blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 201 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 7 100 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 260
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 11.4k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 80
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 8 9.86M | extension stringclasses 52
values | content stringlengths 8 9.86M | authors listlengths 1 1 | author stringlengths 0 119 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a86c24e8ae6256a156e81b454d2d0ad546af414d | 5de42c4e14a7ddbc284a742c66cb01b230ba43ce | /codeforces/1521/E.cpp | 9d334c392bed2086e7fa025afaa666b9ebc4b453 | [] | no_license | NhatMinh0208/CP-Archive | 42d6cc9b1d2d6b8c85e637b8a88a6852a398cc23 | f95784d53708003e7ba74cbe4f2c7a888d29eac4 | refs/heads/master | 2023-05-09T15:50:34.344385 | 2021-05-04T14:25:00 | 2021-05-19T16:10:11 | 323,779,542 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,661 | cpp | /*
Normie's Template v2.2
Changes:
Added modulo binpow and inverse.
*/
// Standard library in one include.
#include <bits/stdc++.h>
using namespace std;
// ordered_set library.
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set(el) tree<el,null_type,less<el>,rb_tree_tag,tree_order_statistics_node_update>
// AtCoder library. (Comment out these two lines if you're not submitting in AtCoder.) (Or if you want to use it in other judges, run expander.py first.)
//#include <atcoder/all>
//using namespace atcoder;
//Pragmas (Comment out these three lines if you're submitting in szkopul.)
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,unroll-loops,tree-vectorize")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
//File I/O.
#define FILE_IN "cseq.inp"
#define FILE_OUT "cseq.out"
#define ofile freopen(FILE_IN,"r",stdin);freopen(FILE_OUT,"w",stdout)
//Fast I/O.
#define fio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define nfio cin.tie(0);cout.tie(0)
#define endl "\n"
//Order checking.
#define ord(a,b,c) ((a>=b)and(b>=c))
//min/max redefines, so i dont have to resolve annoying compile errors.
#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))
// Fast min/max assigns to use with AVX.
// Requires g++ 9.2.0.
template<typename T>
__attribute__((always_inline)) void chkmin(T& a, const T& b) {
a=(a<b)?a:b;
}
template<typename T>
__attribute__((always_inline)) void chkmax(T& a, const T& b) {
a=(a>b)?a:b;
}
//Constants.
#define MOD (ll(998244353))
#define MAX 300001
#define mag 320
const long double PI=3.14159265358979;
//Pairs and 3-pairs.
#define p1 first
#define p2 second.first
#define p3 second.second
#define fi first
#define se second
#define pii(element_type) pair<element_type,element_type>
#define piii(element_type) pair<element_type,pii(element_type)>
//Quick power of 2.
#define pow2(x) (ll(1)<<x)
//Short for-loops.
#define ff(i,__,___) for(int i=__;i<=___;i++)
#define rr(i,__,___) for(int i=__;i>=___;i--)
//Typedefs.
#define bi BigInt
typedef long long ll;
typedef long double ld;
typedef short sh;
// Binpow and stuff
ll BOW(ll a, ll x, ll p)
{
if (!x) return 1;
ll res=BOW(a,x/2,p);
res*=res;
res%=p;
if (x%2) res*=a;
return res%p;
}
ll INV(ll a, ll p)
{
return BOW(a,p-2,p);
}
//---------END-------//
vector<int> vec1,vec3;
vector<pii(int)> vec2;
int n,m,i,j,k,t,t1,u,v,a,b;
int arr[100001];
int res[501][501];
int main()
{
fio;
cin>>t;
for (t1=0;t1<t;t1++)
{
cin>>m>>n;
u=0;
for (i=1;i<=n;i++) {cin>>arr[i]; u=max(u,arr[i]);}
for (i=1;i<=500;i++) if ((m<=i*i-(i/2)*(i/2))and(u<=i*(i-i/2))) break;
vec1.clear();
vec2.clear();
vec3.clear();
b=i;
for (j=0;j<i;j++) for (k=0;k<i;k++) if ((j%2)and(k%2==0)) vec2.push_back({j,k});
for (j=0;j<i;j++) for (k=0;k<i;k++) if ((j%2==0)and(k%2==0)) vec2.push_back({j,k});
for (j=0;j<i;j++) for (k=0;k<i;k++) if ((j%2==0)and(k%2)) vec2.push_back({j,k});
for (i=1;i<=n;i++) vec3.push_back(i);
sort(vec3.begin(),vec3.end(),[](int a, int b){
return (arr[a]>arr[b]);
});
for (i=0;i<n;i++)
{
for (j=0;j<arr[vec3[i]];j++) vec1.push_back(vec3[i]);
}
for (j=0;j<b;j++) for (k=0;k<b;k++) res[j][k]=0;
for (i=0;i<m;i++) res[vec2[i].fi][vec2[i].se]=vec1[i];
cout<<b<<endl;
for (i=0;i<b;i++)
{
for (j=0;j<b;j++) cout<<res[i][j]<<' ';
cout<<endl;
}
}
}
| [
"minhkhicon2468@gmail.com"
] | minhkhicon2468@gmail.com |
25157d8f4665aa9523b9f5200e0d16f44b7a45a4 | 34a6a2803d8840968667b89b9ccee9c72e28fb24 | /numberOfPartitions.cpp | 005b6e07ae0e0ae0827c8e5505dada609f6d9119 | [] | no_license | rakeshyeka/geeksForGeeks | 9ef8295b8008d2bfef0fefdaab9d2c1acdee13c1 | 4763d4ae9d8db6a1181e0fff1af3a556e622ae5b | refs/heads/master | 2020-04-03T14:52:40.525390 | 2018-11-14T14:31:25 | 2018-11-14T14:31:25 | 155,339,738 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,237 | cpp | //https://www.geeksforgeeks.org/bell-numbers-number-of-ways-to-partition-a-set/
#include<iostream>
#include<vector>
using namespace std;
int insertInto(vector<vector<int>> *partitions, int i, int j, int val) {
if (i > (*partitions).size()) {
(*partitions).resize(i+1);
}
if (j > (*partitions)[i].size()) {
(*partitions)[i].resize(j+1);
}
(*partitions)[i][j] = val;
}
int kPartitions(vector<vector<int>> *partitions, int n, int k) {
if (k==1 || n==k) {
insertInto(partitions, n, k, 1);
return 1;
}
if ((*partitions)[n][k] != 0) {
return (*partitions)[n][k];
}
// adding nth element to n-1 with k partitions
// i.e. adding nth element as new partition to k-1 partitions of n-1 elements
int append = kPartitions(partitions, n-1, k-1);
// or inserting nth element into every partition of k from n-1 elements
int insert = k*kPartitions(partitions, n-1, k);
insertInto(partitions, n, k, append+insert);
return append + insert;
}
int totalPartitionCount(int n) {
int partitionCount = 0;
vector<vector<int>> partitions(n+1);
for (int i=1; i<=n; i++) {
partitionCount += kPartitions(&partitions, n, i);
}
return partitionCount;
}
int main() {
int n;
cin >> n;
cout << totalPartitionCount(n) << endl;
}
| [
"jayendra.rakesh@gmail.com"
] | jayendra.rakesh@gmail.com |
df2bdbe91a736aab9ac635675ec0e57df499f394 | 948f4e13af6b3014582909cc6d762606f2a43365 | /testcases/juliet_test_suite/testcases/CWE121_Stack_Based_Buffer_Overflow/s05/CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memmove_82.h | 7cc036ccc625bf64285ddd69acae14550c84f8ef | [] | 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 | 1,417 | h | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memmove_82.h
Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE805.label.xml
Template File: sources-sink-82.tmpl.h
*/
/*
* @description
* CWE: 121 Stack Based Buffer Overflow
* BadSource: Set data pointer to the bad buffer
* GoodSource: Set data pointer to the good buffer
* BadSink : Copy twoIntsStruct array to data using memmove
* Flow Variant: 82 Data flow: data passed in a parameter to an virtual method called via a pointer
*
* */
#include "std_testcase.h"
namespace CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memmove_82
{
class CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memmove_82_base
{
public:
/* pure virtual function */
virtual void action(twoIntsStruct * data) = 0;
};
#ifndef OMITBAD
class CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memmove_82_bad : public CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memmove_82_base
{
public:
void action(twoIntsStruct * data);
};
#endif /* OMITBAD */
#ifndef OMITGOOD
class CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memmove_82_goodG2B : public CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memmove_82_base
{
public:
void action(twoIntsStruct * data);
};
#endif /* OMITGOOD */
}
| [
"yzhang0701@gmail.com"
] | yzhang0701@gmail.com |
c065615efecb54f3e365a31b2b13979f1d582aac | 9a3b9d80afd88e1fa9a24303877d6e130ce22702 | /src/Providers/UNIXProviders/CommonDatabaseStatistics/tests/CommonDatabaseStatistics.Tests/UNIX_CommonDatabaseStatisticsFixture.cpp | 2dacb4e8c0a01f95c0963435da2b2df5e554aed3 | [
"MIT"
] | permissive | brunolauze/openpegasus-providers | 3244b76d075bc66a77e4ed135893437a66dd769f | f24c56acab2c4c210a8d165bb499cd1b3a12f222 | refs/heads/master | 2020-04-17T04:27:14.970917 | 2015-01-04T22:08:09 | 2015-01-04T22:08:09 | 19,707,296 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,559 | cpp | //%LICENSE////////////////////////////////////////////////////////////////
//
// Licensed to The Open Group (TOG) under one or more contributor license
// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
// this work for additional information regarding copyright ownership.
// Each contributor licenses this file to you under the OpenPegasus Open
// Source License; you may not use this file except in compliance with the
// License.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////
//
//%/////////////////////////////////////////////////////////////////////////
#include "UNIX_CommonDatabaseStatisticsFixture.h"
#include <CommonDatabaseStatistics/UNIX_CommonDatabaseStatisticsProvider.h>
UNIX_CommonDatabaseStatisticsFixture::UNIX_CommonDatabaseStatisticsFixture()
{
}
UNIX_CommonDatabaseStatisticsFixture::~UNIX_CommonDatabaseStatisticsFixture()
{
}
void UNIX_CommonDatabaseStatisticsFixture::Run()
{
CIMName className("UNIX_CommonDatabaseStatistics");
CIMNamespaceName nameSpace("root/cimv2");
UNIX_CommonDatabaseStatistics _p;
UNIX_CommonDatabaseStatisticsProvider _provider;
Uint32 propertyCount;
CIMOMHandle omHandle;
_provider.initialize(omHandle);
_p.initialize();
for(int pIndex = 0; _p.load(pIndex); pIndex++)
{
CIMInstance instance = _provider.constructInstance(className,
nameSpace,
_p);
CIMObjectPath path = instance.getPath();
cout << path.toString() << endl;
propertyCount = instance.getPropertyCount();
for(Uint32 i = 0; i < propertyCount; i++)
{
CIMProperty propertyItem = instance.getProperty(i);
if (propertyItem.getType() == CIMTYPE_REFERENCE) {
CIMValue subValue = propertyItem.getValue();
CIMInstance subInstance;
subValue.get(subInstance);
CIMObjectPath subPath = subInstance.getPath();
cout << " Name: " << propertyItem.getName().getString() << ": " << subPath.toString() << endl;
Uint32 subPropertyCount = subInstance.getPropertyCount();
for(Uint32 j = 0; j < subPropertyCount; j++)
{
CIMProperty subPropertyItem = subInstance.getProperty(j);
cout << " Name: " << subPropertyItem.getName().getString() << " - Value: " << subPropertyItem.getValue().toString() << endl;
}
}
else {
cout << " Name: " << propertyItem.getName().getString() << " - Value: " << propertyItem.getValue().toString() << endl;
}
}
cout << "------------------------------------" << endl;
cout << endl;
}
_p.finalize();
}
| [
"brunolauze@msn.com"
] | brunolauze@msn.com |
190417bc47c569386a5ca377e06aa82a5869482c | 572580660d475027fa349e47a078479222066726 | /Server/kennel/monitor/unix/monitor/Sybase.cpp | 5632c8f96a953dbf7889c1c4c9b3b968b09b3722 | [
"Apache-2.0"
] | permissive | SiteView/ecc82Server | 30bae118932435e226ade01bfbb05b662742e6dd | 084b06af3a7ca6c5abf5064e0d1f3f8069856d25 | refs/heads/master | 2021-01-10T21:11:37.487455 | 2013-01-16T09:22:02 | 2013-01-16T09:22:02 | 7,639,874 | 6 | 3 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 2,574 | cpp |
#include "Sybase.h"
#include "base\funcGeneral.h"
BOOL SYBASE_MONITOR(char *dbconn, char *uid, char *pwd, char *custpath, char *szReturn)
{
BOOL bResult = TRUE;
CDatabase db;
CRecordset *rs = NULL;
CString szConnect;
CString strSQL = _T("select * from master..spt_monitor");
//szConnect.Format(_T("DSN=%s;SRVR=dragonxu;UID=%s;PWD=%s;"), dbconn, uid, pwd);
szConnect.Format(_T("DSN=%s;UID=%s;PWD=%s;"), dbconn, uid, pwd);
puts(szConnect);
try
{
if(!db.OpenEx(szConnect, CDatabase::noOdbcDialog))
{
sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_DB_1%>"));//<%IDS_DB_1%>
return FALSE;
}
puts("Á¬½Ó³É¹¦");
rs = new CRecordset(&db);
rs->Open(CRecordset::forwardOnly, strSQL, CRecordset::noDirtyFieldCheck);
if(rs->IsEOF())
{
bResult = FALSE;
sprintf(szReturn, "error=%s", FuncGetStringFromIDS("<%IDS_SYBASE_01%>"));
goto w;
}
{
CString /*strlastRun = _T(""), */strcpuBusy = _T(""), strioBusy = _T(""),
strIdle = _T(""), strpackReceived = _T(""), strpackSent = _T(""),
strConnections = _T(""), strpackErrors = _T(""), strtotalRead = _T(""),
strtotalWrite = _T(""), strtotalErrors = _T("");
//rs->GetFieldValue(_LASTRUN, strlastRun);
puts("select ok");
rs->GetFieldValue(_CPU_BUSY, strcpuBusy);
rs->GetFieldValue(_IO_BUSY, strioBusy);
rs->GetFieldValue(_IDLE, strIdle);
rs->GetFieldValue(_PACK_RECEIVED, strpackReceived);
rs->GetFieldValue(_PACK_SENT, strpackSent);
rs->GetFieldValue(_CONNECTIONS, strConnections);
rs->GetFieldValue(_PACK_ERRORS, strpackErrors);
rs->GetFieldValue(_TOTAL_READ, strtotalRead);
rs->GetFieldValue(_TOTAL_WRITE, strtotalWrite);
rs->GetFieldValue(_TOTAL_ERRORS, strtotalErrors);
/*
sprintf(szReturn, "cpuBusy=%s$ioBusy=%s$Idle=%s$packReceived=%s$packSent=%s$Connections=%s$packErrors=%s$totalRead=%s$totalWrite=%s$totalErrors=%s$",
strcpuBusy, strioBusy, strIdle, strpackReceived, strpackSent,
strConnections, strpackErrors, strtotalRead, strtotalWrite,
strtotalErrors);
*/
sprintf(szReturn, "cpu_busy=%s$io_busy=%s$packets_received=%s$packets_sent=%s$connections=%s$packet_errors=%s$total_read=%s$total_write=%s$total_errors=%s$",
strcpuBusy, strioBusy, strpackReceived, strpackSent,
strConnections, strpackErrors, strtotalRead, strtotalWrite,
strtotalErrors);
}
w: rs->Close();
}
catch (CDBException* e)
{
sprintf(szReturn, "error=%s", e->m_strError.GetBuffer(e->m_strError.GetLength()));
e->Delete();
}
if(rs != NULL)
delete rs;
db.Close();
return bResult;
}
| [
"xingyu.cheng@dragonflow.com"
] | xingyu.cheng@dragonflow.com |
34b76372eb46f1114aabc043ee1080447b5a65df | 36fdbbdeaa96cc51c181d34bf6bf56ebc99de332 | /kmeans_openmp/Point.cpp | 2628fba88b2e2c519592379285d247e5e3f750a1 | [] | no_license | cristianogle/kmeans | 97a59094b22633fd074766ceb9718c40b5f5f8a3 | e43570784d7698f995f415fa766e99ebd4309c95 | refs/heads/master | 2021-04-27T17:18:47.678879 | 2018-02-21T10:13:09 | 2018-02-21T10:13:09 | 122,318,705 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 668 | cpp | #include "Point.h"
Point::Point(int id, int x, int y) {
id_point = id;
this->x = x;
this->y = y;
id_cluster = -1;
}
Point::Point(int x, int y) {
this->id_point = -1;
this->x = x;
this->y = y;
id_cluster = -1;
}
void Point::setCluster(int id_cluster) {
this->id_cluster = id_cluster;
}
int Point::getID() { return id_point; }
int Point::getCluster() { return id_cluster; }
int Point::getX() { return x; }
int Point::getY() { return y; }
void Point::setX(int x) { this->x = x; }
void Point::setY(int y) { this->y = y; }
double Point::getDistance(Point other) {
return sqrt(pow(this->x - other.getX(), 2)+ pow(this->y - other.getY(), 2));
}
| [
"noreply@github.com"
] | noreply@github.com |
ed507053158e8b1569e6d24bb3e142f8ce612e20 | a144611ad0a2842bc6f6b64181689910c173947a | /include/SampleTextureRender.h | 3809a5a5a9e6e7dcbf2bff896484d077e44ddbfc | [] | no_license | Montx/AnimationSystem | b3a99bd3b434095eb2ab13c0f31d0903b1cc9f28 | 2b59d2927305fb16f81a2216eeec9167965712dc | refs/heads/master | 2023-05-24T14:24:36.462773 | 2021-06-21T22:40:20 | 2021-06-21T22:40:20 | 277,361,115 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 659 | h | #ifndef _H_SAMPLE_
#define _H_SAMPLE_
#include "math/vec3.h"
#include "math/vec2.h"
#include "Application.h"
#include "render/Shader.h"
#include "render/Attribute.h"
#include "render/IndexBuffer.h"
#include "render/Texture.h"
#define DEG2RAD 0.0174533f
class SampleTextureRender : public Application {
protected:
Shader* mShader;
Attribute<vec3>* mVertexPositions;
Attribute<vec3>* mVertexNormals;
Attribute<vec2>* mVertexTexCoords;
IndexBuffer* mIndexBuffer;
Texture* mDisplayTexture;
float mRotation;
vec3 mTranslation;
public:
void Initialize();
void Update(float inDeltaTime);
void Render(float inAspectRatio);
void Shutdown();
};
#endif
| [
"fateweaving@hotmail.com"
] | fateweaving@hotmail.com |
f18f043ffe98a1d7dae8ac2430ceead6b01e096c | fe75ad7849b8e34d03654e05591e46630219b351 | /Tarea_5/src/binario.cpp | 9a70aa9163f5dca007c0196b423bdcdaa77df2f9 | [] | no_license | JuanFerInc/Prog-2 | aafc25d43d6a9d3ca68eb6069c199b8c46c5ca82 | 3705aa578dfe0eaa305733dbc552913d4a1bd0be | refs/heads/master | 2020-05-29T19:00:21.474503 | 2019-05-30T00:32:37 | 2019-05-30T00:32:37 | 189,318,356 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,122 | cpp | /* 48191081 */
#include "../include/info.h"
#include "../include/cadena.h"
#include "../include/binario.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
struct rep_binario {
info_t dato;
rep_binario *izq;
rep_binario *der;
};
binario_t crear_binario(){
return NULL;
}
bool insertar_en_binario(info_t i, binario_t &b){
if(b == NULL){
binario_t leaf = new rep_binario;
leaf->dato = i;
leaf->izq = leaf->der = NULL;
b = leaf;
return true;
}else if (strcmp(frase_info(i),frase_info(b->dato)) < 0 ){
return insertar_en_binario(i,b->izq);
}else if(strcmp(frase_info(i),frase_info(b->dato)) > 0){
return insertar_en_binario(i,b->der);
}else {return false;};
}
info_t remover_mayor(binario_t &b){
info_t res;
if (b->der == NULL){
res = b->dato;
binario_t izq = b->izq;
delete(b);
b = izq;
}else{
res = remover_mayor(b->der);
}
return res;
}
bool remover_de_binario(const char *t, binario_t &b){
if (es_vacio_binario(b)){
return false;
}else if(strcmp(t,frase_info(b->dato)) < 0) {
return remover_de_binario(t,b->izq);
}else if(strcmp(t,frase_info(b->dato)) > 0){
return remover_de_binario(t,b->der);
} else {
// al encontrar necesitamos remplasarlo por el valor mas
// grande del subarbol izquierdo
binario_t aux_b = NULL;
if (b->izq == NULL){
aux_b = b;
b = b->der;
liberar_info(aux_b->dato);
delete(aux_b);
}else if(b->der == NULL){
aux_b = b;
b = b->izq;
liberar_info(aux_b->dato);
delete(aux_b);
}else{
info_t mayor = remover_mayor(b->izq);
liberar_info(b->dato);
b->dato = mayor;
}
return true;
}
}
void liberar_binario(binario_t &b){
if(!(es_vacio_binario(b))){
liberar_binario(b->izq);
liberar_binario(b->der);
liberar_info(b->dato);
delete(b);
}
}
bool es_vacio_binario(binario_t b){
if (b == NULL){
return true;
}else return false;
}
// retorna la distancia entre dos enter
static nat distancia(nat a, nat b){
if(a < b){
return (b-a);
}else return (a-b);
}
// retorna el maximo entre dos numeros
static nat max(nat a, nat b){
if (a > b){
return a;
}else return b;
}
bool aux_es_AVL(binario_t b, nat &altura){
nat altura_izq = 0;
nat altura_der = 0;
if(b == NULL){
return true;
altura = 0;
}
bool izq = aux_es_AVL(b->izq, altura_izq);
bool der = aux_es_AVL(b->der,altura_der);
altura = max(altura_izq,altura_der) +1;
if(distancia(altura_izq,altura_der) >= 2){
return false;
}else return izq&&der;
}
bool es_AVL(binario_t b){
nat altura = 0;
return aux_es_AVL(b,altura);
}
info_t raiz(binario_t b){
info_t res = b->dato;
return res;
}
binario_t izquierdo(binario_t b){
return b->izq;
}
binario_t derecho(binario_t b){
return b->der;
}
binario_t buscar_subarbol(const char *t, binario_t b){
if (es_vacio_binario(b)){
return NULL;
}else if(strcmp(t,frase_info(b->dato)) < 0) {
return buscar_subarbol(t,b->izq);
}else if(strcmp(t,frase_info(b->dato)) > 0){
return buscar_subarbol(t,b->der);
} else {
return b;
}
}
nat altura_binario(binario_t b){
if(es_vacio_binario(b)){
return 0;
}else return (1 + max(altura_binario(b->izq), altura_binario(b->der)));
}
nat cantidad_binario(binario_t b){
if(es_vacio_binario(b)){
return 0;
}else return (cantidad_binario(b->izq) + cantidad_binario(b->der) + 1);
}
info_t kesimo_en_binario_aux(nat k, nat &nodo,binario_t b){
// si estoy en un nodo del extremo retorno null
if((k == 0)|| (b == NULL)){
return NULL;
}else{
// tengo que posicionarme en el ultimo nodo
info_t res = kesimo_en_binario_aux(k,nodo,b->izq);
// cuento el nodo
nodo++;
// posible que nodo sol venga de otro nodo cuando recorri el lado izquierdo
// o que el nodo en el que estamos sea solucion
// de lo contrario verificamos el subarbol derecho
if((res != NULL)){
return res;
}else if(k == nodo){
return b->dato;
}else{
return kesimo_en_binario_aux(k,nodo,b->der);
}
}
}
info_t kesimo_en_binario(nat k, binario_t b){
nat nodo = 0;
return kesimo_en_binario_aux(k,nodo,b);
}
static cadena_t aux_linealizacion(binario_t b, cadena_t &cad){
if (es_vacio_binario(b)){
return NULL;
}else {
aux_linealizacion(b->der,cad);
info_t aux_info = copia_info(b->dato);
if(es_vacia_cadena(cad)){
insertar_al_final(aux_info,cad);
}else{
insertar_antes(aux_info,inicio_cadena(cad),cad);
}
aux_linealizacion(b->izq,cad);
}
return cad;
}
cadena_t linealizacion(binario_t b){
cadena_t cad = crear_cadena();
aux_linealizacion(b,cad);
return cad;
}
// funcion auxiliar utilisada por filtrado_aux que retorna el dato numero del nodo mas grande
static info_t maximo_nodo_info(int clave, binario_t b){
if(es_vacio_binario(b)){
return NULL;
}else if(numero_info(b->dato) >= clave){
return maximo_nodo_info(clave,b->der);
}else if(es_vacio_binario(b->der)){
return copia_info(b->dato);
}else if(numero_info(b->der->dato) >= clave){
return copia_info(b->dato);
}else return maximo_nodo_info(clave,b->der);
}
// cada nodo que cumpla la condicion es agregado a res
// si el nodo no complue la condicion, se agrega el mayor nodo del sub-arbol izquierd
// para mantener la misma estructura que el arbol binario origianl
static void filtrado_aux(int clave, binario_t b, binario_t &res){
info_t aux_info = NULL;
if(!es_vacio_binario(b)){ //si el arbol es vacio se hace nada
if(numero_info(b->dato) < clave){ //primer se mira si el nodo cumple la condicion
aux_info = copia_info(b->dato); //si este cumple, se lo agrega al arbol
if(insertar_en_binario(aux_info,res) == false){ // aseguramos que el nodo fue insertado, de lo contrario se borra la informacion
liberar_info(aux_info);
}
filtrado_aux(clave,b->izq,res);
filtrado_aux(clave,b->der,res);
}else if(numero_info(b->dato) >= clave) { // si el nodo en el que estamos parado no cumple la condicion buscamos el mas grande en el sub-arbol izquierdo
if(b->izq != NULL){ // que cumpla la condicion
aux_info = maximo_nodo_info(clave,b->izq);
if(aux_info != NULL){
if(insertar_en_binario(aux_info,res) == false){ // seguramos que el nodo se aya insertado, de lo contrario se borra la informacion obtenida
liberar_info(aux_info);
}
}
}
filtrado_aux(clave,b->izq,res); // llamado recursivo izquierdo
filtrado_aux(clave,b->der,res); // llamado recursivo derecho
}
}
}
binario_t filtrado(int clave, binario_t b){
binario_t res = crear_binario();
filtrado_aux(clave,b,res);
return res;
}
static void aux_imprimir_binario(int altura, binario_t b){
if (es_vacio_binario(b)){
}else {
aux_imprimir_binario(altura+1,b->der);
for(int i = 0; i<altura; i++){
printf("-");
}
printf("(%d,%s)\n", numero_info(b->dato),frase_info(b->dato));
aux_imprimir_binario(altura+1,b->izq);
}
}
void imprimir_binario(binario_t b){
printf("\n");
// utilisando una funcion aux que reciva comom parametro adicional un int poder mantener
// un control de la altura en la que se encuentra la funcion para lograr imprimir
// la cantidad de caracteres que correspondan
aux_imprimir_binario(0,b);
}
// Dado una cadena y un ocalizador de la cadena, retorna el largo de la cadena
// O(n)
nat largo_cadena(localizador_t loc, cadena_t cad){
nat largo = 0;
while(es_localizador(loc)){
loc = siguiente(loc,cad);
largo++;
}
return largo;
}
binario_t crear_balanceado_aux (nat largo,cadena_t &cad){
if(largo <= 0){
return NULL;
}else {
binario_t res = new rep_binario;
res->izq = crear_balanceado_aux(largo/2,cad);
localizador_t loc = inicio_cadena(cad);
info_t copia = copia_info(info_cadena(loc,cad));
res->dato = copia;
remover_de_cadena(loc,cad);
res->der = crear_balanceado_aux(largo - (largo/2)-1,cad);
return res;
}
}
binario_t crear_balanceado(cadena_t cad){
cadena_t cad_copia = segmento_cadena(inicio_cadena(cad),final_cadena(cad),cad);
nat largo = largo_cadena(inicio_cadena(cad_copia),cad_copia);
binario_t res = crear_balanceado_aux(largo, cad_copia);
liberar_cadena(cad_copia);
return res;
} | [
"JuanFerrand@users.noreply.github.com"
] | JuanFerrand@users.noreply.github.com |
50fd30bdb3f6a4fc6afbc58cb110a8768d2ae53c | ce5877ec37be0e79e526802ddc9be4e6f3818def | /Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkGibbsTrackingView.h | 6d85a900da72be2ee34dcd00242c1aafcf5b7f97 | [] | no_license | robotdm/MITK | 97b7fcee18cf1824bcfd2c35eb6c795094b171f2 | 2f6475053fbae8e2a30ba0a34c480cae5557ed50 | refs/heads/master | 2021-01-16T20:35:36.081416 | 2012-02-03T13:46:07 | 2012-02-03T13:46:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,502 | h | /*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2010-03-31 16:40:27 +0200 (Mi, 31 Mrz 2010) $
Version: $Revision: 21975 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef QmitkGibbsTrackingView_h
#define QmitkGibbsTrackingView_h
#include <berryISelectionListener.h>
#include <QmitkFunctionality.h>
#include "ui_QmitkGibbsTrackingViewControls.h"
#include <mitkQBallImage.h>
#include <QThread>
#include <mitkFiberBundleX.h>
#include <QTime>
#include <itkImage.h>
#include <vtkSmartPointer.h>
#include <vtkPolyData.h>
class QmitkGibbsTrackingView;
class QmitkTrackingWorker : public QObject
{
Q_OBJECT
public:
QmitkTrackingWorker(QmitkGibbsTrackingView* view);
public slots:
void run();
private:
QmitkGibbsTrackingView* m_View;
};
/*!
\brief QmitkGibbsTrackingView
\warning This application module is not yet documented. Use "svn blame/praise/annotate" and ask the author to provide basic documentation.
\sa QmitkFunctionality
\ingroup Functionalities
*/
typedef itk::Image< float, 3 > FloatImageType;
namespace itk
{
template<class X, class Y>
class GibbsTrackingFilter;
}
class QmitkGibbsTrackingView : public QmitkFunctionality
{
// this is needed for all Qt objects that should have a Qt meta-object
// (everything that derives from QObject and wants to have signal/slots)
Q_OBJECT
public:
typedef itk::Image<float,3> MaskImgType;
typedef itk::Vector<float, QBALL_ODFSIZE> OdfVectorType;
typedef itk::Image<OdfVectorType, 3> ItkQBallImgType;
typedef itk::GibbsTrackingFilter<ItkQBallImgType, MaskImgType> GibbsTrackingFilterType;
static const std::string VIEW_ID;
QmitkGibbsTrackingView();
virtual ~QmitkGibbsTrackingView();
virtual void CreateQtPartControl(QWidget *parent);
virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget);
virtual void StdMultiWidgetNotAvailable();
signals:
protected slots:
void StartGibbsTracking();
void StopGibbsTracking();
void AfterThread();
void BeforeThread();
void TimerUpdate();
void SetMask();
void AdvancedSettings();
void SaveTrackingParameters();
void LoadTrackingParameters();
void SetIterations(int value);
void SetParticleWidth(int value);
void SetParticleLength(int value);
void SetInExBalance(int value);
void SetFiberLength(int value);
void SetParticleWeight(int value);
void SetStartTemp(int value);
void SetEndTemp(int value);
void SetCurvatureThreshold(int value);
void SetOutputFile();
private:
// Visualization & GUI
void GenerateFiberBundle(bool smoothFibers);
void UpdateGUI();
void UpdateTrackingStatus();
/// \brief called by QmitkFunctionality when DataManager's selection has changed
virtual void OnSelectionChanged( std::vector<mitk::DataNode*> nodes );
template<class InputImageType>
void CastToFloat(InputImageType* image, typename mitk::Image::Pointer outImage);
void UpdateIteraionsGUI(unsigned long iterations);
Ui::QmitkGibbsTrackingViewControls* m_Controls;
QmitkStdMultiWidget* m_MultiWidget;
// data objects
mitk::FiberBundleX::Pointer m_FiberBundle;
MaskImgType::Pointer m_MaskImage;
mitk::QBallImage::Pointer m_QBallImage;
ItkQBallImgType::Pointer m_ItkQBallImage;
// data nodes
mitk::DataNode::Pointer m_QBallImageNode;
mitk::DataNode::Pointer m_MaskImageNode;
mitk::DataNode::Pointer m_FiberBundleNode;
// flags etc.
bool m_ThreadIsRunning;
QTimer* m_TrackingTimer;
QTime m_TrackingTime;
unsigned long m_ElapsedTime;
bool m_QBallSelected;
bool m_FibSelected;
unsigned long m_Iterations;
int m_LastStep;
QString m_OutputFileName;
int m_SaveCounter;
// global tracker and friends
itk::SmartPointer<GibbsTrackingFilterType> m_GlobalTracker;
QmitkTrackingWorker m_TrackingWorker;
QThread m_TrackingThread;
friend class QmitkTrackingWorker;
};
#endif // _QMITKGibbsTrackingVIEW_H_INCLUDED
| [
"p.neher@dkfz-heidelberg.de"
] | p.neher@dkfz-heidelberg.de |
de82853a704e4bbdf08875f2faa8702f72a49adc | 5cd88ef8b7b43b3039bad7c8cf9423c257b0b512 | /Penguin/src/scenes/SceneTest.cpp | 3c0ac024774b214b936ef2ae193fd604b3d40c3b | [] | no_license | David-DiGioia/penguin-graphics | d8fa5eb25be4af8842a6082f068d650240547548 | a02ec7c5a398d8827d39efc9d6fb1e77a3808c59 | refs/heads/master | 2020-06-10T02:10:14.118262 | 2019-09-15T23:07:49 | 2019-09-15T23:07:49 | 193,552,694 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,939 | cpp | #include "SceneTest.h"
#include "glm/gtc/quaternion.hpp"
#include "glm/gtx/quaternion.hpp"
#include "imgui/imgui.h"
#include "imgui/imgui_impl_glfw.h"
#include "imgui/imgui_impl_opengl3.h"
#include "../Constants.h"
namespace Scenes {
void SceneTest::init()
{
activeCamera = std::make_unique<MeshData::Camera>();
penguin = std::make_unique<Object>(&models, "data/mesh/penguin.obj", "data/textures/penguin_col.png");
bulldozer = std::make_unique<Object>(&models, "data/mesh/bulldozer.obj", "data/textures/bulldozer_col.png");
igloo = std::make_unique<Object>(&models, "data/mesh/igloo.obj", "data/textures/igloo_col.png");
}
// Controlled by gui
glm::vec3 position{ 0.0f, 0.0f, -2.0f };
float angle{ 0 };
glm::vec3 scale{ 1.0f, 1.0f, 1.0f };
glm::vec3 positionC{ 0.0f, 0.0f, 0.0f };
float angleC{ 0 };
void SceneTest::update(float delta)
{
glm::vec3 axis{ 0.0f, 1.0f, 0.0f };
axis = glm::normalize(axis);
glm::fquat orientation{ glm::angleAxis(angle, axis) };
penguin->get().transform.pos = position;
penguin->get().transform.rot = orientation;
penguin->get().transform.scale = scale;
glm::fquat orientationC{ glm::angleAxis(angleC, axis) };
activeCamera->transform.pos = positionC;
activeCamera->transform.rot = orientationC;
}
void SceneTest::gui()
{
ImGui::Begin("Debug");
ImGui::Text("Model transform:");
ImGui::SliderFloat("Angle", &angle, 0.0f, 2.0f * Constants::PI);
ImGui::SliderFloat3("Position", &position.x, -3.0f, 3.0f);
ImGui::SliderFloat3("Scale", &scale.x, 0.0f, 3.0f);
ImGui::Text("Camera transform:");
ImGui::SliderFloat("AngleC", &angleC, 0.0f, 2.0f * Constants::PI);
ImGui::SliderFloat3("PositionC", &positionC.x, -3.0f, 3.0f);
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
ImGui::End();
}
void SceneTest::keyEvent(int key, int scancode, int action, int mods)
{
}
} | [
"davidofjoy@gmail.com"
] | davidofjoy@gmail.com |
8c10868d2515e2a88552bb09ec5961fd8f38936f | 5fa84c413bbfa6e940f57df163ab1ba6e4659c09 | /external/glm/detail/type_vec3.hpp | 72d322862e498967b298dde4cb30228031da8900 | [
"MIT"
] | permissive | PacktPublishing/Learning-Vulkan | f5a51f41180136e6ef911c130787c7e7a9615c13 | bc3a76c7b3ec34a222e8a216bf39b740cfecb10c | refs/heads/master | 2023-01-22T10:54:33.917187 | 2023-01-18T09:58:05 | 2023-01-18T09:58:05 | 74,563,033 | 202 | 64 | MIT | 2021-02-19T13:37:19 | 2016-11-23T09:50:50 | C++ | UTF-8 | C++ | false | false | 16,978 | hpp | ///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
/// Restrictions:
/// By making use of the Software for military purposes, you choose to make
/// a Bunny unhappy.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE.
///
/// @ref core
/// @file glm/detail/type_vec3.hpp
/// @date 2008-08-22 / 2011-06-15
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "type_vec.hpp"
#ifdef GLM_SWIZZLE
# if GLM_HAS_ANONYMOUS_UNION
# include "_swizzle.hpp"
# else
# include "_swizzle_func.hpp"
# endif
#endif //GLM_SWIZZLE
#include <cstddef>
namespace glm
{
template <typename T, precision P = defaultp>
struct tvec3
{
// -- Implementation detail --
typedef tvec3<T, P> type;
typedef tvec3<bool, P> bool_type;
typedef T value_type;
# ifdef GLM_META_PROG_HELPERS
static GLM_RELAXED_CONSTEXPR length_t components = 3;
static GLM_RELAXED_CONSTEXPR precision prec = P;
# endif//GLM_META_PROG_HELPERS
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type X;
static const type Y;
static const type Z;
static const type XY;
static const type XZ;
static const type YZ;
static const type XYZ;
# endif
// -- Data --
# if GLM_HAS_ANONYMOUS_UNION
union
{
struct{ T x, y, z; };
struct{ T r, g, b; };
struct{ T s, t, p; };
# ifdef GLM_SWIZZLE
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, x, y, z)
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, r, g, b)
_GLM_SWIZZLE3_2_MEMBERS(T, P, tvec2, s, t, p)
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, x, y, z)
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, r, g, b)
_GLM_SWIZZLE3_3_MEMBERS(T, P, tvec3, s, t, p)
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, x, y, z)
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, r, g, b)
_GLM_SWIZZLE3_4_MEMBERS(T, P, tvec4, s, t, p)
# endif//GLM_SWIZZLE
};
# else
union { T x, r, s; };
union { T y, g, t; };
union { T z, b, p; };
# ifdef GLM_SWIZZLE
GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, P, tvec3, tvec2, tvec3, tvec4)
# endif//GLM_SWIZZLE
# endif//GLM_LANG
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC
/// Return the count of components of the vector
typedef size_t size_type;
GLM_FUNC_DECL GLM_CONSTEXPR size_type size() const;
GLM_FUNC_DECL T & operator[](size_type i);
GLM_FUNC_DECL T const & operator[](size_type i) const;
# else
/// Return the count of components of the vector
typedef length_t length_type;
GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
GLM_FUNC_DECL T & operator[](length_type i);
GLM_FUNC_DECL T const & operator[](length_type i) const;
# endif//GLM_FORCE_SIZE_FUNC
// -- Implicit basic constructors --
GLM_FUNC_DECL tvec3() GLM_DEFAULT_CTOR;
GLM_FUNC_DECL tvec3(tvec3<T, P> const & v) GLM_DEFAULT;
template <precision Q>
GLM_FUNC_DECL tvec3(tvec3<T, Q> const & v);
// -- Explicit basic constructors --
GLM_FUNC_DECL explicit tvec3(ctor);
GLM_FUNC_DECL explicit tvec3(T const & scalar);
GLM_FUNC_DECL tvec3(T const & a, T const & b, T const & c);
// -- Conversion scalar constructors --
/// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C>
GLM_FUNC_DECL tvec3(A const & a, B const & b, C const & c);
template <typename A, typename B, typename C>
GLM_FUNC_DECL tvec3(tvec1<A, P> const & a, tvec1<B, P> const & b, tvec1<C, P> const & c);
// -- Conversion vector constructors --
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL tvec3(tvec2<A, Q> const & a, B const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL tvec3(tvec2<A, Q> const & a, tvec1<B, Q> const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL tvec3(A const & a, tvec2<B, Q> const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, precision Q>
GLM_FUNC_DECL tvec3(tvec1<A, Q> const & a, tvec2<B, Q> const & b);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT tvec3(tvec4<U, Q> const & v);
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, precision Q>
GLM_FUNC_DECL GLM_EXPLICIT tvec3(tvec3<U, Q> const & v);
// -- Swizzle constructors --
# if GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
template <int E0, int E1, int E2>
GLM_FUNC_DECL tvec3(detail::_swizzle<3, T, P, tvec3<T, P>, E0, E1, E2, -1> const & that)
{
*this = that();
}
template <int E0, int E1>
GLM_FUNC_DECL tvec3(detail::_swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v, T const & scalar)
{
*this = tvec3<T, P>(v(), scalar);
}
template <int E0, int E1>
GLM_FUNC_DECL tvec3(T const & scalar, detail::_swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2> const & v)
{
*this = tvec3<T, P>(scalar, v());
}
# endif// GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
// -- Unary arithmetic operators --
GLM_FUNC_DECL tvec3<T, P> & operator=(tvec3<T, P> const & v) GLM_DEFAULT;
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator+=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator+=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator+=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator-=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator-=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator-=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator*=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator*=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator*=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator/=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator/=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator/=(tvec3<U, P> const & v);
// -- Increment and decrement operators --
GLM_FUNC_DECL tvec3<T, P> & operator++();
GLM_FUNC_DECL tvec3<T, P> & operator--();
GLM_FUNC_DECL tvec3<T, P> operator++(int);
GLM_FUNC_DECL tvec3<T, P> operator--(int);
// -- Unary bit operators --
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator%=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator%=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator%=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator&=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator&=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator&=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator|=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator|=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator|=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator^=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator^=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator^=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator<<=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator<<=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator<<=(tvec3<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator>>=(U scalar);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator>>=(tvec1<U, P> const & v);
template <typename U>
GLM_FUNC_DECL tvec3<T, P> & operator>>=(tvec3<U, P> const & v);
};
// -- Unary operators --
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator+(tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator-(tvec3<T, P> const & v);
// -- Binary operators --
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator+(tvec3<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator+(tvec3<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator+(T const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator+(tvec1<T, P> const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator+(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator-(tvec3<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator-(tvec3<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator-(T const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator-(tvec1<T, P> const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator-(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator*(tvec3<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator*(tvec3<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator*(T const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator*(tvec1<T, P> const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator*(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator/(tvec3<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator/(tvec3<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator/(T const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator/(tvec1<T, P> const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator/(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator%(tvec3<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator%(tvec3<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator%(T const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator%(tvec1<T, P> const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator%(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator&(tvec3<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator&(tvec3<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator&(T const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator&(tvec1<T, P> const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator&(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator|(tvec3<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator|(tvec3<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator|(T const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator|(tvec1<T, P> const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator|(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator^(tvec3<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator^(tvec3<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator^(T const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator^(tvec1<T, P> const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator^(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator<<(tvec3<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator<<(tvec3<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator<<(T const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator<<(tvec1<T, P> const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator<<(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator>>(tvec3<T, P> const & v, T const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator>>(tvec3<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator>>(T const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator>>(tvec1<T, P> const & scalar, tvec3<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator>>(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL tvec3<T, P> operator~(tvec3<T, P> const & v);
// -- Boolean operators --
template <typename T, precision P>
GLM_FUNC_DECL bool operator==(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
template <typename T, precision P>
GLM_FUNC_DECL bool operator!=(tvec3<T, P> const & v1, tvec3<T, P> const & v2);
template <precision P>
GLM_FUNC_DECL tvec3<bool, P> operator&&(tvec3<bool, P> const & v1, tvec3<bool, P> const & v2);
template <precision P>
GLM_FUNC_DECL tvec3<bool, P> operator||(tvec3<bool, P> const & v1, tvec3<bool, P> const & v2);
// -- Is type --
template <typename T, precision P>
struct type<T, P, tvec3>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
};
}//namespace glm
#ifndef GLM_EXTERNAL_TEMPLATE
#include "type_vec3.inl"
#endif//GLM_EXTERNAL_TEMPLATE
| [
"sushantn@packt.com"
] | sushantn@packt.com |
40450065f4225cdd4d85fb736f85ed73041eca88 | 5e8d200078e64b97e3bbd1e61f83cb5bae99ab6e | /main/source/src/utility/options/keys/FileVectorOptionKey.fwd.hh | fc9024856d257ff909c1952ed071469f33671f5e | [] | no_license | MedicaicloudLink/Rosetta | 3ee2d79d48b31bd8ca898036ad32fe910c9a7a28 | 01affdf77abb773ed375b83cdbbf58439edd8719 | refs/heads/master | 2020-12-07T17:52:01.350906 | 2020-01-10T08:24:09 | 2020-01-10T08:24:09 | 232,757,729 | 2 | 6 | null | null | null | null | UTF-8 | C++ | false | false | 1,054 | hh | // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
// vi: set ts=2 noet:
//
// (c) Copyright Rosetta Commons Member Institutions.
// (c) This file is part of the Rosetta software suite and is made available under license.
// (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
// (c) For more information, see http://www.rosettacommons.org. Questions about this can be
// (c) addressed to University of Washington CoMotion, email: license@uw.edu.
/// @file utility/options/keys/FileVectorOptionKey.fwd.hh
/// @brief utility::options::FileVectorOptionKey forward declarations
/// @author Stuart G. Mentzer (Stuart_Mentzer@objexx.com)
#ifndef INCLUDED_utility_options_keys_FileVectorOptionKey_fwd_hh
#define INCLUDED_utility_options_keys_FileVectorOptionKey_fwd_hh
namespace utility {
namespace options {
// Forward
class FileVectorOptionKey;
} // namespace options
} // namespace utility
#endif // INCLUDED_utility_options_keys_FileVectorOptionKey_FWD_HH
| [
"36790013+MedicaicloudLink@users.noreply.github.com"
] | 36790013+MedicaicloudLink@users.noreply.github.com |
344dae2de9dc591f2a652d5974717ae90f5dfc89 | 4c23be1a0ca76f68e7146f7d098e26c2bbfb2650 | /ic8h18/0.0055/AC3H4CH2CHO | bcfa91245dc44cafc91ef81ea7ff61122d59a54c | [] | no_license | labsandy/OpenFOAM_workspace | a74b473903ddbd34b31dc93917e3719bc051e379 | 6e0193ad9dabd613acf40d6b3ec4c0536c90aed4 | refs/heads/master | 2022-02-25T02:36:04.164324 | 2019-08-23T02:27:16 | 2019-08-23T02:27:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 844 | /*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 6
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0.0055";
object AC3H4CH2CHO;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 4.91259e-18;
boundaryField
{
boundary
{
type empty;
}
}
// ************************************************************************* //
| [
"jfeatherstone123@gmail.com"
] | jfeatherstone123@gmail.com | |
dde9540ca6e071a0624b32b4b3661b8de21328c4 | 5f4fd92950d1111d6bd17a8b78366fd09e5584b0 | /AssimpTest/FBXLoader.cpp | 532133efbadec4f361a8afab356f3e095e1c1c8c | [] | no_license | DuckMonster/AssimpTesting | 08de71cc4fe07c8e4dbb6d587d40336877a29991 | ea0f3623401d8d37dd40d46882338c098b03bbd2 | refs/heads/master | 2020-05-23T11:15:33.786783 | 2017-02-20T21:22:49 | 2017-02-20T21:22:49 | 80,369,762 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,938 | cpp | #include "stdafx.h"
#include "FBXLoader.h"
#include <assimp/Importer.hpp>
#include <assimp/postprocess.h>
#include <assimp/scene.h>
#include <regex>
using namespace std;
namespace {
string GetNodeName( const std::string node ) {
string str( node );
smatch match;
regex expr( "^(\\w+)_\\$" );
if (regex_search( str, match, expr )) {
return match[1];
}
else return str;
}
string GetNodeName( const aiNode* node ) { return GetNodeName( node->mName.C_Str( ) ); }
string GetNodeName( const aiNodeAnim* node ) { return GetNodeName( node->mNodeName.C_Str( ) ); }
string GetNodeData( const std::string node ) {
string str( node );
smatch match;
regex expr( "_(\\w+)$" );
if (regex_search( str, match, expr )) {
return match[1];
}
else return "";
}
string GetNodeData( const aiNode* node ) { return GetNodeData( node->mName.C_Str( ) ); }
string GetNodeData( const aiNodeAnim* node ) { return GetNodeData( node->mNodeName.C_Str( ) ); }
void ProcessNode( aiNode* node, int indents ) {
for (size_t i = 0; i < indents; i++) {
cout << " ";
}
cout << node->mName.C_Str( ) << "\n";
for (size_t i = 0; i < node->mNumChildren; i++) {
ProcessNode( node->mChildren[i], indents + 1 );
}
}
void ProcessAnimation( aiAnimation* anim ) {
cout << anim->mName.C_Str( ) << "\n";
for (size_t i = 0; i < anim->mNumChannels; i++) {
aiNodeAnim* chnl = anim->mChannels[i];
cout << " " << chnl->mNodeName.C_Str( ) << "\n";
cout << " " << chnl->mNumPositionKeys << "\n"
<< " " << chnl->mNumRotationKeys << "\n"
<< " " << chnl->mNumScalingKeys << "\n";
}
}
template<typename OutT, typename InT>
OutT convert( const InT& value ) {
OutT result;
for (size_t i = 0; i < result.length( ); i++)
result[i] = value[i];
return result;
}
quat convert( const aiQuaternion& value ) {
return quat( value.w, value.x, value.y, value.z );
}
mat4 convert( const aiMatrix4x4& mat ) {
mat4 result;
for (size_t i = 0; i < result.length( ); i++) {
for (size_t j = 0; j < result[i].length( ); j++) {
result[i][j] = mat[i][j];
}
}
return result;
}
}
void FBXLoader::Load( const string file, CMesh& mesh ) {
Assimp::Importer importer;
const aiScene* scene = importer.ReadFile( file, aiProcess_Triangulate );
if (!scene) {
cout << "Failed to load " << file << ": " << importer.GetErrorString( ) << "\n";
return;
}
ParseMesh( scene, 0, scene->mNumMeshes, mesh );
return;
}
void FBXLoader::Load( const string file, CMeshTree & tree ) {
Assimp::Importer importer;
const aiScene* scene = importer.ReadFile( file, aiProcess_Triangulate );
if (!scene) {
cout << "Failed to load " << file << ": " << importer.GetErrorString( ) << "\n";
return;
}
ProcessNode( scene->mRootNode, 0 );
// Parse meshes
for (size_t i = 0; i < scene->mNumMeshes; i++) {
CMesh* mesh = new CMesh( );
ParseMesh( scene, i, 1, *mesh );
tree.AddMesh( mesh );
}
// Parse nodes
CMeshTree::Node* node = new CMeshTree::Node( GetNodeName( scene->mRootNode ) );
ParseNode( scene->mRootNode, node );
tree.SetRoot( node );
return;
}
void FBXLoader::Load( const std::string file, CAnimation& animation ) {
Assimp::Importer importer;
const aiScene* scene = importer.ReadFile( file, aiProcess_Triangulate );
if (!scene) {
cout << "Failed to load " << file << ": " << importer.GetErrorString( ) << "\n";
return;
}
for (size_t a = 0; a < scene->mNumAnimations; a++) {
aiAnimation* fbxAnimation = scene->mAnimations[a];
animation = CAnimation( fbxAnimation->mDuration, fbxAnimation->mTicksPerSecond );
ProcessAnimation( fbxAnimation );
for (size_t c = 0; c < fbxAnimation->mNumChannels; c++) {
aiNodeAnim* fbxChannel = fbxAnimation->mChannels[c];
std::string nodeName = GetNodeName( fbxChannel );
std::string dataName = GetNodeData( fbxChannel );
CAnimationChannel* chnl = animation.GetChannel( nodeName );
// ------ Specific animation types
if (dataName == "Translation") {
for (size_t p = 0; p < fbxChannel->mNumPositionKeys; p++) {
aiVector3D value = fbxChannel->mPositionKeys[p].mValue;
chnl->GetKey( p ).m_Position = convert<vec3>( value );
}
}
else if (dataName == "Rotation") {
for (size_t p = 0; p < fbxChannel->mNumRotationKeys; p++) {
aiQuaternion value = fbxChannel->mRotationKeys[p].mValue;
chnl->GetKey( p ).m_Rotation = convert( value );
}
}
else if (dataName == "Scaling") {
for (size_t p = 0; p < fbxChannel->mNumScalingKeys; p++) {
aiVector3D value = fbxChannel->mScalingKeys[p].mValue;
chnl->GetKey( p ).m_Scale = convert<vec3>( value );
}
}
// ------ General
else {
for (size_t p = 0; p < fbxChannel->mNumPositionKeys; p++) {
aiVector3D value = fbxChannel->mPositionKeys[p].mValue;
chnl->GetKey( p ).m_Position = convert<vec3>( value );
}
for (size_t p = 0; p < fbxChannel->mNumRotationKeys; p++) {
aiQuaternion value = fbxChannel->mRotationKeys[p].mValue;
chnl->GetKey( p ).m_Rotation = convert( value );
}
for (size_t p = 0; p < fbxChannel->mNumScalingKeys; p++) {
aiVector3D value = fbxChannel->mScalingKeys[p].mValue;
chnl->GetKey( p ).m_Scale = convert<vec3>( value );
}
}
}
}
return;
}
void FBXLoader::ParseMesh( const aiScene* scene, const size_t index, const size_t count, CMesh& mesh ) {
vector<aiVector3D> vertices;
vector<aiVector3D> normals;
vector<aiVector2D> uvs;
vector<size_t> indicies;
size_t elem_offset = 0;
for (size_t m = 0; m < count; m++) {
aiMesh* fbxMesh = scene->mMeshes[index + m];
for (size_t i = 0; i < fbxMesh->mNumVertices; i++) {
vertices.push_back( fbxMesh->mVertices[i] );
if (fbxMesh->HasNormals( ))
normals.push_back( fbxMesh->mNormals[i] );
if (fbxMesh->HasTextureCoords( 0 )) {
aiVector3D v = fbxMesh->mTextureCoords[0][i];
uvs.push_back( aiVector2D( v.x, v.y ) );
}
}
for (size_t f = 0; f < fbxMesh->mNumFaces; f++) {
aiFace face = fbxMesh->mFaces[f];
for (size_t i = 0; i < face.mNumIndices; i++) {
indicies.push_back( face.mIndices[i] + elem_offset );
}
}
elem_offset += fbxMesh->mNumVertices;
}
mesh.SetVertices( &vertices[0].x, sizeof( vertices[0] ) * vertices.size( ) );
mesh.SetNormals( &normals[0].x, sizeof( normals[0] ) * normals.size( ) );
mesh.SetUVs( &uvs[0].x, sizeof( uvs[0] ) * vertices.size( ) );
mesh.SetElements( &indicies[0], sizeof( indicies[0] ) * indicies.size( ) );
}
void FBXLoader::ParseNode( const aiNode* node, CMeshTree::Node* targetNode ) {
std::string data( GetNodeData( node ) );
mat4 baseTransform( 1.f );
// Loop through nodes to fetch all data in FBX parser
while (data != "") {
if (data == "Translation")
baseTransform = baseTransform * transpose( convert( node->mTransformation ) );
if (data == "Rotation")
baseTransform = baseTransform * transpose( convert( node->mTransformation ) );
else if (data == "PreRotation")
targetNode->SetRotationAxes( transpose( convert( node->mTransformation ) ) );
node = node->mChildren[0];
data = GetNodeData( node );
}
// Set meshes
for (size_t i = 0; i < node->mNumMeshes; i++)
targetNode->SetMesh( node->mMeshes[i] );
// Base transform
if (!node->mTransformation.IsIdentity( ))
targetNode->SetTransform( transpose( convert( node->mTransformation ) ) );
else
targetNode->SetTransform( baseTransform );
// We made it! To the actual node
for (size_t i = 0; i < node->mNumChildren; i++) {
aiNode* child = node->mChildren[i];
CMeshTree::Node* newNode = new CMeshTree::Node( GetNodeName( child ) );
ParseNode( child, newNode );
targetNode->AddChild( newNode );
}
} | [
"emil.strm@gmail.com"
] | emil.strm@gmail.com |
f1d94d5bfae1fc429924ef8540300bc28d7059a0 | 7d0618a22a8fc5279530763dccbb8c38023871fe | /HW2/10-3/main.cpp | 0811df87c4983331ec5a827516163363c2a4812e | [] | no_license | B10213147/105-2-Program_Design | 52da38affffa33baddaeacb4e39a2fc75c2fe246 | d623062eca9589778ea3e743e34d07a7347ff499 | refs/heads/master | 2021-01-19T20:26:59.070143 | 2017-06-13T17:18:31 | 2017-06-13T17:18:31 | 83,752,670 | 0 | 0 | null | 2017-06-14T03:05:07 | 2017-03-03T03:23:01 | C++ | UTF-8 | C++ | false | false | 713 | cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
int nums[10];
srand(time(NULL));
cout << "Before:";
for(int i = 0; i < 10; i++){
nums[i] = rand() % 99 + 1;
cout << nums[i] << ' ';
}
for(int i = 10 - 1; i >= 0; i--){
int inew = 0;
for(int j = 0; j < i; j++){
if(nums[j] < nums[j+1]){
int tmp = nums[j];
nums[j] = nums[j+1];
nums[j+1] = tmp;
inew = j + 1;
}
}
i = inew;
}
cout << endl << "After:";
for(int i = 0; i < 10; i++){
cout << nums[i] << ' ';
}
cout << endl;
return 0;
}
| [
"B10213147@yuntech.org.tw"
] | B10213147@yuntech.org.tw |
a7ed0e2614582f968cd39e747def4c3906eba4ea | 6fe466996cb7d2932210a3b38f78ffd31b26fd27 | /IMPORTANT/BIT MANIPULATION/WinningLottery.cpp | b42476758369cc9e0eb6c10bda5a57427e31af41 | [] | no_license | Gaurav6982/c- | bef488ae3b79db3736520042e134abb33932d545 | 34a0ceea52ba5f0f470b631d2fc59fb7de26bb7e | refs/heads/master | 2023-02-13T04:25:49.075891 | 2021-01-25T16:25:00 | 2021-01-25T16:25:00 | 303,927,723 | 4 | 1 | null | 2020-12-16T16:38:34 | 2020-10-14T06:50:59 | C++ | UTF-8 | C++ | false | false | 1,916 | cpp | /*
HACKER RANK BIT MANIPULATION -Medium
https://www.hackerrank.com/challenges/winning-lottery-ticket/problem
INPUT
5
129300455
5559948277
012334556
56789
123456879
OUTPUT
5
*/
/*
WHAT I GOT
CONVERT EACH NUMBER IN BIT WHICH SIGNIFIES THE PRESENSE OF A DIGIT BETWEEN 0-9
AND ADD IT TO MAP WITH ITS OCCURRENCE.
LATER CHECK IF ANY TWO ENTRIES OF MAP MAKING THE ALL ONES WHICH WE HAVE PRE COMPUTED IN VARIABLE WIN
IF IT IS SO THEN MULTIPLY THE OCCERENCES OF BOTH NUMBERS
ALSO CONSIDER THAT THERE MIGHT BE SOME NUMBERS WHICH ALREADY CONTAINS DIIGT FROM 0-9 SO TAKE CARE OF THEM AT END.
BY APPLYING THE SUMMATION FORMULA.
*/
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using value_t=long long;
// Complete the winningLotteryTicket function below.
value_t winningLotteryTicket(vector<string> tickets) {
map<int,value_t> table;
const int win=(1<<10)-1;
for (auto ticket : tickets) {
int numbers(0);
for (auto c : ticket)
numbers |= 1 << (c - '0');
table[numbers]++;
}
value_t res=0;
for (auto ticket1 = table.begin(); ticket1 != prev(table.end()); ++ticket1)
for (auto ticket2 = next(ticket1); ticket2 != table.end(); ++ticket2)
if ((ticket1->first | ticket2->first) == win)
res += ticket1->second * ticket2->second;
return res+table[win] * (table[win] - 1) / 2;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
vector<string> tickets(n);
for(int tickets_i = 0; tickets_i < n; tickets_i++){
cin >> tickets[tickets_i];
}
value_t result = winningLotteryTicket(tickets);
cout << result << endl;
return 0;
} | [
"gaurav.jss.027@gmail.com"
] | gaurav.jss.027@gmail.com |
659ed277d42caaacf2a3e82d7aa1c683ff9b67fb | ca74848e60e1a86279cba5b527f197680ae1c487 | /src/libsk/tfm_descriptor_unittest.cc | 1180ab7bdfa983a1adbb5d7d5ce672b12bd51081 | [] | no_license | EFForg/sovereign-keys | 72d61c48325b80b0bc5ed31612d7797757266149 | 423a664fe5a3f2418520d51faad0e053c8642baa | refs/heads/master | 2020-03-21T03:54:21.278926 | 2012-08-01T03:07:17 | 2012-08-01T03:07:17 | 138,080,343 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,252 | cc | // Copyright 2012 the SK authors. All rights reserved.
#include "tfm_descriptor.h"
#include <memory>
#include <stddef.h>
#include "field.h"
#include "gtest/gtest.h"
#include "test_util.h"
using std::unique_ptr;
namespace sk {
TEST(TFMDescriptorTest, Sanity) {
unique_ptr<TFMDescriptor> desc(new TFMDescriptor(1));
ASSERT_TRUE(desc.get() != NULL);
EXPECT_STREQ("TFM", desc->GetTypeName());
EXPECT_EQ(0, desc->GetTypeId());
EXPECT_TRUE(testing::CheckDescriptorFields(desc.get()));
}
TEST(TFMDescriptorTest, Fields) {
unique_ptr<TFMDescriptor> desc(new TFMDescriptor(1));
ASSERT_TRUE(desc.get() != NULL);
EXPECT_STREQ("Max-Published-SN",
desc->GetField(TFMDescriptor::kMaxPublishedSN).name);
EXPECT_STREQ("Max-Published-Timestamp",
desc->GetField(TFMDescriptor::kMaxPublishedTimestamp).name);
EXPECT_STREQ("Max-SN",
desc->GetField(TFMDescriptor::kMaxSN).name);
EXPECT_STREQ("Max-Timestamp",
desc->GetField(TFMDescriptor::kMaxTimestamp).name);
EXPECT_STREQ("Signature",
desc->GetField(TFMDescriptor::kSignature).name);
EXPECT_STREQ("TID",
desc->GetField(TFMDescriptor::kTID).name);
EXPECT_STREQ("Timestamp",
desc->GetField(TFMDescriptor::kTimestamp).name);
}
} // namespace sk
| [
"jeredw@gmail.com"
] | jeredw@gmail.com |
a510e92028466db9888a7445e2199a88e1c4b285 | 5f1a88d6f40988188a287940f35d4affc4e47d81 | /Hypo3D/src/Hypo/3D/Renderer/Transform.cpp | 44b3fb5f0936e4b0aadc28b70821476347e2b381 | [
"Apache-2.0"
] | permissive | TheodorLindberg/Hypo | 452878ea0cc057304f6d10113667e883d4f835c1 | 67107bf14671711ab5979e2af8c7ead6ee043805 | refs/heads/master | 2022-11-21T10:17:53.916406 | 2020-07-26T21:27:09 | 2020-07-26T21:27:09 | 228,365,153 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,948 | cpp | #include "hypo3dpch.h"
#include "Transform.h"
#include "glm/gtc/matrix_transform.hpp"
namespace Hypo
{
glm::mat4 Transform::CreateTransform(Vec3F position, Vec3F scale, Vec3F rotation, Vec3F origin)
{
glm::mat4 transform = glm::mat4(1);
transform = glm::translate(transform, glm::vec3{ position.x,position.y, position.z });
transform = glm::translate(transform, glm::vec3{ -origin.x,-origin.y, -origin.z });
transform = glm::scale(transform, glm::vec3{ scale.x,scale.y, scale.z });
transform = glm::rotate(transform, rotation.x, glm::vec3{ 1,0,0 });
transform = glm::rotate(transform, rotation.y, glm::vec3{ 0,1,0 });
transform = glm::rotate(transform, rotation.z, glm::vec3{ 0,0,1 });
transform = glm::translate(transform, glm::vec3{ origin.x,origin.y, origin.z });
return transform;
}
Transformable::Transformable()
: m_Position(0, 0, 0), m_Scaling(1, 1, 1),
m_Rotation(0, 0, 0), m_Origin(0, 0, 0),
m_Update(true), m_Transform()
{
}
Transformable::Transformable(Vec3F position, Vec3F scaling, Vec3F rotation, Vec3F origin)
: m_Position(position), m_Scaling(scaling),
m_Rotation(rotation), m_Origin(origin),
m_Update(true), m_Transform()
{
}
glm::mat4& Transformable::GetTransform()
{
if(m_Update)
{
m_Transform = glm::mat4(1);
m_Transform = glm::translate(m_Transform, glm::vec3{ m_Position.x,m_Position.y, m_Position.z});
m_Transform = glm::translate(m_Transform, glm::vec3{ -m_Origin.x,-m_Origin.y, -m_Origin.z });
m_Transform = glm::scale(m_Transform, glm::vec3{ m_Scaling.x,m_Scaling.y, m_Scaling.z });
m_Transform = glm::rotate(m_Transform, m_Rotation.x, glm::vec3{1,0,0});
m_Transform = glm::rotate(m_Transform, m_Rotation.y,glm::vec3{ 0,1,0 });
m_Transform = glm::rotate(m_Transform, m_Rotation.z, glm::vec3{ 0,0,1 });
m_Transform = glm::translate(m_Transform, glm::vec3{ m_Origin.x,m_Origin.y, m_Origin.z });
}
return m_Transform;
}
}
| [
"theodor.lindberg@gmail.com"
] | theodor.lindberg@gmail.com |
0d57aa285920d7261c8dd478fbf8aefb1c3ba7d6 | b750ba36f0b0709c78308eeb1f6ce2c28b7f1756 | /Styles.h | 73faf1716ca5f732a84079d998509f3817066f3d | [] | no_license | fatinbrain/reList455 | 1c39770fc32338bde6dfe7ac1003aa67d87d83f8 | ae4e2e36603b698f3cb0a75455d80cd6879bad25 | refs/heads/master | 2016-09-05T21:36:16.922518 | 2013-01-24T08:42:56 | 2013-01-24T08:42:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 910 | h | #ifndef STYLES_H_
#define STYLES_H_
#include <MAUtil/String.h>
using MAUtil::String;
const int COUNTFONTS = 3;
const int COUNTSIZES = 8;
const int COUNTCOLORS = 9;
const int COUNTSTYLES = 2;
const int SI_SZ_F1 = 0;
const int SI_SZ_F2 = 1;
const int SI_SZ_FDL = 2;
const int SI_SZ_WDL = 3;
const int SI_SZ_P = 4;
const int SI_SZ_FLM = 5;
const int SI_SZ_BCH = 6;
const int SI_SZ_ND = 7;
const int SI_FN_DL = 0;
const int SI_FN_EN = 1;
const int SI_FN_ST = 2;
const int SI_CL_FDL = 0;
const int SI_CL_BDL = 1;
const int SI_CL_BM = 2;
const int SI_CL_FN = 3;
const int SI_CL_FM = 4;
const int SI_CL_BBC = 5;
const int SI_CL_LG1 = 6;
const int SI_CL_LG2 = 7;
const int SI_CL_FT = 8;
struct Style{
String name;
char* fonts[COUNTFONTS];
int sizes[COUNTSIZES];
long colors[COUNTCOLORS];
};
struct Styles{
public:
static int getItemsCount();
static Style items[COUNTSTYLES];
};
#endif /* STYLES_H_ */
| [
"fatinbrain@tut.by"
] | fatinbrain@tut.by |
1d21cb3cfc275d7dab92c8aa12d142628dbac061 | b1b6ac9f7bc82bb5a0baa90d86b41f0be14f7a8c | /Engine/Texture/Map.h | 0a9449d579d4a35efad7c86a6bbfc20c4911183a | [] | no_license | GhineaAlex/3DCar-OpenGL | 4d88ff50504a74ea0586ae3dd8d7ca0fec4192c9 | 104f251493d87c8cdd902bcae18f56edebb02185 | refs/heads/master | 2020-03-19T17:12:24.186254 | 2019-04-18T08:57:27 | 2019-04-18T08:57:27 | 136,748,598 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 549 | h | #ifndef MAP_H_
#define MAP_H_
#include <gl/freeglut.h>
#include "../Mate/Vector3D.h"
#include "../Mate/Vector4D.h"
#include "../Mate/Object3D.h"
#include "../Car/Car.h"
#include "stdio.h"
#include "stdlib.h"
class Map
{
private:
Vector3D translation;
Vector3D rotation;
Vector3D scale;
Vector3D color;
int **levelData;
int levelSize;
GLuint level;
int lastHitX, lastHitY;
FILE* dataFile;
public:
Map();
virtual ~Map();
void readLevelData();
void buildLevel();
bool checkCollision(Car *car);
void Draw();
};
#endif /* MAP_H_ */
| [
"ghinea.alexandru.george@gmail.com"
] | ghinea.alexandru.george@gmail.com |
040f0ae16d790c5d7ea6e4f60d0b1e15bec51422 | 6be495087be519d31de9ecf6c5a5d471bb284c48 | /Arduino/Arduino_Project/Arduino_Project/Arduino_Project.ino | 811dd14f5fffecbf009223e9e11d00306d57c4e2 | [] | no_license | tnsgud9/dummy_data | 3c848994b84dbc89a34fdbf87f62bc261406408a | ab787022be12941fea68c938ff3f2c402c6e8c20 | refs/heads/master | 2022-02-25T11:23:06.887071 | 2019-08-08T17:02:56 | 2019-08-08T17:02:56 | 119,561,017 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 704 | ino | //아두이노 2족 보행로봇
// DC모터 x2, 서보모터 x1
/*
진행도
블루투스 모듈 통신을 배워야함
tx 송신 라인 rx 수신 라인
*/
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(1 , 0);
bool grap;
void setup()
{
Serial.begin(9600);
BTSerial.begin(9600);
//이동 컨트롤
pinMode(13, INPUT);
pinMode(12, INPUT);
pinMode(11, INPUT);
pinMode(10, INPUT);
//서보 잡기 놓기
pinMode(9, INPUT);
//DC모터 라인
pinMode(7, OUTPUT);
pinMode(6, OUTPUT);
//Servo 모터 라인
pinMode(5, OUTPUT);
}
void loop()
{
if (BTSerial.available())
Serial.write(BTSerial.read());
if(digitalRead(13)==true)
AnalogWrite(motorPin, speed);
} | [
"tnsgud9@naver.com"
] | tnsgud9@naver.com |
d2fa61631a9bb5c7e333bd1365037dac6b7972cf | bfd8933c9605067202e1fbe4dbd38e9be7d319eb | /Lib/Chip/Unknown/STMicro/STM32L4x6/Flash.hpp | 0541699e95589808c2435b6abc046628091c3370 | [
"Apache-2.0"
] | permissive | gitter-badger/Kvasir-1 | 91968c6c2bfae38a33e08fafb87de399e450a13c | a9ea942f54b764e27dbab9c74e5f0f97390a778e | refs/heads/master | 2020-12-24T18:23:36.275985 | 2016-02-24T22:06:57 | 2016-02-24T22:06:57 | 52,541,357 | 0 | 0 | null | 2016-02-25T16:54:18 | 2016-02-25T16:54:18 | null | UTF-8 | C++ | false | false | 14,651 | hpp | #pragma once
#include "Register/Utility.hpp"
namespace Kvasir {
//Flash
namespace Noneacr{ ///<Access control register
using Addr = Register::Address<0x40022000,0xffff80f8,0,unsigned>;
///Latency
constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,0),Register::ReadWriteAccess,unsigned> latency{};
///Prefetch enable
constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,unsigned> prften{};
///Instruction cache enable
constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,9),Register::ReadWriteAccess,unsigned> icen{};
///Data cache enable
constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,10),Register::ReadWriteAccess,unsigned> dcen{};
///Instruction cache reset
constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,11),Register::ReadWriteAccess,unsigned> icrst{};
///Data cache reset
constexpr Register::FieldLocation<Addr,Register::maskFromRange(12,12),Register::ReadWriteAccess,unsigned> dcrst{};
///Flash Power-down mode during Low-power
run mode
constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,13),Register::ReadWriteAccess,unsigned> runPd{};
///Flash Power-down mode during Low-power
sleep mode
constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,14),Register::ReadWriteAccess,unsigned> sleepPd{};
}
namespace Nonepdkeyr{ ///<Power down key register
using Addr = Register::Address<0x40022004,0x00000000,0,unsigned>;
///RUN_PD in FLASH_ACR key
constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,0),Register::ReadWriteAccess,unsigned> pdkeyr{};
}
namespace Nonekeyr{ ///<Flash key register
using Addr = Register::Address<0x40022008,0x00000000,0,unsigned>;
///KEYR
constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,0),Register::ReadWriteAccess,unsigned> keyr{};
}
namespace Noneoptkeyr{ ///<Option byte key register
using Addr = Register::Address<0x4002200c,0x00000000,0,unsigned>;
///Option byte key
constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,0),Register::ReadWriteAccess,unsigned> optkeyr{};
}
namespace Nonesr{ ///<Status register
using Addr = Register::Address<0x40022010,0xfffe3c04,0,unsigned>;
///End of operation
constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> eop{};
///Operation error
constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> operr{};
///Programming error
constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,unsigned> progerr{};
///Write protected error
constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,unsigned> wrperr{};
///Programming alignment
error
constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,unsigned> pgaerr{};
///Size error
constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,6),Register::ReadWriteAccess,unsigned> sizerr{};
///Programming sequence error
constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,7),Register::ReadWriteAccess,unsigned> pgserr{};
///Fast programming data miss
error
constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,unsigned> miserr{};
///Fast programming error
constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,9),Register::ReadWriteAccess,unsigned> fasterr{};
///PCROP read error
constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,14),Register::ReadWriteAccess,unsigned> rderr{};
///Option validity error
constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,15),Register::ReadWriteAccess,unsigned> optverr{};
///Busy
constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,16),Register::ReadWriteAccess,unsigned> bsy{};
}
namespace Nonecr{ ///<Flash control register
using Addr = Register::Address<0x40022014,0x30f87000,0,unsigned>;
///Programming
constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> pg{};
///Page erase
constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> per{};
///Bank 1 Mass erase
constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,unsigned> mer1{};
///Page number
constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,3),Register::ReadWriteAccess,unsigned> pnb{};
///Bank erase
constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,11),Register::ReadWriteAccess,unsigned> bker{};
///Bank 2 Mass erase
constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,15),Register::ReadWriteAccess,unsigned> mer2{};
///Start
constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,16),Register::ReadWriteAccess,unsigned> start{};
///Options modification start
constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,17),Register::ReadWriteAccess,unsigned> optstrt{};
///Fast programming
constexpr Register::FieldLocation<Addr,Register::maskFromRange(18,18),Register::ReadWriteAccess,unsigned> fstpg{};
///End of operation interrupt
enable
constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,unsigned> eopie{};
///Error interrupt enable
constexpr Register::FieldLocation<Addr,Register::maskFromRange(25,25),Register::ReadWriteAccess,unsigned> errie{};
///PCROP read error interrupt
enable
constexpr Register::FieldLocation<Addr,Register::maskFromRange(26,26),Register::ReadWriteAccess,unsigned> rderrie{};
///Force the option byte
loading
constexpr Register::FieldLocation<Addr,Register::maskFromRange(27,27),Register::ReadWriteAccess,unsigned> oblLaunch{};
///Options Lock
constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,30),Register::ReadWriteAccess,unsigned> optlock{};
///FLASH_CR Lock
constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::ReadWriteAccess,unsigned> lock{};
}
namespace Noneeccr{ ///<Flash ECC register
using Addr = Register::Address<0x40022018,0x3ee00000,0,unsigned>;
///ECC fail address
constexpr Register::FieldLocation<Addr,Register::maskFromRange(18,0),Register::ReadWriteAccess,unsigned> addrEcc{};
///ECC fail bank
constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,19),Register::ReadWriteAccess,unsigned> bkEcc{};
///System Flash ECC fail
constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,unsigned> sysfEcc{};
///ECC correction interrupt
enable
constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,unsigned> eccie{};
///ECC correction
constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,30),Register::ReadWriteAccess,unsigned> eccc{};
///ECC detection
constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::ReadWriteAccess,unsigned> eccd{};
}
namespace Noneoptr{ ///<Flash option register
using Addr = Register::Address<0x40022020,0xfc40c800,0,unsigned>;
///Read protection level
constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::ReadWriteAccess,unsigned> rdp{};
///BOR reset Level
constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,8),Register::ReadWriteAccess,unsigned> borLev{};
///nRST_STOP
constexpr Register::FieldLocation<Addr,Register::maskFromRange(12,12),Register::ReadWriteAccess,unsigned> nrstStop{};
///nRST_STDBY
constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,13),Register::ReadWriteAccess,unsigned> nrstStdby{};
///Independent watchdog
selection
constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,16),Register::ReadWriteAccess,unsigned> idwgSw{};
///Independent watchdog counter freeze in
Stop mode
constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,17),Register::ReadWriteAccess,unsigned> iwdgStop{};
///Independent watchdog counter freeze in
Standby mode
constexpr Register::FieldLocation<Addr,Register::maskFromRange(18,18),Register::ReadWriteAccess,unsigned> iwdgStdby{};
///Window watchdog selection
constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,19),Register::ReadWriteAccess,unsigned> wwdgSw{};
///Dual-bank boot
constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,unsigned> bfb2{};
///Dual-Bank on 512 KB or 256 KB Flash
memory devices
constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,21),Register::ReadWriteAccess,unsigned> dualbank{};
///Boot configuration
constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,23),Register::ReadWriteAccess,unsigned> nboot1{};
///SRAM2 parity check enable
constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,unsigned> sram2Pe{};
///SRAM2 Erase when system
reset
constexpr Register::FieldLocation<Addr,Register::maskFromRange(25,25),Register::ReadWriteAccess,unsigned> sram2Rst{};
}
namespace Nonepcrop1sr{ ///<Flash Bank 1 PCROP Start address
register
using Addr = Register::Address<0x40022024,0xffff0000,0,unsigned>;
///Bank 1 PCROP area start
offset
constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> pcrop1Strt{};
}
namespace Nonepcrop1er{ ///<Flash Bank 1 PCROP End address
register
using Addr = Register::Address<0x40022028,0x7fff0000,0,unsigned>;
///Bank 1 PCROP area end
offset
constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> pcrop1End{};
///PCROP area preserved when RDP level
decreased
constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::ReadWriteAccess,unsigned> pcropRdp{};
}
namespace Nonewrp1ar{ ///<Flash Bank 1 WRP area A address
register
using Addr = Register::Address<0x4002202c,0xff00ff00,0,unsigned>;
///Bank 1 WRP first area
“Aâ€
start offset
constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::ReadWriteAccess,unsigned> wrp1aStrt{};
///Bank 1 WRP first area A end
offset
constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,16),Register::ReadWriteAccess,unsigned> wrp1aEnd{};
}
namespace Nonewrp1br{ ///<Flash Bank 1 WRP area B address
register
using Addr = Register::Address<0x40022030,0xff00ff00,0,unsigned>;
///Bank 1 WRP second area B end
offset
constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,16),Register::ReadWriteAccess,unsigned> wrp1bStrt{};
///Bank 1 WRP second area B start
offset
constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::ReadWriteAccess,unsigned> wrp1bEnd{};
}
namespace Nonepcrop2sr{ ///<Flash Bank 2 PCROP Start address
register
using Addr = Register::Address<0x40022044,0xffff0000,0,unsigned>;
///Bank 2 PCROP area start
offset
constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> pcrop2Strt{};
}
namespace Nonepcrop2er{ ///<Flash Bank 2 PCROP End address
register
using Addr = Register::Address<0x40022048,0xffff0000,0,unsigned>;
///Bank 2 PCROP area end
offset
constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,0),Register::ReadWriteAccess,unsigned> pcrop2End{};
}
namespace Nonewrp2ar{ ///<Flash Bank 2 WRP area A address
register
using Addr = Register::Address<0x4002204c,0xff00ff00,0,unsigned>;
///Bank 2 WRP first area A start
offset
constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::ReadWriteAccess,unsigned> wrp2aStrt{};
///Bank 2 WRP first area A end
offset
constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,16),Register::ReadWriteAccess,unsigned> wrp2aEnd{};
}
namespace Nonewrp2br{ ///<Flash Bank 2 WRP area B address
register
using Addr = Register::Address<0x40022050,0xff00ff00,0,unsigned>;
///Bank 2 WRP second area B start
offset
constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::ReadWriteAccess,unsigned> wrp2bStrt{};
///Bank 2 WRP second area B end
offset
constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,16),Register::ReadWriteAccess,unsigned> wrp2bEnd{};
}
}
| [
"holmes.odin@gmail.com"
] | holmes.odin@gmail.com |
53a3bb4fb104275eaaac1ece47d2fb2e22c464e0 | 09307f533f11dff0bfe706eeeaeeb9b0828197ab | /source/teldata/root/src/TelEventTTreeReader.cpp | eaf9f76f632909f1f1b38df068d5b9b38af3d3a3 | [] | no_license | eyiliu/altel_acts | 523f427ac937e71a66029ed86264a695bdec2484 | 360f41030c92f0492b270b54222277004f0a9af1 | refs/heads/master | 2023-06-25T01:12:33.646296 | 2021-07-22T17:40:04 | 2021-07-22T17:40:04 | 280,247,910 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 10,208 | cpp | #include "TelEventTTreeReader.hpp"
#include <TFile.h>
#include <TTree.h>
#include <iostream>
void altel::TelEventTTreeReader::setTTree(TTree *pTTree){
if(!pTTree){
std::fprintf(stderr, "TTree is not yet set\n");
throw;
}
m_pTTree = pTTree;
TTree &tree = *m_pTTree;
m_numEvents = tree.GetEntries();
tree.ResetBranchAddresses();
tree.SetBranchAddress("RunN", &rRunN);
tree.SetBranchAddress("EveN", &rEventN);
tree.SetBranchAddress("DetN", &rConfigN);
tree.SetBranchAddress("ClkN", (ULong64_t*)&rClock);
tree.SetBranchAddress("NumTrajs_PerEvent", &rNumTraj_PerEvent);
tree.SetBranchAddress("NumMeasHits_PerEvent", &rNumMeasHits_PerEvent);
tree.SetBranchAddress("MeasRawVec_DetN", &pRawMeasVec_DetN);
tree.SetBranchAddress("MeasRawVec_U", &pRawMeasVec_U);
tree.SetBranchAddress("MeasRawVec_V", &pRawMeasVec_V);
tree.SetBranchAddress("MeasRawVec_Clk", &pRawMeasVec_Clk);
tree.SetBranchAddress("MeasHitVec_DetN", &pHitMeasVec_DetN);
tree.SetBranchAddress("MeasHitVec_U", &pHitMeasVec_U);
tree.SetBranchAddress("MeasHitVec_V", &pHitMeasVec_V);
tree.SetBranchAddress("MeasHitVec_NumMeasRaws_PerMeasHit", &pHitMeasVec_NumRawMeas_PerHitMeas);
tree.SetBranchAddress("MeasHitVec_MeasRaw_Index", &pHitMeasVec_Index_To_RawMeas);
tree.SetBranchAddress("TrajHitVec_DetN", &pHitFitVec_DetN);
tree.SetBranchAddress("TrajHitVec_U", &pHitFitVec_U);
tree.SetBranchAddress("TrajHitVec_V", &pHitFitVec_V);
tree.SetBranchAddress("TrajHitVec_X", &pHitFitVec_X);
tree.SetBranchAddress("TrajHitVec_Y", &pHitFitVec_Y);
tree.SetBranchAddress("TrajHitVec_Z", &pHitFitVec_Z);
tree.SetBranchAddress("TrajHitVec_DirX", &pHitFitVec_DirX);
tree.SetBranchAddress("TrajHitVec_DirY", &pHitFitVec_DirY);
tree.SetBranchAddress("TrajHitVec_DirZ", &pHitFitVec_DirZ);
tree.SetBranchAddress("TrajHitVec_OriginMeasHit_Index", &pHitFitVec_Index_To_Origin_HitMeas);
tree.SetBranchAddress("TrajHitVec_MatchedMeasHit_Index", &pHitFitVec_Index_To_Matched_HitMeas);
tree.SetBranchAddress("TrajVec_NumTrajHits_PerTraj", &pTrajVec_NumHitFit_PerTraj);
tree.SetBranchAddress("TrajVec_NumOriginMeasHits_PerTraj", &pTrajVec_NumHitMeas_Origin_PerTraj);
tree.SetBranchAddress("TrajVec_NumMatchedMeasHits_PerTraj", &pTrajVec_NumHitMeas_Matched_PerTraj);
tree.SetBranchAddress("TrajVec_TrajHit_Index", &pTrajVec_Index_To_HitFit);
// ana
tree.SetBranchAddress("AnaVec_Matched_DetN", &pAnaVec_Matched_DetN);
tree.SetBranchAddress("AnaVec_Matched_ResidU", &pAnaVec_Matched_ResdU);
tree.SetBranchAddress("AnaVec_Matched_ResidV", &pAnaVec_Matched_ResdV);
}
size_t altel::TelEventTTreeReader::numEvents() const{
return m_numEvents;
}
std::shared_ptr<altel::TelEvent> altel::TelEventTTreeReader::createTelEvent(size_t n){
if(n>=m_numEvents){
std::fprintf(stderr, "no more entries in ttree\n");
return nullptr;
}
m_pTTree->GetEntry(n);
// std::printf("GetEntry %d\n", n);
// std::printf("rRunN %d, rEventN %d, rConfigN %d, rClock %d\n", rRunN, rEventN, rConfigN, rClock);
// std::printf("measHit IDsize %d Usize %d Vsize %d\n", rHitMeasVec_DetN.size(), rHitMeasVec_U.size(), rHitMeasVec_V.size());
// std::printf("fitHit IDsize %d Usize %d Vsize %d Xsize %d Ysize %d Zsize %d DXsize %d DYsize %d DZsize %d\n",
// rHitFitVec_DetN.size(), rHitFitVec_U.size(), rHitFitVec_V.size(),
// rHitFitVec_X.size(), rHitFitVec_Y.size(), rHitFitVec_Z.size(),
// rHitFitVec_DirX.size(), rHitFitVec_DirY.size(), rHitFitVec_DirZ.size());
std::shared_ptr<altel::TelEvent> telEvent(new altel::TelEvent(rRunN, rEventN, rConfigN, rClock));
auto it_rawMeasVec_DetN = rRawMeasVec_DetN.begin();
auto it_rawMeasVec_U = rRawMeasVec_U.begin();
auto it_rawMeasVec_V = rRawMeasVec_V.begin();
auto it_rawMeasVec_Clk = rRawMeasVec_Clk.begin();
auto it_rawMeasVec_DetN_end = rRawMeasVec_DetN.end();
std::vector<altel::TelMeasRaw> measRaws;
measRaws.reserve(rRawMeasVec_DetN.size());
while(it_rawMeasVec_DetN !=it_rawMeasVec_DetN_end){
measRaws.emplace_back(*it_rawMeasVec_U, *it_rawMeasVec_V, *it_rawMeasVec_DetN, *it_rawMeasVec_Clk);
it_rawMeasVec_DetN++;
it_rawMeasVec_U++;
it_rawMeasVec_V++;
it_rawMeasVec_Clk++;
}
// make index cluster
auto it_numRawMeas_PerHitMeas = rHitMeasVec_NumRawMeas_PerHitMeas.begin();
auto it_rawMeas_index = rHitMeasVec_Index_To_RawMeas.begin();
auto it_numRawMeas_PerHitMeas_end = rHitMeasVec_NumRawMeas_PerHitMeas.end();
auto it_rawMeas_index_end = rHitMeasVec_Index_To_RawMeas.end();
std::vector<std::vector<altel::TelMeasRaw>> clusterCol;
clusterCol.reserve(rHitMeasVec_DetN.size());
while(it_numRawMeas_PerHitMeas != it_numRawMeas_PerHitMeas_end){
std::vector<altel::TelMeasRaw> cluster;
cluster.reserve(*it_numRawMeas_PerHitMeas);
size_t numRawMeas_got = 0;
while(it_rawMeas_index!=it_rawMeas_index_end && numRawMeas_got < *it_numRawMeas_PerHitMeas){
int16_t rawMeasIndex = *it_rawMeas_index;
if(rawMeasIndex!=int16_t(-1)){
auto aMeasRaw = measRaws[rawMeasIndex];
cluster.push_back(aMeasRaw);
numRawMeas_got++;
}
it_rawMeas_index++;
}
clusterCol.push_back(std::move(cluster));
it_numRawMeas_PerHitMeas++;
}
// std::cout<< "create cluster number "<< clusterCol.size()<<std::endl;
auto it_clusterCol = clusterCol.begin();
size_t numMeasHit = rHitMeasVec_DetN.size();
assert(rHitMeasVec_U.size() == numMeasHit && rHitMeasVec_V.size() == numMeasHit);
auto it_measHitVec_detN = rHitMeasVec_DetN.begin();
auto it_measHitVec_U = rHitMeasVec_U.begin();
auto it_measHitVec_V = rHitMeasVec_V.begin();
auto it_measHitVec_detN_end = rHitMeasVec_DetN.end();
std::vector<std::shared_ptr<altel::TelMeasHit>> measHits;
measHits.reserve(rHitMeasVec_DetN.size());
while(it_measHitVec_detN !=it_measHitVec_detN_end){
measHits.emplace_back(new altel::TelMeasHit(*it_measHitVec_detN,
*it_measHitVec_U,
*it_measHitVec_V,
*it_clusterCol));
// HitMeasVec_NumRawMeas_PerHitMeas;
it_measHitVec_detN++;
it_measHitVec_U++;
it_measHitVec_V++;
it_clusterCol++;
}
// std::cout<< "create measHits "<< measHits.size()<<std::endl;
std::vector<std::shared_ptr<altel::TelTrajHit>> trajHits;
size_t numFitHit = rHitFitVec_DetN.size();
trajHits.reserve(numFitHit);
auto it_fitHitVec_detN = rHitFitVec_DetN.begin();
auto it_fitHitVec_U = rHitFitVec_U.begin();
auto it_fitHitVec_V = rHitFitVec_V.begin();
auto it_fitHitVec_X = rHitFitVec_X.begin();
auto it_fitHitVec_Y = rHitFitVec_Y.begin();
auto it_fitHitVec_Z = rHitFitVec_Z.begin();
auto it_fitHitVec_DX = rHitFitVec_DirX.begin();
auto it_fitHitVec_DY = rHitFitVec_DirY.begin();
auto it_fitHitVec_DZ = rHitFitVec_DirZ.begin();
auto it_fitHitVec_OriginMeasHit_index = rHitFitVec_Index_To_Origin_HitMeas.begin();
auto it_fitHitVec_MatchedMeasHit_index = rHitFitVec_Index_To_Matched_HitMeas.begin();
auto it_fitHitVec_detN_end = rHitFitVec_DetN.end();
// std::cout<<"loop fitHit"<<std::endl;
while(it_fitHitVec_detN !=it_fitHitVec_detN_end){
// std::cout<<"fitHitVec_detN "<< *it_fitHitVec_detN <<std::endl;
int16_t originMeasHitIndex = *it_fitHitVec_OriginMeasHit_index;
std::shared_ptr<altel::TelMeasHit> originMeasHit;
// std::cout<< "originMeasHitIndex"<< originMeasHitIndex<<std::endl;
if(originMeasHitIndex!=int16_t(-1)){
assert( originMeasHitIndex<measHits.size() );
originMeasHit = measHits[originMeasHitIndex];
}
auto fitHit = std::make_shared<altel::TelFitHit>(*it_fitHitVec_detN,
*it_fitHitVec_U,
*it_fitHitVec_V,
*it_fitHitVec_X,
*it_fitHitVec_Y,
*it_fitHitVec_Z,
*it_fitHitVec_DX,
*it_fitHitVec_DY,
*it_fitHitVec_DZ,
originMeasHit);
int16_t matchedMeasHitIndex = *it_fitHitVec_MatchedMeasHit_index;
std::shared_ptr<altel::TelMeasHit> matchedMeasHit;
// std::cout<< "matchedMeasHitIndex"<< matchedMeasHitIndex<<std::endl;
if(matchedMeasHitIndex!= int16_t(-1)){
assert( matchedMeasHitIndex<measHits.size() );
matchedMeasHit = measHits[matchedMeasHitIndex];
}
trajHits.emplace_back(new altel::TelTrajHit(*it_fitHitVec_detN,
fitHit,
matchedMeasHit));
it_fitHitVec_detN ++;
it_fitHitVec_U ++;
it_fitHitVec_V ++;
it_fitHitVec_X ++;
it_fitHitVec_Y ++;
it_fitHitVec_Z ++;
it_fitHitVec_DX ++;
it_fitHitVec_DY ++;
it_fitHitVec_DZ ++;
it_fitHitVec_OriginMeasHit_index++;
it_fitHitVec_MatchedMeasHit_index++;
}
std::vector<std::shared_ptr<altel::TelTrajectory>> trajs;
auto it_numFitHit_PerTraj = rTrajVec_NumHitFit_PerTraj.begin();
auto it_numFitHit_PerTraj_end = rTrajVec_NumHitFit_PerTraj.end();
auto it_fitHit_index = rTrajVec_Index_To_HitFit.begin();
auto it_fitHit_index_end = rTrajVec_Index_To_HitFit.end();
// std::cout<<"loop traj"<<std::endl;
while(it_numFitHit_PerTraj != it_numFitHit_PerTraj_end){
auto traj = std::make_shared<altel::TelTrajectory>();
size_t numFitHits_got = 0;
while(it_fitHit_index!=it_fitHit_index_end && numFitHits_got < *it_numFitHit_PerTraj){
int16_t fitHitIndex = *it_fitHit_index;
if(fitHitIndex!=int16_t(-1)){
auto trajHit = trajHits[fitHitIndex];
traj->trajHits().push_back(trajHit);
numFitHits_got++;
}
it_fitHit_index++;
}
trajs.push_back(traj);
it_numFitHit_PerTraj++;
}
telEvent->measHits() = std::move(measHits);
telEvent->trajs() = std::move(trajs);
return telEvent;
}
| [
"yi.liu@desy.de"
] | yi.liu@desy.de |
bfa2e05076c9308f37e36d74dd9427805e20452f | dce7b1cce3dc2800bd4b378d4d4a40e75116ca09 | /eva3test/gamemodel.cpp | 1b83146aef52a56c06fe9d9676000423fe17ce19 | [] | no_license | matyi2121/eva | deb6262ca1ba8483c4e3efec03351129563c1c88 | e98fe841efd5484528cadbaac964bb42dec30fd8 | refs/heads/master | 2021-01-20T09:21:26.990005 | 2017-05-09T10:27:08 | 2017-05-09T10:27:08 | 83,920,305 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,960 | cpp | #include "gamemodel.h"
GameModel::GameModel(ResourceManager* RM,int N,QObject *parent)
: QObject(parent),
count_same_turns(0),
n(N),
rm(RM)
{
curr_turn = Field::Blue;
blue_collector = 0;
red_collector = 0;
blue_fields.resize(n);
red_fields.resize(n);
for(int i = 0; i < n; ++i)
{
blue_fields[i] = 6;
red_fields[i] = 6;
}
will_come_again = false;
}
GameModel::~GameModel()
{
delete rm;
}
int GameModel::get_collector(Field f)const
{
if(f == Field::Blue)
return blue_collector;
else
return red_collector;
}
int GameModel::get_field(Field f, int col)const
{
if(f == Field::Blue)
return blue_fields[col-1];
else
return red_fields[col-1];
}
int GameModel::get_size()const
{
return n;
}
void GameModel::empty(int row, int col)
{
int adj_col = col-1;
int* curr = row == 0 ? &blue_fields[adj_col] : &red_fields[adj_col];
int* start = curr;
int stones = *curr;
*curr = 0;
while(stones > 0)
{
curr = next_bowl(curr);
if(curr != start)
{
*curr = *curr + 1;
--stones;
}
}
int pos = -1;
if((pos = in(curr_turn,curr)) != -1 && *curr == 1)
{
if(curr_turn == Field::Blue)
{
blue_collector += *curr + red_fields[pos];
*curr = 0;
red_fields[pos] = 0;
}
else
{
red_collector += *curr + blue_fields[pos];
*curr = 0;
blue_fields[pos] = 0;
}
}
else
{
if((curr_turn == Field::Blue && curr == &blue_collector) ||
(curr_turn == Field::Red && curr == &red_collector))
{
will_come_again = true;
}
}
++count_same_turns;
emit refresh_window();
game_over_check();
set_next_player();
}
bool GameModel::is_empty(int row, int col)
{
if(row == 0)
return blue_fields[col-1] == 0;
else
return red_fields[col-1] == 0;
}
bool GameModel::players_turn(Field f)
{
return f == curr_turn;
}
void GameModel::set_next_player()
{
if(will_come_again && count_same_turns < 2)
{
will_come_again = false;
}
else
{
curr_turn = curr_turn == Field::Blue ? Field::Red : Field::Blue;
count_same_turns = 0;
will_come_again = false;
}
}
int* GameModel::next_bowl(int* curr)
{
int* ret = NULL;
if(curr == &blue_collector)
{
ret = &blue_fields[0];
}
else if(curr == &red_collector)
{
ret = &red_fields[n-1];
}
else
{
int pos;
if((pos = in(Field::Blue, curr)) != -1)
{
if(curr == &blue_fields[n-1])
{
ret = &red_collector;
}
else
{
ret = &blue_fields[pos+1];
}
}
else if((pos = in(Field::Red, curr)) != -1)
{
if(curr == &red_fields[0])
{
ret = &blue_collector;
}
else
{
ret = &red_fields[pos-1];
}
}
}
return ret;
}
int GameModel::in(Field f,int* curr)
{
int ret = -1;
QVector<int>* to_check;
if(f == Field::Blue)
{
to_check = &blue_fields;
}
else
{
to_check = &red_fields;
}
int i = 0;
while(i < n && ret == -1)
{
const int* check = &to_check->at(i);
if(curr == check)
{
ret = i;
}
++i;
}
return ret;
}
void GameModel::game_over_check()
{
int blues = 0;
int reds = 0;
for(int i = 0; i < n; ++i)
{
blues += blue_fields[i];
reds += red_fields[i];
}
if(blues == 0 || reds == 0)
{
int to_emit = 0;
if(blue_collector > red_collector)
{
to_emit = 1;
}
else if(red_collector > blue_collector)
{
to_emit = 2;
}
emit winner(to_emit);
}
}
bool GameModel::load_game()
{
int in_size = 0;
bool ret = false;
if(rm->load_game(in_size,
curr_turn,
count_same_turns,
blue_collector,
blue_fields,
red_collector,
red_fields))
{
if(in_size != n)
{
emit size_changed(in_size);
n=in_size;
}
emit refresh_window();
ret = true;
}
return ret;
}
bool GameModel::save_game()
{
bool ret = false;
int turn = curr_turn == Field::Blue ? 1 : 2;
if(rm->save_game(n,
turn,
count_same_turns,
blue_collector,
blue_fields,
red_collector,
red_fields))
{
ret = true;
}
return ret;
}
| [
"matyi2121@gmail.com"
] | matyi2121@gmail.com |
3d55f136d1228788bc6b56931507c7660b6ba4d0 | 41cf8ac679a58e947a62e47cbf5ac2de77c51ebf | /DataPoint.cpp | 881400f55147c9fea9b1ca3c1ab573ae9b623456 | [] | no_license | Yukina1996/DBSCAN_3D | 8e305a0d2b91442ba6bfa23bc4aec96e7629dd55 | d12ba3e4e42d3e9e7f73e347d8ae3223b98ef81a | refs/heads/master | 2021-05-17T01:04:36.760398 | 2020-03-27T14:03:36 | 2020-03-27T14:03:36 | 250,548,630 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,334 | cpp | #include "DataPoint.h"
//默认构造函数
DataPoint::DataPoint()
{
}
//构造函数
DataPoint::DataPoint(unsigned long dpID, double* dimension, bool isKey) :isKey(isKey), dpID(dpID)
{
//传递每维的维度数据
for (int i = 0; i < DIME_NUM; i++)
{
this->dimension[i] = dimension[i];
}
}
//设置维度数据
void DataPoint::SetDimension(double* dimension)
{
for (int i = 0; i < DIME_NUM; i++)
{
this->dimension[i] = dimension[i];
}
}
//获取维度数据
double* DataPoint::GetDimension()
{
return this->dimension;
}
//获取是否为核心对象
bool DataPoint::IsKey()
{
return this->isKey;
}
//设置核心对象标志
void DataPoint::SetKey(bool isKey)
{
this->isKey = isKey;
}
//获取DpId方法
unsigned long DataPoint::GetDpId()
{
return this->dpID;
}
//设置DpId方法
void DataPoint::SetDpId(unsigned long dpID)
{
this->dpID = dpID;
}
//GetIsVisited方法
bool DataPoint::isVisited()
{
return this->visited;
}
//SetIsVisited方法
void DataPoint::SetVisited(bool visited)
{
this->visited = visited;
}
//GetClusterId方法
long DataPoint::GetClusterId()
{
return this->clusterId;
}
//GetClusterId方法
void DataPoint::SetClusterId(long clusterId)
{
this->clusterId = clusterId;
}
//GetArrivalPoints方法
vector<unsigned long>& DataPoint::GetArrivalPoints()
{
return arrivalPoints;
}
| [
"littlecat1129@sina.com"
] | littlecat1129@sina.com |
9e002ee70c1c22bb02af0e89c860fef2167b9cb0 | 327b9274cff7a79f80aa3ef09a6069f6ef3c44ca | /strategy_pattern/strategy_pattern_skill.cpp | 8527ef9d6042ec3ef7d542c5631dab9ece9b0b67 | [] | no_license | jilimanbu/Design-Pattern | e436466e73404fcbe90b0cc50df9e2fab634cd73 | 7c6baad9e3325436b4c9b930182d0ff6620c8dfe | refs/heads/master | 2023-06-27T17:14:45.310295 | 2021-07-30T08:32:14 | 2021-07-30T08:32:14 | 367,362,450 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 975 | cpp | #include <iostream>
#include "strategy_pattern_skill.h"
#include "strategy_pattern_hero.h"
using namespace std;
Skill::~Skill()
{
}
Colliding::~Colliding()
{
}
Waterball::~Waterball()
{
}
int Colliding::attack(Hero *attackHero, Hero *targetHero)
{
int damage = attackHero->getStrength() - targetHero->getDefense();
std::cout << attackHero->getName() << " use " << this->skillName << ", " << targetHero->getName() << " hp-" << damage << " !!" << std::endl;
return damage;
}
int Waterball::attack(Hero *attackHero, Hero *targetHero)
{
int damage=0;
if (attackHero->getMp() >= 5)
{
damage = attackHero->getWisdom() * 2;
attackHero->subMp(5);
std::cout << attackHero->getName() << " use " << this->skillName << ", " << targetHero->getName() << " hp-" << damage << " !!" << std::endl;
return damage;
}
else
{
cout << attackHero->getName() << " is short of mp!!" << endl;
}
return damage;
}
| [
"1434521355@qq.com"
] | 1434521355@qq.com |
1844ed461baff063854666d25454c9f9f6964cab | 1a754f8cbc44f0730491b3aa846bd1c0e4274409 | /CEGUISample9/CEGUISample9.cpp | 2bf07a61cc497c6cb36dfcb20e688873825b66da | [] | no_license | harr999y/OgreFramework | fe63d4be6a9e86dac4c790e5e391031ad5162477 | 784e00ce55b39520ad761132409a6664d142fa5a | refs/heads/master | 2016-09-05T13:07:09.199479 | 2012-05-09T21:26:19 | 2012-05-09T21:26:19 | 4,277,026 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,560 | cpp | #include "CEGUISample9.h"
#include <cstdlib>
const float MyEffect::tess_x = 8.0f;
const float MyEffect::tess_y = 8.0f;
MyEffect::MyEffect() : initialised(false),dragX(0.f),dragY(0.f),elasX(0.f),elasY(0.f),lastX(0.0f),lastY(0.0f)
{}
int MyEffect::getPassCount() const
{
return 1;
}
void MyEffect::performPreRenderFunctions(const int )//pass)
{}
void MyEffect::performPostRenderFunctions()
{}
bool MyEffect::realiseGeometry(CEGUI::RenderingWindow &window, CEGUI::GeometryBuffer &geometry)
{
using namespace CEGUI;
Texture& tex = window.getTextureTarget().getTexture();
static const CEGUI::colour c(1.0f,1.0f,1.0f,1.0f);
const float qw = window.getSize().d_width / tess_x;
const float qh = window.getSize().d_height / tess_y;
const float tcx = qw * tex.getTexelScaling().d_x;
const float tcy = (window.getTextureTarget().isRenderingInverted() ? -qh : qh) * tex.getTexelScaling().d_y;
for(int j = 0;j<tess_y;++j)
{
for(int i= 0;i<tess_x;++i)
{
int idx = (j*tess_x+i)*6;
float top_adj = dragX * ((1.0f / tess_x) * j);
float bot_adj = dragX * ((1.0f / tess_x) * (j+1));
top_adj = ((top_adj*top_adj) / 3) * (dragX < 0 ? -1 : 1);
bot_adj = ((bot_adj*bot_adj) / 3) * (dragX < 0 ? -1 : 1);
float lef_adj = dragY * ((1.0f / tess_y) * i);
float rig_adj = dragY * ((1.0f / tess_y) * (i+1));
lef_adj = ((lef_adj*lef_adj) / 3) * (dragY < 0 ? -1 : 1);
rig_adj = ((rig_adj*rig_adj) / 3) * (dragY < 0 ? -1 : 1);
// vertex 0
vb[idx + 0].position = Vector3(i * qw - top_adj, j * qh - lef_adj, 0.0f);
vb[idx + 0].colour_val = c;
vb[idx + 0].tex_coords = Vector2(i * tcx, j*tcy);
// vertex 1
vb[idx + 1].position = Vector3(i * qw - bot_adj, j * qh + qh - lef_adj, 0.0f);
vb[idx + 1].colour_val = c;
vb[idx + 1].tex_coords = Vector2(i*tcx, j*tcy+tcy);
// vertex 2
vb[idx + 2].position = Vector3(i * qw + qw - bot_adj, j * qh + qh - rig_adj, 0.0f);
vb[idx + 2].colour_val = c;
vb[idx + 2].tex_coords = Vector2(i*tcx+tcx, j*tcy+tcy);
// vertex 3
vb[idx + 3].position = Vector3(i * qw + qw - bot_adj, j * qh + qh - rig_adj, 0.0f);
vb[idx + 3].colour_val = c;
vb[idx + 3].tex_coords = Vector2(i*tcx+tcx, j*tcy+tcy);
// vertex 4
vb[idx + 4].position = Vector3(i * qw + qw - top_adj, j * qh - rig_adj, 0.0f);
vb[idx + 4].colour_val = c;
vb[idx + 4].tex_coords = Vector2(i*tcx+tcx, j*tcy);
// vertex 5
vb[idx + 5].position = Vector3(i * qw - top_adj, j * qh - lef_adj, 0.0f);
vb[idx + 5].colour_val = c;
vb[idx + 5].tex_coords = Vector2(i * tcx, j*tcy);
}
}
geometry.setActiveTexture(&tex);
geometry.appendGeometry(vb,buffsize);
return false;
}
bool MyEffect::update(const float elapsed, CEGUI::RenderingWindow &window)
{
using namespace CEGUI;
if(!initialised)
{
initialised = true;
lastX = window.getPosition().d_x;
lastY = window.getPosition().d_y;
return true;
}
const Vector2 pos(window.getPosition());
if(pos.d_x != lastX)
{
dragX += (pos.d_x - lastX) * 0.2;
elasX = 0.05f;
lastX = pos.d_x;
if(dragX > 30)
dragX = 30;
else if(dragX < -30)
dragX = -30;
}
if(pos.d_y != lastY)
{
dragY += (pos.d_y - lastY) * 0.2f;
elasY = 0.05f;
lastY = pos.d_y;
if (dragY > 30)
dragY = 30;
else if (dragY < -30)
dragY = -30;
}
if((dragX != 0) || (dragY != 0))
{
if(dragX < 0)
{
dragX += (elasX * 800 * elapsed);
elasX +=0.075 * elapsed;
if(dragX > 0)
dragX = 0;
}
else
{
dragX -= (elasX * 800 * elapsed);
elasX += 0.075 * elapsed;
if (dragX < 0)
dragX = 0;
}
if (dragY < 0)
{
dragY += elasY * 800 * elapsed;
elasY += 0.075 * elapsed;
if (dragY >0)
dragY = 0;
}
else
{
dragY -= elasY * 800 * elapsed;
elasY += 0.075 * elapsed;
if (dragY < 0)
dragY = 0;
}
System::getSingleton().signalRedraw();
return false;
}
return true;
}
void CEGUISample9App::createGUI()
{
using namespace CEGUI;
RenderEffectManager::getSingleton().addEffect <MyEffect> ("WobblyWindow");
WindowFactoryManager::getSingleton().addFalagardWindowMapping("TaharezLook/WobblyFrameWindow","CEGUI/FrameWindow","TaharezLook/FrameWindow","Falagard/FrameWindow","WobblyWindow");
WindowManager& winMgr = WindowManager::getSingleton();
SchemeManager::getSingleton().create("TaharezLook.scheme");
System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");
FontManager::getSingleton().create("DejaVuSans-10.font");
// load an image to use as a background
ImagesetManager::getSingleton().createFromImageFile("BackgroundImage", "GPN-2000-001437.tga");
// here we will use a StaticImage as the root, then we can use it to place a background image
Window* background = winMgr.createWindow("TaharezLook/StaticImage", "background_wnd");
// set position and size
background->setPosition(UVector2(cegui_reldim(0), cegui_reldim( 0)));
background->setSize(UVector2(cegui_reldim(1), cegui_reldim( 1)));
// disable frame and standard background
background->setProperty("FrameEnabled", "false");
background->setProperty("BackgroundEnabled", "false");
// set the background image
background->setProperty("Image", "set:BackgroundImage image:full_image");
// install this as the root GUI sheet
System::getSingleton().setGUISheet(background);
// load the windows for Demo7 from the layout file.
Window* sheet = winMgr.loadWindowLayout("Demo7Windows.layout");
// attach this to the 'real' root
background->addChildWindow(sheet);
createListContent();
initDemoEventWiring();
}
void CEGUISample9App::createListContent()
{
using namespace CEGUI;
WindowManager& winMgr = WindowManager::getSingleton();
Combobox * cbobox = static_cast<Combobox*>(winMgr.getWindow("Demo7/Window2/Combobox"));
// add items to the combobox list
cbobox->addItem(new MyListItem("Combobox Item 1"));
cbobox->addItem(new MyListItem("Combobox Item 2"));
cbobox->addItem(new MyListItem("Combobox Item 3"));
cbobox->addItem(new MyListItem("Combobox Item 4"));
cbobox->addItem(new MyListItem("Combobox Item 5"));
cbobox->addItem(new MyListItem("Combobox Item 6"));
cbobox->addItem(new MyListItem("Combobox Item 7"));
cbobox->addItem(new MyListItem("Combobox Item 8"));
cbobox->addItem(new MyListItem("Combobox Item 9"));
cbobox->addItem(new MyListItem("Combobox Item 10"));
//
// Multi-Column List setup
//
MultiColumnList* mclbox = static_cast<MultiColumnList*>(winMgr.getWindow("Demo7/Window2/MultiColumnList"));
// Add some empty rows to the MCL
mclbox->addRow();
mclbox->addRow();
mclbox->addRow();
mclbox->addRow();
mclbox->addRow();
// Set first row item texts for the MCL
mclbox->setItem(new MyListItem("Laggers World"), 0, 0);
mclbox->setItem(new MyListItem("yourgame.some-server.com"), 1, 0);
mclbox->setItem(new MyListItem("[colour='FFFF0000']1000ms"), 2, 0);
// Set second row item texts for the MCL
mclbox->setItem(new MyListItem("Super-Server"), 0, 1);
mclbox->setItem(new MyListItem("whizzy.fakenames.net"), 1, 1);
mclbox->setItem(new MyListItem("[colour='FF00FF00']8ms"), 2, 1);
// Set third row item texts for the MCL
mclbox->setItem(new MyListItem("Cray-Z-Eds"), 0, 2);
mclbox->setItem(new MyListItem("crayzeds.notarealserver.co.uk"), 1, 2);
mclbox->setItem(new MyListItem("[colour='FF00FF00']43ms"), 2, 2);
// Set fourth row item texts for the MCL
mclbox->setItem(new MyListItem("Fake IPs"), 0, 3);
mclbox->setItem(new MyListItem("123.320.42.242"), 1, 3);
mclbox->setItem(new MyListItem("[colour='FFFFFF00']63ms"), 2, 3);
// Set fifth row item texts for the MCL
mclbox->setItem(new MyListItem("Yet Another Game Server"), 0, 4);
mclbox->setItem(new MyListItem("abc.abcdefghijklmn.org"), 1, 4);
mclbox->setItem(new MyListItem("[colour='FFFF6600']284ms"), 2, 4);
mclbox->setProperty("Font", "fkp-16");
}
void CEGUISample9App::initDemoEventWiring()
{
using namespace CEGUI;
// Subscribe handler that processes changes to the slider position.
WindowManager::getSingleton().getWindow("Demo7/Window1/Slider1")->
subscribeEvent(Slider::EventValueChanged, Event::Subscriber(&CEGUISample9App::handleSlider, this));
// Subscribe handler that processes changes to the checkbox selection state.
WindowManager::getSingleton().getWindow("Demo7/Window1/Checkbox")->
subscribeEvent(Checkbox::EventCheckStateChanged, Event::Subscriber(&CEGUISample9App::handleCheck, this));
// Subscribe handler that processes changes to the radio button selection state.
WindowManager::getSingleton().getWindow("Demo7/Window1/Radio1")->
subscribeEvent(RadioButton::EventSelectStateChanged, Event::Subscriber(&CEGUISample9App::handleRadio, this));
// Subscribe handler that processes changes to the radio button selection state.
WindowManager::getSingleton().getWindow("Demo7/Window1/Radio2")->
subscribeEvent(RadioButton::EventSelectStateChanged, Event::Subscriber(&CEGUISample9App::handleRadio, this));
// Subscribe handler that processes changes to the radio button selection state.
WindowManager::getSingleton().getWindow("Demo7/Window1/Radio3")->
subscribeEvent(RadioButton::EventSelectStateChanged, Event::Subscriber(&CEGUISample9App::handleRadio, this));
}
bool CEGUISample9App::handleSlider(const CEGUI::EventArgs &e)
{
using namespace CEGUI;
float val = static_cast<Slider*>(static_cast<const WindowEventArgs&>(e).window)->getCurrentValue();
static_cast<ProgressBar*>(WindowManager::getSingleton().getWindow("Demo7/Window2/Progbar1"))->setProgress(val);
static_cast<ProgressBar*>(WindowManager::getSingleton().getWindow("Demo7/Window2/Progbar2"))->setProgress(1.0f - val);
WindowManager::getSingleton().getWindow("root")->setAlpha(val);
return true;
}
bool CEGUISample9App::handleRadio(const CEGUI::EventArgs &e)
{
using namespace CEGUI;
CEGUI::uint id = static_cast<RadioButton*>(static_cast<const WindowEventArgs&>(e).window)->getSelectedButtonInGroup()->getID();
Window* img = WindowManager::getSingleton().getWindow("Demo7/Window2/Image1");
// set an image into the StaticImage according to the ID of the selected radio button.
switch (id)
{
case 0:
img->setProperty("Image", "set:BackgroundImage image:full_image");
break;
case 1:
img->setProperty("Image", "set:TaharezLook image:MouseArrow");
break;
default:
img->setProperty("Image", "");
break;
}
// event was handled
return true;
}
bool CEGUISample9App::handleCheck(const CEGUI::EventArgs& e)
{
using namespace CEGUI;
// show or hide the FrameWindow containing the multi-line editbox according to the state of the
// checkbox widget
WindowManager::getSingleton().getWindow("Demo7/Window3")->
setVisible(static_cast<Checkbox*>(static_cast<const WindowEventArgs&>(e).window)->isSelected());
// event was handled.
return true;
}
| [
"79481268@qq.com"
] | 79481268@qq.com |
64feadc237a3586e2a423f2f24df2ff3a88cfc84 | 5bf21367f5f4bca698f3f898dc7f32079fc6b24f | /DirectoryContainer/tests/EncoddingBug/Main.cpp | 7a07ab07e31473ba1f910a647c2774f582cd09ef | [] | no_license | rssh/Gen | a17dde42b79c9e9d41b53914b02ffb75d27d615c | 813540bdaa5366c54fe592740250bdae3bbd2edd | refs/heads/master | 2021-01-02T22:45:50.481378 | 2011-06-21T08:05:16 | 2011-06-21T08:05:16 | null | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 919 | cpp | #include <iostream>
#include <string>
#include <GradSoft/Logger.h>
#include <GradSoft/DirectoryContainer.h>
#define LOG_INFO_ENABLE true
// $Id: Main.cpp,v 1.1 2002-08-29 15:10:33 rin Exp $
int main(int argc, char** argv)
{
GradSoft::Logger log;
try{
GradSoft::DirectoryEntry smth("cyrilic");
do {
std::cerr << smth.name() << std::endl;
std::string s = "cyrilic/";
s += smth.name();
if (strcmp(smth.name(),".")&&strcmp(smth.name(),"..")) {
std::cerr << " Logging to file \"" << s.c_str()
<< "\" its filename (encoding ÂÈÍÄÎÑ / „Ž‘ / ëïé8 )." << std::endl;
log.setOutputFile(s.c_str());
log.infos() << smth.name() << std::endl;
}
} while (smth.next());
} catch (const GradSoft::DirectoryException& ex) {
std::cerr << ex.what() << std::endl;
}
return 0;
}
| [
"ruslan@shevchenko.kiev.ua"
] | ruslan@shevchenko.kiev.ua |
5efd8b663cbc97713f68c2b1a8997a1f10656c63 | c6548cd158e170f57470621a188db4af7d67d013 | /src/race_perception_packages/race_perception_utils/src/test_wait_for_tf.cpp | be3bf1ad8a0f28f21433ec9dd10493620a3fe798 | [] | no_license | SverreBr/cognitive_robotics_ws | f3a488eeb487be72576dcf187c5661ecaddac26a | 067689bd2d5e180c614641bf06f73763e1e813a5 | refs/heads/main | 2023-08-23T18:53:47.214218 | 2021-10-07T17:45:21 | 2021-10-07T17:45:21 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,906 | cpp | /**
* @file
* @brief
*/
#ifndef _TEST_WAIT_FOR_TF_CPP_
#define _TEST_WAIT_FOR_TF_CPP_
/* _________________________________
| |
| INCLUDES |
|_________________________________| */
//ros includes
#include <ros/ros.h>
#include <tf/transform_listener.h>
//rviz includes
//race ua includes
#include <race_perception_utils/print.h>
#include <race_perception_utils/tf_wrapper.h>
/* _________________________________
| |
| Namespaces |
|_________________________________| */
using namespace std;
using namespace tf;
using namespace ros;
using namespace race_perception_utils;
//Global vars
boost::shared_ptr<tf::TransformListener> p_tf_listener;
string _name;
int main (int argc, char** argv)
{
PrettyPrint pp;
ros::init(argc, argv, "test_wait_for_tf"); // Initialize ROS coms
ros::NodeHandle* n = (ros::NodeHandle*) new ros::NodeHandle("~"); //The node handle
//get node name
_name = n->getNamespace();
string ns = (ros::this_node::getNamespace()).substr(1); //to get the namespace with a single / at the beggining
//init listener
p_tf_listener = (boost::shared_ptr<tf::TransformListener>) new tf::TransformListener;
std::string target = "/map";
std::string source = "/perception/tabletop_segmentation/table";
ROS_INFO("Starting to wait for tf between %s and %s", target.c_str(), source.c_str());
//Wait for the first table transform
if(!race_perception_utils::safe_tf_wait(p_tf_listener, "/map", "/perception/tabletop_segmentation/table", 10, _name))
{
pp.info(std::ostringstream().flush() << "Could not get table transform after waiting forever. Aborting");
pp.printInitialization();
exit(1);
}
ros::Duration(0.4).sleep();
ROS_INFO("Finished to wait for tf");
return 1;
}
#endif
| [
"noreply@github.com"
] | noreply@github.com |
1a27abfe5d456702fd3745c3c8c8553bd7da4a9f | 1988c1daa0ce63efd26474550959f7631bc315a9 | /demo/0116/decision/lane.cpp | bb6a25c5d3ecaa1b5d922a0c46f400b8f944094c | [] | no_license | dnsd/idoor2 | 2f6c167510f40a1d1a353dff30b762986c62dc10 | b30315eec74a8376246663686acbd9dc298bd4ee | refs/heads/master | 2020-12-31T03:02:52.801562 | 2014-02-27T09:26:45 | 2014-02-27T09:26:45 | 15,908,160 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,523 | cpp | // tanzaku_and_edge
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sys/time.h>
#include <time.h>
#include <ssm.hpp>
#include <cmath>
#include "send_spotinfo.h"
#include <vector>
#include <algorithm>
#include <deque>
#include <iterator>
using namespace std;
void set_entry_lane_num(vector< deque<double> >& tan_x_buf, vector< deque<double> >& tan_y_buf, bool in_the_areaE_flag[],
int entry_lane_num[])
{
for (int tan_num = 0; tan_num < TANZAKU_NUM_MAX; tan_num++)
{
if (tan_x_buf[tan_num][CUR_INDEX] != 0.0 && in_the_areaE_flag[tan_num] == true)
{
if (AREA_E_END_X < tan_x_buf[tan_num][PREPRE_INDEX]
|| tan_y_buf[tan_num][PREPRE_INDEX] < AREA_E_START_Y
|| AREA_E_END_Y < tan_y_buf[tan_num][PREPRE_INDEX])
{
entry_lane_num[tan_num] = (int)tan_x_buf[tan_num][CUR_INDEX] / 100;
if (entry_lane_num[tan_num] <= TARGET_LANE_RANGE) entry_lane_num[tan_num] = TARGET_LANE_RANGE;
}else{
entry_lane_num[tan_num] = 0;
}
}else{
entry_lane_num[tan_num] = 0;
}
}
}
void set_on_the_lane_flag(vector< deque<double> >& tan_x_buf, bool on_the_lane_flag[])
{
// 初期化
for (int lane_num = 0; lane_num < LANE_NUM_MAX; lane_num++)
{
on_the_lane_flag[lane_num] = false;
}
// on_the_lane_flagの更新
for (int tan_num = 0; tan_num < TANZAKU_NUM_MAX; tan_num++)
{
//位置データがあるとき
if (tan_x_buf[tan_num][CUR_INDEX] != 0.0)
{
int tmp = (int)tan_x_buf[tan_num][CUR_INDEX] / 100;
if(tmp <= TARGET_LANE_RANGE) tmp = TARGET_LANE_RANGE; //tmp-TARGET_LANE_RANGEがマイナスにならないようにする
for (int i = tmp-TARGET_LANE_RANGE; i <= tmp+TARGET_LANE_RANGE; i++)
{
on_the_lane_flag[i] = true;
}
}
// いっこ前なら位置データがあるとき
if (tan_x_buf[tan_num][CUR_INDEX] == 0.0 && tan_x_buf[tan_num][PRE_INDEX] != 0.0)
{
int tmp = (int)tan_x_buf[tan_num][PRE_INDEX] / 100;
if(tmp <= TARGET_LANE_RANGE) tmp = TARGET_LANE_RANGE;//tmp-TARGET_LANE_RANGEがマイナスにならないようにする
for (int i = tmp-TARGET_LANE_RANGE; i <= tmp+TARGET_LANE_RANGE; i++)
{
on_the_lane_flag[i] = true;
}
}
// 位置データがないとき
if (tan_x_buf[tan_num][CUR_INDEX] == 0.0 && tan_x_buf[tan_num][PRE_INDEX] == 0.0)
{
// なにもしない
}
}
}
// entry_lane_flagをつかったもの
void upd_cancel_lane_flag(vector< deque<double> >& tan_x_buf, int entry_lane_num[], bool cancel_lane_flag[])
{
// cancel_lane_flagをセットするか判断
for (int tan_num = 0; tan_num < TANZAKU_NUM_MAX; tan_num++)
{
// entry_flag_numが0以外のとき
if (entry_lane_num[tan_num] != 0)
{
for (int i = entry_lane_num[tan_num]-TARGET_LANE_RANGE; i <= entry_lane_num[tan_num]+TARGET_LANE_RANGE; i++)
{
cancel_lane_flag[i] = true;
// cout << i << ","; //debug
}
}
}
// cancel_lane_flagをクリアするか判断
for (int lane_num = 0; lane_num < LANE_NUM_MAX; lane_num++)
{
// cancel_laneに位置データがあるとき:保留
if (cancel_lane_flag[lane_num] == true && on_the_lane_flag[lane_num] == true)
{
// なにもしない
}
// cancel_laneに位置データがないとき:クリアする
if (cancel_lane_flag[lane_num] == true && on_the_lane_flag[lane_num] == false)
{
cancel_lane_flag[lane_num] = false;
}
}
// cout << endl; //debug
}
void upd_cancel_flag(vector< deque<double> >& tan_x_buf, bool in_the_areaE_flag[], bool cancel_lane_flag[],
bool cancel_flag[])
{
for (int tan_num = 0; tan_num < TANZAKU_NUM_MAX; tan_num++)
{
// 物体がエリア内にいるとき(条件1)
if (in_the_areaE_flag[tan_num] == true)
{
// 位置データがあるとき
if (tan_x_buf[tan_num][CUR_INDEX] != 0.0)
{
int tmp = (int)tan_x_buf[tan_num][CUR_INDEX] / 100;
if (cancel_lane_flag[tmp] == true)
{
cancel_flag[tan_num] = true;
}else{
cancel_flag[tan_num] = false;
}
}
// いっこ前なら位置データがあるとき
if (tan_x_buf[tan_num][CUR_INDEX] == 0.0 && tan_x_buf[tan_num][PRE_INDEX] != 0.0)
{
int tmp = (int)tan_x_buf[tan_num][PRE_INDEX] / 100;
if (cancel_lane_flag[tmp] == true)
{
cancel_flag[tan_num] = true;
}else{
cancel_flag[tan_num] = false;
}
}
// 位置データがないとき
if (tan_x_buf[tan_num][CUR_INDEX] == 0.0 && tan_x_buf[tan_num][PRE_INDEX] == 0.0)
{
cancel_flag[tan_num] = true;
}
}
// 物体がエリア内にいないとき(条件1)
if (in_the_areaE_flag[tan_num] == false)
{
cancel_flag[tan_num] = true;
}
}
} | [
"daiki.nishida@gmail.com"
] | daiki.nishida@gmail.com |
c9e3fa83530ae995afd91022f18b3f3fbe4e39b5 | 0eff74b05b60098333ad66cf801bdd93becc9ea4 | /second/download/squid/gumtree/squid_repos_function_241_squid-3.4.14.cpp | 29bcc8689275cdcb8fba6e27c0b31e2f345538e6 | [] | no_license | niuxu18/logTracker-old | 97543445ea7e414ed40bdc681239365d33418975 | f2b060f13a0295387fe02187543db124916eb446 | refs/heads/master | 2021-09-13T21:39:37.686481 | 2017-12-11T03:36:34 | 2017-12-11T03:36:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 407 | cpp | char *
Get_WIN32_ErrorMessage(HRESULT hr)
{
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
hr,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) & WIN32_ErrorMessage,
0,
NULL);
return WIN32_ErrorMessage;
} | [
"993273596@qq.com"
] | 993273596@qq.com |
c6c8e9b560d8df4e7836cb6ff299af4fd64fcffd | e5b47b580913779697308fc89a48e009887bd34c | /Software/mbed Test Code/tft_lcd_test/main.cpp | 17d0ee707515e4a7bbac7b8074c2e533cf5dbf87 | [] | no_license | brianjk66/Gumball-Machine | dd58e7cb7619dd23112a28b60ed971fa1ee81a01 | b4b68a0574e2e094faa5b8e9e2a1da673e08a39c | refs/heads/master | 2021-10-24T13:57:43.140895 | 2019-03-26T15:05:20 | 2019-03-26T15:05:20 | 161,465,181 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,985 | cpp | #include "mbed.h"
#include "millis.h"
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735
// For the breakout, you can use any 2 or 3 pins
// These pins will also work for the 1.8" TFT shield
#define TFT_MOSI p5
#define TFT_MISO p6
#define TFT_SCLK p7
#define TFT_CS p8
#define TFT_DC p9
#define TFT_RST p10
// For 1.44" and 1.8" TFT with ST7735 use
SPI spi(TFT_MOSI, TFT_MISO, TFT_SCLK);
Adafruit_ST7735 tft = Adafruit_ST7735(&spi, TFT_CS, TFT_DC, TFT_RST);
PwmOut lite(p26);
float p = 3.1415926;
void testlines(uint16_t color) {
tft.fillScreen(ST77XX_BLACK);
for (int16_t x=0; x < tft.width(); x+=6) {
tft.drawLine(0, 0, x, tft.height()-1, color);
wait_ms(0);
}
for (int16_t y=0; y < tft.height(); y+=6) {
tft.drawLine(0, 0, tft.width()-1, y, color);
wait_ms(0);
}
tft.fillScreen(ST77XX_BLACK);
for (int16_t x=0; x < tft.width(); x+=6) {
tft.drawLine(tft.width()-1, 0, x, tft.height()-1, color);
wait_ms(0);
}
for (int16_t y=0; y < tft.height(); y+=6) {
tft.drawLine(tft.width()-1, 0, 0, y, color);
wait_ms(0);
}
tft.fillScreen(ST77XX_BLACK);
for (int16_t x=0; x < tft.width(); x+=6) {
tft.drawLine(0, tft.height()-1, x, 0, color);
wait_ms(0);
}
for (int16_t y=0; y < tft.height(); y+=6) {
tft.drawLine(0, tft.height()-1, tft.width()-1, y, color);
wait_ms(0);
}
tft.fillScreen(ST77XX_BLACK);
for (int16_t x=0; x < tft.width(); x+=6) {
tft.drawLine(tft.width()-1, tft.height()-1, x, 0, color);
wait_ms(0);
}
for (int16_t y=0; y < tft.height(); y+=6) {
tft.drawLine(tft.width()-1, tft.height()-1, 0, y, color);
wait_ms(0);
}
}
void testdrawtext(char *text, uint16_t color) {
tft.setCursor(0, 0);
tft.setTextColor(color);
tft.setTextWrap(true);
tft.printf(text);
}
void testfastlines(uint16_t color1, uint16_t color2) {
tft.fillScreen(ST77XX_BLACK);
for (int16_t y=0; y < tft.height(); y+=5) {
tft.drawFastHLine(0, y, tft.width(), color1);
}
for (int16_t x=0; x < tft.width(); x+=5) {
tft.drawFastVLine(x, 0, tft.height(), color2);
}
}
void testdrawrects(uint16_t color) {
tft.fillScreen(ST77XX_BLACK);
for (int16_t x=0; x < tft.width(); x+=6) {
tft.drawRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color);
}
}
void testfillrects(uint16_t color1, uint16_t color2) {
tft.fillScreen(ST77XX_BLACK);
for (int16_t x=tft.width()-1; x > 6; x-=6) {
tft.fillRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color1);
tft.drawRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color2);
}
}
void testfillcircles(uint8_t radius, uint16_t color) {
for (int16_t x=radius; x < tft.width(); x+=radius*2) {
for (int16_t y=radius; y < tft.height(); y+=radius*2) {
tft.fillCircle(x, y, radius, color);
}
}
}
void testdrawcircles(uint8_t radius, uint16_t color) {
for (int16_t x=0; x < tft.width()+radius; x+=radius*2) {
for (int16_t y=0; y < tft.height()+radius; y+=radius*2) {
tft.drawCircle(x, y, radius, color);
}
}
}
void testtriangles() {
tft.fillScreen(ST77XX_BLACK);
int color = 0xF800;
int t;
int w = tft.width()/2;
int x = tft.height()-1;
int y = 0;
int z = tft.width();
for(t = 0 ; t <= 15; t++) {
tft.drawTriangle(w, y, y, x, z, x, color);
x-=4;
y+=4;
z-=4;
color+=100;
}
}
void testroundrects() {
tft.fillScreen(ST77XX_BLACK);
int color = 100;
int i;
int t;
for(t = 0 ; t <= 4; t+=1) {
int x = 0;
int y = 0;
int w = tft.width()-2;
int h = tft.height()-2;
for(i = 0 ; i <= 16; i+=1) {
tft.drawRoundRect(x, y, w, h, 5, color);
x+=2;
y+=3;
w-=4;
h-=6;
color+=1100;
}
color+=100;
}
}
void tftPrintTest() {
tft.setTextWrap(false);
tft.fillScreen(ST77XX_BLACK);
tft.setCursor(0, 30);
tft.setTextColor(ST77XX_RED);
tft.setTextSize(1);
tft.printf("Hello World!\n");
tft.setTextColor(ST77XX_YELLOW);
tft.setTextSize(2);
tft.printf("Hello World!\n");
tft.setTextColor(ST77XX_GREEN);
tft.setTextSize(3);
tft.printf("Hello World!\n");
tft.setTextColor(ST77XX_BLUE);
tft.setTextSize(4);
tft.printf("%f", 1234.567);
wait_ms(1500);
tft.setCursor(0, 0);
tft.fillScreen(ST77XX_BLACK);
tft.setTextColor(ST77XX_WHITE);
tft.setTextSize(0);
tft.printf("Hello World!\n");
tft.setTextSize(1);
tft.setTextColor(ST77XX_GREEN);
tft.printf("%0.6f", p);
tft.printf(" Want pi?\n");
tft.printf(" \n");
tft.printf("0x%x", 8675309); // print 8,675,309 out in HEX!
tft.printf(" Print HEX!\n");
tft.printf(" \n");
tft.setTextColor(ST77XX_WHITE);
tft.printf("Sketch has been\n");
tft.printf("running for: \n");
tft.setTextColor(ST77XX_MAGENTA);
tft.printf("%lu", millis() / 1000);
tft.setTextColor(ST77XX_WHITE);
tft.printf(" seconds.");
}
void mediabuttons() {
// play
tft.fillScreen(ST77XX_BLACK);
tft.fillRoundRect(25, 10, 78, 60, 8, ST77XX_WHITE);
tft.fillTriangle(42, 20, 42, 60, 90, 40, ST77XX_RED);
wait_ms(500);
// pause
tft.fillRoundRect(25, 90, 78, 60, 8, ST77XX_WHITE);
tft.fillRoundRect(39, 98, 20, 45, 5, ST77XX_GREEN);
tft.fillRoundRect(69, 98, 20, 45, 5, ST77XX_GREEN);
wait_ms(500);
// play color
tft.fillTriangle(42, 20, 42, 60, 90, 40, ST77XX_BLUE);
wait_ms(50);
// pause color
tft.fillRoundRect(39, 98, 20, 45, 5, ST77XX_RED);
tft.fillRoundRect(69, 98, 20, 45, 5, ST77XX_RED);
// play color
tft.fillTriangle(42, 20, 42, 60, 90, 40, ST77XX_GREEN);
}
int main() {
// Start millis() library
millisStart();
// Full brightness on backlight and 1 kHz frequency
lite = 1.0;
lite.period(1/1000.0);
printf("Hello! ST77xx TFT Test");
// Use this initializer if you're using a 1.8" TFT
// tft.initR(INITR_BLACKTAB); // initialize a ST7735S chip, black tab
// Use this initializer (uncomment) if you're using a 1.44" TFT
tft.initR(INITR_144GREENTAB); // initialize a ST7735S chip, black tab
// Use this initializer (uncomment) if you're using a 0.96" 180x60 TFT
//tft.initR(INITR_MINI160x80); // initialize a ST7735S chip, mini display
// Use this initializer (uncomment) if you're using a 1.54" 240x240 TFT
//tft.init(240, 240); // initialize a ST7789 chip, 240x240 pixels
printf("Initialized\n");
unsigned long time = millis();
tft.fillScreen(ST77XX_BLACK);
time = millis() - time;
printf("%lu", time);
wait_ms(500);
// large block of text
tft.fillScreen(ST77XX_BLACK);
testdrawtext("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur adipiscing ante sed nibh tincidunt feugiat. Maecenas enim massa, fringilla sed malesuada et, malesuada sit amet turpis. Sed porttitor neque ut ante pretium vitae malesuada nunc bibendum. Nullam aliquet ultrices massa eu hendrerit. Ut sed nisi lorem. In vestibulum purus a tortor imperdiet posuere. ", ST77XX_WHITE);
wait_ms(1000);
// tft print function!
tftPrintTest();
wait_ms(4000);
// a single pixel
tft.drawPixel(tft.width()/2, tft.height()/2, ST77XX_GREEN);
wait_ms(500);
// line draw test
testlines(ST77XX_YELLOW);
wait_ms(500);
// optimized lines
testfastlines(ST77XX_RED, ST77XX_BLUE);
wait_ms(500);
testdrawrects(ST77XX_GREEN);
wait_ms(500);
testfillrects(ST77XX_YELLOW, ST77XX_MAGENTA);
wait_ms(500);
tft.fillScreen(ST77XX_BLACK);
testfillcircles(10, ST77XX_BLUE);
testdrawcircles(10, ST77XX_WHITE);
wait_ms(500);
testroundrects();
wait_ms(500);
testtriangles();
wait_ms(500);
mediabuttons();
wait_ms(500);
printf("done\n");
wait_ms(1000);
while (1) {
bool flip = true;
for (float i = 1.0; i > 0.1; i -= 0.1) {
lite = i;
tft.invertDisplay(flip);
flip = !flip;
wait_ms(500);
}
for (float i = 0.1; i < 1.0; i += 0.1) {
lite = i;
tft.invertDisplay(flip);
flip = !flip;
wait_ms(500);
}
}
}
| [
"brian.kaplan@gatech.edu"
] | brian.kaplan@gatech.edu |
2127033c146e512647f6b4f8b1af370b32a76de4 | 00640eba89432415187058e689e46e4b36faf6d8 | /abc/abc158/d/main.cpp | 5736198d89c932939d207d24dd1632346add656e | [] | no_license | oimou/procon | 1a22cc45325c2fad32141a5e0f1afbad6b4f16b3 | a9a5ae405821eac327f2c8215397505234c95651 | refs/heads/master | 2020-08-15T11:26:35.936055 | 2020-03-29T12:36:42 | 2020-03-29T12:36:42 | 215,333,154 | 1 | 0 | null | 2019-11-06T11:11:01 | 2019-10-15T15:28:58 | TeX | UTF-8 | C++ | false | false | 863 | cpp | #pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include <bits/stdc++.h>
using namespace std;
/**
* main
*/
int main () {
string S_;
cin >> S_;
list<char> S;
for (const char c : S_) {
S.push_back(c);
}
int Q;
cin >> Q;
bool is_reversed = false;
while (Q--) {
int type;
scanf("%d", &type);
if (type == 1) {
is_reversed = !is_reversed;
} else if (type == 2) {
int F;
char C;
scanf("%d %c", &F, &C);
if (!is_reversed && F == 1 || is_reversed && F == 2) {
S.push_front(C);
} else {
S.push_back(C);
}
}
}
if (is_reversed) {
for (auto it = S.rbegin(); it != S.rend(); it++) {
printf("%c", *it);
}
printf("\n");
} else {
for (auto it = S.begin(); it != S.end(); it++) {
printf("%c", *it);
}
printf("\n");
}
}
| [
"s1190013@gmail.com"
] | s1190013@gmail.com |
8ca181ae239df6db57584bcc80672e7ea04e4d37 | 58fc1e297276e83c1bf4db5b17fc40e09bb3bceb | /src/Core/Math/CatmullRomSpline.h | 96a575b18a725281983b0e84e9b30f15f731c49d | [
"MIT"
] | permissive | jholmen/Uintah-kokkos_dev_old | 219679a92e5ed17594040ec602e1fd946e823cde | da1e965f8f065ae5980e69a590b52d85b2df1a60 | refs/heads/master | 2023-04-13T17:03:13.552152 | 2021-04-20T13:16:22 | 2021-04-20T13:16:22 | 359,657,090 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,900 | h | /*
* The MIT License
*
* Copyright (c) 1997-2016 The University of Utah
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
/*
* CatmullRomSpline.h:
*
* Written by:
* Steven G. Parker
* Department of Computer Science
* University of Utah
* March 1994
*
*/
#ifndef SCI_Math_CatmullRomSpline_h
#define SCI_Math_CatmullRomSpline_h
#include <Core/Containers/Array1.h>
namespace Uintah {
template<class T>
class CatmullRomSpline
{
public:
CatmullRomSpline();
CatmullRomSpline( const Array1<T>& );
CatmullRomSpline( const int );
CatmullRomSpline( const CatmullRomSpline<T>& );
void setData( const Array1<T>& );
void add( const T& );
void insertData( const int, const T& );
void removeData( const int );
void clear();
T operator()( double ) const; // 0-1
T& operator[]( const int );
private:
Array1<T> d;
};
} // End namespace Uintah
////////////////////////////////////////////////////////////
// Start of included CatmullRomSpline.cc
#include <Core/Util/Assert.h>
namespace Uintah {
template<class T>
CatmullRomSpline<T>::CatmullRomSpline() :
d(0)
{
}
template<class T>
CatmullRomSpline<T>::CatmullRomSpline( const Array1<T>& data ) :
d(data)
{
}
template<class T>
CatmullRomSpline<T>::CatmullRomSpline( const int n ) :
d(n)
{
}
template<class T>
CatmullRomSpline<T>::CatmullRomSpline( const CatmullRomSpline& s ) :
d(s.d)
{
}
template<class T>
void
CatmullRomSpline<T>::setData( const Array1<T>& data )
{
d = data;
}
template<class T>
void
CatmullRomSpline<T>::clear()
{
d.remove_all();
}
template<class T>
void
CatmullRomSpline<T>::add( const T& obj )
{
d.add(obj);
}
template<class T>
void
CatmullRomSpline<T>::insertData( const int idx, const T& obj )
{
d.insert(idx, obj);
}
template<class T>
void
CatmullRomSpline<T>::removeData( const int idx )
{
d.remove(idx);
}
template<class T>
T
CatmullRomSpline<T>::operator()( double x ) const
{
int idx = (int)x;
double t = x - idx;
double t2 = t * t;
double t3 = t2 * t;
int size = d.size();
int idx1 = (idx-1+size) % size;
int idx2 = (idx +size) % size;
int idx3 = (idx+1+size) % size;
int idx4 = (idx+2+size) % size;
T p0 = d[ idx1 ];
T p1 = d[ idx2 ];
T p2 = d[ idx3 ];
T p3 = d[ idx4 ];
//printf("x=%lf, idx=%d, t=%lf (dsize = %d) %d, %d, %d, %d\n", x, idx, t, size, idx1, idx2, idx3, idx4 );
T result = ( (p0*-1 + p1*3 + p2*-3 + p3 ) * (t3 * 0.5)+
(p0*2 + p1*-5 + p2*4 + p3*-1) * (t2 * 0.5)+
(p0*-1 + p2 ) * (t * 0.5)+
( p1 ) );
//cout << "result: " << result << "\n";
return result;
}
template<class T>
T&
CatmullRomSpline<T>::operator[]( const int idx )
{
return d[idx];
}
} // End namespace Uintah
#endif /* SCI_Math_CatmullRomSpline_h */
| [
"ahumphrey@sci.utah.edu"
] | ahumphrey@sci.utah.edu |
1ed1e4f700e3bdedc17120f192687b149cfc3479 | 53fef3c57b196bb5c1c3244319e685a2e0edd23a | /windows/LiveDemo5/ZegoLiveDemo/Config/ZegoUserConfig.h | afc7242cf5f9f70d29bd0e93ccc6e5b77021c674 | [] | no_license | shengge/ZegoLiveDemo5Rtp | 9579c747ff62fc392e0de211e8739546dc1291e8 | 7356a5bd3056616209ed4122e2f090ef8cb2a3dc | refs/heads/master | 2021-05-15T07:32:06.599706 | 2017-10-10T10:09:46 | 2017-10-10T10:09:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 860 | h | #pragma once
#include "ZegoSettingsModel.h"
#include <QSharedPointer>
#include <QFile>
#include <QSettings>
class QZegoUserConfig
{
public:
QZegoUserConfig();
~QZegoUserConfig();
void LoadConfig(void);
void SaveConfig(void);
QString GetUserId(void);
QString GetUserIdWithRole(void);
void SetUserId(const QString strUserId);
QString GetUserName(void);
void SetUserName(const QString strUserName);
bool IsPrimary(void);
void SetUserRole(bool primary);
VideoQuality GetVideoQuality(void);
void SetVideoQuality(VideoQuality quality);
SettingsPtr GetVideoSettings(void);
void SetVideoSettings(SettingsPtr curSettings);
private:
bool LoadConfigInternal(void);
private:
QString m_strIniPath;
QString m_strUserId;
QString m_strUserName;
bool m_bPrimary;
SettingsPtr m_pVideoSettings;
}; | [
"dev@zego.im"
] | dev@zego.im |
93472a8f702ca0fd9730f88b14897a4727d0b3ea | 635198060c600457a5a19fa96f449d6e8d6ad55e | /code/String/anagrams.cpp | 824a1b8997a1beb642aff1730748c0cd3c2f9e75 | [
"MIT"
] | permissive | leetcode-1533/Lintcode-US-Giants | eaa1b120df599b02ee47f7c4d99421250ed9b47c | 7b7ecf0f952a0bd3467bb2dd5befc3cc2646518a | refs/heads/master | 2021-05-29T21:46:10.615999 | 2015-11-09T07:45:36 | 2015-11-09T07:45:36 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,641 | cpp | 描述
有一个vector,里面存放的是若干个字符串,现在需要把里面的anagrams字符串找出来。比如,["ab", "ba", "cd", "dc", "e],最后需要得到["ab", "ba", "cd", "dc"],顺序无所谓。需要注意的是,所谓的anagrams字符串,一定是有2个或2个以上的,要不然你和谁anagrams啊,是吧?
思路
需要用一个map,来存储每个字符串出现的位置,字符串是排序好的,这一来了下一个字符串也sort一下,就可以看看map中有没有了。之所以记录位置,是因为map的key已经是排序的了,原来的字符串只能通过位置去输入的vector中取。总的时间是O(n2logn),如果不用排序,就可以降到O(n2)了。能想到的方法是对每一个字符串做一个hash,map存储的是hash->位置。问题是,如何计算hash呢,使得hash(abc) = hash(bca)?
代码
class Solution {
public:
/**
* @param strs: A list of strings
* @return: A list of strings
*/
vector<string> anagrams(vector<string> &strs) {
int strsLen = strs.size();
vector<string> result;
map<string, int> cache;
for (int i = 0; i < strsLen; i++) {
string s = strs[i];
sort(s.begin(), s.end());
if (cache.find(s) == cache.end()) {
cache[s] = i;
}
else {
if (cache[s] >= 0) {
result.push_back(strs[cache[s]]);
cache[s] = -1;
}
result.push_back(strs[i]);
}
}
return result;
}
};
| [
"zhangxiaoyang.hit@gmail.com"
] | zhangxiaoyang.hit@gmail.com |
0a25a483e984358f339a468c40f10c1568d5604b | bf6bf0fd37b77d1045dccead61da222edc8eabe8 | /cards.cpp | 41a9cc5c0c08221d7268b5bd9e1c549da9f6fecb | [] | no_license | daveboutcher/professional_cpp | 53d2cf924dd40839aa5504090419f242a131474c | c04b4d248241dc4f18b9d66175a6c0761869b767 | refs/heads/master | 2021-09-10T21:40:27.974234 | 2018-03-04T19:42:09 | 2018-03-29T03:51:42 | 112,390,310 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,639 | cpp | /***********************************************************************
* Card Game Example - part of the Professional C++ tutorial
***********************************************************************
* This work is licensed under a Creative Commons Attribution 4.0
* International License. Details at
* http://creativecommons.org/licenses/by/4.0/
***********************************************************************/
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
int main(int argc, char *argv[])
{
// Initialize SDL
SDL_Init(SDL_INIT_VIDEO);
// Create a window
SDL_Window* window = SDL_CreateWindow("Cards",
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED,
480, // Width
480, // Height
SDL_WINDOW_RESIZABLE);
// Create a renderer for the window
SDL_Renderer* renderer = SDL_CreateRenderer(window, -1,
SDL_RENDERER_ACCELERATED);
// Load the four images
SDL_Surface* club_surface = IMG_Load("club.png");
SDL_Texture* club_texture = SDL_CreateTextureFromSurface(renderer,
club_surface);
int club_width, club_height;
SDL_QueryTexture(club_texture, nullptr, nullptr, &club_width, &club_height);
SDL_Surface* diamond_surface = IMG_Load("diamond.png");
SDL_Texture* diamond_texture = SDL_CreateTextureFromSurface(renderer,
diamond_surface);
int diamond_width, diamond_height;
SDL_QueryTexture(diamond_texture, nullptr, nullptr, &diamond_width, &diamond_height);
SDL_Surface* heart_surface = IMG_Load("heart.png");
SDL_Texture* heart_texture = SDL_CreateTextureFromSurface(renderer,
heart_surface);
int heart_width, heart_height;
SDL_QueryTexture(heart_texture, nullptr, nullptr, &heart_width, &heart_height);
SDL_Surface* spade_surface = IMG_Load("spade.png");
SDL_Texture* spade_texture = SDL_CreateTextureFromSurface(renderer,
spade_surface);
int spade_width, spade_height;
SDL_QueryTexture(spade_texture, nullptr, nullptr, &spade_width, &spade_height);
// This is the main SDL loop
while(true) {
// Loop till we get told to quit
SDL_Event event;
SDL_PollEvent(&event);
if(event.type == SDL_QUIT) {
break;
}
// Clear the renderer
SDL_RenderClear(renderer);
// Get the size of the current renderer
SDL_Rect rect;
SDL_RenderGetViewport(renderer, &rect);
// We are going to display 4 images, with padding between them and
// on the side...that works out to 5 blocks of padding
int padding = ((rect.w -
(club_width + diamond_width +
heart_width + spade_width))
/ 5);
// Figure out everyone's positions
SDL_Rect club_pos = {padding, 10,
club_surface->w, club_surface->h};
SDL_Rect diamond_pos = {padding + club_pos.x + club_pos.w, 10,
diamond_width, diamond_height};
SDL_Rect heart_pos = {padding + diamond_pos.x + diamond_pos.w, 10,
heart_width, heart_height};
SDL_Rect spade_pos = {padding + heart_pos.x + heart_pos.w, 10,
spade_width, spade_height};
// Copy in our images
SDL_RenderCopy(renderer, club_texture, nullptr, &club_pos);
SDL_RenderCopy(renderer, diamond_texture, nullptr, &diamond_pos);
SDL_RenderCopy(renderer, heart_texture, nullptr, &heart_pos);
SDL_RenderCopy(renderer, spade_texture, nullptr, &spade_pos);
// Yay...display the images
SDL_RenderPresent(renderer);
}
// Clean up everything
SDL_DestroyTexture(club_texture);
SDL_FreeSurface(club_surface);
SDL_DestroyTexture(diamond_texture);
SDL_FreeSurface(diamond_surface);
SDL_DestroyTexture(heart_texture);
SDL_FreeSurface(heart_surface);
SDL_DestroyTexture(spade_texture);
SDL_FreeSurface(spade_surface);
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}
| [
"daveboutcher@gmail.com"
] | daveboutcher@gmail.com |
aeb96686e7defa1bae7c8dffec28dff2b1f82003 | 8c5672a073fb71e8038ad88991c2473347de378d | /Data Structure/Stack.cpp | 81964619f29de8929299f83d8ae97dc97c201fec | [
"MIT"
] | permissive | Anika1394/University_Miscellaneous_Codes | 0debf74189b5726e0d994d75717865e2beb3c0e4 | 8ac444f51dfdbfeee5f0af54944df0ed3a52e832 | refs/heads/main | 2023-08-10T14:56:39.287968 | 2021-09-15T16:28:18 | 2021-09-15T16:28:18 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,126 | cpp | //Assignment on Stack
#include <stdio.h>
//Functions for given 4 Stack actions
int pushfunction(int ar[],int t,int m);
int popfunction(int ar[],int t);
void searchfunction(int ar[],int t);
void displayfunction(int ar[],int t);
int main(void)
{
int choice,top,info_array[1000];
top=0;
printf("Stack\n");
printf("-----\n");
printf("-----\n");
printf("Enter your choice:\n");
printf("\tChoose 1 to push data.\n");
printf("\tChoose 2 to pop data.\n");
printf("\tChoose 3 to search data.\n");
printf("\tChoose 4 to display data.\n");
printf("\tChoose 5 to exit.\n");
printf("\n\tYour Selected Option: ");
scanf("%d",&choice);
while(choice!=5)
{
switch(choice)
{
case 1: top=pushfunction(info_array,top,1000);
break;
case 2: top=popfunction(info_array,top);
break;
case 3: searchfunction(info_array,top);
break;
case 4: displayfunction(info_array,top);
break;
default: printf("Invalid Input Provided.\n");
break;
}
printf("\n\nEnter your choice:\n");
printf("\tChoose 1 to push data.\n");
printf("\tChoose 2 to pop data.\n");
printf("\tChoose 3 to search data.\n");
printf("\tChoose 4 to display data.\n");
printf("\tChoose 5 to exit.\n");
printf("\n\tYour Selected Option: ");
scanf("%d",&choice);
}
return 0;
}
int pushfunction(int ar[],int t,int m)
{
printf("\n\nYou have Selected to Push Data.\n");
if(t<m)
{
int e;
printf("Enter the element which is to be inserted: ");
scanf("%d",&e);
ar[t]=e;
t++;
printf("Successfully Inserted Requested Data.\n");
return t;
}
else
{
printf("Overflow Detected. Can not Entry More Data.\n");
return t;
}
}
int popfunction(int ar[],int t)
{
printf("\n\nYou have Selected to Pop Data.\n");
if(t==0)
{
printf("No Data Exists to be Deleted.\n");
return t;
}
else
{
t--;
printf("Successfully Deleted Data.\n");
return t;
}
}
void searchfunction(int ar[],int t)
{
printf("\n\nYou have Selected to Search Data.\n");
if(t==0)
printf("No Data to be Searched from Found.\n");
else
{
int e;
printf("The Element To Search: ");
scanf("%d",&e);
t--;
while(t>=0)
{
if(ar[t]==e)
break;
t--;
}
if(t==-1)
printf("Requested Data was Not Found.\n");
else
printf("Requested Data was Found at %d index\n",t);
}
}
void displayfunction(int ar[],int t)
{
printf("\n\nYou have Selected to Display Data.\n");
if(t==0)
printf("No data for Display.\n");
else
{
t--;
while(t>=0)
{
printf("%d ",ar[t]);
t--;
}
printf("\nThis are all the data that are to be displayed.\n");
}
}
| [
"43475529+TashreefMuhammad@users.noreply.github.com"
] | 43475529+TashreefMuhammad@users.noreply.github.com |
419872f417423307e02c6b2fba4a356e903d592f | 882a98764f51ec952ba0dbc8b786cda2e68c5cdf | /RightPrimerClipper.cpp | e7a8bce2838b04733790c5952574de480cce5516 | [] | no_license | AWGL/RemoveAmpliconDuplicates | 71a461af72a26a5e4f03d311550032ff89bf00a7 | 76cab4e97ba96b17c0c979567ef13d9fd2490e6d | refs/heads/master | 2021-04-26T23:00:33.120879 | 2017-07-01T08:04:38 | 2017-07-01T08:04:38 | 123,913,067 | 0 | 0 | null | 2018-03-05T11:59:47 | 2018-03-05T11:59:47 | null | UTF-8 | C++ | false | false | 1,937 | cpp | /*
* FiLename : MatchPrimer.cpp
* Author : Matthew Lyon, Wessex Regional Genetics Laboratory, Salisbury, UK & University of Southampton, UK
* Contact : mlyon@live.co.uk
* Description : Uses Smith-Waterman (SeqAn) local alignement to identify supplied Primer Sequences within the read and clip Sequence beyond this point
* Status: Release
*/
#include <string>
#include <seqan/align.h>
#include <RemoveAmpliconDuplicates.h>
using namespace std;
void RightPrimerClipper(string& Seq, string& Qual, const string& Primer) //clip after right Primer Sequence
{
seqan::Align< seqan::String<char> > alignment;
seqan::resize(rows(alignment), 2); //pairwise
seqan::assignSource(row(alignment, 0), Seq);
seqan::assignSource(row(alignment, 1), Primer);
//Match misMatch gap open gap extend
if (seqan::localAlignment(alignment, seqan::Score<int>(1, -2, -4)) >= 10){ //clip by right Primer
Seq = Seq.substr(0, seqan::clippedEndPosition(row(alignment, 0)));
Qual = Qual.substr(0, seqan::clippedEndPosition(row(alignment, 0)));
}
return;
}
/*void RightPrimerClipper(string& Seq, string& Qual, string& Primer) //clip after right Primer Sequence
{
float HScore = 0, Score, Match, PrimerLen = Primer.length();
unsigned ReadPos = 0, SeqLen = Seq.length(), Len = 0, n;
while (ReadPos < (SeqLen - PrimerLen)) {
Match = 0; //count Matching bases along Primer
//compare base by base the read Sequence with the Primer Sequence
for (n = 0; n < PrimerLen; ++n) {
if (Primer[n] == Seq[n + ReadPos]) {
Match++;
}
}
Score = Match / PrimerLen;
//keep record of highest Score
if (Score > HScore) {
HScore = Score;
Len = ReadPos;
}
ReadPos++; //start Primer on next base
}
if (HScore > 0.75) {
Seq = Seq.substr(0, Len + PrimerLen); //does not remove right Primer -- useful for mapping
Qual = Qual.substr(0, Len + PrimerLen);
}
return;
}*/ | [
"mcgml@cardiff.ac.uk"
] | mcgml@cardiff.ac.uk |
a0f0bd142028c33fd5148e5d01cc7a84099935e9 | f7fded02bc6e9f29d504384708144489a0105cd4 | /src/qt/bitcoinaddressvalidator.h | 28af2b5c0151d26927845da6f7faceaa5903fb2a | [
"MIT"
] | permissive | OICcoins/K9S | 575346e03b625fe48f876700820b15024852f54e | c1a3e9b2ea5a7a602e0cb685cc8caeae0c74c28f | refs/heads/master | 2023-06-09T03:48:10.082646 | 2021-06-23T04:10:47 | 2021-06-23T04:10:47 | 378,881,369 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 974 | h | // Copyright (c) 2011-2014 The Bitcoin developers
// Copyright (c) 2021 The NEUTRON Core Developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_QT_BITCOINADDRESSVALIDATOR_H
#define BITCOIN_QT_BITCOINADDRESSVALIDATOR_H
#include <QValidator>
/** Base58 entry widget validator, checks for valid characters and
* removes some whitespace.
*/
class BitcoinAddressEntryValidator : public QValidator
{
Q_OBJECT
public:
explicit BitcoinAddressEntryValidator(QObject* parent);
State validate(QString& input, int& pos) const;
};
/** Bitcoin address widget validator, checks for a valid bitcoin address.
*/
class BitcoinAddressCheckValidator : public QValidator
{
Q_OBJECT
public:
explicit BitcoinAddressCheckValidator(QObject* parent);
State validate(QString& input, int& pos) const;
};
#endif // BITCOIN_QT_BITCOINADDRESSVALIDATOR_H
| [
"30714489+OICcoins@users.noreply.github.com"
] | 30714489+OICcoins@users.noreply.github.com |
5fdbc8d6aa972b3d1dce6d88edc7fbb3aee05b15 | 08b8cf38e1936e8cec27f84af0d3727321cec9c4 | /data/crawl/git/new_hunk_7746.cpp | 446eb988e11f690aaaa1db7ad8c82c137dc1a858 | [] | no_license | ccdxc/logSurvey | eaf28e9c2d6307140b17986d5c05106d1fd8e943 | 6b80226e1667c1e0760ab39160893ee19b0e9fb1 | refs/heads/master | 2022-01-07T21:31:55.446839 | 2018-04-21T14:12:43 | 2018-04-21T14:12:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 375 | cpp | */
if (show_stage || show_unmerged)
die("ls-files --with-tree is incompatible with -s or -u");
overlay_tree_on_cache(with_tree, prefix);
}
show_files(&dir, prefix);
if (ps_matched) {
int bad;
bad = report_path_error(ps_matched, pathspec, prefix_offset);
if (bad)
fprintf(stderr, "Did you forget to 'git add'?\n");
return bad ? 1 : 0;
}
return 0;
| [
"993273596@qq.com"
] | 993273596@qq.com |
33324125b4b519cad20a46633a7db6fd453f7345 | eef1d936e9edb172703aecd40cace4fa64268934 | /src/161.cc | f2d30769814c22d2e8d12fb263e393929c406751 | [
"Apache-2.0"
] | permissive | o-olll/shuati | 59d964acd4f340ff392e95a625719c1bc88deab5 | 64a031a5218670afd4bdbba5d3af3c428757b3fd | refs/heads/master | 2022-01-04T05:29:05.932615 | 2021-12-30T08:23:46 | 2021-12-30T08:23:46 | 112,041,583 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 945 | cc | #include <iostream>
#include <vector>
#include <unordered_map>
#include <string>
#include "utils.h"
using namespace std;
bool isOneEditDistance(string s, string t)
{
int m, n;
bool changed = false;
m = s.size();
n = t.size();
if (m-n>1 || n-m>1)
return false;
if (m-n == 1) {
for (int p=0,q=0; p<m && q<n; ++p) {
if (s[p] != t[q]) {
if (changed)
return false;
changed = true;
} else {
++q;
}
}
return true;
} else if (m-n == -1) {
return isOneEditDistance(t, s);
}
for (int p=0,q=0; p<m; ++p,++q) {
if (s[p] != t[q]) {
if (changed)
return false;
changed = true;
}
}
return true;
}
int main(int argc, char** argv)
{
cout << boolalpha << isOneEditDistance(argv[1], argv[2]);
return 0;
}
| [
"o-olll@users.noreply.github.com"
] | o-olll@users.noreply.github.com |
311ab5108a44c133abbdaf5a87908e7bf6b41f58 | 64505206b174a88642833be436aa5fc2bdf8f777 | /dist/Mesa/src/glu/sgi/libnurbs/internals/mesher.h | 4ba67dceaa05b7988f8a74dbd88ea76809e79d16 | [] | no_license | noud/mouse-bsd-4.0.1-x | 3a51529924f50dcca4b1e923b2f9922d7c33d496 | 86c082b577d5fa54f056f9abb7dd0eb8b07c3bb6 | refs/heads/master | 2023-02-27T11:56:52.742306 | 2020-02-18T13:02:55 | 2020-02-18T13:02:55 | 334,542,495 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,178 | h | /*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
** Software License B, Version 1.1 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
**
** http://oss.sgi.com/projects/FreeB
**
** Note that, as provided in the License, the Software is distributed on an
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
**
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
**
** Additional Notice Provisions: The application programming interfaces
** established by SGI in conjunction with the Original Code are The
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
** Window System(R) (Version 1.3), released October 19, 1998. This software
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
** published by SGI, but has not been independently verified as being
** compliant with the OpenGL(R) version 1.2.1 Specification.
*/
/*
* mesher.h
*
* $Date: 2006/04/22 15:22:49 $ $Revision: 1.1.1.1 $
* $Header: /cvsroot/xsrc/dist/Mesa/src/glu/sgi/libnurbs/internals/mesher.h,v 1.1.1.1 2006/04/22 15:22:49 macallan Exp $
*/
#ifndef __glumesher_h_
#define __glumesher_h_
#include "hull.h"
class TrimRegion;
class Backend;
class Pool;
// struct GridTrimVertex;
class Mesher : virtual public TrimRegion, public Hull {
public:
Mesher( Backend & );
~Mesher( void );
void init( unsigned int );
void mesh( void );
private:
static const float ZERO;
Backend& backend;
Pool p;
unsigned int stacksize;
GridTrimVertex ** vdata;
GridTrimVertex * last[2];
int itop;
int lastedge;
inline void openMesh( void );
inline void swapMesh( void );
inline void closeMesh( void );
inline int isCcw( int );
inline int isCw( int );
inline void clearStack( void );
inline void push( GridTrimVertex * );
inline void pop( long );
inline void move( int, int );
inline int equal( int, int );
inline void copy( int, int );
inline void output( int );
void addUpper( void );
void addLower( void );
void addLast( void );
void finishUpper( GridTrimVertex * );
void finishLower( GridTrimVertex * );
};
#endif /* __glumesher_h_ */
| [
"mouse@Rodents-Montreal.ORG"
] | mouse@Rodents-Montreal.ORG |
32fe0e014e2bdc0329ba980cbd962684f1eae52f | 200d8b574156d328adfbb321bece55d120ba1f4d | /AnimationDemo/Includes/Renderers/OpenGLSkybox.h | d9c2f7c39f37a49562a679f8660493f37ce1258a | [] | no_license | MathewAloisio/Hale3D---Example-Projects | feed106311281553e123a9b41ff44c2f7639c3b9 | df89f4feca773d2f871619fbb363dadd6bb3d4a9 | refs/heads/master | 2020-05-20T09:34:12.433326 | 2019-05-08T02:38:42 | 2019-05-08T02:38:42 | 185,503,323 | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 980 | h | /*----------------------------------/
/------------OpenGLSkybox-----------/
/-------Hale Game Engine 2019-------/
/----Copyright © Mathew Aloisio-----/
/----------------------------------*/
#ifndef HALE3D_EXTERNAL_OGLSKYBOX
#define HALE3D_EXTERNAL_OGLSKYBOX
#include "OpenGLVertexBuffer.h"
/* Hale3D include(s). */
#include "Engine/Rendering/Skybox.h"
/* Standard include(s). */
#include <array>
namespace Hale3D {
class Camera;
/* OpenGLSkyboxBuffer. */
class OpenGLSkyboxBuffer : public OpenGLVertexBuffer {
public:
virtual void OnAllocate();
virtual void OnDeallocate();
virtual void OnBind();
};
/* OpenGLSkybox. */
class OpenGLSkybox {
public:
/* Constructor(s) & destructor(s). */
OpenGLSkybox();
~OpenGLSkybox();
/* General. */
void Draw(Camera* pCamera);
OpenGLSkyboxBuffer& GetBuffer();
/* Static constant member(s). */
static const std::array<Vector3, 36> VERTEX_POSITIONS;
protected:
OpenGLSkyboxBuffer _buffer;
};
}
#endif
| [
"codeblocks0101@gmail.com"
] | codeblocks0101@gmail.com |
d8638bdb4e47d476b124eee2abb154fb94c159b8 | 9b8591c5f2a54cc74c73a30472f97909e35f2ecf | /codegen/QtWidgets/QGraphicsSceneSlots.cpp | 082e4fe434e710b12feac2caeed1c1ba6a8b896a | [
"MIT"
] | permissive | tnsr1/Qt5xHb | d3a9396a6ad5047010acd5d8459688e6e07e49c2 | 04b6bd5d8fb08903621003fa5e9b61b831c36fb3 | refs/heads/master | 2021-05-17T11:15:52.567808 | 2020-03-26T06:52:17 | 2020-03-26T06:52:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 386 | cpp | %%
%% Qt5xHb - Bindings libraries for Harbour/xHarbour and Qt Framework 5
%%
%% Copyright (C) 2020 Marcos Antonio Gambeta <marcosgambeta AT outlook DOT com>
%%
$project=Qt5xHb
$module=QtWidgets
$header
$includes
$beginSlotsClass
$slot=|changed( const QList<QRectF> & region )
$slot=|sceneRectChanged( const QRectF & rect )
$slot=|selectionChanged()
$endSlotsClass
| [
"5998677+marcosgambeta@users.noreply.github.com"
] | 5998677+marcosgambeta@users.noreply.github.com |
e62112b70ea07c659264657f94f6d6d26fcf265c | 6a3f420940c6646361908543266e398b87bf4555 | /debugger/src/cpu_sysc_plugin/riverlib/core/proc.h | c046ef773f6e90e59daed6967848abc87a7b178c | [
"Apache-2.0",
"BSD-3-Clause"
] | permissive | omkarkavi/riscv_vhdl | a12c19d217771a4aa49d722f75e60459566c2bed | accb3fd5da77f24a6d5f93ddc9f7736db125489b | refs/heads/master | 2020-09-06T12:57:34.246637 | 2019-11-08T00:42:14 | 2019-11-08T00:42:14 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,040 | h | /*
* Copyright 2019 Sergey Khabarov, sergeykhbr@gmail.com
*
* 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 __DEBUGGER_RIVERLIB_PROC_H__
#define __DEBUGGER_RIVERLIB_PROC_H__
#include <systemc.h>
#include "../river_cfg.h"
#include "fetch.h"
#include "decoder.h"
#include "execute.h"
#include "memaccess.h"
#include "execute.h"
#include "regibank.h"
#include "csr.h"
#include "br_predic.h"
#include "dbg_port.h"
#include "regfbank.h"
#include <fstream>
namespace debugger {
SC_MODULE(Processor) {
sc_in<bool> i_clk; // CPU clock
sc_in<bool> i_nrst; // Reset. Active LOW
// Control path:
sc_in<bool> i_req_ctrl_ready; // ICache is ready to accept request
sc_out<bool> o_req_ctrl_valid; // Request to ICache is valid
sc_out<sc_uint<BUS_ADDR_WIDTH>> o_req_ctrl_addr; // Requesting address to ICache
sc_in<bool> i_resp_ctrl_valid; // ICache response is valid
sc_in<sc_uint<BUS_ADDR_WIDTH>> i_resp_ctrl_addr; // Response address must be equal to the latest request address
sc_in<sc_uint<32>> i_resp_ctrl_data; // Read value
sc_in<bool> i_resp_ctrl_load_fault;
sc_out<bool> o_resp_ctrl_ready; // Core is ready to accept response from ICache
// Data path:
sc_in<bool> i_req_data_ready; // DCache is ready to accept request
sc_out<bool> o_req_data_valid; // Request to DCache is valid
sc_out<bool> o_req_data_write; // Read/Write transaction
sc_out<sc_uint<2>> o_req_data_size; // Size [Bytes]: 0=1B; 1=2B; 2=4B; 3=8B
sc_out<sc_uint<BUS_ADDR_WIDTH>> o_req_data_addr; // Requesting address to DCache
sc_out<sc_uint<RISCV_ARCH>> o_req_data_data; // Writing value
sc_in<bool> i_resp_data_valid; // DCache response is valid
sc_in<sc_uint<BUS_ADDR_WIDTH>> i_resp_data_addr; // DCache response address must be equal to the latest request address
sc_in<sc_uint<RISCV_ARCH>> i_resp_data_data; // Read value
sc_in<bool> i_resp_data_load_fault; // Bus response with SLVERR or DECERR on read
sc_in<bool> i_resp_data_store_fault; // Bus response with SLVERR or DECERR on write
sc_in<sc_uint<BUS_ADDR_WIDTH>> i_resp_data_store_fault_addr; // write-error address (B-channel)
sc_out<bool> o_resp_data_ready; // Core is ready to accept response from DCache
// External interrupt pin
sc_in<bool> i_ext_irq; // PLIC interrupt accordingly with spec
sc_out<sc_uint<64>> o_time; // Clock/Step counter depending attribute "GenerateRef"
// Debug interface
sc_in<bool> i_dport_valid; // Debug access from DSU is valid
sc_in<bool> i_dport_write; // Write command flag
sc_in<sc_uint<2>> i_dport_region; // Registers region ID: 0=CSR; 1=IREGS; 2=Control
sc_in<sc_uint<12>> i_dport_addr; // Register idx
sc_in<sc_uint<RISCV_ARCH>> i_dport_wdata; // Write value
sc_out<bool> o_dport_ready; // Response is ready
sc_out<sc_uint<RISCV_ARCH>> o_dport_rdata; // Response value
sc_out<bool> o_halted; // CPU halted via debug interface
// Cache debug signals:
sc_out<sc_uint<BUS_ADDR_WIDTH>> o_flush_address; // Address of instruction to remove from ICache
sc_out<bool> o_flush_valid; // Remove address from ICache is valid
sc_in<sc_uint<2>> i_istate; // ICache transaction state
sc_in<sc_uint<2>> i_dstate; // DCache transaction state
sc_in<sc_uint<2>> i_cstate; // CacheTop state machine value
void comb();
void negedge_proc();
void dbg_print();
void generateRef(bool v);
void generateVCD(sc_trace_file *i_vcd, sc_trace_file *o_vcd);
SC_HAS_PROCESS(Processor);
Processor(sc_module_name name_, uint32_t hartid, bool async_reset);
virtual ~Processor();
private:
struct FetchType {
sc_signal<bool> req_fire;
sc_signal<bool> load_fault;
sc_signal<bool> valid;
sc_signal<sc_uint<BUS_ADDR_WIDTH>> pc;
sc_signal<sc_uint<32>> instr;
sc_signal<bool> imem_req_valid;
sc_signal<sc_uint<BUS_ADDR_WIDTH>> imem_req_addr;
sc_signal<bool> pipeline_hold;
};
struct InstructionDecodeType {
sc_signal<sc_uint<BUS_ADDR_WIDTH>> pc;
sc_signal<sc_uint<32>> instr;
sc_signal<bool> instr_valid;
sc_signal<bool> memop_store;
sc_signal<bool> memop_load;
sc_signal<bool> memop_sign_ext;
sc_signal<sc_uint<2>> memop_size;
sc_signal<bool> rv32; // 32-bits instruction
sc_signal<bool> compressed; // C-extension
sc_signal<bool> f64; // D-extension (FPU)
sc_signal<bool> unsigned_op; // Unsigned operands
sc_signal<sc_bv<ISA_Total>> isa_type;
sc_signal<sc_bv<Instr_Total>> instr_vec;
sc_signal<bool> exception;
};
struct ExecuteType {
sc_signal<bool> trap_ready;
sc_signal<bool> valid;
sc_signal<sc_uint<32>> instr;
sc_signal<sc_uint<BUS_ADDR_WIDTH>> pc;
sc_signal<sc_uint<BUS_ADDR_WIDTH>> npc;
sc_signal<sc_uint<BUS_ADDR_WIDTH>> ex_npc;
sc_signal<sc_uint<6>> radr1;
sc_signal<sc_uint<6>> radr2;
sc_signal<sc_uint<6>> res_addr;
sc_signal<sc_uint<RISCV_ARCH>> res_data;
sc_signal<bool> mret;
sc_signal<bool> uret;
sc_signal<sc_uint<12>> csr_addr;
sc_signal<bool> csr_wena;
sc_signal<sc_uint<RISCV_ARCH>> csr_wdata;
sc_signal<bool> ex_illegal_instr;
sc_signal<bool> ex_unalign_load;
sc_signal<bool> ex_unalign_store;
sc_signal<bool> ex_breakpoint;
sc_signal<bool> ex_ecall;
sc_signal<bool> ex_fpu_invalidop; // FPU Exception: invalid operation
sc_signal<bool> ex_fpu_divbyzero; // FPU Exception: divide by zero
sc_signal<bool> ex_fpu_overflow; // FPU Exception: overflow
sc_signal<bool> ex_fpu_underflow; // FPU Exception: underflow
sc_signal<bool> ex_fpu_inexact; // FPU Exception: inexact
sc_signal<bool> fpu_valid;
sc_signal<bool> memop_sign_ext;
sc_signal<bool> memop_load;
sc_signal<bool> memop_store;
sc_signal<sc_uint<2>> memop_size;
sc_signal<sc_uint<BUS_ADDR_WIDTH>> memop_addr;
sc_signal<bool> pipeline_hold; // Hold pipeline from Execution stage
sc_signal<bool> call; // pseudo-instruction CALL
sc_signal<bool> ret; // pseudo-instruction RET
};
struct MemoryType {
sc_signal<bool> valid;
sc_signal<sc_uint<32>> instr;
sc_signal<sc_uint<BUS_ADDR_WIDTH>> pc;
sc_signal<bool> pipeline_hold;
};
struct WriteBackType {
sc_signal<sc_uint<BUS_ADDR_WIDTH>> pc;
sc_signal<bool> wena;
sc_signal<sc_uint<6>> waddr;
sc_signal<sc_uint<RISCV_ARCH>> wdata;
};
struct IntRegsType {
sc_signal<sc_uint<RISCV_ARCH>> rdata1;
sc_signal<sc_uint<RISCV_ARCH>> rdata2;
sc_signal<sc_uint<RISCV_ARCH>> dport_rdata;
sc_signal<sc_uint<RISCV_ARCH>> ra; // Return address
sc_signal<sc_uint<RISCV_ARCH>> sp; // Stack pointer
} ireg;
struct FloatRegsType {
sc_signal<sc_uint<RISCV_ARCH>> rdata1;
sc_signal<sc_uint<RISCV_ARCH>> rdata2;
sc_signal<sc_uint<RISCV_ARCH>> dport_rdata;
} freg;
struct CsrType {
sc_signal<sc_uint<RISCV_ARCH>> rdata;
sc_signal<sc_uint<RISCV_ARCH>> dport_rdata;
sc_signal<bool> trap_valid;
sc_signal<sc_uint<BUS_ADDR_WIDTH>> trap_pc;
sc_signal<bool> break_event; // ebreak detected 1 clock pulse
} csr;
struct DebugType {
sc_signal<sc_uint<12>> core_addr; // Address of the sub-region register
sc_signal<sc_uint<RISCV_ARCH>> core_wdata; // Write data
sc_signal<bool> csr_ena; // Region 0: Access to CSR bank is enabled.
sc_signal<bool> csr_write; // Region 0: CSR write enable
sc_signal<bool> ireg_ena; // Region 1: Access to integer register bank is enabled
sc_signal<bool> ireg_write; // Region 1: Integer registers bank write pulse
sc_signal<bool> freg_ena; // Region 1: Access to float register bank is enabled
sc_signal<bool> freg_write; // Region 1: Float registers bank write pulse
sc_signal<bool> npc_write; // Region 1: npc write enable
sc_signal<bool> halt; // Halt signal is equal to hold pipeline
sc_signal<sc_uint<64>> clock_cnt; // Number of clocks excluding halt state
sc_signal<sc_uint<64>> executed_cnt; // Number of executed instruction
sc_signal<bool> break_mode; // Behaviour on EBREAK instruction: 0 = halt; 1 = generate trap
sc_signal<bool> br_fetch_valid; // Fetch injection address/instr are valid
sc_signal<sc_uint<BUS_ADDR_WIDTH>> br_address_fetch; // Fetch injection address to skip ebreak instruciton only once
sc_signal<sc_uint<32>> br_instr_fetch; // Real instruction value that was replaced by ebreak
sc_signal<sc_uint<BUS_ADDR_WIDTH>> flush_address; // Address of instruction to remove from ICache
sc_signal<bool> flush_valid; // Remove address from ICache is valid
} dbg;
struct BranchPredictorType {
sc_signal<sc_uint<BUS_ADDR_WIDTH>> npc;
} bp;
/** 5-stages CPU pipeline */
struct PipelineType {
FetchType f; // Fetch instruction stage
InstructionDecodeType d; // Decode instruction stage
ExecuteType e; // Execute instruction
MemoryType m; // Memory load/store
WriteBackType w; // Write back registers value
} w;
sc_signal<sc_uint<5>> wb_ireg_dport_addr;
sc_signal<sc_uint<5>> wb_freg_dport_addr;
sc_signal<sc_uint<BUS_ADDR_WIDTH>> wb_exec_dport_npc;
sc_signal<bool> w_fetch_pipeline_hold;
sc_signal<bool> w_any_pipeline_hold;
sc_signal<bool> w_exec_pipeline_hold;
InstrFetch *fetch0;
InstrDecoder *dec0;
InstrExecute *exec0;
MemAccess *mem0;
BranchPredictor *predic0;
RegIntBank *iregs0;
RegFloatBank *fregs0;
CsrRegs *csr0;
DbgPort *dbg0;
/** Used only for reference trace generation to compare with
functional model */
bool generate_ref_;
sc_event print_event_;
char tstr[1024];
ofstream *reg_dbg;
ofstream *mem_dbg;
bool mem_dbg_write_flag;
uint64_t dbg_mem_value_mask;
uint64_t dbg_mem_write_value;
};
} // namespace debugger
#endif // __DEBUGGER_RIVERLIB_PROC_H__
| [
"sergeykhbr@gmail.com"
] | sergeykhbr@gmail.com |
a3de5e89c08f976cbadd18deb995113b70e7ed33 | c68f791005359cfec81af712aae0276c70b512b0 | /0-unclassified/unique.cpp | 454fe834af9d39c7ac3324145d92fa59cd48e339 | [] | no_license | luqmanarifin/cp | 83b3435ba2fdd7e4a9db33ab47c409adb088eb90 | 08c2d6b6dd8c4eb80278ec34dc64fd4db5878f9f | refs/heads/master | 2022-10-16T14:30:09.683632 | 2022-10-08T20:35:42 | 2022-10-08T20:35:42 | 51,346,488 | 106 | 46 | null | 2017-04-16T11:06:18 | 2016-02-09T04:26:58 | C++ | UTF-8 | C++ | false | false | 1,540 | cpp | #include <bits/stdc++.h>
using namespace std;
#define LL long long
#define DB double
#define sf scanf
#define pf printf
#define nl printf("\n")
#define FOR(i,a,b) for(i = a; i <= b; ++i)
#define FORD(i,a,b) for(i = a; i >= b; --i)
#define FORS(i,n) for(i = 0; i < n; ++i)
#define FORM(i,n) for(i = n - 1; i >= 0; --i)
#define reset(i,n) memset(i, n, sizeof(i))
#define open freopen("input.txt","r",stdin); freopen("output.txt","w",stdout)
#define close fclose(stdin); fclose(stdout)
#define mp make_pair
#define isi first
#define init second
const LL mod = 1e9 + 7;
const int N = 1e5 + 5;
int gcd(int a, int b) { return b? gcd(b, a%b): a; }
int lcm(int a, int b) { return a*b / gcd(a, b); }
pair<int,int> a[N], b[N], num[N];
bool byInit(const pair<int,int> &lef, const pair<int,int> &rig) {
return lef.init < rig.init;
}
int main(void)
{
int i, n; sf("%d", &n);
FOR(i,1,n) {
sf("%d", &num[i].isi);
num[i].init = i;
}
sort(num + 1, num + 1 + n);
FOR(i,1,n) a[i].init = b[i].init = num[i].init;
int amax = n/3 + (n % 3 > 0);
int bmax = n/3 + (n % 3 == 2);
i = 1;
while(i <= amax) {
a[i].isi = i - 1;
b[i].isi = num[i].isi - i + 1;
++i;
}
int j = 1;
while(j <= bmax) {
a[i].isi = num[i].isi - i + 1;
b[i].isi = i - 1;
++i;
++j;
}
--amax;
while(i <= n) {
a[i].isi = num[i].isi - amax;
b[i].isi = amax;
--amax;
++i;
}
sort(a + 1, a + 1 + n, byInit);
sort(b + 1, b + 1 + n, byInit);
puts("YES");
FOR(i,1,n) pf("%d ", a[i].isi); nl;
FOR(i,1,n) pf("%d ", b[i].isi); nl;
return 0;
}
| [
"l.arifin.siswanto@gmail.com"
] | l.arifin.siswanto@gmail.com |
a3f3b7561a8dd715839e89be22b786d96763c5dd | e97672d82caaca7de4f1bde83d077c3c61eff9d5 | /2021/Eduardo/Daily Practice/June/13 - URI 2369.cpp | 4638017a7f98637ea95e163f1937a62293aff76d | [] | no_license | lucioeduardo/competitive-codes | 3345c48ff6ee7e5c9dd32fff8cf2db1d0904f5e2 | cbb8be67f0dd4c92124378cfbc07a34ab6b58c42 | refs/heads/master | 2021-11-22T21:12:25.346487 | 2021-10-19T11:48:51 | 2021-10-19T11:48:51 | 141,634,356 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 337 | cpp | #include<bits/stdc++.h>
#define MOD 1000000007
#define init_arr(arr,val) memset(arr,val,sizeof(arr))
#define ll long long
using namespace std;
int main(){
int n;
cin>>n;
int res = 7;
if(n > 10) res += min(n,30)-10;
if(n > 30) res += (min(n,100)-30)*2;
if(n > 100) res += (n-100)*5;
cout << res << endl;
return 0;
} | [
"eduardo.lucio.correia@gmail.com"
] | eduardo.lucio.correia@gmail.com |
51eefa2f0f799d8849332e9465128a63981e6996 | 56621ec414e584a34c6b97cb300eff3ce6c3c33b | /src/captain/CaptPMTBuilder.cc | caaf7585821b50d9e4d06f6b2cc58158ebd4a540 | [
"MIT"
] | permissive | ClarkMcGrew/edep-sim | ffa6152c7efa7bd0e1b4490f36a4061ad46b4cd5 | 0a6975949368dc50c4802f1511f4bbd52d5b7cf9 | refs/heads/master | 2023-04-30T08:46:56.180118 | 2022-08-04T13:49:14 | 2022-08-04T13:49:14 | 85,212,455 | 23 | 29 | NOASSERTION | 2023-04-24T11:09:44 | 2017-03-16T15:36:39 | C++ | UTF-8 | C++ | false | false | 5,095 | cc | #include "CaptPMTBuilder.hh"
#include "EDepSimBuilder.hh"
#include "EDepSimLog.hh"
#include <globals.hh>
#include <G4Material.hh>
#include <G4LogicalVolume.hh>
#include <G4VPhysicalVolume.hh>
#include <G4PVPlacement.hh>
#include <G4VisAttributes.hh>
#include <G4SystemOfUnits.hh>
#include <G4PhysicalConstants.hh>
#include <G4Polyhedra.hh>
#include <G4Box.hh>
#include <G4Tubs.hh>
#include <cmath>
class CaptPMTMessenger
: public EDepSim::BuilderMessenger {
private:
CaptPMTBuilder* fBuilder;
G4UIcmdWithADoubleAndUnit* fSizeCMD;
G4UIcmdWithADoubleAndUnit* fBaseLengthCMD;
G4UIcmdWithABool* fRoundCMD;
public:
CaptPMTMessenger(CaptPMTBuilder* c)
: EDepSim::BuilderMessenger(c,"Control the PMT construction."),
fBuilder(c) {
fSizeCMD
= new G4UIcmdWithADoubleAndUnit(CommandName("size"),this);
fSizeCMD->SetGuidance("Set the PMT size.");
fSizeCMD->SetParameterName("size",false);
fSizeCMD->SetUnitCategory("Length");
fBaseLengthCMD = new G4UIcmdWithADoubleAndUnit(
CommandName("baseLength"),this);
fBaseLengthCMD->SetGuidance("Set the PMT base length.");
fBaseLengthCMD->SetParameterName("length",false);
fBaseLengthCMD->SetUnitCategory("Length");
fRoundCMD = new G4UIcmdWithABool(
CommandName("round"),this);
fRoundCMD->SetGuidance("Flag that the PMT is round.");
}
virtual ~CaptPMTMessenger() {
delete fSizeCMD;
delete fBaseLengthCMD;
delete fRoundCMD;
}
void SetNewValue(G4UIcommand *cmd, G4String val) {
if (cmd==fSizeCMD) {
fBuilder->SetSize(fSizeCMD->GetNewDoubleValue(val));
}
else if (cmd==fBaseLengthCMD) {
fBuilder->SetBaseLength(fBaseLengthCMD->GetNewDoubleValue(val));
}
else if (cmd==fRoundCMD) {
fBuilder->SetRound(fRoundCMD->GetNewBoolValue(val));
}
else {
EDepSim::BuilderMessenger::SetNewValue(cmd,val);
}
}
};
void CaptPMTBuilder::Init(void) {
SetMessenger(new CaptPMTMessenger(this));
SetSize(25*CLHEP::mm);
SetBaseLength(25*CLHEP::mm);
}
CaptPMTBuilder::~CaptPMTBuilder() {}
G4LogicalVolume *CaptPMTBuilder::GetPiece(void) {
const double glassThickness = 3*CLHEP::mm;
G4LogicalVolume* logVolume
= new G4LogicalVolume(new G4Tubs(GetName(),
0.0, GetSize()/2.0,
GetBaseLength()/2,
0*CLHEP::degree, 360*CLHEP::degree),
FindMaterial("Glass"),
GetName());
logVolume->SetVisAttributes(GetColor(logVolume));
// Construct the photo cathode volume.
std::string namePhotoCathode = GetName() + "/PhotoCathode";
G4LogicalVolume* logPhotoCathode
= new G4LogicalVolume(new G4Tubs(namePhotoCathode,
0.0, GetSize()/2.0,
glassThickness/2.0,
0*CLHEP::degree, 360*CLHEP::degree),
FindMaterial("Glass"),
namePhotoCathode);
logPhotoCathode->SetVisAttributes(GetColor(logPhotoCathode));
// Place the vessel components.
new G4PVPlacement(NULL, // rotation.
G4ThreeVector(0,0,
GetBaseLength()/2.0 - glassThickness/2.0),
logPhotoCathode, // logical volume
logPhotoCathode->GetName(), // name
logVolume, // mother volume
false, // (not used)
0, // Copy number (zero)
Check()); // Check overlaps.
// Construct the vacuum.
std::string namePMTVoid = GetName() + "/PMTVoid";
G4LogicalVolume* logPMTVoid
= new G4LogicalVolume(new G4Tubs(namePMTVoid,
0.0, GetSize()/2.0-glassThickness,
GetBaseLength()/2.0-glassThickness,
0*CLHEP::degree, 360*CLHEP::degree),
FindMaterial("Air"), // should be vacuum...
namePMTVoid);
logPMTVoid->SetVisAttributes(GetColor(logPMTVoid));
// Place the vessel components.
new G4PVPlacement(NULL, // rotation.
G4ThreeVector(0,0,0),
logPMTVoid, // logical volume
logPMTVoid->GetName(), // name
logVolume, // mother volume
false, // (not used)
0, // Copy number (zero)
Check()); // Check overlaps.
return logVolume;
}
| [
"clark.mcgrew@stonybrook.edu"
] | clark.mcgrew@stonybrook.edu |
40adfccccc197a2c176171db8d776ef59b05fe06 | 536656cd89e4fa3a92b5dcab28657d60d1d244bd | /chrome/browser/profile_resetter/resettable_settings_snapshot.cc | bbd5f93796718ab560e08cf8d5f4092eb0137882 | [
"BSD-3-Clause"
] | permissive | ECS-251-W2020/chromium | 79caebf50443f297557d9510620bf8d44a68399a | ac814e85cb870a6b569e184c7a60a70ff3cb19f9 | refs/heads/master | 2022-08-19T17:42:46.887573 | 2020-03-18T06:08:44 | 2020-03-18T06:08:44 | 248,141,336 | 7 | 8 | BSD-3-Clause | 2022-07-06T20:32:48 | 2020-03-18T04:52:18 | null | UTF-8 | C++ | false | false | 12,754 | cc | // Copyright (c) 2013 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/profile_resetter/resettable_settings_snapshot.h"
#include <memory>
#include <utility>
#include "base/bind.h"
#include "base/guid.h"
#include "base/hash/md5.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/synchronization/atomic_flag.h"
#include "base/task/post_task.h"
#include "base/task/task_traits.h"
#include "base/task_runner_util.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_content_browser_client.h"
#include "chrome/browser/profile_resetter/profile_reset_report.pb.h"
#include "chrome/browser/profile_resetter/reset_report_uploader.h"
#include "chrome/browser/profile_resetter/reset_report_uploader_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/common/channel_info.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "components/prefs/pref_service.h"
#include "components/search_engines/template_url_service.h"
#include "components/strings/grit/components_strings.h"
#include "components/version_info/version_info.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/extension_registry.h"
#include "ui/base/l10n/l10n_util.h"
namespace {
template <class StringType>
void AddPair(base::ListValue* list,
const base::string16& key,
const StringType& value) {
std::unique_ptr<base::DictionaryValue> results(new base::DictionaryValue());
results->SetString("key", key);
results->SetString("value", value);
list->Append(std::move(results));
}
} // namespace
ResettableSettingsSnapshot::ResettableSettingsSnapshot(Profile* profile)
: startup_(SessionStartupPref::GetStartupPref(profile)),
shortcuts_determined_(false) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
// URLs are always stored sorted.
std::sort(startup_.urls.begin(), startup_.urls.end());
PrefService* prefs = profile->GetPrefs();
DCHECK(prefs);
homepage_ = prefs->GetString(prefs::kHomePage);
homepage_is_ntp_ = prefs->GetBoolean(prefs::kHomePageIsNewTabPage);
show_home_button_ = prefs->GetBoolean(prefs::kShowHomeButton);
TemplateURLService* service =
TemplateURLServiceFactory::GetForProfile(profile);
DCHECK(service);
const TemplateURL* dse = service->GetDefaultSearchProvider();
if (dse)
dse_url_ = dse->url();
const extensions::ExtensionSet& enabled_ext =
extensions::ExtensionRegistry::Get(profile)->enabled_extensions();
enabled_extensions_.reserve(enabled_ext.size());
for (extensions::ExtensionSet::const_iterator it = enabled_ext.begin();
it != enabled_ext.end(); ++it)
enabled_extensions_.push_back(std::make_pair((*it)->id(), (*it)->name()));
// ExtensionSet is sorted but it seems to be an implementation detail.
std::sort(enabled_extensions_.begin(), enabled_extensions_.end());
// Calculate the MD5 sum of the GUID to make sure that no part of the GUID
// contains information identifying the sender of the report.
guid_ = base::MD5String(base::GenerateGUID());
}
ResettableSettingsSnapshot::~ResettableSettingsSnapshot() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (cancellation_flag_.get())
cancellation_flag_->data.Set();
}
void ResettableSettingsSnapshot::Subtract(
const ResettableSettingsSnapshot& snapshot) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
ExtensionList extensions = base::STLSetDifference<ExtensionList>(
enabled_extensions_, snapshot.enabled_extensions_);
enabled_extensions_.swap(extensions);
}
int ResettableSettingsSnapshot::FindDifferentFields(
const ResettableSettingsSnapshot& snapshot) const {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
int bit_mask = 0;
if (startup_.type != snapshot.startup_.type ||
startup_.urls != snapshot.startup_.urls)
bit_mask |= STARTUP_MODE;
if (homepage_is_ntp_ != snapshot.homepage_is_ntp_ ||
homepage_ != snapshot.homepage_ ||
show_home_button_ != snapshot.show_home_button_)
bit_mask |= HOMEPAGE;
if (dse_url_ != snapshot.dse_url_)
bit_mask |= DSE_URL;
if (enabled_extensions_ != snapshot.enabled_extensions_)
bit_mask |= EXTENSIONS;
if (shortcuts_ != snapshot.shortcuts_)
bit_mask |= SHORTCUTS;
static_assert(ResettableSettingsSnapshot::ALL_FIELDS == 31,
"new field needs to be added here");
return bit_mask;
}
void ResettableSettingsSnapshot::RequestShortcuts(
const base::Closure& callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(!cancellation_flag_.get() && !shortcuts_determined());
cancellation_flag_ = new SharedCancellationFlag;
#if defined(OS_WIN)
base::PostTaskAndReplyWithResult(
base::CreateCOMSTATaskRunner({base::ThreadPool(), base::MayBlock(),
base::TaskPriority::USER_VISIBLE})
.get(),
FROM_HERE, base::BindOnce(&GetChromeLaunchShortcuts, cancellation_flag_),
base::BindOnce(&ResettableSettingsSnapshot::SetShortcutsAndReport,
weak_ptr_factory_.GetWeakPtr(), callback));
#else // defined(OS_WIN)
// Shortcuts are only supported on Windows.
std::vector<ShortcutCommand> no_shortcuts;
base::SequencedTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(&ResettableSettingsSnapshot::SetShortcutsAndReport,
weak_ptr_factory_.GetWeakPtr(), callback,
std::move(no_shortcuts)));
#endif // defined(OS_WIN)
}
void ResettableSettingsSnapshot::SetShortcutsAndReport(
const base::Closure& callback,
const std::vector<ShortcutCommand>& shortcuts) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
shortcuts_ = shortcuts;
shortcuts_determined_ = true;
cancellation_flag_.reset();
if (!callback.is_null())
callback.Run();
}
std::unique_ptr<reset_report::ChromeResetReport> SerializeSettingsReportToProto(
const ResettableSettingsSnapshot& snapshot,
int field_mask) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
std::unique_ptr<reset_report::ChromeResetReport> report(
new reset_report::ChromeResetReport());
if (field_mask & ResettableSettingsSnapshot::STARTUP_MODE) {
for (const auto& url : snapshot.startup_urls())
report->add_startup_url_path(url.spec());
switch (snapshot.startup_type()) {
case SessionStartupPref::DEFAULT:
report->set_startup_type(
reset_report::ChromeResetReport_SessionStartupType_DEFAULT);
break;
case SessionStartupPref::LAST:
report->set_startup_type(
reset_report::ChromeResetReport_SessionStartupType_LAST);
break;
case SessionStartupPref::URLS:
report->set_startup_type(
reset_report::ChromeResetReport_SessionStartupType_URLS);
break;
}
}
if (field_mask & ResettableSettingsSnapshot::HOMEPAGE) {
report->set_homepage_path(snapshot.homepage());
report->set_homepage_is_new_tab_page(snapshot.homepage_is_ntp());
report->set_show_home_button(snapshot.show_home_button());
}
if (field_mask & ResettableSettingsSnapshot::DSE_URL)
report->set_default_search_engine_path(snapshot.dse_url());
if (field_mask & ResettableSettingsSnapshot::EXTENSIONS) {
for (const auto& enabled_extension : snapshot.enabled_extensions()) {
reset_report::ChromeResetReport_Extension* new_extension =
report->add_enabled_extensions();
new_extension->set_extension_id(enabled_extension.first);
new_extension->set_extension_name(enabled_extension.second);
}
}
if (field_mask & ResettableSettingsSnapshot::SHORTCUTS) {
for (const auto& shortcut_command : snapshot.shortcuts())
report->add_shortcuts(base::UTF16ToUTF8(shortcut_command.second));
}
report->set_guid(snapshot.guid());
static_assert(ResettableSettingsSnapshot::ALL_FIELDS == 31,
"new field needs to be serialized here");
return report;
}
void SendSettingsFeedbackProto(const reset_report::ChromeResetReport& report,
Profile* profile) {
ResetReportUploaderFactory::GetForBrowserContext(profile)
->DispatchReport(report);
}
std::unique_ptr<base::ListValue> GetReadableFeedbackForSnapshot(
Profile* profile,
const ResettableSettingsSnapshot& snapshot) {
DCHECK(profile);
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
std::unique_ptr<base::ListValue> list(new base::ListValue);
AddPair(list.get(),
l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_LOCALE),
g_browser_process->GetApplicationLocale());
AddPair(list.get(),
l10n_util::GetStringUTF16(IDS_VERSION_UI_USER_AGENT),
GetUserAgent());
std::string version = version_info::GetVersionNumber();
version += chrome::GetChannelName();
AddPair(list.get(),
l10n_util::GetStringUTF16(IDS_PRODUCT_NAME),
version);
// Add snapshot data.
const std::vector<GURL>& urls = snapshot.startup_urls();
std::string startup_urls;
for (auto i = urls.begin(); i != urls.end(); ++i) {
if (!startup_urls.empty())
startup_urls += ' ';
startup_urls += i->host();
}
if (!startup_urls.empty()) {
AddPair(list.get(),
l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_STARTUP_URLS),
startup_urls);
}
base::string16 startup_type;
switch (snapshot.startup_type()) {
case SessionStartupPref::DEFAULT:
startup_type =
l10n_util::GetStringUTF16(IDS_SETTINGS_ON_STARTUP_OPEN_NEW_TAB);
break;
case SessionStartupPref::LAST:
startup_type =
l10n_util::GetStringUTF16(IDS_SETTINGS_ON_STARTUP_CONTINUE);
break;
case SessionStartupPref::URLS:
startup_type =
l10n_util::GetStringUTF16(IDS_SETTINGS_ON_STARTUP_OPEN_SPECIFIC);
break;
default:
break;
}
AddPair(list.get(),
l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_STARTUP_TYPE),
startup_type);
if (!snapshot.homepage().empty()) {
AddPair(list.get(),
l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_HOMEPAGE),
snapshot.homepage());
}
int is_ntp_message_id = snapshot.homepage_is_ntp()
? IDS_RESET_PROFILE_SETTINGS_YES
: IDS_RESET_PROFILE_SETTINGS_NO;
AddPair(list.get(),
l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_HOMEPAGE_IS_NTP),
l10n_util::GetStringUTF16(is_ntp_message_id));
int show_home_button_id = snapshot.show_home_button()
? IDS_RESET_PROFILE_SETTINGS_YES
: IDS_RESET_PROFILE_SETTINGS_NO;
AddPair(
list.get(),
l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_SHOW_HOME_BUTTON),
l10n_util::GetStringUTF16(show_home_button_id));
TemplateURLService* service =
TemplateURLServiceFactory::GetForProfile(profile);
DCHECK(service);
const TemplateURL* dse = service->GetDefaultSearchProvider();
if (dse) {
AddPair(list.get(),
l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_DSE),
dse->GenerateSearchURL(service->search_terms_data()).host());
}
if (snapshot.shortcuts_determined()) {
base::string16 shortcut_targets;
const std::vector<ShortcutCommand>& shortcuts = snapshot.shortcuts();
for (auto i = shortcuts.begin(); i != shortcuts.end(); ++i) {
if (!shortcut_targets.empty())
shortcut_targets += base::ASCIIToUTF16("\n");
shortcut_targets += base::ASCIIToUTF16("chrome.exe ");
shortcut_targets += i->second;
}
if (!shortcut_targets.empty()) {
AddPair(list.get(),
l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_SHORTCUTS),
shortcut_targets);
}
} else {
AddPair(list.get(),
l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_SHORTCUTS),
l10n_util::GetStringUTF16(
IDS_RESET_PROFILE_SETTINGS_PROCESSING_SHORTCUTS));
}
const ResettableSettingsSnapshot::ExtensionList& extensions =
snapshot.enabled_extensions();
std::string extension_names;
for (auto i = extensions.begin(); i != extensions.end(); ++i) {
if (!extension_names.empty())
extension_names += '\n';
extension_names += i->second;
}
if (!extension_names.empty()) {
AddPair(list.get(),
l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_EXTENSIONS),
extension_names);
}
return list;
}
| [
"pcding@ucdavis.edu"
] | pcding@ucdavis.edu |
36cddebbba2493ae702c573a5ca0f224fa3c8bec | 4bea57e631734f8cb1c230f521fd523a63c1ff23 | /projects/openfoam/rarefied-flows/impingment/sims/test/nozzle1/8.7/rho | 58ed1bd385a6f692d202188a1fabc82e60c3cf52 | [] | no_license | andytorrestb/cfal | 76217f77dd43474f6b0a7eb430887e8775b78d7f | 730fb66a3070ccb3e0c52c03417e3b09140f3605 | refs/heads/master | 2023-07-04T01:22:01.990628 | 2021-08-01T15:36:17 | 2021-08-01T15:36:17 | 294,183,829 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 17,977 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1912 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "8.7";
object rho;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -3 0 0 0 0 0];
internalField nonuniform List<scalar>
1900
(
11670.2
11185.3
11871.1
12439.9
12652.3
12677.5
12650.1
12565.8
12467.9
12365.6
11670.2
11185.3
11871.1
12440.1
12652.2
12677.2
12649.5
12566.3
12478.4
12384.4
11670.2
11185.3
11871.1
12440.3
12652.4
12677.5
12650.1
12563.5
12465.5
12370
11670.2
11185.3
11871.1
12440.1
12652.2
12677.2
12649.5
12566.3
12478.4
12384.4
11670.2
11185.3
11871.1
12439.9
12652.3
12677.5
12650.1
12565.8
12467.9
12365.6
12465.6
12302
12181.3
11841.9
11739.2
12332.3
12225.1
12121.6
11801.1
11343.1
12304.9
12208.3
12120.2
11840.3
11411.5
12332.3
12225.1
12121.6
11801.1
11343.1
12465.6
12302
12181.3
11841.9
11739.2
6229.47
4235.87
3271.79
2751.66
2197.22
6870.03
4562.94
3457.88
2897.73
2301.66
7058.15
4519.03
3384.85
2838.64
2223.47
6870.03
4562.94
3457.88
2897.73
2301.66
6229.47
4235.87
3271.79
2751.66
2197.22
2460.06
2695.18
2747.56
2749.08
2707.56
2623.24
2509.99
2365.86
2244.73
2115.9
1932.16
1837.91
1890.5
2340.52
3024.14
3118.84
3086.44
2993.15
2904.6
2847.07
2783.96
2736.07
2693.55
2606.84
2448.31
2188.35
1721.84
1312.26
1372
1644.43
1815.76
1917.24
2009.97
2092.13
2162.5
2241.45
2343.91
2465
2597.74
2729.55
2228.71
2412.79
2587.2
2567.09
2513.46
2426.66
2323.71
2202.85
2108.55
1998.44
1840.89
1766
1820.18
2262.41
2935.43
3043.64
3024.88
2960.28
2892.53
2836.74
2774.4
2735.54
2696.58
2604.61
2443.55
2186.85
1729.85
1318.16
1373.26
1643.94
1815.39
1916.88
2009.62
2091.91
2162.47
2241.63
2344.32
2465.61
2598.61
2730.46
2187.94
2289.9
2487.13
2501.27
2467.82
2397.76
2297.79
2175.93
2086.45
1978.71
1822.48
1753.24
1808.42
2252.69
2918.56
3029.37
3011.08
2950.06
2886.04
2822.84
2768.35
2735.12
2704.95
2627.15
2470.01
2197.58
1733.34
1318.18
1373.17
1643.81
1815.25
1916.71
2009.48
2091.82
2162.46
2241.66
2344.28
2465.39
2598.36
2730.23
2228.71
2412.79
2587.2
2567.09
2513.46
2426.66
2323.71
2202.85
2108.55
1998.44
1840.89
1766
1820.18
2262.41
2935.43
3043.64
3024.88
2960.28
2892.53
2836.74
2774.4
2735.54
2696.58
2604.61
2443.55
2186.85
1729.85
1318.16
1373.26
1643.94
1815.39
1916.88
2009.62
2091.91
2162.47
2241.63
2344.32
2465.61
2598.61
2730.46
2460.06
2695.18
2747.56
2749.08
2707.56
2623.24
2509.99
2365.86
2244.73
2115.9
1932.16
1837.91
1890.5
2340.52
3024.14
3118.84
3086.44
2993.15
2904.6
2847.07
2783.96
2736.07
2693.55
2606.84
2448.31
2188.35
1721.84
1312.26
1372
1644.43
1815.76
1917.24
2009.97
2092.13
2162.5
2241.45
2343.91
2465
2597.74
2729.55
3440.55
3288.89
3192.94
3120.88
3028.27
2943.43
2833.43
2694.84
2562.14
2410.24
2192.62
2041.8
2083.1
2550.15
3231.05
3298.35
3232.87
3075.45
2923.46
2867.15
2869.18
2854.46
2819.25
2718.46
2517.8
2201.18
1705.09
1295.7
1367.24
1645.87
1816.89
1918.1
2010.68
2092.55
2162.48
2240.97
2343.07
2464.09
2596.5
2728.38
4192.7
3892.49
3639.5
3419.27
3239.79
3116.38
2994.41
2880.67
2773.39
2634.37
2442.67
2299.51
2343.15
2848.56
3455.61
3505.77
3404.34
3170.82
2950.88
2819
2737.36
2699.33
2673.78
2595.32
2428.55
2143.38
1654.89
1263.92
1358.36
1649.04
1819.34
1919.88
2012.07
2093.37
2162.52
2240.05
2341.42
2462.27
2594.23
2725.94
4346.97
4181.89
4014.95
3815.52
3604.12
3402.95
3217.56
3062.85
2920.88
2771.24
2609.92
2455.08
2510.62
3109.04
3635.46
3670.26
3533.42
3216.09
2958.92
2819.75
2732.93
2685.79
2646.52
2554.11
2379.17
2079.44
1580.29
1218.14
1346.4
1652.37
1820.96
1920.37
2012.23
2093.3
2162.12
2239.22
2340.15
2460.82
2592.24
2723.99
4392.8
4146.89
3926.54
3725.29
3531.89
3331.94
3145.35
2991.76
2812.97
2648.09
2592.28
2565.78
2680.08
3230.96
3568.94
3569.07
3407.36
3108.53
2891.62
2777.22
2701.93
2659.7
2607.87
2496.24
2308.13
1991.68
1482.45
1164.08
1333.27
1654.71
1820.94
1918.95
2010.37
2091.37
2160.18
2237.65
2338.89
2459.43
2590.36
2722.34
4365.91
4167.41
3953.71
3749.06
3558.3
3354.26
3170.04
3002.97
2779.76
2652.83
2642.04
2676.42
2945.05
3377.69
3511.67
3482.84
3269.87
2978.01
2825.46
2729.78
2660.59
2618.23
2548.66
2418.35
2216.23
1876.99
1364.4
1107.09
1318.85
1653.6
1819.05
1916.9
2007.6
2087.47
2155.81
2233.46
2335.17
2456.52
2587.69
2720.28
4299.64
4120.04
3924.55
3736.14
3555
3367.28
3211.51
3021.14
2832.28
2778.46
2759.38
2823.86
3030.22
3310.12
3382.47
3319.26
3054.92
2843.54
2748.4
2666.05
2612.83
2562.07
2468.27
2319.59
2101.86
1739.26
1243.5
1062.29
1319.58
1672.78
1841.77
1941.61
2031.5
2106.47
2165.12
2234.22
2331.87
2453.65
2584.99
2718.52
4223.22
4056.12
3879.62
3707.68
3530.23
3355.7
3202.19
3027.99
2851.49
2800.01
2834.06
2923.49
3075.06
3195.77
3196.46
3022.12
2798.37
2729.7
2661.06
2595.71
2553.94
2491.25
2385.03
2237.81
2012.75
1621.86
1163.88
1055.25
1370.76
1765.92
1947.96
2043.3
2115
2168.34
2212.79
2267.86
2346.69
2455.04
2583.08
2716.97
4130.33
3968.83
3805.56
3643.39
3474.98
3315.91
3165.56
3015.07
2891.24
2871.51
2893.21
2935.47
3014.71
3027.96
2902.6
2694.39
2650.51
2613.57
2556.26
2533
2508.73
2460.15
2374.48
2255.03
2038.68
1615.09
1240.36
1255.19
1732.28
2178.75
2344.15
2400.2
2414.54
2401.24
2373.63
2361.81
2401.97
2484.23
2589.39
2715.92
3995.87
3843.33
3688.92
3535.35
3383.69
3243.86
3107.49
2976.19
2890.52
2859.69
2834.98
2823.01
2825
2738
2583.52
2521.98
2497.04
2487.29
2524.76
2564.67
2593.32
2618.71
2642.84
2571.39
2289.86
1835.7
1588.91
1711.43
2251.28
2613.86
2736.79
2765.42
2762.93
2734.05
2667.95
2594.6
2554.67
2558.44
2617.41
2713.61
3799.63
3657.15
3510.42
3358.09
3200.62
3048.49
2911.05
2810.13
2751.04
2713.38
2682.11
2672.44
2601.81
2407.54
2296.65
2405.28
2501.58
2565.78
2727.85
2941.42
3098.96
3144.1
3076.12
2846.29
2397.85
1952.87
1828.76
2008.63
2512.36
2805.95
2906.98
2932.61
2944.71
2939.08
2894.01
2828.85
2767.41
2716.23
2698.75
2712.49
3544.17
3394.39
3244.82
3091.72
2953.25
2836.18
2748.73
2679.97
2617.35
2543.85
2456.96
2360.22
2249.38
2288.33
2407.02
2593.76
2869.36
3214.6
3435.91
3520.3
3510.2
3396.67
3141.75
2742.63
2255.82
1975.88
1942.31
2143.8
2612.04
2882.39
2982.91
3008.98
3032.39
3046.53
3017.08
2969.02
2920.91
2870.11
2805.38
2715.21
3266.49
3125.42
2992.48
2867.15
2763.77
2691.09
2637.48
2579.51
2502.48
2427.86
2426.2
2469.64
2535.06
2741.75
3068.99
3401.45
3631.41
3776.4
3791.25
3688.82
3512.94
3302.17
2957.69
2486.71
2138.27
2034.61
2032.13
2214.69
2631.99
2896.02
3002.57
3029.83
3057.77
3077.78
3056.52
3015.89
2973.04
2929.91
2863.17
2716.63
3008.24
2928.47
2902.39
2894.35
2874.06
2872.81
2899.47
2945.45
2988.89
3040.51
3110.94
3207.08
3357.55
3572.15
3752.75
3879.82
3893.71
3841.66
3745.58
3606.36
3384.16
3065.5
2652.21
2291.14
2142.49
2111.37
2115.07
2253.66
2618.91
2896.26
3021.94
3054.13
3086.52
3108.11
3089.63
3040.17
2984.94
2926.91
2849.08
2686.39
2827.15
2915.33
2995.29
3064.04
3128.84
3197.29
3287.19
3400.34
3530.15
3663.23
3765.26
3825.39
3878.42
3919.4
3922.17
3933.9
3889.79
3778.91
3615.03
3412.03
3131.41
2751.18
2405.01
2244.31
2192.1
2175.13
2179.82
2271.69
2577.11
2867.32
3019.31
3066.54
3103.63
3126.2
3113.63
3066.24
3002.31
2923.44
2820.34
2656.16
2767.9
2898.82
3008.89
3085.04
3174.47
3290.9
3428.31
3589.73
3758.16
3906.18
4013.28
4060.05
4072.25
4027.84
3963.5
3883.54
3770.66
3612.65
3402.96
3128.06
2783.05
2470.76
2316.68
2265.19
2240.09
2225.52
2227.35
2281.48
2512.37
2797.12
2973.74
3036.65
3075.7
3105.19
3112.81
3079.29
3012.96
2916.76
2790.39
2633.03
2751.18
2857.35
2983.81
3092.21
3228.06
3372.61
3519.96
3671.45
3833.83
3996.54
4110.58
4139.9
4116.8
4023.39
3892.25
3738.98
3563.67
3353.93
3084.52
2769.13
2505.71
2375.66
2328.79
2312.27
2297.33
2282.82
2277.92
2310.63
2464
2717.26
2912.78
2994.17
3023.65
3052.97
3072.62
3052.29
2994.09
2902.64
2771.25
2621.45
2717.44
2788.26
2920.05
3037.91
3174.69
3309.23
3447.71
3602.38
3779.05
3966.88
4083.35
4098.3
4027.37
3878.56
3693.95
3494.53
3272.57
3016.81
2747.07
2539.64
2438.55
2400.57
2393.3
2390.03
2379.28
2365.63
2354.94
2378.78
2463.11
2661.53
2857.28
2952.95
2971.56
2991.61
3004.84
2991.22
2947.45
2869.38
2740.11
2604.5
2662.94
2717.38
2828.31
2927.29
3046.87
3152.34
3271.59
3420
3599.1
3778.86
3881.16
3887.91
3787.14
3599.43
3390.03
3182.6
2961.8
2743.28
2586.37
2510.87
2485.09
2485.66
2489.67
2488.47
2481.54
2472.1
2462.98
2471.05
2514.97
2634.38
2805.73
2910.54
2923.55
2919.98
2910.35
2899.1
2869.59
2807.63
2708.61
2563.16
2609.18
2648.34
2723.34
2787.73
2870.17
2949.01
3046.03
3171.16
3326.85
3480.21
3561.55
3540.37
3408.23
3223.11
3050.47
2894.95
2756.04
2654.21
2597.42
2577.83
2582.28
2591.27
2596.78
2597.41
2594.59
2590.29
2585.59
2585.55
2600.09
2656.74
2760.08
2847.18
2858.21
2830.17
2791.45
2772.77
2741.73
2706.91
2738.66
2641.93
2815.68
2491.01
2600.98
2683.28
2727.92
2783.2
2870.14
2959.74
3028.66
3042.05
2987.24
2878.63
2782.74
2725.43
2695.15
2673.18
2659.35
2659.49
2664.62
2672.99
2682.14
2690.57
2697.74
2703.18
2706.45
2709.07
2710.33
2711.63
2712.63
2714.34
2713.32
2720.9
2701.53
2670.38
2640.25
2626.65
2609.73
2566.33
2646.37
2572.25
2815.68
2491.01
2600.98
2683.28
2727.92
2783.2
2870.14
2959.74
3028.66
3042.05
2987.24
2878.63
2782.74
2725.43
2695.15
2673.18
2659.35
2659.49
2664.62
2672.99
2682.14
2690.57
2697.74
2703.18
2706.45
2709.07
2710.33
2711.63
2712.63
2714.34
2713.32
2720.9
2701.53
2670.38
2640.25
2626.65
2609.73
2566.33
2646.37
2572.25
2609.18
2648.34
2723.34
2787.73
2870.17
2949.01
3046.03
3171.16
3326.85
3480.21
3561.55
3540.37
3408.23
3223.11
3050.47
2894.95
2756.04
2654.21
2597.42
2577.83
2582.28
2591.27
2596.78
2597.41
2594.59
2590.29
2585.59
2585.55
2600.09
2656.74
2760.08
2847.18
2858.21
2830.17
2791.45
2772.77
2741.73
2706.91
2738.66
2641.93
2662.94
2717.38
2828.31
2927.29
3046.87
3152.34
3271.59
3420
3599.1
3778.86
3881.16
3887.91
3787.14
3599.43
3390.03
3182.6
2961.8
2743.28
2586.37
2510.87
2485.09
2485.66
2489.67
2488.47
2481.54
2472.1
2462.98
2471.05
2514.97
2634.38
2805.73
2910.54
2923.55
2919.98
2910.35
2899.1
2869.59
2807.63
2708.61
2563.16
2717.44
2788.26
2920.05
3037.91
3174.69
3309.23
3447.71
3602.38
3779.05
3966.88
4083.35
4098.3
4027.37
3878.56
3693.95
3494.53
3272.57
3016.81
2747.07
2539.64
2438.55
2400.57
2393.3
2390.03
2379.28
2365.63
2354.94
2378.78
2463.11
2661.53
2857.28
2952.95
2971.56
2991.61
3004.84
2991.22
2947.45
2869.38
2740.11
2604.5
2751.18
2857.35
2983.81
3092.21
3228.06
3372.61
3519.96
3671.45
3833.83
3996.54
4110.58
4139.9
4116.8
4023.39
3892.25
3738.98
3563.67
3353.93
3084.52
2769.13
2505.71
2375.66
2328.79
2312.27
2297.33
2282.82
2277.92
2310.63
2464
2717.26
2912.78
2994.17
3023.65
3052.97
3072.62
3052.29
2994.09
2902.64
2771.25
2621.45
2767.9
2898.82
3008.89
3085.04
3174.47
3290.9
3428.31
3589.73
3758.16
3906.18
4013.28
4060.05
4072.25
4027.84
3963.5
3883.54
3770.66
3612.65
3402.96
3128.06
2783.05
2470.76
2316.68
2265.19
2240.09
2225.52
2227.35
2281.48
2512.37
2797.12
2973.74
3036.65
3075.7
3105.19
3112.81
3079.29
3012.96
2916.76
2790.39
2633.03
2827.15
2915.33
2995.29
3064.04
3128.84
3197.29
3287.19
3400.34
3530.15
3663.23
3765.26
3825.39
3878.42
3919.4
3922.17
3933.9
3889.79
3778.91
3615.03
3412.03
3131.41
2751.18
2405.01
2244.31
2192.1
2175.13
2179.82
2271.69
2577.11
2867.32
3019.31
3066.54
3103.63
3126.2
3113.63
3066.24
3002.31
2923.44
2820.34
2656.16
3008.24
2928.47
2902.39
2894.35
2874.06
2872.81
2899.47
2945.45
2988.89
3040.51
3110.94
3207.08
3357.55
3572.15
3752.75
3879.82
3893.71
3841.66
3745.58
3606.36
3384.16
3065.5
2652.21
2291.14
2142.49
2111.37
2115.07
2253.66
2618.91
2896.26
3021.94
3054.13
3086.52
3108.11
3089.63
3040.17
2984.94
2926.91
2849.08
2686.39
3266.49
3125.42
2992.48
2867.15
2763.77
2691.09
2637.48
2579.51
2502.48
2427.86
2426.2
2469.64
2535.06
2741.75
3068.99
3401.45
3631.41
3776.4
3791.25
3688.82
3512.94
3302.17
2957.69
2486.71
2138.27
2034.61
2032.13
2214.69
2631.99
2896.02
3002.57
3029.83
3057.77
3077.78
3056.52
3015.89
2973.04
2929.91
2863.17
2716.63
3544.17
3394.39
3244.82
3091.72
2953.25
2836.18
2748.73
2679.97
2617.35
2543.85
2456.96
2360.22
2249.38
2288.33
2407.02
2593.76
2869.36
3214.6
3435.91
3520.3
3510.2
3396.67
3141.75
2742.63
2255.82
1975.88
1942.31
2143.8
2612.04
2882.39
2982.91
3008.98
3032.39
3046.53
3017.08
2969.02
2920.91
2870.11
2805.38
2715.21
3799.63
3657.15
3510.42
3358.09
3200.62
3048.49
2911.05
2810.13
2751.04
2713.38
2682.11
2672.44
2601.81
2407.54
2296.65
2405.28
2501.58
2565.78
2727.85
2941.42
3098.96
3144.1
3076.12
2846.29
2397.85
1952.87
1828.76
2008.63
2512.36
2805.95
2906.98
2932.61
2944.71
2939.08
2894.01
2828.85
2767.41
2716.23
2698.75
2712.49
3995.87
3843.33
3688.92
3535.35
3383.69
3243.86
3107.49
2976.19
2890.52
2859.69
2834.98
2823.01
2825
2738
2583.52
2521.98
2497.04
2487.29
2524.76
2564.67
2593.32
2618.71
2642.84
2571.39
2289.86
1835.7
1588.91
1711.43
2251.28
2613.86
2736.79
2765.42
2762.93
2734.05
2667.95
2594.6
2554.67
2558.44
2617.41
2713.61
4130.33
3968.83
3805.56
3643.39
3474.98
3315.91
3165.56
3015.07
2891.24
2871.51
2893.21
2935.47
3014.71
3027.96
2902.6
2694.39
2650.51
2613.57
2556.26
2533
2508.73
2460.15
2374.48
2255.03
2038.68
1615.09
1240.36
1255.19
1732.28
2178.75
2344.15
2400.2
2414.54
2401.24
2373.63
2361.81
2401.97
2484.23
2589.39
2715.92
4223.22
4056.12
3879.62
3707.68
3530.23
3355.7
3202.19
3027.99
2851.49
2800.01
2834.06
2923.49
3075.06
3195.77
3196.46
3022.12
2798.37
2729.7
2661.06
2595.71
2553.94
2491.25
2385.03
2237.81
2012.75
1621.86
1163.88
1055.25
1370.76
1765.92
1947.96
2043.3
2115
2168.34
2212.79
2267.86
2346.69
2455.04
2583.08
2716.97
4299.64
4120.04
3924.55
3736.14
3555
3367.28
3211.51
3021.14
2832.28
2778.46
2759.38
2823.86
3030.22
3310.12
3382.47
3319.26
3054.92
2843.54
2748.4
2666.05
2612.83
2562.07
2468.27
2319.59
2101.86
1739.26
1243.5
1062.29
1319.58
1672.78
1841.77
1941.61
2031.5
2106.47
2165.12
2234.22
2331.87
2453.65
2584.99
2718.52
4365.91
4167.41
3953.71
3749.06
3558.3
3354.26
3170.04
3002.97
2779.76
2652.83
2642.04
2676.42
2945.05
3377.69
3511.67
3482.84
3269.87
2978.01
2825.46
2729.78
2660.59
2618.23
2548.66
2418.35
2216.23
1876.99
1364.4
1107.09
1318.85
1653.6
1819.05
1916.9
2007.6
2087.47
2155.81
2233.46
2335.17
2456.52
2587.69
2720.28
4392.8
4146.89
3926.54
3725.29
3531.89
3331.94
3145.35
2991.76
2812.97
2648.09
2592.28
2565.78
2680.08
3230.96
3568.94
3569.07
3407.36
3108.53
2891.62
2777.22
2701.93
2659.7
2607.87
2496.24
2308.13
1991.68
1482.45
1164.08
1333.27
1654.71
1820.94
1918.95
2010.37
2091.37
2160.18
2237.65
2338.89
2459.43
2590.36
2722.34
4346.97
4181.89
4014.95
3815.52
3604.12
3402.95
3217.56
3062.85
2920.88
2771.24
2609.92
2455.08
2510.62
3109.04
3635.46
3670.26
3533.42
3216.09
2958.92
2819.75
2732.93
2685.79
2646.52
2554.11
2379.17
2079.44
1580.29
1218.14
1346.4
1652.37
1820.96
1920.37
2012.23
2093.3
2162.12
2239.22
2340.15
2460.82
2592.24
2723.99
4192.7
3892.49
3639.5
3419.27
3239.79
3116.38
2994.41
2880.67
2773.39
2634.37
2442.67
2299.51
2343.15
2848.56
3455.61
3505.77
3404.34
3170.82
2950.88
2819
2737.36
2699.33
2673.78
2595.32
2428.55
2143.38
1654.89
1263.92
1358.36
1649.04
1819.34
1919.88
2012.07
2093.37
2162.52
2240.05
2341.42
2462.27
2594.23
2725.94
3440.55
3288.89
3192.94
3120.88
3028.27
2943.43
2833.43
2694.84
2562.14
2410.24
2192.62
2041.8
2083.1
2550.15
3231.05
3298.35
3232.87
3075.45
2923.46
2867.15
2869.18
2854.46
2819.25
2718.46
2517.8
2201.18
1705.09
1295.7
1367.24
1645.87
1816.89
1918.1
2010.68
2092.55
2162.48
2240.97
2343.07
2464.09
2596.5
2728.38
)
;
boundaryField
{
inlet
{
type calculated;
value uniform 14000.1;
}
outlet
{
type calculated;
value nonuniform List<scalar>
165
(
3482.39
4332.43
4475.4
4505.31
4459.7
4388.49
4305.51
4209.2
4068.87
3866.23
3621.53
3325.37
3026.57
2738.79
2575.82
2583.87
2613.62
2643.67
2741.22
3130.13
3130.13
2835.12
2719.15
2701.57
2695.85
2679.64
2643.52
2592.18
2532.48
2483.87
2460.35
2478.76
2531.98
2592.11
2643.68
2683.64
2710.87
2728.67
2739.98
2745.47
2749.79
2756.16
2764.07
2771.52
2777.56
2781.89
2784.89
2785.86
2784.43
2775.05
2750.72
2708.95
2661.15
2622.2
2602.61
2594.56
2601.89
2626.82
2628.18
2673.35
2800.13
2800
2799.52
2798.38
2796.87
2795.49
2793.87
2791.22
2785.66
2768.41
2735.56
2687.02
2644.89
2609.75
2593.44
2590.04
2599.25
2624.24
2627.81
2673.35
2800.9
2801.21
2801.57
2801.21
2800.9
2673.35
2627.81
2624.24
2599.25
2590.04
2593.44
2609.75
2644.89
2687.02
2735.56
2768.41
2785.66
2791.22
2793.87
2795.49
2796.87
2798.38
2799.52
2800
2800.13
3130.13
2835.12
2719.15
2701.57
2695.85
2679.64
2643.52
2592.18
2532.48
2483.87
2460.35
2478.76
2531.98
2592.11
2643.68
2683.64
2710.87
2728.67
2739.98
2745.47
2749.79
2756.16
2764.07
2771.52
2777.56
2781.89
2784.89
2785.86
2784.43
2775.05
2750.72
2708.95
2661.15
2622.2
2602.61
2594.56
2601.89
2626.82
2628.18
2673.35
3130.13
2741.22
2643.67
2613.62
2583.87
2575.82
2738.79
3026.57
3325.37
3621.53
3866.23
4068.87
4209.2
4305.51
4388.49
4459.7
4505.31
4475.4
4332.43
3482.39
)
;
}
obstacle
{
type calculated;
value nonuniform List<scalar>
40
(
11670.2
11185.3
11871.1
12439.9
12652.3
12677.5
12650.1
12565.8
12467.9
12365.6
11670.2
11185.3
11871.1
12439.9
12652.3
12677.5
12650.1
12565.8
12467.9
12365.6
12465.6
12302
12181.3
11841.9
11739.2
12465.6
12302
12181.3
11841.9
11739.2
6229.47
4235.87
3271.79
2751.66
2197.22
6229.47
4235.87
3271.79
2751.66
2197.22
)
;
}
empty
{
type empty;
}
}
// ************************************************************************* //
| [
"andytorrestb@gmail.com"
] | andytorrestb@gmail.com | |
ff2bf847d042ac6b6cf87a3d413c6623cb9fca22 | 88ae8695987ada722184307301e221e1ba3cc2fa | /chrome/browser/ui/webui/ntp/app_launcher_handler_unittest.cc | c8ac6ac614b486093bb0687e86bbbb0673efb1a4 | [
"BSD-3-Clause"
] | permissive | iridium-browser/iridium-browser | 71d9c5ff76e014e6900b825f67389ab0ccd01329 | 5ee297f53dc7f8e70183031cff62f37b0f19d25f | refs/heads/master | 2023-08-03T16:44:16.844552 | 2023-07-20T15:17:00 | 2023-07-23T16:09:30 | 220,016,632 | 341 | 40 | BSD-3-Clause | 2021-08-13T13:54:45 | 2019-11-06T14:32:31 | null | UTF-8 | C++ | false | false | 11,206 | cc | // Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
#include <memory>
#include <utility>
#include <vector>
#include "base/command_line.h"
#include "base/memory/raw_ptr.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/browser/web_applications/test/web_app_install_test_utils.h"
#include "chrome/browser/web_applications/test/web_app_test_utils.h"
#include "chrome/browser/web_applications/web_app_command_manager.h"
#include "chrome/browser/web_applications/web_app_provider.h"
#include "chrome/browser/web_applications/web_app_sync_bridge.h"
#include "chrome/common/chrome_features.h"
#include "chrome/test/base/browser_with_test_window_test.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/test_renderer_host.h"
#include "content/public/test/test_web_ui.h"
#include "content/public/test/web_contents_tester.h"
#include "extensions/common/extension_builder.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
using OsIntegrationSubManagersState = web_app::OsIntegrationSubManagersState;
using AppId = web_app::AppId;
using WebAppProvider = web_app::WebAppProvider;
namespace {
using ::testing::Optional;
constexpr char kTestAppUrl[] = "https://www.example.com/";
constexpr char kTestManifestUrl[] = "https://www.example.com/manifest.json";
constexpr char kMethodNameAppAdded[] = "ntp.appAdded";
constexpr char kKeyAppId[] = "id";
constexpr char kKeyIsLocallyInstalled[] = "isLocallyInstalled";
const std::u16string kTestAppTitle = u"Test App";
class TestAppLauncherHandler : public AppLauncherHandler {
public:
TestAppLauncherHandler(extensions::ExtensionService* extension_service,
WebAppProvider* provider,
content::TestWebUI* test_web_ui)
: AppLauncherHandler(extension_service, provider) {
DCHECK(test_web_ui->GetWebContents());
DCHECK(test_web_ui->GetWebContents()->GetBrowserContext());
set_web_ui(test_web_ui);
}
TestAppLauncherHandler(const TestAppLauncherHandler&) = delete;
TestAppLauncherHandler& operator=(const TestAppLauncherHandler&) = delete;
~TestAppLauncherHandler() override = default;
content::TestWebUI* test_web_ui() {
return static_cast<content::TestWebUI*>(web_ui());
}
using CallData = content::TestWebUI::CallData;
const std::vector<std::unique_ptr<CallData>>& call_data() {
return test_web_ui()->call_data();
}
};
std::unique_ptr<WebAppInstallInfo> BuildWebAppInfo() {
auto app_info = std::make_unique<WebAppInstallInfo>();
app_info->start_url = GURL(kTestAppUrl);
app_info->scope = GURL(kTestAppUrl);
app_info->title = kTestAppTitle;
app_info->manifest_url = GURL(kTestManifestUrl);
return app_info;
}
} // namespace
class AppLauncherHandlerTest
: public BrowserWithTestWindowTest,
public ::testing::WithParamInterface<OsIntegrationSubManagersState> {
public:
AppLauncherHandlerTest() {
if (GetParam() == OsIntegrationSubManagersState::kSaveStateToDB) {
scoped_feature_list_.InitWithFeaturesAndParameters(
{{features::kOsIntegrationSubManagers, {{"stage", "write_config"}}}},
/*disabled_features=*/{});
} else {
scoped_feature_list_.InitWithFeatures(
/*enabled_features=*/{}, {features::kOsIntegrationSubManagers});
}
}
AppLauncherHandlerTest(const AppLauncherHandlerTest&) = delete;
AppLauncherHandlerTest& operator=(const AppLauncherHandlerTest&) = delete;
~AppLauncherHandlerTest() override = default;
void SetUp() override {
BrowserWithTestWindowTest::SetUp();
extension_service_ = CreateTestExtensionService();
web_app::test::AwaitStartWebAppProviderAndSubsystems(profile());
}
protected:
std::unique_ptr<TestAppLauncherHandler> GetAppLauncherHandler(
content::TestWebUI* test_web_ui) {
return std::make_unique<TestAppLauncherHandler>(extension_service_,
provider(), test_web_ui);
}
// Install a web app and sets the locally installed property based on
// |is_locally_installed|.
AppId InstallWebApp(bool is_locally_installed = true) {
AppId installed_app_id =
web_app::test::InstallWebApp(profile(), BuildWebAppInfo());
if (is_locally_installed)
return installed_app_id;
provider()->sync_bridge_unsafe().SetAppIsLocallyInstalledForTesting(
installed_app_id, false);
provider()->sync_bridge_unsafe().SetAppInstallTime(installed_app_id,
base::Time::Min());
return installed_app_id;
}
// Validates the expectations for the JS call made after locally installing a
// web app.
void ValidateLocallyInstalledCallData(
TestAppLauncherHandler* app_launcher_handler,
const AppId& installed_app_id) {
ASSERT_EQ(1U, app_launcher_handler->call_data().size());
EXPECT_EQ(kMethodNameAppAdded,
app_launcher_handler->call_data()[0]->function_name());
const base::Value* arg1 = app_launcher_handler->call_data()[0]->arg1();
ASSERT_TRUE(arg1->is_dict());
const base::Value::Dict& app_info = arg1->GetDict();
const std::string* app_id = app_info.FindString(kKeyAppId);
ASSERT_TRUE(app_id);
EXPECT_EQ(*app_id, installed_app_id);
EXPECT_THAT(app_info.FindBoolByDottedPath(kKeyIsLocallyInstalled),
Optional(true));
}
std::unique_ptr<content::TestWebUI> CreateTestWebUI(
content::WebContents* test_web_contents) {
auto test_web_ui = std::make_unique<content::TestWebUI>();
test_web_ui->set_web_contents(test_web_contents);
return test_web_ui;
}
std::unique_ptr<content::WebContents> CreateTestWebContents() {
auto site_instance = content::SiteInstance::Create(profile());
return content::WebContentsTester::CreateTestWebContents(
profile(), std::move(site_instance));
}
extensions::ExtensionService* CreateTestExtensionService() {
auto* extension_system = static_cast<extensions::TestExtensionSystem*>(
extensions::ExtensionSystem::Get(profile()));
extensions::ExtensionService* ext_service =
extension_system->CreateExtensionService(
base::CommandLine::ForCurrentProcess(), base::FilePath(), false);
ext_service->Init();
return ext_service;
}
WebAppProvider* provider() { return WebAppProvider::GetForTest(profile()); }
web_app::OsIntegrationManager::ScopedSuppressForTesting os_hooks_suppress_;
raw_ptr<extensions::ExtensionService> extension_service_;
base::test::ScopedFeatureList scoped_feature_list_;
};
// Tests that AppLauncherHandler::HandleInstallAppLocally calls the JS method
// "ntp.appAdded" for the locally installed app.
TEST_P(AppLauncherHandlerTest, HandleInstallAppLocally) {
AppId installed_app_id = InstallWebApp(/*is_locally_installed=*/false);
// Initialize the web_ui instance.
std::unique_ptr<content::WebContents> test_web_contents =
CreateTestWebContents();
std::unique_ptr<content::TestWebUI> test_web_ui =
CreateTestWebUI(test_web_contents.get());
std::unique_ptr<TestAppLauncherHandler> app_launcher_handler =
GetAppLauncherHandler(test_web_ui.get());
base::Value::List args;
args.Append(base::Value(installed_app_id));
app_launcher_handler->HandleGetApps(/*args=*/base::Value::List());
app_launcher_handler->test_web_ui()->ClearTrackedCalls();
// Call AppLauncherHandler::HandleInstallAppLocally for the web_ui and expect
// that the JS is made correctly.
app_launcher_handler->HandleInstallAppLocally(args);
provider()->command_manager().AwaitAllCommandsCompleteForTesting();
ValidateLocallyInstalledCallData(app_launcher_handler.get(),
installed_app_id);
}
// Tests that AppLauncherHandler::HandleInstallAppLocally calls the JS method
// "ntp.appAdded" for the all the running instances of chrome://apps page.
TEST_P(AppLauncherHandlerTest, HandleInstallAppLocally_MultipleWebUI) {
AppId installed_app_id = InstallWebApp(/*is_locally_installed=*/false);
// Initialize the first web_ui instance.
std::unique_ptr<content::WebContents> test_web_contents_1 =
CreateTestWebContents();
std::unique_ptr<content::TestWebUI> test_web_ui_1 =
CreateTestWebUI(test_web_contents_1.get());
std::unique_ptr<TestAppLauncherHandler> app_launcher_handler_1 =
GetAppLauncherHandler(test_web_ui_1.get());
base::Value::List args;
args.Append(base::Value(installed_app_id));
app_launcher_handler_1->HandleGetApps(/*args=*/base::Value::List());
app_launcher_handler_1->test_web_ui()->ClearTrackedCalls();
// Initialize the second web_ui instance.
std::unique_ptr<content::WebContents> test_web_contents_2 =
CreateTestWebContents();
std::unique_ptr<content::TestWebUI> test_web_ui_2 =
CreateTestWebUI(test_web_contents_2.get());
std::unique_ptr<TestAppLauncherHandler> app_launcher_handler_2 =
GetAppLauncherHandler(test_web_ui_2.get());
app_launcher_handler_2->HandleGetApps(/*args=*/base::Value::List());
app_launcher_handler_2->test_web_ui()->ClearTrackedCalls();
// Call AppLauncherHandler::HandleInstallAppLocally for the first web_ui
// handler and expect the correct JS call is made to both the web_ui
// instances.
app_launcher_handler_1->HandleInstallAppLocally(args);
provider()->command_manager().AwaitAllCommandsCompleteForTesting();
ValidateLocallyInstalledCallData(app_launcher_handler_1.get(),
installed_app_id);
ValidateLocallyInstalledCallData(app_launcher_handler_2.get(),
installed_app_id);
}
// Regression test for crbug.com/1302157.
TEST_P(AppLauncherHandlerTest, HandleClosedWhileUninstallingExtension) {
scoped_refptr<const extensions::Extension> extension =
extensions::ExtensionBuilder("foo").Build();
extension_service_->AddExtension(extension.get());
AddTab(browser(), GURL("http://foo/1"));
content::WebContents* contents =
browser()->tab_strip_model()->GetWebContentsAt(0);
std::unique_ptr<content::WebContents> test_web_contents =
CreateTestWebContents();
std::unique_ptr<content::TestWebUI> test_web_ui = CreateTestWebUI(contents);
std::unique_ptr<TestAppLauncherHandler> app_launcher_handler =
GetAppLauncherHandler(test_web_ui.get());
app_launcher_handler->CreateExtensionUninstallDialog()->ConfirmUninstall(
extension, extensions::UNINSTALL_REASON_USER_INITIATED,
extensions::UNINSTALL_SOURCE_CHROME_APPS_PAGE);
app_launcher_handler.reset();
// No crash (in asan tester) indicates a passing score.
}
INSTANTIATE_TEST_SUITE_P(
All,
AppLauncherHandlerTest,
::testing::Values(OsIntegrationSubManagersState::kSaveStateToDB,
OsIntegrationSubManagersState::kDisabled),
web_app::test::GetOsIntegrationSubManagersTestName);
| [
"jengelh@inai.de"
] | jengelh@inai.de |
bfc1f60059a626b675461a136a7fec05bb17fc7c | 822bf41acd38e266b8e55ec169cd4d57db88a12f | /life.h | b4bcc5a79101f34c9dbdaf0003f5d0b948d03d5c | [] | no_license | kasprzyk01/Arkanoid_game | 9fd2f461a4849c7c06f285c6079746ac0b9f7bf4 | 05800a8760782324920e9c53b1ea228b8dc49171 | refs/heads/master | 2021-01-01T18:44:37.448353 | 2017-07-26T12:41:06 | 2017-07-26T12:41:06 | 98,421,174 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 708 | h | #ifndef LIFE_H
#define LIFE_H
#include<unmovableelement.h>
#include<QPainter>
#include<QPointF>
#include<QRectF>
#include<QGraphicsItem>
///klasa odpowiedzialna za rysowanie żyć gracza
class Life:public UnMovableElement ///dziedziczenie po nieruchomym elemencie
{
private:
qreal radius; ///promien
public:
Life(qreal radius); ///konstruktor, inicjuje promień obiektu
QRectF boundingRect()const; ///funkcja zwracająca prostokąt opisany na obiekcie
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);///funkcja rysująca życia
///argumenty opisane w klasie Ball
qreal getRadius(); ///funkcja zwracająca promień życia
};
#endif // LIFE_H
| [
"kasprzyk01@gmail.com"
] | kasprzyk01@gmail.com |
d8894b6c3d65213bfd4595bc2cc0077a82cb3d20 | c2045fc077e9ad2b70d162327cca46295d73c428 | /src/BaseShader.cpp | 2b56bcd69af297a34e7b36d2d0d762dc2ef32efb | [] | no_license | jfischoff/obido_opengl | 9a781f2b71c7bf153ef94afad0ba652efdaee9f5 | c63b664ddb8d9d463c08cd858e6dce4926bd0b01 | refs/heads/master | 2021-01-23T03:04:46.315220 | 2011-10-11T15:06:23 | 2011-10-11T15:06:23 | 2,556,028 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,614 | cpp | #include "BaseShader.h"
//__HEADERS__
#include <memory.h>
#include <assert.h>
//__HEADERS__
void* BaseShader::Constructor()
{
return new BaseShader();
}
BaseShader::BaseShader()
{
m_SerializableSources = NULL;
m_SerializableSourcesCount = 0;
m_SerializableUniformTypes = NULL;
m_SerializableUniformTypesCount = 0;
//__CUSTOM_INIT__
m_Name = NULL;
m_Sources = NULL;
m_SourcesCount = 0;
m_UniformTypes = NULL;
m_UniformTypeCount = 0;
m_ShaderType = 0;
//__CUSTOM_INIT__
}
BaseShader::BaseShader(const BaseShader& other)
{
copy(other);
}
BaseShader& BaseShader::operator=(const BaseShader& other)
{
copy(other);
return *this;
}
void BaseShader::copy(const BaseShader& other)
{
m_SerializedName = other.m_SerializedName;
m_SerializableSources = other.m_SerializableSources;
m_ShaderType = other.m_ShaderType;
m_SerializableUniformTypes = other.m_SerializableUniformTypes;
}
BaseShader::~BaseShader()
{
}
BaseShader::BaseShader(string serializedName, string* serializableSources, unsigned int serializableSourcesCount, GLenum shaderType, string* serializableUniformTypes, unsigned int serializableUniformTypesCount)
{
m_SerializedName = serializedName;
m_SerializableSources = serializableSources;
m_ShaderType = shaderType;
m_SerializableUniformTypes = serializableUniformTypes;
}
string BaseShader::getSerializedName()
{
return m_SerializedName;
}
const string BaseShader::getSerializedName() const
{
return m_SerializedName;
}
void BaseShader::setSerializedName(string value)
{
m_SerializedName = value;
}
string* BaseShader::getSerializableSources()
{
return m_SerializableSources;
}
string const * BaseShader::getSerializableSources() const
{
return m_SerializableSources;
}
const string BaseShader::getSerializableSourcesElement(unsigned int index) const
{
return m_SerializableSources[index];
}
string BaseShader::getSerializableSourcesElement(unsigned int index)
{
return m_SerializableSources[index];
}
unsigned int BaseShader::getSerializableSourcesCount() const
{
return m_SerializableSourcesCount;
}
void BaseShader::setSerializableSources(string* array)
{
m_SerializableSources = array;
}
void BaseShader::setSerializableSourcesElement(unsigned int index, string element)
{
m_SerializableSources[index] = element;
}
void BaseShader::setSerializableSourcesCount(unsigned int count)
{
m_SerializableSourcesCount = count;
}
GLenum BaseShader::getShaderType()
{
return m_ShaderType;
}
const GLenum BaseShader::getShaderType() const
{
return m_ShaderType;
}
void BaseShader::setShaderType(GLenum value)
{
m_ShaderType = value;
}
string* BaseShader::getSerializableUniformTypes()
{
return m_SerializableUniformTypes;
}
string const * BaseShader::getSerializableUniformTypes() const
{
return m_SerializableUniformTypes;
}
const string BaseShader::getSerializableUniformTypesElement(unsigned int index) const
{
return m_SerializableUniformTypes[index];
}
string BaseShader::getSerializableUniformTypesElement(unsigned int index)
{
return m_SerializableUniformTypes[index];
}
unsigned int BaseShader::getSerializableUniformTypesCount() const
{
return m_SerializableUniformTypesCount;
}
void BaseShader::setSerializableUniformTypes(string* array)
{
m_SerializableUniformTypes = array;
}
void BaseShader::setSerializableUniformTypesElement(unsigned int index, string element)
{
m_SerializableUniformTypes[index] = element;
}
void BaseShader::setSerializableUniformTypesCount(unsigned int count)
{
m_SerializableUniformTypesCount = count;
}
void BaseShader::merge(const BaseShader& other)
{
mergeSerializedName(other.m_SerializedName);
mergeSerializableSources(other.m_SerializableSources);
mergeShaderType(other.m_ShaderType);
mergeSerializableUniformTypes(other.m_SerializableUniformTypes);
}
void BaseShader::clear()
{
clearSerializedName();
clearSerializableSources();
clearShaderType();
clearSerializableUniformTypes();
}
void BaseShader::mergeSerializedName(const string& otherSerializedName)
{
}
void BaseShader::mergeSerializableSources(string* const otherSerializableSources)
{
}
void BaseShader::mergeShaderType(const GLenum& otherShaderType)
{
}
void BaseShader::mergeSerializableUniformTypes(string* const otherSerializableUniformTypes)
{
}
void BaseShader::clearSerializedName()
{
}
void BaseShader::clearSerializableSources()
{
}
void BaseShader::clearShaderType()
{
}
void BaseShader::clearSerializableUniformTypes()
{
}
//__CUSTOM_METHODS__
void BaseShader::cache()
{
m_Name = m_SerializedName.c_str();
m_SourcesCount = m_SerializableSourcesCount;
m_Sources = new const char*[m_SourcesCount];
for(uint index = 0; index < m_SerializableSourcesCount; index++)
{
m_Sources[index] = m_SerializableSources[index].c_str();
}
m_UniformTypeCount = m_SerializableUniformTypesCount;
m_UniformTypes = new const char*[m_UniformTypeCount];
for(uint index = 0; index < m_UniformTypeCount; index++)
{
m_UniformTypes[index] = m_SerializableUniformTypes[index].c_str();
}
}
void BaseShader::uncache()
{
}
bool BaseShader::createShader(string& message)
{
void* pF = (void*)glCreateShader;
assert(pF != NULL);
//GLenum temp0 = GL_VERTEX_SHADER;
//GLenum temp1 = GL_FRAGMENT_SHADER;
assert(m_ShaderType == GL_VERTEX_SHADER ||
m_ShaderType == GL_FRAGMENT_SHADER);
m_ShaderId = glCreateShader(m_ShaderType);
CHECK_ERROR_AND_RETURN(message);
return true;
}
bool BaseShader::compile(string& message)
{
assert(glCompileShader);
glCompileShader(m_ShaderId);
CHECK_ERROR_AND_RETURN(message);
//test for to see if the shader compiled correctly
GLint compileStatus;
glGetShaderiv(m_ShaderId, GL_COMPILE_STATUS, &compileStatus);
if(compileStatus != GL_TRUE)
{
//failed to compile query the info log
GLchar* infoLog = new GLchar[100000];
GLsizei length;
glGetShaderInfoLog(m_ShaderId, 100000, &length, infoLog);
message += infoLog;
m_IsCompiled = false;
return false;
}
m_IsCompiled = true;
return true;
}
bool BaseShader::loadShader(string& message)
{
glShaderSource(m_ShaderId, m_SourcesCount, m_Sources, NULL);
message += "Failed in loadShader ";
message += m_Name;
CHECK_ERROR_AND_RETURN(message);
return true;
}
bool BaseShader::deleteShader(string& message)
{
glDeleteShader(m_ShaderId);
CHECK_ERROR_AND_RETURN(message);
return true;
}
bool BaseShader::isCompiled() const
{
return m_IsCompiled;
}
void BaseShader::getSources(const char*** sources, int& count) const
{
*sources = m_Sources;
count = m_SourcesCount;
}
void BaseShader::setSources(const char** sources, int count)
{
m_Sources = sources;
m_SourcesCount = count;
}
const char* BaseShader::getUniformType(uint index) const
{
return m_UniformTypes[index];
}
void BaseShader::setUniformType(uint index, const char* uniformType)
{
m_UniformTypes[index] = uniformType;
}
uint BaseShader::getUniformCount() const
{
return m_UniformTypeCount;
}
bool BaseShader::setup(string& message)
{
if(createShader(message) == false) return false;
if(loadShader(message) == false) return false;
if(compile(message) == false) return false;
return true;
}
void BaseShader::deepCopy(const BaseShader* other)
{
BaseShader* otherBaseShader2 = (BaseShader*)other;
m_Name = otherBaseShader2->m_Name;
m_IsCompiled = otherBaseShader2->m_IsCompiled;
if(m_SourcesCount != otherBaseShader2->m_SourcesCount)
{
if(m_SourcesCount != 0)
{
assert(m_Sources != NULL);
delete[] m_Sources;
}
m_SourcesCount = otherBaseShader2->m_SourcesCount;
m_Sources = new const char*[m_SourcesCount];
}
for(uint index = 0; index < m_SourcesCount; index++)
{
m_Sources[index] = otherBaseShader2->m_Sources[index];
}
m_ShaderId = otherBaseShader2->m_ShaderId;
m_ShaderType = otherBaseShader2->m_ShaderType;
if(m_UniformTypeCount != otherBaseShader2->m_UniformTypeCount)
{
if(m_UniformTypeCount != 0)
{
assert(m_UniformTypes != NULL);
delete[] m_UniformTypes;
}
m_UniformTypeCount = otherBaseShader2->m_UniformTypeCount;
m_UniformTypes = new const char*[m_UniformTypeCount];
}
for(uint index = 0; index < m_UniformTypeCount; index++)
{
m_UniformTypes[index] = otherBaseShader2->m_UniformTypes[index];
}
}
void BaseShader::destroy()
{
}
unsigned int BaseShader::getShaderId()
{
return m_ShaderId;
}
const unsigned int BaseShader::getShaderId() const
{
return m_ShaderId;
}
void BaseShader::setShaderId(unsigned int value)
{
m_ShaderId = value;
}
//__CUSTOM_METHODS__
| [
"jonathan@fairauto.com"
] | jonathan@fairauto.com |
7bb77f1c34ad776684e2fc84d295d4cfe8d9a122 | 56a5a449a565e0daa337d55cdfa469e886da2a3e | /product_record.h | ef13c8fc3305e2e9bc3f7a8b8003c8428f5d5cc4 | [] | no_license | istyn/threading | 8ed47b9ac3be70d482a601d8624547d87f2e8bbc | ddb212f55f89e1d650a07893599fe95a4b6b9282 | refs/heads/master | 2016-08-10T20:54:05.820165 | 2016-03-29T08:02:08 | 2016-03-29T08:02:08 | 54,957,249 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 711 | h | #ifndef PROCUCT_RECORD
#define PROCUCT_RECORD
#include <fstream>
using namespace std;
#define PRODUCTSIZE 128
#define MAXSTAGES 5
// Created by: Barrett
// Date: 1/19/2016
//
// product_record
// models one product at various stages in the system
// There's no good reason that this isn't a class
// because lazy doesn't cut it
struct product_record {
int idnumber; // Unique identification
char name[PRODUCTSIZE]; // String description
double price; // Unit cost
int number; // Number ordered
double tax; // Tax on order
double sANDh; // Shipping and handling
double total; // Total order cost
int stations[MAXSTAGES]; // Stations processed
};
#endif
| [
"isaacstyles92@gmail.com"
] | isaacstyles92@gmail.com |
59f2cfe0ab124c0e9781fdb092e721e256a7b8d7 | 7b2ebcab7d5cda65fcc68525adf3b7cf711ac2c8 | /kruskal.cpp | f14fd15cae551e26bba8928aa1ec1047208fc9b8 | [] | no_license | ab-bh/Algorithms | 91d10c72f8bdd835a17365a02adeb692cc087a01 | 839cceff925458306e13df47d2df6d54e0602412 | refs/heads/master | 2021-06-12T02:09:37.110094 | 2016-12-05T06:39:06 | 2016-12-05T06:39:06 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,372 | cpp | #include<bits/stdc++.h>
using namespace std;
#define maxs 1001
#define mp make_pair
typedef pair< int, pair<int,int> >pii;
priority_queue< pii,vector<pii>,greater<pii> > pq;
int root_arr[maxs],size_arr[maxs];
int root(int node ){ //function to match root node for cycle detection
while(root_arr[ node ]!= node)
node =root_arr[ root_arr[ node ] ];
return node;
}
void unions(int a,int b){ //union step using size heuristics
int root_a=root(a);
int root_b=root(b);
if(size_arr[ root_a ]>size_arr[ root_b ]){
root_arr[ root_b ]=root_arr[ root_a ];
size_arr[ root_a ] += size_arr[ root_b ];
}
else{
root_arr[ root_a ] = root_arr[ root_b ];
size_arr[ root_b ] += size_arr[ root_a ];
}
}
int main(){
int w,a,b,e,n;
cout<<"enter number of nodes"<<endl;
cin>>n;
cout<<"enter number of edges"<<endl;
cin>>e;
for(int i=1;i<=n;++i){
root_arr[i]=i;
size_arr[i]=1;
}
for(int i=1;i<=e;++i){
cout<<"enter node1 node2 weight"<<endl; //generating connections
cin>>a>>b>>w;
pq.push(mp(w,mp(a,b)));
}
int min_dist=0;
while(!pq.empty()){ //the kruskal step
pii temp=pq.top();
pq.pop();
if(root(temp.second.first)!=root(temp.second.second)){
min_dist+=temp.first;
unions(temp.second.first,temp.second.second);
}
}
cout<<"min_dist is ---> "<<min_dist<<endl; //displying minimum distance
return 0;
} | [
"noreply@github.com"
] | noreply@github.com |
1e530173f66fb54c6c2a4b53ba384852dc0f93e1 | 7c7d727511823fb46c11af87006358b56d668c8a | /Classes/Assassin.hpp | d8a6cdeda01c5bc2078f326dfe71804e719e10f9 | [] | no_license | billysprout/Arena | 4344b8d8a9f8e778367bccf6239137659e1c79d8 | 1f694377a19a66ecfeb200aa7ce8cf735f9660cf | refs/heads/master | 2021-01-18T14:18:30.718735 | 2015-05-08T21:15:34 | 2015-05-08T21:15:34 | 32,198,911 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 241 | hpp | #ifndef _ASSASSIN_HPP_
#define _ASSASSIN_HPP_
#include "Unit.hpp"
#include "Board.hpp"
class Assassin : public Unit {
public:
Assassin::Assassin(int team, string name);
virtual string toString();
void target(Board *b) override;
};
#endif | [
"sprout.billy@gmail.com"
] | sprout.billy@gmail.com |
6d3769db0c86a2b691a2376c8c46920d69a9b5ff | 1fcdb2bc2c7f75f6aed466119a4b1c53777f0b7a | /holly_inletwfine_kappaepsilon_noturbulence4/10/p | 87ba226b954f9e27d69273e85bde7454177a7423 | [] | no_license | bshambaugh/openfoam-experiments3 | b32549e80836eee9fc6062873fc737155168f919 | 4bd90a951845a4bc5dda7063e91f6cc0ba730e48 | refs/heads/master | 2020-04-15T08:17:15.156512 | 2019-01-15T04:31:23 | 2019-01-15T04:31:23 | 164,518,405 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 62,133 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 4.1 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "10";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField nonuniform List<scalar>
6785
(
583.42
508.952
460.375
408.505
361.894
317.608
276.191
237.133
200.293
165.401
131.596
99.1987
71.1031
40.1037
1.60929
-8.05686
-25.645
-17.5166
-23.4295
-24.0275
-26.3733
-27.6242
-28.4782
-28.5173
-27.6275
-25.7537
-23.1196
-19.0243
-13.507
-10.1786
-2.62676
-6.46686
3.64622
0.712398
5.03689
5.69679
7.60172
8.80564
10.0444
11.1222
12.1674
13.0199
13.6511
14.2839
16.2127
43.0082
40.9416
44.9068
40.5561
42.3592
40.3242
40.172
39.2364
38.7249
38.2367
37.9563
37.7861
37.5833
37.2979
37.3399
28.0559
24.5201
26.2978
22.493
23.9322
21.7832
22.0136
21.1219
20.9437
20.4762
19.9827
19.2502
18.1774
16.4437
14.4006
-0.894561
-4.75296
-3.9381
-7.36921
-6.85962
-9.67072
-10.3686
-12.531
-14.1327
-16.0489
-17.6274
-18.8195
-20.0078
-20.9324
-20.1771
-13.3835
-15.5688
-13.9342
-16.3513
-15.0554
-16.9212
-16.6953
-17.7157
-18.1473
-18.6457
-18.6098
-17.9401
-16.5812
-15.3361
-13.0482
2.23064
2.36775
4.76441
4.08507
6.42049
6.49982
8.12108
9.04954
10.3556
11.6407
13.0675
14.4836
16.143
17.3816
19.4745
21.3495
22.2975
24.338
24.1867
26.2427
26.6338
28.0495
28.9803
30.0909
31.1494
32.2418
33.2533
34.366
35.1799
36.2645
34.5473
35.6382
37.2172
37.1223
38.7323
38.9853
40.0432
40.7122
41.5102
42.2802
43.0621
43.7999
44.658
45.2844
46.2834
48.814
49.9622
51.0214
51.0703
52.3431
52.4763
53.2541
53.4564
53.7414
53.9351
54.1985
54.6535
55.3064
55.8491
56.4931
57.9507
58.0413
58.4887
58.1195
58.6252
58.2203
58.3737
58.1388
58.0731
57.8823
57.6604
57.445
57.1962
57.3265
57.0794
63.3957
61.5218
60.5752
59.1698
58.7681
57.615
56.975
55.7693
54.5323
52.9132
51.219
49.6563
48.6317
48.4438
46.9205
46.5245
44.5829
42.2217
38.8384
35.5956
32.0534
29.2086
26.6481
24.8988
23.6474
23.0124
22.8637
23.3933
23.8758
22.6564
55.4483
52.0402
45.9359
38.861
31.7302
25.2731
21.4224
19.3572
18.5033
19.0452
19.8285
20.1667
19.8937
19.0599
17.7042
40.3614
40.7847
41.0918
41.088
41.2404
41.746
42.3799
42.241
42.1436
42.0814
42.5129
42.0897
41.9332
42.0756
41.534
41.3282
41.4615
41.3847
40.5421
40.8029
40.7181
40.0434
39.8418
40.3344
40.1448
39.4894
39.3352
39.8118
39.7833
39.0512
39.4311
39.5052
39.0534
38.9399
39.2781
39.3875
38.9394
39.1254
39.32
39.0705
39.0046
39.1781
39.32
39.1368
39.096
39.2113
39.3378
39.1807
39.281
39.2563
39.1517
39.158
39.2768
39.3859
39.3
39.299
39.399
39.7472
39.7127
39.6863
40.1697
40.1608
40.1051
40.015
40.3733
40.4765
40.9689
40.8506
40.2275
41.1647
41.8617
38.2257
36.5403
39.0144
39.7201
26.8096
33.7896
35.9795
7.79109
15.5971
20.0264
19.6359
23.3609
19.2831
17.17
21.7223
21.9832
23.0236
23.2107
23.5809
25.1882
28.7271
32.1443
21.5298
22.5245
25.5407
28.3622
28.0536
28.937
29.3311
31.433
40.1358
31.9089
33.9152
33.8752
35.7231
39.2969
41.1127
41.6051
42.7444
41.995
54.6977
47.712
48.526
48.3603
48.1838
49.7313
52.6937
53.4743
49.0461
56.0386
56.267
58.3243
58.585
56.962
55.2837
54.0403
55.1519
50.0873
60.1977
58.4579
53.5275
52.5176
50.7163
47.3252
44.9683
41.9536
33.6664
42.8659
46.8057
40.6996
37.8382
33.6561
28.208
23.8916
21.9646
18.7576
14.2214
14.4229
17.3495
13.4157
13.3376
12.6544
11.2284
6.32414
5.13995
7.40245
-1.43759
9.66502
7.34788
5.49959
11.1412
6.27852
8.43514
7.51328
9.23807
11.5233
7.81997
9.93505
11.4672
8.94174
9.758
9.08559
9.90042
11.4932
9.06862
9.74292
9.0107
9.83196
11.2218
8.37109
9.77923
10.9715
8.68357
9.26041
8.49649
9.21068
10.7313
8.19576
8.82098
7.93463
8.81665
10.2516
7.07254
8.62145
9.83587
7.29041
7.93143
7.01487
7.81779
9.2886
6.63676
7.3058
6.3514
7.23667
8.51409
5.50719
6.93617
7.93174
5.65683
6.22006
5.41029
6.05951
7.16802
5.00669
5.52937
4.76153
5.38949
6.2229
4.01587
4.97954
5.5116
3.91388
4.24294
3.65443
3.99073
4.45871
3.07207
3.30012
2.76659
2.99599
3.16271
1.89843
2.22412
2.15161
1.21589
1.18059
0.705779
0.703563
0.768157
0.000717846
0.00119233
0.00195306
0.00249098
0.00312068
0.0036903
0.00429041
0.004877
0.00547675
0.00607697
0.00668508
0.00729647
0.00791157
0.00852637
0.00913716
0.0097378
0.0103212
0.0108787
0.0114015
0.0118809
0.0123104
0.0126862
0.0130095
0.0132866
0.0135291
0.0137526
0.0139746
0.0142105
0.0144711
0.0147598
0.015075
0.0154166
0.0157963
0.0162461
0.0168157
0.0175551
0.0184817
0.0195463
0.020629
0.0215797
0.0222626
0.0225518
0.0223602
0.0216648
0.0204971
0.0189459
0.017121
0.0150842
0.0127683
0.00990786
0.00605047
0.000671858
-0.00670647
-0.0164483
-0.0287609
-0.0434254
-0.0584407
-0.0807198
-0.160277
-0.179464
-0.382453
-0.420574
-0.571746
-0.720735
-0.814773
-0.853377
-0.814232
-0.716152
-0.553221
-0.373976
-0.173521
-0.00161026
0.16771
0.243632
0.373322
0.343049
0.392697
0.490969
0.0821302
0.00205666
0.00339697
0.00554347
0.00709794
0.00886842
0.0104791
0.0121542
0.0137889
0.015448
0.0171024
0.0187696
0.0204388
0.0221098
0.0237716
0.0254131
0.0270164
0.0285607
0.0300211
0.0313717
0.032588
0.0336508
0.0345506
0.0352912
0.0358918
0.0363871
0.0368235
0.037252
0.0377185
0.0382535
0.0388669
0.0395535
0.0403123
0.0411769
0.0422404
0.043648
0.0455466
0.0479885
0.0508347
0.0537423
0.05629
0.0581071
0.0588566
0.0583186
0.0564642
0.0534278
0.0495215
0.0451395
0.0405664
0.0357456
0.0300673
0.0223699
0.0112297
-0.00475433
-0.0268243
-0.0560027
-0.0922878
-0.13121
-0.190419
-0.369481
-0.291804
-0.668317
-0.775002
-1.08252
-1.37783
-1.57032
-1.64721
-1.57064
-1.38079
-1.07404
-0.728473
-0.367019
-0.0310564
0.255564
0.462643
0.654529
0.732599
0.836205
0.969143
0.939967
0.00320503
0.00549106
0.00913946
0.0117755
0.0147817
0.0175146
0.0203586
0.0231342
0.025953
0.028765
0.0316007
0.0344414
0.0372876
0.0401209
0.0429226
0.0456631
0.0483075
0.0508142
0.0531398
0.0552429
0.0570913
0.0586685
0.0599805
0.0610593
0.0619628
0.0627685
0.0635623
0.0644211
0.0653961
0.0665038
0.0677345
0.0690853
0.0706118
0.0724703
0.0749058
0.0781678
0.0823467
0.0872083
0.0921722
0.0965252
0.0996365
0.100929
0.100022
0.0968505
0.0916258
0.0848543
0.0771767
0.0690439
0.060321
0.0499305
0.0358639
0.0156903
-0.012942
-0.0520725
-0.1033
-0.166158
-0.233384
-0.331306
-0.549495
-0.342687
-0.804519
-0.927197
-1.31483
-1.67749
-1.91154
-2.00068
-1.90153
-1.66716
-1.29324
-0.873403
-0.441746
-0.0350404
0.298222
0.560684
0.779678
0.895912
1.05411
1.1273
1.36426
0.0042928
0.00751622
0.0126058
0.0163121
0.0205165
0.0243453
0.0283212
0.0322022
0.0361398
0.040067
0.0440251
0.0479894
0.0519599
0.0559115
0.059818
0.0636383
0.0673235
0.0708156
0.0740536
0.0769795
0.0795481
0.0817361
0.0835519
0.0850401
0.086282
0.0873867
0.0884748
0.0896543
0.0909972
0.0925257
0.0942246
0.0960872
0.0981894
0.10075
0.104117
0.108644
0.114466
0.121255
0.128193
0.134279
0.138631
0.14044
0.139175
0.134746
0.127451
0.118009
0.107334
0.0960818
0.084088
0.069856
0.0505736
0.0228419
-0.0166171
-0.0706648
-0.141555
-0.228348
-0.321766
-0.452768
-0.668814
-0.394487
-1.0091
-1.14235
-1.61774
-2.06595
-2.35077
-2.45409
-2.32647
-2.0356
-1.57479
-1.06033
-0.534013
-0.0373482
0.364462
0.685546
0.950504
1.08623
1.30433
1.33707
1.65423
0.00527632
0.00947066
0.016001
0.0207973
0.026213
0.0311546
0.0362771
0.0412791
0.0463506
0.0514088
0.0565054
0.0616099
0.0667221
0.0718102
0.0768408
0.0817611
0.0865084
0.0910079
0.095181
0.0989528
0.102265
0.105086
0.107427
0.109345
0.110945
0.112369
0.113771
0.115292
0.117026
0.119
0.12119
0.123586
0.126279
0.129554
0.133862
0.139675
0.147175
0.155942
0.164911
0.172786
0.178428
0.180785
0.179168
0.173455
0.164025
0.151811
0.138008
0.123483
0.108044
0.0897517
0.0649545
0.0292628
-0.0215152
-0.0910328
-0.182106
-0.293036
-0.41328
-0.575263
-0.781696
-0.475653
-1.25586
-1.39727
-1.97046
-2.52133
-2.86618
-2.98546
-2.82453
-2.46786
-1.90593
-1.28131
-0.645807
-0.0434551
0.437014
0.830669
1.14491
1.31327
1.58884
1.59459
2.10327
0.00619063
0.011372
0.0193099
0.0252016
0.0318179
0.0378699
0.0441309
0.0502475
0.0564441
0.0626242
0.0688491
0.0750832
0.0813259
0.0875391
0.093682
0.0996905
0.105488
0.110983
0.116078
0.120683
0.124723
0.128162
0.131012
0.133341
0.13528
0.137001
0.138697
0.140542
0.142649
0.145051
0.147715
0.150619
0.153873
0.157824
0.163036
0.170103
0.179268
0.190017
0.20103
0.210709
0.217656
0.220572
0.218609
0.211611
0.200043
0.185062
0.168163
0.150457
0.131744
0.109655
0.0796901
0.0364835
-0.0250289
-0.109262
-0.219534
-0.353334
-0.500171
-0.691078
-0.884478
-0.608813
-1.47463
-1.64506
-2.314
-2.96897
-3.37092
-3.50168
-3.30484
-2.88249
-2.22089
-1.48999
-0.750223
-0.0462037
0.506989
0.972307
1.32967
1.53263
1.86097
1.83951
2.44107
0.00703363
0.0132271
0.0225472
0.0295445
0.0373584
0.0445258
0.0519256
0.0591589
0.066481
0.0737839
0.0811375
0.0885017
0.0958755
0.103215
0.110471
0.11757
0.12442
0.130913
0.136934
0.142374
0.147145
0.151201
0.154557
0.157294
0.159566
0.161579
0.163564
0.165728
0.168208
0.171038
0.174175
0.177582
0.181381
0.185985
0.192075
0.200384
0.211224
0.223991
0.237093
0.248621
0.256916
0.260418
0.258117
0.249818
0.236068
0.218263
0.198214
0.177305
0.155349
0.129539
0.0945085
0.0439247
-0.0281003
-0.1267
-0.255596
-0.411533
-0.585435
-0.803422
-0.982924
-0.797042
-1.66498
-1.90119
-2.66286
-3.4272
-3.8847
-4.02213
-3.78535
-3.29502
-2.53142
-1.69445
-0.85077
-0.0457753
0.578337
1.1147
1.51247
1.74845
2.12532
2.07602
2.78718
0.00781769
0.0150446
0.0257147
0.0338247
0.0428277
0.0511116
0.0596459
0.0679939
0.0764374
0.0848595
0.0933373
0.101827
0.110328
0.118789
0.127156
0.135341
0.143241
0.150729
0.157672
0.163943
0.169439
0.174107
0.177959
0.181093
0.183684
0.185976
0.188236
0.190708
0.193552
0.196804
0.200405
0.2043
0.208618
0.21384
0.220771
0.230298
0.242821
0.257639
0.272875
0.2863
0.295984
0.300098
0.297466
0.287848
0.271875
0.25119
0.22795
0.203841
0.178721
0.149344
0.10946
0.0517965
-0.0302946
-0.142615
-0.289209
-0.466358
-0.66758
-0.910622
-1.08357
-1.04918
-1.83141
-2.17833
-3.03008
-3.91391
-4.42723
-4.56613
-4.28395
-3.7209
-2.84947
-1.90295
-0.952128
-0.0433202
0.652456
1.26232
1.69866
1.96944
2.38993
2.31358
3.11733
0.00854761
0.0168307
0.0288192
0.0380493
0.0482335
0.0576356
0.0673011
0.0767627
0.0863249
0.0958639
0.105463
0.115076
0.124701
0.134282
0.143758
0.153029
0.161978
0.170462
0.178328
0.185429
0.191649
0.196922
0.201265
0.204785
0.207684
0.21024
0.212764
0.215536
0.218737
0.222408
0.226468
0.230838
0.235651
0.241452
0.249186
0.259909
0.274125
0.291042
0.308471
0.323852
0.334979
0.339739
0.336785
0.325822
0.307565
0.283917
0.257403
0.230056
0.201803
0.168956
0.124367
0.0598562
-0.0319088
-0.15735
-0.320781
-0.518448
-0.747118
-1.01403
-1.19999
-1.37618
-1.97231
-2.47823
-3.41553
-4.43033
-4.99899
-5.13199
-4.79789
-4.157
-3.17183
-2.11293
-1.05256
-0.0379749
0.729081
1.41475
1.88646
2.19501
2.65281
2.5592
3.39418
0.00923016
0.0185911
0.0318652
0.0422212
0.053577
0.0640978
0.0748899
0.0854632
0.0961401
0.106793
0.117509
0.128243
0.138988
0.149687
0.160268
0.170625
0.180622
0.190101
0.198889
0.20682
0.213759
0.219633
0.224457
0.228351
0.231544
0.234349
0.237121
0.24018
0.243732
0.247818
0.252331
0.257162
0.262439
0.268777
0.277266
0.289158
0.305082
0.324151
0.343842
0.361247
0.373878
0.379321
0.376052
0.363711
0.343094
0.316374
0.286476
0.255816
0.224426
0.188174
0.139001
0.0678712
-0.0331516
-0.171066
-0.350461
-0.568072
-0.824008
-1.11529
-1.34006
-1.75257
-2.06986
-2.79874
-3.8214
-4.98037
-5.60371
-5.72084
-5.32697
-4.60244
-3.49713
-2.32318
-1.15102
-0.0291149
0.808331
1.5719
2.07514
2.4245
2.91271
2.80137
3.70141
0.00987021
0.0203305
0.0348575
0.0463449
0.0588622
0.0705018
0.0824155
0.0940981
0.105886
0.117648
0.129479
0.141328
0.153192
0.165006
0.176692
0.188132
0.199179
0.209653
0.219363
0.228122
0.235779
0.242248
0.247544
0.2518
0.25527
0.258307
0.261312
0.264646
0.268542
0.273039
0.278002
0.283278
0.288988
0.295813
0.305006
0.318035
0.335685
0.356971
0.379003
0.398511
0.412716
0.418884
0.415306
0.401544
0.378468
0.34853
0.31508
0.280968
0.246364
0.206688
0.15297
0.0753818
-0.0345267
-0.18431
-0.378913
-0.616098
-0.899045
-1.21715
-1.49845
-2.08423
-2.10288
-3.14194
-4.25261
-5.57144
-6.24955
-6.33814
-5.87482
-5.05973
-3.82669
-2.53448
-1.24765
-0.0166312
0.890687
1.73441
2.26501
2.65887
3.17019
3.03858
4.00763
0.0104725
0.0220527
0.0378003
0.0504236
0.0640914
0.0768494
0.089879
0.102668
0.115562
0.128431
0.141371
0.154333
0.167311
0.180237
0.193027
0.20555
0.217646
0.229116
0.23975
0.249337
0.257708
0.264766
0.270524
0.275127
0.278858
0.282109
0.285328
0.288924
0.293156
0.298062
0.30347
0.309177
0.315284
0.322542
0.332377
0.346508
0.365905
0.389482
0.413944
0.435647
0.451503
0.458442
0.454558
0.439317
0.41365
0.380294
0.343056
0.305265
0.267269
0.224047
0.165726
0.0817761
-0.0366762
-0.19776
-0.406942
-0.663519
-0.973359
-1.3218
-1.66301
-2.29058
-2.11719
-3.52533
-4.71313
-6.21071
-6.94489
-6.98926
-6.44454
-5.53069
-4.16117
-2.74703
-1.34221
-0.000104547
0.976156
1.90286
2.4565
2.89895
3.42527
3.28792
4.27015
0.0110409
0.0237612
0.0406977
0.0544608
0.0692678
0.0831428
0.0972823
0.111174
0.125169
0.139141
0.153186
0.167257
0.181346
0.195382
0.209273
0.22288
0.236025
0.248494
0.260051
0.270467
0.27955
0.287191
0.293401
0.298336
0.302307
0.305751
0.309166
0.313009
0.317571
0.322883
0.328733
0.334857
0.341323
0.348952
0.35936
0.374552
0.39572
0.421673
0.448667
0.472664
0.490258
0.498015
0.493823
0.47702
0.448585
0.411539
0.370179
0.328365
0.286668
0.23964
0.176549
0.0862787
-0.0403967
-0.212259
-0.435549
-0.711545
-1.04854
-1.43129
-1.83182
-2.43137
-2.18882
-3.92356
-5.20912
-6.90511
-7.69841
-7.67985
-7.03915
-6.01676
-4.50083
-2.96091
-1.43431
0.0205354
1.06617
2.07758
2.64873
3.14579
3.67772
3.52855
4.5592
0.0115789
0.0254588
0.0435536
0.0584594
0.0743937
0.089384
0.104627
0.119618
0.134708
0.149778
0.164923
0.180099
0.195296
0.210439
0.225431
0.240121
0.254317
0.267785
0.280269
0.291513
0.301306
0.309525
0.316175
0.321426
0.325617
0.32923
0.332819
0.336893
0.341777
0.347497
0.353788
0.360313
0.367098
0.375029
0.38593
0.402135
0.425101
0.453527
0.483166
0.509569
0.528994
0.537616
0.533097
0.514614
0.483166
0.442063
0.396123
0.349799
0.303933
0.252699
0.18459
0.088032
-0.0465291
-0.228679
-0.465749
-0.761409
-1.12638
-1.54783
-2.00848
-2.5779
-2.41975
-4.31764
-5.75652
-7.66162
-8.51969
-8.41651
-7.66252
-6.51976
-4.84622
-3.17671
-1.52357
0.0449311
1.1629
2.25782
2.8447
3.39857
3.92793
3.77517
4.83307
0.0120896
0.027148
0.0463712
0.0624224
0.0794717
0.0955749
0.111914
0.128
0.14418
0.160342
0.176583
0.192859
0.20916
0.225408
0.241499
0.257273
0.272521
0.286992
0.300404
0.312478
0.32298
0.331768
0.338847
0.344396
0.348785
0.352543
0.356282
0.360571
0.36577
0.371897
0.378631
0.385543
0.392602
0.400757
0.412062
0.429225
0.454019
0.485027
0.517435
0.546367
0.56772
0.577248
0.572357
0.552017
0.517221
0.471569
0.420448
0.368963
0.318294
0.262339
0.188949
0.0861903
-0.0558655
-0.247832
-0.498481
-0.814262
-1.2086
-1.67316
-2.19617
-2.77154
-2.86863
-4.72814
-6.37791
-8.48803
-9.41897
-9.20651
-8.31931
-7.04191
-5.19818
-3.395
-1.60959
0.0734209
1.2668
2.44262
3.04939
3.65614
4.1756
4.01997
5.08598
0.0125755
0.0288311
0.0491537
0.0663522
0.0845042
0.101717
0.119145
0.136321
0.153585
0.170834
0.188165
0.205537
0.222938
0.240288
0.257478
0.274335
0.290639
0.306115
0.320458
0.333364
0.344572
0.353924
0.361419
0.367247
0.371809
0.375684
0.379549
0.384034
0.38954
0.396078
0.403258
0.410545
0.41783
0.426125
0.43773
0.455784
0.482442
0.516155
0.551467
0.58306
0.606438
0.616893
0.611538
0.589077
0.550474
0.499641
0.442584
0.385123
0.328878
0.26765
0.18879
0.0800368
-0.0690388
-0.270353
-0.534486
-0.871048
-1.29665
-1.8086
-2.39813
-3.0347
-3.52049
-5.136
-7.0828
-9.39353
-10.4075
-10.0576
-9.01482
-7.58572
-5.55744
-3.61592
-1.69201
0.106509
1.3781
2.63239
3.26295
3.91967
4.4208
4.26095
5.37349
0.0130389
0.0305097
0.0519041
0.0702512
0.0894931
0.107812
0.126321
0.144582
0.162923
0.181254
0.199668
0.218131
0.236628
0.255079
0.273365
0.291308
0.308669
0.325154
0.340432
0.354171
0.366085
0.375995
0.383892
0.389979
0.394688
0.398651
0.402612
0.407274
0.41308
0.420033
0.427666
0.435317
0.442778
0.451117
0.462904
0.481774
0.510333
0.546888
0.585252
0.619644
0.645132
0.656498
0.650506
0.625538
0.582524
0.525728
0.46184
0.397455
0.334797
0.267816
0.183463
0.0690852
-0.0864381
-0.296629
-0.574239
-0.932414
-1.39155
-1.95517
-2.61724
-3.36324
-4.24366
-5.48248
-7.86354
-10.3873
-11.4981
-10.9782
-9.75495
-8.15417
-5.92452
-3.83945
-1.77045
0.144606
1.49731
2.82768
3.48503
4.18839
4.66576
4.51571
5.64381
0.0134818
0.0321857
0.0546249
0.0741216
0.0944405
0.113862
0.133443
0.152783
0.172194
0.191601
0.211093
0.230642
0.250231
0.269778
0.289161
0.30819
0.326611
0.344109
0.360327
0.374903
0.387521
0.397983
0.406269
0.412593
0.41742
0.421438
0.425465
0.430282
0.436382
0.443758
0.451854
0.459859
0.467443
0.475721
0.487556
0.507151
0.537654
0.577204
0.618774
0.656101
0.683757
0.695945
0.689023
0.661003
0.612817
0.549152
0.477441
0.405132
0.335277
0.262244
0.172605
0.0531508
-0.108153
-0.326749
-0.6179
-0.998661
-1.49383
-2.11344
-2.85523
-3.73778
-4.88594
-5.79821
-8.74886
-11.4775
-12.7044
-11.9768
-10.546
-8.7508
-6.30002
-4.06564
-1.84455
0.188132
1.6249
3.02881
3.71615
4.46091
4.91319
4.76676
5.89555
0.0139056
0.0338604
0.0573185
0.0779652
0.0993482
0.119867
0.140511
0.160924
0.181398
0.201874
0.222438
0.243067
0.263744
0.284386
0.304864
0.32498
0.344465
0.362981
0.380144
0.39556
0.408882
0.419888
0.428549
0.435087
0.440002
0.44404
0.448101
0.453048
0.459435
0.467244
0.475818
0.484172
0.491824
0.499924
0.511652
0.531867
0.564361
0.607073
0.652008
0.692393
0.722212
0.735017
0.726698
0.694901
0.640644
0.569138
0.488612
0.407449
0.329785
0.250667
0.156195
0.0323814
-0.133955
-0.360489
-0.665306
-1.06973
-1.60354
-2.28352
-3.11277
-4.14565
-5.45048
-6.18317
-9.77792
-12.6754
-14.0407
-13.0619
-11.3945
-9.37964
-6.68488
-4.29459
-1.91393
0.23755
1.76124
3.23618
3.95678
4.73766
5.16511
5.01567
6.18908
0.0143118
0.0355352
0.059987
0.0817838
0.104218
0.12583
0.147528
0.169007
0.190535
0.212074
0.233702
0.255406
0.277165
0.298899
0.320472
0.341677
0.362229
0.381769
0.399883
0.416143
0.430171
0.441715
0.450736
0.457463
0.462432
0.466452
0.470509
0.475562
0.48223
0.490486
0.499557
0.508259
0.51592
0.523712
0.535159
0.55587
0.590405
0.636459
0.684912
0.728433
0.760304
0.773341
0.762946
0.726466
0.665167
0.584899
0.494707
0.403953
0.318126
0.233178
0.13456
0.00724761
-0.163314
-0.397334
-0.715994
-1.14521
-1.72025
-2.46495
-3.39011
-4.58476
-6.01146
-6.74892
-10.9105
-13.9983
-15.5207
-14.2414
-12.3072
-10.0449
-7.08034
-4.52638
-1.97819
0.293336
1.90673
3.45025
4.20718
5.01927
5.42235
5.2915
6.46528
0.0147014
0.0372112
0.0626325
0.0855789
0.109051
0.13175
0.154493
0.177031
0.199605
0.222199
0.244885
0.267657
0.290494
0.313317
0.335984
0.358279
0.379903
0.400473
0.419545
0.436655
0.451388
0.463465
0.472829
0.479721
0.484708
0.488668
0.492683
0.497814
0.504756
0.513475
0.523071
0.532123
0.539734
0.547075
0.558038
0.579101
0.61573
0.665314
0.717409
0.764062
0.797697
0.81034
0.796952
0.754756
0.685498
0.595768
0.495347
0.394541
0.30047
0.210223
0.108343
-0.0215017
-0.195451
-0.436529
-0.769249
-1.22441
-1.84315
-2.6568
-3.68668
-5.0532
-6.59378
-7.55467
-12.1233
-15.4675
-17.1602
-15.5227
-13.2907
-10.7509
-7.48792
-4.76114
-2.03694
0.355966
2.0617
3.67148
4.46753
5.30577
5.68453
5.5596
6.71441
0.0150754
0.0388895
0.0652566
0.089352
0.113849
0.137628
0.161407
0.184996
0.208608
0.232248
0.255984
0.279819
0.303729
0.327636
0.351397
0.374785
0.397486
0.419093
0.43913
0.457096
0.472537
0.48514
0.494832
0.50186
0.506827
0.510683
0.514611
0.519789
0.527
0.536204
0.546357
0.55577
0.56327
0.570001
0.58025
0.601493
0.640268
0.693565
0.749364
0.798992
0.833846
0.845178
0.827667
0.778719
0.700845
0.601363
0.490519
0.379473
0.277322
0.182538
0.0784319
-0.0529086
-0.229403
-0.477145
-0.824158
-1.30636
-1.97109
-2.85762
-4.00079
-5.54627
-7.21152
-8.63295
-13.4058
-17.1134
-18.9788
-16.9126
-14.3518
-11.5019
-7.90929
-4.99903
-2.08981
0.425917
2.22648
3.90037
4.73799
5.59712
5.95281
5.84179
6.99922
0.0154344
0.0405711
0.0678608
0.0931044
0.118612
0.143466
0.16827
0.192902
0.217543
0.242222
0.267
0.291889
0.316867
0.341856
0.366709
0.391192
0.414975
0.437627
0.458639
0.477468
0.493618
0.506742
0.516746
0.523881
0.528788
0.53249
0.536283
0.541476
0.54895
0.558664
0.569417
0.579207
0.586535
0.592481
0.601751
0.62297
0.663935
0.721097
0.78054
0.832748
0.867944
0.876743
0.853861
0.797347
0.710707
0.601703
0.480587
0.359316
0.249435
0.151063
0.0458754
-0.0858885
-0.264102
-0.518145
-0.879677
-1.38993
-2.10262
-3.06553
-4.32952
-6.05691
-7.87654
-9.99944
-14.7347
-18.9693
-21.0011
-18.4177
-15.4969
-12.3019
-8.3461
-5.24029
-2.1364
0.503657
2.40136
4.13738
5.01863
5.89338
6.22747
6.12463
7.2316
0.0157788
0.042257
0.0704466
0.096837
0.123343
0.149264
0.175083
0.200748
0.226408
0.252117
0.277929
0.303866
0.329905
0.355973
0.381917
0.407498
0.432369
0.456075
0.478071
0.497771
0.514635
0.528274
0.538573
0.545784
0.550587
0.554083
0.557689
0.562858
0.57059
0.580847
0.59225
0.602445
0.60954
0.614509
0.622493
0.643441
0.686615
0.74772
0.810541
0.864598
0.898879
0.903668
0.874268
0.80991
0.715037
0.597224
0.466219
0.334845
0.217708
0.116847
0.0117938
-0.119312
-0.298447
-0.558449
-0.934685
-1.47383
-2.23611
-3.27832
-4.66883
-6.57702
-8.59613
-11.584
-16.0174
-21.0391
-23.2547
-20.0447
-16.7318
-13.1548
-8.79976
-5.48529
-2.17632
0.58964
2.58658
4.38299
5.30946
6.19443
6.50918
6.40545
7.51494
0.0161091
0.043948
0.0730151
0.100551
0.128041
0.155022
0.181844
0.208535
0.235204
0.261934
0.28877
0.315747
0.342842
0.369984
0.397019
0.4237
0.449665
0.474434
0.497425
0.518007
0.535588
0.549738
0.560314
0.56757
0.572222
0.575455
0.578816
0.583921
0.591904
0.602741
0.614857
0.625494
0.632297
0.636075
0.642418
0.662792
0.70814
0.773117
0.838742
0.893509
0.925231
0.924445
0.887852
0.816197
0.714292
0.588695
0.448262
0.306927
0.183082
0.08095
-0.0227053
-0.152076
-0.33136
-0.59698
-0.988044
-1.55674
-2.36984
-3.49353
-5.01409
-7.0995
-9.36698
-13.1848
-17.1604
-23.3136
-25.7667
-21.8008
-18.0617
-14.0634
-9.27126
-5.7345
-2.20919
0.684296
2.78237
4.63763
5.61041
6.50034
6.79884
6.71276
7.78752
0.0164253
0.0456449
0.0755673
0.104247
0.132708
0.160741
0.188556
0.216261
0.243929
0.27167
0.299521
0.32753
0.355674
0.383886
0.412011
0.439795
0.466861
0.492703
0.516701
0.538175
0.55648
0.571137
0.581972
0.589239
0.593691
0.596598
0.599651
0.604646
0.612875
0.624335
0.637238
0.648369
0.654825
0.657176
0.66146
0.680873
0.72825
0.796788
0.864245
0.918117
0.945327
0.937694
0.894133
0.816614
0.709325
0.577062
0.427614
0.276402
0.146443
0.0443677
-0.0565898
-0.183144
-0.361822
-0.632706
-1.03866
-1.6374
-2.50215
-3.70874
-5.36065
-7.61949
-10.1764
-14.5902
-18.2551
-25.8528
-28.5654
-23.6935
-19.4911
-15.0299
-9.76112
-5.98842
-2.23464
0.788033
2.9889
4.90167
5.92137
6.81101
7.096
7.01053
8.01204
0.0167275
0.0473485
0.078104
0.107926
0.137344
0.16642
0.195216
0.223926
0.252582
0.281323
0.310181
0.339213
0.368398
0.397676
0.426889
0.455779
0.483953
0.51088
0.535899
0.558277
0.577312
0.592473
0.60355
0.610792
0.61499
0.617505
0.62018
0.625015
0.633483
0.645616
0.659396
0.671087
0.677145
0.677803
0.679531
0.697473
0.746549
0.817998
0.885841
0.936729
0.957468
0.942577
0.893395
0.812094
0.701204
0.563303
0.405115
0.244003
0.108546
0.0079729
-0.0889396
-0.21158
-0.388899
-0.664697
-1.08558
-1.71476
-2.63168
-3.92189
-5.70461
-8.13485
-11.0139
-15.7923
-19.4611
-28.6582
-31.6832
-25.7307
-21.0246
-16.0554
-10.2694
-6.24741
-2.25226
0.901239
3.20629
5.1754
6.24213
7.12624
7.40144
7.30095
8.29284
0.0170155
0.0490597
0.0806261
0.111588
0.141949
0.17206
0.201825
0.23153
0.261162
0.290893
0.320745
0.350791
0.381011
0.411349
0.441649
0.471648
0.500938
0.528962
0.555016
0.578313
0.598087
0.613748
0.625049
0.632231
0.636118
0.638168
0.640388
0.645005
0.653704
0.666569
0.68133
0.693666
0.699279
0.697944
0.696507
0.712284
0.762454
0.835766
0.901984
0.947435
0.960375
0.939148
0.886631
0.803858
0.691027
0.548316
0.381468
0.210282
0.069969
-0.0275078
-0.118957
-0.236547
-0.411782
-0.692206
-1.12818
-1.78824
-2.75776
-4.13182
-6.0437
-8.64694
-11.8732
-16.8577
-20.9609
-31.6223
-35.1624
-27.9193
-22.6665
-17.1401
-10.7955
-6.51147
-2.26159
1.0243
3.43459
5.459
6.57246
7.44617
7.71624
7.6234
8.56662
0.0172892
0.0507791
0.0831341
0.115233
0.146524
0.17766
0.208382
0.23907
0.269667
0.300376
0.331212
0.362263
0.393508
0.424902
0.456287
0.487397
0.517812
0.546946
0.574051
0.598282
0.618805
0.634965
0.646473
0.653555
0.657073
0.658578
0.660258
0.664593
0.673515
0.687177
0.703041
0.716126
0.721253
0.71757
0.712202
0.724861
0.775205
0.848848
0.910763
0.948498
0.953717
0.928409
0.875254
0.793177
0.679796
0.532855
0.357192
0.175585
0.031102
-0.0614925
-0.14596
-0.257333
-0.429851
-0.714824
-1.16637
-1.85809
-2.88081
-4.33881
-6.37805
-9.16033
-12.7489
-17.845
-22.8919
-34.7035
-39.063
-30.2663
-24.4215
-18.2829
-11.3383
-6.78001
-2.26199
1.15762
3.67381
5.75252
6.91203
7.7709
8.0388
7.92904
8.78085
0.0175481
0.0525075
0.0856285
0.118863
0.151068
0.18322
0.214886
0.246545
0.278095
0.30977
0.34158
0.373623
0.405886
0.43833
0.470798
0.503023
0.534571
0.564828
0.593003
0.618185
0.639468
0.656128
0.667824
0.674768
0.677851
0.678726
0.679774
0.683755
0.692887
0.707421
0.724528
0.738484
0.743081
0.736614
0.726326
0.734624
0.783906
0.855643
0.910093
0.939021
0.938369
0.911989
0.860771
0.78121
0.668358
0.517499
0.332615
0.140042
-0.00784799
-0.0935263
-0.169385
-0.273395
-0.442813
-0.732713
-1.20094
-1.92573
-3.00278
-4.54501
-6.71062
-9.68158
-13.6359
-18.8353
-25.4516
-37.9322
-43.4804
-32.7799
-26.2933
-19.4817
-11.8957
-7.05171
-2.25264
1.30167
3.92388
6.05586
7.26043
8.1003
8.37023
8.24636
9.05886
0.0177917
0.0542455
0.0881096
0.122477
0.155582
0.18874
0.221337
0.253955
0.286444
0.319074
0.351843
0.38487
0.418141
0.451627
0.485176
0.518519
0.551208
0.582604
0.611868
0.638021
0.660077
0.677238
0.689105
0.69587
0.698452
0.698605
0.698916
0.702461
0.711789
0.727277
0.745784
0.760752
0.764757
0.754931
0.738451
0.740955
0.787485
0.854089
0.898356
0.919507
0.916139
0.8917
0.844556
0.768933
0.657382
0.502667
0.307885
0.103587
-0.0468325
-0.123265
-0.188808
-0.284467
-0.450915
-0.746919
-1.23393
-1.99417
-3.12747
-4.75467
-7.04701
-10.2178
-14.5305
-19.932
-28.842
-41.2929
-48.5067
-35.4716
-28.2838
-20.7325
-12.465
-7.32444
-2.23235
1.45706
4.18469
6.36876
7.61719
8.43462
8.70981
8.55639
9.27031
0.0180195
0.0559938
0.0905777
0.126076
0.160066
0.194219
0.227734
0.261298
0.294712
0.328283
0.362001
0.395998
0.430267
0.464789
0.499416
0.533878
0.56772
0.600271
0.630644
0.657789
0.680635
0.698299
0.71032
0.716863
0.718873
0.718204
0.717665
0.720681
0.730184
0.746715
0.766797
0.78292
0.786215
0.77223
0.748074
0.743337
0.784417
0.841992
0.875287
0.891813
0.889188
0.869195
0.827752
0.757127
0.647395
0.488652
0.283001
0.0659764
-0.0859413
-0.150481
-0.204019
-0.290747
-0.455245
-0.759743
-1.26899
-2.06822
-3.26047
-4.9738
-7.39461
-10.7758
-15.4343
-21.2266
-32.9581
-44.5567
-54.1282
-38.3538
-30.3928
-22.0307
-13.0427
-7.59527
-2.19955
1.62457
4.4561
6.69075
7.98175
8.77396
9.05723
8.86206
9.5326
0.0182307
0.0577532
0.0930328
0.129658
0.164518
0.199655
0.234074
0.268571
0.302898
0.337395
0.372048
0.407003
0.44226
0.47781
0.513511
0.549096
0.584098
0.617822
0.649326
0.677488
0.701141
0.719312
0.731472
0.737751
0.739113
0.737515
0.735999
0.738379
0.748031
0.7657
0.787538
0.804939
0.807261
0.78802
0.754813
0.741182
0.772464
0.818
0.842408
0.858481
0.859505
0.845831
0.811265
0.746413
0.638816
0.475662
0.257845
0.0268054
-0.125394
-0.175098
-0.215167
-0.293175
-0.458108
-0.775094
-1.31153
-2.15434
-3.40866
-5.20934
-7.76144
-11.3619
-16.355
-22.7557
-37.2237
-47.5444
-60.2839
-41.4311
-32.6164
-23.3705
-13.6247
-7.8604
-2.15218
1.80529
4.738
7.02122
8.35347
9.11848
9.4126
9.19672
9.79259
0.0184245
0.0595243
0.0954749
0.133225
0.168939
0.205049
0.240357
0.275773
0.310998
0.346408
0.381981
0.417881
0.454115
0.490684
0.527455
0.564165
0.600338
0.635251
0.667912
0.697116
0.721596
0.740282
0.752564
0.758535
0.759171
0.756528
0.753895
0.755518
0.765282
0.784182
0.807948
0.826662
0.827461
0.80169
0.758511
0.733149
0.749184
0.782591
0.80248
0.82194
0.828684
0.822662
0.795798
0.737298
0.632015
0.463867
0.232203
-0.0144871
-0.165554
-0.197284
-0.222984
-0.293794
-0.463394
-0.798705
-1.36865
-2.26005
-3.57918
-5.46814
-8.15485
-11.9814
-17.3031
-24.5055
-41.0635
-50.5181
-67.0427
-44.6898
-34.9465
-24.745
-14.2061
-8.11522
-2.08773
2.00069
5.03035
7.35939
8.73157
9.46828
9.77364
9.51438
9.99471
0.0186
0.0613078
0.0979041
0.136776
0.173329
0.210399
0.246582
0.282903
0.319009
0.355317
0.391795
0.428627
0.465824
0.503403
0.541239
0.579076
0.61643
0.652552
0.686396
0.71667
0.742002
0.76121
0.773601
0.77922
0.779047
0.775234
0.771328
0.772053
0.781878
0.802092
0.827909
0.847747
0.846076
0.812809
0.758949
0.717359
0.714163
0.738369
0.758406
0.784141
0.797927
0.80047
0.781913
0.730243
0.627366
0.453442
0.205784
-0.0586229
-0.206958
-0.217601
-0.22911
-0.296144
-0.476853
-0.838031
-1.44838
-2.39272
-3.7783
-5.75582
-8.58051
-12.6375
-18.2884
-26.453
-44.4694
-53.9141
-74.3811
-48.1119
-37.3685
-26.146
-14.7812
-8.3544
-2.00326
2.21267
5.33327
7.70432
9.1152
9.82307
10.1402
9.82253
10.2644
0.0187562
0.0631043
0.10032
0.14031
0.177685
0.215704
0.252746
0.289956
0.32693
0.364119
0.401488
0.439236
0.477383
0.515962
0.554857
0.593821
0.632366
0.669718
0.704773
0.736149
0.762357
0.782098
0.794585
0.799807
0.79874
0.793622
0.788271
0.787935
0.797747
0.819323
0.847176
0.867513
0.862179
0.821132
0.754696
0.688971
0.665857
0.68881
0.712765
0.746262
0.768084
0.779854
0.770096
0.725712
0.625292
0.444597
0.178226
-0.106494
-0.250379
-0.237231
-0.236471
-0.305608
-0.506102
-0.901611
-1.55848
-2.55824
-4.01026
-6.07599
-9.04154
-13.3311
-19.319
-28.5769
-47.589
-58.1589
-82.127
-51.6902
-39.8611
-27.5638
-15.3439
-8.57195
-1.89553
2.44362
5.64713
8.05497
9.5034
10.1826
10.5124
10.1613
10.5373
0.018892
0.0649144
0.102722
0.143827
0.182008
0.220962
0.258848
0.296932
0.334756
0.372811
0.411053
0.449702
0.488785
0.528352
0.5683
0.608392
0.648138
0.68674
0.723036
0.755548
0.782662
0.80295
0.815522
0.820303
0.818251
0.811684
0.804694
0.803104
0.812793
0.835703
0.865266
0.884909
0.874914
0.825433
0.741016
0.642667
0.609756
0.634295
0.666969
0.709208
0.739665
0.761292
0.760842
0.72423
0.626303
0.437609
0.149104
-0.159172
-0.296913
-0.258277
-0.24968
-0.329583
-0.560142
-0.997746
-1.70479
-2.75986
-4.27669
-6.42964
-9.53788
-14.06
-20.3997
-30.8546
-50.5118
-63.3835
-90.0741
-55.4127
-42.3967
-28.9863
-15.8872
-8.76143
-1.76103
2.6964
5.9727
8.41025
9.89513
10.5465
10.8869
10.4797
10.7512
0.0190061
0.0667388
0.105111
0.147327
0.186296
0.226172
0.264886
0.303827
0.342485
0.381388
0.420487
0.460019
0.500023
0.540565
0.581558
0.622778
0.663734
0.703608
0.741179
0.774864
0.802915
0.823766
0.836414
0.840709
0.83758
0.829407
0.82056
0.817486
0.826886
0.850922
0.88135
0.898761
0.883682
0.825129
0.712768
0.585283
0.553348
0.577055
0.622203
0.673536
0.713237
0.745276
0.754687
0.726404
0.631025
0.432851
0.117936
-0.217908
-0.348096
-0.284093
-0.275382
-0.377281
-0.648101
-1.13267
-1.88996
-2.99759
-4.57629
-6.81476
-10.0657
-14.8178
-21.5308
-33.2535
-53.2913
-69.6237
-97.9451
-59.2536
-44.9387
-30.3991
-16.4041
-8.91602
-1.59607
2.97427
6.31121
8.76907
10.2892
10.9138
11.2638
10.8055
11.035
0.0190972
0.0685782
0.107485
0.150808
0.190548
0.231332
0.270857
0.310639
0.350114
0.389846
0.429783
0.470182
0.51109
0.552593
0.594622
0.636968
0.679145
0.720313
0.759191
0.794091
0.823115
0.844549
0.857265
0.861031
0.856728
0.846778
0.835828
0.830989
0.839827
0.864442
0.894322
0.90837
0.888364
0.817362
0.668396
0.525803
0.497555
0.519349
0.579618
0.639708
0.689346
0.732359
0.752253
0.732944
0.640224
0.43082
0.0841887
-0.284114
-0.405985
-0.319638
-0.322474
-0.458772
-0.777197
-1.30891
-2.11281
-3.26819
-4.90468
-7.22582
-10.6166
-15.5936
-22.7045
-35.723
-55.9632
-76.9031
-105.518
-63.1837
-47.4412
-31.7852
-16.8873
-9.0285
-1.3968
3.28079
6.66447
9.13042
10.6844
11.2835
11.6409
11.1198
11.2738
0.019164
0.0704331
0.109844
0.15427
0.194763
0.23644
0.276759
0.317364
0.357637
0.398181
0.438938
0.480183
0.521979
0.564427
0.607482
0.65095
0.694357
0.736843
0.777066
0.813222
0.843259
0.865298
0.878078
0.881271
0.875693
0.86378
0.850442
0.843488
0.851297
0.875455
0.903418
0.914833
0.891126
0.793764
0.617601
0.465382
0.441657
0.462182
0.539432
0.608211
0.668593
0.723111
0.754221
0.744674
0.654834
0.432169
0.0472597
-0.359258
-0.473144
-0.371985
-0.401863
-0.58289
-0.950557
-1.52449
-2.36854
-3.5653
-5.25422
-7.65313
-11.1768
-16.3696
-23.9009
-38.1928
-58.5613
-85.1558
-112.35
-67.1518
-49.8504
-33.1257
-17.328
-9.09138
-1.15934
3.61962
7.03491
9.49348
11.0794
11.6543
12.0166
11.4243
11.5712
0.0192049
0.0723043
0.112187
0.157712
0.198939
0.241495
0.28259
0.324
0.365052
0.406388
0.447945
0.490017
0.53268
0.576058
0.620125
0.664713
0.709358
0.753184
0.79479
0.832251
0.863344
0.886014
0.898854
0.90143
0.894471
0.880387
0.864332
0.854802
0.860802
0.883155
0.908948
0.920278
0.886411
0.75851
0.566234
0.403707
0.387104
0.407641
0.502311
0.579555
0.651533
0.718149
0.761352
0.762536
0.675984
0.437705
0.00642406
-0.444454
-0.552678
-0.451111
-0.524922
-0.754359
-1.16602
-1.77332
-2.64925
-3.87959
-5.61364
-8.08202
-11.7258
-17.1199
-25.0852
-40.5765
-61.0954
-93.9999
-117.983
-71.0916
-52.1075
-34.4016
-17.716
-9.09739
-0.87984
3.99439
7.42557
9.85774
11.4727
12.0245
12.3893
11.75
11.8639
0.0192182
0.0741924
0.114514
0.161133
0.203075
0.246493
0.288346
0.330543
0.372355
0.414463
0.456798
0.499677
0.543187
0.587475
0.632541
0.678243
0.724132
0.769324
0.812353
0.851168
0.883364
0.906693
0.919593
0.921508
0.913049
0.896562
0.877396
0.864659
0.867725
0.887393
0.912693
0.925145
0.867502
0.72211
0.513247
0.341356
0.333286
0.356408
0.468604
0.554309
0.638779
0.718135
0.774473
0.787602
0.705013
0.448281
-0.0392126
-0.539392
-0.64904
-0.570226
-0.700054
-0.971595
-1.4165
-2.04613
-2.94439
-4.19866
-5.96745
-8.49219
-12.2363
-17.8097
-26.2079
-42.7791
-63.5293
-102.707
-122.371
-74.9449
-54.1498
-35.5906
-18.0411
-9.04016
-0.554517
4.40855
7.84001
10.2231
11.8629
12.3921
12.7548
12.0544
12.1373
0.0192024
0.076098
0.116824
0.164531
0.207169
0.251433
0.294026
0.336989
0.379541
0.422399
0.465492
0.509155
0.553489
0.598668
0.644717
0.691525
0.738664
0.785245
0.82974
0.869964
0.903313
0.927333
0.94029
0.941494
0.931406
0.912246
0.88949
0.872697
0.87174
0.889555
0.918243
0.921819
0.842132
0.686646
0.458376
0.280011
0.279376
0.309928
0.438721
0.533066
0.630961
0.723776
0.79448
0.821072
0.743436
0.464405
-0.0904189
-0.64108
-0.770875
-0.743641
-0.928552
-1.22674
-1.69146
-2.33137
-3.24099
-4.50683
-6.29583
-8.85779
-12.6747
-18.3966
-27.2084
-44.7045
-65.8018
-110.679
-125.712
-78.5757
-55.9204
-36.6687
-18.295
-8.91443
-0.179744
4.86522
8.28211
10.5902
12.2483
12.7548
13.1112
12.3388
12.4813
0.0191555
0.0780219
0.119115
0.167906
0.211219
0.256312
0.299625
0.343335
0.386607
0.430193
0.47402
0.518443
0.563579
0.609626
0.65664
0.704543
0.752938
0.800931
0.846936
0.888625
0.923182
0.947924
0.960934
0.961368
0.949497
0.927348
0.900409
0.878591
0.873284
0.891591
0.925195
0.907447
0.818478
0.650318
0.403125
0.220836
0.22327
0.269099
0.41305
0.516516
0.628721
0.73581
0.822318
0.864265
0.792759
0.485365
-0.146144
-0.744286
-0.933603
-0.980824
-1.20278
-1.50772
-1.97836
-2.61574
-3.5238
-4.78545
-6.57536
-9.14928
-13.0043
-18.8354
-28.0236
-46.2686
-67.8701
-117.756
-128.181
-81.8979
-57.3796
-37.6066
-18.472
-8.71556
0.247906
5.36709
8.75582
10.9601
12.6274
13.1095
13.4554
12.6485
12.7989
0.0190756
0.0799649
0.121388
0.171257
0.215223
0.261128
0.305141
0.349577
0.393546
0.437838
0.482376
0.527535
0.573447
0.620337
0.668295
0.717282
0.766933
0.816361
0.863922
0.907137
0.942957
0.968452
0.981503
0.981088
0.967247
0.941729
0.909939
0.882474
0.874239
0.896826
0.925812
0.890526
0.796688
0.613121
0.349509
0.166054
0.165225
0.234628
0.391884
0.505344
0.632703
0.755001
0.858972
0.918558
0.853794
0.508044
-0.200225
-0.8455
-1.15509
-1.27926
-1.50859
-1.80061
-2.26354
-2.88463
-3.77586
-5.01416
-6.78164
-9.33759
-13.1913
-19.0863
-28.5997
-47.4127
-69.7219
-123.896
-129.725
-84.8564
-58.4819
-38.3842
-18.5662
-8.43937
0.731587
5.91641
9.26488
11.3348
12.9986
13.4538
13.7823
12.9262
13.1374
0.0189607
0.0819276
0.123641
0.17458
0.219179
0.265878
0.31057
0.355711
0.400355
0.445329
0.490553
0.536421
0.583083
0.63079
0.679668
0.729723
0.78063
0.831515
0.880678
0.925481
0.962621
0.988894
1.00196
1.00058
0.984533
0.955207
0.917993
0.885223
0.876873
0.905888
0.918021
0.876577
0.77505
0.576416
0.299201
0.11827
0.107667
0.207527
0.375639
0.500268
0.643544
0.782119
0.905441
0.985182
0.924967
0.526346
-0.24301
-0.959209
-1.47853
-1.62554
-1.82728
-2.09188
-2.53262
-3.12296
-3.98009
-5.17387
-6.89379
-9.4005
-13.2129
-19.1248
-28.9041
-48.1134
-71.34
-128.881
-130.14
-87.3486
-59.2069
-38.9871
-18.5725
-8.08244
1.27412
6.51508
9.8125
11.717
13.3607
13.784
14.0883
13.2108
13.4685
0.0188085
0.0839108
0.125872
0.177876
0.223085
0.270558
0.315909
0.361733
0.407029
0.45266
0.498544
0.545094
0.592477
0.640972
0.690743
0.741846
0.794006
0.846369
0.897181
0.943634
0.982147
1.00921
1.02222
1.01973
1.00117
0.967611
0.924893
0.888474
0.883094
0.913117
0.909067
0.864966
0.753486
0.541352
0.253717
0.0799268
0.0533692
0.188324
0.36473
0.501976
0.661861
0.81793
0.962695
1.06464
0.999552
0.532707
-0.275164
-1.14622
-1.91048
-2.01489
-2.14452
-2.36833
-2.77198
-3.31659
-4.12208
-5.25088
-6.89998
-9.32895
-13.0639
-18.9492
-28.9342
-48.3862
-72.6937
-132.424
-129.427
-89.2595
-59.5507
-39.3999
-18.4872
-7.64231
1.87789
7.16472
10.4011
12.1102
13.7129
14.097
14.3696
13.4866
13.7983
0.0186168
0.0859154
0.128082
0.181142
0.226938
0.275165
0.321154
0.367637
0.413562
0.459824
0.506342
0.553545
0.601617
0.650869
0.701503
0.753632
0.807038
0.860895
0.913401
0.961567
1.0015
1.02934
1.04219
1.03835
1.01693
0.978905
0.931513
0.894181
0.894067
0.914934
0.903285
0.854268
0.732912
0.508571
0.214382
0.0526997
0.00638635
0.177563
0.359648
0.511116
0.688238
0.863151
1.03156
1.15529
1.06464
0.532506
-0.278475
-1.49447
-2.3779
-2.43277
-2.44581
-2.61794
-2.97013
-3.45518
-4.19346
-5.24072
-6.80091
-9.13003
-12.7589
-18.5821
-28.7162
-48.2794
-73.7573
-134.365
-127.68
-90.494
-59.5311
-39.6104
-18.309
-7.11738
2.54478
7.8668
11.0321
12.518
14.0549
14.389
14.6218
13.7321
14.1367
0.018383
0.0879421
0.130267
0.184376
0.230735
0.279697
0.3263
0.37342
0.419949
0.466817
0.513939
0.561765
0.610495
0.660468
0.711932
0.765059
0.819698
0.875063
0.929305
0.979239
1.02061
1.04917
1.06168
1.05617
1.03157
0.989308
0.938958
0.90327
0.907351
0.915332
0.90034
0.844337
0.714078
0.478557
0.18218
0.0359941
-0.0292359
0.175269
0.360987
0.528241
0.723197
0.918407
1.11231
1.25063
1.10492
0.539871
-0.302148
-1.99575
-2.82293
-2.86
-2.71293
-2.83297
-3.11937
-3.53447
-4.19404
-5.14902
-6.60903
-8.82409
-12.3277
-18.064
-28.2972
-47.8595
-74.5077
-134.708
-124.962
-91.0196
-59.1864
-39.6114
-18.039
-6.50712
3.27611
8.6227
11.706
12.9446
14.3879
14.658
14.8412
14.036
14.4631
0.0181045
0.0899916
0.132427
0.187575
0.234474
0.284149
0.331345
0.379076
0.426184
0.47363
0.521329
0.569745
0.619097
0.669755
0.722011
0.776104
0.831957
0.888839
0.944853
0.996596
1.03941
1.06856
1.08044
1.07288
1.04495
0.999304
0.948224
0.916062
0.919085
0.91798
0.898921
0.835718
0.697335
0.451864
0.157731
0.026459
-0.0498658
0.181165
0.369364
0.553771
0.76717
0.984159
1.20389
1.33782
1.11957
0.590844
-0.480315
-2.54014
-3.23328
-3.28367
-2.93622
-3.00931
-3.21764
-3.55701
-4.13111
-4.98872
-6.3435
-8.43787
-11.807
-17.4437
-27.7314
-47.1946
-74.912
-133.572
-121.484
-90.8387
-58.5623
-39.4006
-17.68
-5.81247
4.07258
9.43378
12.4222
13.3941
14.7133
14.8987
15.0172
14.2735
14.5506
0.0177786
0.0920645
0.134561
0.190739
0.238152
0.288518
0.336282
0.384601
0.432261
0.480257
0.528502
0.577476
0.627414
0.678715
0.731721
0.786741
0.843785
0.902181
0.959991
1.01356
1.05775
1.08727
1.09813
1.08813
1.05703
1.00938
0.959609
0.931763
0.929076
0.923053
0.898559
0.828843
0.682907
0.429137
0.141089
0.0165421
-0.053388
0.194543
0.385391
0.587965
0.820449
1.06049
1.302
1.39976
1.12227
0.674317
-0.856299
-3.06887
-3.59675
-3.67658
-3.11442
-3.14708
-3.26846
-3.53054
-4.01599
-4.77503
-6.02406
-7.99774
-11.2334
-16.7693
-27.0695
-46.3427
-74.9442
-131.118
-117.47
-89.9686
-57.7036
-38.9835
-17.2372
-5.03621
4.93435
10.3012
13.1792
13.8703
15.035
15.1144
15.1595
14.5595
14.9262
0.0174023
0.0941615
0.136666
0.193863
0.241765
0.292799
0.341108
0.389988
0.438175
0.486692
0.535451
0.584947
0.635432
0.687333
0.741043
0.796943
0.855144
0.915043
0.974652
1.03002
1.07544
1.10499
1.11435
1.10163
1.06791
1.01974
0.972651
0.948068
0.939413
0.929527
0.899368
0.823879
0.671048
0.411452
0.133676
-0.000738673
-0.0392776
0.214358
0.409517
0.63088
0.883141
1.14671
1.39756
1.42701
1.14272
0.681607
-1.31081
-3.58308
-3.90724
-4.00967
-3.2529
-3.24992
-3.27913
-3.46471
-3.85999
-4.52129
-5.66736
-7.52642
-10.6395
-16.0818
-26.3494
-45.3451
-74.5976
-127.563
-113.061
-88.4688
-56.6544
-38.3758
-16.716
-4.18303
5.86097
11.2258
13.9748
14.3769
15.3561
15.2975
15.2179
14.9347
12.8817
0.0169725
0.0962829
0.138741
0.196946
0.245309
0.296989
0.345818
0.395233
0.443919
0.492927
0.542168
0.59215
0.64314
0.695595
0.749955
0.806684
0.865995
0.927366
0.988743
1.04582
1.0922
1.12131
1.12868
1.11317
1.07762
1.03035
0.986804
0.963196
0.95075
0.936749
0.901449
0.82088
0.662074
0.400405
0.138366
-0.0264498
-0.009974
0.240014
0.441982
0.68236
0.955064
1.24043
1.47722
1.43142
1.21869
0.507115
-1.75229
-4.09086
-4.18772
-4.26574
-3.36097
-3.32262
-3.25776
-3.36798
-3.6718
-4.23737
-5.28641
-7.04305
-10.0531
-15.4124
-25.5939
-44.2262
-73.8834
-123.185
-108.406
-86.4427
-55.4576
-37.6009
-16.1211
-3.2596
6.85116
12.208
14.8059
14.917
15.6868
15.4517
15.2258
14.9274
10.0185
0.0164861
0.098429
0.140783
0.199983
0.248781
0.301081
0.350406
0.400328
0.449485
0.498954
0.548643
0.599074
0.650526
0.703484
0.758436
0.81593
0.876291
0.939077
1.00214
1.06073
1.10769
1.13581
1.14076
1.12262
1.08617
1.04089
1.00124
0.977353
0.96254
0.944486
0.904764
0.819824
0.656236
0.39776
0.157847
-0.0502031
0.0302713
0.270871
0.482644
0.742026
1.03553
1.33607
1.52717
1.43035
1.31124
0.207797
-2.17262
-4.58194
-4.48956
-4.44257
-3.44837
-3.36912
-3.21072
-3.24583
-3.4569
-3.93049
-4.89213
-6.56479
-9.49764
-14.7794
-24.8102
-42.9971
-72.8266
-118.262
-103.678
-84.0101
-54.1516
-36.6855
-15.4564
-2.27444
7.90252
13.2477
15.6687
15.4912
16.0279
15.5318
15.2802
14.2207
7.95175
0.0159398
0.1006
0.14279
0.202972
0.252177
0.305072
0.354866
0.405269
0.454868
0.504766
0.554869
0.605708
0.657578
0.710983
0.766463
0.824648
0.885979
0.950084
1.01468
1.07448
1.1215
1.14805
1.15031
1.12987
1.09344
1.05104
1.01493
0.991043
0.974253
0.952595
0.909171
0.820589
0.653542
0.40401
0.187977
-0.0551427
0.0777146
0.307077
0.531017
0.809247
1.12298
1.4247
1.54612
1.45456
1.30844
-0.0970508
-2.58746
-5.02629
-4.85231
-4.55369
-3.52246
-3.39158
-3.14174
-3.10079
-3.21867
-3.60701
-4.49509
-6.10808
-8.99029
-14.1885
-23.9932
-41.6618
-71.4622
-113.03
-98.9986
-81.2885
-52.7677
-35.6561
-14.7271
-1.23733
9.01122
14.3436
16.5576
16.1088
16.3992
15.5404
15.1128
13.8795
10.1193
0.0153303
0.102794
0.14476
0.205908
0.255492
0.308957
0.359193
0.410048
0.46006
0.510354
0.560836
0.612044
0.664282
0.718077
0.774013
0.832802
0.894994
0.960271
1.02613
1.0867
1.13317
1.15761
1.15706
1.13495
1.09959
1.0606
1.02753
1.00416
0.985596
0.960921
0.914489
0.82295
0.653856
0.417725
0.212098
-0.0310957
0.129013
0.348796
0.586168
0.88306
1.21419
1.49549
1.55042
1.52662
1.15768
-0.364318
-2.99736
-5.38682
-5.27323
-4.6195
-3.58642
-3.39067
-3.05222
-2.93366
-2.96024
-3.27411
-4.10662
-5.68851
-8.5405
-13.633
-23.1314
-40.2218
-69.828
-107.684
-94.4491
-78.3863
-51.3312
-34.5379
-13.9394
-0.158377
10.1718
15.4943
17.4679
16.7842
16.7991
15.5577
14.7434
13.9716
12.9108
0.0146544
0.105013
0.146689
0.208788
0.258722
0.312729
0.363382
0.414659
0.465054
0.515711
0.566535
0.61807
0.670626
0.724749
0.78106
0.840348
0.903261
0.969489
1.03625
1.09701
1.14231
1.16428
1.16121
1.13814
1.10451
1.0693
1.03919
1.01646
0.996392
0.969286
0.920538
0.826739
0.657885
0.439371
0.216116
0.0199704
0.182044
0.395963
0.646875
0.961992
1.30347
1.54047
1.55768
1.60313
0.947334
-0.609384
-3.38988
-5.63167
-5.70268
-4.65406
-3.63959
-3.36599
-2.94238
-2.74498
-2.68625
-2.94044
-3.73903
-5.31914
-8.14812
-13.0979
-22.2133
-38.6794
-67.9587
-102.386
-90.0931
-75.3968
-49.862
-33.3525
-13.1005
0.952608
11.3772
16.6964
18.3881
17.5333
17.3243
15.7083
14.3202
14.884
17.1538
0.0139088
0.107253
0.148575
0.211606
0.261861
0.316382
0.367425
0.419095
0.469842
0.520829
0.571957
0.623775
0.676598
0.730981
0.787578
0.847242
0.910691
0.977566
1.04473
1.10506
1.14862
1.16787
1.16238
1.13949
1.10875
1.07724
1.04986
1.02778
1.00652
0.977528
0.927133
0.831923
0.667501
0.470603
0.208431
0.0870386
0.235872
0.447814
0.711666
1.04375
1.38322
1.56453
1.59235
1.59962
0.763691
-0.854476
-3.75443
-5.7497
-6.07446
-4.65979
-3.67946
-3.31677
-2.81212
-2.53642
-2.40366
-2.61575
-3.40526
-5.00801
-7.80399
-12.566
-21.2337
-37.0408
-65.8816
-97.2479
-85.9533
-72.3943
-48.3729
-32.1176
-12.217
2.08618
12.6185
17.9445
19.3094
18.3568
17.6403
16.735
15.2166
16.5447
23.5624
0.0130904
0.109515
0.150415
0.214358
0.264904
0.319912
0.371316
0.423349
0.474417
0.525699
0.577093
0.629149
0.682184
0.736757
0.793542
0.853435
0.917183
0.984314
1.05132
1.11056
1.15182
1.16824
1.16148
1.14013
1.1125
1.08445
1.05959
1.03812
1.01592
0.985486
0.933985
0.83836
0.683535
0.501324
0.215596
0.157918
0.290917
0.503007
0.778879
1.12463
1.44595
1.58312
1.66347
1.50215
0.621542
-1.10706
-4.09124
-5.76065
-6.35049
-4.63457
-3.70193
-3.24236
-2.66168
-2.31182
-2.12163
-2.31023
-3.11787
-4.75591
-7.49341
-12.0247
-20.198
-35.3166
-63.6157
-92.3362
-82.0006
-69.4353
-46.8693
-30.8457
-11.2951
3.23307
13.8855
19.2303
20.2023
19.0994
17.8924
18.5508
17.2912
19.2999
32.3091
0.0121965
0.111795
0.152206
0.21704
0.267847
0.323311
0.375048
0.427414
0.478771
0.530313
0.581934
0.634182
0.687372
0.742059
0.798923
0.858875
0.922636
0.989569
1.05582
1.11341
1.15225
1.16636
1.15992
1.14069
1.11598
1.09104
1.06837
1.04744
1.02447
0.992973
0.940738
0.846191
0.70499
0.513512
0.254724
0.225906
0.347492
0.559821
0.846539
1.19931
1.48854
1.60777
1.72767
1.38943
0.502437
-1.3622
-4.40819
-5.70139
-6.51791
-4.5785
-3.70278
-3.14234
-2.4922
-2.07789
-1.85012
-2.03419
-2.88695
-4.55588
-7.20149
-11.4704
-19.1232
-33.5213
-61.169
-87.6803
-78.1897
-66.5573
-45.3523
-29.5461
-10.3403
4.38502
15.1683
20.5401
21.0299
19.6187
18.2159
20.4878
19.8493
22.9688
37.1935
0.0112245
0.114092
0.153943
0.219644
0.270683
0.326573
0.378615
0.431282
0.482895
0.534661
0.586469
0.638864
0.69215
0.746872
0.803698
0.863518
0.926973
0.993267
1.05833
1.11428
1.15054
1.16365
1.15841
1.14118
1.11915
1.09698
1.0762
1.05571
1.03209
0.999786
0.947268
0.857332
0.730697
0.512035
0.315132
0.290715
0.404838
0.616469
0.912036
1.26187
1.5193
1.65673
1.72969
1.31098
0.391159
-1.61117
-4.71438
-5.61742
-6.57569
-4.49299
-3.67837
-3.01679
-2.30631
-1.84432
-1.59785
-1.79827
-2.71725
-4.3954
-6.91825
-10.9104
-18.0351
-31.6731
-58.5387
-83.2617
-74.4794
-63.7807
-43.821
-28.2254
-9.35772
5.53406
16.4518
21.8532
21.7884
19.9218
18.4929
22.0931
22.4759
26.8696
37.465
0.0101726
0.116402
0.155624
0.222167
0.273406
0.329692
0.38201
0.434946
0.486783
0.538736
0.590691
0.643183
0.696507
0.751184
0.807852
0.867343
0.930193
0.995524
1.05939
1.11372
1.14759
1.16101
1.15701
1.14171
1.12211
1.10228
1.08305
1.06286
1.03862
1.00563
0.953662
0.872736
0.748416
0.524785
0.378767
0.353784
0.461566
0.671203
0.971668
1.3078
1.5471
1.72215
1.68574
1.26533
0.286058
-1.84604
-5.01436
-5.55811
-6.53578
-4.38226
-3.62564
-2.86641
-2.10919
-1.62245
-1.37095
-1.61325
-2.60596
-4.26065
-6.64119
-10.3604
-16.9646
-29.793
-55.7175
-79.0049
-70.8245
-61.1132
-42.2753
-26.8881
-8.35137
6.6748
17.7286
23.152
22.4505
19.9902
18.5752
23.2862
25.0569
30.6691
36.6613
0.0090395
0.118721
0.157244
0.2246
0.276011
0.33266
0.385226
0.438398
0.490426
0.54253
0.59459
0.647132
0.700434
0.754988
0.811384
0.870377
0.93243
0.996762
1.05985
1.11165
1.14451
1.15862
1.15581
1.14235
1.12484
1.10692
1.08888
1.06879
1.04389
1.01032
0.961311
0.891491
0.752075
0.562257
0.439694
0.41577
0.516075
0.722143
1.02101
1.33853
1.58151
1.76533
1.64933
1.23523
0.192755
-2.05969
-5.30371
-5.56932
-6.41216
-4.25143
-3.54247
-2.69299
-1.90967
-1.42195
-1.17403
-1.48811
-2.54256
-4.14084
-6.37474
-9.83945
-15.942
-27.9052
-52.704
-74.8121
-67.2068
-58.5507
-40.7127
-25.533
-7.31702
7.8106
18.9787
24.3479
23.0185
19.7634
18.6775
24.3505
27.6931
33.759
37.1361
0.00782469
0.121044
0.1588
0.226939
0.278491
0.335471
0.388255
0.441631
0.493816
0.546034
0.598158
0.650704
0.703928
0.758289
0.814321
0.872712
0.933921
0.997491
1.05971
1.10894
1.1418
1.15647
1.15489
1.14312
1.12734
1.11091
1.09365
1.07339
1.04767
1.01416
0.971884
0.905031
0.759377
0.60985
0.498382
0.475971
0.567084
0.766849
1.05644
1.36209
1.6289
1.76551
1.64007
1.21073
0.116499
-2.24442
-5.56773
-5.69296
-6.221
-4.10468
-3.42742
-2.50023
-1.72035
-1.2469
-1.0133
-1.42613
-2.51181
-4.03068
-6.12728
-9.36508
-14.9927
-26.0377
-49.5148
-70.6307
-63.6584
-56.0689
-39.1215
-24.1441
-6.24032
8.93435
20.1458
25.3974
23.5009
19.6585
19.1134
25.9323
30.2845
35.4103
39.8092
0.00652892
0.123365
0.160288
0.229176
0.280839
0.338118
0.39109
0.444638
0.496947
0.549241
0.60139
0.653893
0.706991
0.761106
0.816726
0.874509
0.934997
0.998202
1.0586
1.10648
1.13944
1.15466
1.15432
1.14403
1.12965
1.11426
1.09734
1.07658
1.05008
1.01894
0.985358
0.908812
0.78408
0.657972
0.556308
0.533101
0.613399
0.802349
1.07728
1.38482
1.67232
1.75333
1.64888
1.19229
0.0594286
-2.38898
-5.75751
-5.90635
-5.97882
-3.94533
-3.27985
-2.29524
-1.55499
-1.09448
-0.898718
-1.42115
-2.49855
-3.93009
-5.90744
-8.94876
-14.1345
-24.2244
-46.1867
-66.4943
-60.1814
-53.6341
-37.484
-22.6966
-5.11845
10.007
21.1967
26.341
24.1013
20.377
20.5772
28.2722
32.6452
35.6347
39.7758
0.00515432
0.125677
0.161703
0.231304
0.28305
0.340594
0.393726
0.447412
0.499811
0.552145
0.60428
0.656702
0.709635
0.763475
0.818691
0.87595
0.935935
0.998879
1.05707
1.10448
1.13743
1.15326
1.15411
1.14509
1.13178
1.11699
1.09996
1.07842
1.05192
1.02673
0.995106
0.916215
0.818467
0.705571
0.613288
0.58641
0.65362
0.826231
1.089
1.41638
1.68781
1.75744
1.66368
1.18359
0.0211251
-2.48387
-5.81979
-6.15465
-5.6881
-3.77317
-3.10018
-2.09039
-1.42204
-0.95991
-0.840993
-1.45732
-2.49208
-3.8421
-5.72143
-8.59454
-13.3763
-22.5045
-42.7645
-62.495
-56.7166
-51.2788
-35.7946
-21.1914
-3.99051
10.9796
22.1003
27.0844
25.4303
22.2161
23.1045
30.902
34.5582
35.8212
38.7182
0.00370485
0.127969
0.163042
0.233315
0.285118
0.342892
0.396154
0.449947
0.502403
0.554743
0.606828
0.659135
0.711881
0.765453
0.820329
0.877219
0.936989
0.999159
1.05578
1.1029
1.13582
1.15232
1.15424
1.14631
1.13374
1.11913
1.1016
1.07944
1.05544
1.03761
0.999003
0.936603
0.855089
0.753826
0.668257
0.635293
0.686157
0.838049
1.09705
1.45277
1.68468
1.7789
1.68144
1.18675
-0.000503995
-2.5264
-5.71511
-6.36204
-5.3491
-3.58588
-2.89097
-1.9035
-1.31763
-0.84526
-0.843912
-1.51395
-2.48781
-3.77042
-5.57187
-8.30021
-12.719
-20.917
-39.2933
-58.6747
-53.3836
-49.1409
-34.1007
-19.6897
-2.92745
11.8203
22.8064
27.9611
27.55
24.8058
26.0221
33.2938
35.8143
36.572
38.2749
0.00218674
0.130233
0.1643
0.235203
0.287035
0.345006
0.39837
0.452238
0.50472
0.557033
0.609039
0.661209
0.713764
0.767106
0.821741
0.878435
0.938252
0.99912
1.05492
1.1017
1.13465
1.15181
1.15471
1.14767
1.13556
1.12079
1.10257
1.08078
1.06256
1.04629
1.00778
0.964129
0.892647
0.80248
0.720583
0.679038
0.710032
0.841714
1.10918
1.47631
1.68849
1.80797
1.70454
1.20205
-0.00818738
-2.52472
-5.43689
-6.45629
-4.95892
-3.37891
-2.65963
-1.75268
-1.22607
-0.763233
-0.897884
-1.57303
-2.48599
-3.71772
-5.4581
-8.06044
-12.1587
-19.4945
-35.8328
-54.8483
-50.6512
-47.1446
-32.5219
-18.3032
-1.988
12.5459
23.4454
29.2615
30.0912
27.6592
28.8107
35.1759
36.5257
37.0799
37.8681
0.000609107
0.132453
0.165472
0.236959
0.288796
0.346931
0.400368
0.45428
0.50676
0.559019
0.610922
0.662945
0.715326
0.768497
0.822998
0.879635
0.939478
0.999109
1.05444
1.10087
1.13393
1.15172
1.1555
1.14917
1.13727
1.12209
1.1034
1.0842
1.07286
1.05137
1.02693
0.994017
0.931721
0.850565
0.769756
0.716933
0.726027
0.844283
1.13202
1.48182
1.70755
1.83957
1.73521
1.22927
-0.00481358
-2.49545
-5.01925
-6.38971
-4.51743
-3.14776
-2.42168
-1.64453
-1.13272
-0.729409
-0.981281
-1.6248
-2.48903
-3.685
-5.37718
-7.8696
-11.6899
-18.2598
-32.493
-50.6064
-48.6892
-44.9291
-31.1951
-17.103
-1.19594
13.2201
24.2456
31.0093
32.9014
30.5051
31.2631
36.5534
36.8814
36.1963
37.3848
-0.00101542
0.134615
0.166555
0.238576
0.290396
0.34866
0.402146
0.456074
0.508526
0.560709
0.612496
0.664375
0.716617
0.769694
0.824171
0.880894
0.940483
0.999336
1.05427
1.10042
1.13365
1.15204
1.15659
1.15081
1.13892
1.12323
1.10485
1.09073
1.0822
1.06062
1.05156
1.02524
0.971899
0.897285
0.815093
0.748695
0.737091
0.851114
1.16156
1.48558
1.73645
1.87428
1.77424
1.26851
0.00743505
-2.45976
-4.52546
-6.14549
-4.02859
-2.89043
-2.20085
-1.56446
-1.03954
-0.748542
-1.06978
-1.66798
-2.49925
-3.67129
-5.3248
-7.72276
-11.3072
-17.2233
-29.4399
-45.7782
-46.482
-42.4804
-30.1462
-16.0594
-0.461885
13.9843
25.4234
33.2731
36.0226
33.2499
33.2972
37.445
37.1714
35.456
37.0263
-0.00266992
0.1367
0.167544
0.240046
0.291829
0.350191
0.403701
0.457621
0.510024
0.562115
0.613783
0.665534
0.717679
0.770729
0.825264
0.882183
0.941318
0.999788
1.05437
1.10032
1.13376
1.15272
1.15795
1.15256
1.14052
1.12442
1.10773
1.10001
1.08852
1.07807
1.07821
1.05785
1.01214
0.941808
0.855872
0.775135
0.748037
0.865988
1.18763
1.49995
1.76967
1.91373
1.82154
1.32026
0.0279321
-2.43657
-4.03449
-5.72996
-3.49987
-2.61291
-2.01843
-1.48469
-0.965414
-0.807889
-1.1469
-1.70587
-2.51763
-3.67394
-5.29604
-7.61525
-11.0048
-16.3797
-26.8197
-40.8387
-43.1269
-39.6835
-28.7863
-14.9597
0.456168
15.1025
27.2571
36.2644
39.5108
35.848
34.9188
37.9647
37.3768
35.0255
36.6858
-0.0043324
0.138686
0.168436
0.241363
0.293093
0.351523
0.405036
0.458927
0.511266
0.563259
0.614814
0.666464
0.718564
0.77165
0.826306
0.883417
0.942164
1.00042
1.0547
1.10056
1.13423
1.15374
1.15955
1.1544
1.1421
1.12591
1.11242
1.1094
1.09615
1.10045
1.10579
1.09133
1.05138
0.983078
0.891605
0.798151
0.763397
0.890779
1.20833
1.52475
1.80581
1.9586
1.87681
1.38505
0.058094
-2.43753
-3.62355
-5.16683
-2.94131
-2.3337
-1.8752
-1.38893
-0.929022
-0.883584
-1.20802
-1.74204
-2.5435
-3.68905
-5.28593
-7.54206
-10.7751
-15.7141
-24.6873
-36.4145
-39.1598
-36.3223
-26.5793
-13.3415
1.94555
16.9666
30.042
40.0868
43.2701
38.2196
36.1602
38.2329
37.4947
34.6917
36.3441
-0.00597499
0.140547
0.169226
0.242521
0.294184
0.352654
0.406154
0.46
0.512267
0.564164
0.615622
0.6672
0.719293
0.772454
0.827275
0.884474
0.943049
1.00116
1.05524
1.10108
1.13503
1.15505
1.16134
1.15628
1.14363
1.12785
1.11852
1.11594
1.10931
1.12471
1.13403
1.12454
1.08836
1.01996
0.922275
0.819799
0.784697
0.923554
1.22969
1.55529
1.84505
2.00869
1.93979
1.46316
0.10122
-2.46365
-3.35687
-4.4841
-2.36773
-2.07939
-1.74718
-1.28736
-0.932719
-0.95404
-1.25653
-1.77825
-2.57471
-3.71233
-5.2898
-7.49771
-10.6091
-15.2067
-23.0208
-32.7947
-35.426
-32.8211
-23.8924
-11.1485
4.12366
19.6304
33.6495
44.4355
47.0017
40.2645
37.0552
38.341
37.5957
34.4242
36.0114
-0.00756331
0.142256
0.169913
0.243515
0.295105
0.353592
0.407065
0.460858
0.513053
0.564862
0.616244
0.667786
0.719913
0.773187
0.828221
0.885439
0.944002
1.00201
1.05598
1.10188
1.13613
1.15662
1.16329
1.1582
1.14516
1.13043
1.1252
1.12078
1.12716
1.14942
1.16229
1.15617
1.12167
1.05146
0.948302
0.84139
0.810809
0.959557
1.25528
1.58869
1.88749
2.06342
2.0099
1.55433
0.162683
-2.49165
-3.24484
-3.70906
-1.80205
-1.86418
-1.61064
-1.20326
-0.961954
-1.00916
-1.29729
-1.81431
-2.60831
-3.73994
-5.30359
-7.47657
-10.4967
-14.8348
-21.7635
-29.9998
-32.3448
-29.7455
-21.3243
-8.84765
6.55769
22.6089
37.5006
48.747
50.3667
41.9351
37.6558
38.3725
37.6969
34.2488
35.7959
-0.00905672
0.143782
0.170493
0.244341
0.295854
0.354337
0.407776
0.461511
0.513641
0.56538
0.616712
0.668244
0.720424
0.773817
0.829048
0.886308
0.94493
1.0029
1.05685
1.10288
1.13745
1.15839
1.16533
1.16
1.14655
1.13329
1.13047
1.12775
1.14715
1.17388
1.18938
1.18468
1.1499
1.07703
0.970225
0.863081
0.83925
0.994509
1.28412
1.62337
1.93229
2.1218
2.08617
1.65772
0.248223
-2.46878
-3.2344
-2.86378
-1.27677
-1.67601
-1.46825
-1.15034
-0.997406
-1.04973
-1.33312
-1.84891
-2.64143
-3.7689
-5.32379
-7.47306
-10.4276
-14.5746
-20.8467
-27.9326
-29.993
-27.3241
-19.1896
-6.7956
8.80986
25.3937
41.0436
52.56
53.1611
43.2616
38.0239
38.3922
37.7869
34.1903
35.6774
-0.0104074
0.145095
0.170971
0.245007
0.296447
0.354915
0.408317
0.462
0.514074
0.565757
0.617057
0.668603
0.720858
0.774396
0.829799
0.887177
0.945886
1.00387
1.05788
1.10407
1.13898
1.16032
1.16744
1.16173
1.14791
1.13608
1.1333
1.13841
1.16735
1.19726
1.21371
1.20845
1.17193
1.09647
0.988213
0.883662
0.866817
1.02587
1.31389
1.65872
1.97849
2.18234
2.16644
1.77055
0.357119
-2.35146
-3.22676
-1.96832
-0.816654
-1.49739
-1.34175
-1.12498
-1.02629
-1.08022
-1.36441
-1.88019
-2.67172
-3.79691
-5.34722
-7.48168
-10.3912
-14.4026
-20.2018
-26.4593
-28.2911
-25.5434
-17.553
-5.127
10.6842
27.7288
43.9941
55.6669
55.3601
44.3332
38.2332
38.4277
37.855
34.2146
35.6147
-0.0115667
0.146161
0.171338
0.245503
0.296873
0.355312
0.408678
0.462316
0.514353
0.566011
0.617312
0.66889
0.721218
0.774884
0.83041
0.887931
0.946745
1.00481
1.05894
1.10537
1.14064
1.16232
1.16942
1.16305
1.14887
1.13801
1.13537
1.15123
1.18653
1.21823
1.23369
1.22618
1.18719
1.11007
1.00275
0.903046
0.892997
1.05407
1.34235
1.69277
2.02385
2.24275
2.24803
1.88776
0.473328
-2.14591
-3.10554
-1.07123
-0.425549
-1.33411
-1.24696
-1.11539
-1.0461
-1.10425
-1.39088
-1.90694
-2.69801
-3.82253
-5.37121
-7.49741
-10.3778
-14.2971
-19.769
-25.4547
-27.123
-24.3072
-16.3756
-3.8673
12.1248
29.5325
46.2696
58.0406
57.0246
45.2321
38.3699
38.4607
37.9057
34.2956
35.5184
-0.0124788
0.146966
0.171615
0.245862
0.297181
0.355594
0.408933
0.462536
0.514545
0.566181
0.617479
0.669086
0.721495
0.775308
0.830987
0.888671
0.947613
1.0058
1.06009
1.10675
1.14233
1.16429
1.17128
1.16426
1.14976
1.13893
1.13908
1.16395
1.20335
1.23522
1.24828
1.23779
1.19638
1.11839
1.01288
0.917916
0.91359
1.07725
1.36836
1.72499
2.06673
2.29964
2.32519
2.00066
0.577349
-1.90237
-2.81677
-0.215021
-0.103944
-1.20691
-1.18456
-1.11136
-1.05869
-1.12241
-1.41124
-1.92751
-2.71855
-3.84331
-5.392
-7.5143
-10.3775
-14.2385
-19.4965
-24.8079
-26.3673
-23.4948
-15.5748
-2.9774
13.1605
30.8322
47.9114
59.7552
58.267
46.0314
38.4828
38.4807
37.9449
34.4582
35.5074
-0.013107
0.147481
0.171782
0.246061
0.297335
0.355716
0.409028
0.462608
0.514615
0.566269
0.617609
0.669268
0.721733
0.775614
0.831392
0.889201
0.948273
1.00661
1.06109
1.10803
1.14393
1.16602
1.17255
1.16448
1.14943
1.13893
1.14431
1.17505
1.21615
1.24624
1.25604
1.24259
1.19939
1.12152
1.01912
0.930399
0.931995
1.09641
1.38887
1.75085
2.10218
2.34783
2.3926
2.09857
0.63814
-1.73039
-2.41571
0.524453
0.135884
-1.12753
-1.14694
-1.10877
-1.06689
-1.13506
-1.42542
-1.94197
-2.73339
-3.85893
-5.40862
-7.53013
-10.385
-14.2134
-19.3453
-24.4339
-25.928
-23.0147
-15.0872
-2.41976
13.8211
31.6588
48.9679
60.876
59.1233
46.6214
38.6337
38.4969
37.9564
34.8552
35.8977
-0.0134086
0.147734
0.171883
0.246175
0.297433
0.355798
0.409097
0.462659
0.51465
0.566289
0.617627
0.66932
0.721863
0.775848
0.831739
0.889668
0.948867
1.00734
1.06198
1.10907
1.14507
1.16708
1.17324
1.1648
1.14978
1.1399
1.1481
1.18122
1.22334
1.25257
1.26032
1.24472
1.20017
1.12221
1.02091
0.934229
0.938828
1.10641
1.4031
1.76953
2.12732
2.38106
2.43725
2.15982
0.691032
-1.61926
-2.06523
0.946961
0.294996
-1.08569
-1.12986
-1.10711
-1.07084
-1.14129
-1.43235
-1.94897
-2.74052
-3.86635
-5.41643
-7.53756
-10.3888
-14.2037
-19.2821
-24.2754
-25.7436
-22.8015
-14.8546
-2.1446
14.1528
32.0725
49.5158
61.4419
59.649
47.0054
38.8167
38.5372
38.0246
35.4172
39.5792
)
;
boundaryField
{
inletFace
{
type zeroGradient;
}
inlet
{
type zeroGradient;
}
inletWalls
{
type zeroGradient;
}
outletInlet
{
type cyclicAMI;
value nonuniform List<scalar>
15
(
18.9329
21.3548
23.1658
25.6003
28.2731
32.3997
35.7955
37.8994
41.2665
40.948
37.9718
38.2579
31.3555
29.4195
28.9254
)
;
}
fineSymmetryWall
{
type symmetryPlane;
}
fineWalls
{
type zeroGradient;
}
fineCyclicBoundary
{
type fixedValue;
value uniform 0;
}
fineplug
{
type cyclicAMI;
value nonuniform List<scalar>
80
(
19.0311
18.808
20.9366
18.3548
17.3989
20.3876
20.7303
21.3248
21.4318
21.6433
22.6809
24.9415
24.942
20.8287
21.397
23.1206
24.8498
24.6735
25.1783
25.4035
26.6045
28.263
26.7315
27.8779
27.855
28.9109
30.8413
31.6553
31.9367
32.5877
32.1595
33.737
35.1939
35.659
35.5644
35.4635
36.3478
38.2843
38.8523
36.3219
34.4723
40.4481
41.9189
42.6585
41.731
40.772
40.0614
40.6967
39.4526
39.6651
44.2357
41.4184
40.8413
41.6568
40.6414
39.2947
37.572
32.8366
37.7165
43.4009
39.9116
38.2766
35.8868
32.7735
33.3392
32.2381
30.4055
27.8134
32.9502
31.3452
29.9695
29.9249
29.5345
28.7196
26.4039
26.7003
27.9932
32.0057
29.2861
27.962
)
;
}
faceFine
{
type zeroGradient;
}
}
// ************************************************************************* //
| [
"brent.shambaugh@gmail.com"
] | brent.shambaugh@gmail.com | |
58636b0c7fc550138ee6abefd0dbaf791c6fd800 | 9d75aa8f2d4107c5c2132a53473ff92de856a08c | /random_gen.h | 7aeaf5ea5adf50eb5fe3cdf3c29e00ae7e1ed379 | [] | no_license | luchiancode/Emag-s-Hero | 73cde4199458133bb628620d43018da676550481 | 758a98d071b3c3f6125954244e29fae1307c0339 | refs/heads/master | 2023-03-01T14:37:37.677499 | 2021-02-06T16:23:05 | 2021-02-06T16:23:05 | 265,736,425 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 502 | h | #ifndef _RANDOM_GEN_H
#define _RANDOM_GEN_H
class random_generator
{
private:
std::unique_ptr<int> _low = std::make_unique<int>();
std::unique_ptr<int> _high = std::make_unique<int>();
public:
random_generator() {}
static std::shared_ptr<random_generator> getInstance() {
static std::shared_ptr<random_generator> theInstance = std::make_shared<random_generator>();
return theInstance;
}
void set_limits(const int&& low, const int&& high);
int get_random_number() const;
};
#endif
| [
"41749193+luchiancode@users.noreply.github.com"
] | 41749193+luchiancode@users.noreply.github.com |
308dd4d57f0c70f6ffddb1dee259911f86521df3 | 064a83528c28065e52882c64c757be2413ccd903 | /TowerDefense/Source/FrostTower.cpp | ea1f6570116c3bc8f90ea65132ea7fdaf4d5e437 | [] | no_license | jimmychenn/Games | ce6cd617759dffb0f1d978b9581919f128c0563c | a14d5d6d2a3cb239a662d653ace7e19b01aabf6b | refs/heads/master | 2021-01-10T09:11:57.669109 | 2015-12-13T09:30:44 | 2015-12-13T09:30:44 | 43,994,422 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,126 | cpp | // FrostTower.cpp
//
// Created by Jimmy Chen on 10/4/15.
// Copyright © 2015 Sanjay Madhav. All rights reserved.
//
#include "FrostTower.h"
#include "Game.h"
#include "Mesh.h"
#include "MeshComponent.h"
#include "Enemy.h"
IMPL_ACTOR(FrostTower, Tower);
FrostTower::FrostTower(Game& game) : Tower(game)
{
auto towermesh = mGame.GetAssetCache().Load<Mesh>("Meshes/Frost.itpmesh2");
auto mMeshComponent = MeshComponent::Create(*this);
mMeshComponent->SetMesh(towermesh);
mAudioComponentPtr = AudioComponent::Create(*this);
mFrostSound = mGame.GetAssetCache().Load<Sound>("Sounds/Freeze.wav");
TimerHandle handle;
mGame.GetGameTimers().SetTimer(handle, this, &FrostTower::Attack, 2.0f,true);
}
FrostTower::~FrostTower()
{
}
void FrostTower::Attack()
{
Vector3 pos = GetWorldTransform().GetTranslation();
std::vector<Enemy*> enemies = mGame.GetWorld().GetEnemiesInRange(pos, 150.0f);
if(!enemies.empty())
{
for( auto& enemy : enemies)
{
enemy->Slow();
mAudioComponentPtr->PlaySound(mFrostSound);
}
}
} | [
"jimmylch@usc.edu"
] | jimmylch@usc.edu |
016b38b61370f86b3a1f97f0542f455dbbb063f7 | 33392bbfbc4abd42b0c67843c7c6ba9e0692f845 | /ultrasound/L3/tests/synthetic_aperture/PL_kernels/mm2s7.cpp | b0a4a405aadcba47d7819988b750a5736ce9e8cd | [
"Apache-2.0"
] | permissive | Xilinx/Vitis_Libraries | bad9474bf099ed288418430f695572418c87bc29 | 2e6c66f83ee6ad21a7c4f20d6456754c8e522995 | refs/heads/main | 2023-07-20T09:01:16.129113 | 2023-06-08T08:18:19 | 2023-06-08T08:18:19 | 210,433,135 | 785 | 371 | Apache-2.0 | 2023-07-06T21:35:46 | 2019-09-23T19:13:46 | C++ | UTF-8 | C++ | false | false | 799 | cpp | /*
* Copyright 2022 Xilinx, 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 <hls_stream.h>
extern "C" {
void mm2s7(float* mem, hls::stream<float>& s, int size) {
for (unsigned i = 0; i < size; ++i) {
#pragma HLS PIPELINE II = 1
s.write(mem[i]);
}
}
}
| [
"do-not-reply@gitenterprise.xilinx.com"
] | do-not-reply@gitenterprise.xilinx.com |
d2f2e9c9eaa04c5eca61568813676b02d14ae070 | 89dedd7f3c7acc81d12e2bcb2e716f9af9e5fa04 | /cc/tiles/picture_layer_tiling_unittest.cc | 19e5f27896b53bbd9addd2d95a2d2ab4d251f761 | [
"BSD-3-Clause"
] | permissive | bino7/chromium | 8d26f84a1b6e38a73d1b97fea6057c634eff68cb | 4666a6bb6fdcb1114afecf77bdaa239d9787b752 | refs/heads/master | 2022-12-22T14:31:53.913081 | 2016-09-06T10:05:11 | 2016-09-06T10:05:11 | 67,410,510 | 1 | 3 | BSD-3-Clause | 2022-12-17T03:08:52 | 2016-09-05T10:11:59 | null | UTF-8 | C++ | false | false | 40,977 | cc | // Copyright 2012 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 "cc/tiles/picture_layer_tiling.h"
#include <stddef.h>
#include <limits>
#include <set>
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "cc/base/math_util.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/fake_output_surface_client.h"
#include "cc/test/fake_picture_layer_tiling_client.h"
#include "cc/test/fake_raster_source.h"
#include "cc/test/test_context_provider.h"
#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/tiles/picture_layer_tiling_set.h"
#include "cc/trees/layer_tree_settings.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/quad_f.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/geometry/size_conversions.h"
namespace cc {
namespace {
static gfx::Rect ViewportInLayerSpace(
const gfx::Transform& transform,
const gfx::Size& device_viewport) {
gfx::Transform inverse;
if (!transform.GetInverse(&inverse))
return gfx::Rect();
return MathUtil::ProjectEnclosingClippedRect(inverse,
gfx::Rect(device_viewport));
}
class TestablePictureLayerTiling : public PictureLayerTiling {
public:
using PictureLayerTiling::SetLiveTilesRect;
using PictureLayerTiling::TileAt;
static std::unique_ptr<TestablePictureLayerTiling> Create(
WhichTree tree,
float contents_scale,
scoped_refptr<RasterSource> raster_source,
PictureLayerTilingClient* client,
const LayerTreeSettings& settings) {
return base::WrapUnique(new TestablePictureLayerTiling(
tree, contents_scale, raster_source, client,
settings.tiling_interest_area_padding,
settings.skewport_target_time_in_seconds,
settings.skewport_extrapolation_limit_in_screen_pixels));
}
gfx::Rect live_tiles_rect() const { return live_tiles_rect_; }
using PictureLayerTiling::RemoveTileAt;
using PictureLayerTiling::RemoveTilesInRegion;
protected:
TestablePictureLayerTiling(WhichTree tree,
float contents_scale,
scoped_refptr<RasterSource> raster_source,
PictureLayerTilingClient* client,
size_t tiling_interest_area_padding,
float skewport_target_time,
int skewport_extrapolation_limit)
: PictureLayerTiling(tree, contents_scale, raster_source, client) {}
};
class PictureLayerTilingIteratorTest : public testing::Test {
public:
PictureLayerTilingIteratorTest() {}
~PictureLayerTilingIteratorTest() override {}
void Initialize(const gfx::Size& tile_size,
float contents_scale,
const gfx::Size& layer_bounds) {
client_.SetTileSize(tile_size);
scoped_refptr<FakeRasterSource> raster_source =
FakeRasterSource::CreateFilled(layer_bounds);
tiling_ = TestablePictureLayerTiling::Create(PENDING_TREE, contents_scale,
raster_source, &client_,
LayerTreeSettings());
tiling_->set_resolution(HIGH_RESOLUTION);
}
void InitializeActive(const gfx::Size& tile_size,
float contents_scale,
const gfx::Size& layer_bounds) {
client_.SetTileSize(tile_size);
scoped_refptr<FakeRasterSource> raster_source =
FakeRasterSource::CreateFilled(layer_bounds);
tiling_ = TestablePictureLayerTiling::Create(ACTIVE_TREE, contents_scale,
raster_source, &client_,
LayerTreeSettings());
tiling_->set_resolution(HIGH_RESOLUTION);
}
void SetLiveRectAndVerifyTiles(const gfx::Rect& live_tiles_rect) {
tiling_->SetLiveTilesRect(live_tiles_rect);
std::vector<Tile*> tiles = tiling_->AllTilesForTesting();
for (std::vector<Tile*>::iterator iter = tiles.begin();
iter != tiles.end();
++iter) {
EXPECT_TRUE(live_tiles_rect.Intersects((*iter)->content_rect()));
}
}
void VerifyTilesExactlyCoverRect(
float rect_scale,
const gfx::Rect& request_rect,
const gfx::Rect& expect_rect) {
EXPECT_TRUE(request_rect.Contains(expect_rect));
// Iterators are not valid if this ratio is too large (i.e. the
// tiling is too high-res for a low-res destination rect.) This is an
// artifact of snapping geometry to integer coordinates and then mapping
// back to floating point texture coordinates.
float dest_to_contents_scale = tiling_->contents_scale() / rect_scale;
ASSERT_LE(dest_to_contents_scale, 2.0);
Region remaining = expect_rect;
for (PictureLayerTiling::CoverageIterator
iter(tiling_.get(), rect_scale, request_rect);
iter;
++iter) {
// Geometry cannot overlap previous geometry at all
gfx::Rect geometry = iter.geometry_rect();
EXPECT_TRUE(expect_rect.Contains(geometry));
EXPECT_TRUE(remaining.Contains(geometry));
remaining.Subtract(geometry);
// Sanity check that texture coords are within the texture rect.
gfx::RectF texture_rect = iter.texture_rect();
EXPECT_GE(texture_rect.x(), 0);
EXPECT_GE(texture_rect.y(), 0);
EXPECT_LE(texture_rect.right(), client_.TileSize().width());
EXPECT_LE(texture_rect.bottom(), client_.TileSize().height());
}
// The entire rect must be filled by geometry from the tiling.
EXPECT_TRUE(remaining.IsEmpty());
}
void VerifyTilesExactlyCoverRect(float rect_scale, const gfx::Rect& rect) {
VerifyTilesExactlyCoverRect(rect_scale, rect, rect);
}
void VerifyTiles(
float rect_scale,
const gfx::Rect& rect,
base::Callback<void(Tile* tile,
const gfx::Rect& geometry_rect)> callback) {
VerifyTiles(tiling_.get(),
rect_scale,
rect,
callback);
}
void VerifyTiles(
PictureLayerTiling* tiling,
float rect_scale,
const gfx::Rect& rect,
base::Callback<void(Tile* tile,
const gfx::Rect& geometry_rect)> callback) {
Region remaining = rect;
for (PictureLayerTiling::CoverageIterator iter(tiling, rect_scale, rect);
iter;
++iter) {
remaining.Subtract(iter.geometry_rect());
callback.Run(*iter, iter.geometry_rect());
}
EXPECT_TRUE(remaining.IsEmpty());
}
void VerifyTilesCoverNonContainedRect(float rect_scale,
const gfx::Rect& dest_rect) {
float dest_to_contents_scale = tiling_->contents_scale() / rect_scale;
gfx::Rect clamped_rect = gfx::ScaleToEnclosingRect(
gfx::Rect(tiling_->tiling_size()), 1.f / dest_to_contents_scale);
clamped_rect.Intersect(dest_rect);
VerifyTilesExactlyCoverRect(rect_scale, dest_rect, clamped_rect);
}
protected:
FakePictureLayerTilingClient client_;
std::unique_ptr<TestablePictureLayerTiling> tiling_;
private:
DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingIteratorTest);
};
TEST_F(PictureLayerTilingIteratorTest, ResizeDeletesTiles) {
// Verifies that a resize with invalidation for newly exposed pixels will
// deletes tiles that intersect that invalidation.
gfx::Size tile_size(100, 100);
gfx::Size original_layer_size(10, 10);
InitializeActive(tile_size, 1.f, original_layer_size);
SetLiveRectAndVerifyTiles(gfx::Rect(original_layer_size));
// Tiling only has one tile, since its total size is less than one.
EXPECT_TRUE(tiling_->TileAt(0, 0));
// Stop creating tiles so that any invalidations are left as holes.
gfx::Size new_layer_size(200, 200);
scoped_refptr<FakeRasterSource> raster_source =
FakeRasterSource::CreatePartiallyFilled(new_layer_size, gfx::Rect());
Region invalidation =
SubtractRegions(gfx::Rect(tile_size), gfx::Rect(original_layer_size));
tiling_->SetRasterSourceAndResize(raster_source);
EXPECT_TRUE(tiling_->TileAt(0, 0));
tiling_->Invalidate(invalidation);
EXPECT_FALSE(tiling_->TileAt(0, 0));
}
TEST_F(PictureLayerTilingIteratorTest, CreateMissingTilesStaysInsideLiveRect) {
// The tiling has three rows and columns.
Initialize(gfx::Size(100, 100), 1.f, gfx::Size(250, 250));
EXPECT_EQ(3, tiling_->TilingDataForTesting().num_tiles_x());
EXPECT_EQ(3, tiling_->TilingDataForTesting().num_tiles_y());
// The live tiles rect is at the very edge of the right-most and
// bottom-most tiles. Their border pixels would still be inside the live
// tiles rect, but the tiles should not exist just for that.
int right = tiling_->TilingDataForTesting().TileBounds(2, 2).x();
int bottom = tiling_->TilingDataForTesting().TileBounds(2, 2).y();
SetLiveRectAndVerifyTiles(gfx::Rect(right, bottom));
EXPECT_FALSE(tiling_->TileAt(2, 0));
EXPECT_FALSE(tiling_->TileAt(2, 1));
EXPECT_FALSE(tiling_->TileAt(2, 2));
EXPECT_FALSE(tiling_->TileAt(1, 2));
EXPECT_FALSE(tiling_->TileAt(0, 2));
// Verify CreateMissingTilesInLiveTilesRect respects this.
tiling_->CreateMissingTilesInLiveTilesRect();
EXPECT_FALSE(tiling_->TileAt(2, 0));
EXPECT_FALSE(tiling_->TileAt(2, 1));
EXPECT_FALSE(tiling_->TileAt(2, 2));
EXPECT_FALSE(tiling_->TileAt(1, 2));
EXPECT_FALSE(tiling_->TileAt(0, 2));
}
TEST_F(PictureLayerTilingIteratorTest, ResizeTilingOverTileBorders) {
// The tiling has four rows and three columns.
Initialize(gfx::Size(100, 100), 1.f, gfx::Size(250, 350));
EXPECT_EQ(3, tiling_->TilingDataForTesting().num_tiles_x());
EXPECT_EQ(4, tiling_->TilingDataForTesting().num_tiles_y());
// The live tiles rect covers the whole tiling.
SetLiveRectAndVerifyTiles(gfx::Rect(250, 350));
// Tiles in the bottom row and right column exist.
EXPECT_TRUE(tiling_->TileAt(2, 0));
EXPECT_TRUE(tiling_->TileAt(2, 1));
EXPECT_TRUE(tiling_->TileAt(2, 2));
EXPECT_TRUE(tiling_->TileAt(2, 3));
EXPECT_TRUE(tiling_->TileAt(1, 3));
EXPECT_TRUE(tiling_->TileAt(0, 3));
int right = tiling_->TilingDataForTesting().TileBounds(2, 2).x();
int bottom = tiling_->TilingDataForTesting().TileBounds(2, 3).y();
// Shrink the tiling so that the last tile row/column is entirely in the
// border pixels of the interior tiles. That row/column is removed.
scoped_refptr<FakeRasterSource> raster_source =
FakeRasterSource::CreateFilled(gfx::Size(right + 1, bottom + 1));
tiling_->SetRasterSourceAndResize(raster_source);
EXPECT_EQ(2, tiling_->TilingDataForTesting().num_tiles_x());
EXPECT_EQ(3, tiling_->TilingDataForTesting().num_tiles_y());
// The live tiles rect was clamped to the raster source size.
EXPECT_EQ(gfx::Rect(right + 1, bottom + 1), tiling_->live_tiles_rect());
// Since the row/column is gone, the tiles should be gone too.
EXPECT_FALSE(tiling_->TileAt(2, 0));
EXPECT_FALSE(tiling_->TileAt(2, 1));
EXPECT_FALSE(tiling_->TileAt(2, 2));
EXPECT_FALSE(tiling_->TileAt(2, 3));
EXPECT_FALSE(tiling_->TileAt(1, 3));
EXPECT_FALSE(tiling_->TileAt(0, 3));
// Growing outside the current right/bottom tiles border pixels should create
// the tiles again, even though the live rect has not changed size.
raster_source =
FakeRasterSource::CreateFilled(gfx::Size(right + 2, bottom + 2));
tiling_->SetRasterSourceAndResize(raster_source);
EXPECT_EQ(3, tiling_->TilingDataForTesting().num_tiles_x());
EXPECT_EQ(4, tiling_->TilingDataForTesting().num_tiles_y());
// Not changed.
EXPECT_EQ(gfx::Rect(right + 1, bottom + 1), tiling_->live_tiles_rect());
// The last row/column tiles are inside the live tiles rect.
EXPECT_TRUE(gfx::Rect(right + 1, bottom + 1).Intersects(
tiling_->TilingDataForTesting().TileBounds(2, 0)));
EXPECT_TRUE(gfx::Rect(right + 1, bottom + 1).Intersects(
tiling_->TilingDataForTesting().TileBounds(0, 3)));
EXPECT_TRUE(tiling_->TileAt(2, 0));
EXPECT_TRUE(tiling_->TileAt(2, 1));
EXPECT_TRUE(tiling_->TileAt(2, 2));
EXPECT_TRUE(tiling_->TileAt(2, 3));
EXPECT_TRUE(tiling_->TileAt(1, 3));
EXPECT_TRUE(tiling_->TileAt(0, 3));
}
TEST_F(PictureLayerTilingIteratorTest, ResizeLiveTileRectOverTileBorders) {
// The tiling has three rows and columns.
Initialize(gfx::Size(100, 100), 1.f, gfx::Size(250, 350));
EXPECT_EQ(3, tiling_->TilingDataForTesting().num_tiles_x());
EXPECT_EQ(4, tiling_->TilingDataForTesting().num_tiles_y());
// The live tiles rect covers the whole tiling.
SetLiveRectAndVerifyTiles(gfx::Rect(250, 350));
// Tiles in the bottom row and right column exist.
EXPECT_TRUE(tiling_->TileAt(2, 0));
EXPECT_TRUE(tiling_->TileAt(2, 1));
EXPECT_TRUE(tiling_->TileAt(2, 2));
EXPECT_TRUE(tiling_->TileAt(2, 3));
EXPECT_TRUE(tiling_->TileAt(1, 3));
EXPECT_TRUE(tiling_->TileAt(0, 3));
// Shrink the live tiles rect to the very edge of the right-most and
// bottom-most tiles. Their border pixels would still be inside the live
// tiles rect, but the tiles should not exist just for that.
int right = tiling_->TilingDataForTesting().TileBounds(2, 3).x();
int bottom = tiling_->TilingDataForTesting().TileBounds(2, 3).y();
SetLiveRectAndVerifyTiles(gfx::Rect(right, bottom));
EXPECT_FALSE(tiling_->TileAt(2, 0));
EXPECT_FALSE(tiling_->TileAt(2, 1));
EXPECT_FALSE(tiling_->TileAt(2, 2));
EXPECT_FALSE(tiling_->TileAt(2, 3));
EXPECT_FALSE(tiling_->TileAt(1, 3));
EXPECT_FALSE(tiling_->TileAt(0, 3));
// Including the bottom row and right column again, should create the tiles.
SetLiveRectAndVerifyTiles(gfx::Rect(right + 1, bottom + 1));
EXPECT_TRUE(tiling_->TileAt(2, 0));
EXPECT_TRUE(tiling_->TileAt(2, 1));
EXPECT_TRUE(tiling_->TileAt(2, 2));
EXPECT_TRUE(tiling_->TileAt(2, 3));
EXPECT_TRUE(tiling_->TileAt(1, 2));
EXPECT_TRUE(tiling_->TileAt(0, 2));
// Shrink the live tiles rect to the very edge of the left-most and
// top-most tiles. Their border pixels would still be inside the live
// tiles rect, but the tiles should not exist just for that.
int left = tiling_->TilingDataForTesting().TileBounds(0, 0).right();
int top = tiling_->TilingDataForTesting().TileBounds(0, 0).bottom();
SetLiveRectAndVerifyTiles(gfx::Rect(left, top, 250 - left, 350 - top));
EXPECT_FALSE(tiling_->TileAt(0, 3));
EXPECT_FALSE(tiling_->TileAt(0, 2));
EXPECT_FALSE(tiling_->TileAt(0, 1));
EXPECT_FALSE(tiling_->TileAt(0, 0));
EXPECT_FALSE(tiling_->TileAt(1, 0));
EXPECT_FALSE(tiling_->TileAt(2, 0));
// Including the top row and left column again, should create the tiles.
SetLiveRectAndVerifyTiles(
gfx::Rect(left - 1, top - 1, 250 - left, 350 - top));
EXPECT_TRUE(tiling_->TileAt(0, 3));
EXPECT_TRUE(tiling_->TileAt(0, 2));
EXPECT_TRUE(tiling_->TileAt(0, 1));
EXPECT_TRUE(tiling_->TileAt(0, 0));
EXPECT_TRUE(tiling_->TileAt(1, 0));
EXPECT_TRUE(tiling_->TileAt(2, 0));
}
TEST_F(PictureLayerTilingIteratorTest, ResizeLiveTileRectOverSameTiles) {
// The tiling has four rows and three columns.
Initialize(gfx::Size(100, 100), 1.f, gfx::Size(250, 350));
EXPECT_EQ(3, tiling_->TilingDataForTesting().num_tiles_x());
EXPECT_EQ(4, tiling_->TilingDataForTesting().num_tiles_y());
// The live tiles rect covers the whole tiling.
SetLiveRectAndVerifyTiles(gfx::Rect(250, 350));
// All tiles exist.
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 4; ++j)
EXPECT_TRUE(tiling_->TileAt(i, j)) << i << "," << j;
}
// Shrink the live tiles rect, but still cover all the tiles.
SetLiveRectAndVerifyTiles(gfx::Rect(1, 1, 249, 349));
// All tiles still exist.
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 4; ++j)
EXPECT_TRUE(tiling_->TileAt(i, j)) << i << "," << j;
}
// Grow the live tiles rect, but still cover all the same tiles.
SetLiveRectAndVerifyTiles(gfx::Rect(0, 0, 250, 350));
// All tiles still exist.
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 4; ++j)
EXPECT_TRUE(tiling_->TileAt(i, j)) << i << "," << j;
}
}
TEST_F(PictureLayerTilingIteratorTest, ResizeOverBorderPixelsDeletesTiles) {
// Verifies that a resize with invalidation for newly exposed pixels will
// deletes tiles that intersect that invalidation.
gfx::Size tile_size(100, 100);
gfx::Size original_layer_size(99, 99);
InitializeActive(tile_size, 1.f, original_layer_size);
SetLiveRectAndVerifyTiles(gfx::Rect(original_layer_size));
// Tiling only has one tile, since its total size is less than one.
EXPECT_TRUE(tiling_->TileAt(0, 0));
// Stop creating tiles so that any invalidations are left as holes.
scoped_refptr<FakeRasterSource> raster_source =
FakeRasterSource::CreatePartiallyFilled(gfx::Size(200, 200), gfx::Rect());
tiling_->SetRasterSourceAndResize(raster_source);
Region invalidation =
SubtractRegions(gfx::Rect(tile_size), gfx::Rect(original_layer_size));
EXPECT_TRUE(tiling_->TileAt(0, 0));
tiling_->Invalidate(invalidation);
EXPECT_FALSE(tiling_->TileAt(0, 0));
// The original tile was the same size after resize, but it would include new
// border pixels.
EXPECT_EQ(gfx::Rect(original_layer_size),
tiling_->TilingDataForTesting().TileBounds(0, 0));
}
TEST_F(PictureLayerTilingIteratorTest, RemoveOutsideLayerKeepsTiles) {
gfx::Size tile_size(100, 100);
gfx::Size layer_size(100, 100);
InitializeActive(tile_size, 1.f, layer_size);
SetLiveRectAndVerifyTiles(gfx::Rect(layer_size));
// In all cases here, the tiling should remain with one tile, since the remove
// region doesn't intersect it.
bool recreate_tiles = false;
// Top
tiling_->RemoveTilesInRegion(gfx::Rect(50, -1, 1, 1), recreate_tiles);
EXPECT_TRUE(tiling_->TileAt(0, 0));
// Bottom
tiling_->RemoveTilesInRegion(gfx::Rect(50, 100, 1, 1), recreate_tiles);
EXPECT_TRUE(tiling_->TileAt(0, 0));
// Left
tiling_->RemoveTilesInRegion(gfx::Rect(-1, 50, 1, 1), recreate_tiles);
EXPECT_TRUE(tiling_->TileAt(0, 0));
// Right
tiling_->RemoveTilesInRegion(gfx::Rect(100, 50, 1, 1), recreate_tiles);
EXPECT_TRUE(tiling_->TileAt(0, 0));
}
TEST_F(PictureLayerTilingIteratorTest, CreateTileJustCoverBorderUp) {
float content_scale = 1.2000000476837158f;
gfx::Size tile_size(512, 512);
gfx::Size layer_size(1440, 4560);
FakePictureLayerTilingClient active_client;
active_client.SetTileSize(tile_size);
scoped_refptr<FakeRasterSource> raster_source =
FakeRasterSource::CreateFilled(layer_size);
std::unique_ptr<TestablePictureLayerTiling> active_tiling =
TestablePictureLayerTiling::Create(ACTIVE_TREE, content_scale,
raster_source, &active_client,
LayerTreeSettings());
active_tiling->set_resolution(HIGH_RESOLUTION);
gfx::Rect invalid_rect(0, 750, 220, 100);
Initialize(tile_size, content_scale, layer_size);
client_.set_twin_tiling(active_tiling.get());
client_.set_invalidation(invalid_rect);
SetLiveRectAndVerifyTiles(gfx::Rect(layer_size));
// When it creates a tile in pending tree, verify that tiles are invalidated
// even if only their border pixels intersect the invalidation rect
EXPECT_TRUE(tiling_->TileAt(0, 1));
gfx::Rect scaled_invalid_rect =
gfx::ScaleToEnclosingRect(invalid_rect, content_scale);
EXPECT_FALSE(scaled_invalid_rect.Intersects(
tiling_->TilingDataForTesting().TileBounds(0, 2)));
EXPECT_TRUE(scaled_invalid_rect.Intersects(
tiling_->TilingDataForTesting().TileBoundsWithBorder(0, 2)));
EXPECT_TRUE(tiling_->TileAt(0, 2));
bool recreate_tiles = false;
active_tiling->RemoveTilesInRegion(invalid_rect, recreate_tiles);
// Even though a tile just touch border area of invalid region, verify that
// RemoveTilesInRegion behaves the same as SetLiveRectAndVerifyTiles with
// respect to the tiles that it invalidates
EXPECT_FALSE(active_tiling->TileAt(0, 1));
EXPECT_FALSE(active_tiling->TileAt(0, 2));
}
TEST_F(PictureLayerTilingIteratorTest, LiveTilesExactlyCoverLiveTileRect) {
Initialize(gfx::Size(100, 100), 1.f, gfx::Size(1099, 801));
SetLiveRectAndVerifyTiles(gfx::Rect(100, 100));
SetLiveRectAndVerifyTiles(gfx::Rect(101, 99));
SetLiveRectAndVerifyTiles(gfx::Rect(1099, 1));
SetLiveRectAndVerifyTiles(gfx::Rect(1, 801));
SetLiveRectAndVerifyTiles(gfx::Rect(1099, 1));
SetLiveRectAndVerifyTiles(gfx::Rect(201, 800));
}
TEST_F(PictureLayerTilingIteratorTest, IteratorCoversLayerBoundsNoScale) {
Initialize(gfx::Size(100, 100), 1.f, gfx::Size(1099, 801));
VerifyTilesExactlyCoverRect(1, gfx::Rect());
VerifyTilesExactlyCoverRect(1, gfx::Rect(0, 0, 1099, 801));
VerifyTilesExactlyCoverRect(1, gfx::Rect(52, 83, 789, 412));
// With borders, a size of 3x3 = 1 pixel of content.
Initialize(gfx::Size(3, 3), 1.f, gfx::Size(10, 10));
VerifyTilesExactlyCoverRect(1, gfx::Rect(0, 0, 1, 1));
VerifyTilesExactlyCoverRect(1, gfx::Rect(0, 0, 2, 2));
VerifyTilesExactlyCoverRect(1, gfx::Rect(1, 1, 2, 2));
VerifyTilesExactlyCoverRect(1, gfx::Rect(3, 2, 5, 2));
}
TEST_F(PictureLayerTilingIteratorTest, IteratorCoversLayerBoundsTilingScale) {
Initialize(gfx::Size(200, 100), 2.0f, gfx::Size(1005, 2010));
VerifyTilesExactlyCoverRect(1, gfx::Rect());
VerifyTilesExactlyCoverRect(1, gfx::Rect(0, 0, 1005, 2010));
VerifyTilesExactlyCoverRect(1, gfx::Rect(50, 112, 512, 381));
Initialize(gfx::Size(3, 3), 2.0f, gfx::Size(10, 10));
VerifyTilesExactlyCoverRect(1, gfx::Rect());
VerifyTilesExactlyCoverRect(1, gfx::Rect(0, 0, 1, 1));
VerifyTilesExactlyCoverRect(1, gfx::Rect(0, 0, 2, 2));
VerifyTilesExactlyCoverRect(1, gfx::Rect(1, 1, 2, 2));
VerifyTilesExactlyCoverRect(1, gfx::Rect(3, 2, 5, 2));
Initialize(gfx::Size(100, 200), 0.5f, gfx::Size(1005, 2010));
VerifyTilesExactlyCoverRect(1, gfx::Rect(0, 0, 1005, 2010));
VerifyTilesExactlyCoverRect(1, gfx::Rect(50, 112, 512, 381));
Initialize(gfx::Size(150, 250), 0.37f, gfx::Size(1005, 2010));
VerifyTilesExactlyCoverRect(1, gfx::Rect(0, 0, 1005, 2010));
VerifyTilesExactlyCoverRect(1, gfx::Rect(50, 112, 512, 381));
Initialize(gfx::Size(312, 123), 0.01f, gfx::Size(1005, 2010));
VerifyTilesExactlyCoverRect(1, gfx::Rect(0, 0, 1005, 2010));
VerifyTilesExactlyCoverRect(1, gfx::Rect(50, 112, 512, 381));
}
TEST_F(PictureLayerTilingIteratorTest, IteratorCoversLayerBoundsBothScale) {
Initialize(gfx::Size(50, 50), 4.0f, gfx::Size(800, 600));
VerifyTilesExactlyCoverRect(2.0f, gfx::Rect());
VerifyTilesExactlyCoverRect(2.0f, gfx::Rect(0, 0, 1600, 1200));
VerifyTilesExactlyCoverRect(2.0f, gfx::Rect(512, 365, 253, 182));
float scale = 6.7f;
gfx::Size bounds(800, 600);
gfx::Rect full_rect(gfx::ScaleToCeiledSize(bounds, scale));
Initialize(gfx::Size(256, 512), 5.2f, bounds);
VerifyTilesExactlyCoverRect(scale, full_rect);
VerifyTilesExactlyCoverRect(scale, gfx::Rect(2014, 1579, 867, 1033));
}
TEST_F(PictureLayerTilingIteratorTest, IteratorEmptyRect) {
Initialize(gfx::Size(100, 100), 1.0f, gfx::Size(800, 600));
gfx::Rect empty;
PictureLayerTiling::CoverageIterator iter(tiling_.get(), 1.0f, empty);
EXPECT_FALSE(iter);
}
TEST_F(PictureLayerTilingIteratorTest, NonIntersectingRect) {
Initialize(gfx::Size(100, 100), 1.0f, gfx::Size(800, 600));
gfx::Rect non_intersecting(1000, 1000, 50, 50);
PictureLayerTiling::CoverageIterator iter(tiling_.get(), 1, non_intersecting);
EXPECT_FALSE(iter);
}
TEST_F(PictureLayerTilingIteratorTest, LayerEdgeTextureCoordinates) {
Initialize(gfx::Size(300, 300), 1.0f, gfx::Size(256, 256));
// All of these sizes are 256x256, scaled and ceiled.
VerifyTilesExactlyCoverRect(1.0f, gfx::Rect(0, 0, 256, 256));
VerifyTilesExactlyCoverRect(0.8f, gfx::Rect(0, 0, 205, 205));
VerifyTilesExactlyCoverRect(1.2f, gfx::Rect(0, 0, 308, 308));
}
TEST_F(PictureLayerTilingIteratorTest, NonContainedDestRect) {
Initialize(gfx::Size(100, 100), 1.0f, gfx::Size(400, 400));
// Too large in all dimensions
VerifyTilesCoverNonContainedRect(1.0f, gfx::Rect(-1000, -1000, 2000, 2000));
VerifyTilesCoverNonContainedRect(1.5f, gfx::Rect(-1000, -1000, 2000, 2000));
VerifyTilesCoverNonContainedRect(0.5f, gfx::Rect(-1000, -1000, 2000, 2000));
// Partially covering content, but too large
VerifyTilesCoverNonContainedRect(1.0f, gfx::Rect(-1000, 100, 2000, 100));
VerifyTilesCoverNonContainedRect(1.5f, gfx::Rect(-1000, 100, 2000, 100));
VerifyTilesCoverNonContainedRect(0.5f, gfx::Rect(-1000, 100, 2000, 100));
}
static void TileExists(bool exists, Tile* tile,
const gfx::Rect& geometry_rect) {
EXPECT_EQ(exists, tile != NULL) << geometry_rect.ToString();
}
TEST_F(PictureLayerTilingIteratorTest, TilesExist) {
gfx::Size layer_bounds(1099, 801);
Initialize(gfx::Size(100, 100), 1.f, layer_bounds);
VerifyTilesExactlyCoverRect(1.f, gfx::Rect(layer_bounds));
VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, false));
tiling_->ComputeTilePriorityRects(
gfx::Rect(layer_bounds), // visible rect
gfx::Rect(layer_bounds), // skewport
gfx::Rect(layer_bounds), // soon border rect
gfx::Rect(layer_bounds), // eventually rect
1.f, // current contents scale
Occlusion());
VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, true));
// Make the viewport rect empty. All tiles are killed and become zombies.
tiling_->ComputeTilePriorityRects(gfx::Rect(), gfx::Rect(), gfx::Rect(),
gfx::Rect(), 1.f, Occlusion());
VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, false));
}
TEST_F(PictureLayerTilingIteratorTest, TilesExistGiantViewport) {
gfx::Size layer_bounds(1099, 801);
Initialize(gfx::Size(100, 100), 1.f, layer_bounds);
VerifyTilesExactlyCoverRect(1.f, gfx::Rect(layer_bounds));
VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, false));
gfx::Rect giant_rect(-10000000, -10000000, 1000000000, 1000000000);
tiling_->ComputeTilePriorityRects(
gfx::Rect(layer_bounds), // visible rect
gfx::Rect(layer_bounds), // skewport
gfx::Rect(layer_bounds), // soon border rect
gfx::Rect(layer_bounds), // eventually rect
1.f, // current contents scale
Occlusion());
VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, true));
// If the visible content rect is huge, we should still have live tiles.
tiling_->ComputeTilePriorityRects(giant_rect, giant_rect, giant_rect,
giant_rect, 1.f, Occlusion());
VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, true));
}
TEST_F(PictureLayerTilingIteratorTest, TilesExistOutsideViewport) {
gfx::Size layer_bounds(1099, 801);
Initialize(gfx::Size(100, 100), 1.f, layer_bounds);
VerifyTilesExactlyCoverRect(1.f, gfx::Rect(layer_bounds));
VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, false));
// This rect does not intersect with the layer, as the layer is outside the
// viewport.
gfx::Rect viewport_rect(1100, 0, 1000, 1000);
EXPECT_FALSE(viewport_rect.Intersects(gfx::Rect(layer_bounds)));
LayerTreeSettings settings;
gfx::Rect eventually_rect = viewport_rect;
eventually_rect.Inset(-settings.tiling_interest_area_padding,
-settings.tiling_interest_area_padding);
tiling_->ComputeTilePriorityRects(viewport_rect, viewport_rect, viewport_rect,
eventually_rect, 1.f, Occlusion());
VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, true));
}
static void TilesIntersectingRectExist(const gfx::Rect& rect,
bool intersect_exists,
Tile* tile,
const gfx::Rect& geometry_rect) {
bool intersects = rect.Intersects(geometry_rect);
bool expected_exists = intersect_exists ? intersects : !intersects;
EXPECT_EQ(expected_exists, tile != NULL)
<< "Rects intersecting " << rect.ToString() << " should exist. "
<< "Current tile rect is " << geometry_rect.ToString();
}
TEST_F(PictureLayerTilingIteratorTest,
TilesExistLargeViewportAndLayerWithSmallVisibleArea) {
gfx::Size layer_bounds(10000, 10000);
client_.SetTileSize(gfx::Size(100, 100));
LayerTreeSettings settings;
settings.tiling_interest_area_padding = 1;
scoped_refptr<FakeRasterSource> raster_source =
FakeRasterSource::CreateFilled(layer_bounds);
tiling_ = TestablePictureLayerTiling::Create(PENDING_TREE, 1.f, raster_source,
&client_, settings);
tiling_->set_resolution(HIGH_RESOLUTION);
VerifyTilesExactlyCoverRect(1.f, gfx::Rect(layer_bounds));
VerifyTiles(1.f, gfx::Rect(layer_bounds), base::Bind(&TileExists, false));
gfx::Rect visible_rect(8000, 8000, 50, 50);
tiling_->ComputeTilePriorityRects(visible_rect, // visible rect
visible_rect, // skewport
visible_rect, // soon border rect
visible_rect, // eventually rect
1.f, // current contents scale
Occlusion());
VerifyTiles(1.f,
gfx::Rect(layer_bounds),
base::Bind(&TilesIntersectingRectExist, visible_rect, true));
}
TEST(ComputeTilePriorityRectsTest, VisibleTiles) {
// The TilePriority of visible tiles should have zero distance_to_visible
// and time_to_visible.
FakePictureLayerTilingClient client;
gfx::Size device_viewport(800, 600);
gfx::Size last_layer_bounds(200, 200);
gfx::Size current_layer_bounds(200, 200);
float current_layer_contents_scale = 1.f;
gfx::Transform current_screen_transform;
gfx::Rect viewport_in_layer_space = ViewportInLayerSpace(
current_screen_transform, device_viewport);
client.SetTileSize(gfx::Size(100, 100));
scoped_refptr<FakeRasterSource> raster_source =
FakeRasterSource::CreateFilled(current_layer_bounds);
std::unique_ptr<TestablePictureLayerTiling> tiling =
TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source,
&client, LayerTreeSettings());
tiling->set_resolution(HIGH_RESOLUTION);
LayerTreeSettings settings;
gfx::Rect eventually_rect = viewport_in_layer_space;
eventually_rect.Inset(-settings.tiling_interest_area_padding,
-settings.tiling_interest_area_padding);
tiling->ComputeTilePriorityRects(
viewport_in_layer_space, viewport_in_layer_space, viewport_in_layer_space,
eventually_rect, current_layer_contents_scale, Occlusion());
auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting();
ASSERT_TRUE(tiling->TileAt(0, 0));
ASSERT_TRUE(tiling->TileAt(0, 1));
ASSERT_TRUE(tiling->TileAt(1, 0));
ASSERT_TRUE(tiling->TileAt(1, 1));
TilePriority priority = prioritized_tiles[tiling->TileAt(0, 0)].priority();
EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible);
EXPECT_FLOAT_EQ(TilePriority::NOW, priority.priority_bin);
priority = prioritized_tiles[tiling->TileAt(0, 1)].priority();
EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible);
EXPECT_FLOAT_EQ(TilePriority::NOW, priority.priority_bin);
priority = prioritized_tiles[tiling->TileAt(1, 0)].priority();
EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible);
EXPECT_FLOAT_EQ(TilePriority::NOW, priority.priority_bin);
priority = prioritized_tiles[tiling->TileAt(1, 1)].priority();
EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible);
EXPECT_FLOAT_EQ(TilePriority::NOW, priority.priority_bin);
}
TEST(ComputeTilePriorityRectsTest, OffscreenTiles) {
// The TilePriority of offscreen tiles (without movement) should have nonzero
// distance_to_visible and infinite time_to_visible.
FakePictureLayerTilingClient client;
gfx::Size device_viewport(800, 600);
gfx::Size last_layer_bounds(200, 200);
gfx::Size current_layer_bounds(200, 200);
float current_layer_contents_scale = 1.f;
gfx::Transform last_screen_transform;
gfx::Transform current_screen_transform;
current_screen_transform.Translate(850, 0);
last_screen_transform = current_screen_transform;
gfx::Rect viewport_in_layer_space = ViewportInLayerSpace(
current_screen_transform, device_viewport);
client.SetTileSize(gfx::Size(100, 100));
scoped_refptr<FakeRasterSource> raster_source =
FakeRasterSource::CreateFilled(current_layer_bounds);
std::unique_ptr<TestablePictureLayerTiling> tiling =
TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source,
&client, LayerTreeSettings());
tiling->set_resolution(HIGH_RESOLUTION);
LayerTreeSettings settings;
gfx::Rect eventually_rect = viewport_in_layer_space;
eventually_rect.Inset(-settings.tiling_interest_area_padding,
-settings.tiling_interest_area_padding);
tiling->ComputeTilePriorityRects(
viewport_in_layer_space, viewport_in_layer_space, viewport_in_layer_space,
eventually_rect, current_layer_contents_scale, Occlusion());
auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting();
ASSERT_TRUE(tiling->TileAt(0, 0));
ASSERT_TRUE(tiling->TileAt(0, 1));
ASSERT_TRUE(tiling->TileAt(1, 0));
ASSERT_TRUE(tiling->TileAt(1, 1));
TilePriority priority = prioritized_tiles[tiling->TileAt(0, 0)].priority();
EXPECT_GT(priority.distance_to_visible, 0.f);
EXPECT_NE(TilePriority::NOW, priority.priority_bin);
priority = prioritized_tiles[tiling->TileAt(0, 1)].priority();
EXPECT_GT(priority.distance_to_visible, 0.f);
EXPECT_NE(TilePriority::NOW, priority.priority_bin);
priority = prioritized_tiles[tiling->TileAt(1, 0)].priority();
EXPECT_GT(priority.distance_to_visible, 0.f);
EXPECT_NE(TilePriority::NOW, priority.priority_bin);
priority = prioritized_tiles[tiling->TileAt(1, 1)].priority();
EXPECT_GT(priority.distance_to_visible, 0.f);
EXPECT_NE(TilePriority::NOW, priority.priority_bin);
// Furthermore, in this scenario tiles on the right hand side should have a
// larger distance to visible.
TilePriority left = prioritized_tiles[tiling->TileAt(0, 0)].priority();
TilePriority right = prioritized_tiles[tiling->TileAt(1, 0)].priority();
EXPECT_GT(right.distance_to_visible, left.distance_to_visible);
left = prioritized_tiles[tiling->TileAt(0, 1)].priority();
right = prioritized_tiles[tiling->TileAt(1, 1)].priority();
EXPECT_GT(right.distance_to_visible, left.distance_to_visible);
}
TEST(ComputeTilePriorityRectsTest, PartiallyOffscreenLayer) {
// Sanity check that a layer with some tiles visible and others offscreen has
// correct TilePriorities for each tile.
FakePictureLayerTilingClient client;
gfx::Size device_viewport(800, 600);
gfx::Size last_layer_bounds(200, 200);
gfx::Size current_layer_bounds(200, 200);
float current_layer_contents_scale = 1.f;
gfx::Transform last_screen_transform;
gfx::Transform current_screen_transform;
current_screen_transform.Translate(705, 505);
last_screen_transform = current_screen_transform;
gfx::Rect viewport_in_layer_space = ViewportInLayerSpace(
current_screen_transform, device_viewport);
client.SetTileSize(gfx::Size(100, 100));
scoped_refptr<FakeRasterSource> raster_source =
FakeRasterSource::CreateFilled(current_layer_bounds);
std::unique_ptr<TestablePictureLayerTiling> tiling =
TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source,
&client, LayerTreeSettings());
tiling->set_resolution(HIGH_RESOLUTION);
LayerTreeSettings settings;
gfx::Rect eventually_rect = viewport_in_layer_space;
eventually_rect.Inset(-settings.tiling_interest_area_padding,
-settings.tiling_interest_area_padding);
tiling->ComputeTilePriorityRects(
viewport_in_layer_space, viewport_in_layer_space, viewport_in_layer_space,
eventually_rect, current_layer_contents_scale, Occlusion());
auto prioritized_tiles = tiling->UpdateAndGetAllPrioritizedTilesForTesting();
ASSERT_TRUE(tiling->TileAt(0, 0));
ASSERT_TRUE(tiling->TileAt(0, 1));
ASSERT_TRUE(tiling->TileAt(1, 0));
ASSERT_TRUE(tiling->TileAt(1, 1));
TilePriority priority = prioritized_tiles[tiling->TileAt(0, 0)].priority();
EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible);
EXPECT_FLOAT_EQ(TilePriority::NOW, priority.priority_bin);
priority = prioritized_tiles[tiling->TileAt(0, 1)].priority();
EXPECT_GT(priority.distance_to_visible, 0.f);
EXPECT_NE(TilePriority::NOW, priority.priority_bin);
priority = prioritized_tiles[tiling->TileAt(1, 0)].priority();
EXPECT_GT(priority.distance_to_visible, 0.f);
EXPECT_NE(TilePriority::NOW, priority.priority_bin);
priority = prioritized_tiles[tiling->TileAt(1, 1)].priority();
EXPECT_GT(priority.distance_to_visible, 0.f);
EXPECT_NE(TilePriority::NOW, priority.priority_bin);
}
TEST(PictureLayerTilingTest, RecycledTilesClearedOnReset) {
FakePictureLayerTilingClient active_client;
active_client.SetTileSize(gfx::Size(100, 100));
scoped_refptr<FakeRasterSource> raster_source =
FakeRasterSource::CreateFilled(gfx::Size(100, 100));
std::unique_ptr<TestablePictureLayerTiling> active_tiling =
TestablePictureLayerTiling::Create(ACTIVE_TREE, 1.0f, raster_source,
&active_client, LayerTreeSettings());
active_tiling->set_resolution(HIGH_RESOLUTION);
// Create all tiles on this tiling.
gfx::Rect visible_rect = gfx::Rect(0, 0, 100, 100);
active_tiling->ComputeTilePriorityRects(
visible_rect, visible_rect, visible_rect, visible_rect, 1.f, Occlusion());
FakePictureLayerTilingClient recycle_client;
recycle_client.SetTileSize(gfx::Size(100, 100));
recycle_client.set_twin_tiling(active_tiling.get());
LayerTreeSettings settings;
raster_source = FakeRasterSource::CreateFilled(gfx::Size(100, 100));
std::unique_ptr<TestablePictureLayerTiling> recycle_tiling =
TestablePictureLayerTiling::Create(PENDING_TREE, 1.0f, raster_source,
&recycle_client, settings);
recycle_tiling->set_resolution(HIGH_RESOLUTION);
// Create all tiles on the recycle tiling.
recycle_tiling->ComputeTilePriorityRects(visible_rect, visible_rect,
visible_rect, visible_rect, 1.0f,
Occlusion());
// Set the second tiling as recycled.
active_client.set_twin_tiling(NULL);
recycle_client.set_twin_tiling(NULL);
EXPECT_TRUE(active_tiling->TileAt(0, 0));
EXPECT_FALSE(recycle_tiling->TileAt(0, 0));
// Reset the active tiling. The recycle tiles should be released too.
active_tiling->Reset();
EXPECT_FALSE(active_tiling->TileAt(0, 0));
EXPECT_FALSE(recycle_tiling->TileAt(0, 0));
}
TEST_F(PictureLayerTilingIteratorTest, ResizeTilesAndUpdateToCurrent) {
// The tiling has four rows and three columns.
Initialize(gfx::Size(150, 100), 1.f, gfx::Size(250, 150));
tiling_->CreateAllTilesForTesting();
EXPECT_EQ(150, tiling_->TilingDataForTesting().max_texture_size().width());
EXPECT_EQ(100, tiling_->TilingDataForTesting().max_texture_size().height());
EXPECT_EQ(4u, tiling_->AllTilesForTesting().size());
client_.SetTileSize(gfx::Size(250, 200));
// Tile size in the tiling should still be 150x100.
EXPECT_EQ(150, tiling_->TilingDataForTesting().max_texture_size().width());
EXPECT_EQ(100, tiling_->TilingDataForTesting().max_texture_size().height());
// The layer's size isn't changed, but the tile size was.
scoped_refptr<FakeRasterSource> raster_source =
FakeRasterSource::CreateFilled(gfx::Size(250, 150));
tiling_->SetRasterSourceAndResize(raster_source);
// Tile size in the tiling should be resized to 250x200.
EXPECT_EQ(250, tiling_->TilingDataForTesting().max_texture_size().width());
EXPECT_EQ(200, tiling_->TilingDataForTesting().max_texture_size().height());
EXPECT_EQ(0u, tiling_->AllTilesForTesting().size());
}
// This test runs into floating point issues because of big numbers.
TEST_F(PictureLayerTilingIteratorTest, GiantRect) {
gfx::Size tile_size(256, 256);
gfx::Size layer_size(33554432, 33554432);
float contents_scale = 1.f;
client_.SetTileSize(tile_size);
scoped_refptr<FakeRasterSource> raster_source =
FakeRasterSource::CreateEmpty(layer_size);
tiling_ = TestablePictureLayerTiling::Create(PENDING_TREE, contents_scale,
raster_source, &client_,
LayerTreeSettings());
gfx::Rect content_rect(25554432, 25554432, 950, 860);
VerifyTilesExactlyCoverRect(contents_scale, content_rect);
}
} // namespace
} // namespace cc
| [
"bino.zh@gmail.com"
] | bino.zh@gmail.com |
2b87e8ed0330026cab857a5c124d8ff0402fd9e5 | a94bfc1fbf7cb150028300f7479358dc70804089 | /3dmod/pixelview.h | 2baebf74f4f4b68a6d2a34d4797b8248306adfc6 | [] | no_license | imod-mirror/IMOD | 29f2a0d3f2c2156dc8624c917b9b36b3f23a38ec | 499d656bc7784a23c9614380234511e5c758be4f | refs/heads/master | 2021-01-02T08:47:39.133329 | 2015-08-25T06:42:46 | 2015-08-25T06:42:46 | 41,421,626 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,212 | h | //Added by qt3to4:
#include <QLabel>
#include <QKeyEvent>
#include <QCloseEvent>
/* pixelview.h - declarations for pixelview.cpp and PixelView class
*
* Copyright (C) 1995-2002 by Boulder Laboratory for 3-Dimensional Electron
* Microscopy of Cells ("BL3DEMC") and the Regents of the University of
* Colorado. See implementation file for full copyright notice.
*
* $Id$
* Log at end of file
*/
#ifndef PIXELVIEW_H
#define PIXELVIEW_H
int open_pixelview(struct ViewInfo *vi);
void pvNewMousePosition(struct ViewInfo *vi, float x, float y, int iz);
#define PV_ROWS 7
#define PV_COLS 7
#include <qwidget.h>
class QLabel;
class QPushButton;
class QCheckBox;
class PixelView: public QWidget
{
Q_OBJECT
public:
PixelView(QWidget *parent, const char *name = 0,
Qt::WindowFlags fl = Qt::Window);
~PixelView() {};
void update();
void setButtonWidths();
QLabel *mMouseLabel;
QCheckBox *mFileValBox;
public slots:
void buttonPressed(int pos);
void fromFileToggled(bool state);
void showButsToggled(bool state);
void gridFileToggled(bool state);
void convertToggled(bool state);
void helpClicked(void);
void adjustDialogSize();
protected:
void closeEvent ( QCloseEvent * e );
void keyPressEvent ( QKeyEvent * e );
void keyReleaseEvent ( QKeyEvent * e );
void changeEvent(QEvent *e);
private:
QLabel *mBotLabels[PV_COLS];
QLabel *mLeftLabels[PV_ROWS];
QLabel *mLabXY;
QPushButton *mButtons[PV_ROWS][PV_COLS];
QColor mGrayColor; // Original color
int mMinRow, mMinCol, mMaxRow, mMaxCol; // Row, column of last min/max
QCheckBox *mGridValBox;
QCheckBox *mConvertBox;
QPushButton *mHelpButton;
};
#endif
/*
$Log$
Revision 4.5 2008/05/27 05:33:15 mast
Changes for rgb and memory displays
Revision 4.4 2006/09/18 15:46:46 mast
Moved mouse line to top
Revision 4.3 2006/09/17 18:15:34 mast
Added mouse position/value report line
Revision 4.2 2003/03/26 06:30:56 mast
adjusting to font changes
Revision 4.1 2003/02/10 20:41:56 mast
Merge Qt source
Revision 1.1.2.2 2003/01/10 23:49:19 mast
clean up unused call
Revision 1.1.2.1 2003/01/04 03:49:53 mast
Initial creation
*/
| [
"mast@localhost"
] | mast@localhost |
8a0b4f447547a0b8cfb26b0f1c1635462bbd0877 | 13ea1314672cede9672854e5a11ef95868655b2f | /HHEngine32/ShadowGen.h | 10ac670255558f7e7e36a402e2d0b38d102cfb0f | [] | no_license | MergHQ/survivalgame | 03e7807afd5e0305f2e520a6649f0325d5e54727 | ed6e94a24643158001a17fe53adc023c367567ed | refs/heads/master | 2021-03-27T14:41:26.328666 | 2016-04-11T18:59:50 | 2016-04-11T18:59:50 | 48,742,726 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 639 | h | #pragma once
#include "ITexture.h"
#include "IShader.h"
#include <glm\mat4x4.hpp>
#include <glm\vec3.hpp>
class CShadowGen
{
public:
CShadowGen(int w, int h, glm::mat4 projectionMatrix);
~CShadowGen();
void ShadowPass(glm::vec3 pos);
ITexture* GetShadowMap() { return m_pTexture; }
glm::mat4& GetDepthBiasMVP() { return m_depthBiasMVP; }
private:
GLuint m_framebuffer;
ITexture* m_pTexture;
IShader* m_pSmShader;
glm::mat4 m_projectionMatrix;
glm::mat4 m_depthBiasMVP;
int m_width, m_height;
glm::mat4 m_biasMatrix = glm::mat4(
0.5, 0.0, 0.0, 0.0,
0.0, 0.5, 0.0, 0.0,
0.0, 0.0, 0.5, 0.0,
0.5, 0.5, 0.5, 1.0
);
};
| [
"hugo.holm@live.com"
] | hugo.holm@live.com |
392c6dbe64d27920158bba0eac3d286255b26a5c | 4c2d1c669e16ba7c552d7ca30348b5d013a9fe51 | /vtkm/filter/testing/UnitTestExtractPointsFilter.cxx | ac082cd94b01bb2ba8606d298fd325c139b45f57 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | rushah05/VTKm_FP16 | 7423db6195d60974071565af9995905f45d7a6df | 487819a1dbdd8dc3f95cca2942e3f2706a2514b5 | refs/heads/main | 2023-04-13T12:10:03.420232 | 2021-02-10T21:34:31 | 2021-02-10T21:34:31 | 308,658,384 | 0 | 0 | NOASSERTION | 2021-02-10T21:34:33 | 2020-10-30T14:43:03 | C++ | UTF-8 | C++ | false | false | 5,868 | cxx | //============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/cont/testing/MakeTestDataSet.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/filter/ExtractPoints.h>
using vtkm::cont::testing::MakeTestDataSet;
namespace
{
class TestingExtractPoints
{
public:
void TestUniformByBox0() const
{
std::cout << "Testing extract points with implicit function (box):" << std::endl;
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DUniformDataSet1();
// Implicit function
vtkm::Vec3f minPoint(1.f, 1.f, 1.f);
vtkm::Vec3f maxPoint(3.f, 3.f, 3.f);
auto box = vtkm::cont::make_ImplicitFunctionHandle<vtkm::Box>(minPoint, maxPoint);
// Setup and run filter to extract by volume of interest
vtkm::filter::ExtractPoints extractPoints;
extractPoints.SetImplicitFunction(box);
extractPoints.SetExtractInside(true);
extractPoints.SetCompactPoints(true);
vtkm::cont::DataSet output = extractPoints.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 27), "Wrong result for ExtractPoints");
vtkm::cont::ArrayHandle<vtkm::Float32> outPointData;
output.GetField("pointvar").GetData().CopyTo(outPointData);
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractPoints filter");
VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(0) == 99.0f, "Wrong point field data");
VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(26) == 97.0f, "Wrong point field data");
}
void TestUniformByBox1() const
{
std::cout << "Testing extract points with implicit function (box):" << std::endl;
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DUniformDataSet1();
// Implicit function
vtkm::Vec3f minPoint(1.f, 1.f, 1.f);
vtkm::Vec3f maxPoint(3.f, 3.f, 3.f);
auto box = vtkm::cont::make_ImplicitFunctionHandle<vtkm::Box>(minPoint, maxPoint);
// Setup and run filter to extract by volume of interest
vtkm::filter::ExtractPoints extractPoints;
extractPoints.SetImplicitFunction(box);
extractPoints.SetExtractInside(false);
extractPoints.SetCompactPoints(true);
vtkm::cont::DataSet output = extractPoints.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 98), "Wrong result for ExtractPoints");
vtkm::cont::ArrayHandle<vtkm::Float32> outPointData;
output.GetField("pointvar").GetData().CopyTo(outPointData);
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractPoints filter");
for (vtkm::Id i = 0; i < output.GetCellSet().GetNumberOfPoints(); i++)
{
VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(i) == 0.0f, "Wrong point field data");
}
}
void TestUniformBySphere() const
{
std::cout << "Testing extract points with implicit function (sphere):" << std::endl;
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DUniformDataSet1();
// Implicit function
vtkm::Vec3f center(2.f, 2.f, 2.f);
vtkm::FloatDefault radius(1.8f);
auto sphere = vtkm::cont::make_ImplicitFunctionHandle<vtkm::Sphere>(center, radius);
// Setup and run filter to extract by volume of interest
vtkm::filter::ExtractPoints extractPoints;
extractPoints.SetImplicitFunction(sphere);
extractPoints.SetExtractInside(true);
vtkm::cont::DataSet output = extractPoints.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 27), "Wrong result for ExtractPoints");
}
void TestExplicitByBox0() const
{
std::cout << "Testing extract points with implicit function (box):" << std::endl;
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DExplicitDataSet5();
// Implicit function
vtkm::Vec3f minPoint(0.f, 0.f, 0.f);
vtkm::Vec3f maxPoint(1.f, 1.f, 1.f);
auto box = vtkm::cont::make_ImplicitFunctionHandle<vtkm::Box>(minPoint, maxPoint);
// Setup and run filter to extract by volume of interest
vtkm::filter::ExtractPoints extractPoints;
extractPoints.SetImplicitFunction(box);
extractPoints.SetExtractInside(true);
vtkm::cont::DataSet output = extractPoints.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 8), "Wrong result for ExtractPoints");
}
void TestExplicitByBox1() const
{
std::cout << "Testing extract points with implicit function (box):" << std::endl;
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DExplicitDataSet5();
// Implicit function
vtkm::Vec3f minPoint(0.f, 0.f, 0.f);
vtkm::Vec3f maxPoint(1.f, 1.f, 1.f);
auto box = vtkm::cont::make_ImplicitFunctionHandle<vtkm::Box>(minPoint, maxPoint);
// Setup and run filter to extract by volume of interest
vtkm::filter::ExtractPoints extractPoints;
extractPoints.SetImplicitFunction(box);
extractPoints.SetExtractInside(false);
vtkm::cont::DataSet output = extractPoints.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 3), "Wrong result for ExtractPoints");
}
void operator()() const
{
this->TestUniformByBox0();
this->TestUniformByBox1();
this->TestUniformBySphere();
this->TestExplicitByBox0();
this->TestExplicitByBox1();
}
};
}
int UnitTestExtractPointsFilter(int argc, char* argv[])
{
return vtkm::cont::testing::Testing::Run(TestingExtractPoints(), argc, argv);
}
| [
"46826537+rushah05@users.noreply.github.com"
] | 46826537+rushah05@users.noreply.github.com |
59cef6c80a1e355bc62d88824158d4258dd1bae4 | adbc979313cbc1f0d42c79ac4206d42a8adb3234 | /Source Code/李沿橙 2017-10-8/competition/source/192.168.0.41_株洲二中-梁亮/starlit.cpp | 501493dda0c01abbb1960046205dab2824418a9c | [] | no_license | UnnamedOrange/Contests | a7982c21e575d1342d28c57681a3c98f8afda6c0 | d593d56921d2cde0c473b3abedb419bef4cf3ba4 | refs/heads/master | 2018-10-22T02:26:51.952067 | 2018-07-21T09:32:29 | 2018-07-21T09:32:29 | 112,301,400 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 726 | cpp | #include<cstdio>
#include<iostream>
using namespace std;
int n,k,m;
bool close[40010];
int b[40010];
int a[40010],dis[40010];//a[i] the number of downlight i;
void special()
{
int ans=0;
for(int i=1;i<=n;++i)
{
if(close[i]==true)
{
for(int j=i;j<=i+b[1];++j)
close[j]=1-close[j];
++ans;
}
}
printf("%d",ans);
return;
}
void search()
{
return ;
}
int main()
{
freopen("starlit.in","r",stdin);
freopen("starlit.out","w",stdout);
scanf("%d%d%d",&n,&k,&m);
int temp;
for(int i=1;i<=k;++i)
{
scanf("%d",&a[i]);
close[a[i]]=true;
}
for(int i=1;i<=m;++i)
scanf("%d",&b[i]);
for(int i=1;i<n;++i)
{
dis[i]=a[i+1]-a[i];
}
if(m==1) {special();return 0;}
printf("2");
return 0;
}
| [
"lycheng1215@sina.com"
] | lycheng1215@sina.com |
52d0253903117834885e12697afba98e8858b2d1 | c2d270aff0a4d939f43b6359ac2c564b2565be76 | /src/media/mojo/services/media_metrics_provider.h | 780fcdffedfb2193a25083800b6de3257d6d4987 | [
"BSD-3-Clause"
] | permissive | bopopescu/QuicDep | dfa5c2b6aa29eb6f52b12486ff7f3757c808808d | bc86b705a6cf02d2eade4f3ea8cf5fe73ef52aa0 | refs/heads/master | 2022-04-26T04:36:55.675836 | 2020-04-29T21:29:26 | 2020-04-29T21:29:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,096 | h | // 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.
#ifndef MEDIA_MOJO_SERVICES_MEDIA_METRICS_PROVIDER_H_
#define MEDIA_MOJO_SERVICES_MEDIA_METRICS_PROVIDER_H_
#include <stdint.h>
#include "media/base/pipeline_status.h"
#include "media/mojo/interfaces/media_metrics_provider.mojom.h"
#include "media/mojo/services/media_mojo_export.h"
#include "url/origin.h"
namespace media {
class VideoDecodePerfHistory;
// See mojom::MediaMetricsProvider for documentation.
class MEDIA_MOJO_EXPORT MediaMetricsProvider
: public mojom::MediaMetricsProvider {
public:
explicit MediaMetricsProvider(VideoDecodePerfHistory* perf_history);
~MediaMetricsProvider() override;
// Creates a MediaMetricsProvider, |perf_history| may be nullptr if perf
// history database recording is disabled.
static void Create(VideoDecodePerfHistory* perf_history,
mojom::MediaMetricsProviderRequest request);
private:
// mojom::MediaMetricsProvider implementation:
void Initialize(bool is_mse,
bool is_top_frame,
const url::Origin& untrusted_top_origin) override;
void OnError(PipelineStatus status) override;
void AcquireWatchTimeRecorder(
mojom::PlaybackPropertiesPtr properties,
mojom::WatchTimeRecorderRequest request) override;
void AcquireVideoDecodeStatsRecorder(
mojom::VideoDecodeStatsRecorderRequest request) override;
// Session unique ID which maps to a given WebMediaPlayerImpl instances. Used
// to coordinate multiply logged events with a singly logged metric.
const uint64_t player_id_;
PipelineStatus pipeline_status_ = PIPELINE_OK;
// The values below are only set if |initialized_| is true.
bool initialized_ = false;
bool is_mse_;
bool is_top_frame_;
url::Origin untrusted_top_origin_;
VideoDecodePerfHistory* const perf_history_;
DISALLOW_COPY_AND_ASSIGN(MediaMetricsProvider);
};
} // namespace media
#endif // MEDIA_MOJO_SERVICES_MEDIA_METRICS_PROVIDER_H_
| [
"rdeshm0@aptvm070-6.apt.emulab.net"
] | rdeshm0@aptvm070-6.apt.emulab.net |
7909550ab4494ccb82cfa31c5820fc585dc4e953 | 28bd9e80770ef7b97cbc73377b296096ed2e8f40 | /gst/libraries/chain/include/gstio/chain/reversible_block_object.hpp | d93a18399d41ae69f1b207a56d77e2fd9b5b93ff | [
"Apache-2.0",
"BSD-3-Clause",
"MIT"
] | permissive | lowhumour/gst | f0f325f33b2d663fb0f38c30406549cfe6a13b69 | 59f141d56902d71f54040e3fd826042ada4eb5a0 | refs/heads/master | 2022-03-24T21:12:03.558840 | 2019-09-18T04:04:49 | 2019-09-18T04:04:49 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,596 | hpp |
/**
* @file
* @copyright defined in gst/LICENSE.txt
*/
#pragma once
#include <gstio/chain/types.hpp>
#include <gstio/chain/authority.hpp>
#include <gstio/chain/block_timestamp.hpp>
#include <gstio/chain/contract_types.hpp>
#include "multi_index_includes.hpp"
namespace gstio { namespace chain {
class reversible_block_object : public chainbase::object<reversible_block_object_type, reversible_block_object> {
OBJECT_CTOR(reversible_block_object,(packedblock) )
id_type id;
uint32_t blocknum = 0;
shared_string packedblock;
void set_block( const signed_block_ptr& b ) {
packedblock.resize( fc::raw::pack_size( *b ) );
fc::datastream<char*> ds( packedblock.data(), packedblock.size() );
fc::raw::pack( ds, *b );
}
signed_block_ptr get_block()const {
fc::datastream<const char*> ds( packedblock.data(), packedblock.size() );
auto result = std::make_shared<signed_block>();
fc::raw::unpack( ds, *result );
return result;
}
};
struct by_num;
using reversible_block_index = chainbase::shared_multi_index_container<
reversible_block_object,
indexed_by<
ordered_unique<tag<by_id>, member<reversible_block_object, reversible_block_object::id_type, &reversible_block_object::id>>,
ordered_unique<tag<by_num>, member<reversible_block_object, uint32_t, &reversible_block_object::blocknum>>
>
>;
} } // gstio::chain
CHAINBASE_SET_INDEX_TYPE(gstio::chain::reversible_block_object, gstio::chain::reversible_block_index)
| [
"gst1019@hotmail.com"
] | gst1019@hotmail.com |
c4a43da33df4fce14b1921a79a0a37f59302aaa9 | 5b506a4222bed34ed09f2ffbe71024a7f45f8c26 | /codeforces/1000/69A.cpp | f8482895fdfe1bc55e50452538f076d824db1be4 | [
"Apache-2.0"
] | permissive | bymi15/CP | 0a18191b1f151084b9b213faed945c48eadef154 | 5bfd910e70103fe9e8e7989e9462ac35bc8411fd | refs/heads/master | 2022-12-15T16:39:55.013072 | 2020-09-05T02:57:38 | 2020-09-05T02:57:38 | 288,265,263 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 366 | cpp | #include <bits/stdc++.h>
using namespace std;
int sum[3] = {0, 0, 0};
int main(){
int N;
cin >> N;
while(N--){
int acc[3];
cin >> acc[0] >> acc[1] >> acc[2];
sum[0] += acc[0];
sum[1] += acc[1];
sum[2] += acc[2];
}
for(int n : sum){
if(n != 0){
cout << "NO";
return 0;
}
}
cout << "YES";
} | [
"bymi15@yahoo.com"
] | bymi15@yahoo.com |
a7f1332c8989aae9e13786677e557a4ed28e6c4e | f8ea7e042a62404b1f420a7cc84b7c3167191f57 | /SimLib/ExceptionSignal.cpp | 22e84de55cc9bb984e8e63dcfdaedc17a569dfff | [] | no_license | alexbikfalvi/SimNet | 0a22d8bd0668e86bf06bfb72d123767f24248b48 | 20b24e15647db5467a1187f8be5392570023d670 | refs/heads/master | 2016-09-15T17:50:23.459189 | 2013-07-05T14:41:18 | 2013-07-05T14:41:18 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,240 | cpp | /*
* Copyright (C) 2011 Alex Bikfalvi
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "Headers.h"
#include "ExceptionSignal.h"
namespace SimLib
{
ExceptionSignal::ExceptionSignal(
const char* file,
uint line,
const char* format,
...
) throw() : Exception(file, line)
{
// Variable arguments
va_list args;
va_start(args, format);
#if defined(_MSC_VER)
vsprintf_s(this->message, EXCEPTION_MESSAGE_SIZE*sizeof(char), format, args);
#else
vsnprintf(this->message, EXCEPTION_MESSAGE_SIZE, format, args);
#endif
va_end(args);
}
}
| [
"alex@bikfalvi.com"
] | alex@bikfalvi.com |
7ad80c95b78a195e2cbe4feb7df794c35d554fca | f331753d679f7ac16596bef596ddc7f2d5ee1de6 | /util/src/util_aes.cc | b05e42f0ca54ccbffd46f65f62089c652f7f532e | [] | no_license | syfchao/quick-start-app | 96e1ef72d8b49e34a61b5620c51970db1980d480 | 11a4da6b9cb07edf8a4c0cf0b8b70f938d73982e | refs/heads/master | 2022-12-02T02:39:15.164700 | 2020-08-11T12:26:28 | 2020-08-11T12:26:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 19,231 | cc | /*
This is an implementation of the AES128 algorithm, specifically ECB and CBC mode.
The implementation is verified against the test vectors in:
National Institute of Standards and Technology Special Publication 800-38A 2001 ED
ECB-AES128
----------
plain-text:
6bc1bee22e409f96e93d7e117393172a
ae2d8a571e03ac9c9eb76fac45af8e51
30c81c46a35ce411e5fbc1191a0a52ef
f69f2445df4f9b17ad2b417be66c3710
key:
2b7e151628aed2a6abf7158809cf4f3c
resulting cipher
3ad77bb40d7a3660a89ecaf32466ef97
f5d3d58503b9699de785895a96fdbaaf
43b1cd7f598ece23881b00e3ed030688
7b0c785e27e8ad3f8223207104725dd4
NOTE: String length must be evenly divisible by 16byte (str_len % 16 == 0)
You should pad the end of the string with zeros if this is not the case.
*/
/*****************************************************************************/
/* Includes: */
/*****************************************************************************/
#include <stdint.h>
#include <string.h> // CBC mode, for memset
#include <util_aes.h>
#include <util_md5.h>
#include <util_log.h>
/*****************************************************************************/
/* Defines: */
/*****************************************************************************/
// The number of columns comprising a state in AES. This is a constant in AES. Value=4
#define Nb 4
// The number of 32 bit words in a key.
#define Nk 4
// key length in bytes [128 bit]
#define BLOCK_LEN 16
// The number of rounds in AES do_aes_cipher.
#define Nr 10
// jcallan@github points out that declaring multiply as a function
// reduces code size considerably with the Keil ARM compiler.
// See this link for more information: https://github.com/kokke/tiny-AES128-C/pull/3
#ifndef MULTIPLY_AS_A_FUNCTION
#define MULTIPLY_AS_A_FUNCTION 0
#endif
const uint8_t st_iv[] = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87, 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x5e, 0xaf };
/*****************************************************************************/
/* Private variables: */
/*****************************************************************************/
// state - array holding the intermediate results during decryption.
typedef uint8_t state_t[4][4];
//static state_t* state;
// The key input to the AES Program
// The lookup-tables are marked const so they can be placed in read-only storage instead of RAM
// The numbers below can be computed dynamically trading ROM for RAM -
// This can be useful in (embedded) bootloader applications, where ROM is often limited.
static const uint8_t sbox[256] = {
//0 1 2 3 4 5 6 7 8 9 A B C D E F
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,
0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,
0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 };
static const uint8_t rsbox[256] =
{ 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb,
0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb,
0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e,
0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25,
0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92,
0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84,
0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06,
0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b,
0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73,
0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e,
0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b,
0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4,
0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f,
0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef,
0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61,
0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d };
// The round constant word array, rcon[i], contains the values given by
// x to th e power (i-1) being powers of x (x is denoted as {02}) in the field GF(2^8)
// Note that i starts at 1, not 0).
static const uint8_t rcon[255] = {
0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a,
0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39,
0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a,
0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8,
0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef,
0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc,
0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b,
0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3,
0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94,
0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20,
0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35,
0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f,
0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04,
0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63,
0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd,
0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb };
/*****************************************************************************/
/* Private functions: */
/*****************************************************************************/
static uint8_t getSBoxValue(uint8_t num)
{
return sbox[num];
}
static uint8_t getSBoxInvert(uint8_t num)
{
return rsbox[num];
}
// This function produces Nb(Nr+1) round keys. The round keys are used in each round to decrypt the states.
static void gen_round_key(const uint8_t* key, uint8_t* round_key)
{
if(!key){
return;
}
uint32_t i, j, k;
uint8_t tempa[4]; // Used for the column/row operations
// The first round key is the key itself.
for(i = 0; i < Nk; ++i)
{
round_key[(i * 4) + 0] = key[(i * 4) + 0];
round_key[(i * 4) + 1] = key[(i * 4) + 1];
round_key[(i * 4) + 2] = key[(i * 4) + 2];
round_key[(i * 4) + 3] = key[(i * 4) + 3];
}
// All other round keys are found from the previous round keys.
for(; (i < (Nb * (Nr + 1))); ++i)
{
for(j = 0; j < 4; ++j)
{
tempa[j]=round_key[(i-1) * 4 + j];
}
if (i % Nk == 0)
{
// This function rotates the 4 bytes in a word to the left once.
// [a0,a1,a2,a3] becomes [a1,a2,a3,a0]
// Function RotWord()
{
k = tempa[0];
tempa[0] = tempa[1];
tempa[1] = tempa[2];
tempa[2] = tempa[3];
tempa[3] = k;
}
// SubWord() is a function that takes a four-byte input word and
// applies the S-box to each of the four bytes to produce an output word.
// Function Subword()
{
tempa[0] = getSBoxValue(tempa[0]);
tempa[1] = getSBoxValue(tempa[1]);
tempa[2] = getSBoxValue(tempa[2]);
tempa[3] = getSBoxValue(tempa[3]);
}
tempa[0] = tempa[0] ^ rcon[i/Nk];
}
else if (Nk > 6 && i % Nk == 4)
{
// Function Subword()
{
tempa[0] = getSBoxValue(tempa[0]);
tempa[1] = getSBoxValue(tempa[1]);
tempa[2] = getSBoxValue(tempa[2]);
tempa[3] = getSBoxValue(tempa[3]);
}
}
round_key[i * 4 + 0] = round_key[(i - Nk) * 4 + 0] ^ tempa[0];
round_key[i * 4 + 1] = round_key[(i - Nk) * 4 + 1] ^ tempa[1];
round_key[i * 4 + 2] = round_key[(i - Nk) * 4 + 2] ^ tempa[2];
round_key[i * 4 + 3] = round_key[(i - Nk) * 4 + 3] ^ tempa[3];
}
}
// This function adds the round key to state.
// The round key is added to the state by an XOR function.
static void add_round_key(uint8_t round, uint8_t* round_key, state_t* state)
{
uint8_t i,j;
for(i=0;i<4;++i)
{
for(j = 0; j < 4; ++j)
{
(*state)[i][j] ^= round_key[round * Nb * 4 + i * Nb + j];
}
}
}
// The sub_bytes Function Substitutes the values in the
// state matrix with values in an S-box.
static void sub_bytes(state_t* state)
{
uint8_t i, j;
for(i = 0; i < 4; ++i)
{
for(j = 0; j < 4; ++j)
{
(*state)[j][i] = getSBoxValue((*state)[j][i]);
}
}
}
// The shift_rows() function shifts the rows in the state to the left.
// Each row is shifted with different offset.
// Offset = Row number. So the first row is not shifted.
static void shift_rows(state_t* state)
{
uint8_t temp;
// Rotate first row 1 columns to left
temp = (*state)[0][1];
(*state)[0][1] = (*state)[1][1];
(*state)[1][1] = (*state)[2][1];
(*state)[2][1] = (*state)[3][1];
(*state)[3][1] = temp;
// Rotate second row 2 columns to left
temp = (*state)[0][2];
(*state)[0][2] = (*state)[2][2];
(*state)[2][2] = temp;
temp = (*state)[1][2];
(*state)[1][2] = (*state)[3][2];
(*state)[3][2] = temp;
// Rotate third row 3 columns to left
temp = (*state)[0][3];
(*state)[0][3] = (*state)[3][3];
(*state)[3][3] = (*state)[2][3];
(*state)[2][3] = (*state)[1][3];
(*state)[1][3] = temp;
}
static uint8_t xtime(uint8_t x)
{
return ((x<<1) ^ (((x>>7) & 1) * 0x1b));
}
// mix_columns function mixes the columns of the state matrix
static void mix_columns(state_t* state)
{
uint8_t i;
uint8_t Tmp,Tm,t;
for(i = 0; i < 4; ++i)
{
t = (*state)[i][0];
Tmp = (*state)[i][0] ^ (*state)[i][1] ^ (*state)[i][2] ^ (*state)[i][3] ;
Tm = (*state)[i][0] ^ (*state)[i][1] ; Tm = xtime(Tm); (*state)[i][0] ^= Tm ^ Tmp ;
Tm = (*state)[i][1] ^ (*state)[i][2] ; Tm = xtime(Tm); (*state)[i][1] ^= Tm ^ Tmp ;
Tm = (*state)[i][2] ^ (*state)[i][3] ; Tm = xtime(Tm); (*state)[i][2] ^= Tm ^ Tmp ;
Tm = (*state)[i][3] ^ t ; Tm = xtime(Tm); (*state)[i][3] ^= Tm ^ Tmp ;
}
}
// multiply is used to multiply numbers in the field GF(2^8)
#if MULTIPLY_AS_A_FUNCTION
static uint8_t multiply(uint8_t x, uint8_t y)
{
return (((y & 1) * x) ^
((y>>1 & 1) * xtime(x)) ^
((y>>2 & 1) * xtime(xtime(x))) ^
((y>>3 & 1) * xtime(xtime(xtime(x)))) ^
((y>>4 & 1) * xtime(xtime(xtime(xtime(x))))));
}
#else
#define multiply(x, y) \
( ((y & 1) * x) ^ \
((y>>1 & 1) * xtime(x)) ^ \
((y>>2 & 1) * xtime(xtime(x))) ^ \
((y>>3 & 1) * xtime(xtime(xtime(x)))) ^ \
((y>>4 & 1) * xtime(xtime(xtime(xtime(x)))))) \
#endif
// mix_columns function mixes the columns of the state matrix.
// The method used to multiply may be difficult to understand for the inexperienced.
// Please use the references to gain more information.
static void invert_mix_columns(state_t* state)
{
int i;
uint8_t a,b,c,d;
for(i=0;i<4;++i)
{
a = (*state)[i][0];
b = (*state)[i][1];
c = (*state)[i][2];
d = (*state)[i][3];
(*state)[i][0] = multiply(a, 0x0e) ^ multiply(b, 0x0b) ^ multiply(c, 0x0d) ^ multiply(d, 0x09);
(*state)[i][1] = multiply(a, 0x09) ^ multiply(b, 0x0e) ^ multiply(c, 0x0b) ^ multiply(d, 0x0d);
(*state)[i][2] = multiply(a, 0x0d) ^ multiply(b, 0x09) ^ multiply(c, 0x0e) ^ multiply(d, 0x0b);
(*state)[i][3] = multiply(a, 0x0b) ^ multiply(b, 0x0d) ^ multiply(c, 0x09) ^ multiply(d, 0x0e);
}
}
// The sub_bytes Function Substitutes the values in the
// state matrix with values in an S-box.
static void invert_sub_bytes(state_t* state)
{
uint8_t i,j;
for(i=0;i<4;++i)
{
for(j=0;j<4;++j)
{
(*state)[j][i] = getSBoxInvert((*state)[j][i]);
}
}
}
static void invert_shift_rows(state_t* state)
{
uint8_t temp;
// Rotate first row 1 columns to right
temp=(*state)[3][1];
(*state)[3][1]=(*state)[2][1];
(*state)[2][1]=(*state)[1][1];
(*state)[1][1]=(*state)[0][1];
(*state)[0][1]=temp;
// Rotate second row 2 columns to right
temp=(*state)[0][2];
(*state)[0][2]=(*state)[2][2];
(*state)[2][2]=temp;
temp=(*state)[1][2];
(*state)[1][2]=(*state)[3][2];
(*state)[3][2]=temp;
// Rotate third row 3 columns to right
temp=(*state)[0][3];
(*state)[0][3]=(*state)[1][3];
(*state)[1][3]=(*state)[2][3];
(*state)[2][3]=(*state)[3][3];
(*state)[3][3]=temp;
}
// do_aes_cipher is the main function that encrypts the PlainText.
static void do_aes_cipher(uint8_t* round_key, state_t* state)
{
uint8_t round = 0;
// Add the First round key to the state before starting the rounds.
add_round_key(0, round_key, state);
// There will be Nr rounds.
// The first Nr-1 rounds are identical.
// These Nr-1 rounds are executed in the loop below.
for(round = 1; round < Nr; ++round)
{
sub_bytes(state);
shift_rows(state);
mix_columns(state);
add_round_key(round, round_key, state);
}
// The last round is given below.
// The mix_columns function is not here in the last round.
sub_bytes(state);
shift_rows(state);
add_round_key(Nr, round_key, state);
}
static void invert_aes_cipher(uint8_t* round_key, state_t* state)
{
uint8_t round=0;
// Add the First round key to the state before starting the rounds.
add_round_key(Nr, round_key, state);
// There will be Nr rounds.
// The first Nr-1 rounds are identical.
// These Nr-1 rounds are executed in the loop below.
for(round=Nr-1;round>0;round--)
{
invert_shift_rows(state);
invert_sub_bytes(state);
add_round_key(round, round_key, state);
invert_mix_columns(state);
}
// The last round is given below.
// The mix_columns function is not here in the last round.
invert_shift_rows(state);
invert_sub_bytes(state);
add_round_key(0, round_key, state);
}
/*****************************************************************************/
/* Public functions: */
/*****************************************************************************/
static void xor_with_iv(uint8_t* buf, const uint8_t* iv)
{
uint8_t i;
for(i = 0; i < BLOCK_LEN; ++i)
{
buf[i] ^= iv[i];
}
}
//void AES128_CBC_encrypt_buffer(uint8_t* output, uint8_t* input, uint32_t length, const uint8_t* key, const uint8_t* iv)
#define get_enc_len(length) ((length/BLOCK_LEN+1)*BLOCK_LEN)
int util_aes_encrypt(const char* skey, const char* orig_stream, size_t length, char* enc_buff, size_t* enc_len)
{
if(NULL == skey || NULL == orig_stream || NULL == enc_buff || NULL == enc_len){
LOG_ERR("invalid param");
return -1;
}
if(*enc_len < get_enc_len(length)){
LOG_ERR("enc length is too small. %llu:%llu", *enc_len, get_enc_len(length));
return -1;
}
uint8_t remainders = length % BLOCK_LEN;/* Remaining bytes in the last non-full block */
*enc_len = get_enc_len(length);
memcpy(enc_buff, orig_stream, length);
for(size_t i = length; i < *enc_len; ++i){
*((uint8_t*)(enc_buff+i)) = BLOCK_LEN - remainders;
}
unsigned char md5sum[BLOCK_LEN] = {0};
md5_sum(skey, strlen(skey), md5sum);
uint8_t round_key[176] = {0};
gen_round_key(md5sum, round_key);
state_t* state = NULL;
uint8_t* output = (uint8_t*)enc_buff;
const uint8_t* iv = st_iv;
for(size_t i = 0; i < *enc_len; i += BLOCK_LEN)
{
xor_with_iv(output, iv);
state = (state_t*)output;
do_aes_cipher(round_key, state);
iv = output;
output += BLOCK_LEN;
}
return 0;
}
//void AES128_CBC_decrypt_buffer(uint8_t* output, uint8_t* input, uint32_t length, const uint8_t* key, const uint8_t* iv)
int util_aes_decrypt(const char* skey, const char* enc_stream, size_t length, char* dec_buff, size_t* dec_len)
{
if(NULL == skey || NULL == enc_stream || NULL == dec_buff || NULL == dec_len){
LOG_ERR("invalid params");
return -1;
}
if(length % BLOCK_LEN){
LOG_ERR("invalid length:%llu", length);
return -2;
}
if(length > *dec_len){
LOG_ERR("dec len is less than enc len:%llu:%llu", length, *dec_len);
return -3;
}
unsigned char md5sum[BLOCK_LEN] = {0};
md5_sum(skey, strlen(skey), md5sum);
uint8_t round_key[176] = {0};
gen_round_key(md5sum, round_key);
memcpy(dec_buff, enc_stream, length);
const uint8_t* iv = st_iv;
uint8_t* input = (uint8_t*)enc_stream;
uint8_t* output = (uint8_t*)dec_buff;
state_t* state = NULL;
for(size_t i = 0; i < length; i += BLOCK_LEN)
{
state = (state_t*)output;
invert_aes_cipher(round_key, state);
xor_with_iv(output, iv);
iv = input;
input += BLOCK_LEN;
output += BLOCK_LEN;
}
uint8_t padding_size = (uint8_t)(dec_buff[length-1]);
if(padding_size > 16 || padding_size > length){
LOG_ERR("invalid padding size:%u:%llu", padding_size, length);
return -4;
}
for(uint8_t i = 1; i <= padding_size; ++i){
if((uint8_t)(dec_buff[length-i]) != padding_size){
LOG_ERR("not a valid encrypted buff. padding_size:%u", padding_size);
return -5;
}
}
*dec_len = length - padding_size;
return 0;
}
| [
"duanlijun@bilibili.com"
] | duanlijun@bilibili.com |
a24d8c8eaf082f39bfef8fe55a1fd79a1d4c45be | 9579ab0d960ee4b93e01d34e3f925935b1b9b607 | /src/mindroid/net/Inet4Address.h | 46913f92b9fa9b42b9cc85aeab9c3f661e625259 | [] | no_license | iambanh2/Mindroid.cpp | b756f7c0e134a9fb472ffd581c8e173e7e031521 | 9b0269381d23c1c9dc87cc2b350c9ee310dca44d | refs/heads/master | 2020-04-15T04:43:11.339512 | 2018-10-29T17:30:52 | 2018-10-29T17:30:52 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,537 | h | /*
* Copyright (C) 2017 E.S.R. Labs
*
* 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 MINDROID_NET_INET4ADDRESS_H_
#define MINDROID_NET_INET4ADDRESS_H_
#include <mindroid/net/InetAddress.h>
#include <mindroid/lang/String.h>
#include <arpa/inet.h>
namespace mindroid {
class ByteArray;
class DatagramSocket;
class Inet4Address :
public InetAddress {
public:
static sp<InetAddress> ANY;
static sp<InetAddress> ALL;
static sp<InetAddress> LOOPBACK;
virtual ~Inet4Address() = default;
private:
Inet4Address() = default;
Inet4Address(const sp<ByteArray>& ipAddress, const char* hostName) :
InetAddress(AF_INET, ipAddress, hostName) {
}
Inet4Address(const sp<ByteArray>& ipAddress, const sp<String>& hostName) :
InetAddress(AF_INET, ipAddress, hostName) {
}
friend class InetAddress;
friend class ServerSocket;
friend class Socket;
friend class DatagramSocket;
};
} /* namespace mindroid */
#endif /* MINDROID_NET_INET4ADDRESS_H_ */
| [
"daniel.himmelein@esrlabs.com"
] | daniel.himmelein@esrlabs.com |
51fbb0352cd5b40e3218e17c525c34c765d43a40 | 4b5a6c207886eb664889b8d28bef8724dd26fa63 | /RecoTools/interface/CompositePtrCandidateTMEtProducer.h | e0fbe73a3035c7fb438f5906f91b865fdafeeda2 | [] | no_license | iross/UWAnalysis | 2b5d2ada9cfdc28e2c00f97a04767b4e283a04f1 | 5b3d21ddf2cb8557fd87b7e4f449496fb1f41479 | refs/heads/master | 2021-01-23T07:15:38.950859 | 2013-07-24T20:55:03 | 2013-07-24T20:55:03 | 4,274,658 | 1 | 0 | null | 2013-03-01T19:46:28 | 2012-05-09T17:51:09 | Python | UTF-8 | C++ | false | false | 4,606 | h | #ifndef UWAnalysis_RecoTools_CompositePtrCandidateTMEtProducer_h
#define UWAnalysis_RecoTools_CompositePtrCandidateTMEtProducer_h
/** \class CompositePtrCandidateTMEtProducer
*
* Produce combinations of visible tau decay products and missing transverse momentum
* (representing the undetected momentum carried away
* the neutrino produced in a W --> tau nu decay and the neutrinos produced in the tau decay)
*
* \authors Christian Veelken
*
* \version $Revision: 1.4 $
*
* $Id: CompositePtrCandidateTMEtProducer.h,v 1.4 2010/11/20 00:13:32 bachtis Exp $
*
*/
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "DataFormats/Common/interface/View.h"
#include "DataFormats/Math/interface/deltaR.h"
#include "UWAnalysis/RecoTools/interface/FetchCollection.h"
#include "UWAnalysis/DataFormats/interface/CompositePtrCandidateTMEt.h"
#include "UWAnalysis/DataFormats/interface/CompositePtrCandidateTMEtFwd.h"
#include "UWAnalysis/RecoTools/interface/CompositePtrCandidateTMEtAlgorithm.h"
#include <string>
template<typename T>
class CompositePtrCandidateTMEtProducer : public edm::EDProducer
{
typedef edm::Ptr<T> TPtr;
typedef edm::Ptr<reco::Candidate> METPtr;
typedef edm::Ptr<pat::Jet> JetPtr;
typedef std::vector<edm::Ptr<pat::Jet> > JetPtrVector;
typedef std::vector<CompositePtrCandidateTMEt<T> > CompositePtrCandidateCollection;
public:
explicit CompositePtrCandidateTMEtProducer(const edm::ParameterSet& cfg)
: algorithm_()
{
srcVisDecayProducts_ = cfg.getParameter<edm::InputTag>("srcLeptons");
srcJets_ = cfg.getParameter<edm::InputTag>("srcJets");
srcMET_ = cfg.getParameter<edm::InputTag>("srcMET");
verbosity_ = cfg.getUntrackedParameter<int>("verbosity", 0);
produces<CompositePtrCandidateCollection>("");
}
~CompositePtrCandidateTMEtProducer() {}
void produce(edm::Event& evt, const edm::EventSetup& es)
{
typedef edm::View<T> TView;
edm::Handle<TView> visDecayProductsCollection;
bool gotVisProducts = evt.getByLabel(srcVisDecayProducts_,visDecayProductsCollection);
METPtr metPtr;
edm::Handle<edm::View<reco::Candidate> > metCollection;
bool gotMET = evt.getByLabel(srcMET_,metCollection);
edm::Handle<edm::View<pat::Jet> > jetCollection;
evt.getByLabel(srcJets_,jetCollection);
JetPtrVector pfJets;
for(unsigned int i=0;i<jetCollection->size();++i)
pfJets.push_back(jetCollection->ptrAt(i));
if(gotVisProducts&&gotMET) {
//--- check that there is exactly one MET object in the event
// (missing transverse momentum is an **event level** quantity)
if ( metCollection->size() >0 ) {
metPtr = metCollection->ptrAt(0);
} else {
edm::LogError ("produce") << " Found " << metCollection->size() << " MET objects in collection = " << srcMET_ << ","
<< " --> CompositePtrCandidateTMEt collection will NOT be produced !!";
std::auto_ptr<CompositePtrCandidateCollection> emptyCompositePtrCandidateCollection(new CompositePtrCandidateCollection());
evt.put(emptyCompositePtrCandidateCollection);
return;
}
std::auto_ptr<CompositePtrCandidateCollection> compositePtrCandidateCollection(new CompositePtrCandidateCollection());
for ( unsigned idxVisDecayProducts = 0, numVisDecayProducts = visDecayProductsCollection->size();
idxVisDecayProducts < numVisDecayProducts; ++idxVisDecayProducts ) {
TPtr visDecayProductsPtr = visDecayProductsCollection->ptrAt(idxVisDecayProducts);
CompositePtrCandidateTMEt<T> compositePtrCandidate =
algorithm_.buildCompositePtrCandidate(visDecayProductsPtr, metPtr,pfJets,*visDecayProductsCollection);
compositePtrCandidateCollection->push_back(compositePtrCandidate);
}
//--- add the collection of reconstructed CompositePtrCandidateTMEts to the event
evt.put(compositePtrCandidateCollection);
}
else
{
std::auto_ptr<CompositePtrCandidateCollection> emptyCompositePtrCandidateCollection(new CompositePtrCandidateCollection());
evt.put(emptyCompositePtrCandidateCollection);
}
}
private:
CompositePtrCandidateTMEtAlgorithm<T> algorithm_;
edm::InputTag srcVisDecayProducts_;
edm::InputTag srcMET_;
edm::InputTag srcJets_;
int verbosity_;
};
#endif
| [
"iross@login06.hep.wisc.edu"
] | iross@login06.hep.wisc.edu |
2c20aeef35e9195d3d8bf034362e37a7972394c0 | bf07d3f779c7453fb7ce128286bc1486b6691ac4 | /src/EEPROMAnything.h | d16a6d3acac5f335513a9918da8c70b86d9c1cee | [
"MIT"
] | permissive | gen1nya/esp8266-loyalty-button | b3b6974f43d3ea4a7f5b70d163a518b6c839005d | 73a1ba025a098b0896bb0d90f554c81f6f5ffc40 | refs/heads/master | 2021-04-30T14:43:12.284921 | 2018-02-13T12:10:36 | 2018-02-13T12:10:36 | 121,223,295 | 0 | 1 | MIT | 2018-02-13T12:10:37 | 2018-02-12T08:58:40 | null | UTF-8 | C++ | false | false | 491 | h | #include <EEPROM.h>
#include <Arduino.h>
template <class T> int EEPROM_writeAnything(int ee, const T& value){
const byte* p = (const byte*)(const void*)&value;
unsigned int i;
for (i = 0; i < sizeof(value); i++)
EEPROM.write(ee++, *p++);
return i;
}
template <class T> int EEPROM_readAnything(int ee, T& value){
byte* p = (byte*)(void*)&value;
unsigned int i;
for (i = 0; i < sizeof(value); i++)
*p++ = EEPROM.read(ee++);
return i;
}
| [
"noreply@github.com"
] | noreply@github.com |
010ebf39ee6f105ffca098b4d632057717bf190e | 3ddb02e1671f4f43cb1161cc2ceaa5befa5db87c | /archive.CS236/lab1/TokenType.cpp | a3dae730e442e38e2ac71f3922182b1941226b53 | [] | no_license | kjdevocht/Archive | 931e9982ab89a517047465772cadd7b9441385c0 | f73072eb29dd41e2f40bb3abdb9cc7f32bde61cb | refs/heads/master | 2021-05-01T15:27:58.986705 | 2015-07-26T07:03:29 | 2015-07-26T07:03:29 | 22,653,484 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,138 | cpp | #include "TokenType.h"
using namespace std;
string TokenTypeToString(TokenType tokenType){
string result = "";
switch(tokenType){
case COMMA: result = "COMMA"; break;
case PERIOD: result = "PERIOD"; break;
case Q_MARK: result = "Q_MARK"; break;
case LEFT_PAREN: result = "LEFT_PAREN"; break;
case RIGHT_PAREN: result = "RIGHT_PAREN"; break;
case COLON: result = "COLON"; break;
case COLON_DASH: result = "COLON_DASH"; break;
case MULTIPLY: result = "MULTIPLY"; break;
case ADD: result = "ADD"; break;
case SCHEMES: result = "SCHEMES"; break;
case FACTS: result = "FACTS"; break;
case RULES: result = "RULES"; break;
case QUERIES: result = "QUERIES"; break;
case ID: result = "ID"; break;
case STRING: result = "STRING"; break;
case COMMENT: result = "COMMENT"; break;
case UNDEFINED: result = "UNDEFINED"; break;
case END: result = "EOF"; break;
case NUL: result = "NUL"; break;
}
return result;
};
| [
"kjdevocht@gmail.com"
] | kjdevocht@gmail.com |
2c94ebb08c4d3f006684ca624ba9c504035f9e98 | d0c44dd3da2ef8c0ff835982a437946cbf4d2940 | /cmake-build-debug/programs_tiling/function14087/function14087_schedule_12/function14087_schedule_12_wrapper.cpp | 2289936f5a0b33795902da33e75235ec21aa92f4 | [] | no_license | IsraMekki/tiramisu_code_generator | 8b3f1d63cff62ba9f5242c019058d5a3119184a3 | 5a259d8e244af452e5301126683fa4320c2047a3 | refs/heads/master | 2020-04-29T17:27:57.987172 | 2019-04-23T16:50:32 | 2019-04-23T16:50:32 | 176,297,755 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 927 | cpp | #include "Halide.h"
#include "function14087_schedule_12_wrapper.h"
#include "tiramisu/utils.h"
#include <cstdlib>
#include <iostream>
#include <time.h>
#include <fstream>
#include <chrono>
#define MAX_RAND 200
int main(int, char **){
Halide::Buffer<int32_t> buf00(64, 8192);
Halide::Buffer<int32_t> buf0(64, 64, 8192);
init_buffer(buf0, (int32_t)0);
auto t1 = std::chrono::high_resolution_clock::now();
function14087_schedule_12(buf00.raw_buffer(), buf0.raw_buffer());
auto t2 = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> diff = t2 - t1;
std::ofstream exec_times_file;
exec_times_file.open("../data/programs/function14087/function14087_schedule_12/exec_times.txt", std::ios_base::app);
if (exec_times_file.is_open()){
exec_times_file << diff.count() * 1000000 << "us" <<std::endl;
exec_times_file.close();
}
return 0;
} | [
"ei_mekki@esi.dz"
] | ei_mekki@esi.dz |
1b35c2a333194ee4df826759963f429472d88a36 | c776476e9d06b3779d744641e758ac3a2c15cddc | /examples/litmus/c/run-scripts/tmp_1/R+dmb.st+rfi-ctrl-ctrlisb.c.cbmc.cpp | 9ea184accf0e5408302ab722ff8e5d71607c9413 | [] | no_license | ashutosh0gupta/llvm_bmc | aaac7961c723ba6f7ffd77a39559e0e52432eade | 0287c4fb180244e6b3c599a9902507f05c8a7234 | refs/heads/master | 2023-08-02T17:14:06.178723 | 2023-07-31T10:46:53 | 2023-07-31T10:46:53 | 143,100,825 | 3 | 4 | null | 2023-05-25T05:50:55 | 2018-08-01T03:47:00 | C++ | UTF-8 | C++ | false | false | 36,886 | cpp | // 3:atom_1_X2_2:1
// 0:vars:3
// 4:atom_1_X5_0:1
// 5:thr0:1
// 6:thr1:1
#define ADDRSIZE 7
#define NPROC 3
#define NCONTEXT 1
#define ASSUME(stmt) __CPROVER_assume(stmt)
#define ASSERT(stmt) __CPROVER_assert(stmt, "error")
#define max(a,b) (a>b?a:b)
char __get_rng();
char get_rng( char from, char to ) {
char ret = __get_rng();
ASSUME(ret >= from && ret <= to);
return ret;
}
char get_rng_th( char from, char to ) {
char ret = __get_rng();
ASSUME(ret >= from && ret <= to);
return ret;
}
int main(int argc, char **argv) {
// declare arrays for intial value version in contexts
int meminit_[ADDRSIZE*NCONTEXT];
#define meminit(x,k) meminit_[(x)*NCONTEXT+k]
int coinit_[ADDRSIZE*NCONTEXT];
#define coinit(x,k) coinit_[(x)*NCONTEXT+k]
int deltainit_[ADDRSIZE*NCONTEXT];
#define deltainit(x,k) deltainit_[(x)*NCONTEXT+k]
// declare arrays for running value version in contexts
int mem_[ADDRSIZE*NCONTEXT];
#define mem(x,k) mem_[(x)*NCONTEXT+k]
int co_[ADDRSIZE*NCONTEXT];
#define co(x,k) co_[(x)*NCONTEXT+k]
int delta_[ADDRSIZE*NCONTEXT];
#define delta(x,k) delta_[(x)*NCONTEXT+k]
// declare arrays for local buffer and observed writes
int buff_[NPROC*ADDRSIZE];
#define buff(x,k) buff_[(x)*ADDRSIZE+k]
int pw_[NPROC*ADDRSIZE];
#define pw(x,k) pw_[(x)*ADDRSIZE+k]
// declare arrays for context stamps
char cr_[NPROC*ADDRSIZE];
#define cr(x,k) cr_[(x)*ADDRSIZE+k]
char iw_[NPROC*ADDRSIZE];
#define iw(x,k) iw_[(x)*ADDRSIZE+k]
char cw_[NPROC*ADDRSIZE];
#define cw(x,k) cw_[(x)*ADDRSIZE+k]
char cx_[NPROC*ADDRSIZE];
#define cx(x,k) cx_[(x)*ADDRSIZE+k]
char is_[NPROC*ADDRSIZE];
#define is(x,k) is_[(x)*ADDRSIZE+k]
char cs_[NPROC*ADDRSIZE];
#define cs(x,k) cs_[(x)*ADDRSIZE+k]
char crmax_[NPROC*ADDRSIZE];
#define crmax(x,k) crmax_[(x)*ADDRSIZE+k]
char sforbid_[ADDRSIZE*NCONTEXT];
#define sforbid(x,k) sforbid_[(x)*NCONTEXT+k]
// declare arrays for synchronizations
int cl[NPROC];
int cdy[NPROC];
int cds[NPROC];
int cdl[NPROC];
int cisb[NPROC];
int caddr[NPROC];
int cctrl[NPROC];
int cstart[NPROC];
int creturn[NPROC];
// declare arrays for contexts activity
int active[NCONTEXT];
int ctx_used[NCONTEXT];
__LOCALS__
buff(0,0) = 0;
pw(0,0) = 0;
cr(0,0) = 0;
iw(0,0) = 0;
cw(0,0) = 0;
cx(0,0) = 0;
is(0,0) = 0;
cs(0,0) = 0;
crmax(0,0) = 0;
buff(0,1) = 0;
pw(0,1) = 0;
cr(0,1) = 0;
iw(0,1) = 0;
cw(0,1) = 0;
cx(0,1) = 0;
is(0,1) = 0;
cs(0,1) = 0;
crmax(0,1) = 0;
buff(0,2) = 0;
pw(0,2) = 0;
cr(0,2) = 0;
iw(0,2) = 0;
cw(0,2) = 0;
cx(0,2) = 0;
is(0,2) = 0;
cs(0,2) = 0;
crmax(0,2) = 0;
buff(0,3) = 0;
pw(0,3) = 0;
cr(0,3) = 0;
iw(0,3) = 0;
cw(0,3) = 0;
cx(0,3) = 0;
is(0,3) = 0;
cs(0,3) = 0;
crmax(0,3) = 0;
buff(0,4) = 0;
pw(0,4) = 0;
cr(0,4) = 0;
iw(0,4) = 0;
cw(0,4) = 0;
cx(0,4) = 0;
is(0,4) = 0;
cs(0,4) = 0;
crmax(0,4) = 0;
buff(0,5) = 0;
pw(0,5) = 0;
cr(0,5) = 0;
iw(0,5) = 0;
cw(0,5) = 0;
cx(0,5) = 0;
is(0,5) = 0;
cs(0,5) = 0;
crmax(0,5) = 0;
buff(0,6) = 0;
pw(0,6) = 0;
cr(0,6) = 0;
iw(0,6) = 0;
cw(0,6) = 0;
cx(0,6) = 0;
is(0,6) = 0;
cs(0,6) = 0;
crmax(0,6) = 0;
cl[0] = 0;
cdy[0] = 0;
cds[0] = 0;
cdl[0] = 0;
cisb[0] = 0;
caddr[0] = 0;
cctrl[0] = 0;
cstart[0] = get_rng(0,NCONTEXT-1);
creturn[0] = get_rng(0,NCONTEXT-1);
buff(1,0) = 0;
pw(1,0) = 0;
cr(1,0) = 0;
iw(1,0) = 0;
cw(1,0) = 0;
cx(1,0) = 0;
is(1,0) = 0;
cs(1,0) = 0;
crmax(1,0) = 0;
buff(1,1) = 0;
pw(1,1) = 0;
cr(1,1) = 0;
iw(1,1) = 0;
cw(1,1) = 0;
cx(1,1) = 0;
is(1,1) = 0;
cs(1,1) = 0;
crmax(1,1) = 0;
buff(1,2) = 0;
pw(1,2) = 0;
cr(1,2) = 0;
iw(1,2) = 0;
cw(1,2) = 0;
cx(1,2) = 0;
is(1,2) = 0;
cs(1,2) = 0;
crmax(1,2) = 0;
buff(1,3) = 0;
pw(1,3) = 0;
cr(1,3) = 0;
iw(1,3) = 0;
cw(1,3) = 0;
cx(1,3) = 0;
is(1,3) = 0;
cs(1,3) = 0;
crmax(1,3) = 0;
buff(1,4) = 0;
pw(1,4) = 0;
cr(1,4) = 0;
iw(1,4) = 0;
cw(1,4) = 0;
cx(1,4) = 0;
is(1,4) = 0;
cs(1,4) = 0;
crmax(1,4) = 0;
buff(1,5) = 0;
pw(1,5) = 0;
cr(1,5) = 0;
iw(1,5) = 0;
cw(1,5) = 0;
cx(1,5) = 0;
is(1,5) = 0;
cs(1,5) = 0;
crmax(1,5) = 0;
buff(1,6) = 0;
pw(1,6) = 0;
cr(1,6) = 0;
iw(1,6) = 0;
cw(1,6) = 0;
cx(1,6) = 0;
is(1,6) = 0;
cs(1,6) = 0;
crmax(1,6) = 0;
cl[1] = 0;
cdy[1] = 0;
cds[1] = 0;
cdl[1] = 0;
cisb[1] = 0;
caddr[1] = 0;
cctrl[1] = 0;
cstart[1] = get_rng(0,NCONTEXT-1);
creturn[1] = get_rng(0,NCONTEXT-1);
buff(2,0) = 0;
pw(2,0) = 0;
cr(2,0) = 0;
iw(2,0) = 0;
cw(2,0) = 0;
cx(2,0) = 0;
is(2,0) = 0;
cs(2,0) = 0;
crmax(2,0) = 0;
buff(2,1) = 0;
pw(2,1) = 0;
cr(2,1) = 0;
iw(2,1) = 0;
cw(2,1) = 0;
cx(2,1) = 0;
is(2,1) = 0;
cs(2,1) = 0;
crmax(2,1) = 0;
buff(2,2) = 0;
pw(2,2) = 0;
cr(2,2) = 0;
iw(2,2) = 0;
cw(2,2) = 0;
cx(2,2) = 0;
is(2,2) = 0;
cs(2,2) = 0;
crmax(2,2) = 0;
buff(2,3) = 0;
pw(2,3) = 0;
cr(2,3) = 0;
iw(2,3) = 0;
cw(2,3) = 0;
cx(2,3) = 0;
is(2,3) = 0;
cs(2,3) = 0;
crmax(2,3) = 0;
buff(2,4) = 0;
pw(2,4) = 0;
cr(2,4) = 0;
iw(2,4) = 0;
cw(2,4) = 0;
cx(2,4) = 0;
is(2,4) = 0;
cs(2,4) = 0;
crmax(2,4) = 0;
buff(2,5) = 0;
pw(2,5) = 0;
cr(2,5) = 0;
iw(2,5) = 0;
cw(2,5) = 0;
cx(2,5) = 0;
is(2,5) = 0;
cs(2,5) = 0;
crmax(2,5) = 0;
buff(2,6) = 0;
pw(2,6) = 0;
cr(2,6) = 0;
iw(2,6) = 0;
cw(2,6) = 0;
cx(2,6) = 0;
is(2,6) = 0;
cs(2,6) = 0;
crmax(2,6) = 0;
cl[2] = 0;
cdy[2] = 0;
cds[2] = 0;
cdl[2] = 0;
cisb[2] = 0;
caddr[2] = 0;
cctrl[2] = 0;
cstart[2] = get_rng(0,NCONTEXT-1);
creturn[2] = get_rng(0,NCONTEXT-1);
// Dumping initializations
mem(3+0,0) = 0;
mem(0+0,0) = 0;
mem(0+1,0) = 0;
mem(0+2,0) = 0;
mem(4+0,0) = 0;
mem(5+0,0) = 0;
mem(6+0,0) = 0;
// Dumping context matching equalities
co(0,0) = 0;
delta(0,0) = -1;
co(1,0) = 0;
delta(1,0) = -1;
co(2,0) = 0;
delta(2,0) = -1;
co(3,0) = 0;
delta(3,0) = -1;
co(4,0) = 0;
delta(4,0) = -1;
co(5,0) = 0;
delta(5,0) = -1;
co(6,0) = 0;
delta(6,0) = -1;
// Dumping thread 1
int ret_thread_1 = 0;
cdy[1] = get_rng(0,NCONTEXT-1);
ASSUME(cdy[1] >= cstart[1]);
T1BLOCK0:
// call void @llvm.dbg.value(metadata i8* %arg, metadata !35, metadata !DIExpression()), !dbg !44
// br label %label_1, !dbg !45
goto T1BLOCK1;
T1BLOCK1:
// call void @llvm.dbg.label(metadata !43), !dbg !46
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0), metadata !36, metadata !DIExpression()), !dbg !47
// call void @llvm.dbg.value(metadata i64 1, metadata !39, metadata !DIExpression()), !dbg !47
// store atomic i64 1, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !48
// ST: Guess
iw(1,0) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STIW
old_cw = cw(1,0);
cw(1,0) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STCOM
// Check
ASSUME(active[iw(1,0)] == 1);
ASSUME(active[cw(1,0)] == 1);
ASSUME(sforbid(0,cw(1,0))== 0);
ASSUME(iw(1,0) >= 0);
ASSUME(iw(1,0) >= 0);
ASSUME(cw(1,0) >= iw(1,0));
ASSUME(cw(1,0) >= old_cw);
ASSUME(cw(1,0) >= cr(1,0));
ASSUME(cw(1,0) >= cl[1]);
ASSUME(cw(1,0) >= cisb[1]);
ASSUME(cw(1,0) >= cdy[1]);
ASSUME(cw(1,0) >= cdl[1]);
ASSUME(cw(1,0) >= cds[1]);
ASSUME(cw(1,0) >= cctrl[1]);
ASSUME(cw(1,0) >= caddr[1]);
// Update
caddr[1] = max(caddr[1],0);
buff(1,0) = 1;
mem(0,cw(1,0)) = 1;
co(0,cw(1,0))+=1;
delta(0,cw(1,0)) = -1;
ASSUME(creturn[1] >= cw(1,0));
// call void (...) @dmbst(), !dbg !49
// dumbst: Guess
cds[1] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cds[1] >= cdy[1]);
ASSUME(cds[1] >= cw(1,3+0));
ASSUME(cds[1] >= cw(1,0+0));
ASSUME(cds[1] >= cw(1,0+1));
ASSUME(cds[1] >= cw(1,0+2));
ASSUME(cds[1] >= cw(1,4+0));
ASSUME(cds[1] >= cw(1,5+0));
ASSUME(cds[1] >= cw(1,6+0));
ASSUME(creturn[1] >= cds[1]);
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1), metadata !40, metadata !DIExpression()), !dbg !50
// call void @llvm.dbg.value(metadata i64 1, metadata !42, metadata !DIExpression()), !dbg !50
// store atomic i64 1, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !51
// ST: Guess
iw(1,0+1*1) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STIW
old_cw = cw(1,0+1*1);
cw(1,0+1*1) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STCOM
// Check
ASSUME(active[iw(1,0+1*1)] == 1);
ASSUME(active[cw(1,0+1*1)] == 1);
ASSUME(sforbid(0+1*1,cw(1,0+1*1))== 0);
ASSUME(iw(1,0+1*1) >= 0);
ASSUME(iw(1,0+1*1) >= 0);
ASSUME(cw(1,0+1*1) >= iw(1,0+1*1));
ASSUME(cw(1,0+1*1) >= old_cw);
ASSUME(cw(1,0+1*1) >= cr(1,0+1*1));
ASSUME(cw(1,0+1*1) >= cl[1]);
ASSUME(cw(1,0+1*1) >= cisb[1]);
ASSUME(cw(1,0+1*1) >= cdy[1]);
ASSUME(cw(1,0+1*1) >= cdl[1]);
ASSUME(cw(1,0+1*1) >= cds[1]);
ASSUME(cw(1,0+1*1) >= cctrl[1]);
ASSUME(cw(1,0+1*1) >= caddr[1]);
// Update
caddr[1] = max(caddr[1],0);
buff(1,0+1*1) = 1;
mem(0+1*1,cw(1,0+1*1)) = 1;
co(0+1*1,cw(1,0+1*1))+=1;
delta(0+1*1,cw(1,0+1*1)) = -1;
ASSUME(creturn[1] >= cw(1,0+1*1));
// ret i8* null, !dbg !52
ret_thread_1 = (- 1);
// Dumping thread 2
int ret_thread_2 = 0;
cdy[2] = get_rng(0,NCONTEXT-1);
ASSUME(cdy[2] >= cstart[2]);
T2BLOCK0:
// call void @llvm.dbg.value(metadata i8* %arg, metadata !55, metadata !DIExpression()), !dbg !83
// br label %label_2, !dbg !65
goto T2BLOCK1;
T2BLOCK1:
// call void @llvm.dbg.label(metadata !80), !dbg !85
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1), metadata !56, metadata !DIExpression()), !dbg !86
// call void @llvm.dbg.value(metadata i64 2, metadata !58, metadata !DIExpression()), !dbg !86
// store atomic i64 2, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !68
// ST: Guess
iw(2,0+1*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW
old_cw = cw(2,0+1*1);
cw(2,0+1*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM
// Check
ASSUME(active[iw(2,0+1*1)] == 2);
ASSUME(active[cw(2,0+1*1)] == 2);
ASSUME(sforbid(0+1*1,cw(2,0+1*1))== 0);
ASSUME(iw(2,0+1*1) >= 0);
ASSUME(iw(2,0+1*1) >= 0);
ASSUME(cw(2,0+1*1) >= iw(2,0+1*1));
ASSUME(cw(2,0+1*1) >= old_cw);
ASSUME(cw(2,0+1*1) >= cr(2,0+1*1));
ASSUME(cw(2,0+1*1) >= cl[2]);
ASSUME(cw(2,0+1*1) >= cisb[2]);
ASSUME(cw(2,0+1*1) >= cdy[2]);
ASSUME(cw(2,0+1*1) >= cdl[2]);
ASSUME(cw(2,0+1*1) >= cds[2]);
ASSUME(cw(2,0+1*1) >= cctrl[2]);
ASSUME(cw(2,0+1*1) >= caddr[2]);
// Update
caddr[2] = max(caddr[2],0);
buff(2,0+1*1) = 2;
mem(0+1*1,cw(2,0+1*1)) = 2;
co(0+1*1,cw(2,0+1*1))+=1;
delta(0+1*1,cw(2,0+1*1)) = -1;
ASSUME(creturn[2] >= cw(2,0+1*1));
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1), metadata !61, metadata !DIExpression()), !dbg !88
// %0 = load atomic i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !70
// LD: Guess
old_cr = cr(2,0+1*1);
cr(2,0+1*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM
// Check
ASSUME(active[cr(2,0+1*1)] == 2);
ASSUME(cr(2,0+1*1) >= iw(2,0+1*1));
ASSUME(cr(2,0+1*1) >= 0);
ASSUME(cr(2,0+1*1) >= cdy[2]);
ASSUME(cr(2,0+1*1) >= cisb[2]);
ASSUME(cr(2,0+1*1) >= cdl[2]);
ASSUME(cr(2,0+1*1) >= cl[2]);
// Update
creg_r0 = cr(2,0+1*1);
crmax(2,0+1*1) = max(crmax(2,0+1*1),cr(2,0+1*1));
caddr[2] = max(caddr[2],0);
if(cr(2,0+1*1) < cw(2,0+1*1)) {
r0 = buff(2,0+1*1);
} else {
if(pw(2,0+1*1) != co(0+1*1,cr(2,0+1*1))) {
ASSUME(cr(2,0+1*1) >= old_cr);
}
pw(2,0+1*1) = co(0+1*1,cr(2,0+1*1));
r0 = mem(0+1*1,cr(2,0+1*1));
}
ASSUME(creturn[2] >= cr(2,0+1*1));
// call void @llvm.dbg.value(metadata i64 %0, metadata !63, metadata !DIExpression()), !dbg !88
// %conv = trunc i64 %0 to i32, !dbg !71
// call void @llvm.dbg.value(metadata i32 %conv, metadata !59, metadata !DIExpression()), !dbg !83
// %tobool = icmp ne i32 %conv, 0, !dbg !72
// br i1 %tobool, label %if.then, label %if.else, !dbg !74
old_cctrl = cctrl[2];
cctrl[2] = get_rng(0,NCONTEXT-1);
ASSUME(cctrl[2] >= old_cctrl);
ASSUME(cctrl[2] >= creg_r0);
ASSUME(cctrl[2] >= 0);
if((r0!=0)) {
goto T2BLOCK2;
} else {
goto T2BLOCK3;
}
T2BLOCK2:
// br label %lbl_LC00, !dbg !75
goto T2BLOCK4;
T2BLOCK3:
// br label %lbl_LC00, !dbg !76
goto T2BLOCK4;
T2BLOCK4:
// call void @llvm.dbg.label(metadata !81), !dbg !96
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 2), metadata !65, metadata !DIExpression()), !dbg !97
// %1 = load atomic i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 2) monotonic, align 8, !dbg !79
// LD: Guess
old_cr = cr(2,0+2*1);
cr(2,0+2*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM
// Check
ASSUME(active[cr(2,0+2*1)] == 2);
ASSUME(cr(2,0+2*1) >= iw(2,0+2*1));
ASSUME(cr(2,0+2*1) >= 0);
ASSUME(cr(2,0+2*1) >= cdy[2]);
ASSUME(cr(2,0+2*1) >= cisb[2]);
ASSUME(cr(2,0+2*1) >= cdl[2]);
ASSUME(cr(2,0+2*1) >= cl[2]);
// Update
creg_r1 = cr(2,0+2*1);
crmax(2,0+2*1) = max(crmax(2,0+2*1),cr(2,0+2*1));
caddr[2] = max(caddr[2],0);
if(cr(2,0+2*1) < cw(2,0+2*1)) {
r1 = buff(2,0+2*1);
} else {
if(pw(2,0+2*1) != co(0+2*1,cr(2,0+2*1))) {
ASSUME(cr(2,0+2*1) >= old_cr);
}
pw(2,0+2*1) = co(0+2*1,cr(2,0+2*1));
r1 = mem(0+2*1,cr(2,0+2*1));
}
ASSUME(creturn[2] >= cr(2,0+2*1));
// call void @llvm.dbg.value(metadata i64 %1, metadata !67, metadata !DIExpression()), !dbg !97
// %conv4 = trunc i64 %1 to i32, !dbg !80
// call void @llvm.dbg.value(metadata i32 %conv4, metadata !64, metadata !DIExpression()), !dbg !83
// %tobool5 = icmp ne i32 %conv4, 0, !dbg !81
// br i1 %tobool5, label %if.then6, label %if.else7, !dbg !83
old_cctrl = cctrl[2];
cctrl[2] = get_rng(0,NCONTEXT-1);
ASSUME(cctrl[2] >= old_cctrl);
ASSUME(cctrl[2] >= creg_r1);
ASSUME(cctrl[2] >= 0);
if((r1!=0)) {
goto T2BLOCK5;
} else {
goto T2BLOCK6;
}
T2BLOCK5:
// br label %lbl_LC01, !dbg !84
goto T2BLOCK7;
T2BLOCK6:
// br label %lbl_LC01, !dbg !85
goto T2BLOCK7;
T2BLOCK7:
// call void @llvm.dbg.label(metadata !82), !dbg !105
// call void (...) @isb(), !dbg !87
// isb: Guess
cisb[2] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cisb[2] >= cdy[2]);
ASSUME(cisb[2] >= cctrl[2]);
ASSUME(cisb[2] >= caddr[2]);
ASSUME(creturn[2] >= cisb[2]);
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0), metadata !69, metadata !DIExpression()), !dbg !107
// %2 = load atomic i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !89
// LD: Guess
old_cr = cr(2,0);
cr(2,0) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM
// Check
ASSUME(active[cr(2,0)] == 2);
ASSUME(cr(2,0) >= iw(2,0));
ASSUME(cr(2,0) >= 0);
ASSUME(cr(2,0) >= cdy[2]);
ASSUME(cr(2,0) >= cisb[2]);
ASSUME(cr(2,0) >= cdl[2]);
ASSUME(cr(2,0) >= cl[2]);
// Update
creg_r2 = cr(2,0);
crmax(2,0) = max(crmax(2,0),cr(2,0));
caddr[2] = max(caddr[2],0);
if(cr(2,0) < cw(2,0)) {
r2 = buff(2,0);
} else {
if(pw(2,0) != co(0,cr(2,0))) {
ASSUME(cr(2,0) >= old_cr);
}
pw(2,0) = co(0,cr(2,0));
r2 = mem(0,cr(2,0));
}
ASSUME(creturn[2] >= cr(2,0));
// call void @llvm.dbg.value(metadata i64 %2, metadata !71, metadata !DIExpression()), !dbg !107
// %conv11 = trunc i64 %2 to i32, !dbg !90
// call void @llvm.dbg.value(metadata i32 %conv11, metadata !68, metadata !DIExpression()), !dbg !83
// %cmp = icmp eq i32 %conv, 2, !dbg !91
// %conv12 = zext i1 %cmp to i32, !dbg !91
// call void @llvm.dbg.value(metadata i32 %conv12, metadata !72, metadata !DIExpression()), !dbg !83
// call void @llvm.dbg.value(metadata i64* @atom_1_X2_2, metadata !73, metadata !DIExpression()), !dbg !111
// %3 = zext i32 %conv12 to i64
// call void @llvm.dbg.value(metadata i64 %3, metadata !75, metadata !DIExpression()), !dbg !111
// store atomic i64 %3, i64* @atom_1_X2_2 seq_cst, align 8, !dbg !93
// ST: Guess
iw(2,3) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW
old_cw = cw(2,3);
cw(2,3) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM
// Check
ASSUME(active[iw(2,3)] == 2);
ASSUME(active[cw(2,3)] == 2);
ASSUME(sforbid(3,cw(2,3))== 0);
ASSUME(iw(2,3) >= max(creg_r0,0));
ASSUME(iw(2,3) >= 0);
ASSUME(cw(2,3) >= iw(2,3));
ASSUME(cw(2,3) >= old_cw);
ASSUME(cw(2,3) >= cr(2,3));
ASSUME(cw(2,3) >= cl[2]);
ASSUME(cw(2,3) >= cisb[2]);
ASSUME(cw(2,3) >= cdy[2]);
ASSUME(cw(2,3) >= cdl[2]);
ASSUME(cw(2,3) >= cds[2]);
ASSUME(cw(2,3) >= cctrl[2]);
ASSUME(cw(2,3) >= caddr[2]);
// Update
caddr[2] = max(caddr[2],0);
buff(2,3) = (r0==2);
mem(3,cw(2,3)) = (r0==2);
co(3,cw(2,3))+=1;
delta(3,cw(2,3)) = -1;
ASSUME(creturn[2] >= cw(2,3));
// %cmp16 = icmp eq i32 %conv11, 0, !dbg !94
// %conv17 = zext i1 %cmp16 to i32, !dbg !94
// call void @llvm.dbg.value(metadata i32 %conv17, metadata !76, metadata !DIExpression()), !dbg !83
// call void @llvm.dbg.value(metadata i64* @atom_1_X5_0, metadata !77, metadata !DIExpression()), !dbg !114
// %4 = zext i32 %conv17 to i64
// call void @llvm.dbg.value(metadata i64 %4, metadata !79, metadata !DIExpression()), !dbg !114
// store atomic i64 %4, i64* @atom_1_X5_0 seq_cst, align 8, !dbg !96
// ST: Guess
iw(2,4) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW
old_cw = cw(2,4);
cw(2,4) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM
// Check
ASSUME(active[iw(2,4)] == 2);
ASSUME(active[cw(2,4)] == 2);
ASSUME(sforbid(4,cw(2,4))== 0);
ASSUME(iw(2,4) >= max(creg_r2,0));
ASSUME(iw(2,4) >= 0);
ASSUME(cw(2,4) >= iw(2,4));
ASSUME(cw(2,4) >= old_cw);
ASSUME(cw(2,4) >= cr(2,4));
ASSUME(cw(2,4) >= cl[2]);
ASSUME(cw(2,4) >= cisb[2]);
ASSUME(cw(2,4) >= cdy[2]);
ASSUME(cw(2,4) >= cdl[2]);
ASSUME(cw(2,4) >= cds[2]);
ASSUME(cw(2,4) >= cctrl[2]);
ASSUME(cw(2,4) >= caddr[2]);
// Update
caddr[2] = max(caddr[2],0);
buff(2,4) = (r2==0);
mem(4,cw(2,4)) = (r2==0);
co(4,cw(2,4))+=1;
delta(4,cw(2,4)) = -1;
ASSUME(creturn[2] >= cw(2,4));
// ret i8* null, !dbg !97
ret_thread_2 = (- 1);
// Dumping thread 0
int ret_thread_0 = 0;
cdy[0] = get_rng(0,NCONTEXT-1);
ASSUME(cdy[0] >= cstart[0]);
T0BLOCK0:
// %thr0 = alloca i64, align 8
// %thr1 = alloca i64, align 8
// call void @llvm.dbg.value(metadata i32 %argc, metadata !124, metadata !DIExpression()), !dbg !167
// call void @llvm.dbg.value(metadata i8** %argv, metadata !125, metadata !DIExpression()), !dbg !167
// %0 = bitcast i64* %thr0 to i8*, !dbg !84
// call void @llvm.lifetime.start.p0i8(i64 8, i8* %0) #6, !dbg !84
// call void @llvm.dbg.declare(metadata i64* %thr0, metadata !126, metadata !DIExpression()), !dbg !169
// %1 = bitcast i64* %thr1 to i8*, !dbg !86
// call void @llvm.lifetime.start.p0i8(i64 8, i8* %1) #6, !dbg !86
// call void @llvm.dbg.declare(metadata i64* %thr1, metadata !130, metadata !DIExpression()), !dbg !171
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 2), metadata !131, metadata !DIExpression()), !dbg !172
// call void @llvm.dbg.value(metadata i64 0, metadata !133, metadata !DIExpression()), !dbg !172
// store atomic i64 0, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 2) monotonic, align 8, !dbg !89
// ST: Guess
iw(0,0+2*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW
old_cw = cw(0,0+2*1);
cw(0,0+2*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM
// Check
ASSUME(active[iw(0,0+2*1)] == 0);
ASSUME(active[cw(0,0+2*1)] == 0);
ASSUME(sforbid(0+2*1,cw(0,0+2*1))== 0);
ASSUME(iw(0,0+2*1) >= 0);
ASSUME(iw(0,0+2*1) >= 0);
ASSUME(cw(0,0+2*1) >= iw(0,0+2*1));
ASSUME(cw(0,0+2*1) >= old_cw);
ASSUME(cw(0,0+2*1) >= cr(0,0+2*1));
ASSUME(cw(0,0+2*1) >= cl[0]);
ASSUME(cw(0,0+2*1) >= cisb[0]);
ASSUME(cw(0,0+2*1) >= cdy[0]);
ASSUME(cw(0,0+2*1) >= cdl[0]);
ASSUME(cw(0,0+2*1) >= cds[0]);
ASSUME(cw(0,0+2*1) >= cctrl[0]);
ASSUME(cw(0,0+2*1) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,0+2*1) = 0;
mem(0+2*1,cw(0,0+2*1)) = 0;
co(0+2*1,cw(0,0+2*1))+=1;
delta(0+2*1,cw(0,0+2*1)) = -1;
ASSUME(creturn[0] >= cw(0,0+2*1));
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1), metadata !134, metadata !DIExpression()), !dbg !174
// call void @llvm.dbg.value(metadata i64 0, metadata !136, metadata !DIExpression()), !dbg !174
// store atomic i64 0, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !91
// ST: Guess
iw(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW
old_cw = cw(0,0+1*1);
cw(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM
// Check
ASSUME(active[iw(0,0+1*1)] == 0);
ASSUME(active[cw(0,0+1*1)] == 0);
ASSUME(sforbid(0+1*1,cw(0,0+1*1))== 0);
ASSUME(iw(0,0+1*1) >= 0);
ASSUME(iw(0,0+1*1) >= 0);
ASSUME(cw(0,0+1*1) >= iw(0,0+1*1));
ASSUME(cw(0,0+1*1) >= old_cw);
ASSUME(cw(0,0+1*1) >= cr(0,0+1*1));
ASSUME(cw(0,0+1*1) >= cl[0]);
ASSUME(cw(0,0+1*1) >= cisb[0]);
ASSUME(cw(0,0+1*1) >= cdy[0]);
ASSUME(cw(0,0+1*1) >= cdl[0]);
ASSUME(cw(0,0+1*1) >= cds[0]);
ASSUME(cw(0,0+1*1) >= cctrl[0]);
ASSUME(cw(0,0+1*1) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,0+1*1) = 0;
mem(0+1*1,cw(0,0+1*1)) = 0;
co(0+1*1,cw(0,0+1*1))+=1;
delta(0+1*1,cw(0,0+1*1)) = -1;
ASSUME(creturn[0] >= cw(0,0+1*1));
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0), metadata !137, metadata !DIExpression()), !dbg !176
// call void @llvm.dbg.value(metadata i64 0, metadata !139, metadata !DIExpression()), !dbg !176
// store atomic i64 0, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !93
// ST: Guess
iw(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW
old_cw = cw(0,0);
cw(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM
// Check
ASSUME(active[iw(0,0)] == 0);
ASSUME(active[cw(0,0)] == 0);
ASSUME(sforbid(0,cw(0,0))== 0);
ASSUME(iw(0,0) >= 0);
ASSUME(iw(0,0) >= 0);
ASSUME(cw(0,0) >= iw(0,0));
ASSUME(cw(0,0) >= old_cw);
ASSUME(cw(0,0) >= cr(0,0));
ASSUME(cw(0,0) >= cl[0]);
ASSUME(cw(0,0) >= cisb[0]);
ASSUME(cw(0,0) >= cdy[0]);
ASSUME(cw(0,0) >= cdl[0]);
ASSUME(cw(0,0) >= cds[0]);
ASSUME(cw(0,0) >= cctrl[0]);
ASSUME(cw(0,0) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,0) = 0;
mem(0,cw(0,0)) = 0;
co(0,cw(0,0))+=1;
delta(0,cw(0,0)) = -1;
ASSUME(creturn[0] >= cw(0,0));
// call void @llvm.dbg.value(metadata i64* @atom_1_X2_2, metadata !140, metadata !DIExpression()), !dbg !178
// call void @llvm.dbg.value(metadata i64 0, metadata !142, metadata !DIExpression()), !dbg !178
// store atomic i64 0, i64* @atom_1_X2_2 monotonic, align 8, !dbg !95
// ST: Guess
iw(0,3) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW
old_cw = cw(0,3);
cw(0,3) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM
// Check
ASSUME(active[iw(0,3)] == 0);
ASSUME(active[cw(0,3)] == 0);
ASSUME(sforbid(3,cw(0,3))== 0);
ASSUME(iw(0,3) >= 0);
ASSUME(iw(0,3) >= 0);
ASSUME(cw(0,3) >= iw(0,3));
ASSUME(cw(0,3) >= old_cw);
ASSUME(cw(0,3) >= cr(0,3));
ASSUME(cw(0,3) >= cl[0]);
ASSUME(cw(0,3) >= cisb[0]);
ASSUME(cw(0,3) >= cdy[0]);
ASSUME(cw(0,3) >= cdl[0]);
ASSUME(cw(0,3) >= cds[0]);
ASSUME(cw(0,3) >= cctrl[0]);
ASSUME(cw(0,3) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,3) = 0;
mem(3,cw(0,3)) = 0;
co(3,cw(0,3))+=1;
delta(3,cw(0,3)) = -1;
ASSUME(creturn[0] >= cw(0,3));
// call void @llvm.dbg.value(metadata i64* @atom_1_X5_0, metadata !143, metadata !DIExpression()), !dbg !180
// call void @llvm.dbg.value(metadata i64 0, metadata !145, metadata !DIExpression()), !dbg !180
// store atomic i64 0, i64* @atom_1_X5_0 monotonic, align 8, !dbg !97
// ST: Guess
iw(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW
old_cw = cw(0,4);
cw(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM
// Check
ASSUME(active[iw(0,4)] == 0);
ASSUME(active[cw(0,4)] == 0);
ASSUME(sforbid(4,cw(0,4))== 0);
ASSUME(iw(0,4) >= 0);
ASSUME(iw(0,4) >= 0);
ASSUME(cw(0,4) >= iw(0,4));
ASSUME(cw(0,4) >= old_cw);
ASSUME(cw(0,4) >= cr(0,4));
ASSUME(cw(0,4) >= cl[0]);
ASSUME(cw(0,4) >= cisb[0]);
ASSUME(cw(0,4) >= cdy[0]);
ASSUME(cw(0,4) >= cdl[0]);
ASSUME(cw(0,4) >= cds[0]);
ASSUME(cw(0,4) >= cctrl[0]);
ASSUME(cw(0,4) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,4) = 0;
mem(4,cw(0,4)) = 0;
co(4,cw(0,4))+=1;
delta(4,cw(0,4)) = -1;
ASSUME(creturn[0] >= cw(0,4));
// %call = call i32 @pthread_create(i64* noundef %thr0, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @t0, i8* noundef null) #6, !dbg !98
// dumbsy: Guess
old_cdy = cdy[0];
cdy[0] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[0] >= old_cdy);
ASSUME(cdy[0] >= cisb[0]);
ASSUME(cdy[0] >= cdl[0]);
ASSUME(cdy[0] >= cds[0]);
ASSUME(cdy[0] >= cctrl[0]);
ASSUME(cdy[0] >= cw(0,3+0));
ASSUME(cdy[0] >= cw(0,0+0));
ASSUME(cdy[0] >= cw(0,0+1));
ASSUME(cdy[0] >= cw(0,0+2));
ASSUME(cdy[0] >= cw(0,4+0));
ASSUME(cdy[0] >= cw(0,5+0));
ASSUME(cdy[0] >= cw(0,6+0));
ASSUME(cdy[0] >= cr(0,3+0));
ASSUME(cdy[0] >= cr(0,0+0));
ASSUME(cdy[0] >= cr(0,0+1));
ASSUME(cdy[0] >= cr(0,0+2));
ASSUME(cdy[0] >= cr(0,4+0));
ASSUME(cdy[0] >= cr(0,5+0));
ASSUME(cdy[0] >= cr(0,6+0));
ASSUME(creturn[0] >= cdy[0]);
ASSUME(cstart[1] >= cdy[0]);
// %call9 = call i32 @pthread_create(i64* noundef %thr1, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @t1, i8* noundef null) #6, !dbg !99
// dumbsy: Guess
old_cdy = cdy[0];
cdy[0] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[0] >= old_cdy);
ASSUME(cdy[0] >= cisb[0]);
ASSUME(cdy[0] >= cdl[0]);
ASSUME(cdy[0] >= cds[0]);
ASSUME(cdy[0] >= cctrl[0]);
ASSUME(cdy[0] >= cw(0,3+0));
ASSUME(cdy[0] >= cw(0,0+0));
ASSUME(cdy[0] >= cw(0,0+1));
ASSUME(cdy[0] >= cw(0,0+2));
ASSUME(cdy[0] >= cw(0,4+0));
ASSUME(cdy[0] >= cw(0,5+0));
ASSUME(cdy[0] >= cw(0,6+0));
ASSUME(cdy[0] >= cr(0,3+0));
ASSUME(cdy[0] >= cr(0,0+0));
ASSUME(cdy[0] >= cr(0,0+1));
ASSUME(cdy[0] >= cr(0,0+2));
ASSUME(cdy[0] >= cr(0,4+0));
ASSUME(cdy[0] >= cr(0,5+0));
ASSUME(cdy[0] >= cr(0,6+0));
ASSUME(creturn[0] >= cdy[0]);
ASSUME(cstart[2] >= cdy[0]);
// %2 = load i64, i64* %thr0, align 8, !dbg !100, !tbaa !101
// LD: Guess
old_cr = cr(0,5);
cr(0,5) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM
// Check
ASSUME(active[cr(0,5)] == 0);
ASSUME(cr(0,5) >= iw(0,5));
ASSUME(cr(0,5) >= 0);
ASSUME(cr(0,5) >= cdy[0]);
ASSUME(cr(0,5) >= cisb[0]);
ASSUME(cr(0,5) >= cdl[0]);
ASSUME(cr(0,5) >= cl[0]);
// Update
creg_r4 = cr(0,5);
crmax(0,5) = max(crmax(0,5),cr(0,5));
caddr[0] = max(caddr[0],0);
if(cr(0,5) < cw(0,5)) {
r4 = buff(0,5);
} else {
if(pw(0,5) != co(5,cr(0,5))) {
ASSUME(cr(0,5) >= old_cr);
}
pw(0,5) = co(5,cr(0,5));
r4 = mem(5,cr(0,5));
}
ASSUME(creturn[0] >= cr(0,5));
// %call10 = call i32 @pthread_join(i64 noundef %2, i8** noundef null), !dbg !105
// dumbsy: Guess
old_cdy = cdy[0];
cdy[0] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[0] >= old_cdy);
ASSUME(cdy[0] >= cisb[0]);
ASSUME(cdy[0] >= cdl[0]);
ASSUME(cdy[0] >= cds[0]);
ASSUME(cdy[0] >= cctrl[0]);
ASSUME(cdy[0] >= cw(0,3+0));
ASSUME(cdy[0] >= cw(0,0+0));
ASSUME(cdy[0] >= cw(0,0+1));
ASSUME(cdy[0] >= cw(0,0+2));
ASSUME(cdy[0] >= cw(0,4+0));
ASSUME(cdy[0] >= cw(0,5+0));
ASSUME(cdy[0] >= cw(0,6+0));
ASSUME(cdy[0] >= cr(0,3+0));
ASSUME(cdy[0] >= cr(0,0+0));
ASSUME(cdy[0] >= cr(0,0+1));
ASSUME(cdy[0] >= cr(0,0+2));
ASSUME(cdy[0] >= cr(0,4+0));
ASSUME(cdy[0] >= cr(0,5+0));
ASSUME(cdy[0] >= cr(0,6+0));
ASSUME(creturn[0] >= cdy[0]);
ASSUME(cdy[0] >= creturn[1]);
// %3 = load i64, i64* %thr1, align 8, !dbg !106, !tbaa !101
// LD: Guess
old_cr = cr(0,6);
cr(0,6) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM
// Check
ASSUME(active[cr(0,6)] == 0);
ASSUME(cr(0,6) >= iw(0,6));
ASSUME(cr(0,6) >= 0);
ASSUME(cr(0,6) >= cdy[0]);
ASSUME(cr(0,6) >= cisb[0]);
ASSUME(cr(0,6) >= cdl[0]);
ASSUME(cr(0,6) >= cl[0]);
// Update
creg_r5 = cr(0,6);
crmax(0,6) = max(crmax(0,6),cr(0,6));
caddr[0] = max(caddr[0],0);
if(cr(0,6) < cw(0,6)) {
r5 = buff(0,6);
} else {
if(pw(0,6) != co(6,cr(0,6))) {
ASSUME(cr(0,6) >= old_cr);
}
pw(0,6) = co(6,cr(0,6));
r5 = mem(6,cr(0,6));
}
ASSUME(creturn[0] >= cr(0,6));
// %call11 = call i32 @pthread_join(i64 noundef %3, i8** noundef null), !dbg !107
// dumbsy: Guess
old_cdy = cdy[0];
cdy[0] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[0] >= old_cdy);
ASSUME(cdy[0] >= cisb[0]);
ASSUME(cdy[0] >= cdl[0]);
ASSUME(cdy[0] >= cds[0]);
ASSUME(cdy[0] >= cctrl[0]);
ASSUME(cdy[0] >= cw(0,3+0));
ASSUME(cdy[0] >= cw(0,0+0));
ASSUME(cdy[0] >= cw(0,0+1));
ASSUME(cdy[0] >= cw(0,0+2));
ASSUME(cdy[0] >= cw(0,4+0));
ASSUME(cdy[0] >= cw(0,5+0));
ASSUME(cdy[0] >= cw(0,6+0));
ASSUME(cdy[0] >= cr(0,3+0));
ASSUME(cdy[0] >= cr(0,0+0));
ASSUME(cdy[0] >= cr(0,0+1));
ASSUME(cdy[0] >= cr(0,0+2));
ASSUME(cdy[0] >= cr(0,4+0));
ASSUME(cdy[0] >= cr(0,5+0));
ASSUME(cdy[0] >= cr(0,6+0));
ASSUME(creturn[0] >= cdy[0]);
ASSUME(cdy[0] >= creturn[2]);
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0), metadata !147, metadata !DIExpression()), !dbg !192
// %4 = load atomic i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0) seq_cst, align 8, !dbg !109
// LD: Guess
old_cr = cr(0,0);
cr(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM
// Check
ASSUME(active[cr(0,0)] == 0);
ASSUME(cr(0,0) >= iw(0,0));
ASSUME(cr(0,0) >= 0);
ASSUME(cr(0,0) >= cdy[0]);
ASSUME(cr(0,0) >= cisb[0]);
ASSUME(cr(0,0) >= cdl[0]);
ASSUME(cr(0,0) >= cl[0]);
// Update
creg_r6 = cr(0,0);
crmax(0,0) = max(crmax(0,0),cr(0,0));
caddr[0] = max(caddr[0],0);
if(cr(0,0) < cw(0,0)) {
r6 = buff(0,0);
} else {
if(pw(0,0) != co(0,cr(0,0))) {
ASSUME(cr(0,0) >= old_cr);
}
pw(0,0) = co(0,cr(0,0));
r6 = mem(0,cr(0,0));
}
ASSUME(creturn[0] >= cr(0,0));
// call void @llvm.dbg.value(metadata i64 %4, metadata !149, metadata !DIExpression()), !dbg !192
// %conv = trunc i64 %4 to i32, !dbg !110
// call void @llvm.dbg.value(metadata i32 %conv, metadata !146, metadata !DIExpression()), !dbg !167
// %cmp = icmp eq i32 %conv, 1, !dbg !111
// %conv12 = zext i1 %cmp to i32, !dbg !111
// call void @llvm.dbg.value(metadata i32 %conv12, metadata !150, metadata !DIExpression()), !dbg !167
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1), metadata !152, metadata !DIExpression()), !dbg !196
// %5 = load atomic i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1) seq_cst, align 8, !dbg !113
// LD: Guess
old_cr = cr(0,0+1*1);
cr(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM
// Check
ASSUME(active[cr(0,0+1*1)] == 0);
ASSUME(cr(0,0+1*1) >= iw(0,0+1*1));
ASSUME(cr(0,0+1*1) >= 0);
ASSUME(cr(0,0+1*1) >= cdy[0]);
ASSUME(cr(0,0+1*1) >= cisb[0]);
ASSUME(cr(0,0+1*1) >= cdl[0]);
ASSUME(cr(0,0+1*1) >= cl[0]);
// Update
creg_r7 = cr(0,0+1*1);
crmax(0,0+1*1) = max(crmax(0,0+1*1),cr(0,0+1*1));
caddr[0] = max(caddr[0],0);
if(cr(0,0+1*1) < cw(0,0+1*1)) {
r7 = buff(0,0+1*1);
} else {
if(pw(0,0+1*1) != co(0+1*1,cr(0,0+1*1))) {
ASSUME(cr(0,0+1*1) >= old_cr);
}
pw(0,0+1*1) = co(0+1*1,cr(0,0+1*1));
r7 = mem(0+1*1,cr(0,0+1*1));
}
ASSUME(creturn[0] >= cr(0,0+1*1));
// call void @llvm.dbg.value(metadata i64 %5, metadata !154, metadata !DIExpression()), !dbg !196
// %conv16 = trunc i64 %5 to i32, !dbg !114
// call void @llvm.dbg.value(metadata i32 %conv16, metadata !151, metadata !DIExpression()), !dbg !167
// %cmp17 = icmp eq i32 %conv16, 2, !dbg !115
// %conv18 = zext i1 %cmp17 to i32, !dbg !115
// call void @llvm.dbg.value(metadata i32 %conv18, metadata !155, metadata !DIExpression()), !dbg !167
// call void @llvm.dbg.value(metadata i64* @atom_1_X2_2, metadata !157, metadata !DIExpression()), !dbg !200
// %6 = load atomic i64, i64* @atom_1_X2_2 seq_cst, align 8, !dbg !117
// LD: Guess
old_cr = cr(0,3);
cr(0,3) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM
// Check
ASSUME(active[cr(0,3)] == 0);
ASSUME(cr(0,3) >= iw(0,3));
ASSUME(cr(0,3) >= 0);
ASSUME(cr(0,3) >= cdy[0]);
ASSUME(cr(0,3) >= cisb[0]);
ASSUME(cr(0,3) >= cdl[0]);
ASSUME(cr(0,3) >= cl[0]);
// Update
creg_r8 = cr(0,3);
crmax(0,3) = max(crmax(0,3),cr(0,3));
caddr[0] = max(caddr[0],0);
if(cr(0,3) < cw(0,3)) {
r8 = buff(0,3);
} else {
if(pw(0,3) != co(3,cr(0,3))) {
ASSUME(cr(0,3) >= old_cr);
}
pw(0,3) = co(3,cr(0,3));
r8 = mem(3,cr(0,3));
}
ASSUME(creturn[0] >= cr(0,3));
// call void @llvm.dbg.value(metadata i64 %6, metadata !159, metadata !DIExpression()), !dbg !200
// %conv22 = trunc i64 %6 to i32, !dbg !118
// call void @llvm.dbg.value(metadata i32 %conv22, metadata !156, metadata !DIExpression()), !dbg !167
// call void @llvm.dbg.value(metadata i64* @atom_1_X5_0, metadata !161, metadata !DIExpression()), !dbg !203
// %7 = load atomic i64, i64* @atom_1_X5_0 seq_cst, align 8, !dbg !120
// LD: Guess
old_cr = cr(0,4);
cr(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM
// Check
ASSUME(active[cr(0,4)] == 0);
ASSUME(cr(0,4) >= iw(0,4));
ASSUME(cr(0,4) >= 0);
ASSUME(cr(0,4) >= cdy[0]);
ASSUME(cr(0,4) >= cisb[0]);
ASSUME(cr(0,4) >= cdl[0]);
ASSUME(cr(0,4) >= cl[0]);
// Update
creg_r9 = cr(0,4);
crmax(0,4) = max(crmax(0,4),cr(0,4));
caddr[0] = max(caddr[0],0);
if(cr(0,4) < cw(0,4)) {
r9 = buff(0,4);
} else {
if(pw(0,4) != co(4,cr(0,4))) {
ASSUME(cr(0,4) >= old_cr);
}
pw(0,4) = co(4,cr(0,4));
r9 = mem(4,cr(0,4));
}
ASSUME(creturn[0] >= cr(0,4));
// call void @llvm.dbg.value(metadata i64 %7, metadata !163, metadata !DIExpression()), !dbg !203
// %conv26 = trunc i64 %7 to i32, !dbg !121
// call void @llvm.dbg.value(metadata i32 %conv26, metadata !160, metadata !DIExpression()), !dbg !167
// %and = and i32 %conv22, %conv26, !dbg !122
creg_r10 = max(creg_r8,creg_r9);
ASSUME(active[creg_r10] == 0);
r10 = r8 & r9;
// call void @llvm.dbg.value(metadata i32 %and, metadata !164, metadata !DIExpression()), !dbg !167
// %and27 = and i32 %conv18, %and, !dbg !123
creg_r11 = max(max(creg_r7,0),creg_r10);
ASSUME(active[creg_r11] == 0);
r11 = (r7==2) & r10;
// call void @llvm.dbg.value(metadata i32 %and27, metadata !165, metadata !DIExpression()), !dbg !167
// %and28 = and i32 %conv12, %and27, !dbg !124
creg_r12 = max(max(creg_r6,0),creg_r11);
ASSUME(active[creg_r12] == 0);
r12 = (r6==1) & r11;
// call void @llvm.dbg.value(metadata i32 %and28, metadata !166, metadata !DIExpression()), !dbg !167
// %cmp29 = icmp eq i32 %and28, 1, !dbg !125
// br i1 %cmp29, label %if.then, label %if.end, !dbg !127
old_cctrl = cctrl[0];
cctrl[0] = get_rng(0,NCONTEXT-1);
ASSUME(cctrl[0] >= old_cctrl);
ASSUME(cctrl[0] >= creg_r12);
ASSUME(cctrl[0] >= 0);
if((r12==1)) {
goto T0BLOCK1;
} else {
goto T0BLOCK2;
}
T0BLOCK1:
// call void @__assert_fail(i8* noundef getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* noundef getelementptr inbounds ([110 x i8], [110 x i8]* @.str.1, i64 0, i64 0), i32 noundef 69, i8* noundef getelementptr inbounds ([23 x i8], [23 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #7, !dbg !128
// unreachable, !dbg !128
r13 = 1;
T0BLOCK2:
// %8 = bitcast i64* %thr1 to i8*, !dbg !131
// call void @llvm.lifetime.end.p0i8(i64 8, i8* %8) #6, !dbg !131
// %9 = bitcast i64* %thr0 to i8*, !dbg !131
// call void @llvm.lifetime.end.p0i8(i64 8, i8* %9) #6, !dbg !131
// ret i32 0, !dbg !132
ret_thread_0 = 0;
ASSERT(r13== 0);
}
| [
"tuan-phong.ngo@it.uu.se"
] | tuan-phong.ngo@it.uu.se |
686d4abbd7462e75ace9ecc975bebda42126ce57 | f8f69588af5b11f7d3c03eb0906123f3721753b5 | /cpp/sorting/shaker_sort.cc | 2c561d0cd279b3d4acf0d02a93d5724151cd7108 | [
"Apache-2.0"
] | permissive | stn/algorithms | ff478888812c63ea7251fe8315dbb00526c861cb | 435c6b1bcdc042553c13a711d20f6d871988c251 | refs/heads/main | 2023-07-08T05:28:32.760906 | 2021-08-15T13:19:35 | 2021-08-15T13:19:35 | 378,162,246 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 821 | cc | #include "shaker_sort.h"
void shaker_sort(int *arr, int n) {
if (n == 0) return;
int left = 0;
int right = n - 1;
while (true) {
int last = left;
for (int i = left; i < right; ++i) {
if (arr[i] > arr[i + 1]) {
int tmp = arr[i];
arr[i] = arr[i + 1];
arr[i + 1] = tmp;
last = i;
}
}
right = last;
if (left == right) {
break;
}
for (int i = right; i > left; --i) {
if (arr[i -1] > arr[i]) {
int tmp = arr[i];
arr[i] = arr[i - 1];
arr[i - 1] = tmp;
last = i;
}
}
left = last;
if (left == right) {
break;
}
}
}
| [
"akira.ishino@gmail.com"
] | akira.ishino@gmail.com |
33d95638d32f736372b7f59d9e48c00e25d57df1 | 39adfee7b03a59c40f0b2cca7a3b5d2381936207 | /codeforces/100534/C.cpp | dd2a94f3f59a8f25d3a89b81483152c5a975b8d0 | [] | no_license | ngthanhtrung23/CompetitiveProgramming | c4dee269c320c972482d5f56d3808a43356821ca | 642346c18569df76024bfb0678142e513d48d514 | refs/heads/master | 2023-07-06T05:46:25.038205 | 2023-06-24T14:18:48 | 2023-06-24T14:18:48 | 179,512,787 | 78 | 22 | null | null | null | null | UTF-8 | C++ | false | false | 2,045 | cpp | #include <set>
#include <map>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <complex>
#include <iostream>
#include <algorithm>
#include <ctime>
#include <deque>
#include <bitset>
#include <cctype>
#include <utility>
#include <cassert>
using namespace std;
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define FORD(i,a,b) for(int i=(a),_b=(b); i>=_b; i--)
#define REP(i,a) for(int i=0,_a=(a); i<_a; i++)
#define EACH(it,a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define SZ(S) ((int) ((S).size()))
#define DEBUG(x) { cout << #x << " = " << x << endl; }
#define PR(a,n) { cout << #a << " = "; FOR(_,1,n) cout << a[_] << ' '; cout << endl; }
#define PR0(a,n) { cout << #a << " = "; REP(_,n) cout << a[_] << ' '; cout << endl; }
void addEdges(vector< pair<int,int> > &res, int need, int nLeaf) {
int add = 0;
FOR(i,1,nLeaf) FOR(j,i+1,nLeaf) {
if (add >= need) return ;
++add;
res.push_back(make_pair(i, j));
}
}
int main() {
ios :: sync_with_stdio(false); cin.tie(NULL);
cout << (fixed) << setprecision(6);
int s;
while (cin >> s) {
if (s == 0) {
cout << 1 << ' ' << 0 << endl;
}
else if (s == 2 || s == 5) {
cout << "Impossible" << endl;
continue;
}
else {
int nLeaf = 1;
while (nLeaf * nLeaf < s) ++nLeaf;
int n = nLeaf + 1;
vector< pair<int,int> > res;
FOR(i,1,nLeaf) res.push_back(make_pair(n, i));
int m = nLeaf * nLeaf;
int need = m - s;
addEdges(res, need, nLeaf);
cout << n << ' ' << res.size() << endl;
REP(i,res.size()) cout << res[i].first << ' ' << res[i].second << endl;
}
}
return 0;
}
| [
"ngthanhtrung23@gmail.com"
] | ngthanhtrung23@gmail.com |
16340ba5e5222cee12768a39a3e8e294b1c67b56 | 3a97ff0246fb768c6d8a565b83085ac417fafe68 | /Main.cpp | dbf1c9ebb2f652ccdc1d239d975e621702cb745b | [] | no_license | jadyngonzalez/Assignment3 | 3edc815b8b4b5b51c3427ce3a6c4d70b0d96153c | 7efd631ec2f6ab1c8d16155138efe8f23522c3f3 | refs/heads/master | 2020-03-31T23:58:17.268413 | 2018-10-12T01:29:12 | 2018-10-12T01:29:12 | 152,676,354 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 412 | cpp | #include <iostream>
#include <fstream>
#include <string>
#include "SyntaxCheck.h"
using namespace std;
int main(int argc, char* argv[])
{
if(argc == 1) //checking for command line arguments
{
cerr << "File not included.";
exit(0);
}
if(argc > 2)
{
cerr << "Too many arguments entered.";
exit(0);
}
else
{
SyntaxCheck run(argv[1]);
}
return 0;
}
| [
"noreply@github.com"
] | noreply@github.com |
6fd473c7ed9b5b2e2467f50eaf05c3f0091705ff | 0ccef09cec2ae80ae02e4707c626da61c1d03303 | /Beam/Include/Beam/SerializationTests/ShuttleTestTypes.hpp | 9996deabdf70e051432e891c45bd524700746d46 | [] | no_license | blockspacer/beam | 76dc1f597032848b7d788050ca6a97a12186d3a6 | c96a99292bca88f7414750e1b3da3dd157525ca0 | refs/heads/master | 2022-04-18T16:03:52.472095 | 2020-04-16T02:39:09 | 2020-04-16T02:39:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,095 | hpp | #ifndef BEAM_SHUTTLETESTTYPES_HPP
#define BEAM_SHUTTLETESTTYPES_HPP
#include <string>
#include <cppunit/extensions/HelperMacros.h>
#include "Beam/Serialization/DataShuttle.hpp"
#include "Beam/Serialization/Receiver.hpp"
#include "Beam/Serialization/Sender.hpp"
#include "Beam/SerializationTests/SerializationTests.hpp"
namespace Beam {
namespace Serialization {
namespace Tests {
/*! \class StructWithFreeShuttle
\brief Struct with a free symmetric shuttle.
*/
struct StructWithFreeShuttle {
char m_a;
int m_b;
double m_c;
//! Tests for equality.
/*!
\param rhs The right hand side of the equality.
\return <code>true</code> iff <i>this</i> is equal to </i>rhs</i>.
*/
bool operator ==(const StructWithFreeShuttle& rhs) const;
};
/*! \class ClassWithShuttleMethod
\brief Class type with a symmetric shuttle method.
*/
class ClassWithShuttleMethod {
public:
//! Constructs an uninitialized ClassWithShuttleMethod.
ClassWithShuttleMethod();
//! Constructs a ClassWithShuttleMethod.
/*!
\param a The char value to shuttle.
\param b The int value to shuttle.
\param c The double value to shuttle.
*/
ClassWithShuttleMethod(char a, int b, double c);
//! Tests for equality.
/*!
\param rhs The right hand side of the equality.
\return <code>true</code> iff <i>this</i> is equal to </i>rhs</i>.
*/
bool operator ==(const ClassWithShuttleMethod& rhs) const;
private:
friend struct Serialization::DataShuttle;
char m_a;
int m_b;
double m_c;
template<typename Shuttler>
void Shuttle(Shuttler& shuttle, unsigned int version) {
shuttle.Shuttle("a", m_a);
shuttle.Shuttle("b", m_b);
shuttle.Shuttle("c", m_c);
}
};
/*! \class ClassWithSendReceiveMethods
\brief Class type with different methods for sending/receiving.
*/
class ClassWithSendReceiveMethods {
public:
//! Constructs an uninitialized ClassWithSendReceiveMethods.
ClassWithSendReceiveMethods();
//! Constructs a ClassWithSendReceiveMethods.
/*!
\param a The char value to shuttle.
\param b The int value to shuttle.
\param c The double value to shuttle.
*/
ClassWithSendReceiveMethods(char a, int b, double c);
//! Tests for equality.
/*!
\param rhs The right hand side of the equality.
\return <code>true</code> iff <i>this</i> is equal to </i>rhs</i>.
*/
bool operator ==(const ClassWithSendReceiveMethods& rhs) const;
private:
friend struct Serialization::DataShuttle;
char m_a;
int m_b;
double m_c;
template<typename Shuttler>
void Send(Shuttler& shuttle, unsigned int version) const {
shuttle.Shuttle("a", m_a);
int b1 = m_b - 1;
shuttle.Shuttle("b1", b1);
int b2 = m_b + 1;
shuttle.Shuttle("b2", b2);
shuttle.Shuttle("c", m_c);
}
template<typename Shuttler>
void Receive(Shuttler& shuttle, unsigned int version) {
shuttle.Shuttle("a", m_a);
int b1;
shuttle.Shuttle("b1", b1);
int b2;
shuttle.Shuttle("b2", b2);
m_b = b1 + 1;
CPPUNIT_ASSERT(b2 == m_b + 1);
shuttle.Shuttle("c", m_c);
}
};
/*! \class ClassWithVersioning
\brief Class type with versioning.
*/
class ClassWithVersioning {
public:
//! Constructs an uninitialized ClassWithVersioning.
ClassWithVersioning();
//! Constructs a ClassWithVersioning.
/*!
\param v0 Value visible in version 0.
\param v1 Value visible in version 1.
\param v2 Value visible in version 2.
*/
ClassWithVersioning(int v0, int v1, int v2);
//! Tests for equality.
/*!
\param rhs The right hand side of the equality.
\return <code>true</code> iff <i>this</i> is equal to </i>rhs</i>.
*/
bool operator ==(const ClassWithVersioning& rhs) const;
private:
friend struct Serialization::DataShuttle;
int m_v0;
int m_v1;
int m_v2;
template<typename Shuttler>
void Shuttle(Shuttler& shuttle, unsigned int version) {
shuttle.Shuttle("v0", m_v0);
if(version >= 1) {
shuttle.Shuttle("v1", m_v1);
} else if(Serialization::IsReceiver<Shuttler>::value) {
m_v1 = 0;
}
if(version >= 2) {
shuttle.Shuttle("v2", m_v2);
} else if(Serialization::IsReceiver<Shuttler>::value) {
m_v2 = 0;
}
}
};
/*! \class PolymorphicBaseClass
\brief Base class of a polymorphic type.
*/
class PolymorphicBaseClass {
public:
virtual ~PolymorphicBaseClass();
//! Returns an identifier for this class.
virtual std::string ToString() const = 0;
};
/*! \class PolymorphicDerivedClassA
\brief Inherits PolymorphicBaseClass.
*/
class PolymorphicDerivedClassA : public PolymorphicBaseClass {
public:
//! Constructs a PolymorphicDerivedClassA.
PolymorphicDerivedClassA();
virtual ~PolymorphicDerivedClassA();
virtual std::string ToString() const;
private:
friend struct Serialization::DataShuttle;
template<typename Shuttler>
void Shuttle(Shuttler& shuttle, unsigned int version) {}
};
/*! \class PolymorphicDerivedClassB
\brief Inherits PolymorphicBaseClass.
*/
class PolymorphicDerivedClassB : public PolymorphicBaseClass {
public:
//! Constructs a PolymorphicDerivedClassB.
PolymorphicDerivedClassB();
virtual ~PolymorphicDerivedClassB();
virtual std::string ToString() const;
private:
friend struct Serialization::DataShuttle;
template<typename Shuttler>
void Shuttle(Shuttler& shuttle, unsigned int version) {}
};
/*! \class ProxiedFunctionType
\brief Tests shuttling via proxy functions.
*/
class ProxiedFunctionType {
public:
//! Constructs an empty ProxiedFunctionType.
ProxiedFunctionType();
//! Constructs a ProxiedFunctionType.
/*!
\param value The value to return in the ToString.
*/
ProxiedFunctionType(const std::string& value);
//! Tests two instances for equality.
/*!
\param rhs The instance to test for equality.
\return <code>true</code> iff </i>rhs</i>'s ToString() is equal to
<code>this</i> ToString().
*/
bool operator ==(const ProxiedFunctionType& rhs) const;
//! Returns the held value.
std::string ToString() const;
private:
std::string m_value;
};
/*! \class ProxiedMethodType
\brief Tests shuttling via proxy methods.
*/
class ProxiedMethodType {
public:
//! Constructs an empty ProxiedMethodType.
ProxiedMethodType();
//! Constructs a ProxiedMethodType.
/*!
\param value The value to return in the ToString.
*/
ProxiedMethodType(const std::string& value);
//! Tests two instances for equality.
/*!
\param rhs The instance to test for equality.
\return <code>true</code> iff </i>rhs</i>'s ToString() is equal to
<code>this</i> ToString().
*/
bool operator ==(const ProxiedMethodType& rhs) const;
//! Returns the held value.
std::string ToString() const;
private:
friend struct Serialization::DataShuttle;
std::string m_value;
template<typename Shuttler>
void Send(Shuttler& shuttle, const char* name) const {
shuttle.Send(name, m_value);
}
template<typename Shuttler>
void Receive(Shuttler& shuttle, const char* name) {
shuttle.Shuttle(name, m_value);
}
};
}
template<>
struct Shuttle<Tests::StructWithFreeShuttle> {
template<typename Shuttler>
void operator ()(Shuttler& shuttle, Tests::StructWithFreeShuttle& value,
unsigned int version) const {
shuttle.Shuttle("a", value.m_a);
shuttle.Shuttle("b", value.m_b);
shuttle.Shuttle("c", value.m_c);
}
};
template<>
struct Version<Tests::ClassWithVersioning> :
std::integral_constant<unsigned int, 2> {};
template<>
struct IsStructure<Tests::ProxiedFunctionType> : std::false_type {};
template<>
struct IsStructure<Tests::ProxiedMethodType> : std::false_type {};
template<>
struct Send<Tests::ProxiedFunctionType> {
template<typename Shuttler>
void operator ()(Shuttler& shuttle, const char* name,
const Tests::ProxiedFunctionType& value) const {
shuttle.Send(name, value.ToString());
}
};
template<>
struct Receive<Tests::ProxiedFunctionType> {
template<typename Shuttler>
void operator ()(Shuttler& shuttle, const char* name,
Tests::ProxiedFunctionType& value) const {
std::string proxy;
shuttle.Shuttle(name, proxy);
value = Tests::ProxiedFunctionType(proxy);
}
};
}
}
#endif
| [
"kamal@eidolonsystems.com"
] | kamal@eidolonsystems.com |
0d2f47f996e1bbe0851f62044c3fca2b92384b17 | 1408929beb0a5733b6a83668984ab0f8521979c2 | /Codechef/August Long 19/apples.cpp | 8bbd42518282c7cd4b1cd66fb065d85c34e54b96 | [
"Apache-2.0"
] | permissive | utkarshsingh99/Competitive-Coding | 44eade011bbc7f3b12858c17d480a5e8746de9d8 | 8951cfa7b8ee2c003a37163c0daab7e1b7c63da1 | refs/heads/master | 2022-12-31T03:53:52.241988 | 2020-10-20T19:33:17 | 2020-10-20T19:33:17 | 119,350,372 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 330 | cpp | #include<bits/stdc++.h>
using namespace std;
int main () {
int t;
cin>>t;
while(t--) {
long long int n, k;
cin>>n>>k;
if(n/k < k) {
cout<<"YES";
} else if((n/k)%k == 0) {
cout<<"NO";
} else {
cout<<"YES";
}
cout<<endl;
}
} | [
"utkarshsingh369@gmail.com"
] | utkarshsingh369@gmail.com |
d4261a64f4c4b50de6cfa1f48a720b6c4bc689fa | 5fc853c980596f934251fce867501ace7348a4eb | /Graphic11/base/pyramid.cpp | 06e1d71457e3b665df5a90963b10b8c42eedee46 | [
"MIT"
] | permissive | rodrigobmg/Common | 89f7d62eba8ed8be63e671c623627804fcd6468a | b0d2f89e01a10a18199547a87a3c05da03212421 | refs/heads/master | 2020-03-11T04:37:17.692780 | 2018-04-11T00:30:05 | 2018-04-11T00:30:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,364 | cpp |
#include "stdafx.h"
#include "pyramid.h"
using namespace graphic;
cPyramid::cPyramid()
: cNode(common::GenerateId(), "pyramid", eNodeType::MODEL)
{
}
cPyramid::~cPyramid()
{
}
bool cPyramid::Create(cRenderer &renderer
, const float width //=1
, const float height//=1
, const Vector3 &pos //=Vector3(0,0,0)
, const int vtxType //= (eVertexType::POSITION)
, const cColor &color //= cColor::BLACK
)
{
m_shape.Create(renderer, width, height, pos, vtxType, color);
m_transform.scale = Vector3(width, height, width);
m_transform.pos = pos;
m_boundingBox.SetBoundingBox(m_transform);
m_color = color;
m_vtxType = vtxType;
return true;
}
bool cPyramid::Render(cRenderer &renderer
, const XMMATRIX &parentTm //= XMIdentity
, const int flags //= 1
)
{
cShader11 *shader = (m_shader) ? m_shader : renderer.m_shaderMgr.FindShader(m_shape.m_vtxType);
assert(shader);
shader->SetTechnique("Unlit");
shader->Begin();
shader->BeginPass(renderer, 0);
renderer.m_cbPerFrame.m_v->mWorld = XMMatrixTranspose(m_transform.GetMatrixXM() * parentTm);
renderer.m_cbPerFrame.Update(renderer);
renderer.m_cbLight.Update(renderer, 1);
const Vector4 color = m_color.GetColor();
renderer.m_cbMaterial.m_v->diffuse = XMVectorSet(color.x, color.y, color.z, color.w);
renderer.m_cbMaterial.Update(renderer, 2);
m_shape.Render(renderer);
return __super::Render(renderer, parentTm, flags);
}
void cPyramid::SetDimension(const float width, const float height)
{
m_transform.scale = Vector3(width, height, width);
}
void cPyramid::SetPos(const Vector3 &pos)
{
m_transform.pos = pos;
}
// Rotation Head to (p1-p0) Vector
void cPyramid::SetDirection(const Vector3 &p0, const Vector3 &p1
, const float width //= 1
)
{
Vector3 v = p1 - p0;
Quaternion q;
q.SetRotationArc(Vector3(0, 1, 0), v.Normal());
m_transform.rot = q;
m_transform.pos = p0;
m_transform.scale = Vector3(width, v.Length(), width);
m_boundingBox.SetBoundingBox(m_transform);
}
void cPyramid::SetDirection(const Vector3 &p0, const Vector3 &p1, const Vector3 &from
, const float width //= 1
, const float lengthRatio //= 1.f
)
{
Vector3 v = p1 - p0;
Quaternion q;
q.SetRotationArc(Vector3(0, 1, 0), v.Normal());
m_transform.rot = q;
m_transform.pos = from;
m_transform.scale = Vector3(width, v.Length()*lengthRatio, width);
m_boundingBox.SetBoundingBox(m_transform);
}
| [
"jjuiddong@gmail.com"
] | jjuiddong@gmail.com |
21c9e86b872bfec89375b1e2a118666c9700cae3 | 03d3231478373089a3de04db162f61b79a388fd3 | /l2ooghelper/packet_handlers/ph_NewCharacterSuccess.cpp | afcecd2a377e3d9db505b61d01ff75a3fadf7892 | [] | no_license | minlexx/l2-unlegits | f4b0e9d70afe2a0a26f81daa16123eb2fe31cc13 | fc189ca35edf14439a5eeac81359b30112496b80 | refs/heads/master | 2021-01-17T05:35:09.738039 | 2015-06-28T09:16:13 | 2015-06-28T09:16:13 | 38,192,499 | 6 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 2,119 | cpp | #include "stdafx.h"
#include "Logger.h"
#include "L2Client.h"
// dlg
#include "CreateCharDlg.h"
void L2Client::ph_NewCharacterSuccess( class L2Client *pcls, L2GamePacket *p )
{
L2Game_NewCharacterSuccess *ncs = new L2Game_NewCharacterSuccess(
p->getBytesPtr(), p->getPacketSize() );
//
int nTemplates = ncs->read_templatesCount();
int i;
const int supported_maxTemplates = 48;
//
log_error( LOG_DEBUG, "NewCharacterSuccess: %d templates\n", nTemplates );
// check
if( nTemplates > supported_maxTemplates )
{
log_error( LOG_WARNING, "NewCharacterSuccess: truncated templates count from %d to %d\n",
nTemplates, supported_maxTemplates );
nTemplates = supported_maxTemplates;
}
L2Game_NewCharacterTemplate char_templates[supported_maxTemplates];
memset( &char_templates, 0, sizeof(char_templates) );
for( i=0; i<nTemplates; i++ )
{
ncs->read_nextCharacterTemplate( &(char_templates[i]) );
//
log_error( LOG_DEBUG, "tmpl[%d]: race %d(%s), class %d(%s), %d,%d,%d,%d,%d,%d\n",
i,
char_templates[i].race, L2Data_getRace( char_templates[i].race ),
char_templates[i].classID, L2Data_getClass (char_templates[i].classID ),
char_templates[i].base_STR, char_templates[i].base_DEX, char_templates[i].base_CON,
char_templates[i].base_INT, char_templates[i].base_WIT, char_templates[i].base_MEN );
}
//
delete ncs;
ncs = NULL;
//
if( nTemplates > 0 )
{
CreateCharDialogResult res;
CreateCharDialog( pcls->hWnd, char_templates, nTemplates, &res );
if( res.createTemplateIndex < 0 )
{
// creation cancelled
log_error( LOG_DEBUG, "Char creation cancelled...\n" );
pcls->send_RequestGotoLobby();
return;
}
//
log_error( LOG_DEBUG, "Creating char [%S] tmpl index %d\n",
res.createCharName, res.createTemplateIndex );
// send CharacterCreate
pcls->send_CharacterCreate( res.createCharName,
&(char_templates[res.createTemplateIndex]),
res.createHairStyle, res.createHairColor, res.createFace, res.createGender );
// request char selection info
pcls->send_RequestGotoLobby();
}
}
| [
"alexey.min@gmail.com"
] | alexey.min@gmail.com |
c0428e3188176eb218907ccb0f78508745d9fd41 | c9dff28d8e32aa680ec7b53deef8f701d9b8a6ef | /labs/lab_1/code/lab1.cpp | f304defe11506826505acf04d6548e4babad7ffa | [] | no_license | ArtDu/DA | c390fad181a24c5eb562e0f579b631b2e3d22cfe | 76468a838b730807ee50561667de1c650565cfb0 | refs/heads/master | 2021-07-10T08:53:47.805167 | 2021-07-04T15:03:09 | 2021-07-04T15:03:09 | 184,652,164 | 2 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 2,932 | cpp | #include <iostream>
#include <cmath>
#include <cstring>
#include "TVector.h"
const size_t VALUE_LEN = 64;
const size_t PHONES_BITS = 45; // Количество бит в номере
int Log(size_t a, size_t b) {
return (int)(log(b) / log(a));
}
int GetDigit(long n, int r, int numSys, int i) { // получить разряд по r
return (n >> (r * i)) & (numSys - 1);
}
int GetSortPar(long n) { //кол-во бит каждого разряда
if (PHONES_BITS < Log(2, n)) {
return PHONES_BITS;
} else {
return (int)Log(2, n);
}
}
void CountingSort(TVector &vec, int index, int r, int numSys) {
long *tmp_array = new long[numSys];
//vector of result
TVector result(vec.Size(), vec.Size());
for(int i=0; i<numSys; ++i) {
tmp_array[i] = 0;
}
//run of data array
for (int indexI = 0; indexI < vec.Size(); ++indexI) {
tmp_array[GetDigit(vec[indexI].keyInNum,r,numSys,index)]++;
}
//adding priviously
for(int i=1; i<=numSys; ++i) {
tmp_array[i] += tmp_array[i-1];
}
for (int j = vec.Size()-1; j >= 0 ; --j) {
TData tmp_data = vec[j];
result[tmp_array[GetDigit(vec[j].keyInNum,r,numSys,index)]-1] = tmp_data;
tmp_array[GetDigit(vec[j].keyInNum,r,numSys,index)]--;
}
vec = result;
delete[] tmp_array;
}
void RadixSort(TVector &vec) {
if (vec.Size() < 2) {
return;
}
int r = GetSortPar(vec.Size()); //количество бит одного разряда
int numSys = pow(2, r); //система счисления
int phoneDigits = ceil((float)PHONES_BITS / r); //количество разрядов
for (int index = 0; index < phoneDigits ; ++index) {
CountingSort(vec,index, r, numSys);
}
}
int main()
{
TVector vec(0,100);
TData elem;
//scan the key
elem.key = new char[17];
while(scanf("%s",elem.key) != EOF) {
if(strcmp(elem.key,"*")==0) {
break;
}
//scan the value
elem.val = new char[VALUE_LEN + 1];
char* tmp = new char[VALUE_LEN + 1];
scanf("%s",tmp);
size_t tmp_size = strlen(tmp);
for (int j = 0; j < (VALUE_LEN)-tmp_size; ++j) {
elem.val[j] = '\0';
}
for (size_t j = VALUE_LEN-tmp_size, val_j = 0; j < VALUE_LEN+1; ++j, ++val_j) {
elem.val[j] = tmp[val_j];
}
//record key into the number
elem.keyInNum = 0;
tmp_size = strlen(elem.key);
for (size_t j = 0; j < tmp_size; ++j) {
if(elem.key[j] != '+' && elem.key[j]!= '-') {
elem.keyInNum = elem.keyInNum * 10 + elem.key[j] - '0';
}
}
vec.PushBack(elem);
elem.key = new char[17];
}
RadixSort(vec);
vec.Print();
return 0;
}
| [
"rusartdub@gmail.com"
] | rusartdub@gmail.com |
71bba215eb1d8e93f3b48f44529e5eee45c2bf0e | be0b8d7d4cba036c251e102c0c0dd1a15972cf5a | /src/MovieRetrieve/MyHashTable.h | b1ff8a6b1e3769e9a613c73e30ae792e10b6cdcd | [] | no_license | BlackCloud37/DSProject | 87a569ecab9a788d6a9fd7b26c320ff089702466 | 3533a95f8fdd7989ca54960749b3d0fd278e1e1b | refs/heads/master | 2022-03-30T04:54:23.942844 | 2019-12-21T03:39:48 | 2019-12-21T03:39:48 | 227,758,300 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,611 | h | #pragma once
#include "MyList.h"
#include "MyString.h"
template <class Valuetype>
class MyHashTable;
template <class Valuetype>
class HashNode {
friend class MyHashTable<Valuetype>;
CharString key;
Valuetype val;
public:
HashNode(const CharString& k):key(k) {
}
HashNode(const CharString& k, const Valuetype& v) :key(k), val(v) {
}
Valuetype value() const {
return val;
}
bool operator==(const HashNode& other) {
return key == other.key;
}
};
template <class Valuetype>
class MyHashTable {
int m_size;
MyList<HashNode<Valuetype> > *m_hashNodes;//array of list
public:
MyHashTable(const int size = 300000):m_size(size) {
m_hashNodes = new MyList<HashNode<Valuetype> >[size]();
}
~MyHashTable() {
delete[] m_hashNodes;
}
void insert(const CharString& key) {
int index = hash(key);
m_hashNodes[index].add(HashNode<Valuetype>(key));
}
void insert(const CharString& key, const Valuetype& val) {
int index = hash(key);
m_hashNodes[index].add(HashNode<Valuetype>(key, val));
}
void del(const CharString& key) {
int index = hash(key);
m_hashNodes[index].remove(HashNode<Valuetype>(key));
}
//判断是否存在此词
bool has(const CharString& key) {
return m_hashNodes[hash(key)].search(HashNode<Valuetype>(key));
}
Valuetype get(const CharString& key) {
return m_hashNodes[hash(key)].search(HashNode<Valuetype>(key))->elem().value();
}
//哈希算法,直接求和,乘以大素数再取模
int hash(const CharString& key) {
int sum = 0;
for (int i = 0; i < key.length(); i++) {
sum += key[i];
}
return abs((sum - 1) * 40503 % m_size);
}
};
| [
"44435569+BlackCloud37@users.noreply.github.com"
] | 44435569+BlackCloud37@users.noreply.github.com |
79b843c1e39a713166079ac8e46664e6341fc056 | d988d257f6f42d871c1a110b24afabed845c38d8 | /codesrc/source/cl_dll/history_resource.cpp | 2d5ec7227f3b78afcbca3bd6b6dd321cd84f5301 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | blockspacer/Forsaken | 3748f7d25b6425db00033d7650799d4f7107d276 | 966ba79dba9e418eb7513f5ab771556eb5935036 | refs/heads/master | 2021-09-22T20:15:52.609394 | 2018-09-15T10:12:34 | 2018-09-15T10:12:34 | 258,598,863 | 1 | 0 | null | 2020-04-24T18:59:02 | 2020-04-24T18:59:01 | null | WINDOWS-1252 | C++ | false | false | 12,243 | cpp | //========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Item pickup history displayed onscreen when items are picked up.
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "history_resource.h"
#include "hud_macros.h"
#include <vgui_controls/Controls.h>
#include <vgui/ILocalize.h>
#include <vgui/ISurface.h>
#include "iclientmode.h"
#include "vgui_controls/AnimationController.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
using namespace vgui;
extern ConVar hud_drawhistory_time;
DECLARE_HUDELEMENT( CHudHistoryResource );
DECLARE_HUD_MESSAGE( CHudHistoryResource, ItemPickup );
DECLARE_HUD_MESSAGE( CHudHistoryResource, AmmoDenied );
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
CHudHistoryResource::CHudHistoryResource( const char *pElementName ) :
CHudElement( pElementName ), BaseClass( NULL, "HudHistoryResource" )
{
vgui::Panel *pParent = g_pClientMode->GetViewport();
SetParent( pParent );
m_bDoNotDraw = true;
m_wcsAmmoFullMsg[0] = 0;
m_bNeedsDraw = false;
// Forsaken Addition: Hide HUD if credits are going
SetHiddenBits( HIDEHUD_MISCSTATUS | HIDEHUD_CREDITS );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CHudHistoryResource::ApplySchemeSettings( IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
SetPaintBackgroundEnabled( false );
// lookup text to display for ammo full message
wchar_t *wcs = localize()->Find("#hl2_AmmoFull");
if (wcs)
{
wcsncpy(m_wcsAmmoFullMsg, wcs, sizeof(m_wcsAmmoFullMsg) / sizeof(wchar_t));
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CHudHistoryResource::Init( void )
{
HOOK_HUD_MESSAGE( CHudHistoryResource, ItemPickup );
HOOK_HUD_MESSAGE( CHudHistoryResource, AmmoDenied );
Reset();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CHudHistoryResource::Reset( void )
{
m_PickupHistory.RemoveAll();
m_iCurrentHistorySlot = 0;
m_bDoNotDraw = true;
}
//-----------------------------------------------------------------------------
// Purpose: these kept only for hl1-port compatibility
//-----------------------------------------------------------------------------
void CHudHistoryResource::SetHistoryGap( int iNewHistoryGap )
{
}
//-----------------------------------------------------------------------------
// Purpose: adds an element to the history
//-----------------------------------------------------------------------------
void CHudHistoryResource::AddToHistory( C_BaseCombatWeapon *weapon )
{
// don't draw exhaustable weapons (grenades) since they'll have an ammo pickup icon as well
if ( weapon->GetWpnData().iFlags & ITEM_FLAG_EXHAUSTIBLE )
return;
int iId = weapon->entindex();
// don't show the same weapon twice
for ( int i = 0; i < m_PickupHistory.Count(); i++ )
{
if ( m_PickupHistory[i].iId == iId )
{
// it's already in list
return;
}
}
AddIconToHistory( HISTSLOT_WEAP, iId, weapon, 0, NULL );
}
//-----------------------------------------------------------------------------
// Purpose: Add a new entry to the pickup history
//-----------------------------------------------------------------------------
void CHudHistoryResource::AddToHistory( int iType, int iId, int iCount )
{
// Ignore adds with no count
if ( iType == HISTSLOT_AMMO )
{
if ( !iCount )
return;
// clear out any ammo pickup denied icons, since we can obviously pickup again
for ( int i = 0; i < m_PickupHistory.Count(); i++ )
{
if ( m_PickupHistory[i].type == HISTSLOT_AMMODENIED && m_PickupHistory[i].iId == iId )
{
// kill the old entry
m_PickupHistory[i].DisplayTime = 0.0f;
// change the pickup to be in this entry
m_iCurrentHistorySlot = i;
break;
}
}
}
AddIconToHistory( iType, iId, NULL, iCount, NULL );
}
//-----------------------------------------------------------------------------
// Purpose: Add a new entry to the pickup history
//-----------------------------------------------------------------------------
void CHudHistoryResource::AddToHistory( int iType, const char *szName, int iCount )
{
if ( iType != HISTSLOT_ITEM )
return;
// Get the item's icon
CHudTexture *i = gHUD.GetIcon( szName );
if ( i == NULL )
return;
AddIconToHistory( iType, 1, NULL, iCount, i );
}
//-----------------------------------------------------------------------------
// Purpose: adds a history icon
//-----------------------------------------------------------------------------
void CHudHistoryResource::AddIconToHistory( int iType, int iId, C_BaseCombatWeapon *weapon, int iCount, CHudTexture *icon )
{
m_bNeedsDraw = true;
// Check to see if the pic would have to be drawn too high. If so, start again from the bottom
if ( (m_flHistoryGap * m_iCurrentHistorySlot) > GetTall() )
{
m_iCurrentHistorySlot = 0;
}
// If the history resource is appearing, slide the hint message element down
if ( m_iCurrentHistorySlot == 0 )
{
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "HintMessageLower" );
}
// ensure the size
m_PickupHistory.EnsureCount(m_iCurrentHistorySlot + 1);
// default to just writing to the first slot
HIST_ITEM *freeslot = &m_PickupHistory[m_iCurrentHistorySlot++];
if ( iType == HISTSLOT_AMMODENIED && freeslot->DisplayTime )
{
// don't override existing pickup icons with denied icons
return;
}
freeslot->iId = iId;
freeslot->icon = icon;
freeslot->type = iType;
freeslot->m_hWeapon = weapon;
freeslot->iCount = iCount;
if (iType == HISTSLOT_AMMODENIED)
{
freeslot->DisplayTime = gpGlobals->curtime + (hud_drawhistory_time.GetFloat() / 2.0f);
}
else
{
freeslot->DisplayTime = gpGlobals->curtime + hud_drawhistory_time.GetFloat();
}
}
//-----------------------------------------------------------------------------
// Purpose: Handle an item pickup event from the server
//-----------------------------------------------------------------------------
void CHudHistoryResource::MsgFunc_ItemPickup( bf_read &msg )
{
char szName[1024];
msg.ReadString( szName, sizeof(szName) );
// Add the item to the history
AddToHistory( HISTSLOT_ITEM, szName );
}
//-----------------------------------------------------------------------------
// Purpose: ammo denied message
//-----------------------------------------------------------------------------
void CHudHistoryResource::MsgFunc_AmmoDenied( bf_read &msg )
{
int iAmmo = msg.ReadShort();
// see if there are any existing ammo items of that type
for ( int i = 0; i < m_PickupHistory.Count(); i++ )
{
if ( m_PickupHistory[i].type == HISTSLOT_AMMO && m_PickupHistory[i].iId == iAmmo )
{
// it's already in the list as a pickup, ignore
return;
}
}
// see if there are any denied ammo icons, if so refresh their timer
for ( int i = 0; i < m_PickupHistory.Count(); i++ )
{
if ( m_PickupHistory[i].type == HISTSLOT_AMMODENIED && m_PickupHistory[i].iId == iAmmo )
{
// it's already in the list, refresh
m_PickupHistory[i].DisplayTime = gpGlobals->curtime + (hud_drawhistory_time.GetFloat() / 2.0f);
m_bNeedsDraw = true;
return;
}
}
// add into the list
AddToHistory( HISTSLOT_AMMODENIED, iAmmo, 0 );
}
//-----------------------------------------------------------------------------
// Purpose: If there aren't any items in the history, clear it out.
//-----------------------------------------------------------------------------
void CHudHistoryResource::CheckClearHistory( void )
{
for ( int i = 0; i < m_PickupHistory.Count(); i++ )
{
if ( m_PickupHistory[i].type )
return;
}
m_iCurrentHistorySlot = 0;
// Slide the hint message element back up
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "HintMessageRaise" );
}
//-----------------------------------------------------------------------------
// Purpose: Save CPU cycles by letting the HUD system early cull
// costly traversal. Called per frame, return true if thinking and
// painting need to occur.
//-----------------------------------------------------------------------------
bool CHudHistoryResource::ShouldDraw( void )
{
return ( ( m_iCurrentHistorySlot > 0 || m_bNeedsDraw ) && CHudElement::ShouldDraw() );
}
//-----------------------------------------------------------------------------
// Purpose: Draw the pickup history
//-----------------------------------------------------------------------------
void CHudHistoryResource::Paint( void )
{
if ( m_bDoNotDraw )
{
// this is to not draw things until the first rendered
m_bDoNotDraw = false;
return;
}
// set when drawing should occur
// will be set if valid drawing does occur
m_bNeedsDraw = false;
int wide, tall;
GetSize( wide, tall );
for ( int i = 0; i < m_PickupHistory.Count(); i++ )
{
if ( m_PickupHistory[i].type )
{
m_PickupHistory[i].DisplayTime = min( m_PickupHistory[i].DisplayTime, gpGlobals->curtime + hud_drawhistory_time.GetFloat() );
if ( m_PickupHistory[i].DisplayTime <= gpGlobals->curtime )
{
// pic drawing time has expired
memset( &m_PickupHistory[i], 0, sizeof(HIST_ITEM) );
CheckClearHistory();
continue;
}
float elapsed = m_PickupHistory[i].DisplayTime - gpGlobals->curtime;
float scale = elapsed * 80;
Color clr = gHUD.m_clrNormal;
clr[3] = min( scale, 255 );
bool bUseAmmoFullMsg = false;
// get the icon and number to draw
const CHudTexture *itemIcon = NULL;
int iAmount = 0;
switch ( m_PickupHistory[i].type )
{
case HISTSLOT_AMMO:
{
itemIcon = gWR.GetAmmoIconFromWeapon( m_PickupHistory[i].iId );
iAmount = m_PickupHistory[i].iCount;
}
break;
case HISTSLOT_AMMODENIED:
{
itemIcon = gWR.GetAmmoIconFromWeapon( m_PickupHistory[i].iId );
iAmount = 0;
bUseAmmoFullMsg = true;
// display as red
clr = gHUD.m_clrCaution;
clr[3] = min( scale, 255 );
}
break;
case HISTSLOT_WEAP:
{
C_BaseCombatWeapon *pWeapon = m_PickupHistory[i].m_hWeapon;
if ( !pWeapon )
return;
if ( !pWeapon->HasAmmo() )
{
// if the weapon doesn't have ammo, display it as red
clr = gHUD.m_clrCaution;
clr[3] = min( scale, 255 );
}
itemIcon = pWeapon->GetSpriteInactive();
}
break;
case HISTSLOT_ITEM:
{
if ( !m_PickupHistory[i].iId )
continue;
itemIcon = m_PickupHistory[i].icon;
}
break;
default:
// unknown history type
Assert( 0 );
break;
}
if ( !itemIcon )
continue;
if ( clr[3] )
{
// valid drawing will occur
m_bNeedsDraw = true;
}
int ypos = tall - (m_flHistoryGap * (i + 1));
int xpos = wide - itemIcon->Width() - m_flIconInset;
itemIcon->DrawSelf( xpos, ypos, clr );
if ( iAmount )
{
wchar_t text[16];
_snwprintf( text, sizeof( text ) / sizeof(wchar_t), L"%i", m_PickupHistory[i].iCount );
// offset the number to sit properly next to the icon
ypos -= ( surface()->GetFontTall( m_hNumberFont ) - itemIcon->Height() ) / 2;
vgui::surface()->DrawSetTextFont( m_hNumberFont );
vgui::surface()->DrawSetTextColor( clr );
vgui::surface()->DrawSetTextPos( wide - m_flTextInset, ypos );
vgui::surface()->DrawUnicodeString( text );
}
else if ( bUseAmmoFullMsg )
{
// offset the number to sit properly next to the icon
ypos -= ( surface()->GetFontTall( m_hTextFont ) - itemIcon->Height() ) / 2;
vgui::surface()->DrawSetTextFont( m_hTextFont );
vgui::surface()->DrawSetTextColor( clr );
vgui::surface()->DrawSetTextPos( wide - m_flTextInset, ypos );
vgui::surface()->DrawUnicodeString( m_wcsAmmoFullMsg );
}
}
}
}
| [
"mail@jessevanover92.net"
] | mail@jessevanover92.net |
57895cfce746b9ac3a651d07c268c431cdf5e89a | 1e7dab0b93063c66aba5eff9dfb3522e042fcd4e | /Jobsheet 9 C++.cpp | a823c9c45d6a8de16016376770a6d4076f62fd51 | [] | no_license | rizkyaulias/P4-Rizky-Aulia-Safitri | 4a74d6f2c14741400e7a0f75eb4a4fe541a22221 | 002b6322ca0669671f713d1dea586ce91a90c94a | refs/heads/master | 2022-07-02T09:53:45.988554 | 2020-05-12T03:57:25 | 2020-05-12T03:57:25 | 263,056,762 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 271 | cpp | #include <iostream>
using namespace std;
int main()
{
int i;
char nama[20]={'U','L','I','4','A','@'};
char nama2[20]="@AULI4";
cout<<"Array per karakter = ";
for(i=0;i<5;i++)
{
cout<<nama[i]<<",";
}
cout<<endl;
cout<<"Array string = "<<nama2<<endl<<endl;
}
| [
"noreply@github.com"
] | noreply@github.com |
355ea1a5756e009ee060419bdcaa61596c607fc7 | c6382570f0d9005f13ddb4aa02a9e333e352d94f | /BAEKJOON/10798.cpp | 7ed5cf419e9d3286c980f534b465f818947e0cba | [] | no_license | minkukjo/Cpp-Algorithm | 1bf0aba053bbc09bac43363ee66f138460cede37 | 81a784e31d2b227ad4dcc28886befaadd4d03769 | refs/heads/master | 2020-04-14T04:26:55.323753 | 2020-02-18T13:36:45 | 2020-02-18T13:36:45 | 163,636,203 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 879 | cpp | //
// Created by 조민국 on 2019-04-18.
//
#include <iostream>
using namespace std;
string a[16];
char map[6][16];
void print(int size)
{
for(int i=0; i<size; i++)
{
for(int j=0; j<5; j++)
{
if(map[j][i] == '%')
{
continue;
}
cout << map[j][i];
}
}
}
int main()
{
int size = 0;
for(int i=0; i<5; i++)
{
cin >> a[i];
}
for(int i=0; i<5; i++)
{
if(size < a[i].size())
{
size = a[i].size();
}
}
for(int i=0; i<5; i++)
{
for(int j=0; j<size; j++)
{
if(j+1 >a[i].size())
{
map[i][j] = '%';
}
else
{
map[i][j] = a[i][j];
}
}
}
print(size);
return 0;
} | [
"strike0115@naver.com"
] | strike0115@naver.com |
a56e7405058954db8971cee678cc3ebf21971842 | 58748e6da9052a63539cf8c53ac78e859c13dbb2 | /src/openGL/Uniform/UniformAbstract.hpp | ecf11316da227859903111e0be38f49bb9122704 | [] | no_license | JulesFouchy/IMACUBES | eb2b6a2f6720b44f78882cde472c9d70c86012f1 | c5c64577f179eed3ca86e4913f965ce17e6f77d0 | refs/heads/master | 2021-12-09T00:40:00.548058 | 2021-12-05T14:49:36 | 2021-12-05T14:49:36 | 220,300,221 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,050 | hpp | #pragma once
#pragma once
#include <string>
#include "OpenGL/Shader.hpp"
#include "OpenGL/ShaderLibrary.hpp"
#include "Locator/Locate.hpp"
#include "History/HistoryTypes.hpp"
#include "UniformValue.hpp"
class UniformAbstract {
public:
UniformAbstract(const std::string& name, HistoryType historyType)
: m_name(name), m_historyType(historyType) {}
~UniformAbstract() = default;
virtual void sendTo(Shader& shader, const std::string& name) = 0;
inline void sendTo(size_t shaderLID, const std::string& name) { sendTo(GetShader(shaderLID), name); }
inline void sendTo(size_t shaderLID) { sendTo(shaderLID, getName()); }
virtual bool ImGui_Slider() = 0;
virtual bool ImGui_Drag(float speed = 1.0f) = 0;
virtual UniformAbstract* createPtrWithSameData() = 0;
inline const std::string& getName() const { return m_name; }
protected:
inline static Shader& GetShader(size_t shaderLID) { return Locate::shaderLibrary()[shaderLID]; }
protected:
std::string m_name;
HistoryType m_historyType;
}; | [
"jules.fouchy@ntymail.com"
] | jules.fouchy@ntymail.com |
f47f437d8b31f2d64ca7726be3f6ff4a44150e1e | 83d2a3ae9397fb7e870700e2eff8d7fa92686609 | /libs/python/test/str.cpp | d1ff87297d4bbc2ca655768a5d67e91557d0b2d9 | [
"BSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Albermg7/boost | a46b309ae8963762dbe8be5a94b2f2aefdeed424 | cfc1cd75edc70029bbb095c091a28c46b44904cc | refs/heads/master | 2020-04-25T01:45:56.415033 | 2013-11-15T12:56:31 | 2013-11-15T12:56:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,062 | cpp | // Copyright David Abrahams 2004. 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)
#include <boost/python/module.hpp>
#include <boost/python/def.hpp>
#include <boost/python/class.hpp>
#include <boost/python/str.hpp>
using namespace boost::python;
object convert_to_string(object data)
{
return str(data);
}
void work_with_string(object print)
{
str data("this is a demo string");
print(data.split(" "));
print(data.split(" ",3));
print(str("<->").join(data.split(" ")));
print(data.capitalize());
print('[' + data.center(30) + ']');
print(data.count("t"));
print(data.encode("utf-8"));
print(data.decode("utf-8"));
assert(!data.endswith("xx"));
assert(!data.startswith("test"));
print(data.splitlines());
print(data.strip());
print(data.swapcase());
print(data.title());
print("find");
print(data.find("demo"));
print(data.find("demo"),3,5);
print(data.find(std::string("demo")));
print(data.find(std::string("demo"),9));
print("expandtabs");
str tabstr("\t\ttab\tdemo\t!");
print(tabstr.expandtabs());
print(tabstr.expandtabs(4));
print(tabstr.expandtabs(7L));
print("operators");
print( str("part1") + str("part2") );
// print( str("a test string").slice(3,_) );
// print( str("another test")[5] );
print(data.replace("demo",std::string("blabla")));
print(data.rfind("i",5));
print(data.rindex("i",5));
assert(!data.startswith("asdf"));
assert(!data.endswith("asdf"));
print(data.translate(str('a')*256));
bool tmp = data.isalnum() || data.isalpha() || data.isdigit() || data.islower() ||
data.isspace() || data.istitle() || data.isupper();
(void)tmp; // ignored.
}
BOOST_PYTHON_MODULE(str_ext)
{
def("convert_to_string",convert_to_string);
def("work_with_string",work_with_string);
}
| [
"albermg7@gmail.com"
] | albermg7@gmail.com |
aa43fcbff29b3021824d3f69bbb70d8b360b85b9 | 0a7e11f45d7873e3fcfd0c9f91b9c1998abc6a10 | /Merge Sort.cpp | 8cdebd6ba5e1cf5fa118ce2a0ddce4513f5693f1 | [] | no_license | Muskankumari2002/CPP_CODES | c58ca2ed939e6fbfaeb9c1dead01d6d9d16137f8 | ecdd4f182d95962403135dea82e65a0a890af58c | refs/heads/master | 2023-07-30T14:27:47.181627 | 2021-10-06T17:47:36 | 2021-10-06T17:47:36 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 915 | cpp | #include<iostream>
using namespace std;
void merge(int arr[], int l, int mid, int r)
{
int n1=mid-l+1;
int n2=r-mid;
int a[n1];
int b[n2];
for (int i=0;i<n1;i++){
a[i]=arr[l+i];}
for(int i=0;i<n2;i++){
b[i]=arr[mid+1+i];
}
int i=0;
int j=0;
int k=l;
while(i<n1 && j<n2)
{
if (a[i]<b[j])
{
arr[k]=a[i];
k++; i++;
}
else {
arr[k]=b[j];
k++; j++;
}
}
while(i<n1)
{
arr[k]=a[i];
k++; i++;
}
while (j<n2)
{
arr[k]=b[j];
k++; j++;
}
}
void mergesort(int arr[], int l , int r)
{if (l<r)
{
int mid=(l+r)/2;
mergesort(arr, l , mid );
mergesort(arr, mid+1, r);
merge (arr,l,mid,r);
}
}
int main()
{
int arr[]= {5 ,4 ,3 ,2 ,1};
mergesort(arr,0,4);
for (int i=0;i<5;i++)
{
cout<<arr[i]<<" ";
}
cout<<endl;
return 0;
}
| [
"noreply@github.com"
] | noreply@github.com |
850b0361592dba5ddca2d75e98df03532ebb4033 | cd9c038686a9ee6421a468998e8869b50ae5fcc5 | /INF1010/TP2/Film.cpp | 8b366434ca947ba376dd6b3648b72e64cf08b555 | [] | no_license | SlimaneBouss/SchoolProjects | 479fb5f1846c1f5c6ff835d6aaf954903ea99c60 | 6fee50f050c7fa0a167117fce43de425129e45dc | refs/heads/master | 2022-05-26T23:15:11.742257 | 2020-05-02T22:40:31 | 2020-05-02T22:40:31 | 234,398,691 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,201 | cpp | ////////////////////////////////////////////////////////////////////////////////
/// \file Film .cpp
/// \author Kevin Lam and Slimane Boussafeur
/// \version Dernière entrée : 2020-02-29
/// \since Création : 2020-01-29
///
/// Ce fichier contient les méthodes de la class Film
////////////////////////////////////////////////////////////////////////////////
#include "Film.h"
#include <iostream>
#include "Pays.h"
#include "typesafe_enum.h"
namespace
{
constexpr std::size_t CAPACITE_PAYS_INITIALE = 2;
//! Fonction qui convertit le enum Film::Genre en string
//! \param genre Le genre à convertir
//! \return Le string qui représente le enum
const std::string& getGenreString(Film::Genre genre)
{
static const std::string NOMS_GENRES[] = {"Action",
"Aventure",
"Comedie",
"Horreur",
"Romance"};
auto index = enum_value(genre);
assert(valid_as_enum<Pays>(index));
return NOMS_GENRES[index];
}
//! Fonction qui convertit le enum Pays en string
//! \param pays Le pays à convertir
//! \return Le string qui représente le enum
const std::string& getPaysString(Pays pays)
{
static const std::string NOMS_PAYS[] = {"Bresil",
"Canada",
"Chine",
"EtatsUnis",
"France",
"Japon",
"RoyaumeUni",
"Russie",
"Mexique"};
auto index = enum_value(pays);
assert(valid_as_enum<Pays>(index));
return NOMS_PAYS[index];
}
} // namespace
//! Constructeur de la classe Film
//! \param nom Nom du film
//! \param anneeDeSortie Année de sortie du film
//! \param genre Le genre du film
//! \param pays Le pays d'origine du film
//! \param estRestreintParAge Bool qui représente si le film est interdit aux moins de 16 ans
//! \param auteur Pointeur vers l'auteur du film
Film::Film(const std::string& nom, unsigned int anneeDeSortie, Genre genre, Pays pays,
bool estRestreintParAge, Auteur* auteur)
: nom_(nom)
, anneeDeSortie_(anneeDeSortie)
, genre_(genre)
, pays_(pays)
, estRestreintParAge_(estRestreintParAge)
, auteur_(auteur)
, paysRestreints_(std::vector<Pays> {})
{
}
//! Destructeur de classe Film
Film::~Film()
{
auteur_->setNbFilms(auteur_->getNbFilms() - 1);
}
//! Méthode qui ajoute un pays à liste des pays restreints du film
//! \param pays Pays à ajouter à la liste
void Film::ajouterPaysRestreint(Pays pays)
{
paysRestreints_.push_back(pays);
}
//! Méthode qui supprime les pays restreints
void Film::supprimerPaysRestreints()
{
paysRestreints_.clear();
}
//! Méthode qui retourne si un pays est dans la liste des pays restreints du film
//! \param pays Le pays à chercher dans la liste des pays restreints
//! \return Un bool représentant si le pays se trouve dans la liste des pays restreints
bool Film::estRestreintDansPays(Pays pays) const
{
for (std::size_t i = 0; i < paysRestreints_.size(); i++)
{
if (paysRestreints_[i] == pays)
{
return true;
}
}
return false;
}
//! Méthode de l'operateur << de la classe Film qui affiche un film et ses informations
//! \param stream Le stream dans lequel afficher
//! \param film Le film qu'on veut afficher dans le stream
//! \return stream Le stream modifié
std::ostream& operator<<( std::ostream& stream, const Film& film)
{
// Ne modifiez pas cette fonction
stream << film.nom_ << "\n\tDate de sortie: " << film.anneeDeSortie_
<< "\n\tGenre: " << getGenreString(film.genre_) << "\n\tAuteur: " << film.auteur_->getNom()
<< "\n\tPays: " << getPaysString(film.pays_)
<< (film.paysRestreints_.size() == 0 ? "\n\tAucun pays restreint." : "\n\tPays restreints:");
for (std::size_t i = 0; i < film.paysRestreints_.size(); i++)
{
stream << "\n\t\t" << getPaysString(film.paysRestreints_[i]);
}
stream << '\n';
return stream;
}
// Méthode qui retourne le genre du film
// \return Le genre du film
Film::Genre Film::getGenre() const
{
return genre_;
}
// Méthode qui retourne si le film est restreint aux moins de 16 ans
// \return Un bool représentant si le film est restreint aux moins de 16 ans
bool Film::estRestreintParAge() const
{
return estRestreintParAge_;
}
// Méthode qui retourne le nom du film
// \return Le nom du film
const std::string& Film::getNom() const
{
return nom_;
}
// Méthode qui retourne l'auteur
// \return L'auteur du film
Auteur* Film::getAuteur()
{
return auteur_;
}
| [
"noreply@github.com"
] | noreply@github.com |
8ccbf98390d44ed7ba6e79a954b7af6164720e93 | 117aaf186609e48230bff9f4f4e96546d3484963 | /questions/50570554/mainwindow.cpp | 4cc719a5ad78ba09048599e516d673177f019049 | [
"MIT"
] | permissive | eyllanesc/stackoverflow | 8d1c4b075e578496ea8deecbb78ef0e08bcc092e | db738fbe10e8573b324d1f86e9add314f02c884d | refs/heads/master | 2022-08-19T22:23:34.697232 | 2022-08-10T20:59:17 | 2022-08-10T20:59:17 | 76,124,222 | 355 | 433 | MIT | 2022-08-10T20:59:18 | 2016-12-10T16:29:34 | C++ | UTF-8 | C++ | false | false | 325 | cpp | #include "mainwindow.h"
#include "custombutton.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow) {
ui->setupUi(this);
CustomButton *custom = new CustomButton(this);
custom->resize(200, custom->height());
}
MainWindow::~MainWindow() { delete ui; }
| [
"e.yllanescucho@gmail.com"
] | e.yllanescucho@gmail.com |
a7a38569f3fc0c8791089d9dbe379fde60849184 | 946c544e8390d1e9269f571dbe4333b7735e7026 | /Code/WeaponClientServer.cpp | dfa6a7e89b37bfc423d10bca511b221a85407298 | [] | no_license | blockspacer/destructionderby | f5681908c75e063d4730350b328ddd7b3c51b097 | cd693a2bfa90ddbe4b1869ca812e9ada2d44ceb3 | refs/heads/master | 2021-06-01T08:50:06.910800 | 2013-01-03T13:33:53 | 2013-01-03T13:33:53 | null | 0 | 0 | null | null | null | null | WINDOWS-1250 | C++ | false | false | 24,512 | cpp | /*************************************************************************
Crytek Source File.
Copyright (C), Crytek Studios, 2001-2004.
-------------------------------------------------------------------------
$Id$
$DateTime$
-------------------------------------------------------------------------
History:
- 15:2:2006 12:50 : Created by Márcio Martins
*************************************************************************/
#include "StdAfx.h"
#include "Weapon.h"
#include "Actor.h"
#include "Game.h"
#include "GameRules.h"
#include "Single.h"
/*
#define CHECK_OWNER_REQUEST() \
{ \
uint16 channelId=m_pGameFramework->GetGameChannelId(pNetChannel); \
IActor *pOwnerActor=GetOwnerActor(); \
if (!pOwnerActor || pOwnerActor->GetChannelId()!=channelId) \
{ \
CryLogAlways("[gamenet] Disconnecting %s. Bogus weapon action '%s' request! %s %d!=%d (%s!=%s)", \
pNetChannel->GetName(), __FUNCTION__, pOwnerActor?pOwnerActor->GetEntity()->GetName():"null", \
pOwnerActor?pOwnerActor->GetChannelId():0, channelId,\
pOwnerActor?pOwnerActor->GetEntity()->GetName():"null", \
m_pGameFramework->GetIActorSystem()->GetActorByChannelId(channelId)?m_pGameFramework->GetIActorSystem()->GetActorByChannelId(channelId)->GetEntity()->GetName():"null"); \
return false; \
} \
} \
*/
#define CHECK_OWNER_REQUEST() \
{ \
uint16 channelId=m_pGameFramework->GetGameChannelId(pNetChannel); \
IActor *pOwnerActor=GetOwnerActor(); \
if (pOwnerActor && pOwnerActor->GetChannelId()!=channelId && !IsDemoPlayback()) \
return true; \
}
//------------------------------------------------------------------------
int CWeapon::NetGetCurrentAmmoCount() const
{
if (!m_fm)
return 0;
return GetAmmoCount(m_fm->GetAmmoType());
}
//------------------------------------------------------------------------
void CWeapon::NetSetCurrentAmmoCount(int count)
{
if (!m_fm)
return;
SetAmmoCount(m_fm->GetAmmoType(), count);
}
//------------------------------------------------------------------------
void CWeapon::NetShoot(const Vec3 &hit, int predictionHandle)
{
if (m_fm)
m_fm->NetShoot(hit, predictionHandle);
}
//------------------------------------------------------------------------
void CWeapon::NetShootEx(const Vec3 &pos, const Vec3 &dir, const Vec3 &vel, const Vec3 &hit, float extra, int predictionHandle)
{
if (m_fm)
m_fm->NetShootEx(pos, dir, vel, hit, extra, predictionHandle);
}
//------------------------------------------------------------------------
void CWeapon::NetStartFire()
{
if (m_fm)
m_fm->NetStartFire();
}
//------------------------------------------------------------------------
void CWeapon::NetStopFire()
{
if (m_fm)
m_fm->NetStopFire();
}
//------------------------------------------------------------------------
void CWeapon::NetStartSecondaryFire()
{
if (m_fm)
m_fm->NetStartSecondaryFire();
//gEnv->pLog->Log("<<< NetStartSecondaryFire!!! >>>");
}
//------------------------------------------------------------------------
void CWeapon::NetStartMeleeAttack(bool weaponMelee)
{
if (weaponMelee && m_melee)
m_melee->NetStartFire();
else if (m_fm)
m_fm->NetStartFire();
}
//------------------------------------------------------------------------
void CWeapon::NetMeleeAttack(bool weaponMelee, const Vec3 &pos, const Vec3 &dir)
{
if (weaponMelee && m_melee)
{
m_melee->NetShootEx(pos, dir, ZERO, ZERO, 1.0f, 0);
if (IsServer())
m_pGameplayRecorder->Event(GetOwner(), GameplayEvent(eGE_WeaponMelee, 0, 0, (void *)GetEntityId()));
}
else if (m_fm)
{
m_fm->NetShootEx(pos, dir, ZERO, ZERO, 1.0f, 0);
if (IsServer())
m_pGameplayRecorder->Event(GetOwner(), GameplayEvent(eGE_WeaponMelee, 0, 0, (void *)GetEntityId()));
}
}
//------------------------------------------------------------------------
void CWeapon::NetZoom(float fov)
{
if (CActor *pOwner=GetOwnerActor())
{
if (pOwner->IsClient())
return;
SActorParams *pActorParams = pOwner->GetActorParams();
if (!pActorParams)
return;
pActorParams->viewFoVScale = fov;
}
}
//------------------------------------------------------------------------
void CWeapon::RequestShoot(IEntityClass* pAmmoType, const Vec3 &pos, const Vec3 &dir, const Vec3 &vel, const Vec3 &hit, float extra, int predictionHandle, uint16 seq, uint8 seqr, bool forceExtended)
{
IActor *pActor=m_pGameFramework->GetClientActor();
if ((!pActor || pActor->IsClient()) && IsClient())
{
if (pActor)
pActor->GetGameObject()->Pulse('bang');
GetGameObject()->Pulse('bang');
if (IsServerSpawn(pAmmoType) || forceExtended)
GetGameObject()->InvokeRMI(CWeapon::SvRequestShootEx(), SvRequestShootExParams(pos, dir, vel, hit, extra, predictionHandle, seq, seqr), eRMI_ToServer);
else
GetGameObject()->InvokeRMI(CWeapon::SvRequestShoot(), SvRequestShootParams(pos, dir, hit, predictionHandle, seq, seqr), eRMI_ToServer);
}
else if (!IsClient() && IsServer())
{
if (IsServerSpawn(pAmmoType) || forceExtended)
{
GetGameObject()->InvokeRMI(CWeapon::ClShoot(), ClShootParams(pos+dir*5.0f, predictionHandle), eRMI_ToAllClients);
NetShootEx(pos, dir, vel, hit, extra, predictionHandle);
}
else
{
GetGameObject()->InvokeRMI(CWeapon::ClShoot(), ClShootParams(hit, predictionHandle), eRMI_ToAllClients);
NetShoot(hit, predictionHandle);
}
}
}
//------------------------------------------------------------------------
void CWeapon::RequestMeleeAttack(bool weaponMelee, const Vec3 &pos, const Vec3 &dir, uint16 seq)
{
IActor *pActor=m_pGameFramework->GetClientActor();
if ((!pActor || pActor->IsClient()) && IsClient())
GetGameObject()->InvokeRMI(CWeapon::SvRequestMeleeAttack(), RequestMeleeAttackParams(weaponMelee, pos, dir, seq), eRMI_ToServer);
else if (!IsClient() && IsServer())
{
GetGameObject()->InvokeRMI(CWeapon::ClMeleeAttack(), ClMeleeAttackParams(weaponMelee, pos, dir), eRMI_ToAllClients);
NetMeleeAttack(weaponMelee, pos, dir);
}
}
//------------------------------------------------------------------------
void CWeapon::RequestStartFire()
{
IActor *pActor=m_pGameFramework->GetClientActor();
if ((!pActor || pActor->IsClient()) && IsClient())
GetGameObject()->InvokeRMI(CWeapon::SvRequestStartFire(), EmptyParams(), eRMI_ToServer);
else if (!IsClient() && IsServer())
GetGameObject()->InvokeRMI(CWeapon::ClStartFire(), EmptyParams(), eRMI_ToAllClients);
}
//------------------------------------------------------------------------
void CWeapon::RequestStartMeleeAttack(bool weaponMelee)
{
IActor *pActor=m_pGameFramework->GetClientActor();
if ((!pActor || pActor->IsClient()) && IsClient())
GetGameObject()->InvokeRMI(CWeapon::SvRequestStartMeleeAttack(), RequestStartMeleeAttackParams(weaponMelee), eRMI_ToServer);
else if (!IsClient() && IsServer())
{
GetGameObject()->InvokeRMI(CWeapon::ClStartMeleeAttack(), RequestStartMeleeAttackParams(weaponMelee), eRMI_ToAllClients);
NetStartMeleeAttack(weaponMelee);
}
}
//------------------------------------------------------------------------
void CWeapon::RequestZoom(float fov)
{
IActor *pActor=m_pGameFramework->GetClientActor();
if ((!pActor || pActor->IsClient()) && IsClient())
GetGameObject()->InvokeRMI(CWeapon::SvRequestZoom(), ZoomParams(fov), eRMI_ToServer);
else if (!IsClient() && IsServer())
{
GetGameObject()->InvokeRMI(CWeapon::ClZoom(), ZoomParams(fov), eRMI_ToAllClients);
NetZoom(fov);
}
}
//------------------------------------------------------------------------
void CWeapon::RequestStopFire()
{
IActor *pActor=m_pGameFramework->GetClientActor();
if ((!pActor || pActor->IsClient()) && IsClient())
GetGameObject()->InvokeRMI(CWeapon::SvRequestStopFire(), EmptyParams(), eRMI_ToServer);
else if (!IsClient() && IsServer())
GetGameObject()->InvokeRMI(CWeapon::ClStopFire(), EmptyParams(), eRMI_ToAllClients);
}
//------------------------------------------------------------------------
void CWeapon::RequestReload()
{
IActor *pActor=m_pGameFramework->GetClientActor();
if ((!pActor || pActor->IsClient()) && IsClient())
GetGameObject()->InvokeRMI(SvRequestReload(), EmptyParams(), eRMI_ToServer);
else if (!IsClient() && IsServer())
GetGameObject()->InvokeRMI(CWeapon::ClReload(), EmptyParams(), eRMI_ToAllClients);
}
//-----------------------------------------------------------------------
void CWeapon::RequestCancelReload()
{
IActor *pActor=m_pGameFramework->GetClientActor();
if ((!pActor || pActor->IsClient()) && IsClient())
GetGameObject()->InvokeRMI(SvRequestCancelReload(), EmptyParams(), eRMI_ToServer);
else if (!IsClient() && IsServer())
GetGameObject()->InvokeRMI(CWeapon::ClCancelReload(), EmptyParams(), eRMI_ToAllClients);
}
//------------------------------------------------------------------------
void CWeapon::RequestFireMode(int fmId)
{
IActor *pActor=m_pGameFramework->GetClientActor();
if (!pActor || pActor->IsClient())
{
if (gEnv->bServer)
SetCurrentFireMode(fmId); // serialization will fix the rest.
else
GetGameObject()->InvokeRMI(SvRequestFireMode(), SvRequestFireModeParams(fmId), eRMI_ToServer);
}
}
//------------------------------------------------------------------------
void CWeapon::RequestLock(EntityId id, int partId)
{
IActor *pActor=m_pGameFramework->GetClientActor();
if (!pActor || pActor->IsClient())
{
if (gEnv->bServer)
{
if (m_fm)
m_fm->Lock(id, partId);
GetGameObject()->InvokeRMI(CWeapon::ClLock(), LockParams(id, partId), eRMI_ToRemoteClients);
}
else
GetGameObject()->InvokeRMI(SvRequestLock(), LockParams(id, partId), eRMI_ToServer);
}
}
//------------------------------------------------------------------------
void CWeapon::RequestUnlock()
{
IActor *pActor=m_pGameFramework->GetClientActor();
if (!pActor || pActor->IsClient())
GetGameObject()->InvokeRMI(SvRequestUnlock(), EmptyParams(), eRMI_ToServer);
}
//------------------------------------------------------------------------
void CWeapon::RequestWeaponRaised(bool raise)
{
if(gEnv->bMultiplayer)
{
CActor* pActor = GetOwnerActor();
if(pActor && pActor->IsClient())
{
if (gEnv->bServer)
GetGameObject()->InvokeRMI(ClWeaponRaised(), WeaponRaiseParams(raise), eRMI_ToRemoteClients|eRMI_NoLocalCalls);
else
GetGameObject()->InvokeRMI(SvRequestWeaponRaised(), WeaponRaiseParams(raise), eRMI_ToServer);
}
}
}
//------------------------------------------------------------------------
void CWeapon::RequestStartSecondaryFire()
{
IActor *pActor=m_pGameFramework->GetClientActor();
if ((!pActor || pActor->IsClient()) && IsClient())
GetGameObject()->InvokeRMI(CWeapon::SvRequestStartSecondaryFire(), EmptyParams(), eRMI_ToServer);
else if (!IsClient() && IsServer())
GetGameObject()->InvokeRMI(CWeapon::ClStartSecondaryFire(), EmptyParams(), eRMI_ToAllClients);
}
//------------------------------------------------------------------------
void CWeapon::SendEndReload()
{
int channelId=0;
if (CActor* pActor = GetOwnerActor())
channelId=pActor->GetChannelId();
GetGameObject()->InvokeRMI(ClEndReload(), EmptyParams(), eRMI_ToClientChannel|eRMI_NoLocalCalls, channelId);
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, SvRequestStartFire)
{
CHECK_OWNER_REQUEST();
GetGameObject()->InvokeRMI(CWeapon::ClStartFire(), params, eRMI_ToOtherClients|eRMI_NoLocalCalls,
m_pGameFramework->GetGameChannelId(pNetChannel));
CActor *pActor=GetActorByNetChannel(pNetChannel);
IActor *pLocalActor=m_pGameFramework->GetClientActor();
bool isLocal = pLocalActor && pActor && (pLocalActor->GetChannelId() == pActor->GetChannelId());
if (!isLocal)
NetStartFire();
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, SvRequestStopFire)
{
CHECK_OWNER_REQUEST();
GetGameObject()->InvokeRMI(CWeapon::ClStopFire(), params, eRMI_ToOtherClients|eRMI_NoLocalCalls,
m_pGameFramework->GetGameChannelId(pNetChannel));
CActor *pActor=GetActorByNetChannel(pNetChannel);
IActor *pLocalActor=m_pGameFramework->GetClientActor();
bool isLocal = pLocalActor && pActor && (pLocalActor->GetChannelId() == pActor->GetChannelId());
if (!isLocal)
NetStopFire();
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, ClStartFire)
{
NetStartFire();
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, ClStopFire)
{
NetStopFire();
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, SvRequestShoot)
{
CHECK_OWNER_REQUEST();
bool ok=true;
CActor *pActor=GetActorByNetChannel(pNetChannel);
if (!pActor || pActor->GetHealth()<=0)
ok=false;
ok &= !OutOfAmmo(false);
if (ok)
{
if (pActor)
pActor->GetGameObject()->Pulse('bang');
GetGameObject()->Pulse('bang');
static ray_hit rh;
IEntity* pEntity = NULL;
IPhysicalEntity* pSkipEnts[10];
int nSkipEnts = CSingle::GetSkipEntities(this, pSkipEnts, 10);
if ( gEnv->pPhysicalWorld->RayWorldIntersection(params.pos, params.dir*4096.0f, ent_all & ~ent_terrain, rwi_stop_at_pierceable|rwi_ignore_back_faces, &rh, 1, pSkipEnts, nSkipEnts) )
pEntity = gEnv->pEntitySystem->GetEntityFromPhysics(rh.pCollider);
if (pEntity)
{
if(INetContext* pNC = gEnv->pGame->GetIGameFramework()->GetNetContext())
{
if(pNC->IsBound(pEntity->GetId()))
{
AABB bbox; pEntity->GetWorldBounds(bbox);
bool hit0 = bbox.GetRadius() < 1.0f; // this (radius*2) must match the value in CompressionPolicy.xml ("hit0")
Vec3 hitLocal = pEntity->GetWorldTM().GetInvertedFast() * rh.pt;
//GetGameObject()->InvokeRMI(CWeapon::ClShootX(), ClShootXParams(pEntity->GetId(), hit0, hitLocal, params.predictionHandle),
// eRMI_ToOtherClients|eRMI_NoLocalCalls, m_pGameFramework->GetGameChannelId(pNetChannel));
GetGameObject()->InvokeRMIWithDependentObject(CWeapon::ClShootX(), ClShootXParams(pEntity->GetId(), hit0, hitLocal, params.predictionHandle),
eRMI_ToOtherClients|eRMI_NoLocalCalls, pEntity->GetId(), m_pGameFramework->GetGameChannelId(pNetChannel));
}
}
}
else
GetGameObject()->InvokeRMI(CWeapon::ClShoot(), ClShootParams(params.hit, params.predictionHandle),
eRMI_ToOtherClients|eRMI_NoLocalCalls, m_pGameFramework->GetGameChannelId(pNetChannel));
IActor *pLocalActor=m_pGameFramework->GetClientActor();
bool isLocal = pLocalActor && (pLocalActor->GetChannelId() == pActor->GetChannelId());
if (!isLocal)
NetShoot(params.hit, params.predictionHandle);
if (pActor && !isLocal && params.seq)
{
if (CGameRules *pGameRules=g_pGame->GetGameRules())
pGameRules->ValidateShot(pActor->GetEntityId(), GetEntityId(), params.seq, params.seqr);
}
}
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, SvRequestShootEx)
{
CHECK_OWNER_REQUEST();
bool ok=true;
CActor *pActor=GetActorByNetChannel(pNetChannel);
if (!pActor || pActor->GetHealth()<=0)
ok=false;
ok &= !OutOfAmmo(false);
if (ok)
{
if (pActor)
pActor->GetGameObject()->Pulse('bang');
GetGameObject()->Pulse('bang');
GetGameObject()->InvokeRMI(CWeapon::ClShoot(), ClShootParams(params.pos+params.dir*5.0f, params.predictionHandle),
eRMI_ToOtherClients|eRMI_NoLocalCalls, m_pGameFramework->GetGameChannelId(pNetChannel));
IActor *pLocalActor=m_pGameFramework->GetClientActor();
bool isLocal = pLocalActor && (pLocalActor->GetChannelId() == pActor->GetChannelId());
if (!isLocal)
NetShootEx(params.pos, params.dir, params.vel, params.hit, params.extra, params.predictionHandle);
if (pActor && !isLocal && params.seq)
{
if (CGameRules *pGameRules=g_pGame->GetGameRules())
pGameRules->ValidateShot(pActor->GetEntityId(), GetEntityId(), params.seq, params.seqr);
}
}
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, ClShoot)
{
NetShoot(params.hit, params.predictionHandle);
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, ClShootX)
{
if (IEntity* pEntity = gEnv->pEntitySystem->GetEntity(params.eid))
{
Vec3 hit = pEntity->GetWorldTM() * params.hit;
NetShoot(hit, params.predictionHandle);
}
else
{
GameWarning("ClShootX: invalid entity id %.8x", params.eid);
}
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, SvRequestStartMeleeAttack)
{
CHECK_OWNER_REQUEST();
GetGameObject()->InvokeRMI(CWeapon::ClStartMeleeAttack(), params, eRMI_ToOtherClients | eRMI_NoLocalCalls,
m_pGameFramework->GetGameChannelId(pNetChannel));
CActor *pActor=GetActorByNetChannel(pNetChannel);
IActor *pLocalActor=m_pGameFramework->GetClientActor();
bool isLocal = pLocalActor && pActor && (pLocalActor->GetChannelId() == pActor->GetChannelId());
if (!isLocal)
NetStartMeleeAttack(params.wmelee);
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, ClStartMeleeAttack)
{
NetStartMeleeAttack(params.wmelee);
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, SvRequestMeleeAttack)
{
CHECK_OWNER_REQUEST();
bool ok=true;
CActor *pActor=GetActorByNetChannel(pNetChannel);
if (pActor && pActor->GetHealth()<=0)
ok=false;
if (ok)
{
GetGameObject()->InvokeRMI(CWeapon::ClMeleeAttack(), ClMeleeAttackParams(params.wmelee, params.pos, params.dir),
eRMI_ToOtherClients|eRMI_NoLocalCalls, m_pGameFramework->GetGameChannelId(pNetChannel));
IActor *pLocalActor=m_pGameFramework->GetClientActor();
bool isLocal = pLocalActor && (pLocalActor->GetChannelId() == pActor->GetChannelId());
if (!isLocal)
NetMeleeAttack(params.wmelee, params.pos, params.dir);
if (pActor && !isLocal && params.seq)
{
if (CGameRules *pGameRules=g_pGame->GetGameRules())
pGameRules->ValidateShot(pActor->GetEntityId(), GetEntityId(), params.seq, 0);
}
m_pGameplayRecorder->Event(GetOwner(), GameplayEvent(eGE_WeaponMelee, 0, 0, (void *)GetEntityId()));
}
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, ClMeleeAttack)
{
NetMeleeAttack(params.wmelee, params.pos, params.dir);
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, SvRequestZoom)
{
CHECK_OWNER_REQUEST();
bool ok=true;
CActor *pActor=GetActorByNetChannel(pNetChannel);
if (!pActor || pActor->GetHealth()<=0)
ok=false;
if (ok)
{
GetGameObject()->InvokeRMI(CWeapon::ClZoom(), params,
eRMI_ToOtherClients|eRMI_NoLocalCalls, m_pGameFramework->GetGameChannelId(pNetChannel));
IActor *pLocalActor=m_pGameFramework->GetClientActor();
bool isLocal = pLocalActor && (pLocalActor->GetChannelId() == pActor->GetChannelId());
if (!isLocal)
NetZoom(params.fov);
int event=eGE_ZoomedOut;
if (params.fov<0.99f)
event=eGE_ZoomedIn;
m_pGameplayRecorder->Event(GetOwner(), GameplayEvent(event, 0, 0, (void *)GetEntityId()));
}
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, ClZoom)
{
NetZoom(params.fov);
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, SvRequestFireMode)
{
CHECK_OWNER_REQUEST();
SetCurrentFireMode(params.id);
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, ClSetFireMode)
{
SetCurrentFireMode(params.id);
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, SvRequestReload)
{
CHECK_OWNER_REQUEST();
bool ok=true;
CActor *pActor=GetActorByNetChannel(pNetChannel);
if (!pActor || pActor->GetHealth()<=0)
ok=false;
if (ok)
{
GetGameObject()->InvokeRMI(CWeapon::ClReload(), params, eRMI_ToOtherClients|eRMI_NoLocalCalls, m_pGameFramework->GetGameChannelId(pNetChannel));
IActor *pLocalActor=m_pGameFramework->GetClientActor();
bool isLocal = pLocalActor && (pLocalActor->GetChannelId() == pActor->GetChannelId());
if (!isLocal && m_fm)
m_fm->Reload(0);
m_pGameplayRecorder->Event(GetOwner(), GameplayEvent(eGE_WeaponReload, 0, 0, (void *)GetEntityId()));
}
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, ClReload)
{
if (m_fm)
{
if(m_zm)
m_fm->Reload(m_zm->GetCurrentStep());
else
m_fm->Reload(false);
}
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, ClEndReload)
{
if(m_fm)
m_fm->NetEndReload();
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, SvRequestCancelReload)
{
CHECK_OWNER_REQUEST();
if(m_fm)
{
m_fm->CancelReload();
GetGameObject()->InvokeRMI(CWeapon::ClCancelReload(), params, eRMI_ToRemoteClients);
}
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, ClCancelReload)
{
if(m_fm)
m_fm->CancelReload();
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, ClLock)
{
if (m_fm)
m_fm->Lock(params.entityId, params.partId);
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, ClUnlock)
{
if (m_fm)
m_fm->Unlock();
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, SvRequestLock)
{
CHECK_OWNER_REQUEST();
if (m_fm)
m_fm->Lock(params.entityId, params.partId);
GetGameObject()->InvokeRMI(CWeapon::ClLock(), params, eRMI_ToRemoteClients);
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, SvRequestUnlock)
{
CHECK_OWNER_REQUEST();
if (m_fm)
m_fm->Unlock();
GetGameObject()->InvokeRMI(CWeapon::ClUnlock(), params, eRMI_ToRemoteClients);
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, SvRequestWeaponRaised)
{
CHECK_OWNER_REQUEST();
GetGameObject()->InvokeRMI(CWeapon::ClWeaponRaised(), params, eRMI_ToAllClients);
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, ClWeaponRaised)
{
CActor* pActor = GetOwnerActor();
if(pActor && !pActor->IsClient())
RaiseWeapon(params.raise);
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, SvRequestStartSecondaryFire)
{
CHECK_OWNER_REQUEST();
CActor *pActor=GetActorByNetChannel(pNetChannel);
if (!pActor || pActor->GetHealth()<=0)
return true;
GetGameObject()->InvokeRMI(CWeapon::ClStartSecondaryFire(), params, eRMI_ToAllClients,
m_pGameFramework->GetGameChannelId(pNetChannel));
IActor *pLocalActor=m_pGameFramework->GetClientActor();
// NOTE: only recall for dedicated server (!IsClient()), otherwise one will receive a double call on server and client setup
bool isLocal = pLocalActor && pActor && (pLocalActor->GetChannelId() == pActor->GetChannelId());
if (!isLocal && !IsClient())
NetStartSecondaryFire();
//GetGameObject()->InvokeRMI(CWeapon::ClStartSecondaryFire(), params, eRMI_ToAllClients);
return true;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CWeapon, ClStartSecondaryFire)
{
NetStartSecondaryFire();
return true;
}
| [
"mrhankey88@gmx.de"
] | mrhankey88@gmx.de |
f8f3aa7682566914e5338e2a874541826e95c7cd | 658dd4a71ce689ef6338894628d8cdb59a595ba5 | /COJ/KhozmoS-p4126-Accepted-s1301698.cc | f2005861b4429583827c9c478ee5b8c1c14805c5 | [] | no_license | KhozmoS/Competitive-Programming-Solutions | 4d8be747efc7feb29a5f70dc6c1ea1bd26c9e78c | 9cb7b6e500854ab22fc405c2c5c4f444e06e7056 | refs/heads/master | 2021-02-04T09:17:18.818228 | 2020-02-28T01:24:11 | 2020-02-28T01:24:11 | 243,648,605 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 372 | cc | #include<bits/stdc++.h>
using namespace std;
const int N=100100;
bool t[N]={1,1};
int a[500],b[500],n,m,i,j,x;
int main() {
for(i=2;i*i<N;++i) if(!t[i])
for(j=i*i;j<N;j+=i) t[j]=1;
cin>>n>>m;
for(i=0;i<n;++i)
for(j=0;j<m;++j)
{
int k=0;
for(cin>>x;t[x+k];++k);
a[i]+=k;
b[j]+=k;
}
cout<<min(*min_element(a,a+n),*min_element(b,b+m))<<endl;
}
| [
"khozmos0107@gmail.com"
] | khozmos0107@gmail.com |
303a70fae6633a3ab5e825c6023c6640d74433af | 9edc46f08cd03a327b3b3868f9437893e78ace90 | /progect(Qt_Creator)/sign_in.h | 3cfa5bfc69b2032797620b5c04da741e0c2ef868 | [] | no_license | Andriy1024/myCplusplusProject | f674e2f7490c3d6981abedb616881c37dedd3fc0 | fc6a0c67cdb20db04440b415e67864dd1cf48918 | refs/heads/master | 2020-04-26T06:10:09.679882 | 2019-03-01T19:23:20 | 2019-03-01T19:23:20 | 173,356,406 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 541 | h | #ifndef SIGN_IN_H
#define SIGN_IN_H
#include <QDialog>
#include <QCloseEvent>
namespace Ui {
class sign_in;
}
class sign_in : public QDialog
{
Q_OBJECT
public:
explicit sign_in(QWidget *parent = 0);
~sign_in();
void getpass(QString *pass){
password = *pass;
}
private:
Ui::sign_in *ui;
QString password;
QString temp;
signals:
void rightpass();
private slots:
void on_ok_clicked();
void on_cancel_clicked();
protected:
void closeEvent(QCloseEvent * event);
};
#endif // SIGN_IN_H
| [
"32951480+Andriy1024@users.noreply.github.com"
] | 32951480+Andriy1024@users.noreply.github.com |
b2c0c80efe08c3b5165b6cd341ed3cf96e68b71e | 634120df190b6262fccf699ac02538360fd9012d | /Develop/Tools/ClientResourceValidator/ValidatorApp/VMeshInfoLoader.h | d082740b41c380bebf34217e8812930ccc658291 | [] | no_license | ktj007/Raiderz_Public | c906830cca5c644be384e68da205ee8abeb31369 | a71421614ef5711740d154c961cbb3ba2a03f266 | refs/heads/master | 2021-06-08T03:37:10.065320 | 2016-11-28T07:50:57 | 2016-11-28T07:50:57 | 74,959,309 | 6 | 4 | null | 2016-11-28T09:53:49 | 2016-11-28T09:53:49 | null | UTF-8 | C++ | false | false | 588 | h | #pragma once
#include "VFileName.h"
#include "VInfoLoader.h"
class VMeshInfoLoader : public VInfoLoader
{
private:
vector<FILENAME_DATA> m_vecMeshFileList;
private:
void GetMeshFileLIst();
public:
VMeshInfoLoader();
virtual ~VMeshInfoLoader();
virtual void Init();
virtual void Load(BackgroundWorker^ worker, VValidatorInfoMgr * pValidatorInfoMgr, int nFullCompleteCount, int& nCurrCompleteCount, int& nMsgIndex);
virtual int GetLoadingCount() { return m_vecMeshFileList.size(); }
virtual LOADING_STATE GetID() { return LS_MESH_INFO; }
};
| [
"espause0703@gmail.com"
] | espause0703@gmail.com |
12424684bbd2159b7fee06e386c43ef0ba328b65 | 29f2c40392489fc1656010f2c9b384fd0b090847 | /units/sea_doctest.hh | 05dda5624d74529db89189bb5c2e38ed90b05744 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | seahorn/seahorn | 6498777c0d12716379035c0bc102b9baec6f28f9 | 2bab7831960766a0a16f149adcdce55f0651eb8f | refs/heads/main | 2023-08-25T13:51:48.354660 | 2023-08-11T00:48:27 | 2023-08-14T16:43:13 | 31,487,486 | 423 | 126 | NOASSERTION | 2023-09-08T21:30:09 | 2015-03-01T05:08:17 | C | UTF-8 | C++ | false | false | 276 | hh | //
// Wrapper over doctest.h to workaround macro name clash with Sealog.hh
//
#ifndef SEAHORN_SEA_DOCTEST_HH
#define SEAHORN_SEA_DOCTEST_HH
// workaround(test): to avoid name clash with doctest.h
#undef WARN
#undef INFO
#include "doctest.h"
#endif // SEAHORN_SEA_DOCTEST_HH
| [
"priya.siddharth@gmail.com"
] | priya.siddharth@gmail.com |
ab8f811613f1804c96b4e1450521277c93079530 | 4718b9b11110db8eb23980c6d12940bd5b754f34 | /bench/ml2cpp-demo/AdaBoostClassifier/iris_date_tgt/ml2cpp-demo_AdaBoostClassifier_iris_date_tgt.cpp | f8baa0d66a75a1b976560726db1da8365f2e7b94 | [
"BSD-3-Clause"
] | permissive | ssh352/ml2cpp | 74d38935256cf9d034d08ede37a7d8bdcfa25540 | 999eb1e7238b9ee2ee32d47ac4f12e1530a3ba6f | refs/heads/master | 2023-01-27T12:07:15.929729 | 2020-12-07T12:26:54 | 2020-12-07T12:26:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 45,133 | cpp | // ********************************************************
// This C++ code was automatically generated by ml2cpp (development version).
// Copyright 2020
// https://github.com/antoinecarme/ml2cpp
// Model : AdaBoostClassifier
// Dataset : iris_date_tgt
// This CPP code can be compiled using any C++-17 compiler.
// g++ -Wall -Wno-unused-function -std=c++17 -g -o ml2cpp-demo_AdaBoostClassifier_iris_date_tgt.exe ml2cpp-demo_AdaBoostClassifier_iris_date_tgt.cpp
// Model deployment code
// ********************************************************
#include "../../Generic.i"
namespace {
std::vector<std::any> get_classes(){
std::vector<std::any> lClasses = { 1789-07-14T00:00:00.000000000, 1789-08-14T00:00:00.000000000, 1789-09-14T00:00:00.000000000 };
return lClasses;
}
namespace SubModel_0 {
std::vector<std::any> get_classes(){
std::vector<std::any> lClasses = { 1789-07-14T00:00:00.000000000, 1789-08-14T00:00:00.000000000, 1789-09-14T00:00:00.000000000 };
return lClasses;
}
typedef std::vector<double> tNodeData;
std::map<int, tNodeData> Decision_Tree_Node_data = {
{ 1 , {1.0, 0.0, 0.0 }} ,
{ 2 , {0.0, 0.4819277108433735, 0.5180722891566266 }}
};
int get_decision_tree_node_index(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
int lNodeIndex = (Feature_2 <= 2.449999988079071) ? ( 1 ) : ( 2 );
return lNodeIndex;
}
std::vector<std::string> get_input_names(){
std::vector<std::string> lFeatures = { "Feature_0", "Feature_1", "Feature_2", "Feature_3" };
return lFeatures;
}
std::vector<std::string> get_output_names(){
std::vector<std::string> lOutputs = {
"Score_1789-07-14T00:00:00.000000000", "Score_1789-08-14T00:00:00.000000000", "Score_1789-09-14T00:00:00.000000000",
"Proba_1789-07-14T00:00:00.000000000", "Proba_1789-08-14T00:00:00.000000000", "Proba_1789-09-14T00:00:00.000000000",
"LogProba_1789-07-14T00:00:00.000000000", "LogProba_1789-08-14T00:00:00.000000000", "LogProba_1789-09-14T00:00:00.000000000",
"Decision", "DecisionProba" };
return lOutputs;
}
tTable compute_classification_scores(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
auto lClasses = get_classes();
int lNodeIndex = get_decision_tree_node_index(Feature_0, Feature_1, Feature_2, Feature_3);
std::vector<double> lNodeValue = Decision_Tree_Node_data[ lNodeIndex ];
tTable lTable;
lTable["Score"] = {
std::any(),
std::any(),
std::any()
} ;
lTable["Proba"] = {
lNodeValue [ 0 ],
lNodeValue [ 1 ],
lNodeValue [ 2 ]
} ;
int lBestClass = get_arg_max( lTable["Proba"] );
auto lDecision = lClasses[lBestClass];
lTable["Decision"] = { lDecision } ;
lTable["DecisionProba"] = { lTable["Proba"][lBestClass] };
recompute_log_probas( lTable );
return lTable;
}
tTable compute_model_outputs_from_table( tTable const & iTable) {
tTable lTable = compute_classification_scores(iTable.at("Feature_0")[0], iTable.at("Feature_1")[0], iTable.at("Feature_2")[0], iTable.at("Feature_3")[0]);
return lTable;
}
} // eof namespace SubModel_0
namespace SubModel_1 {
std::vector<std::any> get_classes(){
std::vector<std::any> lClasses = { 1789-07-14T00:00:00.000000000, 1789-08-14T00:00:00.000000000, 1789-09-14T00:00:00.000000000 };
return lClasses;
}
typedef std::vector<double> tNodeData;
std::map<int, tNodeData> Decision_Tree_Node_data = {
{ 1 , {4.412618350835303e-06, 0.9521202749995236, 0.04787531238212566 }} ,
{ 2 , {0.0, 0.07292255511588465, 0.9270774448841154 }}
};
int get_decision_tree_node_index(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
int lNodeIndex = (Feature_2 <= 4.8500001430511475) ? ( 1 ) : ( 2 );
return lNodeIndex;
}
std::vector<std::string> get_input_names(){
std::vector<std::string> lFeatures = { "Feature_0", "Feature_1", "Feature_2", "Feature_3" };
return lFeatures;
}
std::vector<std::string> get_output_names(){
std::vector<std::string> lOutputs = {
"Score_1789-07-14T00:00:00.000000000", "Score_1789-08-14T00:00:00.000000000", "Score_1789-09-14T00:00:00.000000000",
"Proba_1789-07-14T00:00:00.000000000", "Proba_1789-08-14T00:00:00.000000000", "Proba_1789-09-14T00:00:00.000000000",
"LogProba_1789-07-14T00:00:00.000000000", "LogProba_1789-08-14T00:00:00.000000000", "LogProba_1789-09-14T00:00:00.000000000",
"Decision", "DecisionProba" };
return lOutputs;
}
tTable compute_classification_scores(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
auto lClasses = get_classes();
int lNodeIndex = get_decision_tree_node_index(Feature_0, Feature_1, Feature_2, Feature_3);
std::vector<double> lNodeValue = Decision_Tree_Node_data[ lNodeIndex ];
tTable lTable;
lTable["Score"] = {
std::any(),
std::any(),
std::any()
} ;
lTable["Proba"] = {
lNodeValue [ 0 ],
lNodeValue [ 1 ],
lNodeValue [ 2 ]
} ;
int lBestClass = get_arg_max( lTable["Proba"] );
auto lDecision = lClasses[lBestClass];
lTable["Decision"] = { lDecision } ;
lTable["DecisionProba"] = { lTable["Proba"][lBestClass] };
recompute_log_probas( lTable );
return lTable;
}
tTable compute_model_outputs_from_table( tTable const & iTable) {
tTable lTable = compute_classification_scores(iTable.at("Feature_0")[0], iTable.at("Feature_1")[0], iTable.at("Feature_2")[0], iTable.at("Feature_3")[0]);
return lTable;
}
} // eof namespace SubModel_1
namespace SubModel_2 {
std::vector<std::any> get_classes(){
std::vector<std::any> lClasses = { 1789-07-14T00:00:00.000000000, 1789-08-14T00:00:00.000000000, 1789-09-14T00:00:00.000000000 };
return lClasses;
}
typedef std::vector<double> tNodeData;
std::map<int, tNodeData> Decision_Tree_Node_data = {
{ 1 , {1.0, 0.0, 0.0 }} ,
{ 2 , {0.0, 0.5000000000000002, 0.4999999999999998 }}
};
int get_decision_tree_node_index(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
int lNodeIndex = (Feature_3 <= 0.800000011920929) ? ( 1 ) : ( 2 );
return lNodeIndex;
}
std::vector<std::string> get_input_names(){
std::vector<std::string> lFeatures = { "Feature_0", "Feature_1", "Feature_2", "Feature_3" };
return lFeatures;
}
std::vector<std::string> get_output_names(){
std::vector<std::string> lOutputs = {
"Score_1789-07-14T00:00:00.000000000", "Score_1789-08-14T00:00:00.000000000", "Score_1789-09-14T00:00:00.000000000",
"Proba_1789-07-14T00:00:00.000000000", "Proba_1789-08-14T00:00:00.000000000", "Proba_1789-09-14T00:00:00.000000000",
"LogProba_1789-07-14T00:00:00.000000000", "LogProba_1789-08-14T00:00:00.000000000", "LogProba_1789-09-14T00:00:00.000000000",
"Decision", "DecisionProba" };
return lOutputs;
}
tTable compute_classification_scores(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
auto lClasses = get_classes();
int lNodeIndex = get_decision_tree_node_index(Feature_0, Feature_1, Feature_2, Feature_3);
std::vector<double> lNodeValue = Decision_Tree_Node_data[ lNodeIndex ];
tTable lTable;
lTable["Score"] = {
std::any(),
std::any(),
std::any()
} ;
lTable["Proba"] = {
lNodeValue [ 0 ],
lNodeValue [ 1 ],
lNodeValue [ 2 ]
} ;
int lBestClass = get_arg_max( lTable["Proba"] );
auto lDecision = lClasses[lBestClass];
lTable["Decision"] = { lDecision } ;
lTable["DecisionProba"] = { lTable["Proba"][lBestClass] };
recompute_log_probas( lTable );
return lTable;
}
tTable compute_model_outputs_from_table( tTable const & iTable) {
tTable lTable = compute_classification_scores(iTable.at("Feature_0")[0], iTable.at("Feature_1")[0], iTable.at("Feature_2")[0], iTable.at("Feature_3")[0]);
return lTable;
}
} // eof namespace SubModel_2
namespace SubModel_3 {
std::vector<std::any> get_classes(){
std::vector<std::any> lClasses = { 1789-07-14T00:00:00.000000000, 1789-08-14T00:00:00.000000000, 1789-09-14T00:00:00.000000000 };
return lClasses;
}
typedef std::vector<double> tNodeData;
std::map<int, tNodeData> Decision_Tree_Node_data = {
{ 1 , {4.937970304777942e-06, 0.9999503857736846, 4.4676256010536464e-05 }} ,
{ 2 , {0.0, 0.026446267524541277, 0.9735537324754588 }}
};
int get_decision_tree_node_index(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
int lNodeIndex = (Feature_3 <= 1.6500000357627869) ? ( 1 ) : ( 2 );
return lNodeIndex;
}
std::vector<std::string> get_input_names(){
std::vector<std::string> lFeatures = { "Feature_0", "Feature_1", "Feature_2", "Feature_3" };
return lFeatures;
}
std::vector<std::string> get_output_names(){
std::vector<std::string> lOutputs = {
"Score_1789-07-14T00:00:00.000000000", "Score_1789-08-14T00:00:00.000000000", "Score_1789-09-14T00:00:00.000000000",
"Proba_1789-07-14T00:00:00.000000000", "Proba_1789-08-14T00:00:00.000000000", "Proba_1789-09-14T00:00:00.000000000",
"LogProba_1789-07-14T00:00:00.000000000", "LogProba_1789-08-14T00:00:00.000000000", "LogProba_1789-09-14T00:00:00.000000000",
"Decision", "DecisionProba" };
return lOutputs;
}
tTable compute_classification_scores(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
auto lClasses = get_classes();
int lNodeIndex = get_decision_tree_node_index(Feature_0, Feature_1, Feature_2, Feature_3);
std::vector<double> lNodeValue = Decision_Tree_Node_data[ lNodeIndex ];
tTable lTable;
lTable["Score"] = {
std::any(),
std::any(),
std::any()
} ;
lTable["Proba"] = {
lNodeValue [ 0 ],
lNodeValue [ 1 ],
lNodeValue [ 2 ]
} ;
int lBestClass = get_arg_max( lTable["Proba"] );
auto lDecision = lClasses[lBestClass];
lTable["Decision"] = { lDecision } ;
lTable["DecisionProba"] = { lTable["Proba"][lBestClass] };
recompute_log_probas( lTable );
return lTable;
}
tTable compute_model_outputs_from_table( tTable const & iTable) {
tTable lTable = compute_classification_scores(iTable.at("Feature_0")[0], iTable.at("Feature_1")[0], iTable.at("Feature_2")[0], iTable.at("Feature_3")[0]);
return lTable;
}
} // eof namespace SubModel_3
namespace SubModel_4 {
std::vector<std::any> get_classes(){
std::vector<std::any> lClasses = { 1789-07-14T00:00:00.000000000, 1789-08-14T00:00:00.000000000, 1789-09-14T00:00:00.000000000 };
return lClasses;
}
typedef std::vector<double> tNodeData;
std::map<int, tNodeData> Decision_Tree_Node_data = {
{ 1 , {1.0, 0.0, 0.0 }} ,
{ 2 , {0.0, 0.5000000000000008, 0.4999999999999991 }}
};
int get_decision_tree_node_index(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
int lNodeIndex = (Feature_2 <= 2.449999988079071) ? ( 1 ) : ( 2 );
return lNodeIndex;
}
std::vector<std::string> get_input_names(){
std::vector<std::string> lFeatures = { "Feature_0", "Feature_1", "Feature_2", "Feature_3" };
return lFeatures;
}
std::vector<std::string> get_output_names(){
std::vector<std::string> lOutputs = {
"Score_1789-07-14T00:00:00.000000000", "Score_1789-08-14T00:00:00.000000000", "Score_1789-09-14T00:00:00.000000000",
"Proba_1789-07-14T00:00:00.000000000", "Proba_1789-08-14T00:00:00.000000000", "Proba_1789-09-14T00:00:00.000000000",
"LogProba_1789-07-14T00:00:00.000000000", "LogProba_1789-08-14T00:00:00.000000000", "LogProba_1789-09-14T00:00:00.000000000",
"Decision", "DecisionProba" };
return lOutputs;
}
tTable compute_classification_scores(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
auto lClasses = get_classes();
int lNodeIndex = get_decision_tree_node_index(Feature_0, Feature_1, Feature_2, Feature_3);
std::vector<double> lNodeValue = Decision_Tree_Node_data[ lNodeIndex ];
tTable lTable;
lTable["Score"] = {
std::any(),
std::any(),
std::any()
} ;
lTable["Proba"] = {
lNodeValue [ 0 ],
lNodeValue [ 1 ],
lNodeValue [ 2 ]
} ;
int lBestClass = get_arg_max( lTable["Proba"] );
auto lDecision = lClasses[lBestClass];
lTable["Decision"] = { lDecision } ;
lTable["DecisionProba"] = { lTable["Proba"][lBestClass] };
recompute_log_probas( lTable );
return lTable;
}
tTable compute_model_outputs_from_table( tTable const & iTable) {
tTable lTable = compute_classification_scores(iTable.at("Feature_0")[0], iTable.at("Feature_1")[0], iTable.at("Feature_2")[0], iTable.at("Feature_3")[0]);
return lTable;
}
} // eof namespace SubModel_4
namespace SubModel_5 {
std::vector<std::any> get_classes(){
std::vector<std::any> lClasses = { 1789-07-14T00:00:00.000000000, 1789-08-14T00:00:00.000000000, 1789-09-14T00:00:00.000000000 };
return lClasses;
}
typedef std::vector<double> tNodeData;
std::map<int, tNodeData> Decision_Tree_Node_data = {
{ 1 , {4.776435899510506e-06, 0.9968914731370432, 0.0031037504270571992 }} ,
{ 2 , {0.0, 1.708024211715555e-05, 0.9999829197578829 }}
};
int get_decision_tree_node_index(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
int lNodeIndex = (Feature_2 <= 4.950000047683716) ? ( 1 ) : ( 2 );
return lNodeIndex;
}
std::vector<std::string> get_input_names(){
std::vector<std::string> lFeatures = { "Feature_0", "Feature_1", "Feature_2", "Feature_3" };
return lFeatures;
}
std::vector<std::string> get_output_names(){
std::vector<std::string> lOutputs = {
"Score_1789-07-14T00:00:00.000000000", "Score_1789-08-14T00:00:00.000000000", "Score_1789-09-14T00:00:00.000000000",
"Proba_1789-07-14T00:00:00.000000000", "Proba_1789-08-14T00:00:00.000000000", "Proba_1789-09-14T00:00:00.000000000",
"LogProba_1789-07-14T00:00:00.000000000", "LogProba_1789-08-14T00:00:00.000000000", "LogProba_1789-09-14T00:00:00.000000000",
"Decision", "DecisionProba" };
return lOutputs;
}
tTable compute_classification_scores(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
auto lClasses = get_classes();
int lNodeIndex = get_decision_tree_node_index(Feature_0, Feature_1, Feature_2, Feature_3);
std::vector<double> lNodeValue = Decision_Tree_Node_data[ lNodeIndex ];
tTable lTable;
lTable["Score"] = {
std::any(),
std::any(),
std::any()
} ;
lTable["Proba"] = {
lNodeValue [ 0 ],
lNodeValue [ 1 ],
lNodeValue [ 2 ]
} ;
int lBestClass = get_arg_max( lTable["Proba"] );
auto lDecision = lClasses[lBestClass];
lTable["Decision"] = { lDecision } ;
lTable["DecisionProba"] = { lTable["Proba"][lBestClass] };
recompute_log_probas( lTable );
return lTable;
}
tTable compute_model_outputs_from_table( tTable const & iTable) {
tTable lTable = compute_classification_scores(iTable.at("Feature_0")[0], iTable.at("Feature_1")[0], iTable.at("Feature_2")[0], iTable.at("Feature_3")[0]);
return lTable;
}
} // eof namespace SubModel_5
namespace SubModel_6 {
std::vector<std::any> get_classes(){
std::vector<std::any> lClasses = { 1789-07-14T00:00:00.000000000, 1789-08-14T00:00:00.000000000, 1789-09-14T00:00:00.000000000 };
return lClasses;
}
typedef std::vector<double> tNodeData;
std::map<int, tNodeData> Decision_Tree_Node_data = {
{ 1 , {1.0, 0.0, 0.0 }} ,
{ 2 , {0.0, 0.5000000000000004, 0.4999999999999995 }}
};
int get_decision_tree_node_index(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
int lNodeIndex = (Feature_3 <= 0.800000011920929) ? ( 1 ) : ( 2 );
return lNodeIndex;
}
std::vector<std::string> get_input_names(){
std::vector<std::string> lFeatures = { "Feature_0", "Feature_1", "Feature_2", "Feature_3" };
return lFeatures;
}
std::vector<std::string> get_output_names(){
std::vector<std::string> lOutputs = {
"Score_1789-07-14T00:00:00.000000000", "Score_1789-08-14T00:00:00.000000000", "Score_1789-09-14T00:00:00.000000000",
"Proba_1789-07-14T00:00:00.000000000", "Proba_1789-08-14T00:00:00.000000000", "Proba_1789-09-14T00:00:00.000000000",
"LogProba_1789-07-14T00:00:00.000000000", "LogProba_1789-08-14T00:00:00.000000000", "LogProba_1789-09-14T00:00:00.000000000",
"Decision", "DecisionProba" };
return lOutputs;
}
tTable compute_classification_scores(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
auto lClasses = get_classes();
int lNodeIndex = get_decision_tree_node_index(Feature_0, Feature_1, Feature_2, Feature_3);
std::vector<double> lNodeValue = Decision_Tree_Node_data[ lNodeIndex ];
tTable lTable;
lTable["Score"] = {
std::any(),
std::any(),
std::any()
} ;
lTable["Proba"] = {
lNodeValue [ 0 ],
lNodeValue [ 1 ],
lNodeValue [ 2 ]
} ;
int lBestClass = get_arg_max( lTable["Proba"] );
auto lDecision = lClasses[lBestClass];
lTable["Decision"] = { lDecision } ;
lTable["DecisionProba"] = { lTable["Proba"][lBestClass] };
recompute_log_probas( lTable );
return lTable;
}
tTable compute_model_outputs_from_table( tTable const & iTable) {
tTable lTable = compute_classification_scores(iTable.at("Feature_0")[0], iTable.at("Feature_1")[0], iTable.at("Feature_2")[0], iTable.at("Feature_3")[0]);
return lTable;
}
} // eof namespace SubModel_6
namespace SubModel_7 {
std::vector<std::any> get_classes(){
std::vector<std::any> lClasses = { 1789-07-14T00:00:00.000000000, 1789-08-14T00:00:00.000000000, 1789-09-14T00:00:00.000000000 };
return lClasses;
}
typedef std::vector<double> tNodeData;
std::map<int, tNodeData> Decision_Tree_Node_data = {
{ 1 , {4.820822504482422e-06, 0.999931832803407, 6.334637408853024e-05 }} ,
{ 2 , {0.0, 0.003150747638458889, 0.9968492523615411 }}
};
int get_decision_tree_node_index(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
int lNodeIndex = (Feature_3 <= 1.6500000357627869) ? ( 1 ) : ( 2 );
return lNodeIndex;
}
std::vector<std::string> get_input_names(){
std::vector<std::string> lFeatures = { "Feature_0", "Feature_1", "Feature_2", "Feature_3" };
return lFeatures;
}
std::vector<std::string> get_output_names(){
std::vector<std::string> lOutputs = {
"Score_1789-07-14T00:00:00.000000000", "Score_1789-08-14T00:00:00.000000000", "Score_1789-09-14T00:00:00.000000000",
"Proba_1789-07-14T00:00:00.000000000", "Proba_1789-08-14T00:00:00.000000000", "Proba_1789-09-14T00:00:00.000000000",
"LogProba_1789-07-14T00:00:00.000000000", "LogProba_1789-08-14T00:00:00.000000000", "LogProba_1789-09-14T00:00:00.000000000",
"Decision", "DecisionProba" };
return lOutputs;
}
tTable compute_classification_scores(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
auto lClasses = get_classes();
int lNodeIndex = get_decision_tree_node_index(Feature_0, Feature_1, Feature_2, Feature_3);
std::vector<double> lNodeValue = Decision_Tree_Node_data[ lNodeIndex ];
tTable lTable;
lTable["Score"] = {
std::any(),
std::any(),
std::any()
} ;
lTable["Proba"] = {
lNodeValue [ 0 ],
lNodeValue [ 1 ],
lNodeValue [ 2 ]
} ;
int lBestClass = get_arg_max( lTable["Proba"] );
auto lDecision = lClasses[lBestClass];
lTable["Decision"] = { lDecision } ;
lTable["DecisionProba"] = { lTable["Proba"][lBestClass] };
recompute_log_probas( lTable );
return lTable;
}
tTable compute_model_outputs_from_table( tTable const & iTable) {
tTable lTable = compute_classification_scores(iTable.at("Feature_0")[0], iTable.at("Feature_1")[0], iTable.at("Feature_2")[0], iTable.at("Feature_3")[0]);
return lTable;
}
} // eof namespace SubModel_7
namespace SubModel_8 {
std::vector<std::any> get_classes(){
std::vector<std::any> lClasses = { 1789-07-14T00:00:00.000000000, 1789-08-14T00:00:00.000000000, 1789-09-14T00:00:00.000000000 };
return lClasses;
}
typedef std::vector<double> tNodeData;
std::map<int, tNodeData> Decision_Tree_Node_data = {
{ 1 , {1.0, 0.0, 0.0 }} ,
{ 2 , {0.0, 0.5000000000000004, 0.4999999999999996 }}
};
int get_decision_tree_node_index(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
int lNodeIndex = (Feature_3 <= 0.800000011920929) ? ( 1 ) : ( 2 );
return lNodeIndex;
}
std::vector<std::string> get_input_names(){
std::vector<std::string> lFeatures = { "Feature_0", "Feature_1", "Feature_2", "Feature_3" };
return lFeatures;
}
std::vector<std::string> get_output_names(){
std::vector<std::string> lOutputs = {
"Score_1789-07-14T00:00:00.000000000", "Score_1789-08-14T00:00:00.000000000", "Score_1789-09-14T00:00:00.000000000",
"Proba_1789-07-14T00:00:00.000000000", "Proba_1789-08-14T00:00:00.000000000", "Proba_1789-09-14T00:00:00.000000000",
"LogProba_1789-07-14T00:00:00.000000000", "LogProba_1789-08-14T00:00:00.000000000", "LogProba_1789-09-14T00:00:00.000000000",
"Decision", "DecisionProba" };
return lOutputs;
}
tTable compute_classification_scores(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
auto lClasses = get_classes();
int lNodeIndex = get_decision_tree_node_index(Feature_0, Feature_1, Feature_2, Feature_3);
std::vector<double> lNodeValue = Decision_Tree_Node_data[ lNodeIndex ];
tTable lTable;
lTable["Score"] = {
std::any(),
std::any(),
std::any()
} ;
lTable["Proba"] = {
lNodeValue [ 0 ],
lNodeValue [ 1 ],
lNodeValue [ 2 ]
} ;
int lBestClass = get_arg_max( lTable["Proba"] );
auto lDecision = lClasses[lBestClass];
lTable["Decision"] = { lDecision } ;
lTable["DecisionProba"] = { lTable["Proba"][lBestClass] };
recompute_log_probas( lTable );
return lTable;
}
tTable compute_model_outputs_from_table( tTable const & iTable) {
tTable lTable = compute_classification_scores(iTable.at("Feature_0")[0], iTable.at("Feature_1")[0], iTable.at("Feature_2")[0], iTable.at("Feature_3")[0]);
return lTable;
}
} // eof namespace SubModel_8
namespace SubModel_9 {
std::vector<std::any> get_classes(){
std::vector<std::any> lClasses = { 1789-07-14T00:00:00.000000000, 1789-08-14T00:00:00.000000000, 1789-09-14T00:00:00.000000000 };
return lClasses;
}
typedef std::vector<double> tNodeData;
std::map<int, tNodeData> Decision_Tree_Node_data = {
{ 1 , {4.793617328869877e-06, 0.9986735916405715, 0.0013216147420995164 }} ,
{ 2 , {0.0, 2.6476088424120238e-05, 0.9999735239115759 }}
};
int get_decision_tree_node_index(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
int lNodeIndex = (Feature_2 <= 4.950000047683716) ? ( 1 ) : ( 2 );
return lNodeIndex;
}
std::vector<std::string> get_input_names(){
std::vector<std::string> lFeatures = { "Feature_0", "Feature_1", "Feature_2", "Feature_3" };
return lFeatures;
}
std::vector<std::string> get_output_names(){
std::vector<std::string> lOutputs = {
"Score_1789-07-14T00:00:00.000000000", "Score_1789-08-14T00:00:00.000000000", "Score_1789-09-14T00:00:00.000000000",
"Proba_1789-07-14T00:00:00.000000000", "Proba_1789-08-14T00:00:00.000000000", "Proba_1789-09-14T00:00:00.000000000",
"LogProba_1789-07-14T00:00:00.000000000", "LogProba_1789-08-14T00:00:00.000000000", "LogProba_1789-09-14T00:00:00.000000000",
"Decision", "DecisionProba" };
return lOutputs;
}
tTable compute_classification_scores(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
auto lClasses = get_classes();
int lNodeIndex = get_decision_tree_node_index(Feature_0, Feature_1, Feature_2, Feature_3);
std::vector<double> lNodeValue = Decision_Tree_Node_data[ lNodeIndex ];
tTable lTable;
lTable["Score"] = {
std::any(),
std::any(),
std::any()
} ;
lTable["Proba"] = {
lNodeValue [ 0 ],
lNodeValue [ 1 ],
lNodeValue [ 2 ]
} ;
int lBestClass = get_arg_max( lTable["Proba"] );
auto lDecision = lClasses[lBestClass];
lTable["Decision"] = { lDecision } ;
lTable["DecisionProba"] = { lTable["Proba"][lBestClass] };
recompute_log_probas( lTable );
return lTable;
}
tTable compute_model_outputs_from_table( tTable const & iTable) {
tTable lTable = compute_classification_scores(iTable.at("Feature_0")[0], iTable.at("Feature_1")[0], iTable.at("Feature_2")[0], iTable.at("Feature_3")[0]);
return lTable;
}
} // eof namespace SubModel_9
namespace SubModel_10 {
std::vector<std::any> get_classes(){
std::vector<std::any> lClasses = { 1789-07-14T00:00:00.000000000, 1789-08-14T00:00:00.000000000, 1789-09-14T00:00:00.000000000 };
return lClasses;
}
typedef std::vector<double> tNodeData;
std::map<int, tNodeData> Decision_Tree_Node_data = {
{ 1 , {1.0, 0.0, 0.0 }} ,
{ 2 , {0.0, 0.49999999999999983, 0.5000000000000001 }}
};
int get_decision_tree_node_index(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
int lNodeIndex = (Feature_2 <= 2.449999988079071) ? ( 1 ) : ( 2 );
return lNodeIndex;
}
std::vector<std::string> get_input_names(){
std::vector<std::string> lFeatures = { "Feature_0", "Feature_1", "Feature_2", "Feature_3" };
return lFeatures;
}
std::vector<std::string> get_output_names(){
std::vector<std::string> lOutputs = {
"Score_1789-07-14T00:00:00.000000000", "Score_1789-08-14T00:00:00.000000000", "Score_1789-09-14T00:00:00.000000000",
"Proba_1789-07-14T00:00:00.000000000", "Proba_1789-08-14T00:00:00.000000000", "Proba_1789-09-14T00:00:00.000000000",
"LogProba_1789-07-14T00:00:00.000000000", "LogProba_1789-08-14T00:00:00.000000000", "LogProba_1789-09-14T00:00:00.000000000",
"Decision", "DecisionProba" };
return lOutputs;
}
tTable compute_classification_scores(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
auto lClasses = get_classes();
int lNodeIndex = get_decision_tree_node_index(Feature_0, Feature_1, Feature_2, Feature_3);
std::vector<double> lNodeValue = Decision_Tree_Node_data[ lNodeIndex ];
tTable lTable;
lTable["Score"] = {
std::any(),
std::any(),
std::any()
} ;
lTable["Proba"] = {
lNodeValue [ 0 ],
lNodeValue [ 1 ],
lNodeValue [ 2 ]
} ;
int lBestClass = get_arg_max( lTable["Proba"] );
auto lDecision = lClasses[lBestClass];
lTable["Decision"] = { lDecision } ;
lTable["DecisionProba"] = { lTable["Proba"][lBestClass] };
recompute_log_probas( lTable );
return lTable;
}
tTable compute_model_outputs_from_table( tTable const & iTable) {
tTable lTable = compute_classification_scores(iTable.at("Feature_0")[0], iTable.at("Feature_1")[0], iTable.at("Feature_2")[0], iTable.at("Feature_3")[0]);
return lTable;
}
} // eof namespace SubModel_10
namespace SubModel_11 {
std::vector<std::any> get_classes(){
std::vector<std::any> lClasses = { 1789-07-14T00:00:00.000000000, 1789-08-14T00:00:00.000000000, 1789-09-14T00:00:00.000000000 };
return lClasses;
}
typedef std::vector<double> tNodeData;
std::map<int, tNodeData> Decision_Tree_Node_data = {
{ 1 , {4.81196669298056e-06, 0.9998977442279475, 9.744380535948516e-05 }} ,
{ 2 , {0.0, 0.0013923137600357898, 0.9986076862399642 }}
};
int get_decision_tree_node_index(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
int lNodeIndex = (Feature_3 <= 1.6500000357627869) ? ( 1 ) : ( 2 );
return lNodeIndex;
}
std::vector<std::string> get_input_names(){
std::vector<std::string> lFeatures = { "Feature_0", "Feature_1", "Feature_2", "Feature_3" };
return lFeatures;
}
std::vector<std::string> get_output_names(){
std::vector<std::string> lOutputs = {
"Score_1789-07-14T00:00:00.000000000", "Score_1789-08-14T00:00:00.000000000", "Score_1789-09-14T00:00:00.000000000",
"Proba_1789-07-14T00:00:00.000000000", "Proba_1789-08-14T00:00:00.000000000", "Proba_1789-09-14T00:00:00.000000000",
"LogProba_1789-07-14T00:00:00.000000000", "LogProba_1789-08-14T00:00:00.000000000", "LogProba_1789-09-14T00:00:00.000000000",
"Decision", "DecisionProba" };
return lOutputs;
}
tTable compute_classification_scores(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
auto lClasses = get_classes();
int lNodeIndex = get_decision_tree_node_index(Feature_0, Feature_1, Feature_2, Feature_3);
std::vector<double> lNodeValue = Decision_Tree_Node_data[ lNodeIndex ];
tTable lTable;
lTable["Score"] = {
std::any(),
std::any(),
std::any()
} ;
lTable["Proba"] = {
lNodeValue [ 0 ],
lNodeValue [ 1 ],
lNodeValue [ 2 ]
} ;
int lBestClass = get_arg_max( lTable["Proba"] );
auto lDecision = lClasses[lBestClass];
lTable["Decision"] = { lDecision } ;
lTable["DecisionProba"] = { lTable["Proba"][lBestClass] };
recompute_log_probas( lTable );
return lTable;
}
tTable compute_model_outputs_from_table( tTable const & iTable) {
tTable lTable = compute_classification_scores(iTable.at("Feature_0")[0], iTable.at("Feature_1")[0], iTable.at("Feature_2")[0], iTable.at("Feature_3")[0]);
return lTable;
}
} // eof namespace SubModel_11
namespace SubModel_12 {
std::vector<std::any> get_classes(){
std::vector<std::any> lClasses = { 1789-07-14T00:00:00.000000000, 1789-08-14T00:00:00.000000000, 1789-09-14T00:00:00.000000000 };
return lClasses;
}
typedef std::vector<double> tNodeData;
std::map<int, tNodeData> Decision_Tree_Node_data = {
{ 1 , {1.0, 0.0, 0.0 }} ,
{ 2 , {0.0, 0.5000000000000001, 0.49999999999999983 }}
};
int get_decision_tree_node_index(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
int lNodeIndex = (Feature_3 <= 0.800000011920929) ? ( 1 ) : ( 2 );
return lNodeIndex;
}
std::vector<std::string> get_input_names(){
std::vector<std::string> lFeatures = { "Feature_0", "Feature_1", "Feature_2", "Feature_3" };
return lFeatures;
}
std::vector<std::string> get_output_names(){
std::vector<std::string> lOutputs = {
"Score_1789-07-14T00:00:00.000000000", "Score_1789-08-14T00:00:00.000000000", "Score_1789-09-14T00:00:00.000000000",
"Proba_1789-07-14T00:00:00.000000000", "Proba_1789-08-14T00:00:00.000000000", "Proba_1789-09-14T00:00:00.000000000",
"LogProba_1789-07-14T00:00:00.000000000", "LogProba_1789-08-14T00:00:00.000000000", "LogProba_1789-09-14T00:00:00.000000000",
"Decision", "DecisionProba" };
return lOutputs;
}
tTable compute_classification_scores(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
auto lClasses = get_classes();
int lNodeIndex = get_decision_tree_node_index(Feature_0, Feature_1, Feature_2, Feature_3);
std::vector<double> lNodeValue = Decision_Tree_Node_data[ lNodeIndex ];
tTable lTable;
lTable["Score"] = {
std::any(),
std::any(),
std::any()
} ;
lTable["Proba"] = {
lNodeValue [ 0 ],
lNodeValue [ 1 ],
lNodeValue [ 2 ]
} ;
int lBestClass = get_arg_max( lTable["Proba"] );
auto lDecision = lClasses[lBestClass];
lTable["Decision"] = { lDecision } ;
lTable["DecisionProba"] = { lTable["Proba"][lBestClass] };
recompute_log_probas( lTable );
return lTable;
}
tTable compute_model_outputs_from_table( tTable const & iTable) {
tTable lTable = compute_classification_scores(iTable.at("Feature_0")[0], iTable.at("Feature_1")[0], iTable.at("Feature_2")[0], iTable.at("Feature_3")[0]);
return lTable;
}
} // eof namespace SubModel_12
namespace SubModel_13 {
std::vector<std::any> get_classes(){
std::vector<std::any> lClasses = { 1789-07-14T00:00:00.000000000, 1789-08-14T00:00:00.000000000, 1789-09-14T00:00:00.000000000 };
return lClasses;
}
typedef std::vector<double> tNodeData;
std::map<int, tNodeData> Decision_Tree_Node_data = {
{ 1 , {4.798116221942719e-06, 0.999124428950558, 0.0008707729332201233 }} ,
{ 2 , {0.0, 6.0884107962139895e-05, 0.9999391158920379 }}
};
int get_decision_tree_node_index(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
int lNodeIndex = (Feature_2 <= 4.950000047683716) ? ( 1 ) : ( 2 );
return lNodeIndex;
}
std::vector<std::string> get_input_names(){
std::vector<std::string> lFeatures = { "Feature_0", "Feature_1", "Feature_2", "Feature_3" };
return lFeatures;
}
std::vector<std::string> get_output_names(){
std::vector<std::string> lOutputs = {
"Score_1789-07-14T00:00:00.000000000", "Score_1789-08-14T00:00:00.000000000", "Score_1789-09-14T00:00:00.000000000",
"Proba_1789-07-14T00:00:00.000000000", "Proba_1789-08-14T00:00:00.000000000", "Proba_1789-09-14T00:00:00.000000000",
"LogProba_1789-07-14T00:00:00.000000000", "LogProba_1789-08-14T00:00:00.000000000", "LogProba_1789-09-14T00:00:00.000000000",
"Decision", "DecisionProba" };
return lOutputs;
}
tTable compute_classification_scores(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
auto lClasses = get_classes();
int lNodeIndex = get_decision_tree_node_index(Feature_0, Feature_1, Feature_2, Feature_3);
std::vector<double> lNodeValue = Decision_Tree_Node_data[ lNodeIndex ];
tTable lTable;
lTable["Score"] = {
std::any(),
std::any(),
std::any()
} ;
lTable["Proba"] = {
lNodeValue [ 0 ],
lNodeValue [ 1 ],
lNodeValue [ 2 ]
} ;
int lBestClass = get_arg_max( lTable["Proba"] );
auto lDecision = lClasses[lBestClass];
lTable["Decision"] = { lDecision } ;
lTable["DecisionProba"] = { lTable["Proba"][lBestClass] };
recompute_log_probas( lTable );
return lTable;
}
tTable compute_model_outputs_from_table( tTable const & iTable) {
tTable lTable = compute_classification_scores(iTable.at("Feature_0")[0], iTable.at("Feature_1")[0], iTable.at("Feature_2")[0], iTable.at("Feature_3")[0]);
return lTable;
}
} // eof namespace SubModel_13
namespace SubModel_14 {
std::vector<std::any> get_classes(){
std::vector<std::any> lClasses = { 1789-07-14T00:00:00.000000000, 1789-08-14T00:00:00.000000000, 1789-09-14T00:00:00.000000000 };
return lClasses;
}
typedef std::vector<double> tNodeData;
std::map<int, tNodeData> Decision_Tree_Node_data = {
{ 1 , {1.0, 0.0, 0.0 }} ,
{ 2 , {0.0, 0.5000000000000004, 0.4999999999999995 }}
};
int get_decision_tree_node_index(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
int lNodeIndex = (Feature_2 <= 2.449999988079071) ? ( 1 ) : ( 2 );
return lNodeIndex;
}
std::vector<std::string> get_input_names(){
std::vector<std::string> lFeatures = { "Feature_0", "Feature_1", "Feature_2", "Feature_3" };
return lFeatures;
}
std::vector<std::string> get_output_names(){
std::vector<std::string> lOutputs = {
"Score_1789-07-14T00:00:00.000000000", "Score_1789-08-14T00:00:00.000000000", "Score_1789-09-14T00:00:00.000000000",
"Proba_1789-07-14T00:00:00.000000000", "Proba_1789-08-14T00:00:00.000000000", "Proba_1789-09-14T00:00:00.000000000",
"LogProba_1789-07-14T00:00:00.000000000", "LogProba_1789-08-14T00:00:00.000000000", "LogProba_1789-09-14T00:00:00.000000000",
"Decision", "DecisionProba" };
return lOutputs;
}
tTable compute_classification_scores(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
auto lClasses = get_classes();
int lNodeIndex = get_decision_tree_node_index(Feature_0, Feature_1, Feature_2, Feature_3);
std::vector<double> lNodeValue = Decision_Tree_Node_data[ lNodeIndex ];
tTable lTable;
lTable["Score"] = {
std::any(),
std::any(),
std::any()
} ;
lTable["Proba"] = {
lNodeValue [ 0 ],
lNodeValue [ 1 ],
lNodeValue [ 2 ]
} ;
int lBestClass = get_arg_max( lTable["Proba"] );
auto lDecision = lClasses[lBestClass];
lTable["Decision"] = { lDecision } ;
lTable["DecisionProba"] = { lTable["Proba"][lBestClass] };
recompute_log_probas( lTable );
return lTable;
}
tTable compute_model_outputs_from_table( tTable const & iTable) {
tTable lTable = compute_classification_scores(iTable.at("Feature_0")[0], iTable.at("Feature_1")[0], iTable.at("Feature_2")[0], iTable.at("Feature_3")[0]);
return lTable;
}
} // eof namespace SubModel_14
namespace SubModel_15 {
std::vector<std::any> get_classes(){
std::vector<std::any> lClasses = { 1789-07-14T00:00:00.000000000, 1789-08-14T00:00:00.000000000, 1789-09-14T00:00:00.000000000 };
return lClasses;
}
typedef std::vector<double> tNodeData;
std::map<int, tNodeData> Decision_Tree_Node_data = {
{ 1 , {4.809382844138304e-06, 0.9998473862639816, 0.00014780435317418502 }} ,
{ 2 , {0.0, 0.0009574869821768459, 0.9990425130178231 }}
};
int get_decision_tree_node_index(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
int lNodeIndex = (Feature_3 <= 1.6500000357627869) ? ( 1 ) : ( 2 );
return lNodeIndex;
}
std::vector<std::string> get_input_names(){
std::vector<std::string> lFeatures = { "Feature_0", "Feature_1", "Feature_2", "Feature_3" };
return lFeatures;
}
std::vector<std::string> get_output_names(){
std::vector<std::string> lOutputs = {
"Score_1789-07-14T00:00:00.000000000", "Score_1789-08-14T00:00:00.000000000", "Score_1789-09-14T00:00:00.000000000",
"Proba_1789-07-14T00:00:00.000000000", "Proba_1789-08-14T00:00:00.000000000", "Proba_1789-09-14T00:00:00.000000000",
"LogProba_1789-07-14T00:00:00.000000000", "LogProba_1789-08-14T00:00:00.000000000", "LogProba_1789-09-14T00:00:00.000000000",
"Decision", "DecisionProba" };
return lOutputs;
}
tTable compute_classification_scores(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
auto lClasses = get_classes();
int lNodeIndex = get_decision_tree_node_index(Feature_0, Feature_1, Feature_2, Feature_3);
std::vector<double> lNodeValue = Decision_Tree_Node_data[ lNodeIndex ];
tTable lTable;
lTable["Score"] = {
std::any(),
std::any(),
std::any()
} ;
lTable["Proba"] = {
lNodeValue [ 0 ],
lNodeValue [ 1 ],
lNodeValue [ 2 ]
} ;
int lBestClass = get_arg_max( lTable["Proba"] );
auto lDecision = lClasses[lBestClass];
lTable["Decision"] = { lDecision } ;
lTable["DecisionProba"] = { lTable["Proba"][lBestClass] };
recompute_log_probas( lTable );
return lTable;
}
tTable compute_model_outputs_from_table( tTable const & iTable) {
tTable lTable = compute_classification_scores(iTable.at("Feature_0")[0], iTable.at("Feature_1")[0], iTable.at("Feature_2")[0], iTable.at("Feature_3")[0]);
return lTable;
}
} // eof namespace SubModel_15
tTable generate_score_contribution_samme_r( tTable const & iTable) {
std::any lLogProbaSum = 0.0;
tAnyVector lResult1(3);
tAnyVector const & lLogProbas = iTable.at("LogProba");
for(uint lIndex = 0; lIndex < lLogProbas.size(); ++lIndex ) {
lLogProbaSum = lLogProbaSum + lLogProbas[lIndex];
}
std::any lLogProbaAvg = lLogProbaSum / 3;
for(uint lIndex = 0; lIndex < lLogProbas.size(); ++lIndex ) {
lResult1[lIndex] = 2 * (lLogProbas[lIndex] - lLogProbaAvg);
}
tTable lTable;
lTable["Score"] = lResult1;
lTable["Proba"] = lResult1;
return lTable;
}
tTable normalize_ada_scores( tTable const & iTable) {
tAnyVector lLoss(3);
std::any lLossSum = 0.0;
std::any lSumWeights = 16.0;
tAnyVector const & lProbas = iTable.at("Proba");
for(uint lIndex = 0; lIndex < lProbas.size(); ++lIndex ) {
lLoss[ lIndex ] = exp(lProbas[ lIndex ] / lSumWeights / 2);
lLossSum = lLossSum + lLoss[ lIndex ];
}
tTable lTable = iTable;
for(uint lIndex = 0; lIndex < lProbas.size(); ++lIndex ) {
lTable["Proba"][ lIndex ] = lLoss[ lIndex ] / lLossSum;
lTable["Score"][ lIndex ] = lTable["Score"][ lIndex ] / lSumWeights;
}
return lTable;
}
std::vector<std::string> get_input_names(){
std::vector<std::string> lFeatures = { "Feature_0", "Feature_1", "Feature_2", "Feature_3" };
return lFeatures;
}
std::vector<std::string> get_output_names(){
std::vector<std::string> lOutputs = {
"Score_1789-07-14T00:00:00.000000000", "Score_1789-08-14T00:00:00.000000000", "Score_1789-09-14T00:00:00.000000000",
"Proba_1789-07-14T00:00:00.000000000", "Proba_1789-08-14T00:00:00.000000000", "Proba_1789-09-14T00:00:00.000000000",
"LogProba_1789-07-14T00:00:00.000000000", "LogProba_1789-08-14T00:00:00.000000000", "LogProba_1789-09-14T00:00:00.000000000",
"Decision", "DecisionProba" };
return lOutputs;
}
tTable compute_classification_scores(std::any Feature_0, std::any Feature_1, std::any Feature_2, std::any Feature_3) {
auto lClasses = get_classes();
std::vector<tTable> lTreeScores = {
SubModel_0::compute_classification_scores(Feature_0, Feature_1, Feature_2, Feature_3),
SubModel_1::compute_classification_scores(Feature_0, Feature_1, Feature_2, Feature_3),
SubModel_2::compute_classification_scores(Feature_0, Feature_1, Feature_2, Feature_3),
SubModel_3::compute_classification_scores(Feature_0, Feature_1, Feature_2, Feature_3),
SubModel_4::compute_classification_scores(Feature_0, Feature_1, Feature_2, Feature_3),
SubModel_5::compute_classification_scores(Feature_0, Feature_1, Feature_2, Feature_3),
SubModel_6::compute_classification_scores(Feature_0, Feature_1, Feature_2, Feature_3),
SubModel_7::compute_classification_scores(Feature_0, Feature_1, Feature_2, Feature_3),
SubModel_8::compute_classification_scores(Feature_0, Feature_1, Feature_2, Feature_3),
SubModel_9::compute_classification_scores(Feature_0, Feature_1, Feature_2, Feature_3),
SubModel_10::compute_classification_scores(Feature_0, Feature_1, Feature_2, Feature_3),
SubModel_11::compute_classification_scores(Feature_0, Feature_1, Feature_2, Feature_3),
SubModel_12::compute_classification_scores(Feature_0, Feature_1, Feature_2, Feature_3),
SubModel_13::compute_classification_scores(Feature_0, Feature_1, Feature_2, Feature_3),
SubModel_14::compute_classification_scores(Feature_0, Feature_1, Feature_2, Feature_3),
SubModel_15::compute_classification_scores(Feature_0, Feature_1, Feature_2, Feature_3)
};
std::vector<tTable> lAdaScores = {
generate_score_contribution_samme_r( lTreeScores[ 0 ]),
generate_score_contribution_samme_r( lTreeScores[ 1 ]),
generate_score_contribution_samme_r( lTreeScores[ 2 ]),
generate_score_contribution_samme_r( lTreeScores[ 3 ]),
generate_score_contribution_samme_r( lTreeScores[ 4 ]),
generate_score_contribution_samme_r( lTreeScores[ 5 ]),
generate_score_contribution_samme_r( lTreeScores[ 6 ]),
generate_score_contribution_samme_r( lTreeScores[ 7 ]),
generate_score_contribution_samme_r( lTreeScores[ 8 ]),
generate_score_contribution_samme_r( lTreeScores[ 9 ]),
generate_score_contribution_samme_r( lTreeScores[ 10 ]),
generate_score_contribution_samme_r( lTreeScores[ 11 ]),
generate_score_contribution_samme_r( lTreeScores[ 12 ]),
generate_score_contribution_samme_r( lTreeScores[ 13 ]),
generate_score_contribution_samme_r( lTreeScores[ 14 ]),
generate_score_contribution_samme_r( lTreeScores[ 15 ])
};
tTable lAggregatedTable = aggregate_ada_scores(lAdaScores, {"Proba", "Score"});
tTable lNormalizedTable = normalize_ada_scores( lAggregatedTable );
tTable lTable = lNormalizedTable;
int lBestClass = get_arg_max( lTable["Proba"] );
auto lDecision = lClasses[lBestClass];
lTable["Decision"] = { lDecision } ;
lTable["DecisionProba"] = { lTable["Proba"][lBestClass] };
recompute_log_probas( lTable );
return lTable;
}
tTable compute_model_outputs_from_table( tTable const & iTable) {
tTable lTable = compute_classification_scores(iTable.at("Feature_0")[0], iTable.at("Feature_1")[0], iTable.at("Feature_2")[0], iTable.at("Feature_3")[0]);
return lTable;
}
} // eof namespace
int main() {
score_csv_file("outputs/ml2cpp-demo/datasets/iris_date_tgt.csv");
return 0;
}
| [
"antoine.carme@laposte.net"
] | antoine.carme@laposte.net |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.