blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 201 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 7 100 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 260
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 11.4k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 80
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 8 9.86M | extension stringclasses 52
values | content stringlengths 8 9.86M | authors listlengths 1 1 | author stringlengths 0 119 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ecd5a405cbd7f60a71ec4e04f8f6f7134a96eba6 | 44587eba2feda6671cb0963ef0fd81031eb41735 | /makeSigmaGraph.cxx | 2d1b0e37e42a578e9d04d0210dbb50371eb96dbd | [] | no_license | FujimotoMinori/testTMVA | 281f2fbee26be39cd975f64a8ae47087c1ed3f71 | ac78c4723865b8772a6b7331d353e28da1884e67 | refs/heads/master | 2021-04-13T06:22:36.238617 | 2020-05-05T06:51:56 | 2020-05-05T06:51:56 | 249,142,991 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,421 | cxx | void setGraph(TGraph* g, int color){
g->SetMarkerColor(color);
g->SetLineColor(color);
g->SetMarkerStyle(20);
g->SetMarkerSize(0.7);
g->GetYaxis()->SetRangeUser(-0.2,1.2);
g->GetYaxis()->SetTitle("Z");
g->GetXaxis()->SetTitle("#sigma");
g->SetTitle("");
return;
}
void makeSigmaGraph(){
//read files
TString ifn = "original_0504_cutflow.txt";
TString ifnl2 = "l2jet_0504_cutflow.txt";
ifstream fin,finl2;
std::string str,str2;
//open files
fin.open(ifn);
finl2.open(ifnl2);
vector<Float_t> sigma;
vector<Float_t> Z,Zl2;
//read file
std::cout << "reading file..." << std::endl;
float a,b,al2,bl2;
while(getline(fin,str))
{
sscanf(str.data(), "%f\t%f", &a,&b);
sigma.push_back(a);
Z.push_back(b);
}
while(getline(finl2,str2))
{
sscanf(str2.data(), "%f\t%f", &al2,&bl2);
Zl2.push_back(bl2);
}
//set graphs
int n = sigma.size();
Float_t* sigmapointer=&(sigma.at(0));
Float_t* Zpointer=&(Z.at(0));
Float_t* Zl2pointer=&(Zl2.at(0));
TGraph *gr = new TGraph(n,sigmapointer,Zpointer);
TGraph *gr2 = new TGraph(n,sigmapointer,Zl2pointer);
//set config of grapus
setGraph(gr,kRed);
setGraph(gr2,kBlue);
//set legend
TLegend *l = new TLegend();
//draw graphs
TCanvas *c = new TCanvas("c","c",700,500);
gr->Draw("APL");
gr2->Draw("PL same");
c->Print("SigmaGraph.pdf");
fin.close();
finl2.close();
return;
}
| [
"minori.fujimoto@cern.ch"
] | minori.fujimoto@cern.ch |
6ae011db7c2f70ac67659487b451584fc5168a10 | fc0635634e57f6d550f95aad163c5441e074b69f | /bbs/bbsutl2.h | 931b9fcd49787601fd35543eed4ed930e6b5c11f | [
"Apache-2.0"
] | permissive | ericpareja/wwiv | 6797f87b8a50a81c653fecf916094f8012f9e49a | d705f701ab9b67006545069a41726d147269c4d5 | refs/heads/master | 2021-01-18T16:17:34.305055 | 2020-11-12T11:16:53 | 2020-11-12T11:16:53 | 38,795,691 | 0 | 0 | null | 2015-07-09T03:51:34 | 2015-07-09T03:51:34 | null | UTF-8 | C++ | false | false | 1,517 | h | /**************************************************************************/
/* */
/* WWIV Version 5.x */
/* Copyright (C)1998-2020, WWIV Software Services */
/* */
/* 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 __INCLUDED_BBS_BBSUTL2_H__
#define __INCLUDED_BBS_BBSUTL2_H__
#include <string>
std::string ctypes(int num);
std::string strip_to_node(const std::string& txt);
#endif // __INCLUDED_BBS_BBSUTL2_H__ | [
"rushfan@wwivbbs.org"
] | rushfan@wwivbbs.org |
ad77c57d4a3d724b2c1c6bd8edcc7105eceb84a4 | 0808de6337cad95dca3b8452b27ee61dbbeb0b0e | /Crystal_Density/Source Files/3D/Cell/Obtain_T2_Centres.cpp | 55d6515f4c418178050fd99872b0e50822816169 | [] | no_license | Phil-Smith1/Pre-Voronoi_Zone_Density_Functions | 88ab9cb9161bf8ec0cc22bc2c13e701a0273cf65 | 026fe20ab227cef479deebb1be2836f6fd59dce5 | refs/heads/master | 2023-01-27T21:16:04.371297 | 2020-12-10T18:00:22 | 2020-12-10T18:00:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,435 | cpp | #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
using namespace std;
using namespace CGAL;
typedef Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_3 P3;
void Obtain_T2_Centres ( vector<P3>const& atom_cloud, string const& type_of_experiment, vector<P3>& T2_centres )
{
int num_molecules = atom_cloud.size() / (double)46;
T2_centres.reserve( num_molecules );
for (int counter = 0; counter < num_molecules; ++counter)
{
P3 atom_1 = atom_cloud[9 + counter * 32], atom_2 = atom_cloud[22 + counter * 32];
P3 oxygen_1 = atom_cloud[0 + counter * 32];
P3 oxygen_2 = atom_cloud[1 + counter * 32];
P3 oxygen_3 = atom_cloud[2 + counter * 32];
P3 centre = P3( 0.5 * (atom_1.x() + atom_2.x()), 0.5 * (atom_1.y() + atom_2.y()), 0.5 * (atom_1.z() + atom_2.z()) );
if (type_of_experiment == "Molecule_Centres") T2_centres.push_back( centre );
else if (type_of_experiment == "Molecule_Centres_with_Oxygens")
{
T2_centres.push_back( oxygen_1 );
T2_centres.push_back( oxygen_2 );
T2_centres.push_back( oxygen_3 );
T2_centres.push_back( centre );
}
else
{
T2_centres.push_back( oxygen_1 );
T2_centres.push_back( oxygen_2 );
T2_centres.push_back( oxygen_3 );
}
}
}
| [
"pvsmith100@btinternet.com"
] | pvsmith100@btinternet.com |
6836d6e8962af8a1163fff381c8bb6d83397546a | 6dfdbefc50f6dc4aa84e01ac2aabf0df5d07ca39 | /plugins/mapper/src/mapper_export.cpp | 3e59a90a9a176dbbf0b13b3cdc2d9ff9a23b3ecc | [] | no_license | kvirund/tortilla | 04a6f8c1802294f09db79c5b61e675c8da54d8b9 | 338f2cf575a8b90057d291ba79a164ade749a635 | refs/heads/master | 2020-04-08T03:48:49.591154 | 2018-11-30T02:34:48 | 2018-11-30T02:34:48 | 158,787,484 | 0 | 0 | null | 2018-11-23T06:01:59 | 2018-11-23T06:01:58 | null | WINDOWS-1251 | C++ | false | false | 6,675 | cpp | #include "stdafx.h"
#include "../res/resource.h"
#include "properties.h"
#include "mapper.h"
#include "debugHelpers.h"
#include "mapperUnitTests.h"
bool map_active = false;
PropertiesMapper m_props;
luaT_window m_parent_window;
Mapper* m_mapper_window = NULL;
//-------------------------------------------------------------------------
int get_name(lua_State *L)
{
luaT_pushwstring(L, L"Карта");
return 1;
}
int get_description(lua_State *L)
{
luaT_pushwstring(L,
L"Отображает схему комнат и выходов. Показывает местоположение игрока.\r\n"
L"Предназначен для мадов с 6 стандартными выходами.\r\n"
L"Требует для работы поддержки MSDP протокола от мад-сервера c\r\n"
L"данными о местоположении."
);
return 1;
}
int get_version(lua_State *L)
{
luaT_pushwstring(L, L"0.03 beta");
return 1;
}
int init(lua_State *L)
{
#ifdef _DEBUG
MapperUnitTests t;
t.runTests();
#endif
DEBUGINIT(L);
init_clientlog(L);
luaT_run(L, "addButton", "dds", IDB_MAP, 1, L"Окно с картой");
m_props.initAllDefault();
tstring error;
tstring path;
tstring current_zone;
base::getPath(L, L"settings.xml", &path);
xml::node p;
if (p.load(path.c_str(), &error))
{
int width = 0;
p.get(L"zoneslist/width", &width);
m_props.zoneslist_width = (width > 0) ? width : -1;
if (p.get(L"lastzone/name", ¤t_zone))
m_props.current_zone = current_zone;
} else {
if (!error.empty())
base::log(L, error.c_str());
}
p.deletenode();
if (!m_parent_window.create(L, L"Карта", 400, 400))
return luaT_error(L, L"Не удалось создать окно для карты");
HWND parent = m_parent_window.hwnd();
map_active = m_parent_window.isVisible();
tstring folder;
base::getPath(L, L"", &folder);
m_mapper_window = new Mapper(&m_props, folder);
RECT rc; ::GetClientRect(parent, &rc);
if (rc.right == 0) rc.right = 400; // requeires for splitter inside map window (if parent window hidden)
HWND res = m_mapper_window->Create(parent, rc, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
m_parent_window.attach(res);
m_parent_window.block(L"left,right,top,bottom");
if (map_active)
luaT_run(L, "checkMenu", "d", 1);
//todo! m_mapper_window->loadMaps();
return 0;
}
int release(lua_State *L)
{
//todo! m_mapper_window->saveMaps();
xml::node p(L"settings");
p.set(L"zoneslist/width", m_props.zoneslist_width);
p.set(L"lastzone/name", m_props.current_zone);
tstring path;
base::getPath(L, L"settings.xml", &path);
if (!p.save(path.c_str()))
{
tstring error(L"Ошибка записи настроек пользователя: ");
error.append(path);
base::log(L, error.c_str());
}
p.deletenode();
return 0;
}
int menucmd(lua_State *L)
{
if (!luaT_check(L, 1, LUA_TNUMBER))
return 0;
int id = lua_tointeger(L, 1);
lua_pop(L, 1);
if (id == 1)
{
if (map_active)
{
luaT_run(L, "uncheckMenu", "d", 1);
m_parent_window.hide();
}
else
{
luaT_run(L, "checkMenu", "d", 1);
m_parent_window.show();
}
map_active = !map_active;
}
return 0;
}
int closewindow(lua_State *L)
{
if (!luaT_check(L, 1, LUA_TNUMBER))
return 0;
HWND hwnd = (HWND)lua_tointeger(L, 1);
if (hwnd == m_parent_window.hwnd())
{
luaT_run(L, "uncheckMenu", "d", 1);
m_parent_window.hide();
map_active = false;
}
return 0;
}
void msdpstate(lua_State *L, bool state)
{
luaT_Msdp m(L);
std::vector<std::wstring> reports1;
std::vector<std::wstring> reports2;
reports1.push_back(L"ROOM");
//reports2.push_back(L"MOVEMENT");
if (state)
{
m.report(reports1); //todo!
//m.report(reports2);
}
else
{
m.unreport(reports1);
//m.unreport(reports2);
}
}
int msdpon(lua_State *L)
{
msdpstate(L, true);
return 0;
}
int msdpoff(lua_State *L)
{
msdpstate(L, false);
return 0;
}
bool popString(lua_State *L, const char* name, tstring* val)
{
lua_pushstring(L, name);
lua_gettable(L, -2);
val->assign(luaT_towstring(L, -1));
lua_pop(L, 1);
return (val->empty()) ? false : true;
}
int msdp(lua_State *L)
{
luaT_showLuaStack(L, L"begin");
RoomData rd;
bool inconsistent_data = true;
if (luaT_check(L, 1, LUA_TTABLE))
{
lua_pushstring(L, "ROOM");
lua_gettable(L, -2);
if (lua_istable(L, -1))
{
if (popString(L, "AREA", &rd.zonename) &&
popString(L, "VNUM", &rd.vnum) &&
popString(L, "NAME", &rd.name))
{
lua_pushstring(L, "EXITS");
lua_gettable(L, -2);
if (lua_istable(L, -1))
{
lua_pushnil(L);
while (lua_next(L, -2) != 0) // key index = -2, value index = -1
{
tstring dir(luaT_towstring(L, -2));
tstring vnum(luaT_towstring(L, -1));
rd.exits[dir] = vnum;
lua_pop(L, 1);
}
inconsistent_data = false;
}
lua_pop(L, 1);
}
}
lua_pop(L, 1);
}
luaT_showLuaStack(L, L"end");
luaT_showTableOnTop(L, L"end");
if (!inconsistent_data)
{
m_mapper_window->processMsdp(rd);
return 1;
}
assert(false);
return 1;
}
static const luaL_Reg mapper_methods[] =
{
{"name", get_name},
{"description", get_description},
{"version", get_version},
{"init", init },
{"release", release },
{"menucmd", menucmd },
{"closewindow", closewindow },
{"msdpon", msdpon },
{"msdpoff", msdpoff },
{"msdp", msdp },
{ NULL, NULL }
};
int WINAPI plugin_open(lua_State *L)
{
luaL_newlib(L, mapper_methods);
return 1;
}
CAppModule _Module;
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
_Module.Init(NULL, hModule);
break;
case DLL_PROCESS_DETACH:
delete m_mapper_window;
_Module.Term();
break;
}
return TRUE;
}
| [
"gm79@list.ru"
] | gm79@list.ru |
35ac836b43ce18be7f6b1635fa860ab50017c888 | 10588b2214e68172ad790cf97e70a3aa161a5479 | /project3/ClientSocket.h | 6c6eac711c02fa9cbb46228e53c795720b69a7a8 | [] | no_license | shiba0281/learngit | 81e79ffe38dc4c7dcc14bee5cdaed7dfeff957fc | 1c485771e2862c1997d4fbaafdbe995659e0953b | refs/heads/master | 2020-03-22T08:03:42.606135 | 2018-07-04T15:14:38 | 2018-07-04T15:14:38 | 139,741,964 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 750 | h | #pragma once
#include "Define.h"
#include <windows.h>
#include <iostream>
#include <string>
#define BUFSIZE 16
class ClientSocket
{
private:
//server address
SOCKADDR_IN server;
//client SOCKET that connect to the server
SOCKET clientSocket;
//the message buffer that is received from the server
char recvBuf[BUFSIZE];
//the message buffer that is sent to the server
char sendBuf[BUFSIZE];
public:
ClientSocket() ;
~ClientSocket(void);
//connect to the server
int connectServer();
//receive message from server
int recvMsg();
//send message to server
int sendMsg(const char* msg);
//close socket
void close();
//get the received message
char* getRecvMsg();
};
| [
"171860526@smail.nju.edu.cn"
] | 171860526@smail.nju.edu.cn |
15ba939861e8281f8ad3a429ec8ba29d20103178 | 9b1512be84b4482a80e6d49ff9b3f6a2e88f6633 | /pylna kursowa.cpp | 09bb741075230847bec169cad84b5a1752c48125 | [] | no_license | mimmiich/pylna-kursowa | 6709b539377fa2999ad953d59ca12668cbdb088c | ef3df0d8a2a909dfbd45f4eedfac7514d10ab6d6 | refs/heads/master | 2020-11-23T22:02:47.605195 | 2019-12-13T12:57:40 | 2019-12-13T12:57:40 | 227,839,550 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 38,186 | cpp | #include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
const char Filename[] = "data.dat"; // Data file directory
fstream fp; // fstream instance for saving and loading data from file
// Structure for participants
struct Participant {
int num; // Participant's number
char name[30]; // Participant's name
int age; // Participant's age
bool gender; // Participant's gender, male = true, female = false
float hip; // Participant's hip size
float shoulder; // Participant's shoulder size
float neck; // Participant's neck size
float calf; // Participant's calf size
float total; // Participant's total score - hip/(shoulder+neck+calf)
};
// Constructor for participant structure
Participant input() {
char ch; // Choice for female/male
Participant a = { 0 }; // Create instance a of participants as a buffer
cout << "\nNumber: ";
cin >> a.num; // Enter new participant's number
cin.ignore();
cout << "Name: ";
cin.getline(a.name, 30); // Enter new participant's name
cout << "Age: ";
cin >> a.age; // Enter new participant's age
// Ask for gender until male or female is selected
do {
cout << "Gender [M/F]: ";
cin >> ch; // Enter new participant's gender
} while (!(ch == 'm' || ch == 'M' || ch == 'f' || ch == 'F')); // Lowercase and uppercase both accepted
if (ch == 'm' || ch == 'M') // Lowercase and uppercase both accepted
a.gender = true; // Male = true, Female = false
else if (ch == 'f' || ch == 'F') // Lowercase and uppercase both accepted
a.gender = false; // Male = true, Female = false
cout << "Hip size (cm): ";
cin >> a.hip; // Enter new participant's hip size
cout << "Shoulder size (cm): ";
cin >> a.shoulder; // Enter new participant's shoulder size
cout << "Neck size (cm): ";
cin >> a.neck; // Enter new participant's neck size
cout << "Calf size (cm): ";
cin >> a.calf; // Enter new participant's calf size
return(a); // Return the new participant to the caller function
}
// Functions menu
int menu() {
int ch; // Function choice
// Repeat until 1-7 is selected
do {
cout << "\n\n \tMenu";
cout << "\n1. New participant";
cout << "\n2. New list of participants";
cout << "\n3. Print participants";
cout << "\n4. Split participants into categories";
cout << "\n5. Print winners of categories";
cout << "\n6. Query menu";
cout << "\n7. Exit\n";
cin >> ch; // Enter your choice
} while (ch < 1 || ch>7);
return (ch); // Return your choice to the caller function
}
// Add one new participant
void addParticipant(Participant list[], Participant* listSort[], int n) {
cout << "\nAdd a new participant\n";
cout << "\nParticipant " << n + 1;
list[n] = input(); // Create new participant and insert it into the main array
listSort[n] = &list[n]; // Insert the new participant into the array used only for sorting
}
// Add multiple new participants
int addParticipantList(Participant list[], Participant* listSort[], int n) {
int i, m; // i = for counter, m = amount of new participants to enter
// Repeat until participants entered are less than the maximum allowed by array
do {
cout << "\nHow many participants to enter (max " << (30 - n) << "): ";
cin >> m; // Enter amount of new participants to enter
} while (m < 1 || m + n>30);
if (m + n <= 30) { // Check if new amount of participants don't overflow the array
for (i = n; i < n + m; i++) {
cout << "\nParticipant " << i + 1;
list[i] = input(); // Create new participant and insert it into the main array
listSort[i] = &list[i]; // Insert the new participant into the array used only for sorting
}
}
else {
cout << "\nNo free places\n";
}
return(n + m); // Return the new length of the array to the caller function
}
// Save the new data in a file
void saveFile(Participant list[], int n) {
fp.open(Filename, ios::binary | ios::out); // Open the data file
fp.write((char*)&n, sizeof(n)); // Insert the length of the main array into the data file
fp.write((char*)list, n * sizeof(Participant)); // Insert the data of the main array into the data file
fp.close(); // Close the data file
}
// Load the data from a file
int loadFile(Participant list[], Participant* listSort[], int n) {
fp.open(Filename, ios::binary | ios::in); // Open the data file
fp.read((char*)&n, sizeof(n)); // Read the length of the main array from the data file
fp.read((char*)list, n * sizeof(Participant)); // Read the data of the main array from the data file
// Insert the data from the main array into the sorting array
for (int i = 0; i < n; i++) {
listSort[i] = &list[i];
}
fp.close(); // Close the data file
return n; // Return the array length to the caller function
}
// Print all the data
void printAll(Participant list[], int n) {
cout << "\nParticipants: " << n << "\n";
for (int i = 0; i < n; i++) {
cout << "\nParticipant " << i + 1;
cout << "\nNumber: " << list[i].num; // Prints the participant's number
cout << "\nName: " << list[i].name; // Prints the participant's name
cout << "\nAge: " << list[i].age; // Prints the participant's age
cout << "\nHip size: " << list[i].hip << "cm"; // Prints the participant's hip size in centimeters
cout << "\nShoulder size: " << list[i].shoulder << "cm"; // Prints the participant's shoulder size in centimeters
cout << "\nNeck size: " << list[i].neck << "cm"; // Prints the participant's neck size in centimeters
cout << "\nCalf size: " << list[i].calf << "cm"; // Prints the participant's calf size in centimeters
// Checks if the gender is true or false
if (list[i].gender)
cout << "\nGender: Male\n"; // If the gender is true, prints that the gender is male
else
cout << "\nGender: Female\n"; // If the gender is false, prints that the gender is female
}
}
// Splits participants into category aged 14-16
int splitCategory1(Participant list[], Participant* cat1[], int n, int j) {
int i; // For counter
j = 0; // Category 1 array length
// Go through the whole category 1 array
for (i = 0; i < n; i++) {
// Insert into category 1 array only participants aged 14-16
if (list[i].age >= 14 && list[i].age <= 16) {
// Insert participant into category 1
cat1[j] = &list[i];
j++; // Increase category 1 array length
}
}
cout << "\nCategory 14-16\n";
for (int i = 0; i < j; i++) {
cout << "\nParticipant " << i + 1;
cout << "\nNumber: " << cat1[i]->num; // Prints the participant's number
cout << "\nName: " << cat1[i]->name; // Prints the participant's name
cout << "\nAge: " << cat1[i]->age; // Prints the participant's age
cout << "\nHip size: " << cat1[i]->hip << "cm"; // Prints the participant's hip size in centimeters
cout << "\nShoulder size: " << cat1[i]->shoulder << "cm"; // Prints the participant's shoulder size in centimeters
cout << "\nNeck size: " << cat1[i]->neck << "cm"; // Prints the participant's neck size in centimeters
cout << "\nCalf size: " << cat1[i]->calf << "cm"; // Prints the participant's calf size in centimeters
// Checks if the gender is true or false
if (cat1[i]->gender)
cout << "\nGender: Male\n"; // If the gender is true, prints that the gender is male
else
cout << "\nGender: Female\n"; // If the gender is false, prints that the gender is female
}
if (!j)
cout << "No participants found";
return (j);
}
// Splits participants into category aged 17-19
int splitCategory2(Participant list[], Participant* cat2[], int n, int k) {
int i; // For counter
k = 0; // Category 2 array length
// Go through the whole category 2 array
for (i = 0; i < n; i++) {
// Insert into category 2 array only participants aged 17-19
if (list[i].age >= 17 && list[i].age <= 19) {
// Insert participant into category 2
cat2[k] = &list[i];
k++; // Increase category 2 array length
}
}
cout << "\nCategory 17-19\n";
for (int i = 0; i < k; i++) {
cout << "\nParticipant " << i + 1;
cout << "\nNumber: " << cat2[i]->num; // Prints the participant's number
cout << "\nName: " << cat2[i]->name; // Prints the participant's name
cout << "\nAge: " << cat2[i]->age; // Prints the participant's age
cout << "\nHip size: " << cat2[i]->hip << "cm"; // Prints the participant's hip size in centimeters
cout << "\nShoulder size: " << cat2[i]->shoulder << "cm"; // Prints the participant's shoulder size in centimeters
cout << "\nNeck size: " << cat2[i]->neck << "cm"; // Prints the participant's neck size in centimeters
cout << "\nCalf size: " << cat2[i]->calf << "cm"; // Prints the participant's calf size in centimeters
// Checks if the gender is true or false
if (cat2[i]->gender)
cout << "\nGender: Male\n"; // If the gender is true, prints that the gender is male
else
cout << "\nGender: Female\n"; // If the gender is false, prints that the gender is female
}
if (!k)
cout << "No participants found";
return (k);
}
// Splits participants into category aged 20-22
int splitCategory3(Participant list[], Participant* cat3[], int n, int l) {
int i; // For counter
l = 0; // Category 3 array length
// Go through the whole category 3 array
for (i = 0; i < n; i++) {
// Insert into category 3 array only participants aged 22-22
if (list[i].age >= 20 && list[i].age <= 22) {
// Insert participant into category 3
cat3[l] = &list[i];
l++; // Increase category 3 array length
}
}
cout << "\nCategory 20-22\n";
for (int i = 0; i < l; i++) {
cout << "\nParticipant " << i + 1;
cout << "\nNumber: " << cat3[i]->num; // Prints the participant's number
cout << "\nName: " << cat3[i]->name; // Prints the participant's name
cout << "\nAge: " << cat3[i]->age; // Prints the participant's age
cout << "\nHip size: " << cat3[i]->hip << "cm"; // Prints the participant's hip size in centimeters
cout << "\nShoulder size: " << cat3[i]->shoulder << "cm"; // Prints the participant's shoulder size in centimeters
cout << "\nNeck size: " << cat3[i]->neck << "cm"; // Prints the participant's neck size in centimeters
cout << "\nCalf size: " << cat3[i]->calf << "cm"; // Prints the participant's calf size in centimeters
// Checks if the gender is true or false
if (cat3[i]->gender)
cout << "\nGender: Male\n"; // If the gender is true, prints that the gender is male
else
cout << "\nGender: Female\n"; // If the gender is false, prints that the gender is female
}
if (!l)
cout << "No participants found";
return (l);
}
// Splits participants into category aged 23-25
int splitCategory4(Participant list[], Participant* cat4[], int n, int m) {
int i; // For counter
m = 0; // Category 4 array length
// Go through the whole category 4 array
for (i = 0; i < n; i++) {
// Insert into category 4 array only participants aged 23-25
if (list[i].age >= 20 && list[i].age <= 22) {
// Insert participant into category 4
cat4[m] = &list[i];
m++; // Increase category 4 array length
}
}
cout << "\nCategory 23-25\n";
for (int i = 0; i < m; i++) {
cout << "\nParticipant " << i + 1;
cout << "\nNumber: " << cat4[i]->num; // Prints the participant's number
cout << "\nName: " << cat4[i]->name; // Prints the participant's name
cout << "\nAge: " << cat4[i]->age; // Prints the participant's age
cout << "\nHip size: " << cat4[i]->hip << "cm"; // Prints the participant's hip size in centimeters
cout << "\nShoulder size: " << cat4[i]->shoulder << "cm"; // Prints the participant's shoulder size in centimeters
cout << "\nNeck size: " << cat4[i]->neck << "cm"; // Prints the participant's neck size in centimeters
cout << "\nCalf size: " << cat4[i]->calf << "cm"; // Prints the participant's calf size in centimeters
// Checks if the gender is true or false
if (cat4[i]->gender)
cout << "\nGender: Male\n"; // If the gender is true, prints that the gender is male
else
cout << "\nGender: Female\n"; // If the gender is false, prints that the gender is female
}
if (!m)
cout << "No participants found";
return (m);
}
// Print all the winners from the different categories
void printWinners(Participant* cat1[], Participant* cat2[], Participant* cat3[], Participant* cat4[], int j, int k, int l, int m) {
Participant* temp; // Temporary structure used for bubble sort algorithm
int top, search, i; // i = for counter, top and search used for sorting algorithm
// Calculate total score for different participants of different categories
for (i = 0; i < j; i++)
cat1[i]->total = (cat1[i]->hip / (cat1[i]->shoulder + cat1[i]->neck + cat1[i]->calf));
for (i = 0; i < k; i++)
cat2[i]->total = (cat2[i]->hip / (cat2[i]->shoulder + cat2[i]->neck + cat2[i]->calf));
for (i = 0; i < l; i++)
cat3[i]->total = (cat3[i]->hip / (cat3[i]->shoulder + cat3[i]->neck + cat3[i]->calf));
for (i = 0; i < m; i++)
cat4[i]->total = (cat4[i]->hip / (cat4[i]->shoulder + cat4[i]->neck + cat4[i]->calf));
// Bubble sort algorithm to calculate total score descending
for (top = 0; top < j - 1; top++) {
for (search = top + 1; search < j; search++) {
if (cat1[top]->total < cat1[search]->total) {
temp = cat1[top];
cat1[top] = cat1[search];
cat1[search] = temp;
}
}
}
// Print category 1 total value of 0.54 - 0.62 / Winners
cout << "\nCategory 14-16\n";
for (int i = 0; i < j; i++) {
if (cat1[i]->total > 0.54 && cat1[i]->total < 0.62) {
cout << "\nNumber: " << cat1[i]->num; // Prints the participant's number
cout << "\nName: " << cat1[i]->name; // Prints the participant's name
cout << "\nAge: " << cat1[i]->age; // Prints the participant's age
cout << "\nHip size: " << cat1[i]->hip << "cm"; // Prints the participant's hip size in centimeters
cout << "\nShoulder size: " << cat1[i]->shoulder << "cm"; // Prints the participant's shoulder size in centimeters
cout << "\nNeck size: " << cat1[i]->neck << "cm"; // Prints the participant's neck size in centimeters
cout << "\nCalf size: " << cat1[i]->calf << "cm"; // Prints the participant's calf size in centimeters
cout << "\nTotal proportions: " << cat1[i]->total;
// Checks if the gender is true or false
if (cat1[i]->gender)
cout << "\nGender: Male\n"; // If the gender is true, prints that the gender is male
else
cout << "\nGender: Female\n"; // If the gender is false, prints that the gender is female
}
}
// Bubble sort algorithm to calculate total score ascending of category 1
for (top = 0; top < j - 1; top++) {
for (search = top + 1; search < j; search++) {
if (cat1[top]->total > cat1[search]->total) {
temp = cat1[top];
cat1[top] = cat1[search];
cat1[search] = temp;
}
}
}
// Print category 1 total value of > 0.63
for (int i = 0; i < j; i++) {
if (cat1[i]->total >= 0.63) {
cout << "\nNumber: " << cat1[i]->num; // Prints the participant's number
cout << "\nName: " << cat1[i]->name; // Prints the participant's name
cout << "\nAge: " << cat1[i]->age; // Prints the participant's age
cout << "\nHip size: " << cat1[i]->hip << "cm"; // Prints the participant's hip size in centimeters
cout << "\nShoulder size: " << cat1[i]->shoulder << "cm"; // Prints the participant's shoulder size in centimeters
cout << "\nNeck size: " << cat1[i]->neck << "cm"; // Prints the participant's neck size in centimeters
cout << "\nCalf size: " << cat1[i]->calf << "cm"; // Prints the participant's calf size in centimeters
cout << "\nTotal proportions: " << cat1[i]->total;
// Checks if the gender is true or false
if (cat1[i]->gender)
cout << "\nGender: Male\n"; // If the gender is true, prints that the gender is male
else
cout << "\nGender: Female\n"; // If the gender is false, prints that the gender is female
}
}
// Print category 1 total value of < 0.53
for (int i = 0; i < j; i++) {
if (cat1[i]->total <= 0.53) {
cout << "\nNumber: " << cat1[i]->num; // Prints the participant's number
cout << "\nName: " << cat1[i]->name; // Prints the participant's name
cout << "\nAge: " << cat1[i]->age; // Prints the participant's age
cout << "\nHip size: " << cat1[i]->hip << "cm"; // Prints the participant's hip size in centimeters
cout << "\nShoulder size: " << cat1[i]->shoulder << "cm"; // Prints the participant's shoulder size in centimeters
cout << "\nNeck size: " << cat1[i]->neck << "cm"; // Prints the participant's neck size in centimeters
cout << "\nCalf size: " << cat1[i]->calf << "cm"; // Prints the participant's calf size in centimeters
cout << "\nTotal proportions: " << cat1[i]->total;
// Checks if the gender is true or false
if (cat1[i]->gender)
cout << "\nGender: Male\n"; // If the gender is true, prints that the gender is male
else
cout << "\nGender: Female\n"; // If the gender is false, prints that the gender is female
}
}
// Bubble sort algorithm to calculate total score descending of category 2
for (top = 0; top < k - 1; top++) {
for (search = top + 1; search < k; search++) {
if (cat2[top]->total < cat2[search]->total) {
temp = cat2[top];
cat2[top] = cat2[search];
cat2[search] = temp;
}
}
}
cout << "\nCategory 17-19\n";
// Print category 2 total value of 0.54 - 0.62 / Winners
for (int i = 0; i < k; i++) {
if (cat2[i]->total > 0.54 && cat2[i]->total < 0.62) {
cout << "\nNumber: " << cat2[i]->num; // Prints the participant's number
cout << "\nName: " << cat2[i]->name; // Prints the participant's name
cout << "\nAge: " << cat2[i]->age; // Prints the participant's age
cout << "\nHip size: " << cat2[i]->hip << "cm"; // Prints the participant's hip size in centimeters
cout << "\nShoulder size: " << cat2[i]->shoulder << "cm"; // Prints the participant's shoulder size in centimeters
cout << "\nNeck size: " << cat2[i]->neck << "cm"; // Prints the participant's neck size in centimeters
cout << "\nCalf size: " << cat2[i]->calf << "cm"; // Prints the participant's calf size in centimeters
cout << "\nTotal proportions: " << cat2[i]->total;
// Checks if the gender is true or false
if (cat2[i]->gender)
cout << "\nGender: Male\n"; // If the gender is true, prints that the gender is male
else
cout << "\nGender: Female\n"; // If the gender is false, prints that the gender is female
}
}
// Bubble sort algorithm to calculate total score ascending of category 2
for (top = 0; top < k - 1; top++) {
for (search = top + 1; search < k; search++) {
if (cat2[top]->total > cat2[search]->total) {
temp = cat2[top];
cat2[top] = cat2[search];
cat2[search] = temp;
}
}
}
// Print category 2 total value of > 0.63
for (int i = 0; i < k; i++) {
if (cat2[i]->total >= 0.63) {
cout << "\nNumber: " << cat2[i]->num; // Prints the participant's number
cout << "\nName: " << cat2[i]->name; // Prints the participant's name
cout << "\nAge: " << cat2[i]->age; // Prints the participant's age
cout << "\nHip size: " << cat2[i]->hip << "cm"; // Prints the participant's hip size in centimeters
cout << "\nShoulder size: " << cat2[i]->shoulder << "cm"; // Prints the participant's shoulder size in centimeters
cout << "\nNeck size: " << cat2[i]->neck << "cm"; // Prints the participant's neck size in centimeters
cout << "\nCalf size: " << cat2[i]->calf << "cm"; // Prints the participant's calf size in centimeters
cout << "\nTotal proportions: " << cat2[i]->total;
// Checks if the gender is true or false
if (cat2[i]->gender)
cout << "\nGender: Male\n"; // If the gender is true, prints that the gender is male
else
cout << "\nGender: Female\n"; // If the gender is false, prints that the gender is female
}
}
// Print category 2 total value of < 0.53
for (int i = 0; i < k; i++) {
if (cat2[i]->total <= 0.53) {
cout << "\nNumber: " << cat2[i]->num; // Prints the participant's number
cout << "\nName: " << cat2[i]->name; // Prints the participant's name
cout << "\nAge: " << cat2[i]->age; // Prints the participant's age
cout << "\nHip size: " << cat2[i]->hip << "cm"; // Prints the participant's hip size in centimeters
cout << "\nShoulder size: " << cat2[i]->shoulder << "cm"; // Prints the participant's shoulder size in centimeters
cout << "\nNeck size: " << cat2[i]->neck << "cm"; // Prints the participant's neck size in centimeters
cout << "\nCalf size: " << cat2[i]->calf << "cm"; // Prints the participant's calf size in centimeters
cout << "\nTotal proportions: " << cat2[i]->total;
// Checks if the gender is true or false
if (cat2[i]->gender)
cout << "\nGender: Male\n"; // If the gender is true, prints that the gender is male
else
cout << "\nGender: Female\n"; // If the gender is false, prints that the gender is female
}
}
//
cout << "\nCategory 20-22\n";
// Bubble sort algorithm to calculate total score descending of category 3
for (top = 0; top < l - 1; top++) {
for (search = top + 1; search < l; search++) {
if (cat3[top]->total < cat3[search]->total) {
temp = cat3[top];
cat3[top] = cat3[search];
cat3[search] = temp;
}
}
}
// Print category 3 total value of 0.54 - 0.62 / Winners
for (int i = 0; i < l; i++) {
if (cat3[i]->total > 0.54 && cat3[i]->total < 0.62) {
cout << "\nNumber: " << cat3[i]->num; // Prints the participant's number
cout << "\nName: " << cat3[i]->name; // Prints the participant's name
cout << "\nAge: " << cat3[i]->age; // Prints the participant's age
cout << "\nHip size: " << cat3[i]->hip << "cm"; // Prints the participant's hip size in centimeters
cout << "\nShoulder size: " << cat3[i]->shoulder << "cm"; // Prints the participant's shoulder size in centimeters
cout << "\nNeck size: " << cat3[i]->neck << "cm"; // Prints the participant's neck size in centimeters
cout << "\nCalf size: " << cat3[i]->calf << "cm"; // Prints the participant's calf size in centimeters
cout << "\nTotal proportions: " << cat3[i]->total;
// Checks if the gender is true or false
if (cat3[i]->gender)
cout << "\nGender: Male\n"; // If the gender is true, prints that the gender is male
else
cout << "\nGender: Female\n"; // If the gender is false, prints that the gender is female
}
}
// Bubble sort algorithm to calculate total score ascending of category 3
for (top = 0; top < l - 1; top++) {
for (search = top + 1; search < l; search++) {
if (cat3[top]->total > cat3[search]->total) {
temp = cat3[top];
cat3[top] = cat3[search];
cat3[search] = temp;
}
}
}
// Print category 3 total value of > 0.63
for (int i = 0; i < l; i++) {
if (cat3[i]->total >= 0.63) {
cout << "\nNumber: " << cat3[i]->num; // Prints the participant's number
cout << "\nName: " << cat3[i]->name; // Prints the participant's name
cout << "\nAge: " << cat3[i]->age; // Prints the participant's age
cout << "\nHip size: " << cat3[i]->hip << "cm"; // Prints the participant's hip size in centimeters
cout << "\nShoulder size: " << cat3[i]->shoulder << "cm"; // Prints the participant's shoulder size in centimeters
cout << "\nNeck size: " << cat3[i]->neck << "cm"; // Prints the participant's neck size in centimeters
cout << "\nCalf size: " << cat3[i]->calf << "cm"; // Prints the participant's calf size in centimeters
cout << "\nTotal proportions: " << cat3[i]->total;
// Checks if the gender is true or false
if (cat3[i]->gender)
cout << "\nGender: Male\n"; // If the gender is true, prints that the gender is male
else
cout << "\nGender: Female\n"; // If the gender is false, prints that the gender is female
}
}
// Print category 3 total value of < 0.53
for (int i = 0; i < l; i++) {
if (cat3[i]->total <= 0.53) {
cout << "\nNumber: " << cat3[i]->num; // Prints the participant's number
cout << "\nName: " << cat3[i]->name; // Prints the participant's name
cout << "\nAge: " << cat3[i]->age; // Prints the participant's age
cout << "\nHip size: " << cat3[i]->hip << "cm"; // Prints the participant's hip size in centimeters
cout << "\nShoulder size: " << cat3[i]->shoulder << "cm"; // Prints the participant's shoulder size in centimeters
cout << "\nNeck size: " << cat3[i]->neck << "cm"; // Prints the participant's neck size in centimeters
cout << "\nCalf size: " << cat3[i]->calf << "cm"; // Prints the participant's calf size in centimeters
cout << "\nTotal proportions: " << cat3[i]->total;
// Checks if the gender is true or false
if (cat3[i]->gender)
cout << "\nGender: Male\n"; // If the gender is true, prints that the gender is male
else
cout << "\nGender: Female\n"; // If the gender is false, prints that the gender is female
}
}
//
cout << "\nCategory 23-25\n";
// Bubble sort algorithm to calculate total score descending of category 4
for (top = 0; top < m - 1; top++) {
for (search = top + 1; search < m; search++) {
if (cat4[top]->total < cat4[search]->total) {
temp = cat1[top];
cat1[top] = cat1[search];
cat1[search] = temp;
}
}
}
// Print category 4 total value of 0.54 - 0.62 / Winners
for (int i = 0; i < m; i++) {
if (cat4[i]->total > 0.54 && cat4[i]->total < 0.62) {
cout << "\nNumber: " << cat4[i]->num; // Prints the participant's number
cout << "\nName: " << cat4[i]->name; // Prints the participant's name
cout << "\nAge: " << cat4[i]->age; // Prints the participant's age
cout << "\nHip size: " << cat4[i]->hip << "cm"; // Prints the participant's hip size in centimeters
cout << "\nShoulder size: " << cat4[i]->shoulder << "cm"; // Prints the participant's shoulder size in centimeters
cout << "\nNeck size: " << cat4[i]->neck << "cm"; // Prints the participant's neck size in centimeters
cout << "\nCalf size: " << cat4[i]->calf << "cm"; // Prints the participant's calf size in centimeters
cout << "\nTotal proportions: " << cat4[i]->total;
// Checks if the gender is true or false
if (cat4[i]->gender)
cout << "\nGender: Male\n"; // If the gender is true, prints that the gender is male
else
cout << "\nGender: Female\n"; // If the gender is false, prints that the gender is female
}
}
// Bubble sort algorithm to calculate total score ascending of category 4
for (top = 0; top < m - 1; top++) {
for (search = top + 1; search < m; search++) {
if (cat4[top]->total > cat4[search]->total) {
temp = cat4[top];
cat4[top] = cat1[search];
cat4[search] = temp;
}
}
}
// Print category 4 total value of > 0.63
for (int i = 0; i < m; i++) {
if (cat4[i]->total >= 0.63) {
cout << "\nNumber: " << cat4[i]->num; // Prints the participant's number
cout << "\nName: " << cat4[i]->name; // Prints the participant's name
cout << "\nAge: " << cat4[i]->age; // Prints the participant's age
cout << "\nHip size: " << cat4[i]->hip << "cm"; // Prints the participant's hip size in centimeters
cout << "\nShoulder size: " << cat4[i]->shoulder << "cm"; // Prints the participant's shoulder size in centimeters
cout << "\nNeck size: " << cat4[i]->neck << "cm"; // Prints the participant's neck size in centimeters
cout << "\nCalf size: " << cat4[i]->calf << "cm"; // Prints the participant's calf size in centimeters
cout << "\nTotal proportions: " << cat4[i]->total;
// Checks if the gender is true or false
if (cat4[i]->gender)
cout << "\nGender: Male\n"; // If the gender is true, prints that the gender is male
else
cout << "\nGender: Female\n"; // If the gender is false, prints that the gender is female
}
}
// Print category 4 total value of < 0.53
for (int i = 0; i < m; i++) {
if (cat4[i]->total <= 0.53) {
cout << "\nNumber: " << cat4[i]->num; // Prints the participant's number
cout << "\nName: " << cat4[i]->name; // Prints the participant's name
cout << "\nAge: " << cat4[i]->age; // Prints the participant's age
cout << "\nHip size: " << cat4[i]->hip << "cm"; // Prints the participant's hip size in centimeters
cout << "\nShoulder size: " << cat4[i]->shoulder << "cm"; // Prints the participant's shoulder size in centimeters
cout << "\nNeck size: " << cat4[i]->neck << "cm"; // Prints the participant's neck size in centimeters
cout << "\nCalf size: " << cat4[i]->calf << "cm"; // Prints the participant's calf size in centimeters
cout << "\nTotal proportions: " << cat4[i]->total;
// Checks if the gender is true or false
if (cat4[i]->gender)
cout << "\nGender: Male\n"; // If the gender is true, prints that the gender is male
else
cout << "\nGender: Female\n"; // If the gender is false, prints that the gender is female
}
}
}
// Audit functions menu
int auditmenu() {
int ch; // Audit functions choice
// Repeat until choice is one of the functions
do {
cout << "\n\n \t Query menu";
cout << "\n1. Sort by age";
cout << "\n2. Print youngest male and female participants";
cout << "\n3. Print participants with biggest shoulder width";
cout << "\n4. Back\n";
cin >> ch; // Enter your choice
} while (ch < 1 || ch>5);
return (ch); // Return choice to claler function
}
// Sort participants by age ascending
void sortByAge(Participant* listSort[], int n) {
Participant* temp; // Temporary structure used for bubble sort algorithm
int top, search, i; // i = for counter, top and search used for sorting algorithm
// Bubble sort algorithm sorted by ascending by age
for (top = 0; top < n - 1; top++) {
for (search = top + 1; search < n; search++) {
if (listSort[top]->age > listSort[search]->age) {
temp = listSort[top];
listSort[top] = listSort[search];
listSort[search] = temp;
}
}
}
// Print all participants
for (i = 0; i < n; i++) {
cout << "\nNumber: " << listSort[i]->num; // Prints the participant's number
cout << "\nName: " << listSort[i]->name; // Prints the participant's name
cout << "\nAge: " << listSort[i]->age; // Prints the participant's age
cout << "\nHip size: " << listSort[i]->hip << "cm"; // Prints the participant's hip size in centimeters
cout << "\nShoulder size: " << listSort[i]->shoulder << "cm"; // Prints the participant's shoulder size in centimeters
cout << "\nNeck size: " << listSort[i]->neck << "cm"; // Prints the participant's neck size in centimeters
cout << "\nCalf size: " << listSort[i]->calf << "cm"; // Prints the participant's calf size in centimeters
// Checks if the gender is true or false
if (listSort[i]->gender)
cout << "\nGender: Male\n"; // If the gender is true, prints that the gender is male
else
cout << "\nGender: Female\n"; // If the gender is false, prints that the gender is female
}
}
// Prints the youngest male and female participants
void printYoungest(Participant* listSort[], int n) {
Participant* temp; // Temporary structure used for bubble sort algorithm
int top, search, i; // i = for counter, top and search used for sorting algorithm
// Bubble sort algorithm
for (top = 0; top < n - 1; top++) {
for (search = top + 1; search < n; search++) {
if (listSort[top]->age > listSort[search]->age) {
temp = listSort[top];
listSort[top] = listSort[search];
listSort[search] = temp;
}
}
}
// Print participants
for (i = 0; i < n; i++) {
if (listSort[i]->gender) { // If gender is male
cout << "\nNumber: " << listSort[i]->num; // Prints the participant's number
cout << "\nName: " << listSort[i]->name; // Prints the participant's name
cout << "\nAge: " << listSort[i]->age; // Prints the participant's age
cout << "\nHip size: " << listSort[i]->hip << "cm"; // Prints the participant's hip size in centimeters
cout << "\nShoulder size: " << listSort[i]->shoulder << "cm"; // Prints the participant's shoulder size in centimeters
cout << "\nNeck size: " << listSort[i]->neck << "cm"; // Prints the participant's neck size in centimeters
cout << "\nCalf size: " << listSort[i]->calf << "cm"; // Prints the participant's calf size in centimeters
// Checks if the gender is true or false
if (listSort[i]->gender)
cout << "\nGender: Male\n"; // If the gender is true, prints that the gender is male
else
cout << "\nGender: Female\n"; // If the gender is false, prints that the gender is female
break; // Stop the for loop if a male participant is found
}
}
for (i = 0; i < n; i++) {
if (!listSort[i]->gender) { // If gender is female
cout << "\nNumber: " << listSort[i]->num; // Prints the participant's number
cout << "\nName: " << listSort[i]->name; // Prints the participant's name
cout << "\nAge: " << listSort[i]->age; // Prints the participant's age
cout << "\nHip size: " << listSort[i]->hip << "cm"; // Prints the participant's hip size in centimeters
cout << "\nShoulder size: " << listSort[i]->shoulder << "cm"; // Prints the participant's shoulder size in centimeters
cout << "\nNeck size: " << listSort[i]->neck << "cm"; // Prints the participant's neck size in centimeters
cout << "\nCalf size: " << listSort[i]->calf << "cm"; // Prints the participant's calf size in centimeters
// Checks if the gender is true or false
if (listSort[i]->gender)
cout << "\nGender: Male\n"; // If the gender is true, prints that the gender is male
else
cout << "\nGender: Female\n"; // If the gender is false, prints that the gender is female
break; // Stop the loop if a female participant is found
}
}
}
// Print participants sorted by shoulder size descending
void sortByShoulder(Participant* listSort[], int n) {
Participant* temp; // Temporary structure used for bubble sort algorithm
int top, search, i; // i = for counter, top and search used for sorting algorithm
// Bubble sort algorithm
for (top = 0; top < n - 1; top++) {
for (search = top + 1; search < n; search++) {
if (listSort[top]->shoulder < listSort[search]->shoulder) {
temp = listSort[top];
listSort[top] = listSort[search];
listSort[search] = temp;
}
}
}
// Print all participants
for (i = 0; i < n; i++) {
cout << "\nNumber: " << listSort[i]->num; // Prints the participant's number
cout << "\nName: " << listSort[i]->name; // Prints the participant's name
cout << "\nAge: " << listSort[i]->age; // Prints the participant's age
cout << "\nHip size: " << listSort[i]->hip << "cm"; // Prints the participant's hip size in centimeters
cout << "\nShoulder size: " << listSort[i]->shoulder << "cm"; // Prints the participant's shoulder size in centimeters
cout << "\nNeck size: " << listSort[i]->neck << "cm"; // Prints the participant's neck size in centimeters
cout << "\nCalf size: " << listSort[i]->calf << "cm"; // Prints the participant's calf size in centimeters
// Checks if the gender is true or false
if (listSort[i]->gender)
cout << "\nGender: Male\n"; // If the gender is true, prints that the gender is male
else
cout << "\nGender: Female\n"; // If the gender is false, prints that the gender is female
}
}
// The main function of the program
int main() {
char ans = 'y'; // Choice for creating a new participant
int choice; // Choice for function selection
int n = 0, j = 0, k = 0, l = 0, m = 0; // Array lengths
Participant list[30]; // Main array
Participant* listSort[30]; // Array used for sorting
Participant* cat1[30]; // Array used for category 1
Participant* cat2[30]; // Array used for category 2
Participant* cat3[30]; // Array used for category 3
Participant* cat4[30]; // Array used for category 4
n = loadFile(list, listSort, n); // Load data from data file
// Repeat until choice is 7
do {
choice = menu(); // Choose a function
// Calculate your choice
switch (choice) {
case 1:
// Repeat until choice is no
do {
addParticipant(list, listSort, n); // Add a new participant
n++; // Increase array length by one
saveFile(list, n); // Save data in data file
cout << "\n One more? [Y/N]: ";
cin >> ans; // Enter your choice
} while (!(ans == 'N' || ans == 'n')); // Lowercase and uppercase accepted
break; // End case 1
case 2:
n = addParticipantList(list, listSort, n); // Add a list of participants and change array length to returned variable
saveFile(list, n); // Save data in data file
break; // End case 2
case 3:
printAll(list, n); // Print all participants
break; // End case 3
case 4:
j = splitCategory1(list, cat1, n, j); // Split participants into category 14-16
k = splitCategory2(list, cat2, n, k); // Split participants into category 17-19
l = splitCategory3(list, cat3, n, l); // Split participants into category 20-22
m = splitCategory4(list, cat4, n, m); // Split participants into category 23-25
break; // End case 4
case 5:
printWinners(cat1, cat2, cat3, cat4, j, k, l, m); // Print the winners of the competition
break; // End case 5
case 6:
int auchoice; // Choice for audit menu functions
// Repeat until choice is 4
do {
auchoice = auditmenu(); // Choose an audit menu function
// Calculate audit menu choice
switch (auchoice) {
case 1:
sortByAge(listSort, n); // Sort participants by age ascending
break; // End case 1
case 2:
printYoungest(listSort, n); // Print youngest male and female participants
break; // End case 2
case 3:
sortByShoulder(listSort, n); // Print participants by shoulder size descending
break; // End case 3
case 4:
// Exits the audit menu
break; // End case 4
}
} while (auchoice != 4);
break; // End case 6
case 7:
saveFile(list, n); // Saves data in data file
break; // End case 7
}
} while (choice != 7);
system("pause"); // Pause console
return 0; // Return in order to end program
} | [
"noreply@github.com"
] | noreply@github.com |
c9649903c8c3fe1b28f5f86475b32b0643539ec4 | 1572d712cfbaf231ac1c12ec2e8d057a3a2ecc4f | /UserBasedCollaborativeFiltering/utils.cpp | dfbb708a64436d8b15c4ea41b72714a08d3dd5b9 | [] | no_license | zhu-dq/Machine-Learning | 5b601353be8c87c52b6dc6c9593382542c732ed5 | 4a07a84d696944270722899f2612b50ca6c246f8 | refs/heads/master | 2021-01-17T13:03:53.162522 | 2016-04-14T05:34:04 | 2016-04-14T05:34:04 | 34,507,530 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,595 | cpp | #include "utils.h"
mutex g_lock;
utils::utils()
{
}
bool utils::sort_func(const pair<index_t, float> & u1,const pair<index_t, float> & u2)
{
return u1.second > u2.second;
}
void utils::countRealAll(MATRIX * U_I_test, index_t * cnt)
{
*cnt = 0;
for (auto & items : *U_I_test)
{
for (auto & item : items.second)
(*cnt)++;
}
}
void utils::countRecomAll(ALLRECOMMEND * ALL_U_Recommend_I, index_t * cnt)
{
*cnt = 0;
for (auto & threads : *ALL_U_Recommend_I)
{
for (auto & items : *threads.second)
{
for (auto & item : items.second)
(*cnt)++;
}
}
}
void utils::countHitAll(MATRIX * U_I_test, ALLRECOMMEND * ALL_U_Recommend_I, index_t * cnt)
{
*cnt = 0;
for (auto & threads : *ALL_U_Recommend_I)
{
for (auto & items : *threads.second)
{
for (auto & item : items.second)
{
if ((*U_I_test)[items.first].count(item.first))
(*cnt)++;
}
}
}
}
void utils::buildUserGroup(USER* users, ULIST* th_ulist)
{
vector<index_t> u(users->begin(), users->end());
for (index_t i = 0; i < u.size(); ++i)
{
(*th_ulist)[i%THREADNUM].push_back(u[i]);
}
}
void utils::loadSrcFile(const char * src_file,
MATRIX * U_I_rating, IUSET* I_U_rating, USER* users, USER* items)
{
ifstream fin(src_file);
if (!fin)
cout << "Source file address is incorrect" << endl;
string line;
index_t uid = 0, iid = 0, timestamp = 0;
float rating = 0.0;
while (getline(fin, line))
{
sscanf_s(line.c_str(), "%u\t%u\t%f\t%u", &uid, &iid, &rating, ×tamp);
(*U_I_rating)[uid][iid] = rating;
(*I_U_rating)[iid].insert(uid);
(*users).insert(uid);
(*items).insert(iid);
}
}
void utils::loadTestFile(const char * test_file, MATRIX * U_I_test)
{
ifstream fin(test_file);
if (!fin)
cout << "test file address is incorrect" << endl;
string line;
index_t uid = 0, iid = 0, timestamp = 0;
float rating = 0.0;
while (getline(fin, line))
{
sscanf_s(line.c_str(), "%u\t%u\t%f\t%u", &uid, &iid, &rating, ×tamp);
(*U_I_test)[uid][iid] = rating;
}
}
void utils::loadFile(const char * src_file, const char * test_src_file,
MATRIX * U_I_rating, IUSET* I_U_rating, USER* users, USER* items, MATRIX * U_I_test)
{
thread t1(loadSrcFile, src_file, U_I_rating, I_U_rating, users, items);
thread t2(loadTestFile, test_src_file, U_I_test);
t1.join();
t2.join();
}
void utils::count_vec(vector<index_t> & group, IUInvertTable* I_U_Table)
{
for (auto & elem : group)
{
for (auto & item : (*I_U_Table)[elem])//map
{
for (index_t i = 0; i < item.second.size(); ++i)
{
item.second[0] += item.second[i];
}
}
}
}
void utils::builOneGroupItemUserInvert(vector<index_t> & group, index_t th_num,
IUInvertTable* I_U_Table, IUSET* I_U_Rating)
{
for (auto & elem : group)
{
vector<index_t> users((*I_U_Rating)[elem].begin(), (*I_U_Rating)[elem].end());
index_t length = users.size();
for (int i = 0; i < length; ++i)
{
for (int j = i + 1; j < length; ++j)
{
(*I_U_Table)[users[i]][users[j]][th_num] += 1;
(*I_U_Table)[users[j]][users[i]][th_num] += 1;
}
}
}
}
float utils::computingUserSimiar(index_t uid1, index_t uid2, MATRIX* U_I_rating, IUInvertTable* I_U_Table)
{
index_t divisor = (*I_U_Table)[uid1][uid2][0];
if (divisor == 0)
{
return 0.0;
}
index_t u1_length = (*U_I_rating)[uid1].size();
index_t u2_length = (*U_I_rating)[uid2].size();
float dividend = sqrt(u1_length*u2_length);
return ((float)divisor) / dividend;
}
void utils::constructOneSimilarUserList(index_t uid,
USER* users, MATRIX* U_I_Rating, IUInvertTable* I_U_Table, SIMILAR* U_U_Simiar)
{
vector<pair<index_t, float>> similarUser;
for (auto & item : *users)
{
similarUser.push_back(make_pair(item, utils::computingUserSimiar(uid, item, U_I_Rating, I_U_Table)));
}
sort(similarUser.begin(), similarUser.end(), sort_func);
lock_guard<mutex> lck(g_lock);
if (similarUser.size() < K)
(*U_U_Simiar)[uid] = similarUser;
else
copy(similarUser.begin(), similarUser.begin() + K, back_inserter((*U_U_Simiar)[uid]));
}
void utils::constructOneGroupSimilarUserList(vector<index_t> userlist,
USER* users, MATRIX* U_I_Rating, IUInvertTable* I_U_Table, SIMILAR* U_U_Simiar)
{
for (auto & elem : userlist)
{
constructOneSimilarUserList(elem, users, U_I_Rating, I_U_Table, U_U_Simiar);
}
}
void utils::user2UserRecommendComputing(index_t uid1, index_t uid2, float simial,
MATRIX* U_I_Rating, RECOMMEND* U_Recommend_I)
{
for (auto & elem : (*U_I_Rating)[uid2])
{
if ((*U_I_Rating)[uid1].count(elem.first))
continue;
float Pui = simial*elem.second;
if ((*U_Recommend_I)[uid1].count(elem.first))
{
(*U_Recommend_I)[uid1][elem.first] += Pui;
}
else
{
(*U_Recommend_I)[uid1][elem.first] = Pui;
}
}
}
void utils::user2GroupRecommendComputing(index_t iid,
SIMILAR* U_U_Simiar, MATRIX* U_I_Rating, RECOMMEND* U_Recommend_I)
{
for (auto & elem : (*U_U_Simiar)[iid])
{
user2UserRecommendComputing(iid, elem.first, elem.second, U_I_Rating, U_Recommend_I);
}
}
void utils::Group2GroupRecommendComputing(UGROUP & usergroup,
SIMILAR* U_U_Simiar, MATRIX* U_I_Rating, REALRECOM* U_Recommend_I)
{
for (auto & elem : usergroup)
{
RECOMMEND * recommend = new RECOMMEND();
user2GroupRecommendComputing(elem, U_U_Simiar, U_I_Rating, recommend);
vector<pair<index_t, float>> v((*recommend)[elem].begin(), (*recommend)[elem].end());
sort(v.begin(), v.end(), sort_func);
if (v.size() < K)
copy(v.begin(), v.end(), back_inserter((*U_Recommend_I)[elem]));
else
copy(v.begin(), v.begin() + K, back_inserter((*U_Recommend_I)[elem]));
delete recommend;
}
}
utils::~utils()
{
}
| [
"554575784@qq.com"
] | 554575784@qq.com |
97ed543c68bb73fd0c009afd852c9b7f88dc9733 | 35f31946c74b01cfdbb18460d64763ee1cc48bfa | /PA 3/src/cool-tree.handcode.h | 7ad4d12fd480e79d0958e06ae3cccaae7922ab3d | [] | no_license | w-dq/cool-compiler | dd12e43a1ec47ac56b3b162ab7a4a4fe5eda7598 | cea401e431b86d772f798da050aba597833e5d3c | refs/heads/main | 2023-05-24T09:49:53.895695 | 2021-06-21T01:33:07 | 2021-06-21T01:33:07 | 378,770,489 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,518 | h | //
// The following include files must come first.
#ifndef COOL_TREE_HANDCODE_H
#define COOL_TREE_HANDCODE_H
#include <iostream>
#include "tree.h"
#include "cool.h"
#include "stringtab.h"
#define yylineno curr_lineno;
extern int yylineno;
inline Boolean copy_Boolean(Boolean b) {return b; }
inline void assert_Boolean(Boolean) {}
inline void dump_Boolean(ostream& stream, int padding, Boolean b)
{ stream << pad(padding) << (int) b << "\n"; }
void dump_Symbol(ostream& stream, int padding, Symbol b);
void assert_Symbol(Symbol b);
Symbol copy_Symbol(Symbol b);
class Program_class;
typedef Program_class *Program;
class Class__class;
typedef Class__class *Class_;
class Feature_class;
typedef Feature_class *Feature;
class Formal_class;
typedef Formal_class *Formal;
class Expression_class;
typedef Expression_class *Expression;
class Case_class;
typedef Case_class *Case;
typedef list_node<Class_> Classes_class;
typedef Classes_class *Classes;
typedef list_node<Feature> Features_class;
typedef Features_class *Features;
typedef list_node<Formal> Formals_class;
typedef Formals_class *Formals;
typedef list_node<Expression> Expressions_class;
typedef Expressions_class *Expressions;
typedef list_node<Case> Cases_class;
typedef Cases_class *Cases;
#define Program_EXTRAS \
virtual void semant() = 0; \
virtual void dump_with_types(ostream&, int) = 0;
#define program_EXTRAS \
void semant(); \
void dump_with_types(ostream&, int);
#define Class__EXTRAS \
virtual Symbol get_filename() = 0; \
virtual void dump_with_types(ostream&,int) = 0; \
virtual Symbol GetName() = 0; \
virtual Symbol GetParent() = 0; \
virtual Features GetFeatures() = 0;
#define class__EXTRAS \
Symbol get_filename() { return filename; } \
void dump_with_types(ostream&,int); \
Symbol GetName() { return name; } \
Symbol GetParent() { return parent; } \
Features GetFeatures() { return features; }
#define Feature_EXTRAS \
virtual void dump_with_types(ostream&,int) = 0; \
virtual void CheckFeatureType(ClassTable *classtable) = 0; \
virtual void AddMethodToTable(Symbol class_name, ClassTable *classtable) = 0; \
virtual void AddAttribToTable(Symbol class_name, ClassTable *classtable) = 0; \
virtual Symbol GetName() = 0; \
virtual bool IsMethod() = 0;
#define Feature_SHARED_EXTRAS \
void dump_with_types(ostream&,int);
#define Formal_EXTRAS \
virtual void dump_with_types(ostream&,int) = 0; \
virtual Symbol GetName() = 0; \
virtual Symbol GetType() = 0;
#define formal_EXTRAS \
void dump_with_types(ostream&,int);
#define Case_EXTRAS \
virtual void dump_with_types(ostream& ,int) = 0;
#define branch_EXTRAS \
void dump_with_types(ostream& ,int);
#define Expression_EXTRAS \
Symbol type; \
Symbol get_type() { return type; } \
Expression set_type(Symbol s) { type = s; return this; } \
virtual void dump_with_types(ostream&,int) = 0; \
void dump_type(ostream&, int); \
Expression_class() { type = (Symbol) NULL; } \
virtual Symbol CheckExprType(ClassTable *classtable) = 0;
#define Expression_SHARED_EXTRAS \
void dump_with_types(ostream&,int);
#endif
| [
"wudq1@shanghaitech.edu.cn"
] | wudq1@shanghaitech.edu.cn |
4cb9e2248152c89aa0bba2b6f24a510abd42f4de | 6d62b00de117bb0dd82ae1b789d37d0641f1c360 | /source/platform/sighandl.cpp | ecf832084413201ab63bbd436276500cb81581ef | [
"MIT",
"HPND-Markus-Kuhn",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | magiblot/tvision | 226c71f59ca2f4212784a25d1894bf351c12fa40 | 92177cb365b523b0bc3e17d865292045ed7e0073 | refs/heads/master | 2023-08-31T23:07:38.024223 | 2023-06-21T22:53:45 | 2023-06-21T22:53:45 | 184,303,095 | 1,682 | 136 | NOASSERTION | 2023-04-25T14:08:13 | 2019-04-30T17:21:02 | C++ | UTF-8 | C++ | false | false | 4,368 | cpp | #include <internal/sighandl.h>
#include <stdlib.h>
#ifdef _TV_UNIX
namespace tvision
{
std::atomic<SignalHandlerCallback *> SignalHandler::callback {nullptr};
const int SignalHandler::handledSignals[HandledSignalCount] =
{ SIGINT, SIGQUIT, SIGILL, SIGABRT, SIGFPE, SIGSEGV, SIGTERM, SIGTSTP };
static bool operator==(const struct sigaction &a, const struct sigaction &b) noexcept
{
constexpr int knownFlags =
SA_NOCLDSTOP | SA_NOCLDWAIT | SA_SIGINFO | SA_ONSTACK | SA_RESTART |
SA_NODEFER | SA_RESETHAND;
return ((a.sa_flags & knownFlags) == (b.sa_flags & knownFlags)) &&
((a.sa_flags & SA_SIGINFO) ? a.sa_sigaction == b.sa_sigaction
: a.sa_handler == b.sa_handler);
}
void SignalHandler::enable(SignalHandlerCallback &aCallback) noexcept
{
if (!callback)
{
struct sigaction sa = makeHandlerAction();
for (int signo : handledSignals)
sigaction(signo, &sa, &getHandlerInfo(signo).action);
callback = &aCallback;
}
}
void SignalHandler::disable() noexcept
{
if (callback)
{
callback = nullptr;
for (int signo : handledSignals)
{
auto &handlerInfo = getHandlerInfo(signo);
struct sigaction sa = {};
sigaction(signo, nullptr, &sa);
// Restore the previous handler only if ours is still installed.
if (sa == makeHandlerAction())
sigaction(signo, &handlerInfo.action, nullptr);
handlerInfo.action = makeDefaultAction();
}
}
}
SignalHandler::HandlerInfo &SignalHandler::getHandlerInfo(int signo) noexcept
{
static HandlerInfo infos[HandledSignalCount];
switch (signo)
{
case SIGINT: return infos[SigInt];
case SIGQUIT: return infos[SigQuit];
case SIGILL: return infos[SigIll];
case SIGABRT: return infos[SigAbrt];
case SIGFPE: return infos[SigFpe];
case SIGSEGV: return infos[SigSegv];
case SIGTERM: return infos[SigTerm];
case SIGTSTP: return infos[SigTstp];
default: abort();
}
}
void SignalHandler::handleSignal(int signo, siginfo_t *info, void *context)
{
// In a multi-threaded application the signal handler may be changed from
// another thread while this one is running, but there's nothing we can do
// about it.
auto &handlerInfo = getHandlerInfo(signo);
struct sigaction currentAction {};
SignalHandlerCallback *callback;
if ((callback = SignalHandler::callback) && handlerInfo.running.exchange(true) == false)
{
struct sigaction nextAction = handlerInfo.action;
sigaction(signo, nullptr, ¤tAction);
callback(true);
sigaction(signo, &nextAction, nullptr);
if (invokeHandlerOrDefault(signo, nextAction, info, context))
return;
callback(false);
sigaction(signo, ¤tAction, nullptr);
handlerInfo.running = false;
}
else
{
// Just invoke the default handler.
struct sigaction sa = makeDefaultAction();
sigaction(signo, &sa, ¤tAction);
if (invokeDefault(signo, info))
return;
sigaction(signo, ¤tAction, nullptr);
}
}
bool SignalHandler::invokeHandlerOrDefault( int signo, struct sigaction &action,
siginfo_t *info, void *context ) noexcept
{
// If the handler is a custom one, invoke it directly.
if (action.sa_flags & SA_SIGINFO && action.sa_sigaction)
action.sa_sigaction(signo, info, context);
else if (!(action.sa_flags & SA_SIGINFO) && action.sa_handler)
action.sa_handler(signo);
else
return invokeDefault(signo, info);
return false;
}
bool SignalHandler::invokeDefault(int signo, siginfo_t *info) noexcept
{
// In some cases the signal will be raised again after leaving the handler.
if ((signo == SIGILL || signo == SIGFPE || signo == SIGSEGV) && info->si_code > 0)
return true;
// Otherwise, raise the signal manually.
sigset_t mask, oldMask;
sigemptyset(&mask);
sigaddset(&mask, signo);
sigprocmask(SIG_UNBLOCK, &mask, &oldMask);
raise(signo);
sigprocmask(SIG_SETMASK, &oldMask, nullptr);
return false;
}
} // namespace tvision
#endif // _TV_UNIX
| [
"magiblot@hotmail.com"
] | magiblot@hotmail.com |
d8efecd7b52309c43fc77fb0dd25f9f97ba9afd9 | a0cec8074a9156eb855cdb5039193775d5108241 | /codeforces/hf1009.cpp | eda0aa3e53879c2e9feace2671308bbf9ccef9de | [] | no_license | Caprimulgusindicus/icpc2016 | 37eacc28973a95ca02636f3d12b4bced1722c5f3 | 87989e6c74e2402c3bc3891e128e58be12a0a0e0 | refs/heads/master | 2021-09-15T09:20:34.043369 | 2018-05-29T18:52:58 | 2018-05-29T18:52:58 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,209 | cpp | #include <cstdio>
#include <cstring>
#include <stack>
#include <iostream>
using namespace std;
int ll[222];
int rr[222];
int aans[222];
long long pow(long long a,long long b)//a^b
{
long long ans=1;
while(b>0)
{
if(b&1)
ans=ans*a;
b=b>>1;
a=a*a;
}
return ans;
}
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
memset(aans,0,sizeof(aans));
memset(ll,0,sizeof(ll));
memset(rr,0,sizeof(rr));
long long l,r;
scanf("%lld%lld",&l,&r);
int len2=0;
if(l==r) cout<<l<<endl;
else
{
//cout<<l<<" "<<r<<endl;
stack <int> a;
stack <int> b;
while(r) {b.push(r%2);r/=2;}
while(!b.empty()) {rr[len2++]=b.top();b.pop();}
while(l) {a.push(l%2);l/=2;}
int cnt=len2-a.size();
while(!a.empty()) {ll[cnt++]=a.top();a.pop();}
//for(int i=0;i<len2;i++)
// cout<<ll[i]<<" "<<rr[i]<<endl;
int flag=0;
long long ans=0;
for(int i=0;i<len2;i++)
{
if(ll[i]!=rr[i]) flag=1;
if(flag) ans+=pow(2,(len2-i-1));
else if(flag==0&&rr[i]==1) //cout<<"here"<<endl,
ans+=pow(2,(len2-i-1));
}
/*
for(int i=0;i<len2;i++)
{
long long t=pow(2,(len2-i-1));
if(aans[i]!=0) ans+=t;
}*/
cout<<ans<<endl;
}
}
}
| [
"fsszns@163.com"
] | fsszns@163.com |
af779ed468d639948f197f6d4df1df3f41652074 | d0fb46aecc3b69983e7f6244331a81dff42d9595 | /devops-rdc/include/alibabacloud/devops-rdc/model/InsertProjectMembersResult.h | 7b7673030ccafb1569ee027db5ffd76d6f650075 | [
"Apache-2.0"
] | permissive | aliyun/aliyun-openapi-cpp-sdk | 3d8d051d44ad00753a429817dd03957614c0c66a | e862bd03c844bcb7ccaa90571bceaa2802c7f135 | refs/heads/master | 2023-08-29T11:54:00.525102 | 2023-08-29T03:32:48 | 2023-08-29T03:32:48 | 115,379,460 | 104 | 82 | NOASSERTION | 2023-09-14T06:13:33 | 2017-12-26T02:53:27 | C++ | UTF-8 | C++ | false | false | 1,621 | h | /*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ALIBABACLOUD_DEVOPS_RDC_MODEL_INSERTPROJECTMEMBERSRESULT_H_
#define ALIBABACLOUD_DEVOPS_RDC_MODEL_INSERTPROJECTMEMBERSRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/devops-rdc/Devops_rdcExport.h>
namespace AlibabaCloud
{
namespace Devops_rdc
{
namespace Model
{
class ALIBABACLOUD_DEVOPS_RDC_EXPORT InsertProjectMembersResult : public ServiceResult
{
public:
InsertProjectMembersResult();
explicit InsertProjectMembersResult(const std::string &payload);
~InsertProjectMembersResult();
std::string getErrorMsg()const;
bool getObject()const;
std::string getErrorCode()const;
bool getSuccessful()const;
protected:
void parse(const std::string &payload);
private:
std::string errorMsg_;
bool object_;
std::string errorCode_;
bool successful_;
};
}
}
}
#endif // !ALIBABACLOUD_DEVOPS_RDC_MODEL_INSERTPROJECTMEMBERSRESULT_H_ | [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
3aadc5d15af5d04b563657b1ccf8ba69dbcb1dbe | 0400a93704547664272c1ac004fae952df4ef9c1 | /doubledouble.hpp | 7afa85d5d7611fba3b32512a3142e1e7b9006c16 | [] | no_license | larsch/mandelbrot | 2b3f62b5c2442744d73956a5e0b46a5d2ef5c36a | e188e4cb48a3d383ae99e118bc7dc128c1daa6f9 | refs/heads/master | 2022-12-25T11:14:29.200756 | 2020-10-04T10:24:25 | 2020-10-04T10:24:25 | 289,681,756 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,406 | hpp | #ifndef _doubledouble_hpp
#define _doubledouble_hpp
#include <cmath>
template <typename FLT>
class doubledouble {
public:
explicit doubledouble(FLT _r = 0.0, FLT _e = 0.0) : r(_r), e(_e) {}
explicit operator FLT() const { return FLT(r); }
doubledouble& operator+=(const doubledouble& other);
doubledouble& operator-=(const doubledouble& other);
FLT r, e;
};
template <typename FLT>
doubledouble<FLT> two_difference(FLT x, FLT y) {
FLT r = x - y;
FLT t = r - x;
FLT e = (x - (r - t)) - (y + t);
return doubledouble<FLT>(r, e);
}
template <typename FLT>
doubledouble<FLT> two_sum_quick(FLT x, FLT y) {
FLT r = x + y;
return doubledouble<FLT>(r, y - (r - x));
}
template <typename FLT>
doubledouble<FLT> two_sum(FLT x, FLT y) {
FLT r = x + y;
FLT t = r - x;
FLT e = (x - (r - t)) + (y - t);
return doubledouble<FLT>(r, e);
}
template <typename FLT>
doubledouble<FLT> two_product(FLT x, FLT y) {
FLT u = x * 134217729.0;
FLT v = y * 134217729.0;
FLT s = u - (u - x);
FLT t = v - (v - y);
FLT f = x - s;
FLT g = y - t;
FLT r = x * y;
FLT e = ((s * t - r) + s * g + f * t) + f * g;
return doubledouble<FLT>(r, e);
}
template <typename FLT>
doubledouble<FLT>& doubledouble<FLT>::operator+=(
const doubledouble<FLT>& other) {
doubledouble<FLT> re = two_sum(r, other.r);
re.e += e + other.e;
*this = two_sum_quick(re.r, re.e);
return *this;
}
template <typename FLT>
doubledouble<FLT>& doubledouble<FLT>::operator-=(
const doubledouble<FLT>& other) {
doubledouble<FLT> re = two_difference(r, other.r);
re.e += e - other.e;
*this = two_sum_quick(re.r, re.e);
return *this;
}
template <typename FLT>
doubledouble<FLT> operator*(const doubledouble<FLT> lhs, FLT rhs) {
doubledouble<FLT> re = two_product(rhs, lhs.r);
re.e += rhs * lhs.e;
return two_sum_quick(re.r, re.e);
}
template <typename FLT>
doubledouble<FLT> operator+(const doubledouble<FLT>& lhs,
const doubledouble<FLT>& rhs) {
doubledouble<FLT> re = two_sum(lhs.r, rhs.r);
re.e += lhs.e + rhs.e;
return two_sum_quick(re.r, re.e);
}
template <typename FLT>
doubledouble<FLT> operator-(const doubledouble<FLT>& lhs,
const doubledouble<FLT>& rhs) {
doubledouble re = two_difference(lhs.r, rhs.r);
re.e += lhs.e - rhs.e;
return two_sum_quick(re.r, re.e);
}
template <typename FLT>
doubledouble<FLT> operator*(const doubledouble<FLT>& lhs,
const doubledouble<FLT>& rhs) {
doubledouble<FLT> re = two_product(lhs.r, rhs.r);
re.e += lhs.r * rhs.e + lhs.e * rhs.r;
return two_sum_quick(re.r, re.e);
}
template <typename FLT>
doubledouble<FLT> operator/(const doubledouble<FLT>& lhs,
const doubledouble<FLT>& rhs) {
auto r = lhs.r / rhs.r;
auto sf = two_product(r, rhs.r);
auto e = (lhs.r - sf.r - sf.e + lhs.e - r * rhs.e) / rhs.r;
return two_sum_quick(r, e);
}
template <typename FLT>
bool operator<(const doubledouble<FLT>& lhs, doubledouble<FLT> rhs) {
return lhs.r < rhs.r || (lhs.r == rhs.r && lhs.e < rhs.e);
}
template <typename FLT>
bool operator>(const doubledouble<FLT>& lhs, doubledouble<FLT> rhs) {
return lhs.r > rhs.r || (lhs.r == rhs.r && lhs.e > rhs.e);
}
template <typename FLT>
bool operator<(const doubledouble<FLT>& lhs, double rhs) {
return lhs.r < rhs || (lhs.r == rhs && lhs.e < 0.0);
}
template <typename FLT>
bool operator>(const doubledouble<FLT>& lhs, double rhs) {
return lhs.r > rhs;
}
template <typename FLT>
bool operator==(const doubledouble<FLT>& lhs, const doubledouble<FLT>& rhs) {
return lhs.r == rhs.r && lhs.e == rhs.e;
}
template <typename FLT>
bool operator!=(const doubledouble<FLT>& lhs, const doubledouble<FLT>& rhs) {
return lhs.r != rhs.r || lhs.e != rhs.e;
}
namespace std {
template <typename FLT>
class numeric_limits<doubledouble<FLT>> {
public:
static const size_t digits10 = 2 * std::numeric_limits<FLT>::digits10;
static const size_t digits = 2 * std::numeric_limits<FLT>::digits + 2;
static doubledouble<FLT> epsilon() {
return doubledouble<FLT>(std::numeric_limits<FLT>::epsilon() *
std::numeric_limits<FLT>::epsilon());
}
};
template <typename FLT>
doubledouble<FLT> abs(const doubledouble<FLT> f) {
if (f < 0.0) return doubledouble<FLT>(-f.r, -f.e);
return f;
}
} // namespace std
#endif // _doubledouble_hpp
| [
"larsch@belunktum.dk"
] | larsch@belunktum.dk |
a57e0ed62e36fc3285b815c78f132d8cbd5d63d5 | 8010df1fef10ddfd83bf07966cbf7e2e4b0d7ee9 | /include/winsdk/um/shidfact.h | b01551bfb7045798e1d9f191e0dff6836995f373 | [] | no_license | light-tech/MSCpp | a23ab987b7e12329ab2d418b06b6b8055bde5ca2 | 012631b58c402ceec73c73d2bda443078bc151ef | refs/heads/master | 2022-12-26T23:51:21.686396 | 2020-10-15T13:40:34 | 2020-10-15T13:40:34 | 188,921,341 | 6 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,457 | h | //
// Copyright (C) Microsoft. All rights reserved.
//
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
#pragma once
#endif
#ifndef _INC_SHIDFACT
#define _INC_SHIDFACT
#include <winapifamily.h>
#pragma region Desktop Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#ifdef __cplusplus
#include <shobjidl_core.h> // for IDelegateFolder
#include <propvarutil.h> // for PropVariantToVariant
template <class T, DWORD dwMagic>
class CItemIDFactory : public IDelegateFolder
{
protected:
CItemIDFactory() : _pmalloc(NULL) {}
// if we have an IMalloc from IDelegateFolder::SetItemAlloc then clean it up
virtual ~CItemIDFactory()
{
if (_pmalloc)
{
_pmalloc->Release();
}
}
public:
// IUnknown provided by derived classes
// IDelegateFolder
IFACEMETHODIMP SetItemAlloc(_In_opt_ IMalloc *pmalloc)
{
IUnknown_Set((IUnknown**)&_pmalloc, pmalloc);
return S_OK;
}
BOOL IsDelegateFolder()
{
return (_pmalloc != NULL);
}
// get a read only pointer to the client provided structure in the first ItemID in the IDList.
// returns NULL if the IDList isn't valid.
static const UNALIGNED T* GetDataFromIDList(_In_opt_ PCUIDLIST_RELATIVE pidl)
{
PCITEM pitem = _IsValid(pidl);
return pitem ? &pitem->innerData : NULL;
}
static HRESULT GetDataFromIDList(_In_ PCUIDLIST_RELATIVE pidl, _Outptr_ const UNALIGNED T** ppData)
{
*ppData = GetDataFromIDList(pidl);
return (*ppData) ? S_OK : E_INVALIDARG;
}
// return a read only pointer to the serialized property storage that we use for storing metadata
static PCUSERIALIZEDPROPSTORAGE GetPropertyStorage(_In_opt_ PCUIDLIST_RELATIVE pidl, _Out_ DWORD* pcb)
{
PCITEM pitem = _IsValid(pidl);
if (pitem && pitem->cbPropStore)
{
*pcb = pitem->cbPropStore;
return (PCUSERIALIZEDPROPSTORAGE)(pitem + 1);
}
return NULL;
}
// return a property from the IPropertyStore within the IDList, convert the resulting PROPVARIANT
// to a variant (useful when implementing IShellFolder2::GetDetailsEx)
// return vt == VT_EMPTY if not found
static HRESULT GetPropertyFromIDList(_In_ PCUIDLIST_RELATIVE pidl, _In_ REFPROPERTYKEY rkey, _Out_ VARIANT *pvar)
{
PROPVARIANT pv = {pvar->vt};
HRESULT hr = GetPropertyFromIDList(pidl, rkey, &pv);
if (SUCCEEDED(hr))
{
hr = PropVariantToVariant(&pv, pvar);
PropVariantClear(&pv);
}
return hr;
}
static HRESULT GetPropertyFromIDList(_In_ PCUIDLIST_RELATIVE pidl, _In_ PCWSTR pszName, _Out_ VARIANT *pvar)
{
PROPVARIANT pv = {pvar->vt};
HRESULT hr = GetPropertyFromIDList(pidl, pszName, &pv);
if (SUCCEEDED(hr))
{
hr = PropVariantToVariant(&pv, pvar);
PropVariantClear(&pv);
}
return hr;
}
// read a PROPVARIANT from the IPropertyStore within the first ItemID in the IDList.
static HRESULT GetPropertyFromIDList(_In_ PCUIDLIST_RELATIVE pidl, _In_ REFPROPERTYKEY rkey, _Out_ PROPVARIANT *pv)
{
PropVariantInit(pv);
HRESULT hr = E_INVALIDARG;
DWORD cb;
PCUSERIALIZEDPROPSTORAGE psps = GetPropertyStorage(pidl, &cb);
if (psps)
{
hr = PSGetPropertyFromPropertyStorage(psps, cb, rkey, pv);
if (SUCCEEDED(hr) && (pv->vt == VT_EMPTY))
{
hr = HRESULT_FROM_WIN32(ERROR_UNKNOWN_PROPERTY);
}
}
return hr;
}
// read a PROPVARIANT from the IPropertyStore within the first ItemID in the IDList using the named property
static HRESULT GetPropertyFromIDList(_In_ PCUIDLIST_RELATIVE pidl, _In_ PCWSTR pszName, _Out_ PROPVARIANT *pv)
{
PropVariantInit(pv);
HRESULT hr = E_INVALIDARG;
DWORD cb;
PCUSERIALIZEDPROPSTORAGE psps = GetPropertyStorage(pidl, &cb);
if (psps)
{
hr = PSGetNamedPropertyFromPropertyStorage(psps, cb, pszName, pv);
if (SUCCEEDED(hr) && (pv->vt == VT_EMPTY))
{
hr = HRESULT_FROM_WIN32(ERROR_UNKNOWN_PROPERTY);
}
}
return hr;
}
// create an instance of the IPropertyStore based on the serialized property storage associated
// with the first ItemID.
static HRESULT GetPropertyStorageFromIDList(_In_ PCUIDLIST_RELATIVE pidl, _In_ REFIID riid, _Outptr_ void **ppv)
{
HRESULT hr = E_INVALIDARG;
if (pidl && ppv)
{
*ppv = NULL;
DWORD cb;
PCUSERIALIZEDPROPSTORAGE psps = GetPropertyStorage(pidl, &cb);
if (psps)
{
IPersistSerializedPropStorage* ppsps;
hr = PSCreateMemoryPropertyStore(IID_PPV_ARGS(&ppsps));
if (SUCCEEDED(hr))
{
hr = ppsps->SetPropertyStorage(psps, cb);
if (SUCCEEDED(hr))
{
hr = ppsps->SetFlags(FPSPS_READONLY);
if (SUCCEEDED(hr))
{
hr = ppsps->QueryInterface(riid, ppv);
}
}
ppsps->Release();
}
}
}
return hr;
}
// package up the user supplied data into an ItemID. pinner points to the clients structure
// that should be copied, and the IPropertyStore is serialized into the ItemID. If the
// client has called IDelegateFolder::SetItemAlloc then we will allocate with that
// allocator, otherwise the COM allocator is used. the size of the user supplied data must
// equal sizeof(T). don't use structs with variably allocated array/string members. the
// struct must also follow standard SHITEMID for persistance and portability. see
// shtypes.idl for details.
HRESULT CreateItemID(_In_opt_ const UNALIGNED T *pinner, _Inout_opt_ IPropertyStore *pps, _Outptr_ PITEMID_CHILD *ppidl)
{
return s_CreateItemID(pinner, pps, ppidl, _pmalloc);
}
static HRESULT s_CreateItemID(_In_opt_ const UNALIGNED T *pinner, _Inout_opt_ IPropertyStore *pps, _Outptr_ PITEMID_CHILD *ppidl, _In_opt_ IMalloc *pMalloc=NULL)
{
*ppidl = NULL;
SERIALIZEDPROPSTORAGE *pspstg = NULL;
DWORD cbPropStore = 0;
// do we have a IPropertyStore, if so we are going to add this to the ItemID
// so we need to get the serialized version of it.
HRESULT hr = S_OK;
if (pps)
{
IPersistSerializedPropStorage *ppsps;
hr = pps->QueryInterface(IID_PPV_ARGS(&ppsps));
if (SUCCEEDED(hr))
{
hr = ppsps->GetPropertyStorage(&pspstg, &cbPropStore);
ppsps->Release();
}
}
// either we succeeded at getting the serialized data, or an IPropertyStore wasn't passed to us.
if (SUCCEEDED(hr))
{
UINT cbInner = sizeof(CHILDITEMID) - (sizeof(DELEGATEITEMID) - 1) + cbPropStore;
CHILDITEMID *pitem = s_Alloc(cbInner + sizeof(USHORT), pMalloc);
if (pitem)
{
pitem->dwMagic = dwMagic;
pitem->cbPropStore = (WORD)cbPropStore; // size of the property store
pitem->cbInnerData = sizeof(pitem->innerData); // size of the "innerData" structure (useful for debugging)
if (pinner)
pitem->innerData = *pinner; // copy the structure provided by the user
if (pspstg)
{
BYTE *pbData = (BYTE*)(pitem+1);
memcpy(pbData, pspstg, cbPropStore); // copy property store to ItemID
}
*ppidl = (PITEMID_CHILD)pitem;
hr = S_OK;
}
else
{
hr = E_OUTOFMEMORY;
}
CoTaskMemFree(pspstg);
}
return hr;
}
private:
// ItemID form is derived from the delegate folder verison, this allows us to easily
// switch allocators without having to recompute the ItemID structure dynamically.
#include <pshpack1.h>
typedef struct // typedef struct
{ // {
// these need to line up -----------------------
WORD cbSize; // WORD cbSize; // Size of entire item ID
WORD wOuter; // WORD wOuter; // Private data owned by the outer folder
WORD cbInner; // WORD cbInner; // Size of delegate's data
// ---------------------------------------------
DWORD dwMagic; // guard word used to compare to ensure its valid
WORD cbPropStore; // size of the property store at the end of the ItemID
WORD cbInnerData; // size of the innerData structure
T innerData; // inner data returned by the client
} CHILDITEMID;
#include <poppack.h>
typedef UNALIGNED CHILDITEMID * PITEM;
typedef const UNALIGNED CHILDITEMID * PCITEM;
// given the size of the ItemID we want, let's allocate using the supplied
// allocator and initialize the structure
IMalloc *_pmalloc; // used to allocate ItemID when we are a delegate folder
static CHILDITEMID* s_Alloc(SIZE_T cbInner, _In_opt_ IMalloc *pMalloc)
{
DELEGATEITEMID *pidl;
if (pMalloc)
{
pidl = (DELEGATEITEMID *)pMalloc->Alloc(cbInner);
}
else
{
SIZE_T cbAlloc =
sizeof(DELEGATEITEMID) - sizeof(pidl->rgb[0]) + // header
cbInner + // inner
sizeof(WORD); // trailing null (pidl terminator)
const SIZE_T cbSizeMax = (1 << (sizeof(pidl->cbSize)*8)) - 1;
if (cbAlloc > cbSizeMax + sizeof(WORD))
{
// cbSize will overflow
pidl = NULL;
}
else
{
pidl = (DELEGATEITEMID *)CoTaskMemAlloc(cbAlloc);
if (pidl)
{
ZeroMemory(pidl, cbAlloc);
pidl->cbSize = (WORD)(cbAlloc - sizeof(WORD));
pidl->cbInner = (WORD)cbInner;
}
}
}
return (CHILDITEMID*)pidl;
}
// given a relative IDList, determine if it's valid and therefore if
// we should continue to process the contents of it.
static PCITEM _IsValid(_In_opt_ PCUIDLIST_RELATIVE pidl)
{
PCITEM pitem = (PCITEM)pidl;
if (!pitem || pitem->cbSize < sizeof(CHILDITEMID))
return NULL;
if ((pitem->dwMagic != dwMagic) || (pitem->cbSize < (sizeof(CHILDITEMID) + pitem->cbPropStore)))
return NULL;
return pitem;
}
};
#endif // __cplusplus
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
#pragma endregion
#endif // _INC_SHIDFACT
| [
"lightech@outlook.com"
] | lightech@outlook.com |
56d0602fd30b4e322a1ef88cbcff24b5281c8f7d | 73e889b6ed0630a71788e819d10c917a2065faca | /Qt5-widgets-beginners/chapter6-dialogs/qtwb-6-3/selections.h | cacc99dd51ea2f0fac0c113861a92958ac099923 | [] | no_license | tenevincent/Qt-Learning-for-beginners | 39d4844b418176443c28e9a1ea004af61a9066dd | 0b289b690007e65c066f76a452f08598bc9aeeee | refs/heads/main | 2023-04-02T23:14:36.280457 | 2021-04-14T22:02:38 | 2021-04-14T22:02:38 | 352,951,819 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 586 | h | #ifndef SELECTIONS_H
#define SELECTIONS_H
#include <QDialog>
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QFileInfoList>
#include <QListWidgetItem>
namespace Ui {
class Selections;
}
class Selections : public QDialog
{
Q_OBJECT
public:
explicit Selections(QWidget *parent = nullptr);
~Selections();
QString selected();
void setSelected(QString value);
private slots:
void on_buttonBox_accepted();
void on_buttonBox_rejected();
private:
Ui::Selections *ui;
QString m_selected;
void init();
};
#endif // SELECTIONS_H
| [
"vincent.tene@gmail.com"
] | vincent.tene@gmail.com |
c30f8e23cdf376d0c8eaecb724693cc9e44b45f1 | a41bd626dde5894f0becfb598d70acf7e7345762 | /Implementations/Leetcode/number_of_operations_to_make_network_connected.cpp | 6b8cb78b0486b6a60bc10ea20f786e74e46460de | [] | no_license | escaper423/Algorithm_Coding_Note | 7dcad233b45b1f4a6bf4af61f1e8316c7a253961 | 8e79ed8dd6e0b7e12d305981fcd9adb57ff132eb | refs/heads/master | 2021-11-07T05:41:47.129140 | 2021-11-03T08:52:53 | 2021-11-03T08:52:53 | 160,045,726 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,228 | cpp | #include <vector>
#include <iostream>
#include <string>
#include <algorithm>
#include <Windows.h>
#include <unordered_map>
#include <unordered_set>
//problem URL : https://leetcode.com/problems/number-of-operations-to-make-network-connected/
using namespace std;
unordered_set<int> visited;
int numGroup = -1;
void findNumConnected(vector<vector<int>> &g, int i) {
visited.insert(i);
for (auto &it : g[i]) {
if (visited.find(it) == visited.end()) {
findNumConnected(g, it);
}
}
}
int makeConnected(int n, vector<vector<int>>& connections) {
int edges = connections.size();
vector<vector<int>> g(n, vector<int>());
for (auto &it : connections) {
g[it[0]].push_back(it[1]);
g[it[1]].push_back(it[0]);
}
for (int i = 0; i < n; i++) {
if (visited.find(i) == visited.end())
{
findNumConnected(g, i);
numGroup++;
}
}
if (edges >= n - 1)
return numGroup;
else
return -1;
}
int main() {
vector<vector<int>> c;
int node_num;
cin >> node_num;
int edge_num;
cin >> edge_num;
c.resize(edge_num);
for (int i = 0; i < edge_num; i++) {
int f, s;
cin >> f >> s;
c[i].push_back(f);
c[i].push_back(s);
}
cout << makeConnected(node_num, c) << endl;
system("pause");
return 0;
}
| [
"escaper423@gmail.com"
] | escaper423@gmail.com |
634cb94e31650a270b481dcac5279c98ae4a6ba0 | 6a8aaf9c16f4856532cf9acc14dd33a602ccc115 | /src/tmx/TmxUtils/src/GeoVector.cpp | 2ac8f2f9d249610bd254a0ccbbeba6f47f484112 | [
"Apache-2.0"
] | permissive | RCVWPHASEII/V2I-Hub | ffcbfa6cb445bed281d1406b8b7cb7fa5b8beff8 | 5ed6d672b92257af60db0eb06ea32acfcf7c3674 | refs/heads/master | 2023-05-07T20:08:42.223640 | 2021-05-18T02:46:40 | 2021-05-18T02:46:40 | 360,922,301 | 0 | 2 | NOASSERTION | 2021-04-30T21:58:32 | 2021-04-23T15:07:10 | null | UTF-8 | C++ | false | false | 16,399 | cpp | /*
* GeoVector.cpp
*
* Created on: Oct 6, 2016
* Author: ivp
*/
// Officially, the ANSI standard does not include the math constant definitions, such as M_PI used below
#ifdef __STRICT_ANSI__
#undef __STRICT_ANSI__
#include <cmath>
#define __STRICT_ANSI__
#else
#include <cmath>
#endif
#include "GeoVector.h"
namespace tmx {
namespace utils {
/*
* initialization of statics
*/
const double GeoVector::_earthRadiusInKM = 6371.0;
/*
* Constructors
*/
GeoVector::GeoVector(double x, double y, double z) : _x(x), _y(y), _z(z)
{
}
/*
* Convert WGS84Point (lat/long) to NVector
*
* return GeoVector
*/
GeoVector GeoVector::WGS84PointToNVector(WGS84Point point)
{
GeoVector vec;
double lat;
double lon;
//convert lat/lon to radians
lat = point.Latitude * M_PI / 180.0;
lon = point.Longitude * M_PI / 180.0;
//create right handed vector x -> 0°E,0°N; y -> 90°E,0°N, z -> 90°N
vec._x = cos(lat) * cos(lon);
vec._y = cos(lat) * sin(lon);
vec._z = sin(lat);
return vec;
}
/*
* Convert NVector to WGS84Point (lat/long)
*
* return WGS84Point
*/
WGS84Point GeoVector::NVectorToWGS84Point(GeoVector vec)
{
WGS84Point point;
point.Latitude = atan2(vec._z, sqrt((vec._x * vec._x) + (vec._y * vec._y))) * 180.0 / M_PI;
point.Longitude = atan2(vec._y, vec._x) * 180.0 / M_PI;
return point;
}
/*
* Calculate vector dot product
*
* return double
*/
double GeoVector::Dot(GeoVector vec1, GeoVector vec2)
{
return (vec1._x * vec2._x) + (vec1._y * vec2._y) + (vec1._z * vec2._z);
}
/*
* Calculate vector cross product
*
* return GeoVector
*/
GeoVector GeoVector::Cross(GeoVector vec1, GeoVector vec2)
{
GeoVector vec;
vec._x = (vec1._y * vec2._z) - (vec1._z * vec2._y);
vec._y = (vec1._z * vec2._x) - (vec1._x * vec2._z);
vec._z = (vec1._x * vec2._y) - (vec1._y * vec2._x);
return vec;
}
/*
* Calculate magnitude or norm of vector
*
* return double
*/
double GeoVector::Length(GeoVector vec)
{
return sqrt((vec._x * vec._x) + (vec._y * vec._y) + (vec._z * vec._z));
}
/*
* Calculate vec1 + vec2
*
* return GeoVector
*/
GeoVector GeoVector::Plus(GeoVector vec1, GeoVector vec2)
{
GeoVector vec;
vec._x = vec1._x + vec2._x;
vec._y = vec1._y + vec2._y;
vec._z = vec1._z + vec2._z;
return vec;
}
/*
* Calculate vec1 - vec2
*
* return GeoVector
*/
GeoVector GeoVector::Minus(GeoVector vec1, GeoVector vec2)
{
GeoVector vec;
vec._x = vec1._x - vec2._x;
vec._y = vec1._y - vec2._y;
vec._z = vec1._z - vec2._z;
return vec;
}
/*
* Normalize vector to its unit vector
*
* return GeoVector
*/
GeoVector GeoVector::Unit(GeoVector vec)
{
GeoVector nvec;
double norm = Length(vec);
if (norm == 1)
return vec;
if (norm == 0)
return vec;
nvec._x = vec._x / norm;
nvec._y = vec._y / norm;
nvec._z = vec._z / norm;
return nvec;
}
/*
* Multiply vector by a value
*
* return GeoVector
*/
GeoVector GeoVector::Times(GeoVector vec, double value)
{
GeoVector rvec;
rvec._x = vec._x * value;
rvec._y = vec._y * value;
rvec._z = vec._z * value;
return rvec;
}
/*
* Calculate angle between vec1 and vec2 in radians (-pi to pi)
* If signVec is not supplied angle is unsigned.
* If signVec is supplied (must be out of the plane of vec1 and vec2) then sign is positive if vec1
* is clockwise looking along signVec, otherwise sign is negative.
*
* return radians (-pi to pi) as double
*
*/
double GeoVector::AngleBetweenInRadians(GeoVector vec1, GeoVector vec2, GeoVector signVec)
{
double angle = atan2(Length(Cross(vec1, vec2)), Dot(vec1, vec2));
if (signVec._x == 0.0 && signVec._y == 0.0 && signVec._z == 0.0)
{
// if signVec is invalid return unsigned angle
return angle;
}
//determine sign
if (Dot(Cross(vec1, vec2),signVec) < 0.0)
{
angle = -angle;
}
return angle;
}
/*
* Calculate distance between two WGS84Point in meters
*
* return meters as double
*/
double GeoVector::DistanceInMeters(WGS84Point point1, WGS84Point point2)
{
GeoVector vec1 = WGS84PointToNVector(point1);
GeoVector vec2 = WGS84PointToNVector(point2);
return DistanceInMeters(vec1, vec2);
}
/*
* Calculate distance between two GeoVector in meters
*
* return meters as double
*/
double GeoVector::DistanceInMeters(GeoVector vec1, GeoVector vec2)
{
double angle = AngleBetweenInRadians(vec1, vec2);
return angle * _earthRadiusInKM * 1000.0;
}
/*
* Calculate great circle given a point and a bearing (degrees 0 to 360)
*
* return GeoVector
*/
GeoVector GeoVector::GreatCircle(GeoVector vec, double bearing)
{
GeoVector gc;
double lat;
double lon;
double bear;
WGS84Point point;
point = NVectorToWGS84Point(vec);
//cout << "Point: " << point.Latitude << "," << point.Longitude << "\n";
//convert to radians
lat = point.Latitude * M_PI / 180.0;
lon = point.Longitude * M_PI / 180.0;
bear = bearing * M_PI / 180.0;
gc._x = (sin(lon) * cos(bear)) - (sin(lat) * cos(lon) * sin(bear));
gc._y = (cos(lon) * -1.0 * cos(bear)) - (sin(lat) * sin(lon) * sin(bear));
gc._z = cos(lat) * sin(bear);
return gc;
}
/*
* Calculate initial bearing from point1 to point2 in degrees from north (0 to 360)
*
* return degrees from north (0 to 360) as double
*/
double GeoVector::BearingInDegrees(WGS84Point point1, WGS84Point point2)
{
GeoVector vec1 = WGS84PointToNVector(point1);
GeoVector vec2 = WGS84PointToNVector(point2);
GeoVector northPole(0, 0, 1);
GeoVector c1; //great circle through point1 and point2 surface normal
GeoVector c2; //great circle through point1 and north pole surface normal
double bearing;
// calculate great circle surface normals
c1 = GeoVector::Cross(vec1, vec2);
c2 = GeoVector::Cross(vec1, northPole);
//signed bearing in degrees (-180 to 180)
bearing = AngleBetweenInRadians(c1, c2, vec1) * 180.0 / M_PI;
//return normalized bearing (0 to 360)
if (bearing < 0.0)
bearing += 360.0;
return bearing;
}
/*
* Calculate point of intersection of two paths.
*
* If c1 and c2 are great circles through start and end points then candidate intersections are c1 × c2 and c2 × c1.
* Choose closer intersection.
*
* return WGS84Point
*/
WGS84Point GeoVector::Intersection(WGS84Point path1P1, WGS84Point path1P2, WGS84Point path2P1, WGS84Point path2P2)
{
GeoVector p1v1 = WGS84PointToNVector(path1P1);
GeoVector p1v2 = WGS84PointToNVector(path1P2);
GeoVector p2v1 = WGS84PointToNVector(path2P1);
GeoVector p2v2 = WGS84PointToNVector(path2P2);
GeoVector c1; //great circle through path1P1 and path1P2 surface normal
GeoVector c2; //great circle through path2P1 and path2P2 surface normal
GeoVector i1; // intersection 1
GeoVector i2; // intersection 2
double sum1, sum2;
// calculate great circle surface normals
c1 = Cross(p1v1, p1v2);
c2 = Cross(p2v1, p2v2);
// get both intersections
i1 = Cross(c1, c2);
i2 = Cross(c2, c1);
//calculate sum of distances from all points to each intersection, choose closest
sum1 = DistanceInMeters(p1v1, i1) + DistanceInMeters(p1v2, i1) +
DistanceInMeters(p2v1, i1) + DistanceInMeters(p2v2, i1);
sum2 = DistanceInMeters(p1v1, i2) + DistanceInMeters(p1v2, i2) +
DistanceInMeters(p2v1, i2) + DistanceInMeters(p2v2, i2);
if (sum1 < sum2)
return NVectorToWGS84Point(i1);
return NVectorToWGS84Point(i2);
}
/*
* Calculate point of intersection of two paths.
*
* If c1 and c2 are great circles through start and end points then candidate intersections are c1 × c2 and c2 × c1.
* Choose closer intersection.
*
* return WGS84Point
*/
WGS84Point GeoVector::Intersection(WGS84Point path1P1, double path1Bearing, WGS84Point path2P1, double path2Bearing)
{
GeoVector p1v1 = WGS84PointToNVector(path1P1);
GeoVector p2v1 = WGS84PointToNVector(path2P1);
GeoVector c1; //great circle through path1P1 and path1P2 surface normal
GeoVector c2; //great circle through path2P1 and path2P2 surface normal
GeoVector i1; // intersection 1
GeoVector i2; // intersection 2
double sum1, sum2;
// calculate great circle surface normals
c1 = GreatCircle(p1v1, path1Bearing);
c2 = GreatCircle(p2v1, path2Bearing);
// get both intersections
i1 = Cross(c1, c2);
i2 = Cross(c2, c1);
//calculate sum of distances from all points to each intersection, choose closest
sum1 = DistanceInMeters(p1v1, i1) + DistanceInMeters(p2v1, i1);
sum2 = DistanceInMeters(p1v1, i2) + DistanceInMeters(p2v1, i2);
if (sum1 < sum2)
return NVectorToWGS84Point(i1);
return NVectorToWGS84Point(i2);
}
/*
* Calculate new position given starting point with bearing and distance traveled in meters
*
* return WGS84Point
*/
WGS84Point GeoVector::DestinationPoint(WGS84Point point, double bearing, double distanceTraveledInMeters)
{
GeoVector n1;
double angle;
double earthRadiusInMeters = _earthRadiusInKM * 1000.0;
double b;
GeoVector northPole(0, 0, 1);
GeoVector de; // direction east
GeoVector dn; // direction north
GeoVector deSin;
GeoVector dnCos;
GeoVector d; // direction vector at n1 (C x n1 where C = great circle)
GeoVector x; // component of n2 parallel to n1
GeoVector y; // component of n2 perpendicular to n1
GeoVector n2;
n1 = WGS84PointToNVector(point);
angle = distanceTraveledInMeters / earthRadiusInMeters; // angle in radians
b = bearing * M_PI / 180.0; // bearing in radians
de = Cross(northPole, n1);
de = Unit(de);
dn = Cross(n1, de);
deSin = Times(de, sin(b));
dnCos = Times(dn, cos(b));
d = Plus(dnCos, deSin);
x = Times(n1, cos(angle));
y = Times(d, sin(angle));
n2 = Plus(x, y);
// you have got to be kidding me
return NVectorToWGS84Point(n2);
}
/*
* Calculate cross track distance, the distance in meters from a point to the great circle defined
* by a path start point and end point, distance is signed (negative to left of path, positive to right of path)
*
* return meters as double
*/
double GeoVector::CrossTrackDistanceInMeters(WGS84Point point, WGS84Point pathP1, WGS84Point pathP2)
{
GeoVector vec1 = WGS84PointToNVector(point);
GeoVector pv1 = WGS84PointToNVector(pathP1);
GeoVector pv2 = WGS84PointToNVector(pathP2);
GeoVector c1; //great circle through pathP1 and pathP2 surface normal
double angle;
// calculate great circle surface normal
c1 = Cross(pv1, pv2);
// calculate angle between surface and point
angle = AngleBetweenInRadians(c1, vec1) - (M_PI / 2);
//return distance in meters
return angle * _earthRadiusInKM * 1000.0;
}
/*
* Calculate cross track distance, the distance in meters from a point to the great circle defined
* by a path start point and bearing, distance is signed (negative to left of path, positive to right of path)
*
* return meters as double
*/
double GeoVector::CrossTrackDistanceInMeters(WGS84Point point, WGS84Point pathP1, double pathBearing)
{
GeoVector vec1 = WGS84PointToNVector(point);
GeoVector pv1 = WGS84PointToNVector(pathP1);
GeoVector c1; //great circle from pathP1 using bearing
double angle;
// calculate great circle surface normal
c1 = GreatCircle(pv1, pathBearing);
// calculate angle between surface and point
angle = AngleBetweenInRadians(c1, vec1) - (M_PI / 2);
//return distance in meters
return angle * _earthRadiusInKM * 1000.0;
}
/*
* Calculate the signed angle from path1 to path2 (-180 to 180)
* Paths are defined by their GPS coordinate pairs
*
* return degrees from north (-180 to 180) as double
*/
double GeoVector::AngleBetweenPathsInDegrees(WGS84Point path1P1, WGS84Point path1P2, WGS84Point path2P1, WGS84Point path2P2)
{
GeoVector p1v1 = WGS84PointToNVector(path1P1);
GeoVector p1v2 = WGS84PointToNVector(path1P2);
GeoVector p2v1 = WGS84PointToNVector(path2P1);
GeoVector p2v2 = WGS84PointToNVector(path2P2);
GeoVector c1; //great circle through path1P1 and path1P2 surface normal
GeoVector c2; //great circle through path2P1 and path2P2 surface normal
double angle;
// calculate great circle surface normals
c1 = Cross(p1v1, p1v2);
c2 = Cross(p2v1, p2v2);
// calculate angle between surface normals using vector to first point as sign vector
angle = AngleBetweenInRadians(c2, c1, p1v1) * 180.0 / M_PI;
//cout << "GC1: " << c1._x << "," << c1._y << "," << c1._z << "\n";
return angle;
}
/*
* Calculate the signed angle from path1 to path2 (-180 to 180)
* Path1 is defined by its GPS start point and bearing, path2 is a GPS coordinate pair
*
* return degrees from north (-180 to 180) as double
*/
double GeoVector::AngleBetweenPathsInDegrees(WGS84Point path1P1, double path1Bearing, WGS84Point path2P1, WGS84Point path2P2)
{
GeoVector p1v1 = WGS84PointToNVector(path1P1);
GeoVector p2v1 = WGS84PointToNVector(path2P1);
GeoVector p2v2 = WGS84PointToNVector(path2P2);
GeoVector c1; //great circle through path1P1 and path1Bearing
GeoVector c2; //great circle through path2P1 and path2P2 surface normal
double angle;
// calculate great circle surface normals
c1 = GreatCircle(p1v1, path1Bearing);
c2 = Cross(p2v1, p2v2);
// calculate angle between surface normals using vector to first point as sign vector
angle = AngleBetweenInRadians(c2, c1, p1v1) * 180.0 / M_PI;
//cout << "GC1(B): " << c1._x << "," << c1._y << "," << c1._z << " B: " << path1Bearing << "\n";
return angle;
}
/*
* Calculate the midpoint between two GPS coordinate points
*
* return WGS84Point
*/
WGS84Point GeoVector::MidpointBetween(WGS84Point point1, WGS84Point point2)
{
GeoVector vec;
GeoVector vec1 = WGS84PointToNVector(point1);
GeoVector vec2 = WGS84PointToNVector(point2);
vec = Plus(vec1, vec2);
vec = Unit(vec);
return NVectorToWGS84Point(vec);
}
/*
* Test if point is between two points of a path segment. If point is not on path return true if
* point is between perpendiculars from path segment points.
*
* return bool
*/
bool GeoVector::IsBetween(WGS84Point point, WGS84Point pathP1, WGS84Point pathP2)
{
GeoVector vec1 = WGS84PointToNVector(point);
GeoVector pv1 = WGS84PointToNVector(pathP1);
GeoVector pv2 = WGS84PointToNVector(pathP2);
GeoVector d10, d12, d20, d21;
double extent1, extent2;
d10 = Minus(vec1, pv1);
d12 = Minus(pv2, pv1);
d20 = Minus(vec1, pv2);
d21 = Minus(pv1, pv2);
extent1 = Dot(d10, d12);
extent2 = Dot(d20, d21);
if (extent1 >= 0.0 && extent2 >= 0.0)
return true;
return false;
}
/*
* Return the nearest point on a path segment if point argument is between segment endpoints. If point
* argument is not between segment endpoints return nearest endpoint.
*
* return WGS84Point
*/
WGS84Point GeoVector::NearestPointOnSegment(WGS84Point point, WGS84Point pathP1, WGS84Point pathP2)
{
GeoVector vec1 = WGS84PointToNVector(point);
GeoVector pv1 = WGS84PointToNVector(pathP1);
GeoVector pv2 = WGS84PointToNVector(pathP2);
GeoVector c1, c2, n;
double d1, d2;
if (IsBetween(point, pathP1, pathP2))
{
c1 = Cross(pv1, pv2); //surface normal of great circle through pathP1 and pathP2
c2 = Cross(vec1, c1); //surface normal of great circle through point normal to c1
n = Cross(c1, c2);
}
else
{
d1 = DistanceInMeters(vec1, pv1);
d2 = DistanceInMeters(vec1, pv2);
if (d1 < d2)
return pathP1;
else
return pathP2;
}
return NVectorToWGS84Point(n);
}
/*
* Determine if a point is enclosed by a polygon
* Polygon is defined by a vector of vertices, first vertex is not duplicated
*
* return bool
*/
bool GeoVector::IsEnclosedBy(WGS84Point point, std::vector<WGS84Point> &polygon)
{
WGS84Point p1;
WGS84Point p2;
double angle = 0.0;
bool isFirstPoint = true;
//add angles between point and vertices
for (auto it = polygon.begin() ; it != polygon.end(); ++it)
{
p1 = p2;
p2 = *it;
if (!isFirstPoint)
angle += AngleBetweenPathsInDegrees(point, p1, point, p2);
else
isFirstPoint = false;
}
//add angle between last vertex and first vertex
angle += AngleBetweenPathsInDegrees(point, polygon.back(), point, polygon.front());
if (fabs(angle) >= 360.0)
return true;
else
return false;
}
}
} // namespace tmx::utils
| [
"baumgardner@battelle.org"
] | baumgardner@battelle.org |
81ddf606ba8b824ca9789e03482714212d041465 | 3ad968797a01a4e4b9a87e2200eeb3fb47bf269a | /Atl Internals 2e src/Chapter 05/MathServiceNoAttr/CoCalc.h | 3d68e20f19344f0be45abe567bcfd61e584992c3 | [] | no_license | LittleDrogon/MFC-Examples | 403641a1ae9b90e67fe242da3af6d9285698f10b | 1d8b5d19033409cd89da3aba3ec1695802c89a7a | refs/heads/main | 2023-03-20T22:53:02.590825 | 2020-12-31T09:56:37 | 2020-12-31T09:56:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 693 | h | // CoCalc.h : Declaration of the CCalc
#pragma once
#include "resource.h" // main symbols
#include "MathServiceNoAttr.h"
// CCalc
class ATL_NO_VTABLE CCalc :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CCalc, &CLSID_Calc>,
public IDispatchImpl<ICalc, &IID_ICalc, &LIBID_MathServiceNoAttrLib, /*wMajor =*/ 1, /*wMinor =*/ 0>
{
public:
CCalc()
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_CALC)
BEGIN_COM_MAP(CCalc)
COM_INTERFACE_ENTRY(ICalc)
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
public:
};
OBJECT_ENTRY_AUTO(__uuidof(Calc), CCalc)
| [
"pkedpekr@gmail.com"
] | pkedpekr@gmail.com |
ef060f621a0783dbfd7c7e09bc1f14b2dfc124ef | fb66a5cc43d27f33c85320a6dba8b9a8ff4765a9 | /gapputils/gapphost/GeneratedFiles/Debug/moc_LogbookWidget.cpp | e94ac58dd7be98c9bd6c1aca208ec8f4a506e262 | [] | no_license | e-thereal/gapputils | 7a211c7d92fd2891703cb16bf94e6e05f0fb3b8a | a9eca31373c820c12f4f5f308c0e2005e4672fd0 | refs/heads/master | 2021-04-26T16:42:58.303603 | 2015-09-02T21:32:45 | 2015-09-02T21:32:45 | 38,838,767 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,852 | cpp | /****************************************************************************
** Meta object code from reading C++ file 'LogbookWidget.h'
**
** Created: Sun Jan 13 18:18:51 2013
** by: The Qt Meta Object Compiler version 63 (Qt 4.8.2)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../../LogbookWidget.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'LogbookWidget.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 63
#error "This file was generated using the moc from 4.8.2. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_gapputils__host__LogbookWidget[] = {
// content:
6, // revision
0, // classname
0, 0, // classinfo
9, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
1, // signalCount
// signals: signature, parameters, type, tag, flags
37, 32, 31, 31, 0x05,
// slots: signature, parameters, type, tag, flags
97, 68, 31, 31, 0x0a,
158, 31, 31, 31, 0x0a,
183, 31, 31, 31, 0x0a,
210, 31, 31, 31, 0x0a,
225, 31, 31, 31, 0x0a,
238, 31, 31, 31, 0x0a,
252, 31, 31, 31, 0x0a,
275, 263, 31, 31, 0x0a,
0 // eod
};
static const char qt_meta_stringdata_gapputils__host__LogbookWidget[] = {
"gapputils::host::LogbookWidget\0\0uuid\0"
"selectModuleRequested(QString)\0"
"message,severity,module,uuid\0"
"showMessage(std::string,std::string,std::string,std::string)\0"
"handleButtonToggle(bool)\0"
"handleTextChanged(QString)\0filterModule()\0"
"filterUuid()\0clearFilter()\0clearLog()\0"
"item,column\0handleItemDoubleClicked(QTreeWidgetItem*,int)\0"
};
void gapputils::host::LogbookWidget::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
Q_ASSERT(staticMetaObject.cast(_o));
LogbookWidget *_t = static_cast<LogbookWidget *>(_o);
switch (_id) {
case 0: _t->selectModuleRequested((*reinterpret_cast< const QString(*)>(_a[1]))); break;
case 1: _t->showMessage((*reinterpret_cast< const std::string(*)>(_a[1])),(*reinterpret_cast< const std::string(*)>(_a[2])),(*reinterpret_cast< const std::string(*)>(_a[3])),(*reinterpret_cast< const std::string(*)>(_a[4]))); break;
case 2: _t->handleButtonToggle((*reinterpret_cast< bool(*)>(_a[1]))); break;
case 3: _t->handleTextChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
case 4: _t->filterModule(); break;
case 5: _t->filterUuid(); break;
case 6: _t->clearFilter(); break;
case 7: _t->clearLog(); break;
case 8: _t->handleItemDoubleClicked((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
default: ;
}
}
}
const QMetaObjectExtraData gapputils::host::LogbookWidget::staticMetaObjectExtraData = {
0, qt_static_metacall
};
const QMetaObject gapputils::host::LogbookWidget::staticMetaObject = {
{ &QWidget::staticMetaObject, qt_meta_stringdata_gapputils__host__LogbookWidget,
qt_meta_data_gapputils__host__LogbookWidget, &staticMetaObjectExtraData }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &gapputils::host::LogbookWidget::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *gapputils::host::LogbookWidget::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *gapputils::host::LogbookWidget::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_gapputils__host__LogbookWidget))
return static_cast<void*>(const_cast< LogbookWidget*>(this));
return QWidget::qt_metacast(_clname);
}
int gapputils::host::LogbookWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QWidget::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 9)
qt_static_metacall(this, _c, _id, _a);
_id -= 9;
}
return _id;
}
// SIGNAL 0
void gapputils::host::LogbookWidget::selectModuleRequested(const QString & _t1)
{
void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 0, _a);
}
QT_END_MOC_NAMESPACE
| [
"brosch.tom@gmail.com"
] | brosch.tom@gmail.com |
1c0d776af4b9b75738149a2350d766bf4f8dc1e7 | e9e8064dd3848b85b65e871877c55f025628fb49 | /code/MapEngine/MapLayer/MapPoint.h | f16b67923fcc13ba45c9040fd8abd03c32a30319 | [] | no_license | xxh0078/gmapx | eb5ae8eefc2308b8ca3a07f575ee3a27b3e90d95 | e265ad90b302db7da05345e2467ec2587e501e90 | refs/heads/master | 2021-06-02T14:42:30.372998 | 2019-08-29T02:45:10 | 2019-08-29T02:45:10 | 12,397,909 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 814 | h | #pragma once
#include "../MapBase/MapBase.h"
#include "MapPoiRes.h"
class VOS_EXPORT CMapPoint: public MapPoint
{
public:
CMapPoint(void);
~CMapPoint(void);
public:
void SetX(double& dbX ) { m_Point.x = dbX;};
void SetY(double& dbY ) { m_Point.y = dbY;};
void SetIndex(unsigned int uiIndex ) { m_uid = uiIndex ; };
unsigned int GetIndex() { return m_uid; };
// void SetStatus(bool& bStatus) { m_bStatus = bStatus;};
double GetX() { return m_Point.x;};
double GetY() { return m_Point.y;};
double Distance(CMapPoint& pt );
// bool GetStatus() { return m_bStatus;};
bool IsEqual(CMapPoint& pt );
bool IsPointInLine(CMapPoint& p1 , CMapPoint& p2 );
public:
MapPoint m_Point;
long m_uid;
string m_strPoiName; //默认显示
string m_strText; //鼠标移动显示
VOSRect m_rc;
};
| [
"you@example.com"
] | you@example.com |
571ed7b99eb6197feb8bef45be458aa5415a0153 | 3720c717b5e6ec72fc08bd7dfdec6ba9d6f51915 | /utils/libcuckoo/cuckoohash_util.h | af17a6df3c98a189214267dad9b00b4421198a9f | [
"Apache-2.0"
] | permissive | wthanone/kmerLSH | 9e71602e285944b65b4b320a620d59df9f9d6da4 | 3b9b8c83936fd77b0a6fe9cbd62b72944497f97b | refs/heads/master | 2023-04-17T14:44:36.858743 | 2021-04-26T14:49:05 | 2021-04-26T14:49:05 | 235,373,667 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 831 | h | #ifndef UTIL_H
#define UTIL_H
#include <pthread.h>
#include "cuckoohash_config.h" // for LIBCUCKOO_DEBUG
#if LIBCUCKOO_DEBUG
# define LIBCUCKOO_DBG(fmt, args...) \
fprintf(stderr, "\x1b[32m""[libcuckoo:%s:%d:%lu] " fmt"" "\x1b[0m", \
__FILE__,__LINE__, (unsigned long)pthread_self(), ##args)
#else
# define LIBCUCKOO_DBG(fmt, args...) do {} while (0)
#endif
// For enabling certain methods based on a condition. Here's an example.
// ENABLE_IF(some_cond, type, static, inline) method() {
// ...
// }
#define ENABLE_IF(preamble, condition, return_type) \
template <class Bogus=void*> \
preamble typename std::enable_if<sizeof(Bogus) && \
condition, return_type>::type
#endif
| [
"hanwon@darwin.soic.indiana.edu"
] | hanwon@darwin.soic.indiana.edu |
f3e26164e97aa8b914b58cfb332a66dfd3ff5f53 | 534f28f7f7f6310e6a08d62b88a97446e0b5de03 | /src/Socket.cpp | 9e706a8ef3943a3f25ac52633ac9e77b059877ce | [] | no_license | danachapnik/REVERSY_WITH_TESTS_NEW | 680225b749e36f0dbee533c4e47035468fb64b6d | 240032972c670fa4654174aa7fde2d2a12a1c241 | refs/heads/master | 2021-09-02T12:00:21.695316 | 2018-01-02T11:48:46 | 2018-01-02T11:48:46 | 113,197,891 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,502 | cpp |
#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <strings.h>
#include <cstring>
#include <iostream>
#include "Socket.h"
Socket::Socket() :
m_socket(socket(AF_INET , SOCK_STREAM , 0)) {
}
void Socket::connectToServer(const char *ip , const unsigned short port) {
if (m_socket == -1) {
throw "Error opening socket";
}
// Convert the ip string to a network address
struct in_addr address;
if (!inet_aton(ip , &address)) {
throw "Can't parse IP address";
}
// Get a hostentstructure for the given host address
struct hostent *server;
server = gethostbyaddr((const void *) &address , sizeof(address) , AF_INET);
if (server == NULL) {
throw "Host is unreachable";
}
// Create a structure for the server address
struct sockaddr_in serverAddress;
bzero((char *) &address , sizeof(address));
serverAddress.sin_family = AF_INET;
memcpy((char *) &serverAddress.sin_addr.s_addr , server->h_addr , server->h_length);
//htons converts values between host and network byte orders
serverAddress.sin_port = htons(port);
// Establish a connection with the TCP server
if (connect(m_socket , (struct sockaddr *) &serverAddress , sizeof(serverAddress)) == -1) {
throw "Error connecting to server";
}
std::cout << "Connected to server" << std::endl;
}
Socket::~Socket() {
close(m_socket);
}
const int Socket::getM_socket() const {
return m_socket;
}
| [
"omerdekel92@gmail.com"
] | omerdekel92@gmail.com |
a97f3ea42641c5d23abbc690b2406c512667dba8 | bcd99d48665e0813d37f31a0eeab9a6e0c19971d | /src/VertexJoiner.cpp | e9d860399d63623fd320745504020a55a2ed8fab | [
"BSD-3-Clause"
] | permissive | wngrahams/meshDemo | 00c4aa1036d04b551ae1c111eddae39dec83a7b3 | eb51a026069d543ff374f4592c17f447fb79f729 | refs/heads/master | 2021-01-15T17:15:54.117717 | 2017-09-21T21:25:00 | 2017-09-21T21:25:00 | 99,745,308 | 0 | 0 | null | 2017-08-10T07:39:55 | 2017-08-08T23:38:48 | C++ | UTF-8 | C++ | false | false | 1,920 | cpp | //
// VertexJoiner.cpp
// meshReduction
//
// Created by Graham Stubbs on 8/25/17.
// Copyright (c) 2017 Graham Stubbs. All rights reserved.
//
#include <iostream>
#include <algorithm>
#include <vector>
#include "VertexJoiner.h"
bool compareDummyVertexPointers (DummyVertex *dv1, DummyVertex *dv2) {return (*dv1 < *dv2);}
VertexJoiner::VertexJoiner (int *ind, float *vert, int numInd, int numVert) {
if (nullptr == ind || nullptr == vert || numInd == 0 || numVert == 0)
std::cout << "Indices and vertices must contain at least 1 vertex\n";
this->oldVertices = vert;
std::vector<DummyVertex *> vertVec(numVert);
std::vector<DummyVertex *> vertVec2(numVert);
for (int i=0; i < numVert; i++) {
vertVec[i] = new DummyVertex(i, this);
vertVec2[i] = vertVec[i];
}
std::sort(vertVec.begin(), vertVec.end(), compareDummyVertexPointers);
int vcount = 1;
vertVec[0]->parent = 0;
std::vector<int> restVerts;
restVerts.push_back(0);
for (int i=0; i < numVert - 1; i++) {
if (*(vertVec[i]) == *(vertVec[i + 1]))
vertVec[i + 1]->parent = vertVec[i]->parent;
else {
vertVec[i + 1]->parent = vcount++;
restVerts.push_back(i + 1);
}
}
this->newVertices = new float[vcount * 3];
this->newIndices = new int[numInd];
for (int i=0; i<vcount; i++) {
this->newVertices[3 * i + 0] = vert[vertVec[restVerts.at(i)]->idx * 3 + 0];
this->newVertices[3 * i + 1] = vert[vertVec[restVerts.at(i)]->idx * 3 + 1];
this->newVertices[3 * i + 2] = vert[vertVec[restVerts.at(i)]->idx * 3 + 2];
}
for (int i=0; i<numInd; i++)
this->newIndices[i] = vertVec2[ind[i]]->parent;
oldVertices = nullptr;
this->newNumVerts = vcount;
for (int i=vertVec.size()-1; i>=0; i--)
delete vertVec[i];
}
| [
"23465768+wngrahams@users.noreply.github.com"
] | 23465768+wngrahams@users.noreply.github.com |
cf6188e141a82dde63e6728ce2e7547b3566a4f8 | f8404fb1b8868991beff43c911494121d02c500e | /model/neighbor.h | a53d476a566f284afcf14aeaeff8a285589b9ecd | [] | no_license | trinacriax/video-push | 1409a80edbb96e8edf4fdd3e293cf54767377ff9 | ce0167692977d25963afb762589690147a32dea9 | refs/heads/master | 2020-05-02T20:03:16.550602 | 2013-08-01T09:48:46 | 2013-08-01T09:50:00 | 11,813,347 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,274 | h | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2011 University of Trento, Italy
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Authors: Alessandro Russo <russo@disi.unitn.it>
* University of Trento, Italy
*/
#ifndef __NEIGHBOR_H__
#define __NEIGHBOR_H__
#include <stdint.h>
#include "chunk-video.h"
#include <ns3/ipv4-address.h>
#include <ns3/nstime.h>
namespace ns3
{
/**
* Data structure containing neighbors' information.
*/
struct Neighbor
{
Neighbor () :
n_address(Ipv4Address::GetAny()), n_port(0)
{
}
Neighbor (Ipv4Address n, uint32_t i) :
n_address(n), n_port(i)
{
}
Ipv4Address n_address; /// Neighbor address.
uint32_t n_port; /// Neighbor port.
/**
*
* \return Neighbor address.
* Get neighbor address.
*/
Ipv4Address
GetAddress ();
/**
*
* \return Neighbor port.
* Get neighbor port.
*/
uint32_t
GetPort ();
};
static inline bool
operator == (const Neighbor &a, const Neighbor &b)
{
return (a.n_address == b.n_address) && (a.n_port == b.n_port);
}
static inline bool
operator < (const Neighbor &a, const Neighbor &b)
{
return (a.n_address < b.n_address);
}
static inline std::ostream&
operator << (std::ostream& outStream, const Neighbor& neighbor)
{
return outStream << "IP=" << neighbor.n_address << " Port=" << neighbor.n_port;
}
} // namespace ns3
#endif /* __NEIGHBOR_H__ */
| [
"russo@disi.unitn.it"
] | russo@disi.unitn.it |
b064489e62250dc8135bdfa5b6b2c21e74653c7a | 85ff5e5db7365c431720b6d79808795d371d6d42 | /routines/level2/tpmv.cc | 6afb55aa35752b2addc035abdcd373901516d248 | [
"MIT"
] | permissive | vgire/nblas | 8b47b304de6a4c348d5896d1822501827ee5198b | eda6cd1cafaf9a56c5184f1e1ce43f8858b8e01a | refs/heads/master | 2021-01-17T10:00:12.990955 | 2016-08-26T14:19:47 | 2016-08-26T14:19:47 | 66,596,639 | 0 | 0 | null | 2016-08-25T22:08:39 | 2016-08-25T22:08:38 | null | UTF-8 | C++ | false | false | 1,387 | cc | #include "cblas.h"
#include "routines.h"
void dtpmv(const v8::FunctionCallbackInfo<v8::Value>& info) {
const enum CBLAS_UPLO uplo = static_cast<CBLAS_UPLO>(info[0]->Uint32Value());
const enum CBLAS_TRANSPOSE trans = static_cast<CBLAS_TRANSPOSE>(info[1]->Uint32Value());
const enum CBLAS_DIAG diag = static_cast<CBLAS_DIAG>(info[2]->Uint32Value());
const int n = info[3]->Uint32Value();
const double *ap = reinterpret_cast<double*>(info[4].As<v8::Float64Array>()->Buffer()->GetContents().Data());
double *x = reinterpret_cast<double*>(info[5].As<v8::Float64Array>()->Buffer()->GetContents().Data());
const int inc_x = info[6]->Uint32Value();
cblas_dtpmv(CblasRowMajor, uplo, trans, diag, n, ap, x, inc_x);
}
void stpmv(const v8::FunctionCallbackInfo<v8::Value>& info) {
const enum CBLAS_UPLO uplo = static_cast<CBLAS_UPLO>(info[0]->Uint32Value());
const enum CBLAS_TRANSPOSE trans = static_cast<CBLAS_TRANSPOSE>(info[1]->Uint32Value());
const enum CBLAS_DIAG diag = static_cast<CBLAS_DIAG>(info[2]->Uint32Value());
const int n = info[3]->Uint32Value();
const float *ap = reinterpret_cast<float*>(info[4].As<v8::Float32Array>()->Buffer()->GetContents().Data());
float *x = reinterpret_cast<float*>(info[5].As<v8::Float32Array>()->Buffer()->GetContents().Data());
const int inc_x = info[6]->Uint32Value();
cblas_stpmv(CblasRowMajor, uplo, trans, diag, n, ap, x, inc_x);
}
| [
"gianoliomateo@gmail.com"
] | gianoliomateo@gmail.com |
8f9c311c0f5f38e0a97c82f8a637455de9a0a3fe | cfce6d21339d67e6831402f3a80700bbea7cc298 | /4.Conditions_and_cycles/Task4.cpp | ad2154b6ffa0baed258adae9ddef7d65f562a227 | [] | no_license | unusual-alias/Cpp_Basics | ab967ad92fb2ccb09bb76a8b15bff1eba1db7b7d | 23058abdc7678ebafa604d227664e4ad46579779 | refs/heads/main | 2023-03-19T03:16:29.810897 | 2021-03-07T00:24:55 | 2021-03-07T00:24:55 | 342,829,861 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,660 | cpp |
#include <iostream>
/ int main() {
// Ex.1 Провеить, что сумма 2-х чисел лежит в диапазоне от 10 до 20 включительно
int a = 43;
int b = 32;
int c = a + b;
std::string res;
if (c >= 10)
if (c <= 20)
res = "Сумма чисел a+b лежит в диапазоне от 10 до 20 - true\n";
else
res = "Сумма чисел a+b не лежит в диапазоне от 10 до 20 - false \n";
std::cout << "Сумма чисел a+b = " << c << "\n";
std::cout << res;
//Ex.2 Проверить, является число простым
int n;
std::cout << "Enter the number \n";
std::cin >> n;
if (n < 1 && n == 1 || n % 2 && n / 2)
std::cout << n << "It is prime number";
else
std::cout << n << "It is not prime number";
// Ex.3 Проверить, что сумма чисел равна 10 или каждое из чисел равно 10
int x, y;
std::cout << "Enter x: \n";
std::cin >> x;
std::cout << "Enter y: \n";
std::cin >> y;
if (x == 10 && y == 10 || x + y == 10) {
std::cout << "true \n";
}
else {
std::cout << "false \n";
}
// Ex.4 Провеить, является ли год високосным
int year;
std::cout << "Enter year \n";
std::cin >> year;
if (year % 4 == 0 && year % 100 || year % 400 == 0) {
std::cout << "It's a leap-year \n";
}
else {
std::cout << "It's not a leap year \n";
}
} | [
"nikolyabra85@gmail.com"
] | nikolyabra85@gmail.com |
99f4226b6d80562bb756d4fcc094d42aa5347d35 | edaa69f6f156b2bbef1c427ef6509fa8ab8d6379 | /Chess/GameManager.h | 216c5151e8189597d78871810984551e59c1db6c | [] | no_license | orertrr/OOP_Project2 | 56fa9b8bb08b4bee55bbd0baf1e324651bbf9d52 | 5bd90055df35adca46474f8b82239b3e3ffa35f4 | refs/heads/master | 2023-05-09T17:37:33.109717 | 2021-06-07T08:44:42 | 2021-06-07T08:44:42 | 374,596,045 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 521 | h | #pragma once
#include"Viewer.h"
#include"Player.h"
#include"Board.h"
#include"Chess.h"
#include<vector>
#include<Qthread>
#include<qmetaobject.h>
using namespace std;
class GameManager
{
private:
Board gameBoard;
Player* blackAndWhite[2];
vector<int> moveList[64];
vector<int> moveChoice;
vector<int> upgrade;
int KingPosition[2];
int movePath[2];
int currentPlayer;
bool endGame;
int winner;
public:
GameManager();
void Load(string);
void Start();
void RePlay();
int checkMate();
void ReSetBoard();
}; | [
"orertrr6207@gmail.com"
] | orertrr6207@gmail.com |
b0e3e48e6dcdcad68d69a24574f8f7eb0b54dfc5 | cb5d53dac793c26f24ccc7af78c5603279958f74 | /sylar/log.cpp | 9f01b9d49743c895ecf2042f247d3a2ab90d730b | [] | no_license | donkeywx/my_sylar | 8a2eda59d4859be26aa1dfb78e35e9772d45f41c | 0351faa11c7dcb0e37087614dbdd9e18e467b453 | refs/heads/master | 2022-04-13T22:26:15.551924 | 2020-04-09T15:15:09 | 2020-04-09T15:15:09 | 243,960,096 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 24,907 | cpp | #include "log.h"
#include "config.h"
#include <functional>
#include <map>
#include <iostream>
namespace sylar
{
const char* LogLevel::ToString(LogLevel::Level level)
{
switch (level)
{
#define XX(name) \
case LogLevel::name: \
return #name; \
break;
XX(DEBUG);
XX(INFO);
XX(WARN);
XX(ERROR);
XX(FATAL);
#undef XX
default:
return "UNKNOWN";
}
return "UNKNOWN";
}
LogLevel::Level LogLevel::FromString(const std::string& str) {
#define XX(level, v) \
if(str == #v) { \
return LogLevel::level; \
}
XX(DEBUG, debug);
XX(INFO, info);
XX(WARN, warn);
XX(ERROR, error);
XX(FATAL, fatal);
XX(DEBUG, DEBUG);
XX(INFO, INFO);
XX(WARN, WARN);
XX(ERROR, ERROR);
XX(FATAL, FATAL);
return LogLevel::UNKNOWN;
#undef XX
}
class MessageFormatItem: public LogFormatter::FormatItem
{
public:
MessageFormatItem(const std::string& str = "") {}
virtual void format(std::ostream& os, Logger::ptr logger, LogLevel::Level level, LogEvent::ptr event) override
{
os << event->getContent();
}
};
class LevelFormatItem: public LogFormatter::FormatItem
{
public:
LevelFormatItem(const std::string& str = "") {}
virtual void format(std::ostream& os, Logger::ptr logger, LogLevel::Level level, LogEvent::ptr event) override
{
os << LogLevel::ToString(level);
}
};
class ElapseFormatItem: public LogFormatter::FormatItem
{
public:
ElapseFormatItem(const std::string& str = "") {}
virtual void format(std::ostream& os, Logger::ptr logger, LogLevel::Level level, LogEvent::ptr event) override
{
os << event->getElapse();
}
};
class NameFormatItem : public LogFormatter::FormatItem {
public:
NameFormatItem(const std::string& str = "") {}
void format(std::ostream& os, Logger::ptr logger, LogLevel::Level level, LogEvent::ptr event) override {
os << event->getLogger()->getName();
}
};
class ThreadIdFormatItem: public LogFormatter::FormatItem
{
public:
ThreadIdFormatItem(const std::string& str = "") {}
virtual void format(std::ostream& os, Logger::ptr logger, LogLevel::Level level, LogEvent::ptr event) override
{
os << event->getThreadId();
}
};
class FiberIdFormatItem: public LogFormatter::FormatItem
{
public:
FiberIdFormatItem(const std::string& str = "") {}
virtual void format(std::ostream& os, Logger::ptr logger, LogLevel::Level level, LogEvent::ptr event) override
{
os << event->getFiberId();
}
};
class ThreadNameFormatItem : public LogFormatter::FormatItem {
public:
ThreadNameFormatItem(const std::string& str = "") {}
void format(std::ostream& os, Logger::ptr logger, LogLevel::Level level, LogEvent::ptr event) override
{
os << event->getThreadName();
}
};
class DateTimeFormatItem: public LogFormatter::FormatItem
{
public:
DateTimeFormatItem(const std::string& format = "%Y:%m:%d %H:%M:%s")
: m_format(format)
{
}
virtual void format(std::ostream& os, Logger::ptr logger, LogLevel::Level level, LogEvent::ptr event) override
{
time_t time = event->getTime();
struct tm tm;
localtime_r(&time, &tm);
char buf[64];
strftime(buf, sizeof(buf), m_format.c_str(), &tm);
os << buf;
}
private:
std::string m_format;
};
class FilenameFormatItem: public LogFormatter::FormatItem
{
public:
FilenameFormatItem(const std::string& str = "") {}
virtual void format(std::ostream& os, Logger::ptr logger, LogLevel::Level level, LogEvent::ptr event) override
{
os << event->getFile();
}
};
class LineFormatItem: public LogFormatter::FormatItem
{
public:
LineFormatItem(const std::string& str = "") {}
virtual void format(std::ostream& os, Logger::ptr logger, LogLevel::Level level, LogEvent::ptr event) override
{
os << event->getLine();
}
};
class NewLineFormatItem : public LogFormatter::FormatItem {
public:
NewLineFormatItem(const std::string& str = "") {}
void format(std::ostream& os, Logger::ptr logger, LogLevel::Level level, LogEvent::ptr event) override {
os << std::endl;
}
};
class StringFormatItem : public LogFormatter::FormatItem {
public:
StringFormatItem(const std::string& str)
:m_string(str) {}
void format(std::ostream& os, Logger::ptr logger, LogLevel::Level level, LogEvent::ptr event) override {
os << m_string;
}
private:
std::string m_string;
};
class TabFormatItem : public LogFormatter::FormatItem {
public:
TabFormatItem(const std::string& str = "") {}
void format(std::ostream& os, Logger::ptr logger, LogLevel::Level level, LogEvent::ptr event) override {
os << "\t";
}
private:
std::string m_string;
};
LogEvent::LogEvent(std::shared_ptr<Logger> logger, LogLevel::Level level,
const char* file, uint32_t line, uint64_t elapse,
uint32_t threadId, uint32_t fiberId, uint64_t time,
const std::string& threadName)
: m_logger(logger), m_level(level), m_file(file),
m_line(line), m_elapse(elapse), m_threadId(threadId),
m_fiberId(fiberId), m_time(time), m_threadName(threadName)
{}
void LogEvent::format(const char* fmt, ...)
{
va_list al;
va_start(al, fmt);
format(fmt, al);
va_end(al);
}
void LogEvent::format(const char* fmt, va_list al)
{
char* buf = nullptr;
int len = vasprintf(&buf, fmt, al);
if(len != -1)
{
m_ss << std::string(buf, len);
free(buf);
}
}
LogEventWrap::LogEventWrap(LogEvent::ptr e)
: m_event(e)
{
}
LogEventWrap::~LogEventWrap()
{
// std::cout << "~" << std::endl;
m_event->getLogger()->log(m_event->getLevel(), m_event);
}
LogFormatter::LogFormatter(const std::string& pattern)
:m_pattern(pattern)
{
init();
}
std::ostream& LogFormatter::format(std::ostream& ofs, std::shared_ptr<Logger> logger, LogLevel::Level level, LogEvent::ptr event)
{
for (auto& i : m_items)
{
i->format(ofs, logger, level, event);
}
return ofs;
}
// std::string LogFormatter::format(std::shared_ptr<Logger> logger, LogLevel::Level level, LogEvent::ptr event)
// {
// std::stringstream ss;
// for (auto& i : m_items)
// {
// i->format(ss, logger, level, event);
// }
// return ss.str();
// }
// 日志格式解析
void LogFormatter::init() {
//str, format, type
std::vector<std::tuple<std::string, std::string, int> > vec;
std::string nstr;
for(size_t i = 0; i < m_pattern.size(); ++i) {
if(m_pattern[i] != '%') {
nstr.append(1, m_pattern[i]);
continue;
}
if((i + 1) < m_pattern.size()) {
if(m_pattern[i + 1] == '%') {
nstr.append(1, '%');
continue;
}
}
size_t n = i + 1;
int fmt_status = 0;
size_t fmt_begin = 0;
std::string str;
std::string fmt;
while(n < m_pattern.size()) {
if(!fmt_status && (!isalpha(m_pattern[n]) && m_pattern[n] != '{'
&& m_pattern[n] != '}')) {
str = m_pattern.substr(i + 1, n - i - 1);
break;
}
if(fmt_status == 0) {
if(m_pattern[n] == '{') {
str = m_pattern.substr(i + 1, n - i - 1);
//std::cout << "*" << str << std::endl;
fmt_status = 1; //解析格式
fmt_begin = n;
++n;
continue;
}
} else if(fmt_status == 1) {
if(m_pattern[n] == '}') {
fmt = m_pattern.substr(fmt_begin + 1, n - fmt_begin - 1);
//std::cout << "#" << fmt << std::endl;
fmt_status = 0;
++n;
break;
}
}
++n;
if(n == m_pattern.size()) {
if(str.empty()) {
str = m_pattern.substr(i + 1);
}
}
}
if(fmt_status == 0) {
if(!nstr.empty()) {
vec.push_back(std::make_tuple(nstr, std::string(), 0));
nstr.clear();
}
vec.push_back(std::make_tuple(str, fmt, 1));
i = n - 1;
} else if(fmt_status == 1) {
std::cout << "pattern parse error: " << m_pattern << " - " << m_pattern.substr(i) << std::endl;
m_error = true;
vec.push_back(std::make_tuple("<<pattern_error>>", fmt, 0));
}
}
if(!nstr.empty()) {
vec.push_back(std::make_tuple(nstr, "", 0));
}
static std::map<std::string, std::function<FormatItem::ptr(const std::string& str)> > s_format_items = {
#define XX(str, C) \
{#str, [](const std::string& fmt) { return FormatItem::ptr(new C(fmt));}}
XX(m, MessageFormatItem), //m:消息
XX(p, LevelFormatItem), //p:日志级别
XX(r, ElapseFormatItem), //r:累计毫秒数
XX(c, NameFormatItem), //c:日志名称
XX(t, ThreadIdFormatItem), //t:线程id
XX(n, NewLineFormatItem), //n:换行
XX(d, DateTimeFormatItem), //d:时间
XX(f, FilenameFormatItem), //f:文件名
XX(l, LineFormatItem), //l:行号
XX(T, TabFormatItem), //T:Tab
XX(F, FiberIdFormatItem), //F:协程id
XX(N, ThreadNameFormatItem), //N:线程名称
#undef XX
};
for(auto& i : vec) {
if(std::get<2>(i) == 0) {
m_items.push_back(FormatItem::ptr(new StringFormatItem(std::get<0>(i))));
} else {
auto it = s_format_items.find(std::get<0>(i));
if(it == s_format_items.end()) {
m_items.push_back(FormatItem::ptr(new StringFormatItem("<<error_format %" + std::get<0>(i) + ">>")));
m_error = true;
} else {
m_items.push_back(it->second(std::get<1>(i)));
}
}
// std::cout << "(" << std::get<0>(i) << ") - (" << std::get<1>(i) << ") - (" << std::get<2>(i) << ")" << std::endl;
}
// std::cout << m_items.size() << std::endl;
}
LogLevel::Level LogAppender::getLevel()
{
MutexType::ReadLock lock(m_mutex);
return m_level;
}
void LogAppender::setLevel(LogLevel::Level level)
{
MutexType::WriteLock lock(m_mutex);
m_level = level;
}
bool LogAppender::hasFormatter()
{
MutexType::ReadLock lock(m_mutex);
return m_hasFormatter;
}
void LogAppender::setFormatter(LogFormatter::ptr val)
{
MutexType::WriteLock lock(m_mutex);
m_formatter = val;
if(m_formatter)
{
m_hasFormatter = true;
}
else
{
m_hasFormatter = false;
}
}
LogFormatter::ptr LogAppender::getFormatter()
{
MutexType::ReadLock lock(m_mutex);
return m_formatter;
}
void StdoutLogAppender::log(std::shared_ptr<Logger> logger, LogLevel::Level level, LogEvent::ptr event)
{
MutexType::ReadLock lock(m_mutex);
if (level >= m_level)
{
m_formatter->format(std::cout, logger, level, event);
}
}
std::string StdoutLogAppender::toYamlString()
{
MutexType::ReadLock lock(m_mutex);
YAML::Node node;
node["type"] = "StdoutLogAppender";
if(m_level != LogLevel::UNKNOWN)
{
node["level"] = LogLevel::ToString(m_level);
}
if(m_hasFormatter && m_formatter)
{
node["formatter"] = m_formatter->getPattern();
}
std::stringstream ss;
ss << node;
return ss.str();
}
FileLogAppender::FileLogAppender(const std::string& filename)
:m_filename(filename)
{
reopen();
}
FileLogAppender::~FileLogAppender()
{
MutexType::ReadLock lock(m_mutex);
if (m_filestream.is_open())
{
m_filestream.close();
}
}
void FileLogAppender::log(std::shared_ptr<Logger> logger, LogLevel::Level level, LogEvent::ptr event)
{
// MutexType::ReadLock lock(m_mutex);
if (level >= m_level)
{
uint64_t now = event->getTime();
if (now >= (m_lastTime + 3))
{
reopen();
m_lastTime = now;
}
MutexType::WriteLock lock(m_mutex);
if (!m_formatter->format(m_filestream, logger, level, event))
{
std::cout << "error" << std::endl;
}
}
}
std::string FileLogAppender::toYamlString()
{
MutexType::ReadLock lock(m_mutex);
YAML::Node node;
node["type"] = "FileLogAppender";
node["file"] = m_filename;
if(m_level != LogLevel::UNKNOWN)
{
node["level"] = LogLevel::ToString(m_level);
}
if(m_hasFormatter && m_formatter)
{
node["formatter"] = m_formatter->getPattern();
}
std::stringstream ss;
ss << node;
return ss.str();
}
bool FileLogAppender::reopen()
{
MutexType::WriteLock lock(m_mutex);
if (m_filestream)
{
m_filestream.close();
}
m_filestream.open(m_filename, std::ios::app);
return !!m_filestream;
}
Logger::Logger(const std::string& name)
:m_name(name),
m_level(LogLevel::ERROR)
{
m_formatter.reset(new LogFormatter("%d{%Y-%m-%d %H:%M:%S}%T%t%T%N%T%F%T[%p]%T[%c]%T%f:%l%T%m%n"));
}
LogLevel::Level Logger::getLevel()
{
MutexType::ReadLock lock(m_mutex);
return m_level;
}
void Logger::setLevel(LogLevel::Level level)
{
MutexType::WriteLock lock(m_mutex);
m_level = level;
}
void Logger::addAppender(LogAppender::ptr appender)
{
MutexType::WriteLock lock(m_mutex);
if (!appender->hasFormatter())
{
appender->setFormatter(m_formatter);
}
m_appenders.push_back(appender);
}
void Logger::delAppender(LogAppender::ptr appender)
{
MutexType::WriteLock lock(m_mutex);
for (auto it = m_appenders.begin();
it != m_appenders.end(); it++)
{
if (*it == appender)
{
m_appenders.erase(it);
break;
}
}
}
void Logger::clearAppender()
{
MutexType::WriteLock lock(m_mutex);
m_appenders.clear();
}
void Logger::setFormatter(LogFormatter::ptr val)
{
MutexType::WriteLock lock(m_mutex);
m_formatter = val;
for (auto& appender : m_appenders)
{
// if (!appender->hasFormatter())
// {
appender->setFormatter(m_formatter);
// }
}
}
void Logger::setFormatter(const std::string& val)
{
std::cout << "---" << val << std::endl;
sylar::LogFormatter::ptr new_val(new sylar::LogFormatter(val));
if(new_val->isError())
{
std::cout << "Logger setFormatter name=" << m_name
<< " value=" << val << " invalid formatter"
<< std::endl;
return;
}
//m_formatter = new_val;
setFormatter(new_val);
}
LogFormatter::ptr Logger::getFormatter()
{
MutexType::ReadLock lock(m_mutex);
return m_formatter;
}
Logger::ptr Logger::getRoot()
{
MutexType::ReadLock lock(m_mutex);
return m_root;
}
void Logger::setRoot(Logger::ptr root)
{
MutexType::WriteLock lock(m_mutex);
m_root = root;
}
std::string Logger::toYamlString()
{
MutexType::ReadLock lock(m_mutex);
YAML::Node node;
node["name"] = m_name;
if(m_level != LogLevel::UNKNOWN)
{
node["level"] = LogLevel::ToString(m_level);
}
if(m_formatter)
{
node["formatter"] = m_formatter->getPattern();
}
for(auto& i : m_appenders)
{
node["appenders"].push_back(YAML::Load(i->toYamlString()));
}
std::stringstream ss;
ss << node;
return ss.str();
}
void Logger::log(LogLevel::Level level, const LogEvent::ptr event)
{
MutexType::ReadLock lock(m_mutex);
if(level >= m_level)
{
auto self = shared_from_this();
if(!m_appenders.empty())
{
for(auto& i : m_appenders)
{
i->log(self, level, event);
}
}
else if(m_root)
{
m_root->log(level, event);
}
else
{
std::cout << "There is not any appender in logger:"
<< self->getName()
<< std::endl;
}
}
}
void Logger::debug(LogEvent::ptr event)
{
log(LogLevel::DEBUG, event);
}
void Logger::error(LogEvent::ptr event)
{
log(LogLevel::ERROR, event);
}
void Logger::info(LogEvent::ptr event)
{
log(LogLevel::INFO, event);
}
void Logger::warn(LogEvent::ptr event)
{
log(LogLevel::WARN, event);
}
void Logger::fatal(LogEvent::ptr event)
{
log(LogLevel::FATAL, event);
}
LoggerManager::LoggerManager()
{
m_root.reset(new Logger("root"));
m_root->addAppender(LogAppender::ptr(new FileLogAppender("root.txt")));
m_loggers[m_root->getName()] = m_root;
init();
}
Logger::ptr LoggerManager::getLogger(const std::string& name)
{
{
MutexType::ReadLock lock(m_mutex);
auto it = m_loggers.find(name);
if (it != m_loggers.end())
{
return it->second;
}
}
{
MutexType::WriteLock lock(m_mutex);
Logger::ptr logger(new Logger(name));
std::string logName = name;
logger->setRoot(m_root);
m_loggers[name] = logger;
return logger;
}
}
void LoggerManager::init()
{
}
std::string LoggerManager::toYamlString()
{
MutexType::ReadLock lock(m_mutex);
YAML::Node node;
for(auto& i : m_loggers)
{
node.push_back(YAML::Load(i.second->toYamlString()));
}
std::stringstream ss;
ss << node;
return ss.str();
}
bool LogAppenderDefine::operator==(const LogAppenderDefine& other) const
{
return m_type == other.m_type
&& m_level == other.m_level
&& m_formatter == other.m_formatter
&& m_file == other.m_file;
}
bool LogDefine::operator==(const LogDefine& other) const
{
return m_name == other.m_name
&& m_level == other.m_level
&& m_formatter == other.m_formatter;
}
bool LogDefine::operator<(const LogDefine& other) const
{
return m_name < other.m_name;
}
bool LogDefine::isValid() const
{
return !m_name.empty();
}
sylar::ConfigVar<std::set<LogDefine> >::ptr g_log_defines =
sylar::Config::Lookup("logs", std::set<LogDefine>(), "logs config");
template<>
class LexicalCast<std::string, LogDefine> {
public:
LogDefine operator()(const std::string& v) {
YAML::Node n = YAML::Load(v);
LogDefine ld;
if(!n["name"].IsDefined()) {
std::cout << "log config error: name is null, " << n
<< std::endl;
throw std::logic_error("log config name is null");
}
ld.setName(n["name"].as<std::string>());
ld.setLevel(LogLevel::FromString(n["level"].IsDefined() ? n["level"].as<std::string>() : ""));
if(n["formatter"].IsDefined()) {
ld.setFormatter(n["formatter"].as<std::string>());
}
if(n["appenders"].IsDefined()) {
//std::cout << "==" << ld.name << " = " << n["appenders"].size() << std::endl;
for(size_t x = 0; x < n["appenders"].size(); ++x) {
auto a = n["appenders"][x];
if(!a["type"].IsDefined()) {
std::cout << "log config error: appender type is null, " << a
<< std::endl;
continue;
}
std::string type = a["type"].as<std::string>();
LogAppenderDefine lad;
if(type == "FileLogAppender") {
lad.setType(AppenderType::Type::FILEAPPENDER);
if(!a["file"].IsDefined()) {
std::cout << "log config error: fileappender file is null, " << a
<< std::endl;
continue;
}
lad.setFile(a["file"].as<std::string>());
if(a["formatter"].IsDefined()) {
lad.setFormatter(a["formatter"].as<std::string>());
}
} else if(type == "StdoutLogAppender") {
lad.setType(AppenderType::Type::STDCOUTAPPENDER);
if(a["formatter"].IsDefined()) {
lad.setFormatter(a["formatter"].as<std::string>());
}
} else {
std::cout << "log config error: appender type is invalid, " << a
<< std::endl;
continue;
}
ld.addLogAppenderDefine(lad);
}
}
return ld;
}
};
template<>
class LexicalCast<LogDefine, std::string> {
public:
std::string operator()(const LogDefine& i) {
YAML::Node n;
n["name"] = i.getName();
if(i.getLevel() != LogLevel::UNKNOWN) {
n["level"] = LogLevel::ToString(i.getLevel());
}
if(!i.getFormatter().empty()) {
n["formatter"] = i.getFormatter();
}
for(auto& a : i.getAppenders()) {
YAML::Node na;
if(a.getType() == AppenderType::Type::FILEAPPENDER) {
na["type"] = "FileLogAppender";
na["file"] = a.getFile();
} else if(a.getType() == AppenderType::Type::STDCOUTAPPENDER) {
na["type"] = "StdoutLogAppender";
}
if(a.getLevel() != LogLevel::UNKNOWN) {
na["level"] = LogLevel::ToString(a.getLevel());
}
if(!a.getFormatter().empty()) {
na["formatter"] = a.getFormatter();
}
n["appenders"].push_back(na);
}
std::stringstream ss;
ss << n;
return ss.str();
}
};
LogIniter::LogIniter()
{
std::function<void (const std::set<LogDefine>&, const std::set<LogDefine>&)> cb = resetLogger;
g_log_defines->addListener(cb);
}
void LogIniter::resetLogger(const std::set<LogDefine>& oldValue,
const std::set<LogDefine>& newValue)
{
SYLAR_LOG_INFO(SYLAR_LOG_ROOT()) << "on_logger_conf_changed";
for (auto& newLogDefine : newValue)
{
auto oldLogDefine = oldValue.find(newLogDefine);
sylar::Logger::ptr logger;
if (oldValue.end() == oldLogDefine)
{
// 新增logger
logger = SYLAR_LOG_NAME(newLogDefine.getName());
}
else
{
// old中有, new中也有,但是不相同,就是修改
if (!(newLogDefine == *oldLogDefine))
{
logger = SYLAR_LOG_NAME(newLogDefine.getName());
}
else
{
continue;
}
}
logger->setLevel(newLogDefine.getLevel());
if (!newLogDefine.getFormatter().empty())
{
logger->setFormatter(newLogDefine.getFormatter());
std::cout << newLogDefine.getFormatter() << std::endl;
}
resetLoggerAppender(logger, newLogDefine);
}
for(auto& oldLogDefine : oldValue)
{
auto it = newValue.find(oldLogDefine);
if(it == newValue.end())
{
//删除logger
auto logger = SYLAR_LOG_NAME(oldLogDefine.getName());
logger->setLevel((LogLevel::Level)0);
logger->clearAppender();
}
}
}
void LogIniter::resetLoggerAppender(Logger::ptr logger, const LogDefine& newLogDefine)
{
logger->clearAppender();
std::vector<LogAppenderDefine> newAppenders= newLogDefine.getAppenders();
for (auto appender : newAppenders)
{
sylar::LogAppender::ptr newAppender;
if(AppenderType::Type::FILEAPPENDER == appender.getType())
{
newAppender.reset(new FileLogAppender(appender.getFile()));
}
else if(AppenderType::Type::STDCOUTAPPENDER == appender.getType())
{
// if(!sylar::EnvMgr::GetInstance()->has("d")) {
newAppender.reset(new StdoutLogAppender);
// } else {
// continue;
// }
}
newAppender->setLevel(appender.getLevel());
if(!appender.getFormatter().empty())
{
LogFormatter::ptr fmt(new LogFormatter(appender.getFormatter()));
if(!fmt->isError())
{
newAppender->setFormatter(fmt);
} else
{
std::cout << "log.name=" << newLogDefine.getName() << " appender type=" << (int)appender.getType()
<< " formatter=" << appender.getFormatter() << " is invalid" << std::endl;
}
}
logger->addAppender(newAppender);
}
}
// 确保__log_init在程序执行前完成
static LogIniter __log_init;
} | [
"wangk9294@163.com"
] | wangk9294@163.com |
317ea77d4018bc2e6faedf4d389991d4d1794514 | cad604b38f9257c5410751bfebded37a73b02436 | /Kernel/Storage/AHCIPort.h | a8730272b3a44a68572b08a0ffac9e33873cd2fc | [
"BSD-2-Clause"
] | permissive | govi20/serenity | 5f4d7217afbe8b98313aed26ad663d1f56553250 | 67362b1f8501b19b451c71cc28b540da15171739 | refs/heads/master | 2023-06-26T21:14:06.461110 | 2021-07-09T02:57:34 | 2021-07-09T13:36:50 | 384,451,039 | 1 | 0 | BSD-2-Clause | 2021-07-09T13:49:20 | 2021-07-09T13:49:19 | null | UTF-8 | C++ | false | false | 4,252 | h | /*
* Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/OwnPtr.h>
#include <AK/RefPtr.h>
#include <Kernel/Devices/Device.h>
#include <Kernel/IO.h>
#include <Kernel/Interrupts/IRQHandler.h>
#include <Kernel/Lock.h>
#include <Kernel/PhysicalAddress.h>
#include <Kernel/Random.h>
#include <Kernel/Sections.h>
#include <Kernel/SpinLock.h>
#include <Kernel/Storage/AHCI.h>
#include <Kernel/Storage/AHCIPortHandler.h>
#include <Kernel/Storage/StorageDevice.h>
#include <Kernel/VM/AnonymousVMObject.h>
#include <Kernel/VM/PhysicalPage.h>
#include <Kernel/VM/ScatterGatherList.h>
#include <Kernel/WaitQueue.h>
namespace Kernel {
class AsyncBlockDeviceRequest;
class AHCIPortHandler;
class SATADiskDevice;
class AHCIPort : public RefCounted<AHCIPort> {
friend class AHCIPortHandler;
friend class SATADiskDevice;
public:
UNMAP_AFTER_INIT static NonnullRefPtr<AHCIPort> create(const AHCIPortHandler&, volatile AHCI::PortRegisters&, u32 port_index);
u32 port_index() const { return m_port_index; }
u32 representative_port_index() const { return port_index() + 1; }
bool is_operable() const;
bool is_hot_pluggable() const;
bool is_atapi_attached() const { return m_port_registers.sig == (u32)AHCI::DeviceSignature::ATAPI; };
RefPtr<StorageDevice> connected_device() const { return m_connected_device; }
bool reset();
UNMAP_AFTER_INIT bool initialize_without_reset();
void handle_interrupt();
private:
bool is_phy_enabled() const { return (m_port_registers.ssts & 0xf) == 3; }
bool initialize(ScopedSpinLock<SpinLock<u8>>&);
UNMAP_AFTER_INIT AHCIPort(const AHCIPortHandler&, volatile AHCI::PortRegisters&, u32 port_index);
ALWAYS_INLINE void clear_sata_error_register() const;
void eject();
const char* try_disambiguate_sata_status();
void try_disambiguate_sata_error();
bool initiate_sata_reset(ScopedSpinLock<SpinLock<u8>>&);
void rebase();
void recover_from_fatal_error();
bool shutdown();
ALWAYS_INLINE void spin_up() const;
ALWAYS_INLINE void power_on() const;
void start_request(AsyncBlockDeviceRequest&);
void complete_current_request(AsyncDeviceRequest::RequestResult);
bool access_device(AsyncBlockDeviceRequest::RequestType, u64 lba, u8 block_count);
size_t calculate_descriptors_count(size_t block_count) const;
[[nodiscard]] Optional<AsyncDeviceRequest::RequestResult> prepare_and_set_scatter_list(AsyncBlockDeviceRequest& request);
ALWAYS_INLINE bool is_interrupts_enabled() const;
bool spin_until_ready() const;
bool identify_device(ScopedSpinLock<SpinLock<u8>>&);
ALWAYS_INLINE void start_command_list_processing() const;
ALWAYS_INLINE void mark_command_header_ready_to_process(u8 command_header_index) const;
ALWAYS_INLINE void stop_command_list_processing() const;
ALWAYS_INLINE void start_fis_receiving() const;
ALWAYS_INLINE void stop_fis_receiving() const;
ALWAYS_INLINE void set_active_state() const;
ALWAYS_INLINE void set_sleep_state() const;
void set_interface_state(AHCI::DeviceDetectionInitialization);
Optional<u8> try_to_find_unused_command_header();
ALWAYS_INLINE bool is_interface_disabled() const { return (m_port_registers.ssts & 0xf) == 4; };
// Data members
EntropySource m_entropy_source;
RefPtr<AsyncBlockDeviceRequest> m_current_request;
SpinLock<u8> m_hard_lock;
Lock m_lock { "AHCIPort" };
mutable bool m_wait_for_completion { false };
bool m_wait_connect_for_completion { false };
NonnullRefPtrVector<PhysicalPage> m_dma_buffers;
NonnullRefPtrVector<PhysicalPage> m_command_table_pages;
RefPtr<PhysicalPage> m_command_list_page;
OwnPtr<Region> m_command_list_region;
RefPtr<PhysicalPage> m_fis_receive_page;
RefPtr<StorageDevice> m_connected_device;
u32 m_port_index;
volatile AHCI::PortRegisters& m_port_registers;
NonnullRefPtr<AHCIPortHandler> m_parent_handler;
AHCI::PortInterruptStatusBitField m_interrupt_status;
AHCI::PortInterruptEnableBitField m_interrupt_enable;
RefPtr<ScatterGatherList> m_current_scatter_list;
bool m_disabled_by_firmware { false };
};
}
| [
"kling@serenityos.org"
] | kling@serenityos.org |
a9e4924c6e7199c2fc1ee7c79035c7890ac2b30a | 65bd6a26bcdddaec12b7f4ddce5a1e800d078927 | /mgsv_fov/wrapper.cpp | 1509ae9e3b958045f48dac8c9274cb49c8d6bf23 | [] | no_license | AltimorTASDK/MGSV-TPP-FoV | 1f3cafebc0945ed28a3afedfed26535dd451aa7c | d96130226aeb23532dc4f6ce55659aac5e68e14a | refs/heads/master | 2021-01-21T12:21:31.320417 | 2017-09-27T19:37:23 | 2017-09-27T19:37:23 | 42,018,432 | 26 | 5 | null | 2018-07-28T12:08:58 | 2015-09-06T20:51:19 | C++ | UTF-8 | C++ | false | false | 8,978 | cpp | #include <Windows.h>
static class functions {
public:
FARPROC D3DKMTCloseAdapter;
FARPROC D3DKMTDestroyAllocation;
FARPROC D3DKMTDestroyContext;
FARPROC D3DKMTDestroyDevice;
FARPROC D3DKMTDestroySynchronizationObject;
FARPROC D3DKMTQueryAdapterInfo;
FARPROC D3DKMTSetDisplayPrivateDriverFormat;
FARPROC D3DKMTSignalSynchronizationObject;
FARPROC D3DKMTUnlock;
FARPROC D3DKMTWaitForSynchronizationObject;
FARPROC EnableFeatureLevelUpgrade;
FARPROC OpenAdapter10;
FARPROC OpenAdapter10_2;
FARPROC D3D11CoreCreateDevice;
FARPROC D3D11CoreCreateLayeredDevice;
FARPROC D3D11CoreGetLayeredDeviceSize;
FARPROC D3D11CoreRegisterLayers;
FARPROC D3D11CreateDevice;
FARPROC D3D11CreateDeviceAndSwapChain;
FARPROC D3DKMTCreateAllocation;
FARPROC D3DKMTCreateContext;
FARPROC D3DKMTCreateDevice;
FARPROC D3DKMTCreateSynchronizationObject;
FARPROC D3DKMTEscape;
FARPROC D3DKMTGetContextSchedulingPriority;
FARPROC D3DKMTGetDeviceState;
FARPROC D3DKMTGetDisplayModeList;
FARPROC D3DKMTGetMultisampleMethodList;
FARPROC D3DKMTGetRuntimeData;
FARPROC D3DKMTGetSharedPrimaryHandle;
FARPROC D3DKMTLock;
FARPROC D3DKMTOpenAdapterFromHdc;
FARPROC D3DKMTOpenResource;
FARPROC D3DKMTPresent;
FARPROC D3DKMTQueryAllocationResidency;
FARPROC D3DKMTQueryResourceInfo;
FARPROC D3DKMTRender;
FARPROC D3DKMTSetAllocationPriority;
FARPROC D3DKMTSetContextSchedulingPriority;
FARPROC D3DKMTSetDisplayMode;
FARPROC D3DKMTSetGammaRamp;
FARPROC D3DKMTSetVidPnSourceOwner;
FARPROC D3DKMTWaitForVerticalBlankEvent;
FARPROC D3DPerformance_BeginEvent;
FARPROC D3DPerformance_EndEvent;
FARPROC D3DPerformance_GetStatus;
FARPROC D3DPerformance_SetMarker;
functions()
{
char path[MAX_PATH];
GetWindowsDirectory(path, MAX_PATH);
strcat_s(path, "\\system32\\d3d11.dll");
const auto module = LoadLibrary(path);
D3DKMTCloseAdapter = GetProcAddress(module, "D3DKMTCloseAdapter");
D3DKMTDestroyAllocation = GetProcAddress(module, "D3DKMTDestroyAllocation");
D3DKMTDestroyContext = GetProcAddress(module, "D3DKMTDestroyContext");
D3DKMTDestroyDevice = GetProcAddress(module, "D3DKMTDestroyDevice");
D3DKMTDestroySynchronizationObject = GetProcAddress(module, "D3DKMTDestroySynchronizationObject");
D3DKMTQueryAdapterInfo = GetProcAddress(module, "D3DKMTQueryAdapterInfo");
D3DKMTSetDisplayPrivateDriverFormat = GetProcAddress(module, "D3DKMTSetDisplayPrivateDriverFormat");
D3DKMTSignalSynchronizationObject = GetProcAddress(module, "D3DKMTSignalSynchronizationObject");
D3DKMTUnlock = GetProcAddress(module, "D3DKMTUnlock");
D3DKMTWaitForSynchronizationObject = GetProcAddress(module, "D3DKMTWaitForSynchronizationObject");
EnableFeatureLevelUpgrade = GetProcAddress(module, "EnableFeatureLevelUpgrade");
OpenAdapter10 = GetProcAddress(module, "OpenAdapter10");
OpenAdapter10_2 = GetProcAddress(module, "OpenAdapter10_2");
D3D11CoreCreateDevice = GetProcAddress(module, "D3D11CoreCreateDevice");
D3D11CoreCreateLayeredDevice = GetProcAddress(module, "D3D11CoreCreateLayeredDevice");
D3D11CoreGetLayeredDeviceSize = GetProcAddress(module, "D3D11CoreGetLayeredDeviceSize");
D3D11CoreRegisterLayers = GetProcAddress(module, "D3D11CoreRegisterLayers");
D3D11CreateDevice = GetProcAddress(module, "D3D11CreateDevice");
D3D11CreateDeviceAndSwapChain = GetProcAddress(module, "D3D11CreateDeviceAndSwapChain");
D3DKMTCreateAllocation = GetProcAddress(module, "D3DKMTCreateAllocation");
D3DKMTCreateContext = GetProcAddress(module, "D3DKMTCreateContext");
D3DKMTCreateDevice = GetProcAddress(module, "D3DKMTCreateDevice");
D3DKMTCreateSynchronizationObject = GetProcAddress(module, "D3DKMTCreateSynchronizationObject");
D3DKMTEscape = GetProcAddress(module, "D3DKMTEscape");
D3DKMTGetContextSchedulingPriority = GetProcAddress(module, "D3DKMTGetContextSchedulingPriority");
D3DKMTGetDeviceState = GetProcAddress(module, "D3DKMTGetDeviceState");
D3DKMTGetDisplayModeList = GetProcAddress(module, "D3DKMTGetDisplayModeList");
D3DKMTGetMultisampleMethodList = GetProcAddress(module, "D3DKMTGetMultisampleMethodList");
D3DKMTGetRuntimeData = GetProcAddress(module, "D3DKMTGetRuntimeData");
D3DKMTGetSharedPrimaryHandle = GetProcAddress(module, "D3DKMTGetSharedPrimaryHandle");
D3DKMTLock = GetProcAddress(module, "D3DKMTLock");
D3DKMTOpenAdapterFromHdc = GetProcAddress(module, "D3DKMTOpenAdapterFromHdc");
D3DKMTOpenResource = GetProcAddress(module, "D3DKMTOpenResource");
D3DKMTPresent = GetProcAddress(module, "D3DKMTPresent");
D3DKMTQueryAllocationResidency = GetProcAddress(module, "D3DKMTQueryAllocationResidency");
D3DKMTQueryResourceInfo = GetProcAddress(module, "D3DKMTQueryResourceInfo");
D3DKMTRender = GetProcAddress(module, "D3DKMTRender");
D3DKMTSetAllocationPriority = GetProcAddress(module, "D3DKMTSetAllocationPriority");
D3DKMTSetContextSchedulingPriority = GetProcAddress(module, "D3DKMTSetContextSchedulingPriority");
D3DKMTSetDisplayMode = GetProcAddress(module, "D3DKMTSetDisplayMode");
D3DKMTSetGammaRamp = GetProcAddress(module, "D3DKMTSetGammaRamp");
D3DKMTSetVidPnSourceOwner = GetProcAddress(module, "D3DKMTSetVidPnSourceOwner");
D3DKMTWaitForVerticalBlankEvent = GetProcAddress(module, "D3DKMTWaitForVerticalBlankEvent");
D3DPerformance_BeginEvent = GetProcAddress(module, "D3DPerformance_BeginEvent");
D3DPerformance_EndEvent = GetProcAddress(module, "D3DPerformance_EndEvent");
D3DPerformance_GetStatus = GetProcAddress(module, "D3DPerformance_GetStatus");
D3DPerformance_SetMarker = GetProcAddress(module, "D3DPerformance_SetMarker");
}
} functions;
void D3DKMTCloseAdapter() { functions.D3DKMTCloseAdapter(); }
void D3DKMTDestroyAllocation() { functions.D3DKMTDestroyAllocation(); }
void D3DKMTDestroyContext() { functions.D3DKMTDestroyContext(); }
void D3DKMTDestroyDevice() { functions.D3DKMTDestroyDevice(); }
void D3DKMTDestroySynchronizationObject() { functions.D3DKMTDestroySynchronizationObject(); }
void D3DKMTQueryAdapterInfo() { functions.D3DKMTQueryAdapterInfo(); }
void D3DKMTSetDisplayPrivateDriverFormat() { functions.D3DKMTSetDisplayPrivateDriverFormat(); }
void D3DKMTSignalSynchronizationObject() { functions.D3DKMTSignalSynchronizationObject(); }
void D3DKMTUnlock() { functions.D3DKMTUnlock(); }
void D3DKMTWaitForSynchronizationObject() { functions.D3DKMTWaitForSynchronizationObject(); }
void EnableFeatureLevelUpgrade() { functions.EnableFeatureLevelUpgrade(); }
void OpenAdapter10() { functions.OpenAdapter10(); }
void OpenAdapter10_2() { functions.OpenAdapter10_2(); }
void D3D11CoreCreateDevice() { functions.D3D11CoreCreateDevice(); }
void D3D11CoreCreateLayeredDevice() { functions.D3D11CoreCreateLayeredDevice(); }
void D3D11CoreGetLayeredDeviceSize() { functions.D3D11CoreGetLayeredDeviceSize(); }
void D3D11CoreRegisterLayers() { functions.D3D11CoreRegisterLayers(); }
void D3D11CreateDevice() { functions.D3D11CreateDevice(); }
void D3D11CreateDeviceAndSwapChain() { functions.D3D11CreateDeviceAndSwapChain(); }
void D3DKMTCreateAllocation() { functions.D3DKMTCreateAllocation(); }
void D3DKMTCreateContext() { functions.D3DKMTCreateContext(); }
void D3DKMTCreateDevice() { functions.D3DKMTCreateDevice(); }
void D3DKMTCreateSynchronizationObject() { functions.D3DKMTCreateSynchronizationObject(); }
void D3DKMTEscape() { functions.D3DKMTEscape(); }
void D3DKMTGetContextSchedulingPriority() { functions.D3DKMTGetContextSchedulingPriority(); }
void D3DKMTGetDeviceState() { functions.D3DKMTGetDeviceState(); }
void D3DKMTGetDisplayModeList() { functions.D3DKMTGetDisplayModeList(); }
void D3DKMTGetMultisampleMethodList() { functions.D3DKMTGetMultisampleMethodList(); }
void D3DKMTGetRuntimeData() { functions.D3DKMTGetRuntimeData(); }
void D3DKMTGetSharedPrimaryHandle() { functions.D3DKMTGetSharedPrimaryHandle(); }
void D3DKMTLock() { functions.D3DKMTLock(); }
void D3DKMTOpenAdapterFromHdc() { functions.D3DKMTOpenAdapterFromHdc(); }
void D3DKMTOpenResource() { functions.D3DKMTOpenResource(); }
void D3DKMTPresent() { functions.D3DKMTPresent(); }
void D3DKMTQueryAllocationResidency() { functions.D3DKMTQueryAllocationResidency(); }
void D3DKMTQueryResourceInfo() { functions.D3DKMTQueryResourceInfo(); }
void D3DKMTRender() { functions.D3DKMTRender(); }
void D3DKMTSetAllocationPriority() { functions.D3DKMTSetAllocationPriority(); }
void D3DKMTSetContextSchedulingPriority() { functions.D3DKMTSetContextSchedulingPriority(); }
void D3DKMTSetDisplayMode() { functions.D3DKMTSetDisplayMode(); }
void D3DKMTSetGammaRamp() { functions.D3DKMTSetGammaRamp(); }
void D3DKMTSetVidPnSourceOwner() { functions.D3DKMTSetVidPnSourceOwner(); }
void D3DKMTWaitForVerticalBlankEvent() { functions.D3DKMTWaitForVerticalBlankEvent(); }
void D3DPerformance_BeginEvent() { functions.D3DPerformance_BeginEvent(); }
void D3DPerformance_EndEvent() { functions.D3DPerformance_EndEvent(); }
void D3DPerformance_GetStatus() { functions.D3DPerformance_GetStatus(); }
void D3DPerformance_SetMarker() { functions.D3DPerformance_SetMarker(); } | [
"altimormc@gmail.com"
] | altimormc@gmail.com |
28e79b0a04b88f09669adc6b72c9e26eff944d15 | 0ce5a9be7357cd649cbfc2814ea3f558f227e064 | /client/GroupGame/GroupGame/Classes/net/NetManager.cpp | 198e88ddbc42f09b6789e4fdbd9b474217155a7b | [] | no_license | mjssw/myproj | 1beb06c2b8e490a11decfa5213e122b54d09beec | 4051ae1ed6062caa8acb24959416a5c4cfb4dea0 | refs/heads/master | 2021-01-17T06:23:53.492422 | 2014-10-27T09:19:03 | 2014-10-27T09:19:03 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,545 | cpp | #include "cocos2d.h"
#include "NetManager.h"
#include "gamemsg/MsgBase.h"
#include "tolua++.h"
#include "CCLuaEngine.h"
using namespace cocos2d;
using namespace SGLib;
using namespace std;
SIGNLETON_CLASS_INIT(CNetManager);
bool CNetManager::Init()
{
m_loginClient = NULL;
m_groupClient = NULL;
m_gameClient = NULL;
m_registerClient = NULL;
m_loginConn = NULL;
m_groupConn = NULL;
m_gameConn = NULL;
m_regConn = NULL;
m_isPauseProcessMessage = false;
CCDirector::sharedDirector()->getScheduler()->scheduleUpdateForTarget( this, 0, false );
return true;
}
void CNetManager::update(float delta)
{
ProcessMessage();
}
void CNetManager::Fini()
{
CCDirector::sharedDirector()->getScheduler()->unscheduleUpdateForTarget( this );
_CloseAll();
}
bool CNetManager::StartLogin(const char *ip, int port)
{
_CloseAll();
CCLog( "StartLogin %s:%d\n", ip, port );
m_loginConn = new SGLib::CClientManager<CLoginClient>( 1 );
if( !m_loginConn )
{
CCLog( "[ERROR] StartLogin %s:%d\n", ip, port );
return false;
}
return m_loginConn->Start( ip, port );
}
bool CNetManager::StartGroup(const char *ip, int port)
{
m_groupConn = new SGLib::CClientManager<CGroupClient>( 1 );
if( !m_groupConn )
{
return false;
}
return m_groupConn->Start( ip, port );
}
bool CNetManager::StartGame(const char *ip, int port)
{
CloseGameConn();
m_gameConn = new SGLib::CClientManager<CGameClient>( 1 );
if( !m_gameConn )
{
return false;
}
return m_gameConn->Start( ip, port );
}
bool CNetManager::StartRegister(const char *ip, int port)
{
CloseRegisterConn();
m_regConn = new SGLib::CClientManager<CRegisterClient>( 1 );
if( !m_regConn )
{
return false;
}
return m_regConn->Start( ip, port );
}
void CNetManager::CloseGameConn()
{
if( m_gameConn )
{
m_gameClient = NULL;
m_gameConn->Stop();
SAFE_DELETE( m_gameConn );
}
}
void CNetManager::CloseLoginConn()
{
if( m_loginConn )
{
m_loginClient = NULL;
m_loginConn->Stop();
SAFE_DELETE( m_loginConn );
}
}
void CNetManager::CloseRegisterConn()
{
if( m_regConn )
{
m_registerClient = NULL;
m_regConn->Stop();
SAFE_DELETE( m_regConn );
}
}
void CNetManager::PushMessage(CMsgBase *msg)
{
if( msg )
{
CGuardLock<CLock> g( m_msgLock );
m_msgQueue.push_back( msg );
}
}
void CNetManager::ProcessMessage()
{
while( !m_isPauseProcessMessage )
{
CMsgBase *msg = NULL;
{
CGuardLock<CLock> g( m_msgLock );
if( !m_msgQueue.empty() )
{
msg = m_msgQueue.front();
m_msgQueue.pop_front();
}
}
if( msg )
{
msg->Process();
SAFE_DELETE( msg );
}
else
{
break;
}
}
}
void CNetManager::PauseProcessMessage()
{
m_isPauseProcessMessage = true;
}
void CNetManager::ResumeProcessMessage()
{
m_isPauseProcessMessage = false;
}
void CNetManager::SetLoginClientInstance(CLoginClient *client)
{
m_loginClient = client;
}
CLoginClient* CNetManager::GetLoginClientInstance()
{
return m_loginClient;
}
void CNetManager::SetGroupClientInstance(CGroupClient *client)
{
m_groupClient = client;
}
CGroupClient* CNetManager::GetGroupClientInstance()
{
return m_groupClient;
}
void CNetManager::SetGameClientInstance(CGameClient *client)
{
m_gameClient = client;
}
CGameClient* CNetManager::GetGameClientInstance()
{
return m_gameClient;
}
void CNetManager::SetRegClientInstance(CRegisterClient *client)
{
m_registerClient = client;
}
CRegisterClient* CNetManager::GetRegClientInstance()
{
return m_registerClient;
}
int CNetManager::SendGameMessage(lua_State *ls)
{
void **data = (void**)lua_touserdata( ls, 1 );
google::protobuf::Message *msg = ((google::protobuf::Message*)(*data));
int ret = 1;
if( !msg )
{
ret = 0;
}
else
{
int msgid = (int)lua_tonumber( ls, 2 );
Instance().GetGameClientInstance()->SendMsg( *msg, msgid );
}
lua_pushinteger( ls, ret );
delete msg;
return 1;
}
void CNetManager::LuaProcessGameMessage(int msgid, int msglen, void *data)
{
const char *strFuncName = "ProcessGameMessage";
lua_State *ls = LuaEngine::getInstance()->getLuaStack()->getLuaState();
lua_getglobal( ls, strFuncName );
lua_pushnumber( ls, msgid );
lua_pushnumber( ls, msglen );
*(void**)lua_newuserdata(ls, sizeof(void*)) = data;
lua_pcall( ls, 3, 0, 0 );
}
void CNetManager::_CloseAll()
{
m_loginClient = NULL;
m_groupClient = NULL;
m_gameClient = NULL;
#define _CLOSE_CONN(conn) \
if( conn )\
{\
conn->Stop();\
SAFE_DELETE( conn );\
}
_CLOSE_CONN( m_loginConn );
_CLOSE_CONN( m_groupConn );
_CLOSE_CONN( m_gameConn );
#undef _CLOSE_CONN
}
| [
"shenjiajia1225@163.com"
] | shenjiajia1225@163.com |
d4ad3c698c13042741baee2979f5357dba8359ef | 198b6400cc518504f1bb35252b3b9f180f12e697 | /test.cpp | a210a81ec9b17af344118f724398fd1f5ea3c597 | [
"BSD-3-Clause"
] | permissive | mikeaustin/impulse-language | 444e2638b8995640cdbd9f898b688cefaaf8c0b2 | bedf659c063ed492b3d4cc5ed61c2a34d92f20c4 | refs/heads/master | 2016-09-10T09:01:41.490051 | 2012-02-27T03:14:34 | 2012-02-27T03:14:34 | 1,272,659 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 345 | cpp | #include <iostream>
#include <limits>
#include <cmath>
using namespace std;
int main()
{
cout << numeric_limits<double>::has_quiet_NaN << endl;
cout << numeric_limits<double>::has_signaling_NaN << endl;
double d = numeric_limits<double>::signaling_NaN();
cout << d << endl;
cout << isnan(d) << endl;
cout << 0/0 << endl;
return 0;
}
| [
"mike@mike-austin.com"
] | mike@mike-austin.com |
faa285c85ea56d3afaa2760d88d467dda0a99fcf | f05bde6d5bdee3e9a07e34af1ce18259919dd9bd | /lang_service/java/com/intel/daal/algorithms/linear_regression/train_batch.cpp | 6b93d89c434d07815ad7684d146c943e38a562ee | [
"Intel",
"Apache-2.0"
] | permissive | HFTrader/daal | f827c83b75cf5884ecfb6249a664ce6f091bfc57 | b18624d2202a29548008711ec2abc93d017bd605 | refs/heads/daal_2017_beta | 2020-12-28T19:08:39.038346 | 2016-04-15T17:02:24 | 2016-04-15T17:02:24 | 56,404,044 | 0 | 1 | null | 2016-04-16T20:26:14 | 2016-04-16T20:26:14 | null | UTF-8 | C++ | false | false | 3,379 | cpp | /* file: train_batch.cpp */
/*******************************************************************************
* Copyright 2014-2016 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
#include <jni.h>
#include "linear_regression/training/JTrainingBatch.h"
#include "linear_regression/training/JTrainingMethod.h"
#include "common_helpers.h"
#define normEqDense com_intel_daal_algorithms_linear_regression_training_TrainingMethod_normEqDenseValue
#define qrDense com_intel_daal_algorithms_linear_regression_training_TrainingMethod_qrDenseValue
USING_COMMON_NAMESPACES();
using namespace daal::algorithms::linear_regression::training;
/*
* Class: com_intel_daal_algorithms_linear_regression_training_BatchTraining
* Method: cInit
* Signature:(II)J
*/
JNIEXPORT jlong JNICALL Java_com_intel_daal_algorithms_linear_1regression_training_TrainingBatch_cInit
(JNIEnv *env, jobject thisObj, jint prec, jint method)
{
return jniBatch<linear_regression::training::Method, Batch, normEqDense, qrDense>::newObj(prec, method);
}
/*
* Class: com_intel_daal_algorithms_linear_regression_training_BatchTraining
* Method: cInitParameter
* Signature:(JII)J
*/
JNIEXPORT jlong JNICALL Java_com_intel_daal_algorithms_linear_1regression_training_TrainingBatch_cInitParameter
(JNIEnv *env, jobject thisObj, jlong algAddr, jint prec, jint method)
{
return jniBatch<linear_regression::training::Method, Batch, normEqDense, qrDense>::getParameter(prec, method, algAddr);
}
/*
* Class: com_intel_daal_algorithms_linear_regression_training_BatchTraining
* Method: cGetInput
* Signature:(JII)J
*/
JNIEXPORT jlong JNICALL Java_com_intel_daal_algorithms_linear_1regression_training_TrainingBatch_cGetInput
(JNIEnv *env, jobject thisObj, jlong algAddr, jint prec, jint method)
{
return jniBatch<linear_regression::training::Method, Batch, normEqDense, qrDense>::getInput(prec, method, algAddr);
}
/*
* Class: com_intel_daal_algorithms_linear_regression_training_BatchTraining
* Method: cGetResult
* Signature:(JII)J
*/
JNIEXPORT jlong JNICALL Java_com_intel_daal_algorithms_linear_1regression_training_TrainingBatch_cGetResult
(JNIEnv *env, jobject thisObj, jlong algAddr, jint prec, jint method)
{
return jniBatch<linear_regression::training::Method, Batch, normEqDense, qrDense>::getResult(prec, method, algAddr);
}
/*
* Class: com_intel_daal_algorithms_linear_regression_training_BatchTraining
* Method: cClone
* Signature:(JII)J
*/
JNIEXPORT jlong JNICALL Java_com_intel_daal_algorithms_linear_1regression_training_TrainingBatch_cClone
(JNIEnv *env, jobject thisObj, jlong algAddr, jint prec, jint method)
{
return jniBatch<linear_regression::training::Method, Batch, normEqDense, qrDense>::getClone(prec, method, algAddr);
}
| [
"vasily.rubtsov@intel.com"
] | vasily.rubtsov@intel.com |
a34f0f879972dc2e9d6d3b360540293e8397299a | fdf6b097f635a861e89323f1d7c9a40ecf788a88 | /src/chips/logic/actors.cpp | 9c1664ef41a9615ea5375dbbe32e801eb218f768 | [] | no_license | EricWF/chips | db1057670b5297988ea7323fac35cd5919a0b8d8 | 3e5dadb7055ae69baa28e6df95920394439dafce | refs/heads/master | 2020-06-01T19:45:02.790868 | 2014-06-17T06:13:13 | 2014-06-17T06:13:13 | 16,317,898 | 10 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,445 | cpp | #include "chips/logic.hpp"
#include "chips/core.hpp"
#include "chips/entity.hpp"
#include "chips/sounds.hpp"
#include <elib/aux.hpp>
namespace chips { namespace logic
{
namespace
{
void kill_chip_on_col(entity &, entity & other, level &)
{
if (is_chip(other)) other.kill();
}
////////////////////////////////////////////////////////////////////////
//
void init_block(entity & e, level &)
{
auto block_on_collide =
[](entity & self, entity & other, level & lev)
{
if (!is_chip(other) || self.has<move_lock>())
return;
self(move_, other.get<direction>(), lev);
self.remove<direction>();
};
e << method(move_, common::move_)
<< method(on_collision_, block_on_collide)
<< method(collides_, common::always_collides_);
}
////////////////////////////////////////////////////////////////////////
//
void init_bug(entity & e, level &)
{
auto bug_update_ =
[](entity & self, level & lv)
{
ELIB_ASSERT(self);
if (self.has<move_lock>())
return;
position p; direction d;
self >> p >> d;
auto & el = lv.entity_list;
bool front = ColFront(self).contains(el);
bool back = ColBack(self).contains(el);
bool left = ColLeft(self).contains(el);
bool right = ColRight(self).contains(el);
if (!left) self(move_, turn_left(d), lv);
else if (!front) self(move_, d, lv);
else if (!right) self(move_, turn_right(d), lv);
else if (!back) self(move_, turn_around(d), lv);
};
e.on_death([](entity &) { bug_die_sound(); });
e << method(update_, bug_update_)
<< regular_speed;
}
////////////////////////////////////////////////////////////////////////
void init_tank(entity & e, level &)
{
auto tank_update =
[](entity & self, level & l)
{
if (self.has<move_lock>()) return;
self(move_, self.get<direction>(), l);
};
e.on_death([](entity &) { generic_die_sound(); });
e << method(update_, tank_update)
<< regular_speed;
}
////////////////////////////////////////////////////////////////////////
void init_fireball(entity & e, level &)
{
auto fireball_update =
[](entity & self, level & l)
{
ELIB_ASSERT(self);
REQUIRE_CONCEPT(self, EntityHas<position, direction>);
if (self.has<move_lock>())
return;
position p; direction d;
self >> p >> d;
auto & el = l.entity_list;
bool front = ColFront(self).contains(el);
bool back = ColBack(self).contains(el);
bool left = ColLeft(self).contains(el);
bool right = ColRight(self).contains(el);
if (!front)
self(move_, d, l);
else if (!right)
self(move_, turn_right(d), l);
else if (!left)
self(move_, turn_left(d), l);
else if (!back)
self(move_, turn_around(d), l);
};
e.on_death([](entity &) { generic_die_sound(); });
e << method(update_, fireball_update)
<< regular_speed;
}
////////////////////////////////////////////////////////////////////////
void init_pink_ball(entity & e, level &)
{
auto update =
[](entity & self, level & l)
{
bool front = ColFront(self).contains(l.entity_list);
bool back = ColBack(self).contains(l.entity_list);
if (!front)
self(move_, self.get<direction>(), l);
else if (!back)
self(move_, turn_around(self.get<direction>()), l);
};
e.on_death([](entity &) { generic_die_sound(); });
e << method(update_, update)
<< regular_speed;
}
////////////////////////////////////////////////////////////////////////
void init_teeth(entity & e, level &)
{
auto teeth_update =
[](entity & self, level & l)
{
if (self.has<move_lock>()) return;
position cp, p;
l.chip >> cp; self >> p;
direction hdir, vdir;
hdir = cp.x < p.x ? direction::W : direction::E;
vdir = cp.y < p.y ? direction::N : direction::S;
unsigned hmov = cp.x < p.x ? p.x - cp.x : cp.x - p.x;
unsigned vmov = cp.y < p.y ? p.y - cp.y : cp.y - p.y;
if (hmov == 0 && vmov == 0) return;
if (vmov >= hmov)
{
self(move_, vdir, l);
if (self.get<position>() != p)
return;
}
// virtical move wasnt taken
if (hmov != 0)
self(move_, hdir, l);
};
e.on_death([](entity &) { teeth_die_sound(); });
e << method(update_, teeth_update)
<< half_speed;
}
////////////////////////////////////////////////////////////////////////
void init_glider(entity & e, level &)
{
auto glider_update =
[](entity & self, level & l)
{
ELIB_ASSERT(self);
if (self.has<move_lock>())
return;
position p; direction d;
self >> p >> d;
auto & el = l.entity_list;
bool front = ColFront(self).contains(el);
bool back = ColBack(self).contains(el);
bool left = ColLeft(self).contains(el);
bool right = ColRight(self).contains(el);
if (!front)
self(move_, d, l);
else if (!left)
self(move_, turn_left(d), l);
else if (!right)
self(move_, turn_right(d), l);
else if (!back)
self(move_, turn_around(d), l);
};
e.on_death([](entity &) { generic_die_sound(); });
e << method(update_, glider_update)
<< full_speed;
}
void init_germ(entity & e, level &)
{
auto germ_update =
[](entity & self, level & lv)
{
if (self.has<move_lock>())
return;
position p; direction d;
self >> p >> d;
auto & el = lv.entity_list;
bool front = ColFront(self).contains(el);
bool behind = ColBack(self).contains(el);
bool left = ColLeft(self).contains(el);
bool right = ColRight(self).contains(el);
if (!right) self(move_, turn_right(d), lv);
else if (!front) self(move_, d, lv);
else if (!left) self(move_, turn_left(d), lv);
else if (!behind) self(move_, turn_around(d), lv);
};
e.on_death([](entity &) { generic_die_sound(); });
e << method(update_, germ_update)
<< regular_speed;
}
#if defined(__GNUC__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wswitch-enum"
#endif
void init_monster(entity & e, level & l)
{
ELIB_ASSERT(is_monster(e));
e.remove<tile_id>();
e << method(move_, common::move_)
<< method(collides_, common::always_collides_)
<< method(on_collision_, kill_chip_on_col);
switch (e.id())
{
case entity_id::bug:
init_bug(e, l);
break;
case entity_id::fireball:
init_fireball(e, l);
break;
case entity_id::pink_ball:
init_pink_ball(e, l);
break;
case entity_id::tank:
init_tank(e, l);
break;
case entity_id::glider:
init_glider(e, l);
break;
case entity_id::teeth:
init_teeth(e, l);
break;
case entity_id::walker:
// TODO
break;
case entity_id::blob:
// TODO
break;
case entity_id::germ:
init_germ(e, l);
break;
default:
ELIB_ASSERT(false && "In default case");
}
}
#if defined(__GNUC__)
# pragma GCC diagnostic pop
#endif
} // namespace
void init_actor(entity & e, level & l)
{
if (is_monster(e))
init_monster(e, l);
else if (e.id() == entity_id::block)
init_block(e, l);
else
log::warn("In default case for init_actor");
}
void process_actor(entity &, level &)
{
}
void finalize_actor(entity &, level &)
{
}
}} // namespace chips | [
"eric@efcs.ca"
] | eric@efcs.ca |
cb074b971202b35fe8a6ed72fb8452e3c5a40961 | f977d19124b0ffdab29a6d97c5acfee33bc3f558 | /Chapter-2/1.cpp | 83e2c4c83086a9e053c0c4065f76ca32d00e8fe0 | [] | no_license | phoenixx1/Robert-Lafore | 022fe2746327fea5aecaff7479a4ac2e0317a9d2 | 2fa323b017ca3cc5173ae35c35b8bf383813531c | refs/heads/master | 2021-08-17T10:30:29.938186 | 2021-04-25T21:02:16 | 2021-04-25T21:02:16 | 224,205,356 | 45 | 20 | null | 2023-09-02T15:14:10 | 2019-11-26T14:00:16 | C++ | UTF-8 | C++ | false | false | 373 | cpp | /*Assuming there are 7.481 gallons in a cubic foot, write a program that asks the user to
enter a number of gallons, and then displays the equivalent in cubic feet.*/
#include<iostream>
using namespace std;
int main(){
float vGallons;
cout << "Enter the value in gallons: ";
cin >> vGallons;
cout << "Value in cubic feet: " << (vGallons/7.481) << endl;
return 0;
}
| [
"noreply@github.com"
] | noreply@github.com |
3cbb65f211b0f79fc96687779ead1c652ca790c4 | 4c66702128339f62b1935c6e631a0e5f05cb5958 | /MACHINE/machine.cpp | af91bb01b525e5c14b2e3224193376173ae534e7 | [] | no_license | Thang-ND/applied-algorithms | eb58527fb146f20a3aa2d928eec531844d3251e2 | dac20530d8a01fb727c5c85982436ce3d1cdf6f8 | refs/heads/main | 2023-07-15T15:03:25.223382 | 2021-08-12T13:56:58 | 2021-08-12T13:56:58 | 395,335,797 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 673 | cpp | #include <bits/stdc++.h>
using namespace std;
const int N = (int) 3e6;
const int INF = (int) 3e6;
int L[N+1], R[N+1];
int n;
int ans = -1;
void input() {
for (int i=1; i<=N; i++) L[i] = R[i] = -INF;
cin >> n;
int a, b;
for (int i=1; i<=n; i++) {
scanf("%d %d", &a, &b);
L[b] = max(L[b], b-a);
R[a] = max(R[a], b-a);
}
}
void solve() {
for (int i=1; i<=N; i++) L[i] = max(L[i-1], L[i]);
for (int i=N; i>=1; i--) R[i] = max(R[i+1], R[i]);
ans = -INF;
for (int i=1; i<=N-1; i++) {
ans = max(ans, L[i] + R[i+1]);
}
if (ans == -INF) ans = -1;
cout << ans;
}
main() {
input();
solve();
}
| [
"winner310800@gmail.com"
] | winner310800@gmail.com |
f8a0bb1c8ebcf47aed8ffb6a2c4e69b3e80723a2 | abdd0dcf68914e1547ac23b14fd1d7847dc9ce83 | /fileSys/src/.history/node_20200428200623.cpp | 1f7c51d8c0165c3f1ad4f8831d491b9f78ed90a0 | [] | no_license | SnowflyLXF/Distributed-Systems-UMN | d290e2fdd2f07309fc62dffbe377443be6c34f3f | bd834f8cb2100836a67143ccdaeb79495cb74e18 | refs/heads/master | 2023-08-01T09:29:56.350535 | 2021-09-26T04:05:17 | 2021-09-26T04:05:17 | 410,444,689 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,758 | cpp | #include "node.hpp"
using namespace std;
uint32_t checksum(std::ifstream& file)
{
uint32_t sum = 0;
uint32_t word = 0;
while (file.read(reinterpret_cast<char*>(&word), sizeof(word))) {
sum += word;
}
if (file.gcount()) {
word &= (~0U >> ((sizeof(uint32_t) - file.gcount()) * 8));
sum += word;
}
return sum;
}
Node ::Node(int Port, int OnPort)
{
num_up = 0;
load = 0;
_port = Port;
_onListenPort = OnPort;
_slen = sizeof(_node_addr);
max_port = OnPort+1;
dirname = "node" + to_string(_port);
memset((char *)&_node_addr, 0, sizeof(_node_addr));
_node_addr.sin_family = AF_INET;
_node_addr.sin_addr.s_addr = htonl(INADDR_ANY);
_node_addr.sin_port = htons(_port);
_node_socket_fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (::bind(_node_socket_fd, (struct sockaddr *)&_node_addr, sizeof(_node_addr)) == -1)
{
cout << "Bind failed!" << endl;
}
thread onLis(&Node::onListen, this);
onLis.detach();
}
string Node::listen2()
{
char _buf2[BUFLEN];
memset(_buf2, ' ', BUFLEN);
int recvLen = recvfrom(_onlisten_fd, _buf2, BUFLEN, 0, (struct sockaddr *)&_tmp_addr, reinterpret_cast<socklen_t *>(&_slen));
char msg[recvLen + 1];
// cout<<_buf<<endl;
strncpy(msg, _buf2, recvLen);
// string s(msg);
msg[recvLen] = '\0';
string s(msg);
// cout << s << endl;
return s;
}
void Node::onListen()
{
memset((char *)&_onlisten_addr, 0, sizeof(_onlisten_addr));
memset((char *)&_tmp_addr, 0, sizeof(_tmp_addr));
_onlisten_addr.sin_family = AF_INET;
_onlisten_addr.sin_addr.s_addr = htonl(INADDR_ANY);
_onlisten_addr.sin_port = htons(_onListenPort);
_onlisten_fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (::bind(_onlisten_fd, (struct sockaddr *)&_onlisten_addr, sizeof(_onlisten_addr)) == -1)
{
cout << "Bind failed!" << endl;
}
string m;
while(1)
{
m = listen2();
if(strcmp(m.c_str(), "GetLoad")==0)
{
char msg[BUFLEN] = {0};
int len = sizeof(to_string(load).c_str());
snprintf(msg, len, to_string(load).c_str());
sendto(_onlisten_fd, msg, len, 0, (struct sockaddr *)&_tmp_addr, _slen);
}
else if (strcmp(m.c_str(), "Download")==0)
{
string dIP = listen2();
int dport = stoi(listen2());
string file = listen2();
// cout << dIP << ":" << dport << ", "<< file << endl;
handleUpload(dIP, dport, file);
}
}
}
int Node::Connect()
{
char msg[BUFLEN] = {0};
int len = sizeof("Connect");
snprintf(msg, len, "Connect");
int n = sendall(msg, &len);
return n;
}
int Node::SetServer(string serverIP, int serverPort)
{
memset((char *)&_server_addr, 0, sizeof(_server_addr));
_server_addr.sin_family = AF_INET;
_server_addr.sin_addr.s_addr = inet_addr(serverIP.c_str());
_server_addr.sin_port = htons(serverPort);
}
string Node::listen()
{
memset(_buf, ' ', BUFLEN);
int recvLen = recvfrom(_node_socket_fd, _buf, BUFLEN, 0, (struct sockaddr *)&_server_addr, reinterpret_cast<socklen_t *>(&_slen));
char msg[recvLen + 1];
// cout<<_buf<<endl;
strncpy(msg, _buf, recvLen);
// string s(msg);
msg[recvLen] = '\0';
string s(msg);
return s;
}
int Node ::sendall(char *msg, int *len)
{
// cout<<msg.c_str()<<endl;
int bytesLeft = *len;
int sentLen = 0;
int n;
while (sentLen < *len)
{
n = sendto(_node_socket_fd, msg + sentLen, bytesLeft, 0, (struct sockaddr *)&_server_addr, _slen);
if (n == -1)
{
break;
}
sentLen += n;
bytesLeft -= n;
}
*len = sentLen;
return n == -1 ? -1 : 0;
}
Node::names Node::getFileList()
{
names files;
DIR *dir;
struct dirent *ptr;
if ((dir = opendir(dirname.c_str())) == NULL)
{
perror("Open dir error...");
exit(1);
}
while ((ptr = readdir(dir)) != NULL)
{
if (strcmp(ptr->d_name, ".") == 0 || strcmp(ptr->d_name, "..") == 0) ///current dir OR parrent dir
continue;
else if (ptr->d_type == 8)
files.push_back(ptr->d_name);
}
closedir(dir);
return files;
}
int Node::FileList()
{
char msg[BUFLEN] = {0};
int len = sizeof("FileList");
snprintf(msg, len, "FileList");
int n = sendall(msg, &len);
len = sizeof(to_string(_onListenPort));
snprintf(msg, len, to_string(_onListenPort).c_str());
n = sendall(msg, &len);
names files = getFileList();
int fsize = files.size();
len = sizeof(to_string(fsize));
snprintf(msg, len, to_string(fsize).c_str());
n = sendall(msg, &len);
for(int i = 0;i<fsize;i++)
{
len = sizeof(files[i]);
snprintf(msg, len, files[i].c_str());
n = sendall(msg, &len);
}
}
int Node::Update()
{
char msg[BUFLEN] = {0};
int len = sizeof("Update");
snprintf(msg, len, "Update");
int n = sendall(msg, &len);
names files = getFileList();
int fsize = files.size();
len = sizeof(to_string(fsize));
snprintf(msg, len, to_string(fsize).c_str());
n = sendall(msg, &len);
for (int i = 0; i < fsize; i++)
{
len = sizeof(files[i]);
snprintf(msg, len, files[i].c_str());
n = sendall(msg, &len);
}
}
Node::names Node::Find(string filename)
{
names tmpnodes;
char msg[BUFLEN] = {0};
int len = sizeof("Find");
snprintf(msg, len, "Find");
int n = sendall(msg, &len);
len = sizeof(filename.c_str());
snprintf(msg, len+1, filename.c_str());
n = sendall(msg, &len);
string inmsg;
inmsg = listen();
int nodecount = stoi(inmsg);
for (int i = 0; i < nodecount; i++)
{
inmsg = listen();
tmpnodes.push_back(inmsg);
cout<<inmsg<<endl;
}
// GetLoad(tmpnodes[0]);
// GetLoad(tmpnodes[1]);
return tmpnodes;
}
int Node::GetLoad(string c)
{
char *p;
char *strs = new char[c.length() + 1];
strcpy(strs,c.c_str());
p = strtok(strs, ":");
string IP(p);
p = strtok(NULL, ":");
int p2 = atoi(p);
// cout<<p2<<endl;
struct sockaddr_in _c_addr;
memset((char *)&_c_addr, 0, sizeof(_c_addr));
_c_addr.sin_family = AF_INET;
_c_addr.sin_addr.s_addr = inet_addr(IP.c_str());
_c_addr.sin_port = htons(p2);
char msg[BUFLEN] = {0};
int len = sizeof("GetLoad");
snprintf(msg, len, "GetLoad");
sendto(_node_socket_fd, msg, len, 0, (struct sockaddr *)&_c_addr, _slen);
string m = listen();
cout<<m<<endl;
// len = sizeof("Download");
// snprintf(msg, len, "Download");
// sendto(_node_socket_fd, msg, len, 0, (struct sockaddr *)&_c_addr, _slen);
// len = sizeof("127.0.0.1");
// snprintf(msg, len, "127.0.0.1");
// sendto(_node_socket_fd, msg, len, 0, (struct sockaddr *)&_c_addr, _slen);
// len = sizeof("6001");
// snprintf(msg, len, "6001");
// sendto(_node_socket_fd, msg, len, 0, (struct sockaddr *)&_c_addr, _slen);
// len = sizeof("cnm.txt");
// snprintf(msg, len, "cnm.txt");
// sendto(_node_socket_fd, msg, len, 0, (struct sockaddr *)&_c_addr, _slen);
// m = listen();
// cout<<m<<endl;
// m = listen();
// cout << m << endl;
return stoi(m);
}
int Node::Download(string file)
{
Node::names upers = Find(file);
string uper = upers.front();
int minload = GetLoad(uper);
for(int i=1; i<upers.size(); i++){
int l = GetLoad(upers.at(i));
if(l < minload) {
uper = l;
minload = GetLoad(uper);
}
}
load++;
thread onDownload(&Node::handleDownload, this, uper, file);
onDownload.detach();
// cout<<m<<endl;
}
int Node::handleDownload(string uper, string file){
struct sockaddr_in down_node_addr, up_node_addr;
memset((char *)&down_node_addr, 0, sizeof(down_node_addr));
down_node_addr.sin_family = AF_INET;
down_node_addr.sin_addr.s_addr = htonl(INADDR_ANY);
down_node_addr.sin_port = htons(max_port++);
int down_node_socket_fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (::bind(down_node_socket_fd, (struct sockaddr *)&down_node_addr, sizeof(down_node_addr)) == -1)
{
cout << "Bind failed!" << endl;
}
int pos = uper.find(":");
string upip = uper.substr(0,pos);
string p = uper.substr(pos+1, uper.length()+1);
int upport = stoi(p);
memset((char *)&up_node_addr, 0, sizeof(up_node_addr));
up_node_addr.sin_family = AF_INET;
up_node_addr.sin_addr.s_addr = inet_addr(upip.c_str());
up_node_addr.sin_port = htons(upport);
char msg[BUFLEN] = {0};
int len = sizeof("Download");
snprintf(msg, len, "Download");
sendto(down_node_socket_fd, msg, len, 0, (struct sockaddr *)&up_node_addr, _slen);
len = sizeof(upip);
snprintf(msg, len, upip.c_str());
sendto(down_node_socket_fd, msg, len, 0, (struct sockaddr *)&up_node_addr, _slen);
len = sizeof(p);
snprintf(msg, len, p.c_str());
sendto(down_node_socket_fd, msg, len, 0, (struct sockaddr *)&up_node_addr, _slen);
len = sizeof(file);
snprintf(msg, len, file.c_str());
sendto(down_node_socket_fd, msg, len, 0, (struct sockaddr *)&up_node_addr, _slen);
char _bufd[BUFLEN];
int recvLen = recvfrom(down_node_socket_fd, _bufd, BUFLEN, 0, (struct sockaddr *)&_tmp_addr, reinterpret_cast<socklen_t *>(&_slen));
char filed[recvLen + 1];
strncpy(filed, _buf, recvLen);
cout << "downloader received:" << filed << endl;
recvLen = recvfrom(down_node_socket_fd, _bufd, BUFLEN, 0, (struct sockaddr *)&_tmp_addr, reinterpret_cast<socklen_t *>(&_slen));
filed[recvLen + 1];
strncpy(filed, _buf, recvLen);
cout << "ytr" << m << endl;
}
int Node::handleUpload(string dip, int dport, string file)
{
thread uplder(&Node::Uploader, this, dip, dport, file);
uplder.detach();
num_up ++;
}
void Node::Uploader(string dip, int dport, string file)
{
char msg[BUFLEN] = {0};
int len;
load++;
struct sockaddr_in downloader_addr;
int uploader_socket_fd;
memset((char *)&downloader_addr, 0, sizeof(downloader_addr));
downloader_addr.sin_family = AF_INET;
downloader_addr.sin_addr.s_addr = inet_addr(dip.c_str());
downloader_addr.sin_port = htons(dport);
uploader_socket_fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
DIR *dir;
struct dirent *ptr;
FILE *fp;
if ((dir = opendir(dirname.c_str())) == NULL)
{
perror("Open dir error...");
exit(1);
}
while ((ptr = readdir(dir)) != NULL)
{
if (strcmp(ptr->d_name, ".") == 0 || strcmp(ptr->d_name, "..") == 0) ///current dir OR parrent dir
continue;
else if (ptr->d_type == 8)
{
if(strcmp(ptr->d_name, file.c_str()) == 0)
{
fp = fopen((dirname +"/"+ file).c_str(), "rb");
if (fp == NULL)
{
cerr << "File Open Error";
}
struct stat st;
stat((dirname + "/" + file).c_str(), &st);
size_t fsize = st.st_size;
len = sizeof(fsize);
snprintf(msg, len, "%d", fsize);
sendto(uploader_socket_fd, msg, len, 0, (struct sockaddr *)&downloader_addr, _slen);
fread(msg, 1, fsize, fp);
sendto(uploader_socket_fd, msg, fsize, 0, (struct sockaddr *)&downloader_addr, _slen);
fclose(fp);
}
}
}
closedir(dir);
load--;
}
| [
"lixuefei9679@gmail.com"
] | lixuefei9679@gmail.com |
cec45f4da64e334ed5e4d9ec48a58de46040f064 | f986e6aad322515718989ee337a8c1b5c7778466 | /Baekjoon/15483_최소편집.cpp | 3e36e4c539f5185cc12dac7227b541c5f75583da | [] | no_license | wh2per/Baekjoon-Algorithm | bf611ae9c87dfc1af3f66b79f0c2d21db75c0df1 | 04f721f59b497f81452216ff0becbc3a620bbd0c | refs/heads/master | 2021-11-24T09:23:31.327854 | 2021-11-11T05:56:54 | 2021-11-11T05:56:54 | 165,788,406 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 626 | cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int bj_15483() {
string s1, s2;
cin >> s1 >> s2;
vector<vector<int>> d(1001, vector<int>(1001, 0));
int len1 = s1.length();
int len2 = s2.length();
for (int i = 0; i <= len1; ++i)
d[i][0] = i;
for (int i = 0; i <= len2; ++i)
d[0][i] = i;
for (int i = 1; i <= len1; i++) {
for (int j = 1; j <= len2; j++) {
if (s1[i - 1] == s2[j - 1])
d[i][j] = d[i - 1][j - 1];
else
d[i][j] = min(d[i - 1][j - 1] + 1, min(d[i][j - 1] + 1, d[i - 1][j] + 1));
}
}
cout << d[len1][len2];
return 0;
} | [
"93negaro@gmail.com"
] | 93negaro@gmail.com |
d374c65596bd0e06453e4dd010eb1e308b2db0dd | 55e1a90361d9c7ea4cb65213e29165dfa862d936 | /assembler/(outdated)/ifttt-cpu-assembler/ifttt-cpu-assembler.cpp | cf8b9829a3eb8e983a5b0cedcd39c84375a3e508 | [] | no_license | HolgerBovbjerg/ifttt-cpu | d6bdc5af7750a3ed8927f6e044cb8ed7bffbb3de | c32d692f5113494c90690e26f8deae87d96dc2c2 | refs/heads/master | 2022-01-06T02:51:03.986796 | 2019-05-27T13:02:33 | 2019-05-27T13:02:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 964 | cpp | // ifttt-cpu-assembler.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include "pch.h"
#include "file_handling.h"
#include "translater.h"
using namespace std;
int main()
{
read_from_asm();
translate_asm_to_mif();
init_mif(1024, 32, "UNS", "BIN");
write_to_mif();
return 0;
}
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
| [
"holger.bovbjerg@hotmail.com"
] | holger.bovbjerg@hotmail.com |
cc1bb7777c49abba9ad12341045ccdeb1c4ba4a9 | 66e9b8723929576f847e1b34a11705c754dedc3f | /ICANTEVEN/c++/Homework_1/working.cc | 086e5cc277a14a1843a421aed5e5ded7d8cc6a35 | [] | no_license | RobertaNetzova123/BecauseOfTheDamnPackageManager | 463a6edbcb4a24bc6953c28ef7895e42c288562f | c926bca22bc5b7a6d3565ad408c371f8e971c3e7 | refs/heads/master | 2021-04-12T12:18:14.118582 | 2018-03-26T12:46:04 | 2018-03-26T12:46:04 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,062 | cc | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <numeric>
#include <iomanip>
#include <string>
using namespace std;
class Exception {
string error;
public:
Exception(string msg) : error(msg) {}
string get_error() {
return error;
}
};
int main() {
try {
string input;
vector<double> sample;
cin >> input; //прочита един string от целия ред
if(input == "END") {
throw Exception("ERR: PROVIDE AT LEAST ONE NUMBER");
}
string type_of_the_function;
if(input == "strict" || input == "integers-only" || input == "strict:integers-only") {
type_of_the_function = input; //запазваме го в нова променлива за да се проверявам по-късно
cin >> input;
}
while(input != "END") {
istringstream brook(input); //от string-a input създава поток
double token;
brook >> token; //за да го набуташ в доубле променлива //за числата с повече от едно на ред
//strict
if(type_of_the_function == "strict") {
if(!brook.fail()) { //ако няма букви а само числа в потока
sample.push_back(token); //добавям числото най-накрая във вектора
}
else{
throw Exception("ERR: PROVIDE ONLY NUMBERS");
}
}
//integers-only
else if(type_of_the_function == "integers-only") {
if(!brook.fail()) {
sample.push_back(floor(token)); //закръглява към по-малкото чсило
}
}
//strict:integers-only
else if(type_of_the_function == "strict:integers-only") {
if(brook.fail()) { //ако имаме числа с десетична запетая
throw Exception("ERR: PROVIDE ONLY NUMBERS");
}
if(floor(token) == token) { //проверява дали е целочислено числото
sample.push_back(token);
} else {
throw Exception ("ERR: PROVIDE ONLY INTEGERS");
}
}
else{
if(!brook.fail()) { //ако няма никакви подадени команди
sample.push_back(token);
}
}
cin >> input;
}
if(sample.empty()) {
throw Exception ("ERR: PROVIDE AT LEAST ONE NUMBER"); //ако вектора е празен
}
double min = *min_element(sample.begin(), sample.end());
cout << min << " ";
double max = *max_element(sample.begin(), sample.end());
cout << max << " ";
double average = accumulate(sample.begin(), sample.end(), 0.0) / sample.size(); //accumulate събира всички числа и ги set-ва до един знак след десетичната запетая
if(type_of_the_function == "integers-only" || type_of_the_function == "strict:integers-only") {
cout << setprecision(2) << average << endl;
}
else cout << setprecision(4) << average << endl; //?????
} catch(Exception ex) {
cout << ex.get_error() << endl;
}
return 0;
}
| [
"mihaelagadzhalova@gmail.com"
] | mihaelagadzhalova@gmail.com |
73ac7e8a44e1cb7933b27bf3f413b441658f9c4e | c10cca6bac30319aeeb136e78acece6d915b407e | /PurePlayer/SubtitlePlayer.h | dd9b6051d09f8aa30f5e239586012526e7b3dee3 | [] | no_license | hinkage/PurePlayer | 8aacb144680918882ee7a56a60745b4de0db2ad3 | c21f5defcde28c91e8e1b0f98ca359379bd980d5 | refs/heads/master | 2022-11-12T12:47:30.902018 | 2019-07-31T03:09:58 | 2019-07-31T03:09:58 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 238 | h | #pragma once
#include "BasePlayer.h"
#include "SubtitleDecoder.h"
class SubtitlePlayer: public BasePlayer
{
public:
SubtitlePlayer();
~SubtitlePlayer();
void play_current_frame() {};
SubtitleDecoder subtitleDecoder;
private:
};
| [
"2505513470@qq.com"
] | 2505513470@qq.com |
a35d3ccabcfe6c1ff81f4b58c11cd197ac7ebb24 | 5f85a0d7cc024ff0e6752378b95f0f7c5d6565cb | /C++学习/C++数据结构/实验四/ex/MyString.h | a9e28d3711eb9e8bb7682979a60ab1404c7002ec | [] | no_license | lskyo/school | 9060ce45411bdbd457a0b1def2582b7230742752 | 5eb9cc59c1021ea04a34b8bf10a42f0344598cbe | refs/heads/master | 2021-01-12T15:23:05.547248 | 2017-06-15T02:20:39 | 2017-06-15T02:20:39 | 71,765,365 | 3 | 0 | null | null | null | null | GB18030 | C++ | false | false | 13,187 | h | #include <iostream>
using namespace std;
#include <string> //包含strlen(s)求串长等函数
//约定:在保证正确前提下,可对char*使用string.h中函数
class MyString //字符串类
{
private: //私有成员
char *element; //动态字符数组
int length; //数组容量
int n; //串长度
void init(char *s="", int length=32); //初始化串,参数指定初值和容量
public:
MyString(char *s="", int length=32); //构造串对象,s指定char*串常量,length指定容量
MyString(char ch); //构造串对象,ch指定字符初值
MyString(MyString &str); //拷贝构造函数,深拷贝
MyString& operator=(MyString &str); //重载=赋值运算符,深拷贝
MyString& operator=(char *str); //支持赋值为字符串常量
~MyString(); //析构函数
bool empty(); //判断串是否为空
int count(); //返回串长度
char& operator[](int i); //重载下标运算符,引用第i(≥0)个字符
friend ostream& operator<<(ostream& out, MyString &s); //重载<<输出流运算符
bool operator==(MyString &str); //重载==运算符,比较两串是否相等
bool operator!=(MyString &str); //重载!=运算符,比较两串是否不相等
bool operator<(MyString &str); //重载<运算符,比较两串大小
bool operator<=(MyString &str);
bool operator>(MyString &str);
bool operator>=(MyString &str);
void reverse(); //将当前串逆转
MyString substring(int i, int len); //返回从第i个字符开始长度为len的子串
MyString substring(int i); //返回从第i个字符开始至串尾的子串
void insert(int i, MyString &str); //在第i个字符处插入str串
void insert(int i, char ch); //插入ch作为第i个字符
void insert(int i, char* str); //在第i个字符处插入str串
void operator+=(MyString &str); //重载+=运算符,在当前串之后连接str串
void operator+=(char ch); //重载+=运算符,在当前串之后连接ch字符
void operator+=(char *str); //重载+=运算符,在当前串之后连接str串
MyString operator+(MyString &str); //重载+运算符,返回当前串与str连接后的串
void remove(int i, int len); //删除从第i个字符开始长度为len的子串
void remove(int i); //删除从第i个字符开始至串尾的子串
};
//1. 字符串的基本操作
//(1)构造、析构
void MyString::init(char *s, int length) //初始化串,s指定初值,length指定(默认)数组容量
{
this->n = strlen(s); //获得s串长度,strlen(s)定义在string.h中
this->length = (n*2)>length ? (n*2) : length; //指定数组容量,取n*2、length最大值
this->element = new char[this->length]; //申请字符数组
for (int i=0; s[i]!='\0'; i++) //复制s字符串,strcpy(*,*)功能
this->element[i] = s[i];
this->element[this->n] = '\0';
}
//构造串对象,s指定初值,接受char*类型的字符串常量;length指定数组容量,有默认值
MyString::MyString(char *s, int length)
{
this->init(s, length);
// cout<<s<<endl;
}
MyString::MyString(char ch) //构造串对象,ch指定字符初值
{
this->init("");
this->n = 1;
this->element[0] = ch;
this->element[1] = '\0';
}
MyString::MyString(MyString &str) //拷贝构造函数,深拷贝
{
this->init(str.element);
}
MyString& MyString::operator=(MyString &str) //重载=赋值运算符,深拷贝
{
this->~MyString(); //调用析构函数,释放element数组空间
this->init(str.element); //全部重新申请数组空间
return *this;
}
MyString& MyString::operator=(char *str) //重载=赋值运算符,深拷贝
{
this->~MyString(); //调用析构函数,释放element数组空间
this->init(str); //全部重新申请数组空间
return *this;
}
MyString::~MyString() //析构函数
{
// cout<<"MyString析构"<<*this<<",n="<<count<<",length="<<length<<endl;
delete []this->element;
}
//【思考题3-1】
//(2)判空、串长度、输出和存取字符
bool MyString::empty() //判断串是否为空
{
return this->n==0;
}
int MyString::count() //返回串长度
{
return this->n;
}
//重载下标运算符,引用第i(0≤i<n)个字符。若i<0或i≥n,则抛出异常
char& MyString::operator[](int i)
{
if (i>=0 && i<this->n)
return this->element[i]; //返回元素引用
throw out_of_range("参数i指定元素序号超出范围"); //抛出C++ STL范围越界异常
}
ostream& operator<<(ostream& out, MyString &str) //重载<<输出流运算符
{
out<<"\""<<str.element<<"\""; //输出流支持以字符指针形式输出字符数组
return out;
}
//【习3.1】
//(6)关系运算,char支持==、!=、>、>=、<、<=运算
bool MyString::operator==(MyString &str) //重载==运算符,比较两个串是否相等
{
if (this==&str) //指针比较,当两个对象引用同一个实例时
return true;
if (this->n != str.n) //以下考虑深拷贝情况,比较两者长度是否相等,不比较数组容量
return false;
for (int i=0; i<this->n; i++) //比较两个串的所有字符是否对应相等
if (this->element[i] != str.element[i])
return false;
return true;
}
bool MyString::operator!=(MyString &str) //重载!=运算符,比较两个串是否不相等
{
return !(*this==str);
}
bool MyString::operator<(MyString &str) //重载<运算符,比较两个串大小
{
if (this==&str) //指针比较,当两个对象引用同一个实例时
return false;
int i=0;
while (i<this->n && i<str.n)
if (this->element[i]==str.element[i]) //对应字符相等时继续比较
i++;
else
return this->element[i]<str.element[i]; //以首个不相等字符确定两串的大小
return this->n < str.n; //两串前若干字符对应相等,还要比长度。*this串较短时返回1,不包括等长
}
bool MyString::operator<=(MyString &str) //重载<=运算符,比较两个串大小
{
if (this==&str) //指针比较,当两个对象引用同一个实例时
return true;
int i=0;
while (i<this->n && i<str.n)
if (this->element[i]==str.element[i]) //对应字符相等时继续比较
i++;
else
return this->element[i]<str.element[i];
return this->n <= str.n; //两串等长或*this串较短时返回1
}
bool MyString::operator>(MyString &str) //重载>运算符,比较两个串的大小
{
return !(*this <= str);
}
bool MyString::operator>=(MyString &str) //重载>=运算符,比较两个串的大小
{
return !(*this < str);
}
void MyString::reverse()
{
//将当前串逆转
//可用来判断是否为回文
//请自行完成代码的设计
char t;
for(int i=0;i<n/2;i++)
{
t=element[i];
element[i]=element[n-i-1];
element[n-i-1]=t;
}
}
//2. 对子串的操作
//(1)求子串
//返回从第i(0≤i<n)个字符开始长度为len(>=0)的子串;len容错,若i+len>串长度n,
//则复制到串尾。若i<0或i≥n,或len<0则抛出异常
MyString MyString::substring(int i, int len)
{
if (i>=0 && i<n && len>=0)
{
if (len>n-i) //len容错
len=n-i; //i+len最多到串尾
MyString sub; //创建空串对象
sub.n = len; //若len=0,则返回空串
for (int j=0; j<len; j++)
sub.element[j] = this->element[i+j];
sub.element[len]='\0';
return sub; //执行MyString的拷贝构造函数
}
else
throw out_of_range("参数i指定字符序号或len超出范围");//抛出C++ STL范围越界异常
}
MyString MyString::substring(int i) //返回从第i个字符开始至串尾的子串
{
return substring(i, this->n-i+1);
}
//(2)插入串
//在第i(≥0)个字符处插入str串。i容错,若i<0,插入在最前;若i≥n,插入在最后
void MyString::insert(int i, MyString &str)
{
if (str.n==0) return; //若str为空串,则不操作
if (i<0) i=0; //插入位置i容错,最前
if (i>n) i=n; //最后
char *temp = this->element;
if (this->length <= this->n+str.n) //若当前串的字符数组空间不足,则扩充容量
{
this->length = (this->n+str.n+1)*2; //指定数组容量
this->element = new char[this->length]; //重新申请字符数组空间
for (int j=0; j<i; j++) //复制当前串前i-1个字符
this->element[j] = temp[j];
}
for (int j=this->n; j>=i; j--) //从i开始至串尾的子串(包括'\0')向后移动,次序是从后向前
this->element[j+str.n] = temp[j]; //移动距离是插入串长度
if (temp!=this->element)
delete[] temp; //释放原数组空间
for (int j=0; j<str.n; j++) //插入str串
this->element[i+j] = str.element[j];
this->n += str.n;
}
void MyString::insert(int i, char ch) //插入ch作为第i个字符。i序号越界容错
{
this->insert(i, MyString(ch));
}
void MyString::insert(int i, char* str) //在第i个字符处插入str串常量。i序号越界容错
{
this->insert(i, MyString(str));
}
//【思考题3-2】连接串
//重载+=运算符,在当前串之后连接str,*this += str,改变当前串
void MyString::operator+=(MyString &str)
{
this->insert(this->n, str);
}
void MyString::operator+=(char ch) //连接ch字符
{
insert(this->n, MyString(ch));
}
void MyString::operator+=(char* str) //连接str串,习题3
{
insert(this->n, MyString(str));
}
//重载+运算符,返回连接起来的新串,result=*this+str,不改变当前串*this
MyString MyString::operator+(MyString &str)
{
MyString result(*this); //复制当前串*this,执行MyString的拷贝构造函数
result.insert(this->n, str);
return result; //返回串对象,执行MyString的拷贝构造函数
}
//(3) 删除子串
//删除从第i(0≤i<n)个字符开始长度为len(>0)的子串。若i或len参数无效,则不操作。
//len容错,若i+len>串长度n,则删除到串尾
void MyString::remove(int i, int len)
{
if (i<0 || i>=this->n || len<0)
return;
if (len>n-i) //len容错,若i+len>串长度n,则删除到串尾
len = n-i;
for (int j=i+len; j<=n; j++) //从i+len开始至串尾的子串(包括'\0')向前移动len个字符
this->element[j-len] = element[j];
this->n -= len;
}
void MyString::remove(int i) //删除从第i(≥0)个字符开始至串尾的子串
{
remove(i, this->n-i);
}
| [
"609911762@qq.com"
] | 609911762@qq.com |
0a7ae57574bbb4711d8f25db270747862613374d | 63daabf17b753e8ed72ef4ada0d9c3a9f9e69bb8 | /Baekjoon/1000~10000/3001~3100/3036.cpp | 01520168dc0332d5433247f1c666ad1b1a188437 | [] | no_license | weedrice/Algorithm | 97c829bafdf6f1e1d3983788e20f7f9d3b6e0b82 | 7cbaf8ad733a29d02b552154e8450d8a5619165d | refs/heads/master | 2022-06-25T16:51:56.565925 | 2020-05-12T05:59:35 | 2020-05-12T05:59:35 | 136,200,598 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 384 | cpp | #include <cstdio>
int gcd(int a, int b) {
int c;
while (b) {
c = a % b;
a = b;
b = c;
}
return a;
}
int main() {
int n;
scanf("%d", &n);
int* ringArr = new int[n];
for (int i = 0; i < n; i++) {
scanf("%d", &ringArr[i]);
}
for (int i = 1; i < n; i++) {
int gcdNum = gcd(ringArr[0], ringArr[i]);
printf("%d/%d\n", ringArr[0] / gcdNum, ringArr[i] / gcdNum);
}
} | [
"supp0rtyoo@gmail.com"
] | supp0rtyoo@gmail.com |
567dfff1bfb6ef7ab03ebdfbe0a6b8050ad21211 | 600df3590cce1fe49b9a96e9ca5b5242884a2a70 | /chrome/browser/ui/ash/launcher/chrome_mash_shelf_controller.h | 748f9b425b90a7772ae3d86f9fb7957bb6db5b69 | [
"BSD-3-Clause"
] | permissive | metux/chromium-suckless | efd087ba4f4070a6caac5bfbfb0f7a4e2f3c438a | 72a05af97787001756bae2511b7985e61498c965 | refs/heads/orig | 2022-12-04T23:53:58.681218 | 2017-04-30T10:59:06 | 2017-04-30T23:35:58 | 89,884,931 | 5 | 3 | BSD-3-Clause | 2022-11-23T20:52:53 | 2017-05-01T00:09:08 | null | UTF-8 | C++ | false | false | 2,077 | h | // Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_MASH_SHELF_CONTROLLER_H_
#define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_MASH_SHELF_CONTROLLER_H_
#include <map>
#include <memory>
#include <string>
#include <vector>
#include "ash/public/interfaces/shelf.mojom.h"
#include "chrome/browser/ui/app_icon_loader.h"
#include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h"
#include "mojo/public/cpp/bindings/associated_binding.h"
class ChromeShelfItemDelegate;
// ChromeMashShelfController manages chrome's interaction with the mash shelf.
class ChromeMashShelfController : public ash::mojom::ShelfObserver,
public AppIconLoaderDelegate {
public:
ChromeMashShelfController();
~ChromeMashShelfController() override;
void LaunchItem(const std::string& app_id);
private:
void Init();
void PinAppsFromPrefs();
AppIconLoader* GetAppIconLoaderForApp(const std::string& app_id);
// ash::mojom::ShelfObserver:
void OnShelfCreated(int64_t display_id) override;
void OnAlignmentChanged(ash::ShelfAlignment alignment,
int64_t display_id) override;
void OnAutoHideBehaviorChanged(ash::ShelfAutoHideBehavior auto_hide,
int64_t display_id) override;
// AppIconLoaderDelegate:
void OnAppImageUpdated(const std::string& app_id,
const gfx::ImageSkia& image) override;
LauncherControllerHelper helper_;
ash::mojom::ShelfControllerPtr shelf_controller_;
mojo::AssociatedBinding<ash::mojom::ShelfObserver> observer_binding_;
std::map<std::string, std::unique_ptr<ChromeShelfItemDelegate>>
app_id_to_item_delegate_;
// Used to load the images for app items.
std::vector<std::unique_ptr<AppIconLoader>> app_icon_loaders_;
DISALLOW_COPY_AND_ASSIGN(ChromeMashShelfController);
};
#endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_MASH_SHELF_CONTROLLER_H_
| [
"enrico.weigelt@gr13.net"
] | enrico.weigelt@gr13.net |
6cef17cf85e4f9aa471be6967b2014861933642c | 30150c1a4a99608aab496570e172bdce4c53449e | /067_OOP_intro.cpp | 45fcc4f0ae09787e2b92ce602ca010d97b2e16d2 | [] | no_license | gergokutu/cplusplus-tutorials | 88334ba9b1aa8108109796d69ab5e8dd94da62c6 | 11e9c15f6c4e06b8e97ce77a732aec460d0251eb | refs/heads/master | 2020-09-04T17:46:03.954635 | 2020-01-14T11:44:15 | 2020-01-14T11:44:15 | 219,837,606 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 949 | cpp | /*
Intro to Object Oriented Programming
- pretty big topic
- structs
- all C-like programming languages has this concept >
- like Java, C#...
- but there is specifics to C++ OOP
OOP:
- based on classes and objects
- classes the blueprints for its instances (objects)
- we can describes data and real world things as objects
- help to keep things organized
- you can imagine it as an axcel table
- column names (the structure) > class
- each individual row (instances) > object
Basic concepts of OOP:
- ?data abstraction
- structs
- similar to classes
- used for smaller things than classes
- classes
- members of classes
- data members (variables inside of a class)
- methods
- constructor
- destructor
- encapsulation
- hide the inner details of the class
- give a public interface to interact
- inheritance
- classes can inherit from other classes
- polimorphism
- classes can be interpreted as their parent classes...
*/ | [
"gergo.kutu@gmail.com"
] | gergo.kutu@gmail.com |
92ed4aa359d8e3d360a5db7b8d215414ef583c11 | 5838cf8f133a62df151ed12a5f928a43c11772ed | /NT/com/netfx/src/clr/profile/counters/perfcounters.cpp | 84fc36718be9c8d0357569a9978bba894a0c68ab | [] | no_license | proaholic/Win2K3 | e5e17b2262f8a2e9590d3fd7a201da19771eb132 | 572f0250d5825e7b80920b6610c22c5b9baaa3aa | refs/heads/master | 2023-07-09T06:15:54.474432 | 2021-08-11T09:09:14 | 2021-08-11T09:09:14 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,655 | cpp | // ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
// ===========================================================================
// File: PerfCounters.CPP
//
// ===========================================================================
// PerfCounters.cpp
#include "stdafx.h"
// Always enable perf counters
#define ENABLE_PERF_COUNTERS
#include "PerfCounters.h"
#include "IPCManagerInterface.h"
#ifdef ENABLE_PERF_COUNTERS
extern IPCWriterInterface* g_pIPCManagerInterface;
//-----------------------------------------------------------------------------
// Instantiate static data
//-----------------------------------------------------------------------------
PerfCounterIPCControlBlock PerfCounters::m_garbage;
HANDLE PerfCounters::m_hGlobalMapPerf = NULL;
PerfCounterIPCControlBlock * PerfCounters::m_pGlobalPerf = &PerfCounters::m_garbage;
PerfCounterIPCControlBlock * PerfCounters::m_pPrivatePerf = &PerfCounters::m_garbage;
BOOL PerfCounters::m_fInit = false;
//-----------------------------------------------------------------------------
// Should never actually instantiate this class, so assert.
// ctor is also private, so we should never be here.
//-----------------------------------------------------------------------------
PerfCounters::PerfCounters()
{
_ASSERTE(false);
}
//-----------------------------------------------------------------------------
// Create or Open memory mapped files for IPC for both shared & private
//-----------------------------------------------------------------------------
HRESULT PerfCounters::Init() // static
{
// @todo: not opening the private IPC block is not a good enough reason
// to fail. so we return NO_ERROR. If we do fail, just drop something in
// the logs. PerfCounters are designed to work even if not connected.
// Should only be called once
_ASSERTE(!m_fInit);
_ASSERTE(g_pIPCManagerInterface != NULL);
HRESULT hr = NOERROR;
BOOL globalMapAlreadyCreated = FALSE;
void * pArena = NULL;
// Open shared block
LPSECURITY_ATTRIBUTES pSecurity = NULL;
hr = g_pIPCManagerInterface->GetSecurityAttributes(GetCurrentProcessId(), &pSecurity);
// No need to check the HR. pSecurity will be NULL if it fails, and this logic doesn't care.
if (RunningOnWinNT5())
{
m_hGlobalMapPerf = WszCreateFileMapping(
(HANDLE) -1, // Current file handle.
pSecurity, // Default security.
PAGE_READWRITE, // Read/write permission.
0, // Max. object size.
sizeof(PerfCounterIPCControlBlock), // Size of hFile.
L"Global\\" SHARED_PERF_IPC_NAME); // Name of mapping object.
}
else
{
m_hGlobalMapPerf = WszCreateFileMapping(
(HANDLE) -1, // Current file handle.
pSecurity, // Default security.
PAGE_READWRITE, // Read/write permission.
0, // Max. object size.
sizeof(PerfCounterIPCControlBlock), // Size of hFile.
SHARED_PERF_IPC_NAME); // Name of mapping object.
}
g_pIPCManagerInterface->DestroySecurityAttributes(pSecurity);
pSecurity = NULL;
if (m_hGlobalMapPerf == NULL)
{
//hr = HRESULT_FROM_WIN32(GetLastError());
hr = NO_ERROR;
goto errExit;
}
else
{
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
globalMapAlreadyCreated = TRUE;
}
}
// Map shared block into memory
pArena = MapViewOfFile(m_hGlobalMapPerf, // Handle to mapping object.
FILE_MAP_ALL_ACCESS, // Read/write permission
0, // Max. object size.
0, // Size of hFile.
0);
if (pArena == NULL)
{
CloseHandle(m_hGlobalMapPerf);
//hr = HRESULT_FROM_WIN32(GetLastError());
hr = NO_ERROR;
goto errExit;
}
m_pGlobalPerf = (PerfCounterIPCControlBlock*) pArena;
// Set Version & attr.
// Note, if we're not updating counters, either this block doesn't exist, or
// if it does, these fields are 0. So clients can know the validity of the data
if (! globalMapAlreadyCreated)
memset (m_pGlobalPerf, 0, sizeof (PerfCounterIPCControlBlock));
m_pGlobalPerf->m_cBytes = sizeof(PerfCounterIPCControlBlock);
m_pGlobalPerf->m_wAttrs = PERF_ATTR_ON | PERF_ATTR_GLOBAL;
errExit:
m_pPrivatePerf= g_pIPCManagerInterface->GetPerfBlock();
// Set attributes
if (m_pPrivatePerf != NULL)
{
memset (m_pPrivatePerf, 0, sizeof (PerfCounterIPCControlBlock));
m_pPrivatePerf->m_cBytes = sizeof(PerfCounterIPCControlBlock);
m_pPrivatePerf->m_wAttrs = PERF_ATTR_ON;
}
if (SUCCEEDED(hr))
{
m_fInit = true;
} else {
Terminate();
}
return hr;
}
//-----------------------------------------------------------------------------
// Reset certain counters to 0 at closure because we could still have
// dangling references to us
//-----------------------------------------------------------------------------
void ResetCounters()
{
// Signify this block is no longer being updated
GetPrivatePerfCounters().m_wAttrs &= ~PERF_ATTR_ON;
for(int iGen = 0; iGen < MAX_TRACKED_GENS; iGen ++)
{
GetPrivatePerfCounters().m_GC.cGenHeapSize[iGen] = 0;
}
GetPrivatePerfCounters().m_GC.cLrgObjSize = 0;
}
//-----------------------------------------------------------------------------
// Shutdown - close handles
//-----------------------------------------------------------------------------
void PerfCounters::Terminate() // static
{
// @jms - do we have any threading issues to worry about here?
// Should be created first
_ASSERTE(m_fInit);
// Reset counters to zero for dangling references
ResetCounters();
// release global handles
if (m_hGlobalMapPerf != NULL)
{
::CloseHandle(m_hGlobalMapPerf);
m_hGlobalMapPerf = NULL;
}
if (m_pGlobalPerf != &PerfCounters::m_garbage)
{
UnmapViewOfFile(m_pGlobalPerf);
m_pGlobalPerf = &PerfCounters::m_garbage;
}
if (m_pPrivatePerf != &PerfCounters::m_garbage)
{
m_pPrivatePerf = &PerfCounters::m_garbage;
}
m_fInit = false;
}
Perf_Contexts *GetPrivateContextsPerfCounters()
{
return (Perf_Contexts *)((unsigned char *)PerfCounters::GetPrivatePerfCounterPtr() + offsetof (PerfCounterIPCControlBlock, m_Context));
}
Perf_Contexts *GetGlobalContextsPerfCounters()
{
return (Perf_Contexts *)((unsigned char *)PerfCounters::GetGlobalPerfCounterPtr() + offsetof (PerfCounterIPCControlBlock, m_Context));
}
#endif // ENABLE_PERF_COUNTERS
| [
"blindtiger@foxmail.com"
] | blindtiger@foxmail.com |
eb998982bef6d587b4e43cc2c24446cd5dd2da8a | 3821e537c0e03e602ba4ac770dcce0d741d026a7 | /Atcoder/abc120_b.cpp | e6bf17de40bf856f4da7e85acf4a11357f77a463 | [] | no_license | msyashik/CPPS | 6766992e40c30f112d959b5c57e1af5487d885a9 | ae163a3a75dade8bc51f566ae529ea4f9075db97 | refs/heads/master | 2023-07-13T00:08:32.465275 | 2021-08-22T02:41:23 | 2021-08-22T02:41:23 | 161,633,625 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 494 | cpp | //Problem Link : https://atcoder.jp/contests/abc120/tasks/abc120_b
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define Fastest ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
int main()
{
int a, b, c;
cin >> a>> b >> c;
int coun = 0;
for(int i = 100; i >= 1; i--)
{
if((a%i == 0) && (b%i == 0))
{
coun++;
}
if(coun == c)
{
cout << i << endl;
return 0;
}
}
return 0;
}
| [
"noreply@github.com"
] | noreply@github.com |
956c548a4da8fea3c76872c9210208f28c1cadd8 | f393e8ea54685ae881e5c71331ffc4625735ac2e | /hikr/build/Android/Preview/app/src/main/include/Fuse.Reactive.PropertyBinding.h | 8e8ca5c7461f6606ef3206e1bde06fc8c2bfb299 | [] | no_license | joseph-shumway/Manna | f4c92f56152d3d206f8c9b1e9392a11d6245f10c | 13354425ee59b10f3c22bbc442fdd85db2aa9d17 | refs/heads/master | 2022-02-17T01:20:42.479275 | 2017-12-21T23:23:47 | 2017-12-21T23:23:47 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,249 | h | // This file was generated based on C:/Users/Shumcom/AppData/Local/Fusetools/Packages/Fuse.Reactive.Bindings/1.4.0/DataBinding.uno.
// WARNING: Changes might be lost if you edit this file directly.
#pragma once
#include <Fuse.INameListener.h>
#include <Fuse.Reactive.DataBinding.h>
#include <Fuse.Reactive.IContext.h>
#include <Fuse.Reactive.IListener.h>
#include <Fuse.Reactive.IObserver.h>
#include <Uno.UX.IPropertyListener.h>
namespace g{namespace Fuse{namespace Reactive{struct PropertyBinding;}}}
namespace g{namespace Uno{namespace UX{struct Property;}}}
namespace g{
namespace Fuse{
namespace Reactive{
// public sealed class PropertyBinding :323
// {
::g::Fuse::Reactive::DataBinding_type* PropertyBinding_typeof();
void PropertyBinding__ctor_3_fn(PropertyBinding* __this, ::g::Uno::UX::Property* target, ::g::Uno::UX::Property* source);
void PropertyBinding__New2_fn(::g::Uno::UX::Property* target, ::g::Uno::UX::Property* source, PropertyBinding** __retval);
struct PropertyBinding : ::g::Fuse::Reactive::DataBinding
{
void ctor_3(::g::Uno::UX::Property* target, ::g::Uno::UX::Property* source);
static PropertyBinding* New2(::g::Uno::UX::Property* target, ::g::Uno::UX::Property* source);
};
// }
}}} // ::g::Fuse::Reactive
| [
"thegreenjag1@gmail.com"
] | thegreenjag1@gmail.com |
41489075ffe545ef2a00e3fc8fdb86132e08d4cb | 3ad968797a01a4e4b9a87e2200eeb3fb47bf269a | /wfc_sample/Sample/SerialTest/Normal/Receiver/compute_checksum.cpp | 85f5d44590ef3e562164fdf7f96c693530d08941 | [] | no_license | LittleDrogon/MFC-Examples | 403641a1ae9b90e67fe242da3af6d9285698f10b | 1d8b5d19033409cd89da3aba3ec1695802c89a7a | refs/heads/main | 2023-03-20T22:53:02.590825 | 2020-12-31T09:56:37 | 2020-12-31T09:56:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 548 | cpp | #include "receiver.h"
#pragma hdrstop
DWORD compute_checksum( const DWORD * buffer, DWORD number_of_entries )
{
WFCTRACEINIT( TEXT( "compute_checksum()" ) );
DWORD checksum = 0xAAAAAAAA; // Initialize the checksum
DWORD loop_index = 0;
while( loop_index < number_of_entries )
{
checksum ^= buffer[ loop_index ];
if ( checksum != 0 )
{
while( bit_test( checksum, 31 ) == 1 && checksum != 0 )
{
checksum <<= 1;
}
}
loop_index++;
}
return( checksum );
}
| [
"pkedpekr@gmail.com"
] | pkedpekr@gmail.com |
8e5f1c6f6922cd9c0949bffa7ecf7473ee8737b0 | b9af1a423fb98d0f5889858b58774a38da302cb2 | /assignment.cpp | 632c2b6eea73072476fe646bc00d3b712df01e8e | [] | no_license | hap17066/practise1 | c9ce0d6a5877b882920214541454c9e49efb5570 | 3f9356ce1ca6c562c8dcbf8611942b182de9f2aa | refs/heads/master | 2023-02-02T18:43:41.148187 | 2020-12-21T06:29:33 | 2020-12-21T06:29:33 | 320,642,355 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 755 | cpp | #include<bits/stdc++.h>
using namespace std;
float corrCoeff(int X[], int Y[], int N)
{
int sumX = 0, sumY = 0, sumXY = 0, squareSumX = 0, squareSumY = 0;
float corrcoe;
for (int i = 0; i < N; i++)
{
sumX = sumX + X[i];
sumY = sumY + Y[i];
sumXY = sumXY + X[i] * Y[i];
squareSumX = squareSumX + X[i] * X[i];
squareSumY = squareSumY + Y[i] * Y[i];
}
corrcoe = (float)(N * sumXY - sumX * sumY) / sqrt((N * squareSumX - sumX * sumX) * (N * squareSumY - sumY * sumY));
return corrcoe;
}
int main()
{
int X[] = {43, 21, 25, 42, 57, 59};
int Y[] = {99, 65, 79, 75, 87, 81};
int N = sizeof(X)/sizeof(X[0]);
cout<<corrCoeff(X, Y, N);
return 0;
}
| [
"“harshalpatil17066@gmail.com”"
] | “harshalpatil17066@gmail.com” |
0e4badd85baac16aebc681b7367547543b875b4a | ff082da6f13bed8f54ed8bb47664fc343f01950a | /Utilisateur.cpp | bc1f7ac357efcaaaa8ce2a3b7953113940945eac | [] | no_license | KABA15u/miniarche | 22591b6526fa507fab8c6f59be8c83e829ba4743 | 25b12677a01a166d09bda669d535157008d96630 | refs/heads/master | 2021-01-18T04:42:52.897056 | 2014-12-23T13:36:06 | 2014-12-23T13:36:06 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,285 | cpp | #include "Utilisateur.h"
#include <windows.h>
#include <windowsx.h>
using namespace std;
Utilisateur::Utilisateur(LPCSTR nom, LPCSTR prenom, LPCSTR login, LPCSTR mdp) : m_nom(nom), m_prenom(prenom), m_login(login), m_mdp(mdp)
{
}
Utilisateur::~Utilisateur()
{
}
LPCSTR Utilisateur::getNom() const
{
return m_nom;
}
void Utilisateur::setNom(LPCSTR nom)
{
m_nom = nom;
}
LPCSTR Utilisateur::getPrenom() const
{
return m_prenom;
}
void Utilisateur::setPrenom(LPCSTR prenom)
{
m_prenom = prenom;
}
LPCSTR Utilisateur::getLogin() const
{
return m_login;
}
void Utilisateur::setLogin(LPCSTR login)
{
m_login = login;
}
LPCSTR Utilisateur::getMdp() const
{
return m_mdp;
}
void Utilisateur::setMdp(LPCSTR mdp)
{
m_mdp = mdp;
}
LPCSTR Utilisateur::afficherMessage() const
{
return m_bdr.afficherMessage();
}
void Utilisateur::newMessage(LPCSTR message)
{
m_bdr.newMessage(message);
}
| [
"mamdikab@gmail.com"
] | mamdikab@gmail.com |
f957dbceddfb288592375338dd636202749f14ad | 0b11c8c54b1e71ae935ea032376e785be8bfb65e | /2527_37.cpp | fc34b8186ae3be57db0c58dd6651dc48ec07606a | [] | no_license | wyx150137/wyx-infinity37-ac-code-on-BZOJ | 320bef65927b065c938dec97c44fc599fac14176 | 5a1cc0803e0356e59f6e679e6aed23f8374ab67b | refs/heads/master | 2020-06-25T01:45:51.676298 | 2017-07-12T23:45:45 | 2017-07-12T23:45:45 | 96,950,945 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,873 | cpp |
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
const int N = 3e5+5;
typedef long long LL;
struct E
{int next,to;}e[N],k[N];
int head[N],tot;
void add(int x,int y)
{
e[++tot].to = y;
e[tot].next = head[x];
head[x] = tot;
}
int pos[N],Cnt,n,m,K;
void Add(int x,int y)
{
k[++Cnt].to = y;
k[Cnt].next = pos[x];
pos[x] = Cnt;
}
struct A
{int l,r,mid;}ask[N];
LL c[N];
struct R
{int s,t,a;}rain[N];
void update(int x,int y)
{
for(int i = x;i<N;i+=i&(-i))
c[i]+=y;
}
LL getans(int x)
{
LL ans = 0;
for(int i = x;i>0;i-=i&(-i))
ans+=c[i];
return ans;
}
void UP(int i)
{
if(rain[i].s>rain[i].t)
{
update(1,rain[i].a);update(rain[i].t+1,-rain[i].a);
update(rain[i].s,rain[i].a);update(m+1,-rain[i].a);
}else
update(rain[i].s,rain[i].a),update(rain[i].t+1,-rain[i].a);
}
LL p[N];
void check()
{
memset(c,0,sizeof(c));
memset(head,0,sizeof(head));
tot = 0;
for(int i = 1;i<= n;i++)
{
ask[i].mid = (ask[i].l+ask[i].r)>>1;
add(ask[i].mid,i);
}
for(int i = 1;i<= K;i++)
{
UP(i);
for(int j = head[i];j;j = e[j].next)
{
LL ans = 0;
for(int t = pos[e[j].to];t;t = k[t].next)
{
ans+=getans(k[t].to);
if(ans>p[e[j].to])break;
}
if(ans<p[e[j].to])
ask[e[j].to].l = ask[e[j].to].mid+1;
else
ask[e[j].to].r = ask[e[j].to].mid;
}
}
}
int main()
{
//freopen("met.in","r",stdin);
//freopen("met.out","w",stdout);
scanf("%d%d",&n,&m);
for(int i = 1;i<= m;i++)
{
int x;
scanf("%d",&x);
Add(x,i);
}
for(int i = 1;i<= n;i++)
scanf("%lld",&p[i]);
scanf("%d",&K);
for(int i = 1;i<= K;i++)
scanf("%d%d%d",&rain[i].s,&rain[i].t,&rain[i].a);
for(int i = 1;i<= n;i++)
ask[i].l = 1,ask[i].r = K+1;
for(int i = 1;i<= 20;i++)
check();
for(int i = 1;i<= n;i++)
{
if(ask[i].mid<=K)
printf("%d\n",ask[i].mid);
else printf("NIE\n");
}
return 0;
}
| [
"wyx150137@users.noreply.github.com"
] | wyx150137@users.noreply.github.com |
21ca66a9abb425ae697fe27ade56c6fc4e1439c3 | 08b8cf38e1936e8cec27f84af0d3727321cec9c4 | /data/crawl/wget/old_hunk_1357.cpp | cc81b63dbe3ed278b18fdeb1ab0dfa4a3b290b7c | [] | no_license | ccdxc/logSurvey | eaf28e9c2d6307140b17986d5c05106d1fd8e943 | 6b80226e1667c1e0760ab39160893ee19b0e9fb1 | refs/heads/master | 2022-01-07T21:31:55.446839 | 2018-04-21T14:12:43 | 2018-04-21T14:12:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 371 | cpp | if (*dt & RETROKF)
{
logprintf (LOG_VERBOSE,
_("%s (%s) - `%s' saved [%s/%s]\n\n"),
tms, tmrate, hstat.local_file,
number_to_static_string (hstat.len),
number_to_static_string (hstat.contlen));
logprintf (LOG_NONVERBOSE,
| [
"993273596@qq.com"
] | 993273596@qq.com |
c181aead9f8ddefa7d9f2dd533cc2fcbe5bb1a50 | edf7d36d50485e33ab241c4bca12feda2443d503 | /BindNowPolicy.cpp | 467ed64f0be3f1e32208ec077a742b2158d96640 | [] | no_license | afwu/SilverPatcher | e77d2fe674ce8202fd96e92f0bc758734f8cae3a | f99282be69022cac0394c4c8fc534dd13e1f25c6 | refs/heads/master | 2023-07-07T12:09:22.652303 | 2021-08-12T11:10:38 | 2021-08-12T11:10:38 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,628 | cpp | #include "BindNowPolicy.h"
#include "BinaryEditor.h"
/*RELRO是个很有意思的东西,其实包含了两个方面:
1、立即绑定
2、绑定后获取的动态地址表项(GOT)只读
GNU在实现时,这两个是完全独立的特性。
可以有如下编译选项:
-z now -z norelro,立即绑定,但不添加PT_GNU_RELRO段,.got.plt和.got都可写
-z relro,延时绑定,添加PT_GNU_RELRO段,只有.got只读,.got.plt依然可写
-z now, 立即绑定,添加PT_GNU_RELRO段,.got只读,.got.plt节取消(plt直接调用.got节地址了)
PT_GNU_RELRO中虚拟地址和size,指定了要设置为只读的区域,可通过readelf -l 查看包含哪些节,这个范围必须是页对齐的,即结束地址必须是0x1000整数倍
所以强制添加GOT表项为只读是不可能的,只能换一种曲折的方案,那就是策略ResortGotEntryPolicy,打乱GOT表顺序来延缓攻击。
*/
void BindNowPolicy::do_patch()
{
label("BindNowPolicy");
if (BinaryEditor::instance()->isBindNow())
{
std::cout << "Got BindNow already SUPPORT." << std::endl;
return;
}
//增加DynamicEntry DT_BIND_NOW之后,立即绑定,增加PT_GNU_RELRO段会设置相应范围为只读
//got[1]和got[0]都是0,这样ret2dl_resolve_runtime就不能用了
//为了避免增加新代码段,这里将DT_DEBUG段修改为DT_BIND_NOW (本策略只实现此步骤)
if (BinaryEditor::instance()->enableBindnow())
{
std::cout << "Modify DT_DEBUG to DT_BIND_NOW." << std::endl;
}
else
{
std::cout << "Not found DT_DEBUG." << std::endl;
}
}
| [
"fuchuangbob@163.com"
] | fuchuangbob@163.com |
1423a33c0676340a8c2301e729de9706dca3b6f7 | e182a7d0a29f77ad8a0a25d349a23e846977c65e | /src/main.cpp | 6acb04b7d98f82e2081dc1716f148c2c18cc82bd | [] | no_license | LostPointer/KeyValueTutorial | 78c8467d5913111e911c6055462dce89f226d867 | 68965165deb88a497ed058b15c1b136ff0adb64c | refs/heads/master | 2023-01-30T06:46:56.059320 | 2020-11-14T08:53:43 | 2020-11-14T08:53:43 | 306,182,928 | 1 | 1 | null | 2020-12-15T21:37:32 | 2020-10-22T00:44:55 | C++ | UTF-8 | C++ | false | false | 584 | cpp | #include <array>
#include <iostream>
#include <unordered_map>
#include "command.hpp"
#include "utils.hpp"
int main([[maybe_unused]] int argc, [[maybe_unused]] char const* argv[]) {
std::map<std::string, Value> storage;
while (true) {
try {
std::string buffer;
std::getline(std::cin, buffer);
auto command = command::MakeCommand(buffer);
auto result = command->Execute(storage);
std::cout << result.ToString() << std::endl;
} catch (const std::exception& e) {
std::cout << "Error: " << e.what() << std::endl;
}
}
return 0;
}
| [
"lostpointmeister@gmail.com"
] | lostpointmeister@gmail.com |
e36bc1aa2939139b0a051f0845dfd7c437942a43 | 6f36106d593c7d2ff51636ad0b0578f508cc3bdc | /scripts/c/ug871-design-files/Design_Optimization/lab2/matrixmul.h | 9e1d4fc799bdc06c5b61dbc33d660ee68bd2e26c | [] | no_license | A-suozhang/WhatIveRead | ec0c08865d3ea6459a75054ea531258f06cc49e6 | 4e6f61bf0879e3778b597bebf036a02878e07850 | refs/heads/master | 2021-12-15T03:57:06.480369 | 2021-11-29T10:49:00 | 2021-11-29T10:49:00 | 222,939,046 | 5 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,080 | h | /*******************************************************************************
Vendor: Xilinx
Associated Filename: matrixmul.h
Purpose: Vivado HLS tutorial example
Device: All
Revision History: March 1, 2013 - initial release
*******************************************************************************
Copyright 2008 - 2013 Xilinx, Inc. All rights reserved.
This file contains confidential and proprietary information of Xilinx, Inc. and
is protected under U.S. and international copyright and other intellectual
property laws.
DISCLAIMER
This disclaimer is not a license and does not grant any rights to the materials
distributed herewith. Except as otherwise provided in a valid license issued to
you by Xilinx, and to the maximum extent permitted by applicable law:
(1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL FAULTS, AND XILINX
HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, OR
FITNESS FOR ANY PARTICULAR PURPOSE; and (2) Xilinx shall not be liable (whether
in contract or tort, including negligence, or under any other theory of
liability) for any loss or damage of any kind or nature related to, arising under
or in connection with these materials, including for any direct, or any indirect,
special, incidental, or consequential loss or damage (including loss of data,
profits, goodwill, or any type of loss or damage suffered as a result of any
action brought by a third party) even if such damage or loss was reasonably
foreseeable or Xilinx had been advised of the possibility of the same.
CRITICAL APPLICATIONS
Xilinx products are not designed or intended to be fail-safe, or for use in any
application requiring fail-safe performance, such as life-support or safety
devices or systems, Class III medical devices, nuclear facilities, applications
related to the deployment of airbags, or any other applications that could lead
to death, personal injury, or severe property or environmental damage
(individually and collectively, "Critical Applications"). Customer asresultes the
sole risk and liability of any use of Xilinx products in Critical Applications,
subject only to applicable laws and regulations governing limitations on product
liability.
THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE AT
ALL TIMES.
*******************************************************************************/
#ifndef __MATRIXMUL_H__
#define __MATRIXMUL_H__
#include <cmath>
using namespace std;
// Compare TB vs HW C-model and/or RTL
#define HW_COSIM
#define MAT_A_ROWS 3
#define MAT_A_COLS 3
#define MAT_B_ROWS 3
#define MAT_B_COLS 3
typedef char mat_a_t;
typedef char mat_b_t;
typedef short result_t;
// Prototype of top level function for C-synthesis
void matrixmul(
mat_a_t a[MAT_A_ROWS][MAT_A_COLS],
mat_b_t b[MAT_B_ROWS][MAT_B_COLS],
result_t res[MAT_A_ROWS][MAT_B_COLS]);
#endif // __MATRIXMUL_H__ not defined
| [
"574596610@qq.com"
] | 574596610@qq.com |
2fc9b5bfb981543179e7bb0373e150b1bb25849c | a363b06ff115e7a7d3fd569072ebbee0349b9a2b | /Samples/MjgIntelFluidDemo_Part10/Space/uniformGridDiagnostics.cpp | 59ddbab143cf4ef10be40b7aa32ac92eac22e9db | [] | no_license | william-manning-levelex/VorteGrid | 2e90474b66a6ead25a5a44c68554e3e6e016dc6e | f99a4e17ab9cbd4ff6cc9fa37124c2bf7d6a88a4 | refs/heads/master | 2023-03-27T15:23:41.440257 | 2021-03-27T22:46:22 | 2021-03-27T22:46:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 21,657 | cpp | /*! \file uniformGridDiagnostics.cpp
\brief Diagnostic routines for UniformGrids of vectors or matrices
\see Accompanying articles for more information:
http://software.intel.com/en-us/articles/fluid-simulation-for-video-games-part-1/
http://software.intel.com/en-us/articles/fluid-simulation-for-video-games-part-2/
http://software.intel.com/en-us/articles/fluid-simulation-for-video-games-part-3/
http://software.intel.com/en-us/articles/fluid-simulation-for-video-games-part-4/
http://software.intel.com/en-us/articles/fluid-simulation-for-video-games-part-5/
http://software.intel.com/en-us/articles/fluid-simulation-for-video-games-part-6/
http://software.intel.com/en-us/articles/fluid-simulation-for-video-games-part-7/
http://software.intel.com/en-us/articles/fluid-simulation-for-video-games-part-8/
http://software.intel.com/en-us/articles/fluid-simulation-for-video-games-part-9/
http://software.intel.com/en-us/articles/fluid-simulation-for-video-games-part-10/
http://www.gamasutra.com/view/feature/4164/sponsored_feature_fluid_.php
http://www.gamasutra.com/view/feature/4176/sponsored_feature_fluid_.php
http://www.mijagourlay.com/
\author Copyright 2009-2010 Dr. Michael Jason Gourlay; All rights reserved.
*/
#include "Core/Math/mat33.h"
#include "uniformGrid.h"
#include "uniformGridMath.h"
/*! \brief Generate brick-of-bytes volumetric data file, for a scalar quantity
\param strFilenameBase - prefix of name of files to write.
This string precedes both data and script file names.
\param uFrame - frame number. Used to generate data filenames.
This routine also appends filenames to an OGLE script file named "<strFilenameBase>.ogle".
Example OGLE script file preamble which can make use of the files this routine generates:
\verbatim
windowSize: 512 512
Transform: { angles 270 0 0 }
#
dataView: Opacity_Renderer[0] subset.selected_var = 0
dataView: Opacity_Renderer[0] colormap.alpha = 0.5
dataView: Opacity_Renderer[0] colormap[0].type = COLORMAP_SPECTRUM
dataView: Opacity_Renderer[0] colormap[1].alpha = 0.6
dataView: Opacity_Renderer[0] colormap[2].alpha = 0.7
dataView: Opacity_Renderer[0] active = true
#
# Entries for various data sets:
#
# (Append contents of file generated by this routine.)
\endverbatim
*/
void UniformGrid<float>::GenerateBrickOfBytes( const char * strFilenameBase , unsigned uFrame ) const
{
#if ! defined( _XBOX )
// Compute min, max values of values.
float fMin=FLT_MAX, fMax=-fMin ;
ComputeStatistics( fMin , fMax ) ;
#if ENFORCE_SYMMETRIC_RANGE
const float fExtreme = MAX2( -fMin , fMax ) ;
fMax = fExtreme ;
fMin = - fMax ;
#endif
const float fRange = MAX2( fMax - fMin , FLT_MIN ) ; // FLT_MIN is to avoid divide-by-zero below.
// Create name of data file.
char strDataFilename[ 256 ] ;
sprintf( strDataFilename , "Vols/%s%05u-%ux%ux%u.dat" , strFilenameBase , uFrame , GetNumPoints( 0 ) , GetNumPoints( 1 ) , GetNumPoints( 2 ) ) ;
{
// Append data filename to script file.
char strScriptFilename[ 256 ] ;
sprintf( strScriptFilename , "%s.ogle" , strFilenameBase ) ;
FILE * pScriptFile = fopen( strScriptFilename , "a" ) ;
if( ! pScriptFile ) { return ; }
// Write comment to script file indicating vector value ranges
fprintf( pScriptFile , "# %s ranges: %9.7g to %9.7g\n" , strFilenameBase , fMin , fMax ) ;
// Write to script file, names of vector component data files.
fprintf( pScriptFile , "%ux%ux%u %s\n" , GetNumPoints( 0 ) , GetNumPoints( 1 ) , GetNumPoints( 2 ) , strDataFilename ) ;
fclose( pScriptFile ) ;
}
// Open and populate data file.
FILE * pDataFile ;
pDataFile = fopen( strDataFilename , "wb" ) ;
if( ! pDataFile ) { return ; }
static const float fAlmost256 = 256.0f * ( 1.0f - FLT_EPSILON ) ;
const size_t numGridPoints = Size() ;
for( size_t offset = 0 ; offset < numGridPoints ; ++ offset )
{
const float & rVal = (*this)[ offset ] ;
const float fShifted = rVal - fMin ;
const float f0to1 = fShifted / fRange ;
const float f0to255 = f0to1 * fAlmost256 ;
const int iVal = int( f0to255 ) ;
unsigned char cVal = unsigned char( iVal ) ;
fwrite( & cVal , 1 , 1 , pDataFile ) ;
}
// Write minimum and maximum values.
// Without this, OGLE will interpret the value to be unsigned.
fprintf( pDataFile , "MIN %g MAX %g\n" , fMin , fMax ) ;
// Close data file.
fclose( pDataFile ) ;
#endif
}
/*! \brief Compute statistics of data in a uniform grid of 3-vectors
\param min - minimum of all values in grid.
\param max - maximum of all values in grid.
*/
void UniformGrid<Vec3>::ComputeStatistics( Vec3 & min , Vec3 & max ) const
{
min = Vec3( FLT_MAX , FLT_MAX , FLT_MAX ) ;
max = Vec3( -min ) ;
const unsigned dims[3] = { GetNumPoints( 0 ) , GetNumPoints( 1 ) , GetNumPoints( 2 ) } ;
const unsigned numXY = dims[0] * dims[1] ;
unsigned index[3] ;
for( index[2] = 0 ; index[2] < dims[2] ; ++ index[2] )
{
const unsigned offsetPartialZ = numXY * index[2] ;
for( index[1] = 0 ; index[1] < dims[1] ; ++ index[1] )
{
const unsigned offsetPartialYZ = dims[ 0 ] * index[1] + offsetPartialZ ;
for( index[0] = 0 ; index[0] < dims[0] ; ++ index[0] )
{
const unsigned offset = index[0] + offsetPartialYZ ;
const Vec3 & rVal = (*this)[ offset ] ;
min.x = MIN2( min.x , rVal.x ) ;
min.y = MIN2( min.y , rVal.y ) ;
min.z = MIN2( min.z , rVal.z ) ;
max.x = MAX2( max.x , rVal.x ) ;
max.y = MAX2( max.y , rVal.y ) ;
max.z = MAX2( max.z , rVal.z ) ;
}
}
}
}
/*! \brief Generate brick-of-bytes volumetric data files, one per component of vector and another for magnitude.
\param strFilenameBase - prefix of name of file to write
\param uFrame - frame number. Used to generate filenames.
This routine also appends filenames to an OGLE script file.
Example OGLE script file which can make use of the files this routine generates:
\verbatim
windowSize: 512 512
Transform: { angles 270 0 0 }
#
dataView: Streamline[0] subset.x_range = 31 32 4
dataView: Streamline[0] subset.y_range = 54 57 4
dataView: Streamline[0] subset.z_range = 7 10 4
dataView: Streamline[0] colormap.type = COLORMAP_SPECTRUM
dataView: Streamline[0] criterion = STREAMLINE_CRITERION_ALL
dataView: Streamline[0] decimation = 5
dataView: Streamline[0] active = true
#
dataView: Vector_Field subset.selected_var = 0
dataView: Vector_Field subset.x_stride = 2
dataView: Vector_Field subset.y_stride = 2
dataView: Vector_Field subset.z_stride = 2
dataView: Vector_Field colormap.type = COLORMAP_HOT_COLD
dataView: Vector_Field vector_glyph = HEDGEHOG_VECTOR_CONES_SOLID_LIT
dataView: Vector_Field active = true
#
dataView: Opacity_Renderer[0] subset.selected_var = -1
dataView: Opacity_Renderer[0] colormap.alpha = 0.5
dataView: Opacity_Renderer[0] colormap[0].type = COLORMAP_SPECTRUM
dataView: Opacity_Renderer[0] colormap[1].alpha = 0.6
dataView: Opacity_Renderer[0] colormap[2].alpha = 0.7
dataView: Opacity_Renderer[0] active = true
#
# Entries for various data sets:
#
# (Append contents of file generated by this routine.)
\endverbatim
*/
void UniformGrid<Vec3>::GenerateBrickOfBytes( const char * strFilenameBase , unsigned uFrame ) const
{
#if ! defined( _XBOX )
// Compute min, max values of vector components.
Vec3 vMin , vMax ;
ComputeStatistics( vMin , vMax ) ;
Vec3 vExtreme( MAX2( -vMin.x , vMax.x ) , MAX2( -vMin.y , vMax.y ) , MAX2( -vMin.z , vMax.z ) ) ;
const float fMagMax = vExtreme.Magnitude() ; // Not the correct value for |v|_max but a reasonable approximation for visualization purposes.
#if ENFORCE_SYMMETRIC_RANGE
vMax = vExtreme ;
vMin = - vMax ;
#endif
Vec3 vRange( vMax - vMin ) ;
vRange.x = MAX2( FLT_MIN , vRange.x ) ; // Avoid divide-by-zero below
vRange.y = MAX2( FLT_MIN , vRange.y ) ; // Avoid divide-by-zero below
vRange.z = MAX2( FLT_MIN , vRange.z ) ; // Avoid divide-by-zero below
// Create names of data files.
char strDataFilenames[4][ 256 ] ;
sprintf( strDataFilenames[0] , "Vols/%sX%05u-%ux%ux%u.dat" , strFilenameBase , uFrame , GetNumPoints( 0 ) , GetNumPoints( 1 ) , GetNumPoints( 2 ) ) ;
sprintf( strDataFilenames[1] , "Vols/%sY%05u-%ux%ux%u.dat" , strFilenameBase , uFrame , GetNumPoints( 0 ) , GetNumPoints( 1 ) , GetNumPoints( 2 ) ) ;
sprintf( strDataFilenames[2] , "Vols/%sZ%05u-%ux%ux%u.dat" , strFilenameBase , uFrame , GetNumPoints( 0 ) , GetNumPoints( 1 ) , GetNumPoints( 2 ) ) ;
sprintf( strDataFilenames[3] , "Vols/%sM%05u-%ux%ux%u.dat" , strFilenameBase , uFrame , GetNumPoints( 0 ) , GetNumPoints( 1 ) , GetNumPoints( 2 ) ) ;
{
// Append data filenames to script file.
char strScriptFilename[ 256 ] ;
sprintf( strScriptFilename , "%s.ogle" , strFilenameBase ) ;
FILE * pScriptFile = fopen( strScriptFilename , "a" ) ;
// Write comment to script file indicating vector value ranges
fprintf( pScriptFile , "# %s ranges: {%9.7g,%9.7g,%9.7g} to {%9.7g,%9.7g,%9.7g}\n" , strFilenameBase , vMin.x , vMin.y , vMin.z , vMax.x , vMax.y , vMax.z ) ;
// Write to script file, names of vector component data files.
fprintf( pScriptFile , "%ux%ux%u %s %s %s\n" , GetNumPoints( 0 ) , GetNumPoints( 1 ) , GetNumPoints( 2 ) , strDataFilenames[0] , strDataFilenames[1] , strDataFilenames[2] ) ;
// Write to script file, name of magnitude data file.
// fprintf( pScriptFile , "%ux%ux%u %s\n" , GetNumPoints( 0 ) , GetNumPoints( 1 ) , GetNumPoints( 2 ) , strDataFilenames[3] ) ;
fclose( pScriptFile ) ;
}
// Open and populate data files.
FILE * pDataFiles[4] ;
pDataFiles[0] = fopen( strDataFilenames[0] , "wb" ) ;
pDataFiles[1] = fopen( strDataFilenames[1] , "wb" ) ;
pDataFiles[2] = fopen( strDataFilenames[2] , "wb" ) ;
pDataFiles[3] = fopen( strDataFilenames[3] , "wb" ) ;
if( ! pDataFiles[0] ) { return ; } // If this fails, inspect the filenames and check to see whether the subdirectory exists.
if( ! pDataFiles[1] ) { return ; }
if( ! pDataFiles[2] ) { return ; }
if( ! pDataFiles[3] ) { return ; }
static const float fAlmost256 = 256.0f * ( 1.0f - FLT_EPSILON ) ;
const size_t numGridPoints = Size() ;
for( size_t offset = 0 ; offset < numGridPoints ; ++ offset )
{
const Vec3 & rVec = (*this)[ offset ] ;
const float fMag = rVec.Magnitude() ;
const Vec3 vShifted = rVec - vMin ;
const Vec3 v0to1 = Vec3( vShifted.x / vRange.x , vShifted.y / vRange.y , vShifted.z / vRange.z ) ;
const Vec3 v0to255 = v0to1 * fAlmost256 ;
const float vMag0to255 = fAlmost256 * fMag / ( fMagMax + FLT_MIN ) ;
//printf( "vF %3g %3g %3g %3g %3g\n", v0to255.x , v0to255.y , v0to255.z , vMag0to255 ) ;
int iVec[4] = { int( v0to255.x ) , int( v0to255.y ) , int( v0to255.z ) , int( vMag0to255 ) } ;
#if ENFORCE_SYMMETRIC_RANGE
#endif
//printf( "vI %3i %3i %3i %3i\n", iVec[0] , iVec[1] , iVec[2] , iVec[3] ) ;
unsigned char cVec[4] = { unsigned char( iVec[0] ) , unsigned char( iVec[1] ) , unsigned char( iVec[2] ) , unsigned char( iVec[3] ) } ;
fwrite( & cVec[0] , 1 , 1 , pDataFiles[0] ) ;
fwrite( & cVec[1] , 1 , 1 , pDataFiles[1] ) ;
fwrite( & cVec[2] , 1 , 1 , pDataFiles[2] ) ;
fwrite( & cVec[3] , 1 , 1 , pDataFiles[3] ) ;
//printf( "vC %3u %3u %3u %3u\n", cVec[0] , cVec[1] , cVec[2] , cVec[3] ) ;
}
// Write minimum and maximum values for each component.
// Without this, OGLE will interpret the value to be signed, when used with hedgehog and streamline dataviews.
fprintf( pDataFiles[0] , "MIN %g MAX %g\n" , vMin.x , vMax.x ) ;
fprintf( pDataFiles[1] , "MIN %g MAX %g\n" , vMin.y , vMax.y ) ;
fprintf( pDataFiles[2] , "MIN %g MAX %g\n" , vMin.z , vMax.z ) ;
fprintf( pDataFiles[3] , "MIN %g MAX %g\n" , 0 , fMagMax ) ;
// Close data files.
fclose( pDataFiles[0] ) ;
fclose( pDataFiles[1] ) ;
fclose( pDataFiles[2] ) ;
fclose( pDataFiles[3] ) ;
#endif
}
inline float testFunc1D( float x ) { return x * ( 4.0f - x * 4.0f ) ; }
inline float testFunc2D( float x , float y ) { return testFunc1D( x ) * testFunc1D( y ) ; }
inline float testFunc3D( float x , float y , float z ) { return testFunc2D( x , y ) * testFunc1D( z ) ; }
/* static */ void UniformGrid<unsigned>::UnitTest( void )
{
}
// --------------------------
// Tests below assume grid spacing h==1/N+1 (i.e. there are NUM_PTS cells/intervals).
static const unsigned NX = 64 ;
static const unsigned NY = 16 ;
static const float h[2] = { 1.0f / float( NX - 1 ) , 1.0f / float( NY - 1 ) } ;
static const float h2[2] = { h[0] * h[0] , h[1] * h[1] } ;
static const float oneOverH2[2] = { 1.0f / h2[0] , 1.0f / h2[1] } ;
static const float halfH2Sum = 0.5f / ( oneOverH2[0] + oneOverH2[1] ) ;
inline float X( int i ) { return float( i ) * h[0] ; }
inline float Y( int i ) { return float( i ) * h[1] ; }
void ComputeLaplacian1D( float laplacian[ NX ] , const float func[ NX ] )
{
for( unsigned i = 1 ; i < NX - 1 ; ++ i )
{
laplacian[ i ] = ( func[ i+1 ] + func[ i-1 ] - 2.0f * func[ i ] ) * oneOverH2[0] ;
}
#if 1
// Use Dirichlet boundary conditions:
// Assume func[boundary]==0.
laplacian[ 0 ] = ( func[ 1 ] - 2.0f * func[ 0 ] ) * oneOverH2[0] ;
laplacian[ NX - 1 ] = ( func[ NX - 2 ] - 2.0f * func[ NX - 1 ] ) * oneOverH2[0] ;
#elif 0
// Use Neumann-ish boundary conditions:
// -1 instead of -2 because we assume func[i]==func[boundary].
laplacian[ 0 ] = ( func[ 1 ] - 1.0f * func[ 0 ] ) * oneOverH2[0] ;
laplacian[ NX - 1 ] = ( func[ NX - 2 ] - 1.0f * func[ NX - 1 ] ) * oneOverH2[0] ;
#else
laplacian[ 0 ] = laplacian[ 1 ] ;
laplacian[ NX - 1 ] = laplacian[ NX - 2 ] ;
#endif
}
void ComputeLaplacian2D( float laplacian[ NY ][ NX ] , const float func[ NY ][ NX ] )
{
for( unsigned j = 1 ; j < NY - 1 ; ++ j )
{
for( unsigned i = 1 ; i < NX - 1 ; ++ i )
{
laplacian[ j ][ i ] = ( func[ j ][ i+1 ] + func[ j ][ i-1 ] - 2.0f * func[ j ][ i ] ) * oneOverH2[0]
+ ( func[ j+1 ][ i ] + func[ j-1 ][ i ] - 2.0f * func[ j ][ i ] ) * oneOverH2[1]
;
}
}
#if 1
// Use Dirichlet boundary conditions:
// Assume func[boundary]==0.
for( unsigned i = 0 ; i < NX ; ++ i )
{
laplacian[ 0 ][i] = ( func[ 1 ][i] - 2.0f * func[ 0 ][i] ) * oneOverH2[1] ;
laplacian[ NY - 1 ][i] = ( func[ NY - 2 ][i] - 2.0f * func[ NY - 1 ][i] ) * oneOverH2[1] ;
}
for( unsigned j = 0 ; j < NY ; ++ j )
{
laplacian[j][ 0 ] = ( func[j][ 1 ] - 2.0f * func[j][ 0 ] ) * oneOverH2[0] ;
laplacian[j][ NX - 1 ] = ( func[j][ NX - 2 ] - 2.0f * func[j][ NX - 1 ] ) * oneOverH2[0] ;
}
#elif 0
// Use Neumann-ish boundary conditions:
// -1 instead of -2 because we assume func[i]==func[boundary].
laplacian[ 0 ] = ( func[ 1 ] - 1.0f * func[ 0 ] ) * oneOverH2[0] ;
laplacian[ NX - 1 ] = ( func[ NX - 2 ] - 1.0f * func[ NX - 1 ] ) * oneOverH2[0] ;
#else
// "Gourlay" boundaries: second derivative is constant.
for( unsigned i = 0 ; i < NX ; ++ i )
{
laplacian[ 0 ][ i ] = laplacian[ 1 ][ i ] ;
laplacian[ NY - 1 ][ i ] = laplacian[ NY - 2 ][ i ] ;
}
for( unsigned j = 0 ; j < NY ; ++ j )
{
laplacian[ j ][ 0 ] = laplacian[ j ][ 1 ] ;
laplacian[ j ][ NX - 1 ] = laplacian[ j ][ NX - 2 ] ;
}
#endif
}
void SolvePoisson1D( float solution[ NX ] , const float laplacian[ NX ] )
{
for( unsigned i = 1 ; i < NX - 1 ; ++ i )
{
// solution[ i ] = ( solution[ i+1 ] + solution[ i-1 ] ) * oneOverH2[0] - laplacian[ i ] ) * 0.5f * h2[0] ;
solution[ i ] = ( solution[ i+1 ] + solution[ i-1 ] - laplacian[ i ] * h2[0] ) * 0.5f ;
}
}
void SolvePoisson2D( float solution[ NY ][ NX ] , const float laplacian[ NY ][ NX ] )
{
for( unsigned j = 1 ; j < NY - 1 ; ++ j )
{
for( unsigned i = 1 ; i < NX - 1 ; ++ i )
{
solution[ j ][ i ] = ( ( solution[ j ][ i+1 ] + solution[ j ][ i-1 ] ) * oneOverH2[0]
+ ( solution[ j+1 ][ i ] + solution[ j-1 ][ i ] ) * oneOverH2[1]
- laplacian[ j ][ i ]
) * halfH2Sum
;
}
}
}
void PrintFunc1D( const float func[ NX ] , const char * filename )
{
FILE * fp = fopen( filename , "w" ) ;
for( unsigned i = 0 ; i < NX ; ++ i )
{
fprintf( fp , "%g\t%g\n" , X( i ) , func[ i ] ) ;
}
fclose( fp ) ;
}
void PrintFunc2D( const float func[ NY ][ NX ] , const char * filename )
{
FILE * fp = fopen( filename , "w" ) ;
#define EXCEL_STYLE 1
#if EXCEL_STYLE
fprintf( fp , "\t" ) ;
for( unsigned i = 0 ; i < NX ; ++ i )
{
fprintf( fp , "%g\t" , X( i ) ) ;
}
fprintf( fp , "\n" ) ;
#endif
for( unsigned j = 0 ; j < NY ; ++ j )
{
#if EXCEL_STYLE
fprintf( fp , "%g\t" , Y( j ) ) ;
#endif
for( unsigned i = 0 ; i < NX ; ++ i )
{
#if EXCEL_STYLE
fprintf( fp , "%g\t" , func[ j ][ i ] ) ;
#else
fprintf( fp , "%g\t%g\t%g\n" , X( i ) , Y( i ) , func[ j ][ i ] ) ;
#endif
}
#if EXCEL_STYLE
fprintf( fp , "\n" ) ;
#endif
}
fclose( fp ) ;
}
void UniformGrid_AssignTestValues( UniformGrid<Vec3> & ugv3 )
{
unsigned idx[3] ; // Grid cell indices.
for( idx[2] = 0 ; idx[2] < ugv3.GetNumPoints( 2 ) ; ++ idx[2] )
{ // For each point along z axis...
Vec3 vPos ; // Position of point within UniformGrid.
Vec3 vParam ; // Parametric coordinate of vPosition
vParam.z = float( idx[2] ) / float( ugv3.GetNumCells(2) ) ;
vPos.z = ugv3.GetMinCorner().z + float( idx[2] ) * ugv3.GetCellSpacing().z ;
for( idx[1] = 0 ; idx[1] < ugv3.GetNumPoints( 1 ) ; ++ idx[1] )
{ // For each point along y axis...
vParam.y = float( idx[1] ) / float( ugv3.GetNumCells(1) ) ;
vPos.y = ugv3.GetMinCorner().y + float( idx[1] ) * ugv3.GetCellSpacing().y ;
for( idx[0] = 0 ; idx[0] < ugv3.GetNumPoints( 0 ) ; ++ idx[0] )
{ // For each point along x axis...
vParam.x = float( idx[0] ) / float( ugv3.GetNumCells(0) ) ;
vPos.x = ugv3.GetMinCorner().x + float( idx[0] ) * ugv3.GetCellSpacing().x ;
const Vec3 funcVal( testFunc1D( vParam.x )
, testFunc2D( vParam.x , vParam.y )
, testFunc3D( vParam.x , vParam.y , vParam.z )
);
ugv3[ idx ] = funcVal ;
}
}
}
}
void UnitTestPoisson1D( void )
{
float func[ NX ] ;
for( unsigned i = 0 ; i < NX ; ++ i )
{
func[ i ] = testFunc1D( X( i ) ) ; // effectively, func( x ) = x^2
}
PrintFunc1D( func , "func.dat" ) ;
float laplacian[ NX ] ;
ComputeLaplacian1D( laplacian , func ) ;
PrintFunc1D( laplacian , "laplacian.dat" ) ;
float funcSolved[ NX ] ;
for( unsigned i = 0 ; i < NX ; ++ i )
{
funcSolved[ i ] = 0.0f ; // Initialize the trial solution
}
for( unsigned iter = 0 ; iter < NX * NX ; ++ iter )
{
//char filename[ 256 ] ;
//sprintf( filename , "funcSoln%04i.dat" , iter ) ;
//PrintFunc1D( funcSolved , filename ) ;
SolvePoisson1D( funcSolved , laplacian ) ;
}
PrintFunc1D( funcSolved , "funcSoln.dat" ) ;
}
void UnitTestPoisson2D( void )
{
float func[ NY ][ NX ] ;
for( unsigned j = 0 ; j < NY ; ++ j )
{
for( unsigned i = 0 ; i < NX ; ++ i )
{
func[ j ][ i ] = testFunc2D( X( i ) , Y( j ) ) ;
}
}
PrintFunc2D( func , "func2d.dat" ) ;
float laplacian[ NY ][ NX ] ;
ComputeLaplacian2D( laplacian , func ) ;
PrintFunc2D( laplacian , "laplacian2.dat" ) ;
float funcSolved[ NY ][ NX ] ;
for( unsigned j = 0 ; j < NY ; ++ j )
{
for( unsigned i = 0 ; i < NX ; ++ i )
{
funcSolved[ j ][ i ] = 0.0f ; // Initialize the trial solution
}
}
for( unsigned iter = 0 ; iter < NX * NY ; ++ iter )
{
//char filename[ 256 ] ;
//sprintf( filename , "funcSoln%04i.dat" , iter ) ;
//PrintFunc2D( funcSolved , filename ) ;
SolvePoisson2D( funcSolved , laplacian ) ;
}
PrintFunc2D( funcSolved , "funcSoln2.dat" ) ;
}
| [
"github@mijagourlay.com"
] | github@mijagourlay.com |
58cce3b86ebe648eefd51f2cc7199acc87615962 | 35ff30ffc49eae17bdf7c1fbd34aa41eff6ab168 | /Label.cpp | a9cc822f5897522a9acc84a2c018ff872093c4b1 | [] | no_license | aadarshasubedi/ZurichTowerDefense | f3cd871863d9ef84bfa61402d5407557f094cb68 | 4ed6eeeb9bc49ddbab97d4db4c27a8dbbcabcb08 | refs/heads/master | 2021-01-17T22:58:06.582476 | 2015-10-04T20:39:31 | 2015-10-04T20:39:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 670 | cpp | #include "Label.h"
#include "Utility.h"
#include <SFML/Graphics/RenderStates.hpp>
#include <SFML/Graphics/RenderTarget.hpp>
namespace GUI
{
Label::Label(const std::string& text, const FontHolder& fonts)
: mText(text, fonts.get(Fonts::Main), 16)
{
}
bool Label::isSelectable() const
{
return false;
}
void Label::handleEvent(const sf::Event&)
{
}
void Label::draw(sf::RenderTarget& target, sf::RenderStates states) const
{
states.transform *= getTransform();
target.draw(mText, states);
}
void Label::setText(const std::string& text)
{
mText.setString(text);
}
} | [
"garrettschmidt@onlymyemail.com"
] | garrettschmidt@onlymyemail.com |
3c2ac023050a6780f30a3c580323b118e405709c | 44a00da3b7ae2915ad25ca37849ee18da5f49b43 | /src/gui/object/MenuItemHolderManager.cpp | fd07174fca24caa860e8c7c79fd9d8935c045227 | [] | no_license | WilfSilver/TheMazeGame | c7508cc1661ce26be12366132c799d25692162ea | b100a81ee5494e7839c5481c1096ceef90450cf7 | refs/heads/master | 2023-04-17T21:07:10.194741 | 2021-05-04T17:41:24 | 2021-05-04T17:41:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,255 | cpp | #include "MenuItemHolderManager.h"
// #include <algorithm>
#include "Application.h"
#include "Log.h"
#include "event/Event.h"
#include "layer/GUILayer.h"
#include "rendering/Renderer.h"
#include "ItemContainer.h"
#include "WeaponContainer.h"
#include "layer/MessageManager.h"
#include "event/game/ChestOpened.h"
#include "event/input/Mouse.h"
#include "event/menu/Transfer.h"
#include "event/menu/WindowResize.h"
MIHManager::MIHManager(float x, float y, float width, float height, float blockSize, Layer *layer, std::function<void(int)> clickedFunc, IContainer *items, int *activeItem)
: MenuObject(x, y, width, height, layer),
m_BlockSize(blockSize),
m_Items(items),
m_ActiveItem(activeItem),
m_ClickedFunc(clickedFunc),
m_BackgroundColour({0.6f, 0.6f, 0.6f, 1.0f}),
m_BorderColour({0.0f, 0.0f, 0.0f, 1.0f}),
m_HoverBorderColour({0.0f, 1.0f, 0.0f, 1.0f}),
m_ActiveBorderColour({1.0f, 0.0f, 0.0f, 1.0f}),
m_ListenType(IContainer::Type::None)
{
}
MIHManager::MIHManager(std::function<void(float *, float *, float *, float *)> posFunc, float blockSize, Layer *layer, std::function<void(int)> clickedFunc, IContainer *items, int *activeItem)
: MenuObject(posFunc, layer),
m_BlockSize(blockSize),
m_Items(items),
m_ActiveItem(activeItem),
m_ClickedFunc(clickedFunc),
m_BackgroundColour({0.6f, 0.6f, 0.6f, 1.0f}),
m_BorderColour({0.0f, 0.0f, 0.0f, 1.0f}),
m_HoverBorderColour({0.0f, 1.0f, 0.0f, 1.0f}),
m_ActiveBorderColour({1.0f, 0.0f, 0.0f, 1.0f}),
m_ListenType(IContainer::Type::None)
{
}
MIHManager::MIHManager(std::function<void(float *, float *, float *, float *)> posFunc, float blockSize, Layer *layer, std::function<void(int)> clickedFunc, IContainer::Type type)
: MenuObject(posFunc, layer),
m_BlockSize(blockSize),
m_Items(nullptr),
m_ActiveItem(nullptr),
m_ClickedFunc(clickedFunc),
m_BackgroundColour({0.6f, 0.6f, 0.6f, 1.0f}),
m_BorderColour({0.0f, 0.0f, 0.0f, 1.0f}),
m_HoverBorderColour({0.0f, 1.0f, 0.0f, 1.0f}),
m_ActiveBorderColour({1.0f, 0.0f, 0.0f, 1.0f}),
m_ListenType(type)
{
}
MIHManager::MIHManager(float x, float y, float width, float height, float blockSize, Layer *layer, glm::vec4 backgroundColour, glm::vec4 borderColour, glm::vec4 hoverColour, glm::vec4 activeColour, std::function<void(int)> clickedFunc, IContainer *items, int *activeItem)
: MenuObject(x, y, width, height, layer),
m_BlockSize(blockSize),
m_Items(items),
m_ActiveItem(activeItem),
m_ClickedFunc(clickedFunc),
m_BackgroundColour(backgroundColour),
m_BorderColour(borderColour),
m_HoverBorderColour(hoverColour),
m_ActiveBorderColour(activeColour),
m_ListenType(IContainer::Type::None)
{
}
MIHManager::MIHManager(std::function<void(float *, float *, float *, float *)> posFunc, float blockSize, Layer *layer, glm::vec4 backgroundColour, glm::vec4 borderColour, glm::vec4 hoverColour, glm::vec4 activeColour, std::function<void(int)> clickedFunc, IContainer *items, int *activeItem)
: MenuObject(posFunc, layer),
m_BlockSize(blockSize),
m_Items(items),
m_ActiveItem(activeItem),
m_ClickedFunc(clickedFunc),
m_BackgroundColour(backgroundColour),
m_BorderColour(borderColour),
m_HoverBorderColour(hoverColour),
m_ActiveBorderColour(activeColour),
m_ListenType(IContainer::Type::None)
{
}
MIHManager::~MIHManager()
{
// NOTE: m_Items is a reference to something stored elsewhere, same with m_ActiveItem so they shouldn't be deleted here
}
void MIHManager::render()
{
// If the container is not a nullptr it will render
if(m_Items)
{
// Gets the width and height of the grid created
int gridWidth = (int) round(width / getScaledBlockSize());
int gridHeight = (int) round(height / getScaledBlockSize());
uint8_t layer = 7;
// If the mouse is hovering over the MIHM then it will get the index of the block it is hovering over
int mouseHoverBlock = -1;
if(m_State == Button::State::Hover)
mouseHoverBlock = getIndexMouseAt();
// Goes through the grid width and height and renders each block
for(int posY = 0; posY < gridHeight; posY++)
{
for(int posX = 0; posX < gridWidth; posX++)
{
int i = posX + posY * gridWidth;
// Gets the postion of the block
float nextX = getScaledBlockSize() / 2 + x + posX * getScaledBlockSize();
float nextY = getScaledBlockSize() / 2 + y - posY * getScaledBlockSize();
float borderWidth = 2.0f;
// Checks what type of block this is
if(i < m_Items->size() && i == mouseHoverBlock)
{
// If it is the block the mouse is hovering over and has an item in it it will render a square with the hover border colour
borderWidth += 1.0f;
Render::rectangle(nextX, nextY, getScaledBlockSize(), getScaledBlockSize(), m_BackgroundColour, borderWidth, m_HoverBorderColour, layer, true, true);
// It will also render text over the block with the item name
float scale = 35.0f * Application::getGUIScale();
Vec2f mousePos = Event::getMousePos();
Render::hoverText(*m_Items->getItem(i)->getName(), mousePos.x, mousePos.y, scale, {1.0f, 1.0f, 1.0f, 1.0f}, {0.3f, 0.3f, 0.3f, 0.7f}, layer + 2, true);
}
else if(m_ActiveItem && i == *m_ActiveItem)
{
// If it is the active block then it will render a square with current active border colour
borderWidth += 3.0f;
Render::rectangle(nextX, nextY, getScaledBlockSize(), getScaledBlockSize(), m_BackgroundColour, borderWidth, m_ActiveBorderColour, layer, true, true);
}
else
Render::rectangle(nextX, nextY, getScaledBlockSize(), getScaledBlockSize(), m_BackgroundColour, borderWidth, m_BorderColour, layer, true, true);
// If there is an item stored in the block then it will render the item inside (NOTE: It will be rendered at a slightly smaller size)
if(i < m_Items->size())
m_Items->getItem(i)->render(nextX, nextY, 0.0f, getScaledBlockSize() - 10.0f * Application::getGUIScale(), layer + 1, true);
}
}
}
}
void MIHManager::update()
{
// If the active item is greater than the size of items then it will be updated
if(m_ActiveItem && (*m_ActiveItem) >= m_Items->size())
(*m_ActiveItem)--;
// Updates the state
Vec2f mousePos = Event::getMousePos();
if(mousePos.x > x && mousePos.x < x + width && mousePos.y < y + getScaledBlockSize() && mousePos.y > y + getScaledBlockSize() - height)
m_State = Button::State::Hover;
else
m_State = Button::State::None;
}
bool MIHManager::eventCallback(const Event::Event &e)
{
switch(e.getType())
{
case Event::EventType::MouseClicked:
{
if(!m_Items)
return false;
// If there is a mouse clicked event it will find the block clicked
const Event::MouseClickedEvent &ne = static_cast<const Event::MouseClickedEvent &>(e);
Vec2f mousePos = ne.pos;
int hoverBlock = getIndexMouseAt();
if(hoverBlock != -1 && ne.action == Event::Action::Press)
{
switch(ne.button)
{
case Event::MouseButton::RightButton:
{
// If there was a right click it will call the clicked function
m_State = Button::State::Press;
GUILayer *layer = dynamic_cast<GUILayer *>(m_Layer);
if(layer && hoverBlock < m_Items->size())
m_ClickedFunc(hoverBlock);
return true;
}
case Event::MouseButton::LeftButton:
{
// If a left click has occurred it will call an item transfer event
if(hoverBlock < m_Items->size())
{
Event::ItemTransferEvent e(hoverBlock, m_Items);
Application::callEvent(e, Event::CallType::Overlay);
}
return true;
}
default:
break;
}
}
return false;
}
case Event::EventType::ChestOpened:
{
// If a chest has been opened it will check its listening type is equal to the container type
const Event::ChestOpenedEvent &ne = static_cast<const Event::ChestOpenedEvent &>(e);
if(m_ListenType == ne.container->getType())
{
// Updates the items and active item
m_Items = ne.container;
m_ActiveItem = ne.activeItem;
return true;
}
return false;
}
default:
return MenuObject::eventCallback(e);
}
}
int MIHManager::getIndexMouseAt()
{
// Checks the mouse is hovering over the MIHM
if(m_State == Button::State::Hover)
{
Vec2f mousePos = Event::getMousePos();
// Gets the grid position the mouse is at
int mouseGridX = (int) (mousePos.x - x) / getScaledBlockSize();
int mouseGridY = (int) -(mousePos.y - (y + getScaledBlockSize())) / getScaledBlockSize();
int gridWidth = (int) round(width / getScaledBlockSize());
int gridHeight = (int) round(height / getScaledBlockSize());
// Checks the hover block is in the range
int mouseHoverBlock = mouseGridX + mouseGridY * gridWidth;
if(mouseHoverBlock < 0 || mouseHoverBlock >= gridWidth * gridHeight)
return -1;
return mouseHoverBlock;
}
return -1;
}
void MIHManager::transferItem(TransferObject *o)
{
// Gets the block the mouse is hovering over
int hoverBox = getIndexMouseAt();
if(hoverBox != -1)
{
// Determines if it needs to swap an item
bool swap = hoverBox < m_Items->size();
IContainer *oContainer = o->getContainer();
int oIndex = o->getIndex();
// Determines whether it is possible to move the item (taking into account the types of the containers and items)
bool cancel = false;
{
Weapon *oWeapon = dynamic_cast<Weapon *>(oContainer->getItem(oIndex));
cancel = m_Items->getType() == IContainer::Type::Weapon && !oWeapon;
}
// If it is wapping it checks the type of its container and item
if(swap)
{
Weapon *mWeapon = dynamic_cast<Weapon *>(m_Items->getItem(hoverBox));
cancel = cancel || (oContainer->getType() == IContainer::Type::Weapon && !mWeapon);
}
// If an item cannot be stored it will send a message to the user saying it cannot be stored there
if(cancel)
{
MessageManager::sendMessage("Item cannot be stored there!", MessageManager::Priority::High);
return;
}
// If the containers are different or it is swapping it will transfer
if(oContainer != m_Items || swap)
{
// Function for inserting an item to the correct position correctly
auto insertItem = [swap](IContainer *container, Item *item, int index) {
switch(container->getType())
{
case IContainer::Type::Item:
{
ItemContainer *itemContainer = static_cast<ItemContainer *>(container);
if(item == nullptr)
{
// If the item is a nullptr then it will just erase the item at that index
itemContainer->erase(itemContainer->begin() + index);
break;
}
if(swap)
{
// Will erase the item in the index
itemContainer->erase(itemContainer->begin() + index);
// Will erase insert the item at that index
itemContainer->insert(itemContainer->begin() + index, item);
}
else
itemContainer->push_back(item);
break;
}
case IContainer::Type::Weapon:
{
// Same as above just with a weapon container instead
WeaponContainer *weaponContainer = static_cast<WeaponContainer *>(container);
if(item == nullptr)
{
weaponContainer->erase(weaponContainer->begin() + index);
break;
}
Weapon *weapon = static_cast<Weapon *>(item);
if(swap)
{
weaponContainer->erase(weaponContainer->begin() + index);
weaponContainer->insert(weaponContainer->begin() + index, weapon);
}
else
weaponContainer->push_back(weapon);
break;
}
default:
Log::warning("Unknown container type!");
break;
}
};
o->hasTransferred(); // Tells the transfer object that it has transfer so it can render the items again
// Gets the other item
Item *oItem = oContainer->getItem(oIndex);
Item *mItem = nullptr; // Will be nullptr unless it is swapping
if(swap)
mItem = m_Items->getItem(hoverBox);
// Inserts both the items at the given position
insertItem(m_Items, oItem, hoverBox);
insertItem(oContainer, mItem, oIndex);
// Will update the active item if it is incorrect
if(m_ActiveItem && (*m_ActiveItem) == -1 && m_Items->size() > 0)
(*m_ActiveItem) = 0;
}
}
}
float const MIHManager::getScaledBlockSize() const
{
// Returns the scaled version of the block size
return m_BlockSize * Application::getGUIScale();
}
| [
"git@wilfsilver.co.uk"
] | git@wilfsilver.co.uk |
c5a952f11d9571f2017112f8d7c9bf3f5709b52c | 464d4b4fb9bbf8e9613e86a682ec0f75781a94e8 | /plugins/schedpol/tempura/tempura_plugin.cc | 386b42381bd849abafa82eadc8e9795b8149381f | [] | no_license | djchopper/bosp | 711fa089c1f761bdbe68a8d98b097ec7a0efe8ee | a83f1fe21579f430bd3f15b3f1f0400b470879b3 | refs/heads/master | 2020-07-31T10:08:50.420326 | 2019-09-25T16:14:54 | 2019-09-25T16:14:54 | 210,569,503 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,370 | cc | /*
* Copyright (C) 2014 Politecnico di Milano
*
* 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "tempura_plugin.h"
#include "tempura_schedpol.h"
#include "bbque/plugins/static_plugin.h"
namespace bp = bbque::plugins;
extern "C"
int32_t PF_exitFunc() {
return 0;
}
extern "C"
PF_ExitFunc PF_initPlugin(const PF_PlatformServices * params) {
int res = 0;
PF_RegisterParams rp;
rp.version.major = 1;
rp.version.minor = 0;
rp.programming_language = PF_LANG_CPP;
// Registering the module
rp.CreateFunc = bp::TempuraSchedPol::Create;
rp.DestroyFunc = bp::TempuraSchedPol::Destroy;
res = params->RegisterObject((const char *) MODULE_NAMESPACE, &rp);
if (res < 0)
return NULL;
return PF_exitFunc;
}
PLUGIN_INIT(PF_initPlugin);
| [
"joe.massanga@gmail.com"
] | joe.massanga@gmail.com |
3421a41afbafd22988598997af3cc5a6b363ef50 | 18e09ac833ebe870afa58538969b1f990af3e7d6 | /Devil's Dice NN/RandomAI.h | 2e5e9f769645e575e799b3af275842b342c85b39 | [] | no_license | rewilkins/Devils-Dice-Neural-Network | 20915454f5c7059f77b70889fb1c272aeb755567 | dc148e030c7046befd3655c947ebca9e477a0dbf | refs/heads/master | 2021-01-12T09:51:28.463501 | 2016-12-14T07:37:54 | 2016-12-14T07:37:54 | 76,278,583 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,760 | h | #pragma once
#ifndef RANDOM_AI
#define RANDOM_AI
#include <iostream>
#include <string>
#include <fstream>
#include "Player.h"
class RandomAI : public Player {
private:
bool passed = true;
int inf_RollCount = 0; // how many times the A.I. has rolled
int inf_OpponentsScore = 0; // the overall score of the AI's opponent
double inf_FreqOf1s = 0.0; // the frequency at which 1s are being roled.
int overallNumOfTurns = 0; // tracks the overall number of times the AI has rolled. overallNum1sRolled/overallNumOfTurns = 1s frequency or inf_FreqOf1s
int overallNum1sRolled = 0; // The number of 1s that have been rolled. AI becomes more cautious and reserved due to superstition.
public:
int choice = 0;
RandomAI() {
std::ifstream fin;
fin.open("player.txt");
if (fin.good()) {
fin >> winCount;
fin >> lossCount;
fin.close();
}
else {
winCount = 0;
}
if (winCount < 0) winCount = 0;
}
RandomAI(std::string name, bool _withPauses, bool _withPrint) {
playerName = name;
std::ifstream fin;
fin.open(playerName + ".txt");
if (fin.good()) {
fin >> winCount;
fin >> lossCount;
fin.close();
}
else {
winCount = 0;
}
if (winCount < 0) winCount = 0;
withPauses = _withPauses;
withPrint = _withPrint;
}
char getAction(int oppenentsScore) {
if (turnScore == 0) { // once per turn event
overallNumOfTurns++;
inf_RollCount = 0; // reset rollCount on first turn
inf_OpponentsScore = oppenentsScore;
if (passed == false) { // must have rolled a 1 last turn we are here and this condition is true
overallNum1sRolled++;
}
}
passed = false;
choice = -1;
std::fstream fout;
fout.open("data.txt", std::fstream::in | std::fstream::out | std::fstream::app);
fout << (double)(inf_RollCount / 100.0f) << " " << (double)inf_FreqOf1s << " " << (double)(turnScore / 100.0f) << " " << (double)(savedScore / 100.0f) << " " << (double)(inf_OpponentsScore / 100.0f) << " " << (int)(choice == 1 || turnScore == 0) << "\n";
fout.close();
if (turnScore == 0) {
inf_RollCount++;
if (withPrint) std::cout << " I choose to roll.";
if (withPauses) pause(1);
return 'r';
}
choice = randomNumGen(0, 1);
if (choice == 1) {
inf_RollCount++;
if (withPrint) std::cout << " I choose to roll.";
if (withPauses) pause(1);
return 'r';
}
else {
if (withPrint) std::cout << " I choose to pass.";
if (withPauses) pause(1);
return 'p';
}
}
void additionalPrint(int player, int i, bool player1sTurn) {
if (player == 0) {
if (i == 95) std::cout << " Choise: " << choice;
}
if (player == 1) {
if (i == 45) std::cout << " Choise: " << choice;
}
}
};
#endif | [
"r.e.wilkins@gmail.com"
] | r.e.wilkins@gmail.com |
38d0c65ec2222fc6a34c8b7a99c61ddfa78b8b89 | f66d08afc3a54a78f6fdb7c494bc2624d70c5d25 | /Code/CLN/src/complex/transcendental/cl_C_atanh_aux.cc | 6049d913638151ac7a6c3c0556b5e4f0f4205f53 | [] | no_license | NBAlexis/GiNaCToolsVC | 46310ae48cff80b104cc4231de0ed509116193d9 | 62a25e0b201436316ddd3d853c8c5e738d66f436 | refs/heads/master | 2021-04-26T23:56:43.627861 | 2018-03-09T19:15:53 | 2018-03-09T19:15:53 | 123,883,542 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,869 | cc | // atanh().
// General includes.
#include "cln_private.h"
// Specification.
#include "complex/cl_C.h"
// Implementation.
#include "base/cl_N.h"
#include "cln/real.h"
#include "float/transcendental/cl_F_tran.h"
#include "real/cl_R.h"
/* Use the inline version of cl_float */
#include "base/cl_inline.h"
#include "real/conv/cl_F_from_R_def.cc"
namespace cln {
// Hilfsfunktion für atanh und atan: u+iv := artanh(x+iy). Liefert cl_C_R(u,v).
const cl_C_R CL_FLATTEN atanh (const cl_R& x, const cl_R& y)
{
// Methode:
// Wert und Branch Cuts nach der Formel CLTL2, S. 315:
// artanh(z) = (log(1+z)-log(1-z)) / 2
// Sei z=x+iy, Ergebnis u+iv.
// Falls x=0 und y=0: u=0, v=0.
// Falls x=0: u = 0, v = atan(X=1,Y=y).
// Falls y=0:
// x rational -> x in Float umwandeln.
// |x|<1/2: u = atanh(x), v = 0.
// |x|>=1/2: (1+x)/(1-x) errechnen,
// =0 -> Error,
// >0 (also |x|<1) -> u = 1/2 log((1+x)/(1-x)), v = 0.
// <0 (also |x|>1) -> u = 1/2 log(-(1+x)/(1-x)),
// v = (-pi/2 für x>1, pi/2 für x<-1).
// Sonst:
// 1+x und 1-x errechnen.
// x und y in Floats umwandeln.
// |4x| und 1+x^2+y^2 errechnen,
// |4x| < 1+x^2+y^2 -> u = 1/2 atanh(2x/(1+x^2+y^2)),
// |4x| >= 1+x^2+y^2 -> u = 1/4 ln ((1+x^2+y^2)+2x)/((1+x^2+y^2)-2x)
// oder besser (an der Singularität: |x|-1,|y| klein):
// u = 1/4 ln ((1+x)^2+y^2)/((1-x)^2+y^2).
// v = 1/2 atan(X=(1-x)(1+x)-y^2,Y=2y) * (-1 falls Y=0.0 und X<0.0 und x>=0.0,
// 1 sonst)
// Ergebnis ist reell nur, wenn z reell.
// Real- und Imaginärteil des Ergebnisses sind Floats, außer wenn z reell oder
// rein imaginär ist.
if (eq(x,0))
// x=0 -> u=0, v=atan(X=1,Y=y) (Fall y=0 ist inbegriffen)
return cl_C_R(0, atan(1,y));
if (eq(y,0)) {
var cl_F xf = cl_float_inline(x); // (float x)
var cl_F& x = xf;
// x Float
if (zerop(x))
// x=0.0 -> x als Ergebnis
return cl_C_R(x, 0);
if (float_exponent(x) < 0)
// Exponent e<0, also |x|<1/2
return cl_C_R(atanhx(x), 0);
// e>=0, also |x|>=1/2
var cl_F xx_den = 1 - x;
var cl_F xx = (1 + x) / xx_den; // (1+x)/(1-x)
var cl_R v;
if (!minusp(xx)) {
if (zerop(xx))
{ throw division_by_0_exception(); }
v = 0;
} else {
// (1+x)/(1-x) < 0 -> Betrag nehmen, Imaginärteil berechnen:
xx = - xx;
v = scale_float(pi(),-1); // (scale-float pi -1) = pi/2
if (minusp(xx_den))
// 1-x<0 -> dann -pi/2
v = -v;
}
// ln bilden, durch 2
return cl_C_R(scale_float(ln(xx),-1), v);
}
var cl_R _1_plus_x = 1+x;
var cl_R _1_minus_x = 1-x;
// x und y in Floats umwandeln: (Diese Fallunterscheidung ist
// symmetrisch in x und y, auch wenn's nicht so aussieht.)
var cl_F xf;
var cl_F yf;
if (rationalp(x)) {
DeclareType(cl_RA,x);
yf = cl_float_inline(y);
xf = cl_float(x,yf);
} else {
DeclareType(cl_F,x);
xf = x;
yf = cl_somefloat(y,xf);
}
var cl_F yf_2 = square(yf);
var cl_F u;
{
var cl_F temp1 = abs(scale_float(xf,2)); // |4x|
var cl_F temp2 = 1 + (square(xf) + yf_2); // 1+x^2+y^2
if (temp1 < temp2) // |4x| < 1+x^2+y^2 ?
// u = 1/2 atanh(2x/(1+x^2+y^2))
u = scale_float(atanhx(scale_float(xf,1)/temp2),-1);
else {
// u = 1/4 ln ((1+x)^2+y^2)/((1-x)^2+y^2)
var cl_F num = _1_plus_x*_1_plus_x + yf_2; // (1+x)^2+y^2, ein Float >=0
var cl_F den = _1_minus_x*_1_minus_x + yf_2; // (1-x)^2+y^2, ein Float >=0
if (zerop(den))
{ throw division_by_0_exception(); }
u = scale_float(ln(num/den),-2);
}
}
var cl_F v;
{
var cl_F X = _1_plus_x*_1_minus_x-yf_2;
var cl_F Y = scale_float(yf,1);
v = atan(X,Y); // atan(X=(1-x)(1+x)-y^2,Y=2y), ein Float
if (minusp(X) && !minusp(x) && zerop(Y))
v = -v;
v = scale_float(v,-1); // 1/2 * atan(...) * +-1
}
return cl_C_R(u,v);
}
} // namespace cln
| [
"nbalexis@gmail.com"
] | nbalexis@gmail.com |
5eec4b0e20f31dcd39611318ea17d7ca79a35bf0 | 0335521931f42bcd4b31d9cd3c36a6abec1aad92 | /Sources/Windows/Forms_XE3/TFormMain.h | 1c7249310cd37ac1b15443620f49f6ac83968e9f | [] | no_license | rogergithubbing/CapriceForEveryone | 88a048976781c2e8c28b39b3fe33d530890cef4f | ae252a7acd909ea2954640bb778f08c718511c0a | refs/heads/master | 2021-08-18T09:39:26.622545 | 2019-04-14T16:34:26 | 2019-04-14T16:34:26 | 178,580,655 | 2 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 22,804 | h | /*
CaPriCe Forever - Amstrad CPC 464/664/6128 emulator
Copyright (C) 2014-2018 by Frédéric Coste
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TFormMainH
#define TFormMainH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Buttons.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.Dialogs.hpp>
#include <Vcl.ExtCtrls.hpp>
#include <Vcl.Menus.hpp>
#include "..\Settings\TSettings.h"
#include "..\Emulator\TEmulator.h"
#include "..\Drawing\TDrawingContext.h"
#include "..\Audio\TAudioContext.h"
#include "..\Dialogs\TDialogInfo.h"
#include "..\Inputs\TInputContext.h"
#include "..\Time\TBaseTimer.h"
//---------------------------------------------------------------------------
class TFormMain : public TForm
{
__published: // Composants gérés par l'EDI
TPanel *PanelCPCScreen;
TOpenDialog *OpenDialog;
TMainMenu *MainMenu;
TMenuItem *DrivesMenu;
TMenuItem *LoadimageintoDriveAMenu;
TMenuItem *LoadimageintoDriveBMenu;
TMenuItem *SwapDrivesMenu;
TMenuItem *EjectbothMenu;
TMenuItem *EmulatorMenu;
TMenuItem *ExitMenu;
TMenuItem *N1;
TMenuItem *ToggleCPUSpeedMenu;
TMenuItem *ResetMenu;
TMenuItem *HelpMenu;
TMenuItem *DisplayMenu;
TMenuItem *EnlargeDisplayMenu;
TMenuItem *ReduceDisplayMenu;
TMenuItem *ExtraMenu;
TMenuItem *N3;
TMenuItem *EmulatorSettingsMenu;
TMenuItem *N4;
TMenuItem *NightmodeMenu;
TMenuItem *ControlPanelMenu;
TMenuItem *N5;
TMenuItem *CRTCRegistersMenu;
TMenuItem *N6;
TMenuItem *PauseMenu;
TMenuItem *MuteMenu;
TMenuItem *FDCOperationsMenu;
TSaveDialog *SaveDialog;
TMenuItem *InputsMenu;
TMenuItem *ToggleColorMonochromeMenu;
TMenuItem *N8;
TMenuItem *MouseAsLightpenMenu;
TMenuItem *EnableAutoStartMenu;
TMenuItem *MouseAsMagnumLightPhaserMenu;
TMenuItem *MouseAsGunStickMenu;
TMenuItem *FullscreenMenu;
TPanel *PanelControl;
TMenuItem *GameControllerSeparator;
TMenuItem *GameControllersSettingsMenu;
TMenuItem *LoadDefaultProfileMenu;
TMenuItem *LoadDriveAProfile;
TMenuItem *N7;
TMenuItem *SmallScreenshotMenu;
TMenuItem *ScreenshotMenu;
TMenuItem *N11;
TMenuItem *SaveSnapshotMenu;
TMenuItem *UpdateSnapshotMenu;
TMenuItem *LoadSnapshotMenu;
TMenuItem *ReloadSnapshotMenu;
TMenuItem *N12;
TMenuItem *KeyboardMappingMenu;
TMenuItem *MouseAsWestPhaserMenu;
TMenuItem *N2;
TMenuItem *AboutMenu;
TMenuItem *N13;
TMenuItem *Hints1;
TMenuItem *GateArrayRegistersMenu;
TMenuItem *DriveACatalogMenu;
TMenuItem *N14;
TMenuItem *Z80EditorMenu;
TMenuItem *MemoryEditorMenu;
TMenuItem *TapeMenu;
TMenuItem *PlayTapeMenu;
TMenuItem *RewindTapeMenu;
TMenuItem *N15;
TMenuItem *InsertTapeMenu;
TMenuItem *EjectTapeMenu;
TMenuItem *PSGOperationsMenu;
TMenuItem *ResetCounterTo000Menu;
TMenuItem *RewindToCounter000Menu;
TMenuItem *N17;
TMenuItem *GoToPreviousTagMenu;
TMenuItem *GoToNextTagMenu;
TMenuItem *TextCaptureMenu;
TMenuItem *TapeAudioWorkshopMenu;
TMenuItem *EnableAutoPlayAtInsertMenu;
TMenuItem *N18;
TPanel *PanelFloattingControl;
TSpeedButton *SpeedButtonControlReset;
TSpeedButton *SpeedButtonControlMute;
TPanel *PanelControlTape;
TSpeedButton *SpeedButtonControlTape;
TSpeedButton *SpeedButtonControlTapeRewind;
TSpeedButton *SpeedButtonControlTapePrevious;
TSpeedButton *SpeedButtonControlTapePlayStop;
TSpeedButton *SpeedButtonControlTapeNext;
TPanel *PanelControlDrives;
TSpeedButton *SpeedButtonControlDriveA;
TPanel *PanelControlDriveAPosition;
TSpeedButton *SpeedButtonControlSwapDrives;
TSpeedButton *SpeedButtonControlDriveB;
TPanel *PanelControlDriveBPosition;
TMenuItem *N19;
TMenuItem *AutoTypeFromClipboardMenu;
TMenuItem *MEA8000Menu;
TMenuItem *VolumeUpMenu;
TMenuItem *VolumeDownMenu;
TMenuItem *PrinterMenu;
TMenuItem *UnloadSnapshotMenu;
TMenuItem *OpenScreenshotsFolderMenu;
TMenuItem *Maximumspeed1;
TMenuItem *FullSpeedMenu;
TMenuItem *Speed200Menu;
TMenuItem *Speed300Menu;
TMenuItem *CustomSpeedMenu;
TMenuItem *N9;
TMenuItem *SetCustomSpeedMenu;
TMenuItem *AudioSettingsMenu;
TMenuItem *DebuggerMenu;
TMenuItem *DisplaySettingsMenu;
TMenuItem *DriveAMenu;
TMenuItem *DriveAEjectMenu;
TMenuItem *DriveBMenu;
TMenuItem *DriveBEjectMenu;
TMenuItem *DriveAWriteProtectionMenu;
TMenuItem *DriveBWriteProtectionMenu;
TMenuItem *N10;
TMenuItem *DriveACreateDATADiskMenu;
TMenuItem *DriveBCreateDATADiskMenu;
TMenuItem *N20;
TMenuItem *N21;
TMenuItem *ConfirmDiskImagesUpdatesMenu;
TMenuItem *N22;
TMenuItem *N23;
TMenuItem *UseHardwareKeyboardMappingMenu;
TMenuItem *SaveContextMenu;
TMenuItem *DriveAFlipSidesMenu;
TMenuItem *N24;
TMenuItem *DriveBFlipSidesMenu;
TMenuItem *DriveAUpdateDiskImageMenu;
TMenuItem *DriveBUpdateDiskImageMenu;
TPopupMenu *DrivePopupMenu;
TMenuItem *PopupDriveFlipSidesMenu;
TMenuItem *PopupDriveCreateDATADiskMenu;
TMenuItem *N16;
TMenuItem *PopupDriveUpdateDiskImageMenu;
TMenuItem *PopupDriveReloadDiskImageMenu;
TMenuItem *N25;
TMenuItem *DriveAReloadDiskImageMenu;
TMenuItem *DriveBReloadDiskImageMenu;
TMenuItem *N26;
TMenuItem *PlaybackSessionMenu;
TMenuItem *N27;
TMenuItem *N28;
TMenuItem *DiskViewerMenu2;
TMenuItem *N29;
TMenuItem *TapeViewerMenu2;
TMenuItem *AutoPlayTapeMenu;
TMenuItem *CheatScriptsMenu;
TMenuItem *OpenCapriceFolderMenu;
TMenuItem *DriveALoadRecentImageMenu;
TMenuItem *DriveALoadFavouriteImageMenu;
TMenuItem *DriveAAddToFavouriteMenu;
TMenuItem *PopupDriveAddToFavouriteMenu;
TMenuItem *DriveBAddToFavouriteMenu;
TMenuItem *N30;
TMenuItem *N31;
TMenuItem *N32;
TMenuItem *NeverUpdateDiskImagesMenu;
TMenuItem *MouseAsAMXMouseMenu;
TMenuItem *N33;
TMenuItem *AMXMouseSpeedMenu;
TMenuItem *AMXMouseSpeed100Menu;
TMenuItem *AMXMouseSpeed200Menu;
TPopupMenu *PopupMenuScreen;
TMenuItem *AutotypefromClipboard1;
TMenuItem *ShowHintsMenu;
TMenuItem *GraphicsExplorerMenu;
void __fastcall FormDestroy(TObject *Sender);
void __fastcall FormShow(TObject *Sender);
void __fastcall ExitMenuClick(TObject *Sender);
void __fastcall LoadimageintoDriveAMenuClick(TObject *Sender);
void __fastcall LoadimageintoDriveBMenuClick(TObject *Sender);
void __fastcall SwapDrivesMenuClick(TObject *Sender);
void __fastcall ToggleCPUSpeedMenuClick(TObject *Sender);
void __fastcall EjectbothMenuClick(TObject *Sender);
void __fastcall ResetMenuClick(TObject *Sender);
void __fastcall EnlargeDisplayMenuClick(TObject *Sender);
void __fastcall ReduceDisplayMenuClick(TObject *Sender);
void __fastcall NightmodeMenuClick(TObject *Sender);
void __fastcall ControlPanelMenuClick(TObject *Sender);
void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
void __fastcall CRTCRegistersMenuClick(TObject *Sender);
void __fastcall PauseMenuClick(TObject *Sender);
void __fastcall MuteMenuClick(TObject *Sender);
void __fastcall FDCOperationsMenuClick(TObject *Sender);
void __fastcall ToggleColorMonochromeMenuClick(TObject *Sender);
void __fastcall PanelCPCScreenMouseMove(TObject *Sender,
TShiftState Shift, int X, int Y);
void __fastcall EnableAutoStartMenuClick(TObject *Sender);
void __fastcall PanelCPCScreenMouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y);
void __fastcall PanelCPCScreenMouseUp(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y);
void __fastcall MouseAsMagnumLightPhaserMenuClick(TObject *Sender);
void __fastcall MouseAsGunStickMenuClick(TObject *Sender);
void __fastcall FullscreenMenuClick(TObject *Sender);
void __fastcall AboutMenuClick(TObject *Sender);
void __fastcall GameControllersSettingsMenuClick(TObject *Sender);
void __fastcall LoadDefaultProfileMenuClick(TObject *Sender);
void __fastcall LoadDriveAProfileClick(TObject *Sender);
void __fastcall SmallScreenshotMenuClick(TObject *Sender);
void __fastcall ScreenshotMenuClick(TObject *Sender);
void __fastcall SaveSnapshotMenuClick(TObject *Sender);
void __fastcall UpdateSnapshotMenuClick(TObject *Sender);
void __fastcall LoadSnapshotMenuClick(TObject *Sender);
void __fastcall ReloadSnapshotMenuClick(TObject *Sender);
void __fastcall KeyboardMappingMenuClick(TObject *Sender);
void __fastcall PanelCPCScreenResize(TObject *Sender);
void __fastcall EmulatorSchedulingMenuClick(TObject *Sender);
void __fastcall MouseAsLightpenMenuClick(TObject *Sender);
// void __fastcall KeyboardAsJoystickMenuClick(TObject *Sender);
void __fastcall MouseAsWestPhaserMenuClick(TObject *Sender);
void __fastcall LightgunMenuClick(TObject *Sender);
void __fastcall DSKViewerMenuClick(TObject *Sender);
void __fastcall HintsMenuClick(TObject *Sender);
void __fastcall GateArrayRegistersMenuClick(TObject *Sender);
void __fastcall DriveACatalogMenuClick(TObject *Sender);
void __fastcall Z80EditorMenuClick(TObject *Sender);
void __fastcall MemoryEditorMenuClick(TObject *Sender);
void __fastcall RewindTapeMenuClick(TObject *Sender);
void __fastcall EjectTapeMenuClick(TObject *Sender);
void __fastcall InsertTapeMenuClick(TObject *Sender);
void __fastcall PlayTapeMenuClick(TObject *Sender);
void __fastcall PSGOperationsMenuClick(TObject *Sender);
void __fastcall CDTViewerMenuClick(TObject *Sender);
void __fastcall ResetCounterTo000MenuClick(TObject *Sender);
void __fastcall RewindToCounter000MenuClick(TObject *Sender);
void __fastcall GoToPreviousTagMenuClick(TObject *Sender);
void __fastcall GoToNextTagMenuClick(TObject *Sender);
void __fastcall TextCaptureMenuClick(TObject *Sender);
void __fastcall TapeAudioWorkshopMenuClick(TObject *Sender);
void __fastcall EnableAutoPlayAtInsertMenuClick(TObject *Sender);
// void __fastcall DecathlonModeMenuClick(TObject *Sender);
void __fastcall PanelControlResize(TObject *Sender);
void __fastcall SpeedButtonControlDriveAClick(TObject *Sender);
void __fastcall SpeedButtonControlDriveBClick(TObject *Sender);
void __fastcall SpeedButtonControlSwapDrivesClick(TObject *Sender);
void __fastcall SpeedButtonControlResetClick(TObject *Sender);
void __fastcall SpeedButtonControlTapeClick(TObject *Sender);
void __fastcall SpeedButtonControlTapeRewindClick(TObject *Sender);
void __fastcall SpeedButtonControlTapePreviousClick(TObject *Sender);
void __fastcall SpeedButtonControlTapePlayStopClick(TObject *Sender);
void __fastcall SpeedButtonControlTapeNextClick(TObject *Sender);
void __fastcall SpeedButtonControlMuteClick(TObject *Sender);
void __fastcall AutoTypeFromClipboardMenuClick(TObject *Sender);
void __fastcall MEA8000MenuClick(TObject *Sender);
void __fastcall VolumeUpMenuClick(TObject *Sender);
void __fastcall VolumeDownMenuClick(TObject *Sender);
void __fastcall PrinterMenuClick(TObject *Sender);
void __fastcall EmulatorSettingsMenuClick(TObject *Sender);
void __fastcall UnloadSnapshotMenuClick(TObject *Sender);
void __fastcall PanelCPCScreenMouseClick(TObject *Sender);
void __fastcall PanelCPCScreenMouseDblClick(TObject *Sender);
void __fastcall OpenScreenshotsFolderMenuClick(TObject *Sender);
void __fastcall FileEditorMenuClick(TObject *Sender);
void __fastcall FullSpeedMenuClick(TObject *Sender);
void __fastcall Speed200MenuClick(TObject *Sender);
void __fastcall Speed300MenuClick(TObject *Sender);
void __fastcall CustomSpeedMenuClick(TObject *Sender);
void __fastcall SetCustomSpeedMenuClick(TObject *Sender);
void __fastcall AudioSettingsMenuClick(TObject *Sender);
// void __fastcall CombatSchoolModeMenuClick(TObject *Sender);
void __fastcall DebuggerMenuClick(TObject *Sender);
void __fastcall DisplaySettingsMenuClick(TObject *Sender);
void __fastcall DriveAEjectMenuClick(TObject *Sender);
void __fastcall DriveBEjectMenuClick(TObject *Sender);
void __fastcall DriveAWriteProtectionMenuClick(TObject *Sender);
void __fastcall DriveBWriteProtectionMenuClick(TObject *Sender);
void __fastcall PanelControlDriveAPositionClick(TObject *Sender);
void __fastcall PanelControlDriveBPositionClick(TObject *Sender);
void __fastcall DriveACreateDATADiskMenuClick(TObject *Sender);
void __fastcall DriveBCreateDATADiskMenuClick(TObject *Sender);
void __fastcall ConfirmDiskImagesUpdatesMenuClick(TObject *Sender);
void __fastcall FormCanResize(TObject *Sender, int &NewWidth,
int &NewHeight, bool &Resize);
void __fastcall UseHardwareKeyboardMappingMenuClick(TObject *Sender);
void __fastcall SaveContextMenuClick(TObject *Sender);
void __fastcall EngineDataMenuClick(TObject *Sender);
void __fastcall DriveAFlipSidesMenuClick(TObject *Sender);
void __fastcall DriveBFlipSidesMenuClick(TObject *Sender);
void __fastcall DriveAUpdateDiskImageMenuClick(TObject *Sender);
void __fastcall DriveBUpdateDiskImageMenuClick(TObject *Sender);
void __fastcall DrivePopupMenuPopup(TObject *Sender);
void __fastcall DriveAReloadDiskImageMenuClick(TObject *Sender);
void __fastcall DriveBReloadDiskImageMenuClick(TObject *Sender);
void __fastcall PlaybackSessionMenuClick(TObject *Sender);
void __fastcall AutoPlayTapeMenuClick(TObject *Sender);
void __fastcall CheatScriptsMenuClick(TObject *Sender);
void __fastcall OpenCapriceFolderMenuClick(TObject *Sender);
void __fastcall DriveAAddToFavouriteMenuClick(TObject *Sender);
void __fastcall DriveBAddToFavouriteMenuClick(TObject *Sender);
void __fastcall NeverUpdateDiskImagesMenuClick(TObject *Sender);
void __fastcall MouseAsAMXMouseMenuClick(TObject *Sender);
void __fastcall AMXMouseSpeed100MenuClick(TObject *Sender);
void __fastcall AMXMouseSpeed200MenuClick(TObject *Sender);
void __fastcall ShowHintsMenuClick(TObject *Sender);
void __fastcall GraphicsExplorerMenuClick(TObject *Sender);
void __fastcall PanelCPCScreenMouseEnter(TObject *Sender);
void __fastcall ROMOperationsMenuClick(TObject *Sender);
private: // Déclarations utilisateur
//
// Members
//
TBaseTimer* mBaseTimerP;
TEmulator* mEmulatorP;
TSettings* mSettingsP;
TDialogInfo* mInfoFormP;
TDrawingContext* mDrawingContextP;
TAudioContext* mAudioContextP;
TInputContext* mInputContextP;
tULong mExecuteCondition;
bool mMouseNecessary;
AnsiString mApplicationTitle;
bool mScreenSaverActive;
LONG mFullScreenOldStyle;
LONG mFullScreenOldExStyle;
int mFullScreenOldTop;
int mFullScreenOldLeft;
int mFullScreenOldWidth;
int mFullScreenOldHeight;
int mFullScreenControlPanelVisible;
int mEmulatorPerformance;
int mCompteurCycleSecond;
bool mFullSpeed;
TCursor mOldCursor;
TList* mEmulatorMessages;
bool mRunTillNextLightgunTrigger;
TShiftState mShiftState;
bool mDoNotSaveSettings;
bool mShowOverridenSettings;
AnsiString mStartSnapshotFilename;
AnsiString mStartROMFilename;
AnsiString mStartAutoTypeCommand;
AnsiString mStartScriptFilename;
bool mFDCMotorState;
bool mTapeMotorState;
TDialogForm* mFullscreenDialogForm;
bool mUpdateControlPanel;
int mFPSCounter;
int mFPSDisplayed;
int mFormFrameWidth;
int mFormFrameHeight;
bool mCheckAutoRunAtStartup;
bool mCheckAutoPlayAtStartup;
bool mKeyboardAsJoystickAtStartup;
bool mFullscreenAtStartup;
bool mWindowedAtStartup;
bool mTurboAtStartup;
TStringList* mRecentDiskFilenames;
TStringList* mFavouriteDiskFilenames;
bool mQuietMode;
// Events
TList* mOnEmulatorCPCEventsList;
TList* mOnEmulatorFDCEventList;
TList* mOnEmulatorDiskEventList;
TList* mOnEmulatorTapeEventList;
TEmulatorMouseDownEvent OnEmulatorMouseDown;
TEmulatorMouseUpEvent OnEmulatorMouseUp;
TEmulatorMouseMoveEvent OnEmulatorMouseMove;
TIdleEvent mOldIdleEvent;
TIdleEvent mIdleEventBeforePause;
//
// Methods
//
void __fastcall OnApplicationDeactivate(TObject* Sender);
void __fastcall AppMessage(tagMSG &Msg, bool &Handled);
void __fastcall WMMove(TMessage &Message);
void __fastcall WMKeyDown(TWMKey &Message);
void __fastcall WMKeyUp(TWMKey &Message);
bool __fastcall InitInputs(void);
void __fastcall OnIdleNormalSpeed(TObject *Sender, bool &Done);
void __fastcall OnIdleFullSpeed(TObject *Sender, bool &Done);
void __fastcall OnIdlePaused(TObject *Sender, bool &Done);
bool __fastcall ExecuteSoundCondition(void);
void __fastcall UpdateSoundBuffers(void);
inline void __fastcall ExecuteVDUCondition(void);
inline void __fastcall ExecutePSGCondition(void);
void __fastcall DropFile(TWMDropFiles &Message); // drag & drop handler
void __fastcall SetAudioSettings();
inline TSettings* __fastcall GetSettings(void) { return mSettingsP; };
inline TEmulator* __fastcall GetEmulator(void) { return mEmulatorP; };
inline tNativeCPC* __fastcall GetNativeCPC(void) { return mEmulatorP->NativeCPC; };
inline TDrawingContext* __fastcall GetDrawingContext(void) { return mDrawingContextP; };
void __fastcall AudioRendererMenuClick(TObject *Sender);
void __fastcall OnRemoveGameController(AnsiString Name);
bool __fastcall OnWINInputKeyDown(WORD &Key, TShiftState Shift);
bool __fastcall OnEmulatorKeyDown(WORD &Key);
bool __fastcall OnEmulatorKeyDownWithAlt(WORD &Key);
bool __fastcall OnEmulatorKeyDownWithCtrl(WORD &Key);
bool __fastcall OnEmulatorKeyDownWithShift(WORD &Key);
bool __fastcall OnEmulatorKeyDownWithCtrlAndShift(WORD &Key);
bool __fastcall OnWINInputKeyUp(WORD &Key, TShiftState Shift);
void __fastcall OnCPCInputKeyDown(tUChar Key);
void __fastcall OnCPCInputKeyUp(tUChar Key);
void __fastcall OnInputMouseDown(TMouseButton Button, int X, int Y);
void __fastcall OnInputMouseUp(TMouseButton Button, int X, int Y);
void __fastcall OnInputMouseMove(int X, int Y);
void __fastcall OnInputMouseClick(int X, int Y);
void __fastcall OnInputMouseDblClick(int X, int Y);
void __fastcall OnLightpenMove(int X, int Y);
void __fastcall OnMagnumLightPhaserPressed(TMouseButton Button, int X, int Y);
void __fastcall OnMagnumLightPhaserReleased(TMouseButton Button);
void __fastcall OnMagnumLightPhaserMove(int X, int Y);
void __fastcall OnGunStickPressed(TMouseButton Button, int X, int Y);
void __fastcall OnGunStickReleased(TMouseButton Button);
void __fastcall OnGunStickMove(int X, int Y);
void __fastcall OnWestPhaserPressed(TMouseButton Button, int X, int Y);
void __fastcall OnWestPhaserReleased(TMouseButton Button);
void __fastcall OnWestPhaserMove(int X, int Y);
void __fastcall OnAMXMousePressed(TMouseButton Button, int X, int Y);
void __fastcall OnAMXMouseReleased(TMouseButton Button);
void __fastcall OnAMXMouseMove(int X, int Y);
void __fastcall SetFullscreen(void);
void __fastcall SetWindowed(void);
void __fastcall AddEmulatorMessage(String NewMessage);
void __fastcall AddEmulatorMessage(String NewMessage, int Duration);
void __fastcall RemoveEmulatorMessage(int IndexToRemove);
void __fastcall DisplayEmulatorMessage(void);
void __fastcall OnFullscreenOpenDSKDialogEnd(TDialogFormEndCause EndCause);
void __fastcall OnFullscreenOpenSNADialogEnd(TDialogFormEndCause EndCause);
void __fastcall OnFullscreenOpenCDTDialogEnd(TDialogFormEndCause EndCause);
void __fastcall OnFullscreenDiskCatalogDialogEnd(TDialogFormEndCause EndCause);
void __fastcall OnEmulatorNextLightgunTrigger(void);
void __fastcall MaximizeEmulatorEndEventPriority(TEmulatorCPCEvent Callback);
void __fastcall OnDiskEvent(tDrive* DriveP);
void __fastcall OnFDCEvent(tFDC* FDC);
void __fastcall ResetEmulator(void);
void __fastcall SetRealCPCSpeed(void);
void __fastcall SetFullSpeed(void);
void __fastcall SetSpeed300Percent(void);
void __fastcall SetSpeed200Percent(void);
void __fastcall SetSpeedCustom(void);
int __fastcall GetCommandParamList(TStringList* ParamList);
void __fastcall AddRecentDisk(AnsiString Filename);
void __fastcall AddFavouriteDisk(AnsiString Filename);
void __fastcall LoadDriveAStoredImageMenuClick(TObject *Sender);
void __fastcall UpdateDriveAMenu(void);
void __fastcall UpdateDriveBMenu(void);
void __fastcall UpdateShowHints(void);
public: // Déclarations utilisateur
//
// Properties
//
__property TSettings* SettingsP = {read=GetSettings};
__property TEmulator* EmulatorP = {read=GetEmulator};
__property tNativeCPC* NativeCPC = {read=GetNativeCPC};
__property TDrawingContext* DrawingContextP = {read=GetDrawingContext};
//
// API
//
__fastcall TFormMain(TComponent* Owner);
void __fastcall SwapDrives(void);
void __fastcall FlipSidesDriveA(void);
void __fastcall EjectDriveA(void);
void __fastcall EjectDriveB(void);
void __fastcall LoadDriveA(AnsiString Filename, bool CheckAutoStart);
void __fastcall LoadDriveB(AnsiString Filename);
void __fastcall CreateDriveA(AnsiString Filename);
void __fastcall CreateDriveB(AnsiString Filename);
void __fastcall InsertTape(AnsiString Filename, bool CheckAutoPlay);
void __fastcall PlayTape(void);
void __fastcall StopTape(void);
void __fastcall SubscribeToCPCEvents(TEmulatorCPCEvent Callback);
void __fastcall UnsubscribeToCPCEvents(TEmulatorCPCEvent Callback);
void __fastcall SubscribeToFDCEvents(TEmulatorFDCEvent Callback);
void __fastcall UnsubscribeToFDCEvents(TEmulatorFDCEvent Callback);
void __fastcall SubscribeToDiskEvents(TEmulatorDiskEvent Callback);
void __fastcall UnsubscribeToDiskEvents(TEmulatorDiskEvent Callback);
void __fastcall SubscribeToTapeEvents(TEmulatorTapeEvent Callback);
void __fastcall UnsubscribeToTapeEvents(TEmulatorTapeEvent Callback);
void __fastcall Pause(bool Paused);
void __fastcall ResumeStepByStep(TEmulatorCPCEvent FirstCallback);
void __fastcall StopStepByStep(bool Paused);
#pragma option push -vi-
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_DROPFILES, TWMDropFiles, DropFile);
MESSAGE_HANDLER(WM_MOVE, TMessage, WMMove);
MESSAGE_HANDLER(WM_KEYDOWN, TWMKey, WMKeyDown);
MESSAGE_HANDLER(WM_KEYUP, TWMKey, WMKeyUp);
END_MESSAGE_MAP(TForm)
#pragma option pop
};
//---------------------------------------------------------------------------
extern PACKAGE TFormMain *FormMain;
//---------------------------------------------------------------------------
#endif
| [
"Roger"
] | Roger |
86b73b4ca4ad989398a257afce396ce163cd10ac | 4732e8b09bfef920f834ae4be32af1210278eee8 | /2017 Data Structure/Project4/BinarySearchTree.cpp | 1953b89cfd8afdaea3209e29227333b46390e686 | [] | no_license | Justin1095/2017-Data-Structure | 466a91383eb8f0fdeb82908ab18a337ae155f381 | 80ad8ad3720b86622822b486a3d9fd6d6da76676 | refs/heads/master | 2021-05-13T14:28:32.246914 | 2018-01-08T23:47:48 | 2018-01-08T23:47:48 | 116,741,616 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,633 | cpp | //Justin Seda
//CPSC 250 10am
//jseda1@live.esu.edu
//13 April 2017
//This program will design a BinarySearchTree class to create a binary tree that holds different values.
//The class contains functions for inserting, finding, deleting, Binary Search Tree Sort, pre-order, in-order and post-order traversals.
//BinarySearchTree.cpp
#include "BinarySearchTree.h"
#include<iomanip>
#include<iostream>
using namespace std;
//Constructor - Initializes root to NULL.
BinarySearchTree::BinarySearchTree()
{
root = NULL;
}
//Destructor - deletes everythng inside the tree.
BinarySearchTree::~BinarySearchTree()
{
delete root;
root = NULL;
}
//insert - insert items into the tree.
void BinarySearchTree::insert(TreeNode *& tree, int item)
{
if (tree == NULL)
{
TreeNode *newNode;
newNode = new TreeNode;
newNode->left = NULL;
newNode->right = NULL;
newNode->info = item;
tree = newNode;
return;
}
else if (item < tree->info)
{
insert(tree->left, item);
}
else
{
insert(tree->right, item);
}
}
//treeSearch - searches for the item throughout the tree.
bool BinarySearchTree::treeSearch(TreeNode *node, int key)
{
if (node == NULL)
{
return false;
}
else if (key == node->info)
{
return true;
}
if (key > node->info)
{
treeSearch(node->right, key);
}
else
{
treeSearch(node->left, key);
}
}
//deleteItem - removes the item in the node inside the tree.
void BinarySearchTree::deleteItem(TreeNode*& tree, int item)
{
if (tree->info == item)
{
deleteNode(tree);
}
else if (tree->info < item)
{
deleteItem(tree->right, item);
}
else
{
deleteItem(tree->left, item);
}
}
//deleteNode- removes entire node inside the tree.
void BinarySearchTree::deleteNode(TreeNode *& tree)
{
TreeNode* tmp = tree;
if (tree->left == NULL || tree->right == NULL)
{
if (tree->right == NULL)
{
tree = tree->left;
delete tmp;
}
else
{
tree = tree->right;
delete tmp;
}
}
else
{
int nTree = tree->info;
getInorderSuccessor(tree, nTree);
tree->info = nTree;
deleteItem(tree, tree->info);
}
}
//getInorderSuccessor - finds the successor for a node.
void BinarySearchTree::getInorderSuccessor(TreeNode* tree, int& item)
{
if (tree->right != NULL)
{
item = min(tree->right);
}
}
//preOrder - traverses and displays the tree in preOrder.
void BinarySearchTree::preOrder(TreeNode *tree)
{
if (tree != NULL)
{
cout << tree->info << " ";
preOrder(tree->left);
preOrder(tree->right);
}
}
//inOrder - traverses and displays the tree in inOrder.
void BinarySearchTree::inOrder(TreeNode* tree)
{
if (tree != NULL)
{
inOrder(tree->left);
cout << tree->info << " ";
inOrder(tree->right);
}
}
//postOrder - traverses and displays the tree in postOrder.
void BinarySearchTree::postOrder(TreeNode *tree)
{
if (tree != NULL)
{
postOrder(tree->left);
postOrder(tree->right);
cout << tree->info << " ";
}
}
//empty - checks if the root is empty.
bool BinarySearchTree::empty() const
{
return root == NULL;
}
//min - find the smallest item in the tree.
int BinarySearchTree::min(TreeNode * root)
{
while (root->left != NULL)
{
root = root->left;
}
return root->info;
}
//BSTsort - gets the array, insert each item in the array and sorts the items inorder.
void BinarySearchTree:: BSTsort(TreeNode* root, int B[], int size)
{
for (int i = 0; i < size; i++)
{
insert(root, B[i]);
}
inOrder(root);
}
| [
"noreply@github.com"
] | noreply@github.com |
11fbddeca6c9572d7d2972700b1aed26c5a1149f | 9358789cc18adbd132c2ae93b36b8f4d7a9f1c60 | /colorConstant.ino | 40a20db8dc5e4eedd6e039cd53eb992933855f35 | [] | no_license | Daedalus12/neopixel-goggles-2014 | 1a7fae95c618abc3b250980e20c1d7b5e3bcf214 | 505bb912466bbc6a581ba95a77c543d6d729e021 | refs/heads/master | 2020-03-26T19:00:31.983834 | 2018-08-24T00:22:22 | 2018-08-24T00:22:22 | 145,243,762 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 212 | ino | byte constant_hue = 0;
void colorConstant(byte* hues, byte* sats) {
if (j == 0){
constant_hue = random(255);
}
for (byte i=0; i<16; i++) {
hues[i] = constant_hue;
sats[i] = 255;
}
}
| [
"Daedalus12@gmail.com"
] | Daedalus12@gmail.com |
0fc685645aab1f5bdac682d302e1d7435deb2f16 | e5486b48e9b0a167a22efd59f0fa5e8f4512e2cf | /BAEKJOON/2699.cpp | b0a23e64a18c927d66282f421b10d1a68eacd87c | [] | no_license | Jihunn-Kim/Coding-Test-Practice | a7ec7cb8f186168fa39026527bb8369599389674 | c2fd1c2f6871dc0b3d1614b0dc9e8f9fcdbe3a91 | refs/heads/master | 2023-04-23T00:48:23.833705 | 2021-05-07T13:48:47 | 2021-05-07T13:48:47 | 112,074,131 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 1,937 | cpp | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
#include <stack>
#include <cmath>
#include <list>
#include <cstring>
#include <set>
#include <unordered_set>
#include <climits>
#include <unordered_map>
#include <map>
#include <iomanip>
using namespace std;
int p, n;
struct Point {
int x, y;
double cos = 0;
};
Point point[51];
// 벡터 AB와 벡터 AC의 CW/CCW
int ccw(const Point& A, const Point& B, const Point& C) {
return (B.x - A.x) * (C.y - A.y) - (B.y - A.y) * (C.x - A.x);
}
// 시작점이 맨 위, 왼쪽이므로 코사인
bool cmp(const Point& p1, const Point& p2) {
if (abs(p1.cos - p2.cos) > 1e-6)
return p1.cos > p2.cos;
else if (p1.y != p2.y)
return p1.y > p2.y;
else
return p1.x < p2.x;
}
int main(void)
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> p;
while (p--) {
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> point[i].x >> point[i].y;
point[i].cos = 0;
}
sort(point, point + n, cmp);
//for (int i = 0; i < n; ++i) {
// cout << point[i].x << ' ' << point[i].y << ' ' << point[i].cos << ' ';
//}
//cout << '\n';
// 시작 점 부터 코사인
for (int i = 1; i < n; i++) {
point[i].cos = (point[i].x - point[0].x) / sqrt(
(point[i].x - point[0].x) * (point[i].x - point[0].x) +
(point[i].y - point[0].y) * (point[i].y - point[0].y));
}
sort(point + 1, point + n, cmp);
vector<Point> s;
s.push_back(point[0]);
s.push_back(point[1]);
// 처음 2개의 점을 넣음
int next = 2;
while (next < n) {
while (s.size() >= 2) {
// 시계방향이면 조건 만족
if (ccw(s[s.size() - 2], s[s.size() - 1], point[next]) < 0)
break;
s.pop_back();
}
// 다음 점을 넣음
s.push_back(point[next++]);
}
cout << s.size() << '\n';
for (int i = 0; i < s.size(); i++)
cout << s[i].x << ' ' << s[i].y << '\n';
}
return 0;
} | [
"sonic2010@naver.com"
] | sonic2010@naver.com |
f11da4578167ca9e0d6afeb1ac57d759cf300157 | edfb435ee89eec4875d6405e2de7afac3b2bc648 | /tags/selenium-2.2.0/cpp/IEDriver/CommandHandlers/QuitCommandHandler.h | a695901954be027a1552a08feab3d51a487d5c05 | [
"Apache-2.0"
] | permissive | Escobita/selenium | 6c1c78fcf0fb71604e7b07a3259517048e584037 | f4173df37a79ab6dd6ae3f1489ae0cd6cc7db6f1 | refs/heads/master | 2021-01-23T21:01:17.948880 | 2012-12-06T22:47:50 | 2012-12-06T22:47:50 | 8,271,631 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,988 | h | // Copyright 2011 WebDriver committers
// 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 WEBDRIVER_IE_QUITCOMMANDHANDLER_H_
#define WEBDRIVER_IE_QUITCOMMANDHANDLER_H_
#include "../Browser.h"
#include "../IECommandHandler.h"
#include "../IECommandExecutor.h"
namespace webdriver {
class QuitCommandHandler : public IECommandHandler {
public:
QuitCommandHandler(void) {
}
virtual ~QuitCommandHandler(void) {
}
protected:
void QuitCommandHandler::ExecuteInternal(const IECommandExecutor& executor, const LocatorMap& locator_parameters, const ParametersMap& command_parameters, Response * response) {
std::vector<std::string> managed_browser_handles;
executor.GetManagedBrowserHandles(&managed_browser_handles);
std::vector<std::string>::iterator end = managed_browser_handles.end();
for (std::vector<std::string>::iterator it = managed_browser_handles.begin(); it != end; ++it) {
BrowserHandle browser_wrapper;
int status_code = executor.GetManagedBrowser(*it, &browser_wrapper);
if (status_code == SUCCESS && !browser_wrapper->is_closing()) {
browser_wrapper->Close();
}
}
// Calling quit will always result in an invalid session.
IECommandExecutor& mutable_executor = const_cast<IECommandExecutor&>(executor);
mutable_executor.set_is_valid(false);
response->SetSuccessResponse(Json::Value::null);
}
};
} // namespace webdriver
#endif // WEBDRIVER_IE_QUITCOMMANDHANDLER_H_
| [
"simon.m.stewart@07704840-8298-11de-bf8c-fd130f914ac9"
] | simon.m.stewart@07704840-8298-11de-bf8c-fd130f914ac9 |
9b2660815b4b2f06c9c87d4a9da51dae71bd21df | 2f6e9f4007975d446489892c6d36050c3438bc51 | /ft_containers/vector.hpp | c02fa1ce56c7955a7b781f033932745db208eb39 | [] | no_license | qperrot/qperrot | 10cb3cf7ca86a2ba4c6cdfc9bd8b4cbd9fae2a4e | d9b6d203cefbc069b47a006c356a8c895c8bf698 | refs/heads/master | 2023-03-08T13:12:37.180525 | 2022-02-02T09:14:36 | 2022-02-02T09:14:36 | 216,030,915 | 0 | 0 | null | 2023-03-08T01:47:57 | 2019-10-18T13:31:26 | C++ | UTF-8 | C++ | false | false | 18,820 | hpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* vector.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: qperrot- <qperrot-@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/10/07 10:38:56 by qperrot- #+# #+# */
/* Updated: 2020/10/26 15:05:53 by qperrot- ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef VECTOR_HPP
#define VECTOR_HPP
#include <iostream>
#include <memory>
#include <limits>
#include "iterator.hpp"
namespace ft {
template<typename T, typename A = std::allocator<T> >
class vector
{
public:
typedef T value_type;
typedef A allocator_type;
typedef typename A::reference reference;
typedef typename A::const_reference const_reference;
typedef typename A::pointer pointer;
typedef typename A::const_pointer const_pointer;
typedef typename A::difference_type difference_type;
typedef typename A::size_type size_type;
private:
allocator_type _alloc;
size_type _size;
size_type _capacity;
T* _array;
template <class InputIterator>
size_type distance(InputIterator first, InputIterator last, typename ft::enable_if< !ft::is_integral< InputIterator >::value, InputIterator >::type Iter = InputIterator());
public:
explicit vector (const allocator_type& alloc = allocator_type());
explicit vector (size_type n, const value_type& val = value_type(), const allocator_type& alloc = allocator_type());
template <class InputIterator>
vector (InputIterator first, InputIterator last,
const allocator_type& alloc = allocator_type(), typename ft::enable_if< !ft::is_integral< InputIterator >::value, InputIterator >::type Iter = InputIterator());
vector (const vector& x);
virtual ~vector();
class iterator;
class const_iterator;
template <class InputIterator>
void assign (InputIterator first, InputIterator last, typename ft::enable_if< !ft::is_integral< InputIterator >::value, InputIterator >::type Iter = InputIterator());
void assign (size_type n, const value_type& val);
reference at (size_type n);
const_reference at (size_type n) const;
reference back();
const_reference back() const;
size_type capacity() const;
void clear();
bool empty() const;
iterator erase (iterator position);
iterator erase (iterator first, iterator last);
reference front();
const_reference front() const;
iterator insert (iterator position, const value_type& val);
void insert (iterator position, size_type n, const value_type& val);
template <class InputIterator>
void insert (iterator position, InputIterator first, InputIterator last, typename ft::enable_if< !ft::is_integral< InputIterator >::value, InputIterator >::type Iter = InputIterator());
size_type max_size() const;
vector& operator= (const vector& x);
reference operator[] (size_type n);
const_reference operator[] (size_type n) const;
void pop_back();
void push_back (const value_type& val);
void reserve (size_type n);
void resize (size_type n, value_type val = value_type());
size_type size() const;
void swap (vector& x);
class iterator {
public:
typedef typename A::difference_type difference_type;
typedef typename A::value_type value_type;
typedef typename A::reference reference;
typedef typename A::pointer pointer;
typedef std::random_access_iterator_tag iterator_category;
private:
T* _index;
public:
iterator(T* i) : _index(i) {}
iterator() : _index(nullptr) {}
iterator &operator=( const iterator& other) { this->_index = other.geti(); return *this; }
virtual ~iterator() {};
T * geti() const {
return this->_index;
}
/* Overload for the comparison operator == */
bool operator==(const iterator& itr) const { return this->_index == itr._index; }
/* Overload for the comparison operator != */
bool operator!=(const iterator& itr) const { return this->_index != itr._index; }
bool operator<(const iterator& itr) const { return this->_index < itr._index; }
bool operator>(const iterator& itr) const { return this->_index > itr._index; }
bool operator<=(const iterator& itr) const {
if (this->_index != itr._index)
return this->_index < itr._index;
return true;
}
bool operator>=(const iterator& itr) const {
if (this->_index != itr._index)
return this->_index > itr._index;
return true;
}
/* Overload for the dereference operator * */
reference operator*() const { return *this->_index; }
pointer operator->() const { return this->_index; }
/* Overload for the postincrement operator ++ */
iterator operator++(int) { return iterator(this->_index++); }
iterator &operator++() { this->_index++; return *this; }
iterator operator--(int) { return iterator(this->_index--); }
iterator &operator--() { --this->_index; return *this; }
iterator operator+( difference_type n ) const {return iterator(this->_index + n);}
iterator operator-( difference_type n ) const {return iterator(this->_index - n);}
iterator& operator+=( difference_type n ) {this->_index += n; return *this;}
iterator& operator-=( difference_type n ) {this->_index -= n; return *this;}
iterator operator[]( difference_type n ) const { return (_index[n]); }
}; /* End of inner class iterator */
class const_iterator {
public:
typedef const T& reference;
typedef const T* pointer;
typedef typename A::difference_type difference_type;
typedef typename A::value_type value_type;
typedef std::random_access_iterator_tag iterator_category;
private:
T* _index;
public:
const_iterator(T* i) : _index(i) {}
const_iterator() : _index(nullptr) {}
const_iterator &operator=( const const_iterator& other) { this->_index = other.geti(); return *this; }
const_iterator(const iterator &other) : _index(other.geti()) { }
virtual ~const_iterator() {};
T * geti() const {
return this->_index;
}
/* Overload for the comparison operator == */
bool operator==(const const_iterator& itr) const { return this->_index == itr._index; }
/* Overload for the comparison operator != */
bool operator!=(const const_iterator& itr) const { return this->_index != itr._index; }
/* Overload for the dereference operator * */
reference operator*() const { return *this->_index; }
pointer operator->() const { return this->_index; }
/* Overload for the postincrement operator ++ */
const_iterator operator++(int) { return const_iterator(this->_index++); }
const_iterator &operator++() { ++this->_index; return *this; }
const_iterator operator--(int) { return const_iterator(this->_index--); }
const_iterator &operator--() { --this->_index; return *this; }
const_iterator operator+( difference_type n ) const {return const_iterator(this->_index + n);}
const_iterator operator-( difference_type n ) const {return const_iterator(this->_index - n);}
const_iterator& operator+=( difference_type n ) {this->_index += n; return *this;}
const_iterator& operator-=( difference_type n ) {this->_index -= n; return *this;}
const_iterator operator[]( difference_type n ) const { return (_index[n]); }
}; /* End of inner class iterator */
typedef ReverseIterator<iterator> reverse_iterator;
typedef ReverseIterator<const_iterator> const_reverse_iterator;
iterator begin() { return iterator(this->_array); }
const_iterator begin() const { return const_iterator(this->_array); }
iterator end() { return iterator(this->_array + this->_size); }
const_iterator end() const { return const_iterator(this->_array + this->_size); }
reverse_iterator rbegin() { return reverse_iterator(end()); }
const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
reverse_iterator rend() { return reverse_iterator(begin()); }
const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
};
template <class T, class A>
bool operator== (const vector<T,A>& lhs, const vector<T,A>& rhs) {
if (lhs.size() != rhs.size())
return false;
typename vector<T, A>::const_iterator it = lhs.begin();
typename vector<T, A>::const_iterator it2 = rhs.begin();
for ( ; it != lhs.end() && it2 != rhs.end() ; ++it, ++it2)
{
if (*it != *it2)
return false;
}
return true;
}
template <class T, class A>
bool operator!= (const vector<T,A>& lhs, const vector<T,A>& rhs) {
if (!(lhs == rhs))
return true;
return false;
}
template <class T, class A>
bool operator< (const vector<T,A>& lhs, const vector<T,A>& rhs) {
typename vector<T, A>::const_iterator it = lhs.begin();
typename vector<T, A>::const_iterator it2 = rhs.begin();
for ( ; it != lhs.end() && it2 != rhs.end() ; ++it, ++it2)
{
if ((*it != *it2))
return (*it < *it2);
}
if (lhs.size() == rhs.size())
return false;
return lhs.size() < rhs.size();
}
template <class T, class A>
bool operator<= (const vector<T,A>& lhs, const vector<T,A>& rhs) {
if (!(lhs == rhs))
return lhs < rhs;
return true;
}
template <class T, class A>
bool operator> (const vector<T,A>& lhs, const vector<T,A>& rhs) {
typename vector<T, A>::const_iterator it = lhs.begin();
typename vector<T, A>::const_iterator it2 = rhs.begin();
for ( ; it != lhs.end() && it2 != rhs.end() ; ++it, ++it2)
{
if ((*it != *it2))
return (*it > *it2);
}
if (lhs.size() == rhs.size())
return false;
return lhs.size() > rhs.size();
}
template <class T, class A>
bool operator>= (const vector<T,A>& lhs, const vector<T,A>& rhs) {
if (!(lhs == rhs))
return lhs > rhs;
return true;
}
template<typename T, typename A >
template <class InputIterator>
typename vector<T,A>::size_type vector<T,A>::distance (InputIterator first, InputIterator last, typename ft::enable_if< !ft::is_integral< InputIterator >::value, InputIterator >::type) {
size_type result = 0;
while (first != last) {
++first;
++result;
}
return result;
}
// template <class T>
// void swap (T &x, T &y) {
// T tmp(x);
// x = y;
// y = tmp;
// }
template <class T, class Alloc>
void swap (vector<T,Alloc>& x, vector<T,Alloc>& y) { x.swap(y); }
template<typename T, typename A >
vector<T,A>::vector (const allocator_type& alloc) : _alloc(alloc), _size(0), _capacity(0), _array(nullptr) {}
template<typename T, typename A >
vector<T,A>::vector (size_type n, const value_type& val, const allocator_type& alloc) : _alloc(alloc), _size(n), _capacity(n) {
_array = _alloc.allocate(n);
_alloc.construct(_array, 0);
for (size_type i = 0; i < n; i++)
_array[i] = val;
}
template<typename T, typename A >
template <class InputIterator>
vector<T,A>::vector (InputIterator first, InputIterator last,
const allocator_type& alloc , typename ft::enable_if< !ft::is_integral< InputIterator >::value, InputIterator >::type) : _alloc(alloc) {
size_type n = distance(first, last);
_array = _alloc.allocate(n);
_alloc.construct(_array, 0);
for (size_type i = 0; i < n; i++) {
_array[i] = *first;
first++;
}
_capacity = n;
_size = n;
}
template<typename T, typename A >
vector<T,A>::vector (const vector& x) {
size_type n = distance(x.begin(), x.end());
_array = _alloc.allocate(n);
_alloc.construct(_array, 0);
for (size_type i = 0; i < n; i++) {
_array[i] = x._array[i];
}
_capacity = x.capacity();
_size = x.size();
}
template<typename T, typename A >
vector<T,A>::~vector() {
if (_capacity) {
for (size_type i = 0; i < _size; i++)
{
_alloc.destroy(_array + i);
}
}
_alloc.deallocate(_array, _capacity);
}
template<typename T, typename A >
vector<T,A> & vector<T,A>::operator= (const vector& x) {
assign(x.begin(), x.end());
return (*this);
}
template<typename T, typename A >
typename vector<T,A>::reference vector<T,A>::operator[] (size_type n) { return _array[n]; }
template<typename T, typename A >
typename vector<T,A>::const_reference vector<T,A>::operator[] (size_type n) const { return _array[n]; }
template<typename T, typename A >
template <class InputIterator>
void vector<T,A>::assign (InputIterator first, InputIterator last, typename ft::enable_if< !ft::is_integral< InputIterator >::value, InputIterator >::type) {
clear();
size_type result = distance(first, last);
if (result > this->capacity())
{
_alloc.deallocate(_array, _capacity);
_array = _alloc.allocate(result);
_alloc.construct(_array, 0);
_size = result;
_capacity = result;
}
for (size_type i = 0; i < result; i++) {
_array[i] = *first;
++first;
}
_size = result;
}
template<typename T, typename A >
void vector<T,A>::assign (size_type n, const value_type& val) {
clear();
if (n > capacity()) {
try
{
this->reserve(n);
}
catch(const std::exception& e)
{
std::cout << e.what() << '\n';
return ;
}
}
for (size_type i = 0; i < n; i++)
_array[i] = val;
_size = n;
}
template<typename T, typename A >
typename vector<T,A>::reference vector<T,A>::at (size_type n) {
if (n >= size())
throw std::out_of_range("index is out of range");
return (_array[n]);
}
template<typename T, typename A >
typename vector<T,A>::const_reference vector<T,A>::at (size_type n) const {
if (n >= size())
throw std::out_of_range("index is out of range");
return (_array[n]);
}
template<typename T, typename A >
typename vector<T,A>::reference vector<T,A>::back() { return (*(--(end()))); }
template<typename T, typename A >
typename vector<T,A>::const_reference vector<T,A>::back() const { return (*(--(end()))); }
template<typename T, typename A >
void vector<T,A>::clear() {
erase(begin(), end());
}
template<typename T, typename A >
typename vector<T,A>::size_type vector<T,A>::capacity() const { return this->_capacity; }
template<typename T, typename A >
bool vector<T,A>::empty() const {
if (size() == 0)
return true;
return false;
}
template<typename T, typename A >
typename vector<T,A>::iterator vector<T,A>::erase (iterator position) {
iterator lst = position;
lst++;
return (erase(position, lst));
}
template<typename T, typename A >
typename vector<T,A>::iterator vector<T,A>::erase (iterator first, iterator last) {
if (first == last)
return last;
size_type new_size = distance(first, last);
for (iterator it = first; it != last; it++)
{
_alloc.destroy(it.geti());
}
iterator lst = last;
if (last != end())
{
for (iterator it = first; lst != end(); it++, lst++)
{
_alloc.construct(it.geti(), *lst);
this->_alloc.destroy(lst.geti());
}
}
_size = _size - new_size;
return (first);
}
template<typename T, typename A >
typename vector<T,A>::reference vector<T,A>::front() { return (*begin()); }
template<typename T, typename A >
typename vector<T,A>::const_reference vector<T,A>::front() const { return (*begin()); }
template<typename T, typename A >
typename vector<T,A>::iterator vector<T,A>::insert (iterator position, const value_type& val) {
size_type dist = distance(begin(), position);
if ((size() + 1) > capacity())
{
try
{
reserve(capacity() * 2);
}
catch(const std::exception& e)
{
std::cout << e.what() << '\n';
return (begin());
}
}
size_type new_size = _size + 1;
for (size_type i = size() + 1; i > dist + 1; i--)
{
_alloc.construct(_array + i - 1 , _array[i - 2]);
_alloc.destroy(_array + i - 2);
}
_alloc.construct(_array + dist, val);
_size = new_size;
return (_array + dist);
}
template<typename T, typename A >
void vector<T,A>::insert (iterator position, size_type n, const value_type& val) {
size_type dist = distance(begin(), position);
if ((size() + n) > capacity())
{
try
{
if ((size() + n) > (capacity() * 2))
reserve((size() + n));
else
reserve(capacity() * 2);
}
catch(const std::exception& e)
{
std::cout << e.what() << '\n';
return ;
}
}
while (n > 0)
{
insert(_array + dist, val);
dist++;
--n;
}
return ;
}
template<typename T, typename A >
template <class InputIterator>
void vector<T,A>::insert (iterator position, InputIterator first, InputIterator last, typename ft::enable_if< !ft::is_integral< InputIterator >::value, InputIterator >::type) {
size_type dist = distance(begin(), position);
size_type n = distance(first, last);
if ((size() + n) > capacity())
{
try
{
reserve((size() + n));
}
catch(const std::exception& e)
{
std::cout << e.what() << '\n';
return ;
}
}
while (n > 0)
{
insert(_array + dist, *(first + (n - 1)));
n--;
}
}
template<typename T, typename A>
typename vector<T, A>::size_type vector<T, A>::max_size() const {
return (static_cast<size_type>(std::numeric_limits<ft::vector<T, A>::size_type>::max())/ sizeof(T));
}
template<typename T, typename A>
void vector<T, A>::pop_back() {
erase(--end());
}
template<typename T, typename A>
void vector<T, A>::push_back (const value_type& val) {
insert(end(), val);
}
template<typename T, typename A >
void vector<T,A>::reserve(size_type n) {
if (n > max_size())
throw std::length_error("Max size reached");
if (n > capacity())
{
T* new_pointer = _alloc.allocate(n);
for (size_type i = 0; i < _size; i++)
{
_alloc.construct(&new_pointer[i], _array[i]);
_alloc.destroy(&_array[i]);
}
_alloc.deallocate(_array, _capacity);
_array = new_pointer;
_capacity = n;
}
return ;
}
template<typename T, typename A >
void vector<T,A>::resize (size_type n, value_type val) {
if (n < size())
erase(_array + n, _array + size());
else
insert(end(), n - size(), val);
}
template<typename T, typename A >
typename vector<T,A>::size_type vector<T,A>::size() const { return _size; }
template<typename T, typename A>
void vector<T,A>::swap (vector& x) {
ft::swap(_alloc, x._alloc);
ft::swap(_size, x._size);
ft::swap(_capacity, x._capacity);
ft::swap(_array, x._array);
}
}
#endif
| [
"perrot-minnotquentin@macbook-pro-de-perrot-minnot.home"
] | perrot-minnotquentin@macbook-pro-de-perrot-minnot.home |
9668502ea967c94bfbc420b036784a18794fee61 | 7cb287aa15612d1e92ab3d264f61ede7092f3986 | /refactor/refctor2/main/bin/sketch/MoveList.h | 0e7111e66302fe3775ec25e032efe669e660f268 | [] | no_license | mlenover/CNC-Tube-Notcher | a1c29b4b59229eeb6e97909b849141cc0ed1b537 | b4c19a16e502f61470f74e2b1cdccfde002ef0d9 | refs/heads/master | 2022-04-08T03:52:24.201340 | 2020-03-12T17:10:43 | 2020-03-12T17:10:43 | 225,083,632 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 385 | h | #ifndef MOVE_LIST_H
#define MOVE_LIST_H
#include "Move.h"
#include "Param.h"
class MoveList {
private:
Move* moveBuf[param.numMoveBuf];
static Move* startMove;
static Move* endMove;
public:
MoveList* create();
void init();
bool hasFreeMove();
Move* reserveMove();
void releaseMove(Move* move);
static Move* getFirstRunnableMove();
};
#endif | [
"mlenover@gmail.com"
] | mlenover@gmail.com |
db147d905c7f904f3cc869990ebba081ce008f28 | 65f9576021285bc1f9e52cc21e2d49547ba77376 | /LINUX/android/vendor/qcom/proprietary/qcril-data-hal/datamodule/include/module/IDataModule.h | b91154cb49376c2e6b31e0a557dc2a38866dcf44 | [] | no_license | AVCHD/qcs605_root_qcom | 183d7a16e2f9fddc9df94df9532cbce661fbf6eb | 44af08aa9a60c6ca724c8d7abf04af54d4136ccb | refs/heads/main | 2023-03-18T21:54:11.234776 | 2021-02-26T11:03:59 | 2021-02-26T11:03:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 677 | h | /**
* Copyright (c) 2017 Qualcomm Technologies, Inc.
* All Rights Reserved.
* Confidential and Proprietary - Qualcomm Technologies, Inc.
**/
#pragma once
#include "framework/Module.h"
namespace rildata {
/**
IDataModule is the public interface to create Data Module
*/
class IDataModule : public Module {
public:
static IDataModule* makeModule();
virtual void init() = 0;
virtual ~IDataModule() {}
IDataModule(const IDataModule&) =delete;
IDataModule& operator=(const IDataModule&) =delete;
// void setImsDataModuleInterface(
// std::shared_ptr<ImsDataModuleInterface> imsDataModuleInterface);
protected:
IDataModule() = default;
};
} //namespace
| [
"jagadeshkumar.s@pathpartnertech.com"
] | jagadeshkumar.s@pathpartnertech.com |
25d2b3e3d4cf1ccd798acf0e7e70843430a888bb | 34cffde27a132b9e8f0cb6ba7e4981ddf9bdff78 | /C++ Family/Internet Learning/Learn/Learn Theory/aboutvariablestype2.cpp | 7560f50428abb8df9ce05e8afa6a0fb631116b2b | [] | no_license | tokaisuDev/Code-Coding-Series | a02c6a12dc0b856d0eea29c2dd39da2030a86315 | 9ae8b3dc0aea23f556b7f1456b00b1d45b8af45e | refs/heads/master | 2023-05-01T22:58:06.367493 | 2021-05-26T00:59:33 | 2021-05-26T00:59:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 237 | cpp | #include <iostream>
using namespace std;
int main() {
// Wait some minutes! We will learn another tpye of "int" variables
// another thing... to assign a value to a veriables
int myNum;
myNum = 15;
cout << myNum;
return 0;
} | [
"toymyorange@gmail.com"
] | toymyorange@gmail.com |
b4bd2b3838b5365e9301fd73e9186b109605128b | 41b4adb10cc86338d85db6636900168f55e7ff18 | /aws-cpp-sdk-ec2/source/model/BundleTask.cpp | 452ca83b52c043e787336315c6bd1385bf0a37d7 | [
"JSON",
"MIT",
"Apache-2.0"
] | permissive | totalkyos/AWS | 1c9ac30206ef6cf8ca38d2c3d1496fa9c15e5e80 | 7cb444814e938f3df59530ea4ebe8e19b9418793 | refs/heads/master | 2021-01-20T20:42:09.978428 | 2016-07-16T00:03:49 | 2016-07-16T00:03:49 | 63,465,708 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 6,687 | cpp | /*
* Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#include <aws/ec2/model/BundleTask.h>
#include <aws/core/utils/xml/XmlSerializer.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <utility>
using namespace Aws::Utils::Xml;
using namespace Aws::Utils;
namespace Aws
{
namespace EC2
{
namespace Model
{
BundleTask::BundleTask() :
m_instanceIdHasBeenSet(false),
m_bundleIdHasBeenSet(false),
m_stateHasBeenSet(false),
m_startTimeHasBeenSet(false),
m_updateTimeHasBeenSet(false),
m_storageHasBeenSet(false),
m_progressHasBeenSet(false),
m_bundleTaskErrorHasBeenSet(false)
{
}
BundleTask::BundleTask(const XmlNode& xmlNode) :
m_instanceIdHasBeenSet(false),
m_bundleIdHasBeenSet(false),
m_stateHasBeenSet(false),
m_startTimeHasBeenSet(false),
m_updateTimeHasBeenSet(false),
m_storageHasBeenSet(false),
m_progressHasBeenSet(false),
m_bundleTaskErrorHasBeenSet(false)
{
*this = xmlNode;
}
BundleTask& BundleTask::operator =(const XmlNode& xmlNode)
{
XmlNode resultNode = xmlNode;
if(!resultNode.IsNull())
{
XmlNode instanceIdNode = resultNode.FirstChild("instanceId");
if(!instanceIdNode.IsNull())
{
m_instanceId = StringUtils::Trim(instanceIdNode.GetText().c_str());
m_instanceIdHasBeenSet = true;
}
XmlNode bundleIdNode = resultNode.FirstChild("bundleId");
if(!bundleIdNode.IsNull())
{
m_bundleId = StringUtils::Trim(bundleIdNode.GetText().c_str());
m_bundleIdHasBeenSet = true;
}
XmlNode stateNode = resultNode.FirstChild("state");
if(!stateNode.IsNull())
{
m_state = BundleTaskStateMapper::GetBundleTaskStateForName(StringUtils::Trim(stateNode.GetText().c_str()).c_str());
m_stateHasBeenSet = true;
}
XmlNode startTimeNode = resultNode.FirstChild("startTime");
if(!startTimeNode.IsNull())
{
m_startTime = DateTime(StringUtils::Trim(startTimeNode.GetText().c_str()).c_str(), DateFormat::ISO_8601);
m_startTimeHasBeenSet = true;
}
XmlNode updateTimeNode = resultNode.FirstChild("updateTime");
if(!updateTimeNode.IsNull())
{
m_updateTime = DateTime(StringUtils::Trim(updateTimeNode.GetText().c_str()).c_str(), DateFormat::ISO_8601);
m_updateTimeHasBeenSet = true;
}
XmlNode storageNode = resultNode.FirstChild("storage");
if(!storageNode.IsNull())
{
m_storage = storageNode;
m_storageHasBeenSet = true;
}
XmlNode progressNode = resultNode.FirstChild("progress");
if(!progressNode.IsNull())
{
m_progress = StringUtils::Trim(progressNode.GetText().c_str());
m_progressHasBeenSet = true;
}
XmlNode bundleTaskErrorNode = resultNode.FirstChild("error");
if(!bundleTaskErrorNode.IsNull())
{
m_bundleTaskError = bundleTaskErrorNode;
m_bundleTaskErrorHasBeenSet = true;
}
}
return *this;
}
void BundleTask::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
{
if(m_instanceIdHasBeenSet)
{
oStream << location << index << locationValue << ".InstanceId=" << StringUtils::URLEncode(m_instanceId.c_str()) << "&";
}
if(m_bundleIdHasBeenSet)
{
oStream << location << index << locationValue << ".BundleId=" << StringUtils::URLEncode(m_bundleId.c_str()) << "&";
}
if(m_stateHasBeenSet)
{
oStream << location << index << locationValue << ".State=" << BundleTaskStateMapper::GetNameForBundleTaskState(m_state) << "&";
}
if(m_startTimeHasBeenSet)
{
oStream << location << index << locationValue << ".StartTime=" << StringUtils::URLEncode(m_startTime.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
}
if(m_updateTimeHasBeenSet)
{
oStream << location << index << locationValue << ".UpdateTime=" << StringUtils::URLEncode(m_updateTime.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
}
if(m_storageHasBeenSet)
{
Aws::StringStream storageLocationAndMemberSs;
storageLocationAndMemberSs << location << index << locationValue << ".Storage";
m_storage.OutputToStream(oStream, storageLocationAndMemberSs.str().c_str());
}
if(m_progressHasBeenSet)
{
oStream << location << index << locationValue << ".Progress=" << StringUtils::URLEncode(m_progress.c_str()) << "&";
}
if(m_bundleTaskErrorHasBeenSet)
{
Aws::StringStream bundleTaskErrorLocationAndMemberSs;
bundleTaskErrorLocationAndMemberSs << location << index << locationValue << ".BundleTaskError";
m_bundleTaskError.OutputToStream(oStream, bundleTaskErrorLocationAndMemberSs.str().c_str());
}
}
void BundleTask::OutputToStream(Aws::OStream& oStream, const char* location) const
{
if(m_instanceIdHasBeenSet)
{
oStream << location << ".InstanceId=" << StringUtils::URLEncode(m_instanceId.c_str()) << "&";
}
if(m_bundleIdHasBeenSet)
{
oStream << location << ".BundleId=" << StringUtils::URLEncode(m_bundleId.c_str()) << "&";
}
if(m_stateHasBeenSet)
{
oStream << location << ".State=" << BundleTaskStateMapper::GetNameForBundleTaskState(m_state) << "&";
}
if(m_startTimeHasBeenSet)
{
oStream << location << ".StartTime=" << StringUtils::URLEncode(m_startTime.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
}
if(m_updateTimeHasBeenSet)
{
oStream << location << ".UpdateTime=" << StringUtils::URLEncode(m_updateTime.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
}
if(m_storageHasBeenSet)
{
Aws::String storageLocationAndMember(location);
storageLocationAndMember += ".Storage";
m_storage.OutputToStream(oStream, storageLocationAndMember.c_str());
}
if(m_progressHasBeenSet)
{
oStream << location << ".Progress=" << StringUtils::URLEncode(m_progress.c_str()) << "&";
}
if(m_bundleTaskErrorHasBeenSet)
{
Aws::String bundleTaskErrorLocationAndMember(location);
bundleTaskErrorLocationAndMember += ".BundleTaskError";
m_bundleTaskError.OutputToStream(oStream, bundleTaskErrorLocationAndMember.c_str());
}
}
} // namespace Model
} // namespace EC2
} // namespace Aws
| [
"henso@amazon.com"
] | henso@amazon.com |
49e8581ecc6e16ed87c20d6d5a8bde3727056935 | 4e9d28e319ee58dd120fda27f5bd695e09bac620 | /Maps/userpath.cpp | 365641d99d876ae1d0609f3b68c307a8ac1645cf | [] | no_license | Lvisual/GraduateProject | f73aa64baac3a0b073abd344d8e1866b06ad81c8 | 25e508aa144960a7934054f9e887cfe71769da0e | refs/heads/master | 2020-03-09T01:29:32.411440 | 2018-05-01T15:44:15 | 2018-05-01T15:44:15 | 128,515,956 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,430 | cpp |
#include "userpath.h"
#include <QFont>
#include <QWidget>
#include <QLabel>
#include <QWidget>
#include <QApplication>
#include <QGridLayout>
#include <QLabel>
#include <QLineEdit>
#include <QFormLayout>
#include <QPushButton>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QScrollArea>
#include<QString>
#include "basestation/formtitle.h"
userPath::userPath(QWidget *parent) :
QWidget(parent)
{
this->setFixedSize(400,400);
setWindowFlags(Qt::FramelessWindowHint);
//表单输入
formlayout=new QFormLayout();
formlayout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
startEdit=new QLineEdit();
endEdit=new QLineEdit();
startEdit->setPlaceholderText(QStringLiteral("请输入起始地址"));
endEdit->setPlaceholderText(QStringLiteral("请输入目的地址"));
formlayout->addRow(QStringLiteral("&起始地址: "),startEdit);
formlayout->addRow(QStringLiteral("&目的地址: "),endEdit);
formlayout->setLabelAlignment(Qt::AlignRight);
formlayout->setVerticalSpacing(40);
formlayout->setHorizontalSpacing(10);
widget_1=new QWidget();
widget_1->setLayout(formlayout);
widget_1->setObjectName("widget_1");
widget_1->setMinimumSize(500,290);
chk_btn=new QPushButton();
chk_btn->setText(QStringLiteral("确 定"));
chk_btn->setObjectName("chk_btn");
can_btn=new QPushButton();
can_btn->setText(QStringLiteral("取 消"));
can_btn->setObjectName("can_btn");
hor_layout=new QHBoxLayout();
hor_layout->addWidget(chk_btn);
hor_layout->addWidget(can_btn);
hor_layout->setAlignment(Qt::AlignRight);
hor_layout->setMargin(10);
hor_layout->setSpacing(30);
widget_2=new QWidget();
widget_2->setLayout(hor_layout);
widget_2->setObjectName("widget_2");
widget_2->setFixedHeight(70);
scrollArea=new QScrollArea();
scrollArea->setWidget(widget_1);
scrollArea->setObjectName("scrollArea");
scrollArea->setWidgetResizable(false);
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scrollArea->setFrameShape(QFrame::NoFrame);
title=new FormTitle(this,QStringLiteral("起始房间号"));
title->setFixedHeight(40);
gridlayout=new QGridLayout(this);
gridlayout->addWidget(title,0,0,1,1);
gridlayout->addWidget(scrollArea,1,0,1,1);
gridlayout->addWidget(widget_2,2,0,1,1);
gridlayout->setSizeConstraint(QLayout::SetMaximumSize);
gridlayout->setContentsMargins(0,0,0,0);
gridlayout->setSpacing(0);
setLayout(gridlayout);
connect(this->chk_btn,SIGNAL(clicked()),this,SLOT(combine()));
connect(this->can_btn,SIGNAL(clicked()),this,SLOT(close()));
connect(title,SIGNAL(showMin()),this,SLOT(showMinimized()));
connect(title,SIGNAL(closeWidget()),this,SLOT(close()));
/********************窗口缩放***********************/
this->setMouseTracking(true);
isLeftPressed=false;
curPos=0; //鼠标左击时的位置
this->setMinimumSize(450,10);
this->setFixedWidth(450);
QCursor cursor;
cursor.setShape(Qt::ArrowCursor);
QWidget::setCursor(cursor);
}
void userPath::combine(){
userPoint userpointInfo;
userpointInfo.start = this->startEdit->text();
userpointInfo.end = this->endEdit->text();
emit userPointSignal(userpointInfo);
this->close();
}
userPath::~userPath()
{
}
/********************窗口缩放***********************/
void userPath::mousePressEvent(QMouseEvent *eve)
{
if(eve->button()==Qt::LeftButton)
{
this->isLeftPressed=true;
QPoint temp=eve->globalPos();
pLast=temp;
curPos=countFlag(eve->pos(),countRow(eve->pos()));
eve->ignore();
}
}
void userPath::mouseReleaseEvent(QMouseEvent *eve)
{
if(isLeftPressed)
isLeftPressed=false;
QApplication::restoreOverrideCursor();
eve->ignore();
}
void userPath::mouseMoveEvent(QMouseEvent *eve)
{
int poss=countFlag(eve->pos(),countRow(eve->pos()));
setCursorType(poss);
if(isLeftPressed)
{
QPoint ptemp=eve->globalPos();
ptemp=ptemp-pLast;
if(curPos==22)
{
ptemp=ptemp+pos();
move(pos());
}
else
{
QRect wid=geometry();
switch (curPos)
{
case 11:wid.setTopLeft(wid.topLeft());break;
case 13:wid.setTopRight(wid.topRight());break;
case 31:wid.setBottomLeft(wid.bottomLeft());break;
case 33:wid.setBottomRight(wid.bottomRight());break;
case 12:wid.setTop(wid.top()+ptemp.y());break;
case 21:wid.setLeft(wid.left());break;
case 23:wid.setRight(wid.right());break;
case 32:wid.setBottom(wid.bottom()+ptemp.y());break;
}
setGeometry(wid);
}
pLast=eve->globalPos();
}
eve->ignore();
}
int userPath::countFlag(QPoint p, int row)
{
if(p.y()<MARGIN)
return 10+row;
else if(p.y()>this->height()-MARGIN)
return 30+row;
else
return 20+row;
}
void userPath::setCursorType(int flag)
{
if(curPos==32)
{
this->setCursor(Qt::ArrowCursor);
}
else
{
this->setCursor(Qt::ArrowCursor);
}
}
int userPath::countRow(QPoint p)
{
return (p.x()<MARGIN)?1:(p.x()>(this->width()-MARGIN))?3:2;
}
| [
"873584843@qq.com"
] | 873584843@qq.com |
316341f63e40ece26dd98b83132e218e3bda4103 | 2cf838b54b556987cfc49f42935f8aa7563ea1f4 | /aws-cpp-sdk-quicksight/include/aws/quicksight/model/DescribeTemplatePermissionsRequest.h | 6b362fa9c6c5b1e6e647239295698cd203fa9607 | [
"MIT",
"Apache-2.0",
"JSON"
] | permissive | QPC-database/aws-sdk-cpp | d11e9f0ff6958c64e793c87a49f1e034813dac32 | 9f83105f7e07fe04380232981ab073c247d6fc85 | refs/heads/main | 2023-06-14T17:41:04.817304 | 2021-07-09T20:28:20 | 2021-07-09T20:28:20 | 384,714,703 | 1 | 0 | Apache-2.0 | 2021-07-10T14:16:41 | 2021-07-10T14:16:41 | null | UTF-8 | C++ | false | false | 4,408 | h | /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/quicksight/QuickSight_EXPORTS.h>
#include <aws/quicksight/QuickSightRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace QuickSight
{
namespace Model
{
/**
*/
class AWS_QUICKSIGHT_API DescribeTemplatePermissionsRequest : public QuickSightRequest
{
public:
DescribeTemplatePermissionsRequest();
// Service request name is the Operation name which will send this request out,
// each operation should has unique request name, so that we can get operation's name from this request.
// Note: this is not true for response, multiple operations may have the same response name,
// so we can not get operation's name from response.
inline virtual const char* GetServiceRequestName() const override { return "DescribeTemplatePermissions"; }
Aws::String SerializePayload() const override;
/**
* <p>The ID of the AWS account that contains the template that you're
* describing.</p>
*/
inline const Aws::String& GetAwsAccountId() const{ return m_awsAccountId; }
/**
* <p>The ID of the AWS account that contains the template that you're
* describing.</p>
*/
inline bool AwsAccountIdHasBeenSet() const { return m_awsAccountIdHasBeenSet; }
/**
* <p>The ID of the AWS account that contains the template that you're
* describing.</p>
*/
inline void SetAwsAccountId(const Aws::String& value) { m_awsAccountIdHasBeenSet = true; m_awsAccountId = value; }
/**
* <p>The ID of the AWS account that contains the template that you're
* describing.</p>
*/
inline void SetAwsAccountId(Aws::String&& value) { m_awsAccountIdHasBeenSet = true; m_awsAccountId = std::move(value); }
/**
* <p>The ID of the AWS account that contains the template that you're
* describing.</p>
*/
inline void SetAwsAccountId(const char* value) { m_awsAccountIdHasBeenSet = true; m_awsAccountId.assign(value); }
/**
* <p>The ID of the AWS account that contains the template that you're
* describing.</p>
*/
inline DescribeTemplatePermissionsRequest& WithAwsAccountId(const Aws::String& value) { SetAwsAccountId(value); return *this;}
/**
* <p>The ID of the AWS account that contains the template that you're
* describing.</p>
*/
inline DescribeTemplatePermissionsRequest& WithAwsAccountId(Aws::String&& value) { SetAwsAccountId(std::move(value)); return *this;}
/**
* <p>The ID of the AWS account that contains the template that you're
* describing.</p>
*/
inline DescribeTemplatePermissionsRequest& WithAwsAccountId(const char* value) { SetAwsAccountId(value); return *this;}
/**
* <p>The ID for the template.</p>
*/
inline const Aws::String& GetTemplateId() const{ return m_templateId; }
/**
* <p>The ID for the template.</p>
*/
inline bool TemplateIdHasBeenSet() const { return m_templateIdHasBeenSet; }
/**
* <p>The ID for the template.</p>
*/
inline void SetTemplateId(const Aws::String& value) { m_templateIdHasBeenSet = true; m_templateId = value; }
/**
* <p>The ID for the template.</p>
*/
inline void SetTemplateId(Aws::String&& value) { m_templateIdHasBeenSet = true; m_templateId = std::move(value); }
/**
* <p>The ID for the template.</p>
*/
inline void SetTemplateId(const char* value) { m_templateIdHasBeenSet = true; m_templateId.assign(value); }
/**
* <p>The ID for the template.</p>
*/
inline DescribeTemplatePermissionsRequest& WithTemplateId(const Aws::String& value) { SetTemplateId(value); return *this;}
/**
* <p>The ID for the template.</p>
*/
inline DescribeTemplatePermissionsRequest& WithTemplateId(Aws::String&& value) { SetTemplateId(std::move(value)); return *this;}
/**
* <p>The ID for the template.</p>
*/
inline DescribeTemplatePermissionsRequest& WithTemplateId(const char* value) { SetTemplateId(value); return *this;}
private:
Aws::String m_awsAccountId;
bool m_awsAccountIdHasBeenSet;
Aws::String m_templateId;
bool m_templateIdHasBeenSet;
};
} // namespace Model
} // namespace QuickSight
} // namespace Aws
| [
"aws-sdk-cpp-automation@github.com"
] | aws-sdk-cpp-automation@github.com |
31134167ecc5241b393a9fdf4b9db9d66a6d6c94 | cd72b19d2030f36f78dab52390d092ed3dc8005f | /lib/include/libvideostitch/context.hpp | 80578ec1a026611d239ed85c5dbc0c987d4a56e2 | [
"MIT",
"DOC"
] | permissive | stitchEm/stitchEm | 08c5a3ef95c16926c944c1835fdd4ab4b6855580 | 4a0e9fc167f10c7dde46394aff302927c15ce6cb | refs/heads/master | 2022-11-27T20:13:45.741733 | 2022-11-22T17:26:07 | 2022-11-22T17:26:07 | 182,059,770 | 250 | 68 | MIT | 2022-11-22T17:26:08 | 2019-04-18T09:36:54 | C++ | UTF-8 | C++ | false | false | 1,245 | hpp | // Copyright (c) 2012-2017 VideoStitch SAS
// Copyright (c) 2018 stitchEm
#pragma once
#include "algorithm.hpp"
#include "status.hpp"
namespace VideoStitch {
namespace GPU {
namespace Context {
/** Compile all GPU kernels for the thread-local device */
Status compileAllKernels(const bool aheadOfTime, Util::Algorithm::ProgressReporter* pReporter);
/**
* Compile all the OpenCL programs for the selected device.
* @param device The device delected
* @param aheadOfTime if true, only compile the programs that are marked as likelyUsed
* @param progress if non-null, used as progress indicator.
*/
VS_EXPORT Status compileAllKernelsOnSelectedDevice(int device, const bool aheadOfTime,
Util::Algorithm::ProgressReporter* pReporter = nullptr);
/** Destroy current GPU context immediately.
* This is usually called before program exit to flush profiling data.
*/
VS_EXPORT Status destroy();
// check that sharing between OpenGL and cuda or OpenCL is OK.
// If it doesn't return OK, it probably means that the selected GPU doesn't display
VS_EXPORT Status setDefaultBackendDeviceAndCheck(const int vsDeviceID);
} // namespace Context
} // namespace GPU
} // namespace VideoStitch
| [
"stitchemvr@gmail.com"
] | stitchemvr@gmail.com |
b7fec407b2625a1de6e2345e20ef71edb53006c5 | 4cc01bb450a264037c0852a6b0772000a6a8058f | /NumberComplement.cpp | eac354d1cb5bdee29cfa7f8b5e00656f2aaf6a46 | [] | no_license | VijayReddy119/LeetCode | d759763df6295618421c7bf029ccd4c550da7a50 | 59f5d50b4bf3d2ac4bd8f6ec686e2cd5f1b1883e | refs/heads/master | 2022-10-28T01:00:08.860510 | 2020-06-16T15:55:25 | 2020-06-16T15:55:25 | 272,750,135 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 195 | cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
int n=2147483647;
int mask = 1;
while(mask < n)
mask = (mask<<1)+1;
cout<< (n^mask);
return 0;
} | [
"noreply@github.com"
] | noreply@github.com |
7de392f5c0cbbe83d75c9dcd484121400e2063be | 846162163ec441b1e8affc5e9942b2e30f39fb78 | /MyWidgetApplications/applications/widgettesterapp.hpp | 3f996d7afaa402a1698a12101cc1462959b01a7f | [] | no_license | abrdo/Widget_library---in_CPP | 3674cae44b7e4110b8c0dce1fe116700b0922518 | 8e2804717313e010a228bda6bea9ed26f82596f5 | refs/heads/master | 2023-02-27T03:47:24.364579 | 2021-02-02T18:16:40 | 2021-02-02T18:16:40 | 273,394,287 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 452 | hpp | #ifndef WIDGETTESTERAPP_HPP
#define WIDGETTESTERAPP_HPP
#include "../window.hpp"
#include "../checkbox.hpp"
#include "../statictext.hpp"
#include "../numbereditor.hpp"
#include "../texteditor.hpp"
#include "../selectorlist.hpp"
#include "../funcbutton.hpp"
class WidgetTesterApp : public dowi::Window{
dowi::SelectorList* _sl;
dowi::FuncButton* _b;
public:
WidgetTesterApp(int XX = 800, int YY = 400);
};
#endif // WIDGETTESTERAPP_HPP
| [
"abraham.domi@gmail.com"
] | abraham.domi@gmail.com |
1bf6cb5f587cedf7b2e9f3727b52e2f53d63a286 | c4a66686285857e441d05420f970a9b72bc8d5d5 | /2202_ArraySortedRecursion.cpp | 9919414b43c50b2ae8199c92002e09d5f2acaf43 | [] | no_license | himanshu-rawat/CBcplusplus | 99140cb25a96b66c6160f6689b02d278ac8ba66d | fbb5de2e4945457eed604fc11fb2093da4258ecc | refs/heads/master | 2020-05-03T20:38:32.174661 | 2019-07-24T13:13:06 | 2019-07-24T13:13:06 | 178,807,210 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 312 | cpp | #include<iostream>
using namespace std;
bool isSorted(int arr[],int n){
// Base Case
if(n==0){
return 1;
}
// Recursive Case
int val = arr[n-1]>arr[n-2] &&isSorted(arr,n-1);
return val;
}
int main(){
int arr[]={3,5,6,9,10,11};
cout<<isSorted(arr,6);
return 0;
} | [
"himanshurawatrit@gmail.com"
] | himanshurawatrit@gmail.com |
e2562e8e780c231d94aaf0f7a0a4fa5826269800 | 6819e26f7d705b8fb92a709667a3610b63a75229 | /sort.cpp | f8911edf1a760732259faaca8c0a5c3ffd4f43c9 | [] | no_license | RStravinsky/Sorting | 0edd1c8b6e7366a9ebfbfcfa11f8ce25265b4f77 | ad44fca14ba655e1fbf3acf009be533613b6272f | refs/heads/master | 2019-01-21T15:51:50.968387 | 2016-05-09T13:57:46 | 2016-05-09T13:57:46 | 58,380,658 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,416 | cpp | #include "sort.h"
Sort::Sort(unsigned int _iSize) : iSize(_iSize)
{
pSourceArray = new int[_iSize];
pom = new int[iSize];
GenerateArray();
pSourceArray_CONST = new int[_iSize];
std::copy(pSourceArray, pSourceArray+iSize, pSourceArray_CONST);
DisplayArray("Początkowe");
}
Sort::~Sort()
{
delete [] pom;
delete [] pSourceArray;
delete [] pSourceArray_CONST;
}
void Sort::DisplayArray(std::string _strType, clock_t _t)
{
std::cout<<"Sortowanie "<<_strType<<std::endl;
if(_t)
std::cout << std::fixed << std::setprecision(10) <<"CPU time used: "
<< 1000.0 * _t/ CLOCKS_PER_SEC << " ms\n"<<std::endl;
for(int i = 0 ; i < iSize ; i++)
//std::cout<<"Tablica ["<<i<<"]= "<<pSourceArray[i]<<std::endl;
std::cout<< pSourceArray[i] <<",";
std::cout<<std::endl<<std::endl;
}
void Sort::GenerateArray()
{
srand (time(NULL));
for(int i = 0 ; i < iSize ; i++)
pSourceArray[i] = rand() % 99 + 1;
}
void Sort::BubbleSort()
{
/* start clock */
std::clock_t c_start = std::clock();
/* bubble algorythim */
int flag,temp;
do
{
flag=0;
for( int i = (iSize-1) ; i > 0 ; --i )
{
if( pSourceArray[i] < pSourceArray[i-1])
{
/* swap elements */
temp = pSourceArray[i];
pSourceArray[i] = pSourceArray[i-1];
pSourceArray[i-1] = temp;
flag=1;
}
}
}
while( flag != 0);
/* stop clock */
std::clock_t c_end = std::clock();
DisplayArray("Bąbelkowe",(c_end-c_start));
std::copy(pSourceArray_CONST, pSourceArray_CONST+iSize, pSourceArray);
}
void Sort::SelectionSort()
{
/* start clock */
std::clock_t c_start = std::clock();
/* selection sort algorythim */
int min,temp;
for(int i = 0 ; i < iSize ; ++i)
{
min=i;
for(int j = i+1 ; j < iSize ; ++j)
if(pSourceArray[j]<pSourceArray[min]) min=j; // find minimum
/* swap */
temp = pSourceArray[min];
pSourceArray[min] = pSourceArray[i];
pSourceArray[i] = temp;
}
/* stop clock */
std::clock_t c_end = std::clock();
DisplayArray("przez zamianę",(c_end-c_start));
std::copy(pSourceArray_CONST, pSourceArray_CONST+iSize, pSourceArray);
}
/* for QuickSort() */
void Sort::quicksort(int *array, int left, int right)
{
int i=left;
int j=right;
int pivot;
int swap;
pivot = array[(i+j)/2];
while(i<=j)
{
while(*(array+i) < pivot) i++;
while(*(array+j) > pivot) j--;
if(i<=j)
{
swap = *(array+i);
array[i] = *(array + j);
array[j] = swap;
i++;
j--;
}
}
if(left<j) quicksort(array,left,j);
if(i<right) quicksort(array,i,right);
}
void Sort::QuickSort()
{
/* start clock */
std::clock_t c_start = std::clock();
quicksort(pSourceArray,0,iSize-1);
/* stop clock */
std::clock_t c_end = std::clock();
DisplayArray("Quick",(c_end-c_start));
std::copy(pSourceArray_CONST, pSourceArray_CONST+iSize, pSourceArray);
}
void Sort::InsertSort()
{
/* start clock */
std::clock_t c_start = std::clock();
/* insert sort algorythim */
int temp, j;
for( int i = 1; i < iSize; ++i )
{
temp = pSourceArray[ i ];
for( j = i - 1; j >= 0 && pSourceArray[ j ] > temp; j-- )
{
pSourceArray[ j + 1 ] = pSourceArray[ j ];
}
pSourceArray[ j + 1] = temp;
}
/* stop clock */
std::clock_t c_end = std::clock();
DisplayArray("Insert",(c_end-c_start));
std::copy(pSourceArray_CONST, pSourceArray_CONST+iSize, pSourceArray);
}
/* for CountingSort() */
void Sort::findminmax(int *array, int size, int &max, int &min)
{
max=0,min=MAX_ARRAY+1;
for(int i = 0 ; i < size ; i++)
{
if(array[i]>max) max = array[i];
if(array[i]<min) min = array[i];
}
}
void Sort::CountingSort()
{
/* start clock */
std::clock_t c_start = std::clock();
int i,max,min,z=0;
findminmax(pSourceArray,iSize,max,min);
int nlen = (max-min)+1;
int * helpArray = new int[nlen];
for(i = 0 ; i < nlen ; ++i) helpArray[i]=0;
for(i = 0 ; i < iSize ; ++i) helpArray[pSourceArray[i]-min]++;
for(i = 0 ; i <=(max-min) ; i++)
{
while(helpArray[i]!=0)
{
pSourceArray[z++]= i + min;
helpArray[i]--;
}
}
/* stop clock */
std::clock_t c_end = std::clock();
DisplayArray("Counting",(c_end-c_start));
std::copy(pSourceArray_CONST, pSourceArray_CONST+iSize, pSourceArray);
}
/* for HeapSort() */
void Sort::shiftRight(int* array, int low, int high)
{
int root = low;
while ((root*2)+1 <= high)
{
int leftChild = (root * 2) + 1;
int rightChild = leftChild + 1;
int swapIdx = root;
/*Check if root is less than left child*/
if (array[swapIdx] < array[leftChild])
{
swapIdx = leftChild;
}
/*If right child exists check if it is less than current root*/
if ((rightChild <= high) && (array[swapIdx] < array[rightChild]))
{
swapIdx = rightChild;
}
/*Make the biggest element of root, left and right child the root*/
if (swapIdx != root)
{
int tmp = array[root];
array[root] = array[swapIdx];
array[swapIdx] = tmp;
/*Keep shifting right and ensure that swapIdx satisfies
heap property aka left and right child of it is smaller than
itself*/
root = swapIdx;
}
else
{
break;
}
}
}
/* for HeapSort() */
void Sort::heapify(int* array, int low, int high)
{
/*Start with middle element. Middle element is chosen in
such a way that the last element of array is either its
left child or right child*/
int midIdx = (high - low -1)/2;
while (midIdx >= 0)
{
shiftRight(array, midIdx, high);
--midIdx;
}
}
void Sort::HeapSort()
{
/* start clock */
std::clock_t c_start = std::clock();
assert(pSourceArray);
assert(iSize > 0);
/*This will put max element in the index 0*/
heapify(pSourceArray, 0, iSize-1);
int high = iSize - 1;
while (high > 0)
{
/*Swap max element with high index in the array*/
int tmp = pSourceArray[high];
pSourceArray[high] = pSourceArray[0];
pSourceArray[0] = tmp;
--high;
/*Ensure heap property on remaining elements*/
shiftRight(pSourceArray, 0, high);
}
/* stop clock */
std::clock_t c_end = std::clock();
DisplayArray("Heap",(c_end-c_start));
std::copy(pSourceArray_CONST, pSourceArray_CONST+iSize, pSourceArray);
}
/* for MargeSort() */
void Sort::Marge(int * array, int left, int middle, int right)
{
int i, j;
/* Save left part of subarray in helpArray */
for(i = middle + 1; i>left; i--)
pom[i-1] = array[i-1];
/* Save right part of subarray in helpArray */
for(j = middle; j<right; j++)
pom[right+middle-j] = array[j+1];
/* marge two subarrays and save in good one */
for(int k=left;k<=right;k++)
if(pom[j]<pom[i])
array[k] = pom[j--];
else
array[k] = pom[i++];
}
/* for MargeSort() */
void Sort::margesort(int * array, int left, int right)
{
/* only one element */
if(right<=left)
return;
/* middle of subarray */
int middle = (right+left)/2;
margesort(array, left, middle);
margesort(array, middle+1, right);
/* marge two sorted arrays */
Marge(array, left, middle, right);
}
void Sort::MargeSort()
{
/* start clock */
std::clock_t c_start = std::clock();
margesort(pSourceArray, 0, iSize-1);
/* stop clock */
std::clock_t c_end = std::clock();
DisplayArray("Marge",(c_end-c_start));
std::copy(pSourceArray_CONST, pSourceArray_CONST+iSize, pSourceArray);
}
| [
"rafal_strawinski@o2.pl"
] | rafal_strawinski@o2.pl |
e1d4f32d68d7711b62fa40cdab6557ffcb901594 | 622cf161272905c39f986796bd431996825f64fb | /kglt/ui/rocket/Source/Controls/ElementDataGridRow.cpp | 38edb65c4b09b39617155923e112f0be3029f5c4 | [
"BSD-2-Clause"
] | permissive | aonorin/KGLT | 03faffd80201b1665ccf724d314d1625707248ff | 998c1aca7f27d89bf32e975fd13a0fdf84f86d39 | refs/heads/master | 2020-12-25T15:50:36.040120 | 2016-02-16T09:53:17 | 2016-02-16T09:53:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 18,259 | cpp | /*
* This source file is part of libRocket, the HTML/CSS Interface Middleware
*
* For the latest information, see http://www.librocket.com
*
* Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
#include "../../Include/Rocket/Controls/ElementDataGridRow.h"
#include "../../Include/Rocket/Core.h"
#include "../../Include/Rocket/Controls/DataSource.h"
#include "../../Include/Rocket/Controls/DataFormatter.h"
#include "../../Include/Rocket/Controls/ElementDataGrid.h"
#include "../../Include/Rocket/Controls/ElementDataGridCell.h"
namespace Rocket {
namespace Controls {
const float MAX_UPDATE_TIME = 0.01f;
ElementDataGridRow::ElementDataGridRow(const Rocket::Core::String& tag) : Core::Element(tag)
{
parent_grid = NULL;
parent_row = NULL;
child_index = -1;
depth = -1;
data_source = NULL;
table_relative_index = -1;
table_relative_index_dirty = true;
dirty_cells = true;
dirty_children = false;
row_expanded = true;
SetProperty("white-space", "nowrap");
SetProperty("display", Rocket::Core::Property(Rocket::Core::DISPLAY_INLINE_BLOCK, Rocket::Core::Property::KEYWORD));
}
ElementDataGridRow::~ElementDataGridRow()
{
if (data_source)
{
data_source->DetachListener(this);
data_source = NULL;
}
}
void ElementDataGridRow::Initialise(ElementDataGrid* _parent_grid, ElementDataGridRow* _parent_row, int _child_index, ElementDataGridRow* header_row, int _depth)
{
parent_grid = _parent_grid;
parent_row = _parent_row;
child_index = _child_index;
depth = _depth;
// We start all the rows collapsed, except for the root row.
if (child_index != -1)
{
row_expanded = false;
}
int num_columns = parent_grid->GetNumColumns();
Rocket::Core::XMLAttributes cell_attributes;
for (int i = 0; i < num_columns; i++)
{
ElementDataGridCell* cell = dynamic_cast< ElementDataGridCell* >(Core::Factory::InstanceElement(this, "#rktctl_datagridcell", "datagridcell", cell_attributes));
cell->Initialise(i, header_row->GetChild(i));
cell->SetProperty("display", Rocket::Core::Property(Rocket::Core::DISPLAY_INLINE_BLOCK, Rocket::Core::Property::KEYWORD));
AppendChild(cell);
cell->RemoveReference();
}
}
void ElementDataGridRow::SetChildIndex(int _child_index)
{
if (child_index != _child_index)
{
child_index = _child_index;
if (parent_row)
{
parent_row->ChildChanged(child_index);
}
}
}
int ElementDataGridRow::GetDepth()
{
return depth;
}
void ElementDataGridRow::SetDataSource(const Rocket::Core::String& data_source_name)
{
if (data_source != NULL)
{
data_source->DetachListener(this);
data_source = NULL;
}
if (ParseDataSource(data_source, data_table, data_source_name))
{
data_source->AttachListener(this);
RefreshRows();
}
}
bool ElementDataGridRow::UpdateChildren()
{
if (dirty_children)
{
float start_time = Core::GetSystemInterface()->GetElapsedTime();
RowQueue dirty_rows;
dirty_rows.push(this);
while (!dirty_rows.empty())
{
ElementDataGridRow* dirty_row = dirty_rows.front();
dirty_rows.pop();
float time_slice = MAX_UPDATE_TIME - (Core::GetSystemInterface()->GetElapsedTime() - start_time);
if (time_slice <= 0.0f)
break;
dirty_row->LoadChildren(time_slice);
for (size_t i = 0; i < dirty_row->children.size(); i++)
{
if (dirty_row->children[i]->dirty_cells || dirty_row->children[i]->dirty_children)
{
dirty_rows.push(dirty_row->children[i]);
}
}
}
return true;
}
return false;
}
// Returns the number of children that aren't dirty (have been loaded)
int ElementDataGridRow::GetNumLoadedChildren()
{
int num_loaded_children = 0;
for (size_t i = 0; i < children.size(); i++)
{
if (!children[i]->dirty_cells)
{
num_loaded_children++;
}
num_loaded_children += children[i]->GetNumLoadedChildren();
}
return num_loaded_children;
}
bool ElementDataGridRow::IsRowExpanded()
{
return row_expanded;
}
void ElementDataGridRow::ExpandRow()
{
row_expanded = true;
for (size_t i = 0; i < children.size(); i++)
{
children[i]->Show();
}
DirtyLayout();
}
void ElementDataGridRow::CollapseRow()
{
row_expanded = false;
for (size_t i = 0; i < children.size(); i++)
{
children[i]->Hide();
}
DirtyLayout();
}
void ElementDataGridRow::ToggleRow()
{
if (row_expanded)
{
CollapseRow();
}
else
{
ExpandRow();
}
}
// Returns the index of this row, relative to its parent.
int ElementDataGridRow::GetParentRelativeIndex()
{
return child_index;
}
// Returns the index of this row, relative to the table rather than its parent.
int ElementDataGridRow::GetTableRelativeIndex()
{
if (!parent_row)
{
return -1;
}
if (table_relative_index_dirty)
{
table_relative_index = parent_row->GetChildTableRelativeIndex(child_index);
table_relative_index_dirty = false;
}
return table_relative_index;
}
// Returns the parent row of this row.
ElementDataGridRow* ElementDataGridRow::GetParentRow()
{
return parent_row;
}
// Returns the grid that this row belongs to.
ElementDataGrid* ElementDataGridRow::GetParentGrid()
{
return parent_grid;
}
void ElementDataGridRow::OnDataSourceDestroy(DataSource* data_source)
{
if(data_source != NULL)
{
data_source->DetachListener(this);
data_source = NULL;
}
RemoveChildren();
}
void ElementDataGridRow::OnRowAdd(DataSource* _data_source, const Rocket::Core::String& _data_table, int first_row_added, int num_rows_added)
{
if (_data_source == data_source && _data_table == data_table)
AddChildren(first_row_added, num_rows_added);
}
void ElementDataGridRow::OnRowRemove(DataSource* _data_source, const Rocket::Core::String& _data_table, int first_row_removed, int num_rows_removed)
{
if (_data_source == data_source && _data_table == data_table)
RemoveChildren(first_row_removed, num_rows_removed);
}
void ElementDataGridRow::OnRowChange(DataSource* _data_source, const Rocket::Core::String& _data_table, int first_row_changed, int num_rows_changed)
{
if (_data_source == data_source && _data_table == data_table)
ChangeChildren(first_row_changed, num_rows_changed);
}
void ElementDataGridRow::OnRowChange(DataSource* _data_source, const Rocket::Core::String& _data_table)
{
if (_data_source == data_source && _data_table == data_table)
RefreshRows();
}
// Removes all the child cells and fetches them again from the data source.
void ElementDataGridRow::RefreshRows()
{
// Remove all our child rows from the table.
RemoveChildren();
// Load the children from the data source.
if (data_source != NULL)
{
int num_rows = data_source->GetNumRows(data_table);
if (num_rows > 0)
{
AddChildren(0, num_rows);
}
}
}
// Called when a row change (addition or removal) occurs in one of our
// children.
void ElementDataGridRow::ChildChanged(int child_row_index)
{
for (int i = child_row_index + 1; i < (int)children.size(); i++)
{
children[i]->DirtyTableRelativeIndex();
}
if (parent_row)
{
parent_row->ChildChanged(child_index);
}
}
// Checks if any columns are dependent on the number of children present, and
// refreshes them from the data source if they are.
void ElementDataGridRow::RefreshChildDependentCells()
{
if (child_index != -1)
{
for (int i = 0; i < parent_grid->GetNumColumns(); i++)
{
const ElementDataGrid::Column* column = parent_grid->GetColumn(i);
if (column->refresh_on_child_change)
{
DirtyCells();
}
}
}
}
// Called whenever a row is added or removed above ours.
void ElementDataGridRow::DirtyTableRelativeIndex()
{
for (size_t i = 0; i < children.size(); i++)
{
children[i]->DirtyTableRelativeIndex();
}
table_relative_index_dirty = true;
}
int ElementDataGridRow::GetChildTableRelativeIndex(int child_index)
{
// We start with our index, then count down each of the children until we
// reach child_index. For each child we skip by add one (for the child
// itself) and all of its descendants.
int child_table_index = GetTableRelativeIndex() + 1;
for (int i = 0; i < child_index; i++)
{
child_table_index++;
child_table_index += children[i]->GetNumDescendants();
}
return child_table_index;
}
// Adds children underneath this row, and fetches their contents (and possible
// children) from the row's data source.
void ElementDataGridRow::AddChildren(int first_row_added, int num_rows_added)
{
if (first_row_added == -1)
{
first_row_added = (int)children.size();
}
// prevent relayout of the document while adding rows
Core::ElementDocument* document = parent_grid->GetOwnerDocument();
document->LockLayout(true);
// We need to make a row for each new child, then pass through the cell
// information and the child's data source (if one exists.)
if (data_source != NULL)
{
for (int i = 0; i < num_rows_added; i++)
{
int row_index = first_row_added + i;
// Make a new row:
ElementDataGridRow* new_row = parent_grid->AddRow(this, row_index);
children.insert(children.begin() + row_index, new_row);
if (!row_expanded)
{
new_row->SetProperty("display", "none");
}
}
for (int i = first_row_added + num_rows_added; i < (int)children.size(); i++)
{
children[i]->SetChildIndex(i);
children[i]->DirtyTableRelativeIndex();
}
if (parent_row)
{
parent_row->ChildChanged(child_index);
}
}
document->LockLayout(false);
RefreshChildDependentCells();
DirtyRow();
Rocket::Core::Dictionary parameters;
parameters.Set("first_row_added", GetChildTableRelativeIndex(first_row_added));
parameters.Set("num_rows_added", num_rows_added);
parent_grid->DispatchEvent("rowadd", parameters);
}
void ElementDataGridRow::RemoveChildren(int first_row_removed, int num_rows_removed)
{
if (num_rows_removed == -1)
{
num_rows_removed = (int)children.size() - first_row_removed;
}
// prevent relayout of the document while removing rows
Core::ElementDocument* document = parent_grid->GetOwnerDocument();
document->LockLayout(true);
for (int i = num_rows_removed - 1; i >= 0; i--)
{
children[first_row_removed + i]->RemoveChildren();
parent_grid->RemoveRows(children[first_row_removed + i]->GetTableRelativeIndex());
}
children.erase(children.begin() + first_row_removed, children.begin() + (first_row_removed + num_rows_removed));
for (int i = first_row_removed; i < (int) children.size(); i++)
{
children[i]->SetChildIndex(i);
children[i]->DirtyTableRelativeIndex();
}
document->LockLayout(false);
Rocket::Core::Dictionary parameters;
parameters.Set("first_row_removed", GetChildTableRelativeIndex(first_row_removed));
parameters.Set("num_rows_removed", num_rows_removed);
parent_grid->DispatchEvent("rowremove", parameters);
}
void ElementDataGridRow::ChangeChildren(int first_row_changed, int num_rows_changed)
{
for (int i = first_row_changed; i < first_row_changed + num_rows_changed; i++)
children[i]->DirtyCells();
Rocket::Core::Dictionary parameters;
parameters.Set("first_row_changed", GetChildTableRelativeIndex(first_row_changed));
parameters.Set("num_rows_changed", num_rows_changed);
parent_grid->DispatchEvent("rowchange", parameters);
}
// Returns the number of rows under this row (children, grandchildren, etc)
int ElementDataGridRow::GetNumDescendants()
{
int num_descendants = (int)children.size();
for (size_t i = 0; i < children.size(); i++)
num_descendants += children[i]->GetNumDescendants();
return num_descendants;
}
// Adds the cell contents, and marks the row as loaded.
void ElementDataGridRow::Load(const DataQuery& row_information)
{
// Check for a data source. If they're both set then we set
// ourselves up with it.
if (row_information.IsFieldSet(DataSource::CHILD_SOURCE))
{
Rocket::Core::String data_source = row_information.Get< Rocket::Core::String >(DataSource::CHILD_SOURCE, "");
if (!data_source.Empty())
{
SetDataSource(data_source);
}
else
{
// If we've no data source, then we should remove any children.
RemoveChildren();
}
}
// Now load our cells.
for (int i = 0; i < parent_grid->GetNumColumns(); i++)
{
Core::Element* cell = GetChild(i);
if (cell)
{
// Fetch the column:
const ElementDataGrid::Column* column = parent_grid->GetColumn(i);
// Now we use the column's formatter to process the raw data into the
// XML string, and parse that into the actual Core::Elements. If there is
// no formatter, then we just send through the raw text, in CVS form.
Rocket::Core::StringList raw_data;
for (size_t i = 0; i < column->fields.size(); i++)
{
if (column->fields[i] == DataSource::DEPTH)
{
raw_data.push_back(Rocket::Core::String(8, "%d", depth));
}
else if (column->fields[i] == DataSource::NUM_CHILDREN)
{
raw_data.push_back(Rocket::Core::String(8, "%d", children.size()));
}
else
{
raw_data.push_back(row_information.Get< Rocket::Core::String >(column->fields[i], ""));
}
}
Rocket::Core::String cell_string;
if (column->formatter)
{
column->formatter->FormatData(cell_string, raw_data);
}
else
{
for (size_t i = 0; i < raw_data.size(); i++)
{
if (i > 0)
{
cell_string.Append(",");
}
cell_string.Append(raw_data[i]);
}
}
// Remove all the cell's current contents.
while (cell->GetNumChildren(true) > 0)
{
cell->RemoveChild(cell->GetChild(0));
}
// Add the new contents to the cell.
Core::Factory::InstanceElementText(cell, cell_string);
}
else
{
ROCKET_ERROR;
}
}
dirty_cells = false;
}
// Instantiates the children that haven't been fully loaded yet.
void ElementDataGridRow::LoadChildren(float time_slice)
{
float start_time = Core::GetSystemInterface()->GetElapsedTime();
int data_query_offset = -1;
int data_query_limit = -1;
// Iterate through the list of children and find the holes of unloaded
// rows.
// - If we find an unloaded element, and we haven't set the offset
// (beginning of the hole), then we've hit a new hole. We set the offset
// to the current index and the limit (size of the hole) to 1. If we've
// found a hole already and we find an unloaded element, then we
// increase the size of the hole.
// - The end of a hole is either a loaded element or the end of the list.
// In either case, we check if we have a hole that's unfilled, and if
// so, we fill it.
bool any_dirty_children = false;
for (size_t i = 0; i < children.size() && (Core::GetSystemInterface()->GetElapsedTime() - start_time) < time_slice; i++)
{
if (children[i]->dirty_cells)
{
any_dirty_children = true;
if (data_query_offset == -1)
{
data_query_offset = (int)i;
data_query_limit = 1;
}
else
{
data_query_limit++;
}
}
else if (children[i]->dirty_children)
{
any_dirty_children = true;
}
bool end_of_list = i == children.size() - 1;
bool unfilled_hole = data_query_offset != -1;
bool end_of_hole_found = !children[i]->dirty_cells;
// If this is the last element and we've found no holes (or filled them
// all in) then all our children are loaded.
if (end_of_list && !unfilled_hole)
{
if (!any_dirty_children)
{
dirty_children = false;
}
}
// Otherwise, if we have a hole outstanding and we've either hit the
// end of the list or the end of the hole, fill the hole.
else if (unfilled_hole && (end_of_list || end_of_hole_found))
{
float load_time_slice = time_slice - (Core::GetSystemInterface()->GetElapsedTime() - start_time);
LoadChildren(data_query_offset, data_query_limit, load_time_slice);
data_query_offset = -1;
data_query_limit = -1;
}
}
if (children.empty())
{
dirty_children = false;
}
}
void ElementDataGridRow::LoadChildren(int first_row_to_load, int num_rows_to_load, Rocket::Core::Time time_slice)
{
float start_time = Core::GetSystemInterface()->GetElapsedTime();
// Now fetch these new children from the data source, pass them
// through each column's data formatter, and add them as our new
// child rows.
Rocket::Core::String column_query = parent_grid->GetAllColumnFields() + "," + DataSource::CHILD_SOURCE;
DataQuery query(data_source, data_table, column_query, first_row_to_load, num_rows_to_load);
for (int i = 0; i < num_rows_to_load; i++)
{
int index = first_row_to_load + i;
if (!query.NextRow())
{
Core::Log::Message(Rocket::Core::Log::LT_WARNING, "Failed to load row %d from data source %s", i, data_table.CString());
}
// Now load the child with the row in the query.
children[index]->Load(query);
if (Core::GetSystemInterface()->GetElapsedTime() - start_time > time_slice)
{
break;
}
}
}
void ElementDataGridRow::DirtyCells()
{
dirty_cells = true;
if (parent_row)
{
parent_row->DirtyRow();
}
}
void ElementDataGridRow::DirtyRow()
{
dirty_children = true;
if (parent_row)
{
parent_row->DirtyRow();
}
}
// Sets this row's child rows to be visible.
void ElementDataGridRow::Show()
{
SetProperty("display", "inline-block");
if (row_expanded)
{
for (size_t i = 0; i < children.size(); i++)
{
children[i]->Show();
}
}
}
// Sets this row's children to be invisible.
void ElementDataGridRow::Hide()
{
SetProperty("display", "none");
for (size_t i = 0; i < children.size(); i++)
{
children[i]->Hide();
}
}
}
}
| [
"kazade@gmail.com"
] | kazade@gmail.com |
ed8e1f6c1ead0ef7d24b681f3083fa69c1a7b841 | cb80a8562d90eb969272a7ff2cf52c1fa7aeb084 | /inletTest3/0.13/turbulenceProperties.I | 734a3475ecaa88eb3ec825ddd041c6879c3f2da9 | [] | no_license | mahoep/inletCFD | eb516145fad17408f018f51e32aa0604871eaa95 | 0df91e3fbfa60d5db9d52739e212ca6d3f0a28b2 | refs/heads/main | 2023-08-30T22:07:41.314690 | 2021-10-14T19:23:51 | 2021-10-14T19:23:51 | 314,657,843 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 154,371 | i | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2006 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0.13";
object turbulenceProperties:I;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField nonuniform List<scalar>
16277
(
0.149961
0.149972
0.149974
0.149978
0.149979
0.149984
0.149988
0.149993
0.150001
0.150009
0.150015
0.150018
0.150018
0.150017
0.150015
0.150013
0.150011
0.150009
0.150008
0.150007
0.150006
0.150005
0.150005
0.150004
0.150004
0.150003
0.150003
0.150003
0.150003
0.150002
0.150002
0.150002
0.150002
0.150002
0.150002
0.150002
0.150002
0.150002
0.150002
0.150002
0.150002
0.150001
0.150001
0.150001
0.150001
0.150001
0.150001
0.150001
0.150001
0.150001
0.150001
0.150001
0.150001
0.150001
0.150001
0.150001
0.150001
0.150001
0.150001
0.150001
0.150001
0.150001
0.150001
0.150001
0.150001
0.150001
0.150001
0.15
0.15
0.15
0.15
0.15
0.15
0.149999
0.149999
0.149999
0.149998
0.149997
0.149995
0.149995
0.149997
0.150005
0.150018
0.150031
0.150035
0.150024
0.150006
0.149987
0.149966
0.149968
0.149981
0.149977
0.149989
0.150008
0.149873
0.149304
0.14506
0.13908
0.145978
0.148746
0.14598
0.139196
0.133277
0.129404
0.135533
0.143821
0.139874
0.129547
0.125375
0.12312
0.127253
0.138208
0.134539
0.122607
0.120471
0.11919
0.121242
0.133288
0.130276
0.117865
0.117439
0.116712
0.117167
0.129409
0.126995
0.114912
0.115549
0.115163
0.114556
0.126376
0.124398
0.112921
0.11435
0.114172
0.112769
0.123968
0.122297
0.111518
0.113571
0.113515
0.111487
0.121993
0.120552
0.110494
0.113058
0.113089
0.110551
0.12035
0.119086
0.109736
0.112727
0.112809
0.10985
0.118957
0.11782
0.109151
0.112502
0.112617
0.109299
0.117745
0.116713
0.108685
0.112352
0.112489
0.10886
0.116683
0.115736
0.10831
0.112254
0.112407
0.108506
0.115742
0.114869
0.108007
0.112194
0.112359
0.108219
0.114905
0.114094
0.107763
0.112163
0.112337
0.107991
0.114158
0.113402
0.107571
0.112156
0.112337
0.107814
0.113491
0.112786
0.107427
0.112168
0.112357
0.107685
0.112899
0.112243
0.107328
0.112199
0.112394
0.1076
0.112382
0.111772
0.107272
0.112246
0.112449
0.107561
0.111935
0.111369
0.107261
0.11231
0.11252
0.107565
0.111556
0.111032
0.107292
0.11239
0.112608
0.107613
0.111242
0.110758
0.107364
0.112486
0.112712
0.107702
0.11099
0.110542
0.107476
0.112599
0.112833
0.107831
0.110797
0.110384
0.107627
0.112727
0.112971
0.107998
0.11066
0.11028
0.107814
0.112871
0.113124
0.108203
0.110579
0.11023
0.108038
0.11303
0.113293
0.108446
0.110552
0.110233
0.108299
0.113206
0.113478
0.108726
0.110578
0.110288
0.108596
0.113397
0.11368
0.109043
0.110657
0.110396
0.108929
0.113603
0.113898
0.109397
0.110789
0.110555
0.109299
0.113826
0.114133
0.10979
0.110973
0.110767
0.109707
0.114065
0.114384
0.110221
0.111211
0.111031
0.110154
0.114319
0.114651
0.110693
0.111503
0.111349
0.110641
0.11459
0.114935
0.111205
0.111849
0.111722
0.111167
0.114875
0.115234
0.111759
0.11225
0.112148
0.111736
0.115175
0.115546
0.112355
0.112704
0.112627
0.112344
0.115487
0.115871
0.11299
0.113212
0.113156
0.112989
0.115808
0.116204
0.113661
0.113768
0.113733
0.113669
0.116135
0.11654
0.114365
0.11437
0.114351
0.114377
0.116462
0.116873
0.115094
0.115009
0.115002
0.115106
0.116781
0.117195
0.115838
0.115678
0.115677
0.115846
0.117083
0.117494
0.116586
0.116362
0.11636
0.116581
0.117356
0.117756
0.117319
0.117045
0.11703
0.117292
0.117585
0.117965
0.118014
0.117703
0.117662
0.117952
0.117748
0.118098
0.11864
0.118304
0.118222
0.118529
0.117825
0.118132
0.11916
0.118814
0.118673
0.118985
0.117788
0.118038
0.119532
0.119192
0.118972
0.119276
0.117618
0.117757
0.119688
0.119393
0.119067
0.119301
0.117292
0.117289
0.119541
0.119349
0.118902
0.119016
0.116784
0.116625
0.119064
0.119022
0.118442
0.118398
0.116128
0.115785
0.118244
0.118387
0.117674
0.117448
0.1153
0.114826
0.11711
0.117455
0.116629
0.1162
0.114281
0.113752
0.115654
0.116221
0.115268
0.114595
0.113076
0.112521
0.113851
0.114676
0.113624
0.112689
0.111785
0.111302
0.111846
0.11293
0.111839
0.11067
0.110575
0.110162
0.10978
0.111082
0.109993
0.108639
0.109474
0.109134
0.107752
0.109212
0.108158
0.106689
0.108506
0.108247
0.105842
0.107385
0.106395
0.104875
0.10769
0.107512
0.104109
0.105656
0.104749
0.103216
0.107033
0.106928
0.102576
0.104078
0.103249
0.10177
0.106531
0.106491
0.101258
0.10266
0.101904
0.100546
0.106177
0.106193
0.100159
0.10142
0.100743
0.0995466
0.105958
0.106019
0.0992789
0.100362
0.0997668
0.0987647
0.105857
0.105953
0.0986077
0.0994842
0.0989692
0.0981811
0.105849
0.105974
0.0981057
0.0987696
0.0983279
0.097758
0.10592
0.106063
0.0977557
0.0981982
0.097823
0.0974802
0.106051
0.106201
0.0975402
0.0977503
0.0974341
0.0973278
0.106223
0.106372
0.0974345
0.097404
0.0971382
0.0972768
0.106419
0.10656
0.0974159
0.0971365
0.0969123
0.0973029
0.106624
0.106751
0.097461
0.0969268
0.0967341
0.0973824
0.106826
0.106936
0.0975468
0.0967524
0.0965842
0.0974936
0.107015
0.107103
0.0976542
0.0965996
0.0964428
0.0976188
0.107188
0.107256
0.097769
0.0964593
0.0963079
0.0977455
0.107344
0.107393
0.0978803
0.0963227
0.0961727
0.0978642
0.10748
0.107517
0.0979821
0.0961881
0.0960303
0.0979659
0.107596
0.107626
0.0980698
0.0960469
0.0958779
0.0980449
0.107681
0.107709
0.0981399
0.0958939
0.0957132
0.0981058
0.107747
0.107771
0.098189
0.0957258
0.0955348
0.0981445
0.107794
0.107815
0.098217
0.0955442
0.0953416
0.0981628
0.107829
0.107848
0.0982264
0.0953467
0.0951316
0.0981648
0.107857
0.10787
0.0982154
0.0951301
0.0949026
0.0981452
0.107872
0.107883
0.0981865
0.0948963
0.0946583
0.0981064
0.107877
0.107883
0.0981387
0.0946452
0.094398
0.0980468
0.107871
0.107872
0.0980716
0.0943785
0.0941206
0.0979662
0.107853
0.107853
0.097986
0.0940942
0.0938238
0.0978715
0.10783
0.107822
0.0978726
0.0937833
0.0934803
0.0977218
0.107789
0.107697
0.0976861
0.0934185
0.0931367
0.0976257
0.107651
0.107432
0.0972583
0.0928894
0.0926449
0.0971418
0.106996
0.106291
0.0955989
0.0919086
0.0928334
0.0958742
0.104158
0.105096
0.0933928
0.0905926
0.0953263
0.100925
0.107146
0.11269
0.11635
0.120711
0.12352
0.125771
0.127336
0.12839
0.128918
0.128949
0.128435
0.127317
0.125553
0.122566
0.120262
0.115106
0.11027
0.105085
0.100386
0.0991201
0.102111
0.116044
0.131492
0.133541
0.117519
0.103043
0.10406
0.11917
0.135236
0.136279
0.120321
0.10469
0.105205
0.120947
0.137166
0.137418
0.12128
0.105454
0.105805
0.121507
0.137701
0.137775
0.121722
0.105911
0.106
0.121785
0.137801
0.137809
0.12179
0.106081
0.106122
0.121812
0.137795
0.137764
0.121813
0.106209
0.106233
0.12181
0.137746
0.137712
0.121814
0.106323
0.106338
0.121785
0.137674
0.137649
0.121815
0.106433
0.106451
0.121783
0.137606
0.137578
0.121814
0.106549
0.106565
0.121775
0.137525
0.137489
0.12179
0.106659
0.106673
0.121773
0.137452
0.137416
0.121762
0.106769
0.106781
0.121755
0.137371
0.137334
0.121753
0.106882
0.106902
0.121751
0.137289
0.137249
0.121746
0.107011
0.107029
0.121748
0.137206
0.137165
0.121746
0.107135
0.107154
0.121745
0.137123
0.137079
0.121736
0.107263
0.107281
0.12174
0.137038
0.136992
0.121734
0.107392
0.107411
0.121734
0.136956
0.136909
0.121717
0.107519
0.107535
0.12172
0.136865
0.136825
0.121723
0.107654
0.107673
0.121718
0.136776
0.136738
0.121736
0.107793
0.107815
0.121719
0.13669
0.13665
0.121743
0.107943
0.10797
0.121743
0.136603
0.136565
0.121771
0.108096
0.108116
0.121747
0.136512
0.136479
0.121776
0.108241
0.108258
0.121766
0.136432
0.136398
0.121802
0.108382
0.108402
0.121784
0.136349
0.136315
0.121823
0.108533
0.108554
0.121822
0.136274
0.136242
0.121864
0.108678
0.108693
0.121842
0.136192
0.136165
0.121886
0.10882
0.108832
0.121878
0.136116
0.136088
0.121926
0.108951
0.108957
0.121901
0.136038
0.136012
0.121947
0.109072
0.109074
0.121943
0.135972
0.13595
0.121991
0.109174
0.109163
0.121961
0.135904
0.135882
0.122001
0.109249
0.109227
0.121982
0.135842
0.135818
0.122012
0.10929
0.109251
0.121964
0.135773
0.135746
0.121975
0.109293
0.109236
0.121936
0.135703
0.135676
0.12191
0.109239
0.109156
0.12186
0.135632
0.135592
0.121798
0.109128
0.10902
0.121716
0.135545
0.135496
0.121591
0.108926
0.108771
0.121463
0.135447
0.135379
0.121281
0.108616
0.108419
0.121075
0.135312
0.135236
0.120836
0.108211
0.107943
0.12055
0.135144
0.135037
0.120227
0.107695
0.107339
0.119834
0.134902
0.134755
0.119374
0.107023
0.106564
0.11881
0.134578
0.134373
0.118206
0.106182
0.105624
0.117486
0.134133
0.133889
0.116709
0.105162
0.104506
0.115832
0.133595
0.13327
0.114903
0.103998
0.103293
0.113849
0.132884
0.13246
0.112751
0.102745
0.101968
0.111437
0.131979
0.131467
0.110109
0.101337
0.100457
0.108558
0.130898
0.130338
0.107053
0.0997489
0.0988779
0.105347
0.129713
0.129041
0.103672
0.0981728
0.0973419
0.101651
0.128095
0.126777
0.0997085
0.0965712
0.0957849
0.0980746
0.125337
0.124056
0.0961535
0.0951349
0.0945824
0.0943496
0.122891
0.121687
0.0932718
0.0945856
0.0943031
0.0923572
0.120598
0.119608
0.0909606
0.0946031
0.0946184
0.0902356
0.11851
0.117277
0.0896625
0.095316
0.0956643
0.0894253
0.116074
0.115189
0.0898136
0.0969526
0.0975081
0.0898426
0.11434
0.113463
0.090997
0.0991815
0.1003
0.0924304
0.112409
0.112548
0.0958103
0.103337
0.105046
0.0984402
0.113799
0.134412
0.0900911
0.085459
0.0975063
0.0950369
0.126256
0.12581
0.0918175
0.0965578
0.0974351
0.0908497
0.125436
0.124187
0.0894249
0.0969928
0.0984035
0.0891244
0.122711
0.120751
0.0883701
0.0984162
0.100746
0.0892069
0.118825
0.117335
0.0893523
0.100971
0.104388
0.0920397
0.116062
0.114883
0.0932475
0.105729
0.111215
0.0981722
0.114576
0.11556
0.101164
0.114004
0.088048
0.0878354
0.130865
0.121091
0.0945287
0.106664
0.10729
0.093622
0.119237
0.117089
0.0965171
0.112741
0.114267
0.0972269
0.115912
0.115095
0.100727
0.118801
0.121072
0.102471
0.114401
0.116164
0.108381
0.126406
0.12848
0.112783
0.118247
0.126331
0.0947623
0.0975763
0.120793
0.101151
0.121279
0.119644
0.100898
0.122068
0.128241
0.105736
0.119214
0.118972
0.107473
0.129778
0.138219
0.116016
0.120374
0.124256
0.12242
0.142099
0.107714
0.0983784
0.130956
0.122586
0.111554
0.137705
0.141122
0.114199
0.121429
0.122847
0.125041
0.152662
0.157719
0.131644
0.125583
0.132275
0.142125
0.164123
0.125991
0.109487
0.132776
0.127636
0.129528
0.161903
0.165985
0.133182
0.128703
0.13466
0.152224
0.18225
0.189829
0.162917
0.141637
0.138041
0.124627
0.151878
0.195952
0.158098
0.137565
0.141107
0.166738
0.206172
0.229859
0.195577
0.153732
0.161889
0.208528
0.240919
0.209768
0.166636
0.151656
0.170736
0.228739
0.267271
0.287758
0.250139
0.184641
0.171545
0.207825
0.265932
0.345734
0.302426
0.212875
0.245397
0.354044
0.398733
0.438109
0.347624
0.237572
0.414264
0.610576
0.648555
0.918442
0.847728
0.510995
1
1
1
0.825026
0.796972
0.508864
0.275481
0.424562
0.471717
0.342322
0.308892
0.213222
0.211392
0.276984
0.289235
0.239438
0.199197
0.171727
0.1777
0.216372
0.232981
0.192661
0.16481
0.149175
0.149921
0.177829
0.198282
0.187221
0.162681
0.140699
0.136279
0.122641
0.146534
0.165856
0.14837
0.137551
0.129491
0.123884
0.138535
0.15568
0.136752
0.127521
0.12255
0.127768
0.148962
0.116669
0.105225
0.122006
0.120883
0.119951
0.13933
0.133155
0.114361
0.118611
0.120607
0.0981222
0.10465
0.127822
0.109796
0.116664
0.11569
0.105993
0.121747
0.0971723
0.0941836
0.119655
0.113935
0.10304
0.11937
0.112908
0.0997785
0.113744
0.119156
0.0908486
0.0912977
0.111419
0.0974454
0.110907
0.111261
0.0942669
0.10534
0.0862037
0.0871935
0.117613
0.108773
0.0930382
0.105209
0.0994908
0.0901512
0.109689
0.116576
0.0844231
0.0824933
0.0997668
0.0889765
0.106335
0.107774
0.086286
0.094794
0.0795307
0.0818408
0.115178
0.104507
0.0867647
0.0964741
0.0894749
0.0830692
0.105046
0.108418
0.0804029
0.0839477
0.0738004
0.0768869
0.122197
0.10563
0.0778851
0.0851834
0.0816073
0.076682
0.10838
0.116675
0.0770482
0.0716952
0.0804737
0.0753242
0.10205
0.106124
0.0750638
0.0777153
0.0690421
0.0735493
0.119004
0.102025
0.0720871
0.0769023
0.074386
0.0721497
0.105637
0.115236
0.0736616
0.0669422
0.0736664
0.0706913
0.0999574
0.104712
0.07097
0.0716185
0.0658374
0.0734546
0.114639
0.099025
0.0683328
0.070431
0.0688755
0.0690343
0.103428
0.116928
0.070184
0.0635928
0.0688961
0.0667078
0.0991104
0.103342
0.0679775
0.0671765
0.062325
0.068936
0.116494
0.0982663
0.064199
0.0654981
0.0643891
0.0661992
0.10313
0.11901
0.0677092
0.0604547
0.0631606
0.0640186
0.100814
0.109915
0.0671502
0.0590634
0.065291
0.0630008
0.0934004
0.0971904
0.0634322
0.0632483
0.0601368
0.0686253
0.108255
0.0937788
0.0633184
0.0639107
0.0627366
0.0634545
0.0982894
0.109222
0.0685606
0.0597006
0.0632406
0.0627679
0.0933925
0.0974194
0.0622883
0.0615981
0.0592305
0.0692775
0.108704
0.0940285
0.0614213
0.0603727
0.0588145
0.0610726
0.100148
0.11188
0.0703219
0.0576821
0.0586678
0.060468
0.0943615
0.0990851
0.0605605
0.0571131
0.0565171
0.0679844
0.113589
0.0961109
0.0565109
0.0567669
0.0549204
0.0653558
0.106422
0.0919651
0.0577071
0.0566458
0.0547368
0.0574003
0.0967122
0.107273
0.0680269
0.0548609
0.0551611
0.0571773
0.0919037
0.0969843
0.0568111
0.0526524
0.0539743
0.068301
0.110878
0.0939612
0.0537057
0.0529168
0.0520663
0.0636784
0.104604
0.089429
0.0548573
0.0530797
0.0510027
0.054745
0.0938402
0.104618
0.0666661
0.0521497
0.0525847
0.0549847
0.0899646
0.0953114
0.0551137
0.0504423
0.0523663
0.0674961
0.109418
0.0929324
0.0516594
0.0503033
0.0502313
0.0628177
0.104042
0.088753
0.0530929
0.0510601
0.0487812
0.0531508
0.0932965
0.104268
0.0661411
0.0503436
0.0499116
0.0528429
0.0894799
0.0956114
0.0529263
0.0476557
0.050651
0.0701803
0.105387
0.0915599
0.0505519
0.0475285
0.0480082
0.061527
0.103485
0.0876546
0.0503735
0.048104
0.046419
0.0514273
0.0924652
0.105596
0.0662095
0.0492936
0.0463413
0.0483671
0.0899071
0.101078
0.0606739
0.0469851
0.046834
0.0491244
0.0857409
0.0924391
0.0497422
0.0446534
0.0481259
0.0672937
0.103888
0.0895771
0.0487517
0.045503
0.0463903
0.0603907
0.100301
0.0845199
0.0483898
0.046035
0.0441247
0.0493901
0.0908909
0.102088
0.0671204
0.047599
0.0448432
0.0478177
0.0878829
0.0994678
0.0598481
0.0458269
0.0454869
0.0477751
0.084547
0.0909054
0.049278
0.0436881
0.0474681
0.06562
0.10429
0.0886452
0.04695
0.0444249
0.0453913
0.0596883
0.0989944
0.0842755
0.0473362
0.0449127
0.043263
0.0482932
0.0901691
0.0999144
0.0675403
0.0472382
0.0439767
0.0466559
0.0877195
0.100261
0.061708
0.0461082
0.0433302
0.0446029
0.085334
0.095588
0.0581866
0.0445705
0.0442721
0.0465012
0.0822125
0.087728
0.0479208
0.0425772
0.0462914
0.0646375
0.0994896
0.0853644
0.0458203
0.0430078
0.0442655
0.0587586
0.0967406
0.0826295
0.0460674
0.0436384
0.0421742
0.047562
0.0888949
0.0984752
0.0668623
0.046387
0.0429486
0.0459192
0.0871174
0.0995884
0.0609062
0.0453661
0.0423432
0.0437981
0.0853541
0.0945603
0.0572374
0.0434928
0.0427715
0.0451055
0.0804929
0.0862373
0.0464929
0.0411701
0.0453458
0.0634838
0.0991964
0.0850709
0.04443
0.041871
0.0442901
0.0591944
0.0966722
0.082819
0.0425989
0.0415876
0.043134
0.0571319
0.09245
0.0799806
0.0447938
0.0424427
0.0411151
0.0466921
0.0863463
0.0968324
0.0646815
0.0452628
0.0417981
0.0447452
0.0840378
0.0957368
0.0592379
0.0442557
0.0412055
0.0424397
0.0819571
0.0914328
0.0563991
0.0426398
0.0417898
0.0440789
0.0784589
0.0840713
0.0458211
0.0404225
0.0447007
0.0628816
0.0962392
0.0831921
0.0439997
0.0412426
0.0438248
0.0586933
0.0946063
0.0818515
0.0423446
0.0409671
0.042619
0.0566646
0.091034
0.0781845
0.0439398
0.0415425
0.040203
0.0457985
0.0838358
0.0976182
0.0620257
0.0446311
0.0408393
0.0433404
0.0839659
0.0952445
0.0582212
0.0434283
0.0403615
0.0412655
0.0815776
0.0911242
0.0564801
0.0422924
0.0409174
0.0434371
0.0780728
0.0836868
0.0452872
0.0396317
0.0442767
0.0619893
0.0974168
0.0834172
0.0432995
0.0405066
0.0431536
0.0583369
0.0942674
0.0801951
0.0409405
0.0398805
0.0424298
0.056144
0.0901094
0.0780577
0.0409211
0.0394981
0.0415134
0.0554119
0.0874033
0.0754361
0.042507
0.0401
0.0390541
0.0444856
0.0813247
0.0911835
0.0628802
0.0436102
0.0402079
0.0433968
0.0811888
0.0932691
0.0578774
0.0431296
0.0396518
0.0412108
0.0807338
0.0903414
0.0561378
0.0421598
0.0390935
0.0405321
0.0774923
0.0864711
0.0549729
0.0411182
0.0395863
0.0420741
0.0746508
0.0801525
0.0439035
0.0384153
0.0431567
0.0604384
0.0930873
0.0803319
0.0420781
0.0393683
0.0421301
0.0567659
0.091488
0.0785775
0.0399881
0.0388951
0.0415448
0.0549173
0.0881106
0.0763023
0.0400163
0.0386079
0.0408313
0.0547717
0.0853069
0.074151
0.0419071
0.0391781
0.0381565
0.0438133
0.0793886
0.0921163
0.0600168
0.0430443
0.0390044
0.0419715
0.0795881
0.0906767
0.0563838
0.0419071
0.038489
0.0395313
0.0780037
0.0878332
0.0548168
0.0412726
0.0382054
0.0397774
0.0760667
0.0851302
0.0543877
0.0404568
0.0385245
0.0413092
0.0733942
0.0791649
0.0431798
0.0375893
0.04265
0.0613005
0.0882419
0.0787321
0.042027
0.0387314
0.0419653
0.0562019
0.0901352
0.0773898
0.0394804
0.0382291
0.0410646
0.0546053
0.0868104
0.075279
0.039262
0.0377044
0.040383
0.0534573
0.0846968
0.0737521
0.0390472
0.0374608
0.0398156
0.0531066
0.0824557
0.0719477
0.0408989
0.0378992
0.0370828
0.0430142
0.077315
0.0909892
0.05873
0.0423611
0.037851
0.0410427
0.0780094
0.0889619
0.0554993
0.041233
0.0374704
0.0386818
0.076582
0.0860355
0.053826
0.0405135
0.0372022
0.0387176
0.0744145
0.0835672
0.0531716
0.0399709
0.0369416
0.0388245
0.0729185
0.081364
0.0525435
0.0391894
0.0372596
0.040085
0.0705057
0.0756724
0.0419202
0.036395
0.0416518
0.0580036
0.0873395
0.0754028
0.0402415
0.037398
0.0408195
0.05465
0.0860516
0.0740924
0.0384514
0.0370682
0.0400273
0.0527913
0.0834973
0.0726197
0.0382036
0.0367818
0.0396659
0.0524407
0.0816509
0.0713557
0.0385948
0.0366845
0.0389695
0.0517627
0.0796029
0.0695163
0.0397696
0.0369213
0.0361822
0.04187
0.0745714
0.0871877
0.0570958
0.0414413
0.0368521
0.0399475
0.0754631
0.0857989
0.0539675
0.0402978
0.0364281
0.0377749
0.0742735
0.0835218
0.0521916
0.0396848
0.0361634
0.0375073
0.072475
0.0813049
0.0517945
0.0391948
0.0360081
0.0378447
0.0708768
0.0787974
0.0514095
0.0385006
0.036322
0.0391749
0.0683601
0.0735104
0.0412068
0.0355897
0.0408832
0.0567079
0.0850626
0.0738102
0.0394256
0.0363882
0.0399294
0.0532246
0.0840512
0.0724876
0.0373119
0.0359563
0.0391242
0.0512916
0.0813957
0.0707761
0.037025
0.0356732
0.038763
0.0508585
0.0794007
0.0695147
0.0373924
0.0355299
0.0381134
0.0506566
0.0774823
0.0675568
0.0387361
0.0357546
0.0351483
0.0409969
0.0728347
0.0857928
0.0558494
0.0406921
0.0357264
0.0389449
0.0735381
0.0835796
0.0530195
0.0395595
0.0352334
0.0368178
0.0719972
0.0808347
0.0508631
0.0387203
0.0349743
0.036447
0.0703911
0.0790847
0.0504608
0.0383207
0.034887
0.0367192
0.0691112
0.0773516
0.0500746
0.0380267
0.034774
0.036745
0.0675975
0.0753329
0.0495248
0.0372739
0.0349907
0.037895
0.0654023
0.0707595
0.0397453
0.034376
0.039642
0.0554707
0.0803782
0.0704911
0.0384368
0.0352478
0.038897
0.0514973
0.0801099
0.0692692
0.0363461
0.03479
0.038095
0.049881
0.077589
0.0675552
0.0361628
0.0345549
0.037668
0.0493014
0.075514
0.0661669
0.0364459
0.0344757
0.0370938
0.0486868
0.0736821
0.0644124
0.0374456
0.0345863
0.0340527
0.0395325
0.0697372
0.0802038
0.0544677
0.0395329
0.0348432
0.0380401
0.0698075
0.079375
0.0511439
0.038678
0.0342985
0.0360882
0.0689382
0.0771697
0.0493584
0.0377472
0.0339315
0.0355638
0.0672594
0.0750844
0.0486959
0.0372673
0.0337139
0.0357047
0.0656742
0.0732529
0.0482362
0.0365262
0.0337916
0.0368045
0.063609
0.0691279
0.0386677
0.033256
0.0388042
0.0544409
0.0782214
0.0685407
0.0376898
0.034181
0.0380245
0.0503393
0.0777617
0.0673303
0.0355147
0.0336662
0.0371813
0.0487106
0.0752298
0.0655573
0.0351753
0.0333106
0.0365842
0.0478513
0.0733158
0.0641567
0.0351437
0.0331512
0.0359808
0.0473944
0.0717561
0.0625312
0.0362053
0.0332214
0.0327222
0.0383498
0.0677996
0.0774854
0.0532778
0.0383892
0.0336224
0.0370475
0.0675589
0.0766755
0.0497793
0.0376039
0.0331026
0.0351153
0.0664474
0.0744944
0.0482392
0.036764
0.032806
0.0347923
0.0648881
0.0728212
0.0475424
0.0363344
0.0326135
0.0347698
0.0635669
0.071307
0.0471152
0.0356247
0.0326689
0.0357526
0.0620986
0.0673125
0.0377065
0.0321556
0.0378313
0.0526389
0.0763078
0.0666195
0.0366208
0.0331248
0.0370346
0.049025
0.0751463
0.0649041
0.0346299
0.0326214
0.0361489
0.0472345
0.0727275
0.0629846
0.0341715
0.032251
0.0354723
0.0467118
0.0708686
0.0621694
0.0355408
0.0322375
0.0318845
0.0378393
0.067615
0.0779156
0.0525873
0.0381356
0.032868
0.0363945
0.0673031
0.0758902
0.0491124
0.0370547
0.0322428
0.0343834
0.0655221
0.0734413
0.0473694
0.0360418
0.0318173
0.0339238
0.0633254
0.0711606
0.046723
0.0352606
0.0317102
0.0351689
0.0617453
0.0672723
0.037055
0.0312459
0.0373398
0.0529129
0.0750731
0.0658437
0.0361765
0.0323237
0.0363831
0.0482276
0.074446
0.0637623
0.0335663
0.0316483
0.035579
0.0467383
0.0720216
0.0628457
0.0336834
0.0314075
0.0350368
0.0465483
0.070763
0.0615521
0.0348841
0.0312875
0.0310029
0.0372968
0.0669755
0.0772185
0.05183
0.0376026
0.0319402
0.0356
0.066083
0.0748539
0.0484306
0.0363938
0.0313744
0.0336296
0.0642409
0.0720837
0.0465708
0.0352918
0.0308822
0.03317
0.0622171
0.0701212
0.0458746
0.034455
0.0307301
0.0342552
0.0609492
0.0662405
0.0362981
0.0302899
0.0367175
0.051032
0.0748174
0.0645086
0.0349843
0.0313776
0.0358111
0.0478082
0.0734585
0.06335
0.0333803
0.0310146
0.0350084
0.0461483
0.0713537
0.0619035
0.0329955
0.0307538
0.0344755
0.0458137
0.0698105
0.0608477
0.0343556
0.0306581
0.0303809
0.0366152
0.066376
0.0749831
0.0516326
0.0371344
0.0315021
0.0355187
0.0645752
0.0731197
0.0477662
0.0359201
0.0308279
0.0333777
0.0627605
0.070575
0.0460207
0.0345938
0.0303001
0.0338949
0.0609396
0.0658584
0.0355692
0.0298715
0.0367424
0.0511918
0.0750768
0.064353
0.034927
0.0311018
0.0357481
0.0477093
0.0730782
0.0630459
0.0332443
0.0306603
0.0347809
0.0460702
0.0710623
0.0614614
0.0327017
0.0303293
0.0341119
0.0454978
0.0692498
0.060155
0.0338838
0.0301374
0.0299091
0.0360602
0.0654885
0.0735985
0.0515837
0.0367365
0.0311124
0.0353898
0.063632
0.0720089
0.0473939
0.0356159
0.0305
0.0330975
0.0619706
0.0697265
0.0456864
0.0343158
0.0299515
0.0335693
0.059685
0.0648513
0.0354707
0.0296271
0.0365831
0.0512267
0.0738405
0.0641485
0.0351117
0.0309412
0.0356451
0.0475967
0.0726367
0.0625483
0.0332791
0.0304843
0.0344817
0.0460402
0.070351
0.0608857
0.0338782
0.0300597
0.0298495
0.0360049
0.0660731
0.0742466
0.0518042
0.0368619
0.0309617
0.0355
0.0637624
0.0720611
0.0477786
0.0354944
0.0302178
0.0341181
0.0617485
0.0668319
0.0358359
0.0298136
0.0367754
0.0514985
0.0749003
0.0635481
0.034691
0.0307087
0.0357112
0.0476923
0.0724033
0.0626349
0.0332937
0.0302096
0.0345945
0.0463517
0.070765
0.0613239
0.0339025
0.0297893
0.0296317
0.0362138
0.0666775
0.0750144
0.0518402
0.0369848
0.0307207
0.0352932
0.06439
0.0727924
0.0477184
0.0354099
0.0297673
0.0337907
0.0622389
0.0673122
0.0355056
0.0294343
0.0367544
0.0517515
0.0755409
0.0643864
0.0348055
0.030395
0.0350936
0.0473775
0.0724673
0.0613631
0.0335697
0.0293609
0.029159
0.0356697
0.0669378
0.0761366
0.0524499
0.0370475
0.0305203
0.0351182
0.0651792
0.0736094
0.0482523
0.0355729
0.0294905
0.0337971
0.062724
0.0679298
0.035739
0.0292368
0.0369665
0.0520953
0.0764099
0.0650501
0.0348161
0.0302812
0.0353045
0.0478096
0.0733239
0.0624476
0.0336239
0.0292496
0.0289251
0.035389
0.0675264
0.0757767
0.0518123
0.0365549
0.0297347
0.0338062
0.0630086
0.0716929
0.0472155
0.0348873
0.0287663
0.0332407
0.0616716
0.0673523
0.0352226
0.0286779
0.0365735
0.0521679
0.075592
0.0647304
0.034717
0.0298828
0.0349835
0.0476104
0.0730249
0.0622749
0.0332646
0.028912
0.0286723
0.0351854
0.0672905
0.0754655
0.0517204
0.036467
0.0296838
0.0343756
0.064048
0.0720122
0.047071
0.0345738
0.0283988
0.0327491
0.0604435
0.0643713
0.0334731
0.0278978
0.0352511
0.0505324
0.0730204
0.0629207
0.0342901
0.0288022
0.0286591
0.0357229
0.0684704
0.0766983
0.0528482
0.0369071
0.0298253
0.0348095
0.0653624
0.0734046
0.0477225
0.0350587
0.0285316
0.0329105
0.0621897
0.0667515
0.0346271
0.0282574
0.0357014
0.0512281
0.0745126
0.0630926
0.0346024
0.0288506
0.0282502
0.0345787
0.0673287
0.0751489
0.0515414
0.0358409
0.028587
0.0344634
0.063739
0.0694092
0.0354145
0.0283479
0.0369284
0.053115
0.0781304
0.0659292
0.0345607
0.0295558
0.0349538
0.0478624
0.0737505
0.0620694
0.0327015
0.0281966
0.0279247
0.0343052
0.0664294
0.0738628
0.0508958
0.035318
0.0283397
0.0341055
0.0620827
0.0658285
0.0337844
0.0277008
0.035053
0.0502392
0.0734752
0.0622855
0.0335988
0.0279564
0.0277814
0.0347444
0.0676499
0.0763646
0.0519287
0.0358202
0.0284675
0.0344903
0.0642035
0.0687159
0.0351329
0.02814
0.0359378
0.0518541
0.0763765
0.0637512
0.0341744
0.0283233
0.0277852
0.0345715
0.0677339
0.0747595
0.0505172
0.0351713
0.0275348
0.0330029
0.0617681
0.0661238
0.035932
0.0276614
0.0278459
0.0379142
0.0723586
0.081542
0.0545198
0.0373144
0.0285256
0.0351656
0.0673675
0.0717248
0.0352977
0.0280283
0.0359239
0.0525304
0.0788229
0.0643968
0.0335081
0.0275017
0.0268776
0.0343504
0.0664475
0.0708223
0.0359247
0.0266736
0.036158
0.0538025
0.080339
0.0668979
0.0341089
0.0274226
0.0275943
0.0365703
0.0710908
0.07616
0.038395
0.027647
0.037218
0.054285
0.084494
0.0663389
0.0337867
0.0273376
0.0267038
0.0346812
0.0683391
0.0731619
0.0362387
0.0264427
0.0359361
0.053651
0.0835855
0.0683876
0.0338614
0.0267954
0.0262538
0.0333084
0.0717684
0.076497
0.0396085
0.0269172
0.02603
0.0348964
0.0786123
0.0828425
0.0570587
0.0363358
0.0264908
0.0342051
0.0682296
0.0745092
0.0349663
0.0262873
0.0264002
0.038681
0.0794929
0.0818351
0.0362532
0.0254932
0.0260079
0.0406201
0.0847087
0.0892478
0.0398039
0.0252686
0.0364456
0.0601099
0.0960661
0.0718316
0.0342941
0.0258306
0.0253099
0.0340483
0.0749992
0.080166
0.0378752
0.0253253
0.0252661
0.0382644
0.0857293
0.091132
0.0396752
0.0255293
0.0260507
0.042434
0.0959523
0.100927
0.0448066
0.026626
0.0272062
0.0470614
0.104909
0.106932
0.0494044
0.0277739
0.028286
0.051404
0.108077
0.108746
0.0536471
0.0288819
0.0294612
0.0558704
0.109112
0.109255
0.0584145
0.0302469
0.0309459
0.0608937
0.109309
0.109314
0.0633375
0.0319434
0.032795
0.065734
0.109294
0.109272
0.0680919
0.0339609
0.0349532
0.0703929
0.109243
0.109226
0.0726319
0.0362458
0.0374754
0.0746758
0.109211
0.109212
0.0766488
0.038988
0.040382
0.0784528
0.109219
0.109246
0.0802174
0.0420024
0.0433983
0.0819021
0.109292
0.109366
0.0835423
0.0450172
0.0464152
0.0850966
0.109455
0.109564
0.086601
0.0480333
0.0494326
0.0880101
0.109676
0.109802
0.0893623
0.0510415
0.0524352
0.090615
0.109925
0.11006
0.0918127
0.0540306
0.055422
0.0929082
0.110189
0.110324
0.0939471
0.0570139
0.0583989
0.0948852
0.110451
0.11058
0.0957629
0.0599788
0.0613139
0.0965546
0.110698
0.110814
0.0972965
0.062813
0.0640673
0.0979579
0.110915
0.111012
0.098577
0.0654743
0.0666416
0.0991208
0.111093
0.111169
0.0996281
0.0679527
0.069024
0.100068
0.111228
0.11128
0.100466
0.0702287
0.0711925
0.100822
0.111317
0.111353
0.101146
0.072285
0.0731379
0.101403
0.111373
0.111392
0.101663
0.0741139
0.0748588
0.101847
0.111398
0.111399
0.102044
0.0757237
0.0763677
0.102169
0.111394
0.111381
0.102307
0.077127
0.077676
0.102382
0.111363
0.111337
0.102469
0.0783345
0.0787951
0.102502
0.11131
0.111273
0.102545
0.0793573
0.0797373
0.102545
0.111238
0.111194
0.102554
0.0802141
0.0805273
0.10253
0.111155
0.111103
0.10251
0.0809252
0.0811825
0.102467
0.11106
0.111004
0.102424
0.0815097
0.0817215
0.102367
0.110959
0.110899
0.102305
0.0819832
0.0821571
0.102235
0.110851
0.110792
0.10216
0.0823639
0.0825065
0.102084
0.110745
0.110686
0.102001
0.0826611
0.0827789
0.101917
0.110638
0.11058
0.101829
0.0828986
0.0829887
0.10174
0.110533
0.110476
0.101651
0.0830868
0.0831493
0.101558
0.110428
0.110374
0.101471
0.0832256
0.083257
0.101378
0.110328
0.110275
0.10129
0.0833154
0.0833236
0.101196
0.110231
0.11018
0.101109
0.0833692
0.0833614
0.101017
0.110138
0.110089
0.100929
0.0833964
0.0833774
0.100839
0.110048
0.11
0.100752
0.0834053
0.0833808
0.100667
0.109963
0.109916
0.100579
0.0834007
0.0833739
0.100499
0.10988
0.109836
0.100413
0.0833887
0.0833653
0.100339
0.109803
0.109761
0.100256
0.0833745
0.0833524
0.100187
0.109729
0.10969
0.100107
0.0833613
0.0833419
0.100045
0.109662
0.109624
0.09997
0.0833502
0.0833333
0.0999128
0.109597
0.109562
0.0998427
0.0833423
0.0833303
0.0997917
0.109538
0.109505
0.0997279
0.0833414
0.0833331
0.0996826
0.109484
0.109453
0.099624
0.0833458
0.0833426
0.0995841
0.109434
0.109405
0.0995314
0.0833576
0.0833587
0.0994967
0.109389
0.109362
0.0994488
0.0833759
0.0833818
0.0994196
0.109348
0.109323
0.0993769
0.0834016
0.0834119
0.0993526
0.109311
0.109288
0.0993144
0.0834338
0.0834489
0.0992946
0.109277
0.109257
0.099261
0.083474
0.0834916
0.0992445
0.109245
0.109228
0.0992144
0.0835181
0.0835405
0.0992011
0.109217
0.109203
0.0991749
0.0835681
0.0835936
0.0991633
0.109191
0.109179
0.099141
0.0836218
0.0836504
0.0991306
0.109168
0.109157
0.0991122
0.0836791
0.0837097
0.0991026
0.109147
0.109136
0.0990874
0.0837386
0.0837712
0.0990787
0.109128
0.109117
0.0990666
0.0838003
0.083834
0.0990584
0.10911
0.109099
0.0990493
0.0838627
0.0838978
0.0990419
0.109093
0.109083
0.0990346
0.083926
0.0839615
0.0990277
0.109078
0.109068
0.0990204
0.083989
0.0840249
0.0990156
0.109064
0.109054
0.0990086
0.0840518
0.0840875
0.0990054
0.109051
0.109041
0.0989983
0.0841135
0.0841492
0.0989967
0.109039
0.109029
0.0989899
0.0841744
0.0842095
0.0989894
0.109027
0.109018
0.0989823
0.0842337
0.0842684
0.098983
0.109016
0.109007
0.098976
0.0842917
0.0843255
0.0989775
0.109006
0.108997
0.0989704
0.0843478
0.0843807
0.0989726
0.108996
0.108988
0.0989651
0.0844018
0.0844332
0.0989675
0.108986
0.108978
0.0989596
0.084453
0.084483
0.0989622
0.108977
0.108968
0.0989538
0.0845015
0.0845297
0.0989563
0.108967
0.108959
0.0989474
0.0845468
0.0845734
0.09895
0.108958
0.108949
0.0989407
0.0845892
0.0846139
0.098943
0.108948
0.10894
0.0989331
0.0846282
0.0846512
0.0989353
0.108938
0.10893
0.0989249
0.0846643
0.0846853
0.0989267
0.108929
0.108921
0.0989157
0.0846969
0.0847161
0.0989172
0.108919
0.108911
0.0989059
0.0847265
0.0847437
0.0989069
0.10891
0.108901
0.0988951
0.0847528
0.084768
0.0988957
0.1089
0.108892
0.0988835
0.0847759
0.0847893
0.0988836
0.10889
0.108882
0.0988711
0.084796
0.0848078
0.0988708
0.108881
0.108873
0.098858
0.0848133
0.0848232
0.0988572
0.108871
0.108863
0.098844
0.0848277
0.084836
0.0988428
0.108861
0.108853
0.0988292
0.0848393
0.0848459
0.0988275
0.108851
0.108842
0.0988134
0.0848481
0.084853
0.0988111
0.10884
0.108832
0.0987964
0.084854
0.0848571
0.0987933
0.108829
0.10882
0.0987781
0.0848571
0.0848586
0.0987742
0.108818
0.108808
0.0987584
0.0848574
0.084857
0.0987535
0.108806
0.108796
0.0987371
0.0848546
0.0848525
0.0987315
0.108793
0.108783
0.0987143
0.084849
0.084845
0.0987076
0.108779
0.108769
0.0986896
0.0848401
0.0848345
0.0986821
0.108765
0.108754
0.0986635
0.0848284
0.0848211
0.0986549
0.10875
0.108739
0.0986357
0.0848139
0.0848052
0.0986267
0.108735
0.108724
0.0986072
0.0847972
0.0847872
0.0985978
0.108721
0.10871
0.0985782
0.0847785
0.0847677
0.098569
0.108707
0.108696
0.0985496
0.0847585
0.0847462
0.0985403
0.108694
0.108683
0.0985213
0.0847369
0.0847247
0.0985128
0.108682
0.108671
0.098494
0.0847139
0.0847033
0.0984862
0.108671
0.10866
0.0984674
0.084693
0.0846789
0.0984574
0.108657
0.108645
0.0984397
0.0846689
0.0846499
0.0984342
0.108649
0.108636
0.098415
0.0846415
0.0846231
0.0984019
0.108634
0.108613
0.0983775
0.0846058
0.0845913
0.0983618
0.108606
0.108563
0.0983541
0.0846021
0.0846351
0.0983372
0.108582
0.108578
0.098319
0.0847463
0.0845158
0.0981053
0.10866
0.108525
0.0976406
0.0839737
0.0837029
0.0974564
0.108325
0.0718641
0.0515592
0.0378973
0.0362698
0.0365051
0.0377134
0.0388541
0.0408167
0.0414214
0.0434509
0.0444677
0.0445155
0.0443237
0.0439832
0.0436886
0.0435039
0.0434124
0.0433826
0.0433869
0.0434076
0.0434347
0.0434632
0.0434904
0.0435153
0.0435372
0.0435562
0.0435722
0.0435853
0.0435955
0.0436029
0.0436079
0.0436107
0.0436121
0.0436154
0.0436199
0.0436265
0.0436353
0.0436458
0.0436583
0.0436722
0.0436881
0.0437058
0.0437255
0.0437475
0.0437716
0.0438037
0.043855
0.0439306
0.044023
0.0441205
0.0442155
0.0443053
0.0443897
0.0444692
0.0445446
0.0446165
0.0446852
0.0447515
0.0448157
0.0448786
0.0449409
0.0450036
0.0450677
0.0451342
0.0452042
0.0452788
0.0453592
0.0454464
0.0455419
0.0456467
0.0457625
0.0458905
0.0460325
0.0461901
0.0463651
0.0465593
0.0467747
0.0470131
0.0472765
0.0475668
0.0478858
0.0482352
0.0486166
0.0490313
0.0494803
0.0499649
0.0504853
0.0510423
0.0516357
0.0522658
0.0529319
0.0536339
0.0543706
0.0551419
0.055946
0.0567826
0.0576498
0.0585472
0.0594728
0.0604255
0.0614043
0.0624075
0.0634337
0.0644822
0.0655508
0.066639
0.0677454
0.0688682
0.0700068
0.07116
0.0723261
0.0735049
0.0746944
0.0758944
0.077103
0.0783203
0.0795441
0.0807746
0.08201
0.08325
0.0844938
0.0857398
0.0869882
0.0882372
0.0894871
0.090736
0.0919842
0.0932302
0.0944735
0.095714
0.09695
0.0981818
0.099408
0.100629
0.101843
0.10305
0.104249
0.10544
0.106622
0.107795
0.108958
0.110111
0.111253
0.112383
0.113502
0.114609
0.115702
0.116783
0.117851
0.118904
0.119943
0.120968
0.121977
0.122972
0.123951
0.124914
0.125861
0.126792
0.127706
0.128603
0.129483
0.130346
0.131191
0.132019
0.13283
0.133622
0.134396
0.135152
0.13589
0.13661
0.137311
0.137994
0.138658
0.139304
0.139931
0.14054
0.141129
0.141701
0.142253
0.142787
0.143303
0.143799
0.144277
0.144737
0.145178
0.1456
0.146004
0.146389
0.146756
0.147104
0.147434
0.147745
0.148038
0.148311
0.148566
0.148801
0.149017
0.149213
0.149387
0.149539
0.149667
0.14977
0.149847
0.1499
0.149928
0.149937
0.149943
0.149948
0.149951
0.149953
0.149956
0.149954
0.149953
0.149956
0.149967
0.14998
0.149991
0.149998
0.15
0.149999
0.149995
0.149992
0.149988
0.149985
0.149983
0.149981
0.14998
0.149979
0.149978
0.149977
0.149976
0.149975
0.149975
0.149974
0.149974
0.149974
0.149974
0.149974
0.149974
0.149975
0.149975
0.149976
0.149977
0.149977
0.149978
0.149979
0.14998
0.149982
0.149983
0.149984
0.149986
0.149987
0.149989
0.149991
0.149992
0.149994
0.149996
0.149998
0.150001
0.150003
0.150005
0.150007
0.15001
0.150012
0.150015
0.150018
0.15002
0.150023
0.150026
0.150028
0.150031
0.150034
0.150037
0.15004
0.150043
0.150046
0.15005
0.150054
0.150059
0.150064
0.150069
0.150075
0.150083
0.150095
0.150116
0.150149
0.15019
0.150223
0.15022
0.150169
0.150086
0.149995
0.149908
0.149802
0.149558
0.14828
0.146063
0.14427
0.143616
0.141803
0.141329
0.139563
0.139225
0.137543
0.137324
0.135704
0.135582
0.134031
0.134001
0.132513
0.132557
0.131118
0.131225
0.129836
0.129999
0.128658
0.12887
0.12758
0.127828
0.126581
0.126863
0.125658
0.125975
0.124812
0.125164
0.124046
0.124433
0.123356
0.123776
0.122739
0.12319
0.12219
0.122671
0.121707
0.122217
0.121286
0.121826
0.120926
0.121494
0.120626
0.121223
0.120384
0.121011
0.1202
0.120857
0.120074
0.12076
0.120005
0.120722
0.119994
0.120741
0.12004
0.12082
0.120145
0.120957
0.120308
0.121154
0.120531
0.12141
0.120811
0.121724
0.121148
0.122094
0.121539
0.122518
0.121982
0.122989
0.122469
0.123502
0.122993
0.124046
0.123542
0.124609
0.124103
0.125172
0.124655
0.125714
0.125175
0.126207
0.125632
0.126615
0.125988
0.126899
0.126205
0.127021
0.126244
0.126943
0.126065
0.126623
0.125633
0.126036
0.124928
0.125185
0.123981
0.124065
0.122759
0.122662
0.121288
0.121091
0.119694
0.119429
0.118039
0.117739
0.116378
0.116072
0.11476
0.114473
0.113227
0.112981
0.11181
0.111618
0.110511
0.110394
0.109358
0.109324
0.108363
0.108406
0.107518
0.107632
0.106811
0.106984
0.106222
0.10644
0.105727
0.105977
0.105303
0.105574
0.104929
0.105211
0.104568
0.104865
0.104227
0.104533
0.103895
0.104205
0.103564
0.103873
0.103227
0.103533
0.10288
0.103182
0.102521
0.102817
0.102148
0.102436
0.10176
0.102039
0.101356
0.101625
0.100936
0.101197
0.100501
0.100749
0.100049
0.100286
0.099581
0.0998086
0.0990994
0.099317
0.0985978
0.0988107
0.0980836
0.0982852
0.0975658
0.0976815
0.0970574
0.0978551
0.0963375
0.100348
0.10594
0.105072
0.103737
0.113533
0.102826
0.104866
0.11399
0.103405
0.105561
0.114817
0.103995
0.106185
0.115639
0.104622
0.106849
0.116483
0.105262
0.107512
0.117323
0.105891
0.10816
0.11815
0.106506
0.108795
0.118964
0.107106
0.109414
0.119768
0.107689
0.110016
0.120559
0.108255
0.110601
0.121337
0.108805
0.111171
0.1221
0.109338
0.111723
0.122847
0.109857
0.112253
0.123578
0.110362
0.11277
0.124291
0.110852
0.113282
0.124987
0.111324
0.113792
0.125678
0.111785
0.114289
0.126383
0.112237
0.114781
0.127096
0.112686
0.115275
0.127815
0.113141
0.115781
0.128548
0.113613
0.116312
0.129302
0.114118
0.116881
0.130091
0.114673
0.117505
0.130925
0.115288
0.118194
0.131781
0.11599
0.118971
0.132687
0.116796
0.119851
0.133666
0.117718
0.120846
0.134723
0.118768
0.121963
0.135878
0.11995
0.123206
0.137143
0.121257
0.124569
0.138519
0.12268
0.126034
0.139998
0.124192
0.127574
0.141545
0.125759
0.129149
0.143096
0.127343
0.13071
0.144607
0.128927
0.13224
0.146183
0.130372
0.133647
0.147546
0.13156
0.134755
0.148579
0.13247
0.135606
0.149362
0.133181
0.13621
0.149885
0.13364
0.13656
0.150123
0.133856
0.13667
0.150099
0.133862
0.136577
0.14986
0.133692
0.136321
0.149456
0.133388
0.135946
0.148928
0.132991
0.135489
0.14832
0.132533
0.134982
0.147665
0.132043
0.134454
0.146993
0.131544
0.133924
0.146321
0.131055
0.133411
0.145665
0.13059
0.132923
0.14504
0.13016
0.13247
0.144455
0.129772
0.132062
0.143916
0.12943
0.131704
0.143426
0.12914
0.131398
0.142989
0.128903
0.131145
0.142606
0.128721
0.130948
0.142277
0.128593
0.130806
0.142001
0.128521
0.130718
0.141776
0.128502
0.130684
0.141602
0.128538
0.130704
0.141476
0.128627
0.130775
0.141398
0.128768
0.130898
0.141367
0.128961
0.131071
0.14138
0.129205
0.131294
0.141436
0.129499
0.131566
0.141533
0.129845
0.131888
0.141669
0.130243
0.132261
0.141843
0.130693
0.132685
0.142053
0.131198
0.133161
0.142298
0.131757
0.133692
0.142576
0.132376
0.13428
0.142885
0.133058
0.134931
0.143222
0.133812
0.13566
0.143579
0.134633
0.136455
0.143966
0.135508
0.137299
0.144386
0.136438
0.138194
0.144836
0.137424
0.139138
0.145315
0.138468
0.140133
0.145819
0.139569
0.141172
0.146339
0.140724
0.142262
0.146877
0.141946
0.143409
0.147436
0.143228
0.144595
0.148
0.144555
0.145809
0.148559
0.145961
0.147048
0.149098
0.147386
0.149634
0.149419
0.149186
0.148955
0.148732
0.148525
0.148333
0.148158
0.148004
0.147871
0.14776
0.147674
0.147612
0.147577
0.147568
0.147588
0.147639
0.147721
0.147836
0.147987
0.148177
0.148407
0.14868
0.148999
0.149366
0.149785
0.150256
0.150784
0.151371
0.152019
0.152728
0.153497
0.154326
0.155215
0.156161
0.15716
0.158205
0.159284
0.160382
0.161483
0.162552
0.163542
0.164401
0.165065
0.165469
0.16554
0.165224
0.164556
0.163536
0.162077
0.160374
0.158664
0.156921
0.155266
0.153735
0.152338
0.151033
0.149802
0.148609
0.14744
0.146309
0.145261
0.14422
0.143193
0.142188
0.141199
0.140221
0.139248
0.138279
0.137312
0.136346
0.13538
0.134412
0.133442
0.13247
0.131495
0.13052
0.129542
0.12857
0.127581
0.126631
0.125607
0.124783
0.123668
0.123477
0.121369
0.115956
0.112569
0.112613
0.116161
0.121018
0.123759
0.123934
0.126445
0.126081
0.127624
0.127928
0.128054
0.128788
0.129944
0.130946
0.132059
0.133136
0.134242
0.135346
0.136462
0.137581
0.138707
0.139836
0.14097
0.142107
0.143247
0.147303
0.146006
0.144717
0.143435
0.142163
0.140901
0.139651
0.138412
0.137189
0.135971
0.134785
0.133574
0.132451
0.131193
0.130253
0.129081
0.128702
0.129231
0.129608
0.129674
0.129278
0.128771
0.129163
0.130392
0.131384
0.13275
0.130318
0.128837
0.128085
0.12792
0.12761
0.125805
0.126161
0.122118
0.122205
0.118855
0.11903
0.120529
0.121366
0.122877
0.124175
0.131551
0.133952
0.135268
0.136555
0.137885
0.135809
0.13436
0.132989
0.125698
0.127133
0.128683
0.117643
0.115091
0.116233
0.113718
0.114868
0.112387
0.113519
0.111078
0.112223
0.109827
0.110869
0.108588
0.109158
0.110225
0.110704
0.112038
0.109206
0.109128
0.103892
0.104288
0.099985
0.0998517
0.0996626
0.102825
0.102108
0.0997908
0.100111
0.10345
0.102573
0.10012
0.10059
0.103912
0.10328
0.100594
0.101106
0.101003
0.100808
0.100621
0.100374
0.1
0.0998181
0.0994265
0.101312
0.101099
0.104795
0.103653
0.101037
0.101544
0.105037
0.104386
0.101525
0.102034
0.105943
0.104754
0.101959
0.102478
0.106164
0.105507
0.102458
0.102271
0.102202
0.101977
0.101907
0.101684
0.101611
0.101391
0.102491
0.102984
0.107102
0.105884
0.1029
0.103434
0.107326
0.106656
0.103411
0.103954
0.108291
0.10704
0.103862
0.104414
0.108512
0.107832
0.104389
0.103464
0.103391
0.10315
0.103086
0.102857
0.102785
0.102555
0.103703
0.104952
0.109508
0.108228
0.104853
0.105424
0.109731
0.10904
0.105394
0.105975
0.110757
0.109445
0.105871
0.106461
0.11098
0.116495
0.110279
0.10643
0.104744
0.104666
0.104406
0.10434
0.104092
0.104017
0.103768
0.105001
0.10703
0.112039
0.119084
0.13022
0.13726
0.139224
0.140588
0.141968
0.143368
0.141819
0.14027
0.138755
0.131828
0.133458
0.135144
0.136872
0.143394
0.144785
0.146218
0.147665
0.149123
0.148277
0.146627
0.144999
0.138649
0.140463
0.142316
0.130523
0.12762
0.128721
0.125869
0.126982
0.124178
0.125299
0.122542
0.123673
0.120961
0.122098
0.119428
0.12057
0.117941
0.112264
0.110696
0.106918
0.107527
0.107489
0.111551
0.113355
0.11198
0.107986
0.108107
0.105676
0.105412
0.105336
0.105067
0.105742
0.106016
0.108614
0.113582
0.11286
0.108575
0.106094
0.106363
0.109214
0.114712
0.113304
0.109085
0.109734
0.11494
0.114207
0.109689
0.110346
0.116105
0.114662
0.110207
0.110874
0.116334
0.11559
0.110824
0.10748
0.107407
0.107122
0.107061
0.106784
0.106708
0.106426
0.107756
0.111501
0.11754
0.116061
0.111351
0.112039
0.11777
0.117014
0.111981
0.112676
0.119017
0.1175
0.112513
0.113217
0.119247
0.118477
0.11315
0.108811
0.108757
0.108478
0.108435
0.108161
0.108095
0.107809
0.109072
0.113862
0.12053
0.118978
0.113682
0.114404
0.120767
0.119983
0.114325
0.115058
0.122092
0.120504
0.11486
0.115603
0.122338
0.129441
0.121537
0.115511
0.109895
0.109882
0.109641
0.109637
0.109395
0.109359
0.109097
0.110111
0.116266
0.123708
0.1324
0.144211
0.149944
0.15059
0.148604
0.144388
0.145532
0.146678
0.147827
0.148983
0.150148
0.151334
0.152551
0.15381
0.155117
0.156423
0.157769
0.159204
0.160601
0.161993
0.163393
0.170544
0.169048
0.167452
0.165761
0.164151
0.162525
0.160917
0.15938
0.157921
0.156528
0.155178
0.153851
0.152534
0.151221
0.14991
0.152065
0.153546
0.155032
0.155009
0.153314
0.151623
0.146142
0.148092
0.150045
0.151982
0.15669
0.156522
0.158022
0.159549
0.161144
0.161862
0.160072
0.158369
0.153898
0.155814
0.15789
0.147776
0.144599
0.145485
0.142332
0.143186
0.140018
0.140882
0.137719
0.138615
0.13548
0.136435
0.133353
0.134366
0.131347
0.123971
0.122087
0.116047
0.116812
0.116704
0.123154
0.125396
0.123744
0.117244
0.117486
0.110452
0.110274
0.110293
0.110086
0.110389
0.110559
0.11804
0.125683
0.12485
0.117916
0.110505
0.110651
0.118735
0.12717
0.125489
0.118467
0.119301
0.127483
0.126629
0.119156
0.120023
0.129036
0.127322
0.119728
0.120617
0.129378
0.128498
0.120453
0.110563
0.110686
0.110561
0.110706
0.110588
0.110684
0.110547
0.11068
0.12138
0.130986
0.129241
0.121056
0.122003
0.131345
0.130439
0.121808
0.122805
0.133003
0.131235
0.122445
0.123467
0.133371
0.132446
0.123245
0.110438
0.110604
0.110426
0.110634
0.110491
0.110638
0.110501
0.110661
0.124326
0.13507
0.133291
0.12391
0.125002
0.135425
0.13444
0.124702
0.125884
0.137146
0.135371
0.125416
0.126799
0.137649
0.147136
0.136873
0.12672
0.111233
0.11122
0.110539
0.110801
0.110479
0.110705
0.11044
0.112352
0.128332
0.139808
0.150583
0.160354
0.163845
0.162851
0.164694
0.166657
0.168698
0.171362
0.168609
0.166094
0.163323
0.166797
0.17075
0.174804
0.174256
0.170778
0.172803
0.174807
0.176749
0.18276
0.180131
0.177248
0.179288
0.183886
0.188546
0.187967
0.184631
0.181491
0.177581
0.175152
0.171081
0.169563
0.165906
0.164165
0.159712
0.158667
0.154598
0.15423
0.150424
0.140977
0.138389
0.128233
0.130182
0.130495
0.140562
0.143724
0.142766
0.132877
0.132554
0.11624
0.114553
0.114046
0.112589
0.117057
0.11904
0.135177
0.14551
0.145486
0.135838
0.119986
0.122186
0.138216
0.148721
0.148254
0.138972
0.141958
0.151238
0.151752
0.143519
0.147502
0.155152
0.154739
0.155854
0.148836
0.136402
0.136024
0.128631
0.126512
0.123428
0.113015
0.118875
0.118609
0.120849
0.138517
0.13783
0.120746
0.124298
0.143705
0.158796
0.162216
0.166692
0.170705
0.157974
0.151464
0.152317
0.146262
0.147643
0.141747
0.124231
0.128377
0.128586
0.133313
0.134172
0.140364
0.143046
0.158233
0.165994
0.176628
0.180833
0.185508
0.190031
0.19172
0.194939
0.192888
0.185419
0.178507
0.172073
0.16495
0.16672
0.168612
0.170604
0.172546
0.174178
0.175251
0.175812
0.175886
0.175444
0.174592
0.173454
0.172127
0.170687
0.169189
0.167678
0.172378
0.174212
0.176077
0.177948
0.179763
0.181423
0.182782
0.183649
0.183829
0.183341
0.182153
0.180228
0.177908
0.175736
0.173792
0.180171
0.182074
0.184402
0.192322
0.189816
0.187692
0.196565
0.200396
0.203998
0.207629
0.195204
0.186955
0.189098
0.190265
0.190537
0.198242
0.198445
0.197465
0.210445
0.210986
0.209327
0.224713
0.229302
0.230332
0.226337
0.220517
0.21278
0.204702
0.19917
0.199025
0.194592
0.189239
0.185306
0.183
0.178771
0.177198
0.172739
0.171616
0.166301
0.155172
0.154132
0.135076
0.125024
0.13584
0.142377
0.160869
0.162718
0.144308
0.149341
0.167398
0.169657
0.1744
0.177727
0.161893
0.157852
0.152043
0.142365
0.153142
0.172941
0.183251
0.185979
0.1913
0.193748
0.179585
0.175384
0.155249
0.161192
0.163263
0.181335
0.189276
0.199716
0.207857
0.200525
0.191736
0.177101
0.172565
0.191297
0.195255
0.204081
0.210153
0.214365
0.222247
0.219553
0.214455
0.20833
0.203312
0.18694
0.176532
0.172061
0.158391
0.192694
0.202025
0.215345
0.221785
0.224646
0.231165
0.227905
0.235711
0.242377
0.237539
0.228316
0.220337
0.215029
0.197179
0.181953
0.203088
0.215824
0.227652
0.243397
0.246664
0.253761
0.251513
0.240833
0.247985
0.260516
0.264943
0.250595
0.25674
0.260565
0.27063
0.299141
0.290081
0.277831
0.268561
0.262233
0.263786
0.252941
0.242178
0.230551
0.210453
0.259696
0.27365
0.272953
0.282617
0.292074
0.295857
0.266292
0.31743
0.306774
0.322927
0.341391
0.360051
0.331488
0.336238
0.366564
0.420982
0.396661
0.362458
0.319857
0.447939
0.511396
0.705208
0.706074
0.49217
0.408377
0.360283
0.334589
0.299753
0.287129
0.323733
0.330191
0.35122
0.38886
0.434827
0.388308
0.367475
0.339432
0.315767
0.351632
0.361105
0.414327
0.509012
0.57997
1
0.720057
0.50626
0.404283
0.478726
0.360058
0.330102
0.283697
0.298692
0.265357
0.24539
0.2345
0.218758
0.217823
0.208582
0.182471
0.197292
0.178871
0.189544
0.18227
0.159827
0.176068
0.169626
0.146641
0.165307
0.159901
0.136389
0.156625
0.151156
0.127371
0.149366
0.144022
0.120283
0.143239
0.137458
0.113659
0.13795
0.13219
0.108152
0.136706
0.12378
0.115671
0.0952003
0.119366
0.113916
0.0910721
0.117415
0.110159
0.0864763
0.113306
0.107106
0.0836493
0.111351
0.103605
0.0799879
0.107568
0.101028
0.07761
0.10607
0.0974626
0.0739631
0.101568
0.0945114
0.0689254
0.101961
0.0766506
0.106743
0.0977272
0.0727598
0.102818
0.0940808
0.0720852
0.0983197
0.0903603
0.067582
0.0955755
0.087256
0.0651814
0.0920932
0.0799719
0.0607422
0.0877533
0.064297
0.0914549
0.0789793
0.059855
0.0870942
0.071915
0.0561381
0.0830106
0.0595062
0.089834
0.0758505
0.0571448
0.0837084
0.0675909
0.0537393
0.0772638
0.0566059
0.0824823
0.0669504
0.0528126
0.0758375
0.0612332
0.0506197
0.0703475
0.0522966
0.0790825
0.0613862
0.0498976
0.0681611
0.0511051
0.075683
0.0592317
0.0485755
0.0666954
0.050054
0.0747544
0.0579796
0.0479595
0.0641158
0.0491221
0.0705527
0.0556109
0.0471108
0.0624284
0.0480783
0.0684462
0.0536899
0.0464351
0.0585298
0.0470976
0.0624494
0.0476069
0.067268
0.0528791
0.0455093
0.0584121
0.0463736
0.0620725
0.0499531
0.0448909
0.0544924
0.0454933
0.0582362
0.0455866
0.0618316
0.0492354
0.0439832
0.0541333
0.0447448
0.056972
0.0451458
0.0596684
0.048086
0.0437105
0.0518067
0.0440382
0.0550424
0.0441665
0.0584863
0.0470584
0.0430811
0.0510354
0.0436401
0.0534285
0.0437409
0.0556743
0.0454035
0.0426647
0.0483836
0.0427504
0.0508439
0.0427046
0.0540754
0.044342
0.0421541
0.0471683
0.0421696
0.0487654
0.0420393
0.0503159
0.0420354
0.0524568
0.0431597
0.0414537
0.0454737
0.0417413
0.0468945
0.0414061
0.047968
0.0411422
0.0506047
0.0420267
0.0407013
0.0443222
0.0408301
0.0455935
0.040742
0.0467834
0.0406676
0.0485459
0.0410059
0.0397575
0.0424836
0.0402212
0.0437015
0.0401464
0.044439
0.0398001
0.0462124
0.0398433
0.0386635
0.0410508
0.0393801
0.0421467
0.0394639
0.0428198
0.0392764
0.0433905
0.0391803
0.0444081
0.038789
0.0378293
0.039849
0.0382359
0.0404458
0.0386245
0.0414607
0.0386319
0.042152
0.0383724
0.0437183
0.0381546
0.0372584
0.039134
0.0375781
0.0397702
0.038056
0.0404824
0.0382218
0.0410661
0.0380067
0.0419142
0.0372884
0.0366645
0.0380651
0.0365568
0.0381936
0.0366216
0.0386909
0.0370828
0.0393163
0.0371774
0.0408684
0.0365555
0.0360406
0.0371663
0.0358807
0.0374405
0.0359452
0.0377068
0.0361722
0.0381422
0.0364163
0.0390549
0.035548
0.0353223
0.036067
0.0350389
0.0360875
0.0348447
0.0364272
0.0349912
0.0365926
0.0351447
0.0371754
0.0355579
0.038419
0.0349309
0.0345312
0.0354281
0.0345376
0.0357028
0.0344611
0.0359272
0.034557
0.0362585
0.0348007
0.0372465
0.0342784
0.034121
0.0345761
0.0338489
0.0346642
0.0337064
0.0346581
0.0335741
0.0350273
0.0336951
0.0358523
0.033289
0.0331736
0.0336706
0.0330923
0.0337936
0.0329879
0.0339884
0.0329953
0.0342879
0.0330676
0.035038
0.0326426
0.0326813
0.0328923
0.0324263
0.0329817
0.0323218
0.0330105
0.0322504
0.0334137
0.0323458
0.0341355
0.0319782
0.032054
0.0323375
0.0319054
0.0323981
0.0317786
0.032561
0.0317255
0.0329807
0.0313245
0.0315904
0.0315186
0.031315
0.0314428
0.0310599
0.0317271
0.0310316
0.0321829
0.0306303
0.0308361
0.0308257
0.0306664
0.0308643
0.030584
0.031053
0.0305317
0.0314129
0.0300065
0.0304057
0.0301665
0.0302029
0.0301541
0.0299607
0.0304374
0.0299201
0.0309009
0.0295008
0.0297887
0.0297303
0.0298035
0.0299229
0.0297971
0.0301341
0.0297737
0.0305512
0.0292836
0.0296936
0.0294375
0.0295213
0.0295055
0.0292247
0.0299915
0.0287823
0.029227
0.0290115
0.0292083
0.0291753
0.0292024
0.0294136
0.0291631
0.0299148
0.0287825
0.0292352
0.0289437
0.0290513
0.02905
0.0288475
0.0293783
0.0283526
0.028873
0.0286946
0.0288912
0.02889
0.0288374
0.0293422
0.0283961
0.028941
0.0285618
0.0286102
0.0288152
0.0279374
0.0285507
0.0279588
0.0282761
0.0281496
0.0282985
0.0284874
0.0277067
0.0284187
0.0277762
0.027919
0.0279901
0.0272769
0.0279363
0.0274215
0.0275761
0.0275408
0.0269224
0.0278655
0.0270661
0.0273772
0.0273573
0.0267146
0.0276695
0.0268819
0.0271723
0.0270082
0.0263176
0.0272285
0.0263087
0.0265973
0.0266611
0.0260983
0.0271427
0.0264359
0.0267737
0.02666
0.0260307
0.0270026
0.0261135
0.0262713
0.0263169
0.0255999
0.0262198
0.026107
0.0255701
0.02688
0.0258025
0.0261431
0.0260949
0.0254486
0.0261689
0.0257545
0.0249942
0.0258237
0.0253948
0.0247802
0.0263054
0.0252399
0.0256297
0.0255331
0.0249052
0.0255989
0.0252793
0.0244862
0.0252184
0.0249682
0.024404
0.0254005
0.0249301
0.0242964
0.0252808
0.0247046
0.023979
0.0248726
0.0242478
0.0238007
0.0235405
0.024867
0.0239607
0.0233086
0.0244374
0.0237611
0.0231192
0.0226837
0.0239483
0.0231239
0.0229031
0.0225912
0.0239165
0.0226787
0.0221202
0.0217203
0.0228844
0.0223087
0.0219388
0.0218317
0.021226
0.02248
0.0216041
0.0213502
0.0212202
0.0209303
0.0205927
0.0204593
0.0210807
0.0214259
0.0212219
0.0212067
0.0212642
0.0213835
0.0215511
0.0217373
0.0218893
0.0220145
0.0220735
0.0221235
0.0221324
0.022166
0.0221661
0.0222107
0.022226
0.0222934
0.0223377
0.02243
0.0225081
0.0226341
0.0227713
0.0229347
0.0231048
0.0233459
0.0235478
0.023865
0.024099
0.0244899
0.0247547
0.0252148
0.0255099
0.0260405
0.0263691
0.0269775
0.0273406
0.0280251
0.0284202
0.0291771
0.0295907
0.0303893
0.030817
0.0316494
0.0320883
0.0329484
0.0333955
0.0342762
0.0347285
0.0356246
0.0360798
0.0369921
0.0374333
0.0383505
0.038803
0.0397173
0.0401515
0.041067
0.0414942
0.0423985
0.0428188
0.0437061
0.044132
0.0450055
0.0454104
0.0462718
0.0466791
0.0475184
0.0479148
0.0487388
0.0491242
0.0499309
0.0503042
0.0510933
0.0514534
0.052221
0.0525668
0.053313
0.0536445
0.0543672
0.0546839
0.0553845
0.055687
0.056368
0.0566466
0.0573053
0.0575783
0.0582078
0.0584657
0.0590719
0.0593158
0.0598986
0.0601282
0.0606879
0.0609041
0.0614429
0.0616459
0.0621623
0.0623524
0.0628485
0.063026
0.063501
0.0636668
0.064123
0.0642777
0.0647153
0.0648597
0.0652807
0.065415
0.0658192
0.0659443
0.0663333
0.0664492
0.0668224
0.0669297
0.0672888
0.0673875
0.0677317
0.0678225
0.0681522
0.0682353
0.0685498
0.0686259
0.0689272
0.0689962
0.0692837
0.0693465
0.069622
0.0696785
0.0699415
0.0699924
0.0702447
0.07029
0.0705311
0.0705715
0.070803
0.0708385
0.0710598
0.0710909
0.0713034
0.0713296
0.0715325
0.0715543
0.0717486
0.0717656
0.0719509
0.0719638
0.0721412
0.0721499
0.0723191
0.0723243
0.0724866
0.0724881
0.0726429
0.0726412
0.0727895
0.0727843
0.0729255
0.0729175
0.0730527
0.0730415
0.0731704
0.0731569
0.0732799
0.073264
0.0733807
0.0733631
0.0734745
0.0734547
0.0735604
0.073539
0.0736398
0.0736163
0.0737121
0.0736872
0.0737786
0.0737519
0.0738381
0.0738098
0.0738916
0.0738614
0.0739384
0.0739068
0.0739802
0.0739469
0.0740161
0.0739817
0.0740474
0.0740117
0.0740734
0.0740369
0.0740956
0.0740564
0.0741131
0.0740696
0.0741259
0.0740875
0.0741368
0.0740977
0.074145
0.074103
0.0741464
0.0740968
0.0741343
0.0740875
0.074141
0.0741736
0.0742857
0.0739744
0.0732032
0.0525256
0.0378617
0.038068
0.0537294
0.0547339
0.038767
0.0365156
0.0363405
0.0361804
0.0376487
0.0407569
0.0410171
0.0406427
0.0374413
0.0363744
0.0381798
0.054194
0.0544476
0.0387223
0.037906
0.0538893
0.054339
0.0386642
0.0362575
0.0364301
0.0369054
0.0362103
0.0378717
0.0538743
0.0542987
0.0386074
0.0377975
0.0538082
0.05421
0.0385235
0.0361265
0.0365058
0.0393334
0.0394753
0.0369198
0.0360451
0.0376831
0.053698
0.0540951
0.0384128
0.0375783
0.0535783
0.0539708
0.038305
0.0359409
0.0364858
0.0369331
0.0358547
0.0374618
0.0534374
0.0538333
0.0381825
0.0373501
0.0533018
0.0536891
0.0380671
0.0357459
0.0365233
0.039335
0.0440822
0.0440182
0.0440276
0.0442208
0.0446415
0.0446931
0.0448184
0.0449219
0.0450551
0.0442276
0.0394577
0.0369739
0.035659
0.0372287
0.0531558
0.0535393
0.0379391
0.0371071
0.0530005
0.0533807
0.0378153
0.0355465
0.0365457
0.0370247
0.035461
0.0369867
0.052837
0.0532174
0.037686
0.0368682
0.0526678
0.0530439
0.0375661
0.035346
0.0365754
0.0396065
0.0397615
0.0370808
0.0352628
0.0367498
0.0524947
0.0528702
0.0374366
0.0366236
0.052313
0.0526823
0.0373058
0.0351441
0.0366098
0.0371411
0.0350609
0.0364937
0.0521205
0.0524875
0.0371638
0.036365
0.0519169
0.0522782
0.0370337
0.0349392
0.0366489
0.0399174
0.0446425
0.0445056
0.0443504
0.0451652
0.0452922
0.0454074
0.0450577
0.0449744
0.0448854
0.0448068
0.0447114
0.0446353
0.0445278
0.0444671
0.0440686
0.0441108
0.0441723
0.044219
0.0437938
0.0437743
0.0437492
0.0437285
0.0435193
0.043526
0.0435305
0.0435331
0.0435346
0.0438138
0.0442716
0.0443174
0.044367
0.044415
0.0438675
0.0438499
0.0438315
0.0435348
0.0435343
0.0435328
0.0433756
0.043386
0.0433951
0.043403
0.0434096
0.0434147
0.0434179
0.0434191
0.0433862
0.0433828
0.0433773
0.0433702
0.043375
0.0433815
0.0433867
0.0433899
0.0434107
0.0434087
0.0434048
0.0433999
0.0433938
0.0433669
0.0433615
0.0433514
0.0433399
0.043327
0.0433348
0.0433469
0.0433576
0.0433866
0.0433781
0.0433683
0.0433568
0.0433209
0.0433124
0.0433638
0.0435305
0.0438854
0.0444654
0.0451477
0.0455348
0.0447987
0.0400772
0.0372053
0.0348595
0.0362425
0.051708
0.0520683
0.0368993
0.0361175
0.0514929
0.0518475
0.0367705
0.0347369
0.036692
0.0372738
0.0346597
0.0359884
0.0512704
0.0516222
0.0366253
0.0358539
0.0510359
0.0513807
0.0364878
0.0345317
0.03674
0.0402393
0.0404077
0.0373475
0.0344586
0.0357232
0.0507925
0.0511347
0.036341
0.0355925
0.0505403
0.0508762
0.0362092
0.0343265
0.0367932
0.0374274
0.0342615
0.0354653
0.050282
0.0506149
0.0360625
0.0353328
0.0500141
0.0503397
0.0359287
0.0341245
0.0368529
0.0405817
0.0452493
0.0450993
0.0449427
0.0456553
0.0457831
0.0459069
0.046036
0.0454086
0.0407621
0.0375145
0.0340668
0.0352016
0.0497377
0.0500595
0.0357744
0.0350647
0.04945
0.0497641
0.0356379
0.0339221
0.0369205
0.0376096
0.0338728
0.0349343
0.0491544
0.0494645
0.035483
0.0348011
0.048849
0.0491513
0.0353522
0.033723
0.0369965
0.0409486
0.041141
0.037713
0.033683
0.0346736
0.0485364
0.0488342
0.035196
0.0345369
0.0482129
0.0485021
0.0350619
0.0335258
0.0370812
0.0378253
0.0334942
0.0344062
0.0478809
0.0481649
0.0349001
0.0342705
0.0475378
0.0478131
0.0347701
0.0333303
0.0371755
0.0413389
0.0458872
0.0457267
0.0455646
0.0461635
0.0462944
0.0464244
0.0465565
0.0460517
0.0415425
0.0379473
0.0333091
0.0341452
0.0471876
0.0474574
0.0346109
0.0340118
0.0468269
0.0470876
0.0344834
0.0331432
0.0372802
0.0380788
0.0331365
0.0338877
0.046459
0.0467134
0.0343214
0.0337553
0.0460796
0.046324
0.0341976
0.0329617
0.0373951
0.0417511
0.0419653
0.0382202
0.0329689
0.0336329
0.0456924
0.04593
0.0340319
0.033497
0.0452937
0.0455209
0.0339065
0.0327822
0.0375206
0.0383725
0.032803
0.0333725
0.0448875
0.0451075
0.0337347
0.0332372
0.04447
0.0446792
0.0336135
0.0326082
0.0376581
0.042185
0.0465487
0.0463822
0.0462156
0.0466882
0.0468212
0.046954
0.0470873
0.0467168
0.0424103
0.0385367
0.0326465
0.0331179
0.0440456
0.0442469
0.0334423
0.032984
0.04361
0.0438003
0.0333233
0.0324452
0.0378087
0.0387132
0.0325007
0.0328622
0.0431685
0.0433506
0.0331421
0.0327199
0.0427165
0.0428875
0.0330154
0.0322905
0.0379732
0.042641
0.0428769
0.0389029
0.0323658
0.0325907
0.0422595
0.0424222
0.0328193
0.0324382
0.0417926
0.0419446
0.0326794
0.0321573
0.0381524
0.0391061
0.0322605
0.0323077
0.041321
0.0414648
0.0324861
0.0321645
0.0408398
0.0409722
0.0323336
0.0320401
0.0383467
0.0431176
0.0472221
0.0470537
0.0468849
0.0472203
0.0473533
0.0474855
0.0465848
0.0464845
0.0463844
0.0462845
0.0461851
0.0460863
0.045988
0.0458906
0.0457938
0.0456983
0.0456032
0.0455101
0.0454173
0.0453269
0.0452354
0.0445155
0.0445672
0.044619
0.0439378
0.0439206
0.043903
0.0435272
0.0435228
0.0435172
0.0435103
0.0439549
0.0446716
0.0447246
0.0447786
0.0448333
0.0440041
0.0439878
0.0439715
0.0435023
0.0434929
0.0434822
0.0432319
0.0432566
0.0432793
0.0433
0.0433186
0.0433354
0.0433505
0.0432961
0.0432778
0.0432574
0.0432678
0.0432876
0.0433053
0.0433437
0.0433285
0.0433112
0.0432915
0.0432456
0.0432348
0.0432099
0.0431825
0.0431526
0.0431632
0.0431934
0.0432208
0.0432692
0.043244
0.0432159
0.0431845
0.0431299
0.04312
0.0432051
0.0434701
0.0440203
0.0448888
0.0449448
0.0450016
0.0450588
0.0440683
0.0440524
0.0440364
0.0434569
0.0434426
0.043427
0.0434102
0.0440842
0.0451166
0.0451748
0.0452334
0.0452919
0.0441314
0.0441158
0.0441
0.0433924
0.0433736
0.0433538
0.0429559
0.042998
0.043038
0.0430757
0.0431113
0.0431447
0.043176
0.0430848
0.0430467
0.0430058
0.0430116
0.0430543
0.0430937
0.0431499
0.0431117
0.04307
0.0430247
0.0429656
0.0429621
0.0429153
0.0428656
0.0428127
0.0428065
0.0428632
0.0429162
0.0429755
0.0429224
0.0428651
0.0429521
0.0430084
0.0430601
0.0431076
0.0431509
0.0431903
0.0432258
0.0432576
0.0432858
0.0433107
0.0433324
0.0433513
0.0433675
0.0433813
0.0433931
0.043403
0.0434113
0.0434182
0.0434239
0.0434286
0.0434324
0.0434352
0.0434374
0.0434382
0.0434668
0.0434673
0.0434668
0.043466
0.0434978
0.0434967
0.0434957
0.0434942
0.043519
0.0435213
0.0435237
0.0435264
0.0435292
0.0434986
0.0434646
0.0434625
0.0434596
0.0434558
0.043498
0.0434988
0.043499
0.0435318
0.0435343
0.0435363
0.0435701
0.0435654
0.0435607
0.043556
0.0435515
0.0435473
0.0435439
0.043541
0.0435598
0.0435632
0.0435675
0.0435729
0.0435909
0.0435845
0.0435795
0.0435757
0.0435887
0.0435928
0.0435983
0.0436056
0.0436139
0.0435982
0.0435789
0.0435854
0.0435922
0.0435992
0.043624
0.0436148
0.0436062
0.0436233
0.0436335
0.0436446
0.043661
0.0436483
0.0436368
0.0436263
0.0436171
0.0436092
0.0436032
0.0435989
0.0436063
0.0436107
0.0436171
0.0436255
0.0436309
0.0436222
0.0436157
0.0436112
0.0436141
0.0436185
0.0436252
0.043634
0.0436445
0.0436413
0.0436354
0.0436467
0.0436593
0.0436733
0.0436814
0.0436665
0.0436532
0.0436568
0.0436706
0.0436861
0.0437034
0.0436981
0.0436888
0.043675
0.0436565
0.0436337
0.0436064
0.0435745
0.0435377
0.0434963
0.0434508
0.0434444
0.0434364
0.0434264
0.0434833
0.0434893
0.0434935
0.0435384
0.043538
0.0435361
0.0435324
0.0434753
0.0434142
0.0433994
0.0433817
0.0433607
0.0434349
0.0434515
0.0434648
0.0435264
0.0435177
0.0435059
0.0435724
0.0435793
0.0435831
0.0435845
0.0435839
0.0435817
0.0435784
0.0436135
0.0436203
0.0436264
0.0436639
0.0436539
0.0436438
0.0436693
0.0436826
0.0436963
0.0437098
0.0436732
0.0436314
0.0436348
0.0436359
0.0436343
0.0436917
0.0436875
0.0436813
0.0437226
0.0437352
0.0437502
0.0437734
0.0436958
0.0436289
0.043562
0.0434904
0.0434148
0.0433363
0.0433082
0.0432761
0.0432399
0.0433303
0.0433627
0.0433909
0.0434711
0.0434473
0.0434192
0.0433858
0.0432931
0.0431994
0.0431544
0.0431048
0.0430495
0.0431598
0.0432049
0.0432511
0.0433528
0.0433218
0.0433028
0.0435131
0.0434865
0.0434788
0.0434888
0.0435081
0.0435285
0.0435478
0.0436215
0.0436144
0.043613
0.0437592
0.0437227
0.0437034
0.0438108
0.0438663
0.043936
0.0440106
0.0438132
0.0436269
0.04366
0.0437085
0.0437627
0.0440023
0.0439418
0.0438771
0.0440828
0.0441493
0.0442106
0.0443832
0.0443201
0.0442533
0.0441811
0.0441027
0.04402
0.0439392
0.0438699
0.0438181
0.0437832
0.0437595
0.0437409
0.0437234
0.0437063
0.0436901
0.0437059
0.0437245
0.0437445
0.043759
0.0437369
0.0437166
0.0437228
0.0437442
0.0437677
0.0437977
0.0437851
0.0437661
0.0437934
0.0438339
0.0438932
0.0439592
0.0438808
0.043823
0.0438443
0.0439143
0.0440028
0.0440989
0.0440504
0.0439706
0.0440586
0.0441477
0.0442321
0.0443184
0.0442343
0.0441442
0.0441938
0.0442837
0.0443679
0.044447
0.0443968
0.0443101
0.0443826
0.044451
0.0445167
0.0446082
0.0445407
0.0444705
0.0445218
0.0445932
0.0446616
0.0447275
0.0446734
0.0445804
0.0444444
0.0442686
0.0440581
0.0438157
0.0435519
0.043304
0.043118
0.0429925
0.0428916
0.0428035
0.0427458
0.0427566
0.0429116
0.0433331
0.0441469
0.0453505
0.046685
0.047617
0.0473903
0.0433628
0.0393235
0.0321646
0.0320264
0.0403529
0.0404757
0.0321627
0.0318854
0.0398563
0.0399681
0.0320204
0.031941
0.0385566
0.0395505
0.0320785
0.0317713
0.0393547
0.0394551
0.0318667
0.0316295
0.0388433
0.0389327
0.0317327
0.0318529
0.0387777
0.0436119
0.0438645
0.0397875
0.0320077
0.0315316
0.0383282
0.0384055
0.0315855
0.0313991
0.0378039
0.0378699
0.0314633
0.031782
0.0390101
0.0400348
0.0319545
0.031312
0.0372769
0.0373302
0.03132
0.0311948
0.0367422
0.0367839
0.0312187
0.031727
0.0392541
0.0441201
0.0478878
0.0477236
0.0475576
0.0477473
0.047876
0.0480026
0.0481267
0.0480496
0.0443778
0.0402926
0.031915
0.0311081
0.0362063
0.0362348
0.0310596
0.0310048
0.0356632
0.0356798
0.0309536
0.0316889
0.03951
0.0405609
0.031904
0.0309154
0.0351206
0.0351239
0.030797
0.0307976
0.0345694
0.0345585
0.0307103
0.0316882
0.0397779
0.0446368
0.0448963
0.0408379
0.0319262
0.0307251
0.0340222
0.0339933
0.0305613
0.0306185
0.0334755
0.0334271
0.0304745
0.0317169
0.0400558
0.0411224
0.0319816
0.0305451
0.0329292
0.0328684
0.0303166
0.0304308
0.0323858
0.0323118
0.0302169
0.0317856
0.0403427
0.0451547
0.0485115
0.0483624
0.0482081
0.0482476
0.0483644
0.0484763
0.0485822
0.048654
0.0454101
0.0414107
0.0320825
0.0303439
0.0318506
0.0317597
0.0300323
0.0302045
0.0313185
0.0312165
0.0298954
0.0319083
0.0406348
0.0416981
0.0322443
0.0300817
0.0307987
0.0306832
0.0296566
0.0298966
0.0302903
0.0301708
0.0294662
0.0320974
0.0409263
0.0456609
0.0459057
0.0419764
0.0324849
0.0297424
0.0298018
0.0296745
0.0291923
0.0295646
0.029326
0.0291958
0.0290218
0.032357
0.0412077
0.042238
0.0327385
0.0294603
0.0288678
0.0287289
0.0288105
0.0293483
0.0284251
0.0282786
0.0287305
0.032597
0.0414707
0.0461422
0.0490275
0.0489138
0.0487887
0.0486809
0.0487711
0.0488512
0.0489193
0.0491274
0.046368
0.0424856
0.0329626
0.0293356
0.0279951
0.0278392
0.0286326
0.0293237
0.027578
0.0274101
0.0286402
0.0327941
0.0417178
0.0427248
0.0331581
0.0293815
0.0271897
0.0269889
0.0286256
0.0294117
0.0268365
0.0265999
0.0286834
0.0329933
0.0419551
0.0465802
0.0467746
0.0429551
0.0333699
0.0294875
0.0265095
0.0262585
0.0286906
0.0295367
0.0261931
0.025949
0.02877
0.0332146
0.0421836
0.043173
0.0336
0.0296295
0.0259049
0.0256619
0.0287958
0.0296939
0.025635
0.0254054
0.0288928
0.0334498
0.0424
0.0469465
0.0493154
0.0492749
0.049211
0.0489735
0.0490114
0.04903
0.0478321
0.0478125
0.0477767
0.047728
0.0476686
0.0476004
0.047525
0.0474437
0.0473577
0.0472677
0.0471748
0.0470796
0.0469825
0.0468841
0.0467847
0.0454087
0.0454662
0.0455227
0.04419
0.0441765
0.044162
0.0433115
0.0432892
0.0432661
0.0432418
0.0442021
0.0455775
0.0456303
0.04568
0.0457262
0.0442215
0.0442187
0.0442119
0.043216
0.043188
0.0431571
0.0425551
0.0426094
0.0426636
0.0427164
0.0427676
0.0428173
0.0428653
0.0426972
0.0426347
0.0425693
0.0425382
0.0426116
0.0426808
0.0427364
0.0426639
0.0425873
0.0425061
0.0424583
0.0425007
0.0424289
0.0423531
0.0422681
0.042176
0.0422782
0.0423726
0.0424196
0.0423336
0.042252
0.0421788
0.0420708
0.0421698
0.0424941
0.0431212
0.0442189
0.0457673
0.0458028
0.0458307
0.04585
0.0441641
0.044193
0.04421
0.0430806
0.043039
0.0429757
0.0428889
0.0441261
0.0458592
0.0458556
0.0458363
0.0457993
0.043896
0.0440085
0.0440765
0.0427721
0.0426272
0.0424522
0.0415981
0.0417608
0.0419238
0.0420784
0.0422104
0.0423244
0.0424195
0.0420589
0.0419337
0.0418058
0.0417796
0.0418692
0.0419673
0.0421148
0.0420649
0.0420296
0.0420083
0.0417003
0.0416804
0.0415589
0.0414449
0.041337
0.0415474
0.0415842
0.0416356
0.0420022
0.042011
0.0420308
0.0420602
0.0415256
0.0412443
0.0414388
0.0422472
0.0437415
0.0457372
0.0478316
0.0490253
0.049327
0.0470924
0.0433745
0.0338482
0.0298005
0.0253936
0.0251767
0.0289332
0.0298781
0.0251825
0.024982
0.0290468
0.0337008
0.0425994
0.0435554
0.0341124
0.0299971
0.0250111
0.0248109
0.0290997
0.0300872
0.0248606
0.0246611
0.0292308
0.0339664
0.0427782
0.0472027
0.04727
0.0437118
0.0343865
0.0302195
0.0247325
0.0245335
0.0292972
0.0303213
0.0246215
0.0244202
0.0294426
0.0342394
0.0429326
0.0438364
0.0346648
0.0304647
0.0245236
0.0243258
0.0295209
0.0305766
0.0244399
0.0242387
0.0296783
0.034513
0.043054
0.047283
0.0491261
0.0492365
0.0493028
0.0489932
0.0489326
0.0488467
0.0487312
0.0489734
0.0472292
0.0439169
0.0349466
0.03073
0.0243628
0.0241754
0.0297659
0.0308351
0.0243352
0.0241303
0.0299144
0.0347933
0.0431256
0.0439253
0.0352119
0.0309602
0.0243388
0.0241236
0.0299702
0.0310303
0.0243688
0.0241504
0.0300762
0.0350498
0.0431122
0.0470881
0.0468074
0.0438236
0.0354358
0.0311119
0.0244278
0.0242057
0.0300829
0.031127
0.0245068
0.0242806
0.0301227
0.0352537
0.042976
0.0435668
0.0355737
0.0311399
0.0245992
0.024367
0.0300551
0.0310696
0.024696
0.0244575
0.0299983
0.035338
0.0426407
0.0462867
0.0476077
0.0483279
0.0487493
0.0485122
0.048092
0.0475328
0.0470134
0.0468323
0.0454596
0.0430004
0.0355514
0.0309862
0.0247921
0.0245404
0.0298245
0.030794
0.024865
0.0245943
0.0296382
0.03524
0.0419784
0.042177
0.0353072
0.0305583
0.0248898
0.0245759
0.0292825
0.0301317
0.0248076
0.0244433
0.0288088
0.0348505
0.0410298
0.0446412
0.0441999
0.0412532
0.034904
0.0296416
0.0246528
0.0243375
0.0282742
0.0292938
0.0247379
0.0246902
0.0281889
0.0348406
0.0405039
0.0409585
0.0357454
0.0294505
0.0255353
0.0260195
0.0284707
0.0296661
0.0274063
0.0219535
0.0225963
0.0278142
0.0291157
0.0284752
0.0365348
0.0405568
0.0441155
0.0457223
0.0459222
0.0462968
0.0466358
0.0463136
0.0460891
0.0459883
0.0457562
0.0444162
0.0412331
0.0384057
0.0385641
0.0311312
0.0242559
0.0227524
0.0231311
0.0237172
0.0264321
0.021781
0.0229367
0.0261189
0.033131
0.0415928
0.0342732
0.0288439
0.0238743
0.0252916
0.0287747
0.0312009
0.0274645
0.0225111
0.0238561
0.0248978
0.0318695
0.0262223
0.022897
0.0242711
0.0254008
0.0295822
0.0358546
0.0294891
0.0383788
0.0326714
0.0282548
0.0233483
0.0248073
0.0305058
0.0341316
0.0326922
0.0261007
0.0279176
0.0242281
0.0264499
0.0289828
0.0241797
0.0256357
0.0327863
0.0265937
0.0296577
0.0248059
0.0268953
0.0322711
0.0385566
0.043428
0.0465378
0.0420013
0.0388662
0.0312463
0.0311372
0.0432714
0.0417466
0.0445109
0.0468326
0.0454278
0.0452774
0.0416344
0.0392527
0.0435283
0.0378175
0.0306696
0.0292413
0.0458269
0.045105
0.0460966
0.046009
0.0460141
0.0465648
0.047222
0.046783
0.0477272
0.0488262
0.0483288
0.049771
0.0488308
0.0461245
0.0420128
0.0363335
0.03028
0.0252133
0.0275034
0.0302823
0.0252958
0.0273268
0.0331428
0.0385508
0.0342699
0.0367957
0.043329
0.0371807
0.0308664
0.0256111
0.0281579
0.0315027
0.0259401
0.0283921
0.0350069
0.0397165
0.0350882
0.0376254
0.046006
0.0484603
0.0456381
0.047223
0.0506165
0.0522276
0.0513843
0.0487326
0.0445649
0.039233
0.0329193
0.0267014
0.0298649
0.0256616
0.0279213
0.0312489
0.025981
0.028219
0.0382333
0.0316304
0.0264379
0.0292536
0.0336263
0.0275199
0.0308444
0.0263274
0.0285091
0.0351707
0.0420509
0.038758
0.0444166
0.0366447
0.0487485
0.0515478
0.0471334
0.0419689
0.0339797
0.0352496
0.0376305
0.0399611
0.0476673
0.0499534
0.0543419
0.0518444
0.0483288
0.0509646
0.047054
0.0406038
0.0327387
0.027063
0.0301149
0.034553
0.0280502
0.0319765
0.0269714
0.0293417
0.0413024
0.0343071
0.0279789
0.0320934
0.0272932
0.0302512
0.0349136
0.0281735
0.0321309
0.027197
0.0295542
0.0428381
0.0383698
0.0448465
0.0379824
0.0415934
0.0477034
0.040031
0.0545512
0.0501724
0.0441949
0.0372715
0.038342
0.0415521
0.0508452
0.0546434
0.0524091
0.053026
0.0563324
0.0564539
0.0550303
0.0533449
0.0535669
0.0547862
0.0558546
0.0536832
0.0536888
0.0531548
0.0522136
0.0510221
0.0506289
0.0498234
0.0483528
0.0482997
0.047774
0.0457104
0.0459294
0.0432116
0.0433571
0.0436615
0.0440319
0.0444571
0.0449142
0.0453872
0.045836
0.0463064
0.0468125
0.0472739
0.0475299
0.0476821
0.0477612
0.0478078
0.0456403
0.0454981
0.0452744
0.0430109
0.0433054
0.0435438
0.0420339
0.041812
0.0415612
0.0412995
0.0426696
0.0449734
0.0445286
0.0440399
0.0435833
0.0416229
0.0419395
0.0422825
0.0410566
0.04084
0.040658
0.0406609
0.0406673
0.0407226
0.0408171
0.0409446
0.0411129
0.0412808
0.041164
0.0410977
0.0410499
0.0415595
0.0415324
0.0415207
0.0421045
0.0421595
0.042232
0.0423247
0.0416138
0.0410284
0.0410341
0.0410764
0.0411585
0.0419721
0.0418156
0.041698
0.0424426
0.0425908
0.0427755
0.0430029
0.0421761
0.0412975
0.0407082
0.0405413
0.0413234
0.0431667
0.0427441
0.0423407
0.041996
0.0407556
0.0408188
0.0410405
0.0404965
0.0405574
0.0407271
0.0410155
0.0408092
0.0417367
0.0416104
0.0416992
0.0419508
0.041976
0.0414302
0.0410516
0.0414181
0.0419235
0.0425337
0.0433903
0.0426948
0.0421157
0.0416437
0.0412763
0.0410103
0.0408224
0.0415025
0.0417845
0.0421489
0.0431258
0.0427448
0.0424315
0.0432792
0.0436105
0.0440019
0.0444565
0.0435759
0.0425988
0.0431307
0.0437436
0.0444249
0.045352
0.0446904
0.044098
0.044976
0.0455603
0.0462085
0.0469178
0.0460797
0.0451784
0.0441803
0.0432407
0.0426436
0.0424175
0.0432667
0.0434864
0.0455063
0.0453138
0.0456257
0.0481509
0.0479015
0.0510753
0.0509392
0.0505672
0.0504162
0.048781
0.0482591
0.0479028
0.0465936
0.0458923
0.0454327
0.0446103
0.0439478
0.043822
0.0430354
0.0434071
0.0440569
0.0449761
0.0442598
0.0451845
0.0447149
0.0456823
0.0467187
0.0464029
0.0474562
0.047404
0.048407
0.049516
0.0496457
0.0506932
0.0531459
0.0564001
0.0576545
0.0580229
0.0575454
0.0594578
0.0583996
0.0551686
0.0509611
0.0538241
0.0493202
0.0410197
0.0326518
0.0278395
0.03086
0.0388332
0.0466429
0.0431017
0.0355697
0.0289164
0.0328992
0.0279323
0.0303091
0.0439961
0.0361934
0.0291506
0.0338388
0.0286766
0.0321645
0.0377621
0.0298883
0.0343346
0.0289291
0.0317099
0.0471828
0.0421105
0.0487102
0.0403858
0.0448865
0.050928
0.042515
0.0586924
0.0555061
0.0591897
0.0548683
0.0580395
0.0537383
0.0460629
0.0362538
0.0298891
0.0347196
0.0291703
0.0323961
0.0378474
0.0311183
0.0360457
0.0299682
0.0336269
0.0429027
0.0503009
0.0453568
0.0517947
0.0414155
0.0444448
0.0482956
0.0578755
0.0634254
0.0605137
0.0632852
0.0584216
0.0608206
0.0628805
0.0655662
0.0674569
0.0668618
0.0690395
0.0677364
0.0641588
0.060558
0.0540822
0.0443413
0.0348087
0.0303819
0.0366281
0.0311707
0.0388252
0.0322059
0.0411616
0.0488159
0.0548302
0.0471197
0.0499027
0.0517511
0.0562639
0.0499543
0.0606984
0.0417744
0.0322405
0.0382738
0.0315545
0.0369694
0.0305789
0.0347671
0.0449147
0.052729
0.0470048
0.0602718
0.0634859
0.0682137
0.0657846
0.0632988
0.0586375
0.0525307
0.0432391
0.0334538
0.0412351
0.0323311
0.0390881
0.0315551
0.0375188
0.0306951
0.0350344
0.0421266
0.0336086
0.0404075
0.0318648
0.0373764
0.0313025
0.0354239
0.0531549
0.0464292
0.0554611
0.0499473
0.0564477
0.0455661
0.0481921
0.0525317
0.0579197
0.0498411
0.0513537
0.0546328
0.0633447
0.0687534
0.0657613
0.0627765
0.0691238
0.0623262
0.0658183
0.0606979
0.053413
0.0427094
0.033454
0.041122
0.0327019
0.0392064
0.0320553
0.0375231
0.045851
0.0349078
0.0426131
0.0342127
0.0416548
0.0326657
0.0384867
0.0321718
0.0365956
0.0563053
0.0464565
0.0352466
0.0443624
0.034738
0.0429418
0.0340218
0.0409619
0.0333969
0.0393253
0.0482407
0.0365887
0.0447834
0.0359789
0.0439421
0.034394
0.0406568
0.0339158
0.0389778
0.0594444
0.0497675
0.0376874
0.0481726
0.037229
0.0469027
0.0364058
0.0444377
0.0356609
0.0426605
0.0527544
0.0397203
0.0495982
0.0390454
0.0488713
0.03747
0.0461288
0.0372666
0.045267
0.0360815
0.0425997
0.055867
0.0648427
0.0567346
0.0658512
0.0588795
0.0665287
0.0550418
0.0612571
0.0674121
0.0585435
0.0629805
0.0675994
0.0595684
0.0729931
0.0763929
0.0689395
0.0614762
0.0514754
0.0544394
0.0620705
0.0505195
0.0569417
0.0634768
0.0532887
0.0548636
0.0592124
0.0639069
0.0559743
0.0694269
0.0758339
0.0723568
0.0752232
0.069442
0.0654868
0.0581445
0.0516198
0.0591342
0.0482088
0.054213
0.0601289
0.0524752
0.0562572
0.0509036
0.0663854
0.0695362
0.0662883
0.0699954
0.0739763
0.0717691
0.0744783
0.0696187
0.065833
0.0693051
0.0720178
0.0786395
0.0810244
0.0799718
0.0826732
0.0810719
0.0842113
0.0816802
0.0773198
0.0737425
0.0770371
0.0739187
0.0774143
0.0736036
0.0772678
0.0735772
0.0775362
0.0722051
0.064846
0.054765
0.0414649
0.0536482
0.0402386
0.0514109
0.0394165
0.0501848
0.0383459
0.0472305
0.0375959
0.0452638
0.0561495
0.0422072
0.0531652
0.0415358
0.0523724
0.0399047
0.0496157
0.0397863
0.0488189
0.0384679
0.045715
0.0597949
0.0690306
0.0605035
0.0693276
0.0622182
0.070851
0.0583703
0.0652471
0.0712375
0.0609916
0.0616537
0.0666311
0.0722399
0.062822
0.0633231
0.0678689
0.0780371
0.0843286
0.0811486
0.0774693
0.0852261
0.0779859
0.0815005
0.0772958
0.0860312
0.0767441
0.0689351
0.059034
0.0445728
0.0582028
0.0434022
0.0561231
0.04261
0.0550512
0.041505
0.0522683
0.0404744
0.049317
0.0615427
0.0459649
0.0588546
0.0453182
0.0581158
0.0437058
0.0558483
0.0436795
0.0555596
0.041723
0.0518477
0.0409412
0.0488749
0.0732541
0.0641836
0.0740247
0.065718
0.0748442
0.0676049
0.0755567
0.0630876
0.0698102
0.0765211
0.065958
0.0714065
0.0766195
0.067063
0.0673406
0.0719739
0.0828846
0.0867906
0.0830378
0.0866899
0.0833539
0.0873456
0.0830026
0.08727
0.0832591
0.087704
0.0824308
0.0871941
0.0820949
0.0729553
0.061746
0.0463077
0.0612321
0.0454087
0.0589137
0.0444447
0.0571013
0.0428852
0.0521799
0.0655094
0.0500152
0.0639733
0.0475058
0.0612967
0.0473858
0.0607499
0.0454234
0.0573376
0.044578
0.054214
0.0777624
0.067977
0.0509754
0.0678635
0.0506385
0.0673699
0.0496688
0.0655594
0.0486028
0.0638072
0.0467887
0.0581686
0.0716668
0.0549055
0.0701728
0.0521657
0.0677405
0.0516396
0.0671984
0.0491946
0.0633793
0.0480948
0.0593532
0.0841651
0.075136
0.0848269
0.0768037
0.0857297
0.0792079
0.0866463
0.0736823
0.0749205
0.080984
0.087283
0.077029
0.0820157
0.0870467
0.0784052
0.0933124
0.0971613
0.0882923
0.0795093
0.0687032
0.0711975
0.0795705
0.0731888
0.0813328
0.0680856
0.069574
0.0757234
0.0813859
0.0710845
0.0714828
0.0764305
0.087945
0.0961746
0.0918092
0.0951949
0.0885003
0.091044
0.0938994
0.0902033
0.0927093
0.0892988
0.0914762
0.0964295
0.0993727
0.0977366
0.101147
0.0991862
0.102795
0.100474
0.10451
0.101908
0.106101
0.102919
0.0982155
0.0942206
0.0979903
0.0945958
0.0987515
0.0941174
0.0987352
0.0945092
0.0992393
0.0936605
0.0986003
0.0932208
0.0839317
0.0738375
0.0548439
0.0731637
0.053541
0.0708923
0.0520683
0.0690608
0.0500698
0.0628778
0.076545
0.0588243
0.0749398
0.055383
0.0717231
0.0546553
0.0710605
0.0522508
0.0659285
0.0808645
0.090174
0.0817602
0.0904694
0.0840503
0.0924383
0.0785414
0.0801198
0.0865165
0.092465
0.0816818
0.0821292
0.0872386
0.099389
0.108246
0.103564
0.107162
0.100021
0.102749
0.105705
0.101829
0.104346
0.100772
0.109408
0.113102
0.111057
0.114887
0.11258
0.116753
0.114225
0.109362
0.098547
0.0903341
0.0811279
0.0634085
0.0803671
0.0604084
0.0784836
0.0577456
0.0766544
0.05534
0.0707316
0.0823747
0.0669107
0.0816668
0.0617743
0.0793283
0.0600286
0.0779718
0.0571289
0.0728535
0.0865383
0.0958757
0.0880141
0.0967153
0.09013
0.097923
0.086214
0.092239
0.0981975
0.0877295
0.0884496
0.0931599
0.10555
0.110236
0.105675
0.109978
0.105934
0.110681
0.105168
0.110043
0.104699
0.0958607
0.0867829
0.0702538
0.0857845
0.0668699
0.0838684
0.0635087
0.0820705
0.0600697
0.0763652
0.0871652
0.0722922
0.0858259
0.0662211
0.0833648
0.0622823
0.0784789
0.0995892
0.0900537
0.0741766
0.0898286
0.0717118
0.0883776
0.0676914
0.0831034
0.0941087
0.0795362
0.091614
0.0736858
0.0892274
0.0687815
0.0844304
0.105009
0.0959659
0.0806458
0.095172
0.0778194
0.0932308
0.0734372
0.0879865
0.0990913
0.0846461
0.0957345
0.0784221
0.0929631
0.0731491
0.0878164
0.109507
0.0990996
0.0836225
0.0971292
0.0804478
0.093268
0.104546
0.0899072
0.100095
0.0857756
0.0985071
0.0794971
0.0930778
0.106512
0.116225
0.109014
0.117772
0.104634
0.1119
0.119051
0.108169
0.130923
0.126315
0.131366
0.125772
0.130417
0.124688
0.115426
0.106491
0.0917677
0.103282
0.0857042
0.0969381
0.109321
0.0939089
0.104446
0.087592
0.0981631
0.111596
0.120347
0.114963
0.122635
0.110703
0.111854
0.117786
0.129836
0.139678
0.129238
0.120188
0.111567
0.0980358
0.108292
0.092297
0.101553
0.114366
0.0990478
0.108956
0.092832
0.102092
0.115992
0.124907
0.11972
0.127357
0.115434
0.116502
0.122212
0.135366
0.140182
0.134929
0.139391
0.134135
0.12475
0.11577
0.101802
0.111907
0.0952213
0.104478
0.11731
0.099562
0.107444
0.128122
0.119092
0.104796
0.115127
0.101263
0.109194
0.121793
0.105516
0.113218
0.125694
0.135188
0.121698
0.129769
0.137503
0.126445
0.14781
0.13843
0.131429
0.119114
0.122975
0.120717
0.126855
0.139963
0.146578
0.143287
0.142893
0.144959
0.149069
0.149596
0.14687
0.143487
0.138478
0.134388
0.136868
0.139443
0.135557
0.129844
0.121462
0.110892
0.101768
0.105294
0.113737
0.100771
0.102879
0.108438
0.114338
0.104877
0.120984
0.125261
0.12847
0.121464
0.116342
0.106973
0.100867
0.108115
0.0957082
0.0975107
0.10278
0.109106
0.0995089
0.120839
0.109702
0.100859
0.0918944
0.0945627
0.103176
0.0892804
0.0917597
0.0975866
0.103522
0.0939595
0.0987254
0.0933028
0.110487
0.119702
0.1111
0.115343
0.114925
0.118479
0.114095
0.11698
0.113149
0.115412
0.120457
0.122095
0.118476
0.120041
0.122475
0.12428
0.12467
0.123976
0.122174
0.125943
0.123905
0.127929
0.125673
0.129794
0.126905
0.12149
0.116301
0.121037
0.12449
0.11638
0.131901
0.13535
0.133744
0.137434
0.140427
0.140252
0.138192
0.137846
0.135922
0.133342
0.133639
0.131177
0.131308
0.129047
0.128965
0.126865
0.126627
0.125747
0.126811
0.128159
0.129337
0.130563
0.131861
0.133001
0.134358
0.135435
0.136846
0.137885
0.139307
0.140439
0.141772
0.142645
0.142664
0.141623
0.144756
0.14499
0.146693
0.147313
0.149109
0.147944
0.148856
0.150386
0.15149
0.151777
0.151054
0.153962
0.152585
0.14805
0.142082
0.134434
0.125779
0.113335
0.121483
0.106825
0.113799
0.126349
0.109509
0.116627
0.136515
0.128056
0.114599
0.123584
0.109898
0.117115
0.130445
0.143572
0.138525
0.14544
0.135087
0.151306
0.154316
0.147369
0.140637
0.128319
0.131793
0.130115
0.136306
0.14715
0.150742
0.158004
0.15513
0.151626
0.154747
0.150294
0.14207
0.131542
0.117472
0.123969
0.135891
0.148336
0.144049
0.135442
0.119844
0.125943
0.138677
0.14685
0.137724
0.124803
0.131191
0.141648
0.152863
0.148861
0.153871
0.158147
0.160003
0.155272
0.157099
0.162858
0.161152
0.158843
0.161279
0.158398
0.149558
0.127853
0.122093
0.135229
0.129158
0.141473
0.143892
0.139003
0.124901
0.132433
0.143633
0.127983
0.133682
0.153414
0.1441
0.130204
0.137402
0.148368
0.133279
0.138885
0.158191
0.149366
0.13565
0.142822
0.153577
0.138807
0.144126
0.163451
0.154321
0.140452
0.147382
0.157162
0.165484
0.169866
0.161046
0.17354
0.173843
0.169877
0.164537
0.153611
0.158857
0.168017
0.15734
0.162476
0.171055
0.175368
0.168051
0.172106
0.178686
0.176196
0.171987
0.162409
0.167688
0.175252
0.181161
0.178164
0.176176
0.167819
0.172792
0.179328
0.183542
0.181235
0.174197
0.179246
0.184398
0.18824
0.185605
0.184211
0.186058
0.182299
0.187526
0.190678
0.192582
0.192834
0.190668
0.195623
0.195481
0.197216
0.194656
0.20042
0.200733
0.20491
0.208432
0.213789
0.2072
0.218067
0.225454
0.228087
0.243562
0.237252
0.254272
0.253794
0.276449
0.309043
0.354351
0.403553
0.431064
0.363306
0.325782
0.32872
0.301424
0.279133
0.299639
0.293034
0.316216
0.348405
0.321162
0.293119
0.270622
0.267705
0.281852
0.299745
0.282825
0.269113
0.240519
0.253613
0.270449
0.258888
0.241557
0.25213
0.240674
0.223159
0.240819
0.22615
0.219947
0.208164
0.218566
0.210164
0.206502
0.226351
0.222901
0.234638
0.220359
0.210762
0.220875
0.225818
0.223649
0.217194
0.209438
0.201671
0.194665
0.188746
0.19002
0.196865
0.205816
0.216775
0.229335
0.247898
0.273135
0.257294
0.243444
0.267241
0.290838
0.27765
0.251626
0.18694
0.184794
0.189271
0.192073
0.197486
0.193533
0.189871
0.186419
0.182494
0.180177
0.177925
0.175778
0.178525
0.180994
0.183635
0.186516
0.183457
0.180675
0.182263
0.18533
0.18881
0.192806
0.197465
0.202943
0.207862
0.200712
0.202734
0.211262
0.211975
0.202989
0.196297
0.196295
0.19504
0.190444
0.186594
0.183298
0.183769
0.187194
0.19128
0.191188
0.187083
0.183674
0.180763
0.180827
0.180423
0.179534
0.178147
0.176233
0.173743
0.170605
0.16621
0.164797
0.16345
0.162175
0.160975
0.159851
0.158802
0.157824
0.156915
0.156068
0.155288
0.154573
0.153917
0.153319
0.152776
0.152284
0.154305
0.154903
0.155555
0.156265
0.157035
0.157869
0.15877
0.15974
0.160785
0.161912
0.163126
0.16443
0.165828
0.167323
0.168917
0.17183
0.170041
0.168373
0.170337
0.17215
0.174111
0.175844
0.173739
0.171811
0.170038
0.168659
0.166821
0.165378
0.164037
0.162792
0.164332
0.165667
0.167106
0.168403
0.166893
0.165495
0.166349
0.167785
0.169339
0.171027
0.172864
0.174875
0.177087
0.17788
0.175604
0.173548
0.1739
0.175959
0.17825
0.178223
0.175971
0.173948
0.172115
0.172032
0.171679
0.169968
0.168395
0.166945
0.167315
0.16876
0.170326
0.17044
0.168902
0.167483
0.166169
0.165979
0.165603
0.16502
0.1642
0.163094
0.161638
0.16057
0.159577
0.158657
0.15989
0.160879
0.161945
0.162998
0.161883
0.160848
0.159886
0.158972
0.157803
0.157014
0.156284
0.155611
0.156599
0.15733
0.15812
0.158992
0.158162
0.157393
0.158027
0.158821
0.159675
0.160594
0.161581
0.162644
0.163788
0.164359
0.163204
0.16213
0.162519
0.163589
0.16474
0.164949
0.163816
0.16276
0.161775
0.161522
0.161131
0.160202
0.159336
0.158531
0.158922
0.159728
0.160593
0.160857
0.16
0.159201
0.159352
0.160141
0.160984
0.161886
0.16285
0.163882
0.164989
0.166177
0.167455
0.168833
0.170324
0.171943
0.173712
0.17566
0.177824
0.180256
0.183034
0.18627
0.190139
0.194904
0.201074
0.209237
0.203244
0.197321
0.192628
0.196504
0.200606
0.204309
0.193906
0.194513
0.191967
0.193458
0.198913
0.200565
0.203963
0.192033
0.188532
0.183598
0.190111
0.178208
0.177562
0.176804
0.179411
0.180746
0.181923
0.180548
0.178269
0.175621
0.176542
0.172693
0.171732
0.170257
0.169012
0.165303
0.156043
0.159121
0.169488
0.170959
0.165469
0.167568
0.160667
0.150809
0.153709
0.161578
0.156231
0.146176
0.149063
0.161844
0.165143
0.162753
0.164354
0.167457
0.165992
0.164844
0.163498
0.162389
0.160755
0.160039
0.158417
0.156227
0.156193
0.157661
0.158651
0.159326
0.161064
0.161755
0.162079
0.164202
0.164549
0.16674
0.168687
0.16948
0.169994
0.170284
0.173353
0.173775
0.174196
0.170792
0.170478
0.167475
0.167392
0.167324
0.167147
0.164656
0.164639
0.164595
0.161832
0.16194
0.162067
0.16214
0.159583
0.159689
0.159658
0.157253
0.157232
0.15689
0.156245
0.15527
0.153856
0.152843
0.153819
0.154441
0.15229
0.151971
0.151365
0.149471
0.149761
0.149763
0.14962
0.152305
0.154779
0.154797
0.154667
0.154443
0.157129
0.156922
0.156683
0.159405
0.159216
0.15906
0.158993
0.161785
0.164609
0.164714
0.167687
0.167983
0.171308
0.174944
0.179152
0.184356
0.186589
0.180607
0.175817
0.171775
0.172068
0.176151
0.180892
0.186593
0.186024
0.192479
0.190227
0.187759
0.185162
0.188963
0.192323
0.188257
0.184831
0.181897
0.18031
0.182867
0.185746
0.182712
0.180395
0.178256
0.175904
0.177666
0.179506
0.181361
0.183177
0.184735
0.179892
0.180684
0.176119
0.172126
0.171838
0.175633
0.174959
0.17889
0.177621
0.176243
0.174813
0.173391
0.170818
0.171951
0.173053
0.174072
0.170756
0.171374
0.168119
0.168429
0.168572
0.168472
0.168238
0.165058
0.164861
0.161953
0.161813
0.159069
0.159257
0.159493
0.162153
0.162349
0.165253
0.165379
0.165352
0.16517
0.162506
0.162568
0.162503
0.159913
0.159721
0.157342
0.157063
0.156775
0.156519
0.15635
0.156324
0.156452
0.15375
0.153907
0.154174
0.151385
0.15164
0.151938
0.152171
0.149368
0.149086
0.148861
0.146272
0.146331
0.146503
0.146745
0.147011
0.14717
0.14719
0.146923
0.146325
0.145476
0.144246
0.142972
0.143778
0.144345
0.141898
0.141734
0.141226
0.139091
0.138649
0.136413
0.136046
0.135315
0.133415
0.132763
0.130765
0.130216
0.128099
0.127647
0.125401
0.125061
0.12431
0.123327
0.121928
0.120242
0.118016
0.118009
0.11593
0.115769
0.113847
0.111231
0.107915
0.109435
0.111741
0.113517
0.112656
0.111289
0.109649
0.107513
0.107552
0.105565
0.105404
0.10357
0.103263
0.101583
0.10119
0.0996031
0.097611
0.0947088
0.0908345
0.0932341
0.0896936
0.0916239
0.0884839
0.0833831
0.0806681
0.0776798
0.079963
0.0824644
0.0793622
0.0872066
0.0899629
0.0919842
0.093576
0.093866
0.0955572
0.0957455
0.0975818
0.0969708
0.0957784
0.0947941
0.0935332
0.0926157
0.0915423
0.0900436
0.0882249
0.0857616
0.0864481
0.0881133
0.0895114
0.0883933
0.0873966
0.0862122
0.0846587
0.084272
0.0828006
0.0822548
0.0809715
0.0793372
0.077219
0.0775565
0.0756895
0.0731821
0.0741248
0.0719355
0.0724431
0.0705147
0.0707305
0.0721577
0.0712581
0.0701787
0.0690149
0.0682952
0.0671898
0.0658267
0.064159
0.0620747
0.0587113
0.0540045
0.055941
0.0530628
0.0564998
0.0608265
0.0626284
0.0641571
0.0652803
0.0663387
0.0668181
0.0666566
0.0691047
0.0693909
0.0658922
0.0657283
0.0687479
0.0717593
0.0732084
0.074007
0.0751575
0.0758002
0.0771804
0.0782012
0.0790834
0.0801862
0.0811749
0.0792131
0.0789716
0.076583
0.0766756
0.0762007
0.0743215
0.0740304
0.0717103
0.0683168
0.065841
0.0663528
0.0681354
0.0709033
0.0707003
0.07371
0.0732654
0.0730989
0.0758485
0.0756158
0.0785595
0.0816022
0.0832767
0.0839287
0.0853092
0.0861917
0.0865333
0.0861128
0.0888956
0.0905023
0.0912437
0.0914761
0.0909103
0.0939226
0.0936359
0.0963228
0.0979591
0.0990723
0.100156
0.101066
0.102412
0.103393
0.104684
0.105667
0.106892
0.107953
0.109109
0.110297
0.11125
0.10924
0.108835
0.106661
0.106401
0.103987
0.103938
0.101254
0.101476
0.0985148
0.0989809
0.0987208
0.0963494
0.0958357
0.0956259
0.0956831
0.098269
0.0981882
0.100913
0.100767
0.103582
0.103405
0.106295
0.106095
0.109059
0.11178
0.113631
0.114978
0.116017
0.117306
0.118444
0.119614
0.120889
0.119346
0.117227
0.116843
0.114558
0.114321
0.111825
0.111533
0.111384
0.114283
0.114132
0.117083
0.11985
0.121834
0.122463
0.122672
0.122469
0.119552
0.119681
0.119889
0.116898
0.116811
0.116916
0.114672
0.114285
0.114106
0.1117
0.111446
0.109175
0.108822
0.108696
0.108802
0.106049
0.106256
0.106692
0.107343
0.108159
0.109731
0.110472
0.112176
0.112829
0.111349
0.110172
0.109122
0.108044
0.106947
0.105915
0.105007
0.104274
0.10374
0.103463
0.10129
0.100911
0.098892
0.098416
0.0965578
0.0959715
0.0942766
0.0936148
0.0931997
0.0930472
0.0932124
0.0905277
0.0906154
0.0880834
0.0880271
0.0882441
0.0888515
0.0856511
0.0854888
0.0856831
0.0839338
0.0833451
0.0830255
0.0830964
0.0833749
0.0840735
0.0807285
0.0813608
0.0781802
0.0756906
0.0760818
0.0780431
0.0783472
0.0805408
0.0806639
0.0810628
0.0818343
0.0828513
0.0821373
0.0809245
0.0798151
0.0789031
0.0778852
0.0768597
0.076025
0.0748995
0.073971
0.073397
0.0719894
0.0711891
0.0707333
0.0691352
0.068535
0.0672441
0.06833
0.0695491
0.0701076
0.0712574
0.0725004
0.0730398
0.0742354
0.0754942
0.075121
0.0737748
0.0735298
0.0721273
0.0708181
0.0705627
0.0691905
0.0679023
0.0666447
0.0654569
0.0644232
0.063734
0.0631789
0.0633102
0.0635849
0.0643765
0.0641514
0.0634815
0.0623157
0.0610516
0.0605556
0.0593646
0.0586465
0.0564103
0.0557956
0.0591443
0.05893
0.0614155
0.0618106
0.0613186
0.0607696
0.0607211
0.0590196
0.0583481
0.0581946
0.058317
0.0557873
0.0556347
0.0537591
0.0531983
0.0530559
0.0511714
0.0520329
0.0530737
0.0529813
0.0517779
0.0506425
0.0506741
0.0518829
0.0531425
0.0545048
0.0542313
0.0542363
0.0545768
0.0556287
0.0563488
0.0571993
0.0582816
0.0580519
0.0568086
0.0567241
0.0554611
0.0555277
0.0559724
0.0574301
0.0569128
0.0584093
0.0580449
0.0594536
0.0593288
0.059477
0.0598906
0.0610111
0.0616685
0.0626511
0.0637896
0.0634932
0.0622258
0.061002
0.0607343
0.0620294
0.0633982
0.0648751
0.0648032
0.0650342
0.0663109
0.0676495
0.0690768
0.0692636
0.0677191
0.0662031
0.066425
0.0679344
0.0694385
0.0696363
0.0681506
0.066665
0.0651682
0.0636577
0.0621126
0.0606749
0.060982
0.062484
0.0639675
0.0642818
0.0628257
0.0613635
0.0598988
0.0603085
0.0588707
0.059317
0.0579136
0.0565097
0.0551058
0.0536961
0.0522822
0.0509555
0.0497307
0.0485597
0.048994
0.0478096
0.0485411
0.0473182
0.0462053
0.0470896
0.0460096
0.0469466
0.0459779
0.0450479
0.0459974
0.0468755
0.0478066
0.0486154
0.0477158
0.0468691
0.0476852
0.0485066
0.0493788
0.0502968
0.0495626
0.0487884
0.047974
0.049035
0.0482251
0.0493627
0.0505522
0.0497809
0.0510532
0.0502803
0.0516226
0.0529803
0.0543119
0.0549015
0.0536138
0.0523122
0.0529801
0.0517482
0.0524334
0.0512723
0.0501367
0.050875
0.0498106
0.0505527
0.0512578
0.052257
0.0515824
0.0526462
0.0519712
0.0531001
0.054256
0.0536266
0.0548361
0.0542262
0.0554917
0.0567766
0.0562293
0.0556715
0.0570231
0.0583985
0.0597703
0.0602302
0.0588901
0.057541
0.0580673
0.0593804
0.0606946
0.0611582
0.0598666
0.0585879
0.0573207
0.056072
0.056638
0.0554355
0.0560161
0.0548662
0.0537424
0.0543571
0.0532912
0.0539018
0.0528947
0.0519225
0.0509878
0.0500951
0.0492468
0.0484466
0.0476978
0.0470033
0.0463657
0.0457869
0.0452676
0.0448077
0.0444057
0.044059
0.0437633
0.0435138
0.0433053
0.0431321
0.042989
0.042871
0.0427734
0.0426925
0.0426245
0.0425674
0.0425204
0.0424811
0.0424534
0.0424332
0.0424225
0.0424248
0.0424399
0.0424676
0.0425086
0.0425596
0.0426194
0.0426851
0.0427548
0.0428237
0.0429361
0.0428831
0.0428428
0.0430786
0.0430788
0.0430908
0.0433195
0.0433435
0.0433712
0.0434008
0.0430857
0.0428134
0.0427931
0.0427825
0.0427822
0.043145
0.043119
0.0430996
0.0434334
0.0434695
0.04351
0.0438534
0.0438041
0.0437583
0.0437154
0.0436746
0.0436344
0.0435935
0.0438653
0.0439125
0.0439593
0.0442151
0.0441628
0.0441109
0.0443252
0.0443814
0.0444381
0.0444956
0.0442686
0.0440073
0.0440572
0.0441097
0.0441651
0.0444408
0.044381
0.0443238
0.0445542
0.0446147
0.0446777
0.0447444
0.0445039
0.0442239
0.0439063
0.0435551
0.0431778
0.0427934
0.0428132
0.0428397
0.0428751
0.0433098
0.0432601
0.0432162
0.0436045
0.0436587
0.0437182
0.0437836
0.0433653
0.042917
0.042966
0.0430228
0.0430877
0.0435763
0.0434974
0.0434275
0.0438561
0.0439371
0.0440282
0.0444399
0.0443382
0.0442473
0.0441658
0.0440921
0.044025
0.0439634
0.0442866
0.0443543
0.044428
0.0447236
0.0446442
0.0445714
0.0448158
0.044893
0.0449772
0.0450698
0.0448108
0.0445088
0.0445983
0.0446978
0.0448091
0.0451337
0.0450143
0.0449071
0.0451721
0.0452857
0.0454121
0.0456411
0.0455089
0.0453901
0.0452829
0.0451858
0.0450975
0.0450167
0.0449421
0.0448725
0.044807
0.0447442
0.0446833
0.0446235
0.044564
0.0445044
0.0446428
0.0447042
0.0447652
0.0448611
0.0447993
0.044737
0.0447916
0.0448543
0.0449165
0.044979
0.0449232
0.0448265
0.0448888
0.0449532
0.0450207
0.0451208
0.045052
0.0449864
0.0450428
0.045109
0.0451787
0.0452529
0.0451941
0.0450925
0.0451697
0.0452533
0.0453447
0.0454522
0.0453586
0.045273
0.0453328
0.0454195
0.0455144
0.0456186
0.045555
0.0454452
0.0455562
0.0456791
0.0458156
0.0459337
0.0457943
0.0456686
0.0457337
0.045861
0.0460022
0.0461591
0.0460887
0.0459674
0.0457883
0.0455532
0.0452674
0.0449339
0.0445545
0.044131
0.0436661
0.0431627
0.0432492
0.04335
0.0434683
0.0440234
0.0438868
0.0437687
0.0442479
0.0443813
0.0445339
0.0447091
0.0441821
0.043608
0.0437731
0.0439681
0.0441976
0.0448278
0.0445803
0.0443663
0.04491
0.0451401
0.045403
0.0459214
0.0456456
0.0454016
0.0451866
0.0449972
0.0448307
0.044684
0.0450743
0.0452326
0.0454111
0.0457739
0.0455853
0.0454172
0.045711
0.0458873
0.0460843
0.0463045
0.0459856
0.0456125
0.0458397
0.0460952
0.046382
0.0467839
0.0464881
0.0462229
0.0465501
0.0468234
0.0471267
0.0474621
0.0471128
0.0467027
0.0462323
0.0457021
0.0451131
0.0444664
0.0447789
0.045139
0.0455502
0.0462302
0.0458111
0.0454397
0.0460407
0.0464216
0.0468472
0.0473194
0.046699
0.046015
0.0465343
0.0471087
0.0477376
0.0484108
0.0477892
0.0472184
0.0478389
0.0484067
0.0490219
0.0495704
0.0489604
0.0483953
0.0478758
0.0474007
0.0469696
0.0465809
0.0470595
0.0474548
0.0478905
0.0483166
0.0478772
0.0474765
0.0478315
0.0482366
0.0486791
0.0491601
0.048796
0.0483679
0.0488875
0.0494504
0.0500559
0.0504787
0.0498769
0.0493157
0.0496799
0.0502397
0.0508386
0.0511329
0.0505362
0.0499775
0.0494576
0.0489753
0.0485305
0.0481218
0.0477479
0.0474073
0.047098
0.0468184
0.0465662
0.0463392
0.0461353
0.0459524
0.0461363
0.0463242
0.0465332
0.0466646
0.0464522
0.0462608
0.0463331
0.0465265
0.0467409
0.0469786
0.0469002
0.0467653
0.0470225
0.0473069
0.0476205
0.0477649
0.0474483
0.0471608
0.0472411
0.0475305
0.0478488
0.0481974
0.048112
0.0479651
0.0483422
0.0487537
0.0492003
0.0493526
0.0489047
0.0484914
0.0485782
0.0489926
0.0494412
0.0499256
0.0498366
0.0496836
0.0502036
0.0507615
0.0513566
0.0515083
0.0509142
0.0503568
0.0504459
0.0510031
0.0515965
0.0522272
0.0521398
0.0519897
0.0517685
0.0514775
0.0511219
0.0507044
0.0502251
0.0496842
0.049082
0.0484195
0.0491526
0.0499343
0.050762
0.051377
0.0505672
0.0498015
0.050392
0.0511441
0.0519384
0.0527731
0.0522283
0.0516325
0.0525439
0.0534921
0.0544747
0.0550073
0.0540463
0.0531192
0.0536459
0.0545545
0.0554964
0.0559398
0.0550147
0.0541219
0.0532651
0.0524447
0.0516638
0.050923
0.051394
0.052125
0.0528946
0.0532877
0.0525275
0.0518048
0.0521547
0.0528707
0.0536233
0.0544124
0.0540854
0.0537027
0.0545463
0.0554252
0.056336
0.0566836
0.0557848
0.054918
0.0552359
0.0560926
0.0569815
0.0579011
0.0576136
0.0572785
0.056897
0.0564705
0.0560007
0.0554899
0.0549409
0.0560091
0.0554519
0.0565733
0.0577174
0.0571878
0.0583801
0.0578575
0.0590962
0.0603476
0.061614
0.0620583
0.0608174
0.0595909
0.0600684
0.0588835
0.0593647
0.058223
0.0571044
0.0576052
0.0565337
0.0570227
0.0574731
0.058504
0.0580727
0.059147
0.0587006
0.0598196
0.0609586
0.0605255
0.061705
0.0612708
0.0624884
0.0637206
0.0633124
0.062892
0.0624636
0.0620295
0.0615916
0.0611536
0.0607247
0.0621349
0.0617422
0.0631796
0.0646146
0.0660533
0.0657397
0.065445
0.0669192
0.0683896
0.0698597
0.0701036
0.0686503
0.0671955
0.0674897
0.068928
0.0703632
0.0717986
0.0715551
0.0713262
0.0711154
0.0709275
0.0707672
0.0706292
0.0721498
0.0720321
0.073584
0.0750914
0.0750457
0.0765754
0.0765573
0.0767809
0.0772522
0.0785167
0.0790641
0.0803112
0.0815796
0.0812523
0.0798411
0.0796461
0.0781644
0.0780979
0.0780783
0.0795754
0.0795941
0.0811011
0.0811665
0.0826557
0.0827712
0.0829462
0.0833898
0.0840168
0.0848432
0.0861393
0.0869099
0.0884167
0.0890656
0.0907824
0.0912981
0.0899747
0.0890804
0.0879282
0.0871405
0.0859407
0.0852496
0.0865039
0.0878516
0.0883774
0.0896689
0.0902975
0.0910648
0.0920896
0.0931043
0.0942448
0.0952055
0.0962851
0.0973657
0.0983767
0.0996046
0.100525
0.101903
0.102733
0.103723
0.10272
0.101587
0.100666
0.0994954
0.0986402
0.0974476
0.0966586
0.0954413
0.0947386
0.0934665
0.0922481
0.0915349
0.0928631
0.0942668
0.0956938
0.0960854
0.0975023
0.0979599
0.0993335
0.099889
0.101203
0.101856
0.103129
0.103881
0.104813
0.105947
0.107105
0.108338
0.109164
0.110338
0.111263
0.112342
0.113628
0.115242
0.117221
0.1196
0.122342
0.125295
0.125146
0.128124
0.12796
0.130931
0.130774
0.133683
0.133597
0.133446
0.136413
0.136246
0.139179
0.139039
0.136087
0.133304
0.13332
0.130623
0.130568
0.130634
0.127832
0.127834
0.125121
0.12506
0.122446
0.122311
0.119809
0.117696
0.118336
0.120205
0.120755
0.122753
0.123217
0.125344
0.125717
0.127968
0.128252
0.128673
0.130819
0.131149
0.133411
0.135999
0.138851
0.141807
0.144567
0.144517
0.144324
0.144092
0.141275
0.141404
0.141598
0.138702
0.138648
0.138706
0.138886
0.141248
0.143895
0.143793
0.143805
0.143946
0.141893
0.141559
0.141342
0.139185
0.139591
0.140092
0.138511
0.137875
0.137307
0.136824
0.136441
0.136171
0.136023
0.13365
0.134011
0.13448
0.132792
0.132153
0.1316
0.129848
0.129212
0.127567
0.126851
0.126227
0.124519
0.123813
0.12222
0.121436
0.119956
0.119095
0.117735
0.116799
0.115958
0.114545
0.115545
0.11658
0.11558
0.11446
0.113389
0.112376
0.113559
0.114772
0.115983
0.116747
0.117637
0.118723
0.119733
0.120891
0.12186
0.123087
0.124004
0.12531
0.126168
0.127059
0.128354
0.129189
0.130562
0.131335
0.132143
0.133498
0.135041
0.135678
0.136371
0.137103
0.135844
0.135033
0.13425
0.132975
0.133851
0.134731
0.133716
0.132795
0.131868
0.130945
0.13005
0.128932
0.12797
0.126931
0.125922
0.124942
0.123893
0.122847
0.121881
0.12079
0.119896
0.118756
0.117929
0.117195
0.118396
0.119104
0.120274
0.121033
0.12217
0.122984
0.12408
0.124949
0.126006
0.127058
0.127947
0.128958
0.1299
0.13087
0.131834
0.132787
0.13193
0.130953
0.129962
0.129129
0.128099
0.127313
0.126248
0.12517
0.124408
0.123295
0.12258
0.121434
0.120765
0.119588
0.118963
0.117757
0.116537
0.115305
0.114063
0.11282
0.111565
0.11089
0.109615
0.108993
0.10769
0.106374
0.105096
0.104457
0.105791
0.107126
0.106632
0.105284
0.103926
0.102576
0.102098
0.100715
0.100296
0.0988934
0.0985237
0.0971125
0.0967867
0.0953616
0.0939214
0.0924957
0.091039
0.0907463
0.0892827
0.0890342
0.0875774
0.0860885
0.0846968
0.0844008
0.0858978
0.0873692
0.088839
0.0903074
0.0905024
0.0919553
0.0921962
0.0936387
0.0934077
0.0932181
0.0917645
0.0916135
0.0901552
0.0886898
0.0872135
0.0857424
0.0842501
0.0841432
0.0856296
0.0871042
0.0870316
0.0855567
0.0840769
0.0825859
0.0825579
0.0810726
0.0810801
0.0795923
0.0780958
0.076602
0.0766613
0.0751595
0.0736639
0.0737688
0.0722737
0.0724223
0.073905
0.0753897
0.0752609
0.0767508
0.078232
0.078149
0.0796395
0.0811181
0.0811815
0.079712
0.0798059
0.078339
0.0768663
0.0770037
0.0755399
0.0740675
0.0725959
0.0727912
0.0742504
0.0757083
0.075892
0.0744493
0.0730042
0.073231
0.074661
0.0760883
0.0775117
0.0773294
0.0771592
0.0786075
0.0784652
0.079919
0.0813681
0.0812659
0.0827213
0.0826484
0.0825946
0.0825629
0.0840401
0.0840441
0.0855178
0.0869883
0.0884476
0.088499
0.0885785
0.0900401
0.0914954
0.0929395
0.0930635
0.0945021
0.0946601
0.094852
0.0950834
0.0965144
0.0979412
0.0982099
0.0996239
0.0999348
0.101334
0.101688
0.103072
0.103469
0.10484
0.106197
0.105812
0.104449
0.104103
0.102724
0.102418
0.101027
0.100758
0.0993551
0.099123
0.097711
0.0962859
0.0960926
0.0975137
0.098922
0.100317
0.100523
0.101909
0.102147
0.103523
0.103796
0.105159
0.105467
0.106818
0.107162
0.107544
0.107971
0.108451
0.10977
0.110296
0.111593
0.112169
0.113436
0.112876
0.112371
0.111078
0.110614
0.1093
0.108877
0.110195
0.111496
0.111913
0.113196
0.11365
0.114149
0.114697
0.115944
0.117176
0.118391
0.117864
0.116644
0.115404
0.114911
0.116155
0.117379
0.11693
0.115705
0.114459
0.114044
0.112779
0.112398
0.111115
0.109815
0.108496
0.108151
0.109468
0.110767
0.112048
0.11331
0.113661
0.114906
0.115289
0.116514
0.11613
0.115774
0.114553
0.114227
0.112987
0.111728
0.110449
0.109153
0.107839
0.106508
0.106228
0.104884
0.104637
0.10328
0.103065
0.101699
0.101514
0.100139
0.0987488
0.0973457
0.0959302
0.0957949
0.094373
0.0942692
0.0928423
0.0914051
0.089956
0.0898985
0.0913395
0.0927694
0.0941885
0.0955952
0.0956839
0.0970865
0.0972041
0.0986008
0.0984761
0.0983724
0.0969903
0.0969143
0.0955274
0.0941285
0.0927177
0.091296
0.0898636
0.0884204
0.0869699
0.0855076
0.0855212
0.0840613
0.0841047
0.084167
0.0856073
0.0855553
0.0869967
0.0869735
0.0884155
0.0898491
0.0912724
0.0926854
0.0926709
0.0912672
0.0898535
0.0884298
0.0884609
0.0870381
0.0870949
0.0856749
0.0842459
0.0828111
0.0829159
0.0814855
0.0800484
0.0801916
0.0787637
0.0789317
0.0803464
0.0817574
0.0816158
0.0830339
0.0844454
0.0843393
0.0857566
0.0871657
0.0872489
0.0858509
0.0859562
0.0845624
0.083163
0.083302
0.0819087
0.0805109
0.0791095
0.0777038
0.0762949
0.0748831
0.0734687
0.0720531
0.0706347
0.0692176
0.0677981
0.0663809
0.0649634
0.0635484
0.0639291
0.0625386
0.0629476
0.0633605
0.0647086
0.064318
0.0656865
0.0653225
0.0667181
0.0681161
0.0695158
0.0709151
0.071201
0.0698202
0.0684392
0.0670629
0.0674103
0.0660534
0.0664207
0.0650964
0.0637736
0.0641809
0.0654795
0.0667844
0.0671408
0.0658554
0.0645789
0.0649653
0.066221
0.0674872
0.068762
0.0684343
0.0680982
0.0677562
0.0690919
0.0687653
0.0701281
0.0714898
0.0717799
0.0704359
0.0707409
0.0694159
0.0697342
0.0700443
0.0713339
0.071041
0.0723518
0.0720679
0.0734005
0.0731287
0.0728556
0.0725839
0.0723157
0.0737148
0.0751131
0.0765095
0.07673
0.0753488
0.0739666
0.0742217
0.0755884
0.0769545
0.0783199
0.0781097
0.0779038
0.0792953
0.0806833
0.0820681
0.082234
0.0808619
0.0794873
0.0796838
0.0810454
0.082405
0.0825794
0.081232
0.0798831
0.0785326
0.077181
0.0758298
0.0744782
0.0747341
0.0760706
0.0774078
0.0776328
0.0763088
0.0749871
0.0736684
0.0739305
0.0726293
0.0728979
0.0716174
0.0703441
0.0690779
0.0678207
0.066573
0.0653357
0.0641118
0.0629006
0.0632922
0.062117
0.0625032
0.0613642
0.0602454
0.0606392
0.0595594
0.0599352
0.0588966
0.0578827
0.0582493
0.0592485
0.0602725
0.0605699
0.0595582
0.058572
0.0588492
0.0598246
0.0608258
0.061852
0.0616065
0.0613215
0.0609986
0.0620833
0.06174
0.0628618
0.0640013
0.0636599
0.0648336
0.0644839
0.065689
0.0669084
0.0681388
0.0684391
0.0672246
0.0660218
0.066331
0.0651588
0.0654569
0.0643139
0.0631895
0.0634846
0.0623921
0.0626651
0.0629005
0.0639701
0.0637453
0.0648451
0.0645956
0.0657256
0.0668714
0.066615
0.067789
0.0675186
0.0687189
0.069931
0.0696648
0.0693794
0.0706302
0.0718891
0.0731553
0.0733993
0.0721465
0.0709008
0.0711538
0.072387
0.0736278
0.0738389
0.0726088
0.0713869
0.0701757
0.0689763
0.0692092
0.0680333
0.0682499
0.0670986
0.0659634
0.066169
0.0650606
0.0652394
0.0641569
0.063095
0.0620547
0.0610374
0.0600445
0.0590777
0.0581381
0.057227
0.0563462
0.0554971
0.0546809
0.0538985
0.053152
0.0524413
0.0526594
0.0533662
0.0541082
0.0542506
0.0535116
0.0528074
0.0528936
0.0535963
0.0543336
0.0551058
0.0550247
0.0548856
0.0556963
0.0565399
0.0574145
0.0575419
0.0566716
0.0558316
0.0559107
0.0567484
0.0576165
0.058515
0.0584429
0.0583193
0.0592526
0.0602129
0.0611997
0.0613106
0.060328
0.059372
0.0594417
0.0603953
0.0613754
0.0623796
0.0623171
0.0622103
0.0632445
0.0643007
0.065377
0.0654709
0.0643989
0.0633469
0.0634067
0.0644563
0.0655258
0.066615
0.0665621
0.0664721
0.0663403
0.0674591
0.0672953
0.0684377
0.0695953
0.069416
0.0705951
0.0703976
0.0715983
0.0728101
0.0740309
0.0742022
0.0729896
0.0717867
0.0719504
0.0707667
0.0709094
0.069745
0.0685944
0.0687151
0.0675855
0.0676719
0.0677225
0.068846
0.0687976
0.0699394
0.0698604
0.0710197
0.0721919
0.0720867
0.0732757
0.0731455
0.074351
0.075566
0.0754239
0.0752609
0.0750782
0.0748773
0.0746602
0.0744286
0.0741846
0.0754753
0.0752349
0.0765431
0.077854
0.0791666
0.0789578
0.0787459
0.0800834
0.0814202
0.0827558
0.0829326
0.0816081
0.080283
0.0804801
0.081794
0.0831079
0.08328
0.0819761
0.0806728
0.0793703
0.0780695
0.0767711
0.0769901
0.0757065
0.0759263
0.0761326
0.0773944
0.0771984
0.0784752
0.0782772
0.0795671
0.0808592
0.0821527
0.0834473
0.0836079
0.0823219
0.0810375
0.0797549
0.0799321
0.0786613
0.078834
0.0775764
0.0763239
0.0764981
0.0777424
0.0789919
0.0791335
0.0778907
0.0766535
0.0767893
0.07802
0.0792572
0.0805
0.0803821
0.0802472
0.0800967
0.0813626
0.0812059
0.0824819
0.0837601
0.0839021
0.0826311
0.0827677
0.081506
0.0816347
0.0817474
0.0829987
0.0828908
0.0841499
0.0840324
0.0852989
0.0851748
0.0850395
0.0848949
0.0847424
0.084584
0.0844214
0.0842561
0.08409
0.0839247
0.0837618
0.0836027
0.083449
0.0848243
0.0846892
0.0860712
0.0874471
0.0873432
0.0887227
0.0886393
0.088567
0.0885071
0.0899102
0.0898743
0.0912784
0.0926724
0.0926887
0.0913043
0.0913437
0.0899598
0.0900216
0.0900947
0.0914585
0.0913954
0.0927601
0.0927183
0.0940827
0.0940627
0.0940559
0.0940636
0.0940872
0.0954776
0.0968561
0.0982221
0.0982882
0.0996497
0.0997415
0.0998525
0.0999844
0.101354
0.102708
0.102875
0.104221
0.104416
0.105752
0.105977
0.1073
0.107556
0.108867
0.11016
0.109896
0.108607
0.108372
0.10707
0.106863
0.10555
0.105372
0.104048
0.103896
0.102563
0.101215
0.101097
0.102438
0.103764
0.105075
0.105214
0.106515
0.106679
0.10797
0.10816
0.10944
0.109656
0.110923
0.111167
0.111435
0.11269
0.113927
0.115144
0.115446
0.116646
0.116976
0.117333
0.117718
0.118134
0.118582
0.119065
0.119587
0.120151
0.121322
0.121925
0.123067
0.12371
0.124823
0.125507
0.126587
0.127649
0.128361
0.129389
0.130141
0.131135
0.130396
0.129706
0.128689
0.128035
0.126986
0.125915
0.12529
0.124189
0.1236
0.122471
0.121918
0.120763
0.120245
0.119764
0.120924
0.121404
0.12254
0.123052
0.124162
0.124707
0.12579
0.126368
0.127423
0.128454
0.12906
0.130059
0.130699
0.13138
0.132108
0.132888
0.133726
0.13463
0.135612
0.136683
0.137861
0.139192
0.140671
0.142332
0.144215
0.146349
0.148747
0.148774
0.151233
0.151234
0.151392
0.15375
0.153906
0.154177
0.154507
0.154856
0.152858
0.152448
0.152044
0.151678
0.149659
0.149259
0.148951
0.146904
0.146564
0.144599
0.145077
0.145618
0.147341
0.147838
0.148364
0.150111
0.150583
0.151051
0.151491
0.153254
0.155193
0.155499
0.157588
0.15779
0.160052
0.160104
0.16006
0.162349
0.164889
0.167692
0.167159
0.17001
0.169173
0.168285
0.165859
0.166538
0.164087
0.164528
0.162126
0.159953
0.159792
0.161838
0.161493
0.163587
0.163047
0.165145
0.167373
0.169682
0.172002
0.174231
0.176285
0.178026
0.179338
0.177072
0.17504
0.1732
0.172393
0.174101
0.17597
0.174468
0.17279
0.171234
0.169787
0.17082
0.171519
0.169974
0.168548
0.167224
0.166757
0.168016
0.169366
0.168438
0.167176
0.165993
0.164998
0.166092
0.167251
0.168481
0.169787
0.171176
0.172656
0.170662
0.16938
0.168157
0.166419
0.167472
0.168562
0.166456
0.165548
0.16466
0.163796
0.165406
0.166994
0.16589
0.164842
0.163848
0.16262
0.163506
0.164435
0.162958
0.162153
0.16138
0.160639
0.161775
0.162905
0.163966
0.164882
0.165581
0.165993
0.164844
0.163771
0.162767
0.162469
0.163442
0.164478
0.163837
0.162851
0.161922
0.161044
0.161554
0.161827
0.160945
0.160116
0.159338
0.159111
0.159879
0.160692
0.160214
0.159428
0.158684
0.158131
0.158836
0.15958
0.160364
0.161192
0.162066
0.162989
0.16201
0.16116
0.160354
0.159476
0.160205
0.160971
0.15993
0.159253
0.158607
0.157991
0.158784
0.159589
0.158864
0.158175
0.157524
0.15691
0.157502
0.158126
0.157404
0.156846
0.156315
0.155747
0.156219
0.156713
0.157229
0.15777
0.158334
0.158923
0.159536
0.160174
0.160835
0.161517
0.16222
0.162943
0.163676
0.164413
0.16248
0.161896
0.161307
0.159783
0.160235
0.160677
0.161102
0.159312
0.159572
0.157829
0.157928
0.157988
0.157999
0.157934
0.155975
0.155762
0.15393
0.153618
0.151905
0.152289
0.152627
0.154203
0.154439
0.156125
0.156214
0.156254
0.156252
0.154813
0.154741
0.154622
0.153162
0.152917
0.151535
0.151194
0.150806
0.150372
0.149903
0.149402
0.148891
0.147352
0.14677
0.146193
0.144695
0.14406
0.143445
0.142857
0.141303
0.141966
0.14265
0.143345
0.144033
0.145333
0.145967
0.146576
0.147921
0.148468
0.14898
0.149454
0.149885
0.148683
0.148215
0.147706
0.147159
0.145957
0.145344
0.144702
0.14354
0.142842
0.14212
0.141384
0.140634
0.139905
0.138651
0.139441
0.140227
0.139163
0.138348
0.137519
0.136483
0.137341
0.138181
0.138998
0.139959
0.140996
0.141745
0.142469
0.143163
0.144211
0.14485
0.145454
0.146535
0.147075
0.147576
0.148035
0.149109
0.150272
0.150613
0.151831
0.152081
0.153356
0.1535
0.1536
0.154846
0.156206
0.157688
0.157508
0.159023
0.158707
0.158371
0.158021
0.159324
0.160723
0.160147
0.15958
0.159027
0.157947
0.158402
0.158862
0.157662
0.157299
0.156935
0.155983
0.156268
0.156545
0.156812
0.157066
0.1573
0.156002
0.156119
0.154842
0.153663
0.153693
0.154803
0.154735
0.155857
0.155688
0.155502
0.155301
0.155089
0.154247
0.154394
0.154527
0.154641
0.153664
0.153692
0.152719
0.152661
0.152573
0.152452
0.152289
0.151167
0.150911
0.149831
0.149492
0.148452
0.148829
0.149166
0.15013
0.15039
0.151384
0.151562
0.151701
0.151809
0.150958
0.150802
0.150613
0.149727
0.149464
0.148598
0.148265
0.147894
0.147485
0.147037
0.146549
0.146021
0.145042
0.144451
0.143825
0.142871
0.142189
0.141475
0.140731
0.139788
0.14055
0.141282
0.14198
0.142644
0.143517
0.144128
0.144702
0.145594
0.146108
0.146583
0.14702
0.147421
0.146628
0.146201
0.145738
0.145239
0.144424
0.143866
0.143273
0.142471
0.141826
0.141146
0.140433
0.139687
0.13891
0.138103
0.137269
0.13641
0.135529
0.134646
0.135545
0.136419
0.135625
0.134738
0.133824
0.133057
0.133982
0.13488
0.13575
0.136485
0.137268
0.138087
0.138877
0.139637
0.138888
0.138117
0.137316
0.136591
0.137403
0.138184
0.13752
0.136729
0.135909
0.135059
0.13418
0.133273
0.13234
0.131666
0.132608
0.133522
0.132902
0.131981
0.131034
0.130439
0.129459
0.128895
0.127885
0.12685
0.126313
0.12525
0.124743
0.123653
0.123178
0.122062
0.121617
0.120478
0.119317
0.118901
0.120062
0.121201
0.120814
0.119676
0.118515
0.118156
0.119316
0.120453
0.121569
0.12193
0.122318
0.122733
0.123826
0.124269
0.125337
0.125809
0.126851
0.127352
0.128365
0.129353
0.129879
0.130837
0.131392
0.132318
0.133217
0.133795
0.134408
0.135266
0.136095
0.136894
0.136303
0.135496
0.13466
0.134088
0.134932
0.135746
0.136532
0.137081
0.137663
0.13828
0.138933
0.139627
0.140363
0.141057
0.141717
0.142344
0.143082
0.143658
0.144199
0.144945
0.145431
0.145882
0.145179
0.144706
0.144022
0.143496
0.142937
0.142257
0.141649
0.141007
0.140333
0.139652
0.140338
0.140993
0.141616
0.142207
0.142833
0.143377
0.14389
0.144516
0.144978
0.145621
0.1463
0.147021
0.147785
0.148116
0.148897
0.149161
0.149956
0.150153
0.150321
0.151083
0.15189
0.152749
0.152753
0.153612
0.153541
0.153452
0.153348
0.154088
0.154869
0.155695
0.156571
0.1575
0.158488
0.157966
0.157462
0.156975
0.156221
0.156636
0.157063
0.15621
0.155855
0.155507
0.155165
0.155819
0.156506
0.156055
0.155621
0.155206
0.154688
0.155052
0.155429
0.154832
0.154507
0.154192
0.153717
0.153986
0.154262
0.154542
0.154827
0.155115
0.155405
0.154642
0.154412
0.15418
0.153564
0.153744
0.153919
0.153233
0.153108
0.152975
0.152836
0.15338
0.153948
0.153716
0.153487
0.15326
0.152821
0.153007
0.153194
0.152693
0.152546
0.152398
0.151991
0.152103
0.152212
0.152315
0.152412
0.152501
0.15258
0.152647
0.1527
0.152736
0.151976
0.151945
0.151181
0.150462
0.150577
0.151257
0.151312
0.151987
0.151981
0.151958
0.151922
0.151874
0.151358
0.151368
0.151365
0.151347
0.150744
0.15067
0.150061
0.149931
0.149778
0.1496
0.149395
0.14868
0.148413
0.147707
0.14738
0.146686
0.14704
0.147365
0.148005
0.148274
0.148919
0.14913
0.149316
0.14948
0.148927
0.148733
0.148516
0.147933
0.147662
0.147083
0.14676
0.146409
0.14603
0.14541
0.145812
0.146186
0.145643
0.145247
0.144824
0.144372
0.143798
0.143298
0.142768
0.142192
0.141616
0.141011
0.140374
0.139707
0.139009
0.138402
0.139111
0.13979
0.139238
0.138549
0.13783
0.137289
0.138018
0.138717
0.139389
0.139899
0.140439
0.141058
0.141648
0.142208
0.142738
0.143255
0.143743
0.144269
0.144711
0.145127
0.145517
0.146012
0.146533
0.146854
0.14738
0.147652
0.148179
0.148401
0.148602
0.1491
0.149622
0.15017
0.15026
0.150799
0.150839
0.150865
0.150877
0.151337
0.151816
0.15175
0.151677
0.151598
0.151219
0.151266
0.151306
0.150879
0.150871
0.150854
0.150503
0.150491
0.150469
0.150436
0.150392
0.150333
0.14985
0.149745
0.149253
0.148783
0.148946
0.149388
0.149506
0.149939
0.150014
0.150075
0.150125
0.150164
0.149839
0.149774
0.149698
0.149609
0.149221
0.149091
0.148694
0.148524
0.148335
0.148128
0.147901
0.147425
0.147151
0.146675
0.146355
0.145882
0.146223
0.146541
0.146972
0.147247
0.147677
0.147908
0.148121
0.148316
0.147954
0.147736
0.147501
0.147113
0.146837
0.146448
0.146131
0.145793
0.145432
0.145048
0.144639
0.144204
0.143724
0.143246
0.142741
0.142255
0.141708
0.141133
0.14053
0.140032
0.140647
0.141234
0.141795
0.142329
0.142775
0.143269
0.143737
0.144176
0.144603
0.145005
0.145384
0.145741
0.145371
0.144997
0.1446
0.144181
0.14378
0.143321
0.142838
0.14243
0.141907
0.14136
0.140787
0.140187
0.13956
0.138907
0.138225
0.137516
0.136779
0.136014
0.135221
0.134399
0.13355
0.132673
0.131769
0.131251
0.130315
0.129824
0.128858
0.127867
0.1274
0.126381
0.12594
0.124895
0.12448
0.123411
0.123023
0.122661
0.123731
0.124093
0.12514
0.125527
0.126549
0.126961
0.127957
0.128393
0.129362
0.130305
0.130763
0.131677
0.13216
0.133042
0.133897
0.134725
0.134257
0.133424
0.132564
0.132113
0.131222
0.130794
0.129874
0.128928
0.12852
0.127547
0.127162
0.126163
0.125802
0.124778
0.124441
0.123394
0.122324
0.121232
0.120118
0.118982
0.117824
0.117517
0.116341
0.11606
0.114865
0.113652
0.112419
0.112171
0.1134
0.11461
0.114376
0.11317
0.111945
0.110701
0.110501
0.109244
0.109069
0.107801
0.10765
0.10637
0.106244
0.104955
0.103651
0.102332
0.100998
0.100916
0.0995757
0.0995183
0.0981728
0.096815
0.0954449
0.0954281
0.0967897
0.098139
0.0994764
0.100801
0.100851
0.10217
0.102243
0.103555
0.103475
0.10341
0.102112
0.102069
0.100766
0.0994488
0.0981196
0.0967787
0.0954261
0.0954376
0.0967814
0.0981136
0.0981202
0.0967962
0.0954612
0.0941153
0.0941594
0.0928134
0.0928772
0.0915314
0.0901776
0.0888158
0.088918
0.0875599
0.0861953
0.086326
0.0849662
0.0851139
0.0864628
0.087806
0.0876799
0.0890281
0.0903699
0.0902698
0.0916138
0.0929503
0.0930323
0.0917046
0.0918026
0.090477
0.0891447
0.0892665
0.0879373
0.0866042
0.0852658
0.0854205
0.0867489
0.0880724
0.0882097
0.0868953
0.0855765
0.0857322
0.0870419
0.0883479
0.0896511
0.0895212
0.0893925
0.0907071
0.0905897
0.0919069
0.0932179
0.0931217
0.0944333
0.0943519
0.0942785
0.0942141
0.0955425
0.0954965
0.0968227
0.0981387
0.0994439
0.0994333
0.0994347
0.100744
0.10204
0.103324
0.10336
0.104637
0.104694
0.104766
0.104853
0.106135
0.107402
0.107518
0.108775
0.108913
0.110159
0.110321
0.111555
0.11174
0.112961
0.114163
0.113968
0.112771
0.112599
0.111388
0.111239
0.110016
0.109889
0.108653
0.108548
0.107302
0.106042
0.105963
0.107218
0.108457
0.109681
0.109778
0.11099
0.111107
0.112308
0.112445
0.113634
0.113793
0.114968
0.115148
0.115346
0.115563
0.115801
0.116971
0.117233
0.118386
0.118673
0.119806
0.119518
0.119251
0.118122
0.117878
0.11673
0.11651
0.117654
0.118778
0.119005
0.120111
0.12036
0.120629
0.120919
0.12201
0.123079
0.124126
0.123832
0.122786
0.121718
0.121448
0.122514
0.123559
0.123306
0.122262
0.121197
0.120966
0.119882
0.119671
0.11857
0.117449
0.116308
0.116124
0.117262
0.118379
0.119478
0.120557
0.120753
0.121814
0.122029
0.123071
0.122854
0.122655
0.121616
0.121435
0.120378
0.119302
0.118206
0.117091
0.115958
0.114805
0.114659
0.113492
0.113366
0.112187
0.11208
0.110889
0.110802
0.1096
0.108382
0.107148
0.1059
0.10585
0.104594
0.104564
0.1033
0.102024
0.100735
0.100738
0.10202
0.103289
0.103291
0.102028
0.100753
0.099466
0.0981684
0.0968606
0.0969086
0.0955985
0.0956637
0.0957372
0.097032
0.096966
0.0982587
0.0982086
0.0994989
0.100778
0.102047
0.103304
0.103328
0.102077
0.100815
0.0995419
0.0995946
0.098318
0.0983853
0.0971055
0.0958178
0.0945215
0.0946151
0.0933192
0.0920159
0.0921288
0.0908276
0.0909497
0.0922437
0.0935324
0.0934244
0.0947134
0.0959964
0.0959047
0.0971859
0.0984594
0.0985387
0.0972716
0.0973609
0.0960917
0.094815
0.0949181
0.0936413
0.0923591
0.0910719
0.0897805
0.0884853
0.0871872
0.085886
0.086036
0.0873293
0.0886199
0.0887504
0.0874666
0.0861807
0.0863183
0.0875975
0.0888747
0.0901504
0.0900319
0.089908
0.0911927
0.0924735
0.0937498
0.0938561
0.0925854
0.0913104
0.0914233
0.0926929
0.0939586
0.0940557
0.0927946
0.0915298
0.0902621
0.0889915
0.0877202
0.0864471
0.0865657
0.0878334
0.0890996
0.0891973
0.0879357
0.0866729
0.0854108
0.0855092
0.0842529
0.0843395
0.0830892
0.0818421
0.080599
0.0793608
0.0781284
0.0769028
0.0756848
0.0744754
0.0745715
0.0733765
0.0734458
0.0722641
0.0710954
0.0711399
0.0699855
0.0723066
0.0734865
0.0746765
0.0746376
0.0758403
0.0757768
0.0769906
0.0782126
0.0794411
0.0794963
0.0782706
0.077051
0.0770866
0.0758775
0.0783048
0.079529
0.0807603
0.080729
0.0806759
0.0819155
0.0831595
0.0844071
0.0844537
0.0832079
0.0819661
0.081996
0.0832367
0.0844812
0.0857275
0.0857011
0.0856567
0.0855919
0.0868462
0.086767
0.0880256
0.0892834
0.0905413
0.0904589
0.0903654
0.0916285
0.092889
0.094146
0.0942282
0.0929747
0.0917181
0.091797
0.0930503
0.094301
0.0955477
0.0954776
0.0953985
0.0953123
0.0952197
0.095122
0.0950208
0.0962861
0.0961887
0.0974526
0.0987091
0.0986223
0.0998762
0.0997976
0.0997237
0.0996556
0.100916
0.100861
0.102117
0.103362
0.103406
0.102167
0.102224
0.100978
0.101047
0.101121
0.102357
0.102288
0.103519
0.103459
0.104683
0.104636
0.104597
0.104567
0.104549
0.104542
0.104546
0.10579
0.105814
0.10705
0.107092
0.10832
0.108271
0.108237
0.10702
0.107004
0.105779
0.105781
0.107
0.108206
0.108215
0.109412
0.109438
0.109479
0.109533
0.110729
0.11191
0.111988
0.113158
0.113255
0.114413
0.114528
0.115673
0.115807
0.116937
0.118049
0.117907
0.116799
0.116675
0.115553
0.115447
0.114312
0.114225
0.113076
0.113007
0.111847
0.11067
0.110625
0.111797
0.112953
0.114093
0.114152
0.11528
0.115356
0.116471
0.116566
0.117667
0.117779
0.118866
0.118996
0.119141
0.120215
0.121269
0.122304
0.122471
0.123487
0.123672
0.123874
0.124092
0.124328
0.124582
0.124856
0.125149
0.125465
0.126465
0.126802
0.127778
0.128137
0.129088
0.129468
0.130392
0.13129
0.131689
0.132559
0.132978
0.133817
0.133402
0.133011
0.132164
0.131792
0.130915
0.130014
0.129659
0.128731
0.128396
0.127442
0.127129
0.12615
0.125857
0.125583
0.126561
0.126835
0.127791
0.128083
0.129015
0.129327
0.130233
0.130563
0.131443
0.132298
0.132644
0.133471
0.133834
0.13422
0.134629
0.135064
0.135525
0.136298
0.137043
0.137761
0.137322
0.136596
0.135843
0.135415
0.136175
0.136908
0.137616
0.138022
0.138451
0.139115
0.139752
0.140363
0.139963
0.139342
0.138695
0.138298
0.138954
0.139585
0.139228
0.138588
0.137923
0.137233
0.136518
0.135778
0.135011
0.134631
0.135403
0.13615
0.135804
0.135051
0.134273
0.133936
0.133129
0.132809
0.131974
0.131115
0.130808
0.129923
0.129634
0.128724
0.128452
0.127518
0.127263
0.126306
0.125328
0.125092
0.12607
0.127026
0.126806
0.12585
0.124872
0.12467
0.125647
0.126603
0.127538
0.127741
0.127961
0.128198
0.12911
0.129363
0.130251
0.13052
0.131384
0.13167
0.132508
0.133322
0.13362
0.134407
0.134719
0.135477
0.136211
0.136532
0.136872
0.13757
0.138242
0.138891
0.138573
0.137916
0.137236
0.136922
0.137609
0.138272
0.137989
0.137319
0.136626
0.13591
0.13517
0.134881
0.134113
0.133838
0.133043
0.132225
0.131961
0.131117
0.130868
0.13
0.129765
0.128874
0.128655
0.128452
0.129344
0.129547
0.130417
0.130635
0.131482
0.131713
0.132536
0.132781
0.133579
0.134355
0.13461
0.135359
0.135626
0.136347
0.137046
0.137722
0.137471
0.136789
0.136085
0.135839
0.135108
0.134873
0.134116
0.133337
0.133111
0.132307
0.132094
0.131266
0.131066
0.130216
0.130029
0.129157
0.128264
0.12735
0.126415
0.12546
0.124484
0.124313
0.123318
0.123164
0.122151
0.121119
0.120067
0.119933
0.120983
0.122012
0.121889
0.120861
0.119815
0.11875
0.118648
0.117568
0.117485
0.11639
0.116325
0.115217
0.115169
0.114049
0.112913
0.111761
0.110593
0.110575
0.109398
0.109397
0.108209
0.107008
0.105794
0.105818
0.107028
0.108224
0.109408
0.110578
0.11057
0.11173
0.111739
0.112887
0.112874
0.112875
0.111734
0.11175
0.110597
0.10943
0.10825
0.107058
0.105852
0.105896
0.107098
0.108286
0.108331
0.107145
0.105947
0.104739
0.1048
0.103584
0.103653
0.10243
0.101199
0.0999581
0.100041
0.0987968
0.0975448
0.0976364
0.0963823
0.0964756
0.0977256
0.0989696
0.0988841
0.100125
0.101357
0.101278
0.102506
0.103725
0.103797
0.102582
0.102656
0.101436
0.100206
0.100284
0.099051
0.0978104
0.0965644
0.0966473
0.0978899
0.0991272
0.0991969
0.0979625
0.0967229
0.09679
0.0980271
0.099259
0.100485
0.100425
0.100358
0.101581
0.101511
0.102729
0.103939
0.103869
0.105072
0.105003
0.104934
0.104865
0.106067
0.106005
0.107199
0.108382
0.109552
0.109504
0.109463
0.110626
0.111776
0.112912
0.112888
0.114012
0.114002
0.114004
0.11402
0.115136
0.116238
0.116274
0.117361
0.117415
0.118489
0.118561
0.11962
0.11971
0.120754
0.121779
0.121684
0.120661
0.120583
0.119545
0.119485
0.118431
0.11839
0.117322
0.117298
0.116216
0.115118
0.115113
0.116209
0.117288
0.118352
0.118363
0.119412
0.119441
0.120474
0.120521
0.121539
0.121603
0.122606
0.122688
0.122786
0.122898
0.123024
0.124015
0.124157
0.12513
0.125288
0.126242
0.126084
0.125939
0.124987
0.124858
0.123887
0.123773
0.124742
0.125692
0.125809
0.126741
0.126872
0.127018
0.127176
0.12809
0.128983
0.129856
0.129697
0.128824
0.127931
0.127785
0.128678
0.129551
0.129418
0.128545
0.127653
0.127534
0.126623
0.126519
0.125589
0.124641
0.123674
0.123589
0.124555
0.125502
0.12643
0.127338
0.127429
0.12832
0.128426
0.129298
0.129192
0.129099
0.128228
0.128153
0.127264
0.126356
0.12543
0.124485
0.123521
0.122539
0.122489
0.121491
0.121459
0.120444
0.120429
0.119399
0.1194
0.118354
0.117292
0.116214
0.115121
0.11514
0.114033
0.114065
0.112945
0.111812
0.110664
0.11071
0.111855
0.112986
0.114104
0.115208
0.11517
0.11626
0.116232
0.117308
0.117335
0.11737
0.116296
0.116339
0.115252
0.11415
0.113034
0.111904
0.110761
0.109606
0.108438
0.107258
0.107321
0.106132
0.106199
0.106266
0.107449
0.107385
0.10856
0.108498
0.109664
0.110817
0.111958
0.113086
0.11314
0.112014
0.110875
0.109723
0.109784
0.108622
0.108683
0.107512
0.10633
0.105139
0.105203
0.104004
0.102797
0.102859
0.101646
0.101703
0.102915
0.104118
0.104064
0.105261
0.106448
0.106392
0.107571
0.108741
0.108794
0.107626
0.107676
0.106499
0.105313
0.105358
0.104164
0.102963
0.101753
0.100536
0.099312
0.0980823
0.0968469
0.095607
0.0943624
0.0931142
0.0918638
0.0906108
0.0893564
0.0881013
0.0881605
0.0869084
0.0869513
0.0869766
0.0882258
0.0882016
0.0894531
0.0894136
0.0906652
0.0919163
0.0931647
0.0944105
0.0944442
0.0932
0.0919528
0.0907031
0.0907255
0.0894764
0.0919743
0.0932207
0.0944642
0.0957052
0.095686
0.0956535
0.0968915
0.0981257
0.0993537
0.0993827
0.0981558
0.0969228
0.0969413
0.0981736
0.0993999
0.100621
0.100604
0.100576
0.101792
0.103
0.104201
0.104227
0.103026
0.101819
0.101835
0.103042
0.104242
0.105433
0.105419
0.105394
0.106577
0.106543
0.107718
0.108883
0.108842
0.109998
0.109951
0.109899
0.109842
0.11099
0.110933
0.112071
0.113196
0.11325
0.112127
0.11218
0.111045
0.111096
0.111142
0.112275
0.11223
0.113351
0.113302
0.114413
0.114361
0.114308
0.114254
0.1142
0.115301
0.116388
0.117459
0.117412
0.11847
0.118428
0.118394
0.118369
0.119413
0.120441
0.120429
0.121441
0.121442
0.122438
0.122456
0.123434
0.123469
0.124431
0.125375
0.125338
0.124395
0.124376
0.123416
0.123413
0.122436
0.122447
0.121453
0.121476
0.120465
0.119438
0.119472
0.120498
0.121509
0.122503
0.12247
0.123447
0.123424
0.124384
0.124373
0.125315
0.125319
0.126242
0.126263
0.126301
0.127207
0.128095
0.128964
0.129023
0.129874
0.129951
0.130044
0.130151
0.130271
0.130404
0.130549
0.130708
0.13088
0.13171
0.131895
0.132703
0.132899
0.133684
0.133893
0.134653
0.135391
0.135608
0.136321
0.136548
0.137235
0.137013
0.136804
0.136108
0.135909
0.135189
0.134447
0.134255
0.133489
0.133308
0.132519
0.13235
0.131539
0.131381
0.131237
0.13205
0.132193
0.132985
0.13314
0.13391
0.134076
0.134823
0.134999
0.135723
0.136426
0.136609
0.137288
0.137479
0.137683
0.1379
0.138131
0.138376
0.138637
0.138913
0.139205
0.139516
0.139844
0.140192
0.140559
0.140948
0.141508
0.142043
0.142554
0.142927
0.143401
0.143851
0.144216
0.144629
0.14502
0.145389
0.145724
0.146077
0.146392
0.146744
0.14702
0.14737
0.147608
0.147829
0.148154
0.148493
0.148849
0.148988
0.149335
0.149437
0.149527
0.149226
0.149114
0.148804
0.148656
0.148338
0.148034
0.148223
0.148507
0.148663
0.148938
0.149061
0.149327
0.149605
0.149894
0.150194
0.150506
0.15083
0.151166
0.151515
0.151875
0.152249
0.152636
0.153037
0.153454
0.153887
0.154337
0.154807
0.155298
0.155811
0.156349
0.156906
0.157464
0.15798
0.158385
0.158605
0.158613
0.158455
0.158171
0.157783
0.15729
0.156679
0.155924
0.154991
0.153758
0.151841
0.151443
0.151088
0.150774
0.150497
0.150255
0.150045
0.149867
0.149718
0.149599
0.149507
0.149441
0.149398
0.149378
0.14938
0.149404
0.150003
0.15006
0.150138
0.150239
0.150363
0.150512
0.150688
0.150893
0.151129
0.151396
0.151693
0.152026
0.152396
0.152806
0.15326
0.154421
0.153899
0.153421
0.154199
0.154726
0.1553
0.156019
0.155409
0.154846
0.154329
0.153716
0.152987
0.152593
0.152239
0.15192
0.152512
0.152874
0.153275
0.153854
0.15342
0.153026
0.153481
0.153897
0.154352
0.154849
0.155388
0.155974
0.156607
0.157087
0.156442
0.155845
0.156221
0.156824
0.157473
0.157759
0.15711
0.156504
0.155939
0.155662
0.155292
0.154783
0.154315
0.153885
0.154222
0.154666
0.155145
0.155412
0.154919
0.154458
0.154026
0.153812
0.153492
0.153104
0.152669
0.152187
0.151634
0.151378
0.151153
0.150957
0.151403
0.151633
0.151894
0.152347
0.152059
0.151802
0.151575
0.151202
0.150787
0.150642
0.150519
0.150417
0.150748
0.150879
0.151029
0.151375
0.1512
0.151045
0.15131
0.151494
0.151698
0.151923
0.152174
0.152453
0.152762
0.153132
0.152803
0.152501
0.152747
0.153078
0.153432
0.153619
0.153235
0.15287
0.152526
0.152436
0.152224
0.151968
0.15173
0.151508
0.151605
0.151867
0.152144
0.152199
0.151889
0.151594
0.151319
0.151356
0.151297
0.151139
0.150907
0.150635
0.150334
0.149967
0.149447
0.149507
0.149583
0.149671
0.149763
0.149844
0.149983
0.14997
0.149956
0.149947
0.149949
0.150269
0.150218
0.150177
0.150379
0.150454
0.150538
0.150781
0.150664
0.150552
0.150438
0.150305
0.150141
0.150111
0.150234
0.150326
0.150361
0.150511
0.150667
0.150822
0.150977
0.151094
0.150898
0.150704
0.150669
0.150888
0.151117
0.151062
0.150825
0.150604
0.150405
0.150464
0.150512
0.150338
0.150289
0.150241
0.150205
0.150354
0.150539
0.150749
0.15098
0.151233
0.15151
0.151812
0.152137
0.152484
0.152855
0.153247
0.15366
0.154093
0.15455
0.155032
0.155543
0.156085
0.156659
0.15727
0.15792
0.157914
0.157261
0.156644
0.156428
0.157046
0.157698
0.157311
0.156678
0.156079
0.155511
0.155841
0.156057
0.1555
0.154971
0.154471
0.154262
0.154759
0.155285
0.154976
0.154471
0.153997
0.15372
0.154163
0.154635
0.155136
0.155669
0.156234
0.156832
0.156322
0.15577
0.155249
0.15484
0.155315
0.155818
0.155333
0.154879
0.154448
0.154041
0.154391
0.154758
0.154295
0.15386
0.153451
0.153194
0.153569
0.153968
0.153655
0.153291
0.152947
0.152623
0.152841
0.153068
0.153306
0.153552
0.153795
0.153997
0.15355
0.153127
0.15273
0.152562
0.152945
0.153356
0.153137
0.152749
0.152389
0.152055
0.152207
0.152359
0.152015
0.151697
0.151405
0.151301
0.151577
0.151879
0.151747
0.151465
0.151207
0.15112
0.15136
0.151624
0.151911
0.152222
0.152558
0.152919
0.15271
0.152376
0.152064
0.151913
0.152201
0.152511
0.152319
0.152034
0.151767
0.151519
0.151645
0.151775
0.151508
0.151262
0.151038
0.150959
0.151168
0.151396
0.15129
0.151078
0.150885
0.150813
0.150992
0.151187
0.151399
0.151627
0.151872
0.152134
0.152413
0.152709
0.153023
0.153354
0.153704
0.154073
0.154461
0.154869
0.154426
0.154061
0.153713
0.153366
0.153677
0.154
0.153592
0.153307
0.153032
0.152769
0.153069
0.153381
0.153065
0.152764
0.152479
0.152258
0.152515
0.152786
0.152516
0.152274
0.152044
0.151836
0.152041
0.152255
0.152478
0.15271
0.15295
0.153198
0.152819
0.152606
0.152399
0.152097
0.152273
0.152453
0.1521
0.151952
0.151805
0.151661
0.151925
0.152197
0.152003
0.151815
0.151635
0.151439
0.151596
0.151758
0.15152
0.151383
0.15125
0.151121
0.151289
0.151462
0.151641
0.151824
0.152014
0.15221
0.151955
0.151716
0.151492
0.151361
0.151565
0.151783
0.151616
0.15142
0.151235
0.151062
0.15117
0.151282
0.151088
0.150909
0.150745
0.15068
0.150829
0.150993
0.150901
0.150753
0.150617
0.150556
0.150678
0.150812
0.150957
0.151113
0.151279
0.151455
0.151298
0.151142
0.150994
0.150879
0.151008
0.151145
0.150997
0.150879
0.150767
0.150661
0.150757
0.150855
0.150726
0.150607
0.150497
0.15044
0.150537
0.150643
0.150561
0.15047
0.150385
0.150309
0.150352
0.150398
0.150445
0.150493
0.150544
0.150597
0.150652
0.15071
0.150771
0.150834
0.150901
0.150973
0.151051
0.151139
0.150898
0.150681
0.150485
0.150441
0.150623
0.150826
0.150763
0.150574
0.150404
0.15026
0.150285
0.150315
0.15018
0.150162
0.150148
0.150136
0.150239
0.150371
0.150529
0.150705
0.150652
0.150487
0.150341
0.150313
0.150448
0.150601
0.150553
0.150411
0.150287
0.150184
0.150201
0.150219
0.150125
0.150115
0.150105
0.150096
0.150168
0.150262
0.150377
0.150507
0.150464
0.150344
0.150239
0.150218
0.150314
0.150422
0.150383
0.150284
0.150198
0.150127
0.15014
0.150153
0.150088
0.150081
0.150074
0.150068
0.150115
0.150179
0.150256
0.150345
0.150309
0.15023
0.15016
0.150143
0.150204
0.150274
0.15024
0.150179
0.150126
0.150082
0.150093
0.150104
0.150061
0.150055
0.150049
0.150043
0.150072
0.15011
0.150155
0.150207
0.150266
0.150332
0.150404
0.150483
0.150567
0.150658
0.150753
0.150853
0.150957
0.151065
0.151176
0.15129
0.151405
0.151522
0.15164
0.151758
0.151428
0.151339
0.151248
0.150983
0.151047
0.151109
0.1508
0.150765
0.150726
0.150683
0.150916
0.151157
0.151066
0.150975
0.150885
0.150711
0.15078
0.150848
0.150638
0.150591
0.150542
0.150378
0.150407
0.150434
0.150458
0.150477
0.150493
0.150503
0.150216
0.15023
0.150237
0.150006
0.149976
0.149939
0.149673
0.149732
0.149783
0.149826
0.150029
0.15024
0.150237
0.15023
0.15022
0.150067
0.150059
0.150047
0.149863
0.149894
0.149919
0.14994
0.150072
0.150207
0.150348
0.150493
0.150643
0.150798
0.150713
0.15063
0.150552
0.150449
0.150511
0.150576
0.150444
0.150396
0.150349
0.150304
0.150389
0.150477
0.150406
0.150341
0.15028
0.15023
0.150279
0.150332
0.15026
0.150219
0.150181
0.150135
0.150162
0.150191
0.150221
0.150252
0.150284
0.150316
0.150193
0.150176
0.150159
0.150069
0.150072
0.150073
0.149957
0.149971
0.149982
0.14999
0.150064
0.150141
0.150123
0.150106
0.150089
0.150046
0.150052
0.150058
0.149996
0.15
0.150003
0.149963
0.14995
0.149935
0.149918
0.149898
0.149874
0.149846
0.149814
0.149777
0.149735
0.149686
0.149631
0.149568
0.149497
0.149417
0.149171
0.149271
0.149362
0.149163
0.149055
0.148935
0.148805
0.14856
0.148399
0.148146
0.147952
0.147743
0.147519
0.147279
0.146964
0.146687
0.14637
0.146057
0.145739
0.146068
0.14638
0.146665
0.146942
0.147224
0.147466
0.147693
0.147904
0.147673
0.147445
0.147201
0.146949
0.146673
0.146417
0.146108
0.145781
0.145436
0.145071
0.144686
0.144279
0.143948
0.143506
0.143041
0.142701
0.142201
0.141678
0.141131
0.140773
0.141332
0.141866
0.142378
0.142868
0.143178
0.143634
0.144068
0.144369
0.144768
0.145148
0.145508
0.145849
0.145603
0.145248
0.144874
0.144481
0.144208
0.143782
0.143335
0.143053
0.142573
0.142072
0.14155
0.141004
0.140436
0.140117
0.140695
0.14125
0.140967
0.140402
0.139815
0.13953
0.140126
0.140699
0.14125
0.141509
0.141783
0.142295
0.142785
0.143254
0.143511
0.143949
0.144367
0.144614
0.145001
0.145369
0.145719
0.14594
0.146173
0.146479
0.146708
0.146983
0.147209
0.147453
0.147682
0.147887
0.148102
0.148326
0.148493
0.148709
0.148847
0.148973
0.149089
0.149262
0.149443
0.149516
0.149581
0.14964
0.149508
0.149434
0.149352
0.149195
0.149293
0.149382
0.14926
0.149157
0.149044
0.148922
0.14879
0.148647
0.148456
0.148285
0.148087
0.147897
0.148099
0.148274
0.148448
0.148615
0.148763
0.1489
0.149026
0.149143
0.149031
0.148901
0.148761
0.14861
0.148464
0.148287
0.148134
0.147931
0.147716
0.147486
0.147242
0.147041
0.146768
0.146563
0.14626
0.146052
0.146367
0.146667
0.14685
0.147121
0.147299
0.147542
0.147771
0.147987
0.147846
0.147619
0.147377
0.147219
0.14695
0.146788
0.146492
0.146181
0.145853
0.145509
0.145146
0.144766
0.144543
0.144133
0.143703
0.14347
0.14301
0.142531
0.142031
0.141781
0.14229
0.14278
0.143249
0.143699
0.14391
0.144331
0.144733
0.144935
0.145308
0.145664
0.146003
0.146326
0.146167
0.145834
0.145485
0.145118
0.144937
0.144542
0.14413
0.143939
0.143498
0.143039
0.142561
0.142063
0.141544
0.141006
0.140446
0.139865
0.139262
0.139008
0.139618
0.140207
0.139981
0.139386
0.138769
0.138544
0.139166
0.139768
0.140349
0.140556
0.140774
0.141321
0.141847
0.142354
0.142158
0.141644
0.14111
0.14091
0.141451
0.141972
0.141797
0.141269
0.140722
0.140155
0.139568
0.13896
0.138332
0.138133
0.138766
0.139379
0.139202
0.138584
0.137946
0.137771
0.137109
0.136942
0.136256
0.13555
0.135388
0.134659
0.134508
0.133756
0.133615
0.132842
0.132712
0.131918
0.131104
0.130985
0.131799
0.132593
0.132486
0.131691
0.130877
0.130784
0.131598
0.132392
0.133168
0.133262
0.133368
0.133486
0.13424
0.134368
0.135101
0.135239
0.13595
0.136097
0.136786
0.137455
0.137607
0.138253
0.138413
0.139035
0.139638
0.139799
0.139972
0.140545
0.141098
0.141632
0.141476
0.140936
0.140378
0.140221
0.140785
0.141329
0.141856
0.141997
0.142147
0.142306
0.142474
0.142652
0.142841
0.143308
0.143757
0.144188
0.14436
0.144764
0.145151
0.145313
0.145673
0.146016
0.145872
0.14552
0.145374
0.144996
0.144601
0.144445
0.144024
0.143585
0.143128
0.142958
0.143422
0.143869
0.144297
0.144708
0.144848
0.145235
0.145604
0.145735
0.14608
0.146208
0.146343
0.146484
0.146633
0.146923
0.147068
0.147333
0.147472
0.147712
0.147938
0.148061
0.148189
0.148323
0.148501
0.148628
0.148781
0.148923
0.149055
0.149151
0.149251
0.149355
0.149463
0.149575
0.149692
0.149739
0.14978
0.149817
0.149739
0.14969
0.149636
0.149537
0.149603
0.149664
0.149719
0.149782
0.149849
0.149877
0.149902
0.149924
0.149886
0.149856
0.149821
0.149767
0.149811
0.14985
0.149815
0.149768
0.149716
0.149657
0.149592
0.14952
0.149441
0.14935
0.14944
0.149523
0.149457
0.149363
0.149262
0.149177
0.14929
0.149393
0.149487
0.149541
0.149598
0.149666
0.149727
0.149781
0.149749
0.149687
0.149618
0.149572
0.149649
0.149718
0.149779
0.149804
0.149829
0.149856
0.149883
0.149912
0.149942
0.149973
0.150006
0.150039
0.150074
0.15011
0.150147
0.150185
0.150225
0.150176
0.150132
0.150094
0.150078
0.15011
0.150145
0.150116
0.150088
0.150063
0.150043
0.150052
0.150062
0.150038
0.150032
0.150027
0.150021
0.150033
0.150049
0.150067
0.150087
0.150059
0.150046
0.150035
0.150021
0.150027
0.150033
0.150007
0.150008
0.150008
0.150007
0.150016
0.150025
0.150016
0.150011
0.150007
0.150002
0.149999
0.149995
0.149989
0.149982
0.149958
0.149972
0.149982
0.149971
0.149955
0.149935
0.149913
0.149938
0.149959
0.149976
0.149983
0.149991
0.149997
0.149993
0.149988
0.149984
0.149969
0.149948
0.149923
0.149892
0.149871
0.149907
0.149938
0.149928
0.149893
0.149851
0.149832
0.149879
0.149918
0.149949
0.149955
0.149962
0.14998
0.149976
0.149973
0.149969
0.149943
0.149909
0.149866
0.149814
0.149756
0.149689
0.149613
0.149528
0.149435
0.149332
0.149219
0.149096
0.148964
0.14882
0.148666
0.148556
0.148379
0.148262
0.14815
0.148349
0.14845
0.148627
0.148721
0.148876
0.149019
0.149151
0.149273
0.149216
0.149086
0.148944
0.148791
0.14871
0.148536
0.148449
0.148252
0.148043
0.14782
0.147583
0.14746
0.147199
0.147072
0.146786
0.146654
0.14695
0.14723
0.147343
0.147599
0.147707
0.14794
0.148159
0.148365
0.148285
0.14807
0.147842
0.147747
0.147496
0.147397
0.147123
0.146833
0.146529
0.146409
0.146722
0.14702
0.146921
0.146616
0.146294
0.145957
0.14584
0.14548
0.145102
0.144977
0.144575
0.144157
0.143721
0.143268
0.142796
0.142643
0.143122
0.143582
0.14345
0.142983
0.142499
0.142363
0.142853
0.143325
0.143779
0.143898
0.144024
0.144449
0.144857
0.145248
0.145361
0.145729
0.146081
0.146185
0.146514
0.146827
0.147125
0.147212
0.147302
0.14757
0.147657
0.147902
0.147984
0.148208
0.148417
0.148486
0.148558
0.148632
0.148804
0.148873
0.149023
0.149162
0.14929
0.149336
0.149384
0.149486
0.149578
0.14966
0.149633
0.149544
0.149446
0.149407
0.149512
0.149607
0.149582
0.149481
0.149369
0.149245
0.14911
0.148963
0.148905
0.148738
0.148674
0.148613
0.148796
0.148849
0.149012
0.14906
0.149203
0.149333
0.149451
0.149558
0.149534
0.149422
0.149298
0.149161
0.149121
0.148965
0.14892
0.148744
0.148554
0.148351
0.148134
0.148062
0.147823
0.147748
0.147487
0.147407
0.147675
0.147928
0.147994
0.148225
0.148287
0.148498
0.148694
0.148877
0.148835
0.148646
0.148443
0.14839
0.148166
0.148109
0.147864
0.147605
0.147331
0.147041
0.146737
0.146417
0.146324
0.145981
0.145623
0.145522
0.145141
0.144744
0.14433
0.144216
0.144636
0.145039
0.144943
0.144534
0.144109
0.143667
0.143207
0.14273
0.142235
0.141723
0.141192
0.140642
0.140074
0.139486
0.13888
0.138734
0.138104
0.137966
0.137314
0.136642
0.136509
0.135815
0.13569
0.134975
0.13486
0.134123
0.134018
0.133924
0.134662
0.134755
0.135473
0.135576
0.136274
0.136386
0.137063
0.137183
0.137838
0.138474
0.138599
0.139213
0.139345
0.139936
0.140509
0.141062
0.140942
0.140384
0.139808
0.139689
0.139091
0.138978
0.138359
0.13772
0.137612
0.136953
0.136852
0.136172
0.136081
0.135381
0.135301
0.134582
0.133844
0.133088
0.132313
0.131519
0.130706
0.130646
0.129814
0.129774
0.128924
0.128056
0.127169
0.127148
0.128034
0.128903
0.128899
0.128031
0.127144
0.126238
0.126249
0.125326
0.125349
0.124407
0.124439
0.12348
0.12352
0.122543
0.121549
0.120539
0.119512
0.119558
0.118516
0.118566
0.11751
0.116439
0.115353
0.115406
0.116491
0.117561
0.118617
0.119658
0.119607
0.120633
0.120584
0.121595
0.121644
0.121694
0.120684
0.120734
0.119709
0.118668
0.117612
0.116543
0.115459
0.115509
0.116593
0.117662
0.117708
0.116639
0.115556
0.114461
0.114504
0.113395
0.113433
0.112313
0.111181
0.110038
0.110069
0.108916
0.107751
0.107775
0.106601
0.106616
0.107788
0.108952
0.108938
0.110091
0.111234
0.111212
0.112344
0.113463
0.113484
0.112365
0.112378
0.111247
0.110104
0.113496
0.114603
0.114591
0.11457
0.114541
0.115636
0.115599
0.116681
0.117749
0.118804
0.118763
0.118717
0.119758
0.120783
0.121793
0.121744
0.122739
0.122688
0.122638
0.122589
0.123566
0.124526
0.12448
0.125423
0.125382
0.126307
0.126273
0.127179
0.127155
0.128042
0.128911
0.128937
0.128067
0.128103
0.127214
0.127257
0.126349
0.126397
0.12547
0.12552
0.124576
0.123615
0.123666
0.124627
0.125572
0.1265
0.126448
0.127357
0.127305
0.128196
0.128147
0.129019
0.128974
0.129826
0.129788
0.129762
0.129749
0.129752
0.130583
0.130604
0.131416
0.131458
0.132251
0.132209
0.132187
0.131394
0.131391
0.130579
0.130593
0.131406
0.132199
0.132184
0.132958
0.13296
0.132983
0.133026
0.133781
0.134518
0.135236
0.135191
0.134473
0.133737
0.133714
0.13445
0.135167
0.135164
0.134448
0.133712
0.133729
0.132974
0.133005
0.13223
0.131435
0.130621
0.13066
0.131475
0.132272
0.133049
0.133808
0.133762
0.1345
0.134466
0.135183
0.135218
0.135267
0.134547
0.134604
0.133862
0.133102
0.132322
0.131524
0.130708
0.129872
0.129924
0.129069
0.129123
0.128249
0.128304
0.127411
0.127463
0.126552
0.125624
0.124678
0.123716
0.123765
0.122787
0.122832
0.121838
0.120828
0.119803
0.119844
0.120869
0.121879
0.121914
0.120904
0.119879
0.118839
0.117785
0.116717
0.116746
0.115665
0.115685
0.115697
0.116777
0.116766
0.117833
0.117814
0.118867
0.119907
0.120932
0.121941
0.121961
0.120951
0.119926
0.118887
0.118899
0.117845
0.119938
0.120963
0.121972
0.122967
0.122955
0.122936
0.122908
0.122873
0.123852
0.123811
0.124773
0.124727
0.125673
0.125719
0.125761
0.124815
0.12485
0.123887
0.123915
0.124878
0.125825
0.125797
0.126727
0.126691
0.126649
0.126602
0.127514
0.128409
0.128357
0.129234
0.129179
0.130036
0.12998
0.130818
0.130761
0.131579
0.132379
0.132439
0.131638
0.131697
0.130876
0.130933
0.130092
0.130146
0.129286
0.129335
0.128457
0.127561
0.127604
0.1285
0.129379
0.13024
0.130195
0.131038
0.130988
0.131812
0.131756
0.13256
0.1325
0.133285
0.133222
0.13316
0.133923
0.134666
0.135391
0.135326
0.136029
0.135968
0.135918
0.135881
0.135862
0.135864
0.13589
0.135936
0.136001
0.136683
0.136762
0.137425
0.137514
0.138157
0.138253
0.138875
0.139479
0.139579
0.140162
0.140269
0.14083
0.140726
0.140631
0.140064
0.139975
0.139387
0.138781
0.138695
0.138069
0.137991
0.137346
0.13728
0.136617
0.13657
0.136544
0.137204
0.137232
0.137876
0.137925
0.138553
0.138618
0.139228
0.139303
0.139893
0.140465
0.140544
0.141096
0.14118
0.141273
0.141373
0.141481
0.141598
0.142115
0.142615
0.143096
0.142993
0.142506
0.142003
0.141898
0.142405
0.142895
0.143368
0.143461
0.143561
0.144008
0.144438
0.144852
0.144765
0.144347
0.143913
0.143824
0.144262
0.144684
0.144609
0.144183
0.14374
0.143281
0.142805
0.142312
0.141801
0.141712
0.142226
0.142722
0.142646
0.142147
0.14163
0.141556
0.141019
0.140949
0.140393
0.139819
0.139754
0.139162
0.139111
0.138502
0.138471
0.137847
0.137842
0.1372
0.136541
0.13656
0.13722
0.137861
0.1379
0.137259
0.136598
0.13665
0.137313
0.137956
0.13858
0.138523
0.138483
0.138465
0.139069
0.139078
0.139667
0.139702
0.140276
0.140329
0.140886
0.141426
0.141488
0.142009
0.142075
0.142577
0.143061
0.143128
0.143201
0.143664
0.144109
0.144538
0.144474
0.144042
0.143593
0.143529
0.14398
0.144415
0.144362
0.143925
0.143471
0.143001
0.142513
0.142455
0.141949
0.141896
0.141373
0.140833
0.140794
0.140239
0.140226
0.139656
0.139671
0.139086
0.139127
0.139185
0.139771
0.139711
0.140277
0.140239
0.140788
0.140778
0.141313
0.141333
0.141855
0.142361
0.142403
0.142894
0.142945
0.143417
0.143873
0.144313
0.144267
0.143826
0.143368
0.143325
0.142851
0.142822
0.142335
0.141832
0.141835
0.14132
0.141355
0.140825
0.140886
0.140338
0.140414
0.139845
0.139257
0.13865
0.138024
0.137378
0.136713
0.136783
0.136096
0.136166
0.135459
0.134732
0.133986
0.134051
0.134799
0.135527
0.135594
0.134864
0.134114
0.133347
0.133405
0.132617
0.13267
0.131863
0.13191
0.131084
0.131122
0.130278
0.129416
0.128536
0.12764
0.127669
0.126755
0.126775
0.125844
0.124897
0.123934
0.123945
0.124909
0.125856
0.126786
0.127701
0.127689
0.128586
0.128565
0.129445
0.129466
0.129478
0.128598
0.130341
0.130328
0.130308
0.131153
0.13198
0.131949
0.132758
0.132718
0.133508
0.133459
0.13423
0.134174
0.134925
0.135658
0.135716
0.134982
0.135033
0.134279
0.134321
0.133549
0.133581
0.132789
0.132811
0.132001
0.131174
0.131186
0.132014
0.132824
0.133616
0.133603
0.134377
0.134354
0.13511
0.135076
0.135812
0.135768
0.136485
0.136431
0.136371
0.136306
0.136237
0.136928
0.136855
0.137525
0.13745
0.138098
0.138176
0.138253
0.1376
0.137673
0.136999
0.137066
0.137743
0.1384
0.138329
0.138965
0.138887
0.138807
0.138727
0.139336
0.139927
0.140498
0.140587
0.140013
0.139419
0.139502
0.140098
0.140675
0.140761
0.140181
0.139583
0.139658
0.139039
0.139106
0.138465
0.137806
0.137128
0.137183
0.137862
0.138523
0.139165
0.139789
0.139728
0.14033
0.140259
0.140841
0.140914
0.140979
0.140393
0.140446
0.13984
0.139216
0.138572
0.13791
0.137229
0.13653
0.136565
0.135847
0.13587
0.135133
0.135146
0.13439
0.135884
0.136604
0.136589
0.13729
0.137265
0.137947
0.13861
0.138636
0.137972
0.137987
0.137305
0.138652
0.139297
0.139281
0.139255
0.13988
0.140488
0.141076
0.141034
0.141602
0.141546
0.14148
0.141404
0.141321
0.141233
0.141141
0.14105
0.140963
0.141493
0.141415
0.141926
0.141867
0.142361
0.142333
0.142816
0.143282
0.143293
0.14375
0.143783
0.144226
0.144191
0.144171
0.143734
0.143746
0.1433
0.142839
0.142892
0.142418
0.142497
0.142005
0.142096
0.141583
0.141677
0.141771
0.142291
0.142193
0.14269
0.142591
0.143066
0.142971
0.143427
0.14335
0.14379
0.144214
0.144177
0.144593
0.144594
0.144617
0.144652
0.144693
0.144736
0.144782
0.144833
0.144889
0.144951
0.145018
0.14509
0.145167
0.145249
0.145335
0.145426
0.145796
0.145887
0.146235
0.146568
0.14665
0.146961
0.147257
0.147538
0.147803
0.147744
0.147473
0.147187
0.146885
0.146812
0.146489
0.146151
0.14607
0.145711
0.145629
0.145994
0.146342
0.146414
0.146742
0.147054
0.147119
0.147411
0.147688
0.147949
0.148001
0.148054
0.148289
0.148339
0.148554
0.148599
0.148794
0.148975
0.14901
0.149046
0.149083
0.149232
0.149265
0.149395
0.149512
0.14949
0.149368
0.149342
0.149201
0.14917
0.149141
0.149292
0.149317
0.149449
0.149469
0.149582
0.149599
0.149616
0.149634
0.149652
0.149671
0.149691
0.149712
0.149733
0.149797
0.149853
0.1499
0.149891
0.149841
0.14978
0.149765
0.149829
0.149883
0.149927
0.149932
0.149938
0.149966
0.149963
0.14996
0.149957
0.149922
0.149876
0.149818
0.149749
0.149735
0.149807
0.149868
0.149862
0.149797
0.149721
0.149708
0.149788
0.149855
0.149909
0.149913
0.149917
0.149954
0.149952
0.14995
0.149947
0.149905
0.149849
0.149778
0.149695
0.149682
0.14977
0.149843
0.149837
0.149761
0.14967
0.149566
0.149551
0.149429
0.149409
0.149268
0.149112
0.148941
0.148755
0.148716
0.14851
0.148468
0.148242
0.148196
0.148427
0.148643
0.148679
0.148875
0.148908
0.149084
0.149245
0.14939
0.149372
0.149222
0.149056
0.149029
0.148844
0.148813
0.148608
0.148387
0.148151
0.1479
0.147633
0.147352
0.147295
0.146993
0.146675
0.146612
0.146274
0.145921
0.145552
0.145479
0.145853
0.14621
0.146552
0.146878
0.146934
0.14724
0.147531
0.147581
0.147852
0.148108
0.148348
0.148574
0.14854
0.148311
0.148066
0.147806
0.147762
0.147483
0.147188
0.147139
0.146824
0.146495
0.146149
0.145788
0.145411
0.145347
0.145728
0.146092
0.146039
0.145672
0.145289
0.145235
0.145621
0.145991
0.146345
0.146391
0.146441
0.146774
0.147092
0.147394
0.147437
0.14772
0.147988
0.148027
0.148275
0.148508
0.148726
0.148754
0.148783
0.148977
0.149003
0.149177
0.149199
0.149353
0.149492
0.149506
0.149521
0.149536
0.149648
0.149659
0.149753
0.149832
0.149894
0.149897
0.149901
0.149945
0.149944
0.149942
0.14994
0.149891
0.149827
0.149745
0.149738
0.149637
0.149626
0.149615
0.149723
0.14973
0.149817
0.149822
0.149888
0.149939
0.149938
0.149885
0.149883
0.149812
0.149807
0.149715
0.149604
0.149477
0.149335
0.149317
0.149155
0.149134
0.148952
0.148927
0.149113
0.149282
0.1493
0.149449
0.149463
0.149594
0.149708
0.149803
0.149798
0.1497
0.149583
0.149572
0.149435
0.149421
0.149265
0.149092
0.148903
0.148698
0.148477
0.14824
0.148207
0.147952
0.147681
0.147643
0.147353
0.147048
0.146727
0.146684
0.147007
0.147315
0.147608
0.147884
0.147917
0.148176
0.148419
0.148447
0.148672
0.14888
0.149072
0.149248
0.149231
0.149053
0.148857
0.148646
0.148622
0.148391
0.148146
0.148118
0.147854
0.147575
0.147281
0.146971
0.146645
0.146304
0.145947
0.145575
0.145187
0.145143
0.145533
0.145908
0.145872
0.145495
0.145102
0.145064
0.145459
0.145838
0.146202
0.146233
0.146267
0.14661
0.146938
0.14725
0.147222
0.146908
0.146579
0.146549
0.146881
0.147197
0.147173
0.146855
0.14652
0.146171
0.145805
0.145424
0.145028
0.145002
0.145396
0.145776
0.145758
0.145383
0.144995
0.145017
0.144623
0.144688
0.144284
0.143864
0.14396
0.143522
0.143627
0.143168
0.143272
0.142791
0.142888
0.142385
0.141862
0.141948
0.142473
0.142979
0.143062
0.142553
0.142026
0.142094
0.142624
0.143135
0.143626
0.143551
0.143466
0.143372
0.143837
0.143734
0.144177
0.144067
0.144488
0.144379
0.14478
0.145163
0.145075
0.145446
0.145397
0.145764
0.146118
0.14612
0.146141
0.146492
0.146827
0.147148
0.147123
0.146802
0.146468
0.146459
0.146788
0.147104
0.147408
0.147429
0.147453
0.147476
0.147498
0.147521
0.147546
0.147827
0.148093
0.148343
0.148366
0.148599
0.148815
0.148836
0.149034
0.149215
0.1492
0.149016
0.148999
0.148797
0.148578
0.148559
0.148323
0.148071
0.147804
0.147782
0.148052
0.148305
0.148543
0.148765
0.14878
0.148984
0.149173
0.149186
0.149355
0.149367
0.14938
0.149394
0.149407
0.149551
0.149562
0.149685
0.149693
0.149793
0.149874
0.149876
0.149878
0.149881
0.149936
0.149937
0.149936
0.149935
0.149935
0.149935
0.149872
0.149789
0.149784
0.149678
0.14967
0.14954
0.14953
0.149662
0.149774
0.149779
0.149867
0.149869
0.149934
0.149934
0.149934
0.149865
0.149863
0.149769
0.149655
0.149519
0.149509
0.149647
0.149765
0.149761
0.149641
0.1495
0.149344
0.149335
0.149161
0.148971
0.148961
0.148753
0.148529
0.148289
0.148034
0.147763
0.147742
0.148016
0.148274
0.148256
0.147996
0.14772
0.147698
0.147974
0.148236
0.148482
0.1485
0.148515
0.148741
0.148951
0.149144
0.149152
0.149327
0.149486
0.149493
0.149635
0.149757
0.149857
0.149858
0.14986
0.149933
0.149933
0.149933
0.149934
0.149935
0.149856
0.149755
0.14963
0.149627
0.149481
0.149321
0.149315
0.149136
0.148941
0.148729
0.148713
0.148928
0.149126
0.149307
0.149471
0.149477
0.149624
0.149753
0.149753
0.149857
0.149936
0.149939
0.149858
0.149859
0.149752
0.149621
0.149615
0.149463
0.149296
0.149112
0.148911
0.148695
0.148463
0.148217
0.147958
0.147685
0.147401
0.147105
0.146798
0.146478
0.146147
0.145804
0.14588
0.14553
0.145637
0.145272
0.144889
0.145004
0.1446
0.14471
0.144283
0.144383
0.143934
0.144022
0.144099
0.144554
0.144474
0.144907
0.144813
0.145224
0.145118
0.145506
0.14539
0.145756
0.146103
0.145984
0.146314
0.146215
0.146535
0.146843
0.147138
0.14721
0.146926
0.146627
0.146743
0.146432
0.146556
0.146225
0.145875
0.145989
0.145616
0.145716
0.145321
0.145406
0.144989
0.145058
0.14462
0.144164
0.143689
0.143196
0.142683
0.142152
0.142197
0.141646
0.141676
0.141105
0.140516
0.139908
0.139924
0.140532
0.141122
0.141693
0.142245
0.142228
0.142761
0.142729
0.143243
0.143275
0.143294
0.142779
0.143791
0.143771
0.143738
0.144214
0.144672
0.145111
0.145147
0.144707
0.144249
0.144269
0.144728
0.145168
0.145591
0.145569
0.145531
0.145477
0.145877
0.145803
0.146182
0.146092
0.146449
0.146342
0.146676
0.146992
0.146868
0.147162
0.147037
0.147315
0.147438
0.147564
0.147287
0.147405
0.147105
0.146787
0.146883
0.146542
0.146621
0.146258
0.146316
0.145933
0.145972
0.145994
0.146379
0.146356
0.146722
0.146681
0.147027
0.146964
0.147289
0.147205
0.147508
0.147792
0.147685
0.147945
0.147823
0.147696
0.147577
0.147482
0.147422
0.147696
0.147958
0.14821
0.14823
0.147991
0.147742
0.147826
0.148062
0.148288
0.148502
0.14846
0.148451
0.148679
0.148895
0.149096
0.149084
0.148888
0.148679
0.148708
0.148904
0.14909
0.149125
0.148954
0.148773
0.148582
0.14838
0.148166
0.147938
0.148063
0.148287
0.148494
0.148616
0.14841
0.148187
0.148301
0.148056
0.148149
0.147882
0.147595
0.147662
0.147354
0.147397
0.147069
0.147093
0.146746
0.147423
0.147734
0.147707
0.147998
0.147951
0.148221
0.148472
0.148397
0.148625
0.148526
0.148732
0.14892
0.148805
0.148688
0.148868
0.149036
0.149193
0.149284
0.149137
0.148978
0.14909
0.149244
0.149382
0.149476
0.149343
0.149192
0.149022
0.148834
0.148915
0.148703
0.148757
0.148523
0.14827
0.148299
0.148026
0.148553
0.148788
0.149003
0.14897
0.149163
0.149105
0.149275
0.149425
0.149555
0.149614
0.149485
0.149335
0.149371
0.149198
0.149523
0.14965
0.149754
0.14972
0.149666
0.149593
0.149507
0.149418
0.14934
0.149287
0.149265
0.149268
0.149281
0.149451
0.149606
0.149743
0.149749
0.149858
0.149943
0.149941
0.149942
0.149855
0.149848
0.149732
0.149593
0.149437
0.149429
0.149583
0.149721
0.149837
0.149929
0.149938
0.149917
0.149828
0.149716
0.149584
0.14944
0.149478
0.149608
0.149727
0.149757
0.149655
0.149541
0.149618
0.149718
0.149803
0.14987
0.149842
0.149828
0.149909
0.149909
0.149919
0.149933
0.1499
0.14985
0.149781
0.149695
0.149759
0.149834
0.149888
0.149912
0.14987
0.149806
0.149834
0.149891
0.149922
0.149938
0.149933
0.149923
0.149943
0.149946
0.149945
0.203609
0.18667
0.181717
0.186501
0.18975
0.118974
0.112553
0.129399
0.132889
0.14347
0.111256
0.097569
0.12018
0.125615
0.131326
0.134847
0.0843448
0.0992387
0.104122
0.0999871
0.0552196
0.0735977
0.0885293
0.0923436
0.0879014
0.0764048
0.0465019
0.0621468
0.0652957
0.0487891
0.069653
0.0725198
0.0690637
0.0574891
0.0340709
0.0445722
0.0632075
0.0658127
0.0304691
0.0386703
0.0391486
0.0283872
0.034959
0.0516795
0.0424743
0.0411057
0.146849
0.148714
0.14933
0.148345
0.149133
0.149672
0.149828
0.1499
0.149953
0.150005
0.150059
0.150105
0.150123
0.150108
0.150077
0.150051
0.150035
0.150027
0.150024
0.150022
0.150021
0.15002
0.150019
0.150018
0.150017
0.150016
0.150015
0.150014
0.150013
0.150013
0.150012
0.150011
0.15001
0.15001
0.150009
0.150008
0.150007
0.150006
0.150005
0.150004
0.150003
0.150003
0.150002
0.150001
0.150001
0.15
0.149999
0.149999
0.149998
0.149998
0.149997
0.149997
0.149996
0.149996
0.149995
0.149995
0.149995
0.149994
0.149994
0.149994
0.149994
0.149994
0.149994
0.149994
0.149994
0.149994
0.149995
0.149995
0.149996
0.149996
0.149997
0.149998
0.149999
0.15
0.150002
0.150003
0.150005
0.150007
0.15001
0.150013
0.150017
0.150021
0.150023
0.150023
0.15002
0.150012
0.149999
0.149986
0.149976
0.14997
0.149967
0.149962
0.149917
0.149897
0.149783
0.14994
)
;
boundaryField
{
bottomEmptyFaces
{
type empty;
}
topEmptyFaces
{
type empty;
}
inlet
{
type calculated;
value nonuniform List<scalar>
95
(
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
0.15
)
;
}
outlet
{
type calculated;
value nonuniform List<scalar>
36
(
0.0436107
0.0436079
0.0436029
0.0435955
0.0435853
0.0435722
0.0435562
0.0435372
0.0435153
0.0434904
0.0434632
0.0434347
0.0434076
0.0433869
0.0433826
0.0434124
0.0435039
0.0436886
0.0439832
0.0443237
0.0445155
0.0444677
0.0414214
0.0434509
0.0408167
0.0388541
0.0365051
0.0377134
0.0362698
0.0378973
0.0515592
0.0718641
0.108325
0.0974564
0.0837029
0.0436121
)
;
}
walls
{
type calculated;
value uniform 1;
}
rightWall
{
type calculated;
value nonuniform List<scalar>
28
(
0.0991201
0.100386
0.105085
0.11027
0.115106
0.120262
0.122566
0.125553
0.127317
0.128435
0.128949
0.128918
0.12839
0.127336
0.125771
0.12352
0.120711
0.11635
0.11269
0.107146
0.100925
0.0953263
0.105096
0.0933928
0.0905926
0.131492
0.116044
0.102111
)
;
}
symmetryLine
{
type symmetryPlane;
}
}
// ************************************************************************* //
| [
"mhoeper3234@gmail.com"
] | mhoeper3234@gmail.com |
6809dbfcd52b960a0da18caa1586ce5efb491bc4 | 98410335456794507c518e361c1c52b6a13b0b39 | /sprayMASCOTTELAM2/0.04/C7H16 | b066527748f1c03a96ed29bd30cbf760e5388e78 | [] | no_license | Sebvi26/MASCOTTE | d3d817563f09310dfc8c891d11b351ec761904f3 | 80241928adec6bcaad85dca1f2159f6591483986 | refs/heads/master | 2022-10-21T03:19:24.725958 | 2020-06-14T21:19:38 | 2020-06-14T21:19:38 | 270,176,043 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,396 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 4.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format binary;
class volScalarField;
location "0.04";
object C7H16;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type fixedValue;
value uniform 0;
}
outlet
{
type zeroGradient;
}
bottom1
{
type zeroGradient;
}
bottom2
{
type zeroGradient;
}
top1
{
type zeroGradient;
}
top2
{
type zeroGradient;
}
defaultFaces
{
type empty;
}
}
// ************************************************************************* //
| [
"sebastianvi26@gmail.com"
] | sebastianvi26@gmail.com | |
c6302c0a32cf4c4999f458a62bf2fa28ea143f4a | 1082d5cde908e101c51f69923212dcae4b4b60f4 | /Source/PythonConsole/Private/SPythonLog.h | c521e972acf5035b3e7466ee20ec2c50d6713157 | [
"MIT"
] | permissive | SaxonRah/UnrealEnginePython | 88039c62024d01672138c4adeecac0fc9729bed0 | d5f3b2e7a42209af31cbbd47377633e8d452439c | refs/heads/master | 2021-01-04T23:56:44.556697 | 2020-02-16T00:38:43 | 2020-02-16T00:38:43 | 240,805,780 | 7 | 1 | MIT | 2020-02-16T00:03:20 | 2020-02-16T00:03:19 | null | UTF-8 | C++ | false | false | 5,952 | h | // Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Runtime/Slate/Public/Framework/Text/BaseTextLayoutMarshaller.h"
#include "Runtime/Core/Public/Misc/TextFilterExpressionEvaluator.h"
#include "Runtime/SlateCore/Public/SlateCore.h"
#include "UnrealEnginePython.h"
#include "Runtime/Slate/Public/Widgets/Input/SMultiLineEditableTextBox.h"
#include "Runtime/Slate/Public/Widgets/Input/SEditableTextBox.h"
class FPythonLogTextLayoutMarshaller;
class SSearchBox;
/**
* A single log message for the output log, holding a message and
* a style, for color and bolding of the message.
*/
struct FLogMessage
{
TSharedRef<FString> Message;
FName Style;
FLogMessage(const TSharedRef<FString>& NewMessage, FName NewStyle = NAME_None)
: Message(NewMessage)
, Style(NewStyle)
{
}
};
/**
* Console input box with command-completion support
*/
class SPythonConsoleInputBox
: public SCompoundWidget
{
public:
SLATE_BEGIN_ARGS(SPythonConsoleInputBox) {}
/** Called when a console command is executed */
SLATE_EVENT( FSimpleDelegate, OnConsoleCommandExecuted )
SLATE_END_ARGS()
/** Protected console input box widget constructor, called by Slate */
SPythonConsoleInputBox();
/**
* Construct this widget. Called by the SNew() Slate macro.
*
* @param InArgs Declaration used by the SNew() macro to construct this widget
*/
void Construct( const FArguments& InArgs );
/** Returns the editable text box associated with this widget. Used to set focus directly. */
TSharedRef< SEditableTextBox > GetEditableTextBox()
{
return InputText.ToSharedRef();
}
/** SWidget interface */
virtual void Tick( const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime ) override;
TArray<FString> History;
int HistoryPosition;
FString MultilineString;
bool IsMultiline;
protected:
virtual bool SupportsKeyboardFocus() const override { return true; }
/** Handles entering in a command */
void OnTextCommitted(const FText& InText, ETextCommit::Type CommitInfo);
private:
/** Editable text widget */
TSharedPtr< SEditableTextBox > InputText;
/** Delegate to call when a console command is executed */
FSimpleDelegate OnConsoleCommandExecuted;
/** to prevent recursive calls in UI callback */
bool bIgnoreUIUpdate;
};
/**
* Widget which holds a list view of logs of the program output
* as well as a combo box for entering in new commands
*/
class SPythonLog
: public SCompoundWidget, public FOutputDevice
{
public:
SLATE_BEGIN_ARGS( SPythonLog )
: _Messages()
{}
/** All messages captured before this log window has been created */
SLATE_ARGUMENT( TArray< TSharedPtr<FLogMessage> >, Messages )
SLATE_END_ARGS()
/** Destructor for output log, so we can unregister from notifications */
~SPythonLog();
/**
* Construct this widget. Called by the SNew() Slate macro.
*
* @param InArgs Declaration used by the SNew() macro to construct this widget
*/
void Construct( const FArguments& InArgs );
/**
* Creates FLogMessage objects from FOutputDevice log callback
*
* @param V Message text
* @param Verbosity Message verbosity
* @param Category Message category
* @param OutMessages Array to receive created FLogMessage messages
* @param Filters [Optional] Filters to apply to Messages
*
* @return true if any messages have been created, false otherwise
*/
static bool CreateLogMessages(const TCHAR* V, ELogVerbosity::Type Verbosity, const class FName& Category, TArray< TSharedPtr<FLogMessage> >& OutMessages);
protected:
virtual void Serialize( const TCHAR* V, ELogVerbosity::Type Verbosity, const class FName& Category ) override;
protected:
/**
* Extends the context menu used by the text box
*/
void ExtendTextBoxMenu(FMenuBuilder& Builder);
/**
* Called when delete all is selected
*/
void OnClearLog();
/**
* Called when the user scrolls the log window vertically
*/
void OnUserScrolled(float ScrollOffset);
/**
* Called to determine whether delete all is currently a valid command
*/
bool CanClearLog() const;
/** Called when a console command is entered for this output log */
void OnConsoleCommandExecuted();
/** Request we immediately force scroll to the bottom of the log */
void RequestForceScroll();
/** Converts the array of messages into something the text box understands */
TSharedPtr< FPythonLogTextLayoutMarshaller > MessagesTextMarshaller;
/** The editable text showing all log messages */
TSharedPtr< SMultiLineEditableTextBox > MessagesTextBox;
/** True if the user has scrolled the window upwards */
bool bIsUserScrolled;
};
/** Output log text marshaller to convert an array of FLogMessages into styled lines to be consumed by an FTextLayout */
class FPythonLogTextLayoutMarshaller : public FBaseTextLayoutMarshaller
{
public:
static TSharedRef< FPythonLogTextLayoutMarshaller > Create(TArray< TSharedPtr<FLogMessage> > InMessages);
virtual ~FPythonLogTextLayoutMarshaller();
// ITextLayoutMarshaller
virtual void SetText(const FString& SourceString, FTextLayout& TargetTextLayout) override;
virtual void GetText(FString& TargetString, const FTextLayout& SourceTextLayout) override;
bool AppendMessage(const TCHAR* InText, const ELogVerbosity::Type InVerbosity, const FName& InCategory);
void ClearMessages();
int32 GetNumMessages() const;
protected:
FPythonLogTextLayoutMarshaller(TArray< TSharedPtr<FLogMessage> > InMessages);
void AppendMessageToTextLayout(const TSharedPtr<FLogMessage>& InMessage);
void AppendMessagesToTextLayout(const TArray<TSharedPtr<FLogMessage>>& InMessages);
/** All log messages to show in the text box */
TArray< TSharedPtr<FLogMessage> > Messages;
/** Holds cached numbers of messages to avoid unnecessary re-filtering */
int32 CachedNumMessages;
/** Flag indicating the messages count cache needs rebuilding */
bool bNumMessagesCacheDirty;
FTextLayout* TextLayout;
}; | [
"roberto@20tab.com"
] | roberto@20tab.com |
4e077e738d91e3cc621f32cce6cd86f7196184ba | 93debf8d51e8966118f59fb97164219f95592d47 | /[std] 9LetterWords/JMiles9LetterWords/FIleIO.h | bb2bc03f1f11c27e78d14ad2127bc5b46d05b747 | [] | no_license | JMiles42/9LetterWordsCalculator | 6814470b6bb3b2bfbe101e496a88cfebc1524856 | 052e98d0cec1c380c2aeca1d55ba93e551d73c26 | refs/heads/master | 2020-03-24T17:54:53.680126 | 2018-07-30T13:00:51 | 2018-07-30T13:00:51 | 142,876,343 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 691 | h | #pragma once
#include "stdafx.h"
#include "NineLetterWords.h"
#include <fstream>
#include <regex>
#include <Windows.h>
class FileIO
{
public:
static bool FileExists(std::string fileName);
static std::vector<std::string> FileLoad(std::string fileName);
static bool FileSave(std::string fileName, std::set<std::string>& eachLineString, NineLetterWords & nineLetterWords);
static void ToUpper(std::string & stringToUpper);
static void ToLower(std::string & stringToUpper);
static bool GetUserTrueFalse(std::string message);
static std::set<std::string> StringVectorToSet(std::vector<std::string>& vec);
static std::vector<std::string> StringSetToVector(std::set<std::string>& set);
};
| [
"J@jmiles42.com"
] | J@jmiles42.com |
46096175814438524854cf1b9d27f22998a78e6f | 4051c58e8beba4e2aa692a479619f5459209f8ab | /include/Engine.h | 775245c05e22e2496240cb6f16b214f1738d9676 | [
"MIT"
] | permissive | Tursh/CGE-Dev | 00f3125996f46cd387fdb9d69226791e3b17be88 | fbe670dfa848b0447b5d66a71acbc53b683c1397 | refs/heads/master | 2023-04-30T02:16:03.825677 | 2021-05-01T04:23:34 | 2021-05-01T04:23:34 | 183,306,988 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 688 | h | #pragma once
#include "IO/Window.h"
namespace CGE
{
/**
* Initialize the library and it's dependencies then return the main window
* @param name Your application name
* @param width The window width_
* @param height The window height
* @param resizable If the window will be resizable
* @return The window (can be access by CGE::IO::getWindow(0)
*/
IO::Window *initEngine(const char *name,
unsigned int width = IO::DEFAULT_WIDTH,
unsigned int height = IO::DEFAULT_HEIGHT,
bool resizable = true);
/**
* Terminate the library and dependencies
*/
void stopEngine();
}
| [
"raphaeltremblay01@gmail.com"
] | raphaeltremblay01@gmail.com |
2964dd74027080c48f2e024d97dfc00a5e8ad77a | 935e1458888b7911a58f2da5981c9d586fe6965d | /lib/ErriezBH1750/examples/OneTimeMode/BH1750OneTimeBasic/BH1750OneTimeBasic.ino | 8d0a835225b5b7472683dac5e411e14f8d6aeb10 | [
"MIT"
] | permissive | Erriez/ESP8266UbidotsSensors | a0580a5cde8b913d2c86700deb2734a7e9acfdf2 | 498d932aca5c0a4d9f3f2a701e60f22ee068669d | refs/heads/master | 2020-03-27T20:54:09.031544 | 2018-09-02T16:16:59 | 2018-09-02T16:16:59 | 147,101,170 | 0 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 2,263 | ino | /*
* MIT License
*
* Copyright (c) 2018 Erriez
*
* 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.
*/
/*!
* \brief BH1750 digital light sensor example for Arduino.
* \details
* Source: https://github.com/Erriez/ErriezBH1750
* Documentation: https://erriez.github.io/ErriezBH1750
*/
#include <Wire.h>
#include <ErriezBH1750.h>
// ADDR line LOW/open: I2C address 0x23 (0x46 including R/W bit) [default]
// ADDR line HIGH: I2C address 0x5C (0xB8 including R/W bit)
BH1750 sensor(LOW);
void setup()
{
Serial.begin(115200);
while (!Serial) {
;
}
Serial.println(F("BH1750 one-time measurement basic example"));
// Initialize I2C bus
Wire.begin();
// Initialize sensor in one-time mode, medium 1 lx resolution
sensor.begin(ModeOneTime, ResolutionMid);
}
void loop()
{
uint16_t lux;
// Start conversion
sensor.startConversion();
// Wait synchronous for completion (blocking)
if (sensor.waitForCompletion()) {
// Read light
lux = sensor.read();
// Print light
Serial.print(F("Light: "));
Serial.print(lux);
Serial.println(F(" LUX"));
} else {
Serial.println(F("Light: -"));
}
}
| [
"Erriez@users.noreply.github.com"
] | Erriez@users.noreply.github.com |
36352d746e42f9e1acbdae1f2ee50ca87e234ad1 | 34fab4f3be12eeac03955209f8986274739c5835 | /Root/LightweightGraph.cxx | 4be131113b0fe700381706abc13afe1a1b41a465 | [] | no_license | jwsmithers/ttgamma_lwtnn_injection | 786a01215140c9da2f8775a4b7ce18ddb78066d3 | e2a0cf4f82406071476af662e273e5e0585ce987 | refs/heads/master | 2020-12-30T11:51:22.993170 | 2018-03-27T12:55:52 | 2018-03-27T12:55:52 | 91,527,431 | 0 | 2 | null | 2018-03-27T10:16:47 | 2017-05-17T03:00:28 | C++ | UTF-8 | C++ | false | false | 4,138 | cxx | #include "lwtnn/LightweightGraph.hh"
#include "lwtnn/InputPreprocessor.hh"
#include "lwtnn/Graph.hh"
#include <Eigen/Dense>
namespace {
using namespace Eigen;
using namespace lwt;
// utility functions
typedef LightweightGraph::NodeMap NodeMap;
typedef InputPreprocessor IP;
typedef std::vector<std::pair<std::string, IP*> > Preprocs;
std::vector<VectorXd> get_input_vectors(const NodeMap& nodes,
const Preprocs& preprocs) {
std::vector<VectorXd> input_vectors;
for (const auto& proc: preprocs) {
if (!nodes.count(proc.first)) {
throw NNEvaluationException("Can't find node " + proc.first);
}
const auto& preproc = *proc.second;
input_vectors.emplace_back(preproc(nodes.at(proc.first)));
}
return input_vectors;
}
typedef LightweightGraph::SeqNodeMap SeqNodeMap;
typedef InputVectorPreprocessor IVP;
typedef std::vector<std::pair<std::string, IVP*> > VecPreprocs;
std::vector<MatrixXd> get_input_seq(const SeqNodeMap& nodes,
const VecPreprocs& preprocs) {
std::vector<MatrixXd> input_mats;
for (const auto& proc: preprocs) {
if (!nodes.count(proc.first)) {
throw NNEvaluationException("Can't find node " + proc.first);
}
const auto& preproc = *proc.second;
input_mats.emplace_back(preproc(nodes.at(proc.first)));
}
return input_mats;
}
}
namespace lwt {
// ______________________________________________________________________
// Lightweight Graph
typedef LightweightGraph::NodeMap NodeMap;
LightweightGraph::LightweightGraph(const GraphConfig& config,
std::string default_output):
m_graph(new Graph(config.nodes, config.layers))
{
for (const auto& node: config.inputs) {
m_preprocs.emplace_back(
node.name, new InputPreprocessor(node.variables));
}
for (const auto& node: config.input_sequences) {
m_vec_preprocs.emplace_back(
node.name, new InputVectorPreprocessor(node.variables));
}
size_t output_n = 0;
for (const auto& node: config.outputs) {
m_outputs.emplace_back(node.second.node_index, node.second.labels);
m_output_indices.emplace(node.first, output_n);
output_n++;
}
if (default_output.size() > 0) {
if (!m_output_indices.count(default_output)) {
throw NNConfigurationException("no output node" + default_output);
}
m_default_output = m_output_indices.at(default_output);
} else if (output_n == 1) {
m_default_output = 0;
} else {
throw NNConfigurationException("you must specify a default output");
}
}
LightweightGraph::~LightweightGraph() {
delete m_graph;
for (auto& preproc: m_preprocs) {
delete preproc.second;
preproc.second = 0;
}
for (auto& preproc: m_vec_preprocs) {
delete preproc.second;
preproc.second = 0;
}
}
ValueMap LightweightGraph::compute(const NodeMap& nodes,
const SeqNodeMap& seq) const {
return compute(nodes, seq, m_default_output);
}
ValueMap LightweightGraph::compute(const NodeMap& nodes,
const SeqNodeMap& seq,
const std::string& output) const {
if (!m_output_indices.count(output)) {
throw NNEvaluationException("no output node " + output);
}
return compute(nodes, seq, m_output_indices.at(output));
}
ValueMap LightweightGraph::compute(const NodeMap& nodes,
const SeqNodeMap& seq,
size_t idx) const {
VectorSource source(get_input_vectors(nodes, m_preprocs),
get_input_seq(seq, m_vec_preprocs));
VectorXd result = m_graph->compute(source, m_outputs.at(idx).first);
const std::vector<std::string>& labels = m_outputs.at(idx).second;
std::map<std::string, double> output;
for (size_t iii = 0; iii < labels.size(); iii++) {
output[labels.at(iii)] = result(iii);
}
return output;
}
}
| [
"joshua.wyatt.smith@cern.ch"
] | joshua.wyatt.smith@cern.ch |
44f3f5ef4276cf957052d3a701ef87a1cdd19a2a | ead3d2b70465ba2ca4b8c271c91ec91edfabeec6 | /api/data/departure.h | ddc9232d01535fb52211567024d58fe8c0b6cd11 | [] | no_license | iRail/libqtrail | 8badc845efe7566b7e68fb2f86cf218c809788d3 | 0f795317c279959794542b9eae9743742dc5b70c | refs/heads/master | 2021-01-25T12:01:42.627206 | 2011-06-30T12:20:40 | 2011-06-30T12:20:40 | 1,627,224 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,600 | h | //
// Configuration
//
// Include guard
#ifndef DEPARTURE_H
#define DEPARTURE_H
// Includes
#include <QObject>
#include <QMetaType>
#include <QString>
#include <QVariant>
#include "stop.h"
#include "vehicle.h"
namespace iRail
{
class Departure : public QObject
{
Q_OBJECT
Q_PROPERTY(uint delay READ delay WRITE setDelay)
public:
// Auxiliary structure
struct Id
{
Stop const* origin;
Vehicle const* vehicle;
// Operators
friend inline unsigned int qHash(const Departure::Id& iDepartureId);
friend bool operator==(const Departure::Id& lhs, const Departure::Id& rhs);
};
enum Roles
{
VehicleRole = Qt::UserRole+1,
OriginRole,
DelayRole
};
// Construction and destruction
Departure(Id iId);
// Basic I/O
QVariant field(int iRole) const;
Id const* id() const;
unsigned int delay() const;
void setDelay(unsigned int iDelay);
// Operators
friend bool operator==(const Departure& lhs, const Departure& rhs);
Departure& operator=(const Departure& other);
private:
Id mId;
unsigned int mDelay;
};
bool operator==(const Departure& lhs, const Departure& rhs);
inline unsigned int qHash(const Departure::Id& iDepartureId)
{
return qHash(*iDepartureId.origin->id()) ^ qHash(*iDepartureId.vehicle->id());
}
bool operator==(const Departure::Id& lhs, const Departure::Id& rhs);
}
#endif // DEPARTURE_H
| [
"tim.besard@gmail.com"
] | tim.besard@gmail.com |
c0adcca1682c4d5b4e54d57b40196b276001b1e7 | 903565480db35abdd7755a7dc499edb940f228fa | /Colour.h | 253385a83330e9760a6a95f21825ded8186a5b26 | [
"MIT"
] | permissive | yxw027/gnssview | 158b269f61d347f9140150463c85948f3682a81e | 6cbfaf6a8b5bc592588b1d3b441fd3eab490da0c | refs/heads/master | 2021-01-07T02:13:32.944997 | 2016-06-13T08:03:09 | 2016-06-13T08:03:09 | 241,549,765 | 1 | 0 | NOASSERTION | 2020-02-19T06:31:06 | 2020-02-19T06:31:06 | null | UTF-8 | C++ | false | false | 1,559 | h | //
// gnssview - a program for displaying GNSS satellite paths
//
// The MIT License (MIT)
//
// Copyright (c) 2014 Michael J. Wouters
//
// 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 __COLOUR_H_
#define __COLOUR_H_
class Colour
{
public:
enum Space { RGB,XYZ,HSV,xyY };
Colour(Colour *);
Colour(float cx=0.0,float cy=0.0,float cz=0.0,int spc=RGB);
Colour asRGB();
Colour asXYZ();
Colour asHSV();
Colour asxyY();
Colour gammaCorrect(float);
float x,y,z;
int space;
};
#endif
| [
"groundstate@users.noreply.github.com"
] | groundstate@users.noreply.github.com |
aa57e61c5dad26f8e18b1394a608d16773ff74d0 | 5fe1a08be4a62ff19d5d61e4716742d4fb292297 | /binaryPrefixDivisibleBy5.cpp | 04751f68776be369c0511fa0a02f305070afd2ef | [] | no_license | songclei/leetcode | 85e92e1e6b456fcf686812942eb14bd393459987 | 6d33f9ee2d67408c2cff11c550ccef7f58c76369 | refs/heads/master | 2020-05-02T14:34:17.406765 | 2019-08-24T09:39:20 | 2019-08-24T09:39:20 | 178,014,665 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 398 | cpp | class Solution {
public:
vector<bool> prefixesDivBy5(vector<int>& A) {
int n = A.size();
vector<bool> ret(n);
int cur = 0;
for (int i = 0; i < n; ++i) {
cur = (cur * 2 + A[i]) % 10;
if (cur % 5 == 0) {
ret[i] = true;
} else {
ret[i] = false;
}
}
return ret;
}
}; | [
"songchenlei@bytedance.com"
] | songchenlei@bytedance.com |
1847d9a2b08f9d0623d4658fb241879eb419672a | ba3d7ea31d9fc1dddfe34074f7d87ff0d8377930 | /openglannotationwindow.cpp | 670c743f3a0c2e9040d3948492044fffc108d7c2 | [] | no_license | Eremeos/AFMA | 5f1b6b8139bf9f31627a889de449070a8e30e034 | dac8f9c9b5347be9d1aae749512dd3288e0b91b0 | refs/heads/master | 2021-01-23T14:05:46.091167 | 2016-11-14T11:12:39 | 2016-11-14T11:12:39 | 59,669,111 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,007 | cpp |
#include "openglannotationwindow.h"
#include <QOpenGLWidget>
#include <QOpenGLVertexArrayObject>
#include <iostream>
#include <glm/glm.hpp>
#include <stdio.h>
#include <fstream>
#include <QMouseEvent>
#include <QOpenGLBuffer>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <QOpenGLTexture>
//Fenster für die Annotation des Referenzbildes
OpenGLAnnotationWindow::OpenGLAnnotationWindow(QWidget *parent) : QOpenGLWidget(parent)
{
}
//Erzeugung eines Annotationspunktes bei Mausklick auf das Bild
void OpenGLAnnotationWindow::mousePressEvent(QMouseEvent *e)
{
if(vec_vertices.size() < ogl->model.vec_vertices.size())
{
QPointF pt = this->mapFromGlobal(QCursor::pos());
int width = this->width();
int height = this->height();
vec_vertices.push_back(glm::vec3((pt.x()/width*2)-1, (pt.y()/height*(-2))+1, ogl->model.vec_vertices[vec_vertices.size()].z));
update();
ogl->next();
for(int i = 0; i < ogl->model.vec_doubled_points.size(); ++i)
{
if(ogl->count == ogl->model.vec_doubled_points[i].x)
{
vec_vertices.push_back(vec_vertices[ogl->model.vec_doubled_points[i].y]);
ogl->next();
std::cout << ogl->count<< endl;
}
}
}
}
//Initialisierung der GL-Funktionen
void OpenGLAnnotationWindow::initializeGL()
{
initializeOpenGLFunctions();
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable( GL_BLEND );
glClearColor(0.0,0.0,0.0,1.0);
//glEnable(GL_DEPTH_TEST);
glPointSize(4);
glIsEnabled(true);
// programID = LoadShaders( "..\\AFMA\\vertexshader.vert", "..\\AFMA\\fragmentshader.frag" );
// glUseProgram(programID);
/* m_shader.addShaderFromSourceFile(QOpenGLShader::Vertex, "..\\AFMA\\annotationvertexshader.vert");
m_shader.addShaderFromSourceFile(QOpenGLShader::Fragment, "..\\AFMA\\annotationfragmentshader.frag");
m_shader.link();
m_shader.bind(); */
background_VAO.create();
background_VAO.bind();
background.push_back(glm::vec3(-1.0f, 1.0f, 0.0f));
background.push_back(glm::vec3(-1.0f, -1.0f, 0.0f));
background.push_back(glm::vec3(1.0f, -1.0f, 0.0f));
background.push_back(glm::vec3(1.0f, 1.0f, 0.0f));
tex.push_back(glm::vec2(-1.0f, 1.0f));
tex.push_back(glm::vec2(-1.0f, -1.0f));
tex.push_back(glm::vec2(1.0f, -1.0f));
tex.push_back(glm::vec2(1.0f, 1.0f));
// Generate 1 buffer, put the resulting identifier in vertexbuffer
VBO.create();
// The following commands will talk about our 'vertexbuffer' buffer
VBO.bind();
VBO2.create();
VBO2.bind();
}
//Zeichnet das Referenzbild und die Annotationspunkte
void OpenGLAnnotationWindow::paintGL()
{
if(filepath != NULL)
{
// Load cube.png image
QOpenGLTexture * texture = new QOpenGLTexture(textureImage.mirrored());
// Set nearest filtering mode for texture minification
texture->setMinificationFilter(QOpenGLTexture::Nearest);
// Set bilinear filtering mode for texture magnification
texture->setMagnificationFilter(QOpenGLTexture::Linear);
// Wrap texture coordinates by repeating
// f.ex. texture coordinate (1.1, 1.2) is same as (0.1, 0.2)
texture->setWrapMode(QOpenGLTexture::Repeat);
texture->bind();
// Give our vertices to OpenGL.
glEnable(GL_TEXTURE_2D);
VBO.allocate(background.data(), sizeof(glm::vec3)*background.size());
VBO.bind();
/* m_shader.enableAttributeArray(0);
m_shader.setAttributeBuffer( 0, GL_FLOAT, 0, 3 );
m_shader.enableAttributeArray(1);
m_shader.setAttributeBuffer(1, GL_FLOAT, 0, 2);
*/
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPolygonMode(GL_FRONT,GL_QUADS);
// glDrawArrays(GL_QUADS, 0, background.size());
texture->bind();
glBegin(GL_QUADS);
// Front Face
glTexCoord2f(0.0f, 0.0f); glVertex2f(-1.0f, -1.0f); // Bottom Left Of The Texture and Quad
glTexCoord2f(1.0f, 0.0f); glVertex2f( 1.0f, -1.0f); // Bottom Right Of The Texture and Quad
glTexCoord2f(1.0f, 1.0f); glVertex2f( 1.0f, 1.0f); // Top Right Of The Texture and Quad
glTexCoord2f(0.0f, 1.0f); glVertex2f(-1.0f, 1.0f); // Top Left Of The Texture and Quad
glEnd();
glDisable(GL_TEXTURE_2D);
if(vec_vertices.size() > 0)
{
// VBO2.allocate(vec_vertices.data(), sizeof(glm::vec3)*vec_vertices.size());
// glDrawArrays(GL_POINTS, 0, vec_vertices.size());
glBegin(GL_POINTS);
for(unsigned int i = 0; i < vec_vertices.size();++i)
{
glColor3f(1,0,0);
glVertex3f(vec_vertices[i].x,vec_vertices[i].y,vec_vertices[i].z);
glColor4f(1,1,1,1);
}
glEnd();
}
ogl->draw();
}
}
//Anpassung des Widgets an der Bildschirmauflösung
void OpenGLAnnotationWindow::resizeGL(int w, int h)
{
glViewport(0, 0, w, h);
}
| [
"matthias.bergler@gmx.de"
] | matthias.bergler@gmx.de |
9cee6a5555167d233beef1d8d2fc259b76e296c9 | 6e9b20902f4e232d12e865f192ea5128ae253ba7 | /Fluid/5.4/meshPhi | 41796e00c895392a51de8e9fa4206c2b5153866f | [] | no_license | abarcaortega/FSI_3 | 1de5ed06ca7731016e5136820aecdc0a74042723 | 016638757f56e7b8b33af4a1af8e0635b88ffbbc | refs/heads/master | 2020-08-03T22:28:04.707884 | 2019-09-30T16:33:31 | 2019-09-30T16:33:31 | 211,905,379 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,351 | /*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class surfaceScalarField;
location "5.4";
object meshPhi;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 3 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type calculated;
value uniform 0;
}
outlet
{
type calculated;
value uniform 0;
}
flap
{
type calculated;
value uniform 0;
}
upperWall
{
type calculated;
value uniform 0;
}
lowerWall
{
type calculated;
value uniform 0;
}
frontAndBack
{
type empty;
value nonuniform 0();
}
}
// ************************************************************************* //
| [
"aldo.abarca.ortega@gmail.com"
] | aldo.abarca.ortega@gmail.com | |
3b2c52244706456953c0a9fe02c1fb23891645f7 | bd1fea86d862456a2ec9f56d57f8948456d55ee6 | /000/116/625/CWE762_Mismatched_Memory_Management_Routines__strdup_delete_wchar_t_15.cpp | b38ce309d5bb204061683b8e85e8a0307218e25e | [] | no_license | CU-0xff/juliet-cpp | d62b8485104d8a9160f29213368324c946f38274 | d8586a217bc94cbcfeeec5d39b12d02e9c6045a2 | refs/heads/master | 2021-03-07T15:44:19.446957 | 2020-03-10T12:45:40 | 2020-03-10T12:45:40 | 246,275,244 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 5,957 | cpp | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE762_Mismatched_Memory_Management_Routines__strdup_delete_wchar_t_15.cpp
Label Definition File: CWE762_Mismatched_Memory_Management_Routines__strdup_delete.label.xml
Template File: sources-sinks-15.tmpl.cpp
*/
/*
* @description
* CWE: 762 Mismatched Memory Management Routines
* BadSource: Allocate data using wcsdup()
* GoodSource: Allocate data using new
* Sinks:
* GoodSink: Deallocate data using free()
* BadSink : Deallocate data using delete
* Flow Variant: 15 Control flow: switch(6) and switch(7)
* */
#include "std_testcase.h"
#include <wchar.h>
namespace CWE762_Mismatched_Memory_Management_Routines__strdup_delete_wchar_t_15
{
#ifndef OMITBAD
void bad()
{
wchar_t * data;
/* Initialize data*/
data = NULL;
switch(6)
{
case 6:
{
wchar_t myString[] = L"myString";
/* POTENTIAL FLAW: Allocate memory from the heap using a function that requires free() for deallocation */
data = wcsdup(myString);
}
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
switch(7)
{
case 7:
/* POTENTIAL FLAW: Deallocate memory using delete - the source memory allocation function may
* require a call to free() to deallocate the memory */
delete data;
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodB2G1() - use badsource and goodsink by changing the second switch to switch(8) */
static void goodB2G1()
{
wchar_t * data;
/* Initialize data*/
data = NULL;
switch(6)
{
case 6:
{
wchar_t myString[] = L"myString";
/* POTENTIAL FLAW: Allocate memory from the heap using a function that requires free() for deallocation */
data = wcsdup(myString);
}
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
switch(8)
{
case 7:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
default:
/* FIX: Deallocate the memory using free() */
free(data);
break;
}
}
/* goodB2G2() - use badsource and goodsink by reversing the blocks in the second switch */
static void goodB2G2()
{
wchar_t * data;
/* Initialize data*/
data = NULL;
switch(6)
{
case 6:
{
wchar_t myString[] = L"myString";
/* POTENTIAL FLAW: Allocate memory from the heap using a function that requires free() for deallocation */
data = wcsdup(myString);
}
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
switch(7)
{
case 7:
/* FIX: Deallocate the memory using free() */
free(data);
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
}
/* goodG2B1() - use goodsource and badsink by changing the first switch to switch(5) */
static void goodG2B1()
{
wchar_t * data;
/* Initialize data*/
data = NULL;
switch(5)
{
case 6:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
default:
/* FIX: Allocate memory from the heap using new */
data = new wchar_t;
break;
}
switch(7)
{
case 7:
/* POTENTIAL FLAW: Deallocate memory using delete - the source memory allocation function may
* require a call to free() to deallocate the memory */
delete data;
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
}
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the first switch */
static void goodG2B2()
{
wchar_t * data;
/* Initialize data*/
data = NULL;
switch(6)
{
case 6:
/* FIX: Allocate memory from the heap using new */
data = new wchar_t;
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
switch(7)
{
case 7:
/* POTENTIAL FLAW: Deallocate memory using delete - the source memory allocation function may
* require a call to free() to deallocate the memory */
delete data;
break;
default:
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
break;
}
}
void good()
{
goodB2G1();
goodB2G2();
goodG2B1();
goodG2B2();
}
#endif /* OMITGOOD */
} /* close namespace */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
using namespace CWE762_Mismatched_Memory_Management_Routines__strdup_delete_wchar_t_15; /* so that we can use good and bad easily */
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
| [
"frank@fischer.com.mt"
] | frank@fischer.com.mt |
b9ffde55b68ea9fe38ba74b1a0efdbbce12d3d90 | 33a14cc76b7cc6e63df29a71b961888da620ca72 | /inst/enumpart/BigInteger.hpp | 3b7fce3f627a3168bdc716bfdd89b0823a18c7df | [] | no_license | cran/redist | 36150746a95124666f2f895244027c7fc01605e2 | c3e8756fef4b13970904825f464369c793327aff | refs/heads/master | 2023-04-06T07:35:15.973690 | 2023-04-03T09:50:02 | 2023-04-03T09:50:02 | 35,801,284 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 16,358 | hpp | /*
* BigInteger.hpp
*
* Copyright (c) 2012 -- 2019 Jun Kawahara
*/
#ifndef BIGINTEGER_HPP
#define BIGINTEGER_HPP
#include <iostream>
#include <vector>
#include <string>
#include <climits>
#include <cstdlib>
#include <sstream>
#include <stdexcept>
#include <fstream>
#include <sstream>
class BigDecimal {
private:
std::vector<int> place_list_;
public:
BigDecimal()
{
place_list_.resize(1);
place_list_[0] = 0;
}
BigDecimal& operator=(unsigned long long int integer)
{
place_list_.clear();
while (integer > 0) {
place_list_.push_back(integer % 10);
integer /= 10;
}
return *this;
}
BigDecimal& operator+=(const BigDecimal& integer)
{
if (place_list_.size() < integer.place_list_.size()) {
place_list_.resize(integer.place_list_.size());
}
unsigned long long int c = 0;
for (unsigned int i = 0; i < place_list_.size(); ++i) {
unsigned long long int q1 = place_list_[i];
unsigned long long int q2 = (i < integer.place_list_.size() ? integer.place_list_[i] : 0);
place_list_[i] = (q1 + q2 + c) % 10;
c = (q1 + q2 + c) / 10;
}
if (c > 0) {
place_list_.push_back(c);
}
return *this;
}
std::string GetString() const
{
std::ostringstream oss;
for (int i = static_cast<int>(place_list_.size()) - 1; i >= 0; --i) {
oss << place_list_[i];
}
return oss.str();
}
};
namespace BigIntegerUtility {
// http://developer.cybozu.co.jp/takesako/2006/11/binary_hacks.html
int CountBits(unsigned long long int bit) {
bit = ((bit & 0xaaaaaaaaaaaaaaaaUL) >> 1)
+ (bit & 0x5555555555555555UL);
bit = ((bit & 0xccccccccccccccccUL) >> 2)
+ (bit & 0x3333333333333333UL);
bit = ((bit & 0xf0f0f0f0f0f0f0f0UL) >> 4)
+ (bit & 0x0f0f0f0f0f0f0f0fUL);
bit = ((bit & 0xff00ff00ff00ff00UL) >> 8)
+ (bit & 0x00ff00ff00ff00ffUL);
bit = ((bit & 0xffff0000ffff0000UL) >> 16)
+ (bit & 0x0000ffff0000ffffUL);
bit = ((bit & 0xffffffff00000000UL) >> 32)
+ (bit & 0x00000000ffffffffUL);
return bit;
}
// http://www.nminoru.jp/~nminoru/programming/bitcount.html
int GetNumberOfLeadingZero(unsigned long long int bit) {
bit |= (bit >> 1);
bit |= (bit >> 2);
bit |= (bit >> 4);
bit |= (bit >> 8);
bit |= (bit >> 16);
bit |= (bit >> 32);
return CountBits(~bit);
}
}
class BigInteger {
private:
std::vector<unsigned long long int> place_list_;
public:
BigInteger()
{
place_list_.resize(1);
place_list_[0] = 0;
}
BigInteger(unsigned long long int integer)
{
place_list_.resize(1);
place_list_[0] = integer;
}
BigInteger& operator=(unsigned long long int integer)
{
place_list_.resize(1);
place_list_[0] = integer;
return *this;
}
BigInteger& operator+=(const BigInteger& integer)
{
if (place_list_.size() < integer.place_list_.size()) {
place_list_.resize(integer.place_list_.size());
}
unsigned long long int c = 0;
for (unsigned int i = 0; i < place_list_.size(); ++i) {
unsigned long long int q1 = place_list_[i];
unsigned long long int q2 = (i < integer.place_list_.size() ? integer.place_list_[i] : 0);
place_list_[i] = static_cast<unsigned long long int>(q1 + q2 + c);
if (q1 > ULLONG_MAX - q2) { // check overflow (whether q1 + q2 is larger than 2^64 - 1)
c = 1;
} else if (c > ULLONG_MAX - (q1 + q2)) {
c = 1;
} else {
c = 0;
}
}
if (c > 0) {
place_list_.push_back(c);
}
return *this;
}
// If this < integer, throw exception
BigInteger& operator-=(const BigInteger& integer)
{
int large_digit1, large_digit2, small_digit1, small_digit2;
GetDigit(&large_digit1, &small_digit1);
integer.GetDigit(&large_digit2, &small_digit2);
if (IsSmaller(integer, large_digit1, small_digit1,
large_digit2, small_digit2)) {
throw std::range_error("integer1 must not be smaller than integer2!");
}
BigInteger bi = integer;
bi.place_list_.resize(large_digit1);
for (size_t i = 0; i < large_digit1; ++i) {
bi.place_list_[i] = ~bi.place_list_[i];
}
*this += bi;
*this += 1;
place_list_.resize(large_digit1);
return *this;
}
operator double() const
{
double d = 0.0;
for (int i = static_cast<int>(place_list_.size()) - 1; i >= 0; --i) {
d *= 18446744073709551616.0; // d *= 2^64
d += place_list_[i];
}
return d;
}
bool IsZero() const
{
for (size_t i = 0; i < place_list_.size(); ++i) {
if (place_list_[i] != 0) {
return false;
}
}
return true;
}
// Check whether "value" is equal to this integer.
// If this integer is larger than 2^64 - 1, always return false.
bool Equals(unsigned long long int value) const
{
// check if the upper digits are 0
for (size_t i = 1; i < place_list_.size(); ++i) {
if (place_list_[i] != 0) {
return false;
}
}
return place_list_[0] == value;
}
void GetDigit(int* large_digit, int* small_digit) const
{
int pos = static_cast<int>(place_list_.size()) - 1;
for (; pos >= 1; --pos) {
if (place_list_[pos] != 0) {
break;
}
}
*large_digit = pos + 1;
*small_digit = 64 - BigIntegerUtility::GetNumberOfLeadingZero(place_list_[pos]);
}
void Set(int place, unsigned long long int value)
{
if (place >= static_cast<int>(place_list_.size())) {
place_list_.resize(place + 1);
}
place_list_[place] = value;
}
std::string GetString() const
{
BigDecimal d;
for (int i = static_cast<int>(place_list_.size()) - 1; i >= 0; --i) {
for (int j = 0; j < 64; ++j) { // compute d * 2^64
BigDecimal d2 = d;
d += d2;
}
BigDecimal d3;
d3 = place_list_[i];
d += d3;
}
return d.GetString();
}
bool IsSmaller(const BigInteger& integer2,
int large_digit1, int small_digit1,
int large_digit2, int small_digit2) const
{
if (large_digit1 < large_digit2) {
return true;
} else if (large_digit1 > large_digit2) {
return false;
} else {
for (int i = large_digit1 - 1; i >= 0; --i) {
if (place_list_[i] < integer2.place_list_[i]) {
return true;
} else if (place_list_[i] > integer2.place_list_[i]) {
return false;
}
}
return false; // this == integer2
}
}
friend void TestBigInteger();
friend bool operator<(const BigInteger& integer1, const BigInteger& integer2);
};
inline std::ostream& operator<<(std::ostream& ost, const BigInteger& integer)
{
ost << integer.GetString();
return ost;
}
inline BigInteger operator+(const BigInteger& integer1, const BigInteger& integer2)
{
BigInteger integer3(integer1);
integer3 += integer2;
return integer3;
}
inline BigInteger operator-(const BigInteger& integer1, const BigInteger& integer2)
{
BigInteger integer3(integer1);
integer3 -= integer2;
return integer3;
}
inline bool operator<(const BigInteger& integer1, const BigInteger& integer2)
{
int large_digit1, large_digit2, small_digit1, small_digit2;
integer1.GetDigit(&large_digit1, &small_digit1);
integer2.GetDigit(&large_digit2, &small_digit2);
return integer1.IsSmaller(integer2, large_digit1, small_digit1,
large_digit2, small_digit2);
}
class BigIntegerRandom {
//extern "C" {
//#include "mt19937ar.h"
//}
private:
std::mt19937 engine_;
std::uniform_int_distribution<unsigned long long int> dis_;
public:
BigIntegerRandom()
{
std::random_device rd;
std::array<int, std::mt19937::state_size> seed_data;
std::generate_n(seed_data.data(), seed_data.size(), std::ref(rd));
std::seed_seq seq(std::begin(seed_data), std::end(seed_data));
engine_ = std::mt19937(seq);
dis_ = std::uniform_int_distribution<unsigned long long int>(0, 0xffffffffffffffffll);
}
//void MTInit(unsigned long int s)
//{
//init_genrand(s);
//}
//void MTInitByArray(unsigned long int init_key[], int key_length)
//{
// //init_by_array(init_key, key_length);
//}
unsigned long long int GenRandUInt64()
{
unsigned long long int x = dis_(engine_);
//std::cerr << x << std::endl;
return x;
//return ((static_cast<unsigned long long int>(genrand_int32()) << 32) |
// static_cast<unsigned long long int>(genrand_int32()));
}
// get rand between [0,r)
BigInteger GetRand(const BigInteger& r)
{
int large_digit;
int small_digit;
r.GetDigit(&large_digit, &small_digit);
assert(small_digit > 0);
//std::cout << "l" << large_digit << " " << small_digit << std::endl;
BigInteger ret(0);
do {
for (int i = 0; i < large_digit - 1; ++i) {
unsigned long long int x = GenRandUInt64();
ret.Set(i, x);
}
unsigned long long int y = GenRandUInt64();
if (small_digit < 64) {
y &= ((1ull << small_digit) - 1);
}
ret.Set(large_digit - 1, y);
} while (!(ret < r));
return ret;
}
};
#include <cassert>
void TestBigInteger()
{
BigInteger zero(0);
BigInteger one(1);
BigInteger bigint(100);
assert(zero.IsZero());
assert(!bigint.IsZero());
assert(bigint.GetString() == std::string("100"));
int large_digit, small_digit;
bigint.GetDigit(&large_digit, &small_digit);
assert(large_digit == 1);
assert(small_digit == 7);
bigint.Set(1, 123);
assert(bigint.GetString() == std::string("2268949521066274848868"));
bigint.GetDigit(&large_digit, &small_digit);
assert(large_digit == 2);
assert(small_digit == 7);
BigInteger bigint1(0xffffffffffffffffull);
BigInteger bigint2(0);
bigint2.Set(1, 1);
assert(bigint1.GetString() == std::string("18446744073709551615"));
assert(bigint2.GetString() == std::string("18446744073709551616"));
assert(bigint1 < bigint2);
assert(!(bigint2 < bigint1));
assert(zero < one);
assert(!(one < zero));
assert((BigInteger(9) - BigInteger(3)).GetString() == std::string("6"));
assert((bigint2 - bigint1).GetString() == std::string("1"));
BigInteger bigint3(0);
bigint3.Set(10, 1);
BigInteger bigint4(0);
bigint4.Set(5, 123);
bigint4.Set(4, 456);
assert((bigint3 - bigint4).GetString() == std::string("456244061762219521"
"86411716057002913248932285072485599305791925178992751672086773865059"
"12811317108673373224037633407018448137633626166156972838831343037636"
"957482329550887253504122441468437594112"));
//BigIntegerUtility::MTInit(12345678);
BigIntegerRandom random;
BigInteger hundred(100);
for (int i = 0; i < 1000; ++i) {
BigInteger c = random.GetRand(hundred);
//std::cerr << c << std::endl;
assert(!(c < zero));
assert(c < hundred);
}
for (int i = 0; i < 1000; ++i) {
BigInteger c = random.GetRand(bigint1);
//std::cerr << c << std::endl;
assert(!(c < zero));
assert(c < bigint1);
}
for (int i = 0; i < 1000; ++i) {
BigInteger c = random.GetRand(bigint2);
//std::cerr << c << std::endl;
assert(!(c < zero));
assert(c < bigint2);
}
std::cerr << "pass!" << std::endl;
}
/*
void TestBigInteger2() {
for (int i = 0; i < 100; ++i) {
std::cout << i << "\t" << BigIntegerUtility::CountBits(i) << "\t"
<< BigIntegerUtility::GetNumberOfLeadingZero(i) << "\n";
}
std::cout.flush();
unsigned long long int c = 0xffffffffffffffffull;
std::cout << c << "\t" << BigIntegerUtility::CountBits(c) << "\t"
<< BigIntegerUtility::GetNumberOfLeadingZero(c) << "\n";
--c;
std::cout << c << "\t" << BigIntegerUtility::CountBits(c) << "\t"
<< BigIntegerUtility::GetNumberOfLeadingZero(c) << "\n";
c = 0x7fffffffffffffffull;
std::cout << c << "\t" << BigIntegerUtility::CountBits(c) << "\t"
<< BigIntegerUtility::GetNumberOfLeadingZero(c) << "\n";
BigInteger bi(0);
int large_digit;
int small_digit;
bi.GetDigit(&large_digit, &small_digit);
std::cout << bi << "\t" << large_digit << "\t" << small_digit << "\n";
bi += 1;
bi.GetDigit(&large_digit, &small_digit);
std::cout << bi << "\t" << large_digit << "\t" << small_digit << "\n";
bi += 1;
bi.GetDigit(&large_digit, &small_digit);
std::cout << bi << "\t" << large_digit << "\t" << small_digit << "\n";
bi = BigInteger(0xffffffffffffffffull);
bi.GetDigit(&large_digit, &small_digit);
std::cout << bi << "\t" << large_digit << "\t" << small_digit << "\n";
bi.Set(0, 0);
bi.Set(1, 1);
bi.GetDigit(&large_digit, &small_digit);
std::cout << bi << "\t" << large_digit << "\t" << small_digit << "\n";
bi += 1;
bi.GetDigit(&large_digit, &small_digit);
std::cout << bi << "\t" << large_digit << "\t" << small_digit << "\n";
BigInteger bi10;
bi10.Set(10, 1);
for (int i = 0; i < 20; ++i) {
std::cout << BigIntegerUtility::GetRand(bi10).GetString() << "\n";
}
std::cout << RAND_MAX << std::endl;
}
void TestBigInteger3()
{
std::ifstream ifs("bigintegerdata.txt");
if (!ifs) {
std::cerr << "file bigintegerdata.txt cannot be opened" << std::endl;
exit(1);
}
std::vector<BigInteger> bi_vec;
for (int i = 0; i < 1000; ++i) {
std::string bignum;
std::string str;
std::getline(ifs, bignum);
//std::cout << bignum << std::endl;;
std::getline(ifs, str);
int n = atoi(str.c_str());
BigInteger bi;
for (int j = 0; j < n; ++j) {
std::getline(ifs, str);
std::istringstream iss(str);
unsigned long long int c;
iss >> c;
bi.Set(j, c);
}
if (bi.GetString() != bignum) {
std::cout << bi.GetString() << std::endl;
std::cout << bignum << std::endl;
}
assert(bi.GetString() == bignum);
bi_vec.push_back(bi);
//std::cout << "i = " << i << " OK" << std::endl;
}
BigInteger sum;
for (int i = 0; i < 1000; ++i) {
sum += bi_vec[i];
std::string bnum;
std::getline(ifs, bnum);
assert(sum.GetString() == bnum);
}
for (int i = 0; i < 1000; ++i) {
sum -= bi_vec[i];
std::string bnum;
std::getline(ifs, bnum);
assert(sum.GetString() == bnum);
}
std::string bstr;
std::getline(ifs, bstr);
for (int i = 0; i < 1000 - 1; ++i) {
if (bi_vec[i] < bi_vec[i + 1]) {
assert(bstr[i] == 't');
} else {
assert(bstr[i] == 'f');
}
}
}
*/
#endif // BIGINTEGER_HPP
| [
"csardi.gabor+cran@gmail.com"
] | csardi.gabor+cran@gmail.com |
0103b80e5d689cfb7d7200e7306954871e265c3d | 377a59b189eeb9efe3d8d73a9d144dbbcb72978d | /falcon/c++/initialize.hpp | e73a7b177b84c48a6ebde6f5cadeacec91e42916 | [] | no_license | BGCX067/falcon-library-git | 89c92c424436c05c5605d926e588b1e512e8279c | a5ec72f885346d91801fcda1d2a36a901a35145d | refs/heads/master | 2021-01-13T00:56:29.589188 | 2013-09-05T20:57:42 | 2013-09-05T20:57:42 | 48,870,693 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 300 | hpp | #ifndef FALCON_CPP_INITIALIZE_HPP
#define FALCON_CPP_INITIALIZE_HPP
#include <falcon/config.hpp>
#if defined(IN_IDE_PARSER)
# define CPP_INITIALIZE(args...) (args)
#elif __cplusplus < 201103L
# define CPP_INITIALIZE(...) (__VA_ARGS__)
#else
# define CPP_INITIALIZE(...) {__VA_ARGS__}
#endif
#endif | [
"jonathan.poelen@gmail.com"
] | jonathan.poelen@gmail.com |
7848790f7fddb003a82ab5856eee7f9d4388151a | 6e076309c0837160ed21f100782e7358df71109a | /jni/utils/easing.h | ea050884034b062792b08919bbaec10d71b92fec | [] | no_license | banketree/Magicamera | f2cf632eb5480c3a4c405ccde92bc74b4d4af0d4 | d98436b18121896ac0a9eed04c628654cbdc52ec | refs/heads/master | 2021-01-24T22:52:26.078250 | 2013-08-17T22:08:40 | 2013-08-17T22:08:40 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,303 | h | #ifndef _easing_h_
#define _easing_h_
#define _USE_MATH_DEFINES
class CEasing
{
public:
bool AutoFree;
virtual ~CEasing(){};
//! time a value between 0 and 1
//! For example:
//! * 0 means that the action just started
//! * 0.5 means that the action is in the middle
//! * 1 means that the action is over
virtual float update(double t) = 0;
};
class CEaseOutCubic :public CEasing
{
public:
virtual float update( double t );
};
class CEaseInCubic : public CEasing{
public:
virtual float update( double t );
};
class CEaseShake :public CEasing{
int m_round;
public:
CEaseShake(int round = 6);
virtual float update( double t );
};
class CEaseInOutCirc :public CEasing{
public:
virtual float update( double t );
};
class CEaseOutBounce:public CEasing{
float m_amplitude;
public:
CEaseOutBounce(double amplitude = 1.0);
virtual float update( double t );
};
class CEaseOutQuart :public CEasing
{
public:
virtual float update( double t );
};
class CEaseInQuart : public CEasing{
public:
virtual float update( double t );
};
inline float easeShake(double t, int round = 6);
static float easeOutBounce_helper(double t, double c, double a);
#endif // _easing_h_
| [
"devnull@localhost"
] | devnull@localhost |
d860c7cbd960fbcd9285866c1090daa9620925c3 | 533f244419fa5b9416bb5e7c567d76f400048ec9 | /Src/testio.cpp | 157fb70ab2470fc6943ae4eff954f6cf07f0654d | [] | no_license | etienneSG/Metaheuristic_GRASP | d83f5f9fd078afc5710eb593f7ac0796ffd6cf2d | 9b836c53748dc6631179317de0e0474a118df4a5 | refs/heads/master | 2021-01-21T13:56:37.950038 | 2014-11-05T20:00:47 | 2014-11-05T20:00:47 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,562 | cpp | #include "testio.h"
#include <fstream>
#include <iostream>
#include <string.h>
#include <string>
#include <assert.h>
Testio::Testio():
_NbClients(0),
_NbFactories(0),
_aImplantationCost(0),
_ClientFactoryDistance()
{
}
Testio::~Testio()
{
if (_aImplantationCost)
delete [] _aImplantationCost; _aImplantationCost=0;
}
Testio::Testio(std::string iFile):
_NbClients(0),
_NbFactories(0),
_aImplantationCost(0),
_ClientFactoryDistance()
{
std::ifstream fichier(iFile.c_str(), std::ios::in); // Openning file
if(fichier)
{
fichier >> _NbFactories >> _NbClients;
// Creation of the array of implantation costs
if (_NbFactories) {
_aImplantationCost = new double[_NbFactories];
memset(_aImplantationCost, 0, _NbFactories*sizeof(double));
}
// Creation of the array of distance costs
_ClientFactoryDistance.Resize(_NbClients, _NbFactories);
// Filling implantation costs
int i;
for (i = 0; i < _NbFactories; i++)
{
double capacity, cost;
fichier >> capacity >> cost;
_aImplantationCost[i]=cost;
}
// Filling distance between clients and factories
for (i = 0; i < _NbClients; i++)
{
double demand, distance;
fichier >> demand;
int j;
for (j = 0; j < _NbFactories; j++)
{
fichier >> distance;
_ClientFactoryDistance(i,j) = distance;
}
}
fichier.close(); // Closing file
}
else
{
std::cout << "Impossible d'ouvrir le fichier !" << std::endl;
assert(false);
}
}
| [
"etiennegaillard@gmail.com"
] | etiennegaillard@gmail.com |
170760ef15160c4e738d7ed684c3531178fd544d | b23e02c50ee5cabfe82267f57daea3c06a85055a | /Infrared-Spec1/Infrared-Spec1.ino | e1aa5391929a42a0715cd85c8643a6f89b17380d | [] | no_license | vipkas/Vipkas-SLF-2019 | 18f3497cafacd717cfda33acedd028ab462fb619 | 1e0bf4e46844fcd0c541d8e2ac6af42acba9c23c | refs/heads/master | 2020-07-11T01:10:02.781782 | 2019-08-29T00:29:20 | 2019-08-29T00:29:20 | 204,415,952 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 549 | ino | #define BUZZER 6
#define SIGNAL_PIN A0
int distance = 0;
void setup() {
Serial.begin(9600);
pinMode(BUZZER, OUTPUT);
pinMode(SIGNAL_PIN, INPUT);
}
void loop() {
int volt = map(analogRead(SIGNAL_PIN), 0, 1023, 0, 5000);
distance = (21.61 / (volt - 0.1696)) * 1000;
/*if(distance <= 20)
{
tone(BUZZER, 100);
delay(distance * 5);
noTone(BUZZER);
delay(distance * 5);
}
else
{
delay(500);
}*/
Serial.print(distance);
Serial.println(" cm");
delay(500);
}
| [
"noreply@github.com"
] | noreply@github.com |
9052b82ac03d236d866764d0d43b7f6b6fc0b62e | 204c5937cdea475f5c3dafde6d770a74ae9b8919 | /bzoj/2818(欧拉函数).cpp | d1900d2b50d327f3dfd59b66c28b0b8f6b73cc92 | [] | no_license | mlz000/Algorithms | ad2c35e4441bcbdad61203489888b83627024b7e | 495eb701d4ec6b317816786ad5b38681fbea1001 | refs/heads/master | 2023-01-04T03:50:02.673937 | 2023-01-02T22:46:20 | 2023-01-02T22:46:20 | 101,135,823 | 7 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 594 | cpp | #include<iostream>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=1e7+5;
int n,tot,p[N];
long long f[N];
bool check[N];
void init(){
for(int i=2;i<=n;++i){
if(!check[i]) p[++tot]=i,f[i]=i-1;
for(int j=1;j<=tot;++j){
if(i*p[j]>n) break;
check[i*p[j]]=true;
if(i%p[j]==0){
f[i*p[j]]=f[i]*p[j];
break;
}
else f[i*p[j]]=f[i]*(p[j]-1);
}
}
for(int i=3;i<=n;++i) f[i]+=f[i-1];
}
int main(){
cin>>n;
init();
long long ans=0ll;
for(int i=1;i<=tot;++i) ans+=(f[n/p[i]]<<1)+1;
cout<<ans<<endl;
return 0;
}
| [
"njumlz@gmail.com"
] | njumlz@gmail.com |
77b1bffb1d4c1dead383c6812bda8b4f9a1b625d | 5ff0a8b467ee4c9bb144ef877fc3e4ee9e2a26bc | /Midterm/Mario64KicksAss_MP/SirVive.h | b49a1228386c5d66d3da61286d34380743b8ca36 | [] | no_license | esheeder/441-Computer-Graphics | 60750cf473053133758d510f0a60233fdb40ec5b | 3495f7d45643847ba728f15e488e5f54caf99455 | refs/heads/master | 2016-08-11T07:09:01.995558 | 2016-01-06T05:17:59 | 2016-01-06T05:17:59 | 49,113,180 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 261 | h | #pragma once
#include "Hero.h"
class SirVive : public Hero {
public:
SirVive(std::shared_ptr<Point> location, float spinAngle2, float theta2, float xAngle2, float zAngle2);
void drawHero();
void drawBody();
void drawWheelL();
void drawWheelR();
};
| [
"esheeder@CTB60-08.adit.mines.edu"
] | esheeder@CTB60-08.adit.mines.edu |
2181790c96ec7d5e693732b63ba040d9e610d382 | 785df77400157c058a934069298568e47950e40b | /TnbMesh/TnbLib/Base/Region/Plane/Mesh_RegionPlane.hxx | baf10fbdb026d412b937e5a60407981fe9dc2f86 | [] | no_license | amir5200fx/Tonb | cb108de09bf59c5c7e139435e0be008a888d99d5 | ed679923dc4b2e69b12ffe621fc5a6c8e3652465 | refs/heads/master | 2023-08-31T08:59:00.366903 | 2023-08-31T07:42:24 | 2023-08-31T07:42:24 | 230,028,961 | 9 | 3 | null | 2023-07-20T16:53:31 | 2019-12-25T02:29:32 | C++ | UTF-8 | C++ | false | false | 3,134 | hxx | #pragma once
#ifndef _Mesh_RegionPlane_Header
#define _Mesh_RegionPlane_Header
#include <Global_Indexed.hxx>
#include <Global_Named.hxx>
#include <OFstream.hxx>
#include <TnbError.hxx>
#include <Mesh_RegionPlaneTraits.hxx>
#include <memory>
#include <vector>
namespace tnbLib
{
// Forward Declarations
template<class CurveType, class SizeFun, class MetricFun>
class Mesh_PlnCurve;
template<class PlnCurve>
class Mesh_PlnWire;
template<class CurveType, class SizeFun, class MetricFun = void>
class Mesh_RegionPlane
: public Global_Indexed
, public Global_Named
{
public:
typedef Mesh_PlnCurve<CurveType, SizeFun, MetricFun>
plnCurveType;
typedef typename Mesh_RegionPlaneTraits<CurveType>::plnType
plnType;
typedef Mesh_PlnWire<plnCurveType> plnWireType;
typedef std::shared_ptr<plnWireType> outer;
typedef std::shared_ptr<std::vector<std::shared_ptr<plnWireType>>> inner;
typedef std::vector<std::shared_ptr<plnWireType>> wireList;
typedef SizeFun sizeFun;
typedef MetricFun metricFun;
private:
/*Private Data*/
std::shared_ptr<plnType> thePlane_;
outer theOuter_;
inner theInner_;
//- default constructor
Mesh_RegionPlane()
{}
//- private functions and operators
friend class boost::serialization::access;
template<class Archive>
void serialize(Archive& /*ar*/, const unsigned int /*file_version*/)
{
Info << "WARNING! This function is not supposed to be called." << endl;
NotImplemented;
}
public:
//- default constructor
//- constructors
Mesh_RegionPlane
(
const std::shared_ptr<plnType>& thePlane,
const outer& theOuter,
const inner& theInner = nullptr
)
: thePlane_(thePlane)
, theOuter_(theOuter)
, theInner_(theInner)
{}
Mesh_RegionPlane
(
const Standard_Integer theIndex,
const word& theName,
const std::shared_ptr<plnType>& thePlane,
const outer& theOuter,
const inner& theInner = nullptr
)
: Global_Indexed(theIndex)
, Global_Named(theName)
, thePlane_(thePlane)
, theOuter_(theOuter)
, theInner_(theInner)
{}
//- public functions and operators
const auto& Plane() const
{
return thePlane_;
}
auto HasHole() const
{
return (Standard_Boolean)theInner_;
}
auto NbHoles() const
{
if (!HasHole()) return 0;
return (Standard_Integer)theInner_->size();
}
const auto& Inner() const
{
return theInner_;
}
const auto& Outer() const
{
return theOuter_;
}
void SetPlane(const std::shared_ptr<plnType>& thePlane)
{
thePlane_ = thePlane;
}
void RetrieveWiresTo(wireList& theWires) const;
void ExportToPlt(OFstream& File) const;
//- Static functions and operators
template<class WireType>
static std::shared_ptr<plnWireType>
MakeMeshWire
(
const WireType& theWire
);
static std::shared_ptr<Mesh_RegionPlane>
MakePlane
(
const std::shared_ptr<plnType>& thePlane
);
template<class PlnType>
static std::shared_ptr<PlnType> MakeOrignPlane(const std::shared_ptr<Mesh_RegionPlane>&);
};
}
#include <Mesh_RegionPlaneI.hxx>
#endif // !_Mesh_RegionPlane_Header
| [
"aasoleimani86@gmail.com"
] | aasoleimani86@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.