hexsha
stringlengths
40
40
size
int64
7
1.05M
ext
stringclasses
13 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
4
269
max_stars_repo_name
stringlengths
5
108
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
9
max_stars_count
int64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
4
269
max_issues_repo_name
stringlengths
5
116
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
listlengths
1
9
max_issues_count
int64
1
67k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
4
269
max_forks_repo_name
stringlengths
5
116
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
listlengths
1
9
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
7
1.05M
avg_line_length
float64
1.21
330k
max_line_length
int64
6
990k
alphanum_fraction
float64
0.01
0.99
author_id
stringlengths
2
40
59bb2db2c476de6bde860e3910bc3bea5bed64fa
3,818
cpp
C++
ChipsEninge/02_Script/ChipsSystem/BasicFrame/GameObject.cpp
jerrypoiu/DX11_ChipsEngine2021
a558fb0013259a380d68b66142fc48b575208980
[ "MIT" ]
1
2021-01-25T11:38:21.000Z
2021-01-25T11:38:21.000Z
ChipsEninge/02_Script/ChipsSystem/BasicFrame/GameObject.cpp
jerrypoiu/ChipsEngine
a558fb0013259a380d68b66142fc48b575208980
[ "MIT" ]
null
null
null
ChipsEninge/02_Script/ChipsSystem/BasicFrame/GameObject.cpp
jerrypoiu/ChipsEngine
a558fb0013259a380d68b66142fc48b575208980
[ "MIT" ]
null
null
null
#include "ChipsSystem/BasicFrame/Scene.h" #include "ChipsSystem/BasicFrame/AComponent.h" #include "ChipsSystem/BasicFrame/GameObject.h" #include "ChipsSystem/BasicFrame/Application.h" #include "ChipsSystem/Components/BaiscComponents/Transform.h" #include "ChipsSystem/Components/BaiscComponents/Rigidbody.h" #include "ChipsSystem/Etc/Debug.h" #include "ChipsSystem/Etc/LayerMask.h" namespace ChipsEngine { GameObject::GameObject(string _name, string _layer, string _tag ) : m_name(_name), m_tag(_tag), m_isActive(true), m_transfrom(nullptr), m_rigidbody(nullptr), m_transformType(typeid(Transform)), m_rigidbodyType(typeid(Rigidbody)) { Debug::Log("Object Create " + m_name, LOG_TYPE::CREATE_LOG); m_layer = LayerMask::NameToLayer(_layer); m_components.resize(0); AddComponent<Transform>(); m_transfrom = GetComponent<Transform>(); AddComponent<Rigidbody>(); m_rigidbody = GetComponent<Rigidbody>(); } VOID GameObject::RemoveComponent(AComponent* _component) { if (strcmp(_component->GetType().c_str(), "Transform") == 0 || strcmp(_component->GetType().c_str(), "Rigidbody") == 0) { Debug::Log("WARNING : You can't remove \"" + _component->GetType() + "\" Compoenet.", LOG_TYPE::WARING_LOG); return; } for (auto it = m_components.begin(); it != m_components.end(); it++) { if (it->get() == _component) { m_components.remove(*it); return; } } } VOID GameObject::RemoveComponent(string _componentType) { if (strcmp(_componentType.c_str(), "Transform") == 0 || strcmp(_componentType.c_str(), "Rigidbody") == 0) { Debug::Log("WARNING : You can't remove \"" + _componentType + "\" Compoenet.", LOG_TYPE::WARING_LOG); return; } for (auto it = m_components.begin(); it != m_components.end(); it++) { AComponent* component = static_cast<AComponent*>(it->get()); if (component->GetType() == _componentType) { m_components.remove(*it); return; } } } VOID GameObject::_Awake_() { } VOID GameObject::_Update_() { if (m_isActive == false) return; for (auto const& _component : m_components) { _component->_Update_(); } } VOID GameObject::_FixedUpdate_() { if (m_isActive == false) return; for (auto const& _component : m_components) { _component->_FixedUpdate_(); for (auto const& _coll : m_triggerColliders) { _component->OnTriggerStay(_coll); } } } VOID GameObject::_Render_() { if (m_isActive == false) return; for (auto const& _component : m_components) { _component->_Render_(); } } VOID GameObject::_Release_() { Debug::Log("Object Delete " + m_name, LOG_TYPE::DELETE_LOG); m_isActive = false; m_components.clear(); this->~GameObject(); } VOID GameObject::OnCollisionEnter(GameObject* _coll) { if (m_isActive == false) return; for (auto const& _component : m_components) { _component->OnCollisionEnter(_coll); } } VOID GameObject::OnCollisionStay(GameObject* _coll) { if (m_isActive == false) return; for (auto const& _component : m_components) { _component->OnCollisionStay(_coll); } } VOID GameObject::OnCollisionExit(GameObject* _coll) { if (m_isActive == false) return; for (auto const& _component : m_components) { _component->OnCollisionExit(_coll); } } VOID GameObject::OnTriggerEnter(GameObject* _coll) { if (m_isActive == false) return; m_triggerColliders.emplace_back(_coll); for (auto const& _component : m_components) { _component->OnTriggerEnter(_coll); } } VOID GameObject::OnTriggerExit(GameObject* _coll) { if (m_isActive == false) return; m_triggerColliders.remove(_coll); for (auto const& _component : m_components) { _component->OnTriggerExit(_coll); } } }
21.942529
114
0.673389
jerrypoiu
59bcd6ce5d8597e533a44861452fb7fe45b18cbc
381
cpp
C++
solutions/683.k-empty-slots.285439527.ac.cpp
satu0king/Leetcode-Solutions
2edff60d76c2898d912197044f6284efeeb34119
[ "MIT" ]
78
2020-10-22T11:31:53.000Z
2022-02-22T13:27:49.000Z
solutions/683.k-empty-slots.285439527.ac.cpp
satu0king/Leetcode-Solutions
2edff60d76c2898d912197044f6284efeeb34119
[ "MIT" ]
null
null
null
solutions/683.k-empty-slots.285439527.ac.cpp
satu0king/Leetcode-Solutions
2edff60d76c2898d912197044f6284efeeb34119
[ "MIT" ]
26
2020-10-23T15:10:44.000Z
2021-11-07T16:13:50.000Z
class Solution { public: int kEmptySlots(vector<int> &bulbs, int k) { set<int> s; for (int i = 0; i < bulbs.size(); i++) { int x = bulbs[i]; auto it = s.upper_bound(x); if (it != s.end() && *it - x == k + 1) return i + 1; if (it != s.begin() && x - *prev(it) == k + 1) return i + 1; s.insert(x); } return -1; } };
21.166667
52
0.44357
satu0king
59c0d81cfdc6dd66f38ad87d10c0b02d6146d707
1,514
cpp
C++
src/lang/expr/throwNode.cpp
dmcdougall/occa
4cc784e86459c01c8821da0a02eea3ad4fb36ef5
[ "MIT" ]
null
null
null
src/lang/expr/throwNode.cpp
dmcdougall/occa
4cc784e86459c01c8821da0a02eea3ad4fb36ef5
[ "MIT" ]
null
null
null
src/lang/expr/throwNode.cpp
dmcdougall/occa
4cc784e86459c01c8821da0a02eea3ad4fb36ef5
[ "MIT" ]
null
null
null
#include <occa/lang/expr/throwNode.hpp> namespace occa { namespace lang { throwNode::throwNode(token_t *token_, const exprNode &value_) : exprNode(token_), value(value_.clone()) {} throwNode::throwNode(const throwNode &node) : exprNode(node.token), value(node.value->clone()) {} throwNode::~throwNode() { delete value; } udim_t throwNode::type() const { return exprNodeType::throw_; } exprNode* throwNode::clone() const { return new throwNode(token, *value); } exprNode* throwNode::endNode() { return value->endNode(); } void throwNode::pushChildNodes(exprNodeVector &children) { children.push_back(value); } bool throwNode::safeReplaceExprNode(exprNode *currentNode, exprNode *newNode) { if (currentNode == value) { delete value; value = newNode; return true; } return false; } exprNode* throwNode::wrapInParentheses() { return new parenthesesNode(token, *this); } void throwNode::print(printer &pout) const { pout << "throw"; if (value->type() != exprNodeType::empty) { pout << ' ' << *value; } } void throwNode::debugPrint(const std::string &prefix) const { printer pout(io::stderr); io::stderr << prefix << "|\n" << prefix << "|\n" << prefix << "|---["; pout << *value; io::stderr << "] (throw)\n"; } } }
23.292308
83
0.559445
dmcdougall
59c4e91fd07c9db6cc4bfaa43d48f05fefc663da
3,323
cpp
C++
Lab2-1/Lab2-1/main.cpp
AlexPC2/Public
9f42f1873c72355511242680f8ebd54d03dec895
[ "MIT" ]
null
null
null
Lab2-1/Lab2-1/main.cpp
AlexPC2/Public
9f42f1873c72355511242680f8ebd54d03dec895
[ "MIT" ]
null
null
null
Lab2-1/Lab2-1/main.cpp
AlexPC2/Public
9f42f1873c72355511242680f8ebd54d03dec895
[ "MIT" ]
null
null
null
// // main.cpp // Lab2-1 // // Created by Alex Noyanov on 12.02.19. // Copyright © 2019 Popoff Developer Studio. All rights reserved. // // Лабораторная 2 Задача #1 /* Задача №1 Выполнить преобразование Фурье для функции Период функции равен T = 2*pi a0 = 1, am = 0, m (-1) + 1 bm = _____________ pi * m 1. Проверить формулы. 2. Составить программу, которая вычисляет разложение функции f(x) для различных m определить максимальную разность между значениями функции f(x) и c помощью разложения Фурье. 3. Построить график при различных m сравнить визуально схожесть графиков исходной функции и разложения Фурье. n ____ a0 \ | g(t) = ____ + \ [am* cos(mx) + bm*sin(mx)] 2 / /____| m = 1 F(g(t)) = A/(pi*f) * sin(pi+T) Максимальную разность среди элементов */ #include <iostream> #include <math.h> using namespace std; double f(double x) { while (x > M_PI*2) { x -= M_PI*2; } if(x <= M_PI) return 1.0; else return 0.0; } /* double pow1(int m) { if(m%2 == 1) return 1; else return -1; } */ double b(double m) // Функция b(m) { double bm = (pow(-1,m+1)+1)/(M_PI * m); //double bm = (pow1(m)+1.0)/(M_PI * m); return bm; } double a2(int m) { double sum = 0; const double dx = 0.01; for(double x = 0; x < M_PI*2; x += dx) { sum += f(x)*cos(m*x)*dx; } double integral = sum / M_PI; return integral; } double b2(int m) { double sum = 0; const double dx = 0.01; for(double x = 0; x < M_PI*2; x += dx) { sum += f(x)*sin(m*x)*dx; } double integral = sum / M_PI; return integral; } /* double g1(double x, int mmax) // Функция g(x) { double a0 = 1.0; double amm, bmm; double ds; double sum = a0 / 2.0; for(int m = 1; m < mmax; m++) { amm = a2(m); bmm = b2(m); ds = amm*cos(m*x) + bmm*sin(m*x); sum += ds; } return sum; } */ double g2(double x, int mmax) // Функция g(x) { double a0 = 1.0; double bm = 0; double ds; double sum = a0 / 2.0; for(int m = 1; m < mmax; m++) { bm = b(m); // Значение b(i) ds = bm*sin(m*x); sum += ds; } return sum; } int main(int argc, const char * argv[]) { double maxDelta = 0; const int mmax = 50; for(int i = 1; i < mmax; i++) printf("b[%d]=%.6f = %.3f/pi\n", i, b(i), b(i)*M_PI); printf("\n"); for(double x = 0; x <= M_PI; x+= M_PI/8) { double gx = g2(x, mmax); double fx = f(x); double dfx = fx - gx; printf("x=%.4lf | %.3lf - %.3lf = %.3lf\n", x, fx, gx, dfx); if(dfx > maxDelta) maxDelta = dfx; } cout << endl << "Max delta = " << maxDelta << endl; // double yourValue; // double d = 0; // // cout << "Input m: "; // cin >> yourValue; // cout << "Result:" << g(yourValue, &d) << endl; // // cout << "Max delta:" << d << endl; return 0; }
19.898204
177
0.466446
AlexPC2
59c82143afa2d88deede76dbe298ea461416b83c
4,172
hpp
C++
src/hotspot/share/memory/metaspace/chunkHeaderPool.hpp
1690296356/jdk
eaf668d1510c28d51e26c397b582b66ebdf7e263
[ "Apache-2.0" ]
1
2020-12-26T04:52:15.000Z
2020-12-26T04:52:15.000Z
src/hotspot/share/memory/metaspace/chunkHeaderPool.hpp
1690296356/jdk
eaf668d1510c28d51e26c397b582b66ebdf7e263
[ "Apache-2.0" ]
1
2020-12-26T04:57:19.000Z
2020-12-26T04:57:19.000Z
src/hotspot/share/memory/metaspace/chunkHeaderPool.hpp
1690296356/jdk
eaf668d1510c28d51e26c397b582b66ebdf7e263
[ "Apache-2.0" ]
1
2021-12-06T01:13:18.000Z
2021-12-06T01:13:18.000Z
/* * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. * */ #ifndef SHARE_MEMORY_METASPACE_CHUNKHEADERPOOL_HPP #define SHARE_MEMORY_METASPACE_CHUNKHEADERPOOL_HPP #include "memory/allocation.hpp" #include "memory/metaspace/counters.hpp" #include "memory/metaspace/metachunk.hpp" #include "memory/metaspace/metachunkList.hpp" #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" namespace metaspace { // Chunk headers (Metachunk objects) are separate entities from their payload. // Since they are allocated and released frequently in the course of buddy allocation // (splitting, merging chunks happens often) we want allocation of them fast. Therefore // we keep them in a simple pool (somewhat like a primitive slab allocator). class ChunkHeaderPool : public CHeapObj<mtMetaspace> { static const int SlabCapacity = 128; struct Slab : public CHeapObj<mtMetaspace> { Slab* _next; int _top; Metachunk _elems [SlabCapacity]; Slab() : _next(NULL), _top(0) { for (int i = 0; i < SlabCapacity; i++) { _elems[i].clear(); } } }; IntCounter _num_slabs; Slab* _first_slab; Slab* _current_slab; IntCounter _num_handed_out; MetachunkList _freelist; void allocate_new_slab(); static ChunkHeaderPool* _chunkHeaderPool; public: ChunkHeaderPool(); ~ChunkHeaderPool(); // Allocates a Metachunk structure. The structure is uninitialized. Metachunk* allocate_chunk_header() { DEBUG_ONLY(verify()); Metachunk* c = NULL; c = _freelist.remove_first(); assert(c == NULL || c->is_dead(), "Not a freelist chunk header?"); if (c == NULL) { if (_current_slab == NULL || _current_slab->_top == SlabCapacity) { allocate_new_slab(); assert(_current_slab->_top < SlabCapacity, "Sanity"); } c = _current_slab->_elems + _current_slab->_top; _current_slab->_top++; } _num_handed_out.increment(); // By contract, the returned structure is uninitialized. // Zap to make this clear. DEBUG_ONLY(c->zap_header(0xBB);) return c; } void return_chunk_header(Metachunk* c) { // We only ever should return free chunks, since returning chunks // happens only on merging and merging only works with free chunks. assert(c != NULL && c->is_free(), "Sanity"); #ifdef ASSERT // In debug, fill dead header with pattern. c->zap_header(0xCC); c->set_next(NULL); c->set_prev(NULL); #endif c->set_dead(); _freelist.add(c); _num_handed_out.decrement(); } // Returns number of allocated elements. int used() const { return _num_handed_out.get(); } // Returns number of elements in free list. int freelist_size() const { return _freelist.count(); } // Returns size of memory used. size_t memory_footprint_words() const; DEBUG_ONLY(void verify() const;) static void initialize(); // Returns reference to the one global chunk header pool. static ChunkHeaderPool* pool() { return _chunkHeaderPool; } }; } // namespace metaspace #endif // SHARE_MEMORY_METASPACE_CHUNKHEADERPOOL_HPP
30.676471
88
0.706616
1690296356
59c923713c29ef240b8fb860b4f83b5ca865de35
844
hpp
C++
framework/graphics/graphics/base.hpp
YiJiangFengYun/vulkan-graphics-examples
e7b788b8f47dd238b08840c019940c7c52335a54
[ "MIT" ]
1
2018-03-01T01:05:25.000Z
2018-03-01T01:05:25.000Z
framework/graphics/graphics/base.hpp
YiJiangFengYun/vulkan-graphics-examples
e7b788b8f47dd238b08840c019940c7c52335a54
[ "MIT" ]
null
null
null
framework/graphics/graphics/base.hpp
YiJiangFengYun/vulkan-graphics-examples
e7b788b8f47dd238b08840c019940c7c52335a54
[ "MIT" ]
null
null
null
#ifndef VG_BASE_H #define VG_BASE_H #include <unordered_map> namespace vg { enum class BaseType { UNDEFINED, VERTEX_DATA, INDEX_DATA, UNIFORM_BUFFER_DATA, TEXTURE, SHADER, PASS, PRE_DEPTH_PASS, MATERIAL, MESH, TRANSFORM, SCENE, SCENE_OBJECT, RENDERER_PASS, RENDERER, APP, }; using InstanceID = uint32_t; class Base { public: Base(BaseType baseType); virtual ~Base(); BaseType getBaseType() const; InstanceID getID() const; protected: BaseType m_baseType; InstanceID m_id; private: Base() = delete; static std::unordered_map<BaseType, InstanceID> m_idCreator; }; } //namespace kgs #endif // !VG_BASE_H
15.924528
68
0.554502
YiJiangFengYun
59caa40e5aa7f247553442150b04e381577b9018
1,104
cpp
C++
codeBase/HackerCup/2015/2015_1_1/2015_1_1.cpp
suren3141/codeBase
10ed9a56aca33631dc8c419cd83859c19dd6ff09
[ "Apache-2.0" ]
3
2020-03-16T14:59:08.000Z
2021-07-28T20:51:53.000Z
codeBase/HackerCup/2015/2015_1_1/2015_1_1.cpp
suren3141/codeBase
10ed9a56aca33631dc8c419cd83859c19dd6ff09
[ "Apache-2.0" ]
2
2016-04-16T05:39:20.000Z
2016-06-06T12:24:56.000Z
codeBase/HackerCup/2015/2015_1_1/2015_1_1.cpp
killerilaksha/codeBase
91cbd950fc90066903e58311000784aeba4ffc02
[ "Apache-2.0" ]
18
2020-02-17T23:17:37.000Z
2021-07-28T20:52:13.000Z
/* Copyright Hackers' Club, University Of Peradeniya Author : E/13/181 (Samurdhi Karunarathne) 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 <bits/stdc++.h> using namespace std; typedef long long ll; void sieveOfEratosthenes(ll n) { bool prime[n + 1]; memset(prime, true, sizeof(prime)); for (ll p = 2; p <= n; p++) { if (prime[p] == true) { printf("%d ", p); for (ll i = p * 2; i <= n; i += p) { prime[i] = false; } } } printf("\n"); } int main() { ll n; scanf("%lld\n", n); sieveOfEratosthenes(n); return 0; }
30.666667
72
0.643116
suren3141
59cd84a2f095c7786a1ecab691c3516a4bf334a6
10,075
cc
C++
build/x86/python/m5/internal/param_DMASequencer.py.cc
billionshang/gem5
18cc4294f32315595f865d07d1f33434e92b06b2
[ "BSD-3-Clause" ]
null
null
null
build/x86/python/m5/internal/param_DMASequencer.py.cc
billionshang/gem5
18cc4294f32315595f865d07d1f33434e92b06b2
[ "BSD-3-Clause" ]
null
null
null
build/x86/python/m5/internal/param_DMASequencer.py.cc
billionshang/gem5
18cc4294f32315595f865d07d1f33434e92b06b2
[ "BSD-3-Clause" ]
null
null
null
#include "sim/init.hh" namespace { const uint8_t data_m5_internal_param_DMASequencer[] = { 120,156,197,89,253,114,219,198,17,223,3,64,74,164,36,75, 178,190,252,33,91,180,93,59,172,167,18,19,39,142,211,137, 235,214,205,199,76,51,99,37,5,211,177,195,100,138,66,192, 137,4,69,2,44,112,180,205,140,52,211,169,60,109,254,235, 95,125,132,254,209,23,232,115,244,9,250,42,205,238,30,0, 66,34,157,122,218,142,36,145,167,195,98,111,239,118,247,183, 123,123,39,15,210,159,18,126,127,81,3,72,254,37,0,124, 252,8,232,1,244,5,180,4,8,41,192,95,133,131,18,196, 239,129,95,130,87,0,45,3,164,1,199,216,49,225,107,3, 194,121,30,83,134,158,201,20,1,163,42,72,11,90,37,120, 26,46,131,37,203,112,80,133,248,119,32,132,8,5,60,243, 103,192,159,133,87,40,29,59,21,22,56,11,68,172,50,177, 2,254,28,19,171,224,207,115,103,14,70,75,32,231,161,181, 64,108,173,11,40,246,46,138,93,100,177,255,36,177,62,190, 89,3,255,2,177,227,186,190,34,78,139,56,121,190,69,150, 178,148,173,114,25,90,23,179,254,74,161,191,90,232,175,21, 250,235,133,254,70,161,127,169,208,191,92,232,95,41,244,175, 22,250,155,133,254,181,66,255,58,247,81,195,139,208,221,130, 110,13,186,55,96,31,141,190,156,107,115,19,164,9,221,91, 208,186,5,18,63,55,225,24,253,226,95,44,140,248,17,143, 88,201,71,220,230,17,119,160,117,7,36,126,110,235,17,101, 104,214,215,209,215,193,191,241,167,142,190,6,53,143,205,115, 25,39,65,20,58,65,184,31,5,6,189,47,83,67,200,240, 168,153,73,33,242,17,65,228,239,192,248,240,141,20,34,71, 128,130,5,233,210,51,224,136,59,71,6,140,234,112,40,160, 107,129,111,194,33,78,83,162,5,180,5,28,27,240,141,73, 12,71,216,90,232,200,235,96,41,141,143,46,59,82,75,154, 129,163,18,28,150,160,249,236,208,32,194,65,5,226,191,193, 183,155,44,116,150,133,26,112,136,173,5,199,22,28,149,225, 41,50,33,169,91,33,245,197,179,67,212,20,41,205,186,133, 171,221,45,168,75,170,248,65,28,186,125,169,86,176,239,12, 220,216,237,59,31,63,121,220,148,191,31,202,208,147,113,189, 154,49,70,201,206,192,85,29,155,71,154,100,146,254,64,177, 196,40,148,106,14,59,251,65,232,59,253,200,31,246,164,154, 37,113,206,126,208,147,142,195,47,127,213,31,68,177,250,36, 142,163,216,38,171,50,177,23,185,249,8,178,169,215,139,18, 89,167,217,120,26,155,196,43,226,222,31,176,68,90,0,175, 150,6,251,50,241,226,96,160,208,89,90,34,113,147,180,58, 185,137,155,100,15,155,70,63,84,141,78,123,63,105,52,59, 110,44,155,29,25,54,218,178,127,127,59,138,131,118,16,110, 39,202,221,235,201,237,123,111,191,115,127,251,167,219,239,54, 246,134,65,207,111,188,252,224,253,198,96,164,58,81,216,232, 223,111,4,161,146,104,167,94,99,210,66,59,200,117,145,230, 122,17,180,157,128,181,116,58,178,55,144,241,2,81,175,208, 58,196,146,152,23,101,97,138,186,88,192,94,9,191,166,216, 52,230,196,110,64,122,122,164,59,161,204,42,226,138,156,45, 224,192,128,120,147,80,211,197,143,32,55,35,118,154,244,206, 224,119,191,38,3,105,106,215,36,44,104,226,33,35,13,33, 135,156,15,201,249,33,48,92,74,208,45,131,134,17,162,79, 227,42,30,81,139,236,36,198,64,225,22,36,127,5,52,56, 2,232,16,82,112,29,155,32,194,37,80,85,202,37,72,93, 199,9,255,200,248,108,214,105,249,187,12,18,213,9,146,232, 69,200,174,160,62,71,84,19,45,243,197,232,243,189,174,244, 84,178,133,132,175,162,97,205,115,195,48,82,53,215,247,107, 174,82,113,176,55,84,50,169,169,168,118,59,169,147,119,237, 229,12,103,185,188,209,32,195,21,97,0,113,165,31,252,192, 83,248,192,0,118,216,11,137,84,136,145,78,228,39,72,39, 17,109,169,108,90,164,34,35,71,188,16,134,144,67,172,52, 61,242,93,192,231,199,217,74,24,167,245,114,134,170,68,246, 246,85,149,1,234,38,137,195,43,33,58,99,145,4,63,119, 123,67,201,210,17,77,10,23,68,93,189,134,179,71,227,37, 210,44,51,4,107,23,70,161,63,194,197,6,222,91,180,142, 75,140,201,121,70,229,26,34,114,6,219,50,254,45,139,117, 195,179,82,28,150,51,44,82,142,84,192,72,16,41,24,16, 151,199,152,143,234,6,39,20,86,144,227,245,38,245,104,176, 189,73,205,53,106,174,83,179,149,217,224,76,13,177,112,218, 16,15,104,114,131,181,103,61,201,117,102,166,167,127,34,230, 46,143,99,14,147,104,147,98,199,160,8,27,199,142,69,9, 55,126,68,45,178,114,84,154,144,124,73,233,157,98,140,133, 81,56,97,96,80,111,28,46,108,53,123,137,172,49,155,33, 221,38,248,22,49,220,46,96,216,38,135,49,128,237,203,89, 234,116,136,67,67,215,190,74,162,74,83,204,94,163,230,198, 185,216,126,12,194,246,4,8,63,164,117,44,165,32,92,96, 240,85,241,187,100,120,102,234,144,124,131,93,57,5,62,66, 158,53,5,121,119,168,103,78,154,224,60,65,151,42,254,105, 1,116,180,86,163,168,223,46,118,70,27,164,86,17,110,27, 88,58,60,13,55,176,26,48,184,26,120,155,171,1,174,40, 184,134,211,201,221,228,252,174,59,37,178,207,190,9,235,233, 46,159,84,176,29,196,209,203,81,45,218,175,41,54,0,229, 226,135,183,147,157,219,201,135,152,101,107,143,56,191,233,60, 171,51,105,44,7,148,9,105,232,39,47,61,201,91,43,63, 57,142,78,124,14,39,65,39,221,178,17,121,107,100,93,35, 51,59,111,1,137,138,41,243,159,189,225,171,185,225,73,143, 207,104,230,42,91,221,20,27,136,178,170,224,229,57,58,253, 115,41,199,111,241,251,75,242,4,153,64,2,21,249,118,83, 47,158,245,34,13,237,159,156,64,210,89,106,101,55,112,154, 223,100,8,42,143,17,68,95,51,139,144,63,3,87,188,2, 254,4,132,17,132,66,26,33,121,64,17,40,86,136,253,183, 192,161,52,165,178,224,28,213,164,106,130,57,48,117,37,15, 152,85,23,26,159,193,119,133,56,204,202,1,51,173,105,139, 229,128,149,231,55,6,215,27,109,249,214,201,68,72,158,234, 184,9,177,233,236,54,14,237,241,126,146,87,162,152,221,207, 20,105,179,122,78,135,150,247,205,24,103,180,161,94,21,43, 70,1,61,239,80,115,47,7,142,200,104,103,181,210,45,120, 125,41,224,232,253,229,107,90,142,197,10,44,206,112,189,86, 20,146,199,73,41,139,147,123,121,156,72,222,10,95,241,9, 136,90,131,176,112,108,8,60,246,98,141,72,167,76,11,100, 9,90,101,138,40,46,239,69,26,112,34,75,127,148,44,79, 236,179,108,162,93,109,188,28,14,218,211,212,188,60,251,180, 66,206,126,216,115,251,123,190,251,136,242,104,66,147,123,89, 8,26,153,38,75,69,77,40,124,196,235,148,225,199,251,153, 70,207,207,62,165,188,15,188,167,106,77,56,128,252,200,227, 60,242,101,71,214,250,178,191,135,71,224,78,48,168,237,247, 220,54,251,204,76,53,253,60,211,84,177,211,79,215,52,201, 93,106,163,154,23,133,184,11,12,61,21,197,53,95,226,177, 80,250,181,237,26,111,33,181,32,169,185,123,248,214,245,148, 14,135,147,225,205,101,181,27,183,19,174,160,15,94,80,247, 124,124,238,56,65,24,224,193,226,57,228,219,183,62,153,230, 59,2,31,25,116,116,225,78,139,7,62,53,210,89,143,234, 27,123,135,154,31,195,185,109,28,239,165,30,78,200,144,101, 113,213,168,24,124,78,45,242,125,65,35,147,201,24,255,199, 155,196,184,190,212,74,35,189,76,156,114,134,238,35,168,173, 208,246,209,170,102,196,57,110,231,153,184,144,17,47,112,187, 200,196,165,140,184,204,237,69,38,174,100,196,85,110,215,152, 184,158,93,187,109,48,241,18,180,46,211,189,17,81,174,80, 158,153,249,95,243,12,135,230,249,4,229,209,255,53,189,216, 15,206,95,17,251,3,72,75,148,215,165,22,81,212,114,65, 167,150,174,200,78,84,69,21,249,142,231,242,84,4,59,94, 44,93,37,181,255,54,207,67,109,78,87,122,21,127,24,39, 140,201,122,255,113,174,225,49,151,106,163,85,118,171,62,90, 178,91,197,211,240,10,22,254,22,23,254,15,169,240,63,100, 115,56,134,174,253,199,224,45,229,86,161,35,122,40,95,56, 147,150,209,229,61,45,206,29,12,100,232,219,119,161,88,177, 243,235,179,199,8,37,200,239,160,80,56,153,98,21,75,244, 201,184,165,221,160,160,49,251,183,148,71,234,185,120,154,1, 254,151,12,224,117,218,190,198,91,130,253,144,26,222,4,242, 252,111,255,60,247,211,205,233,232,141,135,123,35,39,25,37, 74,246,233,208,248,38,108,88,206,241,53,64,129,166,174,77, 31,86,16,252,195,28,36,147,175,176,180,184,250,116,230,97, 18,132,109,189,22,44,223,209,82,44,249,141,153,105,18,2, 221,196,27,117,125,186,136,236,62,158,102,249,15,44,36,155, 242,127,250,172,238,77,103,231,43,218,164,231,62,151,14,86, 42,33,158,6,105,176,23,13,67,197,179,252,23,195,104,102, 66,194,15,240,48,232,57,127,249,178,39,149,156,18,172,138, 128,147,222,255,248,104,148,56,26,225,145,155,79,173,248,220, 115,156,115,42,37,126,166,55,31,125,21,136,165,132,40,99, 49,177,38,210,95,163,82,174,8,174,224,78,253,187,68,47, 148,110,28,245,41,109,148,216,188,39,44,230,241,192,119,250, 89,233,68,161,195,183,13,187,110,95,95,192,242,125,162,125, 11,210,251,29,251,173,60,174,200,140,124,52,214,215,19,152, 251,184,186,228,98,210,126,151,232,148,27,250,247,119,50,205, 118,180,102,54,226,173,169,225,109,48,3,67,106,146,175,25, 244,7,61,249,68,246,163,120,164,106,83,89,30,167,85,108, 202,116,117,42,19,190,212,247,222,124,18,155,124,255,81,47, 242,14,164,159,242,92,123,61,207,199,81,223,69,250,244,89, 112,181,169,132,229,83,239,253,152,70,173,157,162,38,50,14, 220,94,240,173,228,91,186,41,242,180,133,78,79,38,195,33, 107,132,234,62,137,124,57,97,226,199,190,31,219,110,216,150, 24,144,84,251,171,27,167,25,78,152,44,227,34,16,100,44, 138,176,113,218,116,228,226,252,137,235,218,137,50,128,99,38, 150,237,128,51,201,98,113,64,186,15,18,134,217,9,211,242, 95,97,240,249,132,152,62,101,234,107,181,71,148,215,57,84, 232,126,190,178,88,193,112,163,29,210,20,85,220,35,45,115, 126,169,98,205,207,85,172,202,140,201,23,167,11,98,197,168, 90,149,185,121,241,186,223,45,12,208,170,177,181,90,17,223, 3,166,146,52,138, }; EmbeddedPython embedded_m5_internal_param_DMASequencer( "m5/internal/param_DMASequencer.py", "/mnt/hgfs/ShareShen/gem5-origin-stable-2015-9-3/build/x86/python/m5/internal/param_DMASequencer.py", "m5.internal.param_DMASequencer", data_m5_internal_param_DMASequencer, 2485, 7909); } // anonymous namespace
58.236994
105
0.666005
billionshang
59d09dc56d120e65fe8acb1a2902fcd714d6d1f0
1,742
cpp
C++
SAMP-EDGEngine/src/SAMP-EDGEngine/Server/GameMode.cpp
Desantowski/SAMP-EDGEngine
949811bf801b1a1a76cc7cc510be749cdfdba540
[ "MIT" ]
null
null
null
SAMP-EDGEngine/src/SAMP-EDGEngine/Server/GameMode.cpp
Desantowski/SAMP-EDGEngine
949811bf801b1a1a76cc7cc510be749cdfdba540
[ "MIT" ]
null
null
null
SAMP-EDGEngine/src/SAMP-EDGEngine/Server/GameMode.cpp
Desantowski/SAMP-EDGEngine
949811bf801b1a1a76cc7cc510be749cdfdba540
[ "MIT" ]
null
null
null
#include "SAMP-EDGEnginePCH.hpp" // PCH // Custom includes: #include <SAMP-EDGEngine/Server/GameMode.hpp> #include <SAMP-EDGEngine/World/Streamer/Streamer.hpp> namespace agdk { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// IGameMode::IGameMode() { } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// IGameMode::~IGameMode() { } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// SharedPtr<Player> IGameMode::newPlayerInstance(std::size_t const playerIndex_) const { return std::make_shared<Player>(playerIndex_); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void IGameMode::addPlayerClass(std::size_t modelIndex_, math::Vector3f const location_, float const facingAngle_, std::array<Weapon, 3> weapons_) { sampgdk_AddPlayerClass(modelIndex_, location_.x, location_.y, location_.z, facingAngle_, static_cast<std::int32_t>(weapons_[0].getType()), weapons_[0].getAmmo(), static_cast<std::int32_t>(weapons_[1].getType()), weapons_[1].getAmmo(), static_cast<std::int32_t>(weapons_[2].getType()), weapons_[2].getAmmo()); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void IGameMode::setup() { this->setupStreamer(); this->setupEvents(); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void IGameMode::setupStreamer() { Streamer = std::make_unique<default_streamer::Streamer>(); } }
35.55102
145
0.434558
Desantowski
59d18cd03b548a308a1f9b449170a3dde049136c
4,761
hpp
C++
SYCL/ESIMD/api/functional/type_coverage.hpp
aobolensk/llvm-test-suite
f06b0646bced61b6fe92625aad9f12a000a17075
[ "Apache-2.0" ]
null
null
null
SYCL/ESIMD/api/functional/type_coverage.hpp
aobolensk/llvm-test-suite
f06b0646bced61b6fe92625aad9f12a000a17075
[ "Apache-2.0" ]
null
null
null
SYCL/ESIMD/api/functional/type_coverage.hpp
aobolensk/llvm-test-suite
f06b0646bced61b6fe92625aad9f12a000a17075
[ "Apache-2.0" ]
null
null
null
//===-- type_coverage.hpp - Define generic functions for type coverage. ---===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// /// /// \file /// This file provides a generic way to run tests with different types. /// //===----------------------------------------------------------------------===// #pragma once #include <string> #include <type_traits> #include <utility> namespace esimd_test { namespace api { namespace functional { // Type pack to store types and underlying data type names to use with // type_name_string template <typename... T> struct named_type_pack { const std::string names[sizeof...(T)]; template <typename... nameListT> named_type_pack(nameListT &&... nameList) : names{std::forward<nameListT>(nameList)...} {} }; enum class tested_types { all, fp, uint, sint }; // Factory method to retrieve pre-defined named_type_pack, to have the same // default type coverage over the tests template <tested_types required> auto get_tested_types() { if constexpr (required == tested_types::all) { #ifdef TEST_HALF return named_type_pack<char, unsigned char, signed char, short, unsigned short, int, unsigned int, long, unsigned long, float, sycl::half, double, long long, unsigned long long>( {"char", "unsigned char", "signed char", "short", "unsigned short", "int", "unsigned int", "long", "unsigned long", "float", "sycl::half", "double", "long long", "unsigned long long"}); #else return named_type_pack<char, unsigned char, signed char, short, unsigned short, int, unsigned int, long, unsigned long, float, double, long long, unsigned long long>( {"char", "unsigned char", "signed char", "short", "unsigned short", "int", "unsigned int", "long", "unsigned long", "float", "double", "long long", "unsigned long long"}); #endif } else if constexpr (required == tested_types::fp) { #ifdef TEST_HALF return named_type_pack<float, sycl::half, double>( {"float", "sycl::half", "double"}); #else return named_type_pack<float, double>({"float", "double"}); #endif } else if constexpr (required == tested_types::uint) { if constexpr (!std::is_signed_v<char>) { return named_type_pack<unsigned char, unsigned short, unsigned int, unsigned long, unsigned long long, char>( {"unsigned char", "unsigned short", "unsigned int", "unsigned long", "unsigned long long", "char"}); } else { return named_type_pack<unsigned char, unsigned short, unsigned int, unsigned long, unsigned long long>( {"unsigned char", "unsigned short", "unsigned int", "unsigned long", "unsigned long long"}); } } else if constexpr (required == tested_types::sint) { if constexpr (std::is_signed_v<char>) { return named_type_pack<signed char, short, int, long, long long, char>( {"signed char", "short", "int", "long", "long long", "char"}); } else { return named_type_pack<signed char, short, int, long, long long>( {"signed char", "short", "int", "long", "long long"}); } } else { static_assert(required != required, "Unexpected tested type"); } } // Run action for each of types given by named_type_pack instance template <template <typename, typename...> class action, typename... actionArgsT, typename... types, typename... argsT> inline bool for_all_types(const named_type_pack<types...> &typeList, argsT &&... args) { bool passed{true}; // run action for each type from types... parameter pack size_t typeNameIndex = 0; int packExpansion[] = { (passed &= action<types, actionArgsT...>{}(std::forward<argsT>(args)..., typeList.names[typeNameIndex]), ++typeNameIndex, 0 // Dummy initialization value )...}; // Every initializer clause is sequenced before any initializer clause that // follows it in the braced-init-list. Every expression in comma operator is // also strictly sequenced. So we can use increment safely. We still should // discard dummy results, but this initialization should not be optimized out // due side-effects static_cast<void>(packExpansion); return passed; } } // namespace functional } // namespace api } // namespace esimd_test
40.347458
80
0.611846
aobolensk
59d50d601f627a0bf9f4ce0814160d77c9f4f94d
18,753
cxx
C++
PWG/EMCAL/EMCALbase/AliEmcalESDTrackCutsGenerator.cxx
AudreyFrancisco/AliPhysics
cb36cfa7d1edcd969780e90fe6bfab5107f0f099
[ "BSD-3-Clause" ]
null
null
null
PWG/EMCAL/EMCALbase/AliEmcalESDTrackCutsGenerator.cxx
AudreyFrancisco/AliPhysics
cb36cfa7d1edcd969780e90fe6bfab5107f0f099
[ "BSD-3-Clause" ]
null
null
null
PWG/EMCAL/EMCALbase/AliEmcalESDTrackCutsGenerator.cxx
AudreyFrancisco/AliPhysics
cb36cfa7d1edcd969780e90fe6bfab5107f0f099
[ "BSD-3-Clause" ]
null
null
null
/************************************************************************** * Copyright(c) 1998-2016, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ #include <TString.h> #include <TFormula.h> #include "AliEmcalTrackSelection.h" #include "AliEmcalESDTrackCutsGenerator.h" #include "AliESDtrackCuts.h" #include "TError.h" const Int_t AliEmcalESDTrackCutsGenerator::fgkAddCutFactor = 10000; /** * Function to create track cuts for PWG Jet analysis * User can select a specific set by indicating cutMode * * \param cutMode has 8 digits: first 4 digits additional cuts, last 4 digits standard cuts * additional cuts are variations of standard cuts (used for hybrid track selection and QA) * Numbering starts from 1000 For standard and additional cut numbers * * \return AliESDtrackCuts object */ AliESDtrackCuts* AliEmcalESDTrackCutsGenerator::CreateTrackCutsPWGJE(Int_t cutMode) { //Get standard cuts: last 4 digits of cutMode Int_t stdCutMode = cutMode % fgkAddCutFactor; //Get additional cut mode: first 4 digits of cutMode Int_t addCutMode = (int)((float)cutMode/(float)fgkAddCutFactor); return CreateTrackCutsPWGJE(stdCutMode, addCutMode); } /** * Function to create track cuts for PWG Jet analysis * User can select a specific set by indicating cutMode * * \param stdCutMode standard cuts, should be one of the EStdCutMode_t enum values * \param addCutMode additional cuts, should be one of the EAddCutMode_t enum values * * \return AliESDtrackCuts object */ AliESDtrackCuts* AliEmcalESDTrackCutsGenerator::CreateTrackCutsPWGJE(Int_t stdCutMode, Int_t addCutMode) { AliESDtrackCuts* trackCuts = 0; TString tag; tag = SetStandardCuts(trackCuts, stdCutMode); tag += SetAdditionalCuts(trackCuts, addCutMode); ::Info("AliEmcalESDTrackCutsGenerator::CreateTrackCutsPWGJE", "Created track cuts for: %s", tag.Data()); return trackCuts; } /** * Function to create track cuts for PWG Jet analysis * User can select a specific set by indicating cutMode * * \param stdCutMode standard cuts, should be one of the EStdCutMode_t enum values * \param addCutMode1 additional cuts, should be one of the EAddCutMode_t enum values * \param addCutMode2 additional cuts, should be one of the EAddCutMode_t enum values * * \return AliESDtrackCuts object */ AliESDtrackCuts* AliEmcalESDTrackCutsGenerator::CreateTrackCutsPWGJE(Int_t stdCutMode, Int_t addCutMode1, Int_t addCutMode2) { AliESDtrackCuts* trackCuts = 0; TString tag; tag = SetStandardCuts(trackCuts, stdCutMode); tag += SetAdditionalCuts(trackCuts, addCutMode1); tag += SetAdditionalCuts(trackCuts, addCutMode2); ::Info("AliEmcalESDTrackCutsGenerator::CreateTrackCutsPWGJE", "Created track cuts for: %s", tag.Data()); return trackCuts; } /** * Function to set standard track cuts * User can select a specific set by indicating stdCutMode * * \param trackCuts AliESDtrackCuts to be set * \param stdCutMode has 4 digits, >= 1000 * * \return string with track cut label */ TString AliEmcalESDTrackCutsGenerator::SetStandardCuts(AliESDtrackCuts*& trackCuts, Int_t stdCutMode) { TString tag; if (trackCuts) { delete trackCuts; trackCuts = 0; } switch (stdCutMode) { case kRAA2011: { trackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kTRUE,1); trackCuts->SetMinNCrossedRowsTPC(120); trackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.8); trackCuts->SetMaxChi2PerClusterITS(36); trackCuts->SetMaxFractionSharedTPCClusters(0.4); trackCuts->SetMaxChi2TPCConstrainedGlobal(36); trackCuts->SetEtaRange(-0.9,0.9); trackCuts->SetPtRange(0.15, 1e10); tag = "Global track RAA analysis QM2011 + Chi2ITS<36"; break; } case kGlobalTracksNCls90NoSPD: { trackCuts = new AliESDtrackCuts("AliESDtrackCuts"); // TPC trackCuts->SetMinNClustersTPC(90); trackCuts->SetMaxChi2PerClusterTPC(4); trackCuts->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1 trackCuts->SetAcceptKinkDaughters(kFALSE); trackCuts->SetRequireTPCRefit(kTRUE); trackCuts->SetMaxFractionSharedTPCClusters(0.4); // ITS trackCuts->SetRequireITSRefit(kTRUE); //accept secondaries trackCuts->SetMaxDCAToVertexXY(2.4); trackCuts->SetMaxDCAToVertexZ(3.2); trackCuts->SetDCAToVertex2D(kTRUE); //reject fakes trackCuts->SetMaxChi2PerClusterITS(36); trackCuts->SetRequireSigmaToVertex(kFALSE); trackCuts->SetEtaRange(-0.9,0.9); trackCuts->SetPtRange(0.15, 100.); tag = "Global tracks jet analysis with ITSrefit and NclsIter1=90, noSPD requirement"; break; } case kGlobalTracksNCls80NoSPD: { trackCuts = new AliESDtrackCuts("AliESDtrackCuts"); // TPC trackCuts->SetMinNClustersTPC(80); trackCuts->SetMaxChi2PerClusterTPC(4); trackCuts->SetAcceptKinkDaughters(kFALSE); trackCuts->SetRequireTPCRefit(kTRUE); trackCuts->SetMaxFractionSharedTPCClusters(0.4); // ITS trackCuts->SetRequireITSRefit(kTRUE); //accept secondaries trackCuts->SetMaxDCAToVertexXY(2.4); trackCuts->SetMaxDCAToVertexZ(3.2); trackCuts->SetDCAToVertex2D(kTRUE); //reject fakes trackCuts->SetMaxChi2PerClusterITS(36); trackCuts->SetRequireSigmaToVertex(kFALSE); trackCuts->SetEtaRange(-0.9,0.9); trackCuts->SetPtRange(0.15, 100.); tag = "Global tracks jet analysis with ITSrefit and Ncls=80, noSPD requirement"; break; } case kGlobalTracks2010NCrossRows120: { trackCuts = new AliESDtrackCuts("AliESDtrackCuts"); // tight global tracks trackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kFALSE,1); trackCuts->SetMinNClustersTPC(0); trackCuts->SetMinNCrossedRowsTPC(120); trackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.1);// essentially switches it off trackCuts->SetMaxDCAToVertexXY(2.4); trackCuts->SetMaxDCAToVertexZ(3.2); trackCuts->SetDCAToVertex2D(kTRUE); trackCuts->SetMaxChi2PerClusterITS(36); trackCuts->SetMaxFractionSharedTPCClusters(0.4); tag = "Global tracks ITSTPC2010 + NCrossedRows + loose ITS"; break; } case kGlobalTracksNCls70NoSPD: { trackCuts = new AliESDtrackCuts("AliESDtrackCuts"); // TPC trackCuts->SetMinNClustersTPC(70); trackCuts->SetMaxChi2PerClusterTPC(4); trackCuts->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1 trackCuts->SetAcceptKinkDaughters(kFALSE); trackCuts->SetRequireTPCRefit(kTRUE); trackCuts->SetMaxFractionSharedTPCClusters(0.4); // ITS trackCuts->SetRequireITSRefit(kTRUE); //accept secondaries trackCuts->SetMaxDCAToVertexXY(2.4); trackCuts->SetMaxDCAToVertexZ(3.2); trackCuts->SetDCAToVertex2D(kTRUE); //reject fakes trackCuts->SetMaxChi2PerClusterITS(36); trackCuts->SetRequireSigmaToVertex(kFALSE); trackCuts->SetEtaRange(-0.9,0.9); trackCuts->SetPtRange(0.15, 100.); tag = "Global tracks jet analysis with ITSrefit and NclsIter1=70, noSPD requirement"; break; } case kGlobalTracksNCls70NoSPDNoPtCut: { trackCuts = new AliESDtrackCuts("AliESDtrackCuts"); // TPC trackCuts->SetMinNClustersTPC(70); trackCuts->SetMaxChi2PerClusterTPC(4); trackCuts->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1 trackCuts->SetAcceptKinkDaughters(kFALSE); trackCuts->SetRequireTPCRefit(kTRUE); trackCuts->SetMaxFractionSharedTPCClusters(0.4); // ITS trackCuts->SetRequireITSRefit(kTRUE); //accept secondaries trackCuts->SetMaxDCAToVertexXY(2.4); trackCuts->SetMaxDCAToVertexZ(3.2); trackCuts->SetDCAToVertex2D(kTRUE); //reject fakes trackCuts->SetMaxChi2PerClusterITS(36); trackCuts->SetRequireSigmaToVertex(kFALSE); trackCuts->SetEtaRange(-0.9,0.9); trackCuts->SetPtRange(0.15, 1E+15); tag = "Global tracks jet analysis with ITSrefit and NclsIter1=70, noSPD requirement, no upper pt cut"; break; } case kGlobalTracksNClsPtDepNoSPDNoPtCut: { trackCuts = new AliESDtrackCuts("AliESDtrackCuts"); // TPC TFormula *f1NClustersTPCLinearPtDep = new TFormula("f1NClustersTPCLinearPtDep","70.+30./20.*x"); trackCuts->SetMinNClustersTPCPtDep(f1NClustersTPCLinearPtDep,20.); trackCuts->SetMinNClustersTPC(70); trackCuts->SetMaxChi2PerClusterTPC(4); trackCuts->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1 trackCuts->SetAcceptKinkDaughters(kFALSE); trackCuts->SetRequireTPCRefit(kTRUE); trackCuts->SetMaxFractionSharedTPCClusters(0.4); // ITS trackCuts->SetRequireITSRefit(kTRUE); //accept secondaries trackCuts->SetMaxDCAToVertexXY(2.4); trackCuts->SetMaxDCAToVertexZ(3.2); trackCuts->SetDCAToVertex2D(kTRUE); //reject fakes trackCuts->SetMaxChi2PerClusterITS(36); trackCuts->SetMaxChi2TPCConstrainedGlobal(36); trackCuts->SetRequireSigmaToVertex(kFALSE); trackCuts->SetEtaRange(-0.9,0.9); trackCuts->SetPtRange(0.15, 1E+15); tag = "Global tracks jet analysis with ITSrefit and NclsIter1=PtDep, noSPD requirement, no upper pt cut, golden chi2"; break; } case kGlobalTracks2011: { trackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE,1); //accept secondaries trackCuts->SetMaxDCAToVertexXY(2.4); trackCuts->SetMaxDCAToVertexZ(3.2); trackCuts->SetDCAToVertex2D(kTRUE); trackCuts->SetMaxChi2TPCConstrainedGlobal(36); trackCuts->SetEtaRange(-0.9,0.9); trackCuts->SetPtRange(0.15, 1E+15); tag = "Global tracks with AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE)"; break; } case kGlobalTracks2011NoSPD: { trackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE,1); //accept secondaries trackCuts->SetMaxDCAToVertexXY(2.4); trackCuts->SetMaxDCAToVertexZ(3.2); trackCuts->SetDCAToVertex2D(kTRUE); trackCuts->SetMaxChi2TPCConstrainedGlobal(36); trackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone); trackCuts->SetMaxFractionSharedTPCClusters(0.4); tag = "Global tracks 2011 with AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE) and no SPD requirement"; break; } case kGlobalTracksNCls90NoITS: { trackCuts = new AliESDtrackCuts("AliESDtrackCuts"); // TPC trackCuts->SetMinNClustersTPC(90); trackCuts->SetMaxChi2PerClusterTPC(4); trackCuts->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1 trackCuts->SetAcceptKinkDaughters(kFALSE); trackCuts->SetRequireTPCRefit(kTRUE); trackCuts->SetMaxFractionSharedTPCClusters(0.4); //accept secondaries trackCuts->SetMaxDCAToVertexXY(2.4); trackCuts->SetMaxDCAToVertexZ(3.2); trackCuts->SetDCAToVertex2D(kTRUE); trackCuts->SetRequireSigmaToVertex(kFALSE); trackCuts->SetEtaRange(-0.9,0.9); trackCuts->SetPtRange(0.15, 100.); tag = "Global tracks jet analysis, loose cuts, NClsIter1=90, no ITS requirements"; break; } case kTPCOnlyTracksNCls70: { trackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); // trackCuts->SetRequireTPCRefit(kTRUE); trackCuts->SetMinNClustersTPC(70); trackCuts->SetEtaRange(-0.9,0.9); trackCuts->SetPtRange(0.15, 100.); tag = "TPConly track cuts, loose cuts, NCls=70, no ITS requirements"; break; } case kTPCOnlyTracksNCrossRows120: { trackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); trackCuts->SetMinNClustersTPC(0); trackCuts->SetMinNCrossedRowsTPC(120); trackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.1);// essentially switches it off trackCuts->SetEtaRange(-0.9,0.9); trackCuts->SetPtRange(0.15, 100.); tag = "TPConly track cuts, loose cuts, NCrossRows=120, no ITS requirements"; break; } default: { Printf("AliEmcalESDTrackCutsGenerator: standard cuts not recognized."); break; } } return tag; } /** * Function to set additional track cuts on top of the standard ones * User can select a specific set by indicating addCutMode * * \param trackCuts AliESDtrackCuts to be set * \param addCutMode has 4 digits, >= 1000 * * \return string with track cut label */ TString AliEmcalESDTrackCutsGenerator::SetAdditionalCuts(AliESDtrackCuts*& trackCuts, Int_t addCutMode) { TString tag; switch (addCutMode) { case kSPDAny: { trackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny); tag += " + additonal: SPD any requirement"; break; } case kSPDNone: { trackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kNone); tag += " + additional: w/o hits in SPD"; break; } case kNoITSChi2: { trackCuts->SetMaxChi2PerClusterITS(1E10); tag += " + additional: maxITSChi2=1e10"; break; } case kNoMinTPCCls: { trackCuts->SetMinNClustersTPC(0); trackCuts->SetMinNCrossedRowsTPC(0); trackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.); tag += " + additional: minClusters=0 minCrossedRows=0 minCrossedRowsOverFindable=0"; break; } case kNoITSRefit: { trackCuts->SetRequireITSRefit(kFALSE); tag += " + additional: ITSrefit=kFALSE"; break; } case kSPDOff: { trackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kOff); tag += " + additional: no SPD requirement (kOff)"; break; } } return tag; } /** * Helper function to steer period string into an enum type * * \param period String identifying a data or MC period * * \return enum type identifying a data or MC period */ AliEmcalESDTrackCutsGenerator::EDataSet_t AliEmcalESDTrackCutsGenerator::SteerDataSetFromString(TString period) { EDataSet_t dataSet = kUnknown; TString strPeriod(period); strPeriod.ToLower(); if (strPeriod == "lhc10h") { dataSet = kLHC10h; } else if (strPeriod == "lhc11a" || strPeriod == "lhc12a15a") { dataSet = kLHC11a; } else if (strPeriod == "lhc10b" || strPeriod == "lhc10c" || strPeriod == "lhc10d" || strPeriod == "lhc10e") { dataSet = kLHC10bcde; } else if (strPeriod == "lhc11a1a" || strPeriod == "lhc11a1b" || strPeriod == "lhc11a1c" || strPeriod == "lhc11a1d" || strPeriod == "lhc11a1e" || strPeriod == "lhc11a1f" || strPeriod == "lhc11a1g" || strPeriod == "lhc11a1h" || strPeriod == "lhc11a1i" || strPeriod == "lhc11a1j") { dataSet = kLHC11a; } else if (strPeriod == "lhc11c") { dataSet = kLHC11c; } else if (strPeriod == "lhc11d") { dataSet = kLHC11d; } else if (strPeriod == "lhc11h" || strPeriod == "lhc12a15e") { dataSet = kLHC11h; } else if (strPeriod == "lhc12g") { dataSet = kLHC11h; } else if (strPeriod == "lhc12") { dataSet = kLHC11h; } else if (strPeriod == "lhc13b") { dataSet = kLHC11h; } else if (strPeriod == "lhc13c") { dataSet = kLHC11h; } else if (strPeriod == "lhc13d") { dataSet = kLHC11h; } else if (strPeriod == "lhc13e") { dataSet = kLHC11h; } else if (strPeriod == "lhc13f") { dataSet = kLHC11h; } else if (strPeriod == "lhc13g") { dataSet = kLHC11h; } else if (strPeriod == "lhc16q") { dataSet = kLHC11h; } else if (strPeriod == "lhc16r") { dataSet = kLHC11h; } else if (strPeriod == "lhc16s") { dataSet = kLHC11h; } else if (strPeriod == "lhc16t") { dataSet = kLHC11h; } else if (strPeriod == "lhc12a15f") { dataSet = kLHC11h; } else if (strPeriod == "lhc13b4") { dataSet = kLHC11h; } else if (strPeriod == "lhc12a15g") { dataSet = kLHC11d; } else if (strPeriod == "lhc12f2a") { dataSet = kLHC11d; } else if (strPeriod.BeginsWith("lhc12a17")) { dataSet = kLHC11h; } else if (strPeriod == "lhc14a1") { dataSet = kLHC11h; } else if (strPeriod.BeginsWith("lhc15g6")) { dataSet = kLHC10bcde; } else { ::Error("AliEmcalESDTrackCutsGenerator::SteerDataSetFromString", "Dataset %s not recognized!", period.Data()); } return dataSet; } /** * Adds hybrid track cuts to an AliEmcalTrackSelection object * * \param trkSel AliEmcalTrackSelection object * \param period enum type identifying a data or MC period */ void AliEmcalESDTrackCutsGenerator::AddHybridTrackCuts(AliEmcalTrackSelection* trkSel, EDataSet_t period) { switch (period) { case kLHC11c: case kLHC11d: case kLHC11h: { AliESDtrackCuts *cutsp = CreateTrackCutsPWGJE(kGlobalTracks2011NoSPD, kSPDAny); trkSel->AddTrackCuts(cutsp); AliESDtrackCuts *hybsp = CreateTrackCutsPWGJE(kGlobalTracks2011NoSPD, kSPDOff); trkSel->AddTrackCuts(hybsp); break; } case kLHC10h: case kLHC11a: case kLHC10bcde: { /* hybrid track cuts*/ AliESDtrackCuts *cutsp = CreateTrackCutsPWGJE(kGlobalTracksNClsPtDepNoSPDNoPtCut, kSPDAny); trkSel->AddTrackCuts(cutsp); AliESDtrackCuts *hybsp = CreateTrackCutsPWGJE(kGlobalTracksNClsPtDepNoSPDNoPtCut, kSPDOff, kNoITSRefit); trkSel->AddTrackCuts(hybsp); break; } default: { ::Error("AliEmcalESDTrackCutsGenerator::AddHybridTrackCuts", "Hybrid track cuts not available for dataset %d", period); break; } } } /** * Adds TPC only track cuts to an AliEmcalTrackSelection object * * \param trkSel AliEmcalTrackSelection object * \param period enum type identifying a data or MC period */ void AliEmcalESDTrackCutsGenerator::AddTPCOnlyTrackCuts(AliEmcalTrackSelection* trkSel, EDataSet_t period) { switch (period) { case kLHC11c: case kLHC11d: case kLHC11h: { AliESDtrackCuts *cutsp = CreateTrackCutsPWGJE(kTPCOnlyTracksNCls70); trkSel->AddTrackCuts(cutsp); break; } default: { Printf("AliEmcalESDTrackCutsGenerator::AddTPCOnlyTrackCuts: TPC only track cuts not available for dataset %d", period); break; } } }
30.492683
124
0.702181
AudreyFrancisco
59da3cacbf049ccb878f5e26fb93c07edeb08833
3,157
cc
C++
tests/config_test.cc
jjzhang166/lullaby
d9b11ea811cb5869b46165b9b9537b6063c6cbae
[ "Apache-2.0" ]
null
null
null
tests/config_test.cc
jjzhang166/lullaby
d9b11ea811cb5869b46165b9b9537b6063c6cbae
[ "Apache-2.0" ]
null
null
null
tests/config_test.cc
jjzhang166/lullaby
d9b11ea811cb5869b46165b9b9537b6063c6cbae
[ "Apache-2.0" ]
null
null
null
/* Copyright 2017 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #include "lullaby/modules/config/config.h" #include "gmock/gmock.h" #include "gtest/gtest.h" #include "lullaby/generated/config_def_generated.h" #include "lullaby/modules/flatbuffers/flatbuffer_writer.h" #include "lullaby/util/inward_buffer.h" namespace lull { namespace { using ::testing::Eq; TEST(ConfigTest, Empty) { const HashValue key = Hash("key"); Config cfg; int value = cfg.Get(key, 12); EXPECT_THAT(value, Eq(12)); } TEST(ConfigTest, SetGet) { const HashValue key = Hash("key"); Config cfg; cfg.Set(key, 34); EXPECT_THAT(cfg.Get(key, 12), Eq(34)); cfg.Set(key, 56); EXPECT_THAT(cfg.Get(key, 12), Eq(56)); } TEST(ConfigTest, Remove) { const HashValue key = Hash("key"); Config cfg; cfg.Set(key, 34); EXPECT_THAT(cfg.Get(key, 12), Eq(34)); cfg.Remove(key); EXPECT_THAT(cfg.Get(key, 12), Eq(12)); } template <typename T> void AddVariant(ConfigDefT* def, const std::string& key, const decltype(T::value) & value) { KeyVariantPairDefT pair; pair.key = key; pair.value.set<T>()->value = value; def->values.emplace_back(std::move(pair)); } TEST(ConfigTest, SetFromFlatbuffer) { ConfigDefT data; AddVariant<DataBoolT>(&data, "bool_key", true); AddVariant<DataIntT>(&data, "int_key", 123); AddVariant<DataFloatT>(&data, "float_key", 456.f); AddVariant<DataStringT>(&data, "string_key", "hello"); AddVariant<DataHashValueT>(&data, "hash_key", Hash("world")); InwardBuffer buffer(256); auto flatbuffer = WriteFlatbuffer(&data, &buffer); Config cfg; SetConfigFromFlatbuffer(&cfg, flatbuffers::GetRoot<ConfigDef>(flatbuffer)); EXPECT_TRUE(cfg.Get(Hash("bool_key"), false)); EXPECT_THAT(cfg.Get(Hash("int_key"), 0), Eq(123)); EXPECT_THAT(cfg.Get(Hash("float_key"), 0.f), Eq(456.f)); EXPECT_THAT(cfg.Get(Hash("string_key"), std::string("")), Eq("hello")); EXPECT_THAT(cfg.Get(Hash("hash_key"), HashValue(0)), Eq(Hash("world"))); } TEST(ConfigTest, SetFromVariantMap) { VariantMap var; var[Hash("bool_key")] = true; var[Hash("int_key")] = 123; var[Hash("float_key")] = 456.f; var[Hash("string_key")] = std::string("hello"); var[Hash("hash_key")] = Hash("world"); Config cfg; SetConfigFromVariantMap(&cfg, &var); EXPECT_TRUE(cfg.Get(Hash("bool_key"), false)); EXPECT_THAT(cfg.Get(Hash("int_key"), 0), Eq(123)); EXPECT_THAT(cfg.Get(Hash("float_key"), 0.f), Eq(456.f)); EXPECT_THAT(cfg.Get(Hash("string_key"), std::string("")), Eq("hello")); EXPECT_THAT(cfg.Get(Hash("hash_key"), HashValue(0)), Eq(Hash("world"))); } } // namespace } // namespace lull
28.7
77
0.69433
jjzhang166
59dbbd987f751c17d80fca7a13dd90ee65078e84
312
cpp
C++
src/filament_tester.cpp
Betterton-Lab/CyLaKS
17d01e8742b8172b477dd99d254c2d0771f774d0
[ "BSD-3-Clause" ]
null
null
null
src/filament_tester.cpp
Betterton-Lab/CyLaKS
17d01e8742b8172b477dd99d254c2d0771f774d0
[ "BSD-3-Clause" ]
null
null
null
src/filament_tester.cpp
Betterton-Lab/CyLaKS
17d01e8742b8172b477dd99d254c2d0771f774d0
[ "BSD-3-Clause" ]
null
null
null
#include "cylaks/filament_tester.hpp" #include "cylaks/protein_tester.hpp" void FilamentTester::Initialize(ProteinTester *proteins) { proteins_ = proteins; FilamentManager::proteins_ = dynamic_cast<ProteinManager *>(proteins_); FilamentManager::SetParameters(); FilamentManager::GenerateFilaments(); }
28.363636
73
0.788462
Betterton-Lab
59de3fa528965e2c40956339db5fb3f5056a5b10
2,079
cpp
C++
Fractal/FractalPhysics/src/PhysicsBody.cpp
talislincoln/fractals
a9ed52e99b9737ce0a6bba715f61e4d122e37dd5
[ "MIT" ]
2
2016-09-22T16:11:17.000Z
2016-09-22T16:11:55.000Z
Fractal/FractalPhysics/src/PhysicsBody.cpp
talislincoln/FractalGameEngine
a9ed52e99b9737ce0a6bba715f61e4d122e37dd5
[ "MIT" ]
null
null
null
Fractal/FractalPhysics/src/PhysicsBody.cpp
talislincoln/FractalGameEngine
a9ed52e99b9737ce0a6bba715f61e4d122e37dd5
[ "MIT" ]
null
null
null
#include "PhysicsBody.h" namespace fractal { namespace fphysics { PhysicsBody::PhysicsBody() { m_aabb; m_mass = float(1.0); m_worldCenter.load(); m_localCenter.load(); m_linearVelocity.load(); m_angularVelocity.load(); m_gravityScale = float(1.0); //m_linearDamping = float(0.0); //m_angularDamping = float(0.1); m_force.load(); m_torque.load(); m_flags = 0x000000000; m_flags |= DYNAMIC; m_flags |= ALLOWSLEEP; m_flags |= AWAKE; m_flags |= ACTIVE; } void PhysicsBody::calculateMassData(const std::vector<PhysicsShape*> shapeList, Transform& m_localTransform) { Matrix3 inertia = Matrix3((0.0f)); m_inverseInertiaModel = Matrix3((0.0f)); m_inverseInertiaWorld = Matrix3((0.0f)); m_inverseMass = (0.0f); m_mass = (0.0f); float mass = (0.0f); if (m_flags & STATIC || m_flags & KINEMATIC) { m_localCenter.load(); m_worldCenter = m_localTransform.position; return; } Vector3 lc; lc.load(); for (auto& shape : shapeList) { if (shape->density == float(0.0)) continue; massData md; shape->calMass(&md); mass += md.mass; inertia += md.inertia; lc += md.center * md.mass; } if (mass > float(0.0)) { m_mass = mass; m_inverseMass = float(1.0) / mass; lc *= m_inverseMass; Matrix3 identity; Matrix3 outerP = Matrix3::outerProduct(lc, lc); identity.loadIdentity(); inertia -= (identity * lc.dot(lc) - outerP) * mass; m_inverseInertiaModel = inertia; bool freezeX = false, freezeY = false, freezeZ = false; if (m_flags & LOCKAXISX) freezeX = true; if (m_flags & LOCKAXISY) freezeY = true; if (m_flags & LOCKAXISZ) freezeZ = true; m_inverseInertiaModel.freezeRotate(freezeX, freezeY, freezeZ); } else { // Force all dynamic bodies to have some mass m_inverseMass = float(1.0); m_inverseInertiaModel = Matrix3(0.0f); m_inverseInertiaWorld = Matrix3(0.0f); } m_localCenter = lc; m_worldCenter = m_localTransform * (Point3)lc; } } }
22.117021
112
0.632516
talislincoln
59e18176883ad2398bd1ce097678e81ad17af408
17,223
cpp
C++
com/netfx/src/clr/tools/jitman/jitman.cpp
npocmaka/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
17
2020-11-13T13:42:52.000Z
2021-09-16T09:13:13.000Z
com/netfx/src/clr/tools/jitman/jitman.cpp
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
2
2020-10-19T08:02:06.000Z
2020-10-19T08:23:18.000Z
com/netfx/src/clr/tools/jitman/jitman.cpp
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
14
2020-11-14T09:43:20.000Z
2021-08-28T08:59:57.000Z
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== #include <windows.h> #include "resource.h" #include <shellapi.h> #include <stdlib.h> #include <assert.h> #include <tlhelp32.h> #include "__file__.ver" #include <corver.h> // These are used to identify components in callbacks. #define JIT_TRAY 0x2345 // Max size of the strings we'll be reading in this dialog #define REG_STRING_SIZE 100 // String we'll use to generate a named semaphore #define SEMA_STRING "JITMAN" enum { JIT_OPT_OVERALL, JIT_OPT_SPEED , JIT_OPT_SIZE, JIT_OPT_ANY, JIT_OPT_DEFAULT = JIT_OPT_SPEED }; // Function Prototypes // Callbacks for the window and the dialog LRESULT CALLBACK wndprocMainWindow(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); int CALLBACK wndprocDialog(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); // Registry setting functions DWORD GetCOMPlusRegistryDwordValueEx(const char * valName, DWORD defValue, HKEY hRoot); BOOL SetCOMPlusRegistryDwordValueEx(const char * valName, DWORD value, HKEY hRoot); void DeleteCOMPlusRegistryValueEx(const char * valName, HKEY hRoot); // Various functions used by the dialog void onEconoJITClick(HWND hwnd); void onLimitCacheClick(HWND hwnd); void CheckConGC(HWND hwnd); int GetData(HWND hwnd); void SetData(HWND hwnd); // Other stuff void DisplayUsage(); // Global variables // This variable keeps track is our Dialog Box is open int g_fDialogOpen=0; // This is the handle for our dialog box HWND g_hDialog=NULL; // This is the popup menu for our program HMENU g_hMenu=NULL; int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { // See if we need to display usage information if (lpCmdLine && *lpCmdLine) DisplayUsage(); // Check to see if we should run HANDLE hSema=CreateSemaphore(NULL, 1, 1, SEMA_STRING); if (hSema && WaitForSingleObject(hSema, 0) == WAIT_TIMEOUT) { // There's already an instance running... we shouldn't run CloseHandle(hSema); exit(0); } // We need to create and set up a window so we can register it with the system tray // Let's register a window type WNDCLASS wc; wc.style=0; wc.lpfnWndProc=wndprocMainWindow; wc.cbClsExtra=0; wc.cbWndExtra=0; wc.hInstance=hInstance; wc.hIcon=NULL; wc.hCursor=NULL; wc.hbrBackground=(HBRUSH)(COLOR_WINDOW+1); wc.lpszMenuName=NULL; wc.lpszClassName="JIT Manager"; RegisterClass(&wc); HWND hMainWindow=CreateWindow(wc.lpszClassName, "JIT Manager", 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, wc.hInstance, NULL); // Now load the icon that will be placed in the system tray HICON hJITIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_JITMAN)); // Set up the System Tray stuff // This holds the information needed to place our item in the system tray NOTIFYICONDATA nid; nid.cbSize=sizeof(nid); nid.hWnd=hMainWindow; nid.hIcon = hJITIcon; nid.uID=0; nid.uFlags=NIF_ICON|NIF_MESSAGE|NIF_TIP; strcpy(nid.szTip,"JIT Manager"); nid.uCallbackMessage=JIT_TRAY; Shell_NotifyIcon(NIM_ADD, &nid); // Now create our Dialog Box g_hDialog = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_JITMANDLG_DIALOG), hMainWindow, wndprocDialog); // Give it the lightning bolt icon SendMessage(g_hDialog, WM_SETICON, ICON_SMALL, (long)hJITIcon); // Create the popup menu g_hMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU)); // Now let's handle the messages we receive as long as we're supposed to MSG msg; int iErrorCode = GetMessage(&msg, NULL, 0,0); while (iErrorCode != 0 && iErrorCode != -1) { // See if this message is intended for our dialog box if (!IsDialogMessage(g_hDialog, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } iErrorCode = GetMessage(&msg, NULL, 0,0); } // Remove our icon from the System Tray Shell_NotifyIcon(NIM_DELETE, &nid); // Now clean up if (g_hDialog) DestroyWindow(g_hDialog); DestroyWindow(hMainWindow); DestroyIcon((HICON)hJITIcon); // Now clean up our semaphore ReleaseSemaphore(hSema, 1, NULL); CloseHandle(hSema); return 0; }// WinMain //--------------------------------------------------------------- // DisplayUsage // // This function will display the command line arguments available // to this program //--------------------------------------------------------------- void DisplayUsage() { char szUsage[1000]=""; strcat(szUsage, "Microsoft (R) CLR JIT Compiler Manager Version "); strcat(szUsage, VER_FILEVERSION_STR); strcat(szUsage, "\n"); strcat(szUsage, VER_LEGALCOPYRIGHT_DOS_STR); strcat(szUsage, "\n\n"); strcat(szUsage, "Usage: jitman [-?]\n\n"); strcat(szUsage, " -? Displays this text.\n"); MessageBox(NULL, szUsage, "CLR JIT Compiler Manager Options", MB_OK); exit(0); }// DisplayUsage //--------------------------------------------------------------- // wndprocMainWindow // // This function handles all windows messages. Its main responsbility // is popping up the Configuration Dialog when the user double clicks // on the icon in the tray and bringing up the popup menu when the // user right clicks on the icon in the tray //--------------------------------------------------------------- LRESULT CALLBACK wndprocMainWindow(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_CREATE: return 0; case JIT_TRAY: if (lParam == WM_LBUTTONDBLCLK) { // Check to see if the Dialog is open if (!g_fDialogOpen) { // Let's pop open the dialog // First make sure the dialog box will have the focus initially SetForegroundWindow(hwnd); // Let's reload all the values in the dialog box in case someone was // mucking with the registry while this dialog was down. SetData(g_hDialog); onEconoJITClick(g_hDialog); CheckConGC(g_hDialog); // And now show the dialog ShowWindow(g_hDialog, SW_SHOWNORMAL); g_fDialogOpen=1; } } else if (lParam == WM_RBUTTONDOWN && !g_fDialogOpen) { // We should create a menu that allows the user to close this thing HMENU myMenu = CreatePopupMenu(); if (myMenu != NULL) // Make sure we could create it { POINT pt; GetCursorPos(&pt); SetForegroundWindow(hwnd); // If they selected the "close" from the menu, we should inform the // main loop to quit. if (ID_CLOSE == TrackPopupMenu(GetSubMenu(g_hMenu,0), TPM_RIGHTALIGN|TPM_BOTTOMALIGN|TPM_RETURNCMD|TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL)) PostQuitMessage(0); PostMessage(hwnd, WM_NULL, 0, 0); } } return TRUE; default: return DefWindowProc(hwnd, message, wParam, lParam); } }// wndprocMainWindow //--------------------------------------------------------------- // wndprocDialog // // This function handles all message to the dialog. It handles all // the housekeeping associated with the dialog box //--------------------------------------------------------------- int CALLBACK wndprocDialog(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { // We need to get the Dialog box ready to be displayed case WM_INITDIALOG: SetData(hwnd); onEconoJITClick(hwnd); CheckConGC(hwnd); return TRUE; case WM_COMMAND: switch(wParam) { case IDCANCEL: ShowWindow(hwnd, SW_HIDE); g_fDialogOpen=0; return TRUE; case IDOK: // Check to see if it passes our validation if (GetData(hwnd)) { ShowWindow(hwnd, SW_HIDE); g_fDialogOpen=0; } return TRUE; case IDC_ECONOJIT: onEconoJITClick(hwnd); return TRUE; case IDC_LIMITCACHE: onLimitCacheClick(hwnd); return TRUE; } return FALSE; default: return FALSE; } }// wndprocDialog //--------------------------------------------------------------- // CheckConGC // // This function will check to see if the OS (and its settings) // will support Concurrent GC. If it doesn't, we disable the // checkbox. //--------------------------------------------------------------- void CheckConGC(HWND hwnd) { // If the registry key WriteWatch is not set to 1 in // [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management] // then the user cannot select Enabled Concurrent GC int iVal = 0; HKEY hkey; DWORD value; DWORD size = sizeof(value); DWORD type = REG_BINARY; DWORD res; res = RegOpenKeyEx (HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management", 0, KEY_ALL_ACCESS, &hkey); if (res == ERROR_SUCCESS) { res = RegQueryValueEx(hkey, "WriteWatch", 0, &type, (unsigned char *)&value, &size); RegCloseKey(hkey); if (res != ERROR_SUCCESS || type != REG_DWORD) iVal = 0; else iVal = value; } // We do not support this option if (iVal != 1) EnableWindow(GetDlgItem(hwnd, IDC_CONCURGC), 0); else EnableWindow(GetDlgItem(hwnd, IDC_CONCURGC), 1); }// CheckConGC //--------------------------------------------------------------- // onEconoJITClick // // This function will toggle the activate of the text fields // when the user selects/deselects use EconoJIT only //--------------------------------------------------------------- void onEconoJITClick(HWND hwnd) { // We'll enable them by default.... int fEnable = 1; // They unchecked the box.... let's disable the text fields if (IsDlgButtonChecked(hwnd, IDC_ECONOJIT) == BST_CHECKED) fEnable = 0; // Enable/Disable the text field EnableWindow(GetDlgItem(hwnd, IDC_MAXPITCH), fEnable); // Enable/Disable the "LimitCache Size" checkbox EnableWindow(GetDlgItem(hwnd, IDC_LIMITCACHE), fEnable); // Make sure we're not stomping on LimitCache's properties on the max cache fEnable&=IsDlgButtonChecked(hwnd, IDC_LIMITCACHE) == BST_CHECKED; EnableWindow(GetDlgItem(hwnd, IDC_MAXCACHE), fEnable); }// onEconoJITClick //--------------------------------------------------------------- // onLimitCacheClick // // This function will toggle the activatation of the text field // to set the maximum code cache size //--------------------------------------------------------------- void onLimitCacheClick(HWND hwnd) { // We'll disable it by default.... int fEnable = 0; // They unchecked the box.... let's disable the text fields if (IsDlgButtonChecked(hwnd, IDC_LIMITCACHE) == BST_CHECKED) fEnable = 1; // Make sure we're not overwriting the property that EconoJIT set on this item fEnable&=IsDlgButtonChecked(hwnd, IDC_ECONOJIT) != BST_CHECKED; // Enable/Disable the text field EnableWindow(GetDlgItem(hwnd, IDC_MAXCACHE), fEnable); }// onLimitCacheClick //--------------------------------------------------------------- // GetData // // This function will get the data from the dialog box and place // it in the registry //--------------------------------------------------------------- int GetData(HWND hwnd) { char szMaxCache[100]; char szMaxPitch[100]; // First pull all the data off the dialog GetDlgItemText(hwnd, IDC_MAXPITCH, szMaxPitch, 99); GetDlgItemText(hwnd, IDC_MAXCACHE, szMaxCache, 99); int iEconJIT = IsDlgButtonChecked(hwnd, IDC_ECONOJIT); int iOp4Size = IsDlgButtonChecked(hwnd, IDC_OP4SIZE); int iConGC = IsDlgButtonChecked(hwnd, IDC_CONCURGC); int iLimitCC = IsDlgButtonChecked(hwnd, IDC_LIMITCACHE); // Now let's verify the text fields // We only need to verify the max cache field if we're limiting the // size of the cache int iMaxCache; if (iLimitCC) { iMaxCache = atoi(szMaxCache); if (iMaxCache < 4096) { MessageBox(hwnd, "The Max Code Cache field must be at least 4096 bytes", "Error", MB_ICONEXCLAMATION); return 0; } } // Ok, MaxCache is ok... let's test the Max Pitch int iMaxPitch = atoi(szMaxPitch); if (iMaxPitch < 0) { MessageBox(hwnd, "The Max Code Pitch Overhead field may only contain positive values", "Error", MB_ICONEXCLAMATION); return 0; } else if (iMaxPitch > 100) { MessageBox(hwnd, "The Max Code Pitch Overhead field cannot be greater than 100", "Error", MB_ICONEXCLAMATION); return 0; } // See if we need to doctor up the text fields // If nothing was put in the Max Pitch Overhead box, we'll put in the default if (!szMaxPitch[0]) { iMaxPitch=10; } // Ok, all the data is validated... let's put it where it belongs // If they're not limiting the size of the Code Cache, we shouldn't have an entry in // the registry if (iLimitCC) SetCOMPlusRegistryDwordValueEx("MaxCodeCacheSize", iMaxCache, HKEY_LOCAL_MACHINE); else DeleteCOMPlusRegistryValueEx("MaxCodeCacheSize", HKEY_LOCAL_MACHINE); SetCOMPlusRegistryDwordValueEx("MaxPitchOverhead", iMaxPitch, HKEY_LOCAL_MACHINE); SetCOMPlusRegistryDwordValueEx("JITEnable", !iEconJIT, HKEY_LOCAL_MACHINE); SetCOMPlusRegistryDwordValueEx("GCconcurrent", iConGC, HKEY_LOCAL_MACHINE); // If they checked Optimize for Size, write out to opforSize, else we'll Op Overall SetCOMPlusRegistryDwordValueEx("JITOptimizeType", iOp4Size?JIT_OPT_SIZE:JIT_OPT_OVERALL, HKEY_LOCAL_MACHINE); return 1; }// GetData //--------------------------------------------------------------- // SetData // // This function will place the data from the registry into // the dialog box //--------------------------------------------------------------- void SetData(HWND hwnd) { char szMaxCache[REG_STRING_SIZE] = ""; char szMaxPitch[REG_STRING_SIZE] = "10"; // Now read the stuff from the registery // Get the value for the "Use EconoJIT only" int iEconJIT = !GetCOMPlusRegistryDwordValueEx("JITEnable", 1, HKEY_LOCAL_MACHINE); // Get the value for Optimize for Size int iOp4Size = GetCOMPlusRegistryDwordValueEx("JITOptimizeType", JIT_OPT_SPEED, HKEY_LOCAL_MACHINE) == JIT_OPT_SIZE; // Get the value for Concurrent GC int iConGC = GetCOMPlusRegistryDwordValueEx("GCconcurrent", 0, HKEY_LOCAL_MACHINE); // Now get the Max Code Cache int iMaxCache = GetCOMPlusRegistryDwordValueEx("MaxCodeCacheSize", -1, HKEY_LOCAL_MACHINE); // And get the Max Pitch Overhead int iMaxPitch= GetCOMPlusRegistryDwordValueEx("MaxPitchOverhead", 10, HKEY_LOCAL_MACHINE); // Now write this all to the dialog box CheckDlgButton(hwnd, IDC_ECONOJIT, iEconJIT?BST_CHECKED:BST_UNCHECKED); CheckDlgButton(hwnd, IDC_OP4SIZE, iOp4Size?BST_CHECKED:BST_UNCHECKED); CheckDlgButton(hwnd, IDC_CONCURGC, iConGC?BST_CHECKED:BST_UNCHECKED); CheckDlgButton(hwnd, IDC_LIMITCACHE, iMaxCache!=-1?BST_CHECKED:BST_UNCHECKED); SetDlgItemInt(hwnd, IDC_MAXPITCH, iMaxPitch, 0); if(iMaxCache != -1) SetDlgItemInt(hwnd, IDC_MAXCACHE, iMaxCache, 0); else SetDlgItemText(hwnd, IDC_MAXCACHE, ""); }// SetData BOOL SetCOMPlusRegistryDwordValueEx(const char * valName, DWORD value, HKEY hRoot) { HKEY hkey; DWORD op, res; int size = sizeof(DWORD); res = RegCreateKeyEx(hRoot, "Software\\Microsoft\\.NETFramework", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &op); assert(res == ERROR_SUCCESS); res = RegSetValueEx(hkey, valName, 0, REG_DWORD, (unsigned char *)&value, size); assert(res == ERROR_SUCCESS); RegCloseKey(hkey); return TRUE; }// SetCOMPlusRegisteryDwordValueEx DWORD GetCOMPlusRegistryDwordValueEx(const char * valName, DWORD defValue, HKEY hRoot) { HKEY hkey; DWORD value; DWORD size = sizeof(value); DWORD type = REG_BINARY; DWORD res; res = RegOpenKeyEx (hRoot, "Software\\Microsoft\\.NETFramework", 0, KEY_ALL_ACCESS, &hkey); if (res != ERROR_SUCCESS) return defValue; res = RegQueryValueEx(hkey, valName, 0, &type, (unsigned char *)&value, &size); RegCloseKey(hkey); if (res != ERROR_SUCCESS || type != REG_DWORD) return defValue; else return value; }// GetCOMPlusRegistryDwordValueEx void DeleteCOMPlusRegistryValueEx(const char * valName, HKEY hRoot) { HKEY hkey; DWORD res; res = RegOpenKeyEx (hRoot, "Software\\Microsoft\\.NETFramework", 0, KEY_ALL_ACCESS, &hkey); if (res != ERROR_SUCCESS) return; res = RegDeleteValue(hkey, valName); RegCloseKey(hkey); }// DeleteCOMPlusRegistryValueEx
30.268893
149
0.630959
npocmaka
59e3772f5bd2eed985a614106983ac96c6880df1
3,637
cpp
C++
src/PixelFlutSource.cpp
subject721/floodfill
f1328ac8de2f3c7988256e7cb9948f671f91a2d7
[ "MIT" ]
null
null
null
src/PixelFlutSource.cpp
subject721/floodfill
f1328ac8de2f3c7988256e7cb9948f671f91a2d7
[ "MIT" ]
null
null
null
src/PixelFlutSource.cpp
subject721/floodfill
f1328ac8de2f3c7988256e7cb9948f671f91a2d7
[ "MIT" ]
null
null
null
#include "PixelFlutSource.h" #include "DrawIF.h" #include "DrawOperations.h" #include <cstring> #include <cstdlib> PixelFlutSource::PixelFlutSource() { } PixelFlutSource::~PixelFlutSource() { } void PixelFlutSource::start(IDrawInterface* drawInterface) { _drawInterface = drawInterface; } void PixelFlutSource::stop() { } int PixelFlutSource::handleCmd(const char* cmdIn, int cmdInLen, char* cmdOut, int cmdOutBufferSize) { PixelFlutCmd cmdStruct; if(!parseCmd(cmdStruct, cmdIn, cmdInLen)) { return -1; } if(cmdStruct.cmd == CMD_PX) { //LOG("CMD_PX %u %u %x", cmdStruct.args[0], cmdStruct.args[1], cmdStruct.args[2]); if(cmdStruct.nargs == 3) { //Fucking dirty hack! But in this prealpharandomexcusewhyitmaynotbeworking version i don't give a shit! uint8_t drawOpBuf[DRAW_PIXEL_OP_SIZE]; DrawOpDescr* drawPixelCmd = (DrawOpDescr*)drawOpBuf; drawPixelCmd->size = DRAW_PIXEL_OP_SIZE; drawPixelCmd->operationType = OP_DRAW_PIXEL; DrawPixelParams* drawPixelParams = (DrawPixelParams*)drawPixelCmd->opData; drawPixelParams->x = cmdStruct.args[0]; drawPixelParams->y = cmdStruct.args[1]; drawPixelParams->color = cmdStruct.args[2]; _drawInterface->queueDrawCmd(drawPixelCmd); } else if(cmdStruct.nargs == 2) { uint32_t pixelColor = _drawInterface->readPixel(cmdStruct.args[0], cmdStruct.args[1]); int len = snprintf(cmdOut, cmdOutBufferSize, "PX %u %u %06x\n", cmdStruct.args[0], cmdStruct.args[1], pixelColor); return len; } return 0; } else if(cmdStruct.cmd == CMD_SIZE) { uint32_t width = _drawInterface->getWidth(); uint32_t height = _drawInterface->getHeight(); int len = snprintf(cmdOut, cmdOutBufferSize, "SIZE %u %u\n", width, height); return len; } return 0; } bool PixelFlutSource::parseCmd(PixelFlutCmd& cmdStruct, const char* cmd, int cmdInLen) { char tokenBuffer[TOKEN_BUFFER_SIZE]; int currentTokenLen = 0; uint32_t currentTokenIndex = 0; for(int charIndex = 0; charIndex < cmdInLen; charIndex++) { char currentChar = cmd[charIndex]; if((currentChar == ' ') || (currentChar == '\n')) { tokenBuffer[currentTokenLen] = '\0'; //LOG("token %d: %s", currentTokenIndex, tokenBuffer); if(currentTokenIndex == 0) { int cmdType = getCmdType(tokenBuffer, currentTokenLen); if(cmdType == -1) return false; cmdStruct.cmd = (PixelFLutCmdType)cmdType; } else { //Hardcoded argument parsing. if(cmdStruct.cmd == CMD_PX) { switch(currentTokenIndex) { case 1: { cmdStruct.args[0] = (uint32_t)atoi(tokenBuffer); break; } case 2: { cmdStruct.args[1] = (uint32_t)atoi(tokenBuffer); break; } case 3: { cmdStruct.args[2] = (uint32_t)strtoul(tokenBuffer, nullptr, 16); if(currentTokenLen == 6) { cmdStruct.args[2] <<= 8; cmdStruct.args[2] |= 0xff; } //else if(currentTokenLen == 8) //{ //} break; } } } } currentTokenLen = 0; currentTokenIndex++; } else { tokenBuffer[currentTokenLen] = currentChar; currentTokenLen++; } } cmdStruct.nargs = currentTokenIndex - 1; if(cmdStruct.cmd == CMD_PX) { if(!((currentTokenIndex == 4) || (currentTokenIndex == 3))) return false; } else if(cmdStruct.cmd == CMD_SIZE) { if(currentTokenIndex != 1) return false; } return true; } int PixelFlutSource::getCmdType(const char* cmdStr, int len) { if(strncmp(cmdStr, "PX", len) == 0) return CMD_PX; else if(strncmp(cmdStr, "SIZE", len) == 0) return CMD_SIZE; return -1; }
20.432584
117
0.654111
subject721
59e44037e24e1c4f559fc44ea4592bc81c6810d1
1,084
cpp
C++
codes/ZOJ/zoj3810.cpp
JeraKrs/ACM
edcd61ec6764b8cd804bf1538dfde53d0ff572b5
[ "Apache-2.0" ]
null
null
null
codes/ZOJ/zoj3810.cpp
JeraKrs/ACM
edcd61ec6764b8cd804bf1538dfde53d0ff572b5
[ "Apache-2.0" ]
null
null
null
codes/ZOJ/zoj3810.cpp
JeraKrs/ACM
edcd61ec6764b8cd804bf1538dfde53d0ff572b5
[ "Apache-2.0" ]
null
null
null
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int maxn = 105; const char s[10][10] = {"BBBBBB", "GGRGRR", "GRRGRB", "GRGGRB", "GRGRRB", "GRGBBB"}; const char c[5] = "BGRY"; int g[maxn][maxn]; void solve (int n) { memset(g, 0, sizeof(g)); for (int i = 0; i < n; i++) g[0][i] = 3; int k = (n - 1) / 2, col = 1; for (int i = 0; i < k; i++) { for (int j = 1; j <= i+1; j++) g[j][i+1] = col; for (int j = i+1; j < n; j++) g[j][i] = col; col = 3 - col; } for (int i = k; i < n; i++) { for (int j = 2; j <= i+2; j++) g[j][i+2] = col; g[i+2][i+1] = col; for (int j = i+2; j < n; j++) g[j][i] = col; col = 3 - col; } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) printf("%c", c[g[i][j]]); printf("\n"); } } int main () { int cas, n; scanf("%d", &cas); while (cas--) { scanf("%d", &n); if (n == 1) printf("B\n"); else if (n == 6) { for (int i = 0; i < 6; i++) printf("%s\n", s[i]); } else if (n >= 5) { solve(n); } else printf("No solution!\n"); } return 0; }
18.066667
84
0.447417
JeraKrs
59e5aa4fa71944c18edcd9ee53474775afc94ee0
3,872
cc
C++
psdaq/psdaq/service/Task.cc
JBlaschke/lcls2
30523ef069e823535475d68fa283c6387bcf817b
[ "BSD-3-Clause-LBNL" ]
16
2017-11-09T17:10:56.000Z
2022-03-09T23:03:10.000Z
psdaq/psdaq/service/Task.cc
JBlaschke/lcls2
30523ef069e823535475d68fa283c6387bcf817b
[ "BSD-3-Clause-LBNL" ]
6
2017-12-12T19:30:05.000Z
2020-07-09T00:28:33.000Z
psdaq/psdaq/service/Task.cc
JBlaschke/lcls2
30523ef069e823535475d68fa283c6387bcf817b
[ "BSD-3-Clause-LBNL" ]
25
2017-09-18T20:02:43.000Z
2022-03-27T22:27:42.000Z
#include "Semaphore.hh" #include "Task.hh" #include <signal.h> #include <sched.h> using namespace Pds; /* * * * */ Task::Task(const TaskObject& tobj) { _taskObj = new TaskObject(tobj); _refCount = new int(1); _jobs = new Queue<Routine>; _pending = new Semaphore(Semaphore::EMPTY); int err = createTask(*_taskObj, (TaskFunction) TaskMainLoop ); if ( err != 0 ) { //error occured, throw exception } } /* * */ Task::Task(const Task& aTask) { _refCount = aTask._refCount; ++*_refCount; _taskObj = aTask._taskObj; _jobs = aTask._jobs; _pending = aTask._pending; } /* * */ void Task::operator =(const Task& aTask) { _refCount = aTask._refCount; _taskObj = aTask._taskObj; _jobs = aTask._jobs; _pending = aTask._pending; } /* * */ Task::Task(MakeThisATaskFlag dummy) { _taskObj = new TaskObject(); _refCount = new int(1); _jobs = new Queue<Routine>; _pending = new Semaphore(Semaphore::EMPTY); } /* * */ Task::~Task() { // deletes only the memory for the object itself // memory for the contained by pointer objects is deleted // by the TaskDelete object's routine() } /* * * * */ void Task::destroy() { --*_refCount; if (*_refCount > 0) { delete this; } if (*_refCount == 0) { _destroyRoutine = new TaskDelete(this); call(_destroyRoutine); } else { // severe error, probably bug check (assert) } } /* * * * */ const TaskObject& Task::parameters() const { return *_taskObj; }; /* * Inserts an entry on the tasks processing queue. * give the jobs pending semaphore only when the queue goes empty to non-empty * */ void Task::call(Routine* routine) { if( _jobs->insert(routine) == _jobs->empty()) { _pending->give(); } } /* * Main Loop of a task. * * It is a global function with c linkage so it can be correctly * called by the underlying system service layer. It is friend * to the Task class so that it can act like a private member * function. This function should never be called directly. * * Process jobs while there are entries on the queue then take * the jobs pending semaphore and wait for new entries. * */ void* Pds::TaskMainLoop(void* task) { Task* t = (Task*) task; Routine *aJob; for(;;) { while( (aJob=t->_jobs->remove()) != t->_jobs->empty() ) { aJob->routine(); } t->_pending->take(); } return NULL; } /* * Public Callable Version of taskMainLoop() * */ void Task::mainLoop() { TaskMainLoop((void*)this); } void TaskDelete::routine(void) { _taskToKill->deleteTask(); } /* * actually make the call to start the thread * * see TaskObjectUx.cc for a note on the priority value and * the stupid sentinal trick. */ int Task::createTask(TaskObject& tobj, TaskFunction aRoutine) { struct sched_param param; param.sched_priority=tobj.priority(); pthread_attr_setstacksize(&tobj._flags,tobj.stackSize()); pthread_attr_setschedparam(&tobj._flags,&param); int status = pthread_create(&tobj._threadID,&tobj._flags,aRoutine,this); // printf("Task::createTask id %ld name %s\n", tobj._threadID, tobj._name); return status; } /* * actually make the call to exit the thread. This routine can only * be called from within the context of the thread itself. Therefore, * only the destroy() method of Task will really use it. */ void Task::deleteTask() { // printf("Task::deleteTask id %ld\n", _taskObj->_threadID); if(*_refCount != 0) { // error as this should be the last message // from the last task object for this task } delete _pending; delete _jobs; delete _refCount; delete _taskObj; delete _destroyRoutine; delete this; int status; pthread_exit((void*)&status); } void Task::signal(int signal){ pthread_kill(_taskObj->_threadID, signal); } bool Task::is_self() const { return pthread_self() == _taskObj->taskID(); }
17.680365
78
0.662707
JBlaschke
59ec73e5dd660eb73eb1790f2c4ff78bba777e00
857
cc
C++
chrome/browser/chromeos/drive/drive_protocol_handler.cc
GnorTech/chromium
e1c7731d5bd099ca5544fcf8eda3867d4ce5bab5
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
1
2018-03-10T13:08:49.000Z
2018-03-10T13:08:49.000Z
chrome/browser/chromeos/drive/drive_protocol_handler.cc
GnorTech/chromium
e1c7731d5bd099ca5544fcf8eda3867d4ce5bab5
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
chrome/browser/chromeos/drive/drive_protocol_handler.cc
GnorTech/chromium
e1c7731d5bd099ca5544fcf8eda3867d4ce5bab5
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
1
2020-11-04T07:19:31.000Z
2020-11-04T07:19:31.000Z
// Copyright (c) 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 "chrome/browser/chromeos/drive/drive_protocol_handler.h" #include "base/logging.h" #include "chrome/browser/chromeos/drive/drive_url_request_job.h" #include "googleurl/src/gurl.h" #include "net/url_request/url_request.h" namespace drive { DriveProtocolHandler::DriveProtocolHandler(void* profile_id) : profile_id_(profile_id) { } DriveProtocolHandler::~DriveProtocolHandler() { } net::URLRequestJob* DriveProtocolHandler::MaybeCreateJob( net::URLRequest* request, net::NetworkDelegate* network_delegate) const { DVLOG(1) << "Handling url: " << request->url().spec(); return new DriveURLRequestJob(profile_id_, request, network_delegate); } } // namespace drive
30.607143
77
0.766628
GnorTech
59ed9e0ee5727e4052b18f00bcfc40299e02bef9
1,040
cc
C++
CPP/No1024.cc
hxz1998/funny_leetcode
1d2c425af09b57a030fc018ddc1e1a5ffb966cd0
[ "Apache-2.0" ]
null
null
null
CPP/No1024.cc
hxz1998/funny_leetcode
1d2c425af09b57a030fc018ddc1e1a5ffb966cd0
[ "Apache-2.0" ]
null
null
null
CPP/No1024.cc
hxz1998/funny_leetcode
1d2c425af09b57a030fc018ddc1e1a5ffb966cd0
[ "Apache-2.0" ]
null
null
null
/** * Created by Xiaozhong on 2020/10/24. * Copyright (c) 2020/10/24 Xiaozhong. All rights reserved. */ #include <algorithm> #include <vector> #include <iostream> using namespace std; class Solution { public: int videoStitching(vector<vector<int>> &clips, int T) { vector<int> dp(T + 1, INT32_MAX - 1); sort(clips.begin(), clips.end(), [](const vector<int> &lhs, const vector<int> &rhs) { return lhs[0] == rhs[0] ? lhs[1] > rhs[1] : lhs[0] < rhs[0]; }); dp[0] = 0; for (int i = 1; i <= T; ++i) { for (auto &it : clips) { if (it[0] < i && it[1] >= i) { dp[i] = min(dp[i], dp[it[0]] + 1); } } } return dp[T] == INT32_MAX - 1 ? -1 : dp[T]; } }; int main() { Solution s; vector<vector<int>> clips = { {0, 2}, {4, 6}, {8, 10}, {1, 9}, {1, 5}, {5, 9} }; cout << s.videoStitching(clips, 10) << endl; }
25.365854
93
0.440385
hxz1998
59ee4c0a309f914f2733f58643d87bd17c856dd1
2,978
cpp
C++
sample.cpp
chihirokondo/wl_mpi
33cb42e6a2649df767d1284c44d3fb11525b423e
[ "MIT" ]
1
2021-03-22T04:19:17.000Z
2021-03-22T04:19:17.000Z
sample.cpp
chihirokondo/wl_mpi
33cb42e6a2649df767d1284c44d3fb11525b423e
[ "MIT" ]
null
null
null
sample.cpp
chihirokondo/wl_mpi
33cb42e6a2649df767d1284c44d3fb11525b423e
[ "MIT" ]
2
2020-11-27T07:40:42.000Z
2021-03-22T04:58:18.000Z
#include <cmath> #include <mpi.h> #include <random> #include <iostream> #include <iomanip> #include <fstream> #include <vector> #include "include/wl_mpi.hpp" // Sample model (classical ferro magnetic ising model) #include "model_sample/lattice/graph.hpp" #include "model_sample/ferro_ising.hpp" int main(int argc, char *argv[]) { int numprocs, myid, num_walkers_window; MPI_Status status; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &numprocs); MPI_Comm_rank(MPI_COMM_WORLD, &myid); // Check command line arguments. if (argc != 5) { if (myid == 0) { std::cerr << "ERROR: Unexpected number of command line arguments!\n" << " Expect 6 arguments, " << argc - 1 << " were provided.\n" << "Syntax: " << argv[0] << " [arg1] [arg2] [arg3] [arg4] \n\n" << "Please provide the following command line arguments:\n" << "1. Number of walkers per window. [integer]\n" << "2. Random number seed. [integer]\n" << "3. Time limit (secs). [double]\n" << "4. Should execute from the top. [integer (bool)]\n" << std::endl; } MPI_Abort(MPI_COMM_WORLD, 1); } num_walkers_window = atoi(argv[1]); MPIV mpiv(numprocs, myid, num_walkers_window); // Model dependent variables. int dim = 2; int length = 4; lattice::graph lat = lattice::graph::simple(dim, length); FerroIsing model(lat); HistoEnvManager histo_env(model.ene_min(), model.ene_max(), model.num_bins(), true); // Replica exchange Wang-Landau (REWL) parameters. int check_flatness_every = 500; double lnf = 1.0; double lnfmin = 1e-8; double flatness = 0.95; double overlap = 0.75; // 0<= overlap <= 1. int exch_every = 100; WLParams wl_params(check_flatness_every, lnf, lnfmin, flatness, overlap, exch_every); std::mt19937 engine(atoi(argv[2])+mpiv.myid()); // Program control variables. double timelimit_secs = atof(argv[3]); bool from_the_top = atoi(argv[4]); // REWL routine. std::vector<double> ln_dos; RunningState running_state = rewl<FerroIsing>(&ln_dos, &model, histo_env, &wl_params, &mpiv, engine, timelimit_secs, from_the_top); int result = 0; if (running_state == RunningState::ERROR) { result = static_cast<int>(RunningState::ERROR); } if ((running_state==RunningState::ALL_FINISHED) && (mpiv.myid()==0)) { double ln_const = ln_dos[0] - std::log(2.0); for (auto &ln_dos_i : ln_dos) { if (ln_dos_i != 0.0) ln_dos_i -= ln_const; } std::ofstream ofs("ln_dos_jointed.dat", std::ios::out); ofs << "# ferro ising model\n"; ofs << "# dim = " << dim << ", length = " << length << "\n"; ofs << "# energy\t # log_e (density of states)\n"; for (size_t i=0; i<ln_dos.size(); ++i) { ofs << std::scientific << std::setprecision(15) << histo_env.GetVal(i, "mid") << "\t" << ln_dos[i] << "\n"; } ofs << std::endl; } MPI_Finalize(); return result; }
35.035294
79
0.622565
chihirokondo
59f125c9f66925baf6697b1250fcf00708165094
709
hpp
C++
include/text.hpp
Ikaguia/idj-pinguim
fd07be94b440057ab2ec9bf80931bc3f2b588cd3
[ "MIT" ]
1
2017-04-03T14:37:36.000Z
2017-04-03T14:37:36.000Z
include/text.hpp
Ikaguia/idj-pinguim
fd07be94b440057ab2ec9bf80931bc3f2b588cd3
[ "MIT" ]
null
null
null
include/text.hpp
Ikaguia/idj-pinguim
fd07be94b440057ab2ec9bf80931bc3f2b588cd3
[ "MIT" ]
null
null
null
#ifndef TEXTHPP #define TEXTHPP #include <SDL2/SDL_ttf.h> #include <common.hpp> #include <geometry.hpp> class Text{ public: enum TextStyle{SOLID,SHADED,BLENDED}; private: shared_ptr<TTF_Font> font; SDL_Texture* texture; string fontName; string text; TextStyle style; int fontSize; SDL_Color color; Rect box; void RemakeTexture(); public: Text(string file,int fSize,TextStyle st,string txt,SDL_Color c=SDL_COLOR_WHITE,int x=0,int y=0); ~Text(); void Render(int cameraX=0,int cameraY=0); void SetPos(int x,int y,bool centerX=false,bool centerY=false); void SetText(string txt); void SetColor(SDL_Color c); void SetStyle(TextStyle st); void SetFontSize(int fSize); }; #endif//TEXTHPP
17.725
97
0.744711
Ikaguia
59f1e062f5f292ac68b53ad179fbb1cc65347422
2,858
cpp
C++
test/TreeJobContainerTest.cpp
ywx217/elapse
d27e851b8f5744ed9bf488a421094c5653aae46e
[ "Unlicense" ]
null
null
null
test/TreeJobContainerTest.cpp
ywx217/elapse
d27e851b8f5744ed9bf488a421094c5653aae46e
[ "Unlicense" ]
null
null
null
test/TreeJobContainerTest.cpp
ywx217/elapse
d27e851b8f5744ed9bf488a421094c5653aae46e
[ "Unlicense" ]
null
null
null
#include "gtest/gtest.h" #include <list> #include "TreeJobContainer.hpp" #ifdef BENCHMARK_ASIO_JOB_CONTAINER #include "AsioJobContainer.hpp" #endif using namespace elapse; #define TIME_BEGIN 1525436318156L TEST(TreeContainer, InsertAndExpire) { TreeJobContainer ctn; TimeUnit now = TIME_BEGIN; std::list<JobId> jobSequence; for (int i = 0; i < 100; ++i, now += 100) { jobSequence.push_back(ctn.Add(now, WrapLambdaPtr([&jobSequence](JobId id) { ASSERT_EQ(id, jobSequence.front()); jobSequence.pop_front(); }))); } now = TIME_BEGIN; for (int i = 0; i < 10; ++i, now += 100) { ASSERT_EQ(1, ctn.PopExpires(now)); } ++now; for (int i = 10; i < 20; ++i, now += 100) { ASSERT_EQ(1, ctn.PopExpires(now)); } --now; now += 100; for (int i = 20; i < 100; i += 2, now += 200) { ASSERT_EQ(2, ctn.PopExpires(now)); } } TEST(TreeContainer, Remove) { TreeJobContainer ctn; auto cb = [](JobId id) {}; auto id_1 = ctn.Add(1, WrapLambdaPtr(cb)); auto id_2 = ctn.Add(2, WrapLambdaPtr(cb)); auto id_3 = ctn.Add(3, WrapLambdaPtr(cb)); auto id_4 = ctn.Add(4, WrapLambdaPtr(cb)); ASSERT_TRUE(ctn.Remove(id_2)); ASSERT_FALSE(ctn.Remove(id_2)); ASSERT_EQ(2, ctn.PopExpires(3)); ASSERT_FALSE(ctn.Remove(id_3)); ASSERT_TRUE(ctn.Remove(id_4)); ASSERT_EQ(0, ctn.PopExpires(1000)); } TEST(TreeContainer, Iterate) { TreeJobContainer ctn; auto cb = [](JobId id) {}; size_t counter = 0; ctn.Add(1, WrapLambdaPtr(cb)); ctn.Add(2, WrapLambdaPtr(cb)); ctn.Add(3, WrapLambdaPtr(cb)); ctn.Add(4, WrapLambdaPtr(cb)); ctn.IterJobs([&counter](Job const& job) { ++counter; return false; }); ASSERT_EQ(1, counter); ctn.IterJobs([&counter](Job const& job) { ++counter; return true; }); ASSERT_EQ(5, counter); } TEST(TreeContainer, RemoveAll) { TreeJobContainer ctn; auto cb = [](JobId id) {}; size_t counter = 0; ctn.Add(1, WrapLambdaPtr(cb)); ctn.Add(2, WrapLambdaPtr(cb)); ctn.Add(3, WrapLambdaPtr(cb)); ctn.Add(4, WrapLambdaPtr(cb)); ASSERT_EQ(4, ctn.Size()); ctn.RemoveAll(); ASSERT_EQ(0, ctn.Size()); } TEST(TreeContainer, RemoveIf) { TreeJobContainer ctn; auto cb = [](JobId id) {}; size_t counter = 0; ctn.Add(1, WrapLambdaPtr(cb)); ctn.Add(2, WrapLambdaPtr(cb)); ctn.Add(3, WrapLambdaPtr(cb)); ctn.Add(4, WrapLambdaPtr(cb)); ASSERT_EQ(4, ctn.Size()); ctn.RemoveJobs([](Job const& job) { return job.id_ % 2 == 0; }); ASSERT_EQ(2, ctn.Size()); ctn.RemoveJobs([](Job const& job) { return job.id_ % 2 == 1; }); ASSERT_EQ(0, ctn.Size()); } #ifdef BENCHMARK_ASIO_JOB_CONTAINER TEST(Scheduler, BenchTreeJobContainer) { TreeJobContainer ctn; ExpireCallback cb = [](JobId id) {}; for (int i = 0; i < 1000000; ++i) { ctn.Add(i, cb); } } TEST(Scheduler, BenchAsioJobContainer) { AsioJobContainer ctn; ExpireCallback cb = [](JobId id) {}; for (int i = 0; i < 1000000; ++i) { ctn.Add(i, cb); } } #endif
24.016807
77
0.662701
ywx217
59f31757a685dff137d4958a9d55680823e9831d
9,779
cpp
C++
Device/Source/Unit/Datapath/Specific/MPEG/DVDPESStreamUnpacker.cpp
rerunner/STCM_driver
8fef3dd7327812fd317fdb0e6fab8d36e345a505
[ "BSD-3-Clause" ]
null
null
null
Device/Source/Unit/Datapath/Specific/MPEG/DVDPESStreamUnpacker.cpp
rerunner/STCM_driver
8fef3dd7327812fd317fdb0e6fab8d36e345a505
[ "BSD-3-Clause" ]
null
null
null
Device/Source/Unit/Datapath/Specific/MPEG/DVDPESStreamUnpacker.cpp
rerunner/STCM_driver
8fef3dd7327812fd317fdb0e6fab8d36e345a505
[ "BSD-3-Clause" ]
null
null
null
/// /// @brief Extracts elementary streams from DVD PES streams /// #include "DVDPESStreamUnpacker.h" #include "VDR/Source/Construction/IUnitConstruction.h" #include "Device/Interface/Unit/Video/IMPEGVideoTypes.h" UNIT_CREATION_FUNCTION(CreateDVDPESStreamUnpackerUnit, DVDPESStreamUnpackerUnit) STFResult DVDPESStreamUnpackerUnit::CreateVirtual(IVirtualUnit * & unit, IVirtualUnit * parent, IVirtualUnit * root) { unit = (IVirtualUnit*)(new VirtualDVDPESStreamUnpackerUnit(this, rangesThreshold)); if (unit) { STFRES_REASSERT(unit->Connect(parent, root)); } else STFRES_RAISE(STFRES_NOT_ENOUGH_MEMORY); STFRES_RAISE_OK; } STFResult DVDPESStreamUnpackerUnit::Create(uint64 * createParams) { if (createParams[0] != PARAMS_DWORD || createParams[2] != PARAMS_DONE) STFRES_RAISE(STFRES_INVALID_PARAMETERS); rangesThreshold = createParams[1]; STFRES_RAISE_OK; } STFResult DVDPESStreamUnpackerUnit::Connect(uint64 localID, IPhysicalUnit * source) { STFRES_RAISE(STFRES_RANGE_VIOLATION); } STFResult DVDPESStreamUnpackerUnit::Initialize(uint64 * depUnitsParams) { STFRES_RAISE_OK; } VirtualDVDPESStreamUnpackerUnit::VirtualDVDPESStreamUnpackerUnit(DVDPESStreamUnpackerUnit * physical, uint32 rangesThreshold) : VirtualNonthreadedStandardInOutStreamingUnit(physical, 32), streamQueue(32) { state = DVDPESS_PARSE_PACKHEADER_0; outputFormatter.SetRangesThreshold(rangesThreshold); } STFResult VirtualDVDPESStreamUnpackerUnit::ParseBeginConfigure(void) { STFRES_RAISE_OK; } STFResult VirtualDVDPESStreamUnpackerUnit::ParseConfigure(TAG *& tags) { while (tags->id) { STFRES_REASSERT(outputFormatter.PutTag(*tags)); tags++; } STFRES_RAISE_OK; } STFResult VirtualDVDPESStreamUnpackerUnit::ParseCompleteConfigure(void) { STFRES_REASSERT(outputFormatter.CompleteTags()); STFRES_RAISE_OK; } STFResult VirtualDVDPESStreamUnpackerUnit::ParsePESPacket(const VDRDataRange * ranges, uint32 num, uint32 & range, uint32 & offset) { uint8 value; uint8 * pos; uint32 size = ranges[range].size; uint32 start, done; while (range < num) { pos = ranges[range].GetStart(); size = ranges[range].size; start = offset; while (offset < size) { value = pos[offset]; switch (state) { case DVDPESS_PARSE_PACKHEADER_0: if (value == 0x00) { state = DVDPESS_PARSE_PACKHEADER_1; start = offset; } else streamQueue.FlushRanges(this); offset++; break; case DVDPESS_PARSE_PACKHEADER_1: if (value == 0x00) { state = DVDPESS_PARSE_PACKHEADER_2; } else { state = DVDPESS_PARSE_PACKHEADER_0; streamQueue.FlushRanges(this); } offset++; break; case DVDPESS_PARSE_PACKHEADER_2: if (value == 0x01) { state = DVDPESS_PARSE_PACKHEADER_3; } else if (value == 0x00) { // // we remain in this state during any size of zero group... // We just eat byte from the start of the overlap section. // if (streamQueue.Size()) { // // Oops, we already consumed some ranges... // // Remove the start byte from the first overlap range // streamQueue.DropBytes(1, done, this); } else { // // Remove first byte of this first range // start++; } } else { state = DVDPESS_PARSE_PACKHEADER_0; streamQueue.FlushRanges(this); } offset++; break; case DVDPESS_PARSE_PACKHEADER_3: if (value == 0xba) { state = DVDPESS_PARSE_PAYLOAD; offset++; packetSize = 2048 - streamQueue.Size(); } else { state = DVDPESS_PARSE_PACKHEADER_0; streamQueue.FlushRanges(this); } break; case DVDPESS_PARSE_PAYLOAD: if (start + packetSize > size) { offset = size; packetSize -= size - start; } else { streamQueue.AppendRange(VDRSubDataRange(ranges[range], start, packetSize), this); start += packetSize; offset = start; state = DVDPESS_ANALYZE_PACKET; STFRES_RAISE_OK; } break; default: break; } } if (start < size && state != DVDPESS_PARSE_PACKHEADER_0) { streamQueue.AppendRange(VDRSubDataRange(ranges[range], start, size - start), this); } range++; offset = 0; } STFRES_RAISE_OK; } STFResult VirtualDVDPESStreamUnpackerUnit::AnalyzePESPacket(void) { uint32 headerLength; uint32 payload, done, extra; uint8 secondaryID, primaryID; uint32 pesPacketOffset; // Attention: it's possible that there is a system header upfront video pesPacketOffset = 14; // behind pack header if (streamQueue[pesPacketOffset + 3] == SYSTEM_HEADER_START_CODE) // system header, PES packet behind { headerLength = (streamQueue[pesPacketOffset + 4] << 8) + streamQueue[pesPacketOffset + 5]; pesPacketOffset += headerLength + 6; // plus system header } primaryID = streamQueue[pesPacketOffset + 3]; headerLength = (uint32)streamQueue[pesPacketOffset + 8] + 9; if (primaryID == PRIVATE_STREAM_1_ID) // private stream 1 { secondaryID = streamQueue[pesPacketOffset + headerLength] & 0xf8; switch (secondaryID) { case 0x20: case 0x28: case 0x30: case 0x38: // subpicture 0x20 - 0x3F headerLength += 1; break; case 0x80: // ac3 audio case 0x88: // dts audio case 0x90: // sdds audio headerLength += 4; break; case 0xa0: // lpcm audio //headerLength += 7; // comment the upper line to get the LPCM Private data header break; } } payload = ((uint32)(streamQueue[pesPacketOffset + 4]) << 8) + (uint32)streamQueue[pesPacketOffset + 5] + 6 - headerLength; streamQueue.DropBytes(pesPacketOffset + headerLength, done, this); #if 0 if ((primaryID & 0xf0) == 0xd0) { streamQueue.SkipBytes(0, payload, this); payload = 0; } #endif while ((primaryID & 0xe8) == 0xc0 && payload + 9 < streamQueue.Size()) { // An MPEG Audio Packet, we have to be extra carefull, to get the extension header with it... primaryID = streamQueue[payload + 3]; if ((primaryID & 0xe8) == 0xc0) { headerLength = (uint32)streamQueue[payload + 8] + 9; extra = ((uint32)(streamQueue[payload + 4]) << 8) + (uint32)streamQueue[payload + 5] + 6 - headerLength; streamQueue.SkipBytes(payload, headerLength, this); payload += extra; } #if 0 if ((primaryID & 0xf0) == 0xd0) { streamQueue.SkipBytes(payload - extra, extra, this); payload -= extra; } #endif } streamQueue.LimitBytes(payload, this); state = DVDPESS_DELIVER_PACKET; STFRES_RAISE_OK; } STFResult VirtualDVDPESStreamUnpackerUnit::DeliverPESPacket(void) { switch (state) { case DVDPESS_DELIVER_PACKET: STFRES_REASSERT(outputFormatter.PutFrameStart()); state = DVDPESS_DELIVER_RANGES; case DVDPESS_DELIVER_RANGES: STFRES_REASSERT(streamQueue.SendRanges(&outputFormatter, this)); state = DVDPESS_DELIVER_END_TIME; case DVDPESS_DELIVER_END_TIME: if (endTimePending) { STFRES_REASSERT(outputFormatter.PutEndTime(endTime)); endTimePending = false; } state = DVDPESS_DELIVER_GROUP_END; case DVDPESS_DELIVER_GROUP_END: if (groupEndPending) { STFRES_REASSERT(outputFormatter.CompleteGroup(groupEndNotification)); groupEndPending = false; } #if 0 state = DVDPESS_DELIVER_TAGS; case DVDPESS_DELIVER_TAGS: while (numSentTags < numPendingTags) { STFRES_REASSERT(outputFormatter.PutTag(pendingTags[numSentTags])); numSentTags++; } #endif state = DVDPESS_DELIVER_GROUP_START; case DVDPESS_DELIVER_GROUP_START: if (groupStartPending) { STFRES_REASSERT(outputFormatter.BeginGroup(groupNumber, groupStartNotification, singleUnitGroup)); groupStartPending = false; } state = DVDPESS_DELIVER_START_TIME; case DVDPESS_DELIVER_START_TIME: if (startTimePending) { STFRES_REASSERT(outputFormatter.PutStartTime(startTime)); startTimePending = false; } state = DVDPESS_PARSE_PACKHEADER_0; default: break; } STFRES_RAISE_OK; } STFResult VirtualDVDPESStreamUnpackerUnit::ParseRanges(const VDRDataRange * ranges, uint32 num, uint32 & range, uint32 & offset) { STFRES_REASSERT(this->DeliverPESPacket()); while (range < num) { // Only call ParseFrame if we are in the parsing state. if (state < DVDPESS_ANALYZE_PACKET) STFRES_REASSERT(this->ParsePESPacket(ranges, num, range, offset)); if (state == DVDPESS_ANALYZE_PACKET) STFRES_REASSERT(this->AnalyzePESPacket()); STFRES_REASSERT(this->DeliverPESPacket()); } STFRES_RAISE_OK; } STFResult VirtualDVDPESStreamUnpackerUnit::ResetParser(void) { if (state < DVDPESS_ANALYZE_PACKET) { streamQueue.FlushRanges(this); state = DVDPESS_PARSE_PACKHEADER_0; } STFRES_RAISE(VirtualNonthreadedStandardInOutStreamingUnit::ResetParser()); } STFResult VirtualDVDPESStreamUnpackerUnit::ResetInputProcessing(void) { if (state < DVDPESS_ANALYZE_PACKET) { streamQueue.FlushRanges(this); state = DVDPESS_PARSE_PACKHEADER_0; } STFRES_RAISE(VirtualNonthreadedStandardInOutStreamingUnit::ResetParser()); } STFResult VirtualDVDPESStreamUnpackerUnit::ProcessFlushing(void) { streamQueue.FlushRanges(this); outputFormatter.Flush(); state = DVDPESS_PARSE_PACKHEADER_0; STFRES_RAISE(VirtualNonthreadedStandardInOutStreamingUnit::ProcessFlushing()); } bool VirtualDVDPESStreamUnpackerUnit::InputPending(void) { return state != DVDPESS_PARSE_PACKHEADER_0; } #if _DEBUG STFString VirtualDVDPESStreamUnpackerUnit::GetInformation(void) { return STFString("DVDPESStreamUnpacker ") + STFString(physical->GetUnitID(), 8, 16); } #endif
23.063679
131
0.698026
rerunner
59f3ed9dd50a93706593ca4f4d1a89e5b967f51f
2,360
cc
C++
Library/Utilities/fftw++-2.05/mpi/explicit/exmpiutils.cc
stevend12/SolutioCpp
6fa8a12207cd1e7e806a8ef5de93dc137c33856e
[ "Apache-2.0" ]
9
2017-06-27T14:04:46.000Z
2022-02-17T17:38:03.000Z
Library/Utilities/fftw++-2.05/mpi/explicit/exmpiutils.cc
stevend12/SolutioCpp
6fa8a12207cd1e7e806a8ef5de93dc137c33856e
[ "Apache-2.0" ]
null
null
null
Library/Utilities/fftw++-2.05/mpi/explicit/exmpiutils.cc
stevend12/SolutioCpp
6fa8a12207cd1e7e806a8ef5de93dc137c33856e
[ "Apache-2.0" ]
3
2017-06-23T20:10:44.000Z
2021-01-13T10:09:46.000Z
#include <mpi.h> #include <Complex.h> #include <fftw3-mpi.h> #include <iostream> #include <stdlib.h> #include "Complex.h" #include "exmpiutils.h" #include "cmult-sse2.h" #ifdef __SSE2__ namespace fftwpp { const union uvec sse2_pm = { { 0x00000000,0x00000000,0x00000000,0x80000000 } }; const union uvec sse2_mm = { { 0x00000000,0x80000000,0x00000000,0x80000000 } }; } #endif void show(Complex *f, int local_0_start, int local_n0, int N1, int m0, int m1, int A) { int stop=local_0_start+local_n0; for (int i = local_0_start; i < stop; ++i) { if(i < m0) { int ii=i-local_0_start; std::cout << A << i << ": "; for (int j = 0; j < m1; ++j) std::cout << f[ii*N1 + j] << " "; std::cout << std::endl; } } } void initf(Complex *f, int local_0_start, int local_n0, int N0, int N1, int m0, int m1) { int stop=local_0_start+local_n0; for (int i = local_0_start; i < stop; ++i) { if(i < m0) { int ii=i-local_0_start; for (int j = 0; j < m1; ++j) { f[ii*N1+j]=i +j*I; // f[ii*N1+j]=i*I; } for (int j = m1; j < N1; ++j) { f[ii*N1+j]=0.0; } } } for (int i = 0; i < local_n0; ++i) { if(i+local_0_start >= m0) { for (int j = 0; j < N1; ++j) { f[i*N1+j]=0.0; } } } } void initg(Complex *g, int local_0_start, int local_n0, int N0, int N1, int m0, int m1) { int stop=local_0_start+local_n0; for (int i = local_0_start; i < stop; ++i) { if(i < m0) { int ii=i-local_0_start; for (int j = 0; j < m1; ++j) { g[ii*N1+j]=2*i +(j+1)*I; // g[ii*N1+j]=(i == 0 && j == 0) ? 1.0 : 0.0; //i*I; } for (int j = m1; j < N1; ++j) { g[ii*N1+j]=0.0; } } } for (int i = 0; i < local_n0; ++i) { if(i+local_0_start >= m0) { for (int j = 0; j < N1; ++j) { g[i*N1+j]=0.0; } } } } // 3D void show(Complex *f, int local_0_start, int local_n0, int N1, int N2, int m0, int m1, int m2, int A) { int stop=local_0_start+local_n0; for (int i = local_0_start; i < stop; ++i) { if(i < m0) { int ii=i-local_0_start; for (int j = 0; j < m1; ++j) { std::cout << A << "-" << i << ": "; for (int k = 0; k < m2; ++k) { int index=ii*N1*N2 + j*N1 +k; std::cout << f[index] << " "; } std::cout << std::endl; } std::cout << std::endl; } } }
20.884956
56
0.513559
stevend12
59f3ff47a06e15d1581749eae11fe190c52bfd6a
2,236
cpp
C++
main.cpp
azriel91/sl_ax_main
fd34e4b27da35fdf18afcad1dfc11e36d2504545
[ "Apache-2.0" ]
null
null
null
main.cpp
azriel91/sl_ax_main
fd34e4b27da35fdf18afcad1dfc11e36d2504545
[ "Apache-2.0" ]
null
null
null
main.cpp
azriel91/sl_ax_main
fd34e4b27da35fdf18afcad1dfc11e36d2504545
[ "Apache-2.0" ]
null
null
null
/*============================================================================= Library: Silver Copyright (c) Azriel Hoh 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 <cstdio> #include <azriel/cppmicroservices/core/include/usGetModuleContext.h> #include <azriel/sl_ax_engine/AutexousiousService.h> US_USE_NAMESPACE #ifndef US_BUILD_SHARED_LIBS #include <azriel/cppmicroservices/core/include/usModuleImport.h> US_IMPORT_MODULE(CppMicroServices) US_IMPORT_MODULE(sl_core_application) US_IMPORT_MODULE(sl_ax_engine) US_IMPORT_MODULE(sl_ax_main) #endif #include "sl_ax_main/Block.h" #include "Activator.h" int main(int argc, char const *argv[]) { printf(" === Auto load dirs ===\n"); auto autoLoadPaths = ModuleSettings::GetAutoLoadPaths(); for (auto path : autoLoadPaths) { printf("auto load: %s\n", path.c_str()); } printf("\n"); printf(" === Module Locations ===\n"); ModuleContext* mc = GetModuleContext(); auto modules = mc->GetModules(); for (auto module : modules) { printf("%s: %s\n", module->GetName().c_str(), module->GetLocation().c_str()); } printf("\n"); printf(" === Module Properties ===\n"); for (auto module : modules) { printf(" == %s\n ==", module->GetName().c_str()); printf(" module.autoload_dir: %s\n", module->GetProperty("module.autoload_dir").ToString().c_str()); } auto axServiceReferenceU = mc->GetServiceReference("sl::ax::engine::AutexousiousService"); auto axServiceMap = mc->GetService(axServiceReferenceU); auto axService = (sl::ax::engine::AutexousiousService*) axServiceMap["sl::ax::engine::AutexousiousService"]; return axService->runApplication("sl::ax::engine::StartupActivity"); }
33.878788
109
0.68381
azriel91
59f7427b059068377b3be5224e852a778e88a537
14,750
cpp
C++
demo/Whole-App-Acceleration/SORT/src/main.cpp
luyufan498/Vitis-AI-ZH
262fd6e29f25ec3b7583cbde5405f5ddeb29f2d5
[ "Apache-2.0" ]
848
2019-12-03T00:16:17.000Z
2022-03-31T22:53:17.000Z
demo/Whole-App-Acceleration/SORT/src/main.cpp
wangyifan778/Vitis-AI
f61061eef7550d98bf02a171604c9a9f283a7c47
[ "Apache-2.0" ]
656
2019-12-03T00:48:46.000Z
2022-03-31T18:41:54.000Z
demo/Whole-App-Acceleration/SORT/src/main.cpp
wangyifan778/Vitis-AI
f61061eef7550d98bf02a171604c9a9f283a7c47
[ "Apache-2.0" ]
506
2019-12-03T00:46:26.000Z
2022-03-30T10:34:56.000Z
/////////////////////////////////////////////////////////////////////////////// // SORT: A Simple, Online and Realtime Tracker // // This is a C++ reimplementation of the open source tracker in // https://github.com/abewley/sort // Based on the work of Alex Bewley, alex@dynamicdetection.com, 2016 // // Cong Ma, mcximing@sina.cn, 2016 // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. /////////////////////////////////////////////////////////////////////////////// #include <iostream> #include <fstream> #include <iomanip> // to format image names using setw() and setfill() // #include <io.h> // to check file existence using POSIX function access(). On Linux include <unistd.h>. #include <unistd.h> #include <set> #include "Hungarian.h" #include "KalmanTracker.h" #include "opencv2/video/tracking.hpp" #include "opencv2/highgui/highgui.hpp" #include "profiling.hpp" #include "kf_xrt/kf_wrapper.h" using namespace std; using namespace cv; using namespace vitis::ai; typedef struct TrackingBox { int frame; int id; Rect_<float> box; } TrackingBox; // Computes IOU between two bounding boxes double GetIOU(Rect_<float> bb_test, Rect_<float> bb_gt) { float in = (bb_test & bb_gt).area(); float un = bb_test.area() + bb_gt.area() - in; if (un < DBL_EPSILON) return 0; return (double)(in / un); } // global variables for counting int total_frames = 0; double total_time = 0.0; // global hardware KF accelerator enable bool hw_kf_en; void TestSORT(string inputDir, bool display); int main(int argc, char **argv) { if (argc != 3) { std::cout << "Usage: .exe <inputDir> <waa en>" << std::endl; } const std::string inputDir = argv[1]; if(atoi(argv[2])==0) hw_kf_en = 0; else hw_kf_en = 1; TestSORT(inputDir, false); // Note: time counted here is of tracking procedure, while the running speed bottleneck is opening and parsing detectionFile. cout << "Total Tracking took: " << total_time << " for " << total_frames << " frames or " << ((double)total_frames / (double)total_time) << " FPS" << endl; return 0; } //global buffer for states and covariances float* states_in_global = (float*)malloc(500 * 7* sizeof(float)); float* covariances_in_global = (float*)malloc(500 * 7 * 7* sizeof(float)); float* covariancesD_in_global = (float*)malloc(500 * 7* sizeof(float)); float* states_out_global = (float*)malloc(500 * 7* sizeof(float)); float* covariances_out_global = (float*)malloc(500 * 7 * 7* sizeof(float)); float* covariancesD_out_global = (float*)malloc(500 * 7* sizeof(float)); float* measurements_global = (float*)malloc(500 * 4* sizeof(float)); void sw_predict(cv::KalmanFilter kf_sw, size_t num_kf) { for(int n=0;n<num_kf;n++) { for (int i = 0; i < 7; i++) { kf_sw.statePost.at<float>(i) = states_in_global[i+7*n]; } for (int i = 0; i < 7; i++) { for (int j = 0; j < 7; j++) { kf_sw.errorCovPost.at<float>(i, j) = covariances_in_global[j + i*7 + 7*7*n]; } } kf_sw.predict(); for (int i = 0; i < 7; i++) { states_out_global[i+7*n] = kf_sw.statePre.at<float>(i); } for (int i = 0; i < 7; i++) { for (int j = 0; j < 7; j++) { covariances_out_global[j + i*7 + 7*7*n] = kf_sw.errorCovPre.at<float>(i, j) ; } } } } void sw_correct(cv::KalmanFilter kf_sw, size_t num_kf) { for(int n=0;n<num_kf;n++) { cv::Mat meas(4, 1, CV_32FC1); for (int i = 0; i < 4; i++) { meas.at<float>(i) = measurements_global[i+4*n]; } for (int i = 0; i < 7; i++) { kf_sw.statePre.at<float>(i) = states_in_global[i+7*n]; } for (int i = 0; i < 7; i++) { for (int j = 0; j < 7; j++) { kf_sw.errorCovPre.at<float>(i, j) = covariances_in_global[j + i*7 + 7*7*n]; } } kf_sw.correct(meas); for (int i = 0; i < 7; i++) { states_out_global[i+7*n] = kf_sw.statePost.at<float>(i); } for (int i = 0; i < 7; i++) { for (int j = 0; j < 7; j++) { covariances_out_global[j + i*7 + 7*7*n] = kf_sw.errorCovPost.at<float>(i, j) ; } } } } void predict(KFMOT kf_fpga, cv::KalmanFilter kf_sw, std::vector<KalmanTracker>& trackers) { for (size_t idx = 0; idx < trackers.size(); idx++) { auto &tracker = trackers[idx]; memcpy(states_in_global+(idx*7), tracker.getState().data, 7*sizeof(float)); memcpy(covariances_in_global+(idx*7*7), tracker.getErrorCov().data, 7*7*sizeof(float)); memcpy(covariancesD_in_global+(idx*7), tracker.getErrorCovD().data, 7*sizeof(float)); tracker.m_age += 1; if (tracker.m_time_since_update > 0) tracker.m_hit_streak = 0; tracker.m_time_since_update += 1; } if(hw_kf_en==1) kf_fpga.kalmanfilter_predict( (int)trackers.size(), states_in_global, covariances_in_global, covariancesD_in_global, states_out_global, covariances_out_global, covariancesD_out_global); else sw_predict(kf_sw, trackers.size()); unsigned idx = 0; for (auto it = trackers.begin(); it != trackers.end();) { it->setState(states_out_global+idx*7); auto Rect = it->getRect(); if (Rect.x >= 0 && Rect.y >= 0) { it->setErrorCov(covariances_out_global+idx*7*7); it->setErrorCovD(covariancesD_out_global+idx*7); it++; } // Else remove tracker else { it = trackers.erase(it); } idx++; } } void update(KFMOT kf_fpga, cv::KalmanFilter kf_sw, vector<KalmanTracker> &trackers, vector<TrackingBox> &detections, vector<cv::Point>& matchedPairs) { for (size_t idx = 0; idx < matchedPairs.size(); idx++) { auto &tracker = trackers[matchedPairs[idx].x]; auto &detection = detections[matchedPairs[idx].y]; memcpy(states_in_global+(idx*7), tracker.getState().data, 7*sizeof(float)); memcpy(covariances_in_global+(idx*7*7), tracker.getErrorCov().data, 7*7*sizeof(float)); memcpy(covariancesD_in_global+(idx*7), tracker.getErrorCovD().data, 7*sizeof(float)); *(measurements_global+(idx*4)) = detection.box.x + detection.box.width / 2; *(measurements_global+(idx*4)+1) = detection.box.y + detection.box.height / 2; *(measurements_global+(idx*4)+2) = detection.box.area(); *(measurements_global+(idx*4)+3) = detection.box.width / detection.box.height; tracker.m_time_since_update = 0; tracker.m_hits += 1; tracker.m_hit_streak += 1; } if(hw_kf_en==1) kf_fpga.kalmanfilter_correct(matchedPairs.size(), states_in_global, covariances_in_global, covariancesD_in_global, measurements_global, states_out_global, covariances_out_global, covariancesD_out_global); else sw_correct(kf_sw, matchedPairs.size()); int idx = 0; for (auto matchedPair : matchedPairs) { auto &tracker = trackers[matchedPair.x]; tracker.setState(states_out_global+idx*7); tracker.setErrorCov(covariances_out_global+idx*7*7); tracker.setErrorCovD(covariancesD_out_global+idx*7); idx++; } } void TestSORT(string inputDir, bool display) { cout << "Processing " << inputDir << "..." << endl; // 1. read detection file ifstream detectionFile; string detFileName = inputDir + "/det/det.txt"; detectionFile.open(detFileName); if (!detectionFile.is_open()) { cerr << "Error: can not find file " << detFileName << endl; return; } string detLine; istringstream ss; vector<TrackingBox> detData; char ch; float tpx, tpy, tpw, tph; while ( getline(detectionFile, detLine) ) { TrackingBox tb; ss.str(detLine); ss >> tb.frame >> ch >> tb.id >> ch; ss >> tpx >> ch >> tpy >> ch >> tpw >> ch >> tph; ss.str(""); tb.box = Rect_<float>(Point_<float>(tpx, tpy), Point_<float>(tpx + tpw, tpy + tph)); detData.push_back(tb); } detectionFile.close(); // 2. group detData by frame int maxFrame = 0; for (auto tb : detData) // find max frame number { if (maxFrame < tb.frame) maxFrame = tb.frame; } vector<vector<TrackingBox>> detFrameData; vector<TrackingBox> tempVec; for (int fi = 0; fi < maxFrame; fi++) { for (auto tb : detData) if (tb.frame == fi + 1) // frame num starts from 1 tempVec.push_back(tb); detFrameData.push_back(tempVec); tempVec.clear(); } // 3. update across frames int frame_count = 0; int max_age = 30; int min_hits = 3; double iouThreshold = 0.7; vector<KalmanTracker> trackers; KalmanTracker::kf_count = 0; // tracking id relies on this, so we have to reset it in each seq. // variables used in the for-loop vector<vector<double>> iouMatrix; vector<int> assignment; set<int> unmatchedDetections; set<int> unmatchedTrajectories; set<int> allDetections; set<int> matchedDetections; vector<cv::Point> matchedPairs; vector<TrackingBox> frameTrackingResult; unsigned int trkNum = 0; unsigned int detNum = 0; double cycle_time = 0.0; int64 start_time = 0; // prepare result file. ofstream resultsFile; string resFileName = "output.txt"; resultsFile.open(resFileName); if (!resultsFile.is_open()) { cerr << "Error: can not create file " << resFileName << endl; return; } KFMOT kf_fpga; cv::KalmanFilter kf_sw; if(hw_kf_en==1) { kf_fpga.kalmanfilter_init("/media/sd-mmcblk0p1/krnl_kalmanfilter.xclbin", "kalmanfilter_accel", 0); } else { int stateNum = 7; int measureNum = 4; kf_sw = KalmanFilter(stateNum, measureNum, 0); kf_sw.transitionMatrix = (Mat_<float>(stateNum, stateNum) << 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1); setIdentity(kf_sw.measurementMatrix); setIdentity(kf_sw.processNoiseCov, Scalar::all(1e-2)); setIdentity(kf_sw.measurementNoiseCov, Scalar::all(1e-1)); } ////////////////////////////////////////////// // main loop for (int fi = 0; fi < maxFrame; fi++) { total_frames++; frame_count++; start_time = getTickCount(); if (trackers.size() == 0) // the first frame met { trackers.reserve(detFrameData[fi].size()); // initialize kalman trackers using first detections. // __TIC_SUM__(INITIALISE); for (unsigned int i = 0; i < detFrameData[fi].size(); i++) { trackers.emplace_back(detFrameData[fi][i].box); } // __TOC_SUM__(INITIALISE); // output the first frame detections for (unsigned int id = 0; id < detFrameData[fi].size(); id++) { TrackingBox tb = detFrameData[fi][id]; resultsFile << tb.frame << "," << id + 1 << "," << tb.box.x << "," << tb.box.y << "," << tb.box.width << "," << tb.box.height << ",1,-1,-1,-1" << endl; } continue; } /////////////////////////////////////// // 3.1. get predicted locations from existing trackers. // __TIC_SUM__(PREDICT); predict(kf_fpga, kf_sw, trackers); // __TOC_SUM__(PREDICT); /////////////////////////////////////// // 3.2. associate detections to tracked object (both represented as bounding boxes) // dets : detFrameData[fi] trkNum = trackers.size(); detNum = detFrameData[fi].size(); iouMatrix.clear(); iouMatrix.resize(trkNum, vector<double>(detNum, 0)); // __TIC_SUM__(IOU); for (unsigned int i = 0; i < trkNum; i++) // compute iou matrix as a distance matrix { auto rect = trackers[i].getRect(); for (unsigned int j = 0; j < detNum; j++) { // use 1-iou because the hungarian algorithm computes a minimum-cost assignment. iouMatrix[i][j] = 1 - GetIOU(rect, detFrameData[fi][j].box); } } // __TOC_SUM__(IOU); // solve the assignment problem using hungarian algorithm. // the resulting assignment is [track(prediction) : detection], with len=preNum HungarianAlgorithm HungAlgo; assignment.clear(); // __TIC_SUM__(HUNGARIAN); HungAlgo.Solve(iouMatrix, assignment); // __TOC_SUM__(HUNGARIAN); // find matches, unmatched_detections and unmatched_predictions // filter out matched with low IOU unmatchedTrajectories.clear(); unmatchedDetections.clear(); allDetections.clear(); matchedDetections.clear(); matchedPairs.clear(); // __TIC_SUM__(IOU_THRESHOLD); for (unsigned int n = 0; n < detNum; n++) allDetections.insert(n); for (unsigned int i = 0; i < trkNum; ++i) { if (assignment[i] == -1) unmatchedTrajectories.insert(i); else if (1 - iouMatrix[i][assignment[i]] < iouThreshold) { unmatchedTrajectories.insert(i); unmatchedDetections.insert(assignment[i]); } else { matchedDetections.insert(assignment[i]); matchedPairs.emplace_back(i, assignment[i]); } } set_difference(allDetections.begin(), allDetections.end(), matchedDetections.begin(), matchedDetections.end(), insert_iterator<set<int>>(unmatchedDetections, unmatchedDetections.begin())); // __TOC_SUM__(IOU_THRESHOLD); /////////////////////////////////////// // 3.3. updating trackers // update matched trackers with assigned detections. // each prediction is corresponding to a tracker int detIdx, trkIdx; // __TIC_SUM__(UPDATE); int detIdx2, trkIdx2; for (unsigned int i = 0; i < matchedPairs.size(); i++) { trkIdx2 = matchedPairs[i].x; detIdx2 = matchedPairs[i].y; } update(kf_fpga, kf_sw, trackers, detFrameData[fi], matchedPairs); // __TOC_SUM__(UPDATE); // create and initialise new trackers for unmatched detections // __TIC_SUM__(INITIALISE_NEW); for (auto umd : unmatchedDetections) { KalmanTracker tracker = KalmanTracker(detFrameData[fi][umd].box); trackers.push_back(tracker); } // __TOC_SUM__(INITIALISE_NEW); // get trackers' output frameTrackingResult.clear(); for (auto it = trackers.begin(); it != trackers.end();) { if (((*it).m_time_since_update < 1) && ((*it).m_hit_streak >= min_hits || frame_count <= min_hits)) { TrackingBox res; res.box = (*it).getRect(); res.id = (*it).m_id + 1; res.frame = frame_count; frameTrackingResult.push_back(res); it++; } else it++; // remove dead tracklet if (it != trackers.end() && (*it).m_time_since_update > max_age) it = trackers.erase(it); } cycle_time = (double)(getTickCount() - start_time); total_time += cycle_time / getTickFrequency(); for (auto tb : frameTrackingResult) resultsFile << tb.frame << "," << tb.id << "," << tb.box.x << "," << tb.box.y << "," << tb.box.width << "," << tb.box.height << ",1,-1,-1,-1" << endl; } resultsFile.close(); }
28.640777
156
0.647051
luyufan498
59f7a965e8cc6205cfba71b5f7957c7c290d94ea
3,224
cpp
C++
RayEngine/Source/Vulkan/VulkRootLayout.cpp
Mumsfilibaba/RayEngine
68496966c1d7b91bc8fbdd305226ece9b9f596b2
[ "Apache-2.0" ]
null
null
null
RayEngine/Source/Vulkan/VulkRootLayout.cpp
Mumsfilibaba/RayEngine
68496966c1d7b91bc8fbdd305226ece9b9f596b2
[ "Apache-2.0" ]
null
null
null
RayEngine/Source/Vulkan/VulkRootLayout.cpp
Mumsfilibaba/RayEngine
68496966c1d7b91bc8fbdd305226ece9b9f596b2
[ "Apache-2.0" ]
null
null
null
/*//////////////////////////////////////////////////////////// Copyright 2018 Alexander Dahlin 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 THIS SOFTWARE IS PROVIDED "AS IS". MEANING NO WARRANTY OR SUPPORT IS PROVIDED OF ANY KIND. In event of any damages, direct or indirect that can be traced back to the use of this software, shall no contributor be held liable. This includes computer failure and or malfunction of any kind. ////////////////////////////////////////////////////////////*/ #include <RayEngine.h> #include <Vulkan/VulkDevice.h> #include <Vulkan/VulkRootLayout.h> namespace RayEngine { namespace Graphics { ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// VulkRootLayout::VulkRootLayout(IDevice* pDevice, const RootLayoutDesc* pDesc) : m_Device(nullptr), m_Layout(VK_NULL_HANDLE), m_Desc(), m_References(0) { AddRef(); m_Device = pDevice->QueryReference<VulkDevice>(); Create(pDevice, pDesc); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// VulkRootLayout::~VulkRootLayout() { if (m_Layout != VK_NULL_HANDLE) { VkDevice vkDevice = reinterpret_cast<VulkDevice*>(m_Device)->GetVkDevice(); vkDestroyPipelineLayout(vkDevice, m_Layout, nullptr); m_Layout = VK_NULL_HANDLE; } ReRelease_S(m_Device); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void VulkRootLayout::GetDesc(RootLayoutDesc * pDesc) const { *pDesc = m_Desc; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CounterType VulkRootLayout::Release() { CounterType counter = --m_References; if (m_References < 1) delete this; return counter; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CounterType VulkRootLayout::AddRef() { return ++m_References; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void VulkRootLayout::Create(IDevice* pDevice, const RootLayoutDesc* pDesc) { VkPipelineLayoutCreateInfo pipelineLayoutInfo = {}; pipelineLayoutInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO; pipelineLayoutInfo.pNext = nullptr; pipelineLayoutInfo.flags = 0; pipelineLayoutInfo.setLayoutCount = 0; pipelineLayoutInfo.pSetLayouts = nullptr; pipelineLayoutInfo.pushConstantRangeCount = 0; pipelineLayoutInfo.pPushConstantRanges = nullptr; VkDevice vkDevice = reinterpret_cast<VulkDevice*>(pDevice)->GetVkDevice(); VkResult result = vkCreatePipelineLayout(vkDevice, &pipelineLayoutInfo, nullptr, &m_Layout); if (result != VK_SUCCESS) { LOG_ERROR("Vulkan: Could not create pipelinelayout"); } else { m_Desc = *pDesc; } } } }
29.577982
124
0.531638
Mumsfilibaba
59fe4ef528bb118d9b1ea046656b122e246b842b
1,852
hpp
C++
src/BayesDecider.hpp
Nolnocn/Bayesian-Inference
76ee29171c6e3a4a69b752c1f68ae3fef2526f92
[ "MIT" ]
1
2021-07-07T02:45:55.000Z
2021-07-07T02:45:55.000Z
src/BayesDecider.hpp
Nolnocn/Bayes-Classifier
76ee29171c6e3a4a69b752c1f68ae3fef2526f92
[ "MIT" ]
null
null
null
src/BayesDecider.hpp
Nolnocn/Bayes-Classifier
76ee29171c6e3a4a69b752c1f68ae3fef2526f92
[ "MIT" ]
null
null
null
#ifndef BayesDecider_hpp #define BayesDecider_hpp #include <string> #include "BayesOutcomeDefs.h" namespace Bayes { // Forward dec struct BayesObservation; /* * Class used to store conditions and decide on observations * * Only this class and BayesObservation should be used * outside the Bayes namespace */ class BayesDecider { public: BayesDecider( const std::string& actionName ); ~BayesDecider(); // Public interface to add conditions to the decider // TODO: "Lock" decider before use so new conditions cannot be added void addContinuousCondition( const std::string& conditionName ); void addDiscreteCondition( const std::string& conditionName, uint32_t numValues = 2 ); // Adds an observation to the saved observations void addObservation( const BayesObservation& obs ); // Builds data for conditions from observations void buildStats(); // Does some Bayesian magic with the given observation // and returns whether or not the action should be performed bool decide( const BayesObservation& obs ) const; // Prints data from conditions and action to console void printData() const; // Prints all saved observations to the console void printObservations() const; private: struct Impl; // Using the PIML idiom to avoid including every other Bayes class static const double SQRT2PI; // constant cached for convenience // Internal functions used to perform aforementioned Bayesian magic double calculateBayes( const BayesObservation& obs, OutcomeType outcome ) const; double calculateGaussianDistribution( double mean, double stdDev, int x ) const; // Checks that an observation has the same number of values as there are conditions bool validateObservation( const BayesObservation& obs ) const; Impl* pImpl; }; } #endif /* BayesDecider_hpp */
28.9375
88
0.74568
Nolnocn
94017194841b6d01072880d0bc250e49e5d54fab
7,314
cpp
C++
ManagedScripts/MPhysClassMultiListClass.cpp
mpforums/RenSharp
5b3fb8bff2a1772a82a4148bcf3e1265a11aa097
[ "Apache-2.0" ]
1
2021-10-04T02:34:33.000Z
2021-10-04T02:34:33.000Z
ManagedScripts/MPhysClassMultiListClass.cpp
TheUnstoppable/RenSharp
2a123c6018c18f3fc73501737d600e291ac3afa7
[ "Apache-2.0" ]
9
2019-07-03T19:19:59.000Z
2020-03-02T22:00:21.000Z
ManagedScripts/MPhysClassMultiListClass.cpp
TheUnstoppable/RenSharp
2a123c6018c18f3fc73501737d600e291ac3afa7
[ "Apache-2.0" ]
2
2019-08-14T08:37:36.000Z
2020-09-29T06:44:26.000Z
/* Copyright 2020 Neijwiert 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 "stdafx.h" #include "MPhysClassMultiListClass.h" #include "Imports.h" #include "UnmanagedContainer.h" namespace RenSharp { PhysClassMultiListClass::PhysClassMultiListClass() : MultiListClass<IPhysClass ^>(IntPtr(Imports::CreatePhysClassMultiListClass())) { } PhysClassMultiListClass::PhysClassMultiListClass(IntPtr pointer) : MultiListClass<IPhysClass ^>(pointer) { } IUnmanagedContainer<IMultiListClass<IPhysClass ^> ^> ^PhysClassMultiListClass::CreatePhysClassMultiListClass() { return gcnew UnmanagedContainer<IMultiListClass<IPhysClass ^> ^>(gcnew PhysClassMultiListClass()); } bool PhysClassMultiListClass::Contains(IPhysClass ^obj) { return GenericContains(obj); } bool PhysClassMultiListClass::Add(IPhysClass ^obj, bool onlyOnce) { if (obj == nullptr || obj->PhysClassPointer.ToPointer() == nullptr) { throw gcnew ArgumentNullException("obj"); } return InternalPhysClassMultiListClassPointer->Add( reinterpret_cast<::PhysClass *>(obj->PhysClassPointer.ToPointer()), onlyOnce); } bool PhysClassMultiListClass::AddTail(IPhysClass ^obj, bool onlyOnce) { if (obj == nullptr || obj->PhysClassPointer.ToPointer() == nullptr) { throw gcnew ArgumentNullException("obj"); } return InternalPhysClassMultiListClassPointer->Add_Tail( reinterpret_cast<::PhysClass *>(obj->PhysClassPointer.ToPointer()), onlyOnce); } bool PhysClassMultiListClass::AddTail(IPhysClass ^obj) { if (obj == nullptr || obj->PhysClassPointer.ToPointer() == nullptr) { throw gcnew ArgumentNullException("obj"); } return InternalPhysClassMultiListClassPointer->Add_Tail( reinterpret_cast<::PhysClass *>(obj->PhysClassPointer.ToPointer())); } bool PhysClassMultiListClass::AddAfter(IPhysClass ^obj, IPhysClass ^existingListMember, bool onlyOnce) { if (obj == nullptr || obj->PhysClassPointer.ToPointer() == nullptr) { throw gcnew ArgumentNullException("obj"); } else if (existingListMember == nullptr || existingListMember->PhysClassPointer.ToPointer() == nullptr) { throw gcnew ArgumentNullException("existingListMember"); } return InternalPhysClassMultiListClassPointer->Add_After( reinterpret_cast<::PhysClass *>(obj->PhysClassPointer.ToPointer()), reinterpret_cast<::PhysClass *>(existingListMember->PhysClassPointer.ToPointer()), onlyOnce); } bool PhysClassMultiListClass::AddAfter(IPhysClass ^obj, IPhysClass ^existingListMember) { if (obj == nullptr || obj->PhysClassPointer.ToPointer() == nullptr) { throw gcnew ArgumentNullException("obj"); } else if (existingListMember == nullptr || existingListMember->PhysClassPointer.ToPointer() == nullptr) { throw gcnew ArgumentNullException("existingListMember"); } return InternalPhysClassMultiListClassPointer->Add_After( reinterpret_cast<::PhysClass *>(obj->PhysClassPointer.ToPointer()), reinterpret_cast<::PhysClass *>(existingListMember->PhysClassPointer.ToPointer())); } IPhysClass ^PhysClassMultiListClass::GetHead() { auto result = InternalPhysClassMultiListClassPointer->Get_Head(); if (result == nullptr) { return nullptr; } else { return PhysClass::CreatePhysClassWrapper(result); } } IPhysClass ^PhysClassMultiListClass::PeekHead() { auto result = InternalPhysClassMultiListClassPointer->Peek_Head(); if (result == nullptr) { return nullptr; } else { return PhysClass::CreatePhysClassWrapper(result); } } IPhysClass ^PhysClassMultiListClass::RemoveHead() { auto result = InternalPhysClassMultiListClassPointer->Remove_Head(); if (result == nullptr) { return nullptr; } else { return PhysClass::CreatePhysClassWrapper(result); } } void PhysClassMultiListClass::ResetList() { InternalPhysClassMultiListClassPointer->Reset_List(); } bool PhysClassMultiListClass::Remove(IPhysClass ^item) { if (item == nullptr || item->PhysClassPointer.ToPointer() == nullptr) { throw gcnew ArgumentNullException("item"); } return InternalPhysClassMultiListClassPointer->Remove( reinterpret_cast<::PhysClass *>(item->PhysClassPointer.ToPointer())); } IntPtr PhysClassMultiListClass::PhysClassMultiListClassPointer::get() { return IntPtr(InternalPhysClassMultiListClassPointer); } IUnmanagedContainer<IMultiListIterator<IPhysClass ^> ^> ^PhysClassMultiListClass::Iterator::get() { return PhysClassMultiListIterator::CreatePhysClassMultiListIterator(this); } bool PhysClassMultiListClass::InternalDestroyPointer() { Imports::DestroyPhysClassMultiListClass(InternalPhysClassMultiListClassPointer); Pointer = IntPtr::Zero; return true; } ::MultiListClass<::PhysClass> *PhysClassMultiListClass::InternalPhysClassMultiListClassPointer::get() { return reinterpret_cast<::MultiListClass<::PhysClass> *>(Pointer.ToPointer()); } PhysClassMultiListIterator::PhysClassMultiListIterator(IMultiListClass<IPhysClass ^> ^list) { if (list == nullptr || list->Pointer.ToPointer() == nullptr) { throw gcnew ArgumentNullException("list"); } Pointer = IntPtr(Imports::CreatePhysClassMultiListIterator( reinterpret_cast<::MultiListClass<::PhysClass> *>(list->Pointer.ToPointer()))); } PhysClassMultiListIterator::PhysClassMultiListIterator(IntPtr pointer) : MultiListIterator<IPhysClass ^>(pointer) { } IUnmanagedContainer<IMultiListIterator<IPhysClass ^> ^> ^PhysClassMultiListIterator::CreatePhysClassMultiListIterator( IMultiListClass<IPhysClass ^> ^list) { return gcnew UnmanagedContainer<IMultiListIterator<IPhysClass ^> ^>(gcnew PhysClassMultiListIterator(list)); } IPhysClass ^PhysClassMultiListIterator::GetObj() { auto result = InternalPhysClassMultiListIteratorPointer->Get_Obj(); if (result == nullptr) { return nullptr; } else { return PhysClass::CreatePhysClassWrapper(result); } } IPhysClass ^PhysClassMultiListIterator::PeekObj() { auto result = InternalPhysClassMultiListIteratorPointer->Peek_Obj(); if (result == nullptr) { return nullptr; } else { return PhysClass::CreatePhysClassWrapper(result); } } void PhysClassMultiListIterator::RemoveCurrentObject() { InternalPhysClassMultiListIteratorPointer->Remove_Current_Object(); } IntPtr PhysClassMultiListIterator::PhysClassMultiListIteratorPointer::get() { return IntPtr(InternalPhysClassMultiListIteratorPointer); } bool PhysClassMultiListIterator::InternalDestroyPointer() { Imports::DestroyPhysClassMultiListIterator(InternalPhysClassMultiListIteratorPointer); Pointer = IntPtr::Zero; return true; } ::MultiListIterator<::PhysClass> *PhysClassMultiListIterator::InternalPhysClassMultiListIteratorPointer::get() { return reinterpret_cast<::MultiListIterator<::PhysClass> *>(Pointer.ToPointer()); } }
27.704545
119
0.760459
mpforums
9402c048510239433822431b1d7d805bb9124bcb
1,752
hpp
C++
src/geometry/geometry.hpp
lanl/phoebus
c570f42882c1c9e01e3bfe4b00b22e15a7a9992b
[ "BSD-3-Clause" ]
3
2022-03-24T22:09:12.000Z
2022-03-29T23:16:21.000Z
src/geometry/geometry.hpp
lanl/phoebus
c570f42882c1c9e01e3bfe4b00b22e15a7a9992b
[ "BSD-3-Clause" ]
8
2022-03-15T20:49:43.000Z
2022-03-29T17:45:04.000Z
src/geometry/geometry.hpp
lanl/phoebus
c570f42882c1c9e01e3bfe4b00b22e15a7a9992b
[ "BSD-3-Clause" ]
null
null
null
// © 2021. Triad National Security, LLC. All rights reserved. This // program was produced under U.S. Government contract // 89233218CNA000001 for Los Alamos National Laboratory (LANL), which // is operated by Triad National Security, LLC for the U.S. // Department of Energy/National Nuclear Security Administration. All // rights in the program are reserved by Triad National Security, LLC, // and the U.S. Department of Energy/National Nuclear Security // Administration. The Government is granted for itself and others // acting on its behalf a nonexclusive, paid-up, irrevocable worldwide // license in this material to reproduce, prepare derivative works, // distribute copies to the public, perform publicly and display // publicly, and to permit others to do so. #ifndef GEOMETRY_GEOMETRY_HPP_ #define GEOMETRY_GEOMETRY_HPP_ #include <memory> #include <parthenon/package.hpp> #include "geometry/coordinate_systems.hpp" #include "geometry/tetrads.hpp" using namespace parthenon::package::prelude; namespace Geometry { std::shared_ptr<StateDescriptor> Initialize(ParameterInput *pin); // Set geometry data on grid, if needed. // Potentially a very expensive operation. You only want to do this // once, but it is deally done per meshblock, right at the beginning of // a problem generator. void SetGeometryBlock(MeshBlock *pmb, ParameterInput *pin); // Same as SetGeometryBlock, but a task for the task list. // Supports MeshBlockData or MeshData. // Template specializations are in geometry.cpp template <typename Data> TaskStatus UpdateGeometry(Data *rc); CoordSysMeshBlock GetCoordinateSystem(MeshBlockData<Real> *rc); CoordSysMesh GetCoordinateSystem(MeshData<Real> *rc); } // namespace Geometry #endif // GEOMETRY_GEOMETRY_HPP_
36.5
71
0.785388
lanl
9403527921d2f1b89cd5bb9a13f08c405701cf13
711
hpp
C++
pythran/pythonic/include/numpy/logaddexp.hpp
davidbrochart/pythran
24b6c8650fe99791a4091cbdc2c24686e86aa67c
[ "BSD-3-Clause" ]
1,647
2015-01-13T01:45:38.000Z
2022-03-28T01:23:41.000Z
pythran/pythonic/include/numpy/logaddexp.hpp
davidbrochart/pythran
24b6c8650fe99791a4091cbdc2c24686e86aa67c
[ "BSD-3-Clause" ]
1,116
2015-01-01T09:52:05.000Z
2022-03-18T21:06:40.000Z
pythran/pythonic/include/numpy/logaddexp.hpp
davidbrochart/pythran
24b6c8650fe99791a4091cbdc2c24686e86aa67c
[ "BSD-3-Clause" ]
180
2015-02-12T02:47:28.000Z
2022-03-14T10:28:18.000Z
#ifndef PYTHONIC_INCLUDE_NUMPY_LOGADDEXP_HPP #define PYTHONIC_INCLUDE_NUMPY_LOGADDEXP_HPP #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/utils/numpy_traits.hpp" #include "pythonic/include/numpy/log.hpp" #include "pythonic/include/numpy/exp.hpp" PYTHONIC_NS_BEGIN namespace numpy { namespace wrapper { template <class T0, class T1> auto logaddexp(T0 const &t0, T1 const &t1) -> decltype(functor::log{}(functor::exp{}(t0) + functor::exp{}(t1))); } #define NUMPY_NARY_FUNC_NAME logaddexp #define NUMPY_NARY_FUNC_SYM wrapper::logaddexp #include "pythonic/include/types/numpy_nary_expr.hpp" } PYTHONIC_NS_END #endif
24.517241
77
0.772152
davidbrochart
9404cada7abb85c24fb038250bb09f642ac913b9
2,207
cpp
C++
EZOJ/Contests/1465/A.cpp
sshockwave/Online-Judge-Solutions
9d0bc7fd68c3d1f661622929c1cb3752601881d3
[ "MIT" ]
6
2019-09-30T16:11:00.000Z
2021-11-01T11:42:33.000Z
EZOJ/Contests/1465/A.cpp
sshockwave/Online-Judge-Solutions
9d0bc7fd68c3d1f661622929c1cb3752601881d3
[ "MIT" ]
4
2017-11-21T08:17:42.000Z
2020-07-28T12:09:52.000Z
EZOJ/Contests/1465/A.cpp
sshockwave/Online-Judge-Solutions
9d0bc7fd68c3d1f661622929c1cb3752601881d3
[ "MIT" ]
4
2017-07-26T05:54:06.000Z
2020-09-30T13:35:38.000Z
#include <iostream> #include <cstdio> #include <cstring> #include <cassert> #include <cctype> using namespace std; typedef long long lint; #define cout cerr #define ni (next_num<int>()) template<class T>inline T next_num(){ T i=0;char c; while(!isdigit(c=getchar())&&c!='-'); bool neg=c=='-'; neg?c=getchar():0; while(i=i*10-'0'+c,isdigit(c=getchar())); return neg?-i:i; } template<class T1,class T2>inline void apmax(T1 &a,const T2 &b){if(a<b)a=b;} template<class T1,class T2>inline void apmin(T1 &a,const T2 &b){if(b<a)a=b;} template<class T>inline void mset(T a[],int v,int n){memset(a,v,n*sizeof(T));} template<class T>inline void mcpy(T a[],T b[],int n){memcpy(a,b,n*sizeof(T));} const int N=1000010; lint ans=0; namespace T{ const int E=::N<<1; int to[E],bro[E],head[N],e=0; bool vis[N]; int son[N],dep[N],hei[N]; int dfn[N],tim=0; inline void init(int n){ mset(head+1,-1,n); mset(vis+1,0,n); dep[0]=dep[1]=0; } inline void ae(int u,int v){ to[e]=v,bro[e]=head[u],head[u]=e++; } inline void add(int u,int v){ ae(u,v),ae(v,u); } void dfs1(int x,int fa){ hei[x]=dep[x]; son[x]=0; for(int i=head[x],v;~i;i=bro[i]){ if((v=to[i])==fa)continue; dep[v]=dep[x]+1; dfs1(v,x); if(hei[v]>hei[x]){ hei[x]=hei[v],son[x]=v; } } } lint f[N]; void dfs2(int x,int fa,lint g[]){ dfn[x]=++tim; lint *const f=T::f+dfn[x]; f[0]=1; if(son[x]==0)return; dfs2(son[x],x,g-1); ans+=g[0]; for(int i=head[x],v;~i;i=bro[i]){ if((v=to[i])==fa||v==son[x])continue; lint *ng=new lint[((hei[v]-dep[x])<<1)|1]; mset(ng,0,((hei[v]-dep[x])<<1)|1); ng+=hei[v]-dep[x]; lint *const nf=T::f+tim; dfs2(v,x,ng-1); ans+=ng[0]; for(int d=1;d<=hei[v]-dep[x];d++){ ans+=g[d]*nf[d]+f[d]*ng[d]; g[d]+=f[d]*nf[d]+ng[d]; f[d]+=nf[d]; } delete (ng-(hei[v]-dep[x])); } } } int main(){ #ifndef ONLINE_JUDGE freopen("zh.in","r",stdin); freopen("zh.out","w",stdout); #endif const int n=ni; T::init(n); for(int i=1;i<n;i++){ T::add(ni,ni); } T::dfs1(1,0); { lint *ng=new lint[(T::hei[1]<<1)|1]; mset(ng,0,(T::hei[1]<<1)|1); ng+=T::hei[1]; T::dfs2(1,0,ng-1); delete (ng-T::hei[1]); } printf("%lld\n",ans); return 0; }
22.292929
78
0.562302
sshockwave
9405b8c6256c4bf5cb3e9496bb27913661fc01f3
1,663
cpp
C++
benchmark/1_1/main.cpp
philong6297/modern-cpp-challenges
c3f9786aff9dd097ee1e4ec7ac65560e447c28b5
[ "MIT" ]
null
null
null
benchmark/1_1/main.cpp
philong6297/modern-cpp-challenges
c3f9786aff9dd097ee1e4ec7ac65560e447c28b5
[ "MIT" ]
null
null
null
benchmark/1_1/main.cpp
philong6297/modern-cpp-challenges
c3f9786aff9dd097ee1e4ec7ac65560e447c28b5
[ "MIT" ]
null
null
null
// Copyright 2021 Long Le Phi. All rights reserved. // Use of this source code is governed by a MIT license that can be // found in the LICENSE file. #include <cassert> #include <cstdint> #include <limits> #include <numeric> #include "benchmark/benchmark.h" #include "problems/1_1/solution.hpp" namespace { using longlp::solution::Problem_1_1; } // namespace auto main(int32_t argc, char** argv) -> int32_t { benchmark::RegisterBenchmark( "BM_Iteration_Branch", [](benchmark::State& state) { for ([[maybe_unused]] auto _ : state) { benchmark::DoNotOptimize(Problem_1_1::IterationWithBranches( static_cast<uintmax_t>(state.range()))); } }) ->RangeMultiplier(10) ->Range(100, 1'000'000) ->DisplayAggregatesOnly(true); benchmark::RegisterBenchmark( "BM_Iteration_Branch_no_branch", [](benchmark::State& state) { for ([[maybe_unused]] auto _ : state) { benchmark::DoNotOptimize(Problem_1_1::IterationWithNoBranches( static_cast<uintmax_t>(state.range()))); } }) ->RangeMultiplier(10) ->Range(100, 1'000'000) ->DisplayAggregatesOnly(true); benchmark::RegisterBenchmark( "BM_No_Iteration", [](benchmark::State& state) { for ([[maybe_unused]] auto _ : state) { benchmark::DoNotOptimize( Problem_1_1::UseFormula(static_cast<uintmax_t>(state.range()))); } }) ->RangeMultiplier(10) ->Range(100, 1'000'000) ->DisplayAggregatesOnly(true); benchmark::Initialize(&argc, argv); if (benchmark::ReportUnrecognizedArguments(argc, argv)) { return 1; } benchmark::RunSpecifiedBenchmarks(); }
27.716667
74
0.662057
philong6297
940ba990cc8c99d4ce336f193825936d60e9eee9
7,255
cpp
C++
src/solver/QLDLeastSquareSolver.cpp
mmurooka/tvm
9098ad443d059ed4d216afb5bcc41655afdc34e0
[ "BSD-3-Clause" ]
2
2021-03-15T00:54:58.000Z
2022-02-01T20:15:47.000Z
src/solver/QLDLeastSquareSolver.cpp
mmurooka/tvm
9098ad443d059ed4d216afb5bcc41655afdc34e0
[ "BSD-3-Clause" ]
null
null
null
src/solver/QLDLeastSquareSolver.cpp
mmurooka/tvm
9098ad443d059ed4d216afb5bcc41655afdc34e0
[ "BSD-3-Clause" ]
null
null
null
/* Copyright 2017-2020 CNRS-AIST JRL and CNRS-UM LIRMM * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors * may be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #pragma once #include <tvm/solver/QLDLeastSquareSolver.h> #include <tvm/scheme/internal/AssignmentTarget.h> #include <iostream> namespace tvm { namespace solver { QLDLeastSquareSolver::QLDLeastSquareSolver(const QLDLSSolverOptions& options) : LeastSquareSolver(options.verbose().value()) , Aineq_(A_.bottomRows(0)) , bineq_(b_.tail(0)) , big_number_(options.big_number().value()) , cholesky_(options.cholesky().value()) , choleskyDamping_(options.choleskyDamping().value()) , eps_(options.eps().value()) , autoMinNorm_(false) { } void QLDLeastSquareSolver::initializeBuild_(int nObj, int nEq, int nIneq, bool) { int n = variables().totalSize(); int nCstr = nEq + nIneq; underspecifiedObj_ = nObj < n; if (cholesky_ && underspecifiedObj_) { D_.resize(nObj + n, n); D_.bottomRows(n).setZero(); D_.bottomRows(n).diagonal().setConstant(choleskyDamping_); } else D_.resize(nObj, n); e_.resize(nObj); if (!cholesky_) Q_.resize(n, n); c_.resize(n); A_.resize(nCstr, n); b_.resize(nCstr); xl_ = Eigen::VectorXd::Constant(n, -big_number_); xu_ = Eigen::VectorXd::Constant(n, +big_number_); new(&Aineq_) MatrixXdBottom(A_.bottomRows(nIneq)); new(&bineq_) VectorXdTail(b_.tail(nIneq)); if (underspecifiedObj_) qld_.problem(n, nEq, nIneq, n+nObj); else qld_.problem(n, nEq, nIneq); if (cholesky_) { if (underspecifiedObj_) new(&qr_) Eigen::HouseholderQR<Eigen::MatrixXd>(nObj+n, n); else new(&qr_) Eigen::HouseholderQR<Eigen::MatrixXd>(nObj, n); } autoMinNorm_ = false; } void QLDLeastSquareSolver::addBound_(LinearConstraintPtr bound, RangePtr range, bool first) { scheme::internal::AssignmentTarget target(range, xl_, xu_); addAssignement(bound, target, bound->variables()[0], first); } void QLDLeastSquareSolver::addEqualityConstraint_(LinearConstraintPtr cstr) { RangePtr r = std::make_shared<Range>(eqSize_, cstr->size()); scheme::internal::AssignmentTarget target(r, A_, b_, constraint::Type::EQUAL, constraint::RHS::OPPOSITE); addAssignement(cstr, nullptr, target, variables(), substitutions()); } void QLDLeastSquareSolver::addIneqalityConstraint_(LinearConstraintPtr cstr) { RangePtr r = std::make_shared<Range>(ineqSize_, constraintSize(cstr)); scheme::internal::AssignmentTarget target(r, Aineq_, bineq_, constraint::Type::GREATER_THAN, constraint::RHS::OPPOSITE); addAssignement(cstr, nullptr, target, variables(), substitutions()); } void QLDLeastSquareSolver::addObjective_(LinearConstraintPtr cstr, SolvingRequirementsPtr req, double additionalWeight) { RangePtr r = std::make_shared<Range>(objSize_, cstr->size()); scheme::internal::AssignmentTarget target(r, D_, e_, constraint::Type::EQUAL, constraint::RHS::OPPOSITE); addAssignement(cstr, req, target, variables(), substitutions(), additionalWeight); } void QLDLeastSquareSolver::setMinimumNorm_() { autoMinNorm_ = true; Q_.setIdentity(); c_.setZero(); } void QLDLeastSquareSolver::preAssignmentProcess_() { } void QLDLeastSquareSolver::postAssignmentProcess_() { // QLD does not solve least-square cost, but quadratic cost. // We then either need to form the quadratic cost, or to get the Cholesky // decomposition of this quadratic cost. if (!autoMinNorm_) { // c = D^T e c_.noalias() = D_.topRows(nObj_).transpose() * e_; if (cholesky_) { // The cholesky decomposition of Q = D^T D is given by the R factor of // the QR decomposition of D: if D = U R with U orthogonal, D^T D = R^T R. qr_.compute(D_); } else { // Q = D^T D Q_.noalias() = D_.transpose() * D_; //TODO check if this can be optimized: QLD might need only half the matrix } } } bool QLDLeastSquareSolver::solve_() { if (cholesky_ && !autoMinNorm_) { int n = variables().totalSize(); return qld_.solve(qr_.matrixQR().topRows(n), c_, A_, b_, xl_, xu_, nEq_, true, eps_); } else { return qld_.solve(Q_, c_, A_, b_, xl_, xu_, nEq_, false, eps_); } } const Eigen::VectorXd& QLDLeastSquareSolver::result_() const { return qld_.result(); } void QLDLeastSquareSolver::printProblemData_() const { if (cholesky_) { int n = variables().totalSize(); std::cout << "R =\n" << qr_.matrixQR().topRows(n).template triangularView<Eigen::Upper>().toDenseMatrix() << std::endl; } else std::cout << "Q =\n" << Q_ << std::endl; std::cout << "c = " << c_.transpose() << std::endl; std::cout << "A =\n" << A_ << std::endl; std::cout << "b = " << b_.transpose() << std::endl; std::cout << "xl = " << xl_.transpose() << std::endl; std::cout << "xu = " << xu_.transpose() << std::endl; } void QLDLeastSquareSolver::printDiagnostic_() const { std::cout << "QLD fail code = " << qld_.fail() << " (0 is success)" << std::endl; } std::unique_ptr<abstract::LSSolverFactory> QLDLSSolverFactory::clone() const { return std::make_unique<QLDLSSolverFactory>(*this); } QLDLSSolverFactory::QLDLSSolverFactory(const QLDLSSolverOptions& options) : LSSolverFactory("qld") , options_(options) { } std::unique_ptr<abstract::LeastSquareSolver> QLDLSSolverFactory::createSolver() const { return std::make_unique<QLDLeastSquareSolver>(options_); } } }
32.977273
125
0.663129
mmurooka
940f9ad896fc34423013c03ef7f975751065fbbd
7,537
cpp
C++
src/Server.cpp
mark-grimes/Communique
969a2a8851ac2eb9dfc0d5c4fdd8669073ad882a
[ "Apache-2.0" ]
null
null
null
src/Server.cpp
mark-grimes/Communique
969a2a8851ac2eb9dfc0d5c4fdd8669073ad882a
[ "Apache-2.0" ]
1
2015-11-25T09:48:34.000Z
2015-11-25T09:48:34.000Z
src/Server.cpp
mark-grimes/Communique
969a2a8851ac2eb9dfc0d5c4fdd8669073ad882a
[ "Apache-2.0" ]
null
null
null
#include "communique/Server.h" #define _WEBSOCKETPP_CPP11_STL_ // Make sure websocketpp uses c++11 features in preference to boost ones #include <websocketpp/server.hpp> #include <websocketpp/config/asio.hpp> #include <list> #include "communique/impl/Connection.h" #include "communique/impl/TLSHandler.h" // // Declaration of the pimple // namespace communique { class ServerPrivateMembers { public: typedef websocketpp::server<websocketpp::config::asio_tls> server_type; ServerPrivateMembers() : tlsHandler_(server_.get_alog()) { /*No operation besides initialiser list*/ } server_type server_; std::thread ioThread_; std::list< std::shared_ptr<communique::impl::Connection> > currentConnections_; mutable std::mutex currentConnectionsMutex_; communique::impl::TLSHandler tlsHandler_; void on_http( websocketpp::connection_hdl hdl ); void on_open( websocketpp::connection_hdl hdl ); void on_close( websocketpp::connection_hdl hdl ); void on_interrupt( websocketpp::connection_hdl hdl ); std::function<void(const std::string&,std::weak_ptr<communique::IConnection>)> defaultInfoHandler_; std::function<std::string(const std::string&,std::weak_ptr<communique::IConnection>)> defaultRequestHandler_; }; } communique::Server::Server() : pImple_( new ServerPrivateMembers ) { pImple_->server_.set_access_channels(websocketpp::log::alevel::none); //pImple_->server_.set_error_channels(websocketpp::log::elevel::all ^ websocketpp::log::elevel::info); pImple_->server_.set_error_channels(websocketpp::log::elevel::none); pImple_->server_.set_tls_init_handler( std::bind( &communique::impl::TLSHandler::on_tls_init, &pImple_->tlsHandler_, std::placeholders::_1 ) ); pImple_->server_.set_http_handler( std::bind( &ServerPrivateMembers::on_http, pImple_.get(), std::placeholders::_1 ) ); pImple_->server_.init_asio(); pImple_->server_.set_open_handler( std::bind( &ServerPrivateMembers::on_open, pImple_.get(), std::placeholders::_1 ) ); pImple_->server_.set_close_handler( std::bind( &ServerPrivateMembers::on_close, pImple_.get(), std::placeholders::_1 ) ); pImple_->server_.set_interrupt_handler( std::bind( &ServerPrivateMembers::on_interrupt, pImple_.get(), std::placeholders::_1 ) ); } communique::Server::~Server() { try { stop(); } catch(...) { /* Make sure no exceptions propagate out */ } } bool communique::Server::listen( size_t port ) { try { if( pImple_->ioThread_.joinable() ) stop(); // If already running stop the current IO websocketpp::lib::error_code errorCode; websocketpp::lib::asio::error_code underlyingErrorCode; pImple_->server_.listen(port,errorCode,&underlyingErrorCode); if( errorCode ) { std::string errorMessage="Communique server listen error: "+errorCode.message(); if( underlyingErrorCode ) errorMessage+=" ("+underlyingErrorCode.message()+")"; throw std::runtime_error( errorMessage ); } pImple_->server_.start_accept(); pImple_->ioThread_=std::thread( &ServerPrivateMembers::server_type::run, &pImple_->server_ ); return true; } catch( std::exception& error ) { throw; } catch(...) { throw std::runtime_error( "Unknown exception in communique::Server::listen" ); } } void communique::Server::stop() { if( pImple_->server_.is_listening() ) pImple_->server_.stop_listening(); { // Block to limit lifetime of the lock_guard std::lock_guard<std::mutex> myMutex( pImple_->currentConnectionsMutex_ ); for( auto& pConnection : pImple_->currentConnections_ ) { //pImple_->server_.get_con_from_hdl(connection_hdl)->get_raw_socket().shutdown(boost::asio::ip::tcp::socket::shutdown_both); pConnection->close(); } } if( pImple_->ioThread_.joinable() ) pImple_->ioThread_.join(); } void communique::Server::setCertificateChainFile( const std::string& filename ) { pImple_->tlsHandler_.setCertificateChainFile(filename); } void communique::Server::setPrivateKeyFile( const std::string& filename ) { pImple_->tlsHandler_.setPrivateKeyFile(filename); } void communique::Server::setVerifyFile( const std::string& filename ) { pImple_->tlsHandler_.setVerifyFile(filename); } void communique::Server::setDiffieHellmanParamsFile( const std::string& filename ) { pImple_->tlsHandler_.setDiffieHellmanParamsFile(filename); } void communique::Server::setDefaultInfoHandler( std::function<void(const std::string&)> infoHandler ) { // Wrap in a function that drops the connection argument pImple_->defaultInfoHandler_=std::bind( infoHandler, std::placeholders::_1 ); } void communique::Server::setDefaultInfoHandler( std::function<void(const std::string&,std::weak_ptr<communique::IConnection>)> infoHandler ) { pImple_->defaultInfoHandler_=infoHandler; } void communique::Server::setDefaultRequestHandler( std::function<std::string(const std::string&)> requestHandler ) { // Wrap in a function that drops the connection argument pImple_->defaultRequestHandler_=std::bind( requestHandler, std::placeholders::_1 ); } void communique::Server::setDefaultRequestHandler( std::function<std::string(const std::string&,std::weak_ptr<communique::IConnection>)> requestHandler ) { pImple_->defaultRequestHandler_=requestHandler; } std::vector<std::weak_ptr<communique::IConnection> > communique::Server::currentConnections() { std::lock_guard<std::mutex> myMutex( pImple_->currentConnectionsMutex_ ); return std::vector<std::weak_ptr<communique::IConnection> >( pImple_->currentConnections_.begin(), pImple_->currentConnections_.end() ); } void communique::Server::setErrorLogLocation( std::ostream& outputStream ) { pImple_->server_.get_elog().set_ostream( &outputStream ); } void communique::Server::setErrorLogLevel( uint32_t level ) { pImple_->server_.set_error_channels(level); } void communique::Server::setAccessLogLocation( std::ostream& outputStream ) { pImple_->server_.get_alog().set_ostream( &outputStream ); } void communique::Server::setAccessLogLevel( uint32_t level ) { pImple_->server_.set_access_channels(level); } void communique::ServerPrivateMembers::on_http( websocketpp::connection_hdl hdl ) { server_type::connection_ptr con = server_.get_con_from_hdl(hdl); //con->set_body("Hello World!\n"); con->set_status(websocketpp::http::status_code::ok); } void communique::ServerPrivateMembers::on_open( websocketpp::connection_hdl hdl ) { std::lock_guard<std::mutex> myMutex( currentConnectionsMutex_ ); currentConnections_.emplace_back( new communique::impl::Connection( server_.get_con_from_hdl(hdl), defaultInfoHandler_, defaultRequestHandler_ ) ); } void communique::ServerPrivateMembers::on_close( websocketpp::connection_hdl hdl ) { std::lock_guard<std::mutex> myMutex( currentConnectionsMutex_ ); auto pRawConnection=server_.get_con_from_hdl(hdl); auto findResult=std::find_if( currentConnections_.begin(), currentConnections_.end(), [&pRawConnection](std::shared_ptr<communique::impl::Connection>& other){return pRawConnection==other->underlyingPointer();} ); if( findResult!=currentConnections_.end() ) currentConnections_.erase( findResult ); else std::cout << "Couldn't find connection to remove" << std::endl; } void communique::ServerPrivateMembers::on_interrupt( websocketpp::connection_hdl hdl ) { std::cout << "Connection has been interrupted" << std::endl; // auto findResult=std::find_if( currentConnections_.begin(), currentConnections_.end(), [&hdl](websocketpp::connection_hdl& other){return !other.owner_before(hdl) && !hdl.owner_before(other);} ); // if( findResult!=currentConnections_.end() ) currentConnections_.erase( findResult ); }
36.587379
213
0.761311
mark-grimes
9413d89aba0649c57c1517326033bcfa67239be6
6,706
cpp
C++
src/lib/meshes/Terrain.cpp
fluffels/vulkan-experiments
77fc2a3510a22df277d49a6e9b86e52505768b91
[ "MIT" ]
null
null
null
src/lib/meshes/Terrain.cpp
fluffels/vulkan-experiments
77fc2a3510a22df277d49a6e9b86e52505768b91
[ "MIT" ]
null
null
null
src/lib/meshes/Terrain.cpp
fluffels/vulkan-experiments
77fc2a3510a22df277d49a6e9b86e52505768b91
[ "MIT" ]
null
null
null
#include "Terrain.h" Terrain:: Terrain(string path) : IndexedMesh(), COMPONENTS(3), SMOOTH_PAS_COUNT(5), _vertices(nullptr), _normals(nullptr), _indices(nullptr), _width(0), _depth(0), _maxHeight(0), _terrainWidth(0), _terrainDepth(0), _heightMap(nullptr) { FILE* fp; errno_t fopenCode = fopen_s(&fp, path.c_str(), "rb"); if (fopenCode != 0) { char buffer[256]; errno_t strerrorCode = strerror_s(buffer, fopenCode); if (strerrorCode != 0) { throw runtime_error(buffer); } else { throw runtime_error("Could not load heightmap at " + path); } } else { int width = 0; int height = 0; int channelsInFile = 0; int desiredChannels = 1; _heightMap = stbi_load_from_file( fp, &width, &height, &channelsInFile, desiredChannels ); if (_heightMap != NULL) { _width = static_cast<unsigned>(width); _depth = static_cast<unsigned>(height); construct(); } else { const char* errorMessage = stbi_failure_reason(); throw runtime_error(errorMessage); } } } Terrain:: Terrain(const Terrain &rhs) : IndexedMesh(), COMPONENTS(3), SMOOTH_PAS_COUNT(5), _vertices(NULL), _normals(NULL), _indices(NULL), _width(rhs._width), _depth(rhs._depth), _maxHeight(0), _terrainWidth(0), _terrainDepth(0), _heightMap(rhs._heightMap) { construct(); } const Terrain &Terrain:: operator=(Terrain &rhs) { if (this != &rhs) { delete[] _vertices; delete[] _normals; delete[] _indices; /* TODO(jan): This is unsafe. */ this->_heightMap = rhs._heightMap; construct(); } return *this; } float Terrain:: getHeightAt(unsigned x, unsigned z) { return getCoord(x, z)[Y]; } void Terrain:: setHeight(unsigned x, unsigned z, float height) { getCoord(x, z)[Y] = height; } float Terrain:: getMaxHeight() const { return _maxHeight; } unsigned Terrain:: getWidth() const { return _width; } unsigned Terrain:: getDepth() const { return _depth; } float *Terrain:: getHeightArray() { float *result = new float[_vertexCount]; float *v = getCoord(0, 0); for (unsigned i = 0; i < (unsigned) _vertexCount; i++) { result[i] = v[Y]; v += COMPONENTS; } return result; } const float *Terrain:: getPositions() const { return _vertices; } const float *Terrain:: getNormals() const { return _normals; } const unsigned *Terrain:: getIndices() const { return _indices; } void Terrain:: construct() { _vertexCount = _width * _depth; const unsigned SIZE = (unsigned) _vertexCount * COMPONENTS; _vertices = new float[SIZE]; _normals = new float[SIZE]; _indexCount = _vertexCount * 6; _indices = new unsigned[_indexCount]; generateVertices(); for (unsigned i = 0; i < SMOOTH_PAS_COUNT; i++) { smoothVertices(); } generateNormals(); generateIndices(); } float *Terrain:: getCoord(unsigned x, unsigned z) { return _vertices + (z * _width * COMPONENTS) + (x * COMPONENTS); } float Terrain:: getPixel(unsigned x, unsigned z) { const unsigned index = z * _width + x; const unsigned char rawPixel = _heightMap[index]; const float normalizedPixel = rawPixel / 255.f; return normalizedPixel; } void Terrain:: generateVertices() { const float Z_DELTA = 1.0f; const float X_DELTA = 1.0f; unsigned index = 0; float Zcoord = 0.0f; float Xcoord = 0.0f; for (unsigned z = 0; z < _depth; z++) { Xcoord = 0.0f; for (unsigned x = 0; x < _width; x++) { float height = getPixel(x, z) * 64.f; if (height > _maxHeight) _maxHeight = height; _vertices[index++] = Xcoord; _vertices[index++] = height; _vertices[index++] = Zcoord; Xcoord += X_DELTA; } Zcoord += Z_DELTA; } _terrainDepth = Zcoord; _terrainWidth = Xcoord; } void Terrain:: generateNormals() { for (unsigned z = 1; z < _depth - 1; z++) { unsigned index = (_width * z + 1) * COMPONENTS; float *mid = _vertices + index; float *top = mid + _width * COMPONENTS; float *left = mid - COMPONENTS; float *right = mid + COMPONENTS; float *bot = mid - _width * COMPONENTS; for (unsigned x = 1; x < _width - 1; x++) { vec3 m(mid[X], mid[Y], mid[Z]); vec3 t(top[X], top[Y], top[Z]); vec3 r(right[X], right[Y], right[Z]); vec3 l(left[X], left[Y], left[Z]); vec3 b(bot[X], bot[Y], bot[Z]); vec3 v0 = t - m; vec3 v1 = r - m; vec3 n = normalize(cross(v0, v1)); vec3 v2 = l - m; n = n + normalize(cross(v2, v0)); vec3 v3 = b - m; n = n + normalize(cross(v3, v2)); n = n + normalize(cross(v1, v3)); n /= 4; _normals[index++] = n.x; _normals[index++] = n.y; _normals[index++] = n.z; mid += COMPONENTS; top += COMPONENTS; right += COMPONENTS; left += COMPONENTS; bot += COMPONENTS; } } } void Terrain:: generateIndices() { unsigned index = 0; for (unsigned z = 0; z < _depth - 1; z++) { for (unsigned x = 0; x < _width - 1; x++) { unsigned i = z * _width + x; /* Top left square. */ _indices[index++] = i; _indices[index++] = i + _width; _indices[index++] = i + 1; /* Bottom right square. */ _indices[index++] = i + 1; _indices[index++] = i + _width; _indices[index++] = i + 1 + _width; } } } void Terrain:: smoothVertices() { const unsigned SAMPLE = 4; for (unsigned z = SAMPLE; z < _depth - SAMPLE; z++) { float *t = getCoord(SAMPLE, z + 1); float *m = getCoord(SAMPLE, z); float *b = getCoord(SAMPLE, z - 1); for (unsigned x = SAMPLE; x < _width - SAMPLE; x++) { float acc = m[Y] + (m - COMPONENTS)[Y] + (m + COMPONENTS)[Y]; acc += t[Y] + (t - COMPONENTS)[Y] + (t + COMPONENTS)[Y]; acc += b[Y] + (b - COMPONENTS)[Y] + (b + COMPONENTS)[Y]; m[Y] = acc / 9; t += COMPONENTS; m += COMPONENTS; b += COMPONENTS; } } }
24.654412
73
0.525798
fluffels
9418d5e12fd6ddd41053ccde892c997c9b1b6445
1,009
cpp
C++
blackbox/net/ResponseQueue.cpp
mojmir-svoboda/BlackBoxTT
0c87b989827107695538e1bf1266c08b083dda44
[ "MIT" ]
11
2017-06-19T14:21:15.000Z
2020-03-04T06:43:16.000Z
blackbox/net/ResponseQueue.cpp
mojmir-svoboda/BlackBoxTT
0c87b989827107695538e1bf1266c08b083dda44
[ "MIT" ]
null
null
null
blackbox/net/ResponseQueue.cpp
mojmir-svoboda/BlackBoxTT
0c87b989827107695538e1bf1266c08b083dda44
[ "MIT" ]
3
2017-07-23T18:08:55.000Z
2019-09-16T16:28:18.000Z
#include "Session.h" #include "Server.h" #include <blackbox/common.h> #include <utility> #include <memory> #include <asio.hpp> #include <asio/ts/buffer.hpp> #include <asio/ts/internet.hpp> #include <bbproto/decoder.h> #include "commands.h" #include <boost/lockfree/spsc_queue.hpp> namespace bb { ResponseQueue::ResponseQueue () : m_impl(new boost::lockfree::spsc_queue<PendingCommand *, boost::lockfree::capacity<128>>) //: m_impl(new boost::lockfree::spsc_queue<std::unique_ptr<PendingCommand>, boost::lockfree::capacity<128>>) { } ResponseQueue::~ResponseQueue () { } // bool ResponseQueue::Enqueue (std::unique_ptr<PendingCommand> cmd) // { // return m_impl->push(cmd); // } // // bool ResponseQueue::Dequeue (std::unique_ptr<PendingCommand> & cmd) // { // return m_impl->pop(cmd); // } bool ResponseQueue::Enqueue(PendingCommand * cmd) { return m_impl->push(cmd); } bool ResponseQueue::Dequeue(PendingCommand * & cmd) { return m_impl->pop(cmd); } }
21.934783
110
0.682854
mojmir-svoboda
941e403224b15896608d39846bf5ab23aff0345e
5,749
cpp
C++
CmnMath/sample/sample_pointcloud_pointcloud.cpp
Khoronus/CmnUniverse
9cf9b4297f2fcb49330126aa1047b422144045e1
[ "MIT" ]
null
null
null
CmnMath/sample/sample_pointcloud_pointcloud.cpp
Khoronus/CmnUniverse
9cf9b4297f2fcb49330126aa1047b422144045e1
[ "MIT" ]
null
null
null
CmnMath/sample/sample_pointcloud_pointcloud.cpp
Khoronus/CmnUniverse
9cf9b4297f2fcb49330126aa1047b422144045e1
[ "MIT" ]
null
null
null
/* @file sample_math_trigonometry.hpp * @brief Perform a sample trigonometric operations. * * @section LICENSE * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR/AUTHORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * @author Various * @bug No known bugs. * @version 0.1.0.0 * */ #include <iostream> #include "pointcloud/pointcloud_pointcloud.hpp" #include "noise/noise_noise.hpp" namespace { /** @brief It finds a peak of values in a set */ float find_peak(std::map<int, std::vector< std::pair< std::pair< CmnMath::algebralinear::Vector3f, CmnMath::algebralinear::Vector3f>, std::pair<CmnMath::algebralinear::Vector3f, float> > > > &items, float bin) { // container with the bin points std::map<int, std::vector<CmnMath::algebralinear::Vector3f>> m_pts; // Show the points for (auto it : items) { for (auto it2 : it.second) { //std::cout << it.first << " " << it2.first.first << " " << it2.first.second << " " << it2.second.first << " " << it2.second.second << std::endl; m_pts[static_cast<int>(it2.first.first.z * bin)].push_back(CmnMath::algebralinear::Vector3f(it2.first.first.x, it2.first.first.y, it2.first.first.z)); } } //std::cout << "###########" << std::endl; float maxval = 0; float maxid = 0; for (auto it : m_pts) { //std::cout << it.first << " " << it.second.size() << std::endl; if (it.second.size() > maxval) { maxval = it.second.size(); maxid = it.first / bin; } } return maxid; } CmnMath::algebralinear::Vector3f rand_point() { return CmnMath::algebralinear::Vector3f( static_cast<float>(rand()) / RAND_MAX, static_cast<float>(rand()) / RAND_MAX, static_cast<float>(rand()) / RAND_MAX); } /** @brief Function to test the classes and functions */ void test() { srand(time(0)); // Load items std::map<int, std::vector< std::pair< std::pair< CmnMath::algebralinear::Vector3f, CmnMath::algebralinear::Vector3f>, std::pair<CmnMath::algebralinear::Vector3f, float> > > > items; for (int i = 0; i < 1000; ++i) { items[0].push_back(std::make_pair(std::make_pair( rand_point(), rand_point()), std::make_pair(CmnMath::algebralinear::Vector3f(255, 0, 255), 0.1f))); } // modifier std::vector<CmnMath::algebralinear::Vector3f> vpts; vpts.push_back(CmnMath::algebralinear::Vector3f(0.6, 0.4, 2.3)); vpts.push_back(CmnMath::algebralinear::Vector3f(-1.1, -0.2, 2.4)); CmnMath::noise::Noise<CmnMath::algebralinear::Vector3f>::localized_adjustment(vpts, 0.5, 1.0, items); vpts.clear(); vpts.push_back(CmnMath::algebralinear::Vector3f(0.8, -0.7, 2.4)); CmnMath::noise::Noise<CmnMath::algebralinear::Vector3f>::localized_adjustment(vpts, 0.7, 1.5, items); CmnMath::noise::Noise<CmnMath::algebralinear::Vector3f>::random_noise(0.0, 0.1, items); //Noise<CmnMath::algebralinear::Vector3f>::localized_random_noise(vpts, 0.5, 0.8, 0.1, items); //// Show the points //std::map<int, std::vector<CmnMath::algebralinear::Vector3f>> m_pts; //for (auto it : items) { // for (auto it2 : it.second) { // std::cout << it.first << " " << it2.first.first << " " << it2.first.second << " " << it2.second.first << " " << it2.second.second << std::endl; // m_pts[static_cast<int>(it2.first.first.z * 10)].push_back(CmnMath::algebralinear::Vector3f(it2.first.first.x, it2.first.first.y, it2.first.first.z)); // } //} //std::cout << "###########" << std::endl; //for (auto it : m_pts) { // std::cout << it.first << " " << it.second.size() << std::endl; //} std::vector<float> vavg, vmode, vmode_peak; // https://stackoverflow.com/questions/11062804/measuring-the-runtime-of-a-c-code auto start = std::chrono::system_clock::now(); // find the peak float peak = find_peak(items, 10); std::cout << "peak: " << peak << std::endl; int num_iterations = 5; for (int k = 0; k < num_iterations; ++k) { float dAvg = CmnMath::pointcloud::EstimateHeight<CmnMath::algebralinear::Vector3f>::average(5000, items[0]); float dMode = CmnMath::pointcloud::EstimateHeight<CmnMath::algebralinear::Vector3f>::mode(5000, 1000, items[0]); float dModeP = CmnMath::pointcloud::EstimateHeight<CmnMath::algebralinear::Vector3f>::mode(5000, 1000, items[0], peak, 0.2); vavg.push_back(dAvg); vmode.push_back(dMode); vmode_peak.push_back(dModeP); } auto end = std::chrono::system_clock::now(); // this constructs a duration object using milliseconds auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end - start); CmnMath::CMN_64F mean = 0, stdev = 0; CmnMath::statistics::classic::SeriesAnalysis<float>::mean_var(vavg, mean, stdev); std::cout << "dAvg: " << mean << " " << stdev << std::endl; CmnMath::statistics::classic::SeriesAnalysis<float>::mean_var(vmode, mean, stdev); std::cout << "dMode: " << mean << " " << stdev << std::endl; CmnMath::statistics::classic::SeriesAnalysis<float>::mean_var(vmode_peak, mean, stdev); std::cout << "dModeP: " << mean << " " << stdev << std::endl; std::cout << "et(ms): " << elapsed.count() / num_iterations << std::endl; } } // namespace /** main */ int main(int argc, char *argv[]) { std::cout << "Test pointcloud" << std::endl; test(); return 0; }
39.108844
154
0.678901
Khoronus
941f9574a275a4e910e05e0542e5010e18b71ca9
12,633
hpp
C++
ryoanji/src/ryoanji/cpu/multipole.hpp
nknk567/SPH-EXA
1d51f444eeb8662192465b40f5893fd92045729e
[ "MIT" ]
null
null
null
ryoanji/src/ryoanji/cpu/multipole.hpp
nknk567/SPH-EXA
1d51f444eeb8662192465b40f5893fd92045729e
[ "MIT" ]
null
null
null
ryoanji/src/ryoanji/cpu/multipole.hpp
nknk567/SPH-EXA
1d51f444eeb8662192465b40f5893fd92045729e
[ "MIT" ]
null
null
null
/* * MIT License * * Copyright (c) 2021 CSCS, ETH Zurich * 2021 University of Basel * * 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. */ /*! @file * @brief implements elementary gravity data structures for octree nodes * * @author Sebastian Keller <sebastian.f.keller@gmail.com> * * See for example Hernquist 1987, Performance Characteristics of Tree Codes, * https://ui.adsabs.harvard.edu/abs/1987ApJS...64..715H */ #pragma once #include <cmath> #include "cstone/util/tuple.hpp" #include "ryoanji/types.h" namespace ryoanji { template <class T> using CartesianQuadrupole = util::array<T, 8>; template<class MType> struct IsCartesian : public stl::integral_constant<size_t, MType{}.size() == CartesianQuadrupole<float>{}.size()> { }; //! @brief CartesianQuadrupole index names struct Cqi { enum IndexNames { mass = 0, qxx = 1, qxy = 2, qxz = 3, qyy = 4, qyz = 5, qzz = 6 }; }; /*! @brief Compute the monopole and quadruple moments from particle coordinates * * @tparam T1 float or double * @tparam T2 float or double * @tparam T3 float or double * @param[in] x x coordinate array * @param[in] y y coordinate array * @param[in] z z coordinate array * @param[in] m masses array * @param[in] numParticles number of particles to read from coordinate arrays * @param[out] gv output quadrupole */ template<class T1, class T2, class T3> void particle2Multipole(const T1* x, const T1* y, const T1* z, const T2* m, LocalIndex first, LocalIndex last, const Vec3<T1>& center, CartesianQuadrupole<T3>& gv) { gv = T3(0); if (first == last) { return; } for (LocalIndex i = first; i < last; ++i) { T1 xx = x[i]; T1 yy = y[i]; T1 zz = z[i]; T1 m_i = m[i]; T1 rx = xx - center[0]; T1 ry = yy - center[1]; T1 rz = zz - center[2]; gv[Cqi::mass] += m_i; gv[Cqi::qxx] += rx * rx * m_i; gv[Cqi::qxy] += rx * ry * m_i; gv[Cqi::qxz] += rx * rz * m_i; gv[Cqi::qyy] += ry * ry * m_i; gv[Cqi::qyz] += ry * rz * m_i; gv[Cqi::qzz] += rz * rz * m_i; } T1 traceQ = gv[Cqi::qxx] + gv[Cqi::qyy] + gv[Cqi::qzz]; // remove trace gv[Cqi::qxx] = 3 * gv[Cqi::qxx] - traceQ; gv[Cqi::qyy] = 3 * gv[Cqi::qyy] - traceQ; gv[Cqi::qzz] = 3 * gv[Cqi::qzz] - traceQ; gv[Cqi::qxy] *= 3; gv[Cqi::qxz] *= 3; gv[Cqi::qyz] *= 3; } template<class T> void moveExpansionCenter(Vec3<T> Xold, Vec3<T> Xnew, CartesianQuadrupole<T>& gv) { Vec3<T> dX = Xold - Xnew; T rx = dX[0]; T ry = dX[1]; T rz = dX[2]; gv[Cqi::qxx] = gv.qxx - rx * rx * gv[Cqi::mass]; gv[Cqi::qxy] = gv.qxy - rx * ry * gv[Cqi::mass]; gv[Cqi::qxz] = gv.qxz - rx * rz * gv[Cqi::mass]; gv[Cqi::qyy] = gv.qyy - ry * ry * gv[Cqi::mass]; gv[Cqi::qyz] = gv.qyz - ry * rz * gv[Cqi::mass]; gv[Cqi::qzz] = gv.qzz - rz * rz * gv[Cqi::mass]; T traceQ = gv[Cqi::qxx] + gv[Cqi::qyy] + gv[Cqi::qzz]; // remove trace gv[Cqi::qxx] = 3 * gv[Cqi::qxx] - traceQ; gv[Cqi::qyy] = 3 * gv[Cqi::qyy] - traceQ; gv[Cqi::qzz] = 3 * gv[Cqi::qzz] - traceQ; gv[Cqi::qxy] *= 3; gv[Cqi::qxz] *= 3; gv[Cqi::qyz] *= 3; } /*! @brief compute a single particle-particle gravitational interaction * * @tparam T1 float or double * @tparam T2 float or double * @param tx target x coord * @param ty target y coord * @param tz target z coord * @param th target h smoothing length * @param sx source x coord * @param sy source y coord * @param sz source z coord * @param sh source h coord * @param sm source mass * @return tuple(ax, ay, az, ugrav) */ template<class T1, class T2> HOST_DEVICE_FUN inline __attribute__((always_inline)) util::tuple<T1, T1, T1, T1> particle2Particle(T1 tx, T1 ty, T1 tz, T2 th, T1 sx, T1 sy, T1 sz, T2 sh, T2 sm) { T1 rx = sx - tx; T1 ry = sy - ty; T1 rz = sz - tz; T1 r_2 = rx * rx + ry * ry + rz * rz; T1 r = std::sqrt(r_2); T1 r_minus1 = 1.0 / r; T1 r_minus2 = r_minus1 * r_minus1; T1 mEffective = sm; T1 h_ts = th + sh; if (r < h_ts) { // apply mass softening correction T1 vgr = r / h_ts; mEffective *= vgr * vgr * vgr; } T1 Mr_minus3 = mEffective * r_minus1 * r_minus2; return {Mr_minus3 * rx, Mr_minus3 * ry, Mr_minus3 * rz, -Mr_minus3 * r_2}; } /*! @brief direct gravity calculation with particle-particle interactions * * @tparam T1 float or double * @tparam T2 float or double * @param[in] tx target particle x coordinate * @param[in] ty target particle y coordinate * @param[in] tz target particle z coordinate * @param[in] hi target particle smoothing length * @param[in] sx source particle x coordinates * @param[in] sy source particle y coordinates * @param[in] sz source particle z coordinates * @param[in] h source particle smoothing lengths * @param[in] m source particle masses * @param[in] numSources number of source particles * @return tuple(ax, ay, az, ugrav) * * Computes direct particle-particle gravitational interaction according to * * vec(a_t) = - sum_{j} m_j / (r_tj^2 + eps2)^(3/2)) * (r_t - r_j) * * Notes: * - Source particles MUST NOT contain the target. If the source is a cell that contains the target, * the target must be located and this function called twice, with all particles before target and * all particles that follow it. */ template<class T1, class T2> HOST_DEVICE_FUN util::tuple<T1, T1, T1, T1> particle2Particle(T1 tx, T1 ty, T1 tz, T2 hi, const T1* sx, const T1* sy, const T1* sz, const T2* h, const T2* m, LocalIndex numSources) { T1 axLoc = 0; T1 ayLoc = 0; T1 azLoc = 0; T1 uLoc = 0; #if defined(__llvm__) || defined(__clang__) #pragma clang loop vectorize(enable) #endif for (LocalIndex j = 0; j < numSources; ++j) { auto [ax_, ay_, az_, u_] = particle2Particle(tx, ty, tz, hi, sx[j], sy[j], sz[j], h[j], m[j]); axLoc += ax_; ayLoc += ay_; azLoc += az_; uLoc += u_; } return {axLoc, ayLoc, azLoc, uLoc}; } /*! @brief apply gravitational interaction with a multipole to a particle * * @tparam T1 float or double * @tparam T2 float or double * @param[in] tx target particle x coordinate * @param[in] ty target particle y coordinate * @param[in] tz target particle z coordinate * @param[in] multipole multipole source * @param[inout] ugrav location to add gravitational potential to * @return tuple(ax, ay, az, u) * * Note: contribution is added to output * * Direct implementation of the formulae in Hernquist, 1987 (complete reference in file docstring): * * monopole: -M/r^3 * vec(r) * quadrupole: Q*vec(r) / r^5 - 5/2 * vec(r)*Q*vec(r) * vec(r) / r^7 */ template<class T1, class T2> HOST_DEVICE_FUN inline util::tuple<T1, T1, T1, T1> multipole2Particle(T1 tx, T1 ty, T1 tz, const Vec3<T1>& center, const CartesianQuadrupole<T2>& multipole) { T2 rx = tx - center[0]; T2 ry = ty - center[1]; T2 rz = tz - center[2]; T2 r_2 = rx * rx + ry * ry + rz * rz; T2 r_minus1 = T2(1) / std::sqrt(r_2); T2 r_minus2 = r_minus1 * r_minus1; T2 r_minus5 = r_minus2 * r_minus2 * r_minus1; T2 Qrx = rx * multipole[Cqi::qxx] + ry * multipole[Cqi::qxy] + rz * multipole[Cqi::qxz]; T2 Qry = rx * multipole[Cqi::qxy] + ry * multipole[Cqi::qyy] + rz * multipole[Cqi::qyz]; T2 Qrz = rx * multipole[Cqi::qxz] + ry * multipole[Cqi::qyz] + rz * multipole[Cqi::qzz]; T2 rQr = rx * Qrx + ry * Qry + rz * Qrz; // rQr quad-term mono-term // | | T2 rQrAndMonopole = (T2(-2.5) * rQr * r_minus5 - multipole[Cqi::mass] * r_minus1) * r_minus2; // Qr Quad-term return {r_minus5 * Qrx + rQrAndMonopole * rx, r_minus5 * Qry + rQrAndMonopole * ry, r_minus5 * Qrz + rQrAndMonopole * rz, -(multipole[Cqi::mass] * r_minus1 + T2(0.5) * r_minus5 * rQr)}; } /*! @brief add a multipole contribution to the composite multipole * * @tparam T float or double * @param[inout] composite the composite multipole * @param[in] dX distance vector between composite and added expansion center * @param[in] addend the multipole to add * * Implements formula (2.5) from Hernquist 1987 (parallel axis theorem) */ template<class T> void addQuadrupole(CartesianQuadrupole<T>& composite, Vec3<T> dX, const CartesianQuadrupole<T>& addend) { T rx = dX[0]; T ry = dX[1]; T rz = dX[2]; T rx_2 = rx * rx; T ry_2 = ry * ry; T rz_2 = rz * rz; T r_2 = (rx_2 + ry_2 + rz_2) * (1.0 / 3.0); T ml = addend[Cqi::mass] * 3; composite[Cqi::mass] += addend[Cqi::mass]; composite[Cqi::qxx] += addend[Cqi::qxx] + ml * (rx_2 - r_2); composite[Cqi::qxy] += addend[Cqi::qxy] + ml * rx * ry; composite[Cqi::qxz] += addend[Cqi::qxz] + ml * rx * rz; composite[Cqi::qyy] += addend[Cqi::qyy] + ml * (ry_2 - r_2); composite[Cqi::qyz] += addend[Cqi::qyz] + ml * ry * rz; composite[Cqi::qzz] += addend[Cqi::qzz] + ml * (rz_2 - r_2); } /*! @brief Combine multipoles into a single multipole * * @tparam T float or double * @tparam MType Spherical multipole, quadrupole or octopole * @param[in] begin first index into @p sourceCenter and @p Multipole to aggregate * @param[in] end last index * @param[in] Xout the expansion (com) center of the output multipole * @param[in] Xsrc input multipole expansion (com) centers * @param[in] Msrc input multipoles * @param[out] Mout the aggregated output multipole */ template<class T, class MType, std::enable_if_t<MType{}.size() == CartesianQuadrupole<T>{}.size(), int> = 0> void multipole2Multipole(int begin, int end, const Vec4<T>& Xout, const Vec4<T>* Xsrc, const MType* Msrc, MType& Mout) { Mout = 0; for (int i = begin; i < end; i++) { const MType& Mi = Msrc[i]; Vec4<T> Xi = Xsrc[i]; Vec3<T> dX = makeVec3(Xout - Xi); addQuadrupole(Mout, dX, Mi); } } template<class MType, std::enable_if_t<IsCartesian<MType>{}, int> = 0> HOST_DEVICE_FUN MType normalize(const MType& multipole) { return multipole; } } // namespace ryoanji
34.99446
118
0.5583
nknk567
94202060e600345f1441d56fd740a24839276ef0
28,861
cpp
C++
newton-4.00/sdk/dNewton/dParticles/ndBodySphFluid.cpp
Libertus-Lab/newton-dynamics
af6e6635c7f563c697b8e5b088d68ba24fa8fe9c
[ "Zlib" ]
null
null
null
newton-4.00/sdk/dNewton/dParticles/ndBodySphFluid.cpp
Libertus-Lab/newton-dynamics
af6e6635c7f563c697b8e5b088d68ba24fa8fe9c
[ "Zlib" ]
null
null
null
newton-4.00/sdk/dNewton/dParticles/ndBodySphFluid.cpp
Libertus-Lab/newton-dynamics
af6e6635c7f563c697b8e5b088d68ba24fa8fe9c
[ "Zlib" ]
null
null
null
/* Copyright (c) <2003-2021> <Julio Jerez, Newton Game Dynamics> * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * * 3. This notice may not be removed or altered from any source distribution. */ #include "ndCoreStdafx.h" #include "ndNewtonStdafx.h" #include "ndWorld.h" #include "ndBodySphFluid.h" #define D_SPH_HASH_BITS 8 #define D_SPH_BUFFER_GRANULARITY 4096 class ndBodySphFluid::ndGridHash { public: ndGridHash() { } ndGridHash(ndUnsigned64 gridHash) :m_gridHash(gridHash) { } ndGridHash(ndInt32 y, ndInt32 z) { m_gridHash = 0; m_y = y; m_z = z; } ndGridHash(const ndVector& grid, ndInt32 particleIndex) { dAssert(grid.m_y >= ndFloat32(0.0f)); dAssert(grid.m_z >= ndFloat32(0.0f)); dAssert(grid.m_y < ndFloat32(1 << (D_SPH_HASH_BITS * 2))); dAssert(grid.m_z < ndFloat32(1 << (D_SPH_HASH_BITS * 2))); ndVector hash(grid.GetInt()); m_gridHash = 0; m_y = hash.m_iy; m_z = hash.m_iz; m_cellType = ndAdjacentGrid; m_particleIndex = particleIndex; } union { struct { ndUnsigned64 m_y : D_SPH_HASH_BITS * 2; ndUnsigned64 m_z : D_SPH_HASH_BITS * 2; ndUnsigned64 m_particleIndex : 23; ndUnsigned64 m_cellType : 1; }; struct { ndUnsigned64 m_yLow : D_SPH_HASH_BITS; ndUnsigned64 m_yHigh : D_SPH_HASH_BITS; ndUnsigned64 m_zLow : D_SPH_HASH_BITS; ndUnsigned64 m_zHigh : D_SPH_HASH_BITS; }; ndUnsigned64 m_gridHash : D_SPH_HASH_BITS * 2 * 2; }; }; class ndBodySphFluid::ndParticlePair { public: ndInt32 m_neighborg[32]; }; class ndBodySphFluid::ndParticleKernelDistance { public: ndFloat32 m_dist[32]; }; class ndBodySphFluid::ndWorkingData { #define D_SPH_GRID_X_RESOLUTION 4 public: ndWorkingData() :m_accel(D_SPH_BUFFER_GRANULARITY) ,m_locks(D_SPH_BUFFER_GRANULARITY) ,m_pairCount(D_SPH_BUFFER_GRANULARITY) ,m_gridScans(D_SPH_BUFFER_GRANULARITY) ,m_density(D_SPH_BUFFER_GRANULARITY) ,m_invDensity(D_SPH_BUFFER_GRANULARITY) ,m_pairs(D_SPH_BUFFER_GRANULARITY) ,m_hashGridMap(D_SPH_BUFFER_GRANULARITY) ,m_hashGridMapScratchBuffer(D_SPH_BUFFER_GRANULARITY) ,m_kernelDistance(D_SPH_BUFFER_GRANULARITY) ,m_worlToGridOrigin(ndFloat32 (1.0f)) ,m_worlToGridScale(ndFloat32(1.0f)) { for (ndInt32 i = 0; i < D_MAX_THREADS_COUNT; ++i) { m_partialsGridScans[i].Resize(D_SPH_BUFFER_GRANULARITY); } } void Clear() { m_accel.Resize(D_SPH_BUFFER_GRANULARITY); m_locks.Resize(D_SPH_BUFFER_GRANULARITY); m_pairs.Resize(D_SPH_BUFFER_GRANULARITY); m_density.Resize(D_SPH_BUFFER_GRANULARITY); m_pairCount.Resize(D_SPH_BUFFER_GRANULARITY); m_gridScans.Resize(D_SPH_BUFFER_GRANULARITY); m_invDensity.Resize(D_SPH_BUFFER_GRANULARITY); m_hashGridMap.Resize(D_SPH_BUFFER_GRANULARITY); m_kernelDistance.Resize(D_SPH_BUFFER_GRANULARITY); m_hashGridMapScratchBuffer.Resize(D_SPH_BUFFER_GRANULARITY); for (ndInt32 i = 0; i < D_MAX_THREADS_COUNT; ++i) { m_partialsGridScans[i].Resize(D_SPH_BUFFER_GRANULARITY); } } void SetWorldToGridMapping(ndInt32 gridCount, ndFloat32 xMax, ndFloat32 xMin) { m_worlToGridOrigin = xMin; m_worlToGridScale = ndFloat32(1<< D_SPH_GRID_X_RESOLUTION) * gridCount / (xMax - xMin); } ndInt32 WorldToGrid(ndFloat32 x) const { ndInt32 val = ndInt32((x - m_worlToGridOrigin) * m_worlToGridScale); dAssert(val >= 0); return val; } ndArray<ndVector> m_accel; ndArray<ndSpinLock> m_locks; ndArray<ndInt8> m_pairCount; ndArray<ndInt32> m_gridScans; ndArray<ndFloat32> m_density; ndArray<ndFloat32> m_invDensity; ndArray<ndParticlePair> m_pairs; ndArray<ndGridHash> m_hashGridMap; ndArray<ndGridHash> m_hashGridMapScratchBuffer; ndArray<ndParticleKernelDistance> m_kernelDistance; ndArray<ndInt32> m_partialsGridScans[D_MAX_THREADS_COUNT]; ndFloat32 m_worlToGridOrigin; ndFloat32 m_worlToGridScale; }; ndBodySphFluid::ndBodySphFluid() :ndBodyParticleSet() ,m_mass(ndFloat32(0.02f)) ,m_viscosity(ndFloat32 (1.05f)) ,m_restDensity(ndFloat32(1000.0f)) ,m_gasConstant(ndFloat32(1.0f)) { } ndBodySphFluid::ndBodySphFluid(const ndLoadSaveBase::ndLoadDescriptor& desc) :ndBodyParticleSet(desc) ,m_mass(ndFloat32(0.02f)) ,m_viscosity(ndFloat32(1.0f)) ,m_restDensity(ndFloat32(1000.0f)) ,m_gasConstant(ndFloat32(1.0f)) { // nothing was saved dAssert(0); } ndBodySphFluid::~ndBodySphFluid() { ndWorkingData& data = WorkingData(); data.Clear(); } //void ndBodySphFluid::Save(const dLoadSaveBase::dSaveDescriptor& desc) const void ndBodySphFluid::Save(const ndLoadSaveBase::ndSaveDescriptor&) const { dAssert(0); //nd::TiXmlElement* const paramNode = CreateRootElement(rootNode, "ndBodySphFluid", nodeid); //ndBodyParticleSet::Save(paramNode, assetPath, nodeid, shapesCache); } ndBodySphFluid::ndWorkingData& ndBodySphFluid::WorkingData() { static ndWorkingData workingBuffers; return workingBuffers; } void ndBodySphFluid::SortXdimension(ndThreadPool* const threadPool) { D_TRACKTIME(); #define XRESOLUTION ndFloat32(1<<23) class ndKey_low { public: ndKey_low(void* const context) :m_fluid((ndBodySphFluid*)context) ,m_data(m_fluid->WorkingData()) ,m_point(m_fluid->GetPositions()) { } ndInt32 GetKey(const ndGridHash& cell) const { ndUnsigned32 key = m_data.WorldToGrid(m_point[cell.m_particleIndex].m_x); return key & 0xff; } ndBodySphFluid* m_fluid; ndWorkingData& m_data; const ndArray<ndVector>& m_point; }; class ndKey_middle { public: ndKey_middle(void* const context) :m_fluid((ndBodySphFluid*)context) ,m_data(m_fluid->WorkingData()) ,m_point(m_fluid->GetPositions()) { } ndInt32 GetKey(const ndGridHash& cell) const { ndUnsigned32 key = m_data.WorldToGrid(m_point[cell.m_particleIndex].m_x); return (key >> 8) & 0xff; } ndBodySphFluid* m_fluid; ndWorkingData& m_data; const ndArray<ndVector>& m_point; }; class ndKey_high { public: ndKey_high(void* const context) :m_fluid((ndBodySphFluid*)context) ,m_data(m_fluid->WorkingData()) ,m_point(m_fluid->GetPositions()) { } ndInt32 GetKey(const ndGridHash& cell) const { ndUnsigned32 key = m_data.WorldToGrid(m_point[cell.m_particleIndex].m_x); return (key >> 16) & 0xff; } ndBodySphFluid* m_fluid; ndWorkingData& m_data; const ndArray<ndVector>& m_point; }; ndWorkingData& data = WorkingData(); const ndInt32 keySize = data.WorldToGrid(m_box1.m_x); ndCountingSort<ndGridHash, ndKey_low, 8>(*threadPool, data.m_hashGridMap, data.m_hashGridMapScratchBuffer, this); if (keySize >= 256) { ndCountingSort<ndGridHash, ndKey_middle, 8>(*threadPool, data.m_hashGridMap, data.m_hashGridMapScratchBuffer, this); } if (keySize >= (256 * 256)) { ndCountingSort<ndGridHash, ndKey_high, 8>(*threadPool, data.m_hashGridMap, data.m_hashGridMapScratchBuffer, this); } #ifdef _DEBUG const ndArray<ndVector>& point = GetPositions(); for (int i = 1; i < data.m_hashGridMap.GetCount(); i ++) { ndGridHash cell0(data.m_hashGridMap[i - 1]); ndGridHash cell1(data.m_hashGridMap[i + 0]); const ndVector p0(point[cell0.m_particleIndex]); const ndVector p1(point[cell1.m_particleIndex]); ndUnsigned32 key0 = data.WorldToGrid(p0.m_x); ndUnsigned32 key1 = data.WorldToGrid(p1.m_x); dAssert(key0 <= key1); //dAssert(p0.m_x <= p1.m_x); } #endif } void ndBodySphFluid::SortCellBuckects(ndThreadPool* const threadPool) { D_TRACKTIME(); class ndKey_ylow { public: ndKey_ylow(void* const) {} ndInt32 GetKey(const ndGridHash& cell) const { return cell.m_yLow; } }; class ndKey_zlow { public: ndKey_zlow(void* const) {} ndInt32 GetKey(const ndGridHash& cell) const { return cell.m_zLow; } }; class ndKey_yhigh { public: ndKey_yhigh(void* const) {} ndInt32 GetKey(const ndGridHash& cell) const { return cell.m_yHigh; } }; class ndKey_zhigh { public: ndKey_zhigh(void* const) {} ndInt32 GetKey(const ndGridHash& cell) const { return cell.m_zHigh; } }; ndWorkingData& data = WorkingData(); const ndVector boxSize((m_box1 - m_box0).Scale(ndFloat32(1.0f) / GetSphGridSize()).GetInt()); ndCountingSort<ndGridHash, ndKey_ylow, D_SPH_HASH_BITS>(*threadPool, data.m_hashGridMap, data.m_hashGridMapScratchBuffer); if (boxSize.m_iy > (1 << D_SPH_HASH_BITS)) { ndCountingSort<ndGridHash, ndKey_yhigh, D_SPH_HASH_BITS>(*threadPool, data.m_hashGridMap, data.m_hashGridMapScratchBuffer); } ndCountingSort<ndGridHash, ndKey_zlow, D_SPH_HASH_BITS>(*threadPool, data.m_hashGridMap, data.m_hashGridMapScratchBuffer); if (boxSize.m_iz > (1 << D_SPH_HASH_BITS)) { ndCountingSort<ndGridHash, ndKey_zhigh, D_SPH_HASH_BITS>(*threadPool, data.m_hashGridMap, data.m_hashGridMapScratchBuffer); } #ifdef _DEBUG for (int i = 1; i < data.m_hashGridMap.GetCount(); i++) { ndGridHash cell0(data.m_hashGridMap[i - 1]); ndGridHash cell1(data.m_hashGridMap[i + 0]); ndUnsigned64 key0 = (cell0.m_z << (D_SPH_HASH_BITS * 2)) + cell0.m_y; ndUnsigned64 key1 = (cell1.m_z << (D_SPH_HASH_BITS * 2)) + cell1.m_y; dAssert(key0 <= key1); } #endif } void ndBodySphFluid::CalculateScans(ndThreadPool* const threadPool) { D_TRACKTIME(); ndWorkingData& data = WorkingData(); ndInt32 sums[D_MAX_THREADS_COUNT + 1]; ndInt32 scans[D_MAX_THREADS_COUNT + 1]; auto CountGridScans = ndMakeObject::ndFunction([this, &data, &scans](ndInt32 threadIndex, ndInt32) { D_TRACKTIME(); const ndGridHash* const hashGridMap = &data.m_hashGridMap[0]; const ndInt32 start = scans[threadIndex]; const ndInt32 end = scans[threadIndex + 1]; ndArray<ndInt32>& gridScans = data.m_partialsGridScans[threadIndex]; ndUnsigned64 gridHash0 = hashGridMap[start].m_gridHash; ndInt32 count = 0; gridScans.SetCount(0); for (ndInt32 i = start; i < end; ++i) { ndUnsigned64 gridHash = hashGridMap[i].m_gridHash; if (gridHash != gridHash0) { gridScans.PushBack(count); count = 0; gridHash0 = gridHash; } count++; } gridScans.PushBack(count); }); auto CalculateScans = ndMakeObject::ndFunction([this, &data, &scans, &sums](ndInt32 threadIndex, ndInt32) { D_TRACKTIME(); ndArray<ndInt32>& gridScans = data.m_gridScans; const ndArray<ndInt32>& partialScan = data.m_partialsGridScans[threadIndex]; const ndInt32 base = sums[threadIndex]; ndInt32 sum = scans[threadIndex]; for (ndInt32 i = 0; i < partialScan.GetCount(); ++i) { gridScans[base + i] = sum; sum += partialScan[i]; } }); memset(scans, 0, sizeof(scans)); const ndInt32 threadCount = threadPool->GetThreadCount(); ndInt32 particleCount = data.m_hashGridMap.GetCount(); ndInt32 acc0 = 0; ndInt32 stride = particleCount / threadCount; const ndGridHash* const hashGridMap = &data.m_hashGridMap[0]; for (ndInt32 threadIndex = 0; threadIndex < threadCount; threadIndex++) { scans[threadIndex] = acc0; acc0 += stride; while (acc0 < particleCount && (hashGridMap[acc0].m_gridHash == hashGridMap[acc0 - 1].m_gridHash)) { acc0++; } } scans[threadCount] = particleCount; threadPool->ParallelExecute(CountGridScans); ndInt32 scansCount = 0; for (ndInt32 i = 0; i < threadCount; ++i) { sums[i] = scansCount; scansCount += data.m_partialsGridScans[i].GetCount(); } sums[threadCount] = scansCount; data.m_gridScans.SetCount(scansCount + 1); threadPool->ParallelExecute(CalculateScans); data.m_gridScans[scansCount] = scans[threadCount]; } void ndBodySphFluid::SortGrids(ndThreadPool* const threadPool) { D_TRACKTIME(); SortXdimension(threadPool); SortCellBuckects(threadPool); #ifdef _DEBUG ndWorkingData& data = WorkingData(); for (ndInt32 i = 0; i < (data.m_hashGridMap.GetCount() - 1); ++i) { const ndGridHash& entry0 = data.m_hashGridMap[i + 0]; const ndGridHash& entry1 = data.m_hashGridMap[i + 1]; ndUnsigned64 gridHashA = entry0.m_gridHash; ndUnsigned64 gridHashB = entry1.m_gridHash; dAssert(gridHashA <= gridHashB); } #endif } void ndBodySphFluid::BuildPairs(ndThreadPool* const threadPool) { D_TRACKTIME(); ndWorkingData& data = WorkingData(); ndInt32 countReset = data.m_locks.GetCount(); data.m_pairs.SetCount(m_posit.GetCount()); data.m_locks.SetCount(m_posit.GetCount()); data.m_pairCount.SetCount(m_posit.GetCount()); data.m_kernelDistance.SetCount(m_posit.GetCount()); for (ndInt32 i = countReset; i < data.m_locks.GetCount(); ++i) { data.m_locks[i].Unlock(); } for (ndInt32 i = 0; i < data.m_pairCount.GetCount(); ++i) { data.m_pairCount[i] = 0; } auto AddPairs = ndMakeObject::ndFunction([this, &data](ndInt32 threadIndex, ndInt32 threadCount) { D_TRACKTIME(); const ndArray<ndGridHash>& hashGridMap = data.m_hashGridMap; const ndArray<ndInt32>& gridScans = data.m_gridScans; const ndFloat32 diameter = GetSphGridSize(); const ndFloat32 diameter2 = diameter * diameter; const ndInt32 windowsTest = data.WorldToGrid(data.m_worlToGridOrigin + diameter) + 1; ndArray<ndSpinLock>& locks = data.m_locks; ndArray<ndInt8>& pairCount = data.m_pairCount; ndArray<ndParticlePair>& pair = data.m_pairs; ndArray<ndParticleKernelDistance>& distance = data.m_kernelDistance; auto ProccessCell = [this, &data, &hashGridMap, &pair, &pairCount, &locks, &distance, windowsTest, diameter2](ndInt32 start, ndInt32 count) { const ndInt32 count0 = count - 1; for (ndInt32 i = 0; i < count0; ++i) { const ndGridHash hash0 = hashGridMap[start + i]; const ndInt32 homeGridTest0 = (hash0.m_cellType == ndHomeGrid); const ndInt32 particle0 = hash0.m_particleIndex; const ndInt32 x0 = data.WorldToGrid(m_posit[particle0].m_x); for (ndInt32 j = i + 1; j < count; ++j) { const ndGridHash hash1 = hashGridMap[start + j]; const ndInt32 particle1 = hash1.m_particleIndex; dAssert(particle0 != particle1); const ndInt32 x1 = data.WorldToGrid(m_posit[particle1].m_x); dAssert((x1 - x0) > ndFloat32(-1.0e-3f)); const ndInt32 sweeptTest = ((x1 - x0) >= windowsTest); if (sweeptTest) { break; } dAssert(particle0 != particle1); const ndInt32 homeGridTest1 = (hash1.m_cellType == ndHomeGrid); const ndInt32 test = homeGridTest0 | homeGridTest1; if (test) { dAssert(particle0 != particle1); const ndVector p1p0(m_posit[particle0] - m_posit[particle1]); const ndFloat32 dist2(p1p0.DotProduct(p1p0).GetScalar()); if (dist2 < diameter2) { dAssert(dist2 >= ndFloat32(0.0f)); const ndFloat32 dist = ndSqrt(dist2); { ndSpinLock lock(locks[particle0]); ndInt8 neigborCount = pairCount[particle0]; if (neigborCount < 32) { ndInt8 isUnique = 1; ndInt32* const neighborg = pair[particle0].m_neighborg; for (ndInt32 k = neigborCount - 1; k >= 0; --k) { isUnique = isUnique & (neighborg[k] != particle1); } neighborg[neigborCount] = particle1; distance[particle0].m_dist[neigborCount] = dist; pairCount[particle0] = neigborCount + isUnique; } } { ndSpinLock lock(locks[particle1]); ndInt8 neigborCount = pairCount[particle1]; if (neigborCount < 32) { ndInt8 isUnique = 1; ndInt32* const neighborg = pair[particle1].m_neighborg; for (ndInt32 k = neigborCount - 1; k >= 0; --k) { isUnique = isUnique & (neighborg[k] != particle0); } neighborg[neigborCount] = particle0; distance[particle1].m_dist[neigborCount] = dist; pairCount[particle1] = neigborCount + isUnique; } } } } } } }; // even step is nor good because the bashes tend to be clustered // a better way is to sort, bu that takes about 1 ms, // we interleaving bashes and has the randomizing // effect that balance the work load on the thread. const ndInt32 scansCount = gridScans.GetCount() - 1; for (ndInt32 i = threadIndex; i < scansCount; i += threadCount) { const ndInt32 start = gridScans[i]; const ndInt32 count = gridScans[i + 1] - start; ProccessCell(start, count); } }); threadPool->ParallelExecute(AddPairs); } void ndBodySphFluid::CalculateParticlesDensity(ndThreadPool* const threadPool) { D_TRACKTIME(); ndWorkingData& data = WorkingData(); data.m_density.SetCount(m_posit.GetCount()); data.m_invDensity.SetCount(m_posit.GetCount()); auto CalculateDensity = ndMakeObject::ndFunction([this, &data](ndInt32 threadIndex, ndInt32 threadCount) { D_TRACKTIME(); const ndArray<ndVector>& posit = m_posit; const ndFloat32 h = GetSphGridSize(); const ndFloat32 h2 = h * h; const ndFloat32 kernelMagicConst = ndFloat32(315.0f) / (ndFloat32(64.0f) * ndPi * ndPow(h, 9)); const ndFloat32 kernelConst = m_mass * kernelMagicConst; const ndFloat32 selfDensity = kernelConst * h2 * h2 * h2; const ndStartEnd startEnd(posit.GetCount(), threadIndex, threadCount); for (ndInt32 i = startEnd.m_start; i < startEnd.m_end; ++i) { const ndInt32 count = data.m_pairCount[i]; const ndParticleKernelDistance& distance = data.m_kernelDistance[i]; ndFloat32 density = selfDensity; for (ndInt32 j = 0; j < count; ++j) { const ndFloat32 d = distance.m_dist[j]; const ndFloat32 dist2 = h2 - d * d; dAssert(dist2 > ndFloat32(0.0f)); const ndFloat32 dist6 = dist2 * dist2 * dist2; density += kernelConst * dist6; } dAssert(density > ndFloat32(0.0f)); data.m_density[i] = density; data.m_invDensity[i] = ndFloat32(1.0f) / density; } }); threadPool->ParallelExecute(CalculateDensity); } void ndBodySphFluid::CalculateAccelerations(ndThreadPool* const threadPool) { D_TRACKTIME(); ndWorkingData& data = WorkingData(); data.m_accel.SetCount(m_posit.GetCount()); auto CalculateAcceleration = ndMakeObject::ndFunction([this, &data](ndInt32 threadIndex, ndInt32 threadCount) { D_TRACKTIME(); const ndVector epsilon2 (ndFloat32(1.0e-12f)); const ndArray<ndVector>& veloc = m_veloc; const ndArray<ndVector>& posit = m_posit; const ndFloat32* const density = &data.m_density[0]; const ndFloat32* const invDensity = &data.m_invDensity[0]; const ndFloat32 h = GetSphGridSize(); const ndFloat32 u = m_viscosity; const ndVector kernelConst(m_mass * ndFloat32(45.0f) / (ndPi * ndPow(h, 6))); const ndFloat32 viscosity = m_viscosity; const ndFloat32 restDensity = m_restDensity; const ndFloat32 gasConstant = ndFloat32(0.5f) * m_gasConstant; const ndVector gravity(m_gravity); const ndStartEnd startEnd(posit.GetCount(), threadIndex, threadCount); for (ndInt32 i0 = startEnd.m_start; i0 < startEnd.m_end; ++i0) { const ndVector p0(posit[i0]); const ndVector v0(veloc[i0]); const ndInt32 count = data.m_pairCount[i0]; const ndParticlePair& pairs = data.m_pairs[i0]; ndParticleKernelDistance& distance = data.m_kernelDistance[i0]; const ndFloat32 pressureI0 = density[i0] - restDensity; ndVector forceAcc(ndVector::m_zero); for (ndInt32 j = 0; j < count; ++j) { const ndInt32 i1 = pairs.m_neighborg[j]; const ndVector p10(posit[i1] - p0); const ndVector dot(p10.DotProduct(p10) + epsilon2); const ndVector unitDir(p10 * dot.InvSqrt()); dAssert(unitDir.m_w == ndFloat32(0.0f)); // kernel distance const ndFloat32 dist = distance.m_dist[j]; const ndFloat32 kernelDist = h - dist; dAssert(kernelDist >= ndFloat32(0.0f)); // calculate pressure const ndFloat32 kernelDist2 = kernelDist * kernelDist; const ndFloat32 pressureI1 = density[i1] - restDensity; const ndVector force(gasConstant * kernelDist2 * invDensity[i1] * (pressureI0 + pressureI1)); forceAcc += force * unitDir; // calculate viscosity acceleration const ndVector v01(veloc[i1] - v0); forceAcc += v01 * ndVector(kernelDist * viscosity * invDensity[j]); } const ndVector accel(gravity + ndVector(invDensity[i0]) * kernelConst * forceAcc); data.m_accel[i0] = accel; } }); threadPool->ParallelExecute(CalculateAcceleration); } void ndBodySphFluid::IntegrateParticles(ndThreadPool* const threadPool) { D_TRACKTIME(); ndWorkingData& data = WorkingData(); auto IntegrateParticles = ndMakeObject::ndFunction([this, &data](ndInt32 threadIndex, ndInt32 threadCount) { D_TRACKTIME(); const ndArray<ndVector>& accel = data.m_accel; ndArray<ndVector>& veloc = m_veloc; ndArray<ndVector>& posit = m_posit; //const ndVector timestep(m_timestep); //ndVector halfTime(timestep * ndVector::m_half); const ndVector timestep (ndFloat32 (0.003f)); const ndStartEnd startEnd(posit.GetCount(), threadIndex, threadCount); for (ndInt32 i = startEnd.m_start; i < startEnd.m_end; ++i) { veloc[i] = veloc[i] + accel[i] * timestep; posit[i] = posit[i] + veloc[i] * timestep; if (posit[i].m_y <= 1.0f) { posit[i].m_y = 1.0f; veloc[i].m_y = 0.0f; } } }); threadPool->ParallelExecute(IntegrateParticles); } void ndBodySphFluid::CaculateAabb(ndThreadPool* const threadPool) { D_TRACKTIME(); class ndBox { public: ndBox() :m_min(ndFloat32(1.0e10f)) , m_max(ndFloat32(-1.0e10f)) { } ndVector m_min; ndVector m_max; }; ndBox boxes[D_MAX_THREADS_COUNT]; auto CalculateAabb = ndMakeObject::ndFunction([this, &boxes](ndInt32 threadIndex, ndInt32 threadCount) { D_TRACKTIME(); ndBox box; const ndArray<ndVector>& posit = m_posit; const ndStartEnd startEnd(posit.GetCount(), threadIndex, threadCount); for (ndInt32 i = startEnd.m_start; i < startEnd.m_end; ++i) { box.m_min = box.m_min.GetMin(posit[i]); box.m_max = box.m_max.GetMax(posit[i]); } boxes[threadIndex] = box; }); threadPool->ParallelExecute(CalculateAabb); ndBox box; const ndInt32 threadCount = threadPool->GetThreadCount(); for (ndInt32 i = 0; i < threadCount; ++i) { box.m_min = box.m_min.GetMin(boxes[i].m_min); box.m_max = box.m_max.GetMax(boxes[i].m_max); } const ndFloat32 gridSize = GetSphGridSize(); ndVector grid(gridSize); ndVector invGrid(ndFloat32(1.0f) / gridSize); // add one grid padding to the aabb box.m_min -= grid; box.m_max += (grid + grid); // quantize the aabb to integers of the gird size box.m_min = grid * (box.m_min * invGrid).Floor(); box.m_max = grid * (box.m_max * invGrid).Floor(); // make sure the w component is zero. m_box0 = box.m_min & ndVector::m_triplexMask; m_box1 = box.m_max & ndVector::m_triplexMask; ndWorkingData& data = WorkingData(); ndInt32 numberOfGrid = ndInt32((box.m_max.m_x - box.m_min.m_x) * invGrid.m_x + ndFloat32(1.0f)); data.SetWorldToGridMapping(numberOfGrid, m_box1.m_x, m_box0.m_x); } void ndBodySphFluid::CreateGrids(ndThreadPool* const threadPool) { D_TRACKTIME(); class ndGridNeighborInfo { public: ndGridNeighborInfo() { //ndGridHash stepsCode; m_neighborDirs[0][0] = ndGridHash(0, 0); m_neighborDirs[0][1] = ndGridHash(0, 0); m_neighborDirs[0][2] = ndGridHash(0, 0); m_neighborDirs[0][3] = ndGridHash(0, 0); m_counter[0] = 1; m_isPadd[0][0] = 0; m_isPadd[0][1] = 1; m_isPadd[0][2] = 1; m_isPadd[0][3] = 1; ndGridHash stepsCode_y; m_neighborDirs[1][0] = ndGridHash(0, 0); m_neighborDirs[1][1] = ndGridHash(1, 0); m_neighborDirs[1][2] = ndGridHash(0, 0); m_neighborDirs[1][3] = ndGridHash(0, 0); m_counter[1] = 2; m_isPadd[1][0] = 0; m_isPadd[1][1] = 0; m_isPadd[1][2] = 1; m_isPadd[1][3] = 1; //ndGridHash stepsCode_z; m_neighborDirs[2][0] = ndGridHash(0, 0); m_neighborDirs[2][1] = ndGridHash(0, 1); m_neighborDirs[2][2] = ndGridHash(0, 0); m_neighborDirs[2][3] = ndGridHash(0, 0); m_counter[2] = 2; m_isPadd[2][0] = 0; m_isPadd[2][1] = 0; m_isPadd[2][2] = 1; m_isPadd[2][3] = 1; //ndGridHash stepsCode_yz; m_neighborDirs[3][0] = ndGridHash(0, 0); m_neighborDirs[3][1] = ndGridHash(1, 0); m_neighborDirs[3][2] = ndGridHash(0, 1); m_neighborDirs[3][3] = ndGridHash(1, 1); m_counter[3] = 4; m_isPadd[3][0] = 0; m_isPadd[3][1] = 0; m_isPadd[3][2] = 0; m_isPadd[3][3] = 0; } ndGridHash m_neighborDirs[4][4]; ndInt8 m_isPadd[4][4]; ndInt8 m_counter[4]; }; ndGridNeighborInfo neiborghood; ndWorkingData& data = WorkingData(); auto CountGrids = ndMakeObject::ndFunction([this, &data, &neiborghood](ndInt32 threadIndex, ndInt32 threadCount) { D_TRACKTIME(); const ndVector origin(m_box0); const ndFloat32 gridSize = GetSphGridSize(); const ndVector box(gridSize * ndFloat32(0.5f * 0.99f)); const ndVector invGridSize(ndFloat32(1.0f) / gridSize); const ndVector* const posit = &m_posit[0]; ndInt32* const scans = &data.m_gridScans[0]; const ndStartEnd startEnd(m_posit.GetCount(), threadIndex, threadCount); for (ndInt32 i = startEnd.m_start; i < startEnd.m_end; ++i) { const ndVector r(posit[i] - origin); const ndVector p(r * invGridSize); const ndGridHash hashKey(p, i); const ndVector p0((r - box) * invGridSize); const ndVector p1((r + box) * invGridSize); ndGridHash box0Hash(p0, i); const ndGridHash box1Hash(p1, i); const ndGridHash codeHash(box1Hash.m_gridHash - box0Hash.m_gridHash); dAssert(codeHash.m_y <= 1); dAssert(codeHash.m_z <= 1); const ndUnsigned32 code = ndUnsigned32(codeHash.m_z * 2 + codeHash.m_y); scans[i] = neiborghood.m_counter[code]; } }); auto CreateGrids = ndMakeObject::ndFunction([this, &data, &neiborghood](ndInt32 threadIndex, ndInt32 threadCount) { D_TRACKTIME(); const ndVector origin(m_box0); const ndFloat32 gridSize = GetSphGridSize(); ndGridHash* const dst = &data.m_hashGridMap[0]; const ndInt32* const scans = &data.m_gridScans[0]; // the 0.99 factor is to make sure the box // fits in not more than two adjacent grids. const ndVector box(gridSize * ndFloat32(0.5f * 0.99f)); const ndVector invGridSize(ndFloat32(1.0f) / gridSize); const ndVector* const posit = &m_posit[0]; const ndStartEnd startEnd(m_posit.GetCount(), threadIndex, threadCount); for (ndInt32 i = startEnd.m_start; i < startEnd.m_end; ++i) { const ndVector r(posit[i] - origin); const ndVector p(r * invGridSize); const ndGridHash hashKey(p, i); const ndVector p0((r - box) * invGridSize); const ndVector p1((r + box) * invGridSize); ndGridHash box0Hash(p0, i); const ndGridHash box1Hash(p1, i); const ndGridHash codeHash(box1Hash.m_gridHash - box0Hash.m_gridHash); dAssert(codeHash.m_y <= 1); dAssert(codeHash.m_z <= 1); const ndUnsigned32 code = ndUnsigned32(codeHash.m_z * 2 + codeHash.m_y); const ndInt32 base = scans[i]; const ndInt32 count = scans[i + 1] - base; const ndGridHash* const neigborgh = &neiborghood.m_neighborDirs[code][0]; for (ndInt32 j = 0; j < count; ++ j) { ndGridHash quadrand(box0Hash); quadrand.m_gridHash += neigborgh[j].m_gridHash; quadrand.m_cellType = ndGridType(quadrand.m_gridHash == hashKey.m_gridHash); dAssert(quadrand.m_cellType == ((quadrand.m_gridHash == hashKey.m_gridHash) ? ndHomeGrid : ndAdjacentGrid)); dst[base + j] = quadrand; } } }); dAssert(sizeof(ndGridHash) <= 16); data.m_gridScans.SetCount(m_posit.GetCount() + 1); data.m_gridScans[m_posit.GetCount()] = 0; threadPool->ParallelExecute(CountGrids); ndInt32 gridCount = 0; for (ndInt32 i = 0; i < data.m_gridScans.GetCount(); i++) { ndInt32 count = data.m_gridScans[i]; data.m_gridScans[i] = gridCount; gridCount += count; } data.m_hashGridMap.SetCount(gridCount); threadPool->ParallelExecute(CreateGrids); data.m_hashGridMapScratchBuffer.SetCount(gridCount); } void ndBodySphFluid::Execute(ndThreadPool* const threadPool) { D_TRACKTIME(); dAssert(sizeof(ndGridHash) == sizeof(ndUnsigned64)); CaculateAabb(threadPool); CreateGrids(threadPool); SortGrids(threadPool); CalculateScans(threadPool); BuildPairs(threadPool); CalculateParticlesDensity(threadPool); CalculateAccelerations(threadPool); IntegrateParticles(threadPool); } void ndBodySphFluid::Update(const ndWorld* const world, ndFloat32 timestep) { if (taskState() == ndBackgroundTask::m_taskCompleted) { m_timestep = timestep; ndScene* const scene = world->GetScene(); scene->SendBackgroundTask(this); if (!m_updateInBackground) { Sync(); } } }
29.182002
141
0.707183
Libertus-Lab
942047a1383b606f3bb2c82178db3e5281231381
1,546
hpp
C++
src/09-OpenCV-Video-Template/mat_viewer.hpp
m516/CV-Sandbox
c22630e56c2989bb53e346ea4ada8d4fe45dfe82
[ "MIT" ]
6
2020-07-31T22:28:36.000Z
2021-10-04T10:04:24.000Z
src/09-OpenCV-Video-Template/mat_viewer.hpp
m516/CV-Sandbox
c22630e56c2989bb53e346ea4ada8d4fe45dfe82
[ "MIT" ]
1
2020-11-18T08:43:34.000Z
2021-02-05T17:29:02.000Z
src/09-OpenCV-Video-Template/mat_viewer.hpp
m516/CV-Sandbox
c22630e56c2989bb53e346ea4ada8d4fe45dfe82
[ "MIT" ]
null
null
null
#pragma once #include <opencv2/opencv.hpp> #include <glad/glad.h> #include <GLFW/glfw3.h> using namespace cv; using namespace std; class MatViewer { public: /*Creates an empty MatViewer*/ MatViewer(){} /*Creates a new MatViewer that binds to a Mat*/ MatViewer(std::string name, Mat& mat); /*Destroys a MatViewer*/ ~MatViewer(); /* Uses ImGui to render an image preview. The first parameter, withControls, adds display controls like the apparent size of the image on the display. The second parameter, withTooltip, adds a tooltip that magnifies a part of the image when hovered */ void addToGUI(bool withControls = true, bool withTooltip = true); /*Gets a reference to the current Mat that this renders*/ Mat* getMat() { return mat; } /*Updates the OpenGL texture*/ void update(); /*Gets the dimensions of this Mat and places them in width and height*/ void getDimensions(int* width, int* height) { *width = this->width; *height = this->height; }; /**/ bool initialized() { return textureID > 0 && width > 0 && height > 0; } private: Mat* mat = nullptr; GLuint textureID = 0; std::string name; int width = 0, height = 0; float imageScale = 1; /*A helper function to create the texture*/ void generateTexture(); /*A helper function to reload an existing texture*/ void reloadTexture(); /*A helper function to create the texture from a Mat. Returns the texture ID*/ GLuint matToTexture(const cv::Mat& mat); };
30.92
101
0.666882
m516
9420ea738bac4733be3fcbc985c4c52e585e2a93
37,587
hpp
C++
2 - MaxPooled Net/3 - SCAMP5 implementation/fc_weights.hpp
brouwa/CNNs-on-FPSPs
71bcc2335e6d71ad21ba66e04a651d4db218356d
[ "MIT" ]
1
2021-02-23T21:53:30.000Z
2021-02-23T21:53:30.000Z
2 - MaxPooled Net/3 - SCAMP5 implementation/fc_weights.hpp
brouwa/CNNs-on-FPSPs
71bcc2335e6d71ad21ba66e04a651d4db218356d
[ "MIT" ]
1
2020-11-13T19:08:27.000Z
2020-11-13T19:08:27.000Z
2 - MaxPooled Net/3 - SCAMP5 implementation/fc_weights.hpp
brouwa/CNNs-on-FPSPs
71bcc2335e6d71ad21ba66e04a651d4db218356d
[ "MIT" ]
1
2021-03-04T10:17:01.000Z
2021-03-04T10:17:01.000Z
/* * fc_weights.hpp * * Created on: Jul 4, 2019 * Author: Benoît GUILLARD */ #ifndef FC_WEIGHTS_HPP_ #define FC_WEIGHTS_HPP_ // Re-trained fully connected weight values inline void fc_1(int in[32], int out[50]){ out[0] = in[0]*(-76) + in[1]*(14) + in[2]*(125) + in[3]*(-20) + in[4]*(-11) + in[5]*(8) + in[6]*(3) + in[7]*(4) + in[8]*(-95) + in[9]*(22) + in[10]*(25) + in[11]*(27) + in[12]*(-50) + in[13]*(-28) + in[14]*(22) + in[15]*(32) + in[16]*(-20) + in[17]*(31) + in[18]*(-184) + in[19]*(206) + in[20]*(-35) + in[21]*(10) + in[22]*(-35) + in[23]*(-92) + in[24]*(-21) + in[25]*(-64) + in[26]*(52) + in[27]*(-85) + in[28]*(32) + in[29]*(14) + in[30]*(6) + in[31]*(59) + (-113); out[1] = in[0]*(20) + in[1]*(-17) + in[2]*(-11) + in[3]*(-65) + in[4]*(-66) + in[5]*(-24) + in[6]*(11) + in[7]*(-4) + in[8]*(-145) + in[9]*(44) + in[10]*(-56) + in[11]*(-21) + in[12]*(-332) + in[13]*(-100) + in[14]*(47) + in[15]*(83) + in[16]*(-21) + in[17]*(12) + in[18]*(33) + in[19]*(-71) + in[20]*(67) + in[21]*(-1) + in[22]*(105) + in[23]*(29) + in[24]*(11) + in[25]*(15) + in[26]*(-28) + in[27]*(1) + in[28]*(-29) + in[29]*(20) + in[30]*(-11) + in[31]*(44) + (-5); out[2] = in[0]*(21) + in[1]*(-13) + in[2]*(16) + in[3]*(-8) + in[4]*(-21) + in[5]*(-24) + in[6]*(10) + in[7]*(-21) + in[8]*(-8) + in[9]*(-11) + in[10]*(10) + in[11]*(-9) + in[12]*(-23) + in[13]*(-7) + in[14]*(-26) + in[15]*(-6) + in[16]*(-15) + in[17]*(1) + in[18]*(-3) + in[19]*(-20) + in[20]*(3) + in[21]*(-23) + in[22]*(-7) + in[23]*(-19) + in[24]*(8) + in[25]*(-11) + in[26]*(24) + in[27]*(14) + in[28]*(-25) + in[29]*(12) + in[30]*(-27) + in[31]*(-6) + (0); out[3] = in[0]*(-85) + in[1]*(7) + in[2]*(12) + in[3]*(-21) + in[4]*(-262) + in[5]*(49) + in[6]*(4) + in[7]*(-23) + in[8]*(-52) + in[9]*(-15) + in[10]*(6) + in[11]*(20) + in[12]*(41) + in[13]*(32) + in[14]*(57) + in[15]*(-31) + in[16]*(54) + in[17]*(1) + in[18]*(-245) + in[19]*(26) + in[20]*(27) + in[21]*(-59) + in[22]*(75) + in[23]*(-126) + in[24]*(70) + in[25]*(-42) + in[26]*(-98) + in[27]*(-9) + in[28]*(44) + in[29]*(-12) + in[30]*(-44) + in[31]*(26) + (248); out[4] = in[0]*(-184) + in[1]*(8) + in[2]*(61) + in[3]*(-47) + in[4]*(111) + in[5]*(-6) + in[6]*(-118) + in[7]*(-11) + in[8]*(151) + in[9]*(45) + in[10]*(88) + in[11]*(-28) + in[12]*(-66) + in[13]*(33) + in[14]*(-57) + in[15]*(-5) + in[16]*(-28) + in[17]*(32) + in[18]*(17) + in[19]*(0) + in[20]*(40) + in[21]*(41) + in[22]*(70) + in[23]*(79) + in[24]*(-24) + in[25]*(-20) + in[26]*(35) + in[27]*(34) + in[28]*(17) + in[29]*(0) + in[30]*(51) + in[31]*(-65) + (-201); out[5] = in[0]*(-153) + in[1]*(54) + in[2]*(81) + in[3]*(3) + in[4]*(90) + in[5]*(5) + in[6]*(53) + in[7]*(-15) + in[8]*(-190) + in[9]*(-96) + in[10]*(-106) + in[11]*(26) + in[12]*(217) + in[13]*(-9) + in[14]*(63) + in[15]*(-71) + in[16]*(29) + in[17]*(11) + in[18]*(18) + in[19]*(-53) + in[20]*(56) + in[21]*(-13) + in[22]*(49) + in[23]*(-21) + in[24]*(-10) + in[25]*(-43) + in[26]*(89) + in[27]*(-163) + in[28]*(-67) + in[29]*(13) + in[30]*(-29) + in[31]*(65) + (-32); out[6] = in[0]*(-12) + in[1]*(-7) + in[2]*(-101) + in[3]*(-3) + in[4]*(-230) + in[5]*(18) + in[6]*(-212) + in[7]*(-18) + in[8]*(-23) + in[9]*(34) + in[10]*(155) + in[11]*(-25) + in[12]*(59) + in[13]*(-14) + in[14]*(-40) + in[15]*(53) + in[16]*(4) + in[17]*(5) + in[18]*(-123) + in[19]*(-93) + in[20]*(62) + in[21]*(-25) + in[22]*(78) + in[23]*(26) + in[24]*(14) + in[25]*(-35) + in[26]*(115) + in[27]*(-50) + in[28]*(13) + in[29]*(-7) + in[30]*(-30) + in[31]*(7) + (148); out[7] = in[0]*(36) + in[1]*(20) + in[2]*(-27) + in[3]*(24) + in[4]*(129) + in[5]*(-2) + in[6]*(22) + in[7]*(2) + in[8]*(-118) + in[9]*(61) + in[10]*(-297) + in[11]*(-64) + in[12]*(119) + in[13]*(17) + in[14]*(6) + in[15]*(8) + in[16]*(33) + in[17]*(-11) + in[18]*(-14) + in[19]*(-3) + in[20]*(1) + in[21]*(-15) + in[22]*(32) + in[23]*(-98) + in[24]*(23) + in[25]*(38) + in[26]*(-76) + in[27]*(-43) + in[28]*(0) + in[29]*(-15) + in[30]*(25) + in[31]*(56) + (-7); out[8] = in[0]*(10) + in[1]*(50) + in[2]*(92) + in[3]*(20) + in[4]*(-103) + in[5]*(8) + in[6]*(-13) + in[7]*(1) + in[8]*(-103) + in[9]*(35) + in[10]*(-88) + in[11]*(3) + in[12]*(25) + in[13]*(-14) + in[14]*(-9) + in[15]*(-61) + in[16]*(-3) + in[17]*(16) + in[18]*(157) + in[19]*(65) + in[20]*(86) + in[21]*(-22) + in[22]*(15) + in[23]*(25) + in[24]*(16) + in[25]*(32) + in[26]*(9) + in[27]*(-111) + in[28]*(-4) + in[29]*(-3) + in[30]*(40) + in[31]*(105) + (-292); out[9] = in[0]*(-54) + in[1]*(-14) + in[2]*(-6) + in[3]*(-21) + in[4]*(-55) + in[5]*(-6) + in[6]*(10) + in[7]*(-1) + in[8]*(-53) + in[9]*(13) + in[10]*(182) + in[11]*(5) + in[12]*(-76) + in[13]*(-44) + in[14]*(-38) + in[15]*(0) + in[16]*(-2) + in[17]*(17) + in[18]*(106) + in[19]*(25) + in[20]*(-50) + in[21]*(-18) + in[22]*(-12) + in[23]*(4) + in[24]*(-18) + in[25]*(-48) + in[26]*(54) + in[27]*(-71) + in[28]*(34) + in[29]*(45) + in[30]*(3) + in[31]*(54) + (270); out[10] = in[0]*(-121) + in[1]*(-36) + in[2]*(-137) + in[3]*(-33) + in[4]*(-64) + in[5]*(31) + in[6]*(40) + in[7]*(44) + in[8]*(-124) + in[9]*(0) + in[10]*(10) + in[11]*(36) + in[12]*(-79) + in[13]*(29) + in[14]*(-10) + in[15]*(-23) + in[16]*(-62) + in[17]*(29) + in[18]*(-325) + in[19]*(-130) + in[20]*(17) + in[21]*(18) + in[22]*(-9) + in[23]*(16) + in[24]*(12) + in[25]*(0) + in[26]*(-33) + in[27]*(59) + in[28]*(35) + in[29]*(-58) + in[30]*(13) + in[31]*(3) + (92); out[11] = in[0]*(53) + in[1]*(74) + in[2]*(92) + in[3]*(-4) + in[4]*(-21) + in[5]*(-46) + in[6]*(-107) + in[7]*(1) + in[8]*(-174) + in[9]*(33) + in[10]*(-12) + in[11]*(22) + in[12]*(41) + in[13]*(18) + in[14]*(-40) + in[15]*(-31) + in[16]*(-9) + in[17]*(-30) + in[18]*(-60) + in[19]*(8) + in[20]*(-86) + in[21]*(50) + in[22]*(16) + in[23]*(-52) + in[24]*(-5) + in[25]*(21) + in[26]*(0) + in[27]*(28) + in[28]*(85) + in[29]*(-58) + in[30]*(37) + in[31]*(-3) + (39); out[12] = in[0]*(-59) + in[1]*(16) + in[2]*(-1) + in[3]*(-8) + in[4]*(-48) + in[5]*(17) + in[6]*(63) + in[7]*(-21) + in[8]*(-94) + in[9]*(-14) + in[10]*(-68) + in[11]*(1) + in[12]*(121) + in[13]*(72) + in[14]*(-104) + in[15]*(-5) + in[16]*(7) + in[17]*(-3) + in[18]*(-232) + in[19]*(-19) + in[20]*(62) + in[21]*(-20) + in[22]*(-93) + in[23]*(18) + in[24]*(53) + in[25]*(-11) + in[26]*(-93) + in[27]*(-38) + in[28]*(-1) + in[29]*(53) + in[30]*(-18) + in[31]*(-11) + (162); out[13] = in[0]*(27) + in[1]*(12) + in[2]*(-11) + in[3]*(-10) + in[4]*(10) + in[5]*(17) + in[6]*(-15) + in[7]*(22) + in[8]*(9) + in[9]*(-19) + in[10]*(13) + in[11]*(-3) + in[12]*(10) + in[13]*(-20) + in[14]*(-19) + in[15]*(-26) + in[16]*(11) + in[17]*(-7) + in[18]*(-27) + in[19]*(6) + in[20]*(8) + in[21]*(-23) + in[22]*(17) + in[23]*(5) + in[24]*(-17) + in[25]*(-25) + in[26]*(22) + in[27]*(-12) + in[28]*(-21) + in[29]*(-12) + in[30]*(-8) + in[31]*(23) + (0); out[14] = in[0]*(84) + in[1]*(-25) + in[2]*(77) + in[3]*(15) + in[4]*(26) + in[5]*(17) + in[6]*(48) + in[7]*(-39) + in[8]*(23) + in[9]*(-19) + in[10]*(-105) + in[11]*(-15) + in[12]*(43) + in[13]*(8) + in[14]*(55) + in[15]*(29) + in[16]*(8) + in[17]*(-7) + in[18]*(-461) + in[19]*(53) + in[20]*(-35) + in[21]*(15) + in[22]*(-3) + in[23]*(-27) + in[24]*(-8) + in[25]*(2) + in[26]*(41) + in[27]*(117) + in[28]*(16) + in[29]*(-45) + in[30]*(-29) + in[31]*(-12) + (250); out[15] = in[0]*(37) + in[1]*(105) + in[2]*(-28) + in[3]*(5) + in[4]*(-229) + in[5]*(6) + in[6]*(63) + in[7]*(-20) + in[8]*(56) + in[9]*(-22) + in[10]*(-19) + in[11]*(-33) + in[12]*(18) + in[13]*(4) + in[14]*(4) + in[15]*(-26) + in[16]*(41) + in[17]*(-1) + in[18]*(15) + in[19]*(-66) + in[20]*(-23) + in[21]*(15) + in[22]*(-64) + in[23]*(12) + in[24]*(9) + in[25]*(-15) + in[26]*(-11) + in[27]*(-177) + in[28]*(6) + in[29]*(15) + in[30]*(-75) + in[31]*(-32) + (49); out[16] = in[0]*(-24) + in[1]*(14) + in[2]*(-3) + in[3]*(-29) + in[4]*(12) + in[5]*(-12) + in[6]*(10) + in[7]*(-10) + in[8]*(-24) + in[9]*(-15) + in[10]*(7) + in[11]*(23) + in[12]*(-9) + in[13]*(-28) + in[14]*(-10) + in[15]*(-19) + in[16]*(4) + in[17]*(-12) + in[18]*(20) + in[19]*(2) + in[20]*(-28) + in[21]*(-25) + in[22]*(-4) + in[23]*(-5) + in[24]*(-12) + in[25]*(13) + in[26]*(8) + in[27]*(11) + in[28]*(20) + in[29]*(-11) + in[30]*(-9) + in[31]*(21) + (-2); out[17] = in[0]*(-55) + in[1]*(-19) + in[2]*(-144) + in[3]*(20) + in[4]*(-2) + in[5]*(-58) + in[6]*(76) + in[7]*(-90) + in[8]*(39) + in[9]*(13) + in[10]*(23) + in[11]*(-10) + in[12]*(25) + in[13]*(71) + in[14]*(-13) + in[15]*(-21) + in[16]*(3) + in[17]*(18) + in[18]*(-3) + in[19]*(1) + in[20]*(38) + in[21]*(-32) + in[22]*(101) + in[23]*(225) + in[24]*(-32) + in[25]*(-8) + in[26]*(55) + in[27]*(74) + in[28]*(-5) + in[29]*(23) + in[30]*(7) + in[31]*(-163) + (42); out[18] = in[0]*(72) + in[1]*(-3) + in[2]*(15) + in[3]*(-24) + in[4]*(-63) + in[5]*(-23) + in[6]*(-21) + in[7]*(24) + in[8]*(-26) + in[9]*(-2) + in[10]*(80) + in[11]*(-15) + in[12]*(-129) + in[13]*(-50) + in[14]*(111) + in[15]*(45) + in[16]*(6) + in[17]*(16) + in[18]*(-77) + in[19]*(25) + in[20]*(9) + in[21]*(-17) + in[22]*(-1) + in[23]*(-70) + in[24]*(2) + in[25]*(-20) + in[26]*(-10) + in[27]*(-29) + in[28]*(5) + in[29]*(-38) + in[30]*(31) + in[31]*(-42) + (328); out[19] = in[0]*(56) + in[1]*(-42) + in[2]*(-134) + in[3]*(25) + in[4]*(-214) + in[5]*(35) + in[6]*(14) + in[7]*(16) + in[8]*(-204) + in[9]*(27) + in[10]*(-21) + in[11]*(-11) + in[12]*(-233) + in[13]*(18) + in[14]*(2) + in[15]*(42) + in[16]*(-11) + in[17]*(-34) + in[18]*(-176) + in[19]*(15) + in[20]*(159) + in[21]*(0) + in[22]*(113) + in[23]*(178) + in[24]*(-8) + in[25]*(-7) + in[26]*(19) + in[27]*(42) + in[28]*(21) + in[29]*(-44) + in[30]*(13) + in[31]*(-73) + (33); out[20] = in[0]*(183) + in[1]*(-28) + in[2]*(-68) + in[3]*(8) + in[4]*(-125) + in[5]*(71) + in[6]*(-12) + in[7]*(58) + in[8]*(-42) + in[9]*(-170) + in[10]*(-3) + in[11]*(46) + in[12]*(-106) + in[13]*(45) + in[14]*(-14) + in[15]*(-9) + in[16]*(-3) + in[17]*(-32) + in[18]*(-254) + in[19]*(97) + in[20]*(-1) + in[21]*(-46) + in[22]*(60) + in[23]*(34) + in[24]*(-28) + in[25]*(-2) + in[26]*(-34) + in[27]*(1) + in[28]*(12) + in[29]*(-53) + in[30]*(7) + in[31]*(48) + (103); out[21] = in[0]*(-26) + in[1]*(34) + in[2]*(2) + in[3]*(7) + in[4]*(-350) + in[5]*(47) + in[6]*(-10) + in[7]*(15) + in[8]*(194) + in[9]*(46) + in[10]*(-37) + in[11]*(-15) + in[12]*(-121) + in[13]*(-69) + in[14]*(56) + in[15]*(-9) + in[16]*(-26) + in[17]*(-11) + in[18]*(15) + in[19]*(-121) + in[20]*(43) + in[21]*(16) + in[22]*(-76) + in[23]*(-29) + in[24]*(-54) + in[25]*(7) + in[26]*(15) + in[27]*(72) + in[28]*(-17) + in[29]*(22) + in[30]*(-53) + in[31]*(15) + (-115); out[22] = in[0]*(-51) + in[1]*(33) + in[2]*(47) + in[3]*(-35) + in[4]*(-145) + in[5]*(19) + in[6]*(-39) + in[7]*(46) + in[8]*(16) + in[9]*(-12) + in[10]*(-15) + in[11]*(-51) + in[12]*(23) + in[13]*(-7) + in[14]*(50) + in[15]*(45) + in[16]*(9) + in[17]*(-20) + in[18]*(-148) + in[19]*(1) + in[20]*(45) + in[21]*(33) + in[22]*(93) + in[23]*(-20) + in[24]*(14) + in[25]*(40) + in[26]*(24) + in[27]*(16) + in[28]*(-68) + in[29]*(18) + in[30]*(-96) + in[31]*(-81) + (-97); out[23] = in[0]*(55) + in[1]*(29) + in[2]*(61) + in[3]*(41) + in[4]*(-21) + in[5]*(8) + in[6]*(-9) + in[7]*(-6) + in[8]*(56) + in[9]*(-6) + in[10]*(-20) + in[11]*(34) + in[12]*(-8) + in[13]*(-18) + in[14]*(32) + in[15]*(-45) + in[16]*(0) + in[17]*(-3) + in[18]*(104) + in[19]*(-5) + in[20]*(75) + in[21]*(-59) + in[22]*(-62) + in[23]*(113) + in[24]*(30) + in[25]*(11) + in[26]*(-95) + in[27]*(-147) + in[28]*(-6) + in[29]*(-26) + in[30]*(-28) + in[31]*(211) + (106); out[24] = in[0]*(-28) + in[1]*(4) + in[2]*(-53) + in[3]*(-13) + in[4]*(52) + in[5]*(-10) + in[6]*(-8) + in[7]*(-35) + in[8]*(90) + in[9]*(-53) + in[10]*(109) + in[11]*(16) + in[12]*(31) + in[13]*(36) + in[14]*(-9) + in[15]*(30) + in[16]*(-1) + in[17]*(11) + in[18]*(79) + in[19]*(41) + in[20]*(-229) + in[21]*(29) + in[22]*(-28) + in[23]*(56) + in[24]*(-48) + in[25]*(-13) + in[26]*(57) + in[27]*(116) + in[28]*(16) + in[29]*(17) + in[30]*(-25) + in[31]*(-51) + (-7); out[25] = in[0]*(-415) + in[1]*(34) + in[2]*(-182) + in[3]*(-32) + in[4]*(18) + in[5]*(0) + in[6]*(7) + in[7]*(69) + in[8]*(-16) + in[9]*(21) + in[10]*(-8) + in[11]*(-9) + in[12]*(-24) + in[13]*(-5) + in[14]*(8) + in[15]*(-17) + in[16]*(-29) + in[17]*(-34) + in[18]*(-60) + in[19]*(-72) + in[20]*(72) + in[21]*(11) + in[22]*(-12) + in[23]*(-37) + in[24]*(-15) + in[25]*(-6) + in[26]*(60) + in[27]*(-139) + in[28]*(33) + in[29]*(21) + in[30]*(-46) + in[31]*(-125) + (378); out[26] = in[0]*(2) + in[1]*(-6) + in[2]*(4) + in[3]*(-4) + in[4]*(5) + in[5]*(-3) + in[6]*(-24) + in[7]*(-30) + in[8]*(21) + in[9]*(-21) + in[10]*(16) + in[11]*(8) + in[12]*(-22) + in[13]*(0) + in[14]*(7) + in[15]*(1) + in[16]*(-7) + in[17]*(-8) + in[18]*(1) + in[19]*(2) + in[20]*(-26) + in[21]*(-20) + in[22]*(7) + in[23]*(20) + in[24]*(-9) + in[25]*(0) + in[26]*(-22) + in[27]*(6) + in[28]*(23) + in[29]*(0) + in[30]*(-15) + in[31]*(7) + (-5); out[27] = in[0]*(15) + in[1]*(57) + in[2]*(47) + in[3]*(-3) + in[4]*(28) + in[5]*(72) + in[6]*(33) + in[7]*(30) + in[8]*(-173) + in[9]*(12) + in[10]*(-13) + in[11]*(-30) + in[12]*(153) + in[13]*(-33) + in[14]*(-32) + in[15]*(4) + in[16]*(-3) + in[17]*(-24) + in[18]*(-47) + in[19]*(73) + in[20]*(123) + in[21]*(-40) + in[22]*(-112) + in[23]*(-10) + in[24]*(18) + in[25]*(22) + in[26]*(-31) + in[27]*(127) + in[28]*(50) + in[29]*(27) + in[30]*(-56) + in[31]*(-171) + (156); out[28] = in[0]*(-33) + in[1]*(4) + in[2]*(-99) + in[3]*(18) + in[4]*(-59) + in[5]*(17) + in[6]*(23) + in[7]*(-69) + in[8]*(70) + in[9]*(9) + in[10]*(-147) + in[11]*(-31) + in[12]*(-18) + in[13]*(8) + in[14]*(-28) + in[15]*(-62) + in[16]*(-28) + in[17]*(-13) + in[18]*(223) + in[19]*(-57) + in[20]*(13) + in[21]*(-21) + in[22]*(84) + in[23]*(33) + in[24]*(-78) + in[25]*(33) + in[26]*(126) + in[27]*(-14) + in[28]*(-21) + in[29]*(0) + in[30]*(55) + in[31]*(-27) + (240); out[29] = in[0]*(-229) + in[1]*(55) + in[2]*(-19) + in[3]*(-8) + in[4]*(-9) + in[5]*(-8) + in[6]*(26) + in[7]*(-7) + in[8]*(-118) + in[9]*(56) + in[10]*(27) + in[11]*(-10) + in[12]*(76) + in[13]*(25) + in[14]*(-3) + in[15]*(54) + in[16]*(24) + in[17]*(-4) + in[18]*(-9) + in[19]*(-59) + in[20]*(-33) + in[21]*(9) + in[22]*(13) + in[23]*(18) + in[24]*(51) + in[25]*(3) + in[26]*(-93) + in[27]*(49) + in[28]*(0) + in[29]*(-13) + in[30]*(-41) + in[31]*(99) + (-83); out[30] = in[0]*(-72) + in[1]*(-19) + in[2]*(22) + in[3]*(11) + in[4]*(-112) + in[5]*(0) + in[6]*(-235) + in[7]*(-147) + in[8]*(6) + in[9]*(-10) + in[10]*(-58) + in[11]*(8) + in[12]*(-22) + in[13]*(5) + in[14]*(-27) + in[15]*(10) + in[16]*(-8) + in[17]*(9) + in[18]*(-95) + in[19]*(-1) + in[20]*(-155) + in[21]*(-27) + in[22]*(-196) + in[23]*(-15) + in[24]*(-5) + in[25]*(37) + in[26]*(-14) + in[27]*(-10) + in[28]*(50) + in[29]*(-44) + in[30]*(41) + in[31]*(-27) + (398); out[31] = in[0]*(152) + in[1]*(14) + in[2]*(233) + in[3]*(17) + in[4]*(42) + in[5]*(-25) + in[6]*(-13) + in[7]*(-50) + in[8]*(71) + in[9]*(11) + in[10]*(-15) + in[11]*(9) + in[12]*(-108) + in[13]*(-12) + in[14]*(-19) + in[15]*(55) + in[16]*(47) + in[17]*(-43) + in[18]*(-95) + in[19]*(47) + in[20]*(13) + in[21]*(22) + in[22]*(20) + in[23]*(-37) + in[24]*(-14) + in[25]*(10) + in[26]*(13) + in[27]*(-49) + in[28]*(22) + in[29]*(9) + in[30]*(-14) + in[31]*(-67) + (-130); out[32] = in[0]*(-33) + in[1]*(23) + in[2]*(63) + in[3]*(-17) + in[4]*(-38) + in[5]*(-12) + in[6]*(-25) + in[7]*(24) + in[8]*(-128) + in[9]*(44) + in[10]*(-55) + in[11]*(-31) + in[12]*(66) + in[13]*(3) + in[14]*(-30) + in[15]*(36) + in[16]*(10) + in[17]*(1) + in[18]*(77) + in[19]*(34) + in[20]*(46) + in[21]*(-24) + in[22]*(40) + in[23]*(-12) + in[24]*(-1) + in[25]*(35) + in[26]*(-14) + in[27]*(-7) + in[28]*(27) + in[29]*(-42) + in[30]*(22) + in[31]*(20) + (465); out[33] = in[0]*(38) + in[1]*(-8) + in[2]*(-27) + in[3]*(53) + in[4]*(-16) + in[5]*(5) + in[6]*(100) + in[7]*(-4) + in[8]*(14) + in[9]*(-14) + in[10]*(27) + in[11]*(3) + in[12]*(64) + in[13]*(-24) + in[14]*(-28) + in[15]*(-43) + in[16]*(26) + in[17]*(-46) + in[18]*(-128) + in[19]*(-47) + in[20]*(-51) + in[21]*(13) + in[22]*(-94) + in[23]*(37) + in[24]*(-20) + in[25]*(-8) + in[26]*(-15) + in[27]*(98) + in[28]*(-23) + in[29]*(35) + in[30]*(-10) + in[31]*(146) + (219); out[34] = in[0]*(-75) + in[1]*(-15) + in[2]*(-11) + in[3]*(20) + in[4]*(-117) + in[5]*(-18) + in[6]*(28) + in[7]*(18) + in[8]*(-71) + in[9]*(-8) + in[10]*(28) + in[11]*(-27) + in[12]*(108) + in[13]*(18) + in[14]*(-52) + in[15]*(74) + in[16]*(-19) + in[17]*(14) + in[18]*(-332) + in[19]*(23) + in[20]*(-19) + in[21]*(-28) + in[22]*(-58) + in[23]*(-33) + in[24]*(-35) + in[25]*(-10) + in[26]*(80) + in[27]*(-56) + in[28]*(-7) + in[29]*(78) + in[30]*(-2) + in[31]*(18) + (-6); out[35] = in[0]*(99) + in[1]*(-6) + in[2]*(52) + in[3]*(6) + in[4]*(50) + in[5]*(-5) + in[6]*(-34) + in[7]*(-27) + in[8]*(-77) + in[9]*(32) + in[10]*(-30) + in[11]*(6) + in[12]*(16) + in[13]*(-35) + in[14]*(22) + in[15]*(-40) + in[16]*(36) + in[17]*(-13) + in[18]*(-127) + in[19]*(-55) + in[20]*(-92) + in[21]*(34) + in[22]*(-130) + in[23]*(28) + in[24]*(20) + in[25]*(-38) + in[26]*(-166) + in[27]*(-46) + in[28]*(-23) + in[29]*(-2) + in[30]*(37) + in[31]*(31) + (334); out[36] = in[0]*(6) + in[1]*(-4) + in[2]*(-8) + in[3]*(-8) + in[4]*(13) + in[5]*(-17) + in[6]*(17) + in[7]*(-16) + in[8]*(-2) + in[9]*(-25) + in[10]*(-8) + in[11]*(22) + in[12]*(-25) + in[13]*(-8) + in[14]*(-11) + in[15]*(-4) + in[16]*(-5) + in[17]*(-14) + in[18]*(4) + in[19]*(-7) + in[20]*(-14) + in[21]*(-15) + in[22]*(9) + in[23]*(23) + in[24]*(-15) + in[25]*(-9) + in[26]*(-7) + in[27]*(-11) + in[28]*(-24) + in[29]*(-14) + in[30]*(-25) + in[31]*(13) + (0); out[37] = in[0]*(97) + in[1]*(36) + in[2]*(-37) + in[3]*(-1) + in[4]*(26) + in[5]*(-36) + in[6]*(-39) + in[7]*(-68) + in[8]*(-9) + in[9]*(-65) + in[10]*(37) + in[11]*(-5) + in[12]*(10) + in[13]*(43) + in[14]*(-79) + in[15]*(-6) + in[16]*(27) + in[17]*(33) + in[18]*(-10) + in[19]*(65) + in[20]*(-33) + in[21]*(-25) + in[22]*(-53) + in[23]*(-53) + in[24]*(-13) + in[25]*(60) + in[26]*(56) + in[27]*(48) + in[28]*(-2) + in[29]*(4) + in[30]*(30) + in[31]*(-77) + (-121); out[38] = in[0]*(-107) + in[1]*(-39) + in[2]*(171) + in[3]*(-2) + in[4]*(-64) + in[5]*(-5) + in[6]*(-58) + in[7]*(68) + in[8]*(14) + in[9]*(18) + in[10]*(23) + in[11]*(-12) + in[12]*(50) + in[13]*(23) + in[14]*(10) + in[15]*(38) + in[16]*(-30) + in[17]*(19) + in[18]*(-129) + in[19]*(7) + in[20]*(49) + in[21]*(4) + in[22]*(10) + in[23]*(-68) + in[24]*(6) + in[25]*(21) + in[26]*(-21) + in[27]*(3) + in[28]*(-62) + in[29]*(4) + in[30]*(28) + in[31]*(46) + (-370); out[39] = in[0]*(187) + in[1]*(48) + in[2]*(6) + in[3]*(24) + in[4]*(148) + in[5]*(-7) + in[6]*(-4) + in[7]*(-105) + in[8]*(10) + in[9]*(14) + in[10]*(-53) + in[11]*(14) + in[12]*(8) + in[13]*(-12) + in[14]*(-60) + in[15]*(-95) + in[16]*(37) + in[17]*(-33) + in[18]*(123) + in[19]*(7) + in[20]*(-3) + in[21]*(13) + in[22]*(78) + in[23]*(26) + in[24]*(6) + in[25]*(-9) + in[26]*(-17) + in[27]*(-142) + in[28]*(22) + in[29]*(43) + in[30]*(22) + in[31]*(140) + (90); out[40] = in[0]*(8) + in[1]*(5) + in[2]*(22) + in[3]*(7) + in[4]*(16) + in[5]*(-32) + in[6]*(16) + in[7]*(-52) + in[8]*(31) + in[9]*(-1) + in[10]*(-100) + in[11]*(-28) + in[12]*(2) + in[13]*(-24) + in[14]*(-1) + in[15]*(-14) + in[16]*(7) + in[17]*(5) + in[18]*(147) + in[19]*(-37) + in[20]*(-125) + in[21]*(-17) + in[22]*(-104) + in[23]*(8) + in[24]*(7) + in[25]*(-11) + in[26]*(8) + in[27]*(-59) + in[28]*(16) + in[29]*(19) + in[30]*(-9) + in[31]*(30) + (521); out[41] = in[0]*(208) + in[1]*(-42) + in[2]*(48) + in[3]*(-14) + in[4]*(67) + in[5]*(-23) + in[6]*(19) + in[7]*(27) + in[8]*(141) + in[9]*(-1) + in[10]*(-50) + in[11]*(26) + in[12]*(-85) + in[13]*(-8) + in[14]*(23) + in[15]*(-20) + in[16]*(-66) + in[17]*(28) + in[18]*(-34) + in[19]*(59) + in[20]*(-49) + in[21]*(29) + in[22]*(-28) + in[23]*(-60) + in[24]*(-18) + in[25]*(-78) + in[26]*(-30) + in[27]*(-63) + in[28]*(-28) + in[29]*(45) + in[30]*(-13) + in[31]*(56) + (227); out[42] = in[0]*(-17) + in[1]*(-17) + in[2]*(6) + in[3]*(-48) + in[4]*(-121) + in[5]*(0) + in[6]*(15) + in[7]*(69) + in[8]*(40) + in[9]*(30) + in[10]*(-33) + in[11]*(4) + in[12]*(-53) + in[13]*(7) + in[14]*(12) + in[15]*(-49) + in[16]*(-19) + in[17]*(35) + in[18]*(-146) + in[19]*(96) + in[20]*(43) + in[21]*(-17) + in[22]*(52) + in[23]*(10) + in[24]*(-91) + in[25]*(-15) + in[26]*(68) + in[27]*(54) + in[28]*(4) + in[29]*(27) + in[30]*(15) + in[31]*(126) + (227); out[43] = in[0]*(-231) + in[1]*(-23) + in[2]*(-37) + in[3]*(7) + in[4]*(-26) + in[5]*(13) + in[6]*(22) + in[7]*(-43) + in[8]*(-36) + in[9]*(34) + in[10]*(-34) + in[11]*(-33) + in[12]*(-39) + in[13]*(-41) + in[14]*(-28) + in[15]*(20) + in[16]*(9) + in[17]*(-36) + in[18]*(-217) + in[19]*(-8) + in[20]*(-65) + in[21]*(11) + in[22]*(-141) + in[23]*(-47) + in[24]*(17) + in[25]*(77) + in[26]*(44) + in[27]*(-28) + in[28]*(-6) + in[29]*(10) + in[30]*(-25) + in[31]*(-23) + (-325); out[44] = in[0]*(58) + in[1]*(-70) + in[2]*(1) + in[3]*(62) + in[4]*(39) + in[5]*(18) + in[6]*(35) + in[7]*(-106) + in[8]*(-404) + in[9]*(-18) + in[10]*(17) + in[11]*(14) + in[12]*(3) + in[13]*(-16) + in[14]*(25) + in[15]*(-46) + in[16]*(23) + in[17]*(-40) + in[18]*(102) + in[19]*(-81) + in[20]*(52) + in[21]*(-11) + in[22]*(-83) + in[23]*(29) + in[24]*(30) + in[25]*(-21) + in[26]*(-8) + in[27]*(17) + in[28]*(-11) + in[29]*(23) + in[30]*(-24) + in[31]*(2) + (273); out[45] = in[0]*(14) + in[1]*(-23) + in[2]*(-24) + in[3]*(-24) + in[4]*(1) + in[5]*(-2) + in[6]*(11) + in[7]*(-3) + in[8]*(-74) + in[9]*(-11) + in[10]*(-32) + in[11]*(20) + in[12]*(65) + in[13]*(-4) + in[14]*(-27) + in[15]*(-1) + in[16]*(-8) + in[17]*(26) + in[18]*(97) + in[19]*(60) + in[20]*(55) + in[21]*(-18) + in[22]*(118) + in[23]*(-69) + in[24]*(-14) + in[25]*(-13) + in[26]*(-22) + in[27]*(-45) + in[28]*(-12) + in[29]*(72) + in[30]*(34) + in[31]*(16) + (-404); out[46] = in[0]*(17) + in[1]*(1) + in[2]*(21) + in[3]*(11) + in[4]*(9) + in[5]*(-22) + in[6]*(-24) + in[7]*(8) + in[8]*(-15) + in[9]*(-7) + in[10]*(-26) + in[11]*(18) + in[12]*(12) + in[13]*(-5) + in[14]*(15) + in[15]*(-7) + in[16]*(-2) + in[17]*(-8) + in[18]*(19) + in[19]*(-13) + in[20]*(12) + in[21]*(-21) + in[22]*(9) + in[23]*(-6) + in[24]*(-15) + in[25]*(-9) + in[26]*(-3) + in[27]*(20) + in[28]*(-13) + in[29]*(-29) + in[30]*(-21) + in[31]*(-7) + (-4); out[47] = in[0]*(48) + in[1]*(-11) + in[2]*(154) + in[3]*(-11) + in[4]*(-65) + in[5]*(13) + in[6]*(-41) + in[7]*(27) + in[8]*(-64) + in[9]*(15) + in[10]*(-81) + in[11]*(-38) + in[12]*(158) + in[13]*(27) + in[14]*(26) + in[15]*(-64) + in[16]*(-29) + in[17]*(31) + in[18]*(6) + in[19]*(136) + in[20]*(150) + in[21]*(-44) + in[22]*(85) + in[23]*(-66) + in[24]*(16) + in[25]*(-3) + in[26]*(-67) + in[27]*(-150) + in[28]*(-31) + in[29]*(29) + in[30]*(27) + in[31]*(-48) + (238); out[48] = in[0]*(153) + in[1]*(-5) + in[2]*(134) + in[3]*(15) + in[4]*(-8) + in[5]*(-9) + in[6]*(51) + in[7]*(9) + in[8]*(-187) + in[9]*(-29) + in[10]*(39) + in[11]*(-24) + in[12]*(124) + in[13]*(-156) + in[14]*(29) + in[15]*(48) + in[16]*(28) + in[17]*(-16) + in[18]*(30) + in[19]*(41) + in[20]*(37) + in[21]*(-29) + in[22]*(9) + in[23]*(8) + in[24]*(65) + in[25]*(26) + in[26]*(37) + in[27]*(-45) + in[28]*(-33) + in[29]*(-2) + in[30]*(26) + in[31]*(-12) + (-153); out[49] = in[0]*(-70) + in[1]*(-11) + in[2]*(15) + in[3]*(9) + in[4]*(71) + in[5]*(32) + in[6]*(-98) + in[7]*(-103) + in[8]*(93) + in[9]*(1) + in[10]*(-25) + in[11]*(31) + in[12]*(-72) + in[13]*(22) + in[14]*(77) + in[15]*(-22) + in[16]*(-17) + in[17]*(3) + in[18]*(-21) + in[19]*(-9) + in[20]*(78) + in[21]*(17) + in[22]*(127) + in[23]*(59) + in[24]*(-1) + in[25]*(12) + in[26]*(-55) + in[27]*(84) + in[28]*(8) + in[29]*(-73) + in[30]*(-19) + in[31]*(41) + (55); } inline void fc_2(int in[50], int out[10]){ out[0] = in[0]*(14) + in[1]*(6) + in[2]*(-22) + in[3]*(35) + in[4]*(51) + in[5]*(-53) + in[6]*(-182) + in[7]*(-7) + in[8]*(-26) + in[9]*(-49) + in[10]*(-12) + in[11]*(-37) + in[12]*(-7) + in[13]*(31) + in[14]*(-8) + in[15]*(40) + in[16]*(29) + in[17]*(-40) + in[18]*(-54) + in[19]*(-44) + in[20]*(-1028) + in[21]*(19) + in[22]*(-7) + in[23]*(6) + in[24]*(-42) + in[25]*(-55) + in[26]*(14) + in[27]*(-27) + in[28]*(11) + in[29]*(-7) + in[30]*(-97) + in[31]*(-62) + in[32]*(-8) + in[33]*(-3) + in[34]*(-39) + in[35]*(-11) + in[36]*(-9) + in[37]*(0) + in[38]*(33) + in[39]*(-14) + in[40]*(-85) + in[41]*(-32) + in[42]*(-3) + in[43]*(-6) + in[44]*(28) + in[45]*(58) + in[46]*(-7) + in[47]*(12) + in[48]*(25) + in[49]*(-53) + (-21320); out[1] = in[0]*(-40) + in[1]*(27) + in[2]*(21) + in[3]*(14) + in[4]*(9) + in[5]*(-14) + in[6]*(-121) + in[7]*(-33) + in[8]*(-104) + in[9]*(2) + in[10]*(5) + in[11]*(-15) + in[12]*(-44) + in[13]*(-28) + in[14]*(9) + in[15]*(25) + in[16]*(23) + in[17]*(-22) + in[18]*(-13) + in[19]*(-63) + in[20]*(-321) + in[21]*(-43) + in[22]*(-13) + in[23]*(-72) + in[24]*(-36) + in[25]*(-12) + in[26]*(-11) + in[27]*(3) + in[28]*(22) + in[29]*(41) + in[30]*(-52) + in[31]*(-37) + in[32]*(11) + in[33]*(-50) + in[34]*(0) + in[35]*(29) + in[36]*(2) + in[37]*(0) + in[38]*(-29) + in[39]*(47) + in[40]*(26) + in[41]*(1) + in[42]*(49) + in[43]*(6) + in[44]*(-106) + in[45]*(-69) + in[46]*(-15) + in[47]*(72) + in[48]*(-1) + in[49]*(-40) + (38749); out[2] = in[0]*(-11) + in[1]*(7) + in[2]*(-20) + in[3]*(-28) + in[4]*(12) + in[5]*(6) + in[6]*(-93) + in[7]*(-40) + in[8]*(12) + in[9]*(22) + in[10]*(-8) + in[11]*(-33) + in[12]*(-42) + in[13]*(5) + in[14]*(-1) + in[15]*(30) + in[16]*(2) + in[17]*(10) + in[18]*(-29) + in[19]*(-36) + in[20]*(-840) + in[21]*(-44) + in[22]*(-22) + in[23]*(-27) + in[24]*(-2) + in[25]*(41) + in[26]*(-17) + in[27]*(19) + in[28]*(-32) + in[29]*(19) + in[30]*(-82) + in[31]*(-11) + in[32]*(-19) + in[33]*(-11) + in[34]*(-26) + in[35]*(-37) + in[36]*(-15) + in[37]*(-42) + in[38]*(42) + in[39]*(-2) + in[40]*(-46) + in[41]*(12) + in[42]*(-6) + in[43]*(14) + in[44]*(40) + in[45]*(7) + in[46]*(14) + in[47]*(-40) + in[48]*(-38) + in[49]*(-16) + (-11896); out[3] = in[0]*(31) + in[1]*(-13) + in[2]*(-17) + in[3]*(-57) + in[4]*(4) + in[5]*(6) + in[6]*(-62) + in[7]*(-41) + in[8]*(-29) + in[9]*(-29) + in[10]*(10) + in[11]*(20) + in[12]*(-35) + in[13]*(11) + in[14]*(10) + in[15]*(-21) + in[16]*(-14) + in[17]*(-35) + in[18]*(24) + in[19]*(7) + in[20]*(-110) + in[21]*(8) + in[22]*(-25) + in[23]*(-16) + in[24]*(-13) + in[25]*(-29) + in[26]*(1) + in[27]*(-44) + in[28]*(-52) + in[29]*(13) + in[30]*(18) + in[31]*(-41) + in[32]*(8) + in[33]*(-4) + in[34]*(-6) + in[35]*(-44) + in[36]*(11) + in[37]*(-5) + in[38]*(8) + in[39]*(-11) + in[40]*(19) + in[41]*(-23) + in[42]*(-15) + in[43]*(26) + in[44]*(-26) + in[45]*(29) + in[46]*(11) + in[47]*(-21) + in[48]*(-14) + in[49]*(-7) + (-921); out[4] = in[0]*(-31) + in[1]*(30) + in[2]*(14) + in[3]*(-43) + in[4]*(-30) + in[5]*(-1) + in[6]*(1) + in[7]*(21) + in[8]*(25) + in[9]*(-41) + in[10]*(-1) + in[11]*(-6) + in[12]*(5) + in[13]*(29) + in[14]*(12) + in[15]*(-11) + in[16]*(6) + in[17]*(5) + in[18]*(-13) + in[19]*(-61) + in[20]*(-20) + in[21]*(0) + in[22]*(-10) + in[23]*(-16) + in[24]*(6) + in[25]*(26) + in[26]*(5) + in[27]*(-25) + in[28]*(13) + in[29]*(2) + in[30]*(25) + in[31]*(-23) + in[32]*(-45) + in[33]*(-33) + in[34]*(-27) + in[35]*(-6) + in[36]*(27) + in[37]*(-3) + in[38]*(-52) + in[39]*(12) + in[40]*(-77) + in[41]*(22) + in[42]*(-11) + in[43]*(-41) + in[44]*(-2) + in[45]*(-16) + in[46]*(10) + in[47]*(-28) + in[48]*(-37) + in[49]*(17) + (-5652); out[5] = in[0]*(-3) + in[1]*(-13) + in[2]*(13) + in[3]*(-25) + in[4]*(-15) + in[5]*(-12) + in[6]*(-48) + in[7]*(2) + in[8]*(-17) + in[9]*(11) + in[10]*(-26) + in[11]*(0) + in[12]*(-21) + in[13]*(-1) + in[14]*(43) + in[15]*(11) + in[16]*(9) + in[17]*(-36) + in[18]*(14) + in[19]*(0) + in[20]*(-45) + in[21]*(0) + in[22]*(4) + in[23]*(0) + in[24]*(-44) + in[25]*(-49) + in[26]*(-20) + in[27]*(-49) + in[28]*(-45) + in[29]*(-32) + in[30]*(6) + in[31]*(13) + in[32]*(25) + in[33]*(21) + in[34]*(-11) + in[35]*(-2) + in[36]*(-4) + in[37]*(-3) + in[38]*(8) + in[39]*(-24) + in[40]*(34) + in[41]*(-37) + in[42]*(0) + in[43]*(-7) + in[44]*(-39) + in[45]*(40) + in[46]*(16) + in[47]*(-2) + in[48]*(-28) + in[49]*(-14) + (-7859); out[6] = in[0]*(18) + in[1]*(-1) + in[2]*(-10) + in[3]*(-50) + in[4]*(-24) + in[5]*(-20) + in[6]*(-582) + in[7]*(18) + in[8]*(-10) + in[9]*(-82) + in[10]*(-53) + in[11]*(-35) + in[12]*(25) + in[13]*(21) + in[14]*(-36) + in[15]*(16) + in[16]*(20) + in[17]*(-46) + in[18]*(-82) + in[19]*(-7) + in[20]*(-934) + in[21]*(22) + in[22]*(-28) + in[23]*(-45) + in[24]*(6) + in[25]*(-6) + in[26]*(-8) + in[27]*(-40) + in[28]*(3) + in[29]*(-11) + in[30]*(-57) + in[31]*(3) + in[32]*(-1) + in[33]*(10) + in[34]*(-48) + in[35]*(31) + in[36]*(28) + in[37]*(-20) + in[38]*(-31) + in[39]*(-17) + in[40]*(-4) + in[41]*(-26) + in[42]*(34) + in[43]*(24) + in[44]*(-41) + in[45]*(-52) + in[46]*(-9) + in[47]*(31) + in[48]*(5) + in[49]*(-43) + (17341); out[7] = in[0]*(23) + in[1]*(-8) + in[2]*(-14) + in[3]*(11) + in[4]*(34) + in[5]*(-3) + in[6]*(-68) + in[7]*(-31) + in[8]*(2) + in[9]*(11) + in[10]*(-7) + in[11]*(-15) + in[12]*(8) + in[13]*(-10) + in[14]*(-19) + in[15]*(-27) + in[16]*(0) + in[17]*(3) + in[18]*(-39) + in[19]*(-62) + in[20]*(15) + in[21]*(-41) + in[22]*(39) + in[23]*(-66) + in[24]*(-26) + in[25]*(-13) + in[26]*(11) + in[27]*(-2) + in[28]*(-23) + in[29]*(-7) + in[30]*(-43) + in[31]*(-36) + in[32]*(34) + in[33]*(27) + in[34]*(-31) + in[35]*(-20) + in[36]*(-24) + in[37]*(18) + in[38]*(-9) + in[39]*(-7) + in[40]*(-93) + in[41]*(-21) + in[42]*(-38) + in[43]*(-19) + in[44]*(12) + in[45]*(-24) + in[46]*(-8) + in[47]*(1) + in[48]*(-53) + in[49]*(36) + (12408); out[8] = in[0]*(5) + in[1]*(2) + in[2]*(-11) + in[3]*(-34) + in[4]*(1) + in[5]*(-30) + in[6]*(-85) + in[7]*(1) + in[8]*(40) + in[9]*(-58) + in[10]*(16) + in[11]*(29) + in[12]*(-47) + in[13]*(6) + in[14]*(0) + in[15]*(7) + in[16]*(-34) + in[17]*(-35) + in[18]*(-35) + in[19]*(-32) + in[20]*(-181) + in[21]*(-21) + in[22]*(-17) + in[23]*(-27) + in[24]*(14) + in[25]*(-29) + in[26]*(17) + in[27]*(-28) + in[28]*(-32) + in[29]*(-21) + in[30]*(-56) + in[31]*(-20) + in[32]*(-65) + in[33]*(3) + in[34]*(31) + in[35]*(-26) + in[36]*(-8) + in[37]*(-9) + in[38]*(9) + in[39]*(-5) + in[40]*(27) + in[41]*(-30) + in[42]*(17) + in[43]*(-33) + in[44]*(2) + in[45]*(-6) + in[46]*(-15) + in[47]*(-19) + in[48]*(-18) + in[49]*(-26) + (-16309); out[9] = in[0]*(27) + in[1]*(40) + in[2]*(-2) + in[3]*(-42) + in[4]*(-11) + in[5]*(-47) + in[6]*(-25) + in[7]*(-10) + in[8]*(0) + in[9]*(-33) + in[10]*(0) + in[11]*(1) + in[12]*(20) + in[13]*(22) + in[14]*(29) + in[15]*(-14) + in[16]*(12) + in[17]*(-4) + in[18]*(-45) + in[19]*(-49) + in[20]*(-245) + in[21]*(-15) + in[22]*(-21) + in[23]*(-17) + in[24]*(-2) + in[25]*(-19) + in[26]*(19) + in[27]*(-14) + in[28]*(-39) + in[29]*(-30) + in[30]*(49) + in[31]*(-46) + in[32]*(-9) + in[33]*(-36) + in[34]*(-19) + in[35]*(-20) + in[36]*(30) + in[37]*(-26) + in[38]*(29) + in[39]*(52) + in[40]*(-86) + in[41]*(-52) + in[42]*(1) + in[43]*(-36) + in[44]*(-20) + in[45]*(-13) + in[46]*(-3) + in[47]*(-31) + in[48]*(-7) + in[49]*(24) + (2658); } #endif /* FC_WEIGHTS_HPP_ */
16.779911
44
0.329156
brouwa
942129a8633c59263f489a8e2a0a503085954125
636
hpp
C++
include/sp/algo/nn/config.hpp
thorigin/sp
a837b4fcb5b7184591585082012942bbdb8f11f9
[ "FSFAP" ]
null
null
null
include/sp/algo/nn/config.hpp
thorigin/sp
a837b4fcb5b7184591585082012942bbdb8f11f9
[ "FSFAP" ]
null
null
null
include/sp/algo/nn/config.hpp
thorigin/sp
a837b4fcb5b7184591585082012942bbdb8f11f9
[ "FSFAP" ]
null
null
null
/** * Copyright (C) Omar Thor <omarthoro@gmail.com> - All Rights Reserved * Unauthorized copying of this file, via any medium is strictly prohibited * Proprietary and confidential * * Written by Omar Thor <omarthoro@gmail.com>, 2017 */ #ifndef SP_ALGO_NN_CONFIG_HPP #define SP_ALGO_NN_CONFIG_HPP #include <cmath> #include "sp/config.hpp" SP_ALGO_NN_NAMESPACE_BEGIN #ifndef NN_FLOAT_TYPE #define NN_FLOAT_TYPE std::float_t #endif #ifndef SP_ALGO_NN_RANDOM_GENERATOR #define SP_ALGO_NN_RANDOM_GENERATOR std::mt19937 #endif using float_t = NN_FLOAT_TYPE; SP_ALGO_NN_NAMESPACE_END #endif /* SP_ALGO_NN_CONFIG_HPP */
19.875
75
0.779874
thorigin
942b7a2a4945141ddc9dac7b8aa3403257e91cb9
525
cpp
C++
http/src/EHttpMethod.cpp
developkits/CxxMina
705734fccc5ef87c7faa385b77cd1e67c46c5c75
[ "Apache-2.0" ]
7
2016-08-25T14:22:36.000Z
2020-05-25T17:27:51.000Z
http/src/EHttpMethod.cpp
developkits/CxxMina
705734fccc5ef87c7faa385b77cd1e67c46c5c75
[ "Apache-2.0" ]
1
2018-07-11T12:37:55.000Z
2018-07-12T00:05:33.000Z
http/src/EHttpMethod.cpp
developkits/CxxMina
705734fccc5ef87c7faa385b77cd1e67c46c5c75
[ "Apache-2.0" ]
2
2017-06-09T01:22:36.000Z
2021-09-29T16:27:58.000Z
/* * EHttpMethod.cpp * * Created on: 2017-1-4 * Author: cxxjava@163.com */ #include "../inc/EHttpMethod.hh" namespace efc { namespace eio { EHttpMethod EHttpMethod::GET("GET"); EHttpMethod EHttpMethod::HEAD("HEAD"); EHttpMethod EHttpMethod::POST("POST"); EHttpMethod EHttpMethod::PUT("PUT"); EHttpMethod EHttpMethod::DELETE("DELETE"); EHttpMethod EHttpMethod::OPTIONS("OPTIONS"); EHttpMethod EHttpMethod::TRACE("TRACE"); EHttpMethod EHttpMethod::CONNECT("CONNECT"); } /* namespace eio */ } /* namespace efc */
21.875
44
0.710476
developkits
942cfb9e5f2cb3eb58bc2f8300704fb1b333e30c
1,571
cc
C++
sdios/src/ram_dsm/main.cc
NeoLeMarc/sdios
24630c16dfabab008891a354e2f49088d0d0a369
[ "BSD-2-Clause" ]
null
null
null
sdios/src/ram_dsm/main.cc
NeoLeMarc/sdios
24630c16dfabab008891a354e2f49088d0d0a369
[ "BSD-2-Clause" ]
null
null
null
sdios/src/ram_dsm/main.cc
NeoLeMarc/sdios
24630c16dfabab008891a354e2f49088d0d0a369
[ "BSD-2-Clause" ]
null
null
null
// // File: src/ram_dsm/main.cc // // Description: RAM-DataspaceManager // #include <l4/thread.h> #include <l4/sigma0.h> #include <l4io.h> #include <sdi/types.h> #include <sdi/sdi.h> #include <idl4glue.h> #include <if/iflocator.h> #include <if/iflogging.h> #include "ram_dsm.h" L4_ThreadId_t sigma0_id = L4_nilthread; // Bitmap to store available state // calculate bitmap size via RAM size / 4KB (page size) / 32 (bits per word) #define AVAILABLE_BITMAP_SIZE 256 L4_Word_t available[AVAILABLE_BITMAP_SIZE]; int main () { printf ("[RAM-DSM] is alive\n"); // Initiate sigma0_id L4_KernelInterfacePage_t * kip = (L4_KernelInterfacePage_t *) L4_GetKernelInterface (); sigma0_id = L4_GlobalId (kip->ThreadInfo.X.UserBase, 1); // Try to get whole memory from sigma0 // We are starting at 1 MB, because we do // not want to fiddle around with architecture // specific stuff like EBDA etc. IO-DSM has to // take this memory later. for (L4_Word_t i = 0x01000UL; i < 0x02000UL; i++) { // page size is 2^12 byte if (!L4_IsNilFpage(L4_Sigma0_GetAny(L4_nilthread, 12, L4_FpageLog2(i << 12, 12)))) { // 2^5 bits per word available[i >> 5] |= (1UL << (i & 0x1fUL)); } } // Start BI-ELF-Loader bielfloader_server(available); printf("[RAM-DSM] Oooooooops, your ELF-Loader just died!\n"); /* Start Pager */ // printf("Starting pager...\n"); // pager_server(); // printf("Oooops, your pager just died!\n"); /* Spin forever */ while (42); return 0; }
25.33871
90
0.644812
NeoLeMarc
942dcee35ec86a7347eb0d231e13e9479d5012f1
495
cpp
C++
src/storm/color.cpp
vanderlokken/storm
462a783fb780b290149acf0d75c4b3b837a97325
[ "MIT" ]
2
2016-11-17T20:48:08.000Z
2018-04-28T22:41:12.000Z
src/storm/color.cpp
vanderlokken/storm
462a783fb780b290149acf0d75c4b3b837a97325
[ "MIT" ]
null
null
null
src/storm/color.cpp
vanderlokken/storm
462a783fb780b290149acf0d75c4b3b837a97325
[ "MIT" ]
1
2016-10-19T03:07:58.000Z
2016-10-19T03:07:58.000Z
#include <storm/color.h> namespace storm { const Color Color::Black( 0, 0, 0, 1 ); const Color Color::White( 1, 1, 1, 1 ); const Color Color::BlackTransparent( 0, 0, 0, 0 ); const Color Color::WhiteTransparent( 1, 1, 1, 0 ); const CompressedColor CompressedColor::Black( 0xFF000000 ); const CompressedColor CompressedColor::White( 0xFFFFFFFF ); const CompressedColor CompressedColor::BlackTransparent( 0x00000000 ); const CompressedColor CompressedColor::WhiteTransparent( 0x00FFFFFF ); }
27.5
70
0.751515
vanderlokken
942e3878f2d7cebe5475cec7a58bcb83566ca817
1,662
cpp
C++
cEpiabm/test/sweeps/test_household_sweep.cpp
Saketkr21/epiabm
3ec0dcbc78d3fd4114ed3c6bdd78ef39f0013d2f
[ "BSD-3-Clause" ]
11
2021-12-02T15:24:02.000Z
2022-03-10T14:02:13.000Z
cEpiabm/test/sweeps/test_household_sweep.cpp
Saketkr21/epiabm
3ec0dcbc78d3fd4114ed3c6bdd78ef39f0013d2f
[ "BSD-3-Clause" ]
119
2021-11-24T13:56:48.000Z
2022-03-30T11:52:07.000Z
cEpiabm/test/sweeps/test_household_sweep.cpp
SABS-R3-Epidemiology/epiabm
8eb83fd2de84104f6f77929e3771095f7b033ddc
[ "BSD-3-Clause" ]
3
2022-01-13T03:05:19.000Z
2022-03-11T22:00:17.000Z
#include "sweeps/household_sweep.hpp" #include "population_factory.hpp" #include "../catch/catch.hpp" #include "helpers.hpp" #include <random> using namespace epiabm; TEST_CASE("sweeps/household_sweep: test initialize household_sweep", "[HouseholdSweep]") { HouseholdSweepPtr subject = std::make_shared<HouseholdSweep>(); } TEST_CASE("sweeps/household_sweep: test household_sweep bind_population", "[HouseholdSweep]") { HouseholdSweepPtr subject = std::make_shared<HouseholdSweep>(); PopulationPtr population = PopulationFactory().makePopulation(5, 5, 1000); bind_households(population, 500); population->initialize(); REQUIRE_NOTHROW(subject->bind_population(population)); } TEST_CASE("sweeps/household_sweep: test household_sweep run sweep", "[HouseholdSweep]") { HouseholdSweepPtr subject = std::make_shared<HouseholdSweep>(); PopulationPtr population = PopulationFactory().makePopulation(5, 5, 1000); bind_households(population, 500); random_seed(population, 10, InfectionStatus::InfectASympt, 5); population->initialize(); REQUIRE_NOTHROW(subject->bind_population(population)); for (int i = 0; i < 10; i++) REQUIRE_NOTHROW((*subject)(static_cast<unsigned short>(i))); } TEST_CASE("sweeps/household_sweep: test destructor", "[HouseholdSweep]") { { SweepInterface* i = new HouseholdSweep(); [[maybe_unused]] HouseholdSweep* subject = dynamic_cast<HouseholdSweep*>(i); delete i; i = nullptr; subject = nullptr; } { SweepInterface* i = new SweepInterface(); i->operator()(0); delete i; i = nullptr; } }
29.678571
93
0.699759
Saketkr21
94313705de52132518bef6bec085088d766e1d9e
751
cpp
C++
TOJ/HayForSale.cpp
aajjbb/contest-files
b8842681b96017063a7baeac52ae1318bf59d74d
[ "Apache-2.0" ]
1
2018-08-28T19:58:40.000Z
2018-08-28T19:58:40.000Z
TOJ/HayForSale.cpp
aajjbb/contest-files
b8842681b96017063a7baeac52ae1318bf59d74d
[ "Apache-2.0" ]
2
2017-04-16T00:48:05.000Z
2017-08-03T20:12:26.000Z
TOJ/HayForSale.cpp
aajjbb/contest-files
b8842681b96017063a7baeac52ae1318bf59d74d
[ "Apache-2.0" ]
4
2016-03-04T19:42:00.000Z
2018-01-08T11:42:00.000Z
#include <iostream> template<typename T> T gcd(T a, T b) { if(!b) return a; return gcd(b, a % b); } template<typename T> T lcm(T a, T b) { return a * b / gcd(a, b); } template<typename T> void chmin(T& a, T b) { a = (a > b) ? b : a; } template<typename T> void chmax(T& a, T b) { a = (a < b) ? b : a; } using namespace std; typedef long long Int; typedef unsigned uint; const int MAXN = 50050; int C, N; int P[5005]; bool dp[MAXN]; int main(void) { cin >> C >> N; dp[0] = true; for (int i = 0; i < N; i++) { cin >> P[i]; } for (int i = 0; i < N; i++) { for (int j = C; j >= P[i]; j--) { dp[j] |= dp[j - P[i]]; } } int ans = C; while (!dp[ans] && ans > 0) { ans -= 1; } cout << ans << "\n"; return 0; }
15.978723
67
0.498003
aajjbb
9434b83e91ade57a403ea82bd2eed4a10cfebba7
712
cpp
C++
boboleetcode/Play-Leetcode-master/0104-Maximum-Depth-of-Binary-Tree/cpp-0104/main.cpp
yaominzh/CodeLrn2019
adc727d92904c5c5d445a2621813dfa99474206d
[ "Apache-2.0" ]
2
2021-03-25T05:26:55.000Z
2021-04-20T03:33:24.000Z
boboleetcode/Play-Leetcode-master/0104-Maximum-Depth-of-Binary-Tree/cpp-0104/main.cpp
mcuallen/CodeLrn2019
adc727d92904c5c5d445a2621813dfa99474206d
[ "Apache-2.0" ]
6
2019-12-04T06:08:32.000Z
2021-05-10T20:22:47.000Z
boboleetcode/Play-Leetcode-master/0104-Maximum-Depth-of-Binary-Tree/cpp-0104/main.cpp
mcuallen/CodeLrn2019
adc727d92904c5c5d445a2621813dfa99474206d
[ "Apache-2.0" ]
null
null
null
/// Source : https://leetcode.com/problems/maximum-depth-of-binary-tree/description/ /// Author : liuyubobobo /// Time : 2017-11-17 #include <iostream> using namespace std; /// Definition for a binary tree node. struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {} }; /// Recursive /// Time Complexity: O(n), where n is the nodes' number in the tree /// Space Complexity: O(h), where h is the height of the tree class Solution { public: int maxDepth(TreeNode* root) { if(root == NULL) return 0; return 1 + max(maxDepth(root->left), maxDepth(root->right)); } }; int main() { return 0; }
20.342857
84
0.627809
yaominzh
943e2ed2ddc9cfa963d6f34b837c34775cec3719
123
cpp
C++
lab2.2/errorProcess.cpp
mengguanya/Elementary-Computer-Architecture-Lab
38167d54f9af8af0fade1ff38dd8adb795db476f
[ "MIT" ]
null
null
null
lab2.2/errorProcess.cpp
mengguanya/Elementary-Computer-Architecture-Lab
38167d54f9af8af0fade1ff38dd8adb795db476f
[ "MIT" ]
null
null
null
lab2.2/errorProcess.cpp
mengguanya/Elementary-Computer-Architecture-Lab
38167d54f9af8af0fade1ff38dd8adb795db476f
[ "MIT" ]
null
null
null
#include"errorProcess.h" #include"Inst.h" void openElfError(FILE* elfFile) { } void instAddrError(ADDR addr) { }
13.666667
35
0.682927
mengguanya
9440b5dfd9a9d1d75beba5bfb3c36d8bbcd93604
1,522
cpp
C++
doc/src/examples/arithmetic/dot_product.cpp
jkerkela/geometry
4034ac88b214da0eab8943172eff0f1200b0a6cc
[ "BSL-1.0" ]
326
2015-02-08T13:47:49.000Z
2022-03-16T02:13:59.000Z
doc/src/examples/arithmetic/dot_product.cpp
jkerkela/geometry
4034ac88b214da0eab8943172eff0f1200b0a6cc
[ "BSL-1.0" ]
623
2015-01-02T23:45:23.000Z
2022-03-09T11:15:23.000Z
Libs/boost_1_76_0/libs/geometry/doc/src/examples/arithmetic/dot_product.cpp
Antd23rus/S2DE
47cc7151c2934cd8f0399a9856c1e54894571553
[ "MIT" ]
215
2015-01-14T15:50:38.000Z
2022-02-23T03:58:36.000Z
// Boost.Geometry // QuickBook Example // Copyright (c) 2020, Aditya Mohan // Use, modification and distribution is subject to 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) //[dot_product //` Calculate the dot product of two points #include <iostream> #include <boost/geometry.hpp> #include <boost/geometry/arithmetic/dot_product.hpp> #include <boost/geometry/geometries/adapted/boost_array.hpp> namespace bg = boost::geometry; /*< Convenient namespace alias >*/ BOOST_GEOMETRY_REGISTER_BOOST_ARRAY_CS(cs::cartesian) int main() { double dp1,dp2,dp3,dp4; bg::model::point<double, 3, bg::cs::cartesian> point1(1.0, 2.0, 3.0); bg::model::point<double, 3, bg::cs::cartesian> point2(4.0, 5.0, 6.0); //Example 1 dp1 = bg::dot_product(point1, point2); std::cout << "Dot Product 1: "<< dp1 << std::endl; bg::model::point<double, 2, bg::cs::cartesian> point3(3.0, 2.0); bg::model::point<double, 2, bg::cs::cartesian> point4(4.0, 7.0); //Example 2 dp2 = bg::dot_product(point3, point4); std::cout << "Dot Product 2: "<< dp2 << std::endl; boost::array<double, 2> a = {1, 2}; boost::array<double, 2> b = {2, 3}; //Example 3 dp3 = bg::dot_product(a, b); std::cout << "Dot Product 3: "<< dp3 << std::endl; return 0; } //] //[dot_product_output /*` Output: [pre Dot Product 1: 32 Dot Product 2: 26 Dot Product 3: 8 ] */ //]
22.716418
79
0.632063
jkerkela
9446fd5576f98b99736acbf0ca162971723d07d3
755
hpp
C++
src/mlt/models/transformers/zero_components_analysis.hpp
fedeallocati/MachineLearningToolkit
8614ee2c8c5211a3eefceb10a50576e0485cefd9
[ "MIT" ]
6
2015-08-31T11:43:19.000Z
2018-07-22T11:03:47.000Z
src/mlt/models/transformers/zero_components_analysis.hpp
fedeallocati/MachineLearningToolkit
8614ee2c8c5211a3eefceb10a50576e0485cefd9
[ "MIT" ]
null
null
null
src/mlt/models/transformers/zero_components_analysis.hpp
fedeallocati/MachineLearningToolkit
8614ee2c8c5211a3eefceb10a50576e0485cefd9
[ "MIT" ]
null
null
null
#ifndef MLT_MODELS_TRANSFORMERS_ZERO_COMPONENTS_ANALYSIS_HPP #define MLT_MODELS_TRANSFORMERS_ZERO_COMPONENTS_ANALYSIS_HPP #include "principal_components_analysis_impl.hpp" namespace mlt { namespace models { namespace transformers { class ZeroComponentsAnalysis : public PrincipalComponentsAnalysisImpl<ZeroComponentsAnalysis> { public: explicit ZeroComponentsAnalysis() : PrincipalComponentsAnalysisImpl(true) {} Result transform(Features input) const { assert(_fitted); return _components * PrincipalComponentsAnalysisImpl<Self>::transform(input); } Features inverse_transform(Result input) const { assert(_fitted); return PrincipalComponentsAnalysisImpl::inverse_transform(_components.transpose() * input); } }; } } } #endif
29.038462
96
0.81457
fedeallocati
944ace87ef4102cfbea37b10862ab7c8c3b812c4
1,912
cpp
C++
games/cpp/sudoku.cpp
CarbonDDR/al-go-rithms
8e65affbe812931b7dde0e2933eb06c0f44b4130
[ "CC0-1.0" ]
1,253
2017-06-06T07:19:25.000Z
2022-03-30T17:07:58.000Z
games/cpp/sudoku.cpp
rishabh99-rc/al-go-rithms
4df20d7ef7598fda4bc89101f9a99aac94cdd794
[ "CC0-1.0" ]
554
2017-09-29T18:56:01.000Z
2022-02-21T15:48:13.000Z
games/cpp/sudoku.cpp
rishabh99-rc/al-go-rithms
4df20d7ef7598fda4bc89101f9a99aac94cdd794
[ "CC0-1.0" ]
2,226
2017-09-29T19:59:59.000Z
2022-03-25T08:59:55.000Z
//Implement sudoku solver using recursion (Conceptual) #include<iostream> using namespace std; bool isPossible(int sudoku[][9], int i, int j, int k){ //i=row, j=col, k=value //check if value k is present in row or col for(int p=0;p<9;p++){ if(sudoku[p][j]==k || sudoku[i][p]==k) return false; } //check in sub-sudoku //Find the starting index of the sub-sudoku for (i,j) (IMPORTANT) int si=(i/3)*3; int sj=(j/3)*3; for(int p=si;p<si+3;p++){ for(int q=sj;q<sj+3;q++) if(sudoku[p][q]==k) return false; } return true; } bool sudokuSolver(int sudoku[][9], int i, int j){ //base case if(i==9){ //print soduko for(int p=0;p<9;p++){ for(int q=0;q<9;q++) cout<<sudoku[p][q]<<" "; cout<<endl; } cout<<endl; return true; } //edge cases //if j>9 and (i,j) value already fixed if(j>=9) return sudokuSolver(sudoku,i+1,0); if(sudoku[i][j]!=0) return sudokuSolver(sudoku,i,j+1); //recursive cases for(int k=1;k<=9;k++){ if(isPossible(sudoku,i,j,k)){ sudoku[i][j]=k; bool solved = sudokuSolver(sudoku,i,j+1); if(solved) return true; } } //backtrack sudoku[i][j]=0; return false; } int main(){ int sudoku[9][9]={ {3, 0, 6, 5, 0, 8, 4, 0, 0}, {5, 2, 0, 0, 0, 0, 0, 0, 0}, {0, 8, 7, 0, 0, 0, 0, 3, 1}, {0, 0, 3, 0, 1, 0, 0, 8, 0}, {9, 0, 0, 8, 6, 3, 0, 0, 5}, {0, 5, 0, 0, 9, 0, 6, 0, 0}, {1, 3, 0, 0, 0, 0, 2, 5, 0}, {0, 0, 0, 0, 0, 0, 0, 7, 4}, {0, 0, 5, 2, 0, 6, 3, 0, 0} }; sudokuSolver(sudoku,0,0); return 0; }
27.710145
73
0.429393
CarbonDDR
944c92e249ad5fa1251777c70bb60692378a8bbe
2,673
cpp
C++
tools/editor/source/command/standard/modifyDepth.cpp
pixelballoon/pixelboost
085873310050ce62493df61142b7d4393795bdc2
[ "MIT" ]
6
2015-04-21T11:30:52.000Z
2020-04-29T00:10:04.000Z
tools/editor/source/command/standard/modifyDepth.cpp
pixelballoon/pixelboost
085873310050ce62493df61142b7d4393795bdc2
[ "MIT" ]
null
null
null
tools/editor/source/command/standard/modifyDepth.cpp
pixelballoon/pixelboost
085873310050ce62493df61142b7d4393795bdc2
[ "MIT" ]
null
null
null
#include <string> #include "pixelboost/maths/boundingBox.h" #include "command/standard/modifyDepth.h" #include "core/uidHelpers.h" #include "project/entity.h" #include "project/project.h" #include "project/record.h" #include "project/schema.h" #include "view/entity/entity.h" #include "view/level.h" #include "core.h" #include "view.h" Command* ModifyDepthCommand::Create() { return new ModifyDepthCommand(); } std::string ModifyDepthCommand::GetStaticName() { return "modifyDepth"; } ModifyDepthCommand::ModifyDepthCommand() { } ModifyDepthCommand::~ModifyDepthCommand() { } std::string ModifyDepthCommand::GetName() { return ModifyDepthCommand::GetStaticName(); } bool ModifyDepthCommand::CanUndo() { return false; } bool ModifyDepthCommand::Do(std::string& returnString) { Core* core = Core::Instance(); Level* level = View::Instance()->GetLevel(); Selection& selection = core->GetSelection(); pb::BoundingBox selectionBounds; const Selection::Entities& entities = selection.GetSelection(); float selectionMin = +INFINITY; float selectionMax = -INFINITY; for (Selection::Entities::const_iterator it = entities.begin(); it != entities.end(); ++it) { ViewEntity* entity = level->GetEntityById(it->first); selectionBounds.Expand(entity->GetBoundingBox()); selectionMin = glm::min(selectionMin, entity->GetPosition().z); selectionMax = glm::max(selectionMax, entity->GetPosition().z); } float offset = 0.f; bool modify = false; float otherMin = +INFINITY; float otherMax = -INFINITY; Level::EntityList boundsEntities = level->GetEntitiesInBounds(selectionBounds); for (Level::EntityList::iterator it = boundsEntities.begin(); it != boundsEntities.end(); ++it) { ViewEntity* entity = *it; if (!selection.IsSelected(GenerateSelectionUid(entity->GetUid()))) { modify = true; otherMin = glm::min(otherMin, entity->GetPosition().z); otherMax = glm::max(otherMax, entity->GetPosition().z); } } if (IsArgumentSet("f")) { offset = (otherMax + 1.f) - selectionMin; } else if (IsArgumentSet("b")) { offset = (otherMin - 1.f) - selectionMax; } if (modify && offset != 0.f) { for (Selection::Entities::const_iterator it = entities.begin(); it != entities.end(); ++it) { ViewEntity* entity = level->GetEntityById(it->first); entity->Transform(glm::vec3(0,0,offset)); entity->CommitTransform(); } } return true; }
25.216981
99
0.632997
pixelballoon
944fbb889b970c185bf1c36d8ce933caa50fb773
822
hpp
C++
src/aspell-60/common/error.hpp
reydajp/build-spell
a88ffbb9ffedae3f20933b187c95851e47e0e4c3
[ "MIT" ]
31
2016-11-08T05:13:02.000Z
2022-02-23T19:13:01.000Z
src/aspell-60/common/error.hpp
reydajp/build-spell
a88ffbb9ffedae3f20933b187c95851e47e0e4c3
[ "MIT" ]
6
2017-01-17T20:21:55.000Z
2021-09-02T07:36:18.000Z
src/aspell-60/common/error.hpp
reydajp/build-spell
a88ffbb9ffedae3f20933b187c95851e47e0e4c3
[ "MIT" ]
5
2017-07-11T11:10:55.000Z
2022-02-14T01:55:16.000Z
/* This file is part of The New Aspell * Copyright (C) 2001-2002 by Kevin Atkinson under the GNU LGPL * license version 2.0 or 2.1. You should have received a copy of the * LGPL license along with this library if you did not you can find it * at http://www.gnu.org/. */ #ifndef ASPELL_ERROR__HPP #define ASPELL_ERROR__HPP namespace acommon { struct ErrorInfo; struct Error { const char * mesg; // expected to be allocated with malloc const ErrorInfo * err; Error() : mesg(0), err(0) {} Error(const Error &); Error & operator=(const Error &); ~Error(); bool is_a(const ErrorInfo * e) const; }; struct ErrorInfo { const ErrorInfo * isa; const char * mesg; unsigned int num_parms; const char * parms[3]; }; } #endif /* ASPELL_ERROR__HPP */
21.631579
74
0.647202
reydajp
944fd654a145a501e39a490b0cbe8956d80ae612
2,743
cpp
C++
src/dfm/nodestore/impl/DatabaseRotatingImp.cpp
dfm-official/dfm
97f133aa87b17c760b90f2358d6ba10bc7ad9d1f
[ "ISC" ]
null
null
null
src/dfm/nodestore/impl/DatabaseRotatingImp.cpp
dfm-official/dfm
97f133aa87b17c760b90f2358d6ba10bc7ad9d1f
[ "ISC" ]
null
null
null
src/dfm/nodestore/impl/DatabaseRotatingImp.cpp
dfm-official/dfm
97f133aa87b17c760b90f2358d6ba10bc7ad9d1f
[ "ISC" ]
null
null
null
#include <ripple/nodestore/impl/DatabaseRotatingImp.h> #include <ripple/app/ledger/Ledger.h> #include <ripple/protocol/HashPrefix.h> namespace ripple { namespace NodeStore { DatabaseRotatingImp::DatabaseRotatingImp( std::string const& name, Scheduler& scheduler, int readThreads, Stoppable& parent, std::unique_ptr<Backend> writableBackend, std::unique_ptr<Backend> archiveBackend, Section const& config, beast::Journal j) : DatabaseRotating(name, parent, scheduler, readThreads, config, j) , pCache_(std::make_shared<TaggedCache<uint256, NodeObject>>( name, cacheTargetSize, cacheTargetAge, stopwatch(), j)) , nCache_(std::make_shared<KeyCache<uint256>>( name, stopwatch(), cacheTargetSize, cacheTargetAge)) , writableBackend_(std::move(writableBackend)) , archiveBackend_(std::move(archiveBackend)) { if (writableBackend_) fdLimit_ += writableBackend_->fdlimit(); if (archiveBackend_) fdLimit_ += archiveBackend_->fdlimit(); } std::unique_ptr<Backend> DatabaseRotatingImp::rotateBackends( std::unique_ptr<Backend> newBackend) { auto oldBackend {std::move(archiveBackend_)}; archiveBackend_ = std::move(writableBackend_); writableBackend_ = std::move(newBackend); return oldBackend; } void DatabaseRotatingImp::store(NodeObjectType type, Blob&& data, uint256 const& hash, std::uint32_t seq) { #if RIPPLE_VERIFY_NODEOBJECT_KEYS assert(hash == sha512Hash(makeSlice(data))); #endif auto nObj = NodeObject::createObject(type, std::move(data), hash); pCache_->canonicalize(hash, nObj, true); getWritableBackend()->store(nObj); nCache_->erase(hash); storeStats(nObj->getData().size()); } bool DatabaseRotatingImp::asyncFetch(uint256 const& hash, std::uint32_t seq, std::shared_ptr<NodeObject>& object) { object = pCache_->fetch(hash); if (object || nCache_->touch_if_exists(hash)) return true; Database::asyncFetch(hash, seq, pCache_, nCache_); return false; } void DatabaseRotatingImp::tune(int size, std::chrono::seconds age) { pCache_->setTargetSize(size); pCache_->setTargetAge(age); nCache_->setTargetSize(size); nCache_->setTargetAge(age); } void DatabaseRotatingImp::sweep() { pCache_->sweep(); nCache_->sweep(); } std::shared_ptr<NodeObject> DatabaseRotatingImp::fetchFrom(uint256 const& hash, std::uint32_t seq) { Backends b = getBackends(); auto nObj = fetchInternal(hash, *b.writableBackend); if (! nObj) { nObj = fetchInternal(hash, *b.archiveBackend); if (nObj) { getWritableBackend()->store(nObj); nCache_->erase(hash); } } return nObj; } } }
25.165138
71
0.689391
dfm-official
944fda07448a9014ed2901afeb52a5a82ad724cd
791
cpp
C++
Cpp/821 Shortest distance to a character.cpp
QuincyWork/AllCodes
59fe045608dda924cb993dde957da4daff769438
[ "MIT" ]
null
null
null
Cpp/821 Shortest distance to a character.cpp
QuincyWork/AllCodes
59fe045608dda924cb993dde957da4daff769438
[ "MIT" ]
null
null
null
Cpp/821 Shortest distance to a character.cpp
QuincyWork/AllCodes
59fe045608dda924cb993dde957da4daff769438
[ "MIT" ]
1
2019-04-01T10:30:03.000Z
2019-04-01T10:30:03.000Z
#include <gtest\gtest.h> #include <numeric> #include <queue> using namespace std; vector<int> shortestToChar(string S, char C) { queue<int> position; for (int i = 0; i < S.length(); ++i) { if (S[i] == C) { position.push(i); } } int next = position.front(); int begin = -next; position.pop(); vector<int> result; for (int i = 0; i < S.length(); ++i) { if (i > next) { begin = next; if (!position.empty()) { next = position.front(); position.pop(); } else { next = numeric_limits<int>::max(); } } result.push_back(std::min(i - begin, next - i)); } return result; } TEST(LeetCodeCN, tShortestToChar) { auto result = shortestToChar("loveleetcode", 'e'); result = shortestToChar("gtywtbcnowpwibfdgvph", 'i'); }
15.82
54
0.581542
QuincyWork
94520d5737d1866659c89becc9096c88d1150460
1,479
hpp
C++
include/nativecpp_tr.hpp
ferhatgec/native-cpp
d4a56447a099994f28ce95eb1a23aa995b763d22
[ "MIT" ]
6
2020-10-04T22:07:55.000Z
2021-02-18T15:40:03.000Z
include/nativecpp_tr.hpp
ferhatgec/native-cpp
d4a56447a099994f28ce95eb1a23aa995b763d22
[ "MIT" ]
null
null
null
include/nativecpp_tr.hpp
ferhatgec/native-cpp
d4a56447a099994f28ce95eb1a23aa995b763d22
[ "MIT" ]
null
null
null
/* MIT License # # Copyright (c) 2020 Ferhat Geçdoğan All Rights Reserved. # Distributed under the terms of the MIT License. # # */ /* For Turkish language. */ #ifndef NATIVE_CPP_TR_HPP #define NATIVE_CPP_TR_HPP #include <iostream> #define tur_tanimla typedef /* Character */ tur_tanimla char karakter; /* Integer */ tur_tanimla int tam; tur_tanimla uint8_t itam8; tur_tanimla int8_t tam8; tur_tanimla uint16_t itam16; tur_tanimla int16_t tam16; tur_tanimla uint32_t itam32; tur_tanimla int32_t tam32; tur_tanimla uint64_t itam64; tur_tanimla int64_t tam64; tur_tanimla unsigned isaretsiz; /* Floating point, decimal */ tur_tanimla float ondalik; tur_tanimla double cift; tur_tanimla long double uzuncift; tur_tanimla std::string dizgi; /* Boolean algebra */ tur_tanimla bool boole; tur_tanimla void dondurulemez; #define sirali (inline) /* Logical operators */ #define ve (and) #define ya_da (or) #define ve_esit (and_eq) #define esit (==) #define sonlandir (break) #define devam (continue) /* Main function */ #define ana (main) #define const sabit #define dogru (true) #define yanlis (false) #define dondur return #define eger if #define degilse else /* Automatic storage duration. */ #define otomatik auto #define __DOSYA__ __FILE__ #define __SATIR__ __LINE__ #define __ZAMAN__ __TIME__ #define sinif class #define genel public #define ozel private #define sabit static #define sanal virtual #define yenisatir '\n' #endif /* NATIVECPP_TR_HPP */
17.197674
57
0.762001
ferhatgec
94524131c04cd329a7467cb20148df5e865a809b
5,707
hpp
C++
Math/Geometry.hpp
GlynnJKW/Stratum
ddc55796f3207fe3df23c455c6304cb72aebcb02
[ "MIT" ]
2
2019-10-01T22:55:47.000Z
2019-10-04T20:25:29.000Z
Math/Geometry.hpp
Shmaug/vkCAVE
e502aedaf172047557f0454acb170a46b9d350f8
[ "MIT" ]
null
null
null
Math/Geometry.hpp
Shmaug/vkCAVE
e502aedaf172047557f0454acb170a46b9d350f8
[ "MIT" ]
null
null
null
#pragma once #include <Math/Math.hpp> struct Sphere { float3 mCenter; float mRadius; inline Sphere() : mCenter(float3()), mRadius(0) {} inline Sphere(const float3& center, float radius) : mCenter(center), mRadius(radius) {} }; struct AABB { float3 mMin; float3 mMax; AABB() : mMin(float3()), mMax(float3()) {} AABB(const float3& min, const float3& max) : mMin(min), mMax(max) {} AABB(const AABB& aabb) : mMin(aabb.mMin), mMax(aabb.mMax) {} AABB(const AABB& aabb, const float4x4& transform) : AABB(aabb) { *this *= transform; } inline float3 Center() const { return (mMax + mMin) * .5f; } inline float3 Extents() const { return (mMax - mMin) * .5f; } inline bool Intersects(const float3& point) const { float3 e = (mMax - mMin) * .5f; float3 s = point - (mMax + mMin) * .5f; return (s.x <= e.x && s.x >= -e.x) && (s.y <= e.y && s.y >= -e.y) && (s.z <= e.z && s.z >= -e.z); } inline bool Intersects(const Sphere& sphere) const { float3 e = (mMax - mMin) * .5f; float3 s = sphere.mCenter - (mMax + mMin) * .5f; float3 delta = e - s; float sqDist = 0.0f; for (int i = 0; i < 3; i++) { if (s[i] < -e[i]) sqDist += delta[i]; if (s[i] > e[i]) sqDist += delta[i]; } return sqDist <= sphere.mRadius * sphere.mRadius; } inline bool Intersects(const AABB& aabb) const { // for each i in (x, y, z) if a_min(i) > b_max(i) or b_min(i) > a_max(i) then return false bool dx = (mMin.x > aabb.mMax.x) || (aabb.mMin.x > mMax.x); bool dy = (mMin.y > aabb.mMax.y) || (aabb.mMin.y > mMax.y); bool dz = (mMin.z > aabb.mMax.z) || (aabb.mMin.z > mMax.z); return !(dx || dy || dz); } inline bool Intersects(const float4 frustum[6]) const { float3 center = Center(); float3 extent = Extents(); for (uint32_t i = 0; i < 6; i++) { float r = dot(extent, abs(frustum[i].xyz)); float d = dot(center, frustum[i].xyz) - frustum[i].w; if (d <= -r) return false; } return true; } inline void Encapsulate(const float3& p) { mMin = min(mMin, p); mMax = max(mMax, p); } inline void Encapsulate(const AABB& aabb) { mMin = min(aabb.mMin, mMin); mMax = max(aabb.mMax, mMax); } inline AABB operator *(const float4x4& transform) { return AABB(*this, transform); } inline AABB operator *=(const float4x4& transform) { float3 corners[8]{ mMax, // 1,1,1 float3(mMin.x, mMax.y, mMax.z), // 0,1,1 float3(mMax.x, mMax.y, mMin.z), // 1,1,0 float3(mMin.x, mMax.y, mMin.z), // 0,1,0 float3(mMax.x, mMin.y, mMax.z), // 1,0,1 float3(mMin.x, mMin.y, mMax.z), // 0,0,1 float3(mMax.x, mMin.y, mMin.z), // 1,0,0 mMin, // 0,0,0 }; for (uint32_t i = 0; i < 8; i++) corners[i] = (transform * float4(corners[i], 1)).xyz; mMin = corners[0]; mMax = corners[0]; for (uint32_t i = 1; i < 8; i++) { mMin = min(mMin, corners[i]); mMax = max(mMax, corners[i]); } return *this; } }; struct Ray { float3 mOrigin; float3 mDirection; inline Ray() : mOrigin(float3()), mDirection(float3(0,0,1)) {}; inline Ray(const float3& ro, const float3& rd) : mOrigin(ro), mDirection(rd) {}; inline float Intersect(const float4& plane) const { return -(dot(mOrigin, plane.xyz) + plane.w) / dot(mDirection, plane.xyz); } inline float Intersect(const float3& planeNormal, const float3& planePoint) const { return -dot(mOrigin - planePoint, planeNormal) / dot(mDirection, planeNormal); } inline bool Intersect(const AABB& aabb, float2& t) const { float3 id = 1.f / mDirection; float3 pmin = (aabb.mMin - mOrigin) * id; float3 pmax = (aabb.mMax - mOrigin) * id; float3 mn, mx; mn.x = id.x >= 0.f ? pmin.x : pmax.x; mn.y = id.y >= 0.f ? pmin.y : pmax.y; mn.z = id.z >= 0.f ? pmin.z : pmax.z; mx.x = id.x >= 0.f ? pmax.x : pmin.x; mx.y = id.y >= 0.f ? pmax.y : pmin.y; mx.z = id.z >= 0.f ? pmax.z : pmin.z; t = float2(fmaxf(fmaxf(mn.x, mn.y), mn.z), fminf(fminf(mx.x, mx.y), mx.z)); return t.y > t.x; } inline bool Intersect(const Sphere& sphere, float2& t) const { float3 pq = mOrigin - sphere.mCenter; float a = dot(mDirection, mDirection); float b = 2 * dot(pq, mDirection); float c = dot(pq, pq) - sphere.mRadius * sphere.mRadius; float d = b * b - 4 * a * c; if (d < 0.f) return false; d = sqrt(d); t = -.5f * float2(b + d, b - d) / a; return true; } inline bool Intersect(float3 v0, float3 v1, float3 v2, float3* tuv) const { // http://jcgt.org/published/0002/01/05/paper.pdf v0 -= mOrigin; v1 -= mOrigin; v2 -= mOrigin; float3 rd = mDirection; float3 ad = abs(mDirection); uint32_t largesti = 0; if (ad[largesti] < ad[1]) largesti = 1; if (ad[largesti] < ad[2]) largesti = 2; float idz; float2 rdz; if (largesti == 0) { v0 = float3(v0.y, v0.z, v0.x); v1 = float3(v1.y, v1.z, v1.x); v2 = float3(v2.y, v2.z, v2.x); idz = 1.f / rd.x; rdz = float2(rd.y, rd.z) * idz; } else if (largesti == 1) { v0 = float3(v0.z, v0.x, v0.y); v1 = float3(v1.z, v1.x, v1.y); v2 = float3(v2.z, v2.x, v2.y); idz = 1.f / rd.y; rdz = float2(rd.z, rd.x) * idz; } else { idz = 1.f / rd.z; rdz = float2(rd.x, rd.y) * idz; } v0 = float3(v0.x - v0.z * rdz.x, v0.y - v0.z * rdz.y, v0.z * idz); v1 = float3(v1.x - v1.z * rdz.x, v1.y - v1.z * rdz.y, v1.z * idz); v2 = float3(v2.x - v2.z * rdz.x, v2.y - v2.z * rdz.y, v2.z * idz); float u = v2.x * v1.y - v2.y * v1.x; float v = v0.x * v2.y - v0.y * v2.x; float w = v1.x * v0.y - v1.y * v0.x; if ((u < 0 || v < 0 || w < 0) && (u > 0 || v > 0 || w > 0)) return false; float det = u + v + w; if (det == 0) return false; // co-planar float t = u * v0.z + v * v1.z + w * v2.z; if (tuv) *tuv = float3(t, u, v) / det; return true; } };
29.569948
92
0.574382
GlynnJKW
94550e3ee33e359fa7324f280541daf2b1d3a1e7
2,967
hpp
C++
src/Backend.hpp
VetoProjects/ShaderSandbox
5ee34badb690cff611f105fbe9bc56e7ca219515
[ "MIT" ]
2
2015-01-26T17:17:14.000Z
2015-02-07T18:07:51.000Z
src/Backend.hpp
VetoProjects/ShaderSandbox
5ee34badb690cff611f105fbe9bc56e7ca219515
[ "MIT" ]
null
null
null
src/Backend.hpp
VetoProjects/ShaderSandbox
5ee34badb690cff611f105fbe9bc56e7ca219515
[ "MIT" ]
1
2019-12-19T15:06:45.000Z
2019-12-19T15:06:45.000Z
#ifndef BACKEND_HPP #define BACKEND_HPP #include <QDesktopServices> #include <QUrl> #include "SettingsBackend.hpp" #include "SettingsWindow.hpp" #include "LiveThread.hpp" #include "Instances/IInstance.hpp" using namespace Instances; /** * @brief The Backend class * * The heart and soul of the eidtors functionality. * Is connected to all the other parts of the application * (through SIGNALs as well as references) and keeps track * of all the windows and code evaluation threads that are created * and deleted. */ class Backend : public QObject { Q_OBJECT public: static QDir directoryOf(const QString&) noexcept; explicit Backend(QObject *parent = 0); ~Backend(); void addInstance(IInstance *, bool = true) noexcept; void childExited(IInstance *, QString) noexcept; bool isLast() noexcept; bool removeInstance(IInstance*, bool = true) noexcept; bool removeInstance(int, bool = true) noexcept; void removeSettings(IInstance*) noexcept; void removeSettings(int) noexcept; void saveAllSettings() noexcept; void saveSettings(IInstance *, QString) noexcept; QHash<QString, QVariant> getSettings(IInstance *) noexcept; QHash<QString, QVariant> getSettings(int id) noexcept; int nextID() noexcept; QList<int> loadIds() noexcept; QVariant getSetting(QString key, QVariant defaultValue = QVariant()) noexcept; Q_SIGNALS: void warningSignal(QWidget*, QString); void closeAction(); void saveAction(); void showResults(const QString &); void childDoSaveSettings(); public Q_SLOTS: void settingsWindowRequested(IInstance*) noexcept; void openHelp(IInstance *) noexcept; void instanceClosing(IInstance *) noexcept; void instanceDestroyed(QObject*) noexcept; void instanceRunCode(IInstance *) noexcept; void instanceStopCode(IInstance *) noexcept; void instanceChangedSetting(IInstance *, const QString &key, const QVariant &value) noexcept; void instanceRequestSetting(IInstance *, const QString &key, QVariant &value) noexcept; void instanceChangedSettings(IInstance *, const QHash<QString, QVariant> &) noexcept; void instanceRequestSettings(IInstance *, QHash<QString, QVariant> &) noexcept; void instanceLoadModel(IInstance*, const QString &, const QVector3D &, const QVector3D &, const QVector3D &) noexcept; // void instanceRemoveID(IInstance *instance); void childSaidCloseAll() noexcept; void getExecutionResults(GlLiveThread*, QString) noexcept; void getError(GlLiveThread*, QString) noexcept; void getVertexError(GlLiveThread*, QString, int) noexcept; void getFragmentError(GlLiveThread*, QString, int) noexcept; private: void runGlFile(IInstance *) noexcept; void terminateThread(long id) noexcept; void saveIDs() noexcept; QList<int> ids; QHash<long, std::shared_ptr<IInstance>> instances; QHash<long, std::shared_ptr<LiveThread>> threads; }; #endif // BACKEND_HPP
35.746988
122
0.738456
VetoProjects
9458b9e8951239ec7dae718a1eb5b1b4c3c2560c
551
cpp
C++
src/components/player.cpp
wareya/kotareci
14c87d1364d442456f93cebe73a288f85b79ba74
[ "Libpng" ]
null
null
null
src/components/player.cpp
wareya/kotareci
14c87d1364d442456f93cebe73a288f85b79ba74
[ "Libpng" ]
null
null
null
src/components/player.cpp
wareya/kotareci
14c87d1364d442456f93cebe73a288f85b79ba74
[ "Libpng" ]
null
null
null
#include "gamecomponents.hpp" #include "player.hpp" namespace Sys { Player::Player(entityid_t myEntity, const char * name) : Component(myEntity), character(nullptr), name(name), myself(false) { spawntimer = -1; Players.add(this); puts("MAKING A PLAYER"); } Player::~Player() { delete character; Players.remove(this); } void Player::spawn(double x, double y) { if(!character) character = new Character(entityID, x, y); } Collection<Player> Players; }
22.958333
127
0.593466
wareya
94618d4bccdcb327d8e6bea600a3a3d5b95fe3f8
902
cpp
C++
Engine/resourcemodelselect.cpp
vadkasevas/BAS
657f62794451c564c77d6f92b2afa9f5daf2f517
[ "MIT" ]
302
2016-05-20T12:55:23.000Z
2022-03-29T02:26:14.000Z
Engine/resourcemodelselect.cpp
chulakshana/BAS
955f5a41bd004bcdd7d19725df6ab229b911c09f
[ "MIT" ]
9
2016-07-21T09:04:50.000Z
2021-05-16T07:34:42.000Z
Engine/resourcemodelselect.cpp
chulakshana/BAS
955f5a41bd004bcdd7d19725df6ab229b911c09f
[ "MIT" ]
113
2016-05-18T07:48:37.000Z
2022-02-26T12:59:39.000Z
#include "resourcemodelselect.h" #include "every_cpp.h" namespace BrowserAutomationStudioFramework { ResourceModelSelect::ResourceModelSelect(QObject *parent) : ResourceModelAbstract(parent) { Type = Combo; } QStringList ResourceModelSelect::GetValues() { return Values; } void ResourceModelSelect::SetValues(const QStringList& val) { Values = val; } QList<int> ResourceModelSelect::GetSelected() { return Selected; } void ResourceModelSelect::SetSelected(const QList<int>& val) { Selected = val; } QString ResourceModelSelect::GetTypeId() { return QString("Select"); } ResourceModelSelect::SelectType ResourceModelSelect::GetSelectType() { return Type; } void ResourceModelSelect::SetSelectType(SelectType val) { Type = val; } }
20.976744
72
0.63969
vadkasevas
946276e2f18418d699aca9429a5b2ba553f9896d
7,477
cpp
C++
language-extensions/R/src/RParamContainer.cpp
rabryst/sql-server-language-extensions
a6a25890d1c3e449537eaaafab706c6c1e8b51cb
[ "MIT" ]
82
2019-05-24T00:36:57.000Z
2022-02-21T23:51:46.000Z
language-extensions/R/src/RParamContainer.cpp
rabryst/sql-server-language-extensions
a6a25890d1c3e449537eaaafab706c6c1e8b51cb
[ "MIT" ]
20
2019-07-05T06:12:28.000Z
2022-03-31T20:48:30.000Z
language-extensions/R/src/RParamContainer.cpp
rabryst/sql-server-language-extensions
a6a25890d1c3e449537eaaafab706c6c1e8b51cb
[ "MIT" ]
35
2019-05-24T01:44:07.000Z
2022-02-28T13:29:44.000Z
//************************************************************************************************** // RExtension : A language extension implementing the SQL Server // external language communication protocol for R. // Copyright (C) 2020 Microsoft Corporation. // // This file is part of RExtension. // // RExtension 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. // // RExtension 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 RExtension. If not, see <https://www.gnu.org/licenses/>. // // @File: RParamContainer.cpp // // Purpose: // RExtension input/output parameters wrappers, along with the container consolidating them. // //************************************************************************************************** #include "Common.h" #include "RParam.h" #include "RParamContainer.h" using namespace std; //-------------------------------------------------------------------------------------------------- // Function map - maps a ODBC C data type to the appropriate param creator // const RParamContainer::CreateParamFnMap RParamContainer::sm_FnCreateParamMap = { {static_cast<SQLSMALLINT>(SQL_C_SLONG), static_cast<fnCreateParam>(&RParamContainer::CreateParam <RParamTemplate<SQLINTEGER, Rcpp::IntegerVector, int, SQL_C_SLONG>>)}, {static_cast<SQLSMALLINT>(SQL_C_SBIGINT), static_cast<fnCreateParam>(&RParamContainer::CreateParam <RParamTemplate<SQLBIGINT, Rcpp::NumericVector, double, SQL_C_SBIGINT>>)}, {static_cast<SQLSMALLINT>(SQL_C_FLOAT), static_cast<fnCreateParam>(&RParamContainer::CreateParam <RParamTemplate<SQLREAL, Rcpp::NumericVector, double, SQL_C_FLOAT>>)}, {static_cast<SQLSMALLINT>(SQL_C_DOUBLE), static_cast<fnCreateParam>(&RParamContainer::CreateParam <RParamTemplate<SQLDOUBLE, Rcpp::NumericVector, double, SQL_C_DOUBLE>>)}, {static_cast<SQLSMALLINT>(SQL_C_SSHORT), static_cast<fnCreateParam>(&RParamContainer::CreateParam <RParamTemplate<SQLSMALLINT, Rcpp::IntegerVector, int, SQL_C_SSHORT>>)}, {static_cast<SQLSMALLINT>(SQL_C_UTINYINT), static_cast<fnCreateParam>(&RParamContainer::CreateParam <RParamTemplate<SQLCHAR, Rcpp::IntegerVector, int, SQL_C_UTINYINT>>)}, {static_cast<SQLSMALLINT>(SQL_C_BIT), static_cast<fnCreateParam>(&RParamContainer::CreateParam <RParamTemplate<SQLCHAR, Rcpp::LogicalVector, int, SQL_C_BIT>>)}, {static_cast<SQLSMALLINT>(SQL_C_CHAR), static_cast<fnCreateParam>(&RParamContainer::CreateParam<RCharacterParam<char, SQLCHAR>>)}, {static_cast<SQLSMALLINT>(SQL_C_WCHAR), static_cast<fnCreateParam>(&RParamContainer::CreateParam<RCharacterParam<char16_t, SQLWCHAR>>)}, {static_cast<SQLSMALLINT>(SQL_C_BINARY), static_cast<fnCreateParam>(&RParamContainer::CreateParam<RRawParam>)}, {static_cast<SQLSMALLINT>(SQL_C_TYPE_DATE), static_cast<fnCreateParam>(&RParamContainer::CreateParam <RDateTimeParam<SQL_DATE_STRUCT, Rcpp::DateVector, Rcpp::Date>>)}, {static_cast<SQLSMALLINT>(SQL_C_TYPE_TIMESTAMP), static_cast<fnCreateParam>(&RParamContainer::CreateParam <RDateTimeParam<SQL_TIMESTAMP_STRUCT, Rcpp::DatetimeVector, Rcpp::Datetime>>)}, {static_cast<SQLSMALLINT>(SQL_C_NUMERIC), static_cast<fnCreateParam>(&RParamContainer::CreateParam<RNumericParam>)}, }; //-------------------------------------------------------------------------------------------------- // Name: RParamContainer::Init // // Description: // Initialize this container with the number of parameters. // void RParamContainer::Init(SQLSMALLINT paramsNumber) { LOG("RParamContainer::Init"); m_params.resize(paramsNumber); } //-------------------------------------------------------------------------------------------------- // Name: RParamContainer::AddParamToEmbeddedR // // Description: // Creates an RParam object containing an RcppVector, assigns the parameter name to this // RcppVector so that the underlying R object can be accessed via this parameter name in the // embedded R environment. // Eventually, adds the RParam to m_params for future use. // Creation is done by calling the respective constructor based on the datatype. // void RParamContainer::AddParamToEmbeddedR( SQLUSMALLINT paramNumber, const SQLCHAR *paramName, SQLSMALLINT paramNameLength, SQLSMALLINT dataType, SQLULEN paramSize, SQLSMALLINT decimalDigits, SQLPOINTER paramValue, SQLINTEGER strLen_or_Ind, SQLSMALLINT inputOutputType) { LOG("RParamContainer::AddParamToEmbeddedR"); CreateParamFnMap::const_iterator it = sm_FnCreateParamMap.find(dataType); if (it == sm_FnCreateParamMap.end()) { throw runtime_error("Unsupported parameter type encountered when creating param #" + to_string(paramNumber)); } (this->*it->second)( paramNumber, paramName, paramNameLength, dataType, paramSize, decimalDigits, paramValue, strLen_or_Ind, inputOutputType); } //-------------------------------------------------------------------------------------------------- // Name: RParamContainer::CreateParam // // Description: // Creates an RParam object, adds the parameter with paramValue for given dataType // to the Embedded R environment and stores it in m_params for future use. // template<class RParamType> void RParamContainer::CreateParam( SQLUSMALLINT paramNumber, const SQLCHAR *paramName, SQLSMALLINT paramNameLength, SQLSMALLINT dataType, SQLULEN paramSize, SQLSMALLINT decimalDigits, SQLPOINTER paramValue, SQLINTEGER strLen_or_Ind, SQLSMALLINT inputOutputType) { LOG("RParamContainer::CreateParam"); unique_ptr<RParam> paramToBeAdded = make_unique<RParamType>( paramNumber, paramName, paramNameLength, dataType, paramSize, decimalDigits, paramValue, strLen_or_Ind, inputOutputType); RInside* embeddedREnvPtr = REnvironment::EmbeddedREnvironment(); (*embeddedREnvPtr)[paramToBeAdded.get()->Name().c_str()] = static_cast<RParamType*>( paramToBeAdded.get())->RcppVector(); Logger::LogRVariable(paramToBeAdded.get()->Name()); m_params[paramNumber] = std::move(paramToBeAdded); } //-------------------------------------------------------------------------------------------------- // Name: RParamContainer::GetParamValueAndStrLenInd // // Description: // For the given paramNumber, calls RetriveValueAndStrLenOrInd() to retrieve the value from R and // returns it via paramValue. Return the strLenOrInd as well. // void RParamContainer::GetParamValueAndStrLenInd( SQLUSMALLINT paramNumber, SQLPOINTER *paramValue, SQLINTEGER *strLen_or_Ind) { LOG("RParamContainer::GetParamValueAndStrLenInd"); if (m_params[paramNumber] == nullptr) { throw runtime_error("InitParam not called for param #" + to_string(paramNumber)); } RParam *param = m_params[paramNumber].get(); if (param->InputOutputType() < SQL_PARAM_INPUT_OUTPUT) { throw runtime_error("Requested param #" + to_string(paramNumber) + " is not initialized as an output parameter"); } // Retrieve the value from R // param->RetrieveValueAndStrLenInd(); *paramValue = param->Value(); *strLen_or_Ind = param->StrLenOrInd(); }
35.947115
100
0.6956
rabryst
9462f806e416cf8bea8ec122a7810f8366adfcdf
5,006
cpp
C++
test/rules/constrictor_ruleset_test.cpp
TheApX/battlesnake-engine-cpp
05053f06ecc631f037417bd0d897b28f48dfe07d
[ "MIT" ]
3
2021-07-05T22:42:26.000Z
2021-07-29T12:14:43.000Z
test/rules/constrictor_ruleset_test.cpp
TheApX/battlesnake-engine-cpp
05053f06ecc631f037417bd0d897b28f48dfe07d
[ "MIT" ]
2
2021-07-12T00:11:57.000Z
2021-09-04T19:11:38.000Z
test/rules/constrictor_ruleset_test.cpp
TheApX/battlesnake-engine-cpp
05053f06ecc631f037417bd0d897b28f48dfe07d
[ "MIT" ]
null
null
null
#include "battlesnake/rules/constrictor_ruleset.h" #include "gmock/gmock.h" #include "gtest/gtest.h" namespace battlesnake { namespace rules { namespace { using ::testing::ElementsAre; using ::testing::ElementsAreArray; using ::testing::Eq; using ::testing::Field; using ::testing::IsFalse; using ::testing::IsTrue; using ::testing::Lt; template <class M> auto SnakeHealthIs(M m) { return Field(&Snake::health, m); } template <class M> auto SnakeBodyIs(const M& m) { return Field(&Snake::body, m); } class ConstrictorRulesetTest : public testing::Test { protected: std::vector<SnakeId> CreateSnakeIds(int n, StringPool& pool) { std::vector<SnakeId> result; result.reserve(n); for (int i = 0; i < n; ++i) { result.push_back(pool.Add("Snake" + std::to_string(n))); } return result; } }; TEST_F(ConstrictorRulesetTest, Sanity) { ConstrictorRuleset ruleset; BoardState state = ruleset.CreateInitialBoardState(0, 0, {}); EXPECT_THAT(state.width, Eq(0)); EXPECT_THAT(state.height, Eq(0)); EXPECT_THAT(state.snakes, ElementsAre()); BoardState new_state{}; ruleset.CreateNextBoardState(state, {}, 0, new_state); EXPECT_THAT(new_state.width, Eq(0)); EXPECT_THAT(new_state.height, Eq(0)); EXPECT_THAT(new_state.snakes, ElementsAre()); EXPECT_THAT(ruleset.IsGameOver(new_state), IsTrue()); } TEST_F(ConstrictorRulesetTest, NoFoodInitially) { ConstrictorRuleset ruleset; StringPool pool; BoardState state = ruleset.CreateInitialBoardState(11, 11, { pool.Add("snake1"), pool.Add("snake2"), }); EXPECT_THAT(state.Food(), ElementsAre()); } class ConstrictorCreateNextBoardStateTest : public ConstrictorRulesetTest {}; TEST_F(ConstrictorCreateNextBoardStateTest, KeepsHealth) { StringPool pool; BoardState initial_state{ .width = kBoardSizeSmall, .height = kBoardSizeSmall, .snakes = SnakesVector::Create({ Snake{ .id = pool.Add("one"), .body = SnakeBody::Create({ Point{1, 1}, Point{1, 2}, Point{1, 3}, }), .health = 100, }, }), }; // Disable spawning random food so that it doesn't interfere with tests. ConstrictorRuleset ruleset(StandardRuleset::Config{.food_spawn_chance = 0}); BoardState state{}; ruleset.CreateNextBoardState( initial_state, SnakeMovesVector::Create({{pool.Add("one"), Move::Down}}), 1, state); // Health shouldn't decrease. EXPECT_THAT(state.snakes, ElementsAre(SnakeHealthIs(Eq(100)))); } TEST_F(ConstrictorCreateNextBoardStateTest, GrowsSnake) { StringPool pool; BoardState initial_state{ .width = kBoardSizeSmall, .height = kBoardSizeSmall, .snakes = SnakesVector::Create({ Snake{ .id = pool.Add("one"), .body = SnakeBody::Create({ Point{1, 1}, Point{1, 2}, Point{1, 3}, }), .health = 100, }, }), }; // Disable spawning random food so that it doesn't interfere with tests. ConstrictorRuleset ruleset(StandardRuleset::Config{.food_spawn_chance = 0}); BoardState state{}; ruleset.CreateNextBoardState( initial_state, SnakeMovesVector::Create({{pool.Add("one"), Move::Down}}), 1, state); // Body should grow. EXPECT_THAT(state.snakes, ElementsAre(SnakeBodyIs(ElementsAreArray({ Point{1, 0}, Point{1, 1}, Point{1, 2}, Point{1, 2}, })))); } TEST_F(ConstrictorCreateNextBoardStateTest, DoesnGrowInitialSnake) { StringPool pool; BoardState initial_state{ .width = kBoardSizeSmall, .height = kBoardSizeSmall, .snakes = SnakesVector::Create({ Snake{ .id = pool.Add("one"), .body = SnakeBody::Create({ Point{1, 1}, Point{1, 1}, Point{1, 1}, }), .health = 100, }, }), }; // Disable spawning random food so that it doesn't interfere with tests. ConstrictorRuleset ruleset(StandardRuleset::Config{.food_spawn_chance = 0}); BoardState state{}; ruleset.CreateNextBoardState( initial_state, SnakeMovesVector::Create({{pool.Add("one"), Move::Down}}), 1, state); // Body shouldn't grow. EXPECT_THAT(state.snakes, ElementsAre(SnakeBodyIs(ElementsAreArray({ Point{1, 0}, Point{1, 1}, Point{1, 1}, })))); } } // namespace } // namespace rules } // namespace battlesnake
28.936416
79
0.571314
TheApX
9463985d3a5965cf52c7570db3c4457fba14df66
379
cpp
C++
libmuscle/cpp/src/libmuscle/logger.cpp
DongweiYe/muscle3
0c2fcf5f62995b8639fc84ce1b983c8a8e6248d0
[ "Apache-2.0" ]
11
2018-03-12T10:43:46.000Z
2020-06-01T10:58:56.000Z
libmuscle/cpp/src/libmuscle/logger.cpp
DongweiYe/muscle3
0c2fcf5f62995b8639fc84ce1b983c8a8e6248d0
[ "Apache-2.0" ]
85
2018-03-03T15:10:56.000Z
2022-03-18T14:05:14.000Z
libmuscle/cpp/src/libmuscle/logger.cpp
DongweiYe/muscle3
0c2fcf5f62995b8639fc84ce1b983c8a8e6248d0
[ "Apache-2.0" ]
6
2018-03-12T10:47:11.000Z
2022-02-03T13:44:07.000Z
#include <libmuscle/logger.hpp> namespace libmuscle { namespace impl { Logger::Logger(std::string const & instance_id, MMPClient & manager) : instance_id_(instance_id) , manager_(manager) , remote_level_(LogLevel::WARNING) {} void Logger::set_remote_level(LogLevel level) { remote_level_ = level; } void Logger::append_args_(std::ostringstream & s) {} } }
18.95
68
0.71504
DongweiYe
9465839ceef5f41267f638965207206ecc2468da
66
cpp
C++
tutorials/learncpp.com#1.0#1/composition/container_classes/source1.cpp
officialrafsan/CppDroid
5fb2cc7750fea53b1ea6ff47b5094da6e95e9224
[ "MIT" ]
null
null
null
tutorials/learncpp.com#1.0#1/composition/container_classes/source1.cpp
officialrafsan/CppDroid
5fb2cc7750fea53b1ea6ff47b5094da6e95e9224
[ "MIT" ]
null
null
null
tutorials/learncpp.com#1.0#1/composition/container_classes/source1.cpp
officialrafsan/CppDroid
5fb2cc7750fea53b1ea6ff47b5094da6e95e9224
[ "MIT" ]
null
null
null
#ifndef INTARRAY_H #define INTARRAY_H class IntArray { }; #endif
8.25
18
0.757576
officialrafsan
946651724ceea5e08f0de6d5f6bcceaecdcec9cf
506
cpp
C++
2160/2160.cpp
isac322/BOJ
35959dd1a63d75ebca9ed606051f7a649d5c0c7b
[ "MIT" ]
14
2017-05-02T02:00:42.000Z
2021-11-16T07:25:29.000Z
2160/2160.cpp
isac322/BOJ
35959dd1a63d75ebca9ed606051f7a649d5c0c7b
[ "MIT" ]
1
2017-12-25T14:18:14.000Z
2018-02-07T06:49:44.000Z
2160/2160.cpp11.cpp
isac322/BOJ
35959dd1a63d75ebca9ed606051f7a649d5c0c7b
[ "MIT" ]
9
2016-03-03T22:06:52.000Z
2020-04-30T22:06:24.000Z
#include <cstdio> char p[50][5][8]; inline int c(int a, int b) { int cnt = 0; for (int i = 0; i < 5; i++) for (int j = 0; j < 7; j++) if (p[a][i][j] != p[b][i][j]) cnt++; return cnt; } int main() { int n, m = 35, a, b; scanf("%d\n", &n); for (int i = 0; i < n; i++) for (int j = 0; j < 5; j++) gets(p[i][j]); for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { const int &r = c(i, j); if (r < m) { m = r; a = i; b = j; } } } printf("%d %d", a + 1, b + 1); }
19.461538
93
0.397233
isac322
946900e0b8cd9fcacb7d914031f096569f929d5f
3,977
cpp
C++
NinjaVsZombie/POC - C++/source/LevelManager.cpp
Cabrra/SPG-Project
7602de287b750c882f9fe9e2bc57e0492d36a76f
[ "MIT" ]
null
null
null
NinjaVsZombie/POC - C++/source/LevelManager.cpp
Cabrra/SPG-Project
7602de287b750c882f9fe9e2bc57e0492d36a76f
[ "MIT" ]
null
null
null
NinjaVsZombie/POC - C++/source/LevelManager.cpp
Cabrra/SPG-Project
7602de287b750c882f9fe9e2bc57e0492d36a76f
[ "MIT" ]
null
null
null
#include "LevelManager.h" #include "../TinyXML/tinyxml.h" #include <sstream> #include <cstdlib> #include "Tile.h" LevelManager::LevelManager() { } LevelManager::~LevelManager() { delete m_pLevel; m_pLevel = nullptr; } bool LevelManager::LoadFile(const char* file) { TiXmlDocument doc; if (doc.LoadFile(file) == false) return false; else { TiXmlElement* root = doc.RootElement(); if (root == nullptr) return false; //load map/level info TiXmlElement* pLevel = root->FirstChildElement("Level"); char levelName[12]; int numRooms; char bossName[16]; int levelrows, levelcols, levelwidth, levelheight; strcpy_s(levelName, 12, pLevel->Attribute("Name")); if (levelName == nullptr) return false; strcpy_s(bossName, 16, pLevel->Attribute("Boss")); if (bossName == nullptr) return false; pLevel->Attribute("NumOfRooms", &numRooms); pLevel->Attribute("Rows", &levelrows); pLevel->Attribute("Cols", &levelcols); pLevel->Attribute("Width", &levelwidth); pLevel->Attribute("Height", &levelheight); if (numRooms <= 0 || levelrows <= 0 || levelcols <= 0 || levelwidth <= 0 || levelheight <= 0) return false; m_pLevel = new Map(levelrows, levelcols, levelwidth, levelheight); //load tileset info char tilesetPath[100]; int tilesetrows, tilesetcols, tilesetwidth, tilesetheight; TiXmlElement* pTileset = root->FirstChildElement("Tileset"); strcpy_s(tilesetPath, 100, pTileset->Attribute("Path")); if (tilesetPath == nullptr) return false; pTileset->Attribute("Rows", &tilesetrows); pTileset->Attribute("Cols", &tilesetcols); pTileset->Attribute("Width", &tilesetwidth); pTileset->Attribute("Height", &tilesetheight); if (tilesetrows <= 0 || tilesetcols <= 0 || tilesetwidth <= 0 || tilesetheight <= 0) return false; //initialize map and tile set m_pLevel->InitializeTileset(tilesetPath, tilesetcols, tilesetrows, tilesetwidth, tilesetheight); m_pLevel->InitializeMap(); //load tile info TiXmlElement* pTilelist = root->FirstChildElement("Tile_List"); TiXmlElement* pTile = pTilelist->FirstChildElement("Tile"); int rowcount = 0, colcount = 0; while (pTile != nullptr) { if (colcount >= m_pLevel->GetGridColumnNum()) { rowcount++; colcount = 0; } int id; int type; pTile->Attribute("Id", &id); pTile->Attribute("Type", &type); if (type < 1 || type > 4) return false; m_pLevel->SetTile(colcount, rowcount, id, (Tile::m_eTiletype)type); colcount++; pTile = pTile->NextSiblingElement("Tile"); } } return true; } void LevelManager::SaveFile() { //create tinyXML Document TiXmlDocument doc; //create a tinyXML Declaration TiXmlDeclaration* pDecl = new TiXmlDeclaration{ "1.0", "utf-8", "" }; //link the declaration to the doc doc.LinkEndChild(pDecl); //all the levels TiXmlElement* pRoot = new TiXmlElement{ "Level_Info" }; //link the root to the document doc.LinkEndChild(pRoot); TiXmlElement* pLevel = new TiXmlElement{ "Level" }; pRoot->LinkEndChild(pLevel); pLevel->SetAttribute("Name", "Test Level"); pLevel->SetAttribute("NumOfRooms", 1); pLevel->SetAttribute("Boss", "None"); pLevel->SetAttribute("Rows", 5); pLevel->SetAttribute("Cols", 5); pLevel->SetAttribute("Width", 32); pLevel->SetAttribute("Height", 32); TiXmlElement* pTileset = new TiXmlElement{ "Tileset" }; pRoot->LinkEndChild(pTileset); pTileset->SetAttribute("Path", "resource/Graphics/test_tileset.png"); pTileset->SetAttribute("Rows", 15); pTileset->SetAttribute("Cols", 15); pTileset->SetAttribute("Width", 32); pTileset->SetAttribute("Height", 32); TiXmlElement* pTilelist = new TiXmlElement{ "Tile_List" }; pRoot->LinkEndChild(pTilelist); for (int i = 0; i < 25; i++) { int id = rand() % 20; TiXmlElement* pTile = new TiXmlElement{ "Tile" }; pTilelist->LinkEndChild(pTile); pTile->SetAttribute("Id", id); pTile->SetAttribute("Type", 1); } doc.SaveFile("resource/XML/testfile.xml"); }
23.814371
98
0.687201
Cabrra
946eb5b09957fa538cd6af6ac65a4470202796d3
1,869
hpp
C++
src/include/RAII.hpp
whyamiroot/vulkalc
7ad50235d043aed86284c84ef5f2eea8dba36677
[ "MIT" ]
1
2018-01-19T00:29:49.000Z
2018-01-19T00:29:49.000Z
src/include/RAII.hpp
whyamiroot/vulkalc
7ad50235d043aed86284c84ef5f2eea8dba36677
[ "MIT" ]
4
2020-12-18T10:06:16.000Z
2020-12-18T10:09:25.000Z
src/include/RAII.hpp
whyamiroot/vulkalc
7ad50235d043aed86284c84ef5f2eea8dba36677
[ "MIT" ]
null
null
null
/* * The MIT License (MIT) * * Copyright (c) 2017 Lev Sizov * * 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. */ /*! * \file RAII.hpp * \brief RAII pattern interface * \author Lev Sizov * \date 28.05.17 * * This file contains RAII class which plays as interface for RAII pattern. */ #ifndef VULKALC_RAII_H #define VULKALC_RAII_H #include "Export.hpp" /*! * \copydoc Application */ namespace Vulkalc { /*! * \brief RAII class which plays as interface for RAII pattern * * Abstract class RAII, which plays as interface to implement RAII pattern */ class VULKALC_API RAII { protected: /*! * \brief Initializes a resource */ virtual void init() = 0; /*! * \brief Releases a resource */ virtual void release() = 0; }; } #endif //VULKALC_RAII_H
28.753846
80
0.702515
whyamiroot
946fd1b61af12a89a1c68896aea9425c55592921
3,109
cpp
C++
src/trie.cpp
AkshayMohan/contact-management
07f9f129db66735d8dc3a2fc81f3d24442a1509e
[ "MIT" ]
null
null
null
src/trie.cpp
AkshayMohan/contact-management
07f9f129db66735d8dc3a2fc81f3d24442a1509e
[ "MIT" ]
null
null
null
src/trie.cpp
AkshayMohan/contact-management
07f9f129db66735d8dc3a2fc81f3d24442a1509e
[ "MIT" ]
null
null
null
/*____________________________________________________________________________________ Contact Management System trie.cpp - Trie data structure class definition file. - Akshay Mohan MIT License Copyright (c) 2019 Akshay Mohan 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 "trie.h" Trie::Trie() { this->root = new Node(); } Node* Trie::insert(std::string key) { Node *temp = this->root; for(auto c : key) { if(temp->children.find(c) == temp->children.end()) temp->children[c] = new Node(); temp = temp->children[c]; } temp->end_of_word = true; return temp; } Node* Trie::search(Node *root, std::string key, bool *result) { for(auto c : key) { if(root->children.find(c) == root->children.end()) { *result = false; return nullptr; } root = root->children[c]; } *result = (root->end_of_word) ? true : false; return root; } Node* Trie::search(std::string key, bool *result) { return search(this->root, key, result); } bool Trie::exists(std::string key) { bool result; search(this->root, key, &result); return result; } bool Trie::remove(Node *root, char *key) { if(root == nullptr) return false; if(*key == '\0') { if(!root->end_of_word) return false; else root->end_of_word = false; } else { if((root->children.find(*key) == root->children.end()) || !remove(root->children[*key], key + 1)) return false; } if(root->children.empty()) delete root; return true; } bool Trie::remove(char *key) { return remove(this->root, key); } #ifdef _TRIE_DEBUG_MODE_ void Trie::display(Node *root, char *buffer, unsigned int idx) { if(root->end_of_word) { buffer[idx] = '\0'; std::cout << buffer << std::endl; } for(auto i : root->children) { buffer[idx] = i.first; display(i.second, buffer, idx + 1); } } void Trie::display() { char buffer[32]; display(this->root, buffer, 0); } #endif
24.480315
100
0.675137
AkshayMohan
20df8c3af0de78fe0f86e44b93f8062c1ed4baa7
2,253
cc
C++
felicia/python/thread/main_thread_py.cc
chokobole/felicia
3b5eeb5f93c59c5364d3932bc407e054977aa1ec
[ "BSD-3-Clause" ]
17
2018-10-28T13:58:01.000Z
2022-03-22T07:54:12.000Z
felicia/python/thread/main_thread_py.cc
chokobole/felicia
3b5eeb5f93c59c5364d3932bc407e054977aa1ec
[ "BSD-3-Clause" ]
2
2018-11-09T04:15:58.000Z
2018-11-09T06:42:57.000Z
felicia/python/thread/main_thread_py.cc
chokobole/felicia
3b5eeb5f93c59c5364d3932bc407e054977aa1ec
[ "BSD-3-Clause" ]
5
2019-10-31T06:50:05.000Z
2022-03-22T07:54:30.000Z
// Copyright (c) 2019 The Felicia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #if defined(FEL_PY_BINDING) #include "felicia/python/thread/main_thread_py.h" #include "felicia/core/thread/main_thread.h" #include "felicia/python/type_conversion/callback.h" namespace felicia { #if defined(OS_WIN) void PyMainThread::InitCOM(bool use_mta) { py::gil_scoped_release release; return MainThread::GetInstance().InitCOM(use_mta); } #endif bool PyMainThread::IsBoundToCurrentThread() const { py::gil_scoped_release release; return MainThread::GetInstance().IsBoundToCurrentThread(); } bool PyMainThread::PostTask(py::function callback) { PyClosure* closure = new PyClosure(callback); py::gil_scoped_release release; MainThread& main_thread = MainThread::GetInstance(); return main_thread.PostTask( FROM_HERE, base::BindOnce(&PyClosure::Invoke, base::Owned(closure))); } bool PyMainThread::PostDelayedTask(py::function callback, base::TimeDelta delay) { PyClosure* closure = new PyClosure(callback); py::gil_scoped_release release; MainThread& main_thread = MainThread::GetInstance(); return main_thread.PostDelayedTask( FROM_HERE, base::BindOnce(&PyClosure::Invoke, base::Owned(closure)), delay); } void PyMainThread::Run() { py::gil_scoped_release release; { py::gil_scoped_acquire acquire; acquire.inc_ref(); } MainThread::GetInstance().Run(); } void PyMainThread::Stop() { py::gil_scoped_release release; MainThread::GetInstance().Stop(); } void AddMainThread(py::module& m) { py::class_<PyMainThread>(m, "MainThread") #if defined(OS_WIN) .def("init_com", &PyMainThread::InitCOM, py::arg("use_mta")) #endif .def("is_bound_to_current_thread", &PyMainThread::IsBoundToCurrentThread) .def("post_task", &PyMainThread::PostTask, py::arg("callback")) .def("post_delayed_task", &PyMainThread::PostDelayedTask, py::arg("callback"), py::arg("delay")) .def("run", &PyMainThread::Run) .def("stop", &PyMainThread::Stop); m.attr("main_thread") = PyMainThread{}; } } // namespace felicia #endif // defined(FEL_PY_BINDING)
30.04
79
0.712383
chokobole
20e1ccc95c27380a715dcc4d587d9309fa62ee06
3,489
cpp
C++
variational_fluids/VariationalViscosity3D/levelset_util.cpp
OrionQuest/Nova_Examples
482521902bc3afa7d0caefeb9ce9595456384961
[ "Apache-2.0" ]
1
2022-02-01T18:04:45.000Z
2022-02-01T18:04:45.000Z
variational_fluids/VariationalViscosity3D/levelset_util.cpp
OrionQuest/Nova_Examples
482521902bc3afa7d0caefeb9ce9595456384961
[ "Apache-2.0" ]
null
null
null
variational_fluids/VariationalViscosity3D/levelset_util.cpp
OrionQuest/Nova_Examples
482521902bc3afa7d0caefeb9ce9595456384961
[ "Apache-2.0" ]
1
2018-12-30T00:49:36.000Z
2018-12-30T00:49:36.000Z
#include "levelset_util.h" //Given two signed distance values (line endpoints), determine what fraction of a connecting segment is "inside" float fraction_inside(float phi_left, float phi_right) { if(phi_left < 0 && phi_right < 0) return 1; if (phi_left < 0 && phi_right >= 0) return phi_left / (phi_left - phi_right); if(phi_left >= 0 && phi_right < 0) return phi_right / (phi_right - phi_left); else return 0; } static void cycle_array(float* arr, int size) { float t = arr[0]; for(int i = 0; i < size-1; ++i) arr[i] = arr[i+1]; arr[size-1] = t; } //Given four signed distance values (square corners), determine what fraction of the square is "inside" float fraction_inside(float phi_bl, float phi_br, float phi_tl, float phi_tr) { int inside_count = (phi_bl<0?1:0) + (phi_tl<0?1:0) + (phi_br<0?1:0) + (phi_tr<0?1:0); float list[] = { phi_bl, phi_br, phi_tr, phi_tl }; if(inside_count == 4) return 1; else if (inside_count == 3) { //rotate until the positive value is in the first position while(list[0] < 0) { cycle_array(list,4); } //Work out the area of the exterior triangle float side0 = 1-fraction_inside(list[0], list[3]); float side1 = 1-fraction_inside(list[0], list[1]); return 1 - 0.5f*side0*side1; } else if(inside_count == 2) { //rotate until a negative value is in the first position, and the next negative is in either slot 1 or 2. while(list[0] >= 0 || !(list[1] < 0 || list[2] < 0)) { cycle_array(list,4); } if(list[1] < 0) { //the matching signs are adjacent float side_left = fraction_inside(list[0], list[3]); float side_right = fraction_inside(list[1], list[2]); return 0.5f*(side_left + side_right); } else { //matching signs are diagonally opposite //determine the centre point's sign to disambiguate this case float middle_point = 0.25f*(list[0] + list[1] + list[2] + list[3]); if(middle_point < 0) { float area = 0; //first triangle (top left) float side1 = 1-fraction_inside(list[0], list[3]); float side3 = 1-fraction_inside(list[2], list[3]); area += 0.5f*side1*side3; //second triangle (top right) float side2 = 1-fraction_inside(list[2], list[1]); float side0 = 1-fraction_inside(list[0], list[1]); area += 0.5f*side0*side2; return 1-area; } else { float area = 0; //first triangle (bottom left) float side0 = fraction_inside(list[0], list[1]); float side1 = fraction_inside(list[0], list[3]); area += 0.5f*side0*side1; //second triangle (top right) float side2 = fraction_inside(list[2], list[1]); float side3 = fraction_inside(list[2], list[3]); area += 0.5f*side2*side3; return area; } } } else if(inside_count == 1) { //rotate until the negative value is in the first position while(list[0] >= 0) { cycle_array(list,4); } //Work out the area of the interior triangle, and subtract from 1. float side0 = fraction_inside(list[0], list[3]); float side1 = fraction_inside(list[0], list[1]); return 0.5f*side0*side1; } else return 0; }
33.548077
112
0.57495
OrionQuest
20e29f2b5cae32bdfa088f94e170950d54f0719d
590
cpp
C++
Anton_and_Letters.cpp
amit9amarwanshi/The_Quiet_Revolution
7713787ef27c0c144e4c2d852d826ee1c4176a95
[ "MIT" ]
null
null
null
Anton_and_Letters.cpp
amit9amarwanshi/The_Quiet_Revolution
7713787ef27c0c144e4c2d852d826ee1c4176a95
[ "MIT" ]
null
null
null
Anton_and_Letters.cpp
amit9amarwanshi/The_Quiet_Revolution
7713787ef27c0c144e4c2d852d826ee1c4176a95
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; #define ll long long int int main(){ ios::sync_with_stdio(0); cin.tie(0); string s; getline(cin,s); set<char>k; for(int i=0;i<s.length();i++){ if(s[i]=='a'||s[i]=='b'||s[i]=='c'||s[i]=='d'||s[i]=='e'||s[i]=='f'||s[i]=='g'||s[i]=='h'||s[i]=='i'||s[i]=='j'||s[i]=='k'||s[i]=='l'||s[i]=='m'||s[i]=='n'||s[i]=='o'||s[i]=='p'||s[i]=='q'||s[i]=='r'||s[i]=='s'||s[i]=='u'||s[i]=='v'||s[i]=='w'||s[i]=='x'||s[i]=='y'||s[i]=='z'||s[i]=='t'){ k.insert(s[i]); } } cout<<k.size(); return 0; }
32.777778
297
0.394915
amit9amarwanshi
20e39a1800584a041a68aba2a289e213fafd4d70
88,719
cpp
C++
Hacks/Esp.cpp
DanielBence/Atomware
e413b57b45f395c1f45a9230db4d7e94a3d72681
[ "MIT" ]
2
2020-06-18T11:07:55.000Z
2020-07-14T15:16:24.000Z
Hacks/Esp.cpp
DanielAtom/Atomware
e413b57b45f395c1f45a9230db4d7e94a3d72681
[ "MIT" ]
null
null
null
Hacks/Esp.cpp
DanielAtom/Atomware
e413b57b45f395c1f45a9230db4d7e94a3d72681
[ "MIT" ]
1
2020-11-04T07:15:30.000Z
2020-11-04T07:15:30.000Z
#define NOMINMAX #include <sstream> #include "Esp.h" #include "../Config.h" #include "../Interfaces.h" #include "../Memory.h" #include "../SDK/ConVar.h" #include "../SDK/Entity.h" #include "../SDK/GlobalVars.h" #include "../SDK/Localize.h" #include "../SDK/Surface.h" #include "../SDK/Vector.h" #include "../SDK/WeaponData.h" bool canHear(LocalPlayer& local, Entity& target) noexcept { bool x = target.velocity().length2D() > 110.0f; bool z = target.getShotsFired() >= 1; //bool y = isInRange(&target, 25.4f); bool y = (target.getAbsOrigin() - localPlayer->getAbsOrigin()).length() * 0.0254f <= 25.4f; bool smk = target.isVisible(); bool line = memory->lineGoesThroughSmoke(local->getEyePosition(), target.getBonePosition(8), 1); //return (x || z || smk) && (y || smk); return (x || z || (smk && !line)) && (y || (smk && !line)); } static constexpr bool worldToScreen(const Vector& in, Vector& out) noexcept { const auto& matrix = interfaces->engine->worldToScreenMatrix(); float w = matrix._41 * in.x + matrix._42 * in.y + matrix._43 * in.z + matrix._44; if (w > 0.001f) { const auto [width, height] = interfaces->surface->getScreenSize(); out.x = width / 2 * (1 + (matrix._11 * in.x + matrix._12 * in.y + matrix._13 * in.z + matrix._14) / w); out.y = height / 2 * (1 - (matrix._21 * in.x + matrix._22 * in.y + matrix._23 * in.z + matrix._24) / w); out.z = 0.0f; return true; } return false; } static void renderSnaplines(Entity* entity, const Config::Esp::Shared& config) noexcept { if (!config.snaplines.enabled) return; Vector position; if (!worldToScreen(entity->getAbsOrigin(), position)) return; if (config.snaplines.rainbow) interfaces->surface->setDrawColor(rainbowColor(memory->globalVars->realtime, config.snaplines.rainbowSpeed)); else interfaces->surface->setDrawColor(config.snaplines.color); const auto [width, height] = interfaces->surface->getScreenSize(); interfaces->surface->drawLine(width / 2, height, static_cast<int>(position.x), static_cast<int>(position.y)); } static void renderEyeTraces(Entity* entity, const Config::Esp::Player& config) noexcept { if (config.eyeTraces.enabled) { constexpr float maxRange{ 8192.0f }; auto eyeAngles = entity->eyeAngles(); Vector viewAngles{ cos(degreesToRadians(eyeAngles.x)) * cos(degreesToRadians(eyeAngles.y)) * maxRange, cos(degreesToRadians(eyeAngles.x)) * sin(degreesToRadians(eyeAngles.y)) * maxRange, -sin(degreesToRadians(eyeAngles.x)) * maxRange }; static Trace trace; Vector headPosition{ entity->getBonePosition(8) }; interfaces->engineTrace->traceRay({ headPosition, headPosition + viewAngles }, 0x46004009, { entity }, trace); Vector start, end; if (worldToScreen(trace.startpos, start) && worldToScreen(trace.endpos, end)) { if (config.eyeTraces.rainbow) interfaces->surface->setDrawColor(rainbowColor(memory->globalVars->realtime, config.eyeTraces.rainbowSpeed)); else interfaces->surface->setDrawColor(config.eyeTraces.color); interfaces->surface->drawLine(start.x, start.y, end.x, end.y); } } } static constexpr void renderPositionedText(unsigned font, const wchar_t* text, std::pair<float, float&> position) noexcept { interfaces->surface->setTextFont(font); interfaces->surface->setTextPosition(position.first, position.second); position.second += interfaces->surface->getTextSize(font, text).second; interfaces->surface->printText(text); } struct BoundingBox { float x0, y0; float x1, y1; Vector vertices[8]; BoundingBox(Entity* entity) noexcept { const auto [width, height] = interfaces->surface->getScreenSize(); x0 = static_cast<float>(width * 2); y0 = static_cast<float>(height * 2); x1 = -x0; y1 = -y0; const auto& mins = entity->getCollideable()->obbMins(); const auto& maxs = entity->getCollideable()->obbMaxs(); for (int i = 0; i < 8; ++i) { const Vector point{ i & 1 ? maxs.x : mins.x, i & 2 ? maxs.y : mins.y, i & 4 ? maxs.z : mins.z }; if (!worldToScreen(point.transform(entity->coordinateFrame()), vertices[i])) { valid = false; return; } x0 = std::min(x0, vertices[i].x); y0 = std::min(y0, vertices[i].y); x1 = std::max(x1, vertices[i].x); y1 = std::max(y1, vertices[i].y); } valid = true; } operator bool() noexcept { return valid; } private: bool valid; }; static void renderBox(const BoundingBox& bbox, const Config::Esp::Shared& config) noexcept { if (config.box.enabled) { if (config.box.rainbow) interfaces->surface->setDrawColor(rainbowColor(memory->globalVars->realtime, config.box.rainbowSpeed)); else interfaces->surface->setDrawColor(config.box.color); switch (config.boxType) { case 0: interfaces->surface->drawOutlinedRect(bbox.x0, bbox.y0, bbox.x1, bbox.y1); if (config.outline.enabled) { if (config.outline.rainbow) interfaces->surface->setDrawColor(rainbowColor(memory->globalVars->realtime, config.outline.rainbowSpeed)); else interfaces->surface->setDrawColor(config.outline.color); interfaces->surface->drawOutlinedRect(bbox.x0 + 1, bbox.y0 + 1, bbox.x1 - 1, bbox.y1 - 1); interfaces->surface->drawOutlinedRect(bbox.x0 - 1, bbox.y0 - 1, bbox.x1 + 1, bbox.y1 + 1); } break; case 1: interfaces->surface->drawLine(bbox.x0, bbox.y0, bbox.x0, bbox.y0 + fabsf(bbox.y1 - bbox.y0) / 4); interfaces->surface->drawLine(bbox.x0, bbox.y0, bbox.x0 + fabsf(bbox.x1 - bbox.x0) / 4, bbox.y0); interfaces->surface->drawLine(bbox.x1, bbox.y0, bbox.x1 - fabsf(bbox.x1 - bbox.x0) / 4, bbox.y0); interfaces->surface->drawLine(bbox.x1, bbox.y0, bbox.x1, bbox.y0 + fabsf(bbox.y1 - bbox.y0) / 4); interfaces->surface->drawLine(bbox.x0, bbox.y1, bbox.x0, bbox.y1 - fabsf(bbox.y1 - bbox.y0) / 4); interfaces->surface->drawLine(bbox.x0, bbox.y1, bbox.x0 + fabsf(bbox.x1 - bbox.x0) / 4, bbox.y1); interfaces->surface->drawLine(bbox.x1, bbox.y1, bbox.x1 - fabsf(bbox.x1 - bbox.x0) / 4, bbox.y1); interfaces->surface->drawLine(bbox.x1, bbox.y1, bbox.x1, bbox.y1 - fabsf(bbox.y1 - bbox.y0) / 4); if (config.outline.enabled) { if (config.outline.rainbow) interfaces->surface->setDrawColor(rainbowColor(memory->globalVars->realtime, config.outline.rainbowSpeed)); else interfaces->surface->setDrawColor(config.outline.color); // TODO: get rid of fabsf() interfaces->surface->drawLine(bbox.x0 - 1, bbox.y0 - 1, bbox.x0 - 1, bbox.y0 + fabsf(bbox.y1 - bbox.y0) / 4); interfaces->surface->drawLine(bbox.x0 - 1, bbox.y0 - 1, bbox.x0 + fabsf(bbox.x1 - bbox.x0) / 4, bbox.y0 - 1); interfaces->surface->drawLine(bbox.x1 + 1, bbox.y0 - 1, bbox.x1 - fabsf(bbox.x1 - bbox.x0) / 4, bbox.y0 - 1); interfaces->surface->drawLine(bbox.x1 + 1, bbox.y0 - 1, bbox.x1 + 1, bbox.y0 + fabsf(bbox.y1 - bbox.y0) / 4); interfaces->surface->drawLine(bbox.x0 - 1, bbox.y1 + 1, bbox.x0 - 1, bbox.y1 - fabsf(bbox.y1 - bbox.y0) / 4); interfaces->surface->drawLine(bbox.x0 - 1, bbox.y1 + 1, bbox.x0 + fabsf(bbox.x1 - bbox.x0) / 4, bbox.y1 + 1); interfaces->surface->drawLine(bbox.x1 + 1, bbox.y1 + 1, bbox.x1 - fabsf(bbox.x1 - bbox.x0) / 4, bbox.y1 + 1); interfaces->surface->drawLine(bbox.x1 + 1, bbox.y1 + 1, bbox.x1 + 1, bbox.y1 - fabsf(bbox.y1 - bbox.y0) / 4); interfaces->surface->drawLine(bbox.x0 + 1, bbox.y0 + 1, bbox.x0 + 1, bbox.y0 + fabsf(bbox.y1 - bbox.y0) / 4); interfaces->surface->drawLine(bbox.x0 + 2, bbox.y0 + 1, bbox.x0 + fabsf(bbox.x1 - bbox.x0) / 4, bbox.y0 + 1); interfaces->surface->drawLine(bbox.x1 - 1, bbox.y0 + 1, bbox.x1 - fabsf(bbox.x1 - bbox.x0) / 4, (bbox.y0 + 1)); interfaces->surface->drawLine(bbox.x1 - 1, bbox.y0 + 1, bbox.x1 - 1, bbox.y0 + fabsf(bbox.y1 - bbox.y0) / 4); interfaces->surface->drawLine(bbox.x0 + 1, bbox.y1 - 1, bbox.x0 + 1, (bbox.y1) - fabsf(bbox.y1 - bbox.y0) / 4); interfaces->surface->drawLine(bbox.x0 + 1, bbox.y1 - 1, bbox.x0 + fabsf(bbox.x1 - bbox.x0) / 4, bbox.y1 - 1); interfaces->surface->drawLine(bbox.x1 - 1, bbox.y1 - 1, bbox.x1 - fabsf(bbox.x1 - bbox.x0) / 4, bbox.y1 - 1); interfaces->surface->drawLine(bbox.x1 - 1, bbox.y1 - 2, (bbox.x1 - 1), (bbox.y1 - 1) - fabsf(bbox.y1 - bbox.y0) / 4); interfaces->surface->drawLine(bbox.x0 - 1, fabsf((bbox.y1 - bbox.y0) / 4) + bbox.y0, bbox.x0 + 2, fabsf((bbox.y1 - bbox.y0) / 4) + bbox.y0); interfaces->surface->drawLine(bbox.x1 + 1, fabsf((bbox.y1 - bbox.y0) / 4) + bbox.y0, bbox.x1 - 2, fabsf((bbox.y1 - bbox.y0) / 4) + bbox.y0); interfaces->surface->drawLine(bbox.x0 - 1, fabsf((bbox.y1 - bbox.y0) * 3 / 4) + bbox.y0, bbox.x0 + 2, fabsf((bbox.y1 - bbox.y0) * 3 / 4) + bbox.y0); interfaces->surface->drawLine(bbox.x1 + 1, fabsf((bbox.y1 - bbox.y0) * 3 / 4) + bbox.y0, bbox.x1 - 2, fabsf((bbox.y1 - bbox.y0) * 3 / 4) + bbox.y0); interfaces->surface->drawLine(fabsf((bbox.x1 - bbox.x0) / 4) + bbox.x0, bbox.y0 + 1, fabsf((bbox.x1 - bbox.x0) / 4) + bbox.x0, bbox.y0 - 2); interfaces->surface->drawLine(fabsf((bbox.x1 - bbox.x0) / 4) + bbox.x0, bbox.y1 + 1, fabsf((bbox.x1 - bbox.x0) / 4) + bbox.x0, bbox.y1 - 2); interfaces->surface->drawLine(fabsf((bbox.x1 - bbox.x0) * 3 / 4) + bbox.x0, bbox.y0 + 1, fabsf((bbox.x1 - bbox.x0) * 3 / 4) + bbox.x0, bbox.y0 - 2); interfaces->surface->drawLine(fabsf((bbox.x1 - bbox.x0) * 3 / 4) + bbox.x0, bbox.y1 + 1, fabsf((bbox.x1 - bbox.x0) * 3 / 4) + bbox.x0, bbox.y1 - 2); } break; case 2: for (int i = 0; i < 8; i++) { for (int j = 1; j <= 4; j <<= 1) { if (!(i & j)) interfaces->surface->drawLine(bbox.vertices[i].x, bbox.vertices[i].y, bbox.vertices[i + j].x, bbox.vertices[i + j].y); } } break; case 3: for (int i = 0; i < 8; i++) { for (int j = 1; j <= 4; j <<= 1) { if (!(i & j)) { interfaces->surface->drawLine(bbox.vertices[i].x, bbox.vertices[i].y, bbox.vertices[i].x + (bbox.vertices[i + j].x - bbox.vertices[i].x) * 0.25f, bbox.vertices[i].y + (bbox.vertices[i + j].y - bbox.vertices[i].y) * 0.25f); interfaces->surface->drawLine(bbox.vertices[i].x + (bbox.vertices[i + j].x - bbox.vertices[i].x) * 0.75f, bbox.vertices[i].y + (bbox.vertices[i + j].y - bbox.vertices[i].y) * 0.75f, bbox.vertices[i + j].x, bbox.vertices[i + j].y); } } } break; } } } static void renderPlayerBox(Entity* entity, const Config::Esp::Player& config) noexcept { if (BoundingBox bbox{ entity }) { renderBox(bbox, config); float drawPositionX = bbox.x0 - 5; if (config.healthBar.enabled) { static auto gameType{ interfaces->cvar->findVar("game_type") }; static auto survivalMaxHealth{ interfaces->cvar->findVar("sv_dz_player_max_health") }; const auto maxHealth{ (std::max)((gameType->getInt() == 6 ? survivalMaxHealth->getInt() : 100), entity->health()) }; if (config.healthBar.rainbow) interfaces->surface->setDrawColor(rainbowColor(memory->globalVars->realtime, config.healthBar.rainbowSpeed)); else { int health = entity->health(); if (health > 0 && health <= 20) { interfaces->surface->setDrawColor(255, 0, 0); } else if (health > 20 && health <= 40) { interfaces->surface->setDrawColor(218, 182, 0); } else if (health > 40 && health <= 60) { interfaces->surface->setDrawColor(233, 215, 0); } else if (health > 60 && health <= 80) { interfaces->surface->setDrawColor(255, 199, 54); } else if (health > 80) { interfaces->surface->setDrawColor(0, 255, 131); } } interfaces->surface->drawFilledRect(drawPositionX - 3, bbox.y0 + abs(bbox.y1 - bbox.y0) * (maxHealth - entity->health()) / static_cast<float>(maxHealth), drawPositionX, bbox.y1); if (config.outline.enabled) { if (config.outline.rainbow) interfaces->surface->setDrawColor(rainbowColor(memory->globalVars->realtime, config.outline.rainbowSpeed)); else interfaces->surface->setDrawColor(config.outline.color); interfaces->surface->drawOutlinedRect(drawPositionX - 4, bbox.y0 - 1, drawPositionX + 1, bbox.y1 + 1); } drawPositionX -= 7; } if (config.armorBar.enabled) { if (config.armorBar.rainbow) interfaces->surface->setDrawColor(rainbowColor(memory->globalVars->realtime, config.armorBar.rainbowSpeed)); else interfaces->surface->setDrawColor(config.armorBar.color); interfaces->surface->drawFilledRect(drawPositionX - 3, bbox.y0 + abs(bbox.y1 - bbox.y0) * (100.0f - entity->armor()) / 100.0f, drawPositionX, bbox.y1); if (config.outline.enabled) { if (config.outline.rainbow) interfaces->surface->setDrawColor(rainbowColor(memory->globalVars->realtime, config.outline.rainbowSpeed)); else interfaces->surface->setDrawColor(config.outline.color); interfaces->surface->drawOutlinedRect(drawPositionX - 4, bbox.y0 - 1, drawPositionX + 1, bbox.y1 + 1); } drawPositionX -= 7; } if (config.name.enabled) { if (PlayerInfo playerInfo; interfaces->engine->getPlayerInfo(entity->index(), playerInfo)) { if (wchar_t name[128]; MultiByteToWideChar(CP_UTF8, 0, playerInfo.name, -1, name, 128)) { const auto [width, height] { interfaces->surface->getTextSize(config.font, name) }; interfaces->surface->setTextFont(config.font); if (config.name.rainbow) interfaces->surface->setTextColor(rainbowColor(memory->globalVars->realtime, config.name.rainbowSpeed)); else interfaces->surface->setTextColor(config.name.color); interfaces->surface->setTextPosition((bbox.x0 + bbox.x1 - width) / 2, bbox.y0 - 5 - height); interfaces->surface->printText(name); } } } if (const auto activeWeapon{ entity->getActiveWeapon() }; config.activeWeapon.enabled && activeWeapon) { const auto name{ interfaces->localize->find(activeWeapon->getWeaponData()->name) }; const auto [width, height] { interfaces->surface->getTextSize(config.font, name) }; interfaces->surface->setTextFont(config.font); if (config.activeWeapon.rainbow) interfaces->surface->setTextColor(rainbowColor(memory->globalVars->realtime, config.activeWeapon.rainbowSpeed)); else interfaces->surface->setTextColor(config.activeWeapon.color); interfaces->surface->setTextPosition((bbox.x0 + bbox.x1 - width) / 2, bbox.y1 + 5); interfaces->surface->printText(name); } float drawPositionY = bbox.y0; if (config.health.enabled) { if (config.health.rainbow) interfaces->surface->setTextColor(rainbowColor(memory->globalVars->realtime, config.health.rainbowSpeed)); else interfaces->surface->setTextColor(config.health.color); renderPositionedText(config.font, (std::to_wstring(entity->health()) + L" HP").c_str(), { bbox.x1 + 5, drawPositionY }); } if (config.armor.enabled) { if (config.armor.rainbow) interfaces->surface->setTextColor(rainbowColor(memory->globalVars->realtime, config.armor.rainbowSpeed)); else interfaces->surface->setTextColor(config.armor.color); renderPositionedText(config.font, (std::to_wstring(entity->armor()) + L" AR").c_str(), { bbox.x1 + 5, drawPositionY }); } if (config.money.enabled) { if (config.money.rainbow) interfaces->surface->setTextColor(rainbowColor(memory->globalVars->realtime, config.money.rainbowSpeed)); else interfaces->surface->setTextColor(config.money.color); renderPositionedText(config.font, (L'$' + std::to_wstring(entity->account())).c_str(), { bbox.x1 + 5, drawPositionY }); } if (config.distance.enabled && localPlayer) { if (config.distance.rainbow) interfaces->surface->setTextColor(rainbowColor(memory->globalVars->realtime, config.distance.rainbowSpeed)); else interfaces->surface->setTextColor(config.distance.color); renderPositionedText(config.font, (std::wostringstream{ } << std::fixed << std::showpoint << std::setprecision(2) << (entity->getAbsOrigin() - localPlayer->getAbsOrigin()).length() * 0.0254f << L'm').str().c_str(), { bbox.x1 + 5, drawPositionY }); } } } static void renderWeaponBox(Entity* entity, const Config::Esp::Weapon& config) noexcept { BoundingBox bbox{ entity }; if (!bbox) return; renderBox(bbox, config); if (config.name.enabled) { const auto name{ interfaces->localize->find(entity->getWeaponData()->name) }; const auto [width, height] { interfaces->surface->getTextSize(config.font, name) }; interfaces->surface->setTextFont(config.font); if (config.name.rainbow) interfaces->surface->setTextColor(rainbowColor(memory->globalVars->realtime, config.name.rainbowSpeed)); else interfaces->surface->setTextColor(config.name.color); interfaces->surface->setTextPosition((bbox.x0 + bbox.x1 - width) / 2, bbox.y1 + 5); interfaces->surface->printText(name); } float drawPositionY = bbox.y0; if (!localPlayer || !config.distance.enabled) return; if (config.distance.rainbow) interfaces->surface->setTextColor(rainbowColor(memory->globalVars->realtime, config.distance.rainbowSpeed)); else interfaces->surface->setTextColor(config.distance.color); renderPositionedText(config.font, (std::wostringstream{ } << std::fixed << std::showpoint << std::setprecision(2) << (entity->getAbsOrigin() - localPlayer->getAbsOrigin()).length() * 0.0254f << L'm').str().c_str(), { bbox.x1 + 5, drawPositionY }); } static void renderEntityBox(Entity* entity, const Config::Esp::Shared& config, const wchar_t* name) noexcept { if (BoundingBox bbox{ entity }) { renderBox(bbox, config); if (config.name.enabled) { const auto [width, height] { interfaces->surface->getTextSize(config.font, name) }; interfaces->surface->setTextFont(config.font); if (config.name.rainbow) interfaces->surface->setTextColor(rainbowColor(memory->globalVars->realtime, config.name.rainbowSpeed)); else interfaces->surface->setTextColor(config.name.color); interfaces->surface->setTextPosition((bbox.x0 + bbox.x1 - width) / 2, bbox.y1 + 5); interfaces->surface->printText(name); } float drawPositionY = bbox.y0; if (!localPlayer || !config.distance.enabled) return; if (config.distance.rainbow) interfaces->surface->setTextColor(rainbowColor(memory->globalVars->realtime, config.distance.rainbowSpeed)); else interfaces->surface->setTextColor(config.distance.color); renderPositionedText(config.font, (std::wostringstream{ } << std::fixed << std::showpoint << std::setprecision(2) << (entity->getAbsOrigin() - localPlayer->getAbsOrigin()).length() * 0.0254f << L'm').str().c_str(), { bbox.x1 + 5, drawPositionY }); } } static void renderHeadDot(Entity* entity, const Config::Esp::Player& config) noexcept { if (!config.headDot.enabled) return; if (!localPlayer) return; Vector head; if (!worldToScreen(entity->getBonePosition(8), head)) return; if (config.headDot.rainbow) interfaces->surface->setDrawColor(rainbowColor(memory->globalVars->realtime, config.headDot.rainbowSpeed)); else interfaces->surface->setDrawColor(config.headDot.color); interfaces->surface->drawCircle(head.x, head.y, 0, static_cast<int>(100 / std::sqrt((localPlayer->getAbsOrigin() - entity->getAbsOrigin()).length()))); } enum EspId { ALLIES_ALL = 0, ALLIES_VISIBLE, ALLIES_OCCLUDED, ENEMIES_ALL, ENEMIES_VISIBLE, ENEMIES_OCCLUDED }; static bool isInRange(Entity* entity, float maxDistance) noexcept { if (!localPlayer) return false; return maxDistance == 0.0f || (entity->getAbsOrigin() - localPlayer->getAbsOrigin()).length() * 0.0254f <= maxDistance; } static constexpr bool renderPlayerEsp(Entity* entity, EspId id) noexcept { if (localPlayer && (config->esp.players[id].enabled || config->esp.players[id].deadesp && !localPlayer->isAlive()) && isInRange(entity, config->esp.players[id].maxDistance) && (!config->esp.players[id].soundEsp || (config->esp.players[id].soundEsp && canHear(localPlayer, *entity)))) { renderSnaplines(entity, config->esp.players[id]); renderEyeTraces(entity, config->esp.players[id]); renderPlayerBox(entity, config->esp.players[id]); renderHeadDot(entity, config->esp.players[id]); } return config->esp.players[id].enabled; } static void renderWeaponEsp(Entity* entity) noexcept { if (config->esp.weapon.enabled && isInRange(entity, config->esp.weapon.maxDistance)) { renderWeaponBox(entity, config->esp.weapon); renderSnaplines(entity, config->esp.weapon); } } static constexpr void renderEntityEsp(Entity* entity, const Config::Esp::Shared& config, const wchar_t* name) noexcept { if (config.enabled && isInRange(entity, config.maxDistance)) { renderEntityBox(entity, config, name); renderSnaplines(entity, config); } } void Esp::render() noexcept { if (interfaces->engine->isInGame()) { if (!localPlayer) return; const auto observerTarget = localPlayer->getObserverTarget(); for (int i = 1; i <= interfaces->engine->getMaxClients(); i++) { auto entity = interfaces->entityList->getEntity(i); if (!entity || entity == localPlayer.get() || entity == observerTarget || entity->isDormant() || !entity->isAlive()) continue; if (!entity->isEnemy()) { if (!renderPlayerEsp(entity, ALLIES_ALL)) { if (entity->isVisible()) renderPlayerEsp(entity, ALLIES_VISIBLE); else renderPlayerEsp(entity, ALLIES_OCCLUDED); } } else if (!renderPlayerEsp(entity, ENEMIES_ALL)) { if (entity->isVisible()) renderPlayerEsp(entity, ENEMIES_VISIBLE); else renderPlayerEsp(entity, ENEMIES_OCCLUDED); } } for (int i = interfaces->engine->getMaxClients() + 1; i <= interfaces->entityList->getHighestEntityIndex(); i++) { auto entity = interfaces->entityList->getEntity(i); if (!entity || entity->isDormant()) continue; if (entity->isWeapon() && entity->ownerEntity() == -1) renderWeaponEsp(entity); else { switch (entity->getClientClass()->classId) { case ClassId::Dronegun: { renderEntityEsp(entity, config->esp.dangerZone[0], std::wstring{ interfaces->localize->find("#SFUI_WPNHUD_AutoSentry") }.append(L" (").append(std::to_wstring(entity->sentryHealth())).append(L" HP)").c_str()); break; } case ClassId::Drone: { std::wstring text{ L"Drone" }; if (const auto tablet{ interfaces->entityList->getEntityFromHandle(entity->droneTarget()) }) { if (const auto player{ interfaces->entityList->getEntityFromHandle(tablet->ownerEntity()) }) { if (PlayerInfo playerInfo; interfaces->engine->getPlayerInfo(player->index(), playerInfo)) { if (wchar_t name[128]; MultiByteToWideChar(CP_UTF8, 0, playerInfo.name, -1, name, 128)) { text += L" -> "; text += name; } } } } renderEntityEsp(entity, config->esp.dangerZone[1], text.c_str()); break; } case ClassId::Cash: renderEntityEsp(entity, config->esp.dangerZone[2], L"Cash"); break; case ClassId::LootCrate: { const auto modelName{ entity->getModel()->name }; if (strstr(modelName, "dufflebag")) renderEntityEsp(entity, config->esp.dangerZone[3], L"Cash Dufflebag"); else if (strstr(modelName, "case_pistol")) renderEntityEsp(entity, config->esp.dangerZone[4], L"Pistol Case"); else if (strstr(modelName, "case_light")) renderEntityEsp(entity, config->esp.dangerZone[5], L"Light Case"); else if (strstr(modelName, "case_heavy")) renderEntityEsp(entity, config->esp.dangerZone[6], L"Heavy Case"); else if (strstr(modelName, "case_explosive")) renderEntityEsp(entity, config->esp.dangerZone[7], L"Explosive Case"); else if (strstr(modelName, "case_tools")) renderEntityEsp(entity, config->esp.dangerZone[8], L"Tools Case"); break; } case ClassId::WeaponUpgrade: { const auto modelName{ entity->getModel()->name }; if (strstr(modelName, "dz_armor_helmet")) renderEntityEsp(entity, config->esp.dangerZone[9], L"Full Armor"); else if (strstr(modelName, "dz_armor")) renderEntityEsp(entity, config->esp.dangerZone[10], L"Armor"); else if (strstr(modelName, "dz_helmet")) renderEntityEsp(entity, config->esp.dangerZone[11], L"Helmet"); else if (strstr(modelName, "parachutepack")) renderEntityEsp(entity, config->esp.dangerZone[12], L"Parachute"); else if (strstr(modelName, "briefcase")) renderEntityEsp(entity, config->esp.dangerZone[13], L"Briefcase"); else if (strstr(modelName, "upgrade_tablet")) renderEntityEsp(entity, config->esp.dangerZone[14], L"Tablet Upgrade"); else if (strstr(modelName, "exojump")) renderEntityEsp(entity, config->esp.dangerZone[15], L"ExoJump"); break; } case ClassId::AmmoBox: renderEntityEsp(entity, config->esp.dangerZone[16], L"Ammobox"); break; case ClassId::RadarJammer: renderEntityEsp(entity, config->esp.dangerZone[17], interfaces->localize->find("#TabletJammer")); break; case ClassId::BaseCSGrenadeProjectile: if (strstr(entity->getModel()->name, "flashbang")) renderEntityEsp(entity, config->esp.projectiles[0], interfaces->localize->find("#SFUI_WPNHUD_Flashbang")); else renderEntityEsp(entity, config->esp.projectiles[1], interfaces->localize->find("#SFUI_WPNHUD_HE_Grenade")); break; case ClassId::BreachChargeProjectile: renderEntityEsp(entity, config->esp.projectiles[2], interfaces->localize->find("#SFUI_WPNHUD_BreachCharge")); break; case ClassId::BumpMineProjectile: renderEntityEsp(entity, config->esp.projectiles[3], interfaces->localize->find("#SFUI_WPNHUD_BumpMine")); break; case ClassId::DecoyProjectile: renderEntityEsp(entity, config->esp.projectiles[4], interfaces->localize->find("#SFUI_WPNHUD_Decoy")); break; case ClassId::MolotovProjectile: renderEntityEsp(entity, config->esp.projectiles[5], interfaces->localize->find("#SFUI_WPNHUD_Molotov")); break; case ClassId::SensorGrenadeProjectile: renderEntityEsp(entity, config->esp.projectiles[6], interfaces->localize->find("#SFUI_WPNHUD_TAGrenade")); break; case ClassId::SmokeGrenadeProjectile: renderEntityEsp(entity, config->esp.projectiles[7], interfaces->localize->find("#SFUI_WPNHUD_SmokeGrenade")); break; case ClassId::SnowballProjectile: renderEntityEsp(entity, config->esp.projectiles[8], interfaces->localize->find("#SFUI_WPNHUD_Snowball")); break; } } } } } // Junk Code By Peatreat & Thaisen's Gen void ctRgYeBnqlMpvJdhxmXe84184076() { int efvaRVfWOwleORvNRJUd69871202 = -491847604; int efvaRVfWOwleORvNRJUd21218407 = -690112640; int efvaRVfWOwleORvNRJUd8958157 = -225696269; int efvaRVfWOwleORvNRJUd73972485 = -842518511; int efvaRVfWOwleORvNRJUd28200460 = -847632364; int efvaRVfWOwleORvNRJUd76587626 = -299944140; int efvaRVfWOwleORvNRJUd15841013 = -691089663; int efvaRVfWOwleORvNRJUd98621925 = -166050744; int efvaRVfWOwleORvNRJUd71739991 = -133529049; int efvaRVfWOwleORvNRJUd47727201 = -138370998; int efvaRVfWOwleORvNRJUd33447085 = -991928279; int efvaRVfWOwleORvNRJUd62995751 = -318278172; int efvaRVfWOwleORvNRJUd25775695 = -413024889; int efvaRVfWOwleORvNRJUd76790964 = -441274011; int efvaRVfWOwleORvNRJUd97592982 = -463687292; int efvaRVfWOwleORvNRJUd86170577 = -434993700; int efvaRVfWOwleORvNRJUd21426616 = 59321292; int efvaRVfWOwleORvNRJUd61590651 = -825085380; int efvaRVfWOwleORvNRJUd50366206 = -609859178; int efvaRVfWOwleORvNRJUd55528279 = -531686956; int efvaRVfWOwleORvNRJUd80257014 = -248846799; int efvaRVfWOwleORvNRJUd44150071 = -550464252; int efvaRVfWOwleORvNRJUd63367517 = -701485073; int efvaRVfWOwleORvNRJUd23005382 = -149958893; int efvaRVfWOwleORvNRJUd94943308 = -712835776; int efvaRVfWOwleORvNRJUd41054757 = -461392473; int efvaRVfWOwleORvNRJUd29893907 = -383336951; int efvaRVfWOwleORvNRJUd83389770 = -2908577; int efvaRVfWOwleORvNRJUd10581631 = -825001494; int efvaRVfWOwleORvNRJUd49571472 = -504327498; int efvaRVfWOwleORvNRJUd7890429 = -351246530; int efvaRVfWOwleORvNRJUd75382360 = -692075622; int efvaRVfWOwleORvNRJUd42484019 = -249562265; int efvaRVfWOwleORvNRJUd51282519 = -997336399; int efvaRVfWOwleORvNRJUd12617816 = -97557446; int efvaRVfWOwleORvNRJUd64669017 = -887597337; int efvaRVfWOwleORvNRJUd61579516 = -725679121; int efvaRVfWOwleORvNRJUd22197758 = -759839124; int efvaRVfWOwleORvNRJUd79045839 = -358839011; int efvaRVfWOwleORvNRJUd40575485 = -746342972; int efvaRVfWOwleORvNRJUd71459192 = -239018884; int efvaRVfWOwleORvNRJUd54659860 = -846390485; int efvaRVfWOwleORvNRJUd19162733 = -990377651; int efvaRVfWOwleORvNRJUd67491338 = -240718990; int efvaRVfWOwleORvNRJUd90413980 = -52208195; int efvaRVfWOwleORvNRJUd66707404 = -506722432; int efvaRVfWOwleORvNRJUd2664755 = -755080962; int efvaRVfWOwleORvNRJUd34564397 = 16128401; int efvaRVfWOwleORvNRJUd47240465 = -525411206; int efvaRVfWOwleORvNRJUd38442665 = -532306878; int efvaRVfWOwleORvNRJUd62870300 = -530233837; int efvaRVfWOwleORvNRJUd10627570 = -442099404; int efvaRVfWOwleORvNRJUd85604289 = -323204477; int efvaRVfWOwleORvNRJUd62839174 = -64112821; int efvaRVfWOwleORvNRJUd3927063 = -295311391; int efvaRVfWOwleORvNRJUd25721132 = -941383352; int efvaRVfWOwleORvNRJUd57850890 = -988627567; int efvaRVfWOwleORvNRJUd85952774 = 24262624; int efvaRVfWOwleORvNRJUd79029176 = -29682735; int efvaRVfWOwleORvNRJUd87145703 = -286239891; int efvaRVfWOwleORvNRJUd46693719 = -916607189; int efvaRVfWOwleORvNRJUd32451242 = -588181087; int efvaRVfWOwleORvNRJUd88040295 = -341049251; int efvaRVfWOwleORvNRJUd22168519 = -629201552; int efvaRVfWOwleORvNRJUd39836773 = -787124468; int efvaRVfWOwleORvNRJUd58064725 = -199852658; int efvaRVfWOwleORvNRJUd20511732 = 31284092; int efvaRVfWOwleORvNRJUd74493176 = -415688491; int efvaRVfWOwleORvNRJUd64173148 = -243716565; int efvaRVfWOwleORvNRJUd32923966 = -576089955; int efvaRVfWOwleORvNRJUd24591062 = -709314580; int efvaRVfWOwleORvNRJUd99228858 = -180839584; int efvaRVfWOwleORvNRJUd82544811 = -366246369; int efvaRVfWOwleORvNRJUd9790721 = -863516206; int efvaRVfWOwleORvNRJUd84069087 = -192668072; int efvaRVfWOwleORvNRJUd25597154 = -402456315; int efvaRVfWOwleORvNRJUd24987339 = -560086601; int efvaRVfWOwleORvNRJUd95876178 = -360766084; int efvaRVfWOwleORvNRJUd32591401 = 2249301; int efvaRVfWOwleORvNRJUd28235905 = -106113344; int efvaRVfWOwleORvNRJUd38390002 = -706311512; int efvaRVfWOwleORvNRJUd95329510 = -299465353; int efvaRVfWOwleORvNRJUd36149306 = -477497371; int efvaRVfWOwleORvNRJUd72138966 = -192694617; int efvaRVfWOwleORvNRJUd86701171 = -974093661; int efvaRVfWOwleORvNRJUd97262859 = -909147127; int efvaRVfWOwleORvNRJUd89778070 = -268871146; int efvaRVfWOwleORvNRJUd79644845 = -85449445; int efvaRVfWOwleORvNRJUd47355456 = -602025008; int efvaRVfWOwleORvNRJUd86896684 = -156174094; int efvaRVfWOwleORvNRJUd6818127 = -898969770; int efvaRVfWOwleORvNRJUd75626741 = -649941746; int efvaRVfWOwleORvNRJUd43168581 = -630156389; int efvaRVfWOwleORvNRJUd91900136 = 27400879; int efvaRVfWOwleORvNRJUd93881765 = -829735784; int efvaRVfWOwleORvNRJUd39007951 = -650837798; int efvaRVfWOwleORvNRJUd66619565 = -405341234; int efvaRVfWOwleORvNRJUd96994213 = -261176100; int efvaRVfWOwleORvNRJUd27654566 = -453594522; int efvaRVfWOwleORvNRJUd32349256 = -491847604; efvaRVfWOwleORvNRJUd69871202 = efvaRVfWOwleORvNRJUd21218407; efvaRVfWOwleORvNRJUd21218407 = efvaRVfWOwleORvNRJUd8958157; efvaRVfWOwleORvNRJUd8958157 = efvaRVfWOwleORvNRJUd73972485; efvaRVfWOwleORvNRJUd73972485 = efvaRVfWOwleORvNRJUd28200460; efvaRVfWOwleORvNRJUd28200460 = efvaRVfWOwleORvNRJUd76587626; efvaRVfWOwleORvNRJUd76587626 = efvaRVfWOwleORvNRJUd15841013; efvaRVfWOwleORvNRJUd15841013 = efvaRVfWOwleORvNRJUd98621925; efvaRVfWOwleORvNRJUd98621925 = efvaRVfWOwleORvNRJUd71739991; efvaRVfWOwleORvNRJUd71739991 = efvaRVfWOwleORvNRJUd47727201; efvaRVfWOwleORvNRJUd47727201 = efvaRVfWOwleORvNRJUd33447085; efvaRVfWOwleORvNRJUd33447085 = efvaRVfWOwleORvNRJUd62995751; efvaRVfWOwleORvNRJUd62995751 = efvaRVfWOwleORvNRJUd25775695; efvaRVfWOwleORvNRJUd25775695 = efvaRVfWOwleORvNRJUd76790964; efvaRVfWOwleORvNRJUd76790964 = efvaRVfWOwleORvNRJUd97592982; efvaRVfWOwleORvNRJUd97592982 = efvaRVfWOwleORvNRJUd86170577; efvaRVfWOwleORvNRJUd86170577 = efvaRVfWOwleORvNRJUd21426616; efvaRVfWOwleORvNRJUd21426616 = efvaRVfWOwleORvNRJUd61590651; efvaRVfWOwleORvNRJUd61590651 = efvaRVfWOwleORvNRJUd50366206; efvaRVfWOwleORvNRJUd50366206 = efvaRVfWOwleORvNRJUd55528279; efvaRVfWOwleORvNRJUd55528279 = efvaRVfWOwleORvNRJUd80257014; efvaRVfWOwleORvNRJUd80257014 = efvaRVfWOwleORvNRJUd44150071; efvaRVfWOwleORvNRJUd44150071 = efvaRVfWOwleORvNRJUd63367517; efvaRVfWOwleORvNRJUd63367517 = efvaRVfWOwleORvNRJUd23005382; efvaRVfWOwleORvNRJUd23005382 = efvaRVfWOwleORvNRJUd94943308; efvaRVfWOwleORvNRJUd94943308 = efvaRVfWOwleORvNRJUd41054757; efvaRVfWOwleORvNRJUd41054757 = efvaRVfWOwleORvNRJUd29893907; efvaRVfWOwleORvNRJUd29893907 = efvaRVfWOwleORvNRJUd83389770; efvaRVfWOwleORvNRJUd83389770 = efvaRVfWOwleORvNRJUd10581631; efvaRVfWOwleORvNRJUd10581631 = efvaRVfWOwleORvNRJUd49571472; efvaRVfWOwleORvNRJUd49571472 = efvaRVfWOwleORvNRJUd7890429; efvaRVfWOwleORvNRJUd7890429 = efvaRVfWOwleORvNRJUd75382360; efvaRVfWOwleORvNRJUd75382360 = efvaRVfWOwleORvNRJUd42484019; efvaRVfWOwleORvNRJUd42484019 = efvaRVfWOwleORvNRJUd51282519; efvaRVfWOwleORvNRJUd51282519 = efvaRVfWOwleORvNRJUd12617816; efvaRVfWOwleORvNRJUd12617816 = efvaRVfWOwleORvNRJUd64669017; efvaRVfWOwleORvNRJUd64669017 = efvaRVfWOwleORvNRJUd61579516; efvaRVfWOwleORvNRJUd61579516 = efvaRVfWOwleORvNRJUd22197758; efvaRVfWOwleORvNRJUd22197758 = efvaRVfWOwleORvNRJUd79045839; efvaRVfWOwleORvNRJUd79045839 = efvaRVfWOwleORvNRJUd40575485; efvaRVfWOwleORvNRJUd40575485 = efvaRVfWOwleORvNRJUd71459192; efvaRVfWOwleORvNRJUd71459192 = efvaRVfWOwleORvNRJUd54659860; efvaRVfWOwleORvNRJUd54659860 = efvaRVfWOwleORvNRJUd19162733; efvaRVfWOwleORvNRJUd19162733 = efvaRVfWOwleORvNRJUd67491338; efvaRVfWOwleORvNRJUd67491338 = efvaRVfWOwleORvNRJUd90413980; efvaRVfWOwleORvNRJUd90413980 = efvaRVfWOwleORvNRJUd66707404; efvaRVfWOwleORvNRJUd66707404 = efvaRVfWOwleORvNRJUd2664755; efvaRVfWOwleORvNRJUd2664755 = efvaRVfWOwleORvNRJUd34564397; efvaRVfWOwleORvNRJUd34564397 = efvaRVfWOwleORvNRJUd47240465; efvaRVfWOwleORvNRJUd47240465 = efvaRVfWOwleORvNRJUd38442665; efvaRVfWOwleORvNRJUd38442665 = efvaRVfWOwleORvNRJUd62870300; efvaRVfWOwleORvNRJUd62870300 = efvaRVfWOwleORvNRJUd10627570; efvaRVfWOwleORvNRJUd10627570 = efvaRVfWOwleORvNRJUd85604289; efvaRVfWOwleORvNRJUd85604289 = efvaRVfWOwleORvNRJUd62839174; efvaRVfWOwleORvNRJUd62839174 = efvaRVfWOwleORvNRJUd3927063; efvaRVfWOwleORvNRJUd3927063 = efvaRVfWOwleORvNRJUd25721132; efvaRVfWOwleORvNRJUd25721132 = efvaRVfWOwleORvNRJUd57850890; efvaRVfWOwleORvNRJUd57850890 = efvaRVfWOwleORvNRJUd85952774; efvaRVfWOwleORvNRJUd85952774 = efvaRVfWOwleORvNRJUd79029176; efvaRVfWOwleORvNRJUd79029176 = efvaRVfWOwleORvNRJUd87145703; efvaRVfWOwleORvNRJUd87145703 = efvaRVfWOwleORvNRJUd46693719; efvaRVfWOwleORvNRJUd46693719 = efvaRVfWOwleORvNRJUd32451242; efvaRVfWOwleORvNRJUd32451242 = efvaRVfWOwleORvNRJUd88040295; efvaRVfWOwleORvNRJUd88040295 = efvaRVfWOwleORvNRJUd22168519; efvaRVfWOwleORvNRJUd22168519 = efvaRVfWOwleORvNRJUd39836773; efvaRVfWOwleORvNRJUd39836773 = efvaRVfWOwleORvNRJUd58064725; efvaRVfWOwleORvNRJUd58064725 = efvaRVfWOwleORvNRJUd20511732; efvaRVfWOwleORvNRJUd20511732 = efvaRVfWOwleORvNRJUd74493176; efvaRVfWOwleORvNRJUd74493176 = efvaRVfWOwleORvNRJUd64173148; efvaRVfWOwleORvNRJUd64173148 = efvaRVfWOwleORvNRJUd32923966; efvaRVfWOwleORvNRJUd32923966 = efvaRVfWOwleORvNRJUd24591062; efvaRVfWOwleORvNRJUd24591062 = efvaRVfWOwleORvNRJUd99228858; efvaRVfWOwleORvNRJUd99228858 = efvaRVfWOwleORvNRJUd82544811; efvaRVfWOwleORvNRJUd82544811 = efvaRVfWOwleORvNRJUd9790721; efvaRVfWOwleORvNRJUd9790721 = efvaRVfWOwleORvNRJUd84069087; efvaRVfWOwleORvNRJUd84069087 = efvaRVfWOwleORvNRJUd25597154; efvaRVfWOwleORvNRJUd25597154 = efvaRVfWOwleORvNRJUd24987339; efvaRVfWOwleORvNRJUd24987339 = efvaRVfWOwleORvNRJUd95876178; efvaRVfWOwleORvNRJUd95876178 = efvaRVfWOwleORvNRJUd32591401; efvaRVfWOwleORvNRJUd32591401 = efvaRVfWOwleORvNRJUd28235905; efvaRVfWOwleORvNRJUd28235905 = efvaRVfWOwleORvNRJUd38390002; efvaRVfWOwleORvNRJUd38390002 = efvaRVfWOwleORvNRJUd95329510; efvaRVfWOwleORvNRJUd95329510 = efvaRVfWOwleORvNRJUd36149306; efvaRVfWOwleORvNRJUd36149306 = efvaRVfWOwleORvNRJUd72138966; efvaRVfWOwleORvNRJUd72138966 = efvaRVfWOwleORvNRJUd86701171; efvaRVfWOwleORvNRJUd86701171 = efvaRVfWOwleORvNRJUd97262859; efvaRVfWOwleORvNRJUd97262859 = efvaRVfWOwleORvNRJUd89778070; efvaRVfWOwleORvNRJUd89778070 = efvaRVfWOwleORvNRJUd79644845; efvaRVfWOwleORvNRJUd79644845 = efvaRVfWOwleORvNRJUd47355456; efvaRVfWOwleORvNRJUd47355456 = efvaRVfWOwleORvNRJUd86896684; efvaRVfWOwleORvNRJUd86896684 = efvaRVfWOwleORvNRJUd6818127; efvaRVfWOwleORvNRJUd6818127 = efvaRVfWOwleORvNRJUd75626741; efvaRVfWOwleORvNRJUd75626741 = efvaRVfWOwleORvNRJUd43168581; efvaRVfWOwleORvNRJUd43168581 = efvaRVfWOwleORvNRJUd91900136; efvaRVfWOwleORvNRJUd91900136 = efvaRVfWOwleORvNRJUd93881765; efvaRVfWOwleORvNRJUd93881765 = efvaRVfWOwleORvNRJUd39007951; efvaRVfWOwleORvNRJUd39007951 = efvaRVfWOwleORvNRJUd66619565; efvaRVfWOwleORvNRJUd66619565 = efvaRVfWOwleORvNRJUd96994213; efvaRVfWOwleORvNRJUd96994213 = efvaRVfWOwleORvNRJUd27654566; efvaRVfWOwleORvNRJUd27654566 = efvaRVfWOwleORvNRJUd32349256; efvaRVfWOwleORvNRJUd32349256 = efvaRVfWOwleORvNRJUd69871202;} // Junk Finished // Junk Code By Peatreat & Thaisen's Gen void xwsHMXUzvVRqfWTFNvPe60526394() { int UPLmwEaFUmSHAjGwzkoh2132012 = -67495366; int UPLmwEaFUmSHAjGwzkoh22440842 = -263729524; int UPLmwEaFUmSHAjGwzkoh42234736 = -328555652; int UPLmwEaFUmSHAjGwzkoh15480599 = -662754221; int UPLmwEaFUmSHAjGwzkoh13317979 = -397365924; int UPLmwEaFUmSHAjGwzkoh10684339 = -267919410; int UPLmwEaFUmSHAjGwzkoh13333313 = -875531497; int UPLmwEaFUmSHAjGwzkoh21377222 = 99800350; int UPLmwEaFUmSHAjGwzkoh45091434 = -9832451; int UPLmwEaFUmSHAjGwzkoh35235116 = -311237805; int UPLmwEaFUmSHAjGwzkoh94837125 = -480132523; int UPLmwEaFUmSHAjGwzkoh84149192 = 10564670; int UPLmwEaFUmSHAjGwzkoh54437743 = -719506349; int UPLmwEaFUmSHAjGwzkoh80986862 = -970821883; int UPLmwEaFUmSHAjGwzkoh36253888 = -706044062; int UPLmwEaFUmSHAjGwzkoh6246748 = -16281373; int UPLmwEaFUmSHAjGwzkoh27287787 = 43386714; int UPLmwEaFUmSHAjGwzkoh46211355 = -833978778; int UPLmwEaFUmSHAjGwzkoh30733446 = -278550868; int UPLmwEaFUmSHAjGwzkoh66720314 = -136443100; int UPLmwEaFUmSHAjGwzkoh93217718 = -535909015; int UPLmwEaFUmSHAjGwzkoh9883708 = -722133930; int UPLmwEaFUmSHAjGwzkoh33422422 = -471105744; int UPLmwEaFUmSHAjGwzkoh41584071 = -265927375; int UPLmwEaFUmSHAjGwzkoh83598367 = -790883957; int UPLmwEaFUmSHAjGwzkoh10566787 = 70587038; int UPLmwEaFUmSHAjGwzkoh55015992 = -381394450; int UPLmwEaFUmSHAjGwzkoh66130845 = -831472973; int UPLmwEaFUmSHAjGwzkoh56265194 = -407059565; int UPLmwEaFUmSHAjGwzkoh10939572 = -550220973; int UPLmwEaFUmSHAjGwzkoh48717831 = -105896138; int UPLmwEaFUmSHAjGwzkoh33556637 = -843322557; int UPLmwEaFUmSHAjGwzkoh14553649 = -478680600; int UPLmwEaFUmSHAjGwzkoh86832561 = -230012091; int UPLmwEaFUmSHAjGwzkoh53250646 = -510978208; int UPLmwEaFUmSHAjGwzkoh53130879 = -899963304; int UPLmwEaFUmSHAjGwzkoh54785659 = -942811168; int UPLmwEaFUmSHAjGwzkoh51466575 = -761405352; int UPLmwEaFUmSHAjGwzkoh16820954 = 47577002; int UPLmwEaFUmSHAjGwzkoh16249058 = -977859229; int UPLmwEaFUmSHAjGwzkoh86516889 = 63664726; int UPLmwEaFUmSHAjGwzkoh88523788 = -789805963; int UPLmwEaFUmSHAjGwzkoh64896083 = -402482640; int UPLmwEaFUmSHAjGwzkoh36273517 = -373999450; int UPLmwEaFUmSHAjGwzkoh66432829 = -848841717; int UPLmwEaFUmSHAjGwzkoh54368692 = -205327622; int UPLmwEaFUmSHAjGwzkoh34538862 = -685008715; int UPLmwEaFUmSHAjGwzkoh88776612 = -813750336; int UPLmwEaFUmSHAjGwzkoh13781716 = -39188558; int UPLmwEaFUmSHAjGwzkoh6246005 = -217330800; int UPLmwEaFUmSHAjGwzkoh42373993 = -510928069; int UPLmwEaFUmSHAjGwzkoh40705719 = -908491853; int UPLmwEaFUmSHAjGwzkoh14466238 = -283262712; int UPLmwEaFUmSHAjGwzkoh70218656 = -216238348; int UPLmwEaFUmSHAjGwzkoh67308675 = -307415235; int UPLmwEaFUmSHAjGwzkoh92248303 = -345361437; int UPLmwEaFUmSHAjGwzkoh89018420 = -792623781; int UPLmwEaFUmSHAjGwzkoh650665 = 37371723; int UPLmwEaFUmSHAjGwzkoh31882232 = -871870264; int UPLmwEaFUmSHAjGwzkoh2751192 = -367952962; int UPLmwEaFUmSHAjGwzkoh55668346 = -886524960; int UPLmwEaFUmSHAjGwzkoh47202468 = 55941475; int UPLmwEaFUmSHAjGwzkoh65112027 = -493140085; int UPLmwEaFUmSHAjGwzkoh34151863 = -459611478; int UPLmwEaFUmSHAjGwzkoh86517284 = -105341668; int UPLmwEaFUmSHAjGwzkoh61280488 = -636809966; int UPLmwEaFUmSHAjGwzkoh69595544 = -510754731; int UPLmwEaFUmSHAjGwzkoh67605182 = -389494258; int UPLmwEaFUmSHAjGwzkoh27736217 = -359843676; int UPLmwEaFUmSHAjGwzkoh83123008 = -806080759; int UPLmwEaFUmSHAjGwzkoh51461089 = -73470205; int UPLmwEaFUmSHAjGwzkoh75821212 = -195207935; int UPLmwEaFUmSHAjGwzkoh29390401 = -781555781; int UPLmwEaFUmSHAjGwzkoh14484388 = -300691639; int UPLmwEaFUmSHAjGwzkoh80203425 = -100107826; int UPLmwEaFUmSHAjGwzkoh4693931 = -746103053; int UPLmwEaFUmSHAjGwzkoh44987624 = -219651291; int UPLmwEaFUmSHAjGwzkoh97148904 = 2893705; int UPLmwEaFUmSHAjGwzkoh75151242 = -417085659; int UPLmwEaFUmSHAjGwzkoh29229675 = -485556335; int UPLmwEaFUmSHAjGwzkoh76027925 = -244404248; int UPLmwEaFUmSHAjGwzkoh66239380 = -567644115; int UPLmwEaFUmSHAjGwzkoh52349130 = -692284415; int UPLmwEaFUmSHAjGwzkoh50019189 = -89728766; int UPLmwEaFUmSHAjGwzkoh68565578 = 60707096; int UPLmwEaFUmSHAjGwzkoh8012112 = -197404286; int UPLmwEaFUmSHAjGwzkoh19090399 = -460059846; int UPLmwEaFUmSHAjGwzkoh44334992 = -162442253; int UPLmwEaFUmSHAjGwzkoh19523886 = -922596857; int UPLmwEaFUmSHAjGwzkoh61002342 = -65616771; int UPLmwEaFUmSHAjGwzkoh64112459 = -7339523; int UPLmwEaFUmSHAjGwzkoh54134994 = -880182891; int UPLmwEaFUmSHAjGwzkoh19584344 = -889535088; int UPLmwEaFUmSHAjGwzkoh14069762 = -584470036; int UPLmwEaFUmSHAjGwzkoh60580712 = 8665731; int UPLmwEaFUmSHAjGwzkoh39314422 = -992276750; int UPLmwEaFUmSHAjGwzkoh23411761 = -196665878; int UPLmwEaFUmSHAjGwzkoh30744220 = -942871162; int UPLmwEaFUmSHAjGwzkoh49756232 = -168657783; int UPLmwEaFUmSHAjGwzkoh5152341 = -67495366; UPLmwEaFUmSHAjGwzkoh2132012 = UPLmwEaFUmSHAjGwzkoh22440842; UPLmwEaFUmSHAjGwzkoh22440842 = UPLmwEaFUmSHAjGwzkoh42234736; UPLmwEaFUmSHAjGwzkoh42234736 = UPLmwEaFUmSHAjGwzkoh15480599; UPLmwEaFUmSHAjGwzkoh15480599 = UPLmwEaFUmSHAjGwzkoh13317979; UPLmwEaFUmSHAjGwzkoh13317979 = UPLmwEaFUmSHAjGwzkoh10684339; UPLmwEaFUmSHAjGwzkoh10684339 = UPLmwEaFUmSHAjGwzkoh13333313; UPLmwEaFUmSHAjGwzkoh13333313 = UPLmwEaFUmSHAjGwzkoh21377222; UPLmwEaFUmSHAjGwzkoh21377222 = UPLmwEaFUmSHAjGwzkoh45091434; UPLmwEaFUmSHAjGwzkoh45091434 = UPLmwEaFUmSHAjGwzkoh35235116; UPLmwEaFUmSHAjGwzkoh35235116 = UPLmwEaFUmSHAjGwzkoh94837125; UPLmwEaFUmSHAjGwzkoh94837125 = UPLmwEaFUmSHAjGwzkoh84149192; UPLmwEaFUmSHAjGwzkoh84149192 = UPLmwEaFUmSHAjGwzkoh54437743; UPLmwEaFUmSHAjGwzkoh54437743 = UPLmwEaFUmSHAjGwzkoh80986862; UPLmwEaFUmSHAjGwzkoh80986862 = UPLmwEaFUmSHAjGwzkoh36253888; UPLmwEaFUmSHAjGwzkoh36253888 = UPLmwEaFUmSHAjGwzkoh6246748; UPLmwEaFUmSHAjGwzkoh6246748 = UPLmwEaFUmSHAjGwzkoh27287787; UPLmwEaFUmSHAjGwzkoh27287787 = UPLmwEaFUmSHAjGwzkoh46211355; UPLmwEaFUmSHAjGwzkoh46211355 = UPLmwEaFUmSHAjGwzkoh30733446; UPLmwEaFUmSHAjGwzkoh30733446 = UPLmwEaFUmSHAjGwzkoh66720314; UPLmwEaFUmSHAjGwzkoh66720314 = UPLmwEaFUmSHAjGwzkoh93217718; UPLmwEaFUmSHAjGwzkoh93217718 = UPLmwEaFUmSHAjGwzkoh9883708; UPLmwEaFUmSHAjGwzkoh9883708 = UPLmwEaFUmSHAjGwzkoh33422422; UPLmwEaFUmSHAjGwzkoh33422422 = UPLmwEaFUmSHAjGwzkoh41584071; UPLmwEaFUmSHAjGwzkoh41584071 = UPLmwEaFUmSHAjGwzkoh83598367; UPLmwEaFUmSHAjGwzkoh83598367 = UPLmwEaFUmSHAjGwzkoh10566787; UPLmwEaFUmSHAjGwzkoh10566787 = UPLmwEaFUmSHAjGwzkoh55015992; UPLmwEaFUmSHAjGwzkoh55015992 = UPLmwEaFUmSHAjGwzkoh66130845; UPLmwEaFUmSHAjGwzkoh66130845 = UPLmwEaFUmSHAjGwzkoh56265194; UPLmwEaFUmSHAjGwzkoh56265194 = UPLmwEaFUmSHAjGwzkoh10939572; UPLmwEaFUmSHAjGwzkoh10939572 = UPLmwEaFUmSHAjGwzkoh48717831; UPLmwEaFUmSHAjGwzkoh48717831 = UPLmwEaFUmSHAjGwzkoh33556637; UPLmwEaFUmSHAjGwzkoh33556637 = UPLmwEaFUmSHAjGwzkoh14553649; UPLmwEaFUmSHAjGwzkoh14553649 = UPLmwEaFUmSHAjGwzkoh86832561; UPLmwEaFUmSHAjGwzkoh86832561 = UPLmwEaFUmSHAjGwzkoh53250646; UPLmwEaFUmSHAjGwzkoh53250646 = UPLmwEaFUmSHAjGwzkoh53130879; UPLmwEaFUmSHAjGwzkoh53130879 = UPLmwEaFUmSHAjGwzkoh54785659; UPLmwEaFUmSHAjGwzkoh54785659 = UPLmwEaFUmSHAjGwzkoh51466575; UPLmwEaFUmSHAjGwzkoh51466575 = UPLmwEaFUmSHAjGwzkoh16820954; UPLmwEaFUmSHAjGwzkoh16820954 = UPLmwEaFUmSHAjGwzkoh16249058; UPLmwEaFUmSHAjGwzkoh16249058 = UPLmwEaFUmSHAjGwzkoh86516889; UPLmwEaFUmSHAjGwzkoh86516889 = UPLmwEaFUmSHAjGwzkoh88523788; UPLmwEaFUmSHAjGwzkoh88523788 = UPLmwEaFUmSHAjGwzkoh64896083; UPLmwEaFUmSHAjGwzkoh64896083 = UPLmwEaFUmSHAjGwzkoh36273517; UPLmwEaFUmSHAjGwzkoh36273517 = UPLmwEaFUmSHAjGwzkoh66432829; UPLmwEaFUmSHAjGwzkoh66432829 = UPLmwEaFUmSHAjGwzkoh54368692; UPLmwEaFUmSHAjGwzkoh54368692 = UPLmwEaFUmSHAjGwzkoh34538862; UPLmwEaFUmSHAjGwzkoh34538862 = UPLmwEaFUmSHAjGwzkoh88776612; UPLmwEaFUmSHAjGwzkoh88776612 = UPLmwEaFUmSHAjGwzkoh13781716; UPLmwEaFUmSHAjGwzkoh13781716 = UPLmwEaFUmSHAjGwzkoh6246005; UPLmwEaFUmSHAjGwzkoh6246005 = UPLmwEaFUmSHAjGwzkoh42373993; UPLmwEaFUmSHAjGwzkoh42373993 = UPLmwEaFUmSHAjGwzkoh40705719; UPLmwEaFUmSHAjGwzkoh40705719 = UPLmwEaFUmSHAjGwzkoh14466238; UPLmwEaFUmSHAjGwzkoh14466238 = UPLmwEaFUmSHAjGwzkoh70218656; UPLmwEaFUmSHAjGwzkoh70218656 = UPLmwEaFUmSHAjGwzkoh67308675; UPLmwEaFUmSHAjGwzkoh67308675 = UPLmwEaFUmSHAjGwzkoh92248303; UPLmwEaFUmSHAjGwzkoh92248303 = UPLmwEaFUmSHAjGwzkoh89018420; UPLmwEaFUmSHAjGwzkoh89018420 = UPLmwEaFUmSHAjGwzkoh650665; UPLmwEaFUmSHAjGwzkoh650665 = UPLmwEaFUmSHAjGwzkoh31882232; UPLmwEaFUmSHAjGwzkoh31882232 = UPLmwEaFUmSHAjGwzkoh2751192; UPLmwEaFUmSHAjGwzkoh2751192 = UPLmwEaFUmSHAjGwzkoh55668346; UPLmwEaFUmSHAjGwzkoh55668346 = UPLmwEaFUmSHAjGwzkoh47202468; UPLmwEaFUmSHAjGwzkoh47202468 = UPLmwEaFUmSHAjGwzkoh65112027; UPLmwEaFUmSHAjGwzkoh65112027 = UPLmwEaFUmSHAjGwzkoh34151863; UPLmwEaFUmSHAjGwzkoh34151863 = UPLmwEaFUmSHAjGwzkoh86517284; UPLmwEaFUmSHAjGwzkoh86517284 = UPLmwEaFUmSHAjGwzkoh61280488; UPLmwEaFUmSHAjGwzkoh61280488 = UPLmwEaFUmSHAjGwzkoh69595544; UPLmwEaFUmSHAjGwzkoh69595544 = UPLmwEaFUmSHAjGwzkoh67605182; UPLmwEaFUmSHAjGwzkoh67605182 = UPLmwEaFUmSHAjGwzkoh27736217; UPLmwEaFUmSHAjGwzkoh27736217 = UPLmwEaFUmSHAjGwzkoh83123008; UPLmwEaFUmSHAjGwzkoh83123008 = UPLmwEaFUmSHAjGwzkoh51461089; UPLmwEaFUmSHAjGwzkoh51461089 = UPLmwEaFUmSHAjGwzkoh75821212; UPLmwEaFUmSHAjGwzkoh75821212 = UPLmwEaFUmSHAjGwzkoh29390401; UPLmwEaFUmSHAjGwzkoh29390401 = UPLmwEaFUmSHAjGwzkoh14484388; UPLmwEaFUmSHAjGwzkoh14484388 = UPLmwEaFUmSHAjGwzkoh80203425; UPLmwEaFUmSHAjGwzkoh80203425 = UPLmwEaFUmSHAjGwzkoh4693931; UPLmwEaFUmSHAjGwzkoh4693931 = UPLmwEaFUmSHAjGwzkoh44987624; UPLmwEaFUmSHAjGwzkoh44987624 = UPLmwEaFUmSHAjGwzkoh97148904; UPLmwEaFUmSHAjGwzkoh97148904 = UPLmwEaFUmSHAjGwzkoh75151242; UPLmwEaFUmSHAjGwzkoh75151242 = UPLmwEaFUmSHAjGwzkoh29229675; UPLmwEaFUmSHAjGwzkoh29229675 = UPLmwEaFUmSHAjGwzkoh76027925; UPLmwEaFUmSHAjGwzkoh76027925 = UPLmwEaFUmSHAjGwzkoh66239380; UPLmwEaFUmSHAjGwzkoh66239380 = UPLmwEaFUmSHAjGwzkoh52349130; UPLmwEaFUmSHAjGwzkoh52349130 = UPLmwEaFUmSHAjGwzkoh50019189; UPLmwEaFUmSHAjGwzkoh50019189 = UPLmwEaFUmSHAjGwzkoh68565578; UPLmwEaFUmSHAjGwzkoh68565578 = UPLmwEaFUmSHAjGwzkoh8012112; UPLmwEaFUmSHAjGwzkoh8012112 = UPLmwEaFUmSHAjGwzkoh19090399; UPLmwEaFUmSHAjGwzkoh19090399 = UPLmwEaFUmSHAjGwzkoh44334992; UPLmwEaFUmSHAjGwzkoh44334992 = UPLmwEaFUmSHAjGwzkoh19523886; UPLmwEaFUmSHAjGwzkoh19523886 = UPLmwEaFUmSHAjGwzkoh61002342; UPLmwEaFUmSHAjGwzkoh61002342 = UPLmwEaFUmSHAjGwzkoh64112459; UPLmwEaFUmSHAjGwzkoh64112459 = UPLmwEaFUmSHAjGwzkoh54134994; UPLmwEaFUmSHAjGwzkoh54134994 = UPLmwEaFUmSHAjGwzkoh19584344; UPLmwEaFUmSHAjGwzkoh19584344 = UPLmwEaFUmSHAjGwzkoh14069762; UPLmwEaFUmSHAjGwzkoh14069762 = UPLmwEaFUmSHAjGwzkoh60580712; UPLmwEaFUmSHAjGwzkoh60580712 = UPLmwEaFUmSHAjGwzkoh39314422; UPLmwEaFUmSHAjGwzkoh39314422 = UPLmwEaFUmSHAjGwzkoh23411761; UPLmwEaFUmSHAjGwzkoh23411761 = UPLmwEaFUmSHAjGwzkoh30744220; UPLmwEaFUmSHAjGwzkoh30744220 = UPLmwEaFUmSHAjGwzkoh49756232; UPLmwEaFUmSHAjGwzkoh49756232 = UPLmwEaFUmSHAjGwzkoh5152341; UPLmwEaFUmSHAjGwzkoh5152341 = UPLmwEaFUmSHAjGwzkoh2132012;} // Junk Finished // Junk Code By Peatreat & Thaisen's Gen void PLFvQpiJvXqNOFyoQJtA84626179() { int WpvwPyuISJamDYIHLlDP5050959 = -388768117; int WpvwPyuISJamDYIHLlDP53764479 = -766394583; int WpvwPyuISJamDYIHLlDP54167023 = -916580881; int WpvwPyuISJamDYIHLlDP11840139 = -852587489; int WpvwPyuISJamDYIHLlDP11045717 = -362150509; int WpvwPyuISJamDYIHLlDP99975381 = -238043020; int WpvwPyuISJamDYIHLlDP60657173 = -254212573; int WpvwPyuISJamDYIHLlDP31760847 = -276988328; int WpvwPyuISJamDYIHLlDP81567768 = -265837111; int WpvwPyuISJamDYIHLlDP49069977 = -48393092; int WpvwPyuISJamDYIHLlDP78155721 = -43766624; int WpvwPyuISJamDYIHLlDP36557528 = -240877919; int WpvwPyuISJamDYIHLlDP31074265 = -913866392; int WpvwPyuISJamDYIHLlDP15185575 = -956244914; int WpvwPyuISJamDYIHLlDP12462704 = -35437984; int WpvwPyuISJamDYIHLlDP84287011 = 65243019; int WpvwPyuISJamDYIHLlDP71149025 = -62118425; int WpvwPyuISJamDYIHLlDP28125020 = -434966751; int WpvwPyuISJamDYIHLlDP72380197 = -36448232; int WpvwPyuISJamDYIHLlDP64625296 = -771541097; int WpvwPyuISJamDYIHLlDP81644753 = 78816002; int WpvwPyuISJamDYIHLlDP58716843 = -715097030; int WpvwPyuISJamDYIHLlDP68542739 = -349611718; int WpvwPyuISJamDYIHLlDP50362190 = -93376240; int WpvwPyuISJamDYIHLlDP7935126 = -118142972; int WpvwPyuISJamDYIHLlDP94102319 = -687511968; int WpvwPyuISJamDYIHLlDP18177282 = -473830012; int WpvwPyuISJamDYIHLlDP21250621 = -456194147; int WpvwPyuISJamDYIHLlDP21412798 = -737405538; int WpvwPyuISJamDYIHLlDP35389897 = -379078145; int WpvwPyuISJamDYIHLlDP63204551 = -321886197; int WpvwPyuISJamDYIHLlDP51518517 = -931044894; int WpvwPyuISJamDYIHLlDP84116215 = -452816328; int WpvwPyuISJamDYIHLlDP87464741 = -249535735; int WpvwPyuISJamDYIHLlDP89549674 = -512031824; int WpvwPyuISJamDYIHLlDP58757811 = -911790072; int WpvwPyuISJamDYIHLlDP79841920 = -148883045; int WpvwPyuISJamDYIHLlDP63610202 = -551822008; int WpvwPyuISJamDYIHLlDP97815760 = -989054204; int WpvwPyuISJamDYIHLlDP15153037 = -17552161; int WpvwPyuISJamDYIHLlDP73792203 = 70273355; int WpvwPyuISJamDYIHLlDP65173046 = -308818428; int WpvwPyuISJamDYIHLlDP99313034 = -342211426; int WpvwPyuISJamDYIHLlDP52332097 = 77709562; int WpvwPyuISJamDYIHLlDP54387685 = -380862231; int WpvwPyuISJamDYIHLlDP8007848 = -950225297; int WpvwPyuISJamDYIHLlDP64846379 = -249725645; int WpvwPyuISJamDYIHLlDP33219457 = -386998013; int WpvwPyuISJamDYIHLlDP67106029 = 25033982; int WpvwPyuISJamDYIHLlDP62431408 = -598338713; int WpvwPyuISJamDYIHLlDP76807640 = -459639415; int WpvwPyuISJamDYIHLlDP98108116 = -961958275; int WpvwPyuISJamDYIHLlDP22955495 = -279064982; int WpvwPyuISJamDYIHLlDP57575173 = -497325520; int WpvwPyuISJamDYIHLlDP2981426 = -673560715; int WpvwPyuISJamDYIHLlDP46334116 = -673671088; int WpvwPyuISJamDYIHLlDP85221739 = -316782866; int WpvwPyuISJamDYIHLlDP3804833 = -723204641; int WpvwPyuISJamDYIHLlDP3905014 = -634444518; int WpvwPyuISJamDYIHLlDP16943397 = -674638541; int WpvwPyuISJamDYIHLlDP81798099 = -764213009; int WpvwPyuISJamDYIHLlDP39406553 = -798018426; int WpvwPyuISJamDYIHLlDP10348049 = -539582790; int WpvwPyuISJamDYIHLlDP46177872 = -886758966; int WpvwPyuISJamDYIHLlDP85865426 = -726506896; int WpvwPyuISJamDYIHLlDP26637205 = -112721730; int WpvwPyuISJamDYIHLlDP52441312 = -788061591; int WpvwPyuISJamDYIHLlDP43609523 = -564330657; int WpvwPyuISJamDYIHLlDP25635901 = -344213091; int WpvwPyuISJamDYIHLlDP53704892 = -123647912; int WpvwPyuISJamDYIHLlDP4445091 = -785873937; int WpvwPyuISJamDYIHLlDP7538824 = -510296417; int WpvwPyuISJamDYIHLlDP30309260 = -445912547; int WpvwPyuISJamDYIHLlDP57227161 = 81103929; int WpvwPyuISJamDYIHLlDP90833092 = -741814453; int WpvwPyuISJamDYIHLlDP16471707 = -612365571; int WpvwPyuISJamDYIHLlDP59403808 = -272885605; int WpvwPyuISJamDYIHLlDP16210642 = -327321280; int WpvwPyuISJamDYIHLlDP95974504 = -712514009; int WpvwPyuISJamDYIHLlDP99927278 = -167917676; int WpvwPyuISJamDYIHLlDP29255941 = -337786324; int WpvwPyuISJamDYIHLlDP84957825 = 13168001; int WpvwPyuISJamDYIHLlDP54144591 = -381228130; int WpvwPyuISJamDYIHLlDP58981390 = -39066825; int WpvwPyuISJamDYIHLlDP58582256 = -919438730; int WpvwPyuISJamDYIHLlDP65096435 = -359927922; int WpvwPyuISJamDYIHLlDP28563023 = -551979913; int WpvwPyuISJamDYIHLlDP26541042 = -955490808; int WpvwPyuISJamDYIHLlDP84483315 = -575975020; int WpvwPyuISJamDYIHLlDP43215559 = -838360737; int WpvwPyuISJamDYIHLlDP73536071 = -495007206; int WpvwPyuISJamDYIHLlDP76037087 = -425678404; int WpvwPyuISJamDYIHLlDP59705188 = -917377491; int WpvwPyuISJamDYIHLlDP80872363 = -214415663; int WpvwPyuISJamDYIHLlDP33354937 = -253339153; int WpvwPyuISJamDYIHLlDP34385651 = -131708219; int WpvwPyuISJamDYIHLlDP54824998 = -769235638; int WpvwPyuISJamDYIHLlDP53135162 = -455452460; int WpvwPyuISJamDYIHLlDP66466671 = -195783543; int WpvwPyuISJamDYIHLlDP27750481 = -388768117; WpvwPyuISJamDYIHLlDP5050959 = WpvwPyuISJamDYIHLlDP53764479; WpvwPyuISJamDYIHLlDP53764479 = WpvwPyuISJamDYIHLlDP54167023; WpvwPyuISJamDYIHLlDP54167023 = WpvwPyuISJamDYIHLlDP11840139; WpvwPyuISJamDYIHLlDP11840139 = WpvwPyuISJamDYIHLlDP11045717; WpvwPyuISJamDYIHLlDP11045717 = WpvwPyuISJamDYIHLlDP99975381; WpvwPyuISJamDYIHLlDP99975381 = WpvwPyuISJamDYIHLlDP60657173; WpvwPyuISJamDYIHLlDP60657173 = WpvwPyuISJamDYIHLlDP31760847; WpvwPyuISJamDYIHLlDP31760847 = WpvwPyuISJamDYIHLlDP81567768; WpvwPyuISJamDYIHLlDP81567768 = WpvwPyuISJamDYIHLlDP49069977; WpvwPyuISJamDYIHLlDP49069977 = WpvwPyuISJamDYIHLlDP78155721; WpvwPyuISJamDYIHLlDP78155721 = WpvwPyuISJamDYIHLlDP36557528; WpvwPyuISJamDYIHLlDP36557528 = WpvwPyuISJamDYIHLlDP31074265; WpvwPyuISJamDYIHLlDP31074265 = WpvwPyuISJamDYIHLlDP15185575; WpvwPyuISJamDYIHLlDP15185575 = WpvwPyuISJamDYIHLlDP12462704; WpvwPyuISJamDYIHLlDP12462704 = WpvwPyuISJamDYIHLlDP84287011; WpvwPyuISJamDYIHLlDP84287011 = WpvwPyuISJamDYIHLlDP71149025; WpvwPyuISJamDYIHLlDP71149025 = WpvwPyuISJamDYIHLlDP28125020; WpvwPyuISJamDYIHLlDP28125020 = WpvwPyuISJamDYIHLlDP72380197; WpvwPyuISJamDYIHLlDP72380197 = WpvwPyuISJamDYIHLlDP64625296; WpvwPyuISJamDYIHLlDP64625296 = WpvwPyuISJamDYIHLlDP81644753; WpvwPyuISJamDYIHLlDP81644753 = WpvwPyuISJamDYIHLlDP58716843; WpvwPyuISJamDYIHLlDP58716843 = WpvwPyuISJamDYIHLlDP68542739; WpvwPyuISJamDYIHLlDP68542739 = WpvwPyuISJamDYIHLlDP50362190; WpvwPyuISJamDYIHLlDP50362190 = WpvwPyuISJamDYIHLlDP7935126; WpvwPyuISJamDYIHLlDP7935126 = WpvwPyuISJamDYIHLlDP94102319; WpvwPyuISJamDYIHLlDP94102319 = WpvwPyuISJamDYIHLlDP18177282; WpvwPyuISJamDYIHLlDP18177282 = WpvwPyuISJamDYIHLlDP21250621; WpvwPyuISJamDYIHLlDP21250621 = WpvwPyuISJamDYIHLlDP21412798; WpvwPyuISJamDYIHLlDP21412798 = WpvwPyuISJamDYIHLlDP35389897; WpvwPyuISJamDYIHLlDP35389897 = WpvwPyuISJamDYIHLlDP63204551; WpvwPyuISJamDYIHLlDP63204551 = WpvwPyuISJamDYIHLlDP51518517; WpvwPyuISJamDYIHLlDP51518517 = WpvwPyuISJamDYIHLlDP84116215; WpvwPyuISJamDYIHLlDP84116215 = WpvwPyuISJamDYIHLlDP87464741; WpvwPyuISJamDYIHLlDP87464741 = WpvwPyuISJamDYIHLlDP89549674; WpvwPyuISJamDYIHLlDP89549674 = WpvwPyuISJamDYIHLlDP58757811; WpvwPyuISJamDYIHLlDP58757811 = WpvwPyuISJamDYIHLlDP79841920; WpvwPyuISJamDYIHLlDP79841920 = WpvwPyuISJamDYIHLlDP63610202; WpvwPyuISJamDYIHLlDP63610202 = WpvwPyuISJamDYIHLlDP97815760; WpvwPyuISJamDYIHLlDP97815760 = WpvwPyuISJamDYIHLlDP15153037; WpvwPyuISJamDYIHLlDP15153037 = WpvwPyuISJamDYIHLlDP73792203; WpvwPyuISJamDYIHLlDP73792203 = WpvwPyuISJamDYIHLlDP65173046; WpvwPyuISJamDYIHLlDP65173046 = WpvwPyuISJamDYIHLlDP99313034; WpvwPyuISJamDYIHLlDP99313034 = WpvwPyuISJamDYIHLlDP52332097; WpvwPyuISJamDYIHLlDP52332097 = WpvwPyuISJamDYIHLlDP54387685; WpvwPyuISJamDYIHLlDP54387685 = WpvwPyuISJamDYIHLlDP8007848; WpvwPyuISJamDYIHLlDP8007848 = WpvwPyuISJamDYIHLlDP64846379; WpvwPyuISJamDYIHLlDP64846379 = WpvwPyuISJamDYIHLlDP33219457; WpvwPyuISJamDYIHLlDP33219457 = WpvwPyuISJamDYIHLlDP67106029; WpvwPyuISJamDYIHLlDP67106029 = WpvwPyuISJamDYIHLlDP62431408; WpvwPyuISJamDYIHLlDP62431408 = WpvwPyuISJamDYIHLlDP76807640; WpvwPyuISJamDYIHLlDP76807640 = WpvwPyuISJamDYIHLlDP98108116; WpvwPyuISJamDYIHLlDP98108116 = WpvwPyuISJamDYIHLlDP22955495; WpvwPyuISJamDYIHLlDP22955495 = WpvwPyuISJamDYIHLlDP57575173; WpvwPyuISJamDYIHLlDP57575173 = WpvwPyuISJamDYIHLlDP2981426; WpvwPyuISJamDYIHLlDP2981426 = WpvwPyuISJamDYIHLlDP46334116; WpvwPyuISJamDYIHLlDP46334116 = WpvwPyuISJamDYIHLlDP85221739; WpvwPyuISJamDYIHLlDP85221739 = WpvwPyuISJamDYIHLlDP3804833; WpvwPyuISJamDYIHLlDP3804833 = WpvwPyuISJamDYIHLlDP3905014; WpvwPyuISJamDYIHLlDP3905014 = WpvwPyuISJamDYIHLlDP16943397; WpvwPyuISJamDYIHLlDP16943397 = WpvwPyuISJamDYIHLlDP81798099; WpvwPyuISJamDYIHLlDP81798099 = WpvwPyuISJamDYIHLlDP39406553; WpvwPyuISJamDYIHLlDP39406553 = WpvwPyuISJamDYIHLlDP10348049; WpvwPyuISJamDYIHLlDP10348049 = WpvwPyuISJamDYIHLlDP46177872; WpvwPyuISJamDYIHLlDP46177872 = WpvwPyuISJamDYIHLlDP85865426; WpvwPyuISJamDYIHLlDP85865426 = WpvwPyuISJamDYIHLlDP26637205; WpvwPyuISJamDYIHLlDP26637205 = WpvwPyuISJamDYIHLlDP52441312; WpvwPyuISJamDYIHLlDP52441312 = WpvwPyuISJamDYIHLlDP43609523; WpvwPyuISJamDYIHLlDP43609523 = WpvwPyuISJamDYIHLlDP25635901; WpvwPyuISJamDYIHLlDP25635901 = WpvwPyuISJamDYIHLlDP53704892; WpvwPyuISJamDYIHLlDP53704892 = WpvwPyuISJamDYIHLlDP4445091; WpvwPyuISJamDYIHLlDP4445091 = WpvwPyuISJamDYIHLlDP7538824; WpvwPyuISJamDYIHLlDP7538824 = WpvwPyuISJamDYIHLlDP30309260; WpvwPyuISJamDYIHLlDP30309260 = WpvwPyuISJamDYIHLlDP57227161; WpvwPyuISJamDYIHLlDP57227161 = WpvwPyuISJamDYIHLlDP90833092; WpvwPyuISJamDYIHLlDP90833092 = WpvwPyuISJamDYIHLlDP16471707; WpvwPyuISJamDYIHLlDP16471707 = WpvwPyuISJamDYIHLlDP59403808; WpvwPyuISJamDYIHLlDP59403808 = WpvwPyuISJamDYIHLlDP16210642; WpvwPyuISJamDYIHLlDP16210642 = WpvwPyuISJamDYIHLlDP95974504; WpvwPyuISJamDYIHLlDP95974504 = WpvwPyuISJamDYIHLlDP99927278; WpvwPyuISJamDYIHLlDP99927278 = WpvwPyuISJamDYIHLlDP29255941; WpvwPyuISJamDYIHLlDP29255941 = WpvwPyuISJamDYIHLlDP84957825; WpvwPyuISJamDYIHLlDP84957825 = WpvwPyuISJamDYIHLlDP54144591; WpvwPyuISJamDYIHLlDP54144591 = WpvwPyuISJamDYIHLlDP58981390; WpvwPyuISJamDYIHLlDP58981390 = WpvwPyuISJamDYIHLlDP58582256; WpvwPyuISJamDYIHLlDP58582256 = WpvwPyuISJamDYIHLlDP65096435; WpvwPyuISJamDYIHLlDP65096435 = WpvwPyuISJamDYIHLlDP28563023; WpvwPyuISJamDYIHLlDP28563023 = WpvwPyuISJamDYIHLlDP26541042; WpvwPyuISJamDYIHLlDP26541042 = WpvwPyuISJamDYIHLlDP84483315; WpvwPyuISJamDYIHLlDP84483315 = WpvwPyuISJamDYIHLlDP43215559; WpvwPyuISJamDYIHLlDP43215559 = WpvwPyuISJamDYIHLlDP73536071; WpvwPyuISJamDYIHLlDP73536071 = WpvwPyuISJamDYIHLlDP76037087; WpvwPyuISJamDYIHLlDP76037087 = WpvwPyuISJamDYIHLlDP59705188; WpvwPyuISJamDYIHLlDP59705188 = WpvwPyuISJamDYIHLlDP80872363; WpvwPyuISJamDYIHLlDP80872363 = WpvwPyuISJamDYIHLlDP33354937; WpvwPyuISJamDYIHLlDP33354937 = WpvwPyuISJamDYIHLlDP34385651; WpvwPyuISJamDYIHLlDP34385651 = WpvwPyuISJamDYIHLlDP54824998; WpvwPyuISJamDYIHLlDP54824998 = WpvwPyuISJamDYIHLlDP53135162; WpvwPyuISJamDYIHLlDP53135162 = WpvwPyuISJamDYIHLlDP66466671; WpvwPyuISJamDYIHLlDP66466671 = WpvwPyuISJamDYIHLlDP27750481; WpvwPyuISJamDYIHLlDP27750481 = WpvwPyuISJamDYIHLlDP5050959;} // Junk Finished // Junk Code By Peatreat & Thaisen's Gen void mUmxjYXGHdetyRRpWMMR60968497() { int GpecuGKFdGVfeFibKnSh37311767 = 35584121; int GpecuGKFdGVfeFibKnSh54986914 = -340011467; int GpecuGKFdGVfeFibKnSh87443602 = 80559736; int GpecuGKFdGVfeFibKnSh53348252 = -672823199; int GpecuGKFdGVfeFibKnSh96163235 = 88115932; int GpecuGKFdGVfeFibKnSh34072094 = -206018290; int GpecuGKFdGVfeFibKnSh58149474 = -438654406; int GpecuGKFdGVfeFibKnSh54516142 = -11137234; int GpecuGKFdGVfeFibKnSh54919212 = -142140512; int GpecuGKFdGVfeFibKnSh36577892 = -221259900; int GpecuGKFdGVfeFibKnSh39545762 = -631970867; int GpecuGKFdGVfeFibKnSh57710969 = 87964923; int GpecuGKFdGVfeFibKnSh59736313 = -120347851; int GpecuGKFdGVfeFibKnSh19381474 = -385792787; int GpecuGKFdGVfeFibKnSh51123609 = -277794754; int GpecuGKFdGVfeFibKnSh4363182 = -616044654; int GpecuGKFdGVfeFibKnSh77010197 = -78053003; int GpecuGKFdGVfeFibKnSh12745724 = -443860149; int GpecuGKFdGVfeFibKnSh52747437 = -805139922; int GpecuGKFdGVfeFibKnSh75817331 = -376297241; int GpecuGKFdGVfeFibKnSh94605458 = -208246214; int GpecuGKFdGVfeFibKnSh24450479 = -886766708; int GpecuGKFdGVfeFibKnSh38597644 = -119232389; int GpecuGKFdGVfeFibKnSh68940880 = -209344722; int GpecuGKFdGVfeFibKnSh96590184 = -196191153; int GpecuGKFdGVfeFibKnSh63614349 = -155532457; int GpecuGKFdGVfeFibKnSh43299367 = -471887511; int GpecuGKFdGVfeFibKnSh3991696 = -184758542; int GpecuGKFdGVfeFibKnSh67096361 = -319463609; int GpecuGKFdGVfeFibKnSh96757996 = -424971621; int GpecuGKFdGVfeFibKnSh4031954 = -76535805; int GpecuGKFdGVfeFibKnSh9692794 = 17708171; int GpecuGKFdGVfeFibKnSh56185845 = -681934663; int GpecuGKFdGVfeFibKnSh23014784 = -582211427; int GpecuGKFdGVfeFibKnSh30182505 = -925452586; int GpecuGKFdGVfeFibKnSh47219674 = -924156038; int GpecuGKFdGVfeFibKnSh73048064 = -366015092; int GpecuGKFdGVfeFibKnSh92879019 = -553388237; int GpecuGKFdGVfeFibKnSh35590875 = -582638190; int GpecuGKFdGVfeFibKnSh90826609 = -249068417; int GpecuGKFdGVfeFibKnSh88849901 = -727043035; int GpecuGKFdGVfeFibKnSh99036974 = -252233906; int GpecuGKFdGVfeFibKnSh45046385 = -854316414; int GpecuGKFdGVfeFibKnSh21114276 = -55570898; int GpecuGKFdGVfeFibKnSh30406534 = -77495753; int GpecuGKFdGVfeFibKnSh95669135 = -648830487; int GpecuGKFdGVfeFibKnSh96720486 = -179653398; int GpecuGKFdGVfeFibKnSh87431672 = -116876750; int GpecuGKFdGVfeFibKnSh33647281 = -588743370; int GpecuGKFdGVfeFibKnSh30234748 = -283362635; int GpecuGKFdGVfeFibKnSh56311333 = -440333648; int GpecuGKFdGVfeFibKnSh28186267 = -328350724; int GpecuGKFdGVfeFibKnSh51817443 = -239123217; int GpecuGKFdGVfeFibKnSh64954656 = -649451047; int GpecuGKFdGVfeFibKnSh66363038 = -685664559; int GpecuGKFdGVfeFibKnSh12861288 = -77649172; int GpecuGKFdGVfeFibKnSh16389271 = -120779079; int GpecuGKFdGVfeFibKnSh18502723 = -710095543; int GpecuGKFdGVfeFibKnSh56758068 = -376632047; int GpecuGKFdGVfeFibKnSh32548886 = -756351612; int GpecuGKFdGVfeFibKnSh90772726 = -734130780; int GpecuGKFdGVfeFibKnSh54157778 = -153895864; int GpecuGKFdGVfeFibKnSh87419781 = -691673625; int GpecuGKFdGVfeFibKnSh58161216 = -717168892; int GpecuGKFdGVfeFibKnSh32545938 = -44724095; int GpecuGKFdGVfeFibKnSh29852968 = -549679038; int GpecuGKFdGVfeFibKnSh1525125 = -230100414; int GpecuGKFdGVfeFibKnSh36721529 = -538136424; int GpecuGKFdGVfeFibKnSh89198969 = -460340201; int GpecuGKFdGVfeFibKnSh3903935 = -353638716; int GpecuGKFdGVfeFibKnSh31315118 = -150029562; int GpecuGKFdGVfeFibKnSh84131177 = -524664767; int GpecuGKFdGVfeFibKnSh77154848 = -861221960; int GpecuGKFdGVfeFibKnSh61920827 = -456071505; int GpecuGKFdGVfeFibKnSh86967430 = -649254206; int GpecuGKFdGVfeFibKnSh95568483 = -956012309; int GpecuGKFdGVfeFibKnSh79404094 = 67549706; int GpecuGKFdGVfeFibKnSh17483369 = 36338509; int GpecuGKFdGVfeFibKnSh38534346 = -31848969; int GpecuGKFdGVfeFibKnSh921049 = -547360666; int GpecuGKFdGVfeFibKnSh66893863 = -975879060; int GpecuGKFdGVfeFibKnSh55867695 = -255010761; int GpecuGKFdGVfeFibKnSh70344415 = -596015173; int GpecuGKFdGVfeFibKnSh36861613 = 63899025; int GpecuGKFdGVfeFibKnSh40446663 = -984637973; int GpecuGKFdGVfeFibKnSh75845687 = -748185082; int GpecuGKFdGVfeFibKnSh57875351 = -743168613; int GpecuGKFdGVfeFibKnSh91231188 = 67516383; int GpecuGKFdGVfeFibKnSh56651746 = -896546869; int GpecuGKFdGVfeFibKnSh17321217 = -747803414; int GpecuGKFdGVfeFibKnSh30830404 = -703376959; int GpecuGKFdGVfeFibKnSh54545341 = -655919550; int GpecuGKFdGVfeFibKnSh36120951 = -76756190; int GpecuGKFdGVfeFibKnSh3041989 = -826286579; int GpecuGKFdGVfeFibKnSh53883 = -514937638; int GpecuGKFdGVfeFibKnSh34692123 = -473147171; int GpecuGKFdGVfeFibKnSh11617194 = -560560281; int GpecuGKFdGVfeFibKnSh86885169 = -37147523; int GpecuGKFdGVfeFibKnSh88568337 = 89153196; int GpecuGKFdGVfeFibKnSh553567 = 35584121; GpecuGKFdGVfeFibKnSh37311767 = GpecuGKFdGVfeFibKnSh54986914; GpecuGKFdGVfeFibKnSh54986914 = GpecuGKFdGVfeFibKnSh87443602; GpecuGKFdGVfeFibKnSh87443602 = GpecuGKFdGVfeFibKnSh53348252; GpecuGKFdGVfeFibKnSh53348252 = GpecuGKFdGVfeFibKnSh96163235; GpecuGKFdGVfeFibKnSh96163235 = GpecuGKFdGVfeFibKnSh34072094; GpecuGKFdGVfeFibKnSh34072094 = GpecuGKFdGVfeFibKnSh58149474; GpecuGKFdGVfeFibKnSh58149474 = GpecuGKFdGVfeFibKnSh54516142; GpecuGKFdGVfeFibKnSh54516142 = GpecuGKFdGVfeFibKnSh54919212; GpecuGKFdGVfeFibKnSh54919212 = GpecuGKFdGVfeFibKnSh36577892; GpecuGKFdGVfeFibKnSh36577892 = GpecuGKFdGVfeFibKnSh39545762; GpecuGKFdGVfeFibKnSh39545762 = GpecuGKFdGVfeFibKnSh57710969; GpecuGKFdGVfeFibKnSh57710969 = GpecuGKFdGVfeFibKnSh59736313; GpecuGKFdGVfeFibKnSh59736313 = GpecuGKFdGVfeFibKnSh19381474; GpecuGKFdGVfeFibKnSh19381474 = GpecuGKFdGVfeFibKnSh51123609; GpecuGKFdGVfeFibKnSh51123609 = GpecuGKFdGVfeFibKnSh4363182; GpecuGKFdGVfeFibKnSh4363182 = GpecuGKFdGVfeFibKnSh77010197; GpecuGKFdGVfeFibKnSh77010197 = GpecuGKFdGVfeFibKnSh12745724; GpecuGKFdGVfeFibKnSh12745724 = GpecuGKFdGVfeFibKnSh52747437; GpecuGKFdGVfeFibKnSh52747437 = GpecuGKFdGVfeFibKnSh75817331; GpecuGKFdGVfeFibKnSh75817331 = GpecuGKFdGVfeFibKnSh94605458; GpecuGKFdGVfeFibKnSh94605458 = GpecuGKFdGVfeFibKnSh24450479; GpecuGKFdGVfeFibKnSh24450479 = GpecuGKFdGVfeFibKnSh38597644; GpecuGKFdGVfeFibKnSh38597644 = GpecuGKFdGVfeFibKnSh68940880; GpecuGKFdGVfeFibKnSh68940880 = GpecuGKFdGVfeFibKnSh96590184; GpecuGKFdGVfeFibKnSh96590184 = GpecuGKFdGVfeFibKnSh63614349; GpecuGKFdGVfeFibKnSh63614349 = GpecuGKFdGVfeFibKnSh43299367; GpecuGKFdGVfeFibKnSh43299367 = GpecuGKFdGVfeFibKnSh3991696; GpecuGKFdGVfeFibKnSh3991696 = GpecuGKFdGVfeFibKnSh67096361; GpecuGKFdGVfeFibKnSh67096361 = GpecuGKFdGVfeFibKnSh96757996; GpecuGKFdGVfeFibKnSh96757996 = GpecuGKFdGVfeFibKnSh4031954; GpecuGKFdGVfeFibKnSh4031954 = GpecuGKFdGVfeFibKnSh9692794; GpecuGKFdGVfeFibKnSh9692794 = GpecuGKFdGVfeFibKnSh56185845; GpecuGKFdGVfeFibKnSh56185845 = GpecuGKFdGVfeFibKnSh23014784; GpecuGKFdGVfeFibKnSh23014784 = GpecuGKFdGVfeFibKnSh30182505; GpecuGKFdGVfeFibKnSh30182505 = GpecuGKFdGVfeFibKnSh47219674; GpecuGKFdGVfeFibKnSh47219674 = GpecuGKFdGVfeFibKnSh73048064; GpecuGKFdGVfeFibKnSh73048064 = GpecuGKFdGVfeFibKnSh92879019; GpecuGKFdGVfeFibKnSh92879019 = GpecuGKFdGVfeFibKnSh35590875; GpecuGKFdGVfeFibKnSh35590875 = GpecuGKFdGVfeFibKnSh90826609; GpecuGKFdGVfeFibKnSh90826609 = GpecuGKFdGVfeFibKnSh88849901; GpecuGKFdGVfeFibKnSh88849901 = GpecuGKFdGVfeFibKnSh99036974; GpecuGKFdGVfeFibKnSh99036974 = GpecuGKFdGVfeFibKnSh45046385; GpecuGKFdGVfeFibKnSh45046385 = GpecuGKFdGVfeFibKnSh21114276; GpecuGKFdGVfeFibKnSh21114276 = GpecuGKFdGVfeFibKnSh30406534; GpecuGKFdGVfeFibKnSh30406534 = GpecuGKFdGVfeFibKnSh95669135; GpecuGKFdGVfeFibKnSh95669135 = GpecuGKFdGVfeFibKnSh96720486; GpecuGKFdGVfeFibKnSh96720486 = GpecuGKFdGVfeFibKnSh87431672; GpecuGKFdGVfeFibKnSh87431672 = GpecuGKFdGVfeFibKnSh33647281; GpecuGKFdGVfeFibKnSh33647281 = GpecuGKFdGVfeFibKnSh30234748; GpecuGKFdGVfeFibKnSh30234748 = GpecuGKFdGVfeFibKnSh56311333; GpecuGKFdGVfeFibKnSh56311333 = GpecuGKFdGVfeFibKnSh28186267; GpecuGKFdGVfeFibKnSh28186267 = GpecuGKFdGVfeFibKnSh51817443; GpecuGKFdGVfeFibKnSh51817443 = GpecuGKFdGVfeFibKnSh64954656; GpecuGKFdGVfeFibKnSh64954656 = GpecuGKFdGVfeFibKnSh66363038; GpecuGKFdGVfeFibKnSh66363038 = GpecuGKFdGVfeFibKnSh12861288; GpecuGKFdGVfeFibKnSh12861288 = GpecuGKFdGVfeFibKnSh16389271; GpecuGKFdGVfeFibKnSh16389271 = GpecuGKFdGVfeFibKnSh18502723; GpecuGKFdGVfeFibKnSh18502723 = GpecuGKFdGVfeFibKnSh56758068; GpecuGKFdGVfeFibKnSh56758068 = GpecuGKFdGVfeFibKnSh32548886; GpecuGKFdGVfeFibKnSh32548886 = GpecuGKFdGVfeFibKnSh90772726; GpecuGKFdGVfeFibKnSh90772726 = GpecuGKFdGVfeFibKnSh54157778; GpecuGKFdGVfeFibKnSh54157778 = GpecuGKFdGVfeFibKnSh87419781; GpecuGKFdGVfeFibKnSh87419781 = GpecuGKFdGVfeFibKnSh58161216; GpecuGKFdGVfeFibKnSh58161216 = GpecuGKFdGVfeFibKnSh32545938; GpecuGKFdGVfeFibKnSh32545938 = GpecuGKFdGVfeFibKnSh29852968; GpecuGKFdGVfeFibKnSh29852968 = GpecuGKFdGVfeFibKnSh1525125; GpecuGKFdGVfeFibKnSh1525125 = GpecuGKFdGVfeFibKnSh36721529; GpecuGKFdGVfeFibKnSh36721529 = GpecuGKFdGVfeFibKnSh89198969; GpecuGKFdGVfeFibKnSh89198969 = GpecuGKFdGVfeFibKnSh3903935; GpecuGKFdGVfeFibKnSh3903935 = GpecuGKFdGVfeFibKnSh31315118; GpecuGKFdGVfeFibKnSh31315118 = GpecuGKFdGVfeFibKnSh84131177; GpecuGKFdGVfeFibKnSh84131177 = GpecuGKFdGVfeFibKnSh77154848; GpecuGKFdGVfeFibKnSh77154848 = GpecuGKFdGVfeFibKnSh61920827; GpecuGKFdGVfeFibKnSh61920827 = GpecuGKFdGVfeFibKnSh86967430; GpecuGKFdGVfeFibKnSh86967430 = GpecuGKFdGVfeFibKnSh95568483; GpecuGKFdGVfeFibKnSh95568483 = GpecuGKFdGVfeFibKnSh79404094; GpecuGKFdGVfeFibKnSh79404094 = GpecuGKFdGVfeFibKnSh17483369; GpecuGKFdGVfeFibKnSh17483369 = GpecuGKFdGVfeFibKnSh38534346; GpecuGKFdGVfeFibKnSh38534346 = GpecuGKFdGVfeFibKnSh921049; GpecuGKFdGVfeFibKnSh921049 = GpecuGKFdGVfeFibKnSh66893863; GpecuGKFdGVfeFibKnSh66893863 = GpecuGKFdGVfeFibKnSh55867695; GpecuGKFdGVfeFibKnSh55867695 = GpecuGKFdGVfeFibKnSh70344415; GpecuGKFdGVfeFibKnSh70344415 = GpecuGKFdGVfeFibKnSh36861613; GpecuGKFdGVfeFibKnSh36861613 = GpecuGKFdGVfeFibKnSh40446663; GpecuGKFdGVfeFibKnSh40446663 = GpecuGKFdGVfeFibKnSh75845687; GpecuGKFdGVfeFibKnSh75845687 = GpecuGKFdGVfeFibKnSh57875351; GpecuGKFdGVfeFibKnSh57875351 = GpecuGKFdGVfeFibKnSh91231188; GpecuGKFdGVfeFibKnSh91231188 = GpecuGKFdGVfeFibKnSh56651746; GpecuGKFdGVfeFibKnSh56651746 = GpecuGKFdGVfeFibKnSh17321217; GpecuGKFdGVfeFibKnSh17321217 = GpecuGKFdGVfeFibKnSh30830404; GpecuGKFdGVfeFibKnSh30830404 = GpecuGKFdGVfeFibKnSh54545341; GpecuGKFdGVfeFibKnSh54545341 = GpecuGKFdGVfeFibKnSh36120951; GpecuGKFdGVfeFibKnSh36120951 = GpecuGKFdGVfeFibKnSh3041989; GpecuGKFdGVfeFibKnSh3041989 = GpecuGKFdGVfeFibKnSh53883; GpecuGKFdGVfeFibKnSh53883 = GpecuGKFdGVfeFibKnSh34692123; GpecuGKFdGVfeFibKnSh34692123 = GpecuGKFdGVfeFibKnSh11617194; GpecuGKFdGVfeFibKnSh11617194 = GpecuGKFdGVfeFibKnSh86885169; GpecuGKFdGVfeFibKnSh86885169 = GpecuGKFdGVfeFibKnSh88568337; GpecuGKFdGVfeFibKnSh88568337 = GpecuGKFdGVfeFibKnSh553567; GpecuGKFdGVfeFibKnSh553567 = GpecuGKFdGVfeFibKnSh37311767;} // Junk Finished // Junk Code By Peatreat & Thaisen's Gen void UrrysfMtoOjIcNpgLuVU85068282() { int pbkHlMAMiOifsjkfLjYS40230714 = -285688631; int pbkHlMAMiOifsjkfLjYS86310550 = -842676526; int pbkHlMAMiOifsjkfLjYS99375889 = -507465493; int pbkHlMAMiOifsjkfLjYS49707792 = -862656467; int pbkHlMAMiOifsjkfLjYS93890973 = -976668654; int pbkHlMAMiOifsjkfLjYS23363137 = -176141899; int pbkHlMAMiOifsjkfLjYS5473335 = -917335483; int pbkHlMAMiOifsjkfLjYS64899767 = -387925912; int pbkHlMAMiOifsjkfLjYS91395545 = -398145172; int pbkHlMAMiOifsjkfLjYS50412753 = 41584813; int pbkHlMAMiOifsjkfLjYS22864358 = -195604968; int pbkHlMAMiOifsjkfLjYS10119305 = -163477666; int pbkHlMAMiOifsjkfLjYS36372834 = -314707894; int pbkHlMAMiOifsjkfLjYS53580186 = -371215818; int pbkHlMAMiOifsjkfLjYS27332425 = -707188675; int pbkHlMAMiOifsjkfLjYS82403445 = -534520262; int pbkHlMAMiOifsjkfLjYS20871436 = -183558142; int pbkHlMAMiOifsjkfLjYS94659388 = -44848122; int pbkHlMAMiOifsjkfLjYS94394188 = -563037286; int pbkHlMAMiOifsjkfLjYS73722312 = 88604761; int pbkHlMAMiOifsjkfLjYS83032493 = -693521197; int pbkHlMAMiOifsjkfLjYS73283614 = -879729808; int pbkHlMAMiOifsjkfLjYS73717961 = 2261638; int pbkHlMAMiOifsjkfLjYS77718998 = -36793587; int pbkHlMAMiOifsjkfLjYS20926942 = -623450168; int pbkHlMAMiOifsjkfLjYS47149883 = -913631463; int pbkHlMAMiOifsjkfLjYS6460657 = -564323072; int pbkHlMAMiOifsjkfLjYS59111471 = -909479717; int pbkHlMAMiOifsjkfLjYS32243965 = -649809583; int pbkHlMAMiOifsjkfLjYS21208322 = -253828793; int pbkHlMAMiOifsjkfLjYS18518674 = -292525865; int pbkHlMAMiOifsjkfLjYS27654674 = -70014165; int pbkHlMAMiOifsjkfLjYS25748412 = -656070391; int pbkHlMAMiOifsjkfLjYS23646965 = -601735071; int pbkHlMAMiOifsjkfLjYS66481533 = -926506202; int pbkHlMAMiOifsjkfLjYS52846606 = -935982806; int pbkHlMAMiOifsjkfLjYS98104325 = -672086969; int pbkHlMAMiOifsjkfLjYS5022646 = -343804893; int pbkHlMAMiOifsjkfLjYS16585681 = -519269397; int pbkHlMAMiOifsjkfLjYS89730588 = -388761350; int pbkHlMAMiOifsjkfLjYS76125215 = -720434406; int pbkHlMAMiOifsjkfLjYS75686233 = -871246371; int pbkHlMAMiOifsjkfLjYS79463336 = -794045200; int pbkHlMAMiOifsjkfLjYS37172856 = -703861886; int pbkHlMAMiOifsjkfLjYS18361390 = -709516268; int pbkHlMAMiOifsjkfLjYS49308290 = -293728161; int pbkHlMAMiOifsjkfLjYS27028004 = -844370328; int pbkHlMAMiOifsjkfLjYS31874517 = -790124427; int pbkHlMAMiOifsjkfLjYS86971594 = -524520830; int pbkHlMAMiOifsjkfLjYS86420151 = -664370549; int pbkHlMAMiOifsjkfLjYS90744980 = -389044994; int pbkHlMAMiOifsjkfLjYS85588663 = -381817147; int pbkHlMAMiOifsjkfLjYS60306700 = -234925486; int pbkHlMAMiOifsjkfLjYS52311173 = -930538219; int pbkHlMAMiOifsjkfLjYS2035790 = 48189961; int pbkHlMAMiOifsjkfLjYS66947100 = -405958823; int pbkHlMAMiOifsjkfLjYS12592590 = -744938164; int pbkHlMAMiOifsjkfLjYS21656891 = -370671906; int pbkHlMAMiOifsjkfLjYS28780850 = -139206300; int pbkHlMAMiOifsjkfLjYS46741090 = 36962808; int pbkHlMAMiOifsjkfLjYS16902480 = -611818828; int pbkHlMAMiOifsjkfLjYS46361864 = 92144234; int pbkHlMAMiOifsjkfLjYS32655803 = -738116330; int pbkHlMAMiOifsjkfLjYS70187224 = -44316380; int pbkHlMAMiOifsjkfLjYS31894080 = -665889323; int pbkHlMAMiOifsjkfLjYS95209683 = -25590803; int pbkHlMAMiOifsjkfLjYS84370893 = -507407275; int pbkHlMAMiOifsjkfLjYS12725870 = -712972824; int pbkHlMAMiOifsjkfLjYS87098652 = -444709616; int pbkHlMAMiOifsjkfLjYS74485819 = -771205870; int pbkHlMAMiOifsjkfLjYS84299119 = -862433294; int pbkHlMAMiOifsjkfLjYS15848790 = -839753249; int pbkHlMAMiOifsjkfLjYS78073707 = -525578726; int pbkHlMAMiOifsjkfLjYS4663601 = -74275936; int pbkHlMAMiOifsjkfLjYS97597097 = -190960833; int pbkHlMAMiOifsjkfLjYS7346261 = -822274827; int pbkHlMAMiOifsjkfLjYS93820278 = 14315392; int pbkHlMAMiOifsjkfLjYS36545105 = -293876476; int pbkHlMAMiOifsjkfLjYS59357609 = -327277320; int pbkHlMAMiOifsjkfLjYS71618651 = -229722007; int pbkHlMAMiOifsjkfLjYS20121879 = 30738865; int pbkHlMAMiOifsjkfLjYS74586140 = -774198645; int pbkHlMAMiOifsjkfLjYS72139876 = -284958888; int pbkHlMAMiOifsjkfLjYS45823814 = -985439034; int pbkHlMAMiOifsjkfLjYS30463341 = -864783800; int pbkHlMAMiOifsjkfLjYS32930010 = -910708718; int pbkHlMAMiOifsjkfLjYS67347974 = -835088680; int pbkHlMAMiOifsjkfLjYS73437239 = -725532172; int pbkHlMAMiOifsjkfLjYS21611176 = -549925032; int pbkHlMAMiOifsjkfLjYS99534433 = -420547380; int pbkHlMAMiOifsjkfLjYS40254016 = -91044642; int pbkHlMAMiOifsjkfLjYS76447434 = -201415063; int pbkHlMAMiOifsjkfLjYS76241796 = -104598593; int pbkHlMAMiOifsjkfLjYS69844590 = -456232206; int pbkHlMAMiOifsjkfLjYS72828108 = -776942522; int pbkHlMAMiOifsjkfLjYS29763352 = -712578640; int pbkHlMAMiOifsjkfLjYS43030430 = -33130041; int pbkHlMAMiOifsjkfLjYS9276112 = -649728821; int pbkHlMAMiOifsjkfLjYS5278777 = 62027436; int pbkHlMAMiOifsjkfLjYS23151706 = -285688631; pbkHlMAMiOifsjkfLjYS40230714 = pbkHlMAMiOifsjkfLjYS86310550; pbkHlMAMiOifsjkfLjYS86310550 = pbkHlMAMiOifsjkfLjYS99375889; pbkHlMAMiOifsjkfLjYS99375889 = pbkHlMAMiOifsjkfLjYS49707792; pbkHlMAMiOifsjkfLjYS49707792 = pbkHlMAMiOifsjkfLjYS93890973; pbkHlMAMiOifsjkfLjYS93890973 = pbkHlMAMiOifsjkfLjYS23363137; pbkHlMAMiOifsjkfLjYS23363137 = pbkHlMAMiOifsjkfLjYS5473335; pbkHlMAMiOifsjkfLjYS5473335 = pbkHlMAMiOifsjkfLjYS64899767; pbkHlMAMiOifsjkfLjYS64899767 = pbkHlMAMiOifsjkfLjYS91395545; pbkHlMAMiOifsjkfLjYS91395545 = pbkHlMAMiOifsjkfLjYS50412753; pbkHlMAMiOifsjkfLjYS50412753 = pbkHlMAMiOifsjkfLjYS22864358; pbkHlMAMiOifsjkfLjYS22864358 = pbkHlMAMiOifsjkfLjYS10119305; pbkHlMAMiOifsjkfLjYS10119305 = pbkHlMAMiOifsjkfLjYS36372834; pbkHlMAMiOifsjkfLjYS36372834 = pbkHlMAMiOifsjkfLjYS53580186; pbkHlMAMiOifsjkfLjYS53580186 = pbkHlMAMiOifsjkfLjYS27332425; pbkHlMAMiOifsjkfLjYS27332425 = pbkHlMAMiOifsjkfLjYS82403445; pbkHlMAMiOifsjkfLjYS82403445 = pbkHlMAMiOifsjkfLjYS20871436; pbkHlMAMiOifsjkfLjYS20871436 = pbkHlMAMiOifsjkfLjYS94659388; pbkHlMAMiOifsjkfLjYS94659388 = pbkHlMAMiOifsjkfLjYS94394188; pbkHlMAMiOifsjkfLjYS94394188 = pbkHlMAMiOifsjkfLjYS73722312; pbkHlMAMiOifsjkfLjYS73722312 = pbkHlMAMiOifsjkfLjYS83032493; pbkHlMAMiOifsjkfLjYS83032493 = pbkHlMAMiOifsjkfLjYS73283614; pbkHlMAMiOifsjkfLjYS73283614 = pbkHlMAMiOifsjkfLjYS73717961; pbkHlMAMiOifsjkfLjYS73717961 = pbkHlMAMiOifsjkfLjYS77718998; pbkHlMAMiOifsjkfLjYS77718998 = pbkHlMAMiOifsjkfLjYS20926942; pbkHlMAMiOifsjkfLjYS20926942 = pbkHlMAMiOifsjkfLjYS47149883; pbkHlMAMiOifsjkfLjYS47149883 = pbkHlMAMiOifsjkfLjYS6460657; pbkHlMAMiOifsjkfLjYS6460657 = pbkHlMAMiOifsjkfLjYS59111471; pbkHlMAMiOifsjkfLjYS59111471 = pbkHlMAMiOifsjkfLjYS32243965; pbkHlMAMiOifsjkfLjYS32243965 = pbkHlMAMiOifsjkfLjYS21208322; pbkHlMAMiOifsjkfLjYS21208322 = pbkHlMAMiOifsjkfLjYS18518674; pbkHlMAMiOifsjkfLjYS18518674 = pbkHlMAMiOifsjkfLjYS27654674; pbkHlMAMiOifsjkfLjYS27654674 = pbkHlMAMiOifsjkfLjYS25748412; pbkHlMAMiOifsjkfLjYS25748412 = pbkHlMAMiOifsjkfLjYS23646965; pbkHlMAMiOifsjkfLjYS23646965 = pbkHlMAMiOifsjkfLjYS66481533; pbkHlMAMiOifsjkfLjYS66481533 = pbkHlMAMiOifsjkfLjYS52846606; pbkHlMAMiOifsjkfLjYS52846606 = pbkHlMAMiOifsjkfLjYS98104325; pbkHlMAMiOifsjkfLjYS98104325 = pbkHlMAMiOifsjkfLjYS5022646; pbkHlMAMiOifsjkfLjYS5022646 = pbkHlMAMiOifsjkfLjYS16585681; pbkHlMAMiOifsjkfLjYS16585681 = pbkHlMAMiOifsjkfLjYS89730588; pbkHlMAMiOifsjkfLjYS89730588 = pbkHlMAMiOifsjkfLjYS76125215; pbkHlMAMiOifsjkfLjYS76125215 = pbkHlMAMiOifsjkfLjYS75686233; pbkHlMAMiOifsjkfLjYS75686233 = pbkHlMAMiOifsjkfLjYS79463336; pbkHlMAMiOifsjkfLjYS79463336 = pbkHlMAMiOifsjkfLjYS37172856; pbkHlMAMiOifsjkfLjYS37172856 = pbkHlMAMiOifsjkfLjYS18361390; pbkHlMAMiOifsjkfLjYS18361390 = pbkHlMAMiOifsjkfLjYS49308290; pbkHlMAMiOifsjkfLjYS49308290 = pbkHlMAMiOifsjkfLjYS27028004; pbkHlMAMiOifsjkfLjYS27028004 = pbkHlMAMiOifsjkfLjYS31874517; pbkHlMAMiOifsjkfLjYS31874517 = pbkHlMAMiOifsjkfLjYS86971594; pbkHlMAMiOifsjkfLjYS86971594 = pbkHlMAMiOifsjkfLjYS86420151; pbkHlMAMiOifsjkfLjYS86420151 = pbkHlMAMiOifsjkfLjYS90744980; pbkHlMAMiOifsjkfLjYS90744980 = pbkHlMAMiOifsjkfLjYS85588663; pbkHlMAMiOifsjkfLjYS85588663 = pbkHlMAMiOifsjkfLjYS60306700; pbkHlMAMiOifsjkfLjYS60306700 = pbkHlMAMiOifsjkfLjYS52311173; pbkHlMAMiOifsjkfLjYS52311173 = pbkHlMAMiOifsjkfLjYS2035790; pbkHlMAMiOifsjkfLjYS2035790 = pbkHlMAMiOifsjkfLjYS66947100; pbkHlMAMiOifsjkfLjYS66947100 = pbkHlMAMiOifsjkfLjYS12592590; pbkHlMAMiOifsjkfLjYS12592590 = pbkHlMAMiOifsjkfLjYS21656891; pbkHlMAMiOifsjkfLjYS21656891 = pbkHlMAMiOifsjkfLjYS28780850; pbkHlMAMiOifsjkfLjYS28780850 = pbkHlMAMiOifsjkfLjYS46741090; pbkHlMAMiOifsjkfLjYS46741090 = pbkHlMAMiOifsjkfLjYS16902480; pbkHlMAMiOifsjkfLjYS16902480 = pbkHlMAMiOifsjkfLjYS46361864; pbkHlMAMiOifsjkfLjYS46361864 = pbkHlMAMiOifsjkfLjYS32655803; pbkHlMAMiOifsjkfLjYS32655803 = pbkHlMAMiOifsjkfLjYS70187224; pbkHlMAMiOifsjkfLjYS70187224 = pbkHlMAMiOifsjkfLjYS31894080; pbkHlMAMiOifsjkfLjYS31894080 = pbkHlMAMiOifsjkfLjYS95209683; pbkHlMAMiOifsjkfLjYS95209683 = pbkHlMAMiOifsjkfLjYS84370893; pbkHlMAMiOifsjkfLjYS84370893 = pbkHlMAMiOifsjkfLjYS12725870; pbkHlMAMiOifsjkfLjYS12725870 = pbkHlMAMiOifsjkfLjYS87098652; pbkHlMAMiOifsjkfLjYS87098652 = pbkHlMAMiOifsjkfLjYS74485819; pbkHlMAMiOifsjkfLjYS74485819 = pbkHlMAMiOifsjkfLjYS84299119; pbkHlMAMiOifsjkfLjYS84299119 = pbkHlMAMiOifsjkfLjYS15848790; pbkHlMAMiOifsjkfLjYS15848790 = pbkHlMAMiOifsjkfLjYS78073707; pbkHlMAMiOifsjkfLjYS78073707 = pbkHlMAMiOifsjkfLjYS4663601; pbkHlMAMiOifsjkfLjYS4663601 = pbkHlMAMiOifsjkfLjYS97597097; pbkHlMAMiOifsjkfLjYS97597097 = pbkHlMAMiOifsjkfLjYS7346261; pbkHlMAMiOifsjkfLjYS7346261 = pbkHlMAMiOifsjkfLjYS93820278; pbkHlMAMiOifsjkfLjYS93820278 = pbkHlMAMiOifsjkfLjYS36545105; pbkHlMAMiOifsjkfLjYS36545105 = pbkHlMAMiOifsjkfLjYS59357609; pbkHlMAMiOifsjkfLjYS59357609 = pbkHlMAMiOifsjkfLjYS71618651; pbkHlMAMiOifsjkfLjYS71618651 = pbkHlMAMiOifsjkfLjYS20121879; pbkHlMAMiOifsjkfLjYS20121879 = pbkHlMAMiOifsjkfLjYS74586140; pbkHlMAMiOifsjkfLjYS74586140 = pbkHlMAMiOifsjkfLjYS72139876; pbkHlMAMiOifsjkfLjYS72139876 = pbkHlMAMiOifsjkfLjYS45823814; pbkHlMAMiOifsjkfLjYS45823814 = pbkHlMAMiOifsjkfLjYS30463341; pbkHlMAMiOifsjkfLjYS30463341 = pbkHlMAMiOifsjkfLjYS32930010; pbkHlMAMiOifsjkfLjYS32930010 = pbkHlMAMiOifsjkfLjYS67347974; pbkHlMAMiOifsjkfLjYS67347974 = pbkHlMAMiOifsjkfLjYS73437239; pbkHlMAMiOifsjkfLjYS73437239 = pbkHlMAMiOifsjkfLjYS21611176; pbkHlMAMiOifsjkfLjYS21611176 = pbkHlMAMiOifsjkfLjYS99534433; pbkHlMAMiOifsjkfLjYS99534433 = pbkHlMAMiOifsjkfLjYS40254016; pbkHlMAMiOifsjkfLjYS40254016 = pbkHlMAMiOifsjkfLjYS76447434; pbkHlMAMiOifsjkfLjYS76447434 = pbkHlMAMiOifsjkfLjYS76241796; pbkHlMAMiOifsjkfLjYS76241796 = pbkHlMAMiOifsjkfLjYS69844590; pbkHlMAMiOifsjkfLjYS69844590 = pbkHlMAMiOifsjkfLjYS72828108; pbkHlMAMiOifsjkfLjYS72828108 = pbkHlMAMiOifsjkfLjYS29763352; pbkHlMAMiOifsjkfLjYS29763352 = pbkHlMAMiOifsjkfLjYS43030430; pbkHlMAMiOifsjkfLjYS43030430 = pbkHlMAMiOifsjkfLjYS9276112; pbkHlMAMiOifsjkfLjYS9276112 = pbkHlMAMiOifsjkfLjYS5278777; pbkHlMAMiOifsjkfLjYS5278777 = pbkHlMAMiOifsjkfLjYS23151706; pbkHlMAMiOifsjkfLjYS23151706 = pbkHlMAMiOifsjkfLjYS40230714;} // Junk Finished
134.831307
11,501
0.743088
DanielBence
20e772fcee4af78a9167eceea2628a7a87e54465
443
cpp
C++
10 Days of Statistics/Day-6/Day-6-The Central Limit Theorem III.cpp
pavstar619/HackerRank
697ee46b6e621ad884a064047461d7707b1413cd
[ "MIT" ]
61
2017-04-27T13:45:12.000Z
2022-01-27T11:40:15.000Z
10 Days of Statistics/Day-6/Day-6-The Central Limit Theorem III.cpp
fahad0193/HackerRank
eb6c95e16688c02921c1df6b6ea613667a251457
[ "MIT" ]
1
2017-06-24T14:16:06.000Z
2017-06-24T14:16:28.000Z
10 Days of Statistics/Day-6/Day-6-The Central Limit Theorem III.cpp
fahad0193/HackerRank
eb6c95e16688c02921c1df6b6ea613667a251457
[ "MIT" ]
78
2017-07-05T11:48:20.000Z
2022-02-08T08:04:22.000Z
#include <bits/stdc++.h> using namespace std; double marginError(double z, int sigma, int x) { return z * sigma / sqrt(x); } int main(void) { int x, meu, sigma; cin >> x; cin >> meu; cin >> sigma; double p, z; cin >> p; cin >> z; cout << fixed << setprecision(2) << meu - marginError(z, sigma, x) << endl; cout << fixed << setprecision(2) << meu + marginError(z, sigma, x) << endl; return 0; }
17.72
79
0.55079
pavstar619
20e78e1cfa121675c5113ab8e3290f244b540070
661
cpp
C++
DDrawCompat/v0.3.1/Win32/MsgHooks.cpp
elishacloud/dxwrapper
6be80570acfcfd2b6f8e0aec1ed250dd96f5be5c
[ "Zlib" ]
634
2017-02-09T01:32:58.000Z
2022-03-26T18:14:28.000Z
DDrawCompat/v0.3.1/Win32/MsgHooks.cpp
elishacloud/dxwrapper
6be80570acfcfd2b6f8e0aec1ed250dd96f5be5c
[ "Zlib" ]
128
2017-03-02T13:30:12.000Z
2022-03-11T07:08:24.000Z
DDrawCompat/v0.3.1/Win32/MsgHooks.cpp
elishacloud/dxwrapper
6be80570acfcfd2b6f8e0aec1ed250dd96f5be5c
[ "Zlib" ]
58
2017-05-16T14:42:35.000Z
2022-02-21T20:32:02.000Z
#define WIN32_LEAN_AND_MEAN #define CINTERFACE #include <Windows.h> #include <DDrawCompat/v0.3.1/Common/Hook.h> #include <DDrawCompat/v0.3.1/Win32/MsgHooks.h> namespace { HHOOK WINAPI setWindowsHookExA(int idHook, HOOKPROC lpfn, HINSTANCE hMod, DWORD dwThreadId) { if (WH_KEYBOARD_LL == idHook && hMod && GetModuleHandle("AcGenral") == hMod) { // This effectively disables the IgnoreAltTab shim return nullptr; } return CALL_ORIG_FUNC(SetWindowsHookExA)(idHook, lpfn, hMod, dwThreadId); } } namespace Win32 { namespace MsgHooks { void installHooks() { HOOK_FUNCTION(user32, SetWindowsHookExA, setWindowsHookExA); } } }
20.65625
92
0.726172
elishacloud
20e8467d9b10b31a3b54dec79147a02445d2219b
2,092
cpp
C++
src/test/TCAtl/RangeValueSlider.cpp
FreeAllegiance/AllegianceDX7
3955756dffea8e7e31d3a55fcf6184232b792195
[ "MIT" ]
76
2015-08-18T19:18:40.000Z
2022-01-08T12:47:22.000Z
src/test/TCAtl/RangeValueSlider.cpp
StudentAlleg/Allegiance
e91660a471eb4e57e9cea4c743ad43a82f8c7b18
[ "MIT" ]
37
2015-08-14T22:44:12.000Z
2020-01-21T01:03:06.000Z
src/test/TCAtl/RangeValueSlider.cpp
FreeAllegiance/Allegiance-AZ
1d8678ddff9e2efc79ed449de6d47544989bc091
[ "MIT" ]
42
2015-08-13T23:31:35.000Z
2022-03-17T02:20:26.000Z
///////////////////////////////////////////////////////////////////////////// // RangeValueSlider.cpp | Implementation of the TCRangeValueSlider class. #include "RangeValueSlider.h" ///////////////////////////////////////////////////////////////////////////// // TCRangeValueSlider ///////////////////////////////////////////////////////////////////////////// // Operations bool TCRangeValueSlider::Update(ULONG nObjects, ITCRangeValue** ppObjects) { // Enable/disable the controls if no objects or more than 1 object bool bEnable = (1 == nObjects); if (bEnable) { __try { // Get the object ITCRangeValue* pobj = ppObjects[0]; // Save the default value m_nValueDefault = pobj->DefaultValue; // Get the range of the value long nMin = pobj->MinValue; long nMax = pobj->MaxValue; long nSteps = nMax + 1 - nMin; // Set the tick frequency of the slider long nTickMarks = pobj->TickMarks; if (nTickMarks) { long nTickFreq = nSteps / pobj->TickMarks; SetTicFreq(nTickFreq); // Set the page size of the slider to be the same as the tick freq SetPageSize(nTickFreq); } else { ClearTics(); } // Set the line size of the slider long nGranularity = pobj->Granularity; SetLineSize(nGranularity); // Set the range of the slider SetRange(nMin, nMax, true); // Set the position of the slider long nValue = pobj->RangeValue; SetPos(nValue); } __except(1) { bEnable = false; } } // Enable/disable the window if no objects or more than 1 object EnableWindow(bEnable); // Returnt the enabled flag return bEnable; } HRESULT TCRangeValueSlider::Apply(ULONG nObjects, ITCRangeValue** ppObjects) { // Do nothing if no objects or more than 1 object if (1 != nObjects) return E_UNEXPECTED; // Get the object ITCRangeValue* pobj = ppObjects[0]; // Apply the slider setting to the object long nValue = GetPos(); return pobj->put_RangeValue(nValue); }
24.325581
77
0.5674
FreeAllegiance
20e8ef67bc739c95d3bc6e439d40a5872348b812
10,580
cpp
C++
src/src/vk/vulkan_memory_manager.cpp
N4G170/vulkan
aea90d2e7d4d59dd9743f36d159239f16ffdca61
[ "MIT" ]
null
null
null
src/src/vk/vulkan_memory_manager.cpp
N4G170/vulkan
aea90d2e7d4d59dd9743f36d159239f16ffdca61
[ "MIT" ]
null
null
null
src/src/vk/vulkan_memory_manager.cpp
N4G170/vulkan
aea90d2e7d4d59dd9743f36d159239f16ffdca61
[ "MIT" ]
null
null
null
#include "vulkan_memory_manager.hpp" #include <utility> #include "vulkan_utils.hpp" #include "vulkan_context.hpp" #include <iostream> namespace vk { //<f> Constructors & operator= VulkanMemoryManager::VulkanMemoryManager(VulkanContext* vulkan_context): m_vulkan_context{vulkan_context} { } VulkanMemoryManager::~VulkanMemoryManager() noexcept { // m_memory_blocks.clear(); m_vulkan_context = nullptr; } VulkanMemoryManager::VulkanMemoryManager(const VulkanMemoryManager& other) { } VulkanMemoryManager::VulkanMemoryManager(VulkanMemoryManager&& other) noexcept { } VulkanMemoryManager& VulkanMemoryManager::operator=(const VulkanMemoryManager& other) { if(this != &other)//not same ref { auto tmp(other); *this = std::move(tmp); } return *this; } VulkanMemoryManager& VulkanMemoryManager::operator=(VulkanMemoryManager&& other) noexcept { if(this != &other)//not same ref { //move here } return *this; } //</f> /Constructors & operator= //<f> Methods //<f> Buffer bool VulkanMemoryManager::RequestBuffer(VkDeviceSize buffer_size, VkBufferUsageFlags usage_flags, VkMemoryPropertyFlags property_flags, Buffer* buffer) { std::lock_guard<std::mutex> lock{m_blocks_access_mutex}; //<f> Create Buffer VkBufferCreateInfo buffer_create_info{}; buffer_create_info.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; buffer_create_info.pNext = nullptr; buffer_create_info.flags = 0; buffer_create_info.size = buffer_size; buffer_create_info.usage = usage_flags; buffer_create_info.sharingMode = VK_SHARING_MODE_EXCLUSIVE; if( vkCreateBuffer(*m_vulkan_context->LogicalDevice(), &buffer_create_info, nullptr, &buffer->buffer) != VK_SUCCESS ) throw std::runtime_error("Failed to create vertex buffer"); //</f> /Create Buffer //<f> Request Memory block VkMemoryRequirements buffer_memory_requirements; vkGetBufferMemoryRequirements(*m_vulkan_context->LogicalDevice(), buffer->buffer, &buffer_memory_requirements); auto memory_type_index{m_vulkan_context->FindMemoryTypeIndex(buffer_memory_requirements.memoryTypeBits, property_flags)}; auto key_pair{ std::make_pair(memory_type_index, property_flags) }; //find a valid memory block bool created{false}; //run through every block with the given key_pair for(auto& block : m_memory_blocks[key_pair]) { if(block.second.CreateBuffer(buffer_memory_requirements, usage_flags, buffer))//was able to create buffer created = true; } if(!created)//failed to create buffer, either by not having space in existing blocks or no block of the needed type exists { auto block_size{VulkanMemoryBlock::DefaultSize()}; while(block_size < buffer_size) block_size *= 2;//starting default is 64MB so we keep it as a pow2 //create new block VulkanMemoryBlock block{m_vulkan_context->LogicalDevice(), memory_type_index, block_size}; block.CreateBuffer(buffer_memory_requirements, usage_flags, buffer); //store memory block m_memory_blocks[key_pair].insert(std::make_pair(block.ID(), std::move(block))); } //</f> /Request Memory block return true; } void VulkanMemoryManager::DestroyBuffer(Buffer* buffer) { std::lock_guard<std::mutex> lock{m_blocks_access_mutex}; //tmp code for(auto& block_list : m_memory_blocks) { auto itr{block_list.second.find(buffer->block_id)}; if(itr != std::end(block_list.second))//we found the block owning the buffer itr->second.ReleaseBuffer(buffer); } } void VulkanMemoryManager::MapMemory(Buffer* buffer, void **ppData, VkMemoryMapFlags flags) { std::lock_guard<std::mutex> lock{m_blocks_access_mutex}; //tmp code for(auto& block_list : m_memory_blocks) { auto itr{block_list.second.find(buffer->block_id)}; if(itr != std::end(block_list.second))//we found the block owning the buffer itr->second.MapMemory(buffer, ppData, flags); } } void VulkanMemoryManager::UnmapMemory(Buffer* buffer) { std::lock_guard<std::mutex> lock{m_blocks_access_mutex}; //tmp code for(auto& block_list : m_memory_blocks) { auto itr{block_list.second.find(buffer->block_id)}; if(itr != std::end(block_list.second))//we found the block owning the buffer itr->second.UnmapMemory(buffer); } } //</f> /Buffer //<f> Image bool VulkanMemoryManager::RequestImageBuffer(uint32_t width, uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage_flags, VkMemoryPropertyFlags property_flags, ImageBuffer* buffer) { std::lock_guard<std::mutex> lock{m_blocks_access_mutex}; //<f> Create Image VkImageCreateInfo create_info{vk::ImageCreateInfo()}; create_info.imageType = VK_IMAGE_TYPE_2D; create_info.extent.width = width; create_info.extent.height = height; create_info.extent.depth = 1; create_info.mipLevels = 1; create_info.arrayLayers = 1; create_info.format = format; create_info.tiling = tiling; create_info.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; create_info.usage = usage_flags; // create_info.usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT;//we will copy to it(transfer) and use it in shaders to colour the mesh(sampled) create_info.sharingMode = VK_SHARING_MODE_EXCLUSIVE;//one queue at a time create_info.samples = VK_SAMPLE_COUNT_1_BIT; if( vkCreateImage(*m_vulkan_context->LogicalDevice(), &create_info, nullptr, &buffer->image) != VK_SUCCESS ) throw std::runtime_error("Failed to create image buffer"); //</f> /Create Image //<f> Request Memory block VkMemoryRequirements image_memory_requirements; vkGetImageMemoryRequirements(*m_vulkan_context->LogicalDevice(), buffer->image, &image_memory_requirements); auto memory_type_index{m_vulkan_context->FindMemoryTypeIndex(image_memory_requirements.memoryTypeBits, property_flags)}; auto image_size{image_memory_requirements.size}; auto key_pair{ std::make_pair(memory_type_index, property_flags) }; //find a valid memory block bool created{false}; //run through every block with the given key_pair for(auto& block : m_image_memory_blocks[key_pair]) { if(block.second.CreateImageBuffer(image_memory_requirements, usage_flags, buffer))//was able to create buffer created = true; } if(!created)//failed to create buffer, either by not having space in existing blocks or no block of the needed type exists { auto block_size{VulkanMemoryBlock::DefaultSize()}; while(block_size < image_size) block_size *= 2;//starting default is 64MB so we keep it as a pow2 //create new block VulkanMemoryBlock block{m_vulkan_context->LogicalDevice(), memory_type_index, block_size}; block.CreateImageBuffer(image_memory_requirements, usage_flags, buffer); //store memory block m_image_memory_blocks[key_pair].insert(std::make_pair(block.ID(), std::move(block))); } //</f> /Request Memory block return true; } bool VulkanMemoryManager::RequestCubemapBuffer(uint32_t width, uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage_flags, VkMemoryPropertyFlags property_flags, ImageBuffer* buffer) { std::lock_guard<std::mutex> lock{m_blocks_access_mutex}; //<f> Create Image VkImageCreateInfo create_info{vk::ImageCreateInfo()}; create_info.imageType = VK_IMAGE_TYPE_2D; create_info.flags = VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT; create_info.extent.width = width; create_info.extent.height = height; create_info.extent.depth = 1; create_info.mipLevels = 1; create_info.arrayLayers = 6;//6 faces of the cubemap create_info.format = format; create_info.tiling = tiling; create_info.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; create_info.usage = usage_flags; // create_info.usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT;//we will copy to it(transfer) and use it in shaders to colour the mesh(sampled) create_info.sharingMode = VK_SHARING_MODE_EXCLUSIVE;//one queue at a time create_info.samples = VK_SAMPLE_COUNT_1_BIT; if( vkCreateImage(*m_vulkan_context->LogicalDevice(), &create_info, nullptr, &buffer->image) != VK_SUCCESS ) throw std::runtime_error("Failed to create image buffer"); //</f> /Create Image //<f> Request Memory block VkMemoryRequirements image_memory_requirements; vkGetImageMemoryRequirements(*m_vulkan_context->LogicalDevice(), buffer->image, &image_memory_requirements); auto memory_type_index{m_vulkan_context->FindMemoryTypeIndex(image_memory_requirements.memoryTypeBits, property_flags)}; auto image_size{image_memory_requirements.size}; auto key_pair{ std::make_pair(memory_type_index, property_flags) }; //find a valid memory block bool created{false}; //run through every block with the given key_pair for(auto& block : m_image_memory_blocks[key_pair]) { if(block.second.CreateImageBuffer(image_memory_requirements, usage_flags, buffer))//was able to create buffer created = true; } if(!created)//failed to create buffer, either by not having space in existing blocks or no block of the needed type exists { auto block_size{VulkanMemoryBlock::DefaultSize()}; while(block_size < image_size) block_size *= 2;//starting default is 64MB so we keep it as a pow2 //create new block VulkanMemoryBlock block{m_vulkan_context->LogicalDevice(), memory_type_index, block_size}; block.CreateImageBuffer(image_memory_requirements, usage_flags, buffer); //store memory block m_image_memory_blocks[key_pair].insert(std::make_pair(block.ID(), std::move(block))); } //</f> /Request Memory block return true; } void VulkanMemoryManager::DestroyImageBuffer(ImageBuffer* buffer) { std::lock_guard<std::mutex> lock{m_blocks_access_mutex}; //tmp code for(auto& block_list : m_image_memory_blocks) { auto itr{block_list.second.find(buffer->block_id)}; if(itr != std::end(block_list.second))//we found the block owning the buffer itr->second.ReleaseImageBuffer(buffer); } } //</f> /Image void VulkanMemoryManager::Clear() { //memory block destructor will destroy the memory allocation m_memory_blocks.clear(); m_image_memory_blocks.clear(); } //</f> /Methods }//namespace
36.608997
208
0.727977
N4G170
20ea129aaba9eba777a5eb1689e94b4b94ffc96b
141
cpp
C++
modules/test/unit/examples/test_lesser.cpp
pbrunet/nt2
2aeca0f6a315725b335efd5d9dc95d72e10a7fb7
[ "BSL-1.0" ]
34
2017-05-19T18:10:17.000Z
2022-01-04T02:18:13.000Z
modules/test/unit/examples/test_lesser.cpp
pbrunet/nt2
2aeca0f6a315725b335efd5d9dc95d72e10a7fb7
[ "BSL-1.0" ]
null
null
null
modules/test/unit/examples/test_lesser.cpp
pbrunet/nt2
2aeca0f6a315725b335efd5d9dc95d72e10a7fb7
[ "BSL-1.0" ]
7
2017-12-02T12:59:17.000Z
2021-07-31T12:46:14.000Z
#include <nt2/sdk/unit/module.hpp> #include <nt2/sdk/unit/tests/relation.hpp> NT2_TEST_CASE(nt2_test_lesser) { NT2_TEST_LESSER(0.f, 3); }
17.625
42
0.744681
pbrunet
20ebf22705922377c623c9c12bf9a36de894fcad
1,286
cpp
C++
Algorithms/1935.MaxNumberOfWordsYouCanType/solution.cpp
stdstring/leetcode
84e6bade7d6fc1a737eb6796cb4e2565440db5e3
[ "MIT" ]
null
null
null
Algorithms/1935.MaxNumberOfWordsYouCanType/solution.cpp
stdstring/leetcode
84e6bade7d6fc1a737eb6796cb4e2565440db5e3
[ "MIT" ]
null
null
null
Algorithms/1935.MaxNumberOfWordsYouCanType/solution.cpp
stdstring/leetcode
84e6bade7d6fc1a737eb6796cb4e2565440db5e3
[ "MIT" ]
null
null
null
#include <array> #include <string> #include "gtest/gtest.h" namespace { class Solution { public: [[nodiscard]] int canBeTypedWords(std::string const &text, std::string const &brokenLetters) const { constexpr size_t alphabetSize = 26; constexpr size_t alphabetStart = 'a'; std::array<bool, alphabetSize> brokenLettersData{}; brokenLettersData.fill(false); for (const char brokenLetter : brokenLetters) brokenLettersData[brokenLetter - alphabetStart] = true; size_t wordsCount = 0; size_t canType = true; for (const char ch : text) { if (ch == ' ') { wordsCount += (canType ? 1 : 0); canType = true; } else if (brokenLettersData[ch - alphabetStart]) canType = false; } wordsCount += (canType ? 1 : 0); return static_cast<int>(wordsCount); } }; } namespace MaxNumberOfWordsYouCanTypeTask { TEST(MaxNumberOfWordsYouCanTypeTaskTests, Examples) { const Solution solution; ASSERT_EQ(1, solution.canBeTypedWords("hello world", "ad")); ASSERT_EQ(1, solution.canBeTypedWords("leet code", "lt")); ASSERT_EQ(0, solution.canBeTypedWords("leet code", "e")); } }
25.72
102
0.604977
stdstring
20ed76c1f86d76d05998fd0e7408fb8f70d88752
452
cc
C++
Code/0089-gray-code.cc
SMartQi/Leetcode
9e35c65a48ba1ecd5436bbe07dd65f993588766b
[ "MIT" ]
2
2019-12-06T14:08:57.000Z
2020-01-15T15:25:32.000Z
Code/0089-gray-code.cc
SMartQi/Leetcode
9e35c65a48ba1ecd5436bbe07dd65f993588766b
[ "MIT" ]
1
2020-01-15T16:29:16.000Z
2020-01-26T12:40:13.000Z
Code/0089-gray-code.cc
SMartQi/Leetcode
9e35c65a48ba1ecd5436bbe07dd65f993588766b
[ "MIT" ]
null
null
null
class Solution { public: vector<int> grayCode(int n) { vector<int> result; result.push_back(0); if (n == 0) return result; for (int i = 0; i < n; i++) { // the left most bit int mask = 1 << i; int s = result.size(); while (s) { int num = mask | result[--s]; result.push_back(num); } } return result; } };
25.111111
45
0.415929
SMartQi
20ed889bb2e2b98eb5841859625f759b32bd44c7
2,616
cpp
C++
SDL_Sprite_Animation/SDL_Sprite_Animation/Main.cpp
Joker2770/SDL2-Tutorial
05bc0b3105275eab9c7f12b2fada83a89cb14a16
[ "MIT" ]
null
null
null
SDL_Sprite_Animation/SDL_Sprite_Animation/Main.cpp
Joker2770/SDL2-Tutorial
05bc0b3105275eab9c7f12b2fada83a89cb14a16
[ "MIT" ]
null
null
null
SDL_Sprite_Animation/SDL_Sprite_Animation/Main.cpp
Joker2770/SDL2-Tutorial
05bc0b3105275eab9c7f12b2fada83a89cb14a16
[ "MIT" ]
null
null
null
#ifdef _WIN32 //Windows extern "C" { #include "SDL.h" #include "SDL_image.h" }; #else //Linux... #ifdef __cplusplus extern "C"{ #endif #include <SDL.h> #include <SDL_image.h> #ifdef __cplusplus }; #endif #endif #include <iostream> SDL_Texture *LoadTexture(std::string filePath, SDL_Renderer *renderTarget) { SDL_Texture *texture = nullptr; SDL_Surface *surface = IMG_Load(filePath.c_str()); if (surface == NULL) std::cout << "Error!" << std::endl; else { texture = SDL_CreateTextureFromSurface(renderTarget, surface); if (texture == NULL) std::cout << "Error!" << std::endl; } SDL_FreeSurface(surface); return texture; } int main(int argc, char *argv[]) { const int FPS = 32; double frameTime = 0.0f; SDL_Window *window = nullptr; SDL_Texture *currentImage = nullptr; SDL_Renderer *renderTarget = nullptr; SDL_Rect playerRect; SDL_Rect playerPosition; playerPosition.x = playerPosition.y = 0; playerPosition.w = playerPosition.h = 64; int textureWidth, textureHeight; int frameWidth, frameHeight; SDL_Init(SDL_INIT_VIDEO); if (!(IMG_Init(IMG_INIT_JPG | IMG_INIT_PNG)) & (IMG_INIT_JPG | IMG_INIT_PNG)) std::cout << "Error: " << IMG_GetError() << std::endl; window = SDL_CreateWindow("SDL Window", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, SDL_WINDOW_SHOWN); renderTarget = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); currentImage = LoadTexture(argv[1], renderTarget); SDL_QueryTexture(currentImage, NULL, NULL, &textureWidth, &textureHeight); frameWidth = textureWidth / 20; frameHeight = textureHeight; playerRect.x = playerRect.y = 0; playerRect.w = frameWidth; playerRect.h = frameHeight; SDL_SetRenderDrawColor(renderTarget, 0xFF, 0, 0, 0X10); bool isRunning = true; SDL_Event ev; while (isRunning) { while (SDL_PollEvent(&ev) != 0) { if (ev.type == SDL_QUIT) isRunning = false; } frameTime++; if (FPS / frameTime == 0.32) { frameTime = 0; playerRect.x += frameWidth; if (playerRect.x >= textureWidth) { playerRect.y += frameHeight; if (playerRect.y >= textureHeight) playerRect.y = 0; playerRect.x = 0; } } SDL_RenderClear(renderTarget); SDL_RenderCopy(renderTarget, currentImage, &playerRect, &playerPosition); SDL_RenderPresent(renderTarget); } SDL_DestroyWindow(window); SDL_DestroyTexture(currentImage); SDL_DestroyRenderer(renderTarget); window = nullptr; currentImage = nullptr; renderTarget = nullptr; SDL_Quit(); return 0; }
22.551724
118
0.679664
Joker2770
20f00e5d35bca8d6aa86ed141a9bd5589f102bda
4,963
cpp
C++
ffos/ota/src/ota/daemon/CheckDaemon.cpp
jsli/code-snippet
fd99819d58c4c3621790f551a82ac8714faebe4b
[ "MIT" ]
null
null
null
ffos/ota/src/ota/daemon/CheckDaemon.cpp
jsli/code-snippet
fd99819d58c4c3621790f551a82ac8714faebe4b
[ "MIT" ]
null
null
null
ffos/ota/src/ota/daemon/CheckDaemon.cpp
jsli/code-snippet
fd99819d58c4c3621790f551a82ac8714faebe4b
[ "MIT" ]
null
null
null
/* * CheckDaemon.cpp * * Created on: 2014-8-22 * Author: manson */ #include <unistd.h> #include <sys/types.h> #include "ota/daemon/CheckDaemon.h" #include "ota/config/OtaConfig.h" #include "utils/Logger.h" #include "utils/FsUtils.h" #include "net/HttpClient.h" #include "json/json.h" namespace ota { class DownloadListener: public download::Downloader::OnDownloadListener, public event::EventTarget { private: int counter; public: DownloadListener() : OnDownloadListener(), EventTarget() { counter = 0; } ~DownloadListener() { } void onRetry(download::Downloader *downloader, int count) { Log("listener: download retry"); Json::Value message; message["message"] = "retry"; send(message.toString()); } void onStart(download::Downloader *downloader) { Log("listener: download started"); Json::Value message; message["message"] = "start"; send(message.toString()); } void onFailed(download::Downloader *downloader, const std::string &reason) { Log("listener: download failed"); Json::Value message; message["message"] = "failed"; send(message.toString()); } void onSuccess(download::Downloader *downloader) { Log("listener: download success"); Json::Value message; message["message"] = "success"; message["path"] = downloader->GetDownloadTask()->GetDownloadPath(); send(message.toString()); } void onProgress(download::Downloader *downloader, double total, double progress) { counter++; if ((counter % 500) == 0 || (progress == total)) { Log( "CALLBACK: download progress: total=%f, progress=%f, percent=%%%f", total, progress, (progress * 100) / total); } } void send(const std::string message) { SendEvent(DOWNLOAD_EVENT, message); } std::string GetName() { return "DownloadListener"; } }; CheckDaemon::CheckDaemon() : Thread(true) { // TODO Auto-generated constructor stub m_DownloadListener = new DownloadListener(); m_OnDownloadListener = m_DownloadListener; m_EventTarget = m_DownloadListener; } CheckDaemon::~CheckDaemon() { // TODO Auto-generated destructor stub delete m_DownloadListener; } HttpResult * CheckDaemon::check() { std::string params = HttpParameter::GetInstance()->GetParameters(); Log("Http request paramter: %s", params.c_str()); net::HttpClient *hc = new net::HttpClient(); std::string response = hc->PostRequest(OTA_SERVER_API, params); HttpResult * result = new HttpResult(); if (!result->Load(response)) { delete result; result = NULL; } return result; } download::DownloadTask * CheckDaemon::createDownloadTask(HttpResult * result) { download::DownloadTask * task = NULL; download::DownloadTask * cacheTask = download::DownloadTask::CreateTaskFromCache(); do { if (cacheTask == NULL) { Log("no cache task"); break; } if (cacheTask->GetUrl() != result->GetUrl()) { Log("cache url ->[%s]", cacheTask->GetUrl().c_str()); Log("result url ->[%s]", result->GetUrl().c_str()); Log("url not match"); break; } if (cacheTask->GetFileSize() != result->GetFileSize()) { Log("cache file size ->[%f]", cacheTask->GetFileSize()); Log("result file size ->[%f]", result->GetFileSize()); Log("file size not match"); break; } if (!utils::FsUtils::IsFileExist(cacheTask->GetDownloadPath())) { Log("cache file missed ->[%s]", cacheTask->GetDownloadPath().c_str()); break; } double downloadedSize = utils::FsUtils::GetFileSize( cacheTask->GetDownloadPath()); double progress = cacheTask->GetProgress(); if (downloadedSize != progress) { Log("downloaded size ->[%f]", downloadedSize); Log("cache progress size ->[%f]", progress); Log("progress not match"); break; } task = cacheTask; } while (false); if (task == NULL) { if (cacheTask != NULL) { delete cacheTask; } utils::FsUtils::CleanDir(CACHE_ROOT); Log("create new DownloadTask"); task = download::DownloadTask::CreateNewTask(result->ToString()); } return task; } void CheckDaemon::Run() throw (utils::Exception) { Log("CheckDaemon Start...[%d]", gettid()); //wait for network connection sleep(30); int counter = 0; while (true) { Log("CheckDaemon run <%d> times", counter++); HttpResult * result = NULL; download::DownloadTask * task = NULL; download::Downloader * downloader = NULL; //must not delete downloader do { result = check(); if (result == NULL) { break; } result->LogSelf(); task = createDownloadTask(result); if (task == NULL) { break; } task->LogSelf(); downloader = new download::Downloader(task); downloader->SetDownloadListener(m_OnDownloadListener); if (downloader->Start() != 0) { break; } Log("Downloader running, wait..."); if (downloader->Join() != 0) { break; } Log("Downloader finished!"); } while (false); delete result; delete task; sleep(CHECK_INTERVAL); } } event::EventTarget * CheckDaemon::GetEventTarget() { return m_EventTarget; } }
23.975845
79
0.666734
jsli
20f5e3e2e06eae25f92fb1cb9f9470264ecb35a6
1,170
cpp
C++
Strings/remove_character.cpp
jahnvisrivastava100/CompetitiveProgrammingQuestionBank
0d72884ea5e0eb674a503b81ab65e444f5175cf4
[ "MIT" ]
931
2020-04-18T11:57:30.000Z
2022-03-31T15:15:39.000Z
Strings/remove_character.cpp
jahnvisrivastava100/CompetitiveProgrammingQuestionBank
0d72884ea5e0eb674a503b81ab65e444f5175cf4
[ "MIT" ]
661
2020-12-13T04:31:48.000Z
2022-03-15T19:11:54.000Z
Strings/remove_character.cpp
Mayuri-cell/CompetitiveProgrammingQuestionBank
eca2257d7da5346f45bdd7a351cc95bde6ed5c7d
[ "MIT" ]
351
2020-08-10T06:49:21.000Z
2022-03-25T04:02:12.000Z
/* Given two strings string1 and string2, remove those characters from first string(string1) which are present in second string(string2). Both the strings are different and contain only lowercase characters. NOTE: Size of first string is always greater than the size of second string( |string1| > |string2|). */ // Initial template for C++ #include <bits/stdc++.h> using namespace std; class Solution { public: bool isPresent(string string2, char ch) { for (int i = 0; i < string2.length(); i++) { if (string2[i] == ch) { return true; } } return false; } string removeChars(string string1, string string2) { string res = ""; for (int i = 0; i < string1.length(); i++) { if (!isPresent(string2, string1[i])) res += string1[i]; } return res; } }; int main() { int t; cin >> t; while (t--) { string string1, string2; cin >> string1; cin >> string2; Solution ob; cout << ob.removeChars(string1, string2) << endl; } return 0; }
22.5
118
0.545299
jahnvisrivastava100
20f74baa01709f573a7d499f1c2b0c29e75497f7
5,588
cpp
C++
Chapter/09_Debugging/kmain.cpp
arkiny/OSwithMSVC
90cd62ce9bbe8301942e024404f32b04874e7906
[ "MIT" ]
1
2021-05-09T01:24:05.000Z
2021-05-09T01:24:05.000Z
Chapter/09_Debugging/kmain.cpp
arkiny/OSwithMSVC
90cd62ce9bbe8301942e024404f32b04874e7906
[ "MIT" ]
null
null
null
Chapter/09_Debugging/kmain.cpp
arkiny/OSwithMSVC
90cd62ce9bbe8301942e024404f32b04874e7906
[ "MIT" ]
null
null
null
#include "kmain.h" #include "SkyTest.h" #include "PhysicalMemoryManager.h" #include "VirtualMemoryManager.h" #include "HeapManager.h" #include "HDDAdaptor.h" #include "RamDiskAdaptor.h" #include "FloppyDiskAdaptor.h" #include "StorageManager.h" #include "fileio.h" #include "SysAPI.h" #include "FPU.h" _declspec(naked) void multiboot_entry(void) { __asm { align 4 multiboot_header: //멀티부트 헤더 사이즈 : 0X20 dd(MULTIBOOT_HEADER_MAGIC); magic number dd(MULTIBOOT_HEADER_FLAGS); flags dd(CHECKSUM); checksum dd(HEADER_ADRESS); //헤더 주소 KERNEL_LOAD_ADDRESS+ALIGN(0x100064) dd(KERNEL_LOAD_ADDRESS); //커널이 로드된 가상주소 공간 dd(00); //사용되지 않음 dd(00); //사용되지 않음 dd(HEADER_ADRESS + 0x20); //커널 시작 주소 : 멀티부트 헤더 주소 + 0x20, kernel_entry kernel_entry: mov esp, KERNEL_STACK; //스택 설정 push 0; //플래그 레지스터 초기화 popf //GRUB에 의해 담겨 있는 정보값을 스택에 푸쉬한다. push ebx; //멀티부트 구조체 포인터 push eax; //매직 넘버 //위의 두 파라메터와 함께 kmain 함수를 호출한다. call kmain; //C++ 메인 함수 호출 //루프를 돈다. kmain이 리턴되지 않으면 아래 코드는 수행되지 않는다. halt: jmp halt; } } bool systemOn = false; uint32_t g_freeMemoryStartAddress = 0x00400000; //자유공간 시작주소 : 4MB uint32_t g_freeMemorySize = 0; void HardwareInitialize(); bool InitMemoryManager(multiboot_info* bootinfo); void ConstructFileSystem(); void kmain(unsigned long magic, unsigned long addr) { InitializeConstructors(); multiboot_info* pBootInfo = (multiboot_info*)addr; SkyConsole::Initialize(); //헥사를 표시할 때 %X는 integer, %x는 unsigned integer의 헥사값을 표시한다. SkyConsole::Print("*** Sky OS Console System Init ***\n"); SkyConsole::Print("GRUB Information\n"); SkyConsole::Print("Boot Loader Name : %s\n", (char*)pBootInfo->boot_loader_name); //kEnterCriticalSection(&g_criticalSection); HardwareInitialize(); SkyConsole::Print("Hardware Init Complete\n"); SetInterruptVector(); SkyConsole::Print("Interrput Handler Init Complete\n"); //물/가상 메모리 매니저를 초기화한다. //설정 시스템 메모리는 128MB InitMemoryManager(pBootInfo); SkyConsole::Print("Memory Manager Init Complete\n"); int heapFrameCount = 256 * 10 * 5; //프레임수 12800개, 52MB unsigned int requiredHeapSize = heapFrameCount * PAGE_SIZE; //요구되는 힙의 크기가 자유공간보다 크다면 그 크기를 자유공간 크기로 맞춘다음 반으로 줄인다. if (requiredHeapSize > g_freeMemorySize) { requiredHeapSize = g_freeMemorySize; heapFrameCount = requiredHeapSize / PAGE_SIZE / 2; } HeapManager::InitKernelHeap(heapFrameCount); SkyConsole::Print("Heap %dMB Allocated\n", requiredHeapSize / 1048576); /*if (false == InitFPU()) { SkyConsole::Print("[Warning] Floating Pointer Unit Detection Fail\n"); } else { EnableFPU(); SkyConsole::Print("FPU Init..\n"); }*/ InitKeyboard(); SkyConsole::Print("Keyboard Init..\n"); TestDebugging(); ConstructFileSystem(); for (;;); } void HardwareInitialize() { GDTInitialize(); IDTInitialize(0x8); PICInitialize(0x20, 0x28); InitializePIT(); } uint32_t GetFreeSpaceMemory(multiboot_info* bootinfo) { uint32_t memorySize = 0; uint32_t mmapEntryNum = bootinfo->mmap_length / sizeof(multiboot_memory_map_t); uint32_t mmapAddr = bootinfo->mmap_addr; #ifdef _SKY_DEBUG SkyConsole::Print("Memory Map Entry Num : %d\n", mmapEntryNum); #endif for (uint32_t i = 0; i < mmapEntryNum; i++) { multiboot_memory_map_t* entry = (multiboot_memory_map_t*)mmapAddr; #ifdef _SKY_DEBUG SkyConsole::Print("Memory Address : %x\n", entry->addr); SkyConsole::Print("Memory Length : %x\n", entry->len); SkyConsole::Print("Memory Type : %x\n", entry->type); SkyConsole::Print("Entry Size : %d\n", entry->size); #endif mmapAddr += sizeof(multiboot_memory_map_t); if (entry->addr + entry->len < g_freeMemoryStartAddress) continue; if (memorySize > entry->len) continue; memorySize = entry->len; if (entry->addr < g_freeMemoryStartAddress) memorySize -= (g_freeMemoryStartAddress - entry->addr); else g_freeMemoryStartAddress = entry->addr; } memorySize -= (memorySize % 4096); return memorySize; } bool InitMemoryManager(multiboot_info* bootinfo) { PhysicalMemoryManager::EnablePaging(false); g_freeMemorySize = GetFreeSpaceMemory(bootinfo); //물리 메모리 매니저 초기화 PhysicalMemoryManager::Initialize(g_freeMemorySize, g_freeMemoryStartAddress); //PhysicalMemoryManager::Dump(); //가상 메모리 매니저 초기화 VirtualMemoryManager::Initialize(); //PhysicalMemoryManager::Dump(); SkyConsole::Print("Free Memory Start Address(0x%x)\n", g_freeMemoryStartAddress); SkyConsole::Print("Free Memory Size(%dMB)\n", g_freeMemorySize / 1048576); return true; } void ConstructFileSystem() { //IDE 하드 디스크 /*FileSysAdaptor* pHDDAdaptor = new HDDAdaptor("HardDisk", 'C'); pHDDAdaptor->Initialize(); if (pHDDAdaptor->GetCount() > 0) { StorageManager::GetInstance()->RegisterFileSystem(pHDDAdaptor, 'C'); StorageManager::GetInstance()->SetCurrentFileSystemByID('C'); //TestHardDisk(); } else { delete pHDDAdaptor; }*/ //램 디스크 FileSysAdaptor* pRamDiskAdaptor = new RamDiskAdaptor("RamDisk", 'K'); if (pRamDiskAdaptor->Initialize() == true) { StorageManager::GetInstance()->RegisterFileSystem(pRamDiskAdaptor, 'K'); StorageManager::GetInstance()->SetCurrentFileSystemByID('K'); ((RamDiskAdaptor*)pRamDiskAdaptor)->InstallPackage(); } else { delete pRamDiskAdaptor; } //플로피 디스크 /*FileSysAdaptor* pFloppyDiskAdaptor = new FloppyDiskAdaptor("FloppyDisk", 'A'); if (pFloppyDiskAdaptor->Initialize() == true) { StorageManager::GetInstance()->RegisterFileSystem(pFloppyDiskAdaptor, 'A'); StorageManager::GetInstance()->SetCurrentFileSystemByID('A'); } else { delete pFloppyDiskAdaptor; } */ }
23.677966
82
0.717788
arkiny
20f7eacf50728a62c69a48cb1ff0c64118e5585b
822
cpp
C++
problemsets/UVA/10819.cpp
juarezpaulino/coderemite
a4649d3f3a89d234457032d14a6646b3af339ac1
[ "Apache-2.0" ]
null
null
null
problemsets/UVA/10819.cpp
juarezpaulino/coderemite
a4649d3f3a89d234457032d14a6646b3af339ac1
[ "Apache-2.0" ]
null
null
null
problemsets/UVA/10819.cpp
juarezpaulino/coderemite
a4649d3f3a89d234457032d14a6646b3af339ac1
[ "Apache-2.0" ]
null
null
null
/** * * Author: Juarez Paulino(coderemite) * Email: juarez.paulino@gmail.com * */ #include <cstdio> #include <algorithm> using namespace std; int DP[10202][101]; int ID[10202][101]; int id = 1; int M, N; int P[101], V[101]; int go(int m, int n) { if (n == N) { if (m >= 200 || M+200-m > 2000) return 0; return -1; } int &ret = DP[m][n]; if (ID[m][n]==id) return ret; ret = go(m, n+1); if (m >= P[n]) { int v = go(m-P[n], n+1); if (v != -1) ret = max(ret, v + V[n]); } ID[m][n] = id; return ret; } int main() { while (scanf("%d %d", &M, &N) != EOF) { for (int i = 0; i < N; i++) scanf("%d %d", P+i, V+i); int ret = go(M+200, 0); id++; printf("%d\n", ret); } return 0; }
17.125
43
0.43309
juarezpaulino
20f898051cd5d22ba0248c2dd1e681f6f434b29e
1,421
cpp
C++
Codes/N/NDIVPHI.cpp
Tanuj9043/spoj-submissions
71ee6aa00eb9fd2572d83001faf321909beac9ca
[ "MIT" ]
null
null
null
Codes/N/NDIVPHI.cpp
Tanuj9043/spoj-submissions
71ee6aa00eb9fd2572d83001faf321909beac9ca
[ "MIT" ]
null
null
null
Codes/N/NDIVPHI.cpp
Tanuj9043/spoj-submissions
71ee6aa00eb9fd2572d83001faf321909beac9ca
[ "MIT" ]
null
null
null
#include <iostream> #include <stdio.h> #include <cstdlib> #include <cstring> #include <algorithm> using namespace std; int flag[61504>>6], primes[6186], total; char N[32000], R[32000], S[32000]; int L; #define ifc(x) (flag[x>>6]&(1<<((x>>1)&31))) #define isc(x) (flag[x>>6]|=(1<<((x>>1)&31))) void sieve() { int i, j, k; for(i = 3; i < 248; i+=2) if(!ifc(i)) for(j = i*i, k=i<<1; j<61504; j+=k) isc(j); primes[0] = 2, total = 1; for(i = 3; i < 61504; i+=2) if(!ifc(i)) primes[total++] = i; } int multi(int n, char *num, int slen, char *res, int &rlen) { int carry = 0, a, i; rlen = 0; for(i = 0; i < slen || carry; i++) { a = n * ((i < slen)? num[i]-'0' : 0) + carry; res[rlen++] = a % 10 + '0'; carry = a / 10; } res[rlen] = 0;//ASCII value of '\0' is 0. return rlen; } bool gt(char *r, int rl, char *s, int sl) { if(rl != sl) return rl > sl; for(int i = rl-1, j = sl-1; i >= 0; i--, j--) { if(r[i] != s[j]) return r[i] > s[j]; } return false; } int main() { sieve(); int slen, rlen, i, test = 20, save; while(test--) { cin >> N; if(!strcmp("1", N)) { cout << 1 << endl; continue; } reverse(N, N + (L=strlen(N))); R[0] = '1'; slen = 1; for(i = 0; i < total; i++) { slen = multi(primes[i], R, slen, R, rlen); if(gt(R, rlen, N, L)) break; else { strcpy(S, R); save = rlen; } } reverse(S, S + save); cout << S << endl; } return 0; }
19.736111
61
0.503167
Tanuj9043
20fbc0d91e7c0a548a83816a1f209b4ea6619a0f
752
cpp
C++
programs_AtoZ/Check Prime Number/Check Prime Number using Class.cpp
EarthMan123/unitech_cpp_with_oops-course
941fec057bdcb8a5289994780ae553e6d4fddbbe
[ "Unlicense" ]
2
2021-06-12T02:55:28.000Z
2021-07-04T22:25:38.000Z
programs_AtoZ/Check Prime Number/Check Prime Number using Class.cpp
EarthMan123/unitech_cpp_with_oops-course
941fec057bdcb8a5289994780ae553e6d4fddbbe
[ "Unlicense" ]
null
null
null
programs_AtoZ/Check Prime Number/Check Prime Number using Class.cpp
EarthMan123/unitech_cpp_with_oops-course
941fec057bdcb8a5289994780ae553e6d4fddbbe
[ "Unlicense" ]
1
2021-07-04T22:28:38.000Z
2021-07-04T22:28:38.000Z
// Check Prime or Not using Class #include<iostream> using namespace std; class CodesCracker { private: int num, i, chk; public: int getData(); int checkPrimeNumber(int); }; int CodesCracker::getData() { cout<<"Enter a Number: "; cin>>num; return num; } int CodesCracker::checkPrimeNumber(int num) { int i, chk=0; for(i=2; i<num; i++) { if(num%i==0) { chk++; return chk; } } return chk; } int main() { CodesCracker c; int num, chk=0; num = c.getData(); chk = c.checkPrimeNumber(num); if(chk==0) cout<<"\nIt is a Prime Number"; else cout<<"\nIt is not a Prime Number"; cout<<endl; return 0; }
17.090909
43
0.530585
EarthMan123
20fc08c093597e22303de20bf328bb218667f8bb
870
hpp
C++
library/ATF/_starting_vote_inform_zoclInfo.hpp
lemkova/Yorozuya
f445d800078d9aba5de28f122cedfa03f26a38e4
[ "MIT" ]
29
2017-07-01T23:08:31.000Z
2022-02-19T10:22:45.000Z
library/ATF/_starting_vote_inform_zoclInfo.hpp
kotopes/Yorozuya
605c97d3a627a8f6545cc09f2a1b0a8afdedd33a
[ "MIT" ]
90
2017-10-18T21:24:51.000Z
2019-06-06T02:30:33.000Z
library/ATF/_starting_vote_inform_zoclInfo.hpp
kotopes/Yorozuya
605c97d3a627a8f6545cc09f2a1b0a8afdedd33a
[ "MIT" ]
44
2017-12-19T08:02:59.000Z
2022-02-24T23:15:01.000Z
// This file auto generated by plugin for ida pro. Generated code only for x64. Please, dont change manually #pragma once #include <common/common.h> #include <_starting_vote_inform_zocl.hpp> START_ATF_NAMESPACE namespace Info { using _starting_vote_inform_zoclctor__starting_vote_inform_zocl2_ptr = void (WINAPIV*)(struct _starting_vote_inform_zocl*); using _starting_vote_inform_zoclctor__starting_vote_inform_zocl2_clbk = void (WINAPIV*)(struct _starting_vote_inform_zocl*, _starting_vote_inform_zoclctor__starting_vote_inform_zocl2_ptr); using _starting_vote_inform_zoclsize4_ptr = int (WINAPIV*)(struct _starting_vote_inform_zocl*); using _starting_vote_inform_zoclsize4_clbk = int (WINAPIV*)(struct _starting_vote_inform_zocl*, _starting_vote_inform_zoclsize4_ptr); }; // end namespace Info END_ATF_NAMESPACE
48.333333
196
0.803448
lemkova
20fcdf40d494d629f08c627f39b3682d3ce29323
4,054
cpp
C++
src/RCubeViewer/Systems/PickSystem.cpp
pradeep-pyro/RCube
df0e13eadbd70aadd721629bc77f48c31f9c0f4d
[ "BSD-3-Clause" ]
4
2019-03-13T00:43:16.000Z
2021-12-02T00:27:52.000Z
src/RCubeViewer/Systems/PickSystem.cpp
pradeep-pyro/RCube
df0e13eadbd70aadd721629bc77f48c31f9c0f4d
[ "BSD-3-Clause" ]
14
2019-11-12T17:32:29.000Z
2021-03-18T07:22:24.000Z
src/RCubeViewer/Systems/PickSystem.cpp
pradeep-pyro/RCube
df0e13eadbd70aadd721629bc77f48c31f9c0f4d
[ "BSD-3-Clause" ]
1
2019-11-10T22:20:27.000Z
2019-11-10T22:20:27.000Z
#include "RCubeViewer/Systems/PickSystem.h" #include "RCube/Components/Camera.h" #include "RCube/Components/Drawable.h" #include "RCube/Components/Transform.h" #include "RCube/Systems/ForwardRenderSystem.h" #include "RCubeViewer/Components/CameraController.h" #include "RCubeViewer/Components/Pickable.h" #include "RCubeViewer/Pointcloud.h" #include "imgui.h" namespace rcube { namespace viewer { glm::vec2 screenToNDC(double xpos, double ypos, double width, double height) { const float x = static_cast<float>(xpos); const float y = static_cast<float>(ypos); const float w = static_cast<float>(width); const float h = static_cast<float>(height); float ndc_x = (2.0f * x) / w - 1.0f; float ndc_y = 1.0f - 2.0f * y / h; return glm::vec2(ndc_x, ndc_y); } PickSystem::PickSystem() { addFilter({Camera::family(), CameraController::family()}); addFilter({Drawable::family(), Transform::family(), Pickable::family()}); } void PickSystem::update(bool) { if (ImGui::GetIO().WantCaptureMouse) { return; } // Get the render system if we don't already have it if (render_system_ == nullptr) { render_system_ = dynamic_cast<ForwardRenderSystem *>(world_->getSystem("ForwardRenderSystem")); } // Can't pick without a render system if (render_system_ == nullptr) { return; } // Get the texture holding the picking information std::shared_ptr<Texture2D> objPrimID = render_system_->objPrimIDTexture(); if (objPrimID != nullptr) { glm::dvec2 xy = InputState::instance().mousePos(); const glm::dvec2 window_size = InputState::instance().windowSize(); // Initialize double-buffered PBOs if not already available if (pbos_.first() == nullptr) { pbos_.first() = PixelPackBuffer::create(size_t(window_size[0]) * size_t(window_size[1]), GL_STREAM_READ); } if (pbos_.second() == nullptr) { pbos_.second() = PixelPackBuffer::create( size_t(window_size[0]) * size_t(window_size[1]), GL_STREAM_READ); } // Transform mouse coordinate to texture image space xy /= window_size; xy[1] = 1.0 - xy[1]; xy[0] *= objPrimID->width(); xy[1] *= objPrimID->height(); // Return if mouse is outside window if (xy[0] < 0 || xy[1] < 0 || xy[0] >= objPrimID->width() || xy[1] >= objPrimID->height()) { return; } // Copy a single pixel from the texture asynchronously pbos_.first()->use(); objPrimID->getSubImage(int(xy.x), int(xy.y), 1, 1, (uint32_t *)NULL, 2); pbos_.second()->use(); GLuint *ptr = (GLuint *)pbos_.second()->map(); int entity_id = -1; int primitive_id = -1; if (ptr != nullptr) { entity_id = ptr[0]; // Entity ID primitive_id = ptr[1]; // Primitive ID pbos_.second()->unmap(); } pbos_.second()->done(); // Swap the buffers pbos_.increment(); // Assign to Pickable components for (Entity ent : getFilteredEntities({Drawable::family(), Transform::family(), Pickable::family()})) { Pickable *p = world_->getComponent<Pickable>(ent); if (p != nullptr) { p->picked = p->active && (ent.id() == entity_id); if (p->picked) { EntityHandle ent_handle; ent_handle.entity = ent; ent_handle.world = world_; p->picked_entity = ent_handle; p->picked_primitive = primitive_id; p->picked_xy = xy; } } } } } unsigned int PickSystem::priority() const { return 9000; } const std::string PickSystem::name() const { return "PickSystem"; } } // namespace viewer } // namespace rcube
31.671875
100
0.568328
pradeep-pyro
20fdeada0b93f5682ce471d92f56cbbefed44f3e
5,954
cpp
C++
src/coordinate_system.cpp
tomalexander/topaz
a0776a3b14629e5e1af3a4ed89fded3fe06cfea3
[ "Zlib" ]
1
2015-07-23T00:26:23.000Z
2015-07-23T00:26:23.000Z
src/coordinate_system.cpp
tomalexander/topaz
a0776a3b14629e5e1af3a4ed89fded3fe06cfea3
[ "Zlib" ]
null
null
null
src/coordinate_system.cpp
tomalexander/topaz
a0776a3b14629e5e1af3a4ed89fded3fe06cfea3
[ "Zlib" ]
null
null
null
/* * Copyright (c) 2012 Tom Alexander, Tate Larsen * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * * 3. This notice may not be removed or altered from any source * distribution. */ #include "coordinate_system.h" #include "panda_node.h" #include <sstream> using std::stringstream; namespace { void negate_v(topaz::panda_node* node) { for (topaz::panda_node* child : node->children) { if (child->tag == "V") { stringstream inp(child->content); stringstream out; float tmp; while (inp >> tmp) { out << -tmp << " "; } child->content = out.str(); } } } void inverse_v(topaz::panda_node* node) { for (topaz::panda_node* child : node->children) { if (child->tag == "V") { stringstream inp(child->content); stringstream out; float tmp; while (inp >> tmp) { out << 1.0f/tmp << " "; } child->content = out.str(); } } } } namespace topaz { extern glm::mat4 fix_z_up_matrix; void assign_coordinate_system(panda_node* node, coordinate_system system) { node->coordinate_system = system; for (panda_node* child : node->children) assign_coordinate_system(child, system); } coordinate_system detect_coordinate_system(panda_node* node) { if (node->coordinate_system != UNASSIGNED) return node->coordinate_system; std::list<panda_node*> queue; queue.push_back(node); while (!queue.empty()) { panda_node* current = queue.front(); queue.pop_front(); for (panda_node* child : current->children) queue.push_back(child); if (current->tag == "CoordinateSystem") { if (current->content == "Z-Up") { assign_coordinate_system(node, ZUP); return ZUP; } else if (current->content == "Y-Up") { assign_coordinate_system(node, YUP); return YUP; } } } assign_coordinate_system(node, ZUP); return ZUP; } void fix_coordinate_system(panda_node* top) { std::list<panda_node*> queue; queue.push_back(top); while (!queue.empty()) { panda_node* node = queue.front(); queue.pop_front(); for (panda_node* child : node->children) queue.push_back(child); coordinate_system system = detect_coordinate_system(node); if (node->tag == "Matrix4") { stringstream tmp(node->content); glm::mat4 mat(1.0f); for (int i = 0; i < 16; ++i) { float x; tmp >> x; mat[i%4][i/4] = x; } mat = glm::transpose(mat); stringstream out; for (int i = 0; i < 16; ++i) { out << mat[i%4][i/4] << " "; } node->content = out.str(); } if (node->tag == "Char*" && node->name == "order") { std::reverse(node->content.begin(), node->content.end()); if (system == ZUP) { size_t hpos = node->content.find('h'); size_t rpos = node->content.find('r'); if (hpos != string::npos) { node->content[hpos] = 'r'; } if (rpos != string::npos) { node->content[rpos] = 'h'; } } } if (node->tag == "S$Anim") { if (node->name == "r") { if (system == ZUP) node->name = "h"; negate_v(node); } else if (system == ZUP && node->name == "h") { node->name = "r"; } // else if (system == ZUP && node->name == "j") // { // node->name = "k"; // } // else if (system == ZUP && node->name == "k") // { // negate_v(node); // node->name = "j"; // } // else if (system == ZUP && node->name == "y") // { // node->name = "z"; // } // else if (system == ZUP && node->name == "z") // { // negate_v(node); // node->name = "y"; // } } } } }
31.336842
80
0.433322
tomalexander
20feca9f22ac9481e2e2bb9a016dff751212252d
5,165
cpp
C++
RtLibrary/src/Xuzumi/Platform.Windows/WindowsConsole.cpp
lymuc-studio/Xuzumi
6377b07ba991d3c4f7cfa92c25fd35cc8a136f81
[ "MIT" ]
null
null
null
RtLibrary/src/Xuzumi/Platform.Windows/WindowsConsole.cpp
lymuc-studio/Xuzumi
6377b07ba991d3c4f7cfa92c25fd35cc8a136f81
[ "MIT" ]
null
null
null
RtLibrary/src/Xuzumi/Platform.Windows/WindowsConsole.cpp
lymuc-studio/Xuzumi
6377b07ba991d3c4f7cfa92c25fd35cc8a136f81
[ "MIT" ]
null
null
null
#include "WindowsConsole.h" #include "Xuzumi/Core/Debug/InternalAssertion.h" #include "Xuzumi/Platform.Windows/Debug/HrDebug.h" #include <cstdio> #include <Windows.h> #include <Shobjidl.h> namespace Xuzumi { namespace { UINT convertForegroundConsoleColor_(ConsoleColor color) { UINT colorFlags = 0u; switch (color) { case ConsoleColor::White: colorFlags |= FOREGROUND_INTENSITY; colorFlags |= FOREGROUND_RED; colorFlags |= FOREGROUND_GREEN; colorFlags |= FOREGROUND_BLUE; break; case ConsoleColor::Black: break; case ConsoleColor::Blue: colorFlags |= FOREGROUND_INTENSITY; colorFlags |= FOREGROUND_BLUE; break; case ConsoleColor::Red: colorFlags |= FOREGROUND_INTENSITY; colorFlags |= FOREGROUND_RED; break; case ConsoleColor::Green: colorFlags |= FOREGROUND_INTENSITY; colorFlags |= FOREGROUND_GREEN; break; case ConsoleColor::Yello: colorFlags |= FOREGROUND_INTENSITY; colorFlags |= FOREGROUND_RED; colorFlags |= FOREGROUND_GREEN; break; case ConsoleColor::DarkWhite: colorFlags |= FOREGROUND_RED; colorFlags |= FOREGROUND_GREEN; colorFlags |= FOREGROUND_BLUE; break; case ConsoleColor::DarkBlue: colorFlags |= FOREGROUND_BLUE; break; case ConsoleColor::DarkRed: colorFlags |= FOREGROUND_RED; break; case ConsoleColor::DarkGreen: colorFlags |= FOREGROUND_GREEN; break; case ConsoleColor::DarkYello: colorFlags |= FOREGROUND_RED; colorFlags |= FOREGROUND_GREEN; break; } return colorFlags; } UINT convertBackgroundConsoleColor_(ConsoleColor color) { UINT colorFlags = 0u; switch (color) { case ConsoleColor::White: colorFlags |= BACKGROUND_INTENSITY; colorFlags |= BACKGROUND_RED; colorFlags |= BACKGROUND_GREEN; colorFlags |= BACKGROUND_BLUE; break; case ConsoleColor::Black: break; case ConsoleColor::Blue: colorFlags |= BACKGROUND_INTENSITY; colorFlags |= BACKGROUND_BLUE; break; case ConsoleColor::Red: colorFlags |= BACKGROUND_INTENSITY; colorFlags |= BACKGROUND_RED; break; case ConsoleColor::Green: colorFlags |= BACKGROUND_INTENSITY; colorFlags |= BACKGROUND_GREEN; break; case ConsoleColor::Yello: colorFlags |= BACKGROUND_INTENSITY; colorFlags |= BACKGROUND_RED; colorFlags |= BACKGROUND_GREEN; break; case ConsoleColor::DarkWhite: colorFlags |= BACKGROUND_RED; colorFlags |= BACKGROUND_GREEN; colorFlags |= BACKGROUND_BLUE; break; case ConsoleColor::DarkBlue: colorFlags |= BACKGROUND_BLUE; break; case ConsoleColor::DarkRed: colorFlags |= BACKGROUND_RED; break; case ConsoleColor::DarkGreen: colorFlags |= BACKGROUND_GREEN; break; case ConsoleColor::DarkYello: colorFlags |= BACKGROUND_RED; colorFlags |= BACKGROUND_GREEN; break; } return colorFlags; } } bool Console::Allocate() { Free(); s_instance = new WindowsConsole(); if (!s_instance->Valid_()) { Free(); return false; } return true; } WindowsConsole::WindowsConsole() { AllocWindowsConsole(); } WindowsConsole::~WindowsConsole() { FreeWindowsConsole(); } bool WindowsConsole::Valid_() const { return m_valid; } void WindowsConsole::SetBackgroundColor_(ConsoleColor color) { SetConsoleTextAttribute(m_consoleHandle, convertBackgroundConsoleColor_(color)); } void WindowsConsole::SetForegroundColor_(ConsoleColor color) { SetConsoleTextAttribute(m_consoleHandle, convertForegroundConsoleColor_(color)); } void WindowsConsole::AllocWindowsConsole() { m_valid = AllocConsole(); checkLastHr().LogFailure(); if (!m_valid) return; FILE* ioJob = nullptr; freopen_s(&ioJob, "CONIN$", "r", stdin); freopen_s(&ioJob, "CONOUT$", "w", stdout); freopen_s(&ioJob, "CONOUT$", "w", stderr); m_consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE); HWND consoleWindow = GetConsoleWindow(); EnableMenuItem(GetSystemMenu(consoleWindow, false), SC_CLOSE, MF_DISABLED); RemoveFromTaskbar(); } void WindowsConsole::FreeWindowsConsole() { HWND consoleWindow = GetConsoleWindow(); FreeConsole(); checkLastHr().LogFailure(); SendMessageA(consoleWindow, WM_CLOSE, 0, 0); m_valid = false; m_consoleHandle = nullptr; } void WindowsConsole::RemoveFromTaskbar() { HRESULT hr = CoInitialize(nullptr); checkHr(hr).LogFailure(); ITaskbarList* taskbar = nullptr; hr = CoCreateInstance( CLSID_TaskbarList, nullptr, CLSCTX_SERVER, IID_ITaskbarList, (void**)&taskbar); checkHr(hr).LogFailure(); if (FAILED(hr) || nullptr == taskbar) { XZ_CORE_ASSERT(false, "Cannot remove console window from task bar." " Closing the console window may result into undefined behaviour"); return; } hr = taskbar->DeleteTab(GetConsoleWindow()); checkHr(hr).LogFailure(); taskbar->Release(); if (FAILED(hr)) { XZ_CORE_ASSERT(false, "Cannot remove console window from task bar." " Closing the console window may result into undefined behaviour"); return; } return CoUninitialize(); } }
22.167382
77
0.700097
lymuc-studio
20ff4e05e7f7bdfad3644345adf591f1adb55a60
2,603
cpp
C++
torrijas/source/trjsequenceaction.cpp
GValiente/torrijas
209ca7e770860e5aea3a2322fdefee6f34b0e551
[ "Zlib" ]
4
2015-09-13T09:04:29.000Z
2016-08-21T22:12:59.000Z
torrijas/source/trjsequenceaction.cpp
GValiente/torrijas
209ca7e770860e5aea3a2322fdefee6f34b0e551
[ "Zlib" ]
null
null
null
torrijas/source/trjsequenceaction.cpp
GValiente/torrijas
209ca7e770860e5aea3a2322fdefee6f34b0e551
[ "Zlib" ]
null
null
null
// // Copyright (c) 2015 Gustavo Valiente gustavovalient@gmail.com // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. // #include "trjsequenceaction.h" #include "trjdebug.h" namespace trj { SequenceAction::SequenceAction(std::vector<Ptr<Action>>&& actions, bool forward) : mActions(std::move(actions)), mForward(forward) { TRJ_ASSERT(! mActions.empty(), "Actions vector is empty"); #ifdef TRJ_DEBUG for(const auto& action : mActions) { TRJ_ASSERT(action.get(), "Action is empty"); } #endif if(forward) { mIndex = 0; } else { mIndex = mActions.size() - 1; } } bool SequenceAction::run(float elapsedTime, Node& node) { auto& action = mActions[mIndex]; if(action->run(elapsedTime, node)) { if(mForward) { ++mIndex; if(mIndex == (int) mActions.size()) { return true; } } else { --mIndex; if(mIndex < 0) { return true; } } } return false; } Ptr<SequenceAction> SequenceAction::getSequenceClone() const { std::vector<Ptr<Action>> actions; actions.reserve(mActions.size()); for(const auto& action : mActions) { actions.push_back(action->getClone()); } return Ptr<SequenceAction>(new SequenceAction(std::move(actions), mForward)); } Ptr<SequenceAction> SequenceAction::getSequenceReversed() const { std::vector<Ptr<Action>> actions; actions.reserve(mActions.size()); for(const auto& action : mActions) { actions.push_back(action->getReversed()); } return Ptr<SequenceAction>(new SequenceAction(std::move(actions), ! mForward)); } }
25.519608
83
0.633116
GValiente
1f020fbbe19230c161940500849d1f2777756ac2
881
hpp
C++
include/operon/core/operator.hpp
ivor-dd/operon
57775816304b5df7a2f64e1505693a1fdf17a2fe
[ "MIT" ]
3
2019-10-29T09:36:18.000Z
2020-08-17T08:31:37.000Z
include/operon/core/operator.hpp
ivor-dd/operon
57775816304b5df7a2f64e1505693a1fdf17a2fe
[ "MIT" ]
3
2020-04-24T20:02:56.000Z
2020-10-14T10:07:18.000Z
include/operon/core/operator.hpp
ivor-dd/operon
57775816304b5df7a2f64e1505693a1fdf17a2fe
[ "MIT" ]
3
2020-01-29T05:36:03.000Z
2020-05-31T06:48:52.000Z
// SPDX-License-Identifier: MIT // SPDX-FileCopyrightText: Copyright 2019-2022 Heal Research #ifndef OPERON_OPERATOR_HPP #define OPERON_OPERATOR_HPP #include "types.hpp" namespace Operon { template <typename Ret, typename... Args> struct OperatorBase { using ReturnType = Ret; using ArgumentType = std::tuple<Args...>; // all operators take a random device (source of randomness) as the first parameter virtual auto operator()(Operon::RandomGenerator& random, Args... args) const -> Ret = 0; virtual ~OperatorBase() = default; OperatorBase() = default; OperatorBase(OperatorBase const& other) = default; OperatorBase(OperatorBase&& other) noexcept = default; auto operator=(OperatorBase const& other) -> OperatorBase& = default; auto operator=(OperatorBase&& other) noexcept -> OperatorBase& = default; }; } // namespace Operon #endif
31.464286
92
0.724177
ivor-dd
1f068f97526b1f11a9c7796cab8c6735efb4f176
2,095
cpp
C++
src/types/cube_framebuffer.cpp
chokomancarr/chokoengine2
2825f2b95d24689f4731b096c8be39cc9a0f759a
[ "Apache-2.0" ]
null
null
null
src/types/cube_framebuffer.cpp
chokomancarr/chokoengine2
2825f2b95d24689f4731b096c8be39cc9a0f759a
[ "Apache-2.0" ]
null
null
null
src/types/cube_framebuffer.cpp
chokomancarr/chokoengine2
2825f2b95d24689f4731b096c8be39cc9a0f759a
[ "Apache-2.0" ]
null
null
null
#include "chokoengine.hpp" CE_BEGIN_NAMESPACE _FrameBufferCube::_FrameBufferCube(uint r, std::vector<GLenum> types, int div) : _maps(types.size(), nullptr), _depth(nullptr), _lastUpdated(0) { std::vector<GLenum> bufs(types.size()); for (size_t a = 0; a < types.size(); a++) { _maps[a] = CubeMap::New(r, types[a], TextureOptions( TextureWrap::Clamp, TextureWrap::Clamp, div, true ), 0); bufs[a] = GL_COLOR_ATTACHMENT0 + (GLsizei)a; } _depth = DepthCubeMap_New(r); for (int f = 0; f < 6; f++) { GLuint fbo; glGenFramebuffers(1, &fbo); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo); for (size_t a = 0; a < types.size(); a++) { glFramebufferTexture2D(GL_FRAMEBUFFER, bufs[a], GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, _maps[a]->_pointer, 0); } glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, _depth->_pointer, 0); glDrawBuffers((GLsizei)bufs.size(), bufs.data()); GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); if (status != GL_FRAMEBUFFER_COMPLETE) { Debug::Error("FrameBuffer", "gl error " + std::to_string(status)); } //we have to use fromptr to construct from private function //this is not good design-wise, but will do for now //pass null textures to prevent double cleanup _pointers[f] = RenderTarget::FromPtr(new _RenderTarget(_depth->_reso, _depth->_reso, 0, 0, fbo)); } _tmpPointer = RenderTarget::New(_depth->_reso, _depth->_reso, true, true); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); } const CubeMap& _FrameBufferCube::map(int i) { return _maps[i]; } void _FrameBufferCube::Clear() const { float zeros[4] = {}; float one = 1; for (int a = 0; a < _maps.size(); a++) { glClearBufferfv(GL_COLOR, a, zeros); } glClearBufferfv(GL_DEPTH, 0, &one); } void _FrameBufferCube::Bind(CubeMapFace f) const { _pointers[(int)f]->BindTarget(); } void _FrameBufferCube::Unbind() const { glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); } FrameBufferCube FrameBufferCube_New(uint r, std::vector<GLenum> types) { return std::make_shared<_FrameBufferCube>(r, types); } CE_END_NAMESPACE
32.734375
119
0.713604
chokomancarr
1f0837174b1e9d05cd8e27dfb723a47c5ac5b268
2,501
cpp
C++
lib/commands/src/CommandCombat.cpp
ica778/adventure2019
51167c67967877eb0be2937b3e38780e6365e1b6
[ "MIT" ]
null
null
null
lib/commands/src/CommandCombat.cpp
ica778/adventure2019
51167c67967877eb0be2937b3e38780e6365e1b6
[ "MIT" ]
null
null
null
lib/commands/src/CommandCombat.cpp
ica778/adventure2019
51167c67967877eb0be2937b3e38780e6365e1b6
[ "MIT" ]
null
null
null
#include "CommandCombat.h" #include <boost/algorithm/string.hpp> void CommandCombat::executeInHeartbeat(const std::string& username, const std::vector<std::string>& fullCommand) { auto& combatManager = characterManager.getCombatManager(); auto& currentCombat = combatManager.getCombatWithPlayer(username); if(currentCombat.hasPlayer(username)){ onlineUserManager.addMessageToUser(username, "One of you are already in a combat!\n"); } auto& firstCommand = fullCommand.at(1); if(firstCommand == "challenge"){ auto& challengedName = fullCommand.at(2); if(combatManager.createInvite(username, challengedName)){ onlineUserManager.addMessageToUser(username, "Waiting for " + challengedName +" to accept challenge.\n"); onlineUserManager.addMessageToUser(challengedName, "You were challenged to combat by " + username +".\n"); } }else if(firstCommand == "join" || firstCommand == "accept"){ if(combatManager.confirmInvite(username)){ combatManager.removeInvite(username); currentCombat = combatManager.getCombatWithPlayer(username); auto opponentName = currentCombat.getOpponent(username); onlineUserManager.addMessageToUser(username, "joined combat with " + opponentName + ".\n"); onlineUserManager.addMessageToUser(opponentName, username + " accepted your challenge.\n"); } else { onlineUserManager.addMessageToUser(username, "You have not been challenged to combat.\n"); } } } std::vector<std::string> CommandCombat::reassembleCommand(std::string& fullCommand, bool& commandIsValid) { std::vector<std::string> processedCommand; //Format: combat challenge [username] //Format: combat accept //Format: combat accept [username] //Format: combat join [username] boost::trim_if(fullCommand, boost::is_any_of(" \t")); //split by " " boost::split(processedCommand, fullCommand, boost::is_any_of(" \t"), boost::token_compress_on); if(processedCommand.size() == 2) { commandIsValid = (processedCommand[1] == "accept"); } else if(processedCommand.size() == 3) { //reassemble the command commandIsValid = (processedCommand[1] == "accept" || processedCommand[1] == "join" || processedCommand[1] == "challenge"); } else { commandIsValid = false; } return processedCommand; }
44.660714
118
0.661335
ica778
1f0d6a327fbd20e3f2c972e17737883cc64eda60
8,904
cpp
C++
mpw/mpw_ioctl.cpp
tsupplis/mpw
bab20662aacc37ddadef3f2d075b167e263ea18f
[ "Xnet", "X11" ]
191
2015-01-04T17:17:00.000Z
2022-03-30T22:59:31.000Z
mpw/mpw_ioctl.cpp
tsupplis/mpw
bab20662aacc37ddadef3f2d075b167e263ea18f
[ "Xnet", "X11" ]
28
2015-01-06T01:16:25.000Z
2020-11-26T14:46:14.000Z
mpw/mpw_ioctl.cpp
tsupplis/mpw
bab20662aacc37ddadef3f2d075b167e263ea18f
[ "Xnet", "X11" ]
18
2015-01-26T21:33:31.000Z
2021-12-21T05:33:24.000Z
/* * Copyright (c) 2013, Kelvin W Sherlock * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #include "mpw.h" #include "mpw_internal.h" #include "mpw_errno.h" #include <algorithm> #include <memory> #include <string> #include <stdexcept> #include <cstdio> #include <cstring> #include <cerrno> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <sys/paths.h> #include <cpu/defs.h> #include <cpu/fmem.h> #include <cpu/CpuModule.h> #include <macos/errors.h> #include <toolbox/os.h> #include <toolbox/os_internal.h> using MacOS::macos_error_from_errno; namespace MPW { uint32_t ftrap_dup(uint32_t parm, uint32_t arg) { uint32_t d0; MPWFile f; f.flags = memoryReadWord(parm); f.error = memoryReadWord(parm + 2); f.device = memoryReadLong(parm + 4); f.cookie = memoryReadLong(parm + 8); f.count = memoryReadLong(parm + 12); f.buffer = memoryReadLong(parm + 16); f.error = 0; int fd = f.cookie; Log(" dup(%02x)\n", fd); d0 = OS::Internal::FDEntry::action(fd, [](int fd, OS::Internal::FDEntry &e){ e.refcount++; return 0; }, [](int fd){ return kEINVAL; } ); #if 0 try { auto &e = OS::Internal::FDTable.at(fd); if (e.refcount) { d0 = 0; fd.refcount++; } else { d0 = kEINVAL; } } catch(std::out_of_range &ex) { d0 = kEINVAL; } #endif memoryWriteWord(f.error, parm + 2); return d0; } uint32_t ftrap_bufsize(uint32_t parm, uint32_t arg) { // should return the preferred buffsize in *arg // an error will use the default size (0x400 bytes). MPWFile f; f.flags = memoryReadWord(parm); f.error = memoryReadWord(parm + 2); f.device = memoryReadLong(parm + 4); f.cookie = memoryReadLong(parm + 8); f.count = memoryReadLong(parm + 12); f.buffer = memoryReadLong(parm + 16); f.error = 0; int fd = f.cookie; Log(" bufsize(%02x)\n", fd); memoryWriteWord(f.error, parm + 2); return kEINVAL; } uint32_t ftrap_interactive(uint32_t parm, uint32_t arg) { // return 0 if interactive, an error if // non-interactive. uint32_t d0; MPWFile f; f.flags = memoryReadWord(parm); f.error = memoryReadWord(parm + 2); f.device = memoryReadLong(parm + 4); f.cookie = memoryReadLong(parm + 8); f.count = memoryReadLong(parm + 12); f.buffer = memoryReadLong(parm + 16); // linkgs reads from stdin and // doesn't work quite right when // this returns 0. So, don't. f.error = 0; int fd = f.cookie; Log(" interactive(%02x)\n", fd); d0 = OS::Internal::FDEntry::action(fd, [](int fd, OS::Internal::FDEntry &e){ int tty = ::isatty(fd); return tty ? 0 : kEINVAL; }, [](int fd){ return kEINVAL; } ); #if 0 try { auto &e = OS::Internal::FDTable.at(fd); if (e.refcount) { int tty = ::isatty(fd); d0 = tty ? 0 : kEINVAL; } else { d0 = kEINVAL; } } catch(std::out_of_range &ex) { d0 = kEINVAL; } #endif memoryWriteWord(f.error, parm + 2); return d0; } uint32_t ftrap_fname(uint32_t parm, uint32_t arg) { // return file name. // AsmIIgs uses this... MPWFile f; f.flags = memoryReadWord(parm); f.error = memoryReadWord(parm + 2); f.device = memoryReadLong(parm + 4); f.cookie = memoryReadLong(parm + 8); f.count = memoryReadLong(parm + 12); f.buffer = memoryReadLong(parm + 16); f.error = 0; int fd = f.cookie; Log(" fname(%02x)\n", fd); memoryWriteWord(f.error, parm + 2); return kEINVAL; } uint32_t ftrap_refnum(uint32_t parm, uint32_t arg) { // returns the refnum in *arg uint32_t d0; MPWFile f; f.flags = memoryReadWord(parm); f.error = memoryReadWord(parm + 2); f.device = memoryReadLong(parm + 4); f.cookie = memoryReadLong(parm + 8); f.count = memoryReadLong(parm + 12); f.buffer = memoryReadLong(parm + 16); f.error = 0; int fd = f.cookie; Log(" refnum(%02x)\n", fd); d0 = OS::Internal::FDEntry::action(fd, [arg](int fd, OS::Internal::FDEntry &e){ memoryWriteWord(fd, arg); return 0; }, [](int fd){ return kEINVAL; } ); #if 0 if (fd < 0 || fd >= FDTable.size() || !FDTable[fd]) { d0 = kEINVAL; } else { d0 = 0; memoryWriteWord(fd, arg); } #endif memoryWriteWord(f.error, parm + 2); return d0; } uint32_t ftrap_lseek(uint32_t parm, uint32_t arg) { MPWFile f; uint32_t d0; uint32_t whence = memoryReadLong(arg); int32_t offset = memoryReadLong(arg + 4); // signed value. int nativeWhence = 0; f.flags = memoryReadWord(parm); f.error = memoryReadWord(parm + 2); f.device = memoryReadLong(parm + 4); f.cookie = memoryReadLong(parm + 8); f.count = memoryReadLong(parm + 12); f.buffer = memoryReadLong(parm + 16); int fd = f.cookie; /* * LinkIIgs does a seek on stdin. If it doesn't cause an * error, then it attempts to read a list of files from stdin, * which causes problems. * (Get_Standard_Input -> fseek -> lseek -> ioctl ) * to compensate, error out if isatty. */ // TODO - MacOS returns eofERR and sets mark to eof // if seeking past the eof. switch (whence) { case kSEEK_CUR: nativeWhence = SEEK_CUR; break; case kSEEK_END: nativeWhence = SEEK_END; break; case kSEEK_SET: nativeWhence = SEEK_SET; break; default: memoryWriteWord(0, parm + 2); return kEINVAL; } Log(" lseek(%02x, %08x, %02x)\n", fd, offset, nativeWhence); if (::isatty(fd)) { off_t rv = -1; d0 = kEINVAL; f.error = 0; memoryWriteLong(rv, arg + 4); memoryWriteWord(f.error, parm + 2); return d0; } off_t rv = ::lseek(fd, offset, nativeWhence); if (rv < 0) { d0 = mpw_errno_from_errno(); f.error = macos_error_from_errno(); //perror(NULL); } else { d0 = 0; f.error = 0; } memoryWriteLong(rv, arg + 4); memoryWriteWord(f.error, parm + 2); return d0; } uint32_t ftrap_seteof(uint32_t parm, uint32_t arg) { uint32_t d0; MPWFile f; f.flags = memoryReadWord(parm); f.error = memoryReadWord(parm + 2); f.device = memoryReadLong(parm + 4); f.cookie = memoryReadLong(parm + 8); f.count = memoryReadLong(parm + 12); f.buffer = memoryReadLong(parm + 16); f.error = 0; int fd = f.cookie; Log(" seteof(%02x, %08x)\n", fd, arg); d0 = OS::Internal::FDEntry::action(fd, [arg, &f](int fd, OS::Internal::FDEntry &e){ int ok = ftruncate(fd, arg); if (ok == 0) return 0; f.error = macos_error_from_errno(); return (int)mpw_errno_from_errno(); }, [](int fd){ return kEINVAL; } ); memoryWriteWord(f.error, parm + 2); return d0; } void ftrap_ioctl(uint16_t trap) { // returns an mpw_errno in d0 [???] // int ioctl(int fildes, unsigned int cmd, long *arg); uint32_t d0; uint32_t sp = cpuGetAReg(7); uint32_t fd = memoryReadLong(sp + 4); uint32_t cmd = memoryReadLong(sp + 8); uint32_t arg = memoryReadLong(sp + 12); Log("%04x IOCtl(%08x, %08x, %08x)\n", trap, fd, cmd, arg); switch (cmd) { case kFIOLSEEK: d0 = ftrap_lseek(fd, arg); break; case kFIODUPFD: d0 = ftrap_dup(fd, arg); break; case kFIOBUFSIZE: d0 = ftrap_bufsize(fd, arg); break; case kFIOINTERACTIVE: d0 = ftrap_interactive(fd, arg); break; case kFIOFNAME: d0 = ftrap_fname(fd, arg); break; case kFIOREFNUM: d0 = ftrap_refnum(fd, arg); break; case kFIOSETEOF: d0 = ftrap_seteof(fd, arg); break; default: fprintf(stderr, "ioctl - unsupported op %04x\n", cmd); exit(1); break; } cpuSetDReg(0, d0); } }
19.919463
82
0.636119
tsupplis
1f0eb13712f90a906ed0852d5522fd74d011c871
5,348
cpp
C++
src/PE/TLS.cpp
rafael-santiago/LIEF
f230094d5877dd63d40915dc944c53c2a4be5ed9
[ "Apache-2.0" ]
1
2022-02-26T00:28:52.000Z
2022-02-26T00:28:52.000Z
src/PE/TLS.cpp
rafael-santiago/LIEF
f230094d5877dd63d40915dc944c53c2a4be5ed9
[ "Apache-2.0" ]
null
null
null
src/PE/TLS.cpp
rafael-santiago/LIEF
f230094d5877dd63d40915dc944c53c2a4be5ed9
[ "Apache-2.0" ]
null
null
null
/* Copyright 2017 - 2022 R. Thomas * Copyright 2017 - 2022 Quarkslab * * 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 <iomanip> #include "LIEF/exception.hpp" #include "LIEF/PE/hash.hpp" #include "LIEF/PE/TLS.hpp" #include "LIEF/PE/Section.hpp" #include "PE/Structures.hpp" namespace LIEF { namespace PE { TLS::~TLS() = default; TLS::TLS() = default; TLS::TLS(const TLS& copy) = default; TLS& TLS::operator=(TLS copy) { swap(copy); return *this; } void TLS::swap(TLS& other) { std::swap(callbacks_, other.callbacks_); std::swap(VAOfRawData_, other.VAOfRawData_); std::swap(addressof_index_, other.addressof_index_); std::swap(addressof_callbacks_, other.addressof_callbacks_); std::swap(sizeof_zero_fill_, other.sizeof_zero_fill_); std::swap(characteristics_, other.characteristics_); std::swap(directory_, other.directory_); std::swap(section_, other.section_); std::swap(data_template_, other.data_template_); } TLS::TLS(const details::pe32_tls& header) : VAOfRawData_{header.RawDataStartVA, header.RawDataEndVA}, addressof_index_{header.AddressOfIndex}, addressof_callbacks_{header.AddressOfCallback}, sizeof_zero_fill_{header.SizeOfZeroFill}, characteristics_{header.Characteristics} {} TLS::TLS(const details::pe64_tls& header) : VAOfRawData_{header.RawDataStartVA, header.RawDataEndVA}, addressof_index_{header.AddressOfIndex}, addressof_callbacks_{header.AddressOfCallback}, sizeof_zero_fill_{header.SizeOfZeroFill}, characteristics_{header.Characteristics} {} const std::vector<uint64_t>& TLS::callbacks() const { return callbacks_; } std::pair<uint64_t, uint64_t> TLS::addressof_raw_data() const { return VAOfRawData_; } uint64_t TLS::addressof_index() const { return addressof_index_; } uint64_t TLS::addressof_callbacks() const { return addressof_callbacks_; } uint32_t TLS::sizeof_zero_fill() const { return sizeof_zero_fill_; } uint32_t TLS::characteristics() const { return characteristics_; } bool TLS::has_data_directory() const { return directory_ != nullptr; } const DataDirectory* TLS::directory() const { return directory_; } DataDirectory* TLS::directory() { return const_cast<DataDirectory*>(static_cast<const TLS*>(this)->directory()); } bool TLS::has_section() const { return section_ != nullptr; } const Section* TLS::section() const { return section_; } Section* TLS::section() { return const_cast<Section*>(static_cast<const TLS*>(this)->section()); } const std::vector<uint8_t>& TLS::data_template() const { return data_template_; } void TLS::callbacks(const std::vector<uint64_t>& callbacks) { callbacks_ = callbacks; } void TLS::addressof_raw_data(std::pair<uint64_t, uint64_t> VAOfRawData) { VAOfRawData_ = VAOfRawData; } void TLS::addressof_index(uint64_t addressOfIndex) { addressof_index_ = addressOfIndex; } void TLS::addressof_callbacks(uint64_t addressOfCallbacks) { addressof_callbacks_ = addressOfCallbacks; } void TLS::sizeof_zero_fill(uint32_t sizeOfZeroFill) { sizeof_zero_fill_ = sizeOfZeroFill; } void TLS::characteristics(uint32_t characteristics) { characteristics_ = characteristics; } void TLS::data_template(const std::vector<uint8_t>& dataTemplate) { data_template_ = dataTemplate; } void TLS::accept(LIEF::Visitor& visitor) const { visitor.visit(*this); } bool TLS::operator==(const TLS& rhs) const { if (this == &rhs) { return true; } size_t hash_lhs = Hash::hash(*this); size_t hash_rhs = Hash::hash(rhs); return hash_lhs == hash_rhs; } bool TLS::operator!=(const TLS& rhs) const { return !(*this == rhs); } std::ostream& operator<<(std::ostream& os, const TLS& entry) { os << std::hex; os << std::setw(40) << std::left << std::setfill(' ') << "Address Of Index: " << entry.addressof_index() << std::endl; os << std::setw(40) << std::left << std::setfill(' ') << "Address Of Callbacks: " << entry.addressof_callbacks() << std::endl; for (uint64_t value : entry.callbacks()) { os << "\t - " << value << std::endl; } os << std::setw(40) << std::left << std::setfill(' ') << "Virtual Address of RawData (start): " << entry.addressof_raw_data().first << std::endl; os << std::setw(40) << std::left << std::setfill(' ') << "Virtual Address of RawData (end): " << entry.addressof_raw_data().second << std::endl; os << std::setw(40) << std::left << std::setfill(' ') << "Size Of Zero Fill: " << entry.sizeof_zero_fill() << std::endl; if (entry.has_section()) { os << std::setw(40) << std::left << std::setfill(' ') << "Associated section: " << entry.section()->name() << std::endl; } return os; } } // namespace PE } // namespace LIEF
26.344828
153
0.685864
rafael-santiago
1f118130f9e6d444dfb3b836d683cf02d55f184a
5,212
cpp
C++
CDump/Minecraft/src/Engine/Draw3D.cpp
YushchenkoAndrew/template
35c6bcd2121647015308f0cc110da71aa148d5fb
[ "MIT" ]
5
2020-08-25T11:35:04.000Z
2021-12-25T18:57:58.000Z
CDump/Minecraft/src/Engine/Draw3D.cpp
YushchenkoAndrew/template
35c6bcd2121647015308f0cc110da71aa148d5fb
[ "MIT" ]
null
null
null
CDump/Minecraft/src/Engine/Draw3D.cpp
YushchenkoAndrew/template
35c6bcd2121647015308f0cc110da71aa148d5fb
[ "MIT" ]
3
2020-10-08T07:51:33.000Z
2021-12-29T10:19:24.000Z
#include "Draw3D.h" void Draw3D::Init(int32_t iHeight, int32_t iWidth) { nScreenHeight = iHeight; nScreenWidth = iWidth; zBuffer.assign(iHeight * iWidth, 0.0f); } void Draw3D::Update() { zBuffer.assign(nScreenHeight * nScreenWidth, 0.0f); } // Using the implementation of Bresenham Algorithm // https://jstutorial.medium.com/how-to-code-your-first-algorithm-draw-a-line-ca121f9a1395 void Draw3D::DrawLine(olc::PixelGameEngine& GameEngine, int32_t x1, int32_t y1, float z1, int32_t x2, int32_t y2, float z2, olc::Pixel p) { if (y1 == y2 && x1 == x2) return; auto sign = [](int32_t& x) { return x > 0 ? 1 : -1; }; // Calculate line deltas int32_t dx = x2 - x1; int32_t dy = y2 - y1; float dz = z2 - z1; int32_t dx1 = abs(dx); int32_t dy1 = abs(dy); float dz1 = fabsf(dz); // Calculate error intervals for both axis int32_t px = 2 * dy1 - dx1; int32_t py = 2 * dx1 - dy1; bool bDraw = false; if (dy1 <= dx1) { if (x1 > x2) { swap(y1, y2); swap(x1, x2); swap(z1, z2); } dx = x2 - x1; dy = y2 - y1; float sz = z1, ez = z2; int32_t sx = x1, ex = x2, y = y1; for (int32_t x = sx; x < ex; x++) { if (px < 0) px += 2 * dy1; else { y += sign(dy); px += 2 * (dy1 - dx1); } // Correct depth error, by finding 'y' by interpolation int32_t sy = y1 + (int32_t)((x - sx) * dy / dx1); float q = dy1 ? (float)(sy - y1) / dy1 : (float)(x - sx) / dx1; float z = 1.0f / ((1.0f - q) / sz + q / ez); // Not the best solution but for now it's enough // The code below just check if we can draw any point // in the line if so then draw it if (z >= zBuffer[sy * nScreenWidth + x]) { bDraw = true; break; } } if (bDraw) GameEngine.DrawLine(sx, y1, ex, y2, p); return; } if (y1 > y2) { swap(y1, y2); swap(x1, x2); swap(z1, z2); } dx = x2 - x1; dy = y2 - y1; float sz = z1, ez = z2; int32_t sy = y1, ey = y2, x = x1; for (int32_t y = sy; y < ey; y++) { if (py <= 0) py += 2 * dx1; else { x -= sign(dx); py += 2 * (dx1 - dy1); } // Correct depth error, by finding 'x' by interpolation int32_t sx = x1 + (int32_t)((y - sy) * dx / dy1); float q = dx1 ? ((float)(sx - x1) / dx1) : ((float)(y - sy) / dy1); float z = 1.0f / ((1.0f - q) / sz + q / ez); // Not the best solution but for now it's enough // The code below just check if we can draw any point // in the line if so then draw it if (z >= zBuffer[y * nScreenWidth + sx]) { bDraw = true; break; } } if (bDraw) GameEngine.DrawLine(x1, sy, x2, ey, p); } void Draw3D::DrawTriangle(olc::PixelGameEngine& GameEngine, int32_t x1, int32_t y1, float z1, int32_t x2, int32_t y2, float z2, int32_t x3, int32_t y3, float z3, olc::Pixel p) { DrawLine(GameEngine, x1, y1, z1, x2, y2, z2, p); DrawLine(GameEngine, x1, y1, z1, x3, y3, z3, p); DrawLine(GameEngine, x2, y2, z2, x3, y3, z3, p); } // Using this implementation of Bresenham method // http://www.sunshine2k.de/coding/java/TriangleRasterization/TriangleRasterization.html#pointintrianglearticle // https://www.scratchapixel.com/lessons/3d-basic-rendering/rasterization-practical-implementation/visibility-problem-depth-buffer-depth-interpolation void Draw3D::FillTriangle(olc::PixelGameEngine& GameEngine, int32_t x1, int32_t y1, float z1, int32_t x2, int32_t y2, float z2, int32_t x3, int32_t y3, float z3, olc::Pixel p) { float dax = 1.0f; float dbx = 1.0f; float daz = 1.0f; float dbz = 1.0f; auto DrawLine = [&](int32_t sx, int32_t ex, int32_t y, float sz, float ez) { float step = 1.0f / (float)(ex - sx); float q = 0.0f; for (int i = sx; i <= ex; i++) { float z = 1.0f / ((1.0f - q) / sz + q / ez); q += step; if (z >= zBuffer[y * nScreenWidth + i]) { GameEngine.Draw(i, y, p); zBuffer[y * nScreenWidth + i] = z; } } }; // Sort vertices's if (y1 > y2) { swap(y1, y2); swap(x1, x2); swap(z1, z2); } if (y1 > y3) { swap(y1, y3); swap(x1, x3); swap(z1, z3); } if (y2 > y3) { swap(y2, y3); swap(x2, x3); swap(z2, z3); } int32_t dx1 = x2 - x1; int32_t dy1 = y2 - y1; float dz1 = z2 - z1; int32_t dx2 = x3 - x1; int32_t dy2 = y3 - y1; float dz2 = z3 - z1; if (dy1) { dax = dx1 / (float)abs(dy1); daz = dz1 / (float)abs(dy1); } if (dy2) { dbx = dx2 / (float)abs(dy2); dbz = dz2 / (float)abs(dy2); } if (dy1) { for (int32_t i = y1; i <= y2; i++) { int32_t sx = x1 + (int32_t)((i - y1) * dax); int32_t ex = x1 + (int32_t)((i - y1) * dbx); float sz = (float)z1 + (float)((i - y1) * daz); float ez = (float)z1 + (float)((i - y1) * dbz); if (sx > ex) { swap(sx, ex); swap(sz, ez); } DrawLine(sx, ex, i, sz, ez); } } dx1 = x3 - x2; dy1 = y3 - y2; dz1 = z3 - z2; if (!dy1) return; dax = dx1 / (float)abs(dy1); daz = dz1 / (float)abs(dy1); for (int32_t i = y2; i <= y3; i++) { int32_t sx = x2 + (int32_t)((i - y2) * dax); int32_t ex = x1 + (int32_t)((i - y1) * dbx); float sz = (float)z2 + (float)((i - y2) * daz); float ez = (float)z1 + (float)((i - y1) * dbz); if (sx > ex) { swap(sx, ex); swap(sz, ez); } DrawLine(sx, ex, i, sz, ez); } }
30.658824
178
0.56581
YushchenkoAndrew