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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8119cb06fcf57ccd0036e6a60eb2e8729338c6f2 | f822e186fba019562569857c8601779a3a468932 | /src/cpp/lib/tw/common/fractional.h | d20dd92eaa4bc5175b0b4519ac537cedae03ad65 | [] | no_license | ssh352/code_repo | cd418db35d80892c0a56c5292f7c5eba25295641 | 15848a274939696f620696093fbcc42dc3a46b79 | refs/heads/master | 2023-03-19T14:08:31.777110 | 2017-05-10T18:37:26 | 2017-05-10T18:37:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,062 | h | fractional.h | #pragma once
#include <tw/common/defs.h>
#include <stdio.h>
namespace tw {
namespace common {
// Very CRUDE implementation of convertion from fraction
// to num/denom - precision is limited by the value of CM!
//
class Fractional {
public:
typedef std::pair<uint32_t, uint32_t> TFraction;
static const uint64_t CM = 1000000000;
static uint64_t GCD(uint64_t numer, uint64_t denom) {
while(true) {
int rem = denom%numer;
if(rem == 0) return numer;
denom = numer;
numer = rem;
}
}
static TFraction getFraction(double d) {
TFraction fraction;
uint64_t num = (uint64_t)(d * CM);
uint64_t den = CM;
uint64_t gcd = GCD(num,den);
num /= gcd;
den /= gcd;
fraction.first = static_cast<TFraction::first_type>(num);
fraction.second = static_cast<TFraction::second_type>(den);
return fraction;
}
// TODO: right now precision is between 0 and 7 (per CME, maximum
// precision can be up to 7 characters)
//
static uint32_t getPrecision(uint64_t numer, uint64_t denom) {
static double EPSILON = 0.000000005;
uint32_t precision = 0;
if ( denom > 1) {
double d = static_cast<double>(numer)/static_cast<double>(denom);
char buffer[256];
sprintf(buffer, "%.7f", d+EPSILON);
char* iter = buffer + ::strlen(buffer) - 1;
char* end = iter - 7;
precision = 7;
for ( ; iter != end; --iter ) {
if ( *iter != '0' )
break;
--precision;
}
}
return precision;
}
};
} // namespace common
} // namespace tw
|
7f1701df26b10f9e9680cb9abd26bbb7165d05b3 | e7974412fb23b838aa1f36e7e79508b161cb0b28 | /DS codes/searching_sorting/intersection_of_2_sorted_linked_list/main.cpp | 6653ee78565c9f64dcb08a12798c2368c61a2524 | [] | no_license | tanvitiwari17/DSA_cpp | d927f63356fe9add95c4d64ddd609797385f7fea | 3acdbd648bf357c5148977e91f4099b540205945 | refs/heads/master | 2023-03-22T18:45:56.181200 | 2021-03-19T17:26:46 | 2021-03-19T17:26:46 | 298,234,345 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 622 | cpp | main.cpp | Node* findIntersection(Node* head1, Node* head2)
{
Node* temp1=head1;
Node* temp2=head2;
Node* head=NULL;
Node* temp=NULL;
while(temp1!=NULL and temp2!=NULL)
{
if(temp1->data == temp2->data)
{
Node* new_node = new Node(temp1->data);
if(head)
temp->next = new_node;
else
head= new_node;
temp=new_node;
temp1=temp1->next;
temp2=temp2->next;
}
else if(temp1->data<temp2->data)
temp1=temp1->next;
else
temp2=temp2->next;
}
return head;
}
|
3ccda6e2459c9fafeea5fa782b8f295b7cdb0734 | e645ebf3b5177eb0ebedb7f239bd6e1b40bf1b07 | /packages/pex_logging/src/ScreenLog.cc | b2345be60edcc3f4690e628f317264bc983cd250 | [] | no_license | lsst-dm/bp | e095cdb7412124fef39bdd8428fce70bbf0f462a | 31c0b65866d06a09575a53d0dd558320e6994a06 | refs/heads/main | 2023-07-22T11:32:48.479329 | 2023-07-10T00:30:32 | 2023-07-10T00:30:32 | 37,212,636 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,694 | cc | ScreenLog.cc | /*
* LSST Data Management System
* Copyright 2008, 2009, 2010 LSST Corporation.
*
* This product includes software developed by the
* LSST Project (http://www.lsst.org/).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the LSST License Statement and
* the GNU General Public License along with this program. If not,
* see <http://www.lsstcorp.org/LegalNotices/>.
*/
/**
* @file ScreenLog.cc
* @author Ray Plante
*/
#include "lsst/pex/logging/ScreenLog.h"
#include <iostream>
#include <boost/shared_ptr.hpp>
using namespace std;
namespace lsst {
namespace pex {
namespace logging {
//@cond
using boost::shared_ptr;
using lsst::daf::base::PropertySet;
///////////////////////////////////////////////////////////
// ScreenLog
///////////////////////////////////////////////////////////
/*
* create a Log that will write messages to a given file
* @param threshold the importance threshold to set for messages going
* to the screen.
* @param verbose if true, all message data properties will be printed
* to the screen. If false, only the Log name
* ("LOG") and the text comment ("COMMENT") will be
* printed.
* @param preamble a list of data properties that should be included
* with every recorded message to the Log. This
* constructor will automatically add a property
* ("LOG") giving the Log name.
*/
ScreenLog::ScreenLog(const PropertySet& preamble, bool verbose, int threshold)
: Log(threshold), _screen(0), _screenFrmtr(0)
{
configure(verbose);
_preamble->combine(preamble.deepCopy());
}
/*
* create a Log that will write messages to a given file
* @param threshold the importance threshold to set for messages going
* to the screen.
* @param verbose if true, all message data properties will be printed
* to the screen. If false, only the Log name
* ("LOG") and the text comment ("COMMENT") will be
* printed.
* @param preamble a list of data properties that should be included
* with every recorded message to the Log. This
* constructor will automatically add a property
* ("LOG") giving the Log name.
*/
ScreenLog::ScreenLog(bool verbose, int threshold)
: Log(threshold), _screen(0), _screenFrmtr(0)
{
configure(verbose);
}
void ScreenLog::configure(bool verbose) {
// note that the shared_ptr held by the screen LogDestination will
// handle the deletion of this pointer.
_screenFrmtr = new IndentedFormatter(verbose);
shared_ptr<LogFormatter> fmtr(_screenFrmtr);
// note that the shared_ptr held by LogDestination list will
// handle the deletion of this pointer.
_screen = new LogDestination(&clog, fmtr, INHERIT_THRESHOLD);
shared_ptr<LogDestination> dest(_screen);
_destinations.push_back( dest );
}
ScreenLog::~ScreenLog() { }
/*
* copy another ScreenLog into this one
*/
ScreenLog& ScreenLog::operator=(const ScreenLog& that) {
if (this == &that) return *this;
dynamic_cast<Log*>(this)->operator=(that);
_screen = that._screen;
_screenFrmtr = that._screenFrmtr;
return *this;
}
/**
* create a new log and set it as the default Log
* @param preamble a list of data properties that should be included
* with every recorded message to the Log. This
* constructor will automatically add a property
* ("LOG") giving the Log name.
* @param threshold the importance threshold to set for messages going
* to the screen.
* @param verbose if true, all message data properties will be printed
* to the screen. If false, only the Log name
* ("LOG") and the text comment ("COMMENT") will be
* printed.
*/
void ScreenLog::createDefaultLog(const PropertySet& preamble,
bool verbose, int threshold)
{
Log::setDefaultLog(new ScreenLog(preamble, verbose, threshold));
}
/*
* create a new log and set it as the default Log
* @param preamble a list of data properties that should be included
* with every recorded message to the Log. This
* constructor will automatically add a property
* ("LOG") giving the Log name.
* @param threshold the importance threshold to set for messages going
* to the screen.
* @param verbose if true, all message data properties will be printed
* to the screen. If false, only the Log name
* ("LOG") and the text comment ("COMMENT") will be
* printed.
*/
void ScreenLog::createDefaultLog(bool verbose, int threshold) {
Log::setDefaultLog(new ScreenLog(verbose, threshold));
}
//@endcond
}}} // end lsst::pex::logging
|
b6bda6c08f5ff37cad77cf509e6a726113e364d5 | db6f3e6486ad8367c62163a4f124da185a64ab5d | /include/retdec/llvmir2hll/graphs/cg/cg_writers/graphviz_cg_writer.h | 9b6f66972d744a3d775933e4a8809d4cb5dfae28 | [
"MIT",
"Zlib",
"JSON",
"LicenseRef-scancode-unknown-license-reference",
"MPL-2.0",
"BSD-3-Clause",
"GPL-2.0-only",
"NCSA",
"WTFPL",
"BSL-1.0",
"LicenseRef-scancode-proprietary-license",
"Apache-2.0"
] | permissive | avast/retdec | c199854e06454a0e41f5af046ba6f5b9bfaaa4b4 | b9791c884ad8f5b1c1c7f85c88301316010bc6f2 | refs/heads/master | 2023-08-31T16:03:49.626430 | 2023-08-07T08:15:07 | 2023-08-14T14:09:09 | 113,967,646 | 3,111 | 483 | MIT | 2023-08-17T05:02:35 | 2017-12-12T09:04:24 | C++ | UTF-8 | C++ | false | false | 1,375 | h | graphviz_cg_writer.h | /**
* @file include/retdec/llvmir2hll/graphs/cg/cg_writers/graphviz_cg_writer.h
* @brief A CG writer in the @c dot format (@c graphviz).
* @copyright (c) 2017 Avast Software, licensed under the MIT license
*/
#ifndef RETDEC_LLVMIR2HLL_GRAPHS_CG_CG_WRITERS_GRAPHVIZ_CG_WRITER_H
#define RETDEC_LLVMIR2HLL_GRAPHS_CG_CG_WRITERS_GRAPHVIZ_CG_WRITER_H
#include <ostream>
#include <string>
#include "retdec/llvmir2hll/graphs/cg/cg.h"
#include "retdec/llvmir2hll/graphs/cg/cg_writer.h"
#include "retdec/llvmir2hll/support/smart_ptr.h"
namespace retdec {
namespace llvmir2hll {
/**
* @brief A CG writer in the @c dot format (@c graphviz).
*
* For more information on the @c dot format, see http://www.graphviz.org/.
*
* Use create() to create instances. Instances of this class have
* reference object semantics.
*/
class GraphvizCGWriter: public CGWriter {
public:
static ShPtr<CGWriter> create(ShPtr<CG> cg, std::ostream &out);
virtual std::string getId() const override;
virtual bool emitCG() override;
private:
/// Mapping between a node and its label.
using NodeLabelMapping = std::map<ShPtr<Function>, std::string>;
private:
GraphvizCGWriter(ShPtr<CG> cg, std::ostream &out);
void emitNode(ShPtr<Function> caller, ShPtr<CG::CalledFuncs> callees);
std::string getNodeLabelForFunc(ShPtr<Function> func);
};
} // namespace llvmir2hll
} // namespace retdec
#endif
|
9b861329d07e12cd5fc1bc5b2ad8a9e6e8575803 | c68f966b526d2913e5195a1ff1075cc37f3ce3a5 | /helloAnimation/helloAnimation/main.cpp | 0e769f787b534879df4c59ad662cd0a3f3bb07e3 | [] | no_license | jurianne/FirstOpenGL_Intaraction | 6630c889c8662cdf40b269181bfb0656bad54b11 | 48c6f0d54da9f4904e521e6cbbb5b5410664dc0e | refs/heads/master | 2020-03-13T04:57:32.438443 | 2018-04-25T08:12:23 | 2018-04-25T08:12:23 | 130,972,939 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,268 | cpp | main.cpp | //
// main.cpp
// helloAnimation
//
// Created by Juri Fujii on 2018/04/24.
// Copyright © 2018 jf. All rights reserved.
//
#include <iostream>
#include <OpenGL/OpenGL.h>
#include <GLUT/GLUT.h>
#include <math.h>
float r = 0.7; //radius 半径
GLenum mode = GL_LINES; //描画するモード
float red = 0.0;
float blue =0.0;
int count = 0;
float divNum = 100.0;
void display(){ //displayが関数の名前
//draw something
glClear(GL_COLOR_BUFFER_BIT); // 背景を描く.buffer=メモリーの1個の領域.
//draw rectangle
glColor3f(red,blue,1.0); //マウスで色を変える//色は0~1で指定
glBegin(mode); // beginで始まったら絶対endで終わる.頂点をその間に指定する
//1個前の値を入れる箱
float prev_x = 0.0;
float prev_y = 0.0;
//for ( float t =0.0; t < 2*M_PI + 0.05; t += 0.05){//2M_PIで1周 M_PIは円3.14 t = theta 角度
for(float f = 0.0; f < divNum + 1.0; f += 1.0){
//三角関数
//float x = r * cos(t);
//float y = r * sin(t);
float x = r * cos(2*M_PI * (f/divNum));
float y = r * sin((2*M_PI * (f/divNum)));
if(f != 0.0){
glVertex3f(prev_x, prev_y,0.0);//1個前の座標と今の座標をつなぐ
glVertex3f(x,y,0.0);//1個前の座標地をどこに保存するのか?
}
prev_x = x;
prev_y = y;
}
glEnd();
glFlush(); //絵かいて! //データを実行
glutPostRedisplay(); //強制再描画.
}
void keyboard(unsigned char key, int x, int y){ //パラメータ 一つ目は文字じゃなきゃいけない
if(key == 'q'){
exit(0);//プログラムを終了する quit program
}else if(key == '1'){//そうじゃなくてもし〜
mode = GL_POINTS;
count++;
}else if(key == '2' ){
mode = GL_LINES;
count++;
}else if(key == '3'){
mode = GL_POLYGON;
count++;
}
std::cout << count << "\n"; //デバック.コンソールに数値を表示
}
void mouse(int x, int y){ //x座標 y座標
red = (float)x/500.0; //型変換(キャスト)
blue = (float)y / 500.0;
divNum =(float)y/50 +1;
//r =(float)x/500.0;
glutPostRedisplay();
std::cout << red << "\n"; //デバック.コンソールに数値を表示
}
int main(int argc, char * argv[]) {
glutInit(&argc, argv); //initialize初期化
glutInitDisplayMode(GLUT_RGB); //Display Mode
glutInitWindowSize(500,500); //window size
glutCreateWindow("hello graphics"); // Create Window "ウィンドウ名"
glutDisplayFunc(display); //上の#13のdisplayという関数につながるので名前は一致させること
//キーボード入力を可能にする
glutKeyboardFunc(keyboard);//キーボード入力を許可
glutMotionFunc(mouse); // ()の中はその機能を諸々入れる関数名を入れとく
//ここで指定した関数はmainの上に書かないと実行できない
glClearColor(0.0,0.0,0.0,0.0); //Clear Color 背景の色 RGB + アルファ 光の3原色
glutMainLoop();
return 0;
}
|
9c769564ea6bd5970cbf6a5223003fa67fa37460 | 60b5ec80238d53f25a06abfe1671b8ca55d706bc | /12- Table Sorting using 2D array.cpp | c4f50bdeb54cbd2e0bcecc0afce76ad3b9f4e493 | [] | no_license | talhaansari77/CPlusePluse_Basic | d163cffc95c372cdefaec4e7d799d9048773ea85 | 2dd004b63ec4bcb008a894b523a020802b6b6b9a | refs/heads/master | 2022-12-02T04:17:44.369207 | 2020-08-19T16:58:32 | 2020-08-19T16:58:32 | 288,846,046 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 714 | cpp | 12- Table Sorting using 2D array.cpp | //Data Sorting of Table(order 5x5) using 2-D array
#include<iostream>
using namespace std;
void main()
{
int a[5][5]={{20,17,19,16,18},{24,25,21,23,22},{11,15,14,12,13},{9,8,7,6,10},{5,2,3,1,4}};
int temp;
for(int k=0;k<25;k++)//to repeat sorting mechanism
{
for(int i=0;i<5;i++)
{
for(int j=0;j<5;j++)
{
if(j<4)
{
if(a[i][j]>a[i][j+1])
{
temp=a[i][j];
a[i][j]=a[i][j+1];
a[i][j+1]=temp;
}
}
else if(j==4 && i<4)
{
if(a[i][4]>a[i+1][0])
{
temp=a[i][4];
a[i][4]=a[i+1][0];
a[i+1][0]=temp;
}
}
}
}
}
//To output sorted elements
for(int m=0;m<5;m++)
{
for(int n=0;n<5;n++)
{
cout<<a[m][n]<<" ";
}
cout<<endl;
}
}
|
9e0c403aac85a47d7b4e96d080a9fc576f2fa633 | 711bafd4272699312251d1ea07a7d69ee72998a1 | /填充同一层的兄弟节点 II.cpp | 2478430ea6b3dc439ad07c944c71f77fef604c76 | [] | no_license | songjunyu/LeetCode | dbe18740f659cd7d8d4e227fded3603efe73637f | e17a1d14878271a5db13084ba38a98c7b6ba5bd5 | refs/heads/master | 2022-04-07T06:59:45.835123 | 2019-12-29T08:23:59 | 2019-12-29T08:23:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,728 | cpp | 填充同一层的兄弟节点 II.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <utility>
#include <queue>
#include <functional>
using namespace std;
/*
和上一题的区别是,这是普通的二叉树,中间会有空缺的节点;
题目要求常数的辅助空间,所以不能使用队列进行BFS
自己使用了类似上一题的方法,但写的比较复杂,需要设置3个指针,分别指向存在子节点的父节点、当前子节点,每层存在子节点的最左节点。
主要难点是如何判断next指针的情况,有几种情况:
1.当前结点是父节点的左节点:
1.1父节点存在右节点,当前结点的next指向右节点
1.2父节点不存在右节点,即将父节点指向父节点的next,然后判断是否子节点,并是当前结点指向这个。
2.当前结点是父节点的有节点,即判断下一个父节点的子树。
可以将两种情况合并一下,但总体来说,还是比较复杂
网上的方法比较简单,首先创建一个缓存结点,用来记录,再创建一个指针,指向这个缓存结点。
https://blog.csdn.net/qq_36627886/article/details/80359679
*/
//struct TreeNode {
// int val;
// TreeNode *left;
// TreeNode *right;
// TreeNode(int x) : val(x), left(NULL), right(NULL) {}
//};
struct TreeLinkNode {
int val;
TreeLinkNode *left, *right, *next;
TreeLinkNode(int x) : val(x), left(NULL), right(NULL), next(NULL) {}
};
class Solution
{
public:
void connect(TreeLinkNode *root)
{
if (!root)
return;
TreeLinkNode *parent = root;
TreeLinkNode *current = nullptr;
TreeLinkNode *first = root->left ? root->left : root->right;
while (first)
{
current = first;
while (current)
{
if (current == parent->left && parent->right)
current->next = parent->right;
else
{
current->next = FindNode(parent->next);
parent = parent->next;
}
current = current->next;
}
parent = first;
while (parent && !(parent->left || parent->right))
parent = parent->next;
if (!parent)
return;
first = parent->left ? parent->left : parent->right;
}
}
void connect_network(TreeLinkNode *root)
{
TreeLinkNode *temp = new TreeLinkNode(0);//缓存结点
TreeLinkNode *left = temp;
while (root)
{
if (root->left)
{
left->next = root->next;
left = root->left;
}
if (root->right)
{
//这里的left是已经指向同一层中前一个结点,所以要连接下一个右节点
left->next = root->right;
left = root->right;
}
root = root->next;//当前父节点已经遍历完,进入同一层中下一个父节点
if (!root)
{
//若为空,说明同一层遍历完了,要开始将root变到下一层
left = temp;
root = temp->next;
temp->next = nullptr;
}
}
}
private:
//用于寻找父节点下存在的左右节点,并返回子节点
TreeLinkNode* FindNode(TreeLinkNode *root)
{
while (root)
{
if (root->left)
return root->left;
else if (root->right)
return root->right;
else
root = root->next;
}
return nullptr;
}
};
int main()
{
TreeLinkNode node1{ 1 };
TreeLinkNode node2{ 2 };
TreeLinkNode node3{ 3 };
TreeLinkNode node4{ 4 };
TreeLinkNode node5{ 5 };
TreeLinkNode node6{ 6 };
TreeLinkNode node7{ 7 };
node1.left = &node2;
node1.right = &node3;
node2.left = &node4;
//node2.right = &node5;
node3.right = &node5;
node4.left = &node6;
node5.right = &node7;
Solution a;
a.connect(&node1);
TreeLinkNode *p = &node1;
while (p)
{
TreeLinkNode *q = p;
while (q)
{
cout << q->val << " ";
q = q->next;
}
cout << endl;
p = p->left;
}
system("pause");
return 0;
}
|
8a77fd4eaea5fac688fc23c9a242048febca6443 | 9c451121eaa5e0131110ad0b969d75d9e6630adb | /hdu/1000-1999/1287 破译密码.cpp | c90adc6513933627f22d78142a90244908275034 | [] | no_license | tokitsu-kaze/ACM-Solved-Problems | 69e16c562a1c72f2a0d044edd79c0ab949cc76e3 | 77af0182401904f8d2f8570578e13d004576ba9e | refs/heads/master | 2023-09-01T11:25:12.946806 | 2023-08-25T03:26:50 | 2023-08-25T03:26:50 | 138,472,754 | 5 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,399 | cpp | 1287 破译密码.cpp | ////////////////////System Comment////////////////////
////Welcome to Hangzhou Dianzi University Online Judge
////http://acm.hdu.edu.cn
//////////////////////////////////////////////////////
////Username: tokitsukaze
////Nickname: tokitsukaze
////Run ID:
////Submit time: 2017-07-05 17:04:34
////Compiler: GUN C++
//////////////////////////////////////////////////////
////Problem ID: 1287
////Problem Title:
////Run result: Accept
////Run time:15MS
////Run memory:1672KB
//////////////////System Comment End//////////////////
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cctype>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <ctime>
#define mem(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int INF=0x3f3f3f3f;
const double PI=acos(-1.0);
const double eps=1e-6;
const ll mod=1e9+7;
const int MAX=1e5+10;
int main()
{
int n,v[1111],i,j;
char ans[1111];
while(~scanf("%d",&n))
{
for(i=0;i<n;i++)
{
scanf("%d",&v[i]);
}
mem(ans,0);
for(i='A';i<='Z';i++)
{
int flag=0;
for(j=0;j<n;j++)
{
ans[j]=i^v[j];
if(ans[j]<'A'||ans[j]>'Z')
{
flag=1;
break;
}
}
if(!flag) break;
}
ans[n]='\0';
puts(ans);
}
return 0;
} |
63e7673abbe4d9b0cc28ee643845d4fc0aa9c096 | aeaf5b83ccd26792e2baaa47ecc35d1f2f7881ce | /src/Renderer.h | c62b0395fa82ca002a7da7fa04b20d8d7273025f | [
"Unlicense",
"MIT"
] | permissive | alaingalvan/directx12-seed | 13078bab4aa58b2fce3bdb009da239f88b7c89f8 | c8711b02ca8f4b51c827ad2bc5fbd3f9286ee237 | refs/heads/master | 2022-06-19T01:57:48.278104 | 2022-01-02T19:04:56 | 2022-01-02T19:04:56 | 208,545,085 | 96 | 21 | null | null | null | null | UTF-8 | C++ | false | false | 3,805 | h | Renderer.h | #pragma once
#include "CrossWindow/CrossWindow.h"
#include "CrossWindow/Graphics.h"
#define GLM_FORCE_SSE42 1
#define GLM_FORCE_DEFAULT_ALIGNED_GENTYPES 1
#define GLM_FORCE_LEFT_HANDED
#include "glm/glm.hpp"
#include "glm/gtc/matrix_transform.hpp"
#include <algorithm>
#include <chrono>
#include <fstream>
#include <iostream>
#include <vector>
#include <direct.h>
// Common Utils
inline std::vector<char> readFile(const std::string& filename)
{
std::ifstream file(filename, std::ios::ate | std::ios::binary);
bool exists = (bool)file;
if (!exists || !file.is_open())
{
throw std::runtime_error("failed to open file!");
}
size_t fileSize = (size_t)file.tellg();
std::vector<char> buffer(fileSize);
file.seekg(0);
file.read(buffer.data(), fileSize);
file.close();
return buffer;
};
// Renderer
class Renderer
{
public:
Renderer(xwin::Window& window);
~Renderer();
// Render onto the render target
void render();
// Resize the window and internal data structures
void resize(unsigned width, unsigned height);
protected:
// Initialize your Graphics API
void initializeAPI(xwin::Window& window);
// Destroy any Graphics API data structures used in this example
void destroyAPI();
// Initialize any resources such as VBOs, IBOs, used in this example
void initializeResources();
// Destroy any resources used in this example
void destroyResources();
// Create graphics API specific data structures to send commands to the GPU
void createCommands();
// Set up commands used when rendering frame by this app
void setupCommands();
// Destroy all commands
void destroyCommands();
// Set up the FrameBuffer
void initFrameBuffer();
void destroyFrameBuffer();
// Set up the RenderPass
void createRenderPass();
void createSynchronization();
// Set up the swapchain
void setupSwapchain(unsigned width, unsigned height);
struct Vertex
{
float position[3];
float color[3];
};
Vertex mVertexBufferData[3] = {{{1.0f, -1.0f, 0.0f}, {1.0f, 0.0f, 0.0f}},
{{-1.0f, -1.0f, 0.0f}, {0.0f, 1.0f, 0.0f}},
{{0.0f, 1.0f, 0.0f}, {0.0f, 0.0f, 1.0f}}};
uint32_t mIndexBufferData[3] = {0, 1, 2};
std::chrono::time_point<std::chrono::steady_clock> tStart, tEnd;
float mElapsedTime = 0.0f;
// Uniform data
struct
{
glm::mat4 projectionMatrix;
glm::mat4 modelMatrix;
glm::mat4 viewMatrix;
} uboVS;
static const UINT backbufferCount = 2;
xwin::Window* mWindow;
unsigned mWidth, mHeight;
// Initialization
IDXGIFactory4* mFactory;
IDXGIAdapter1* mAdapter;
#if defined(_DEBUG)
ID3D12Debug1* mDebugController;
ID3D12DebugDevice* mDebugDevice;
#endif
ID3D12Device* mDevice;
ID3D12CommandQueue* mCommandQueue;
ID3D12CommandAllocator* mCommandAllocator;
ID3D12GraphicsCommandList* mCommandList;
// Current Frame
UINT mCurrentBuffer;
ID3D12DescriptorHeap* mRtvHeap;
ID3D12Resource* mRenderTargets[backbufferCount];
IDXGISwapChain3* mSwapchain;
// Resources
D3D12_VIEWPORT mViewport;
D3D12_RECT mSurfaceSize;
ID3D12Resource* mVertexBuffer;
ID3D12Resource* mIndexBuffer;
ID3D12Resource* mUniformBuffer;
ID3D12DescriptorHeap* mUniformBufferHeap;
UINT8* mMappedUniformBuffer;
D3D12_VERTEX_BUFFER_VIEW mVertexBufferView;
D3D12_INDEX_BUFFER_VIEW mIndexBufferView;
UINT mRtvDescriptorSize;
ID3D12RootSignature* mRootSignature;
ID3D12PipelineState* mPipelineState;
// Sync
UINT mFrameIndex;
HANDLE mFenceEvent;
ID3D12Fence* mFence;
UINT64 mFenceValue;
}; |
cfe621b7dc9b1df25f715e51f25aa0ca1def01c1 | 64770fa89f6bd2366fa6020d27f63a1892511d3a | /testes.cpp | 6eaa5d85df58caacada695af7253caa17e9da263 | [] | no_license | Ueeda/NFU_Study | 11da4bbefc307082e0aef0e29a2a3ae2ba1927e8 | 048d69d9cc1f538796a061e182105a781d8ba9a6 | refs/heads/master | 2022-04-24T12:38:13.582144 | 2020-04-18T12:38:50 | 2020-04-18T12:38:50 | 256,748,789 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,250 | cpp | testes.cpp | #include <stdio.h>
#include <stdlib.h>
typedef struct estrutura_paginas_virtuais{
int valor;
int idade;
struct estrutura_paginas_virtuais *prox;
} virtualPage;
virtualPage *pag_ini, *pag, *pag_fim;
void manipulandoArquivo(char *nomeArq, int tamanhoFita, int nArquivo);
int idadeMax(int tamanhoFita);
void main(){
int fat = idadeMax(4);
printf("%d", fat);
/*manipulandoArquivo("arquivos/arquivo1.txt", 4,1);
manipulandoArquivo("arquivos/arquivo2.txt", 4,2);
manipulandoArquivo("arquivos/arquivo3.txt", 64,3);
manipulandoArquivo("arquivos/arquivo3.txt", 256,3);
manipulandoArquivo("arquivos/arquivo3.txt", 1024,3);
manipulandoArquivo("arquivos/arquivo3.txt", 2048,3);
manipulandoArquivo("arquivos/arquivo4.txt", 64,4);
manipulandoArquivo("arquivos/arquivo4.txt", 256,4);
manipulandoArquivo("arquivos/arquivo4.txt", 1024,4);
manipulandoArquivo("arquivos/arquivo4.txt", 2048,4);*/
}
void manipulandoArquivo(char *nomeArq, int tamanhoFita, int nArquivo){
int tamanhoMax = tamanhoFita;
int numeroArq = nArquivo;
char ch[10];
int valorAtual = 0;
int pageFaults = 0;
int idadeMax = idadeMax(tamanhoMax);
}
int idadeMax(int tamanhoFita){
int i, fat;
for(i = 0; i < (tamanhoFita - 1); i++){
fat += 2 ^i ;
}
return fat;
}
|
bd1e68bdaa7b5bbebd241cf9fa90cb5ee5fdff2b | f8fef63c2cdd5324f13b6cdc4a3a0fc507afbe87 | /DarkSoulsAnimTool/utility.hpp | e91f892172165459fc25d9cf0d87a514d253fd65 | [
"MIT"
] | permissive | Meowmaritus/DarkSoulsAnimTool | 0417fe0827a613ef14ca7aede9d4f5c61478b251 | 1dbfce7f3886aa746dc707395c6da29a20c27a0e | refs/heads/master | 2021-07-23T17:44:04.887379 | 2017-11-02T18:29:53 | 2017-11-02T18:29:53 | 109,303,500 | 0 | 0 | null | 2017-11-02T18:28:18 | 2017-11-02T18:28:17 | null | UTF-8 | C++ | false | false | 316 | hpp | utility.hpp | #pragma once
#include "UTF8-CPP\checked.h"
#include <string>
#include <algorithm>
std::string utf16ToUtf8(std::wstring inputText) {
std::string result;
utf8::utf16to8(
inputText.c_str(),
inputText.c_str() + inputText.length(),
std::back_inserter(result)
);
return result;
}
|
22086a424be08fec7129c86eaa103b52cf2aa40a | 85fd3112e0c531b071a86fe873cdf6becb69352b | /difalpha.cc | 82c6dd916a439aade7c00d5dc0b409ae9edc1dd3 | [] | no_license | k0k1maekawa/MMtrigger_sim | 6a0722bc1cfd41cb10ae7668c69c301ec320e1b1 | 3ca085b0377d26ce172c785038e37e8009d19193 | refs/heads/master | 2020-09-07T14:48:25.035666 | 2017-10-10T12:16:05 | 2017-10-10T12:16:05 | 94,430,016 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 93,232 | cc | difalpha.cc | #include "/home/maekawa/atlasstyle-00-03-05/AtlasStyle.C"
#include "/home/maekawa/atlasstyle-00-03-05/AtlasLabels.C"
#include<stdlib.h>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<time.h>
#include<vector>
#include "TMath.h"
#include "TVector3.h"
#include "TLorentzVector.h"
#include "TTree.h"
#include "TFile.h"
#include "TRandom3.h"
#include "TComplex.h"
#include "LinkDef.h"
#include "TF1.h"
#include "TH1.h"
#include "TH2.h"
#include "TH3.h"
#include "TCanvas.h"
#include "TGraph.h"
#include "TGraph2D.h"
#include "TMinuit.h"
#include "TStyle.h"
#include "TROOT.h"
#include <TVector3.h>
#include <TLorentzVector.h>
#include <iomanip>
#include "TFitter.h"
#include "TGraphErrors.h"
using namespace std;
using namespace ROOT::Math;
double Dphi(int sector,double phi){
const double pi = TMath::Pi();
double dphi = phi;
if(sector==0) dphi += pi/8.0;
while(dphi>pi/8.0||dphi<=-pi/8.0){
if(dphi>pi/8.0) dphi -= pi/4.0;
if(dphi<=-pi/8.0) dphi += pi/4.0;
}
return dphi;
}
int SectorAllpat(int n,int *vec){
int Allpat = 0;
int layeron[8]={0};
int d = 0;
for(int i=0;i<n;i++){
d = *vec;
layeron[(d-1)%8] = 1;
++vec;
}
int dlack=0;
for(int d=7;d>-1;d--){
if(layeron[d]==0){
Allpat += (d+1)*pow(10,dlack);
dlack += 1;
}
}
return Allpat;
}
int SectorUVpat(int n,int *vec){
int UVpat = 0;
int layeron[8]={0};
int d = 0;
for(int i=0;i<n;i++){
d = *vec;
layeron[(d-1)%8] = 1;
++vec;
}
int dlack=0;
for(int d=5;d>1;d--){
if(layeron[d]==0){
UVpat += (d-1)*pow(10,dlack);
dlack += 1;
}
}
return UVpat;
}
int SectorXpat(int n,int *vec){
int Xpat = 0;
int layeron[8]={0};
int d = 0;
for(int i=0;i<n;i++){
d = *vec;
layeron[(d-1)%8] = 1;
++vec;
}
int dlack = 0;
for(int d=7;d>5;d--){
if(layeron[d]==0){
Xpat += (d-3)*pow(10,dlack);
dlack += 1;
}
}
for(int d=1;d>-1;d--){
if(layeron[d]==0){
Xpat += (d+1)*pow(10,dlack);
dlack += 1;
}
}
return Xpat;
}
int ForLofU(double u1,double u2,double v1,double v2,double mx,double etaslopewidth){
int flu = -1;
int flv = -1;
double min = 0;
min = abs(u1+v1-2.0*mx); flu = 0; flv = 0;
if(abs(u1+v2-2.0*mx) < min){ min = abs(u1+v2-2.0*mx); flu = 0; flv = 1;}
if(abs(u2+v1-2.0*mx) < min){ min = abs(u2+v1-2.0*mx); flu = 1; flv = 0;}
if(abs(u2+v2-2.0*mx) < min){ min = abs(u2+v2-2.0*mx); flu = 1; flv = 1;}
if(min>etaslopewidth){ flu = -1; flv = -1; }
return flu;
}
int ForLofV(double u1,double u2,double v1,double v2,double mx,double etaslopewidth){
int flu = -1;
int flv= -1;
double min = 0;
min = abs(u1+v1-2.0*mx); flu = 0; flv= 0;
if(abs(u1+v2-2.0*mx) < min){ min = abs(u1+v2-2.0*mx); flu = 0; flv = 1;}
if(abs(u2+v1-2.0*mx) < min){ min = abs(u2+v1-2.0*mx); flu = 1; flv = 0;}
if(abs(u2+v2-2.0*mx) < min){ min = abs(u2+v2-2.0*mx); flu = 1; flv = 1;}
if(min>etaslopewidth){ flu = -1; flv = -1; }
return flv;
}
void UVfit(int n,int *vec,double *slope,int *U_valid,int *V_valid,int *layerbit,double *phicoeff,double etaslopewidth,int uv_fit,int *Grade,int *xuse){//size of layerbit == 8
double h = etaslopewidth/2.0;
int layeron[8]={0};
int layeruse[8]={0};
double layerslope[8]={0};
double layercoeff[8]={0};
double mx = 0;
double mu = 0;
double mv = 0;
int nX = 0;
int nU = 0;
int nV = 0;
int nXuse = 0;
int nUuse = 0;
int nVuse = 0;
int d = 0;
int grade = 0;
for(int i=0;i<n;i++){
d = *vec;
layeron[(d-1)%8] = 1;
layerslope[(d-1)%8] = *slope;
if((d-1)%8<=1||(d-1)%8>=6){
nX += 1;
}else{
if((d-1)%8==2||(d-1)%8==4)nU+=1;
if((d-1)%8==3||(d-1)%8==5)nV+=1;
}
++vec;
++slope;
}
nX = layeron[0]+layeron[1]+layeron[6]+layeron[7];
nU = layeron[2]+layeron[4];
nV = layeron[3]+layeron[5];
int Uvalid = 0;
int Vvalid = 0;
int Xuse = 0;
int Uuse = 0;
int Vuse = 0;
if(uv_fit==1){
if(nU==2)Uvalid = 1;
if(nV==2)Vvalid = 1;
}
if(uv_fit==2||uv_fit==3){
if(nU==2&&abs(layerslope[2]-layerslope[4])<h)Uvalid = 1;
if(nV==2&&abs(layerslope[3]-layerslope[5])<h)Vvalid = 1;
}
if(Uvalid==1&&Vvalid==1){
Xuse = 0;
Uuse = 1;
Vuse = 1;
}
if( (Uvalid==1&&Vvalid==0) || (Uvalid==0&&Vvalid==1) ){
Xuse = 1;
Uuse = Uvalid;
Vuse = Vvalid;
}
if(Uvalid==0&&Vvalid==0){
Xuse = 0;
Uuse = 1;
Vuse = 1;
}
if(uv_fit==0){
Xuse = 1; Uuse = 1; Vuse = 1;
}
if(Xuse==1){
layeruse[0] = layeron[0]; layeruse[1] = layeron[1]; layeruse[6] = layeron[6]; layeruse[7] = layeron[7];
}
if(Uuse==1){
layeruse[2] = layeron[2]; layeruse[4] = layeron[4];
}
if(Vuse==1){
layeruse[3] = layeron[3]; layeruse[5] = layeron[5];
}
if(Uvalid==0&&Vvalid==0&&uv_fit==3){
Xuse = 0;
mx = (layerslope[0]*layeron[0]+layerslope[1]*layeron[1]+layerslope[6]*layeron[6]+layerslope[7]*layeron[7])/1.0/(layeron[0]+layeron[1]+layeron[6]+layeron[7]);
if(ForLofU(layerslope[2],layerslope[4],layerslope[3],layerslope[5],mx,etaslopewidth)==0){
layeruse[2] = layeron[2]; layeruse[4] = 0;
}
if(ForLofU(layerslope[2],layerslope[4],layerslope[3],layerslope[5],mx,etaslopewidth)==1){
layeruse[2] = 0; layeruse[4] = layeron[4];
}
if(ForLofU(layerslope[2],layerslope[4],layerslope[3],layerslope[5],mx,etaslopewidth)==-1){
layeruse[2] = layeron[2]; layeruse[4] = layeron[4];
}//fix
if(ForLofV(layerslope[2],layerslope[4],layerslope[3],layerslope[5],mx,etaslopewidth)==0){
layeruse[3] = layeron[3]; layeruse[5] = 0;
}
if(ForLofV(layerslope[2],layerslope[4],layerslope[3],layerslope[5],mx,etaslopewidth)==1){
layeruse[3] = 0; layeruse[5] = layeron[5];
}
if(ForLofV(layerslope[2],layerslope[4],layerslope[3],layerslope[5],mx,etaslopewidth)==-1){
layeruse[3] = layeron[3]; layeruse[5] = layeron[5];
}//fix
}
if(nU==0||nV==0){
Xuse = 1; Uuse = 0; Vuse = 0;
layeruse[0] = layeron[0]; layeruse[1] = layeron[1]; layeruse[6] = layeron[6]; layeruse[7] = layeron[7];
if(nU>=1){
Uuse = 1;
layeruse[2] = layeron[2]; layeruse[4] = layeron[4];
}
if(nV>=1){
Vuse = 1;
layeruse[3] = layeron[3]; layeruse[5] = layeron[5];
}
}//add
//coeff //fixed
nXuse = layeruse[0]+layeruse[1]+layeruse[6]+layeruse[7];
nUuse = layeruse[2]+layeruse[4];
nVuse = layeruse[3]+layeruse[5];
if(nXuse>=1){Xuse = 1;}else{Xuse = 0;}
if(nUuse>=1){Uuse = 1;}else{Uuse = 0;}
if(nVuse>=1){Vuse = 1;}else{Vuse = 0;}//add
if(Xuse==1){
if(Uuse==1&&Vuse==0){layercoeff[0] = -1.0/nXuse; layercoeff[1] = -1.0/nXuse; layercoeff[6] = -1.0/nXuse; layercoeff[7] = -1.0/nXuse;}
if(Uuse==0&&Vuse==1){layercoeff[0] = 1.0/nXuse; layercoeff[1] = 1.0/nXuse; layercoeff[6] = 1.0/nXuse; layercoeff[7] = 1.0/nXuse;}
if(Uuse==1&&Vuse==1){
mx = (layerslope[0]*layeruse[0]+layerslope[1]*layeruse[1]+layerslope[6]*layeruse[6]+layerslope[7]*layeruse[7])/1.0/nXuse;
mu = (layerslope[2]*layeruse[2]+layerslope[4]*layeruse[4])/1.0/nUuse;
mv = (layerslope[3]*layeruse[3]+layerslope[5]*layeruse[5])/1.0/nVuse;
layercoeff[0] = (mu-mv)/mx/4.0/nXuse; layercoeff[1] = (mu-mv)/mx/4.0/nXuse; layercoeff[6] = (mu-mv)/mx/4.0/nXuse; layercoeff[7] = (mu-mv)/mx/4.0/nXuse;
}
}
if(Uuse==1){
if(Xuse==1&&Vuse==0){layercoeff[2] = 1.0/nUuse; layercoeff[4] = 1.0/nUuse;}
if(Xuse==0&&Vuse==1){layercoeff[2] = 0.5/nUuse; layercoeff[4] = 0.5/nUuse;}
if(Xuse==1&&Vuse==1){layercoeff[2] = 0.5/nUuse; layercoeff[4] = 0.5/nUuse;}
}
if(Vuse==1){
if(Xuse==1&&Uuse==0){layercoeff[3] = -1.0/nVuse; layercoeff[5] = -1.0/nVuse;}
if(Xuse==0&&Uuse==1){layercoeff[3] = -0.5/nVuse; layercoeff[5] = -0.5/nVuse;}
if(Xuse==1&&Uuse==1){layercoeff[3] = -0.5/nVuse; layercoeff[5] = -0.5/nVuse;}
}
//grade //fixed
if(uv_fit==3){
if(nU==2&&nV==2){
if(Uvalid==1&&Vvalid==1)grade = 3;
if(Uvalid+Vvalid==1)grade = 2;
if(Uvalid==0&&Vvalid==0){
if(nUuse==1&&nVuse==1){
grade = 1;
}else{
grade = 0;
}
}
}
if((nU==2&&nV==1)||(nU==1&&nV==2)){
if(Uvalid+Vvalid==1)grade = 2;
if(Uvalid==0&&Vvalid==0){
if(nUuse==1&&nVuse==1){
grade = 1;
}else{
grade = 0;
}
}
}
if((nUuse==2&&nVuse==0)||(nUuse==0&&nVuse==2)){
if(Uvalid+Vvalid==1)grade = 3;
if(Uvalid==0&&Vvalid==0)grade = 0;
}
if(nU==1&&nV==1){
grade = 0;
}
if((nU==1&&nV==0)||(nU==0&&nV==1)){
grade = 0;
}
}
*Grade = grade;
*U_valid = Uvalid;
*V_valid = Vvalid;
*xuse = Xuse;
for(int d=0;d<8;d++){
*layerbit = layeruse[d];
*phicoeff = layercoeff[d];
++layerbit;
++phicoeff;
}
}
double interseclX(double a1, double b1, double c1, double a2, double b2, double c2, double z) {
return a1+(z-c1)/(c2-c1)*(a2-a1);
}
double interseclY(double a1, double b1, double c1, double a2, double b2, double c2, double z) {
return b1+(z-c1)/(c2-c1)*(b2-b1);
}
double intersecX(double a1, double b1, double c1, double theta, double phi, double z) {
return a1+(z-c1)*tan(theta)*cos(phi);
}
double intersecY(double a1, double b1, double c1, double theta, double phi, double z) {
return b1+(z-c1)*tan(theta)*sin(phi);
}
double distance1(double a, double b, double c, double d1, double d2, double d3, double x, double y, double z) {
return ((a-x)*(a-x)+(b-y)*(b-y)+(c-z)*(c-z))-((a-x)*d1+(b-y)*d2+(c-z)*d3)*((a-x)*d1+(b-y)*d2+(c-z)*d3);
}
double distance2(double a, double b, double c, double d1, double d2, double d3, double x, double y, double z, double l1, double l2, double l3) {
double a1d1_a2d1 = 0;
double a1d2_a2d2 = 0;
double cosgamma = 0;
a1d1_a2d1 = (a*d1+b*d2+c*d3)-(x*d1+y*d2+z*d3);
a1d2_a2d2 = (a*l1+b*l2+c*l3)-(x*l1+y*l2+z*l3);
cosgamma = d1*l1+d2*l2+d3*l3;
return ((a-x)*(a-x)+(b-y)*(b-y)+(c-z)*(c-z))-(a1d1_a2d1*a1d1_a2d1-2.0*cosgamma*a1d1_a2d1*a1d2_a2d2+a1d2_a2d2*a1d2_a2d2)/(1-cosgamma*cosgamma);
}
void trackFunction(int& nDim, double* gout, double& result, double par[], int flg) {
double sum = 0;
double a = par[32];
double b = par[33];
double theta = par[30];
double phi = par[31];
double d1 = sin(theta)*cos(phi);
double d2 = sin(theta)*sin(phi);
double d3 = cos(theta);
double x=0;
double y=0;
double z=0;
double ini=0;
for(int p=0;p<34;p++){
ini = par[p];
}
for(int i=0;i<10;i++){
if(fabs(par[3*i])>0.1||fabs(par[3*i+1])>0.1||fabs(par[3*i+2])>0.1){
x = par[3*i];
y = par[3*i+1];
z = par[3*i+2];
sum += distance1(a,b,0,d1,d2,d3,x,y,z);
}
}
result = sum;
}
void minuitFunction(int& nDim, double* gout, double& result, double par[], int flg) {
double sum = 0;
double a = par[62];
double b = par[63];
double c = par[64];
double theta = par[60];
double phi = par[61];
double d1 = sin(theta)*cos(phi);
double d2 = sin(theta)*sin(phi);
double d3 = cos(theta);
double x=0;
double y=0;
double z=0;
double l1=0;
double l2=0;
double l3=0;
double ini=0;
for(int p=0;p<65;p++){
ini = par[p];
}
for(int i=0;i<10;i++){
if(fabs(par[6*i])>0.1||fabs(par[6*i+1])>0.1||fabs(par[6*i+2])>0.1){
x = par[6*i];
y = par[6*i+1];
z = par[6*i+2];
l1 = par[6*i+3];
l2 = par[6*i+4];
l3 = par[6*i+5];
sum += distance2(a, b, c, d1, d2, d3, x, y, z, l1, l2, l3);
}
}
result = sum;
}
void XFitFunction(int& nDim, double* gout, double& result, double par[], int flg) {
double sum = 0;
double a = par[8];
double b = par[9];
double r=0;
double z=0;
double ini=0;
for(int p=0;p<10;p++){
ini = par[p];
}
for(int i=0;i<4;i++){
if(fabs(par[2*i])>0.1||fabs(par[2*i+1])>0.1){
z = par[2*i];
r = par[2*i+1];
sum += sqrt((r-a*z-b)*(r-a*z-b));
}
}
result = sum;
}
int signfunc(double x){
int sgn=0;
if(x>0) sgn=1;
if(x<0) sgn=-1;
return sgn;
}
void difalpha(){
SetAtlasStyle();
int nevent;
int drcut=0;
int first = 0;
int n; //nstrip and so on
double eta1 = 1.2;
double eta2 = 2.9;
char namecore[200]="";
char filename[200];
const int shortcut = 0;
const char* core;
const int checknum=10;
const double zwidth=6;
const int fixon = 1;//fix acceptance definition
const int checkexp = 1;//express errors
const int bg = atoi(getenv("BG"));
int nvertexcrit = 0;
if(bg==1) nvertexcrit = 100000;
const int h_check = 1;
const int uvfit = 2;//using all XUV, "1" means no cut UV fit, "2" means demanding 2U(2V) and these two < etaslopewidth/2.0.
//"3" means add to "2" method, taking coincidence with X
const double slopewidth = atof(getenv("ETASLOPEWIDTH"));
const int robust = 0;//robust algorithm
const int majority = 0;//majority algorithm
const int analytic = 1;//analytic 2d(Xonly) fit
const int takemean = 1;
const int l3d = 1;//calculate local_3d
const double drcutin = 1;//for tight cut of the signal from secondary particles The unit is mm.
const int Ndata = atoi(getenv("NDATA"));
const int truthtracktype = 0; //the way you treat the truth track
//0:tie mu start-point with mu end-point 1:fit for all mupoints 2:treat as curve
const int UVtruth = 1; //0:easy virtual plain (in R-Z 2d plane) 1:virtual plain (calculated in 3d)
const int Xtruth = 1; //0:chi^2 fit 1:virtual plain
const int maxs = 4; //timewindow max = nBC
//constant----------------------------
const double pi = TMath::Pi();
const double lowPtedge = 80000;
if(bg==0) cout<<"Single Mu"<<endl;
if(bg==1) cout<<"BG"<<endl;
if(uvfit==0) cout<<"xuvfit"<<endl;
if(uvfit==1) cout<<"no cut uvfit"<<endl;
if(uvfit==2) cout<<"same as board uvfit"<<endl;
if(uvfit==3) cout<<"exceeding uvfit"<<endl;
if(uvfit==4) cout<<"outlier eliminate"<<endl;
//Plate
double error;
// double max[10] = {0};
// double min[10] = {0};
double test = 0;
int alert[checknum] = {0};
double aofz0=0;
double bofz0=0;
double zintercept3d=0;
double gtheta3d=0;
double ltheta3d=0;
double gphi3d=0;
double lphi3d=0;
double hit_aofz0=0;
double hit_bofz0=0;
double truth_aofz0=0;
double truth_bofz0=0;
double hit_3dtheta=0;
double hit_3dphi=0;
double hit_gtheta3d=0;
double hit_gphi3d=0;
TFitter* minuit = new TFitter(65);
double p1 = -1;
minuit->ExecuteCommand("SET PRINTOUT",&p1,1);
minuit->SetFCN(minuitFunction);
TFitter* track = new TFitter(34);
track->ExecuteCommand("SET PRINTOUT",&p1,1);
track->SetFCN(trackFunction);
TFitter* xfit = new TFitter(10);
xfit->ExecuteCommand("SET PRINTOUT",&p1,1);
xfit->SetFCN(XFitFunction);
double delta[5] = {0};
TF1 *linear = new TF1("lin","tan([0])*(x-[1])");
TF1 *linearl = new TF1("linl","[0]*(x-[1])");
//vector def
vector<double> xofe(4);
vector<double> yofe(4);
vector<double> aofe(4);
vector<double> xyofe(4);
vector<int> dofe(4);
vector<int> dofs(4);
vector<double> rofs(4);
vector<int> signofs(4);
vector<double> exofe(4);
vector<double> eyofe(4);
vector<double> x3d(10);
vector<double> y3d(10);
vector<double> z3d(10);
vector<int> d3d(10);
vector<double> l1ofe(10);
vector<double> l2ofe(10);
vector<double> l3ofe(10);
vector<double> hitxofe(10);
vector<double> hityofe(10);
vector<double> hitxyofe(10);
vector<double> hitexofe(10);
vector<double> hiteyofe(10);
vector<double> hit3dxofe(10);
vector<double> hit3dyofe(10);
vector<double> hit3dzofe(10);
for(int c=0;c<4;c++){
exofe.at(c) = 5.;
eyofe.at(c) = 0.435;
}
for(int c=0;c<10;c++){
hitexofe.at(c) = 0;
hiteyofe.at(c) = 0;
}
//for diffuse
double mx = 0;
int nofmx = 0;
int uvuse = 0;
double u1 = 0;
double u2 = 0;
double v1 = 0;
double v2 = 0;
int nmu[33];
double mur[33];
double mut[33];
double flac;
int nother;
int nmuhit;
double layerz[33] = {0};
double layerzcent[33] = {0};
int layersign[33] = {0};
double ltheta=0;
double b=0;
double errltheta=0;
double errb=0;
double hit_gtheta=0;
double hit_ltheta=0;
double gtheta=0;
double errgtheta=0;
int dd=0;
double resid=0;
double zintercept=0;
double rintercept=0;
double hit_zintercept=0;
double hit_rintercept=0;
string MML = "MML";
TH1D *residhist[6];
//TH2D *residhist[2];
residhist[0] = new TH1D("residual_error","residual error for hit_ltheta",500,-0.002,0.002);
//residhist[0] = new TH2D("residual_error","residual error for hit_ltheta",500,-0.002,0.002,10000,-8000,8000);
residhist[0]->GetXaxis()->SetTitle("residual_error/mm");
residhist[1] = new TH1D("residual_error","residual error for hit_gtheta",500,-5.,5.);
//residhist[1] = new TH2D("residual_error","residual error for hit_gtheta",500,-5.,5.,10000,-8000,8000);
residhist[1]->GetXaxis()->SetTitle("residual_error/mm");
residhist[2] = new TH1D("residual_error","residual error for 3dhit_ltheta",500,-0.01,0.04);
residhist[2]->GetXaxis()->SetTitle("residual_error/mm");
residhist[3] = new TH1D("vetex_to_track","distance of vertex to track",400,-1,19);
residhist[3]->GetXaxis()->SetTitle("distance of vertex to track/mm");
residhist[4] = new TH1D("residual_error","residual error for ltheta",500,-5,5);
residhist[4]->GetXaxis()->SetTitle("residual_error/mm");
residhist[5] = new TH1D("residual_error","residual error for gtheta",500,-5,5);
residhist[5]->GetXaxis()->SetTitle("residual_error/mm");
TH2D *intercepthist[4];//intercepthist
intercepthist[0] = new TH2D("hit_xyatz0-truth","hit_xyofz0-truth",500,-500.,500.,500,-500.,500.);
intercepthist[0]->GetXaxis()->SetTitle("hit_xatz0-truth/mm");
intercepthist[0]->GetYaxis()->SetTitle("hit_yatz0-truth/mm");
intercepthist[1] = new TH2D("hitintercept_and_hit_dtheta","hitintercept and hit_dtheta",500,-2500.,2500.,500,-0.1,0.1);
intercepthist[1]->GetXaxis()->SetTitle("zintercept/mm");
intercepthist[1]->GetYaxis()->SetTitle("dtheta/rad");
intercepthist[2] = new TH2D("xyatz0-truth","xyatz0-truth",500,-500.,500.,500,-500.,500.);
intercepthist[2]->GetXaxis()->SetTitle("xatz0-truth/mm");
intercepthist[2]->GetYaxis()->SetTitle("yatz0-truth/mm");
intercepthist[3] = new TH2D("hitdtheta_and_dtheta","hit_dtheta and dtheta",500,-0.1,0.1,500,-1.,1.);
intercepthist[3]->GetXaxis()->SetTitle("hit_dtheta/rad");
intercepthist[3]->GetYaxis()->SetTitle("dtheta/rad");
//cout <<"Please Enter the Filename before \".root\""<<endl;
strcpy(namecore,getenv("NAMECORE"));
cout<<"NAMECORE = "<<namecore<<endl;
drcut = atof(getenv("DRCUT"));
cout<<"drcut"<<drcut<<endl;
char *ret;
char namefordata[200] = "";
ret = strstr(Form("%s",namecore),"drcut");
if(ret!=NULL){
int drcutlength = strlen(Form("%s",ret));
int namecorelength = strlen(Form("%s",namecore));
strncat(namefordata,Form("%s",namecore),namecorelength-drcutlength);
}else{
//drcut = 1000000;
ret = strstr(Form("%s",namecore),"trig");
if(ret!=NULL){
int triggertypelength = strlen(Form("%s",ret));
int namecorelength = strlen(Form("%s",namecore));
strncat(namefordata,Form("%s",namecore),namecorelength-triggertypelength);
}else{
ret = strstr(Form("%s",namecore),"alg");
if(ret!=NULL){
int algoptionlength = strlen(Form("%s",ret));
int namecorelength = strlen(Form("%s",namecore));
strncat(namefordata,Form("%s",namecore),namecorelength-algoptionlength);
}else{
strcat(namefordata,Form("%s",namecore));
}
}
}
cout<<"Open "<<namefordata<<"memo.root"<<endl;
TFile *filememo = new TFile(Form("%smemo.root",namefordata));
TTree *memo = (TTree*)filememo->Get("memo");
/*TFile *file2[Ndata];
cout<<"Open "<<namefordata<<".root"<<endl;
file2[0] = new TFile(Form("%s.root",namefordata));
for(int d=1;d<Ndata;d++){
file2[d] = new TFile(Form("%s_%d.root",namefordata,d));
}
int ninc[Ndata]={0};
int Ninc = 0;
for(int d=0;d<Ndata;d++){
ninc[d] = Ninc;
cout<<"for"<<d<<"th data "<<ninc[d]<<"event"<<endl;
TTree *data = (TTree*)file2[d]->Get("NSWHitsTree");
Ninc += data->GetEntries();
}
TTree *data = (TTree*)file2[0]->Get("NSWHitsTree");
if(memo->GetEntries()!=Ninc)cout<<"Sum up Error!!"<<endl;*/
int Ninc = memo->GetEntries();
TCanvas *c4 = new TCanvas("");
TCanvas *c5 = new TCanvas("");
char nameforfast[300] = "";
ret = strstr(Form("%s",namecore),"alg");
if(ret!=NULL){
int algoptionlength = strlen(Form("%s",ret));
int namecorelength = strlen(Form("%s",namecore));
strncat(nameforfast,Form("%s",namecore),namecorelength-algoptionlength);
}else{
strcat(nameforfast,Form("%s",namecore));
}
TFile *filefast = new TFile(Form("%sfast.root",nameforfast));
TTree *tree = (TTree*)filefast->Get("fast");
//Treesetting
double hitphi0[33] = {0};
double hiteta0[33] = {0};
double hitz[33] = {0};
double hitx0[33] = {0};
double hity0[33] = {0};
double hitz0[33] = {0};
double hitt0[33] = {0};
memo->SetBranchAddress("hiteta0",hiteta0);
memo->SetBranchAddress("hitphi0",hitphi0);
memo->SetBranchAddress("muz",hitz);
memo->SetBranchAddress("mux0",hitx0);
memo->SetBranchAddress("muy0",hity0);
memo->SetBranchAddress("muz0",hitz0);
memo->SetBranchAddress("mut0",hitt0);
int ndata = 0;
int i = 0;
double time[33] = {0};
int layer[33] = {0};
double x[33] = {0};
double y[33] = {0};
double z[33] = {0};
//int nmu[33]={0};
double mufirst[33]={0};
/* double mux[33] = {0};
double muy[33] = {0};
double muz[33] = {0};
double mut[33] = {0};
double mux0[33] = {0};
double muy0[33] = {0};
double muz0[33] = {0};
double mut0[33] = {0};*/
double lx[33] = {0};
double ly[33] = {0};
double dr0[33] = {0};
int sign[33] = {0};
int dial = 0;
double mueta = 0;
double muentryeta = 0;
int nhit = 0;
int neta = 0;
int nstereo = 0;
int sector=0;
int band = 0;
tree->SetBranchAddress("ndata",&ndata);
tree->SetBranchAddress("i",&i);
tree->SetBranchAddress("layer",layer);
tree->SetBranchAddress("time",time);
tree->SetBranchAddress("dial",&dial);
tree->SetBranchAddress("mueta",&mueta);
tree->SetBranchAddress("muentryeta",&muentryeta);
tree->SetBranchAddress("nhit",&nhit);
tree->SetBranchAddress("neta",&neta);
tree->SetBranchAddress("nstereo",&nstereo);
tree->SetBranchAddress("x",x);
tree->SetBranchAddress("y",y);
tree->SetBranchAddress("z",z);
/*tree->SetBranchAddress("mux",mux);
tree->SetBranchAddress("muy",muy);
tree->SetBranchAddress("muz",muz);
tree->SetBranchAddress("mut",mut);
tree->SetBranchAddress("mux0",mux0);
tree->SetBranchAddress("muy0",muy0);
tree->SetBranchAddress("muz0",muz0);
tree->SetBranchAddress("mut0",mut0);*/
tree->SetBranchAddress("lx",lx);
tree->SetBranchAddress("ly",ly);
tree->SetBranchAddress("dr0",dr0);
tree->SetBranchAddress("sign",sign);
tree->SetBranchAddress("sector",§or);
tree->SetBranchAddress("band",&band);
//int numbers
int efef[33]={0};
//layer
int ef[33][maxs]={{0}};
//layer:time
int en[5][maxs]={{0}};
//neta:time (8 layer hit 4 stereo layer hit)
int esn[5][5][maxs]={{{0}}};
//neta:nstereo:time (8 layer hit 4 stereo layer hit)
double esdelta[5][5][maxs]={{{0}}};
double edelta[5][maxs]={{0}};
double hit_esdelta[5][5][maxs]={{{0}}};
double hit_edelta[5][maxs]={{0}};
double sigma_sltheta[5][5][maxs]={{{0}}};
double sigma_ltheta[5][maxs]={{0}};
double sigma_sgtheta[5][5][maxs]={{{0}}};
double sigma_gtheta[5][maxs]={{0}};
int def[33]={0};//denomi of each
//layer
int dnf[17]={0};//denomi of nthrough
//nthrough
int dsnf[17][9]={{0}};//denomi of nthrough and nstereo
//nthrough:nstereothrough
double x0=0;
double y0=0;
double z0=0;
double eta0=0;
double phi0=0;
double pt0=0;
int pdg0=0;
unsigned int vertex_n=0;
memo->SetBranchAddress("x0",&x0);
memo->SetBranchAddress("y0",&y0);
memo->SetBranchAddress("z0",&z0);
memo->SetBranchAddress("vertex_n",&vertex_n);
memo->SetBranchAddress("pdg0",&pdg0);
memo->SetBranchAddress("eta0",&eta0);
memo->SetBranchAddress("pt0" ,&pt0);
memo->SetBranchAddress("phi0",&phi0);
//for fitting
int nfast = tree->GetEntries();
nevent = memo->GetEntries();
cout<<nfast<<"nfast"<<endl;
cout<<Ninc<<"all events"<<endl;
TH1D *phihist[33];
TH1D *etahist[33];
char histname1[32], histname2[32];
for(int i=0; i<33; i++){
sprintf(histname1, "phi%d", i);
sprintf(histname2, "h%d phi", i);
phihist[i] = new TH1D(histname1, histname2, round(5.608*sqrt(nevent)/100)*100, -3.2, 3.2);
}
for(int i=0; i<33; i++){
sprintf(histname1, "eta%d", i);
sprintf(histname2, "h%d eta", i);
etahist[i] = new TH1D(histname1, histname2, round(5.608*sqrt(nevent)/100)*100, -3.0, 3.0);
}
n = 0;
first = 0;
int f = 0;
TGraphErrors *mint[Ninc];
TGraphErrors *hit[Ninc];
//get layer info
int nlayerz = 0;
for(int i = 0; i < nfast; i++){
cout<<i<<endl<<endl;
cout<<nlayerz<<endl;
if((i+1)%100000 == 0) cout<<i+1<<endl;
tree->GetEntry(i);
for(int d=0;d<33;d++){
if(layer[d]==1){
if(layerz[d]==0) nlayerz+=1;
layerz[d] = z[d];
layersign[d] = sign[d];
}
}
if(layerz[17]!=0&&layerz[18]!=0&&layerz[19]!=0&&layerz[20]!=0&&layerz[21]!=0&&layerz[22]!=0&&layerz[23]!=0&&layerz[24]!=0&&layerz[25]!=0&&layerz[26]!=0&&layerz[27]!=0&&layerz[28]!=0&&layerz[29]!=0&&layerz[30]!=0&&layerz[31]!=0&&layerz[32]!=0)break;
}
nlayerz = 0;
for(int i = 0; i < nevent; i++){
if((i+1)%100000 == 0) cout<<i+1<<endl;
memo->GetEntry(i);
for(int d=0;d<33;d++){
if(fabs(hitz[d]-layerz[d])<zwidth&&fabs(hitz[d]-layerz[d])>2.5){
if(layerzcent[d]==0)nlayerz+=1;
layerzcent[d] = layerz[d]+signfunc(hitz[d]-layerz[d])*2.5;
}
}
if(nlayerz>=16) break;
}
for(int d=0;d<33;d++){
cout<<"layer"<<d-16<<"\t"<<layerz[d]<<"\t"<<layerzcent[d]<<"\t"<<layersign[d]<<endl;
}
double per = TMath::ErfcInverse(0.01);//95%
double a=0;
double errora=0;
double v[8]={0};
double w[8]={0};
double phibound[16][4]={{0}};
double etabound[2][33]={{0}};
double generaletabound[2][4]={{0}};
double generalphiwidth[4]={0};
double e[16]={0};
int first_eta[33] = {0};
/*if(fixon==0){
vector<int> *PDGID =0;
vector<double> *Hits_kineticEnergy=0;
vector<double> *Hits_DirectionZ=0;
vector<double> *hitspos_X=0;
vector<double> *hitspos_Y=0;
vector<double> *hitspos_Z=0;
vector<double> *hitspos_R=0;
vector<double> *hitstime=0;
data->SetBranchAddress("Hits_MM_hitGlobalPositionX",&hitspos_X);
data->SetBranchAddress("Hits_MM_hitGlobalPositionY",&hitspos_Y);
data->SetBranchAddress("Hits_MM_hitGlobalPositionZ",&hitspos_Z);
data->SetBranchAddress("Hits_MM_hitGlobalPositionR",&hitspos_R);
data->SetBranchAddress("Hits_MM_globalTime",&hitstime);
data->SetBranchAddress("Hits_MM_particleEncoding" ,&PDGID); //PDGID
data->SetBranchAddress("Hits_MM_kineticEnergy",&Hits_kineticEnergy);
data->SetBranchAddress("Hits_MM_hitGlobalDirectionZ",&Hits_DirectionZ);
for(int nn=0;nn<data->GetEntries();nn++){
data->GetEntry(nn);
if((nn+1)%100000 == 0) cout<<(nn+1)/1.0/data->GetEntries()<<endl;
for(int c=0;c<hitspos_X->size();c++){
if(PDGID->at(c)==13){
for(int d=0;d<33;d++){
if(fabs(hitspos_Z->at(c)-layerz[d])<zwidth){
phihist[d]->Fill( atan2(hitspos_Y->at(c),hitspos_X->at(c)) );
etahist[d]->Fill( -log(tan(atan2(hitspos_R->at(c),hitspos_Z->at(c))/2.0)) );
}
}
}
}
f = f+1;
}
TF1 *func = new TF1("f","[0]*TMath::Erfc([1]*(x-[2]))");
for(int ll=-8;ll<8;ll++){
for(int d=0;d<8;d++){
func->SetParameters(phihist[d]->GetBinContent(phihist[d]->GetMaximumBin())/2.0,30*pow(-1,ll),(2*ll+1)/16.0*pi);
func->SetParLimits(0,phihist[d]->GetBinContent(phihist[d]->GetMaximumBin())/4.0,phihist[d]->GetBinContent(phihist[d]->GetMaximumBin())/2.0);
func->SetParLimits(2,2*ll/16.0*pi,2*(ll+1)/16.0*pi);
phihist[d]->Fit("f","Q","goff",2*ll/16.0*pi,2*(ll+1)/16.0*pi);
cout<<"laC_side"<<d-16<<endl;
a = func->GetParameter(1);
errora = func->GetParError(1);
v[d] = func->GetParameter(2)-per/a;
error = func->GetParError(2);
error = sqrt(error*error+per*per*errora*errora/a/a/a/a);
w[d] = error*error;
cout<<func->GetChisquare()/func->GetNDF()<<endl;
phibound[ll+8][0]=TMath::Mean(8,&v[0]);
}
}
for(int ll=-8;ll<8;ll++){
for(int d=8;d<16;d++){
func->SetParameters(phihist[d]->GetBinContent(phihist[d]->GetMaximumBin())/2.0,-30*pow(-1,ll),(2*ll+1)/16.0*pi);
func->SetParLimits(0,phihist[d]->GetBinContent(phihist[d]->GetMaximumBin())/4.0,phihist[d]->GetBinContent(phihist[d]->GetMaximumBin())/2.0);
func->SetParLimits(2,2*ll/16.0*pi,2*(ll+1)/16.0*pi);
phihist[d]->Fit("f","Q","goff",2*ll/16.0*pi,2*(ll+1)/16.0*pi);
cout<<"smC_side"<<d-16<<endl;
a = func->GetParameter(1);
errora = func->GetParError(1);
v[d-8] = func->GetParameter(2)-per/a;
error =func->GetParError(2);
error =sqrt(error*error+per*per*errora*errora/a/a/a/a);
w[d-8] = error*error;
cout<<func->GetChisquare()/func->GetNDF()<<endl;
phibound[ll+8][1]=TMath::Mean(8,&v[0]);
}
}
for(int ll=-8;ll<8;ll++){
for(int d=17;d<25;d++){
func->SetParameters(phihist[d]->GetBinContent(phihist[d]->GetMaximumBin())/2.0,-30*pow(-1,ll),(2*ll+1)/16.0*pi);
func->SetParLimits(0,phihist[d]->GetBinContent(phihist[d]->GetMaximumBin())/4.0,phihist[d]->GetBinContent(phihist[d]->GetMaximumBin())/2.0);
func->SetParLimits(2,2*ll/16.0*pi,2*(ll+1)/16.0*pi);
phihist[d]->Fit("f","Q","goff",2*ll/16.0*pi,2*(ll+1)/16.0*pi);
cout<<"smA_side"<<d-16<<endl;
a = func->GetParameter(1);
errora = func->GetParError(1);
v[d-17] = func->GetParameter(2)-per/a;
error =func->GetParError(2);
error =sqrt(error*error+per*per*errora*errora/a/a/a/a);
w[d-17] = error*error;
cout<<func->GetChisquare()/func->GetNDF()<<endl;
phibound[ll+8][2]=TMath::Mean(8,&v[0]);
}
}
for(int ll=-8;ll<8;ll++){
for(int d=25;d<33;d++){
func->SetParameters(phihist[d]->GetBinContent(phihist[d]->GetMaximumBin())/2.0,30*pow(-1,ll),(2*ll+1)/16.0*pi);
func->SetParLimits(0,phihist[d]->GetBinContent(phihist[d]->GetMaximumBin())/4.0,phihist[d]->GetBinContent(phihist[d]->GetMaximumBin())/2.0);
func->SetParLimits(2,2*ll/16.0*pi,2*(ll+1)/16.0*pi);
phihist[d]->Fit("f","Q","goff",2*ll/16.0*pi,2*(ll+1)/16.0*pi);
cout<<"laA_side"<<d-16<<endl;
a = func->GetParameter(1);
errora = func->GetParError(1);
v[d-25] = func->GetParameter(2)-per/a;
error =func->GetParError(2);
error =sqrt(error*error+per*per*errora*errora/a/a/a/a);
w[d-25] = error*error;
cout<<func->GetChisquare()/func->GetNDF()<<endl;
phibound[ll+8][3]=TMath::Mean(8,&v[0]);
}
}
for(int d=0;d<16;d++){
func->SetParameters(etahist[d]->GetBinContent(etahist[d]->GetMaximumBin())/2.0,-10,-2.8);
func->SetParLimits(0,etahist[d]->GetBinContent(etahist[d]->GetMaximumBin())/4.0,etahist[d]->GetBinContent(etahist[d]->GetMaximumBin())/2.0);
func->SetParLimits(2,-3.0,-2.5);
etahist[d]->Fit("f","Q","",-3.0,-2.5);
cout<<"C_side"<<d-16<<endl;
a = func->GetParameter(1);
etabound[0][d] = func->GetParameter(2)-per/a;
cout<<func->GetChisquare()/func->GetNDF()<<endl;
}
for(int d=0;d<16;d++){
func->SetParameters(etahist[d]->GetBinContent(etahist[d]->GetMaximumBin())/2.0,10,-1.24);
func->SetParLimits(0,etahist[d]->GetBinContent(etahist[d]->GetMaximumBin())/4.0,etahist[d]->GetBinContent(etahist[d]->GetMaximumBin())/2.0);
func->SetParLimits(2,-1.5,-1.0);
etahist[d]->Fit("f","Q","",-1.5,-1.0);
cout<<"C_side"<<d-16<<endl;
a = func->GetParameter(1);
etabound[1][d] = func->GetParameter(2)-per/a;
cout<<func->GetChisquare()/func->GetNDF()<<endl;
}
for(int d=17;d<33;d++){
func->SetParameters(etahist[d]->GetBinContent(etahist[d]->GetMaximumBin())/2.0,-10,1.24);
func->SetParLimits(0,etahist[d]->GetBinContent(etahist[d]->GetMaximumBin())/4.0,etahist[d]->GetBinContent(etahist[d]->GetMaximumBin())/2.0);
func->SetParLimits(2,1.0,1.5);
etahist[d]->Fit("f","Q","",1.0,1.5);
cout<<"A_side"<<d-16<<endl;
a = func->GetParameter(1);
etabound[0][d] = func->GetParameter(2)-per/a;
cout<<func->GetChisquare()/func->GetNDF()<<endl;
}
for(int d=17;d<33;d++){
func->SetParameters(etahist[d]->GetBinContent(etahist[d]->GetMaximumBin())/2.0,10,2.8);
func->SetParLimits(0,etahist[d]->GetBinContent(etahist[d]->GetMaximumBin())/4.0,etahist[d]->GetBinContent(etahist[d]->GetMaximumBin())/2.0);
func->SetParLimits(2,2.5,3.0);
etahist[d]->Fit("f","Q","",2.5,3.0);
cout<<"A_side"<<d-16<<endl;
a = func->GetParameter(1);
etabound[1][d] = func->GetParameter(2)-per/a;
cout<<func->GetChisquare()/func->GetNDF()<<endl;
}
cout<<"phi"<<endl<<endl;
for(int c=0;c<4;c++){
cout<<c<<endl;
for(int d=0;d<16;d++){
cout<<d<<"\t"<<phibound[d][c]<<endl;
}
}
cout<<"eta"<<endl<<endl;
for(int d=0;d<2;d++){
for(int c=0;c<33;c++){
cout<<c<<"\t"<<etabound[d][c]<<endl;
}
}
int generalbound = 0;
for(int d=0;d<33;d++){
if(d==0||d==8||d==17||d==25){
generaletabound[0][generalbound] = etabound[0][d];
generaletabound[1][generalbound] = etabound[1][d];
generalbound += 1;
}
if(generaletabound[0][generalbound]>etabound[0][d]) generaletabound[0][generalbound] = etabound[0][d];
if(generaletabound[1][generalbound]<etabound[1][d]) generaletabound[1][generalbound] = etabound[1][d];
}
for(int c=0;c<4;c++){
for(int d=0;d<16;d++){
if(fabs(c-1.5)>1){//large
if(d==0)generalphiwidth[c]=fabs(phibound[d][c]-pi/4.0*floor((d-7)/2.0));
if(fabs(phibound[d][c]-pi/4.0*floor((d-7)/2.0))<generalphiwidth[c]){
generalphiwidth[c]=fabs(phibound[d][c]-pi/4.0*floor((d-7)/2.0));
}
}else{
if(d==0)generalphiwidth[c]=fabs(phibound[d][c]-pi/4.0*floor((d-8)/2.0)-pi/8.0);
if(fabs(phibound[d][c]-pi/4.0*floor((d-8)/2.0)-pi/8.0)<generalphiwidth[c]){
generalphiwidth[c]=fabs(phibound[d][c]-pi/4.0*floor((d-8)/2.0)-pi/8.0);
}
}
}
}
}*/
if(fixon==1){
generaletabound[0][0] = 0;
generaletabound[0][1] = 0;
//generaletabound[0][2] = 1.32748;
//generaletabound[0][3] = 1.33956;
generaletabound[0][2] = 1.35;
generaletabound[0][3] = 1.35;
generaletabound[1][0] = 0;
generaletabound[1][1] = 0;
//generaletabound[1][2] = 2.66647;
//generaletabound[1][3] = 2.69886;
generaletabound[1][2] = 2.65;
generaletabound[1][3] = 2.65;
generalphiwidth[0] = 0;
generalphiwidth[1] = 0;
generalphiwidth[2] = 0.13788;
generalphiwidth[3] = 0.245034;
}
cout<<"eta"<<endl<<endl;
for(int d=0;d<2;d++){
for(int c=0;c<4;c++){
cout<<c<<"\t"<<generaletabound[d][c]<<endl;
}
}
cout<<"phi"<<endl<<endl;
for(int c=0;c<4;c++){
cout<<c<<"\t"<<generalphiwidth[c]<<endl;
}
cout <<"neff"<< f <<endl;
//tree creation
TFile *filed3 = new TFile(Form("%sd3.root",namecore),"recreate");
TTree *d3 = new TTree("d3","d3");
n = 0;
first = 0;
nevent = memo->GetEntries();
//Plate
f=0;
int platendata = 0;
vector<double> hitmux(300);
vector<double> hitmuy(300);
vector<double> hitmuz(300);
int nn = 0;
int plateef;
int platenf=0;
int platesnf=0;
int plateneta=0;
int Xuse = 0;
int Uvalid = 0;
int Vvalid = 0;
int grade = 0;
double URZmemory = 0;
double VRZmemory = 0;
int plateth=0;//through
int platesth=0;//stereo through
int platenetath=0;//eta through
int platei=0;
int platenUVin=0;
int platenXin=0;
int plateXpat=0;
int plateUVpat=0;
int platePhipat=0;
int platePhiXpat=0;
double platex0=0;
double platey0=0;
double platez0=0;
double plater0=0;
double platetheta0=0;
double plateeta0=0;
double plateentrytheta=0;
double platephi0=0;
double plateentryphi=0;
int passband=0;
double dr2d=0;
double piphi=0;
vector<double> plateresid2dl(4);
vector<double> plateresid2dg(4);
int on = 0;
int cut;
int hitbutcut=0;
double phifraction=0;
double strip_phifraction=0;
double phimemory=0;
double lphi=0;
int dall = 0;
int dstereo = 0;
double hit_phimemory=0;
double hit_thetamemory=0;
double hit_xmemory=0;
double hit_ymemory=0;
double hit_zmemory=0;
double hit_gx=0;
double hit_gy=0;
double hit_gz=0;
double strip_phimemory=0;
double strip_xmemory=0;
double strip_ymemory=0;
double strip_zmemory=0;
double hit_dphi=0;
double dt2d=0;
int platetimewindow = 0;
double estimated_phifraction=0;
double rhat=0;
int platesector=0;
int platesectoron=0;
double platechi2_ndf=0;
double platedr0=0;
double plateetadr0=0;
double platetmin=0;
int fakeornot = 0;
double rplus = 0;
double rminus = 0;
int dplus = 0;
int dminus = 0;
double dialphi = 0;
vector<int> prelayerd(10);
prelayerd.erase(prelayerd.begin(),prelayerd.end());
vector<double> prelayerslope(10);
prelayerslope.erase(prelayerslope.begin(),prelayerslope.end());
int layerbit[8] = {0};
double phicoeff[8] = {0};
vector<int> vec_band(300);
vector<int> vec_passband(300);
vector<double> vec_dr2d(300);
vector<double> vec_zintercept(300);
vector<double> vec_rintercept(300);
vector<double> vec_ltheta(300);
vector<double> vec_gtheta(300);
vector<double> vec_ltheta3d(300);
vector<double> vec_lphi3d(300);
vector<double> vec_gtheta3d(300);
vector<double> vec_gphi3d(300);
vector<double> vec_zintercept3d(300);
vector<double> vec_strip_phimemory(300);
vector<int> vec_timewindow(300);
vector<int> vec_nlayer(300);
vector<int> vec_nUV(300);
vector<int> vec_nX(300);
vector<int> vec_nUVin(300);
vector<int> vec_nXin(300);
vector<int> vec_Xpat(300);
vector<int> vec_UVpat(300);
vector<int> vec_Phipat(300);
vector<int> vec_PhiXpat(300);
vector<int> vec_Uvalid(300);
vector<int> vec_Vvalid(300);
vector<int> vec_grade(300);
vector<double> vec_estimated_phifraction(300);
vector<int> vec_sector(300);
vector<int> vec_sectoron(300);
vector<double> vec_chi2_ndf(300);
vector<double> vec_dr0(300);
vector<double> vec_etadr0(300);
vector<double> vec_tmin(300);
vector<int> vec_fakeornot(300);
vector<double> vec_hit_zintercept3d(300);
vector<double> vec_hit_zintercept(300);
vector<double> vec_hit_rintercept(300);
vector<double> vec_hit_ltheta(300);
vector<double> vec_hit_gtheta(300);
vector<double> vec_hit_3dtheta(300);
vector<double> vec_hit_3dphi(300);
vector<double> vec_hit_gtheta3d(300);
vector<double> vec_hit_gphi3d(300);
vector<double> vec_hit_phimemory(300);
vector<double> vec_hit_thetamemory(300);
vector<vector<int> > vecvec_layer(300, vector<int>(8));
vector<vector<double> > vecvec_dr0(300, vector<double>(8));
vector<vector<int> > vecvec_Xlayer(300, vector<int>(8));
vector<vector<double> > vecvec_Xdr0(300, vector<double>(8));
vector<vector<int> > vecvec_Philayer(300, vector<int>(8));
vector<vector<double> > vecvec_Phidr0(300, vector<double>(8));
vector<vector<double> > vecvec_Phicoeff(300, vector<double>(8));
vec_band.erase(vec_band.begin(),vec_band.end());
vec_passband.erase(vec_passband.begin(),vec_passband.end());
vec_dr2d.erase(vec_dr2d.begin(),vec_dr2d.end());
vec_zintercept3d.erase(vec_zintercept3d.begin(),vec_zintercept3d.end());
vec_zintercept.erase(vec_zintercept.begin(),vec_zintercept.end());
vec_rintercept.erase(vec_rintercept.begin(),vec_rintercept.end());
vec_ltheta.erase(vec_ltheta.begin(),vec_ltheta.end());
vec_gtheta.erase(vec_gtheta.begin(),vec_gtheta.end());
vec_ltheta3d.erase(vec_ltheta3d.begin(),vec_ltheta3d.end());
vec_lphi3d.erase(vec_lphi3d.begin(),vec_lphi3d.end());
vec_gtheta3d.erase(vec_gtheta3d.begin(),vec_gtheta3d.end());
vec_gphi3d.erase(vec_gphi3d.begin(),vec_gphi3d.end());
vec_strip_phimemory.erase(vec_strip_phimemory.begin(),vec_strip_phimemory.end());
vec_timewindow.erase(vec_timewindow.begin(),vec_timewindow.end());
vec_nlayer.erase(vec_nlayer.begin(),vec_nlayer.end());
vec_nUV.erase(vec_nUV.begin(),vec_nUV.end());
vec_nX.erase(vec_nX.begin(),vec_nX.end());
vec_nUVin.erase(vec_nUVin.begin(),vec_nUVin.end());
vec_nXin.erase(vec_nXin.begin(),vec_nXin.end());
vec_Xpat.erase(vec_Xpat.begin(),vec_Xpat.end());
vec_UVpat.erase(vec_UVpat.begin(),vec_UVpat.end());
vec_Phipat.erase(vec_Phipat.begin(),vec_Phipat.end());
vec_PhiXpat.erase(vec_PhiXpat.begin(),vec_PhiXpat.end());
vec_Uvalid.erase(vec_Uvalid.begin(),vec_Uvalid.end());
vec_Vvalid.erase(vec_Vvalid.begin(),vec_Vvalid.end());
vec_grade.erase(vec_grade.begin(),vec_grade.end());
vec_estimated_phifraction.erase(vec_estimated_phifraction.begin(),vec_estimated_phifraction.end());
vec_sector.erase(vec_sector.begin(),vec_sector.end());
vec_sectoron.erase(vec_sectoron.begin(),vec_sectoron.end());
vec_chi2_ndf.erase(vec_chi2_ndf.begin(),vec_chi2_ndf.end());
vec_dr0.erase(vec_dr0.begin(),vec_dr0.end());
vec_etadr0.erase(vec_etadr0.begin(),vec_etadr0.end());
vec_tmin.erase(vec_tmin.begin(),vec_tmin.end());
vec_fakeornot.erase(vec_fakeornot.begin(),vec_fakeornot.end());
vec_hit_zintercept.erase(vec_hit_zintercept.begin(),vec_hit_zintercept.end());
vec_hit_rintercept.erase(vec_hit_rintercept.begin(),vec_hit_rintercept.end());
vec_hit_ltheta.erase(vec_hit_ltheta.begin(),vec_hit_ltheta.end());
vec_hit_gtheta.erase(vec_hit_gtheta.begin(),vec_hit_gtheta.end());
vec_hit_3dtheta.erase(vec_hit_3dtheta.begin(),vec_hit_3dtheta.end());
vec_hit_3dphi.erase(vec_hit_3dphi.begin(),vec_hit_3dphi.end());
vec_hit_gtheta3d.erase(vec_hit_gtheta3d.begin(),vec_hit_gtheta3d.end());
vec_hit_gphi3d.erase(vec_hit_gphi3d.begin(),vec_hit_gphi3d.end());
vec_hit_phimemory.erase(vec_hit_phimemory.begin(),vec_hit_phimemory.end());
vec_hit_thetamemory.erase(vec_hit_thetamemory.begin(),vec_hit_thetamemory.end());
vecvec_dr0.erase(vecvec_dr0.begin(),vecvec_dr0.end());
vecvec_layer.erase(vecvec_layer.begin(),vecvec_layer.end());
vecvec_Xdr0.erase(vecvec_Xdr0.begin(),vecvec_Xdr0.end());
vecvec_Xlayer.erase(vecvec_Xlayer.begin(),vecvec_Xlayer.end());
vecvec_Phidr0.erase(vecvec_Phidr0.begin(),vecvec_Phidr0.end());
vecvec_Philayer.erase(vecvec_Philayer.begin(),vecvec_Philayer.end());
vecvec_Phicoeff.erase(vecvec_Phicoeff.begin(),vecvec_Phicoeff.end());
d3->Branch("ndata",&platendata);
d3->Branch("i",&platei);
d3->Branch("x0",&platex0);
d3->Branch("y0",&platey0);
d3->Branch("z0",&platez0);
d3->Branch("r0",&plater0);
d3->Branch("theta0",&platetheta0);
d3->Branch("entrytheta",&plateentrytheta);
d3->Branch("phi0",&platephi0);
d3->Branch("entryphi",&plateentryphi);
d3->Branch("band",&vec_band);
d3->Branch("passband",&vec_passband);
d3->Branch("dr2d",&vec_dr2d);
d3->Branch("zcept",&vec_zintercept);
d3->Branch("rcept",&vec_rintercept);
d3->Branch("hit_zcept",&hit_zintercept);
d3->Branch("hit_rcept",&hit_rintercept);
d3->Branch("ltheta",&vec_ltheta);
d3->Branch("gtheta",&vec_gtheta);
d3->Branch("hit_ltheta",&hit_ltheta);
d3->Branch("hit_gtheta",&hit_gtheta);
d3->Branch("ltheta3d",&vec_ltheta3d);
d3->Branch("lphi3d",&vec_lphi3d);
d3->Branch("hit_ltheta3d",&hit_3dtheta);
d3->Branch("hit_lphi3d",&hit_3dphi);
d3->Branch("gtheta3d",&vec_gtheta3d);
d3->Branch("gphi3d",&vec_gphi3d);
d3->Branch("hit_gtheta3d",&hit_gtheta3d);
d3->Branch("hit_gphi3d",&hit_gphi3d);
d3->Branch("zcept3d",&vec_zintercept3d);
d3->Branch("hit_posphi",&hit_phimemory);
d3->Branch("hit_postheta",&hit_thetamemory);
d3->Branch("strip_posphi",&vec_strip_phimemory);
d3->Branch("timewindow",&vec_timewindow);
d3->Branch("nth",&plateth);
d3->Branch("nUVth",&platesth);
d3->Branch("nXth",&platenetath);
d3->Branch("nlayer",&vec_nlayer);
d3->Branch("nUV",&vec_nUV);
d3->Branch("nX",&vec_nX);
d3->Branch("nUVin",&vec_nUVin);
d3->Branch("nXin",&vec_nXin);
d3->Branch("Xpat",&vec_Xpat);
d3->Branch("UVpat",&vec_UVpat);
d3->Branch("Phipat",&vec_Phipat);
d3->Branch("PhiXpat",&vec_PhiXpat);
d3->Branch("Uvalid",&vec_Uvalid);
d3->Branch("Vvalid",&vec_Vvalid);
d3->Branch("estimated_phifraction",&vec_estimated_phifraction);
d3->Branch("sector",&vec_sector);
d3->Branch("sectoron",&vec_sectoron);
d3->Branch("chi2_ndf",&vec_chi2_ndf);
d3->Branch("dr0",&vec_dr0);
d3->Branch("etadr0",&vec_etadr0);
d3->Branch("tmin",&vec_tmin);
d3->Branch("fakeornot",&vec_fakeornot);
d3->Branch("dr0pat",&vecvec_dr0);
d3->Branch("layerpat",&vecvec_layer);
d3->Branch("Xdr0pat",&vecvec_Xdr0);
d3->Branch("Xlayerpat",&vecvec_Xlayer);
d3->Branch("Phidr0pat",&vecvec_Phidr0);
d3->Branch("Philayerpat",&vecvec_Philayer);
d3->Branch("Phicoeff",&vecvec_Phicoeff);
d3->Branch("grade",&vec_grade);
cut = Ninc;
int firsttime = 0;
int truthcheck = 0;
int la_sm = 1;
int legitimacy = 0;
int acceptance=0;
int validity=0;
int layeron[33] = {0};
int allhitsectoron[2] = {0};
int bandmemory = 0;
int Xfirst = 0;
int UVfirst = 0;
int Xsecond = 0;
int Xfirston = 0;
int UVfirston = 0;
int Xsecondon = 0;
int l=0;
int k=0;
n = 0;
int m = 0;
tree->GetEntry(0);
if(shortcut==1){
n = nevent-100;
m = 13100;
tree->GetEntry(13100);
}
while(m < nfast){
if(checkexp==1)cout<<"n"<<n<<"i"<<i<<endl;//check1
truthcheck = 0;//for truth
if((n+1)%100000 == 0) cout<<(n+1)/1.0/Ninc<<endl;
on = 0;
vec_band.erase(vec_band.begin(),vec_band.end());
vec_passband.erase(vec_passband.begin(),vec_passband.end());
vec_dr2d.erase(vec_dr2d.begin(),vec_dr2d.end());
vec_zintercept.erase(vec_zintercept.begin(),vec_zintercept.end());
vec_rintercept.erase(vec_rintercept.begin(),vec_rintercept.end());
vec_ltheta.erase(vec_ltheta.begin(),vec_ltheta.end());
vec_gtheta.erase(vec_gtheta.begin(),vec_gtheta.end());
vec_ltheta3d.erase(vec_ltheta3d.begin(),vec_ltheta3d.end());
vec_lphi3d.erase(vec_lphi3d.begin(),vec_lphi3d.end());
vec_gtheta3d.erase(vec_gtheta3d.begin(),vec_gtheta3d.end());
vec_gphi3d.erase(vec_gphi3d.begin(),vec_gphi3d.end());
vec_zintercept3d.erase(vec_zintercept3d.begin(),vec_zintercept3d.end());
vec_strip_phimemory.erase(vec_strip_phimemory.begin(),vec_strip_phimemory.end());
vec_timewindow.erase(vec_timewindow.begin(),vec_timewindow.end());
vec_nlayer.erase(vec_nlayer.begin(),vec_nlayer.end());
vec_nUV.erase(vec_nUV.begin(),vec_nUV.end());
vec_nX.erase(vec_nX.begin(),vec_nX.end());
vec_nUVin.erase(vec_nUVin.begin(),vec_nUVin.end());
vec_nXin.erase(vec_nXin.begin(),vec_nXin.end());
vec_Xpat.erase(vec_Xpat.begin(),vec_Xpat.end());
vec_UVpat.erase(vec_UVpat.begin(),vec_UVpat.end());
vec_Phipat.erase(vec_Phipat.begin(),vec_Phipat.end());
vec_PhiXpat.erase(vec_PhiXpat.begin(),vec_PhiXpat.end());
vec_Uvalid.erase(vec_Uvalid.begin(),vec_Uvalid.end());
vec_Vvalid.erase(vec_Vvalid.begin(),vec_Vvalid.end());
vec_grade.erase(vec_grade.begin(),vec_grade.end());
vec_estimated_phifraction.erase(vec_estimated_phifraction.begin(),vec_estimated_phifraction.end());
vec_sector.erase(vec_sector.begin(),vec_sector.end());
vec_sectoron.erase(vec_sectoron.begin(),vec_sectoron.end());
vec_chi2_ndf.erase(vec_chi2_ndf.begin(),vec_chi2_ndf.end());
vec_dr0.erase(vec_dr0.begin(),vec_dr0.end());
vec_etadr0.erase(vec_etadr0.begin(),vec_etadr0.end());
vec_tmin.erase(vec_tmin.begin(),vec_tmin.end());
vec_fakeornot.erase(vec_fakeornot.begin(),vec_fakeornot.end());
vec_hit_zintercept.erase(vec_hit_zintercept.begin(),vec_hit_zintercept.end());
vec_hit_rintercept.erase(vec_hit_rintercept.begin(),vec_hit_rintercept.end());
vec_hit_ltheta.erase(vec_hit_ltheta.begin(),vec_hit_ltheta.end());
vec_hit_gtheta.erase(vec_hit_gtheta.begin(),vec_hit_gtheta.end());
vec_hit_3dtheta.erase(vec_hit_3dtheta.begin(),vec_hit_3dtheta.end());
vec_hit_3dphi.erase(vec_hit_3dphi.begin(),vec_hit_3dphi.end());
vec_hit_gtheta3d.erase(vec_hit_gtheta3d.begin(),vec_hit_gtheta3d.end());
vec_hit_gphi3d.erase(vec_hit_gphi3d.begin(),vec_hit_gphi3d.end());
vec_hit_phimemory.erase(vec_hit_phimemory.begin(),vec_hit_phimemory.end());
vec_hit_thetamemory.erase(vec_hit_thetamemory.begin(),vec_hit_thetamemory.end());
vecvec_dr0.erase(vecvec_dr0.begin(),vecvec_dr0.end());
vecvec_layer.erase(vecvec_layer.begin(),vecvec_layer.end());
vecvec_Xdr0.erase(vecvec_Xdr0.begin(),vecvec_Xdr0.end());
vecvec_Xlayer.erase(vecvec_Xlayer.begin(),vecvec_Xlayer.end());
vecvec_Phidr0.erase(vecvec_Phidr0.begin(),vecvec_Phidr0.end());
vecvec_Philayer.erase(vecvec_Philayer.begin(),vecvec_Philayer.end());
vecvec_Phicoeff.erase(vecvec_Phicoeff.begin(),vecvec_Phicoeff.end());
while(n == i){//while ni start
cout<<"i"<<i<<endl;
platendata = ndata;
if(truthcheck == 0)passband = 0;
cout<<ndata<<endl;
firsttime = 0;//for hit tracking
if(truthcheck == 0){//means ni while first time
if(checkexp==1)cout<<"truthcheck"<<endl;//check2
truthcheck = 1;
memo->GetEntry(n);
if(checkexp==1)cout<<"mueta"<<mueta<<" : "<<eta0<<endl;//datacheck
allhitsectoron[0] = 0;
allhitsectoron[1] = 0;
for(int d=0;d<33;d++){layeron[d] = 0;}
plateth = 0;
platesth = 0;
acceptance = 0;
legitimacy = 0;
validity = 0;
if(checkexp==1)cout<<"Vertex_x"<<vertex_n<<endl;
if(checkexp==1)cout<<"MU +/-"<<pdg0<<endl;
if(mueta>eta1 && mueta<eta2 && pdg0==13 && vertex_n>nvertexcrit && acceptance==0){
if(checkexp==1)cout<<"ACCEPT"<<endl;
platetheta0 = 2.0*atan(exp(-mueta));
plateeta0 = mueta;
if(mueta<0){
for(int d=0;d<8;d++){
if(fabs(hitphi0[d]-round(hitphi0[d]/pi*4.0)/4.0*pi)<generalphiwidth[0]){
if((hiteta0[d]<generaletabound[1][0] && hiteta0[d]>1.7 ) || ( 1.5>hiteta0[d] && hiteta0[d]>generaletabound[0][0])){
on = 1;
layeron[d] = 1;
def[d] += 1;
plateth += 1;
if(layersign[d]!=0){
platesth += 1;
}
}
}
}//large C_side
for(int d=8;d<16;d++){
if(fabs(hitphi0[d]-round((hitphi0[d]+pi/8.0)/pi*4.0)/4.0*pi+pi/8.0)<generalphiwidth[1]){
if((hiteta0[d]<generaletabound[1][1] && hiteta0[d]>1.7 ) || ( 1.5>hiteta0[d] && hiteta0[d]>generaletabound[0][1])){
on = 1;
layeron[d] = 1;
def[d] += 1;
plateth += 1;
if(layersign[d]!=0){
platesth += 1;
}
}
}
}//small C_side
}
if(mueta>0){
for(int d=17;d<25;d++){
if(fabs(hitphi0[d]-round((hitphi0[d]+pi/8.0)/pi*4.0)/4.0*pi+pi/8.0)<generalphiwidth[2]){
if((hiteta0[d]<generaletabound[1][2] && hiteta0[d]>1.7 ) || ( 1.5>hiteta0[d] && hiteta0[d]>generaletabound[0][2])){
on = 1;
layeron[d] = 1;
def[d] += 1;
plateth += 1;
if(layersign[d]!=0){
platesth += 1;
}
}
}
}//small A_side
for(int d=25;d<33;d++){
if(fabs(hitphi0[d]-round(hitphi0[d]/pi*4.0)/4.0*pi)<generalphiwidth[3]){
if((hiteta0[d]<generaletabound[1][3] && hiteta0[d]>1.7 ) || ( 1.5>hiteta0[d] && hiteta0[d]>generaletabound[0][3])){
on = 1;
layeron[d] = 1;
def[d] += 1;
plateth += 1;
if(layersign[d]!=0){
platesth += 1;
}
}
}
}//large A_side
}
}
platenetath = plateth-platesth;
for(int b=0;b<17;b++){
if(plateth==b){
dnf[b] += 1;
for(int h=0;h<9;h++){
if(platesth==h){
dsnf[b][h] += 1;
}
}
}
}
if(layeron[17]+layeron[18]+layeron[23]+layeron[24]+layeron[19]+layeron[20]+layeron[21]+layeron[22]==8){
allhitsectoron[0] = 1;
}
if(layeron[25]+layeron[26]+layeron[31]+layeron[32]+layeron[27]+layeron[28]+layeron[29]+layeron[30]==8){
allhitsectoron[1] = 1;
}
}//truthcheck
if(plateth==8){
if(platesth==4){
if(checkexp==1)cout<<"allhit"<<endl;//check3
//data->GetEntry(n);
if(sector==3) sector = allhitsectoron[1];
platesector = sector;
platesectoron = allhitsectoron[sector];
if(mueta != eta0) alert[4]+=1;
phimemory = phi0;
platephi0 = phi0;
plateentryphi = 0;
plateeta0 = mueta;
platetheta0 = 2.0*atan(exp(-mueta));
plateentrytheta = 2.0*atan(exp(-muentryeta));
platex0 = x0;
platey0 = y0;
platez0 = z0;
plater0 = sqrt(x0*x0+y0*y0+z0*z0);
platei = n;
truth_aofz0 = platex0+(0-platez0)/cos(platetheta0)*sin(platetheta0)*cos(platephi0);
truth_bofz0 = platey0+(0-platez0)/cos(platetheta0)*sin(platetheta0)*sin(platephi0);
/* for(int c=0;c<hitspos_X->size();c++){
if(PDGID->at(c)!=13){
mux.push_back();
muy.push_back();
muz.push_back();
}
}*/
for(int s=0;s<maxs;s++){
platetimewindow = 25*(s+1);
if(checkexp==1){
if(allhitsectoron[0]==1)cout<<"sm"<<endl;
if(allhitsectoron[1]==1)cout<<"la"<<endl;
cout<<"band"<<band;
if(sector==0)cout<<" sector sm";
if(sector==1)cout<<" sector la";
cout<<" "<<neta<<"X"<<nstereo<<"UV"<<endl;//check5
cout<<"window"<<platetimewindow<<endl;//check5
}
platenf = 0;
platesnf = 0;
prelayerd.erase(prelayerd.begin(),prelayerd.end());
prelayerslope.erase(prelayerslope.begin(),prelayerslope.end());
Xuse = 0;
grade = 0;
Uvalid = 0;
URZmemory = 0;
Vvalid = 0;
VRZmemory = 0;
for(int d=0;d<33;d++){
if(time[d]!=0&&layeron[d]==1){
if(time[d]!=0 && time[d] < (s+1)*25){
ef[d][s] += 1;
platenf += 1;
if(layersign[d]!=0){
platesnf += 1;
}
}
}
}
if(platenf>8)alert[0]+=1;
plateneta = platenf - platesnf;
//initialize
estimated_phifraction = 0;
strip_phimemory = 0;
strip_xmemory = 0;
strip_ymemory = 0;
strip_zmemory = 0;
dd = 0;dall = 0;dstereo = 0;
xofe.erase(xofe.begin(),xofe.end());
yofe.erase(yofe.begin(),yofe.end());
xyofe.erase(xyofe.begin(),xyofe.end());
aofe.erase(aofe.begin(),aofe.end());
dofe.erase(dofe.begin(),dofe.end());
x3d.erase(x3d.begin(),x3d.end());
y3d.erase(y3d.begin(),y3d.end());
z3d.erase(z3d.begin(),z3d.end());
d3d.erase(d3d.begin(),d3d.end());
dofs.erase(dofs.begin(),dofs.end());
rofs.erase(rofs.begin(),rofs.end());
signofs.erase(signofs.begin(),signofs.end());
platenXin = 0;
platenUVin = 0;
plateXpat = 0;
plateUVpat = 0;
platePhipat = 0;
platePhiXpat = 0;
platechi2_ndf = 0;
platedr0 = 0;
plateetadr0 = 0;
platetmin = 0;
fakeornot = 1;
for(int c=0;c<10;c++){
l1ofe.at(c)=0;
l2ofe.at(c)=0;
l3ofe.at(c)=0;
}
l = platenf-platesnf;
k = platesnf;
if(l>=2&&l<=4){
if(k>=1&&k<=4){
en[l][s] += 1;
esn[l][k][s] += 1;
vecvec_dr0.push_back(vector<double>(8));
vecvec_layer.push_back(vector<int>(8));
vecvec_Xdr0.push_back(vector<double>(8));
vecvec_Xlayer.push_back(vector<int>(8));
vecvec_Phidr0.push_back(vector<double>(8));
vecvec_Philayer.push_back(vector<int>(8));
vecvec_Phicoeff.push_back(vector<double>(8));
vecvec_dr0.at(vecvec_dr0.size()-1).erase(vecvec_dr0.at(vecvec_dr0.size()-1).begin(),vecvec_dr0.at(vecvec_dr0.size()-1).end());
vecvec_layer.at(vecvec_layer.size()-1).erase(vecvec_layer.at(vecvec_layer.size()-1).begin(),vecvec_layer.at(vecvec_layer.size()-1).end());
vecvec_Xdr0.at(vecvec_Xdr0.size()-1).erase(vecvec_Xdr0.at(vecvec_Xdr0.size()-1).begin(),vecvec_Xdr0.at(vecvec_Xdr0.size()-1).end());
vecvec_Xlayer.at(vecvec_Xlayer.size()-1).erase(vecvec_Xlayer.at(vecvec_Xlayer.size()-1).begin(),vecvec_Xlayer.at(vecvec_Xlayer.size()-1).end());
vecvec_Phidr0.at(vecvec_Phidr0.size()-1).erase(vecvec_Phidr0.at(vecvec_Phidr0.size()-1).begin(),vecvec_Phidr0.at(vecvec_Phidr0.size()-1).end());
vecvec_Philayer.at(vecvec_Philayer.size()-1).erase(vecvec_Philayer.at(vecvec_Philayer.size()-1).begin(),vecvec_Philayer.at(vecvec_Philayer.size()-1).end());
vecvec_Phicoeff.at(vecvec_Phicoeff.size()-1).erase(vecvec_Phicoeff.at(vecvec_Phicoeff.size()-1).begin(),vecvec_Phicoeff.at(vecvec_Phicoeff.size()-1).end());
prelayerd.erase(prelayerd.begin(),prelayerd.end());
prelayerslope.erase(prelayerslope.begin(),prelayerslope.end());
Uvalid = 0;
Vvalid = 0;
grade = 0;
Xuse = 0;
URZmemory = 0;
VRZmemory = 0;
for(int d=0;d<33;d++){
if(time[d]!=0 && time[d] < 25*(s+1) && layeron[d]==1){
//cout<<d<<endl;
strip_phifraction = Dphi(abs(d-16)>8,atan2(y[d],x[d]));
prelayerslope.push_back(hypot(x[d],y[d])*(cos(strip_phifraction)+layersign[d]*sin(strip_phifraction)*tan(1.5*pi/180))/layerz[d]);
prelayerd.push_back(d-16);
}
}
for(int d=0;d<8;d++){
layerbit[d] = 0;
phicoeff[d] = 0;
}
UVfit(prelayerd.size(),&prelayerd[0],&prelayerslope[0],&Uvalid,&Vvalid,layerbit,phicoeff,slopewidth,uvfit,&grade,&Xuse);
cout<<"Grade"<<grade<<endl;
cout<<Uvalid<<Vvalid<<endl;
cout<<layerbit[0]<<layerbit[1]<<layerbit[2]<<layerbit[3]<<layerbit[4]<<layerbit[5]<<layerbit[6]<<layerbit[7]<<endl;
for(int d=0;d<33;d++){
//eta
if(time[d]!=0 && time[d] < 25*(s+1) && layeron[d]==1){
vecvec_dr0.at(vecvec_dr0.size()-1).push_back(dr0[d]);
vecvec_layer.at(vecvec_layer.size()-1).push_back(d-16);
if(layersign[d]==0){
if(dd>3){cout<<"e"<<dd<<"layer"<<d-16<<endl;}else{
xofe.push_back(layerz[d]);
dofe.push_back(d);
vecvec_Xdr0.at(vecvec_Xdr0.size()-1).push_back(dr0[d]);
vecvec_Xlayer.at(vecvec_Xlayer.size()-1).push_back(d-16);
if(abs(d-16)>8){
la_sm = 2;
}else{
la_sm = 1;
}
platedr0 += dr0[d]*dr0[d];
plateetadr0 += dr0[d]*dr0[d];
platetmin += time[d];
if(fabs(dr0[d])<drcut){
fakeornot = 0;
}
if(fabs(dr0[d])<drcutin){
platenXin += 1;
}
yofe.push_back(sqrt(x[d]*x[d]+y[d]*y[d]));//as r
xyofe.push_back(layerz[d]*sqrt(x[d]*x[d]+y[d]*y[d]));
aofe.push_back(sqrt(x[d]*x[d]+y[d]*y[d])/layerz[d]);
//strip_phimemory += atan2(y[d],x[d]);
strip_xmemory += x[d];
strip_ymemory += y[d];
strip_zmemory += z[d];
//exofe.at(dd) = 5.;
//eyofe.at(dd) = 0.435;
dialphi = atan2(y[d],x[d]);
dialphi = round(dialphi/pi*8.0)*pi/8.0;
if(layerbit[(d-1)%8]==1){
x3d.push_back(x[d]);
y3d.push_back(y[d]);
z3d.push_back(layerz[d]);
d3d.push_back(d);
vecvec_Phidr0.at(vecvec_Phidr0.size()-1).push_back(dr0[d]);
vecvec_Philayer.at(vecvec_Philayer.size()-1).push_back(d-16);
vecvec_Phicoeff.at(vecvec_Phicoeff.size()-1).push_back(phicoeff[(d-1)%8]);
lphi = atan2(y[d],x[d]);
lphi = round(lphi/pi*8.0)*pi/8.0+pi/2.0;
//cout<<"layer"<<d<<"\tlphi"<<(lphi-pi/2.0)/pi*8.0<<endl;
l1ofe.at(dall) = cos(lphi);
l2ofe.at(dall) = sin(lphi);
l3ofe.at(dall) = 0;
dall += 1;//for xuv/uv fit
}
dd += 1;//for eta
}
}else{
if(layerbit[(d-1)%8]==1){
strip_phifraction = Dphi(la_sm-1,atan2(y[d],x[d]));
platedr0 += dr0[d]*dr0[d];
platetmin += time[d];
if(fabs(dr0[d])<drcutin){
platenUVin += 1;
}
x3d.push_back(x[d]);
y3d.push_back(y[d]);
z3d.push_back(layerz[d]);
d3d.push_back(d);
vecvec_Phidr0.at(vecvec_Phidr0.size()-1).push_back(dr0[d]);
vecvec_Philayer.at(vecvec_Philayer.size()-1).push_back(d-16);
vecvec_Phicoeff.at(vecvec_Phicoeff.size()-1).push_back(phicoeff[(d-1)%8]);
dofs.push_back(d);//stereo
rofs.push_back(hypot(x[d],y[d])*(cos(strip_phifraction)+layersign[d]*sin(strip_phifraction)*tan(1.5*pi/180)));//stereo//degpoint
signofs.push_back(layersign[d]);
lphi = atan2(y[d],x[d]);
lphi = round(lphi/pi*8.0)*pi/8.0+pi/2.0+layersign[d]*1.5/180.0*pi;//degpoint
l1ofe.at(dall) = cos(lphi);
l2ofe.at(dall) = sin(lphi);
l3ofe.at(dall) = 0;
dstereo += 1;
dall += 1;
}
}
}
}
if(dd!=l){alert[2]+=1;}
if((uvfit>=3&&Uvalid==0&&Vvalid==0&&dall!=2)||((uvfit<=2)&&(Xuse==0)&&(dall!=k))||((uvfit==0)&&(dall!=l+k))){alert[3]+=1;}
if(dd==l){
plateetadr0 /= 1.0*l;
platedr0 /= 1.0*(l+dstereo);
platetmin /= 1.0*(l+dstereo);
if(analytic==0){
if(robust==0){
mint[n] = new TGraphErrors(l,&xofe[0],&yofe[0],&exofe[0],&eyofe[0]);
linear->SetParameters(2*atan(exp(-(eta1+eta2)/2.0)),0);
if(mueta>0){
linear->SetParLimits(0,0.,pi/2.0);
}else{
linear->SetParLimits(0,pi/2.0,pi);
}
linear->FixParameter(1,0);
mint[n]->Fit("lin","Q","",-8000,8000);
if(fabs(linear->GetParameter(0)/pi*2.0-round(linear->GetParameter(0)/pi*2.0))<0.00001)alert[7]+=1;
gtheta = linear->GetParameter(0);
linear->ReleaseParameter(1);
mint[n]->Fit("lin","Q","",-8000,8000);
if(fabs(linear->GetParameter(0)/pi*2.0-round(linear->GetParameter(0)/pi*2.0))<0.00001)alert[7]+=1;
ltheta = linear->GetParameter(0);
if(l>2){platechi2_ndf = linear->GetChisquare()/1.0/(l-2);}else{platechi2_ndf = linear->GetChisquare()/0.1;}
esdelta[l][k][s] += fabs(gtheta-ltheta);
edelta[l][s] += fabs(gtheta-ltheta);
zintercept = linear->GetParameter(1);
rintercept = -zintercept*tan(ltheta);
}
if(robust==1){
for(int mr=0;mr<l;mr++){
xfit->ReleaseParameter(mr*2);
xfit->ReleaseParameter(mr*2+1);
xfit->SetParameter(mr*2,Form("x[%d]",mr),xofe.at(mr),1,-8000,8000);
xfit->SetParameter(mr*2+1,Form("y[%d]",mr),yofe.at(mr),1,0,6000);
xfit->FixParameter(mr*2);
xfit->FixParameter(mr*2+1);
}
for(int mr=l;mr<4;mr++){
xfit->ReleaseParameter(mr*2);
xfit->ReleaseParameter(mr*2+1);
xfit->SetParameter(mr*2,Form("z[%d]",mr),0,1,-8000,8000);
xfit->SetParameter(mr*2+1,Form("r[%d]",mr),0,1,0,6000);
xfit->FixParameter(mr*2);
xfit->FixParameter(mr*2+1);
}
if(mueta>0){
xfit->SetParameter(8,"a",tan(2*atan(exp(-(eta1+eta2)/2.0))),0.5,0.0,1.0);
}else{
xfit->SetParameter(8,"a",tan(2*atan(exp(-(eta1+eta2)/2.0))),0.5,-1.0,0.0);
}
xfit->SetParameter(9,"b",0,300,-2000,2000);
xfit->FixParameter(9);
xfit->ExecuteCommand("MIGRAD",0,0);
if(fabs(atan(xfit->GetParameter(8))/pi*2.0-round(atan(xfit->GetParameter(8))/pi*2.0))<0.00001)alert[7]+=1;
//gtheta = atan(xfit->GetParameter(8));
xfit->ReleaseParameter(9);
xfit->SetParameter(9,"b",0,300,-2000,2000);
xfit->ExecuteCommand("MIGRAD",0,0);
/*while(fabs(fabs(minuit->GetParameter(61))-pi)<0.00000001){
piphi = minuit->GetParameter(61);
cout<<piphi<<endl;
minuit->SetParameter(61,"phi",-piphi*0.99,0.1,-pi,pi);
minuit->ExecuteCommand("MIGRAD",0,0);
//cout<<platephi0<<" : "<<minuit->GetParameter(61)<<endl;//for phi
}
minuit->ExecuteCommand("MIGRAD",0,0);
while(fabs(fabs(minuit->GetParameter(61))-pi)<0.00000001){
piphi = minuit->GetParameter(61);
cout<<piphi<<endl;
minuit->SetParameter(61,"phi",-piphi*0.99,0.1,-pi,pi);
minuit->ExecuteCommand("MIGRAD",0,0);
//cout<<platephi0<<" : "<<minuit->GetParameter(61)<<endl;//for phi*/
if(fabs(atan(xfit->GetParameter(8))/pi*2.0-round(atan(xfit->GetParameter(8))/pi*2.0))<0.00001)alert[7]+=1;
ltheta = atan(xfit->GetParameter(8));
//if(l>2){platechi2_ndf = xfit->GetChisquare()/1.0/(l-2);}else{platechi2_ndf = xfit->GetChisquare()/0.1;}
esdelta[l][k][s] += fabs(gtheta-ltheta);
edelta[l][s] += fabs(gtheta-ltheta);
rintercept = xfit->GetParameter(9);
zintercept = -rintercept/tan(ltheta);
xfit->ReleaseParameter(8);
xfit->ReleaseParameter(9);
gtheta = atan(TMath::Mean(l,&xyofe[0])/(TMath::RMS(l,&xofe[0])*TMath::RMS(l,&xofe[0])*(l-1)/l+TMath::Mean(l,&xofe[0])*TMath::Mean(l,&xofe[0])));
}
}else{
if(checkexp==1){
for(int ppp=0;ppp<l;ppp++){
cout<<xofe[ppp]<<"\t"<<yofe[ppp]<<endl;
}
}
//cout<<TMath::RMS(l,&xofe[0])<<endl;
if(analytic==1){
if(takemean==0){
gtheta = atan(TMath::Mean(l,&xyofe[0])/(TMath::RMS(l,&xofe[0])*TMath::RMS(l,&xofe[0])*(l-1)/l+TMath::Mean(l,&xofe[0])*TMath::Mean(l,&xofe[0])));
}else{
gtheta = atan(TMath::Mean(l,&aofe[0]));
}
ltheta = atan((TMath::Mean(l,&xyofe[0])-TMath::Mean(l,&xofe[0])*TMath::Mean(l,&yofe[0]))/(TMath::RMS(l,&xofe[0])*TMath::RMS(l,&xofe[0])*(l-1)/l));
if(checkexp==1){cout<<"gthetacheck"<<gtheta<<endl;
cout<<"lthetacheck"<<ltheta<<endl;}
if(l>2){
platechi2_ndf = TMath::RMS(l,&yofe[0])*TMath::RMS(l,&yofe[0])*(l-1)/l-(TMath::Mean(l,&xyofe[0])-TMath::Mean(l,&xofe[0])*TMath::Mean(l,&yofe[0]))*(TMath::Mean(l,&xyofe[0])-TMath::Mean(l,&xofe[0])*TMath::Mean(l,&yofe[0]))/TMath::RMS(l,&xofe[0])/TMath::RMS(l,&xofe[0])/(l-1)*l/(l-2);
}else{
platechi2_ndf = TMath::RMS(l,&yofe[0])*TMath::RMS(l,&yofe[0])*(l-1)/l-(TMath::Mean(l,&xyofe[0])-TMath::Mean(l,&xofe[0])*TMath::Mean(l,&yofe[0]))*(TMath::Mean(l,&xyofe[0])-TMath::Mean(l,&xofe[0])*TMath::Mean(l,&yofe[0]))/TMath::RMS(l,&xofe[0])/TMath::RMS(l,&xofe[0])/(l-1)*l/0.1;
}
esdelta[l][k][s] += fabs(gtheta-ltheta);
edelta[l][s] += fabs(gtheta-ltheta);
rintercept = TMath::Mean(l,&yofe[0])-TMath::Mean(l,&xofe[0])*tan(ltheta);
zintercept = -rintercept/tan(ltheta);
}
if(analytic==2){
mint[n] = new TGraphErrors(l,&xofe[0],&yofe[0],&exofe[0],&eyofe[0]);
linearl->SetParameters(tan(2*atan(exp(-(eta1+eta2)/2.0))),0);
if(mueta>0){
linearl->SetParLimits(0,0.,1000.);
}else{
linearl->SetParLimits(0,-1000.,0.);
}
linearl->FixParameter(1,0);
mint[n]->Fit("linl","QC","",-8000,8000);
//if(fabs(linearl->GetParameter(0)/pi*2.0-round(linearl->GetParameter(0)/pi*2.0))<0.00001)alert[7]+=1;
gtheta = atan(linearl->GetParameter(0));
linearl->ReleaseParameter(1);
mint[n]->Fit("linl","QC","",-8000,8000);
//if(fabs(linearl->GetParameter(0)/pi*2.0-round(linearl->GetParameter(0)/pi*2.0))<0.00001)alert[7]+=1;
ltheta = atan(linearl->GetParameter(0));
if(l>2){platechi2_ndf = linearl->GetChisquare()/1.0/(l-2);}else{platechi2_ndf = linearl->GetChisquare()/0.1;}
esdelta[l][k][s] += fabs(gtheta-ltheta);
edelta[l][s] += fabs(gtheta-ltheta);
zintercept = linearl->GetParameter(1);
rintercept = -zintercept*tan(ltheta);
}
}
plateresid2dl.erase(plateresid2dl.begin(),plateresid2dl.end());
plateresid2dg.erase(plateresid2dg.begin(),plateresid2dg.end());
for(int mr=0;mr<dd;mr++){
resid = yofe.at(mr)-tan(ltheta)*xofe.at(mr)+tan(ltheta)*zintercept;
residhist[4]->Fill(/*xofe.at(mr),*/resid);
plateresid2dl.push_back(resid);
resid = yofe.at(mr)-tan(gtheta)*xofe.at(mr);
residhist[5]->Fill(/*xofe.at(mr),*/resid);
plateresid2dg.push_back(resid);
}
if(Xuse==1){
for(int pp=0;pp<dofs.size();pp++){
rhat = tan(ltheta)*layerz[dofs.at(pp)]-tan(ltheta)*zintercept;
resid = rofs.at(pp)-rhat;
estimated_phifraction += signofs.at(pp)*atan(resid/rhat/tan(1.5/180*pi));
}
if(dofs.size()!=0)estimated_phifraction /= dofs.size();
}else{
rplus = 0;
rminus = 0;
dplus = 0; dminus = 0;
for(int pp=0;pp<dofs.size();pp++){
if(signofs.at(pp)==1){
dplus += 1;
rplus += rofs.at(pp);
}
if(signofs.at(pp)==-1){
dminus += 1;
rminus += rofs.at(pp);
}
}
rplus /= 1.0*dplus;
rminus /= 1.0*dminus;
rhat = (rplus+rminus)/2.0;
resid = rplus-rhat;
estimated_phifraction = atan(resid/rhat/tan(1.5/180*pi));
}
if(platesnf!=dofs.size())alert[5] += 1;
strip_xmemory /= l;
strip_ymemory /= l;
strip_zmemory /= l;
strip_phimemory = atan2(strip_ymemory,strip_xmemory);
}
if(checkexp==1)cout<<"minuit"<<endl;//check6
plateXpat = SectorXpat(dofe.size(),&dofe[0]);
platePhipat = SectorAllpat(d3d.size(),&d3d[0]);
platePhiXpat = SectorXpat(d3d.size(),&d3d[0]);
plateUVpat = SectorUVpat(d3d.size(),&d3d[0]);
cout<<plateXpat<<"\t"<<plateUVpat<<"\t"<<platePhipat<<"\t"<<platePhiXpat<<endl;
for(int mr=0;mr<dall;mr++){
minuit->ReleaseParameter(mr*6);
minuit->ReleaseParameter(mr*6+1);
minuit->ReleaseParameter(mr*6+2);
minuit->ReleaseParameter(mr*6+3);
minuit->ReleaseParameter(mr*6+4);
minuit->ReleaseParameter(mr*6+5);
minuit->SetParameter(mr*6,Form("x[%d]",mr),x3d.at(mr),1,-4500,4500);
minuit->SetParameter(mr*6+1,Form("y[%d]",mr),y3d.at(mr),1,-4500,4500);
minuit->SetParameter(mr*6+2,Form("z[%d]",mr),z3d.at(mr),1,-8000,8000);
minuit->SetParameter(mr*6+3,Form("l1[%d]",mr),l1ofe.at(mr),1,-100.,100.);
minuit->SetParameter(mr*6+4,Form("l2[%d]",mr),l2ofe.at(mr),1,-100.,100.);
minuit->SetParameter(mr*6+5,Form("l3[%d]",mr),l3ofe.at(mr),1,-100.,100.);
minuit->FixParameter(mr*6);
minuit->FixParameter(mr*6+1);
minuit->FixParameter(mr*6+2);
minuit->FixParameter(mr*6+3);
minuit->FixParameter(mr*6+4);
minuit->FixParameter(mr*6+5);
}
for(int mr=dall;mr<10;mr++){
minuit->ReleaseParameter(mr*6);
minuit->ReleaseParameter(mr*6+1);
minuit->ReleaseParameter(mr*6+2);
minuit->ReleaseParameter(mr*6+3);
minuit->ReleaseParameter(mr*6+4);
minuit->ReleaseParameter(mr*6+5);
minuit->SetParameter(mr*6,Form("x[%d]",mr),0,1,-4500,4500);
minuit->SetParameter(mr*6+1,Form("y[%d]",mr),0,1,-4500,4500);
minuit->SetParameter(mr*6+2,Form("z[%d]",mr),0,1,-8000,8000);
minuit->SetParameter(mr*6+3,Form("l1[%d]",mr),l1ofe.at(mr),1,-100.,100.);
minuit->SetParameter(mr*6+4,Form("l2[%d]",mr),l2ofe.at(mr),1,-100.,100.);
minuit->SetParameter(mr*6+5,Form("l3[%d]",mr),l3ofe.at(mr),1,-100.,100.);
minuit->FixParameter(mr*6);
minuit->FixParameter(mr*6+1);
minuit->FixParameter(mr*6+2);
minuit->FixParameter(mr*6+3);
minuit->FixParameter(mr*6+4);
minuit->FixParameter(mr*6+5);
}
minuit->SetParameter(62,"a",0,300,-2000,2000);
minuit->SetParameter(63,"b",0,300,-2000,2000);
minuit->FixParameter(62);
minuit->FixParameter(63);
if(l3d==1){
minuit->SetParameter(64,"c",zintercept,300,-2000,2000);
if(z3d.at(0)>0){
if(Xuse==1){
minuit->SetParameter(60,"theta",atan(tan(ltheta)/cos(estimated_phifraction)),0.1,0.,pi/2.0);
}else{
minuit->SetParameter(60,"theta",atan(signfunc(mueta)*rhat/(layerz[la_sm*8+9]+layerz[la_sm*8+16])*2.0)/cos(estimated_phifraction),0.1,0.,pi/2.0);
}
}else{
if(Xuse==1){
minuit->SetParameter(60,"theta",atan(tan(ltheta)/cos(estimated_phifraction)),0.1,pi/2.0,pi);
}else{
minuit->SetParameter(60,"theta",atan(signfunc(mueta)*rhat/(layerz[la_sm*8+9]+layerz[la_sm*8+16])*2.0)/cos(estimated_phifraction),0.1,pi/2.0,pi);
}
}
minuit->SetParameter(61,"phi",dialphi+estimated_phifraction,0.1,-pi,pi);
//cout<<platephi0<<" : "<<dialphi+estimated_phifraction<<endl;//for phi
minuit->FixParameter(60);
minuit->FixParameter(61);
minuit->ExecuteCommand("MIGRAD",0,0);
minuit->ReleaseParameter(60);
minuit->ReleaseParameter(61);
minuit->ExecuteCommand("MIGRAD",0,0);
//cout<<platephi0<<" : "<<minuit->GetParameter(61)<<endl;//for phi
while(fabs(fabs(minuit->GetParameter(61))-pi)<0.00000001){
piphi = minuit->GetParameter(61);
cout<<piphi<<endl;
minuit->SetParameter(61,"phi",-piphi*0.99,0.1,-pi,pi);
minuit->ExecuteCommand("MIGRAD",0,0);
//cout<<platephi0<<" : "<<minuit->GetParameter(61)<<endl;//for phi
}
minuit->ExecuteCommand("MIGRAD",0,0);
while(fabs(fabs(minuit->GetParameter(61))-pi)<0.00000001){
piphi = minuit->GetParameter(61);
cout<<piphi<<endl;
minuit->SetParameter(61,"phi",-piphi*0.99,0.1,-pi,pi);
minuit->ExecuteCommand("MIGRAD",0,0);
//cout<<platephi0<<" : "<<minuit->GetParameter(61)<<endl;//for phi
}
minuit->ExecuteCommand("MIGRAD",0,0);
while(fabs(fabs(minuit->GetParameter(61))-pi)<0.00000001){
piphi = minuit->GetParameter(61);
cout<<piphi<<endl;
minuit->SetParameter(61,"phi",-piphi*0.99,0.1,-pi,pi);
minuit->ExecuteCommand("MIGRAD",0,0);
//cout<<platephi0<<" : "<<minuit->GetParameter(61)<<endl;//for phi \
}
ltheta3d = minuit->GetParameter(60);
lphi3d = minuit->GetParameter(61);
//cout<<platephi0<<" : "<<lphi3d<<endl;//for phi
zintercept3d = minuit->GetParameter(64);
aofz0 = intersecX(0,0,zintercept3d,gtheta3d,gphi3d,0);
bofz0 = intersecY(0,0,zintercept3d,gtheta3d,gphi3d,0);
}
minuit->SetParameter(64,"c",0,300,-2000,2000);
minuit->FixParameter(64);
if(z3d.at(0)>0){
if(Xuse==1){
minuit->SetParameter(60,"theta",atan(tan(gtheta)/cos(estimated_phifraction)),0.1,0.,pi/2.0);
}else{
minuit->SetParameter(60,"theta",atan(signfunc(mueta)*rhat/(layerz[la_sm*8+9]+layerz[la_sm*8+16])*2.0)/cos(estimated_phifraction),0.1,0.,pi/2.0);
}
}else{
if(Xuse==1){
minuit->SetParameter(60,"theta",atan(tan(gtheta)/cos(estimated_phifraction)),0.1,pi/2.0,pi);
}else{
minuit->SetParameter(60,"theta",atan(signfunc(mueta)*rhat/(layerz[la_sm*8+9]+layerz[la_sm*8+16])*2.0)/cos(estimated_phifraction),0.1,pi/2.0,pi);
}
}
minuit->SetParameter(61,"phi",dialphi+estimated_phifraction,0.1,-pi,pi);
//cout<<platephi0<<" : "<<dialphi+estimated_phifraction<<endl;//for phi
minuit->ExecuteCommand("MIGRAD",0,0);
while(fabs(fabs(minuit->GetParameter(61))-pi)<0.00000001){
piphi = minuit->GetParameter(61);
cout<<piphi<<endl;
minuit->SetParameter(61,"phi",-piphi*0.99,0.1,-pi,pi);
minuit->ExecuteCommand("MIGRAD",0,0);
//cout<<platephi0<<" : "<<minuit->GetParameter(61)<<endl;//for phi
}
minuit->ExecuteCommand("MIGRAD",0,0);
while(fabs(fabs(minuit->GetParameter(61))-pi)<0.00000001){
piphi = minuit->GetParameter(61);
cout<<piphi<<endl;
minuit->SetParameter(61,"phi",-piphi*0.99,0.1,-pi,pi);
minuit->ExecuteCommand("MIGRAD",0,0);
//cout<<platephi0<<" : "<<minuit->GetParameter(61)<<endl;//for phi
}
minuit->ExecuteCommand("MIGRAD",0,0);
while(fabs(fabs(minuit->GetParameter(61))-pi)<0.00000001){
piphi = minuit->GetParameter(61);
cout<<piphi<<endl;
minuit->SetParameter(61,"phi",-piphi*0.99,0.1,-pi,pi);
minuit->ExecuteCommand("MIGRAD",0,0);
//cout<<platephi0<<" : "<<minuit->GetParameter(61)<<endl;//for phi \
}
minuit->ExecuteCommand("MIGRAD",0,0);
while(fabs(fabs(minuit->GetParameter(61))-pi)<0.00000001){
piphi = minuit->GetParameter(61);
cout<<piphi<<endl;
minuit->SetParameter(61,"phi",-piphi*0.99,0.1,-pi,pi);
minuit->ExecuteCommand("MIGRAD",0,0);
//cout<<platephi0<<" : "<<minuit->GetParameter(61)<<endl;//for phi \
}
minuit->ReleaseParameter(62);
minuit->ReleaseParameter(63);
minuit->ReleaseParameter(64);
gtheta3d = minuit->GetParameter(60);
gphi3d = minuit->GetParameter(61);
if(firsttime==0){//start of hit
if(checkexp==1)cout<<"hitstart"<<endl;//check4
firsttime = 1;
//data->GetEntry(n);
//initialize
hit_phimemory = 0;
hit_thetamemory = 0;
hit_xmemory = 0;
hit_ymemory = 0;
hit_zmemory = 0;
hit_dphi = 0;
for(int d=0;d<33;d++){
mur[d] = 0;
mut[d] = 0;
}
//initialize
int ddd = 0;
hitxofe.erase(hitxofe.begin(),hitxofe.end());
hityofe.erase(hityofe.begin(),hityofe.end());
hitxyofe.erase(hitxyofe.begin(),hitxyofe.end());
hit3dxofe.erase(hit3dxofe.begin(),hit3dxofe.end());
hit3dyofe.erase(hit3dyofe.begin(),hit3dyofe.end());
hit3dzofe.erase(hit3dzofe.begin(),hit3dzofe.end());
//for hitpoints
for(int d=0;d<33;d++){
if(signfunc(d-16)==signfunc(mueta)&&(abs(d-16)>8)+1==la_sm){
if(hitt0[d]==0)alert[6]+=1;
phifraction = Dphi(la_sm-1,atan2(hity0[d],hitx0[d]));
if(layersign[d]==0){
/*in 2D, comparison for Xstrip is only needed, so do not reckon 1.5deg*/
hitxofe.push_back(hitz0[d]);
hityofe.push_back(hypot(hitx0[d],hity0[d])*cos(phifraction));
hitxyofe.push_back(hitz0[d]*hypot(hitx0[d],hity0[d])*cos(phifraction));
}
hit_xmemory += hitx0[d];
hit_ymemory += hity0[d];
hit_zmemory += hitz0[d];
mur[d] = hypot(hitx0[d],hity0[d])*(cos(phifraction)+layersign[d]*sin(phifraction)*tan(1.5*pi/180));
mut[d] = hitt0[d];
hit3dxofe.push_back(hitx0[d]);
hit3dyofe.push_back(hity0[d]);
hit3dzofe.push_back(hitz0[d]);
ddd += 1;
}
}
if(hitxofe.size()!=4)alert[6]+=1;
if(ddd!=8)alert[6]+=1;
if(ddd!=0){
hit_xmemory /= ddd;
hit_ymemory /= ddd;
hit_zmemory /= ddd;
hit_phimemory = atan2(hit_ymemory,hit_xmemory);
hit_thetamemory = atan2(hypot(hit_xmemory,hit_ymemory),hit_zmemory);
}
//for 2dtrack
if(hitxofe.size()>1){
if(analytic==0){
hit[n] = new TGraphErrors(hitxofe.size(),&hitxofe[0],&hityofe[0],&hitexofe[0],&hiteyofe[0]);
linear->SetParameters(2*atan(exp(-(eta1+eta2)/2.0)),0);
linear->SetParLimits(0,0.,pi);
linear->FixParameter(1,0);
hit[n]->Fit("lin","Q","",-8000,8000);
hit_gtheta = linear->GetParameter(0);
linear->ReleaseParameter(1);
hit[n]->Fit("lin","Q","",-8000,8000);
hit_ltheta = linear->GetParameter(0);
hit_zintercept = linear->GetParameter(1);
hit_rintercept = -hit_zintercept*tan(hit_ltheta);
if(Xtruth==1){
if(la_sm==1)hit_gtheta = atan(tan(hit_ltheta)+hit_rintercept/(layerz[20]+layerz[21])*2.0);
if(la_sm==2)hit_gtheta = atan(tan(hit_ltheta)+hit_rintercept/(layerz[28]+layerz[29])*2.0);
}
intercepthist[1]->Fill(hit_zintercept,hit_ltheta-hit_gtheta);
intercepthist[3]->Fill(hit_ltheta-hit_gtheta,ltheta-gtheta);
}else{
hit_gtheta = atan(TMath::Mean(4,&hitxyofe[0])/(TMath::RMS(4,&hitxofe[0])*TMath::RMS(4,&hitxofe[0])*(4-1)/4+TMath::Mean(4,&hitxofe[0])*TMath::Mean(4,&hitxofe[0])));
hit_ltheta = atan((TMath::Mean(4,&hitxyofe[0])-TMath::Mean(4,&hitxofe[0])*TMath::Mean(4,&hityofe[0]))/(TMath::RMS(4,&hitxofe[0])*TMath::RMS(4,&hitxofe[0])*(4-1)/4));
if(checkexp==1){cout<<"hit_gthetacheck"<<hit_gtheta<<endl;
cout<<"hit_lthetacheck"<<hit_ltheta<<endl;}
//platechi2_ndf = TMath::RMS(4,&hityofe[0])*TMath::RMS(4,&hityofe[0])*(4-1)/4-(TMath::Mean(4,&hitxyofe[0])-TMath::Mean(4,&hitxofe[0])*TMath::Mean(4,&hityofe[0]))*(TMath::Mean(4,&hitxyofe[0])-TMath::Mean(4,&hitxofe[0])*TMath::Mean(4,&hityofe[0]))/TMath::RMS(4,&hitxofe[0])/TMath::RMS(4,&hitxofe[0])/(4-1)*4/(4-2);
hit_rintercept = TMath::Mean(4,&hityofe[0])-TMath::Mean(4,&hitxofe[0])*tan(hit_ltheta);
hit_zintercept = -hit_rintercept/tan(hit_ltheta);
if(Xtruth==1){
if(la_sm==1)hit_gtheta = atan(tan(hit_ltheta)+hit_rintercept/(layerz[20]+layerz[21])*2.0);
if(la_sm==2)hit_gtheta = atan(tan(hit_ltheta)+hit_rintercept/(layerz[28]+layerz[29])*2.0);
}
intercepthist[1]->Fill(hit_zintercept,hit_ltheta-hit_gtheta);
intercepthist[3]->Fill(hit_ltheta-hit_gtheta,ltheta-gtheta);
}
//for 3dtrack
for(int mr=0;mr<ddd;mr++){
track->ReleaseParameter(mr*3);
track->ReleaseParameter(mr*3+1);
track->ReleaseParameter(mr*3+2);
track->SetParameter(mr*3,Form("x[%d]",mr),hit3dxofe.at(mr),1,-4500,4500);
track->SetParameter(mr*3+1,Form("y[%d]",mr),hit3dyofe.at(mr),1,-4500,4500);
track->SetParameter(mr*3+2,Form("z[%d]",mr),hit3dzofe.at(mr),1,-8000,8000);
track->FixParameter(mr*3);
track->FixParameter(mr*3+1);
track->FixParameter(mr*3+2);
}
for(int mr=ddd;mr<10;mr++){
track->ReleaseParameter(mr*3);
track->ReleaseParameter(mr*3+1);
track->ReleaseParameter(mr*3+2);
track->SetParameter(mr*3,Form("x[%d]",mr),0,1,-4500,4500);
track->SetParameter(mr*3+1,Form("y[%d]",mr),0,1,-4500,4500);
track->SetParameter(mr*3+2,Form("z[%d]",mr),0,1,-8000,8000);
track->FixParameter(mr*3);
track->FixParameter(mr*3+1);
track->FixParameter(mr*3+2);
}
track->SetParameter(32,"a",truth_aofz0,100,-2000,2000);
track->SetParameter(33,"b",truth_bofz0,100,-2000,2000);
if(hit3dzofe.at(0)>0){track->SetParameter(30,"theta",platetheta0,0.1,0.,pi/2.0);}else{
track->SetParameter(30,"theta",platetheta0,0.1,pi/2.0,pi);}
track->SetParameter(31,"phi",platephi0,0.1,-pi,pi);
track->FixParameter(30);
track->FixParameter(31);
track->ExecuteCommand("MIGRAD",0,0);
track->ReleaseParameter(30);
track->ReleaseParameter(31);
track->ExecuteCommand("MIGRAD",0,0);
track->ExecuteCommand("MIGRAD",0,0);
track->ExecuteCommand("MIGRAD",0,0);
track->ExecuteCommand("MIGRAD",0,0);
hit_aofz0 = track->GetParameter(32);
hit_bofz0 = track->GetParameter(33);
hit_3dtheta = track->GetParameter(30);
hit_3dphi = track->GetParameter(31);
//cout<<platephi0<<" : "<<dialphi+estimated_phifraction<<" : "<<hit_3dphi<<endl;//for phi
intercepthist[0]->Fill(hit_aofz0-truth_aofz0,hit_bofz0-truth_bofz0);
/*cout<<"hit_aofz0"<<hit_aofz0<<endl;
cout<<"hit_bofz0"<<hit_bofz0<<endl;
cout<<hit_3dtheta<<"\t"<<hit_ltheta<<endl;
cout<<hit_3dphi<<"\t"<<phimemory<<endl;*/
//for 2dtrack resid
for(int mr=0;mr<hitxofe.size();mr++){
resid = hityofe.at(mr)-tan(hit_ltheta)*hitxofe.at(mr)+tan(hit_ltheta)*hit_zintercept;
residhist[0]->Fill(/*hitxofe.at(mr),*/resid);
resid = hityofe.at(mr)-tan(hit_gtheta)*hitxofe.at(mr);
residhist[1]->Fill(/*hitxofe.at(mr),*/resid);
}
//for 3dtrack resid(distance)
for(int mr=0;mr<ddd;mr++){
resid = sqrt(distance1(hit_aofz0, hit_bofz0, 0, sin(hit_3dtheta)*cos(hit_3dphi), sin(hit_3dtheta)*sin(hit_3dphi), cos(hit_3dtheta), hit3dxofe.at(mr), hit3dyofe.at(mr), hit3dzofe.at(mr)));
residhist[2]->Fill(resid);
}
resid = sqrt(distance1(hit_aofz0, hit_bofz0, 0, sin(hit_3dtheta)*cos(hit_3dphi), sin(hit_3dtheta)*sin(hit_3dphi), cos(hit_3dtheta), x0, y0, z0));
residhist[3]->Fill(resid);
}
}//last of hit
if(checkexp==1){
cout<<platendata<<"th DATA Entry"<<platei<<endl;//datacheck
cout<<"mueta"<<plateeta0<<" : "<<eta0<<endl;
}
if(hit3dxofe.size()!=0){
hit_gz = TMath::Mean(z3d.size(),&z3d[0]);
if(UVtruth==1){
if(la_sm==1)hit_gz = (layerz[20]+layerz[21])/2.0;
if(la_sm==2)hit_gz = (layerz[28]+layerz[29])/2.0;
}
hit_gx = interseclX(hit3dxofe.at(0),hit3dyofe.at(0),hit3dzofe.at(0),hit3dxofe.at(hit3dxofe.size()-1),hit3dyofe.at(hit3dyofe.size()-1),hit3dzofe.at(hit3dzofe.size()-1),hit_gz);
hit_gy = interseclY(hit3dxofe.at(0),hit3dyofe.at(0),hit3dzofe.at(0),hit3dxofe.at(hit3dxofe.size()-1),hit3dyofe.at(hit3dyofe.size()-1),hit3dzofe.at(hit3dzofe.size()-1),hit_gz);
hit_gphi3d = atan2(hit_gy,hit_gx);
hit_gtheta3d = atan2(hypot(hit_gx,hit_gy),hit_gz);
}else{
hit_gphi3d = 0;hit_gtheta3d=0;alert[8]+=1;
cout<<"SIZE0error "<<platendata<<"th DATA Entry"<<platei<<endl;
cout<<"mueta"<<plateeta0<<" : "<<eta0<<endl;
}
cout<<platei<<endl;
intercepthist[3]->Fill(aofz0-hit_aofz0,bofz0-hit_bofz0);
cout<<"aofz0-hit_aofz0"<<fabs(aofz0-hit_aofz0)<<endl;
cout<<"bofz0-hit_bofz0"<<fabs(bofz0-hit_bofz0)<<endl;
cout<<fabs(gtheta3d-hit_gtheta3d)<<endl;
cout<<fabs(gphi3d-hit_gphi3d)<<endl;
cout<<"lthetacheck"<<fabs(ltheta-hit_ltheta)<<endl;
cout<<"gthetacheck"<<fabs(gtheta-hit_gtheta)<<endl;
delta[0] += ltheta - hit_ltheta;
//cout<<"hit_gtheta-eta"<<hit_gtheta-atan(tan(2*atan(exp(-eta)))*cos(phi))<<endl;
delta[1] += gtheta - hit_gtheta;
nn += 1;
esdelta[l][k][s] += fabs(gtheta-ltheta);
hit_esdelta[l][k][s] += fabs(hit_gtheta-hit_ltheta);
sigma_sltheta[l][k][s] += (ltheta-hit_ltheta)*(ltheta-hit_ltheta);
sigma_sgtheta[l][k][s] += (gtheta-hit_gtheta)*(gtheta-hit_gtheta);
edelta[l][s] += fabs(gtheta-ltheta);
hit_edelta[l][s] += fabs(hit_gtheta-hit_ltheta);
sigma_ltheta[l][s] += (ltheta-hit_ltheta)*(ltheta-hit_ltheta);
sigma_gtheta[l][s] += (gtheta-hit_gtheta)*(gtheta-hit_gtheta);
//for dr2d dt2d
dr2d = 0;
dt2d = 0;
for(int mr=0;mr<dd;mr++){
for(int d=0;d<33;d++){
if(fabs(xofe.at(mr)-layerz[d])<zwidth){
dr2d += (yofe.at(mr)-tan(hit_ltheta)*(layerz[d]-hit_zintercept))*(yofe.at(mr)-tan(hit_ltheta)*(layerz[d]-hit_zintercept));
dt2d += (time[d]-mut[d])*(time[d]-mut[d]);
if(d==16)alert[1]+=1;
}
}
}
if(dd!=0){
dr2d = sqrt(dr2d/dd);
dt2d = sqrt(dt2d/dd);
}
//d3->Fill();
on = 1;
f = f+1;
//cout<<platephi0<<" : "<<dialphi+estimated_phifraction<<" : "<<hit_3dphi<<endl;//for phi
vec_band.push_back(band);
vec_passband.push_back(passband);
vec_dr2d.push_back(dr2d);
vec_zintercept.push_back(zintercept);
vec_rintercept.push_back(rintercept);
vec_hit_zintercept.push_back(hit_zintercept);
vec_hit_rintercept.push_back(hit_rintercept);
vec_ltheta.push_back(ltheta);
vec_gtheta.push_back(gtheta);
vec_hit_ltheta.push_back(hit_ltheta);
vec_hit_gtheta.push_back(hit_gtheta);
vec_ltheta3d.push_back(ltheta3d);
vec_lphi3d.push_back(lphi3d);
vec_hit_3dtheta.push_back(hit_3dtheta);
vec_hit_3dphi.push_back(hit_3dphi);
vec_gtheta3d.push_back(gtheta3d);
vec_gphi3d.push_back(gphi3d);
vec_hit_gtheta3d.push_back(hit_gtheta3d);
vec_hit_gphi3d.push_back(hit_gphi3d);
vec_zintercept3d.push_back(zintercept3d);
vec_hit_phimemory.push_back(hit_phimemory);
vec_hit_thetamemory.push_back(hit_thetamemory);
vec_strip_phimemory.push_back(strip_phimemory);
vec_timewindow.push_back(platetimewindow);
vec_nlayer.push_back(platenf);
vec_nUV.push_back(platesnf);
vec_nX.push_back(plateneta);
vec_nUVin.push_back(platenUVin);
vec_nXin.push_back(platenXin);
vec_Xpat.push_back(plateXpat);
vec_UVpat.push_back(plateUVpat);
vec_Phipat.push_back(platePhipat);
vec_PhiXpat.push_back(platePhiXpat);
vec_Uvalid.push_back(Uvalid);
vec_Vvalid.push_back(Vvalid);
vec_grade.push_back(grade);
vec_estimated_phifraction.push_back(estimated_phifraction);
vec_sector.push_back(platesector);
vec_sectoron.push_back(platesectoron);
vec_chi2_ndf.push_back(platechi2_ndf);
vec_dr0.push_back(platedr0);
vec_etadr0.push_back(plateetadr0);
vec_tmin.push_back(platetmin);
vec_fakeornot.push_back(fakeornot);
if(s==2)passband += 1;
}//last of needs 1~4UV
}//last of needs 2~4X
}//last of s loop
}//last of 4 eta layer through
}//last of 8 layer through
if(on==1){
cut -= 1;
}
if(nhit!=0 && on ==0){
hitbutcut += 1;
}
m += 1;//band
if(m < nfast){
tree->GetEntry(m);
cout<<"entry"<<n<<"nfast"<<m<<" : "<<ndata<<" : "<<platendata<<endl;
if(ndata!=platendata){
cout<<"Change!!"<<endl;
}
}
if(m == nfast){
n = 0;
}
}//while ni last
if(vec_fakeornot.size()>0){
d3->Fill();
}
n += 1;
//f = f+1;
}
d3->Write();
filed3->Close();
//cout<<"ltheta-hit_ltheta"<<delta[0]/nn;
//cout<<"hit_gtheta-entryeta"<<delta[1]/nn;
const int tractnum = 5;
int tract[tractnum][2]={{0}};
tract[0][0]=2;tract[0][1]=1;
tract[1][0]=2;tract[1][1]=2;
tract[2][0]=3;tract[2][1]=2;
tract[3][0]=3;tract[3][1]=3;
tract[4][0]=4;tract[4][1]=4;
TH1D *xuvlhist[maxs];
TH1D *xuvghist[maxs];
for(int s=0; s<maxs; s++){
xuvlhist[s] = new TH1D(Form("xuvldist%d",s+1),Form("%dns",(s+1)*25),5,-0.5,4.5);
xuvghist[s] = new TH1D(Form("xuvgdist%d",s+1),Form("%dns",(s+1)*25),5,-0.5,4.5);
}
TCanvas *c1 = new TCanvas("c1","c1");
c1->Divide(3,1);
TCanvas *c2 = new TCanvas("c2","c2");
c2->Divide(3,1);
char binname[200];
const char *binnamead;
double p=0;
cout <<"neff"<< f <<endl;
cout <<"cut event"<< cut/1.0/Ninc <<endl;
cout <<"hit but cut event"<< hitbutcut/1.0/Ninc <<endl;
for(int s=0;s<maxs;s++){
cout <<"time < "<<(s+1)*25<<"ns"<<endl;
for(int l=1;l<5;l++){
if(en[l][s]!=0){
cout <<"eta"<<l<<"層"<<endl;
cout <<edelta[l][s]/en[l][s]<<endl;
cout <<hit_edelta[l][s]/en[l][s]<<endl;
cout <<sqrt(sigma_ltheta[l][s])/en[l][s]<<endl;
cout <<sqrt(sigma_gtheta[l][s])/en[l][s]<<endl;
}
for(int k=1;k<5;k++){
if(esn[l][k][s]!=0){
cout <<"stereo"<<k<<"層"<<endl;
cout <<esdelta[l][k][s]/esn[l][k][s]<<endl;
cout <<hit_esdelta[l][k][s]/esn[l][k][s]<<endl;
cout <<sqrt(sigma_sltheta[l][k][s])/esn[l][k][s]<<endl;
cout <<sqrt(sigma_sgtheta[l][k][s])/esn[l][k][s]<<endl;
}
}
}
for(int j=0;j<5;j++){
p = sqrt(sigma_sltheta[tract[j][0]][tract[j][1]][s])/1.0/esn[tract[j][0]][tract[j][1]][s];
if(esn[tract[j][0]][tract[j][1]][s]!=0){xuvlhist[s]->SetBinContent(j+1,p);}else{xuvlhist[s]->SetBinContent(j+1,0);}
//xuvlhist[s]->SetBinError(j+1,sqrt(p*(1-p)/dsnf[8][4]));
sprintf(binname, "%dX,%dUV",tract[j][0],tract[j][1]);
binnamead = binname;
xuvlhist[s]->GetXaxis()->SetBinLabel(j+1,binnamead);
}
for(int j=0;j<5;j++){
p = sqrt(sigma_sgtheta[tract[j][0]][tract[j][1]][s])/1.0/esn[tract[j][0]][tract[j][1]][s];
if(esn[tract[j][0]][tract[j][1]][s]!=0){xuvghist[s]->SetBinContent(j+1,p);}else{xuvghist[s]->SetBinContent(j+1,0);}
//xuvlhist[s]->SetBinError(j+1,sqrt(p*(1-p)/dsnf[8][4]));
sprintf(binname, "%dX,%dUV",tract[j][0],tract[j][1]);
binnamead = binname;
xuvghist[s]->GetXaxis()->SetBinLabel(j+1,binnamead);
}
c1->cd(s+1);
gStyle->SetOptStat(000000000);
xuvlhist[s]->GetXaxis()->SetTitle("CT");
xuvlhist[s]->GetXaxis()->SetTitleOffset(1);
xuvlhist[s]->GetXaxis()->SetLabelSize(0.06);
xuvlhist[s]->GetXaxis()->SetTitleSize(0.04);
xuvlhist[s]->GetYaxis()->SetTitle("sigma_ltheta");
xuvlhist[s]->GetYaxis()->SetTitleOffset(1.2);
xuvlhist[s]->GetYaxis()->SetTitleSize(0.04);
xuvlhist[s]->Draw("");
c2->cd(s+1);
gStyle->SetOptStat(000000000);
xuvghist[s]->GetXaxis()->SetTitle("CT");
xuvghist[s]->GetXaxis()->SetTitleOffset(1);
xuvghist[s]->GetXaxis()->SetLabelSize(0.06);
xuvghist[s]->GetXaxis()->SetTitleSize(0.04);
xuvghist[s]->GetYaxis()->SetTitle("sigma_gtheta");
xuvghist[s]->GetYaxis()->SetTitleOffset(1.2);
xuvghist[s]->GetYaxis()->SetTitleSize(0.04);
xuvghist[s]->Draw("");
}
TCanvas *c[10];
c[0] = new TCanvas("resid_hit_ltheta");
residhist[0]->Draw();
c[1] = new TCanvas("resid_hit_gtheta");
residhist[1]->Draw();
c[2] = new TCanvas("hitintercept_vertex");
intercepthist[0]->Draw();
c[3] = new TCanvas("hitintercept_dtheta");
intercepthist[1]->Draw();
c[4] = new TCanvas("resid_3dltheta");
residhist[2]->Draw();
c[5] = new TCanvas("vertex_to_track");
residhist[3]->Draw();
c[6] = new TCanvas("resid_ltheta");
residhist[4]->Draw();
c[7] = new TCanvas("resid_gtheta");
residhist[5]->Draw();
c[8] = new TCanvas("intercept_vertex");
intercepthist[2]->Draw();
c[9] = new TCanvas("hitdtheta_dtheta");
intercepthist[3]->Draw();
for(int mm=0;mm<10;mm++){
c[mm]->Print(Form("resid_ana%d.pdf",mm+1));
}
cout<<"error\t";
for(int c=0;c<checknum;c++){
cout<<alert[c]<<"\t";
}
cout<<endl;
}
|
9707fc81a9e3edfa1503a83b6c2fa9cfaf043bfc | 04f15913aca8a702efe47962bf82b60eedad73d9 | /LibA/Analytics/MotionTracking.h | 6ae28afdf08d8c8d472d1eb0fb006f88b95c9540 | [] | no_license | DevilCCCP/Code | eae9b7f5a2fede346deefe603a817027a87ef753 | 9cc1a06e5010bb585876056a727abad48bca3915 | refs/heads/master | 2021-10-07T17:04:27.728918 | 2021-09-28T06:49:50 | 2021-09-28T06:49:50 | 166,522,458 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 9,369 | h | MotionTracking.h | #pragma once
#include <vector>
#include <QElapsedTimer>
#include <QVector>
#include <QPointF>
#include <LibV/Include/Rect.h>
#include "AnalyticsB.h"
#include "StatNormal.h"
#include "StatScene.h"
#include "Hyst.h"
//const int kDiffHystLen = 4;
struct Info {
int DiffCount;
int DiffSharpCount;
int DiffP;
int DiffM;
int Sharp;
int Object;
};
struct StatBase {
enum EFlag {
eNormal = 0,
eIgnore = 1 << 0,
eDoor = 1 << 1
};
int Flag;
};
struct Stat: public StatBase {
StatNormal DiffCount;
StatNormal DiffSharpCount;
int SharpD;
};
struct InfoDif {
int DiffCount;
int DiffPCount;
int Object;
};
struct StatDif: public StatBase {
int Layer;
int Layer0TimeTrue;
int Layer0TimeFalse;
int Layer1TimeTrue;
int Layer1TimeFalse;
};
struct ObjPre {
int Id;
Rectangle Place;
QPointF CMass;
int Mass;
QPointF CSize;
int Size;
QPointF Radius;
int Used;
bool Constructed;
};
struct ObjLink {
ObjPre* PreObject;
int Quality;
};
struct ObjInfo {
Rectangle Place;
Rectangle NewPlace;
Point Speed;
ObjPre* PreLinkGood;
QList<ObjLink> PreLinkBad;
int Quality;
int Mode;
int Time;
void Init(Rectangle _Place);
};
struct HitInf {
qint64 Time;
bool In;
};
struct Obj2Info {
enum EMode {
eNormal,
eCasper,
eLost,
eEnded,
eDeleted = 0x10000,
eModeIllegal
};
int Id;
QPointF EmergeLocation;
QPointF Location;
QPointF NewLocation;
QPointF Speed;
QPointF Radius;
int PreLink;
EMode Mode;
int Quality;
int Time;
QMap<int, HitInf> BariersHit;
};
const char* ObjModeToString(Obj2Info::EMode mode);
typedef QList<QPointF> PointList;
struct Barier {
DetectorS Detector;
PointList Points;
};
class MotionTracking: public AnalyticsA
{
bool mMacroObjects;
bool mDiffBackground;
bool mDiffBackgroundDouble;
int mMinObjectSizePer;
bool mStandByEnabled;
bool mStandByMode;
Hyst mDiffAvgHyst;
int mDiffNowCount;
QElapsedTimer mSyncSettings;
std::vector<byte> mBackground;
std::vector<byte> mDiffLayer0;
std::vector<byte> mDiffLayer1;
std::vector<byte> mDiffLayer2;
std::vector<byte> mBorderLayer;
std::vector<byte> mDebugLayer;
qint64 mStartTimestamp;
qint64 mCalc1Timestamp;
qint64 mLastTimestamp;
int mFrameMs;
float mTimeSec;
int mSceneWidth;
int mSceneHeight;
int mSafeStride;
int mSafeHeight;
// Detectors
QVector<PointList> mDoors;
QVector<Barier> mBariers;
// scene
std::vector<Info> mSceneInfo;
std::vector<Stat> mSceneStat;
std::vector<InfoDif> mSceneDiffInfo;
std::vector<StatDif> mSceneDiffStat;
std::vector<int> mSceneTmp;
std::vector<int> mSceneTmp2;
// scene stat
//int mLayer0DiffCountThreshold;
//Hyst mLayer0DiffCountHyst;
StatScene mDiffStatScene;
StatScene mDiffSharpStatScene;
int mMinObjectSize;
Hyst mObjectSpeedHyst;
float mObjectMaxSpeed;
float mObjectMaxAccel;
Hyst mObjectFitHyst;
float mObjectFitMin;
Hyst mDebugHyst;
// pre obj
StatNormalAuto mPreCountStat;
std::vector<int> mObjIds;
std::vector<ObjPre> mPreObjects;
int mPreObjectsCount;
// obj
QList<ObjInfo> mObjectInfo;
QList<Obj2Info> mObject2Info;
int mObjectNextId;
int mObjectCounter;
// total scene
int mTotalObjectsLast;
int mTotalObjects;
// source image
const byte* mImageData;
protected:
/*override */virtual void InitSettings(const SettingsAS& _Settings) Q_DECL_OVERRIDE;
/*override */virtual void InitDetectors(const QList<DetectorS>& _Detectors) Q_DECL_OVERRIDE;
/*override */virtual bool InitImageParameters(int width, int height, int stride) Q_DECL_OVERRIDE;
/*override */virtual void AnalizePrepare(const byte* imageData) Q_DECL_OVERRIDE;
/*override */virtual void AnalizeInit() Q_DECL_OVERRIDE;
/*override */virtual bool AnalizeStandBy() Q_DECL_OVERRIDE;
/*override */virtual bool AnalizeNormal() Q_DECL_OVERRIDE;
/*override */virtual int GetDebugFrameCount() Q_DECL_OVERRIDE;
/*override */virtual bool GetDebugFrame(const int index, QString& text, EImageType& imageType, byte* data, bool& save) Q_DECL_OVERRIDE;
public:
/*override */virtual bool HaveNextObject() Q_DECL_OVERRIDE;
/*override */virtual bool RetrieveNextObject(Object& object) Q_DECL_OVERRIDE;
private:
bool AnalizeAll();
bool LoadDetectorPoints(const DetectorS& detector, PointList& points);
bool TrySwithStandByMode();
void SyncSettings();
//
// Scene
//
void InitBackground();
void InitDiffLayer0();
void InitStat();
void InitStatDiff();
void UpdateStatPeriod1();
void SceneInit();
void SceneInitDiff();
void CalcFront();
void CalcLayer2();
void UpdateStat();
void UpdateStatDiff();
//
// Pre Objects
//
void PreObjectsCreateNormal();
void PreObjectsMark();
void PreObjectsMarkSmooth();
void PreObjectsMarkSmooth2();
bool PreMarkValid();
void PreObjectsConnect(int threshold);
void PreObjectsConstruct();
void PreObjectsConstructDiff();
void PreObjectsCreateMacro();
void PreObjectsMarkMacro();
void PreObjectsConstructMacro();
void PreObjectsCreateDiff();
void PreObjectsMarkDiff();
//
// Objects
//
void ObjectsManage();
void ObjectsLinkPre();
void ObjectsDevideMultiPre();
void ObjectsMoveAll();
void ObjectsUpdateSpeedStat();
float Object2FitPoint(const Obj2Info* object, int ii, int jj);
void Object2LinkOne(Obj2Info* object);
void Object2CreateOne(ObjPre* preObject);
void Object2ManageOne(Obj2Info* object);
void MoveObject(Obj2Info* object);
int IntersectBarier(const QPointF& pp1, const QPointF& pp2, const PointList& barier);
//
// Objects old
//
void ObjectVerify();
void ObjectLinkOne(ObjInfo& object);
bool ObjectVerifyOne(ObjInfo& object);
void ObjectModifyGoodFit(ObjInfo& object);
void ObjectModifyBadFit(ObjInfo& object);
void ObjectModifyFinal(ObjInfo& object, int deltaWidth = 0, int deltaHeight = 0);
// bool ObjectFitPreGood(const Rectangle& newPlace, const Rectangle& testPlace, const Point& moveThreshold, int sizeThreshold);
int ObjectFitPreCalc(const Rectangle& newPlace, const Rectangle& testPlace, const Point& moveThreshold, int sizeThreshold);
int ObjectCalcFit(ObjPre& objectPre, Rectangle &place, int distance);
bool ObjectModifyOne(ObjInfo& object, Rectangle &newPlace, const Rectangle &fitPlace, const Rectangle &fitCount);
void GetDbgBackground(byte* data);
void GetDbgDiffLayer0(byte* data);
void GetDbgDiffLayerX(byte* data);
void GetDbgDiff(byte* data);
void GetDbgDiffLayer0Diff(byte* data);
void GetDbgDiffFormula(byte* data);
void GetDbgDiffP(byte* data);
void GetDbgDiffMicroHyst(byte* data);
void GetDbgDiffBackground(byte* data);
void GetDbgBlockDiffHyst(byte* data);
void GetDbgBlockDiffOneHyst(byte* data, int blockI, int blockJ);
void GetDbgBlockDiff(byte* data);
void GetDbgBlockDiffMidStat(byte* data);
void GetDbgBlockDiffMaxStat(byte* data);
void GetDbgSharpHyst(byte* data);
void GetDbgBlockSharp(byte* data);
void GetDbgBlockDiffSharp(byte* data);
void GetDbgBlockDiffSharpMidStat(byte* data);
void GetDbgBlockDiffSharpMaxStat(byte* data);
void GetDbgInfoObjects(byte* data);
void GetDbgInfoObjectsHyst(byte* data);
void GetDbgDiffInfoObjects(byte* data);
void GetDbgInfoSharp(byte* data);
void GetDbgStatSharp(byte* data);
void GetDbgInfo(byte* data, size_t disp, size_t dispStat, int threshold);
void GetDbgStat(byte* data, size_t disp, int threshold);
// void GetDbgDiffM(byte* data);
void GetDbgSharp(byte* data);
void GetDbgSharpDiff(byte* data);
void GetDbgFront(byte* data);
void GetDbgDiffLayer1(byte* data);
void GetDbgDiffLayer2(byte* data);
void GetDbgDiffCurrentLayer(byte* data);
void GetDbgDiffLayer0Time(byte* data);
void GetDbgDiffLayer1Time(byte* data);
void GetDbgObjDetect(byte* data);
void GetDbgIgnore(byte* data);
void GetDbgHyst(byte* data, const Hyst& hyst, int percentDraw = -1);
bool IsPointInDoor(int ii, int jj);
QPointF PointPercentToScreen(const QPointF& pointPercent);
QPointF PointScreenToPercent(const QPointF& pointScreen);
bool IsNearBorder(const Obj2Info& object);
public:
MotionTracking();
/*override */virtual ~MotionTracking();
};
|
e5ec47a2238021d275575587159cc23559ed2bca | 0a3fa79984b49eedbb78adb665d6e17276ceace3 | /person/main.cpp | 6e366e5ec00db11db4321f9977b67b897d6652c1 | [] | no_license | alex-klim/golf-and-other-activities | a40f4bea5cc3a37853fa5160d28f5c68a39cb944 | c7937fd7dd6fcbf15a4c4e005f5770fb9cea7c45 | refs/heads/master | 2020-04-09T18:27:02.612642 | 2018-12-20T14:13:02 | 2018-12-20T14:13:02 | 160,512,860 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 543 | cpp | main.cpp | #include "person.h"
#include <iostream>
int main()
{
Person one{"Alex", "Klim"};
one.Show();
one.FormalShow();
std::cout << "\n";
Person two{"Buddy"};
two.Show();
two.FormalShow();
std::cout << "\n";
const char* sur = "Surname";
Person three{"Gary", sur};
three.Show();
three.FormalShow();
std::cout << "\n";
// more than 25 characters scenario
Person four{"asd", "agkdysakduyagsduyaskudyaksuydyadusydaysdkuyasgdkyasyd"};
four.Show();
four.FormalShow();
return 0;
}
|
feeeebb0f12c5d4397d437a43d4f10f4dac17586 | 5586622f22718e95df130778bee0a5b117f590d6 | /algorithms/043_Multiply Strings/main_not_understand.cpp | 4958a940278d6a41cc5779c589e370b73e93c93e | [] | no_license | EricDDK/leetcode_brush | 26e1bd3e0a6716f943c85f4ff0c94471a5083629 | b92c7981671413a98601a507cf5504fb8239ded7 | refs/heads/master | 2021-07-10T10:24:54.377633 | 2020-07-01T10:23:56 | 2020-07-01T10:23:56 | 161,455,760 | 4 | 1 | null | 2020-07-01T10:23:58 | 2018-12-12T08:23:43 | C++ | UTF-8 | C++ | false | false | 1,210 | cpp | main_not_understand.cpp | //Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.
#include<sstream>
#include "iostream"
#include <cstdint>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include "algorithm"
#include <stack>
#include <string>
#include <queue>
using namespace std;
class Solution {
public:
string multiply(string num1, string num2) {
string res;
int n1 = num1.size(), n2 = num2.size();
int k = n1 + n2 - 2, carry = 0;
vector<int> v(n1 + n2, 0);
for (int i = 0; i < n1; ++i) {
for (int j = 0; j < n2; ++j) {
v[k - i - j] += (num1[i] - '0') * (num2[j] - '0');
}
}
for (int i = 0; i < n1 + n2; ++i) {
v[i] += carry;
carry = v[i] / 10;
v[i] %= 10;
}
int i = n1 + n2 - 1;
while (v[i] == 0) --i;
if (i < 0) return "0";
while (i >= 0) res.push_back(v[i--] + '0');
return res;
}
};
int main()
{
Solution* solution = new Solution;
auto result = solution->multiply("2", "3");
delete solution;
//cout << result << endl;
return 0;
}
|
bf41839187789ad264e68d462c6de90faa89a9d9 | f64f58aad1a5f4602440df8521c2d3bc25f6f6a2 | /src/LemonTranslator/headers/LT_GT.h | 024f3490b6a4707cec22ff96837d9135229c330f | [
"Apache-2.0"
] | permissive | tera-insights/grokit | ab0f41a8f213739b1bac6ef69815a177f75f914a | af55cc1d22b816e9f8424199cdc2e0264288bc8a | refs/heads/master | 2020-04-15T17:29:49.981823 | 2017-08-26T22:24:52 | 2017-08-26T22:24:52 | 29,202,011 | 9 | 5 | null | null | null | null | UTF-8 | C++ | false | false | 2,433 | h | LT_GT.h | //
// Copyright 2012 Alin Dobra and Christopher Jermaine
//
// 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.
//
#ifndef _LT_GT_H_
#define _LT_GT_H_
#include "LT_Waypoint.h"
#include "GLAData.h"
class LT_GT : public LT_Waypoint {
private:
QueryToJson infoMap; // map from query to expressions defining tranformations
typedef std::vector<WayPointID> StateSourceVec;
typedef std::map<QueryID, StateSourceVec> QueryToState;
QueryToState stateSources;
// map from query to output attributes
typedef EfficientMap<QueryID, SlotContainer> QueryToSlotContainer;
QueryToSlotContainer gfAttribs;
QueryToSlotSet synthesized;
// Attributes to pass through the GT, per query
QueryToSlotSet passThrough;
// All attributes needed as input for the GT, passthrough, or both
QueryToSlotSet inputNeeded;
public:
LT_GT(WayPointID id):
LT_Waypoint(id),
infoMap(),
stateSources(),
gfAttribs(),
synthesized(),
passThrough(),
inputNeeded()
{}
virtual WaypointType GetType() {return GTWaypoint;}
virtual void DeleteQuery(QueryID query) override;
virtual void ClearAllDataStructure() override;
//GT, one per query basis
virtual bool AddGT(QueryID query,
SlotContainer& resultAtts,
SlotSet& atts,
StateSourceVec & sVec,
Json::Value& expr
) override;
virtual bool PropagateDown(QueryID query, const SlotSet& atts, SlotSet& result, QueryExit qe) override;
virtual bool PropagateDownTerminating(QueryID query, const SlotSet& atts/*blank*/, SlotSet& result, QueryExit qe) override;
virtual bool PropagateUp(QueryToSlotSet& result) override;
virtual Json::Value GetJson() override;
virtual bool GetConfig(WayPointConfigureData& where) override;
private:
Json::Value QueryToSlotSetJson( const QueryToSlotSet & );
};
#endif // _LT_GT_H_
|
6fb14249ca9234d1d1d9a7a7151a9bff86aee7c2 | 941c21954bcedc96fddf41a09bc71fb1e44e226f | /contest-1181-567/b.cpp | a74183c85e2048c2406ad83c07916bec494e023f | [
"MIT"
] | permissive | easimonenko/codeforces-problems-solutions | 9cbf5f73bede40c48915b26d6303e36b11398655 | 36e4ecd7fcdfe1d6a4d2b439f952c5aefa9c0bf4 | refs/heads/master | 2023-08-05T05:06:40.376155 | 2023-07-27T09:10:51 | 2023-07-27T09:10:51 | 69,059,791 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 627 | cpp | b.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
string sum(string l, size_t idx) {
string res = "";
size_t w = l.length();
size_t w1 = idx;
size_t w2 = w - idx + 1;
return res;
}
int main() {
size_t w;
cin >> w;
string l;
cin >> l;
vector<string> sums;
if (w % 2 == 0) {
auto idx = w / 2;
while (idx < w && l[idx] == '0') {
idx++;
}
if (idx == w) {
idx = w / 2 - 1;
while (idx >= 0 && l[idx] == '0') {
idx--;
}
if (idx == -1) {
return -1;
}
}
cout << sum(l, idx) << endl;
}
return 0;
}
|
134bada5dd0b41e0948df9fa7b2c58ae2e9944dc | 103eb7b2995196cf033b4d2fc412db183c9f8ee8 | /catkin_ws/src/pick/src/archive/picked_segmentation (2013.11.19).cpp | f0e51c9640d5ab087c2d4c939f3185ec7b2c72e7 | [] | no_license | tfinley/ROS | 7595e213cd6afbbb9541e75eec89a90591be5074 | 3c2fe030803631d8a82b1c03c54734478294f716 | refs/heads/master | 2021-01-19T18:58:14.535653 | 2014-05-02T16:10:11 | 2014-05-02T16:10:11 | 14,591,832 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,478 | cpp | picked_segmentation (2013.11.19).cpp | /*
Originally created by Taylor Finley, 2013.11.18
License: BSD
Description: Segment a point cloud around a specific point picked from RVIZ
*/
#include <ros/ros.h>
// PCL specific includes
// deleted for hydro: #include <pcl/ros/conversions.h>
// #include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl_ros/point_cloud.h> //added 11.18.13
#include <boost/foreach.hpp> //added 11.18.13
#include <pcl/io/pcd_io.h> //added 11.18.13
#include <pcl/sample_consensus/model_types.h>
#include <pcl/sample_consensus/method_types.h>
#include <pcl/segmentation/sac_segmentation.h>
#include <pcl/filters/passthrough.h>
//added for hydro:
#include <pcl_conversions/pcl_conversions.h>
#include <sensor_msgs/PointCloud2.h>
using namespace std;
ros::Publisher pub;
float picked_x = 0.0;
float picked_y = 0.0;
float picked_z = 1.0;
//typedefs
typedef pcl::PointXYZRGB rgbpoint;
typedef pcl::PointCloud<pcl::PointXYZRGB> cloudrgb;
typedef cloudrgb::Ptr cloudrgbptr;
void
cloud_cb (const sensor_msgs::PointCloud2ConstPtr& cloud)
{
cloudrgbptr PC (new cloudrgb());
cloudrgbptr PC_filtered_x (new cloudrgb());
cloudrgbptr PC_filtered_xy (new cloudrgb());
cloudrgbptr PC_filtered_xyz (new cloudrgb());
pcl::fromROSMsg(*cloud, *PC); //Now you can process this PC using the pcl functions
sensor_msgs::PointCloud2 cloud_filtered;
//calculate bounding box
float delta = 0.5;
float xmin = picked_x - delta;
float xmax = picked_x + delta;
float ymin = picked_y - delta;
float ymax = picked_y + delta;
float zmin = picked_z - delta;
float zmax = picked_z + delta;
//----------------------------------------
//------Start Passthrough Filter----------
//----------------------------------------
// Create the filtering object x
pcl::PassThrough<pcl::PointXYZRGB> pass_x;
pass_x.setInputCloud (PC);
pass_x.setFilterFieldName ("x");
pass_x.setFilterLimits (xmin, xmax);
//pass_x.setFilterLimitsNegative (true);
pass_x.filter (*PC_filtered_x);
//I'm not sure if I need to create new objects for each passthrough or if I can just reset it each time with new settings.
//I'm going to be safe and create new objects for each.
// Create the filtering object y
pcl::PassThrough<pcl::PointXYZRGB> pass_y;
pass_y.setInputCloud (PC_filtered_x);
pass_y.setFilterFieldName ("y");
pass_y.setFilterLimits (ymin, ymax);
//pass_y.setFilterLimitsNegative (true);
pass_y.filter (*PC_filtered_xy);
// Create the filtering object z
pcl::PassThrough<pcl::PointXYZRGB> pass_z;
pass_z.setInputCloud (PC_filtered_xy);
pass_z.setFilterFieldName ("z");
pass_z.setFilterLimits (zmin, zmax);
//pass_z.setFilterLimitsNegative (true);
pass_z.filter (*PC_filtered_xyz);
//Convert the pcl cloud back to rosmsg
pcl::toROSMsg(*PC_filtered_xyz, cloud_filtered);
//Set the header of the cloud
cloud_filtered.header.frame_id = cloud->header.frame_id;
// Publish the data
//You may have to set the header frame id of the cloud_filtered also
pub.publish (cloud_filtered);
}
int
main (int argc, char** argv)
{
// Initialize ROS
ros::init (argc, argv, "picked_segmentation");
ros::NodeHandle nh;
// Create a ROS subscriber for the input point cloud
ros::Subscriber sub = nh.subscribe ("/camera/depth_registered/points", 1, cloud_cb);
// Create a ROS publisher for the output point cloud
pub = nh.advertise<sensor_msgs::PointCloud2> ("/camera/depth_registered/seg_points", 1);
// Spin
ros::spin ();
}
|
0eb2caf08fd692309a550e92c0611397e1e84473 | e00047d43784e64cf31d15b0c3a6dd65ba771cb7 | /CTCI/4-Additional-Review-Problems/16-Moderate/Gunjan/16-2-Word-Frequencies.cpp | f0dad35e24e0ad8d071ff594a0823653e4a1fd0c | [] | no_license | swayamxd/noobmaster69 | e49510f7c02c5323c0ac78d76bad2f31124f3b72 | f549c365c4623e2ea17ca120d72c8488bfcfd8de | refs/heads/master | 2022-01-16T13:04:14.666901 | 2022-01-12T11:55:06 | 2022-01-12T11:55:06 | 199,595,424 | 3 | 2 | null | 2020-12-01T04:18:11 | 2019-07-30T07:07:52 | C++ | UTF-8 | C++ | false | false | 2,388 | cpp | 16-2-Word-Frequencies.cpp | #include<iostream>
#include<unordered_map>
using namespace std;
string getBook(){
string book = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean scelerisque consectetur laoreet. Curabitur lacinia lorem a sagittis molestie. Phasellus aliquet enim ac nunc interdum interdum. Pellentesque odio metus, eleifend in felis in, fermentum blandit risus. Nunc fringilla semper dui in mattis. Donec suscipit sit amet nulla eu pretium. Curabitur sollicitudin condimentum tellus ac accumsan. Curabitur sapien urna, maximus eu tempor sed, euismod eget nisi. Morbi vel felis quis metus ornare elementum. Morbi ut nisi est. Integer sit amet justo mauris. Phasellus tempus auctor lacus, vitae scelerisque nibh consequat vitae. Suspendisse sollicitudin sed erat tempus posuere. Duis porta enim et odio posuere molestie. Cras eget urna a nunc fermentum sagittis. Nam luctus pharetra scelerisque. Vivamus at maximus arcu. Vestibulum eros massa, lobortis vitae blandit in, vulputate faucibus eros. Quisque mollis gravida eros. Pellentesque eu viverra urna, nec tincidunt purus. Nullam lacus orci, varius eget leo ultrices, cursus aliquet orci. Vivamus tristique iaculis facilisis. Suspendisse euismod erat molestie nulla placerat elementum. Donec lacus sapien, ornare et augue id, porta tincidunt diam. Vivamus in ullamcorper enim. Curabitur sapien neque, placerat nec eleifend et, lacinia vitae nisi. Nulla viverra elementum pharetra. Phasellus pellentesque nec sem id vehicula. Vivamus convallis interdum enim, sed sodales elit laoreet nec.";
return book;
}
unordered_map <string,int> getFreq(string&book){
unordered_map <string,int> wordFreqTable;
string word = "";
for(int i=0;i<book.length();i++){
if(book[i]==' '){
wordFreqTable[word]++;
word.clear();
} else {
word.push_back(book[i]);
}
}
return wordFreqTable;
}
void test(string&book,unordered_map<string,int>&wordFreqTable){
string word;
for(int i=0;i<book.length();i++){
if(book[i]==' '){
cout << "Frequency of '" << word << "' is : " << wordFreqTable[word] << endl;
word.clear();
} else {
word.push_back(book[i]);
}
}
}
int main(){
string book = getBook();
unordered_map <string,int> wordFreqTable = getFreq(book);
test(book,wordFreqTable);
return 0;
} |
243251149932fe989ab9366729270b4adda8723d | 8bf1aed9ef31254280340940b219a008b9a86f50 | /Finished/May-22-2019/Destructor/framwork.cpp | 219c1a1e79c83d7415c5abfb5733a9c8466a9756 | [] | no_license | Xianbo-X/Matrix_General_HW | 8f03a16122e27f77846ff4b46ea309171e5542eb | 5406f77b79b6076952fbcf7fdafbc59ad2625b1e | refs/heads/master | 2022-01-12T19:23:25.687742 | 2019-06-21T11:46:46 | 2019-06-21T11:46:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 170 | cpp | framwork.cpp | #include <iostream>
#include "source.h"
void fun(A *a) { delete a; }
int main() {
A *a = new B(10);
a->Prin();
fun(a);
B *b = new B(20);
fun(b);
return 0;
} |
3de648fd373495e37c716581d676a02cfa8768ca | ad96c497c21c968fbf666036f6defdd484559f31 | /mainwindow.h | 0eccaa45a59ef05f589b8a25e5a2d3dcac5390e4 | [] | no_license | arg1998/LightKnightPlayer | ef49cf143e1508059a22b5676f6687199a2aae5e | 46abb6745e92c9109894298e8c8896d6422d1ed2 | refs/heads/master | 2022-12-24T06:13:26.559078 | 2020-10-12T10:06:49 | 2020-10-12T10:06:49 | 303,340,881 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,306 | h | mainwindow.h | #ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QDebug>
#include <QPushButton>
#include <QFileDialog>
#include <QSerialPortInfo>
#include <QSerialPort>
#include <QMediaPlayer>
#include "project.h"
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private:
Ui::MainWindow *ui;
bool m_isPlaying;
Project currentProject;
QMediaPlayer *mediaPlayer;
bool isDraggingSlider;
QList<QSerialPortInfo> portlist;
QSerialPortInfo *selectedPort;
bool isPortConnected;
QSerialPort *port;
int currentFrame;
int _temp_pos;
public:
bool connectToArduino();
void displayProjectInfo();
void resetMusic();
void play();
void pause();
void addLog(QString);
signals:
void updateSlider(int value);
public slots:
void import_new_project();
void play_and_pause();
void refresh_ports();
void audioProgress(qint64);
void mediaStatusChanged(QMediaPlayer::MediaStatus);
void beginDrag();
void endDrag();
void mediaPlayerStateChanged(QMediaPlayer::State);
void onPortChangedIndex(int);
void connect_disconnect_port();
};
#endif // MAINWINDOW_H
|
3c49d073c95d4084c0921494d206c25ba1cac71d | f5c6ef416967d3209d5b07b5d29c94f683c58881 | /processmsg.cpp | e6d85accaa3493abaf8a0ead2e01a68e0743c461 | [] | no_license | llkid/tcpThreadServer | 1bf02262efcbfaa9433cea301ea2ddc9e1ccafda | 0061526a62e1e96022f64fddc10ca7ac9081f6ad | refs/heads/master | 2022-12-05T17:54:23.707644 | 2020-08-29T14:53:48 | 2020-08-29T14:53:48 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 955 | cpp | processmsg.cpp | #include "processmsg.h"
#include <QThread>
#include <QHostAddress>
#include <QDebug>
ProcessMsg::ProcessMsg(QObject* parent)
{
Q_UNUSED(parent)
socketNumber = 0;
}
void ProcessMsg::connected(QTcpSocket &socket)
{
qDebug() << "---------------------------------";
qDebug() << "Connected: ";
qDebug() << "Current thread id: " << QThread::currentThreadId();
qDebug() << socket.peerAddress();
qDebug() << socket.peerPort();
qDebug() << "Current link numbers: " << ++socketNumber;
}
void ProcessMsg::disconnected(const QTcpSocket &socket)
{
qDebug() << "---------------------------------";
qDebug() << "Disconnected: ";
qDebug() << "Current thread id: " << QThread::currentThreadId();
qDebug() << socket.peerAddress();
qDebug() << socket.peerPort();
qDebug() << "Current link numbers: " << --socketNumber;
}
void ProcessMsg::readyRead(QTcpSocket &socket)
{
qDebug() << socket.readAll().data();
}
|
2baff4d99184ef47b22f0291ce3ff76c6e4a7afa | 0ac0d098320409b5ef0270b09e67f1d815a8c4f2 | /What the hell!/Horse_t.cpp | bcf83f3ae471f637a646fc6009aff5060e66d988 | [] | no_license | Clownce/WhatTheHell | 24c355a3d86d27ad2a89f4f4301ff21ac83ba59f | def5a5791e788f939ccdff392983953be0ccdb03 | refs/heads/master | 2021-10-19T15:37:16.753864 | 2019-02-22T06:42:09 | 2019-02-22T06:42:09 | 97,461,534 | 2 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,944 | cpp | Horse_t.cpp | #include "stdafx.h"
#include "Horse_t.h"
CHorse_t::CHorse_t()
{
}
CHorse_t::CHorse_t(int x, int level)
{
m_position.x = x;
if (level == 1)
{
m_pImg = cvLoadImage("图像资源/第一关/真马.jpg", 1);
}
else
{
m_pImg = cvLoadImage("图像资源/第二关/真马.jpg", 1);
}
}
CHorse_t::~CHorse_t()
{
}
void CHorse_t::Init(int Level)
{
if (Level == 1)
{
m_pImg = cvLoadImage("图像资源/第一关/真马.jpg", 1);
m_size = cvGetSize(m_pImg);
m_position.x = 23;
m_position.y = 210;
}
else if (Level == 3)
{
m_pImg = cvLoadImage("图像资源/第三关/真马.jpg", 1);
m_size = cvGetSize(m_pImg);
m_position.x = 1720;
m_position.y = 215;
}
}
void CHorse_t::Init()
{
m_size = cvGetSize(m_pImg);
m_position.y = 210;
}
int CHorse_t::CollideJudge(CMan* man,int Level)
{
if (Level == 1)
{
if (man->m_position.x + man->m_size.width / 2 > m_position.x
&&man->m_position.x + man->m_size.width / 2 < m_position.x + m_size.width
&&man->m_position.y + man->m_size.height / 2 < m_position.y + m_size.height
&&man->m_position.y + man->m_size.height / 2 > m_position.y)
{
Success(man);
}
}
else if (Level == 3)
{
if (m_position.x == 1720 && (man->m_position.x + man->m_size.width) > 1720 && (man->m_position.x + man->m_size.width) < 1730 && man->m_position.y > 200 && man->m_position.y < 245)
{
man->life = 0;
}
if (m_position.x == 1720 && man->m_position.x > 1750 && man->m_position.y > 230 && man->m_position.y < 245)
{
Success(man);
}
}
return 0;
}
int CHorse_t::CollideJudge(CMan* man)
{
if (man->m_position.x + man->m_size.width / 2 > m_position.x
&&man->m_position.x + man->m_size.width / 2 < m_position.x + m_size.width
&&man->m_position.y + man->m_size.height / 2 < m_position.y + m_size.height
&&man->m_position.y + man->m_size.height / 2 > m_position.y)
{
Success(man);
}
return 0;
}
void CHorse_t::Success(CMan* man)
{
man->success = 1;
}
|
0d88c386fa3898e70a1b4834ce1f3904871056b0 | e5292428482181499e59886ad2ee50c83a504f6e | /codeforces/team.cpp | b2a761a6d4de133863227893694725eea60fc1c0 | [] | no_license | pedrohenriqueos/maratona | fa01ebfe747d647cf4f88c486e1a798b3bcdbb3d | 5c9bffa2ec6a321a35c854d4800b4fe7931c1baf | refs/heads/master | 2020-03-22T06:35:23.879463 | 2020-02-27T20:15:53 | 2020-02-27T20:15:53 | 139,644,788 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 237 | cpp | team.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int N,quant=0;
cin >> N;
bool P,V,T;
for(int i=0;i<N;i++){
cin >> P >> V >> T;
if((P==V and P) or (P==T and P) or (V==T and V))
quant++;
}
cout << quant << '\n';
}
|
9af2b2af028c7abacc210a4802cfe6f0199664b4 | 4ee8932c0b62f12177d88973c45512eb8752b1ab | /Toothless_Arduino_Code/src/main.cpp | e071a045f402bc2dbfde766deb862edafd163945 | [
"BSD-2-Clause"
] | permissive | phantom-5/Toothless | f5228a903fec4965316ea39fa88ef54bdf00af78 | a89dc53fd6cab904d147457bf8547f69c23b9dfd | refs/heads/master | 2020-03-18T14:18:41.239034 | 2018-06-16T07:06:50 | 2018-06-16T07:06:50 | 134,841,432 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 4,518 | cpp | main.cpp | #include <Arduino.h>
#include <AFMotor.h>
#include <Servo.h>
Servo stest;
AF_DCMotor mur(1);
AF_DCMotor mbr(2);
AF_DCMotor mbl(4);
AF_DCMotor mul(3);
int servoPos=0;
int trigPin = A0;
int echoPin = A5;
int speed=0;
int first_control_forward=0;
int move_control=0;
int scan_control=0;
int angle_loop_func=0;
int Bluetooth_Override_Active=0;
int Transit_Mode_Active=0;
int Left_Angle_Count=0;
int Right_Angle_Count=0;
float cal_dis();
void move_forward();
void move_backward();
void move_left();
void move_right();
void strategic_delay(int value);
void stop();
int scan(int dis);
void setup() {
//Serial.begin(9600);
mbr.setSpeed(250);
mur.setSpeed(250);
mbl.setSpeed(250);
mul.setSpeed(250);
stest.attach(10);
pinMode(trigPin,OUTPUT);
pinMode(echoPin,INPUT);
}
void loop() {
stest.write(90);
if (Bluetooth_Override_Active == 0){
if (Transit_Mode_Active == 0){
int gotcha = scan(45);
// Serial.println("gotcha");
// Serial.println(gotcha);
if(gotcha>0){
//move left
while(move_control==0){
move_right();
strategic_delay((((7-gotcha)*300)));
}stop();
}else if(gotcha<0){
//move right
while(move_control==0){
move_left();
strategic_delay(((7-((-1)*gotcha))*300));
}stop();
}
move_control=0;
scan_control=0;
Transit_Mode_Active=1;
}else{
if(cal_dis()<=60 && cal_dis()>25){
while(cal_dis() <= 40){
move_forward();
}
stop();
}else if(cal_dis()>=0 && cal_dis()<=25){
while(cal_dis()>=40){
move_backward();
}
stop();
}else{
Transit_Mode_Active=0;
}
}
}//this ends autonomous code
}
float cal_dis(){
//returns distance in cm
float duration,distance;
digitalWrite(trigPin,LOW);
delayMicroseconds(2);
digitalWrite(trigPin,HIGH);
delayMicroseconds(10);
digitalWrite(trigPin,LOW);
duration=pulseIn(echoPin,HIGH);
distance=(duration/2)*0.03444;
return distance;
}
void move_forward(){
mbr.run(FORWARD);
mur.run(FORWARD);
mbl.run(FORWARD);
mul.run(FORWARD);
Transit_Mode_Active=0;
}
void move_backward(){
mbr.run(BACKWARD);
mur.run(BACKWARD);
mbl.run(BACKWARD);
mul.run(BACKWARD);
Transit_Mode_Active=0;
}
void move_left(){
mbr.run(FORWARD);
mur.run(FORWARD);
mbl.run(BACKWARD);
mul.run(BACKWARD);
}
void move_right(){
mbr.run(BACKWARD);
mur.run(BACKWARD);
mbl.run(FORWARD);
mul.run(FORWARD);
}
void stop(){
mbr.run(RELEASE);
mur.run(RELEASE);
mbl.run(RELEASE);
mul.run(RELEASE);
}
int scan(int dis){
while(scan_control==0){
float distance;
int angle=0;
Left_Angle_Count=0;
Right_Angle_Count=0;
//0 degree is left , 180 is right , 90 is center
stest.write(90);
if(cal_dis()<=dis){
return 0;
}
for(servoPos=0;servoPos<=90;servoPos+=15){
distance=cal_dis();
// Serial.println(distance);
if(distance<=dis){
stest.write(servoPos);
//angle=servoPos;
distance=cal_dis();
scan_control=1;
break;
}
stest.write(servoPos);
delay(200);
//angle++; //move towards right
Left_Angle_Count++;
}
if(cal_dis()<=dis){
return 0;
}
if(scan_control==1){
if (Left_Angle_Count==6){stest.write(90);}
return Left_Angle_Count;
}
for(servoPos=180;servoPos>=90;servoPos-=15){
distance=cal_dis();
// Serial.println(distance);
if(distance<=dis){
stest.write(servoPos);
//angle=servoPos;
distance=cal_dis();
scan_control=1;
break;
}
stest.write(servoPos);
delay(200);
//angle--; //moves towards left
Right_Angle_Count--;
}
if(scan_control==1){
if (Right_Angle_Count==6){stest.write(90);}
return Right_Angle_Count;
}
}
}
void strategic_delay(int value){
delay(value);
move_control=1;
Serial.println(move_control);
} |
6d0e6f2dfb317415d68b17bf038355f35910da86 | 7261b4cfaaa633a2a83631755ae4ad52b2caaab7 | /cnes/src/otb/HermiteInterpolator.h | f04a9141de52e725946898cb6d6e2698a9ffa00a | [
"MIT"
] | permissive | ossimlabs/ossim-plugins | 54c06555c92fb595f8270b63902a4e7ef1cc1e51 | 6575511a70d4594f0eef6d5800d60ea4b8fc0866 | refs/heads/dev | 2023-07-24T12:18:05.047728 | 2023-07-12T16:34:15 | 2023-07-12T16:34:15 | 43,512,138 | 12 | 24 | MIT | 2023-06-14T12:56:23 | 2015-10-01T18:04:33 | C++ | UTF-8 | C++ | false | false | 2,208 | h | HermiteInterpolator.h | //----------------------------------------------------------------------------
//
// "Copyright Centre National d'Etudes Spatiales"
//
// License: LGPL
//
// See LICENSE.txt file in the top level directory for more details.
//
//----------------------------------------------------------------------------
// $Id$
#ifndef HermiteInterpolator_h
#define HermiteInterpolator_h
#include <ossim/plugin/ossimPluginConstants.h>
namespace ossimplugins
{
/**
* @brief Abstract interpolator
* @see Interpolate
*/
class OSSIM_PLUGINS_DLL HermiteInterpolator
{
public:
/**
* @brief Constructor
*/
HermiteInterpolator();
/**
* @brief Constructor with initializations
* @param nbrPoints Number of points used to perform the interpolation
* @param x Values of the points abscissa
* @param y Values of the points
* @param dy Values of the differential coefficients
*/
HermiteInterpolator(int nbrPoints, double* x, double* y, double* dy);
/**
* @brief Destructor
*/
~HermiteInterpolator();
/**
* @brief Copy constructor
*/
HermiteInterpolator(const HermiteInterpolator& rhs);
/**
* @brief Affectation operator
*/
HermiteInterpolator& operator =(const HermiteInterpolator& rhs);
/**
* @brief This function performs the interpolation for the abscissa x
* @param x Abscissa of the interpolation
* @param y [out] value of the point at the abscissa x
* @param dy [out] value of the differential coefficient at abscissa x
* @return Different of 0 if an error occurs
*/
int Interpolate(double x, double& y, double& dy) const;
/**
* @brief This function performs the interpolation for the abscissa x
* @param x Abscissa of the interpolation
* @param y [out] value of the point at the abscissa x
* @return Different of 0 if an error occurs
*/
int Interpolate(double x, double& y) const;
protected:
void Clear();
int theNPointsAvailable;
double* theXValues;
double* theYValues;
double* thedYValues;
mutable double* prodC;
mutable double* sumC;
mutable bool isComputed;
int Precompute() const; // const in a semantic way
private:
};
}
#endif
|
5398574448bd90f681ee5d8fbc228b696cb1beb3 | 38ea408580f592f504815b9be0de75112b5d1a87 | /code/maps.cpp | e04f998a898b303e80d045a471f0d6f5a27165cf | [] | no_license | ramster0111/Pac-man | dee531e4ab3d1be05dfda1645c368d5b76567544 | d36d379d4c60d6235e5de5720768a43a597ff72c | refs/heads/master | 2021-01-10T19:40:49.157991 | 2012-03-25T11:07:01 | 2012-03-25T11:07:01 | 2,944,159 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 27,351 | cpp | maps.cpp | #include "maps.h"
//#include "config.h"
//#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <list>
#include "config.h"
#include <conio.h>
//#include <cstdlib>
int maps::z=0;
void maps::IncLevel(){
++level;
}
maps::maps(){
pink=new Ghost(1);
red=new Ghost(2);
orange=new Ghost(3);
brown=new Ghost(4);
totdots=0;
ctr=3;
D=6;
endFlag=0;
level=1;
screen = SDL_SetVideoMode (SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE /*|SDL_FULLSCREEN*/);
level=1;
GFX = new graphics(screen);
GFX -> loadImageData();
SFX = new audio();
GFX -> loadFontData();
SFX -> loadWavSoundData();
GFX->renderGraphics(26,Player1.GetX(),Player1.GetY());
}
int maps::ghost(){
if(z%2==0)
MoveGhost(*red);
if(z%3==0)
MoveGhost(*pink);
if(z%4==0)
MoveGhost(*orange);
if(z%5==0)
MoveGhost(*brown);
z++;
return endFlag;
}
void maps::ReadName(){
char c;
std::stringstream name;
GFX->Flip();
while(c!=13){
std::cout<<"entering name";
c=getch();
std::cout<<"\t"<<c<<"\n";
name<<c;
}
GFX->renderGraphics(17,0,0);
std::string n = name.str();
GFX->renderText(1, n.c_str(), 0,150,255, 5, 100);
}
void maps::ChkKill(){
int ctr=0;
if(red->GetX()==Player1.GetX()&&red->GetY()==Player1.GetY()&&!red->IsPillActive())
ctr=1;
if(orange->GetX()==Player1.GetX()&&orange->GetY()==Player1.GetY()&&!orange->IsPillActive())
ctr=1;
if(brown->GetX()==Player1.GetX()&&brown->GetY()==Player1.GetY()&&!brown->IsPillActive())
ctr=1;
if(pink->GetX()==Player1.GetX()&&pink->GetY()==Player1.GetY()&&!pink->IsPillActive())
ctr=1;
if(ctr==1){
Player1.Reset();
red->Reset();
pink->Reset();
orange->Reset();
brown->Reset();
std::cout<<Player1.getLives();
if(Player1.getLives()==0){
std::cout<<"game over";
SFX->playSound(3);
SDL_Delay(2000);
GFX->renderGraphics(17,0,0);
std::cout<<"enter name";
//ReadName();
high.input();
high.handleHighscore(high);
DisplayHigh();
endFlag=1;
}
if(endFlag==0){
SFX->playSound(3);
SDL_Delay(2000);
GFX->renderGraphics(17,0,0);
DrawMap();
}
}
if(red->IsPillActive()&&red->GetX()==Player1.GetX()&&red->GetY()==Player1.GetY())
{
red->InitiateKill();
std::cout<<"Ghost DEad";
// Player1.BonusScore();
}
if(pink->IsPillActive()&&pink->GetX()==Player1.GetX()&&pink->GetY()==Player1.GetY())
{
pink->InitiateKill();
std::cout<<"Ghost DEad";
// Player1.BonusScore();
}
if(orange->IsPillActive()&&orange->GetX()==Player1.GetX()&&orange->GetY()==Player1.GetY())
{
orange->InitiateKill();
std::cout<<"Ghost DEad";
// Player1.BonusScore();
}
if(brown->IsPillActive()&&brown->GetX()==Player1.GetX()&&brown->GetY()==Player1.GetY())
{
brown->InitiateKill();
std::cout<<"Ghost DEad";
//Player1.BonusScore();
}
}
void maps::MoveGhost(Ghost &ghost){
ghost.PacPos(Player1.GetX()/30,Player1.GetY()/30);
ghost.SetTarget();
switch(ghost.Move()){
case 1:
//std::cout<<"going up \n";
for(int i=0;i<(30/ctr);i++){
GFX->renderGraphics(21,ghost.GetX(),ghost.GetY()); GFX->renderGraphics(21,Player1.GetX(),Player1.GetY());
ghost.SetY(ghost.GetY()-ctr);
GFX->renderGraphics(21+ghost.RetColor(),ghost.GetX(),ghost.GetY());
SDL_Delay(D);
//std::cout<<MAP[(Player1.GetY())/30-1][(Player1.GetX()/30) ]<<" "<<Player1.GetX()/30<<" "<<Player1.GetY()/30<<std::endl;
}
if(MAP[(ghost.GetY())/30+1][(ghost.GetX()/30) ]==48)
GFX->renderGraphics(16,ghost.GetX(),ghost.GetY()+30);
if(MAP[(ghost.GetY())/30+1][(ghost.GetX()/30) ]==57)
GFX->renderGraphics(19,ghost.GetX(),ghost.GetY()+30);
break;
case 2:
// std::cout<<"going right \n";
for(int i=0;i<(30/ctr);i++){ GFX->renderGraphics(21,Player1.GetX(),Player1.GetY());
GFX->renderGraphics(21,ghost.GetX(),ghost.GetY());
ghost.SetX(ghost.GetX()+ctr);
GFX->renderGraphics(21+ghost.RetColor(),ghost.GetX(),ghost.GetY());
SDL_Delay(D);
}
if(MAP[(ghost.GetY())/30][(ghost.GetX()/30-1) ]==48)
GFX->renderGraphics(16,ghost.GetX()-30,ghost.GetY());
break;
case 3:
// std::cout<<"going down \n";
for(int i=0;i<(30/ctr);i++){ GFX->renderGraphics(21,Player1.GetX(),Player1.GetY());
GFX->renderGraphics(21,ghost.GetX(),ghost.GetY());
ghost.SetY(ghost.GetY()+ctr);
GFX->renderGraphics(21+ghost.RetColor(),ghost.GetX(),ghost.GetY());
SDL_Delay(D);
}
if(MAP[(ghost.GetY())/30-1][(ghost.GetX()/30) ]==48)
GFX->renderGraphics(16,ghost.GetX(),ghost.GetY()-30);
if(MAP[(ghost.GetY())/30-1][(ghost.GetX()/30) ]==57)
GFX->renderGraphics(19,ghost.GetX(),ghost.GetY()-30);
break;
case 4:
//std::cout<<"going left \n";
for(int i=0;i<(30/ctr);i++){ GFX->renderGraphics(21,Player1.GetX(),Player1.GetY());
GFX->renderGraphics(21,ghost.GetX(),ghost.GetY());
ghost.SetX(ghost.GetX()-ctr);
GFX->renderGraphics(21+ghost.RetColor(),ghost.GetX(),ghost.GetY());
SDL_Delay(D);
}
if(MAP[(ghost.GetY())/30][(ghost.GetX()/30)+1 ]==48)
GFX->renderGraphics(16,ghost.GetX()+30,ghost.GetY());
break;
}
GFX->renderGraphics(26+Player1.RetFrame(),Player1.GetX(),Player1.GetY());
GFX-> Flip();
}
void maps::MapData(){
if(level==1){
FILE *f = fopen("data\\r.txt","r");
char c;
if (f==NULL) std::cout<<"Error opening file";
else{
MAP.clear();
std::cout<<"level 1\n";
GFX->renderGraphics(37,230,200);
GFX->Flip();
SDL_Delay(2000);
red->Reset();
orange->Reset();
pink->Reset();
brown->Reset();
GFX->renderGraphics(17);
for ( int i = 0; i < 18; i++ ){
MAP.push_back ( vector<int>() );
for ( int j = 0; j < 26; j++ ){
c = fgetc (f);
if(c == EOF){
fclose (f);
break;
}
MAP[i].push_back ( (int)c );
if(c=='0')
totdots++;
}
}
for ( int i = 0; i < 18; i++ ) {
for ( int j = 0; j < 26; j++ )
cout<<MAP[i][j] <<' ';
cout<<'\n';
}
}
}
if(level==2){
FILE *f2 = fopen("data\\r2.txt","r");
char c2;
if (f2==NULL) std::cout<<"Error opening file";
else{
MAP.clear();
GFX->renderGraphics(38,230,200);
GFX->Flip();
SDL_Delay(2000);
red->Reset();
orange->Reset();
pink->Reset();
brown->Reset();
GFX->renderGraphics(17);
std::cout<<"level 2\n";
for ( int i = 0; i < 18; i++ ){
MAP.push_back ( vector<int>() );
for ( int j = 0; j < 26; j++ ){
c2 = fgetc (f2);
if(c2 == EOF){
fclose (f2);
break;
}
MAP[i].push_back ( (int)c2);
if(c2=='0')
totdots++;
}
}
for ( int i = 0; i < 18; i++ ) {
for ( int j = 0; j < 26; j++ )
cout<<MAP[i][j] <<' ';
cout<<'\n';
}
}
}
if(level==3){
FILE *f3 = fopen("data\\r3.txt","r");
char c3;
if (f3==NULL) std::cout<<"Error opening file";
else{
MAP.clear();
GFX->renderGraphics(39,230,200);
GFX->Flip();
SDL_Delay(2000);
red->Reset();
orange->Reset();
pink->Reset();
brown->Reset();
GFX->renderGraphics(17);
for ( int i = 0; i < 18; i++ ){
MAP.push_back ( vector<int>() );
for ( int j = 0; j < 26; j++ ){
c3 = fgetc (f3);
if(c3 == EOF){
fclose (f3);
break;
}
MAP[i].push_back ( (int)c3 );
if(c3=='0')
totdots++;
}
}
for ( int i = 0; i < 18; i++ ) {
for ( int j = 0; j < 26; j++ )
cout<<MAP[i][j] <<' ';
cout<<'\n';
}
}
}
if(level==4){
FILE *f4 = fopen("data\\r4.txt","r");
char c4;
if (f4==NULL) std::cout<<"Error opening file";
else{
MAP.clear();
GFX->renderGraphics(40,230,200);
GFX->Flip();
SDL_Delay(2000);
red->Reset();
orange->Reset();
pink->Reset();
brown->Reset();
GFX->renderGraphics(17);
for ( int i = 0; i < 18; i++ ){
MAP.push_back ( vector<int>() );
for ( int j = 0; j < 26; j++ ){
c4 = fgetc (f4);
if(c4 == EOF){
fclose (f4);
break;
}
MAP[i].push_back ( (int)c4 );
if(c4=='0')
totdots++;
}
}
for ( int i = 0; i < 18; i++ ) {
for ( int j = 0; j < 26; j++ )
cout<<MAP[i][j] <<' ';
cout<<'\n';
}
}
}
if(level==5){
FILE *f5 = fopen("data\\r5.txt","r");
char c5;
if (f5==NULL) std::cout<<"Error opening file";
else{
MAP.clear();
GFX->renderGraphics(41,230,200);
GFX->Flip();
SDL_Delay(2000);
GFX->renderGraphics(17);
for ( int i = 0; i < 18; i++ ){
MAP.push_back ( vector<int>() );
for ( int j = 0; j < 26; j++ ){
c5 = fgetc (f5);
if(c5 == EOF){
fclose (f5);
break;
}
MAP[i].push_back ( (int)c5 );
if(c5=='0')
totdots++;
}
}
for ( int i = 0; i < 18; i++ ) {
for ( int j = 0; j < 26; j++ )
cout<<MAP[i][j] <<' ';
cout<<'\n';
}
}
}
SFX -> playSound(1);
}
int maps::MovePacman(int x){
//DrawMap();
switch(x){
case 1:if(MAP[Player1.GetY()/30-1][(Player1.GetX())/30]==48|| MAP[Player1.GetY()/30-1][(Player1.GetX())/30]==47||MAP[Player1.GetY()/30-1][(Player1.GetX())/30]==55){
if(MAP[Player1.GetY()/30-1][(Player1.GetX())/30]==48){
MAP[Player1.GetY()/30-1][(Player1.GetX())/30]=47;
SFX -> playSound(2);
Player1.collectDot();
if(level*250==Player1.getScore()/10){
IncLevel();
Player1.SetX(360);
Player1.SetY(360);
GFX->renderGraphics(21,Player1.GetX(),Player1.GetY());
GFX->renderGraphics(17);
MapData();
DrawMap();
//return 1;
}
itoa (Player1.getScore(),score,10);
GFX->renderGraphics(30,260,540);
GFX->renderText(1,score, 50,40,255, 260, 535);
}
if(MAP[Player1.GetY()/30-1][(Player1.GetX())/30]==55){
MAP[Player1.GetY()/30-1][(Player1.GetX())/30]=47;
red->ActivatePill();
orange->ActivatePill();
brown->ActivatePill();
pink->ActivatePill();
Timer=0;
Timer= SDL_GetTicks();
std::cout<<Timer;
}
GFX->renderText(2, "Score :", 150,0,255, 5, 540);
Player1.ChangeFrame(1);
for(int i=0;i<(30/ctr);i++){
GFX->renderGraphics(21,Player1.GetX(),Player1.GetY());
Player1.SetY(Player1.GetY()-ctr);
//DrawMap();
GFX->renderGraphics(26+Player1.RetFrame(),Player1.GetX(),Player1.GetY());
SDL_Delay(D);
// std::cout<<MAP[(Player1.GetY())/30-1][(Player1.GetX()/30) ]<<" "<<Player1.GetX()/30<<" "<<Player1.GetY()/30<<std::endl;
}
}
break;
case 2:if(MAP[(Player1.GetY())/30][Player1.GetX()/30+1]==48|| MAP[(Player1.GetY())/30][Player1.GetX()/30+1]==47||MAP[(Player1.GetY())/30][Player1.GetX()/30+1]==55){
if(MAP[(Player1.GetY())/30][Player1.GetX()/30+1]==48){
MAP[(Player1.GetY())/30][Player1.GetX()/30+1]=47;
SFX -> playSound(2);
Player1.collectDot();
if(level*250==Player1.getScore()/10){
IncLevel();
Player1.SetX(360);
Player1.SetY(360);
GFX->renderGraphics(21,Player1.GetX(),Player1.GetY());
GFX->renderGraphics(17);
MapData();
DrawMap();
//return 1;
}
itoa (Player1.getScore(),score,10);
GFX->renderGraphics(30,260,540);
GFX->renderText(1,score, 50,40,255, 260, 535);
}
if(MAP[(Player1.GetY())/30][Player1.GetX()/30+1]==55){
MAP[(Player1.GetY())/30][Player1.GetX()/30+1]=47;
red->ActivatePill();
orange->ActivatePill();
brown->ActivatePill();
pink->ActivatePill();
Timer=0;
Timer= SDL_GetTicks();
std::cout<<Timer;
}
GFX->renderText(2, "Score :", 0,150,255, 5, 540);
Player1.ChangeFrame(4);
for(int i=0;i<(30/ctr);i++){
GFX->renderGraphics(21,Player1.GetX(),Player1.GetY());
Player1.SetX(Player1.GetX()+ctr);
GFX->renderGraphics(26+Player1.RetFrame(),Player1.GetX(),Player1.GetY());
SDL_Delay(D);
// std::cout<<(MAP[(Player1.GetY())/30][Player1.GetX()/30+1])<<" "<<Player1.GetX()<<" "<<Player1.GetY()<<std::endl;
}
}
break;
case 3:if(MAP[Player1.GetY()/30+1][(Player1.GetX())/30]==48||MAP[Player1.GetY()/30+1][(Player1.GetX())/30]==47||MAP[Player1.GetY()/30+1][(Player1.GetX())/30]==55){
if(MAP[Player1.GetY()/30+1][(Player1.GetX())/30]==48){
MAP[Player1.GetY()/30+1][(Player1.GetX())/30]=47;
SFX -> playSound(2);
Player1.collectDot();
if(level*250==Player1.getScore()/10){
IncLevel();
Player1.SetX(360);
Player1.SetY(360);
GFX->renderGraphics(21,Player1.GetX(),Player1.GetY());
GFX->renderGraphics(17);
MapData();
DrawMap();
//return 1;
}
itoa (Player1.getScore(),score,10);
GFX->renderGraphics(30,260,540);
GFX->renderText(1,score, 50,40,255, 260, 535);
}
if(MAP[Player1.GetY()/30+1][(Player1.GetX())/30]==55){
MAP[Player1.GetY()/30+1][(Player1.GetX())/30]=47;
red->ActivatePill();
orange->ActivatePill();
brown->ActivatePill();
pink->ActivatePill();
Timer=0;
Timer= SDL_GetTicks();
std::cout<<Timer;
}
GFX->renderText(2, "Score :", 150,150,0, 5, 540);
Player1.ChangeFrame(2);
for(int i=0;i<(30/ctr);i++){
GFX->renderGraphics(21,Player1.GetX(),Player1.GetY());
Player1.SetY(Player1.GetY()+ctr);
GFX->renderGraphics(26+Player1.RetFrame(),Player1.GetX(),Player1.GetY());
SDL_Delay(D);
// std::cout<<MAP[(Player1.GetY())/30+1][(Player1.GetX()/30) ]<<" "<<Player1.GetX()/30<<" "<<Player1.GetY()/30<<std::endl;
}
}
break;
case 4:if(MAP[(Player1.GetY())/30][ Player1.GetX()/30-1 ]==48||MAP[(Player1.GetY())/30][ Player1.GetX()/30-1 ]==47||MAP[(Player1.GetY())/30][ Player1.GetX()/30-1 ]==55){
if(MAP[(Player1.GetY())/30][ Player1.GetX()/30-1 ]==48){
MAP[(Player1.GetY())/30][ Player1.GetX()/30-1 ]=47;
SFX -> playSound(2);
Player1.collectDot();
if(level*250==Player1.getScore()/10){
IncLevel();
Player1.SetX(360);
Player1.SetY(360);
GFX->renderGraphics(21,Player1.GetX(),Player1.GetY());
GFX->renderGraphics(17);
MapData();
DrawMap();
//return 1;
}
itoa (Player1.getScore(),score,10);
GFX->renderGraphics(30,260,540);
GFX->renderText(1,score, 50,40,255, 260, 535);
}
if(MAP[(Player1.GetY())/30][ Player1.GetX()/30-1 ]==55){
MAP[(Player1.GetY())/30][ Player1.GetX()/30-1 ]=47;
red->ActivatePill();
orange->ActivatePill();
brown->ActivatePill();
pink->ActivatePill();
Timer=0;
Timer= SDL_GetTicks();
std::cout<<Timer;
}
GFX->renderText(2, "Score :", 0,0,255, 5, 540);
Player1.ChangeFrame(3);
for(int i=0;i<(30/ctr);i++){
GFX->renderGraphics(21,Player1.GetX(),Player1.GetY());
Player1.SetX(Player1.GetX()-ctr);
GFX->renderGraphics(26+Player1.RetFrame(),Player1.GetX(),Player1.GetY());
SDL_Delay(D);
// std::cout<<(MAP[(Player1.GetY())/30][Player1.GetX()/30-1])<<" "<<Player1.GetX()<<" "<<Player1.GetY()<<" "<<std::endl;
}
}
break;
};
//red.SetTarget();
//MoveGhost();
GFX->renderGraphics(21+red->RetColor(),red->GetX(),red->GetY());
GFX->renderGraphics(21+pink->RetColor(),pink->GetX(),pink->GetY());
GFX->renderGraphics(21+orange->RetColor(),orange->GetX(),orange->GetY());
GFX->renderGraphics(21+brown->RetColor(),brown->GetX(),brown->GetY());
std::cout<<"totdots\t"<<totdots<<"totdots\t"<<Player1.getScore()/10<<std::endl;
if ( (SDL_GetTicks()-Timer) > 5000){
red->DeActivatePill();
orange->DeActivatePill();
brown->DeActivatePill();
pink->DeActivatePill();
}
DisplayLives();
GFX-> Flip();
return 0;
}
void maps::DrawMap(){
for(int x=0;x<18;x++)
for(int y=0;y<26;y++)
switch(MAP[x][y]){
case 49:
GFX->renderGraphics(14,y*30,x*30);
// std::cout<<"drawn";
break;
case 51:
GFX->renderGraphics(22,y*30,x*30);//pink
// std::cout<<"drawn";
break;
case 52:
GFX->renderGraphics(23,y*30,x*30);//red
// std::cout<<"drawn";
break;
case 53:
GFX->renderGraphics(24,y*30,x*30);//orange
// std::cout<<"drawn";
break;
case 54:
GFX->renderGraphics(25,y*30,x*30);//brown
// std::cout<<"drawn";
break;
case 55:
GFX->renderGraphics(15,y*30,x*30);
// std::cout<<"drawn";
break;
case 57:
GFX->renderGraphics(19,y*30,x*30);
// std::cout<<"drawn";
break;
case 56:
GFX->renderGraphics(26,y*30,x*30);
// std::cout<<"drawn";
std::cout<<Player1.GetX()<<Player1.GetY()<<totdots;
break;
case 50:
GFX->renderGraphics(18,y*30,x*30);
// std::cout<<"drawn";
break;
case 48:
GFX->renderGraphics(16,y*30,x*30);
// std::cout<<"drawn";
break;
case 32:
GFX->renderGraphics(21,y*30,x*30);
// std::cout<<"drawn";
break;
};
GFX->Flip();
MAP[(Player1.GetY())/30][Player1.GetX()/30]=47;
SDL_Delay(3000);
}
void maps::DisplayLives(){
int x=0;
for(int i=0;i<Player1.getLives();i++){
GFX->renderGraphics(29,710+x,540);
//GFX->renderGraphics(30,260,540);
x+=30 ;
}
}
void maps::DisplayHigh(){
int y=0;
GFX->renderGraphics(17,0,0);
GFX->renderText(2, "HIGHSCORES", 0,150,255, 160, 5);
std::list<Highscore> list;
Highscore::read(list);
std::list<Highscore>::iterator it = list.begin();
for(int i=1;it!= list.end(); it++,i++){
Highscore hs = *it;
std::stringstream name;
name << i;
std::cout<<hs.name;
std::string n = name.str() + ". " + hs.name;
std::cout<<n;
name.clear();
GFX->renderText(1, n.c_str(), 0,150,255, 5, 100+y);
std::stringstream sc;
sc << hs.score;
GFX->renderText(1, sc.str().c_str(), 0,150,255, 500, 100+y);
y+=90;
}
GFX->Flip();
SDL_Delay(6000);
}
|
f41a3b9c94e2fe044330610cf8a6733b4204da07 | 65c92f6c171a0565fe5275ecc48033907090d69d | /Client/Plugins/LessonManager/Implementation/LessonManager.cpp | 7b2a08f601a58087d2cdb4402b2511b176e92ba0 | [] | no_license | freakyzoidberg/horus-edu | 653ac573887d83a803ddff1881924ab82b46f5f6 | 2757766a6cb8c1f1a1b0a8e209700e6e3ccea6bc | refs/heads/master | 2020-05-20T03:08:15.276939 | 2010-01-07T14:34:51 | 2010-01-07T14:34:51 | 32,684,226 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,753 | cpp | LessonManager.cpp | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Horus is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* Horus is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with Horus. If not, see <http://www.gnu.org/licenses/>. *
* *
* The orginal content of this material was realized as part of *
* 'Epitech Innovative Project' www.epitech.eu *
* *
* You are required to preserve the names of the original authors *
* of this content in every copy of this material *
* *
* Authors : *
* - BERTHOLON Romain *
* - GRANDEMANGE Adrien *
* - LACAVE Pierre *
* - LEON-BONNET Valentin *
* - NANOUCHE Abderrahmane *
* - THORAVAL Gildas *
* - VIDAL Jeremy *
* *
* You are also invited but not required to send a mail to the original *
* authors of this content in case of modification of this material *
* *
* Contact: contact@horus-edu.net *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <QtCore/qplugin.h>
#include <QDebug>
#include <QtXml/QXmlSimpleReader>
#include <QFile>
#include <QFrame>
#include "../../../../Common/PluginManager.h"
#include "../../../../Common/FileDataPlugin.h"
#include "../../../../Common/FileData.h"
#include "LessonModel_ext.h"
#include "LessonManager.h"
bool LessonManager::canLoad() const
{
if (pluginManager->findPlugin<TreeDataPlugin*>() && pluginManager->findPlugin<FileDataPlugin*>())
return (true);
return (false);
}
void LessonManager::load()
{
//lessonModel = new LessonModel_ext(pluginManager);
lessonModel = 0;
Plugin::load();
}
void LessonManager::unload()
{
if (lessonModel)
delete lessonModel;
}
const QString LessonManager::pluginName() const
{
return ("LessonManager");
}
const QString LessonManager::pluginVersion() const
{
return ("1.1");
}
LessonModel* LessonManager::getLessonModel()
{
if (lessonModel == NULL)
lessonModel = new LessonModel_ext(pluginManager);
return lessonModel;
}
|
ec94c795d6a0428aac6911e02ddd362a93f932f0 | 6d32a95ecf5f9eedeb9b64aa9d2415ae189110a8 | /reshoot/reshoot/Collider.cpp | c5a35c5a8cf71895b97350f3a23238f9ca5645fc | [
"MIT"
] | permissive | ashkeys/reshoot | c9412b1202678840d0de59f23861eaf150d7c656 | acc9f7184de062729c8f65b03e7d5482944d0ffd | refs/heads/master | 2021-01-20T11:35:11.613494 | 2014-11-20T09:39:56 | 2014-11-20T09:39:56 | null | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 79 | cpp | Collider.cpp | /**
* @file Collider.cpp
* @brief Colliderクラス実装ファイル
*
*/
|
3d232db8451ad42ca680da301fc23230857fbf80 | 61427148b0521eb9e1c534b5fd1a7a2112127e5a | /Zadanie 2.3.cpp | 7b5fa0981090cc26d5e95e67e85d0ee9b7185fe3 | [] | no_license | s25938pj/Zadanie-2.3 | 3e2551ffceb08ebcbf3f0538a9e30868fa0b6ccd | 524e2faaa5e6f2f95ef91263ca76f73ba4a99216 | refs/heads/master | 2023-08-28T01:13:47.028100 | 2021-10-29T14:04:37 | 2021-10-29T14:04:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,227 | cpp | Zadanie 2.3.cpp |
#include <iostream>
using namespace std;
int main()
{
int liczba;
cout << "Podaj liczbę z przedziału 1-12: ";
cin >> liczba;
switch (liczba)
{
case 1:
cout << "Styczen ma 31 dni i jest w nim pochmurnie " << endl;
break;
case 2:
cout << "Luty ma 28 dni i jest w nim pochmurnie " << endl;
break;
case 3:
cout << "Marzec ma 31 dni i jest w nim pochmurnie " << endl;
break;
case 4:
cout << "Kwiecien ma 30 dni i jest w nim slonecznie " << endl;
break;
case 5:
cout << "Maj ma 31 dni i jest w nim slonecznie " << endl;
break;
case 6:
cout << "Czerwiec ma 30 dni i jest w nim slonecznie " << endl;
break;
case 7:
cout << "Lipiec ma 31 dni i jest w nim slonecznie " << endl;
break;
case 8:
cout << "Sierpien ma 31 dni i jest w nim slonecznie " << endl;
break;
case 9:
cout << "Wrzesien ma 30 dni i jest w nim slonecznie " << endl;
break;
case 10:
cout << "Pazdziernik ma 31 dni i jest w nim pochmurnie " << endl;
break;
case 11:
cout << "Listopad ma 30 dni i jest w nim pochmurnie " << endl;
break;
case 12:
cout << "Grudzien ma 31 dni i jest w nim pochmurnie " << endl;
break;
default:
cout << "Podales liczbe z przedzialu poza 1-12" << endl;
break;
}
}
|
c0e27ef7e35a3331ece1c792a0d32e8963a05307 | 5f42387a94da27090557a73458bd3d1fac20074c | /cpp/ThreadPool/Cpp11ThreadPool/ThreadPool.h | 1d1d8f7fd94aaf7ccffaa6ccf91f8187f1d0756a | [] | no_license | NicePigg/test_repository_cpp | ad5cf7d94c1c957ece63e0dcc797a140661f2f21 | da3f2fa5e662d99d1673e77f791d3a461ea58079 | refs/heads/main | 2023-07-06T21:49:55.013188 | 2021-08-11T14:06:45 | 2021-08-11T14:06:45 | 328,578,533 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 514 | h | ThreadPool.h | #pragma once
#include <unordered_map>
#include "TaskQueue.h"
#include "WorkThread.h"
#include "ThreadUtils.h"
class ThreadPool {
public:
ThreadPool(int min = 10, int max = 50);
~ThreadPool();
void AddTask(TaskPtr task);
void Finish();
private:
void AddThread();
void DelThread();
std::atomic_bool finished_;
std::unordered_map<std::thread::id, ThreadPtr> threads_;
std::thread manageThread_;
TaskQueue taskQue_;
int min_;
int max_;
}; |
bfae1f5e4bdbf9668848f0f1460d4b46e2a7056b | eddbccedc56b67d9bed5580ea208800ef498809e | /include/plumage_webapi/api/xml.hpp | 6312630cd5cf77380af542366c1ddd34913fcd6d | [] | no_license | cnsuhao/plumage_webapi | f525e5b3ac746546e8aa460498dd9cee4b32066f | ea0a1960ce67be0bbb8f75486fae38b281ca546f | refs/heads/master | 2021-05-27T03:49:37.691931 | 2013-10-20T15:57:30 | 2013-10-20T15:57:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 604 | hpp | xml.hpp | #ifndef PLUMAGE_WEB_API_XML_HPP
#define PLUMAGE_WEB_API_XML_HPP
#include <istream>
#include <ostream>
#include <boost/property_tree/xml_parser.hpp>
class XmlApi {
public:
void parse(std::istream& in_data, boost::property_tree::ptree& pt) const;
void encode(const boost::property_tree::ptree& in_data, std::ostream& out) const;
void encodeToBase64(std::istream& data, std::ostream& out) const;
void decodeFromBase64(std::istream& data, std::ostream& out) const;
private:
unsigned char getBase64Char(int num) const;
unsigned char getDecodedBit(char base64char) const;
};
#endif
|
d269e2ab0d7e04e44bed7b273d83330fba444cb3 | d2a4e57369e4be35df4d8e0f47361080a3403327 | /kernels.cpp | 06f5e6c42dfd65421a287b596581f3f61577d330 | [
"MIT"
] | permissive | os-hackathon/porTTgpu | 2947c1903d5ff267f9fcbbc8f932b22d578a9f5a | cf0c26a7dc8d17986415786ec6bb8eba7ed40ed9 | refs/heads/main | 2023-06-04T01:27:45.282731 | 2021-06-25T18:24:49 | 2021-06-25T18:24:49 | 380,318,563 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,547 | cpp | kernels.cpp |
#include <hip/hip_runtime.h>
#include "tensor_transpose.h"
#include <cuComplex.h>
// ************** Float Real ************** //
__global__ void transpose_021_fr(float *dIn, float *dOut, int Nx, int Ny, int Nz){
size_t i = threadIdx.x + blockDim.x*blockIdx.x;
size_t j = threadIdx.y + blockDim.y*blockIdx.y;
size_t k = threadIdx.z + blockDim.z*blockIdx.z;
if( i < Nx && j < Ny && k < Nz ) {
dOut[T3D_INDEX(i,j,k,Nx,Ny,Nz)] = dIn[T3D_INDEX(i,k,j,Nx,Nz,Ny)];
}
}
__global__ void transpose_102_fr(float *dIn, float *dOut, int Nx, int Ny, int Nz){
size_t i = threadIdx.x + blockDim.x*blockIdx.x;
size_t j = threadIdx.y + blockDim.y*blockIdx.y;
size_t k = threadIdx.z + blockDim.z*blockIdx.z;
if( i < Nx && j < Ny && k < Nz ) {
dOut[T3D_INDEX(i,j,k,Nx,Ny,Nz)] = dIn[T3D_INDEX(j,i,k,Ny,Nx,Nz)];
}
}
__global__ void transpose_120_fr(float *dIn, float *dOut, int Nx, int Ny, int Nz){
size_t i = threadIdx.x + blockDim.x*blockIdx.x;
size_t j = threadIdx.y + blockDim.y*blockIdx.y;
size_t k = threadIdx.z + blockDim.z*blockIdx.z;
if( i < Nx && j < Ny && k < Nz ) {
dOut[T3D_INDEX(i,j,k,Nx,Ny,Nz)] = dIn[T3D_INDEX(j,k,i,Ny,Nz,Nx)];
}
}
__global__ void transpose_210_fr(float *dIn, float *dOut, int Nx, int Ny, int Nz){
size_t i = threadIdx.x + blockDim.x*blockIdx.x;
size_t j = threadIdx.y + blockDim.y*blockIdx.y;
size_t k = threadIdx.z + blockDim.z*blockIdx.z;
if( i < Nx && j < Ny && k < Nz ) {
dOut[T3D_INDEX(i,j,k,Nx,Ny,Nz)] = dIn[T3D_INDEX(k,j,i,Nz,Ny,Nx)];
}
}
/*
__global__ void transpose_210_fr_block(float *dIn, float *dOut, int Nx, int Ny, int Nz){
// Each thread is responsible for transposing an 8x8x8 block.
// The start of a block is calculated from the blockIdx.[x,y,z]
// The i0, j0, k0 correspond to the starting index for the block
size_t i0 = threadIdx.x + 8*blockIdx.x;
size_t j0 = threadIdx.y + 8*blockIdx.y;
size_t k0 = threadIdx.z + 8*blockIdx.z;
int width = gridDim.x*8;
dIn(
/*
* do k = 0, nBz
* do j = 0, nBy
* do i = 0, nBx
* do lk = 0,7
*
* dout(i,j,k) = din(k,j,i)
* enddo
* enddo
* enddo
*
dOut[T3D_INDEX(i,j,k,Nx,Ny,Nz)] = dIn[T3D_INDEX(k,j,i,Nz,Ny,Nx)];
}
*/
__global__ void transpose_201_fr(float *dIn, float *dOut, int Nx, int Ny, int Nz){
size_t i = threadIdx.x + blockDim.x*blockIdx.x;
size_t j = threadIdx.y + blockDim.y*blockIdx.y;
size_t k = threadIdx.z + blockDim.z*blockIdx.z;
if( i < Nx && j < Ny && k < Nz ) {
dOut[T3D_INDEX(i,j,k,Nx,Ny,Nz)] = dIn[T3D_INDEX(k,i,j,Nz,Nx,Ny)];
}
}
__global__ void copy_fr(float *dIn, float *dOut, int Nx, int Ny, int Nz){
size_t i = threadIdx.x + blockDim.x*blockIdx.x;
size_t j = threadIdx.y + blockDim.y*blockIdx.y;
size_t k = threadIdx.z + blockDim.z*blockIdx.z;
if( i < Nx && j < Ny && k < Nz ) {
dOut[T3D_INDEX(i,j,k,Nx,Ny,Nz)] = dIn[T3D_INDEX(i,j,k,Nz,Ny,Nx)];
}
}
// ************** Double Real ************** //
__global__ void transpose_021_dr(double *dIn, double *dOut, int Nx, int Ny, int Nz){
size_t i = threadIdx.x + blockDim.x*blockIdx.x;
size_t j = threadIdx.y + blockDim.y*blockIdx.y;
size_t k = threadIdx.z + blockDim.z*blockIdx.z;
if( i < Nx && j < Ny && k < Nz ) {
dOut[T3D_INDEX(i,j,k,Nx,Ny,Nz)] = dIn[T3D_INDEX(i,k,j,Nx,Nz,Ny)];
}
}
__global__ void transpose_102_dr(double *dIn, double *dOut, int Nx, int Ny, int Nz){
size_t i = threadIdx.x + blockDim.x*blockIdx.x;
size_t j = threadIdx.y + blockDim.y*blockIdx.y;
size_t k = threadIdx.z + blockDim.z*blockIdx.z;
if( i < Nx && j < Ny && k < Nz ) {
dOut[T3D_INDEX(i,j,k,Nx,Ny,Nz)] = dIn[T3D_INDEX(j,i,k,Ny,Nx,Nz)];
}
}
__global__ void transpose_120_dr(double *dIn, double *dOut, int Nx, int Ny, int Nz){
size_t i = threadIdx.x + blockDim.x*blockIdx.x;
size_t j = threadIdx.y + blockDim.y*blockIdx.y;
size_t k = threadIdx.z + blockDim.z*blockIdx.z;
if( i < Nx && j < Ny && k < Nz ) {
dOut[T3D_INDEX(i,j,k,Nx,Ny,Nz)] = dIn[T3D_INDEX(j,k,i,Ny,Nz,Nx)];
}
}
__global__ void transpose_210_dr(double *dIn, double *dOut, int Nx, int Ny, int Nz){
size_t i = threadIdx.x + blockDim.x*blockIdx.x;
size_t j = threadIdx.y + blockDim.y*blockIdx.y;
size_t k = threadIdx.z + blockDim.z*blockIdx.z;
if( i < Nx && j < Ny && k < Nz ) {
dOut[T3D_INDEX(i,j,k,Nx,Ny,Nz)] = dIn[T3D_INDEX(k,j,i,Nz,Ny,Nx)];
}
}
__global__ void transpose_201_dr(double *dIn, double *dOut, int Nx, int Ny, int Nz){
size_t i = threadIdx.x + blockDim.x*blockIdx.x;
size_t j = threadIdx.y + blockDim.y*blockIdx.y;
size_t k = threadIdx.z + blockDim.z*blockIdx.z;
if( i < Nx && j < Ny && k < Nz ) {
dOut[T3D_INDEX(i,j,k,Nx,Ny,Nz)] = dIn[T3D_INDEX(k,i,j,Nz,Nx,Ny)];
}
}
// ************** Float Complex ************** //
__global__ void transpose_021_fc(cuFloatComplex *dIn, cuFloatComplex *dOut, int Nx, int Ny, int Nz){
size_t i = threadIdx.x + blockDim.x*blockIdx.x;
size_t j = threadIdx.y + blockDim.y*blockIdx.y;
size_t k = threadIdx.z + blockDim.z*blockIdx.z;
if( i < Nx && j < Ny && k < Nz ) {
dOut[T3D_INDEX(i,j,k,Nx,Ny,Nz)] = dIn[T3D_INDEX(i,k,j,Nx,Nz,Ny)];
}
}
__global__ void transpose_102_fc(cuFloatComplex *dIn, cuFloatComplex *dOut, int Nx, int Ny, int Nz){
size_t i = threadIdx.x + blockDim.x*blockIdx.x;
size_t j = threadIdx.y + blockDim.y*blockIdx.y;
size_t k = threadIdx.z + blockDim.z*blockIdx.z;
if( i < Nx && j < Ny && k < Nz ) {
dOut[T3D_INDEX(i,j,k,Nx,Ny,Nz)] = dIn[T3D_INDEX(j,i,k,Ny,Nx,Nz)];
}
}
__global__ void transpose_120_fc(cuFloatComplex *dIn, cuFloatComplex *dOut, int Nx, int Ny, int Nz){
size_t i = threadIdx.x + blockDim.x*blockIdx.x;
size_t j = threadIdx.y + blockDim.y*blockIdx.y;
size_t k = threadIdx.z + blockDim.z*blockIdx.z;
if( i < Nx && j < Ny && k < Nz ) {
dOut[T3D_INDEX(i,j,k,Nx,Ny,Nz)] = dIn[T3D_INDEX(j,k,i,Ny,Nz,Nx)];
}
}
__global__ void transpose_210_fc(cuFloatComplex *dIn, cuFloatComplex *dOut, int Nx, int Ny, int Nz){
size_t i = threadIdx.x + blockDim.x*blockIdx.x;
size_t j = threadIdx.y + blockDim.y*blockIdx.y;
size_t k = threadIdx.z + blockDim.z*blockIdx.z;
if( i < Nx && j < Ny && k < Nz ) {
dOut[T3D_INDEX(i,j,k,Nx,Ny,Nz)] = dIn[T3D_INDEX(k,j,i,Nz,Ny,Nx)];
}
}
__global__ void transpose_201_fc(cuFloatComplex *dIn, cuFloatComplex *dOut, int Nx, int Ny, int Nz){
size_t i = threadIdx.x + blockDim.x*blockIdx.x;
size_t j = threadIdx.y + blockDim.y*blockIdx.y;
size_t k = threadIdx.z + blockDim.z*blockIdx.z;
if( i < Nx && j < Ny && k < Nz ) {
dOut[T3D_INDEX(i,j,k,Nx,Ny,Nz)] = dIn[T3D_INDEX(k,i,j,Nz,Nx,Ny)];
}
}
// ************** Double Complex ************** //
__global__ void transpose_021_dc(cuDoubleComplex *dIn, cuDoubleComplex *dOut, int Nx, int Ny, int Nz){
size_t i = threadIdx.x + blockDim.x*blockIdx.x;
size_t j = threadIdx.y + blockDim.y*blockIdx.y;
size_t k = threadIdx.z + blockDim.z*blockIdx.z;
if( i < Nx && j < Ny && k < Nz ) {
dOut[T3D_INDEX(i,j,k,Nx,Ny,Nz)] = dIn[T3D_INDEX(i,k,j,Nx,Nz,Ny)];
}
}
__global__ void transpose_102_dc(cuDoubleComplex *dIn, cuDoubleComplex *dOut, int Nx, int Ny, int Nz){
size_t i = threadIdx.x + blockDim.x*blockIdx.x;
size_t j = threadIdx.y + blockDim.y*blockIdx.y;
size_t k = threadIdx.z + blockDim.z*blockIdx.z;
if( i < Nx && j < Ny && k < Nz ) {
dOut[T3D_INDEX(i,j,k,Nx,Ny,Nz)] = dIn[T3D_INDEX(j,i,k,Ny,Nx,Nz)];
}
}
__global__ void transpose_120_dc(cuDoubleComplex *dIn, cuDoubleComplex *dOut, int Nx, int Ny, int Nz){
size_t i = threadIdx.x + blockDim.x*blockIdx.x;
size_t j = threadIdx.y + blockDim.y*blockIdx.y;
size_t k = threadIdx.z + blockDim.z*blockIdx.z;
if( i < Nx && j < Ny && k < Nz ) {
dOut[T3D_INDEX(i,j,k,Nx,Ny,Nz)] = dIn[T3D_INDEX(j,k,i,Ny,Nz,Nx)];
}
}
__global__ void transpose_210_dc(cuDoubleComplex *dIn, cuDoubleComplex *dOut, int Nx, int Ny, int Nz){
size_t i = threadIdx.x + blockDim.x*blockIdx.x;
size_t j = threadIdx.y + blockDim.y*blockIdx.y;
size_t k = threadIdx.z + blockDim.z*blockIdx.z;
if( i < Nx && j < Ny && k < Nz ) {
dOut[T3D_INDEX(i,j,k,Nx,Ny,Nz)] = dIn[T3D_INDEX(k,j,i,Nz,Ny,Nx)];
}
}
__global__ void transpose_201_dc(cuDoubleComplex *dIn, cuDoubleComplex *dOut, int Nx, int Ny, int Nz){
size_t i = threadIdx.x + blockDim.x*blockIdx.x;
size_t j = threadIdx.y + blockDim.y*blockIdx.y;
size_t k = threadIdx.z + blockDim.z*blockIdx.z;
if( i < Nx && j < Ny && k < Nz ) {
dOut[T3D_INDEX(i,j,k,Nx,Ny,Nz)] = dIn[T3D_INDEX(k,i,j,Nz,Nx,Ny)];
}
}
|
cc851b4ff6634e9677c0f8f6fbc1c0ba3921a886 | 3b9be445aac7fa0d25bafeec930d75c0e77f257a | /BarbicanIceFloor/src/ofApp.cpp | df1ce27c350ba0ca73856b5f7a8720410602f71a | [] | no_license | jaysonh/BarbicanIceFloor2 | 73fa51f4b60a4da594094fa882fbebc79804988f | e397f11e03bfa78adc93f511d1b6ca785acd2ce9 | refs/heads/master | 2016-09-06T02:33:11.653473 | 2014-11-17T23:11:21 | 2014-11-17T23:11:21 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,622 | cpp | ofApp.cpp | #include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
showDebug=false;
userInterface.init();
motionDetector.init();
// iceFloorRenderer.init();
backgroundSound.loadSound("atmo 2.mp3");
backgroundSound.play();
ofEnableAlphaBlending();
// Set up our cracks
crackManager.Allocate(100);
crackManager.AllocateTypes(3);
crackManager.SetType(0,"crack1.jpg","crackalpha1.jpg",1.0f,"Ice crack 1.mp3");
crackManager.SetType(1,"mastercrack.jpg","mask1.jpg",1.0f,"Ice crack 3.mp3");
crackManager.SetType(2,"crack1.jpg","crackalpha1.jpg",1.0f,"Ice crack 5.mp3");
crackManager.SetMode(CrackManager::Individual);
iceRenderer.init();
ofSetFrameRate(25);
}
//--------------------------------------------------------------
void ofApp::update(){
motionDetector.update(userInterface.getFarThreshold());
crackManager.DetectMovement(motionDetector.getBlobs());
// iceFloorRenderer.update(motionDetector.getBlobs());
}
//--------------------------------------------------------------
void ofApp::draw(){
ofClear(0,0,0);
iceRenderer.draw(); // toms renderer
//iceFloorRenderer.draw();
if(showDebug){
motionDetector.drawDebugScreen();
crackManager.drawDebug();
}
userInterface.draw();
crackManager.Process();
}
void ofApp::exit() {
motionDetector.shutDownBeforeExit();
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
switch(key)
{
case '\t':
showDebug = !showDebug;
break;
}
}
//--------------------------------------------------------------
void ofApp::keyReleased(int key){
}
//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y ){
}
//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){
crackManager.CreateCrack(x,y);
}
//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){
}
//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){
}
//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){
}
|
b49bf5382e87cf33b2c990507a31ad4b589665f7 | 71cbc64910807ceab826a6c54e0fea8d96104506 | /GMServer/section_mgr.h | 0574d599b5938cd9e30472965268e48aa8afbe19 | [] | no_license | adrianolls/ll | 385580143dfc2365428469a51c220da08bfea8ec | 9c7d480036b1e6f1e3bdffe93b44bd5c70bd944a | refs/heads/master | 2022-12-26T07:06:13.260844 | 2020-09-16T04:36:17 | 2020-09-16T04:36:17 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 6,918 | h | section_mgr.h | //-----------------------------------------------------------------------------
//!\file section_mgr.h
//!\brief 大区管理器,管理该服务器管理的所有大区
//!
//!\date 2009-04-20
//! last 2009-04-20
//!\author zhangrong
//!
//! Copyright (c) 1985-2008 CTCRST Entertainment All rights reserved.
//-----------------------------------------------------------------------------
#pragma once
#include "../WorldDefine/base_define.h"
#include "../ServerDefine/rt_define.h"
class GameWorld;
class GameServer;
class GameServerLogin;
class GameServerWorld;
class GameServerDB;
class Section;
class Client;
class ServerDB;
//-----------------------------------------------------------------------------
// 大区管理器
//-----------------------------------------------------------------------------
class SectionMgr
{
public:
SectionMgr();
~SectionMgr(){};
//--------------------------------------------------------------------------
// 初始化,更新及销毁
//--------------------------------------------------------------------------
BOOL Init();
VOID Destroy();
VOID Update();
//---------------------------------------------------------------------------
// 网络相关
//---------------------------------------------------------------------------
LPBYTE RecvMsg(DWORD dwID, DWORD& dwMsgSize, INT& nUnRecved) { return m_pStreamServer->Recv(dwID, dwMsgSize, nUnRecved); }
VOID ReturnMsg(DWORD dwID, LPBYTE pMsg) { m_pStreamServer->FreeRecved(dwID, pMsg); }
VOID SendMsg(DWORD dwID, LPVOID pMsg, DWORD dwSize) { m_pStreamServer->Send(dwID, pMsg, dwSize); }
VOID HandleCmd(LPVOID pMsg, DWORD dwSize, DWORD dwID) { m_pCmdMgr->HandleCmd((tagNetCmd*)pMsg, dwSize, dwID); }
VOID SendAllServerStaticInfoToClient(Client* pClient);
//---------------------------------------------------------------------------
// 网络ID映射相关
//---------------------------------------------------------------------------
DWORD CreateNewClientID() { InterlockedExchangeAdd((LPLONG)&m_dwIDGen, 1); return m_dwIDGen; }
VOID RegisterClientID(DWORD dwID, DWORD dwSectionID) { m_mapIDSectionID.Add(dwID, dwSectionID); }
//---------------------------------------------------------------------------
// 功能相关
//---------------------------------------------------------------------------
BOOL StartServer(EServerType eType, DWORD dwSectionID, DWORD dwWorldID);
BOOL CloseServer(EServerType eType, DWORD dwSectionID, DWORD dwWorldID, BOOL bForce=FALSE);
//---------------------------------------------------------------------------
// 辅助函数
//---------------------------------------------------------------------------
TMap<DWORD, Section*> GetSectionMap(){return m_mapSection;}
Section* GetSection(DWORD dwSectionID) { return m_mapSection.Peek(dwSectionID); }
Section* GetSection(LPCTSTR);
INT GetSectionNum() { return m_mapSection.Size(); }
GameServer* GetServer(DWORD dwSectionID, DWORD dwWorldID, EServerType eType);
ServerDB* GetServerDB(DWORD dwSectionID, DWORD dwWorldID);
ServerDB* GetLoginDB(DWORD dwSectionID);
GameWorld* FindGameWorld(DWORD dwID);
INT64 GetGameWorldMinItemSerial(DWORD dwSectionID, DWORD dwWorldID);
VOID GameWorldMinItemSerialDec(DWORD dwSectionID, DWORD dwWorldID);
VOID SendDynamicInfo() { InterlockedExchange((LPLONG)&m_bSendImmediately, TRUE); }
private:
//---------------------------------------------------------------------------
// 网络消息注册
//---------------------------------------------------------------------------
VOID RegisterServerMsg();
VOID UnRegisterServerMsg();
//---------------------------------------------------------------------------
// 网络消息处理函数
//---------------------------------------------------------------------------
DWORD HandleWorldLogin(tagNetCmd* pMsg, DWORD);
//DWORD HandleStartWorld(tagNetCmd* pMsg, DWORD);
//DWORD HandleCloseWorld(tagNetCmd* pMsg, DWORD);
DWORD HandleGetWorldInfo(tagNetCmd* pMsg, DWORD);
DWORD HandleRTServiceLogin(tagNetCmd* pMsg, DWORD);
//---------------------------------------------------------------------------
// 向客户端返回操作结果
//---------------------------------------------------------------------------
DWORD HandleRetDouble(tagNetCmd* pMsg, DWORD dwID);
DWORD HandleRetAutoNotice(tagNetCmd* pMsg, DWORD dwID);
DWORD HandleRetRightNotice(tagNetCmd* pMsg, DWORD dwID);
DWORD HandleRetAccountForbid(tagNetCmd* pMsg, DWORD dwID);
DWORD HandleRetIPBlacklist(tagNetCmd* pMsg, DWORD dwID);
DWORD HandleRetCancelDouble(tagNetCmd* pMsg, DWORD dwID);
DWORD HandleRetRoleSpeak(tagNetCmd* pMsg, DWORD dwID);
DWORD HandleRetCreateItemCheck(tagNetCmd* pMsg, DWORD dwID);
DWORD HandleRetClearAttPoint(tagNetCmd* pMsg, DWORD dwID);
//DWORD HandleRetCancelRightNotice(tagNetCmd* pMsg, DWORD dwID);
DWORD HandleRetAddNeedLogRole(tagNetCmd* pMsg, DWORD dwID);
DWORD HandleRetAddFilterWords(tagNetCmd* pMsg, DWORD dwID);
DWORD HandleRetDelFilterWords(tagNetCmd* pMsg, DWORD dwID);
DWORD HandleRetGuildGodMiracle(tagNetCmd* pMsg, DWORD dwID);
//---------------------------------------------------------------------------
// 网络通信相关
//---------------------------------------------------------------------------
DWORD LoginCallBack(LPVOID, LPVOID); // 服务器连接回调函数
DWORD LogoutCallBack(LPVOID); // 服务器连接断开回调函数
//---------------------------------------------------------------------------
// 初始化相关
//---------------------------------------------------------------------------
BOOL LoadAllServerInfo();
//---------------------------------------------------------------------------
// 更新相关
//---------------------------------------------------------------------------
VOID UpdateSession();
VOID SendAllServerDynamicInfo();
//---------------------------------------------------------------------------
// 辅助函数相关
//---------------------------------------------------------------------------
GameServer* FindServer(DWORD dwID);
GameServerLogin* FindLoginServer(DWORD dwID);
GameServerWorld* FindWorldServer(DWORD dwID);
GameServerDB* FindDBServer(DWORD dwID);
private:
static const INT SEND_INFO_TICK_COUNT_DOWN = 5 * TICK_PER_SECOND; // 发送服务器信息的倒计时间隔
private:
TSFPTrunk<SectionMgr> m_Trunk;
TObjRef<NetCmdMgr> m_pCmdMgr; // 网络命令管理器
TObjRef<StreamServer> m_pStreamServer; // 网络接口
INT m_nPort; // 本地监听的端口
TMap<DWORD, Section*> m_mapSection; // 所有大区
volatile DWORD m_dwIDGen; // ID生成器
TMap<DWORD, DWORD> m_mapIDSectionID; // 网络ID与大区ID对应表
INT m_nSendInfoTickCountDown; // 发送服务器信息的倒计时
volatile BOOL m_bSendImmediately;
};
extern SectionMgr g_SectionMgr;
extern DWORD g_dwSectionID; |
49d0e60502a4d4d92b52e8adc314c7a9beea3a4e | 0eff74b05b60098333ad66cf801bdd93becc9ea4 | /second/download/CMake/CMake-gumtree/Kitware_CMake_repos_basic_block_block_16470.cpp | ce61cb81bb82dc1c785045b25a55ff604760c533 | [] | no_license | niuxu18/logTracker-old | 97543445ea7e414ed40bdc681239365d33418975 | f2b060f13a0295387fe02187543db124916eb446 | refs/heads/master | 2021-09-13T21:39:37.686481 | 2017-12-11T03:36:34 | 2017-12-11T03:36:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 61 | cpp | Kitware_CMake_repos_basic_block_block_16470.cpp | (0 != *s2++)
return (- *(const unsigned char *)(s2 - 1)); |
1979ce485907832f6ae12225841c227ff8ae1426 | 6932c21a775e4a180b0d48efb2bd33eb506d70ff | /source/CrazeEngine/Script/ScriptManager.h | 9a8ac8827633efa648ad843c2751326b3bc7faaf | [] | no_license | lindend/lighting-thesis | 8e42d4cc75212b06a5c7aa17314be9c69088a0d5 | d37f9e2a1409ba716899487f91cb9c474176df5f | refs/heads/master | 2021-01-19T13:52:48.240078 | 2013-01-23T20:45:55 | 2013-01-23T20:45:55 | 35,110,146 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 835 | h | ScriptManager.h | #pragma once
extern "C"
{
#include "lua/lua.h"
#include "lua/lauxlib.h"
}
#include <string>
namespace Craze
{
class Script;
class ScriptManager
{
CRAZE_ALLOC();
public:
ScriptManager() : L(nullptr) {}
bool Initialize();
void Shutdown();
void Update(float delta);
bool RunScript(const std::string& name, const char* pBuffer, int size, int env);
bool LoadScript(const std::string &name, const char* pBuffer, int size, Script*& pOutScript, int env = LUA_NOREF);
void ClearEnvironment(int env);
lua_State* GetL() const { return L; }
static std::string GetUID();
private:
void CreateEnvironment(int parent);
lua_State* L;
ScriptManager(const ScriptManager &);
ScriptManager & operator=(const ScriptManager &);
};
extern ScriptManager gScriptManager;
} |
1f07e0c4d126a47252fc64787991b4bdb3b57afd | 8058852f2a2279cd62e37f96552387635b138964 | /src/SystemClasses/System.SysUtils.hpp | 647e6a71e87d5d73e81c151fd119d08ad9715c61 | [
"BSL-1.0"
] | permissive | fishca/tool1cd | e77e9f5a87b0bf33b45e842d8513c210099395fa | 7cc9342988837bbdf8ee885209558f51ead59b4b | refs/heads/master | 2022-09-15T08:55:04.944729 | 2022-08-18T18:33:42 | 2022-08-18T18:33:42 | 92,711,666 | 2 | 0 | null | 2017-05-29T06:10:53 | 2017-05-29T06:10:53 | null | UTF-8 | C++ | false | false | 1,645 | hpp | System.SysUtils.hpp | #ifndef SYSTEM_SYSUTILS_HPP
#define SYSTEM_SYSUTILS_HPP
#include "System.IOUtils.hpp"
#include "String.hpp"
namespace System {
namespace SysUtils {
String StringReplace(const String &S, const String &OldPattern, const String &NewPattern, TReplaceFlags Flags);
class TStringBuilder
{
public:
explicit TStringBuilder();
explicit TStringBuilder(const String &initial);
TStringBuilder *Replace(const String &substring, const String &replace);
String ToString() const;
void Clear();
void Append(const String &s);
void Append(char c);
String value;
};
class TMultiReadExclusiveWriteSynchronizer
{
public:
void BeginWrite();
void EndWrite();
void BeginRead();
void EndRead();
};
class TEncoding
{
public:
virtual System::DynamicArray<System::t::Byte> GetPreamble() = 0;
virtual String toUtf8(const System::DynamicArray<t::Byte> &Buffer) const = 0;
virtual DynamicArray<t::Byte> fromUtf8(const String &str) = 0;
static int GetBufferEncoding(const System::DynamicArray<t::Byte> &Buffer, TEncoding* &AEncoding);
static DynamicArray<t::Byte> Convert(TEncoding * const Source, TEncoding * const Destination, const DynamicArray<t::Byte> &Bytes, int StartIndex, int Count);
//! двухбайтная кодировка WCHART
static TEncoding *Unicode;
static TEncoding *UTF8;
};
typedef System::DynamicArray<System::t::Byte> TBytes;
int StrToInt(const String &s);
struct TSearchRec {
int Time;
int64_t Size;
int Attr;
String Name;
int ExcludeAttr;
};
String ExtractFileExt(const String &filename);
} // SysUtils
namespace Sysutils = SysUtils;
} // System
using namespace System::SysUtils;
#endif
|
b167af16086cbc8cbee2f281939cf7a4210a9303 | 1f6053048ca6dea5d1cc435a46dd7b51d467158b | /matrixcalc/mainwindow.cpp | 6c0e6093b35b0d1f4bba34409cfd665528a7ed12 | [] | no_license | norbertzagozdzon/jimp2 | 24f02bc177ed8e3ffbaf6ffd47f3648a35ff9beb | f658cf3d350d484c04eedb5b09e2b12926df4d10 | refs/heads/master | 2020-04-29T08:57:02.019527 | 2019-06-03T21:55:57 | 2019-06-03T21:55:57 | 176,005,581 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,887 | cpp | mainwindow.cpp | #include "mainwindow.h"
#include "ui_mainwindow.h"
#include "matrix.h"
#include<complex>
static Matrix rep[100];
static int g;
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->textBrowserMatrix->setFont (QFont ("Courier", 9));
ui->textBrowserMatrix->setReadOnly(true);
ui->lineEditC->setDisabled(true);
ui->textEditError->setReadOnly(true);
g=0;
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::errorCompleted() {
ui->textEditError->setStyleSheet("background-color:black; color:#C0C0C0");
ui->textEditError->setText("Completed.");
}
void MainWindow::errorWrong(const QString &text) {
ui->textEditError->setStyleSheet("background-color:black;color:red");
ui->textEditError->setText(text);
}
void MainWindow::on_listWidget_clicked()
{
int curRow = ui->listWidget->currentRow();
ui->textBrowserMatrix->setText(QString::fromStdString(rep[curRow].print()));
}
int MainWindow::listSearch(QListWidget *list, QLineEdit *line) {
int listSize = list->count();
int elseIndex=-1;
for (int i=0;i<listSize;i++) {
if(line->text()==list->item(i)->text()) {
elseIndex=i;
break;
}
}
return elseIndex;
}
void MainWindow::on_pushAddMatrix_clicked()
{
if (ui->textEdit->toPlainText()!="") {
Matrix m = Matrix(ui->textEdit->toPlainText().toUtf8().constData());
if (m.isError()) {
errorWrong("Wrong matLab syntax.");
return;
}
if (ui->textVarName->text()!="") {
int listSize = ui->listWidget->count();
bool ifIs = false;
int elseIndex=-1;
for (int i=0;i<listSize;i++) {
if(ui->textVarName->text()==ui->listWidget->item(i)->text()) {
ifIs = true;
elseIndex=i;
break;
}
}
if (ifIs==false) {
ui->listWidget->addItem(ui->textVarName->text());
rep[g] = m;
g++;
}
else {
rep[elseIndex]=m;
}
errorCompleted();
}
ui->textBrowserMatrix->setText(QString::fromStdString(m.print()));
}
else {
ui->textEditError->setStyleSheet("background-color:black; color: red");
ui->textEditError->setText("Matrix Entering Zone is empty.");
}
}
void MainWindow::on_addButton_clicked()
{
ui->labelOp->setText("Add");
ui->lineEditC->setDisabled(false);
errorCompleted();
}
void MainWindow::on_subButton_clicked()
{
ui->labelOp->setText("Sub");
ui->lineEditC->setDisabled(false);
errorCompleted();
}
void MainWindow::on_mulButton_clicked()
{
ui->labelOp->setText("Mul");
ui->lineEditC->setDisabled(false);
errorCompleted();
}
void MainWindow::on_divButton_clicked()
{
ui->labelOp->setText("Div");
ui->lineEditC->setDisabled(false);
errorCompleted();
}
void MainWindow::on_mulByButton_clicked()
{
ui->labelOp->setText("MulByNum");
ui->lineEditC->setDisabled(false);
errorCompleted();
}
void MainWindow::on_divByButton_clicked()
{
ui->labelOp->setText("DivByNum");
ui->lineEditC->setDisabled(false);
errorCompleted();
}
void MainWindow::on_powButton_clicked()
{
ui->labelOp->setText("Pow");
ui->lineEditC->setDisabled(false);
errorCompleted();
}
void MainWindow::on_revButton_clicked()
{
ui->labelOp->setText("Rev");
ui->lineEditC->setDisabled(true);
errorCompleted();
}
void MainWindow::on_transButton_clicked()
{
ui->labelOp->setText("Trans");
ui->lineEditC->setDisabled(true);
errorCompleted();
}
void MainWindow::on_compButton_clicked()
{
ui->labelOp->setText("Comp");
ui->lineEditC->setDisabled(true);
errorCompleted();
}
void MainWindow::on_pushResult_clicked()
{
int i=-1,j=-1;
QString choice = ui->labelOp->text();
if(ui->lineEditB->text()!="") {
i = listSearch(ui->listWidget,ui->lineEditB);
if (i==-1) {
errorWrong("Matrix aint in the list.");
return;
}
}
else {
errorWrong("Empty slot in operation zone.");
return;
}
if(ui->lineEditC->isEnabled()==true) {
if(ui->lineEditC->text()!="") {
if (choice=="Add" || choice=="Sub" || choice=="Mul" || choice=="Div") {
j=listSearch(ui->listWidget,ui->lineEditC);
if (j==-1) {
errorWrong("Matrix aint in the list.");
return;
}
}
}
else {
errorWrong("Empty slot in operation zone.");
return;
}
}
Matrix result;
if (ui->labelOp->text()=="Add") {result = rep[i].add(rep[j]);}
else if(ui->labelOp->text()=="Sub") {result = rep[i].sub(rep[j]);}
else if(ui->labelOp->text()=="Mul") {result = rep[i].mul(rep[j]);}
else if(ui->labelOp->text()=="Div") {result = rep[i].div(rep[j]);}
else if(ui->labelOp->text()=="MulByNum") {result = rep[i].mulByNumber(readComplex(ui->lineEditC->text().toUtf8().constData()));}
else if(ui->labelOp->text()=="DivByNum") {result = rep[i].divByNumber(readComplex(ui->lineEditC->text().toUtf8().constData()));}
else if(ui->labelOp->text()=="Pow") {result = rep[i].pow(ui->lineEditC->text().toInt());}
else if(ui->labelOp->text()=="Rev") {result = rep[i].reverse();}
else if(ui->labelOp->text()=="Trans") {result = rep[i].transpose();}
else if(ui->labelOp->text()=="Comp") {result = rep[i].matrixOfComplements();}
else {
errorWrong("Enter some operation.");
return;
}
if (result.isError()) {
errorWrong("Error while operating.");
return;
}
else {
errorCompleted();
}
if(ui->lineEditA->text()=="") {
ui->textBrowserMatrix->setText(QString::fromStdString(result.print()));
}
else {
int k = listSearch(ui->listWidget,ui->lineEditA);
if (k==-1) {
ui->listWidget->addItem(ui->lineEditA->text());
rep[g]=result;
g++;
}
else {
rep[k]=result;
}
}
ui->textBrowserMatrix->setText(QString::fromStdString(result.print()));
}
void MainWindow::on_resultButtonDet_clicked()
{
if(ui->lineEditDet->text()!="") {
int i = listSearch(ui->listWidget,ui->lineEditDet);
if(i==-1) {
errorWrong("Matrix aint in the list.");
}
else {
QString result = QString::fromStdString(complexToString(rep[i].det()));
ui->textBrowserDet->setText(result);
if(result=="-1") {
errorWrong("Result of det might be wrong.");
}
}
}
else {
errorWrong("Enter some Matrix.");
}
}
|
9fd1f1fbb5b54a16ad85eb96c46a53d7e37129b1 | 563c00cea64186bc14dd125f6735bd478cbe25b7 | /Source/LowPolySurvival/TestingLibrary.cpp | f6c15cccb95667ef39d26a048a9f5d49a008299a | [] | no_license | Cr0wy1/LowPolySurvival | 3e9ae307a9fd25fe2222810a00a6848edf307fbd | 932ab90fba5df227f2e1fe40c8f2540ec216a37c | refs/heads/master | 2022-06-28T07:44:16.504480 | 2019-10-04T19:03:05 | 2019-10-04T19:03:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,028 | cpp | TestingLibrary.cpp | // Fill out your copyright notice in the Description page of Project Settings.
#include "TestingLibrary.h"
void UTestingLibrary::TArrayTest() {
TArray<float> arr;
UE_LOG(LogTemp, Warning, TEXT("declare: %s"), *GetArrayDebugData(arr) );
arr.Init(1.0f, 99);
UE_LOG(LogTemp, Warning, TEXT("Init(1.0f, 99): %s"), *GetArrayDebugData(arr));
arr.Reset();
UE_LOG(LogTemp, Warning, TEXT("Reset: %s"), *GetArrayDebugData(arr));
arr.AddUninitialized(10);
UE_LOG(LogTemp, Warning, TEXT("AddUninitialized(10): %s"), *GetArrayDebugData(arr));
UE_LOG(LogTemp, Warning, TEXT("[0]: %f"), arr[0]);
arr.Empty();
UE_LOG(LogTemp, Warning, TEXT("Empty: %s"), *GetArrayDebugData(arr));
}
FString UTestingLibrary::GetArrayDebugData(const TArray<float>& arr){
return FArrayDebugData(arr).ToString();
}
FString UTestingLibrary::GetArrayDebugData(const TArray<TArray<float>> &arr) {
FArrayDebugData debugData;
for (size_t x = 0; x < arr.Num(); x++){
debugData += FArrayDebugData(arr[x]);
}
return debugData.ToString();
}
|
bc3312166cfca9060be7c72d9bfcf4406cbf1805 | a3d6556180e74af7b555f8d47d3fea55b94bcbda | /extensions/shell/browser/shell_desktop_controller_aura_browsertest.cc | 6bde319e257309d9e8fcb92a7a930c122f60d863 | [
"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 | 7,391 | cc | shell_desktop_controller_aura_browsertest.cc | // Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "extensions/shell/browser/shell_desktop_controller_aura.h"
#include <memory>
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/time/time.h"
#include "components/keep_alive_registry/keep_alive_registry.h"
#include "extensions/browser/app_window/app_window.h"
#include "extensions/browser/app_window/app_window_registry.h"
#include "extensions/browser/browsertest_util.h"
#include "extensions/shell/browser/desktop_controller.h"
#include "extensions/shell/test/shell_apitest.h"
#include "extensions/test/result_catcher.h"
namespace extensions {
// Tests that spin up the ShellDesktopControllerAura and run async tasks like
// launching and reloading apps.
class ShellDesktopControllerAuraBrowserTest : public ShellApiTest {
public:
ShellDesktopControllerAuraBrowserTest() = default;
~ShellDesktopControllerAuraBrowserTest() override = default;
ShellDesktopControllerAuraBrowserTest(
const ShellDesktopControllerAuraBrowserTest&) = delete;
ShellDesktopControllerAuraBrowserTest& operator=(
const ShellDesktopControllerAuraBrowserTest&) = delete;
// Loads and launches a platform app that opens an app window.
void LoadAndLaunchApp() {
ASSERT_FALSE(app_);
app_ = LoadApp("platform_app");
ASSERT_TRUE(app_);
// Wait for app window to load.
ResultCatcher catcher;
EXPECT_TRUE(catcher.GetNextResult());
// A window was created.
EXPECT_EQ(1u,
AppWindowRegistry::Get(browser_context())->app_windows().size());
}
protected:
// Returns an open app window.
AppWindow* GetAppWindow() {
EXPECT_GT(AppWindowRegistry::Get(browser_context())->app_windows().size(),
0u);
return AppWindowRegistry::Get(browser_context())->app_windows().front();
}
// ShellApiTest:
void SetUpOnMainThread() override {
ShellApiTest::SetUpOnMainThread();
desktop_controller_ =
static_cast<ShellDesktopControllerAura*>(DesktopController::instance());
ASSERT_TRUE(desktop_controller_);
}
void TearDownOnMainThread() override {
EXPECT_FALSE(KeepAliveRegistry::GetInstance()->IsKeepingAlive());
ShellApiTest::TearDownOnMainThread();
}
void RunDesktopController() {
desktop_controller_->PreMainMessageLoopRun();
auto run_loop = std::make_unique<base::RunLoop>();
desktop_controller_->WillRunMainMessageLoop(run_loop);
run_loop->Run();
desktop_controller_->PostMainMessageLoopRun();
}
scoped_refptr<const Extension> app_;
private:
raw_ptr<ShellDesktopControllerAura, DanglingUntriaged> desktop_controller_ =
nullptr;
};
// Test that closing the app window stops the DesktopController.
IN_PROC_BROWSER_TEST_F(ShellDesktopControllerAuraBrowserTest, CloseAppWindow) {
bool test_succeeded = false;
// Post a task so everything runs after the DesktopController starts.
base::SingleThreadTaskRunner::GetCurrentDefault()->PostTaskAndReply(
FROM_HERE,
// Asynchronously launch the app.
base::BindOnce(&ShellDesktopControllerAuraBrowserTest::LoadAndLaunchApp,
base::Unretained(this)),
// Once the app launches, run the test.
base::BindLambdaForTesting([this, &test_succeeded]() {
// Close the app window so DesktopController quits.
GetAppWindow()->OnNativeClose();
test_succeeded = true;
}));
// Start DesktopController. It should run until the last app window closes.
RunDesktopController();
EXPECT_TRUE(test_succeeded)
<< "DesktopController quit before test completed.";
}
// Test that the DesktopController runs until all app windows close.
IN_PROC_BROWSER_TEST_F(ShellDesktopControllerAuraBrowserTest, TwoAppWindows) {
bool test_succeeded = false;
// Post a task so everything runs after the DesktopController starts.
base::SingleThreadTaskRunner::GetCurrentDefault()->PostTaskAndReply(
FROM_HERE,
// Asynchronously launch the app.
base::BindOnce(&ShellDesktopControllerAuraBrowserTest::LoadAndLaunchApp,
base::Unretained(this)),
// Once the app launches, run the test.
base::BindLambdaForTesting([this, &test_succeeded]() {
// Create a second app window.
ASSERT_TRUE(browsertest_util::ExecuteScriptInBackgroundPageNoWait(
browser_context(), app_->id(),
"chrome.app.window.create('/hello.html');"));
ResultCatcher catcher;
ASSERT_TRUE(catcher.GetNextResult());
// Close the first app window.
GetAppWindow()->OnNativeClose();
// One window is still open, so the DesktopController should still be
// running. Post a task to close the last window.
base::SingleThreadTaskRunner::GetCurrentDefault()->PostDelayedTask(
FROM_HERE, base::BindLambdaForTesting([this, &test_succeeded]() {
GetAppWindow()->OnNativeClose();
test_succeeded = true;
}),
// A regression might cause DesktopController to quit before the
// last window closes. To ensure we catch this, wait a while before
// closing the last window. If DesktopController::Run() finishes
// before we close the last window and update |test_succeeded|, the
// test fails.
base::Milliseconds(500));
}));
RunDesktopController();
EXPECT_TRUE(test_succeeded)
<< "DesktopController quit before test completed.";
}
// Test that the DesktopController stays open while an app reloads, even though
// the app window closes.
IN_PROC_BROWSER_TEST_F(ShellDesktopControllerAuraBrowserTest, ReloadApp) {
bool test_succeeded = false;
// Post a task so everything runs after the DesktopController starts.
base::SingleThreadTaskRunner::GetCurrentDefault()->PostTaskAndReply(
FROM_HERE,
// Asynchronously launch the app.
base::BindOnce(&ShellDesktopControllerAuraBrowserTest::LoadAndLaunchApp,
base::Unretained(this)),
// Once the app launches, run the test.
base::BindLambdaForTesting([this, &test_succeeded]() {
// Reload the app.
ASSERT_TRUE(browsertest_util::ExecuteScriptInBackgroundPageNoWait(
browser_context(), app_->id(), "chrome.runtime.reload();"));
// Wait for the app window to re-open.
ResultCatcher catcher;
ASSERT_TRUE(catcher.GetNextResult());
// Close the new window after a delay. DesktopController should remain
// open until the window closes.
base::SingleThreadTaskRunner::GetCurrentDefault()->PostDelayedTask(
FROM_HERE, base::BindLambdaForTesting([this, &test_succeeded]() {
AppWindow* app_window = AppWindowRegistry::Get(browser_context())
->app_windows()
.front();
app_window->OnNativeClose();
test_succeeded = true;
}),
base::Milliseconds(500));
}));
RunDesktopController();
EXPECT_TRUE(test_succeeded)
<< "DesktopController quit before test completed.";
}
} // namespace extensions
|
4fa69584331768770f1cdf0962929bd46c02d782 | ad2bc5064a090f56cee7604704e2b6a4c4dcaefd | /include/IDisplay.h | 52e1b9eb36057b87a87e929b7168d8dacab86f9b | [] | no_license | mdebelle/Nibbler | 212db500a390b39737956aafc76c68be06c329dc | b657cbd2316e126f5c7a57d2edde964ccf593f6e | refs/heads/master | 2020-05-20T06:12:14.729629 | 2015-05-07T08:16:12 | 2015-05-07T08:16:12 | 32,392,301 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 829 | h | IDisplay.h | #ifndef IDISPLAY_H
# define IDISPLAY_H
#include "Pattern.h"
#include "Snake.h"
class IDisplay
{
public:
enum Key
{
NONE, // Generic one without any effect
UP, LEFT, RIGHT, DOWN, // First player moves
W, A, S, D, // Second player moves
ESC, // Quit
SPACE, // Pause
ONE, // NCurses
TWO, // OpenGL
THREE, // SFML
M // Multi Player Option
};
virtual ~IDisplay() {};
virtual void init(int width, int height) = 0;
virtual Key getEvent() = 0;
virtual void close() = 0;
virtual void drawField() = 0;
virtual void drawMenu(bool multi, bool sound) = 0;
virtual void drawScoring(int pts, int player, int level, bool multi) = 0;
virtual void drawPattern(
int posX,
int posY,
Pattern::Type type
) = 0;
virtual void display() = 0;
};
#endif
|
ed01e65503de0ec1d517cec1fc9b784f80e1818a | 777a75e6ed0934c193aece9de4421f8d8db01aac | /src/Providers/UNIXProviders/BlockStatisticsManifest/UNIX_BlockStatisticsManifest.h | 711ce1cc245339648c46e0eac36a54b91603ea5e | [
"MIT"
] | permissive | brunolauze/openpegasus-providers-old | 20fc13958016e35dc4d87f93d1999db0eae9010a | b00f1aad575bae144b8538bf57ba5fd5582a4ec7 | refs/heads/master | 2021-01-01T20:05:44.559362 | 2014-04-30T17:50:06 | 2014-04-30T17:50:06 | 19,132,738 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,120 | h | UNIX_BlockStatisticsManifest.h | //%LICENSE////////////////////////////////////////////////////////////////
//
// Licensed to The Open Group (TOG) under one or more contributor license
// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
// this work for additional information regarding copyright ownership.
// Each contributor licenses this file to you under the OpenPegasus Open
// Source License; you may not use this file except in compliance with the
// License.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////
//
//%/////////////////////////////////////////////////////////////////////////
#ifndef __UNIX_BLOCKSTATISTICSMANIFEST_H
#define __UNIX_BLOCKSTATISTICSMANIFEST_H
#include "CIM_ManagedElement.h"
#include "UNIX_BlockStatisticsManifestDeps.h"
#define PROPERTY_ELEMENT_TYPE "ElementType"
#define PROPERTY_INCLUDE_START_STATISTIC_TIME "IncludeStartStatisticTime"
#define PROPERTY_INCLUDE_STATISTIC_TIME "IncludeStatisticTime"
#define PROPERTY_INCLUDE_TOTAL_I_OS "IncludeTotalIOs"
#define PROPERTY_INCLUDE_K_BYTES_TRANSFERRED "IncludeKBytesTransferred"
#define PROPERTY_INCLUDE_I_O_TIME_COUNTER "IncludeIOTimeCounter"
#define PROPERTY_INCLUDE_READ_I_OS "IncludeReadIOs"
#define PROPERTY_INCLUDE_READ_HIT_I_OS "IncludeReadHitIOs"
#define PROPERTY_INCLUDE_READ_I_O_TIME_COUNTER "IncludeReadIOTimeCounter"
#define PROPERTY_INCLUDE_READ_HIT_I_O_TIME_COUNTER "IncludeReadHitIOTimeCounter"
#define PROPERTY_INCLUDE_K_BYTES_READ "IncludeKBytesRead"
#define PROPERTY_INCLUDE_WRITE_I_OS "IncludeWriteIOs"
#define PROPERTY_INCLUDE_WRITE_HIT_I_OS "IncludeWriteHitIOs"
#define PROPERTY_INCLUDE_WRITE_I_O_TIME_COUNTER "IncludeWriteIOTimeCounter"
#define PROPERTY_INCLUDE_WRITE_HIT_I_O_TIME_COUNTER "IncludeWriteHitIOTimeCounter"
#define PROPERTY_INCLUDE_K_BYTES_WRITTEN "IncludeKBytesWritten"
#define PROPERTY_INCLUDE_IDLE_TIME_COUNTER "IncludeIdleTimeCounter"
#define PROPERTY_INCLUDE_MAINT_OP "IncludeMaintOp"
#define PROPERTY_INCLUDE_MAINT_TIME_COUNTER "IncludeMaintTimeCounter"
class UNIX_BlockStatisticsManifest :
public CIM_ManagedElement
{
public:
UNIX_BlockStatisticsManifest();
~UNIX_BlockStatisticsManifest();
virtual Boolean initialize();
virtual Boolean load(int&);
virtual Boolean finalize();
virtual Boolean find(Array<CIMKeyBinding>&);
virtual Boolean validateKey(CIMKeyBinding&) const;
virtual void setScope(CIMName);
virtual Boolean getInstanceID(CIMProperty&) const;
virtual String getInstanceID() const;
virtual Boolean getCaption(CIMProperty&) const;
virtual String getCaption() const;
virtual Boolean getDescription(CIMProperty&) const;
virtual String getDescription() const;
virtual Boolean getElementName(CIMProperty&) const;
virtual String getElementName() const;
virtual Boolean getElementType(CIMProperty&) const;
virtual Uint16 getElementType() const;
virtual Boolean getIncludeStartStatisticTime(CIMProperty&) const;
virtual Boolean getIncludeStartStatisticTime() const;
virtual Boolean getIncludeStatisticTime(CIMProperty&) const;
virtual Boolean getIncludeStatisticTime() const;
virtual Boolean getIncludeTotalIOs(CIMProperty&) const;
virtual Boolean getIncludeTotalIOs() const;
virtual Boolean getIncludeKBytesTransferred(CIMProperty&) const;
virtual Boolean getIncludeKBytesTransferred() const;
virtual Boolean getIncludeIOTimeCounter(CIMProperty&) const;
virtual Boolean getIncludeIOTimeCounter() const;
virtual Boolean getIncludeReadIOs(CIMProperty&) const;
virtual Boolean getIncludeReadIOs() const;
virtual Boolean getIncludeReadHitIOs(CIMProperty&) const;
virtual Boolean getIncludeReadHitIOs() const;
virtual Boolean getIncludeReadIOTimeCounter(CIMProperty&) const;
virtual Boolean getIncludeReadIOTimeCounter() const;
virtual Boolean getIncludeReadHitIOTimeCounter(CIMProperty&) const;
virtual Boolean getIncludeReadHitIOTimeCounter() const;
virtual Boolean getIncludeKBytesRead(CIMProperty&) const;
virtual Boolean getIncludeKBytesRead() const;
virtual Boolean getIncludeWriteIOs(CIMProperty&) const;
virtual Boolean getIncludeWriteIOs() const;
virtual Boolean getIncludeWriteHitIOs(CIMProperty&) const;
virtual Boolean getIncludeWriteHitIOs() const;
virtual Boolean getIncludeWriteIOTimeCounter(CIMProperty&) const;
virtual Boolean getIncludeWriteIOTimeCounter() const;
virtual Boolean getIncludeWriteHitIOTimeCounter(CIMProperty&) const;
virtual Boolean getIncludeWriteHitIOTimeCounter() const;
virtual Boolean getIncludeKBytesWritten(CIMProperty&) const;
virtual Boolean getIncludeKBytesWritten() const;
virtual Boolean getIncludeIdleTimeCounter(CIMProperty&) const;
virtual Boolean getIncludeIdleTimeCounter() const;
virtual Boolean getIncludeMaintOp(CIMProperty&) const;
virtual Boolean getIncludeMaintOp() const;
virtual Boolean getIncludeMaintTimeCounter(CIMProperty&) const;
virtual Boolean getIncludeMaintTimeCounter() const;
private:
CIMName currentScope;
# include "UNIX_BlockStatisticsManifestPrivate.h"
};
#endif /* UNIX_BLOCKSTATISTICSMANIFEST */
|
70a0ffac7d6cacbce98ea36a6bf2adc2a80888c7 | 63be43d521452cf0665f17cb1a0796cd186b5c28 | /discrete-math/Hamiltonian Paths && Cycles/d.cpp | ce25c7db5068da5d60b109e276e10d73795870f6 | [] | no_license | DMozhevitin/ITMO | 1eb62ecb1a6a2de01a7913c7aae071ad99b93db7 | 45c1099bbdfa9b3f8932ff66339b74a6f095d3ac | refs/heads/main | 2023-02-28T07:48:38.870719 | 2021-02-06T23:17:03 | 2021-02-06T23:17:03 | 336,550,936 | 3 | 7 | null | null | null | null | UTF-8 | C++ | false | false | 3,558 | cpp | d.cpp | #define _FORTIFY_SOURCE 0
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")
#include <iostream>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <random>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;
const ll N = 1 * 1e7 + 10;
const ll INF = 1e18 + 100;
const ll NO_EDGE = 100000;
const ll M = 5e3 + 100;
#define x first
#define y second
#define pb push_back
vector<int> hamPath, hamCycle;
set<int> unused;
bool g[M][M];
vector<bool> used;
int n;
struct lamp {
set<int> less, more;
};
vector<lamp> lamps;
vector<int> concat(vector<int> a, int b, vector<int> c) {
vector<int> res;
for (const auto &it : a) {
res.pb(it);
}
res.pb(b);
for (const auto &it : c) {
res.pb(it);
}
return res;
}
string isMore(int a, int b) {
return g[a][b] ? "YES" : "NO";
}
void print(set<int> s) {
cout << "s: " << endl;
for (const auto &it : s) {
cout << it << " ";
}
cout << endl;
}
vector<int> split(set<int> s) {
string answer;
if (s.empty()) {
return vector<int>();
}
auto it = s.begin();
int v = *it;
s.erase(it);
if (s.empty()) {
vector<int> res;
res.pb(v);
return res;
}
if (s.size() == 1) {
answer = isMore(*s.begin(), v);
vector<int> res;
if (answer == "YES") {
res.pb(*s.begin());
res.pb(v);
} else {
res.pb(v);
res.pb(*s.begin());
}
return res;
}
for (const auto &it : s) {
answer = isMore(it, v);
if (answer == "YES") {
lamps[v].less.insert(it);
} else {
lamps[v].more.insert(it);
}
}
return concat(split(lamps[v].less), v, split(lamps[v].more));
}
void dfs(int v) {
used[v] = true;
for (int i = 0; i < n; i++) {
if (g[v][i] && !used[i]) {
dfs(i);
}
}
hamCycle.pb(v);
}
void createCycle() {
for (int i = 0; i < hamPath.size(); i++) {
hamCycle.clear();
used.clear();
used.resize(n, false);
dfs(i);
if (g[hamCycle.front()][hamCycle.back()]) {
reverse(hamCycle.begin(), hamCycle.end());
break;
}
}
}
int main() {
freopen("guyaury.in", "r", stdin);
freopen("guyaury.out", "w", stdout);
cin >> n;
string s;
getline(cin, s);
for (int i = 0; i < n; i++) {
string s;
getline(cin, s);
g[i][i] = 0;
for (int j = 0; j < s.size(); j++) {
g[i][j] = (s[j] == '1');
g[j][i] = (s[j] == '0');
}
}
lamps.resize(n);
int start = 0;
string answer;
for (int i = 1; i < n; i++) {
if (i == start) continue;
answer = isMore(i, start);
if (answer == "YES") {
lamps[start].less.insert(i);
} else {
lamps[start].more.insert(i);
}
}
hamPath = concat(split(lamps[start].less), start, split(lamps[start].more));
createCycle();
for (const auto &it : hamCycle) {
cout << it + 1 << " ";
}
fclose(stdin);
fclose(stdout);
} |
deb581788a58ea9cdee7531c090216b3548675d3 | 0c22d527c18df1f4edb90523f01e4a56cdf58606 | /NaoTH2011-light/NaoTHSoccer/Source/Core/Cognition/Modules/Perception/VisualCortex/ColorProvider.cpp | d65625216b68631e2fea8b3f12697c105b529d66 | [] | no_license | IntelligentRoboticsLab/DNT2013 | 3d9fdb1677858fe73006132cc47dda54b47ef165 | ddc47ce982fe9f9cfaf924902208df1d5e53a802 | refs/heads/master | 2020-04-09T06:04:30.577673 | 2013-12-11T13:39:12 | 2013-12-11T13:39:12 | 9,521,743 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,158 | cpp | ColorProvider.cpp | /**
* @file ColorProvider.h
*
* @author <a href="mailto:mellmann@informatik.hu-berlin.de">Heinrich Mellmann</a>
* Implementation of class ColorProvider
*/
#include "ColorProvider.h"
// needed to load the colortable
#include <PlatformInterface/Platform.h>
ColorProvider::ColorProvider()
{
const string colorTablePath = naoth::Platform::getInstance().theConfigDirectory + "/colortable.c64";
getColorTable64().loadFromFile(colorTablePath);
getColorClassificationModel().setColorTable(getColorTable64());
}
void ColorProvider::execute()
{
if
(
getFieldColorPercept().lastUpdated.getFrameNumber() == getFrameInfo().getFrameNumber()
)
{
getColorClassificationModel().setFieldColorPercept(getFieldColorPercept());
}
else
{
getColorClassificationModel().invalidateFieldColorPercept();
}
if(getBaseColorRegionPercept().lastUpdated.getFrameNumber() == getFrameInfo().getFrameNumber())
{
getColorClassificationModel().setBaseColorRegionPercept(getBaseColorRegionPercept());
}
else
{
getColorClassificationModel().invalidateBaseColorRegionPercept();
}
}//end execute
|
957d7ea3c8181ea60a3cc42f51a3e9429c762ab1 | 877818edab914a50d6e7c389d050ca9827d1cefe | /cf/5.1/C.cpp | b0f1e192380942d1490149e8b002a087e232c3c0 | [] | no_license | Phoenix-Xie/algorithm_training | 11ededa6b68c77028f1bb1823f9780a56706203a | 7d472417198c70491663f59bbd29b04c6d328f5c | refs/heads/master | 2020-03-18T21:36:33.780265 | 2018-05-29T12:35:03 | 2018-05-29T12:35:03 | 135,289,481 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 674 | cpp | C.cpp | #include <bits/stdc++.h>
#define ll long long
#define MS 200010
using namespace std;
ll num_wa, num_da;
ll hea[MS];
ll pre[MS];
ll find(ll v){
ll l = 0, r = num_wa;
ll mid = l+(r-l)/2;
while(l < r){
mid = l + (r-l)/2;
if(pre[mid] <= v) l = mid+1;
else r = mid;
}
return r;
}
int main(){
cin >> num_wa >> num_da;
pre[0] = 0;
for(ll i = 0 ; i < num_wa; i++) {
cin >> hea[i];
pre[i+1] = pre[i]+hea[i];
}
ll damage = 0, damage_t;
for(ll i = 0 ; i < num_da; i++){
cin >> damage_t;
damage+= damage_t;
if(damage >= pre[num_wa]){
damage = 0;
cout << num_wa << endl;
}
else{
ll x = find(damage);
cout << num_wa-x+1 << endl;
}
}
}
|
3b76184b120d7c9b9d71089eb2cbe4775fd1a73c | 1452bd64555f0fa57730cee1dc2a796f93370058 | /python/lsst/afw/cameraGeom/_detectorCollection.cc | af3a271dbc3ae4f716e7754bb0ba7f281f0f59f4 | [] | no_license | lsst/afw | 5c6fd179b78eb50391f5db2c89e127cf7fdaea3b | 5b0a8152295a779573e119dde2297b13acc35365 | refs/heads/main | 2023-09-01T12:13:29.736376 | 2023-08-08T00:34:08 | 2023-08-08T00:34:08 | 23,013,175 | 18 | 52 | null | 2023-09-13T13:52:50 | 2014-08-16T07:37:40 | C++ | UTF-8 | C++ | false | false | 3,557 | cc | _detectorCollection.cc | /*
* This file is part of afw.
*
* Developed for the LSST Data Management System.
* This product includes software developed by the LSST Project
* (https://www.lsst.org).
* See the COPYRIGHT file at the top-level directory of this distribution
* for details of code ownership.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "pybind11/pybind11.h"
#include <lsst/utils/python.h>
#include "pybind11/stl.h"
#include "lsst/afw/table/io/python.h"
#include "lsst/afw/cameraGeom/DetectorCollection.h"
namespace py = pybind11;
using namespace py::literals;
namespace lsst {
namespace afw {
namespace cameraGeom {
namespace {
template <typename T>
using PyDetectorCollectionBase =
py::class_<DetectorCollectionBase<T>, std::shared_ptr<DetectorCollectionBase<T>>>;
using PyDetectorCollection = py::class_<DetectorCollection, DetectorCollectionBase<Detector const>,
std::shared_ptr<DetectorCollection>>;
template <typename T>
void declareDetectorCollectionBase(PyDetectorCollectionBase<T> &cls) {
cls.def("getNameMap", &DetectorCollectionBase<T>::getNameMap);
cls.def("getIdMap", &DetectorCollectionBase<T>::getIdMap);
cls.def("__len__", &DetectorCollectionBase<T>::size);
cls.def("get",
py::overload_cast<std::string const &, std::shared_ptr<T>>(&DetectorCollectionBase<T>::get,
py::const_),
"name"_a, "default"_a = nullptr);
cls.def("get", py::overload_cast<int, std::shared_ptr<T>>(&DetectorCollectionBase<T>::get, py::const_),
"id"_a, "default"_a = nullptr);
cls.def("__contains__", [](DetectorCollectionBase<T> const &self, std::string const &name) {
return self.get(name) != nullptr;
});
cls.def("__contains__",
[](DetectorCollectionBase<T> const &self, int id) { return self.get(id) != nullptr; });
}
} // namespace
void wrapDetectorCollection(lsst::utils::python::WrapperCollection &wrappers) {
wrappers.addInheritanceDependency("lsst.afw.table.io");
wrappers.wrapType(
PyDetectorCollectionBase<Detector const>(wrappers.module, "DetectorCollectionDetectorBase"),
[](auto &mod, auto &cls) { declareDetectorCollectionBase(cls); });
wrappers.wrapType(PyDetectorCollection(wrappers.module, "DetectorCollection"), [](auto &mod, auto &cls) {
;
cls.def(py::init<DetectorCollection::List>());
cls.def("getFpBBox", &DetectorCollection::getFpBBox);
table::io::python::addPersistableMethods(cls);
});
wrappers.wrapType(PyDetectorCollectionBase<Detector::InCameraBuilder>(wrappers.module,
"DetectorCollectionBuilderBase"),
[](auto &mod, auto &cls) { declareDetectorCollectionBase(cls); });
}
} // namespace cameraGeom
} // namespace afw
} // namespace lsst
|
dc4f7e82db80e7e496e1fd01f4f3a49acacdd96c | 8bf334845ed90091ddabfe26911b09acc6ace280 | /20_2_notation/main.cpp | 0c5e455585a5abed82cec5036ddc5ca02894ca05 | [] | no_license | DanyloSve/Ravesli | f158cf4285a89f9878e50243fbbbc22a2f0f2247 | 76471a6d83946d355642b3b915d2c012f2fdfbbf | refs/heads/master | 2020-06-23T14:59:37.033716 | 2019-08-25T15:02:29 | 2019-08-25T15:02:29 | 198,656,895 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 657 | cpp | main.cpp | #include <iostream>
#include <vector>
int main()
{
std::cout << "Input a number : \n";
int n;
std::cin >> n;
std::vector <int> v;
int count(0);
for (;;)
{
count++;
if (n / 16 != 0 )
{
v.push_back(n % 16);
}
else
{
v.push_back(n % 16);
break;
}
n /= 16;
}
for (int i(v.size() - 1); i != -1; i--)
{
if (v[i] > 9)
{
std::cout << static_cast<char>('A' + v[i] - 10);
}
else
{
std::cout << v[i];
}
}
std::cout << '\n';
return 0;
}
|
ae341ef970bbb88c8f4901c5c8be67335685c6d4 | 1fc6d2baa958992adecd42d57e89f979972dc3c5 | /random/cpp/56.Djkstras.cpp | 2d1b87ac53593b09510e6065f3ff1ce227beac99 | [] | no_license | Ritapravo/cpp | b5c56d3b649b0fd2698482e960e39217d547e8fb | 0510f41b5ff5c59126461f4c36b3d05c9b1a362e | refs/heads/master | 2021-08-20T06:30:49.176592 | 2021-07-12T17:43:43 | 2021-07-12T17:43:43 | 216,426,587 | 5 | 6 | null | null | null | null | UTF-8 | C++ | false | false | 1,962 | cpp | 56.Djkstras.cpp | //https://www.geeksforgeeks.org/dijkstras-shortest-path-algorithm-using-priority_queue-stl/
#include<iostream>
#include<bits/stdc++.h>
#define int long int
# define INF INT_MAX
using namespace std;
typedef pair<int, int> ipair;
void shortestPath(vector<vector<ipair>> &adj, int V, int src)
{
priority_queue< ipair, vector <ipair> , greater<ipair> > pq;
vector<int> dist(V, INF);
pq.push(make_pair(0, src));
dist[src] = 0;
while (!pq.empty())
{
int u = pq.top().second;
pq.pop();
for (auto x : adj[u])
{
int v = x.first;
int weight = x.second;
if (dist[v] > dist[u] + weight)
{
dist[v] = dist[u] + weight;
pq.push(make_pair(dist[v], v));
}
}
}
cout<<"Vertex Distance from Source\n";
for (int i = 0; i < V; ++i)
cout<<i<<"\t\t"<<dist[i]<<endl;
}
signed main(){
int V = 9;
int graph[V][V] = { { 0, 4, 0, 0, 0, 0, 0, 8, 0 },
{ 4, 0, 8, 0, 0, 0, 0, 11, 0 },
{ 0, 8, 0, 7, 0, 4, 0, 0, 2 },
{ 0, 0, 7, 0, 9, 14, 0, 0, 0 },
{ 0, 0, 0, 9, 0, 10, 0, 0, 0 },
{ 0, 0, 4, 14, 10, 0, 2, 0, 0 },
{ 0, 0, 0, 0, 0, 2, 0, 1, 6 },
{ 8, 11, 0, 0, 0, 0, 1, 0, 7 },
{ 0, 0, 2, 0, 0, 0, 6, 7, 0 } };
vector<vector<ipair>>adj(V,vector<ipair>());
for(int i = 0; i<V; i++)
for(int j = 0; j<V; j++)
if(graph[i][j]>0)
adj[i].push_back(make_pair(j, graph[i][j]));
for (auto i: adj){
for(auto j: i)
cout<<j.first<<" "<<j.second<<"\t";
cout<<endl;
}
shortestPath(adj, V, 0);
}
//g++ "56.Djkstras.cpp" && a
//g++ "F:\cpp\random\56.Djkstras.cpp" && a |
dfd41de575f42be62de5dd10453d01b8bdf5d3f2 | 11f462871e9655afb2b62b6bf6eb1cb31bdf928f | /Algospot/[A]FENCE.cpp | 9dcfb48555c973fa1eae9327af9e7ebd8e188d92 | [] | no_license | gashe-soo/Algorithm | e1ebfad4a00bbb3652c999322d9695cf182d9328 | 087932cf96b621e325ae71aa7e5a734012f1d079 | refs/heads/master | 2023-05-01T10:47:14.974113 | 2021-05-15T13:24:55 | 2021-05-15T13:24:55 | 263,251,573 | 1 | 1 | null | null | null | null | UHC | C++ | false | false | 1,451 | cpp | [A]FENCE.cpp | // Algospot Fence
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int n;
vector<int> square(20000, 10001);
// 정석 풀이
int solve(int left, int right) {
if (left == right) return square[left];
int mid = (left + right) / 2;
int ret = max(solve(left, mid), solve(mid + 1, right));
int lo = mid, hi = mid + 1;
int height = min(square[lo], square[hi]);
ret = max(ret, height * 2);
while (left < lo || hi < right) {
if (hi < right && (lo == left || square[lo - 1] < square[hi + 1])) {
++hi;
height = min(height, square[hi]);
}
else {
--lo;
height = min(height, square[lo]);
}
ret = max(ret, height * (hi - lo + 1));
}
return ret;
}
// min값 기준으로 나누기.
int size(int left, int right) {
if (left==right) return square[right];
auto it = min_element(square.begin()+left, square.begin() + right+1);
int ret = *it * (right - left + 1);
int before, after;
if (it - square.begin() == left)
before = square[left];
else
before = size(left, it - square.begin() - 1);
if (it - square.begin() == right)
after = square[right];
else
after = size(it - square.begin() + 1, right);
return max({ ret,before,after });
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int tc;
cin >> tc;
while (tc--) {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> square[i];
}
cout << solve(0,n-1) << '\n';
}
return 0;
} |
8dc5bbfdc246ae0afc49be25c58fe6d80d00d9dc | 8c61dfc4eb5f30ba60f206d5f477685df950a661 | /src/node.h | 296e046d183e9558479b96506c452fe77ab5d35d | [
"MIT"
] | permissive | illusive-chase/Megumi | 173590d3c165f515b5772252aa62a51af4658d49 | 7bee18962fe5e7d0fd91e8c13da8f46c850b785b | refs/heads/master | 2020-06-05T07:26:26.257091 | 2020-01-31T15:23:41 | 2020-01-31T15:23:41 | 192,359,847 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,109 | h | node.h | /*
MIT License
Copyright (c) 2019 illusive-chase
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.
*/
#pragma once
#include "operator.h"
namespace megumi {
class output {
public:
using pmatrix = matrix::pmatrix;
using functor = matrix::functor;
private:
std::list<pmatrix> seq;
public:
output(std::list<pmatrix>&& li) :seq(li) {}
void run() { seq.back()->reset(); for (pmatrix& p : seq) p->calculate(); }
};
template<unsigned M, unsigned N>
class node {
public:
using pmatrix = matrix::pmatrix;
using functor = matrix::functor;
template<unsigned A, unsigned B> friend class node;
template<typename F, unsigned A, unsigned B> friend node<A, B> operator_node(F, const node<A, B>&);
template<unsigned A, unsigned B, unsigned C, unsigned D>
friend node<A, B> partial_node(const node<C, D>&, const node<A, B>&);
private:
pmatrix val;
node(pmatrix ptr) :val(ptr) {}
public:
node(scalar(&arr)[M][N]) :val(std::make_shared<matrix>(arr)) {}
node(std::initializer_list<scalar> init_li) :val(std::make_shared<matrix>(M, N)) {
for (unsigned i = 0, len = std::min(init_li.size(), M * N); i < len; ++i) val->val[i] = init_li.begin()[i];
}
explicit node(scalar constant) :val(std::make_shared<matrix>(M, N)) {
for (unsigned i = 0, len = std::min(M, N); i < len; ++i) val->val[i] = constant;
}
node() :val(std::make_shared<matrix>(M, N)) {}
node<M, N> operator +(const node<M, N>& rhs) const {
node<M, N> ret(std::make_shared<matrix>(M, N, operation::plus()));
matrix::link_to(ret.val, val); matrix::link_to(ret.val, rhs.val);
return ret;
}
node<M, N> operator -(const node<M, N>& rhs) const {
node<M, N> ret(std::make_shared<matrix>(M, N, operation::minus()));
matrix::link_to(ret.val, val); matrix::link_to(ret.val, rhs.val);
return ret;
}
template<unsigned K>
node<M, K> operator *(const node<N, K>& rhs) const {
node<M, K> ret(std::make_shared<matrix>(M, K, operation::multiply()));
matrix::link_to(ret.val, val); matrix::link_to(ret.val, rhs.val);
return ret;
}
template<unsigned A, unsigned B>
node<A, B> reshape() const {
static_assert(A * B == M * N);
node<A, B> ret(std::make_shared<matrix>(A, B, operation::reshape()));
matrix::link_to(ret.val, val);
return ret;
}
static node<M, N> random_node() {
return node<M, N>(std::make_shared<matrix>(M, N, operation::random<>()));
}
output value() {
val->reset();
std::list<pmatrix> li;
std::queue<pmatrix> zero_ind;
std::stack<pmatrix> stk;
stk.push(val);
int cnt = 0;
while (!stk.empty()) {
pmatrix temp = stk.top();
stk.pop();
if (!temp->sflag) {
cnt++;
if (temp->next.empty()) {
zero_ind.push(temp);
temp->sflag = ~0;
} else temp->sflag = (unsigned)temp->next.size();
for (pmatrix& p : temp->next) stk.push(p);
}
}
while (!zero_ind.empty()) {
pmatrix temp = zero_ind.front();
zero_ind.pop();
li.push_back(temp);
cnt--;
for (pmatrix& p : temp->prev) {
if (--p->sflag == 0) zero_ind.push(p);
}
}
assert(cnt == 0);
return output(std::move(li));
}
void print(const char* label, std::ostream& os = std::cout) {
os << label << '<' << M << ',' << N << ">: " << std::endl;
for (unsigned i = 0; i < M; ++i) {
os << ' ' << val->val[i * N];
for (unsigned j = 1; j < N; ++j) os << ", " << val->val[i * N + j];
os << std::endl;
}
os << std::endl;
}
};
template<unsigned M,unsigned N>
node<N, M> transpose(const node<M, N>& rhs) {
return rhs.reshape<N, M>();
}
template<typename F, unsigned A, unsigned B>
node<A, B> operator_node(F, const node<A, B>& x) {
node<A, B> ret(std::make_shared<matrix>(A, B, F()));
matrix::link_to(ret.val, val);
return ret;
}
template<unsigned M, unsigned N, unsigned A, unsigned B>
node<M, N> partial_node(const node<A, B>& y, const node<M, N>& x) {
y.val->reset();
node<M, N> ret(std::make_shared<matrix>(M, N, operation::partial()));
std::list<matrix::pmatrix> subgraph;
std::stack<matrix::pmatrix> stk;
std::queue<matrix::pmatrix> zero_ind;
stk.push(y.val);
zero_ind.push(x.val);
const matrix* find = x.val.get();
int cnt = 1;
while (!stk.empty()) {
matrix::pmatrix temp = stk.top();
stk.pop();
if (bool(temp)) {
subgraph.push_back(temp);
stk.push(nullptr);
for (matrix::pmatrix& ptr : temp->next) {
if (ptr.get() == find) {
for (auto it = subgraph.begin(); it != subgraph.end(); ++it) {
auto nxt = it;
nxt++;
if ((*it)->sflag) {
if (nxt != subgraph.end() && (*nxt)->sflag == 0) (*it)->sflag++;
} else {
(*it)->sflag++;
cnt++;
}
}
} else stk.push(ptr);
}
} else subgraph.pop_back();
}
while (!zero_ind.empty()) {
matrix::pmatrix temp = zero_ind.front();
zero_ind.pop();
temp->active();
ret.val->next.push_front(temp);
temp->prev.push_back(ret.val);
cnt--;
for (matrix::pmatrix& p : temp->prev) {
if (--p->sflag == 0) zero_ind.push(p);
}
}
assert(ret.val->next.size() && cnt == 0);
return ret;
}
} |
4e3c03e051c9caa943acd44ab0598dbc295ab62f | 25624692db299fa6de7a3358b8bc00f500607ba7 | /rbtree.cpp | 2f5f5217f296ed34a835d5e9b0f3b2e141c40401 | [] | no_license | curiousTauseef/stock-inventory-system | be9eac82bdaa20722891b62cedd954d2f684c85d | d8c47f496bf09c1837f149a470bae2adfcc81a0a | refs/heads/master | 2022-01-01T16:18:52.502048 | 2016-09-07T05:13:23 | 2016-09-07T05:13:23 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,911 | cpp | rbtree.cpp | #ifdef _RBTREE_H_
#include "rbtree.h"
#include <iostream>
using namespace std;
template <typename T>
RBTree<T>::RBTree() {
size = 0;
root = NULL;
}
template <typename T>
RBTree<T>::RBTree(const RBTree<T>& rbtree) {
size = 0;
root = NULL;
CopyTree(rbtree.root, NULL);
}
template <typename T>
RBTree<T>::~RBTree() {
RemoveAll();
}
template <typename T>
RBTree<T>& RBTree<T>::operator=(const RBTree<T>& rbtree) {
if (this != &rbtree) {
RemoveAll();
size = 0;
root = NULL;
CopyTree(rbtree.root, NULL);
}
return *this;
}
// Calls BSTInsert and then performs any necessary tree fixing.
// If item already exists, do not insert and return false.
// Otherwise, insert, increment size, and return true.
template <typename T>
bool RBTree<T>::Insert(T item) {
if (Find(item) != NULL) {
return false;
}
else {
Node<T>* newNode = BSTInsert(item);
size++;
newNode->is_black = false;
while (newNode != root && newNode->p->is_black == false) {
if (newNode->p == newNode->p->p->left) {
Node<T>* uncle = newNode->p->p->right;
if (uncle != NULL) {
if (uncle->is_black == false) {
newNode->p->is_black = true;
uncle->is_black = true;
newNode->p->p->is_black = false;
newNode = newNode->p->p;
}
else {
if (newNode == newNode->p->right) {
newNode = newNode->p;
RotateLeft(newNode);
}
newNode->p->is_black = true;
newNode->p->p->is_black = false;
RotateRight(newNode->p->p);
}
}
// a bit repetitive but needed if uncle is NULL
else {
if (newNode == newNode->p->right) {
newNode = newNode->p;
RotateLeft(newNode);
}
newNode->p->is_black = true;
newNode->p->p->is_black = false;
RotateRight(newNode->p->p);
}
}
else {
Node<T>* y = newNode->p->p->left;
if (y != NULL) {
if (y->is_black == false) {
newNode->p->is_black = true;
y->is_black = true;
newNode->p->p->is_black = false;
newNode = newNode->p->p;
}
else {
if (newNode == newNode->p->left) {
newNode = newNode->p;
RotateRight(newNode);
}
newNode->p->is_black = true;
newNode->p->p->is_black = false;
RotateLeft(newNode->p->p);
}
}
else {
if (newNode == newNode->p->left) {
newNode = newNode->p;
RotateRight(newNode);
}
newNode->p->is_black = true;
newNode->p->p->is_black = false;
RotateLeft(newNode->p->p);
}
}
}
root->is_black = true;
return true;
}
}
template <typename T>
bool RBTree<T>::Remove(T item) {
Node<T>* z = Find(item);
Node<T>* y = NULL;
Node<T>* x = NULL;
Node<T>* parent = NULL;
bool isLeft;
if (z == NULL) { // z was not found, return false
return false;
}
else {
if (z->left == NULL || z->right == NULL) { // z has at most one child, set y to z, determine if y is left or right child
y = z;
parent = y->p;
}
else { // z has two children, find the predecessor
y = Predecessor(z);
parent = y->p;
}
if (y->left != NULL) { // determine x from y's children
x = y->left;
}
if (x != NULL) { // x has a value, set it's parent to y's parent
x->p = y->p;
}
if (y->p == NULL) { // if y's parent is null, y must be the root, so x becomes root
root = x;
}
else { //
if (y == y->p->left) {
y->p->left = x;
isLeft = true;
}
else {
y->p->right = x;
isLeft = false;
}
}
if (y != z) {
z->data = y->data;
}
}
if (y->is_black == true) {
RBRemoveFixUp(x, parent, isLeft);
}
delete y;
size--;
return true;
}
template <typename T>
void RBTree<T>::RBRemoveFixUp(Node<T>* x, Node<T>* xparent, bool xisleftchild) {
Node<T>* y;
bool xcolor;
bool yleftcolor;
bool yrightcolor;
if (x != NULL) {
xcolor = x->is_black;
}
else {
xcolor = true;
}
while (x != root && xcolor) { // entering for a value of X, need while loop
if (!xisleftchild) {
y = xparent->left;
if (y != NULL) {
if (!y->is_black) {
y->is_black = true;
xparent->is_black = false;
RotateRight(xparent);
y = xparent->left;
}
if (y->left != NULL) {
yleftcolor = y->left->is_black;
}
else {
yleftcolor = true;
}
if (y->right != NULL) {
yrightcolor = y->right->is_black;
}
else {
yrightcolor = true;
}
if (yleftcolor && yrightcolor) {
y->is_black = false;
x = xparent;
xcolor = x->is_black;
xparent = xparent->p;
if (xparent->left == x) {
xisleftchild = true;
}
else {
xisleftchild = false;
}
}
else {
if (yleftcolor) {
y->right->is_black = true; // this may cause problems
y->is_black = false;
RotateLeft(y);
y = xparent->left;
}
y->is_black = xparent->is_black;
xparent->is_black = true;
if (y->left != NULL) {
y->left->is_black = true;
}
RotateRight(xparent);
x = root;
return;
}
}
}
else {
y = xparent->right;
if (y != NULL) {
if (!y->is_black) {
y->is_black = true;
xparent->is_black = false;
RotateLeft(xparent);
y = xparent->right;
}
}
if (y->left != NULL) {
yleftcolor = y->left->is_black;
}
else {
yleftcolor = true;
}
if (y->right != NULL) {
yrightcolor = y->right->is_black;
}
else {
yrightcolor = true;
}
if (yleftcolor && yrightcolor) {
y->is_black = false;
x = xparent;
xcolor = x->is_black;
xparent = xparent->p;
if (xparent->left == x) {
xisleftchild = true;
}
else {
xisleftchild = false;
}
}
else {
if (yrightcolor) {
y->left->is_black = true; // this may cause problems
y->is_black = false;
RotateRight(y);
y = xparent->right;
}
y->is_black = xparent->is_black;
xparent->is_black = true;
if (y->right != NULL) {
y->right->is_black = true;
}
RotateLeft(xparent);
x = root;
return;
}
}
}
if (x != NULL) {
x->is_black = true;
}
}
template <typename T>
void RBTree<T>::RemoveAll(Node<T>* node) {
if (node == NULL) {
return;
}
if (node->left != NULL) {
RemoveAll(node->left);
}
if (node->right != NULL) {
RemoveAll(node->right);
}
if (node != root) {
if (node->p->left == node) {
node->p->left = NULL;
}
if (node->p->right == node) {
node->p->right = NULL;
}
}
else {
node->left = NULL;
node->right = NULL;
delete node;
root = NULL;
return;
}
node->p = NULL;
delete node;
}
template <typename T>
void RBTree<T>::RemoveAll() {
RemoveAll(root);
}
template <typename T>
Node<T>* RBTree<T>::CopyTree(Node<T>* sourcenode, Node<T>* parentnode) {
if (size <= 0) {
Node<T>* refNode;
root = new Node<T>(sourcenode->data);
refNode = root;
size++;
refNode->is_black = sourcenode->is_black;
if (sourcenode->left != NULL) {
refNode->left = CopyTree(sourcenode->left, refNode);
}
if (sourcenode->right != NULL) {
refNode->right = CopyTree(sourcenode->right, refNode);
}
return refNode;
}
else {
Node<T>* next = new Node<T>(sourcenode->data);
size++;
next->p = parentnode;
next->is_black = sourcenode->is_black;
if (sourcenode->left != NULL) {
next->left = CopyTree(sourcenode->left, next);
}
if (sourcenode->right != NULL) {
next->right = CopyTree(sourcenode->right, next);
}
return next;
}
}
template <typename T>
int RBTree<T>::Size() const {
return size;
}
template <typename T>
int RBTree<T>::ComputeHeight(Node<T>* node) const {
if (!node) {
return 0;
}
else {
int left = ComputeHeight(node->left);
int right = ComputeHeight(node->right);
if (left > right) {
return left + 1;
}
else {
return right + 1;
}
}
}
template <typename T>
int RBTree<T>::Height() const {
return ComputeHeight(root);
}
#endif |
819e1f4383c92fbff48ebd0d34b6564d3a74cb96 | 324ae1d6b2fed439091107cd2febaa6cbb7e5860 | /GladeEngine/Math/Quaternion.h | b7889650d0618065364fc7153e5fff8f508285a1 | [] | no_license | ArcRaizen/Glade-Engine | ac6a46606e24397946c8a5af9943f024dd0df9a2 | 8f57c01959e2a863afe2f679336bbc175764e17f | refs/heads/master | 2021-01-17T07:10:10.612465 | 2018-01-16T09:11:19 | 2018-01-16T09:11:19 | 44,852,845 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,726 | h | Quaternion.h | #pragma once
#ifndef GLADE_QUATERNION_H
#define GLADE_QUATERNION_H
#ifndef GLADE_MATRIX_H
#include "Matrix.h"
#endif
#ifndef GLADE_VECTOR_H
#include "Vector.h"
#endif
#ifndef GLADE_PRECISION_H
#include "Precision.h"
#endif
namespace Glade {
// Forward Declaration
class Matrix;
class Vector;
class Quaternion
{
public:
gFloat x, y, z, w; //x, y and z are the imaginary components and w is the real component of the Quaternion
// Constructors
Quaternion();
Quaternion(gFloat components[]);
Quaternion(gFloat _x, gFloat _y, gFloat _z, gFloat _w);
Quaternion(gFloat phi, gFloat theta, gFloat psi);
Quaternion(const Vector& startVec, const Vector& endVec);
Quaternion(const Vector& v, gFloat angle);
Quaternion(const Quaternion& quat);
Quaternion& operator=(const Quaternion& other);
// Destructor
~Quaternion();
// Operator Overloads
gFloat& operator[] (int index);
const gFloat& operator[] (int index) const;
Quaternion operator+ (const Quaternion& other) const;
Quaternion& operator+= (const Quaternion& other);
Quaternion operator- (const Quaternion& other) const;
Quaternion& operator-= (const Quaternion& other);
Quaternion operator* (const Quaternion& other) const;
Quaternion& operator*= (const Quaternion& other);
Quaternion operator* (gFloat scalar) const;
Quaternion& operator*= (gFloat scalar);
Quaternion operator~() const;
Quaternion operator-() const;
gFloat operator% (const Quaternion& other) const;
bool operator== (const Quaternion& other) const;
bool operator!= (const Quaternion& other) const;
operator gFloat() const;
// Functions
Quaternion& Add(const Quaternion& other);
Quaternion& Subtract(const Quaternion& other);
Quaternion& Multiply(const Quaternion& other);
Quaternion& Scale(gFloat scalar);
Quaternion Conjugated() const;
Quaternion& ConjugateInPlace();
Quaternion Inverse() const;
Quaternion& InvertInPlace();
Quaternion UnitInverse() const;
Quaternion& UnitInverseInPlace();
Quaternion Negated() const;
Quaternion& NegateInPlace();
Quaternion Normalized() const;
Quaternion& NormalizeInPlace();
gFloat DotProduct(const Quaternion& other) const;
gFloat Magnitude() const;
void AddRotation(const Vector& rot, gFloat dt);
Matrix ConvertToMatrix() const;
void EulerAngles(gFloat& phi, gFloat& theta, gFloat& psi, bool solution2=false) const;
void AxisAngle(Vector& v, gFloat& angle);
Quaternion& Identity();
bool IsIdentity();
// Static Functions
static Quaternion QuaternionAddition(const Quaternion& q1, const Quaternion& q2);
static Quaternion QuaternionSubtraction(const Quaternion& q1, const Quaternion& q2);
static Quaternion QuaternionMultiplication(const Quaternion& q1, const Quaternion& q2);
static Quaternion QuaternionScale(const Quaternion& q, gFloat scalar);
static Quaternion QuaternionNegate(const Quaternion& q);
static Quaternion QuaternionConjugate(const Quaternion& q);
static Matrix QuaternionToMatrix(const Quaternion& q);
static gFloat* QuaternionEulerAngles(Quaternion& q);
static Quaternion QuaternionFromTwoVectors(const Vector& startVec, const Vector& endVec);
static Quaternion Slerp(const Quaternion& q1, const Quaternion& q2, gFloat t);
};
} // namespace
#endif // GLADE_QUATERNION_H
// Quaternion Math Notes:
//
// Integrating Quaternions representing orientations:
// q(t) - orientation quaternion | w - angular velocity
//
// dq/dt = (1/2) * w * q(t)
// q(t+Δt) = q(t) + (dq/dt * Δt) = q(t) + ((1/2) * Δt * w * q(t))
// https://fgiesen.wordpress.com/2012/08/24/quaternion-differentiation/#comment-3913
//
// Rotation between 2 quaternions:
// For some quaternion q' such that q1 * q' = q2:
//
// q' = q1^-1 * q2 -> q2 = q1 * q'
// q' = q2 * q1^-1 -> q2 = q' * q1
// |
9c0468e6c6047cd9acdb5e3f2c3734f74e867dd5 | 5ec06dab1409d790496ce082dacb321392b32fe9 | /clients/cpp-restsdk/generated/model/ComDayCqMailerImplEmailCqRetrieverTemplateFactoryProperties.h | 0a6525b43e8d7d461ffb99b5474a2b36a40f8825 | [
"Apache-2.0"
] | permissive | shinesolutions/swagger-aem-osgi | e9d2385f44bee70e5bbdc0d577e99a9f2525266f | c2f6e076971d2592c1cbd3f70695c679e807396b | refs/heads/master | 2022-10-29T13:07:40.422092 | 2021-04-09T07:46:03 | 2021-04-09T07:46:03 | 190,217,155 | 3 | 3 | Apache-2.0 | 2022-10-05T03:26:20 | 2019-06-04T14:23:28 | null | UTF-8 | C++ | false | false | 3,506 | h | ComDayCqMailerImplEmailCqRetrieverTemplateFactoryProperties.h | /**
* Adobe Experience Manager OSGI config (AEM) API
* Swagger AEM OSGI is an OpenAPI specification for Adobe Experience Manager (AEM) OSGI Configurations API
*
* OpenAPI spec version: 1.0.0-pre.0
* Contact: opensource@shinesolutions.com
*
* NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* ComDayCqMailerImplEmailCqRetrieverTemplateFactoryProperties.h
*
*
*/
#ifndef ORG_OPENAPITOOLS_CLIENT_MODEL_ComDayCqMailerImplEmailCqRetrieverTemplateFactoryProperties_H_
#define ORG_OPENAPITOOLS_CLIENT_MODEL_ComDayCqMailerImplEmailCqRetrieverTemplateFactoryProperties_H_
#include "../ModelBase.h"
#include "ConfigNodePropertyBoolean.h"
#include "ConfigNodePropertyString.h"
namespace org {
namespace openapitools {
namespace client {
namespace model {
/// <summary>
///
/// </summary>
class ComDayCqMailerImplEmailCqRetrieverTemplateFactoryProperties
: public ModelBase
{
public:
ComDayCqMailerImplEmailCqRetrieverTemplateFactoryProperties();
virtual ~ComDayCqMailerImplEmailCqRetrieverTemplateFactoryProperties();
/////////////////////////////////////////////
/// ModelBase overrides
void validate() override;
web::json::value toJson() const override;
void fromJson(web::json::value& json) override;
void toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) const override;
void fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& namePrefix) override;
/////////////////////////////////////////////
/// ComDayCqMailerImplEmailCqRetrieverTemplateFactoryProperties members
/// <summary>
///
/// </summary>
std::shared_ptr<ConfigNodePropertyBoolean> getMailerEmailEmbed() const;
bool mailerEmailEmbedIsSet() const;
void unsetMailer_email_embed();
void setMailerEmailEmbed(std::shared_ptr<ConfigNodePropertyBoolean> value);
/// <summary>
///
/// </summary>
std::shared_ptr<ConfigNodePropertyString> getMailerEmailCharset() const;
bool mailerEmailCharsetIsSet() const;
void unsetMailer_email_charset();
void setMailerEmailCharset(std::shared_ptr<ConfigNodePropertyString> value);
/// <summary>
///
/// </summary>
std::shared_ptr<ConfigNodePropertyString> getMailerEmailRetrieverUserID() const;
bool mailerEmailRetrieverUserIDIsSet() const;
void unsetMailer_email_retrieverUserID();
void setMailerEmailRetrieverUserID(std::shared_ptr<ConfigNodePropertyString> value);
/// <summary>
///
/// </summary>
std::shared_ptr<ConfigNodePropertyString> getMailerEmailRetrieverUserPWD() const;
bool mailerEmailRetrieverUserPWDIsSet() const;
void unsetMailer_email_retrieverUserPWD();
void setMailerEmailRetrieverUserPWD(std::shared_ptr<ConfigNodePropertyString> value);
protected:
std::shared_ptr<ConfigNodePropertyBoolean> m_Mailer_email_embed;
bool m_Mailer_email_embedIsSet;
std::shared_ptr<ConfigNodePropertyString> m_Mailer_email_charset;
bool m_Mailer_email_charsetIsSet;
std::shared_ptr<ConfigNodePropertyString> m_Mailer_email_retrieverUserID;
bool m_Mailer_email_retrieverUserIDIsSet;
std::shared_ptr<ConfigNodePropertyString> m_Mailer_email_retrieverUserPWD;
bool m_Mailer_email_retrieverUserPWDIsSet;
};
}
}
}
}
#endif /* ORG_OPENAPITOOLS_CLIENT_MODEL_ComDayCqMailerImplEmailCqRetrieverTemplateFactoryProperties_H_ */
|
e6cf507113b9d140dabaa02036c862e6c8c3b343 | a730cf8fead3439422f34e2c5238f61fbe0fb6e5 | /pageDisplayer.h | 042d9edd88bb4cf23c29dda5815f30be9f59d07a | [] | no_license | arupam/book_cinema_cpp | d7e6166979e6695ee6c0d861937529e369b52c20 | 7c8524debd53a8418987a37860174a5ae2fcab4c | refs/heads/master | 2021-05-25T08:20:56.454425 | 2020-05-19T12:06:53 | 2020-05-19T12:06:53 | 253,737,140 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 844 | h | pageDisplayer.h | #include <iostream>
#include <fstream>
using namespace std;
//This header file contains functions to display the interface pages
//rdbuf() is for outputting the file inputted through ifstream
void startPage()
{
cout<<endl<<ifstream("startPage.txt").rdbuf();
}
void registerPage()
{
cout<<endl<<ifstream("registerPage.txt").rdbuf();
}
void errorPage()
{
cout<<endl<<ifstream("errorPage.txt").rdbuf();
}
void loginPage()
{
cout<<endl<<ifstream("loginPage.txt").rdbuf();
}
void loginAdmPage()
{
cout<<endl<<ifstream("loginAdmPage.txt").rdbuf();
}
void exitPage()
{
cout<<endl<<ifstream("exitPage.txt").rdbuf();
}
void aboutPage()
{
cout<<endl<<ifstream("aboutPage.txt").rdbuf();
}
void seatmatrix()
{
cout<<endl<<ifstream("seatmatrix.txt").rdbuf();
}
void dashboardPage()
{
cout<<endl<<ifstream("dashboardPage.txt").rdbuf();
}
|
d340ff4f24112eee0ddb86a2c3eae5df78913782 | 849518735928b2c3ba0b7cffd3c49cc7a2690865 | /src/main.cpp | 47c5eedad965abc29129e099336c47a167c13465 | [] | no_license | glcraft/Galaxy_simulation | 14e67f2969f4f877530043c65c769a29a8993cb3 | c83d683680057198418bb3ae147b7b9be6fae1c9 | refs/heads/master | 2020-12-10T15:22:46.975919 | 2020-01-26T22:15:13 | 2020-01-26T22:15:13 | 233,632,212 | 2 | 0 | null | 2020-01-13T15:48:28 | 2020-01-13T15:48:27 | null | UTF-8 | C++ | false | false | 10,574 | cpp | main.cpp | #define USE_OPENGL 1
#define VARYING_TIME 0
#include <algorithm>
#include <fstream>
#include <thread>
#include <atomic>
#include <SDL2/SDL.h>
#include <nlohmann/json.hpp>
#include <Utils.h>
#include <Block.h>
#include <Star.h>
#include <Draw_OGL.h>
SDL_Window* window = NULL;
SDL_Renderer* renderer = NULL;
constexpr int nAxis = 3;
#define READ_PARAMETER(value) { if (auto it = parameters.find(#value); it != parameters.end()) value = *it; }
struct MutexRange {
Star<nAxis>::range part;
std::atomic<int> ready = 0;
};
template <size_t N>
void make_partitions(std::array<MutexRange, N>& mutparts, Star<nAxis>::range alive_galaxy, size_t total)
{
const size_t nPerPart = total / N;
auto currentIt = alive_galaxy.begin, prevIt = alive_galaxy.begin;
for (size_t i = 0; i < N - 1; ++i)
{
for (size_t iIt = 0; iIt < nPerPart; ++iIt, ++currentIt);
mutparts[i].part = { prevIt, currentIt };
mutparts[i].ready = 1;
prevIt = currentIt;
}
mutparts.back().part = { currentIt, alive_galaxy.end };
mutparts.back().ready = 1;
}
int main(int argc, char* argv[])
{
// ------------------------- Paramètres de la simulation -------------------------
Float area = 500.; // Taille de la zone d'apparition des étoiles (en années lumière)
Float galaxy_thickness = 0.2; // Epaisseur de la galaxie (en "area")
Float precision = 300.0; // Précision du calcul de l'accélération (algorithme de Barnes-Hut)
bool verlet_integration = true; // Utiliser l'intégration de Verlet au lieu de la méthode d'Euler
int stars_number = 10000; // Nombre d'étoiles
Float initial_speed = 2500.; // Vitesse initiale des d'étoiles (en mêtres par seconde)
Float black_hole_mass = 0.; // Masse du trou noir (en masses solaires)
bool is_black_hole = false; // Présence d'un trou noir
View view = default_view; // Type de vue
Float zoom = 800.; // Taille de "area" (en pixel)
bool real_colors = false; // Activer la couleur réelle des étoiles
bool show_blocks = false; // Afficher les blocs
Float step = 200000.; // Pas de temps de la simulation (en années)
time_t simulation_time = 600; // Temps de simulation (en seconde)
constexpr size_t nThread = 8;
// -------------------------------------------------------------------------------
{
std::ifstream fileParams((argc == 2) ? argv[1] : "./parameters.json");
if (fileParams)
{
nlohmann::json parameters;// = nlohmann::json::parse(fileParams);
fileParams >> parameters;
READ_PARAMETER(area)
READ_PARAMETER(galaxy_thickness)
READ_PARAMETER(precision)
READ_PARAMETER(verlet_integration)
READ_PARAMETER(stars_number)
READ_PARAMETER(initial_speed)
READ_PARAMETER(black_hole_mass)
READ_PARAMETER(is_black_hole)
READ_PARAMETER(view)
READ_PARAMETER(zoom)
READ_PARAMETER(real_colors)
READ_PARAMETER(show_blocks)
READ_PARAMETER(step)
READ_PARAMETER(simulation_time)
}
}
SDL_Init(SDL_INIT_VIDEO);
window = nullptr;
renderer = nullptr;
#if USE_OPENGL
// Version d'OpenGL
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
// Double Buffer
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
window = SDL_CreateWindow("Galaxy simulation", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, WIDTH, HEIGHT, SDL_WINDOW_OPENGL);
SDL_GLContext glcont = SDL_GL_CreateContext(window);
if(!glcont)
throw std::runtime_error("Unable to create GL Context.");
DrawGL drawPlugin;
drawPlugin.setWindow(_std::make_observer(window));
#else
SDL_CreateWindowAndRenderer(static_cast<int>(WIDTH), static_cast<int>(HEIGHT), 0, &window, &renderer);
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_ADD);
SDL_SetWindowTitle(window, "Galaxy simulation");
#endif
SDL_Event event;
if (area < 0.1) area = 0.1;
////if (galaxy_thickness < 0.1) galaxy_thickness = 0.1;
// if (precision > 1.) precision = 1.;
if (stars_number < 1) stars_number = 1;
//if (stars_number > 30000) stars_number = 30000;
if (initial_speed < 0.) initial_speed = 0.;
if (black_hole_mass < 0.) black_hole_mass = 0.;
if (zoom < 1.) zoom = 1.;
if (step < 0.) step = 0.;
if (simulation_time < 1) simulation_time = 1;
area *= LIGHT_YEAR;
black_hole_mass *= SOLAR_MASS;
step *= YEAR;
Star<nAxis>::container galaxy;
Block<nAxis> block;
drawPlugin.init();
std::function<void(Star<nAxis>&)> init_star;
init_star = [area, galaxy_thickness, initial_speed, step](Star<3>& star) {
star.position = create_spherical((sqrt(random_double(0., 1.)) - 0.5) * area, random_double(0., 2. * PI), PI / 2.) * Vector3(1);
star.position.z = ((random_double(0., 1.) - 0.5) * (area * galaxy_thickness));
star.speed = glm::normalize(Vector3(-star.position.y, star.position.x, 0.)) * initial_speed;//create_spherical((((area / 2.) - glm::length(position)) / (area / 2.)) * initial_speed, get_phi(position) + PI / 2., PI / 2.);
star.previous_position = star.position - star.speed * step;
Float min = glm::min(2.1, 16 / (glm::length(star.position) / LIGHT_YEAR)), max = glm::max(2.1, 16 / (glm::length(star.position) / LIGHT_YEAR));
star.mass = random_double(min, max) * SOLAR_MASS;
};
/*init_star = [area, galaxy_thickness, initial_speed, step](Star<2>& star)
{
Float radius = (sqrt(random_double(0., 1.)) - 0.5) * area, angle = random_double(0., 2. * PI);
star.position = Vector<2>(glm::cos(angle) * radius, glm::sin(angle) * radius);
star.speed = glm::normalize(Vector<2>(-star.position.y, star.position.x)) * initial_speed;
star.previous_position = star.position - star.speed * step;
Float min = glm::min(2.1, 16 / (glm::length(star.position) / LIGHT_YEAR)), max = glm::max(2.1, 16 / (glm::length(star.position) / LIGHT_YEAR));
star.mass = random_double(min, max) * SOLAR_MASS;
};*/
//auto init_star = [area, galaxy_thickness, initial_speed, step](Star<3>& star) {
// star.position = create_spherical((sqrt(random_double(0., 1.)) - 0.5) * area, random_double(0., 2. * PI), PI / 2.) * Vector3(1);
// star.position.z = ((random_double(0., 1.) - 0.5) * (area * galaxy_thickness));
// star.speed = glm::normalize(Vector3(-star.position.y, star.position.x, 0.)) * initial_speed;//create_spherical((((area / 2.) - glm::length(position)) / (area / 2.)) * initial_speed, get_phi(position) + PI / 2., PI / 2.);
// star.previous_position = star.position - star.speed * step;
// Float min = glm::min(2.1, 16 / (glm::length(star.position) / LIGHT_YEAR)), max = glm::max(2.1, 16 / (glm::length(star.position) / LIGHT_YEAR));
// star.mass = random_double(min, max) * SOLAR_MASS;
////};
//auto init_star = [area, galaxy_thickness, initial_speed, step](Star<2>& star)
//{
// Float radius = (sqrt(random_double(0., 1.)) - 0.5) * area, angle= random_double(0., 2. * PI);
// star.position = Vector<2>(glm::cos(angle) * radius, glm::sin(angle) * radius);
// star.speed = glm::normalize(Vector<2>(-star.position.y, star.position.x)) * initial_speed;
// star.previous_position = star.position - star.speed * step;
// Float min = glm::min(2.1, 16 / (glm::length(star.position) / LIGHT_YEAR)), max = glm::max(2.1, 16 / (glm::length(star.position) / LIGHT_YEAR));
// star.mass = random_double(min, max) * SOLAR_MASS;
//};
for (int i = 0; i < stars_number; ++i)
{
galaxy.emplace_back(init_star);
}
if (is_black_hole)
{
galaxy.emplace_back();
galaxy.back().mass = black_hole_mass;
galaxy.back().is_alive = true;
}
Star<nAxis>::range alive_galaxy = { galaxy.begin(), galaxy.end() };
float step2 = step * step;
Float currentStep=static_cast<Float>(1.);
bool stopThreads = false;
auto updateStars = [&block, precision, verlet_integration, step, area, real_colors, &stopThreads, ¤tStep](MutexRange* mutpart)
{
using namespace std::chrono_literals;
while (mutpart->ready != 1)
std::this_thread::sleep_for(2ms);
while (!stopThreads)
{
for (auto itStar = mutpart->part.begin; itStar != mutpart->part.end; ++itStar) // Boucle sur les étoiles de la galaxie
{
acceleration_and_density_maj(precision, *itStar, block);
if (!(verlet_integration))
itStar->speed_maj(step * currentStep, area);
itStar->position_maj(step * currentStep, verlet_integration);
if (!is_in(block, *itStar))
itStar->is_alive = false;
else if (!(real_colors))
itStar->color_maj();
}
mutpart->ready = 2;
while (mutpart->ready != 1 && !stopThreads)
std::this_thread::sleep_for(2ms);
}
};
std::array<std::thread, nThread> mythreads;
std::array<MutexRange, nThread> mutparts;
for (int i = 0; i < mythreads.size(); ++i)
{
mutparts[i].ready = 0;
mythreads[i] = std::thread(updateStars, &mutparts[i]);
}
auto totalGalaxy = std::distance(alive_galaxy.begin, alive_galaxy.end);
auto t0 = std::chrono::steady_clock::now();
bool stopProgram=false;
bool pauseSimulation=false;
create_blocks(area, block, alive_galaxy);
make_partitions<nThread >(mutparts, alive_galaxy, totalGalaxy);
while (!stopProgram) // Boucle du pas de temps de la simulation
{
using namespace std::chrono_literals;
if (!pauseSimulation)
{
block.updateNodes();
block.updateMass(true);
make_partitions<nThread >(mutparts, alive_galaxy, totalGalaxy);
for (auto& mp : mutparts)
while (mp.ready != 2)
std::this_thread::sleep_for(1ms);
auto prevEnd = alive_galaxy.end;
alive_galaxy.end = std::partition(alive_galaxy.begin, alive_galaxy.end, [](const Star<nAxis>& star) { return star.is_alive; });
totalGalaxy -= std::distance(alive_galaxy.end, prevEnd);
}
while(SDL_PollEvent(&event))
{
if (event.type == SDL_QUIT || (event.type == SDL_KEYDOWN && event.key.keysym.scancode==SDL_SCANCODE_ESCAPE))
{
stopProgram=true;
}
if (event.type == SDL_KEYDOWN && event.key.keysym.scancode==SDL_SCANCODE_SPACE)
pauseSimulation=!pauseSimulation;
drawPlugin.event(&event);
}
drawPlugin.update<nAxis>(alive_galaxy);
// SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
// SDL_RenderClear(renderer);
// draw_stars(alive_galaxy, block.mass_center, area, zoom, view);
drawPlugin.render();
// SDL_RenderPresent(renderer);
#if VARYING_TIME
auto t1 = std::chrono::steady_clock::now();
std::chrono::duration<Float, std::ratio<1,60>> duree = t1-t0;
t0=t1;
currentStep = duree.count();
#else
currentStep = 1.;
#endif
}
stopThreads = true;
for (auto& thr : mythreads)
thr.join();
if (renderer)
SDL_DestroyRenderer(renderer);
if (window)
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
} |
3a20dbe905d1ea989819ef1873cc35e3d39c3027 | 69518ec5dce5749153a3239a5b28995633054bf5 | /DFDEditor2/DFDEditor2/DFDEditor2/EditTool.cpp | fe082f2563637d17e4676e88e76d25ee633216dd | [] | no_license | hermixy/DFDEditor | dcbfb64922d6d7fc8b6123fbdac1754bf77fc50e | 54c71f4a12d8b46a49d3e52976d3c05baf990caa | refs/heads/master | 2021-01-14T08:51:36.160658 | 2015-01-01T06:43:57 | 2015-01-01T06:43:57 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 6,730 | cpp | EditTool.cpp | #include "stdafx.h"
#include "EditTool.h"
#include"Tool.h"
#include"Element.h"
#include"DFDStream.h"
#include"DFDProcess.h"
#include"Diagram.h"
#include"DiagramEditor.h"
#include"Dlg.h"
#include"DFDEditor2.h"
#include"MainFrm.h"
#include"ChildFrm.h"
EditTool::EditTool(){
}
EditTool::EditTool(DiagramEditor *d)
{
currente = NULL;
currentd = NULL;
de = d;
type = EDITTOOL;
}
EditTool::~EditTool()
{
}
void EditTool::Press(CPoint pos, HWND hWnd){
Diagram *d = NULL;
Element *e = NULL;
this->Select(d, hWnd);
if (d){
//this->SetCurrentD(d);
de->SetCurrentD(d);
if (d->Find(pos, e)){ // 点中某一图元
//this->SetCurrentE(e);
if (e->isStream()) //如果点击的是流
{
Stream *str = (Stream*)e;
str->ContainsPoint(pos); //如果点击到流的端点,则根据端点设置相应状态位
}
de->SetCurrentE(e);
//de->Highlight();
de->Redraw(false);
}
else{
//this->ClearCurrentE();
de->ClearCurrentE();
de->ClearCurrentTool();
//de->Redraw(pos, 0, false);
de->Redraw(false); // 释放highlight
}
}
}
void EditTool::RightPress(CPoint pos, HWND hWnd){
Diagram *d = NULL;
Element *e = NULL;
this->Select(d, hWnd);
if (d){
//this->SetCurrentD(d);
de->SetCurrentD(d);
d->Find(pos, e);
if (e){
//this->SetCurrentE(e);
de->SetCurrentE(e);
//de->Highlight();
de->Redraw(false);
}
else{
//this->ClearCurrentE();
de->ClearCurrentE();
de->ClearCurrentTool();
//de->Redraw(pos, 0, false);
de->Redraw(false);
}
}
}
void EditTool::DoubleClick(CPoint pos, HWND hWnd){
Diagram *d = NULL;
Element *e = NULL;
HWND h = NULL;
this->Select(d, hWnd);
if (d){
//this->SetCurrentD(d);
de->SetCurrentD(d);
d->Find(pos, e);
if (e){ // 如果找到当前图元
//this->SetCurrentE(e);
de->SetCurrentE(e);
//de->Highlight();
//de->Redraw(false);
//d = NULL;
if (currente->isProcess()){ // 如果该图元是Process
DFDProcess *temppe = (DFDProcess*)currente; //
if (temppe->hasSubDiagram()){
h = de->SearchDiagramtoProcess(d, temppe); //不能直接用currentd,因为此处指的是edittool的currente,变成功之后,diagrameditor中的currente没变,所以redraw时候set给doc的currente还是没变(因为用的是diagrameditor中的currente)
this->OpenDiagramtoProcess(h, d); //
}
//h = de->SearchDiagramtoProcess(d);
//if (h && d) OpenDiagramtoProcess(h, d);
else this->CreateNewDiagram();
}
}
else{
//this->ClearCurrentE();
de->ClearCurrentE();
de->ClearCurrentTool();
//de->Redraw(pos, 0, false);
de->Redraw(false);
}
}
}
void EditTool::Move(CPoint pos, CPoint oldpos){
if (this->hasCurrentE() && de->hasCurrentE()){
if (currente->isStream())
{
Stream *t = (Stream*)currente;
if (t->GetState()!=0)
{
t->Onsize(pos);
//de->Highlight();
de->Redraw(false);
}
else {
currente->Offset(pos, oldpos);
//de->Highlight();
de->Redraw(false);
}
}
else{
queue<Stream*> streamq;
currente->Offset(pos, oldpos);
int startNum = currentd->FindStreams(currente, streamq); // 查找与原移动图元连接的连接线
while (startNum > 0)
{
//streamq.front()->SetStartElement(currente);
//streamq.front()->SetStart(streamq.front()->GetStart() + (pos - oldpos));
streamq.front()->StartFollowElement(currente);
streamq.pop();
startNum--;
}
while (!streamq.empty())
{
//streamq.front()->SetEndElement(currente);
//streamq.front()->SetEnd(streamq.front()->GetEnd() + (pos - oldpos));
streamq.front()->EndFollowElement(currente);
streamq.pop();
}
//de->Highlight();
de->Redraw(false);
}
}
/*if (currente && currente->isStream()){
Stream *tempse = (Stream*)currente;
currentd->SetStartElementforStream(tempse, tempse->getStart());
currentd->SetEndElementforStream(tempse, tempse->getEnd());
}
else if(currente){
currentd->SetElementforStreambyElement(currente, pos);
}*/
}
void EditTool::Release(CPoint pos){
/*if (currente->isStream()){
CPoint p;
p.SetPoint(pos.x - 60, pos.y - 40);
currentd->SetStartElementforStream(currente, p);
p.SetPoint(pos.x + 60, pos.y + 40);
currentd->SetEndElementforStream(currente, p);
}
else{
currentd->SetElementforStreambyElement(currente, pos);
}*/
if (currente && currente->isStream()){
Stream *tempse = (Stream*)currente;
currentd->SetStartElementforStream(tempse, tempse->GetStart());
currentd->SetEndElementforStream(tempse, tempse->GetEnd());
}
else if (currente){
currentd->SetElementforStreambyElement(currente, currente->GetMidPoint());
}
else{}
if (currente && currente->isStream()){
Stream *tempse = (Stream*)currente;
tempse->SetControlState(0);
}
de->Redraw(false);
}
void EditTool::RightRelease(CPoint pos){
CDlg dlg;
int response = dlg.DoModal();
if (response == IDOK){
if (dlg.newtext != _T("")){
currente->SetText(dlg.newtext);
}
}
de->Redraw(false);
}
void EditTool::GotoFatherWnd(){
HWND hWnd = currentd->getFatherWnd();
if (hWnd){
Diagram *d = NULL;
de->SearchDiagram(hWnd, d);
this->OpenDiagramtoProcess(hWnd, d);
}
else{
AfxMessageBox(_T("This is top!"));
}
}
void EditTool::Remove(){
queue<Stream*> tmpQueue;
if (currente) // 如果currente非空
{
//将所有与连接线相关的指针置空
if (!currente->isStream())
{
int startNum = currentd->FindStreams(currente, tmpQueue);
while (startNum > 0)
{
tmpQueue.front()->SetStartElement(NULL);
tmpQueue.pop();
startNum--;
}
while (!tmpQueue.empty())
{
tmpQueue.front()->SetEndElement(NULL);
tmpQueue.pop();
}
}
currentd->Remove(currente);
}
delete currente;
de->ClearCurrentE();
de->Redraw(false);
}
void EditTool::CreateNewDiagram(){
Diagram *oldD = currentd;
CMainFrame *pMainFrame = (CMainFrame*)AfxGetMainWnd();
HWND oldhWnd = ((CChildFrame*)pMainFrame->GetActiveFrame())->m_hWnd;
::SendMessage(::AfxGetMainWnd()->m_hWnd, WM_COMMAND, ID_FILE_NEW, 0);
//CMainFrame *pMainFrame = (CMainFrame*)AfxGetMainWnd();
CChildFrame *pChildFrame = (CChildFrame*)pMainFrame->GetActiveFrame();
HWND hWnd = pChildFrame->m_hWnd;
if (!hWnd) AfxMessageBox(_T("Top Window Not found!"));
currentd->setFatherWnd(oldhWnd);
oldD->InsertMap(currente, hWnd);
DFDProcess *temppe = (DFDProcess*)currente;
temppe->setSubDiagram();
//this->ClearCurrentE();
de->ClearCurrentE();
}
void EditTool::OpenDiagramtoProcess(HWND hWnd, Diagram *d){
CChildFrame *pcProcessFrame = (CChildFrame*)CChildFrame::FromHandle(hWnd);
pcProcessFrame->MDIActivate();
ShowWindow(hWnd, SW_SHOWNORMAL);
//this->SetCurrentD(d);
de->ClearCurrentE();
de->SetCurrentD(d);
de->Redraw(false);
} |
b25d1776367fead04db93b858da5107c6c946c82 | 93496367f4dd6870f1616f8354fe71e393f71e82 | /utl/mksec15.cpp | 74730d6925a351a27a8b53a4cdc0bd51efbb5d13 | [] | no_license | DTidd/OpenRDAAPI | 5fa858474ec54335033adb37e3c4f4c22772e55d | 78eee4201b2fbd938824ade81b6eaaa4b88cacaa | refs/heads/master | 2021-01-21T23:28:49.291394 | 2014-06-25T15:26:29 | 2014-06-25T15:26:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 33,485 | cpp | mksec15.cpp | /* SECURITY's - Make (ADD PROCESS SECURITY) Power Add */
#include <cstdio>
#include <mkadd.hpp>
#include <mkmsc.hpp>
extern char *module;
extern APPlib *errorlist;
static void ADD_ADD_PROCESS_SECURITY()
{
int x=0;
PowerAdd *add=NULL;
char *defdir=NULL;
APPlib *args=NULL,*args2=NULL;
RDAaddsub *subord=NULL;
AddWrite *Write=NULL;
/*
MaintainButton *button=NULL;
*/
char *temp1=NULL,*temp2=NULL;
char *temp3=NULL,*temp4=NULL;
char *temp5=NULL,*temp6=NULL;
char *temp7=NULL,*temp8=NULL;
char *temp9=NULL;
/* ADD DESCRIPTION */
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
/* SAVE EXPRESSION */
temp2=Rmalloc(32+1);
sprintf(temp2,"%s",
"([ADD USER IDENTIFICATION]=\"\")");
/* SAVE ERROR DESCRIPTION */
temp3=Rmalloc(132+1);
sprintf(temp3,"%s%s",
"IF ([ADD USER IDENTIFICATION]=\"\")\nTHEN RETURN_VALUE=\"Error: You must enter a valid user iden",
"tification before saving!!!\" FI");
/* SAVE WARNING */
temp4=Rmalloc(3+1);
sprintf(temp4,"%s",
"");
/* SAVE WARNING DESCRIPTION */
temp5=Rmalloc(3+1);
sprintf(temp5,"%s",
"");
/* QUIT ERROR */
temp6=Rmalloc(3+1);
sprintf(temp6,"%s",
"");
/* QUIT ERROR DESCRIPTION */
temp7=Rmalloc(3+1);
sprintf(temp7,"%s",
"");
/* QUIT WARNING */
temp8=Rmalloc(3+1);
sprintf(temp8,"%s",
"");
/* QUIT WARNING DESCRIPTION */
temp9=Rmalloc(3+1);
sprintf(temp9,"%s",
"");
add=RDAPowerAddNEW(module,"ADD PROCESS SECURITY",temp1,"ADD PROCESS SECURITY SCREEN","ADD PROCESS SECURITY DEFINE LIST","",1,temp2,temp3,temp4,temp5,temp6,temp7,temp8,temp9,0,NULL,0,NULL,0,NULL,0,NULL);
if(temp1!=NULL) Rfree(temp1);
if(temp2!=NULL) Rfree(temp2);
if(temp3!=NULL) Rfree(temp3);
if(temp4!=NULL) Rfree(temp4);
if(temp5!=NULL) Rfree(temp5);
if(temp6!=NULL) Rfree(temp6);
if(temp7!=NULL) Rfree(temp7);
if(temp8!=NULL) Rfree(temp8);
if(temp9!=NULL) Rfree(temp9);
if(add!=NULL)
{
/* POWERADD SUPPORTING FILES */
/* SECURITY USERS SUPPORTING FILE */
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
x=addPowerAddSupportingADV(add,"SECURITY","USERS",1,0,NULL,"USERS KEY",temp1,1,"LOAD USERS","SELECT USERS BROWSE","SELECT USERS DEFINE LIST","SELECT USERS SEARCH BROWSE",1);
if(temp1!=NULL) Rfree(temp1);
if(x!=(-1))
{
subord=add->subord+(x-1);
temp1=Rmalloc(25+1);
sprintf(temp1,"%s",
"[ADD USER IDENTIFICATION]");
x=addPowerAddSupportingConfld(subord,"USER IDENTIFICATION",temp1,0);
if(temp1!=NULL) Rfree(temp1);
}
/* SECURITY MODSEC SUPPORTING FILE */
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
x=addPowerAddSupportingADV(add,"SECURITY","MODSEC",0,0,NULL,"MODSEC KEY",temp1,1,"LOAD MODSEC","SELECT MODULE BROWSE","SELECT MODULE DEFINE LIST","SELECT MODULE SEARCH BROWSE",3);
if(temp1!=NULL) Rfree(temp1);
if(x!=(-1))
{
subord=add->subord+(x-1);
temp1=Rmalloc(25+1);
sprintf(temp1,"%s",
"[ADD USER IDENTIFICATION]");
x=addPowerAddSupportingConfld(subord,"USER IDENTIFICATION",temp1,1);
if(temp1!=NULL) Rfree(temp1);
temp1=Rmalloc(17+1);
sprintf(temp1,"%s",
"[ADD MODULE NAME]");
x=addPowerAddSupportingConfld(subord,"MODULE NAME",temp1,0);
if(temp1!=NULL) Rfree(temp1);
}
/* POWERADD WRITES */
/* SECURITY PROCSEC POWER WRITE */
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
x=addPowerAddWrite(add,"SECURITY","PROCSEC",temp1,0,NULL);
if(temp1!=NULL) Rfree(temp1);
if(x!=(-1))
{
Write=add->Writes+(x-1);
temp1=Rmalloc(25+1);
sprintf(temp1,"%s",
"[ADD USER IDENTIFICATION]");
x=addPowerAddWriteField(Write,"[SECURITY][PROCSEC][USER IDENTIFICATION]",0,temp1);
if(temp1!=NULL) Rfree(temp1);
temp1=Rmalloc(17+1);
sprintf(temp1,"%s",
"[ADD MODULE NAME]");
x=addPowerAddWriteField(Write,"[SECURITY][PROCSEC][MODULE NAME]",0,temp1);
if(temp1!=NULL) Rfree(temp1);
temp1=Rmalloc(18+1);
sprintf(temp1,"%s",
"[ADD PROCESS NAME]");
x=addPowerAddWriteField(Write,"[SECURITY][PROCSEC][PROCESS NAME]",0,temp1);
if(temp1!=NULL) Rfree(temp1);
temp1=Rmalloc(21+1);
sprintf(temp1,"%s",
"[ADD EXECUTE PROCESS]");
x=addPowerAddWriteField(Write,"[SECURITY][PROCSEC][EXECUTE PROCESS]",0,temp1);
if(temp1!=NULL) Rfree(temp1);
}
/* POWERADD EDIT WIDGETS */
/* ADD USER IDENTIFICATION EDIT WIDGET */
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
temp2=Rmalloc(3+1);
sprintf(temp2,"%s",
"");
temp3=Rmalloc(3+1);
sprintf(temp3,"%s",
"");
x=addPowerAddEditWdgts(add,"ADD USER IDENTIFICATION",0,0,2,temp1,0,"","","",0,NULL,temp2,"","ADD USER IDENTIFICATION",temp3,0,NULL,0,NULL);
if(temp1!=NULL) Rfree(temp1);
if(temp2!=NULL) Rfree(temp2);
if(temp3!=NULL) Rfree(temp3);
/* ADD MODULE NAME EDIT WIDGET */
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
temp2=Rmalloc(3+1);
sprintf(temp2,"%s",
"");
temp3=Rmalloc(3+1);
sprintf(temp3,"%s",
"");
x=addPowerAddEditWdgts(add,"ADD MODULE NAME",0,0,0,temp1,0,"","","",0,NULL,temp2,"","ADD MODULE NAME",temp3,0,NULL,0,NULL);
if(temp1!=NULL) Rfree(temp1);
if(temp2!=NULL) Rfree(temp2);
if(temp3!=NULL) Rfree(temp3);
/* ADD PROCESS NAME EDIT WIDGET */
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
temp2=Rmalloc(3+1);
sprintf(temp2,"%s",
"");
temp3=Rmalloc(3+1);
sprintf(temp3,"%s",
"");
x=addPowerAddEditWdgts(add,"ADD PROCESS NAME",0,0,0,temp1,0,"","","",0,NULL,temp2,"","ADD PROCESS NAME",temp3,0,NULL,0,NULL);
if(temp1!=NULL) Rfree(temp1);
if(temp2!=NULL) Rfree(temp2);
if(temp3!=NULL) Rfree(temp3);
/* ADD EXECUTE PROCESS EDIT WIDGET */
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
temp2=Rmalloc(3+1);
sprintf(temp2,"%s",
"");
temp3=Rmalloc(3+1);
sprintf(temp3,"%s",
"");
x=addPowerAddEditWdgts(add,"ADD EXECUTE PROCESS",10,1,0,temp1,0,"","","",0,NULL,temp2,"","ADD EXECUTE PROCESS",temp3,0,NULL,0,NULL);
if(temp1!=NULL) Rfree(temp1);
if(temp2!=NULL) Rfree(temp2);
if(temp3!=NULL) Rfree(temp3);
defdir=Rmalloc(RDAstrlen(CURRENTDIRECTORY)+RDAstrlen(module)+12);
#ifndef WIN32
sprintf(defdir,"%s/rda/%s.ADD",CURRENTDIRECTORY,module);
#endif
#ifdef WIN32
sprintf(defdir,"%s\\rda\\%s.ADD",CURRENTDIRECTORY,module);
#endif
if(writePowerAdd(defdir,add))
{
if(temp1!=NULL) Rfree(temp1);
temp1=Rmalloc(20+8+89+1);
sprintf(temp1,"POWER ADD WRITE ERROR: Module [SECURITY] Power Add [ADD PROCESS SECURITY], Can Not Save Power Add!");
prterr(temp1);
if(errorlist!=NULL)
{
addERRlist(&errorlist,temp1);
}
if(temp1!=NULL) Rfree(temp1);
}
if(defdir!=NULL) Rfree(defdir);
if(args!=NULL) freeapplib(args);
if(args2!=NULL) freeapplib(args2);
if(add!=NULL) FreePowerAdd(add);
}
}
static void LST_ADD_PROCSEC_MODULES()
{
RDAScrolledList *scrn=NULL;
char *defdir=NULL;
char *temp1=NULL;
scrn=RDAScrolledListNew("SECURITY","ADD PROCSEC MODULES");
if(scrn!=NULL)
{
scrn->vtype=0;
scrn->type=2;
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
scrn->select_formula=stralloc(temp1);
if(temp1!=NULL) Rfree(temp1);
scrn->special_function=stralloc("MODULES AVAILABLE");
scrn->num=0;
scrn->initfld=NULL;
scrn->ffield=stralloc("");
scrn->ffinfo=Rmalloc(sizeof(DFincvir));
scrn->ffinfo->module=stralloc("");
scrn->ffinfo->file=stralloc("");
scrn->ffinfo->keyname=stralloc("");
scrn->contype=1;
scrn->conmod=stralloc("ADD MODULE NAME");
scrn->confil=stralloc("");
scrn->confld=stralloc("");
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
scrn->format_formula=stralloc(temp1);
if(temp1!=NULL) Rfree(temp1);
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
scrn->reformat_formula=stralloc(temp1);
if(temp1!=NULL) Rfree(temp1);
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
scrn->unformat_formula=stralloc(temp1);
if(temp1!=NULL) Rfree(temp1);
scrn->desc=stralloc("");
scrn->timing=0;
defdir=Rmalloc(RDAstrlen(CURRENTDIRECTORY)+RDAstrlen(module)+12);
#ifndef WIN32
sprintf(defdir,"%s/rda/%s.LST",CURRENTDIRECTORY,module);
#endif
#ifdef WIN32
sprintf(defdir,"%s\\rda\\%s.LST",CURRENTDIRECTORY,module);
#endif
if(writeScrolledListbin(defdir,scrn))
{
if(temp1!=NULL) Rfree(temp1);
temp1=Rmalloc(19+8+100+1);
sprintf(temp1,"SCROLLED LIST WRITE ERROR: Module [SECURITY] RDAScrolledList [ADD PROCSEC MODULES], Can Not Save Scrolled List!");
prterr(temp1);
if(errorlist!=NULL)
{
addERRlist(&errorlist,temp1);
}
if(temp1!=NULL) Rfree(temp1);
}
if(defdir!=NULL) Rfree(defdir);
if(scrn!=NULL) FreeRDAScrolledList(scrn);
}
}
static void LST_ADD_PROCSEC_PROCESSES()
{
RDAScrolledList *scrn=NULL;
char *defdir=NULL;
char *temp1=NULL;
scrn=RDAScrolledListNew("SECURITY","ADD PROCSEC PROCESSES");
if(scrn!=NULL)
{
scrn->vtype=0;
scrn->type=2;
temp1=Rmalloc(17+1);
sprintf(temp1,"%s",
"[ADD MODULE NAME]");
scrn->select_formula=stralloc(temp1);
if(temp1!=NULL) Rfree(temp1);
scrn->special_function=stralloc("PROCESSES AVAILABLE");
scrn->num=0;
scrn->initfld=NULL;
scrn->ffield=stralloc("");
scrn->ffinfo=Rmalloc(sizeof(DFincvir));
scrn->ffinfo->module=stralloc("");
scrn->ffinfo->file=stralloc("");
scrn->ffinfo->keyname=stralloc("");
scrn->contype=1;
scrn->conmod=stralloc("ADD PROCESS NAME");
scrn->confil=stralloc("");
scrn->confld=stralloc("");
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
scrn->format_formula=stralloc(temp1);
if(temp1!=NULL) Rfree(temp1);
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
scrn->reformat_formula=stralloc(temp1);
if(temp1!=NULL) Rfree(temp1);
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
scrn->unformat_formula=stralloc(temp1);
if(temp1!=NULL) Rfree(temp1);
scrn->desc=stralloc("");
scrn->timing=1;
defdir=Rmalloc(RDAstrlen(CURRENTDIRECTORY)+RDAstrlen(module)+12);
#ifndef WIN32
sprintf(defdir,"%s/rda/%s.LST",CURRENTDIRECTORY,module);
#endif
#ifdef WIN32
sprintf(defdir,"%s\\rda\\%s.LST",CURRENTDIRECTORY,module);
#endif
if(writeScrolledListbin(defdir,scrn))
{
if(temp1!=NULL) Rfree(temp1);
temp1=Rmalloc(21+8+100+1);
sprintf(temp1,"SCROLLED LIST WRITE ERROR: Module [SECURITY] RDAScrolledList [ADD PROCSEC PROCESSES], Can Not Save Scrolled List!");
prterr(temp1);
if(errorlist!=NULL)
{
addERRlist(&errorlist,temp1);
}
if(temp1!=NULL) Rfree(temp1);
}
if(defdir!=NULL) Rfree(defdir);
if(scrn!=NULL) FreeRDAScrolledList(scrn);
}
}
static void SCN_ADD_PROCESS_SECURITY_SCREEN()
{
RDAscrn *scrn=NULL;
char *defdir=NULL;
char *temp1=NULL,*temp2=NULL;
char *temp3=NULL,*temp4=NULL;
scrn=RDAscrnNEW("SECURITY","ADD PROCESS SECURITY SCREEN");
if(scrn!=NULL)
{
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,7,"PREVIOUS ADD'S","Previous Adds","","",5,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,5,"","User Identification:","","",0,0,0,NULL,NULL,NULL,NULL);
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
temp2=Rmalloc(3+1);
sprintf(temp2,"%s",
"");
temp3=Rmalloc(3+1);
sprintf(temp3,"%s",
"");
temp4=Rmalloc(27+1);
sprintf(temp4,"%s",
"\"ADD PROCSEC MODULE LIST\"");
ADVaddwdgt(scrn,0,"ADD USER IDENTIFICATION","User Identification","","",0,15,0,temp1,temp2,temp3,temp4);
if(temp1!=NULL) Rfree(temp1);
if(temp2!=NULL) Rfree(temp2);
if(temp3!=NULL) Rfree(temp3);
if(temp4!=NULL) Rfree(temp4);
ADVaddwdgt(scrn,5,"","User Name:","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,0,"[USERS][USER NAME]","User Name","","",0,20,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,5,"","Module Name:","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,7,"ADD PROCSEC MODULES","Modules","","",1,0,0,NULL,NULL,NULL,NULL);
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
temp2=Rmalloc(3+1);
sprintf(temp2,"%s",
"");
temp3=Rmalloc(3+1);
sprintf(temp3,"%s",
"");
temp4=Rmalloc(20+1);
sprintf(temp4,"%s",
"\"ADD PROCESS NAME\"");
ADVaddwdgt(scrn,0,"ADD MODULE NAME","Module Name","","",0,20,0,temp1,temp2,temp3,temp4);
if(temp1!=NULL) Rfree(temp1);
if(temp2!=NULL) Rfree(temp2);
if(temp3!=NULL) Rfree(temp3);
if(temp4!=NULL) Rfree(temp4);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,5,"","Process Name:","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,7,"ADD PROCSEC PROCESSES","Processes","","",1,0,0,NULL,NULL,NULL,NULL);
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
temp2=Rmalloc(3+1);
sprintf(temp2,"%s",
"");
temp3=Rmalloc(3+1);
sprintf(temp3,"%s",
"");
temp4=Rmalloc(8+1);
sprintf(temp4,"%s",
"\"SAVE\"");
ADVaddwdgt(scrn,0,"ADD PROCESS NAME","Process Name","","",0,30,0,temp1,temp2,temp3,temp4);
if(temp1!=NULL) Rfree(temp1);
if(temp2!=NULL) Rfree(temp2);
if(temp3!=NULL) Rfree(temp3);
if(temp4!=NULL) Rfree(temp4);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,9,"ADD EXECUTE PROCESS","Execute Process","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,11,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,3,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
temp2=Rmalloc(3+1);
sprintf(temp2,"%s",
"");
temp3=Rmalloc(3+1);
sprintf(temp3,"%s",
"");
temp4=Rmalloc(18+1);
sprintf(temp4,"%s",
"\"RESET DEFAULTS\"");
ADVaddwdgt(scrn,6,"SAVE","Save","","",0,0,0,temp1,temp2,temp3,temp4);
if(temp1!=NULL) Rfree(temp1);
if(temp2!=NULL) Rfree(temp2);
if(temp3!=NULL) Rfree(temp3);
if(temp4!=NULL) Rfree(temp4);
ADVaddwdgt(scrn,6,"QUIT","Quit","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,6,"HELP","Help","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,4,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,11,"","","","",0,0,1,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,3,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,6,"DEFINE LIST","Define List","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,6,"RESET DEFAULTS","Reset Defaults","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,6,"DEFAULTS","Save Defaults","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,4,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
defdir=Rmalloc(RDAstrlen(CURRENTDIRECTORY)+RDAstrlen(module)+12);
#ifndef WIN32
sprintf(defdir,"%s/rda/%s.SCN",CURRENTDIRECTORY,module);
#endif
#ifdef WIN32
sprintf(defdir,"%s\\rda\\%s.SCN",CURRENTDIRECTORY,module);
#endif
if(writescrnbin(defdir,scrn))
{
if(temp1!=NULL) Rfree(temp1);
temp1=Rmalloc(27+8+89+1);
sprintf(temp1,"SCREEN WRITE ERROR: Module [SECURITY] Screen [ADD PROCESS SECURITY SCREEN], Can Not Save Maintain Master!");
prterr(temp1);
if(errorlist!=NULL)
{
addERRlist(&errorlist,temp1);
}
if(temp1!=NULL) Rfree(temp1);
}
if(defdir!=NULL) Rfree(defdir);
if(scrn!=NULL) free_scrn(scrn);
}
if(temp1!=NULL) Rfree(temp1);
if(temp2!=NULL) Rfree(temp2);
if(temp3!=NULL) Rfree(temp3);
if(temp4!=NULL) Rfree(temp4);
}
static void ADD_PROCESS_SECURITY_DEFINE_LIST()
{
RDAscrn *scrn=NULL;
char *defdir=NULL;
char *temp1=NULL,*temp2=NULL;
char *temp3=NULL,*temp4=NULL;
scrn=RDAscrnNEW("SECURITY","ADD PROCESS SECURITY DEFINE LIST");
if(scrn!=NULL)
{
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,5,"","Enter the position and length to be displayed for the following fields:","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,3,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,5,"","Module Name:","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,3,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,0,"ADD MODULE NAME POSITION","Module Name Position","","",0,3,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,0,"ADD MODULE NAME LENGTH","Module Name Length","","",0,3,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,4,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,5,"","Process Name:","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,3,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,0,"ADD PROCESS NAME POSITION","Process Name Position","","",0,3,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,0,"ADD PROCESS NAME LENGTH","Process Name Length","","",0,3,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,4,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,5,"","User Identification:","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,3,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,0,"ADD USER IDENTIFICATION POSITION","User Identification Position","","",0,3,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,0,"ADD USER IDENTIFICATION LENGTH","User Identification Length","","",0,3,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,4,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,5,"","Execute Process:","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,3,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,0,"ADD EXECUTE PROCESS POSITION","Execute Process Position","","",0,3,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,0,"ADD EXECUTE PROCESS LENGTH","Execute Process Length","","",0,3,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,4,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,4,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,3,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,6,"DEFAULTS","Save Defaults","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,6,"SELECT","Select","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,6,"QUIT","Quit","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,6,"HELP","Help","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,4,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
defdir=Rmalloc(RDAstrlen(CURRENTDIRECTORY)+RDAstrlen(module)+12);
#ifndef WIN32
sprintf(defdir,"%s/rda/%s.SCN",CURRENTDIRECTORY,module);
#endif
#ifdef WIN32
sprintf(defdir,"%s\\rda\\%s.SCN",CURRENTDIRECTORY,module);
#endif
if(writescrnbin(defdir,scrn))
{
if(temp1!=NULL) Rfree(temp1);
temp1=Rmalloc(32+8+89+1);
sprintf(temp1,"SCREEN WRITE ERROR: Module [SECURITY] Screen [ADD PROCESS SECURITY DEFINE LIST], Can Not Save Maintain Master!");
prterr(temp1);
if(errorlist!=NULL)
{
addERRlist(&errorlist,temp1);
}
if(temp1!=NULL) Rfree(temp1);
}
if(defdir!=NULL) Rfree(defdir);
if(scrn!=NULL) free_scrn(scrn);
}
if(temp1!=NULL) Rfree(temp1);
if(temp2!=NULL) Rfree(temp2);
if(temp3!=NULL) Rfree(temp3);
if(temp4!=NULL) Rfree(temp4);
}
static void ADD_ADD_PROCESS_SECURITY_NL()
{
int x=0;
PowerAdd *add=NULL;
char *defdir=NULL;
APPlib *args=NULL,*args2=NULL;
RDAaddsub *subord=NULL;
AddWrite *Write=NULL;
/*
MaintainButton *button=NULL;
AddEditWdgt *EditWdgt=NULL;
*/
char *temp1=NULL,*temp2=NULL;
char *temp3=NULL,*temp4=NULL;
char *temp5=NULL,*temp6=NULL;
char *temp7=NULL,*temp8=NULL;
char *temp9=NULL;
/* ADD DESCRIPTION */
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
/* SAVE EXPRESSION */
temp2=Rmalloc(32+1);
sprintf(temp2,"%s",
"([ADD USER IDENTIFICATION]=\"\")");
/* SAVE ERROR DESCRIPTION */
temp3=Rmalloc(132+1);
sprintf(temp3,"%s%s",
"IF ([ADD USER IDENTIFICATION]=\"\")\nTHEN RETURN_VALUE=\"Error: You must enter a valid user iden",
"tification before saving!!!\" FI");
/* SAVE WARNING */
temp4=Rmalloc(3+1);
sprintf(temp4,"%s",
"");
/* SAVE WARNING DESCRIPTION */
temp5=Rmalloc(3+1);
sprintf(temp5,"%s",
"");
/* QUIT ERROR */
temp6=Rmalloc(3+1);
sprintf(temp6,"%s",
"");
/* QUIT ERROR DESCRIPTION */
temp7=Rmalloc(3+1);
sprintf(temp7,"%s",
"");
/* QUIT WARNING */
temp8=Rmalloc(3+1);
sprintf(temp8,"%s",
"");
/* QUIT WARNING DESCRIPTION */
temp9=Rmalloc(3+1);
sprintf(temp9,"%s",
"");
add=RDAPowerAddNEW(module,"ADD PROCESS SECURITY-NL",temp1,"ADD PROCESS SECURITY SCREEN (NO LIST)","ADD PROCESS SECURITY DEFINE LIST","",1,temp2,temp3,temp4,temp5,temp6,temp7,temp8,temp9,0,NULL,0,NULL,0,NULL,0,NULL);
if(temp1!=NULL) Rfree(temp1);
if(temp2!=NULL) Rfree(temp2);
if(temp3!=NULL) Rfree(temp3);
if(temp4!=NULL) Rfree(temp4);
if(temp5!=NULL) Rfree(temp5);
if(temp6!=NULL) Rfree(temp6);
if(temp7!=NULL) Rfree(temp7);
if(temp8!=NULL) Rfree(temp8);
if(temp9!=NULL) Rfree(temp9);
if(add!=NULL)
{
/* POWERADD SUPPORTING FILES */
/* SECURITY USERS SUPPORTING FILE */
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
x=addPowerAddSupportingADV(add,"SECURITY","USERS",1,0,NULL,"USERS KEY",temp1,1,"LOAD USERS","SELECT USERS BROWSE","SELECT USERS DEFINE LIST","SELECT USERS SEARCH BROWSE",1);
if(temp1!=NULL) Rfree(temp1);
if(x!=(-1))
{
subord=add->subord+(x-1);
temp1=Rmalloc(25+1);
sprintf(temp1,"%s",
"[ADD USER IDENTIFICATION]");
x=addPowerAddSupportingConfld(subord,"USER IDENTIFICATION",temp1,0);
if(temp1!=NULL) Rfree(temp1);
}
/* SECURITY MODSEC SUPPORTING FILE */
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
x=addPowerAddSupportingADV(add,"SECURITY","MODSEC",0,0,NULL,"MODSEC KEY",temp1,1,"LOAD MODSEC","SELECT MODULE BROWSE","SELECT MODULE DEFINE LIST","SELECT MODULE SEARCH BROWSE",3);
if(temp1!=NULL) Rfree(temp1);
if(x!=(-1))
{
subord=add->subord+(x-1);
temp1=Rmalloc(25+1);
sprintf(temp1,"%s",
"[ADD USER IDENTIFICATION]");
x=addPowerAddSupportingConfld(subord,"USER IDENTIFICATION",temp1,1);
if(temp1!=NULL) Rfree(temp1);
temp1=Rmalloc(17+1);
sprintf(temp1,"%s",
"[ADD MODULE NAME]");
x=addPowerAddSupportingConfld(subord,"MODULE NAME",temp1,0);
if(temp1!=NULL) Rfree(temp1);
}
/* POWERADD WRITES */
/* SECURITY PROCSEC POWER WRITE */
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
x=addPowerAddWrite(add,"SECURITY","PROCSEC",temp1,0,NULL);
if(temp1!=NULL) Rfree(temp1);
if(x!=(-1))
{
Write=add->Writes+(x-1);
temp1=Rmalloc(25+1);
sprintf(temp1,"%s",
"[ADD USER IDENTIFICATION]");
x=addPowerAddWriteField(Write,"[SECURITY][PROCSEC][USER IDENTIFICATION]",0,temp1);
if(temp1!=NULL) Rfree(temp1);
temp1=Rmalloc(17+1);
sprintf(temp1,"%s",
"[ADD MODULE NAME]");
x=addPowerAddWriteField(Write,"[SECURITY][PROCSEC][MODULE NAME]",0,temp1);
if(temp1!=NULL) Rfree(temp1);
temp1=Rmalloc(18+1);
sprintf(temp1,"%s",
"[ADD PROCESS NAME]");
x=addPowerAddWriteField(Write,"[SECURITY][PROCSEC][PROCESS NAME]",0,temp1);
if(temp1!=NULL) Rfree(temp1);
temp1=Rmalloc(21+1);
sprintf(temp1,"%s",
"[ADD EXECUTE PROCESS]");
x=addPowerAddWriteField(Write,"[SECURITY][PROCSEC][EXECUTE PROCESS]",0,temp1);
if(temp1!=NULL) Rfree(temp1);
}
/* POWERADD EDIT WIDGETS */
/* ADD USER IDENTIFICATION EDIT WIDGET */
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
temp2=Rmalloc(3+1);
sprintf(temp2,"%s",
"");
temp3=Rmalloc(3+1);
sprintf(temp3,"%s",
"");
x=addPowerAddEditWdgts(add,"ADD USER IDENTIFICATION",0,0,2,temp1,0,"","","",0,NULL,temp2,"","ADD USER IDENTIFICATION",temp3,0,NULL,0,NULL);
if(temp1!=NULL) Rfree(temp1);
if(temp2!=NULL) Rfree(temp2);
if(temp3!=NULL) Rfree(temp3);
/* ADD MODULE NAME EDIT WIDGET */
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
temp2=Rmalloc(3+1);
sprintf(temp2,"%s",
"");
temp3=Rmalloc(3+1);
sprintf(temp3,"%s",
"");
x=addPowerAddEditWdgts(add,"ADD MODULE NAME",0,0,0,temp1,0,"","","",0,NULL,temp2,"","ADD MODULE NAME",temp3,0,NULL,0,NULL);
if(temp1!=NULL) Rfree(temp1);
if(temp2!=NULL) Rfree(temp2);
if(temp3!=NULL) Rfree(temp3);
/* ADD PROCESS NAME EDIT WIDGET */
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
temp2=Rmalloc(3+1);
sprintf(temp2,"%s",
"");
temp3=Rmalloc(3+1);
sprintf(temp3,"%s",
"");
x=addPowerAddEditWdgts(add,"ADD PROCESS NAME",0,0,0,temp1,0,"","","",0,NULL,temp2,"","ADD PROCESS NAME",temp3,0,NULL,0,NULL);
if(temp1!=NULL) Rfree(temp1);
if(temp2!=NULL) Rfree(temp2);
if(temp3!=NULL) Rfree(temp3);
/* ADD EXECUTE PROCESS EDIT WIDGET */
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
temp2=Rmalloc(3+1);
sprintf(temp2,"%s",
"");
temp3=Rmalloc(3+1);
sprintf(temp3,"%s",
"");
x=addPowerAddEditWdgts(add,"ADD EXECUTE PROCESS",10,1,0,temp1,0,"","","",0,NULL,temp2,"","ADD EXECUTE PROCESS",temp3,0,NULL,0,NULL);
if(temp1!=NULL) Rfree(temp1);
if(temp2!=NULL) Rfree(temp2);
if(temp3!=NULL) Rfree(temp3);
defdir=Rmalloc(RDAstrlen(CURRENTDIRECTORY)+RDAstrlen(module)+12);
#ifndef WIN32
sprintf(defdir,"%s/rda/%s.ADD",CURRENTDIRECTORY,module);
#endif
#ifdef WIN32
sprintf(defdir,"%s\\rda\\%s.ADD",CURRENTDIRECTORY,module);
#endif
if(writePowerAdd(defdir,add))
{
if(temp1!=NULL) Rfree(temp1);
temp1=Rmalloc(23+8+89+1);
sprintf(temp1,"POWER ADD WRITE ERROR: Module [SECURITY] Power Add [ADD PROCESS SECURITY-NL], Can Not Save Power Add!");
prterr(temp1);
if(errorlist!=NULL)
{
addERRlist(&errorlist,temp1);
}
if(temp1!=NULL) Rfree(temp1);
}
if(defdir!=NULL) Rfree(defdir);
if(args!=NULL) freeapplib(args);
if(args2!=NULL) freeapplib(args2);
if(add!=NULL) FreePowerAdd(add);
}
}
static void MNU_SECURITY_ADD_PROCESS_SECURITY_NL()
{
RDAmenu *menu=NULL;
char *defdir=NULL;
menu=RDAmenuNEW("SECURITY ADD PROCESS SECURITY-NL","doadd.EXT SECURITY \"ADD PROCESS SECURITY-NL\"");
if(menu!=NULL)
{
defdir=Rmalloc(RDAstrlen(CURRENTDIRECTORY)+RDAstrlen(module)+10);
#ifndef WIN32
sprintf(defdir,"%s/rda/%s.MNU",CURRENTDIRECTORY,module);
#endif
#ifdef WIN32
sprintf(defdir,"%s\\rda\\%s.MNU",CURRENTDIRECTORY,module);
#endif
if(writemenubin(defdir,menu))
{
ERRORDIALOG("Cannot Save Menu","This menu may not be saved to the specified library. Check your permissions and re-try. Call your installer for further instructions.",NULL,FALSE);
}
if(defdir!=NULL) Rfree(defdir);
if(menu!=NULL) free_menu(menu);
}
}
static void SCN_ADD_PROCESS_SECURITY_SCREEN_NO_LIST()
{
RDAscrn *scrn=NULL;
char *defdir=NULL;
char *temp1=NULL,*temp2=NULL;
char *temp3=NULL,*temp4=NULL;
scrn=RDAscrnNEW("SECURITY","ADD PROCESS SECURITY SCREEN (NO LIST)");
if(scrn!=NULL)
{
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,7,"PREVIOUS ADD'S","Previous Adds","","",5,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,5,"","User Identification:","","",0,0,0,NULL,NULL,NULL,NULL);
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
temp2=Rmalloc(3+1);
sprintf(temp2,"%s",
"");
temp3=Rmalloc(3+1);
sprintf(temp3,"%s",
"");
temp4=Rmalloc(27+1);
sprintf(temp4,"%s",
"\"ADD PROCSEC MODULE LIST\"");
ADVaddwdgt(scrn,0,"ADD USER IDENTIFICATION","User Identification","","",0,15,0,temp1,temp2,temp3,temp4);
if(temp1!=NULL) Rfree(temp1);
if(temp2!=NULL) Rfree(temp2);
if(temp3!=NULL) Rfree(temp3);
if(temp4!=NULL) Rfree(temp4);
ADVaddwdgt(scrn,5,"","User Name:","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,0,"[USERS][USER NAME]","User Name","","",0,20,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,5,"","Module Name:","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,7,"ADD PROCSEC MODULES","Modules","","",1,0,0,NULL,NULL,NULL,NULL);
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
temp2=Rmalloc(3+1);
sprintf(temp2,"%s",
"");
temp3=Rmalloc(3+1);
sprintf(temp3,"%s",
"");
temp4=Rmalloc(20+1);
sprintf(temp4,"%s",
"\"ADD PROCESS NAME\"");
ADVaddwdgt(scrn,0,"ADD MODULE NAME","Module Name","","",0,20,0,temp1,temp2,temp3,temp4);
if(temp1!=NULL) Rfree(temp1);
if(temp2!=NULL) Rfree(temp2);
if(temp3!=NULL) Rfree(temp3);
if(temp4!=NULL) Rfree(temp4);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,5,"","Process Name:","","",0,0,0,NULL,NULL,NULL,NULL);
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
temp2=Rmalloc(3+1);
sprintf(temp2,"%s",
"");
temp3=Rmalloc(3+1);
sprintf(temp3,"%s",
"");
temp4=Rmalloc(8+1);
sprintf(temp4,"%s",
"\"SAVE\"");
ADVaddwdgt(scrn,0,"ADD PROCESS NAME","Process Name","","",0,30,0,temp1,temp2,temp3,temp4);
if(temp1!=NULL) Rfree(temp1);
if(temp2!=NULL) Rfree(temp2);
if(temp3!=NULL) Rfree(temp3);
if(temp4!=NULL) Rfree(temp4);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,9,"ADD EXECUTE PROCESS","Execute Process","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,11,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,3,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
temp1=Rmalloc(3+1);
sprintf(temp1,"%s",
"");
temp2=Rmalloc(3+1);
sprintf(temp2,"%s",
"");
temp3=Rmalloc(3+1);
sprintf(temp3,"%s",
"");
temp4=Rmalloc(18+1);
sprintf(temp4,"%s",
"\"RESET DEFAULTS\"");
ADVaddwdgt(scrn,6,"SAVE","Save","","",0,0,0,temp1,temp2,temp3,temp4);
if(temp1!=NULL) Rfree(temp1);
if(temp2!=NULL) Rfree(temp2);
if(temp3!=NULL) Rfree(temp3);
if(temp4!=NULL) Rfree(temp4);
ADVaddwdgt(scrn,6,"QUIT","Quit","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,6,"HELP","Help","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,4,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,11,"","","","",0,0,1,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,3,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,1,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,6,"DEFINE LIST","Define List","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,6,"RESET DEFAULTS","Reset Defaults","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,6,"DEFAULTS","Save Defaults","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,4,"","","","",0,0,0,NULL,NULL,NULL,NULL);
ADVaddwdgt(scrn,2,"","","","",0,0,0,NULL,NULL,NULL,NULL);
defdir=Rmalloc(RDAstrlen(CURRENTDIRECTORY)+RDAstrlen(module)+12);
#ifndef WIN32
sprintf(defdir,"%s/rda/%s.SCN",CURRENTDIRECTORY,module);
#endif
#ifdef WIN32
sprintf(defdir,"%s\\rda\\%s.SCN",CURRENTDIRECTORY,module);
#endif
if(writescrnbin(defdir,scrn))
{
if(temp1!=NULL) Rfree(temp1);
temp1=Rmalloc(37+8+89+1);
sprintf(temp1,"SCREEN WRITE ERROR: Module [SECURITY] Screen [ADD PROCESS SECURITY SCREEN (NO LIST)], Can Not Save Maintain Master!");
prterr(temp1);
if(errorlist!=NULL)
{
addERRlist(&errorlist,temp1);
}
if(temp1!=NULL) Rfree(temp1);
}
if(defdir!=NULL) Rfree(defdir);
if(scrn!=NULL) free_scrn(scrn);
}
if(temp1!=NULL) Rfree(temp1);
if(temp2!=NULL) Rfree(temp2);
if(temp3!=NULL) Rfree(temp3);
if(temp4!=NULL) Rfree(temp4);
}
void ADDPROCSEC()
{
ADD_ADD_PROCESS_SECURITY();
LST_ADD_PROCSEC_MODULES();
LST_ADD_PROCSEC_PROCESSES();
SCN_ADD_PROCESS_SECURITY_SCREEN();
ADD_PROCESS_SECURITY_DEFINE_LIST();
ADD_ADD_PROCESS_SECURITY_NL();
MNU_SECURITY_ADD_PROCESS_SECURITY_NL();
SCN_ADD_PROCESS_SECURITY_SCREEN_NO_LIST();
}
|
42a36dd5154db1cb1dbc020880be905488d1fdba | d6acdd69a25c74a5bb0a54807db6550f7166dc6c | /src/buffers/vertexArray.h | 291c34d3a9d777a1e5d7984b9652508abdad4b28 | [] | no_license | R-e-t-u-r-n-N-u-l-l/OpenGL-Engine | 91317e9c584d29cf79ec6841ff64bb4e7ba18e8b | 5b1aa4a60b9c2d3e09b361058c242f8a5021d5a5 | refs/heads/master | 2020-03-15T12:50:07.339045 | 2018-08-28T15:01:56 | 2018-08-28T15:01:56 | 132,152,786 | 9 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 553 | h | vertexArray.h | #pragma once
#include <vector>
#include <GL/glew.h>
#include "buffer.h"
namespace engine {
class VertexArray {
private:
GLuint m_array;
std::vector<GLuint> m_buffers;
std::vector<GLuint> m_attributes;
public:
VertexArray();
void append(GLuint attribute, GLuint buffer, GLuint dimensions);
void append(GLuint attribute, Buffer* buffer);
void updateBuffer(GLuint attribute, GLuint dimensions, GLuint length, GLfloat* data);
void bind() const;
void unbind() const;
GLuint getID() const;
};
} |
e1607d8034b3923bd22fd4ab92d91ab7784ed190 | be2acce4947844453976aaf2f9f359a3448efc67 | /create wave array.cpp | facc0a528ec6353fc6c9f7926e0e26350a2d3660 | [] | no_license | vestigegroup/InterviewBit-Leetcode_Solutions | 4845f8b7d67311f913e73264682df9c9c2b85a90 | 417853dd95d13c310c6bcfe18ac076d6b48265eb | refs/heads/main | 2023-06-05T13:53:21.901698 | 2021-06-28T05:50:05 | 2021-06-28T05:50:05 | 501,138,114 | 1 | 0 | null | 2022-06-08T07:06:32 | 2022-06-08T07:06:31 | null | UTF-8 | C++ | false | false | 275 | cpp | create wave array.cpp | vector<int> Solution::wave(vector<int> &A) {
//3 2 1 4
//sorted= 1 2 3 4
//wave array lexicographically= 2 1 4 2
sort(A.begin(),A.end());
for(int i=1;i<A.size();i+=2)
{
int temp=A[i];
A[i]=A[i-1];
A[i-1]=temp;
}
return A;
}
|
2137592eedef25a039c97a3b7d98dd82e2c79ec2 | 88deffcfe2566da58c4e91cc6c5c30256e5479f1 | /mesh.h | 9c61939b7bd43093c86db1df7e86640ebb899b04 | [] | no_license | keresan/dipl-praca | 76bcabf8ae911ec8acfe22c626457caa9c53c7fd | cac259aae6ccf270fc63c71e32dc978a90e72c9f | refs/heads/master | 2016-09-10T01:14:06.578147 | 2014-05-28T05:21:24 | 2014-05-28T05:21:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,902 | h | mesh.h | #ifndef MESH_H
#define MESH_H
#include <QVector>
#include <QtGlobal>
#include <QString>
#include <QRect>
#include <QColor>
#include <QRegularExpression>
#include "Opencv/cv.h"
//#include "map.h"
#include <QDebug>
#include <cmath>
//#include "maskedvector.h"
#include "common.h"
#define UNKNOWN_POINT cv::Point3d(-999,-999,-999)
typedef QVector<cv::Point3d> VectorOfPoints;
typedef QVector<cv::Vec3i> VectorOfTriangles;
typedef cv::Vec3b Color;
typedef QVector<Color> VectorOfColors;
/**
* @brief Class for represent 3D model of face
*/
class Mesh {
public:
typedef cv::Vec3i Triangle;
typedef cv::Vec3b Color;
typedef QVector<Triangle> Triangles;
typedef QVector<Color> Colors;
Matrix pointsMat;
VectorOfTriangles triangles;
// VectorOfColors colors;
double minx, maxx, miny, maxy, minz, maxz;
QColor _color;
QString name;
//static cv::Point3d UNKNOWN_POINT;
Mesh();
Mesh(const Mesh &src);
Mesh(const QString path, bool centralizeLoadedMesh = false);
virtual ~Mesh();
void printStats();
//transformations
void centralize();
void translate(cv::Point3d translationVector);
void transform(Matrix &m);
void rotate(double x, double y, double z);
//selections
Mesh crop(cv::Point3d center, int deltaPX, int deltaMX, int deltaPY, int deltaMY);
Mesh crop(cv::Point3d topLeft, cv::Point3d bottomRight);
void cropMe(cv::Point2d topLeft, cv::Point2d bottomRight);
Mesh zLevelSelect(double zValue);
Mesh radiusSelect(double radius, cv::Point3d center = cv::Point3d(0,0,0));
//read, write
void writeOBJ(const QString &path, char decimalPoint);
static Mesh fromABS(const QString &filename, bool centralizeLoadedMesh = false);
static Mesh fromOBJ(const QString &filename, bool centralizeLoadedMesh = false);
static Mesh fromPointcloud(VectorOfPoints &pointcloud, bool centralizeLoadedMesh = false, bool calculateTriangles = true);
void loadFromABS(const QString &filename, bool centralizeLoadedMesh = false);
void loadFromOBJ(const QString &filename, bool centralizeLoadedMesh = false);
void loadFromPointcloud(VectorOfPoints &pointcloud, bool centralizeLoadedMesh = false, bool calculateTriangles = true);
//grid
static Mesh create2dGrid(cv::Point3d topLeft, cv::Point3d bottomRight, int stepX, int stepY);
Mesh getExtract2dGrid(Mesh &grid);
void getExtract2dGrid(Mesh &grid, Mesh &dst);
void getExtract2dGrid_2(Mesh &grid, Mesh &dst);
Mesh getClosedPoints(Mesh &inputMesh, cv::flann::Index &index, float *distance);
float getClosedDistance(cv::flann::Index &index);
int getClosed2dPoint(cv::Point2d point);
static void averageMesh(Mesh &src, Mesh &dst, int dstWeight);
cv::Point3d getMeanPoint();
QVector<cv::Point3d>* getVectorOfPoint3d();
void calculateTriangles();
void recalculateMinMax();
private:
void init();
};
#endif // MESH_H
|
dbce8d853831cfa892711cab9feb580328d66d97 | d26a306d0dc07a6a239e0f1e87e83e8d96712681 | /DWNLD/main.cpp | 9539829433cbea59390b7a3c6bf32c73cb4c5afd | [] | no_license | umar-07/Competitive-Programming-questions-with-solutions | e08f8dbbebed7ab48c658c3f0ead19baf966f140 | 39353b923638dff2021923a8ea2f426cd94d2204 | refs/heads/main | 2023-05-19T03:05:48.669470 | 2021-06-16T18:36:22 | 2021-06-16T18:36:22 | 377,588,251 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 759 | cpp | main.cpp | #include <iostream>
using namespace std;
int main()
{
int t, k;
cin >> t;
for(k=0; k<t; k++)
{
int n, k;
cin >> n >> k;
int arr[n][2];
for(int i=0; i<n; i++)
{
cin >> arr[i][0] >> arr[i][1];
}
int j=0;
while(k!=0)
{
if(k>arr[j][0])
{
k=k-arr[j][0];
arr[j][0]=0;
}
else
{
arr[j][0]=arr[j][0]-k;
k=0;
break;
}
j++;
}
int money=0;
for(int i=0; i<n; i++)
{
money=money+arr[i][0]*arr[i][1];
}
cout << money << endl;
}
return 0;
}
|
f85afe16601459c881f2d9ecb69b9b554fe1246d | 8c8820fb84dea70d31c1e31dd57d295bd08dd644 | /Renderer/Private/SceneHitProxyRendering.cpp | 636db95e83b4873e16dc4078dcd9007f9f4d4e0f | [] | no_license | redisread/UE-Runtime | e1a56df95a4591e12c0fd0e884ac6e54f69d0a57 | 48b9e72b1ad04458039c6ddeb7578e4fc68a7bac | refs/heads/master | 2022-11-15T08:30:24.570998 | 2020-06-20T06:37:55 | 2020-06-20T06:37:55 | 274,085,558 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 38,122 | cpp | SceneHitProxyRendering.cpp | // Copyright Epic Games, Inc. All Rights Reserved.
/*=============================================================================
SceneHitProxyRendering.cpp: Scene hit proxy rendering.
=============================================================================*/
#include "SceneHitProxyRendering.h"
#include "RendererInterface.h"
#include "BatchedElements.h"
#include "Materials/Material.h"
#include "PostProcess/SceneRenderTargets.h"
#include "MaterialShaderType.h"
#include "MeshMaterialShader.h"
#include "ShaderBaseClasses.h"
#include "SceneRendering.h"
#include "DeferredShadingRenderer.h"
#include "ScenePrivate.h"
#include "DynamicPrimitiveDrawing.h"
#include "ClearQuad.h"
#include "VisualizeTexture.h"
#include "MeshPassProcessor.inl"
#include "GPUScene.h"
#include "Rendering/ColorVertexBuffer.h"
#include "FXSystem.h"
#include "GPUSortManager.h"
class FHitProxyShaderElementData : public FMeshMaterialShaderElementData
{
public:
FHitProxyShaderElementData(FHitProxyId InBatchHitProxyId)
: BatchHitProxyId(InBatchHitProxyId)
{
}
FHitProxyId BatchHitProxyId;
};
/**
* A vertex shader for rendering the depth of a mesh.
*/
class FHitProxyVS : public FMeshMaterialShader
{
DECLARE_SHADER_TYPE(FHitProxyVS,MeshMaterial);
public:
static bool ShouldCompilePermutation(const FMeshMaterialShaderPermutationParameters& Parameters)
{
// Only compile the hit proxy vertex shader on PC
return IsPCPlatform(Parameters.Platform)
// and only compile for the default material or materials that are masked.
&& (Parameters.MaterialParameters.bIsSpecialEngineMaterial ||
!Parameters.MaterialParameters.bWritesEveryPixel ||
Parameters.MaterialParameters.bMaterialMayModifyMeshPosition ||
Parameters.MaterialParameters.bIsTwoSided);
}
void GetShaderBindings(
const FScene* Scene,
ERHIFeatureLevel::Type FeatureLevel,
const FPrimitiveSceneProxy* PrimitiveSceneProxy,
const FMaterialRenderProxy& MaterialRenderProxy,
const FMaterial& Material,
const FMeshPassProcessorRenderState& DrawRenderState,
const FMeshMaterialShaderElementData& ShaderElementData,
FMeshDrawSingleShaderBindings& ShaderBindings)
{
FMeshMaterialShader::GetShaderBindings(Scene, FeatureLevel, PrimitiveSceneProxy, MaterialRenderProxy, Material, DrawRenderState, ShaderElementData, ShaderBindings);
#if WITH_EDITOR
const FColorVertexBuffer* HitProxyIdBuffer = PrimitiveSceneProxy ? PrimitiveSceneProxy->GetCustomHitProxyIdBuffer() : nullptr;
if(HitProxyIdBuffer)
{
ShaderBindings.Add(VertexFetch_HitProxyIdBuffer, HitProxyIdBuffer->GetColorComponentsSRV());
}
else
{
ShaderBindings.Add(VertexFetch_HitProxyIdBuffer, GNullColorVertexBuffer.VertexBufferSRV);
}
#endif
}
protected:
FHitProxyVS(const ShaderMetaType::CompiledShaderInitializerType& Initializer) :
FMeshMaterialShader(Initializer)
{
PassUniformBuffer.Bind(Initializer.ParameterMap, FSceneTexturesUniformParameters::StaticStructMetadata.GetShaderVariableName());
VertexFetch_HitProxyIdBuffer.Bind(Initializer.ParameterMap, TEXT("VertexFetch_HitProxyIdBuffer"), SPF_Optional);
}
FHitProxyVS() {}
LAYOUT_FIELD(FShaderResourceParameter, VertexFetch_HitProxyIdBuffer)
};
IMPLEMENT_MATERIAL_SHADER_TYPE(,FHitProxyVS,TEXT("/Engine/Private/HitProxyVertexShader.usf"),TEXT("Main"),SF_Vertex);
/**
* A hull shader for rendering the depth of a mesh.
*/
class FHitProxyHS : public FBaseHS
{
DECLARE_SHADER_TYPE(FHitProxyHS,MeshMaterial);
protected:
FHitProxyHS() {}
FHitProxyHS(const ShaderMetaType::CompiledShaderInitializerType& Initializer) :
FBaseHS(Initializer)
{}
static bool ShouldCompilePermutation(const FMeshMaterialShaderPermutationParameters& Parameters)
{
return FBaseHS::ShouldCompilePermutation(Parameters)
&& FHitProxyVS::ShouldCompilePermutation(Parameters);
}
};
/**
* A domain shader for rendering the depth of a mesh.
*/
class FHitProxyDS : public FBaseDS
{
DECLARE_SHADER_TYPE(FHitProxyDS,MeshMaterial);
protected:
FHitProxyDS() {}
FHitProxyDS(const ShaderMetaType::CompiledShaderInitializerType& Initializer) :
FBaseDS(Initializer)
{}
static bool ShouldCompilePermutation(const FMeshMaterialShaderPermutationParameters& Parameters)
{
return FBaseDS::ShouldCompilePermutation(Parameters)
&& FHitProxyVS::ShouldCompilePermutation(Parameters);
}
};
IMPLEMENT_MATERIAL_SHADER_TYPE(,FHitProxyHS,TEXT("/Engine/Private/HitProxyVertexShader.usf"),TEXT("MainHull"),SF_Hull);
IMPLEMENT_MATERIAL_SHADER_TYPE(,FHitProxyDS,TEXT("/Engine/Private/HitProxyVertexShader.usf"),TEXT("MainDomain"),SF_Domain);
/**
* A pixel shader for rendering the HitProxyId of an object as a unique color in the scene.
*/
class FHitProxyPS : public FMeshMaterialShader
{
DECLARE_SHADER_TYPE(FHitProxyPS,MeshMaterial);
public:
static bool ShouldCompilePermutation(const FMeshMaterialShaderPermutationParameters& Parameters)
{
// Only compile the hit proxy vertex shader on PC
return IsPCPlatform(Parameters.Platform)
// and only compile for default materials or materials that are masked.
&& (Parameters.MaterialParameters.bIsSpecialEngineMaterial ||
!Parameters.MaterialParameters.bWritesEveryPixel ||
Parameters.MaterialParameters.bMaterialMayModifyMeshPosition ||
Parameters.MaterialParameters.bIsTwoSided);
}
FHitProxyPS(const ShaderMetaType::CompiledShaderInitializerType& Initializer):
FMeshMaterialShader(Initializer)
{
HitProxyId.Bind(Initializer.ParameterMap,TEXT("HitProxyId"), SPF_Optional); // There is no way to guarantee that this parameter will be preserved in a material that kill()s all fragments as the optimiser can remove the global - this happens in various projects.
PassUniformBuffer.Bind(Initializer.ParameterMap, FSceneTexturesUniformParameters::StaticStructMetadata.GetShaderVariableName());
}
FHitProxyPS() {}
void GetShaderBindings(
const FScene* Scene,
ERHIFeatureLevel::Type FeatureLevel,
const FPrimitiveSceneProxy* PrimitiveSceneProxy,
const FMaterialRenderProxy& MaterialRenderProxy,
const FMaterial& Material,
const FMeshPassProcessorRenderState& DrawRenderState,
const FHitProxyShaderElementData& ShaderElementData,
FMeshDrawSingleShaderBindings& ShaderBindings) const
{
FMeshMaterialShader::GetShaderBindings(Scene, FeatureLevel, PrimitiveSceneProxy, MaterialRenderProxy, Material, DrawRenderState, ShaderElementData, ShaderBindings);
FHitProxyId hitProxyId = ShaderElementData.BatchHitProxyId;
#if WITH_EDITOR
if (PrimitiveSceneProxy && PrimitiveSceneProxy->GetCustomHitProxyIdBuffer())
{
hitProxyId = FColor(0);
}
else
#endif
if (PrimitiveSceneProxy && ShaderElementData.BatchHitProxyId == FHitProxyId())
{
hitProxyId = PrimitiveSceneProxy->GetPrimitiveSceneInfo()->DefaultDynamicHitProxyId;
}
// Per-instance hitproxies are supplied by the vertex factory.
if (PrimitiveSceneProxy && PrimitiveSceneProxy->HasPerInstanceHitProxies())
{
hitProxyId = FColor(0);
}
ShaderBindings.Add(HitProxyId, hitProxyId.GetColor().ReinterpretAsLinear());
}
private:
LAYOUT_FIELD(FShaderParameter, HitProxyId)
};
IMPLEMENT_MATERIAL_SHADER_TYPE(,FHitProxyPS,TEXT("/Engine/Private/HitProxyPixelShader.usf"),TEXT("Main"),SF_Pixel);
#if WITH_EDITOR
void InitHitProxyRender(FRHICommandListImmediate& RHICmdList, const FSceneRenderer* SceneRenderer, TRefCountPtr<IPooledRenderTarget>& OutHitProxyRT, TRefCountPtr<IPooledRenderTarget>& OutHitProxyDepthRT)
{
check(!RHICmdList.IsInsideRenderPass());
auto& ViewFamily = SceneRenderer->ViewFamily;
auto FeatureLevel = ViewFamily.Scene->GetFeatureLevel();
// Initialize global system textures (pass-through if already initialized).
GSystemTextures.InitializeTextures(RHICmdList, FeatureLevel);
FSceneRenderTargets& SceneContext = FSceneRenderTargets::Get(RHICmdList);
// Allocate the maximum scene render target space for the current view family.
SceneContext.Allocate(RHICmdList, SceneRenderer);
// Create a texture to store the resolved light attenuation values, and a render-targetable surface to hold the unresolved light attenuation values.
{
FPooledRenderTargetDesc Desc(FPooledRenderTargetDesc::Create2DDesc(SceneContext.GetBufferSizeXY(), PF_B8G8R8A8, FClearValueBinding::None, TexCreate_None, TexCreate_RenderTargetable | TexCreate_ShaderResource, false));
GRenderTargetPool.FindFreeElement(RHICmdList, Desc, OutHitProxyRT, TEXT("HitProxy"));
// create non-MSAA version for hit proxies on PC if needed
const EShaderPlatform CurrentShaderPlatform = GShaderPlatformForFeatureLevel[FeatureLevel];
FPooledRenderTargetDesc DepthDesc = SceneContext.SceneDepthZ->GetDesc();
if (DepthDesc.NumSamples > 1 && RHISupportsSeparateMSAAAndResolveTextures(CurrentShaderPlatform))
{
DepthDesc.NumSamples = 1;
GRenderTargetPool.FindFreeElement(RHICmdList, DepthDesc, OutHitProxyDepthRT, TEXT("NoMSAASceneDepthZ"));
}
else
{
OutHitProxyDepthRT = SceneContext.SceneDepthZ;
}
}
}
static void BeginHitProxyRenderpass(FRHICommandListImmediate& RHICmdList, const FSceneRenderer* SceneRenderer, TRefCountPtr<IPooledRenderTarget> HitProxyRT, TRefCountPtr<IPooledRenderTarget> HitProxyDepthRT)
{
FRHIRenderPassInfo RPInfo(HitProxyRT->GetRenderTargetItem().TargetableTexture, ERenderTargetActions::Load_Store);
RPInfo.DepthStencilRenderTarget.Action = EDepthStencilTargetActions::LoadDepthStencil_StoreDepthStencil;
RPInfo.DepthStencilRenderTarget.DepthStencilTarget = HitProxyDepthRT->GetRenderTargetItem().TargetableTexture;
RPInfo.DepthStencilRenderTarget.ExclusiveDepthStencil = FExclusiveDepthStencil::DepthWrite_StencilWrite;
TransitionRenderPassTargets(RHICmdList, RPInfo);
RHICmdList.BeginRenderPass(RPInfo, TEXT("Clear_HitProxies"));
{
// Clear color for each view.
auto& Views = SceneRenderer->Views;
for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ViewIndex++)
{
const FViewInfo& View = Views[ViewIndex];
RHICmdList.SetViewport(View.ViewRect.Min.X, View.ViewRect.Min.Y, 0.0f, View.ViewRect.Max.X, View.ViewRect.Max.Y, 1.0f);
DrawClearQuad(RHICmdList, true, FLinearColor::White, false, 0, false, 0, HitProxyRT->GetDesc().Extent, FIntRect());
}
}
}
static void DoRenderHitProxies(FRHICommandListImmediate& RHICmdList, const FSceneRenderer* SceneRenderer, TRefCountPtr<IPooledRenderTarget> HitProxyRT, TRefCountPtr<IPooledRenderTarget> HitProxyDepthRT)
{
BeginHitProxyRenderpass(RHICmdList, SceneRenderer, HitProxyRT, HitProxyDepthRT);
auto & ViewFamily = SceneRenderer->ViewFamily;
auto & Views = SceneRenderer->Views;
const auto FeatureLevel = SceneRenderer->FeatureLevel;
const bool bNeedToSwitchVerticalAxis = RHINeedsToSwitchVerticalAxis(GShaderPlatformForFeatureLevel[SceneRenderer->FeatureLevel]);
FSceneRenderTargets& SceneContext = FSceneRenderTargets::Get(RHICmdList);
for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ViewIndex++)
{
const FViewInfo& View = Views[ViewIndex];
const FScene* LocalScene = SceneRenderer->Scene;
SceneRenderer->Scene->UniformBuffers.UpdateViewUniformBuffer(View);
FSceneTexturesUniformParameters SceneTextureParameters;
SetupSceneTextureUniformParameters(SceneContext, View.FeatureLevel, ESceneTextureSetupMode::None, SceneTextureParameters);
SceneRenderer->Scene->UniformBuffers.HitProxyPassUniformBuffer.UpdateUniformBufferImmediate(SceneTextureParameters);
FMeshPassProcessorRenderState DrawRenderState(View, SceneRenderer->Scene->UniformBuffers.HitProxyPassUniformBuffer);
// Set the device viewport for the view.
RHICmdList.SetViewport(View.ViewRect.Min.X, View.ViewRect.Min.Y, 0.0f, View.ViewRect.Max.X, View.ViewRect.Max.Y, 1.0f);
// Clear the depth buffer for each DPG.
DrawClearQuad(RHICmdList, false, FLinearColor(), true, (float)ERHIZBuffer::FarPlane, true, 0, HitProxyDepthRT->GetDesc().Extent, FIntRect());
// Depth tests + writes, no alpha blending.
DrawRenderState.SetDepthStencilState(TStaticDepthStencilState<true, CF_DepthNearOrEqual>::GetRHI());
DrawRenderState.SetBlendState(TStaticBlendState<>::GetRHI());
const bool bHitTesting = true;
// Adjust the visibility map for this view
if (View.bAllowTranslucentPrimitivesInHitProxy)
{
View.ParallelMeshDrawCommandPasses[EMeshPass::HitProxy].DispatchDraw(nullptr, RHICmdList);
}
else
{
View.ParallelMeshDrawCommandPasses[EMeshPass::HitProxyOpaqueOnly].DispatchDraw(nullptr, RHICmdList);
}
DrawDynamicMeshPass(View, RHICmdList,
[&View, &DrawRenderState, LocalScene](FDynamicPassMeshDrawListContext* DynamicMeshPassContext)
{
FHitProxyMeshProcessor PassMeshProcessor(
LocalScene,
&View,
View.bAllowTranslucentPrimitivesInHitProxy,
DrawRenderState,
DynamicMeshPassContext);
const uint64 DefaultBatchElementMask = ~0ull;
for (int32 MeshIndex = 0; MeshIndex < View.DynamicEditorMeshElements.Num(); MeshIndex++)
{
const FMeshBatchAndRelevance& MeshBatchAndRelevance = View.DynamicEditorMeshElements[MeshIndex];
PassMeshProcessor.AddMeshBatch(*MeshBatchAndRelevance.Mesh, DefaultBatchElementMask, MeshBatchAndRelevance.PrimitiveSceneProxy);
}
});
View.SimpleElementCollector.DrawBatchedElements(RHICmdList, DrawRenderState, View, EBlendModeFilter::All, SDPG_World);
View.SimpleElementCollector.DrawBatchedElements(RHICmdList, DrawRenderState, View, EBlendModeFilter::All, SDPG_Foreground);
View.EditorSimpleElementCollector.DrawBatchedElements(RHICmdList, DrawRenderState, View, EBlendModeFilter::All, SDPG_World);
View.EditorSimpleElementCollector.DrawBatchedElements(RHICmdList, DrawRenderState, View, EBlendModeFilter::All, SDPG_Foreground);
DrawDynamicMeshPass(View, RHICmdList,
[&View, &DrawRenderState, LocalScene](FDynamicPassMeshDrawListContext* DynamicMeshPassContext)
{
FHitProxyMeshProcessor PassMeshProcessor(
LocalScene,
&View,
View.bAllowTranslucentPrimitivesInHitProxy,
DrawRenderState,
DynamicMeshPassContext);
const uint64 DefaultBatchElementMask = ~0ull;
for (int32 MeshIndex = 0; MeshIndex < View.ViewMeshElements.Num(); MeshIndex++)
{
const FMeshBatch& MeshBatch = View.ViewMeshElements[MeshIndex];
PassMeshProcessor.AddMeshBatch(MeshBatch, DefaultBatchElementMask, nullptr);
}
});
DrawDynamicMeshPass(View, RHICmdList,
[&View, &DrawRenderState, LocalScene](FDynamicPassMeshDrawListContext* DynamicMeshPassContext)
{
FHitProxyMeshProcessor PassMeshProcessor(
LocalScene,
&View,
View.bAllowTranslucentPrimitivesInHitProxy,
DrawRenderState,
DynamicMeshPassContext);
const uint64 DefaultBatchElementMask = ~0ull;
for (int32 MeshIndex = 0; MeshIndex < View.TopViewMeshElements.Num(); MeshIndex++)
{
const FMeshBatch& MeshBatch = View.TopViewMeshElements[MeshIndex];
PassMeshProcessor.AddMeshBatch(MeshBatch, DefaultBatchElementMask, nullptr);
}
});
// Draw the view's batched simple elements(lines, sprites, etc).
View.BatchedViewElements.Draw(RHICmdList, DrawRenderState, FeatureLevel, bNeedToSwitchVerticalAxis, View, true);
// Some elements should never be occluded (e.g. gizmos).
// So we render those twice, first to overwrite potentially nearer objects,
// then again to allows proper occlusion within those elements.
DrawRenderState.SetDepthStencilState(TStaticDepthStencilState<false, CF_Always>::GetRHI());
DrawDynamicMeshPass(View, RHICmdList,
[&View, &DrawRenderState, LocalScene](FDynamicPassMeshDrawListContext* DynamicMeshPassContext)
{
FHitProxyMeshProcessor PassMeshProcessor(
LocalScene,
&View,
View.bAllowTranslucentPrimitivesInHitProxy,
DrawRenderState,
DynamicMeshPassContext);
const uint64 DefaultBatchElementMask = ~0ull;
for (int32 MeshIndex = 0; MeshIndex < View.TopViewMeshElements.Num(); MeshIndex++)
{
const FMeshBatch& MeshBatch = View.TopViewMeshElements[MeshIndex];
PassMeshProcessor.AddMeshBatch(MeshBatch, DefaultBatchElementMask, nullptr);
}
});
View.TopBatchedViewElements.Draw(RHICmdList, DrawRenderState, FeatureLevel, bNeedToSwitchVerticalAxis, View, true);
DrawRenderState.SetDepthStencilState(TStaticDepthStencilState<true, CF_DepthNearOrEqual>::GetRHI());
DrawDynamicMeshPass(View, RHICmdList,
[&View, &DrawRenderState, LocalScene](FDynamicPassMeshDrawListContext* DynamicMeshPassContext)
{
FHitProxyMeshProcessor PassMeshProcessor(
LocalScene,
&View,
View.bAllowTranslucentPrimitivesInHitProxy,
DrawRenderState,
DynamicMeshPassContext);
const uint64 DefaultBatchElementMask = ~0ull;
for (int32 MeshIndex = 0; MeshIndex < View.TopViewMeshElements.Num(); MeshIndex++)
{
const FMeshBatch& MeshBatch = View.TopViewMeshElements[MeshIndex];
PassMeshProcessor.AddMeshBatch(MeshBatch, DefaultBatchElementMask, nullptr);
}
});
View.TopBatchedViewElements.Draw(RHICmdList, DrawRenderState, FeatureLevel, bNeedToSwitchVerticalAxis, View, true);
}
// Was started in init, but ends here.
RHICmdList.EndRenderPass();
// Finish drawing to the hit proxy render target.
RHICmdList.CopyToResolveTarget(HitProxyRT->GetRenderTargetItem().TargetableTexture, HitProxyRT->GetRenderTargetItem().ShaderResourceTexture, FResolveParams());
RHICmdList.CopyToResolveTarget(SceneContext.GetSceneDepthSurface(), SceneContext.GetSceneDepthSurface(), FResolveParams());
// to be able to observe results with VisualizeTexture
GVisualizeTexture.SetCheckPoint(RHICmdList, HitProxyRT);
//
// Copy the hit proxy buffer into the view family's render target.
//
// Set up a FTexture that is used to draw the hit proxy buffer to the view family's render target.
FTexture HitProxyRenderTargetTexture;
HitProxyRenderTargetTexture.TextureRHI = HitProxyRT->GetRenderTargetItem().ShaderResourceTexture;
HitProxyRenderTargetTexture.SamplerStateRHI = TStaticSamplerState<>::GetRHI();
// Generate the vertices and triangles mapping the hit proxy RT pixels into the view family's RT pixels.
FBatchedElements BatchedElements;
for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ViewIndex++)
{
const FViewInfo& View = Views[ViewIndex];
FIntPoint BufferSize = SceneContext.GetBufferSizeXY();
float InvBufferSizeX = 1.0f / BufferSize.X;
float InvBufferSizeY = 1.0f / BufferSize.Y;
const float U0 = View.ViewRect.Min.X * InvBufferSizeX;
const float V0 = View.ViewRect.Min.Y * InvBufferSizeY;
const float U1 = View.ViewRect.Max.X * InvBufferSizeX;
const float V1 = View.ViewRect.Max.Y * InvBufferSizeY;
// Note: High DPI . We are drawing to the size of the unscaled view rect because that is the size of the views render target
// if we do not do this clicking would be off.
const int32 V00 = BatchedElements.AddVertex(FVector4(View.UnscaledViewRect.Min.X, View.UnscaledViewRect.Min.Y, 0, 1),FVector2D(U0, V0), FLinearColor::White, FHitProxyId());
const int32 V10 = BatchedElements.AddVertex(FVector4(View.UnscaledViewRect.Max.X, View.UnscaledViewRect.Min.Y, 0, 1),FVector2D(U1, V0), FLinearColor::White, FHitProxyId());
const int32 V01 = BatchedElements.AddVertex(FVector4(View.UnscaledViewRect.Min.X, View.UnscaledViewRect.Max.Y, 0, 1),FVector2D(U0, V1), FLinearColor::White, FHitProxyId());
const int32 V11 = BatchedElements.AddVertex(FVector4(View.UnscaledViewRect.Max.X, View.UnscaledViewRect.Max.Y, 0, 1),FVector2D(U1, V1), FLinearColor::White, FHitProxyId());
BatchedElements.AddTriangle(V00,V10,V11,&HitProxyRenderTargetTexture,BLEND_Opaque);
BatchedElements.AddTriangle(V00,V11,V01,&HitProxyRenderTargetTexture,BLEND_Opaque);
}
// Generate a transform which maps from view family RT pixel coordinates to Normalized Device Coordinates.
FIntPoint RenderTargetSize = ViewFamily.RenderTarget->GetSizeXY();
const FMatrix PixelToView =
FTranslationMatrix(FVector(0, 0, 0)) *
FMatrix(
FPlane( 1.0f / ((float)RenderTargetSize.X / 2.0f), 0.0, 0.0f, 0.0f ),
FPlane( 0.0f, -GProjectionSignY / ((float)RenderTargetSize.Y / 2.0f), 0.0f, 0.0f ),
FPlane( 0.0f, 0.0f, 1.0f, 0.0f ),
FPlane( -1.0f, GProjectionSignY, 0.0f, 1.0f )
);
{
// Draw the triangles to the view family's render target.
FRHIRenderPassInfo RPInfo(ViewFamily.RenderTarget->GetRenderTargetTexture(), ERenderTargetActions::Load_Store);
RHICmdList.BeginRenderPass(RPInfo, TEXT("HitProxies"));
{
FSceneView SceneView = FBatchedElements::CreateProxySceneView(PixelToView, FIntRect(0, 0, RenderTargetSize.X, RenderTargetSize.Y));
FMeshPassProcessorRenderState DrawRenderState(SceneView);
DrawRenderState.SetDepthStencilState(TStaticDepthStencilState<false, CF_Always>::GetRHI());
DrawRenderState.SetBlendState(TStaticBlendState<>::GetRHI());
BatchedElements.Draw(
RHICmdList,
DrawRenderState,
FeatureLevel,
bNeedToSwitchVerticalAxis,
SceneView,
false,
1.0f
);
}
RHICmdList.EndRenderPass();
}
RHICmdList.EndScene();
}
#endif
void FMobileSceneRenderer::RenderHitProxies(FRHICommandListImmediate& RHICmdList)
{
Scene->UpdateAllPrimitiveSceneInfos(RHICmdList);
PrepareViewRectsForRendering();
#if WITH_EDITOR
TRefCountPtr<IPooledRenderTarget> HitProxyRT;
TRefCountPtr<IPooledRenderTarget> HitProxyDepthRT;
InitHitProxyRender(RHICmdList, this, HitProxyRT, HitProxyDepthRT);
// HitProxyRT==0 should never happen but better we don't crash
if (HitProxyRT)
{
// Find the visible primitives.
InitViews(RHICmdList);
GEngine->GetPreRenderDelegate().Broadcast();
// Global dynamic buffers need to be committed before rendering.
DynamicIndexBuffer.Commit();
DynamicVertexBuffer.Commit();
DynamicReadBuffer.Commit();
::DoRenderHitProxies(RHICmdList, this, HitProxyRT, HitProxyDepthRT);
}
check(RHICmdList.IsOutsideRenderPass());
#endif
}
void FDeferredShadingSceneRenderer::RenderHitProxies(FRHICommandListImmediate& RHICmdList)
{
Scene->UpdateAllPrimitiveSceneInfos(RHICmdList);
PrepareViewRectsForRendering();
#if WITH_EDITOR
// HitProxyRT==0 should never happen but better we don't crash
TRefCountPtr<IPooledRenderTarget> HitProxyRT;
TRefCountPtr<IPooledRenderTarget> HitProxyDepthRT;
InitHitProxyRender(RHICmdList, this, HitProxyRT, HitProxyDepthRT);
if (HitProxyRT)
{
// Find the visible primitives.
FGraphEventArray UpdateViewCustomDataEvents;
FILCUpdatePrimTaskData ILCTaskData;
bool bDoInitViewAftersPrepass = InitViews(RHICmdList, FExclusiveDepthStencil::DepthWrite_StencilWrite, ILCTaskData, UpdateViewCustomDataEvents);
if (bDoInitViewAftersPrepass)
{
InitViewsPossiblyAfterPrepass(RHICmdList, ILCTaskData, UpdateViewCustomDataEvents);
}
extern TSet<IPersistentViewUniformBufferExtension*> PersistentViewUniformBufferExtensions;
for (IPersistentViewUniformBufferExtension* Extension : PersistentViewUniformBufferExtensions)
{
Extension->BeginFrame();
for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ViewIndex++)
{
// Must happen before RHI thread flush so any tasks we dispatch here can land in the idle gap during the flush
Extension->PrepareView(&Views[ViewIndex]);
}
}
UpdateGPUScene(RHICmdList, *Scene);
for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ViewIndex++)
{
UploadDynamicPrimitiveShaderDataForView(RHICmdList, *Scene, Views[ViewIndex]);
}
if (UpdateViewCustomDataEvents.Num())
{
QUICK_SCOPE_CYCLE_COUNTER(STAT_FDeferredShadingSceneRenderer_AsyncUpdateViewCustomData_Wait);
FTaskGraphInterface::Get().WaitUntilTasksComplete(UpdateViewCustomDataEvents, ENamedThreads::GetRenderThread());
}
GEngine->GetPreRenderDelegate().Broadcast();
// Global dynamic buffers need to be committed before rendering.
DynamicIndexBufferForInitViews.Commit();
DynamicVertexBufferForInitViews.Commit();
DynamicReadBufferForInitViews.Commit();
// Notify the FX system that the scene is about to be rendered.
if (Scene->FXSystem && Views.IsValidIndex(0))
{
FGPUSortManager* GPUSortManager = Scene->FXSystem->GetGPUSortManager();
Scene->FXSystem->PreRender(RHICmdList, &Views[0].GlobalDistanceFieldInfo.ParameterData, false);
if (GPUSortManager)
{
GPUSortManager->OnPreRender(RHICmdList);
}
// Call PostRenderOpaque now as this is irrelevant for when rendering hit proxies.
// because we don't tick the particles in the render loop (see last param being "false").
Scene->FXSystem->PostRenderOpaque(RHICmdList, Views[0].ViewUniformBuffer, nullptr, nullptr, false);
if (GPUSortManager)
{
GPUSortManager->OnPostRenderOpaque(RHICmdList);
}
}
::DoRenderHitProxies(RHICmdList, this, HitProxyRT, HitProxyDepthRT);
}
check(RHICmdList.IsOutsideRenderPass());
#endif
}
#if WITH_EDITOR
void FHitProxyMeshProcessor::AddMeshBatch(const FMeshBatch& RESTRICT MeshBatch, uint64 BatchElementMask, const FPrimitiveSceneProxy* RESTRICT PrimitiveSceneProxy, int32 StaticMeshId)
{
if (MeshBatch.bUseForMaterial && MeshBatch.bSelectable && Scene->RequiresHitProxies() && (!PrimitiveSceneProxy || PrimitiveSceneProxy->IsSelectable()))
{
// Determine the mesh's material and blend mode.
const FMaterialRenderProxy* MaterialRenderProxy = nullptr;
const FMaterial* Material = &MeshBatch.MaterialRenderProxy->GetMaterialWithFallback(FeatureLevel, MaterialRenderProxy);
const EBlendMode BlendMode = Material->GetBlendMode();
const FMeshDrawingPolicyOverrideSettings OverrideSettings = ComputeMeshOverrideSettings(MeshBatch);
const ERasterizerFillMode MeshFillMode = ComputeMeshFillMode(MeshBatch, *Material, OverrideSettings);
const ERasterizerCullMode MeshCullMode = ComputeMeshCullMode(MeshBatch, *Material, OverrideSettings);
if (Material->WritesEveryPixel() && !Material->IsTwoSided() && !Material->MaterialModifiesMeshPosition_RenderThread())
{
// Default material doesn't handle masked, and doesn't have the correct bIsTwoSided setting.
MaterialRenderProxy = UMaterial::GetDefaultMaterial(MD_Surface)->GetRenderProxy();
Material = MaterialRenderProxy->GetMaterial(FeatureLevel);
}
if (!MaterialRenderProxy)
{
MaterialRenderProxy = MeshBatch.MaterialRenderProxy;
}
check(Material && MaterialRenderProxy);
bool bAddTranslucentPrimitive = bAllowTranslucentPrimitivesInHitProxy;
// Check whether the primitive overrides the pass to force translucent hit proxies.
if (!bAddTranslucentPrimitive)
{
FHitProxyId HitProxyId = MeshBatch.BatchHitProxyId;
// Fallback to the primitive default hit proxy id if the mesh batch doesn't have one.
if (MeshBatch.BatchHitProxyId == FHitProxyId() && PrimitiveSceneProxy)
{
if (const FPrimitiveSceneInfo* PrimitiveSceneInfo = PrimitiveSceneProxy->GetPrimitiveSceneInfo())
{
HitProxyId = PrimitiveSceneInfo->DefaultDynamicHitProxyId;
}
}
if (const HHitProxy* HitProxy = GetHitProxyById(HitProxyId))
{
bAddTranslucentPrimitive = HitProxy->AlwaysAllowsTranslucentPrimitives();
}
}
if (bAddTranslucentPrimitive || !IsTranslucentBlendMode(BlendMode))
{
Process(MeshBatch, BatchElementMask, StaticMeshId, PrimitiveSceneProxy, *MaterialRenderProxy, *Material, MeshFillMode, MeshCullMode);
}
}
}
void GetHitProxyPassShaders(
const FMaterial& Material,
FVertexFactoryType* VertexFactoryType,
ERHIFeatureLevel::Type FeatureLevel,
TShaderRef<FHitProxyHS>& HullShader,
TShaderRef<FHitProxyDS>& DomainShader,
TShaderRef<FHitProxyVS>& VertexShader,
TShaderRef<FHitProxyPS>& PixelShader)
{
const EMaterialTessellationMode MaterialTessellationMode = Material.GetTessellationMode();
const bool bNeedsHSDS = RHISupportsTessellation(GShaderPlatformForFeatureLevel[FeatureLevel])
&& VertexFactoryType->SupportsTessellationShaders()
&& MaterialTessellationMode != MTM_NoTessellation;
if (bNeedsHSDS)
{
DomainShader = Material.GetShader<FHitProxyDS>(VertexFactoryType);
HullShader = Material.GetShader<FHitProxyHS>(VertexFactoryType);
}
VertexShader = Material.GetShader<FHitProxyVS>(VertexFactoryType);
PixelShader = Material.GetShader<FHitProxyPS>(VertexFactoryType);
}
void FHitProxyMeshProcessor::Process(
const FMeshBatch& MeshBatch,
uint64 BatchElementMask,
int32 StaticMeshId,
const FPrimitiveSceneProxy* RESTRICT PrimitiveSceneProxy,
const FMaterialRenderProxy& RESTRICT MaterialRenderProxy,
const FMaterial& RESTRICT MaterialResource,
ERasterizerFillMode MeshFillMode,
ERasterizerCullMode MeshCullMode)
{
const FVertexFactory* VertexFactory = MeshBatch.VertexFactory;
TMeshProcessorShaders<
FHitProxyVS,
FHitProxyHS,
FHitProxyDS,
FHitProxyPS> HitProxyPassShaders;
GetHitProxyPassShaders(
MaterialResource,
VertexFactory->GetType(),
FeatureLevel,
HitProxyPassShaders.HullShader,
HitProxyPassShaders.DomainShader,
HitProxyPassShaders.VertexShader,
HitProxyPassShaders.PixelShader
);
FHitProxyShaderElementData ShaderElementData(MeshBatch.BatchHitProxyId);
ShaderElementData.InitializeMeshMaterialData(ViewIfDynamicMeshCommand, PrimitiveSceneProxy, MeshBatch, StaticMeshId, false);
const FMeshDrawCommandSortKey SortKey = CalculateMeshStaticSortKey(HitProxyPassShaders.VertexShader, HitProxyPassShaders.PixelShader);
BuildMeshDrawCommands(
MeshBatch,
BatchElementMask,
PrimitiveSceneProxy,
MaterialRenderProxy,
MaterialResource,
PassDrawRenderState,
HitProxyPassShaders,
MeshFillMode,
MeshCullMode,
SortKey,
EMeshPassFeatures::Default,
ShaderElementData);
}
FHitProxyMeshProcessor::FHitProxyMeshProcessor(const FScene* Scene, const FSceneView* InViewIfDynamicMeshCommand, bool InbAllowTranslucentPrimitivesInHitProxy, const FMeshPassProcessorRenderState& InRenderState, FMeshPassDrawListContext* InDrawListContext)
: FMeshPassProcessor(Scene, Scene->GetFeatureLevel(), InViewIfDynamicMeshCommand, InDrawListContext)
, PassDrawRenderState(InRenderState)
, bAllowTranslucentPrimitivesInHitProxy(InbAllowTranslucentPrimitivesInHitProxy)
{
}
FMeshPassProcessor* CreateHitProxyPassProcessor(const FScene* Scene, const FSceneView* InViewIfDynamicMeshCommand, FMeshPassDrawListContext* InDrawListContext)
{
FMeshPassProcessorRenderState PassDrawRenderState(Scene->UniformBuffers.ViewUniformBuffer, Scene->UniformBuffers.HitProxyPassUniformBuffer);
PassDrawRenderState.SetInstancedViewUniformBuffer(Scene->UniformBuffers.InstancedViewUniformBuffer);
PassDrawRenderState.SetDepthStencilState(TStaticDepthStencilState<true, CF_DepthNearOrEqual>::GetRHI());
PassDrawRenderState.SetBlendState(TStaticBlendState<>::GetRHI());
return new(FMemStack::Get()) FHitProxyMeshProcessor(Scene, InViewIfDynamicMeshCommand, true, PassDrawRenderState, InDrawListContext);
}
FMeshPassProcessor* CreateHitProxyOpaqueOnlyPassProcessor(const FScene* Scene, const FSceneView* InViewIfDynamicMeshCommand, FMeshPassDrawListContext* InDrawListContext)
{
FMeshPassProcessorRenderState PassDrawRenderState(Scene->UniformBuffers.ViewUniformBuffer, Scene->UniformBuffers.HitProxyPassUniformBuffer);
PassDrawRenderState.SetInstancedViewUniformBuffer(Scene->UniformBuffers.InstancedViewUniformBuffer);
PassDrawRenderState.SetDepthStencilState(TStaticDepthStencilState<true, CF_DepthNearOrEqual>::GetRHI());
PassDrawRenderState.SetBlendState(TStaticBlendState<>::GetRHI());
return new(FMemStack::Get()) FHitProxyMeshProcessor(Scene, InViewIfDynamicMeshCommand, false, PassDrawRenderState, InDrawListContext);
}
FRegisterPassProcessorCreateFunction RegisterHitProxyPass(&CreateHitProxyPassProcessor, EShadingPath::Deferred, EMeshPass::HitProxy, EMeshPassFlags::CachedMeshCommands | EMeshPassFlags::MainView);
FRegisterPassProcessorCreateFunction RegisterHitProxyOpaqueOnlyPass(&CreateHitProxyOpaqueOnlyPassProcessor, EShadingPath::Deferred, EMeshPass::HitProxyOpaqueOnly, EMeshPassFlags::CachedMeshCommands | EMeshPassFlags::MainView);
FRegisterPassProcessorCreateFunction RegisterMobileHitProxyPass(&CreateHitProxyPassProcessor, EShadingPath::Mobile, EMeshPass::HitProxy, EMeshPassFlags::CachedMeshCommands | EMeshPassFlags::MainView);
FRegisterPassProcessorCreateFunction RegisterMobileHitProxyOpaqueOnlyPass(&CreateHitProxyOpaqueOnlyPassProcessor, EShadingPath::Mobile, EMeshPass::HitProxyOpaqueOnly, EMeshPassFlags::CachedMeshCommands | EMeshPassFlags::MainView);
void FEditorSelectionMeshProcessor::AddMeshBatch(const FMeshBatch& RESTRICT MeshBatch, uint64 BatchElementMask, const FPrimitiveSceneProxy* RESTRICT PrimitiveSceneProxy, int32 StaticMeshId)
{
if (MeshBatch.bUseForMaterial
&& MeshBatch.bUseSelectionOutline
&& PrimitiveSceneProxy->WantsSelectionOutline()
&& (PrimitiveSceneProxy->IsSelected() || PrimitiveSceneProxy->IsHovered()))
{
// Determine the mesh's material and blend mode.
const FMaterialRenderProxy* MaterialRenderProxy = nullptr;
const FMaterial* Material = &MeshBatch.MaterialRenderProxy->GetMaterialWithFallback(FeatureLevel, MaterialRenderProxy);
const FMeshDrawingPolicyOverrideSettings OverrideSettings = ComputeMeshOverrideSettings(MeshBatch);
const ERasterizerFillMode MeshFillMode = ComputeMeshFillMode(MeshBatch, *Material, OverrideSettings);
const ERasterizerCullMode MeshCullMode = CM_None;
if (Material->WritesEveryPixel() && !Material->IsTwoSided() && !Material->MaterialModifiesMeshPosition_RenderThread())
{
// Default material doesn't handle masked, and doesn't have the correct bIsTwoSided setting.
MaterialRenderProxy = UMaterial::GetDefaultMaterial(MD_Surface)->GetRenderProxy();
Material = MaterialRenderProxy->GetMaterial(FeatureLevel);
}
if (!MaterialRenderProxy)
{
MaterialRenderProxy = MeshBatch.MaterialRenderProxy;
}
check(Material && MaterialRenderProxy);
Process(MeshBatch, BatchElementMask, StaticMeshId, PrimitiveSceneProxy, *MaterialRenderProxy, *Material, MeshFillMode, MeshCullMode);
}
}
void FEditorSelectionMeshProcessor::Process(
const FMeshBatch& MeshBatch,
uint64 BatchElementMask,
int32 StaticMeshId,
const FPrimitiveSceneProxy* RESTRICT PrimitiveSceneProxy,
const FMaterialRenderProxy& RESTRICT MaterialRenderProxy,
const FMaterial& RESTRICT MaterialResource,
ERasterizerFillMode MeshFillMode,
ERasterizerCullMode MeshCullMode)
{
const FVertexFactory* VertexFactory = MeshBatch.VertexFactory;
TMeshProcessorShaders<
FHitProxyVS,
FHitProxyHS,
FHitProxyDS,
FHitProxyPS> HitProxyPassShaders;
GetHitProxyPassShaders(
MaterialResource,
VertexFactory->GetType(),
FeatureLevel,
HitProxyPassShaders.HullShader,
HitProxyPassShaders.DomainShader,
HitProxyPassShaders.VertexShader,
HitProxyPassShaders.PixelShader
);
const int32 StencilRef = GetStencilValue(ViewIfDynamicMeshCommand, PrimitiveSceneProxy);
PassDrawRenderState.SetStencilRef(StencilRef);
FHitProxyId DummyId;
FHitProxyShaderElementData ShaderElementData(DummyId);
ShaderElementData.InitializeMeshMaterialData(ViewIfDynamicMeshCommand, PrimitiveSceneProxy, MeshBatch, StaticMeshId, false);
const FMeshDrawCommandSortKey SortKey = CalculateMeshStaticSortKey(HitProxyPassShaders.VertexShader, HitProxyPassShaders.PixelShader);
BuildMeshDrawCommands(
MeshBatch,
BatchElementMask,
PrimitiveSceneProxy,
MaterialRenderProxy,
MaterialResource,
PassDrawRenderState,
HitProxyPassShaders,
MeshFillMode,
MeshCullMode,
SortKey,
EMeshPassFeatures::Default,
ShaderElementData);
}
int32 FEditorSelectionMeshProcessor::GetStencilValue(const FSceneView* View, const FPrimitiveSceneProxy* PrimitiveSceneProxy)
{
const bool bActorSelectionColorIsSubdued = View->bHasSelectedComponents;
const int32* ExistingStencilValue = PrimitiveSceneProxy->IsIndividuallySelected() ? ProxyToStencilIndex.Find(PrimitiveSceneProxy) : ActorNameToStencilIndex.Find(PrimitiveSceneProxy->GetOwnerName());
int32 StencilValue = 0;
if (PrimitiveSceneProxy->GetOwnerName() == NAME_BSP)
{
StencilValue = 1;
}
else if (ExistingStencilValue != nullptr)
{
StencilValue = *ExistingStencilValue;
}
else if (PrimitiveSceneProxy->IsIndividuallySelected())
{
// Any component that is individually selected should have a stencil value of < 128 so that it can have a unique color. We offset the value by 2 because 0 means no selection and 1 is for bsp
StencilValue = ProxyToStencilIndex.Num() % 126 + 2;
ProxyToStencilIndex.Add(PrimitiveSceneProxy, StencilValue);
}
else
{
// If we are subduing actor color highlight then use the top level bits to indicate that to the shader.
StencilValue = bActorSelectionColorIsSubdued ? ActorNameToStencilIndex.Num() % 128 + 128 : ActorNameToStencilIndex.Num() % 126 + 2;
ActorNameToStencilIndex.Add(PrimitiveSceneProxy->GetOwnerName(), StencilValue);
}
return StencilValue;
}
FEditorSelectionMeshProcessor::FEditorSelectionMeshProcessor(const FScene* Scene, const FSceneView* InViewIfDynamicMeshCommand, FMeshPassDrawListContext* InDrawListContext)
: FMeshPassProcessor(Scene, Scene->GetFeatureLevel(), InViewIfDynamicMeshCommand, InDrawListContext)
{
checkf(InViewIfDynamicMeshCommand, TEXT("Editor selection mesh process required dynamic mesh command mode."));
ActorNameToStencilIndex.Add(NAME_BSP, 1);
PassDrawRenderState.SetDepthStencilState(TStaticDepthStencilState<true, CF_DepthNearOrEqual, true, CF_Always, SO_Keep, SO_Keep, SO_Replace>::GetRHI());
PassDrawRenderState.SetBlendState(TStaticBlendStateWriteMask<CW_NONE, CW_NONE, CW_NONE, CW_NONE>::GetRHI());
PassDrawRenderState.SetViewUniformBuffer(Scene->UniformBuffers.ViewUniformBuffer);
PassDrawRenderState.SetInstancedViewUniformBuffer(Scene->UniformBuffers.InstancedViewUniformBuffer);
PassDrawRenderState.SetPassUniformBuffer(Scene->UniformBuffers.EditorSelectionPassUniformBuffer);
}
FMeshPassProcessor* CreateEditorSelectionPassProcessor(const FScene* Scene, const FSceneView* InViewIfDynamicMeshCommand, FMeshPassDrawListContext* InDrawListContext)
{
return new(FMemStack::Get()) FEditorSelectionMeshProcessor(Scene, InViewIfDynamicMeshCommand, InDrawListContext);
}
FRegisterPassProcessorCreateFunction RegisterEditorSelectionPass(&CreateEditorSelectionPassProcessor, EShadingPath::Deferred, EMeshPass::EditorSelection, EMeshPassFlags::MainView);
FRegisterPassProcessorCreateFunction RegisterMobileEditorSelectionPass(&CreateEditorSelectionPassProcessor, EShadingPath::Mobile, EMeshPass::EditorSelection, EMeshPassFlags::MainView);
#endif
|
fd6624eb809778641b71544497610a74d192023b | b9261ea1c3415701018f8eeab92654fc8c51cf3d | /stats.cpp | f9f3ea45407727d3ffc5099785e72bf409acffb4 | [] | no_license | Jubata/warc_html | 2b1d17df5b53b382c069ba5c3cc27b1d212b25ac | 49db7b8a1170342722004a0025a97503791037df | refs/heads/master | 2021-04-27T19:35:11.508413 | 2018-03-03T17:16:56 | 2018-03-03T17:16:56 | 122,359,694 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,672 | cpp | stats.cpp | #include "stats.h"
#include "yuarel.h"
#include <sstream>
#include <json/json.h>
#include <iostream>
#include "csv/ostream.hpp"
void Stats::addEntity(const std::string& url, bool isAttrName, const std::string& name, size_t count) {
struct yuarel parsedUrl;
std::string url2(url);
if(-1 == yuarel_parse(&parsedUrl, &url2.front()) ) {
return;
}
std::ostringstream stringStream;
stringStream << parsedUrl.host << "#" << isAttrName << "#" << name;
addEntity(stringStream.str(), count, 1, url, count);
}
void Stats::addEntity(const std::string& url,
size_t totalFields,
size_t countUrls,
const std::string& bestUrl,
size_t bestMeanFieldsPerPage) {
Stats::UrlStats &entry = map[url];
if(entry.bestMeanFieldsPerPage < bestMeanFieldsPerPage) {
entry.bestMeanFieldsPerPage = bestMeanFieldsPerPage;
entry.bestUrl = bestUrl;
}
entry.totalFields += totalFields;
entry.countUrls += countUrls;
}
void Stats::print_json() {
for(auto& it: map) {
const UrlStats& stats = it.second;
// Json::Value root;
// root["url"] = it.first;
// root["total"] = stats.totalFields;
// root["urls"] = stats.countUrls;
// root["best_url"]=stats.bestUrl;
// root["best_count"]=stats.bestMeanFieldsPerPage;
// std::cout<<root<<","<<std::endl;
namespace csv = ::text::csv;
csv::csv_ostream csvs(std::cout);
csvs << it.first.c_str()
<< (int)stats.totalFields
<< (int)stats.countUrls
<< stats.bestUrl.c_str()
<< (double)stats.bestMeanFieldsPerPage
<< csv::endl;
}
} |
f65729983b24f41ade9ac23b1bebf163d2369dd3 | 7f924882d23444cdb16c2ac37c9875b7b83c841a | /SDK75/idasdk75/idasdk75/include/tryblks.hpp | 14437185485e24791358612a3ffbc025e1486757 | [] | no_license | vbty/IDA7.5_SDK | 4e047a2c0eef056373134a3713876040b50d07bb | 5244a2b5059113e421b4da4ecf771013a6fde2f8 | refs/heads/main | 2023-06-26T16:21:38.541579 | 2021-07-23T08:18:56 | 2021-07-23T08:18:56 | 388,311,205 | 9 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 6,851 | hpp | tryblks.hpp | /*
* Interactive disassembler (IDA).
* Copyright (c) 2016-2020 Hex-Rays
* ALL RIGHTS RESERVED.
*
* Module independent exception description
*/
#ifndef TRYBLKS_HPP
#define TRYBLKS_HPP
/*! \file tryblks.hpp
*
* \brief Architecture independent exception handling info.
*
* Try blocks have the following general properties:
* - An try block specifies a possibly fragmented guarded code region.
* - Each try block has always at least one catch/except block description
* - Each catch block contains its boundaries and a filter.
* - Additionally a catch block can hold sp adjustment and the offset to the
* exception object offset (C++).
* - Try blocks can be nested. Nesting is automatically calculated at the retrieval time.
* - There may be (nested) multiple try blocks starting at the same address.
*
* See examples in tests/input/src/eh_tests.
*
*/
// We use end_ea=BADADDR if the exact boundaries are unknown of any range.
//----------------------------------------------------------------------------
// An exception handler clause (the body of __except or catch statement)
struct try_handler_t : public rangevec_t
{
sval_t disp; // displacement to the stack region of the guarded region.
// if it is valid, it is fpreg relative.
// -1 means unknown.
int fpreg; // frame register number used in handler. -1 means none.
try_handler_t() : disp(-1), fpreg(-1) {}
void clear(void)
{
rangevec_t::clear();
disp = -1;
fpreg = -1;
}
};
DECLARE_TYPE_AS_MOVABLE(try_handler_t);
//----------------------------------------------------------------------------
// __except() {} statement
struct seh_t : public try_handler_t
{
rangevec_t filter; // boundaries of the filter callback. if filter is empty,
ea_t seh_code; // then use seh_code
#define SEH_CONTINUE BADADDR // EXCEPTION_CONTINUE_EXECUTION (-1)
#define SEH_SEARCH ea_t(0) // EXCEPTION_CONTINUE_SEARCH (0) (alias of __finally)
#define SEH_HANDLE ea_t(1) // EXCEPTION_EXECUTE_HANDLER (1)
void clear(void)
{
try_handler_t::clear();
filter.clear();
seh_code = SEH_CONTINUE;
}
};
DECLARE_TYPE_AS_MOVABLE(seh_t);
//----------------------------------------------------------------------------
// catch() {} statement
struct catch_t : public try_handler_t
{
sval_t obj; // fpreg relative displacement to the exception object. -1 if unknown.
sval_t type_id; // the type caught by this catch. -1 means "catch(...)"
#define CATCH_ID_ALL sval_t(-1) // catch(...)
#define CATCH_ID_CLEANUP sval_t(-2) // a cleanup handler invoked if exception occures
catch_t() : obj(-1), type_id(-1) {}
};
DECLARE_TYPE_AS_MOVABLE(catch_t);
typedef qvector<catch_t> catchvec_t;
//----------------------------------------------------------------------------
class tryblk_t : public rangevec_t // block guarded by try/__try {...} statements
{
#ifndef SWIG
char reserve[qmax(sizeof(catchvec_t), sizeof(seh_t))]; // seh_t or catchvec_t
#endif
uchar cb; // size of tryblk_t
uchar kind; // one of the following kinds
#define TB_NONE 0 // empty
#define TB_SEH 1 // MS SEH __try/__except/__finally
#define TB_CPP 2 // C++ language try/catch
public:
uchar level; // nesting level, calculated by get_tryblks()
// C++ try/catch block (TB_CPP)
catchvec_t &cpp() { return *(( catchvec_t *)reserve); }
const catchvec_t &cpp() const { return *((const catchvec_t *)reserve); }
// SEH __except/__finally case (TB_SEH)
seh_t &seh() { return *(( seh_t *)reserve); }
const seh_t &seh() const { return *((const seh_t *)reserve); }
tryblk_t() : rangevec_t(), cb(sizeof(*this)), kind(TB_NONE), level(0) { reserve[0] = '\0'; }
~tryblk_t() { clear(); }
tryblk_t(const tryblk_t &r) : rangevec_t(), kind(TB_NONE) { *this = r; }
uchar get_kind(void) const { return kind; }
bool empty(void) const { return kind == TB_NONE; }
bool is_seh(void) const { return kind == TB_SEH; }
bool is_cpp(void) const { return kind == TB_CPP; }
//-------------------------------------------------------------------------
tryblk_t &operator=(const tryblk_t &r)
{
if ( this != &r ) // don't copy yourself
{
if ( kind != TB_NONE )
clear();
kind = r.kind;
level = r.level;
rangevec_t::operator=(r);
if ( kind == TB_SEH )
new (reserve) seh_t(r.seh());
else if ( kind == TB_CPP )
new (reserve) catchvec_t(r.cpp());
}
return *this;
}
//-------------------------------------------------------------------------
void clear(void)
{
if ( kind == TB_CPP )
cpp().~catchvec_t();
else if ( kind == TB_SEH )
seh().~seh_t();
kind = TB_NONE;
}
//-------------------------------------------------------------------------
seh_t &set_seh(void)
{
if ( kind != TB_SEH )
{
clear();
new (reserve) seh_t;
kind = TB_SEH;
}
else
{
seh().clear();
}
return seh();
}
//-------------------------------------------------------------------------
catchvec_t &set_cpp(void)
{
if ( kind != TB_CPP )
{
clear();
new (reserve) catchvec_t;
kind = TB_CPP;
}
else
{
cpp().clear();
}
return cpp();
}
};
DECLARE_TYPE_AS_MOVABLE(tryblk_t);
typedef qvector<tryblk_t> tryblks_t;
///-------------------------------------------------------------------------
/// Retrieve try block information from the specified address range.
/// Try blocks are sorted by starting address and their nest levels calculated.
/// \param tbv output buffer; may be NULL
/// \param range address range to change
/// \return number of found try blocks
idaman size_t ida_export get_tryblks(tryblks_t *tbv, const range_t &range);
/// Delete try block information in the specified range.
/// \param range the range to be cleared
idaman void ida_export del_tryblks(const range_t &range);
/// Add one try block information.
/// \param tb try block to add.
/// \return error code; 0 means good
idaman int ida_export add_tryblk(const tryblk_t &tb);
/// \defgroup TBERR_ Try block handling error codes
//@{
#define TBERR_OK 0 ///< ok
#define TBERR_START 1 ///< bad start address
#define TBERR_END 2 ///< bad end address
#define TBERR_ORDER 3 ///< bad address order
#define TBERR_EMPTY 4 ///< empty try block
#define TBERR_KIND 5 ///< illegal try block kind
#define TBERR_NO_CATCHES 6 ///< no catch blocks at all
#define TBERR_INTERSECT 7 ///< range would intersect inner tryblk
//@}
/// Find the start address of the system eh region including the argument.
/// \param ea search address
/// \return start address of surrounding tryblk, otherwise BADADDR
idaman ea_t ida_export find_syseh(ea_t ea);
#endif // TRYBLKS_HPP
|
96f8acec7ecc1eea1541a23652e90965a33d21c3 | 21b03cb331af7aedbfc657d1baf14c29804d2c6a | /AntSim/Main.cpp | acf5da1a62a1b47faee4a4fd788b1e589843b1e9 | [] | no_license | SupersushiMega/AntSim | 03f1c4790613fff8a221fbf5e21e88bed75be761 | 1f1e21a547f05fd9a31620043467f6388a51540d | refs/heads/master | 2023-04-23T12:08:11.902222 | 2021-05-01T16:13:58 | 2021-05-01T16:13:58 | 359,561,025 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,890 | cpp | Main.cpp | #define WIDTH 1024
#define HEIGHT 800
#include <Windows.h>
#include <algorithm>
#include <time.h>
#include <string>
#include "Graphics.h"
#include "AntSim.h"
#include "Perlin.h"
Graphics* graphics;
bool closeWindow = false;
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_DESTROY)
{
PostQuitMessage(0);
closeWindow = true;
return 0;
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE prevInstance, LPWSTR cmd, int nCmdShow)
{
RECT resolution = { 0, 0, WIDTH, HEIGHT };
//Window Setup
//=========================================================================================
WNDCLASSEX windowclass;
ZeroMemory(&windowclass, sizeof(WNDCLASSEX));
windowclass.cbSize = sizeof(WNDCLASSEX);
windowclass.hbrBackground = (HBRUSH)COLOR_WINDOW;
windowclass.hInstance = hInstance;
windowclass.lpfnWndProc = WindowProc;
windowclass.lpszClassName = L"MainWindow";
windowclass.style = CS_HREDRAW | CS_VREDRAW;
RegisterClassEx(&windowclass);
RECT rect = resolution; //Drawing area
AdjustWindowRectEx(&rect, WS_OVERLAPPEDWINDOW, false, WS_EX_OVERLAPPEDWINDOW); //Calculate window Size
HWND windowhandle = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW, L"MainWindow", L"AntSim", WS_OVERLAPPEDWINDOW, 100, 100, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, hInstance, 0);
//=========================================================================================
if (!windowhandle)
{
return -1;
}
graphics = new Graphics();
MSG message;
message.message = WM_NULL;
if (!graphics->Init(windowhandle, resolution.right, resolution.bottom))
{
delete graphics;
return -1;
}
ShowWindow(windowhandle, nCmdShow);
Colony colo = Colony(graphics, 512, 400);
colo.MakeTileMap(1024, 800);
uint8_t frame = 0;
Color col = { 0.0f, 0.0f, 0.0f };
Perlin2D perlin(1024, 800);
perlin.generateNoise(24, 1.4f);
for (uint16_t x = 0; x < 1024; x++)
{
for (uint16_t y = 0; y < 800; y++)
{
col.r = perlin.noise[x + (y * perlin.width)];
graphics->imageBuff.PutPix(x, y, col);
}
}
graphics->refresh();
for (uint16_t x = 0; x < 1024; x++)
{
for (uint16_t y = 0; y < 800; y++)
{
float value = perlin.noise[x + (y * perlin.width)];
if(value > 0.4f)
{
tile temp;
temp = colo.tileMap.ReadMap_WC(x, y);
temp.type = FOOD;
colo.tileMap.WriteToMap_WC(x, y, temp);
}
}
}
uint32_t i = 0;
for (i = 0; i < 50; i++)
{
colo.addAnt();
}
uint32_t temp;
graphics->refresh();
while (!closeWindow)
{
frame++;
if (PeekMessage(&message, windowhandle, 0, 0, PM_REMOVE))
{
DispatchMessage(&message);
}
colo.simulateStep();
temp = colo.Ants.capacity();
if (1)
{
//graphics->Clear();
colo.drawTileMap();
colo.drawAnts();
graphics->refresh();
}
}
delete graphics;
return 0;
}
|
6a8263500f717f512935d14ca3ec904fc45ffec9 | 343eb548ccf1d184720bffac7d857828524226dd | /Others/HackerRank/minimum-abs.cpp | 708874c0f248faf1f3edd212c7a6fd854d7e75cd | [] | no_license | endiliey/competitive-programming | fc6b7d03894d3c0e3d974384c54ad0d38f3a6a9a | 897203fab283e7b5abda3d4809f37f3b5afea0c2 | refs/heads/master | 2021-09-09T11:01:11.679978 | 2018-03-06T05:00:00 | 2018-03-15T11:19:16 | 68,797,153 | 5 | 5 | null | null | null | null | UTF-8 | C++ | false | false | 386 | cpp | minimum-abs.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> v1;
for (int val, i = 0; i != n; ++i)
{
cin >> val;
v1.push_back(val);
}
int diff = INT_MAX;
sort(v1.begin(), v1.end());
for (int i = 0; i != n - 1; ++i)
{
if (abs(v1[i + 1] - v1[i]) < diff)
{
diff = abs(v1[i + 1] - v1[i]);
}
}
cout << diff << endl;
return 0;
}
|
69cde77d822632d627af37021861f99ab87391c7 | b219519f94e6c6782f641a5a9d2dcf22537fac3b | /template1/poj3686_good_2-sat.cpp | 81914bdd2d82c987df8256ec2a43823e1d9ede8f | [] | no_license | liangsheng/ACM | 71a37a85b13aa7680a095cf0710c50acb5457641 | 0e80385b51e622b2b97431ac650b8121ecd56e51 | refs/heads/master | 2023-06-01T06:37:51.727779 | 2023-05-14T03:16:18 | 2023-05-14T03:16:18 | 9,337,661 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,353 | cpp | poj3686_good_2-sat.cpp | #include<iostream>
#include<stack>
#include <cstring>
#include <cstdio>
using namespace std;
const int MAX=2050;
struct node
{
int v,next;
}g[MAX*MAX];
int low[MAX],dfn[MAX],adj[MAX],inStack[MAX],bel[MAX],ind[MAX];
int path[MAX][MAX],col[MAX],cf[MAX],op[MAX],dt[MAX],start[MAX],end[MAX];
int n,e,index,cnt;
stack<int>s;
void add(int u,int v)
{
g[e].v=v; g[e].next=adj[u]; adj[u]=e++;
}
void tarjan(int u)
{
int i,v;
low[u]=dfn[u]=++index;
s.push(u);
inStack[u]=1;
for(i=adj[u];i!=-1;i=g[i].next)
{
v=g[i].v;
if(!dfn[v])
{
tarjan(v);
low[u]=min(low[u],low[v]);
}
else if(inStack[v])
low[u]=min(low[u],dfn[v]);
}
if(dfn[u]==low[u])
{
cnt++;
do
{
v=s.top();
s.pop();
inStack[v]=0;
bel[v]=cnt;
}while(u!=v);
}
}
bool contradict(int i,int j)
{
if(i==op[j]||i==j)
return false;
//if(start[i]<=start[j]&&end[i]<=end[j]&&end[i]>=start[j])
if(start[i]<end[j]&&start[j]<end[i])
return true;
//if(start[j]<=start[i]&&end[j]<=end[i]&&end[j]>=start[i])
//return true;
return false;
}
void topsort()
{
int i,j,u,v;
for(i=1;i<=cnt;i++)
if(ind[i]==0)
s.push(i);
while(!s.empty())
{
u=s.top();
s.pop();
if(!col[u])
{
col[u]=1;
col[cf[u]]=2;
}
for(v=1;v<=cnt;v++)
{
if(u!=v&&path[u][v])
{
if(--ind[v]==0)
s.push(v);
}
}
}
}
void solve()
{
int i,j,h,m;
for(i=0;i<2*n;i++)
{
for(j=0;j<2*n;j++)
{
if(contradict(i,j))
{
add(i,op[j]);
//add(j,op[i]);
}
}
}
for(i=0;i<2*n;i++)
{
if(!dfn[i])
tarjan(i);
}
for(i=0;i<n;i++)
{
if(bel[i]==bel[i+n])
{
puts("NO");
return;
}
cf[bel[i]]=bel[i+n];
cf[bel[i+n]]=bel[i];
}
puts("YES");
memset(path,0,sizeof(path));
memset(ind,0,sizeof(ind));
for(int u=0;u<2*n;u++)
{
for(i=adj[u];i!=-1;i=g[i].next)
{
int v=g[i].v;
if(bel[u]!=bel[v])
path[bel[v]][bel[u]]=1;
}
}
//for (i = 1; i < 3; i++){
// for (j = 1; j < 3; j++)
// cout << path[i][j] << " ";
// cout << endl;}
// system("pause");
//cout<<"yes"<<endl;
for(i=1;i<=cnt;i++)
for(j=1;j<=cnt;j++)
{
if(path[i][j])
ind[j]++;
}
memset(col,0,sizeof(col));
topsort();
//cout<<"yes"<<endl;
//for(i=0;i<2*n;i++)
// cout<<col[bel[i]]<<endl;
for(i=0;i<n;i++)
{
if(col[bel[i]]==1)
j=i;
else
j=i+n;
if((start[j]/60)<10)
printf("0");
printf("%d:",start[j]/60);
if((start[j]%60)<10)
printf("0");
printf("%d ",start[j]%60);
if((end[j]/60)<10)
printf("0");
printf("%d:",end[j]/60);
if((end[j]%60)<10)
printf("0");
printf("%d\n",end[j]%60);
}
}
int main()
{
int i,j,t;
char s[20];
scanf("%d",&n);
for(i=0;i<n;i++)
op[i]=i+n;
for(i=n;i<2*n;i++)
op[i]=i-n;
memset(adj,-1,sizeof(adj));
memset(dfn,0,sizeof(dfn));
e=index=cnt=0;
for(j=0;j<n;j++)
{
scanf("%s",&s);
t=((s[0]-'0')*10+s[1]-'0')*60+(s[3]-'0')*10+s[4]-'0';
start[j]=t;
scanf("%s",&s);
t=((s[0]-'0')*10+s[1]-'0')*60+(s[3]-'0')*10+s[4]-'0';
end[j+n]=t;
scanf("%d",&dt[j]);
end[j]=start[j]+dt[j];
start[j+n]=end[j+n]-dt[j];
//cout<<start[j]<<" "<<end[j]<<endl;
//cout<<start[j+n]<<" "<<end[j+n]<<endl;
}
solve();
system("pause");
return 0;
}
|
fa0812ade01cf8de491fe30e737309f8e9284ca3 | 131416ed956c82f2d527f56f627f90c4555f3f5b | /runtime/nterp_helpers.h | aacd178258e31cd113c2657afa8b709c99139323 | [
"Apache-2.0"
] | permissive | LineageOS/android_art | 5edf0db5fc8861deb699a3b9299172cfef00c58a | 96ac90faab12beb9cf671ae73f85f02225c96039 | refs/heads/lineage-18.0 | 2022-11-19T21:06:09.486629 | 2019-03-01T14:30:59 | 2020-09-15T14:01:35 | 75,633,906 | 21 | 205 | NOASSERTION | 2020-10-07T19:19:48 | 2016-12-05T14:45:12 | C++ | UTF-8 | C++ | false | false | 2,266 | h | nterp_helpers.h | /*
* Copyright (C) 2019 The Android Open Source Project
*
* 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.
*/
#ifndef ART_RUNTIME_NTERP_HELPERS_H_
#define ART_RUNTIME_NTERP_HELPERS_H_
#include "quick/quick_method_frame_info.h"
namespace art {
class ArtMethod;
/**
* The frame size nterp will use for the given method.
*/
size_t NterpGetFrameSize(ArtMethod* method)
REQUIRES_SHARED(Locks::mutator_lock_);
/**
* Returns the QuickMethodFrameInfo of the given frame corresponding to the
* given method.
*/
QuickMethodFrameInfo NterpFrameInfo(ArtMethod** frame)
REQUIRES_SHARED(Locks::mutator_lock_);
/**
* Returns the dex PC at which the given nterp frame is executing.
*/
uint32_t NterpGetDexPC(ArtMethod** frame)
REQUIRES_SHARED(Locks::mutator_lock_);
/**
* Returns the reference array to be used by the GC to visit references in an
* nterp frame.
*/
uintptr_t NterpGetReferenceArray(ArtMethod** frame)
REQUIRES_SHARED(Locks::mutator_lock_);
/**
* Returns the dex register array to be used by the GC to update references in
* an nterp frame.
*/
uintptr_t NterpGetRegistersArray(ArtMethod** frame)
REQUIRES_SHARED(Locks::mutator_lock_);
/**
* Returns the nterp landing pad for catching an exception.
*/
uintptr_t NterpGetCatchHandler();
/**
* Returns the value of dex register number `vreg` in the given frame.
*/
uint32_t NterpGetVReg(ArtMethod** frame, uint16_t vreg)
REQUIRES_SHARED(Locks::mutator_lock_);
/**
* Returns the value of dex register number `vreg` in the given frame if it is a
* reference. Return 0 otehrwise.
*/
uint32_t NterpGetVRegReference(ArtMethod** frame, uint16_t vreg)
REQUIRES_SHARED(Locks::mutator_lock_);
} // namespace art
#endif // ART_RUNTIME_NTERP_HELPERS_H_
|
358c2afe003b0cf854a4eff8531699e3067159d6 | f1ecd29d9d11d540f52943e927586cb9a5dde4a0 | /EGE C/12/12.cpp | 9db78fdf096f9fd4b8ec67465d8e5465844f2aef | [] | no_license | almostinf/EGE-C- | 340fc37ec65b6471367d387e9fa97e22eeaf7402 | 5f2cd8e49ee788b2bfefb2647243474a209651d7 | refs/heads/main | 2023-06-14T00:27:16.211995 | 2021-07-11T15:35:30 | 2021-07-11T15:35:30 | 384,968,254 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 375 | cpp | 12.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
string str(72, '5');
while (str.find("333") != string::npos || str.find("555") != string::npos) {
if (str.find("555") != string::npos) str.replace(str.find("555"), 3, "3");
else str.replace(str.find("333"), 3, "5");
}
cout << str << '\n';
return 0;
} |
6a746bb20999d94a047fb006873195163d819e0c | c058cc5ad487452feec10f824e5289d4b96ea76c | /lab5(4-5)/lab5.4/lab5.4/5.4.cpp | e3e5801c2011c38af1a5b31e6f595e5327483fff | [] | no_license | sergoromanov/LabMosPol | 919dcfa6f2aafdb36849f3a412f018a5e5140fa8 | 443a5c1264c102073c02a8fd3d16a464ad9f9783 | refs/heads/main | 2023-08-12T17:33:02.692323 | 2021-10-05T21:21:20 | 2021-10-05T21:21:20 | 414,145,619 | 0 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 702 | cpp | 5.4.cpp |
#include<iostream>
using namespace std;
int x1, y, x2, y2;
int main()
{
setlocale(LC_ALL, "rus");
int a, b;
cout << "Введите координаты точки 1 :\n";
cin >> x1 >> y;
cout << "Введите координаты точки 2 :\n";
cin >> x2 >> y2;
cout << "Длина прямоугольнка равна " << abs(x2 - x1) << "\n";
cout << "Ширина прямоугольника равна " << abs(y - y2) << "\n";
cout << "Периметр прямоугольника равен " << 2 * (abs(x2 - x1) + abs(y - y2)) << "\n";
cout << "Площадь прямоугольника равна " << abs(x2 - x1) * abs(y - y2) << "\n";
}
|
4efdb48f98add1cd527f562a590b8642612c7914 | eb48184473ffb32a5cca7f64310fa7fd7fc97c12 | /sj_common.cpp | 6d444a31c99634d886a4f6b51007ba822838f07b | [
"MIT"
] | permissive | sj-magic-work-voice/oF_VoiceOfImafe | 74541c3302114e61b0912f52b02f1e6a9c7786c6 | 2fd8df3b708137a7d3b653bf0f1787025ed0aa97 | refs/heads/master | 2020-05-15T00:47:18.604432 | 2019-04-23T01:11:59 | 2019-04-23T01:11:59 | 182,016,713 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,567 | cpp | sj_common.cpp | /************************************************************
************************************************************/
#include "sj_common.h"
/************************************************************
************************************************************/
/********************
********************/
int GPIO_0 = 0;
int GPIO_1 = 0;
/********************
********************/
GUI_GLOBAL* Gui_Global = NULL;
FILE* fp_Log = NULL;
FILE* fp_Log_main = NULL;
FILE* fp_Log_Audio = NULL;
FILE* fp_Log_fft = NULL;
/************************************************************
func
************************************************************/
/******************************
******************************/
double LPF(double LastVal, double CurrentVal, double Alpha_dt, double dt)
{
double Alpha;
if((Alpha_dt <= 0) || (Alpha_dt < dt)) Alpha = 1;
else Alpha = 1/Alpha_dt * dt;
return CurrentVal * Alpha + LastVal * (1 - Alpha);
}
/******************************
******************************/
double LPF(double LastVal, double CurrentVal, double Alpha)
{
if(Alpha < 0) Alpha = 0;
else if(1 < Alpha) Alpha = 1;
return CurrentVal * Alpha + LastVal * (1 - Alpha);
}
/******************************
******************************/
double sj_max(double a, double b)
{
if(a < b) return b;
else return a;
}
/************************************************************
class
************************************************************/
/******************************
******************************/
void GUI_GLOBAL::setup(string GuiName, string FileName, float x, float y)
{
/********************
********************/
gui.setup(GuiName.c_str(), FileName.c_str(), x, y);
/********************
********************/
Group_Sound.setup("Sound");
Group_Sound.add(vol.setup("vol", 0.05, 0, 3.0));
Group_Sound.add(NumHarmony.setup("NumHarmony", 2, 1, 3));
Group_Sound.add(CursorSpeed.setup("CursorSpeed", 80.0, 70.0, 100.0));
Group_Sound.add(d_ROTATION.setup("d_ROTATION", 0.6, 0.0, 2.0));
Group_Sound.add(d_PAUSE.setup("d_PAUSE", 0.1, 0.0, 5.0));
Group_Sound.add(b_HighDown.setup("HighFreq Cut", true));
Group_Sound.add(b_ImageChange.setup("b_ImageChange", true));
Group_Sound.add(b_PALINDROME.setup("b_PALINDROME", true));
gui.add(&Group_Sound);
Group_FFT.setup("fft");
Group_FFT.add(LPFAlpha_dt__FFTGain.setup(">LPF_dt", 0.15, 0, 2.0));
Group_FFT.add(Val_DispMax__FFTGain.setup(">ValDisp FFT", 0.05, 0, 0.1));
gui.add(&Group_FFT);
/********************
********************/
gui.minimizeAll();
}
|
35ee905654a6cca05c5b54495c85005c4776dec2 | eaf3b9e8e3275ab6b1fcc5a044adfad1a8b7fbbc | /include/apu.hpp | cd7acf9a4647bf7ff0c6d36b4cee3f5ea0ed1c65 | [] | no_license | AranGarcia/Nesem | 64e7a40edb791ab8bf218f83c501040c0b8bc84e | 971f8beaaa8a64c93437530b09cf83692849ab76 | refs/heads/master | 2020-04-13T01:08:55.862804 | 2019-04-12T00:25:52 | 2019-04-12T00:25:52 | 162,865,571 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,351 | hpp | apu.hpp | #ifndef NESEM_APU_H
#define NESEM_APU_H
#include <array>
#include <cstdint>
class APU {
public:
uint8_t access_registers(uint16_t addr, uint8_t data = 0);
// The vertical clock signal is the only register which is read from
uint8_t read_mstrctrl() const;
private:
/*
* APU Registers:
* --------------
* Pulse 1: $4000-$4003
* Pulse 2: $4004-$4007
* Triangle: $4008-$400B
* Noise: $400C-$400F
* Delta Modulation: $4010-$4013
*
*/
// Pulse 1
uint8_t pulse1_ctrl;
uint8_t pulse1_ramp_ctrl;
uint8_t pulse1_fine_tune; //Fine tune
uint8_t pulse1_coarse_tune; //Coarse tune
// Pulse 2:
uint8_t pulse2_ctrl;
uint8_t pulse2_ramp_ctrl;
uint8_t pulse2_fine_tune; //Fine tune
uint8_t pulse2_coarse_tune; //Coarse tune
// Triangle: $4008-$400B
uint8_t tri_ctrl1;
uint8_t tri_ctrl2;
uint8_t tri_freq1;
uint8_t tri_freq2;
// Noise
uint8_t noise_ctrl;
// No register in address $400D
uint8_t noise_freq1;
uint8_t noise_freq2;
// Delta Modulation:
uint8_t delta_ctrl;
uint8_t delta_da;
uint8_t delta_addr;
uint8_t delta_data_len;
uint8_t mstrctrl;
private:
// $4015
uint8_t delta_frame_ctr; // $4017 Yes, this is also the same address for the joystick
};
#endif //NESEM_APU_H
|
7e3060055f5c4d81d612b377e360404b0605f2df | 81c66c9c0b78f8e9c698dcbb8507ec2922efc8b7 | /src/domains/cgc/targets/NOWam/NOWam/CGCNOWamSend.cc | fad323f4f4d8e043f6a13c7519baa934a86f79db | [
"MIT-Modern-Variant"
] | permissive | Argonnite/ptolemy | 3394f95d3f58e0170995f926bd69052e6e8909f2 | 581de3a48a9b4229ee8c1948afbf66640568e1e6 | refs/heads/master | 2021-01-13T00:53:43.646959 | 2015-10-21T20:49:36 | 2015-10-21T20:49:36 | 44,703,423 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,877 | cc | CGCNOWamSend.cc | static const char file_id[] = "CGCNOWamSend.pl";
// .cc file generated from CGCNOWamSend.pl by ptlang
/*
Copyright (c) 1995-1997 The Regents of the University of California
All rights reserved.
See the file $PTOLEMY/copyright for copyright notice,
limitation of liability, and disclaimer of warranty provisions.
*/
#ifdef __GNUG__
#pragma implementation
#endif
#include "CGCNOWamSend.h"
const char *star_nm_CGCNOWamSend = "CGCNOWamSend";
const char* CGCNOWamSend :: className() const {return star_nm_CGCNOWamSend;}
ISA_FUNC(CGCNOWamSend,CGCStar);
Block* CGCNOWamSend :: makeNew() const { LOG_NEW; return new CGCNOWamSend;}
CodeBlock CGCNOWamSend :: converttype (
# line 69 "CGCNOWamSend.pl"
"typedef union ints_or_double {\n"
" int asInt[2];\n"
" double asDouble;\n"
"} convert;\n");
CodeBlock CGCNOWamSend :: timeincludes (
# line 75 "CGCNOWamSend.pl"
"#ifdef TIME_INFO1\n"
"#include <sys/time.h>\n"
"#endif\n");
CodeBlock CGCNOWamSend :: replyHandler (
# line 80 "CGCNOWamSend.pl"
"void reply_handler(void *source_token, int d1, int d2, int d3, int d4)\n"
"{\n"
"}\n");
CodeBlock CGCNOWamSend :: errorHandler (
# line 85 "CGCNOWamSend.pl"
"void error_handler(int status, op_t opcode, void *argblock)\n"
"{\n"
" switch (opcode) {\n"
" case EBADARGS:\n"
" fprintf(stderr,\"Bad Args:\");\n"
" fflush(stderr);\n"
" break;\n"
" case EBADENTRY:\n"
" fprintf(stderr,\"Bad Entry:\");\n"
" fflush(stderr);\n"
" break;\n"
" case EBADTAG:\n"
" fprintf(stderr,\"Bad Tag:\");\n"
" fflush(stderr);\n"
" break;\n"
" case EBADHANDLER:\n"
" fprintf(stderr,\"Bad Handler:\");\n"
" fflush(stderr);\n"
" break;\n"
" case EBADSEGOFF:\n"
" fprintf(stderr,\"Bad Seg offset:\");\n"
" fflush(stderr);\n"
" break;\n"
" case EBADLENGTH:\n"
" fprintf(stderr,\"Bad Length:\");\n"
" fflush(stderr);\n"
" break;\n"
" case EBADENDPOINT:\n"
" fprintf(stderr,\"Bad Endpoint:\");\n"
" fflush(stderr);\n"
" break;\n"
" case ECONGESTION:\n"
" fprintf(stderr,\"Congestion:\");\n"
" fflush(stderr);\n"
" break;\n"
" case EUNREACHABLE:\n"
" fprintf(stderr,\"Unreachable:\");\n"
" fflush(stderr);\n"
" break;\n"
" }\n"
"}\n");
CodeBlock CGCNOWamSend :: amdecls (
# line 128 "CGCNOWamSend.pl"
"en_t global;\n"
"eb_t bundle;\n");
CodeBlock CGCNOWamSend :: timedecls (
# line 132 "CGCNOWamSend.pl"
"#ifdef TIME_INFO1\n"
"hrtime_t timeRun;\n"
"hrtime_t beginRun;\n"
"hrtime_t endRun;\n"
"#endif\n");
CodeBlock CGCNOWamSend :: stardecls (
# line 139 "CGCNOWamSend.pl"
"#ifdef TIME_INFO2\n"
"hrtime_t $starSymbol(timeSend);\n"
"hrtime_t $starSymbol(beginSend);\n"
"hrtime_t $starSymbol(endSend);\n"
"#endif\n"
"en_t *$starSymbol(endname);\n"
"ea_t $starSymbol(endpoint);\n"
"int $starSymbol(i);\n");
CodeBlock CGCNOWamSend :: aminit (
# line 149 "CGCNOWamSend.pl"
"AM_Init();\n"
"if (AM_AllocateBundle(AM_PAR, &bundle) != AM_OK) {\n"
" fprintf(stderr, \"error: AM_AllocateBundle failed\\n\");\n"
" exit(1);\n"
"}\n"
"if (AM_SetEventMask(bundle, AM_NOTEMPTY) != AM_OK) {\n"
" fprintf(stderr, \"error: AM_SetEventMask error\\n\");\n"
" exit(1);\n"
"}\n"
"\n");
CodeBlock CGCNOWamSend :: timeinit (
# line 161 "CGCNOWamSend.pl"
"#ifdef TIME_INFO2\n"
"$starSymbol(timeSend) = 0.0;\n"
"#endif\n"
"#ifdef TIME_INFO1\n"
"beginRun = gethrtime();\n"
"#endif\n");
CodeBlock CGCNOWamSend :: starinit (
# line 169 "CGCNOWamSend.pl"
"#ifdef TIME_INFO\n"
"$starSymbol(timeSend) = 0.0;\n"
"#endif\n"
"if (AM_AllocateKnownEndpoint(bundle, &$starSymbol(endpoint), &$starSymbol(endname), HARDPORT + $val(pairNumber)) != AM_OK) {\n"
"\n"
" fprintf(stderr, \"error: AM_AllocateKnownEndpoint failed\\n\");\n"
" exit(1);\n"
"}\n"
" \n"
"if (AM_SetTag($starSymbol(endpoint), 1234) != AM_OK) {\n"
" fprintf(stderr, \"error: AM_SetTag failed\\n\");\n"
" exit(1);\n"
"}\n"
"if (AM_SetHandler($starSymbol(endpoint), 0, error_handler) != AM_OK) {\n"
" fprintf(stderr, \"error: AM_SetHandler failed\\n\");\n"
" exit(1);\n"
"}\n"
"if (AM_SetHandler($starSymbol(endpoint), 1, reply_handler) != AM_OK) {\n"
" fprintf(stderr, \"error: AM_SetHandler failed\\n\");\n"
" exit(1);\n"
"}\n"
"\n"
"for ($starSymbol(i) = 0; $starSymbol(i) < $val(numNodes); $starSymbol(i)++) {\n"
" global.ip_addr = $ref(nodeIPs, $starSymbol(i));\n"
" global.port = HARDPORT + $val(pairNumber);\n"
" if (AM_Map($starSymbol(endpoint), $starSymbol(i), global, 1234) != AM_OK) {\n"
" fprintf(stderr, \"AM_Map error\\n\");\n"
" fflush(stderr);\n"
" exit(-1);\n"
" }\n"
"}\n");
CodeBlock CGCNOWamSend :: block (
# line 234 "CGCNOWamSend.pl"
" int i, pos, check;\n"
" convert myData;\n"
" \n"
"#ifdef TIME_INFO2\n"
" $starSymbol(beginSend) = gethrtime();\n"
"#endif\n"
"\n"
" for (i = 0; i < $val(numData); i++) {\n"
" pos = $val(numData) - 1 + i;\n"
" myData.asDouble = $ref(input,pos);\n"
" check = AM_Request4($starSymbol(endpoint), $val(hostAddr), 2, myData.asInt[0], myData.asInt[1], 0, 0); \n"
" if (check == -1) {\n"
" printf(\"Error in sending data\\n\");\n"
" }\n"
" }\n"
"\n"
"#ifdef TIME_INFO2\n"
" $starSymbol(endSend) = gethrtime();\n"
" $starSymbol(timeSend) += $starSymbol(endSend) - $starSymbol(beginSend);\n"
" printf(\"Cumulative time to send %lld usec\\n\", $starSymbol(timeSend) / 1000);\n"
"#endif\n"
"\n");
CodeBlock CGCNOWamSend :: runtime (
# line 262 "CGCNOWamSend.pl"
"#ifdef TIME_INFO1\n"
"endRun = gethrtime();\n"
"timeRun = endRun - beginRun;\n"
"printf(\"Time to run %lld usec\\n\", timeRun / 1000);\n"
"#endif\n");
CGCNOWamSend::CGCNOWamSend ()
{
setDescriptor("Send star between NOWam processors.");
addPort(input.setPort("input",this,FLOAT));
addState(numData.setState("numData",this,"1","number of tokens to be transferred",
# line 32 "CGCNOWamSend.pl"
A_NONSETTABLE));
addState(nodeIPs.setState("nodeIPs",this,"0 1 2 3","IP addresses of nodes in program.",
# line 39 "CGCNOWamSend.pl"
A_NONSETTABLE));
addState(hostAddr.setState("hostAddr",this,"0","Host virtual node for server",
# line 46 "CGCNOWamSend.pl"
A_NONSETTABLE));
addState(numNodes.setState("numNodes",this,"0","Number of nodes in program.",
# line 53 "CGCNOWamSend.pl"
A_NONSETTABLE));
addState(pairNumber.setState("pairNumber",this,"0","Send Receive pair number for unique IP port.",
# line 60 "CGCNOWamSend.pl"
A_NONSETTABLE));
}
void CGCNOWamSend::wrapup() {
# line 271 "CGCNOWamSend.pl"
addCode(runtime, "mainClose", "runTime");
addCode("AM_Terminate();\n", "mainClose", "amTerminate");
}
void CGCNOWamSend::initCode() {
# line 204 "CGCNOWamSend.pl"
// obtain the hostAddr state from parent MultiTarget.
// Note that this routine should be placed here.
CGCNOWamTarget* t = (CGCNOWamTarget*) cgTarget()->parent();
t->setMachineAddr(this, partner);
hostAddr.initialize();
// code generation.
addCode(converttype, "globalDecls", "convert");
addGlobal("#define HARDPORT 61114\n", "hardPort");
addInclude("<stdio.h>");
addInclude("<stdlib.h>");
addInclude("<thread.h>");
addInclude("<udpam.h>");
addInclude("<am.h>");
addCompileOption(
"-I$PTOLEMY/src/domains/cgc/targets/NOWam/libudpam");
addLinkOption(
"-L$PTOLEMY/lib.$PTARCH -ludpam -lnsl -lsocket -lthread");
addCode(timeincludes, "include", "timeIncludes");
addProcedure(replyHandler, "CGCNOWam_ReplyHandler");
addProcedure(errorHandler, "CGCNOWam_ErrorHandler");
addCode(amdecls, "mainDecls", "amDecls");
addCode(timedecls, "mainDecls", "timeDecls");
addCode(stardecls, "mainDecls");
addCode(timeinit, "mainInit", "timeInit");
addCode(aminit, "mainInit", "amInit");
addCode(starinit, "mainInit");
}
void CGCNOWamSend::setup() {
# line 66 "CGCNOWamSend.pl"
numData = input.numXfer();
}
void CGCNOWamSend::go() {
# line 259 "CGCNOWamSend.pl"
addCode(block);
}
// prototype instance for known block list
static CGCNOWamSend proto;
static RegisterBlock registerBlock(proto,"NOWamSend");
|
f68ef13e436081708fbc4d75aa253c2a55b4de76 | 4f8795395d126c13b06bc3b9c5950a7a39717e79 | /rgb-led.ino | 35091fb4a866c0eaa50ebcee1bfacb0e39054266 | [
"MIT"
] | permissive | ZeDoomFury/rgb-led | 7bae4e980f5f03638b731794d9b6c4d5f8c1a89c | 41ac066024c079c4d2244bc996c48ab041a44e38 | refs/heads/master | 2023-03-21T11:29:08.725162 | 2019-09-23T10:47:05 | 2019-09-23T10:47:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,254 | ino | rgb-led.ino | /*
Code by:
M. Hashir & Wardah Arshad
This is a code that shows mixing of Red, Green and Blue to make different colours using RGB led
Hardware:
- Arduino
- RGB Led
- Resistor
Hold the led in your hand such that the longest pin of RGB LED is second pin from left.
Left most pin is pin 1 and right most pin is pin 4
Connections:
Connect pin 1 (red) of RGB LED to pin 3 of Arduino
Connect pin 2 (VCC) of RGB LED to resistor and connect other end of resistor to pin 5V of Arduino
Connect pin 3 (green) of RGB LED to pin 5 of Arduino
Connect pin 4 (blue) of RGB LED to pin 6 of Arduino
*/
int redpin = 3; //pin 1 of RGB is connected to pin 3 of Arduino
int greenpin = 5; //pin 3 of RGB is connected to pin 5 of Arduino
int bluepin = 6; //pin 4 of RGB is connected to pin 6 of Arduino
//comment this line if not using a Common Anode LED
#define COMMON_ANODE
void setup()
{
pinMode(redpin, OUTPUT); //Donot edit this line
pinMode(greenpin, OUTPUT); //Donot edit this line
pinMode(bluepin, OUTPUT); //Donot edit this line
}
void loop()
{
setColor(255, 0, 0); // red
delay(1000);
setColor(0, 255, 0); // green
delay(1000);
setColor(0, 0, 255); // blue
delay(1000);
setColor(255, 255, 0); // yellow
delay(1000);
setColor(80, 0, 80); // purple
delay(1000);
setColor(0, 255, 255); // aqua
delay(1000);
}
void setColor(int red, int green, int blue) //Donot edit this line
{
#ifdef COMMON_ANODE //Donot edit this line
red = 255 - red; //Donot edit this line
green = 255 - green; //Donot edit this line
blue = 255 - blue; //Donot edit this line
#endif //Donot edit this line
analogWrite(redpin, red); //Donot edit this line
analogWrite(greenpin, green); //Donot edit this line
analogWrite(bluepin, blue); //Donot edit this line
}
|
6e6970d970b530dcf27a5632cd0be843dff44e75 | 5f097a9960eabb0f7360612620fc67f44fa8693e | /libsqaod/cuda/DeviceArray.h | da087dd6dbb0cd9c0042c2f9648ec4a5e194057f | [
"BSD-3-Clause"
] | permissive | shukob/sqaod | db0f384935b2162cec82a820b28b022176369679 | d97c20b201ea167910874a2f13516b06d85c9e77 | refs/heads/master | 2021-09-04T09:14:26.535197 | 2018-01-17T16:21:01 | 2018-01-17T16:21:01 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 583 | h | DeviceArray.h | #ifndef SQAOD_DEVICEARRAY_H__
#define SQAOD_DEVICEARRAY_H__
#include <common/Array.h>
namespace sqaod_cuda {
template<class V>
struct DeviceArrayType {
typedef DeviceArrayType<V> DeviceArray;
DeviceArrayType();
void append(const DeviceArray &dar);
static
void swap(DeviceArray *lhs, DeviceArray *rhs);
// friend
// void merge(DevicePackedBitsArray *lhs, DevicePackedBitsArray *rhs);
V *d_data;
size_t size;
};
typedef DeviceArrayType<sqaod::PackedBits> DevicePackedBitsArray;
typedef DeviceArrayType<char> DeviceBitArray;
}
#endif
|
64368ad129d01434b9e44a6a10cc99b86eefe9c4 | e05b2b1aa3a2d21111d495812a594a650909362f | /src/4-CPUArchitecture/branch_prediction.cpp | 4f2f55058511b13878309bdba467b5faf6194f66 | [
"MIT"
] | permissive | nixiz/advanced_cpp_course | ed0845e322affd292d7a33e46d32e5fd400d313c | acc3cab52cb629ed3eb12cd0fdd9689069e733e7 | refs/heads/master | 2021-11-26T17:41:02.055566 | 2021-10-20T10:16:46 | 2021-10-20T10:16:46 | 145,102,505 | 2 | 1 | MIT | 2021-10-06T20:51:52 | 2018-08-17T09:42:46 | C++ | UTF-8 | C++ | false | false | 3,199 | cpp | branch_prediction.cpp | #include <advanced_cpp_topics.h>
#include <benchmarker.hpp>
#include <iostream>
#include <random>
#include <algorithm>
#include <vector>
#include <chrono>
#include <iterator>
ELEMENT_CODE(CountIfRandom) {
std::vector<int> v(65536);
std::generate(std::begin(v), std::end(v), [] {
return (rand() % 2) ? 1 : -1;
});
auto result = benchmarker::run([&] {
auto count = std::count_if(std::begin(v), std::end(v), [](auto x) {
return x > 0;
});
return count;
});
std::cout << "duration: " << result.first << " msec\n";
std::cout << "result: " << result.second << "\n";
}
ELEMENT_CODE(CountIfSequenced) {
std::vector<int> v(65536);
std::generate(std::begin(v), std::end(v), [n = 0]() mutable {
return (++n % 2) ? 1 : -1;
});
auto result = benchmarker::run([&] {
auto count = std::count_if(std::begin(v), std::end(v), [](auto x) {
return x > 0;
});
return count;
});
std::cout << "duration: " << result.first << " msec\n";
std::cout << "result: " << result.second << "\n";
}
ELEMENT_CODE(CountIfSorted) {
std::vector<int> v(65536);
std::generate(std::begin(v), std::end(v), [] {
return (rand() % 2) ? 1 : -1;
});
std::sort(v.begin(), v.end());
auto result = benchmarker::run([&] {
auto count = std::count_if(std::begin(v), std::end(v), [](auto x) {
return x > 0;
});
return count;
});
std::cout << "duration: " << result.first << " msec\n";
std::cout << "result: " << result.second << "\n";
}
namespace branch_prediction
{
struct price
{
virtual ~price() {}
virtual float getPrice() const noexcept { return 1.0f; }
};
struct cheap : public price
{
float getPrice() const noexcept override { return 2.0f; }
};
struct expensive : public price
{
float getPrice() const noexcept override { return 3.14159f; }
};
} // namespace branch_prediction
ELEMENT_CODE(VirtualCallsSequenced) {
using namespace branch_prediction;
std::vector<price*> pricelist;
std::fill_n(std::back_inserter(pricelist), 10000, new price);
std::fill_n(std::back_inserter(pricelist), 10000, new cheap);
std::fill_n(std::back_inserter(pricelist), 10000, new expensive);
auto result = benchmarker::run([&] {
float sum = 0;
for (auto *p : pricelist)
{
sum += p->getPrice();
}
return sum;
});
std::cout << "duration: " << result.first << " msec\n"; // return in millisecond resolution
std::cout << "sum: " << result.second << "\n";
}
ELEMENT_CODE(VirtualCallsShuffled) {
using namespace branch_prediction;
std::random_device rd;
std::mt19937 g{ rd() };
std::vector<price*> pricelist;
std::fill_n(std::back_inserter(pricelist), 10000, new price);
std::fill_n(std::back_inserter(pricelist), 10000, new cheap);
std::fill_n(std::back_inserter(pricelist), 10000, new expensive);
std::shuffle(pricelist.begin(), pricelist.end(), g);
auto result = benchmarker::run([&] {
float sum = 0;
for (auto *p : pricelist)
{
sum += p->getPrice();
}
return sum;
});
std::cout << "duration: " << result.first << " msec\n"; // return in millisecond resolution
std::cout << "sum: " << result.second << "\n";
}
|
ad2389947d9f8f55ba3458caf23fba9b2bdc5894 | 9c3a323aa89ab82c51febef6940a58645109da3c | /Copper/src/utilList.h | 6d5faf8c96cc4c63996244d1380c741759c47bfd | [] | no_license | chronologicaldot/CopperLang | 16229dcce1b8d4cc9071f40913686ec48fcb1e69 | eba2a5496b144ecb73408d414fb4833c0d6b5e25 | refs/heads/master | 2023-05-11T23:36:23.079843 | 2023-05-04T20:28:46 | 2023-05-04T20:28:46 | 87,672,239 | 29 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,705 | h | utilList.h | // Copyright 2015 Nicolaus Anderson
// Note: Some of the function names in here have been changed from the original.
#ifndef UTILITY_LIST
#define UTILITY_LIST
namespace util {
class NodeCopyException {};
class IndexOutOfBoundsException {};
class NullListNodeException {};
class BadIteratorException {}; // Node could be null
class BadListInitException {};
// For debug
class InvalidListException {};
typedef unsigned long uint;
template<typename T>
class List
{
public:
class Node
{
friend List;
Node* prev;
Node* next;
T item;
public:
Node( const T& pItem )
: prev(0)
, next(0)
, item( pItem )
{}
Node( const Node& pOther )
{
throw NodeCopyException();
}
T& getItem()
{
return item;
}
const T& getConstItem() const
{
return item;
}
void setItem( const T& pItem )
{
item = pItem;
}
void insertBefore( const T& pItem )
{
Node* n = prev;
prev = new Node(pItem);
prev->next = this;
if ( n ) {
n->next = prev;
prev->prev = n;
}
}
void insertAfter( const T& pItem )
{
Node* n = next;
next = new Node(pItem);
next->prev = this;
if ( n ) {
n->prev = next;
next->next = n;
}
}
void delink()
{
if ( prev )
{
if ( next )
{
prev->next = next;
next->prev = prev;
} else {
prev->next = 0;
}
} else if ( next )
{
next->prev = 0;
}
prev = 0;
next = 0;
}
void destroy()
{
delink();
delete this;
}
};
class Iter
{
friend List;
List* list;
Node* node;
public:
Iter( List& pList )
: list( &pList )
, node( pList.head )
{}
Iter( const Iter& pOther )
: list( pOther.list )
, node( pOther.node )
{}
//T& curr() // current node
T& operator*()
{
return node->getItem();
}
// For explicitness
T& getItem() {
return node->getItem();
}
T* operator->()
{
return &node->getItem();
}
void setItem( T pItem )
{
if ( node )
node->setItem( pItem );
}
bool operator==( const Iter& pOther ) const
{
return (list == pOther.list) && (node == pOther.node);
}
Iter& operator=( Iter pOther )
{
list = pOther.list;
node = pOther.node;
return *this;
}
// REQUIRED
void set( Iter pOther )
{
list = pOther.list;
node = pOther.node;
}
bool prev() // previous node
//bool operator--() // <- was this
{
//if ( start() ) return false;
if ( !node || !(node->prev) ) return false;
node = node->prev;
return true; // there may be more nodes
}
bool next() // next node
//bool operator++() // <- was this
{
if ( !node || !(node->next) ) return false;
node = node->next;
return true; // there may be more nodes
}
T& peek() // UNSAFE
{
return node->next->getItem();
}
void reset()
{
node = list->head;
}
void makeLast()
{
node = list->tail;
}
bool atStart() const
{
if ( ! list->has() ) return true;
return node == list->head;
}
bool atEnd() const
{
if ( ! list->has() ) return true;
return node == list->tail;
}
bool has() const
{
return list->has();
}
void insertBefore( const T& item )
{
if ( ! list->has() )
{
list->push_back( item );
node = list->head;
return;
}
Node* n = node->prev;
node->prev = new Node( item );
node->prev->next = node;
// Link to pre-previous node
if ( n )
{
n->next = node->prev;
node->prev->prev = n;
}
if ( node == list->head )
{
list->head = node->prev;
}
list->count++;
}
void insertAfter( const T& item )
{
if ( ! list->has() )
{
list->push_back( item );
node = list->head;
return;
}
Node* n = node->next;
node->next = new Node( item );
node->next->prev = node;
// Link to previous next node
if ( n )
{
node->next->next = n;
n->prev = node->next;
}
if ( node == list->tail )
{
list->tail = node->next;
}
list->count++;
}
// Invalidates the node
void destroy() {
if ( node == list->head )
list->head = node->next;
if ( node == list->tail )
list->tail = node->prev;
node->destroy();
node = 0;
}
};
class ConstIter
{
friend List;
const List* list;
const Node* node;
public:
// Bad setup? I don't know how to save a const list
ConstIter( const List& pList )
: list( &pList )
, node( pList.head )
{}
ConstIter( const ConstIter& pOther )
: list( pOther.list )
, node( pOther.node )
{}
const T& operator*() const
{
return node->getConstItem();
}
// For explicitness
const T& getItem() {
return node->getConstItem();
}
ConstIter& operator=( ConstIter pOther )
{
list = pOther.list;
node = pOther.node;
return *this;
}
bool operator==( const Iter& pOther ) const
{
return (list == pOther.list) && (node == pOther.node);
}
bool prev()
//bool operator--() // <- was
{
if ( !node || !(node->prev) ) return false;
node = node->prev;
return true; // there may be more nodes
}
bool next()
//bool operator++() // <- was
{
if ( !node || !(node->next) ) return false;
node = node->next;
return true; // there may be more nodes
}
void reset()
{
node = list->head;
}
void makeLast()
{
node = list->tail;
}
bool atStart() const
{
if ( ! list->has() ) return true;
return node == list->head;
}
bool atEnd() const
{
if ( ! list->has() ) return true;
return node == list->tail;
}
bool has() const
{
return list->has();
}
};
protected:
Node* head;
Node* tail;
uint count;
public:
friend Iter;
List()
: head(0)
, tail(0)
, count(0)
{}
List( const List& pOther )
: head(0)
, tail(0)
, count(0)
{
ConstIter other( pOther );
if ( other.has() )
do {
push_back( *other );
} while ( other.next() );
}
~List()
{
clear();
}
//! Optimized index search
T& operator[] ( uint pIndex )
{
// should throw exceptions when no items
Node* n = head;
uint i=0;
if ( pIndex >= count )
throw IndexOutOfBoundsException();
if ( pIndex > count / 2 ) // index is over halfway, so start from back instead
{
n = tail;
i = count - 1;
for ( ; i > pIndex && i > 0; i-- )
{
n = n->prev;
}
} else {
for ( ; i < pIndex && i < count; i++ )
{
n = n->next;
}
}
return n->getItem();
}
//! Optimized index search
const T& operator[] ( uint pIndex ) const
{
// should throw exceptions when no items
const Node* n = head;
uint i=0;
if ( pIndex >= count )
throw IndexOutOfBoundsException();
if ( pIndex > count / 2 ) // index is over halfway, so start from back instead
{
n = tail;
i = count - 1;
for ( ; i > pIndex && i > 0; i-- )
{
n = n->prev;
}
} else {
for ( ; i < pIndex && i < count; i++ )
{
n = n->next;
}
}
return n->getConstItem();
}
T& getFromBack( uint pReverseIndex )
{
// should throw exceptions when no items
Node* n = tail;
uint i=0;
if ( pReverseIndex >= count )
throw IndexOutOfBoundsException();
if ( !tail )
throw NullListNodeException();
uint index = count - 1 - (pReverseIndex >= count? count-1 : pReverseIndex);
i = count - 1;
for ( ; i > index && i > 0; i-- )
{
n = n->prev;
}
return n->getItem();
}
T& getFirst() {
if ( !head )
throw NullListNodeException();
return head->getItem();
}
T& getLast() {
if ( !tail )
throw NullListNodeException();
return tail->getItem();
}
const T& getConstFirst() const {
if ( !head )
throw NullListNodeException();
return head->getConstItem();
}
List& operator= ( const List& pOther )
{
clear();
ConstIter i = pOther.constStart();
if ( i.has() )
do {
push_back(*i);
} while ( i.next() );
return *this;
}
uint size() const
{
return count;
}
bool has() const
{
return count >= 1;
}
void clear()
{
if ( count == 0 ) return;
Node* n;
while ( tail )
{
n = tail->prev;
delete tail;
tail = n;
}
head = 0; // tail should be 0 already
count = 0;
}
void remove( const uint pIndex )
{
if ( count == 0 ) return;
Node* n = head;
Node* n2 = 0;
for ( uint i = 0; i < pIndex; i++ )
{
if ( i == count - 1 )
return;
n = n->next;
}
if ( n == head )
{
if ( head != tail )
{
head = head->next;
} else {
head = 0;
tail = 0;
}
}
n->destroy();
count--;
}
// Removes all nodes PRIOR to the given iterator
void removeUpTo( const Iter& stopIter )
{
if ( stopIter.list != this )
throw BadIteratorException();
while ( stopIter.node != head )
pop_front();
}
void push_back( const T& pItem )
{
if ( !tail )
{
if ( head )
throw BadListInitException();
tail = new Node( pItem );
head = tail;
} else {
tail->insertAfter( pItem );
tail = tail->next;
}
count++;
}
void push_front( const T& pItem )
{
if ( !head )
{
if ( tail )
throw BadListInitException();
head = new Node( pItem );
tail = head;
} else {
head->insertBefore( pItem );
head = head->prev;
}
count++;
}
void pop()
{
if ( count == 0 )
return;
Node* n = tail->prev;
if ( head == tail )
head = n;
tail->destroy();
tail = n; // Could be 0
count--;
}
void pop_front()
{
if ( count == 0 )
return;
Node* n = head->next;
if ( head == tail )
tail = n;
head->destroy();
head = n; // Could be 0
count--;
}
void append( const List& pOther )
{
ConstIter other( pOther );
if ( !other.has() ) return;
do {
push_back( *other );
} while ( other.next() );
}
Iter start()
{
return Iter( *this );
}
ConstIter constStart() const
{
return ConstIter( *this );
}
Iter end() {
Iter i(*this);
i.makeLast();
return i;
}
// Primarily for debug stack-trace
uint indexOf( const Iter& pIter )
{
if ( ! pIter.list->has() )
return 0;
if ( pIter.list != this )
throw BadIteratorException();
uint i=0;
ConstIter it = constStart();
if ( it.has() )
do {
if ( it == pIter )
return i;
++i;
} while ( it.next() );
throw BadIteratorException();
//return count-1;
}
void validate() {
if ( !head && !tail )
return;
if ( head && !tail )
throw InvalidListException();
if ( tail && !head )
throw InvalidListException();
if ( head->prev )
throw InvalidListException();
if ( tail->next )
throw InvalidListException();
if ( head == tail ) {
return;
}
Node* n = head;
while ( n != tail ) {
if ( !( n->next ) )
throw InvalidListException();
n = n->next;
}
n = tail;
while ( n != head ) {
if ( !( n->prev ) )
throw InvalidListException();
n = n->prev;
}
}
};
}
#endif
|
6235eb63211549a8f44c2c4e5b1c874c07c4a792 | 1f26962debe644c50c4f04a2f6deb58973aa7df4 | /mainwindow.cpp | 361ca3a527c01c027f56d2e26482f5288141e5cb | [
"MIT"
] | permissive | lanser-z/qmultisel | 2fe1510f99b2dead5c5f96ca1cc30cebba9c5ee9 | 24bfcf7a3668bcb2b40302eba25a484e4292ba60 | refs/heads/master | 2020-06-20T00:37:13.090714 | 2019-07-15T10:46:09 | 2019-07-15T10:46:09 | 196,930,662 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,543 | cpp | mainwindow.cpp | #include "mainwindow.h"
#include <QVBoxLayout>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent), m_rangeTable(this), m_addButton("+", this), m_subButton("-", this)
{
setMinimumSize(800, 600);
setWindowTitle("Merge multiple videos");
m_addButton.move(0, -2);
m_subButton.move(50, -2);
m_addButton.setChecked(true);
connect(&m_addButton, &QRadioButton::pressed, [this]{m_rangeTable.SetSelectionMode(true);} );
connect(&m_subButton, &QRadioButton::pressed, [this]{m_rangeTable.SetSelectionMode(false);} );
}
MainWindow::~MainWindow()
{
}
void MainWindow::SetupLayout()
{
// 设置时间轴
QStringList timeline;
timeline << "00:00" << "01:00" << "02:00" << "03:00" << "04:00" << "05:00" << "06:00" << "07:00" << "08:00" << "09:00" << "10:00";
timeline << "11:00" << "12:00" << "13:00" << "14:00" << "15:00" << "16:00" << "17:00" << "18:00" << "19:00" << "20:00";
m_rangeTable.SetHeader(timeline, 100); // 每列宽100
// 设置视频名
QStringList videos;
videos << "camera 1" << "camera 2" << "camera 3" << "camera 4" << "camera 5" << "camera 6" << "camera 7" << "camera 8" << "camera 9" << "camera 10";
m_rangeTable.SetRows(videos, 100); // 每行高100
// 创建布局并映射到时间范围
m_rangeTable.SetupLayout(timeline.size()*60); // 每列1min
// 添加表格数据
m_rangeTable.AddCellData(0, 0, QImage(":/demo/1x1.png"));
m_rangeTable.AddCellData(1, 1, QImage(":/demo/2x2.png"));
setCentralWidget(&m_rangeTable);
}
|
6905962059947ce0c503dd81b690119c9ce2152c | 189f52bf5454e724d5acc97a2fa000ea54d0e102 | /ras/fluidisedBed/1.54/nut.particles | 5b64a5b616b469e1bd2055487993cae8b4b5ba5c | [] | no_license | pyotr777/openfoam_samples | 5399721dd2ef57545ffce68215d09c49ebfe749d | 79c70ac5795decff086dd16637d2d063fde6ed0d | refs/heads/master | 2021-01-12T16:52:18.126648 | 2016-11-05T08:30:29 | 2016-11-05T08:30:29 | 71,456,654 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 76,039 | particles | nut.particles | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1606+ |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "1.54";
object nut.particles;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField nonuniform List<scalar>
6000
(
1.24367e-05
9.59249e-06
9.31424e-06
9.17961e-06
9.44753e-06
8.74594e-06
8.32586e-06
1.05057e-05
1.37728e-05
1.51975e-05
1.53017e-05
1.49835e-05
1.51956e-05
1.61907e-05
1.677e-05
1.6538e-05
1.50772e-05
1.38566e-05
1.34996e-05
1.2243e-05
9.29612e-06
8.37024e-06
8.61028e-06
9.10242e-06
8.92772e-06
8.94947e-06
9.22926e-06
9.45268e-06
9.73134e-06
1.28798e-05
6.64698e-06
6.31781e-06
5.67889e-06
4.63805e-06
3.75479e-06
3.64897e-06
3.86592e-06
4.03151e-06
4.11498e-06
4.21567e-06
4.45965e-06
4.63266e-06
4.92084e-06
5.30926e-06
5.14161e-06
5.1602e-06
5.44157e-06
5.15614e-06
4.7949e-06
4.45641e-06
4.41329e-06
4.16481e-06
3.82186e-06
4.48444e-06
5.4205e-06
6.45512e-06
7.38178e-06
7.6769e-06
7.69762e-06
8.73322e-06
1.2216e-05
1.3295e-05
1.26139e-05
1.0378e-05
6.91609e-06
4.86623e-06
3.95285e-06
3.81625e-06
3.90652e-06
4.12158e-06
4.57026e-06
4.72302e-06
4.89001e-06
3.93991e-06
3.62016e-06
3.70558e-06
4.65633e-06
5.34051e-06
5.19299e-06
4.6585e-06
4.34695e-06
4.99959e-06
7.50713e-06
1.07844e-05
1.41007e-05
1.56858e-05
1.67262e-05
1.46762e-05
1.06907e-05
1.13358e-05
1.00883e-05
9.78794e-06
1.29379e-05
1.65629e-05
1.43026e-05
8.00572e-06
4.78804e-06
3.79359e-06
3.63579e-06
3.7215e-06
3.93224e-06
4.2695e-06
3.96155e-06
3.39856e-06
3.38012e-06
3.39348e-06
3.49054e-06
4.77859e-06
4.7658e-06
4.19199e-06
4.06577e-06
5.54425e-06
1.25636e-05
1.54561e-05
1.61917e-05
1.37678e-05
9.96336e-06
7.25794e-06
5.03678e-06
5.66637e-06
5.41934e-06
4.50677e-06
6.05603e-06
1.08268e-05
4.54927e-05
9.61777e-05
1.05628e-05
5.24498e-06
4.12891e-06
3.74017e-06
3.65382e-06
3.71362e-06
3.23905e-06
3.26407e-06
3.26704e-06
3.28233e-06
3.29419e-06
3.82374e-06
4.25901e-06
4.27638e-06
4.70062e-06
7.1806e-06
1.62577e-05
1.51573e-05
8.61116e-06
6.2672e-06
4.454e-06
3.81688e-06
3.86605e-06
3.93461e-06
3.50717e-06
3.536e-06
3.58131e-06
4.01017e-06
9.60504e-06
9.8601e-05
9.46839e-05
8.80571e-06
5.94371e-06
4.72902e-06
4.42469e-06
4.18463e-06
3.22253e-06
3.09562e-06
3.12565e-06
3.1659e-06
3.20817e-06
3.55702e-06
4.30805e-06
5.81072e-06
7.7144e-06
1.12249e-05
1.63015e-05
8.13401e-06
4.47183e-06
3.72696e-06
3.4833e-06
3.52013e-06
3.53337e-06
3.64453e-06
3.23486e-06
3.25279e-06
3.29606e-06
3.36032e-06
3.60574e-06
1.14098e-05
9.40477e-05
1.30124e-05
9.50973e-06
7.79458e-06
6.77314e-06
5.54753e-06
3.86129e-06
3.26587e-06
3.21594e-06
3.23052e-06
3.35646e-06
4.01141e-06
5.88941e-06
9.96653e-06
2.60966e-05
0.000204014
9.52396e-05
9.66183e-06
5.56134e-06
4.14105e-06
3.7907e-06
3.35428e-06
3.3656e-06
3.47559e-06
3.01284e-06
3.03743e-06
3.11315e-06
3.23104e-06
3.34605e-06
5.58434e-06
9.33946e-05
0.000133862
2.68409e-05
1.53584e-05
1.17626e-05
9.09827e-06
6.0235e-06
4.53292e-06
4.22211e-06
4.26034e-06
4.62494e-06
5.82889e-06
9.75512e-06
8.34271e-05
0.000521251
0.000959557
0.000972535
1.74691e-05
8.56976e-06
6.32676e-06
5.74725e-06
4.40039e-06
3.49139e-06
3.54149e-06
3.6955e-06
3.63182e-06
3.81065e-06
3.9253e-06
4.03964e-06
6.61801e-06
0.000420965
0.00182828
0.000717405
0.000766036
0.000462432
0.000100519
1.15815e-05
8.44351e-06
7.66263e-06
7.87676e-06
8.55152e-06
1.07134e-05
2.66829e-05
0.000438154
0.000655149
0.000942187
0.000975007
2.28662e-05
1.15189e-05
1.01693e-05
9.91646e-06
8.38387e-06
5.62764e-06
4.93599e-06
7.3273e-06
7.27533e-06
7.788e-06
7.76859e-06
7.8369e-06
1.17162e-05
0.00225001
0.00224038
0.0022551
0.00206856
0.00170346
0.00139889
0.000498048
4.66911e-05
1.60646e-05
1.77949e-05
2.8112e-05
0.000126859
0.000518888
0.000645215
0.000629718
0.000913144
2.88769e-05
9.77165e-06
9.10851e-06
1.13384e-05
1.3092e-05
1.37007e-05
1.17582e-05
8.56832e-06
1.5259e-05
1.62852e-05
1.6352e-05
1.63328e-05
1.39859e-05
1.6462e-05
0.00223527
0.00226772
0.0022357
0.00222251
0.00207849
0.0020456
0.00175293
0.00116595
0.000862513
0.00112426
0.00149974
0.00151079
0.00151432
0.00152118
0.000629127
2.15285e-05
5.50635e-06
2.64901e-06
4.01748e-06
6.84503e-06
8.25602e-06
1.23451e-05
1.57801e-05
1.35721e-05
1.75017e-05
1.36203e-05
1.7139e-05
1.47554e-05
9.5777e-06
9.87395e-06
1.81862e-05
0.0022281
0.00225738
0.00223315
0.00224596
0.00222884
0.00223653
0.00222182
0.00222152
0.000491209
6.60934e-05
5.20823e-05
3.75558e-05
2.68109e-05
1.06458e-05
2.74561e-06
1.31729e-06
1.30077e-06
2.10449e-06
3.86791e-06
4.62517e-06
5.38015e-06
1.04069e-05
0.000157638
1.28276e-05
6.91149e-06
8.2861e-06
7.66127e-06
4.24557e-06
3.47978e-06
4.54764e-06
1.02483e-05
2.06859e-05
0.000336111
0.00222955
0.00223858
0.00221276
3.65214e-05
1.83332e-05
8.26743e-06
5.19715e-06
4.67381e-06
4.24748e-06
2.55301e-06
1.23925e-06
9.19475e-07
8.69259e-07
9.81643e-07
1.70601e-06
3.7351e-06
4.16894e-06
4.28716e-06
4.62755e-06
1.85619e-05
7.60857e-06
5.00978e-06
4.89962e-06
4.89433e-06
2.68839e-06
1.58765e-06
1.4215e-06
1.43772e-06
2.63055e-06
6.163e-06
1.05153e-05
1.23416e-05
8.13969e-06
3.90723e-06
1.85549e-06
1.14325e-06
8.76616e-07
7.80028e-07
7.43492e-07
7.1722e-07
7.32292e-07
7.88709e-07
7.97189e-07
8.52615e-07
1.56394e-06
4.46791e-06
4.36918e-06
3.915e-06
4.00447e-06
6.84319e-06
6.24293e-06
4.46353e-06
4.25347e-06
8.00187e-06
2.48459e-06
1.07907e-06
9.15554e-07
7.67394e-07
9.36165e-07
1.43579e-06
2.10199e-06
2.40559e-06
2.04013e-06
1.556e-06
1.1448e-06
9.1323e-07
7.49011e-07
6.50203e-07
6.24639e-07
6.63523e-07
7.14179e-07
7.43925e-07
7.37547e-07
8.65266e-07
1.73804e-06
4.27699e-06
4.65782e-06
3.67341e-06
3.75776e-06
4.82709e-06
6.47722e-06
4.25389e-06
4.03942e-06
1.0053e-05
3.14593e-06
1.00275e-06
8.57575e-07
7.70762e-07
8.12681e-07
1.18063e-06
1.78475e-06
2.20963e-06
2.24983e-06
1.96597e-06
1.57916e-06
1.25733e-06
1.02179e-06
8.44755e-07
7.57174e-07
7.36769e-07
7.58656e-07
7.40056e-07
7.62421e-07
1.1691e-06
2.54977e-06
4.40188e-06
5.31514e-06
4.70888e-06
4.25025e-06
5.5436e-06
6.9397e-06
3.95425e-06
3.8668e-06
7.13027e-06
4.72948e-06
1.06913e-06
8.68795e-07
8.16369e-07
7.9908e-07
1.11881e-06
1.74637e-06
2.47885e-06
2.92456e-06
2.91712e-06
2.73187e-06
2.41453e-06
1.90947e-06
1.39906e-06
1.07382e-06
9.3117e-07
8.69758e-07
8.28593e-07
9.49794e-07
1.95876e-06
4.28576e-06
6.91503e-06
7.90369e-06
7.74312e-06
7.22866e-06
8.56743e-06
7.74554e-06
4.36768e-06
3.96424e-06
4.90247e-06
7.101e-06
1.10378e-06
8.54659e-07
8.27985e-07
7.84048e-07
1.08362e-06
1.79968e-06
2.66994e-06
3.60414e-06
4.35504e-06
4.53077e-06
4.36619e-06
3.59375e-06
2.58298e-06
1.77582e-06
1.21457e-06
1.03626e-06
1.07939e-06
1.7118e-06
4.0641e-06
8.88536e-06
4.43181e-05
0.000143926
0.000184168
0.000139692
0.000295535
9.98121e-06
5.93118e-06
5.27328e-06
4.95863e-06
8.64454e-06
1.51728e-06
8.43075e-07
8.26735e-07
7.71567e-07
1.08874e-06
2.21464e-06
3.20557e-06
4.58123e-06
6.13381e-06
7.24764e-06
7.68872e-06
6.9827e-06
5.1209e-06
3.20686e-06
1.98312e-06
1.41354e-06
1.89905e-06
4.39199e-06
1.04802e-05
0.000474911
0.00179067
0.00292797
0.00368919
0.00385419
0.00435251
0.000427266
1.03051e-05
9.22703e-06
7.84579e-06
9.48243e-06
3.17163e-06
1.00991e-06
8.9468e-07
8.55446e-07
1.38721e-06
3.60313e-06
5.14052e-06
7.26611e-06
9.88409e-06
1.46497e-05
2.19995e-05
1.41699e-05
1.02389e-05
6.80091e-06
3.98566e-06
2.86499e-06
4.96013e-06
1.18235e-05
0.000775152
0.00293948
0.0046416
0.00557622
0.0055805
0.00557846
0.00557942
0.00259778
0.00128993
0.000759543
0.00033339
0.000117289
9.05341e-06
2.25653e-06
1.43206e-06
1.3719e-06
2.71761e-06
8.33702e-06
1.13002e-05
0.000206294
0.000957083
0.00127447
0.00102759
0.00063695
0.000220884
1.33953e-05
8.71591e-06
7.93356e-06
1.30295e-05
0.000551836
0.00253007
0.0038595
0.00546435
0.00558384
0.00558084
0.00548127
0.00557677
0.00263285
0.0026334
0.00262706
0.0026228
0.00261332
0.000307863
1.07383e-05
5.12231e-06
4.54615e-06
8.4636e-06
0.00037805
0.00364451
0.00538934
0.00541113
0.00540203
0.00438211
0.00309757
0.00178461
0.000303202
1.59107e-05
2.17781e-05
0.000613593
0.00200416
0.00235555
0.00331616
0.004654
0.00531678
0.00462086
0.00254312
0.00284777
0.00262951
0.00261477
3.10505e-05
2.46276e-05
2.47991e-05
2.39994e-05
2.08796e-05
1.48196e-05
1.4924e-05
2.42029e-05
0.00142985
0.00536882
0.0054089
0.00541505
0.00542319
0.00541385
0.00541915
0.00489881
0.00200883
0.00036108
0.000966927
0.00200064
0.00200033
0.00168013
0.000382252
3.96351e-05
2.43059e-05
1.80028e-05
2.25715e-05
2.15492e-05
3.08527e-05
1.11158e-05
3.01074e-06
2.5002e-06
2.91849e-06
3.32746e-06
6.30042e-06
7.34392e-06
9.93597e-06
1.18371e-05
1.79037e-05
3.47319e-05
0.000318143
0.00536808
0.00541204
0.00542722
0.00541839
0.00542232
0.00492274
0.0016793
0.000850116
2.94442e-05
1.49971e-05
9.60414e-06
6.5419e-06
4.07908e-06
2.79311e-06
2.38081e-06
2.75447e-06
3.74239e-06
5.91638e-06
1.50399e-06
1.04879e-06
1.0933e-06
1.14146e-06
1.30322e-06
1.75881e-06
2.21989e-06
2.67674e-06
2.55807e-06
2.38217e-06
3.51168e-06
7.86505e-06
2.93054e-05
0.001658
0.00537982
0.00541533
0.00541313
0.00472422
0.00117618
1.65893e-05
3.38537e-06
2.0004e-06
1.65809e-06
1.57048e-06
1.48311e-06
1.42137e-06
1.31308e-06
1.19513e-06
1.82356e-06
2.76277e-06
1.04839e-06
9.86198e-07
1.03533e-06
1.06515e-06
1.12576e-06
1.21287e-06
1.32889e-06
1.39614e-06
1.39017e-06
1.40194e-06
1.49444e-06
1.863e-06
3.29603e-06
1.08874e-05
2.85008e-05
0.000464073
0.00336696
0.00400429
2.63341e-05
3.17005e-06
1.54193e-06
1.50863e-06
1.48997e-06
1.55799e-06
1.74361e-06
1.96712e-06
1.97636e-06
1.83413e-06
2.67347e-06
3.14691e-06
1.11038e-06
9.86765e-07
9.86483e-07
1.04696e-06
1.11651e-06
1.17373e-06
1.23225e-06
1.26185e-06
1.25831e-06
1.32346e-06
1.51832e-06
1.73274e-06
1.98022e-06
2.40548e-06
4.6324e-06
8.12754e-06
1.44992e-05
2.34098e-05
6.15363e-06
1.90814e-06
1.62785e-06
1.61362e-06
1.64976e-06
1.80956e-06
2.17692e-06
2.73606e-06
3.27856e-06
3.32219e-06
4.90072e-06
3.38259e-06
1.26302e-06
1.03755e-06
1.0414e-06
1.08132e-06
1.10699e-06
1.16392e-06
1.2375e-06
1.27208e-06
1.29465e-06
1.40135e-06
1.7441e-06
2.1327e-06
2.15784e-06
1.82125e-06
1.73775e-06
1.9879e-06
2.69842e-06
5.06165e-06
3.37876e-06
2.27658e-06
1.84992e-06
1.79102e-06
1.83648e-06
1.99215e-06
2.34224e-06
3.01889e-06
4.23777e-06
5.10009e-06
8.46567e-06
3.80826e-06
1.43421e-06
1.21181e-06
1.12833e-06
1.13637e-06
1.1887e-06
1.27554e-06
1.36602e-06
1.43631e-06
1.46764e-06
1.74408e-06
2.40359e-06
2.92969e-06
2.50855e-06
1.63544e-06
1.27013e-06
1.19849e-06
1.15924e-06
2.78685e-06
3.78487e-06
2.96944e-06
2.16216e-06
1.91509e-06
1.92526e-06
2.02791e-06
2.2986e-06
2.85029e-06
4.42197e-06
6.21368e-06
1.27256e-05
4.3672e-06
1.69573e-06
1.47495e-06
1.33281e-06
1.3286e-06
1.38126e-06
1.46636e-06
1.54257e-06
1.60967e-06
1.72072e-06
2.27466e-06
3.50071e-06
3.92073e-06
2.58032e-06
1.45292e-06
1.17367e-06
1.12042e-06
1.05857e-06
1.56993e-06
3.97009e-06
3.88974e-06
2.64028e-06
2.06719e-06
1.9786e-06
2.00463e-06
2.17562e-06
2.44643e-06
3.49936e-06
5.45299e-06
1.56853e-05
4.82086e-06
2.04291e-06
1.81791e-06
1.64777e-06
1.62575e-06
1.65635e-06
1.77673e-06
1.89743e-06
1.97898e-06
2.21559e-06
3.2127e-06
5.24316e-06
4.64045e-06
2.2155e-06
1.32322e-06
1.2232e-06
1.1534e-06
1.07948e-06
1.16355e-06
3.75259e-06
4.49571e-06
3.38775e-06
2.41678e-06
2.07309e-06
1.99621e-06
2.03929e-06
2.1933e-06
2.62811e-06
3.13763e-06
1.61978e-05
5.64804e-06
2.44568e-06
2.21627e-06
2.05317e-06
2.06698e-06
2.19717e-06
2.40135e-06
2.5414e-06
2.73073e-06
3.24661e-06
4.93476e-06
7.01703e-06
4.28531e-06
1.62545e-06
1.15737e-06
1.30229e-06
1.24835e-06
1.14071e-06
1.09182e-06
1.88831e-06
4.99418e-06
4.22696e-06
3.0795e-06
2.37699e-06
2.10554e-06
2.00837e-06
2.0779e-06
2.23607e-06
2.08739e-06
1.28014e-05
6.49814e-06
2.93225e-06
2.77349e-06
2.68306e-06
2.8447e-06
3.20867e-06
3.68936e-06
4.02892e-06
4.32129e-06
5.19475e-06
7.39903e-06
7.87682e-06
3.12841e-06
1.17816e-06
1.00476e-06
1.16318e-06
1.3192e-06
1.23289e-06
1.11319e-06
1.23384e-06
3.83338e-06
4.37718e-06
3.7388e-06
2.96742e-06
2.41818e-06
2.14032e-06
2.06449e-06
2.10122e-06
1.9444e-06
9.11418e-06
7.86777e-06
3.60991e-06
3.55801e-06
3.74898e-06
4.4647e-06
5.41895e-06
6.35024e-06
7.02849e-06
7.30867e-06
8.11861e-06
8.90443e-06
7.30179e-06
2.26629e-06
1.00242e-06
9.43826e-07
1.01391e-06
1.20997e-06
1.24326e-06
1.14843e-06
1.12494e-06
1.72613e-06
4.90217e-06
4.06107e-06
3.59453e-06
2.93095e-06
2.36114e-06
2.05815e-06
2.00048e-06
1.88796e-06
7.07926e-06
9.97102e-06
4.69256e-06
4.88295e-06
5.764e-06
7.42658e-06
9.2845e-06
1.21834e-05
1.69112e-05
1.43745e-05
1.05332e-05
8.78661e-06
5.5559e-06
1.82874e-06
9.40655e-07
8.91706e-07
9.60691e-07
1.04185e-06
1.15462e-06
1.10221e-06
1.04726e-06
1.11298e-06
3.0363e-06
4.28721e-06
3.74654e-06
3.35052e-06
2.52743e-06
1.97391e-06
1.83128e-06
1.7773e-06
5.73645e-06
1.22927e-05
6.30632e-06
7.05141e-06
9.29658e-06
6.90887e-05
0.000254836
0.000361738
0.000336129
0.00024016
0.000141014
9.00082e-06
5.26622e-06
1.71355e-06
9.55227e-07
8.62174e-07
9.07304e-07
9.47155e-07
1.02173e-06
1.0197e-06
9.81383e-07
9.6268e-07
1.31675e-06
3.08564e-06
3.72719e-06
3.49424e-06
2.61946e-06
1.8851e-06
1.67137e-06
1.63862e-06
4.51011e-06
1.41849e-05
8.43029e-06
1.07966e-05
0.000308629
0.00101384
0.00130744
0.00119043
0.00093584
0.000660997
0.000398411
9.04147e-05
6.16232e-06
2.05823e-06
1.06504e-06
8.7213e-07
8.42472e-07
8.54111e-07
9.26755e-07
9.60915e-07
9.3606e-07
9.00808e-07
8.9038e-07
1.23649e-06
2.34214e-06
3.87062e-06
2.725e-06
1.9485e-06
1.718e-06
1.49669e-06
3.86731e-06
1.52857e-05
1.30048e-05
0.000556354
0.00231849
0.00334575
0.00331793
0.0024601
0.00157171
0.00113937
0.000679201
0.000280493
7.21814e-06
2.63856e-06
1.24046e-06
8.99635e-07
7.69498e-07
7.96856e-07
8.79725e-07
9.19501e-07
9.02598e-07
8.62146e-07
7.97485e-07
7.3985e-07
1.69138e-06
6.787e-06
3.06488e-06
2.30495e-06
1.95498e-06
1.51936e-06
4.31827e-06
1.58408e-05
0.000304215
0.00281889
0.00538892
0.00583758
0.00575847
0.00403299
0.00200122
0.00142111
0.000956443
0.000510783
8.22303e-06
3.27097e-06
1.50475e-06
9.15461e-07
7.17882e-07
7.67526e-07
8.55893e-07
8.67197e-07
8.56404e-07
8.2278e-07
7.47299e-07
6.45606e-07
3.11271e-06
5.01842e-05
3.63474e-06
2.99833e-06
2.46983e-06
2.50394e-06
5.5811e-06
1.65968e-05
0.00104869
0.0054305
0.00585102
0.00584458
0.00584843
0.00524506
0.00217868
0.00125134
0.00102045
0.000689946
3.85671e-05
4.28803e-06
1.79367e-06
8.7801e-07
6.90486e-07
7.32964e-07
7.94303e-07
7.88962e-07
7.76802e-07
7.47928e-07
6.77705e-07
7.63362e-07
9.70227e-06
6.16173e-05
4.623e-06
3.65764e-06
3.49213e-06
4.43036e-06
7.56463e-06
1.64769e-05
0.00125847
0.00584032
0.00583492
0.0033211
0.00340333
0.00487174
0.00197589
0.000729374
0.000564074
0.000531279
0.000257462
6.55202e-06
2.41495e-06
9.3639e-07
6.76117e-07
6.97013e-07
7.3509e-07
7.09759e-07
6.84527e-07
6.55601e-07
5.99105e-07
8.40798e-07
1.57305e-05
0.000453192
7.68251e-06
5.41771e-06
5.17957e-06
6.92714e-06
0.000238213
1.37218e-05
0.000922676
0.00580305
0.000831948
1.03824e-05
6.91463e-06
3.16072e-05
0.000850746
0.000846951
0.000843865
0.000842526
0.000839787
0.00037602
5.60334e-06
1.35704e-06
7.9099e-07
7.72595e-07
8.06416e-07
8.05608e-07
7.20359e-07
6.99047e-07
6.64156e-07
1.43471e-06
0.000116699
0.000998877
0.00133008
0.000240042
2.6154e-05
0.00023482
0.000541915
0.00140906
0.00144145
0.000424005
5.22314e-06
1.20167e-06
9.0713e-07
2.19249e-06
5.83204e-06
8.76038e-06
1.0725e-05
1.68711e-05
3.25884e-05
3.84034e-05
1.28157e-05
2.84522e-06
1.68086e-06
1.61761e-06
1.88202e-06
1.98982e-06
1.7176e-06
1.86846e-06
2.57326e-06
6.49243e-06
0.000589521
0.00130801
0.00514695
0.00538681
0.00221718
0.00179768
0.000544141
0.000724487
0.00141909
7.56318e-06
8.52059e-07
5.86812e-07
5.60918e-07
5.60702e-07
7.0121e-07
7.6136e-07
8.40495e-07
1.04741e-06
1.93105e-06
4.81103e-06
7.86919e-06
7.15926e-06
5.12618e-06
4.42493e-06
4.81867e-06
5.13876e-06
5.73834e-06
7.54931e-06
1.32622e-05
3.94183e-05
0.00120109
0.00119168
0.00600571
0.0063737
0.00634914
0.00527402
7.20507e-05
3.17644e-05
1.04994e-05
1.00274e-06
5.41825e-07
5.33581e-07
5.13083e-07
5.12086e-07
5.14682e-07
4.97593e-07
5.07084e-07
5.64659e-07
6.39465e-07
8.05429e-07
1.53379e-06
3.76127e-06
4.39266e-06
3.9126e-06
3.62987e-06
3.84952e-06
5.10256e-06
6.17063e-06
8.13874e-06
1.25665e-05
2.20975e-05
2.93218e-05
3.35097e-05
0.00622596
0.00637506
0.00633311
2.86244e-05
2.41142e-05
3.16794e-06
6.46145e-07
5.22773e-07
5.22163e-07
4.99175e-07
5.1544e-07
5.50901e-07
5.68457e-07
5.63527e-07
5.62596e-07
6.08838e-07
6.65957e-07
7.55487e-07
1.01907e-06
1.408e-06
1.56303e-06
1.53209e-06
1.55555e-06
1.77384e-06
1.68367e-06
1.4402e-06
1.14946e-06
1.63093e-06
1.77571e-06
2.07071e-06
1.35495e-05
0.0062219
0.00634553
1.6388e-05
1.94458e-05
2.13073e-06
7.79333e-07
5.2392e-07
5.20053e-07
5.05893e-07
5.24198e-07
5.66972e-07
6.1149e-07
6.2744e-07
5.71732e-07
6.12238e-07
6.63112e-07
7.01816e-07
7.36755e-07
7.91362e-07
8.39335e-07
8.48851e-07
8.41073e-07
8.26056e-07
7.70709e-07
7.02311e-07
6.37852e-07
6.00172e-07
5.70813e-07
5.73148e-07
1.57883e-06
2.45092e-05
0.00623462
1.35019e-05
1.45591e-05
3.08646e-06
1.07943e-06
5.42147e-07
5.20792e-07
5.11737e-07
5.26514e-07
5.78493e-07
6.61726e-07
7.15319e-07
6.03568e-07
6.1579e-07
6.58684e-07
6.99277e-07
7.18997e-07
7.27561e-07
7.3669e-07
7.40257e-07
7.30384e-07
7.0868e-07
6.80332e-07
6.45731e-07
6.11496e-07
5.77862e-07
5.53545e-07
5.3124e-07
5.51929e-07
2.85555e-06
0.000856317
1.355e-05
1.279e-05
4.19154e-06
1.46062e-06
5.66159e-07
5.2165e-07
5.12403e-07
5.26104e-07
5.90392e-07
7.18128e-07
7.93513e-07
6.38564e-07
6.25228e-07
6.57835e-07
6.95544e-07
7.19158e-07
7.23545e-07
7.22705e-07
7.22365e-07
7.11861e-07
6.93106e-07
6.68461e-07
6.38128e-07
6.05055e-07
5.76191e-07
5.5424e-07
5.37461e-07
5.18733e-07
8.12249e-07
1.13071e-05
1.38075e-05
1.53529e-05
5.3992e-06
1.51976e-06
5.65422e-07
5.17564e-07
5.06691e-07
5.21086e-07
6.03514e-07
7.73089e-07
8.46468e-07
6.70863e-07
6.28805e-07
6.62373e-07
6.91124e-07
7.11796e-07
7.18375e-07
7.14981e-07
7.07226e-07
6.97571e-07
6.78809e-07
6.55227e-07
6.29031e-07
6.01315e-07
5.76321e-07
5.57154e-07
5.44712e-07
5.36791e-07
7.31086e-07
3.64796e-06
1.46352e-05
1.54555e-05
5.93691e-06
1.11194e-06
5.27016e-07
5.03328e-07
4.97309e-07
5.20875e-07
6.12313e-07
7.93138e-07
8.82891e-07
7.0325e-07
6.30268e-07
6.60725e-07
6.86482e-07
7.03717e-07
7.12886e-07
7.10682e-07
6.95783e-07
6.84889e-07
6.67576e-07
6.45265e-07
6.2144e-07
5.95984e-07
5.71909e-07
5.56225e-07
5.4904e-07
5.56354e-07
8.12766e-07
4.08051e-06
1.50629e-05
1.43273e-05
4.16746e-06
7.53197e-07
4.73671e-07
4.79515e-07
4.92797e-07
5.2011e-07
6.12339e-07
8.00649e-07
9.34619e-07
7.2269e-07
6.38674e-07
6.68093e-07
6.88161e-07
6.99413e-07
7.04032e-07
7.05842e-07
6.90076e-07
6.74399e-07
6.57776e-07
6.36147e-07
6.12484e-07
5.87809e-07
5.65327e-07
5.54717e-07
5.56413e-07
5.82756e-07
9.09656e-07
4.49466e-06
7.70493e-05
2.48904e-05
3.96485e-06
6.78108e-07
4.41634e-07
4.53714e-07
4.91377e-07
5.24634e-07
6.34407e-07
8.41978e-07
9.94684e-07
7.34267e-07
6.43247e-07
6.68629e-07
6.94784e-07
7.02275e-07
7.01219e-07
6.97234e-07
6.88302e-07
6.66355e-07
6.47355e-07
6.25407e-07
6.01372e-07
5.78002e-07
5.61342e-07
5.58314e-07
5.72268e-07
6.16381e-07
9.98269e-07
4.6954e-06
0.000275155
8.93734e-05
4.29159e-06
6.80294e-07
4.44185e-07
4.54377e-07
5.11506e-07
5.55128e-07
6.93459e-07
8.96821e-07
1.02071e-06
7.41666e-07
6.48714e-07
6.68155e-07
6.94948e-07
7.06089e-07
7.06207e-07
6.92415e-07
6.79896e-07
6.60687e-07
6.37093e-07
6.15395e-07
5.93593e-07
5.75077e-07
5.6839e-07
5.78148e-07
6.07203e-07
6.6333e-07
1.1076e-06
4.48588e-06
0.000494237
9.26636e-05
3.63771e-06
7.95047e-07
5.15321e-07
5.07932e-07
5.48949e-07
6.13105e-07
7.49802e-07
9.87589e-07
1.03139e-06
7.36699e-07
6.53155e-07
6.67347e-07
6.87454e-07
6.96951e-07
7.01593e-07
6.93298e-07
6.72834e-07
6.55242e-07
6.32023e-07
6.12374e-07
5.95752e-07
5.8771e-07
5.95671e-07
6.19524e-07
6.64251e-07
7.65345e-07
1.34209e-06
4.97238e-06
0.000660708
0.000111903
3.57162e-06
9.9725e-07
6.32487e-07
6.00534e-07
6.1774e-07
6.9026e-07
8.3162e-07
1.09419e-06
1.02777e-06
7.29185e-07
6.57414e-07
6.69597e-07
6.82311e-07
6.88237e-07
6.90442e-07
6.84384e-07
6.70506e-07
6.49318e-07
6.31016e-07
6.16091e-07
6.10119e-07
6.18724e-07
6.43717e-07
6.84838e-07
7.384e-07
9.89783e-07
1.79926e-06
5.86722e-06
0.00066753
0.000467353
3.76618e-06
1.31704e-06
8.09278e-07
6.99256e-07
6.91608e-07
7.68431e-07
9.84606e-07
1.23048e-06
9.98458e-07
7.15548e-07
6.59515e-07
6.686e-07
6.78629e-07
6.83807e-07
6.85311e-07
6.75853e-07
6.61733e-07
6.46548e-07
6.34222e-07
6.31597e-07
6.40202e-07
6.66057e-07
7.11273e-07
7.48771e-07
9.4999e-07
1.40683e-06
2.728e-06
6.76975e-06
0.0006684
1.00113e-05
3.41103e-06
1.76211e-06
1.24244e-06
9.88156e-07
9.07207e-07
9.76284e-07
1.19241e-06
1.37055e-06
9.59986e-07
7.04746e-07
6.60859e-07
6.64906e-07
6.71739e-07
6.76431e-07
6.775e-07
6.70803e-07
6.61801e-07
6.52107e-07
6.51104e-07
6.61606e-07
6.85051e-07
7.28374e-07
7.82077e-07
9.31398e-07
1.30305e-06
2.17635e-06
4.37892e-06
1.66529e-05
0.000668123
4.15476e-06
3.05358e-06
2.71851e-06
2.10956e-06
1.61026e-06
1.33199e-06
1.31071e-06
1.48201e-06
1.44337e-06
9.06377e-07
6.98411e-07
6.62761e-07
6.62042e-07
6.66853e-07
6.72925e-07
6.73659e-07
6.70379e-07
6.66343e-07
6.66703e-07
6.77362e-07
7.00502e-07
7.40379e-07
7.98817e-07
9.09522e-07
1.23012e-06
1.90341e-06
3.54487e-06
6.52228e-06
2.20725e-05
0.000669379
3.64475e-06
3.56143e-06
3.87107e-06
3.56975e-06
2.89772e-06
2.14024e-06
1.82887e-06
1.83239e-06
1.44511e-06
8.67411e-07
6.95244e-07
6.61826e-07
6.57475e-07
6.64709e-07
6.71895e-07
6.72974e-07
6.74585e-07
6.76981e-07
6.88788e-07
7.13142e-07
7.53545e-07
8.1226e-07
8.95064e-07
1.16787e-06
1.71919e-06
2.91814e-06
5.63443e-06
4.02076e-05
2.86215e-05
4.65528e-05
4.09785e-06
4.81044e-06
5.61805e-06
5.72678e-06
5.5918e-06
3.8902e-06
2.52605e-06
2.10325e-06
1.44658e-06
8.36488e-07
6.8398e-07
6.52913e-07
6.54121e-07
6.66271e-07
6.71983e-07
6.7704e-07
6.84771e-07
6.95629e-07
7.21478e-07
7.65016e-07
8.2478e-07
8.91341e-07
1.12668e-06
1.59951e-06
2.5394e-06
4.5503e-06
8.18683e-06
0.000158886
0.000114367
0.000125729
7.39689e-06
3.49314e-05
0.00020156
0.000245532
0.000228065
2.71346e-05
5.19874e-06
2.58833e-06
1.24184e-06
7.77345e-07
6.73395e-07
6.43243e-07
6.55841e-07
6.71734e-07
6.77821e-07
6.89648e-07
7.0478e-07
7.27785e-07
7.70953e-07
8.35312e-07
8.93765e-07
1.10921e-06
1.52366e-06
2.34509e-06
3.92027e-06
6.91378e-06
5.33623e-05
0.000252223
0.00030475
0.000429961
0.00482719
0.00785497
0.00872218
0.00847539
0.00762012
0.00564303
0.000351928
4.31908e-06
1.08632e-06
6.92422e-07
6.41368e-07
6.49581e-07
6.69292e-07
6.84761e-07
6.9614e-07
7.15921e-07
7.40794e-07
7.79915e-07
8.41851e-07
9.09752e-07
1.10441e-06
1.49243e-06
2.23813e-06
3.64698e-06
6.14625e-06
9.60786e-06
0.000124322
0.000299583
0.000450789
0.000680911
0.00922912
0.00923326
0.00922079
0.00921145
0.00919733
0.00913565
0.000723859
5.8508e-06
1.65573e-06
7.86644e-07
6.28754e-07
6.56468e-07
6.9407e-07
7.13795e-07
7.31425e-07
7.62419e-07
8.00217e-07
8.57724e-07
9.26247e-07
1.10835e-06
1.48874e-06
2.205e-06
3.55406e-06
5.87733e-06
9.12859e-06
3.84597e-05
0.00016879
0.000324471
0.000497927
0.000771272
0.00925191
0.00923508
0.0092101
0.00696461
0.00747602
0.00150239
1.34873e-05
7.80641e-06
6.2056e-06
2.57061e-06
8.80404e-07
7.13594e-07
7.44455e-07
7.75183e-07
7.90852e-07
8.37423e-07
8.89889e-07
9.57867e-07
1.14958e-06
1.51947e-06
2.2324e-06
3.576e-06
5.91737e-06
9.14614e-06
1.76457e-05
0.000101002
0.000213775
0.000351694
0.000512611
0.000797562
0.00924222
0.00547989
0.000849576
0.000398624
0.000391856
0.000107437
6.73767e-05
0.000139685
0.000380701
1.01827e-05
2.69593e-06
1.12461e-06
9.17057e-07
9.14134e-07
9.18455e-07
9.86337e-07
1.09295e-06
1.28865e-06
1.65399e-06
2.36064e-06
3.71915e-06
6.14539e-06
9.56208e-06
1.54714e-05
8.31737e-05
0.00017355
0.000275105
0.000396117
0.00053424
0.000798989
0.00274123
0.000420619
0.000421047
0.00119234
0.0028119
0.00264612
0.00387976
0.00407324
0.00131132
4.76954e-05
8.5082e-06
3.23269e-06
1.93175e-06
1.60887e-06
1.50309e-06
1.55856e-06
1.7428e-06
2.09535e-06
2.78324e-06
4.13646e-06
6.59857e-06
1.02293e-05
1.86052e-05
9.78195e-05
0.00018466
0.000268272
0.000360472
0.00046375
0.000578065
0.000800652
3.71843e-05
0.000900767
0.00781405
0.0153216
0.0151535
0.0124554
0.00942517
0.00408309
0.000854662
0.000219979
0.000114853
1.15957e-05
6.71566e-06
4.69008e-06
3.89097e-06
3.65614e-06
3.87039e-06
4.46878e-06
5.67196e-06
7.88507e-06
1.12676e-05
2.25799e-05
0.000126596
0.000234625
0.000319197
0.000394982
0.000474155
0.00055486
0.0006452
0.000807679
0.000826185
0.0166429
0.0180116
0.0155207
0.0109389
0.00988548
0.00727436
0.00313933
0.00126354
0.00196592
0.00399288
0.00134089
0.00013628
1.57966e-05
1.30036e-05
1.1323e-05
1.09257e-05
1.16329e-05
1.32195e-05
1.56518e-05
5.6936e-05
0.000157636
0.000284788
0.000400393
0.000489393
0.000557576
0.000619866
0.000670319
0.000729547
0.000823902
0.0137833
0.0182064
0.0176621
0.00230296
0.00470537
0.00743504
0.00766771
0.00523263
0.0055034
0.0119133
0.0143401
0.0100334
0.00698221
0.00465166
0.00278082
0.00164084
0.00119792
0.00125101
0.00142078
0.00118104
0.0007044
0.000504853
0.000532532
0.000624655
0.00071118
0.000768901
0.000808692
0.000818459
0.000830708
0.000842746
0.0214362
0.017756
0.000551296
0.00037047
0.00306399
0.0122863
0.015366
0.0163452
0.0241181
0.0320407
0.0279433
0.0219871
0.0188085
0.0159908
0.0130353
0.010502
0.00865918
0.00770237
0.00699643
0.00546001
0.00317545
0.00167045
0.00116413
0.00107232
0.00107727
0.0010857
0.00107712
0.00102597
0.000962509
0.000862565
0.0207588
0.00017378
0.000168745
0.000374091
0.0130782
0.0370662
0.0405966
0.0448693
0.0515846
0.0491731
0.0407732
0.0342108
0.0299957
0.0262014
0.0225479
0.0192768
0.0165809
0.0147085
0.0132834
0.0112098
0.0079499
0.00477962
0.00293691
0.00216142
0.00183965
0.00166586
0.00152559
0.00134999
0.00115749
0.000891368
0.00347598
8.68063e-05
0.000649804
0.00768249
0.0624015
0.0759287
0.070286
0.0668775
0.0620708
0.0549459
0.0490036
0.0444473
0.0400917
0.0358611
0.0318405
0.0281477
0.0249529
0.0224293
0.0203385
0.0178026
0.0141343
0.00994421
0.00658342
0.00455943
0.00346257
0.002817
0.00235505
0.00191511
0.00147966
0.000947304
0.000372331
8.7757e-05
0.0106931
0.0749608
0.0842519
0.079967
0.073966
0.0620218
0.055611
0.0516529
0.050145
0.0496437
0.0474271
0.0441642
0.0405966
0.0370168
0.0336801
0.0307466
0.0280628
0.0250246
0.0210567
0.0163732
0.0119573
0.00862064
0.00640756
0.00494125
0.0038706
0.00293196
0.00204344
0.00106279
0.00021919
0.00496951
0.0773474
0.0884967
0.0855361
0.0776385
0.0562385
0.0422995
0.0391487
0.041854
0.046257
0.0491272
0.050606
0.0497616
0.0475934
0.0448048
0.0418367
0.0389123
0.0359698
0.0326338
0.0284926
0.0235866
0.0185564
0.014181
0.010813
0.00831537
0.00637316
0.0046629
0.00302246
0.00129189
0.00266575
0.0685777
0.0885514
0.0886557
0.0802862
0.0379951
0.0179385
0.013899
0.0168921
0.0262294
0.0375026
0.0460579
0.0507952
0.052646
0.0524268
0.050951
0.0488303
0.046389
0.0436476
0.0403846
0.0363176
0.031418
0.0260897
0.0209834
0.0165906
0.0130071
0.0100316
0.00732722
0.00461329
0.00171808
0.0398505
0.0887713
0.0889743
0.0837138
0.0226865
0.00156755
0.000649448
0.000854433
0.00273595
0.0114668
0.0270571
0.0413359
0.0500811
0.0541944
0.0556651
0.0555964
0.0545816
0.0529703
0.0508352
0.0480381
0.0443685
0.039753
0.0344235
0.0288824
0.0236536
0.0190122
0.0149103
0.0110446
0.00697409
0.00245634
0.084595
0.0892076
0.0885442
0.0148816
8.50882e-05
1.26776e-05
1.25496e-05
1.37109e-05
8.27521e-05
0.00349962
0.0195922
0.0383319
0.0502203
0.0557496
0.0582364
0.0592215
0.059275
0.0586428
0.0573832
0.0553842
0.0524487
0.0484451
0.043452
0.0378045
0.0319809
0.0263682
0.0210843
0.0159073
0.0102245
0.00365276
0.089802
0.0888753
0.0150114
1.25966e-05
8.35102e-06
8.69428e-06
9.61251e-06
1.047e-05
1.16623e-05
0.000973009
0.0172208
0.0396793
0.0524962
0.0581227
0.060785
0.0623331
0.0631891
0.0634819
0.0632111
0.0622452
0.0603507
0.0573107
0.0530481
0.0476952
0.0416024
0.0351886
0.0287187
0.0220849
0.0145081
0.00550633
0.0871175
0.017073
1.09741e-05
4.3987e-06
5.25616e-06
7.68022e-06
9.2684e-06
9.68142e-06
1.18619e-05
0.00112436
0.0210977
0.0459196
0.0574833
0.0614312
0.063566
0.0652608
0.0665894
0.0675847
0.0682308
0.0683867
0.0677702
0.0660653
0.0630201
0.0584992
0.052603
0.0456859
0.0381186
0.0299042
0.0200955
0.00829395
0.0229009
1.15608e-05
4.2156e-06
4.26837e-06
4.45753e-06
7.46759e-06
1.11579e-05
1.03958e-05
2.04432e-05
0.00351131
0.0334477
0.0568594
0.063444
0.0649946
0.0665326
0.0681679
0.0696734
0.0710645
0.07235
0.073432
0.0740924
0.0740077
0.0727558
0.0698766
0.0650078
0.0582064
0.0498331
0.0399669
0.0275027
0.0124077
0.0014764
4.67267e-06
3.98035e-06
3.93644e-06
4.52209e-06
8.49923e-06
6.48059e-05
1.33904e-05
0.000650076
0.0157868
0.0521363
0.0668737
0.0679077
0.0682557
0.0695634
0.0710835
0.0725994
0.0741653
0.0750543
0.0754204
0.075764
0.0760347
0.0761456
0.0759879
0.0754324
0.0725126
0.0645686
0.0534115
0.0377454
0.0184943
0.000193511
3.6388e-06
3.74531e-06
3.80395e-06
4.77497e-06
1.18159e-05
0.000656562
0.000610798
0.00735076
0.0403535
0.0682034
0.0719637
0.0708971
0.0713349
0.0725956
0.0739867
0.0749788
0.0753422
0.0757435
0.0761754
0.0766233
0.0770515
0.0774012
0.0776065
0.0775875
0.0771797
0.0761374
0.0710775
0.0528099
0.0279423
9.54589e-05
8.41519e-06
6.65193e-06
4.13736e-06
5.47093e-06
8.89205e-05
0.00311995
0.00628495
0.0281498
0.0629629
0.0751108
0.0748051
0.0739239
0.0745532
0.0750226
0.0752969
0.0756064
0.0759648
0.0763805
0.0768514
0.0773667
0.0778998
0.0784094
0.0788469
0.0791465
0.0792134
0.0789525
0.0779653
0.0734407
0.0436233
9.36402e-05
0.000294326
0.000345325
1.3043e-05
1.11712e-05
0.000234049
0.010353
0.0248909
0.053654
0.0750425
0.0758249
0.0755103
0.0754517
0.0755758
0.0757588
0.0759764
0.0762401
0.0765681
0.0769768
0.0774689
0.0780367
0.0786584
0.0792965
0.0799044
0.0804274
0.0808068
0.0810084
0.0808546
0.0790552
0.0668815
0.000356897
0.00647915
0.00829597
0.000647063
0.00199731
0.00386684
0.0246661
0.049749
0.071686
0.0763014
0.0764389
0.0763768
0.0764237
0.0765118
0.0766136
0.0767393
0.0769111
0.0771641
0.07753
0.0780236
0.0786349
0.0793397
0.0801004
0.0808648
0.0815772
0.0821883
0.0826822
0.0829933
0.0823093
0.0786883
0.00194555
0.00997433
0.00996398
0.00682332
0.0150503
0.0204044
0.0453948
0.0688247
0.0762695
0.0771722
0.0773436
0.0774916
0.0775953
0.0776314
0.0776307
0.0776243
0.0776519
0.0777694
0.078034
0.0784918
0.0791378
0.0799268
0.0808175
0.0817469
0.0826472
0.0834668
0.0841933
0.0847941
0.0847793
0.0830105
0.00337319
0.0106221
0.00970197
0.0110493
0.0199919
0.0376361
0.0640901
0.0762247
0.0776248
0.0782494
0.0786357
0.0789101
0.0790182
0.078981
0.0788502
0.0786626
0.0784821
0.0783924
0.0784835
0.0788402
0.0794952
0.0803865
0.0814282
0.082543
0.0836459
0.0846793
0.0856289
0.0864889
0.086974
0.0863694
0.00456606
0.0110922
0.00916786
0.0123263
0.0258209
0.052157
0.0756162
0.0780786
0.079004
0.0797255
0.0803123
0.0806589
0.0807366
0.0806118
0.0803144
0.0798907
0.0794199
0.079022
0.0788491
0.0790371
0.0796631
0.0806978
0.0819416
0.0832728
0.0845877
0.0858333
0.0870021
0.0881199
0.0890187
0.0891549
0.00587871
0.0110781
0.00837984
0.013825
0.0339296
0.0655445
0.0779763
0.0797406
0.0806818
0.0815975
0.0823473
0.0827486
0.0827898
0.0825678
0.0820721
0.0813541
0.0804952
0.0796403
0.0790601
0.0790377
0.0796458
0.080874
0.0824448
0.0840734
0.0856078
0.0869989
0.0883213
0.0896815
0.0909612
0.0916425
0.00801019
0.0111703
0.00637545
0.0152145
0.0430829
0.0754521
0.0798692
0.0814592
0.0826556
0.083812
0.0847182
0.0851826
0.0852114
0.084893
0.0841837
0.083119
0.0817215
0.0801162
0.0788446
0.078458
0.079153
0.0807685
0.0828892
0.0850705
0.0870375
0.0884485
0.0896791
0.0911791
0.0928031
0.0939587
0.0111052
0.0110821
0.00276284
0.0158156
0.0519688
0.0777074
0.0815719
0.083345
0.0849002
0.0863308
0.0874091
0.0879621
0.0880167
0.087631
0.0867111
0.0851878
0.0827841
0.0795555
0.0763165
0.0740975
0.0754092
0.0780673
0.0815111
0.0853741
0.0885847
0.0904073
0.0912548
0.0926372
0.0944665
0.0959761
0.0110973
0.00758187
0.00129313
0.0163505
0.0601864
0.0796484
0.0832668
0.0854285
0.0873955
0.0891214
0.0903953
0.0910799
0.0912138
0.0908135
0.0896262
0.0870019
0.0819147
0.0711897
0.0422541
0.0316447
0.0313752
0.0394293
0.0565109
0.0790949
0.0861628
0.091352
0.0926298
0.0938655
0.0958674
0.0973479
0.0110592
0.0012842
0.0012889
0.0174367
0.069096
0.0815872
0.0851272
0.087746
0.0901266
0.092146
0.0936375
0.0945167
0.0948219
0.094451
0.0924712
0.0865456
0.0720059
0.0203596
0.00600866
0.00280631
0.00195965
0.00244326
0.00436089
0.0177275
0.0454469
0.0821787
0.0901398
0.0939726
0.0970031
0.0980009
0.00592413
7.75611e-05
0.00139624
0.0168163
0.0756887
0.0840229
0.0874458
0.0903687
0.0930819
0.0953612
0.097085
0.098259
0.0989242
0.0985334
0.0938899
0.0790056
0.0125783
0.000629151
9.09032e-05
1.86498e-05
1.48179e-05
1.44859e-05
1.4895e-05
0.000161778
0.000888254
0.00801138
0.0626878
0.0882691
0.0969857
0.0980694
0.00214945
3.64224e-05
0.00164282
0.00998335
0.076176
0.0868459
0.090325
0.0933297
0.0962468
0.0987202
0.100691
0.102335
0.103537
0.101984
0.0888962
0.0140687
2.25058e-05
1.28919e-05
1.1971e-05
1.151e-05
1.08105e-05
1.03304e-05
1.00912e-05
1.05897e-05
1.07208e-05
1.236e-05
0.00194899
0.0356387
0.0860105
0.0979602
0.000469741
1.64694e-05
0.00144491
0.00132524
0.064543
0.0887045
0.0933949
0.0966001
0.0996323
0.102194
0.104434
0.106672
0.107427
0.0993997
0.0385686
1.61042e-05
1.12513e-05
1.10119e-05
1.08477e-05
1.05943e-05
1.02061e-05
9.73247e-06
9.31282e-06
9.26495e-06
9.14638e-06
8.91909e-06
9.21816e-06
0.000412968
0.00408555
0.0877159
8.38475e-06
5.1205e-06
1.61816e-05
0.000213783
0.0506753
0.0891664
0.0963203
0.100236
0.10334
0.105835
0.108296
0.110668
0.108736
0.085247
0.00108236
1.12698e-05
1.11797e-05
1.10022e-05
1.07907e-05
1.05106e-05
1.00903e-05
9.60769e-06
8.58914e-06
8.43999e-06
8.29662e-06
8.8906e-06
1.05673e-05
1.12469e-05
1.11504e-05
0.00741573
2.81099e-06
3.06886e-06
4.6064e-06
0.000257996
0.0441887
0.0890228
0.0992786
0.104453
0.107528
0.109654
0.111716
0.111687
0.105608
0.0276833
1.24619e-05
1.15619e-05
1.12759e-05
1.12508e-05
1.13887e-05
1.11739e-05
1.07766e-05
1.05446e-05
1.71948e-05
0.00107159
0.000279932
2.67158e-05
8.85628e-05
1.10283e-05
9.7417e-06
1.17865e-05
3.74408e-06
3.88293e-06
5.25716e-06
0.000139026
0.0382514
0.0894493
0.10325
0.109822
0.112279
0.112996
0.112747
0.111757
0.0916821
0.00217254
1.23814e-05
1.38771e-05
1.50963e-05
1.56403e-05
1.45798e-05
1.33457e-05
1.29013e-05
3.44367e-05
0.00517792
0.0272804
0.0336773
0.0165171
0.0179647
0.00456824
0.000728176
1.11298e-05
9.77995e-06
7.71628e-06
1.12939e-05
0.00144916
0.0358016
0.0900112
0.109257
0.117113
0.117563
0.115653
0.111957
0.102554
0.0593488
0.000116827
1.33067e-05
1.72215e-05
1.97448e-05
2.22979e-05
1.88154e-05
1.70504e-05
4.9763e-05
0.00166205
0.0223479
0.0442225
0.0768338
0.0825542
0.0837789
0.0817903
0.057431
0.00115196
0.000360159
1.93889e-05
0.000481306
0.00302108
0.0183375
0.0876906
0.118077
0.127001
0.124133
0.117192
0.107048
0.0907335
0.0336599
0.000648459
1.62533e-05
1.28191e-05
1.02818e-05
1.57276e-05
2.16813e-05
4.28588e-05
0.00072201
0.0110167
0.031505
0.0429477
0.0737653
0.0826045
0.086488
0.0865888
0.086482
0.0791807
0.00741923
0.000985361
0.00134136
0.00241191
0.00275329
0.0782686
0.131869
0.140384
0.132113
0.118166
0.100785
0.0794486
0.020044
0.00379673
0.000403187
8.56481e-06
5.0165e-06
6.59949e-06
1.1925e-05
1.98028e-05
0.000612701
0.0168241
0.02939
0.0369944
0.0515198
0.0769469
0.086065
0.0866101
0.0866171
0.0865825
0.031776
0.00730952
0.00230119
0.000444531
1.81124e-05
0.0365383
0.152027
0.154214
0.140778
0.118893
0.0931253
0.0410687
0.00505566
0.00148603
0.00152233
1.78144e-05
4.76238e-06
4.54791e-06
5.64609e-06
9.21213e-06
2.13746e-05
0.00736179
0.0191904
0.0186534
0.0201666
0.0298532
0.0725365
0.0864175
0.086505
0.0866133
0.0370207
0.0265978
0.00111049
1.12183e-05
9.91486e-06
0.00957152
0.154919
0.155155
0.149708
0.118872
0.0788667
0.00606593
0.000764874
5.05763e-05
4.14344e-05
1.96809e-05
9.78365e-06
5.19961e-06
4.38125e-06
5.47031e-06
9.44394e-06
9.72919e-05
0.0051625
0.0050784
0.00613491
0.00893041
0.0139707
0.0355543
0.0410499
0.0855754
0.0246361
0.0283836
0.0029697
8.05527e-06
9.68092e-06
0.0219602
0.154678
0.155144
0.152681
0.110647
0.0112186
8.43926e-05
1.26316e-05
5.21045e-06
2.1445e-06
2.95293e-06
8.57711e-06
1.11181e-05
7.95422e-06
7.69886e-06
9.95546e-06
1.59757e-05
0.000252538
0.000619107
0.000839584
0.000681506
0.00010175
1.67603e-05
1.04346e-05
1.85807e-05
0.00109708
0.0282671
0.0252239
3.20624e-05
0.0010085
0.0803237
0.139065
0.155131
0.148356
0.0845293
0.00013941
9.20385e-06
1.32378e-06
1.10022e-06
1.00617e-06
1.10625e-06
1.6874e-06
3.15025e-06
5.99799e-06
9.28232e-06
1.32732e-05
1.72026e-05
1.91017e-05
2.00096e-05
1.81272e-05
1.23085e-05
7.04494e-06
3.78205e-06
2.61584e-06
2.95982e-06
0.000725952
0.0276417
0.0275775
0.0237139
0.0434149
0.0912559
0.127819
0.15481
0.142571
0.017965
2.29017e-05
1.54507e-06
8.74982e-07
9.32195e-07
9.83079e-07
1.00648e-06
1.03008e-06
1.16188e-06
1.6684e-06
2.10361e-06
2.63092e-06
3.11939e-06
3.39493e-06
3.39136e-06
2.80432e-06
2.12165e-06
1.8155e-06
1.76382e-06
1.77352e-06
1.76019e-06
0.000811658
0.000822444
0.00687758
0.0188421
0.0760513
0.0930707
0.121944
0.144139
0.123286
0.00229892
6.86146e-06
9.85709e-07
8.60172e-07
9.27937e-07
9.72666e-07
9.93507e-07
9.98124e-07
9.9779e-07
1.01456e-06
1.07189e-06
1.1813e-06
1.29049e-06
1.45472e-06
1.62666e-06
1.7482e-06
1.86021e-06
1.91174e-06
1.88172e-06
1.75503e-06
1.73014e-06
1.83281e-05
6.01899e-06
1.92983e-05
4.59739e-05
0.0632
0.089101
0.114924
0.13453
0.11018
0.000757786
4.35994e-06
9.37658e-07
8.58531e-07
9.22876e-07
9.60867e-07
9.77128e-07
9.82935e-07
9.80997e-07
9.77191e-07
9.87197e-07
1.00614e-06
1.06137e-06
1.18744e-06
1.4022e-06
1.64656e-06
1.80714e-06
1.88909e-06
1.88618e-06
1.74504e-06
1.66558e-06
2.6914e-06
1.05728e-06
3.10855e-06
1.29956e-05
0.0581542
0.0843356
0.105574
0.127424
0.10186
0.0010213
4.13727e-06
9.53275e-07
8.64507e-07
9.20559e-07
9.48162e-07
9.58466e-07
9.60976e-07
9.58373e-07
9.58098e-07
9.71566e-07
9.97443e-07
1.07654e-06
1.24175e-06
1.49487e-06
1.74034e-06
1.85912e-06
1.89754e-06
1.86882e-06
1.71883e-06
1.61055e-06
2.27807e-06
8.96431e-07
1.66445e-06
0.000418963
0.0800399
0.0808072
0.0917803
0.120287
0.0951002
0.00141549
4.12745e-06
9.5694e-07
8.79249e-07
9.17312e-07
9.37265e-07
9.43158e-07
9.41871e-07
9.33386e-07
9.2876e-07
9.41031e-07
9.73779e-07
1.05992e-06
1.2461e-06
1.56746e-06
1.87094e-06
1.96175e-06
1.93038e-06
1.85581e-06
1.69008e-06
1.57577e-06
2.37104e-06
9.50092e-07
2.17459e-06
0.00925565
0.0804317
0.0411575
0.0561278
0.113234
0.0866575
0.000906019
3.39587e-06
9.37269e-07
8.85526e-07
9.09337e-07
9.2157e-07
9.22096e-07
9.15166e-07
9.06569e-07
8.99838e-07
9.09101e-07
9.37762e-07
1.01493e-06
1.18103e-06
1.51048e-06
1.93525e-06
2.14363e-06
2.04673e-06
1.86606e-06
1.67425e-06
1.56463e-06
2.37214e-06
9.584e-07
3.05583e-06
0.0118929
0.0783911
0.00216338
0.0114079
0.112915
0.0795575
0.000139369
2.54082e-06
9.09026e-07
8.86062e-07
8.98629e-07
9.02793e-07
9.01143e-07
8.94292e-07
8.91337e-07
8.90255e-07
9.00713e-07
9.30755e-07
9.96321e-07
1.11211e-06
1.31206e-06
1.7324e-06
2.1702e-06
2.28313e-06
1.94738e-06
1.67824e-06
1.5769e-06
2.24351e-06
9.77903e-07
2.61253e-06
0.00204895
0.020945
1.42748e-05
0.00246139
0.112536
0.0749243
4.93364e-05
1.8296e-06
9.04125e-07
8.97246e-07
8.95546e-07
8.96701e-07
8.93216e-07
8.89894e-07
9.00405e-07
9.10949e-07
9.32989e-07
9.74648e-07
1.03866e-06
1.12664e-06
1.22539e-06
1.40042e-06
1.84124e-06
2.29402e-06
2.16147e-06
1.71992e-06
1.61376e-06
2.19291e-06
9.87872e-07
1.36296e-06
1.3354e-05
0.000379207
1.46538e-05
0.0418789
0.112296
0.0362079
3.11769e-05
1.38871e-06
9.26556e-07
9.26382e-07
9.10443e-07
9.16712e-07
9.17295e-07
9.19803e-07
9.4017e-07
9.53231e-07
9.66727e-07
9.9987e-07
1.04399e-06
1.10868e-06
1.21081e-06
1.31478e-06
1.49002e-06
1.92837e-06
2.23417e-06
1.82431e-06
1.67322e-06
2.12311e-06
9.30497e-07
9.20788e-07
2.61425e-06
1.90092e-05
1.40802e-05
0.0138802
0.111895
0.016523
1.18672e-05
1.17915e-06
9.75956e-07
9.83629e-07
9.6959e-07
9.91811e-07
9.98409e-07
1.0148e-06
1.03072e-06
1.03175e-06
1.02612e-06
1.0285e-06
1.03017e-06
1.05533e-06
1.13574e-06
1.24813e-06
1.38068e-06
1.59211e-06
2.04386e-06
1.94674e-06
1.75855e-06
2.07372e-06
8.6705e-07
7.96331e-07
1.64376e-06
5.79689e-06
1.19261e-05
0.010412
0.101899
0.00281488
2.85699e-06
1.0774e-06
1.05393e-06
1.05707e-06
1.06245e-06
1.10174e-06
1.11123e-06
1.13863e-06
1.14434e-06
1.13575e-06
1.11204e-06
1.08729e-06
1.0522e-06
1.03344e-06
1.08322e-06
1.16357e-06
1.25865e-06
1.43861e-06
1.78424e-06
1.97047e-06
1.83743e-06
2.05516e-06
8.02365e-07
7.76459e-07
1.30402e-06
6.30098e-06
7.96825e-06
0.00168191
0.0759025
4.81806e-05
1.8072e-06
1.10083e-06
1.14474e-06
1.13044e-06
1.14851e-06
1.18162e-06
1.17895e-06
1.20474e-06
1.20032e-06
1.19514e-06
1.17359e-06
1.14955e-06
1.11993e-06
1.08521e-06
1.08707e-06
1.15272e-06
1.20477e-06
1.31165e-06
1.52363e-06
2.04046e-06
1.81425e-06
2.18232e-06
7.67916e-07
7.89091e-07
1.22519e-06
7.5874e-06
6.91109e-06
3.13407e-05
0.0352909
2.89961e-05
1.74695e-06
1.17259e-06
1.21742e-06
1.19753e-06
1.21329e-06
1.21081e-06
1.1937e-06
1.20936e-06
1.19751e-06
1.19704e-06
1.18664e-06
1.17702e-06
1.17177e-06
1.15185e-06
1.14603e-06
1.17659e-06
1.20455e-06
1.27044e-06
1.39046e-06
1.68144e-06
1.71821e-06
2.41976e-06
7.62098e-07
8.71975e-07
1.58699e-06
8.5835e-06
8.67831e-06
1.02226e-05
0.00876371
2.53833e-05
1.91575e-06
1.25619e-06
1.27198e-06
1.25384e-06
1.23515e-06
1.20433e-06
1.1709e-06
1.15225e-06
1.12338e-06
1.11389e-06
1.12226e-06
1.13151e-06
1.13222e-06
1.14025e-06
1.15755e-06
1.1969e-06
1.26152e-06
1.27248e-06
1.35576e-06
1.47096e-06
1.55717e-06
2.61257e-06
7.92151e-07
9.91426e-07
2.17532e-06
8.91926e-06
0.000118844
9.11081e-06
0.00135327
2.99285e-05
2.14576e-06
1.33382e-06
1.31759e-06
1.28555e-06
1.23804e-06
1.1756e-06
1.13137e-06
1.08369e-06
1.04419e-06
1.01883e-06
1.01047e-06
1.00741e-06
1.00816e-06
1.02514e-06
1.06299e-06
1.11354e-06
1.18204e-06
1.25719e-06
1.34438e-06
1.60814e-06
1.72628e-06
2.92714e-06
8.30134e-07
1.08185e-06
2.57931e-06
9.72712e-06
0.000290974
0.000219011
0.00144299
2.71632e-05
2.1852e-06
1.38003e-06
1.35865e-06
1.31427e-06
1.25611e-06
1.18639e-06
1.15028e-06
1.09923e-06
1.0582e-06
1.0148e-06
9.77882e-07
9.43022e-07
9.29367e-07
9.30259e-07
9.49932e-07
9.95611e-07
1.05695e-06
1.14429e-06
1.31607e-06
1.75335e-06
2.46663e-06
3.57169e-06
9.13499e-07
1.15818e-06
2.61936e-06
9.54071e-06
0.000855853
0.000800733
0.00146619
1.5443e-05
2.03853e-06
1.39652e-06
1.3948e-06
1.35423e-06
1.33621e-06
1.31082e-06
1.30053e-06
1.2678e-06
1.21925e-06
1.1687e-06
1.08101e-06
9.87857e-07
9.29132e-07
8.9293e-07
8.8777e-07
9.09107e-07
9.60511e-07
1.0258e-06
1.19323e-06
1.78713e-06
2.98482e-06
6.34591e-06
1.36954e-06
1.59979e-06
2.59957e-06
9.18062e-06
0.00146118
0.00147156
0.00146702
6.29838e-06
1.71353e-06
1.40659e-06
1.4071e-06
1.40443e-06
1.45566e-06
1.52239e-06
1.56547e-06
1.53814e-06
1.44722e-06
1.36872e-06
1.21324e-06
1.06036e-06
9.63802e-07
8.97386e-07
8.6126e-07
8.63202e-07
8.98173e-07
9.47104e-07
1.03989e-06
1.51488e-06
2.91855e-06
3.3148e-05
4.55472e-06
3.07464e-06
3.27883e-06
7.71682e-06
0.000974171
0.00146549
3.1623e-05
2.67147e-06
1.46542e-06
1.41027e-06
1.40752e-06
1.42775e-06
1.53108e-06
1.70671e-06
1.83078e-06
1.86013e-06
1.74425e-06
1.58005e-06
1.32211e-06
1.12892e-06
9.90048e-07
8.99479e-07
8.48279e-07
8.3117e-07
8.56059e-07
8.92991e-07
9.30095e-07
1.2271e-06
2.87813e-06
0.000171302
0.000118286
7.87041e-06
5.19329e-06
6.62206e-06
1.79651e-05
4.88233e-05
4.39962e-06
1.4771e-06
1.3443e-06
1.35161e-06
1.37549e-06
1.40409e-06
1.52256e-06
1.75585e-06
1.99304e-06
2.20598e-06
2.13921e-06
1.90111e-06
1.51821e-06
1.20681e-06
1.02866e-06
9.04631e-07
8.36562e-07
8.06798e-07
8.12635e-07
8.4232e-07
8.68099e-07
1.08096e-06
3.00721e-06
2.09472e-05
0.00255796
0.000560074
1.06368e-05
6.6542e-06
8.43159e-06
6.02551e-06
1.57432e-06
1.26504e-06
1.28821e-06
1.24568e-06
1.25305e-06
1.26457e-06
1.33927e-06
1.57551e-06
1.96542e-06
2.42069e-06
2.52535e-06
2.29285e-06
1.85008e-06
1.37732e-06
1.10853e-06
9.38072e-07
8.41611e-07
7.9191e-07
7.74608e-07
7.90023e-07
8.21832e-07
1.04532e-06
2.54903e-06
2.1181e-05
0.00399653
0.00355037
0.00020793
7.71771e-06
3.59878e-06
2.80717e-06
1.53955e-06
1.31236e-06
1.24302e-06
1.17081e-06
1.11008e-06
1.06882e-06
1.04468e-06
1.13226e-06
1.52583e-06
2.29199e-06
2.82204e-06
2.63463e-06
2.26943e-06
1.72832e-06
1.26791e-06
1.02396e-06
8.84099e-07
8.02324e-07
7.54704e-07
7.43025e-07
7.70714e-07
1.00287e-06
2.46512e-06
2.95017e-05
0.00396964
0.00405231
0.000699693
6.96418e-06
1.87209e-06
3.55501e-06
2.39941e-06
1.61702e-06
1.36162e-06
1.25775e-06
1.12797e-06
1.03118e-06
9.30147e-07
8.57866e-07
9.04228e-07
1.41361e-06
2.52312e-06
2.89862e-06
2.59849e-06
2.18946e-06
1.58068e-06
1.18004e-06
9.81121e-07
8.5537e-07
7.74876e-07
7.35741e-07
7.47203e-07
1.00603e-06
2.4734e-06
4.14709e-05
0.00405282
0.00397108
2.93276e-05
2.56881e-06
1.70934e-06
3.76565e-06
3.35319e-06
2.51494e-06
1.90061e-06
1.62917e-06
1.43041e-06
1.25676e-06
1.12345e-06
9.85359e-07
8.51677e-07
8.62575e-07
1.48037e-06
2.65913e-06
2.80163e-06
2.55866e-06
2.06292e-06
1.4573e-06
1.14107e-06
9.62079e-07
8.46242e-07
7.77013e-07
7.57857e-07
1.00965e-06
2.52949e-06
3.23077e-05
0.00392697
5.38162e-05
5.56841e-06
1.05657e-06
1.77747e-06
3.23193e-06
3.52781e-06
3.01929e-06
2.70438e-06
2.50791e-06
2.16474e-06
1.82325e-06
1.63458e-06
1.52461e-06
1.39674e-06
1.21634e-06
1.1457e-06
1.65593e-06
2.61186e-06
2.76724e-06
2.55221e-06
1.97061e-06
1.40094e-06
1.1313e-06
9.69822e-07
8.70018e-07
8.12682e-07
1.0174e-06
2.61485e-06
1.77253e-05
1.56882e-05
5.18334e-06
7.09144e-07
7.64354e-07
1.63063e-06
2.59269e-06
3.26305e-06
3.0689e-06
2.81265e-06
2.80397e-06
2.71497e-06
2.47956e-06
2.23636e-06
2.10433e-06
2.02353e-06
1.89853e-06
1.81321e-06
1.36616e-06
1.71863e-06
2.71423e-06
2.82491e-06
2.60718e-06
1.95883e-06
1.41242e-06
1.13515e-06
9.99849e-07
9.11646e-07
1.04968e-06
2.80694e-06
1.38801e-05
2.6526e-06
7.18171e-07
4.75436e-07
7.55016e-07
1.58547e-06
2.24632e-06
2.76149e-06
2.80463e-06
2.63432e-06
2.61426e-06
2.68312e-06
2.59699e-06
2.41907e-06
2.24912e-06
2.09589e-06
1.93421e-06
1.98341e-06
1.76367e-06
1.29554e-06
1.78261e-06
2.93321e-06
3.08615e-06
2.74751e-06
2.04655e-06
1.46856e-06
1.14003e-06
1.02377e-06
1.15249e-06
3.20376e-06
1.26982e-05
1.36856e-06
5.60996e-07
4.61419e-07
7.22224e-07
1.5656e-06
2.02506e-06
2.29138e-06
2.45608e-06
2.38798e-06
2.32877e-06
2.36751e-06
2.37087e-06
2.29269e-06
2.14934e-06
1.9472e-06
1.74935e-06
1.60375e-06
1.65048e-06
1.42924e-06
1.19545e-06
1.93299e-06
3.24895e-06
3.44714e-06
3.04402e-06
2.19876e-06
1.51095e-06
1.15928e-06
1.27661e-06
3.81171e-06
1.1697e-05
1.18772e-06
5.73138e-07
4.5706e-07
6.96507e-07
1.50577e-06
1.88336e-06
1.94785e-06
2.14215e-06
2.15141e-06
2.08215e-06
2.04498e-06
2.01622e-06
1.9455e-06
1.83186e-06
1.71248e-06
1.56807e-06
1.37473e-06
1.24275e-06
1.26629e-06
1.16941e-06
1.13718e-06
2.13564e-06
3.75057e-06
4.03364e-06
3.41681e-06
2.29312e-06
1.51515e-06
1.43205e-06
4.61199e-06
1.06192e-05
1.07236e-06
5.73016e-07
4.57612e-07
6.61236e-07
1.37947e-06
1.73453e-06
1.71723e-06
1.87617e-06
1.96139e-06
1.92059e-06
1.84071e-06
1.77349e-06
1.72385e-06
1.67775e-06
1.60166e-06
1.45522e-06
1.27788e-06
1.13646e-06
1.04084e-06
1.06445e-06
1.01064e-06
1.08725e-06
2.43354e-06
4.52964e-06
4.82965e-06
3.6047e-06
2.17732e-06
1.81572e-06
5.81613e-06
9.7516e-06
9.45542e-07
5.81702e-07
4.62521e-07
6.40143e-07
1.26371e-06
1.5454e-06
1.52015e-06
1.65165e-06
1.79041e-06
1.8024e-06
1.74011e-06
1.67402e-06
1.63983e-06
1.60675e-06
1.52815e-06
1.37874e-06
1.22626e-06
1.10063e-06
9.99838e-07
9.39271e-07
9.50447e-07
8.97351e-07
1.06802e-06
3.12777e-06
5.64772e-06
5.43612e-06
3.23539e-06
2.47927e-06
8.01907e-06
8.83914e-06
8.73485e-07
6.02588e-07
4.69032e-07
6.22608e-07
1.18057e-06
1.34624e-06
1.32531e-06
1.45556e-06
1.6128e-06
1.67469e-06
1.66696e-06
1.62647e-06
1.60492e-06
1.56583e-06
1.48011e-06
1.32806e-06
1.18856e-06
1.07855e-06
9.85794e-07
9.22584e-07
8.70492e-07
8.61139e-07
8.18961e-07
1.25715e-06
5.06056e-06
6.7492e-06
4.75506e-06
3.60141e-06
1.219e-05
8.0362e-06
8.06203e-07
6.19764e-07
4.79355e-07
6.09955e-07
1.11108e-06
1.24818e-06
1.19706e-06
1.27101e-06
1.43673e-06
1.53927e-06
1.57929e-06
1.5826e-06
1.57429e-06
1.53096e-06
1.40793e-06
1.24707e-06
1.11931e-06
1.02742e-06
9.57748e-07
9.13286e-07
8.64767e-07
8.04441e-07
8.03889e-07
7.97351e-07
2.39796e-06
7.26004e-06
6.43354e-06
5.10405e-06
1.91212e-05
7.51457e-06
7.68824e-07
6.25139e-07
4.8873e-07
5.92709e-07
1.05782e-06
1.19918e-06
1.13832e-06
1.15288e-06
1.25398e-06
1.3754e-06
1.44463e-06
1.46482e-06
1.45081e-06
1.36579e-06
1.20041e-06
1.06946e-06
9.92022e-07
9.41905e-07
9.10756e-07
8.86914e-07
8.60913e-07
8.03981e-07
7.50371e-07
7.83129e-07
1.02894e-06
7.39231e-06
6.99142e-06
6.57207e-06
2.86335e-05
6.89179e-06
7.17693e-07
6.38887e-07
5.03591e-07
5.81764e-07
1.01522e-06
1.17264e-06
1.1097e-06
1.10058e-06
1.13074e-06
1.18075e-06
1.21819e-06
1.2114e-06
1.16516e-06
1.08086e-06
1.01019e-06
9.63352e-07
9.23832e-07
8.96945e-07
8.83187e-07
8.60238e-07
8.43707e-07
8.10393e-07
7.43759e-07
7.55458e-07
7.40312e-07
4.88221e-06
6.78802e-06
7.92119e-06
3.90585e-05
6.39819e-06
6.93059e-07
6.43545e-07
5.10902e-07
5.71594e-07
9.75226e-07
1.14445e-06
1.09203e-06
1.0763e-06
1.08088e-06
1.08516e-06
1.07352e-06
1.04762e-06
1.01284e-06
9.70324e-07
9.40385e-07
9.19614e-07
8.96016e-07
8.77643e-07
8.67622e-07
8.46545e-07
8.23083e-07
8.05956e-07
7.5417e-07
7.32435e-07
7.12184e-07
2.38292e-06
6.6644e-06
9.07633e-06
4.80443e-05
6.05144e-06
6.58402e-07
6.49583e-07
5.3607e-07
5.68545e-07
9.35551e-07
1.10268e-06
1.06916e-06
1.0603e-06
1.05886e-06
1.04473e-06
1.01625e-06
9.84029e-07
9.57796e-07
9.28264e-07
9.10315e-07
8.9619e-07
8.79399e-07
8.63842e-07
8.47688e-07
8.31543e-07
8.07124e-07
7.94204e-07
7.59088e-07
7.25929e-07
7.06775e-07
1.31309e-06
6.84119e-06
9.86847e-06
5.35795e-05
5.57224e-06
6.48283e-07
6.7574e-07
5.51924e-07
5.686e-07
8.93468e-07
1.05617e-06
1.03676e-06
1.03378e-06
1.03672e-06
1.02123e-06
9.87151e-07
9.54452e-07
9.31995e-07
9.08035e-07
8.90071e-07
8.66868e-07
8.52796e-07
8.42944e-07
8.28713e-07
8.13715e-07
7.98886e-07
7.85284e-07
7.5741e-07
7.23255e-07
7.00156e-07
8.60265e-07
5.17939e-06
1.00817e-05
6.0742e-05
5.36572e-06
6.40138e-07
6.81466e-07
5.72943e-07
5.69642e-07
8.58136e-07
1.01493e-06
1.00409e-06
9.98019e-07
9.97078e-07
9.80452e-07
9.50172e-07
9.25185e-07
9.04029e-07
8.85512e-07
8.63853e-07
8.44297e-07
8.30198e-07
8.20835e-07
8.11302e-07
7.99105e-07
7.92001e-07
7.79065e-07
7.52397e-07
7.19942e-07
6.92054e-07
6.54301e-07
3.49352e-06
1.00858e-05
6.7578e-05
5.08449e-06
6.20654e-07
7.11916e-07
6.19954e-07
5.77254e-07
8.14476e-07
9.71584e-07
9.72862e-07
9.65549e-07
9.57481e-07
9.34312e-07
9.07649e-07
8.91025e-07
8.74889e-07
8.62772e-07
8.44994e-07
8.29441e-07
8.15643e-07
8.01814e-07
7.92074e-07
7.86426e-07
7.8036e-07
7.69114e-07
7.4611e-07
7.13117e-07
6.83536e-07
5.82432e-07
2.70257e-06
1.02471e-05
7.09229e-05
4.69441e-06
6.12495e-07
7.5652e-07
6.5606e-07
5.91308e-07
7.74336e-07
9.2874e-07
9.39687e-07
9.36284e-07
9.26646e-07
9.06435e-07
8.84686e-07
8.71698e-07
8.60777e-07
8.46284e-07
8.2669e-07
8.13586e-07
8.04613e-07
7.89881e-07
7.77366e-07
7.74337e-07
7.66518e-07
7.55591e-07
7.38208e-07
7.05239e-07
6.71829e-07
5.90453e-07
2.30456e-06
1.02767e-05
7.02579e-05
4.21022e-06
6.10909e-07
7.84809e-07
7.14012e-07
6.18309e-07
7.33361e-07
8.90871e-07
9.0652e-07
9.05667e-07
8.96619e-07
8.82351e-07
8.64958e-07
8.53514e-07
8.45346e-07
8.30767e-07
8.13252e-07
7.99623e-07
7.89105e-07
7.76897e-07
7.67868e-07
7.63579e-07
7.54858e-07
7.42031e-07
7.28525e-07
6.98274e-07
6.63022e-07
6.06692e-07
1.86321e-06
9.12474e-06
6.92513e-05
4.20983e-06
6.10131e-07
7.7784e-07
7.65312e-07
6.54125e-07
7.03628e-07
8.54518e-07
8.75498e-07
8.76317e-07
8.67438e-07
8.55856e-07
8.42058e-07
8.34175e-07
8.28582e-07
8.16172e-07
8.00367e-07
7.86654e-07
7.74743e-07
7.63703e-07
7.59536e-07
7.54054e-07
7.45447e-07
7.30212e-07
7.19134e-07
6.91689e-07
6.60388e-07
6.10283e-07
1.65323e-06
7.61097e-06
6.75553e-05
3.86029e-06
5.96794e-07
8.09362e-07
8.29961e-07
6.82555e-07
6.78646e-07
8.19745e-07
8.45804e-07
8.49896e-07
8.42895e-07
8.35188e-07
8.25704e-07
8.19522e-07
8.14312e-07
8.03473e-07
7.89189e-07
7.7751e-07
7.66779e-07
7.55581e-07
7.5042e-07
7.45708e-07
7.38025e-07
7.23568e-07
7.13201e-07
6.87143e-07
6.58889e-07
6.15975e-07
1.53418e-06
6.26797e-06
6.41922e-05
3.4777e-06
5.85914e-07
8.62607e-07
8.89356e-07
7.17848e-07
6.61069e-07
7.85885e-07
8.16452e-07
8.24993e-07
8.22029e-07
8.1794e-07
8.11379e-07
8.05575e-07
8.01826e-07
7.94135e-07
7.80737e-07
7.69169e-07
7.59251e-07
7.50281e-07
7.44124e-07
7.40685e-07
7.33851e-07
7.23349e-07
7.12376e-07
6.88665e-07
6.59229e-07
6.31825e-07
1.53206e-06
5.28687e-06
3.81947e-05
3.20452e-06
5.71747e-07
9.30523e-07
9.47261e-07
7.51862e-07
6.46942e-07
7.53854e-07
7.89222e-07
8.02634e-07
8.03291e-07
8.01779e-07
7.97658e-07
7.94119e-07
7.90241e-07
7.84373e-07
7.74367e-07
7.61872e-07
7.53198e-07
7.4581e-07
7.41721e-07
7.39461e-07
7.34721e-07
7.26018e-07
7.14768e-07
6.94458e-07
6.63054e-07
6.40403e-07
1.70114e-06
5.40553e-06
3.08819e-05
3.07336e-06
6.39595e-07
9.98536e-07
9.98911e-07
8.06836e-07
6.42157e-07
7.25735e-07
7.64334e-07
7.8406e-07
7.87051e-07
7.88159e-07
7.85909e-07
7.84671e-07
7.80183e-07
7.74613e-07
7.68588e-07
7.57441e-07
7.50578e-07
7.43024e-07
7.40165e-07
7.39062e-07
7.37515e-07
7.31111e-07
7.1896e-07
6.97675e-07
6.50893e-07
6.45656e-07
2.03477e-06
7.71957e-06
3.1756e-05
3.38002e-06
7.24192e-07
1.01887e-06
1.0689e-06
9.23166e-07
6.7362e-07
7.0193e-07
7.41273e-07
7.6806e-07
7.73288e-07
7.77053e-07
7.75837e-07
7.76096e-07
7.73405e-07
7.6815e-07
7.62223e-07
7.54405e-07
7.48777e-07
7.43023e-07
7.39244e-07
7.39025e-07
7.41061e-07
7.36305e-07
7.23317e-07
6.94674e-07
6.14913e-07
6.71413e-07
2.50317e-06
1.23153e-05
8.60657e-05
4.19907e-06
8.18776e-07
1.16331e-06
1.21292e-06
1.08838e-06
7.91956e-07
6.83355e-07
7.20639e-07
7.54234e-07
7.61779e-07
7.67983e-07
7.68125e-07
7.68002e-07
7.67775e-07
7.63901e-07
7.57135e-07
7.51777e-07
7.46655e-07
7.44177e-07
7.39967e-07
7.40688e-07
7.4475e-07
7.39903e-07
7.2455e-07
6.87668e-07
5.93043e-07
6.97809e-07
3.19408e-06
0.000144497
0.000201229
6.51717e-06
1.39697e-06
1.63001e-06
1.40681e-06
1.37583e-06
1.04435e-06
6.71672e-07
7.028e-07
7.42658e-07
7.52703e-07
7.60739e-07
7.62009e-07
7.61756e-07
7.6224e-07
7.5969e-07
7.55128e-07
7.51049e-07
7.45198e-07
7.44716e-07
7.41944e-07
7.4395e-07
7.48672e-07
7.43071e-07
7.23363e-07
6.75166e-07
5.87081e-07
7.09679e-07
4.02377e-06
0.000329122
0.000249085
0.00325658
5.03398e-06
2.7238e-06
1.97601e-06
1.82046e-06
1.38531e-06
6.89681e-07
6.83185e-07
7.32551e-07
7.45699e-07
7.54557e-07
7.57431e-07
7.58083e-07
7.57587e-07
7.55638e-07
7.54554e-07
7.5156e-07
7.45021e-07
7.45456e-07
7.43907e-07
7.47544e-07
7.53438e-07
7.4571e-07
7.21413e-07
6.5737e-07
5.81151e-07
7.37148e-07
4.84305e-06
0.000365518
0.000382452
0.00800848
0.00477277
0.000156251
3.81965e-06
2.78609e-06
1.84439e-06
7.49656e-07
6.67301e-07
7.23837e-07
7.39957e-07
7.49599e-07
7.54372e-07
7.55673e-07
7.54331e-07
7.53148e-07
7.53388e-07
7.50713e-07
7.46787e-07
7.47056e-07
7.46159e-07
7.51426e-07
7.58537e-07
7.47651e-07
7.19987e-07
6.42679e-07
5.8933e-07
8.03629e-07
5.46158e-06
0.000366164
0.000382607
0.00800331
0.0080178
0.00791242
0.000613624
5.97006e-06
2.97721e-06
8.90356e-07
6.62952e-07
7.17967e-07
7.35168e-07
7.46127e-07
7.51986e-07
7.53487e-07
7.53002e-07
7.52582e-07
7.51678e-07
7.50206e-07
7.50128e-07
7.49768e-07
7.50288e-07
7.56468e-07
7.6411e-07
7.50879e-07
7.18873e-07
6.32651e-07
6.07752e-07
8.9329e-07
5.67973e-06
0.000366219
0.000382954
0.000337265
0.0079539
0.00800216
0.00767499
0.000694057
7.55645e-06
1.13628e-06
6.83189e-07
7.16982e-07
7.31134e-07
7.43243e-07
7.49906e-07
7.52171e-07
7.52178e-07
7.52617e-07
7.51655e-07
7.51205e-07
7.52958e-07
7.53032e-07
7.54973e-07
7.63184e-07
7.70793e-07
7.55427e-07
7.14906e-07
6.29876e-07
6.36213e-07
9.56627e-07
5.27036e-06
0.000366721
0.000383683
8.88521e-06
6.12949e-05
0.00227771
0.00639972
0.00629068
1.94843e-05
1.32825e-06
7.5754e-07
7.27858e-07
7.29839e-07
7.3994e-07
7.47725e-07
7.51932e-07
7.51344e-07
7.52158e-07
7.53138e-07
7.5298e-07
7.54768e-07
7.57018e-07
7.60537e-07
7.71184e-07
7.77635e-07
7.58909e-07
7.08419e-07
6.40137e-07
6.76714e-07
1.01981e-06
4.31426e-06
0.000366978
0.00038592
2.30268e-06
2.05663e-06
8.74383e-06
2.97756e-05
4.49215e-05
5.24276e-06
1.21606e-06
9.04754e-07
7.66746e-07
7.34354e-07
7.35408e-07
7.44447e-07
7.51207e-07
7.52348e-07
7.51523e-07
7.54027e-07
7.55661e-07
7.56781e-07
7.61349e-07
7.67742e-07
7.79865e-07
7.84111e-07
7.60836e-07
7.05918e-07
6.56552e-07
7.27716e-07
1.11792e-06
3.42187e-06
1.86834e-05
0.000389358
2.21922e-06
1.00167e-06
1.40022e-06
3.34202e-06
3.85656e-06
2.15517e-06
1.52979e-06
1.11783e-06
8.5994e-07
7.51623e-07
7.33406e-07
7.40119e-07
7.49251e-07
7.52682e-07
7.52704e-07
7.54788e-07
7.57478e-07
7.59548e-07
7.66034e-07
7.75454e-07
7.8872e-07
7.90068e-07
7.63402e-07
7.10332e-07
6.78457e-07
7.96696e-07
1.30161e-06
3.52202e-06
6.32593e-06
2.99282e-05
2.03584e-06
1.04912e-06
7.317e-07
9.15266e-07
1.87171e-06
2.35214e-06
2.01059e-06
1.42726e-06
9.97613e-07
7.99388e-07
7.39999e-07
7.36453e-07
7.46313e-07
7.51878e-07
7.5345e-07
7.54696e-07
7.59093e-07
7.6287e-07
7.70115e-07
7.82805e-07
7.9741e-07
7.9446e-07
7.67393e-07
7.15214e-07
7.19816e-07
8.84255e-07
1.52757e-06
3.65658e-06
4.67485e-06
1.77627e-05
1.93628e-06
1.17524e-06
8.06582e-07
7.09774e-07
1.22437e-06
2.34902e-06
2.25862e-06
1.79976e-06
1.18178e-06
8.85817e-07
7.62102e-07
7.36273e-07
7.42419e-07
7.50756e-07
7.52325e-07
7.53965e-07
7.60437e-07
7.65137e-07
7.73536e-07
7.88951e-07
8.04919e-07
7.97992e-07
7.71754e-07
7.26519e-07
7.73098e-07
1.06299e-06
1.86454e-06
3.94046e-06
3.63424e-06
1.34573e-05
1.92125e-06
1.20715e-06
8.37668e-07
7.07141e-07
7.94351e-07
1.6945e-06
2.43566e-06
2.09109e-06
1.48259e-06
9.94557e-07
8.06467e-07
7.42859e-07
7.38116e-07
7.47101e-07
7.50796e-07
7.5214e-07
7.5989e-07
7.65238e-07
7.77048e-07
7.9382e-07
8.09211e-07
8.02577e-07
7.77173e-07
7.39836e-07
8.30469e-07
1.25466e-06
2.2088e-06
4.23224e-06
3.01871e-06
1.10083e-05
1.95742e-06
1.21058e-06
8.3489e-07
7.11178e-07
6.86647e-07
1.005e-06
2.07425e-06
2.19209e-06
1.78962e-06
1.15141e-06
8.72016e-07
7.5981e-07
7.36138e-07
7.42405e-07
7.46756e-07
7.4896e-07
7.58004e-07
7.62561e-07
7.7926e-07
7.97649e-07
8.09614e-07
8.04409e-07
7.81413e-07
7.50131e-07
8.79327e-07
1.45478e-06
2.48662e-06
4.02819e-06
2.40464e-06
9.40264e-06
1.94035e-06
1.15852e-06
8.03057e-07
7.15922e-07
6.92956e-07
7.4578e-07
1.42202e-06
2.27185e-06
1.99603e-06
1.40108e-06
9.46219e-07
7.93107e-07
7.39888e-07
7.37541e-07
7.40851e-07
7.44238e-07
7.54275e-07
7.57548e-07
7.78526e-07
8.00049e-07
8.06641e-07
8.00518e-07
7.82224e-07
7.5993e-07
9.22059e-07
1.65852e-06
2.65615e-06
3.2295e-06
1.99738e-06
7.88521e-06
1.74898e-06
9.89912e-07
7.44532e-07
7.12934e-07
6.96981e-07
7.08841e-07
9.88802e-07
1.8986e-06
2.04469e-06
1.6429e-06
1.06424e-06
8.46111e-07
7.53817e-07
7.33934e-07
7.34725e-07
7.37345e-07
7.48243e-07
7.50832e-07
7.73799e-07
7.98216e-07
8.00886e-07
7.94547e-07
7.81103e-07
7.64973e-07
9.4941e-07
1.83658e-06
2.74291e-06
2.91351e-06
1.91101e-06
6.1765e-06
1.40209e-06
8.08174e-07
6.98589e-07
7.10355e-07
7.20138e-07
7.07104e-07
7.74352e-07
1.41244e-06
2.06206e-06
1.81309e-06
1.29972e-06
9.18024e-07
7.82323e-07
7.33368e-07
7.26324e-07
7.28954e-07
7.40698e-07
7.4349e-07
7.6495e-07
7.91875e-07
7.9342e-07
7.85469e-07
7.77324e-07
7.69567e-07
9.64889e-07
1.94678e-06
2.7486e-06
2.61246e-06
1.82205e-06
5.30818e-06
1.20905e-06
7.244e-07
6.80123e-07
7.10543e-07
7.37425e-07
7.23654e-07
7.35089e-07
9.92222e-07
1.55278e-06
1.86058e-06
1.57038e-06
1.04071e-06
8.29262e-07
7.37746e-07
7.18457e-07
7.19955e-07
7.31722e-07
7.35729e-07
7.5454e-07
7.82939e-07
7.8679e-07
7.75784e-07
7.69469e-07
7.72134e-07
9.73515e-07
2.03073e-06
2.71193e-06
2.36228e-06
1.69374e-06
5.2662e-06
1.13939e-06
6.86746e-07
6.51352e-07
7.16222e-07
7.48891e-07
7.38054e-07
7.41752e-07
7.63414e-07
1.01444e-06
1.67932e-06
1.74926e-06
1.28612e-06
8.95945e-07
7.55983e-07
7.13495e-07
7.15485e-07
7.28225e-07
7.31671e-07
7.4882e-07
7.73924e-07
7.80595e-07
7.69241e-07
7.61608e-07
7.72269e-07
9.63076e-07
2.02626e-06
2.71008e-06
2.30084e-06
1.54073e-06
7.06555e-06
1.10856e-06
6.46115e-07
6.29095e-07
7.26884e-07
7.53132e-07
7.48559e-07
7.54773e-07
6.77293e-07
6.69125e-07
1.12961e-06
1.76677e-06
1.60488e-06
1.03169e-06
8.02398e-07
7.25509e-07
7.31321e-07
7.4611e-07
7.44297e-07
7.56146e-07
7.76349e-07
7.81829e-07
7.70319e-07
7.55678e-07
7.69663e-07
9.49927e-07
1.99198e-06
2.99759e-06
3.16805e-06
3.86517e-06
0.000197141
1.15806e-06
6.2485e-07
6.21568e-07
7.31809e-07
7.53925e-07
7.57053e-07
7.49792e-07
6.38674e-07
5.56791e-07
7.3582e-07
1.55911e-06
1.98657e-06
1.42949e-06
9.07432e-07
7.89478e-07
8.06719e-07
8.24183e-07
8.07678e-07
7.96812e-07
8.08077e-07
8.07836e-07
7.93614e-07
7.61782e-07
7.75304e-07
9.70751e-07
2.09889e-06
4.30697e-06
6.73458e-06
0.000547153
0.00214417
1.32551e-06
6.11957e-07
6.13041e-07
7.32567e-07
7.51349e-07
7.55781e-07
7.27582e-07
6.14568e-07
5.23228e-07
5.43585e-07
9.9612e-07
2.15909e-06
2.25212e-06
1.45745e-06
1.09055e-06
1.06592e-06
1.02816e-06
9.85783e-07
9.19808e-07
9.13247e-07
9.00588e-07
8.6063e-07
8.04542e-07
8.19532e-07
1.10605e-06
3.06362e-06
9.05351e-06
0.00111751
0.00214485
0.00214913
1.67801e-06
5.834e-07
6.07148e-07
7.28579e-07
7.44579e-07
7.51651e-07
6.96748e-07
5.92715e-07
5.09412e-07
4.84187e-07
6.81303e-07
1.83385e-06
3.48991e-06
2.92749e-06
2.27302e-06
1.7174e-06
1.31707e-06
1.21555e-06
1.10346e-06
1.08731e-06
1.05766e-06
9.89548e-07
9.16484e-07
9.31209e-07
1.31623e-06
4.81626e-06
0.000150868
0.00112433
0.000966795
0.00209462
2.48267e-06
5.47818e-07
6.09412e-07
7.17555e-07
7.33388e-07
7.26588e-07
6.50188e-07
5.71877e-07
4.9777e-07
4.63276e-07
6.05224e-07
1.53885e-06
4.3133e-06
5.0047e-06
4.37782e-06
2.48405e-06
1.63705e-06
1.32574e-06
1.25653e-06
1.25145e-06
1.20058e-06
1.10744e-06
1.04395e-06
1.087e-06
1.30121e-06
2.38638e-06
6.24454e-06
7.86237e-06
3.05765e-06
2.54646e-06
3.9082e-06
4.70227e-07
6.06525e-07
6.96814e-07
7.14321e-07
6.85457e-07
6.1587e-07
5.50516e-07
4.80347e-07
4.5766e-07
6.69317e-07
1.62383e-06
4.45418e-06
6.31181e-06
4.90365e-06
2.30446e-06
1.60544e-06
1.37951e-06
1.33345e-06
1.35178e-06
1.28654e-06
1.22011e-06
1.2253e-06
1.30624e-06
1.29469e-06
1.01948e-06
8.79359e-07
8.58733e-07
1.08486e-06
2.31646e-06
4.8993e-06
4.1968e-07
5.81187e-07
6.67993e-07
6.80342e-07
6.36776e-07
5.8293e-07
5.28533e-07
4.6249e-07
4.80194e-07
8.02546e-07
1.86712e-06
2.21573e-06
1.55661e-06
9.71027e-07
1.00767e-06
9.95053e-07
9.70477e-07
1.01597e-06
1.02002e-06
9.99898e-07
1.02241e-06
1.05824e-06
1.02656e-06
9.72776e-07
1.06492e-06
1.55472e-06
2.14789e-06
2.55391e-06
2.91309e-06
4.66997e-06
4.13038e-07
5.52677e-07
6.32322e-07
6.32409e-07
5.88164e-07
5.47353e-07
5.00329e-07
4.52593e-07
5.20318e-07
8.56742e-07
1.00347e-06
7.2681e-07
6.39276e-07
1.10846e-06
1.06549e-06
9.16658e-07
8.94981e-07
8.88815e-07
8.85995e-07
8.91339e-07
9.1855e-07
9.23009e-07
9.19087e-07
1.12631e-06
1.80899e-06
2.37237e-06
2.63771e-06
2.86927e-06
3.06531e-06
4.62617e-06
4.34895e-07
5.30144e-07
5.88488e-07
5.85326e-07
5.45413e-07
5.11507e-07
4.78442e-07
4.77215e-07
6.04216e-07
7.31935e-07
6.55049e-07
6.94733e-07
1.19552e-06
1.60276e-06
1.59867e-06
1.39953e-06
1.22453e-06
1.11946e-06
1.11768e-06
1.13582e-06
1.1905e-06
1.33816e-06
1.59423e-06
1.9296e-06
2.25785e-06
2.53886e-06
2.72715e-06
2.88537e-06
3.0126e-06
3.98549e-06
4.82134e-07
5.07228e-07
5.4254e-07
5.45569e-07
5.24732e-07
5.14182e-07
5.02607e-07
5.62529e-07
7.28536e-07
7.28116e-07
7.47235e-07
1.0883e-06
1.54646e-06
1.77743e-06
1.77407e-06
1.71913e-06
1.664e-06
1.62834e-06
1.6342e-06
1.66321e-06
1.72535e-06
1.81453e-06
1.93558e-06
2.1273e-06
2.33904e-06
2.51974e-06
2.65653e-06
2.77088e-06
2.85822e-06
1.68403e-06
5.23208e-07
5.14456e-07
5.23985e-07
5.43775e-07
5.70545e-07
5.88222e-07
6.284e-07
7.53472e-07
8.87721e-07
8.32909e-07
1.01194e-06
1.36492e-06
1.65829e-06
1.78255e-06
1.80397e-06
1.7981e-06
1.78415e-06
1.7756e-06
1.78736e-06
1.81844e-06
1.872e-06
1.94502e-06
2.03824e-06
2.16252e-06
2.29866e-06
2.42214e-06
2.52497e-06
2.60968e-06
2.67015e-06
1.21093e-06
6.98712e-07
5.72728e-07
5.94873e-07
6.49038e-07
7.77549e-07
8.38989e-07
9.57123e-07
9.97991e-07
8.77967e-07
9.8986e-07
1.25121e-06
1.51206e-06
1.6729e-06
1.74805e-06
1.77969e-06
1.79579e-06
1.80424e-06
1.81257e-06
1.8295e-06
1.85838e-06
1.90131e-06
1.95734e-06
2.02678e-06
2.11224e-06
2.20549e-06
2.29424e-06
2.37273e-06
2.43762e-06
2.48106e-06
1.22743e-06
8.56119e-07
8.18808e-07
9.14954e-07
1.01294e-06
9.97499e-07
9.57431e-07
9.35011e-07
9.10194e-07
9.90225e-07
1.22909e-06
1.44997e-06
1.58192e-06
1.66206e-06
1.70925e-06
1.74028e-06
1.76319e-06
1.78053e-06
1.79604e-06
1.81459e-06
1.83946e-06
1.87257e-06
1.91429e-06
1.9651e-06
2.0254e-06
2.0912e-06
2.15664e-06
2.21666e-06
2.26641e-06
2.29855e-06
2.04799e-06
9.9422e-07
9.1883e-07
9.10362e-07
9.3089e-07
8.79418e-07
9.01728e-07
9.29e-07
1.06833e-06
1.31056e-06
1.46126e-06
1.54864e-06
1.60311e-06
1.64213e-06
1.67234e-06
1.69813e-06
1.72023e-06
1.73889e-06
1.75548e-06
1.77248e-06
1.79222e-06
1.81635e-06
1.84582e-06
1.88143e-06
1.92356e-06
1.97029e-06
2.018e-06
2.06288e-06
2.10076e-06
2.12504e-06
2.96712e-06
2.03932e-06
1.12163e-06
9.34194e-07
9.2612e-07
9.84268e-07
1.14422e-06
1.34951e-06
1.47083e-06
1.53017e-06
1.56564e-06
1.58629e-06
1.6027e-06
1.61973e-06
1.63847e-06
1.65743e-06
1.67531e-06
1.69117e-06
1.70505e-06
1.71807e-06
1.73169e-06
1.74732e-06
1.76615e-06
1.78916e-06
1.81687e-06
1.84846e-06
1.88187e-06
1.91437e-06
1.94257e-06
1.96116e-06
3.05647e-06
2.69618e-06
2.22574e-06
1.88353e-06
1.75086e-06
1.7108e-06
1.67597e-06
1.63926e-06
1.62943e-06
1.6178e-06
1.60533e-06
1.59608e-06
1.59328e-06
1.59781e-06
1.60722e-06
1.61906e-06
1.63125e-06
1.64226e-06
1.65146e-06
1.65911e-06
1.66608e-06
1.67347e-06
1.68251e-06
1.69436e-06
1.70981e-06
1.72881e-06
1.75034e-06
1.77255e-06
1.79269e-06
1.80668e-06
2.93657e-06
2.72019e-06
2.417e-06
2.16391e-06
1.99182e-06
1.8858e-06
1.80732e-06
1.73828e-06
1.68693e-06
1.64601e-06
1.61437e-06
1.5922e-06
1.58016e-06
1.57638e-06
1.5783e-06
1.5834e-06
1.58943e-06
1.59468e-06
1.59816e-06
1.59969e-06
1.5997e-06
1.59906e-06
1.59896e-06
1.60067e-06
1.60528e-06
1.61336e-06
1.62466e-06
1.63804e-06
1.65138e-06
1.66128e-06
2.71839e-06
2.5803e-06
2.38119e-06
2.19047e-06
2.03591e-06
1.92015e-06
1.82896e-06
1.75257e-06
1.69189e-06
1.64398e-06
1.60728e-06
1.58126e-06
1.56456e-06
1.55535e-06
1.55143e-06
1.55053e-06
1.55055e-06
1.54982e-06
1.54724e-06
1.54238e-06
1.53539e-06
1.52698e-06
1.51825e-06
1.51055e-06
1.50527e-06
1.50347e-06
1.50556e-06
1.51105e-06
1.5184e-06
1.52477e-06
2.46839e-06
2.37651e-06
2.24105e-06
2.10098e-06
1.9774e-06
1.87655e-06
1.79427e-06
1.72595e-06
1.6703e-06
1.62595e-06
1.59147e-06
1.5656e-06
1.54715e-06
1.53466e-06
1.52637e-06
1.52038e-06
1.51492e-06
1.50845e-06
1.49991e-06
1.48876e-06
1.47499e-06
1.45915e-06
1.44226e-06
1.42573e-06
1.41117e-06
1.40009e-06
1.3935e-06
1.39158e-06
1.39337e-06
1.39654e-06
2.21802e-06
2.15632e-06
2.06408e-06
1.96528e-06
1.87454e-06
1.79752e-06
1.73332e-06
1.67981e-06
1.63574e-06
1.59961e-06
1.57028e-06
1.54689e-06
1.52862e-06
1.51442e-06
1.50299e-06
1.49288e-06
1.48263e-06
1.47095e-06
1.45686e-06
1.43979e-06
1.41965e-06
1.39684e-06
1.3723e-06
1.34744e-06
1.32403e-06
1.30398e-06
1.28889e-06
1.27965e-06
1.27595e-06
1.27602e-06
1.98167e-06
1.94127e-06
1.88097e-06
1.81615e-06
1.7562e-06
1.70492e-06
1.66212e-06
1.62613e-06
1.59548e-06
1.56909e-06
1.54629e-06
1.52664e-06
1.50971e-06
1.4949e-06
1.48134e-06
1.46799e-06
1.45372e-06
1.43748e-06
1.41842e-06
1.396e-06
1.37005e-06
1.34087e-06
1.30927e-06
1.2766e-06
1.24473e-06
1.21587e-06
1.19222e-06
1.17543e-06
1.16602e-06
1.16288e-06
1.76491e-06
1.7408e-06
1.70591e-06
1.66987e-06
1.63802e-06
1.6118e-06
1.59017e-06
1.57138e-06
1.55411e-06
1.53763e-06
1.52167e-06
1.50622e-06
1.49125e-06
1.47653e-06
1.46159e-06
1.44576e-06
1.42821e-06
1.40813e-06
1.38479e-06
1.35769e-06
1.32662e-06
1.29177e-06
1.25381e-06
1.21396e-06
1.17408e-06
1.13659e-06
1.10421e-06
1.07944e-06
1.06382e-06
1.05716e-06
1.57043e-06
1.55963e-06
1.54622e-06
1.53537e-06
1.52875e-06
1.52537e-06
1.52313e-06
1.52008e-06
1.51508e-06
1.50776e-06
1.49825e-06
1.48691e-06
1.47405e-06
1.45981e-06
1.44404e-06
1.42635e-06
1.4062e-06
1.38297e-06
1.35605e-06
1.325e-06
1.28957e-06
1.24986e-06
1.20636e-06
1.16013e-06
1.11291e-06
1.06715e-06
1.02597e-06
9.9274e-07
9.70242e-07
9.59573e-07
1.39946e-06
1.4005e-06
1.4064e-06
1.41816e-06
1.43393e-06
1.45056e-06
1.46508e-06
1.4755e-06
1.48096e-06
1.48147e-06
1.47753e-06
1.46982e-06
1.45895e-06
1.44532e-06
1.42905e-06
1.41e-06
1.38783e-06
1.3621e-06
1.3323e-06
1.29804e-06
1.25905e-06
1.21533e-06
1.16724e-06
1.11563e-06
1.062e-06
1.0087e-06
9.59043e-07
9.17128e-07
8.87135e-07
8.71913e-07
1.25601e-06
1.2681e-06
1.29164e-06
1.32328e-06
1.35798e-06
1.39098e-06
1.4189e-06
1.43994e-06
1.45362e-06
1.46028e-06
1.46075e-06
1.45594e-06
1.4467e-06
1.43363e-06
1.41705e-06
1.39702e-06
1.37333e-06
1.34569e-06
1.31368e-06
1.27694e-06
1.2352e-06
1.1884e-06
1.13675e-06
1.0809e-06
1.02212e-06
9.62535e-07
9.05398e-07
8.55279e-07
8.17684e-07
7.97559e-07
1.14839e-06
1.17013e-06
1.20834e-06
1.2556e-06
1.30443e-06
1.34921e-06
1.38657e-06
1.41501e-06
1.43439e-06
1.44533e-06
1.44886e-06
1.44608e-06
1.43799e-06
1.42532e-06
1.40853e-06
1.38779e-06
1.36305e-06
1.33405e-06
1.30048e-06
1.262e-06
1.21834e-06
1.16938e-06
1.11526e-06
1.05648e-06
9.94088e-07
9.29967e-07
8.67202e-07
8.1053e-07
7.66419e-07
7.41806e-07
1.0886e-06
1.11625e-06
1.16325e-06
1.21942e-06
1.27602e-06
1.32714e-06
1.36953e-06
1.40192e-06
1.42432e-06
1.43753e-06
1.44268e-06
1.44096e-06
1.43344e-06
1.42095e-06
1.40401e-06
1.38286e-06
1.3575e-06
1.32774e-06
1.2933e-06
1.25384e-06
1.20912e-06
1.15898e-06
1.10353e-06
1.04319e-06
9.7889e-07
9.12372e-07
8.4658e-07
7.86256e-07
7.38334e-07
7.11055e-07
)
;
boundaryField
{
inlet
{
type calculated;
value nonuniform List<scalar>
30
(
7.93999e-06
7.94e-06
7.93999e-06
7.93997e-06
7.59447e-06
5.857e-06
4.34445e-06
4.76013e-06
6.12728e-06
6.63979e-06
6.63984e-06
6.63987e-06
6.63988e-06
6.63989e-06
6.6399e-06
6.63992e-06
6.63995e-06
6.63995e-06
6.63991e-06
5.9885e-06
4.6353e-06
5.23324e-06
7.09152e-06
8.48445e-06
8.67494e-06
8.67496e-06
8.67497e-06
8.67498e-06
8.67497e-06
8.67498e-06
)
;
}
outlet
{
type calculated;
value nonuniform List<scalar>
30
(
1.0886e-06
1.11625e-06
1.16325e-06
1.21942e-06
1.27602e-06
1.32714e-06
1.36953e-06
1.40192e-06
1.42432e-06
1.43753e-06
1.44268e-06
1.44096e-06
1.43344e-06
1.42095e-06
1.40401e-06
1.38286e-06
1.3575e-06
1.32774e-06
1.2933e-06
1.25384e-06
1.20912e-06
1.15898e-06
1.10353e-06
1.04319e-06
9.7889e-07
9.12372e-07
8.4658e-07
7.86256e-07
7.38334e-07
7.11055e-07
)
;
}
walls
{
type calculated;
value nonuniform List<scalar>
400
(
1.24367e-05
6.64698e-06
1.2216e-05
1.00883e-05
5.41934e-06
3.50717e-06
3.23486e-06
3.01284e-06
3.6955e-06
7.3273e-06
1.5259e-05
1.75017e-05
1.28276e-05
7.60857e-06
6.24293e-06
6.47722e-06
6.9397e-06
7.74554e-06
9.98121e-06
0.000427266
0.00259778
0.00263285
0.00262951
3.08527e-05
5.91638e-06
2.76277e-06
3.14691e-06
3.38259e-06
3.80826e-06
4.3672e-06
4.82086e-06
5.64804e-06
6.49814e-06
7.86777e-06
9.97102e-06
1.22927e-05
1.41849e-05
1.52857e-05
1.58408e-05
1.65968e-05
1.64769e-05
1.37218e-05
0.00140906
0.000724487
3.17644e-05
2.41142e-05
1.94458e-05
1.45591e-05
1.279e-05
1.53529e-05
1.54555e-05
1.43273e-05
2.48904e-05
8.93734e-05
9.26636e-05
0.000111903
0.000467353
1.00113e-05
4.15476e-06
3.64475e-06
4.09785e-06
7.39689e-06
0.00482719
0.00922912
0.00925191
0.00924222
0.00274123
3.71843e-05
0.000826185
0.0137833
0.0214362
0.0207588
0.00347598
0.000372331
0.00021919
0.00266575
0.0398505
0.084595
0.089802
0.0871175
0.0229009
0.0014764
0.000193511
9.54589e-05
9.36402e-05
0.000356897
0.00194555
0.00337319
0.00456606
0.00587871
0.00801019
0.0111052
0.0110973
0.0110592
0.00592413
0.00214945
0.000469741
8.38475e-06
2.81099e-06
3.74408e-06
9.77995e-06
0.000360159
0.00741923
0.031776
0.0370207
0.0246361
0.00109708
0.000725952
0.000811658
1.83281e-05
2.6914e-06
2.27807e-06
2.37104e-06
2.37214e-06
2.24351e-06
2.19291e-06
2.12311e-06
2.07372e-06
2.05516e-06
2.18232e-06
2.41976e-06
2.61257e-06
2.92714e-06
3.57169e-06
6.34591e-06
3.3148e-05
0.000171302
2.09472e-05
2.1181e-05
2.95017e-05
4.14709e-05
3.23077e-05
1.77253e-05
1.38801e-05
1.26982e-05
1.1697e-05
1.06192e-05
9.7516e-06
8.83914e-06
8.0362e-06
7.51457e-06
6.89179e-06
6.39819e-06
6.05144e-06
5.57224e-06
5.36572e-06
5.08449e-06
4.69441e-06
4.21022e-06
4.20983e-06
3.86029e-06
3.4777e-06
3.20452e-06
3.07336e-06
3.38002e-06
4.19907e-06
6.51717e-06
0.00325658
0.00800848
0.00800331
0.000337265
8.88521e-06
2.30268e-06
2.21922e-06
2.03584e-06
1.93628e-06
1.92125e-06
1.95742e-06
1.94035e-06
1.74898e-06
1.40209e-06
1.20905e-06
1.13939e-06
1.10856e-06
1.15806e-06
1.32551e-06
1.67801e-06
2.48267e-06
3.9082e-06
4.8993e-06
4.66997e-06
4.62617e-06
3.98549e-06
1.68403e-06
1.21093e-06
1.22743e-06
2.04799e-06
2.96712e-06
3.05647e-06
2.93657e-06
2.71839e-06
2.46839e-06
2.21802e-06
1.98167e-06
1.76491e-06
1.57043e-06
1.39946e-06
1.25601e-06
1.14839e-06
1.0886e-06
1.28798e-05
8.73322e-06
1.13358e-05
5.66637e-06
3.93461e-06
3.64453e-06
3.47559e-06
3.54149e-06
4.93599e-06
8.56832e-06
1.35721e-05
0.000157638
1.85619e-05
6.84319e-06
4.82709e-06
5.5436e-06
8.56743e-06
0.000295535
0.00435251
0.00557942
0.00557677
0.00284777
2.15492e-05
3.74239e-06
1.82356e-06
2.67347e-06
4.90072e-06
8.46567e-06
1.27256e-05
1.56853e-05
1.61978e-05
1.28014e-05
9.11418e-06
7.07926e-06
5.73645e-06
4.51011e-06
3.86731e-06
4.31827e-06
5.5811e-06
7.56463e-06
0.000238213
0.000541915
0.000544141
7.20507e-05
2.86244e-05
1.6388e-05
1.35019e-05
1.355e-05
1.38075e-05
1.46352e-05
1.50629e-05
7.70493e-05
0.000275155
0.000494237
0.000660708
0.00066753
0.0006684
0.000668123
0.000669379
4.65528e-05
0.000125729
0.000429961
0.000680911
0.000771272
0.000797562
0.000798989
0.000800652
0.000807679
0.000823902
0.000842746
0.000862565
0.000891368
0.000947304
0.00106279
0.00129189
0.00171808
0.00245634
0.00365276
0.00550633
0.00829395
0.0124077
0.0184943
0.0279423
0.0436233
0.0668815
0.0786883
0.0830105
0.0863694
0.0891549
0.0916425
0.0939587
0.0959761
0.0973479
0.0980009
0.0980694
0.0979602
0.0877159
0.00741573
1.17865e-05
1.11298e-05
0.00115196
0.0791807
0.0865825
0.0866133
0.0855754
1.85807e-05
2.95982e-06
1.76019e-06
1.73014e-06
1.66558e-06
1.61055e-06
1.57577e-06
1.56463e-06
1.5769e-06
1.61376e-06
1.67322e-06
1.75855e-06
1.83743e-06
1.81425e-06
1.71821e-06
1.55717e-06
1.72628e-06
2.46663e-06
2.98482e-06
2.91855e-06
2.87813e-06
3.00721e-06
2.54903e-06
2.46512e-06
2.4734e-06
2.52949e-06
2.61485e-06
2.80694e-06
3.20376e-06
3.81171e-06
4.61199e-06
5.81613e-06
8.01907e-06
1.219e-05
1.91212e-05
2.86335e-05
3.90585e-05
4.80443e-05
5.35795e-05
6.0742e-05
6.7578e-05
7.09229e-05
7.02579e-05
6.92513e-05
6.75553e-05
6.41922e-05
3.81947e-05
3.08819e-05
3.1756e-05
8.60657e-05
0.000201229
0.000249085
0.000382452
0.000382607
0.000382954
0.000383683
0.00038592
0.000389358
2.99282e-05
1.77627e-05
1.34573e-05
1.10083e-05
9.40264e-06
7.88521e-06
6.1765e-06
5.30818e-06
5.2662e-06
7.06555e-06
0.000197141
0.00214417
0.00214913
0.00209462
2.54646e-06
2.31646e-06
2.91309e-06
3.06531e-06
3.0126e-06
2.85822e-06
2.67015e-06
2.48106e-06
2.29855e-06
2.12504e-06
1.96116e-06
1.80668e-06
1.66128e-06
1.52477e-06
1.39654e-06
1.27602e-06
1.16288e-06
1.05716e-06
9.59573e-07
8.71913e-07
7.97559e-07
7.41806e-07
7.11055e-07
)
;
}
frontAndBackPlanes
{
type empty;
}
}
// ************************************************************************* //
|
3cf00bc79a78e0293c749968847c6d939a184cbe | 76f8eb2650e1464de9ce456ef2aaa1e717b8f746 | /assignment2/main.cpp | 22e76618b2127c3b6e99503eefbbdeb82ffffd4c | [] | no_license | priyankb/translators | 5e3570664ca0d0009113974cfd25300b9ad27897 | 056c6e734355b0382e6820bbcbadb1a092b80abe | refs/heads/master | 2020-04-10T02:44:49.186228 | 2018-12-07T02:04:29 | 2018-12-07T02:04:29 | 160,751,621 | 0 | 0 | null | 2018-12-07T01:55:10 | 2018-12-07T00:59:04 | null | UTF-8 | C++ | false | false | 1,009 | cpp | main.cpp | //#include <stdio.h>
#include <stdlib.h>
#include "scanner.h"
#include <iostream>
#include <string>
#include <vector>
#include <cstring>
#include <set>
extern int yylex();
extern int yylineno;
extern char* yytext;
extern std::vector<std::string*> lines;
extern std::set<std::string> myset;
using namespace std;
int main(){
//printf("Running Lex....\n");
//int token;
//token = yylex();
std::vector<std::string*>::iterator vecIter;
std::set<std::string>::iterator setIter;
if(!yylex()){
printf("#include <iostream>\n");
printf("int main(){\n");
/*if(lines.empty()){
cout << "is empty" << endl;
}
else{
cout << "not empty" << endl;
}*/
for(setIter = myset.begin(); setIter != myset.end(); ++setIter){
cout << "double " << *setIter << ";" << endl;
}
cout << endl;
for(vecIter = lines.begin(); vecIter != lines.end(); ++vecIter){
cout << **vecIter << endl;
}
cout << "}" << endl;
}
return 0;
}
|
d115c14214de6960a80eae0cea11381f18ef191e | c0ed29b81cae76a9d7f5e0dda2292413770194e2 | /inc/Property.h | d4eddb92a1d047a0b2ba240156f908c7983aa296 | [] | no_license | BreakEngine/Break-0.0 | f72f628d4a0412bc9804594627e0af2964469dbb | d912a165e167c4f8022d7857cf137ee70b3d8312 | refs/heads/master | 2020-04-11T10:47:54.970599 | 2015-09-28T18:48:51 | 2015-09-28T18:48:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,646 | h | Property.h | #pragma once
#include "AccessException.h"
#include <iostream>
#include "GlobalDefinitions.h"
namespace Break{
namespace Infrastructure{
BREAK_API_EX enum Permission{
READ,WRITE,READ_WRITE
};
/**
* @class Property
*
* @brief A property.
*
* @author Moustapha Saad
* @date 10/02/2015
*
* @tparam Prop Type of the property that it contains.
* @tparam Obj Type of the object that holds this property.
*/
template<class Prop, class Obj, Permission permission>
class BREAK_API_EX Property{
/**
* @typedef Prop(Obj::* _get)()
*
* @brief Defines an alias representing the get function.
*/
typedef Prop(Obj::* _get)();
/**
* @typedef void (Obj::* _set)(Prop)
*
* @brief Defines an alias representing the set function.
*/
typedef void (Obj::* _set)(Prop);
/** @brief an instance of the class that holds the property. */
Obj& instance;
/** @brief function pointer to the get function. */
_get get;
/** @brief function pointer to the set function. */
_set set;
/**
* @fn Prop Property::getVal()
*
* @brief Gets the value from the object.
*
* @author Moustapha Saad
* @date 10/02/2015
*
* @return The value.
*/
Prop getVal(){
if(permission == READ || permission == READ_WRITE)
return (instance.*get)();
else
throw accessException("Can't perform operation due to protection levels");
}
Prop getVal()const{
if(permission == READ || permission == READ_WRITE)
return (instance.*get)();
else
throw accessException("Can't perform operation due to protection levels");
}
/**
* @fn void Property::setVal(Prop& val)
*
* @brief Sets a value.
*
* @author Moustapha Saad
* @date 10/02/2015
*
* @param [in,out] val The value.
*/
void setVal(const Prop& val){
if(permission == WRITE || permission == READ_WRITE)
(instance.*set)(val);
else
throw accessException("Can't perform operation due to protection levels");
}
public:
/**
* @fn Property::Property(Obj& obj, _get g, _set s)
*
* @brief Constructor.
*
* @author Moustapha Saad
* @date 10/02/2015
*
* @param [in,out] obj The object.
* @param g The _get function.
* @param s The _set function.
*/
Property(Obj& obj, _get g, _set s):instance(obj), get(g), set(s){
}
/**
* @fn operator Property::Prop()
*
* @brief Cast that converts the given to a Prop.
*
* @author Moustapha Saad
* @date 10/02/2015
*
* @return The result of the operation.
*/
operator Prop(){
return getVal();
}
operator Prop()const{
return (getVal());
}
/**
* @fn void Property::operator=(Prop& val)
*
* @brief Assignment operator.
*
* @author Moustapha Saad
* @date 10/02/2015
*
* @param [in,out] val The value.
*/
Prop operator->()const{
return getVal();
}
void operator =(const Prop& val){
setVal(val);
}
Prop operator +=(const Prop& val){
setVal(getVal()+val);
return *this;
}
Prop operator -=(const Prop& val){
setVal(getVal()-val);
return *this;
}
Prop operator *=(const Prop& val){
setVal(getVal()*val);
return *this;
}
Prop operator /=(const Prop& val){
setVal(getVal()/val);
return *this;
}
Prop operator %=(const Prop& val){
setVal(getVal()%val);
return *this;
}
friend std::ostream& operator<< (std::ostream& stream, const Prop& val) {
stream<<val;
return stream;
}
};
}
} |
7afec948d1a2ea5dadd326c0f2107c1e78f6542e | f2ee9bacc1372e55d7fc538e187e7e26b739d525 | /thread/function.h | 67ae503efd0bb03f449ea561d9d2b869c69cb34e | [] | no_license | fmknowledge/thread | af0b697162bfa1255491ddd137b2f69149e050cb | c4d458fe89c7d9b4a757ac8abf4b25cf29970464 | refs/heads/master | 2021-09-25T19:25:58.443419 | 2018-10-25T02:42:07 | 2018-10-25T02:42:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 302 | h | function.h |
#pragma once
#ifndef CLASSAA
#define CLASSAA
#include "singleton.h"
#include <iostream>
namespace wiseos {
class AA
{
public:
std::string test1(
std::string &aa,
std::string &bb);
int test2(
int &a,
int &b);
void test3();
private:
SINGLETON_DECL(AA);
};
}
#endif // CLASSAA |
fc4db26f96aae95e709fe43b6dc55f35a13f995b | 08380dfbdc50e4e29f005e23c3fe024915b57dcb | /simparameters.cpp | 836a2dccea6cd87d053d226182ade1661024e82e | [] | no_license | gurbinder533/3D_fluid_simulation | 41f21a00f1acaa28f24c40496b97a9a5515e898c | 334f25a9dfa091a429b02d598bc5cf143ef90294 | refs/heads/master | 2021-01-23T12:20:48.430792 | 2015-08-26T16:05:34 | 2015-08-26T16:05:34 | 40,015,017 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 401 | cpp | simparameters.cpp | #include "simparameters.h"
SimParameters::SimParameters()
{
simRunning = false;
timeStep = 0.001;
densityMagnitude = 200;
velocityMagnitude = 20;
diffusionConstant = 0.02;
viscosityFluid = 0.2;
buoyancy = 4.0;
source1 = true;
source2 = false;
source3 = false;
source4 = false;
velsource1 = false;
velsource2 = false;
velsource3 = false;
}
|
8e8c821bad663eb818a3bfe575eeca3b2721f420 | 49e6997bb90eb20254578af4abbd86c8a00c5b7a | /code/11.0/Project1/h/BufferManage.h | 035e69f914bff21f7a2ddd66288d69cb3c55a63c | [] | no_license | ersula/Mini-SQL | ca11b6dedee47f4193d97ee688b44d21c7fa8362 | a93040aca0681a63beb951d93caa0668ab041c2f | refs/heads/main | 2022-12-20T09:38:51.047215 | 2020-10-25T13:21:15 | 2020-10-25T13:21:15 | 307,097,712 | 2 | 1 | null | null | null | null | GB18030 | C++ | false | false | 2,190 | h | BufferManage.h | #ifndef _BufferManage_H
#define _BufferManage_H
#define OneBlockSize 4096 //the size of one Block is 4KB
#define BlockNum 300//the max number of the blocks
#define EMPTY '\0'
#include<iostream>
#include<string>
#include<fstream>
using namespace std;
/*
块中的基本信息:内存中
存放信息的字符型数组、块号、脏数据位、锁
*/
class Block
{
public:
string fileName;/*表示fileName文件的内存块*/
bool Dirty;/*是否被修改*/
bool isEmpty;/*是否为空*/
bool Pin;/*是否被锁*/
int blockIndex;/*表示对应的fileName文件的块号*/
int LRU;/*表示未使用次数*/
char data[OneBlockSize + 1];/*内存中存储的信息*/
Block()/*重载函数*/
{
initialize();
}
void initialize()/*初始化*/
{
fileName = "";
Dirty = false;
isEmpty = true;
Pin = false;
blockIndex = 0;
LRU = 0;
for (int i = 0; i < OneBlockSize; i++) data[i] = EMPTY;
data[OneBlockSize] = '\0';
}
string readBlockSeg(int start, int end)/*得到内存信息start-end位置的字符串*/
{
string content = "";
for (int i = start; i < end; i++)
{
content += data[i];
}
return content;
}
};
class BufferManage
{
public:
Block bufferBlock[BlockNum];
BufferManage();
~BufferManage();
void BufferFlush(int bufferIndex);
/*将buffercache里的这一块写到文件中*/
int GetBufferIndex(string fileName, int blockIndex);
/*根据文件的名字和块号得到内存中的下标,返回缓存索引bufferIndex*/
void BufferRead(string fileName, int blockIndex, int bufferIndex);
/*从磁盘中读取信息存到内存中*/
void RecordBuffer(int bufferIndex);
/*记录buffer调用次数,用于LRU算法*/
int GetEmptyBuffer();
/*找到空闲的缓存索引*/
int checkInBuffer(string fileName, int blockIndex);
/*查找磁盘中该块是否已经写入了内存*/
void BufferPin(int bufferIndex);
/*将缓冲区锁住,使其不可被替换*/
void deleteFile(string fileName);
/*删除磁盘文件*/
void writeToFile(int bufferIndex);
/*将内存中的块写到文件中并不清空内存*/
};
#endif
|
1e8bcc8ed1515c6a4cb0ad1a8cc6fd9d4b474f75 | 7498906ed42295fba4ac9e34a299359b2b85d430 | /Linked List/Top 20/Merge Lists Alternatingly.cpp | 5c563c1bb98efa73d6d3a117e62c8b2ad9b314ee | [] | no_license | addiegupta/GfGProblems | 81e4301e9183b9ccb974823185553cef666d934e | 0da9e2bd10ce82f644664a7738c94078d636693c | refs/heads/master | 2022-07-14T11:54:29.854926 | 2022-06-30T10:06:57 | 2022-06-30T10:06:57 | 141,699,143 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,756 | cpp | Merge Lists Alternatingly.cpp | /*
GeeksForGeeks: Merge Lists Alternatingly
Link to Problem: https://practice.geeksforgeeks.org/problems/merge-list-alternatingly/1
Difficulty: Easy
Given two linked lists, your task is to complete the function mergeList() which insert's nodes of second list into first list at alternate positions of first list.
For example:
Input:
List1- 5->7->17->13->11
List2- 12->10->2->4->6
Output:
List1- 5->12->7->10->17->2->13->4->11->6
List2- (empty)
The nodes of second list should only be inserted when there are positions available.
For example:
Input:
List1- 1->2->3
List2- 4->5->6->7->8
Output:
List1- 1->4->2->5->3->6
List2- 7->8
Input:
The function takes 2 arguments as input, the reference pointer to the head of the two linked list's(head1 & head2).
There will be T test cases and for each test case the function will be called separately.
Output:
For each test case first print space separated vales of the first linked list, then in the next line print space separated values of the second linked list.
Constraints:
1<=T<=100
1<=N<=100
Example:
Input:
2
2
9 10
6
5 4 3 2 1 6
5
99 88 77 66 55
5
55 44 33 22 11
Output:
10 6 9 1
2 3 4 5
55 11 66 22 77 33 88 44 99 55
*/
{
#include<stdio.h>
#include<stdlib.h>
#include<bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node *next;
};
void push(struct Node ** head_ref, int new_data)
{
struct Node* new_node = (struct Node*) malloc(sizeof(struct Node));
new_node->data = new_data;
new_node->next = (*head_ref);
(*head_ref) = new_node;
}
void printList(struct Node *head)
{
struct Node *temp = head;
while (temp != NULL)
{
cout<<temp->data<<' ';
temp = temp->next;
}
cout<<'
';
}
void mergeList(struct Node **head1, struct Node **head2);
// Driver program to test above functions
int main()
{
int T;
cin>>T;
while(T--){
int n1, n2, tmp;
struct Node *a = NULL;
struct Node *b = NULL;
cin>>n1;
while(n1--){
cin>>tmp;
push(&a, tmp);
}
cin>>n2;
while(n2--){
cin>>tmp;
push(&b, tmp);
}
mergeList(&a, &b);
printList(a);
printList(b);
}
return 0;
}
}
/*Please note that it's Function problem i.e.
you need to write your solution in the form of Function(s) only.
Driver Code to call/invoke your function is mentioned above.*/
/*
structure of the node of the linked list is
struct Node
{
int data;
struct Node *next;
};
*/
// complete this function
void mergeList(struct Node **p, struct Node **q)
{
Node* trav1 = *p;
Node* trav2 = *q;
while(trav1&&trav2){
Node* tempList1 = trav1->next;
*q=trav2->next;
trav1->next=trav2;
trav2->next = tempList1;
trav2=*q;
trav1=trav1->next->next;
}
} |
40253419851f219d4f6d253e5eb2e7343ab5fe12 | c3ff828f92ae8cd8703dcec4062d234cb6920aa0 | /src/FiniteVolume/ImmersedBoundary/StepImmersedBoundaryObject.h | 8f4648cecbea8b016638bfe1c6cc5932697257d5 | [] | no_license | cfd-learner/Phase | 2db58130fe57b9ef6f271795c8a36bd174312f83 | 9f4eb06e061763434c23d51e907388e3996e7820 | refs/heads/master | 2021-06-24T03:15:57.219644 | 2017-09-08T00:06:18 | 2017-09-08T00:06:18 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 606 | h | StepImmersedBoundaryObject.h | #ifndef STEP_IMMERSED_BOUNDARY_OBJECT
#define STEP_IMMERSED_BOUNDARY_OBJECT
#include "ImmersedBoundaryObject.h"
class StepImmersedBoundaryObject: public ImmersedBoundaryObject
{
public:
using ImmersedBoundaryObject::ImmersedBoundaryObject;
virtual void update(Scalar timeStep);
virtual void updateCells();
virtual Equation<Scalar> bcs(ScalarFiniteVolumeField& field) const;
virtual Equation<Vector2D> bcs(VectorFiniteVolumeField& field) const;
void computeForce(Scalar rho, Scalar mu, const VectorFiniteVolumeField& u, const ScalarFiniteVolumeField& p);
private:
};
#endif |
666629ef2952fc666e5794ceec3c618d373004c9 | a071d07770b2bc654fec15d916df5966c19ec377 | /src/io/model_importers/TRI/TRIVertex.hpp | e473d6875b0961b8df3df17b23dd0b94ff5ac8f0 | [] | no_license | joshi1983/UAVSim | 8381ab53713a17e63fdb7b9222dfd3e0ce2a396c | 6ca74fb85158c2ef8b342cca38720a370fefb2e7 | refs/heads/master | 2023-07-06T04:58:16.386970 | 2021-08-06T19:16:19 | 2021-08-13T03:36:42 | 359,058,663 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 307 | hpp | TRIVertex.hpp | #ifndef TRI_VERTEX_HEADER_INCLUDED
#define TRI_VERTEX_HEADER_INCLUDED
#include "../../../models/Vector3D.hpp"
#include "../../../models/Colour.hpp"
#include <string>
class TRIVertex
{
public:
void loadFromLine(const std::string& line);
Vector3D position;
Vector3D normal;
Colour colour;
};
#endif |
55aea8cb3787e2a5b57a0270018bf92fc7a18bde | 6777af0193d9e85b96cf0c8f72d4be6fb932f97b | /源.cpp | b2157c44e966f9abd98eaa33d236e02e495df097 | [] | no_license | ldwbaba/Snake | 9181b065231f548fea48c5bc080e1f16b8b1a325 | c98c28306d24718dfa7c4201189b959cd841e4b7 | refs/heads/master | 2023-03-12T18:04:25.533169 | 2021-03-01T08:52:01 | 2021-03-01T08:52:01 | 343,340,686 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 715 | cpp | 源.cpp |
#include "Snake.h"
#include "Unit.h"
#include "Food.h"
#include "Contrl.h"
#include <iostream>
using namespace std;
//定义为全局
int main()
{
Contrl cPlay;
Unit uPlay;
cPlay.selectMode(uPlay.startGame());
////实现一些蛇
//contrl.snake = &snake1;
//contrl.selectMode(unit.startGame());
//contrl.food->creatFood();
//contrl.snake->initSnake();
//contrl.unit->p = contrl.snake->pHead;
//contrl.x = contrl.snake->pHead->x;
//contrl.y = contrl.snake->pHead->y;
//contrl.showGrade();
//创建线程,创建完了之后,线程函数开始之心,且与主线程同事执行
//控制光标
cPlay.unit->setPos(0, 30);
//cout << "GAME OVER!" << endl;
system("pause");
return 0;
}
|
81da1a1e5def70e337613dea5ffcbb68141894a8 | b1d4202f14853b3a2f49c0400749267b8d847ee4 | /Programming_Assignment_7/Caesar.h | 9415ca6419ab142488d5d98524d9d20dbaf40e2d | [] | no_license | longmatthew/CPT_S_122_Assignments | 382302acf2b6f2c5cf5b76b75d5a03185a9338db | 857fbedbb91af055a57e8d119b026d9313315b97 | refs/heads/master | 2021-01-24T22:36:16.616689 | 2015-01-21T22:32:05 | 2015-01-21T22:32:05 | 27,289,697 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 960 | h | Caesar.h | #ifndef CAESAR_HEADER // Inclusion of Header 'Lock'
#define CAESAR_HEADER
#include "Cipher.h" // inclusion of Cipher header.
// Caesar Shift Class inherting from Cipher Base Class.
class Caesar : public Cipher
{
public:
Caesar(); // Constructor
~Caesar(); // Destructor
Caesar(Caesar ©); // Copy Constructor.
virtual void encryption(); // Encryption inherited from base class.
virtual void decryption(); // Decryption inherited from base class.
// Support functions to gather information from user.
void askKey();
void breakKey();
void breakForce();
// Getters.
int getKey() const;
string getEncodedmessage() const;
string getDecodedmessage() const;
// Setters.
void setKey(int newKey);
void setEncodedmessage(string newEncodedmessage);
void setDecodedmessage(string newDecodedmessage);
private:
// private data members.
int key;
string encodedMessage;
string decodedMessage;
};
#endif // End of 'Lock'
|
638107e41d6fdd6606966915e4efe67019ddb28e | 9df24e9110f06ea1004588c87a908c68497b22c0 | /2016/嵌套矩形标程.cpp | 2415693686825c907323ccece15bf89ca340e13f | [] | no_license | zhangz5434/code | b98f9df50f9ec687342737a4a2eaa9ef5bbf5579 | def5fdcdc19c01f34ab08c5f27fe9d1b7253ba4f | refs/heads/master | 2020-07-02T17:24:14.355545 | 2019-03-13T12:39:45 | 2019-03-13T12:39:45 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,612 | cpp | 嵌套矩形标程.cpp | #include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int n,ans=0,k;
int a[1000],b[1000];
int f[1000+10]={0};//f[i]表示从i点出发的最长路
int g[1000+10]={0};//g[i]表示从i点出发的最短路
int map[1000+10][1000+10]={0}; //判断2个矩形是否存在可镶嵌的关系【有向图】
int dp(int i)
{
if(f[i])return f[i];//记忆化搜索
//如果当前情况已访问过直接返回
f[i]=1;//未尝试,赋初值
for(int j=1;j<=n;j++)
{
if(map[i][j])f[i]=max(f[i],dp(j)+1);
//状态转移方程
}
return f[i];
}
void print(int i)//输出从i开始
{
cout<<i<<' ';
for(int j=1;j<=n;j++)
if(map[i][j]&&f[i]==f[j]+1)//如果i能嵌套在j内,输出i后面的矩形
{
print(j);
break;
}
}
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%d%d",&a[i],&b[i]);
}
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
{
if((a[i]<a[j]&&b[i]<b[j])||(a[i]<b[j]&&b[i]<a[j]))map[i][j]=1;
}//判断图是否存在,是否可以镶嵌
for(int i=1;i<=n;i++)f[i]=dp(i);
//尝试每个矩形镶嵌
for(int i=1;i<=n;i++)if(ans<f[i])ans=f[k=i];//找出最大的f[i],并记录结点号k
printf("%d\n",ans);
print(k);
return 0;
}
|
18c2f4cc380b6cd6c5957b15c01f55d7f4b7b369 | ec378fa391c5eed6d52c24fc209e3aca29d5ac38 | /vb/main.cpp | 76deb9a7958bdef45c61d46718fb7fb0b24f8011 | [] | no_license | Westermin/TicTacToe | 8ae9b3e2b5a2aa03183f444fff96753bbcdffb0b | f89ad2bfd6d035cf2d3aca4b1931c83d34f70b6e | refs/heads/master | 2020-07-06T10:34:24.548327 | 2016-09-27T11:18:58 | 2016-09-27T11:18:58 | 67,445,595 | 1 | 1 | null | 2016-09-05T19:57:54 | 2016-09-05T19:22:30 | C++ | UTF-8 | C++ | false | false | 5,433 | cpp | main.cpp | #include "stdafx.h"
#include <stdint.h>
#include <iostream>
#include <string>
#include "C:\Users\Christian\Desktop\serial-master\include\serial\serial.h"
using std::string;
using std::exception;
using std::endl;
char square[9] = { '1', '2', '3', '4', '5', '6', '7', '8', '9' };
char player[2] = { 'X', 'O' };
int turn = 0;
bool arduinoisconnected = false;
int main();
void board();
void game();
int checkwin = 0;
int idx = 0;
int choice;
int play_game;
int c1, c2, c3, c4, c5, c6, c7, c8, c9 = 0;
int checkForWinner();
// application reads from the specified serial port and reports the collected data
int main()
{
// ACTUAL CODE *******************************************************************************
game();
std::cout << "Would you like to play again?" << endl;
std::cin >> play_game;
if (play_game == 1)
{
c1, c2, c3, c4, c5, c6, c7, c8, c9 = 0;
char square[9] = { '1', '2', '3', '4', '5', '6', '7', '8', '9' };
game();
}
else {
std::cout << "okay" << endl;
}
return 0;
}
void game()
{
string port;
unsigned long baud = 9600;
std::cout << "Your port: ";
std::cin >> port;
serial::Serial my_serial(port, baud, serial::Timeout::simpleTimeout(3000));
my_serial.setTimeout(serial::Timeout::simpleTimeout(2000));
if (my_serial.isOpen()) {
std::cout << "Connected to the port!" << std::endl;
}
else {
}
std::cout << std::endl;
string received_bytes;
do {
idx = (turn % 2 == 0) ? 1 : 2;
board();
std::cout << "Turn:" << turn << ", Player " << idx << ", enter a number: ";
std::cin >> choice;
bool validChoice = true;
my_serial.read(received_bytes);
std::cout << "Received bytes!" << std::endl;
//int rec_chance = std::stoi(received_bytes);
int rec_chance = 1;
if ((choice == 1 || rec_chance == 1) && c1 == 0)
{
square[choice - 1] = player[idx - 1];
square[rec_chance - 1] = player[idx - 1];
c1 = 1;
turn++;
}
else if ((choice == 2 || rec_chance == 2) && c2 == 0)
{
square[choice - 1] = player[idx - 1];
square[rec_chance - 1] = player[idx - 1];
c2 = 1;
turn++;
}
else if ((choice == 3 || rec_chance == 3) && c3 == 0)
{
square[choice - 1] = player[idx - 1];
square[rec_chance - 1] = player[idx - 1];
c3 = 1;
turn++;
}
else if ((choice == 4 || rec_chance == 4) && c4 == 0)
{
square[choice - 1] = player[idx - 1];
square[rec_chance - 1] = player[idx - 1];
c4 = 1;
turn++;
}
else if ((choice == 5 || rec_chance == 5) && c5 == 0)
{
square[choice - 1] = player[idx - 1];
square[rec_chance - 1] = player[idx - 1];
c5 = 1;
turn++;
}
else if ((choice == 6 || rec_chance == 6) && c6 == 0)
{
square[choice - 1] = player[idx - 1];
square[rec_chance - 1] = player[idx - 1];
c6 = 1;
turn++;
}
else if ((choice == 7 || rec_chance == 7) && c7 == 0)
{
square[choice - 1] = player[idx - 1];
square[rec_chance - 1] = player[idx - 1];
c7 = 1;
turn++;
}
else if ((choice == 8 || rec_chance == 8) && c8 == 0)
{
square[choice - 1] = player[idx - 1];
square[rec_chance - 1] = player[idx - 1];
c8 = 1;
turn++;
}
else if ((choice == 9 || rec_chance == 9) && c9 == 0)
{
square[choice - 1] = player[idx - 1];
square[rec_chance - 1] = player[idx - 1];
c9 = 1;
turn++;
}
else
{
std::cout << "Invalid move" << std::endl;
validChoice = false;
}
if (validChoice)
{
std::string s = std::to_string(choice);
size_t sent_bytes = my_serial.write(s);
std::cout << "Bytes sent!" << std::endl;
}
board();
checkwin = checkForWinner();
} while (checkwin == -1);
if (checkwin == 1)
{
std::cout << "The player " << idx << " win.";
}
else
{
std::cout << "Game draw.";
std::cout << checkwin << std::endl;
}
}
void board()
{
// a lot of shit
std::cout << "Player's turn: " << player[1] << std::endl;
std::cout << " _____ _____ _____ " << std::endl;
std::cout << "| | | |" << std::endl;
std::cout << "| " << square[0] << " | " << square[1] << " | " << square[2] << " |" << std::endl;
std::cout << "|_____|_____|_____|" << std::endl;
std::cout << "| | | |" << std::endl;
std::cout << "| " << square[3] << " | " << square[4] << " | " << square[5] << " |" << std::endl;
std::cout << "|_____|_____|_____|" << std::endl;
std::cout << "| | | |" << std::endl;
std::cout << "| " << square[6] << " | " << square[7] << " | " << square[8] << " |" << std::endl;
std::cout << "|_____|_____|_____|" << std::endl;
}
// look for any possible winning combination
// returns 1 if there's a winner, 0 for a draw, -1 the game continues
int checkForWinner()
{
if (square[0] == square[1] && square[1] == square[2])
return 1;
else if (square[3] == square[4] && square[4] == square[5])
return 1;
else if (square[6] == square[7] && square[7] == square[8])
return 1;
else if (square[0] == square[3] && square[3] == square[6])
return 1;
else if (square[1] == square[4] && square[4] == square[7])
return 1;
else if (square[2] == square[5] && square[5] == square[8])
return 1;
else if (square[0] == square[4] && square[4] == square[8])
return 1;
else if (square[2] == square[4] && square[4] == square[6])
return 1;
else if (square[0] != '1' && square[1] != '2' && square[2] != '3' && square[3] != '4' && square[4] != '5' && square[5] != '6' && square[6] != '7' && square[7] != '8' && square[8] != '9')
return 0;
else
return -1;
}
|
283a3ac8213634d5b02a40ce3424863d5b6eab1d | 50125cf115787cc8062d1098565065557a986b4c | /ODDEVENLIST.cpp | 0a4759b69849cc495ac5e201b269b9645ac37e97 | [] | no_license | krithvi/CAT1-Assignment | dcf40ed8de58fef7c8c37cdb3b0a27a7e062cad7 | aa5f8918bc95b4e730656cd206fc26ac141a9276 | refs/heads/master | 2020-07-05T04:53:42.649217 | 2019-08-27T16:54:43 | 2019-08-27T16:54:43 | 202,528,502 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,298 | cpp | ODDEVENLIST.cpp | #include<iostream>
using namespace std;
//Segregate the even and odd values based on the data in the nodes into two linked lists.
struct node
{
int value;
struct node *next;
};
class list
{
struct node *head;
int n;
public:
list()
{
head = NULL;
n = 0;
}
void insEnd(int x)
{
struct node *temp,*curr;
temp = new node;
temp->value=x;
temp->next = NULL;
if(head==NULL) //adding first element
{
head = temp;
n++;
return;
}
for(curr=head;curr->next!=NULL;curr=curr->next);
curr->next=temp;
n++;
}
void disp()
{
struct node *temp;
if(head!=NULL)
{
for(temp=head;temp!=NULL;temp=temp->next)
cout<<temp->value<<" ";
}
else
cout<<"Empty list."<<endl;
}
friend void eovalues(list l);
};
void eovalues(list l)
{
list e,o;
struct node *p;
for(p=l.head;p!=NULL;p=p->next)
{
if(p->value%2==0)
e.insEnd(p->value);
else
o.insEnd(p->value);
}
cout<<"Even List: ";
e.disp();
cout<<endl;
cout<<"Odd List: ";
o.disp();
cout<<endl;
}
main()
{
list l;
int q,c=1;
do
{
cout<<"Enter a value for the list: ";
cin>>q;
l.insEnd(q);
cout<<"Do you want to add elements to your list?";
cin>>c;
}while(c!=0);
cout<<"The list entered is:";
l.disp();
cout<<endl;
eovalues(l);
}
|
95569828d435b28f8e93e66cfb8ac57910979a6c | 4009eddec797c49c1c4babced91c394516564e01 | /Level-1-Array/keypadApproch.cpp | fa08362ab75c6564a31bfe798c44e7b679572348 | [] | no_license | vinay5656/CPP-Coding-Ninjas | 0ebc1b95aefa5c96b694eb6235ec6bb1bfb61aff | b6d57aa51fa4ff45d769e20705df92c4a56a2201 | refs/heads/main | 2023-08-07T18:18:29.438353 | 2021-09-29T16:11:07 | 2021-09-29T16:11:07 | 411,731,667 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,372 | cpp | keypadApproch.cpp | #include<iostream>
using namespace std;
int keypadApproch(string output[],int num){
if(num==0 ||num==1){
output[0] = "";
return 1;
}
int numOf = keypadApproch(output,num/10);
int subsquencesize = numOf;
num = num%10;
string str;
if(num==2){
str = "ABC";
}else if(num==3){
str = "DEF";
}else if(num==4){
str = "GHI";
}else if(num==5){
str = "JKL";
}else if(num==6){
str = "MNO";
}else if(num==7){
str = "PQRS";
}else if(num==8){
str = "TUV";
}else if(num==9){
str = "WXYZ";
}
int sizeOfStr = str.length();
for(int i=1;i<sizeOfStr;i++){
for(int j=0;j<numOf;j++){
output[subsquencesize+j] = output[j];
}
subsquencesize = subsquencesize+numOf;
}
int i=0;
for(;i<sizeOfStr;){
for(int j=1;j<=subsquencesize;j++){
output[j-1] = output[j-1]+str[i];
if(j % numOf ==0){
i++;
}
}
}
return subsquencesize;
}
int main(){
int number;
string output[1000];
cin>>number;
int size = keypadApproch(output,number);
cout<<"size = "<<size<<endl;
for(int i=0;i<size;i++){
cout<<output[i]<<" "<<endl;
}
return 0;
} |
18bdbbcd72e4c41ddeec85ce81301cb146cc0b18 | a54ca44c3a5eaf3b090bbcf7b03e9e13ecdee013 | /Paradox/src/System/Scene/Scene.cpp | 879de19228f480534bf59b867357e9e92ee025ad | [] | no_license | sysfce2/SFML_Paradox | 2a891a15fa24a22d23173e510393dde706afb572 | d7ee266f79e7d145311f0877b03980b1351a08a7 | refs/heads/master | 2023-03-16T09:51:34.770766 | 2018-11-25T22:38:25 | 2018-11-25T22:38:25 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,233 | cpp | Scene.cpp | #include <System/Scene/Scene.hpp>
// C++
#include <fstream>
#include <iomanip>
#include <iostream>
// SFML
#include <SFML/Graphics/RenderTarget.hpp>
#include <SFML/Graphics/CircleShape.hpp>
#include <SFML/Graphics/RectangleShape.hpp>
// Paradox
#include <System/Logic/TransformSystem.hpp>
#include <System/Logic/RenderSystem.hpp>
#include <System/Component/Property.hpp>
#include <System/Component/SpriteRenderer.hpp>
#include <System/Component/ShapeRenderer.hpp>
#include <System/Component/Transform.hpp>
// Json
#include <json/json.hpp>
using namespace nlohmann;
namespace paradox
{
Scene::Scene() :
m_name("untitled.scene"),
m_transformSystem(std::make_unique<TransformSystem>()),
m_renderSystem(std::make_unique<RenderSystem>())
{
// Add a basic entity for test
/*auto entity = m_entities.create();
auto shape = std::make_unique<sf::CircleShape>(5.f);
shape->setFillColor(sf::Color::Red);
m_entities.assign<Property>(entity, "gameObject");
m_entities.assign<Transform>(entity, sf::Vector2f(200.f, 200.f), sf::Vector2f(1.f, 1.f), 0.f);
m_entities.assign<ShapeRenderer>(entity, std::move(shape));*/
}
Scene::~Scene()
{
m_transformSystem.reset();
m_renderSystem.reset();
}
void Scene::loadScene(const std::string& path)
{
json input;
std::ifstream handle;
std::ios_base::iostate exceptionMask = handle.exceptions() | std::ios::failbit;
handle.exceptions(exceptionMask);
try
{
handle.open(path);
handle >> input;
handle.close();
}
catch (const std::ios_base::failure& e)
{
std::cerr << "Error: Failed reading " << path << " -> " << std::strerror(errno) << std::endl; // TODO: log to game console
}
if (!input.empty())
{
// Set current scene name
std::string tempPath = path;
std::replace(tempPath.begin(), tempPath.end(), '\\', '/');
const auto found = tempPath.find_last_of("/");
const auto name = tempPath.substr(found + 1);
// Make sure we don't append scene data to the current scene
if (m_name != name)
{
unloadScene();
m_name = name;
}
// Load scene data
for (unsigned i = 0; i < input["size"]; ++i)
{
auto entity = m_entities.create();
// Property
m_entities.assign<Property>(entity, input["scene"][i]["property"]["name"].get<std::string>());
// Transform
m_entities.assign<Transform>(
entity,
sf::Vector2f(input["scene"][i]["transform"]["position"][0], input["scene"][i]["transform"]["position"][1]),
sf::Vector2f(input["scene"][i]["transform"]["scale"][0], input["scene"][i]["transform"]["scale"][1]),
input["scene"][i]["transform"]["rotation"]);
// Render shapes
if (input["scene"][i]["spriteRenderer"].is_object())
{
auto sprite = std::make_unique<sf::Sprite>(); // TODO: add texture here
sprite->setColor(
sf::Color(input["scene"][i]["spriteRenderer"]["color"][0],
input["scene"][i]["spriteRenderer"]["color"][1],
input["scene"][i]["spriteRenderer"]["color"][2]));
// Prevent transform glitch when loading a scene
auto transform = m_entities.get<Transform>(entity);
sprite->setPosition(transform.position);
sprite->setScale(transform.scale);
sprite->setRotation(transform.rotation);
m_entities.assign<SpriteRenderer>(entity, std::move(sprite));
}
else if (input["scene"][i]["shapeRenderer"].is_object())
{
if (input["scene"][i]["shapeRenderer"]["type"] == "Circle")
{
auto circle = std::make_unique<sf::CircleShape>(input["scene"][i]["shapeRenderer"]["radius"].get<float>());
circle->setFillColor(
sf::Color(input["scene"][i]["shapeRenderer"]["color"][0],
input["scene"][i]["shapeRenderer"]["color"][1],
input["scene"][i]["shapeRenderer"]["color"][2]));
// Prevent transform glitch when loading a scene
auto transform = m_entities.get<Transform>(entity);
circle->setPosition(transform.position);
circle->setScale(transform.scale);
circle->setRotation(transform.rotation);
m_entities.assign<ShapeRenderer>(entity, std::move(circle));
}
}
}
}
}
void Scene::saveScene()
{
// Dump scene file
json output;
unsigned index = 0;
output["size"] = m_entities.alive();
m_entities.each([this, &index, &output](const auto& entity)
{
// Property
auto& property = m_entities.get<Property>(entity);
output["scene"][index]["property"]["name"] = property.name;
// Transform
auto& transform = m_entities.get<Transform>(entity);
output["scene"][index]["transform"]["position"] = { transform.position.x, transform.position.y };
output["scene"][index]["transform"]["scale"] = { transform.scale.x, transform.scale.y };
output["scene"][index]["transform"]["rotation"] = transform.rotation;
// Render shapes
if (m_entities.has<SpriteRenderer>(entity))
{
auto& spriteRenderer = m_entities.get<SpriteRenderer>(entity);
auto color = spriteRenderer.sprite->getColor();
output["scene"][index]["spriteRenderer"]["color"] = { color.r, color.g, color.b };
}
else if (m_entities.has<ShapeRenderer>(entity))
{
auto& shapeRenderer = m_entities.get<ShapeRenderer>(entity);
auto fillColor = shapeRenderer.shape->getFillColor();
output["scene"][index]["shapeRenderer"]["color"] = { fillColor.r, fillColor.g, fillColor.b };
if (typeid(*shapeRenderer.shape.get()) == typeid(sf::CircleShape))
{
auto circle = dynamic_cast<sf::CircleShape*>(shapeRenderer.shape.get());
output["scene"][index]["shapeRenderer"]["type"] = "Circle";
output["scene"][index]["shapeRenderer"]["radius"] = circle->getRadius();
}
}
index++;
});
std::ofstream o("meta/" + m_name); // Hardcoded meta folder
o << std::setw(4) << output << std::endl;
o.close();
}
void Scene::unloadScene()
{
m_entities.destroy<Property>();
}
void Scene::update()
{
m_transformSystem->update(m_entities);
}
void Scene::draw(sf::RenderTarget& target)
{
m_renderSystem->update(m_entities, target);
}
void Scene::setName(const std::string& name)
{
m_name = name;
}
std::string Scene::getName() const
{
return m_name;
}
entt::registry<unsigned>& Scene::getEntities()
{
return m_entities;
}
} |
f70bc8afec6c4e3f3a9eb4b78e57178a8cb412fe | 13fd4fed91fa0d42c1ac59e6ba5273010f5f7f1c | /Дружественный класс SCode/Дружественный класс SCode/Дружественный класс SCode.cpp | 812f4b97b6318ce4c32f6b159d3d9af5b2924568 | [] | no_license | Morzhling/My-Cpp-training | 9b1488b557dfafbcabcc4d675874b86dddc1ef79 | 8e372e105f8d05dd152cc1be1666dc36413b430b | refs/heads/master | 2020-04-27T11:04:28.002711 | 2019-07-29T19:51:10 | 2019-07-29T19:51:10 | 174,282,022 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 671 | cpp | Дружественный класс SCode.cpp | #include <iostream>
#include <string>
using namespace std;
class Human;
class Apple;
class Human
{
public:
void TakeApple(Apple& apple);
//{
// cout << "Take Apple\t" << "Weight\t" << apple.weight << "Color\t" << apple.color << endl;
//}
void EatApple(Apple& apple);
};
class Apple
{
friend Human;
int weight;
string color;
public:
Apple(int weight, string color)
{
this->weight = weight;
this->color = color;
}
};
int main()
{
Apple apple(250, "Green");
Human man;
man.TakeApple(apple);
return 0;
}
void Human::TakeApple(Apple& apple)
{
cout << "\tTake Apple\t" << "Weight\t" << apple.weight << "\tColor\t" << apple.color << endl;
}
|
2f849ca88fced85ab0dacebd74ee7a51c3279aa0 | 8051d618498b99445ac1142287016c92f6ab2525 | /priorityQueue/Assignment/BuyTheTicket.cpp | 52bfe3b7aedd4fe27638464aa998187081383ffe | [] | no_license | Muzain187/level4 | b0c60c3bb589da5a684bd034fbe6fa91d1929de3 | ce59aeae751786962f95f36bbe9f798ccf8b18cd | refs/heads/main | 2023-08-13T17:29:58.147737 | 2021-10-17T16:19:22 | 2021-10-17T16:19:22 | 408,895,215 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,138 | cpp | BuyTheTicket.cpp | #include<queue>
int buyTicket(int *arr, int n, int k) {
// Write your code here
queue<int>q;
priority_queue<int>pq;
for(int i=0;i<n;i++){ // only one for is required
q.push(arr[i]);
pq.push(arr[i]);
}
int counter=0;
while(!pq.empty()){
if(arr[q.front()] == pq.top()){
q.pop();
pq.pop();
counter+=1;
k--;
if(counter == k){
return counter+1;
}
}
else{
int element = q.front();
q.pop();
q.push(element);
}
}
// if(q.front()==pq.top()){
// if(k==0){
// return counter+1;
// }
// else{
// counter++;
// q.pop();
// pq.pop();
// k--;
// }
// }
// else{
// q.push(q.front());
// q.pop();
// if(k==0){
// k=q.size()-1;
// }
// else{
// k--;
// }
// }
return counter;
}
|
1f046f281983eda59b6b30693c4b568c82cea630 | 75a4460bbbcaff3080e6d69686e1f8e8bed2e0e6 | /enumWindows/enumWindows/enumWindows.cpp | 833d4f51ca91bc19562315edfd4be74bacd4517a | [] | no_license | Charyas/cxxsln | d1ebb9531094f0b1204a4d7c8bbbd598ad0887b0 | 5f70bbd91561f4a2ac912fb7607a03baf1a9f367 | refs/heads/master | 2021-01-17T12:42:49.975669 | 2016-06-21T01:03:35 | 2016-06-21T01:03:35 | 58,186,919 | 1 | 0 | null | null | null | null | GB18030 | C++ | false | false | 2,806 | cpp | enumWindows.cpp | // enumWindows.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "enumWindows.h"
#include <stdio.h>
#define MAX_LOADSTRING 100
typedef struct ctrl_btn{
HANDLE hButton;
wchar_t buff[64];
}CTRLBTN;
CTRLBTN ctrlBtnStru[3] = { 0 };
static int loop = 0;
BOOL CALLBACK EnumChildProc(HWND hWnd, LPARAM lParam);
char* THCAR2char(TCHAR* tchStr)
{
int iLen = 2 * wcslen(tchStr);//CString,TCHAR汉字算一个字符,因此不用普通计算长度
char* chRtn = new char[iLen + 1];
wcstombs(chRtn, tchStr, iLen + 1);
return chRtn;
}
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPTSTR lpCmdLine,
_In_ int nCmdShow)
{
HWND hWnd = ::FindWindow(_T("#32770"), _T("Windows 安全"));
::EnumChildWindows(hWnd, EnumChildProc, 0);
//SetFocus(hWnd);
//SetForegroundWindow(hWnd);
HWND hBwnd = ::FindWindowEx(hWnd, NULL, _T("DirectUIHWND"), NULL);
//SetForegroundWindow(hBwnd);
//SetFocus(hWnd);
//DWORD e;
//LPARAM lparam = MAKELPARAM(60, 140);
//LRESULT result;
//= ::SendMessage(hBwnd, WM_SETCURSOR, 0, lparam);
//::PostMessage(hBwnd, WM_MOUSEMOVE, 0, lparam);
//::SendMessage(hBwnd, WM_ACTIVATE, HTCLIENT, WM_LBUTTONDOWN);
//::SendMessage(hBwnd, WM_SETCURSOR, HTCLIENT, WM_LBUTTONDOWN);
//ChangeWndMessageFilter(WM_LBUTTONDOWN, TRUE);
//ChangeWndMessageFilter(WM_LBUTTONUP, TRUE);
//result = ::PostMessage(hBwnd, WM_LBUTTONDOWN, MK_LBUTTON, lparam);
//result = ::PostMessage(hBwnd, WM_LBUTTONUP, 0, lparam);
//e = GetLastError();
//result = ::PostMessage(hBwnd, WM_LBUTTONDOWN, MK_LBUTTON, lparam);
//result = ::PostMessage(hBwnd, WM_LBUTTONUP, 0, lparam);
TCHAR szFilePath[MAX_PATH + 1];
GetModuleFileName(NULL, szFilePath, MAX_PATH);
(_tcsrchr(szFilePath, _T('\\')))[1] = 0;
//FILE *file;
//file = fopen();
TCHAR filename[32] = _T("trace.log");
_tcscat_s(szFilePath, MAX_PATH+1, filename);
//FILE* file;
//file = fopen(THCAR2char(szFilePath), "w+");
char* p;
for (int i = 0; i < 3; i++) {
if (wcscmp(ctrlBtnStru[i].buff, _T("安装(&I)")) == 0) {
::SendMessage((HWND)ctrlBtnStru[i].hButton, BM_CLICK, 0, 0);
p = "using first\n";
//fwrite(p, 1, strlen(p), file);
}
if (wcscmp(ctrlBtnStru[i].buff, _T("始终安装此驱动程序软件(&I)")) == 0) {
::SendMessage((HWND)ctrlBtnStru[i].hButton, BM_CLICK, 0, 0);
p = "using second\n";
//fwrite(p, 1, strlen(p), file);
}
}
//fclose(file);
return 0;
}
BOOL CALLBACK EnumChildProc(HWND hWnd, LPARAM lParam)
{
wchar_t buff[64] = { 0 };
GetClassName(hWnd, buff, 63);
if (wcscmp(_T("Button"), buff) == 0) {
ctrlBtnStru[loop].hButton = hWnd;
GetWindowText(hWnd, buff, 63);
memcpy(ctrlBtnStru[loop].buff, buff, 64);
loop += 1;
}
return true;
} |
f65ad86f595f7e60a777a834f6a238b8612b6b12 | b0f8bc3c9791ee2279f07452b911c8edab0fc548 | /dynamic-memory-allocation/1-basics.cpp | 77ce43c6b4fcda2951ce49f7a741285f7f142fd4 | [] | no_license | siddhantv10/algo | 5354cee84f6d6b9ac2d994de00791aa0dedae315 | 1185de6c4d35d0ae1e1141a43e1b4181f361f70e | refs/heads/master | 2023-01-12T19:11:04.488315 | 2020-11-13T14:55:36 | 2020-11-13T14:55:36 | 272,968,675 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 749 | cpp | 1-basics.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
//Static - Compile time allocation
int b[100];
cout<<sizeof(b)<<endl;
cout<<b<<endl; //from symbol table
//b cannot be overwritten as it is read only (static memory)
//Dynamic - Runtime allocation
int n;
cin>>n;
int *a = new int[n]{0}; //initializes all elements with zero
cout<<sizeof(a)<<endl; //constant = will be sizeof pointer for your system
cout<<a<<endl; //from static memory
// can be overwritten which will lead to memory leak
//no change in working
for(int i=0; i<n; i++){
cin>>a[i];
cout<<a[i]<<" ";
}
//Deallocation
delete [] a;
cout<<endl;
return 0;
} |
b6888e2cfe908a4ebe14312a4d588979ffc9be57 | fa7feda744825b8bfd84a739905f00ec5efee395 | /01 - March 10/E/E.cpp | 00cb51c632eb128c0f3ded3bc7c2649b8d442a48 | [] | no_license | thomasokubo/MC521 | 7c8dcfa185cea96cb6bd02ffe29972aa90479e25 | 54e415b1a43e2b48683df0227d43dba6bcc216b1 | refs/heads/master | 2020-03-23T08:03:26.855365 | 2018-07-25T22:26:43 | 2018-07-25T22:26:43 | 141,305,758 | 1 | 0 | null | 2018-07-24T22:56:50 | 2018-07-17T15:03:06 | C++ | UTF-8 | C++ | false | false | 1,421 | cpp | E.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <ctime>
#include <stdlib.h>
using namespace std;
vector< pair<int,int> > soldier;
vector<int> alive;
vector<int> death;
int main(){
int i, j,aux, count=0;
int s, b, l, r;
// le o numero de soldados e o numeros de mortes
cin >> s >> b;
while((s)&&(b)) {
count++;
death.push_back(b);
soldier.push_back(make_pair(0,0));
for(i=1;i<s;i++) soldier.push_back(make_pair(i-1,i+1));
soldier.push_back(make_pair(i-1,0));
// le b linhas de mortes, cada uma contendo o intervalo de mortos
for(i=0;i<b;i++) {
cin >> l>> r;
alive.push_back(soldier[l].first);
alive.push_back(soldier[r].second);
soldier[soldier[l].first].second = soldier[r].second;
soldier[soldier[r].second].first = soldier[l].first;
}
soldier.clear();
cin >> s>> b;
}
// Imprime o resultado
s = 0;
for(i=0;i<count; i++) { // cada case
for(j=0;j<death[i];j++) { // cada case tem b mortes
if(alive[s*2]) cout << alive[s*2];
else cout << "*";
cout << " ";
if(alive[s*2+1]) cout << alive[s*2+1] << endl;
else cout << "*" << endl;
s++;
}
cout << "-" << endl;
}
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.