blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 3 264 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 5 140 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 986
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 3.89k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 23
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 145
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 10.4M | extension stringclasses 122
values | content stringlengths 3 10.4M | authors listlengths 1 1 | author_id stringlengths 0 158 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8378e3049a32c6e399d0fc9bee044e0430b99c5a | 0182e48af6ad4574de1c3ec0ebf03fec3fabb46d | /Lab11/Lab11/Client.cpp | 0241905b96061cdac234692de3dbdbde919b2489 | [] | no_license | ahmedtahami/OOPF20 | e75744a7cf3a1bf9afff643eb369524623c4d0ad | 3a5b9a85fcfdbbe578c8c8e54e9303e141384ca1 | refs/heads/master | 2023-02-28T05:44:54.753890 | 2021-02-03T18:17:11 | 2021-02-03T18:17:11 | 335,711,358 | 5 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,254 | cpp | #include "Client.h"
#include<iostream>
#include<string>
using namespace std;
Client::Client() : Person(){
Employement = nullptr;
Account account{};
}
Client::Client(const Client& ref) : Person(ref) {
account = ref.account;
Employement = cpyDeep(ref.Employement);
}
Client::Client(char* name, char* address, char* phoneNumber, char* titile, Account account) : Person(name, address, phoneNumber) {
Employement = cpyDeep(titile);
account = account;
}
void Client::UpdateAccountInfo(char* accountNo, char* accountype, double balance) {
account.setAccountNo(accountNo);
account.setAccountType(accountype);
account.setBalance(balance);
}
void Client::setEmployeementTitle(char* title) {
Employement = cpyDeep(title);
}
void Client::Withdraw(double amount) {
account - amount;
}
void Client::Deposit(double amount) {
account + amount;
}
void Client::Display() {
Person::Display();
cout << "Title : " << Employement << endl;
account.Display();
}
char* Client::cpyDeep(char* arr) {
int size = strlen(arr) + 1;
char* temp = new char[size];
for (int i = 0; i < size; i++)
{
*(temp + i) = *(arr + i);
}
*(temp + (size - 1)) = '\0';
return temp;
}
Client::~Client() {
if (Employement)
{
delete[] Employement;
Employement = nullptr;
}
} | [
"ahmedtahami@outlook.com"
] | ahmedtahami@outlook.com |
9558f01830aab7f0f440044ba4e6c25b3b736d1a | 948f4e13af6b3014582909cc6d762606f2a43365 | /testcases/juliet_test_suite/testcases/CWE36_Absolute_Path_Traversal/s03/CWE36_Absolute_Path_Traversal__wchar_t_connect_socket_fopen_65b.cpp | 184cd765127b7c6a3b854a3b539c075986ed8267 | [] | no_license | junxzm1990/ASAN-- | 0056a341b8537142e10373c8417f27d7825ad89b | ca96e46422407a55bed4aa551a6ad28ec1eeef4e | refs/heads/master | 2022-08-02T15:38:56.286555 | 2022-06-16T22:19:54 | 2022-06-16T22:19:54 | 408,238,453 | 74 | 13 | null | 2022-06-16T22:19:55 | 2021-09-19T21:14:59 | null | UTF-8 | C++ | false | false | 2,126 | cpp | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE36_Absolute_Path_Traversal__wchar_t_connect_socket_fopen_65b.cpp
Label Definition File: CWE36_Absolute_Path_Traversal.label.xml
Template File: sources-sink-65b.tmpl.cpp
*/
/*
* @description
* CWE: 36 Absolute Path Traversal
* BadSource: connect_socket Read data using a connect socket (client side)
* GoodSource: Full path and file name
* Sinks: fopen
* BadSink : Open the file named in data using fopen()
* Flow Variant: 65 Data/control flow: data passed as an argument from one function to a function in a different source file called via a function pointer
*
* */
#include "std_testcase.h"
#ifndef _WIN32
#include <wchar.h>
#endif
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <direct.h>
#pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */
#define CLOSE_SOCKET closesocket
#else /* NOT _WIN32 */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
#define CLOSE_SOCKET close
#define SOCKET int
#endif
#define TCP_PORT 27015
#define IP_ADDRESS "127.0.0.1"
#ifdef _WIN32
#define FOPEN _wfopen
#else
#define FOPEN fopen
#endif
namespace CWE36_Absolute_Path_Traversal__wchar_t_connect_socket_fopen_65
{
#ifndef OMITBAD
void badSink(wchar_t * data)
{
{
FILE *pFile = NULL;
/* POTENTIAL FLAW: Possibly opening a file without validating the file name or path */
pFile = FOPEN(data, L"wb+");
if (pFile != NULL)
{
fclose(pFile);
}
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void goodG2BSink(wchar_t * data)
{
{
FILE *pFile = NULL;
/* POTENTIAL FLAW: Possibly opening a file without validating the file name or path */
pFile = FOPEN(data, L"wb+");
if (pFile != NULL)
{
fclose(pFile);
}
}
}
#endif /* OMITGOOD */
} /* close namespace */
| [
"yzhang0701@gmail.com"
] | yzhang0701@gmail.com |
77daf8b2240a1fdc22aee30ceac0b3838a43bd9d | e9d407e7586c18612f68acb5c3d2056743e35150 | /Perlin-Noise/Source/WaveOsc.cpp | c500fc4d5235132983116d83d96bf9e26b055f7a | [] | no_license | lennartnicolas/perlin-noise | df094740698f0a305d4e69eba9be760d1cae8a62 | 047f8088328fb7612aa9f019a9201cc493af7f01 | refs/heads/main | 2023-03-25T06:28:31.216518 | 2021-03-16T12:01:52 | 2021-03-16T12:01:52 | 345,111,255 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,303 | cpp | /*
==============================================================================
WaveOsc.cpp
Created: 11 Mar 2021 1:24:06pm
Author: Lennart Krebs
==============================================================================
*/
#include "WaveOsc.h"
WaveOsc::WaveOsc(const juce::AudioSampleBuffer& wavetableToUse) : wavetable(wavetableToUse),
tableSize(wavetable.getNumSamples() - 1)
{
jassert (wavetable.getNumChannels() == 1);
}
void WaveOsc::setFrequency(float frequency, float sampleRate)
{
auto tableSizeOverSampleRate = (float) tableSize / sampleRate;
tableDelta = frequency * tableSizeOverSampleRate;
}
void WaveOsc::setWavetable(const juce::AudioSampleBuffer& newWavetable)
{
wavetable = newWavetable;
}
float WaveOsc::getNextSample() noexcept
{
auto index0 = (unsigned int) currentIndex;
auto index1 = index0 + 1;
auto frac = currentIndex - (float) index0;
auto* table = wavetable.getReadPointer (0);
auto value0 = table[index0];
auto value1 = table[index1];
auto currentSample = value0 + frac * (value1 - value0);
if ((currentIndex += tableDelta) > (float) tableSize){
currentIndex -= (float) tableSize;
}
return currentSample * _level;
}
| [
"contact@lennartnicolas.de"
] | contact@lennartnicolas.de |
03811b6caa6e1e51421ebce83973866a9de064fa | 6b2a8dd202fdce77c971c412717e305e1caaac51 | /solutions_5634947029139456_0/C++/Amtrix/gcja.cpp | 4431dd2f61c90426c58634a7df92e55033fd4820 | [] | no_license | alexandraback/datacollection | 0bc67a9ace00abbc843f4912562f3a064992e0e9 | 076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf | refs/heads/master | 2021-01-24T18:27:24.417992 | 2017-05-23T09:23:38 | 2017-05-23T09:23:38 | 84,313,442 | 2 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 1,932 | cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 200;
int n,m;
string w[maxn], goal[maxn];
vector<int>flip;
int main() {
freopen("Ulaz.txt","r",stdin);
freopen("Izlaz10.txt","w",stdout);
ios_base::sync_with_stdio(false);
int tests; cin >> tests;
for (int t = 1; t <= tests; ++t) {
flip.clear();
cin >> n >> m;
for (int i = 0; i < n; ++i) cin >> w[i];
for (int i = 0; i < n; ++i) cin >> goal[i];
for (int i = 0; i < n; ++i)
for (int j = 0; j < m; ++j)
w[i][j] -= '0', goal[i][j] -= '0';
sort(goal, goal + n);
vector<string> possible;
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
string str = "";
for (int k = 0; k < m; ++k)
str += string(1,(w[i][k]+goal[j][k])%2);
possible.push_back(str);
}
}
int minsol = 1e9;
for (int i = 0; i < possible.size(); ++i) {
int cnt = 0;
for (int j = 0; j < m; ++j) {
cnt += int(possible[i][j]);
for (int k = 0; k < n && possible[i][j]; ++k)
w[k][j] = 1 - w[k][j];
}
sort(w, w + n);
bool ok = 1;
for (int j = 0; j < n; ++j)
for (int k = 0; k < m; ++k)
if (w[j][k] != goal[j][k]) ok = 0;
if (ok)
minsol = min(minsol, cnt);
for (int j = 0; j < m; ++j) {
cnt += int(possible[i][j]);
for (int k = 0; k < n && possible[i][j]; ++k)
w[k][j] = 1 - w[k][j];
}
}
cout << "Case #" << t << ": ";
if (minsol == 1e9) cout << "NOT POSSIBLE" << endl;
else cout << minsol << endl;
}
}
| [
"eewestman@gmail.com"
] | eewestman@gmail.com |
3b92499cc3a4230f08dfe1b4ea8c421c44ec2b92 | 0a5645154953b0a09d3f78753a1711aaa76928ff | /common/c/nbpal/src/linux/myplaces/palcontacts.cpp | 5d061796895c63e494dd08cb3c7ee82be2d6bf0e | [] | no_license | GENIVI/navigation-next | 3a6f26063350ac8862b4d0e2e9d3522f6f249328 | cb8f7ec5ec4c78ef57aa573315b75960b2a5dd36 | refs/heads/master | 2023-08-04T17:44:45.239062 | 2023-07-25T19:22:19 | 2023-07-25T19:22:19 | 116,230,587 | 17 | 11 | null | 2018-05-18T20:00:38 | 2018-01-04T07:43:22 | C++ | UTF-8 | C++ | false | false | 3,106 | cpp | /*
Copyright (c) 2018, TeleCommunication Systems, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the TeleCommunication Systems, Inc., nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
DISCLAIMED. IN NO EVENT SHALL TELECOMMUNICATION SYSTEMS, INC.BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*!--------------------------------------------------------------------------
@file palcontacts.c
*/
/*
(C) Copyright 2012 by TeleCommunication Systems, Inc.
The information contained herein is confidential, proprietary
to TeleCommunication Systems, Inc., and considered a trade secret as
defined in section 499C of the penal code of the State of
California. Use of this information by anyone other than
authorized employees of TeleCommunication Systems, is granted only
under a written non-disclosure agreement, expressly
prescribing the scope and manner of such use.
---------------------------------------------------------------------------*/
/*! @{ */
#include "palcontacts.h"
#include "palstdlib.h"
#include "pal.h"
#include "paltypes.h"
#include "palstdlib.h"
#include "palmyplaces.h"
using namespace std;
struct PAL_Contacts
{
// Contacts* pContacts;
};
PAL_DEF PAL_Error
PAL_ContactsCreate(PAL_Instance* /*pal*/, PAL_Contacts** /*contacts*/)
{
return PAL_ErrUnsupported;
}
PAL_DEF PAL_Error
PAL_ContactsDestroy(PAL_Contacts* /*contacts*/)
{
return PAL_ErrUnsupported;
}
PAL_DEF PAL_Error
PAL_ContactsGet(PAL_Contacts* /*contacts*/, char* /*filter*/, PAL_MyPlace** /*myPlacesArray*/, int* /*myPlaceCount*/)
{
return PAL_ErrUnsupported;
}
PAL_DEF PAL_Error
PAL_ContactsAdd(PAL_Contacts* /*contacts*/, PAL_MyPlace* /*myPlace*/)
{
return PAL_ErrUnsupported;
}
PAL_DEF PAL_Error
PAL_ContactsClear(PAL_Contacts* /*contacts*/)
{
return PAL_ErrUnsupported;
}
/*! @{ */
| [
"caavula@telecomsys.com"
] | caavula@telecomsys.com |
643698604ef62af7c92e3151c7ba5f3bb5f2ebbc | ec8e370551e1549e04ba76870f5a9cbf80e25f97 | /src/simulation/Buildings.cpp | ef95175a9415ece9af47ffb0b37c630cf8fc1821 | [] | no_license | jmc734/OpenEaagles | 7c3ea87417ac6b4b29bd1130ddb849d8cec12aa3 | e28efd40555651261f4dbccc7fd618e524f999aa | refs/heads/master | 2020-12-25T11:41:31.620244 | 2015-08-31T17:25:37 | 2015-08-31T17:25:37 | 41,508,946 | 0 | 0 | null | 2015-08-27T20:10:29 | 2015-08-27T20:10:29 | null | UTF-8 | C++ | false | false | 1,516 | cpp | #include "openeaagles/simulation/Buildings.h"
#include "openeaagles/basic/List.h"
#include "openeaagles/basic/osg/Matrix"
#include "openeaagles/basic/units/Angles.h"
namespace Eaagles {
namespace Simulation {
//==============================================================================
// class Building
//==============================================================================
IMPLEMENT_EMPTY_SLOTTABLE_SUBCLASS(Building,"Building")
EMPTY_SERIALIZER(Building)
//------------------------------------------------------------------------------
// Constructor(s)
//------------------------------------------------------------------------------
Building::Building()
{
STANDARD_CONSTRUCTOR()
static Basic::String generic("GenericBuilding");
setType(&generic);
}
//------------------------------------------------------------------------------
// copyData(), deleteData() -- copy (delete) member data
//------------------------------------------------------------------------------
void Building::copyData(const Building& org, const bool)
{
BaseClass::copyData(org);
}
void Building::deleteData()
{
}
//-----------------------------------------------------------------------------
// getMajorType() -- Returns the player's major type
//-----------------------------------------------------------------------------
unsigned int Building::getMajorType() const
{
return BUILDING;
}
} // End Simulation namespace
} // End Eaagles namespace
| [
"doug@openeaagles.org"
] | doug@openeaagles.org |
abcf183193d5f2f0794013db3cf77b2a5bc4d2da | 575692cb329ebfe1a2d44ae21d4033973009683a | /src/JD.cpp | c2d46bb4d3b1d0c76861bfe579de2d96f108c18b | [] | no_license | StuckInLoop/sxtwl_swig_py | 145e1dd1906068e527c5dd7b3994d25b3106fe43 | 8080b88d2f86897e1f980ef43b720fbb20ba8e30 | refs/heads/master | 2020-07-25T06:16:58.096236 | 2017-11-30T15:04:31 | 2017-11-30T15:04:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,787 | cpp | #include "JD.h"
#include "const.h"
#include <cstring>
//公历转儒略日
long double JD::DD2JD(int y, uint8_t m, long double d)
{
int n = 0, G = 0;
//判断是否为格里高利历日1582*372+10*31+15
if (y * 372 + m * 31 + (int)(d) >= 588829)
{
G = 1;
}
if (m <= 2)
{
m += 12, y--;
}
//加百年闰
if (G)
{
n = int2(y / 100), n = 2 - n + int(n / 4);
}
return int2(365.25*(y + 4716)) + int2(30.6001*(m + 1)) + d + n - 1524.5;
}
//儒略日数转公历
Time JD::JD2DD(int jd)
{
Time r;
int D = int2(jd + 0.5);
float F = jd + 0.5 - D, c; //取得日数的整数部份A及小数部分F
if (D >= 2299161)
{
c = int((D - 1867216.25) / 36524.25), D += 1 + c - int2(c / 4);
}
D += 1524; r.Y = int2((D - 122.1) / 365.25);//年数
D -= int2(365.25*r.Y); r.M = int2(D / 30.601); //月数
D -= int2(30.601*r.M); r.D = D; //日数
if (r.M > 13)
{
r.M -= 13, r.Y -= 4715;
}
else
{
r.M -= 1, r.Y -= 4716;
}
//日的小数转为时分秒
F *= 24; r.h = int2(F); F -= r.h;
F *= 60; r.m = int2(F); F -= r.m;
F *= 60; r.s = F;
return r;
}
long double JD::toJD(Time& time)
{
return JD::DD2JD(time.Y, time.M, time.D + ((time.s / 60 + time.m) / 60 + time.h) / 24);
}
//提取jd中的时间(去除日期);
std::string JD::timeStr(long double jd)
{
int h, m, s;
jd += 0.5; jd = (jd - int2(jd));
s = int2(jd * 86400 + 0.5);
h = int2(s / 3600); s -= h * 3600;
m = int2(s / 60); s -= m * 60;
std::string ret = "";
char buff[11];
memset(buff, 0, 11);
sprintf(buff, "0%d", h);
ret.append(buff + strlen(buff) - 2);
ret += ":";
memset(buff, 0, 11);
sprintf(buff, "0%d", m);
ret.append(buff + strlen(buff) - 2);
ret += ":";
memset(buff, 0, 11);
sprintf(buff, "0%d", s);
ret.append(buff + strlen(buff) - 2);
return ret;
}
| [
"2462787827@qq.com"
] | 2462787827@qq.com |
24fea557640049e1bff32e0a076fd408e63fc2a1 | 83d0a306fa0e29e00e1b12bb29eb66492e0e2a99 | /REPLACE.CPP | 23c339fbe5c3dcf865e8d5963ab225ebde77465c | [] | no_license | tanishkmalhotrx/School-Projects | 46a7ecea4394c0c1597677beb41751e11c28bc8f | 2d79cc2ce377d08c0f44621af50e0e3389739e1e | refs/heads/main | 2023-07-17T14:30:37.268072 | 2021-08-24T04:00:49 | 2021-08-24T04:00:49 | 362,741,457 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 283 | cpp | //Replace a character in a string
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
char s[30];
int i;
cout<<"\n\nEnter a string:";
gets(s);
for(i=0;s[i]!='\0';i++)
{
if(s[i]=='a')
s[i]='A';
}
cout<<"\n\nNew string is:"<<s;
getch();
} | [
"noreply@github.com"
] | tanishkmalhotrx.noreply@github.com |
d9336fc8aa6b348fa8f06b690de395f76f3fa73e | c8c5d95ab92252595b27a534c92246b66b9a0ad0 | /server/include/distributions.h | 8c72228add1ec1b112f2737b21de3bf9978139a6 | [] | no_license | ronalanto03/algorithms-scheduling-simulator | c63864d66da98bcc18238ffc6aef7050f0ad6bd1 | 878074abf255089501050a4bf7fab905fc78e201 | refs/heads/master | 2021-01-24T11:28:15.485016 | 2016-10-25T23:48:02 | 2016-10-25T23:48:02 | 70,206,457 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,139 | h | /**
* @file distributions.h
* @brief Declaracion de las estructura Distribution
* @author Ronald Sulbaran. ronalanto03@gmail.com.
* @date 24-05-2013
*/
#ifndef DISTRIBUTIONS_H
#define DISTRIBUTIONS_H
#include<cmath>
#include <random>
#include <chrono>
/**
* @struct DistributionData
* @brief Distribuciones usadas para hacer las simulaciones.
*/
class Distribution
{
private:
std::default_random_engine generator;/**< Motor de números aleatorios que genera números pseudo-aleatorios*/
double lamda;/**< Parametro lamda de la distribucion exponencial*/
std::uniform_real_distribution<double> * distribution_u;/**< Distribución de números aleatorios que produce valores de punto flotante de acuerdo con una distribución uniforme*/
std::normal_distribution<double> * distribution_n;/**< Distribución de números aleatorios que produce valores de punto flotante de acuerdo con una distribución normal*/
public:
enum Type
{
constant = 0,
uniform = 1,
exponential = 2,
normal = 3
};
enum Type t;
/**
* @brief Constructor parametrico
* @param _t tipo de generador
* @param _t a usado de diferentes formas dependiendo del tipo de distribucion
* @param _t b usado de diferentes formas dependiendo del tipo de distribucion
*/
Distribution(enum Type _t,double a, double b,double seed);
/**
* @brief Borra la memoria ocupada por el generador asociado a la distribucion
*/
~Distribution();
/**
* @return un numero aleatorio distribuido de acuerdo a la distribucion elegida
*/
inline double getVal()
{
switch(t)
{
case constant:
return lamda;
case uniform:
return (*distribution_u)(generator);
case exponential:
return -log((*distribution_u)(generator))*lamda;
case normal:
return (*distribution_n)(generator);
}
return 0.0;//This should not ever be reached
}
};
#endif
| [
"ronalanto03@gmail.com"
] | ronalanto03@gmail.com |
ec278ee893d1b0034ace4b55a177cfc383675b60 | 5b6d9fd23804dea9adb4b4d78cf2eff9c0eb3b05 | /Chapter_10/task_2/Person.hpp | 6212dd2cc42bb47c1dec853877e8411cf5b7853a | [] | no_license | gosowski/PrimerPlusCPP | 410067d94865535544a36120a2a0856f8a9056a5 | 8c654f4e5d3087e85a4b0294bb548e4c2e504bba | refs/heads/master | 2021-09-14T09:40:55.958871 | 2018-05-11T14:00:12 | 2018-05-11T14:00:12 | 125,866,520 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 541 | hpp | #ifndef PERSON_H
#define PERSON_H
#include <iostream>
#include <string.h>
class Person {
private:
static const int LIMIT = 256;
std::string lname;
char fname[LIMIT];
public:
Person() {
lname = "";
fname[0] = '\0';
}
Person(const std::string &ln, const char *fn = "HejU") {
lname = ln;
strcpy(fname, fn);
}
void show() const {
std::cout<<lname<<" | "<<fname<<std::endl;
}
void formalShow() const {
std::cout<<fname<<" | "<<lname<<std::endl;
}
};
#endif | [
"osowski.grzegorz@gmail.com"
] | osowski.grzegorz@gmail.com |
2436b11a50a90e7832ef49dab107400a485a34f6 | 5256b82f743a0aab3ec1eb51103c66c77374ff53 | /src/UKNCBTL.TB/stdafx.cpp | fb6b79a1d86d912f16560e44e56f8f921d3bd838 | [] | no_license | arma-gast/ukncbtl | cdfe37f07edcf020dce24df43aee52b58af49230 | 6c271114054b4cd2b422c5e1756a032f46fb4de7 | refs/heads/master | 2020-03-29T14:01:19.332066 | 2015-03-16T19:39:07 | 2015-03-16T19:39:07 | 33,125,833 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 296 | cpp | // stdafx.cpp : source file that includes just the standard includes
// TestBench.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
| [
"nzeemin@gmail.com@d259c8a2-7647-0410-94c4-d9ba3b64c92c"
] | nzeemin@gmail.com@d259c8a2-7647-0410-94c4-d9ba3b64c92c |
ddc391bb26d4435d9459f2d70acfb73a19d5e8d7 | 67297d0d85b09eb479fd84cd5a75a0af07a25496 | /doSymaFly/doSymaFly/doSymaFly.ino | ab71a2d4a6a4e779fb584c9509b9ac4444f78449 | [] | no_license | surferran/toys | 94d62452c9b0b4413c8bbd2221c6a1ce54bc47de | 44003a601f6144b35b8f51d30f03d0a81bb38dbf | refs/heads/master | 2021-01-10T03:05:48.324900 | 2016-01-29T13:03:13 | 2016-01-29T13:03:13 | 50,661,282 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 265 | ino | /*
Name: doSymaFly.ino
Created: 11/19/2015 9:34:07 PM
Author: Ran_the_User
*/
// the setup function runs once when you press reset or power the board
void setup() {
}
// the loop function runs over and over again until power down or reset
void loop() {
}
| [
"surferran@yahoo.com"
] | surferran@yahoo.com |
7e50dc716a67eb5fa36967622ede0daaa562f1ce | d1f39bb77951a67728ac7966d98f5a018fdabaa5 | /station/station.ino | 884eae9e754c276a3e48821be5a39c93e9b764fb | [] | no_license | Pairat2542/Rover_Network | a7f8de6a370a000419344afe9d6353284346279a | f53bab961c7941f6cd13b9176ec0abae549a5edf | refs/heads/main | 2023-01-03T11:25:07.594375 | 2020-11-02T07:01:58 | 2020-11-02T07:01:58 | 309,283,057 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,603 | ino | #include <ArduinoJson.h>
#include "EEPROM.h"
#include <esp_now.h>
#include <WiFiClient.h>
#include <WebServer.h>
#include <ESPmDNS.h>
#include <WiFi.h>
#include <WiFiAP.h>
int station_number = 1;
WebServer server(8080);
int state = 1;
bool Status = false;
bool restart_esp = false;
bool checkSend = true;
bool checkAdd = true;
bool check_send_fail = true;
bool ticker = true;
esp_now_peer_info_t peerInfo;
uint8_t broadcastMac[] = {0xFF, 0xFF , 0xFF , 0xFF , 0xFF , 0xFF };
uint8_t registerMac[6];
unsigned long start_time = 0, check_car_time = 0;
typedef struct Data {
String msg;
float latency;
} MyData;
MyData receive_data, winner_data;
char ssid[] = "Station#";
void setup() {
Serial.begin(9600);
WiFi.mode(WIFI_AP_STA);
ssid[7] = station_number + 48;
Serial.println(ssid);
WiFi.softAP(ssid);
Serial.println(WiFi.softAPIP());
esp_now_setup();
pinMode(0, INPUT);
EEPROM.begin(64);
Status = EEPROM.read(0);
server.on("/", handleRoot);
server.on("/setRestart", setRestart);
server.on("/setStatusTrue", setTrue);
server.on("/refresh", reFresh);
server.onNotFound(handleNotFound);
server.begin();
Serial.println("HTTP server started");
}
void loop() {
server.handleClient();
if (Status && checkSend) {
checkSend = false;
start_send();
EEPROM.write(0, Status);
EEPROM.commit();
}
if (start_time != 0 && millis() - start_time >= 10000) {
if (winner_data.latency == 0) start_send();
else if (checkAdd) {
checkAdd = false;
add_peer(registerMac);
delay(100);
int i = 0;
for (i = 0 ; i < 3; i++) {
send_data(registerMac, "Win");
delay(1000);
Serial.println(check_send_fail);
if (check_send_fail) {
state = 2;
check_car_time = millis();
ticker = true;
break;
}
}
if (i >= 3) {
ESP.restart();
}
}
}
if (!check_send_fail) {
checkSend = false;
start_send();
check_send_fail = true;
}
if (ticker && millis() - check_car_time >= 3000) {
send_data(registerMac, "Alive");
delay(500);
if (!check_send_fail) {
ESP.restart();
}
check_car_time = millis();
}
}
void start_send() {
start_time = millis();
winner_data.latency = 0;
send_data(broadcastMac, ssid);
}
void display_macaddress(const uint8_t* mac) {
Serial.print("Mac Address: ");
for (int i = 0 ; i < 6; i++) {
Serial.print(mac[i], HEX);
Serial.print(" ");
}
Serial.println();
}
| [
"noreply@github.com"
] | Pairat2542.noreply@github.com |
703a32610e53005b8ae4bd6020c975201645e195 | b4f3934c4a10c455adebc3cdac49e13a2745a2ba | /scintilla/lexlib/CharacterCategory.cxx | ab9107b6fab8fb56e14045293ba99ba73263e35a | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"MIT",
"LicenseRef-scancode-scintilla",
"BSD-2-Clause"
] | permissive | weiling103/notepad2 | 40b11bc592bd23a306659a5efb728d9d6f9895a7 | 7842371bbbb645918f3defdc1c5a9b7959b62ada | refs/heads/master | 2023-05-25T07:17:35.100852 | 2021-06-03T14:08:46 | 2021-06-03T14:08:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 117,652 | cxx | // Scintilla source code edit control
/** @file CharacterCategory.cxx
** Returns the Unicode general category of a character.
** Table automatically regenerated by scripts/GenerateCharacterCategory.py
** Should only be rarely regenerated for new versions of Unicode.
**/
// Copyright 2013 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <vector>
#include <algorithm>
#include <iterator>
#include "CharacterCategory.h"
namespace Lexilla {
namespace {
// Use an unnamed namespace to protect the declarations from name conflicts
//++Autogenerated -- start of section automatically generated
// Created with Python 3.9.0, Unicode 13.0.0
#if CHARACTERCATEGORY_OPTIMIZE_LATIN1
const unsigned char catLatin[] = {
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
22, 17, 17, 17, 19, 17, 17, 17, 13, 14, 17, 18, 17, 12, 17, 17,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 17, 17, 18, 18, 18, 17,
17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 17, 14, 20, 11,
20, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 13, 18, 14, 18, 25,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
22, 17, 19, 19, 19, 19, 21, 17, 20, 21, 4, 15, 18, 26, 21, 20,
21, 18, 10, 10, 20, 1, 17, 17, 20, 10, 4, 16, 10, 10, 10, 17,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 18, 1, 1, 1, 1, 1, 1, 1, 1,
};
#endif
#if CHARACTERCATEGORY_USE_BINARY_SEARCH
const int catRanges[] = {
25,
1046,
1073,
1171,
1201,
1293,
1326,
1361,
1394,
1425,
1452,
1489,
1544,
1873,
1938,
2033,
2080,
2925,
2961,
2990,
3028,
3051,
3092,
3105,
3949,
3986,
4014,
4050,
4089,
5142,
5169,
5203,
5333,
5361,
5396,
5429,
5444,
5487,
5522,
5562,
5589,
5620,
5653,
5682,
5706,
5780,
5793,
5841,
5908,
5930,
5956,
6000,
6026,
6129,
6144,
6898,
6912,
7137,
7922,
7937,
8192,
8225,
8256,
8289,
8320,
8353,
8384,
8417,
8448,
8481,
8512,
8545,
8576,
8609,
8640,
8673,
8704,
8737,
8768,
8801,
8832,
8865,
8896,
8929,
8960,
8993,
9024,
9057,
9088,
9121,
9152,
9185,
9216,
9249,
9280,
9313,
9344,
9377,
9408,
9441,
9472,
9505,
9536,
9569,
9600,
9633,
9664,
9697,
9728,
9761,
9792,
9825,
9856,
9889,
9920,
9953,
10016,
10049,
10080,
10113,
10144,
10177,
10208,
10241,
10272,
10305,
10336,
10369,
10400,
10433,
10464,
10497,
10560,
10593,
10624,
10657,
10688,
10721,
10752,
10785,
10816,
10849,
10880,
10913,
10944,
10977,
11008,
11041,
11072,
11105,
11136,
11169,
11200,
11233,
11264,
11297,
11328,
11361,
11392,
11425,
11456,
11489,
11520,
11553,
11584,
11617,
11648,
11681,
11712,
11745,
11776,
11809,
11840,
11873,
11904,
11937,
11968,
12001,
12032,
12097,
12128,
12161,
12192,
12225,
12320,
12385,
12416,
12449,
12480,
12545,
12576,
12673,
12736,
12865,
12896,
12961,
12992,
13089,
13184,
13249,
13280,
13345,
13376,
13409,
13440,
13473,
13504,
13569,
13600,
13633,
13696,
13729,
13760,
13825,
13856,
13953,
13984,
14017,
14048,
14113,
14180,
14208,
14241,
14340,
14464,
14498,
14529,
14560,
14594,
14625,
14656,
14690,
14721,
14752,
14785,
14816,
14849,
14880,
14913,
14944,
14977,
15008,
15041,
15072,
15105,
15136,
15169,
15200,
15233,
15296,
15329,
15360,
15393,
15424,
15457,
15488,
15521,
15552,
15585,
15616,
15649,
15680,
15713,
15744,
15777,
15808,
15841,
15904,
15938,
15969,
16000,
16033,
16064,
16161,
16192,
16225,
16256,
16289,
16320,
16353,
16384,
16417,
16448,
16481,
16512,
16545,
16576,
16609,
16640,
16673,
16704,
16737,
16768,
16801,
16832,
16865,
16896,
16929,
16960,
16993,
17024,
17057,
17088,
17121,
17152,
17185,
17216,
17249,
17280,
17313,
17344,
17377,
17408,
17441,
17472,
17505,
17536,
17569,
17600,
17633,
17664,
17697,
17728,
17761,
17792,
17825,
17856,
17889,
17920,
17953,
17984,
18017,
18240,
18305,
18336,
18401,
18464,
18497,
18528,
18657,
18688,
18721,
18752,
18785,
18816,
18849,
18880,
18913,
21124,
21153,
22019,
22612,
22723,
23124,
23555,
23732,
23939,
23988,
24003,
24052,
24581,
28160,
28193,
28224,
28257,
28291,
28340,
28352,
28385,
28445,
28483,
28513,
28625,
28640,
28701,
28820,
28864,
28913,
28928,
29053,
29056,
29117,
29120,
29185,
29216,
29789,
29792,
30081,
31200,
31233,
31296,
31393,
31488,
31521,
31552,
31585,
31616,
31649,
31680,
31713,
31744,
31777,
31808,
31841,
31872,
31905,
31936,
31969,
32000,
32033,
32064,
32097,
32128,
32161,
32192,
32225,
32384,
32417,
32466,
32480,
32513,
32544,
32609,
32672,
34305,
35840,
35873,
35904,
35937,
35968,
36001,
36032,
36065,
36096,
36129,
36160,
36193,
36224,
36257,
36288,
36321,
36352,
36385,
36416,
36449,
36480,
36513,
36544,
36577,
36608,
36641,
36672,
36705,
36736,
36769,
36800,
36833,
36864,
36897,
36949,
36965,
37127,
37184,
37217,
37248,
37281,
37312,
37345,
37376,
37409,
37440,
37473,
37504,
37537,
37568,
37601,
37632,
37665,
37696,
37729,
37760,
37793,
37824,
37857,
37888,
37921,
37952,
37985,
38016,
38049,
38080,
38113,
38144,
38177,
38208,
38241,
38272,
38305,
38336,
38369,
38400,
38433,
38464,
38497,
38528,
38561,
38592,
38625,
38656,
38689,
38720,
38753,
38784,
38817,
38848,
38881,
38912,
38977,
39008,
39041,
39072,
39105,
39136,
39169,
39200,
39233,
39264,
39297,
39328,
39361,
39424,
39457,
39488,
39521,
39552,
39585,
39616,
39649,
39680,
39713,
39744,
39777,
39808,
39841,
39872,
39905,
39936,
39969,
40000,
40033,
40064,
40097,
40128,
40161,
40192,
40225,
40256,
40289,
40320,
40353,
40384,
40417,
40448,
40481,
40512,
40545,
40576,
40609,
40640,
40673,
40704,
40737,
40768,
40801,
40832,
40865,
40896,
40929,
40960,
40993,
41024,
41057,
41088,
41121,
41152,
41185,
41216,
41249,
41280,
41313,
41344,
41377,
41408,
41441,
41472,
41505,
41536,
41569,
41600,
41633,
41664,
41697,
41728,
41761,
41792,
41825,
41856,
41889,
41920,
41953,
41984,
42017,
42048,
42081,
42112,
42145,
42176,
42209,
42240,
42273,
42304,
42337,
42368,
42401,
42432,
42465,
42525,
42528,
43773,
43811,
43857,
44033,
45361,
45388,
45437,
45493,
45555,
45597,
45605,
47052,
47077,
47121,
47141,
47217,
47237,
47313,
47333,
47389,
47620,
48509,
48612,
48753,
48829,
49178,
49362,
49457,
49523,
49553,
49621,
49669,
50033,
50074,
50109,
50129,
50180,
51203,
51236,
51557,
52232,
52561,
52676,
52741,
52772,
55953,
55972,
56005,
56250,
56277,
56293,
56483,
56549,
56629,
56645,
56772,
56840,
57156,
57269,
57316,
57361,
57821,
57850,
57860,
57893,
57924,
58885,
59773,
59812,
62661,
63012,
63069,
63496,
63812,
64869,
65155,
65237,
65265,
65347,
65405,
65445,
65491,
65540,
66245,
66371,
66405,
66691,
66725,
66819,
66853,
67037,
67089,
67581,
67588,
68389,
68509,
68561,
68605,
68612,
68989,
70660,
71357,
71364,
71965,
72293,
72794,
72805,
73830,
73860,
75589,
75622,
75653,
75684,
75718,
75813,
76070,
76197,
76230,
76292,
76325,
76548,
76869,
76945,
77000,
77329,
77347,
77380,
77861,
77894,
77981,
77988,
78269,
78308,
78397,
78436,
79165,
79172,
79421,
79428,
79485,
79556,
79709,
79749,
79780,
79814,
79909,
80061,
80102,
80189,
80230,
80293,
80324,
80381,
80614,
80669,
80772,
80861,
80868,
80965,
81053,
81096,
81412,
81491,
81546,
81749,
81779,
81796,
81841,
81861,
81917,
81957,
82022,
82077,
82084,
82301,
82404,
82493,
82532,
83261,
83268,
83517,
83524,
83613,
83620,
83709,
83716,
83805,
83845,
83901,
83910,
84005,
84093,
84197,
84285,
84325,
84445,
84517,
84573,
84772,
84925,
84932,
84989,
85192,
85509,
85572,
85669,
85713,
85757,
86053,
86118,
86173,
86180,
86493,
86500,
86621,
86628,
87357,
87364,
87613,
87620,
87709,
87716,
87901,
87941,
87972,
88006,
88101,
88285,
88293,
88358,
88413,
88422,
88485,
88541,
88580,
88637,
89092,
89157,
89245,
89288,
89617,
89651,
89693,
89892,
89925,
90141,
90149,
90182,
90269,
90276,
90557,
90596,
90685,
90724,
91453,
91460,
91709,
91716,
91805,
91812,
91997,
92037,
92068,
92102,
92133,
92166,
92197,
92349,
92390,
92477,
92518,
92581,
92637,
92837,
92902,
92957,
93060,
93149,
93156,
93253,
93341,
93384,
93717,
93732,
93770,
93981,
94277,
94308,
94365,
94372,
94589,
94660,
94781,
94788,
94941,
95012,
95101,
95108,
95165,
95172,
95261,
95332,
95421,
95492,
95613,
95684,
96093,
96198,
96261,
96294,
96381,
96454,
96573,
96582,
96677,
96733,
96772,
96829,
96998,
97053,
97480,
97802,
97909,
98099,
98133,
98173,
98309,
98342,
98437,
98468,
98749,
98756,
98877,
98884,
99645,
99652,
100189,
100260,
100293,
100390,
100541,
100549,
100669,
100677,
100829,
101029,
101117,
101124,
101245,
101380,
101445,
101533,
101576,
101917,
102129,
102154,
102389,
102404,
102437,
102470,
102545,
102564,
102845,
102852,
102973,
102980,
103741,
103748,
104093,
104100,
104285,
104325,
104356,
104390,
104421,
104454,
104637,
104645,
104678,
104765,
104774,
104837,
104925,
105126,
105213,
105412,
105469,
105476,
105541,
105629,
105672,
106013,
106020,
106109,
106501,
106566,
106628,
106941,
106948,
107069,
107076,
108389,
108452,
108486,
108581,
108733,
108742,
108861,
108870,
108965,
108996,
109045,
109085,
109188,
109286,
109322,
109540,
109637,
109725,
109768,
110090,
110389,
110404,
110621,
110629,
110662,
110749,
110756,
111357,
111428,
112221,
112228,
112541,
112548,
112605,
112644,
112893,
112965,
113021,
113126,
113221,
113341,
113349,
113405,
113414,
113693,
113864,
114205,
114246,
114321,
114365,
114724,
116261,
116292,
116357,
116605,
116723,
116740,
116931,
116965,
117233,
117256,
117585,
117661,
118820,
118909,
118916,
118973,
118980,
119165,
119172,
119965,
119972,
120029,
120036,
120357,
120388,
120453,
120740,
120797,
120836,
121021,
121027,
121085,
121093,
121309,
121352,
121693,
121732,
121885,
122884,
122933,
123025,
123509,
123537,
123573,
123653,
123733,
123912,
124234,
124565,
124581,
124629,
124645,
124693,
124709,
124749,
124782,
124813,
124846,
124870,
124932,
125213,
125220,
126397,
126501,
126950,
126981,
127153,
127173,
127236,
127397,
127773,
127781,
128957,
128981,
129221,
129269,
129469,
129493,
129553,
129717,
129841,
129917,
131076,
132454,
132517,
132646,
132677,
132870,
132901,
132966,
133029,
133092,
133128,
133457,
133636,
133830,
133893,
133956,
134085,
134180,
134214,
134308,
134374,
134596,
134693,
134820,
135237,
135270,
135333,
135398,
135589,
135620,
135654,
135688,
136006,
136101,
136149,
136192,
137437,
137440,
137501,
137632,
137693,
137729,
139121,
139139,
139169,
139268,
149821,
149828,
149981,
150020,
150269,
150276,
150333,
150340,
150493,
150532,
151869,
151876,
152029,
152068,
153149,
153156,
153309,
153348,
153597,
153604,
153661,
153668,
153821,
153860,
154365,
154372,
156221,
156228,
156381,
156420,
158589,
158629,
158737,
159018,
159677,
159748,
160277,
160605,
160768,
163549,
163585,
163805,
163852,
163876,
183733,
183761,
183780,
184342,
184356,
185197,
185230,
185277,
185348,
187761,
187849,
187940,
188221,
188420,
188861,
188868,
188997,
189117,
189444,
190021,
190129,
190205,
190468,
191045,
191133,
191492,
191933,
191940,
192061,
192069,
192157,
192516,
194181,
194246,
194277,
194502,
194757,
194790,
194853,
195217,
195299,
195345,
195443,
195460,
195493,
195549,
195592,
195933,
196106,
196445,
196625,
196812,
196849,
196965,
197082,
197117,
197128,
197469,
197636,
198755,
198788,
200509,
200708,
200869,
200932,
202021,
202052,
202109,
202244,
204509,
204804,
205821,
205829,
205926,
206053,
206118,
206237,
206342,
206405,
206438,
206629,
206749,
206869,
206909,
206993,
207048,
207364,
208349,
208388,
208573,
208900,
210333,
210436,
211293,
211464,
211786,
211837,
211925,
212996,
213733,
213798,
213861,
213917,
213969,
214020,
215718,
215749,
215782,
215813,
216061,
216069,
216102,
216133,
216166,
216229,
216486,
216677,
217021,
217061,
217096,
217437,
217608,
217949,
218129,
218339,
218385,
218589,
218629,
219079,
219109,
219197,
221189,
221318,
221348,
222853,
222886,
222917,
223078,
223109,
223142,
223301,
223334,
223396,
223645,
223752,
224081,
224309,
224613,
224917,
225213,
225285,
225350,
225380,
226342,
226373,
226502,
226565,
226630,
226661,
226756,
226824,
227140,
228549,
228582,
228613,
228678,
228773,
228806,
228837,
228934,
229021,
229265,
229380,
230534,
230789,
231046,
231109,
231197,
231281,
231432,
231773,
231844,
231944,
232260,
233219,
233425,
233473,
233789,
233984,
235389,
235424,
235537,
235805,
236037,
236145,
236165,
236582,
236613,
236836,
236965,
236996,
237189,
237220,
237286,
237317,
237380,
237437,
237569,
238979,
240993,
241411,
241441,
242531,
243717,
245597,
245605,
245760,
245793,
245824,
245857,
245888,
245921,
245952,
245985,
246016,
246049,
246080,
246113,
246144,
246177,
246208,
246241,
246272,
246305,
246336,
246369,
246400,
246433,
246464,
246497,
246528,
246561,
246592,
246625,
246656,
246689,
246720,
246753,
246784,
246817,
246848,
246881,
246912,
246945,
246976,
247009,
247040,
247073,
247104,
247137,
247168,
247201,
247232,
247265,
247296,
247329,
247360,
247393,
247424,
247457,
247488,
247521,
247552,
247585,
247616,
247649,
247680,
247713,
247744,
247777,
247808,
247841,
247872,
247905,
247936,
247969,
248000,
248033,
248064,
248097,
248128,
248161,
248192,
248225,
248256,
248289,
248320,
248353,
248384,
248417,
248448,
248481,
248512,
248545,
248576,
248609,
248640,
248673,
248704,
248737,
248768,
248801,
248832,
248865,
248896,
248929,
248960,
248993,
249024,
249057,
249088,
249121,
249152,
249185,
249216,
249249,
249280,
249313,
249344,
249377,
249408,
249441,
249472,
249505,
249536,
249569,
249600,
249633,
249664,
249697,
249728,
249761,
249792,
249825,
249856,
249889,
249920,
249953,
249984,
250017,
250048,
250081,
250112,
250145,
250176,
250209,
250240,
250273,
250304,
250337,
250368,
250401,
250432,
250465,
250496,
250529,
250816,
250849,
250880,
250913,
250944,
250977,
251008,
251041,
251072,
251105,
251136,
251169,
251200,
251233,
251264,
251297,
251328,
251361,
251392,
251425,
251456,
251489,
251520,
251553,
251584,
251617,
251648,
251681,
251712,
251745,
251776,
251809,
251840,
251873,
251904,
251937,
251968,
252001,
252032,
252065,
252096,
252129,
252160,
252193,
252224,
252257,
252288,
252321,
252352,
252385,
252416,
252449,
252480,
252513,
252544,
252577,
252608,
252641,
252672,
252705,
252736,
252769,
252800,
252833,
252864,
252897,
252928,
252961,
252992,
253025,
253056,
253089,
253120,
253153,
253184,
253217,
253248,
253281,
253312,
253345,
253376,
253409,
253440,
253473,
253504,
253537,
253568,
253601,
253632,
253665,
253696,
253729,
253760,
253793,
253824,
253857,
253888,
253921,
254208,
254465,
254685,
254720,
254941,
254977,
255232,
255489,
255744,
256001,
256221,
256256,
256477,
256513,
256797,
256800,
256861,
256864,
256925,
256928,
256989,
256992,
257025,
257280,
257537,
258013,
258049,
258306,
258561,
258818,
259073,
259330,
259585,
259773,
259777,
259840,
259970,
260020,
260033,
260084,
260161,
260285,
260289,
260352,
260482,
260532,
260609,
260765,
260801,
260864,
261021,
261044,
261121,
261376,
261556,
261661,
261697,
261821,
261825,
261888,
262018,
262068,
262141,
262166,
262522,
262668,
262865,
262927,
262960,
262989,
263023,
263088,
263117,
263151,
263185,
263447,
263480,
263514,
263670,
263697,
263983,
264016,
264049,
264171,
264241,
264338,
264365,
264398,
264433,
264786,
264817,
264843,
264881,
265206,
265242,
265405,
265434,
265738,
265763,
265821,
265866,
266066,
266157,
266190,
266211,
266250,
266578,
266669,
266702,
266749,
266755,
267197,
267283,
268317,
268805,
269223,
269349,
269383,
269477,
269885,
270357,
270400,
270453,
270560,
270613,
270657,
270688,
270785,
270848,
270945,
270997,
271008,
271061,
271122,
271136,
271317,
271488,
271541,
271552,
271605,
271616,
271669,
271680,
271829,
271841,
271872,
272001,
272036,
272161,
272213,
272257,
272320,
272402,
272544,
272577,
272725,
272754,
272789,
272833,
272885,
272906,
273417,
274528,
274561,
274601,
274730,
274773,
274845,
274962,
275125,
275282,
275349,
275474,
275509,
275570,
275605,
275666,
275701,
275922,
275957,
276946,
277013,
277074,
277109,
277138,
277173,
278162,
286741,
286989,
287022,
287053,
287086,
287125,
287762,
287829,
288045,
288078,
288117,
290706,
290741,
291698,
292501,
293778,
293973,
296189,
296981,
297341,
297994,
299925,
302410,
303125,
308978,
309013,
309298,
309333,
311058,
311317,
314866,
314901,
322829,
322862,
322893,
322926,
322957,
322990,
323021,
323054,
323085,
323118,
323149,
323182,
323213,
323246,
323274,
324245,
325650,
325805,
325838,
325874,
326861,
326894,
326925,
326958,
326989,
327022,
327053,
327086,
327117,
327150,
327186,
327701,
335890,
340077,
340110,
340141,
340174,
340205,
340238,
340269,
340302,
340333,
340366,
340397,
340430,
340461,
340494,
340525,
340558,
340589,
340622,
340653,
340686,
340717,
340750,
340786,
342797,
342830,
342861,
342894,
342930,
343949,
343982,
344018,
352277,
353810,
354485,
354546,
354741,
355997,
356053,
357085,
357109,
360448,
361981,
361985,
363517,
363520,
363553,
363584,
363681,
363744,
363777,
363808,
363841,
363872,
363905,
363936,
364065,
364096,
364129,
364192,
364225,
364419,
364480,
364577,
364608,
364641,
364672,
364705,
364736,
364769,
364800,
364833,
364864,
364897,
364928,
364961,
364992,
365025,
365056,
365089,
365120,
365153,
365184,
365217,
365248,
365281,
365312,
365345,
365376,
365409,
365440,
365473,
365504,
365537,
365568,
365601,
365632,
365665,
365696,
365729,
365760,
365793,
365824,
365857,
365888,
365921,
365952,
365985,
366016,
366049,
366080,
366113,
366144,
366177,
366208,
366241,
366272,
366305,
366336,
366369,
366400,
366433,
366464,
366497,
366528,
366561,
366592,
366625,
366656,
366689,
366720,
366753,
366784,
366817,
366848,
366881,
366912,
366945,
366976,
367009,
367040,
367073,
367104,
367137,
367168,
367201,
367232,
367265,
367296,
367329,
367360,
367393,
367424,
367457,
367488,
367521,
367552,
367585,
367616,
367649,
367680,
367713,
367797,
367968,
368001,
368032,
368065,
368101,
368192,
368225,
368285,
368433,
368554,
368593,
368641,
369885,
369889,
369949,
370081,
370141,
370180,
371997,
372195,
372241,
372285,
372709,
372740,
373501,
373764,
374013,
374020,
374269,
374276,
374525,
374532,
374781,
374788,
375037,
375044,
375293,
375300,
375549,
375556,
375805,
375813,
376849,
376911,
376944,
376975,
377008,
377041,
377135,
377168,
377201,
377231,
377264,
377297,
377580,
377617,
377676,
377713,
377743,
377776,
377809,
377871,
377904,
377933,
377966,
377997,
378030,
378061,
378094,
378125,
378158,
378193,
378339,
378385,
378700,
378769,
378892,
378929,
378957,
378993,
379413,
379473,
379517,
380949,
381789,
381813,
384669,
385045,
391901,
392725,
393117,
393238,
393265,
393365,
393379,
393412,
393449,
393485,
393518,
393549,
393582,
393613,
393646,
393677,
393710,
393741,
393774,
393813,
393869,
393902,
393933,
393966,
393997,
394030,
394061,
394094,
394124,
394157,
394190,
394261,
394281,
394565,
394694,
394764,
394787,
394965,
395017,
395107,
395140,
395185,
395221,
395293,
395300,
398077,
398117,
398196,
398243,
398308,
398348,
398372,
401265,
401283,
401380,
401437,
401572,
402973,
402980,
406013,
406037,
406090,
406229,
406532,
407573,
408733,
409092,
409621,
410621,
410634,
410965,
411914,
412181,
412202,
412693,
413706,
414037,
415274,
415765,
425988,
636949,
638980,
1310653,
1310724,
1311395,
1311428,
1348029,
1348117,
1349885,
1350148,
1351427,
1351633,
1351684,
1360259,
1360305,
1360388,
1360904,
1361220,
1361309,
1361920,
1361953,
1361984,
1362017,
1362048,
1362081,
1362112,
1362145,
1362176,
1362209,
1362240,
1362273,
1362304,
1362337,
1362368,
1362401,
1362432,
1362465,
1362496,
1362529,
1362560,
1362593,
1362624,
1362657,
1362688,
1362721,
1362752,
1362785,
1362816,
1362849,
1362880,
1362913,
1362944,
1362977,
1363008,
1363041,
1363072,
1363105,
1363136,
1363169,
1363200,
1363233,
1363264,
1363297,
1363328,
1363361,
1363396,
1363429,
1363463,
1363569,
1363589,
1363921,
1363939,
1363968,
1364001,
1364032,
1364065,
1364096,
1364129,
1364160,
1364193,
1364224,
1364257,
1364288,
1364321,
1364352,
1364385,
1364416,
1364449,
1364480,
1364513,
1364544,
1364577,
1364608,
1364641,
1364672,
1364705,
1364736,
1364769,
1364800,
1364833,
1364867,
1364933,
1364996,
1367241,
1367557,
1367633,
1367837,
1368084,
1368803,
1369108,
1369152,
1369185,
1369216,
1369249,
1369280,
1369313,
1369344,
1369377,
1369408,
1369441,
1369472,
1369505,
1369536,
1369569,
1369664,
1369697,
1369728,
1369761,
1369792,
1369825,
1369856,
1369889,
1369920,
1369953,
1369984,
1370017,
1370048,
1370081,
1370112,
1370145,
1370176,
1370209,
1370240,
1370273,
1370304,
1370337,
1370368,
1370401,
1370432,
1370465,
1370496,
1370529,
1370560,
1370593,
1370624,
1370657,
1370688,
1370721,
1370752,
1370785,
1370816,
1370849,
1370880,
1370913,
1370944,
1370977,
1371008,
1371041,
1371072,
1371105,
1371136,
1371169,
1371200,
1371233,
1371264,
1371297,
1371328,
1371361,
1371392,
1371425,
1371456,
1371489,
1371520,
1371553,
1371584,
1371617,
1371651,
1371681,
1371936,
1371969,
1372000,
1372033,
1372064,
1372129,
1372160,
1372193,
1372224,
1372257,
1372288,
1372321,
1372352,
1372385,
1372419,
1372468,
1372512,
1372545,
1372576,
1372609,
1372644,
1372672,
1372705,
1372736,
1372769,
1372864,
1372897,
1372928,
1372961,
1372992,
1373025,
1373056,
1373089,
1373120,
1373153,
1373184,
1373217,
1373248,
1373281,
1373312,
1373345,
1373376,
1373409,
1373440,
1373473,
1373504,
1373665,
1373696,
1373857,
1373888,
1373921,
1373952,
1373985,
1374016,
1374049,
1374080,
1374113,
1374144,
1374177,
1374237,
1374272,
1374305,
1374336,
1374465,
1374496,
1374529,
1374589,
1375904,
1375937,
1375972,
1376003,
1376065,
1376100,
1376325,
1376356,
1376453,
1376484,
1376613,
1376644,
1377382,
1377445,
1377510,
1377557,
1377669,
1377725,
1377802,
1378005,
1378067,
1378101,
1378141,
1378308,
1379985,
1380125,
1380358,
1380420,
1382022,
1382533,
1382621,
1382865,
1382920,
1383261,
1383429,
1384004,
1384209,
1384292,
1384337,
1384356,
1384421,
1384456,
1384772,
1385669,
1385937,
1385988,
1386725,
1387078,
1387165,
1387505,
1387524,
1388477,
1388549,
1388646,
1388676,
1390181,
1390214,
1390277,
1390406,
1390469,
1390534,
1390641,
1391069,
1391075,
1391112,
1391453,
1391569,
1391620,
1391781,
1391811,
1391844,
1392136,
1392452,
1392637,
1392644,
1393957,
1394150,
1394213,
1394278,
1394341,
1394429,
1394692,
1394789,
1394820,
1395077,
1395110,
1395165,
1395208,
1395549,
1395601,
1395716,
1396227,
1396260,
1396469,
1396548,
1396582,
1396613,
1396646,
1396676,
1398277,
1398308,
1398341,
1398436,
1398501,
1398564,
1398725,
1398788,
1398821,
1398852,
1398909,
1399652,
1399715,
1399761,
1399812,
1400166,
1400197,
1400262,
1400337,
1400388,
1400419,
1400486,
1400517,
1400573,
1400868,
1401085,
1401124,
1401341,
1401380,
1401597,
1401860,
1402109,
1402116,
1402365,
1402369,
1403764,
1403779,
1403905,
1404195,
1404244,
1404317,
1404417,
1406980,
1408102,
1408165,
1408198,
1408261,
1408294,
1408369,
1408390,
1408421,
1408477,
1408520,
1408861,
1409028,
1766557,
1766916,
1767677,
1767780,
1769373,
1769499,
1835036,
2039812,
2051549,
2051588,
2055005,
2056193,
2056445,
2056801,
2056989,
2057124,
2057157,
2057188,
2057522,
2057540,
2057981,
2057988,
2058173,
2058180,
2058237,
2058244,
2058333,
2058340,
2058429,
2058436,
2061908,
2062429,
2062948,
2074574,
2074605,
2074653,
2075140,
2077213,
2077252,
2079005,
2080260,
2080659,
2080693,
2080733,
2080773,
2081297,
2081517,
2081550,
2081585,
2081629,
2081797,
2082321,
2082348,
2082411,
2082477,
2082510,
2082541,
2082574,
2082605,
2082638,
2082669,
2082702,
2082733,
2082766,
2082797,
2082830,
2082861,
2082894,
2082925,
2082958,
2082993,
2083053,
2083086,
2083121,
2083243,
2083345,
2083453,
2083473,
2083596,
2083629,
2083662,
2083693,
2083726,
2083757,
2083790,
2083825,
2083922,
2083948,
2083986,
2084093,
2084113,
2084147,
2084177,
2084253,
2084356,
2084541,
2084548,
2088893,
2088954,
2088989,
2089009,
2089107,
2089137,
2089229,
2089262,
2089297,
2089330,
2089361,
2089388,
2089425,
2089480,
2089809,
2089874,
2089969,
2090016,
2090861,
2090897,
2090926,
2090964,
2090987,
2091028,
2091041,
2091885,
2091922,
2091950,
2091986,
2092013,
2092046,
2092081,
2092109,
2092142,
2092177,
2092228,
2092547,
2092580,
2094019,
2094084,
2095101,
2095172,
2095389,
2095428,
2095645,
2095684,
2095901,
2095940,
2096061,
2096147,
2096210,
2096244,
2096277,
2096307,
2096381,
2096405,
2096434,
2096565,
2096637,
2096954,
2097045,
2097117,
2097156,
2097565,
2097572,
2098429,
2098436,
2099069,
2099076,
2099165,
2099172,
2099677,
2099716,
2100189,
2101252,
2105213,
2105361,
2105469,
2105578,
2107037,
2107125,
2107401,
2109098,
2109237,
2109770,
2109845,
2109949,
2109973,
2110397,
2110485,
2110525,
2112021,
2113445,
2113501,
2117636,
2118589,
2118660,
2120253,
2120709,
2120746,
2121629,
2121732,
2122762,
2122909,
2123172,
2123817,
2123844,
2124105,
2124157,
2124292,
2125509,
2125693,
2125828,
2126813,
2126833,
2126852,
2128029,
2128132,
2128401,
2128425,
2128605,
2129920,
2131201,
2132484,
2135005,
2135048,
2135389,
2135552,
2136733,
2136833,
2138013,
2138116,
2139421,
2139652,
2141341,
2141681,
2141725,
2146308,
2156285,
2156548,
2157277,
2157572,
2157853,
2162692,
2162909,
2162948,
2163005,
2163012,
2164445,
2164452,
2164541,
2164612,
2164669,
2164708,
2165469,
2165489,
2165514,
2165764,
2166517,
2166570,
2166788,
2167805,
2168042,
2168349,
2169860,
2170493,
2170500,
2170589,
2170730,
2170884,
2171594,
2171805,
2171889,
2171908,
2172765,
2172913,
2172957,
2174980,
2176797,
2176906,
2176964,
2177034,
2177565,
2177610,
2179076,
2179109,
2179229,
2179237,
2179325,
2179461,
2179588,
2179741,
2179748,
2179869,
2179876,
2180829,
2180869,
2180989,
2181093,
2181130,
2181437,
2181649,
2181949,
2182148,
2183082,
2183153,
2183172,
2184106,
2184221,
2185220,
2185493,
2185508,
2186405,
2186493,
2186602,
2186769,
2187005,
2187268,
2189021,
2189105,
2189316,
2190045,
2190090,
2190340,
2190973,
2191114,
2191364,
2191965,
2192177,
2192317,
2192682,
2192925,
2195460,
2197821,
2199552,
2201213,
2201601,
2203261,
2203466,
2203652,
2204805,
2204957,
2205192,
2205533,
2214922,
2215933,
2215940,
2217309,
2217317,
2217388,
2217437,
2217476,
2217565,
2220036,
2220970,
2221284,
2221341,
2221572,
2222277,
2222634,
2222769,
2222941,
2225668,
2226346,
2226589,
2227204,
2227965,
2228230,
2228261,
2228294,
2228324,
2230021,
2230513,
2230749,
2230858,
2231496,
2231837,
2232293,
2232390,
2232420,
2233862,
2233957,
2234086,
2234149,
2234225,
2234298,
2234321,
2234461,
2234810,
2234845,
2234884,
2235709,
2235912,
2236253,
2236421,
2236516,
2237669,
2237830,
2237861,
2238141,
2238152,
2238481,
2238596,
2238630,
2238692,
2238749,
2238980,
2240101,
2240145,
2240196,
2240253,
2240517,
2240582,
2240612,
2242150,
2242245,
2242534,
2242596,
2242737,
2242853,
2242993,
2243014,
2243045,
2243080,
2243396,
2243441,
2243460,
2243505,
2243613,
2243626,
2244285,
2244612,
2245213,
2245220,
2246022,
2246117,
2246214,
2246277,
2246310,
2246341,
2246417,
2246597,
2246653,
2248708,
2248957,
2248964,
2249021,
2249028,
2249181,
2249188,
2249693,
2249700,
2250033,
2250077,
2250244,
2251749,
2251782,
2251877,
2252157,
2252296,
2252637,
2252805,
2252870,
2252957,
2252964,
2253245,
2253284,
2253373,
2253412,
2254141,
2254148,
2254397,
2254404,
2254493,
2254500,
2254685,
2254693,
2254756,
2254790,
2254853,
2254886,
2255037,
2255078,
2255165,
2255206,
2255325,
2255364,
2255421,
2255590,
2255645,
2255780,
2255942,
2256029,
2256069,
2256317,
2256389,
2256573,
2260996,
2262694,
2262789,
2263046,
2263109,
2263206,
2263237,
2263268,
2263409,
2263560,
2263889,
2263965,
2263985,
2264005,
2264036,
2264157,
2265092,
2266630,
2266725,
2266918,
2266949,
2266982,
2267109,
2267174,
2267205,
2267268,
2267345,
2267364,
2267421,
2267656,
2267997,
2273284,
2274790,
2274885,
2275037,
2275078,
2275205,
2275270,
2275301,
2275377,
2276100,
2276229,
2276317,
2277380,
2278918,
2279013,
2279270,
2279333,
2279366,
2279397,
2279473,
2279556,
2279613,
2279944,
2280285,
2280465,
2280893,
2281476,
2282853,
2282886,
2282917,
2282950,
2283013,
2283206,
2283237,
2283268,
2283325,
2283528,
2283869,
2285572,
2286461,
2286501,
2286598,
2286661,
2286790,
2286821,
2287005,
2287112,
2287434,
2287505,
2287605,
2287645,
2293764,
2295174,
2295269,
2295558,
2295589,
2295665,
2295709,
2298880,
2299905,
2300936,
2301258,
2301565,
2301924,
2302205,
2302244,
2302301,
2302340,
2302621,
2302628,
2302717,
2302724,
2303494,
2303709,
2303718,
2303805,
2303845,
2303910,
2303941,
2303972,
2304006,
2304036,
2304070,
2304101,
2304145,
2304253,
2304520,
2304861,
2307076,
2307357,
2307396,
2308646,
2308741,
2308893,
2308933,
2308998,
2309125,
2309156,
2309201,
2309220,
2309254,
2309309,
2310148,
2310181,
2310500,
2311781,
2311974,
2312004,
2312037,
2312177,
2312421,
2312477,
2312708,
2312741,
2312934,
2312997,
2313092,
2314565,
2314982,
2315013,
2315089,
2315172,
2315217,
2315389,
2316292,
2318141,
2326532,
2326845,
2326852,
2328038,
2328069,
2328317,
2328325,
2328518,
2328549,
2328580,
2328625,
2328797,
2329096,
2329418,
2330045,
2330129,
2330180,
2331165,
2331205,
2331933,
2331942,
2331973,
2332198,
2332229,
2332294,
2332325,
2332413,
2334724,
2334973,
2334980,
2335069,
2335076,
2336293,
2336509,
2336581,
2336637,
2336645,
2336733,
2336741,
2336964,
2336997,
2337053,
2337288,
2337629,
2337796,
2338013,
2338020,
2338109,
2338116,
2339142,
2339325,
2339333,
2339421,
2339430,
2339493,
2339526,
2339557,
2339588,
2339645,
2339848,
2340189,
2350084,
2350693,
2350758,
2350833,
2350909,
2356740,
2356797,
2357258,
2357941,
2358195,
2358325,
2358877,
2359281,
2359300,
2388829,
2392073,
2395645,
2395665,
2395837,
2396164,
2402461,
2490372,
2524669,
2524698,
2524989,
2654212,
2672893,
2949124,
2967357,
2967556,
2968573,
2968584,
2968925,
2969041,
2969117,
2972164,
2973149,
2973189,
2973361,
2973405,
2973700,
2975237,
2975473,
2975637,
2975747,
2975889,
2975925,
2975965,
2976264,
2976605,
2976618,
2976861,
2976868,
2977565,
2977700,
2978333,
3000320,
3001345,
3002378,
3003121,
3003261,
3006468,
3008893,
3008997,
3009028,
3009062,
3010845,
3011045,
3011171,
3011613,
3013635,
3013713,
3013731,
3013765,
3013821,
3014150,
3014237,
3014660,
3211037,
3211268,
3250909,
3252228,
3252541,
3538948,
3548157,
3549700,
3549821,
3550340,
3550493,
3550724,
3563421,
3637252,
3640701,
3640836,
3641277,
3641348,
3641661,
3641860,
3642205,
3642261,
3642277,
3642353,
3642394,
3642525,
3801109,
3808989,
3809301,
3810557,
3810613,
3812518,
3812581,
3812693,
3812774,
3812986,
3813221,
3813493,
3813541,
3813781,
3814725,
3814869,
3816765,
3817493,
3819589,
3819701,
3819741,
3824650,
3825309,
3825685,
3828477,
3828746,
3829565,
3833856,
3834689,
3835520,
3836353,
3836605,
3836609,
3837184,
3838017,
3838848,
3838909,
3838912,
3839005,
3839040,
3839101,
3839136,
3839229,
3839264,
3839421,
3839424,
3839681,
3839837,
3839841,
3839901,
3839905,
3840157,
3840161,
3840512,
3841345,
3842176,
3842269,
3842272,
3842429,
3842464,
3842749,
3842752,
3843005,
3843009,
3843840,
3843933,
3843936,
3844093,
3844096,
3844285,
3844288,
3844349,
3844416,
3844669,
3844673,
3845504,
3846337,
3847168,
3848001,
3848832,
3849665,
3850496,
3851329,
3852160,
3852993,
3853824,
3854657,
3855581,
3855616,
3856434,
3856449,
3857266,
3857281,
3857472,
3858290,
3858305,
3859122,
3859137,
3859328,
3860146,
3860161,
3860978,
3860993,
3861184,
3862002,
3862017,
3862834,
3862849,
3863040,
3863858,
3863873,
3864690,
3864705,
3864896,
3864929,
3864989,
3865032,
3866645,
3883013,
3884789,
3884901,
3886517,
3886757,
3886805,
3887237,
3887285,
3887345,
3887517,
3887973,
3888157,
3888165,
3888669,
3932165,
3932413,
3932421,
3932989,
3933029,
3933277,
3933285,
3933373,
3933381,
3933565,
3940356,
3941821,
3941893,
3942115,
3942365,
3942408,
3942749,
3942852,
3942901,
3942941,
3954692,
3956101,
3956232,
3956573,
3956723,
3956765,
3997700,
4004029,
4004074,
4004357,
4004605,
4005888,
4006977,
4008069,
4008291,
4008349,
4008456,
4008797,
4008913,
4008989,
4034090,
4035989,
4036010,
4036115,
4036138,
4036285,
4038698,
4040149,
4040170,
4040669,
4046852,
4047005,
4047012,
4047901,
4047908,
4047997,
4048004,
4048061,
4048100,
4048157,
4048164,
4048509,
4048516,
4048669,
4048676,
4048733,
4048740,
4048797,
4048964,
4049021,
4049124,
4049181,
4049188,
4049245,
4049252,
4049309,
4049316,
4049437,
4049444,
4049533,
4049540,
4049597,
4049636,
4049693,
4049700,
4049757,
4049764,
4049821,
4049828,
4049885,
4049892,
4049949,
4049956,
4050045,
4050052,
4050109,
4050148,
4050301,
4050308,
4050557,
4050564,
4050717,
4050724,
4050877,
4050884,
4050941,
4050948,
4051293,
4051300,
4051869,
4052004,
4052125,
4052132,
4052317,
4052324,
4052893,
4054546,
4054621,
4063253,
4064669,
4064789,
4067997,
4068373,
4068861,
4068917,
4069405,
4069429,
4069917,
4069941,
4071133,
4071434,
4071861,
4077021,
4078805,
4079741,
4080149,
4081565,
4081685,
4081981,
4082197,
4082269,
4082709,
4082909,
4087829,
4095860,
4096021,
4119325,
4119573,
4119997,
4120085,
4120509,
4120597,
4124317,
4124693,
4127549,
4127765,
4128157,
4128789,
4129181,
4129301,
4131101,
4131349,
4131677,
4131861,
4133149,
4133397,
4134365,
4134421,
4134493,
4136981,
4140861,
4140885,
4143517,
4143541,
4147869,
4148245,
4148701,
4148757,
4148925,
4149013,
4149117,
4149269,
4149501,
4149781,
4150589,
4150805,
4151037,
4151317,
4151421,
4151829,
4152061,
4153365,
4158077,
4158101,
4159869,
4161032,
4161373,
4194308,
5561309,
5562372,
5695165,
5695492,
5702621,
5702660,
5887069,
5887492,
6126653,
6225924,
6243293,
6291460,
6449533,
29360186,
29360221,
29361178,
29364253,
29368325,
29376029,
31457308,
33554397,
33554460,
35651549,
35651613,
};
#else
const unsigned char catTable1[] = {
0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
40, 42, 44, 46, 48, 50, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 54, 52,
52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 56,
58, 52, 60, 62, 64, 66, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
52, 52, 52, 52, 52, 52, 52, 68, 70, 70, 70, 70, 72, 72, 72, 72, 72, 72, 72, 72,
72, 72, 72, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104,
106, 108, 110, 112, 52, 114, 116, 118, 118, 118, 118, 118, 52, 52, 120, 118, 118, 118, 118, 118,
118, 118, 52, 122, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
52, 124, 118, 126, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 128, 52, 52, 130, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 132, 134, 118, 118,
118, 118, 136, 118, 118, 118, 118, 118, 118, 118, 118, 118, 138, 140, 142, 144, 146, 148, 118, 118,
150, 152, 118, 118, 154, 118, 156, 158, 160, 162, 146, 164, 166, 168, 118, 118, 52, 52, 52, 52,
52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 170,
52, 52, 52, 52, 52, 52, 52, 172, 174, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 176,
52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 178, 118, 118, 118, 118, 118, 118,
52, 180, 118, 118, 52, 52, 52, 52, 52, 52, 52, 52, 52, 182, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 184, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
72, 72, 72, 72, 72, 72, 72, 186, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 186,
};
const unsigned short catTable2[] = {
0, 0, 16, 32, 48, 64, 80, 96, 0, 0, 112, 128, 144, 160, 176, 192, 208, 208, 208, 224,
240, 208, 208, 256, 272, 288, 304, 320, 336, 352, 208, 368, 208, 208, 208, 384, 400, 176, 176, 176,
176, 416, 176, 432, 448, 464, 480, 496, 512, 512, 512, 512, 512, 512, 512, 528, 544, 560, 576, 176,
592, 608, 208, 624, 144, 144, 144, 176, 176, 176, 208, 208, 640, 208, 208, 208, 656, 208, 208, 208,
208, 208, 208, 672, 144, 688, 176, 176, 704, 720, 512, 736, 752, 768, 784, 800, 816, 832, 768, 768,
848, 512, 864, 880, 768, 768, 768, 768, 768, 896, 912, 928, 944, 960, 768, 512, 976, 768, 768, 768,
768, 768, 992, 1008, 1024, 768, 1040, 1056, 768, 1072, 1088, 1104, 768, 1120, 1136, 1152, 1152, 1152, 768, 1168,
1184, 1200, 1216, 512, 1232, 768, 768, 1248, 1264, 1280, 1296, 1312, 1328, 1344, 1360, 1376, 1392, 1408, 1424, 1440,
1456, 1344, 1360, 1472, 1488, 1504, 1520, 1536, 1552, 1568, 1360, 1584, 1600, 1616, 1424, 1632, 1648, 1344, 1360, 1664,
1680, 1696, 1424, 1712, 1728, 1744, 1760, 1776, 1792, 1808, 1520, 1824, 1840, 1856, 1360, 1872, 1888, 1904, 1424, 1920,
1936, 1856, 1360, 1952, 1968, 1984, 1424, 2000, 2016, 1856, 768, 2032, 2048, 2064, 1424, 2080, 2096, 2112, 768, 2128,
2144, 2160, 1520, 2176, 2192, 768, 768, 2208, 2224, 2240, 1152, 1152, 2256, 768, 2272, 2288, 2304, 2320, 1152, 1152,
2336, 2352, 2368, 2384, 2400, 768, 2416, 2432, 2448, 2464, 512, 2480, 2496, 2512, 1152, 1152, 768, 768, 2528, 2544,
2560, 2576, 2592, 2608, 2624, 2640, 144, 144, 2656, 176, 176, 2672, 768, 768, 768, 768, 768, 768, 768, 768,
768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 2688, 2704, 768, 768, 2688, 768, 768, 2720,
2736, 2752, 768, 768, 768, 2736, 768, 768, 768, 2768, 2784, 2800, 768, 2816, 144, 144, 144, 144, 144, 2832,
2848, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768,
768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 2864, 768,
2880, 2896, 768, 768, 768, 768, 2912, 2928, 2944, 2960, 768, 2976, 768, 2992, 2944, 3008, 768, 768, 768, 3024,
3040, 3056, 3072, 3088, 3104, 3072, 768, 768, 3120, 768, 768, 3136, 3152, 768, 3168, 768, 768, 768, 768, 3184,
768, 3200, 3216, 3232, 3248, 768, 3264, 3280, 768, 768, 3296, 768, 3312, 3328, 3344, 3344, 768, 3360, 768, 768,
768, 3376, 3392, 3408, 3072, 3072, 3424, 3440, 3456, 1152, 1152, 1152, 3472, 768, 768, 3488, 3504, 2560, 3520, 3536,
3552, 768, 3568, 1024, 768, 768, 3584, 3600, 768, 768, 3616, 3632, 3648, 1024, 768, 3664, 3680, 144, 144, 3696,
3712, 3728, 3744, 3760, 176, 176, 3776, 432, 432, 432, 3792, 3808, 176, 3824, 432, 432, 512, 512, 512, 3840,
208, 208, 208, 208, 208, 208, 208, 208, 208, 3856, 208, 208, 208, 208, 208, 208, 3872, 3888, 3872, 3872,
3888, 3904, 3872, 3920, 3936, 3936, 3936, 3952, 3968, 3984, 4000, 4016, 4032, 4048, 4064, 4080, 4096, 4112, 4128, 4144,
4160, 4176, 4192, 4192, 1152, 4208, 4224, 3456, 4240, 4256, 4272, 4288, 4304, 4320, 4336, 4336, 4352, 4368, 4384, 3344,
4400, 4416, 3344, 4432, 4448, 4448, 4448, 4448, 4448, 4448, 4448, 4448, 4448, 4448, 4448, 4448, 4448, 4448, 4448, 4448,
4464, 3344, 4480, 3344, 3344, 3344, 3344, 4496, 3344, 4512, 4448, 4528, 3344, 4544, 4560, 3344, 3344, 3344, 4576, 1152,
4592, 1152, 4320, 4320, 4320, 4608, 3344, 3344, 3344, 3344, 4624, 4320, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344,
3344, 3344, 3344, 4640, 4656, 3344, 3344, 4672, 3344, 3344, 3344, 3344, 3344, 3344, 4688, 3344, 3344, 3344, 3344, 3344,
3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 4704, 4720, 4320, 4736, 3344, 3344, 4752, 4448, 4768, 4448,
3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 4448, 4448, 4448, 4448,
4448, 4448, 4448, 4448, 4784, 4800, 4448, 4448, 4448, 4816, 4448, 4832, 4448, 4448, 4448, 4448, 4448, 4448, 4448, 4448,
4448, 4448, 4448, 4448, 4448, 4448, 4448, 4448, 3344, 3344, 3344, 4448, 4848, 3344, 3344, 4864, 3344, 4880, 3344, 3344,
3344, 3344, 3344, 3344, 144, 144, 4896, 176, 176, 4912, 4928, 4944, 208, 208, 208, 208, 208, 208, 4960, 4976,
176, 176, 4992, 768, 768, 768, 5008, 5024, 768, 5040, 5056, 5056, 5056, 5056, 512, 512, 5072, 5088, 5104, 5120,
5136, 5152, 1152, 1152, 3344, 5168, 3344, 3344, 3344, 3344, 3344, 5184, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344,
3344, 3344, 3344, 3344, 3344, 5200, 1152, 5216, 5232, 5248, 5264, 5280, 2192, 768, 768, 768, 768, 5296, 2848, 768,
768, 768, 768, 5312, 5328, 768, 768, 2192, 768, 768, 768, 768, 3200, 5344, 768, 768, 3344, 3344, 5184, 768,
3344, 5360, 5376, 3344, 5392, 5408, 3344, 3344, 5376, 3344, 3344, 5408, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344,
3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 768, 768, 768, 768, 768, 768, 768, 768,
768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768,
768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768,
768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 3344, 3344, 3344, 3344, 768, 768, 768, 768,
768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768,
768, 768, 768, 768, 768, 768, 768, 2416, 768, 5424, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768,
768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768,
768, 768, 768, 768, 768, 768, 768, 768, 2416, 3344, 3344, 3344, 4576, 768, 768, 3664, 768, 768, 768, 768,
768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 5440, 768, 5456, 1152, 208, 208, 5472, 5488,
208, 5504, 768, 768, 768, 768, 5520, 5536, 496, 5552, 5568, 5584, 208, 208, 208, 5600, 5616, 5632, 5648, 5664,
5680, 1152, 1152, 5696, 5712, 768, 5728, 5744, 768, 768, 768, 5760, 5776, 768, 768, 5792, 5808, 3072, 512, 5824,
1024, 768, 5840, 768, 5856, 5872, 768, 2416, 1232, 768, 768, 5888, 5904, 5920, 5936, 5952, 768, 768, 5968, 5984,
6000, 6016, 768, 6032, 768, 768, 768, 6048, 6064, 6080, 6096, 6112, 6128, 6144, 5056, 176, 176, 6160, 6176, 176,
176, 176, 176, 176, 768, 768, 6192, 3072, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768,
768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 6208, 768, 6224, 768, 768, 3296,
6240, 6240, 6240, 6240, 6240, 6240, 6240, 6240, 6240, 6240, 6240, 6240, 6240, 6240, 6240, 6240, 6240, 6240, 6240, 6240,
6240, 6240, 6240, 6240, 6240, 6240, 6240, 6240, 6240, 6240, 6240, 6240, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256,
6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256,
6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256,
768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768,
768, 768, 3264, 768, 768, 768, 768, 768, 768, 3312, 1152, 1152, 6272, 6288, 6304, 6320, 6336, 768, 768, 768,
768, 768, 768, 6352, 6368, 6384, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768,
768, 768, 768, 768, 768, 768, 768, 6400, 1152, 768, 768, 768, 768, 6416, 768, 768, 1184, 1152, 1152, 6432,
512, 6448, 512, 6464, 6480, 6496, 6512, 1168, 768, 768, 768, 768, 768, 768, 768, 6528, 6544, 32, 48, 64,
80, 6560, 6576, 6592, 768, 6608, 768, 3200, 6624, 6640, 6656, 6672, 6688, 768, 2752, 6704, 3264, 3264, 1152, 1152,
768, 768, 768, 768, 768, 768, 768, 1136, 6720, 4320, 4320, 6736, 4336, 4336, 4336, 6752, 6768, 6784, 6800, 1152,
1152, 3344, 3344, 6816, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 768, 2416, 768, 768, 768, 1616, 6832, 6848,
768, 768, 6864, 768, 6880, 768, 768, 6896, 768, 6912, 768, 768, 6928, 6944, 1152, 1152, 144, 144, 6960, 176,
176, 768, 768, 768, 768, 3264, 3072, 144, 144, 6976, 176, 6992, 768, 768, 1184, 768, 768, 768, 7008, 1152,
1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768,
768, 768, 768, 768, 768, 768, 768, 5040, 768, 3184, 1184, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152,
7024, 768, 768, 7040, 768, 7056, 768, 7072, 768, 3200, 7088, 1152, 1152, 1152, 768, 7104, 768, 7120, 768, 7136,
1152, 1152, 1152, 1152, 768, 768, 768, 7152, 4320, 7168, 4320, 4320, 7184, 7200, 768, 7216, 7232, 7248, 768, 7264,
768, 7280, 1152, 1152, 7296, 768, 7312, 7328, 768, 768, 768, 7344, 768, 7360, 768, 7376, 768, 7392, 7408, 1152,
1152, 1152, 1152, 1152, 768, 768, 768, 768, 3136, 1152, 1152, 1152, 144, 144, 144, 7424, 176, 176, 176, 7440,
768, 768, 7456, 3072, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152,
1152, 1152, 4320, 7472, 768, 768, 7488, 7504, 1152, 1152, 1152, 1152, 768, 7280, 7520, 768, 992, 7536, 1152, 1152,
1152, 1152, 1152, 768, 7552, 1152, 768, 5040, 7568, 768, 768, 7584, 7600, 7168, 7616, 7632, 3552, 768, 768, 7648,
7664, 768, 3136, 3072, 7680, 768, 7696, 7712, 7728, 768, 768, 7744, 3552, 768, 768, 7760, 7776, 7792, 7808, 7824,
768, 1568, 7840, 7856, 1152, 1152, 1152, 1152, 7872, 7888, 7904, 768, 768, 7920, 7936, 3072, 7952, 1344, 1360, 7968,
7984, 8000, 8016, 8032, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 768, 768, 768, 8048, 8064, 8080, 7504, 1152,
768, 768, 768, 8096, 8112, 3072, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 768, 768, 8128, 8144,
8160, 8176, 1152, 1152, 768, 768, 768, 8192, 8208, 3072, 8224, 1152, 768, 768, 8240, 8256, 3072, 1152, 1152, 1152,
768, 2768, 8272, 8288, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 768, 768, 7840, 8304,
1152, 1152, 1152, 1152, 1152, 1152, 144, 144, 176, 176, 2368, 8320, 8336, 8352, 768, 8368, 8384, 3072, 1152, 1152,
1152, 1152, 8400, 768, 768, 8416, 8432, 1152, 8448, 768, 768, 8464, 8480, 8496, 768, 768, 8512, 8528, 8544, 1152,
768, 768, 768, 3136, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152,
1360, 768, 8128, 8560, 8576, 2368, 2800, 8592, 768, 8608, 8624, 8640, 1152, 1152, 1152, 1152, 8656, 768, 768, 8672,
8688, 3072, 8704, 768, 8720, 8736, 3072, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152,
1152, 1152, 1152, 1152, 1152, 1152, 768, 8752, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1616,
4320, 8768, 8784, 8800, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768,
768, 768, 768, 768, 768, 768, 768, 768, 768, 3312, 1152, 1152, 1152, 1152, 1152, 1152, 4336, 4336, 4336, 4336,
4336, 4336, 8816, 8832, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 6208, 1152, 1152, 1152,
1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152,
1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152,
768, 768, 3200, 8848, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152,
1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 768, 768, 768, 768, 5040, 1152, 1152, 1152,
1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152,
1152, 1152, 1152, 1152, 768, 768, 768, 3136, 768, 3200, 5920, 1152, 1152, 1152, 1152, 1152, 1152, 768, 3264, 8864,
768, 768, 768, 8880, 8896, 8912, 8928, 8944, 768, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152,
144, 144, 176, 176, 4320, 8960, 1152, 1152, 1152, 1152, 1152, 1152, 768, 768, 768, 768, 8976, 8992, 9008, 9008,
9024, 9040, 1152, 1152, 1152, 1152, 9056, 9072, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768,
768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 1184,
768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 3184, 1152, 1152, 3136, 1152, 1152, 1152,
1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 768, 768, 768, 768, 768, 768, 768, 768,
768, 768, 768, 768, 768, 768, 768, 768, 768, 3200, 1152, 1152, 1152, 9088, 9104, 768, 768, 768, 768, 768,
768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 3296,
1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 768, 768, 768, 768,
768, 768, 1136, 2416, 3136, 9120, 9136, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152,
1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344,
3344, 3344, 3344, 5200, 3344, 3344, 9152, 3344, 3344, 3344, 9168, 9184, 9200, 3344, 9216, 3344, 3344, 3344, 9232, 1152,
3344, 3344, 3344, 3344, 9248, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 4320, 9264, 3344, 3344, 3344, 3344,
3344, 4576, 4320, 7232, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 144, 9280, 176, 9296, 9312, 9328, 3872, 144,
9344, 9360, 9376, 9392, 9408, 144, 9280, 176, 9424, 9440, 176, 9456, 9472, 9488, 9504, 144, 9520, 176, 144, 9280,
176, 9296, 9312, 176, 3872, 144, 9344, 9504, 144, 9520, 176, 144, 9280, 176, 9536, 144, 9552, 9568, 9584, 9600,
176, 9616, 144, 9632, 9648, 9664, 9680, 176, 9696, 144, 9712, 176, 9728, 9744, 9744, 9744, 3344, 3344, 3344, 3344,
3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344,
3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 512, 512, 512, 9760, 512, 512, 9776, 9792, 9808, 9824, 720, 1152,
1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152,
9840, 9856, 9872, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 768, 768, 2416, 9888,
9904, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152,
1152, 1152, 1152, 1152, 768, 768, 9920, 9936, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152,
1152, 1152, 1152, 1152, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 9952, 9968, 1152, 1152,
144, 144, 9344, 176, 9984, 5920, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152,
1152, 1152, 1152, 7808, 4320, 4320, 10000, 10016, 1152, 1152, 1152, 1152, 7808, 4320, 10032, 10048, 1152, 1152, 1152, 1152,
1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 10064, 768, 10080, 10096, 10112, 10128, 10144, 10160, 10176, 3296, 10192, 3296,
1152, 1152, 1152, 10208, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152,
3344, 3344, 5216, 3344, 3344, 3344, 3344, 3344, 3344, 5184, 5360, 10224, 10224, 10224, 3344, 5200, 10240, 3344, 3344, 3344,
3344, 3344, 3344, 3344, 3344, 3344, 10256, 1152, 1152, 1152, 10272, 3344, 10288, 3344, 3344, 5216, 9232, 10304, 5200, 1152,
1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344,
3344, 3344, 3344, 10320, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 10336, 6784, 6784,
3344, 3344, 3344, 3344, 3344, 3344, 3344, 5184, 3344, 3344, 3344, 3344, 3344, 9232, 5216, 1152, 5216, 3344, 3344, 3344,
10336, 2816, 3344, 3344, 10336, 3344, 10256, 10304, 1152, 1152, 1152, 1152, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 10352,
3344, 3344, 3344, 3344, 10368, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 5184, 10256, 10384, 4576, 3344, 9232, 4576,
10288, 4576, 1152, 1152, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 3344, 10400, 3344, 3344, 4592, 1152, 1152, 3072,
768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 3264, 1152, 1152, 768, 768, 768, 768,
768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768,
768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 3280, 768, 768, 768, 768, 768, 768, 768, 768,
768, 768, 768, 768, 768, 3264, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768,
768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768,
768, 768, 768, 768, 768, 768, 7504, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768,
768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768,
768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 1616, 1152,
768, 3264, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152,
1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 768, 768, 768, 768, 768, 768, 768, 768,
768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 768, 1136, 1152, 1152, 1152, 1152, 1152, 1152, 1152,
1152, 1152, 1152, 1152, 10416, 1152, 10432, 10432, 10432, 10432, 10432, 10432, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152,
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 1152, 6256, 6256, 6256, 6256,
6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256, 6256,
6256, 6256, 6256, 6256, 6256, 6256, 6256, 10448,
};
const unsigned char catTable[] = {
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 22, 17, 17, 17,
19, 17, 17, 17, 13, 14, 17, 18, 17, 12, 17, 17, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 17, 17, 18, 18, 18, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 17, 14, 20, 11,
20, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 13, 18, 14, 18, 25, 22, 17, 19, 19, 19, 19, 21, 17,
20, 21, 4, 15, 18, 26, 21, 20, 21, 18, 10, 10, 20, 1, 17, 17, 20, 10, 4, 16,
10, 10, 10, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 18,
1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0,
1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0,
1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1,
0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0,
1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 4, 0, 1, 1, 1, 4, 4, 4, 4,
0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 2, 1, 0, 1, 0, 0, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1,
1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1,
4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 20, 20, 20, 20, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
3, 3, 3, 3, 3, 20, 20, 20, 20, 20, 20, 20, 3, 20, 3, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 0, 1, 0, 1, 3, 20, 0, 1, 29, 29, 3, 1,
1, 1, 17, 0, 29, 29, 29, 29, 20, 20, 0, 17, 0, 0, 0, 29, 0, 29, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1,
0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 18, 0, 1, 0, 0, 1, 1, 0, 0, 0,
0, 1, 21, 5, 5, 5, 5, 5, 7, 7, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0,
1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 29, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 29, 3, 17, 17,
17, 17, 17, 17, 1, 1, 1, 1, 1, 1, 1, 1, 1, 17, 12, 29, 29, 21, 21, 19,
29, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 12, 5, 17, 5, 5, 17, 5, 5, 17, 5,
29, 29, 29, 29, 29, 29, 29, 29, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 29, 29, 29, 29, 4,
4, 4, 4, 17, 17, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 26, 26, 26, 26,
26, 26, 18, 18, 18, 17, 17, 19, 17, 17, 21, 21, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 17, 26, 29, 17, 17, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5,
5, 5, 5, 5, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 17, 17, 17, 17, 4, 4,
5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
17, 4, 5, 5, 5, 5, 5, 5, 5, 26, 21, 5, 5, 5, 5, 5, 5, 3, 3, 5,
5, 21, 5, 5, 5, 5, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4,
4, 21, 21, 4, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 29, 26,
4, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 29, 29, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5,
3, 3, 21, 17, 17, 17, 3, 29, 29, 5, 19, 19, 4, 4, 4, 4, 4, 4, 5, 5,
5, 5, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 5, 5, 5, 3, 5, 5, 5,
5, 5, 29, 29, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 29,
4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 29, 29, 17, 29, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 4, 4, 4, 4, 4, 29, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 26, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 6,
5, 4, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 5, 6, 6,
4, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5,
17, 17, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 17, 3, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 6, 6, 29, 4, 4, 4, 4, 4, 4, 4,
4, 29, 29, 4, 4, 29, 29, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 29, 4, 4, 4, 4, 4, 4, 4, 29, 4, 29,
29, 29, 4, 4, 4, 4, 29, 29, 5, 4, 6, 6, 6, 5, 5, 5, 5, 29, 29, 6,
6, 29, 29, 6, 6, 5, 4, 29, 29, 29, 29, 29, 29, 29, 29, 6, 29, 29, 29, 29,
4, 4, 29, 4, 4, 4, 5, 5, 29, 29, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
4, 4, 19, 19, 10, 10, 10, 10, 10, 10, 21, 19, 4, 17, 5, 29, 29, 5, 5, 6,
29, 4, 4, 4, 4, 4, 4, 29, 29, 29, 29, 4, 4, 29, 4, 4, 29, 4, 4, 29,
4, 4, 29, 29, 5, 29, 6, 6, 6, 5, 5, 29, 29, 29, 29, 5, 5, 29, 29, 5,
5, 5, 29, 29, 29, 5, 29, 29, 29, 29, 29, 29, 29, 4, 4, 4, 4, 29, 4, 29,
29, 29, 29, 29, 29, 29, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 5, 4, 4,
4, 5, 17, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 5, 5, 6, 29, 4, 4, 4,
4, 4, 4, 4, 4, 4, 29, 4, 4, 4, 29, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 29, 4, 4, 29, 4, 4, 4, 4, 4, 29, 29, 5, 4, 6, 6,
6, 5, 5, 5, 5, 5, 29, 5, 5, 6, 29, 6, 6, 5, 29, 29, 4, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 17, 19, 29, 29, 29, 29, 29, 29,
29, 4, 5, 5, 5, 5, 5, 5, 29, 5, 6, 6, 29, 4, 4, 4, 4, 4, 4, 4,
4, 29, 29, 4, 4, 29, 4, 4, 29, 4, 4, 4, 4, 4, 29, 29, 5, 4, 6, 5,
6, 5, 5, 5, 5, 29, 29, 6, 6, 29, 29, 6, 6, 5, 29, 29, 29, 29, 29, 29,
29, 5, 5, 6, 29, 29, 29, 29, 4, 4, 29, 4, 21, 4, 10, 10, 10, 10, 10, 10,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 5, 4, 29, 4, 4, 4, 4, 4, 4, 29,
29, 29, 4, 4, 4, 29, 4, 4, 4, 4, 29, 29, 29, 4, 4, 29, 4, 29, 4, 4,
29, 29, 29, 4, 4, 29, 29, 29, 4, 4, 4, 29, 29, 29, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 29, 29, 29, 29, 6, 6, 5, 6, 6, 29, 29, 29, 6, 6,
6, 29, 6, 6, 6, 5, 29, 29, 4, 29, 29, 29, 29, 29, 29, 6, 29, 29, 29, 29,
29, 29, 29, 29, 10, 10, 10, 21, 21, 21, 21, 21, 21, 19, 21, 29, 29, 29, 29, 29,
5, 6, 6, 6, 5, 4, 4, 4, 4, 4, 4, 4, 4, 29, 4, 4, 4, 29, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 29, 29, 29, 4, 5, 5, 5, 6, 6, 6, 6, 29, 5, 5, 5, 29, 5, 5,
5, 5, 29, 29, 29, 29, 29, 29, 29, 5, 5, 29, 4, 4, 4, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 17, 10, 10, 10, 10, 10, 10, 10, 21, 4, 5, 6, 6,
17, 4, 4, 4, 4, 4, 4, 4, 4, 29, 4, 4, 4, 4, 4, 4, 29, 4, 4, 4,
4, 4, 29, 29, 5, 4, 6, 5, 6, 6, 6, 6, 6, 29, 5, 6, 6, 29, 6, 6,
5, 5, 29, 29, 29, 29, 29, 29, 29, 6, 6, 29, 29, 29, 29, 29, 29, 29, 4, 29,
29, 4, 4, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 5, 5, 6, 6,
4, 4, 4, 4, 4, 4, 4, 4, 4, 29, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 5, 5, 4, 6, 6, 6, 5, 5, 5, 5, 29, 6, 6, 6, 29, 6, 6,
6, 5, 4, 21, 29, 29, 29, 29, 4, 4, 4, 6, 10, 10, 10, 10, 10, 10, 10, 4,
10, 10, 10, 10, 10, 10, 10, 10, 10, 21, 4, 4, 4, 4, 4, 4, 29, 5, 6, 6,
29, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 29,
29, 29, 4, 4, 4, 4, 4, 4, 4, 4, 29, 4, 4, 4, 4, 4, 4, 4, 4, 4,
29, 4, 29, 29, 4, 4, 4, 4, 4, 4, 4, 29, 29, 29, 5, 29, 29, 29, 29, 6,
6, 6, 5, 5, 5, 29, 5, 29, 6, 6, 6, 6, 6, 6, 6, 6, 29, 29, 6, 6,
17, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 4, 5, 5, 5, 5, 5, 5, 5, 29,
29, 29, 29, 19, 4, 4, 4, 4, 4, 4, 3, 5, 5, 5, 5, 5, 5, 5, 5, 17,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 17, 17, 29, 29, 29, 29, 29, 4, 4, 29,
4, 29, 4, 4, 4, 4, 4, 29, 4, 4, 4, 4, 4, 4, 4, 4, 29, 4, 29, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5,
5, 4, 29, 29, 4, 4, 4, 4, 4, 29, 3, 29, 5, 5, 5, 5, 5, 5, 29, 29,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 29, 29, 4, 4, 4, 4, 4, 21, 21, 21,
17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 21, 17, 21, 21, 21,
5, 5, 21, 21, 21, 21, 21, 21, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 21, 5, 21, 5, 21, 5, 13, 14, 13, 14, 6, 6,
4, 4, 4, 4, 4, 4, 4, 4, 29, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 29, 29, 29, 29, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 17, 5, 5, 4, 4, 4, 4,
4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 29, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 29, 21, 21, 21, 21, 21, 21,
21, 21, 5, 21, 21, 21, 21, 21, 21, 29, 21, 21, 17, 17, 17, 17, 17, 21, 21, 21,
21, 17, 17, 29, 29, 29, 29, 29, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6,
6, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 6, 5, 5, 6, 6, 5, 5, 4,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 17, 17, 17, 17, 17, 17, 4, 4, 4, 4,
4, 4, 6, 6, 5, 5, 4, 4, 4, 4, 5, 5, 5, 4, 6, 6, 6, 4, 4, 6,
6, 6, 6, 6, 6, 6, 4, 4, 4, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 5, 6, 6, 5, 5, 6, 6, 6, 6, 6, 6, 5, 4, 6,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 6, 6, 6, 5, 21, 21, 0, 0, 0, 0,
0, 0, 29, 0, 29, 29, 29, 29, 29, 0, 29, 29, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 17, 3, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 29, 4, 4,
4, 4, 29, 29, 4, 4, 4, 4, 4, 4, 4, 29, 4, 29, 4, 4, 4, 4, 29, 29,
4, 29, 4, 4, 4, 4, 29, 29, 4, 4, 4, 4, 4, 4, 4, 29, 4, 29, 4, 4,
4, 4, 29, 29, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 29,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 29,
29, 5, 5, 5, 17, 17, 17, 17, 17, 17, 17, 17, 17, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 29, 29, 29, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 29, 29, 29, 29, 29, 29, 0, 0, 0, 0, 0, 0, 29, 29,
1, 1, 1, 1, 1, 1, 29, 29, 12, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 21, 17, 4,
22, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 13, 14, 29, 29, 29, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 17, 17, 17, 9, 9, 9, 4, 4, 4, 4, 4, 4, 4, 4, 29, 29, 29,
29, 29, 29, 29, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 29, 4, 4,
4, 4, 5, 5, 5, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 4, 4, 5, 5,
5, 17, 17, 29, 29, 29, 29, 29, 29, 29, 29, 29, 4, 4, 5, 5, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 4, 29, 5, 5, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 4, 4, 4, 4, 5, 5, 6, 5, 5, 5, 5, 5, 5, 5, 6, 6,
6, 6, 6, 6, 6, 6, 5, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
17, 17, 17, 3, 17, 17, 17, 19, 4, 5, 29, 29, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 29, 29, 29, 29, 29, 29, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 29, 29,
29, 29, 29, 29, 17, 17, 17, 17, 17, 17, 12, 17, 17, 17, 17, 5, 5, 5, 26, 29,
4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 29, 29, 29, 29, 29, 29, 29, 4, 4, 4, 4, 4, 5, 5, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 29,
29, 29, 29, 29, 4, 4, 4, 4, 4, 4, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 29, 5, 5, 5, 6,
6, 6, 6, 5, 5, 6, 6, 6, 29, 29, 29, 29, 6, 6, 5, 6, 6, 6, 6, 6,
6, 5, 5, 5, 29, 29, 29, 29, 21, 29, 29, 29, 17, 17, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 29, 29,
4, 4, 4, 4, 4, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 29, 29, 29, 29, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 29, 29, 29, 29, 29, 29, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 10, 29,
29, 29, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
4, 4, 4, 4, 4, 4, 4, 5, 5, 6, 6, 5, 29, 29, 17, 17, 4, 4, 4, 4,
4, 6, 5, 6, 5, 5, 5, 5, 5, 5, 5, 29, 5, 6, 5, 6, 6, 5, 5, 5,
5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 29, 29, 5, 17, 17, 17, 17, 17, 17, 17, 3, 17, 17, 17, 17, 17, 17, 29, 29,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 7, 5, 5, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 5, 5, 5, 5, 6, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 6, 5, 5, 5, 5, 5, 6,
5, 6, 6, 6, 6, 6, 5, 6, 6, 4, 4, 4, 4, 4, 4, 4, 29, 29, 29, 29,
17, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 5, 5, 5, 5, 5, 5, 5, 5, 5,
21, 21, 21, 21, 21, 21, 21, 21, 21, 29, 29, 29, 5, 5, 6, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 5, 5, 5, 5, 6, 6, 5, 5, 6, 5,
5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 5, 6, 5, 5, 6, 6, 6, 5, 6, 5,
5, 5, 6, 6, 29, 29, 29, 29, 29, 29, 29, 29, 17, 17, 17, 17, 4, 4, 4, 4,
6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 5, 5,
29, 29, 29, 17, 17, 17, 17, 17, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 29, 29,
29, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 17, 17,
1, 1, 1, 1, 1, 1, 1, 1, 1, 29, 29, 29, 29, 29, 29, 29, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 29, 29, 0, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17,
29, 29, 29, 29, 29, 29, 29, 29, 5, 5, 5, 17, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 5, 4, 4,
4, 4, 4, 4, 5, 4, 4, 6, 5, 5, 4, 29, 29, 29, 29, 29, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 29, 5, 5, 5, 5, 5, 0, 1, 0, 1,
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 29, 29, 0, 0, 0, 0,
0, 0, 29, 29, 1, 1, 1, 1, 1, 1, 1, 1, 29, 0, 29, 0, 29, 0, 29, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 29, 29, 1, 1, 1, 1,
1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 29, 1, 1,
0, 0, 0, 0, 2, 20, 1, 20, 20, 20, 1, 1, 1, 29, 1, 1, 0, 0, 0, 0,
2, 20, 20, 20, 1, 1, 1, 1, 29, 29, 1, 1, 0, 0, 0, 0, 29, 20, 20, 20,
1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 20, 20, 20, 29, 29, 1, 1,
1, 29, 1, 1, 0, 0, 0, 0, 2, 20, 20, 29, 22, 22, 22, 22, 22, 22, 22, 22,
22, 22, 22, 26, 26, 26, 26, 26, 12, 12, 12, 12, 12, 12, 17, 17, 15, 16, 13, 15,
15, 16, 13, 15, 17, 17, 17, 17, 17, 17, 17, 17, 23, 24, 26, 26, 26, 26, 26, 22,
17, 17, 17, 17, 17, 17, 17, 17, 17, 15, 16, 17, 17, 17, 17, 11, 11, 17, 17, 17,
18, 13, 14, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 17, 11, 17, 17, 17,
17, 17, 17, 17, 17, 17, 17, 22, 26, 26, 26, 26, 26, 29, 26, 26, 26, 26, 26, 26,
26, 26, 26, 26, 10, 3, 29, 29, 10, 10, 10, 10, 10, 10, 18, 18, 18, 13, 14, 3,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 18, 18, 18, 13, 14, 29, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 29, 29, 29, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 7, 7, 7, 7, 5, 7, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
21, 21, 0, 21, 21, 21, 21, 0, 21, 21, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1,
21, 0, 21, 21, 18, 0, 0, 0, 0, 0, 21, 21, 21, 21, 21, 21, 0, 21, 0, 21,
0, 21, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 1, 4, 4, 4, 4, 1, 21, 21,
1, 1, 0, 0, 18, 18, 18, 18, 18, 0, 1, 1, 1, 1, 21, 18, 21, 21, 1, 21,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 1, 9, 9, 9,
9, 10, 21, 21, 29, 29, 29, 29, 18, 18, 18, 18, 18, 21, 21, 21, 21, 21, 18, 18,
21, 21, 21, 21, 18, 21, 21, 18, 21, 21, 18, 21, 21, 21, 21, 21, 21, 21, 18, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 18, 18, 21, 21, 18, 21,
18, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 18, 18, 18, 18,
18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
18, 18, 18, 18, 21, 21, 21, 21, 21, 21, 21, 21, 13, 14, 13, 14, 21, 21, 21, 21,
18, 18, 21, 21, 21, 21, 21, 21, 21, 13, 14, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 18, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 18, 18, 18, 18, 18, 18, 18, 18, 18, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 18, 18, 18, 18,
18, 18, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 29, 29, 29, 29, 29, 29, 29, 29, 29, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 29, 29, 29, 29, 29, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 10, 10, 10, 10, 10, 10,
21, 21, 21, 21, 21, 21, 21, 18, 21, 21, 21, 21, 21, 21, 21, 21, 21, 18, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
18, 18, 18, 18, 18, 18, 18, 18, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 18, 21, 21, 21, 21, 21, 21, 21, 21, 13, 14, 13, 14, 13, 14, 13, 14,
13, 14, 13, 14, 13, 14, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 18, 18, 18, 18, 18, 13, 14, 18,
18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 13, 14, 13, 14, 13, 14,
13, 14, 13, 14, 18, 18, 18, 13, 14, 13, 14, 13, 14, 13, 14, 13, 14, 13, 14, 13,
14, 13, 14, 13, 14, 13, 14, 13, 14, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
18, 18, 18, 18, 13, 14, 13, 14, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
18, 18, 18, 18, 13, 14, 18, 18, 18, 18, 18, 18, 18, 21, 21, 18, 18, 18, 18, 18,
18, 21, 21, 21, 21, 21, 21, 21, 29, 29, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 29, 21, 21, 21, 21, 21, 21, 21, 21, 21, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 29, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0,
1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 3, 3, 0, 0,
0, 1, 0, 1, 1, 21, 21, 21, 21, 21, 21, 0, 1, 0, 1, 5, 5, 5, 0, 1,
29, 29, 29, 29, 29, 17, 17, 17, 17, 10, 17, 17, 1, 1, 1, 1, 1, 1, 29, 1,
29, 29, 29, 29, 29, 1, 29, 29, 4, 4, 4, 4, 4, 4, 4, 4, 29, 29, 29, 29,
29, 29, 29, 3, 17, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 5,
4, 4, 4, 4, 4, 4, 4, 29, 29, 29, 29, 29, 29, 29, 29, 29, 4, 4, 4, 4,
4, 4, 4, 29, 4, 4, 4, 4, 4, 4, 4, 29, 17, 17, 15, 16, 15, 16, 17, 17,
17, 15, 16, 17, 15, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 12, 17, 17, 12, 17,
15, 16, 17, 17, 15, 16, 13, 14, 13, 14, 13, 14, 13, 14, 17, 17, 17, 17, 17, 3,
17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 12, 12, 17, 17, 17, 17, 12, 17, 13, 17,
17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 21, 21, 17, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 29, 21,
21, 21, 21, 21, 21, 21, 21, 21, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
21, 21, 21, 21, 21, 21, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 29, 29, 29, 29, 22, 17, 17, 17, 21, 3, 4, 9,
13, 14, 13, 14, 13, 14, 13, 14, 13, 14, 21, 21, 13, 14, 13, 14, 13, 14, 13, 14,
12, 13, 14, 14, 21, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 5, 5, 5, 6, 6,
12, 3, 3, 3, 3, 3, 21, 21, 9, 9, 9, 3, 4, 17, 21, 21, 4, 4, 4, 4,
4, 4, 4, 29, 29, 5, 5, 20, 20, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 17, 3, 3, 3, 4, 29, 29, 29, 29, 29, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 21, 21, 10, 10, 10, 10, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 29, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
10, 10, 10, 10, 10, 10, 10, 10, 21, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 17, 17, 17, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 4, 4, 29, 29, 29, 29, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 4, 5, 7, 7, 7, 17, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 17, 3, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 3, 3, 5, 5,
4, 4, 4, 4, 4, 4, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 5, 17, 17,
17, 17, 17, 17, 29, 29, 29, 29, 29, 29, 29, 29, 20, 20, 20, 20, 20, 20, 20, 3,
3, 3, 3, 3, 3, 3, 3, 3, 20, 20, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
3, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 3, 20, 20, 0, 1, 0, 1, 4, 0, 1, 0, 1, 1, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0,
0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
29, 29, 0, 1, 0, 0, 0, 0, 1, 0, 1, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 0, 1, 4, 3, 3, 1, 4, 4, 4, 4, 4, 4, 4, 5, 4, 4, 4, 5, 4,
4, 4, 4, 5, 4, 4, 4, 4, 4, 4, 4, 6, 6, 5, 5, 6, 21, 21, 21, 21,
5, 29, 29, 29, 10, 10, 10, 10, 10, 10, 21, 21, 19, 21, 29, 29, 29, 29, 29, 29,
4, 4, 4, 4, 17, 17, 17, 17, 29, 29, 29, 29, 29, 29, 29, 29, 6, 6, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 29, 29, 29, 29, 29, 29,
29, 29, 17, 17, 5, 5, 4, 4, 4, 4, 4, 4, 17, 17, 17, 4, 17, 4, 4, 5,
4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 17, 17, 4, 4, 4, 4,
4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 17, 4, 4, 4, 5, 6, 6, 5, 5, 5, 5, 6, 6,
5, 5, 6, 6, 6, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 29, 3,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 29, 29, 29, 29, 17, 17, 4, 4, 4, 4,
4, 5, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 4, 4, 4, 4, 4, 29, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5,
5, 5, 5, 6, 6, 5, 5, 6, 6, 5, 5, 29, 29, 29, 29, 29, 29, 29, 29, 29,
4, 4, 4, 5, 4, 4, 4, 4, 4, 4, 4, 4, 5, 6, 29, 29, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 29, 29, 17, 17, 17, 17, 3, 4, 4, 4, 4, 4, 4, 21,
21, 21, 4, 6, 5, 6, 4, 4, 5, 4, 5, 5, 5, 4, 4, 5, 5, 4, 4, 4,
4, 4, 5, 5, 4, 5, 4, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 4, 4, 3, 17, 17, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 6, 5, 5, 6, 6, 17, 17, 4, 3, 3, 6, 5, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 4, 4, 4, 4, 4, 4, 29, 29, 4, 4, 4,
4, 4, 4, 29, 29, 4, 4, 4, 4, 4, 4, 29, 29, 29, 29, 29, 29, 29, 29, 29,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 20, 3, 3, 3, 3, 1, 1, 1, 1,
1, 1, 1, 1, 1, 3, 20, 20, 29, 29, 29, 29, 4, 4, 4, 6, 6, 5, 6, 6,
5, 6, 6, 17, 6, 5, 29, 29, 4, 4, 4, 4, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 4, 4, 4, 4, 4, 4, 4, 29, 29, 29, 29, 4, 4, 4, 4, 4,
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28,
28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 1, 1, 1, 1, 1, 1, 1, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 1, 1, 1, 1, 1, 29, 29, 29, 29,
29, 4, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 18, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 29, 4, 4, 4, 4, 4, 29, 4, 29, 4, 4, 29, 4,
4, 29, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 14, 13, 29, 29, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 19, 21, 29, 29, 17, 17, 17, 17, 17, 17, 17, 13, 14, 17, 29, 29,
29, 29, 29, 29, 17, 12, 12, 11, 11, 13, 14, 13, 14, 13, 14, 13, 14, 13, 14, 13,
14, 13, 14, 13, 14, 17, 17, 13, 14, 17, 17, 17, 17, 11, 11, 11, 17, 17, 17, 29,
17, 17, 17, 17, 12, 13, 14, 13, 14, 13, 14, 17, 17, 17, 18, 12, 18, 18, 18, 29,
17, 19, 17, 17, 29, 29, 29, 29, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 29, 29, 26, 29, 17, 17, 17, 19, 17, 17, 17, 13, 14, 17, 18, 17, 12, 17, 17,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 13, 18, 14, 18, 13, 14, 17, 13, 14,
17, 17, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 3, 3, 29, 29, 4, 4, 4, 4, 4, 4, 29, 29, 4, 4, 4, 4, 4, 4,
29, 29, 4, 4, 4, 4, 4, 4, 29, 29, 4, 4, 4, 29, 29, 29, 19, 19, 18, 20,
21, 19, 19, 29, 21, 18, 18, 18, 18, 21, 21, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 26, 26, 26, 21, 21, 29, 29, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
29, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 29, 4, 4, 29, 4,
17, 17, 17, 29, 29, 29, 29, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
29, 29, 29, 21, 21, 21, 21, 21, 21, 21, 21, 21, 9, 9, 9, 9, 9, 10, 10, 10,
10, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 10, 10,
21, 21, 21, 29, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 29, 29, 29,
21, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 5, 29, 29, 5, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
29, 29, 29, 29, 10, 10, 10, 10, 29, 29, 29, 29, 29, 29, 29, 29, 29, 4, 4, 4,
4, 9, 4, 4, 4, 4, 4, 4, 4, 4, 9, 29, 29, 29, 29, 29, 4, 4, 4, 4,
4, 4, 5, 5, 5, 5, 5, 29, 29, 29, 29, 29, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 29, 17, 4, 4, 4, 4, 29, 29, 29, 29, 4, 4, 4, 4,
4, 4, 4, 4, 17, 9, 9, 9, 9, 9, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
29, 29, 29, 29, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 29, 29, 29, 29, 4, 4, 4, 4, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 17, 4, 4, 4, 4, 4, 4, 29, 29, 4, 29, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 29, 4, 4, 29, 29, 29, 4, 29, 29, 4, 4, 4, 4, 4,
4, 4, 29, 17, 10, 10, 10, 10, 10, 10, 10, 10, 4, 4, 4, 4, 4, 4, 4, 21,
21, 10, 10, 10, 10, 10, 10, 10, 29, 29, 29, 29, 29, 29, 29, 10, 10, 10, 10, 10,
10, 10, 10, 10, 4, 4, 4, 29, 4, 4, 29, 29, 29, 29, 29, 10, 10, 10, 10, 10,
4, 4, 4, 4, 4, 4, 10, 10, 10, 10, 10, 10, 29, 29, 29, 17, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 29, 29, 29, 29, 29, 17, 4, 4, 4, 4, 4, 4, 4, 4,
29, 29, 29, 29, 10, 10, 4, 4, 29, 29, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 4, 5, 5, 5, 29, 5, 5, 29, 29, 29, 29, 29, 5, 5, 5, 5,
4, 4, 4, 4, 29, 4, 4, 4, 29, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 29, 29, 5, 5, 5, 29, 29, 29, 29, 5, 10, 10, 10, 10, 10, 10, 10, 10,
10, 29, 29, 29, 29, 29, 29, 29, 17, 17, 17, 17, 17, 17, 17, 17, 17, 29, 29, 29,
29, 29, 29, 29, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 10, 10, 17,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 10, 10, 10, 4, 4, 4, 4,
4, 4, 4, 4, 21, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 29,
29, 29, 29, 10, 10, 10, 10, 10, 17, 17, 17, 17, 17, 17, 17, 29, 29, 29, 29, 29,
29, 29, 29, 29, 4, 4, 4, 4, 4, 4, 29, 29, 29, 17, 17, 17, 17, 17, 17, 17,
4, 4, 4, 4, 4, 4, 29, 29, 10, 10, 10, 10, 10, 10, 10, 10, 4, 4, 4, 29,
29, 29, 29, 29, 10, 10, 10, 10, 10, 10, 10, 10, 4, 4, 29, 29, 29, 29, 29, 29,
29, 17, 17, 17, 17, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 10, 10, 10,
10, 10, 10, 10, 0, 0, 0, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
1, 1, 1, 29, 29, 29, 29, 29, 29, 29, 10, 10, 10, 10, 10, 10, 4, 4, 4, 4,
5, 5, 5, 5, 29, 29, 29, 29, 29, 29, 29, 29, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 29, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 29, 5,
5, 12, 29, 29, 4, 4, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
10, 10, 10, 10, 10, 10, 10, 4, 29, 29, 29, 29, 29, 29, 29, 29, 5, 10, 10, 10,
10, 17, 17, 17, 17, 17, 29, 29, 29, 29, 29, 29, 4, 4, 4, 4, 4, 10, 10, 10,
10, 10, 10, 10, 29, 29, 29, 29, 6, 5, 6, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 17, 17, 17, 17, 17, 17, 17, 29, 29, 10, 10, 10, 10,
10, 10, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 5, 6, 6, 6, 5, 5, 5, 5, 6, 6, 5, 5, 17,
17, 26, 17, 17, 17, 17, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 26, 29, 29,
5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 5, 5, 29, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 17, 17, 17, 17, 4, 6, 6, 4, 29, 29, 29, 29,
29, 29, 29, 29, 4, 4, 4, 5, 17, 17, 4, 29, 29, 29, 29, 29, 29, 29, 29, 29,
4, 4, 4, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 4, 4, 4,
4, 17, 17, 17, 17, 5, 5, 5, 5, 17, 6, 5, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 4, 17, 4, 17, 17, 17, 29, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 5, 5, 5, 6, 6,
5, 6, 5, 5, 17, 17, 17, 17, 17, 17, 5, 29, 4, 4, 4, 4, 4, 4, 4, 29,
4, 29, 4, 4, 4, 4, 29, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 29, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 17, 29, 29, 29, 29, 29, 29,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 6, 6, 6, 5,
5, 5, 5, 5, 5, 5, 5, 29, 29, 29, 29, 29, 5, 5, 6, 6, 29, 4, 4, 4,
4, 4, 4, 4, 4, 29, 29, 4, 4, 29, 4, 4, 29, 4, 4, 4, 4, 4, 29, 5,
5, 4, 6, 6, 5, 6, 6, 6, 6, 29, 29, 6, 6, 29, 29, 6, 6, 6, 29, 29,
4, 29, 29, 29, 29, 29, 29, 6, 29, 29, 29, 29, 29, 4, 4, 4, 4, 4, 6, 6,
29, 29, 5, 5, 5, 5, 5, 5, 5, 29, 29, 29, 5, 5, 5, 5, 5, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 4, 4, 4, 4, 4, 6, 6, 6, 5, 5, 5, 5,
5, 5, 5, 5, 6, 6, 5, 5, 5, 6, 5, 4, 4, 4, 4, 17, 17, 17, 17, 17,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 17, 17, 29, 17, 5, 4, 6, 6, 6, 5,
5, 5, 5, 5, 5, 6, 5, 6, 6, 6, 6, 5, 5, 6, 5, 5, 4, 4, 17, 4,
29, 29, 29, 29, 29, 29, 29, 29, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 6, 6, 6, 5, 5, 5, 5, 29, 29, 6, 6, 6, 6, 5, 5, 6, 5,
5, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
17, 17, 17, 17, 4, 4, 4, 4, 5, 5, 29, 29, 6, 6, 6, 5, 5, 5, 5, 5,
5, 5, 5, 6, 6, 5, 6, 5, 5, 17, 17, 17, 4, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 29, 29, 29,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 6, 5, 6, 6, 5, 5, 5, 5,
5, 5, 6, 5, 4, 29, 29, 29, 29, 29, 29, 29, 6, 6, 5, 5, 5, 5, 6, 5,
5, 5, 5, 5, 29, 29, 29, 29, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 10, 10,
17, 17, 17, 21, 5, 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, 17, 29, 29, 29, 29,
10, 10, 10, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 4, 4, 4, 4, 4,
4, 4, 4, 29, 29, 4, 29, 29, 4, 4, 4, 4, 4, 4, 4, 4, 29, 4, 4, 29,
4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 29, 6, 6, 29, 29, 5,
5, 6, 5, 4, 6, 4, 6, 5, 17, 17, 17, 29, 29, 29, 29, 29, 29, 29, 29, 29,
4, 4, 4, 4, 4, 4, 4, 4, 29, 29, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6,
5, 5, 5, 5, 29, 29, 5, 5, 6, 6, 6, 6, 5, 4, 17, 4, 6, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4,
4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 4, 5, 5, 5, 5, 17,
17, 17, 17, 17, 17, 17, 17, 5, 29, 29, 29, 29, 29, 29, 29, 29, 4, 5, 5, 5,
5, 5, 5, 6, 6, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, 17, 17,
17, 4, 17, 17, 17, 17, 17, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
5, 5, 5, 5, 5, 5, 5, 29, 5, 5, 5, 5, 5, 5, 6, 5, 4, 17, 17, 17,
17, 17, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 17, 17, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 29, 29, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 29, 6, 5, 5, 5, 5, 5, 5,
5, 6, 5, 5, 6, 5, 5, 29, 29, 29, 29, 29, 29, 29, 29, 29, 4, 4, 4, 4,
4, 4, 4, 29, 4, 4, 29, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 29,
29, 29, 5, 29, 5, 5, 29, 5, 5, 5, 5, 5, 5, 5, 4, 5, 29, 29, 29, 29,
29, 29, 29, 29, 4, 4, 4, 4, 4, 4, 29, 4, 4, 29, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 29, 5, 5, 29, 6,
6, 5, 6, 5, 4, 29, 29, 29, 29, 29, 29, 29, 4, 4, 4, 5, 5, 6, 6, 17,
17, 29, 29, 29, 29, 29, 29, 29, 10, 10, 10, 10, 10, 21, 21, 21, 21, 21, 21, 21,
21, 19, 19, 19, 19, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 17, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 29, 17, 17, 17, 17, 17, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 26, 26, 26, 26, 26, 26, 26, 26, 26, 29, 29, 29,
29, 29, 29, 29, 5, 5, 5, 5, 5, 17, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
5, 5, 5, 5, 5, 5, 5, 17, 17, 17, 17, 17, 21, 21, 21, 21, 3, 3, 3, 3,
17, 21, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 29, 10, 10, 10, 10, 10, 10, 10, 29, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 29, 29, 29, 29, 29, 4, 4, 4,
10, 10, 10, 10, 10, 10, 10, 17, 17, 17, 17, 29, 29, 29, 29, 29, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 29, 29, 29, 29, 5, 4, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 29, 29, 29, 29, 29, 29, 29, 5,
5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 17, 3,
5, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 6, 6, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 4, 4, 4, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 4, 4, 4, 4, 29, 29, 29, 29, 29, 29, 29, 29,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 29, 29, 21, 5, 5, 17, 26, 26, 26, 26,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 21, 21, 21, 21, 21, 21, 21, 29,
29, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 6, 6, 5, 5, 5, 21, 21,
21, 6, 6, 6, 6, 6, 6, 26, 26, 26, 26, 26, 26, 26, 26, 5, 5, 5, 5, 5,
5, 5, 5, 21, 21, 5, 5, 5, 5, 5, 5, 5, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 5, 5, 5, 5, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
21, 29, 29, 29, 29, 29, 29, 29, 21, 21, 5, 5, 5, 21, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 10, 10, 10, 10, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 29, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 29, 0, 0, 29, 29, 0, 29,
29, 0, 0, 29, 29, 0, 0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
1, 1, 29, 1, 29, 1, 1, 1, 1, 1, 1, 1, 29, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 29, 0, 0, 0, 0, 29, 29, 0, 0, 0,
0, 0, 0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 0, 29, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 0, 0, 29, 0, 0, 0, 0, 29, 0, 0, 0, 0, 0, 29, 0, 29,
29, 29, 0, 0, 0, 0, 0, 0, 0, 29, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 29, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 18,
1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 1, 1, 1, 1, 1, 1, 1, 1,
1, 18, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 18, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 1, 1, 1, 1,
1, 1, 1, 1, 1, 18, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
0, 18, 1, 1, 1, 1, 1, 1, 1, 1, 1, 18, 1, 1, 1, 1, 1, 1, 0, 1,
29, 29, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
5, 5, 5, 5, 5, 5, 5, 21, 21, 21, 21, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 21, 21, 21, 21, 21, 21, 21, 21, 5, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 5, 21, 21, 17, 17, 17, 17, 17,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 29, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 29, 29, 5, 5, 5, 5, 5, 5, 5, 29, 5, 5, 29, 5, 5,
5, 5, 5, 29, 29, 29, 29, 29, 5, 5, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3,
3, 3, 29, 29, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 29, 29, 29, 29, 4, 21,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 29, 29, 29, 29, 29, 19, 4, 4, 4, 4, 4, 29, 29, 10,
10, 10, 10, 10, 10, 10, 10, 10, 5, 5, 5, 5, 5, 5, 5, 29, 29, 29, 29, 29,
29, 29, 29, 29, 1, 1, 1, 1, 5, 5, 5, 5, 5, 5, 5, 3, 29, 29, 29, 29,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 21, 10, 10, 10, 19, 10, 10, 10,
10, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 21, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 29, 29, 4, 4, 4, 4, 29, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
29, 4, 4, 29, 4, 29, 29, 4, 29, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 29,
4, 4, 4, 4, 29, 4, 29, 4, 29, 29, 29, 29, 29, 29, 4, 29, 29, 29, 29, 4,
29, 4, 29, 4, 29, 4, 4, 4, 29, 4, 4, 29, 4, 29, 29, 4, 29, 4, 29, 4,
29, 4, 29, 4, 29, 4, 4, 29, 4, 29, 29, 4, 4, 4, 4, 29, 4, 4, 4, 4,
4, 4, 4, 29, 4, 4, 4, 4, 29, 4, 4, 4, 4, 29, 4, 29, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 29, 4, 4, 4, 4, 4, 29, 4, 4, 4, 29, 4, 4, 4,
4, 4, 29, 4, 4, 4, 4, 4, 18, 18, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 21, 21, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 29, 29, 29, 29, 29, 29, 29, 29, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 21, 21, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 20, 20, 20, 20, 21, 21, 21, 21,
21, 21, 21, 21, 29, 29, 29, 29, 29, 29, 29, 29, 21, 21, 21, 21, 21, 21, 21, 21,
21, 29, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
29, 21, 21, 21, 21, 21, 21, 21, 21, 29, 29, 29, 21, 21, 21, 29, 29, 29, 29, 29,
21, 21, 21, 29, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 29, 26, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 26, 26, 26, 26, 26, 26, 26, 26,
26, 26, 26, 26, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
28, 28, 29, 29,
};
constexpr int catTableShift11 = 9;
constexpr int catTableShift12 = 8;
constexpr int catTableMask1 = 511;
constexpr int catTableShift21 = 4;
constexpr int catTableShift22 = 0;
constexpr int catTableMask2 = 15;
const unsigned short CatTableRLE_BMP[] = {
1049, 54, 113, 51, 113, 45, 46, 49, 50, 49, 44, 81, 328, 81, 114, 81, 832, 45, 49, 46,
52, 43, 52, 833, 45, 50, 46, 50, 1081, 54, 49, 147, 53, 49, 52, 53, 36, 47, 50, 58,
53, 52, 53, 50, 74, 52, 33, 81, 52, 42, 36, 48, 106, 49, 736, 50, 224, 769, 50, 257,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 65, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 65, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 64, 33,
32, 33, 32, 97, 64, 33, 32, 33, 64, 33, 96, 65, 128, 33, 64, 33, 96, 97, 64, 33,
64, 33, 32, 33, 32, 33, 64, 33, 32, 65, 32, 33, 64, 33, 96, 33, 32, 33, 64, 65,
36, 32, 97, 132, 32, 34, 33, 32, 34, 33, 32, 34, 33, 32, 33, 32, 33, 32, 33, 32,
33, 32, 33, 32, 33, 32, 33, 32, 65, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32,
33, 32, 33, 32, 33, 32, 65, 32, 34, 33, 32, 33, 96, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 225, 64, 33, 64, 65, 32, 33, 128, 33,
32, 33, 32, 33, 32, 33, 32, 2209, 36, 865, 579, 148, 387, 468, 163, 244, 35, 52, 35, 564,
3589, 32, 33, 32, 33, 35, 52, 32, 33, 93, 35, 97, 49, 32, 157, 84, 32, 49, 96, 61,
32, 61, 64, 33, 544, 61, 288, 1121, 32, 65, 96, 97, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 161, 32, 33, 50, 32,
33, 64, 65, 1632, 1537, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32,
33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 53,
165, 71, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 64, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 65, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 61, 1216, 93, 35, 209, 1313, 49, 44, 93, 85, 51, 61, 1445, 44,
37, 49, 69, 49, 69, 49, 37, 285, 868, 157, 132, 81, 381, 218, 114, 81, 51, 81, 85, 357,
49, 58, 61, 81, 1028, 35, 324, 677, 328, 145, 68, 37, 3172, 49, 36, 229, 58, 53, 197, 67,
69, 53, 133, 68, 328, 100, 85, 36, 465, 61, 58, 36, 37, 964, 869, 93, 2852, 357, 36, 477,
328, 1060, 293, 67, 53, 113, 35, 93, 37, 83, 708, 133, 35, 293, 35, 101, 35, 165, 93, 497,
61, 804, 101, 93, 49, 61, 356, 1725, 676, 61, 580, 381, 485, 58, 1029, 38, 1732, 37, 38, 37,
36, 102, 261, 134, 37, 70, 36, 229, 324, 69, 81, 328, 49, 35, 484, 37, 70, 61, 260, 93,
68, 93, 708, 61, 228, 61, 36, 125, 132, 93, 37, 36, 102, 133, 93, 70, 93, 70, 37, 36,
285, 38, 157, 68, 61, 100, 69, 93, 328, 68, 83, 202, 53, 51, 36, 49, 37, 93, 69, 38,
61, 196, 157, 68, 93, 708, 61, 228, 61, 68, 61, 68, 61, 68, 93, 37, 61, 102, 69, 157,
69, 93, 101, 125, 37, 253, 132, 61, 36, 253, 328, 69, 100, 37, 49, 349, 69, 38, 61, 292,
61, 100, 61, 708, 61, 228, 61, 68, 61, 164, 93, 37, 36, 102, 165, 61, 69, 38, 61, 70,
37, 93, 36, 509, 68, 69, 93, 328, 49, 51, 253, 36, 197, 61, 37, 70, 61, 260, 93, 68,
93, 708, 61, 228, 61, 68, 61, 164, 93, 37, 36, 38, 37, 38, 133, 93, 70, 93, 70, 37,
253, 69, 38, 157, 68, 61, 100, 69, 93, 328, 53, 36, 202, 349, 37, 36, 61, 196, 125, 100,
61, 132, 125, 68, 61, 36, 61, 68, 125, 68, 125, 100, 125, 388, 157, 70, 37, 70, 125, 102,
61, 102, 37, 93, 36, 221, 38, 477, 328, 106, 213, 51, 53, 189, 37, 102, 37, 260, 61, 100,
61, 740, 61, 516, 125, 36, 101, 134, 61, 101, 61, 133, 253, 69, 61, 100, 189, 68, 69, 93,
328, 253, 49, 234, 53, 36, 37, 70, 49, 260, 61, 100, 61, 740, 61, 324, 61, 164, 93, 37,
36, 38, 37, 166, 61, 37, 70, 61, 70, 69, 253, 70, 253, 36, 61, 68, 69, 93, 328, 61,
68, 445, 69, 70, 292, 61, 100, 61, 1316, 69, 36, 102, 133, 61, 102, 61, 102, 37, 36, 53,
157, 100, 38, 234, 100, 69, 93, 328, 298, 53, 196, 61, 37, 70, 61, 580, 125, 772, 61, 292,
61, 36, 93, 228, 125, 37, 157, 102, 101, 61, 37, 61, 262, 221, 328, 93, 70, 49, 413, 1540,
37, 68, 229, 157, 51, 196, 35, 261, 49, 328, 81, 1213, 68, 61, 36, 61, 164, 61, 772, 61,
36, 61, 324, 37, 68, 293, 36, 93, 164, 61, 35, 61, 197, 93, 328, 93, 132, 1053, 36, 117,
497, 53, 49, 117, 69, 213, 328, 330, 53, 37, 53, 37, 53, 37, 45, 46, 45, 46, 70, 260,
61, 1156, 157, 453, 38, 165, 49, 69, 164, 357, 61, 1157, 61, 277, 37, 213, 61, 85, 177, 149,
81, 1213, 1380, 70, 133, 38, 197, 38, 69, 70, 69, 36, 328, 209, 196, 70, 69, 132, 101, 36,
102, 68, 230, 100, 133, 420, 37, 70, 69, 198, 37, 36, 38, 328, 102, 37, 85, 1216, 61, 32,
189, 32, 93, 1377, 49, 35, 97, 10532, 61, 132, 93, 228, 61, 36, 61, 132, 93, 1316, 61, 132,
93, 1060, 61, 132, 93, 228, 61, 36, 61, 132, 93, 484, 61, 1828, 61, 132, 93, 2148, 93, 101,
305, 650, 125, 516, 341, 221, 2752, 93, 193, 93, 44, 19844, 53, 49, 548, 54, 836, 45, 46, 125,
2404, 113, 105, 260, 253, 420, 61, 132, 101, 381, 580, 101, 81, 317, 580, 69, 413, 420, 61, 100,
61, 69, 413, 1668, 69, 38, 229, 262, 37, 70, 357, 113, 35, 113, 51, 36, 37, 93, 328, 221,
330, 221, 209, 44, 145, 101, 58, 61, 328, 221, 1124, 35, 1700, 253, 164, 69, 1092, 37, 36, 189,
2244, 349, 996, 61, 101, 134, 69, 102, 157, 70, 37, 198, 101, 157, 53, 125, 81, 328, 964, 93,
164, 381, 1412, 157, 836, 221, 328, 42, 125, 1109, 740, 69, 70, 37, 93, 81, 1700, 38, 37, 38,
229, 61, 37, 38, 37, 70, 261, 198, 325, 93, 37, 328, 221, 328, 221, 241, 35, 209, 93, 453,
39, 69, 2045, 133, 38, 1508, 37, 38, 165, 38, 37, 166, 37, 70, 228, 157, 328, 241, 341, 293,
309, 125, 69, 38, 964, 38, 133, 70, 69, 38, 101, 68, 328, 1412, 37, 38, 69, 102, 37, 38,
101, 70, 285, 145, 1156, 262, 261, 70, 69, 125, 177, 328, 125, 100, 328, 964, 195, 81, 289, 253,
1376, 93, 96, 273, 285, 101, 49, 421, 38, 229, 132, 37, 196, 37, 68, 38, 69, 36, 189, 1409,
2019, 417, 35, 1089, 1187, 1861, 61, 165, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 289, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 289, 256, 193, 93, 192,
93, 257, 256, 257, 256, 193, 93, 192, 93, 257, 61, 32, 61, 32, 61, 32, 61, 32, 257, 256,
449, 93, 257, 258, 257, 258, 257, 258, 161, 61, 65, 128, 34, 52, 33, 116, 97, 61, 65, 128,
34, 116, 129, 93, 65, 128, 61, 116, 257, 160, 116, 93, 97, 61, 65, 128, 34, 84, 61, 374,
186, 204, 81, 47, 48, 45, 79, 48, 45, 47, 273, 55, 56, 186, 54, 305, 47, 48, 145, 75,
113, 50, 45, 46, 369, 50, 49, 43, 337, 54, 186, 61, 346, 42, 35, 93, 202, 114, 45, 46,
35, 330, 114, 45, 46, 61, 419, 125, 1043, 541, 421, 135, 37, 103, 389, 509, 85, 32, 149, 32,
85, 33, 96, 65, 96, 33, 53, 32, 85, 50, 160, 213, 32, 53, 32, 53, 32, 53, 128, 53,
33, 128, 33, 132, 33, 85, 65, 64, 178, 32, 129, 53, 50, 85, 33, 53, 522, 1129, 32, 33,
137, 42, 85, 157, 178, 181, 82, 149, 50, 85, 50, 85, 50, 245, 50, 1013, 82, 85, 50, 53,
50, 1013, 8594, 277, 45, 46, 45, 46, 661, 82, 245, 45, 46, 2613, 50, 981, 818, 1301, 210, 2229,
829, 373, 701, 1930, 2517, 714, 5877, 50, 309, 50, 1749, 274, 3573, 50, 7957, 45, 46, 45, 46, 45,
46, 45, 46, 45, 46, 45, 46, 45, 46, 970, 1429, 178, 45, 46, 1010, 45, 46, 45, 46, 45,
46, 45, 46, 45, 46, 530, 8213, 4210, 45, 46, 45, 46, 45, 46, 45, 46, 45, 46, 45, 46,
45, 46, 45, 46, 45, 46, 45, 46, 45, 46, 2034, 45, 46, 45, 46, 1042, 45, 46, 8274, 1557,
690, 85, 210, 1269, 93, 1045, 61, 3381, 1504, 61, 1505, 61, 32, 33, 96, 65, 32, 33, 32, 33,
32, 33, 128, 33, 32, 65, 32, 193, 67, 96, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32,
33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32,
33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32,
33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32,
33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32,
33, 32, 33, 32, 33, 32, 33, 32, 65, 213, 32, 33, 32, 33, 101, 32, 33, 189, 145, 42,
81, 1217, 61, 33, 189, 33, 93, 1796, 253, 35, 49, 477, 37, 740, 317, 228, 61, 228, 61, 228,
61, 228, 61, 228, 61, 228, 61, 228, 61, 228, 61, 1029, 81, 47, 48, 47, 48, 113, 47, 48,
49, 47, 48, 305, 44, 81, 44, 49, 47, 48, 81, 47, 48, 45, 46, 45, 46, 45, 46, 45,
46, 177, 35, 337, 76, 145, 44, 49, 45, 433, 85, 49, 1469, 853, 61, 2869, 413, 6869, 861, 405,
157, 54, 113, 53, 35, 36, 41, 45, 46, 45, 46, 45, 46, 45, 46, 45, 46, 85, 45, 46,
45, 46, 45, 46, 45, 46, 44, 45, 78, 53, 297, 133, 70, 44, 163, 85, 105, 35, 36, 49,
85, 61, 2756, 93, 69, 84, 67, 36, 44, 2884, 49, 99, 36, 189, 1380, 61, 3012, 61, 85, 138,
341, 1028, 1173, 413, 516, 1013, 61, 330, 981, 266, 53, 490, 1045, 330, 1269, 490, 10261, 65508, 65508, 65508,
14436, 2069, 65508, 65508, 65508, 65508, 65508, 65508, 65508, 65508, 65508, 65508, 16612, 125, 676, 35, 36580, 125, 1781, 317,
1284, 195, 81, 8580, 35, 113, 516, 328, 68, 669, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 36, 37, 103, 49,
325, 49, 35, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32,
33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 67, 69, 2244, 329, 69, 209, 285, 756, 291,
84, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 97, 32, 33, 32, 33, 32,
33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32,
33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32,
33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 35, 257, 32,
33, 32, 33, 64, 33, 32, 33, 32, 33, 32, 33, 32, 33, 35, 84, 32, 33, 32, 33, 36,
32, 33, 32, 97, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,
32, 33, 32, 33, 160, 33, 160, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 93, 32,
33, 128, 33, 32, 33, 1373, 32, 33, 36, 67, 33, 228, 37, 100, 37, 132, 37, 740, 70, 69,
38, 149, 37, 125, 202, 85, 51, 53, 221, 1668, 145, 285, 70, 1604, 518, 69, 285, 81, 328, 221,
581, 196, 113, 36, 49, 68, 37, 328, 900, 261, 81, 740, 357, 70, 381, 49, 932, 125, 101, 38,
1508, 37, 70, 133, 70, 69, 102, 433, 61, 35, 328, 157, 81, 164, 37, 35, 292, 328, 164, 61,
1316, 197, 70, 69, 70, 69, 317, 100, 37, 260, 37, 38, 93, 328, 93, 145, 516, 35, 196, 117,
36, 38, 37, 38, 1604, 37, 36, 101, 68, 69, 164, 69, 36, 37, 36, 797, 68, 35, 81, 356,
38, 69, 70, 81, 36, 67, 38, 37, 349, 196, 93, 196, 93, 196, 317, 228, 61, 228, 61, 1377,
52, 131, 289, 35, 84, 157, 2561, 1124, 70, 37, 70, 37, 70, 49, 38, 37, 93, 328, 221, 65508,
65508, 65508, 65508, 65508, 29988, 413, 740, 157, 1572, 157, 65531, 59, 65532, 65532, 65532, 8316, 11716, 93, 3396, 1245,
225, 413, 161, 189, 36, 37, 324, 50, 420, 61, 164, 61, 36, 61, 68, 61, 68, 61, 3460, 532,
573, 11620, 46, 45, 541, 2052, 93, 1732, 1309, 388, 51, 53, 93, 517, 241, 45, 46, 49, 221, 517,
49, 76, 75, 45, 46, 45, 46, 45, 46, 45, 46, 45, 46, 45, 46, 45, 46, 45, 46, 81,
45, 46, 145, 107, 113, 61, 145, 44, 45, 46, 45, 46, 45, 46, 113, 50, 44, 114, 61, 49,
51, 81, 157, 164, 61, 4324, 93, 58, 61, 113, 51, 113, 45, 46, 49, 50, 49, 44, 81, 328,
81, 114, 81, 832, 45, 49, 46, 52, 43, 52, 833, 45, 50, 46, 50, 45, 46, 49, 45, 46,
81, 324, 35, 1444, 67, 996, 125, 196, 93, 196, 93, 196, 93, 100, 125, 83, 50, 52, 53, 83,
61, 53, 146, 85, 349, 122, 85, 93,
};
#endif
//--Autogenerated -- end of section automatically generated
constexpr int maxUnicode = 0x10ffff;
constexpr int maskCategory = 0x1F;
}
// Each element in catRanges is the start of a range of Unicode characters in
// one general category.
// The value is comprised of a 21-bit character value shifted 5 bits and a 5 bit
// category matching the CharacterCategory enumeration.
// Initial version has 3249 entries and adds about 13K to the executable.
// The array is in ascending order so can be searched using binary search.
// Therefore the average call takes log2(3249) = 12 comparisons.
// For speed, it may be useful to make a linear table for the common values,
// possibly for 0..0xff for most Western European text or 0..0xfff for most
// alphabetic languages.
CharacterCategory CategoriseCharacter(int character) noexcept {
if (character < 0 || character > maxUnicode) {
return ccCn;
}
#if CHARACTERCATEGORY_OPTIMIZE_LATIN1
if (static_cast<size_t>(character) < std::size(catLatin)) {
return static_cast<CharacterCategory>(catLatin[character]);
}
#endif
#if CHARACTERCATEGORY_USE_BINARY_SEARCH
const int baseValue = character * (maskCategory+1) + maskCategory;
const int *placeAfter = std::lower_bound(catRanges, std::end(catRanges), baseValue);
return static_cast<CharacterCategory>(*(placeAfter-1) & maskCategory);
#else
unsigned int index = (catTable1[character >> catTableShift11] << catTableShift12) | (character & catTableMask1);
index = (catTable2[index >> catTableShift21] << catTableShift22) | (index & catTableMask2);
return static_cast<CharacterCategory>(catTable[index]);
#endif
}
// Implementation of character sets recommended for identifiers in Unicode Standard Annex #31.
// https://unicode.org/reports/tr31/
namespace {
enum class OtherID { oidNone, oidStart, oidContinue };
// Some characters are treated as valid for identifiers even
// though most characters from their category are not.
// Values copied from https://www.unicode.org/Public/12.1.0/ucd/PropList.txt
OtherID OtherIDOfCharacter(int character) noexcept {
if (
(character == 0x1885) || // MONGOLIAN LETTER ALI GALI BALUDA
(character == 0x1886) || // MONGOLIAN LETTER ALI GALI THREE BALUDA
(character == 0x2118) || // SCRIPT CAPITAL P
(character == 0x212E) || // ESTIMATED SYMBOL
(character == 0x309B) || // KATAKANA-HIRAGANA VOICED SOUND MARK
(character == 0x309C)) { // KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK
return OtherID::oidStart;
}
if (
(character == 0x00B7) || // MIDDLE DOT
(character == 0x0387) || // GREEK ANO TELEIA
((character >= 0x1369) && (character <= 0x1371)) || // ETHIOPIC DIGIT ONE..ETHIOPIC DIGIT NINE
(character == 0x19DA)) { // NEW TAI LUE THAM DIGIT ONE
return OtherID::oidContinue;
}
return OtherID::oidNone;
}
// Determine if a character is in Ll|Lu|Lt|Lm|Lo|Nl|Mn|Mc|Nd|Pc and has
// Pattern_Syntax|Pattern_White_Space.
// As of Unicode 12, only VERTICAL TILDE which is in Lm and has Pattern_Syntax matches.
// Should really generate from PropList.txt a list of Pattern_Syntax and Pattern_White_Space.
constexpr bool IsIdPattern(int character) noexcept {
return character == 0x2E2F;
}
bool OmitXidStart(int character) noexcept {
switch (character) {
case 0x037A: // GREEK YPOGEGRAMMENI
case 0x0E33: // THAI CHARACTER SARA AM
case 0x0EB3: // LAO VOWEL SIGN AM
case 0x309B: // KATAKANA-HIRAGANA VOICED SOUND MARK
case 0x309C: // KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK
case 0xFC5E: // ARABIC LIGATURE SHADDA WITH DAMMATAN ISOLATED FORM
case 0xFC5F: // ARABIC LIGATURE SHADDA WITH KASRATAN ISOLATED FORM
case 0xFC60: // ARABIC LIGATURE SHADDA WITH FATHA ISOLATED FORM
case 0xFC61: // ARABIC LIGATURE SHADDA WITH DAMMA ISOLATED FORM
case 0xFC62: // ARABIC LIGATURE SHADDA WITH KASRA ISOLATED FORM
case 0xFC63: // ARABIC LIGATURE SHADDA WITH SUPERSCRIPT ALEF ISOLATED FORM
case 0xFDFA: // ARABIC LIGATURE SALLALLAHOU ALAYHE WASALLAM
case 0xFDFB: // ARABIC LIGATURE JALLAJALALOUHOU
case 0xFE70: // ARABIC FATHATAN ISOLATED FORM
case 0xFE72: // ARABIC DAMMATAN ISOLATED FORM
case 0xFE74: // ARABIC KASRATAN ISOLATED FORM
case 0xFE76: // ARABIC FATHA ISOLATED FORM
case 0xFE78: // ARABIC DAMMA ISOLATED FORM
case 0xFE7A: // ARABIC KASRA ISOLATED FORM
case 0xFE7C: // ARABIC SHADDA ISOLATED FORM
case 0xFE7E: // ARABIC SUKUN ISOLATED FORM
case 0xFF9E: // HALFWIDTH KATAKANA VOICED SOUND MARK
case 0xFF9F: // HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK
return true;
default:
return false;
}
}
bool OmitXidContinue(int character) noexcept {
switch (character) {
case 0x037A: // GREEK YPOGEGRAMMENI
case 0x309B: // KATAKANA-HIRAGANA VOICED SOUND MARK
case 0x309C: // KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK
case 0xFC5E: // ARABIC LIGATURE SHADDA WITH DAMMATAN ISOLATED FORM
case 0xFC5F: // ARABIC LIGATURE SHADDA WITH KASRATAN ISOLATED FORM
case 0xFC60: // ARABIC LIGATURE SHADDA WITH FATHA ISOLATED FORM
case 0xFC61: // ARABIC LIGATURE SHADDA WITH DAMMA ISOLATED FORM
case 0xFC62: // ARABIC LIGATURE SHADDA WITH KASRA ISOLATED FORM
case 0xFC63: // ARABIC LIGATURE SHADDA WITH SUPERSCRIPT ALEF ISOLATED FORM
case 0xFDFA: // ARABIC LIGATURE SALLALLAHOU ALAYHE WASALLAM
case 0xFDFB: // ARABIC LIGATURE JALLAJALALOUHOU
case 0xFE70: // ARABIC FATHATAN ISOLATED FORM
case 0xFE72: // ARABIC DAMMATAN ISOLATED FORM
case 0xFE74: // ARABIC KASRATAN ISOLATED FORM
case 0xFE76: // ARABIC FATHA ISOLATED FORM
case 0xFE78: // ARABIC DAMMA ISOLATED FORM
case 0xFE7A: // ARABIC KASRA ISOLATED FORM
case 0xFE7C: // ARABIC SHADDA ISOLATED FORM
case 0xFE7E: // ARABIC SUKUN ISOLATED FORM
return true;
default:
return false;
}
}
}
// UAX #31 defines ID_Start as
// [[:L:][:Nl:][:Other_ID_Start:]--[:Pattern_Syntax:]--[:Pattern_White_Space:]]
bool IsIdStart(int character) noexcept {
if (IsIdPattern(character)) {
return false;
}
const OtherID oid = OtherIDOfCharacter(character);
if (oid == OtherID::oidStart) {
return true;
}
const CharacterCategory c = CategoriseCharacter(character);
return (c == ccLl || c == ccLu || c == ccLt || c == ccLm || c == ccLo
|| c == ccNl);
}
// UAX #31 defines ID_Continue as
// [[:ID_Start:][:Mn:][:Mc:][:Nd:][:Pc:][:Other_ID_Continue:]--[:Pattern_Syntax:]--[:Pattern_White_Space:]]
bool IsIdContinue(int character) noexcept {
if (IsIdPattern(character)) {
return false;
}
const OtherID oid = OtherIDOfCharacter(character);
if (oid != OtherID::oidNone) {
return true;
}
const CharacterCategory c = CategoriseCharacter(character);
return (c == ccLl || c == ccLu || c == ccLt || c == ccLm || c == ccLo
|| c == ccNl || c == ccMn || c == ccMc || c == ccNd || c == ccPc);
}
// XID_Start is ID_Start modified for Normalization Form KC in UAX #31
bool IsXidStart(int character) noexcept {
if (OmitXidStart(character)) {
return false;
}
return IsIdStart(character);
}
// XID_Continue is ID_Continue modified for Normalization Form KC in UAX #31
bool IsXidContinue(int character) noexcept {
if (OmitXidContinue(character)) {
return false;
}
return IsIdContinue(character);
}
CharacterCategoryMap::CharacterCategoryMap() {
Optimize(256);
}
int CharacterCategoryMap::Size() const noexcept {
return static_cast<int>(dense.size());
}
void CharacterCategoryMap::Optimize(int countCharacters) {
#if CHARACTERCATEGORY_USE_BINARY_SEARCH
const int characters = std::clamp(countCharacters, 256, maxUnicode + 1);
dense.resize(characters);
int end = 0;
int index = 0;
int current = catRanges[index];
++index;
do {
const int next = catRanges[index];
const unsigned char category = current & maskCategory;
current >>= 5;
end = std::min(characters, next >> 5);
while (current < end) {
dense[current++] = category;
}
current = next;
++index;
} while (characters > end);
#else
// only support BMP, see ExpandRLE() in CharClassify.cxx
const int characters = std::clamp(countCharacters, 256, 0xffff + 1);
dense.resize(characters);
int end = 0;
int index = 0;
do {
int current = CatTableRLE_BMP[index++];
const unsigned char category = current & maskCategory;
current >>= 5;
int count = std::min(current, characters - end);
while (count--) {
dense[end++] = category;
}
} while (characters > end);
#endif
}
}
| [
"zufuliu@gmail.com"
] | zufuliu@gmail.com |
8fd5c8451d027a0907e326ad0834cbd207b1cda5 | a7b78ab632b77d1ed6b7e1fa46c33eda7a523961 | /test/core/test2.4.3/test.cc | 066d429e9ad8bd657f971b0898fa453447653003 | [
"BSD-2-Clause"
] | permissive | frovedis/frovedis | 80b830da4f3374891f3646a2298d71a3f42a1b2d | 875ae298dfa84ee9815f53db5bf7a8b76a379a6f | refs/heads/master | 2023-05-12T20:06:44.165117 | 2023-04-29T08:30:36 | 2023-04-29T08:30:36 | 138,103,263 | 68 | 13 | BSD-2-Clause | 2018-12-20T10:46:53 | 2018-06-21T01:17:51 | C++ | UTF-8 | C++ | false | false | 815 | cc | #include <frovedis.hpp>
#define BOOST_TEST_MODULE FrovedisTest
#include <boost/test/unit_test.hpp>
using namespace frovedis;
using namespace std;
std::vector<int> duplicate(int i) {
std::vector<int> v;
v.push_back(i); v.push_back(i);
return v;
}
BOOST_AUTO_TEST_CASE( frovedis_test )
{
int argc = 1;
char** argv = NULL;
use_frovedis use(argc, argv);
// filling sample input and output vectors
std::vector<int> v, ref_out;
for(size_t i = 1; i <= 8; i++) v.push_back(i);
for(size_t i = 1; i <= 8; i++) {
ref_out.push_back(i);
ref_out.push_back(i);
}
// testing for dvector::flat_map
auto d1 = frovedis::make_dvector_scatter(v);
auto d2 = d1.flat_map(duplicate);
auto r = d2.gather();
// confirming flattened vector with expected output
BOOST_CHECK(r == ref_out);
}
| [
"t-araki@dc.jp.nec.com"
] | t-araki@dc.jp.nec.com |
31568d0f836d137f63967072d2469027147ae9b3 | ff5313a6e6c9f9353f7505a37a57255c367ff6af | /wtl_hello/stdafx.h | e18df8bf55c9af71f7658ce5cb6d1d00bf5297aa | [] | no_license | badcodes/vc6 | 467d6d513549ac4d435e947927d619abf93ee399 | 0c11d7a81197793e1106c8dd3e7ec6b097a68248 | refs/heads/master | 2016-08-07T19:14:15.611418 | 2011-07-09T18:05:18 | 2011-07-09T18:05:18 | 1,220,419 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,454 | h | // stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__19DE612F_4674_42AE_B6FB_36E8EA9BB2D5__INCLUDED_)
#define AFX_STDAFX_H__19DE612F_4674_42AE_B6FB_36E8EA9BB2D5__INCLUDED_
// Change these values to use different versions
#define WINVER 0x0400
//#define _WIN32_WINNT 0x0400
#define _WIN32_IE 0x0400
#define _RICHEDIT_VER 0x0100
#include <atlbase.h>
#include <atlapp.h>
extern CAppModule _Module;
/*
#define _WTL_SUPPORT_SDK_ATL3
// Support for VS2005 Express & SDK ATL
#ifdef _WTL_SUPPORT_SDK_ATL3
#define _CRT_SECURE_NO_DEPRECATE
#pragma conform(forScope, off)
#pragma comment(linker, "/NODEFAULTLIB:atlthunk.lib")
#endif // _WTL_SUPPORT_SDK_ATL3
#include <atlbase.h>
// Support for VS2005 Express & SDK ATL
#ifdef _WTL_SUPPORT_SDK_ATL3
namespace ATL
{
inline void * __stdcall __AllocStdCallThunk()
{
return ::HeapAlloc(::GetProcessHeap(), 0, sizeof(_stdcallthunk));
}
inline void __stdcall __FreeStdCallThunk(void *p)
{
::HeapFree(::GetProcessHeap(), 0, p);
}
};
#endif // _WTL_SUPPORT_SDK_ATL3
*/
#include <atlwin.h>
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__19DE612F_4674_42AE_B6FB_36E8EA9BB2D5__INCLUDED_)
| [
"eotect@gmail.com"
] | eotect@gmail.com |
695f8caa3a3d984bc919fd0de36035eee7fbb281 | 0a708978050bca0c4bd51183614f83344918f900 | /Recursion/03_Spiral_Matrix/Cpp/main.cpp | c5d3d6712a2255d8bcb8b3cc0888bdb11fbd3a6d | [] | no_license | UHM-PANDA/Mock-Interview-Problems | f34d71ae58ddf609952bfa3eabd77b8eeb31e17b | db526f1ffa676878d7955b57560c4e37ef638156 | refs/heads/main | 2023-03-20T18:22:47.360198 | 2021-03-11T11:52:00 | 2021-03-11T11:52:00 | 305,627,179 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 231 | cpp | #include <iostream>
#inlcude <vector>
#include "spiral.hpp"
int main(int artgc, char** argv){
std::vector<std::vector<int>> in = {{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}};
spiral_matrix(in);
return 0;
} | [
"kgooding@hawaii.edu"
] | kgooding@hawaii.edu |
2c30282209774e64ddd20d11ae32ceb31e83f5a7 | fe2836176ca940977734312801f647c12e32a297 | /Codeforces/Gym/2014-2015 Samara SAU ACM ICPC Quarterfinal Qualification Contest/G/main.cpp | 318d681c19537f791ddfdb48767433c9a792e21b | [] | no_license | henrybear327/Sandbox | ef26d96bc5cbcdc1ce04bf507e19212ca3ceb064 | d77627dd713035ab89c755a515da95ecb1b1121b | refs/heads/master | 2022-12-25T16:11:03.363028 | 2022-12-10T21:08:41 | 2022-12-10T21:08:41 | 53,817,848 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 261 | cpp | #include <bits/stdc++.h>
int main()
{
int N, S;
scanf("%d %d", &N, &S);
int ans = 0;
for (int i = 0; i < N; i++) {
int a;
scanf("%d", &a);
ans += S % a;
S /= a;
}
printf("%d\n", ans + S);
return 0;
}
| [
"henrybear327@gmail.com"
] | henrybear327@gmail.com |
94ee135c52670f28ed6731c16ac4e2c6d8dd7a77 | a4515918f56dd7ab527e4999aa7fce818b6dd6f6 | /Algorithms/Search/Linear_search.cpp | 897bcf357ee8e7709bd5d43d0740d0fb91db3c4b | [
"MIT"
] | permissive | rathoresrikant/HacktoberFestContribute | 0e2d4692a305f079e5aebcd331e8df04b90f90da | e2a69e284b3b1bd0c7c16ea41217cc6c2ec57592 | refs/heads/master | 2023-06-13T09:22:22.554887 | 2021-10-27T07:51:41 | 2021-10-27T07:51:41 | 151,832,935 | 102 | 901 | MIT | 2023-06-23T06:53:32 | 2018-10-06T11:23:31 | C++ | UTF-8 | C++ | false | false | 630 | cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main()
{
unsigned long long int n,i,*arr;
long long int x;
int flag=1;
cout<<"Enter the size of the array which you want to search: ";
cin>>n;
arr= new long long int [n];
for(i=0;i<n;i++)
{
cin>>arr[i];
}
//not sorting as it will take nlog(n) instead of n incase of searching without sorting
cout<<endl<<"Enter the number to search: ";
cin>>x;
for(i=0;i<n;i++)
{
if(arr[i]==x)
{
cout<<"The point is present in position "<<i;
flag=0;
break;
}
}
if(flag==1)
{
cout<<"The point is not present"<<endl;
}
delete [] arr;
return 0;
} | [
"thearkamitra@gmail.com"
] | thearkamitra@gmail.com |
73bc0daba4fdd31ee59de753db52a41a3d310493 | a3d6556180e74af7b555f8d47d3fea55b94bcbda | /content/browser/android/additional_navigation_params_utils.cc | c1e04d1e5098047eb7fd135e9b4e7e7d431eaa46 | [
"BSD-3-Clause"
] | permissive | chromium/chromium | aaa9eda10115b50b0616d2f1aed5ef35d1d779d6 | a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c | refs/heads/main | 2023-08-24T00:35:12.585945 | 2023-08-23T22:01:11 | 2023-08-23T22:01:11 | 120,360,765 | 17,408 | 7,102 | BSD-3-Clause | 2023-09-10T23:44:27 | 2018-02-05T20:55:32 | null | UTF-8 | C++ | false | false | 3,263 | cc | // Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/android/additional_navigation_params_utils.h"
#include "base/android/unguessable_token_android.h"
#include "base/numerics/safe_conversions.h"
#include "content/public/android/content_jni_headers/AdditionalNavigationParamsUtils_jni.h"
namespace content {
base::android::ScopedJavaLocalRef<jobject> CreateJavaAdditionalNavigationParams(
JNIEnv* env,
base::UnguessableToken initiator_frame_token,
int initiator_process_id,
absl::optional<base::UnguessableToken> attribution_src_token,
absl::optional<network::AttributionReportingRuntimeFeatures>
runtime_features) {
return Java_AdditionalNavigationParamsUtils_create(
env,
base::android::UnguessableTokenAndroid::Create(env,
initiator_frame_token),
initiator_process_id,
attribution_src_token ? base::android::UnguessableTokenAndroid::Create(
env, attribution_src_token.value())
: nullptr,
runtime_features ? runtime_features->ToEnumBitmask() : 0);
}
absl::optional<blink::LocalFrameToken>
GetInitiatorFrameTokenFromJavaAdditionalNavigationParams(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& j_object) {
if (!j_object) {
return absl::nullopt;
}
auto optional_token =
base::android::UnguessableTokenAndroid::FromJavaUnguessableToken(
env, Java_AdditionalNavigationParamsUtils_getInitiatorFrameToken(
env, j_object));
if (optional_token) {
return blink::LocalFrameToken(optional_token.value());
}
return absl::nullopt;
}
int GetInitiatorProcessIdFromJavaAdditionalNavigationParams(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& j_object) {
if (!j_object) {
return false;
}
return Java_AdditionalNavigationParamsUtils_getInitiatorProcessId(env,
j_object);
}
absl::optional<blink::AttributionSrcToken>
GetAttributionSrcTokenFromJavaAdditionalNavigationParams(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& j_object) {
if (!j_object) {
return absl::nullopt;
}
auto java_token = Java_AdditionalNavigationParamsUtils_getAttributionSrcToken(
env, j_object);
if (!java_token) {
return absl::nullopt;
}
auto optional_token =
base::android::UnguessableTokenAndroid::FromJavaUnguessableToken(
env, java_token);
if (optional_token) {
return blink::AttributionSrcToken(optional_token.value());
}
return absl::nullopt;
}
network::AttributionReportingRuntimeFeatures
GetAttributionRuntimeFeaturesFromJavaAdditionalNavigationParams(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& j_object) {
if (!j_object) {
return network::AttributionReportingRuntimeFeatures();
}
return network::AttributionReportingRuntimeFeatures::FromEnumBitmask(
base::checked_cast<uint64_t>(
Java_AdditionalNavigationParamsUtils_getAttributionRuntimeFeatures(
env, j_object)));
}
} // namespace content
| [
"chromium-scoped@luci-project-accounts.iam.gserviceaccount.com"
] | chromium-scoped@luci-project-accounts.iam.gserviceaccount.com |
01c5aa92003497e989be99a71a67939c9fe04d3f | 7bb34b9837b6304ceac6ab45ce482b570526ed3c | /external/webkit/Source/WebCore/html/HTMLImageElement.cpp | 836388f5a988765b6255f88fa9b1dc4ddc1b935f | [
"Apache-2.0",
"LGPL-2.0-only",
"BSD-2-Clause",
"LGPL-2.1-only",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"GPL-2.0-only",
"LicenseRef-scancode-other-copyleft"
] | permissive | ghsecuritylab/android_platform_sony_nicki | 7533bca5c13d32a8d2a42696344cc10249bd2fd8 | 526381be7808e5202d7865aa10303cb5d249388a | refs/heads/master | 2021-02-28T20:27:31.390188 | 2013-10-15T07:57:51 | 2013-10-15T07:57:51 | 245,730,217 | 0 | 0 | Apache-2.0 | 2020-03-08T00:59:27 | 2020-03-08T00:59:26 | null | UTF-8 | C++ | false | false | 13,046 | cpp | /*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "HTMLImageElement.h"
#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
#include "EventNames.h"
#include "FrameView.h"
#include "HTMLDocument.h"
#include "HTMLFormElement.h"
#include "HTMLNames.h"
#include "HTMLParserIdioms.h"
#include "RenderImage.h"
#include "ScriptEventListener.h"
using namespace std;
namespace WebCore {
using namespace HTMLNames;
HTMLImageElement::HTMLImageElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
: HTMLElement(tagName, document)
, m_imageLoader(this)
, ismap(false)
, m_form(form)
, m_compositeOperator(CompositeSourceOver)
{
ASSERT(hasTagName(imgTag));
if (form)
form->registerImgElement(this);
setIeForbidsInsertHTML();
}
PassRefPtr<HTMLImageElement> HTMLImageElement::create(Document* document)
{
return adoptRef(new HTMLImageElement(imgTag, document));
}
PassRefPtr<HTMLImageElement> HTMLImageElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
{
return adoptRef(new HTMLImageElement(tagName, document, form));
}
HTMLImageElement::~HTMLImageElement()
{
if (m_form)
m_form->removeImgElement(this);
}
PassRefPtr<HTMLImageElement> HTMLImageElement::createForJSConstructor(Document* document, const int* optionalWidth, const int* optionalHeight)
{
RefPtr<HTMLImageElement> image = adoptRef(new HTMLImageElement(imgTag, document));
if (optionalWidth)
image->setWidth(*optionalWidth);
if (optionalHeight > 0)
image->setHeight(*optionalHeight);
return image.release();
}
bool HTMLImageElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const
{
if (attrName == widthAttr ||
attrName == heightAttr ||
attrName == vspaceAttr ||
attrName == hspaceAttr ||
attrName == valignAttr) {
result = eUniversal;
return false;
}
if (attrName == borderAttr || attrName == alignAttr) {
result = eReplaced; // Shared with embed and iframe elements.
return false;
}
return HTMLElement::mapToEntry(attrName, result);
}
void HTMLImageElement::parseMappedAttribute(Attribute* attr)
{
const QualifiedName& attrName = attr->name();
if (attrName == altAttr) {
if (renderer() && renderer()->isImage())
toRenderImage(renderer())->updateAltText();
} else if (attrName == srcAttr)
m_imageLoader.updateFromElementIgnoringPreviousError();
else if (attrName == widthAttr)
addCSSLength(attr, CSSPropertyWidth, attr->value());
else if (attrName == heightAttr)
addCSSLength(attr, CSSPropertyHeight, attr->value());
else if (attrName == borderAttr) {
// border="noborder" -> border="0"
addCSSLength(attr, CSSPropertyBorderWidth, attr->value().toInt() ? attr->value() : "0");
addCSSProperty(attr, CSSPropertyBorderTopStyle, CSSValueSolid);
addCSSProperty(attr, CSSPropertyBorderRightStyle, CSSValueSolid);
addCSSProperty(attr, CSSPropertyBorderBottomStyle, CSSValueSolid);
addCSSProperty(attr, CSSPropertyBorderLeftStyle, CSSValueSolid);
} else if (attrName == vspaceAttr) {
addCSSLength(attr, CSSPropertyMarginTop, attr->value());
addCSSLength(attr, CSSPropertyMarginBottom, attr->value());
} else if (attrName == hspaceAttr) {
addCSSLength(attr, CSSPropertyMarginLeft, attr->value());
addCSSLength(attr, CSSPropertyMarginRight, attr->value());
} else if (attrName == alignAttr)
addHTMLAlignment(attr);
else if (attrName == valignAttr)
addCSSProperty(attr, CSSPropertyVerticalAlign, attr->value());
else if (attrName == usemapAttr) {
if (attr->value().string()[0] == '#')
usemap = attr->value();
else
usemap = document()->completeURL(stripLeadingAndTrailingHTMLSpaces(attr->value())).string();
setIsLink(!attr->isNull());
} else if (attrName == ismapAttr)
ismap = true;
else if (attrName == onabortAttr)
setAttributeEventListener(eventNames().abortEvent, createAttributeEventListener(this, attr));
else if (attrName == onloadAttr)
setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, attr));
else if (attrName == onbeforeloadAttr)
setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attr));
else if (attrName == compositeAttr) {
if (!parseCompositeOperator(attr->value(), m_compositeOperator))
m_compositeOperator = CompositeSourceOver;
} else if (attrName == nameAttr) {
const AtomicString& newName = attr->value();
if (inDocument() && document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
document->removeNamedItem(m_name);
document->addNamedItem(newName);
}
m_name = newName;
} else if (isIdAttributeName(attr->name())) {
const AtomicString& newId = attr->value();
if (inDocument() && document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
document->removeExtraNamedItem(m_id);
document->addExtraNamedItem(newId);
}
m_id = newId;
// also call superclass
HTMLElement::parseMappedAttribute(attr);
} else
HTMLElement::parseMappedAttribute(attr);
}
String HTMLImageElement::altText() const
{
// lets figure out the alt text.. magic stuff
// http://www.w3.org/TR/1998/REC-html40-19980424/appendix/notes.html#altgen
// also heavily discussed by Hixie on bugzilla
String alt = getAttribute(altAttr);
// fall back to title attribute
if (alt.isNull())
alt = getAttribute(titleAttr);
return alt;
}
RenderObject* HTMLImageElement::createRenderer(RenderArena* arena, RenderStyle* style)
{
if (style->contentData())
return RenderObject::createObject(this, style);
RenderImage* image = new (arena) RenderImage(this);
image->setImageResource(RenderImageResource::create());
return image;
}
void HTMLImageElement::attach()
{
HTMLElement::attach();
if (renderer() && renderer()->isImage() && m_imageLoader.haveFiredBeforeLoadEvent()) {
RenderImage* renderImage = toRenderImage(renderer());
RenderImageResource* renderImageResource = renderImage->imageResource();
if (renderImageResource->hasImage())
return;
renderImageResource->setCachedImage(m_imageLoader.image());
// If we have no image at all because we have no src attribute, set
// image height and width for the alt text instead.
if (!m_imageLoader.image() && !renderImageResource->cachedImage())
renderImage->setImageSizeForAltText();
}
}
void HTMLImageElement::insertedIntoDocument()
{
if (document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
document->addNamedItem(m_name);
document->addExtraNamedItem(m_id);
}
// If we have been inserted from a renderer-less document,
// our loader may have not fetched the image, so do it now.
if (!m_imageLoader.image())
m_imageLoader.updateFromElement();
HTMLElement::insertedIntoDocument();
}
void HTMLImageElement::removedFromDocument()
{
if (document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
document->removeNamedItem(m_name);
document->removeExtraNamedItem(m_id);
}
HTMLElement::removedFromDocument();
}
void HTMLImageElement::insertedIntoTree(bool deep)
{
if (!m_form) {
// m_form can be non-null if it was set in constructor.
for (ContainerNode* ancestor = parentNode(); ancestor; ancestor = ancestor->parentNode()) {
if (ancestor->hasTagName(formTag)) {
m_form = static_cast<HTMLFormElement*>(ancestor);
m_form->registerImgElement(this);
break;
}
}
}
HTMLElement::insertedIntoTree(deep);
}
void HTMLImageElement::removedFromTree(bool deep)
{
if (m_form)
m_form->removeImgElement(this);
m_form = 0;
HTMLElement::removedFromTree(deep);
}
int HTMLImageElement::width(bool ignorePendingStylesheets) const
{
if (!renderer()) {
// check the attribute first for an explicit pixel value
bool ok;
int width = getAttribute(widthAttr).toInt(&ok);
if (ok)
return width;
// if the image is available, use its width
if (m_imageLoader.image())
return m_imageLoader.image()->imageSize(1.0f).width();
}
if (ignorePendingStylesheets)
document()->updateLayoutIgnorePendingStylesheets();
else
document()->updateLayout();
RenderBox* box = renderBox();
return box ? adjustForAbsoluteZoom(box->contentWidth(), box) : 0;
}
int HTMLImageElement::height(bool ignorePendingStylesheets) const
{
if (!renderer()) {
// check the attribute first for an explicit pixel value
bool ok;
int height = getAttribute(heightAttr).toInt(&ok);
if (ok)
return height;
// if the image is available, use its height
if (m_imageLoader.image())
return m_imageLoader.image()->imageSize(1.0f).height();
}
if (ignorePendingStylesheets)
document()->updateLayoutIgnorePendingStylesheets();
else
document()->updateLayout();
RenderBox* box = renderBox();
return box ? adjustForAbsoluteZoom(box->contentHeight(), box) : 0;
}
int HTMLImageElement::naturalWidth() const
{
if (!m_imageLoader.image())
return 0;
return m_imageLoader.image()->imageSize(1.0f).width();
}
int HTMLImageElement::naturalHeight() const
{
if (!m_imageLoader.image())
return 0;
return m_imageLoader.image()->imageSize(1.0f).height();
}
bool HTMLImageElement::isURLAttribute(Attribute* attr) const
{
return attr->name() == srcAttr
|| attr->name() == lowsrcAttr
|| attr->name() == longdescAttr
|| (attr->name() == usemapAttr && attr->value().string()[0] != '#');
}
const AtomicString& HTMLImageElement::alt() const
{
return getAttribute(altAttr);
}
bool HTMLImageElement::draggable() const
{
// Image elements are draggable by default.
return !equalIgnoringCase(getAttribute(draggableAttr), "false");
}
void HTMLImageElement::setHeight(int value)
{
setAttribute(heightAttr, String::number(value));
}
KURL HTMLImageElement::src() const
{
return document()->completeURL(getAttribute(srcAttr));
}
void HTMLImageElement::setSrc(const String& value)
{
setAttribute(srcAttr, value);
}
void HTMLImageElement::setWidth(int value)
{
setAttribute(widthAttr, String::number(value));
}
int HTMLImageElement::x() const
{
RenderObject* r = renderer();
if (!r)
return 0;
// FIXME: This doesn't work correctly with transforms.
FloatPoint absPos = r->localToAbsolute();
return absPos.x();
}
int HTMLImageElement::y() const
{
RenderObject* r = renderer();
if (!r)
return 0;
// FIXME: This doesn't work correctly with transforms.
FloatPoint absPos = r->localToAbsolute();
return absPos.y();
}
bool HTMLImageElement::complete() const
{
return m_imageLoader.imageComplete();
}
void HTMLImageElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const
{
HTMLElement::addSubresourceAttributeURLs(urls);
addSubresourceURL(urls, src());
// FIXME: What about when the usemap attribute begins with "#"?
addSubresourceURL(urls, document()->completeURL(getAttribute(usemapAttr)));
}
void HTMLImageElement::willMoveToNewOwnerDocument()
{
m_imageLoader.elementWillMoveToNewOwnerDocument();
HTMLElement::willMoveToNewOwnerDocument();
}
}
| [
"gahlotpercy@gmail.com"
] | gahlotpercy@gmail.com |
24388a9158b0a0b7111afa1fe9742f3631e8d8e7 | bd73c74a097f803e961c93998f8e2ba385534a75 | /Sistema_de_Control__distancia_/Sistema_de_Control__distancia_.ino | 1cbb94939afb4a62080ece097416df66d674af96 | [] | no_license | mjdvr23/MicroMouse | b27b0f0ab8bfcbea2a19491c8a09be70e5945ca3 | 6bfbdaccb097607d1e84c072f4c9135ec69b61b5 | refs/heads/master | 2021-01-10T06:40:36.623921 | 2016-01-29T13:05:42 | 2016-01-29T13:05:42 | 44,977,609 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 4,733 | ino | #define in_1 5 // Left drive motor pin
#define in_2 10 // Left reverse motor pin
#define in_3 9 // Rigth drive motor pin
#define in_4 6 //Right reverse motor pin
#define xOR_LeftPin 3
#define xOR_RightPin 2
#define encoder_B_PinLeft 13
#define encoder_B_PinRight 4
int encoder_PosLeft = 0;
int encoder_PosRight = 0;
int encoder_PrevPos_Left;
int encoder_PrevPos_Right;
int xOR_Value_Left;
int xOR_Value_Right;
int xOR_PrevValue_Left;
int xOR_PrevValue_Right;
int encoder_B_Value_Left = HIGH;
int encoder_B_Value_Right;
int encoder_B_PrevValue_Left;
int encoder_B_PrevValue_Right;
int encoder_A_Value_Left = HIGH;
int encoder_A_Value_Right;
int encoder_A_PrevValue_Left;
int encoder_A_PrevValue_Right;
//int encoderPrevPosLeft = 0;
//int encoderPrevPosRight = 0;
int ticksPies = 832;
int ticksUnidad = 453;
int pies =4;
boolean start = true;
int pwm =180;
double unidad = 12; // pulgadas
int ticksIdeal = pies * ticksPies;
int ticksCalculadosLeft;
int ticksCalculadosRight;
void setup() {
// put your setup code here, to run once:
pinMode (in_1, OUTPUT);
pinMode (in_2, OUTPUT);
pinMode (in_3, OUTPUT);
pinMode (in_4, OUTPUT);
pinMode(encoder_B_PinLeft, INPUT);
pinMode(encoder_B_PinRight, INPUT);
pinMode(xOR_LeftPin, INPUT);
digitalWrite(xOR_LeftPin , HIGH);
pinMode(xOR_RightPin, INPUT);
digitalWrite(xOR_RightPin, HIGH);
attachInterrupt(digitalPinToInterrupt(xOR_LeftPin), readxORLeft, CHANGE);
attachInterrupt(digitalPinToInterrupt(xOR_RightPin), readxORRight, CHANGE);
Serial.begin(9600);
forward(true,true);
}
void loop() {
// put your main code here, to run repeatedly:
ticksCalculadosLeft = encoder_PosLeft;
ticksCalculadosRight = encoder_PosRight;
reviserLeft();
reviserRight();
checkEncoders();
//printEncoderValue();
}
void reviserLeft() {
if (ticksIdeal != ticksCalculadosLeft)
equalizerLeft();
}
void equalizerLeft() {
if (ticksIdeal - ticksCalculadosLeft > 0)
forward(true, false);
else if (ticksIdeal - ticksCalculadosLeft < 0)
reverse(true, false);
else
pause(true, false);
}
void reviserRight() {
if (ticksIdeal != ticksCalculadosRight)
equalizerRight();
}
void equalizerRight() {
if (ticksIdeal - ticksCalculadosRight > 0)
forward(false, true);
else if (ticksIdeal - ticksCalculadosRight < 0)
reverse(false, true);
else
pause(false, true);
}
void readxORLeft () {
xOR_PrevValue_Left = xOR_Value_Left;
encoder_A_PrevValue_Left = encoder_A_Value_Left;
encoder_B_PrevValue_Left = encoder_B_Value_Left;
xOR_Value_Left = digitalRead(xOR_LeftPin);
encoder_B_Value_Left = digitalRead(encoder_B_PinLeft);
encoder_A_Value_Left = xOR_Value_Left ^ encoder_B_Value_Left;
encoder_PrevPos_Left = encoder_PosLeft;
if ((encoder_B_Value_Left ^ encoder_A_PrevValue_Left) & ~(encoder_A_Value_Left ^ encoder_B_PrevValue_Left)) {
encoder_PosLeft++;
}
else {
encoder_PosLeft--;
}
}
void readxORRight() {
xOR_PrevValue_Right = xOR_Value_Right;
encoder_A_PrevValue_Right = encoder_A_Value_Right;
encoder_B_PrevValue_Right = encoder_B_Value_Right;
xOR_Value_Right = digitalRead(xOR_RightPin);
encoder_B_Value_Right = digitalRead(encoder_B_PinRight);
encoder_A_Value_Right = xOR_Value_Right ^ encoder_B_Value_Right;
encoder_PrevPos_Right = encoder_PosRight;
if ((encoder_B_Value_Right ^ encoder_A_PrevValue_Right) & ~(encoder_A_Value_Right ^ encoder_B_PrevValue_Right)) {
encoder_PosRight--;
}
else {
encoder_PosRight++;
}
}
void printEncoderValue() {
Serial.print("Left Encoder is: ");
Serial.print(" ");
Serial.print(encoder_PosLeft);
Serial.print(" ");
Serial.print(" Right Encoder is: ");
Serial.print(" ");
Serial.println(encoder_PosRight);
}
void forward(boolean left, boolean right) {
if (left) {
analogWrite(in_1, pwm);
}
if (right) {
analogWrite(in_3, pwm);
}
}
void reverse(boolean left, boolean right) {
if (left) {
analogWrite(in_2, pwm);
}
if (right) {
analogWrite(in_4, pwm);
}
}
void pause(boolean left, boolean right) {
if (left) {
digitalWrite(in_1, LOW);
}
digitalWrite(in_2, LOW);
if (right) {
digitalWrite(in_3, LOW);
}
digitalWrite(in_4, LOW);
}
void left() {
analogWrite(in_1, 0);
analogWrite(in_2, 0);
analogWrite(in_3, pwm);
analogWrite(in_4, 0);
}
void right() {
analogWrite(in_1, pwm);
analogWrite(in_2, 0);
analogWrite(in_3, 0);
analogWrite(in_4, 0);
}
void checkEncoders() {
if (encoder_PosRight < encoder_PosLeft) {
forward(true, false);
}
else if (encoder_PosRight > encoder_PosLeft) {
forward(false, true);
}
else
forward(true, true);
}
| [
"mikaeldelvalle@Mikaels-MBP.cpe.libertypr.com"
] | mikaeldelvalle@Mikaels-MBP.cpe.libertypr.com |
90921248a8b9633a8ba7c4877d60aaec5e1a9595 | 4469634a5205a9b6e3cca8788b78ffd4d69a50f6 | /aws-cpp-sdk-sms-voice/source/PinpointSMSVoiceClient.cpp | 56c0e13869189c2d233b745e006e3c90068fe6a4 | [
"MIT",
"Apache-2.0",
"JSON"
] | permissive | tnthornton/aws-sdk-cpp | 7070108f778ce9c39211d7041a537a5598f2a351 | e30ee8c5b40091a11f1019d9230bbfac1e6c5edd | refs/heads/master | 2020-04-11T04:53:19.482117 | 2018-12-12T01:33:22 | 2018-12-12T01:33:22 | 161,530,181 | 0 | 0 | Apache-2.0 | 2018-12-12T18:41:56 | 2018-12-12T18:41:55 | null | UTF-8 | C++ | false | false | 17,800 | cpp | /*
* Copyright 2010-2017 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/core/utils/Outcome.h>
#include <aws/core/auth/AWSAuthSigner.h>
#include <aws/core/client/CoreErrors.h>
#include <aws/core/client/RetryStrategy.h>
#include <aws/core/http/HttpClient.h>
#include <aws/core/http/HttpResponse.h>
#include <aws/core/http/HttpClientFactory.h>
#include <aws/core/auth/AWSCredentialsProviderChain.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <aws/core/utils/threading/Executor.h>
#include <aws/core/utils/DNS.h>
#include <aws/core/utils/logging/LogMacros.h>
#include <aws/sms-voice/PinpointSMSVoiceClient.h>
#include <aws/sms-voice/PinpointSMSVoiceEndpoint.h>
#include <aws/sms-voice/PinpointSMSVoiceErrorMarshaller.h>
#include <aws/sms-voice/model/CreateConfigurationSetRequest.h>
#include <aws/sms-voice/model/CreateConfigurationSetEventDestinationRequest.h>
#include <aws/sms-voice/model/DeleteConfigurationSetRequest.h>
#include <aws/sms-voice/model/DeleteConfigurationSetEventDestinationRequest.h>
#include <aws/sms-voice/model/GetConfigurationSetEventDestinationsRequest.h>
#include <aws/sms-voice/model/SendVoiceMessageRequest.h>
#include <aws/sms-voice/model/UpdateConfigurationSetEventDestinationRequest.h>
using namespace Aws;
using namespace Aws::Auth;
using namespace Aws::Client;
using namespace Aws::PinpointSMSVoice;
using namespace Aws::PinpointSMSVoice::Model;
using namespace Aws::Http;
using namespace Aws::Utils::Json;
static const char* SERVICE_NAME = "sms-voice";
static const char* ALLOCATION_TAG = "PinpointSMSVoiceClient";
PinpointSMSVoiceClient::PinpointSMSVoiceClient(const Client::ClientConfiguration& clientConfiguration) :
BASECLASS(clientConfiguration,
Aws::MakeShared<AWSAuthV4Signer>(ALLOCATION_TAG, Aws::MakeShared<DefaultAWSCredentialsProviderChain>(ALLOCATION_TAG),
SERVICE_NAME, clientConfiguration.region),
Aws::MakeShared<PinpointSMSVoiceErrorMarshaller>(ALLOCATION_TAG)),
m_executor(clientConfiguration.executor)
{
init(clientConfiguration);
}
PinpointSMSVoiceClient::PinpointSMSVoiceClient(const AWSCredentials& credentials, const Client::ClientConfiguration& clientConfiguration) :
BASECLASS(clientConfiguration,
Aws::MakeShared<AWSAuthV4Signer>(ALLOCATION_TAG, Aws::MakeShared<SimpleAWSCredentialsProvider>(ALLOCATION_TAG, credentials),
SERVICE_NAME, clientConfiguration.region),
Aws::MakeShared<PinpointSMSVoiceErrorMarshaller>(ALLOCATION_TAG)),
m_executor(clientConfiguration.executor)
{
init(clientConfiguration);
}
PinpointSMSVoiceClient::PinpointSMSVoiceClient(const std::shared_ptr<AWSCredentialsProvider>& credentialsProvider,
const Client::ClientConfiguration& clientConfiguration) :
BASECLASS(clientConfiguration,
Aws::MakeShared<AWSAuthV4Signer>(ALLOCATION_TAG, credentialsProvider,
SERVICE_NAME, clientConfiguration.region),
Aws::MakeShared<PinpointSMSVoiceErrorMarshaller>(ALLOCATION_TAG)),
m_executor(clientConfiguration.executor)
{
init(clientConfiguration);
}
PinpointSMSVoiceClient::~PinpointSMSVoiceClient()
{
}
void PinpointSMSVoiceClient::init(const ClientConfiguration& config)
{
m_configScheme = SchemeMapper::ToString(config.scheme);
if (config.endpointOverride.empty())
{
m_uri = m_configScheme + "://" + PinpointSMSVoiceEndpoint::ForRegion(config.region, config.useDualStack);
}
else
{
OverrideEndpoint(config.endpointOverride);
}
}
void PinpointSMSVoiceClient::OverrideEndpoint(const Aws::String& endpoint)
{
if (endpoint.compare(0, 7, "http://") == 0 || endpoint.compare(0, 8, "https://") == 0)
{
m_uri = endpoint;
}
else
{
m_uri = m_configScheme + "://" + endpoint;
}
}
CreateConfigurationSetOutcome PinpointSMSVoiceClient::CreateConfigurationSet(const CreateConfigurationSetRequest& request) const
{
Aws::StringStream ss;
Aws::Http::URI uri = m_uri;
ss << "/v1/sms-voice/configuration-sets";
uri.SetPath(uri.GetPath() + ss.str());
JsonOutcome outcome = MakeRequest(uri, request, HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER);
if(outcome.IsSuccess())
{
return CreateConfigurationSetOutcome(CreateConfigurationSetResult(outcome.GetResult()));
}
else
{
return CreateConfigurationSetOutcome(outcome.GetError());
}
}
CreateConfigurationSetOutcomeCallable PinpointSMSVoiceClient::CreateConfigurationSetCallable(const CreateConfigurationSetRequest& request) const
{
auto task = Aws::MakeShared< std::packaged_task< CreateConfigurationSetOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->CreateConfigurationSet(request); } );
auto packagedFunction = [task]() { (*task)(); };
m_executor->Submit(packagedFunction);
return task->get_future();
}
void PinpointSMSVoiceClient::CreateConfigurationSetAsync(const CreateConfigurationSetRequest& request, const CreateConfigurationSetResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
m_executor->Submit( [this, request, handler, context](){ this->CreateConfigurationSetAsyncHelper( request, handler, context ); } );
}
void PinpointSMSVoiceClient::CreateConfigurationSetAsyncHelper(const CreateConfigurationSetRequest& request, const CreateConfigurationSetResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
handler(this, request, CreateConfigurationSet(request), context);
}
CreateConfigurationSetEventDestinationOutcome PinpointSMSVoiceClient::CreateConfigurationSetEventDestination(const CreateConfigurationSetEventDestinationRequest& request) const
{
Aws::StringStream ss;
Aws::Http::URI uri = m_uri;
ss << "/v1/sms-voice/configuration-sets/";
ss << request.GetConfigurationSetName();
ss << "/event-destinations";
uri.SetPath(uri.GetPath() + ss.str());
JsonOutcome outcome = MakeRequest(uri, request, HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER);
if(outcome.IsSuccess())
{
return CreateConfigurationSetEventDestinationOutcome(CreateConfigurationSetEventDestinationResult(outcome.GetResult()));
}
else
{
return CreateConfigurationSetEventDestinationOutcome(outcome.GetError());
}
}
CreateConfigurationSetEventDestinationOutcomeCallable PinpointSMSVoiceClient::CreateConfigurationSetEventDestinationCallable(const CreateConfigurationSetEventDestinationRequest& request) const
{
auto task = Aws::MakeShared< std::packaged_task< CreateConfigurationSetEventDestinationOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->CreateConfigurationSetEventDestination(request); } );
auto packagedFunction = [task]() { (*task)(); };
m_executor->Submit(packagedFunction);
return task->get_future();
}
void PinpointSMSVoiceClient::CreateConfigurationSetEventDestinationAsync(const CreateConfigurationSetEventDestinationRequest& request, const CreateConfigurationSetEventDestinationResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
m_executor->Submit( [this, request, handler, context](){ this->CreateConfigurationSetEventDestinationAsyncHelper( request, handler, context ); } );
}
void PinpointSMSVoiceClient::CreateConfigurationSetEventDestinationAsyncHelper(const CreateConfigurationSetEventDestinationRequest& request, const CreateConfigurationSetEventDestinationResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
handler(this, request, CreateConfigurationSetEventDestination(request), context);
}
DeleteConfigurationSetOutcome PinpointSMSVoiceClient::DeleteConfigurationSet(const DeleteConfigurationSetRequest& request) const
{
Aws::StringStream ss;
Aws::Http::URI uri = m_uri;
ss << "/v1/sms-voice/configuration-sets/";
ss << request.GetConfigurationSetName();
uri.SetPath(uri.GetPath() + ss.str());
JsonOutcome outcome = MakeRequest(uri, request, HttpMethod::HTTP_DELETE, Aws::Auth::SIGV4_SIGNER);
if(outcome.IsSuccess())
{
return DeleteConfigurationSetOutcome(DeleteConfigurationSetResult(outcome.GetResult()));
}
else
{
return DeleteConfigurationSetOutcome(outcome.GetError());
}
}
DeleteConfigurationSetOutcomeCallable PinpointSMSVoiceClient::DeleteConfigurationSetCallable(const DeleteConfigurationSetRequest& request) const
{
auto task = Aws::MakeShared< std::packaged_task< DeleteConfigurationSetOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->DeleteConfigurationSet(request); } );
auto packagedFunction = [task]() { (*task)(); };
m_executor->Submit(packagedFunction);
return task->get_future();
}
void PinpointSMSVoiceClient::DeleteConfigurationSetAsync(const DeleteConfigurationSetRequest& request, const DeleteConfigurationSetResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
m_executor->Submit( [this, request, handler, context](){ this->DeleteConfigurationSetAsyncHelper( request, handler, context ); } );
}
void PinpointSMSVoiceClient::DeleteConfigurationSetAsyncHelper(const DeleteConfigurationSetRequest& request, const DeleteConfigurationSetResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
handler(this, request, DeleteConfigurationSet(request), context);
}
DeleteConfigurationSetEventDestinationOutcome PinpointSMSVoiceClient::DeleteConfigurationSetEventDestination(const DeleteConfigurationSetEventDestinationRequest& request) const
{
Aws::StringStream ss;
Aws::Http::URI uri = m_uri;
ss << "/v1/sms-voice/configuration-sets/";
ss << request.GetConfigurationSetName();
ss << "/event-destinations/";
ss << request.GetEventDestinationName();
uri.SetPath(uri.GetPath() + ss.str());
JsonOutcome outcome = MakeRequest(uri, request, HttpMethod::HTTP_DELETE, Aws::Auth::SIGV4_SIGNER);
if(outcome.IsSuccess())
{
return DeleteConfigurationSetEventDestinationOutcome(DeleteConfigurationSetEventDestinationResult(outcome.GetResult()));
}
else
{
return DeleteConfigurationSetEventDestinationOutcome(outcome.GetError());
}
}
DeleteConfigurationSetEventDestinationOutcomeCallable PinpointSMSVoiceClient::DeleteConfigurationSetEventDestinationCallable(const DeleteConfigurationSetEventDestinationRequest& request) const
{
auto task = Aws::MakeShared< std::packaged_task< DeleteConfigurationSetEventDestinationOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->DeleteConfigurationSetEventDestination(request); } );
auto packagedFunction = [task]() { (*task)(); };
m_executor->Submit(packagedFunction);
return task->get_future();
}
void PinpointSMSVoiceClient::DeleteConfigurationSetEventDestinationAsync(const DeleteConfigurationSetEventDestinationRequest& request, const DeleteConfigurationSetEventDestinationResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
m_executor->Submit( [this, request, handler, context](){ this->DeleteConfigurationSetEventDestinationAsyncHelper( request, handler, context ); } );
}
void PinpointSMSVoiceClient::DeleteConfigurationSetEventDestinationAsyncHelper(const DeleteConfigurationSetEventDestinationRequest& request, const DeleteConfigurationSetEventDestinationResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
handler(this, request, DeleteConfigurationSetEventDestination(request), context);
}
GetConfigurationSetEventDestinationsOutcome PinpointSMSVoiceClient::GetConfigurationSetEventDestinations(const GetConfigurationSetEventDestinationsRequest& request) const
{
Aws::StringStream ss;
Aws::Http::URI uri = m_uri;
ss << "/v1/sms-voice/configuration-sets/";
ss << request.GetConfigurationSetName();
ss << "/event-destinations";
uri.SetPath(uri.GetPath() + ss.str());
JsonOutcome outcome = MakeRequest(uri, request, HttpMethod::HTTP_GET, Aws::Auth::SIGV4_SIGNER);
if(outcome.IsSuccess())
{
return GetConfigurationSetEventDestinationsOutcome(GetConfigurationSetEventDestinationsResult(outcome.GetResult()));
}
else
{
return GetConfigurationSetEventDestinationsOutcome(outcome.GetError());
}
}
GetConfigurationSetEventDestinationsOutcomeCallable PinpointSMSVoiceClient::GetConfigurationSetEventDestinationsCallable(const GetConfigurationSetEventDestinationsRequest& request) const
{
auto task = Aws::MakeShared< std::packaged_task< GetConfigurationSetEventDestinationsOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->GetConfigurationSetEventDestinations(request); } );
auto packagedFunction = [task]() { (*task)(); };
m_executor->Submit(packagedFunction);
return task->get_future();
}
void PinpointSMSVoiceClient::GetConfigurationSetEventDestinationsAsync(const GetConfigurationSetEventDestinationsRequest& request, const GetConfigurationSetEventDestinationsResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
m_executor->Submit( [this, request, handler, context](){ this->GetConfigurationSetEventDestinationsAsyncHelper( request, handler, context ); } );
}
void PinpointSMSVoiceClient::GetConfigurationSetEventDestinationsAsyncHelper(const GetConfigurationSetEventDestinationsRequest& request, const GetConfigurationSetEventDestinationsResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
handler(this, request, GetConfigurationSetEventDestinations(request), context);
}
SendVoiceMessageOutcome PinpointSMSVoiceClient::SendVoiceMessage(const SendVoiceMessageRequest& request) const
{
Aws::StringStream ss;
Aws::Http::URI uri = m_uri;
ss << "/v1/sms-voice/voice/message";
uri.SetPath(uri.GetPath() + ss.str());
JsonOutcome outcome = MakeRequest(uri, request, HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER);
if(outcome.IsSuccess())
{
return SendVoiceMessageOutcome(SendVoiceMessageResult(outcome.GetResult()));
}
else
{
return SendVoiceMessageOutcome(outcome.GetError());
}
}
SendVoiceMessageOutcomeCallable PinpointSMSVoiceClient::SendVoiceMessageCallable(const SendVoiceMessageRequest& request) const
{
auto task = Aws::MakeShared< std::packaged_task< SendVoiceMessageOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->SendVoiceMessage(request); } );
auto packagedFunction = [task]() { (*task)(); };
m_executor->Submit(packagedFunction);
return task->get_future();
}
void PinpointSMSVoiceClient::SendVoiceMessageAsync(const SendVoiceMessageRequest& request, const SendVoiceMessageResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
m_executor->Submit( [this, request, handler, context](){ this->SendVoiceMessageAsyncHelper( request, handler, context ); } );
}
void PinpointSMSVoiceClient::SendVoiceMessageAsyncHelper(const SendVoiceMessageRequest& request, const SendVoiceMessageResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
handler(this, request, SendVoiceMessage(request), context);
}
UpdateConfigurationSetEventDestinationOutcome PinpointSMSVoiceClient::UpdateConfigurationSetEventDestination(const UpdateConfigurationSetEventDestinationRequest& request) const
{
Aws::StringStream ss;
Aws::Http::URI uri = m_uri;
ss << "/v1/sms-voice/configuration-sets/";
ss << request.GetConfigurationSetName();
ss << "/event-destinations/";
ss << request.GetEventDestinationName();
uri.SetPath(uri.GetPath() + ss.str());
JsonOutcome outcome = MakeRequest(uri, request, HttpMethod::HTTP_PUT, Aws::Auth::SIGV4_SIGNER);
if(outcome.IsSuccess())
{
return UpdateConfigurationSetEventDestinationOutcome(UpdateConfigurationSetEventDestinationResult(outcome.GetResult()));
}
else
{
return UpdateConfigurationSetEventDestinationOutcome(outcome.GetError());
}
}
UpdateConfigurationSetEventDestinationOutcomeCallable PinpointSMSVoiceClient::UpdateConfigurationSetEventDestinationCallable(const UpdateConfigurationSetEventDestinationRequest& request) const
{
auto task = Aws::MakeShared< std::packaged_task< UpdateConfigurationSetEventDestinationOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->UpdateConfigurationSetEventDestination(request); } );
auto packagedFunction = [task]() { (*task)(); };
m_executor->Submit(packagedFunction);
return task->get_future();
}
void PinpointSMSVoiceClient::UpdateConfigurationSetEventDestinationAsync(const UpdateConfigurationSetEventDestinationRequest& request, const UpdateConfigurationSetEventDestinationResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
m_executor->Submit( [this, request, handler, context](){ this->UpdateConfigurationSetEventDestinationAsyncHelper( request, handler, context ); } );
}
void PinpointSMSVoiceClient::UpdateConfigurationSetEventDestinationAsyncHelper(const UpdateConfigurationSetEventDestinationRequest& request, const UpdateConfigurationSetEventDestinationResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
{
handler(this, request, UpdateConfigurationSetEventDestination(request), context);
}
| [
"aws-sdk-cpp-automation@github.com"
] | aws-sdk-cpp-automation@github.com |
67d9b014346ee1f1ecce697fb7edbeae410b94b2 | 1af656c548d631368638f76d30a74bf93550b1d3 | /chrome/browser/ui/ash/chrome_keyboard_ui_unittest.cc | 01f2c211ee8067e4f9dadc81e4712fefe8c4ee32 | [
"BSD-3-Clause"
] | permissive | pineal/chromium | 8d246c746141ef526a55a0b387ea48cd4e7d42e8 | e6901925dd5b37d55accbac55564f639bf4f788a | refs/heads/master | 2023-03-17T05:50:14.231220 | 2018-10-24T20:11:12 | 2018-10-24T20:11:12 | 154,564,128 | 1 | 0 | NOASSERTION | 2018-10-24T20:20:43 | 2018-10-24T20:20:43 | null | UTF-8 | C++ | false | false | 1,388 | cc | // Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/ash/chrome_keyboard_ui.h"
#include <memory>
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/test_chrome_web_ui_controller_factory.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_controller.h"
#include "url/gurl.h"
namespace {
class ChromeKeyboardUITest : public ChromeRenderViewHostTestHarness {
public:
ChromeKeyboardUITest() = default;
~ChromeKeyboardUITest() override = default;
void SetUp() override {
ChromeRenderViewHostTestHarness::SetUp();
chrome_keyboard_ui_ = std::make_unique<ChromeKeyboardUI>(profile());
}
void TearDown() override {
chrome_keyboard_ui_.reset();
ChromeRenderViewHostTestHarness::TearDown();
}
protected:
std::unique_ptr<ChromeKeyboardUI> chrome_keyboard_ui_;
};
} // namespace
// Ensure ChromeKeyboardContentsDelegate is successfully constructed and has
// a valid aura::Window after calling LoadKeyboardWindow().
TEST_F(ChromeKeyboardUITest, ChromeKeyboardContentsDelegate) {
aura::Window* window =
chrome_keyboard_ui_->LoadKeyboardWindow(base::DoNothing());
EXPECT_TRUE(window);
}
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
8d71f4fb702bb445173269818431c0980a86e5cf | c51febc209233a9160f41913d895415704d2391f | /library/ATF/_remain_potion_buf_use_time_inform_zocl.hpp | 7604979814bf26f35b703e2d8ecc561e29361aaf | [
"MIT"
] | permissive | roussukke/Yorozuya | 81f81e5e759ecae02c793e65d6c3acc504091bc3 | d9a44592b0714da1aebf492b64fdcb3fa072afe5 | refs/heads/master | 2023-07-08T03:23:00.584855 | 2023-06-29T08:20:25 | 2023-06-29T08:20:25 | 463,330,454 | 0 | 0 | MIT | 2022-02-24T23:15:01 | 2022-02-24T23:15:00 | null | UTF-8 | C++ | false | false | 334 | hpp | // This file auto generated by plugin for ida pro. Generated code only for x64. Please, dont change manually
#pragma once
#include <common/common.h>
START_ATF_NAMESPACE
struct _remain_potion_buf_use_time_inform_zocl
{
bool bUse;
char byDay;
char byHour;
char byMin;
};
END_ATF_NAMESPACE
| [
"b1ll.cipher@yandex.ru"
] | b1ll.cipher@yandex.ru |
00b732b715054a7e54911ac2a9399895ac5b74fc | 902ea50f2af62e54977baffcf11f73f18519cd9e | /jx_top100/166. 分数到小数.cpp | 4bd8b38e9b2e8cb18582b6d16c5319f384e25841 | [] | no_license | dh434/leetcode | 80f1436106edd83d38d50d7e21005eaaa4096ac1 | 28ea3e3d5215b23120b9477e31c5727252e19e33 | refs/heads/master | 2020-06-05T16:49:17.023493 | 2019-11-17T12:55:58 | 2019-11-17T12:55:58 | 192,487,558 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,241 | cpp | /*
给定两个整数,分别表示分数的分子 numerator 和分母 denominator,以字符串形式返回小数。
如果小数部分为循环小数,则将循环的部分括在括号内。
示例 1:
输入: numerator = 1, denominator = 2
输出: "0.5"
示例 2:
输入: numerator = 2, denominator = 1
输出: "2"
示例 3:
输入: numerator = 2, denominator = 3
输出: "0.(6)"
*/
/*
这道题细节很多
测试样例 解释
\frac{0}{1}
1
0
被除数为 0。
\frac{1}{0}
0
1
除数为 0,应当抛出异常,这里为了简单起见不考虑。
\frac{20}{4}
4
20
答案是整数,不包括小数部分。
\frac{1}{2}
2
1
答案是 0.5,是有限小数。
\frac{-1}{4}
4
−1
或 \frac{1}{-4}
−4
1
除数被除数有一个为负数,结果为负数。
\frac{-1}{-4}
−4
−1
除数和被除数都是负数,结果为正数。
\frac{-2147483648}{-1}
−1
−2147483648
转成整数时注意可能溢出。
https://leetcode-cn.com/problems/fraction-to-recurring-decimal/solution/fen-shu-dao-xiao-shu-by-leetcode/
*/
//可以直接先求整数部分的,然后再单独求小数部分
class Solution {
public:
string fractionToDecimal(int numerator, int denominator) {
if(numerator == 0)
return "0";
string res = "";
if(numerator <0 ^ denominator <0 )
res += "-";
long dividend = numerator;
long divisor = denominator;
dividend = abs(dividend);
divisor = abs(divisor);
res += to_string(dividend/divisor);
long remainder = dividend%divisor;
if(remainder == 0)
return res;
res += ".";
map<int,int> mp;
while(remainder!=0){
// cout<<remainder<<endl;
if(mp.find(remainder) != mp.end()){
res.insert(mp[remainder], "(");
res += ")";
break;
}
mp[remainder] = res.size();
remainder *= 10;
res += to_string(remainder/divisor);
remainder = remainder%divisor;
}
return res;
}
};
| [
"denghao@bupt.edu.cn"
] | denghao@bupt.edu.cn |
05915e30cb2caf2b6cdef41034513c940ce959a1 | 0bc263b0eeeba9398c7ce950a1e571bb29c1653f | /HTWK_SD_FILTER/SD_SimpleDrive/IParkGap.h | 2ea67d76e634aa374c1d3060bc84c322824a53d2 | [
"BSD-2-Clause"
] | permissive | neophack/HTWK_SmartDriving_2015 | b9de57b72137e71130d33634f28e88b66ed17d71 | 95ee77aa0f9ebbb541bbb1e3b99d3f044347d103 | refs/heads/master | 2020-06-22T14:32:07.322632 | 2015-11-02T10:55:31 | 2015-11-02T10:55:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,862 | h | /**
* Copyright (c) 2014-2015, HTWK SmartDriving
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* AUTHORS: Silvio Feig, Denny Hecht, Andreas Kluge, Lars Kollmann, Eike Florian Petersen, Artem Pokas
*
*/
#ifndef _I_PARK_GAP_H_
#define _I_PARK_GAP_H_
class IParkGap
{
protected:
bool isDebugActive;
public:
//virtual bool isParkingGapFound() const = 0;
virtual bool searchParkingGap(const tInt &irValue,const tInt &distance) = 0;
virtual void setIsDebugActive(const bool &isDebugActive) = 0;
virtual void setDecision(const Decision ¤tDecision) = 0;
};
#endif | [
"gjenschmischek@gmail.com"
] | gjenschmischek@gmail.com |
eae05a8e271dfc203b1c56419ec36a7992f168e2 | 78b337c794b02372620ffbb6674073c6f0d1fd3d | /assimp-5.0.1/test/unit/utXImporterExporter.cpp | 39cda4e35c8c0c3dbb339789023f8eab5c71197f | [
"MIT",
"LGPL-2.0-or-later",
"BSD-3-Clause"
] | permissive | eglowacki/yaget_dependencies | 1fb0298f5af210fcc0f8e2c7052a97be5134f0fc | 7bbaaef4d968b9f1cd54963331017ac499777a1f | refs/heads/master | 2023-06-27T18:10:29.104169 | 2021-07-17T19:38:16 | 2021-07-17T19:38:16 | 261,091,491 | 0 | 0 | MIT | 2021-02-27T21:20:16 | 2020-05-04T05:51:17 | C++ | UTF-8 | C++ | false | false | 4,842 | cpp | /*
---------------------------------------------------------------------------
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2020, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following
conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the assimp team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------
*/
#include "AbstractImportExportBase.h"
#include "UnitTestPCH.h"
#include <assimp/postprocess.h>
#include <assimp/Importer.hpp>
using namespace Assimp;
class utXImporterExporter : public AbstractImportExportBase {
public:
virtual bool importerTest() {
Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/X/test.x", aiProcess_ValidateDataStructure);
return nullptr != scene;
}
};
TEST_F(utXImporterExporter, importXFromFileTest) {
EXPECT_TRUE(importerTest());
}
TEST_F(utXImporterExporter, heap_overflow_in_tokenizer) {
Assimp::Importer importer;
EXPECT_NO_THROW(importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/X/OV_GetNextToken", 0));
}
TEST(utXImporter, importAnimTest) {
Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/X/anim_test.x", aiProcess_ValidateDataStructure);
ASSERT_NE(nullptr, scene);
}
TEST(utXImporter, importBCNEpileptic) {
Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/X/BCN_Epileptic.X", aiProcess_ValidateDataStructure);
ASSERT_NE(nullptr, scene);
}
TEST(utXImporter, importFromTrueSpaceBin32) {
Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/X/fromtruespace_bin32.x", aiProcess_ValidateDataStructure);
ASSERT_NE(nullptr, scene);
}
TEST(utXImporter, import_kwxport_test_cubewithvcolors) {
Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/X/kwxport_test_cubewithvcolors.x", aiProcess_ValidateDataStructure);
ASSERT_NE(nullptr, scene);
}
TEST(utXImporter, importTestCubeBinary) {
Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/X/test_cube_binary.x", aiProcess_ValidateDataStructure);
ASSERT_NE(nullptr, scene);
}
TEST(utXImporter, importTestCubeCompressed) {
Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/X/test_cube_compressed.x", aiProcess_ValidateDataStructure);
ASSERT_NE(nullptr, scene);
}
TEST(utXImporter, importTestCubeText) {
Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/X/test_cube_text.x", aiProcess_ValidateDataStructure);
ASSERT_NE(nullptr, scene);
}
TEST(utXImporter, importTestWuson) {
Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/X/Testwuson.X", aiProcess_ValidateDataStructure);
ASSERT_NE(nullptr, scene);
}
TEST(utXImporter, TestFormatDetection) {
Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/X/TestFormatDetection", aiProcess_ValidateDataStructure);
ASSERT_NE(nullptr, scene);
}
TEST(utXImporter, importDwarf) {
Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_NONBSD_DIR "/X/dwarf.x", aiProcess_ValidateDataStructure);
ASSERT_NE(nullptr, scene);
}
| [
"edgar_glowacki@yahoo.com"
] | edgar_glowacki@yahoo.com |
c2effe2951f4f5cb98180ed3440e701100b9d241 | 9836a073c4f9c4f371fdfe971045835a0736c73c | /Genetic_Algorithm/MainCycle.cpp | c7fe0f397405d21b058de39a66181b0279622c60 | [] | no_license | Volodimirich/LargeSystems | 962efce5be55d077f32b9d4b959d0cdba305f693 | dfaa70312cd48cfcb6c37cb9f777b29d381f85e8 | refs/heads/master | 2023-02-05T04:42:32.461806 | 2020-12-17T23:11:39 | 2020-12-17T23:11:39 | 295,217,829 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,310 | cpp | //
// Created by voland on 15.12.2020.
//
#include "MainCycle.h"
#include "vector"
#include <unistd.h>
#include <fstream>
#include "string"
void MainCycle::Clear() {
printf("\033[2J");
printf("\033[%d;%dH", 0, 0);
}
void MainCycle::WriteInFile(space &best, bool last) {
std::cout<<exp_numb;
std::cout<<launch_numb << std::endl;
std::string filename = !last ? "series_" + std::to_string(exp_numb) + "_run_" + std::to_string(launch_numb) + ".txt" :
"series_" + std::to_string(exp_numb) + "_run_" + std::to_string(launch_numb) + "_sol_after100.txt";
std::ofstream file(filename.c_str());
for (size_t i = 0; i < best.size(); i++) {
for (size_t j = 0; j < best[i].size(); j++) {
auto symb = best[i][j] == 1 ? "#" : ".";
file << symb;
}
file << std::endl;
}
file.close();
}
void MainCycle::PrintResult(space &best) {
WriteInFile(best, false);
for (size_t it = 0; it<101; it++) {
// for (size_t i = 0; i < best.size(); i++) {
// for (size_t j = 0; j < best[i].size(); j++) {
// auto symb = best[i][j] == 1 ? "#" : ".";
// std::cout << symb;
// }
// std::cout << std::endl;
// }
estim->LifeStart(best, 1);
// usleep(500000);
// Clear();
}
WriteInFile(best, true);
}
MainCycle::MainCycle() {
space gen;
std::vector<int> line;
estim = std::make_unique<Estimation> ();
select = std::make_unique<Selection>();
cross = std::make_unique<Crossing>();
mutate = std::make_unique<Mutation>();
srand(static_cast<unsigned int>(time(nullptr)));
for (size_t pop = 0; pop<POPULATION_SIZE; pop++){
for (size_t i=0; i<FIELD; i++) {
for (size_t j = 0; j < FIELD; j++) {
line.emplace_back(rand() % 2);
}
gen.emplace_back(line);
line.clear();
}
population.emplace_back(gen);
gen.clear();
}
}
void MainCycle::Start(float mut, int numb, int launch) {
std::pair <space, int> best = {{}, 0};
int pos;
size_t best_itt = 0;
mut_probability = mut;
exp_numb = numb;
launch_numb = launch;
while (best_itt < 20) {
pos = -1;
std::vector<std::pair<space, int>> population_estimition = estim->GetEstimation(population);
for (size_t i = 0; i < population_estimition.size(); i++) {
if (population_estimition[i].second > best.second) {
best.second = population_estimition[i].second;
pos = i;
}
}
if (pos != -1) {
best.first = population_estimition[pos].first;
best_itt = 0;
} else {
best_itt++;
}
std::vector<space> new_gen = select->GetSelect(population_estimition, 8, POPULATION_SIZE / 2);
cross->GetCrossing(new_gen);
mutate->GetMutation(new_gen, mut_probability);
population = new_gen;
}
std::cout << "BEST" << best.second << std::endl;
PrintResult(best.first);
std::string filename = "series_" + std::to_string(exp_numb) + "_best_result_" + std::to_string(launch_numb) + ".txt";
std::ofstream file(filename.c_str());
file << best.second;
file.close();
}
| [
"volodimirich@arccn.ru"
] | volodimirich@arccn.ru |
0fa5740501a496feee3388504193d0d9d258cdd2 | eb8dce3750f055dd87fcd635ff7cb34e53010a7c | /src/qt/teshubstrings.cpp | 475f125e0e28ad7e4f8e38fd9c83aef81ba7e5cb | [
"MIT"
] | permissive | Teshubcoin/wallet | 3c83f09d271ac3e627626e6ddc81978bfe0c5010 | 04c2182d922d1fa28136721de4306c174f0c62fd | refs/heads/master | 2020-03-21T18:45:24.285600 | 2018-06-29T04:06:50 | 2018-06-29T04:06:50 | 138,909,777 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 28,726 | cpp |
#include <QtGlobal>
// Automatically generated by extract_strings.py
#ifdef __GNUC__
#define UNUSED __attribute__((unused))
#else
#define UNUSED
#endif
static const char UNUSED *teshub_strings[] = {
QT_TRANSLATE_NOOP("teshub-core", ""
"(1 = keep tx meta data e.g. account owner and payment request information, 2 "
"= drop tx meta data)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Allow JSON-RPC connections from specified source. Valid for <ip> are a "
"single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or "
"a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times"),
QT_TRANSLATE_NOOP("teshub-core", ""
"An error occurred while setting up the RPC address %s port %u for listening: "
"%s"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Bind to given address and always listen on it. Use [host]:port notation for "
"IPv6"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Bind to given address and whitelist peers connecting to it. Use [host]:port "
"notation for IPv6"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Bind to given address to listen for JSON-RPC connections. Use [host]:port "
"notation for IPv6. This option can be specified multiple times (default: "
"bind to all interfaces)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Cannot obtain a lock on data directory %s. TesHub Core is probably already "
"running."),
QT_TRANSLATE_NOOP("teshub-core", ""
"Change automatic finalized budget voting behavior. mode=auto: Vote for only "
"exact finalized budget match to my generated budget. (string, default: auto)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Continuously rate-limit free transactions to <n>*1000 bytes per minute "
"(default:%u)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Create new files with system default permissions, instead of umask 077 (only "
"effective with disabled wallet functionality)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Delete all wallet transactions and only recover those parts of the "
"blockchain through -rescan on startup"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Disable all TesHub specific functionality (Masternodes, SwiftTX, "
"Budgeting) (0-1, default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Distributed under the MIT software license, see the accompanying file "
"COPYING or <http://www.opensource.org/licenses/mit-license.php>."),
QT_TRANSLATE_NOOP("teshub-core", ""
"Enable SwiftTX, show confirmations for locked transactions (bool, default: %s)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Enable spork administration functionality with the appropriate private key."),
QT_TRANSLATE_NOOP("teshub-core", ""
"Enter regression test mode, which uses a special chain in which blocks can "
"be solved instantly."),
QT_TRANSLATE_NOOP("teshub-core", ""
"Error: Listening for incoming connections failed (listen returned error %s)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Error: The transaction was rejected! This might happen if some of the coins "
"in your wallet were already spent, such as if you used a copy of wallet.dat "
"and coins were spent in the copy but not marked as spent here."),
QT_TRANSLATE_NOOP("teshub-core", ""
"Error: This transaction requires a transaction fee of at least %s because of "
"its amount, complexity, or use of recently received funds!"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Error: Unsupported argument -checklevel found. Checklevel must be level 4."),
QT_TRANSLATE_NOOP("teshub-core", ""
"Error: Unsupported argument -socks found. Setting SOCKS version isn't "
"possible anymore, only SOCKS5 proxies are supported."),
QT_TRANSLATE_NOOP("teshub-core", ""
"Execute command when a relevant alert is received or we see a really long "
"fork (%s in cmd is replaced by message)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Execute command when a wallet transaction changes (%s in cmd is replaced by "
"TxID)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Execute command when the best block changes (%s in cmd is replaced by block "
"hash)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Fees (in TESB/Kb) smaller than this are considered zero fee for relaying "
"(default: %s)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Fees (in TESB/Kb) smaller than this are considered zero fee for transaction "
"creation (default: %s)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Flush database activity from memory pool to disk log every <n> megabytes "
"(default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"If paytxfee is not set, include enough fee so transactions begin "
"confirmation on average within n blocks (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"In this mode -genproclimit controls how many blocks are generated "
"immediately."),
QT_TRANSLATE_NOOP("teshub-core", ""
"Insufficient or insufficient confirmed funds, you might need to wait a few "
"minutes and try again."),
QT_TRANSLATE_NOOP("teshub-core", ""
"Invalid amount for -maxtxfee=<amount>: '%s' (must be at least the minrelay "
"fee of %s to prevent stuck transactions)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Keep the specified amount available for spending at all times (default: 0)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Log transaction priority and fee per kB when mining blocks (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Maintain a full transaction index, used by the getrawtransaction rpc call "
"(default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Maximum size of data in data carrier transactions we relay and mine "
"(default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Maximum total fees to use in a single wallet transaction, setting too low "
"may abort large transactions (default: %s)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Number of seconds to keep misbehaving peers from reconnecting (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Output debugging information (default: %u, supplying <category> is optional)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Query for peer addresses via DNS lookup, if low on addresses (default: 1 "
"unless -connect)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Randomize credentials for every proxy connection. This enables Tor stream "
"isolation (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Require high priority for relaying free or low-fee transactions (default:%u)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Send trace/debug info to console instead of debug.log file (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Set maximum size of high-priority/low-fee transactions in bytes (default: %d)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Set the number of script verification threads (%u to %d, 0 = auto, <0 = "
"leave that many cores free, default: %d)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Set the number of threads for coin generation if enabled (-1 = all cores, "
"default: %d)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Show N confirmations for a successfully locked transaction (0-9999, default: "
"%u)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Support filtering of blocks and transaction with bloom filters (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"SwiftTX requires inputs with at least 6 confirmations, you might need to wait "
"a few minutes and try again."),
QT_TRANSLATE_NOOP("teshub-core", ""
"This is a pre-release test build - use at your own risk - do not use for "
"staking or merchant applications!"),
QT_TRANSLATE_NOOP("teshub-core", ""
"This product includes software developed by the OpenSSL Project for use in "
"the OpenSSL Toolkit <https://www.openssl.org/> and cryptographic software "
"written by Eric Young and UPnP software written by Thomas Bernard."),
QT_TRANSLATE_NOOP("teshub-core", ""
"To use teshubd, or the -server option to teshub-qt, you must set an rpcpassword "
"in the configuration file:\n"
"%s\n"
"It is recommended you use the following random password:\n"
"rpcuser=teshubrpc\n"
"rpcpassword=%s\n"
"(you do not need to remember this password)\n"
"The username and password MUST NOT be the same.\n"
"If the file does not exist, create it with owner-readable-only file "
"permissions.\n"
"It is also recommended to set alertnotify so you are notified of problems;\n"
"for example: alertnotify=echo %%s | mail -s \"TesHub Alert\" admin@foo.com\n"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Unable to bind to %s on this computer. TesHub Core is probably already running."),
QT_TRANSLATE_NOOP("teshub-core", ""
"Unable to locate enough funds for this transaction that are not equal 1000 "
"TESB."),
QT_TRANSLATE_NOOP("teshub-core", ""
"Use separate SOCKS5 proxy to reach peers via Tor hidden services (default: "
"%s)"),
QT_TRANSLATE_NOOP("teshub-core", ""
"Warning: -maxtxfee is set very high! Fees this large could be paid on a "
"single transaction."),
QT_TRANSLATE_NOOP("teshub-core", ""
"Warning: -paytxfee is set very high! This is the transaction fee you will "
"pay if you send a transaction."),
QT_TRANSLATE_NOOP("teshub-core", ""
"Warning: Please check that your computer's date and time are correct! If "
"your clock is wrong TesHub Core will not work properly."),
QT_TRANSLATE_NOOP("teshub-core", ""
"Warning: The network does not appear to fully agree! Some miners appear to "
"be experiencing issues."),
QT_TRANSLATE_NOOP("teshub-core", ""
"Warning: We do not appear to fully agree with our peers! You may need to "
"upgrade, or other nodes may need to upgrade."),
QT_TRANSLATE_NOOP("teshub-core", ""
"Warning: error reading wallet.dat! All keys read correctly, but transaction "
"data or address book entries might be missing or incorrect."),
QT_TRANSLATE_NOOP("teshub-core", ""
"Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as "
"wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect "
"you should restore from a backup."),
QT_TRANSLATE_NOOP("teshub-core", ""
"Whitelist peers connecting from the given netmask or IP address. Can be "
"specified multiple times."),
QT_TRANSLATE_NOOP("teshub-core", ""
"Whitelisted peers cannot be DoS banned and their transactions are always "
"relayed, even if they are already in the mempool, useful e.g. for a gateway"),
QT_TRANSLATE_NOOP("teshub-core", ""
"You must specify a masternodeprivkey in the configuration. Please see "
"documentation for help."),
QT_TRANSLATE_NOOP("teshub-core", "(23500 could be used only on mainnet)"),
QT_TRANSLATE_NOOP("teshub-core", "(default: %s)"),
QT_TRANSLATE_NOOP("teshub-core", "(default: 1)"),
QT_TRANSLATE_NOOP("teshub-core", "(must be 23500 for mainnet)"),
QT_TRANSLATE_NOOP("teshub-core", "<category> can be:"),
QT_TRANSLATE_NOOP("teshub-core", "Accept command line and JSON-RPC commands"),
QT_TRANSLATE_NOOP("teshub-core", "Accept connections from outside (default: 1 if no -proxy or -connect)"),
QT_TRANSLATE_NOOP("teshub-core", "Accept public REST requests (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Acceptable ciphers (default: %s)"),
QT_TRANSLATE_NOOP("teshub-core", "Add a node to connect to and attempt to keep the connection open"),
QT_TRANSLATE_NOOP("teshub-core", "Allow DNS lookups for -addnode, -seednode and -connect"),
QT_TRANSLATE_NOOP("teshub-core", "Already have that input."),
QT_TRANSLATE_NOOP("teshub-core", "Always query for peer addresses via DNS lookup (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Attempt to force blockchain corruption recovery"),
QT_TRANSLATE_NOOP("teshub-core", "Attempt to recover private keys from a corrupt wallet.dat"),
QT_TRANSLATE_NOOP("teshub-core", "Automatically create Tor hidden service (default: %d)"),
QT_TRANSLATE_NOOP("teshub-core", "Block creation options:"),
QT_TRANSLATE_NOOP("teshub-core", "Can't find random Masternode."),
QT_TRANSLATE_NOOP("teshub-core", "Cannot downgrade wallet"),
QT_TRANSLATE_NOOP("teshub-core", "Cannot resolve -bind address: '%s'"),
QT_TRANSLATE_NOOP("teshub-core", "Cannot resolve -externalip address: '%s'"),
QT_TRANSLATE_NOOP("teshub-core", "Cannot resolve -whitebind address: '%s'"),
QT_TRANSLATE_NOOP("teshub-core", "Cannot write default address"),
QT_TRANSLATE_NOOP("teshub-core", "Collateral not valid."),
QT_TRANSLATE_NOOP("teshub-core", "Connect only to the specified node(s)"),
QT_TRANSLATE_NOOP("teshub-core", "Connect through SOCKS5 proxy"),
QT_TRANSLATE_NOOP("teshub-core", "Connect to a node to retrieve peer addresses, and disconnect"),
QT_TRANSLATE_NOOP("teshub-core", "Connection options:"),
QT_TRANSLATE_NOOP("teshub-core", "Copyright (C) 2009-%i The Bitcoin Core Developers"),
QT_TRANSLATE_NOOP("teshub-core", "Copyright (C) 2014-%i The Dash Core Developers"),
QT_TRANSLATE_NOOP("teshub-core", "Copyright (C) 2015-%i The PIVX Core Developers"),
QT_TRANSLATE_NOOP("teshub-core", "Copyright (C) 2017-%i The TesHub Core Developers"),
QT_TRANSLATE_NOOP("teshub-core", "Corrupted block database detected"),
QT_TRANSLATE_NOOP("teshub-core", "Could not parse -rpcbind value %s as network address"),
QT_TRANSLATE_NOOP("teshub-core", "Could not parse masternode.conf"),
QT_TRANSLATE_NOOP("teshub-core", "Debugging/Testing options:"),
QT_TRANSLATE_NOOP("teshub-core", "Delete blockchain folders and resync from scratch"),
QT_TRANSLATE_NOOP("teshub-core", "Disable OS notifications for incoming transactions (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Disable safemode, override a real safe mode event (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Discover own IP address (default: 1 when listening and no -externalip)"),
QT_TRANSLATE_NOOP("teshub-core", "Display the stake modifier calculations in the debug.log file."),
QT_TRANSLATE_NOOP("teshub-core", "Display verbose coin stake messages in the debug.log file."),
QT_TRANSLATE_NOOP("teshub-core", "Do not load the wallet and disable wallet RPC calls"),
QT_TRANSLATE_NOOP("teshub-core", "Do you want to rebuild the block database now?"),
QT_TRANSLATE_NOOP("teshub-core", "Done loading"),
QT_TRANSLATE_NOOP("teshub-core", "Enable publish hash block in <address>"),
QT_TRANSLATE_NOOP("teshub-core", "Enable publish hash transaction (locked via SwiftTX) in <address>"),
QT_TRANSLATE_NOOP("teshub-core", "Enable publish hash transaction in <address>"),
QT_TRANSLATE_NOOP("teshub-core", "Enable publish raw block in <address>"),
QT_TRANSLATE_NOOP("teshub-core", "Enable publish raw transaction (locked via SwiftTX) in <address>"),
QT_TRANSLATE_NOOP("teshub-core", "Enable publish raw transaction in <address>"),
QT_TRANSLATE_NOOP("teshub-core", "Enable staking functionality (0-1, default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Enable the client to act as a masternode (0-1, default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Entries are full."),
QT_TRANSLATE_NOOP("teshub-core", "Error connecting to Masternode."),
QT_TRANSLATE_NOOP("teshub-core", "Error initializing block database"),
QT_TRANSLATE_NOOP("teshub-core", "Error initializing wallet database environment %s!"),
QT_TRANSLATE_NOOP("teshub-core", "Error loading block database"),
QT_TRANSLATE_NOOP("teshub-core", "Error loading wallet.dat"),
QT_TRANSLATE_NOOP("teshub-core", "Error loading wallet.dat: Wallet corrupted"),
QT_TRANSLATE_NOOP("teshub-core", "Error loading wallet.dat: Wallet requires newer version of TesHub Core"),
QT_TRANSLATE_NOOP("teshub-core", "Error opening block database"),
QT_TRANSLATE_NOOP("teshub-core", "Error reading from database, shutting down."),
QT_TRANSLATE_NOOP("teshub-core", "Error recovering public key."),
QT_TRANSLATE_NOOP("teshub-core", "Error"),
QT_TRANSLATE_NOOP("teshub-core", "Error: A fatal internal error occured, see debug.log for details"),
QT_TRANSLATE_NOOP("teshub-core", "Error: Disk space is low!"),
QT_TRANSLATE_NOOP("teshub-core", "Error: Unsupported argument -tor found, use -onion."),
QT_TRANSLATE_NOOP("teshub-core", "Error: Wallet locked, unable to create transaction!"),
QT_TRANSLATE_NOOP("teshub-core", "Failed to listen on any port. Use -listen=0 if you want this."),
QT_TRANSLATE_NOOP("teshub-core", "Failed to read block index"),
QT_TRANSLATE_NOOP("teshub-core", "Failed to read block"),
QT_TRANSLATE_NOOP("teshub-core", "Failed to write block index"),
QT_TRANSLATE_NOOP("teshub-core", "Fee (in TESB/kB) to add to transactions you send (default: %s)"),
QT_TRANSLATE_NOOP("teshub-core", "Finalizing transaction."),
QT_TRANSLATE_NOOP("teshub-core", "Force safe mode (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Found enough users, signing ( waiting %s )"),
QT_TRANSLATE_NOOP("teshub-core", "Found enough users, signing ..."),
QT_TRANSLATE_NOOP("teshub-core", "Generate coins (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "How many blocks to check at startup (default: %u, 0 = all)"),
QT_TRANSLATE_NOOP("teshub-core", "If <category> is not supplied, output all debugging information."),
QT_TRANSLATE_NOOP("teshub-core", "Importing..."),
QT_TRANSLATE_NOOP("teshub-core", "Imports blocks from external blk000??.dat file"),
QT_TRANSLATE_NOOP("teshub-core", "Include IP addresses in debug output (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Incompatible mode."),
QT_TRANSLATE_NOOP("teshub-core", "Incompatible version."),
QT_TRANSLATE_NOOP("teshub-core", "Incorrect or no genesis block found. Wrong datadir for network?"),
QT_TRANSLATE_NOOP("teshub-core", "Information"),
QT_TRANSLATE_NOOP("teshub-core", "Initialization sanity check failed. TesHub Core is shutting down."),
QT_TRANSLATE_NOOP("teshub-core", "Input is not valid."),
QT_TRANSLATE_NOOP("teshub-core", "Insufficient funds"),
QT_TRANSLATE_NOOP("teshub-core", "Insufficient funds."),
QT_TRANSLATE_NOOP("teshub-core", "Invalid -onion address or hostname: '%s'"),
QT_TRANSLATE_NOOP("teshub-core", "Invalid -proxy address or hostname: '%s'"),
QT_TRANSLATE_NOOP("teshub-core", "Invalid amount for -maxtxfee=<amount>: '%s'"),
QT_TRANSLATE_NOOP("teshub-core", "Invalid amount for -minrelaytxfee=<amount>: '%s'"),
QT_TRANSLATE_NOOP("teshub-core", "Invalid amount for -mintxfee=<amount>: '%s'"),
QT_TRANSLATE_NOOP("teshub-core", "Invalid amount for -paytxfee=<amount>: '%s' (must be at least %s)"),
QT_TRANSLATE_NOOP("teshub-core", "Invalid amount for -paytxfee=<amount>: '%s'"),
QT_TRANSLATE_NOOP("teshub-core", "Invalid amount for -reservebalance=<amount>"),
QT_TRANSLATE_NOOP("teshub-core", "Invalid amount"),
QT_TRANSLATE_NOOP("teshub-core", "Invalid masternodeprivkey. Please see documenation."),
QT_TRANSLATE_NOOP("teshub-core", "Invalid netmask specified in -whitelist: '%s'"),
QT_TRANSLATE_NOOP("teshub-core", "Invalid port detected in masternode.conf"),
QT_TRANSLATE_NOOP("teshub-core", "Invalid private key."),
QT_TRANSLATE_NOOP("teshub-core", "Invalid script detected."),
QT_TRANSLATE_NOOP("teshub-core", "Keep at most <n> unconnectable transactions in memory (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Limit size of signature cache to <n> entries (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Line: %d"),
QT_TRANSLATE_NOOP("teshub-core", "Listen for JSON-RPC connections on <port> (default: %u or testnet: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Listen for connections on <port> (default: %u or testnet: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Loading addresses..."),
QT_TRANSLATE_NOOP("teshub-core", "Loading block index..."),
QT_TRANSLATE_NOOP("teshub-core", "Loading budget cache..."),
QT_TRANSLATE_NOOP("teshub-core", "Loading masternode cache..."),
QT_TRANSLATE_NOOP("teshub-core", "Loading masternode payment cache..."),
QT_TRANSLATE_NOOP("teshub-core", "Loading sporks..."),
QT_TRANSLATE_NOOP("teshub-core", "Loading wallet... (%3.2f %%)"),
QT_TRANSLATE_NOOP("teshub-core", "Loading wallet..."),
QT_TRANSLATE_NOOP("teshub-core", "Lock is already in place."),
QT_TRANSLATE_NOOP("teshub-core", "Lock masternodes from masternode configuration file (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Maintain at most <n> connections to peers (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Masternode options:"),
QT_TRANSLATE_NOOP("teshub-core", "Masternode queue is full."),
QT_TRANSLATE_NOOP("teshub-core", "Masternode:"),
QT_TRANSLATE_NOOP("teshub-core", "Maximum per-connection receive buffer, <n>*1000 bytes (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Maximum per-connection send buffer, <n>*1000 bytes (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Missing input transaction information."),
QT_TRANSLATE_NOOP("teshub-core", "Need to specify a port with -whitebind: '%s'"),
QT_TRANSLATE_NOOP("teshub-core", "No Masternodes detected."),
QT_TRANSLATE_NOOP("teshub-core", "No compatible Masternode found."),
QT_TRANSLATE_NOOP("teshub-core", "Node relay options:"),
QT_TRANSLATE_NOOP("teshub-core", "Non-standard public key detected."),
QT_TRANSLATE_NOOP("teshub-core", "Not compatible with existing transactions."),
QT_TRANSLATE_NOOP("teshub-core", "Not enough file descriptors available."),
QT_TRANSLATE_NOOP("teshub-core", "Not in the Masternode list."),
QT_TRANSLATE_NOOP("teshub-core", "Number of automatic wallet backups (default: 10)"),
QT_TRANSLATE_NOOP("teshub-core", "Only accept block chain matching built-in checkpoints (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Only connect to nodes in network <net> (ipv4, ipv6 or onion)"),
QT_TRANSLATE_NOOP("teshub-core", "Options:"),
QT_TRANSLATE_NOOP("teshub-core", "Password for JSON-RPC connections"),
QT_TRANSLATE_NOOP("teshub-core", "Preparing for resync..."),
QT_TRANSLATE_NOOP("teshub-core", "Prepend debug output with timestamp (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Print version and exit"),
QT_TRANSLATE_NOOP("teshub-core", "RPC SSL options: (see the Bitcoin Wiki for SSL setup instructions)"),
QT_TRANSLATE_NOOP("teshub-core", "RPC server options:"),
QT_TRANSLATE_NOOP("teshub-core", "RPC support for HTTP persistent connections (default: %d)"),
QT_TRANSLATE_NOOP("teshub-core", "Randomly drop 1 of every <n> network messages"),
QT_TRANSLATE_NOOP("teshub-core", "Randomly fuzz 1 of every <n> network messages"),
QT_TRANSLATE_NOOP("teshub-core", "Rebuild block chain index from current blk000??.dat files"),
QT_TRANSLATE_NOOP("teshub-core", "Receive and display P2P network alerts (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Relay and mine data carrier transactions (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Relay non-P2SH multisig (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Rescan the block chain for missing wallet transactions"),
QT_TRANSLATE_NOOP("teshub-core", "Rescanning..."),
QT_TRANSLATE_NOOP("teshub-core", "Run a thread to flush wallet periodically (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Run in the background as a daemon and accept commands"),
QT_TRANSLATE_NOOP("teshub-core", "Send transactions as zero-fee transactions if possible (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Server certificate file (default: %s)"),
QT_TRANSLATE_NOOP("teshub-core", "Server private key (default: %s)"),
QT_TRANSLATE_NOOP("teshub-core", "Session not complete!"),
QT_TRANSLATE_NOOP("teshub-core", "Session timed out."),
QT_TRANSLATE_NOOP("teshub-core", "Set database cache size in megabytes (%d to %d, default: %d)"),
QT_TRANSLATE_NOOP("teshub-core", "Set external address:port to get to this masternode (example: %s)"),
QT_TRANSLATE_NOOP("teshub-core", "Set key pool size to <n> (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Set maximum block size in bytes (default: %d)"),
QT_TRANSLATE_NOOP("teshub-core", "Set minimum block size in bytes (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Set the Maximum reorg depth (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Set the masternode private key"),
QT_TRANSLATE_NOOP("teshub-core", "Set the number of threads to service RPC calls (default: %d)"),
QT_TRANSLATE_NOOP("teshub-core", "Sets the DB_PRIVATE flag in the wallet db environment (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Show all debugging options (usage: --help -help-debug)"),
QT_TRANSLATE_NOOP("teshub-core", "Shrink debug.log file on client startup (default: 1 when no -debug)"),
QT_TRANSLATE_NOOP("teshub-core", "Signing failed."),
QT_TRANSLATE_NOOP("teshub-core", "Signing timed out."),
QT_TRANSLATE_NOOP("teshub-core", "Signing transaction failed"),
QT_TRANSLATE_NOOP("teshub-core", "Specify configuration file (default: %s)"),
QT_TRANSLATE_NOOP("teshub-core", "Specify connection timeout in milliseconds (minimum: 1, default: %d)"),
QT_TRANSLATE_NOOP("teshub-core", "Specify data directory"),
QT_TRANSLATE_NOOP("teshub-core", "Specify masternode configuration file (default: %s)"),
QT_TRANSLATE_NOOP("teshub-core", "Specify pid file (default: %s)"),
QT_TRANSLATE_NOOP("teshub-core", "Specify wallet file (within data directory)"),
QT_TRANSLATE_NOOP("teshub-core", "Specify your own public address"),
QT_TRANSLATE_NOOP("teshub-core", "Spend unconfirmed change when sending transactions (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Staking options:"),
QT_TRANSLATE_NOOP("teshub-core", "Stop running after importing blocks from disk (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Submitted following entries to masternode: %u / %d"),
QT_TRANSLATE_NOOP("teshub-core", "Submitted to masternode, waiting for more entries ( %u / %d ) %s"),
QT_TRANSLATE_NOOP("teshub-core", "Submitted to masternode, waiting in queue %s"),
QT_TRANSLATE_NOOP("teshub-core", "SwiftTX options:"),
QT_TRANSLATE_NOOP("teshub-core", "Synchronization failed"),
QT_TRANSLATE_NOOP("teshub-core", "Synchronization finished"),
QT_TRANSLATE_NOOP("teshub-core", "Synchronization pending..."),
QT_TRANSLATE_NOOP("teshub-core", "Synchronizing budgets..."),
QT_TRANSLATE_NOOP("teshub-core", "Synchronizing masternode winners..."),
QT_TRANSLATE_NOOP("teshub-core", "Synchronizing masternodes..."),
QT_TRANSLATE_NOOP("teshub-core", "Synchronizing sporks..."),
QT_TRANSLATE_NOOP("teshub-core", "This help message"),
QT_TRANSLATE_NOOP("teshub-core", "This is experimental software."),
QT_TRANSLATE_NOOP("teshub-core", "This is intended for regression testing tools and app development."),
QT_TRANSLATE_NOOP("teshub-core", "This is not a Masternode."),
QT_TRANSLATE_NOOP("teshub-core", "Threshold for disconnecting misbehaving peers (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Tor control port password (default: empty)"),
QT_TRANSLATE_NOOP("teshub-core", "Tor control port to use if onion listening enabled (default: %s)"),
QT_TRANSLATE_NOOP("teshub-core", "Transaction amount too small"),
QT_TRANSLATE_NOOP("teshub-core", "Transaction amounts must be positive"),
QT_TRANSLATE_NOOP("teshub-core", "Transaction created successfully."),
QT_TRANSLATE_NOOP("teshub-core", "Transaction fees are too high."),
QT_TRANSLATE_NOOP("teshub-core", "Transaction not valid."),
QT_TRANSLATE_NOOP("teshub-core", "Transaction too large for fee policy"),
QT_TRANSLATE_NOOP("teshub-core", "Transaction too large"),
QT_TRANSLATE_NOOP("teshub-core", "Transmitting final transaction."),
QT_TRANSLATE_NOOP("teshub-core", "Unable to bind to %s on this computer (bind returned error %s)"),
QT_TRANSLATE_NOOP("teshub-core", "Unable to sign spork message, wrong key?"),
QT_TRANSLATE_NOOP("teshub-core", "Unknown network specified in -onlynet: '%s'"),
QT_TRANSLATE_NOOP("teshub-core", "Unknown state: id = %u"),
QT_TRANSLATE_NOOP("teshub-core", "Upgrade wallet to latest format"),
QT_TRANSLATE_NOOP("teshub-core", "Use OpenSSL (https) for JSON-RPC connections"),
QT_TRANSLATE_NOOP("teshub-core", "Use UPnP to map the listening port (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Use UPnP to map the listening port (default: 1 when listening)"),
QT_TRANSLATE_NOOP("teshub-core", "Use a custom max chain reorganization depth (default: %u)"),
QT_TRANSLATE_NOOP("teshub-core", "Use the test network"),
QT_TRANSLATE_NOOP("teshub-core", "Username for JSON-RPC connections"),
QT_TRANSLATE_NOOP("teshub-core", "Verifying blocks..."),
QT_TRANSLATE_NOOP("teshub-core", "Verifying wallet..."),
QT_TRANSLATE_NOOP("teshub-core", "Wallet %s resides outside data directory %s"),
QT_TRANSLATE_NOOP("teshub-core", "Wallet is locked."),
QT_TRANSLATE_NOOP("teshub-core", "Wallet needed to be rewritten: restart TesHub Core to complete"),
QT_TRANSLATE_NOOP("teshub-core", "Wallet options:"),
QT_TRANSLATE_NOOP("teshub-core", "Wallet window title"),
QT_TRANSLATE_NOOP("teshub-core", "Warning"),
QT_TRANSLATE_NOOP("teshub-core", "Warning: This version is obsolete, upgrade required!"),
QT_TRANSLATE_NOOP("teshub-core", "Warning: Unsupported argument -benchmark ignored, use -debug=bench."),
QT_TRANSLATE_NOOP("teshub-core", "Warning: Unsupported argument -debugnet ignored, use -debug=net."),
QT_TRANSLATE_NOOP("teshub-core", "Will retry..."),
QT_TRANSLATE_NOOP("teshub-core", "You need to rebuild the database using -reindex to change -txindex"),
QT_TRANSLATE_NOOP("teshub-core", "Your entries added successfully."),
QT_TRANSLATE_NOOP("teshub-core", "Your transaction was accepted into the pool!"),
QT_TRANSLATE_NOOP("teshub-core", "Zapping all transactions from wallet..."),
QT_TRANSLATE_NOOP("teshub-core", "ZeroMQ notification options:"),
QT_TRANSLATE_NOOP("teshub-core", "on startup"),
QT_TRANSLATE_NOOP("teshub-core", "wallet.dat corrupt, salvage failed"),
};
| [
"OhCreativeYT@gmail.com"
] | OhCreativeYT@gmail.com |
1e9b66f6ae84747992707636dd18dfd113f25a0a | f433402f2a3c5846d25c59c3358174e4a7ead5a3 | /automatic_sensor/src/position_search.h | c9efd94e348f151fc87cb975c13409530ee17d31 | [] | no_license | fire0ice1leaf1484/mbedST | 8167f45d5ea0feb1be30778073eadcac503ac260 | b99354d328d98af41512e3249e66c465543f5f0d | refs/heads/master | 2020-11-28T09:20:17.265457 | 2020-08-30T10:53:31 | 2020-08-30T10:53:31 | 229,756,787 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,071 | h | #ifndef POSITION___H
#define POSITION___H
#include "mbed.h"
#include "MPU6050.h"
#include "MadgwickAHRS.h"
#include "CRotaryEncoder.h"
#include "pinOutYamaShoEdition.h"
#include "functionYamaShoEdition.h"
class Point{
public:
Point(float _x, float _y, float _r, int _p);
float distanceV(float robotX, float robotY, float robotR);
float distance(float robotX, float robotY);
float x, y, r;
int p;
};
extern float aG[3]; //傾き
extern float bG[3];
extern float angle[3];
extern float gx,gy,gz;
extern float theta;
extern Thread positionThread; //座標を推定したり追従したりするスレ
extern CRotaryEncoder encY;
extern CRotaryEncoder encX;
extern double cosR;
extern double sinR;
extern double dx, dy; //ロボットのXY軸でdt間でどれだけすすんだか
extern double realX, realY, realR; //推定される座標
extern float yaw, yaw_radian; //Yaw角
extern float dt; //時間差
void position(void); //座標を推定したり追従したりするスレ
#endif | [
"agohigethirteen@gmail.com"
] | agohigethirteen@gmail.com |
6a0cbd4a6f7a9a05fd90ca76e6b6e7f853b2d12f | ea8ca702551a1dfd09039a56ccb04692508829f6 | /src/shadowcoind.cpp | 651c809ce2db4722ba8bcf90fdd028bce4820b4a | [
"MIT"
] | permissive | freecreators/freecreateors | 04c589ec24272feb372c37c5da6cfb28db60db66 | ef29609c99d4dddba761c964374cfa0e21939f23 | refs/heads/master | 2021-01-22T11:28:19.012441 | 2017-05-29T02:19:07 | 2017-05-29T02:19:07 | 92,698,667 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,537 | cpp | // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "rpcserver.h"
#include "rpcclient.h"
#include "init.h"
#include <boost/algorithm/string/predicate.hpp>
#include "protocol.h"
void ThreadCli()
{
// - Simple persistent cli
// TODO:
// unbuffered terminal input on linux
// format help text
char buffer[4096];
size_t n;
fd_set rfds;
struct timeval tv;
printf("Shadow CLI ready:\n> ");
fflush(stdout);
for (;;)
{
boost::this_thread::interruption_point();
// - must be set every iteration
FD_ZERO(&rfds);
FD_SET(STDIN_FILENO, &rfds);
tv.tv_sec = 0;
tv.tv_usec = 200000;
if (select(1, &rfds, NULL, NULL, &tv) < 1) // read blocks thread from interrupt
continue;
if ((n = read(STDIN_FILENO, buffer, sizeof(buffer))) < 1)
continue;
buffer[n] = '\0';
for ( ; n > 0 && (buffer[n-1] == '\n' || buffer[n-1] == '\r'); --n)
buffer[n-1] = '\0';
if (strcmp(buffer, "stop") == 0
|| strcmp(buffer, "exit") == 0
|| strcmp(buffer, "quit") == 0
|| strcmp(buffer, "q") == 0)
{
puts("Exiting...");
break;
};
std::string strMethod;
std::vector<std::string> strParams;
char *p;
if ((p = strchr(buffer, ' ')))
{
strMethod = std::string(buffer, p);
char *pPS = p+1;
char *pPE = p+1;
while (*pPS
&& ((pPE = strchr(pPS, ' '))
|| (pPE = strchr(pPS, '\0'))))
{
strParams.push_back(std::string(pPS, pPE));
pPS = pPE+1;
};
} else
{
strMethod = std::string(buffer);
};
std::string strReply;
JSONRequest jreq;
try
{
json_spirit::Array params = RPCConvertValues(strMethod, strParams);
json_spirit::Value result = tableRPC.execute(strMethod, params);
strReply = json_spirit::write_string(result, true);
ReplaceStrInPlace(strReply, "\\n", "\n"); // format help msg
if (write(STDOUT_FILENO, strReply.data(), strReply.length()) != (uint32_t) strReply.length())
throw std::runtime_error("write failed.");
printf("\n> ");
fflush(stdout);
} catch (json_spirit::Object& objError)
{
std::string strReply = JSONRPCReply(json_spirit::Value::null, objError, 0);
printf("Error: %s\n> ", strReply.c_str());
fflush(stdout);
} catch (std::exception& e)
{
printf("Error: %s\n> ", e.what());
fflush(stdout);
};
fflush(stdout);
};
StartShutdown();
};
void WaitForShutdown(boost::thread_group* threadGroup)
{
bool fShutdown = ShutdownRequested();
if (!fDaemon && GetBoolArg("-cli", false))
{
threadGroup->create_thread(boost::bind(&TraceThread<void (*)()>, "cli", &ThreadCli));
};
// Tell the main threads to shutdown.
while (!fShutdown)
{
MilliSleep(200);
fShutdown = ShutdownRequested();
};
LogPrintf("ShadowCoin shutdown.\n\n");
if (threadGroup)
{
threadGroup->interrupt_all();
threadGroup->join_all();
};
}
//////////////////////////////////////////////////////////////////////////////
//
// Start
//
bool AppInit(int argc, char* argv[])
{
boost::thread_group threadGroup;
bool fRet = false;
try
{
//
// Parameters
//
// If Qt is used, parameters/bitcoin.conf are parsed in qt/bitcoin.cpp's main()
ParseParameters(argc, argv);
if (!boost::filesystem::is_directory(GetDataDir(false)))
{
fprintf(stderr, "Error: Specified directory does not exist\n");
Shutdown();
};
ReadConfigFile(mapArgs, mapMultiArgs);
if (mapArgs.count("-?") || mapArgs.count("--help"))
{
// First part of help message is specific to bitcoind / RPC client
std::string strUsage = _("ShadowCoin version") + " " + FormatFullVersion() + "\n\n" +
_("Usage:") + "\n" +
" shadowcoind [options] " + "\n" +
" shadowcoind [options] <command> [params] " + _("Send command to -server or shadowcoind") + "\n" +
" shadowcoind [options] help " + _("List commands") + "\n" +
" shadowcoind [options] help <command> " + _("Get help for a command") + "\n";
strUsage += "\n" + HelpMessage();
fprintf(stdout, "%s", strUsage.c_str());
return false;
};
// Command-line RPC
for (int i = 1; i < argc; i++)
if (!IsSwitchChar(argv[i][0]) && !boost::algorithm::istarts_with(argv[i], "shadowcoin:"))
fCommandLine = true;
if (fCommandLine)
{
if (!SelectParamsFromCommandLine())
{
fprintf(stderr, "Error: invalid combination of -regtest and -testnet.\n");
return false;
};
int ret = CommandLineRPC(argc, argv);
exit(ret);
};
#if !defined(WIN32)
fDaemon = GetBoolArg("-daemon", false);
if (fDaemon)
{
// Daemonize
pid_t pid = fork();
if (pid < 0)
{
fprintf(stderr, "Error: fork() returned %d errno %d\n", pid, errno);
return false;
};
if (pid > 0) // Parent process, pid is child process id
{
CreatePidFile(GetPidFile(), pid);
return true;
};
// Child process falls through to rest of initialization
pid_t sid = setsid();
if (sid < 0)
fprintf(stderr, "Error: setsid() returned %d errno %d\n", sid, errno);
};
#endif
if (GetBoolArg("-cli", false))
printf("Starting...\n");
fRet = AppInit2(threadGroup);
} catch (std::exception& e)
{
PrintException(&e, "AppInit()");
} catch (...)
{
PrintException(NULL, "AppInit()");
};
if (!fRet)
{
threadGroup.interrupt_all();
// threadGroup.join_all(); was left out intentionally here, because we didn't re-test all of
// the startup-failure cases to make sure they don't result in a hang due to some
// thread-blocking-waiting-for-another-thread-during-startup case
} else
{
WaitForShutdown(&threadGroup);
};
Shutdown();
return fRet;
}
extern void noui_connect();
int main(int argc, char* argv[])
{
bool fRet = false;
fHaveGUI = false;
// Connect shadowcoind signal handlers
noui_connect();
fRet = AppInit(argc, argv);
if (fRet && fDaemon)
return 0;
return (fRet ? 0 : 1);
};
| [
"lenovo@LAPTOP-D9O5PPS6"
] | lenovo@LAPTOP-D9O5PPS6 |
b0be7dc6ec42364728cff3b0d0b16b60287366f8 | eafc5ac599f2e96c3ca61612abb109eba2abe655 | /customSolvers/edcSimpleFoam/lib/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.H | cad873ab725423ad055a576793f9c4149a356dc6 | [] | no_license | kohyun/OpenFOAM_MSc_Thesis_Project | b651eb129611d41dbb4d3b08a2dec0d4db7663b3 | 11f6b69c23082b3b47b04963c5fc87b8ab4dd08d | refs/heads/master | 2023-03-17T22:34:57.127580 | 2019-01-12T07:41:07 | 2019-01-12T07:41:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,337 | h | /*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::greyDiffusiveRadiationMixedFvPatchScalarField
Description
Radiation temperature specified
SourceFiles
greyDiffusiveRadiationMixedFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef greyDiffusiveRadiationMixedFvPatchScalarField_H
#define greyDiffusiveRadiationMixedFvPatchScalarField_H
#include "mixedFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace radiation
{
/*---------------------------------------------------------------------------*\
Class greyDiffusiveRadiationMixedFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class greyDiffusiveRadiationMixedFvPatchScalarField
:
public mixedFvPatchScalarField
{
// Private data
//- Name of temperature field
word TName_;
//- Emissivity
scalar emissivity_;
public:
//- Runtime type information
TypeName("greyDiffusiveRadiation");
// Constructors
//- Construct from patch and internal field
greyDiffusiveRadiationMixedFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
greyDiffusiveRadiationMixedFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given a
// greyDiffusiveRadiationMixedFvPatchScalarField onto a new patch
greyDiffusiveRadiationMixedFvPatchScalarField
(
const greyDiffusiveRadiationMixedFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
greyDiffusiveRadiationMixedFvPatchScalarField
(
const greyDiffusiveRadiationMixedFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new greyDiffusiveRadiationMixedFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
greyDiffusiveRadiationMixedFvPatchScalarField
(
const greyDiffusiveRadiationMixedFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new greyDiffusiveRadiationMixedFvPatchScalarField(*this, iF)
);
}
// Member functions
// Access
//- Return the temperature field name
const word& TName() const
{
return TName_;
}
//- Return reference to the temperature field name to allow
// adjustment
word& TName()
{
return TName_;
}
//- Return the emissivity
const scalar& emissivity() const
{
return emissivity_;
}
//- Return reference to the emissivity to allow adjustment
scalar& emissivity()
{
return emissivity_;
}
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
// I-O
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
| [
"ali@ali-Inspiron-1525.(none)"
] | ali@ali-Inspiron-1525.(none) |
77a7283969dcf92757a2a9b9be70bc0c37d06e4f | 3e0564518184224152071b318fd280e0c6c30b62 | /matGroup/matGroupRealised.h | cdaa75ee4ef01d1ec8d8aaef47d7b81482be625c | [] | no_license | yfszzx/MatX | 5f70c112a8a0720572cfd134ad81439b3a53ab29 | 81a9d1b0744569d437eb860c370b66707747b1b4 | refs/heads/master | 2020-04-06T06:57:02.566352 | 2016-06-20T13:20:55 | 2016-06-20T13:20:55 | 50,677,779 | 3 | 1 | null | null | null | null | GB18030 | C++ | false | false | 8,961 | h | template <typename TYPE, bool CUDA >
int MatGroup<TYPE, CUDA>::size() const{
int ret = 0;
for(int i = 0; i< matsNum; i++){
ret += mats[i]->size();
}
return ret;
}
template <typename TYPE, bool CUDA >
MatGroup<TYPE, CUDA>::MatGroup(){
matsNum = 0;
mats = NULL;
selfSpace = false;
fixMat = false;
}
template <typename TYPE, bool CUDA >
MatGroup<TYPE, CUDA>::~MatGroup(){
memFree();
}
template <typename TYPE, bool CUDA >
void MatGroup<TYPE, CUDA>::memFree(){
if(mats != NULL){
if(selfSpace){
for(int i = 0; i< matsNum; i++){
delete mats[i];
}
}
delete [] mats;
}
}
template <typename TYPE, bool CUDA >
void MatGroup<TYPE, CUDA>::copy(const MatGroup<TYPE, CUDA> & m){
matsNum = m.matsNum;
mats = new MatriX<TYPE, CUDA> *[matsNum];
for(int i = 0; i< matsNum; i++){
mats[i] = new MatriX<TYPE, CUDA>(*m.mats[i]);
}
}
template <typename TYPE, bool CUDA >
MatGroup<TYPE, CUDA>::MatGroup<TYPE, CUDA>(const MatGroup<TYPE, !CUDA> & m){
selfSpace = true;
matsNum = m.matsNum;
fixMat = false;
mats = new MatriX<TYPE, CUDA> *[matsNum];
for(int i = 0; i< matsNum; i++){
mats[i] = new MatriX<TYPE, CUDA>(*m.mats[i]);
}
}
template <typename TYPE, bool CUDA >
MatGroup<TYPE, CUDA>::MatGroup<TYPE, CUDA>(const MatGroup<TYPE, CUDA> & m){
fixMat = false;
selfSpace = true;
copy(m);
}
template <typename TYPE, bool CUDA >
MatGroup<TYPE, CUDA>::MatGroup<TYPE, CUDA>(MatriX<TYPE, CUDA> * m, int num){
matsNum = num;
fixMat = false;
selfSpace = false;
mats = new MatriX<TYPE, CUDA> *[matsNum];
for(int i = 0; i< matsNum; i++){
mats[i] = m + i;
}
};
template <typename TYPE, bool CUDA >
MatGroup<TYPE, CUDA>::MatGroup<TYPE, CUDA>(MatriX<TYPE, !CUDA> * m, int num){
matsNum = mum;
fixMat = false;
selfSpace = true;
mats = new MatriX<TYPE, CUDA> *[matsNum];
for(int i = 0; i< matsNum; i++){
mats[i] = new MatriX<TYPE, CUDA>(m[i]);
}
};
template <typename TYPE, bool CUDA >
MatGroup<TYPE, CUDA> & MatGroup<TYPE, CUDA>::operator <<(MatriX<TYPE, CUDA> & mat){
if(fixMat){
Assert("无法在固定矩阵组中加入新矩阵");
}
MatriX<TYPE, CUDA> ** temp = new MatriX<TYPE, CUDA> *[matsNum + 1];
if(matsNum > 0){
memcpy(temp, mats, sizeof(MatriX<TYPE, CUDA> *) * matsNum);
}
temp[matsNum] = &mat;
matsNum ++;
if(mats != NULL){
delete [] mats;
}
mats = temp;
return *this;
}
template <typename TYPE, bool CUDA >
MatGroup<TYPE, CUDA> & MatGroup<TYPE, CUDA>::operator += (const MatGroup<TYPE, CUDA> & m){
if(fixMat && m.fixMat){
fixMemMat += m.fixMemMat;
}else{
for(int i = 0; i< matsNum; i++){
*mats[i] += *m.mats[i];
}
}
return *this;
}
template <typename TYPE, bool CUDA >
MatGroup<TYPE, CUDA> & MatGroup<TYPE, CUDA>::operator -= (const MatGroup<TYPE, CUDA> & m){
if(fixMat && m.fixMat){
fixMemMat -= m.fixMemMat;
}else{
for(int i = 0; i< matsNum; i++){
*mats[i] -= *m.mats[i];
}
}
return *this;
}
template <typename TYPE, bool CUDA >
MatGroup<TYPE, CUDA> MatGroup<TYPE, CUDA>::operator + (const MatGroup<TYPE, CUDA> & m) const{
MatGroup<TYPE, CUDA> ret(*this);
if(fixMat && m.fixMat){
ret.fixMemMat += m.fixMemMat;
}else{
for(int i = 0; i< matsNum; i++){
*ret.mats[i] += *m.mats[i];
}
}
return ret;
}
template <typename TYPE, bool CUDA >
MatGroup<TYPE, CUDA> MatGroup<TYPE, CUDA>::operator - (const MatGroup<TYPE, CUDA> & m) const{
MatGroup<TYPE, CUDA> ret(*this);
if(fixMat && m.fixMat){
ret.fixMemMat -= m.fixMemMat;
}else{
for(int i = 0; i< matsNum; i++){
*ret.mats[i] -= *m.mats[i];
}
}
return ret;
}
template <typename TYPE, bool CUDA >
MatGroup<TYPE, CUDA> & MatGroup<TYPE, CUDA>::operator = (const MatGroup<TYPE, CUDA> & m){
if(matsNum == 0){
selfSpace = true;
copy(m);
return *this;
}
if(fixMat && m.fixMat ){
if(fixMemMat.size() != m.fixMemMat.size() || matsNum != m.matsNum){
Assert("\n【错误】MatGroup大小不一致,无法赋值");
}else{
cuWrap::memD2D(fixMemMat.dataPrt(), m.fixMemMat.dataPrt(), sizeof(TYPE) * fixMemMat.size());
}
}else{
if(matsNum != m.matsNum){
Assert("\n【错误】MatGroup元素个数不一致,无法赋值");
}
for(int i = 0; i< matsNum; i++){
*mats[i] = m[i];
}
}
return *this;
}
template <typename TYPE, bool CUDA >
MatGroup<TYPE, CUDA> & MatGroup<TYPE, CUDA>::operator /= ( TYPE scl){
if(fixMat){
cuWrap::scale(fixMemMat.dataPrt(),(TYPE)1.0f/scl, fixMemMat.size());
}else{
for(int i = 0; i< matsNum; i++){
*mats[i] /= scl;
}
}
return *this;
}
template <typename TYPE, bool CUDA >
MatGroup<TYPE, CUDA> & MatGroup<TYPE, CUDA>::operator *= ( TYPE scl){
if(fixMat){
cuWrap::scale(fixMemMat.dataPrt(), scl, fixMemMat.size());
}else{
for(int i = 0; i< matsNum; i++){
*mats[i] *= scl;
}
}
return *this;
}
template <typename TYPE, bool CUDA >
MatGroup<TYPE, CUDA> & MatGroup<TYPE, CUDA>::operator = ( TYPE val){
if(fixMat){
cuWrap::fill(fixMemMat.dataPrt(), val, fixMemMat.size());
}else{
for(int i = 0; i< matsNum; i++){
*mats[i] = val;
}
}
return *this;
}
template <typename TYPE, bool CUDA >
MatGroup<TYPE, CUDA> MatGroup<TYPE, CUDA>::operator * ( TYPE scl) const{
MatGroup<TYPE, CUDA> ret(*this);
ret *= scl;
return ret;
}
template <typename TYPE, bool CUDA >
MatGroup<TYPE, CUDA> MatGroup<TYPE, CUDA>::operator / ( TYPE scl) const{
MatGroup<TYPE, CUDA> ret(*this);
ret /= scl;
return ret;
}
template <typename TYPE, bool CUDA >
MatriX<TYPE, CUDA> & MatGroup<TYPE, CUDA>::operator [] (int i) const{
return *mats[i];
}
template <typename TYPE, bool CUDA >
TYPE MatGroup<TYPE, CUDA>::squaredNorm() const{
double ret = 0;
if(fixMat){
ret = fixMemMat.squaredNorm();
}else{
for(int i = 0; i< matsNum; i++){
ret += mats[i]->squaredNorm();
}
}
return ret;
}
template <typename TYPE, bool CUDA >
TYPE MatGroup<TYPE, CUDA>::norm() const{
return sqrt(squaredNorm());
}
template <typename TYPE, bool CUDA >
TYPE MatGroup<TYPE, CUDA>::dot(const MatGroup<TYPE, CUDA> & m) const{
double ret=0;
if(fixMat && m.fixMat){
ret = fixMemMat.dot(m.fixMemMat);
}else{
for(int i = 0; i< matsNum; i++){
ret += mats[i]->dot(m[i]);
}
}
return ret;
}
template <typename TYPE, bool CUDA >
TYPE MatGroup<TYPE, CUDA>::sum() const{
double ret=0;
if(fixMat){
ret = fixMemMat.allSum();
}else{
for(int i = 0; i< matsNum; i++){
ret += mats[i]->allSum();
}
}
return ret;
}
template <typename TYPE, bool CUDA >
TYPE MatGroup<TYPE, CUDA>::correl(const MatGroup<TYPE, CUDA> & m) const{
double ysum = 0;
double tsum = 0;
double _dot = 0;
double ysn = 0;
double tsn = 0;
int n = 0;
for(int i = 0 ; i < matsNum; i++){
ysum += mats[i]->allSum();
tsum += m.mats[i]->allSum();
_dot += mats[i]->dot(*m.mats[i]);
ysn += mats[i]->squaredNorm();
tsn += m.mats[i]->squaredNorm();
n += mats[i]->size();
}
return (n * _dot - ysum * tsum)/sqrt(( n * ysn - ysum * ysum) *( n * tsn - tsum * tsum));
}
template <typename TYPE, bool CUDA >
TYPE MatGroup<TYPE, CUDA>::MSE() const{
double avg = 0;
int n = 0;
for(int i = 0 ; i < matsNum; i++){
avg += mats[i]->allSum();
n += mats[i]->size();
}
avg /= n;
double mse = 0;
for(int i = 0 ; i < matsNum; i++){
mse += (*mats[i] - (TYPE)avg).squaredNorm();
}
return mse/n;
}
template <typename TYPE, bool CUDA >
void MatGroup<TYPE, CUDA>::show() const{
cout<<"\nnum:"<<matsNum<<"\n";
for(int i = 0; i< matsNum; i++){
cout<<"["<<i<<"]"<<mats[i]->str();
}
}
template <typename TYPE,bool CUDA >
MatGroup<TYPE, CUDA> operator * (const TYPE scl, const MatGroup<TYPE, CUDA> & m){
MatGroup<TYPE, CUDA> ret(m);
ret *= scl;
return ret;
}
template <typename TYPE,bool CUDA >
MatGroup<TYPE, CUDA> operator - (const MatGroup<TYPE, CUDA> & m){
MatGroup<TYPE, CUDA> ret(m);
ret *= -1;
return ret;
}
template <typename TYPE, bool CUDA >
void MatGroup<TYPE, CUDA>::save(ofstream & fl) const{
fl.write((char *)&matsNum, sizeof(int));
fl.write((char *)&fixMat, sizeof(bool));
for(int i = 0; i< matsNum; i++){
mats[i]->save(fl);
}
}
template <typename TYPE, bool CUDA >
void MatGroup<TYPE, CUDA>::read(ifstream & fl){
fl.read((char *)&matsNum, sizeof(int));
bool tmp;
fl.read((char *)&tmp, sizeof(bool));
for(int i = 0; i< matsNum; i++){
mats[i]->read(fl);
}
if(tmp){
setFix();
}
}
template <typename TYPE, bool CUDA >
void MatGroup<TYPE, CUDA>::setFix(){
if(CUDA && !fixMat){
fixMemMat = MatriX<TYPE, CUDA>::Zero(size(),1);
int pos = 0;
for(int i = 0; i< matsNum; i++){
pos += mats[i]->size();
}
fixMat = true;
}
}
template <typename TYPE, bool CUDA >
void MatGroup<TYPE, CUDA>::fixFree(){
if(fixMat){
for(int i = 0; i< matsNum; i++){
}
fixMemMat = MatriX<TYPE, CUDA>::Zero(0,0);
fixMat = false;
}
}
template <typename TYPE, bool CUDA >
MatGroup<TYPE, CUDA> & MatGroup<TYPE, CUDA>::clear(){
memFree();
matsNum = 0;
mats = NULL;
selfSpace = false;
fixMat = false;
return *this;
}
template <typename TYPE, bool CUDA >
int MatGroup<TYPE, CUDA>::num() const{
return matsNum;
} | [
"yfszzx@gmail.com"
] | yfszzx@gmail.com |
d65c94c8e06457fb5087de5c8694292feae3a1e3 | 0c3be775906632abcc91ab4e0b48678413997a9f | /src/extract_sequences.cpp | 9bf8a1afe81cb8db7b434e42e8d6b74d77a73e7d | [
"MIT"
] | permissive | induraj2020/clickstream-hmm | 45fc9d9999b418135e2f0be124474a9f8dbe00e3 | 2565183a7aa95984dba0a5759ea40ad81fc4a419 | refs/heads/master | 2023-03-16T06:54:23.335972 | 2018-06-02T20:30:20 | 2018-06-02T20:30:20 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,379 | cpp | /**
* @file extract_sequences.cpp
* Extracts each browsing session for each user given a Coursera
* clickstream dump.
*/
#include <iostream>
#include <regex>
#include <string>
#include "json.hpp"
#include "meta/hashing/probe_map.h"
#include "meta/io/filesystem.h"
#include "meta/io/packed.h"
#include "meta/logging/logger.h"
#include "meta/parallel/algorithm.h"
#include "meta/util/identifiers.h"
#include "meta/util/multiway_merge.h"
#include "meta/util/optional.h"
#include "meta/util/progress.h"
using namespace nlohmann;
using namespace meta;
MAKE_NUMERIC_IDENTIFIER_UDL(action_id, uint64_t, _aid)
namespace meta
{
namespace util
{
template <class Tag, class T>
void to_json(json& j, const identifier<Tag, T>& i)
{
j = static_cast<T>(i);
}
template <class Tag, class T>
void from_json(const json& j, identifier<Tag, T>& i)
{
i = j.get<T>();
}
} // namespace sequence
} // namespace meta
using action_sequence = std::vector<action_id>;
struct student_record
{
std::string username;
std::vector<action_sequence> sequences;
};
struct memory_student_record
{
uint64_t last_action_time = 0;
std::vector<action_sequence> sequences;
};
util::optional<action_id> get_action(const std::string& str)
{
static std::regex regexes[] = {
std::regex{R"(\/forum\/list$)", std::regex_constants::ECMAScript},
std::regex{R"(\/forum\/list\?forum_id=)",
std::regex_constants::ECMAScript},
std::regex{R"(\/forum\/thread\?thread_id=)",
std::regex_constants::ECMAScript},
std::regex{R"(\/forum\/search\?q=)", std::regex_constants::ECMAScript},
std::regex{R"(\/forum\/posted_thread)",
std::regex_constants::ECMAScript},
std::regex{R"(\/forum\/posted_reply)",
std::regex_constants::ECMAScript},
// either: downloading the video or viewing it in the streaming player
std::regex{R"(\/lecture(\/download|\?lecture_id=|\/view\?lecture_id=))",
std::regex_constants::ECMAScript},
std::regex{R"(\/quiz\/start\?quiz_id=)",
std::regex_constants::ECMAScript},
std::regex{R"(\/quiz\/submit)", std::regex_constants::ECMAScript},
std::regex{R"(\/wiki)", std::regex_constants::ECMAScript}};
action_id aid{0};
for (const auto& regex : regexes)
{
if (std::regex_search(str, regex))
return {aid};
++aid;
}
return util::nullopt;
}
using student_record_map
= hashing::probe_map<std::string, memory_student_record>;
void insert_new_action(student_record_map& store, const std::string& username,
action_id aid, uint64_t timestamp)
{
auto it = store.find(username);
if (it == store.end())
it = store.insert(username, memory_student_record{});
// if the last action was more than 10 hours ago, this is the start
// of a new sequence
if (timestamp > it->value().last_action_time + 10 * 60 * 60 * 1000)
{
it->value().sequences.emplace_back(1, aid);
}
// otherwise, this is just another action of the current sequence
else
{
it->value().sequences.back().push_back(aid);
}
it->value().last_action_time = timestamp;
}
int main()
{
logging::set_cerr_logging();
student_record_map store;
std::string line;
while (std::getline(std::cin, line))
{
auto obj = json::parse(line);
if (obj["key"].get<std::string>() != util::string_view{"pageview"})
continue;
auto username = obj["username"].get<std::string>();
auto timestamp = obj["timestamp"].get<uint64_t>();
// new dumps appear to set some cleaned url in "value"; use that if
// we can
if (auto action = get_action(obj["value"].get<std::string>()))
{
insert_new_action(store, username, *action, timestamp);
}
// otherwise use the value in page_url, which always exists
else if (auto action = get_action(obj["page_url"].get<std::string>()))
{
insert_new_action(store, username, *action, timestamp);
}
}
for (const auto& pr : store)
{
auto obj = json::object();
obj["username"] = pr.key();
obj["sequences"] = pr.value().sequences;
std::cout << obj << '\n';
}
return 0;
}
| [
"geigle1@illinois.edu"
] | geigle1@illinois.edu |
7a4c5941d9fc471320e4d77bb8ccb656175b8a24 | 4cba6096a61c0ccda0adfa0e3de6b9402c93a005 | /gimp/data/blueprints/back/usr/include/c++/7/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp | e47decc55b446c430989d342d66379f11059228d | [] | no_license | StanfordSNR/gg-results | da3de3ce52235c187c6178b0ceab32df2526abf5 | 16ac020603e4b1ef96b2d8c27d1683724cbb30b8 | refs/heads/master | 2021-08-06T16:11:06.747488 | 2019-01-05T21:41:24 | 2019-01-05T21:41:24 | 103,858,663 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 63 | hpp | // GGHASH:VT8mLu0g9D9fi1SzA_fqEM08_peLMWYAnCtWS3tnmNgw000009b5
| [
"sfouladi@gmail.com"
] | sfouladi@gmail.com |
efa199d4162d6bd81ab0154404d330b119e6f003 | fb7efe44f4d9f30d623f880d0eb620f3a81f0fbd | /chrome/common/profiling/profiling_client.cc | 1cc5d300c8c64768d80fbfb9e5f0bfb05eaba3cb | [
"BSD-3-Clause"
] | permissive | wzyy2/chromium-browser | 2644b0daf58f8b3caee8a6c09a2b448b2dfe059c | eb905f00a0f7e141e8d6c89be8fb26192a88c4b7 | refs/heads/master | 2022-11-23T20:25:08.120045 | 2018-01-16T06:41:26 | 2018-01-16T06:41:26 | 117,618,467 | 3 | 2 | BSD-3-Clause | 2022-11-20T22:03:57 | 2018-01-16T02:09:10 | null | UTF-8 | C++ | false | false | 2,392 | cc | // Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/common/profiling/profiling_client.h"
#include "base/files/platform_file.h"
#include "chrome/common/profiling/memlog_allocator_shim.h"
#include "chrome/common/profiling/memlog_sender_pipe.h"
#include "chrome/common/profiling/memlog_stream.h"
#include "content/public/common/service_manager_connection.h"
#include "content/public/common/simple_connection_filter.h"
#include "mojo/public/cpp/system/platform_handle.h"
#include "services/service_manager/public/cpp/binder_registry.h"
namespace profiling {
ProfilingClient::ProfilingClient() : binding_(this) {}
ProfilingClient::~ProfilingClient() {
StopAllocatorShimDangerous();
// The allocator shim cannot be synchronously, consistently stopped. We leak
// the memlog_sender_pipe_, with the idea that very few future messages will
// be sent to it. This happens at shutdown, so resources will be reclaimed by
// the OS after the process is terminated.
memlog_sender_pipe_.release();
}
void ProfilingClient::OnServiceManagerConnected(
content::ServiceManagerConnection* connection) {
std::unique_ptr<service_manager::BinderRegistry> registry(
new service_manager::BinderRegistry);
registry->AddInterface(base::Bind(
&profiling::ProfilingClient::BindToInterface, base::Unretained(this)));
connection->AddConnectionFilter(
base::MakeUnique<content::SimpleConnectionFilter>(std::move(registry)));
}
void ProfilingClient::BindToInterface(mojom::ProfilingClientRequest request) {
binding_.Bind(std::move(request));
}
void ProfilingClient::StartProfiling(mojo::ScopedHandle memlog_sender_pipe) {
base::PlatformFile platform_file;
CHECK_EQ(MOJO_RESULT_OK, mojo::UnwrapPlatformFile(
std::move(memlog_sender_pipe), &platform_file));
base::ScopedPlatformFile scoped_platform_file(platform_file);
memlog_sender_pipe_.reset(
new MemlogSenderPipe(std::move(scoped_platform_file)));
StreamHeader header;
header.signature = kStreamSignature;
memlog_sender_pipe_->Send(&header, sizeof(header));
InitAllocatorShim(memlog_sender_pipe_.get());
}
void ProfilingClient::FlushMemlogPipe(uint32_t barrier_id) {
AllocatorShimFlushPipe(barrier_id);
}
} // namespace profiling
| [
"jacob-chen@iotwrt.com"
] | jacob-chen@iotwrt.com |
95bff8225731de23176cada601933db1dff96bc0 | 7ee32501835c5d0cfe29529ee6edc3b4bef6910e | /OPCODE 1.3.2/OPC_SphereCollider.cpp | 24c9cf05dbcb8ce4104f079618aa46c348e09dab | [] | no_license | moscowlights/OPCODE | 88c87adb4e64b5b194a3e64b37a22fb3e77e8f88 | cf8a6a0192375e05bce14719076199766b9f9984 | refs/heads/master | 2021-05-08T19:49:39.695228 | 2018-02-13T18:30:06 | 2018-02-13T18:30:06 | 119,583,664 | 4 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 29,332 | cpp | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
* OPCODE - Optimized Collision Detection
* Copyright (C) 2001 Pierre Terdiman
* Homepage: http://www.codercorner.com/Opcode.htm
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Contains code for a sphere collider.
* \file OPC_SphereCollider.cpp
* \author Pierre Terdiman
* \date June, 2, 2001
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Contains a sphere-vs-tree collider.
* This class performs a collision test between a sphere and an AABB tree. You can use this to do a standard player vs world collision,
* in a Nettle/Telemachos way. It doesn't suffer from all reported bugs in those two classic codes - the "new" one by Paul Nettle is a
* debuggued version I think. Collision response can be driven by reported collision data - it works extremely well for me. In sake of
* efficiency, all meshes (that is, all AABB trees) should of course also be kept in an extra hierarchical structure (octree, whatever).
*
* \class SphereCollider
* \author Pierre Terdiman
* \version 1.3
* \date June, 2, 2001
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Precompiled Header
#include "Stdafx.h"
using namespace Opcode;
using namespace IceMaths;
#include "OPC_SphereAABBOverlap.h"
#include "OPC_SphereTriOverlap.h"
#define SET_CONTACT(prim_index, flag) \
/* Set contact status */ \
mFlags |= flag; \
mTouchedPrimitives->Add(udword(prim_index));
//! Sphere-triangle overlap test
#define SPHERE_PRIM(prim_index, flag) \
/* Request vertices from the app */ \
VertexPointers VP; mIMesh->GetTriangle(VP, prim_index); \
\
/* Perform sphere-tri overlap test */ \
if(SphereTriOverlap(*VP.Vertex[0], *VP.Vertex[1], *VP.Vertex[2])) \
{ \
SET_CONTACT(prim_index, flag) \
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Constructor.
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
SphereCollider::SphereCollider()
{
mCenter.Zero();
mRadius2 = 0.0f;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Destructor.
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
SphereCollider::~SphereCollider()
{
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Generic collision query for generic OPCODE models. After the call, access the results:
* - with GetContactStatus()
* - with GetNbTouchedPrimitives()
* - with GetTouchedPrimitives()
*
* \param cache [in/out] a sphere cache
* \param sphere [in] collision sphere in local space
* \param model [in] Opcode model to collide with
* \param worlds [in] sphere's world matrix, or null
* \param worldm [in] model's world matrix, or null
* \return true if success
* \warning SCALE NOT SUPPORTED IN SPHERE WORLD MATRIX. The matrix must contain rotation & translation parts only.
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool SphereCollider::Collide(SphereCache& cache, const IceMaths::Sphere& sphere, const Model& model, const IceMaths::Matrix4x4* worlds, const IceMaths::Matrix4x4* worldm)
{
// Checkings
if(!Setup(&model)) return false;
// Init collision query
if(InitQuery(cache, sphere, worlds, worldm)) return true;
// Special case for 1-leaf trees
if(mCurrentModel && mCurrentModel->HasSingleNode())
{
// Here we're supposed to perform a normal query, except our tree has a single node, i.e. just a few triangles
udword Nb = mIMesh->GetNbTriangles();
// Loop through all triangles
for(udword i=0;i<Nb;i++)
{
SPHERE_PRIM(i, OPC_CONTACT)
}
return true;
}
if(!model.HasLeafNodes())
{
if(model.IsQuantized())
{
const AABBQuantizedNoLeafTree* Tree = static_cast<const AABBQuantizedNoLeafTree *>(model.GetTree());
// Setup dequantization coeffs
mCenterCoeff = Tree->mCenterCoeff;
mExtentsCoeff = Tree->mExtentsCoeff;
// Perform collision query
if(SkipPrimitiveTests()) _CollideNoPrimitiveTest(Tree->GetNodes());
else _Collide(Tree->GetNodes());
}
else
{
const AABBNoLeafTree* Tree = static_cast<const AABBNoLeafTree *>(model.GetTree());
// Perform collision query
if(SkipPrimitiveTests()) _CollideNoPrimitiveTest(Tree->GetNodes());
else _Collide(Tree->GetNodes());
}
}
else
{
if(model.IsQuantized())
{
const AABBQuantizedTree* Tree = static_cast<const AABBQuantizedTree *>(model.GetTree());
// Setup dequantization coeffs
mCenterCoeff = Tree->mCenterCoeff;
mExtentsCoeff = Tree->mExtentsCoeff;
// Perform collision query
if(SkipPrimitiveTests()) _CollideNoPrimitiveTest(Tree->GetNodes());
else _Collide(Tree->GetNodes());
}
else
{
const AABBCollisionTree* Tree = static_cast<const AABBCollisionTree *>(model.GetTree());
// Perform collision query
if(SkipPrimitiveTests()) _CollideNoPrimitiveTest(Tree->GetNodes());
else _Collide(Tree->GetNodes());
}
}
return true;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Initializes a collision query :
* - reset stats & contact status
* - setup matrices
* - check temporal coherence
*
* \param cache [in/out] a sphere cache
* \param sphere [in] sphere in local space
* \param worlds [in] sphere's world matrix, or null
* \param worldm [in] model's world matrix, or null
* \return TRUE if we can return immediately
* \warning SCALE NOT SUPPORTED IN SPHERE WORLD MATRIX. The matrix must contain rotation & translation parts only.
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL SphereCollider::InitQuery(SphereCache& cache, const IceMaths::Sphere& sphere, const IceMaths::Matrix4x4* worlds, const IceMaths::Matrix4x4* worldm)
{
// 1) Call the base method
VolumeCollider::InitQuery();
// 2) Compute sphere in model space:
// - Precompute R^2
mRadius2 = sphere.mRadius * sphere.mRadius;
// - Compute center position
mCenter = sphere.mCenter;
// -> to world space
if(worlds) mCenter *= *worlds;
// -> to model space
if(worldm)
{
// Matrix normalization & scaling stripping
IceMaths::Matrix4x4 normWorldm;
NormalizePRSMatrix( normWorldm, mLocalScale, *worldm );
// Invert model matrix
IceMaths::Matrix4x4 InvWorldM;
InvertPRMatrix(InvWorldM, normWorldm); // OLD: //InvertPRMatrix(InvWorldM, *worldm);
mCenter *= InvWorldM;
}else
{
mLocalScale.Set(1.0,1.0,1.0);
}
// 3) Setup destination pointer
mTouchedPrimitives = &cache.TouchedPrimitives;
// 4) Special case: 1-triangle meshes [Opcode 1.3]
if(mCurrentModel && mCurrentModel->HasSingleNode())
{
if(!SkipPrimitiveTests())
{
// We simply perform the BV-Prim overlap test each time. We assume single triangle has index 0.
mTouchedPrimitives->Reset();
// Perform overlap test between the unique triangle and the sphere (and set contact status if needed)
SPHERE_PRIM(udword(0), OPC_CONTACT)
// Return immediately regardless of status
return TRUE;
}
}
// 5) Check temporal coherence :
if(TemporalCoherenceEnabled())
{
// Here we use temporal coherence
// => check results from previous frame before performing the collision query
if(FirstContactEnabled())
{
// We're only interested in the first contact found => test the unique previously touched face
if(mTouchedPrimitives->GetNbEntries())
{
// Get index of previously touched face = the first entry in the array
udword PreviouslyTouchedFace = mTouchedPrimitives->GetEntry(0);
// Then reset the array:
// - if the overlap test below is successful, the index we'll get added back anyway
// - if it isn't, then the array should be reset anyway for the normal query
mTouchedPrimitives->Reset();
// Perform overlap test between the cached triangle and the sphere (and set contact status if needed)
SPHERE_PRIM(PreviouslyTouchedFace, OPC_TEMPORAL_CONTACT)
// Return immediately if possible
if(GetContactStatus()) return TRUE;
}
// else no face has been touched during previous query
// => we'll have to perform a normal query
}
else
{
// We're interested in all contacts =>test the new real sphere N(ew) against the previous fat sphere P(revious):
float r = sqrtf(cache.FatRadius2) - sphere.mRadius;
if(IsCacheValid(cache) && cache.Center.SquareDistance(mCenter) < r*r)
{
// - if N is included in P, return previous list
// => we simply leave the list (mTouchedFaces) unchanged
// Set contact status if needed
if(mTouchedPrimitives->GetNbEntries()) mFlags |= OPC_TEMPORAL_CONTACT;
// In any case we don't need to do a query
return TRUE;
}
else
{
// - else do the query using a fat N
// Reset cache since we'll about to perform a real query
mTouchedPrimitives->Reset();
// Make a fat sphere so that coherence will work for subsequent frames
mRadius2 *= cache.FatCoeff;
// mRadius2 = (sphere.mRadius * cache.FatCoeff)*(sphere.mRadius * cache.FatCoeff);
// Update cache with query data (signature for cached faces)
cache.Center = mCenter;
cache.FatRadius2 = mRadius2;
}
}
}
else
{
// Here we don't use temporal coherence => do a normal query
mTouchedPrimitives->Reset();
}
return FALSE;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Collision query for vanilla AABB trees.
* \param cache [in/out] a sphere cache
* \param sphere [in] collision sphere in world space
* \param tree [in] AABB tree
* \return true if success
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool SphereCollider::Collide(SphereCache& cache, const IceMaths::Sphere& sphere, const AABBTree* tree)
{
// This is typically called for a scene tree, full of -AABBs-, not full of triangles.
// So we don't really have "primitives" to deal with. Hence it doesn't work with
// "FirstContact" + "TemporalCoherence".
ASSERT( !(FirstContactEnabled() && TemporalCoherenceEnabled()) );
// Checkings
if(!tree) return false;
// Init collision query
if(InitQuery(cache, sphere)) return true;
// Perform collision query
_Collide(tree);
return true;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Checks the sphere completely contains the box. In which case we can end the query sooner.
* \param bc_ [in] box center
* \param be_ [in] box extents
* \return true if the sphere contains the whole box
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
inline_ BOOL SphereCollider::SphereContainsBox(const IceMaths::Point& bc_, const IceMaths::Point& be_)
{
// I assume if all 8 box vertices are inside the sphere, so does the whole box.
// Sounds ok but maybe there's a better way?
IceMaths::Point p;
// scaling freak
IceMaths::Point bc = bc_*mLocalScale;
IceMaths::Point be = be_*mLocalScale;
p.x=bc.x+be.x; p.y=bc.y+be.y; p.z=bc.z+be.z; if(mCenter.SquareDistance(p)>=mRadius2) return FALSE;
p.x=bc.x-be.x; if(mCenter.SquareDistance(p)>=mRadius2) return FALSE;
p.x=bc.x+be.x; p.y=bc.y-be.y; if(mCenter.SquareDistance(p)>=mRadius2) return FALSE;
p.x=bc.x-be.x; if(mCenter.SquareDistance(p)>=mRadius2) return FALSE;
p.x=bc.x+be.x; p.y=bc.y+be.y; p.z=bc.z-be.z; if(mCenter.SquareDistance(p)>=mRadius2) return FALSE;
p.x=bc.x-be.x; if(mCenter.SquareDistance(p)>=mRadius2) return FALSE;
p.x=bc.x+be.x; p.y=bc.y-be.y; if(mCenter.SquareDistance(p)>=mRadius2) return FALSE;
p.x=bc.x-be.x; if(mCenter.SquareDistance(p)>=mRadius2) return FALSE;
return TRUE;
}
#define TEST_BOX_IN_SPHERE(center, extents) \
if(SphereContainsBox(center, extents)) \
{ \
/* Set contact status */ \
mFlags |= OPC_CONTACT; \
_Dump(node); \
return; \
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Recursive collision query for normal AABB trees.
* \param node [in] current collision node
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void SphereCollider::_Collide(const AABBCollisionNode* node)
{
// Perform Sphere-AABB overlap test
if(!SphereAABBOverlap(node->mAABB.mCenter, node->mAABB.mExtents)) return;
TEST_BOX_IN_SPHERE(node->mAABB.mCenter, node->mAABB.mExtents)
if(node->IsLeaf())
{
SPHERE_PRIM(node->GetPrimitive(), OPC_CONTACT)
}
else
{
_Collide(node->GetPos());
if(ContactFound()) return;
_Collide(node->GetNeg());
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Recursive collision query for normal AABB trees, without primitive tests.
* \param node [in] current collision node
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void SphereCollider::_CollideNoPrimitiveTest(const AABBCollisionNode* node)
{
// Perform Sphere-AABB overlap test
if(!SphereAABBOverlap(node->mAABB.mCenter, node->mAABB.mExtents)) return;
TEST_BOX_IN_SPHERE(node->mAABB.mCenter, node->mAABB.mExtents)
if(node->IsLeaf())
{
SET_CONTACT(node->GetPrimitive(), OPC_CONTACT)
}
else
{
_CollideNoPrimitiveTest(node->GetPos());
if(ContactFound()) return;
_CollideNoPrimitiveTest(node->GetNeg());
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Recursive collision query for quantized AABB trees.
* \param node [in] current collision node
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void SphereCollider::_Collide(const AABBQuantizedNode* node)
{
// Dequantize box
const QuantizedAABB& Box = node->mAABB;
const IceMaths::Point Center(float(Box.mCenter[0]) * mCenterCoeff.x, float(Box.mCenter[1]) * mCenterCoeff.y, float(Box.mCenter[2]) * mCenterCoeff.z);
const IceMaths::Point Extents(float(Box.mExtents[0]) * mExtentsCoeff.x, float(Box.mExtents[1]) * mExtentsCoeff.y, float(Box.mExtents[2]) * mExtentsCoeff.z);
// Perform Sphere-AABB overlap test
if(!SphereAABBOverlap(Center, Extents)) return;
TEST_BOX_IN_SPHERE(Center, Extents)
if(node->IsLeaf())
{
SPHERE_PRIM(node->GetPrimitive(), OPC_CONTACT)
}
else
{
_Collide(node->GetPos());
if(ContactFound()) return;
_Collide(node->GetNeg());
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Recursive collision query for quantized AABB trees, without primitive tests.
* \param node [in] current collision node
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void SphereCollider::_CollideNoPrimitiveTest(const AABBQuantizedNode* node)
{
// Dequantize box
const QuantizedAABB& Box = node->mAABB;
const IceMaths::Point Center(float(Box.mCenter[0]) * mCenterCoeff.x, float(Box.mCenter[1]) * mCenterCoeff.y, float(Box.mCenter[2]) * mCenterCoeff.z);
const IceMaths::Point Extents(float(Box.mExtents[0]) * mExtentsCoeff.x, float(Box.mExtents[1]) * mExtentsCoeff.y, float(Box.mExtents[2]) * mExtentsCoeff.z);
// Perform Sphere-AABB overlap test
if(!SphereAABBOverlap(Center, Extents)) return;
TEST_BOX_IN_SPHERE(Center, Extents)
if(node->IsLeaf())
{
SET_CONTACT(node->GetPrimitive(), OPC_CONTACT)
}
else
{
_CollideNoPrimitiveTest(node->GetPos());
if(ContactFound()) return;
_CollideNoPrimitiveTest(node->GetNeg());
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Recursive collision query for no-leaf AABB trees.
* \param node [in] current collision node
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void SphereCollider::_Collide(const AABBNoLeafNode* node)
{
// Perform Sphere-AABB overlap test
if(!SphereAABBOverlap(node->mAABB.mCenter, node->mAABB.mExtents)) return;
TEST_BOX_IN_SPHERE(node->mAABB.mCenter, node->mAABB.mExtents)
if(node->HasPosLeaf()) { SPHERE_PRIM(node->GetPosPrimitive(), OPC_CONTACT) }
else _Collide(node->GetPos());
if(ContactFound()) return;
if(node->HasNegLeaf()) { SPHERE_PRIM(node->GetNegPrimitive(), OPC_CONTACT) }
else _Collide(node->GetNeg());
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Recursive collision query for no-leaf AABB trees, without primitive tests.
* \param node [in] current collision node
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void SphereCollider::_CollideNoPrimitiveTest(const AABBNoLeafNode* node)
{
// Perform Sphere-AABB overlap test
if(!SphereAABBOverlap(node->mAABB.mCenter, node->mAABB.mExtents)) return;
TEST_BOX_IN_SPHERE(node->mAABB.mCenter, node->mAABB.mExtents)
if(node->HasPosLeaf()) { SET_CONTACT(node->GetPosPrimitive(), OPC_CONTACT) }
else _CollideNoPrimitiveTest(node->GetPos());
if(ContactFound()) return;
if(node->HasNegLeaf()) { SET_CONTACT(node->GetNegPrimitive(), OPC_CONTACT) }
else _CollideNoPrimitiveTest(node->GetNeg());
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Recursive collision query for quantized no-leaf AABB trees.
* \param node [in] current collision node
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void SphereCollider::_Collide(const AABBQuantizedNoLeafNode* node)
{
// Dequantize box
const QuantizedAABB& Box = node->mAABB;
const IceMaths::Point Center(float(Box.mCenter[0]) * mCenterCoeff.x, float(Box.mCenter[1]) * mCenterCoeff.y, float(Box.mCenter[2]) * mCenterCoeff.z);
const IceMaths::Point Extents(float(Box.mExtents[0]) * mExtentsCoeff.x, float(Box.mExtents[1]) * mExtentsCoeff.y, float(Box.mExtents[2]) * mExtentsCoeff.z);
// Perform Sphere-AABB overlap test
if(!SphereAABBOverlap(Center, Extents)) return;
TEST_BOX_IN_SPHERE(Center, Extents)
if(node->HasPosLeaf()) { SPHERE_PRIM(node->GetPosPrimitive(), OPC_CONTACT) }
else _Collide(node->GetPos());
if(ContactFound()) return;
if(node->HasNegLeaf()) { SPHERE_PRIM(node->GetNegPrimitive(), OPC_CONTACT) }
else _Collide(node->GetNeg());
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Recursive collision query for quantized no-leaf AABB trees, without primitive tests.
* \param node [in] current collision node
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void SphereCollider::_CollideNoPrimitiveTest(const AABBQuantizedNoLeafNode* node)
{
// Dequantize box
const QuantizedAABB& Box = node->mAABB;
const IceMaths::Point Center(float(Box.mCenter[0]) * mCenterCoeff.x, float(Box.mCenter[1]) * mCenterCoeff.y, float(Box.mCenter[2]) * mCenterCoeff.z);
const IceMaths::Point Extents(float(Box.mExtents[0]) * mExtentsCoeff.x, float(Box.mExtents[1]) * mExtentsCoeff.y, float(Box.mExtents[2]) * mExtentsCoeff.z);
// Perform Sphere-AABB overlap test
if(!SphereAABBOverlap(Center, Extents)) return;
TEST_BOX_IN_SPHERE(Center, Extents)
if(node->HasPosLeaf()) { SET_CONTACT(node->GetPosPrimitive(), OPC_CONTACT) }
else _CollideNoPrimitiveTest(node->GetPos());
if(ContactFound()) return;
if(node->HasNegLeaf()) { SET_CONTACT(node->GetNegPrimitive(), OPC_CONTACT) }
else _CollideNoPrimitiveTest(node->GetNeg());
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Recursive collision query for vanilla AABB trees.
* \param node [in] current collision node
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void SphereCollider::_Collide(const AABBTreeNode* node)
{
// Perform Sphere-AABB overlap test
IceMaths::Point Center, Extents;
node->GetAABB()->GetCenter(Center);
node->GetAABB()->GetExtents(Extents);
if(!SphereAABBOverlap(Center, Extents)) return;
if(node->IsLeaf() || SphereContainsBox(Center, Extents))
{
mFlags |= OPC_CONTACT;
mTouchedPrimitives->Add(node->GetPrimitives(), node->GetNbPrimitives());
}
else
{
_Collide(node->GetPos());
_Collide(node->GetNeg());
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Constructor.
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
HybridSphereCollider::HybridSphereCollider()
{
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Destructor.
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
HybridSphereCollider::~HybridSphereCollider()
{
}
bool HybridSphereCollider::Collide(SphereCache& cache, const IceMaths::Sphere& sphere, const HybridModel& model, const IceMaths::Matrix4x4* worlds, const IceMaths::Matrix4x4* worldm)
{
// We don't want primitive tests here!
mFlags |= OPC_NO_PRIMITIVE_TESTS;
// Checkings
if(!Setup(&model)) return false;
// Init collision query
if(InitQuery(cache, sphere, worlds, worldm)) return true;
// Special case for 1-leaf trees
if(mCurrentModel && mCurrentModel->HasSingleNode())
{
// Here we're supposed to perform a normal query, except our tree has a single node, i.e. just a few triangles
udword Nb = mIMesh->GetNbTriangles();
// Loop through all triangles
for(udword i=0;i<Nb;i++)
{
SPHERE_PRIM(i, OPC_CONTACT)
}
return true;
}
// Override destination array since we're only going to get leaf boxes here
mTouchedBoxes.Reset();
mTouchedPrimitives = &mTouchedBoxes;
// Now, do the actual query against leaf boxes
if(!model.HasLeafNodes())
{
if(model.IsQuantized())
{
const AABBQuantizedNoLeafTree* Tree = static_cast<const AABBQuantizedNoLeafTree *>(model.GetTree());
// Setup dequantization coeffs
mCenterCoeff = Tree->mCenterCoeff;
mExtentsCoeff = Tree->mExtentsCoeff;
// Perform collision query - we don't want primitive tests here!
_CollideNoPrimitiveTest(Tree->GetNodes());
}
else
{
const AABBNoLeafTree* Tree = static_cast<const AABBNoLeafTree *>(model.GetTree());
// Perform collision query - we don't want primitive tests here!
_CollideNoPrimitiveTest(Tree->GetNodes());
}
}
else
{
if(model.IsQuantized())
{
const AABBQuantizedTree* Tree = static_cast<const AABBQuantizedTree *>(model.GetTree());
// Setup dequantization coeffs
mCenterCoeff = Tree->mCenterCoeff;
mExtentsCoeff = Tree->mExtentsCoeff;
// Perform collision query - we don't want primitive tests here!
_CollideNoPrimitiveTest(Tree->GetNodes());
}
else
{
const AABBCollisionTree* Tree = static_cast<const AABBCollisionTree *>(model.GetTree());
// Perform collision query - we don't want primitive tests here!
_CollideNoPrimitiveTest(Tree->GetNodes());
}
}
// We only have a list of boxes so far
if(GetContactStatus())
{
// Reset contact status, since it currently only reflects collisions with leaf boxes
Collider::InitQuery();
// Change dest container so that we can use built-in overlap tests and get collided primitives
cache.TouchedPrimitives.Reset();
mTouchedPrimitives = &cache.TouchedPrimitives;
// Read touched leaf boxes
udword Nb = mTouchedBoxes.GetNbEntries();
const udword* Touched = mTouchedBoxes.GetEntries();
const LeafTriangles* LT = model.GetLeafTriangles();
const udword* Indices = model.GetIndices();
// Loop through touched leaves
while(Nb--)
{
const LeafTriangles& CurrentLeaf = LT[*Touched++];
// Each leaf box has a set of triangles
udword NbTris = CurrentLeaf.GetNbTriangles();
if(Indices)
{
const udword* T = &Indices[CurrentLeaf.GetTriangleIndex()];
// Loop through triangles and test each of them
while(NbTris--)
{
udword TriangleIndex = *T++;
SPHERE_PRIM(TriangleIndex, OPC_CONTACT)
}
}
else
{
udword BaseIndex = CurrentLeaf.GetTriangleIndex();
// Loop through triangles and test each of them
while(NbTris--)
{
udword TriangleIndex = BaseIndex++;
SPHERE_PRIM(TriangleIndex, OPC_CONTACT)
}
}
}
}
return true;
}
| [
"a@a.a"
] | a@a.a |
0640a12cd5a928fbf2850dcbba3ed4ac8775381d | 468067fbc1cba8379bbf1a11dee3ae5e527d122e | /FinalProduct/archive/PUimage/Motion.h | 0df233acd7f4316b6aa160f2825b9e048822e51d | [] | no_license | noticeable/MscProject | b675c87b04892af574082bfceea87027030e1cc3 | 0aca2d34c9736fc02f0f5a330a63d8653c84490e | refs/heads/master | 2020-04-16T22:47:57.775032 | 2016-10-23T07:46:16 | 2016-10-23T07:46:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,581 | h | /************************* Includes *******************************/
#include <stdio.h>
#include <conio.h>
#include <iostream>
#include <vector>
#include <math.h>
#include <list>
#include "opencv/cv.h" // Computer Vision Lib Header
#include "opencv/highgui.h" // HighGUI Vision Lib Header
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/opencv.hpp"
/********************************************************************/
using namespace cv;
using namespace std;
Mat LaplacianPyr(Mat img);
bool buildLaplacianPyramid(const Mat &img, const int levels, vector<Mat> &pyramid);//motion
void temporalIIRFilter(const Mat &src, Mat &dst);
void amplify(const Mat &src, Mat &dst);
void reconImgFromLaplacianPyramid2(const vector<Mat> &pyramid, const int levels, Mat &dst);
void attenuate(Mat &src, Mat &dst);
void motion();
void color();
bool buildGaussianPyramid(const cv::Mat &img, const int levels, std::vector<cv::Mat> &pyramid);
void temporalIdealFilter(const cv::Mat &src, cv::Mat &dst);
void upsamplingFromGaussianPyramid(const cv::Mat &src, const int levels, cv::Mat &dst);
void amplify2(const Mat &src, Mat &dst);
void createIdealBandpassFilter(cv::Mat &filter, double fl, double fh, double rate);
bool buildGaussianPyramid(const cv::Mat &img,
const int levels,
std::vector<cv::Mat> &pyramid);
void concat(const std::vector<cv::Mat> &frames,
cv::Mat &dst);
void temporalIdealFilter(const cv::Mat &src,
cv::Mat &dst);
void deConcat(const cv::Mat &src,
const cv::Size &frameSize,
std::vector<cv::Mat> &frames);
| [
"shanshan.fu15@imperial.ac.uk"
] | shanshan.fu15@imperial.ac.uk |
347565ff667583cda80a590f386a9f77d85133a3 | 98877e9ccb49848791945db2853c459c687e1bb7 | /MonitorSYS/MonitorSYSDlg.h | 7cc856a8431308f4d306b8f96b1d56cc6d4954a3 | [] | no_license | Spritutu/MonitorSYS | 6b962e454a0afd74075f186290158d40a66b3042 | ce26e517fa0fde8ce6e3405cddcc1bfb6c5805ba | refs/heads/master | 2021-01-16T18:15:56.764459 | 2015-05-25T22:48:04 | 2015-05-25T22:48:04 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,849 | h |
// MonitorSYSDlg.h : 头文件
//
#pragma once
#include "LoginDlg.h"
#include "BtnST.h"
#include "afxwin.h"
#include "AntimonyDlg.h"
#include "ConditionDlg.h"
#include "LoginDlg.h"
#include "OptimizeCtrDlg.h"
#include "GoldDlg.h"
#include "ProcessDiagram.h"
// CMonitorSYSDlg 对话框
class CMonitorSYSDlg : public CDialogEx
{
// 构造
public:
CMonitorSYSDlg(CWnd* pParent = NULL); // 标准构造函数
CLoginDlg loginDlg;
CProcessDiagram processDlg;
CGoldDlg goldDlg;
CAntimonyDlg antimonyDlg;
COptimizeCtrDlg optimizeCtrDlg;
CConditionDlg conditionDlg;
CBrush m_brush;
CFont m_font;
CFont m_font1;
CFont m_font2;
// 对话框数据
enum { IDD = IDD_MONITORSYS_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
// 实现
protected:
HICON m_hIcon;
// 生成的消息映射函数
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
public:
CButtonST m_btmin;
CButtonST m_btcalcel;
CButtonST m_btprocess;
CButtonST m_btgold;
CButtonST m_btantimony;
CButtonST m_btcontrol;
CButtonST m_btcondition;
afx_msg LRESULT OnNcHitTest(CPoint point);
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
void setbtColor(CButtonST *btst, COLORREF crColor, COLORREF textColor = RGB(255, 255, 255));
afx_msg void OnBnClickedMinzoom();
afx_msg void OnBnClickedCancel();
afx_msg void OnBnClickedBtgold();
afx_msg void OnBnClickedBtprocess();
afx_msg void OnBnClickedBtantimony();
afx_msg void OnBnClickedBtcontrol();
afx_msg void OnBnClickedBtcondition();
CButtonST m_usedtime;
CButtonST m_workcondition;
CButtonST m_time;
CButtonST m_label;
afx_msg void OnTimer(UINT_PTR nIDEvent);
CButtonST m_home;
CButtonST m_history;
CButtonST m_expertsys;
};
| [
"905524057@qq.com"
] | 905524057@qq.com |
97c421933ed4fb2853e23d1781a45ca6d0529f17 | e8ce2a3ffb573832a8a836bbae490f762961703f | /MegascansPlugin/Source/MegascansPlugin/Private/Utilities/AssetsDatabase.cpp | 0657dcdd4f5a9c9f7c280a1c44676cc1e09a411a | [] | no_license | JuHwan0123/ThreeDPose_UnrealRND | d4c5ca5cc86e6d51ad51f5bb40ab174389b923c5 | 043415ed551eff8829eb18670b4b98d98a91f19c | refs/heads/main | 2023-08-28T13:26:24.314773 | 2021-10-13T08:28:58 | 2021-10-13T08:28:58 | 416,651,907 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,139 | cpp | // Copyright Epic Games, Inc. All Rights Reserved.
#include "AssetsDatabase.h"
#include "Misc/Paths.h"
//#include "SQLiteDatabase.h"
#include "SQLitePreparedStatement.h"
#include "SQLiteDatabaseConnection.h"
#include "SQLiteResultSet.h"
TSharedPtr<FAssetsDatabase> FAssetsDatabase::DBInst;
TSharedPtr<FAssetsDatabase> FAssetsDatabase::Get()
{
if (!DBInst.IsValid())
{
DBInst = MakeShareable(new FAssetsDatabase);
}
return DBInst;
}
FAssetsDatabase::FAssetsDatabase()
{
SQLiteDatabase = MakeShareable(new FSQLiteDatabaseConnection);
FString DatabasePath = FPaths::Combine(FPaths::ConvertRelativePathToFull(FPaths::ProjectContentDir()), TEXT("MSPresets"), TEXT("MSAssets.db"));
CreateAssetsDatabase(DatabasePath);
}
FAssetsDatabase::~FAssetsDatabase()
{
SQLiteDatabase->Close();
}
void FAssetsDatabase::CreateAssetsDatabase(const FString& DatabasePath)
{
SQLiteDatabase->Open(*DatabasePath, nullptr, nullptr);
FString CreateStatement = TEXT("CREATE TABLE IF NOT EXISTS MegascansAssets("
"ID TEXT PRIMARY KEY NOT NULL,"
"NAME TEXT NOT NULL,"
"PATH TEXT NOT NULL,"
"TYPE TEXT NOT NULL"
");");
SQLiteDatabase->Execute(*CreateStatement);
FString MatCreateStatement = TEXT("CREATE TABLE IF NOT EXISTS MSPresets("
"ID TEXT PRIMARY KEY NOT NULL,"
"VERSION FLOAT NOT NULL"
");");
SQLiteDatabase->Execute(*MatCreateStatement);
}
void FAssetsDatabase::AddRecord(const AssetRecord& Record)
{
FString InsertStatement = FString::Printf(TEXT("INSERT OR REPLACE INTO MegascansAssets VALUES('%s', '%s', '%s', '%s');"), *Record.ID, *Record.Name, *Record.Path, *Record.Type);
SQLiteDatabase->Execute(*InsertStatement);
}
void FAssetsDatabase::AddMaterialRecord(const FString& MaterialName, float MaterialVersion)
{
FString InsertStatement = FString::Printf(TEXT("INSERT OR REPLACE INTO MSPresets VALUES('%s', %f);"), *MaterialName, MaterialVersion);
SQLiteDatabase->Execute(*InsertStatement);
}
bool FAssetsDatabase::RecordExists(const FString& AssetID, AssetRecord& Record)
{
FString SelectStatement = FString::Printf(TEXT("SELECT * FROM MegascansAssets WHERE ID = '%s'"), *AssetID);
FSQLiteResultSet* QueryResult = NULL;
if (SQLiteDatabase->Execute(*SelectStatement, QueryResult))
{
for (FSQLiteResultSet::TIterator ResultIterator(QueryResult); ResultIterator; ++ResultIterator)
{
Record.ID = ResultIterator->GetString(TEXT("ID"));
Record.Name = ResultIterator->GetString(TEXT("NAME"));
Record.Path = ResultIterator->GetString(TEXT("PATH"));
Record.Type = ResultIterator->GetString(TEXT("TYPE"));
return true;
}
}
return false;
}
float FAssetsDatabase::GetMaterialVersion(const FString& MaterialName)
{
FString SelectStatement = FString::Printf(TEXT("SELECT * FROM MSPresets WHERE ID = '%s'"), *MaterialName);
FSQLiteResultSet* QueryResult = NULL;
if (SQLiteDatabase->Execute(*SelectStatement, QueryResult))
{
for (FSQLiteResultSet::TIterator ResultIterator(QueryResult); ResultIterator; ++ResultIterator)
{
return ResultIterator->GetFloat(TEXT("VERSION"));
}
}
return 0.0f;
}
| [
"83950058+JuHwan0123@users.noreply.github.com"
] | 83950058+JuHwan0123@users.noreply.github.com |
8dde379fd73c9bb8410265ac6535e6b44f48fe65 | cf8ddfc720bf6451c4ef4fa01684327431db1919 | /SDK/ARKSurvivalEvolved_EngramEntry_HazardSuit_Chest_parameters.hpp | cbbb329ca4d9ba5f26cc4a0facc4296947631ade | [
"MIT"
] | permissive | git-Charlie/ARK-SDK | 75337684b11e7b9f668da1f15e8054052a3b600f | c38ca9925309516b2093ad8c3a70ed9489e1d573 | refs/heads/master | 2023-06-20T06:30:33.550123 | 2021-07-11T13:41:45 | 2021-07-11T13:41:45 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 770 | hpp | #pragma once
// ARKSurvivalEvolved (329.9) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
#include "ARKSurvivalEvolved_EngramEntry_HazardSuit_Chest_classes.hpp"
namespace sdk
{
//---------------------------------------------------------------------------
//Parameters
//---------------------------------------------------------------------------
// Function EngramEntry_HazardSuit_Chest.EngramEntry_HazardSuit_Chest_C.ExecuteUbergraph_EngramEntry_HazardSuit_Chest
struct UEngramEntry_HazardSuit_Chest_C_ExecuteUbergraph_EngramEntry_HazardSuit_Chest_Params
{
int EntryPoint; // (Parm, ZeroConstructor, IsPlainOldData)
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"sergey.2bite@gmail.com"
] | sergey.2bite@gmail.com |
4890ed6671e588fb3904874497e2b60f8ab637e7 | 04a8d1f59a7be8a7f4b155929e286621b01341d8 | /gclTimer.h | d228efc319cdd26b608c44b57a24ff5f83f1bd1e | [] | no_license | soheean/interraster | 611b8c19652845787b3728b8fe2ef15f97e2ef4e | a165d769936701221f04f3610f81e08063f6fd97 | refs/heads/master | 2021-01-17T17:24:37.271248 | 2016-06-24T07:47:16 | 2016-06-24T07:47:16 | 61,866,682 | 2 | 0 | null | null | null | null | GB18030 | C++ | false | false | 336 | h | #pragma once
typedef __int64 i64;
class gclTimer
{
public:
gclTimer(void);
~gclTimer(void);
private:
double _freq;
double _clocks;
double _start;
public:
void Start(void);//启动计时器
void Stop(void); //停止计时器
void Reset(void);//复位计时器
double GetElapsedTime(void);//计算流逝的时间
};
| [
"soheean@hotmail.com"
] | soheean@hotmail.com |
856b8e43f7d19e3ed3d11f8452fbdd37f866ab57 | 588c53fbe0f2edce97477481374f1155ce5d99e1 | /07_2.cpp | 48021060934ba581ea06341f93b8371bd77e1bad | [] | no_license | Zcholm/Codility | 8ff4c5b20e697dbdab6e6fc969d9afad82aed6b5 | 2618640f4491159dab395fdbfa74ebacf20f872f | refs/heads/master | 2020-09-13T18:07:04.193802 | 2019-11-22T13:20:52 | 2019-11-22T13:20:52 | 222,863,802 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 519 | cpp | #include<vector>
int solution(vector<int> &A, vector<int> &B) {
int N = A.size();
vector<int> queue;
int alive = N;
for (int i = 0; i < N; i++) {
if (B[i] == 0) {
while (queue.size() > 0 && queue.back() < A[i]) {
queue.pop_back();
alive--;
}
if (queue.size() > 0) {
alive--;
}
} else {
// add to queue
queue.push_back(A[i]);
}
}
return alive;
}
| [
"simon.holm@afconsult.com"
] | simon.holm@afconsult.com |
eeccbb766fda1f600830ec95e1910553d6a44b54 | 6a55fc908497a0d4ada6eae74d64a057b609c261 | /inference-engine/thirdparty/clDNN/src/gpu/device_info.cpp | 1402e05d5513c1ceae6bb9599db76362448277c7 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | anton-potapov/openvino | 9f24be70026a27ea55dafa6e7e2b6b18c6c18e88 | 84119afe9a8c965e0a0cd920fff53aee67b05108 | refs/heads/master | 2023-04-27T16:34:50.724901 | 2020-06-10T11:13:08 | 2020-06-10T11:13:08 | 271,256,329 | 1 | 0 | Apache-2.0 | 2021-04-23T08:22:48 | 2020-06-10T11:16:29 | null | UTF-8 | C++ | false | false | 2,946 | cpp | // Copyright (c) 2018 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 "device_info.h"
#include "include/to_string_utils.h"
#include <unordered_map>
#include <string>
#include <cassert>
#include <time.h>
#include <limits>
#include <chrono>
#include "ocl_builder.h"
#include <fstream>
#include <iostream>
#include <utility>
namespace cldnn {
namespace gpu {
device_info_internal::device_info_internal(const cl::Device& device) {
dev_name = device.getInfo<CL_DEVICE_NAME>();
driver_version = device.getInfo<CL_DRIVER_VERSION>();
compute_units_count = device.getInfo<CL_DEVICE_MAX_COMPUTE_UNITS>();
cores_count = static_cast<uint32_t>(device.getInfo<CL_DEVICE_MAX_COMPUTE_UNITS>());
core_frequency = static_cast<uint32_t>(device.getInfo<CL_DEVICE_MAX_CLOCK_FREQUENCY>());
max_work_group_size = static_cast<uint64_t>(device.getInfo<CL_DEVICE_MAX_WORK_GROUP_SIZE>());
if (max_work_group_size > 256)
max_work_group_size = 256;
max_local_mem_size = static_cast<uint64_t>(device.getInfo<CL_DEVICE_LOCAL_MEM_SIZE>());
max_global_mem_size = static_cast<uint64_t>(device.getInfo<CL_DEVICE_GLOBAL_MEM_SIZE>());
max_alloc_mem_size = static_cast<uint64_t>(device.getInfo<CL_DEVICE_MAX_MEM_ALLOC_SIZE>());
supports_image = static_cast<uint8_t>(device.getInfo<CL_DEVICE_IMAGE_SUPPORT>());
max_image2d_width = static_cast<uint64_t>(device.getInfo<CL_DEVICE_IMAGE2D_MAX_WIDTH>());
max_image2d_height = static_cast<uint64_t>(device.getInfo<CL_DEVICE_IMAGE2D_MAX_HEIGHT>());
// Check for supported features.
auto extensions = device.getInfo<CL_DEVICE_EXTENSIONS>();
extensions.push_back(' '); // Add trailing space to ease searching (search with keyword with trailing space).
supports_fp16 = extensions.find("cl_khr_fp16 ") != std::string::npos;
supports_fp16_denorms = supports_fp16 && (device.getInfo<CL_DEVICE_HALF_FP_CONFIG>() & CL_FP_DENORM) != 0;
supports_subgroups_short = extensions.find("cl_intel_subgroups_short") != std::string::npos;
supports_imad = dev_name.find("Gen12") != std::string::npos;
supports_immad = false;
dev_type = static_cast<uint32_t>(device.getInfo<CL_DEVICE_TYPE>());
vendor_id = static_cast<uint32_t>(device.getInfo<CL_DEVICE_VENDOR_ID>());
supports_usm = extensions.find("cl_intel_unified_shared_memory") != std::string::npos;
}
} // namespace gpu
} // namespace cldnn
| [
"alexey.suhov@intel.com"
] | alexey.suhov@intel.com |
e5828a328b499cde56d965edd419a15b913dcf91 | 38118fa82847f484ee3fb4eb71a59f530e385a47 | /examples/26-occlusion/occlusion.cpp | d0149838d36edc6a26128261a11b056c27253483 | [
"BSD-2-Clause",
"LicenseRef-scancode-free-unknown",
"MIT"
] | permissive | wayveai/bgfx | f0a089bf138d95015b06417f388a60ee7c9df2d0 | 4c61c4b825060ac1750a125f44ff0765da7f6f5c | refs/heads/master | 2023-08-30T13:58:16.839209 | 2023-08-22T15:08:39 | 2023-08-22T15:08:39 | 166,040,894 | 3 | 0 | BSD-2-Clause | 2019-05-28T13:09:43 | 2019-01-16T13:00:35 | C++ | UTF-8 | C++ | false | false | 7,945 | cpp | /*
* Copyright 2011-2022 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
*/
#include "common.h"
#include "bgfx_utils.h"
#include "camera.h"
#include "imgui/imgui.h"
namespace
{
#define CUBES_DIM 10
struct PosColorVertex
{
float m_x;
float m_y;
float m_z;
uint32_t m_abgr;
static void init()
{
ms_layout
.begin()
.add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float)
.add(bgfx::Attrib::Color0, 4, bgfx::AttribType::Uint8, true)
.end();
};
static bgfx::VertexLayout ms_layout;
};
bgfx::VertexLayout PosColorVertex::ms_layout;
static PosColorVertex s_cubeVertices[8] =
{
{-1.0f, 1.0f, 1.0f, 0xff000000 },
{ 1.0f, 1.0f, 1.0f, 0xff0000ff },
{-1.0f, -1.0f, 1.0f, 0xff00ff00 },
{ 1.0f, -1.0f, 1.0f, 0xff00ffff },
{-1.0f, 1.0f, -1.0f, 0xffff0000 },
{ 1.0f, 1.0f, -1.0f, 0xffff00ff },
{-1.0f, -1.0f, -1.0f, 0xffffff00 },
{ 1.0f, -1.0f, -1.0f, 0xffffffff },
};
static const uint16_t s_cubeIndices[36] =
{
0, 1, 2, // 0
1, 3, 2,
4, 6, 5, // 2
5, 6, 7,
0, 2, 4, // 4
4, 2, 6,
1, 5, 3, // 6
5, 7, 3,
0, 4, 1, // 8
4, 5, 1,
2, 3, 6, // 10
6, 3, 7,
};
class ExampleOcclusion : public entry::AppI
{
public:
ExampleOcclusion(const char* _name, const char* _description, const char* _url)
: entry::AppI(_name, _description, _url)
{
}
void init(int32_t _argc, const char* const* _argv, uint32_t _width, uint32_t _height) override
{
Args args(_argc, _argv);
m_width = _width;
m_height = _height;
m_debug = BGFX_DEBUG_TEXT;
m_reset = BGFX_RESET_VSYNC;
bgfx::Init init;
init.type = args.m_type;
init.vendorId = args.m_pciId;
init.platformData.nwh = entry::getNativeWindowHandle(entry::kDefaultWindowHandle);
init.platformData.ndt = entry::getNativeDisplayHandle();
init.resolution.width = m_width;
init.resolution.height = m_height;
init.resolution.reset = m_reset;
bgfx::init(init);
// Enable debug text.
bgfx::setDebug(m_debug);
// Set view 0 clear state.
bgfx::setViewClear(0
, BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH
, 0x303030ff
, 1.0f
, 0
);
bgfx::setViewClear(2
, BGFX_CLEAR_COLOR|BGFX_CLEAR_DEPTH
, 0x202020ff
, 1.0f
, 0
);
// Create vertex stream declaration.
PosColorVertex::init();
// Create static vertex buffer.
m_vbh = bgfx::createVertexBuffer(
// Static data can be passed with bgfx::makeRef
bgfx::makeRef(s_cubeVertices, sizeof(s_cubeVertices) )
, PosColorVertex::ms_layout
);
// Create static index buffer.
m_ibh = bgfx::createIndexBuffer(
// Static data can be passed with bgfx::makeRef
bgfx::makeRef(s_cubeIndices, sizeof(s_cubeIndices) )
);
// Create program from shaders.
m_program = loadProgram("vs_cubes", "fs_cubes");
const bgfx::Caps* caps = bgfx::getCaps();
m_occlusionQuerySupported = !!(caps->supported & BGFX_CAPS_OCCLUSION_QUERY);
if (m_occlusionQuerySupported)
{
for (uint32_t ii = 0; ii < BX_COUNTOF(m_occlusionQueries); ++ii)
{
m_occlusionQueries[ii] = bgfx::createOcclusionQuery();
}
}
cameraCreate();
cameraSetPosition({ 15.5f, 0.0f, -15.5f });
cameraSetHorizontalAngle(bx::toRad(-45.0f) );
m_timeOffset = bx::getHPCounter();
imguiCreate();
}
virtual int shutdown() override
{
imguiDestroy();
// Cleanup.
cameraDestroy();
if (m_occlusionQuerySupported)
{
for (uint32_t ii = 0; ii < BX_COUNTOF(m_occlusionQueries); ++ii)
{
bgfx::destroy(m_occlusionQueries[ii]);
}
}
bgfx::destroy(m_ibh);
bgfx::destroy(m_vbh);
bgfx::destroy(m_program);
// Shutdown bgfx.
bgfx::shutdown();
return 0;
}
bool update() override
{
if (!entry::processEvents(m_width, m_height, m_debug, m_reset, &m_mouseState) )
{
imguiBeginFrame(m_mouseState.m_mx
, m_mouseState.m_my
, (m_mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
| (m_mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
| (m_mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0)
, m_mouseState.m_mz
, uint16_t(m_width)
, uint16_t(m_height)
);
showExampleDialog(this
, !m_occlusionQuerySupported
? "Occlusion query is not supported."
: NULL
);
imguiEndFrame();
if (m_occlusionQuerySupported)
{
int64_t now = bx::getHPCounter();
static int64_t last = now;
const int64_t frameTime = now - last;
last = now;
const double freq = double(bx::getHPFrequency() );
const float time = (float)( (now-m_timeOffset)/double(bx::getHPFrequency() ) );
const float deltaTime = float(frameTime/freq);
// Update camera.
cameraUpdate(deltaTime, m_state.m_mouse, ImGui::MouseOverArea() );
float view[16];
cameraGetViewMtx(view);
// Set view and projection matrix for view 0.
{
float proj[16];
bx::mtxProj(proj, 90.0f, float(m_width)/float(m_height), 0.1f, 10000.0f, bgfx::getCaps()->homogeneousDepth);
bgfx::setViewTransform(0, view, proj);
bgfx::setViewRect(0, 0, 0, uint16_t(m_width), uint16_t(m_height) );
bgfx::setViewTransform(1, view, proj);
bgfx::setViewRect(1, 0, 0, uint16_t(m_width), uint16_t(m_height) );
const bx::Vec3 at = { 0.0f, 0.0f, 0.0f };
const bx::Vec3 eye = { 17.5f, 10.0f, -17.5f };
bx::mtxLookAt(view, eye, at);
bgfx::setViewTransform(2, view, proj);
bgfx::setViewRect(2, 10, uint16_t(m_height - m_height/4 - 10), uint16_t(m_width/4), uint16_t(m_height/4) );
}
bgfx::touch(0);
bgfx::touch(2);
uint8_t img[CUBES_DIM*CUBES_DIM*2];
for (uint32_t yy = 0; yy < CUBES_DIM; ++yy)
{
for (uint32_t xx = 0; xx < CUBES_DIM; ++xx)
{
float mtx[16];
bx::mtxRotateXY(mtx, time + xx*0.21f, time + yy*0.37f);
mtx[12] = -(CUBES_DIM-1) * 3.0f / 2.0f + float(xx)*3.0f;
mtx[13] = 0.0f;
mtx[14] = -(CUBES_DIM-1) * 3.0f / 2.0f + float(yy)*3.0f;
bgfx::OcclusionQueryHandle occlusionQuery = m_occlusionQueries[yy*CUBES_DIM+xx];
bgfx::setTransform(mtx);
bgfx::setVertexBuffer(0, m_vbh);
bgfx::setIndexBuffer(m_ibh);
bgfx::setCondition(occlusionQuery, true);
bgfx::setState(BGFX_STATE_DEFAULT);
bgfx::submit(0, m_program);
bgfx::setTransform(mtx);
bgfx::setVertexBuffer(0, m_vbh);
bgfx::setIndexBuffer(m_ibh);
bgfx::setState(0
| BGFX_STATE_DEPTH_TEST_LEQUAL
| BGFX_STATE_CULL_CW
);
bgfx::submit(1, m_program, occlusionQuery);
bgfx::setTransform(mtx);
bgfx::setVertexBuffer(0, m_vbh);
bgfx::setIndexBuffer(m_ibh);
bgfx::setCondition(occlusionQuery, true);
bgfx::setState(BGFX_STATE_DEFAULT);
bgfx::submit(2, m_program);
img[(yy*CUBES_DIM+xx)*2+0] = " \xfex"[bgfx::getResult(occlusionQuery)];
img[(yy*CUBES_DIM+xx)*2+1] = 0xf;
}
}
for (uint16_t xx = 0; xx < CUBES_DIM; ++xx)
{
bgfx::dbgTextImage(5 + xx*2, 20, 1, CUBES_DIM, img + xx*2, CUBES_DIM*2);
}
int32_t numPixels = 0;
bgfx::getResult(m_occlusionQueries[0], &numPixels);
bgfx::dbgTextPrintf(5, 20 + CUBES_DIM + 1, 0xf, "Passing pixels count: %d", numPixels);
}
// Advance to next frame. Rendering thread will be kicked to
// process submitted rendering primitives.
bgfx::frame();
return true;
}
return false;
}
entry::MouseState m_mouseState;
uint32_t m_width;
uint32_t m_height;
uint32_t m_debug;
uint32_t m_reset;
bgfx::VertexBufferHandle m_vbh;
bgfx::IndexBufferHandle m_ibh;
bgfx::ProgramHandle m_program;
int64_t m_timeOffset;
bool m_occlusionQuerySupported;
bgfx::OcclusionQueryHandle m_occlusionQueries[CUBES_DIM*CUBES_DIM];
entry::WindowState m_state;
};
} // namespace
ENTRY_IMPLEMENT_MAIN(
ExampleOcclusion
, "26-occlusion"
, "Using occlusion query for conditional rendering."
, "https://bkaradzic.github.io/bgfx/examples.html#occlusion"
);
| [
"branimirkaradzic@gmail.com"
] | branimirkaradzic@gmail.com |
1f2ecc14e836d1e6cb1898d18859ad92f756e188 | 4352b5c9e6719d762e6a80e7a7799630d819bca3 | /tutorials/oldd/box/4.3e-05/p | 1da96f856a5203ed615452d5bb9ce27fb06d8a53 | [] | no_license | dashqua/epicProject | d6214b57c545110d08ad053e68bc095f1d4dc725 | 54afca50a61c20c541ef43e3d96408ef72f0bcbc | refs/heads/master | 2022-02-28T17:20:20.291864 | 2019-10-28T13:33:16 | 2019-10-28T13:33:16 | 184,294,390 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 21,957 | /*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 6
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "4.3e-05";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField nonuniform List<scalar>
2370
(
1.18816
2.64298
3.6377
-0.0204223
0.765348
0.771182
0.962726
1.03366
0.759172
0.727217
-0.655159
0.624531
-1.66787
0.822124
-1.17948
-0.891976
-3.00846
-1.80415
0.497188
0.600904
0.682057
-0.856649
1.56148
-2.01913
-0.716554
-0.353369
1.23364
0.33271
-4.75234
-1.27226
-2.45705
1.79455
1.15685
0.0689388
0.655928
0.820711
0.133571
0.27582
-0.423985
0.0919768
0.364615
-0.451464
-0.140437
-0.476894
0.963835
0.134216
0.99327
0.150851
-0.419394
1.9913
0.344049
0.652429
1.67882
-0.44866
-0.100963
1.22514
0.687254
0.721418
0.304447
-0.27993
-0.339693
0.950399
0.280991
0.693182
1.46389
0.868746
1.07786
0.0744149
1.13233
0.078511
1.14909
0.942008
1.32306
1.66883
1.06217
0.360779
0.511397
0.448188
0.289058
1.60983
1.59343
0.860894
1.14788
2.15914
0.227648
0.619597
0.22129
1.25723
0.586353
0.60905
0.723989
1.32622
0.828006
1.2614
0.604011
-0.170393
0.612926
0.799587
1.01516
0.537577
1.78078
0.663517
0.696171
0.957344
1.69309
0.948741
-0.512332
0.928748
1.06236
0.961907
0.385398
0.324724
0.861924
0.474756
1.27882
0.263902
0.424576
0.729802
0.259074
1.08433
0.567553
0.380593
0.302833
0.924884
0.450844
-0.937302
0.33274
0.317138
0.478283
0.293845
0.358704
1.47484
0.474483
0.492894
1.30811
1.85883
0.314123
0.737475
1.44143
0.550712
-0.00450904
0.398786
-0.805751
0.427905
0.649985
0.23602
0.1277
0.513005
0.423371
0.365773
0.420782
0.734988
0.730016
0.602054
0.976053
0.907518
-7.44383
1.80331
1.2287
-5.50438
0.775148
-2.24149
-0.417796
0.168512
0.492888
0.341873
-0.154735
-0.0863435
-0.100518
0.175624
-0.218248
-0.173554
-0.173919
-0.142324
-0.262789
0.236985
1.71763
-1.24107
-1.56131
1.00081
0.875394
-0.818276
0.7676
-0.999346
0.533239
-1.64172
-2.15447
0.674827
0.107426
0.264394
-0.987131
-1.06119
0.297245
-1.25667
-0.765118
0.532899
0.76696
-0.866886
-1.21994
2.40174
0.276665
1.18788
-1.74687
-1.58563
0.758046
-3.36477
-2.16057
-2.26646
-1.35589
0.118
0.961016
3.06258
0.0610938
-1.58152
-1.45682
2.5791
2.23308
3.00947
-0.864466
4.79253
2.04137
3.84354
4.56419
2.09917
10.8206
3.91006
3.73214
3.43226
2.77246
3.75569
7.96612
10.6671
4.49722
10.4498
6.09666
3.66572
8.63432
8.23891
7.13476
5.7586
8.10328
3.63272
6.14725
7.83249
4.55557
6.10652
20.5538
1.61818
5.42256
2.17127
4.87798
5.30566
2.72097
8.37806
3.34655
3.01232
5.86741
5.97432
3.95409
7.60041
4.44198
4.22644
3.43304
10.3403
3.01521
5.74701
4.77395
6.47704
5.15659
4.32776
4.75371
4.19186
3.20288
4.97528
6.41504
3.80173
10.2158
8.00586
6.59828
12.6243
12.3955
13.5767
7.74302
2.76284
4.31998
8.14857
19.4928
8.33789
8.39765
19.9134
14.6859
7.52264
11.6902
20.8551
7.02646
7.33858
5.99922
6.15004
22.1234
12.6395
9.08334
15.2282
13.0493
9.03223
8.9686
4.18456
15.2116
4.56352
12.8697
2.34462
6.58308
6.51474
9.04486
10.9154
11.2791
9.3498
0.298178
12.1137
3.9584
4.17886
4.8872
5.20733
2.07698
4.10323
4.65735
5.81638
12.8197
4.95567
3.2941
2.09658
8.68478
6.71255
9.13818
4.51515
4.4222
10.8916
8.20011
8.03999
0.454738
3.65613
2.25384
7.91132
4.65016
6.34925
6.47879
4.4329
8.20549
3.44289
8.36881
5.31206
-0.949909
8.83933
10.6147
6.24014
0.0185486
0.549643
0.397882
4.07666
0.298706
6.34243
3.44531
5.09544
0.148546
9.41869
3.19925
10.6533
4.32579
2.6539
0.414863
6.27509
8.12974
0.0109691
8.44127
3.78932
5.98863
2.61746
2.74965
0.16047
8.56483
7.76363
8.45228
0.206455
5.33747
4.20747
6.12456
10.2478
5.65221
6.05417
3.13165
0.211276
-0.0889764
2.97676
4.21488
4.39478
4.93344
3.90945
8.05666
3.20223
0.272632
5.54273
-0.463116
0.229588
14.0503
-0.260915
5.26062
11.8654
7.96655
5.06185
5.85879
10.2168
6.14726
5.0447
3.5484
4.32862
10.4142
4.21968
0.166191
0.0170338
0.329946
3.81601
0.0849049
8.14956
7.6935
1.69916
0.218213
6.61806
0.323775
2.81358
4.59443
0.131807
7.31994
2.72196
2.82977
5.81446
0.259663
4.55641
4.01804
-0.602503
6.95492
3.8099
0.0104452
5.9518
6.88948
-0.327857
6.71477
3.81656
7.89881
3.45536
0.57654
2.12287
0.355766
4.24322
-0.192301
3.64654
9.73616
5.05868
8.64858
4.4455
7.11446
-0.382203
0.268205
-0.0306432
14.7431
2.80106
0.102927
5.04563
2.66012
3.38661
5.16091
2.26952
3.4636
-1.73081
3.16854
7.85387
4.54665
1.29761
0.683174
0.476488
8.3319
1.90999
0.0161316
4.23352
4.95044
-0.501086
4.20278
6.9174
3.30505
0.677146
4.54251
5.06577
5.95623
0.52621
0.861233
3.69051
5.11945
7.56067
2.52833
6.53913
0.316912
0.191935
3.75218
5.53249
5.12625
9.0263
8.27495
8.58245
4.33972
5.51352
5.76043
5.5213
4.47076
4.0657
4.23674
0.413963
2.65816
7.74667
7.73792
2.4571
-0.0695768
-0.187973
0.129373
-0.807182
0.535002
4.60979
0.379934
3.97841
6.20138
5.73069
4.01357
5.74316
1.77132
5.45173
6.00114
5.22006
0.302013
2.13002
5.56337
2.43817
1.91272
0.820094
3.47553
3.4132
0.34857
0.513244
6.8706
7.77571
0.0330553
-0.0256156
0.0419344
2.96793
0.428956
5.08552
4.78878
4.50346
0.704797
5.78983
-0.225484
0.250653
2.95916
4.95641
0.0977418
0.213857
0.703496
0.177283
3.06756
5.57123
5.08686
4.92549
7.02626
2.95602
0.382616
1.97406
4.18154
2.00428
5.99962
0.0192604
7.28696
5.65502
2.55898
3.05529
0.258868
6.43152
3.30031
2.63649
4.2213
4.03795
3.26911
3.60351
0.395794
0.257893
0.401403
4.646
4.28777
5.69186
5.24168
2.06435
2.28051
3.38695
3.53091
0.330428
0.306461
3.90454
2.92989
-0.983122
2.06774
0.199123
3.71687
0.262938
2.75839
3.08139
4.33839
4.17546
0.609934
1.79182
2.3705
0.241188
7.41652
6.93073
8.31826
4.51018
3.8371
2.62713
9.69943
-0.0691234
4.42702
0.550303
4.04431
4.0101
4.22717
3.89873
0.479056
3.49464
0.140591
-0.448359
3.66934
0.449686
10.4846
15.9083
5.95411
0.115734
0.179996
1.83705
10.5588
9.14874
5.71895
5.72715
6.51368
4.28805
8.56516
6.9522
4.39042
6.04691
3.59492
4.7697
7.8567
2.37527
3.52601
3.36808
4.67113
4.15321
7.10944
3.65625
10.8927
-0.81119
15.3203
6.24407
6.53491
4.60035
3.13098
0.204454
0.55922
3.34438
5.33208
0.121135
6.41943
3.12167
7.36241
1.88425
2.35221
3.29171
5.55053
4.24204
5.779
2.62367
0.242149
3.63637
5.46963
4.39433
3.49845
0.208428
3.46474
2.56848
4.34666
4.97572
5.502
6.50984
-0.0276188
0.468066
8.76794
8.89357
4.04019
5.87254
3.80613
8.90461
-0.116879
0.00883244
5.55168
5.43282
0.678842
6.13139
0.531736
3.69255
1.04015
3.58445
4.18628
5.46633
5.71846
2.95515
9.07365
2.65076
6.36007
5.97574
-0.0904284
4.18693
2.86618
0.256297
5.52314
4.66834
6.58666
0.377112
8.57922
4.91438
0.0720666
0.493774
3.91695
6.40975
-0.571487
7.08248
4.69622
6.57344
4.93463
1.88108
2.74717
2.26809
1.72151
3.26532
2.17978
3.3161
4.31654
6.9284
6.92425
4.0218
-0.0207617
4.87772
0.518209
6.86747
3.39766
3.11553
5.88132
2.861
2.9361
5.91319
2.6846
5.72599
3.6119
3.20189
0.277464
4.35694
5.14374
4.87541
11.7814
5.13162
0.62471
5.52299
0.494124
0.157493
6.6089
5.55923
5.59956
5.85569
0.276214
4.35136
3.1354
3.15214
0.537849
5.85626
0.269099
4.76531
4.85515
6.33905
2.30508
0.897919
3.43024
5.52912
2.30295
5.06717
4.58922
2.79519
0.906124
1.07759
8.39372
3.05548
5.82631
2.77275
3.50201
3.2144
5.60815
4.89586
4.1463
4.95972
3.95795
4.55933
4.63072
3.66015
0.746082
6.41572
9.9917
3.63119
4.18529
3.46932
5.16081
3.64955
-0.19082
3.07533
5.56424
6.34555
4.49786
2.87898
4.54463
3.95096
2.60255
0.329684
3.46382
1.46753
2.4335
5.72931
6.29525
3.65534
0.0734629
0.17777
6.79736
5.04336
4.30976
1.15879
2.61012
3.7335
5.66338
5.69378
0.652886
5.34974
4.10412
5.99216
-0.640474
6.76892
2.567
5.66402
3.07505
4.83062
0.458844
4.22268
0.0617529
7.5807
0.831718
3.44297
8.69667
4.17653
3.95344
8.72837
6.84346
7.06183
0.218446
0.963691
-0.123246
7.63306
2.07377
0.360092
3.80806
4.24112
6.29343
9.33067
4.23682
9.0054
4.93031
0.236915
5.00641
2.47312
7.4192
5.70464
7.92778
2.21846
3.26543
8.88352
4.40186
4.1996
5.44611
7.80055
3.70756
5.37059
5.34209
4.09931
5.38445
-0.0615585
3.63472
5.89117
4.132
7.91307
6.49264
6.10167
4.23873
3.12142
1.79557
8.81969
4.36142
11.5047
13.1176
8.14998
5.15911
4.89978
1.18305
2.52355
3.57936
6.0642
7.77268
4.16453
3.01745
0.119475
7.83824
8.70934
3.66693
0.206705
7.6444
2.51548
1.42385
-0.0245323
5.69155
3.32869
6.43105
0.279506
2.59096
3.28159
5.00547
5.37756
0.518978
5.13998
6.79729
5.2445
6.1678
7.42017
5.36422
10.0766
5.26524
3.58981
3.00549
2.74769
5.80269
2.44322
6.80702
7.22122
3.36753
4.02957
3.57212
4.59115
5.46443
9.35091
2.53145
2.39303
4.76883
6.34352
4.44606
4.21626
5.27888
3.52463
2.56603
0.429662
3.64415
2.53296
0.455731
0.223711
0.306527
7.08053
0.262169
6.46909
6.80869
5.62406
4.71046
7.80644
5.79625
6.19498
4.41386
4.76452
4.04139
2.66537
-0.0704025
8.49283
3.32919
0.256815
0.823478
10.8746
5.46605
-0.784143
0.630679
3.07525
2.11365
3.91959
2.59291
6.46351
6.45046
0.0485169
9.87665
5.18328
4.24121
6.33802
2.29792
4.61067
0.293874
4.8253
3.923
4.1661
6.83512
2.44458
5.82236
6.28884
3.35798
1.79282
5.30124
2.28936
2.48202
0.738866
2.4793
10.3245
9.42815
3.92039
6.11331
3.41099
2.0482
5.53817
8.396
3.47619
0.442821
-0.734154
7.22234
5.42403
3.51766
3.84541
4.75706
3.55163
3.3369
8.53855
12.7835
11.9938
0.488595
-1.06765
5.25817
0.306586
4.66127
-0.0625705
10.9659
0.816079
0.848408
0.812987
9.78551
5.8773
2.74148
9.13243
4.66801
3.55386
2.56727
2.3523
2.7503
2.69067
6.35837
3.90503
11.6764
15.0183
2.54635
2.57517
3.45461
7.10587
2.25432
2.27685
0.457857
6.45958
5.39051
6.64543
5.80856
4.54172
0.517212
0.377541
2.3068
2.31951
1.87381
0.752167
5.3719
5.01275
6.35837
6.36847
0.808938
14.754
2.39831
4.91092
2.13983
6.10396
16.3793
4.24494
5.02209
4.50985
8.80348
6.58783
4.36513
2.90777
4.42675
10.0751
0.569802
9.67664
3.65995
4.38795
2.28494
6.35732
6.81556
4.72746
3.47732
10.2838
12.7039
3.19831
6.93259
3.54874
2.49093
9.69668
5.64859
1.31423
7.37732
7.15015
3.54899
1.60917
1.85821
2.97766
5.15422
4.61104
0.785169
2.90306
1.38451
3.50544
3.14986
3.87704
3.44556
3.81709
5.0401
5.93911
6.76191
5.07141
4.48437
3.04004
6.17412
0.347973
4.24464
3.21977
9.47379
9.19208
3.62587
6.75972
5.60524
0.576489
0.0314504
7.75794
2.43301
5.52823
3.55444
4.55493
5.20391
7.89686
10.0788
4.74522
5.72295
4.55789
6.00119
6.35729
2.39391
3.51257
6.23304
4.93667
8.98569
2.28577
8.05226
5.09538
0.369937
0.225861
4.66417
5.22724
6.10267
12.7517
1.66306
4.16192
8.65756
7.8506
3.85177
5.34741
0.0912424
3.64184
-0.521309
4.16969
3.11697
3.46656
5.49013
7.6701
2.51089
3.992
2.4063
0.888563
5.03895
6.24013
3.72364
3.79865
6.51446
3.70429
-0.472398
3.13182
4.67022
0.591582
4.60534
10.7646
7.81643
5.11903
8.61206
5.25886
5.14342
6.3063
8.08476
3.07036
3.26297
4.36718
4.79934
6.81803
2.94806
4.87786
9.57956
-0.0257527
9.64565
3.24963
4.99502
3.74996
5.36714
5.7034
2.5551
6.91791
12.5944
3.11992
0.0571028
7.63135
3.87809
6.44852
5.81902
5.60811
3.74577
3.24077
5.7455
0.448786
3.49422
5.21758
4.22753
3.38767
4.72981
11.0143
3.41499
8.05758
1.96635
3.98936
1.7004
3.60653
9.85759
8.39343
5.17554
7.47842
2.77233
4.03894
2.46521
4.63186
2.09156
0.745967
6.84714
4.4371
2.24679
9.81795
0.726079
7.86163
3.61094
4.89984
18.5652
6.65117
8.20969
3.73111
4.3532
0.842564
0.849169
9.25083
6.02935
3.63366
3.52984
1.97591
4.52753
3.72023
8.20068
20.4045
20.834
18.4331
17.7061
8.08125
7.81823
10.678
16.5972
3.58847
3.01208
4.21938
4.31424
4.52231
3.65334
4.81454
10.8031
23.6266
3.48981
2.30888
4.21622
10.8469
4.84386
20.053
16.4686
4.9539
12.6256
3.25537
0.12556
3.01005
1.92775
4.10873
0.179499
3.37751
24.0853
3.83942
8.48387
4.15139
7.67975
7.37267
6.86523
9.87021
6.27411
8.35136
9.97539
2.005
10.1859
5.85787
8.51637
5.10644
4.31238
7.60383
9.30425
3.86631
7.76436
0.197171
3.49959
2.79202
2.43684
1.62019
6.74624
13.2017
3.27594
5.92389
7.36858
5.62455
6.78486
10.615
10.511
8.99208
6.00296
5.79263
0.924703
6.71256
1.9042
5.67965
7.97783
1.87536
2.87518
6.56127
8.76395
17.6487
0.379406
6.19077
7.98239
4.57283
18.0959
3.52346
4.37862
5.80377
4.23495
2.03957
2.31303
2.16273
3.23935
1.60296
12.4145
8.59341
3.0327
4.65314
1.79159
4.01596
8.86813
8.39187
3.13788
7.31466
4.52097
2.15811
5.03982
2.19954
1.7475
0.437149
6.34195
7.08728
0.292905
8.36105
0.294059
4.27722
5.03633
2.97504
4.4146
3.28675
4.10706
6.1111
4.8334
5.26145
2.74407
7.55156
5.76565
3.34729
11.2759
4.08526
3.72069
1.66396
8.0676
4.04617
5.68
8.40259
7.71397
3.65004
3.44996
9.25649
13.1447
1.9515
2.76817
3.81657
3.97861
5.23272
10.3662
4.77066
10.1835
4.19077
7.85303
8.8401
8.70223
19.3908
16.9843
17.0133
-0.023272
0.420945
-4.24633
-3.08392
-1.40553
-0.692181
0.746242
-0.412683
0.273132
0.816151
-2.19475
-1.53137
-0.492639
-0.973411
-1.69488
0.977018
-0.305454
-1.06468
0.0286508
0.440376
-0.295561
0.0690316
0.49496
-0.19403
1.25943
-0.922431
-1.56806
-0.0850962
0.404412
0.322776
-0.545888
-1.07027
0.651724
-1.04755
0.636954
-1.71783
-0.19769
4.34503
1.96895
1.53791
3.17709
2.59474
-4.57754
2.25132
3.12974
3.85338
2.16029
6.25465
4.00933
2.66479
2.25997
4.6068
3.06118
1.98058
10.0098
2.72512
4.53491
6.22044
2.22041
2.81159
4.95927
5.16156
7.28957
4.82354
3.68526
5.37159
5.14375
5.527
2.08802
4.19137
3.94939
6.06144
5.57813
2.99416
3.68491
3.89293
2.75565
2.44473
5.55215
5.38597
3.11802
4.47568
3.31431
3.08153
4.59033
4.08946
3.67686
6.38282
2.41163
6.4935
1.6676
2.62552
5.33691
3.80913
11.6385
2.56412
3.24849
4.73107
2.38679
7.09395
3.29844
3.1227
3.12454
4.38937
4.22829
3.32741
4.94563
4.06292
6.89898
8.15627
10.7826
6.75407
4.85093
5.73248
4.97672
8.07398
7.33705
7.98965
1.93598
1.96542
2.11438
5.16596
3.60015
1.51673
3.36972
3.52931
3.34441
2.39018
2.1754
4.34322
4.69377
3.28369
1.79547
6.05264
2.95494
5.37964
3.70872
11.7436
11.1737
13.0937
2.96188
4.13623
4.25704
3.74401
3.58764
2.93235
3.14657
1.60873
3.09946
3.97977
3.41432
4.13305
2.63959
2.23216
4.77741
6.07283
2.65707
5.14663
1.88323
4.99493
3.56494
2.29095
3.75683
4.15066
5.57603
7.07287
2.54762
3.8972
2.56555
5.04007
3.5327
5.39465
2.59499
3.52035
4.87228
4.02643
4.99355
3.61799
6.83157
8.84077
4.65224
4.3945
4.42126
8.11969
8.88744
3.89699
2.46407
5.98728
6.59117
4.95804
6.21454
3.73594
6.29901
6.59208
3.1423
2.54972
5.37585
3.29427
4.03536
3.13134
4.07247
6.50771
5.26855
5.89323
3.46009
8.42459
6.49626
4.10875
1.88966
11.2105
3.12351
3.60453
2.95412
5.99804
5.20915
5.82297
6.89427
7.63931
4.71051
5.98867
6.74408
2.57363
7.5337
4.7747
3.43326
3.32171
3.5445
1.72886
-1.00161
3.43674
2.10889
3.94296
5.25315
3.34341
3.20116
7.98885
4.54438
8.46864
15.046
4.15798
13.8985
7.25306
4.60179
8.59439
6.13965
3.15306
4.15604
2.57222
4.16179
6.11024
4.00844
6.21816
6.81017
7.46544
4.41636
4.60929
2.82746
2.44676
9.85718
6.85822
4.44328
4.98714
6.96932
2.41851
6.36042
4.85734
2.25784
4.26983
11.3043
3.9405
3.81785
5.13771
5.36674
3.67411
2.57216
7.60376
2.66415
2.17147
1.50402
2.92499
5.08166
4.30024
3.34553
2.30561
20.1426
1.37235
6.76508
3.304
17.54
4.08949
2.57331
5.31904
3.97798
2.06755
3.40151
3.18135
3.77343
3.16579
7.32604
5.08199
2.72896
3.9727
5.05154
1.58502
2.58356
4.43372
5.30089
2.69306
4.57824
1.65924
2.32345
2.9837
3.54678
6.93939
5.63792
7.48272
2.93108
2.54457
1.89895
2.79736
3.88683
6.44782
4.81079
5.52639
1.91496
4.91654
5.30557
2.25243
6.71215
2.7921
3.79104
3.85198
7.22404
6.98023
3.70622
2.44236
4.28416
3.25155
3.29464
2.8678
6.89758
2.99155
4.21611
3.58747
6.21635
2.85954
6.62665
2.17635
3.78065
3.78965
2.11079
2.272
6.36075
5.78477
1.75372
3.48304
4.35303
3.63661
5.45159
2.87398
2.34895
2.79437
3.10818
4.43419
1.52032
4.39349
5.60546
3.49627
2.27432
2.10819
5.12435
5.21104
8.85576
4.22109
4.30309
3.52993
8.8573
3.9113
4.35021
3.0635
3.72211
4.81337
4.73938
6.39486
1.85728
2.59417
5.1542
3.46965
5.65204
2.50334
3.14582
2.67029
2.88193
3.22564
2.14242
3.96705
1.82476
1.78091
3.16935
5.42254
3.76326
5.39579
3.59455
4.5871
3.95134
2.39085
1.41189
5.94737
6.97235
4.77586
6.64916
3.67287
6.46562
3.97925
0.288482
6.53089
1.02907
3.56875
4.30282
6.16373
4.32255
3.54195
4.91742
2.32974
3.04558
4.01107
1.90237
8.33416
2.97761
7.55649
3.34346
2.70236
2.95891
0.389026
18.8929
21.2453
6.13426
22.6093
6.44952
9.26252
8.2533
2.40676
6.58984
5.47669
1.73969
5.72915
3.11606
4.39444
3.89735
1.09754
3.15648
2.75387
2.72085
0.794896
3.88262
3.61466
1.23531
3.42717
3.6432
4.49769
4.76146
1.29741
5.416
5.28232
1.7255
5.04801
6.33553
7.80122
7.88221
2.74557
8.44759
8.69482
2.84499
8.03291
9.42755
9.89436
10.2022
1.93547
6.84342
4.76985
1.67851
5.6416
5.61653
6.51582
7.55547
2.05101
11.6803
13.373
3.49023
11.3484
1.55318
5.29644
9.11173
9.13204
16.8894
3.52503
6.37342
3.15453
4.4102
5.04736
8.35617
6.06576
9.91646
4.00722
5.2471
0.208079
3.22038
4.30548
5.89652
-0.0360863
3.41216
5.18996
8.14442
0.171601
4.87071
2.27891
3.10141
-0.131291
1.84103
0.278526
5.09883
6.05567
7.80423
0.36605
3.42155
4.01795
5.1702
-0.229935
-1.34531
1.50165
3.32025
-0.682055
1.13392
-0.108121
12.9241
13.1825
21.2527
5.12229
6.16685
0.600094
4.21339
-0.344123
2.50008
2.65384
4.30776
-0.527315
2.1106
4.40946
6.03633
2.95814
6.11175
3.622
3.69989
0.652581
2.87266
-1.06807
3.23006
3.78557
3.38301
0.833339
3.40589
0.903609
0.301522
2.0248
0.313189
2.34735
2.87436
2.69108
2.95032
1.76967
4.5676
1.7592
3.83399
4.71538
7.34141
1.63627
7.08058
1.66895
5.93989
7.56851
1.35286
4.11259
3.57243
2.85674
-0.492469
1.7379
0.378384
3.27102
4.42132
4.41543
6.1491
1.60639
6.31413
1.60464
6.77484
6.96704
2.85799
1.15126
4.60653
0.464898
4.01683
2.55071
2.34698
2.34057
2.57798
-0.187989
1.85253
-3.72157
5.06933
6.31177
4.51734
1.77385
1.56743
8.4574
1.54844
9.89432
7.29794
5.68539
4.49448
3.89157
0.58006
3.29553
0.560881
2.8216
3.25569
2.87308
2.39477
0.411634
2.02503
-0.458321
1.61214
0.0347336
1.76815
-0.0823641
2.89141
2.43041
6.87071
6.13828
5.68805
1.11511
3.66523
-1.28722
3.40182
0.615831
3.31565
0.564258
4.58325
4.63282
5.66062
6.27482
4.36385
0.885797
4.72624
1.08891
6.87868
9.17863
6.27446
1.06426
6.533
1.50019
4.21918
1.65055
4.64277
6.18158
3.44072
2.51883
0.265737
2.91301
0.333833
2.48293
1.4398
5.2838
1.04646
4.0048
4.37763
3.36068
2.23691
0.65039
2.16208
0.236992
2.20933
1.48649
3.40902
0.995418
3.61078
0.799542
2.62398
4.26577
6.31489
5.82327
1.49024
6.10923
1.47513
5.36277
3.17223
3.98429
2.8528
0.456106
2.99587
0.611343
3.3228
1.20952
3.97974
4.94224
3.50139
0.668585
2.98167
0.654938
4.01919
3.5233
4.63317
4.40011
0.41978
2.99721
0.522744
3.01184
3.3172
0.599654
3.03642
0.473829
2.46911
2.89786
1.04848
4.05371
0.918827
5.22866
5.68513
4.23745
4.3267
1.18023
4.76672
1.17182
4.04732
5.92207
3.41427
3.69041
1.04387
3.79398
-0.549664
2.59214
1.9605
0.291787
2.25113
0.200675
1.88602
2.77114
3.30386
0.807983
3.96123
0.70056
3.01068
3.54382
7.3275
2.29205
4.85117
6.87357
5.24774
1.40098
6.33299
1.5873
5.2174
6.48108
2.30902
3.05239
0.262629
2.12601
-0.7496
1.4258
4.12635
0.969141
5.7812
1.19697
6.18846
6.37147
7.93298
7.83023
1.51644
6.0409
1.85034
6.55585
3.07908
0.755504
2.54058
0.528782
3.61093
3.91559
3.81035
4.72866
3.67883
1.36877
1.96187
6.02744
1.58457
6.13788
8.31023
5.19501
6.07984
6.9859
3.90105
0.267355
4.28462
0.940581
4.88107
0.854074
3.96774
5.71136
6.12039
5.59462
6.89439
1.43805
4.18771
-1.50251
3.11308
3.5698
0.838818
2.97452
-0.292198
1.88723
2.48189
0.36364
2.26539
0.30277
3.10228
3.23841
4.71406
1.21748
4.81012
1.12062
3.50416
5.33402
4.41752
0.91501
4.38608
0.835296
3.26529
4.2435
2.37982
2.66612
0.493938
2.33595
-0.604942
1.69656
0.295307
3.18698
0.398314
2.70129
3.31851
3.66424
5.7894
6.50405
6.13335
1.27121
4.30832
-1.3658
1.51397
0.247059
1.61569
0.305835
2.38266
1.88897
1.49189
6.83008
1.90901
8.52099
9.28752
7.2458
7.31005
2.11147
7.02115
1.52578
5.18485
6.39652
3.49589
3.9563
0.494209
2.95642
-0.80538
1.62733
4.61316
4.42173
3.09207
0.527512
3.63555
0.691621
7.97933
6.01263
5.37551
1.23288
5.64334
1.27664
4.63092
4.20576
0.747883
3.55316
0.777931
3.03131
5.06196
5.49741
3.91817
0.554689
5.2627
0.759196
6.30271
6.35323
1.58845
5.86083
1.7716
8.72037
9.787
8.37975
1.77827
6.78763
)
;
boundaryField
{
emptyPatches_empt
{
type empty;
}
top_cyc
{
type freestreamPressure;
freestreamValue uniform 3;
supersonic false;
value nonuniform List<scalar>
40
(
4.90653
4.51688
6.36879
3.5444
3.07502
2.00876
4.70375
1.79105
2.06928
2.93021
4.77998
3.2414
1.98409
4.09356
3.13225
3.82925
3.95858
3.45717
3.77788
3.68826
3.15969
3.89418
5.80401
1.95818
3.30806
3.25375
4.87256
2.70507
3.49622
3.63218
3.04448
3.15896
3.39976
2.84753
3.87732
3.3233
3.05807
3.67403
3.02857
3.04231
)
;
}
bottom_cyc
{
type freestreamPressure;
freestreamValue uniform 3;
supersonic false;
value nonuniform List<scalar>
40
(
8.14741
10.0624
10.3625
11.8515
6.38848
7.85639
1.05531
3.84167
1.19827
0.831232
5.40222
0.841967
0.805178
7.48897
11.6477
8.43027
5.35315
4.85454
8.92739
5.08755
0.758042
6.02875
6.65557
7.99291
0.629609
7.55556
6.76051
7.15932
12.4628
12.2733
5.1604
5.44757
11.3152
11.4568
5.6787
5.9108
14.2533
14.9761
6.27254
5.72816
)
;
}
inlet_cyc
{
type cyclicAMI;
value nonuniform List<scalar>
30
(
14.2598
11.3428
6.5138
7.78263
5.41595
10.5499
3.58492
2.29402
2.80729
3.81051
4.7471
8.21407
6.49917
2.49185
4.59833
5.48484
5.7897
7.3178
5.52324
6.79291
12.5061
2.48393
7.17126
4.85783
14.6574
15.0017
7.20582
5.16467
5.89565
5.42732
)
;
}
outlet_cyc
{
type cyclicAMI;
value nonuniform List<scalar>
30
(
6.56204
7.73438
5.89565
6.48317
8.23008
3.59065
4.66869
5.35381
5.8589
6.53557
7.84152
2.32436
4.2266
4.7471
7.3178
5.42732
4.88621
3.71079
14.2598
5.48484
11.3428
11.0312
6.79291
4.58324
15.5525
14.1066
3.30454
12.0339
3.81051
2.49185
)
;
}
}
// ************************************************************************* //
| [
"thomasdigiusto@me.com"
] | thomasdigiusto@me.com | |
f0fcee9518280c81a182c8fe207253b392bca4ce | 43d919af20948bf53fb833b06daeb8810051a506 | /TRTHTBLE.CPP | 83071d3731a1ec0cd9f097cfab7ca468706bf521 | [] | no_license | ashcode07/c--begin | 5fef188ef66e77d28f16ab72021b2db28d37b8f7 | 04cbba8bab0b7bc94f28f66ebea891c81004e7f8 | refs/heads/master | 2021-09-27T20:35:50.720653 | 2018-11-11T20:05:38 | 2018-11-11T20:05:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 328 | cpp | //truth table
#include<iostream.h>
#include<conio.h>
void main()
{
int x,y,z;
clrscr();
cout<<"X\tY\tZ\tXY+Z";
for(x=0;x<=1;++x)
for(y=0;y<=1;++y)
for(z=0;z<=1;++z)
{
if(x*y+z==2)
cout<<"\n\n"<<x<<"\t"<<y<<"\t"<<z<<"\t1";
else
cout<<"\n\n"<<x<<"\t"<<y<<"\t"<<z<<"\t"<<x*y+z;
}
getch();
} | [
"noreply@github.com"
] | ashcode07.noreply@github.com |
a8d0962ee7dcaf281eb3578bcac05d3707983283 | 641fa8341d8c436ad24945bcbf8e7d7d1dd7dbb2 | /third_party/WebKit/Source/core/input/ScrollManager.h | db2bd298c3068c70d193d22800141527229eb0fb | [
"BSD-2-Clause",
"LGPL-2.0-only",
"LGPL-2.1-only",
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"GPL-2.0-only",
"LicenseRef-scancode-other-copyleft"
] | permissive | massnetwork/mass-browser | 7de0dfc541cbac00ffa7308541394bac1e945b76 | 67526da9358734698c067b7775be491423884339 | refs/heads/master | 2022-12-07T09:01:31.027715 | 2017-01-19T14:29:18 | 2017-01-19T14:29:18 | 73,799,690 | 4 | 4 | BSD-3-Clause | 2022-11-26T11:53:23 | 2016-11-15T09:49:29 | null | UTF-8 | C++ | false | false | 5,361 | 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 ScrollManager_h
#define ScrollManager_h
#include "core/CoreExport.h"
#include "core/page/EventWithHitTestResults.h"
#include "platform/PlatformEvent.h"
#include "platform/geometry/LayoutSize.h"
#include "platform/heap/Handle.h"
#include "platform/heap/Visitor.h"
#include "platform/scroll/ScrollTypes.h"
#include "public/platform/WebInputEventResult.h"
#include "wtf/Allocator.h"
#include <deque>
namespace blink {
class AutoscrollController;
class FrameHost;
class LayoutBox;
class LayoutObject;
class LocalFrame;
class PaintLayer;
class PaintLayerScrollableArea;
class PlatformGestureEvent;
class Scrollbar;
class ScrollState;
// This class takes care of scrolling and resizing and the related states. The
// user action that causes scrolling or resizing is determined in other *Manager
// classes and they call into this class for doing the work.
class CORE_EXPORT ScrollManager
: public GarbageCollectedFinalized<ScrollManager> {
WTF_MAKE_NONCOPYABLE(ScrollManager);
public:
explicit ScrollManager(LocalFrame*);
DECLARE_TRACE();
void clear();
bool middleClickAutoscrollInProgress() const;
AutoscrollController* autoscrollController() const;
void stopAutoscroll();
// Performs a chaining logical scroll, within a *single* frame, starting
// from either a provided starting node or a default based on the focused or
// most recently clicked node, falling back to the frame.
// Returns true if the scroll was consumed.
// direction - The logical direction to scroll in. This will be converted to
// a physical direction for each LayoutBox we try to scroll
// based on that box's writing mode.
// granularity - The units that the scroll delta parameter is in.
// startNode - Optional. If provided, start chaining from the given node.
// If not, use the current focus or last clicked node.
bool logicalScroll(ScrollDirection,
ScrollGranularity,
Node* startNode,
Node* mousePressNode);
// Performs a logical scroll that chains, crossing frames, starting from
// the given node or a reasonable default (focus/last clicked).
bool bubblingScroll(ScrollDirection,
ScrollGranularity,
Node* startingNode,
Node* mousePressNode);
void setFrameWasScrolledByUser();
// TODO(crbug.com/616491): Consider moving all gesture related functions to
// another class.
// Handle the provided scroll gesture event, propagating down to child frames
// as necessary.
WebInputEventResult handleGestureScrollEvent(const PlatformGestureEvent&);
WebInputEventResult handleGestureScrollEnd(const PlatformGestureEvent&);
bool isScrollbarHandlingGestures() const;
// Returns true if the gesture event should be handled in ScrollManager.
bool canHandleGestureEvent(const GestureEventWithHitTestResults&);
// These functions are related to |m_resizeScrollableArea|.
bool inResizeMode() const;
void resize(const PlatformEvent&);
// Clears |m_resizeScrollableArea|. if |shouldNotBeNull| is true this
// function DCHECKs to make sure that variable is indeed not null.
void clearResizeScrollableArea(bool shouldNotBeNull);
void setResizeScrollableArea(PaintLayer*, IntPoint);
private:
WebInputEventResult handleGestureScrollUpdate(const PlatformGestureEvent&);
WebInputEventResult handleGestureScrollBegin(const PlatformGestureEvent&);
WebInputEventResult passScrollGestureEventToWidget(
const PlatformGestureEvent&,
LayoutObject*);
void clearGestureScrollState();
void customizedScroll(const Node& startNode, ScrollState&);
FrameHost* frameHost() const;
bool isEffectiveRootScroller(const Node&) const;
bool handleScrollGestureOnResizer(Node*, const PlatformGestureEvent&);
void recomputeScrollChain(const Node& startNode,
std::deque<int>& scrollChain);
// NOTE: If adding a new field to this class please ensure that it is
// cleared in |ScrollManager::clear()|.
const Member<LocalFrame> m_frame;
// Only used with the ScrollCustomization runtime enabled feature.
std::deque<int> m_currentScrollChain;
Member<Node> m_scrollGestureHandlingNode;
bool m_lastGestureScrollOverWidget;
// The most recent element to scroll natively during this scroll
// sequence. Null if no native element has scrolled this scroll
// sequence, or if the most recent element to scroll used scroll
// customization.
Member<Node> m_previousGestureScrolledNode;
// True iff some of the delta has been consumed for the current
// scroll sequence in this frame, or any child frames. Only used
// with ScrollCustomization. If some delta has been consumed, a
// scroll which shouldn't propagate can't cause any element to
// scroll other than the |m_previousGestureScrolledNode|.
bool m_deltaConsumedForScrollSequence;
Member<Scrollbar> m_scrollbarHandlingScrollGesture;
Member<PaintLayerScrollableArea> m_resizeScrollableArea;
LayoutSize
m_offsetFromResizeCorner; // In the coords of m_resizeScrollableArea.
};
} // namespace blink
#endif // ScrollManager_h
| [
"xElvis89x@gmail.com"
] | xElvis89x@gmail.com |
b95cf815bae821a5418ddde09c837f67b67aedcc | ecbe5ac6da0ab1da00c7f615353b739ef9a6ff03 | /492A.cpp | 4f63d4ec84704be93e05944c55bac13ffb05255e | [] | no_license | ngthvan1612/Codeforces | 2d1b10f155ba2f0efc6e0fdda7d78bcbd6aad496 | b86c3d3d11df92f9744f75f495ad458ace9418ae | refs/heads/master | 2022-04-01T20:34:48.115083 | 2020-02-01T06:14:13 | 2020-02-01T06:14:13 | 237,571,708 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 209 | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, t = 0, s = 0, i, res;
cin >> n;
for (i = 1;;++i) {
t += i;
s += t;
if (s <= n) res = i;
else break;
}
cout << res;
return 0;
}
| [
"ngthvan1612@gmail.com"
] | ngthvan1612@gmail.com |
d67ab1335cbf5ca8d7c184ee0c862adcaf3b7f0e | aa0083936eff7afc66fdf62cb7f632e5b3f26d20 | /String processing/Boj 12780.cpp | 2fed5a93cf7f0211248c87d4f4d2548c3edb6a26 | [] | no_license | b8goal/Boj | ab31a8e1a414125bb4a0eb243db7dce2dda1ed4a | b7e395191eda01427a6db8a886a5ce3c49b03abf | refs/heads/master | 2022-02-03T13:15:26.904488 | 2021-12-30T11:58:07 | 2021-12-30T11:58:07 | 161,286,778 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 811 | cpp | #define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cmath>
typedef long long ll;
using namespace std;
const int MOD = 9901;
const int INF = 0x7fffffff;
const int MAXN = 300;
int p[1000001], dp[250001];
ll cache[61][61];
int find(int x) { return p[x] ^ x ? find(p[x]) : x; }
void merge(int x, int y) { p[find(y)] = find(x); }
int abs(int x, int y) { return x - y > 0 ? x - y : y - x; }
int gcd(int x, int y) { return y ? gcd(y, x%y) : x; }
int main(void) {
int cnt = 0;
string s1, s2;
cin >> s1 >> s2;
while (1) {
if (s1.find(s2) == string::npos)
break;
else {
s1.erase(s1.find(s2), s2.size());
cnt++;
}
}
cout << cnt << '\n';
return 0;
} | [
"b8goal@naver.com"
] | b8goal@naver.com |
c421b62fd6ea0d001c05e9fb29e9208d7aba95d4 | b6ffa82d277f8e2635556fa4302d7596203237f9 | /jni/boost/libs/wave/test/testwave/testfiles/t_6_053.cpp | f78b030c3d0d6e6890765b8bfa09b1dd2cf7913e | [
"BSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | LeifAndersen/Android-Supertux | 2e66ae3c6a0ffba2f82b35c27130175151bbb1e6 | e188c9d365420bd21eee45da82d6f74215e27516 | refs/heads/master | 2020-04-11T09:57:11.000668 | 2010-09-20T03:34:55 | 2010-09-20T03:34:55 | 867,072 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,288 | cpp | /*=============================================================================
Boost.Wave: A Standard compliant C++ preprocessor library
http://www.boost.org/
Copyright (c) 2001-2005 Hartmut Kaiser. Distributed under the Boost
Software License, Version 1.0. (See accompanying file
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
The tests included in this file were initially taken from the mcpp V2.5
preprocessor validation suite and were modified to fit into the Boost.Wave
unit test requirements.
The original files of the mcpp preprocessor are distributed under the
license reproduced at the end of this file.
=============================================================================*/
// Tests error reporting: #undef errors.
// 29.4: Excessive token sequence.
//E t_6_053.cpp(20): error: ill formed preprocessor directive: #undef
#undef MACRO_0 Junk
/*-
* Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
| [
"onaips@gmail.com"
] | onaips@gmail.com |
3eea429fa6d4974c3e9abfd83f704b7740b08746 | 5c3f6bdd0aa5446a78372c967d5a642c429b8eda | /src/rpc/net.cpp | abab252d89a846850955b89552ca96a746a12064 | [
"MIT"
] | permissive | GlobalBoost/GlobalBoost-Y | defeb2f930222d8b78447a9440d03cce9d8d602c | b4c8f1bb88ebbfa5016376fee9a00ae98902133f | refs/heads/master | 2023-08-11T12:04:12.578240 | 2023-07-11T03:56:18 | 2023-07-11T03:56:18 | 23,804,954 | 20 | 22 | MIT | 2023-07-11T03:56:19 | 2014-09-08T19:26:43 | C++ | UTF-8 | C++ | false | false | 29,985 | cpp | // Copyright (c) 2009-2018 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <rpc/server.h>
#include <chainparams.h>
#include <clientversion.h>
#include <core_io.h>
#include <validation.h>
#include <net.h>
#include <net_processing.h>
#include <netbase.h>
#include <policy/policy.h>
#include <rpc/protocol.h>
#include <sync.h>
#include <timedata.h>
#include <ui_interface.h>
#include <util.h>
#include <utilstrencodings.h>
#include <version.h>
#include <warnings.h>
#include <univalue.h>
static UniValue getconnectioncount(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"getconnectioncount\n"
"\nReturns the number of connections to other nodes.\n"
"\nResult:\n"
"n (numeric) The connection count\n"
"\nExamples:\n"
+ HelpExampleCli("getconnectioncount", "")
+ HelpExampleRpc("getconnectioncount", "")
);
if(!g_connman)
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
return (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL);
}
static UniValue ping(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"ping\n"
"\nRequests that a ping be sent to all other nodes, to measure ping time.\n"
"Results provided in getpeerinfo, pingtime and pingwait fields are decimal seconds.\n"
"Ping command is handled in queue with all other commands, so it measures processing backlog, not just network ping.\n"
"\nExamples:\n"
+ HelpExampleCli("ping", "")
+ HelpExampleRpc("ping", "")
);
if(!g_connman)
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
// Request that each node send a ping during next message processing pass
g_connman->ForEachNode([](CNode* pnode) {
pnode->fPingQueued = true;
});
return NullUniValue;
}
static UniValue getpeerinfo(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"getpeerinfo\n"
"\nReturns data about each connected network node as a json array of objects.\n"
"\nResult:\n"
"[\n"
" {\n"
" \"id\": n, (numeric) Peer index\n"
" \"addr\":\"host:port\", (string) The IP address and port of the peer\n"
" \"addrbind\":\"ip:port\", (string) Bind address of the connection to the peer\n"
" \"addrlocal\":\"ip:port\", (string) Local address as reported by the peer\n"
" \"services\":\"xxxxxxxxxxxxxxxx\", (string) The services offered\n"
" \"relaytxes\":true|false, (boolean) Whether peer has asked us to relay transactions to it\n"
" \"lastsend\": ttt, (numeric) The time in seconds since epoch (Jan 1 1970 GMT) of the last send\n"
" \"lastrecv\": ttt, (numeric) The time in seconds since epoch (Jan 1 1970 GMT) of the last receive\n"
" \"bytessent\": n, (numeric) The total bytes sent\n"
" \"bytesrecv\": n, (numeric) The total bytes received\n"
" \"conntime\": ttt, (numeric) The connection time in seconds since epoch (Jan 1 1970 GMT)\n"
" \"timeoffset\": ttt, (numeric) The time offset in seconds\n"
" \"pingtime\": n, (numeric) ping time (if available)\n"
" \"minping\": n, (numeric) minimum observed ping time (if any at all)\n"
" \"pingwait\": n, (numeric) ping wait (if non-zero)\n"
" \"version\": v, (numeric) The peer version, such as 70001\n"
" \"subver\": \"/Satoshi:0.8.5/\", (string) The string version\n"
" \"inbound\": true|false, (boolean) Inbound (true) or Outbound (false)\n"
" \"addnode\": true|false, (boolean) Whether connection was due to addnode/-connect or if it was an automatic/inbound connection\n"
" \"startingheight\": n, (numeric) The starting height (block) of the peer\n"
" \"banscore\": n, (numeric) The ban score\n"
" \"synced_headers\": n, (numeric) The last header we have in common with this peer\n"
" \"synced_blocks\": n, (numeric) The last block we have in common with this peer\n"
" \"inflight\": [\n"
" n, (numeric) The heights of blocks we're currently asking from this peer\n"
" ...\n"
" ],\n"
" \"whitelisted\": true|false, (boolean) Whether the peer is whitelisted\n"
" \"bytessent_per_msg\": {\n"
" \"addr\": n, (numeric) The total bytes sent aggregated by message type\n"
" ...\n"
" },\n"
" \"bytesrecv_per_msg\": {\n"
" \"addr\": n, (numeric) The total bytes received aggregated by message type\n"
" ...\n"
" }\n"
" }\n"
" ,...\n"
"]\n"
"\nExamples:\n"
+ HelpExampleCli("getpeerinfo", "")
+ HelpExampleRpc("getpeerinfo", "")
);
if(!g_connman)
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
std::vector<CNodeStats> vstats;
g_connman->GetNodeStats(vstats);
UniValue ret(UniValue::VARR);
for (const CNodeStats& stats : vstats) {
UniValue obj(UniValue::VOBJ);
CNodeStateStats statestats;
bool fStateStats = GetNodeStateStats(stats.nodeid, statestats);
obj.pushKV("id", stats.nodeid);
obj.pushKV("addr", stats.addrName);
if (!(stats.addrLocal.empty()))
obj.pushKV("addrlocal", stats.addrLocal);
if (stats.addrBind.IsValid())
obj.pushKV("addrbind", stats.addrBind.ToString());
obj.pushKV("services", strprintf("%016x", stats.nServices));
obj.pushKV("relaytxes", stats.fRelayTxes);
obj.pushKV("lastsend", stats.nLastSend);
obj.pushKV("lastrecv", stats.nLastRecv);
obj.pushKV("bytessent", stats.nSendBytes);
obj.pushKV("bytesrecv", stats.nRecvBytes);
obj.pushKV("conntime", stats.nTimeConnected);
obj.pushKV("timeoffset", stats.nTimeOffset);
if (stats.dPingTime > 0.0)
obj.pushKV("pingtime", stats.dPingTime);
if (stats.dMinPing < static_cast<double>(std::numeric_limits<int64_t>::max())/1e6)
obj.pushKV("minping", stats.dMinPing);
if (stats.dPingWait > 0.0)
obj.pushKV("pingwait", stats.dPingWait);
obj.pushKV("version", stats.nVersion);
// Use the sanitized form of subver here, to avoid tricksy remote peers from
// corrupting or modifying the JSON output by putting special characters in
// their ver message.
obj.pushKV("subver", stats.cleanSubVer);
obj.pushKV("inbound", stats.fInbound);
obj.pushKV("addnode", stats.m_manual_connection);
obj.pushKV("startingheight", stats.nStartingHeight);
if (fStateStats) {
obj.pushKV("banscore", statestats.nMisbehavior);
obj.pushKV("synced_headers", statestats.nSyncHeight);
obj.pushKV("synced_blocks", statestats.nCommonHeight);
UniValue heights(UniValue::VARR);
for (int height : statestats.vHeightInFlight) {
heights.push_back(height);
}
obj.pushKV("inflight", heights);
}
obj.pushKV("whitelisted", stats.fWhitelisted);
UniValue sendPerMsgCmd(UniValue::VOBJ);
for (const mapMsgCmdSize::value_type &i : stats.mapSendBytesPerMsgCmd) {
if (i.second > 0)
sendPerMsgCmd.pushKV(i.first, i.second);
}
obj.pushKV("bytessent_per_msg", sendPerMsgCmd);
UniValue recvPerMsgCmd(UniValue::VOBJ);
for (const mapMsgCmdSize::value_type &i : stats.mapRecvBytesPerMsgCmd) {
if (i.second > 0)
recvPerMsgCmd.pushKV(i.first, i.second);
}
obj.pushKV("bytesrecv_per_msg", recvPerMsgCmd);
ret.push_back(obj);
}
return ret;
}
static UniValue addnode(const JSONRPCRequest& request)
{
std::string strCommand;
if (!request.params[1].isNull())
strCommand = request.params[1].get_str();
if (request.fHelp || request.params.size() != 2 ||
(strCommand != "onetry" && strCommand != "add" && strCommand != "remove"))
throw std::runtime_error(
"addnode \"node\" \"add|remove|onetry\"\n"
"\nAttempts to add or remove a node from the addnode list.\n"
"Or try a connection to a node once.\n"
"Nodes added using addnode (or -connect) are protected from DoS disconnection and are not required to be\n"
"full nodes/support SegWit as other outbound peers are (though such peers will not be synced from).\n"
"\nArguments:\n"
"1. \"node\" (string, required) The node (see getpeerinfo for nodes)\n"
"2. \"command\" (string, required) 'add' to add a node to the list, 'remove' to remove a node from the list, 'onetry' to try a connection to the node once\n"
"\nExamples:\n"
+ HelpExampleCli("addnode", "\"192.168.0.6:8333\" \"onetry\"")
+ HelpExampleRpc("addnode", "\"192.168.0.6:8333\", \"onetry\"")
);
if(!g_connman)
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
std::string strNode = request.params[0].get_str();
if (strCommand == "onetry")
{
CAddress addr;
g_connman->OpenNetworkConnection(addr, false, nullptr, strNode.c_str(), false, false, true);
return NullUniValue;
}
if (strCommand == "add")
{
if(!g_connman->AddNode(strNode))
throw JSONRPCError(RPC_CLIENT_NODE_ALREADY_ADDED, "Error: Node already added");
}
else if(strCommand == "remove")
{
if(!g_connman->RemoveAddedNode(strNode))
throw JSONRPCError(RPC_CLIENT_NODE_NOT_ADDED, "Error: Node has not been added.");
}
return NullUniValue;
}
static UniValue disconnectnode(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() == 0 || request.params.size() >= 3)
throw std::runtime_error(
"disconnectnode \"[address]\" [nodeid]\n"
"\nImmediately disconnects from the specified peer node.\n"
"\nStrictly one out of 'address' and 'nodeid' can be provided to identify the node.\n"
"\nTo disconnect by nodeid, either set 'address' to the empty string, or call using the named 'nodeid' argument only.\n"
"\nArguments:\n"
"1. \"address\" (string, optional) The IP address/port of the node\n"
"2. \"nodeid\" (number, optional) The node ID (see getpeerinfo for node IDs)\n"
"\nExamples:\n"
+ HelpExampleCli("disconnectnode", "\"192.168.0.6:8333\"")
+ HelpExampleCli("disconnectnode", "\"\" 1")
+ HelpExampleRpc("disconnectnode", "\"192.168.0.6:8333\"")
+ HelpExampleRpc("disconnectnode", "\"\", 1")
);
if(!g_connman)
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
bool success;
const UniValue &address_arg = request.params[0];
const UniValue &id_arg = request.params[1];
if (!address_arg.isNull() && id_arg.isNull()) {
/* handle disconnect-by-address */
success = g_connman->DisconnectNode(address_arg.get_str());
} else if (!id_arg.isNull() && (address_arg.isNull() || (address_arg.isStr() && address_arg.get_str().empty()))) {
/* handle disconnect-by-id */
NodeId nodeid = (NodeId) id_arg.get_int64();
success = g_connman->DisconnectNode(nodeid);
} else {
throw JSONRPCError(RPC_INVALID_PARAMS, "Only one of address and nodeid should be provided.");
}
if (!success) {
throw JSONRPCError(RPC_CLIENT_NODE_NOT_CONNECTED, "Node not found in connected nodes");
}
return NullUniValue;
}
static UniValue getaddednodeinfo(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() > 1)
throw std::runtime_error(
"getaddednodeinfo ( \"node\" )\n"
"\nReturns information about the given added node, or all added nodes\n"
"(note that onetry addnodes are not listed here)\n"
"\nArguments:\n"
"1. \"node\" (string, optional) If provided, return information about this specific node, otherwise all nodes are returned.\n"
"\nResult:\n"
"[\n"
" {\n"
" \"addednode\" : \"192.168.0.201\", (string) The node IP address or name (as provided to addnode)\n"
" \"connected\" : true|false, (boolean) If connected\n"
" \"addresses\" : [ (list of objects) Only when connected = true\n"
" {\n"
" \"address\" : \"192.168.0.201:8333\", (string) The globalboost server IP and port we're connected to\n"
" \"connected\" : \"outbound\" (string) connection, inbound or outbound\n"
" }\n"
" ]\n"
" }\n"
" ,...\n"
"]\n"
"\nExamples:\n"
+ HelpExampleCli("getaddednodeinfo", "\"192.168.0.201\"")
+ HelpExampleRpc("getaddednodeinfo", "\"192.168.0.201\"")
);
if(!g_connman)
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
std::vector<AddedNodeInfo> vInfo = g_connman->GetAddedNodeInfo();
if (!request.params[0].isNull()) {
bool found = false;
for (const AddedNodeInfo& info : vInfo) {
if (info.strAddedNode == request.params[0].get_str()) {
vInfo.assign(1, info);
found = true;
break;
}
}
if (!found) {
throw JSONRPCError(RPC_CLIENT_NODE_NOT_ADDED, "Error: Node has not been added.");
}
}
UniValue ret(UniValue::VARR);
for (const AddedNodeInfo& info : vInfo) {
UniValue obj(UniValue::VOBJ);
obj.pushKV("addednode", info.strAddedNode);
obj.pushKV("connected", info.fConnected);
UniValue addresses(UniValue::VARR);
if (info.fConnected) {
UniValue address(UniValue::VOBJ);
address.pushKV("address", info.resolvedAddress.ToString());
address.pushKV("connected", info.fInbound ? "inbound" : "outbound");
addresses.push_back(address);
}
obj.pushKV("addresses", addresses);
ret.push_back(obj);
}
return ret;
}
static UniValue getnettotals(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() > 0)
throw std::runtime_error(
"getnettotals\n"
"\nReturns information about network traffic, including bytes in, bytes out,\n"
"and current time.\n"
"\nResult:\n"
"{\n"
" \"totalbytesrecv\": n, (numeric) Total bytes received\n"
" \"totalbytessent\": n, (numeric) Total bytes sent\n"
" \"timemillis\": t, (numeric) Current UNIX time in milliseconds\n"
" \"uploadtarget\":\n"
" {\n"
" \"timeframe\": n, (numeric) Length of the measuring timeframe in seconds\n"
" \"target\": n, (numeric) Target in bytes\n"
" \"target_reached\": true|false, (boolean) True if target is reached\n"
" \"serve_historical_blocks\": true|false, (boolean) True if serving historical blocks\n"
" \"bytes_left_in_cycle\": t, (numeric) Bytes left in current time cycle\n"
" \"time_left_in_cycle\": t (numeric) Seconds left in current time cycle\n"
" }\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("getnettotals", "")
+ HelpExampleRpc("getnettotals", "")
);
if(!g_connman)
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
UniValue obj(UniValue::VOBJ);
obj.pushKV("totalbytesrecv", g_connman->GetTotalBytesRecv());
obj.pushKV("totalbytessent", g_connman->GetTotalBytesSent());
obj.pushKV("timemillis", GetTimeMillis());
UniValue outboundLimit(UniValue::VOBJ);
outboundLimit.pushKV("timeframe", g_connman->GetMaxOutboundTimeframe());
outboundLimit.pushKV("target", g_connman->GetMaxOutboundTarget());
outboundLimit.pushKV("target_reached", g_connman->OutboundTargetReached(false));
outboundLimit.pushKV("serve_historical_blocks", !g_connman->OutboundTargetReached(true));
outboundLimit.pushKV("bytes_left_in_cycle", g_connman->GetOutboundTargetBytesLeft());
outboundLimit.pushKV("time_left_in_cycle", g_connman->GetMaxOutboundTimeLeftInCycle());
obj.pushKV("uploadtarget", outboundLimit);
return obj;
}
static UniValue GetNetworksInfo()
{
UniValue networks(UniValue::VARR);
for(int n=0; n<NET_MAX; ++n)
{
enum Network network = static_cast<enum Network>(n);
if(network == NET_UNROUTABLE || network == NET_INTERNAL)
continue;
proxyType proxy;
UniValue obj(UniValue::VOBJ);
GetProxy(network, proxy);
obj.pushKV("name", GetNetworkName(network));
obj.pushKV("limited", IsLimited(network));
obj.pushKV("reachable", IsReachable(network));
obj.pushKV("proxy", proxy.IsValid() ? proxy.proxy.ToStringIPPort() : std::string());
obj.pushKV("proxy_randomize_credentials", proxy.randomize_credentials);
networks.push_back(obj);
}
return networks;
}
static UniValue getnetworkinfo(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"getnetworkinfo\n"
"Returns an object containing various state info regarding P2P networking.\n"
"\nResult:\n"
"{\n"
" \"version\": xxxxx, (numeric) the server version\n"
" \"subversion\": \"/Satoshi:x.x.x/\", (string) the server subversion string\n"
" \"protocolversion\": xxxxx, (numeric) the protocol version\n"
" \"localservices\": \"xxxxxxxxxxxxxxxx\", (string) the services we offer to the network\n"
" \"localrelay\": true|false, (bool) true if transaction relay is requested from peers\n"
" \"timeoffset\": xxxxx, (numeric) the time offset\n"
" \"connections\": xxxxx, (numeric) the number of connections\n"
" \"networkactive\": true|false, (bool) whether p2p networking is enabled\n"
" \"networks\": [ (array) information per network\n"
" {\n"
" \"name\": \"xxx\", (string) network (ipv4, ipv6 or onion)\n"
" \"limited\": true|false, (boolean) is the network limited using -onlynet?\n"
" \"reachable\": true|false, (boolean) is the network reachable?\n"
" \"proxy\": \"host:port\" (string) the proxy that is used for this network, or empty if none\n"
" \"proxy_randomize_credentials\": true|false, (string) Whether randomized credentials are used\n"
" }\n"
" ,...\n"
" ],\n"
" \"relayfee\": x.xxxxxxxx, (numeric) minimum relay fee for transactions in " + CURRENCY_UNIT + "/kB\n"
" \"incrementalfee\": x.xxxxxxxx, (numeric) minimum fee increment for mempool limiting or BIP 125 replacement in " + CURRENCY_UNIT + "/kB\n"
" \"localaddresses\": [ (array) list of local addresses\n"
" {\n"
" \"address\": \"xxxx\", (string) network address\n"
" \"port\": xxx, (numeric) network port\n"
" \"score\": xxx (numeric) relative score\n"
" }\n"
" ,...\n"
" ]\n"
" \"warnings\": \"...\" (string) any network and blockchain warnings\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("getnetworkinfo", "")
+ HelpExampleRpc("getnetworkinfo", "")
);
LOCK(cs_main);
UniValue obj(UniValue::VOBJ);
obj.pushKV("version", CLIENT_VERSION);
obj.pushKV("subversion", strSubVersion);
obj.pushKV("protocolversion",PROTOCOL_VERSION);
if(g_connman)
obj.pushKV("localservices", strprintf("%016x", g_connman->GetLocalServices()));
obj.pushKV("localrelay", fRelayTxes);
obj.pushKV("timeoffset", GetTimeOffset());
if (g_connman) {
obj.pushKV("networkactive", g_connman->GetNetworkActive());
obj.pushKV("connections", (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL));
}
obj.pushKV("networks", GetNetworksInfo());
obj.pushKV("relayfee", ValueFromAmount(::minRelayTxFee.GetFeePerK()));
obj.pushKV("incrementalfee", ValueFromAmount(::incrementalRelayFee.GetFeePerK()));
UniValue localAddresses(UniValue::VARR);
{
LOCK(cs_mapLocalHost);
for (const std::pair<const CNetAddr, LocalServiceInfo> &item : mapLocalHost)
{
UniValue rec(UniValue::VOBJ);
rec.pushKV("address", item.first.ToString());
rec.pushKV("port", item.second.nPort);
rec.pushKV("score", item.second.nScore);
localAddresses.push_back(rec);
}
}
obj.pushKV("localaddresses", localAddresses);
obj.pushKV("warnings", GetWarnings("statusbar"));
return obj;
}
static UniValue setban(const JSONRPCRequest& request)
{
std::string strCommand;
if (!request.params[1].isNull())
strCommand = request.params[1].get_str();
if (request.fHelp || request.params.size() < 2 ||
(strCommand != "add" && strCommand != "remove"))
throw std::runtime_error(
"setban \"subnet\" \"add|remove\" (bantime) (absolute)\n"
"\nAttempts to add or remove an IP/Subnet from the banned list.\n"
"\nArguments:\n"
"1. \"subnet\" (string, required) The IP/Subnet (see getpeerinfo for nodes IP) with an optional netmask (default is /32 = single IP)\n"
"2. \"command\" (string, required) 'add' to add an IP/Subnet to the list, 'remove' to remove an IP/Subnet from the list\n"
"3. \"bantime\" (numeric, optional) time in seconds how long (or until when if [absolute] is set) the IP is banned (0 or empty means using the default time of 24h which can also be overwritten by the -bantime startup argument)\n"
"4. \"absolute\" (boolean, optional) If set, the bantime must be an absolute timestamp in seconds since epoch (Jan 1 1970 GMT)\n"
"\nExamples:\n"
+ HelpExampleCli("setban", "\"192.168.0.6\" \"add\" 86400")
+ HelpExampleCli("setban", "\"192.168.0.0/24\" \"add\"")
+ HelpExampleRpc("setban", "\"192.168.0.6\", \"add\", 86400")
);
if(!g_connman)
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
CSubNet subNet;
CNetAddr netAddr;
bool isSubnet = false;
if (request.params[0].get_str().find('/') != std::string::npos)
isSubnet = true;
if (!isSubnet) {
CNetAddr resolved;
LookupHost(request.params[0].get_str().c_str(), resolved, false);
netAddr = resolved;
}
else
LookupSubNet(request.params[0].get_str().c_str(), subNet);
if (! (isSubnet ? subNet.IsValid() : netAddr.IsValid()) )
throw JSONRPCError(RPC_CLIENT_INVALID_IP_OR_SUBNET, "Error: Invalid IP/Subnet");
if (strCommand == "add")
{
if (isSubnet ? g_connman->IsBanned(subNet) : g_connman->IsBanned(netAddr))
throw JSONRPCError(RPC_CLIENT_NODE_ALREADY_ADDED, "Error: IP/Subnet already banned");
int64_t banTime = 0; //use standard bantime if not specified
if (!request.params[2].isNull())
banTime = request.params[2].get_int64();
bool absolute = false;
if (request.params[3].isTrue())
absolute = true;
isSubnet ? g_connman->Ban(subNet, BanReasonManuallyAdded, banTime, absolute) : g_connman->Ban(netAddr, BanReasonManuallyAdded, banTime, absolute);
}
else if(strCommand == "remove")
{
if (!( isSubnet ? g_connman->Unban(subNet) : g_connman->Unban(netAddr) ))
throw JSONRPCError(RPC_CLIENT_INVALID_IP_OR_SUBNET, "Error: Unban failed. Requested address/subnet was not previously banned.");
}
return NullUniValue;
}
static UniValue listbanned(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"listbanned\n"
"\nList all banned IPs/Subnets.\n"
"\nExamples:\n"
+ HelpExampleCli("listbanned", "")
+ HelpExampleRpc("listbanned", "")
);
if(!g_connman)
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
banmap_t banMap;
g_connman->GetBanned(banMap);
UniValue bannedAddresses(UniValue::VARR);
for (const auto& entry : banMap)
{
const CBanEntry& banEntry = entry.second;
UniValue rec(UniValue::VOBJ);
rec.pushKV("address", entry.first.ToString());
rec.pushKV("banned_until", banEntry.nBanUntil);
rec.pushKV("ban_created", banEntry.nCreateTime);
rec.pushKV("ban_reason", banEntry.banReasonToString());
bannedAddresses.push_back(rec);
}
return bannedAddresses;
}
static UniValue clearbanned(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
"clearbanned\n"
"\nClear all banned IPs.\n"
"\nExamples:\n"
+ HelpExampleCli("clearbanned", "")
+ HelpExampleRpc("clearbanned", "")
);
if(!g_connman)
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
g_connman->ClearBanned();
return NullUniValue;
}
static UniValue setnetworkactive(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1) {
throw std::runtime_error(
"setnetworkactive true|false\n"
"\nDisable/enable all p2p network activity.\n"
"\nArguments:\n"
"1. \"state\" (boolean, required) true to enable networking, false to disable\n"
);
}
if (!g_connman) {
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
}
g_connman->SetNetworkActive(request.params[0].get_bool());
return g_connman->GetNetworkActive();
}
static const CRPCCommand commands[] =
{ // category name actor (function) argNames
// --------------------- ------------------------ ----------------------- ----------
{ "network", "getconnectioncount", &getconnectioncount, {} },
{ "network", "ping", &ping, {} },
{ "network", "getpeerinfo", &getpeerinfo, {} },
{ "network", "addnode", &addnode, {"node","command"} },
{ "network", "disconnectnode", &disconnectnode, {"address", "nodeid"} },
{ "network", "getaddednodeinfo", &getaddednodeinfo, {"node"} },
{ "network", "getnettotals", &getnettotals, {} },
{ "network", "getnetworkinfo", &getnetworkinfo, {} },
{ "network", "setban", &setban, {"subnet", "command", "bantime", "absolute"} },
{ "network", "listbanned", &listbanned, {} },
{ "network", "clearbanned", &clearbanned, {} },
{ "network", "setnetworkactive", &setnetworkactive, {"state"} },
};
void RegisterNetRPCCommands(CRPCTable &t)
{
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
t.appendCommand(commands[vcidx].name, &commands[vcidx]);
}
| [
"null"
] | null |
27649f14042d8655cc0b6ad72ee1cd69507eddb2 | f95683864c1ee1028eb4a43bb97fb7ccd4d2d881 | /001_hello_world/hello_world.cc | 7fc1a0ef04c23e8b271e8699912166929fa8e201 | [] | no_license | shoichi0599/cpp_tutorial | 10adfa7fc4b089902b650bb1c02c1193ec9594af | c3fc64a28969167e89a8b26449c2744ec4122aa6 | refs/heads/master | 2020-04-07T01:42:40.381589 | 2018-12-01T07:31:20 | 2018-12-01T07:31:20 | 157,949,087 | 0 | 0 | null | 2018-12-01T07:29:43 | 2018-11-17T04:01:29 | C++ | UTF-8 | C++ | false | false | 144 | cc | // Hellow World
// A basic program
#include <iostream>
using namespace std;
int main() {
cout << "Hello World!" << endl;
return 0;
}
| [
"shoichi.programming@gmail.com"
] | shoichi.programming@gmail.com |
6be5b79da7cd417da076d345dd333c31d2186ad1 | d9954b283b3fd750b6950a7de8840baa962142cc | /DS/LinklistNode.h | 5d3a042e2ee92085b295f639889b7e603a09f143 | [] | no_license | yiquedexianshi/CP-template | 4a56fca71eb4ab8e593c9ce6931e5a50b7440bc6 | 143832d182b49e609c930298b804dd0ee40a01fc | refs/heads/main | 2023-06-11T18:22:19.916844 | 2021-07-02T10:59:27 | 2021-07-02T10:59:27 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 459 | h | #pragma once
#include <iostream>
using namespace std;
#define OLDYAN_LINKLISTNODE
template<class T>
struct LinklistNode{
T val;
LinklistNode*prev,*next;
LinklistNode():prev(nullptr),next(nullptr){}
LinklistNode(T _val):val(_val),prev(nullptr),next(nullptr){}
LinklistNode(T _val,LinklistNode*_next):val(_val),prev(nullptr),next(_next){}
LinklistNode(T _val,LinklistNode*_prev,LinklistNode*_next):val(_val),prev(_prev),next(_next){}
}; | [
"oldyan_zh@163.com"
] | oldyan_zh@163.com |
3202b28555502ca72873b810693ee8f3c152b20a | 777fc408df508a66f8ba82e662153b17938a8a11 | /Max/include/maxscript/kernel/value.h | a149ab0b42885b92d8171876b3c5937d18b2634f | [] | no_license | bingeun/BG_DX | 4b89a891ea2aadaf7ea8eab6b18baa5f76185766 | e3182934ed276de58c1ac136c42ec6a8b8f6861c | refs/heads/master | 2020-05-22T08:07:51.033127 | 2016-10-21T14:04:18 | 2016-10-21T14:04:18 | 61,520,947 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 27,513 | h | /* Value.h - metaclass system MAXScript values
*
* All MAXScript-specific C++ objects are subclasses of a single root class, Value,
* and allocated & automatically freed in a specially maintained heap. There is also
* a metaclass system to provide a runtime type calculus for the scripter. Value subclasses
* are divided into those that are scripter-visible, (ie, may wind up as objects that the
* scripter may pass around or store in variables, etc.), and those that are entirely
* internal to the scripter operation (such as thunks, etc.). The scripter-visible
* classes (the majority) are represented in the metasystem by instances of separate
* metaclasses. The metaclasses are all subclasses of ValueMetaClass, the metaclass of
* a class X is named XClass and its sole instance is X_class. The class instances are
* made visible in globals (usually) named X.
*
* Each Value instance has a tag word that either contains a pointer to the instance's
* class instance (in the case of scripter-visible classes) or the reserved value INTERNAL_CLASS_TAG.
* This value is used in performing runtimne type tests and for yielding results to classOf
* methods.
*
* The metaclass, its instance and some of the class calculus methods are usually defined via
* a bunch of macros defined here (see visible_class, visible_class_instance, etc.)
*
* Some of the classes are can be instanced directly as literals in a script, such as strings,
* Point3s, arrays, etc. Some others are instantiable directly by applying the class value
* to a set of initializing parameters, ie, using the class as a function in a function call,
* for example, ray, quat, interval, etc. These are defined via a variant macro: applyable_class().
* A special case of this is provided in the MAXWrapper subsytem for creatable MAX objects, such as
* boxes, lights, camera, etc.. These are represnted by instances of the class MAXClass, and again, thses
* instances are exposed in globals to be applied to creation paramters. These instances
* contain a lot of property metadata and are defined in MAX_classes.cpp. See MAXObject.h for more
* info.
*
* Copyright (c) John Wainwright, 1996
*
*/
#pragma once
#include "../ScripterExport.h"
#include "collectable.h"
#include "interupts.h"
#include "MAXScript_TLS.h"
#include "../macros/value_locals.h"
#include "MaxscriptTypedefs.h"
#include "../../matrix3.h"
#include "../../box2.h"
#include "../../acolor.h"
#include "../../interval.h"
#include "../../quat.h"
#include "../../ifnpub.h"
// forward declarations
class BitArray;
class CharStream;
class Name;
class PathName;
class Undefined;
class UserProp;
class UserGeneric;
class CallContext;
class ValueMetaClass;
struct node_map;
class Mtl;
class Texmap;
class MtlBase;
class Modifier;
class Control;
class Atmospheric;
class Effect;
class IMultiPassCameraEffect;
class ShadowType;
class FPInterfaceDesc;
class FilterKernel;
class ITrackViewNode;
class NURBSIndependentPoint;
class NURBSPoint;
class NURBSObject;
class NURBSControlVertex;
class NURBSCurve;
class NURBSCVCurve;
class NURBSSurface;
class NURBSTexturePoint;
class NURBSSet;
class ReferenceTarget;
class Mesh;
class Thunk;
class Renderer;
class NURBSTextureSurface;
class NURBSDisplay;
class TessApprox;
class SelectionIterator;
#include "../macros/define_external_functions.h"
# include "../protocols/corenames.inl"
// forward declarations...
extern ScripterExport Undefined undefined;
extern ScripterExport bool dontThrowAccessorError;
// the root MAXScript class
class Value : public Collectable
{
private:
ScripterExport static Matrix3 s_error_matrix;
ScripterExport static Box2 s_error_box2;
public:
#pragma warning(push)
#pragma warning(disable:4100)
ValueMetaClass* tag; // runtime type tag; filled in by subclasses
ScripterExport virtual BOOL is_kind_of(ValueMetaClass* c);
ScripterExport virtual ValueMetaClass* local_base_class(); // local base class in this class's plug-in
virtual Value* eval() { check_interrupts(); return this; }
virtual Value* eval_no_wrapper() { check_interrupts(); return this; }
ScripterExport virtual Value* apply(Value** arglist, int count, CallContext* cc=NULL);
ScripterExport virtual Value* apply_no_alloc_frame(Value** arglist, int count, CallContext* cc=NULL);
virtual void export_to_scripter() { }
virtual Value* map(node_map& m) { unimplemented(_M("map"), this) ; return this; }
virtual Value* map_path(PathName* path, node_map& m) { unimplemented(_M("map_path"), this) ; return this; }
virtual Value* find_first(BOOL (*test_fn)(INode* node, int level, const void* arg), const void* test_arg) { unimplemented(_M("find_first"), this) ; return this; }
virtual Value* get_path(PathName* path) { unimplemented(_M("get"), this) ; return this; }
ScripterExport virtual void sprin1(CharStream* stream);
ScripterExport virtual void sprint(CharStream* stream);
virtual void prin1() { sprin1(thread_local(current_stdout)); }
virtual void print() { sprint(thread_local(current_stdout)); }
/* include all the protocol declarations */
#include "../macros/define_abstract_functions.h"
# include "../protocols/math.inl"
# include "../protocols/vector.inl"
# include "../protocols/matrix.inl"
# include "../protocols/quat.inl"
# include "../protocols/arrays.inl"
# include "../protocols/streams.inl"
# include "../protocols/strings.inl"
# include "../protocols/time.inl"
# include "../protocols/color.inl"
# include "../protocols/node.inl"
# include "../protocols/controller.inl"
# include "../protocols/primitives.inl"
# include "../protocols/generics.inl"
# include "../protocols/bitmaps.inl"
# include "../protocols/textures.inl"
# include "../protocols/atmospherics.inl"
# // Moved to ../maxwrapper/mxsnurbs.h into class NURBSObjectValue
# include "../protocols/cameratracker.inl"
# include "../protocols/bigmatrix.inl"
# include "../protocols/box.inl"
# include "../protocols/physiqueblend.inl"
# include "../protocols/physiquemod.inl"
# include "../protocols/biped.inl"
# include "../protocols/notekey.inl"
# include "../protocols/xrefs.inl"
ScripterExport virtual Class_ID get_max_class_id() { return Class_ID(0, 0); }
ScripterExport virtual Value* delete_vf(Value** arglist, int arg_count) { ABSTRACT_FUNCTION(_M("delete"), this, Value*); }
ScripterExport virtual Value* clearSelection_vf(Value** arglist, int arg_count) { ABSTRACT_FUNCTION(_M("clearSelection"), this, Value*); }
#undef def_generic
#define def_generic(fn, name) ScripterExport virtual Value* fn##_vf(Value** arglist, int arg_count);
# include "../protocols/kernel.inl"
virtual float to_float() { ABSTRACT_CONVERTER(float, Float); }
virtual double to_double() { ABSTRACT_CONVERTER(double, Double); }
virtual const MCHAR* to_string() { ABSTRACT_CONVERTER(const MCHAR*, String); }
virtual MSTR to_mstr() { return MSTR(to_string()); }
virtual MSTR to_filename() { ABSTRACT_CONVERTER(const MCHAR*, FileName); }
virtual int to_int() { ABSTRACT_CONVERTER(int, Integer); }
virtual INT64 to_int64() { ABSTRACT_CONVERTER(INT64, Integer64); }
virtual INT_PTR to_intptr() { ABSTRACT_CONVERTER(INT_PTR, IntegerPtr); }
virtual BOOL to_bool() { ABSTRACT_CONVERTER(BOOL, Boolean); }
virtual BitArray& to_bitarray() { throw ConversionError (this, _M("BitArray")); return *(BitArray*)NULL; }
virtual Point4 to_point4() { ABSTRACT_CONVERTER(Point4, Point4); }
virtual Point3 to_point3() { ABSTRACT_CONVERTER(Point3, Point3); }
virtual Point2 to_point2() { ABSTRACT_CONVERTER(Point2, Point2); }
virtual AColor to_acolor() { throw ConversionError (this, _M("Color")); return AColor(0,0,0); }
virtual COLORREF to_colorref() { throw ConversionError (this, _M("Color")); return RGB(0,0,0); }
virtual INode* to_node() { ABSTRACT_CONVERTER(INode*, <node>); }
virtual Ray to_ray() { throw ConversionError (this, _M("Ray")); return Ray(); }
virtual Interval to_interval() { throw ConversionError (this, _M("Interval")); return Interval(); }
virtual Quat to_quat() { throw ConversionError (this, _M("Quaternion")); return Quat(); }
virtual AngAxis to_angaxis() { throw ConversionError (this, _M("AngleAxis")); return AngAxis(); }
virtual Matrix3& to_matrix3() { throw ConversionError (this, _M("Matrix")); return s_error_matrix; }
virtual float* to_eulerangles() { ABSTRACT_CONVERTER(float*, Float); }
virtual Mtl* to_mtl() { ABSTRACT_CONVERTER(Mtl*, Material); }
virtual Texmap* to_texmap() { ABSTRACT_CONVERTER(Texmap*, TextureMap); }
virtual MtlBase* to_mtlbase() { ABSTRACT_CONVERTER(MtlBase*, MtlBase); }
virtual Modifier* to_modifier() { ABSTRACT_CONVERTER(Modifier*, Modifier); }
virtual TimeValue to_timevalue() { ABSTRACT_CONVERTER(TimeValue, Time); }
virtual Control* to_controller() { ABSTRACT_CONVERTER(Control*, Controller); }
virtual Atmospheric* to_atmospheric() { ABSTRACT_CONVERTER(Atmospheric*, Atmospheric); }
virtual Effect* to_effect() { ABSTRACT_CONVERTER(Effect*, Effect); } // RK: Added this
virtual IMultiPassCameraEffect* to_mpassCamEffect() { ABSTRACT_CONVERTER(IMultiPassCameraEffect*, Effect); } // LAM: Added this
virtual ShadowType* to_shadowtype() { ABSTRACT_CONVERTER(ShadowType*, ShadowType); } // RK: Added this
virtual FilterKernel* to_filter() { ABSTRACT_CONVERTER(FilterKernel*, FilterKernel); } // RK: Added this
virtual INode* to_rootnode() { ABSTRACT_CONVERTER(INode*, <root>); } // RK: Added this
virtual ITrackViewNode* to_trackviewnode() { ABSTRACT_CONVERTER(ITrackViewNode*, TrackViewNode); }
virtual NURBSIndependentPoint* to_nurbsindependentpoint() { throw ConversionError (this, _M("NURBSIndependentPoint")); return (NURBSIndependentPoint*)0; }
virtual NURBSPoint* to_nurbspoint() { throw ConversionError (this, _M("NURBSPoint")); return (NURBSPoint*)0; }
virtual NURBSObject* to_nurbsobject() { throw ConversionError (this, _M("NURBSObject")); return (NURBSObject*)0; }
virtual NURBSControlVertex* to_nurbscontrolvertex() { throw ConversionError (this, _M("NURBSControlVertex")); return (NURBSControlVertex*)0; }
virtual NURBSCurve* to_nurbscurve() { throw ConversionError (this, _M("NURBSCurve")); return (NURBSCurve*)0; }
virtual NURBSCVCurve* to_nurbscvcurve() { throw ConversionError (this, _M("NURBSCVCurve")); return (NURBSCVCurve*)0; }
virtual NURBSSurface* to_nurbssurface() { throw ConversionError (this, _M("NURBSSurface")); return (NURBSSurface*)0; }
virtual NURBSTexturePoint* to_nurbstexturepoint() { throw ConversionError (this, _M("NURBSTexturePoint")); return (NURBSTexturePoint*)0; }
virtual NURBSSet* to_nurbsset() { throw ConversionError (this, _M("NURBSSet")); return (NURBSSet*)0; }
virtual ReferenceTarget* to_reftarg() { ABSTRACT_CONVERTER(ReferenceTarget*, MaxObject); }
virtual Mesh* to_mesh() { ABSTRACT_CONVERTER(Mesh*, Mesh); }
virtual Thunk* to_thunk() { ABSTRACT_CONVERTER(Thunk*, &-reference); }
virtual void to_fpvalue(FPValue& v) { throw ConversionError (this, _M("FPValue")); }
virtual Renderer* to_renderer() { ABSTRACT_CONVERTER(Renderer*, Renderer); } // LAM: Added this 9/15/01
virtual Box2& to_box2() { throw ConversionError (this, _M("Box2")); return s_error_box2; }
virtual NURBSTextureSurface* to_nurbstexturesurface() { throw ConversionError (this, _M("NURBSTextureSurface")); return (NURBSTextureSurface*)0; }
virtual NURBSDisplay* to_nurbsdisplay() { throw ConversionError (this, _M("NURBSDisplay")); return (NURBSDisplay*)0; }
virtual TessApprox* to_tessapprox() { throw ConversionError (this, _M("TessApprox")); return (TessApprox*)0; }
virtual Value* widen_to(Value* arg, Value** arg_list) { ABSTRACT_WIDENER(arg); }
virtual BOOL comparable(Value* arg) { return (tag == arg->tag); }
virtual BOOL is_const() { return FALSE; }
// LAM - 7/8/03 - defect 504956 - following identifies classes that derive from MAXWrapper. Only other implementation is in MAXWrapper
// used by garbage collector to prevent collection of MAXWrapper-derived values while doing light collection
virtual BOOL derives_from_MAXWrapper() { return FALSE; }
ScripterExport virtual Value* get_property(Value** arg_list, int count);
ScripterExport virtual Value* set_property(Value** arg_list, int count);
ScripterExport Value* _get_property(Value* prop);
ScripterExport virtual Value* _set_property(Value* prop, Value* val);
virtual Value* get_container_property(Value* prop, Value* cur_prop) { if (!dontThrowAccessorError) throw AccessorError (cur_prop, prop); return NULL; }
virtual Value* set_container_property(Value* prop, Value* val, Value* cur_prop) { throw AccessorError (cur_prop, prop); return NULL;}
// polymorphic default type predicates - abstracted over by is_x(v) macros as needed
virtual BOOL _is_collection() { return FALSE; }
virtual BOOL _is_charstream() { return FALSE; }
virtual BOOL _is_rolloutcontrol() { return FALSE; }
virtual BOOL _is_rolloutthunk() { return FALSE; }
virtual BOOL _is_function() { return FALSE; }
virtual BOOL _is_selection() { return FALSE; }
virtual BOOL _is_thunk() { return FALSE; }
virtual BOOL _is_indirect_thunk() { return FALSE; }
// yield selection set iterator if you can
virtual SelectionIterator* selection_iterator() { throw RuntimeError (_M("Operation requires a selection (Array or BitArray)")); return NULL; }
// scene persistence functions
ScripterExport virtual IOResult Save(ISave* isave);
// the Load fn is a static method on loadbale classes, see SceneIO.cpp & .h and each loadable class
// called during MAX exit to have all MAXScript-side refs dropped (main implementation in MAXWrapper)
virtual void drop_MAX_refs() { }
// access ID'd FPInterface if supported
virtual BaseInterface* GetInterface(Interface_ID id) { return NULL; }
// stack allocation routines
ScripterExport Value* make_heap_permanent();
ScripterExport Value* make_heap_static() { Value* v = make_heap_permanent(); v->flags |= GC_STATIC; return v; }
ScripterExport Value* get_heap_ptr() { if (!has_heap_copy()) return migrate_to_heap(); return is_on_stack() ? get_stack_heap_ptr() : this; }
ScripterExport Value* get_stack_heap_ptr() { return (Value*)next; }
ScripterExport Value* migrate_to_heap();
ScripterExport Value* get_live_ptr() { return is_on_stack() && has_heap_copy() ? get_stack_heap_ptr() : this; }
#pragma warning(pop)
};
inline Value* heap_ptr(Value* v) { return v ? v->get_heap_ptr() : NULL; } // ensure v is in heap, migrate if not, return heap pointer
inline Value* live_ptr(Value* v) { return v->get_live_ptr(); } // get live pointer, if on stack & migrated, heap copy is live
/* ---------- the base class for all metaclasses ---------- */
class MetaClassClass;
extern MetaClassClass value_metaclass; // the metaclass class
class ValueMetaClass : public Value
{
// Whether the generic functions and property setters of class instances can be called from debugger thread stored
// in Collectable::flags3 - bit 0. Default is false.
public:
const MCHAR* name;
UserProp* user_props; // additional, user defined property accessors
short uprop_count;
UserGeneric* user_gens; // " " " generic fns
short ugen_count;
Tab<FPInterfaceDesc*> prop_interfaces; // static interfaces who methods appear as properties on instances of the class
ValueMetaClass() { }
ScripterExport ValueMetaClass(const MCHAR* iname);
ScripterExport ~ValueMetaClass();
ScripterExport BOOL is_kind_of(ValueMetaClass* c);
# define is_valueclass(v) ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == (ValueMetaClass*)&value_metaclass)
ScripterExport void sprin1(CharStream* s);
ScripterExport void export_to_scripter();
ScripterExport void add_user_prop(const MCHAR* prop, value_cf getter, value_cf setter);
ScripterExport void add_user_generic(const MCHAR* name, value_cf fn);
ScripterExport UserGeneric* find_user_gen(Value* name);
ScripterExport UserProp* find_user_prop(Value* prop);
// static property interfaces
ScripterExport void add_prop_interface(FPInterfaceDesc* fpd) { prop_interfaces.Append(1, &fpd); }
ScripterExport int num_prop_interfaces() { return prop_interfaces.Count(); }
ScripterExport FPInterfaceDesc* get_prop_interface(int i) { return prop_interfaces[i]; }
};
#define CHECK_ARG_COUNT(fn, w, g) if ((w) != (g)) throw ArgCountError (_M(#fn), w, g)
#define classof_methods(_cls, _super) \
Value* classOf_vf(Value** arg_list, int count) \
{ \
UNUSED_PARAM(arg_list); \
CHECK_ARG_COUNT(classOf, 1, count + 1); \
return &_cls##_class; \
} \
Value* superClassOf_vf(Value** arg_list, int count) \
{ \
UNUSED_PARAM(arg_list); \
CHECK_ARG_COUNT(superClassOf, 1, count + 1); \
return &_super##_class; \
} \
Value* isKindOf_vf(Value** arg_list, int count) \
{ \
CHECK_ARG_COUNT(isKindOf, 2, count + 1); \
return (arg_list[0] == &_cls##_class) ? \
&true_value : \
_super::isKindOf_vf(arg_list, count); \
} \
BOOL is_kind_of(ValueMetaClass* c) \
{ \
return (c == &_cls##_class) ? 1 \
: _super::is_kind_of(c); \
}
#define visible_class(_cls) \
class _cls##Class : public ValueMetaClass \
{ \
public: \
_cls##Class(const MCHAR* name) : ValueMetaClass (name) { } \
void collect() { delete this; } \
}; \
extern ScripterExport _cls##Class _cls##_class;
#define visible_class_debug_ok(_cls) \
class _cls##Class : public ValueMetaClass \
{ \
public: \
_cls##Class(const MCHAR* name) : ValueMetaClass (name) { flags3 |= VALUE_FLAGBIT_0; } \
void collect() { delete this; } \
}; \
extern ScripterExport _cls##Class _cls##_class;
#define visible_class_s(_cls, _super) \
class _cls##Class : public ValueMetaClass \
{ \
public: \
_cls##Class(const MCHAR* name) : ValueMetaClass (name) { } \
void collect() { delete this; } \
Value* classOf_vf(Value** arg_list, int count) \
{ \
UNUSED_PARAM(arg_list); \
CHECK_ARG_COUNT(classOf, 1, count + 1); \
return &_super##_class; \
} \
Value* superClassOf_vf(Value** arg_list, int count) \
{ \
UNUSED_PARAM(arg_list); \
UNUSED_PARAM(count); \
return _super##_class.classOf_vf(NULL, 0); \
} \
}; \
extern ScripterExport _cls##Class _cls##_class;
#define applyable_class(_cls) \
class _cls##Class : public ValueMetaClass \
{ \
public: \
_cls##Class(const MCHAR* name) : ValueMetaClass (name) { }\
void collect() { delete this; } \
ScripterExport Value* apply(Value** arglist, int count, CallContext* cc=NULL); \
}; \
extern ScripterExport _cls##Class _cls##_class;
#define applyable_class_debug_ok(_cls) \
class _cls##Class : public ValueMetaClass \
{ \
public: \
_cls##Class(const MCHAR* name) : ValueMetaClass (name) { flags3 |= VALUE_FLAGBIT_0; }\
void collect() { delete this; } \
ScripterExport Value* apply(Value** arglist, int count, CallContext* cc=NULL); \
}; \
extern ScripterExport _cls##Class _cls##_class;
#define applyable_class_s(_cls, _super) \
class _cls##Class : public ValueMetaClass \
{ \
public: \
_cls##Class(const MCHAR* name) : ValueMetaClass (name) { }\
Value* classOf_vf(Value** arg_list, int count) \
{ \
UNUSED_PARAM(arg_list); \
CHECK_ARG_COUNT(classOf, 1, count + 1); \
return &_super##_class; \
} \
Value* superClassOf_vf(Value** arg_list, int count) \
{ \
UNUSED_PARAM(arg_list); \
UNUSED_PARAM(count); \
return _super##_class.classOf_vf(NULL, 0); \
} \
void collect() { delete this; } \
ScripterExport Value* apply(Value** arglist, int count, CallContext* cc=NULL); \
}; \
extern ScripterExport _cls##Class _cls##_class;
#define visible_class_instance(_cls, _name) \
ScripterExport _cls##Class _cls##_class (_M(_name));
#define invisible_class(_cls) \
class _cls##Class : public ValueMetaClass \
{ \
public: \
_cls##Class(const MCHAR* name) : ValueMetaClass (name) { } \
void collect() { delete this; } \
void export_to_scripter() { } \
}; \
extern ScripterExport _cls##Class _cls##_class;
#define invisible_class_instance(_cls, _name) \
ScripterExport _cls##Class _cls##_class (_M(_name));
#define class_tag(_cls) &_cls##_class
#define INTERNAL_CLASS_TAG ((ValueMetaClass*)0L)
#define INTERNAL_INDEX_THUNK_TAG ((ValueMetaClass*)1L)
#define INTERNAL_PROP_THUNK_TAG ((ValueMetaClass*)2L)
#define INTERNAL_LOCAL_THUNK_TAG ((ValueMetaClass*)3L)
#define INTERNAL_FREE_THUNK_TAG ((ValueMetaClass*)4L)
#define INTERNAL_RO_LOCAL_THUNK_TAG ((ValueMetaClass*)5L)
#define INTERNAL_CODE_TAG ((ValueMetaClass*)6L)
#define INTERNAL_SOURCEFILEWRAPPER_TAG ((ValueMetaClass*)7L)
#define INTERNAL_PIPE_TAG ((ValueMetaClass*)8L)
#define INTERNAL_TOOL_LOCAL_THUNK_TAG ((ValueMetaClass*)9L)
#define INTERNAL_GLOBAL_THUNK_TAG ((ValueMetaClass*)10L)
#define INTERNAL_CONST_GLOBAL_THUNK_TAG ((ValueMetaClass*)11L)
#define INTERNAL_SYS_GLOBAL_THUNK_TAG ((ValueMetaClass*)12L)
#define INTERNAL_PLUGIN_LOCAL_THUNK_TAG ((ValueMetaClass*)13L)
#define INTERNAL_PLUGIN_PARAM_THUNK_TAG ((ValueMetaClass*)14L)
#define INTERNAL_RCMENU_LOCAL_THUNK_TAG ((ValueMetaClass*)15L)
#define INTERNAL_STRUCT_MEM_THUNK_TAG ((ValueMetaClass*)16L)
#define INTERNAL_MSPLUGIN_TAG ((ValueMetaClass*)17L)
#define INTERNAL_STRUCT_TAG ((ValueMetaClass*)18L)
#define INTERNAL_MAKER_TAG ((ValueMetaClass*)19L)
#define INTERNAL_CODEBLOCK_LOCAL_TAG ((ValueMetaClass*)20L)
#define INTERNAL_CODEBLOCK_TAG ((ValueMetaClass*)21L)
#define INTERNAL_THUNK_REF_TAG ((ValueMetaClass*)22L)
#define INTERNAL_THUNK_DEREF_TAG ((ValueMetaClass*)23L)
#define INTERNAL_STRUCT_METHOD_TAG ((ValueMetaClass*)24L) // LAM - defect 307069
#define INTERNAL_MSPLUGIN_METHOD_TAG ((ValueMetaClass*)25L) // LAM - 9/6/02 - defect 291499
#define INTERNAL_CONTEXT_THUNK_TAG ((ValueMetaClass*)26L) // LAM - 2/8/05
#define INTERNAL_OWNER_THUNK_TAG ((ValueMetaClass*)27L) // LAM - 2/28/05
#define INTERNAL_RCMENU_ITEM_THUNK_TAG ((ValueMetaClass*)28L) // LAM - 3/21/05
#define INTERNAL_STANDINMSPLUGINCLASS_TAG ((ValueMetaClass*)29L) // LAM - 8/29/06
#define INTERNAL_SOURCEPOSWRAPPER_TAG ((ValueMetaClass*)30L) // LAM - 9/4/08
#define INTERNAL_TAGS ((ValueMetaClass*)100L) // must be higher than all internal tags
#ifndef DOXYGEN
visible_class_debug_ok (Value)
#endif
#define is_sourcepositionwrapper(v) ((v)->tag == INTERNAL_SOURCEPOSWRAPPER_TAG)
/* ---------- the distinguished value subclasses ---------- */
#ifndef DOXYGEN
visible_class_debug_ok (Boolean)
#endif
class Boolean;
class ValueLoader;
extern ScripterExport Boolean true_value;
extern ScripterExport Boolean false_value;
#pragma warning(push)
#pragma warning(disable:4100)
class Boolean : public Value
{
public:
Boolean() { tag = &Boolean_class; }
classof_methods (Boolean, Value);
void collect();
void sprin1(CharStream* s);
# define is_bool(v) ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == &Boolean_class)
Value* not_vf(Value**arg_list, int count);
Value* copy_vf(Value** arg_list, int count) { return this; }
BOOL to_bool() { return this == &true_value; }
void to_fpvalue(FPValue& v) { v.i = (this == &true_value) ? 1 : 0; v.type = (ParamType2)TYPE_BOOL; }
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
};
/* ----- */
#ifndef DOXYGEN
visible_class_debug_ok (Undefined)
#endif
class Undefined : public Value
{
public:
Undefined() { tag = &Undefined_class; }
classof_methods (Undefined, Value);
void collect();
ScripterExport void sprin1(CharStream* s);
Value* copy_vf(Value** arg_list, int count) { return this; }
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
Mtl* to_mtl() { return NULL; } // undefined is a NULL material
void to_fpvalue(FPValue& v);
};
extern ScripterExport Undefined undefined;
extern ScripterExport Undefined dontCollect;
extern ScripterExport Undefined loopExit;
/* ----- */
#ifndef DOXYGEN
visible_class_debug_ok (Ok)
#endif
class Ok : public Value
{
public:
Ok() { tag = &Ok_class; }
classof_methods (Ok, Value);
void collect();
ScripterExport void sprin1(CharStream* s);
Value* copy_vf(Value** arg_list, int count) { return this; }
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
void to_fpvalue(FPValue& v);
};
extern ScripterExport Ok ok;
/* ----- */
#ifndef DOXYGEN
visible_class_debug_ok (Empty)
#endif
class Empty : public Value
{
public:
Empty() { tag = &Empty_class; }
classof_methods (Empty, Value);
void collect();
ScripterExport void sprin1(CharStream* s);
Value* copy_vf(Value** arg_list, int count) { return this; }
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
void to_fpvalue(FPValue& v);
};
extern ScripterExport Empty empty;
/* ----- */
#ifndef DOXYGEN
visible_class_debug_ok (Unsupplied)
#endif
class Unsupplied : public Value
{
public:
Unsupplied() { tag = &Unsupplied_class; }
classof_methods (Unsupplied, Value);
void collect();
ScripterExport void sprin1(CharStream* s);
Value* copy_vf(Value** arg_list, int count) { return this; }
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
void to_fpvalue(FPValue& v);
};
extern ScripterExport Unsupplied unsupplied;
/* ----- */
#ifndef DOXYGEN
visible_class_debug_ok (NoValue)
#endif
/*
The Class NoValue is for the Max Script function returning silent value, no output and printing log,
even without printing "OK" and "\n".
*/
class NoValue : public Value
{
public:
NoValue() { tag = &NoValue_class; }
classof_methods (NoValue, Value);
void collect();
ScripterExport void sprin1(CharStream* s);
Value* copy_vf(Value** arg_list, int count) { return this; }
// scene I/O
IOResult Save(ISave* isave);
static Value* Load(ILoad* iload, USHORT chunkID, ValueLoader* vload);
void to_fpvalue(FPValue& v);
ScripterExport virtual void sprint(CharStream* stream);
};
#pragma warning(pop)
extern ScripterExport NoValue noValue; | [
"bingeun@dreamwiz.com"
] | bingeun@dreamwiz.com |
82eada3a6b51ca7aa0ae6abdf19ec240563da625 | defaedbe4fa7d8d8a5df5062e14fe259aaabe6d5 | /include/boost_helpers/make_submodules.hpp | d8af42296bf87aae9894c3e0a2c8dd9cd2cfb49f | [] | no_license | alexleach/bp_helpers | 5cfa858066577eacd8d2f58de172678e16e7ca6f | 1e945706fc39905e8b9f6941a486175800a60c75 | refs/heads/master | 2021-01-02T08:47:01.169546 | 2013-05-24T13:49:30 | 2013-05-24T13:49:30 | 9,748,028 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,381 | hpp | /// make_submodules.hpp
//
// Preprocessor macros for defining sub-package namespaces. These are used to
// organise the Blast+ wrapper classes into a better arranged package namespace.
#include <boost/python/borrowed.hpp>
#include <boost/python/object.hpp>
// The only difference between the macros is the number of registry
// functions they can call from the same macro. If more Boost.Python
// registration functions need to be added to a single namespace, then
// create another macro supporting that number of arguments.
//! BLAST_PYTHON_SUBMODULE
// @param NAME.
// The name of submodule to create within the module-level namespace
// @param INIT
// Function to call, which contains Boost.Python definitions
#define BLAST_PYTHON_SUBMODULE(NAME, INIT) \
{ \
std::string NAME ## _name = module_name + "." #NAME ; \
boost::python::object NAME(boost::python::borrowed( \
PyImport_AddModule(NAME ## _name.c_str() )) ); \
module.attr(#NAME) = NAME; \
{ \
boost::python::scope NAME ## _scope = NAME ; \
INIT(); \
} \
}
//! BLAST_PYTHON_SUBMODULE2
// Same as above, but calls two Boost.Python registry functions.
#define BLAST_PYTHON_SUBMODULE2(NAME, INIT, INIT2) \
{ \
std::string NAME ## _name = module_name + "." #NAME ; \
boost::python::object NAME(boost::python::borrowed( \
PyImport_AddModule(NAME ## _name.c_str() )) ); \
module.attr(#NAME) = NAME; \
{ \
boost::python::scope NAME ## _scope = NAME ; \
INIT(); \
INIT2(); \
} \
}
//! BLAST_PYTHON_SUBMODULE3
// Same as above, but calls three Boost.Python registry functions.
#define BLAST_PYTHON_SUBMODULE3(NAME, INIT, INIT2, INIT3) \
{ \
std::string NAME ## _name = module_name + "." #NAME ; \
boost::python::object NAME(boost::python::borrowed( \
PyImport_AddModule(NAME ## _name.c_str() )) ); \
module.attr(#NAME) = NAME; \
{ \
boost::python::scope NAME ## _scope = NAME ; \
INIT(); \
INIT2(); \
INIT3(); \
} \
}
//! BLAST_PYTHON_SUBMODULE4
// Same as above, but calls four Boost.Python registry functions.
#define BLAST_PYTHON_SUBMODULE4(NAME, INIT, INIT2, INIT3, INIT4) \
{ \
std::string NAME ## _name = module_name + "." #NAME ; \
boost::python::object NAME(boost::python::borrowed( \
PyImport_AddModule(NAME ## _name.c_str() )) ); \
module.attr(#NAME) = NAME; \
{ \
boost::python::scope NAME ## _scope = NAME ; \
INIT(); \
INIT2(); \
INIT3(); \
INIT4(); \
} \
}
//! BLAST_PYTHON_SUBMODULE5
// Same as above, but calls five Boost.Python registry functions.
#define BLAST_PYTHON_SUBMODULE5(NAME, INIT, INIT2, INIT3, INIT4, \
INIT5) \
{ \
std::string NAME ## _name = module_name + "." #NAME ; \
boost::python::object NAME(boost::python::borrowed( \
PyImport_AddModule(NAME ## _name.c_str() )) ); \
module.attr(#NAME) = NAME; \
{ \
boost::python::scope NAME ## _scope = NAME ; \
INIT(); \
INIT2(); \
INIT3(); \
INIT4(); \
INIT5(); \
} \
}
| [
"beamesleach@gmail.com"
] | beamesleach@gmail.com |
8d4ca24875ced9a4bcff53558efdaad2fad3201e | e85bc7dd450c3ad6e451d3d10fd1260238bb87f1 | /binaryNode.h | f409cdf81aeae3be8485cbcc4c4e992f6ed7ab17 | [] | no_license | nicholas-leung-1/cs3345-p1-AVLTree | 31a9e43f0b46cdabd37f05be8b807b60f99c0509 | 8a44bfc782c0fe1fb89e6c0e4194c179f16d1098 | refs/heads/master | 2020-05-09T15:40:37.848677 | 2019-04-14T00:38:11 | 2019-04-14T00:38:11 | 181,241,998 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,823 | h | /*
* binaryNode.h
*
* Created on: Feb 28, 2019
* Author: Nicholas Leung
* nml170001
*/
#ifndef BINARYNODE_H_
#define BINARYNODE_H_
#include <string>
#include <iostream>
#include "book.h"
// Node for binary tree
class binaryNode
{
public:
// Key
std::string key;
// Book value
book value;
// Node height
int height;
// Hidden key for random insertion
int hiddenKey;
// Children
binaryNode *leftPtr;
binaryNode *rightPtr;
// Constructors
binaryNode();
binaryNode(std::string aKey, book aValue, int aHidden, binaryNode *aLeftPtr, binaryNode *aRightPtr);
binaryNode(std::string aKey, book aValue, int aHeight, int aHidden, binaryNode *aLeftPtr, binaryNode *aRightPtr);
// Functions
void displayNode();
};
// Default construction
binaryNode::binaryNode()
: key(), value(), height(), hiddenKey(), leftPtr(), rightPtr()
{
}
// Constructor with 5 variables
binaryNode::binaryNode(std::string aKey, book aValue, int aHiddenKey, binaryNode *aLeftPtr, binaryNode *aRightPtr)
{
key = aKey;
value = aValue;
height = -1;
hiddenKey = aHiddenKey;
leftPtr = aLeftPtr;
rightPtr = aRightPtr;
}
// Constructor with 6 variables
binaryNode::binaryNode(std::string aKey, book aValue, int aHeight, int aHiddenKey, binaryNode *aLeftPtr, binaryNode *aRightPtr)
{
key = aKey;
value = aValue;
height = aHeight;
hiddenKey = aHiddenKey;
leftPtr = aLeftPtr;
rightPtr = aRightPtr;
}
// Display node properties
void binaryNode::displayNode()
{
std::cout << std::endl;
std::cout << "ISBN: " << key << std::endl;
std::cout << "Title: " << value.title << std::endl;
std::cout << "Author: " << value.name << std::endl;
std::cout << "Height: " << height << std::endl;
}
#endif /* BINARYNODE_H_ */
| [
"noreply@github.com"
] | nicholas-leung-1.noreply@github.com |
f45863ef978eb5102a273c8742de5616b6e120b4 | c0376f9eb4eb1adf2db5aff3d25abc3576d0241b | /src/plugins/azoth/interfaces/azoth/imessage.h | 62d339df6ef206a807c72dc4737e04abfb197efe | [
"BSL-1.0"
] | permissive | ROOAARR/leechcraft | 0179e6f1e7c0b7afbfcce60cb810d61bd558b163 | 14bc859ca750598b77abdc8b2d5b9647c281d9b3 | refs/heads/master | 2021-01-17T22:08:16.273024 | 2013-08-05T12:28:45 | 2013-08-05T12:28:45 | 2,217,574 | 1 | 0 | null | 2013-01-19T15:32:47 | 2011-08-16T18:55:44 | C++ | UTF-8 | C++ | false | false | 9,140 | h | /**********************************************************************
* LeechCraft - modular cross-platform feature rich internet client.
* Copyright (C) 2006-2013 Georg Rudoy
*
* Boost Software License - Version 1.0 - August 17th, 2003
*
* Permission is hereby granted, free of charge, to any person or organization
* obtaining a copy of the software and accompanying documentation covered by
* this license (the "Software") to use, reproduce, display, distribute,
* execute, and transmit the Software, and to prepare derivative works of the
* Software, and to permit third-parties to whom the Software is furnished to
* do so, all subject to the following:
*
* The copyright notices in the Software and this entire statement, including
* the above license grant, this restriction and the following disclaimer,
* must be included in all copies of the Software, in whole or in part, and
* all derivative works of the Software, unless such copies or derivative
* works are solely in the form of machine-executable object code generated by
* a source language processor.
*
* 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
* SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
* FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
**********************************************************************/
#ifndef PLUGINS_AZOTH_INTERFACES_IMESSAGE_H
#define PLUGINS_AZOTH_INTERFACES_IMESSAGE_H
#include <QString>
#include <QDateTime>
#include <QtPlugin>
class QObject;
namespace LeechCraft
{
namespace Azoth
{
class ICLEntry;
/** @brief This interface is used to represent a message.
*
* Refer to the MessageType enum for the list of possible message
* types that are covered by this interface.
*
* The message should not be sent upon creation, only call to Send()
* should trigger the sending.
*
* This interface provides only more or less basic functionality.
* Advanced features like delivery receipts and such, are in
* IAdvancedMessage.
*
* Messages implementing this interface are expected to contain only
* plain text bodies. If a message may also contain rich text, it
* should implement the IRichTextMessage interface.
*
* @sa IAdvancedMessage, IRichTextMessage.
*/
class IMessage
{
public:
virtual ~IMessage () {};
/** @brief Represents the direction of the message.
*/
enum Direction
{
/** @brief The message is from the remote party to us.
*/
DIn,
/** @brief The message is from us to the remote party.
*/
DOut
};
/** @brief Represents possible message types.
*/
enum MessageType
{
/** @brief Standard one-to-one message.
*/
MTChatMessage,
/** @brief Message in a multiuser conference.
*
* This kind of message is only for messages that originate
* from participants and are human-generated. Thus, status
* changes, topic changes and such should have a different
* type.
*/
MTMUCMessage,
/** @brief Status changes in a chat.
*
* This type of message contains information about
* participant's status/presence changes.
*/
MTStatusMessage,
/** @brief Various events in a chat.
*
* Messages of this type are for notifying about, for
* example, topic changes, kicks, bans, etc. Generally,
* there is no other part in such messages, so the message
* of this type can return NULL from OtherPart().
*/
MTEventMessage,
/** @brief Other.
*/
MTServiceMessage
};
/** @brief This enum is used for more precise classification of
* chat types messages.
*
* The messages of some particular types may have additional
* required properties used by the Azoth Core and other plugins
* to establish proper context for the events.
*/
enum MessageSubType
{
/** This message is of subtype that doesn't correspond to
* any other subtype of message.
*/
MSTOther,
/** This message notifies about someone being just kicked.
*/
MSTKickNotification,
/** This message notifies about someone being just banned.
*/
MSTBanNotification,
/** @brief Represents status change of a participant in a
* chat or MUC room.
*
* The corresponding MessageType is MTStatusMessage.
*
* Messages of this type should have the following dynamic
* properties:
* - Azoth/Nick, with a QString representing nick of the
* participant that has changed its status.
* - Azoth/TargetState, with a QString representing the
* target state. The string is better obtained from the
* State enum by the means of IProxyObject::StateToString
* method.
* - Azoth/StatusText, with a QString representing the new
* status text of the participant. May be empty.
*/
MSTParticipantStatusChange,
/** @brief Represents permission changes of a participant in
* a chat or MUC room.
*/
MSTParticipantRoleAffiliationChange,
/** @brief Notifies about participant joining to a MUC room.
*/
MSTParticipantJoin,
/** @brief Notifies about participant leaving a MUC room.
*/
MSTParticipantLeave,
/** @brief Notifies about participant in a MUC changing the
* nick.
*/
MSTParticipantNickChange,
/** @brief The participant has ended the conversation.
*/
MSTParticipantEndedConversation,
/** @brief Notifies about changing subject in a MUC room.
*/
MSTRoomSubjectChange
};
/** @brief Returns this message as a QObject.
*/
virtual QObject* GetQObject () = 0;
/** @brief Sends the message.
*
* A message should never be sent except as the result of this
* method.
*
* Please note that if the other part is a MUC, it should send
* back this message with the "IN" direction set.
*/
virtual void Send () = 0;
/** @brief Stores the message.
*
* After calling this function this message should be present in
* the messages list returned by ICLEntry::GetAllMessages(), but
* the message shouldn't be sent.
*
* @sa ICLEntry::GetAllMessages()
*/
virtual void Store () = 0;
/** @brief Returns the direction of this message.
*
* @return The direction of this message.
*/
virtual Direction GetDirection () const = 0;
/** @brief Returns the type of this message.
*
* @return The type of this message.
*/
virtual MessageType GetMessageType () const = 0;
/** @brief Returns the subtype of this message.
*
* The subtype is used for more precise classification of
* messages.
*
* @return The subtype of this message
*/
virtual MessageSubType GetMessageSubType () const = 0;
/** @brief Returns the CL entry from which this message is.
*
* For normal, single user chats, this should always be equal to
* the ICLEntry that was (and will be) used to send the message
* back.
*
* For multiuser chats this should be equal to the contact list
* representation of the participant that sent the message.
*
* The returned object must implement ICLEntry.
*
* @return The CL entry from which this message originates,
* implementing ICLEntry.
*/
virtual QObject* OtherPart () const = 0;
/** @brief Returns the parent CL entry of this message.
*
* This is the same that OtherPart() for single user chats. For
* multiuser chats it should be the contact list entry
* representing the MUC room.
*
* By default this function calls OtherPart() and returns its
* result.
*
* The returned object must implement ICLEntry.
*
* @return The parent CL entry of this message, implementing
* ICLEntry.
*/
virtual QObject* ParentCLEntry () const
{
return OtherPart ();
}
/** @brief The variant of the other part.
*
* If not applicable, a null string should be returned.
*
* @return The variant of the other part.
*/
virtual QString GetOtherVariant () const = 0;
/** @brief Returns the body of the message.
*
* The body is expected to be a plain text string. All '<' and
* '&' will be escaped.
*
* @return The body of the message.
*/
virtual QString GetBody () const = 0;
/** @brief Updates the body of the message.
*
* The passed string is the plain text contents of the message.
*
* @param[in] body The new body of the message.
*/
virtual void SetBody (const QString& body) = 0;
/** @brief Returns the timestamp of the message.
*
* @return The timestamp of the message.
*/
virtual QDateTime GetDateTime () const = 0;
/** @brief Updates the timestamp of the message.
*
* @param[in] timestamp The new timestamp of the message.
*/
virtual void SetDateTime (const QDateTime& timestamp) = 0;
};
}
}
Q_DECLARE_INTERFACE (LeechCraft::Azoth::IMessage,
"org.Deviant.LeechCraft.Azoth.IMessage/1.0");
#endif
| [
"0xd34df00d@gmail.com"
] | 0xd34df00d@gmail.com |
d8c158fa663afb5f6f53c95012c6b2157157ae51 | f564812d6af97ad53cf3ad3d0c483caecc0042b6 | /ColliderComponent.h | f440145de0c89f003f889b2693e77689b3c922e3 | [] | no_license | quatros96/pjc_projekt_gra | ea711a4c8112213c55cc88568ff5b7a925562bd2 | 11f320d64d624a605376ce2c585cfc9d7f3403b1 | refs/heads/master | 2022-12-04T07:09:32.985595 | 2020-09-01T21:51:32 | 2020-09-01T21:51:32 | 287,938,061 | 0 | 0 | null | 2020-09-01T21:51:33 | 2020-08-16T12:19:44 | C++ | UTF-8 | C++ | false | false | 552 | h | #pragma once
#include "Component.h"
#include <iostream>
class ColliderComponent : public Component
{
private:
std::string m_Type = "collider";
bool m_Enabled {false};
public:
std::string getType() override
{
return m_Type;
}
void disableComponent() override
{
m_Enabled = false;
}
void enableComponent() override
{
m_Enabled = true;
}
bool enabled() override
{
return m_Enabled;
}
void start(GameObjectSharer* gos, GameObject* self) override
{
}
};
| [
"01129810@pw.edu.pl"
] | 01129810@pw.edu.pl |
ada8e9fca5e8aa1b203d46b9f45d9c1a0a1611de | 8f6569bfb705009b4bead5a9c79730e63d48867e | /src/folly/IPAddress.cpp | c776bc1c76da29c795f1bca2d4f3b80a68cd9015 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | HungMingWu/futures_cpp | ff13e965011f86faa31d42657d0a4671f4b00dd6 | 0e24378c1b989cb7c6115169010577f70aae3c64 | refs/heads/master | 2021-05-12T14:45:10.630137 | 2018-01-11T09:03:17 | 2018-01-11T09:03:17 | 116,111,766 | 0 | 0 | null | 2018-01-03T08:26:30 | 2018-01-03T08:26:29 | null | UTF-8 | C++ | false | false | 12,543 | cpp | /*
* Copyright 2016 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <futures/core/IPAddress.h>
#include <limits>
#include <ostream>
#include <string>
#include <vector>
#include "GlogDummy.h"
using std::ostream;
using std::string;
using std::vector;
namespace folly {
// free functions
size_t hash_value(const IPAddress& addr) {
return addr.hash();
}
ostream& operator<<(ostream& os, const IPAddress& addr) {
os << addr.str();
return os;
}
void toAppend(IPAddress addr, string* result) {
result->append(addr.str());
}
#if 0
void toAppend(IPAddress addr, fbstring* result) {
result->append(addr.str());
}
#endif
bool IPAddress::validate(StringPiece ip) {
return IPAddressV4::validate(ip) || IPAddressV6::validate(ip);
}
// public static
IPAddressV4 IPAddress::createIPv4(const IPAddress& addr) {
if (addr.isV4()) {
return addr.asV4();
} else {
return addr.asV6().createIPv4();
}
}
// public static
IPAddressV6 IPAddress::createIPv6(const IPAddress& addr) {
if (addr.isV6()) {
return addr.asV6();
} else {
return addr.asV4().createIPv6();
}
}
void split(const string &delim, StringPiece str, vector<StringPiece> &v)
{
size_t prev = 0, pos = 0;
do
{
pos = str.find(delim, prev);
if (pos == string::npos) pos = str.size();
auto token = str.subpiece(prev, pos-prev);
if (!token.empty()) v.push_back(token);
prev = pos + delim.length();
}
while (pos < str.size() && prev < str.size());
}
// public static
CIDRNetwork IPAddress::createNetwork(StringPiece ipSlashCidr,
int defaultCidr, /* = -1 */
bool applyMask /* = true */) {
if (defaultCidr > std::numeric_limits<uint8_t>::max()) {
throw std::range_error("defaultCidr must be <= UINT8_MAX");
}
vector<StringPiece> vec;
split("/", ipSlashCidr, vec);
vector<string>::size_type elemCount = vec.size();
if (elemCount == 0 || // weird invalid string
elemCount > 2) { // invalid string (IP/CIDR/extras)
throw IPAddressFormatException("Invalid ipSlashCidr specified. "
"Expected IP/CIDR format, got "
"'" + ipSlashCidr.str() + "'");
}
IPAddress subnet(vec.at(0));
uint8_t cidr = (defaultCidr > -1) ? defaultCidr : (subnet.isV4() ? 32 : 128);
if (elemCount == 2) {
try {
cidr = std::atoi(vec.at(1).str().c_str());
} catch (...) {
throw IPAddressFormatException("Mask value "
"'" + vec.at(1).str() + "' not a valid mask");
}
}
if (cidr > subnet.bitCount()) {
throw IPAddressFormatException("CIDR value '" + std::to_string(cidr) + "' "
"is > network bit count "
"'" + std::to_string(subnet.bitCount()) + "'");
}
return std::make_pair(applyMask ? subnet.mask(cidr) : subnet, cidr);
}
// public static
IPAddress IPAddress::fromBinary(ByteRange bytes) {
if (bytes.size() == 4) {
return IPAddress(IPAddressV4::fromBinary(bytes));
} else if (bytes.size() == 16) {
return IPAddress(IPAddressV6::fromBinary(bytes));
} else {
string hexval = detail::Bytes::toHex(bytes.data(), bytes.size());
throw IPAddressFormatException("Invalid address with hex value '" +
hexval + "'");
}
}
// public static
IPAddress IPAddress::fromLong(uint32_t src) {
return IPAddress(IPAddressV4::fromLong(src));
}
IPAddress IPAddress::fromLongHBO(uint32_t src) {
return IPAddress(IPAddressV4::fromLongHBO(src));
}
// default constructor
IPAddress::IPAddress()
: addr_()
, family_(AF_UNSPEC)
{
}
// public string constructor
IPAddress::IPAddress(StringPiece addr)
: addr_()
, family_(AF_UNSPEC)
{
string ip = addr.str(); // inet_pton() needs NUL-terminated string
auto throwFormatException = [&](const string& msg) {
throw IPAddressFormatException("Invalid IP '" + ip+ "': " + msg);
};
if (ip.size() < 2) {
throwFormatException("address too short");
}
if (ip.front() == '[' && ip.back() == ']') {
ip = ip.substr(1, ip.size() - 2);
}
// need to check for V4 address second, since IPv4-mapped IPv6 addresses may
// contain a period
if (ip.find(':') != string::npos) {
struct addrinfo* result;
struct addrinfo hints;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_INET6;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_NUMERICHOST;
if (!getaddrinfo(ip.c_str(), nullptr, &hints, &result)) {
struct sockaddr_in6* ipAddr = (struct sockaddr_in6*)result->ai_addr;
addr_ = IPAddressV46(IPAddressV6(*ipAddr));
family_ = AF_INET6;
freeaddrinfo(result);
} else {
throwFormatException("getsockaddr failed for V6 address");
}
} else if (ip.find('.') != string::npos) {
in_addr ipAddr;
if (inet_pton(AF_INET, ip.c_str(), &ipAddr) != 1) {
throwFormatException("inet_pton failed for V4 address");
}
addr_ = IPAddressV46(IPAddressV4(ipAddr));
family_ = AF_INET;
} else {
throwFormatException("invalid address format");
}
}
// public sockaddr constructor
IPAddress::IPAddress(const sockaddr* addr)
: addr_()
, family_(AF_UNSPEC)
{
if (addr == nullptr) {
throw IPAddressFormatException("sockaddr == nullptr");
}
family_ = addr->sa_family;
switch (addr->sa_family) {
case AF_INET: {
const sockaddr_in *v4addr = reinterpret_cast<const sockaddr_in*>(addr);
addr_.ipV4Addr = IPAddressV4(v4addr->sin_addr);
break;
}
case AF_INET6: {
const sockaddr_in6 *v6addr = reinterpret_cast<const sockaddr_in6*>(addr);
addr_.ipV6Addr = IPAddressV6(*v6addr);
break;
}
default:
throw InvalidAddressFamilyException(addr->sa_family);
}
}
// public ipv4 constructor
IPAddress::IPAddress(const IPAddressV4 ipV4Addr)
: addr_(ipV4Addr)
, family_(AF_INET)
{
}
// public ipv4 constructor
IPAddress::IPAddress(const in_addr ipV4Addr)
: addr_(IPAddressV4(ipV4Addr))
, family_(AF_INET)
{
}
// public ipv6 constructor
IPAddress::IPAddress(const IPAddressV6& ipV6Addr)
: addr_(ipV6Addr)
, family_(AF_INET6)
{
}
// public ipv6 constructor
IPAddress::IPAddress(const in6_addr& ipV6Addr)
: addr_(IPAddressV6(ipV6Addr))
, family_(AF_INET6)
{
}
// Assign from V4 address
IPAddress& IPAddress::operator=(const IPAddressV4& ipv4_addr) {
addr_ = IPAddressV46(ipv4_addr);
family_ = AF_INET;
return *this;
}
// Assign from V6 address
IPAddress& IPAddress::operator=(const IPAddressV6& ipv6_addr) {
addr_ = IPAddressV46(ipv6_addr);
family_ = AF_INET6;
return *this;
}
// public
bool IPAddress::inSubnet(StringPiece cidrNetwork) const {
auto subnetInfo = IPAddress::createNetwork(cidrNetwork);
return inSubnet(subnetInfo.first, subnetInfo.second);
}
// public
bool IPAddress::inSubnet(const IPAddress& subnet, uint8_t cidr) const {
if (bitCount() == subnet.bitCount()) {
if (isV4()) {
return asV4().inSubnet(subnet.asV4(), cidr);
} else {
return asV6().inSubnet(subnet.asV6(), cidr);
}
}
// an IPv4 address can never belong in a IPv6 subnet unless the IPv6 is a 6to4
// address and vice-versa
if (isV6()) {
const IPAddressV6& v6addr = asV6();
const IPAddressV4& v4subnet = subnet.asV4();
if (v6addr.is6To4()) {
return v6addr.getIPv4For6To4().inSubnet(v4subnet, cidr);
}
} else if (subnet.isV6()) {
const IPAddressV6& v6subnet = subnet.asV6();
const IPAddressV4& v4addr = asV4();
if (v6subnet.is6To4()) {
return v4addr.inSubnet(v6subnet.getIPv4For6To4(), cidr);
}
}
return false;
}
// public
bool IPAddress::inSubnetWithMask(const IPAddress& subnet,
ByteRange mask) const {
auto mkByteArray4 = [&]() -> ByteArray4 {
ByteArray4 ba{{0}};
std::memcpy(ba.data(), mask.begin(), std::min<size_t>(mask.size(), 4));
return ba;
};
if (bitCount() == subnet.bitCount()) {
if (isV4()) {
return asV4().inSubnetWithMask(subnet.asV4(), mkByteArray4());
} else {
ByteArray16 ba{{0}};
std::memcpy(ba.data(), mask.begin(), std::min<size_t>(mask.size(), 16));
return asV6().inSubnetWithMask(subnet.asV6(), ba);
}
}
// an IPv4 address can never belong in a IPv6 subnet unless the IPv6 is a 6to4
// address and vice-versa
if (isV6()) {
const IPAddressV6& v6addr = asV6();
const IPAddressV4& v4subnet = subnet.asV4();
if (v6addr.is6To4()) {
return v6addr.getIPv4For6To4().inSubnetWithMask(v4subnet, mkByteArray4());
}
} else if (subnet.isV6()) {
const IPAddressV6& v6subnet = subnet.asV6();
const IPAddressV4& v4addr = asV4();
if (v6subnet.is6To4()) {
return v4addr.inSubnetWithMask(v6subnet.getIPv4For6To4(), mkByteArray4());
}
}
return false;
}
uint8_t IPAddress::getNthMSByte(size_t byteIndex) const {
const auto highestIndex = byteCount() - 1;
if (byteIndex > highestIndex) {
throw std::invalid_argument("Byte index must be <= " +
std::to_string(highestIndex) + " for addresses of type :" +
detail::familyNameStr(family()));
}
if (isV4()) {
return asV4().bytes()[byteIndex];
}
return asV6().bytes()[byteIndex];
}
// public
bool operator==(const IPAddress& addr1, const IPAddress& addr2) {
if (addr1.family() == addr2.family()) {
if (addr1.isV6()) {
return (addr1.asV6() == addr2.asV6());
} else if (addr1.isV4()) {
return (addr1.asV4() == addr2.asV4());
} else {
CHECK_EQ(addr1.family(), AF_UNSPEC);
// Two default initialized AF_UNSPEC addresses should be considered equal.
// AF_UNSPEC is the only other value for which an IPAddress can be
// created, in the default constructor case.
return true;
}
}
// addr1 is v4 mapped v6 address, addr2 is v4
if (addr1.isIPv4Mapped() && addr2.isV4()) {
if (IPAddress::createIPv4(addr1) == addr2.asV4()) {
return true;
}
}
// addr2 is v4 mapped v6 address, addr1 is v4
if (addr2.isIPv4Mapped() && addr1.isV4()) {
if (IPAddress::createIPv4(addr2) == addr1.asV4()) {
return true;
}
}
// we only compare IPv4 and IPv6 addresses
return false;
}
bool operator<(const IPAddress& addr1, const IPAddress& addr2) {
if (addr1.family() == addr2.family()) {
if (addr1.isV6()) {
return (addr1.asV6() < addr2.asV6());
} else if (addr1.isV4()) {
return (addr1.asV4() < addr2.asV4());
} else {
CHECK_EQ(addr1.family(), AF_UNSPEC);
// Two default initialized AF_UNSPEC addresses can not be less than each
// other. AF_UNSPEC is the only other value for which an IPAddress can be
// created, in the default constructor case.
return false;
}
}
if (addr1.isV6()) {
// means addr2 is v4, convert it to a mapped v6 address and compare
return addr1.asV6() < addr2.asV4().createIPv6();
}
if (addr2.isV6()) {
// means addr2 is v6, convert addr1 to v4 mapped and compare
return addr1.asV4().createIPv6() < addr2.asV6();
}
return false;
}
CIDRNetwork
IPAddress::longestCommonPrefix(const CIDRNetwork& one, const CIDRNetwork& two) {
if (one.first.family() != two.first.family()) {
throw std::invalid_argument("Can't compute longest common prefix between addresses of different families. Passed: " + detail::familyNameStr(one.first.family()) + " and " +
detail::familyNameStr(two.first.family()));
}
if (one.first.isV4()) {
auto prefix = IPAddressV4::longestCommonPrefix(
{one.first.asV4(), one.second},
{two.first.asV4(), two.second});
return {IPAddress(prefix.first), prefix.second};
} else if (one.first.isV6()) {
auto prefix = IPAddressV6::longestCommonPrefix(
{one.first.asV6(), one.second},
{two.first.asV6(), two.second});
return {IPAddress(prefix.first), prefix.second};
} else {
throw std::invalid_argument("Unknown address family");
}
return {IPAddress(0), 0};
}
} // folly
| [
"yuhengchen@sensetime.com"
] | yuhengchen@sensetime.com |
d947413f04c72746bcf9d58c64103afdffa5f6d5 | 49999d127be6f1bf2d05a5f75b6c4ae8739f974f | /MyProject/mainwindow.cpp | 6dbf9380da77372835149cb9808b56c5655f438a | [] | no_license | krampus1/laba1.2-2sem | d61c98b2a844bc0d883dd2949382fe77e08b99b4 | bafbc3ff626a8b941dfeaebe789bd9aff5102bd4 | refs/heads/master | 2022-10-19T16:49:35.687601 | 2020-06-09T18:31:24 | 2020-06-09T18:31:24 | 271,080,139 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,647 | cpp | #include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QMessageBox>
bigdata world;
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
test_setup();
w1 = new AddCountry();
w2 = new additem();
w3 = new InfoCountry();
w4 = new InfoItem();
connect(w1, SIGNAL(SendCountryName(QString)), this, SLOT(RecieveCountryName(QString)));
connect(w2, SIGNAL(SendItemName(QString)), this, SLOT(RecieveItemName(QString)));
connect(this, SIGNAL(SendCountryName(QString)), w3, SLOT(RecieveCountryName(QString)));
connect(this, SIGNAL(SendBigData(bigdata*)), w3, SLOT(RecieveBigData(bigdata*)));
connect(this, SIGNAL(SendItem(item*)), w4, SLOT(RecieveItem(item*)));
connect(this, SIGNAL(SendBigData(bigdata*)), w4, SLOT(RecieveBigData(bigdata*)));
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::test_setup()
{
world.ad_country("Ukraine");
world.ad_country("USA");
world.ad_country("France");
world.ad_country("Spain");
world.ad_country("German");
world.ad_country("China");
CountriesUpdate();
world.ad_item("Iron");
world.ad_item("Car");
world.ad_item("Glass");
world.ad_item("Window");
world.ad_item("Plastic");
world.ad_item("Pen");
world.ad_item("Wood");
world.ad_item("Table");
world.ad_item("Rubber");
world.ad_item("Tire");
world.ad_item("Silk");
world.ad_item("Skirt");
ItemsUpdate();
}
void MainWindow::on_pushButton_clicked()
{
w1->show();
}
void MainWindow::on_pushButton_2_clicked()
{
w2->show();
}
void MainWindow::CountriesUpdate(){
ui->listWidget->clear();
for (auto i = world.countries.begin(); i != world.countries.end(); i++){
ui->listWidget->addItem(i->name);
}
}
void MainWindow::ItemsUpdate(){
ui->listWidget_2->clear();
for (auto i = world.items.begin(); i != world.items.end(); i++){
ui->listWidget_2->addItem(i->name);
}
}
void MainWindow::RecieveCountryName(QString str){
if (world.search_country(str) == nullptr){
world.ad_country(str);
CountriesUpdate();
}
}
void MainWindow::RecieveItemName(QString str){
if (world.search_item(str) == nullptr){
world.ad_item(str);
ItemsUpdate();
}
}
void MainWindow::on_listWidget_itemActivated(QListWidgetItem *item)
{
w3->show();
emit SendBigData(&world);
emit SendCountryName(item->text());
}
void MainWindow::on_listWidget_2_itemActivated(QListWidgetItem *item)
{
w4->show();
emit SendBigData(&world);
emit SendItem(world.search_item(item->text()));
}
| [
"noreply@github.com"
] | krampus1.noreply@github.com |
669bb0ba08a117edec5266276f26c34e79cd1fb6 | 28831c88364813222cc2746c7feac5761b709f8d | /Project_2/Project1/CandidateType.h | d0aa20bf1cdb445dc690d481ab0f99ae1ebe24dc | [] | no_license | williamblood/kingdoms | 85fd648498fbe9b5a7726e8412603da3ceff49e6 | e6a86f6fdb88301a0f8b3c53399b5a18aa36cde9 | refs/heads/master | 2022-07-24T18:31:37.266402 | 2020-05-22T04:35:30 | 2020-05-22T04:35:30 | 264,338,581 | 0 | 3 | null | 2020-05-16T08:31:33 | 2020-05-16T01:57:33 | C++ | UTF-8 | C++ | false | false | 1,153 | h | /*
KaibaCorp
Bearden, Reese (TTh 6:30)
Blood, William (TTh 6:30)
Diep, Vincent (TTh 2:20)
Huynh, Andy (TTh 6:30)
Nguyen, Andrew (MW 11:10)
May 12, 2020
CS A250
Project 2
*/
#ifndef CANDIDATETYPE_H
#define CANDIDATETYPE_H
#include "CharacterType.h"
const int NUM_OF_KINGDOMS = 7; // this is the capacity of the array
const std::string KINGDOMS[] = {
"The North",
"The Vale",
"The Stormlands",
"The Reach",
"The Westerlands",
"The Iron Islands",
"Dorne"
};
class CandidateType : public CharacterType
{
public:
// Default constructor
CandidateType();
// Copy constructor
CandidateType(const CandidateType& other);
// Copy assignment operator
CandidateType& operator=(const CandidateType& other);
// updateVotesByKingdom
void updateVotesByKingdom(int index, int numOfVotes);
// getTotalVotes
int getTotalVotes() const;
// getVotesByKingdom
int getVotesByKingdom(int index) const;
// printCandidateInfo
void printCandidateInfo() const;
// printCandidateTotalVotes
void printCandidateTotalVotes() const;
// Destructor
~CandidateType();
private:
int totalVotes;
int numOfKingdoms;
int* kingdomVotes;
};
#endif | [
"w.blood@icloud.com"
] | w.blood@icloud.com |
6d4ec4fc980953f0abfd89b029c56e770866544b | 86dae49990a297d199ea2c8e47cb61336b1ca81e | /数据结构/平衡树/splay/P4036.cpp | 11823b2a545cd02fdcc5421177bda89272f37c30 | [] | no_license | yingziyu-llt/OI | 7cc88f6537df0675b60718da73b8407bdaeb5f90 | c8030807fe46b27e431687d5ff050f2f74616bc0 | refs/heads/main | 2023-04-04T03:59:22.255818 | 2021-04-11T10:15:03 | 2021-04-11T10:15:03 | 354,771,118 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,550 | cpp | #include<stdio.h>
#include<algorithm>
#include<string.h>
#include<math.h>
using namespace std;
const int MAXN = 150010,MOD = 1e9+7;
struct node
{
int c[2],fa,val,siz,hash;
}a[MAXN];
int n,m,root,tot,power26[MAXN];
char s[MAXN];
int push_up(int x)
{
a[x].siz = a[a[x].c[0]].siz + 1 + a[a[x].c[1]].siz;
a[x].hash=(((long long)a[a[x].c[0]].hash*power26[a[a[x].c[1]].siz+1]%MOD+(long long)a[x].val*power26[a[a[x].c[1]].siz]%MOD)%MOD+a[a[x].c[1]].hash)%MOD;
}
void rotate(int &o,int x)
{
int y = a[x].fa,z = a[y].fa,dy = a[y].c[1] == x,dz = a[z].c[1] == y;
if(o == y) o = x;
else a[z].c[dz] = x;
a[x].fa = z;
a[y].c[dy] = a[x].c[dy ^ 1];
a[a[y].c[dy]].fa = y;
a[x].c[dy ^ 1] = y;
a[y].fa = x;
push_up(y);
}
void splay(int &o,int x)
{
while(o != x)
{
int y = a[x].fa,z = a[y].fa;
if(y != o)
{
if((a[y].c[1] == x) ^ (a[z].c[1] == y))
rotate(o,x);
else rotate(o,y);
}
rotate(o,x);
}
push_up(x);
return ;
}
int find(int o,int v)
{
if(v <= a[a[o].c[0]].siz) return find(a[o].c[0],v);
if(v <= a[a[o].c[0]].siz + 1) return o;
return find(a[o].c[1],v - a[a[o].c[0]].siz - 1);
}
int main()
{
scanf("%s",s + 1);
scanf("%d",&m);
n = strlen(s + 1);
power26[0] = 1;
for(int i = 1;i <= MAXN;i++) power26[i] = power26[i - 1] * 26 % MOD;
a[1].siz = n + 2,a[1].c[1] = 2;
a[n + 2].siz = 1;a[n + 2].fa = n + 1;
for(int i = 1;i <= n;i++)
a[i + 1] = (node){{0,i + 2},i,s[i] - 'a',n - i + 2,0},push_up(i + 1);
tot = n + 2,root = 1;
while(m--)
{
char ques[100];
scanf("%s",ques);
if(ques[0] == 'Q')
{
int x,y;
scanf("%d %d",&x,&y);
if(x > y) swap(x,y);
int l = 0,r = n - y + 2;
while(l < r - 1)
{
int mid = (l + r) >> 1;
splay(root,find(root,x));
splay(a[root].c[1],find(root,x + mid + 1));
int tmp = a[a[a[root].c[1]].c[0]].hash;
splay(root,find(root,y));
splay(a[root].c[1],find(root,y + mid + 1));
tmp -= a[a[a[root].c[1]].c[0]].hash;
if(tmp != 0) r = mid;
else l = mid;
}
printf("%d\n",l);
}
else if(ques[0] == 'R')
{
int x;
char c[10];
scanf("%d%s",&x,c);
splay(root,find(root,x + 1));
a[root].val = c[0] - 'a';
push_up(x);
}
else
{
int x;char c[10];
scanf("%d%s",&x,c);
splay(root,find(root,x + 1));
splay(a[root].c[1],find(root,x + 2));
a[a[root].c[1]].c[0] = ++tot;
a[tot] = (node){{0,0},a[root].c[1],c[0] - 'a',1,c[0] - 'a'};
push_up(a[root].c[1]);
push_up(root);
}
}
return 0;
} | [
"linletian1@sina.com"
] | linletian1@sina.com |
7f41662dfd07a667f4b04ca1e744f2081b8dfdab | 85299b50c36911427c47f49e84993ca0350be173 | /Cplus/Acwing/Dp/miniToll.cc | 962b637e50d3831b2e4b46fcf1921968a814d7a3 | [] | no_license | cogitates/Code | 15f4f5907478d4bd21ab3c7cc74f9afc3d6ae632 | d33d9bd99611a58b1192a23bc90d6f79253b5936 | refs/heads/master | 2021-05-18T07:28:33.140308 | 2020-06-27T12:16:34 | 2020-06-27T12:16:34 | 251,179,703 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 953 | cc | // 最低通行费用
// https://www.acwing.com/solution/acwing/content/5011/
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int N = 110; // 有限集数据规模
// 动态规划算法解决的是 **有限集中在给定约束条件下的最优化问题** 。
int cost[N][N]; // 给定约束
int f[N][N]; // 状态表示
int main(){
int n ;
cin >> n;
for(int i = 1;i <= n;i++){
for(int j = 1;j <= n;j++){
cin >> cost[i][j];
}
}
for(int i = 1;i <= n;i++){
for(int j = 1;j <= n;j++){
if(i == 1 && j == 1) f[i][j] = cost[i][j]; // 特判左上角
else{
f[i][j] = INF;
if(i > 1) f[i][j] = min(f[i][j],f[i-1][j] + cost[i][j]); // 不在第一行
if(j > 1) f[i][j] = min(f[i][j],f[i][j-1] + cost[i][j]); // 不在第一列
}
}
}
cout<< f[n][n] << endl;
return 0;
} | [
"weifengzxq@gmail.com"
] | weifengzxq@gmail.com |
866845d9580b971df2bca86bc03d9253b80d4a4f | 8f9b24cb78943c2fa139e9d02cd670e326e6cd39 | /Problems/160. Intersection of Two Linked Lists/Test.cpp | 727a3b839646f2a193a6065615d3dec9f59b797a | [
"MIT"
] | permissive | DanielDFY/LeetCode | a6e340936684abca4d22f1d02a49c4f2cf1cf920 | 5e39e3168db368617ac2f4509886f32cde5bd000 | refs/heads/master | 2021-07-16T16:04:11.759973 | 2020-09-20T15:03:14 | 2020-09-20T15:03:14 | 213,352,385 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 759 | cpp | #define CATCH_CONFIG_MAIN
#include "../../Utils/Cacth/single_include/catch2/catch.hpp"
#include "solution.h"
TEST_CASE("Intersection of Two Linked Lists")
{
Solution s;
SECTION("has intersection") {
ListNode a1(4);
ListNode a2(1);
ListNode b1(5);
ListNode b2(6);
ListNode b3(1);
ListNode c1(8);
ListNode c2(4);
ListNode c3(5);
a1.next = &a2;
a2.next = &c1;
b1.next = &b2;
b2.next = &b3;
b3.next = &c1;
c1.next = &c2;
c2.next = &c3;
CHECK(s.getIntersectionNode(&a1, &b1) == &c1);
}
SECTION("no intersection") {
ListNode a1(2);
ListNode a2(4);
ListNode a3(6);
ListNode b1(1);
ListNode b2(5);
a1.next = &a2;
a2.next = &a3;
b1.next = &b2;
CHECK(s.getIntersectionNode(&a1, &b1) == nullptr);
}
} | [
"daniel_dfy98@163.com"
] | daniel_dfy98@163.com |
7f8098a970f613d14f7781257bb0dae388c9ddd6 | 80816eb7fd304d652eab656d004a59246eda260d | /cpp-holy/exceptionEx.h | edb93d6ee55e6307e8e95db8651d1fae96a0e8d2 | [] | no_license | holy1017-cpp/cpp-holy | b264ac39787ed0759a84030607f4bcb031670197 | 223a69b5c52b8d1b7a3def04d677eda872587848 | refs/heads/master | 2022-12-10T16:34:06.161294 | 2020-09-19T08:30:55 | 2020-09-19T08:30:55 | 290,492,713 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 233 | h | #pragma once
#ifndef exceptionEx_H
#define exceptionEx_H
#include <exception>
using namespace std;
namespace exceptionEx {
class myException : public exception
{
virtual char const* what() const;
} ;
void test();
}
#endif | [
"holy1017@naver.com"
] | holy1017@naver.com |
4ed108c83eac8383ff15b07b3ac693dff6f262ab | e34dce6dee9f4c969bfdbe7e33285e875d128342 | /Src/AsyncDB/ADBError.h | 04dbc12203ec04e30ce1087bccf7443d7beb5c17 | [] | no_license | Rogni/AsyncDB | 4ba393c2790f7e2fe945be821c30ba9604c8f018 | c5f546d73b7845dd9316ab05c36c46ee8870d526 | refs/heads/master | 2020-08-01T20:47:36.468780 | 2019-10-17T12:36:59 | 2019-10-17T12:36:59 | 211,112,461 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 561 | h | #ifndef ADBERROR_H
#define ADBERROR_H
#include <QString>
#include <memory>
class ADBError
{
QString m_title;
QString m_description;
private:
ADBError() = default;
ADBError(QString title, QString description);
public:
typedef std::shared_ptr<ADBError> Ptr;
typedef std::weak_ptr<ADBError> WPtr;
static Ptr make(QString title, QString description);
QString title() const;
void setTitle(const QString &title);
QString description() const;
void setDescription(const QString &description);
};
#endif // ADBERROR_H
| [
"maktrefa@gmail.com"
] | maktrefa@gmail.com |
f779e9720c608a9ccf49a88cdb55c0eb02ca6bf8 | 83d52ae5413fc0613d2d9f1efbb1c1937f69264a | /src/memory.cpp | 44a0e9c72abc5c00411a62314a7d6a8da0fb9d09 | [
"MIT"
] | permissive | ixy-languages/ixy.cpp | 5a153a4a436c01e489972e1222124e794ae996c4 | c927c418b7ec350c4cc41f3795a1e8d346d1ea16 | refs/heads/master | 2023-04-25T09:15:25.643351 | 2021-05-14T10:38:24 | 2021-05-14T10:38:24 | 227,373,671 | 10 | 1 | MIT | 2020-08-24T13:53:10 | 2019-12-11T13:35:15 | C++ | UTF-8 | C++ | false | false | 1,883 | cpp | #include "memory.hpp"
#include "fs.hpp"
#include <sys/mman.h>
namespace ixy {
static uint32_t huge_pg_id;
auto memory_allocate_dma(size_t size, bool require_contiguous) -> dma_memory {
debug("allocating dma memory via huge page");
// round up to multiples of 2 MB if necessary, this is the wasteful part
// this could be fixed by co-locating allocations on the same page until a request would be too large
// when fixing this: make sure to align on 128 byte boundaries (82599 dma requirement)
if (size % HUGE_PAGE_SIZE) {
size = ((size >> HUGE_PAGE_BITS) + 1) << HUGE_PAGE_BITS;
}
if (require_contiguous && size > HUGE_PAGE_SIZE) {
// this is the place to implement larger contiguous physical mappings if that's ever needed
error("could not map physically contiguous memory");
}
// unique filename, C11 stdatomic.h requires a too recent gcc, we want to support gcc 4.8
uint32_t id = __sync_fetch_and_add(&huge_pg_id, 1);
fs::path path{"/mnt/huge/ixy-" + std::to_string(getpid()) + "-" + std::to_string(id)};
int fd = open(path.c_str(), O_CREAT | O_RDWR, S_IRWXU);
if (fd == -1) {
error("failed to open hugetlbfs file, check that /mnt/huge is mounted");
}
if (ftruncate(fd, static_cast<off_t>(size)) == -1) {
error("failed to allocate huge page memory, check hugetlbfs configuration");
}
void *virt_addr = mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_HUGETLB, fd, 0);
if (virt_addr == MAP_FAILED) {
error("failed to mmap huge page");
}
// never swap out DMA memory
if (mlock(virt_addr, size) == -1) {
error("disable swap for DMA memory");
}
// don't keep it around in the hugetlbfs
close(fd);
unlink(path.c_str());
return (dma_memory{virt_addr, virt_to_phys(virt_addr)});
}
} // namespace ixy
| [
"simon.ellmann@tum.de"
] | simon.ellmann@tum.de |
15a8019bcaad59529c6331de94621b0d27bf6b13 | fd87fbf08aaa8006a5655c19a20051901f5a032b | /LeetCode/49. 字母异位词分组.cpp | 889417649400aee52fc8f23320075d42ff721246 | [] | no_license | Smartuil/LeetCode | c43ad3a32e7ab55e97f9e30183c9dd760ada4015 | c4f31ab91d7073aa2eda8bce58e92e974d5eded8 | refs/heads/master | 2023-06-22T18:54:05.552298 | 2023-06-14T03:10:51 | 2023-06-14T03:10:51 | 243,493,761 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,961 | cpp | #include "iostream"
#include "string"
#include "vector"
#include "map"
#include <algorithm>
#include <unordered_map>
using namespace std;
//class Solution {
//public:
// vector<vector<string>> groupAnagrams(vector<string>& strs) {
// if (strs.empty()) {
// return {};
// }
// map<char, int> index;
// vector<vector<int>> tmp;
// vector<int> tmp2;
// vector<vector<string>> ret;
// vector<string> ret2;
// int len = strs.size();
// index.insert(make_pair('a', 1));
// index.insert(make_pair('b', 2));
// index.insert(make_pair('c', 3));
// index.insert(make_pair('d', 4));
// index.insert(make_pair('e', 5));
// index.insert(make_pair('f', 6));
// index.insert(make_pair('g', 7));
// index.insert(make_pair('h', 8));
// index.insert(make_pair('i', 9));
// index.insert(make_pair('j', 10));
// index.insert(make_pair('k', 11));
// index.insert(make_pair('l', 12));
// index.insert(make_pair('m', 13));
// index.insert(make_pair('n', 14));
// index.insert(make_pair('o', 15));
// index.insert(make_pair('p', 16));
// index.insert(make_pair('q', 17));
// index.insert(make_pair('r', 18));
// index.insert(make_pair('s', 19));
// index.insert(make_pair('t', 20));
// index.insert(make_pair('u', 21));
// index.insert(make_pair('v', 22));
// index.insert(make_pair('w', 23));
// index.insert(make_pair('x', 24));
// index.insert(make_pair('y', 25));
// index.insert(make_pair('z', 26));
// for (int i = 0; i < len; i++) {
// tmp2.clear();
// for (int j = 0; j < strs[i].size(); j++) {
// auto iter = index.find(strs[i][j]);
// tmp2.push_back(iter->second);
// sort(tmp2.begin(), tmp2.end());
// }
// tmp.push_back(tmp2);
// }
//
// int len = tmp.size();
// vector<bool> isUse(len, false);
// int i = 0, j = 1;
// while(i < len) {
// if (isUse[i] == true) {
// i++;
// continue;
// }
// j = i + 1;
// ret2.clear();
// ret2.push_back(strs[i]);
// while (j < len) {
// if (isUse[j] == true) {
// j++;
// continue;
// }
// if (tmp[i] == tmp[j]) {
// isUse[j] = true;
// ret2.push_back(strs[j]);
// }
// j++;
// }
// ret.push_back(ret2);
// i++;
// }
// return ret;
// }
//};
class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
vector<vector<string>> res;
int sub = 0;
string tmp;
unordered_map<string, int> work;
for (auto str : strs)
{
tmp = str;
sort(tmp.begin(), tmp.end());
if (work.count(tmp))
{
res[work[tmp]].push_back(str);
}
else
{
vector<string> vec(1, str);
res.push_back(vec);
work[tmp] = sub++;
}
}
return res;
}
};
int main() {
Solution *solution = new Solution;
vector<string> strs = { "eat", "tea", "tan", "ate", "nat", "bat" };
vector<vector<string>> ret = solution->groupAnagrams(strs);
cout << "[" << endl;
for (auto i : ret) {
cout << "[";
for (auto j : i) {
cout << j;
}
cout << "]" << endl;
}
cout << "]";
return 0;
} | [
"563412673@qq.com"
] | 563412673@qq.com |
834d7d053f4089ecd3b4402e7e74bbfd535c5d73 | 484cb345f43b38425279e42dd3cd320c779d1ea4 | /State_Machine/State_Machine/Automaton.cpp | afc104ac3a07984e79b086e0e2797e24bd1a3243 | [
"MIT"
] | permissive | DavidPetr/Internship_Tasks | 0e231bef90e4c93f2a2c19599f30395f25b49832 | 6c22cf2af667325553df99ebe79c3f5ebd741689 | refs/heads/master | 2020-05-06T20:32:43.091355 | 2019-06-27T11:20:48 | 2019-06-27T11:20:48 | 180,243,173 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,111 | cpp | #include "Automaton.h"
template<typename stateTemplate>
Automaton<stateTemplate>::Automaton(const Alphabet & inputAlphabet
, const Alphabet & outputAlphabet
, const TransmissionOperator<stateTemplate> & transOperator
, const stateTemplate & initialState
, const stateTemplate & finalState
, const System & SysType
, const std::string & input)
:
m_inputAlphabet(inputAlphabet),
m_outputAlphabet(outputAlphabet),
m_transmissionOperator(transOperator),
m_initialState(initialState),
m_SysType(SysType),
m_finalState(finalState)
{
for (auto i : input)
{
m_inputLine.push_back(i);
}
for (auto& key_value : m_transmissionOperator)
{
if (key_value.second == m_finalState)
{
m_minSecondFinalState = key_value.first.first;
break;
}
}
}
template<typename stateTemplate>
Automaton<stateTemplate>::~Automaton()
{
std::cout << std::endl << "Destructor Automaton!!!" << std::endl;
}
template<typename stateTemplate>
void Automaton<stateTemplate>::handler(const stateTemplate& errorState, const char& item)
{
auto search = std::find(m_inputAlphabet.begin(), m_inputAlphabet.end(), item);
if (errorState != stateTemplate::Q || search == m_inputAlphabet.end())
{
std::cout << "Automaton doesn't reach to final state, and stops in " <<
static_cast<std::underlying_type<stateTemplate>::type>(errorState) << " state." <<
std::endl << "Accordingly result is invalid.!!!" << std::endl;
}
else
{
std::cout << "Automaton reach to final state, result is valid !!!" << std::endl;
}
}
template<typename stateTemplate>
void Automaton<stateTemplate>::setinputLine(const std::string & input)
{
m_inputLine.clear();
for (auto i : input)
{
m_inputLine.push_back(i);
}
}
template<typename stateTemplate>
void Automaton<stateTemplate>::work()
{
int value_m_SysType = static_cast<std::underlying_type<stateTemplate>::type>(m_SysType);
int count = m_inputLine.size() % value_m_SysType; /// count of bits that less than SysType
if (count != 0)
{
m_inputLine.insert(m_inputLine.begin(), value_m_SysType - count, '0'); /// push '0' as many as Systype requires to become m_inputAlphabet complete
}
stateTemplate nextState = m_initialState;
char item;
for (int i = 0; i < m_inputLine.size();++i)
{
item = m_inputLine[i];
auto search = m_transmissionOperator.find(std::make_pair(nextState, item));
if (search == m_transmissionOperator.end())
{
break;
}
nextState = search->second;
std::cout << "State " << static_cast<std::underlying_type<stateTemplate>::type>(nextState) << std::endl;
if (nextState >= m_minSecondFinalState)
{
int index1 = static_cast<std::underlying_type<stateTemplate>::type>(nextState);
int index2 = static_cast<std::underlying_type<stateTemplate>::type>(m_minSecondFinalState);
int index = index1 - index2;
m_outputLine.push_back(m_outputAlphabet[index]);
--i;
}
}
handler(nextState,item);
}
template<typename stateTemplate>
void Automaton<stateTemplate>::print()
{
std::cout << "Result is ";
for (auto i : m_outputLine)
{
std::cout << i;
}
std::cout << std::endl;
}
| [
"davitp@cqg.com"
] | davitp@cqg.com |
dbab915473a26b97ad6949e34a372b27c57c95e8 | d4e7817e821c48b77f38eaad09e4f6c0e353e4af | /include/elemental/matrices/DiscreteFourier.hpp | 8d5db35cb10251678328ed47a1906a315aa4cc78 | [] | no_license | ahmadia/Elemental-1 | 711cea2a6fbcb1d2f5e3beca091ca7c9688afd2f | f9a82c76a06728e9e04a4316e41803efbadb5a19 | refs/heads/master | 2021-01-18T08:19:41.737484 | 2013-05-12T06:07:32 | 2013-05-12T06:07:32 | 10,011,794 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,652 | hpp | /*
Copyright (c) 2009-2013, Jack Poulson
All rights reserved.
This file is part of Elemental and is under the BSD 2-Clause License,
which can be found in the LICENSE file in the root directory, or at
http://opensource.org/licenses/BSD-2-Clause
*/
#pragma once
#ifndef MATRICES_DISCRETEFOURIER_HPP
#define MATRICES_DISCRETEFOURIER_HPP
namespace elem {
template<typename R>
inline void
DiscreteFourier( Matrix<Complex<R> >& A, int n )
{
#ifndef RELEASE
CallStackEntry entry("DiscreteFourier");
#endif
A.ResizeTo( n, n );
MakeDiscreteFourier( A );
}
template<typename R,Distribution U,Distribution V>
inline void
DiscreteFourier( DistMatrix<Complex<R>,U,V>& A, int n )
{
#ifndef RELEASE
CallStackEntry entry("DiscreteFourier");
#endif
A.ResizeTo( n, n );
MakeDiscreteFourier( A );
}
template<typename R>
inline void
MakeDiscreteFourier( Matrix<Complex<R> >& A )
{
#ifndef RELEASE
CallStackEntry entry("MakeDiscreteFourier");
#endif
typedef Complex<R> F;
const int m = A.Height();
const int n = A.Width();
if( m != n )
throw std::logic_error("Cannot make a non-square DFT matrix");
const R pi = 4*Atan( R(1) );
const F nSqrt = Sqrt( R(n) );
for( int j=0; j<n; ++j )
{
for( int i=0; i<m; ++i )
{
const R theta = -2*pi*i*j/n;
A.Set( i, j, Complex<R>(Cos(theta),Sin(theta))/nSqrt );
}
}
}
template<typename R,Distribution U,Distribution V>
inline void
MakeDiscreteFourier( DistMatrix<Complex<R>,U,V>& A )
{
#ifndef RELEASE
CallStackEntry entry("MakeDiscreteFourier");
#endif
typedef Complex<R> F;
const int m = A.Height();
const int n = A.Width();
if( m != n )
throw std::logic_error("Cannot make a non-square DFT matrix");
const R pi = 4*Atan( R(1) );
const F nSqrt = Sqrt( R(n) );
const int localHeight = A.LocalHeight();
const int localWidth = A.LocalWidth();
const int colShift = A.ColShift();
const int rowShift = A.RowShift();
const int colStride = A.ColStride();
const int rowStride = A.RowStride();
for( int jLocal=0; jLocal<localWidth; ++jLocal )
{
const int j = rowShift + jLocal*rowStride;
for( int iLocal=0; iLocal<localHeight; ++iLocal )
{
const int i = colShift + iLocal*colStride;
A.SetLocal( iLocal, jLocal, Exp(-2*pi*i*j/n)/nSqrt );
const R theta = -2*pi*i*j/n;
const Complex<R> alpha( Cos(theta), Sin(theta) );
A.SetLocal( iLocal, jLocal, alpha/nSqrt );
}
}
}
} // namespace elem
#endif // ifndef MATRICES_DISCRETEFOURIER_HPP
| [
"jack.poulson@gmail.com"
] | jack.poulson@gmail.com |
18faaf1a153a054b6d0f95d8154eec0ec890020e | 84f620e4414e1e88f2cd7c0d1c79448d344cc7c4 | /src/s390/interface-descriptors-s390.cc | 83c08782d60725fee3abdcb0159fb9bf63b3e363 | [
"BSD-3-Clause",
"SunPro",
"bzip2-1.0.6"
] | permissive | raymond-cai/v8 | 0775b6d2a8297bdd928558e6af1bc200ca19c776 | b496a8b3de4148af06ff7fbe259f4e7bb6d61f36 | refs/heads/master | 2020-12-31T00:12:19.036155 | 2017-03-29T03:00:34 | 2017-03-29T03:24:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,864 | cc | // Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#if V8_TARGET_ARCH_S390
#include "src/interface-descriptors.h"
namespace v8 {
namespace internal {
const Register CallInterfaceDescriptor::ContextRegister() { return cp; }
void CallInterfaceDescriptor::DefaultInitializePlatformSpecific(
CallInterfaceDescriptorData* data, int register_parameter_count) {
const Register default_stub_registers[] = {r2, r3, r4, r5, r6};
CHECK_LE(static_cast<size_t>(register_parameter_count),
arraysize(default_stub_registers));
data->InitializePlatformSpecific(register_parameter_count,
default_stub_registers);
}
const Register FastNewFunctionContextDescriptor::FunctionRegister() {
return r3;
}
const Register FastNewFunctionContextDescriptor::SlotsRegister() { return r2; }
const Register LoadDescriptor::ReceiverRegister() { return r3; }
const Register LoadDescriptor::NameRegister() { return r4; }
const Register LoadDescriptor::SlotRegister() { return r2; }
const Register LoadWithVectorDescriptor::VectorRegister() { return r5; }
const Register LoadICProtoArrayDescriptor::HandlerRegister() { return r6; }
const Register StoreDescriptor::ReceiverRegister() { return r3; }
const Register StoreDescriptor::NameRegister() { return r4; }
const Register StoreDescriptor::ValueRegister() { return r2; }
const Register StoreDescriptor::SlotRegister() { return r6; }
const Register StoreWithVectorDescriptor::VectorRegister() { return r5; }
const Register StoreTransitionDescriptor::SlotRegister() { return r6; }
const Register StoreTransitionDescriptor::VectorRegister() { return r5; }
const Register StoreTransitionDescriptor::MapRegister() { return r7; }
const Register StringCompareDescriptor::LeftRegister() { return r3; }
const Register StringCompareDescriptor::RightRegister() { return r2; }
const Register ApiGetterDescriptor::HolderRegister() { return r2; }
const Register ApiGetterDescriptor::CallbackRegister() { return r5; }
const Register MathPowTaggedDescriptor::exponent() { return r4; }
const Register MathPowIntegerDescriptor::exponent() {
return MathPowTaggedDescriptor::exponent();
}
const Register RegExpExecDescriptor::StringRegister() { return r2; }
const Register RegExpExecDescriptor::LastIndexRegister() { return r3; }
const Register RegExpExecDescriptor::StringStartRegister() { return r4; }
const Register RegExpExecDescriptor::StringEndRegister() { return r5; }
const Register RegExpExecDescriptor::CodeRegister() { return r9; }
const Register GrowArrayElementsDescriptor::ObjectRegister() { return r2; }
const Register GrowArrayElementsDescriptor::KeyRegister() { return r5; }
void FastNewClosureDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r3, r4, r5};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
// static
const Register TypeConversionDescriptor::ArgumentRegister() { return r2; }
void TypeofDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r5};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastCloneRegExpDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r5, r4, r3, r2};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastCloneShallowArrayDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r5, r4, r3};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastCloneShallowObjectDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r5, r4, r3, r2};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CreateAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r4, r5};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CreateWeakCellDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r4, r5, r3};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r3};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallICTrampolineDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r3, r2, r5};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallICDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r3, r2, r5, r4};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallConstructDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// r2 : number of arguments
// r3 : the function to call
// r4 : feedback vector
// r5 : slot in feedback vector (Smi, for RecordCallTarget)
// r6 : new target (for IsSuperConstructorCall)
// TODO(turbofan): So far we don't gather type feedback and hence skip the
// slot parameter, but ArrayConstructStub needs the vector to be undefined.
Register registers[] = {r2, r3, r6, r4};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallTrampolineDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// r2 : number of arguments
// r3 : the target to call
Register registers[] = {r3, r2};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallForwardVarargsDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// r4 : start index (to support rest parameters)
// r3 : the target to call
Register registers[] = {r3, r4};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ConstructStubDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// r2 : number of arguments
// r3 : the target to call
// r5 : the new target
// r4 : allocation site or undefined
Register registers[] = {r3, r5, r2, r4};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ConstructTrampolineDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// r2 : number of arguments
// r3 : the target to call
// r5 : the new target
Register registers[] = {r3, r5, r2};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void TransitionElementsKindDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r2, r3};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
data->InitializePlatformSpecific(0, nullptr, nullptr);
}
void ArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// kTarget, kNewTarget, kActualArgumentsCount, kAllocationSite
Register registers[] = {r3, r5, r2, r4};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void ArrayNoArgumentConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
// r2 -- number of arguments
// r3 -- function
// r4 -- allocation site with elements kind
Register registers[] = {r3, r4, r2};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ArraySingleArgumentConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
// r2 -- number of arguments
// r3 -- function
// r4 -- allocation site with elements kind
Register registers[] = {r3, r4, r2};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void ArrayNArgumentsConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
Register registers[] = {r3, r4, r2};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void VarArgFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (arg count)
Register registers[] = {r2};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r3, r2};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void BinaryOpDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r3, r2};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void BinaryOpWithAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r4, r3, r2};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void BinaryOpWithVectorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
// r3 -- lhs
// r2 -- rhs
// r6 -- slot id
// r5 -- vector
Register registers[] = {r3, r2, r6, r5};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CountOpDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r4};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void StringAddDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r3, r2};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void KeyedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
r4, // key
};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void NamedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
r4, // name
};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallHandlerDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
r2, // receiver
};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
r3, // JSFunction
r5, // the new target
r2, // actual number of arguments
r4, // expected number of arguments
};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ApiCallbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
r2, // callee
r6, // call_data
r4, // holder
r3, // api_function_address
};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InterpreterDispatchDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
kInterpreterAccumulatorRegister, kInterpreterBytecodeOffsetRegister,
kInterpreterBytecodeArrayRegister, kInterpreterDispatchTableRegister};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InterpreterPushArgsAndCallDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
r2, // argument count (not including receiver)
r4, // address of first argument
r3 // the target callable to be call
};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InterpreterPushArgsAndConstructDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
r2, // argument count (not including receiver)
r5, // new target
r3, // constructor to call
r4, // allocation site feedback if available, undefined otherwise
r6 // address of the first argument
};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InterpreterPushArgsAndConstructArrayDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
r2, // argument count (not including receiver)
r3, // target to call checked to be Array function
r4, // allocation site feedback if available, undefined otherwise
r5 // address of the first argument
};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InterpreterCEntryDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
r2, // argument count (argc)
r4, // address of first argument (argv)
r3 // the runtime function to call
};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ResumeGeneratorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
r2, // the value to pass to the generator
r3, // the JSGeneratorObject to resume
r4 // the resume mode (tagged)
};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FrameDropperTrampolineDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
r3, // loaded new FP
};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
} // namespace internal
} // namespace v8
#endif // V8_TARGET_ARCH_S390
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
8b936673d19f742c05781ddc699e4dc2000432b3 | 05b166f163992e1aa67f089c0c86d27a9c3af786 | /~2022/Graph_traversal/2251.cpp | ef63c89dac290b18ba5b6a671f639edb8764aef3 | [] | no_license | gyeolse/algorithm_study | 52417554c9ab7ffc761c3b78e143683a9c18abaa | bdfd3f0ae0661a0163f5575f40a6984a6f453104 | refs/heads/master | 2022-08-31T11:32:27.502032 | 2022-08-06T12:18:50 | 2022-08-06T12:18:50 | 246,004,136 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 247 | cpp | #include <bits/stdc++.h>
using namespace std;
int a, b, c;
int tong[3] = {0,0,0};
int main() {
cin>>a>>b>>c;
while(1) {
if(tong[0] == 0 && tong[2] !=0) {
cout<<tong[2]<<" ";
}
}
return 0;
} | [
"threewave@kakao.com"
] | threewave@kakao.com |
492ce9ba8def3f6a8e22e92bf4081af0ed9ac0b0 | b4c2427ece02bc1bc1f5e6279539ac884efcb323 | /Codeforces/492B/18652748_AC_31ms_36kB.cpp | e64d9a63f8d1ce1217b59402cebc4d5de6b9c420 | [] | no_license | sohag16030/ACM-Programming | eb7210be3685c3f7e5ea855c1598f5e7f3044463 | 39943162ed7b08d34b2b07b1a866b039c6ec2cc7 | refs/heads/master | 2023-01-31T11:08:46.389769 | 2020-12-14T08:57:24 | 2020-12-14T08:57:24 | 218,221,513 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,655 | cpp | /**************************************************
* BISMILLAHIR RAHMANIR RAHIM
* Author Name : SHOHAG (ICT'13)
* University : ICT, MBSTU
***************************************************/
#include<bits/stdc++.h>
#define pi acos(-1.0)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define MAX 1000
#define MIN -1
#define INF 1000
#define dbg cout<<"Executed"<<endl;
#define SET(array_name,value) memset(array_name,value,sizeof(array_name))
#define __FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define sfi(n) scanf("%lld",&n)
#define sfii(n,m) scanf("%lld%lld",&n,&m)
#define pfi(n) printf("%lld",n)
#define pfii(n,m) scanf("%lld%lld",n,m)
#define pfn printf("\n")
#define pfs printf(" ")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
ll n,i,j,L,m,k,t,sum,cnt,d,rem,mod,v,r,l,row,extra,mn=1000000009, a[MAX];
double mx=-1.0,differ,hmm,extra1,extra2;
string str,str2;
map<ll,ll>maap;
map<ll,ll>::iterator it;
vector<ll>vec,v2,v3;
vector<ll>v4[51];
/************************************ Code Start Here ******************************************************/
int main()
{
sfii(n,l);
for(i=0; i<n; i++)
{
cin>>t;
vec.pb(t);
}
sort(all(vec));
for(i=0; i<vec.size()-1; i++)
{
differ=(double)(vec[i+1]-vec[i])/2;
//printf("%f\n",differ);
differ=max(differ,mx);
mx=differ;
}
extra1=(l-vec[n-1]);
extra2=(vec[0]);
hmm=max(extra1,extra2);
//cout<<hmm;
printf("%.10f",max(hmm,differ));
return 0;
}
| [
"shohag.mbstu.it16030@gmail.com"
] | shohag.mbstu.it16030@gmail.com |
0a4c53c9e0b72b7600ab4cb758b8d9312b85071e | 30cf11a1ce961e3eef4332e0743120de55f06871 | /WJets/8TeV/LeptoQuarks/NTupleMaker/interface/RootTupleMakerV2_GenJets.h | 60ef63d994de967b671167e3a8e7c4b43c852464 | [] | no_license | bhawan/usercode | 1bde88a39fcb5ac466ffd547f1662cee91f695bd | b8c9042dc7cc4ee1907dc6c6dc3b25305ad31935 | refs/heads/master | 2020-05-18T00:07:39.498631 | 2013-08-23T15:16:12 | 2013-08-23T15:16:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 573 | h | #ifndef RootTupleMakerV2GenJets
#define RootTupleMakerV2GenJets
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
class RootTupleMakerV2_GenJets : public edm::EDProducer {
public:
explicit RootTupleMakerV2_GenJets(const edm::ParameterSet&);
private:
void produce( edm::Event &, const edm::EventSetup & );
const edm::InputTag inputTag;
const edm::InputTag inputTagP;
const std::string prefix,suffix;
const unsigned int maxSize;
};
#endif
| [
""
] | |
61b0a5434a5e53b8b0bfdb0c71f1b40fa70f2cf7 | 9bccd122450d6a12f7c60092ead774aff8e24241 | /pawn.cpp | 3bc7100ea1810a63f3081d55642f73892e870cf8 | [] | no_license | romuloschiavon/QTChess | c2b6833177ef909deca993379fafc40a85dc3084 | 6760ff6ecc5218d2ec6ab2f3525c4fce04273474 | refs/heads/main | 2023-02-06T09:33:19.208118 | 2020-12-26T00:31:59 | 2020-12-26T00:31:59 | 320,921,038 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,262 | cpp | #include "pawn.h"
#include "chessboard.h"
Pawn::Pawn(QObject *parent) : ChessAlgorithm(parent)
{
}
void Pawn::newGame()
{
setupBoard();
board()->setFen("rnbk1bnr/ppp1p1pp/8/1B6/8/8/PPP2PPP/RNB1K1NR w KQ - 0 1");
setResult(NoResult);
setCurrentPlayer(Player1);
}
bool Pawn::move(int colFrom, int rankFrom, int colTo, int rankTo)
{
if(currentPlayer() == NoPlayer) return false;
// acertando a peça
char source = board()->data(colFrom, rankFrom);
if(currentPlayer() == Player1 && source != 'P') return false;
if(currentPlayer() == Player2 && source != 'p') return false;
char destination = board()->data(colTo, rankTo);
if ((currentPlayer() == Player1) && (destination == 'P' || destination == 'N' || destination == 'B' || destination == 'Q' || destination == 'R' )) return false;
if ((currentPlayer() == Player2) && (destination == 'p' || destination == 'n' || destination == 'b' || destination == 'q' || destination == 'r')) return false;
if (destination == 'k') setResult(Player1Wins);
if (destination == 'K') setResult(Player2Wins);
if(colFrom == colTo && rankFrom == 2 && currentPlayer() == Player1){
if(colFrom == colTo && rankTo <= 4){
board()->movePiece(colFrom, rankFrom, colTo, rankTo);
setCurrentPlayer(currentPlayer() == Player1 ? Player2 : Player1);
return true;
}
}else if(colFrom == colTo && rankFrom == 7 && currentPlayer() == Player2){
if(colFrom == colTo && rankTo >= 5){
board()->movePiece(colFrom, rankFrom, colTo, rankTo);
setCurrentPlayer(currentPlayer() == Player1 ? Player2 : Player1);
return true;
}
}else if(colFrom == colTo && rankFrom == rankTo+1 && currentPlayer() == Player1){
board()->movePiece(colFrom, rankFrom, colTo, rankTo);
setCurrentPlayer(currentPlayer() == Player1 ? Player2 : Player1);
return true;
}else if(colFrom == colTo && rankFrom == rankTo-1 && currentPlayer() == Player2){
board()->movePiece(colFrom, rankFrom, colTo, rankTo);
setCurrentPlayer(currentPlayer() == Player1 ? Player2 : Player1);
return true;
}
return false;
}
| [
"noreply@github.com"
] | romuloschiavon.noreply@github.com |
cb636483037705b3de8f0c1eee7249390666d6c5 | 3ed4316561e9450e92dc334b1442a3500554f57f | /ExOpenGL3/OpenGL/03-uniforms/03-uniforms/ShaderProgram.h | 3a9200304a68e852f9a3d0d4dca6aad2860c7edb | [] | no_license | TheSoraHD/Rambo2D | 91de55f6bc258edf3ccd78e0ace6c108f00ee863 | c4f68348910adf025893f3f96de939c6790b406d | refs/heads/master | 2022-03-27T17:38:18.705431 | 2020-01-01T19:19:05 | 2020-01-01T19:19:05 | 212,827,341 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,044 | h | #ifndef _SHADER_PROGRAM_INCLUDE
#define _SHADER_PROGRAM_INCLUDE
#include <GL/glew.h>
#include <GL/gl.h>
#include "Shader.h"
// Using the Shader class ShaderProgram can link a vertex and a fragment shader
// together, bind input attributes to their corresponding vertex shader names,
// and bind the fragment output to a name from the fragment shader
class ShaderProgram
{
public:
ShaderProgram();
void init();
void addShader(const Shader &shader);
void bindFragmentOutput(const string &outputName);
GLint bindVertexAttribute(const string &attribName, GLint size);
void link();
void free();
void use();
// Pass uniforms to the associated shaders
void setUniform2f(const string &uniformName, float v0, float v1);
void setUniform3f(const string &uniformName, float v0, float v1, float v2);
void setUniform4f(const string &uniformName, float v0, float v1, float v2, float v3);
bool isLinked();
const string &log() const;
private:
GLuint programId;
bool linked;
string errorLog;
};
#endif // _SHADER_PROGRAM_INCLUDE
| [
"sven.wallin@est.fib.upc.edu"
] | sven.wallin@est.fib.upc.edu |
b0521eec49ecb754b839019b8915a0c7e47d9a41 | d8ea5358838f3624b0ac11ef2f4d96caa4e2e356 | /C_BA_String.cpp | d20e214c69a15c17b2edd752bb8971247b5c7869 | [] | no_license | md-omar-f/codeforces-problem-solutions | b81794ce6b601347a6857ce084d5cc7c3d00e4d9 | db2939c437bf5901c9f5c953d9006ed822ecf312 | refs/heads/master | 2023-05-12T05:19:38.597484 | 2023-04-29T19:46:24 | 2023-04-29T19:46:24 | 283,279,144 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 977 | cpp | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define forn(i,n) for(int i=0;i<int(n);++i)
#define vet(a) for(auto&i:a)cout<<i<<" "
#define out(a) cout<<a<<endl
#define lli long long int
void solve(){
lli n,k,x;cin>>n>>k>>x;
--x;
string s;cin>>s;
reverse(s.begin(),s.end());
string ans="";
lli i=0;
while(i<n){
if(s[i]=='a'){
ans+='a';++i;continue;
}
lli cnt=0;
while(i<n&&s[i]=='*'){
cnt+=k;++i;
}
for(lli j=0;j<(x%(cnt+1));++j){
ans+='b';
}
x/=cnt+1;
}
reverse(ans.begin(),ans.end());
cout<<ans<<endl;
}
int32_t main(){
IOS;
/*
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
*/
int t=1;
cin>>t;
while(t--){
solve();
}
return 0;
} | [
"faruqmdomar07@gmail.com"
] | faruqmdomar07@gmail.com |
f91fd4740ac8b6422306df05917247ba7224b007 | 3ff1fe3888e34cd3576d91319bf0f08ca955940f | /cwp/include/tencentcloud/cwp/v20180228/model/DescribeBaselineRuleIgnoreListRequest.h | 5020acc5d6054caca352d7bdf88dfdec47c5832b | [
"Apache-2.0"
] | permissive | TencentCloud/tencentcloud-sdk-cpp | 9f5df8220eaaf72f7eaee07b2ede94f89313651f | 42a76b812b81d1b52ec6a217fafc8faa135e06ca | refs/heads/master | 2023-08-30T03:22:45.269556 | 2023-08-30T00:45:39 | 2023-08-30T00:45:39 | 188,991,963 | 55 | 37 | Apache-2.0 | 2023-08-17T03:13:20 | 2019-05-28T08:56:08 | C++ | UTF-8 | C++ | false | false | 6,770 | h | /*
* Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. 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 TENCENTCLOUD_CWP_V20180228_MODEL_DESCRIBEBASELINERULEIGNORELISTREQUEST_H_
#define TENCENTCLOUD_CWP_V20180228_MODEL_DESCRIBEBASELINERULEIGNORELISTREQUEST_H_
#include <string>
#include <vector>
#include <map>
#include <tencentcloud/core/AbstractModel.h>
#include <tencentcloud/cwp/v20180228/model/Filter.h>
namespace TencentCloud
{
namespace Cwp
{
namespace V20180228
{
namespace Model
{
/**
* DescribeBaselineRuleIgnoreList请求参数结构体
*/
class DescribeBaselineRuleIgnoreListRequest : public AbstractModel
{
public:
DescribeBaselineRuleIgnoreListRequest();
~DescribeBaselineRuleIgnoreListRequest() = default;
std::string ToJsonString() const;
/**
* 获取<li>RuleName - String - 是否必填:否 - 规则名称</li>
<li>ItemId- int - 是否必填:否 - 检测项Id</li>
* @return Filters <li>RuleName - String - 是否必填:否 - 规则名称</li>
<li>ItemId- int - 是否必填:否 - 检测项Id</li>
*
*/
std::vector<Filter> GetFilters() const;
/**
* 设置<li>RuleName - String - 是否必填:否 - 规则名称</li>
<li>ItemId- int - 是否必填:否 - 检测项Id</li>
* @param _filters <li>RuleName - String - 是否必填:否 - 规则名称</li>
<li>ItemId- int - 是否必填:否 - 检测项Id</li>
*
*/
void SetFilters(const std::vector<Filter>& _filters);
/**
* 判断参数 Filters 是否已赋值
* @return Filters 是否已赋值
*
*/
bool FiltersHasBeenSet() const;
/**
* 获取限制条数,默认10,最大100
* @return Limit 限制条数,默认10,最大100
*
*/
int64_t GetLimit() const;
/**
* 设置限制条数,默认10,最大100
* @param _limit 限制条数,默认10,最大100
*
*/
void SetLimit(const int64_t& _limit);
/**
* 判断参数 Limit 是否已赋值
* @return Limit 是否已赋值
*
*/
bool LimitHasBeenSet() const;
/**
* 获取偏移量,默认0
* @return Offset 偏移量,默认0
*
*/
int64_t GetOffset() const;
/**
* 设置偏移量,默认0
* @param _offset 偏移量,默认0
*
*/
void SetOffset(const int64_t& _offset);
/**
* 判断参数 Offset 是否已赋值
* @return Offset 是否已赋值
*
*/
bool OffsetHasBeenSet() const;
/**
* 获取排序方式: [ASC:升序|DESC:降序]
* @return Order 排序方式: [ASC:升序|DESC:降序]
*
*/
std::string GetOrder() const;
/**
* 设置排序方式: [ASC:升序|DESC:降序]
* @param _order 排序方式: [ASC:升序|DESC:降序]
*
*/
void SetOrder(const std::string& _order);
/**
* 判断参数 Order 是否已赋值
* @return Order 是否已赋值
*
*/
bool OrderHasBeenSet() const;
/**
* 获取可选排序列: [HostCount]
* @return By 可选排序列: [HostCount]
*
*/
std::string GetBy() const;
/**
* 设置可选排序列: [HostCount]
* @param _by 可选排序列: [HostCount]
*
*/
void SetBy(const std::string& _by);
/**
* 判断参数 By 是否已赋值
* @return By 是否已赋值
*
*/
bool ByHasBeenSet() const;
private:
/**
* <li>RuleName - String - 是否必填:否 - 规则名称</li>
<li>ItemId- int - 是否必填:否 - 检测项Id</li>
*/
std::vector<Filter> m_filters;
bool m_filtersHasBeenSet;
/**
* 限制条数,默认10,最大100
*/
int64_t m_limit;
bool m_limitHasBeenSet;
/**
* 偏移量,默认0
*/
int64_t m_offset;
bool m_offsetHasBeenSet;
/**
* 排序方式: [ASC:升序|DESC:降序]
*/
std::string m_order;
bool m_orderHasBeenSet;
/**
* 可选排序列: [HostCount]
*/
std::string m_by;
bool m_byHasBeenSet;
};
}
}
}
}
#endif // !TENCENTCLOUD_CWP_V20180228_MODEL_DESCRIBEBASELINERULEIGNORELISTREQUEST_H_
| [
"tencentcloudapi@tencent.com"
] | tencentcloudapi@tencent.com |
0cc3cd60f752345e555b7706da5697cee681c0ba | f9ae1ba26d3d93d9013197cbd28b08d14f8889f3 | /src/nodes/pardata_nodes/parallel_data_sync_node.cpp | b82f8cc51d87e5cce5c048067d5d97ecf249eef1 | [] | no_license | RDowse/Asynchronous-Deep-Learning | 3242bf2d87728518a13e182471aae070698baa06 | d6ae52f4f6647688486d9a47b474d5c6a991c712 | refs/heads/master | 2021-03-24T12:22:04.921517 | 2017-06-24T17:39:54 | 2017-06-24T17:39:54 | 71,652,508 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,309 | cpp |
#include "nodes/pardata_nodes/parallel_data_sync_node.h"
#include "messages/forward_propagation_message.h"
#include "messages/backward_propagation_message.h"
#include "tools/math.h"
#include "states/backward_train_state.h"
#include "states/forward_train_state.h"
std::string ParallelDataNeuralNode::SyncNode::m_type = "Sync";
void ParallelDataNeuralNode::SyncNode::addEdge(Edge* e) {
Node::addEdge(e);
if(e->src->getId() == id){
if(e->dst->getType() == "Output"){
outgoingBackwardEdges.push_back(e);
dstOutputIndex[e->dst->getId()] = map_index++;
} else if(e->dst->getType() == "Input" ||
e->dst->getType() == "Bias"){
outgoingForwardEdges.push_back(e);
} else {
cout << "Unknown type " << e->dst->getType() << "\n";
assert(0);
}
} else if(e->dst->getId() == id){
if(e->src->getType() == "Output"){
incomingForwardEdges.push_back(e);
} else if(e->src->getType() == "Input"
|| e->src->getType() == "Bias"){
incomingBackwardEdges.push_back(e);
} else {
cout << "Unknown type " << e->src->getType() << "\n";
assert(0);
}
}
}
bool ParallelDataNeuralNode::SyncNode::sendForwardMsgs(vector<Message*>& msgs, int stateIndex){
assert(readyToSendForward(stateIndex));
assert(dataset!=NULL);
// time step
batchNum++;
auto& images = validating ?
dataset->validation_images : dataset->training_images;
// if(validating){
// batchSize = dataset->validation_labels.size();
// }else{
// // for batch remainder
// if( sampleIndex + context->batchSize > dataset->training_labels.size() )
// batchSize = dataset->training_labels.size() - sampleIndex;
// else
// batchSize = context->batchSize;
// }
// simplified
batchSize = validating ? dataset->validation_labels.size() : context->batchSize;
Logging::log(3, "Sending sample %d", sampleIndex);
// send out data samples to input nodes
msgs.reserve(outgoingForwardEdges.size());
for(unsigned i = 0, j = 0; i < outgoingForwardEdges.size(); i++){
assert( 0 == outgoingForwardEdges[i]->msgStatus );
auto msg = forwardMessagePool->getMessage();
msg->src = id;
msg->dst = outgoingForwardEdges[i]->dst->getId();
msg->batchNum = batchNum;
msg->dataSetType = validating ? DataSetType::validating : DataSetType::training;
msg->batchIndex = stateIndex;
// sampling strategy
if(outgoingForwardEdges[i]->dst->getType() == "Input"
&& j < images.cols()){
msg->activation = images.block(sampleIndex,j++,batchSize,1);
} else if(outgoingForwardEdges[i]->dst->getType() == "Bias"){
msg->activation = Eigen::VectorXf::Ones(batchSize);
} else {
assert(0); // shouldn't occur
}
msgs.push_back(msg);
}
assert((batchCount % context->numModels) == stateIndex);
// move to next batch
activeBatchCount++;
batchCount++;
assert(activeBatchCount <= context->numModels);
sampleIndex += batchSize;
// reset
tick = false;
backwardSeenCount[stateIndex] = 0;
}
bool ParallelDataNeuralNode::SyncNode::sendBackwardMsgs(vector<Message*>& msgs, int stateIndex){
assert(readyToSendBackward(stateIndex));
Logging::log(3, "Sending sample %d backward", sampleIndex-(activeBatchCount*batchSize));
auto batchLabels = dataset->training_labels.block(sampleIndex-(activeBatchCount*batchSize),0,batchSize,1);
msgs.reserve(outgoingBackwardEdges.size());
for(int i = 0; i < outgoingBackwardEdges.size(); ++i){
auto msg = backwardMessagePool->getMessage();
msg->src = id;
msg->dst = outgoingBackwardEdges[i]->dst->getId();
msg->batchNum = batchNum;
msg->batchIndex = stateIndex;
Eigen::VectorXf target(batchSize);
for(int j = 0; j < batchSize; ++j)
target(j) = (batchLabels(j) == i ? context->actMax : context->actMin);
assert(outgoingBackwardEdges[i]->dst->getType() == "Output");
msg->target = target;
msgs.push_back(msg);
}
// reset
forwardSeenCount[stateIndex] = 0;
}
bool ParallelDataNeuralNode::SyncNode::readyToSendForward(int i){
return (backwardSeenCount[i] == incomingBackwardEdges.size()
|| activeBatchCount < context->numModels
|| tick)
&& (batchCount % context->numModels) == i
&& context->epoch < context->maxEpoch
&& sampleIndex < dataset->training_labels.size()
&& activeBatchCount < context->numModels;
}
bool ParallelDataNeuralNode::SyncNode::readyToSendBackward(int i){
return (forwardSeenCount[i] == incomingForwardEdges.size());
}
void ParallelDataNeuralNode::SyncNode::onRecv(BackwardPropagationMessage* msg){
backwardSeenCount[msg->batchIndex]++;
backwardMessagePool->returnMessage(msg);
int batchIndex = msg->batchIndex;
assert(backwardSeenCount[batchIndex] <= incomingBackwardEdges.size());
if(backwardSeenCount[batchIndex] == incomingBackwardEdges.size())
{ // state update
// free up active batch count
activeBatchCount--;
assert(activeBatchCount >= 0);
int nTrainingSamples = dataset->training_labels.size();
// end of epoch, all samples in the training set have been passed
if(sampleIndex==nTrainingSamples && activeBatchCount == 0){
dataset->shuffle();
// next epoch
context->epoch++;
context->accuracy = accuracy/nTrainingSamples;
context->training_error = training_error/nTrainingSamples;
context->accuracy_train(context->epoch-1) = accuracy/nTrainingSamples;
Logging::log(0,"ACCURACY: %f\n",context->accuracy);
Logging::log(0,"AVERAGE ERROR: %f\n",context->training_error);
Logging::log(0,"EPOCH: %d\n",context->epoch);
// reset
sampleIndex = 0;
training_error = 0;
accuracy = 0;
}
delete state[batchIndex];
state[batchIndex] = new ForwardTrainState<ParallelDataNeuralNode>();
}
}
void ParallelDataNeuralNode::SyncNode::onRecv(ForwardPropagationMessage* msg){
forwardSeenCount[msg->batchIndex]++;
if(!receivedOutput[msg->batchIndex].size() || batchSize != receivedOutput[msg->batchIndex].rows())
receivedOutput[msg->batchIndex] = Eigen::MatrixXf(batchSize,outgoingBackwardEdges.size());
int index = dstOutputIndex[msg->src];
// network output
receivedOutput[msg->batchIndex].col(index) = msg->activation;
forwardMessagePool->returnMessage(msg);
int batchIndex = msg->batchIndex;
if(readyToSendBackward(batchIndex)){
// training error
if(outgoingBackwardEdges.size() == 1){ assert(0); }// todo implement binary version
int batchSampleIndex = sampleIndex - batchSize*activeBatchCount;
auto batchLabels = !validating ? dataset->training_labels.block(batchSampleIndex,0,batchSize,1):
dataset->validation_labels;
Eigen::MatrixXf target = Eigen::MatrixXf::Constant(batchSize,outgoingBackwardEdges.size(),context->actMin);
for(int i = 0; i < batchSize; ++i)
target( i, (int)batchLabels(i) ) = context->actMax;
training_error += math::mse(target,receivedOutput[msg->batchIndex]);
// TODO: separate accuracy predicition for the training set into a separate forward pass
MatrixXf::Index maxIndex[batchSize];
VectorXf maxVal(batchSize);
for(int i = 0; i < batchSize; ++i){ // multi-classification only
maxVal(i) = receivedOutput[msg->batchIndex].row(i).maxCoeff( &maxIndex[i] );
if(maxIndex[i]==batchLabels(i)) accuracy++;
}
delete state[msg->batchIndex];
state[msg->batchIndex] = new BackwardTrainState<ParallelDataNeuralNode>();
}
} | [
"rd613@imperial.ac.uk"
] | rd613@imperial.ac.uk |
215a8e7f38f52bdee15d49a6fc3a4d53d3771f00 | 2f874d5907ad0e95a2285ffc3592b8f75ecca7cd | /src/beast/beast/module/core/files/DirectoryIterator.cpp | 5b754a5e84aacd701fe9238fc3cc925cd4cc70de | [
"MIT-Wu",
"MIT",
"ISC",
"BSL-1.0"
] | permissive | dzcoin/DzCoinService | fb93809a37fad0a26bf26189266b44cf4c797865 | b0056717d6bcc1741f4fb3f3f166cd8ce78393f9 | refs/heads/master | 2021-01-20T20:28:41.639585 | 2016-08-15T06:21:51 | 2016-08-15T06:21:51 | 65,678,478 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,569 | cpp | //------------------------------------------------------------------------------
/*
this file is part of beast: https://github.com/vinniefalco/beast
copyright 2013, vinnie falco <vinnie.falco@gmail.com>
portions of this file are from juce.
copyright (c) 2013 - raw material software ltd.
please visit http://www.juce.com
permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
the software is provided "as is" and the author disclaims all warranties
with regard to this software including all implied warranties of
merchantability and fitness. in no event shall the author be liable for
any special , direct, indirect, or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether in an
action of contract, negligence or other tortious action, arising out of
or in connection with the use or performance of this software.
*/
//==============================================================================
#include <beast/cxx14/memory.h> // <memory>
namespace beast {
static stringarray parsewildcards (const string& pattern)
{
stringarray s;
s.addtokens (pattern, ";,", "\"'");
s.trim();
s.removeemptystrings();
return s;
}
static bool filematches (const stringarray& wildcards, const string& filename)
{
for (int i = 0; i < wildcards.size(); ++i)
if (filename.matcheswildcard (wildcards[i], ! file::arefilenamescasesensitive()))
return true;
return false;
}
directoryiterator::directoryiterator (const file& directory, bool recursive,
const string& pattern, const int type)
: wildcards (parsewildcards (pattern)),
filefinder (directory, (recursive || wildcards.size() > 1) ? "*" : pattern),
wildcard (pattern),
path (file::addtrailingseparator (directory.getfullpathname())),
index (-1),
totalnumfiles (-1),
whattolookfor (type),
isrecursive (recursive),
hasbeenadvanced (false)
{
// you have to specify the type of files you're looking for!
bassert ((type & (file::findfiles | file::finddirectories)) != 0);
bassert (type > 0 && type <= 7);
}
directoryiterator::~directoryiterator()
{
}
bool directoryiterator::next()
{
return next (nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);
}
bool directoryiterator::next (bool* const isdirresult, bool* const ishiddenresult, std::int64_t* const filesize,
time* const modtime, time* const creationtime, bool* const isreadonly)
{
hasbeenadvanced = true;
if (subiterator != nullptr)
{
if (subiterator->next (isdirresult, ishiddenresult, filesize, modtime, creationtime, isreadonly))
return true;
subiterator = nullptr;
}
string filename;
bool isdirectory, ishidden = false;
while (filefinder.next (filename, &isdirectory,
(ishiddenresult != nullptr || (whattolookfor & file::ignorehiddenfiles) != 0) ? &ishidden : nullptr,
filesize, modtime, creationtime, isreadonly))
{
++index;
if (! filename.containsonly ("."))
{
bool matches = false;
if (isdirectory)
{
if (isrecursive && ((whattolookfor & file::ignorehiddenfiles) == 0 || ! ishidden))
subiterator = std::make_unique <directoryiterator> (
file::createfilewithoutcheckingpath (path + filename),
true, wildcard, whattolookfor);
matches = (whattolookfor & file::finddirectories) != 0;
}
else
{
matches = (whattolookfor & file::findfiles) != 0;
}
// if we're not relying on the os iterator to do the wildcard match, do it now..
if (matches && (isrecursive || wildcards.size() > 1))
matches = filematches (wildcards, filename);
if (matches && (whattolookfor & file::ignorehiddenfiles) != 0)
matches = ! ishidden;
if (matches)
{
currentfile = file::createfilewithoutcheckingpath (path + filename);
if (ishiddenresult != nullptr) *ishiddenresult = ishidden;
if (isdirresult != nullptr) *isdirresult = isdirectory;
return true;
}
if (subiterator != nullptr)
return next (isdirresult, ishiddenresult, filesize, modtime, creationtime, isreadonly);
}
}
return false;
}
const file& directoryiterator::getfile() const
{
if (subiterator != nullptr && subiterator->hasbeenadvanced)
return subiterator->getfile();
// you need to call directoryiterator::next() before asking it for the file that it found!
bassert (hasbeenadvanced);
return currentfile;
}
float directoryiterator::getestimatedprogress() const
{
if (totalnumfiles < 0)
totalnumfiles = file (path).getnumberofchildfiles (file::findfilesanddirectories);
if (totalnumfiles <= 0)
return 0.0f;
const float detailedindex = (subiterator != nullptr) ? index + subiterator->getestimatedprogress()
: (float) index;
return detailedindex / totalnumfiles;
}
} // beast
| [
"dzgrouphelp@foxmail.com"
] | dzgrouphelp@foxmail.com |
9a36442ac1ebe20ae6bfb33f1f9d2e03dd4a19eb | e87e60c2a2836ca34c5abf9661230e65dfd565d2 | /src/Json/JsonDiagnostics.cpp | 152799b4912c0020d7835a1872bfb29b6dccc562 | [
"Zlib",
"MIT"
] | permissive | lriki/Lumino.Core | 862234b2022388463d9e18f81aea8f95f9c1c55b | e67084fb8f0c2962b2b36916c747672540902d63 | refs/heads/master | 2021-01-25T15:19:35.856882 | 2017-01-23T13:13:37 | 2017-01-23T13:13:37 | 29,088,000 | 2 | 1 | null | null | null | null | SHIFT_JIS | C++ | false | false | 1,708 | cpp |
#pragma once
//#include "../Base/EnumExtension.h"
//#include "../Base/String.h"
//
//LN_NAMESPACE_BEGIN
//
///** JSON 解析のエラーコード */
//LN_ENUM(JsonParseError)
//{
// NoError = 0, ///< エラーは発生していない
// DocumentEmpty, ///< 入力文字列が空だった
// DocumentRootNotSingular, ///< 複数のルート要素が見つかった
// ValueInvalid, ///< 無効な値
// StringEscapeInvalid, ///< 無効なエスケープシーケンス
// StringMissQuotationMark, ///< 文字列の開始と終端が一致しなかった (" が少ない)
// StringInvalidEncoding, ///< 変換できない文字が存在した
// ArrayMissCommaOrSquareBracket, ///< 配列の要素の後に , か ] が無かった
// ObjectMissKeyStart, ///< オブジェクトメンバの名前の開始 " が見つからなかった
// ObjectMissColon, ///< オブジェクトメンバの : が見つからなかった
// ObjectMissCommaOrCurlyBracket, ///< オブジェクトメンバの後に , か } が見つからなかった
//
// NumberInvalid, ///< 無効な数値
// NumberOverflow, ///< 数値の変換でオーバーフローが発生した
//
// Termination, ///< Hander で中断された
//};
//LN_ENUM_DECLARE(JsonParseError);
//
///**
// @brief JSON 解析中のエラーを表します。
//*/
//class JsonError
//{
//public:
// JsonError()
// : ErrorCode(JsonParseError::NoError)
// , Offset(0)
// , Message()
// {}
//
//public:
// void SetError(JsonParseError errorCode, int offset) { ErrorCode = errorCode; Offset = offset; }
//
//public:
// JsonParseError ErrorCode;
// int Offset;
// String Message;
//};
//
//LN_NAMESPACE_END
| [
"lriki.net@gmail.com"
] | lriki.net@gmail.com |
2b4cb9b035bea8c817424321eb61aa71810542c1 | efaf2832b2fa4a95f1dca38c48128bd0e83126fc | /CodeChef/SAFPAR.cpp | 3b43de4f5dfb933abb90b78bd4e4280076ecb991 | [] | no_license | ailyanlu1/CompetitiveProgramming | e9b67ab02293d3bc5701bcabc32424c46cfcaffd | 55d13a1a5206305a5dfa0ba22c483d24fa4b89d3 | refs/heads/master | 2020-03-26T13:04:23.432571 | 2018-08-15T16:06:38 | 2018-08-15T16:06:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,387 | cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define fi first
#define se second
const int mxN=5e5, M=1e9+7;
int n, a[mxN], l[mxN], r[mxN], b1[mxN+1], b2[mxN+1], qu[mxN], qh, qt;
ll dp[mxN+3];
vector<pii> t1[mxN+2], t2[mxN+2];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for(int i=0; i<n; ++i) {
cin >> a[i];
l[i]=i-1;
while(l[i]>=0&&a[l[i]]<a[i])
l[i]=l[l[i]];
}
for(int i=n-1; i>=0; --i) {
r[i]=i+1;
while(r[i]<n&&a[r[i]]<=a[i])
r[i]=r[r[i]];
if(i-l[i]<r[i]-i)
for(int j=l[i]; j<i; ++j)
t1[j+2].push_back({i+2, min(r[i]+2, j+3+a[i])});
else
for(int j=i; j<r[i]; ++j)
t2[j+2].push_back({max(l[i]+1, j+1-a[i]), i+1});
}
for(int i1=0, i2=0; i1<n; ++i1) {
while(qh<qt&&a[qu[qt-1]]>=a[i1])
--qt;
qu[qt++]=i1;
while(i2<=i1&&i1-i2+1>=a[qu[qh]]) {
if(qu[qh]==i2)
++qh;
++i2;
}
b1[i1+1]=i2;
}
for(int i=1; i<=n; ++i)
b2[b1[i]]=i;
for(int i=1; i<=n; ++i)
b2[i]=max(b2[i-1], b2[i]);
dp[1]=1;
dp[2]=-1;
for(int i=1; i<=n+1; ++i) {
dp[i+1]+=dp[i];
for(pii p : t2[i])
if(p.fi<min(p.se, b1[i-1]))
dp[i]+=dp[min(p.se, b1[i-1])]-dp[p.fi]+M;
dp[i]%=M;
for(pii p : t1[i]) {
if(max(p.fi, b2[i-1]+2)<p.se) {
dp[max(p.fi, b2[i-1]+2)]+=dp[i];
dp[p.se]+=M-dp[i];
}
}
dp[i]=(dp[i-1]+dp[i])%M;
}
cout << (dp[n+1]-dp[n]+M)%M;
}
| [
"noreply@github.com"
] | ailyanlu1.noreply@github.com |
73871068d5f469a92f87b79981c11381a6cdf788 | a05e148a60a5901c1b8faa4aba964e8788fbe1e7 | /cpp/mat_gen2/main.cpp | 71697e08c671e2c83e09533a6a92ea7c57895e71 | [] | no_license | u1234x1234/kaggle-truly-native | 8dd08592e5847be7373c49434f59910dce70b6c7 | 22500be88dc36025ebbec6c354a55bb96b5480cb | refs/heads/master | 2021-01-10T02:03:22.762598 | 2017-04-30T15:16:35 | 2017-04-30T15:16:35 | 47,903,273 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,602 | cpp | #include <iostream>
#include <fstream>
#include <string>
#include <future>
#include <cstdlib>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <chrono>
#include <cctype>
#include <functional>
#include <boost/algorithm/string.hpp>
#include <boost/filesystem.hpp>
#include "../xgboost/wrapper/xgboost_wrapper.h"
using namespace std;
int main(int argc, char *argv[])
{
string root_path = "/root/native/";
string mode(argv[1]);
vector<unsigned long> indptr;
vector<unsigned int> indices;
vector<float> data;
int tmp_i;
float tmp_f;
ifstream in1(root_path + "/" + mode + ".indptr");
while(in1.read(reinterpret_cast<char*>(&tmp_i), sizeof(unsigned int)))
indptr.push_back(tmp_i);
cout << "indptr loaded: " << indptr.size() << endl;
cout << "indptr " << indptr[0] << " " << indptr[indptr.size() - 1] << endl;
ifstream in2(root_path + "/" + mode + ".indices");
while(in2.read(reinterpret_cast<char*>(&tmp_i), sizeof(int)))
indices.push_back(tmp_i);
cout << "indices loaded " << indices.size() << endl;
cout << "ind: " << indices[0] << endl;
ifstream in3(root_path + "/" + mode + ".data");
while(in3.read(reinterpret_cast<char*>(&tmp_f), sizeof(float)))
data.push_back(tmp_f);
cout << "data loaded: " << data.size() << endl;
cout << "data: " << data[0] << endl;
DMatrixHandle *out = new DMatrixHandle();
XGDMatrixCreateFromCSR(indptr.data(), indices.data(), data.data(), indptr.size(), data.size(), out);
cout << "dmat created" << endl;
XGDMatrixSaveBinary(*out, (root_path + "/" + mode + ".dmat").c_str(), 0);
cout << "saved" << endl;
return 0;
}
| [
"u1234x1234@gmail.com"
] | u1234x1234@gmail.com |
ea6693530894b315a7c44282ed1a581bf698cda9 | 24ce061d37343fb1c3129596546577a6622c85d4 | /CS_048-04812030-0006172461-2/2018-1-E.cpp | c75219c1428b3ddc92c379d55a7823ff0afa3bbb | [] | no_license | Tenant/Algorithm-Repo | d61026c835ffe9a9a03ae705702e495adcd45d36 | 96c5f6c44145bfa488811756aa2ce5269e577471 | refs/heads/master | 2021-04-09T17:21:59.418228 | 2019-01-13T19:36:05 | 2019-01-13T19:36:05 | 125,698,364 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 824 | cpp | #include <iostream>
#define N_MAX 65536
int pre[N_MAX],cnt;
void process(int* mid, int* post, int length)
{
int pos=0;
for(;pos<length && mid[pos]!=post[length-1];pos++);
pre[cnt++]=mid[pos];
if(pos>0)
{
process(mid,post,pos);
}
if(pos<length-1)
{
process(mid+pos+1,post+pos,length-pos-1);
}
}
int main(int argc, char* argv[])
{
int mid[N_MAX], post[N_MAX];
int N;
for(N=0;;N++)
{
scanf("%d",&mid[N]);
if(getchar()!=' ') break;
}
for(N=0;;N++)
{
scanf("%d",&post[N]);
if(getchar()!=' ') break;
}
cnt=0;
process(mid,post,++N);
std::cout<<pre[0];
for(int idx=1;idx<cnt;idx++) std::cout<<" "<<pre[idx];
std::cout<<std::endl;
return 0;
}
| [
"gaoshuqi@pku.edu.cn"
] | gaoshuqi@pku.edu.cn |
c296471aec402aaa608b0b3709e5e956d80cc2a1 | dbc2f341a9e9e0200f9a59e8b05a5cad0301e3ec | /uint256.cpp | bf95b8fed158b6cdac7b619cd87b27916d913ee2 | [] | no_license | JonSalazar/serialization | 3523e20abd521f2d7f36c0b88befbb76e9657db9 | e91f41505598ee37cec3cdbaa771f2f68fcd4368 | refs/heads/master | 2020-04-24T18:00:48.528153 | 2019-03-07T03:47:35 | 2019-03-07T03:47:35 | 172,166,665 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,286 | cpp | // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2017 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "uint256.h"
#include "utilstrencodings.h"
#include <stdio.h>
#include <string.h>
#include <vector>
template <unsigned int BITS>
base_blob<BITS>::base_blob(const std::vector<unsigned char>& vch)
{
assert(vch.size() == sizeof(data));
memcpy(data, vch.data(), sizeof(data));
}
template <unsigned int BITS>
std::string base_blob<BITS>::GetHex() const
{
return HexStr(std::reverse_iterator<const uint8_t*>(data + sizeof(data)), std::reverse_iterator<const uint8_t*>(data));
}
template <unsigned int BITS>
void base_blob<BITS>::SetHex(const char* psz)
{
memset(data, 0, sizeof(data));
// skip leading spaces
while (isspace(*psz))
psz++;
// skip 0x
if (psz[0] == '0' && tolower(psz[1]) == 'x')
psz += 2;
// hex string to uint
const char* pbegin = psz;
while (HexDigit(*psz) != -1)
psz++;
psz--;
unsigned char* p1 = (unsigned char*)data;
unsigned char* pend = p1 + WIDTH;
while (psz >= pbegin && p1 < pend) {
*p1 = ::HexDigit(*psz--);
if (psz >= pbegin) {
*p1 |= ((unsigned char)::HexDigit(*psz--) << 4);
p1++;
}
}
}
template <unsigned int BITS>
void base_blob<BITS>::SetHex(const std::string& str)
{
SetHex(str.c_str());
}
template <unsigned int BITS>
std::string base_blob<BITS>::ToString() const
{
return (GetHex());
}
// Explicit instantiations for base_blob<160>
template base_blob<160>::base_blob(const std::vector<unsigned char>&);
template std::string base_blob<160>::GetHex() const;
template std::string base_blob<160>::ToString() const;
template void base_blob<160>::SetHex(const char*);
template void base_blob<160>::SetHex(const std::string&);
// Explicit instantiations for base_blob<256>
template base_blob<256>::base_blob(const std::vector<unsigned char>&);
template std::string base_blob<256>::GetHex() const;
template std::string base_blob<256>::ToString() const;
template void base_blob<256>::SetHex(const char*);
template void base_blob<256>::SetHex(const std::string&);
| [
"jonsalazar99@hotmail.com"
] | jonsalazar99@hotmail.com |
a378ed72f41d87b8240403880c4c548aafebc9a1 | 6b2a8dd202fdce77c971c412717e305e1caaac51 | /solutions_5648941810974720_0/C++/stalker506/main.cpp | 6bf97dabfa10e0a1938201e31b1e1171844e8c3c | [] | no_license | alexandraback/datacollection | 0bc67a9ace00abbc843f4912562f3a064992e0e9 | 076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf | refs/heads/master | 2021-01-24T18:27:24.417992 | 2017-05-23T09:23:38 | 2017-05-23T09:23:38 | 84,313,442 | 2 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 2,235 | cpp | //#include "stdafx.h"
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <iomanip>
#include <deque>
using namespace std;
typedef double ld;
typedef long long ll;
const ld EPS = 1e-2;
const int INF = (int) 1e9;
const int N = (int) 2e3 + 5;
const ll M = (long long) 1e9 + 7;
vector <int> solve(string &s) {
map <char, int> cnt;
vector <int> res;
int n = s.length();
for (int i = 0; i < n; i++)
cnt[s[i]]++;
while (cnt['Z']) {
res.push_back(0);
cnt['Z']--, cnt['E']--, cnt['R']--, cnt['O']--;
}
while (cnt['W']) {
res.push_back(2);
cnt['W']--, cnt['T']--, cnt['O']--;
}
while (cnt['U']) {
res.push_back(4);
cnt['F']--, cnt['U']--, cnt['R']--, cnt['O']--;
}
while (cnt['X']) {
res.push_back(6);
cnt['S']--, cnt['I']--, cnt['X']--;
}
while (cnt['G']) {
res.push_back(8);
cnt['I']--, cnt['E']--, cnt['G']--, cnt['H']--, cnt['T']--;
}
while (cnt['F']) {
res.push_back(5);
cnt['F']--, cnt['E']--, cnt['I']--, cnt['V']--;
}
while (cnt['R']) {
res.push_back(3);
cnt['T']--, cnt['H']--, cnt['R']--, cnt['E'] -= 2;
}
while (cnt['O']) {
res.push_back(1);
cnt['N']--, cnt['E']--; cnt['O']--;
}
while (cnt['S']) {
res.push_back(7);
cnt['S']--, cnt['E'] -= 2, cnt['V']--, cnt['N']--;
}
while (cnt['N']) {
res.push_back(9);
cnt['N'] -= 2, cnt['E']--, cnt['I']--;
}
sort(res.begin(), res.end());
return res;
}
int main() {
freopen("A-small-attempt1.in", "r", stdin);
freopen("output.txt", "w", stdout);
int T;
cin >> T;
for (int t = 0; t < T; t++) {
string s;
cin >> s;
cout << "Case #" << t + 1 << ": ";
vector <int> ans = solve(s);
for (int i = 0; i < (int)ans.size(); i++)
cout << ans[i];
cout << endl;
}
return 0;
}
| [
"alexandra1.back@gmail.com"
] | alexandra1.back@gmail.com |
663e562acb468e1d2124231f740e3d454d53f3dd | 6f4883cec42366e1ed7dc4ddf25b56e7702b0c69 | /2387/5196830_AC_79MS_4528K.cpp | 8438660a6c0259d99845da9267e7aed14c4abd54 | [] | no_license | 15800688908/poj-codes | 89e3739df0db4bd4fe22db3e0bf839fc7abe35d1 | 913331dd1cfb6a422fb90175dcddb54b577d1059 | refs/heads/master | 2022-01-25T07:55:15.590648 | 2016-09-30T13:08:24 | 2016-09-30T13:08:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 948 | cpp | #include<stdio.h>
#include<string.h>
const int maxn=1100;
const int INF=100000000;
int map[maxn][maxn],d[maxn];
bool flag[maxn];
int m,n;
void dijkstra()
{
int i,j,minv,s;
memset(flag,false,sizeof(flag));
for(i=1;i<=n;++i)
d[i]=INF;
d[1]=0;
for(i=1;i<=n;i++)
{
minv=INF;s=-1;
for(j=1;j<=n;j++)
if(!flag[j]&&d[j]<minv)
{
s=j;
minv=d[j];
}
if(s==-1)
break;
flag[s]=true;
if(flag[n])
break;
for(j=1;j<=n;j++)
if(!flag[j]&&d[s]+map[s][j]<d[j])
d[j]=d[s]+map[s][j];
}
}
int main()
{
int cnt,value,i,j;
while(EOF!=scanf("%d %d",&m,&n))
{
for(i=1;i<=n;++i)
{
for(j=1;j<=n;++j)
map[i][j]=INF;
map[i][i]=0;
}
while(m--)
{
scanf("%d%d%d",&i,&j,&value);
if(value<map[i][j])
map[i][j]=map[j][i]=value;
}
dijkstra();
printf("%d\n",d[n]);
}
return 0;
}
| [
"dilin.life@gmail.com"
] | dilin.life@gmail.com |
e11393522975325d140b2400b45eab816d428a7a | d93b93310b0d35df76331869aba39556bbf2a1e1 | /Parcial 1 y 2/ThreadsConv/10Conveniencia/RAM.cpp | 7e8c024475ebb6d4922a39777d967539c64afca0 | [] | no_license | ErickMimin/Ukranio | 5093d3919c41905339902e878f39e23fd0c26ed2 | 17d8f4f9860c0366c91299a80cd1d56cbe45e085 | refs/heads/master | 2021-01-02T10:32:53.147488 | 2020-05-23T05:23:43 | 2020-05-23T05:23:43 | 239,578,836 | 0 | 0 | null | 2020-05-20T22:26:23 | 2020-02-10T18:07:44 | C | UTF-8 | C++ | false | false | 325 | cpp | #include <iostream>
#include <cstdlib>
using namespace std;
#define numeroElementos 999000000
int main() {
unsigned long *arreglo, i;
arreglo = new unsigned long[numeroElementos];
for(i = 0; i < numeroElementos; i++)
arreglo[i] = 0;
for(i = 0; i < 1000010000; i++){
arreglo[rand() % numeroElementos] = rand();
}
} | [
"Eri_mimo@hotmail.com"
] | Eri_mimo@hotmail.com |
dee05680523547303c3d5bbf429efce7b63031a9 | 5c5033209087c5d2c72415ae45efab42e5658d08 | /蓝桥/2013年第四届蓝桥C++B组/2013.07错误票据.cpp | 9c6e8bff0334f5d3fec427d7c2e32d7d2fe69532 | [] | no_license | mqaaa/algorithmmic | 1b6f4bd8381d76625f726bad662783b28080de9d | 811b6ae7c1ff021149c79e54ce9366e95fcb8c8b | refs/heads/master | 2021-03-30T17:26:00.934151 | 2018-04-18T14:00:27 | 2018-04-18T14:00:27 | 123,786,066 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,230 | cpp |
/*************************************************************
Author : qmeng
MailTo : qmeng1128@163.com
QQ : 1163306125
Blog : http://blog.csdn.net/Mq_Go/
Create : 2018-03-23 16:41:43
Version: 1.0
**************************************************************/
#include <cstdio>
#include <iostream>
#include<algorithm>
#include <string>
const int maxn=100005;
using namespace std;
int main(){
int n;
int hashtable[maxn];
fill(hashtable,hashtable+maxn,0);
int num;
int u=0;
scanf("%d",&n);
getchar();
string str;
for(int i=0;i<n;i++)
{
/*while(scanf("%d",&num)!=EOF)
{
hashtable[u++]=num;
}*/
getline(cin,str);
cout << str << endl;
int temp = 0;
for(int j = 0 ; j < str.length() ; j++){
if(str[j]<'9'&&str[j]>'0'){
temp = temp*10 + str[j]-'0';
//cout << temp << endl;
}else{
hashtable[temp]++;
temp = 0;
}
}
hashtable[temp]++;
}
//cout << "1311315365"<<endl;
//sort(hashtable,hashtable+u);
int l,m,k;
for(int i=0;i<10;i++)
{
cout<<i<<" "<<hashtable[i]<<endl;
if(hashtable[i]==2)
{
l=i;
}else if(hashtable[i]==0)
{
m=i;
}
if(hashtable[i]==1){
k = m;
}
}
printf("%d %d",l,k);
return 0;
}
| [
"qmeng1128@163.com"
] | qmeng1128@163.com |
ac15be14855e7923430d97241c783751272e3d8f | 8afb5afd38548c631f6f9536846039ef6cb297b9 | /_REPO/MICROSOFT/react-native-windows/vnext/Microsoft.ReactNative.Cxx/UI.Xaml.Controls.h | 1040f9786a35e27950bab817564588595f442e1c | [
"MIT"
] | permissive | bgoonz/UsefulResourceRepo2.0 | d87588ffd668bb498f7787b896cc7b20d83ce0ad | 2cb4b45dd14a230aa0e800042e893f8dfb23beda | refs/heads/master | 2023-03-17T01:22:05.254751 | 2022-08-11T03:18:22 | 2022-08-11T03:18:22 | 382,628,698 | 10 | 12 | MIT | 2022-10-10T14:13:54 | 2021-07-03T13:58:52 | null | UTF-8 | C++ | false | false | 354 | h | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#pragma once
#ifdef USE_WINUI3
#include <winrt/Microsoft.UI.Xaml.Controls.h>
namespace winrt::Microsoft::UI::Xaml::Controls {
using IControl7 = Control;
} // namespace winrt::Microsoft::UI::Xaml::Controls
#else
#include <winrt/Windows.UI.Xaml.Controls.h>
#endif // USE_WINUI3
| [
"bryan.guner@gmail.com"
] | bryan.guner@gmail.com |
e5dfafe041a81815be98368a96047f9f5630ce9e | c5cf8346c93728e98d086277ebf1d513481c9216 | /ShinobiEngine/Engine/GameObjectx/Components/Transform2D.cpp | 683ac36f00c3eb8378af03432795d16831ca498a | [
"Apache-2.0"
] | permissive | denevcoding/ShinobiEngine2D | 46834bb59317a81809cb46719d9061a46beed4e1 | 3d29adc18cd4ccbb975969d1ccf348401c715fa4 | refs/heads/master | 2022-11-18T05:32:03.189537 | 2020-07-22T13:05:54 | 2020-07-22T13:05:54 | 281,673,477 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 356 | cpp | #include "stdafx.h"
#include "Transform2D.h"
Transform2D::~Transform2D()
{
std::cerr << "Se destruido un Tansform 2D" << std::endl;
}
void Transform2D::Update(double ftimeDiff)
{
}
void Transform2D::ReceiveMsg(const Message& message)
{
}
void Transform2D::Activate()
{
m_isEnabled = true;
}
void Transform2D::Deactivate()
{
m_isEnabled = false;
}
| [
"kevin.velez@live.u-tad.com"
] | kevin.velez@live.u-tad.com |
2b1e52a6cbf68b80b1207375815a8301709dfaf2 | 08d17ddeb5713d8e7a4ee01054fcce78ed7f5191 | /tensorflow/compiler/xla/service/while_loop_trip_count_annotator_test.cc | 5c19cbc015dab7721dc60e015ca7125cc628fc0a | [
"Apache-2.0"
] | permissive | Godsinred/tensorflow | 9cd67e1088ad8893265651ad4a5c45a6640b6c96 | 45100d5f55d7cba15bffcd91bf521ed37daf7bca | refs/heads/master | 2020-04-25T19:44:53.669366 | 2019-02-28T01:54:55 | 2019-02-28T02:59:15 | 173,030,955 | 2 | 0 | Apache-2.0 | 2019-02-28T03:03:41 | 2019-02-28T03:03:41 | null | UTF-8 | C++ | false | false | 6,970 | cc | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/compiler/xla/service/while_loop_trip_count_annotator.h"
#include "tensorflow/compiler/xla/service/pattern_matcher.h"
#include "tensorflow/compiler/xla/service/while_loop_simplifier.h"
#include "tensorflow/compiler/xla/status_macros.h"
#include "tensorflow/compiler/xla/test.h"
#include "tensorflow/compiler/xla/tests/hlo_test_base.h"
#include "tensorflow/core/lib/core/status_test_util.h"
namespace xla {
namespace {
class TripCountAnnotatorTest : public HloTestBase {};
TEST_F(TripCountAnnotatorTest, KnownSmallTripCount) {
const char* kModuleStr = R"(
HloModule test
Body {
param = (s32[]) parameter(0)
i = s32[] get-tuple-element(param), index=0
one = s32[] constant(1)
i_plus_one = s32[] add(i, one)
ROOT tuple = (s32[]) tuple(i_plus_one)
}
Cond {
param = (s32[]) parameter(0)
i = s32[] get-tuple-element(param), index=0
trip_count = s32[] constant(10)
ROOT done = pred[] less-than(i, trip_count)
}
ENTRY test {
i_start = s32[] constant(0)
initial_tuple = (s32[]) tuple(i_start)
ROOT while = (s32[]) while(initial_tuple), condition=Cond, body=Body
})";
TF_ASSERT_OK_AND_ASSIGN(auto m, ParseAndReturnVerifiedModule(kModuleStr));
WhileLoopTripCountAnnotator pass;
TF_ASSERT_OK_AND_ASSIGN(bool changed, RunHloPass(&pass, m.get()));
ASSERT_TRUE(changed);
TF_ASSERT_OK_AND_ASSIGN(auto config,
m->entry_computation()
->root_instruction()
->backend_config<WhileLoopBackendConfig>());
EXPECT_EQ(10, config.known_trip_count().n());
}
TEST_F(TripCountAnnotatorTest, KnownLargeTripCount) {
const char* kModuleStr = R"(
HloModule test
Body {
param = (s32[]) parameter(0)
i = s32[] get-tuple-element(param), index=0
one = s32[] constant(1)
i_plus_one = s32[] add(i, one)
ROOT tuple = (s32[]) tuple(i_plus_one)
}
Cond {
param = (s32[]) parameter(0)
i = s32[] get-tuple-element(param), index=0
trip_count = s32[] constant(1000000)
ROOT done = pred[] less-than(i, trip_count)
}
ENTRY test {
i_start = s32[] constant(0)
initial_tuple = (s32[]) tuple(i_start)
ROOT while = (s32[]) while(initial_tuple), condition=Cond, body=Body
})";
TF_ASSERT_OK_AND_ASSIGN(auto m, ParseAndReturnVerifiedModule(kModuleStr));
WhileLoopTripCountAnnotator pass;
TF_ASSERT_OK_AND_ASSIGN(bool changed, RunHloPass(&pass, m.get()));
ASSERT_TRUE(changed);
TF_ASSERT_OK_AND_ASSIGN(auto config,
m->entry_computation()
->root_instruction()
->backend_config<WhileLoopBackendConfig>());
EXPECT_EQ(1000000, config.known_trip_count().n());
}
TEST_F(TripCountAnnotatorTest, NonzeroStart) {
const char* kModuleStr = R"(
HloModule test
Body {
param = (s32[]) parameter(0)
i = s32[] get-tuple-element(param), index=0
one = s32[] constant(1)
i_plus_one = s32[] add(i, one)
ROOT tuple = (s32[]) tuple(i_plus_one)
}
Cond {
param = (s32[]) parameter(0)
i = s32[] get-tuple-element(param), index=0
trip_count = s32[] constant(1000000)
ROOT done = pred[] less-than(i, trip_count)
}
ENTRY test {
i_start = s32[] constant(10)
initial_tuple = (s32[]) tuple(i_start)
ROOT while = (s32[]) while(initial_tuple), condition=Cond, body=Body
})";
TF_ASSERT_OK_AND_ASSIGN(auto m, ParseAndReturnVerifiedModule(kModuleStr));
WhileLoopTripCountAnnotator pass;
TF_ASSERT_OK_AND_ASSIGN(bool changed, RunHloPass(&pass, m.get()));
ASSERT_TRUE(changed);
TF_ASSERT_OK_AND_ASSIGN(auto config,
m->entry_computation()
->root_instruction()
->backend_config<WhileLoopBackendConfig>());
EXPECT_EQ(999990, config.known_trip_count().n());
}
TEST_F(TripCountAnnotatorTest, LessThanOrEqualTo) {
const char* kModuleStr = R"(
HloModule test
Body {
param = (s32[]) parameter(0)
i = s32[] get-tuple-element(param), index=0
one = s32[] constant(1)
i_plus_one = s32[] add(i, one)
ROOT tuple = (s32[]) tuple(i_plus_one)
}
Cond {
param = (s32[]) parameter(0)
i = s32[] get-tuple-element(param), index=0
trip_count = s32[] constant(1000000)
ROOT done = pred[] less-than-or-equal-to(i, trip_count)
}
ENTRY test {
i_start = s32[] constant(10)
initial_tuple = (s32[]) tuple(i_start)
ROOT while = (s32[]) while(initial_tuple), condition=Cond, body=Body
})";
TF_ASSERT_OK_AND_ASSIGN(auto m, ParseAndReturnVerifiedModule(kModuleStr));
WhileLoopTripCountAnnotator pass;
TF_ASSERT_OK_AND_ASSIGN(bool changed, RunHloPass(&pass, m.get()));
ASSERT_TRUE(changed);
TF_ASSERT_OK_AND_ASSIGN(auto config,
m->entry_computation()
->root_instruction()
->backend_config<WhileLoopBackendConfig>());
EXPECT_EQ(999991, config.known_trip_count().n());
}
TEST_F(TripCountAnnotatorTest, Int64Overflow) {
// for(i = INT64_MIN; i < INT64_MAX; ++i)
//
// We store the trip count as an int64, so this loop is unanalyzable.
const char* kModuleStr = R"(
HloModule test
Body {
param = (s64[]) parameter(0)
i = s64[] get-tuple-element(param), index=0
one = s64[] constant(1)
i_plus_one = s64[] add(i, one)
ROOT tuple = (s64[]) tuple(i_plus_one)
}
Cond {
param = (s64[]) parameter(0)
i = s64[] get-tuple-element(param), index=0
trip_count = s64[] constant(9223372036854775807) // 2^63-1
ROOT done = pred[] less-than-or-equal-to(i, trip_count)
}
ENTRY test {
i_start = s64[] constant(-9223372036854775808) // -2^63
initial_tuple = (s64[]) tuple(i_start)
ROOT while = (s64[]) while(initial_tuple), condition=Cond, body=Body
})";
TF_ASSERT_OK_AND_ASSIGN(auto m, ParseAndReturnVerifiedModule(kModuleStr));
WhileLoopTripCountAnnotator pass;
TF_ASSERT_OK_AND_ASSIGN(bool changed, RunHloPass(&pass, m.get()));
EXPECT_FALSE(changed);
}
} // namespace
} // namespace xla
| [
"gardener@tensorflow.org"
] | gardener@tensorflow.org |
1e31d4e372b97c989b994770a7325545f9ae9b6d | ac16a937f32602cf16114463f8e875a972f64c27 | /docs/dolfin/2016.2.0/cpp/source/demo/undocumented/multimesh-poisson/cpp/MultiMeshPoisson.h | 5e1f215f688133eca1de1d5f3b95e3c9129ff8df | [] | no_license | mparno/fenics-web | 2073248da6f9918ffedbe9be8a3433bc1cbb7ffb | 7202752da876b1f9ab02c1d5a5f28ff5da526528 | refs/heads/master | 2021-05-05T04:45:46.436236 | 2016-12-06T20:25:44 | 2016-12-06T20:25:44 | 118,628,385 | 2 | 0 | null | 2018-01-23T15:21:47 | 2018-01-23T15:21:46 | null | UTF-8 | C++ | false | false | 132,702 | h | // This code conforms with the UFC specification version 2016.2.0
// and was automatically generated by FFC version 2016.2.0.
//
// This code was generated with the option '-l dolfin' and
// contains DOLFIN-specific wrappers that depend on DOLFIN.
//
// This code was generated with the following parameters:
//
// convert_exceptions_to_warnings: False
// cpp_optimize: True
// cpp_optimize_flags: '-O2'
// epsilon: 1e-14
// error_control: False
// form_postfix: True
// format: 'dolfin'
// max_signature_length: 0
// optimize: True
// precision: 15
// quadrature_degree: -1
// quadrature_rule: 'auto'
// representation: 'auto'
// split: False
#ifndef __MULTIMESHPOISSON_H
#define __MULTIMESHPOISSON_H
#include <stdexcept>
#include <ufc.h>
class multimeshpoisson_finite_element_0: public ufc::finite_element
{
public:
multimeshpoisson_finite_element_0() : ufc::finite_element()
{
// Do nothing
}
~multimeshpoisson_finite_element_0() override
{
// Do nothing
}
const char * signature() const final override
{
return "FiniteElement('Lagrange', triangle, 1)";
}
ufc::shape cell_shape() const final override
{
return ufc::shape::triangle;
}
std::size_t topological_dimension() const final override
{
return 2;
}
std::size_t geometric_dimension() const final override
{
return 2;
}
std::size_t space_dimension() const final override
{
return 3;
}
std::size_t value_rank() const final override
{
return 0;
}
std::size_t value_dimension(std::size_t i) const final override
{
return 1;
}
std::size_t value_size() const final override
{
return 1;
}
std::size_t reference_value_rank() const final override
{
return 0;
}
std::size_t reference_value_dimension(std::size_t i) const final override
{
return 1;
}
std::size_t reference_value_size() const final override
{
return 1;
}
std::size_t degree() const final override
{
return 1;
}
const char * family() const final override
{
return "Lagrange";
}
static void _evaluate_basis(std::size_t i,
double * values,
const double * x,
const double * coordinate_dofs,
int cell_orientation)
{
// Compute Jacobian
double J[4];
compute_jacobian_triangle_2d(J, coordinate_dofs);
// Compute Jacobian inverse and determinant
double K[4];
double detJ;
compute_jacobian_inverse_triangle_2d(K, detJ, J);
// Compute constants
const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
// Get coordinates and map to the reference (FIAT) element
double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
// Reset values
*values = 0.0;
switch (i)
{
case 0:
{
// Array of basisvalues
double basisvalues[3] = {0.0, 0.0, 0.0};
// Declare helper variables
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
// Compute basisvalues
basisvalues[0] = 1.0;
basisvalues[1] = tmp0;
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
basisvalues[0] *= std::sqrt(0.5);
basisvalues[2] *= std::sqrt(1.0);
basisvalues[1] *= std::sqrt(3.0);
// Table(s) of coefficients
static const double coefficients0[3] = \
{0.471404520791032, -0.288675134594813, -0.166666666666667};
// Compute value(s)
for (unsigned int r = 0; r < 3; r++)
{
*values += coefficients0[r]*basisvalues[r];
} // end loop over 'r'
break;
}
case 1:
{
// Array of basisvalues
double basisvalues[3] = {0.0, 0.0, 0.0};
// Declare helper variables
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
// Compute basisvalues
basisvalues[0] = 1.0;
basisvalues[1] = tmp0;
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
basisvalues[0] *= std::sqrt(0.5);
basisvalues[2] *= std::sqrt(1.0);
basisvalues[1] *= std::sqrt(3.0);
// Table(s) of coefficients
static const double coefficients0[3] = \
{0.471404520791032, 0.288675134594813, -0.166666666666667};
// Compute value(s)
for (unsigned int r = 0; r < 3; r++)
{
*values += coefficients0[r]*basisvalues[r];
} // end loop over 'r'
break;
}
case 2:
{
// Array of basisvalues
double basisvalues[3] = {0.0, 0.0, 0.0};
// Declare helper variables
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
// Compute basisvalues
basisvalues[0] = 1.0;
basisvalues[1] = tmp0;
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
basisvalues[0] *= std::sqrt(0.5);
basisvalues[2] *= std::sqrt(1.0);
basisvalues[1] *= std::sqrt(3.0);
// Table(s) of coefficients
static const double coefficients0[3] = \
{0.471404520791032, 0.0, 0.333333333333333};
// Compute value(s)
for (unsigned int r = 0; r < 3; r++)
{
*values += coefficients0[r]*basisvalues[r];
} // end loop over 'r'
break;
}
}
}
void evaluate_basis(std::size_t i,
double * values,
const double * x,
const double * coordinate_dofs,
int cell_orientation) const final override
{
_evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
}
static void _evaluate_basis_all(double * values,
const double * x,
const double * coordinate_dofs,
int cell_orientation)
{
// Helper variable to hold values of a single dof.
double dof_values = 0.0;
// Loop dofs and call evaluate_basis
for (unsigned int r = 0; r < 3; r++)
{
_evaluate_basis(r, &dof_values, x, coordinate_dofs, cell_orientation);
values[r] = dof_values;
} // end loop over 'r'
}
void evaluate_basis_all(double * values,
const double * x,
const double * coordinate_dofs,
int cell_orientation) const final override
{
_evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
}
static void _evaluate_basis_derivatives(std::size_t i,
std::size_t n,
double * values,
const double * x,
const double * coordinate_dofs,
int cell_orientation)
{
// Compute number of derivatives.
unsigned int num_derivatives = 1;
for (unsigned int r = 0; r < n; r++)
{
num_derivatives *= 2;
} // end loop over 'r'
// Reset values. Assuming that values is always an array.
for (unsigned int r = 0; r < num_derivatives; r++)
{
values[r] = 0.0;
} // end loop over 'r'
// Call evaluate_basis if order of derivatives is equal to zero.
if (n == 0)
{
_evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
return ;
}
// If order of derivatives is greater than the maximum polynomial degree, return zeros.
if (n > 1)
{
return ;
}
// Compute Jacobian
double J[4];
compute_jacobian_triangle_2d(J, coordinate_dofs);
// Compute Jacobian inverse and determinant
double K[4];
double detJ;
compute_jacobian_inverse_triangle_2d(K, detJ, J);
// Compute constants
const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
// Get coordinates and map to the reference (FIAT) element
double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
// Declare two dimensional array that holds combinations of derivatives and initialise
unsigned int combinations[2][1];
for (unsigned int row = 0; row < 2; row++)
{
for (unsigned int col = 0; col < 1; col++)
combinations[row][col] = 0;
}
// Generate combinations of derivatives
for (unsigned int row = 1; row < num_derivatives; row++)
{
for (unsigned int num = 0; num < row; num++)
{
for (unsigned int col = n-1; col+1 > 0; col--)
{
if (combinations[row][col] + 1 > 1)
combinations[row][col] = 0;
else
{
combinations[row][col] += 1;
break;
}
}
}
}
// Compute inverse of Jacobian
const double Jinv[2][2] = {{K[0], K[1]}, {K[2], K[3]}};
// Declare transformation matrix
// Declare pointer to two dimensional array and initialise
double transform[2][2];
for (unsigned int j = 0; j < num_derivatives; j++)
{
for (unsigned int k = 0; k < num_derivatives; k++)
transform[j][k] = 1;
}
// Construct transformation matrix
for (unsigned int row = 0; row < num_derivatives; row++)
{
for (unsigned int col = 0; col < num_derivatives; col++)
{
for (unsigned int k = 0; k < n; k++)
transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
}
}
switch (i)
{
case 0:
{
// Array of basisvalues
double basisvalues[3] = {0.0, 0.0, 0.0};
// Declare helper variables
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
// Compute basisvalues
basisvalues[0] = 1.0;
basisvalues[1] = tmp0;
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
basisvalues[0] *= std::sqrt(0.5);
basisvalues[2] *= std::sqrt(1.0);
basisvalues[1] *= std::sqrt(3.0);
// Table(s) of coefficients
static const double coefficients0[3] = \
{0.471404520791032, -0.288675134594813, -0.166666666666667};
// Tables of derivatives of the polynomial base (transpose).
static const double dmats0[3][3] = \
{{0.0, 0.0, 0.0},
{4.89897948556635, 0.0, 0.0},
{0.0, 0.0, 0.0}};
static const double dmats1[3][3] = \
{{0.0, 0.0, 0.0},
{2.44948974278318, 0.0, 0.0},
{4.24264068711928, 0.0, 0.0}};
// Compute reference derivatives.
// Declare array of derivatives on FIAT element.
double derivatives[2];
for (unsigned int r = 0; r < 2; r++)
{
derivatives[r] = 0.0;
} // end loop over 'r'
// Declare derivative matrix (of polynomial basis).
double dmats[3][3] = \
{{1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}};
// Declare (auxiliary) derivative matrix (of polynomial basis).
double dmats_old[3][3] = \
{{1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}};
// Loop possible derivatives.
for (unsigned int r = 0; r < num_derivatives; r++)
{
// Resetting dmats values to compute next derivative.
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
dmats[t][u] = 0.0;
if (t == u)
{
dmats[t][u] = 1.0;
}
} // end loop over 'u'
} // end loop over 't'
// Looping derivative order to generate dmats.
for (unsigned int s = 0; s < n; s++)
{
// Updating dmats_old with new values and resetting dmats.
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
dmats_old[t][u] = dmats[t][u];
dmats[t][u] = 0.0;
} // end loop over 'u'
} // end loop over 't'
// Update dmats using an inner product.
if (combinations[r][s] == 0)
{
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
for (unsigned int tu = 0; tu < 3; tu++)
{
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
} // end loop over 'tu'
} // end loop over 'u'
} // end loop over 't'
}
if (combinations[r][s] == 1)
{
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
for (unsigned int tu = 0; tu < 3; tu++)
{
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
} // end loop over 'tu'
} // end loop over 'u'
} // end loop over 't'
}
} // end loop over 's'
for (unsigned int s = 0; s < 3; s++)
{
for (unsigned int t = 0; t < 3; t++)
{
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
} // end loop over 't'
} // end loop over 's'
} // end loop over 'r'
// Transform derivatives back to physical element
for (unsigned int r = 0; r < num_derivatives; r++)
{
for (unsigned int s = 0; s < num_derivatives; s++)
{
values[r] += transform[r][s]*derivatives[s];
} // end loop over 's'
} // end loop over 'r'
break;
}
case 1:
{
// Array of basisvalues
double basisvalues[3] = {0.0, 0.0, 0.0};
// Declare helper variables
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
// Compute basisvalues
basisvalues[0] = 1.0;
basisvalues[1] = tmp0;
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
basisvalues[0] *= std::sqrt(0.5);
basisvalues[2] *= std::sqrt(1.0);
basisvalues[1] *= std::sqrt(3.0);
// Table(s) of coefficients
static const double coefficients0[3] = \
{0.471404520791032, 0.288675134594813, -0.166666666666667};
// Tables of derivatives of the polynomial base (transpose).
static const double dmats0[3][3] = \
{{0.0, 0.0, 0.0},
{4.89897948556635, 0.0, 0.0},
{0.0, 0.0, 0.0}};
static const double dmats1[3][3] = \
{{0.0, 0.0, 0.0},
{2.44948974278318, 0.0, 0.0},
{4.24264068711928, 0.0, 0.0}};
// Compute reference derivatives.
// Declare array of derivatives on FIAT element.
double derivatives[2];
for (unsigned int r = 0; r < 2; r++)
{
derivatives[r] = 0.0;
} // end loop over 'r'
// Declare derivative matrix (of polynomial basis).
double dmats[3][3] = \
{{1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}};
// Declare (auxiliary) derivative matrix (of polynomial basis).
double dmats_old[3][3] = \
{{1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}};
// Loop possible derivatives.
for (unsigned int r = 0; r < num_derivatives; r++)
{
// Resetting dmats values to compute next derivative.
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
dmats[t][u] = 0.0;
if (t == u)
{
dmats[t][u] = 1.0;
}
} // end loop over 'u'
} // end loop over 't'
// Looping derivative order to generate dmats.
for (unsigned int s = 0; s < n; s++)
{
// Updating dmats_old with new values and resetting dmats.
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
dmats_old[t][u] = dmats[t][u];
dmats[t][u] = 0.0;
} // end loop over 'u'
} // end loop over 't'
// Update dmats using an inner product.
if (combinations[r][s] == 0)
{
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
for (unsigned int tu = 0; tu < 3; tu++)
{
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
} // end loop over 'tu'
} // end loop over 'u'
} // end loop over 't'
}
if (combinations[r][s] == 1)
{
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
for (unsigned int tu = 0; tu < 3; tu++)
{
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
} // end loop over 'tu'
} // end loop over 'u'
} // end loop over 't'
}
} // end loop over 's'
for (unsigned int s = 0; s < 3; s++)
{
for (unsigned int t = 0; t < 3; t++)
{
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
} // end loop over 't'
} // end loop over 's'
} // end loop over 'r'
// Transform derivatives back to physical element
for (unsigned int r = 0; r < num_derivatives; r++)
{
for (unsigned int s = 0; s < num_derivatives; s++)
{
values[r] += transform[r][s]*derivatives[s];
} // end loop over 's'
} // end loop over 'r'
break;
}
case 2:
{
// Array of basisvalues
double basisvalues[3] = {0.0, 0.0, 0.0};
// Declare helper variables
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
// Compute basisvalues
basisvalues[0] = 1.0;
basisvalues[1] = tmp0;
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
basisvalues[0] *= std::sqrt(0.5);
basisvalues[2] *= std::sqrt(1.0);
basisvalues[1] *= std::sqrt(3.0);
// Table(s) of coefficients
static const double coefficients0[3] = \
{0.471404520791032, 0.0, 0.333333333333333};
// Tables of derivatives of the polynomial base (transpose).
static const double dmats0[3][3] = \
{{0.0, 0.0, 0.0},
{4.89897948556635, 0.0, 0.0},
{0.0, 0.0, 0.0}};
static const double dmats1[3][3] = \
{{0.0, 0.0, 0.0},
{2.44948974278318, 0.0, 0.0},
{4.24264068711928, 0.0, 0.0}};
// Compute reference derivatives.
// Declare array of derivatives on FIAT element.
double derivatives[2];
for (unsigned int r = 0; r < 2; r++)
{
derivatives[r] = 0.0;
} // end loop over 'r'
// Declare derivative matrix (of polynomial basis).
double dmats[3][3] = \
{{1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}};
// Declare (auxiliary) derivative matrix (of polynomial basis).
double dmats_old[3][3] = \
{{1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}};
// Loop possible derivatives.
for (unsigned int r = 0; r < num_derivatives; r++)
{
// Resetting dmats values to compute next derivative.
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
dmats[t][u] = 0.0;
if (t == u)
{
dmats[t][u] = 1.0;
}
} // end loop over 'u'
} // end loop over 't'
// Looping derivative order to generate dmats.
for (unsigned int s = 0; s < n; s++)
{
// Updating dmats_old with new values and resetting dmats.
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
dmats_old[t][u] = dmats[t][u];
dmats[t][u] = 0.0;
} // end loop over 'u'
} // end loop over 't'
// Update dmats using an inner product.
if (combinations[r][s] == 0)
{
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
for (unsigned int tu = 0; tu < 3; tu++)
{
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
} // end loop over 'tu'
} // end loop over 'u'
} // end loop over 't'
}
if (combinations[r][s] == 1)
{
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
for (unsigned int tu = 0; tu < 3; tu++)
{
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
} // end loop over 'tu'
} // end loop over 'u'
} // end loop over 't'
}
} // end loop over 's'
for (unsigned int s = 0; s < 3; s++)
{
for (unsigned int t = 0; t < 3; t++)
{
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
} // end loop over 't'
} // end loop over 's'
} // end loop over 'r'
// Transform derivatives back to physical element
for (unsigned int r = 0; r < num_derivatives; r++)
{
for (unsigned int s = 0; s < num_derivatives; s++)
{
values[r] += transform[r][s]*derivatives[s];
} // end loop over 's'
} // end loop over 'r'
break;
}
}
}
void evaluate_basis_derivatives(std::size_t i,
std::size_t n,
double * values,
const double * x,
const double * coordinate_dofs,
int cell_orientation) const final override
{
_evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
}
static void _evaluate_basis_derivatives_all(std::size_t n,
double * values,
const double * x,
const double * coordinate_dofs,
int cell_orientation)
{
// Call evaluate_basis_all if order of derivatives is equal to zero.
if (n == 0)
{
_evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
return ;
}
// Compute number of derivatives.
unsigned int num_derivatives = 1;
for (unsigned int r = 0; r < n; r++)
{
num_derivatives *= 2;
} // end loop over 'r'
// Set values equal to zero.
for (unsigned int r = 0; r < 3; r++)
{
for (unsigned int s = 0; s < num_derivatives; s++)
{
values[r*num_derivatives + s] = 0.0;
} // end loop over 's'
} // end loop over 'r'
// If order of derivatives is greater than the maximum polynomial degree, return zeros.
if (n > 1)
{
return ;
}
// Helper variable to hold values of a single dof.
double dof_values[2];
for (unsigned int r = 0; r < 2; r++)
{
dof_values[r] = 0.0;
} // end loop over 'r'
// Loop dofs and call evaluate_basis_derivatives.
for (unsigned int r = 0; r < 3; r++)
{
_evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
for (unsigned int s = 0; s < num_derivatives; s++)
{
values[r*num_derivatives + s] = dof_values[s];
} // end loop over 's'
} // end loop over 'r'
}
void evaluate_basis_derivatives_all(std::size_t n,
double * values,
const double * x,
const double * coordinate_dofs,
int cell_orientation) const final override
{
_evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
}
double evaluate_dof(std::size_t i,
const ufc::function& f,
const double * coordinate_dofs,
int cell_orientation,
const ufc::cell& c) const final override
{
// Declare variables for result of evaluation
double vals[1];
// Declare variable for physical coordinates
double y[2];
switch (i)
{
case 0:
{
y[0] = coordinate_dofs[0];
y[1] = coordinate_dofs[1];
f.evaluate(vals, y, c);
return vals[0];
break;
}
case 1:
{
y[0] = coordinate_dofs[2];
y[1] = coordinate_dofs[3];
f.evaluate(vals, y, c);
return vals[0];
break;
}
case 2:
{
y[0] = coordinate_dofs[4];
y[1] = coordinate_dofs[5];
f.evaluate(vals, y, c);
return vals[0];
break;
}
}
return 0.0;
}
void evaluate_dofs(double * values,
const ufc::function& f,
const double * coordinate_dofs,
int cell_orientation,
const ufc::cell& c) const final override
{
// Declare variables for result of evaluation
double vals[1];
// Declare variable for physical coordinates
double y[2];
y[0] = coordinate_dofs[0];
y[1] = coordinate_dofs[1];
f.evaluate(vals, y, c);
values[0] = vals[0];
y[0] = coordinate_dofs[2];
y[1] = coordinate_dofs[3];
f.evaluate(vals, y, c);
values[1] = vals[0];
y[0] = coordinate_dofs[4];
y[1] = coordinate_dofs[5];
f.evaluate(vals, y, c);
values[2] = vals[0];
}
void interpolate_vertex_values(double * vertex_values,
const double * dof_values,
const double * coordinate_dofs,
int cell_orientation,
const ufc::cell& c) const final override
{
// Evaluate function and change variables
vertex_values[0] = dof_values[0];
vertex_values[1] = dof_values[1];
vertex_values[2] = dof_values[2];
}
void tabulate_dof_coordinates(double * dof_coordinates,
const double * coordinate_dofs) const final override
{
dof_coordinates[0] = coordinate_dofs[0];
dof_coordinates[1] = coordinate_dofs[1];
dof_coordinates[2] = coordinate_dofs[2];
dof_coordinates[3] = coordinate_dofs[3];
dof_coordinates[4] = coordinate_dofs[4];
dof_coordinates[5] = coordinate_dofs[5];
}
std::size_t num_sub_elements() const final override
{
return 0;
}
ufc::finite_element * create_sub_element(std::size_t i) const final override
{
return 0;
}
ufc::finite_element * create() const final override
{
return new multimeshpoisson_finite_element_0();
}
};
class multimeshpoisson_finite_element_1: public ufc::finite_element
{
public:
multimeshpoisson_finite_element_1() : ufc::finite_element()
{
// Do nothing
}
~multimeshpoisson_finite_element_1() override
{
// Do nothing
}
const char * signature() const final override
{
return "VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
}
ufc::shape cell_shape() const final override
{
return ufc::shape::triangle;
}
std::size_t topological_dimension() const final override
{
return 2;
}
std::size_t geometric_dimension() const final override
{
return 2;
}
std::size_t space_dimension() const final override
{
return 6;
}
std::size_t value_rank() const final override
{
return 1;
}
std::size_t value_dimension(std::size_t i) const final override
{
switch (i)
{
case 0:
{
return 2;
break;
}
}
return 0;
}
std::size_t value_size() const final override
{
return 2;
}
std::size_t reference_value_rank() const final override
{
return 1;
}
std::size_t reference_value_dimension(std::size_t i) const final override
{
switch (i)
{
case 0:
{
return 2;
break;
}
}
return 0;
}
std::size_t reference_value_size() const final override
{
return 2;
}
std::size_t degree() const final override
{
return 1;
}
const char * family() const final override
{
return "Lagrange";
}
static void _evaluate_basis(std::size_t i,
double * values,
const double * x,
const double * coordinate_dofs,
int cell_orientation)
{
// Compute Jacobian
double J[4];
compute_jacobian_triangle_2d(J, coordinate_dofs);
// Compute Jacobian inverse and determinant
double K[4];
double detJ;
compute_jacobian_inverse_triangle_2d(K, detJ, J);
// Compute constants
const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
// Get coordinates and map to the reference (FIAT) element
double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
// Reset values
values[0] = 0.0;
values[1] = 0.0;
switch (i)
{
case 0:
{
// Array of basisvalues
double basisvalues[3] = {0.0, 0.0, 0.0};
// Declare helper variables
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
// Compute basisvalues
basisvalues[0] = 1.0;
basisvalues[1] = tmp0;
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
basisvalues[0] *= std::sqrt(0.5);
basisvalues[2] *= std::sqrt(1.0);
basisvalues[1] *= std::sqrt(3.0);
// Table(s) of coefficients
static const double coefficients0[3] = \
{0.471404520791032, -0.288675134594813, -0.166666666666667};
// Compute value(s)
for (unsigned int r = 0; r < 3; r++)
{
values[0] += coefficients0[r]*basisvalues[r];
} // end loop over 'r'
break;
}
case 1:
{
// Array of basisvalues
double basisvalues[3] = {0.0, 0.0, 0.0};
// Declare helper variables
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
// Compute basisvalues
basisvalues[0] = 1.0;
basisvalues[1] = tmp0;
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
basisvalues[0] *= std::sqrt(0.5);
basisvalues[2] *= std::sqrt(1.0);
basisvalues[1] *= std::sqrt(3.0);
// Table(s) of coefficients
static const double coefficients0[3] = \
{0.471404520791032, 0.288675134594813, -0.166666666666667};
// Compute value(s)
for (unsigned int r = 0; r < 3; r++)
{
values[0] += coefficients0[r]*basisvalues[r];
} // end loop over 'r'
break;
}
case 2:
{
// Array of basisvalues
double basisvalues[3] = {0.0, 0.0, 0.0};
// Declare helper variables
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
// Compute basisvalues
basisvalues[0] = 1.0;
basisvalues[1] = tmp0;
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
basisvalues[0] *= std::sqrt(0.5);
basisvalues[2] *= std::sqrt(1.0);
basisvalues[1] *= std::sqrt(3.0);
// Table(s) of coefficients
static const double coefficients0[3] = \
{0.471404520791032, 0.0, 0.333333333333333};
// Compute value(s)
for (unsigned int r = 0; r < 3; r++)
{
values[0] += coefficients0[r]*basisvalues[r];
} // end loop over 'r'
break;
}
case 3:
{
// Array of basisvalues
double basisvalues[3] = {0.0, 0.0, 0.0};
// Declare helper variables
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
// Compute basisvalues
basisvalues[0] = 1.0;
basisvalues[1] = tmp0;
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
basisvalues[0] *= std::sqrt(0.5);
basisvalues[2] *= std::sqrt(1.0);
basisvalues[1] *= std::sqrt(3.0);
// Table(s) of coefficients
static const double coefficients0[3] = \
{0.471404520791032, -0.288675134594813, -0.166666666666667};
// Compute value(s)
for (unsigned int r = 0; r < 3; r++)
{
values[1] += coefficients0[r]*basisvalues[r];
} // end loop over 'r'
break;
}
case 4:
{
// Array of basisvalues
double basisvalues[3] = {0.0, 0.0, 0.0};
// Declare helper variables
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
// Compute basisvalues
basisvalues[0] = 1.0;
basisvalues[1] = tmp0;
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
basisvalues[0] *= std::sqrt(0.5);
basisvalues[2] *= std::sqrt(1.0);
basisvalues[1] *= std::sqrt(3.0);
// Table(s) of coefficients
static const double coefficients0[3] = \
{0.471404520791032, 0.288675134594813, -0.166666666666667};
// Compute value(s)
for (unsigned int r = 0; r < 3; r++)
{
values[1] += coefficients0[r]*basisvalues[r];
} // end loop over 'r'
break;
}
case 5:
{
// Array of basisvalues
double basisvalues[3] = {0.0, 0.0, 0.0};
// Declare helper variables
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
// Compute basisvalues
basisvalues[0] = 1.0;
basisvalues[1] = tmp0;
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
basisvalues[0] *= std::sqrt(0.5);
basisvalues[2] *= std::sqrt(1.0);
basisvalues[1] *= std::sqrt(3.0);
// Table(s) of coefficients
static const double coefficients0[3] = \
{0.471404520791032, 0.0, 0.333333333333333};
// Compute value(s)
for (unsigned int r = 0; r < 3; r++)
{
values[1] += coefficients0[r]*basisvalues[r];
} // end loop over 'r'
break;
}
}
}
void evaluate_basis(std::size_t i,
double * values,
const double * x,
const double * coordinate_dofs,
int cell_orientation) const final override
{
_evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
}
static void _evaluate_basis_all(double * values,
const double * x,
const double * coordinate_dofs,
int cell_orientation)
{
// Helper variable to hold values of a single dof.
double dof_values[2] = {0.0, 0.0};
// Loop dofs and call evaluate_basis
for (unsigned int r = 0; r < 6; r++)
{
_evaluate_basis(r, dof_values, x, coordinate_dofs, cell_orientation);
for (unsigned int s = 0; s < 2; s++)
{
values[r*2 + s] = dof_values[s];
} // end loop over 's'
} // end loop over 'r'
}
void evaluate_basis_all(double * values,
const double * x,
const double * coordinate_dofs,
int cell_orientation) const final override
{
_evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
}
static void _evaluate_basis_derivatives(std::size_t i,
std::size_t n,
double * values,
const double * x,
const double * coordinate_dofs,
int cell_orientation)
{
// Compute number of derivatives.
unsigned int num_derivatives = 1;
for (unsigned int r = 0; r < n; r++)
{
num_derivatives *= 2;
} // end loop over 'r'
// Reset values. Assuming that values is always an array.
for (unsigned int r = 0; r < 2*num_derivatives; r++)
{
values[r] = 0.0;
} // end loop over 'r'
// Call evaluate_basis if order of derivatives is equal to zero.
if (n == 0)
{
_evaluate_basis(i, values, x, coordinate_dofs, cell_orientation);
return ;
}
// If order of derivatives is greater than the maximum polynomial degree, return zeros.
if (n > 1)
{
return ;
}
// Compute Jacobian
double J[4];
compute_jacobian_triangle_2d(J, coordinate_dofs);
// Compute Jacobian inverse and determinant
double K[4];
double detJ;
compute_jacobian_inverse_triangle_2d(K, detJ, J);
// Compute constants
const double C0 = coordinate_dofs[2] + coordinate_dofs[4];
const double C1 = coordinate_dofs[3] + coordinate_dofs[5];
// Get coordinates and map to the reference (FIAT) element
double X = (J[1]*(C1 - 2.0*x[1]) + J[3]*(2.0*x[0] - C0)) / detJ;
double Y = (J[0]*(2.0*x[1] - C1) + J[2]*(C0 - 2.0*x[0])) / detJ;
// Declare two dimensional array that holds combinations of derivatives and initialise
unsigned int combinations[2][1];
for (unsigned int row = 0; row < 2; row++)
{
for (unsigned int col = 0; col < 1; col++)
combinations[row][col] = 0;
}
// Generate combinations of derivatives
for (unsigned int row = 1; row < num_derivatives; row++)
{
for (unsigned int num = 0; num < row; num++)
{
for (unsigned int col = n-1; col+1 > 0; col--)
{
if (combinations[row][col] + 1 > 1)
combinations[row][col] = 0;
else
{
combinations[row][col] += 1;
break;
}
}
}
}
// Compute inverse of Jacobian
const double Jinv[2][2] = {{K[0], K[1]}, {K[2], K[3]}};
// Declare transformation matrix
// Declare pointer to two dimensional array and initialise
double transform[2][2];
for (unsigned int j = 0; j < num_derivatives; j++)
{
for (unsigned int k = 0; k < num_derivatives; k++)
transform[j][k] = 1;
}
// Construct transformation matrix
for (unsigned int row = 0; row < num_derivatives; row++)
{
for (unsigned int col = 0; col < num_derivatives; col++)
{
for (unsigned int k = 0; k < n; k++)
transform[row][col] *= Jinv[combinations[col][k]][combinations[row][k]];
}
}
switch (i)
{
case 0:
{
// Array of basisvalues
double basisvalues[3] = {0.0, 0.0, 0.0};
// Declare helper variables
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
// Compute basisvalues
basisvalues[0] = 1.0;
basisvalues[1] = tmp0;
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
basisvalues[0] *= std::sqrt(0.5);
basisvalues[2] *= std::sqrt(1.0);
basisvalues[1] *= std::sqrt(3.0);
// Table(s) of coefficients
static const double coefficients0[3] = \
{0.471404520791032, -0.288675134594813, -0.166666666666667};
// Tables of derivatives of the polynomial base (transpose).
static const double dmats0[3][3] = \
{{0.0, 0.0, 0.0},
{4.89897948556635, 0.0, 0.0},
{0.0, 0.0, 0.0}};
static const double dmats1[3][3] = \
{{0.0, 0.0, 0.0},
{2.44948974278318, 0.0, 0.0},
{4.24264068711928, 0.0, 0.0}};
// Compute reference derivatives.
// Declare array of derivatives on FIAT element.
double derivatives[2];
for (unsigned int r = 0; r < 2; r++)
{
derivatives[r] = 0.0;
} // end loop over 'r'
// Declare derivative matrix (of polynomial basis).
double dmats[3][3] = \
{{1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}};
// Declare (auxiliary) derivative matrix (of polynomial basis).
double dmats_old[3][3] = \
{{1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}};
// Loop possible derivatives.
for (unsigned int r = 0; r < num_derivatives; r++)
{
// Resetting dmats values to compute next derivative.
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
dmats[t][u] = 0.0;
if (t == u)
{
dmats[t][u] = 1.0;
}
} // end loop over 'u'
} // end loop over 't'
// Looping derivative order to generate dmats.
for (unsigned int s = 0; s < n; s++)
{
// Updating dmats_old with new values and resetting dmats.
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
dmats_old[t][u] = dmats[t][u];
dmats[t][u] = 0.0;
} // end loop over 'u'
} // end loop over 't'
// Update dmats using an inner product.
if (combinations[r][s] == 0)
{
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
for (unsigned int tu = 0; tu < 3; tu++)
{
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
} // end loop over 'tu'
} // end loop over 'u'
} // end loop over 't'
}
if (combinations[r][s] == 1)
{
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
for (unsigned int tu = 0; tu < 3; tu++)
{
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
} // end loop over 'tu'
} // end loop over 'u'
} // end loop over 't'
}
} // end loop over 's'
for (unsigned int s = 0; s < 3; s++)
{
for (unsigned int t = 0; t < 3; t++)
{
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
} // end loop over 't'
} // end loop over 's'
} // end loop over 'r'
// Transform derivatives back to physical element
for (unsigned int r = 0; r < num_derivatives; r++)
{
for (unsigned int s = 0; s < num_derivatives; s++)
{
values[r] += transform[r][s]*derivatives[s];
} // end loop over 's'
} // end loop over 'r'
break;
}
case 1:
{
// Array of basisvalues
double basisvalues[3] = {0.0, 0.0, 0.0};
// Declare helper variables
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
// Compute basisvalues
basisvalues[0] = 1.0;
basisvalues[1] = tmp0;
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
basisvalues[0] *= std::sqrt(0.5);
basisvalues[2] *= std::sqrt(1.0);
basisvalues[1] *= std::sqrt(3.0);
// Table(s) of coefficients
static const double coefficients0[3] = \
{0.471404520791032, 0.288675134594813, -0.166666666666667};
// Tables of derivatives of the polynomial base (transpose).
static const double dmats0[3][3] = \
{{0.0, 0.0, 0.0},
{4.89897948556635, 0.0, 0.0},
{0.0, 0.0, 0.0}};
static const double dmats1[3][3] = \
{{0.0, 0.0, 0.0},
{2.44948974278318, 0.0, 0.0},
{4.24264068711928, 0.0, 0.0}};
// Compute reference derivatives.
// Declare array of derivatives on FIAT element.
double derivatives[2];
for (unsigned int r = 0; r < 2; r++)
{
derivatives[r] = 0.0;
} // end loop over 'r'
// Declare derivative matrix (of polynomial basis).
double dmats[3][3] = \
{{1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}};
// Declare (auxiliary) derivative matrix (of polynomial basis).
double dmats_old[3][3] = \
{{1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}};
// Loop possible derivatives.
for (unsigned int r = 0; r < num_derivatives; r++)
{
// Resetting dmats values to compute next derivative.
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
dmats[t][u] = 0.0;
if (t == u)
{
dmats[t][u] = 1.0;
}
} // end loop over 'u'
} // end loop over 't'
// Looping derivative order to generate dmats.
for (unsigned int s = 0; s < n; s++)
{
// Updating dmats_old with new values and resetting dmats.
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
dmats_old[t][u] = dmats[t][u];
dmats[t][u] = 0.0;
} // end loop over 'u'
} // end loop over 't'
// Update dmats using an inner product.
if (combinations[r][s] == 0)
{
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
for (unsigned int tu = 0; tu < 3; tu++)
{
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
} // end loop over 'tu'
} // end loop over 'u'
} // end loop over 't'
}
if (combinations[r][s] == 1)
{
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
for (unsigned int tu = 0; tu < 3; tu++)
{
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
} // end loop over 'tu'
} // end loop over 'u'
} // end loop over 't'
}
} // end loop over 's'
for (unsigned int s = 0; s < 3; s++)
{
for (unsigned int t = 0; t < 3; t++)
{
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
} // end loop over 't'
} // end loop over 's'
} // end loop over 'r'
// Transform derivatives back to physical element
for (unsigned int r = 0; r < num_derivatives; r++)
{
for (unsigned int s = 0; s < num_derivatives; s++)
{
values[r] += transform[r][s]*derivatives[s];
} // end loop over 's'
} // end loop over 'r'
break;
}
case 2:
{
// Array of basisvalues
double basisvalues[3] = {0.0, 0.0, 0.0};
// Declare helper variables
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
// Compute basisvalues
basisvalues[0] = 1.0;
basisvalues[1] = tmp0;
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
basisvalues[0] *= std::sqrt(0.5);
basisvalues[2] *= std::sqrt(1.0);
basisvalues[1] *= std::sqrt(3.0);
// Table(s) of coefficients
static const double coefficients0[3] = \
{0.471404520791032, 0.0, 0.333333333333333};
// Tables of derivatives of the polynomial base (transpose).
static const double dmats0[3][3] = \
{{0.0, 0.0, 0.0},
{4.89897948556635, 0.0, 0.0},
{0.0, 0.0, 0.0}};
static const double dmats1[3][3] = \
{{0.0, 0.0, 0.0},
{2.44948974278318, 0.0, 0.0},
{4.24264068711928, 0.0, 0.0}};
// Compute reference derivatives.
// Declare array of derivatives on FIAT element.
double derivatives[2];
for (unsigned int r = 0; r < 2; r++)
{
derivatives[r] = 0.0;
} // end loop over 'r'
// Declare derivative matrix (of polynomial basis).
double dmats[3][3] = \
{{1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}};
// Declare (auxiliary) derivative matrix (of polynomial basis).
double dmats_old[3][3] = \
{{1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}};
// Loop possible derivatives.
for (unsigned int r = 0; r < num_derivatives; r++)
{
// Resetting dmats values to compute next derivative.
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
dmats[t][u] = 0.0;
if (t == u)
{
dmats[t][u] = 1.0;
}
} // end loop over 'u'
} // end loop over 't'
// Looping derivative order to generate dmats.
for (unsigned int s = 0; s < n; s++)
{
// Updating dmats_old with new values and resetting dmats.
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
dmats_old[t][u] = dmats[t][u];
dmats[t][u] = 0.0;
} // end loop over 'u'
} // end loop over 't'
// Update dmats using an inner product.
if (combinations[r][s] == 0)
{
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
for (unsigned int tu = 0; tu < 3; tu++)
{
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
} // end loop over 'tu'
} // end loop over 'u'
} // end loop over 't'
}
if (combinations[r][s] == 1)
{
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
for (unsigned int tu = 0; tu < 3; tu++)
{
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
} // end loop over 'tu'
} // end loop over 'u'
} // end loop over 't'
}
} // end loop over 's'
for (unsigned int s = 0; s < 3; s++)
{
for (unsigned int t = 0; t < 3; t++)
{
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
} // end loop over 't'
} // end loop over 's'
} // end loop over 'r'
// Transform derivatives back to physical element
for (unsigned int r = 0; r < num_derivatives; r++)
{
for (unsigned int s = 0; s < num_derivatives; s++)
{
values[r] += transform[r][s]*derivatives[s];
} // end loop over 's'
} // end loop over 'r'
break;
}
case 3:
{
// Array of basisvalues
double basisvalues[3] = {0.0, 0.0, 0.0};
// Declare helper variables
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
// Compute basisvalues
basisvalues[0] = 1.0;
basisvalues[1] = tmp0;
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
basisvalues[0] *= std::sqrt(0.5);
basisvalues[2] *= std::sqrt(1.0);
basisvalues[1] *= std::sqrt(3.0);
// Table(s) of coefficients
static const double coefficients0[3] = \
{0.471404520791032, -0.288675134594813, -0.166666666666667};
// Tables of derivatives of the polynomial base (transpose).
static const double dmats0[3][3] = \
{{0.0, 0.0, 0.0},
{4.89897948556635, 0.0, 0.0},
{0.0, 0.0, 0.0}};
static const double dmats1[3][3] = \
{{0.0, 0.0, 0.0},
{2.44948974278318, 0.0, 0.0},
{4.24264068711928, 0.0, 0.0}};
// Compute reference derivatives.
// Declare array of derivatives on FIAT element.
double derivatives[2];
for (unsigned int r = 0; r < 2; r++)
{
derivatives[r] = 0.0;
} // end loop over 'r'
// Declare derivative matrix (of polynomial basis).
double dmats[3][3] = \
{{1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}};
// Declare (auxiliary) derivative matrix (of polynomial basis).
double dmats_old[3][3] = \
{{1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}};
// Loop possible derivatives.
for (unsigned int r = 0; r < num_derivatives; r++)
{
// Resetting dmats values to compute next derivative.
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
dmats[t][u] = 0.0;
if (t == u)
{
dmats[t][u] = 1.0;
}
} // end loop over 'u'
} // end loop over 't'
// Looping derivative order to generate dmats.
for (unsigned int s = 0; s < n; s++)
{
// Updating dmats_old with new values and resetting dmats.
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
dmats_old[t][u] = dmats[t][u];
dmats[t][u] = 0.0;
} // end loop over 'u'
} // end loop over 't'
// Update dmats using an inner product.
if (combinations[r][s] == 0)
{
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
for (unsigned int tu = 0; tu < 3; tu++)
{
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
} // end loop over 'tu'
} // end loop over 'u'
} // end loop over 't'
}
if (combinations[r][s] == 1)
{
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
for (unsigned int tu = 0; tu < 3; tu++)
{
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
} // end loop over 'tu'
} // end loop over 'u'
} // end loop over 't'
}
} // end loop over 's'
for (unsigned int s = 0; s < 3; s++)
{
for (unsigned int t = 0; t < 3; t++)
{
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
} // end loop over 't'
} // end loop over 's'
} // end loop over 'r'
// Transform derivatives back to physical element
for (unsigned int r = 0; r < num_derivatives; r++)
{
for (unsigned int s = 0; s < num_derivatives; s++)
{
values[num_derivatives + r] += transform[r][s]*derivatives[s];
} // end loop over 's'
} // end loop over 'r'
break;
}
case 4:
{
// Array of basisvalues
double basisvalues[3] = {0.0, 0.0, 0.0};
// Declare helper variables
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
// Compute basisvalues
basisvalues[0] = 1.0;
basisvalues[1] = tmp0;
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
basisvalues[0] *= std::sqrt(0.5);
basisvalues[2] *= std::sqrt(1.0);
basisvalues[1] *= std::sqrt(3.0);
// Table(s) of coefficients
static const double coefficients0[3] = \
{0.471404520791032, 0.288675134594813, -0.166666666666667};
// Tables of derivatives of the polynomial base (transpose).
static const double dmats0[3][3] = \
{{0.0, 0.0, 0.0},
{4.89897948556635, 0.0, 0.0},
{0.0, 0.0, 0.0}};
static const double dmats1[3][3] = \
{{0.0, 0.0, 0.0},
{2.44948974278318, 0.0, 0.0},
{4.24264068711928, 0.0, 0.0}};
// Compute reference derivatives.
// Declare array of derivatives on FIAT element.
double derivatives[2];
for (unsigned int r = 0; r < 2; r++)
{
derivatives[r] = 0.0;
} // end loop over 'r'
// Declare derivative matrix (of polynomial basis).
double dmats[3][3] = \
{{1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}};
// Declare (auxiliary) derivative matrix (of polynomial basis).
double dmats_old[3][3] = \
{{1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}};
// Loop possible derivatives.
for (unsigned int r = 0; r < num_derivatives; r++)
{
// Resetting dmats values to compute next derivative.
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
dmats[t][u] = 0.0;
if (t == u)
{
dmats[t][u] = 1.0;
}
} // end loop over 'u'
} // end loop over 't'
// Looping derivative order to generate dmats.
for (unsigned int s = 0; s < n; s++)
{
// Updating dmats_old with new values and resetting dmats.
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
dmats_old[t][u] = dmats[t][u];
dmats[t][u] = 0.0;
} // end loop over 'u'
} // end loop over 't'
// Update dmats using an inner product.
if (combinations[r][s] == 0)
{
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
for (unsigned int tu = 0; tu < 3; tu++)
{
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
} // end loop over 'tu'
} // end loop over 'u'
} // end loop over 't'
}
if (combinations[r][s] == 1)
{
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
for (unsigned int tu = 0; tu < 3; tu++)
{
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
} // end loop over 'tu'
} // end loop over 'u'
} // end loop over 't'
}
} // end loop over 's'
for (unsigned int s = 0; s < 3; s++)
{
for (unsigned int t = 0; t < 3; t++)
{
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
} // end loop over 't'
} // end loop over 's'
} // end loop over 'r'
// Transform derivatives back to physical element
for (unsigned int r = 0; r < num_derivatives; r++)
{
for (unsigned int s = 0; s < num_derivatives; s++)
{
values[num_derivatives + r] += transform[r][s]*derivatives[s];
} // end loop over 's'
} // end loop over 'r'
break;
}
case 5:
{
// Array of basisvalues
double basisvalues[3] = {0.0, 0.0, 0.0};
// Declare helper variables
double tmp0 = (1.0 + Y + 2.0*X)/2.0;
// Compute basisvalues
basisvalues[0] = 1.0;
basisvalues[1] = tmp0;
basisvalues[2] = basisvalues[0]*(0.5 + 1.5*Y);
basisvalues[0] *= std::sqrt(0.5);
basisvalues[2] *= std::sqrt(1.0);
basisvalues[1] *= std::sqrt(3.0);
// Table(s) of coefficients
static const double coefficients0[3] = \
{0.471404520791032, 0.0, 0.333333333333333};
// Tables of derivatives of the polynomial base (transpose).
static const double dmats0[3][3] = \
{{0.0, 0.0, 0.0},
{4.89897948556635, 0.0, 0.0},
{0.0, 0.0, 0.0}};
static const double dmats1[3][3] = \
{{0.0, 0.0, 0.0},
{2.44948974278318, 0.0, 0.0},
{4.24264068711928, 0.0, 0.0}};
// Compute reference derivatives.
// Declare array of derivatives on FIAT element.
double derivatives[2];
for (unsigned int r = 0; r < 2; r++)
{
derivatives[r] = 0.0;
} // end loop over 'r'
// Declare derivative matrix (of polynomial basis).
double dmats[3][3] = \
{{1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}};
// Declare (auxiliary) derivative matrix (of polynomial basis).
double dmats_old[3][3] = \
{{1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{0.0, 0.0, 1.0}};
// Loop possible derivatives.
for (unsigned int r = 0; r < num_derivatives; r++)
{
// Resetting dmats values to compute next derivative.
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
dmats[t][u] = 0.0;
if (t == u)
{
dmats[t][u] = 1.0;
}
} // end loop over 'u'
} // end loop over 't'
// Looping derivative order to generate dmats.
for (unsigned int s = 0; s < n; s++)
{
// Updating dmats_old with new values and resetting dmats.
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
dmats_old[t][u] = dmats[t][u];
dmats[t][u] = 0.0;
} // end loop over 'u'
} // end loop over 't'
// Update dmats using an inner product.
if (combinations[r][s] == 0)
{
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
for (unsigned int tu = 0; tu < 3; tu++)
{
dmats[t][u] += dmats0[t][tu]*dmats_old[tu][u];
} // end loop over 'tu'
} // end loop over 'u'
} // end loop over 't'
}
if (combinations[r][s] == 1)
{
for (unsigned int t = 0; t < 3; t++)
{
for (unsigned int u = 0; u < 3; u++)
{
for (unsigned int tu = 0; tu < 3; tu++)
{
dmats[t][u] += dmats1[t][tu]*dmats_old[tu][u];
} // end loop over 'tu'
} // end loop over 'u'
} // end loop over 't'
}
} // end loop over 's'
for (unsigned int s = 0; s < 3; s++)
{
for (unsigned int t = 0; t < 3; t++)
{
derivatives[r] += coefficients0[s]*dmats[s][t]*basisvalues[t];
} // end loop over 't'
} // end loop over 's'
} // end loop over 'r'
// Transform derivatives back to physical element
for (unsigned int r = 0; r < num_derivatives; r++)
{
for (unsigned int s = 0; s < num_derivatives; s++)
{
values[num_derivatives + r] += transform[r][s]*derivatives[s];
} // end loop over 's'
} // end loop over 'r'
break;
}
}
}
void evaluate_basis_derivatives(std::size_t i,
std::size_t n,
double * values,
const double * x,
const double * coordinate_dofs,
int cell_orientation) const final override
{
_evaluate_basis_derivatives(i, n, values, x, coordinate_dofs, cell_orientation);
}
static void _evaluate_basis_derivatives_all(std::size_t n,
double * values,
const double * x,
const double * coordinate_dofs,
int cell_orientation)
{
// Call evaluate_basis_all if order of derivatives is equal to zero.
if (n == 0)
{
_evaluate_basis_all(values, x, coordinate_dofs, cell_orientation);
return ;
}
// Compute number of derivatives.
unsigned int num_derivatives = 1;
for (unsigned int r = 0; r < n; r++)
{
num_derivatives *= 2;
} // end loop over 'r'
// Set values equal to zero.
for (unsigned int r = 0; r < 6; r++)
{
for (unsigned int s = 0; s < 2*num_derivatives; s++)
{
values[r*2*num_derivatives + s] = 0.0;
} // end loop over 's'
} // end loop over 'r'
// If order of derivatives is greater than the maximum polynomial degree, return zeros.
if (n > 1)
{
return ;
}
// Helper variable to hold values of a single dof.
double dof_values[4];
for (unsigned int r = 0; r < 4; r++)
{
dof_values[r] = 0.0;
} // end loop over 'r'
// Loop dofs and call evaluate_basis_derivatives.
for (unsigned int r = 0; r < 6; r++)
{
_evaluate_basis_derivatives(r, n, dof_values, x, coordinate_dofs, cell_orientation);
for (unsigned int s = 0; s < 2*num_derivatives; s++)
{
values[r*2*num_derivatives + s] = dof_values[s];
} // end loop over 's'
} // end loop over 'r'
}
void evaluate_basis_derivatives_all(std::size_t n,
double * values,
const double * x,
const double * coordinate_dofs,
int cell_orientation) const final override
{
_evaluate_basis_derivatives_all(n, values, x, coordinate_dofs, cell_orientation);
}
double evaluate_dof(std::size_t i,
const ufc::function& f,
const double * coordinate_dofs,
int cell_orientation,
const ufc::cell& c) const final override
{
// Declare variables for result of evaluation
double vals[2];
// Declare variable for physical coordinates
double y[2];
switch (i)
{
case 0:
{
y[0] = coordinate_dofs[0];
y[1] = coordinate_dofs[1];
f.evaluate(vals, y, c);
return vals[0];
break;
}
case 1:
{
y[0] = coordinate_dofs[2];
y[1] = coordinate_dofs[3];
f.evaluate(vals, y, c);
return vals[0];
break;
}
case 2:
{
y[0] = coordinate_dofs[4];
y[1] = coordinate_dofs[5];
f.evaluate(vals, y, c);
return vals[0];
break;
}
case 3:
{
y[0] = coordinate_dofs[0];
y[1] = coordinate_dofs[1];
f.evaluate(vals, y, c);
return vals[1];
break;
}
case 4:
{
y[0] = coordinate_dofs[2];
y[1] = coordinate_dofs[3];
f.evaluate(vals, y, c);
return vals[1];
break;
}
case 5:
{
y[0] = coordinate_dofs[4];
y[1] = coordinate_dofs[5];
f.evaluate(vals, y, c);
return vals[1];
break;
}
}
return 0.0;
}
void evaluate_dofs(double * values,
const ufc::function& f,
const double * coordinate_dofs,
int cell_orientation,
const ufc::cell& c) const final override
{
// Declare variables for result of evaluation
double vals[2];
// Declare variable for physical coordinates
double y[2];
y[0] = coordinate_dofs[0];
y[1] = coordinate_dofs[1];
f.evaluate(vals, y, c);
values[0] = vals[0];
values[3] = vals[1];
y[0] = coordinate_dofs[2];
y[1] = coordinate_dofs[3];
f.evaluate(vals, y, c);
values[1] = vals[0];
values[4] = vals[1];
y[0] = coordinate_dofs[4];
y[1] = coordinate_dofs[5];
f.evaluate(vals, y, c);
values[2] = vals[0];
values[5] = vals[1];
}
void interpolate_vertex_values(double * vertex_values,
const double * dof_values,
const double * coordinate_dofs,
int cell_orientation,
const ufc::cell& c) const final override
{
// Evaluate function and change variables
vertex_values[0] = dof_values[0];
vertex_values[2] = dof_values[1];
vertex_values[4] = dof_values[2];
// Evaluate function and change variables
vertex_values[1] = dof_values[3];
vertex_values[3] = dof_values[4];
vertex_values[5] = dof_values[5];
}
void tabulate_dof_coordinates(double * dof_coordinates,
const double * coordinate_dofs) const final override
{
dof_coordinates[0] = coordinate_dofs[0];
dof_coordinates[1] = coordinate_dofs[1];
dof_coordinates[2] = coordinate_dofs[2];
dof_coordinates[3] = coordinate_dofs[3];
dof_coordinates[4] = coordinate_dofs[4];
dof_coordinates[5] = coordinate_dofs[5];
dof_coordinates[6] = coordinate_dofs[0];
dof_coordinates[7] = coordinate_dofs[1];
dof_coordinates[8] = coordinate_dofs[2];
dof_coordinates[9] = coordinate_dofs[3];
dof_coordinates[10] = coordinate_dofs[4];
dof_coordinates[11] = coordinate_dofs[5];
}
std::size_t num_sub_elements() const final override
{
return 2;
}
ufc::finite_element * create_sub_element(std::size_t i) const final override
{
switch (i)
{
case 0:
{
return new multimeshpoisson_finite_element_0();
break;
}
case 1:
{
return new multimeshpoisson_finite_element_0();
break;
}
}
return 0;
}
ufc::finite_element * create() const final override
{
return new multimeshpoisson_finite_element_1();
}
};
class multimeshpoisson_dofmap_0: public ufc::dofmap
{
public:
multimeshpoisson_dofmap_0() : ufc::dofmap()
{
// Do nothing
}
~multimeshpoisson_dofmap_0() override
{
// Do nothing
}
const char * signature() const final override
{
return "FFC dofmap for FiniteElement('Lagrange', triangle, 1)";
}
bool needs_mesh_entities(std::size_t d) const final override
{
switch (d)
{
case 0:
{
return true;
break;
}
case 1:
{
return false;
break;
}
case 2:
{
return false;
break;
}
}
return false;
}
std::size_t topological_dimension() const final override
{
return 2;
}
std::size_t global_dimension(const std::vector<std::size_t>&
num_global_entities) const final override
{
return num_global_entities[0];
}
std::size_t num_element_dofs() const final override
{
return 3;
}
std::size_t num_facet_dofs() const final override
{
return 2;
}
std::size_t num_entity_dofs(std::size_t d) const final override
{
switch (d)
{
case 0:
{
return 1;
break;
}
case 1:
{
return 0;
break;
}
case 2:
{
return 0;
break;
}
}
return 0;
}
std::size_t num_entity_closure_dofs(std::size_t d) const final override
{
switch (d)
{
case 0:
{
return 1;
break;
}
case 1:
{
return 2;
break;
}
case 2:
{
return 3;
break;
}
}
return 0;
}
void tabulate_dofs(std::size_t * dofs,
const std::vector<std::size_t>& num_global_entities,
const std::vector<std::vector<std::size_t>>& entity_indices) const final override
{
dofs[0] = entity_indices[0][0];
dofs[1] = entity_indices[0][1];
dofs[2] = entity_indices[0][2];
}
void tabulate_facet_dofs(std::size_t * dofs,
std::size_t facet) const final override
{
switch (facet)
{
case 0:
{
dofs[0] = 1;
dofs[1] = 2;
break;
}
case 1:
{
dofs[0] = 0;
dofs[1] = 2;
break;
}
case 2:
{
dofs[0] = 0;
dofs[1] = 1;
break;
}
}
}
void tabulate_entity_dofs(std::size_t * dofs,
std::size_t d, std::size_t i) const final override
{
if (d > 2)
{
throw std::runtime_error("d is larger than dimension (2)");
}
switch (d)
{
case 0:
{
if (i > 2)
{
throw std::runtime_error("i is larger than number of entities (2)");
}
switch (i)
{
case 0:
{
dofs[0] = 0;
break;
}
case 1:
{
dofs[0] = 1;
break;
}
case 2:
{
dofs[0] = 2;
break;
}
}
break;
}
case 1:
{
break;
}
case 2:
{
break;
}
}
}
void tabulate_entity_closure_dofs(std::size_t * dofs,
std::size_t d, std::size_t i) const final override
{
if (d > 2)
{
throw std::runtime_error("d is larger than dimension (2)");
}
switch (d)
{
case 0:
{
if (i > 2)
{
throw std::runtime_error("i is larger than number of entities (2)");
}
switch (i)
{
case 0:
{
dofs[0] = 0;
break;
}
case 1:
{
dofs[0] = 1;
break;
}
case 2:
{
dofs[0] = 2;
break;
}
}
break;
}
case 1:
{
if (i > 2)
{
throw std::runtime_error("i is larger than number of entities (2)");
}
switch (i)
{
case 0:
{
dofs[0] = 1;
dofs[1] = 2;
break;
}
case 1:
{
dofs[0] = 0;
dofs[1] = 2;
break;
}
case 2:
{
dofs[0] = 0;
dofs[1] = 1;
break;
}
}
break;
}
case 2:
{
if (i > 0)
{
throw std::runtime_error("i is larger than number of entities (0)");
}
dofs[0] = 0;
dofs[1] = 1;
dofs[2] = 2;
break;
}
}
}
std::size_t num_sub_dofmaps() const final override
{
return 0;
}
ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
{
return 0;
}
ufc::dofmap * create() const final override
{
return new multimeshpoisson_dofmap_0();
}
};
class multimeshpoisson_dofmap_1: public ufc::dofmap
{
public:
multimeshpoisson_dofmap_1() : ufc::dofmap()
{
// Do nothing
}
~multimeshpoisson_dofmap_1() override
{
// Do nothing
}
const char * signature() const final override
{
return "FFC dofmap for VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2)";
}
bool needs_mesh_entities(std::size_t d) const final override
{
switch (d)
{
case 0:
{
return true;
break;
}
case 1:
{
return false;
break;
}
case 2:
{
return false;
break;
}
}
return false;
}
std::size_t topological_dimension() const final override
{
return 2;
}
std::size_t global_dimension(const std::vector<std::size_t>&
num_global_entities) const final override
{
return 2*num_global_entities[0];
}
std::size_t num_element_dofs() const final override
{
return 6;
}
std::size_t num_facet_dofs() const final override
{
return 4;
}
std::size_t num_entity_dofs(std::size_t d) const final override
{
switch (d)
{
case 0:
{
return 2;
break;
}
case 1:
{
return 0;
break;
}
case 2:
{
return 0;
break;
}
}
return 0;
}
std::size_t num_entity_closure_dofs(std::size_t d) const final override
{
switch (d)
{
case 0:
{
return 2;
break;
}
case 1:
{
return 4;
break;
}
case 2:
{
return 6;
break;
}
}
return 0;
}
void tabulate_dofs(std::size_t * dofs,
const std::vector<std::size_t>& num_global_entities,
const std::vector<std::vector<std::size_t>>& entity_indices) const final override
{
unsigned int offset = 0;
dofs[0] = offset + entity_indices[0][0];
dofs[1] = offset + entity_indices[0][1];
dofs[2] = offset + entity_indices[0][2];
offset += num_global_entities[0];
dofs[3] = offset + entity_indices[0][0];
dofs[4] = offset + entity_indices[0][1];
dofs[5] = offset + entity_indices[0][2];
offset += num_global_entities[0];
}
void tabulate_facet_dofs(std::size_t * dofs,
std::size_t facet) const final override
{
switch (facet)
{
case 0:
{
dofs[0] = 1;
dofs[1] = 2;
dofs[2] = 4;
dofs[3] = 5;
break;
}
case 1:
{
dofs[0] = 0;
dofs[1] = 2;
dofs[2] = 3;
dofs[3] = 5;
break;
}
case 2:
{
dofs[0] = 0;
dofs[1] = 1;
dofs[2] = 3;
dofs[3] = 4;
break;
}
}
}
void tabulate_entity_dofs(std::size_t * dofs,
std::size_t d, std::size_t i) const final override
{
if (d > 2)
{
throw std::runtime_error("d is larger than dimension (2)");
}
switch (d)
{
case 0:
{
if (i > 2)
{
throw std::runtime_error("i is larger than number of entities (2)");
}
switch (i)
{
case 0:
{
dofs[0] = 0;
dofs[1] = 3;
break;
}
case 1:
{
dofs[0] = 1;
dofs[1] = 4;
break;
}
case 2:
{
dofs[0] = 2;
dofs[1] = 5;
break;
}
}
break;
}
case 1:
{
break;
}
case 2:
{
break;
}
}
}
void tabulate_entity_closure_dofs(std::size_t * dofs,
std::size_t d, std::size_t i) const final override
{
if (d > 2)
{
throw std::runtime_error("d is larger than dimension (2)");
}
switch (d)
{
case 0:
{
if (i > 2)
{
throw std::runtime_error("i is larger than number of entities (2)");
}
switch (i)
{
case 0:
{
dofs[0] = 0;
dofs[1] = 3;
break;
}
case 1:
{
dofs[0] = 1;
dofs[1] = 4;
break;
}
case 2:
{
dofs[0] = 2;
dofs[1] = 5;
break;
}
}
break;
}
case 1:
{
if (i > 2)
{
throw std::runtime_error("i is larger than number of entities (2)");
}
switch (i)
{
case 0:
{
dofs[0] = 1;
dofs[1] = 2;
dofs[2] = 4;
dofs[3] = 5;
break;
}
case 1:
{
dofs[0] = 0;
dofs[1] = 2;
dofs[2] = 3;
dofs[3] = 5;
break;
}
case 2:
{
dofs[0] = 0;
dofs[1] = 1;
dofs[2] = 3;
dofs[3] = 4;
break;
}
}
break;
}
case 2:
{
if (i > 0)
{
throw std::runtime_error("i is larger than number of entities (0)");
}
dofs[0] = 0;
dofs[1] = 1;
dofs[2] = 2;
dofs[3] = 3;
dofs[4] = 4;
dofs[5] = 5;
break;
}
}
}
std::size_t num_sub_dofmaps() const final override
{
return 2;
}
ufc::dofmap * create_sub_dofmap(std::size_t i) const final override
{
switch (i)
{
case 0:
{
return new multimeshpoisson_dofmap_0();
break;
}
case 1:
{
return new multimeshpoisson_dofmap_0();
break;
}
}
return 0;
}
ufc::dofmap * create() const final override
{
return new multimeshpoisson_dofmap_1();
}
};
class multimeshpoisson_cell_integral_0_otherwise: public ufc::cell_integral
{
public:
multimeshpoisson_cell_integral_0_otherwise() : ufc::cell_integral()
{
}
~multimeshpoisson_cell_integral_0_otherwise() override
{
}
const std::vector<bool> & enabled_coefficients() const final override
{
static const std::vector<bool> enabled({});
return enabled;
}
void tabulate_tensor(double * A,
const double * const * w,
const double * coordinate_dofs,
int cell_orientation) const final override
{
// This function was generated using 'tensor' representation
// with the following integrals metadata:
//
// num_cells: None
// quadrature_degree: 0
// quadrature_rule: 'default'
// representation: 'tensor'
//
// and the following integral 0 metadata:
//
// estimated_polynomial_degree: 0
// quadrature_degree: 0
// quadrature_rule: 'default'
// representation: 'tensor'
// Number of operations (multiply-add pairs) for Jacobian data: 3
// Number of operations (multiply-add pairs) for geometry tensor: 8
// Number of operations (multiply-add pairs) for tensor contraction: 11
// Total number of operations (multiply-add pairs): 22
// Compute Jacobian
double J[4];
compute_jacobian_triangle_2d(J, coordinate_dofs);
// Compute Jacobian inverse and determinant
double K[4];
double detJ;
compute_jacobian_inverse_triangle_2d(K, detJ, J);
// Set scale factor
const double det = std::abs(detJ);
// Compute geometry tensor
const double G0_0_0 = det*(K[0]*K[0] + K[1]*K[1]);
const double G0_0_1 = det*(K[0]*K[2] + K[1]*K[3]);
const double G0_1_0 = det*(K[2]*K[0] + K[3]*K[1]);
const double G0_1_1 = det*(K[2]*K[2] + K[3]*K[3]);
// Compute element tensor
A[0] = 0.499999999999999*G0_0_0 + 0.5*G0_0_1 + 0.5*G0_1_0 + 0.5*G0_1_1;
A[1] = -0.499999999999999*G0_0_0 - 0.5*G0_1_0;
A[2] = -0.5*G0_0_1 - 0.5*G0_1_1;
A[3] = -0.499999999999999*G0_0_0 - 0.5*G0_0_1;
A[4] = 0.499999999999999*G0_0_0;
A[5] = 0.5*G0_0_1;
A[6] = -0.5*G0_1_0 - 0.5*G0_1_1;
A[7] = 0.5*G0_1_0;
A[8] = 0.5*G0_1_1;
}
};
class multimeshpoisson_cutcell_integral_0_otherwise: public ufc::cutcell_integral
{
public:
multimeshpoisson_cutcell_integral_0_otherwise() : ufc::cutcell_integral()
{
}
~multimeshpoisson_cutcell_integral_0_otherwise() override
{
}
const std::vector<bool> & enabled_coefficients() const final override
{
static const std::vector<bool> enabled({});
return enabled;
}
void tabulate_tensor(double * A,
const double * const * w,
const double * coordinate_dofs,
std::size_t num_quadrature_points,
const double * quadrature_points,
const double * quadrature_weights,
int cell_orientation) const final override
{
// This function was generated using 'quadrature' representation
// with the following integrals metadata:
//
// num_cells: None
// quadrature_degree: 0
// quadrature_rule: 'default'
// representation: 'quadrature'
//
// and the following integral 0 metadata:
//
// estimated_polynomial_degree: 0
// quadrature_degree: 0
// quadrature_rule: 'default'
// representation: 'quadrature'
// --- Compute geometric quantities on cell 0 ---
// Compute Jacobian
double J[4];
compute_jacobian_triangle_2d(J, coordinate_dofs);
// Compute Jacobian inverse and determinant
double K[4];
double detJ;
compute_jacobian_inverse_triangle_2d(K, detJ, J);
// Compute cell volume
// Compute circumradius of triangle in 2D
// Set quadrature weights
const double* W = quadrature_weights;
// --- Evaluation of basis function derivatives of order 1 ---
// Create table FE0_D10 for basis function derivatives on all cells
std::vector<std::vector<double> > FE0_D10(num_quadrature_points);
for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
FE0_D10[ip].resize(3);
// Create table FE0_D01 for basis function derivatives on all cells
std::vector<std::vector<double> > FE0_D01(num_quadrature_points);
for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
FE0_D01[ip].resize(3);
// Evaluate basis function derivatives on cell 0
static double FE0_dvalues_1_0[6];
for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
{
// Get current quadrature point and compute values of basis function derivatives
const double* x = quadrature_points + ip*2;
const double* v = coordinate_dofs + 0;
multimeshpoisson_finite_element_0::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_0, x, v, cell_orientation);
// Copy values to table FE0_D10
for (std::size_t i = 0; i < 3; i++)
FE0_D10[ip][0 + i] = FE0_dvalues_1_0[2*i + 0];
// Copy values to table FE0_D01
for (std::size_t i = 0; i < 3; i++)
FE0_D01[ip][0 + i] = FE0_dvalues_1_0[2*i + 1];
} // end loop over 'ip'
// Reset values in the element tensor.
for (unsigned int r = 0; r < 9; r++)
{
A[r] = 0.0;
} // end loop over 'r'
// Compute element tensor using UFL quadrature representation
// Optimisations: ('eliminate zeros', False), ('ignore ones', False), ('ignore zero tables', False), ('optimisation', False), ('remove zero terms', False)
// Loop quadrature points for integral.
// Number of operations to compute element tensor for following IP loop = unknown
for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
{
// Number of operations for primary indices: 81
for (unsigned int j = 0; j < 3; j++)
{
for (unsigned int k = 0; k < 3; k++)
{
// Number of operations to compute entry: 9
A[j*3 + k] += (((0 + FE0_D01[ip][j]))*((0 + FE0_D01[ip][k])) + ((FE0_D10[ip][j] + 0))*((FE0_D10[ip][k] + 0)))*W[ip];
} // end loop over 'k'
} // end loop over 'j'
} // end loop over 'ip'
}
};
class multimeshpoisson_interface_integral_0_otherwise: public ufc::interface_integral
{
public:
multimeshpoisson_interface_integral_0_otherwise() : ufc::interface_integral()
{
}
~multimeshpoisson_interface_integral_0_otherwise() override
{
}
const std::vector<bool> & enabled_coefficients() const final override
{
static const std::vector<bool> enabled({});
return enabled;
}
void tabulate_tensor(double * A,
const double * const * w,
const double * coordinate_dofs,
std::size_t num_quadrature_points,
const double * quadrature_points,
const double * quadrature_weights,
const double * facet_normals,
int cell_orientation) const final override
{
// This function was generated using 'quadrature' representation
// with the following integrals metadata:
//
// num_cells: None
// quadrature_degree: 2
// quadrature_rule: 'default'
// representation: 'quadrature'
//
// and the following integral 0 metadata:
//
// estimated_polynomial_degree: 2
// quadrature_degree: 2
// quadrature_rule: 'default'
// representation: 'quadrature'
// --- Compute geometric quantities on cell 0 ---
// Extract vertex coordinates
const double* coordinate_dofs_0 = coordinate_dofs + 0;
// Compute Jacobian
double J_0[4];
compute_jacobian_triangle_2d(J_0, coordinate_dofs_0);
// Compute Jacobian inverse and determinant
double K_0[4];
double detJ_0;
compute_jacobian_inverse_triangle_2d(K_0, detJ_0, J_0);
// Compute cell volume
const double volume_0 = std::abs(detJ_0)/2.0;
// Compute circumradius of triangle in 2D
const double v1v2_0 = std::sqrt((coordinate_dofs_0[4] - coordinate_dofs_0[2])*(coordinate_dofs_0[4] - coordinate_dofs_0[2]) + (coordinate_dofs_0[5] - coordinate_dofs_0[3])*(coordinate_dofs_0[5] - coordinate_dofs_0[3]) );
const double v0v2_0 = std::sqrt(J_0[3]*J_0[3] + J_0[1]*J_0[1]);
const double v0v1_0 = std::sqrt(J_0[0]*J_0[0] + J_0[2]*J_0[2]);
const double circumradius_0 = 0.25*(v1v2_0*v0v2_0*v0v1_0)/(volume_0);
// --- Compute geometric quantities on cell 1 ---
// Extract vertex coordinates
const double* coordinate_dofs_1 = coordinate_dofs + 6;
// Compute Jacobian
double J_1[4];
compute_jacobian_triangle_2d(J_1, coordinate_dofs_1);
// Compute Jacobian inverse and determinant
double K_1[4];
double detJ_1;
compute_jacobian_inverse_triangle_2d(K_1, detJ_1, J_1);
// Compute cell volume
const double volume_1 = std::abs(detJ_1)/2.0;
// Compute circumradius of triangle in 2D
const double v1v2_1 = std::sqrt((coordinate_dofs_1[4] - coordinate_dofs_1[2])*(coordinate_dofs_1[4] - coordinate_dofs_1[2]) + (coordinate_dofs_1[5] - coordinate_dofs_1[3])*(coordinate_dofs_1[5] - coordinate_dofs_1[3]) );
const double v0v2_1 = std::sqrt(J_1[3]*J_1[3] + J_1[1]*J_1[1]);
const double v0v1_1 = std::sqrt(J_1[0]*J_1[0] + J_1[2]*J_1[2]);
const double circumradius_1 = 0.25*(v1v2_1*v0v2_1*v0v1_1)/(volume_1);
// Set quadrature weights
const double* W = quadrature_weights;
// --- Evaluation of basis functions ---
// Create table FE0 for basis function values on all cells
std::vector<std::vector<double> > FE0(num_quadrature_points);
for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
FE0[ip].resize(6);
// Evaluate basis functions on cell 0
static double FE0_values_0[3];
for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
{
// Get current quadrature point and compute values of basis functions
const double* x = quadrature_points + ip*2;
const double* v = coordinate_dofs + 0;
multimeshpoisson_finite_element_0::_evaluate_basis_all(FE0_values_0, x, v, cell_orientation);
// Copy values to table FE0
for (std::size_t i = 0; i < 3; i++)
FE0[ip][0 + i] = FE0_values_0[1*i + 0];
} // end loop over 'ip'
// Evaluate basis functions on cell 1
static double FE0_values_1[3];
for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
{
// Get current quadrature point and compute values of basis functions
const double* x = quadrature_points + ip*2;
const double* v = coordinate_dofs + 6;
multimeshpoisson_finite_element_0::_evaluate_basis_all(FE0_values_1, x, v, cell_orientation);
// Copy values to table FE0
for (std::size_t i = 0; i < 3; i++)
FE0[ip][3 + i] = FE0_values_1[1*i + 0];
} // end loop over 'ip'
// --- Evaluation of basis function derivatives of order 1 ---
// Create table FE0_D10 for basis function derivatives on all cells
std::vector<std::vector<double> > FE0_D10(num_quadrature_points);
for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
FE0_D10[ip].resize(6);
// Create table FE0_D01 for basis function derivatives on all cells
std::vector<std::vector<double> > FE0_D01(num_quadrature_points);
for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
FE0_D01[ip].resize(6);
// Evaluate basis function derivatives on cell 0
static double FE0_dvalues_1_0[6];
for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
{
// Get current quadrature point and compute values of basis function derivatives
const double* x = quadrature_points + ip*2;
const double* v = coordinate_dofs + 0;
multimeshpoisson_finite_element_0::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_0, x, v, cell_orientation);
// Copy values to table FE0_D10
for (std::size_t i = 0; i < 3; i++)
FE0_D10[ip][0 + i] = FE0_dvalues_1_0[2*i + 0];
// Copy values to table FE0_D01
for (std::size_t i = 0; i < 3; i++)
FE0_D01[ip][0 + i] = FE0_dvalues_1_0[2*i + 1];
} // end loop over 'ip'
// Evaluate basis function derivatives on cell 1
static double FE0_dvalues_1_1[6];
for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
{
// Get current quadrature point and compute values of basis function derivatives
const double* x = quadrature_points + ip*2;
const double* v = coordinate_dofs + 6;
multimeshpoisson_finite_element_0::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_1, x, v, cell_orientation);
// Copy values to table FE0_D10
for (std::size_t i = 0; i < 3; i++)
FE0_D10[ip][3 + i] = FE0_dvalues_1_1[2*i + 0];
// Copy values to table FE0_D01
for (std::size_t i = 0; i < 3; i++)
FE0_D01[ip][3 + i] = FE0_dvalues_1_1[2*i + 1];
} // end loop over 'ip'
// Reset values in the element tensor.
for (unsigned int r = 0; r < 36; r++)
{
A[r] = 0.0;
} // end loop over 'r'
// Compute element tensor using UFL quadrature representation
// Optimisations: ('eliminate zeros', False), ('ignore ones', False), ('ignore zero tables', False), ('optimisation', False), ('remove zero terms', False)
// Loop quadrature points for integral.
// Number of operations to compute element tensor for following IP loop = unknown
for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
{
// Set facet normal components for current quadrature point
const double n_00 = facet_normals[2*ip + 0];
const double n_10 = - facet_normals[2*ip + 0];
const double n_01 = facet_normals[2*ip + 1];
const double n_11 = - facet_normals[2*ip + 1];
// Number of operations for primary indices: 1080
for (unsigned int j = 0; j < 3; j++)
{
for (unsigned int k = 0; k < 3; k++)
{
// Number of operations to compute entry: 31
A[(j + 3)*6 + (k + 3)] += ((((((((FE0_D10[ip][k + 3]) + 0))*0.5)*(((FE0[ip][j + 3]))*n_10) + (((0 + (FE0_D01[ip][k + 3])))*0.5)*(((FE0[ip][j + 3]))*n_11)))*(-1.0) + (((FE0[ip][j + 3]))*(-1.0))*((((FE0[ip][k + 3]))*(-1.0))*(4.0/((2.0*circumradius_0 + 2.0*circumradius_1)/(2.0))))) + ((((((FE0_D10[ip][j + 3]) + 0))*0.5)*(((FE0[ip][k + 3]))*n_10) + (((0 + (FE0_D01[ip][j + 3])))*0.5)*(((FE0[ip][k + 3]))*n_11)))*(-1.0))*W[ip];
// Number of operations to compute entry: 30
A[(j + 3)*6 + k] += (((((((0 + FE0_D01[ip][k]))*0.5)*(((FE0[ip][j + 3]))*n_11) + (((FE0_D10[ip][k] + 0))*0.5)*(((FE0[ip][j + 3]))*n_10)))*(-1.0) + (((FE0[ip][j + 3]))*(-1.0))*(FE0[ip][k]*(4.0/((2.0*circumradius_0 + 2.0*circumradius_1)/(2.0))))) + ((((((FE0_D10[ip][j + 3]) + 0))*0.5)*FE0[ip][k]*n_00 + (((0 + (FE0_D01[ip][j + 3])))*0.5)*FE0[ip][k]*n_01))*(-1.0))*W[ip];
// Number of operations to compute entry: 30
A[j*6 + (k + 3)] += ((((((((FE0_D10[ip][k + 3]) + 0))*0.5)*FE0[ip][j]*n_00 + (((0 + (FE0_D01[ip][k + 3])))*0.5)*FE0[ip][j]*n_01))*(-1.0) + FE0[ip][j]*((((FE0[ip][k + 3]))*(-1.0))*(4.0/((2.0*circumradius_0 + 2.0*circumradius_1)/(2.0))))) + (((((0 + FE0_D01[ip][j]))*0.5)*(((FE0[ip][k + 3]))*n_11) + (((FE0_D10[ip][j] + 0))*0.5)*(((FE0[ip][k + 3]))*n_10)))*(-1.0))*W[ip];
// Number of operations to compute entry: 29
A[j*6 + k] += (((((((0 + FE0_D01[ip][k]))*0.5)*FE0[ip][j]*n_01 + (((FE0_D10[ip][k] + 0))*0.5)*FE0[ip][j]*n_00))*(-1.0) + FE0[ip][j]*(FE0[ip][k]*(4.0/((2.0*circumradius_0 + 2.0*circumradius_1)/(2.0))))) + (((((0 + FE0_D01[ip][j]))*0.5)*FE0[ip][k]*n_01 + (((FE0_D10[ip][j] + 0))*0.5)*FE0[ip][k]*n_00))*(-1.0))*W[ip];
} // end loop over 'k'
} // end loop over 'j'
} // end loop over 'ip'
}
};
class multimeshpoisson_overlap_integral_0_otherwise: public ufc::overlap_integral
{
public:
multimeshpoisson_overlap_integral_0_otherwise() : ufc::overlap_integral()
{
}
~multimeshpoisson_overlap_integral_0_otherwise() override
{
}
const std::vector<bool> & enabled_coefficients() const final override
{
static const std::vector<bool> enabled({});
return enabled;
}
void tabulate_tensor(double * A,
const double * const * w,
const double * coordinate_dofs,
std::size_t num_quadrature_points,
const double * quadrature_points,
const double * quadrature_weights,
int cell_orientation) const final override
{
// This function was generated using 'quadrature' representation
// with the following integrals metadata:
//
// num_cells: None
// quadrature_degree: 0
// quadrature_rule: 'default'
// representation: 'quadrature'
//
// and the following integral 0 metadata:
//
// estimated_polynomial_degree: 0
// quadrature_degree: 0
// quadrature_rule: 'default'
// representation: 'quadrature'
// --- Compute geometric quantities on cell 0 ---
// Extract vertex coordinates
const double* coordinate_dofs_0 = coordinate_dofs + 0;
// Compute Jacobian
double J_0[4];
compute_jacobian_triangle_2d(J_0, coordinate_dofs_0);
// Compute Jacobian inverse and determinant
double K_0[4];
double detJ_0;
compute_jacobian_inverse_triangle_2d(K_0, detJ_0, J_0);
// Compute cell volume
// Compute circumradius of triangle in 2D
// --- Compute geometric quantities on cell 1 ---
// Extract vertex coordinates
const double* coordinate_dofs_1 = coordinate_dofs + 6;
// Compute Jacobian
double J_1[4];
compute_jacobian_triangle_2d(J_1, coordinate_dofs_1);
// Compute Jacobian inverse and determinant
double K_1[4];
double detJ_1;
compute_jacobian_inverse_triangle_2d(K_1, detJ_1, J_1);
// Compute cell volume
// Compute circumradius of triangle in 2D
// Set quadrature weights
const double* W = quadrature_weights;
// --- Evaluation of basis function derivatives of order 1 ---
// Create table FE0_D10 for basis function derivatives on all cells
std::vector<std::vector<double> > FE0_D10(num_quadrature_points);
for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
FE0_D10[ip].resize(6);
// Create table FE0_D01 for basis function derivatives on all cells
std::vector<std::vector<double> > FE0_D01(num_quadrature_points);
for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
FE0_D01[ip].resize(6);
// Evaluate basis function derivatives on cell 0
static double FE0_dvalues_1_0[6];
for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
{
// Get current quadrature point and compute values of basis function derivatives
const double* x = quadrature_points + ip*2;
const double* v = coordinate_dofs + 0;
multimeshpoisson_finite_element_0::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_0, x, v, cell_orientation);
// Copy values to table FE0_D10
for (std::size_t i = 0; i < 3; i++)
FE0_D10[ip][0 + i] = FE0_dvalues_1_0[2*i + 0];
// Copy values to table FE0_D01
for (std::size_t i = 0; i < 3; i++)
FE0_D01[ip][0 + i] = FE0_dvalues_1_0[2*i + 1];
} // end loop over 'ip'
// Evaluate basis function derivatives on cell 1
static double FE0_dvalues_1_1[6];
for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
{
// Get current quadrature point and compute values of basis function derivatives
const double* x = quadrature_points + ip*2;
const double* v = coordinate_dofs + 6;
multimeshpoisson_finite_element_0::_evaluate_basis_derivatives_all(1, FE0_dvalues_1_1, x, v, cell_orientation);
// Copy values to table FE0_D10
for (std::size_t i = 0; i < 3; i++)
FE0_D10[ip][3 + i] = FE0_dvalues_1_1[2*i + 0];
// Copy values to table FE0_D01
for (std::size_t i = 0; i < 3; i++)
FE0_D01[ip][3 + i] = FE0_dvalues_1_1[2*i + 1];
} // end loop over 'ip'
// Reset values in the element tensor.
for (unsigned int r = 0; r < 36; r++)
{
A[r] = 0.0;
} // end loop over 'r'
// Compute element tensor using UFL quadrature representation
// Optimisations: ('eliminate zeros', False), ('ignore ones', False), ('ignore zero tables', False), ('optimisation', False), ('remove zero terms', False)
// Loop quadrature points for integral.
// Number of operations to compute element tensor for following IP loop = unknown
for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
{
// Number of operations for primary indices: 432
for (unsigned int j = 0; j < 3; j++)
{
for (unsigned int k = 0; k < 3; k++)
{
// Number of operations to compute entry: 14
A[(j + 3)*6 + (k + 3)] += ((((((FE0_D10[ip][j + 3]) + 0))*(-1.0))*((((FE0_D10[ip][k + 3]) + 0))*(-1.0)) + (((0 + (FE0_D01[ip][j + 3])))*(-1.0))*(((0 + (FE0_D01[ip][k + 3])))*(-1.0))))*4.0*W[ip];
// Number of operations to compute entry: 12
A[(j + 3)*6 + k] += ((((((FE0_D10[ip][j + 3]) + 0))*(-1.0))*((FE0_D10[ip][k] + 0)) + (((0 + (FE0_D01[ip][j + 3])))*(-1.0))*((0 + FE0_D01[ip][k]))))*4.0*W[ip];
// Number of operations to compute entry: 12
A[j*6 + (k + 3)] += ((((0 + FE0_D01[ip][j]))*(((0 + (FE0_D01[ip][k + 3])))*(-1.0)) + ((FE0_D10[ip][j] + 0))*((((FE0_D10[ip][k + 3]) + 0))*(-1.0))))*4.0*W[ip];
// Number of operations to compute entry: 10
A[j*6 + k] += ((((0 + FE0_D01[ip][j]))*((0 + FE0_D01[ip][k])) + ((FE0_D10[ip][j] + 0))*((FE0_D10[ip][k] + 0))))*4.0*W[ip];
} // end loop over 'k'
} // end loop over 'j'
} // end loop over 'ip'
}
};
class multimeshpoisson_cell_integral_1_otherwise: public ufc::cell_integral
{
public:
multimeshpoisson_cell_integral_1_otherwise() : ufc::cell_integral()
{
}
~multimeshpoisson_cell_integral_1_otherwise() override
{
}
const std::vector<bool> & enabled_coefficients() const final override
{
static const std::vector<bool> enabled({true});
return enabled;
}
void tabulate_tensor(double * A,
const double * const * w,
const double * coordinate_dofs,
int cell_orientation) const final override
{
// This function was generated using 'tensor' representation
// with the following integrals metadata:
//
// num_cells: None
// quadrature_degree: 2
// quadrature_rule: 'default'
// representation: 'tensor'
//
// and the following integral 0 metadata:
//
// estimated_polynomial_degree: 2
// quadrature_degree: 2
// quadrature_rule: 'default'
// representation: 'tensor'
// Number of operations (multiply-add pairs) for Jacobian data: 3
// Number of operations (multiply-add pairs) for geometry tensor: 3
// Number of operations (multiply-add pairs) for tensor contraction: 7
// Total number of operations (multiply-add pairs): 13
// Compute Jacobian
double J[4];
compute_jacobian_triangle_2d(J, coordinate_dofs);
// Compute Jacobian inverse and determinant
double K[4];
double detJ;
compute_jacobian_inverse_triangle_2d(K, detJ, J);
// Set scale factor
const double det = std::abs(detJ);
// Compute geometry tensor
const double G0_0 = det*w[0][0]*(1.0);
const double G0_1 = det*w[0][1]*(1.0);
const double G0_2 = det*w[0][2]*(1.0);
// Compute element tensor
A[0] = 0.0833333333333334*G0_0 + 0.0416666666666667*G0_1 + 0.0416666666666667*G0_2;
A[1] = 0.0416666666666667*G0_0 + 0.0833333333333333*G0_1 + 0.0416666666666666*G0_2;
A[2] = 0.0416666666666667*G0_0 + 0.0416666666666666*G0_1 + 0.0833333333333333*G0_2;
}
};
class multimeshpoisson_cutcell_integral_1_otherwise: public ufc::cutcell_integral
{
public:
multimeshpoisson_cutcell_integral_1_otherwise() : ufc::cutcell_integral()
{
}
~multimeshpoisson_cutcell_integral_1_otherwise() override
{
}
const std::vector<bool> & enabled_coefficients() const final override
{
static const std::vector<bool> enabled({true});
return enabled;
}
void tabulate_tensor(double * A,
const double * const * w,
const double * coordinate_dofs,
std::size_t num_quadrature_points,
const double * quadrature_points,
const double * quadrature_weights,
int cell_orientation) const final override
{
// This function was generated using 'quadrature' representation
// with the following integrals metadata:
//
// num_cells: None
// quadrature_degree: 2
// quadrature_rule: 'default'
// representation: 'quadrature'
//
// and the following integral 0 metadata:
//
// estimated_polynomial_degree: 2
// quadrature_degree: 2
// quadrature_rule: 'default'
// representation: 'quadrature'
// --- Compute geometric quantities on cell 0 ---
// Compute Jacobian
double J[4];
compute_jacobian_triangle_2d(J, coordinate_dofs);
// Compute Jacobian inverse and determinant
double K[4];
double detJ;
compute_jacobian_inverse_triangle_2d(K, detJ, J);
// Compute cell volume
// Compute circumradius of triangle in 2D
// Set quadrature weights
const double* W = quadrature_weights;
// --- Evaluation of basis functions ---
// Create table FE0 for basis function values on all cells
std::vector<std::vector<double> > FE0(num_quadrature_points);
for (std::size_t ip = 0; ip < num_quadrature_points; ip++)
FE0[ip].resize(3);
// Evaluate basis functions on cell 0
static double FE0_values_0[3];
for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
{
// Get current quadrature point and compute values of basis functions
const double* x = quadrature_points + ip*2;
const double* v = coordinate_dofs + 0;
multimeshpoisson_finite_element_0::_evaluate_basis_all(FE0_values_0, x, v, cell_orientation);
// Copy values to table FE0
for (std::size_t i = 0; i < 3; i++)
FE0[ip][0 + i] = FE0_values_0[1*i + 0];
} // end loop over 'ip'
// Reset values in the element tensor.
for (unsigned int r = 0; r < 3; r++)
{
A[r] = 0.0;
} // end loop over 'r'
// Compute element tensor using UFL quadrature representation
// Optimisations: ('eliminate zeros', False), ('ignore ones', False), ('ignore zero tables', False), ('optimisation', False), ('remove zero terms', False)
// Loop quadrature points for integral.
// Number of operations to compute element tensor for following IP loop = unknown
for (unsigned int ip = 0; ip < num_quadrature_points; ip++)
{
// Coefficient declarations.
double F0 = 0.0;
// Total number of operations to compute function values = 6
for (unsigned int r = 0; r < 3; r++)
{
F0 += FE0[ip][r]*w[0][r];
} // end loop over 'r'
// Number of operations for primary indices: 9
for (unsigned int j = 0; j < 3; j++)
{
// Number of operations to compute entry: 3
A[j] += FE0[ip][j]*F0*W[ip];
} // end loop over 'j'
} // end loop over 'ip'
}
};
class multimeshpoisson_form_0: public ufc::form
{
public:
multimeshpoisson_form_0() : ufc::form()
{
// Do nothing
}
~multimeshpoisson_form_0() override
{
// Do nothing
}
const char * signature() const final override
{
return "e5230f2cce2577e8ae299f6ad858716c7a551cb9b1352609899bd42ddfaf5841f7a6a1e1afdc8eda868c55f272a114dd516babb4a52cadf5a1ef795843803cbd";
}
std::size_t rank() const final override
{
return 2;
}
std::size_t num_coefficients() const final override
{
return 0;
}
std::size_t original_coefficient_position(std::size_t i) const final override
{
static const std::vector<std::size_t> position({});
return position[i];
}
ufc::finite_element * create_coordinate_finite_element() const final override
{
return new multimeshpoisson_finite_element_1();
}
ufc::dofmap * create_coordinate_dofmap() const final override
{
return new multimeshpoisson_dofmap_1();
}
ufc::coordinate_mapping * create_coordinate_mapping() const final override
{
return nullptr;
}
ufc::finite_element * create_finite_element(std::size_t i) const final override
{
switch (i)
{
case 0:
{
return new multimeshpoisson_finite_element_0();
break;
}
case 1:
{
return new multimeshpoisson_finite_element_0();
break;
}
}
return 0;
}
ufc::dofmap * create_dofmap(std::size_t i) const final override
{
switch (i)
{
case 0:
{
return new multimeshpoisson_dofmap_0();
break;
}
case 1:
{
return new multimeshpoisson_dofmap_0();
break;
}
}
return 0;
}
std::size_t max_cell_subdomain_id() const final override
{
return 0;
}
std::size_t max_exterior_facet_subdomain_id() const final override
{
return 0;
}
std::size_t max_interior_facet_subdomain_id() const final override
{
return 0;
}
std::size_t max_vertex_subdomain_id() const final override
{
return 0;
}
std::size_t max_custom_subdomain_id() const final override
{
return 0;
}
std::size_t max_cutcell_subdomain_id() const final override
{
return 0;
}
std::size_t max_interface_subdomain_id() const final override
{
return 0;
}
std::size_t max_overlap_subdomain_id() const final override
{
return 0;
}
bool has_cell_integrals() const final override
{
return true;
}
bool has_exterior_facet_integrals() const final override
{
return false;
}
bool has_interior_facet_integrals() const final override
{
return false;
}
bool has_vertex_integrals() const final override
{
return false;
}
bool has_custom_integrals() const final override
{
return false;
}
bool has_cutcell_integrals() const final override
{
return true;
}
bool has_interface_integrals() const final override
{
return true;
}
bool has_overlap_integrals() const final override
{
return true;
}
ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
{
return 0;
}
ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
{
return 0;
}
ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
{
return 0;
}
ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
{
return 0;
}
ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
{
return 0;
}
ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
{
return 0;
}
ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
{
return 0;
}
ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
{
return 0;
}
ufc::cell_integral * create_default_cell_integral() const final override
{
return new multimeshpoisson_cell_integral_0_otherwise();
}
ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
{
return 0;
}
ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
{
return 0;
}
ufc::vertex_integral * create_default_vertex_integral() const final override
{
return 0;
}
ufc::custom_integral * create_default_custom_integral() const final override
{
return 0;
}
ufc::cutcell_integral * create_default_cutcell_integral() const final override
{
return new multimeshpoisson_cutcell_integral_0_otherwise();
}
ufc::interface_integral * create_default_interface_integral() const final override
{
return new multimeshpoisson_interface_integral_0_otherwise();
}
ufc::overlap_integral * create_default_overlap_integral() const final override
{
return new multimeshpoisson_overlap_integral_0_otherwise();
}
};
class multimeshpoisson_form_1: public ufc::form
{
public:
multimeshpoisson_form_1() : ufc::form()
{
// Do nothing
}
~multimeshpoisson_form_1() override
{
// Do nothing
}
const char * signature() const final override
{
return "2789e34dafc7d1968368327a7763bf0a71f55d0fe61acbe8e654613eea64482cd9ae5938c8d6db91c7361009e9faeaf34e34f6653b456de900e336dc52f95e62";
}
std::size_t rank() const final override
{
return 1;
}
std::size_t num_coefficients() const final override
{
return 1;
}
std::size_t original_coefficient_position(std::size_t i) const final override
{
static const std::vector<std::size_t> position({0});
return position[i];
}
ufc::finite_element * create_coordinate_finite_element() const final override
{
return new multimeshpoisson_finite_element_1();
}
ufc::dofmap * create_coordinate_dofmap() const final override
{
return new multimeshpoisson_dofmap_1();
}
ufc::coordinate_mapping * create_coordinate_mapping() const final override
{
return nullptr;
}
ufc::finite_element * create_finite_element(std::size_t i) const final override
{
switch (i)
{
case 0:
{
return new multimeshpoisson_finite_element_0();
break;
}
case 1:
{
return new multimeshpoisson_finite_element_0();
break;
}
}
return 0;
}
ufc::dofmap * create_dofmap(std::size_t i) const final override
{
switch (i)
{
case 0:
{
return new multimeshpoisson_dofmap_0();
break;
}
case 1:
{
return new multimeshpoisson_dofmap_0();
break;
}
}
return 0;
}
std::size_t max_cell_subdomain_id() const final override
{
return 0;
}
std::size_t max_exterior_facet_subdomain_id() const final override
{
return 0;
}
std::size_t max_interior_facet_subdomain_id() const final override
{
return 0;
}
std::size_t max_vertex_subdomain_id() const final override
{
return 0;
}
std::size_t max_custom_subdomain_id() const final override
{
return 0;
}
std::size_t max_cutcell_subdomain_id() const final override
{
return 0;
}
std::size_t max_interface_subdomain_id() const final override
{
return 0;
}
std::size_t max_overlap_subdomain_id() const final override
{
return 0;
}
bool has_cell_integrals() const final override
{
return true;
}
bool has_exterior_facet_integrals() const final override
{
return false;
}
bool has_interior_facet_integrals() const final override
{
return false;
}
bool has_vertex_integrals() const final override
{
return false;
}
bool has_custom_integrals() const final override
{
return false;
}
bool has_cutcell_integrals() const final override
{
return true;
}
bool has_interface_integrals() const final override
{
return false;
}
bool has_overlap_integrals() const final override
{
return false;
}
ufc::cell_integral * create_cell_integral(std::size_t subdomain_id) const final override
{
return 0;
}
ufc::exterior_facet_integral * create_exterior_facet_integral(std::size_t subdomain_id) const final override
{
return 0;
}
ufc::interior_facet_integral * create_interior_facet_integral(std::size_t subdomain_id) const final override
{
return 0;
}
ufc::vertex_integral * create_vertex_integral(std::size_t subdomain_id) const final override
{
return 0;
}
ufc::custom_integral * create_custom_integral(std::size_t subdomain_id) const final override
{
return 0;
}
ufc::cutcell_integral * create_cutcell_integral(std::size_t subdomain_id) const final override
{
return 0;
}
ufc::interface_integral * create_interface_integral(std::size_t subdomain_id) const final override
{
return 0;
}
ufc::overlap_integral * create_overlap_integral(std::size_t subdomain_id) const final override
{
return 0;
}
ufc::cell_integral * create_default_cell_integral() const final override
{
return new multimeshpoisson_cell_integral_1_otherwise();
}
ufc::exterior_facet_integral * create_default_exterior_facet_integral() const final override
{
return 0;
}
ufc::interior_facet_integral * create_default_interior_facet_integral() const final override
{
return 0;
}
ufc::vertex_integral * create_default_vertex_integral() const final override
{
return 0;
}
ufc::custom_integral * create_default_custom_integral() const final override
{
return 0;
}
ufc::cutcell_integral * create_default_cutcell_integral() const final override
{
return new multimeshpoisson_cutcell_integral_1_otherwise();
}
ufc::interface_integral * create_default_interface_integral() const final override
{
return 0;
}
ufc::overlap_integral * create_default_overlap_integral() const final override
{
return 0;
}
};
// DOLFIN wrappers
// Standard library includes
#include <string>
// DOLFIN includes
#include <dolfin/common/NoDeleter.h>
#include <dolfin/mesh/Mesh.h>
#include <dolfin/mesh/MultiMesh.h>
#include <dolfin/fem/FiniteElement.h>
#include <dolfin/fem/DofMap.h>
#include <dolfin/fem/Form.h>
#include <dolfin/fem/MultiMeshForm.h>
#include <dolfin/function/FunctionSpace.h>
#include <dolfin/function/MultiMeshFunctionSpace.h>
#include <dolfin/function/GenericFunction.h>
#include <dolfin/function/CoefficientAssigner.h>
#include <dolfin/function/MultiMeshCoefficientAssigner.h>
#include <dolfin/adaptivity/ErrorControl.h>
#include <dolfin/adaptivity/GoalFunctional.h>
#include <dolfin/la/GenericVector.h>
namespace MultiMeshPoisson
{
class CoefficientSpace_f: public dolfin::FunctionSpace
{
public:
// Constructor for standard function space
CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh):
dolfin::FunctionSpace(mesh,
std::make_shared<const dolfin::FiniteElement>(std::make_shared<multimeshpoisson_finite_element_0>()),
std::make_shared<const dolfin::DofMap>(std::make_shared<multimeshpoisson_dofmap_0>(), *mesh))
{
// Do nothing
}
// Constructor for constrained function space
CoefficientSpace_f(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
dolfin::FunctionSpace(mesh,
std::make_shared<const dolfin::FiniteElement>(std::make_shared<multimeshpoisson_finite_element_0>()),
std::make_shared<const dolfin::DofMap>(std::make_shared<multimeshpoisson_dofmap_0>(), *mesh, constrained_domain))
{
// Do nothing
}
};
class Form_a_FunctionSpace_0: public dolfin::FunctionSpace
{
public:
// Constructor for standard function space
Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
dolfin::FunctionSpace(mesh,
std::make_shared<const dolfin::FiniteElement>(std::make_shared<multimeshpoisson_finite_element_0>()),
std::make_shared<const dolfin::DofMap>(std::make_shared<multimeshpoisson_dofmap_0>(), *mesh))
{
// Do nothing
}
// Constructor for constrained function space
Form_a_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
dolfin::FunctionSpace(mesh,
std::make_shared<const dolfin::FiniteElement>(std::make_shared<multimeshpoisson_finite_element_0>()),
std::make_shared<const dolfin::DofMap>(std::make_shared<multimeshpoisson_dofmap_0>(), *mesh, constrained_domain))
{
// Do nothing
}
};
class Form_a_FunctionSpace_1: public dolfin::FunctionSpace
{
public:
// Constructor for standard function space
Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh):
dolfin::FunctionSpace(mesh,
std::make_shared<const dolfin::FiniteElement>(std::make_shared<multimeshpoisson_finite_element_0>()),
std::make_shared<const dolfin::DofMap>(std::make_shared<multimeshpoisson_dofmap_0>(), *mesh))
{
// Do nothing
}
// Constructor for constrained function space
Form_a_FunctionSpace_1(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
dolfin::FunctionSpace(mesh,
std::make_shared<const dolfin::FiniteElement>(std::make_shared<multimeshpoisson_finite_element_0>()),
std::make_shared<const dolfin::DofMap>(std::make_shared<multimeshpoisson_dofmap_0>(), *mesh, constrained_domain))
{
// Do nothing
}
};
class Form_a_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
{
public:
// Constructor for multimesh function space
Form_a_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
{
// Create and add standard function spaces
for (std::size_t part = 0; part < multimesh->num_parts(); part++)
{
std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_0(multimesh->part(part)));
add(V);
}
// Build multimesh function space
build();
}
};
class Form_a_MultiMeshFunctionSpace_1: public dolfin::MultiMeshFunctionSpace
{
public:
// Constructor for multimesh function space
Form_a_MultiMeshFunctionSpace_1(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
{
// Create and add standard function spaces
for (std::size_t part = 0; part < multimesh->num_parts(); part++)
{
std::shared_ptr<const dolfin::FunctionSpace> V(new Form_a_FunctionSpace_1(multimesh->part(part)));
add(V);
}
// Build multimesh function space
build();
}
};
class Form_a: public dolfin::Form
{
public:
// Constructor
Form_a(std::shared_ptr<const dolfin::FunctionSpace> V1, std::shared_ptr<const dolfin::FunctionSpace> V0):
dolfin::Form(2, 0)
{
_function_spaces[0] = V0;
_function_spaces[1] = V1;
_ufc_form = std::make_shared<const multimeshpoisson_form_0>();
}
// Destructor
~Form_a()
{}
/// Return the number of the coefficient with this name
virtual std::size_t coefficient_number(const std::string& name) const
{
dolfin::dolfin_error("generated code for class Form",
"access coefficient data",
"There are no coefficients");
return 0;
}
/// Return the name of the coefficient with this number
virtual std::string coefficient_name(std::size_t i) const
{
dolfin::dolfin_error("generated code for class Form",
"access coefficient data",
"There are no coefficients");
return "unnamed";
}
// Typedefs
typedef Form_a_FunctionSpace_0 TestSpace;
typedef Form_a_FunctionSpace_1 TrialSpace;
typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
// Coefficients
};
class MultiMeshForm_a: public dolfin::MultiMeshForm
{
public:
// Constructor
MultiMeshForm_a(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V1, std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
dolfin::MultiMeshForm(V1, V0)
{
// Create and add standard forms
std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
for (std::size_t part = 0; part < num_parts; part++)
{
std::shared_ptr<dolfin::Form> a(new Form_a(V1->part(part), V0->part(part)));
add(a);
}
// Build multimesh form
build();
/// Assign coefficients
}
// Destructor
~MultiMeshForm_a()
{}
/// Return the number of the coefficient with this name
virtual std::size_t coefficient_number(const std::string& name) const
{
dolfin::dolfin_error("generated code for class Form",
"access coefficient data",
"There are no coefficients");
return 0;
}
/// Return the name of the coefficient with this number
virtual std::string coefficient_name(std::size_t i) const
{
dolfin::dolfin_error("generated code for class Form",
"access coefficient data",
"There are no coefficients");
return "unnamed";
}
// Typedefs
typedef Form_a_FunctionSpace_0 TestSpace;
typedef Form_a_FunctionSpace_1 TrialSpace;
typedef Form_a_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
typedef Form_a_MultiMeshFunctionSpace_1 MultiMeshTrialSpace;
// Coefficients
};
class Form_L_FunctionSpace_0: public dolfin::FunctionSpace
{
public:
// Constructor for standard function space
Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh):
dolfin::FunctionSpace(mesh,
std::make_shared<const dolfin::FiniteElement>(std::make_shared<multimeshpoisson_finite_element_0>()),
std::make_shared<const dolfin::DofMap>(std::make_shared<multimeshpoisson_dofmap_0>(), *mesh))
{
// Do nothing
}
// Constructor for constrained function space
Form_L_FunctionSpace_0(std::shared_ptr<const dolfin::Mesh> mesh, std::shared_ptr<const dolfin::SubDomain> constrained_domain):
dolfin::FunctionSpace(mesh,
std::make_shared<const dolfin::FiniteElement>(std::make_shared<multimeshpoisson_finite_element_0>()),
std::make_shared<const dolfin::DofMap>(std::make_shared<multimeshpoisson_dofmap_0>(), *mesh, constrained_domain))
{
// Do nothing
}
};
class Form_L_MultiMeshFunctionSpace_0: public dolfin::MultiMeshFunctionSpace
{
public:
// Constructor for multimesh function space
Form_L_MultiMeshFunctionSpace_0(std::shared_ptr<const dolfin::MultiMesh> multimesh): dolfin::MultiMeshFunctionSpace(multimesh)
{
// Create and add standard function spaces
for (std::size_t part = 0; part < multimesh->num_parts(); part++)
{
std::shared_ptr<const dolfin::FunctionSpace> V(new Form_L_FunctionSpace_0(multimesh->part(part)));
add(V);
}
// Build multimesh function space
build();
}
};
typedef CoefficientSpace_f Form_L_FunctionSpace_1;
class Form_L: public dolfin::Form
{
public:
// Constructor
Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0):
dolfin::Form(1, 1), f(*this, 0)
{
_function_spaces[0] = V0;
_ufc_form = std::make_shared<const multimeshpoisson_form_1>();
}
// Constructor
Form_L(std::shared_ptr<const dolfin::FunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
dolfin::Form(1, 1), f(*this, 0)
{
_function_spaces[0] = V0;
this->f = f;
_ufc_form = std::make_shared<const multimeshpoisson_form_1>();
}
// Destructor
~Form_L()
{}
/// Return the number of the coefficient with this name
virtual std::size_t coefficient_number(const std::string& name) const
{
if (name == "f")
return 0;
dolfin::dolfin_error("generated code for class Form",
"access coefficient data",
"Invalid coefficient");
return 0;
}
/// Return the name of the coefficient with this number
virtual std::string coefficient_name(std::size_t i) const
{
switch (i)
{
case 0:
return "f";
}
dolfin::dolfin_error("generated code for class Form",
"access coefficient data",
"Invalid coefficient");
return "unnamed";
}
// Typedefs
typedef Form_L_FunctionSpace_0 TestSpace;
typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
// Coefficients
dolfin::CoefficientAssigner f;
};
class MultiMeshForm_L: public dolfin::MultiMeshForm
{
public:
// Constructor
MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0):
dolfin::MultiMeshForm(V0), f(*this, 0)
{
// Create and add standard forms
std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
for (std::size_t part = 0; part < num_parts; part++)
{
std::shared_ptr<dolfin::Form> a(new Form_L(V0->part(part)));
add(a);
}
// Build multimesh form
build();
/// Assign coefficients
}
// Constructor
MultiMeshForm_L(std::shared_ptr<const dolfin::MultiMeshFunctionSpace> V0, std::shared_ptr<const dolfin::GenericFunction> f):
dolfin::MultiMeshForm(V0), f(*this, 0)
{
// Create and add standard forms
std::size_t num_parts = V0->num_parts(); // assume all equal and pick first
for (std::size_t part = 0; part < num_parts; part++)
{
std::shared_ptr<dolfin::Form> a(new Form_L(V0->part(part)));
add(a);
}
// Build multimesh form
build();
/// Assign coefficients
this->f = f;
}
// Destructor
~MultiMeshForm_L()
{}
/// Return the number of the coefficient with this name
virtual std::size_t coefficient_number(const std::string& name) const
{
if (name == "f")
return 0;
dolfin::dolfin_error("generated code for class Form",
"access coefficient data",
"Invalid coefficient");
return 0;
}
/// Return the name of the coefficient with this number
virtual std::string coefficient_name(std::size_t i) const
{
switch (i)
{
case 0:
return "f";
}
dolfin::dolfin_error("generated code for class Form",
"access coefficient data",
"Invalid coefficient");
return "unnamed";
}
// Typedefs
typedef Form_L_FunctionSpace_0 TestSpace;
typedef Form_L_MultiMeshFunctionSpace_0 MultiMeshTestSpace;
typedef Form_L_FunctionSpace_1 CoefficientSpace_f;
// Coefficients
dolfin::MultiMeshCoefficientAssigner f;
};
// Class typedefs
typedef Form_a BilinearForm;
typedef MultiMeshForm_a MultiMeshBilinearForm;
typedef Form_a JacobianForm;
typedef MultiMeshForm_a MultiMeshJacobianForm;
typedef Form_L LinearForm;
typedef MultiMeshForm_L MultiMeshLinearForm;
typedef Form_L ResidualForm;
typedef MultiMeshForm_L MultiMeshResidualForm;
typedef Form_a::TestSpace FunctionSpace;
typedef Form_a::MultiMeshTestSpace MultiMeshFunctionSpace;
}
#endif
| [
"johannr@simula.no"
] | johannr@simula.no |
76b2700d4c5d8f2d7e86078a77409ab606d453e9 | 1a8f5d5fb51498859bb06d0287ad6c38e9bb8f70 | /sparta/test/PatriciaTreeSetAbstractDomainTest.cpp | 198d8ac22d4a2e7b919b3c48c23d5e5ee21526bc | [
"MIT"
] | permissive | willpyshan13/redex | a5c3109734626bb647e2dfcd49c7d38075ab3553 | 0bb6a6ca434c4f57e825f0c3e0d47d7f1388529f | refs/heads/master | 2022-04-15T07:19:18.825412 | 2020-04-15T01:25:03 | 2020-04-15T01:27:58 | 255,777,262 | 1 | 0 | MIT | 2020-04-15T01:57:46 | 2020-04-15T01:57:45 | null | UTF-8 | C++ | false | false | 5,849 | cpp | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "PatriciaTreeSetAbstractDomain.h"
#include <algorithm>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <memory>
#include <string>
#include <vector>
#include "PatriciaTreeSet.h"
using namespace sparta;
using Domain = PatriciaTreeSetAbstractDomain<std::string*>;
class PatriciaTreeSetAbstractDomainTest : public ::testing::Test {
protected:
PatriciaTreeSetAbstractDomainTest()
: m_a(new std::string("a")),
m_b(new std::string("b")),
m_c(new std::string("c")),
m_d(new std::string("d")) {}
std::string* a() { return m_a.get(); }
std::string* b() { return m_b.get(); }
std::string* c() { return m_c.get(); }
std::string* d() { return m_d.get(); }
std::string* e() { return m_e.get(); }
std::vector<std::string> to_string(const PatriciaTreeSet<std::string*>& s) {
std::vector<std::string> result;
std::transform(s.begin(),
s.end(),
std::back_inserter(result),
[](std::string* p) { return *p; });
return result;
}
std::unique_ptr<std::string> m_a;
std::unique_ptr<std::string> m_b;
std::unique_ptr<std::string> m_c;
std::unique_ptr<std::string> m_d;
std::unique_ptr<std::string> m_e;
};
TEST_F(PatriciaTreeSetAbstractDomainTest, latticeOperations) {
Domain e1(this->a());
Domain e2({this->a(), this->b(), this->c()});
Domain e3({this->b(), this->c(), this->d()});
EXPECT_THAT(this->to_string(e1.elements()),
::testing::UnorderedElementsAre("a"));
EXPECT_THAT(this->to_string(e2.elements()),
::testing::UnorderedElementsAre("a", "b", "c"));
EXPECT_THAT(this->to_string(e3.elements()),
::testing::UnorderedElementsAre("b", "c", "d"));
EXPECT_TRUE(Domain::bottom().leq(Domain::top()));
EXPECT_FALSE(Domain::top().leq(Domain::bottom()));
EXPECT_FALSE(e2.is_top());
EXPECT_FALSE(e2.is_bottom());
EXPECT_TRUE(e1.leq(e2));
EXPECT_FALSE(e1.leq(e3));
EXPECT_TRUE(e2.equals(Domain({this->b(), this->c(), this->a()})));
EXPECT_FALSE(e2.equals(e3));
EXPECT_THAT(this->to_string(e2.join(e3).elements()),
::testing::UnorderedElementsAre("a", "b", "c", "d"));
EXPECT_TRUE(e1.join(e2).equals(e2));
EXPECT_TRUE(e2.join(Domain::bottom()).equals(e2));
EXPECT_TRUE(e2.join(Domain::top()).is_top());
EXPECT_TRUE(e1.widening(e2).equals(e2));
EXPECT_THAT(this->to_string(e2.meet(e3).elements()),
::testing::UnorderedElementsAre("b", "c"));
EXPECT_TRUE(e1.meet(e2).equals(e1));
EXPECT_TRUE(e2.meet(Domain::bottom()).is_bottom());
EXPECT_TRUE(e2.meet(Domain::top()).equals(e2));
EXPECT_FALSE(e1.meet(e3).is_bottom());
EXPECT_TRUE(e1.meet(e3).elements().empty());
EXPECT_TRUE(e1.narrowing(e2).equals(e1));
EXPECT_TRUE(e2.contains(this->a()));
EXPECT_FALSE(e3.contains(this->a()));
// Making sure no side effect took place.
EXPECT_THAT(this->to_string(e1.elements()),
::testing::UnorderedElementsAre("a"));
EXPECT_THAT(this->to_string(e2.elements()),
::testing::UnorderedElementsAre("a", "b", "c"));
EXPECT_THAT(this->to_string(e3.elements()),
::testing::UnorderedElementsAre("b", "c", "d"));
}
TEST_F(PatriciaTreeSetAbstractDomainTest, destructiveOperations) {
Domain e1(this->a());
Domain e2({this->a(), this->b(), this->c()});
Domain e3({this->b(), this->c(), this->d()});
e1.add(this->b());
EXPECT_THAT(this->to_string(e1.elements()),
::testing::UnorderedElementsAre("a", "b"));
e1.add({this->a(), this->c()});
EXPECT_TRUE(e1.equals(e2));
std::vector<std::string*> v1 = {this->a(), this->b()};
e1.add(v1.begin(), v1.end());
EXPECT_TRUE(e1.equals(e2));
e1.remove(this->b());
EXPECT_THAT(this->to_string(e1.elements()),
::testing::UnorderedElementsAre("a", "c"));
e1.remove(this->d());
EXPECT_THAT(this->to_string(e1.elements()),
::testing::UnorderedElementsAre("a", "c"));
std::vector<std::string*> v2 = {this->a(), this->e()};
e1.remove(v2.begin(), v2.end());
EXPECT_THAT(this->to_string(e1.elements()),
::testing::UnorderedElementsAre("c"));
e1.remove({this->a(), this->c()});
EXPECT_TRUE(e1.elements().empty());
e1.join_with(e2);
EXPECT_THAT(this->to_string(e1.elements()),
::testing::UnorderedElementsAre("a", "b", "c"));
e1.join_with(Domain::bottom());
EXPECT_TRUE(e1.equals(e2));
e1.join_with(Domain::top());
EXPECT_TRUE(e1.is_top());
e1 = Domain(this->a());
e1.widen_with(Domain({this->b(), this->c()}));
EXPECT_TRUE(e1.equals(e2));
e1 = Domain(this->a());
e2.meet_with(e3);
EXPECT_THAT(this->to_string(e2.elements()),
::testing::UnorderedElementsAre("b", "c"));
e1.meet_with(e2);
EXPECT_TRUE(e1.elements().empty());
e1.meet_with(Domain::top());
EXPECT_THAT(this->to_string(e2.elements()),
::testing::UnorderedElementsAre("b", "c"));
e1.meet_with(Domain::bottom());
EXPECT_TRUE(e1.is_bottom());
e1 = Domain(this->a());
e1.narrow_with(Domain({this->a(), this->b()}));
EXPECT_THAT(this->to_string(e1.elements()),
::testing::UnorderedElementsAre("a"));
EXPECT_FALSE(e2.is_top());
e1.set_to_top();
EXPECT_TRUE(e1.is_top());
e1.set_to_bottom();
EXPECT_TRUE(e1.is_bottom());
EXPECT_FALSE(e2.is_bottom());
e2.set_to_bottom();
EXPECT_TRUE(e2.is_bottom());
e1 = Domain({this->a(), this->b(), this->c(), this->d()});
e2 = e1;
EXPECT_TRUE(e1.equals(e2));
EXPECT_TRUE(e2.equals(e1));
EXPECT_FALSE(e2.is_bottom());
EXPECT_THAT(this->to_string(e2.elements()),
::testing::UnorderedElementsAre("a", "b", "c", "d"));
}
| [
"facebook-github-bot@users.noreply.github.com"
] | facebook-github-bot@users.noreply.github.com |
3c89e47dd3381b4dfa1a4340129f79effcc80b24 | 5fd336b1e29a2a439ec16f81b0ed6fd38a9538de | /REM.cpp | d9c41b3e0d4a44f06294672395f5a36d0c19507b | [] | no_license | itsmekate/ft_gkrellm | 58a7924cf0f5d77cf6f8e0fcf26a43942bec34c8 | 698101198a89cb759619e579807a5b935c44a295 | refs/heads/master | 2020-04-01T04:22:00.289774 | 2018-10-14T14:14:27 | 2018-10-14T14:14:27 | 152,860,364 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,550 | cpp | //
// Created by Kateryna PRASOL on 13.10.2018.
//
#include "REM.h"
REM::REM()
{
char line[80];
FILE *top = popen("top -l 1| grep PhysMem", "r");
fgets(line, sizeof(line), top);
pclose(top);
_REM = line;
}
REM::REM(REM const &rhs)
{
*this = rhs;
}
REM const & REM::operator=(REM const &rhs)
{
if (this != &rhs)
{
_REM = rhs._REM;
}
return (*this);
}
REM::~REM()
{
}
std::string REM::getREM()
{
char line[80];
FILE *top = popen("top -l 1| grep PhysMem", "r");
fgets(line, sizeof(line), top);
pclose(top);
_REM = line;
return _REM;
}
void REM::outputREM(WINDOW *_winREM)
{
std::string s = getREM();
int d = stoi(s.substr(9, 11)) / 400;
std::string progress (d, ' ');
wattron(_winREM, COLOR_PAIR(7));
mvwprintw(_winREM, 3, 2, "..............................................");
wattron(_winREM, COLOR_PAIR(7));
wattron(_winREM, A_BOLD);
wattron(_winREM, COLOR_PAIR(6));
mvwprintw(_winREM, 1, 2, "%s", getREM().c_str());
wattroff(_winREM, COLOR_PAIR(6));
wattron(_winREM, COLOR_PAIR(10));
mvwprintw(_winREM, 3, 2, "%s", progress.c_str());
wattroff(_winREM, COLOR_PAIR(10));
wattroff(_winREM, A_BOLD);
wattron(_winREM, COLOR_PAIR(1));
box(_winREM, 0, 0);
wattroff(_winREM, COLOR_PAIR(1));
wrefresh(_winREM);
}
void REM::outputCPU(WINDOW *_winCPU){(void)_winCPU;}
void REM::outputNetwork(WINDOW *_winNetwork){(void) _winNetwork;}
void REM::outputOSInfoWindow(WINDOW *_winOSInfo){(void) _winOSInfo;} | [
"prasolkaterina@knu.ua"
] | prasolkaterina@knu.ua |
708d4db49841340a0817964cd6e8bc8fade7ba13 | 48d716be7c6ee6c227c51998f30621e4e80ae690 | /util.cpp | 184268edf27e963128752c1827fb114b1fd7bb04 | [] | no_license | aceiii/sfml-game-dev | 329296f905f20604c248e0b96dc1d4bdc1d2c460 | aeb09541ffe4e13f3f94952c6171dd31d38be17b | refs/heads/master | 2021-01-12T13:00:59.407055 | 2016-10-24T16:25:44 | 2016-10-24T16:25:44 | 70,112,358 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,164 | cpp | #include <sstream>
#include <complex>
#include "util.h"
std::string keyToString(const sf::Keyboard::Key& key) {
switch (key) {
case sf::Keyboard::Unknown: return "Unknown";
case sf::Keyboard::A: return "A";
case sf::Keyboard::B: return "B";
case sf::Keyboard::C: return "C";
case sf::Keyboard::D: return "D";
case sf::Keyboard::E: return "E";
case sf::Keyboard::F: return "F";
case sf::Keyboard::G: return "G";
case sf::Keyboard::H: return "H";
case sf::Keyboard::I: return "I";
case sf::Keyboard::J: return "J";
case sf::Keyboard::K: return "K";
case sf::Keyboard::L: return "L";
case sf::Keyboard::M: return "M";
case sf::Keyboard::N: return "N";
case sf::Keyboard::O: return "O";
case sf::Keyboard::P: return "P";
case sf::Keyboard::Q: return "Q";
case sf::Keyboard::R: return "R";
case sf::Keyboard::S: return "S";
case sf::Keyboard::T: return "T";
case sf::Keyboard::U: return "U";
case sf::Keyboard::V: return "V";
case sf::Keyboard::W: return "W";
case sf::Keyboard::X: return "X";
case sf::Keyboard::Y: return "Y";
case sf::Keyboard::Z: return "Z";
case sf::Keyboard::Num0: return "0";
case sf::Keyboard::Num1: return "1";
case sf::Keyboard::Num2: return "2";
case sf::Keyboard::Num3: return "3";
case sf::Keyboard::Num4: return "4";
case sf::Keyboard::Num5: return "5";
case sf::Keyboard::Num6: return "6";
case sf::Keyboard::Num7: return "7";
case sf::Keyboard::Num8: return "8";
case sf::Keyboard::Num9: return "9";
case sf::Keyboard::Escape: return "ESC";
case sf::Keyboard::LControl: return "L-CTRL";
case sf::Keyboard::LShift: return "L-SHIFT";
case sf::Keyboard::LAlt: return "L-ALT";
case sf::Keyboard::LSystem: return "L-SYS";
case sf::Keyboard::RControl: return "R-CTRL";
case sf::Keyboard::RShift: return "R-SHIFT";
case sf::Keyboard::RAlt: return "R-ALT";
case sf::Keyboard::RSystem: return "R-SYS";
case sf::Keyboard::Menu: return "MENU";
case sf::Keyboard::LBracket: return "[";
case sf::Keyboard::RBracket: return "]";
case sf::Keyboard::SemiColon: return ";";
case sf::Keyboard::Comma: return ",";
case sf::Keyboard::Period: return ".";
case sf::Keyboard::Quote: return "'";
case sf::Keyboard::Slash: return "/";
case sf::Keyboard::BackSlash: return "\\";
case sf::Keyboard::Tilde: return "~";
case sf::Keyboard::Equal: return "=";
case sf::Keyboard::Dash: return "-";
case sf::Keyboard::Space: return "SPACE";
case sf::Keyboard::Return: return "RETURN";
case sf::Keyboard::BackSpace: return "BACK";
case sf::Keyboard::Tab: return "TAB";
case sf::Keyboard::PageUp: return "PGUP";
case sf::Keyboard::PageDown: return "PGDN";
case sf::Keyboard::End: return "END";
case sf::Keyboard::Home: return "HOME";
case sf::Keyboard::Insert: return "INS";
case sf::Keyboard::Delete: return "DEL";
case sf::Keyboard::Add: return "ADD";
case sf::Keyboard::Subtract: return "SUB";
case sf::Keyboard::Multiply: return "MUL";
case sf::Keyboard::Divide: return "DIV";
case sf::Keyboard::Left: return "LEFT";
case sf::Keyboard::Right: return "RIGHT";
case sf::Keyboard::Up: return "UP";
case sf::Keyboard::Down: return "DOWN";
case sf::Keyboard::Numpad0: return "NUM0";
case sf::Keyboard::Numpad1: return "NUM1";
case sf::Keyboard::Numpad2: return "NUM2";
case sf::Keyboard::Numpad3: return "NUM3";
case sf::Keyboard::Numpad4: return "NUM4";
case sf::Keyboard::Numpad5: return "NUM5";
case sf::Keyboard::Numpad6: return "NUM6";
case sf::Keyboard::Numpad7: return "NUM7";
case sf::Keyboard::Numpad8: return "NUM8";
case sf::Keyboard::Numpad9: return "NUM9";
case sf::Keyboard::F1: return "F1";
case sf::Keyboard::F2: return "F2";
case sf::Keyboard::F3: return "F3";
case sf::Keyboard::F4: return "F4";
case sf::Keyboard::F5: return "F5";
case sf::Keyboard::F6: return "F6";
case sf::Keyboard::F7: return "F7";
case sf::Keyboard::F8: return "F8";
case sf::Keyboard::F9: return "F9";
case sf::Keyboard::F10: return "F10";
case sf::Keyboard::F11: return "F11";
case sf::Keyboard::F12: return "F12";
case sf::Keyboard::F13: return "F13";
case sf::Keyboard::F14: return "F14";
case sf::Keyboard::F15: return "F15";
case sf::Keyboard::Pause: return "Pause";
default: return "Unknown";
}
}
float toRadians(float deg) {
return static_cast<float>(M_PI / 180.0 * deg);
}
double toRadians(double deg) {
return M_PI / 180 * deg;
}
float toDegrees(float rads) {
return static_cast<float>(rads * 180.0 * M_PI);
}
double toDegrees(double rads) {
return rads * 180.0 * M_PI;
}
sf::Vector2f unitVector(sf::Vector2f pos) {
float dist = std::sqrt(pos.x * pos.x + pos.y * pos.y);
pos.x /= dist;
pos.y /= dist;
return pos;
}
float distance(const SceneNode &node1, const SceneNode &node2) {
sf::Vector2f vec = node1.getWorldPosition() - node2.getWorldPosition();
return std::sqrt(vec.x * vec.x + vec.y * vec.y);
}
bool collision(const SceneNode &lhs, const SceneNode &rhs) {
return lhs.getBoundingRect().intersects(rhs.getBoundingRect());
}
bool matchesCategories(SceneNode::pair_type &colliders, Category::Type type1, Category::Type type2) {
unsigned int category1 = colliders.first->getCategory();
unsigned int category2 = colliders.second->getCategory();
if (type1 & category1 && type2 & category2) {
return true;
} else if (type1 & category2 && type2 & category1) {
std::swap(colliders.first, colliders.second);
return true;
}
return false;
}
| [
"borin.ouch@gmail.com"
] | borin.ouch@gmail.com |
4fa3a54aae386cca811170d5456c04f5ba6c6afd | 5137b0cc9b3f7d90425d584f06bda9e4df0f76f8 | /OOP345/MS3/CustomerOrder.h | 9fe50f1de43eebd0ec3b07d7f76ec17a4c02329d | [] | no_license | zzhao58/Zoey_Repos | 2136a19292899bdd3c90ff58b898345096134fa6 | 43519036c087107ca035acf695d127519ead4800 | refs/heads/master | 2023-01-04T17:12:15.152868 | 2019-12-05T02:52:30 | 2019-12-05T02:52:30 | 149,228,810 | 1 | 0 | null | 2023-01-03T16:14:17 | 2018-09-18T04:26:06 | C++ | UTF-8 | C++ | false | false | 817 | h | //CustomerOrder.h
//Zhi Zhao (109079178)
#ifndef CUSTOMERORDER_SICT_H
#define CUSTOMERORDER_SICT_H
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include "ItemInfo.h"
#include "ItemSet.h"
const int MAX = 5;
namespace sict{
class CustomerOrder {
std::string CustomerName;
std::string ProductName;
std::vector<ItemInfo> Items;
static size_t field_width;
public:
CustomerOrder();
CustomerOrder(const std::string&);
~CustomerOrder();
void fillItem(ItemSet&, std::ostream&); //check inventor full?
bool isFilled() const;
bool isItemFilled(const std::string& ) const;
std::string getNameProduct() const;
void display(std::ostream&, bool = false) const; // argument default value should appear in declaration.
static size_t getfieldWidth();
};
}
#endif
| [
"zoeyzhao100@gmail.com"
] | zoeyzhao100@gmail.com |
403a9f86e53a9d80bc3ad00e87d72ca64919e4d4 | ae3dd93d22fbe363d88f454587b3a08f1f2e7952 | /src/slg/engines/oclrenderengine.cpp | fee7240b900d3aed8a44bdb347e02d51ecdf6519 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | tschw/LuxCore | 1efcfc679856745d33f93d25eb3e9056576d3c4d | 111009811c31a74595e25c290bfaa7d715db4192 | refs/heads/master | 2021-04-12T08:09:14.760438 | 2018-03-20T10:27:15 | 2018-03-20T10:27:15 | 126,042,938 | 0 | 0 | Apache-2.0 | 2018-03-20T15:48:42 | 2018-03-20T15:48:37 | null | UTF-8 | C++ | false | false | 6,164 | cpp | /***************************************************************************
* Copyright 1998-2018 by authors (see AUTHORS.txt) *
* *
* This file is part of LuxCoreRender. *
* *
* 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 "slg/engines/oclrenderengine.h"
#include "luxrays/core/intersectiondevice.h"
#if !defined(LUXRAYS_DISABLE_OPENCL)
#include "luxrays/core/ocldevice.h"
#endif
using namespace std;
using namespace luxrays;
using namespace slg;
//------------------------------------------------------------------------------
// OCLRenderEngine
//------------------------------------------------------------------------------
OCLRenderEngine::OCLRenderEngine(const RenderConfig *rcfg, Film *flm,
boost::mutex *flmMutex, const bool supportsNativeThreads) : RenderEngine(rcfg, flm, flmMutex) {
#if !defined(LUXRAYS_DISABLE_OPENCL)
const Properties &cfg = renderConfig->cfg;
const bool useCPUs = cfg.Get(GetDefaultProps().Get("opencl.cpu.use")).Get<bool>();
const bool useGPUs = cfg.Get(GetDefaultProps().Get("opencl.gpu.use")).Get<bool>();
// 0 means use the value suggested by the OpenCL driver
const u_int forceCPUWorkSize = cfg.Get(GetDefaultProps().Get("opencl.cpu.workgroup.size")).Get<u_int>();
// 0 means use the value suggested by the OpenCL driver
// Note: I'm using 64 because some driver (i.e. NVIDIA) suggests a value and than
// throws a clEnqueueNDRangeKernel(CL_OUT_OF_RESOURCES)
const u_int forceGPUWorkSize = cfg.Get(GetDefaultProps().Get("opencl.gpu.workgroup.size")).Get<u_int>();
const string oclDeviceConfig = cfg.Get(GetDefaultProps().Get("opencl.devices.select")).Get<string>();
//--------------------------------------------------------------------------
// Get OpenCL device descriptions
//--------------------------------------------------------------------------
vector<DeviceDescription *> oclDescs = ctx->GetAvailableDeviceDescriptions();
DeviceDescription::Filter(DEVICE_TYPE_OPENCL_ALL, oclDescs);
// Device info
bool haveSelectionString = (oclDeviceConfig.length() > 0);
if (haveSelectionString && (oclDeviceConfig.length() != oclDescs.size())) {
stringstream ss;
ss << "OpenCL device selection string has the wrong length, must be " <<
oclDescs.size() << " instead of " << oclDeviceConfig.length();
throw runtime_error(ss.str().c_str());
}
for (size_t i = 0; i < oclDescs.size(); ++i) {
OpenCLDeviceDescription *desc = static_cast<OpenCLDeviceDescription *>(oclDescs[i]);
if (haveSelectionString) {
if (oclDeviceConfig.at(i) == '1') {
if (desc->GetType() & DEVICE_TYPE_OPENCL_GPU)
desc->SetForceWorkGroupSize(forceGPUWorkSize);
else if (desc->GetType() & DEVICE_TYPE_OPENCL_CPU)
desc->SetForceWorkGroupSize(forceCPUWorkSize);
selectedDeviceDescs.push_back(desc);
}
} else {
if ((useCPUs && desc->GetType() & DEVICE_TYPE_OPENCL_CPU) ||
(useGPUs && desc->GetType() & DEVICE_TYPE_OPENCL_GPU)) {
if (desc->GetType() & DEVICE_TYPE_OPENCL_GPU)
desc->SetForceWorkGroupSize(forceGPUWorkSize);
else if (desc->GetType() & DEVICE_TYPE_OPENCL_CPU)
desc->SetForceWorkGroupSize(forceCPUWorkSize);
selectedDeviceDescs.push_back(oclDescs[i]);
}
}
}
oclRenderThreadCount = selectedDeviceDescs.size();
#endif
if (selectedDeviceDescs.size() == 0)
throw runtime_error("No OpenCL device selected or available");
#if !defined(LUXRAYS_DISABLE_OPENCL)
if (supportsNativeThreads) {
//----------------------------------------------------------------------
// Get native device descriptions
//----------------------------------------------------------------------
vector<DeviceDescription *> nativeDescs = ctx->GetAvailableDeviceDescriptions();
DeviceDescription::Filter(DEVICE_TYPE_NATIVE_THREAD, nativeDescs);
nativeDescs.resize(1);
nativeRenderThreadCount = cfg.Get(GetDefaultProps().Get("opencl.native.threads.count")).Get<u_int>();
if (nativeRenderThreadCount > 0)
selectedDeviceDescs.resize(selectedDeviceDescs.size() + nativeRenderThreadCount, nativeDescs[0]);
} else
nativeRenderThreadCount = 0;
#endif
}
Properties OCLRenderEngine::ToProperties(const Properties &cfg) {
return Properties() <<
cfg.Get(GetDefaultProps().Get("opencl.cpu.use")) <<
cfg.Get(GetDefaultProps().Get("opencl.gpu.use")) <<
cfg.Get(GetDefaultProps().Get("opencl.cpu.workgroup.size")) <<
cfg.Get(GetDefaultProps().Get("opencl.gpu.workgroup.size")) <<
cfg.Get(GetDefaultProps().Get("opencl.devices.select")) <<
cfg.Get(GetDefaultProps().Get("opencl.native.threads.count"));
}
const Properties &OCLRenderEngine::GetDefaultProps() {
static Properties props = Properties() <<
RenderEngine::GetDefaultProps() <<
Property("opencl.cpu.use")(false) <<
Property("opencl.gpu.use")(true) <<
#if defined(__APPLE__)
Property("opencl.cpu.workgroup.size")(1) <<
#else
Property("opencl.cpu.workgroup.size")(0) <<
#endif
Property("opencl.gpu.workgroup.size")(64) <<
Property("opencl.devices.select")("") <<
Property("opencl.native.threads.count")(boost::thread::hardware_concurrency());
return props;
}
| [
"dade916@gmail.com"
] | dade916@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.