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
109
| 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
48.5k
⌀ | 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
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f47fca44154f5c996e40ad5a3d714e679b3978da
| 4,705
|
cpp
|
C++
|
src/BFS.cpp
|
nantha007/frontierExplorer
|
0660def3de50f043027eaaa453de15699dbc1445
|
[
"BSD-3-Clause"
] | null | null | null |
src/BFS.cpp
|
nantha007/frontierExplorer
|
0660def3de50f043027eaaa453de15699dbc1445
|
[
"BSD-3-Clause"
] | null | null | null |
src/BFS.cpp
|
nantha007/frontierExplorer
|
0660def3de50f043027eaaa453de15699dbc1445
|
[
"BSD-3-Clause"
] | null | null | null |
/**
* BSD 3-Clause License
*
* Copyright (c) 2018, Nantha Kumar Sunder, Nithish Sanjeev Kumar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of the 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.
*/
/**@file explore.cpp
*
* @brief To implement the function of the class BFS
*
* @driver Nantha Kumar Sunder
* @navigator Nithish Sanjeev Kumar
* @copyright 2018 , Nantha Kumar Sunder, Nithish Sanjeev Kumar All rights reserved
*/
#include <ros/ros.h>
#include <queue>
#include <vector>
#include "BFS.hpp"
BFS::BFS(int rows, int cols) {
// Resize the explored
explored.resize(rows);
// Resize the each element of the explored
for (auto& i : explored) {
i.resize(cols);
for (auto& j : i)
j = 0;
}
// Resize the distance
distance.resize(rows);
// Resixe the each element of the distance
for (auto& i : distance) {
i.resize(cols);
for (auto& j : i)
j = 0;
}
}
int BFS::getExplored(int x, int y) {
// Return the value of explored at (x,y)
return explored[x][y];
}
int BFS::getDistance(int x, int y) {
// Return the value of distance at (x,y)
return distance[x][y];
}
void BFS::neighbourList(const std::vector<std::vector<int>>& frontierVector,
std::vector<int> v,
std::queue<std::vector<int> >& list) {
// Intializing the x and y point
int xPoint = v[0];
int yPoint = v[1];
std::vector<int> tempVec;
// list of all possible moves along any direction
int move[3] = { 1, -1, 0 };
// finding the neighbouring grid
for (auto & x : move) {
for (auto & y : move) {
tempVec.push_back(yPoint + y);
tempVec.push_back(xPoint + x);
for (auto & k : frontierVector) {
if (k == tempVec) {
// pushing the neighbouring point to (xPoint, yPoint)
list.push(k);
}
}
// clearing the temporary vector
tempVec.clear();
}
}
}
std::queue<std::vector<int>> BFS::computeBFS(
const std::queue<std::vector<int> >& frontierQueue,
std::vector<int> start) {
// Initializing the start x and y points
int xPos = start[0];
int yPos = start[1];
std::queue<std::vector<int>> frontier, temp, list;
std::vector<std::vector<int>> tempVector;
// temporary vector variables
std::vector<int> v, i, t, d;
// Pushing origin to list
d.push_back(0);
d.push_back(0);
list.push(d);
temp = frontierQueue;
// taking values from queue and passing it to tampVector
while (!temp.empty()) {
t = temp.front();
tempVector.push_back(t);
temp.pop();
}
// Pushing the start point to the queue
pQueue.push(start);
// loop runs until priority is queue is empty
while (!pQueue.empty()) {
v = pQueue.front();
pQueue.pop();
frontier.push(v);
// checking the neighbour list
neighbourList(tempVector, v, list);
// loop runs for all neighbour
while (!list.empty()) {
i = list.front();
list.pop();
// checking if the point is already explored or not
if (explored[i[0]][i[1]] == 0) {
// setting the explored
explored[i[0]][i[1]] = 1;
distance[i[0]][i[1]] = distance[v[0]][v[1]] + 1;
// pushing the value to the priority queue
pQueue.push(i);
}
}
}
return frontier;
}
BFS::~BFS() {
}
| 31.366667
| 83
| 0.658448
|
nantha007
|
f4801ef55b6ce5e943a5967c98fb3fc32637429a
| 1,486
|
cpp
|
C++
|
cpp/Dynamic Programming/72. Edit Distance.cpp
|
baicaihenxiao/LeetCode-Myself
|
f88fa5b5e76a913d6d9395d75571c8d7c46d37f5
|
[
"MIT"
] | null | null | null |
cpp/Dynamic Programming/72. Edit Distance.cpp
|
baicaihenxiao/LeetCode-Myself
|
f88fa5b5e76a913d6d9395d75571c8d7c46d37f5
|
[
"MIT"
] | 6
|
2021-03-31T02:43:24.000Z
|
2022-01-04T16:40:26.000Z
|
cpp/Dynamic Programming/72. Edit Distance.cpp
|
baicaihenxiao/LeetCode-Myself
|
f88fa5b5e76a913d6d9395d75571c8d7c46d37f5
|
[
"MIT"
] | null | null | null |
/*
2017-8-16 15:44:21
https://leetcode.com/problems/edit-distance/description/
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)
You have the following 3 operations permitted on a word:
a) Insert a character
b) Delete a character
c) Replace a character
dp算法,如果s1[m] == s2[n],则dp[m][n] = dp[m-1][n-1];
如果s1[m] != s2[n]:
1.替换s1[m]使s1[m]' == s2[n],则dp[m][n] = dp[m-1][n-1] + 1;
2.在s1[m]之后加s1[m+1]使s1[m+1] == s2[n]。 则dp[m][n] = dp[m][n-1] + 1;
3.在s2[n]之后加s2[n+1]使s1[m] == s2[n + 1]。 则dp[m][n] = dp[m - 1][n] + 1;
取三者最小。
*/
class Solution {
public:
int minDistance(string word1, string word2) {
int m = word1.size();
int n = word2.size();
if (m == 0 || n == 0)
{
return m == 0 ? n : m;
}
vector<int> dp(n + 1, 0);
for (int i = 0; i < n + 1; ++ i)
{
dp[i] = i;
}
for (int i = 1; i <= m; ++ i)
{
int tmpLeft = dp[0];
dp[0] = i;
int tmpCur = 0;
for (int j = 1; j <= n; ++ j)
{
tmpCur = dp[j];
if (word1[i - 1] == word2[j - 1])
{
dp[j] = tmpLeft;
}
else
{
dp[j] = min(tmpLeft, dp[j]);
dp[j] = min(dp[j - 1], dp[j]);
++ dp[j];
}
tmpLeft = tmpCur;
}
}
return dp[n];
}
};
| 18.810127
| 140
| 0.444818
|
baicaihenxiao
|
f4842234b20f5b81e377042efcc1904f448ff106
| 2,333
|
hpp
|
C++
|
Source/Ilum/Renderer/Renderer.hpp
|
LavenSun/IlumEngine
|
94841e56af3c5214f04e7a94cb7369f4935c5788
|
[
"MIT"
] | 1
|
2021-11-20T15:39:09.000Z
|
2021-11-20T15:39:09.000Z
|
Source/Ilum/Renderer/Renderer.hpp
|
LavenSun/IlumEngine
|
94841e56af3c5214f04e7a94cb7369f4935c5788
|
[
"MIT"
] | null | null | null |
Source/Ilum/Renderer/Renderer.hpp
|
LavenSun/IlumEngine
|
94841e56af3c5214f04e7a94cb7369f4935c5788
|
[
"MIT"
] | null | null | null |
#pragma once
#include "Utils/PCH.hpp"
#include "Camera.hpp"
#include "Engine/Context.hpp"
#include "Engine/Subsystem.hpp"
#include "Eventing/Event.hpp"
#include "Graphics/Image/Image.hpp"
#include "Graphics/Image/Sampler.hpp"
#include "RenderGraph/RenderGraphBuilder.hpp"
#include "Loader/ResourceCache.hpp"
#include <glm/glm.hpp>
namespace Ilum
{
class Renderer : public TSubsystem<Renderer>
{
public:
enum class SamplerType
{
Compare_Depth,
Point_Clamp,
Point_Wrap,
Bilinear_Clamp,
Bilinear_Wrap,
Trilinear_Clamp,
Trilinear_Wrap,
Anisptropic_Clamp,
Anisptropic_Wrap
};
enum class BufferType
{
MainCamera,
DirectionalLight,
PointLight,
SpotLight
};
public:
Renderer(Context *context = nullptr);
~Renderer();
virtual bool onInitialize() override;
virtual void onPreTick() override;
virtual void onPostTick() override;
virtual void onShutdown() override;
const RenderGraph *getRenderGraph() const;
RenderGraph *getRenderGraph();
ResourceCache &getResourceCache();
void resetBuilder();
void rebuild();
bool hasImGui() const;
void setImGui(bool enable);
const Sampler &getSampler(SamplerType type) const;
const BufferReference getBuffer(BufferType type) const;
const VkExtent2D &getRenderTargetExtent() const;
void resizeRenderTarget(VkExtent2D extent);
const ImageReference getDefaultTexture() const;
void update();
public:
std::function<void(RenderGraphBuilder &)> buildRenderGraph = nullptr;
private:
void createSamplers();
void createBuffers();
void updateBuffers();
private:
std::function<void(RenderGraphBuilder &)> defaultBuilder;
RenderGraphBuilder m_rg_builder;
scope<RenderGraph> m_render_graph = nullptr;
scope<ResourceCache> m_resource_cache = nullptr;
std::unordered_map<SamplerType, Sampler> m_samplers;
std::unordered_map<BufferType, Buffer> m_buffers;
VkExtent2D m_render_target_extent;
Image m_default_texture;
bool m_update = false;
bool m_imgui = true;
uint32_t m_texture_count = 0;
public:
Camera Main_Camera;
struct
{
float exposure = 4.5f;
float gamma = 2.2f;
} Color_Correction;
struct
{
float threshold = 0.75f;
float scale = 3.f;
float strength = 0.13f;
uint32_t enable = 0;
} Bloom;
public:
Event<> Event_RenderGraph_Rebuild;
};
} // namespace Ilum
| 16.905797
| 70
| 0.741106
|
LavenSun
|
f485fca7569ca3eda76d0090f63eeb1399da7ab9
| 443
|
hpp
|
C++
|
Axis.SystemBase/foundation/settings/SystemSettings.hpp
|
renato-yuzup/axis-fem
|
2e8d325eb9c8e99285f513b4c1218ef53eb0ab22
|
[
"MIT"
] | 2
|
2021-07-23T08:49:54.000Z
|
2021-07-29T22:07:30.000Z
|
Axis.SystemBase/foundation/settings/SystemSettings.hpp
|
renato-yuzup/axis-fem
|
2e8d325eb9c8e99285f513b4c1218ef53eb0ab22
|
[
"MIT"
] | null | null | null |
Axis.SystemBase/foundation/settings/SystemSettings.hpp
|
renato-yuzup/axis-fem
|
2e8d325eb9c8e99285f513b4c1218ef53eb0ab22
|
[
"MIT"
] | null | null | null |
#pragma once
#include "foundation/Axis.SystemBase.hpp"
#include "AxisString.hpp"
namespace axis
{
namespace foundation
{
namespace settings
{
class AXISSYSTEMBASE_API SystemSettings
{
private:
SystemSettings(void);
public:
static const axis::String::char_type * DefaultConfigurationFile;
static const axis::String::char_type * LocaleFolderName;
static const axis::String::char_type * NewLine;
};
}
}
}
| 20.136364
| 68
| 0.717833
|
renato-yuzup
|
f48ae3ebb386b40ba1244dfff62c7e97ce48decf
| 1,699
|
cpp
|
C++
|
Deitel/Chapter20/examples/20.13/fig10_14.cpp
|
SebastianTirado/Cpp-Learning-Archive
|
fb83379d0cc3f9b2390cef00119464ec946753f4
|
[
"MIT"
] | 19
|
2019-09-15T12:23:51.000Z
|
2020-06-18T08:31:26.000Z
|
Deitel/Chapter20/examples/20.13/fig10_14.cpp
|
eirichan/CppLearingArchive
|
07a4baf63f0765d41eb0cc6d32a4c9d2ae1d5bac
|
[
"MIT"
] | 15
|
2021-12-07T06:46:03.000Z
|
2022-01-31T07:55:32.000Z
|
Deitel/Chapter20/examples/20.13/fig10_14.cpp
|
eirichan/CppLearingArchive
|
07a4baf63f0765d41eb0cc6d32a4c9d2ae1d5bac
|
[
"MIT"
] | 13
|
2019-06-29T02:58:27.000Z
|
2020-05-07T08:52:22.000Z
|
/*
* =====================================================================================
*
* Filename: fig10_14.cpp
*
* Description: Fig. 20.14 - Template Stack class test program.
*
* Version: 1.0
* Created: 14/03/17 12:49:35
* Revision: none
* Compiler: g++
*
* Author: Siidney Watson - siidney.watson.work@gmail.com
* Organization: LolaDog Studio
*
* =====================================================================================
*/
#include "Stack.hpp"
#include <iostream>
int main(int argc, const char* argv[]) {
Stack<int> intStack;
std::cout << "Processing an integer stack" << std::endl;
// push integers onto intStack
for (int i = 0; i < 3; ++i) {
intStack.push(i);
intStack.printStack();
}
int popInteger; // store int popped from stack
// pop integers from intStack
while (!intStack.isStackEmpty()) {
intStack.pop(popInteger);
std::cout << popInteger << " popped from stack" << std::endl;
intStack.printStack();
}
Stack<double> doubleStack;
double value = 1.1f;
std::cout << "Processing a double stack" << std::endl;
// push floating-point values onto doubleStack
for (int i = 0; i < 3; ++i) {
doubleStack.push(value);
doubleStack.printStack();
value += 1.1f;
}
double popDouble; // store double popped from stack
// pop floating-point values from doubleStack
while (!doubleStack.isStackEmpty()) {
doubleStack.pop(popDouble);
std::cout << popDouble << " popped from stack." << std::endl;
doubleStack.printStack();
}
return 0;
}
| 26.138462
| 88
| 0.52266
|
SebastianTirado
|
f48b9b6ab4a64a9143c75f9646cbbda8dd78dd1b
| 5,060
|
cc
|
C++
|
ns-allinone-2.35/ns-2.35/diffusion3/ns/diffagent.cc
|
nitishk017/ns2project
|
f037b796ff10300ffe0422580be5855c37d0b140
|
[
"MIT"
] | 1
|
2020-05-29T13:04:42.000Z
|
2020-05-29T13:04:42.000Z
|
ns-allinone-2.35/ns-2.35/diffusion3/ns/diffagent.cc
|
nitishk017/ns2project
|
f037b796ff10300ffe0422580be5855c37d0b140
|
[
"MIT"
] | 1
|
2019-01-20T17:35:23.000Z
|
2019-01-22T21:41:38.000Z
|
ns-allinone-2.35/ns-2.35/diffusion3/ns/diffagent.cc
|
nitishk017/ns2project
|
f037b796ff10300ffe0422580be5855c37d0b140
|
[
"MIT"
] | 1
|
2021-09-29T16:06:57.000Z
|
2021-09-29T16:06:57.000Z
|
/*
* Copyright (C) 2004-2005 by the University of Southern California
* $Id: diffagent.cc,v 1.13 2005/09/13 20:47:34 johnh Exp $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
*
* The copyright of this module includes the following
* linking-with-specific-other-licenses addition:
*
* In addition, as a special exception, the copyright holders of
* this module give you permission to combine (via static or
* dynamic linking) this module with free software programs or
* libraries that are released under the GNU LGPL and with code
* included in the standard release of ns-2 under the Apache 2.0
* license or under otherwise-compatible licenses with advertising
* requirements (or modified versions of such code, with unchanged
* license). You may copy and distribute such a system following the
* terms of the GNU GPL for this module and the licenses of the
* other code concerned, provided that you include the source code of
* that other code when and as the GNU GPL requires distribution of
* source code.
*
* Note that people who make modified versions of this module
* are not obligated to grant this special exception for their
* modified versions; it is their choice whether to do so. The GNU
* General Public License gives permission to release a modified
* version without this exception; this exception also makes it
* possible to release a modified version which carries forward this
* exception.
*
*/
// DiffAppAgent - Wrapper Class for diffusion transport agent DR, ported from SCADDS's directed diffusion software. --Padma, nov 2001.
#ifdef NS_DIFFUSION
#include "diffagent.h"
#include "diffrtg.h"
static class DiffAppAgentClass : public TclClass {
public:
DiffAppAgentClass() : TclClass("Agent/DiffusionApp") {}
TclObject* create(int , const char*const* ) {
return(new DiffAppAgent());
}
} class_diffusion_app_agent;
void NsLocal::sendPacket(DiffPacket p, int len, int dst) {
agent_->sendPacket(p, len, dst);
}
DiffPacket NsLocal::recvPacket(int fd) {
DiffPacket p;
fprintf(stderr, "This function should not get called; call DiffAppAgent::recv(Packet *, Handler *) instead\n\n");
exit(1);
return (p); // to keep the compiler happy
}
DiffAppAgent::DiffAppAgent() : Agent(PT_DIFF) {
dr_ = NR::create_ns_NR(DEFAULT_DIFFUSION_PORT, this);
}
int DiffAppAgent::command(int argc, const char*const* argv) {
//Tcl& tcl = Tcl::instance();
if (argc == 3) {
if (strcmp(argv[1], "node") == 0) {
MobileNode *node = (MobileNode *)TclObject::lookup(argv[2]);
((DiffusionRouting *)dr_)->getNode(node);
return TCL_OK;
}
if (strcmp(argv[1], "agent-id") == 0) {
int id = atoi(argv[2]);
((DiffusionRouting *)dr_)->getAgentId(id);
return TCL_OK;
}
}
return Agent::command(argc, argv);
}
void DiffAppAgent::recv(Packet* p, Handler* h)
{
Message *msg;
DiffusionData *diffdata;
diffdata = (DiffusionData *)(p->userdata());
msg = diffdata->data();
DiffusionRouting *dr = (DiffusionRouting*)dr_;
dr->recvMessage(msg);
Packet::free(p);
}
void
DiffAppAgent::initpkt(Packet* p, Message* msg, int len)
{
hdr_cmn* ch = HDR_CMN(p);
hdr_ip* iph = HDR_IP(p);
AppData *diffdata;
diffdata = new DiffusionData(msg, len);
p->setdata(diffdata);
// initialize pkt
ch->uid() = msg->pkt_num_; /* copy pkt_num from diffusion msg */
ch->ptype() = type_;
ch->size() = size_;
ch->timestamp() = Scheduler::instance().clock();
ch->iface() = UNKN_IFACE.value(); // from packet.h (agent is local)
ch->direction() = hdr_cmn::NONE;
ch->error() = 0; /* pkt not corrupt to start with */
iph->saddr() = addr();
iph->sport() = ((DiffusionRouting*)dr_)->getAgentId();
iph->daddr() = addr();
iph->flowid() = fid_;
iph->prio() = prio_;
iph->ttl() = defttl_;
hdr_flags* hf = hdr_flags::access(p);
hf->ecn_capable_ = 0;
hf->ecn_ = 0;
hf->eln_ = 0;
hf->ecn_to_echo_ = 0;
hf->fs_ = 0;
hf->no_ts_ = 0;
hf->pri_ = 0;
hf->cong_action_ = 0;
}
Packet*
DiffAppAgent::createNsPkt(Message *msg, int len)
{
Packet *p;
p = Packet::alloc();
initpkt(p, msg, len);
return (p);
}
void DiffAppAgent::sendPacket(DiffPacket dp, int len, int dst) {
Packet *p;
hdr_ip *iph;
Message *msg;
msg = (Message *)dp;
p = createNsPkt(msg, len);
iph = HDR_IP(p);
iph->dport() = dst;
// schedule for realistic delay : set to 0 sec for now
(void)Scheduler::instance().schedule(target_, p, 0.000001);
}
#endif // NS
| 27.5
| 136
| 0.692688
|
nitishk017
|
f48eb52bb436c3babe0ca4c8d6166633ce62db2f
| 14,544
|
cpp
|
C++
|
Assigment1/Game/Source/Map.cpp
|
Xavierlm11/Assignment1
|
78e3004c63923ec15883a22c754e1f403fa5c6cd
|
[
"MIT"
] | 1
|
2021-12-11T22:51:20.000Z
|
2021-12-11T22:51:20.000Z
|
Assigment1/Game/Source/Map.cpp
|
Xavierlm11/Assignment1
|
78e3004c63923ec15883a22c754e1f403fa5c6cd
|
[
"MIT"
] | null | null | null |
Assigment1/Game/Source/Map.cpp
|
Xavierlm11/Assignment1
|
78e3004c63923ec15883a22c754e1f403fa5c6cd
|
[
"MIT"
] | null | null | null |
#include "App.h"
#include "Render.h"
#include "Textures.h"
#include "Scene.h"
#include "Map.h"
#include "player.h"
#include "ModuleCollisions.h"
#include "Defs.h"
#include "Log.h"
#include <math.h>
Map::Map( ) : Module(), mapLoaded(false)
{
name.Create("map");
}
// Destructor
Map::~Map()
{}
int Properties::GetProperty(const char* value, int defaultValue) const
{
for (int i = 0; i < list.count(); i++) {
if (strcmp(list.At(i)->data->name.GetString(), value) == 0)
{
if (list.At(i)->data->value != defaultValue) return list.At(i)->data->value;
else return defaultValue;
}
}
return defaultValue;
}
// Called before render is available
bool Map::Awake(pugi::xml_node& config)
{
LOG("Loading Map Parser");
bool ret = true;
folder.Create(config.child("folder").child_value());
return ret;
}
// Draw the map (all requried layers)
void Map::Draw()
{
if (mapLoaded == false) return;
ListItem<MapLayer*>* mapLayerItem;
mapLayerItem = mapData.layers.start;
while (mapLayerItem != NULL) {
if (mapLayerItem->data->properties.GetProperty("Draw") == 1)//dinuja solo las capas con a propiedad draw
{
for (int x = 0; x < mapLayerItem->data->width; x++)
{
for (int y = 0; y < mapLayerItem->data->height; y++)
{
int gid = mapLayerItem->data->Get(x, y);
if (gid > 0) {
TileSet* tileset = GetTilesetFromTileId(gid);
SDL_Rect r = tileset->GetTileRect(gid);
iPoint pos = MapToWorld(x, y);
app->render->DrawTexture(tileset->texture,
pos.x,
pos.y,
&r);
}
}
}
}
mapLayerItem = mapLayerItem->next;
}
}
iPoint Map::MapToWorld(int x, int y) const
{
iPoint ret;
ret.x = x * mapData.tileWidth;
ret.y = y * mapData.tileHeight;
return ret;
}
iPoint Map::WorldToMap(int x, int y) const
{
iPoint ret(0, 0);
ret.x = x / mapData.tileWidth;
ret.y = y / mapData.tileHeight;
return ret;
}
//Pick the right Tileset based on a tile id
TileSet* Map::GetTilesetFromTileId(int id) const
{
ListItem<TileSet*>* item = mapData.tilesets.start;
TileSet* set = item->data;
for (set; set; item = item->next, set = item->data)
{
if (id >= set->firstgid && id < set->firstgid + set->tilecount)
return set;
}
return set;
}
// Get relative Tile rectangle
SDL_Rect TileSet::GetTileRect(int id) const
{
SDL_Rect rect = { 0 };
int relativeId = id - firstgid;
rect.w = tileWidth;
rect.h = tileHeight;
rect.x = margin + ((rect.w + spacing) * (relativeId % columns));
rect.y = margin + ((rect.h + spacing) * (relativeId / columns));
return rect;
}
// Called before quitting
bool Map::CleanUp()
{
LOG("Unloading map");
// Remove all tilesets
ListItem<TileSet*>* item;
item = mapData.tilesets.start;
while (item != NULL)
{
RELEASE(item->data);
item = item->next;
}
mapData.tilesets.clear();
// Remove all layers
ListItem<MapLayer*>* item2;
item2 = mapData.layers.start;
while (item2 != NULL)
{
RELEASE(item2->data);
item2 = item2->next;
}
mapData.layers.clear();
return true;
}
// Load new map
bool Map::Load(const char* filename)
{
bool ret = true;
SString tmp("%s%s", folder.GetString(), filename);
pugi::xml_document mapFile;
pugi::xml_parse_result result = mapFile.load_file(tmp.GetString());
if(result == NULL)
{
LOG("Could not load map xml file %s. pugi error: %s", filename, result.description());
ret = false;
}
// Load general info
if(ret == true)
{
ret = LoadMap(mapFile);
}
// remember to support more any number of tilesets!
if (ret == true)
{
ret = LoadTileSets(mapFile.child("map"));
}
// Load layer info
if (ret == true)
{
ret = LoadAllLayers(mapFile.child("map"));
}
if(ret == true)
{
LOG("Successfully parsed map XML file: %s", filename);
LOG("width: %d", mapData.width);
LOG("height: %d", mapData.height);
LOG("tile width: %d", mapData.tileWidth);
LOG("tile height: %d", mapData.tileHeight);
if (mapData.type == MAPTYPE_ORTHOGONAL)
{
LOG("orientation: orthogonal");
}
else if (mapData.type == MAPTYPE_ISOMETRIC)
{
LOG("orientation: isometric");
}
ListItem<TileSet*>* tileset;
tileset = mapData.tilesets.start;
int tilesetCtr = 0;
while (tileset != NULL)
{
LOG("Tileset %d", tilesetCtr +1);
LOG("name: %s", tileset->data->name.GetString());
LOG("first gid: %d", tileset->data->firstgid);
LOG("margin: %d", tileset->data->margin);
LOG("spacing: %d", tileset->data->spacing);
LOG("tile width: %d", tileset->data->tileWidth);
LOG("tile height: %d", tileset->data->tileHeight);
LOG("width: %d", tileset->data->texWidth);
LOG("height: %d", tileset->data->texHeight);
tileset = tileset->next;
tilesetCtr++;
}
ListItem<MapLayer*>* layer;
layer = mapData.layers.start;
int layerCtr = 0;
while (layer != NULL)
{
LOG("Layer %d", layerCtr + 1);
LOG("name: %s", layer->data->name.GetString());
LOG("width: %d", layer->data->width);
LOG("height: %d", layer->data->height);
layerCtr++;
layer = layer->next;
}
}
mapLoaded = ret;
return ret;
}
bool Map::LoadMap(pugi::xml_node mapFile)
{
bool ret = true;
pugi::xml_node map = mapFile.child("map");
if (map == NULL)
{
LOG("Error parsing map xml file: Cannot find 'map' tag.");
ret = false;
}
else
{
mapData.height = map.attribute("height").as_int();
mapData.width = map.attribute("width").as_int();
mapData.tileHeight = map.attribute("tileheight").as_int();
mapData.tileWidth = map.attribute("tilewidth").as_int();
mapData.type = MAPTYPE_UNKNOWN;
if (strcmp(map.attribute("orientation").as_string(), "isometric") == 0)
{
mapData.type = MAPTYPE_ISOMETRIC;
}
if (strcmp(map.attribute("orientation").as_string(), "orthogonal") == 0)
{
mapData.type = MAPTYPE_ORTHOGONAL;
}
}
return ret;
}
bool Map::LoadTileSets(pugi::xml_node mapFile) {
bool ret = true;
pugi::xml_node tileset;
for (tileset = mapFile.child("tileset"); tileset && ret; tileset = tileset.next_sibling("tileset"))
{
TileSet* set = new TileSet();
if (ret == true) ret = LoadTilesetDetails(tileset, set);
if (ret == true) ret = LoadTilesetImage(tileset, set);
mapData.tilesets.add(set);
}
return ret;
}
bool Map::LoadTilesetDetails(pugi::xml_node& tileset_node, TileSet* set)
{
bool ret = true;
set->name.Create(tileset_node.attribute("name").as_string());
set->firstgid = tileset_node.attribute("firstgid").as_int();
set->tileWidth = tileset_node.attribute("tilewidth").as_int();
set->tileHeight = tileset_node.attribute("tileheight").as_int();
set->margin = tileset_node.attribute("margin").as_int();
set->spacing = tileset_node.attribute("spacing").as_int();
set->tilecount = tileset_node.attribute("tilecount").as_int();
set->columns = tileset_node.attribute("columns").as_int();
return ret;
}
//Load tileset image
bool Map::LoadTilesetImage(pugi::xml_node& tileset_node, TileSet* set)
{
bool ret = true;
pugi::xml_node image = tileset_node.child("image");
if (image == NULL)
{
LOG("Error parsing tileset xml file: Cannot find 'image' tag.");
ret = false;
}
else
{
SString tmp("%s%s", folder.GetString(), image.attribute("source").as_string());
set->texture = app->tex->Load(tmp.GetString());
}
return ret;
}
//load tileset Layer
bool Map::LoadLayer(pugi::xml_node& node, MapLayer* layer)
{
bool ret = true;
//Load the attributes
layer->name = node.attribute("name").as_string();
layer->width = node.attribute("width").as_int();
layer->height = node.attribute("height").as_int();
LoadProperties(node, layer->properties);
//Reserve the memory for the tile array
layer->data = new uint[layer->width * layer->height];
memset(layer->data, 0, layer->width * layer->height);
//Iterate over all the tiles and assign the values
pugi::xml_node tile;
int i = 0;
for (tile = node.child("data").child("tile"); tile && ret; tile = tile.next_sibling("tile"))
{
layer->data[i] = tile.attribute("gid").as_int();
i++;
}
return ret;
}
bool Map::LoadAllLayers(pugi::xml_node mapNode) {
bool ret = true;
for (pugi::xml_node layerNode = mapNode.child("layer"); layerNode && ret; layerNode = layerNode.next_sibling("layer"))
{
//Load the layer
MapLayer* mapLayer = new MapLayer();
ret = LoadLayer(layerNode, mapLayer);
//add the layer to the map
mapData.layers.add(mapLayer);
}
return ret;
}
bool Map::LoadProperties(pugi::xml_node& node, Properties& properties)
{
bool ret = false;
pugi::xml_node data = node.child("properties");
/*pugi::xml_node propertieNode;*/
for (pugi::xml_node propertieNode = node.child("properties").child("property"); propertieNode; propertieNode = propertieNode.next_sibling("property"))
{
Properties::Property* p = new Properties::Property();
p->name = propertieNode.attribute("name").as_string();
p->value = propertieNode.attribute("value").as_int();
properties.list.add(p);
}
return ret;
}
bool Map::Start() {
/*CreateColliders();*/
return true;
}
void Map::CreateColliders() {
if (mapLoaded == false) return;
ListItem<MapLayer*>* mapLayerItem;
mapLayerItem = mapData.layers.start;
int i = 0;
while (mapLayerItem != NULL) {
//suelo
if (mapLayerItem->data->properties.GetProperty("collider") == 1) {//crea colliders de tipo suelo con las tiles de tipo collider
for (int x = 0; x < mapLayerItem->data->width; x++) {
for (int y = 0; y < mapLayerItem->data->height; y++) {
int gid = mapLayerItem->data->Get(x, y);
if (gid > 0) {
//now we always use the firt tileset in the list
TileSet* tileset = mapData.tilesets.start->data;
/*TileSet* tileset = GetTilesetFromTileId(gid);*/
SDL_Rect r = tileset->GetTileRect(gid);
iPoint pos = MapToWorld(x, y);
app->render->DrawTexture(tileset->texture,
pos.x,
pos.y,
&r);
collidersMap[i] = app->coll->AddCollider({ pos.x,pos.y, r.w,r.h }, Collider::Type::SUELO, this);
i++;
}
}
}
}
//wall
if (mapLayerItem->data->properties.GetProperty("wallcol") == 1) {
for (int x = 0; x < mapLayerItem->data->width; x++) {
for (int y = 0; y < mapLayerItem->data->height; y++) {
int gid = mapLayerItem->data->Get(x, y);
if (gid > 0) {
//now we always use the firt tileset in the list
TileSet* tileset = mapData.tilesets.start->data;
/*TileSet* tileset = GetTilesetFromTileId(gid);*/
SDL_Rect r = tileset->GetTileRect(gid);
iPoint pos = MapToWorld(x, y);
app->render->DrawTexture(tileset->texture,
pos.x,
pos.y,
&r);
collidersMap[i] = app->coll->AddCollider({ pos.x,pos.y, r.w,r.h }, Collider::Type::PARED, this);
i++;
}
}
}
}
//lava
if (mapLayerItem->data->properties.GetProperty("lavacol") == 1) {
for (int x = 0; x < mapLayerItem->data->width; x++) {
for (int y = 0; y < mapLayerItem->data->height; y++) {
int gid = mapLayerItem->data->Get(x, y);
if (gid > 0) {
//now we always use the firt tileset in the list
TileSet* tileset = mapData.tilesets.start->data;
SDL_Rect r = tileset->GetTileRect(gid);
iPoint pos = MapToWorld(x, y);
app->render->DrawTexture(tileset->texture,
pos.x,
pos.y,
&r);
collidersMap[i] = app->coll->AddCollider({ pos.x,pos.y, r.w,r.h }, Collider::Type::LAVA, this);
i++;
}
}
}
}
//air
if (mapLayerItem->data->properties.GetProperty("air") == 1) {
for (int x = 0; x < mapLayerItem->data->width; x++) {
for (int y = 0; y < mapLayerItem->data->height; y++) {
int gid = mapLayerItem->data->Get(x, y);
if (gid > 0) {
//now we always use the firt tileset in the list
TileSet* tileset = mapData.tilesets.start->data;
SDL_Rect r = tileset->GetTileRect(gid);
iPoint pos = MapToWorld(x, y);
app->render->DrawTexture(tileset->texture,
pos.x,
pos.y,
&r);
collidersMap[i] = app->coll->AddCollider({ pos.x,pos.y, r.w,r.h }, Collider::Type::AIR, this);
i++;
}
}
}
}
//Volador
if (mapLayerItem->data->properties.GetProperty("vol") == 1) {
for (int x = 0; x < mapLayerItem->data->width; x++) {
for (int y = 0; y < mapLayerItem->data->height; y++) {
int gid = mapLayerItem->data->Get(x, y);
if (gid > 0) {
//now we always use the firt tileset in the list
TileSet* tileset = mapData.tilesets.start->data;
SDL_Rect r = tileset->GetTileRect(gid);
iPoint pos = MapToWorld(x, y);
app->render->DrawTexture(tileset->texture,
pos.x,
pos.y,
&r);
collidersMap[i] = app->coll->AddCollider({ pos.x,pos.y, r.w,r.h }, Collider::Type::VOLADOR, this);
i++;
}
}
}
}
//tiesrra
if (mapLayerItem->data->properties.GetProperty("tier") == 1) {
for (int x = 0; x < mapLayerItem->data->width; x++) {
for (int y = 0; y < mapLayerItem->data->height; y++) {
int gid = mapLayerItem->data->Get(x, y);
if (gid > 0) {
//now we always use the firt tileset in the list
TileSet* tileset = mapData.tilesets.start->data;
SDL_Rect r = tileset->GetTileRect(gid);
iPoint pos = MapToWorld(x, y);
app->render->DrawTexture(tileset->texture,
pos.x,
pos.y,
&r);
collidersMap[i] = app->coll->AddCollider({ pos.x,pos.y, r.w,r.h }, Collider::Type::TIERRA, this);
i++;
}
}
}
}
mapLayerItem = mapLayerItem->next;
}
}
bool Map::CreateWalkabilityMap(int& width, int& height, uchar** buffer) const
{
bool ret = false;
ListItem<MapLayer*>* item;
item = mapData.layers.start;
for (item = mapData.layers.start; item != NULL; item = item->next)
{
MapLayer* layer = item->data;
if (layer->properties.GetProperty("air") == 0)
continue;
uchar* map = new uchar[layer->width * layer->height];
memset(map, 1, layer->width * layer->height);
for (int y = 0; y < mapData.height; ++y)
{
for (int x = 0; x < mapData.width; ++x)
{
int i = (y * layer->width) + x;
int tileId = layer->Get(x, y);
TileSet* tileset = (tileId > 0) ? GetTilesetFromTileId(tileId) : NULL;
if (tileset != NULL)
{
map[i] = (tileId - tileset->firstgid) > 0 ? 0 : 1;
}
}
}
*buffer = map;
width = mapData.width;
height = mapData.height;
ret = true;
break;
}
return ret;
}
| 21.078261
| 151
| 0.616268
|
Xavierlm11
|
f4909b1bbdabdede884ff53b33e9363f09da4eb2
| 151
|
cpp
|
C++
|
SingleSource/Regression/C++/BuiltinTypeInfo.cpp
|
roguedream/llvm-test-suite
|
48b3213a211d2ae86da8834e8b7322778dd605bf
|
[
"Apache-2.0"
] | null | null | null |
SingleSource/Regression/C++/BuiltinTypeInfo.cpp
|
roguedream/llvm-test-suite
|
48b3213a211d2ae86da8834e8b7322778dd605bf
|
[
"Apache-2.0"
] | null | null | null |
SingleSource/Regression/C++/BuiltinTypeInfo.cpp
|
roguedream/llvm-test-suite
|
48b3213a211d2ae86da8834e8b7322778dd605bf
|
[
"Apache-2.0"
] | null | null | null |
#include <typeinfo>
#include <cstdio>
int main() {
int iii = 0;
for(iii=0;iii<100;iii++){
printf("%d", typeid(int) == typeid(float));
}
}
| 15.1
| 45
| 0.562914
|
roguedream
|
f4920bbe684b4720b87f96aafcbcf164a10cfe10
| 1,106
|
cpp
|
C++
|
binarysearch.cpp
|
Jiwant/Searching-and-Sorting
|
1cd58af99050bb3af1e6fdd7e729ed554269a370
|
[
"MIT"
] | null | null | null |
binarysearch.cpp
|
Jiwant/Searching-and-Sorting
|
1cd58af99050bb3af1e6fdd7e729ed554269a370
|
[
"MIT"
] | null | null | null |
binarysearch.cpp
|
Jiwant/Searching-and-Sorting
|
1cd58af99050bb3af1e6fdd7e729ed554269a370
|
[
"MIT"
] | null | null | null |
#include<iostream>
using namespace std;
void swap(int *x,int *y)
{
int temp;
temp=*y;
*y=*x;
*x=temp;
}
class Arr
{
private:
int num;
int *arr;
public:
void getArr();
void dispArr();
int getnum()
{
return num;
}
void bsearch(int,int,int);
~Arr()
{
delete []arr;
}
};
void Arr::getArr()
{
cout<<"Enter the Number of Elements "<<endl;
cin>>num;
arr=new int[num];
cout<<"Enter the Elements of Array"<<endl;
for(int i=0;i<num;i++)
cin>>arr[i];
}
void Arr::dispArr()
{
cout<<"Displaying the Elements of Array"<<endl;
for(int i=0;i<num;i++)
cout<<arr[i]<<endl;
}
void Arr::bsearch(int n,int l,int u)
{
if(l==u)
{
if(arr[l]!=n)
cout<<"Number dont exist in the Array List"<<endl;
else
cout<<"Position of Element "<<u+1<<endl;
}
if(l!=u)
{
int mid=(l+u)/2;
if(n==arr[mid])
bsearch(n,mid,mid);
else
{
if(n<arr[mid])
bsearch(n,l,mid-1);
else
bsearch(n,mid+1,u);
}
}
}
int main()
{
Arr x;
int n;
x.getArr();
x.dispArr();
cout<<"Enter the Value you want to Search"<<endl;
cin>>n;
x.bsearch(n,0,x.getnum()-1);
return 0;
}
| 13.166667
| 53
| 0.577758
|
Jiwant
|
f496d3b3f1eb351311561d3720d550e4e7514230
| 487
|
cpp
|
C++
|
src/processor/simple-accumulator-machine/instructions/Jez.cpp
|
Hiro-Onozawa/Object-oriented-Virtual-Machine
|
4fc371db12c124fe28140ca9c72c10f3c81686ee
|
[
"MIT"
] | 2
|
2019-11-02T17:15:19.000Z
|
2019-11-15T15:19:48.000Z
|
src/processor/simple-accumulator-machine/instructions/Jez.cpp
|
Hiro-Onozawa/Object-oriented-Virtual-Machine
|
4fc371db12c124fe28140ca9c72c10f3c81686ee
|
[
"MIT"
] | null | null | null |
src/processor/simple-accumulator-machine/instructions/Jez.cpp
|
Hiro-Onozawa/Object-oriented-Virtual-Machine
|
4fc371db12c124fe28140ca9c72c10f3c81686ee
|
[
"MIT"
] | null | null | null |
#include "../../../core/common.h"
#include <sstream>
#include "../instructions/common.h"
#include "../instructions/Jez.h"
namespace SimpleAccumulator {
Jez::Jez(OVM::Register pc)
: pc(pc)
{
}
OVM::Assembly Jez::toAssembly() const
{
std::ostringstream oss;
oss << "JEZ " << pc;
return OVM::Assembly(oss.str());
}
bool Jez::Process(::Processor& processor)
{
if (Proxy::acc(processor) == 0) Proxy::pc(processor) = pc;
else ++Proxy::pc(processor);
return true;
}
}
| 18.730769
| 60
| 0.634497
|
Hiro-Onozawa
|
f4a35ca3b149b4b60375e5c984cbb50c03bb48ef
| 4,044
|
cpp
|
C++
|
Lab2/src/lab2_main.cpp
|
DavidePistilli173/Computer-Vision
|
4066a99f6f6fdc941829d3cd3015565ec0046a2f
|
[
"Apache-2.0"
] | null | null | null |
Lab2/src/lab2_main.cpp
|
DavidePistilli173/Computer-Vision
|
4066a99f6f6fdc941829d3cd3015565ec0046a2f
|
[
"Apache-2.0"
] | null | null | null |
Lab2/src/lab2_main.cpp
|
DavidePistilli173/Computer-Vision
|
4066a99f6f6fdc941829d3cd3015565ec0046a2f
|
[
"Apache-2.0"
] | null | null | null |
#include <iostream>
#include <opencv2/core.hpp>
#include <opencv2/core/utils/filesystem.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <sstream>
#include <string_view>
#include "CameraCalibrator.hpp"
/* List of command line arguments. */
enum class Argument
{
input_folder = 1,
test_img,
tot
};
constexpr std::string_view file_pattern{ "*.png" }; // Pattern for file retrieval.
constexpr std::string_view win_original{ "Test image" }; // Output window.
constexpr lab2::Size cell_size{ 0.11F, 0.11F }; // Size of each pattern cell.
constexpr lab2::Size pattern_size{ 6, 5 }; // Dimensions of the pattern grid.
using lab2::Log;
/* Load the calibration images and a test image. */
bool loadImages(
const std::vector<cv::String>& calibFiles, std::vector<cv::Mat>& calibImgs,
const cv::String& testFile, cv::Mat& testImg
);
int main(int argc, char* argv[])
{
/* Check the number of arguments. */
if (argc < static_cast<int>(Argument::tot))
{
Log::fatal("Required parameters: <folder with calibration images> <test image>");
return -1;
}
/* Load the list of calibration images. */
std::vector<cv::String> calibrationImageFiles;
cv::utils::fs::glob(
argv[static_cast<int>(Argument::input_folder)],
file_pattern.data(),
calibrationImageFiles
);
/* Load the actual images. */
std::vector<cv::Mat> calibrationImages;
cv::Mat testImg;
if (!loadImages(calibrationImageFiles, calibrationImages, argv[static_cast<int>(Argument::test_img)], testImg))
{
Log::fatal("Failed to load input images.");
return -1;
}
/* Create the camera calibrator. */
Log::info("Initialising camera calibrator...");
lab2::CameraCalibrator calibrator;
if (!calibrator.setCalibImgs(&calibrationImages, cell_size, pattern_size))
{
Log::fatal("FAIL");
return -1;
}
Log::info("SUCCESS");
Log::info("Starting calibration.");
calibrator.calibrate();
Log::info("Calibration complete.");
calibrator.printResults();
/* Compute the errors and vest/worst images. */
lab2::CalibrationStats results{ calibrator.meanProjErr() };
Log::info("Mean reprojection error: %f", results.meanRE);
Log::info("Best image: \"%s\"; error: %f", calibrationImageFiles[results.minRE.indx].c_str(), results.minRE.err);
Log::info("Worst image: \"%s\"; error: %f", calibrationImageFiles[results.maxRE.indx].c_str(), results.maxRE.err);
Log::info("Undistorting test image...");
cv::Mat undistortedTestImg{ testImg.clone() };
calibrator.undistort(undistortedTestImg);
Log::info("SUCCESS");
Log::info("Preparing output...");
cv::resize(testImg, testImg, testImg.size() / 3);
cv::resize(undistortedTestImg, undistortedTestImg, undistortedTestImg.size() / 3);
cv::hconcat(testImg, undistortedTestImg, testImg);
Log::info("SUCCESS");
Log::info("Displaying risults.");
cv::namedWindow(win_original.data());
cv::imshow(win_original.data(), testImg);
cv::waitKey(0);
}
bool loadImages(
const std::vector<cv::String>& calibFiles, std::vector<cv::Mat>& calibImgs,
const cv::String& testFile, cv::Mat& testImg
)
{
Log::info("Loading calibration images.");
for (const auto& fileName : calibFiles)
{
/* If an image was not loaded correctly, exit. */
Log::info("Loading image \"%s\".", fileName.c_str());
if (auto lastImg = calibImgs.emplace_back(cv::imread(fileName, cv::IMREAD_GRAYSCALE));
lastImg.empty())
{
Log::error("Failed to load image \"%s\".", fileName);
return false;
}
}
Log::info("Loaded calibration images.");
/* Load the test image. */
testImg = cv::imread(testFile);
if (testImg.empty())
{
Log::error("Failed to load test image \"%s\".", testFile);
return false;
}
Log::info("Loaded test image.");
return true;
}
| 31.348837
| 118
| 0.646142
|
DavidePistilli173
|
f4aba49c49dbbcc81da9e20edfcac034b5762561
| 26,597
|
cc
|
C++
|
1-Simulation/source/src/MyPhysListEM.cc
|
surfound/CXPD
|
788a125048cc3d79244a0562d94263e48ca22a6a
|
[
"Apache-2.0"
] | 1
|
2019-08-01T03:48:26.000Z
|
2019-08-01T03:48:26.000Z
|
1-Simulation/source/src/MyPhysListEM.cc
|
surfound/CXPD
|
788a125048cc3d79244a0562d94263e48ca22a6a
|
[
"Apache-2.0"
] | null | null | null |
1-Simulation/source/src/MyPhysListEM.cc
|
surfound/CXPD
|
788a125048cc3d79244a0562d94263e48ca22a6a
|
[
"Apache-2.0"
] | null | null | null |
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4PhysicsListHelper.hh"
// gamma processes
#include "G4PhotoElectricEffect.hh"
#include "G4PEEffectFluoModel.hh"
#include "G4LivermorePhotoElectricModel.hh"
#include "G4PenelopePhotoElectricModel.hh"
//#
#include "G4PolarizedPhotoElectricEffect.hh"
#include "G4PolarizedPEEffectModel.hh"
#include "G4LivermorePolarizedPhotoElectricModel.hh"
#include "G4ComptonScattering.hh"
#include "G4KleinNishinaCompton.hh"
#include "G4KleinNishinaModel.hh"
#include "G4HeatedKleinNishinaCompton.hh"
#include "G4LivermoreComptonModel.hh"
#include "G4LivermoreComptonModifiedModel.hh"
#include "G4LowEPComptonModel.hh"
#include "G4PenelopeComptonModel.hh"
//#
#include "G4PolarizedCompton.hh"
#include "G4PolarizedComptonModel.hh"
#include "G4LivermorePolarizedComptonModel.hh"
#include "G4LowEPPolarizedComptonModel.hh"
#include "G4GammaConversion.hh"
#include "G4BetheHeitlerModel.hh"
#include "G4PairProductionRelModel.hh"
#include "G4LivermoreGammaConversionModel.hh"
#include "G4LivermoreGammaConversionModelRC.hh"
#include "G4PenelopeGammaConversionModel.hh"
//#
#include "G4PolarizedGammaConversion.hh"
#include "G4PolarizedGammaConversionModel.hh"
#include "G4LivermorePolarizedGammaConversionModel.hh"
//#
#include "G4BoldyshevTripletModel.hh" //?
#include "G4LivermoreNuclearGammaConversionModel.hh" //?
#include "G4RayleighScattering.hh"
#include "G4LivermoreRayleighModel.hh"
#include "G4LivermorePolarizedRayleighModel.hh"
#include "G4PenelopeRayleighModel.hh"
// electron processes
#include "G4eMultipleScattering.hh"
#include "G4UrbanMscModel.hh"
#include "G4LowEWentzelVIModel.hh"
#include "G4WentzelVIModel.hh"
#include "G4GoudsmitSaundersonMscModel.hh"
#include "G4CoulombScattering.hh"
#include "G4eCoulombScatteringModel.hh"
#include "G4eIonisation.hh"
#include "G4MollerBhabhaModel.hh"
#include "G4LivermoreIonisationModel.hh"
#include "G4PenelopeIonisationModel.hh"
#include "G4PAIModel.hh"
#include "G4PAIPhotModel.hh"
//#
#include "G4ePolarizedIonisation.hh"
#include "G4PolarizedMollerBhabhaModel.hh"
#include "G4eBremsstrahlung.hh"
#include "G4SeltzerBergerModel.hh"
#include "G4eBremsstrahlungRelModel.hh"
#include "G4LivermoreBremsstrahlungModel.hh"
#include "G4PenelopeBremsstrahlungModel.hh"
//#
#include "G4ePolarizedBremsstrahlung.hh"
#include "G4ePolarizedBremsstrahlungModel.hh"
// positron processes
#include "G4eplusAnnihilation.hh"
// muon EM processes
#include "G4MuMultipleScattering.hh"
#include "G4MuIonisation.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"
// hadron EM process
#include "G4hMultipleScattering.hh"
#include "G4hIonisation.hh"
#include "G4hBremsstrahlung.hh"
#include "G4hPairProduction.hh"
// ion EM process
#include "G4ionIonisation.hh"
#include "G4IonParametrisedLossModel.hh"
#include "G4NuclearStopping.hh"
// distrubution
#include "G4UniversalFluctuation.hh"
//
#include "G4EmProcessOptions.hh"
#include "G4MscStepLimitType.hh"
#include "G4LossTableManager.hh"
#include "G4UAtomicDeexcitation.hh"
#include "G4SystemOfUnits.hh"
#include "Verbose.hh"
#include "MyPhysListEM.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
MyPhysListEM::MyPhysListEM(const G4String &name)
: G4VPhysicsConstructor(name)
{
if (verbose)
G4cout << "====>MyPhysListEM::MyPhysListEM()" << G4endl;
SetVerboseLevel(verbose);
fEmName = G4String(name);
G4EmParameters *param = G4EmParameters::Instance();
param->SetDefaults();
param->SetVerbose(verbose);
param->SetMinEnergy(100 * eV);
param->SetMaxEnergy(1 * TeV);
param->SetLowestElectronEnergy(100 * eV);
param->SetNumberOfBinsPerDecade(20);
param->ActivateAngularGeneratorForIonisation(true);
param->SetMscRangeFactor(0.02);
param->SetMuHadLateralDisplacement(true);
param->SetMscStepLimitType(fUseDistanceToBoundary);
param->SetFluo(true);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
MyPhysListEM::~MyPhysListEM()
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void MyPhysListEM::ConstructParticle()
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void MyPhysListEM::ConstructProcess()
{
if (verbose)
G4cout << "====>MyPhysListEM::ConstructProcess()" << G4endl;
G4PhysicsListHelper *ph = G4PhysicsListHelper::GetPhysicsListHelper();
// Add standard EM Processes
//
auto aParticleIterator = GetParticleIterator();
aParticleIterator->reset();
while ((*aParticleIterator)())
{
G4ParticleDefinition *particle = aParticleIterator->value();
G4String particleName = particle->GetParticleName();
//------------
// 1. gamma
if (particleName == "gamma")
{
//------------
//
//--> 1.1 photoelectric effect || polarizedPhotoElectric
//G4PhotoElectricEffect *thePhotoElectricEffect = new G4PhotoElectricEffect();
G4PolarizedPhotoElectricEffect* thePhotoElectricEffect = new G4PolarizedPhotoElectricEffect();
//----> 1.1.0 default model: G4PEEffectFluoModel || G4PolarizedPEEffectModel
//----> 1.1.1 G4LivermorePhotoElectricModel
//
//thePhotoElectricEffect->SetEmModel(new G4LivermorePhotoElectricModel(), 1);
//----> 1.1.2 G4LivermorePolarizedPhotoElectricModel
//
G4double LivermoreHighEnergyLimit = 1.0*GeV;
G4LivermorePolarizedPhotoElectricModel* theLivermorePhotoElectricModel = new G4LivermorePolarizedPhotoElectricModel();
theLivermorePhotoElectricModel->SetHighEnergyLimit(LivermoreHighEnergyLimit);
thePhotoElectricEffect->SetEmModel(theLivermorePhotoElectricModel);
//----> 1.1.3 G4PenelopePhotoElectricModel
//
//G4double PenelopeHighEnergyLimit = 1.0*GeV;
//G4PenelopePhotoElectricModel* thePEPenelopeModel = new G4PenelopePhotoElectricModel();
//thePEPenelopeModel->SetHighEnergyLimit(PenelopeHighEnergyLimit);
//thePhotoElectricEffect->SetEmModel(thePEPenelopeModel, 1);
//----> other options:
//
// G4PEEffectFluoModel.cc G4PolarizedPEEffectModel.cc
// G4LivermorePhotoElectricModel.cc G4LivermorePolarizedPhotoElectricGDModel.cc
// G4PenelopePhotoElectricModel.cc
// G4PhotoElectricAngularGeneratorPolarized.cc G4PhotoElectricAngularGeneratorSauterGavrila.cc G4PhotoElectricAngularGeneratorSimple.cc
ph->RegisterProcess(thePhotoElectricEffect, particle);
//------------
//
//--> 1.2 Compton scattering || polarized Compton scattering
G4ComptonScattering *theComptonScattering = new G4ComptonScattering();
//G4PolarizedCompton* theComptonScattering = new G4PolarizedCompton();
//----> 1.2.0 default model: G4KleinNishinaCompton || G4PolarizedComptonModel
//----> 1.2.1 G4LivermoreComptonModel
//
theComptonScattering->SetEmModel(new G4LivermoreComptonModel(), 1);
//----> 1.2.2 G4LivermorePolarizedComptonModel
//
//G4LivermorePolarizedComptonModel* theLivermoreComptonModel = new G4LivermorePolarizedComptonModel();
//theLivermoreComptonModel->SetHighEnergyLimit(LivermoreHighEnergyLimit);
//theComptonScattering->AddEmModel(0, theLivermoreComptonModel);
//----> 1.2.3 G4LowEPComptonModel
//
//G4LowEPComptonModel* theLowEPComptonModel = new G4LowEPComptonModel();
//theLowEPComptonModel->SetHighEnergyLimit(20*MeV);
//theComptonScattering->AddEmModel(0, theLowEPComptonModel);
//----> 1.2.4 G4PenelopeComptonModel
//
//G4PenelopeComptonModel* theComptonPenelopeModel = new G4PenelopeComptonModel();
//theComptonPenelopeModel->SetHighEnergyLimit(PenelopeHighEnergyLimit);
//theComptonScattering->SetEmModel(theComptonPenelopeModel, 1);
//----> other options:
//
// G4eInverseCompton.cc
// G4KleinNishinaCompton.cc G4HeatedKleinNishinaCompton.cc
// G4LowEPComptonModel.cc G4LowEPPolarizedComptonModel.cc
// G4LivermoreComptonModel.cc G4LivermoreComptonModifiedModel.cc G4LivermorePolarizedComptonModel.cc
// G4PenelopeComptonModel.cc
ph->RegisterProcess(theComptonScattering, particle);
//------------
//
//--> 1.3 gamma conversion || polarized gamma conversion
G4GammaConversion *theGammaConversion = new G4GammaConversion();
//G4PolarizedGammaConversionModel *theGammaConversion = new G4PolarizedGammaConversionModel();
//----> 1.3.0 default model: G4BetheHeitlerModel & G4PairProductionRelModel
// || G4PolarizedGammaConversionModel
//----> 1.3.1 G4LivermoreGammaConversionModel - Livermore model below 80 GeV
//
theGammaConversion->SetEmModel(new G4LivermoreGammaConversionModel(), 1);
//----> 1.3.2 G4LivermorePolarizedGammaConversionModel
//
//G4LivermorePolarizedGammaConversionModel* theLivermoreGammaConversionModel = new G4LivermorePolarizedGammaConversionModel();
//theLivermoreGammaConversionModel->SetHighEnergyLimit(LivermoreHighEnergyLimit);
//theGammaConversion->AddEmModel(0, theLivermoreGammaConversionModel);
//----> 1.3.4 G4PenelopeGammaConversionModel
//
//G4PenelopeGammaConversionModel* theGCPenelopeModel = new G4PenelopeGammaConversionModel();
//theGammaConversion->SetEmModel(theGCPenelopeModel,1);
//----> other options:
//
ph->RegisterProcess(theGammaConversion, particle);
//------------
//
//--> 1.4 rayleigh - default Rayleigh scattering is Livermore
G4RayleighScattering *theRayleigh = new G4RayleighScattering();
//----> 1.4.1 default Rayleigh scattering is G4LivermoreRayleighModel
//----> 1.4.2 G4LivermorePolarizedRayleighModel
//
//G4LivermorePolarizedRayleighModel* theRayleighModel = new G4LivermorePolarizedRayleighModel();
//theRayleighModel->SetHighEnergyLimit(LivermoreHighEnergyLimit);
//theRayleigh->AddEmModel(0, theRayleighModel);
//----> 1.4.3 G4PenelopeRayleighModel
//
//G4PenelopeRayleighModel* theRayleighPenelopeModel = new G4PenelopeRayleighModel();
////theRayleighPenelopeModel->SetHighEnergyLimit(PenelopeHighEnergyLimit);
//theRayleigh->SetEmModel(theRayleighPenelopeModel, 1);
//----> other options:
//
ph->RegisterProcess(theRayleigh, particle);
}
//------------
// 2. electron
else if (particleName == "e-")
{
G4double highEnergyLimit = 100 * MeV;
//------------
//
//--> 2.1 multiple scattering
G4eMultipleScattering *msc = new G4eMultipleScattering;
//msc->SetStepLimitType(fUseDistanceToBoundary);
//----> 2.1.0 default model: G4UrbanMscModel
//----> 2.1.1 use 1 model
//
// options:
// G4UrbanMscModel, G4WentzelVIModel, G4LowEWentzelVIModel, G4GoudsmitSaundersonMscModel
//G4LowEWentzelVIModel *msc1 = new G4LowEWentzelVIModel();
//msc->SetEmModel(msc1, 1);
//----> 2.1.2 use 2 models for different energy range
//
G4UrbanMscModel *msc1 = new G4UrbanMscModel();
G4WentzelVIModel *msc2 = new G4WentzelVIModel();
msc1->SetHighEnergyLimit(highEnergyLimit);
msc2->SetLowEnergyLimit(highEnergyLimit);
msc->AddEmModel(0, msc1);
msc->AddEmModel(0, msc2);
ph->RegisterProcess(msc, particle);
//------------
//
//--> 2.2 coulomb scattering, default model: G4eCoulombScatteringModel
G4CoulombScattering *ss = new G4CoulombScattering();
G4eCoulombScatteringModel *ssm = new G4eCoulombScatteringModel();
ssm->SetLowEnergyLimit(highEnergyLimit);
ssm->SetActivationLowEnergyLimit(highEnergyLimit);
ss->SetEmModel(ssm, 1);
ss->SetMinKinEnergy(highEnergyLimit);
ph->RegisterProcess(ss, particle);
//------------
//
//--> 2.3 Ionisation and polarized ionisation
G4eIonisation *eIoni = new G4eIonisation();
//G4ePolarizedIonisation *eIoni = new G4ePolarizedIonisation();
eIoni->SetStepFunction(0.2, 100 * um);
//----> 2.3.1 default is G4MollerBhabhaModel || G4PolarizedMollerBhabhaModel
//----> 2.3.2 Livermore should be used only for low energies
//
G4LivermoreIonisationModel *theIoniLivermore = new G4LivermoreIonisationModel();
theIoniLivermore->SetHighEnergyLimit(0.1 * MeV);
eIoni->AddEmModel(0, theIoniLivermore, new G4UniversalFluctuation());
//----> 2.3.3 G4PenelopeIonisationModel
//
//G4PenelopeIonisationModel* theIoniPenelope = new G4PenelopeIonisationModel();
//theIoniPenelope->SetHighEnergyLimit(PenelopeHighEnergyLimit);
//eIoni->AddEmModel(0,theIoniPenelope,new G4UniversalFluctuation());
//----> other options (PAI: PhotoAbsorption Ionization)
// G4PAIModel.cc G4PAIPhotModel.cc
//G4PAIPhotModel *thePAIphotModel = new G4PAIPhotModel();
//thePAIphotModel->SetHighEnergyLimit(0.1 * MeV);
//eIoni->AddEmModel(0, thePAIphotModel, new G4UniversalFluctuation());
ph->RegisterProcess(eIoni, particle);
//------------
//
//--> 2.4 Bremsstrahlung or polarized bremsstrahlung
G4eBremsstrahlung *eBrem = new G4eBremsstrahlung();
//G4ePolarizedBremsstrahlung* eBrem = new G4ePolarizedBremsstrahlung();
//----> 2.4.1 default is G4SeltzerBergerModel (min ~ GeV) + G4eBremsstrahlungRelModel (GeV ~ max)
// || G4ePolarizedBremsstrahlungModel
//----> 2.4.2 G4SeltzerBergerModel + Angular distribution
//
//G4VEmModel* theBrem = new G4SeltzerBergerModel();
//theBrem->SetHighEnergyLimit(1*GeV);
//theBrem->SetAngularDistribution(new G4Generator2BS());
//----> 2.4.3 Livermore
//
//G4VEmModel* theBremLivermore = new G4LivermoreBremsstrahlungModel();
//theBremLivermore->SetHighEnergyLimit(1*GeV);
//theBremLivermore->SetAngularDistribution(new G4Generator2BS());
//eBrem->SetEmModel(theBremLivermore,1);
//----> 2.4.4 G4PenelopeBremsstrahlungModel
//
//G4PenelopeBremsstrahlungModel* theBremPenelope = new G4PenelopeBremsstrahlungModel();
//theBremPenelope->SetHighEnergyLimit(PenelopeHighEnergyLimit);
//eBrem->AddEmModel(0,theBremPenelope);
ph->RegisterProcess(eBrem, particle);
}
//------------
// 3. position
else if (particleName == "e+")
{
G4double highEnergyLimit = 100 * MeV;
//------------
//
//--> 3.1 multiple scattering
G4eMultipleScattering *msc = new G4eMultipleScattering;
//msc->SetStepLimitType(fUseDistanceToBoundary);
//----> 3.1.0 default model: G4UrbanMscModel
//----> 3.1.1 use 1 model
//
// options:
// G4UrbanMscModel, G4WentzelVIModel, G4LowEWentzelVIModel, G4GoudsmitSaundersonMscModel
//G4LowEWentzelVIModel *msc1 = new G4LowEWentzelVIModel();
//msc->SetEmModel(msc1, 1);
//----> 3.1.2 use 2 models for different energy range
//
G4UrbanMscModel *msc1 = new G4UrbanMscModel();
G4WentzelVIModel *msc2 = new G4WentzelVIModel();
msc1->SetHighEnergyLimit(highEnergyLimit);
msc2->SetLowEnergyLimit(highEnergyLimit);
msc->AddEmModel(0, msc1);
msc->AddEmModel(0, msc2);
ph->RegisterProcess(msc, particle);
//------------
//
//--> 3.2 coulomb scattering, default model: G4eCoulombScatteringModel
G4CoulombScattering *ss = new G4CoulombScattering();
G4eCoulombScatteringModel *ssm = new G4eCoulombScatteringModel();
ssm->SetLowEnergyLimit(highEnergyLimit);
ssm->SetActivationLowEnergyLimit(highEnergyLimit);
ss->SetEmModel(ssm, 1);
ss->SetMinKinEnergy(highEnergyLimit);
ph->RegisterProcess(ss, particle);
//------------
//
//--> 3.3 Ionisation and polarized ionisation
G4eIonisation *eIoni = new G4eIonisation();
//G4ePolarizedIonisation *eIoni = new G4ePolarizedIonisation();
eIoni->SetStepFunction(0.2, 100 * um);
//----> 3.3.1 default is G4MollerBhabhaModel || G4PolarizedMollerBhabhaModel
//----> 3.3.2 Livermore should be used only for low energies electron, not for positron
//----> 3.3.3 G4PenelopeIonisationModel
//
//G4PenelopeIonisationModel* theIoniPenelope = new G4PenelopeIonisationModel();
//theIoniPenelope->SetHighEnergyLimit(PenelopeHighEnergyLimit);
//eIoni->AddEmModel(0,theIoniPenelope,new G4UniversalFluctuation());
//----> other options (PAI: PhotoAbsorption Ionization)
// G4PAIModel.cc G4PAIPhotModel.cc
ph->RegisterProcess(eIoni, particle);
//------------
//
//--> 3.4 Bremsstrahlung or polarized bremsstrahlung
G4eBremsstrahlung *eBrem = new G4eBremsstrahlung();
//G4ePolarizedBremsstrahlung* eBrem = new G4ePolarizedBremsstrahlung();
//----> 3.4.1 default is G4SeltzerBergerModel (min ~ GeV) + G4eBremsstrahlungRelModel (GeV ~ max)
// || G4ePolarizedBremsstrahlungModel
//----> 3.4.2 G4SeltzerBergerModel + Angular distribution
//
//G4VEmModel* theBrem = new G4SeltzerBergerModel();
//theBrem->SetHighEnergyLimit(1*GeV);
//theBrem->SetAngularDistribution(new G4Generator2BS());
//----> 3.4.3 Livermore
//
//G4VEmModel* theBremLivermore = new G4LivermoreBremsstrahlungModel();
//theBremLivermore->SetHighEnergyLimit(1*GeV);
//theBremLivermore->SetAngularDistribution(new G4Generator2BS());
//eBrem->SetEmModel(theBremLivermore,1);
//----> 3.4.4 G4PenelopeBremsstrahlungModel
//
//G4PenelopeBremsstrahlungModel* theBremPenelope = new G4PenelopeBremsstrahlungModel();
//theBremPenelope->SetHighEnergyLimit(PenelopeHighEnergyLimit);
//eBrem->AddEmModel(0,theBremPenelope);
ph->RegisterProcess(eBrem, particle);
//------------
//
//--> 3.5 Annihilation
G4eplusAnnihilation *eAnn = new G4eplusAnnihilation();
//----> 3.5.1 default is G4eeToTwoGammaModel
//----> 3.5.2 G4PenelopeAnnihilationModel
//G4PenelopeAnnihilationModel* theAnnPenelope = new G4PenelopeAnnihilationModel();
//theAnnPenelope->SetHighEnergyLimit(PenelopeHighEnergyLimit);
//eAnni->AddEmModel(0,theAnnPenelope);
ph->RegisterProcess(eAnn, particle);
}
else if (particleName == "mu+" ||
particleName == "mu-")
{
G4MuIonisation *muIoni = new G4MuIonisation();
muIoni->SetStepFunction(0.2, 50 * um);
ph->RegisterProcess(muIoni, particle);
G4MuMultipleScattering *mumsc = new G4MuMultipleScattering();
mumsc->AddEmModel(0, new G4WentzelVIModel());
ph->RegisterProcess(mumsc, particle);
G4MuBremsstrahlung *mub = new G4MuBremsstrahlung();
ph->RegisterProcess(mub, particle);
G4MuPairProduction *mup = new G4MuPairProduction();
ph->RegisterProcess(mup, particle);
G4CoulombScattering *mucoul = new G4CoulombScattering();
ph->RegisterProcess(mucoul, particle);
}
else if (particleName == "alpha" ||
particleName == "He3")
{
G4hMultipleScattering *msc = new G4hMultipleScattering();
ph->RegisterProcess(msc, particle);
G4ionIonisation *ionIoni = new G4ionIonisation();
ionIoni->SetStepFunction(0.1, 10 * um);
ph->RegisterProcess(ionIoni, particle);
G4NuclearStopping *pnuc = new G4NuclearStopping();
ph->RegisterProcess(pnuc, particle);
pnuc->SetMaxKinEnergy(MeV);
}
else if (particleName == "pi-" ||
particleName == "pi+")
{
G4hMultipleScattering *pimsc = new G4hMultipleScattering();
ph->RegisterProcess(pimsc, particle);
G4hIonisation *hIoni = new G4hIonisation();
hIoni->SetStepFunction(0.2, 50 * um);
ph->RegisterProcess(hIoni, particle);
G4hBremsstrahlung *pib = new G4hBremsstrahlung();
ph->RegisterProcess(pib, particle);
G4hPairProduction *pip = new G4hPairProduction();
ph->RegisterProcess(pip, particle);
}
else if (particleName == "kaon+" ||
particleName == "kaon-")
{
G4hMultipleScattering *kmsc = new G4hMultipleScattering();
ph->RegisterProcess(kmsc, particle);
G4hIonisation *hIoni = new G4hIonisation();
hIoni->SetStepFunction(0.2, 50 * um);
ph->RegisterProcess(hIoni, particle);
G4hBremsstrahlung *kb = new G4hBremsstrahlung();
ph->RegisterProcess(kb, particle);
G4hPairProduction *kp = new G4hPairProduction();
ph->RegisterProcess(kp, particle);
}
else if (particleName == "proton" ||
particleName == "anti_proton")
{
G4hMultipleScattering *pmsc = new G4hMultipleScattering();
ph->RegisterProcess(pmsc, particle);
G4hIonisation *hIoni = new G4hIonisation();
hIoni->SetStepFunction(0.2, 50 * um);
ph->RegisterProcess(hIoni, particle);
G4hBremsstrahlung *pb = new G4hBremsstrahlung();
ph->RegisterProcess(pb, particle);
G4hPairProduction *pp = new G4hPairProduction();
ph->RegisterProcess(pp, particle);
G4NuclearStopping *pnuc = new G4NuclearStopping();
ph->RegisterProcess(pnuc, particle);
pnuc->SetMaxKinEnergy(MeV);
}
else if (particleName == "GenericIon")
{
G4ionIonisation *ionIoni = new G4ionIonisation();
ionIoni->SetEmModel(new G4IonParametrisedLossModel());
ionIoni->SetStepFunction(0.1, 1 * um);
ph->RegisterProcess(ionIoni, particle);
G4hMultipleScattering *hmsc = new G4hMultipleScattering("ionmsc");
ph->RegisterProcess(hmsc, particle);
G4NuclearStopping *pnuc = new G4NuclearStopping();
ph->RegisterProcess(pnuc, particle);
pnuc->SetMaxKinEnergy(MeV);
}
else if (particleName == "B+" ||
particleName == "B-" ||
particleName == "D+" ||
particleName == "D-" ||
particleName == "Ds+" ||
particleName == "Ds-" ||
particleName == "anti_He3" ||
particleName == "anti_alpha" ||
particleName == "anti_deuteron" ||
particleName == "anti_lambda_c+" ||
particleName == "anti_omega-" ||
particleName == "anti_sigma_c+" ||
particleName == "anti_sigma_c++" ||
particleName == "anti_sigma+" ||
particleName == "anti_sigma-" ||
particleName == "anti_triton" ||
particleName == "anti_xi_c+" ||
particleName == "anti_xi-" ||
particleName == "deuteron" ||
particleName == "lambda_c+" ||
particleName == "omega-" ||
particleName == "sigma_c+" ||
particleName == "sigma_c++" ||
particleName == "sigma+" ||
particleName == "sigma-" ||
particleName == "tau+" ||
particleName == "tau-" ||
particleName == "triton" ||
particleName == "xi_c+" ||
particleName == "xi-")
{
G4hMultipleScattering *hmsc = new G4hMultipleScattering("ionmsc");
ph->RegisterProcess(hmsc, particle);
G4hIonisation *hIoni = new G4hIonisation();
ph->RegisterProcess(hIoni, particle);
G4NuclearStopping *pnuc = new G4NuclearStopping();
ph->RegisterProcess(pnuc, particle);
pnuc->SetMaxKinEnergy(MeV);
}
else if ((!particle->IsShortLived()) &&
(particle->GetPDGCharge() != 0.0) &&
(particle->GetParticleName() != "chargedgeantino"))
{
//all others charged particles except geantino
ph->RegisterProcess(new G4hMultipleScattering(), particle);
ph->RegisterProcess(new G4hIonisation(), particle);
}
}
// Deexcitation
//
G4VAtomDeexcitation *de = new G4UAtomicDeexcitation();
// default: all false
de->SetFluo(true); // active Deexcitation, default is false
de->SetAuger(false); // Auger electron
de->SetPIXE(false); // Particle induced X-ray emission
G4LossTableManager::Instance()->SetAtomDeexcitation(de);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
| 38.546377
| 148
| 0.618867
|
surfound
|
f4bb938368c44124cc42be41e439f74a33a7caf0
| 277
|
cpp
|
C++
|
Modbus Poll/CVcWall.cpp
|
DHSERVICE56/T3000_Building_Automation_System
|
77bd47a356211b1c8ad09fb8d785e9f880d3cd26
|
[
"MIT"
] | 1
|
2019-12-11T05:14:08.000Z
|
2019-12-11T05:14:08.000Z
|
Modbus Poll/CVcWall.cpp
|
DHSERVICE56/T3000_Building_Automation_System
|
77bd47a356211b1c8ad09fb8d785e9f880d3cd26
|
[
"MIT"
] | null | null | null |
Modbus Poll/CVcWall.cpp
|
DHSERVICE56/T3000_Building_Automation_System
|
77bd47a356211b1c8ad09fb8d785e9f880d3cd26
|
[
"MIT"
] | 1
|
2021-05-31T18:56:31.000Z
|
2021-05-31T18:56:31.000Z
|
// CVcWall.cpp : Definition of ActiveX Control wrapper class(es) created by Microsoft Visual C++
#include "stdafx.h"
#include "CVcWall.h"
/////////////////////////////////////////////////////////////////////////////
// CVcWall
// CVcWall properties
// CVcWall operations
| 21.307692
| 97
| 0.523466
|
DHSERVICE56
|
f4bfe147969eb3d294b88d278ff7ceeda3700b5d
| 11,909
|
cpp
|
C++
|
src/main.cpp
|
kaorusha/CarND-Path-Planning-Project
|
62ec9d76840a18702b70d2de3b8e7a91be88d471
|
[
"MIT"
] | null | null | null |
src/main.cpp
|
kaorusha/CarND-Path-Planning-Project
|
62ec9d76840a18702b70d2de3b8e7a91be88d471
|
[
"MIT"
] | null | null | null |
src/main.cpp
|
kaorusha/CarND-Path-Planning-Project
|
62ec9d76840a18702b70d2de3b8e7a91be88d471
|
[
"MIT"
] | null | null | null |
#include <uWS/uWS.h>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include "Eigen-3.3/Eigen/Core"
#include "Eigen-3.3/Eigen/QR"
#include "helpers.h"
#include "json.hpp"
#include "spline.h"
#include "vehicle.h"
// for convenience
using nlohmann::json;
using std::string;
using std::vector;
#define toM_S 0.44704
//#define DEBUG
Eigen::Vector2d translation(const vector<double> &trans,
Eigen::Vector2d input) {
Eigen::Vector2d trans_vector(trans.data());
assert(trans.size() == input.size());
return trans_vector + input;
}
Eigen::Vector2d rotation2d(Eigen::Vector2d input, double theta) {
Eigen::Matrix2d rotation;
rotation << cos(theta), -sin(theta), sin(theta), cos(theta);
return rotation * input;
}
int main() {
uWS::Hub h;
// Load up map values for waypoint's x,y,s and d normalized normal vectors
vector<double> map_waypoints_x;
vector<double> map_waypoints_y;
vector<double> map_waypoints_s;
vector<double> map_waypoints_dx;
vector<double> map_waypoints_dy;
// Waypoint map to read from
string map_file_ = "../data/highway_map.csv";
// The max s value before wrapping around the track back to 0
double max_s = 6945.554;
// variables passed to onMessage()
Vehicle ego;
const int num_lanes = 3;
const int lane_width = 4;
// calculate 50 MPH to m/s and reduce 1%
const float speed_limit = 50 * 0.99; // MPH
const float accel_limit = 10 * 0.5; // m/s^2
ego.configure(num_lanes, lane_width, speed_limit * toM_S, accel_limit, max_s);
std::ifstream in_map_(map_file_.c_str(), std::ifstream::in);
string line;
while (getline(in_map_, line)) {
std::istringstream iss(line);
double x;
double y;
float s;
float d_x;
float d_y;
iss >> x;
iss >> y;
iss >> s;
iss >> d_x;
iss >> d_y;
map_waypoints_x.push_back(x);
map_waypoints_y.push_back(y);
map_waypoints_s.push_back(s);
map_waypoints_dx.push_back(d_x);
map_waypoints_dy.push_back(d_y);
}
h.onMessage([&ego, &map_waypoints_x, &map_waypoints_y, &map_waypoints_s,
&map_waypoints_dx,
&map_waypoints_dy](uWS::WebSocket<uWS::SERVER> ws, char *data,
size_t length, uWS::OpCode opCode) {
// "42" at the start of the message means there's a websocket message event.
// The 4 signifies a websocket message
// The 2 signifies a websocket event
if (length && length > 2 && data[0] == '4' && data[1] == '2') {
auto s = hasData(data);
if (s != "") {
auto j = json::parse(s);
string event = j[0].get<string>();
if (event == "telemetry") {
// j[1] is the data JSON object
// Main car's localization Data
double car_x = j[1]["x"];
double car_y = j[1]["y"];
double car_s = j[1]["s"];
double car_d = j[1]["d"];
double car_yaw = j[1]["yaw"];
double car_speed = j[1]["speed"];
// Previous path data given to the Planner
auto previous_path_x = j[1]["previous_path_x"];
auto previous_path_y = j[1]["previous_path_y"];
// Previous path's end s and d values
double end_path_s = j[1]["end_path_s"];
double end_path_d = j[1]["end_path_d"];
// Sensor Fusion Data, a list of all other cars on the same side
// of the road.
auto sensor_fusion = j[1]["sensor_fusion"];
json msgJson;
vector<double> next_x_vals;
vector<double> next_y_vals;
/**
* TODO: define a path made up of (x,y) points that the car will visit
* sequentially every .02 seconds
*/
#ifdef DEBUG
std::cout << std::setprecision(5) << "x\ty\tyaw\ts\td\tspeed\n"
<< car_x << "\t" << car_y << "\t" << car_yaw << "\t"
<< car_s << "\t" << car_d << "\t" << car_speed << std::endl;
#endif
const double loop_t = 0.02; // sec
ego.last_update_time += (float)loop_t;
ego.update(car_s, car_d, car_speed * toM_S, loop_t);
// wait until finishing lane changing and avoid changing behavior
// frequently
if ((ego.goal_lane < 0 || ego.goal_lane == ego.lane) &&
ego.last_update_time > 0.2) {
ego.goal_lane = ego.choose_next_state(sensor_fusion);
ego.last_update_time = 0;
}
// check front distance of ego-vehicle
bool too_close = false;
for (unsigned int i = 0; i < sensor_fusion.size(); ++i) {
double sensor_d = sensor_fusion[i][6];
// check vehicle in the same lane
if ((int)(sensor_d / ego.lane_width) == ego.lane) {
double sensor_vx = sensor_fusion[i][3];
double sensor_vy = sensor_fusion[i][4];
double sensor_s = sensor_fusion[i][5];
// future position at next time step
sensor_s +=
sqrt(sensor_vx * sensor_vx + sensor_vy * sensor_vy) * loop_t;
// check ones that in front of ego vehicle
if ((sensor_s > car_s) &&
(sensor_s - car_s < ego.preferred_buffer)) {
too_close = true;
break;
}
}
}
unsigned int previous_path_size = previous_path_x.size();
for (unsigned int i = 0; i < previous_path_size; ++i) {
next_x_vals.push_back(previous_path_x[i]);
next_y_vals.push_back(previous_path_y[i]);
}
// find 5 points to create spline
vector<double> Xs, Ys;
// the heading at the end of previous path
double yaw_rad;
if (previous_path_size >= 2) {
// add X[-2], Y[-2]
// std::cout << "previous_path_size >= 2" << std::endl;
Xs.push_back(previous_path_x[previous_path_size - 2]);
Ys.push_back(previous_path_y[previous_path_size - 2]);
// add X[-1], Y[-1]
Xs.push_back(previous_path_x[previous_path_size - 1]);
Ys.push_back(previous_path_y[previous_path_size - 1]);
// calculate yaw
yaw_rad = atan2(Ys[1] - Ys[0], Xs[1] - Xs[0]);
} else {
// create a fake previous point
// std::cout << "previous_path_size less than 2" << std::endl;
Xs.push_back(car_x - cos(deg2rad(car_yaw)));
Xs.push_back(car_x);
Ys.push_back(car_y - sin(deg2rad(car_yaw)));
Ys.push_back(car_y);
yaw_rad = deg2rad(car_yaw);
// no previous path
end_path_s = car_s;
}
// rest point using map waypoints which is 30m apart in s in Frenet
// coordinate
// push another 3 point for spline creating
double target_d = (double)(4 * ego.goal_lane + 2);
double next_waypoint_s = 30.0;
for (unsigned int i = 1; i < 4; ++i) {
vector<double> map_waypoint_plus_lane =
getXY(end_path_s + next_waypoint_s * i, target_d,
map_waypoints_s, map_waypoints_x, map_waypoints_y);
Xs.push_back(map_waypoint_plus_lane[0]);
Ys.push_back(map_waypoint_plus_lane[1]);
}
#ifdef DEBUG
printVector("Xs= ", Xs);
printVector("Ys= ", Ys);
#endif
// transfer to local coordinate
double x_trans = Xs[0];
double y_trans = Ys[0];
for (unsigned int i = 0; i < Xs.size(); ++i) {
Eigen::Vector2d local_pose = rotation2d(
translation({-x_trans, -y_trans}, {Xs[i], Ys[i]}), -yaw_rad);
Xs[i] = local_pose(0);
Ys[i] = local_pose(1);
}
#ifdef DEBUG
printVector("Xs= ", Xs);
printVector("Ys= ", Ys);
#endif
// create spline
tk::spline s(Xs, Ys);
double spline_dist, next_x, next_y;
double next_waypoint_x = 30.0;
spline_dist = distance(Xs[1], Ys[1], Xs[1] + next_waypoint_x,
s(Xs[1] + next_waypoint_x));
// 50 MPH for 0.02 second is 0.447 meter, use 99% and get 0.443 meter
// x_delta will be less for busy traffic and lower lane speed
float velocity_limit;
if (ego.state == "KL")
velocity_limit = ego.target_speed;
else
velocity_limit = ego.lane_speed;
next_x = Xs[1];
#ifdef DEBUG
next_y = Ys[1];
float last_v, last_a;
#endif
for (unsigned int i = 0; i < 50 - previous_path_size; ++i) {
// update x_delta inside the loop
if (too_close || ego.cmd_vel > velocity_limit) {
ego.cmd_vel -= ego.max_acceleration * loop_t;
} else if (ego.cmd_vel < velocity_limit)
ego.cmd_vel += ego.max_acceleration * loop_t;
double x_delta =
next_waypoint_x / (spline_dist / (ego.cmd_vel * loop_t));
if (x_delta < 0) {
std::cout << "x_delta < 0: " << x_delta << std::endl;
x_delta = 0.001;
}
// update next_x
next_x += x_delta;
#ifdef DEBUG
// check the vel
float v, a, jerk;
v = sqrt(x_delta * x_delta +
(s(next_x) - next_y) * (s(next_x) - next_y)) /
0.02;
if (v > 50 * toM_S)
std::cout << "state " << ego.state << "\tat " << i << "\tv= " << v
<< std::endl;
if (i > 0) {
a = (v - last_v) / 0.02;
if (a > 10)
std::cout << "state " << ego.state << "\tat " << i
<< "\ta= " << a << std::endl;
}
/*if (i > 1) {
jerk = (a - last_a) / 0.02;
if (jerk > 10) std::cout << "jerk exceed: " << jerk << std::endl;
}*/
last_v = v;
last_a = a;
#endif
// find corresponded y in spline
next_y = s(next_x);
// transfer from local coordinate to map coordinate
Eigen::Vector2d next;
next << next_x, next_y;
Eigen::Vector2d map_pose =
translation({x_trans, y_trans}, rotation2d(next, yaw_rad));
next_x_vals.push_back(map_pose(0));
next_y_vals.push_back(map_pose(1));
}
// printVector("x= ", next_x_vals);
// printVector("y= ", next_y_vals);
msgJson["next_x"] = next_x_vals;
msgJson["next_y"] = next_y_vals;
auto msg = "42[\"control\"," + msgJson.dump() + "]";
ws.send(msg.data(), msg.length(), uWS::OpCode::TEXT);
} // end "telemetry" if
} else {
// Manual driving
std::string msg = "42[\"manual\",{}]";
ws.send(msg.data(), msg.length(), uWS::OpCode::TEXT);
}
} // end websocket if
}); // end h.onMessage
h.onConnection([&h](uWS::WebSocket<uWS::SERVER> ws, uWS::HttpRequest req) {
std::cout << "Connected!!!" << std::endl;
});
h.onDisconnection([&h](uWS::WebSocket<uWS::SERVER> ws, int code,
char *message, size_t length) {
ws.close();
std::cout << "Disconnected" << std::endl;
});
int port = 4567;
if (h.listen(port)) {
std::cout << "Listening to port " << port << std::endl;
} else {
std::cerr << "Failed to listen to port" << std::endl;
return -1;
}
h.run();
}
| 36.984472
| 81
| 0.522966
|
kaorusha
|
f4c0a258944c9dafc6f806128443299bd2717793
| 4,971
|
cpp
|
C++
|
cppn-neat/NE/HyperNEAT/NEAT/src/NEAT_ModularNetwork.cpp
|
GiorgosMethe/Soft-Robots-Novelty-Search-Public
|
f493923e7c16a3cedc018be22ab6373046641001
|
[
"MIT"
] | null | null | null |
cppn-neat/NE/HyperNEAT/NEAT/src/NEAT_ModularNetwork.cpp
|
GiorgosMethe/Soft-Robots-Novelty-Search-Public
|
f493923e7c16a3cedc018be22ab6373046641001
|
[
"MIT"
] | null | null | null |
cppn-neat/NE/HyperNEAT/NEAT/src/NEAT_ModularNetwork.cpp
|
GiorgosMethe/Soft-Robots-Novelty-Search-Public
|
f493923e7c16a3cedc018be22ab6373046641001
|
[
"MIT"
] | null | null | null |
#include "NEAT_Defines.h"
#include "NEAT_ModularNetwork.h"
#include "NEAT_Random.h"
#include "NEAT_GeneticIndividual.h"
#include "NEAT_Globals.h"
namespace NEAT
{
ModularNetwork::ModularNetwork(vector<NetworkNode *> &_nodes,vector<NetworkLink *> &_links)
:
Network<double>()
{
for (int a=0;a<(int)_nodes.size();a++)
{
nodes.push_back(
new NetworkNode(
_nodes[a]->getName(),
_nodes[a]->getUpdate(),
_nodes[a]->getActivationFunction()
)
);
}
for (int a=0;a<(int)_links.size();a++)
{
NetworkNode *fromNodeTemp=NULL,*toNodeTemp=NULL;
for (int b=0;b<(int)_nodes.size();b++)
{
if (_nodes[b]==_links[a]->getFromNode())
{
fromNodeTemp = nodes[b];
}
if (_nodes[b]==_links[a]->getToNode())
{
toNodeTemp = nodes[b];
}
}
links.push_back(
new NetworkLink(
fromNodeTemp,
toNodeTemp,
_links[a]->isForward(),
_links[a]->getWeight()
)
);
}
}
ModularNetwork::ModularNetwork()
:
Network<double>()
{}
ModularNetwork& ModularNetwork::operator=(const ModularNetwork &other)
{
copyFrom(other);
return *this;
}
ModularNetwork::ModularNetwork(const ModularNetwork &other)
{
copyFrom(other);
}
void ModularNetwork::copyFrom(const ModularNetwork &other)
{
Network<double>::copyFrom(other);
if (this!=&other)
{
for (int a=0;a<(int)other.nodes.size();a++)
{
nodes.push_back(
new NetworkNode(
other.nodes[a]->getName(),
other.nodes[a]->getUpdate(),
other.nodes[a]->getActivationFunction()
)
);
}
for (int a=0;a<(int)other.links.size();a++)
{
NetworkNode *fromNodeTemp=NULL,*toNodeTemp=NULL;
for (int b=0;b<(int)other.nodes.size();b++)
{
if (other.nodes[b]==other.links[a]->getFromNode())
{
fromNodeTemp = nodes[b];
}
if (other.nodes[b]==other.links[a]->getToNode())
{
toNodeTemp = nodes[b];
}
}
links.push_back(
new NetworkLink(
fromNodeTemp,
toNodeTemp,
other.links[a]->isForward(),
other.links[a]->getWeight()
)
);
}
}
}
ModularNetwork::~ModularNetwork()
{
for (int a=0;a<(int)nodes.size();a++)
{
delete nodes[a];
}
for (int a=0;a<(int)links.size();a++)
{
delete links[a];
}
}
bool ModularNetwork::hasNode(const string &nodeName)
{
for (int a=0;a<(int)nodes.size();a++)
{
if (!strcmp(nodes[a]->getName().c_str(),nodeName.c_str()))
return true;
}
return false;
}
NetworkNode *ModularNetwork::getNode(const string &name)
{
for (int a=0;a<(int)nodes.size();a++)
{
if (!strcmp(nodes[a]->getName().c_str(),name.c_str()))
return nodes[a];
}
throw CREATE_LOCATEDEXCEPTION_INFO(string("Could not find node by the name: ")+name+string(" !"));
}
NetworkLink *ModularNetwork::getLink(const string &fromNodeName,const string &toNodeName)
{
NetworkNode* fromNode = getNode(fromNodeName);
NetworkNode* toNode = getNode(toNodeName);
for (int a=0;a<(int)links.size();a++)
{
if (
links[a]->getFromNode()==fromNode &&
links[a]->getToNode() == toNode
)
{
return links[a];
}
}
return NULL;
}
void ModularNetwork::reinitialize()
{
activated=false;
for (int a=0;a<(int)nodes.size();a++)
{
nodes[a]->setValue(0);
}
}
void ModularNetwork::updateFixedIterations(int iterations)
{
int count=iterations;
if (!activated)
{
//count += 19; //run 19 extra times.
//This should hopefully get everything
//up to date on the first run
count += Globals::getSingleton()->getExtraActivationUpdates();
activated=true;
}
for (int a=0;a<count;a++)
{
for (int a=0;a<(int)nodes.size();a++)
{
nodes[a]->computeNewValue();
}
//cout_ << "Done computing values. Updating...\n";
for (int a=0;a<(int)nodes.size();a++)
{
nodes[a]->updateValue();
}
//cout_ << "Done updating values.\n";
}
}
}
| 23.784689
| 102
| 0.477369
|
GiorgosMethe
|
f4c52cda1cc51706b3cba3fa3f83c7bc963a6093
| 2,901
|
cpp
|
C++
|
games/XenDemo/Column.cpp
|
odayibasi/swengine
|
ef07b7c9125d01596837a423a9f3dcbced1f5aa7
|
[
"Zlib",
"MIT"
] | 3
|
2021-03-01T20:41:13.000Z
|
2021-07-10T13:45:47.000Z
|
games/XenDemo/Column.cpp
|
odayibasi/swengine
|
ef07b7c9125d01596837a423a9f3dcbced1f5aa7
|
[
"Zlib",
"MIT"
] | null | null | null |
games/XenDemo/Column.cpp
|
odayibasi/swengine
|
ef07b7c9125d01596837a423a9f3dcbced1f5aa7
|
[
"Zlib",
"MIT"
] | null | null | null |
#include "../../include/SWEngine.h"
typedef struct xenColumnPart{
int dispID;
swRect target;
swRect *source;
};
int iLayerColumnPart=8;
bool bVisibleColumnPart=true;
extern int columnPartID;
extern int columnBlockID;
swRect halfColumnSource={0,0,1,0.5};
//-------------------------------------------------------------------------------------------
void displayColumnPart(void *obj){
xenColumnPart *wall=(xenColumnPart *)obj;
swGraphicsSetBlendingMode(SW_BLENDING_MODE_SOLID);
//DrawImage
swGraphicsSetColor1(&SWCOLOR_WHITE);
swGraphicsRenderImg2(columnPartID,&wall->target,wall->source);
}
//-------------------------------------------------------------------------------------------
void destroyColumnPart(void *obj){
xenColumnPart *cPart=(xenColumnPart *)obj;
swDispManagerDel(cPart->dispID);
free(cPart);
}
//-------------------------------------------------------------------------------------------
void displayColumnBlock(void *obj){
xenColumnPart *wall=(xenColumnPart *)obj;
swGraphicsSetBlendingMode(SW_BLENDING_MODE_SOLID);
swGraphicsSetColor1(&SWCOLOR_WHITE);
swGraphicsRenderImg2(columnBlockID,&wall->target,wall->source);
}
//-------------------------------------------------------------------------------------------
void destroyColumnBlock(void *obj){
xenColumnPart *cPart=(xenColumnPart *)obj;
swDispManagerDel(cPart->dispID);
free(cPart);
}
//-------------------------------------------------------------------------------------------
void columnPartSet(xenColumnPart *wall, float x,float y,float w, float h,swRect *source){
swRectSet(&wall->target,x,y,w,h);
wall->source=source;
wall->dispID=swDispManagerAdd(displayColumnPart,wall,&bVisibleColumnPart,&wall->target,&iLayerColumnPart);
swDestroyManagerAdd(destroyColumnPart,wall);
}
//-------------------------------------------------------------------------------------------
void columnBlockSet(xenColumnPart *wall, float x,float y,swRect *source){
swRectSet(&wall->target,x,y,64,44);
wall->source=source;
wall->dispID=swDispManagerAdd(displayColumnBlock,wall,&bVisibleColumnPart,&wall->target,&iLayerColumnPart);
swDestroyManagerAdd(destroyColumnBlock,wall);
}
//-------------------------------------------------------------------------------------------
void columnPartCreate(float x,float y,int count){
for(int i=0;i<count;i++){
xenColumnPart *wall=(xenColumnPart *)malloc(sizeof(xenColumnPart));
columnPartSet(wall,x,y+64*i,64,64,&SW_SPRITE_SOURCE_DEFAULT);
}
xenColumnPart *wall=(xenColumnPart *)malloc(sizeof(xenColumnPart));
columnPartSet(wall,x,y+64*count,64,32,&halfColumnSource);
xenColumnPart *wallBottom=(xenColumnPart *)malloc(sizeof(xenColumnPart));
columnBlockSet(wallBottom,x,y,&SW_SPRITE_SOURCE_MIRRORXY);
xenColumnPart *wallTop=(xenColumnPart *)malloc(sizeof(xenColumnPart));
columnBlockSet(wallTop,x,y+64*(count)-42,&SW_SPRITE_SOURCE_DEFAULT);
}
| 31.879121
| 108
| 0.60324
|
odayibasi
|
f4c542c90d82a345a64a34812e1ff732da076ba6
| 553
|
cpp
|
C++
|
source/data/map/RadiationTrigger.cpp
|
atkurtul/RadixEngine
|
0eb1c176a25aa9430f54d5a20ce5749360c51381
|
[
"Zlib"
] | 163
|
2016-08-28T23:24:05.000Z
|
2022-03-31T04:51:51.000Z
|
source/data/map/RadiationTrigger.cpp
|
atkurtul/RadixEngine
|
0eb1c176a25aa9430f54d5a20ce5749360c51381
|
[
"Zlib"
] | 144
|
2016-09-10T08:40:06.000Z
|
2020-12-03T17:20:03.000Z
|
source/data/map/RadiationTrigger.cpp
|
atkurtul/RadixEngine
|
0eb1c176a25aa9430f54d5a20ce5749360c51381
|
[
"Zlib"
] | 88
|
2016-02-22T08:34:49.000Z
|
2022-03-05T12:29:19.000Z
|
#include <radix/data/map/RadiationTrigger.hpp>
#include <radix/entities/Player.hpp>
#include <radix/entities/Trigger.hpp>
#include <radix/core/state/GameStateManager.hpp>
#include <radix/World.hpp>
using namespace std;
namespace radix {
const std::string RadiationTrigger::TYPE = "radiation";
void RadiationTrigger::addAction(Entity &ent) {
entities::Trigger &trigger = dynamic_cast<entities::Trigger&>(ent);
trigger.setActionOnUpdate([] (entities::Trigger &trigger) {
trigger.world.getPlayer().harm(0.1f);
});
}
} /* namespace radix */
| 25.136364
| 69
| 0.739602
|
atkurtul
|
f4c798bd11750c119e37bf1c011a358b8b96c268
| 8,162
|
cpp
|
C++
|
WrecklessEngine/D3D11RenderContext.cpp
|
ThreadedStream/WrecklessEngine
|
735ac601914c2445b8eef72a14ec0fcd4d0d12d2
|
[
"MIT"
] | 9
|
2021-02-07T21:33:41.000Z
|
2022-03-20T18:48:06.000Z
|
WrecklessEngine/D3D11RenderContext.cpp
|
ThreadedStream/WrecklessEngine
|
735ac601914c2445b8eef72a14ec0fcd4d0d12d2
|
[
"MIT"
] | null | null | null |
WrecklessEngine/D3D11RenderContext.cpp
|
ThreadedStream/WrecklessEngine
|
735ac601914c2445b8eef72a14ec0fcd4d0d12d2
|
[
"MIT"
] | 4
|
2021-02-11T15:05:35.000Z
|
2022-02-20T15:26:35.000Z
|
#include "D3D11RenderContext.h"
namespace Graphics
{
D3D11RenderContext::D3D11RenderContext(Microsoft::WRL::ComPtr<ID3D11DeviceContext> pDeviceContext)
: m_pDeviceContext(pDeviceContext)
{
}
void D3D11RenderContext::SetOutputTarget(Ref<IRenderTarget> render_target, Ref<IDepthStencilView> depth_stencil)
{
ID3D11RenderTargetView* rtv = nullptr;
if (render_target != nullptr)
{
rtv = reinterpret_cast<ID3D11RenderTargetView*>(render_target->GetNativePointer());
}
m_pDeviceContext->OMSetRenderTargets(1, &rtv, reinterpret_cast<ID3D11DepthStencilView*>(depth_stencil->GetNativePointer()));
}
void D3D11RenderContext::SetOutputRenderTarget(Ref<IRenderTarget> render_target)
{
ID3D11RenderTargetView* _rtv = reinterpret_cast<ID3D11RenderTargetView*>(render_target->GetNativePointer());
m_pDeviceContext->OMSetRenderTargets(1, &_rtv, nullptr);
}
void D3D11RenderContext::SetOutputTargets(std::vector<Ref<IRenderTarget>> render_targets, Ref<IDepthStencilView> depth_stencil)
{
std::vector<ID3D11RenderTargetView*> rtvs;
for (auto& rt : render_targets)
rtvs.push_back(reinterpret_cast<ID3D11RenderTargetView*>(rt->GetNativePointer()));
m_pDeviceContext->OMSetRenderTargets(rtvs.size(), rtvs.data(), reinterpret_cast<ID3D11DepthStencilView*>(depth_stencil->GetNativePointer()));
}
void D3D11RenderContext::ClearRenderTarget(Ref<IRenderTarget> render_target, float* color)
{
m_pDeviceContext->ClearRenderTargetView(reinterpret_cast<ID3D11RenderTargetView*>(render_target->GetNativePointer()), color);
}
void D3D11RenderContext::ClearDepthStencilView(Ref<IDepthStencilView> depth_stencil, float depth, UINT stencil)
{
m_pDeviceContext->ClearDepthStencilView(reinterpret_cast<ID3D11DepthStencilView*>(depth_stencil->GetNativePointer()), D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, depth, stencil);
}
void D3D11RenderContext::BindVertexShader(Ref<IVertexShader> vertex_shader)
{
if (vertex_shader != nullptr)
m_pDeviceContext->VSSetShader(reinterpret_cast<ID3D11VertexShader*>(vertex_shader->GetNativePointer()), nullptr, 0);
else
m_pDeviceContext->VSSetShader(nullptr, nullptr, 0);
}
void D3D11RenderContext::BindHullShader(Ref<IHullShader> hull_shader)
{
if(hull_shader != nullptr)
m_pDeviceContext->HSSetShader(reinterpret_cast<ID3D11HullShader*>(hull_shader->GetNativePointer()), nullptr, 0);
else
m_pDeviceContext->HSSetShader(nullptr, nullptr, 0);
}
void D3D11RenderContext::BindDomainShader(Ref<IDomainShader> domain_shader)
{
if(domain_shader != nullptr)
m_pDeviceContext->DSSetShader(reinterpret_cast<ID3D11DomainShader*>(domain_shader->GetNativePointer()), nullptr, 0);
else
m_pDeviceContext->DSSetShader(nullptr, nullptr, 0);
}
void D3D11RenderContext::BindPixelShader(Ref<IPixelShader> pixel_shader)
{
if(pixel_shader != nullptr)
m_pDeviceContext->PSSetShader(reinterpret_cast<ID3D11PixelShader*>(pixel_shader->GetNativePointer()), nullptr, 0);
else
m_pDeviceContext->PSSetShader(nullptr, nullptr, 0);
}
void D3D11RenderContext::BindViewport(Viewport viewport)
{
D3D11_VIEWPORT vp = {};
vp.Width = viewport.Width;
vp.Height = viewport.Height;
vp.MinDepth = viewport.MinDepth;
vp.MaxDepth = viewport.MaxDepth;
vp.TopLeftX = viewport.TopLeftX;
vp.TopLeftY = viewport.TopLeftY;
m_pDeviceContext->RSSetViewports(1, &vp);
}
void D3D11RenderContext::BindVertexBuffer(Ref<IVertexBuffer> vertex_buffer, unsigned strides, unsigned offsets)
{
ID3D11Buffer* _vertexBuffer = reinterpret_cast<ID3D11Buffer*>(vertex_buffer->GetNativePointer());
m_pDeviceContext->IASetVertexBuffers(0, 1, &_vertexBuffer, &strides, &offsets);
}
void D3D11RenderContext::BindIndexBuffer(Ref<IIndexBuffer> index_buffer, unsigned offset)
{
ID3D11Buffer* _indexBuffer = reinterpret_cast<ID3D11Buffer*>(index_buffer->GetNativePointer());
m_pDeviceContext->IASetIndexBuffer(_indexBuffer, DXGI_FORMAT_R32_UINT, offset);
}
void D3D11RenderContext::BindConstantBuffer(Ref<IConstantBuffer> constant_buffer, SHADER_TYPE stage, int slot)
{
ID3D11Buffer* _constantBuffer = reinterpret_cast<ID3D11Buffer*>(constant_buffer->GetNativePointer());
switch (stage)
{
case SHADER_TYPE::Vertex:
m_pDeviceContext->VSSetConstantBuffers(slot, 1, &_constantBuffer);
break;
case SHADER_TYPE::Hull:
m_pDeviceContext->HSSetConstantBuffers(slot, 1, &_constantBuffer);
break;
case SHADER_TYPE::Domain:
m_pDeviceContext->DSSetConstantBuffers(slot, 1, &_constantBuffer);
break;
case SHADER_TYPE::Geometry:
m_pDeviceContext->GSSetConstantBuffers(slot, 1, &_constantBuffer);
break;
case SHADER_TYPE::Pixel:
m_pDeviceContext->PSSetConstantBuffers(slot, 1, &_constantBuffer);
break;
case SHADER_TYPE::Compute:
m_pDeviceContext->CSSetConstantBuffers(slot, 1, &_constantBuffer);
break;
}
}
void D3D11RenderContext::BindInputLayout(Ref<IInputLayout> input_layout)
{
ID3D11InputLayout* _pInputLayout = reinterpret_cast<ID3D11InputLayout*>(input_layout->GetNativePointer());
m_pDeviceContext->IASetInputLayout(_pInputLayout);
}
void D3D11RenderContext::BindSamplerState(Ref<ISamplerState> sampler_state, unsigned slot)
{
ID3D11SamplerState* _pSamplerState = reinterpret_cast<ID3D11SamplerState*>(sampler_state->GetNativePointer());
m_pDeviceContext->PSSetSamplers(slot, 1, &_pSamplerState);
}
void D3D11RenderContext::BindRasterizerState(Ref<IRasterizer> rasterizer_state)
{
ID3D11RasterizerState* _pRasterizerState = reinterpret_cast<ID3D11RasterizerState*>(rasterizer_state->GetNativePointer());
m_pDeviceContext->RSSetState(_pRasterizerState);
}
void D3D11RenderContext::BindDepthStencilState(Ref<IDepthStencilState> depth_stencil_state)
{
ID3D11DepthStencilState* _pDepthStencilState = reinterpret_cast<ID3D11DepthStencilState*>(depth_stencil_state->GetNativePointer());
m_pDeviceContext->OMSetDepthStencilState(_pDepthStencilState, 0);
}
void D3D11RenderContext::BindTopology(PRIMITIVE_TOPOLOGY topology)
{
m_pDeviceContext->IASetPrimitiveTopology((D3D11_PRIMITIVE_TOPOLOGY)topology);
}
void D3D11RenderContext::BindTexture2D(Ref<ITexture> texture, SHADER_TYPE stage, unsigned slot)
{
ID3D11ShaderResourceView* _pSrv = reinterpret_cast<ID3D11ShaderResourceView*>(texture->GetNativePointer());
switch (stage)
{
case SHADER_TYPE::Vertex:
m_pDeviceContext->VSSetShaderResources(slot, 1, &_pSrv);
break;
case SHADER_TYPE::Hull:
m_pDeviceContext->HSSetShaderResources(slot, 1, &_pSrv);
break;
case SHADER_TYPE::Domain:
m_pDeviceContext->DSSetShaderResources(slot, 1, &_pSrv);
break;
case SHADER_TYPE::Geometry:
m_pDeviceContext->GSSetShaderResources(slot, 1, &_pSrv);
break;
case SHADER_TYPE::Pixel:
m_pDeviceContext->PSSetShaderResources(slot, 1, &_pSrv);
break;
case SHADER_TYPE::Compute:
m_pDeviceContext->CSSetShaderResources(slot, 1, &_pSrv);
break;
}
}
void D3D11RenderContext::MapDataToBuffer(Ref<IBuffer> buffer, const void* data, unsigned size)
{
ID3D11Buffer* _pBuffer = reinterpret_cast<ID3D11Buffer*>(buffer->GetNativePointer());
D3D11_MAPPED_SUBRESOURCE _mapData = {};
WRECK_HR(m_pDeviceContext->Map(_pBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &_mapData));
memcpy(_mapData.pData, data, size);
m_pDeviceContext->Unmap(_pBuffer, 0);
}
void D3D11RenderContext::LoadDataFromBuffer(Ref<IBuffer> buffer, void* outputBuffer, unsigned size)
{
ID3D11Buffer* _pBuffer = reinterpret_cast<ID3D11Buffer*>(buffer->GetNativePointer());
D3D11_MAPPED_SUBRESOURCE _mapData = {};
WRECK_HR(m_pDeviceContext->Map(_pBuffer, 0, D3D11_MAP_READ, 0, &_mapData));
memcpy(outputBuffer, _mapData.pData, size);
m_pDeviceContext->Unmap(_pBuffer, 0);
}
void D3D11RenderContext::Draw(unsigned vertex_count, unsigned start_vertex_location)
{
m_pDeviceContext->Draw(vertex_count, start_vertex_location);
}
void D3D11RenderContext::DrawIndexed(unsigned index_count, unsigned start_index_location, unsigned base_vertex_location)
{
m_pDeviceContext->DrawIndexed(index_count, start_index_location, base_vertex_location);
}
void* D3D11RenderContext::GetNativePointer() const
{
return m_pDeviceContext.Get();
}
}
| 41.015075
| 177
| 0.789757
|
ThreadedStream
|
f4cbb3658830a07c9e9ce531a648b34b36d47428
| 1,592
|
hh
|
C++
|
cxx/satellite/include/PhysList.hh
|
Zelenyy/phd-code
|
d5b8bfefd2418a915dde89f7da2cb6683f438556
|
[
"MIT"
] | null | null | null |
cxx/satellite/include/PhysList.hh
|
Zelenyy/phd-code
|
d5b8bfefd2418a915dde89f7da2cb6683f438556
|
[
"MIT"
] | null | null | null |
cxx/satellite/include/PhysList.hh
|
Zelenyy/phd-code
|
d5b8bfefd2418a915dde89f7da2cb6683f438556
|
[
"MIT"
] | null | null | null |
//
// Created by zelenyy on 18.05.2021.
//
#ifndef PHD_CODE_PHYSLIST_HH
#define PHD_CODE_PHYSLIST_HH
#include <CLHEP/Units/SystemOfUnits.h>
#include "globals.hh"
#include "G4ios.hh"
#include "G4ProcessManager.hh"
#include "G4ProcessVector.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4DecayPhysics.hh"
#include "G4EmStandardPhysics_option4.hh"
#include "G4EmExtraPhysics.hh"
#include "G4IonPhysics.hh"
#include "G4StoppingPhysics.hh"
#include "G4HadronElasticPhysics.hh"
#include "G4NeutronTrackingCut.hh"
#include "QGSP_BERT.hh"
#include "G4HadronPhysicsQGSP_BERT.hh"
class PhysList: public G4VModularPhysicsList{
public:
PhysList(){
int ver = 0;
defaultCutValue = 0.7*CLHEP::mm;
SetVerboseLevel(ver);
// EM Physics
RegisterPhysics( new G4EmStandardPhysics_option4(ver) );
// Synchroton Radiation & GN Physics
RegisterPhysics( new G4EmExtraPhysics(ver) );
// Decays
RegisterPhysics( new G4DecayPhysics(ver) );
// Hadron Elastic scattering
RegisterPhysics( new G4HadronElasticPhysics(ver) );
// Hadron Physics
RegisterPhysics( new G4HadronPhysicsQGSP_BERT(ver));
// Stopping Physics
RegisterPhysics( new G4StoppingPhysics(ver) );
// Ion Physics
RegisterPhysics( new G4IonPhysics(ver));
// Neutron tracking cut
RegisterPhysics( new G4NeutronTrackingCut(ver));
};
~PhysList() override = default;
};
#endif //PHD_CODE_PHYSLIST_HH
| 24.492308
| 64
| 0.699749
|
Zelenyy
|
f4cc19649fa414e3581930122861545c4d530d6c
| 1,068
|
cpp
|
C++
|
09.Manipulation/06.insert.cpp
|
ClaudioDaffra/emjq
|
c3e6083be1238c23a2e15a63e402659af34b2dfe
|
[
"MIT"
] | 1
|
2018-03-03T18:07:57.000Z
|
2018-03-03T18:07:57.000Z
|
09.Manipulation/06.insert.cpp
|
ClaudioDaffra/emjq
|
c3e6083be1238c23a2e15a63e402659af34b2dfe
|
[
"MIT"
] | null | null | null |
09.Manipulation/06.insert.cpp
|
ClaudioDaffra/emjq
|
c3e6083be1238c23a2e15a63e402659af34b2dfe
|
[
"MIT"
] | null | null | null |
#include "../lib/emjQuery.hpp"
// emcc -O3 06.insert.cpp -o main.js -std=c++11 -s NO_EXIT_RUNTIME=1 -s EMULATE_FUNCTION_POINTER_CASTS=1 -s AGGRESSIVE_VARIABLE_ELIMINATION=1
int main( void )
{
$( "<p>XYZ</p>" ).insertAfter( _('.inner') ).insertBefore( _('.inner') );
type::pointer p = $.pointerNew ( "jQuery.cssNumber" ) ;
std::cout << $(p).pointer("[0].zIndex") << "\n";
std::cout << $(p).pointer("[0].fontWeight") << "\n";
std::cout << $(p).pointer("[0].opacity") << "\n";
std::cout << $(p).pointer("[0].zoom") << "\n";
std::cout << $(p).pointer("[0].lineHeight") << "\n";
std::cout << $(p).pointer("[0].widows") << "\n";
std::cout << $(p).pointer("[0].orphans") << "\n";
std::cout << $(p).pointer("[0].fillOpacity") << "\n";
std::cout << $(p).pointer("[0].columnCount") << "\n";
std::cout << $(p).pointer("[0].order") << "\n";
std::cout << $(p).pointer("[0].flexGrow") << "\n";
std::cout << $(p).pointer("[0].flexShrink") << "\n";
return 0 ;
}
| 23.733333
| 143
| 0.493446
|
ClaudioDaffra
|
f4ddd227c4c864d57f88c138871ddb4b8bda5b31
| 1,294
|
hpp
|
C++
|
raytracer/Mesh.hpp
|
kevin-ye/raytracer
|
246e986f7c71cd31ce988b61e54ac9b27cede076
|
[
"MIT"
] | null | null | null |
raytracer/Mesh.hpp
|
kevin-ye/raytracer
|
246e986f7c71cd31ce988b61e54ac9b27cede076
|
[
"MIT"
] | null | null | null |
raytracer/Mesh.hpp
|
kevin-ye/raytracer
|
246e986f7c71cd31ce988b61e54ac9b27cede076
|
[
"MIT"
] | null | null | null |
#pragma once
#include <vector>
#include <iosfwd>
#include <string>
#include <glm/glm.hpp>
#include "Primitive.hpp"
#include "IntersectedPrimitiveInfo.hpp"
struct Triangle
{
size_t v1;
size_t v2;
size_t v3;
Triangle( size_t pv1, size_t pv2, size_t pv3 )
: v1( pv1 )
, v2( pv2 )
, v3( pv3 )
{}
};
// A polygonal mesh.
class Mesh : public Primitive {
glm::mat4 trans;
glm::mat4 transNoScale;
std::vector<glm::vec3> m_vertices;
std::vector<Triangle> m_faces;
glm::vec3 collisionMech_center;
double collisionMech_radius;
friend std::ostream& operator<<(std::ostream& out, const Mesh& mesh);
double maxdouble(double d1, double d2);
float square(float s);
bool collisionDetection(class Tray *theRay, glm::vec4 &inormalV, double &t, IntersectedPrimitiveInfo &info);
bool bound;
public:
Mesh( const std::string& fname );
bool intersect(class Tray *theRay, glm::vec4 &inormalV, double &t, IntersectedPrimitiveInfo &info);
void setTrans(glm::mat4 trans);
void setTransNoScale(glm::mat4 transNoScale);
void getBound(glm::mat4 ptrans, glm::mat4 ptransNoScale, glm::vec3 ¢er, double &boundRadius);
PrimitiveType getType();
void drawBound();
void drawMesh();
};
| 22.701754
| 114
| 0.665379
|
kevin-ye
|
f4e937a51d426dcd6c9c13c0a1cd449a358d7ca3
| 1,114
|
hpp
|
C++
|
src/BayesObservation.hpp
|
Nolnocn/Bayesian-Inference
|
76ee29171c6e3a4a69b752c1f68ae3fef2526f92
|
[
"MIT"
] | 1
|
2021-07-07T02:45:55.000Z
|
2021-07-07T02:45:55.000Z
|
src/BayesObservation.hpp
|
Nolnocn/Bayes-Classifier
|
76ee29171c6e3a4a69b752c1f68ae3fef2526f92
|
[
"MIT"
] | null | null | null |
src/BayesObservation.hpp
|
Nolnocn/Bayes-Classifier
|
76ee29171c6e3a4a69b752c1f68ae3fef2526f92
|
[
"MIT"
] | null | null | null |
#ifndef BayesObservation_hpp
#define BayesObservation_hpp
#include <vector>
#include "BayesOutcomeDefs.h"
namespace Bayes
{
/*
* Data container class for values of each condition of a BayesDecider
* Used to keep track of data for a decision and store result in decider
*/
class BayesObservation
{
public:
BayesObservation( uint32_t numContinuous, uint32_t numDiscrete );
// Accessors for data members
const std::vector<float>& getContinuousValues() const { return m_continuousValues; };
const std::vector<int>& getDiscreteValues() const { return m_discreteValues; };
OutcomeType getOutcome() const { return m_outcome; };
// Setters for data members
void setContinuousCondition( uint32_t conditionIndex, float value );
void setDiscreteCondition( uint32_t conditionIndex, int value );
void setOutcome( OutcomeType outcome );
// Prints formatted member data to the console
void printData() const;
private:
// Data members
std::vector<float> m_continuousValues;
std::vector<int> m_discreteValues;
OutcomeType m_outcome;
};
}
#endif /* BayesObservation_hpp */
| 26.52381
| 87
| 0.748654
|
Nolnocn
|
f4ecfb8fb44c607dd59bc472156cbe7c79a5d4ff
| 1,896
|
cpp
|
C++
|
leetcode/341. Flatten Nested List Iterator/s1.cpp
|
contacttoakhil/LeetCode-1
|
9bb9b5aa9ace836b86a752eb796b3dfcb21ee44c
|
[
"Fair"
] | 1
|
2021-02-09T11:38:51.000Z
|
2021-02-09T11:38:51.000Z
|
leetcode/341. Flatten Nested List Iterator/s1.cpp
|
contacttoakhil/LeetCode-1
|
9bb9b5aa9ace836b86a752eb796b3dfcb21ee44c
|
[
"Fair"
] | null | null | null |
leetcode/341. Flatten Nested List Iterator/s1.cpp
|
contacttoakhil/LeetCode-1
|
9bb9b5aa9ace836b86a752eb796b3dfcb21ee44c
|
[
"Fair"
] | null | null | null |
/**
* // This is the interface that allows for creating nested lists.
* // You should not implement it, or speculate about its implementation
* class NestedInteger {
* public:
* // Return true if this NestedInteger holds a single integer, rather than a nested list.
* bool isInteger() const;
*
* // Return the single integer that this NestedInteger holds, if it holds a single integer
* // The result is undefined if this NestedInteger holds a nested list
* int getInteger() const;
*
* // Return the nested list that this NestedInteger holds, if it holds a nested list
* // The result is undefined if this NestedInteger holds a single integer
* const vector<NestedInteger> &getList() const;
* };
*/
class NestedIterator {
private:
stack<pair<vector<NestedInteger>::iterator, vector<NestedInteger>::iterator>> s; // current, end
void validate () {
while (!s.empty()) {
auto &p = s.top();
auto &it = p.first, &end = p.second;
if (it == end) {
s.pop();
} else if (it->isInteger()) break;
else {
auto &list = it->getList();
s.top().first++;
s.push(make_pair(list.begin(), list.end()));
}
}
}
public:
NestedIterator(vector<NestedInteger> &nestedList) {
s.push(make_pair(nestedList.begin(), nestedList.end()));
validate();
}
int next() {
if (!hasNext()) return 0;
auto &p = s.top();
auto &cur = p.first, &end = p.second;
int ans = cur->getInteger();
++cur;
validate();
return ans;
}
bool hasNext() {
return !s.empty();
}
};
/**
* Your NestedIterator object will be instantiated and called as such:
* NestedIterator i(nestedList);
* while (i.hasNext()) cout << i.next();
*/
| 31.081967
| 100
| 0.573312
|
contacttoakhil
|
f4ed9900f04bd6b7cc935e8e2ca27ea1dc88bb00
| 3,265
|
hpp
|
C++
|
hlsplaylist.hpp
|
samkusin/HLSLibrary
|
45f80ddc9cc7a135bde8321cbc97810825091c77
|
[
"0BSD"
] | 7
|
2018-03-10T21:51:35.000Z
|
2021-09-09T15:41:12.000Z
|
hlsplaylist.hpp
|
samkusin/HLSLibrary
|
45f80ddc9cc7a135bde8321cbc97810825091c77
|
[
"0BSD"
] | 1
|
2019-03-03T18:32:33.000Z
|
2019-03-03T18:32:33.000Z
|
hlsplaylist.hpp
|
samkusin/HLSLibrary
|
45f80ddc9cc7a135bde8321cbc97810825091c77
|
[
"0BSD"
] | 5
|
2016-03-12T22:13:01.000Z
|
2021-02-28T15:51:16.000Z
|
/**
* @file hlsplaylist.hpp
* @brief Parsers and containers for HLS playlists.
*
* @copyright Copyright 2015 Samir Sinha. All rights reserved.
* @license This project is released under the ISC license. See LICENSE
* for the full text.
*/
#ifndef CINEK_AVLIB_HLSPLAYLIST_HPP
#define CINEK_AVLIB_HLSPLAYLIST_HPP
#include "avstream.hpp"
#include <array>
#include <vector>
#include <string>
namespace cinekav {
namespace mpegts {
class ElementaryStream;
}
}
namespace cinekav {
class HLSPlaylistParser;
class HLSPlaylist
{
public:
struct Segment
{
std::string uri;
float duration;
Segment() = default;
Segment(Segment&& other) :
uri(std::move(other.uri)),
duration(other.duration)
{
other.duration = 0.f;
}
Segment& operator=(Segment&& other)
{
uri = std::move(other.uri);
duration = other.duration;
other.duration = 0.f;
return *this;
}
};
HLSPlaylist();
HLSPlaylist(const std::string& uri, const Memory& memory=Memory());
HLSPlaylist(HLSPlaylist&& other);
HLSPlaylist& operator=(HLSPlaylist&& other);
void addSegment(Segment&& segment);
int segmentCount() const { return _segments.size(); }
Segment* segmentAt(int index);
const Segment* segmentAt(int index) const;
const std::string& uri() const { return _uri; }
private:
friend class HLSPlaylistParser;
std::string _uri;
int _seqNo;
float _targetDuration;
int _version;
std::vector<Segment, std_allocator<Segment>> _segments;
};
class HLSPlaylistParser
{
public:
HLSPlaylistParser();
bool parse(HLSPlaylist& playlist, const std::string& line);
private:
enum { kInit, kInputLine, kPlaylistLine } _state;
HLSPlaylist::Segment _info;
};
class HLSMasterPlaylistParser;
class HLSMasterPlaylist
{
public:
struct PlaylistInfo
{
uint32_t frameWidth = 0;
uint32_t frameHeight = 0;
uint32_t bandwidth = 0;
std::array<uint32_t, 4> codecs; // more?
bool available = false;
};
struct StreamInfo
{
PlaylistInfo info;
HLSPlaylist playlist;
};
using Playlists = std::vector<StreamInfo, std_allocator<StreamInfo>>;
HLSMasterPlaylist(const Memory& memory=Memory());
StreamInfo* addStream(const PlaylistInfo& info, const std::string& uri);
Playlists::const_iterator begin() const {
return _playlists.begin();
}
Playlists::const_iterator end() const {
return _playlists.end();
}
Playlists::iterator begin() {
return _playlists.begin();
}
Playlists::iterator end() {
return _playlists.end();
}
private:
friend class HLSMasterPlaylistParser;
Memory _memory;
Playlists _playlists;
};
class HLSMasterPlaylistParser
{
public:
HLSMasterPlaylistParser();
bool parse(HLSMasterPlaylist& playlist, const std::string& line);
private:
void parseCodecs(const std::string& line);
enum { kInit, kInputLine, kPlaylistLine } _state;
HLSMasterPlaylist::PlaylistInfo _info;
int _version;
};
} /* namespace cinekav */
#endif
| 21.912752
| 76
| 0.640735
|
samkusin
|
f4ee5e5f8247782d713c30c1a8b406312f860cd2
| 2,315
|
cpp
|
C++
|
modules/task_1/groshev_n_vec_close_values/vector_close_values.cpp
|
Stepakrap/pp_2021_autumn
|
716803a14183172337d51712fb28fe8e86891a3d
|
[
"BSD-3-Clause"
] | 1
|
2021-12-09T17:20:25.000Z
|
2021-12-09T17:20:25.000Z
|
modules/task_1/groshev_n_vec_close_values/vector_close_values.cpp
|
Stepakrap/pp_2021_autumn
|
716803a14183172337d51712fb28fe8e86891a3d
|
[
"BSD-3-Clause"
] | null | null | null |
modules/task_1/groshev_n_vec_close_values/vector_close_values.cpp
|
Stepakrap/pp_2021_autumn
|
716803a14183172337d51712fb28fe8e86891a3d
|
[
"BSD-3-Clause"
] | 3
|
2022-02-23T14:20:50.000Z
|
2022-03-30T09:00:02.000Z
|
// Copyright 2021 Groshev Nickolay
#include <mpi.h>
#include <random>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include "../../../modules/task_1/groshev_n_vec_close_values/vector_close_values.h"
std::vector<int> getRandomVector(int vecSize) {
std::random_device stage;
std::vector<int> Vec(vecSize);
std::mt19937 load(stage());
for (int i = 0; i < vecSize; i++) {
Vec[i] = load() % 100;
}
return Vec;
}
int getMinDiffByOneProc(std::vector <int> vector) {
int minDiff = INT_MAX;
if ((vector.size() == 1) || (vector.size() == 0)) {
return 0;
} else {
for (int i = 0; i < static_cast<int>(vector.size() - 1); i++) {
if (minDiff > abs(vector[i] - vector[i + 1]))
minDiff = abs(vector[i] - vector[i + 1]);
}
}
return minDiff;
}
int getMinDiffParallel(std::vector <int> someVector) {
int minDiff = INT_MAX;
int size, rank;
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Status status;
int bufSize = someVector.size() - 1;
int elForProc = bufSize / size;
int ost = bufSize % size;
if (rank == 0) {
if (elForProc > 0) {
for (int procNum = 1; procNum < size; procNum++)
MPI_Send(&someVector[ost] + elForProc * procNum,
elForProc + 1, MPI_INT, procNum, 0, MPI_COMM_WORLD);
}
} else {
if (elForProc > 0) {
std::vector<int> tmpVec(elForProc + 1);
MPI_Recv(&tmpVec[0], elForProc + 1, MPI_INT,
0, MPI_ANY_TAG, MPI_COMM_WORLD, &status);
int tmpMinDiff = getMinDiffByOneProc(tmpVec);
MPI_Send(&tmpMinDiff, 1, MPI_INT, 0, 0, MPI_COMM_WORLD);
}
}
if (rank == 0) {
int tmpMinDiff;
std::vector<int> tmpVec(someVector.begin(), someVector.begin() + 1 + elForProc + ost);
minDiff = getMinDiffByOneProc(tmpVec);
if (elForProc > 0) {
for (int procNum = 1; procNum < size; procNum++) {
MPI_Recv(&tmpMinDiff, 1, MPI_INT,
procNum, 0, MPI_COMM_WORLD, &status);
if (minDiff > tmpMinDiff)
minDiff = tmpMinDiff;
}
}
}
return minDiff;
}
| 30.866667
| 94
| 0.557235
|
Stepakrap
|
f4f3c84edd8383ca552104871b1a495402a9198c
| 474
|
cpp
|
C++
|
DepthFirstSearch/DepthFirstSearch/Constants.cpp
|
gabrieltavares0123/AlgorithmDesignAndAnalysis
|
8c19772f0e6805812e4be74f7276637112c9b444
|
[
"Apache-2.0"
] | null | null | null |
DepthFirstSearch/DepthFirstSearch/Constants.cpp
|
gabrieltavares0123/AlgorithmDesignAndAnalysis
|
8c19772f0e6805812e4be74f7276637112c9b444
|
[
"Apache-2.0"
] | null | null | null |
DepthFirstSearch/DepthFirstSearch/Constants.cpp
|
gabrieltavares0123/AlgorithmDesignAndAnalysis
|
8c19772f0e6805812e4be74f7276637112c9b444
|
[
"Apache-2.0"
] | null | null | null |
// Nodes.
int const Oradea = 0;
int const Zerind = 1;
int const Arad = 2;
int const Timisoara = 3;
int const Lugoj = 4;
int const Mehadia = 5;
int const Drobeta = 6;
int const Craiova = 7;
int const RimnicuVilcea = 8;
int const Sibiu = 9;
int const Fagaras = 10;
int const Pitesti = 11;
int const Giurgiu = 12;
int const Bucharest = 13;
int const Eforie = 14;
int const Hirsova = 15;
int const Urziceni = 16;
int const Vaslui = 17;
int const Iasi = 18;
int const Neamt = 19;
| 22.571429
| 28
| 0.696203
|
gabrieltavares0123
|
7600995310f32ad69a9a68e594b4193b0e980fdc
| 629
|
cpp
|
C++
|
CodeForces/Practice/485A.cpp
|
coderanant/Competitive-Programming
|
45076af7894251080ac616c9581fbf2dc49604af
|
[
"MIT"
] | 4
|
2019-06-04T11:03:38.000Z
|
2020-06-19T23:37:32.000Z
|
CodeForces/Practice/485A.cpp
|
coderanant/Competitive-Programming
|
45076af7894251080ac616c9581fbf2dc49604af
|
[
"MIT"
] | null | null | null |
CodeForces/Practice/485A.cpp
|
coderanant/Competitive-Programming
|
45076af7894251080ac616c9581fbf2dc49604af
|
[
"MIT"
] | null | null | null |
/*coderanant*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define f1(i,a,b) for(int i=a;i<b;i++)
#define f2(i,a,b) for(int i=a;i>=b;i--)
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair
const int mod=1000000007;
ll temp;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int a, m;
cin>>a>>m;
f1(i,0,100001)
{
a+=(a%m);
a%=m;
if(a==0)
{
cout<<"Yes"<<endl;
return 0;
}
}
cout<<"No"<<endl;
return 0;
}
| 16.552632
| 39
| 0.540541
|
coderanant
|
76018b8a21539b74f3a182da83d97cb5832de763
| 8,845
|
cpp
|
C++
|
main.cpp
|
cookish/deeptile
|
159275b4d63286dd6ad08010a4e457ba9af9ae2d
|
[
"MIT"
] | null | null | null |
main.cpp
|
cookish/deeptile
|
159275b4d63286dd6ad08010a4e457ba9af9ae2d
|
[
"MIT"
] | 6
|
2018-12-04T22:33:59.000Z
|
2018-12-07T23:07:35.000Z
|
main.cpp
|
cookish/deeptile
|
159275b4d63286dd6ad08010a4e457ba9af9ae2d
|
[
"MIT"
] | null | null | null |
#include "BoardHandler.hh"
#include "ExpectiMax.hh"
#include "Utility.hh"
#include "HeuristicScorer.hh"
#include "MLScorer.hh"
#include "GameStats.hh"
#include "RunStats.hh"
#include "JsonStats.hh"
#include "Output.hh"
#include "Settings.hh"
#include <boost/filesystem.hpp>
#include <mutex>
#include <thread>
#include <iomanip>
#include <iostream>
using std::cout;
using std::endl;
#include <string>
using std::string;
#include <ctime>
using std::clock;
#include <chrono>
using std::chrono::steady_clock;
using std::make_unique;
using std::make_shared;
Board initBoard(Utility* utility);
unique_ptr<GameStats>
runGame(Board startBoard,
const Settings &settings,
const shared_ptr<Utility> &utility,
const shared_ptr<BoardHandler> &bh,
int threadNo,
int gameNo);
void runThread(vector<Board> &boards,
std::mutex &boardMutex,
vector<GameStats> &results,
std::mutex &resultMutex,
const Settings &settings,
const std::shared_ptr<Utility> &utility,
const std::shared_ptr<BoardHandler> &bh,
int threadNo);
int main() {
Settings settings("settings.ini");
boost::filesystem::remove_all(settings.prevGameLogDir);
if (boost::filesystem::exists(settings.gameLogDir)) {
boost::filesystem::rename(settings.gameLogDir, settings.prevGameLogDir);
}
auto bh = make_shared<BoardHandler>(make_unique<RowHandler>());
auto utility = make_shared<Utility>();
std::mutex boardMutex;
std::mutex resultMutex;
std::vector<std::thread> threads;
std::vector<Board> boards;
std::vector<GameStats> results;
threads.reserve(settings.num_games);
boards.reserve(settings.num_games);
results.reserve(settings.num_games);
{
std::lock_guard<std::mutex> lock(boardMutex);
for (int i = 0; i < settings.num_games; ++i) {
boards.emplace_back(initBoard(utility.get()));
}
}
for (int i = 0; i < settings.num_threads; ++i) {
threads.emplace_back(runThread, std::ref(boards), std::ref(boardMutex),
std::ref(results), std::ref(resultMutex),
std::ref(settings), std::ref(utility), std::ref(bh), i);
}
for (auto &thread : threads) {
thread.join();
}
auto overallTotal = 0.;
for (const auto &result : results) {
auto total = bh->getBoardTotal(result.finalBoard);
overallTotal += total;
cout << "Total: " << total << endl;
cout << Output::formatBoard(result.finalBoard);
}
cout << "Average total: " << overallTotal / settings.num_games << endl;
RunStats runStats(results);
auto js = JsonStats::create(runStats);
std::cout << js.dump(4) << std::endl;
runStats.printRateInfo();
cout << "Passing critical point: " << runStats.values["passedCriticalPoint"] << endl;
return 0;
}
void runThread(vector<Board> &boards,
std::mutex &boardMutex,
vector<GameStats> &results,
std::mutex &resultMutex,
const Settings &settings,
const std::shared_ptr<Utility> &utility,
const std::shared_ptr<BoardHandler> &bh,
int threadNo)
{
string name = string("Thread ") + std::to_string(threadNo);
while (true) {
int gameNumber;
Board board;
{
std::lock_guard<std::mutex> lock(boardMutex);
if (boards.empty()) {
return;
}
gameNumber = settings.num_games - boards.size();
board = boards.back();
boards.pop_back();
}
auto result = runGame(board, settings, utility, bh, threadNo, gameNumber);
{
std::lock_guard<std::mutex> lock(resultMutex);
results.emplace_back(*std::move(result));
cout << name << " completed game " << gameNumber
<< ", total: " << bh->getBoardTotal(result->finalBoard) << endl;
}
}
}
unique_ptr<GameStats>
runGame(Board startBoard,
const Settings &settings,
const shared_ptr<Utility> &utility,
const shared_ptr<BoardHandler> &bh,
int threadNo,
int gameNo)
{
string name = string("Thread ") + std::to_string(threadNo);
string dirname = settings.gameLogDir + "/game" + std::to_string(gameNo);
boost::filesystem::create_directories(dirname);
auto gameLogFile = std::ofstream((dirname + "/game_log.txt").c_str(), std::ios::out);
if (!gameLogFile) {
cout << "Warning: could not make file:" << dirname + "/game_log.txt" << endl;
}
bool passedCritialPoint = false;
auto board = startBoard;
auto utility2 = std::make_shared<Utility>();
auto dataLogger = std::make_shared<DataLogger>();
ExpectiMax em(bh,
utility2,
make_unique<HeuristicScorer>(bh, &settings),
// make_unique<MLScorer>(bh, &settings, settings.docker_start_port + threadNo),
make_unique<GameStats>(),
dataLogger,
&settings);
em.scoreForDeath = 0;
int move = 0;
double score = 0;
int i;
auto start = steady_clock::now();
// auto start = clock();
int totalEvals = 0;
auto verbosity = 1;
if (verbosity > 0) {
cout << "Starting game:" << gameNo << endl;
}
if (verbosity > 1) {
cout << "Starting board:" << endl;
cout << Output::formatBoard(board);
}
for (i = 0; true; ++i) {
dataLogger->logMove(bh->getPrincipalBoard(board));
int numEvals = 1;
int gens_now = settings.minimum_generations;
while (numEvals > 0 && numEvals < 200 && gens_now < 20) {
numEvals = em.createTree(board, gens_now++);
}
em.scoreLeaves();
score = em.evaluateTree();
auto moveInfo = em.getMoves(board);
totalEvals += numEvals;
if (moveInfo.empty()) break;
move = moveInfo.front().move;
if (verbosity > 3) {
em.evaluateEffort();
em.printTree(2);
}
gameLogFile << Output::formatMoveInfo(board, moveInfo) << "\n";
if (verbosity > 1) {
cout << Output::formatMoveInfo(board, moveInfo);
cout << endl;
}
score += bh->moveAndScore(board, move);
if (verbosity > 2) cout << Output::formatBoard(board);
auto possibleTiles = bh->getPossibleSpawns(board);
auto placement = utility2->randInt(static_cast<int>(possibleTiles & 0xFull));
auto place = bh->getSpawnFromList(possibleTiles, placement);
if (verbosity > 2) cout << "Putting tile in place " << place << endl;
board |= (utility2->coinToss(0.9) ? (1ull << (4 * place)) : (2ull << (4 * place)));
// if (i % 500 == 0) {
// cout << name << " >> " << " move: " << i << ", score: " << score
// << ", numEvals: " << numEvals << endl;
// }
// used to see if board crosses critical point
if (bh->getHighestTile(board) == 14) {
passedCritialPoint = true;
// cout << name << " passed critical point" << endl;
// break;
}
}
dataLogger->writeToFiles(
dirname + "/dead_boards.dat",
dirname + "/calculated_boards.dat",
dirname + "/calculated_scores.dat",
dirname + "/moves.dat"
);
if (verbosity > 0) {
cout << "Finished game:" << gameNo << endl;
}
auto timeTaken = std::chrono::duration_cast<std::chrono::duration<double> >
(steady_clock::now() - start).count();
// auto timeTaken = (clock() - start) / (double) CLOCKS_PER_SEC;
// cout << name << " >> " << " move: " << i << ", score: " << score << endl;
auto stats = em.getFinalStats();
stats->finalBoard = board;
stats->startBoard = startBoard;
stats->setVal("score", score);
stats->setVal("boardTotal", bh->getBoardTotal(stats->finalBoard));
stats->setVal("moves", i);
stats->setVal("timeTaken", timeTaken);
stats->setVal("totalEvals", totalEvals);
stats->passedCriticalPoint = passedCritialPoint;
return stats;
}
Board initBoard(Utility* utility) {
auto board = 0ull;
// auto board = Board{0xdcba'9000'0000'0000ull};
auto pos1 = utility->randInt(16);
while (BoardHandler::getTileValue(board, pos1) > 0) pos1 = utility->randInt(16);
auto pos2 = utility->randInt(16);
while (BoardHandler::getTileValue(board, pos2) > 0 || pos1 == pos2) pos2 = utility->randInt(16);
for (const auto& p : {pos1, pos2}) {
if (utility->coinToss(0.9)) {
board |= 1ull << (p * 4);
}
else {
board |= 2ull << (p * 4);
}
}
return board;
}
| 33.25188
| 100
| 0.579197
|
cookish
|
7603cfdd482d38b8f23a872a2092ae7e39360507
| 1,650
|
hpp
|
C++
|
create3_coverage/include/create3_coverage/behaviors/rotate-behavior.hpp
|
iRobotEducation/create3_examples
|
8f04a57be3d2c8e7e9a4d346b78eaca991b83e84
|
[
"BSD-3-Clause"
] | 2
|
2021-12-16T16:14:39.000Z
|
2022-03-10T01:19:06.000Z
|
create3_coverage/include/create3_coverage/behaviors/rotate-behavior.hpp
|
iRobotEducation/create3_examples
|
8f04a57be3d2c8e7e9a4d346b78eaca991b83e84
|
[
"BSD-3-Clause"
] | 7
|
2021-11-01T18:59:15.000Z
|
2022-01-14T16:43:55.000Z
|
create3_coverage/include/create3_coverage/behaviors/rotate-behavior.hpp
|
iRobotEducation/create3_examples
|
8f04a57be3d2c8e7e9a4d346b78eaca991b83e84
|
[
"BSD-3-Clause"
] | 1
|
2021-11-11T20:06:22.000Z
|
2021-11-11T20:06:22.000Z
|
// Copyright 2021 iRobot Corporation. All Rights Reserved.
#pragma once
#include "create3_coverage/behaviors/behavior.hpp"
#include "create3_coverage/behaviors/reflex-behavior.hpp"
#include "create3_examples_msgs/action/coverage.hpp"
#include "geometry_msgs/msg/twist.hpp"
#include "rclcpp/rclcpp.hpp"
#include "tf2_geometry_msgs/tf2_geometry_msgs.h"
namespace create3_coverage {
class RotateBehavior : public Behavior
{
public:
using TwistMsg = geometry_msgs::msg::Twist;
struct Config
{
double target_rotation {0.785398};
double angular_vel {0.6};
bool robot_has_reflexes {false};
size_t max_hazard_retries {10};
rclcpp::Duration clear_hazard_time {rclcpp::Duration(std::chrono::seconds(2))};
};
RotateBehavior(
Config config,
rclcpp::Publisher<TwistMsg>::SharedPtr cmd_vel_publisher,
rclcpp::Logger logger,
rclcpp::Clock::SharedPtr clock);
~RotateBehavior() = default;
State execute(const Data & data) override;
int32_t get_id() const override { return create3_examples_msgs::action::Coverage::Feedback::ROTATE; }
double get_rotation_amount() { return m_rotation_amount; }
private:
State handle_hazards(const Data & data);
Config m_config;
double m_rotation_amount;
bool m_first_run;
rclcpp::Time m_start_time;
tf2::Quaternion m_initial_orientation;
std::unique_ptr<ReflexBehavior> m_reflex_behavior;
size_t m_hazards_count;
rclcpp::Publisher<TwistMsg>::SharedPtr m_cmd_vel_publisher;
rclcpp::Logger m_logger;
rclcpp::Clock::SharedPtr m_clock;
};
} // namespace create3_coverage
| 27.04918
| 105
| 0.725455
|
iRobotEducation
|
760be3e00eeee36d5d0e40d2557d701d579e1cea
| 501
|
hpp
|
C++
|
include/data_types/vec/Vec.hpp
|
flwende/data_types
|
2a251345a2d1a1595f4b3f5e49b01311bdd17d42
|
[
"BSD-2-Clause"
] | null | null | null |
include/data_types/vec/Vec.hpp
|
flwende/data_types
|
2a251345a2d1a1595f4b3f5e49b01311bdd17d42
|
[
"BSD-2-Clause"
] | null | null | null |
include/data_types/vec/Vec.hpp
|
flwende/data_types
|
2a251345a2d1a1595f4b3f5e49b01311bdd17d42
|
[
"BSD-2-Clause"
] | null | null | null |
// Copyright (c) 2017-2019 Florian Wende (flwende@gmail.com)
//
// Distributed under the BSD 2-clause Software License
// (See accompanying file LICENSE)
#if !defined(DATA_TYPES_VEC_VEC_HPP)
#define DATA_TYPES_VEC_VEC_HPP
#if !defined(XXX_NAMESPACE)
#define XXX_NAMESPACE fw
#endif
#include <tuple/Tuple.hpp>
#include <DataTypes.hpp>
namespace XXX_NAMESPACE
{
namespace dataTypes
{
template <typename ValueT, SizeT N>
using Vec = Builder<Tuple, ValueT, N>;
}
}
#endif
| 19.269231
| 60
| 0.720559
|
flwende
|
76114b9bc8badcc0cd05cfe6f4b815555321e0c4
| 1,466
|
cpp
|
C++
|
jerome/xml/document.cpp
|
leuski-ict/jerome
|
6141a21c50903e98a04c79899164e7d0e82fe1c2
|
[
"Apache-2.0"
] | 3
|
2018-06-11T10:48:54.000Z
|
2021-05-30T07:10:15.000Z
|
jerome/xml/document.cpp
|
leuski-ict/jerome
|
6141a21c50903e98a04c79899164e7d0e82fe1c2
|
[
"Apache-2.0"
] | null | null | null |
jerome/xml/document.cpp
|
leuski-ict/jerome
|
6141a21c50903e98a04c79899164e7d0e82fe1c2
|
[
"Apache-2.0"
] | null | null | null |
//
// document.cpp
//
// Created by Anton Leuski on 8/15/15.
// Copyright (c) 2015 Anton Leuski & ICT/USC. All rights reserved.
//
// This file is part of Jerome.
//
// 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 <jerome/xml/impl/document_impl.hpp>
#include "document.hpp"
namespace jerome {
namespace xml {
document::document()
: mImpl(new detail::document_impl)
{}
document::document(std::istream& is)
: mImpl(new detail::document_impl(is))
{}
document::document(document&& inOther)
: mImpl(std::move(inOther.mImpl))
{}
document::document(std::unique_ptr<detail::document_impl>&& x)
: mImpl(std::move(x))
{}
// must have the definition even if it's empty.
document::~document() AL_NOEXCEPT
{
}
document::operator bool() const
{
return mImpl->isGood();
}
OptionalError document::save(std::ostream& os, bool formatted) const
{
return mImpl->save(os, formatted);
}
}
}
| 23.645161
| 76
| 0.686903
|
leuski-ict
|
761371997ef47205c1a986e51a751c28ee016882
| 1,246
|
cpp
|
C++
|
cmdstan/stan/lib/stan_math/test/unit/math/mix/mat/fun/trace_test.cpp
|
yizhang-cae/torsten
|
dc82080ca032325040844cbabe81c9a2b5e046f9
|
[
"BSD-3-Clause"
] | null | null | null |
cmdstan/stan/lib/stan_math/test/unit/math/mix/mat/fun/trace_test.cpp
|
yizhang-cae/torsten
|
dc82080ca032325040844cbabe81c9a2b5e046f9
|
[
"BSD-3-Clause"
] | null | null | null |
cmdstan/stan/lib/stan_math/test/unit/math/mix/mat/fun/trace_test.cpp
|
yizhang-cae/torsten
|
dc82080ca032325040844cbabe81c9a2b5e046f9
|
[
"BSD-3-Clause"
] | null | null | null |
#include <stan/math/mix/mat.hpp>
#include <gtest/gtest.h>
#include <test/unit/math/rev/mat/fun/util.hpp>
TEST(AgradMixMatrixTrace,fv) {
using stan::math::trace;
using stan::math::matrix_fv;
using stan::math::fvar;
using stan::math::var;
matrix_fv a(2,2);
a << -1.0, 2.0,
5.0, 10.0;
a(0,0).d_ = 1.0;
a(0,1).d_ = 1.0;
a(1,0).d_ = 1.0;
a(1,1).d_ = 1.0;
fvar<var> s = trace(a);
EXPECT_FLOAT_EQ(9.0,s.val_.val());
EXPECT_FLOAT_EQ(2.0,s.d_.val());
}
TEST(AgradMixMatrixTrace,ffv) {
using stan::math::trace;
using stan::math::matrix_ffv;
using stan::math::fvar;
using stan::math::var;
matrix_ffv a(2,2);
a << -1.0, 2.0,
5.0, 10.0;
a(0,0).d_ = 1.0;
a(0,1).d_ = 1.0;
a(1,0).d_ = 1.0;
a(1,1).d_ = 1.0;
a(0,0).val_.d_ = 1.0;
a(0,1).val_.d_ = 1.0;
a(1,0).val_.d_ = 1.0;
a(1,1).val_.d_ = 1.0;
fvar<fvar<var> > s = trace(a);
EXPECT_FLOAT_EQ(9.0,s.val_.val().val());
EXPECT_FLOAT_EQ(2.0,s.d_.val().val());
AVEC q = createAVEC(a(0,0).val().val(),a(0,1).val().val(),
a(1,0).val().val(),a(1,1).val().val());
VEC h;
s.d_.d_.grad(q,h);
EXPECT_FLOAT_EQ(0,h[0]);
EXPECT_FLOAT_EQ(0,h[1]);
EXPECT_FLOAT_EQ(0,h[2]);
EXPECT_FLOAT_EQ(0,h[3]);
}
| 23.074074
| 61
| 0.555377
|
yizhang-cae
|
761c8fde5ca17eb8395d7f50fec9618cb3d37499
| 886
|
hxx
|
C++
|
Legolas/BlockMatrix/Structures/Diagonal/DiagonalBlockMatrix.hxx
|
LaurentPlagne/Legolas
|
fdf533528baf7ab5fcb1db15d95d2387b3e3723c
|
[
"MIT"
] | null | null | null |
Legolas/BlockMatrix/Structures/Diagonal/DiagonalBlockMatrix.hxx
|
LaurentPlagne/Legolas
|
fdf533528baf7ab5fcb1db15d95d2387b3e3723c
|
[
"MIT"
] | null | null | null |
Legolas/BlockMatrix/Structures/Diagonal/DiagonalBlockMatrix.hxx
|
LaurentPlagne/Legolas
|
fdf533528baf7ab5fcb1db15d95d2387b3e3723c
|
[
"MIT"
] | 1
|
2021-02-11T14:43:25.000Z
|
2021-02-11T14:43:25.000Z
|
#ifndef __LEGOLAS_DIAGONALBLOCKMATRIX_HXX__
#define __LEGOLAS_DIAGONALBLOCKMATRIX_HXX__
#include "Legolas/BlockMatrix/Matrix.hxx"
#include "Legolas/BlockMatrix/Structures/Diagonal/DiagonalVirtualBlockMatrix.hxx"
#include "Legolas/BlockMatrix/Structures/Diagonal/DiagonalVirtualSolver.hxx"
namespace Legolas{
class DiagonalBlockMatrix : public DiagonalVirtualBlockMatrix {
typedef std::vector< Matrix * > DiagonalData;
DiagonalData diagonalData_;
public:
virtual inline std::string name( void ) const { return "DiagonalBlockMatrix";}
DiagonalBlockMatrix(const VirtualMatrixShape & virtualMatrixShape);
virtual ~DiagonalBlockMatrix( void ) ;
void setDiagonalElementPtr(int i, Matrix * matrixPtr);
virtual const Matrix & diagonalGetElement(int i) const ;
virtual Matrix & diagonalGetElement(int i) ;
};
}
#endif
| 26.058824
| 82
| 0.757336
|
LaurentPlagne
|
76202a93a58c86da6c37f826216b9b33fcbdf48e
| 4,312
|
cpp
|
C++
|
Poker/deck_of_cards.cpp
|
jairoalejandrogomez/CppTraining
|
932bc729817213af70c19d5d3525ada44a235116
|
[
"MIT"
] | null | null | null |
Poker/deck_of_cards.cpp
|
jairoalejandrogomez/CppTraining
|
932bc729817213af70c19d5d3525ada44a235116
|
[
"MIT"
] | null | null | null |
Poker/deck_of_cards.cpp
|
jairoalejandrogomez/CppTraining
|
932bc729817213af70c19d5d3525ada44a235116
|
[
"MIT"
] | null | null | null |
#include "deck_of_cards.h"
//--------------------------------------------------------------
using namespace std;
//--------------------------------------------------------------
//Class implementation.
//--------------------------------------------------------------
deck_of_cards::deck_of_cards(void)
{
RNG_Mersenne_Twister=std::mt19937(rd());
unsigned int t=0;
unsigned int n=0;
for (unsigned i=0; i<deck.size(); i++ )
{
//cout<<"t= "<<t<<", n= "<<n<<endl;
deck[i].set_card(t,n);
if (n<12) {n++;} else {n=0; t++;}
}
}
//----------------------------------------------------------------------------------------------------------------------------------------
deck_of_cards::~deck_of_cards(void) //Destructor
{
}
//----------------------------------------------------------------------------------------------------------------------------------------
unsigned deck_of_cards::get_num_of_cards() const
{
return deck.size();
}
//----------------------------------------------------------------------------------------------------------------------------------------
int deck_of_cards::see_card(const unsigned &i, card & c) const
{
if ((i>=0) && (i<deck.size()))
{
c = deck.at(i); //*it;
return 0; //Success;
}
else
{
cout<<"Index i for the card to see should be between 0 and "<<deck.size()<<endl;
return 1; //Failure;
}
}
//----------------------------------------------------------------------------------------------------------------------------------------
int deck_of_cards::extract_card(const unsigned &i, card & c)
{
if ((i>=0) && (i<deck.size()))
{
auto it = deck.begin(); //This is equivalent to: vector <card>::iterator it = deck.begin();
it+=i; //Increment iterator so that it point to the desired card.
c = deck.at(i); //*it;
deck.erase(it);
return 0; //Success;
}
else
{
cout<<"Index i for the card to extract should be between 0 and "<<deck.size()<<endl;
return 1; //Failure;
}
}
//----------------------------------------------------------------------------------------------------------------------------------------
int deck_of_cards::extract_n_cards(const unsigned &n, vector<card> & v)
{
if ((n>=0) && (n<deck.size()))
{
vector< card >::iterator it_b = deck.begin(); //Initial iterator
vector< card >::iterator it_e = it_b + n; //End iterator (remember that this is a sentinel so it goes all the way up to +1)
copy (it_b,it_e,v.begin()); //Copy function from the STL of c++11.
this->deck.erase(it_b,it_e); //Remove the cards from the deck of cards.
return 0; //Success;
}
else
{
cout<<"The number of cards has to be between 0 and "<<deck.size()<<endl;
return 1; //Failure;
}
}
//----------------------------------------------------------------------------------------------------------------------------------------
void deck_of_cards::shuffle_cards()
{
std::shuffle(deck.begin(), deck.end(),RNG_Mersenne_Twister); //This is available in STL of c++
}
//----------------------------------------------------------------------------------------------------------------------------------------
void deck_of_cards::print_deck()
{
for (auto it=deck.begin(); it!=deck.end(); ++it)
{
cout<<(*it)<<endl;
}
}
//----------------------------------------------------------------------------------------------------------------------------------------
ostream & operator << (ostream & out, const deck_of_cards & d) //<< operator to use cout.
{
for (auto it=d.deck.begin(); it!=d.deck.end(); ++it)
{
out<<(*it)<<endl;
}
return out;
}
//----------------------------------------------------------------------------------------------------------------------------------------
| 33.6875
| 148
| 0.325603
|
jairoalejandrogomez
|
762035ad6f88514134248c3644610334f9333b1f
| 1,288
|
hpp
|
C++
|
libraries/CustomHeaderLibs/device/24LC256.hpp
|
mskoenz/arduino_crash_course
|
cc7031e827dd13211cb9ce84f6d758f6e635e6a8
|
[
"WTFPL"
] | null | null | null |
libraries/CustomHeaderLibs/device/24LC256.hpp
|
mskoenz/arduino_crash_course
|
cc7031e827dd13211cb9ce84f6d758f6e635e6a8
|
[
"WTFPL"
] | null | null | null |
libraries/CustomHeaderLibs/device/24LC256.hpp
|
mskoenz/arduino_crash_course
|
cc7031e827dd13211cb9ce84f6d758f6e635e6a8
|
[
"WTFPL"
] | null | null | null |
// Author: Mario S. Könz <mskoenz@gmx.net>
// Date: 19.08.2013 20:44:12 CEST
// File: 24LC256.hpp
/* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://www.wtfpl.net/ or COPYING for more details. */
#ifndef __24LC256_HEADER
#define __24LC256_HEADER
#include "../com/i2c.hpp"
namespace device {
class _24LC256_class {
public:
_24LC256_class(uint8_t const & dev_adr = 0x50): dev_adr_(dev_adr) { //the addres is 0x50 + (A2 << 2 | A1 << 1 | A0)
}
void write(uint16_t const & adr, uint8_t const & data) {
if(read(adr) != data) {
com::i2cout(dev_adr_) << com::little_endian(adr) << data << ustd::endl;
delayMicroseconds(4000);
}
}
uint8_t read(uint16_t const & adr) const {
uint8_t res;
com::i2cout(dev_adr_) << com::little_endian(adr) << ustd::endl(false);
com::i2cin(dev_adr_) >> res;
return res;
}
private:
uint8_t dev_adr_;
};
}//end namespace device
#endif //__24LC256_HEADER
| 33.894737
| 123
| 0.610248
|
mskoenz
|
76210ddea290fd8ea025985d4cc9fe0713dbeb33
| 2,232
|
cpp
|
C++
|
src/pipeline/datatype/SpatialImgDetections.cpp
|
slitcch/depthai-core
|
b6e5f3bc9ac1473c0a91012611a6f7f9d97c384d
|
[
"MIT"
] | 1
|
2022-03-22T07:15:47.000Z
|
2022-03-22T07:15:47.000Z
|
src/pipeline/datatype/SpatialImgDetections.cpp
|
slitcch/depthai-core
|
b6e5f3bc9ac1473c0a91012611a6f7f9d97c384d
|
[
"MIT"
] | null | null | null |
src/pipeline/datatype/SpatialImgDetections.cpp
|
slitcch/depthai-core
|
b6e5f3bc9ac1473c0a91012611a6f7f9d97c384d
|
[
"MIT"
] | null | null | null |
#include "depthai/pipeline/datatype/SpatialImgDetections.hpp"
namespace dai {
std::shared_ptr<RawBuffer> SpatialImgDetections::serialize() const {
return raw;
}
SpatialImgDetections::SpatialImgDetections()
: Buffer(std::make_shared<RawSpatialImgDetections>()), dets(*dynamic_cast<RawSpatialImgDetections*>(raw.get())), detections(dets.detections) {}
SpatialImgDetections::SpatialImgDetections(std::shared_ptr<RawSpatialImgDetections> ptr)
: Buffer(std::move(ptr)), dets(*dynamic_cast<RawSpatialImgDetections*>(raw.get())), detections(dets.detections) {}
// setters
SpatialImgDetections& SpatialImgDetections::setTimestamp(std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration> tp) {
// Set timestamp from timepoint
using namespace std::chrono;
auto ts = tp.time_since_epoch();
dets.ts.sec = duration_cast<seconds>(ts).count();
dets.ts.nsec = duration_cast<nanoseconds>(ts).count() % 1000000000;
return *this;
}
SpatialImgDetections& SpatialImgDetections::setTimestampDevice(std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration> tp) {
// Set timestamp from timepoint
using namespace std::chrono;
auto ts = tp.time_since_epoch();
dets.tsDevice.sec = duration_cast<seconds>(ts).count();
dets.ts.nsec = duration_cast<nanoseconds>(ts).count() % 1000000000;
return *this;
}
SpatialImgDetections& SpatialImgDetections::setSequenceNum(int64_t sequenceNum) {
dets.sequenceNum = sequenceNum;
return *this;
}
// getters
std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration> SpatialImgDetections::getTimestamp() const {
using namespace std::chrono;
return time_point<steady_clock, steady_clock::duration>{seconds(dets.ts.sec) + nanoseconds(dets.ts.nsec)};
}
std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration> SpatialImgDetections::getTimestampDevice() const {
using namespace std::chrono;
return time_point<steady_clock, steady_clock::duration>{seconds(dets.tsDevice.sec) + nanoseconds(dets.tsDevice.nsec)};
}
int64_t SpatialImgDetections::getSequenceNum() const {
return dets.sequenceNum;
}
} // namespace dai
| 44.64
| 156
| 0.75672
|
slitcch
|
7626b2b7fb37852ca22d0e2fd1f5a702cd2e5732
| 7,892
|
cpp
|
C++
|
smalldrop/smalldrop_teleoperation/src/smalldrop_teleoperation/spacemouse.cpp
|
blackchacal/Master-Thesis----Software
|
9a9858ede3086eee99d1fc969e32b4fb13278f00
|
[
"MIT"
] | 1
|
2020-08-16T14:37:09.000Z
|
2020-08-16T14:37:09.000Z
|
smalldrop/smalldrop_teleoperation/src/smalldrop_teleoperation/spacemouse.cpp
|
blackchacal/Master-Thesis----Software
|
9a9858ede3086eee99d1fc969e32b4fb13278f00
|
[
"MIT"
] | 1
|
2020-06-26T09:14:45.000Z
|
2020-07-18T08:46:50.000Z
|
smalldrop/smalldrop_teleoperation/src/smalldrop_teleoperation/spacemouse.cpp
|
blackchacal/Master-Thesis----Software
|
9a9858ede3086eee99d1fc969e32b4fb13278f00
|
[
"MIT"
] | null | null | null |
// Copyright (c) 2019-2020 Ricardo Tonet
// Use of this source code is governed by the MIT license, see LICENSE
/**
* \file spacemouse.cpp
* \brief Defines class for space mouse remote controller.
*/
#include <smalldrop_teleoperation/spacemouse.h>
namespace smalldrop
{
namespace smalldrop_teleoperation
{
/*****************************************************************************************
* Public methods & constructors/destructors
*****************************************************************************************/
/**
* \copybrief SpaceMouse::SpaceMouse(std::string topic, smalldrop_state::SystemState* system_state)
*/
SpaceMouse::SpaceMouse(std::string topic, smalldrop_state::SystemState* system_state)
: RemoteController(), system_state_(system_state), state_topic_(topic)
{
subscribeToStateTopic();
state_.axes.reserve(6);
state_.buttons.reserve(2);
state_prev_.axes.reserve(6);
state_prev_.buttons.reserve(2);
state_.axes[0] = -1;
state_.axes[1] = -1;
state_.axes[2] = -1;
state_.axes[3] = -1;
state_.axes[4] = -1;
state_.axes[5] = -1;
state_.buttons[0] = -1;
state_.buttons[1] = -1;
state_prev_.axes[0] = -1;
state_prev_.axes[1] = -1;
state_prev_.axes[2] = -1;
state_prev_.axes[3] = -1;
state_prev_.axes[4] = -1;
state_prev_.axes[5] = -1;
state_prev_.buttons[0] = -1;
state_prev_.buttons[1] = -1;
}
/**
* \copybrief SpaceMouse::SpaceMouse(std::string topic, std::list<IRemoteControllerMode *> modes, smalldrop_state::SystemState* system_state)
*/
SpaceMouse::SpaceMouse(std::string topic, std::list<IRemoteControllerMode *> modes, smalldrop_state::SystemState* system_state)
: RemoteController(modes), system_state_(system_state), state_topic_(topic)
{
subscribeToStateTopic();
state_.axes.reserve(6);
state_.buttons.reserve(2);
state_prev_.axes.reserve(6);
state_prev_.buttons.reserve(2);
state_.axes[0] = -1;
state_.axes[1] = -1;
state_.axes[2] = -1;
state_.axes[3] = -1;
state_.axes[4] = -1;
state_.axes[5] = -1;
state_.buttons[0] = -1;
state_.buttons[1] = -1;
state_prev_.axes[0] = -1;
state_prev_.axes[1] = -1;
state_prev_.axes[2] = -1;
state_prev_.axes[3] = -1;
state_prev_.axes[4] = -1;
state_prev_.axes[5] = -1;
state_prev_.buttons[0] = -1;
state_prev_.buttons[1] = -1;
}
/**
* \copybrief SpaceMouse::getStateTopic()
*/
std::string SpaceMouse::getStateTopic() const
{
return state_topic_;
}
/**
* \copybrief SpaceMouse::getState()
*/
sensor_msgs::Joy& SpaceMouse::getState()
{
return state_;
}
/*****************************************************************************************
* Private methods
*****************************************************************************************/
/**
* \copybrief RemoteController::connect()
*/
void SpaceMouse::connect()
{
bool spacenav_is_on = false;
std::vector<std::string> nodes;
ros::master::getNodes(nodes);
for (unsigned int i = 0; i < nodes.size(); i++)
{
if (nodes[i].compare("/spacenav") == 0)
{
spacenav_is_on = true;
break;
}
}
if (spacenav_is_on)
connected_ = true;
}
/**
* \copybrief RemoteController::disconnect()
*/
void SpaceMouse::disconnect()
{
connected_ = false;
}
/**
* \copybrief RemoteController::subscribeToStateTopic()
*/
void SpaceMouse::subscribeToStateTopic()
{
state_sub_ = nh_.subscribe<sensor_msgs::Joy>(state_topic_, 10, &SpaceMouse::getStateFromTopic, this);
}
/**
* \copybrief RemoteController::getStateFromTopic()
*/
void SpaceMouse::getStateFromTopic(const sensor_msgs::Joy::ConstPtr &msg)
{
if (connected_)
{
state_.axes[0] = msg->axes[0];
state_.axes[1] = msg->axes[1];
state_.axes[2] = msg->axes[2];
state_.axes[3] = msg->axes[3];
state_.axes[4] = msg->axes[4];
state_.axes[5] = msg->axes[5];
state_.buttons[0] = msg->buttons[0];
state_.buttons[1] = msg->buttons[1];
// Check if any button was pressed and call the associated action
checkButtonPress();
// Update previous data
state_prev_.axes[0] = state_.axes[0];
state_prev_.axes[1] = state_.axes[1];
state_prev_.axes[2] = state_.axes[2];
state_prev_.axes[3] = state_.axes[3];
state_prev_.axes[4] = state_.axes[4];
state_prev_.axes[5] = state_.axes[5];
state_prev_.buttons[0] = state_.buttons[0];
state_prev_.buttons[1] = state_.buttons[1];
}
}
/**
* \copybrief SpaceMouse::checkButtonPress()
*/
void SpaceMouse::checkButtonPress()
{
if (active_mode_ != nullptr)
{
button_map_t button_map = active_mode_->getButtonMap();
button_map_t::iterator it = button_map.begin();
// Check control buttons
if (state_.buttons[0] != state_prev_.buttons[0] && state_prev_.buttons[0] != -1 && !state_.buttons[0])
{
while (it != button_map.end())
{
if (it->second.compare("buttons_0") == 0 && isButtonSet(it->first))
{
if (it->first.compare("mode") == 0)
{
changeMode();
callButtonAction(it->first, system_state_);
}
else
callButtonAction(it->first, system_state_);
break;
}
it++;
}
}
if (state_.buttons[1] != state_prev_.buttons[1] && state_prev_.buttons[1] != -1 && !state_.buttons[1])
{
it = button_map.begin();
while (it != button_map.end())
{
if (it->second.compare("buttons_1") == 0 && isButtonSet(it->first))
{
if (it->first.compare("mode") == 0)
{
changeMode();
callButtonAction(it->first, system_state_);
}
else
callButtonAction(it->first, system_state_);
break;
}
it++;
}
}
// Check joy buttons/positions
if (state_.axes[0] != 0)
{
it = button_map.begin();
while (it != button_map.end())
{
if ((it->second.compare("axes_x") == 0 || it->second.compare("axes_*") == 0) && isButtonSet(it->first))
{
callButtonAction(it->first, system_state_);
break;
}
it++;
}
}
if (state_.axes[1] != 0)
{
it = button_map.begin();
while (it != button_map.end())
{
if ((it->second.compare("axes_y") == 0 || it->second.compare("axes_*") == 0) && isButtonSet(it->first))
{
callButtonAction(it->first, system_state_);
break;
}
it++;
}
}
if (state_.axes[2] != 0)
{
it = button_map.begin();
while (it != button_map.end())
{
if ((it->second.compare("axes_z") == 0 || it->second.compare("axes_*") == 0) && isButtonSet(it->first))
{
callButtonAction(it->first, system_state_);
break;
}
it++;
}
}
if (state_.axes[3] != 0)
{
it = button_map.begin();
while (it != button_map.end())
{
if ((it->second.compare("axes_rx") == 0 || it->second.compare("axes_*") == 0) && isButtonSet(it->first))
{
callButtonAction(it->first, system_state_);
break;
}
it++;
}
}
if (state_.axes[4] != 0)
{
it = button_map.begin();
while (it != button_map.end())
{
if ((it->second.compare("axes_ry") == 0 || it->second.compare("axes_*") == 0) && isButtonSet(it->first))
{
callButtonAction(it->first, system_state_);
break;
}
it++;
}
}
if (state_.axes[5] != 0)
{
it = button_map.begin();
while (it != button_map.end())
{
if ((it->second.compare("axes_rz") == 0 || it->second.compare("axes_*") == 0) && isButtonSet(it->first))
{
callButtonAction(it->first, system_state_);
break;
}
it++;
}
}
}
}
} // namespace smalldrop_teleoperation
} // namespace smalldrop
| 25.79085
| 141
| 0.559934
|
blackchacal
|
762fab91db15fbb2818a11c8c6f4ebe0ba4c557b
| 734
|
hh
|
C++
|
NetworkRelay/RunWorldServer.hh
|
deb0ch/R-Type
|
8bb37cd5ec318efb97119afb87d4996f6bb7644e
|
[
"WTFPL"
] | 5
|
2016-03-15T20:14:10.000Z
|
2020-10-30T23:56:24.000Z
|
NetworkRelay/RunWorldServer.hh
|
deb0ch/R-Type
|
8bb37cd5ec318efb97119afb87d4996f6bb7644e
|
[
"WTFPL"
] | 3
|
2018-12-19T19:12:44.000Z
|
2020-04-02T13:07:00.000Z
|
NetworkRelay/RunWorldServer.hh
|
deb0ch/R-Type
|
8bb37cd5ec318efb97119afb87d4996f6bb7644e
|
[
"WTFPL"
] | 2
|
2016-04-11T19:29:28.000Z
|
2021-11-26T20:53:22.000Z
|
#ifndef RUNWORLDSERVER_H_
# define RUNWORLDSERVER_H_
#include "World.hh"
#include "Timer.hh"
#include "Any.hpp"
class ServerRelay;
class RunWorldServer
{
public:
RunWorldServer(ServerRelay *server, const std::string &nameRoom);
virtual ~RunWorldServer();
void run(Any);
void run();
World *getWorld();
const World *getWorld() const;
void isEnd(bool isEnd);
private:
void addSystems();
void addSharedObjetcs();
void addEntities();
private:
RunWorldServer() = delete;
RunWorldServer(const RunWorldServer &);
RunWorldServer &operator=(const RunWorldServer &);
protected:
ServerRelay *_server;
World *_world;
Timer _timer;
std::string _nameRoom;
bool _isEnd;
};
#endif /* !RUNWORLDSERVER_H_ */
| 17.47619
| 67
| 0.720708
|
deb0ch
|
7630207b9ba9003b76ae9a8f7842139996de2f82
| 390
|
cpp
|
C++
|
EJERCICIOS/EJERCICIO46-Random/random.cpp
|
AntonioVillatoro/cpp
|
dbbfcbf7d31c3c0e64399a487d05398e53d9428d
|
[
"MIT"
] | null | null | null |
EJERCICIOS/EJERCICIO46-Random/random.cpp
|
AntonioVillatoro/cpp
|
dbbfcbf7d31c3c0e64399a487d05398e53d9428d
|
[
"MIT"
] | null | null | null |
EJERCICIOS/EJERCICIO46-Random/random.cpp
|
AntonioVillatoro/cpp
|
dbbfcbf7d31c3c0e64399a487d05398e53d9428d
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
int main(int argc, char const *argv[])
{
int numero=0;
//INICIALIZA EL NUMERO RANDOM
srand (time(NULL));
// GENERE UN NUMERO ENTRE 1 Y 10
for (int i = 0; i < 20; i++)
{
numero= rand ()%5+1;
cout << "NUMERO AL AZAR: " << numero;
cout << endl;
}
return 0;
}
| 13
| 41
| 0.553846
|
AntonioVillatoro
|
7630950fa17aeb6fc006adff8a352a13042e0a44
| 626
|
hpp
|
C++
|
Include/SA/SDK/Assets/TextureAsset.hpp
|
SapphireSuite/Engine
|
f29821853aec6118508f31d3e063e83e603f52dd
|
[
"MIT"
] | 1
|
2022-01-20T23:17:18.000Z
|
2022-01-20T23:17:18.000Z
|
Include/SA/SDK/Assets/TextureAsset.hpp
|
SapphireSuite/Engine
|
f29821853aec6118508f31d3e063e83e603f52dd
|
[
"MIT"
] | null | null | null |
Include/SA/SDK/Assets/TextureAsset.hpp
|
SapphireSuite/Engine
|
f29821853aec6118508f31d3e063e83e603f52dd
|
[
"MIT"
] | null | null | null |
// Copyright (c) 2021 Sapphire's Suite. All Rights Reserved.
#pragma once
#ifndef SAPPHIRE_SDK_TEXTURE_ASSET_GUARD
#define SAPPHIRE_SDK_TEXTURE_ASSET_GUARD
#include <SA/SDK/Assets/AAsset.hpp>
#include <SA/Render/Base/Texture/RawTexture.hpp>
namespace Sa
{
class TextureAsset : public AAsset
{
protected:
bool Load_Internal(std::string&& _bin) override final;
bool Save_Internal(std::fstream& _fStream) const override final;
bool Import_Internal(const std::string& _path) override final;
public:
RawTexture raw;
bool IsValid() const override final;
void UnLoad() override final;
};
}
#endif // GUARD
| 19.5625
| 66
| 0.757188
|
SapphireSuite
|
7632ebaad4ce19069e1327707a390c7b540d3b55
| 1,257
|
cpp
|
C++
|
src/objreceiver.cpp
|
barovig/CyberEye
|
ab6c5f83a07fcefb18fc796b5602f28b8f471bb3
|
[
"BSD-3-Clause"
] | null | null | null |
src/objreceiver.cpp
|
barovig/CyberEye
|
ab6c5f83a07fcefb18fc796b5602f28b8f471bb3
|
[
"BSD-3-Clause"
] | null | null | null |
src/objreceiver.cpp
|
barovig/CyberEye
|
ab6c5f83a07fcefb18fc796b5602f28b8f471bb3
|
[
"BSD-3-Clause"
] | null | null | null |
#include "objreceiver.h"
#include <boost/archive/binary_iarchive.hpp>
#include <boost/archive/binary_oarchive.hpp>
namespace ce {
ObjReceiver::ObjReceiver(int port) :
_port{port},
_acceptor(_ios, boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), _port))
{
}
void ObjReceiver::receiveObject(P_ImgObj obj)
{
CV_Assert(_engine != nullptr);
cv::Mat img;
// wait for connection
boost::asio::ip::tcp::socket socket(_ios);
_acceptor.accept(socket);
// get img data
// read actual data
std::string inbound_data = TcpChannel::readString(socket);
CV_Assert(inbound_data.size() != 0);
std::istringstream archive_is(inbound_data);
// deserialise the string - use scope to close stream
{
boost::archive::text_iarchive arch(archive_is);
// boost::archive::binary_iarchive arch(archive_is);
arch >> img;
}
// construct new ImgObject
P_ImgObj pImg(new ImgObj(img, 0)); //TODO: deal with ID!
// run recognition and get text data back
_engine->recognise(pImg);
std::string label = _engine->getRecognitionResult();
// send this data back through same socket - header + data
TcpChannel::writeString(label, socket);
}
void ObjReceiver::setEngine(cv::Ptr<RecognitionEngine> engine)
{
_engine = engine;
}
} // namespace ce
| 24.647059
| 83
| 0.718377
|
barovig
|
763715dbc8488a92005c36c5a9a6261903807fd8
| 3,261
|
hpp
|
C++
|
include/qflags/string_option.hpp
|
AlErted/qflags
|
27b4c193b0ad6121b9389ef4fd7080a806381026
|
[
"MIT"
] | null | null | null |
include/qflags/string_option.hpp
|
AlErted/qflags
|
27b4c193b0ad6121b9389ef4fd7080a806381026
|
[
"MIT"
] | null | null | null |
include/qflags/string_option.hpp
|
AlErted/qflags
|
27b4c193b0ad6121b9389ef4fd7080a806381026
|
[
"MIT"
] | null | null | null |
// string_option.hpp
//
#include <qflags/qflags.h>
#include <cassert>
namespace qflags {
////////////////////////////////////////////////////////////////////////////////
/**
*
*/
QFLAGS_INLINE string_option::string_option(char const* name,
char const* default_value) :
string_option(name, "", default_value, "") {}
////////////////////////////////////////////////////////////////////////////////
/**
*
*/
QFLAGS_INLINE string_option::string_option(char const* name,
char const* short_name,
char const* default_value,
char const* description) :
option(name, short_name, default_value ? default_value : "", description),
_default_value(default_value ? default_value : "") {}
////////////////////////////////////////////////////////////////////////////////
/**
*
*/
QFLAGS_INLINE int string_option::parse(int argc, char const* const* argv, std::string* errors)
{
assert(argv && "argv must not be null!");
assert(errors && "errors must not be null!");
int argn = _parse_string(argc, argv, &_value_string, errors);
_is_set = (argn > 0) ? true : false;
return argn;
}
////////////////////////////////////////////////////////////////////////////////
/**
*
*/
QFLAGS_INLINE int option::_parse_string(int argc,
char const* const* argv,
std::string* value_string,
std::string* errors) const
{
assert(argv && "argv must not be null!");
assert(errors && "errors must not be null!");
assert(value_string && "value_string must not be null!");
assert(argv[0][0] == '-' && "argv must start with argument prefix!");
bool is_long_opt = (argv[0][1] == '-') ? true : false;
// Choose name or short name based on argument prefix. If short name is
// empty then always use the long name regardless of prefix.
std::string argument_name = (_short_name.empty() || is_long_opt)
? "--" + _name
: "-" + _short_name;
// Check if argument matches option's name.
if (argc < 1 || strncmp(argv[0], argument_name.c_str(), argument_name.length())) {
return 0;
}
// Check if argument has the form: "--<name>=<value>"
if (is_long_opt && argv[0][argument_name.length()] == '=') {
(*value_string) = argv[0] + argument_name.length() + 1;
return 1;
}
// Check if argument has the form: "-<shortname><value>"
else if (!is_long_opt && argv[0][argument_name.length()] != '\0') {
(*value_string) = argv[0] + argument_name.length();
return 1;
}
// Check that argument exactly matches option's name.
else if (argv[0][argument_name.length()] != '\0') {
return 0;
}
// Check if there are insufficient arguments.
else if (argc < 2) {
errors->append("Error: Insufficient arguments for option '");
errors->append(_name);
errors->append("'.\n");
return -1;
}
(*value_string) = argv[1];
return 2;
}
} // namespace qflags
| 32.939394
| 94
| 0.495554
|
AlErted
|
7639579bd5f7d070633defc8d8fd5e5e3e20432a
| 3,461
|
cpp
|
C++
|
filter_stubs/orient_steerable.cpp
|
flyingfalling/salmap_rv
|
61827a42f456afcd9c930646de33bc3f9533e3e2
|
[
"MIT"
] | 1
|
2022-02-17T03:05:40.000Z
|
2022-02-17T03:05:40.000Z
|
filter_stubs/orient_steerable.cpp
|
flyingfalling/salmap_rv
|
61827a42f456afcd9c930646de33bc3f9533e3e2
|
[
"MIT"
] | null | null | null |
filter_stubs/orient_steerable.cpp
|
flyingfalling/salmap_rv
|
61827a42f456afcd9c930646de33bc3f9533e3e2
|
[
"MIT"
] | null | null | null |
auto i = GETINPUT("input");
auto output = GETOUTPUT("output");
if( false == scratch.initialized() )
{
float64_t bandwidth_octaves = param_as_float64( params, "bandwidth_octaves" );
float64_t orientation_theta_rad = deg_to_rad( param_as_float64( params, "orient_theta_deg" ) );
float64_t atten_size_prop = param_as_float64( params, "prop_width_edge_atten" );
float64_t f0_cyc_dva = param_as_float64( params, "f0_cyc_dva" );
float64_t f0_lambda_dva = (1/f0_cyc_dva);
float64_t f0_cyc_pix = f0_cyc_dva * i->get_dva_per_pix_wid();
float64_t f0_lambda_pix = 1/f0_cyc_pix;
cv::Mat cosimg = cv::Mat( i->size(), i->cpu().type() );
cv::Mat sinimg = cosimg.clone();
float64_t xoffset = cosimg.size().width / 2;
float64_t yoffset = cosimg.size().height / 2;
float64_t cycmult=2*CV_PI;
float64_t kx = f0_cyc_pix * cycmult * cos( orientation_theta_rad + CV_PI/2 );
float64_t ky = f0_cyc_pix * cycmult * sin( orientation_theta_rad + CV_PI/2 );
for( size_t y=0; y<cosimg.size().height; ++y )
{
for(size_t x=0; x<cosimg.size().width; ++x )
{
float64_t xarg = x - xoffset;
float64_t yarg = y - yoffset;
float64_t arg = kx * xarg + ky * yarg;
cosimg.at<float32_t>(y,x) = cos(arg);
sinimg.at<float32_t>(y,x) = sin(arg);
}
}
sinimg.copyTo(scratch.cpu_w("sinimg"));
cosimg.copyTo(scratch.cpu_w("cosimg"));
float64_t sig_dva = sigma_from_bandwidth_lambda( bandwidth_octaves, (f0_lambda_dva) );
float64_t xsigma_pix = sig_dva * i->get_pix_per_dva_wid();
#ifdef GAUSS_USE_KERNEL
int ksize_pix = ksize_compute( xsigma_pix );
cv::Mat kern = cv::getGaussianKernel( ksize_pix, xsigma_pix );
kern.copyTo(scratch.cpu_w("kern"));
#endif
float64_t attensize_pix = atten_size_prop * f0_lambda_pix;
scratch.float64("sig_pix") = xsigma_pix;
HELPPRINTF(stdout, "ORIENT_STEERABLE (%s): F0 cyc dva %lf (lamb %lf dva), cyc pix %lf, lamb pix %lf (img size %ld %ld) :: ORI Gauss corresp: (%lf) pix LPF smooth -- Attenuate [%lf] of lambda, i.e. attenuating [%lf] pixels\n", nickname.c_str(), f0_cyc_dva ,f0_lambda_dva, f0_cyc_pix, f0_lambda_pix, i->size().width, i->size().height, xsigma_pix, atten_size_prop, attensize_pix );
attenuation_filter_cpu_wid( attensize_pix, cosimg, scratch.cpu_w("atten") );
}
cv::multiply( i->cpu(), scratch.cpu("cosimg"), scratch.cpu_w("real") );
cv::multiply( i->cpu(), scratch.cpu("sinimg"), output->cpu_w() );
#ifdef GAUSS_USE_KERNEL
cv::sepFilter2D( scratch.cpu("real"), scratch.cpu_w("real"), -1, scratch.cpu("kern"), scratch.cpu("kern") );
cv::sepFilter2D( output->cpu(), output->cpu_w(), -1, scratch.cpu("kern"), scratch.cpu("kern") );
#else
cv::GaussianBlur(scratch.cpu("real"), scratch.cpu_w("real"), cv::Size(0,0), scratch.float64("sig_pix"));
cv::GaussianBlur(output->cpu(), output->cpu_w(), cv::Size(0,0), scratch.float64("sig_pix"));
#endif
cv::magnitude( output->cpu(), scratch.cpu("real"), output->cpu_w() );
cv::multiply( output->cpu_w(), scratch.cpu("atten"), output->cpu_w() );
output->setMetadata( curr_time, i->get_dva_wid(), i->get_dva_hei(), i->get_origaspectratio_wh() );
| 22.92053
| 382
| 0.620341
|
flyingfalling
|
763d85b0be79d2918d0a9aa7a6ea1853cfa088df
| 4,400
|
cpp
|
C++
|
src/ValueWidget.cpp
|
jeanleflambeur/electronicload
|
15cc1b64710ced214928824e34729e83f260ed7f
|
[
"MIT"
] | 4
|
2019-02-24T16:09:44.000Z
|
2019-05-03T08:50:17.000Z
|
src/ValueWidget.cpp
|
jeanleflambeur/electronicload
|
15cc1b64710ced214928824e34729e83f260ed7f
|
[
"MIT"
] | 2
|
2019-05-17T07:42:16.000Z
|
2021-02-04T23:34:06.000Z
|
src/ValueWidget.cpp
|
jeanleflambeur/electronicload
|
15cc1b64710ced214928824e34729e83f260ed7f
|
[
"MIT"
] | 2
|
2019-12-27T00:32:19.000Z
|
2019-12-28T15:10:11.000Z
|
#include "ValueWidget.h"
ValueWidget::ValueWidget(JLMBackBuffer& gfx, float value, const char* suffix)
: WidgetBase(gfx)
, m_value(value)
{
m_suffix = suffix ? suffix : "";
}
void ValueWidget::setValueFont(const GFXfont* font)
{
m_valueFont = font;
m_dirtyFlags |= DirtyFlagGeometry;
}
void ValueWidget::setSuffixFont(const GFXfont* font)
{
m_suffixFont = font;
m_dirtyFlags |= DirtyFlagGeometry;
}
void ValueWidget::setSuffix(const char* suffix)
{
suffix = suffix ? suffix : "";
if (m_suffix == suffix)
{
return;
}
m_suffix = suffix;
m_dirtyFlags |= DirtyFlagGeometry;
}
void ValueWidget::setDecimals(uint8_t decimals)
{
if (m_decimals != decimals)
{
m_decimals = decimals;
m_dirtyFlags |= DirtyFlagGeometry;
}
}
void ValueWidget::setRange(float min, float max)
{
m_min = min;
m_max = max;
setValue(m_value);
}
void ValueWidget::setTextColor(uint16_t color)
{
setMainColor(color);
setSuffixColor(color);
}
void ValueWidget::setMainColor(uint16_t color)
{
if (m_mainColor != color)
{
m_mainColor = color;
}
}
void ValueWidget::setSuffixColor(uint16_t color)
{
if (m_suffixColor != color)
{
m_suffixColor = color;
}
}
void ValueWidget::setUseContentHeight(bool enabled)
{
if (m_useContentHeight != enabled)
{
m_useContentHeight = enabled;
m_dirtyFlags |= DirtyFlagGeometry;
}
}
void ValueWidget::setUsePadding(bool enabled)
{
if (m_usePadding != enabled)
{
m_usePadding = enabled;
m_dirtyFlags |= DirtyFlagGeometry;
}
}
void ValueWidget::setHorizontalAlignment(HorizontalAlignment alignment)
{
m_horizontalAlignment = alignment;
}
int16_t ValueWidget::getWidth() const
{
updateGeometry();
return m_w;
}
int16_t ValueWidget::getHeight() const
{
updateGeometry();
return m_useContentHeight ? m_ch : m_h;
}
void ValueWidget::render()
{
updateGeometry();
const GFXfont* oldFont = m_gfx.getFont();
m_gfx.setTextColor(m_mainColor);
m_gfx.setFont(m_valueFont);
char str[16];
valueToString(str);
Position position = computeBottomLeftPosition();
int16_t x = m_horizontalAlignment == HorizontalAlignment::Left ? position.x : position.x + m_w - m_cw;
//printf("X: '%s', %d, %d, %d\n", str, m_x, x, m_gfx.getTextWidth(str));
m_gfx.setCursor(x, position.y);
m_gfx.print(str);
if (!m_suffix.empty())
{
m_gfx.setTextColor(m_suffixColor);
m_gfx.setFont(m_suffixFont);
m_gfx.print(m_suffix.c_str());
}
m_gfx.setFont(oldFont);
}
void ValueWidget::setValue(float value)
{
value = min(value, m_max);
value = max(value, m_min);
//clamp the unused decimals
float p[] = { 1.f, 10.f, 100.f, 1000.f, 10000.f, 100000.f, 1000000.f, 10000000.f, 100000000.f };
value = (float)((long long)(value * p[m_decimals + 1] + 0.5f)) / p[m_decimals + 1];
if (m_value != value)
{
m_value = value;
m_dirtyFlags |= DirtyFlagGeometry;
}
}
float ValueWidget::getValue() const
{
return m_value;
}
void ValueWidget::valueToString(char* str) const
{
if (m_decimals == 0)
{
sprintf(str, "%d", (int32_t)m_value);
}
else
{
dtostrf(m_value, 0, m_decimals, str);
}
}
void ValueWidget::updateGeometry() const
{
if ((m_dirtyFlags & DirtyFlagGeometry) == 0)
{
return;
}
m_dirtyFlags &= ~DirtyFlagGeometry;
const GFXfont* oldFont = m_gfx.getFont();
char str[16] = { '\0' };
size_t offset = 0;
if (m_usePadding)
{
float maxAbsValue = std::max(m_max, std::abs(m_min));
{
int usedDigits = std::max((int)std::log10(std::abs(m_value)), 0) + 1;
int maxDigits = std::max((int)std::log10(maxAbsValue), 0) + 1;
if (maxDigits > usedDigits)
{
for (int i = 0; i < maxDigits - usedDigits; i++)
{
str[offset++] = '0';
}
}
}
if (m_value < 0 && m_min < 0) //reserve space for '-' if the value can also go negative
{
str[0] = '-';
offset++;
}
}
size_t contentOffset = offset;
valueToString(str + offset);
int16_t x, y;
uint16_t w, h;
m_gfx.setFont(m_valueFont);
m_gfx.getTextBounds(str + contentOffset, 0, 0, &x, &y, &w, &h);
m_cw = x + w;
m_ch = h;
m_gfx.getTextBounds(str, 0, 0, &x, &y, &w, &h);
m_w = x + w;
m_h = h;
if (m_valueFont)
{
m_h = m_valueFont->yAdvance;
}
if (!m_suffix.empty())
{
m_gfx.setFont(m_suffixFont);
m_gfx.getTextBounds(m_suffix.c_str(), 0, 0, &x, &y, &w, &h);
m_ch = std::max<int16_t>(m_ch, h);
m_cw += x + w;
m_w += x + w;
if (m_suffixFont)
{
m_h = std::max<int16_t>(m_h, m_suffixFont->yAdvance);
}
}
m_gfx.setFont(oldFont);
}
| 20.183486
| 103
| 0.673182
|
jeanleflambeur
|
764ba7f8fc894ca90ef780dc37de51f7c861d130
| 243
|
cpp
|
C++
|
gui/widgets/rotationwidget.cpp
|
r24y/PicoScan
|
9cd93b162cd2802962c76a3de7740198b9e936ab
|
[
"BSD-2-Clause"
] | 4
|
2016-11-29T18:33:34.000Z
|
2018-03-09T01:08:23.000Z
|
gui/widgets/rotationwidget.cpp
|
r24y/PicoScan
|
9cd93b162cd2802962c76a3de7740198b9e936ab
|
[
"BSD-2-Clause"
] | null | null | null |
gui/widgets/rotationwidget.cpp
|
r24y/PicoScan
|
9cd93b162cd2802962c76a3de7740198b9e936ab
|
[
"BSD-2-Clause"
] | 4
|
2015-10-22T11:54:09.000Z
|
2017-09-07T07:26:01.000Z
|
#include "rotationwidget.h"
#include "ui_rotationwidget.h"
RotationWidget::RotationWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::RotationWidget)
{
ui->setupUi(this);
}
RotationWidget::~RotationWidget()
{
delete ui;
}
| 16.2
| 49
| 0.703704
|
r24y
|
765348171cf87dc77937c7e7e5f53e614b95cc03
| 194,031
|
hxx
|
C++
|
test/convolution/tv_test_data.hxx
|
sstefan/vigra
|
f8826fa4de4293efb95582367f4bf42cc8ba8c11
|
[
"MIT"
] | null | null | null |
test/convolution/tv_test_data.hxx
|
sstefan/vigra
|
f8826fa4de4293efb95582367f4bf42cc8ba8c11
|
[
"MIT"
] | null | null | null |
test/convolution/tv_test_data.hxx
|
sstefan/vigra
|
f8826fa4de4293efb95582367f4bf42cc8ba8c11
|
[
"MIT"
] | null | null | null |
/************************************************************************/
/* */
/* Copyright 2012 by Frank Lenzen & */
/* Ullrich Koethe */
/* */
/* This file is part of the VIGRA computer vision library. */
/* The VIGRA Website is */
/* http://hci.iwr.uni-heidelberg.de/vigra/ */
/* Please direct questions, bug reports, and contributions to */
/* ullrich.koethe@iwr.uni-heidelberg.de or */
/* vigra@informatik.uni-hamburg.de */
/* */
/* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without */
/* restriction, including without limitation the rights to use, */
/* copy, modify, merge, publish, distribute, sublicense, and/or */
/* sell copies of the Software, and to permit persons to whom the */
/* Software is furnished to do so, subject to the following */
/* conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the */
/* Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES */
/* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */
/* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
/* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
/* OTHER DEALINGS IN THE SOFTWARE. */
/* */
/************************************************************************/
#ifndef __tv_test_data_h
#define __tv_test_data_h
double testdata[2500]={
255.,255.,237.,113.,80.,113.,252.,167.,113.,196.,200.,255.,15.,129.,255.,183.,164.,213.,224.,230.,235.,206.,210.,240.,230.,183.,193.,216.,116.,174.,114.,168.,148.,255.,198.,234.,193.,191.,206.,156.,246.,182.,117.,255.,153.,163.,177.,67.,129.,239.,
194.,242.,203.,224.,225.,130.,115.,168.,180.,210.,155.,190.,106.,179.,189.,213.,95.,207.,120.,251.,164.,136.,183.,225.,245.,146.,215.,255.,162.,249.,255.,225.,221.,191.,139.,225.,139.,239.,172.,215.,134.,203.,198.,128.,191.,255.,255.,189.,193.,142.,
202.,119.,137.,167.,216.,196.,255.,189.,168.,100.,239.,104.,242.,130.,102.,150.,85.,255.,168.,161.,255.,172.,255.,201.,222.,157.,157.,234.,108.,159.,232.,138.,168.,110.,144.,145.,209.,148.,240.,255.,255.,122.,181.,135.,122.,201.,228.,117.,219.,255.,
227.,223.,237.,206.,123.,199.,212.,177.,185.,229.,255.,255.,90.,188.,143.,248.,160.,220.,197.,210.,209.,158.,255.,203.,198.,161.,161.,218.,166.,235.,182.,163.,104.,229.,235.,255.,171.,102.,189.,187.,224.,156.,230.,255.,83.,255.,198.,181.,176.,132.,
197.,181.,183.,196.,253.,192.,240.,233.,240.,94.,195.,220.,216.,182.,255.,182.,178.,165.,225.,204.,205.,134.,221.,251.,234.,222.,194.,198.,196.,255.,245.,163.,233.,200.,218.,113.,245.,129.,217.,175.,255.,174.,216.,239.,223.,134.,222.,248.,99.,255.,
246.,204.,231.,121.,193.,245.,140.,107.,144.,87.,168.,187.,156.,163.,32.,255.,120.,11.,255.,255.,205.,191.,122.,97.,144.,190.,173.,214.,220.,106.,183.,213.,196.,206.,255.,172.,167.,188.,185.,255.,255.,171.,157.,253.,138.,155.,175.,211.,152.,169.,
198.,192.,191.,184.,156.,140.,222.,89.,162.,225.,162.,98.,181.,254.,177.,255.,216.,165.,116.,181.,132.,184.,110.,194.,222.,172.,182.,220.,172.,205.,224.,159.,117.,199.,201.,197.,133.,236.,161.,241.,152.,149.,161.,167.,170.,87.,189.,222.,174.,193.,
160.,173.,175.,169.,161.,209.,163.,240.,150.,180.,167.,239.,147.,195.,128.,219.,189.,148.,201.,187.,219.,193.,189.,246.,120.,33.,164.,168.,86.,137.,246.,248.,153.,255.,188.,185.,121.,160.,199.,175.,138.,230.,250.,219.,172.,181.,236.,217.,124.,196.,
189.,228.,204.,223.,183.,164.,163.,121.,124.,89.,119.,209.,217.,151.,177.,81.,135.,235.,255.,255.,204.,131.,195.,147.,183.,198.,110.,133.,156.,213.,188.,110.,212.,111.,248.,161.,141.,228.,162.,164.,143.,141.,185.,158.,139.,202.,153.,71.,243.,255.,
189.,154.,124.,244.,203.,191.,184.,231.,206.,251.,195.,184.,129.,211.,255.,196.,168.,138.,205.,91.,142.,44.,193.,140.,170.,188.,191.,217.,214.,173.,191.,191.,0.,255.,209.,214.,117.,223.,151.,167.,123.,115.,126.,62.,209.,211.,171.,142.,255.,203.,
255.,154.,206.,177.,171.,153.,255.,219.,188.,202.,182.,156.,162.,171.,174.,206.,92.,202.,217.,83.,180.,232.,200.,145.,110.,172.,223.,177.,219.,199.,215.,76.,89.,90.,168.,225.,208.,193.,195.,175.,83.,120.,255.,255.,255.,255.,235.,171.,216.,164.,
198.,119.,172.,44.,218.,187.,169.,119.,214.,172.,139.,173.,185.,248.,92.,224.,255.,217.,191.,165.,154.,191.,127.,97.,175.,169.,185.,180.,255.,142.,214.,161.,150.,171.,183.,165.,191.,255.,169.,178.,254.,244.,155.,247.,255.,185.,128.,148.,106.,192.,
207.,218.,100.,172.,210.,187.,218.,201.,135.,107.,177.,185.,255.,206.,200.,190.,212.,192.,148.,255.,189.,37.,206.,149.,212.,129.,255.,255.,236.,249.,130.,68.,141.,148.,227.,214.,176.,209.,145.,205.,255.,163.,215.,159.,110.,134.,158.,151.,92.,238.,
207.,246.,167.,255.,110.,62.,121.,237.,221.,154.,86.,42.,239.,222.,210.,158.,131.,100.,204.,255.,159.,197.,231.,237.,160.,224.,184.,255.,210.,104.,150.,218.,180.,152.,134.,116.,103.,114.,211.,250.,171.,187.,141.,218.,207.,195.,205.,209.,196.,179.,
67.,238.,203.,255.,86.,215.,160.,80.,255.,135.,183.,155.,181.,156.,130.,78.,180.,161.,212.,233.,255.,171.,230.,233.,194.,110.,165.,113.,255.,175.,220.,165.,85.,179.,150.,229.,169.,97.,199.,255.,168.,228.,180.,219.,239.,126.,204.,167.,184.,108.,
0.,178.,168.,193.,228.,171.,210.,135.,146.,243.,194.,82.,238.,251.,123.,169.,173.,135.,215.,244.,164.,231.,191.,209.,174.,255.,230.,152.,104.,209.,193.,204.,175.,208.,213.,47.,173.,255.,151.,147.,255.,209.,122.,154.,245.,255.,255.,218.,162.,92.,
0.,241.,80.,178.,211.,162.,166.,225.,133.,225.,249.,215.,83.,206.,215.,141.,139.,210.,208.,197.,198.,231.,224.,191.,200.,228.,186.,201.,200.,166.,112.,143.,154.,113.,142.,153.,122.,227.,198.,199.,214.,187.,255.,248.,216.,110.,215.,196.,255.,114.,
36.,222.,221.,190.,177.,167.,185.,235.,238.,158.,238.,135.,77.,186.,214.,178.,209.,77.,255.,199.,121.,161.,188.,198.,157.,191.,156.,164.,188.,207.,147.,219.,210.,222.,195.,185.,150.,223.,191.,214.,156.,194.,198.,244.,242.,91.,217.,158.,204.,130.,
51.,204.,107.,152.,255.,185.,230.,217.,126.,113.,213.,197.,255.,192.,179.,110.,172.,191.,177.,121.,143.,255.,168.,143.,176.,139.,177.,211.,218.,154.,205.,223.,126.,239.,136.,218.,176.,137.,145.,171.,193.,189.,156.,153.,84.,126.,198.,117.,134.,119.,
73.,125.,117.,210.,114.,212.,130.,173.,233.,238.,179.,185.,160.,114.,140.,182.,157.,194.,255.,163.,173.,169.,245.,214.,222.,134.,200.,217.,255.,131.,157.,188.,219.,180.,222.,136.,143.,162.,121.,184.,111.,60.,232.,223.,198.,251.,191.,227.,133.,0.,
46.,90.,153.,120.,209.,112.,241.,180.,174.,75.,187.,110.,123.,180.,255.,197.,215.,166.,196.,173.,230.,185.,165.,116.,99.,169.,90.,139.,230.,220.,255.,186.,228.,159.,179.,255.,115.,79.,225.,213.,215.,175.,151.,58.,226.,255.,245.,180.,38.,37.,
41.,163.,84.,162.,136.,243.,248.,199.,180.,185.,129.,255.,255.,244.,145.,130.,130.,170.,205.,207.,145.,205.,93.,204.,216.,236.,247.,140.,193.,194.,242.,240.,195.,144.,154.,173.,240.,225.,184.,207.,228.,255.,63.,215.,205.,235.,255.,212.,0.,61.,
39.,192.,156.,172.,168.,53.,192.,170.,165.,198.,146.,216.,134.,255.,157.,161.,141.,90.,120.,195.,157.,236.,157.,106.,161.,162.,241.,187.,226.,178.,126.,245.,210.,255.,255.,123.,255.,200.,112.,255.,216.,120.,158.,146.,216.,195.,160.,7.,39.,0.,
37.,220.,188.,240.,222.,206.,140.,151.,173.,208.,152.,114.,236.,234.,207.,157.,163.,195.,214.,195.,239.,125.,204.,206.,62.,255.,229.,234.,200.,193.,145.,146.,253.,247.,212.,226.,255.,187.,255.,202.,172.,145.,50.,208.,171.,0.,14.,0.,70.,25.,
38.,173.,162.,195.,125.,147.,240.,111.,188.,213.,143.,147.,150.,101.,143.,161.,226.,115.,212.,155.,188.,229.,73.,191.,97.,70.,49.,0.,90.,77.,19.,12.,31.,0.,11.,0.,29.,76.,1.,60.,0.,0.,0.,5.,0.,4.,20.,0.,9.,22.,
0.,239.,226.,142.,210.,213.,139.,117.,203.,135.,178.,151.,217.,207.,0.,184.,179.,255.,111.,252.,187.,97.,30.,0.,77.,0.,21.,78.,65.,0.,0.,79.,33.,0.,66.,29.,80.,13.,27.,36.,64.,0.,0.,0.,5.,70.,144.,0.,0.,9.,
0.,234.,190.,227.,152.,137.,127.,134.,176.,178.,189.,194.,163.,161.,255.,101.,161.,201.,255.,164.,193.,92.,13.,41.,0.,12.,114.,0.,0.,0.,27.,59.,22.,25.,17.,25.,90.,36.,73.,46.,107.,39.,0.,51.,32.,0.,24.,7.,0.,76.,
0.,222.,131.,96.,218.,200.,193.,142.,251.,203.,188.,175.,166.,96.,92.,255.,190.,196.,230.,191.,0.,29.,58.,0.,19.,59.,22.,0.,0.,24.,47.,52.,58.,0.,0.,0.,15.,24.,6.,108.,0.,0.,61.,99.,0.,6.,15.,56.,1.,88.,
1.,164.,204.,162.,173.,174.,230.,227.,222.,171.,220.,251.,183.,179.,178.,89.,152.,100.,122.,110.,6.,34.,67.,42.,162.,5.,0.,13.,3.,0.,67.,0.,130.,0.,99.,69.,0.,0.,0.,81.,23.,0.,2.,0.,0.,14.,88.,111.,0.,31.,
0.,183.,145.,215.,74.,225.,176.,102.,153.,167.,253.,113.,166.,204.,229.,208.,254.,218.,156.,0.,13.,59.,0.,0.,0.,46.,66.,39.,0.,0.,10.,0.,0.,11.,43.,0.,0.,87.,0.,8.,70.,2.,83.,0.,0.,0.,3.,31.,0.,30.,
0.,115.,243.,226.,230.,224.,160.,169.,170.,140.,199.,239.,169.,218.,204.,217.,101.,178.,143.,0.,95.,38.,0.,0.,0.,12.,46.,23.,60.,88.,23.,142.,55.,100.,0.,45.,0.,62.,78.,0.,62.,59.,46.,0.,23.,61.,79.,0.,59.,88.,
31.,87.,200.,230.,255.,255.,125.,140.,143.,235.,195.,170.,172.,190.,215.,223.,218.,38.,0.,0.,0.,9.,112.,49.,0.,44.,6.,0.,0.,0.,51.,0.,13.,81.,9.,8.,21.,0.,0.,13.,0.,0.,87.,126.,0.,36.,4.,73.,31.,55.,
18.,228.,255.,132.,148.,186.,149.,255.,215.,255.,210.,122.,132.,204.,255.,255.,127.,27.,18.,0.,0.,0.,0.,22.,25.,44.,27.,0.,0.,58.,105.,40.,31.,133.,22.,0.,40.,77.,0.,100.,0.,0.,0.,45.,16.,43.,0.,0.,9.,0.,
0.,169.,158.,194.,255.,157.,166.,85.,130.,57.,197.,197.,131.,255.,128.,118.,0.,0.,0.,12.,42.,72.,40.,1.,180.,1.,0.,38.,1.,0.,7.,21.,63.,59.,28.,22.,9.,3.,0.,0.,112.,10.,0.,0.,0.,58.,18.,11.,33.,0.,
0.,116.,141.,149.,219.,86.,107.,228.,112.,196.,134.,201.,176.,208.,166.,0.,0.,2.,15.,43.,0.,0.,0.,28.,0.,90.,35.,77.,0.,0.,69.,0.,3.,0.,2.,0.,23.,61.,43.,26.,48.,127.,0.,9.,0.,0.,56.,0.,0.,0.,
77.,135.,235.,247.,255.,243.,255.,138.,158.,179.,229.,210.,225.,85.,27.,0.,0.,47.,51.,70.,43.,0.,0.,75.,0.,0.,0.,4.,41.,79.,56.,38.,0.,1.,0.,0.,0.,39.,35.,8.,148.,47.,0.,0.,26.,25.,0.,5.,22.,0.,
0.,192.,129.,201.,228.,235.,177.,168.,137.,152.,129.,211.,44.,115.,0.,63.,38.,45.,0.,26.,80.,41.,204.,0.,0.,10.,30.,21.,0.,0.,94.,55.,0.,33.,16.,15.,55.,0.,0.,63.,39.,8.,0.,0.,61.,0.,36.,72.,47.,0.,
34.,173.,255.,190.,203.,255.,229.,112.,213.,126.,237.,140.,97.,40.,0.,6.,124.,6.,7.,0.,0.,44.,0.,43.,49.,0.,0.,0.,0.,0.,0.,65.,0.,0.,0.,0.,0.,0.,0.,18.,51.,97.,0.,53.,37.,0.,60.,0.,36.,0.,
27.,183.,180.,163.,169.,146.,109.,174.,99.,228.,126.,27.,95.,89.,0.,154.,27.,48.,0.,23.,15.,16.,70.,38.,87.,40.,45.,0.,61.,83.,6.,58.,70.,0.,35.,66.,63.,0.,23.,54.,0.,0.,0.,1.,9.,45.,39.,12.,41.,0.,
6.,110.,165.,171.,214.,173.,183.,228.,213.,40.,0.,35.,24.,1.,80.,25.,0.,0.,11.,39.,0.,49.,35.,128.,52.,37.,4.,47.,0.,71.,23.,13.,73.,51.,42.,0.,34.,47.,12.,76.,10.,1.,0.,0.,0.,99.,79.,0.,0.,0.,
42.,149.,184.,183.,254.,146.,213.,80.,41.,43.,0.,106.,82.,26.,0.,52.,0.,0.,0.,0.,3.,46.,5.,81.,52.,0.,34.,0.,109.,0.,68.,0.,39.,0.,0.,0.,71.,0.,81.,0.,75.,75.,0.,0.,0.,92.,60.,142.,41.,83.,
76.,164.,224.,185.,209.,226.,0.,32.,23.,0.,0.,67.,63.,82.,19.,0.,0.,0.,0.,0.,103.,0.,0.,0.,0.,0.,17.,0.,23.,65.,0.,6.,0.,8.,2.,0.,0.,0.,10.,0.,41.,39.,0.,0.,7.,45.,21.,0.,12.,49.,
31.,216.,170.,228.,204.,15.,89.,0.,0.,28.,14.,0.,0.,69.,43.,78.,62.,0.,0.,0.,0.,0.,0.,0.,113.,9.,27.,0.,0.,45.,0.,61.,0.,44.,30.,0.,0.,0.,38.,0.,0.,20.,57.,16.,0.,26.,93.,0.,0.,16.,
103.,166.,165.,133.,0.,71.,0.,18.,14.,55.,35.,0.,0.,72.,5.,2.,23.,0.,70.,0.,32.,22.,0.,107.,0.,89.,0.,59.,97.,30.,89.,57.,10.,56.,0.,57.,17.,58.,2.,0.,64.,0.,12.,0.,66.,0.,8.,127.,49.,0.,
11.,238.,85.,0.,0.,0.,3.,55.,0.,34.,0.,0.,17.,0.,58.,83.,15.,43.,0.,22.,0.,0.,0.,24.,33.,0.,0.,23.,0.,50.,0.,95.,0.,3.,0.,94.,87.,49.,51.,35.,0.,84.,45.,61.,0.,94.,0.,56.,0.,33.,
36.,106.,0.,24.,0.,53.,62.,0.,26.,101.,20.,16.,0.,0.,0.,0.,52.,0.,90.,0.,18.,0.,0.,0.,15.,40.,0.,0.,17.,44.,17.,2.,0.,24.,0.,48.,25.,0.,15.,0.,0.,51.,0.,0.,67.,78.,62.,12.,0.,24.,
0.,7.,0.,174.,2.,33.,0.,0.,35.,0.,61.,22.,34.,0.,106.,5.,10.,0.,0.,34.,0.,0.,0.,57.,49.,108.,0.,0.,22.,7.,39.,0.,13.,23.,0.,0.,0.,50.,76.,74.,116.,0.,75.,0.,26.,0.,85.,0.,23.,0.,
0.,15.,69.,27.,0.,0.,88.,0.,54.,47.,6.,64.,0.,20.,18.,0.,41.,0.,16.,15.,74.,0.,0.,0.,118.,75.,69.,20.,6.,0.,96.,0.,5.,113.,24.,89.,0.,8.,46.,0.,103.,0.,0.,0.,0.,17.,35.,0.,0.,6.,
0.,36.,9.,0.,44.,0.,80.,47.,0.,4.,64.,52.,79.,0.,0.,0.,58.,0.,0.,14.,0.,0.,0.,2.,44.,0.,0.,0.,11.,6.,0.,6.,0.,5.,42.,49.,104.,0.,21.,71.,0.,0.,0.,65.,0.,60.,0.,28.,22.,11.,
0.,101.,84.,23.,0.,0.,29.,59.,23.,73.,0.,98.,98.,0.,0.,0.,0.,0.,11.,95.,0.,0.,0.,15.,64.,0.,0.,97.,0.,0.,10.,69.,25.,0.,108.,0.,0.,86.,12.,0.,0.,28.,92.,9.,0.,28.,0.,36.,78.,80.
};
double result_std_tv[2500]={ 0.691859948730264,0.691859914672739,0.691859813135146,0.691859646019462,0.691859416478622,0.691859128868043,0.691858788639110,0.691858402151126,0.691857976390479,0.691857518607741,0.691857035910528,0.691856534871438,0.691856021214885,0.691855499630075,0.691854973726525,0.691854446116748,0.691853918588914,0.691853392325220,0.691852868127820,0.691852346628142,0.691851828469813,0.691851314463358,0.691850805708615,0.691850303670548,0.691849810184362,0.691849327367323,0.691848857434360,0.691848402448647,0.691847964071461,0.691847543387887,0.691847140864767,0.691846756450885,0.691846389778730,0.691846040397165,0.691845707967621,0.691845392386114,0.691845093829157,0.691844812743949,0.691844549805124,0.691844305849908,0.691844081794781,0.691843878538749,0.691843696868615,0.691843537389580,0.691843400499795,0.691843286410512,0.691843195195452,0.691843126846619,0.691843081320735,0.691843058571839,
0.691859976735363,0.691859942544089,0.691859840598512,0.691859672782069,0.691859442222092,0.691859153248443,0.691858811295347,0.691858422721640,0.691857994536865,0.691857534042586,0.691857048425423,0.691856544360395,0.691856027688797,0.691855503219445,0.691854974671819,0.691854444747609,0.691853915294830,0.691853387521252,0.691852862219579,0.691852339980144,0.691851821380518,0.691851307148709,0.691850798294304,0.691850296192201,0.691849802594642,0.691849319549264,0.691848849220500,0.691848393644960,0.691847954483828,0.691847532847561,0.691847129248952,0.691846743695620,0.691846375883388,0.691846025421976,0.691845692026664,0.691845375637689,0.691845076463970,0.691844794970358,0.691844531831014,0.691844287862600,0.691844063942644,0.691843860919058,0.691843679524754,0.691843520317548,0.691843383661201,0.691843269748261,0.691843178648930,0.691843110363965,0.691843064866101,0.691843042125983,
0.691860061000206,0.691860026412151,0.691859923252903,0.691859753341751,0.691859519717672,0.691859226622658,0.691858879432119,0.691858484502744,0.691858048920414,0.691857580153108,0.691857085641715,0.691856572385993,0.691856046592154,0.691855513436471,0.691854976970122,0.691854440157406,0.691853905015506,0.691853372815233,0.691852844306543,0.691852319943825,0.691851800097272,0.691851285242324,0.691850776116929,0.691850273828481,0.691849779885691,0.691849296134332,0.691848824594833,0.691848367230883,0.691847925708522,0.691847501217383,0.691847094409197,0.691846705467680,0.691846334277224,0.691845980627878,0.691845644393254,0.691845325641877,0.691845024674579,0.691844742003899,0.691844478298799,0.691844234313350,0.691844010810677,0.691843808490420,0.691843627929567,0.691843469548381,0.691843333609691,0.691843220249530,0.691843129524865,0.691843061458491,0.691843016066348,0.691842993364644,
0.691860202393489,0.691860167159998,0.691860062014855,0.691859888641172,0.691859649890825,0.691859349820303,0.691858993680851,0.691858587821811,0.691858139478715,0.691857656442227,0.691857146635917,0.691856617660902,0.691856076381233,0.691855528616412,0.691854978978478,0.691854430854918,0.691853886511595,0.691853347279100,0.691852813787350,0.691852286220246,0.691851764569488,0.691851248870733,0.691850739404479,0.691850236839776,0.691849742296306,0.691849257306083,0.691848783674128,0.691848323265248,0.691847877771164,0.691847448524387,0.691847036412593,0.691846641912192,0.691846265217444,0.691845906411690,0.691845565622150,0.691845243117531,0.691844939335691,0.691844654852805,0.691844390318021,0.691844146378583,0.691843923614403,0.691843722492909,0.691843543348254,0.691843386385006,0.691843251704278,0.691843139346429,0.691843049337898,0.691842981724837,0.691842936579895,0.691842913981700,
0.691860402715227,0.691860366615516,0.691860258778774,0.691860080632899,0.691859834679068,0.691859524625660,0.691859155488695,0.691858733594476,0.691858266433495,0.691857762345627,0.691857230059424,0.691856678151356,0.691856114517914,0.691855545950430,0.691854977869278,0.691854414229671,0.691853857579625,0.691853309238780,0.691852769563267,0.691852238260051,0.691851714714852,0.691851198301437,0.691850688644465,0.691850185810920,0.691849690408200,0.691849203574659,0.691848726864450,0.691848262051730,0.691847810902489,0.691847374974387,0.691846955496993,0.691846553356752,0.691846169173767,0.691845803427830,0.691845456581362,0.691845129157859,0.691844821757798,0.691844535018521,0.691844269542169,0.691844025822369,0.691843804195556,0.691843604829692,0.691843427748061,0.691843272876276,0.691843140099717,0.691843029321231,0.691842940508090,0.691842873713403,0.691842829059639,0.691842806686635,
0.691860665061773,0.691860627925338,0.691860516815833,0.691860332713860,0.691860077503597,0.691859754276437,0.691859367622619,0.691858923803684,0.691858430712069,0.691857897568358,0.691857334373979,0.691856751207910,0.691856157502914,0.691855561436255,0.691854969519639,0.691854386407111,0.691853814903304,0.691853256150456,0.691852709961865,0.691852175248002,0.691851650469216,0.691851134055447,0.691850624751404,0.691850121862539,0.691849625387900,0.691849136034416,0.691848655118946,0.691848184381496,0.691847725751951,0.691847281124902,0.691846852194305,0.691846440378694,0.691846046835465,0.691845672533044,0.691845318335215,0.691844985056438,0.691844673465804,0.691844384241643,0.691844117900029,0.691843874731328,0.691843654775049,0.691843457846184,0.691843283604710,0.691843131646105,0.691843001590657,0.691842893157295,0.691842806211801,0.691842740777009,0.691842696994395,0.691842675042544,
0.691860994037041,0.691860955786029,0.691860841061620,0.691860650095456,0.691860383730196,0.691860044000978,0.691859634745279,0.691859162060416,0.691858634436293,0.691858062457791,0.691857458087461,0.691856833667157,0.691856200863244,0.691855569778707,0.691854948356669,0.691854342075789,0.691853753901982,0.691853184503503,0.691852632714327,0.691852096159628,0.691851571916126,0.691851057096934,0.691850549301521,0.691850046915412,0.691849549265406,0.691849056641396,0.691848570198553,0.691848091762106,0.691847623571287,0.691847168012397,0.691846727393557,0.691846303799398,0.691845899035589,0.691845514642469,0.691845151937761,0.691844812047518,0.691844495899892,0.691844204180262,0.691843937269486,0.691843695200113,0.691843477661816,0.691843284067762,0.691843113668333,0.691842965682126,0.691842839414792,0.691842734347954,0.691842650188985,0.691842586872163,0.691842544503270,0.691842523256060,
0.691861395590531,0.691861356321352,0.691861238105168,0.691861039958175,0.691860761011016,0.691860401525879,0.691859964023143,0.691859454216322,0.691858881439817,0.691858258352208,0.691857599907443,0.691856921830341,0.691856239001185,0.691855564155641,0.691854907084185,0.691854274226440,0.691853668537062,0.691853089734568,0.691852534989866,0.691851999902313,0.691851479506195,0.691850969100027,0.691850464820580,0.691849963978871,0.691849465206989,0.691848968456410,0.691848474872246,0.691847986563020,0.691847506295723,0.691847037162980,0.691846582278820,0.691846144551096,0.691845726551904,0.691845330473289,0.691844958130767,0.691844610972411,0.691844290065721,0.691843996059091,0.691843729138615,0.691843489013830,0.691843274961450,0.691843085935060,0.691842920721982,0.691842778111164,0.691842657037440,0.691842556682238,0.691842476523596,0.691842416330589,0.691842376098388,0.691842355934691,
0.691861876318765,0.691861836450785,0.691861715750335,0.691861511303518,0.691861219472061,0.691860837569092,0.691860365814136,0.691859809076147,0.691859177827804,0.691858487863102,0.691857758714931,0.691857011188317,0.691856264768091,0.691855535714255,0.691854836150933,0.691854173666402,0.691853550964114,0.691852966079103,0.691852413450136,0.691851885526312,0.691851374359167,0.691850872782795,0.691850375107842,0.691849877438779,0.691849377751082,0.691848875817102,0.691848373015400,0.691847872032901,0.691847376477183,0.691846890444145,0.691846418107510,0.691845963393799,0.691845529776942,0.691845120183668,0.691844736967720,0.691844381904174,0.691844056173310,0.691843760332381,0.691843494297763,0.691843257369827,0.691843048324619,0.691842865573571,0.691842707365682,0.691842571990333,0.691842457942286,0.691842364028789,0.691842289416241,0.691842233619162,0.691842196433950,0.691842177829625,
0.691862442159096,0.691862402684780,0.691862282107597,0.691862074505263,0.691861771812335,0.691861366452529,0.691860854613017,0.691860239380004,0.691859532679806,0.691858755081443,0.691857933241199,0.691857095722859,0.691856268603637,0.691855472652030,0.691854722782807,0.691854028112455,0.691853390866698,0.691852806262936,0.691852264288253,0.691851752504193,0.691851258655451,0.691850772311254,0.691850285593595,0.691849793340205,0.691849293002974,0.691848784435958,0.691848269603653,0.691847752185901,0.691847237067707,0.691846729759747,0.691846235839076,0.691845760502888,0.691845308288331,0.691844882946117,0.691844487406804,0.691844123773143,0.691843793303874,0.691843496395516,0.691843232593728,0.691843000667523,0.691842798762717,0.691842624624304,0.691842475851674,0.691842350137704,0.691842245450254,0.691842160138334,0.691842092968807,0.691842043108360,0.691842010062652,0.691841993585804,
0.691863096462764,0.691863059335590,0.691862944220910,0.691862740615292,0.691862433464701,0.691862007102369,0.691861450611854,0.691860763410820,0.691859959132584,0.691859065743475,0.691858121281484,0.691857166544483,0.691856237097342,0.691855358821073,0.691854549407520,0.691853820612080,0.691853174282753,0.691852600974917,0.691852083299310,0.691851601160690,0.691851136186931,0.691850673819515,0.691850203761462,0.691849719694126,0.691849218824082,0.691848701467920,0.691848170650124,0.691847631604866,0.691847091099585,0.691846556635205,0.691846035664744,0.691845534983133,0.691845060377924,0.691844616511209,0.691844206920461,0.691843834029440,0.691843499129372,0.691843202361554,0.691842942757723,0.691842718376948,0.691842526542595,0.691842364149177,0.691842227986025,0.691842115018629,0.691842022583360,0.691841948482928,0.691841891001639,0.691841848873020,0.691841821226444,0.691841807528175,
0.691863837400089,0.691863806087391,0.691863706170487,0.691863520425283,0.691863222981852,0.691862784835827,0.691862182484857,0.691861407876916,0.691860476301583,0.691859427449107,0.691858318121060,0.691857209413227,0.691856150892757,0.691855172109910,0.691854291318065,0.691853526898590,0.691852881690169,0.691852338174699,0.691851866229355,0.691851433507007,0.691851013244693,0.691850586151228,0.691850139703512,0.691849666872087,0.691849165093282,0.691848635639914,0.691848083182400,0.691847515250903,0.691846941339727,0.691846371760652,0.691845816502677,0.691845284373767,0.691844782601532,0.691844316812908,0.691843891155721,0.691843508358291,0.691843169686558,0.691842874897075,0.691842622300136,0.691842408981562,0.691842231160152,0.691842084615203,0.691841965104322,0.691841868698545,0.691841791987494,0.691841732149789,0.691841686926290,0.691841654554739,0.691841633717002,0.691841623523193,
0.691864654537668,0.691864634723687,0.691864566379952,0.691864423058343,0.691864162694084,0.691863734446932,0.691863092399122,0.691862213227125,0.691861112883480,0.691859850127351,0.691858513397149,0.691857199968196,0.691855981955800,0.691854883911898,0.691853913272770,0.691853110742208,0.691852484953827,0.691852002505485,0.691851610044707,0.691851254996522,0.691850900128995,0.691850521949749,0.691850106872581,0.691849648156081,0.691849144138400,0.691848597568190,0.691848015384015,0.691847408379185,0.691846789984565,0.691846174532275,0.691845575491863,0.691845004184034,0.691844469392052,0.691843977648122,0.691843533656544,0.691843140438201,0.691842799183235,0.691842509093210,0.691842267453210,0.691842069984503,0.691841911389952,0.691841785961387,0.691841688130456,0.691841612874839,0.691841555929484,0.691841513808244,0.691841483697625,0.691841463317889,0.691841450847014,0.691841444962343,
0.691865524348588,0.691865524643475,0.691865513482940,0.691865453368132,0.691865279337920,0.691864905160549,0.691864244947420,0.691863243503490,0.691861913967137,0.691860347332784,0.691858684556242,0.691857093135351,0.691855690192854,0.691854464895668,0.691853363556366,0.691852514590942,0.691851942397104,0.691851575547743,0.691851316612878,0.691851078047890,0.691850813561630,0.691850499113793,0.691850122988716,0.691849680447307,0.691849171418377,0.691848600408126,0.691847977030834,0.691847316632188,0.691846638396109,0.691845962542003,0.691845307437141,0.691844687448350,0.691844112755897,0.691843590448319,0.691843125637982,0.691842721704651,0.691842379790552,0.691842098334086,0.691841873140023,0.691841697972798,0.691841565418219,0.691841467764641,0.691841397739639,0.691841349009587,0.691841316387350,0.691841295764778,0.691841283859985,0.691841277921921,0.691841275568638,0.691841274912522,
0.691866404617081,0.691866436795779,0.691866519542820,0.691866606429854,0.691866603550638,0.691866367807651,0.691865743087607,0.691864604739521,0.691862953591298,0.691860940780059,0.691858783213199,0.691856795559979,0.691855217590976,0.691853918051125,0.691852557321314,0.691851637754623,0.691851191344758,0.691851038761289,0.691851002467063,0.691850928364307,0.691850779910777,0.691850542264167,0.691850210791734,0.691849784998038,0.691849266490384,0.691848661039570,0.691847980366964,0.691847246330915,0.691846486764894,0.691845730799474,0.691845004025769,0.691844324236644,0.691843702079815,0.691843144174646,0.691842655784781,0.691842241043169,0.691841901341286,0.691841634111128,0.691841432953919,0.691841288751856,0.691841191089565,0.691841129545015,0.691841094667519,0.691841078597656,0.691841075252626,0.691841080104688,0.691841089671714,0.691841100901678,0.691841110758131,0.691841116465813,
0.691867228644596,0.691867306241890,0.691867528593319,0.691867855337783,0.691868165494077,0.691868223085954,0.691867757359136,0.691866480189541,0.691864355234336,0.691861678282317,0.691858710184846,0.691856085454834,0.691854462723150,0.691853427645618,0.691851304682603,0.691850282633836,0.691850142107729,0.691850382696761,0.691850724928292,0.691850853688165,0.691850837869984,0.691850683147815,0.691850397910576,0.691849987870146,0.691849454233826,0.691848802264850,0.691848041638204,0.691847204942508,0.691846333439337,0.691845470170891,0.691844652432770,0.691843901033828,0.691843224177724,0.691842625451310,0.691842110024619,0.691841684254702,0.691841350789733,0.691841105712560,0.691840939147979,0.691840837592704,0.691840786329858,0.691840771281019,0.691840780231241,0.691840803616609,0.691840834656457,0.691840868883434,0.691840903227575,0.691840934784763,0.691840959671391,0.691840973312600,
0.691867902607922,0.691868035784134,0.691868437247918,0.691869123742373,0.691869981738168,0.691870602494544,0.691870583227604,0.691869203069987,0.691866307989915,0.691862705390681,0.691858291423986,0.691854369949508,0.691841515337232,0.691846598223604,0.691848944495578,0.691848039301643,0.691848705858169,0.691849620698331,0.691850658808787,0.691850923604206,0.691851036687135,0.691850958135863,0.691850714623099,0.691850319842554,0.691849766021923,0.691849057556016,0.691848183579090,0.691847201687150,0.691846173560176,0.691845163862047,0.691844232592929,0.691843399986549,0.691842664060150,0.691842019299853,0.691841471156237,0.691841032941079,0.691840711165591,0.691840499701235,0.691840382673810,0.691840339681532,0.691840349842343,0.691840394237754,0.691840457152787,0.691840527217102,0.691840597424631,0.691840664280329,0.691840726375955,0.691840782147239,0.691840826624550,0.691840850582813,
0.691868313630517,0.691868500096999,0.691869062554717,0.691870220906434,0.691872033733298,0.691873619496815,0.691874767433931,0.691873438669515,0.691868966313771,0.691864541806135,0.691857377656194,0.691818133021488,0.691825087508045,0.691832368363344,0.691839159860508,0.691844215845963,0.691847013733636,0.691848729727796,0.691850457595452,0.691851144907192,0.691851428960873,0.691851401699730,0.691851187500580,0.691850816535541,0.691850238417366,0.691849484076884,0.691848438364048,0.691847248267626,0.691845997071062,0.691844778899520,0.691843711852154,0.691842798375752,0.691842007901804,0.691841311476815,0.691840717915962,0.691840261962250,0.691839959543977,0.691839799134244,0.691839753419975,0.691839790941178,0.691839882197191,0.691840002245281,0.691840130803843,0.691840254734894,0.691840367692203,0.691840468599978,0.691840559992439,0.691840644948233,0.691840718291294,0.691840756041995,
0.674670310592041,0.678900007103735,0.680268274624755,0.685510254955687,0.689650880654277,0.690778516454565,0.691335371284154,0.691539909788838,0.691595568108660,0.691660156296807,0.691753681397991,0.691796197248505,0.691816680910873,0.691828690404607,0.691836921536957,0.691842640530494,0.691846394155357,0.691849011465305,0.691851007138520,0.691851768951024,0.691852134642540,0.691852036301021,0.691851822540632,0.691851526582671,0.691850893564762,0.691850208306377,0.691848843106611,0.691847360157488,0.691845789861288,0.691844242863200,0.691843035304912,0.691842069607314,0.691841252306734,0.691840495038634,0.691839821810974,0.691839333339652,0.691839063295355,0.691838982757364,0.691839041086751,0.691839189535787,0.691839387381827,0.691839603626469,0.691839811035352,0.691839995139971,0.691840151834358,0.691840284169930,0.691840401749141,0.691840521168315,0.691840647637181,0.691840701500902,
0.674669720482187,0.674666441080962,0.675341928746662,0.679352851546529,0.682300363898698,0.686189813982560,0.687832644224254,0.689330358497640,0.690527502518011,0.691037049196508,0.691238608277192,0.691374774334723,0.691457957864557,0.691546980283941,0.691671013942943,0.691748374644714,0.691791774071662,0.691823773094989,0.691842064061829,0.691847060343312,0.691850615485050,0.691852129234617,0.691852545944556,0.691852580657162,0.691851608271068,0.691851619617383,0.691849372000906,0.691847564397371,0.691845562332656,0.691843367894823,0.691842114807680,0.691841188147812,0.691840430897097,0.691839588215219,0.691838734963728,0.691838181367723,0.691837974045116,0.691838025453260,0.691838237748176,0.691838538628742,0.691838874451762,0.691839214208741,0.691839514820131,0.691839762998645,0.691839960164297,0.691840114168512,0.691840241320633,0.691840390238674,0.614158940132033,0.346455099577785,
0.674672067246774,0.674668794719504,0.674800824300060,0.675900418909825,0.678985223435245,0.681872643649978,0.684941295221863,0.685462234289148,0.685206714559290,0.684233384958667,0.686556063311009,0.687853440838783,0.688922272744228,0.690128919611627,0.691058448185945,0.691353004226020,0.691544339527754,0.691648961498063,0.691736568685976,0.691779707170130,0.691810770316137,0.691824237281202,0.691833756539657,0.691843735288330,0.691851347400411,0.691855297800813,0.691849468094534,0.691847968866996,0.691845530816463,0.691841552541983,0.691840865836264,0.691840132786601,0.691839688699154,0.691838685000449,0.691837341753106,0.691836677415636,0.691836621743141,0.691836904336579,0.691837344016454,0.691837851675694,0.691838356778616,0.691838863107665,0.691839269970790,0.691839580482051,0.691839809960954,0.691839969108629,0.691840057168615,0.688422462141666,0.346455099188676,0.346455099376395,
0.674680858846682,0.674677169936218,0.674709538784511,0.675057906007725,0.676397161312509,0.679808119769980,0.682702808108888,0.683757467897874,0.684231737426916,0.684232756007831,0.685017843729856,0.686871674267806,0.687804259176072,0.688196609292452,0.686334203856437,0.684966490590324,0.685583977077557,0.687564142206318,0.689294418355145,0.690175136352124,0.690447987215297,0.690845015729224,0.690940065614090,0.691426798606015,0.691709164596963,0.691829745115491,0.691845241577485,0.691849318480591,0.691847043660972,0.691836447059314,0.691837114238033,0.691838783646992,0.691839499345585,0.691838113695196,0.691835262217099,0.691834558365011,0.691834926114739,0.691835622460040,0.691836379739445,0.691837165403734,0.691837836283567,0.691838609865960,0.691839119555140,0.691839476676696,0.691839727386172,0.691839892164070,0.691839976962231,0.662736677750353,0.184779655156550,0.198226534873917,
0.674697109085718,0.674696881554305,0.674697813553028,0.674784255845738,0.674875526708067,0.674746828415849,0.677046010127314,0.678640288557759,0.680177377710610,0.681481812011059,0.682266770149740,0.684023516057974,0.684952179065568,0.685744070707020,0.684808010218891,0.684717864001169,0.684470799013161,0.684425464131369,0.685648006170737,0.687446873484595,0.688360158263942,0.689222945273565,0.689375403037985,0.689476107421266,0.690371361024520,0.691255652121242,0.691649473711001,0.691744372183667,0.691796459118017,0.691822197280611,0.691832788745075,0.691838383291002,0.691841403951155,0.691838999888713,0.691831027081750,0.691831360721585,0.691832896249570,0.691834275384968,0.691835383924465,0.691836591489191,0.691837210972554,0.675567954271411,0.672915008096403,0.670925703263064,0.672160240464959,0.662599764265182,0.532985549252823,0.151553817538643,0.145549057907166,0.135564741340254,
0.674714049437771,0.674715663660592,0.674722439108775,0.674741983263671,0.674769508950552,0.674750296853823,0.674834747246417,0.675350895896347,0.676611673475602,0.677912903504244,0.678380931508671,0.679630697508136,0.682570173757608,0.684057708231358,0.684306658653224,0.684401747334784,0.684423373839071,0.684424494083303,0.684997382918227,0.685959566410856,0.686902586156906,0.687270603449481,0.688167990386860,0.688476427017918,0.688647222375860,0.690325649432605,0.691011303363268,0.691335728748652,0.691470878720529,0.691545808166527,0.691587588284929,0.691666686059672,0.691761645084457,0.691797444437459,0.691818477437934,0.691826953979101,0.691831016789269,0.691833194223340,0.691834285467981,0.681140245234297,0.629170567390571,0.565371768319708,0.493081862556140,0.534820686118001,0.493684948163369,0.160669739698407,0.134816955841523,0.134819324737023,0.135564747680489,0.135564741673089,
0.674728000786288,0.674729529343316,0.674734539547467,0.674743526923825,0.674751348882994,0.674744094708147,0.674765174986809,0.674754078070151,0.675186755968997,0.675491680293669,0.674811950819951,0.674802415849680,0.674805894477982,0.674816805938266,0.675809784004680,0.678154988801427,0.680087973572922,0.679991142714809,0.681311096305577,0.681635918560996,0.682477776446648,0.682564978968949,0.572741632238766,0.565179983697700,0.420773845063155,0.311747998331594,0.227767662658209,0.176745484366842,0.252926211601876,0.244193706381223,0.145649691968667,0.134816742833337,0.134816412581896,0.134816048261380,0.134815682808248,0.134815364444190,0.154600478441215,0.197689043390296,0.134816221395940,0.168160112916793,0.134815025246846,0.134814901903375,0.134814822115465,0.134814812975962,0.134814907582154,0.134816141520226,0.134816993259744,0.134819520712538,0.134802071718055,0.134812285978782,
0.674738963117228,0.674740021472752,0.674742845927266,0.674746449488512,0.674748446152931,0.674745682503160,0.674748362100419,0.674741077524145,0.674859668664586,0.674823816989188,0.674810031258118,0.674803893158794,0.674805482352523,0.674816599748878,0.674771698529187,0.675882458005553,0.677272514383569,0.678157135140429,0.677337547354246,0.678291883703194,0.675320777661936,0.519518311658853,0.302224164952464,0.178625882205147,0.195339741832813,0.170441266747164,0.176745476929902,0.176745482275167,0.167878478902598,0.134817799568710,0.134816992789115,0.134816750316134,0.134816417673006,0.134816053494825,0.134815688297762,0.134815375226847,0.138907704962262,0.134816512631909,0.134816223669337,0.134815157556596,0.134815030469769,0.134814906321995,0.134814826489018,0.134814817220364,0.134814924589921,0.134815278770931,0.134815356882413,0.134814690305369,0.134810135908648,0.134811531031385,
0.674747657835112,0.674748675540128,0.674750464440477,0.674751181223338,0.674750533918869,0.674749139542383,0.674749405495647,0.674748242599922,0.674797738967951,0.674802996773500,0.674800550656355,0.674797547294598,0.674795263009040,0.674785774382947,0.674780405520213,0.674893248936028,0.675535675467458,0.676364086259205,0.676554264723128,0.675321465963468,0.675321038314141,0.293544319292088,0.177690731595341,0.177405343270078,0.170441241735088,0.170441253851617,0.171378575235342,0.140990286052972,0.134818130314401,0.134817787991318,0.134817263542389,0.134816853055295,0.134816459486895,0.134816065097261,0.134815647245516,0.134815103306941,0.134817921604370,0.134816779999840,0.134815916529514,0.134815312028750,0.134815036976245,0.134814870710150,0.134814764520073,0.134814708854354,0.134814698466201,0.134814695302364,0.134814468128490,0.134813750800429,0.134812255738633,0.134812176416981,
0.674754032830886,0.674756366699586,0.674759163211968,0.674757424371353,0.674753568727926,0.674751152613734,0.674752107538772,0.674759182420172,0.674783743632270,0.674790158636302,0.674791763677425,0.674790499682345,0.674788986496509,0.674785398261166,0.674783887793559,0.674840492196701,0.675045512899165,0.675376002249916,0.675321694579758,0.675321637979896,0.256842992838874,0.175333652878865,0.173837438370228,0.170441212192296,0.170441228471451,0.170441243386705,0.136974343061157,0.134819028130659,0.134818490324287,0.134817963486230,0.134817425372174,0.134816943988473,0.134816507338818,0.134816105534003,0.134815737909573,0.134815434801638,0.134815423304464,0.134815247924471,0.134815353707331,0.134815141021855,0.134814938909268,0.134814779302682,0.134814656256355,0.134814559292324,0.134814468977670,0.134814339473553,0.134814073074311,0.134813592791523,0.134812964283005,0.134812747154829,
0.674738524701498,0.674754921351753,0.674768684715616,0.674765782809958,0.674755232274673,0.674749893057046,0.674748783781283,0.674752755386740,0.674770377520895,0.674782260312563,0.674785897151285,0.674783733483558,0.674784833429815,0.674782959343162,0.674786686192913,0.674774860943910,0.674750074056740,0.671938717427531,0.626404839881563,0.410085688917473,0.173235841835645,0.171390885604193,0.170441213198595,0.170441196614982,0.170441213895388,0.135223062868873,0.134820336690584,0.134819592663570,0.134818844254441,0.134818155221280,0.134817535523218,0.134816995322269,0.134816525569204,0.134816117113222,0.134815769481641,0.134815498873466,0.134815340789291,0.134815195229467,0.134815113591463,0.134814963711915,0.134814802671051,0.134814655678650,0.134814526196146,0.134814407251574,0.134814282702584,0.134814124436040,0.134813895766446,0.134813586991687,0.134813265691162,0.134813105144230,
0.673450790237264,0.674175931005220,0.674612766273900,0.674719717874865,0.674723340997487,0.674729585969987,0.674740267755577,0.674741923837470,0.674751405917740,0.674763461300706,0.674773410033844,0.674773671235612,0.674774674738841,0.674774950440305,0.674768643603465,0.674767143955125,0.674760140145923,0.671366002666067,0.570305854042227,0.181858764853523,0.156269810972774,0.152947676163214,0.138843690215776,0.134832657916066,0.134834579224785,0.134821548265941,0.134821215425629,0.134820166272433,0.134819143650619,0.134818282588784,0.134817571250802,0.134816981368636,0.134816487734255,0.134816073154019,0.134815729337245,0.134815455668554,0.134815250774974,0.134815083445628,0.134814946307428,0.134814802067808,0.134814656855131,0.134814518973022,0.134814389954248,0.134814265071676,0.134814134291741,0.134813983859689,0.134813802590896,0.134813597791196,0.134813410518896,0.134813306824318,
0.672777447768279,0.673296118045604,0.674519611615755,0.674683626553041,0.674717043870435,0.674706551097211,0.674711510470502,0.674730795695029,0.674740050416070,0.674748291471755,0.674757030774625,0.674766405971567,0.674770486647865,0.674768537569156,0.674765770440236,0.674764595886303,0.674762769331104,0.652938696750977,0.365307417920538,0.143164481368460,0.143908044082139,0.136403522683280,0.134835092281529,0.134833072205114,0.134830837791015,0.134825469410812,0.134822814731369,0.134820717903369,0.134819286281420,0.134818265206255,0.134817490626159,0.134816876361679,0.134816376098264,0.134815963711499,0.134815624312432,0.134815348887386,0.134815128259552,0.134814946383726,0.134814790883237,0.134814646049545,0.134814508284449,0.134814377905376,0.134814253992356,0.134814133109998,0.134814009759374,0.134813878270642,0.134813737057373,0.134813595177631,0.134813475914173,0.134813408979683,
0.672628891500582,0.672842671791750,0.673850188926352,0.674367957073461,0.674608747754372,0.674670267376165,0.674694598392094,0.674713624391227,0.674728352022939,0.674741508342925,0.674745699303264,0.674743068809570,0.674754403899240,0.674762803338615,0.674764216418578,0.674762511201778,0.674762771691456,0.308502703436269,0.139298177152267,0.136787712858090,0.135113045526588,0.134841112069345,0.134837914264731,0.134833702392428,0.134830232429978,0.134826680093624,0.134823860082233,0.134820608757129,0.134819023141138,0.134818006328871,0.134817254832279,0.134816662591229,0.134816181871338,0.134815786577050,0.134815460581285,0.134815192508205,0.134814972085832,0.134814787917846,0.134814629638634,0.134814487699669,0.134814356968126,0.134814234919002,0.134814119452054,0.134814007972933,0.134813897631840,0.134813786599775,0.134813676336282,0.134813574073560,0.134813493105680,0.134813448330190,
0.672366702325895,0.672622770227124,0.673161658507278,0.673285385170288,0.673635175989613,0.674035827544723,0.674290105018258,0.674551979576819,0.674638196384411,0.674688023611377,0.674707613506055,0.674725889067502,0.674731967745574,0.674745381586706,0.674754085631205,0.674758362858755,0.436403904559970,0.138891766507633,0.136201938248821,0.135087263248623,0.134864502854893,0.134850529049518,0.134841750206760,0.134833591738923,0.134829711458469,0.134827161351428,0.134818573883912,0.134818838348272,0.134818196035139,0.134817487201184,0.134816864988730,0.134816342586832,0.134815907541029,0.134815545462018,0.134815244206023,0.134814993685990,0.134814784769042,0.134814608563458,0.134814456938170,0.134814322914489,0.134814201634224,0.134814089910938,0.134813985382020,0.134813886057638,0.134813790465930,0.134813698357197,0.134813611757636,0.134813535785195,0.134813478199637,0.134813446994534,
0.669525980330377,0.670264896025248,0.671039789228801,0.671751110321711,0.672216866784897,0.671389494346237,0.670720943657620,0.670119747490632,0.670122689111558,0.670120865943028,0.670907441403927,0.670982473542246,0.670123373368143,0.670248325897316,0.625304932270922,0.469601951160754,0.139425107447207,0.136138064189845,0.135259899163667,0.134918340521816,0.134878809185963,0.134854746613097,0.134828657793123,0.134829203664125,0.134827862255021,0.134819065736686,0.134818402548350,0.134817979575428,0.134817440468214,0.134816886622432,0.134816380611892,0.134815940563006,0.134815565597406,0.134815248857407,0.134814982376796,0.134814758465266,0.134814569848252,0.134814409626361,0.134814271517984,0.134814150151356,0.134814041394104,0.134813942247237,0.134813850538167,0.134813764739126,0.134813684055937,0.134813608768607,0.134813540657019,0.134813483175335,0.134813440954978,0.134813418485021,
0.669504271698210,0.669623494184210,0.670058744252893,0.670361851489806,0.670534863487703,0.670174587189798,0.670120090463018,0.670121648049655,0.670121765393018,0.670121449362189,0.670109249822645,0.670129095974716,0.670124938710106,0.670072964922279,0.530905032277106,0.143934740625915,0.136488995365410,0.135771598062832,0.135089846190026,0.134902438548411,0.134832100675243,0.134837088588333,0.134829134358334,0.134826704626788,0.134824137835354,0.134819595549820,0.134817995883927,0.134817241957925,0.134816704797104,0.134816243478016,0.134815835616860,0.134815478832158,0.134815170799128,0.134814907325974,0.134814683245273,0.134814493129338,0.134814331608131,0.134814193537448,0.134814074197884,0.134813969498893,0.134813876142630,0.134813791626671,0.134813714152383,0.134813642568207,0.134813576420374,0.134813516095968,0.134813462956227,0.134813419289102,0.134813387916440,0.134813371448422,
0.669503769038536,0.669557202052195,0.669877905021817,0.670121057666367,0.670179187567379,0.670163090294994,0.670134411615537,0.670124919739289,0.670121228708420,0.670119304121045,0.670115404564061,0.670119374447168,0.670122260037303,0.381929481767059,0.173811624925353,0.136723568950366,0.136452159388570,0.135678698788315,0.135035770412363,0.134820872790567,0.134826689592503,0.134821975220039,0.134824087731746,0.134824344870684,0.134816718029671,0.134817187172209,0.134816748393086,0.134816292712191,0.134815898555173,0.134815552230406,0.134815244941945,0.134814973749633,0.134814736810295,0.134814531711942,0.134814355376194,0.134814204325496,0.134814074931064,0.134813963609262,0.134813867002525,0.134813782140787,0.134813706560670,0.134813638350433,0.134813576144745,0.134813519120399,0.134813467023832,0.134813420218443,0.134813379696059,0.134813346972098,0.134813323804372,0.134813311758841,
0.663109546143978,0.666182077323402,0.667641070824755,0.668791092384820,0.669327402192908,0.669422826383951,0.668788924345016,0.667581990094968,0.658607596184019,0.656366505503776,0.655007576849927,0.654220312234926,0.352975200048593,0.280362877966901,0.136717142016895,0.136723515381128,0.136485698997728,0.135453782592639,0.134839115096822,0.134826664474088,0.134822064449697,0.134820180104035,0.134820899062530,0.134815673560268,0.134815639196597,0.134815691723693,0.134815522968869,0.134815287242509,0.134815049868523,0.134814827377955,0.134814623607244,0.134814439820808,0.134814276327905,0.134814132599396,0.134814007384116,0.134813898911548,0.134813805101923,0.134813723754687,0.134813652715601,0.134813590018485,0.134813533991912,0.134813483322513,0.134813437085091,0.134813394759877,0.134813356248748,0.134813321882246,0.134813292389480,0.134813268795843,0.134813252230132,0.134813243665218,
0.660971290218866,0.663265917213156,0.665706455010382,0.666816816525600,0.667674200548033,0.668110462991309,0.667802265331582,0.655456100069631,0.655513468929438,0.655013925974034,0.655010536944541,0.436870310598132,0.256687845477857,0.137964393126966,0.136719330647727,0.136729898681855,0.136508171930534,0.134899476208629,0.134817113733738,0.134810603362736,0.134814726128982,0.134815785055372,0.134816105483945,0.134814809371938,0.134814478747630,0.134814422883270,0.134814369922566,0.134814288892632,0.134814191803586,0.134814089307714,0.134813987753430,0.134813890997111,0.134813801388863,0.134813720171403,0.134813647723050,0.134813583774370,0.134813527609462,0.134813478246416,0.134813434594868,0.134813395588000,0.134813360285207,0.134813327943617,0.134813298063206,0.134813270413730,0.134813245047790,0.134813222295402,0.134813202727346,0.134813187073753,0.134813176095276,0.134813170425622,
0.654419624264967,0.655865207842868,0.656648646622712,0.656026284011846,0.655654867604634,0.655071471644961,0.655066873087148,0.655071006272498,0.655024876476551,0.655019195144562,0.401010260389323,0.172445344425243,0.137964943429034,0.137964422801298,0.136767664229990,0.136746907656391,0.135205255637351,0.134827879648534,0.134803945245059,0.134807451311721,0.134810456431238,0.134812133179526,0.134812933210883,0.134812985008812,0.134813049056171,0.134813156736294,0.134813250581446,0.134813312246950,0.134813344768369,0.134813355865246,0.134813352588830,0.134813340406141,0.134813323314467,0.134813304090462,0.134813284529614,0.134813265665663,0.134813247968623,0.134813231519671,0.134813216162130,0.134813201627704,0.134813187637018,0.134813173974570,0.134813160540566,0.134813147383251,0.134813134713502,0.134813122899732,0.134813112438250,0.134813103895221,0.134813097822903,0.134813094663511,
0.654409657280157,0.654456516737700,0.654989252176128,0.655102961504243,0.655081452722943,0.655073105868420,0.655066443079641,0.655059719571699,0.655042089054934,0.228925488275832,0.139878936841342,0.137965759399320,0.137965464349402,0.137964846460260,0.136937672112980,0.135671089649482,0.134889805335367,0.134795761250904,0.134801186408915,0.134804807051541,0.134807521234821,0.134809363816992,0.134810514876707,0.134811154209669,0.134811581612731,0.134811910320195,0.134812169294979,0.134812370569411,0.134812524902109,0.134812642433951,0.134812731838432,0.134812800083463,0.134812852569494,0.134812893372257,0.134812925488607,0.134812951059995,0.134812971569250,0.134812988011106,0.134813001037788,0.134813011080608,0.134813018448223,0.134813023402430,0.134813026213096,0.134813027194164,0.134813026721894,0.134813025235116,0.134813023216493,0.134813021154988,0.134813019493481,0.134813018570687,
0.654422461217103,0.654434981063255,0.654690609455371,0.654839097421153,0.654911882014309,0.654853508407253,0.654840609834737,0.349502955878787,0.169195288480337,0.138695425230588,0.137966758510231,0.137966696271987,0.137966292927090,0.137963768441858,0.136072324756174,0.135348472257331,0.134798137886659,0.134797514796521,0.134800240735626,0.134803077018104,0.134805464746369,0.134807292664851,0.134808614728324,0.134809541701192,0.134810219159679,0.134810739858159,0.134811151837575,0.134811481846545,0.134811747710157,0.134811962842164,0.134812137780307,0.134812280860034,0.134812398646998,0.134812496274149,0.134812577719077,0.134812646035942,0.134812703551012,0.134812752028047,0.134812792807828,0.134812826924550,0.134812855200806,0.134812878322434,0.134812896894576,0.134812911480317,0.134812922623045,0.134812930853265,0.134812936680600,0.134812940572616,0.134812942924199,0.134812944023683,
0.654424854555197,0.654428677011861,0.654554274928654,0.654646073492123,0.654713965490289,0.654717767741183,0.169284523105591,0.148520173448046,0.138139080142228,0.137966342138523,0.137968054440141,0.137967958082240,0.137966597958504,0.137963730912350,0.135759126263725,0.134870540016345,0.134790468761784,0.134795929623500,0.134799193999619,0.134801804006303,0.134803975912031,0.134805734763590,0.134807116759074,0.134808185585554,0.134809020179447,0.134809684672008,0.134810222742910,0.134810663480184,0.134811027261221,0.134811329239144,0.134811581146163,0.134811792257452,0.134811969971111,0.134812120203262,0.134812247682328,0.134812356180708,0.134812448703347,0.134812527644260,0.134812594917562,0.134812652066930,0.134812700355786,0.134812740839667,0.134812774421985,0.134812801894331,0.134812823962501,0.134812841259377,0.134812854346021,0.134812863702905,0.134812869714336,0.134812872650246,
0.594049327309036,0.620456064439652,0.630064520892325,0.636745535368329,0.631934933649774,0.152849628418578,0.147723554666063,0.138013379470543,0.137969348096620,0.137970850001312,0.137971141403289,0.137970466764142,0.137968394097516,0.137961031852852,0.135429800637237,0.134797702961658,0.134794860416301,0.134796551533469,0.134798811308569,0.134800978059020,0.134802908531701,0.134804561677831,0.134805939576950,0.134807071048880,0.134807998412042,0.134808762794933,0.134809397639630,0.134809928484746,0.134810374772054,0.134810751593075,0.134811070914922,0.134811342377182,0.134811573819231,0.134811771648700,0.134811941114459,0.134812086518945,0.134812211389430,0.134812318619673,0.134812410588813,0.134812489261501,0.134812556271530,0.134812612990276,0.134812660580942,0.134812700039551,0.134812732223764,0.134812757870694,0.134812777605118,0.134812791939801,0.134812801270251,0.134812805866756,
0.559177985685406,0.565131929605172,0.553398393966261,0.470795756951916,0.143050206125379,0.141895544688842,0.137989692647598,0.137992553629027,0.137980266858546,0.137976548549094,0.137975175372035,0.137974355382094,0.137975463120487,0.137890803860978,0.134820190563361,0.134792379740455,0.134794729341825,0.134796615208442,0.134798531474768,0.134800397677992,0.134802127291722,0.134803672247875,0.134805016885438,0.134806168381467,0.134807147104354,0.134807977658196,0.134808683452465,0.134809284664454,0.134809798053975,0.134810237428775,0.134810614199031,0.134810937846279,0.134811216286372,0.134811456147521,0.134811662987308,0.134811841466697,0.134811995493308,0.134812128342012,0.134812242757927,0.134812341044834,0.134812425140587,0.134812496680382,0.134812557048447,0.134812607418812,0.134812648785959,0.134812681986330,0.134812707711803,0.134812726516509,0.134812738818612,0.134812744899018,
0.384620752632406,0.441707518068502,0.312791421259183,0.138406204612606,0.137985435312988,0.137984923362573,0.137986897713992,0.137986850113186,0.137982594310022,0.137979880437092,0.137978635493303,0.137976218611121,0.137977230768424,0.135265601509697,0.134791241950486,0.134793460015715,0.134795072636621,0.134796658782884,0.134798311615202,0.134799963398582,0.134801539837577,0.134802991906692,0.134804295772886,0.134805446608865,0.134806451776302,0.134807324773600,0.134808081007794,0.134808735478260,0.134809301800163,0.134809791948398,0.134810216313413,0.134810583861074,0.134810902309321,0.134811178291607,0.134811417500218,0.134811624810465,0.134811804388846,0.134811959788201,0.134812094032122,0.134812209689915,0.134812308942627,0.134812393640243,0.134812465350079,0.134812525396594,0.134812574893023,0.134812614765442,0.134812645770002,0.134812668504235,0.134812683413528,0.134812690794140,
0.195395090983684,0.206969182824403,0.138021776132189,0.137980338152418,0.137984982950693,0.137985753013790,0.137986100392001,0.137985330248198,0.137983356235851,0.137981720635962,0.137980892610650,0.137977453056103,0.137977649882544,0.134794969731193,0.134796063765553,0.134795156167595,0.134795452761406,0.134796645873066,0.134798102769281,0.134799614143797,0.134801086128581,0.134802468832360,0.134803736440954,0.134804878936499,0.134805896719419,0.134806796403951,0.134807587707820,0.134808281430516,0.134808888303923,0.134809418421603,0.134809881001858,0.134810284324341,0.134810635749529,0.134810941774284,0.134811208100893,0.134811439709270,0.134811640928039,0.134811815502875,0.134811966661416,0.134812097174201,0.134812209410903,0.134812305391106,0.134812386829035,0.134812455171927,0.134812511631997,0.134812557212173,0.134812592725888,0.134812618811404,0.134812635941351,0.134812644428444,
0.137997625578614,0.138000477116683,0.138002883572465,0.137991819097407,0.137987366535583,0.137986979772859,0.137986395502034,0.137984989545533,0.137983755613994,0.137982729623199,0.137982205036781,0.137979031287384,0.137978465467656,0.134801913712390,0.134802896006900,0.134793519199443,0.134794946531392,0.134796379347812,0.134797849473396,0.134799314099794,0.134800731276096,0.134802070156741,0.134803311231290,0.134804444668500,0.134805468108661,0.134806384389380,0.134807199561153,0.134807921377340,0.134808558264940,0.134809118682285,0.134809610747757,0.134810042042369,0.134810419517942,0.134810749467178,0.134811037529199,0.134811288715121,0.134811507444922,0.134811697590678,0.134811862523123,0.134812005159325,0.134812128009635,0.134812233222329,0.134812322624719,0.134812397759914,0.134812459918706,0.134812510166312,0.134812549363841,0.134812578184575,0.134812597125437,0.134812606514341,
0.137997613936991,0.137998029315218,0.137997428675677,0.137993196802926,0.137990129224727,0.137988377726256,0.137987486679759,0.137984541181422,0.137983922523323,0.137983212970965,0.137982784767852,0.137980695022884,0.137979568289733,0.134830482318077,0.134789598040577,0.134792488425782,0.134794445245828,0.134796085784915,0.134797611797963,0.134799071452241,0.134800464457763,0.134801778782898,0.134803002876178,0.134804129299415,0.134805155205509,0.134806081639823,0.134806912498736,0.134807653525469,0.134808311494000,0.134808893609473,0.134809407097900,0.134809858941530,0.134810255718405,0.134810603513095,0.134810907874656,0.134811173805454,0.134811405770223,0.134811607718473,0.134811783115652,0.134811934979642,0.134812065919828,0.134812178176499,0.134812273658819,0.134812353980087,0.134812420489352,0.134812474298718,0.134812516305850,0.134812547211463,0.134812567531939,0.134812577607624,
0.137996740174488,0.137996566038585,0.137995573791734,0.137993380569072,0.137991547792415,0.137988116735589,0.137987677104859,0.137984853216593,0.137984155587730,0.137983390385117,0.137982624143012,0.137981511135820,0.137980537035676,0.134786181263534,0.134790004336950,0.134792402192615,0.134794270819586,0.134795917109124,0.134797450684579,0.134798905500112,0.134800286183462,0.134801587282446,0.134802801565923,0.134803923508659,0.134804950474389,0.134805882759615,0.134806723115918,0.134807476100964,0.134808147446289,0.134808743526094,0.134809270949888,0.134809736270553,0.134810145787166,0.134810505419933,0.134810820637362,0.134811096420260,0.134811337251436,0.134811547123373,0.134811729558359,0.134811887636923,0.134812024031197,0.134812141040504,0.134812240627019,0.134812324449886,0.134812393896549,0.134812450110338,0.134812494013562,0.134812526325692,0.134812547576601,0.134812558115362,
0.137996183629936,0.137995889929083,0.137994889431075,0.137993174429630,0.137991224059182,0.137988921847113,0.137987398061130,0.137985569302615,0.137984431330978,0.137983544087251,0.137982785689411,0.137982164113272,0.137981050628137,0.134792692510800,0.134791847470634,0.134792856117874,0.134794329321397,0.134795871542137,0.134797378583369,0.134798823793360,0.134800197441424,0.134801492337330,0.134802702077379,0.134803821863309,0.134804849226225,0.134805784194761,0.134806629031230,0.134807387749615,0.134808065582102,0.134808668492081,0.134809202776492,0.134809674765674,0.134810090610843,0.134810456142522,0.134810776782800,0.134811057496922,0.134811302773129,0.134811516622720,0.134811702594457,0.134811863798773,0.134812002938153,0.134812122340709,0.134812223994627,0.134812309581658,0.134812380508286,0.134812437933418,0.134812482791751,0.134812515812251,0.134812537531682,0.134812548303598,
};
double result_std_tv_weight[2500]={ 0.691859948730264,0.691859914672739,0.691859813135146,0.691859646019462,0.691859416478622,0.691859128868043,0.691858788639110,0.691858402151126,0.691857976390479,0.691857518607741,0.691857035910528,0.691856534871438,0.691856021214885,0.691855499630075,0.691854973726525,0.691854446116748,0.691853918588914,0.691853392325220,0.691852868127820,0.691852346628142,0.691851828469813,0.691851314463358,0.691850805708615,0.691850303670548,0.691849810184362,0.691849327367323,0.691848857434360,0.691848402448647,0.691847964071461,0.691847543387887,0.691847140864767,0.691846756450885,0.691846389778730,0.691846040397165,0.691845707967621,0.691845392386114,0.691845093829157,0.691844812743949,0.691844549805124,0.691844305849908,0.691844081794781,0.691843878538749,0.691843696868615,0.691843537389580,0.691843400499795,0.691843286410512,0.691843195195452,0.691843126846619,0.691843081320735,0.691843058571839,
0.691859976735363,0.691859942544089,0.691859840598512,0.691859672782069,0.691859442222092,0.691859153248443,0.691858811295347,0.691858422721640,0.691857994536865,0.691857534042586,0.691857048425423,0.691856544360395,0.691856027688797,0.691855503219445,0.691854974671819,0.691854444747609,0.691853915294830,0.691853387521252,0.691852862219579,0.691852339980144,0.691851821380518,0.691851307148709,0.691850798294304,0.691850296192201,0.691849802594642,0.691849319549264,0.691848849220500,0.691848393644960,0.691847954483828,0.691847532847561,0.691847129248952,0.691846743695620,0.691846375883388,0.691846025421976,0.691845692026664,0.691845375637689,0.691845076463970,0.691844794970358,0.691844531831014,0.691844287862600,0.691844063942644,0.691843860919058,0.691843679524754,0.691843520317548,0.691843383661201,0.691843269748261,0.691843178648930,0.691843110363965,0.691843064866101,0.691843042125983,
0.691860061000206,0.691860026412151,0.691859923252903,0.691859753341751,0.691859519717672,0.691859226622658,0.691858879432119,0.691858484502744,0.691858048920414,0.691857580153108,0.691857085641715,0.691856572385993,0.691856046592154,0.691855513436471,0.691854976970122,0.691854440157406,0.691853905015506,0.691853372815233,0.691852844306543,0.691852319943825,0.691851800097272,0.691851285242324,0.691850776116929,0.691850273828481,0.691849779885691,0.691849296134332,0.691848824594833,0.691848367230883,0.691847925708522,0.691847501217383,0.691847094409197,0.691846705467680,0.691846334277224,0.691845980627878,0.691845644393254,0.691845325641877,0.691845024674579,0.691844742003899,0.691844478298799,0.691844234313350,0.691844010810677,0.691843808490420,0.691843627929567,0.691843469548381,0.691843333609691,0.691843220249530,0.691843129524865,0.691843061458491,0.691843016066348,0.691842993364644,
0.691860202393489,0.691860167159998,0.691860062014855,0.691859888641172,0.691859649890825,0.691859349820303,0.691858993680851,0.691858587821811,0.691858139478715,0.691857656442227,0.691857146635917,0.691856617660902,0.691856076381233,0.691855528616412,0.691854978978478,0.691854430854918,0.691853886511595,0.691853347279100,0.691852813787350,0.691852286220246,0.691851764569488,0.691851248870733,0.691850739404479,0.691850236839776,0.691849742296306,0.691849257306083,0.691848783674128,0.691848323265248,0.691847877771164,0.691847448524387,0.691847036412593,0.691846641912192,0.691846265217444,0.691845906411690,0.691845565622150,0.691845243117531,0.691844939335691,0.691844654852805,0.691844390318021,0.691844146378583,0.691843923614403,0.691843722492909,0.691843543348254,0.691843386385006,0.691843251704278,0.691843139346429,0.691843049337898,0.691842981724837,0.691842936579895,0.691842913981700,
0.691860402715227,0.691860366615516,0.691860258778774,0.691860080632899,0.691859834679068,0.691859524625660,0.691859155488695,0.691858733594476,0.691858266433495,0.691857762345627,0.691857230059424,0.691856678151356,0.691856114517914,0.691855545950430,0.691854977869278,0.691854414229671,0.691853857579625,0.691853309238780,0.691852769563267,0.691852238260051,0.691851714714852,0.691851198301437,0.691850688644465,0.691850185810920,0.691849690408200,0.691849203574659,0.691848726864450,0.691848262051730,0.691847810902489,0.691847374974387,0.691846955496993,0.691846553356752,0.691846169173767,0.691845803427830,0.691845456581362,0.691845129157859,0.691844821757798,0.691844535018521,0.691844269542169,0.691844025822369,0.691843804195556,0.691843604829692,0.691843427748061,0.691843272876276,0.691843140099717,0.691843029321231,0.691842940508090,0.691842873713403,0.691842829059639,0.691842806686635,
0.691860665061773,0.691860627925338,0.691860516815833,0.691860332713860,0.691860077503597,0.691859754276437,0.691859367622619,0.691858923803684,0.691858430712069,0.691857897568358,0.691857334373979,0.691856751207910,0.691856157502914,0.691855561436255,0.691854969519639,0.691854386407111,0.691853814903304,0.691853256150456,0.691852709961865,0.691852175248002,0.691851650469216,0.691851134055447,0.691850624751404,0.691850121862539,0.691849625387900,0.691849136034416,0.691848655118946,0.691848184381496,0.691847725751951,0.691847281124902,0.691846852194305,0.691846440378694,0.691846046835465,0.691845672533044,0.691845318335215,0.691844985056438,0.691844673465804,0.691844384241643,0.691844117900029,0.691843874731328,0.691843654775049,0.691843457846184,0.691843283604710,0.691843131646105,0.691843001590657,0.691842893157295,0.691842806211801,0.691842740777009,0.691842696994395,0.691842675042544,
0.691860994037041,0.691860955786029,0.691860841061620,0.691860650095456,0.691860383730196,0.691860044000978,0.691859634745279,0.691859162060416,0.691858634436293,0.691858062457791,0.691857458087461,0.691856833667157,0.691856200863244,0.691855569778707,0.691854948356669,0.691854342075789,0.691853753901982,0.691853184503503,0.691852632714327,0.691852096159628,0.691851571916126,0.691851057096934,0.691850549301521,0.691850046915412,0.691849549265406,0.691849056641396,0.691848570198553,0.691848091762106,0.691847623571287,0.691847168012397,0.691846727393557,0.691846303799398,0.691845899035589,0.691845514642469,0.691845151937761,0.691844812047518,0.691844495899892,0.691844204180262,0.691843937269486,0.691843695200113,0.691843477661816,0.691843284067762,0.691843113668333,0.691842965682126,0.691842839414792,0.691842734347954,0.691842650188985,0.691842586872163,0.691842544503270,0.691842523256060,
0.691861395590531,0.691861356321352,0.691861238105168,0.691861039958175,0.691860761011016,0.691860401525879,0.691859964023143,0.691859454216322,0.691858881439817,0.691858258352208,0.691857599907443,0.691856921830341,0.691856239001185,0.691855564155641,0.691854907084185,0.691854274226440,0.691853668537062,0.691853089734568,0.691852534989866,0.691851999902313,0.691851479506195,0.691850969100027,0.691850464820580,0.691849963978871,0.691849465206989,0.691848968456410,0.691848474872246,0.691847986563020,0.691847506295723,0.691847037162980,0.691846582278820,0.691846144551096,0.691845726551904,0.691845330473289,0.691844958130767,0.691844610972411,0.691844290065721,0.691843996059091,0.691843729138615,0.691843489013830,0.691843274961450,0.691843085935060,0.691842920721982,0.691842778111164,0.691842657037440,0.691842556682238,0.691842476523596,0.691842416330589,0.691842376098388,0.691842355934691,
0.691861876318765,0.691861836450785,0.691861715750335,0.691861511303518,0.691861219472061,0.691860837569092,0.691860365814136,0.691859809076147,0.691859177827804,0.691858487863102,0.691857758714931,0.691857011188317,0.691856264768091,0.691855535714255,0.691854836150933,0.691854173666402,0.691853550964114,0.691852966079103,0.691852413450136,0.691851885526312,0.691851374359167,0.691850872782795,0.691850375107842,0.691849877438779,0.691849377751082,0.691848875817102,0.691848373015400,0.691847872032901,0.691847376477183,0.691846890444145,0.691846418107510,0.691845963393799,0.691845529776942,0.691845120183668,0.691844736967720,0.691844381904174,0.691844056173310,0.691843760332381,0.691843494297763,0.691843257369827,0.691843048324619,0.691842865573571,0.691842707365682,0.691842571990333,0.691842457942286,0.691842364028789,0.691842289416241,0.691842233619162,0.691842196433950,0.691842177829625,
0.691862442159096,0.691862402684780,0.691862282107597,0.691862074505263,0.691861771812335,0.691861366452529,0.691860854613017,0.691860239380004,0.691859532679806,0.691858755081443,0.691857933241199,0.691857095722859,0.691856268603637,0.691855472652030,0.691854722782807,0.691854028112455,0.691853390866698,0.691852806262936,0.691852264288253,0.691851752504193,0.691851258655451,0.691850772311254,0.691850285593595,0.691849793340205,0.691849293002974,0.691848784435958,0.691848269603653,0.691847752185901,0.691847237067707,0.691846729759747,0.691846235839076,0.691845760502888,0.691845308288331,0.691844882946117,0.691844487406804,0.691844123773143,0.691843793303874,0.691843496395516,0.691843232593728,0.691843000667523,0.691842798762717,0.691842624624304,0.691842475851674,0.691842350137704,0.691842245450254,0.691842160138334,0.691842092968807,0.691842043108360,0.691842010062652,0.691841993585804,
0.691863096462764,0.691863059335590,0.691862944220910,0.691862740615292,0.691862433464701,0.691862007102369,0.691861450611854,0.691860763410820,0.691859959132584,0.691859065743475,0.691858121281484,0.691857166544483,0.691856237097342,0.691855358821073,0.691854549407520,0.691853820612080,0.691853174282753,0.691852600974917,0.691852083299310,0.691851601160690,0.691851136186931,0.691850673819515,0.691850203761462,0.691849719694126,0.691849218824082,0.691848701467920,0.691848170650124,0.691847631604866,0.691847091099585,0.691846556635205,0.691846035664744,0.691845534983133,0.691845060377924,0.691844616511209,0.691844206920461,0.691843834029440,0.691843499129372,0.691843202361554,0.691842942757723,0.691842718376948,0.691842526542595,0.691842364149177,0.691842227986025,0.691842115018629,0.691842022583360,0.691841948482928,0.691841891001639,0.691841848873020,0.691841821226444,0.691841807528175,
0.691863837400089,0.691863806087391,0.691863706170487,0.691863520425283,0.691863222981852,0.691862784835827,0.691862182484857,0.691861407876916,0.691860476301583,0.691859427449107,0.691858318121060,0.691857209413227,0.691856150892757,0.691855172109910,0.691854291318065,0.691853526898590,0.691852881690169,0.691852338174699,0.691851866229355,0.691851433507007,0.691851013244693,0.691850586151228,0.691850139703512,0.691849666872087,0.691849165093282,0.691848635639914,0.691848083182400,0.691847515250903,0.691846941339727,0.691846371760652,0.691845816502677,0.691845284373767,0.691844782601532,0.691844316812908,0.691843891155721,0.691843508358291,0.691843169686558,0.691842874897075,0.691842622300136,0.691842408981562,0.691842231160152,0.691842084615203,0.691841965104322,0.691841868698545,0.691841791987494,0.691841732149789,0.691841686926290,0.691841654554739,0.691841633717002,0.691841623523193,
0.691864654537668,0.691864634723687,0.691864566379952,0.691864423058343,0.691864162694084,0.691863734446932,0.691863092399122,0.691862213227125,0.691861112883480,0.691859850127351,0.691858513397149,0.691857199968196,0.691855981955800,0.691854883911898,0.691853913272770,0.691853110742208,0.691852484953827,0.691852002505485,0.691851610044707,0.691851254996522,0.691850900128995,0.691850521949749,0.691850106872581,0.691849648156081,0.691849144138400,0.691848597568190,0.691848015384015,0.691847408379185,0.691846789984565,0.691846174532275,0.691845575491863,0.691845004184034,0.691844469392052,0.691843977648122,0.691843533656544,0.691843140438201,0.691842799183235,0.691842509093210,0.691842267453210,0.691842069984503,0.691841911389952,0.691841785961387,0.691841688130456,0.691841612874839,0.691841555929484,0.691841513808244,0.691841483697625,0.691841463317889,0.691841450847014,0.691841444962343,
0.691865524348588,0.691865524643475,0.691865513482940,0.691865453368132,0.691865279337920,0.691864905160549,0.691864244947420,0.691863243503490,0.691861913967137,0.691860347332784,0.691858684556242,0.691857093135351,0.691855690192854,0.691854464895668,0.691853363556366,0.691852514590942,0.691851942397104,0.691851575547743,0.691851316612878,0.691851078047890,0.691850813561630,0.691850499113793,0.691850122988716,0.691849680447307,0.691849171418377,0.691848600408126,0.691847977030834,0.691847316632188,0.691846638396109,0.691845962542003,0.691845307437141,0.691844687448350,0.691844112755897,0.691843590448319,0.691843125637982,0.691842721704651,0.691842379790552,0.691842098334086,0.691841873140023,0.691841697972798,0.691841565418219,0.691841467764641,0.691841397739639,0.691841349009587,0.691841316387350,0.691841295764778,0.691841283859985,0.691841277921921,0.691841275568638,0.691841274912522,
0.691866404617081,0.691866436795779,0.691866519542820,0.691866606429854,0.691866603550638,0.691866367807651,0.691865743087607,0.691864604739521,0.691862953591298,0.691860940780059,0.691858783213199,0.691856795559979,0.691855217590976,0.691853918051125,0.691852557321314,0.691851637754623,0.691851191344758,0.691851038761289,0.691851002467063,0.691850928364307,0.691850779910777,0.691850542264167,0.691850210791734,0.691849784998038,0.691849266490384,0.691848661039570,0.691847980366964,0.691847246330915,0.691846486764894,0.691845730799474,0.691845004025769,0.691844324236644,0.691843702079815,0.691843144174646,0.691842655784781,0.691842241043169,0.691841901341286,0.691841634111128,0.691841432953919,0.691841288751856,0.691841191089565,0.691841129545015,0.691841094667519,0.691841078597656,0.691841075252626,0.691841080104688,0.691841089671714,0.691841100901678,0.691841110758131,0.691841116465813,
0.691867228644596,0.691867306241890,0.691867528593319,0.691867855337783,0.691868165494077,0.691868223085954,0.691867757359136,0.691866480189541,0.691864355234336,0.691861678282317,0.691858710184846,0.691856085454834,0.691854462723150,0.691853427645618,0.691851304682603,0.691850282633836,0.691850142107729,0.691850382696761,0.691850724928292,0.691850853688165,0.691850837869984,0.691850683147815,0.691850397910576,0.691849987870146,0.691849454233826,0.691848802264850,0.691848041638204,0.691847204942508,0.691846333439337,0.691845470170891,0.691844652432770,0.691843901033828,0.691843224177724,0.691842625451310,0.691842110024619,0.691841684254702,0.691841350789733,0.691841105712560,0.691840939147979,0.691840837592704,0.691840786329858,0.691840771281019,0.691840780231241,0.691840803616609,0.691840834656457,0.691840868883434,0.691840903227575,0.691840934784763,0.691840959671391,0.691840973312600,
0.691867902607922,0.691868035784134,0.691868437247918,0.691869123742373,0.691869981738168,0.691870602494544,0.691870583227604,0.691869203069987,0.691866307989915,0.691862705390681,0.691858291423986,0.691854369949508,0.691841515337232,0.691846598223604,0.691848944495578,0.691848039301643,0.691848705858169,0.691849620698331,0.691850658808787,0.691850923604206,0.691851036687135,0.691850958135863,0.691850714623099,0.691850319842554,0.691849766021923,0.691849057556016,0.691848183579090,0.691847201687150,0.691846173560176,0.691845163862047,0.691844232592929,0.691843399986549,0.691842664060150,0.691842019299853,0.691841471156237,0.691841032941079,0.691840711165591,0.691840499701235,0.691840382673810,0.691840339681532,0.691840349842343,0.691840394237754,0.691840457152787,0.691840527217102,0.691840597424631,0.691840664280329,0.691840726375955,0.691840782147239,0.691840826624550,0.691840850582813,
0.691868313630517,0.691868500096999,0.691869062554717,0.691870220906434,0.691872033733298,0.691873619496815,0.691874767433931,0.691873438669515,0.691868966313771,0.691864541806135,0.691857377656194,0.691818133021488,0.691825087508045,0.691832368363344,0.691839159860508,0.691844215845963,0.691847013733636,0.691848729727796,0.691850457595452,0.691851144907192,0.691851428960873,0.691851401699730,0.691851187500580,0.691850816535541,0.691850238417366,0.691849484076884,0.691848438364048,0.691847248267626,0.691845997071062,0.691844778899520,0.691843711852154,0.691842798375752,0.691842007901804,0.691841311476815,0.691840717915962,0.691840261962250,0.691839959543977,0.691839799134244,0.691839753419975,0.691839790941178,0.691839882197191,0.691840002245281,0.691840130803843,0.691840254734894,0.691840367692203,0.691840468599978,0.691840559992439,0.691840644948233,0.691840718291294,0.691840756041995,
0.674670310592041,0.678900007103735,0.680268274624755,0.685510254955687,0.689650880654277,0.690778516454565,0.691335371284154,0.691539909788838,0.691595568108660,0.691660156296807,0.691753681397991,0.691796197248505,0.691816680910873,0.691828690404607,0.691836921536957,0.691842640530494,0.691846394155357,0.691849011465305,0.691851007138520,0.691851768951024,0.691852134642540,0.691852036301021,0.691851822540632,0.691851526582671,0.691850893564762,0.691850208306377,0.691848843106611,0.691847360157488,0.691845789861288,0.691844242863200,0.691843035304912,0.691842069607314,0.691841252306734,0.691840495038634,0.691839821810974,0.691839333339652,0.691839063295355,0.691838982757364,0.691839041086751,0.691839189535787,0.691839387381827,0.691839603626469,0.691839811035352,0.691839995139971,0.691840151834358,0.691840284169930,0.691840401749141,0.691840521168315,0.691840647637181,0.691840701500902,
0.674669720482187,0.674666441080962,0.675341928746662,0.679352851546529,0.682300363898698,0.686189813982560,0.687832644224254,0.689330358497640,0.690527502518011,0.691037049196508,0.691238608277192,0.691374774334723,0.691457957864557,0.691546980283941,0.691671013942943,0.691748374644714,0.691791774071662,0.691823773094989,0.691842064061829,0.691847060343312,0.691850615485050,0.691852129234617,0.691852545944556,0.691852580657162,0.691851608271068,0.691851619617383,0.691849372000906,0.691847564397371,0.691845562332656,0.691843367894823,0.691842114807680,0.691841188147812,0.691840430897097,0.691839588215219,0.691838734963728,0.691838181367723,0.691837974045116,0.691838025453260,0.691838237748176,0.691838538628742,0.691838874451762,0.691839214208741,0.691839514820131,0.691839762998645,0.691839960164297,0.691840114168512,0.691840241320633,0.691840390238674,0.614158940132033,0.346455099577785,
0.674672067246774,0.674668794719504,0.674800824300060,0.675900418909825,0.678985223435245,0.681872643649978,0.684941295221863,0.685462234289148,0.685206714559290,0.684233384958667,0.686556063311009,0.687853440838783,0.688922272744228,0.690128919611627,0.691058448185945,0.691353004226020,0.691544339527754,0.691648961498063,0.691736568685976,0.691779707170130,0.691810770316137,0.691824237281202,0.691833756539657,0.691843735288330,0.691851347400411,0.691855297800813,0.691849468094534,0.691847968866996,0.691845530816463,0.691841552541983,0.691840865836264,0.691840132786601,0.691839688699154,0.691838685000449,0.691837341753106,0.691836677415636,0.691836621743141,0.691836904336579,0.691837344016454,0.691837851675694,0.691838356778616,0.691838863107665,0.691839269970790,0.691839580482051,0.691839809960954,0.691839969108629,0.691840057168615,0.688422462141666,0.346455099188676,0.346455099376395,
0.674680858846682,0.674677169936218,0.674709538784511,0.675057906007725,0.676397161312509,0.679808119769980,0.682702808108888,0.683757467897874,0.684231737426916,0.684232756007831,0.685017843729856,0.686871674267806,0.687804259176072,0.688196609292452,0.686334203856437,0.684966490590324,0.685583977077557,0.687564142206318,0.689294418355145,0.690175136352124,0.690447987215297,0.690845015729224,0.690940065614090,0.691426798606015,0.691709164596963,0.691829745115491,0.691845241577485,0.691849318480591,0.691847043660972,0.691836447059314,0.691837114238033,0.691838783646992,0.691839499345585,0.691838113695196,0.691835262217099,0.691834558365011,0.691834926114739,0.691835622460040,0.691836379739445,0.691837165403734,0.691837836283567,0.691838609865960,0.691839119555140,0.691839476676696,0.691839727386172,0.691839892164070,0.691839976962231,0.662736677750353,0.184779655156550,0.198226534873917,
0.674697109085718,0.674696881554305,0.674697813553028,0.674784255845738,0.674875526708067,0.674746828415849,0.677046010127314,0.678640288557759,0.680177377710610,0.681481812011059,0.682266770149740,0.684023516057974,0.684952179065568,0.685744070707020,0.684808010218891,0.684717864001169,0.684470799013161,0.684425464131369,0.685648006170737,0.687446873484595,0.688360158263942,0.689222945273565,0.689375403037985,0.689476107421266,0.690371361024520,0.691255652121242,0.691649473711001,0.691744372183667,0.691796459118017,0.691822197280611,0.691832788745075,0.691838383291002,0.691841403951155,0.691838999888713,0.691831027081750,0.691831360721585,0.691832896249570,0.691834275384968,0.691835383924465,0.691836591489191,0.691837210972554,0.675567954271411,0.672915008096403,0.670925703263064,0.672160240464959,0.662599764265182,0.532985549252823,0.151553817538643,0.145549057907166,0.135564741340254,
0.674714049437771,0.674715663660592,0.674722439108775,0.674741983263671,0.674769508950552,0.674750296853823,0.674834747246417,0.675350895896347,0.676611673475602,0.677912903504244,0.678380931508671,0.679630697508136,0.682570173757608,0.684057708231358,0.684306658653224,0.684401747334784,0.684423373839071,0.684424494083303,0.684997382918227,0.685959566410856,0.686902586156906,0.687270603449481,0.688167990386860,0.688476427017918,0.688647222375860,0.690325649432605,0.691011303363268,0.691335728748652,0.691470878720529,0.691545808166527,0.691587588284929,0.691666686059672,0.691761645084457,0.691797444437459,0.691818477437934,0.691826953979101,0.691831016789269,0.691833194223340,0.691834285467981,0.681140245234297,0.629170567390571,0.565371768319708,0.493081862556140,0.534820686118001,0.493684948163369,0.160669739698407,0.134816955841523,0.134819324737023,0.135564747680489,0.135564741673089,
0.674728000786288,0.674729529343316,0.674734539547467,0.674743526923825,0.674751348882994,0.674744094708147,0.674765174986809,0.674754078070151,0.675186755968997,0.675491680293669,0.674811950819951,0.674802415849680,0.674805894477982,0.674816805938266,0.675809784004680,0.678154988801427,0.680087973572922,0.679991142714809,0.681311096305577,0.681635918560996,0.682477776446648,0.682564978968949,0.572741632238766,0.565179983697700,0.420773845063155,0.311747998331594,0.227767662658209,0.176745484366842,0.252926211601876,0.244193706381223,0.145649691968667,0.134816742833337,0.134816412581896,0.134816048261380,0.134815682808248,0.134815364444190,0.154600478441215,0.197689043390296,0.134816221395940,0.168160112916793,0.134815025246846,0.134814901903375,0.134814822115465,0.134814812975962,0.134814907582154,0.134816141520226,0.134816993259744,0.134819520712538,0.134802071718055,0.134812285978782,
0.674738963117228,0.674740021472752,0.674742845927266,0.674746449488512,0.674748446152931,0.674745682503160,0.674748362100419,0.674741077524145,0.674859668664586,0.674823816989188,0.674810031258118,0.674803893158794,0.674805482352523,0.674816599748878,0.674771698529187,0.675882458005553,0.677272514383569,0.678157135140429,0.677337547354246,0.678291883703194,0.675320777661936,0.519518311658853,0.302224164952464,0.178625882205147,0.195339741832813,0.170441266747164,0.176745476929902,0.176745482275167,0.167878478902598,0.134817799568710,0.134816992789115,0.134816750316134,0.134816417673006,0.134816053494825,0.134815688297762,0.134815375226847,0.138907704962262,0.134816512631909,0.134816223669337,0.134815157556596,0.134815030469769,0.134814906321995,0.134814826489018,0.134814817220364,0.134814924589921,0.134815278770931,0.134815356882413,0.134814690305369,0.134810135908648,0.134811531031385,
0.674747657835112,0.674748675540128,0.674750464440477,0.674751181223338,0.674750533918869,0.674749139542383,0.674749405495647,0.674748242599922,0.674797738967951,0.674802996773500,0.674800550656355,0.674797547294598,0.674795263009040,0.674785774382947,0.674780405520213,0.674893248936028,0.675535675467458,0.676364086259205,0.676554264723128,0.675321465963468,0.675321038314141,0.293544319292088,0.177690731595341,0.177405343270078,0.170441241735088,0.170441253851617,0.171378575235342,0.140990286052972,0.134818130314401,0.134817787991318,0.134817263542389,0.134816853055295,0.134816459486895,0.134816065097261,0.134815647245516,0.134815103306941,0.134817921604370,0.134816779999840,0.134815916529514,0.134815312028750,0.134815036976245,0.134814870710150,0.134814764520073,0.134814708854354,0.134814698466201,0.134814695302364,0.134814468128490,0.134813750800429,0.134812255738633,0.134812176416981,
0.674754032830886,0.674756366699586,0.674759163211968,0.674757424371353,0.674753568727926,0.674751152613734,0.674752107538772,0.674759182420172,0.674783743632270,0.674790158636302,0.674791763677425,0.674790499682345,0.674788986496509,0.674785398261166,0.674783887793559,0.674840492196701,0.675045512899165,0.675376002249916,0.675321694579758,0.675321637979896,0.256842992838874,0.175333652878865,0.173837438370228,0.170441212192296,0.170441228471451,0.170441243386705,0.136974343061157,0.134819028130659,0.134818490324287,0.134817963486230,0.134817425372174,0.134816943988473,0.134816507338818,0.134816105534003,0.134815737909573,0.134815434801638,0.134815423304464,0.134815247924471,0.134815353707331,0.134815141021855,0.134814938909268,0.134814779302682,0.134814656256355,0.134814559292324,0.134814468977670,0.134814339473553,0.134814073074311,0.134813592791523,0.134812964283005,0.134812747154829,
0.674738524701498,0.674754921351753,0.674768684715616,0.674765782809958,0.674755232274673,0.674749893057046,0.674748783781283,0.674752755386740,0.674770377520895,0.674782260312563,0.674785897151285,0.674783733483558,0.674784833429815,0.674782959343162,0.674786686192913,0.674774860943910,0.674750074056740,0.671938717427531,0.626404839881563,0.410085688917473,0.173235841835645,0.171390885604193,0.170441213198595,0.170441196614982,0.170441213895388,0.135223062868873,0.134820336690584,0.134819592663570,0.134818844254441,0.134818155221280,0.134817535523218,0.134816995322269,0.134816525569204,0.134816117113222,0.134815769481641,0.134815498873466,0.134815340789291,0.134815195229467,0.134815113591463,0.134814963711915,0.134814802671051,0.134814655678650,0.134814526196146,0.134814407251574,0.134814282702584,0.134814124436040,0.134813895766446,0.134813586991687,0.134813265691162,0.134813105144230,
0.673450790237264,0.674175931005220,0.674612766273900,0.674719717874865,0.674723340997487,0.674729585969987,0.674740267755577,0.674741923837470,0.674751405917740,0.674763461300706,0.674773410033844,0.674773671235612,0.674774674738841,0.674774950440305,0.674768643603465,0.674767143955125,0.674760140145923,0.671366002666067,0.570305854042227,0.181858764853523,0.156269810972774,0.152947676163214,0.138843690215776,0.134832657916066,0.134834579224785,0.134821548265941,0.134821215425629,0.134820166272433,0.134819143650619,0.134818282588784,0.134817571250802,0.134816981368636,0.134816487734255,0.134816073154019,0.134815729337245,0.134815455668554,0.134815250774974,0.134815083445628,0.134814946307428,0.134814802067808,0.134814656855131,0.134814518973022,0.134814389954248,0.134814265071676,0.134814134291741,0.134813983859689,0.134813802590896,0.134813597791196,0.134813410518896,0.134813306824318,
0.672777447768279,0.673296118045604,0.674519611615755,0.674683626553041,0.674717043870435,0.674706551097211,0.674711510470502,0.674730795695029,0.674740050416070,0.674748291471755,0.674757030774625,0.674766405971567,0.674770486647865,0.674768537569156,0.674765770440236,0.674764595886303,0.674762769331104,0.652938696750977,0.365307417920538,0.143164481368460,0.143908044082139,0.136403522683280,0.134835092281529,0.134833072205114,0.134830837791015,0.134825469410812,0.134822814731369,0.134820717903369,0.134819286281420,0.134818265206255,0.134817490626159,0.134816876361679,0.134816376098264,0.134815963711499,0.134815624312432,0.134815348887386,0.134815128259552,0.134814946383726,0.134814790883237,0.134814646049545,0.134814508284449,0.134814377905376,0.134814253992356,0.134814133109998,0.134814009759374,0.134813878270642,0.134813737057373,0.134813595177631,0.134813475914173,0.134813408979683,
0.672628891500582,0.672842671791750,0.673850188926352,0.674367957073461,0.674608747754372,0.674670267376165,0.674694598392094,0.674713624391227,0.674728352022939,0.674741508342925,0.674745699303264,0.674743068809570,0.674754403899240,0.674762803338615,0.674764216418578,0.674762511201778,0.674762771691456,0.308502703436269,0.139298177152267,0.136787712858090,0.135113045526588,0.134841112069345,0.134837914264731,0.134833702392428,0.134830232429978,0.134826680093624,0.134823860082233,0.134820608757129,0.134819023141138,0.134818006328871,0.134817254832279,0.134816662591229,0.134816181871338,0.134815786577050,0.134815460581285,0.134815192508205,0.134814972085832,0.134814787917846,0.134814629638634,0.134814487699669,0.134814356968126,0.134814234919002,0.134814119452054,0.134814007972933,0.134813897631840,0.134813786599775,0.134813676336282,0.134813574073560,0.134813493105680,0.134813448330190,
0.672366702325895,0.672622770227124,0.673161658507278,0.673285385170288,0.673635175989613,0.674035827544723,0.674290105018258,0.674551979576819,0.674638196384411,0.674688023611377,0.674707613506055,0.674725889067502,0.674731967745574,0.674745381586706,0.674754085631205,0.674758362858755,0.436403904559970,0.138891766507633,0.136201938248821,0.135087263248623,0.134864502854893,0.134850529049518,0.134841750206760,0.134833591738923,0.134829711458469,0.134827161351428,0.134818573883912,0.134818838348272,0.134818196035139,0.134817487201184,0.134816864988730,0.134816342586832,0.134815907541029,0.134815545462018,0.134815244206023,0.134814993685990,0.134814784769042,0.134814608563458,0.134814456938170,0.134814322914489,0.134814201634224,0.134814089910938,0.134813985382020,0.134813886057638,0.134813790465930,0.134813698357197,0.134813611757636,0.134813535785195,0.134813478199637,0.134813446994534,
0.669525980330377,0.670264896025248,0.671039789228801,0.671751110321711,0.672216866784897,0.671389494346237,0.670720943657620,0.670119747490632,0.670122689111558,0.670120865943028,0.670907441403927,0.670982473542246,0.670123373368143,0.670248325897316,0.625304932270922,0.469601951160754,0.139425107447207,0.136138064189845,0.135259899163667,0.134918340521816,0.134878809185963,0.134854746613097,0.134828657793123,0.134829203664125,0.134827862255021,0.134819065736686,0.134818402548350,0.134817979575428,0.134817440468214,0.134816886622432,0.134816380611892,0.134815940563006,0.134815565597406,0.134815248857407,0.134814982376796,0.134814758465266,0.134814569848252,0.134814409626361,0.134814271517984,0.134814150151356,0.134814041394104,0.134813942247237,0.134813850538167,0.134813764739126,0.134813684055937,0.134813608768607,0.134813540657019,0.134813483175335,0.134813440954978,0.134813418485021,
0.669504271698210,0.669623494184210,0.670058744252893,0.670361851489806,0.670534863487703,0.670174587189798,0.670120090463018,0.670121648049655,0.670121765393018,0.670121449362189,0.670109249822645,0.670129095974716,0.670124938710106,0.670072964922279,0.530905032277106,0.143934740625915,0.136488995365410,0.135771598062832,0.135089846190026,0.134902438548411,0.134832100675243,0.134837088588333,0.134829134358334,0.134826704626788,0.134824137835354,0.134819595549820,0.134817995883927,0.134817241957925,0.134816704797104,0.134816243478016,0.134815835616860,0.134815478832158,0.134815170799128,0.134814907325974,0.134814683245273,0.134814493129338,0.134814331608131,0.134814193537448,0.134814074197884,0.134813969498893,0.134813876142630,0.134813791626671,0.134813714152383,0.134813642568207,0.134813576420374,0.134813516095968,0.134813462956227,0.134813419289102,0.134813387916440,0.134813371448422,
0.669503769038536,0.669557202052195,0.669877905021817,0.670121057666367,0.670179187567379,0.670163090294994,0.670134411615537,0.670124919739289,0.670121228708420,0.670119304121045,0.670115404564061,0.670119374447168,0.670122260037303,0.381929481767059,0.173811624925353,0.136723568950366,0.136452159388570,0.135678698788315,0.135035770412363,0.134820872790567,0.134826689592503,0.134821975220039,0.134824087731746,0.134824344870684,0.134816718029671,0.134817187172209,0.134816748393086,0.134816292712191,0.134815898555173,0.134815552230406,0.134815244941945,0.134814973749633,0.134814736810295,0.134814531711942,0.134814355376194,0.134814204325496,0.134814074931064,0.134813963609262,0.134813867002525,0.134813782140787,0.134813706560670,0.134813638350433,0.134813576144745,0.134813519120399,0.134813467023832,0.134813420218443,0.134813379696059,0.134813346972098,0.134813323804372,0.134813311758841,
0.663109546143978,0.666182077323402,0.667641070824755,0.668791092384820,0.669327402192908,0.669422826383951,0.668788924345016,0.667581990094968,0.658607596184019,0.656366505503776,0.655007576849927,0.654220312234926,0.352975200048593,0.280362877966901,0.136717142016895,0.136723515381128,0.136485698997728,0.135453782592639,0.134839115096822,0.134826664474088,0.134822064449697,0.134820180104035,0.134820899062530,0.134815673560268,0.134815639196597,0.134815691723693,0.134815522968869,0.134815287242509,0.134815049868523,0.134814827377955,0.134814623607244,0.134814439820808,0.134814276327905,0.134814132599396,0.134814007384116,0.134813898911548,0.134813805101923,0.134813723754687,0.134813652715601,0.134813590018485,0.134813533991912,0.134813483322513,0.134813437085091,0.134813394759877,0.134813356248748,0.134813321882246,0.134813292389480,0.134813268795843,0.134813252230132,0.134813243665218,
0.660971290218866,0.663265917213156,0.665706455010382,0.666816816525600,0.667674200548033,0.668110462991309,0.667802265331582,0.655456100069631,0.655513468929438,0.655013925974034,0.655010536944541,0.436870310598132,0.256687845477857,0.137964393126966,0.136719330647727,0.136729898681855,0.136508171930534,0.134899476208629,0.134817113733738,0.134810603362736,0.134814726128982,0.134815785055372,0.134816105483945,0.134814809371938,0.134814478747630,0.134814422883270,0.134814369922566,0.134814288892632,0.134814191803586,0.134814089307714,0.134813987753430,0.134813890997111,0.134813801388863,0.134813720171403,0.134813647723050,0.134813583774370,0.134813527609462,0.134813478246416,0.134813434594868,0.134813395588000,0.134813360285207,0.134813327943617,0.134813298063206,0.134813270413730,0.134813245047790,0.134813222295402,0.134813202727346,0.134813187073753,0.134813176095276,0.134813170425622,
0.654419624264967,0.655865207842868,0.656648646622712,0.656026284011846,0.655654867604634,0.655071471644961,0.655066873087148,0.655071006272498,0.655024876476551,0.655019195144562,0.401010260389323,0.172445344425243,0.137964943429034,0.137964422801298,0.136767664229990,0.136746907656391,0.135205255637351,0.134827879648534,0.134803945245059,0.134807451311721,0.134810456431238,0.134812133179526,0.134812933210883,0.134812985008812,0.134813049056171,0.134813156736294,0.134813250581446,0.134813312246950,0.134813344768369,0.134813355865246,0.134813352588830,0.134813340406141,0.134813323314467,0.134813304090462,0.134813284529614,0.134813265665663,0.134813247968623,0.134813231519671,0.134813216162130,0.134813201627704,0.134813187637018,0.134813173974570,0.134813160540566,0.134813147383251,0.134813134713502,0.134813122899732,0.134813112438250,0.134813103895221,0.134813097822903,0.134813094663511,
0.654409657280157,0.654456516737700,0.654989252176128,0.655102961504243,0.655081452722943,0.655073105868420,0.655066443079641,0.655059719571699,0.655042089054934,0.228925488275832,0.139878936841342,0.137965759399320,0.137965464349402,0.137964846460260,0.136937672112980,0.135671089649482,0.134889805335367,0.134795761250904,0.134801186408915,0.134804807051541,0.134807521234821,0.134809363816992,0.134810514876707,0.134811154209669,0.134811581612731,0.134811910320195,0.134812169294979,0.134812370569411,0.134812524902109,0.134812642433951,0.134812731838432,0.134812800083463,0.134812852569494,0.134812893372257,0.134812925488607,0.134812951059995,0.134812971569250,0.134812988011106,0.134813001037788,0.134813011080608,0.134813018448223,0.134813023402430,0.134813026213096,0.134813027194164,0.134813026721894,0.134813025235116,0.134813023216493,0.134813021154988,0.134813019493481,0.134813018570687,
0.654422461217103,0.654434981063255,0.654690609455371,0.654839097421153,0.654911882014309,0.654853508407253,0.654840609834737,0.349502955878787,0.169195288480337,0.138695425230588,0.137966758510231,0.137966696271987,0.137966292927090,0.137963768441858,0.136072324756174,0.135348472257331,0.134798137886659,0.134797514796521,0.134800240735626,0.134803077018104,0.134805464746369,0.134807292664851,0.134808614728324,0.134809541701192,0.134810219159679,0.134810739858159,0.134811151837575,0.134811481846545,0.134811747710157,0.134811962842164,0.134812137780307,0.134812280860034,0.134812398646998,0.134812496274149,0.134812577719077,0.134812646035942,0.134812703551012,0.134812752028047,0.134812792807828,0.134812826924550,0.134812855200806,0.134812878322434,0.134812896894576,0.134812911480317,0.134812922623045,0.134812930853265,0.134812936680600,0.134812940572616,0.134812942924199,0.134812944023683,
0.654424854555197,0.654428677011861,0.654554274928654,0.654646073492123,0.654713965490289,0.654717767741183,0.169284523105591,0.148520173448046,0.138139080142228,0.137966342138523,0.137968054440141,0.137967958082240,0.137966597958504,0.137963730912350,0.135759126263725,0.134870540016345,0.134790468761784,0.134795929623500,0.134799193999619,0.134801804006303,0.134803975912031,0.134805734763590,0.134807116759074,0.134808185585554,0.134809020179447,0.134809684672008,0.134810222742910,0.134810663480184,0.134811027261221,0.134811329239144,0.134811581146163,0.134811792257452,0.134811969971111,0.134812120203262,0.134812247682328,0.134812356180708,0.134812448703347,0.134812527644260,0.134812594917562,0.134812652066930,0.134812700355786,0.134812740839667,0.134812774421985,0.134812801894331,0.134812823962501,0.134812841259377,0.134812854346021,0.134812863702905,0.134812869714336,0.134812872650246,
0.594049327309036,0.620456064439652,0.630064520892325,0.636745535368329,0.631934933649774,0.152849628418578,0.147723554666063,0.138013379470543,0.137969348096620,0.137970850001312,0.137971141403289,0.137970466764142,0.137968394097516,0.137961031852852,0.135429800637237,0.134797702961658,0.134794860416301,0.134796551533469,0.134798811308569,0.134800978059020,0.134802908531701,0.134804561677831,0.134805939576950,0.134807071048880,0.134807998412042,0.134808762794933,0.134809397639630,0.134809928484746,0.134810374772054,0.134810751593075,0.134811070914922,0.134811342377182,0.134811573819231,0.134811771648700,0.134811941114459,0.134812086518945,0.134812211389430,0.134812318619673,0.134812410588813,0.134812489261501,0.134812556271530,0.134812612990276,0.134812660580942,0.134812700039551,0.134812732223764,0.134812757870694,0.134812777605118,0.134812791939801,0.134812801270251,0.134812805866756,
0.559177985685406,0.565131929605172,0.553398393966261,0.470795756951916,0.143050206125379,0.141895544688842,0.137989692647598,0.137992553629027,0.137980266858546,0.137976548549094,0.137975175372035,0.137974355382094,0.137975463120487,0.137890803860978,0.134820190563361,0.134792379740455,0.134794729341825,0.134796615208442,0.134798531474768,0.134800397677992,0.134802127291722,0.134803672247875,0.134805016885438,0.134806168381467,0.134807147104354,0.134807977658196,0.134808683452465,0.134809284664454,0.134809798053975,0.134810237428775,0.134810614199031,0.134810937846279,0.134811216286372,0.134811456147521,0.134811662987308,0.134811841466697,0.134811995493308,0.134812128342012,0.134812242757927,0.134812341044834,0.134812425140587,0.134812496680382,0.134812557048447,0.134812607418812,0.134812648785959,0.134812681986330,0.134812707711803,0.134812726516509,0.134812738818612,0.134812744899018,
0.384620752632406,0.441707518068502,0.312791421259183,0.138406204612606,0.137985435312988,0.137984923362573,0.137986897713992,0.137986850113186,0.137982594310022,0.137979880437092,0.137978635493303,0.137976218611121,0.137977230768424,0.135265601509697,0.134791241950486,0.134793460015715,0.134795072636621,0.134796658782884,0.134798311615202,0.134799963398582,0.134801539837577,0.134802991906692,0.134804295772886,0.134805446608865,0.134806451776302,0.134807324773600,0.134808081007794,0.134808735478260,0.134809301800163,0.134809791948398,0.134810216313413,0.134810583861074,0.134810902309321,0.134811178291607,0.134811417500218,0.134811624810465,0.134811804388846,0.134811959788201,0.134812094032122,0.134812209689915,0.134812308942627,0.134812393640243,0.134812465350079,0.134812525396594,0.134812574893023,0.134812614765442,0.134812645770002,0.134812668504235,0.134812683413528,0.134812690794140,
0.195395090983684,0.206969182824403,0.138021776132189,0.137980338152418,0.137984982950693,0.137985753013790,0.137986100392001,0.137985330248198,0.137983356235851,0.137981720635962,0.137980892610650,0.137977453056103,0.137977649882544,0.134794969731193,0.134796063765553,0.134795156167595,0.134795452761406,0.134796645873066,0.134798102769281,0.134799614143797,0.134801086128581,0.134802468832360,0.134803736440954,0.134804878936499,0.134805896719419,0.134806796403951,0.134807587707820,0.134808281430516,0.134808888303923,0.134809418421603,0.134809881001858,0.134810284324341,0.134810635749529,0.134810941774284,0.134811208100893,0.134811439709270,0.134811640928039,0.134811815502875,0.134811966661416,0.134812097174201,0.134812209410903,0.134812305391106,0.134812386829035,0.134812455171927,0.134812511631997,0.134812557212173,0.134812592725888,0.134812618811404,0.134812635941351,0.134812644428444,
0.137997625578614,0.138000477116683,0.138002883572465,0.137991819097407,0.137987366535583,0.137986979772859,0.137986395502034,0.137984989545533,0.137983755613994,0.137982729623199,0.137982205036781,0.137979031287384,0.137978465467656,0.134801913712390,0.134802896006900,0.134793519199443,0.134794946531392,0.134796379347812,0.134797849473396,0.134799314099794,0.134800731276096,0.134802070156741,0.134803311231290,0.134804444668500,0.134805468108661,0.134806384389380,0.134807199561153,0.134807921377340,0.134808558264940,0.134809118682285,0.134809610747757,0.134810042042369,0.134810419517942,0.134810749467178,0.134811037529199,0.134811288715121,0.134811507444922,0.134811697590678,0.134811862523123,0.134812005159325,0.134812128009635,0.134812233222329,0.134812322624719,0.134812397759914,0.134812459918706,0.134812510166312,0.134812549363841,0.134812578184575,0.134812597125437,0.134812606514341,
0.137997613936991,0.137998029315218,0.137997428675677,0.137993196802926,0.137990129224727,0.137988377726256,0.137987486679759,0.137984541181422,0.137983922523323,0.137983212970965,0.137982784767852,0.137980695022884,0.137979568289733,0.134830482318077,0.134789598040577,0.134792488425782,0.134794445245828,0.134796085784915,0.134797611797963,0.134799071452241,0.134800464457763,0.134801778782898,0.134803002876178,0.134804129299415,0.134805155205509,0.134806081639823,0.134806912498736,0.134807653525469,0.134808311494000,0.134808893609473,0.134809407097900,0.134809858941530,0.134810255718405,0.134810603513095,0.134810907874656,0.134811173805454,0.134811405770223,0.134811607718473,0.134811783115652,0.134811934979642,0.134812065919828,0.134812178176499,0.134812273658819,0.134812353980087,0.134812420489352,0.134812474298718,0.134812516305850,0.134812547211463,0.134812567531939,0.134812577607624,
0.137996740174488,0.137996566038585,0.137995573791734,0.137993380569072,0.137991547792415,0.137988116735589,0.137987677104859,0.137984853216593,0.137984155587730,0.137983390385117,0.137982624143012,0.137981511135820,0.137980537035676,0.134786181263534,0.134790004336950,0.134792402192615,0.134794270819586,0.134795917109124,0.134797450684579,0.134798905500112,0.134800286183462,0.134801587282446,0.134802801565923,0.134803923508659,0.134804950474389,0.134805882759615,0.134806723115918,0.134807476100964,0.134808147446289,0.134808743526094,0.134809270949888,0.134809736270553,0.134810145787166,0.134810505419933,0.134810820637362,0.134811096420260,0.134811337251436,0.134811547123373,0.134811729558359,0.134811887636923,0.134812024031197,0.134812141040504,0.134812240627019,0.134812324449886,0.134812393896549,0.134812450110338,0.134812494013562,0.134812526325692,0.134812547576601,0.134812558115362,
0.137996183629936,0.137995889929083,0.137994889431075,0.137993174429630,0.137991224059182,0.137988921847113,0.137987398061130,0.137985569302615,0.137984431330978,0.137983544087251,0.137982785689411,0.137982164113272,0.137981050628137,0.134792692510800,0.134791847470634,0.134792856117874,0.134794329321397,0.134795871542137,0.134797378583369,0.134798823793360,0.134800197441424,0.134801492337330,0.134802702077379,0.134803821863309,0.134804849226225,0.134805784194761,0.134806629031230,0.134807387749615,0.134808065582102,0.134808668492081,0.134809202776492,0.134809674765674,0.134810090610843,0.134810456142522,0.134810776782800,0.134811057496922,0.134811302773129,0.134811516622720,0.134811702594457,0.134811863798773,0.134812002938153,0.134812122340709,0.134812223994627,0.134812309581658,0.134812380508286,0.134812437933418,0.134812482791751,0.134812515812251,0.134812537531682,0.134812548303598,
};
double result_aniso_tv[2500]={ 0.696209521533765,0.697082681969646,0.698301311720121,0.697005892834752,0.696118791621479,0.697959105822507,0.700431372538802,0.701325725287826,0.702403083540563,0.701889505161461,0.701363620138288,0.701580663405825,0.701601198902938,0.699891958487773,0.698945093639211,0.698810837575283,0.699076593286350,0.700389327104006,0.701456995193536,0.702618809777587,0.703173414565673,0.703608948331963,0.705856169153519,0.703978248917436,0.700410217320042,0.699877290241796,0.700925485146504,0.701565714959044,0.699855552568798,0.698664086329995,0.699375571103096,0.700887601267992,0.702488647935184,0.702499056504915,0.705298973941742,0.708637415454346,0.709500909334925,0.709289940092380,0.709411721784575,0.708882972631053,0.710449737719543,0.711252172057594,0.710548205687220,0.710274399958307,0.711433081499494,0.714147000667586,0.713668194801466,0.712436979153135,0.711213456852979,0.709110960261073,
0.694842688021190,0.695779750681918,0.697248934805454,0.697458562632816,0.697672477926558,0.699628891866656,0.701789486318804,0.702613685473808,0.703223036414202,0.702777986236723,0.702550271816012,0.703047288699401,0.702674231403003,0.700642252317456,0.699287100846383,0.698819871329278,0.698358202269191,0.699798396423461,0.701712588690151,0.702888722987121,0.702593708512843,0.703057735698289,0.705001123662073,0.703499467505106,0.701249687892018,0.701114903509169,0.701722300900688,0.701942870207282,0.700346267670875,0.699400416873612,0.700391780592535,0.702027932735890,0.703063282432783,0.703045641205392,0.705237833049422,0.707332825668339,0.707360031259294,0.707798429602052,0.708656879936424,0.708802867805684,0.710502772274126,0.711451399612448,0.711222495547173,0.710822345073311,0.711409853609855,0.713840775674660,0.713700136416761,0.712728393690955,0.711991316217751,0.710494697886390,
0.693386158700501,0.694527569617817,0.696294140284954,0.697637868867843,0.698538928418812,0.700330835808610,0.702392210080001,0.703551649448103,0.703533960223166,0.703382705204229,0.703923133754236,0.704201421423001,0.703137060812836,0.700664112717421,0.699530917202514,0.699609216711703,0.698545210508119,0.701116920892739,0.702356171033263,0.702374726013398,0.701043086021032,0.701400698511711,0.703233014740589,0.702542586650881,0.701964186144146,0.702315231777238,0.702697168156366,0.702634068468280,0.701071324811802,0.700484689875440,0.701862656028442,0.703570303596703,0.703759837287803,0.703486227486737,0.705481940634309,0.706591929842676,0.705775613256926,0.706891462396280,0.708876425967340,0.709129450606285,0.710407970407822,0.711666950045865,0.711389485040666,0.710687729549843,0.711334230253918,0.713173000197302,0.713451186491408,0.713009392166011,0.712962371246570,0.712569841635335,
0.692411573831425,0.693625174122992,0.695294426680726,0.697047581164880,0.698227982982766,0.699985089329668,0.702202720962206,0.703574169597344,0.702988905944921,0.703146349991678,0.704445864810182,0.704446705363770,0.703097526856502,0.701757308307377,0.701601125735129,0.702414207577689,0.702373150283342,0.702353248288172,0.702266053792619,0.701127909610217,0.699520306255674,0.700150061363917,0.702209504189910,0.702500106931254,0.702882936683363,0.703107652526032,0.704040485999141,0.704712553551635,0.703469696671144,0.703041309127608,0.703915868056841,0.705309664452022,0.705338533363710,0.705047212874146,0.706876060586419,0.707964189654421,0.707283009432958,0.709314061370465,0.710876015909543,0.710367634428893,0.710223810668359,0.710820344201683,0.709585188475866,0.708222286048301,0.708805394487056,0.710442822412585,0.712589900234222,0.713702978647444,0.714694654444714,0.715422410657968,
0.692342873144149,0.693409766258372,0.694954454128890,0.696353066979288,0.697407125318589,0.699220436112288,0.701525764461895,0.702574082552797,0.702087143975136,0.703083822244935,0.705644976464339,0.706686021516015,0.705215408085674,0.703905063534323,0.703513954151059,0.703990265933435,0.704397750778135,0.703947154950877,0.703318918032535,0.701673089869641,0.699736870982707,0.700416304388826,0.702548704304199,0.702718132675406,0.702898079617026,0.703519958307442,0.704986425643971,0.706534675702699,0.706813047896548,0.707349331119857,0.708171275465955,0.709222158855820,0.708970834040504,0.708938953175143,0.710040921558515,0.710152880916765,0.708862323414568,0.710915939734904,0.711832010627176,0.710185078009160,0.708314634194560,0.707911698296205,0.707058913401981,0.706490047130358,0.707594261846730,0.709151073903280,0.711601085160085,0.713028112745362,0.714660606987952,0.715397891722063,
0.692589188212416,0.693398054591043,0.695380708524569,0.695923791702253,0.695672298476039,0.696796022058655,0.699249016658269,0.700448645621715,0.700085033245406,0.701414779303356,0.704189190593744,0.705739421921837,0.705228955271630,0.704976961445671,0.703728554073993,0.703765095310923,0.704330484481791,0.704782865430704,0.704569188464668,0.702685809722761,0.701148027115172,0.701532408235106,0.702947311117892,0.702496934764847,0.702287182930897,0.703824781226940,0.705614082856486,0.707140011081949,0.708662631778111,0.710110324218636,0.712055489611462,0.713050324776811,0.712904030867846,0.713342668629744,0.713451547968467,0.712655561033552,0.710952209049051,0.711680863725515,0.711598258854430,0.709143282862872,0.706366210721502,0.705620039797739,0.705344733648599,0.705192165556937,0.705624560563079,0.706703122592465,0.708779125580215,0.710889892564553,0.712648945609825,0.713010759598857,
0.693742002880476,0.693702746654973,0.694606237081290,0.694542980080073,0.693860938492400,0.694219852554322,0.696611334722761,0.698903570683950,0.699468851566946,0.699431912345329,0.701227187410599,0.703126214860045,0.704930689778927,0.705641260159849,0.704258360756899,0.704044419063334,0.704105854213432,0.705010598011615,0.704330014907880,0.702611555859283,0.701619639290512,0.701614597074442,0.702405949336051,0.701930844185869,0.702264857346118,0.704871500662085,0.707471793578259,0.709434641620818,0.711756152019591,0.714031105883070,0.715752829413707,0.716187179994289,0.716582331314612,0.716959520601537,0.717002484100420,0.715426331129839,0.712920748228526,0.711899193798114,0.710632587908717,0.707666195991607,0.704888816270563,0.704303450354288,0.704158578239629,0.703092869311407,0.702933544467661,0.703960114927306,0.705601718398423,0.707937940655377,0.710191472338458,0.711316981314321,
0.695240945796319,0.694778572965311,0.693985822196657,0.693536252987533,0.693258737620685,0.693555560254589,0.694885214760323,0.697216071174499,0.698627273461041,0.698443256269993,0.700244001982711,0.702225132120117,0.704526661496842,0.705978633236611,0.705886170980457,0.705919296507804,0.705000010791539,0.704544766087144,0.703649649252309,0.702440254421314,0.701691297204479,0.701272471113617,0.702482775612626,0.702993041718400,0.703770981671102,0.705965480145674,0.708866561977879,0.711379647699507,0.714100644588867,0.716849176913239,0.718206919004319,0.718633654953449,0.718413199723645,0.717496332869521,0.717801483040733,0.716645312338487,0.713736141071858,0.711455381485835,0.709909259066935,0.706802688405397,0.704296110232880,0.703545680828706,0.703236254322778,0.701285021580571,0.700812837157082,0.702642579880913,0.704407554558729,0.706663806252287,0.708619681503087,0.710194531863074,
0.696388208645096,0.696978279992628,0.694481079188709,0.692550160171327,0.692204265749119,0.692794994721748,0.693795278907413,0.695601955504547,0.697532783975725,0.698142116942503,0.699975246107693,0.701884615688329,0.704176213923868,0.705461374246105,0.706008180567254,0.706242395556918,0.705549054498953,0.704402722804703,0.703410372741003,0.702536104708656,0.701452256876805,0.700591254083530,0.701908766283200,0.703676815717917,0.704480360563186,0.706226868089303,0.709267149581946,0.711688693460124,0.713725487398905,0.716370649789800,0.718137414316802,0.718807169206139,0.719775241631510,0.717194124542969,0.716852426381173,0.715562180008011,0.712809326853272,0.709771657818778,0.707815648665185,0.705234897826838,0.703586353274398,0.703484022532953,0.703438621941433,0.701464008169821,0.700867765764601,0.702760741286564,0.704486570642574,0.706518985855387,0.707453695843236,0.707921412535639,
0.695319081256676,0.693487445393407,0.691907204463173,0.691145445101191,0.691158812335994,0.692605890739714,0.694133813628384,0.695792546264713,0.697368909898690,0.697357059558534,0.698363772758685,0.699856132852303,0.701926237363093,0.703357172819629,0.704176098263384,0.704636167329244,0.704154445944163,0.702472066808625,0.701031612017674,0.699960183588406,0.699459516945638,0.699149565801405,0.700129926070124,0.701817264497152,0.702532424148289,0.705001191385835,0.708224089948217,0.709751559424828,0.711097745943105,0.713437372489643,0.715776423254116,0.716651146096325,0.713653436917894,0.714044414431661,0.713271466853777,0.712313976762546,0.710647734179895,0.707242402840924,0.704611470295906,0.702507279155260,0.701757827782545,0.702577186042282,0.702972477036753,0.701501767633986,0.701350035370794,0.702935118811493,0.704059323137503,0.705283261623723,0.706389642354135,0.706235205367962,
0.694611490785903,0.693324761977612,0.691050120209712,0.690716757376747,0.691145446352169,0.692827452694293,0.694461783347183,0.695794318853873,0.696621418676749,0.695089608117208,0.694706055214856,0.696164805822332,0.697715148789676,0.699214721811223,0.700791530863948,0.701348244329569,0.701027157673350,0.700207443668236,0.698177891209414,0.697174323395688,0.697572158001224,0.698198357432332,0.698600780393488,0.699157394409722,0.699338768463161,0.701796947556603,0.704159194689592,0.705136681620657,0.706468560967456,0.709601716760368,0.712542085651391,0.713057642919984,0.711363713671853,0.709299447093260,0.707126757196779,0.705922928863097,0.705023959188034,0.702542820538158,0.700427892189511,0.699826126312276,0.700302679916423,0.701517187262381,0.701546956708029,0.700356145120530,0.700766655672636,0.702161823990279,0.703566111939794,0.703585360571211,0.705239308689107,0.704876392689086,
0.694318443438201,0.693719105557437,0.692180920674216,0.690776732929490,0.691439640065405,0.692941880017730,0.693570580101852,0.693439418348259,0.693315261594438,0.692061885311151,0.691012352856071,0.692504168854457,0.694029097415576,0.695544754816578,0.697402747461601,0.698053777991540,0.697866850279163,0.697942900050233,0.696352737489812,0.695447844508802,0.696223912476974,0.696987175245412,0.696457569787532,0.695805263350429,0.695695849346662,0.698371971152714,0.700418638034898,0.701340231719902,0.702393814970855,0.705374620633543,0.708173547785351,0.708776350460328,0.706839620520686,0.703827366255047,0.700676519139708,0.699315192001886,0.698719942917861,0.697965234943704,0.697385679571498,0.698696112678710,0.699762209086556,0.700641290186773,0.700563936609222,0.699890053883470,0.700308804406085,0.701500407543164,0.700567328832249,0.700664580060095,0.700386331700238,0.702342073235110,
0.694791606557002,0.694400575454387,0.692942625183506,0.691911118857448,0.691359620195826,0.691870595650093,0.691468014443943,0.690093824507157,0.689535467998132,0.689362215024380,0.688728763754110,0.689121743205093,0.689899101528237,0.691184633134684,0.693685722932849,0.695075849899437,0.695021819312085,0.694422802140003,0.693054082219110,0.692360862891006,0.693510776878960,0.694612379407722,0.694556227751132,0.694024704560607,0.694156127852669,0.696066067550221,0.697440983847696,0.698395465420150,0.699381119682030,0.702025495729967,0.704406470685608,0.704684347394110,0.702715018424824,0.700673026649673,0.698151432001620,0.695960292343393,0.694965992660118,0.695809840828486,0.696532818448941,0.698784947074937,0.700033135821926,0.700700661675979,0.700747604902500,0.700383142773319,0.700812623605007,0.701852675697211,0.701624421673160,0.700965889107145,0.702156594244083,0.703488607550171,
0.696535772250361,0.695778225629514,0.693385304066760,0.691931447757729,0.690988200040768,0.689767935089800,0.689235379843357,0.688391745031576,0.687839943605842,0.688301229160388,0.688252046694445,0.687220846265109,0.686609755320475,0.687245919856234,0.689305996637323,0.690920089542913,0.691679426959940,0.691580281335483,0.690910943764322,0.690197270548559,0.691661493748471,0.693322451185230,0.693874573844413,0.694212813160766,0.694965409085758,0.696267235813499,0.697136253891945,0.697601065793507,0.698556467856439,0.700259717853916,0.701166387073436,0.700801454397736,0.699442171638569,0.698567252895733,0.697799647589389,0.696563751199629,0.694102912715390,0.693777559173320,0.696271683609768,0.698545210166360,0.699658407277860,0.701120814750632,0.701537379549186,0.700735135815627,0.700743812434304,0.701223553539628,0.701328238299619,0.701722145293696,0.703661066890167,0.705670275288903,
0.689325695660756,0.692668131564403,0.692400309572115,0.691399422027870,0.691147016098722,0.690640512040660,0.690469056600732,0.689950666620617,0.688626392703401,0.688337858409251,0.688616518205442,0.687223077496494,0.685590363993125,0.685221514134252,0.686456679808161,0.688366922395553,0.689999997392679,0.691309436431035,0.691681932192450,0.690264738508119,0.690683868658981,0.691962906853057,0.693465748207575,0.694883560584745,0.696534447050203,0.697256013768338,0.697581139945385,0.697118160549771,0.697443422275609,0.698177223802699,0.699038672369850,0.699307781993293,0.698767308868626,0.698022654238191,0.697317879084154,0.696291410457920,0.694136625258411,0.694267348362471,0.696752335433316,0.698387506302864,0.699444456285238,0.701151209180204,0.701652728715685,0.700937729564945,0.701353261666586,0.700957162288774,0.701307095824614,0.702319969721395,0.702728090306695,0.696585164571848,
0.678057260977086,0.683113891558290,0.686043306542269,0.689018826474595,0.691468506567408,0.691049876739746,0.691520217223786,0.691758863889206,0.690411644667714,0.688591508260664,0.687632782582438,0.685256152788265,0.682922249724150,0.683373865149568,0.685070800903408,0.687293837735081,0.689366785309363,0.691376335514270,0.692152522424406,0.691338142121277,0.691331432828621,0.691755655157410,0.692800787014636,0.694404234543822,0.695752464766090,0.696242064542110,0.696331603937200,0.695956937943938,0.695897171186642,0.695833995693795,0.696823378531795,0.697598008266293,0.697989847076743,0.697015636199966,0.695651589149776,0.694156150071356,0.692943767010532,0.694221769100893,0.697299562693981,0.699167496030009,0.699998186241823,0.701275437156413,0.702345400888344,0.702912440094677,0.703417525575202,0.702901695544965,0.702791567371690,0.703307579035896,0.696979777790745,0.696815848939851,
0.678216305536496,0.681796888135727,0.684010683045478,0.687339852198705,0.688782905358519,0.689879625452795,0.691325528213186,0.691404260901786,0.690342698719580,0.688121078282746,0.685366346977162,0.682281187030230,0.680220747790595,0.681771525935830,0.684591992168722,0.687525117146105,0.688904968300767,0.689746376225651,0.690427973131577,0.691324403365792,0.691589985613487,0.691294620102484,0.691329073875222,0.692882341554116,0.694531342273572,0.695342157530765,0.695804518071073,0.695178907990821,0.694857103669851,0.694465838843424,0.695343469648417,0.696268163650763,0.697139418314936,0.696077730631747,0.694534517927897,0.693611763114540,0.693289942269036,0.694529476623651,0.697635774900936,0.699865576574953,0.700558788075020,0.701214858493306,0.701935847466203,0.702705936421240,0.703718436891326,0.703555715131105,0.702962860712505,0.699641930743762,0.697811671037587,0.696508335152292,
0.680615607598555,0.682235861054902,0.683422879632590,0.686276392721952,0.686994117733517,0.688628633564224,0.690172373335813,0.688826370683588,0.687085076468329,0.684917791913837,0.682230383141197,0.680130123370110,0.679397813839919,0.681340966140855,0.684359236237093,0.687307045943551,0.688596806821380,0.689146619655822,0.690190338115107,0.691081802542717,0.690656821505400,0.689711043493224,0.688981942105871,0.690916484996495,0.693162028882924,0.694881637427344,0.696448720914616,0.695493829817071,0.693995662199208,0.693507972217805,0.694132014309645,0.694993504769345,0.695483054456274,0.695034375136164,0.694451353627927,0.694263779149636,0.694986719446087,0.695676466056818,0.697822205859753,0.699683231048111,0.699694539410437,0.700403041261198,0.701377158478046,0.702255073264667,0.702520706201768,0.700619473547575,0.700370202459816,0.700143726190156,0.698326750200194,0.697055928384129,
0.674997886064913,0.677744397360630,0.677307350230138,0.680945475034075,0.683593128511714,0.687584490882783,0.689274502806999,0.686256933304327,0.683651740523134,0.681745353681698,0.679377075554016,0.677868981637355,0.678051062589453,0.679896362806145,0.682905050343457,0.686583952192202,0.689221206693521,0.690488925891045,0.692294534745888,0.692779018560791,0.691853861099207,0.690177090416028,0.688784321453185,0.689880074538421,0.691294503644781,0.693462595910804,0.695138432359668,0.693743464466207,0.691772746602356,0.691871671246926,0.692728301611830,0.692924143427547,0.693076769792915,0.694042979272974,0.694117202769120,0.693874937988198,0.694738974869159,0.695205265244430,0.696821173490423,0.698578353439237,0.698637768081827,0.698355966945949,0.696912230296627,0.698384173109652,0.700426072432358,0.701073187646366,0.701954099830507,0.696223854006716,0.695412474953163,0.695775642583847,
0.674979159224227,0.677485085953065,0.678236999216654,0.680693393718449,0.681167272199271,0.684634272200506,0.686309248462594,0.683508561499169,0.680811666973178,0.680372734838968,0.677315803501767,0.675711456499366,0.676005511570230,0.678394855072690,0.681846446428674,0.685681730185724,0.688922076748966,0.691130358210527,0.693887796026240,0.694916022621097,0.694306572970142,0.692397425264293,0.689840611655939,0.689202975957759,0.688936487650260,0.690283154087335,0.691665755536762,0.691263749268111,0.691252200221373,0.692596525337824,0.693295412808502,0.693281843101600,0.693926338353730,0.694879669612049,0.694563541380036,0.693945668295330,0.694434364097579,0.694628015891751,0.695441656113540,0.696676312614133,0.697120316008514,0.696392408420952,0.696976066884978,0.698106494611863,0.699787035086634,0.700495782384392,0.700323838067405,0.697758201952660,0.619454195537079,0.341936298143976,
0.675664944293677,0.677202789530065,0.678160322485963,0.679902074276332,0.680440806457403,0.681957395455247,0.683315012255272,0.679474219758547,0.677057336542337,0.675267481825742,0.675166582032929,0.674838512344299,0.674953364047917,0.677272326469935,0.681117495026013,0.685474728243448,0.689177681528436,0.691868264105160,0.694355545517847,0.695939676421605,0.695988212164564,0.693972745803679,0.690951524339853,0.689074965391050,0.688123173031819,0.688352798872778,0.688878832111106,0.689649100867091,0.691825609968178,0.694406364119656,0.694831849515652,0.695093961657957,0.696544511885500,0.697435187655074,0.696100550498225,0.694578994460745,0.694546370446045,0.694139986777630,0.693781917635003,0.693903784495514,0.694469370100232,0.694981293570831,0.695492523866189,0.696308080414634,0.698292111539330,0.698633861761124,0.698902499613941,0.688919711306074,0.339815135925954,0.291069509301781,
0.677344182475321,0.677739336894399,0.677529013296347,0.678168485788813,0.678074580906852,0.679949607328134,0.679995408394541,0.676989678691530,0.674632315601085,0.674105378085362,0.673755857585948,0.674955353719090,0.675040255999723,0.677179827025456,0.681017494082141,0.684499705726275,0.686315411433970,0.689250632643500,0.693158716023600,0.695654158235319,0.695702856684622,0.695037317145874,0.693120522016117,0.691605612884371,0.689013130985940,0.687285466869809,0.687053608778423,0.689191400916940,0.692695075420098,0.695173142055028,0.696030056282071,0.697735595220454,0.699688915086766,0.700397132798996,0.697956458719517,0.695239858693209,0.694388899818583,0.693447169501382,0.693172003180628,0.693583092689075,0.694122375408189,0.694913237864304,0.696794653246367,0.696896627150191,0.697826619973057,0.698353543322067,0.699341902125340,0.631958085232370,0.155794738173594,0.159130277951797,
0.679834364449190,0.679153296301012,0.677418374619124,0.677364123698532,0.676638456193745,0.675250308759931,0.675395070162678,0.673206311650570,0.673073805549431,0.673494902600869,0.672355471592460,0.673318069330749,0.674786666602520,0.676638137304419,0.680281571009000,0.683416162505743,0.685943246489483,0.687947953459737,0.690960905704785,0.693396523114026,0.695159265658992,0.694665764837308,0.692587034514760,0.690378309361531,0.688385903390582,0.686197928127942,0.686313104646052,0.688991112856122,0.692896177525286,0.695601942733116,0.698385499143760,0.701280847217928,0.703161012698225,0.703520876226047,0.700893912167062,0.698013570921384,0.695919608314435,0.694240497907446,0.694046948303908,0.694215868326751,0.694564203487102,0.687391856433778,0.684935160547389,0.683902711253770,0.683731137354575,0.672156234311792,0.512137394536016,0.141143749690796,0.138402398385285,0.132926839333889,
0.681124546728371,0.679985596819486,0.677294478701775,0.676796584328406,0.676067139049195,0.673808089580662,0.673390414529638,0.672335668997360,0.672761775006913,0.673253903586546,0.671053080742302,0.668708513211208,0.673704768921071,0.678166242867038,0.682422291942552,0.684430358328132,0.685431241979539,0.688040707092505,0.691218069007123,0.692829058922431,0.696035936529787,0.695320509470779,0.693100841372408,0.690402646617465,0.688755379197978,0.686072902564294,0.686915374105800,0.689853923224304,0.694046689597756,0.695987191605161,0.698358302314484,0.702203005138894,0.704858544952842,0.704630335619457,0.701969066144320,0.698936189425224,0.696355461411475,0.695462465170010,0.695707397911832,0.677056383514667,0.625282343155909,0.561266486950138,0.493065652473059,0.526466422746741,0.473993974601070,0.164777343441127,0.133604535409846,0.132692672712809,0.132957048579800,0.132570892257918,
0.679241124863594,0.678929456106431,0.676935503070066,0.675576083237337,0.674110002357695,0.671321850525666,0.670383517526416,0.669660544611543,0.669769419855028,0.670058091951113,0.668731730543778,0.666122062902160,0.666209060760068,0.669565083627739,0.676068824381310,0.682006994918450,0.685151108493141,0.686526969585957,0.688958696705957,0.690605291287865,0.691841809988448,0.693336350254624,0.565272261178881,0.544619976286990,0.390648638410896,0.275848247376804,0.194659136113454,0.155646712253157,0.216721339288040,0.206918222764292,0.138158066160474,0.137120503804904,0.137272566414202,0.137432009035792,0.136014125013094,0.134811503246298,0.140528556444731,0.176250858868572,0.134145705236529,0.156052019098016,0.133338953562310,0.134793713505367,0.134601473106459,0.132472738869949,0.131845467295015,0.132233219327642,0.132304314029407,0.132351755624343,0.133241561608370,0.134333089616552,
0.677598939206846,0.677170910788746,0.675294673469494,0.672860414116576,0.670403868185342,0.667918903668411,0.668164721817471,0.667621760134159,0.666205100153909,0.665552566474881,0.665115798275681,0.664418350351805,0.665190100995319,0.669993181066857,0.676457897474950,0.680835522369781,0.683242334686455,0.686105636499017,0.685792010210810,0.686829465463268,0.683516320799418,0.509518816210535,0.280928171281571,0.157433932981698,0.169607307888050,0.153208895692185,0.156188415369657,0.155531292576073,0.152342183629493,0.137268410019261,0.137407987102330,0.137054633071374,0.136410951633901,0.136376999774922,0.135750917650658,0.135520152746782,0.136613467587444,0.136154170115166,0.135467026174756,0.135105982134350,0.134623854094206,0.134568415922554,0.133764141589553,0.132548775204535,0.132825465003847,0.133432877742487,0.132823971293496,0.133271209015729,0.135342567199222,0.137136856085680,
0.674333334824843,0.674298753047983,0.671690212193077,0.669265905210783,0.666927410406206,0.665674191019746,0.666914725488272,0.666428712334068,0.664064322564162,0.663135997095638,0.662291567847140,0.661834676733501,0.663548502610273,0.669843477890317,0.676811601257930,0.681245301678620,0.684647732114892,0.686049390776155,0.685443003479887,0.680791826850784,0.657684565435706,0.267220147062240,0.156692754422601,0.156674276661500,0.153089682534870,0.153520931565015,0.153769733461374,0.140644570716184,0.138913675004549,0.138600327259703,0.138192411189384,0.137426999544285,0.136040061292696,0.135688353048005,0.135886291766025,0.136450979469387,0.136915002401315,0.136863427661064,0.135295607320951,0.134633936491169,0.134634432642120,0.134214733777649,0.132579876783396,0.131873678451149,0.132533597989548,0.132677547523320,0.132980996792189,0.134603986923152,0.136744752130895,0.137885998002115,
0.668681134932475,0.671003935673989,0.668292286732692,0.667160094962606,0.665631445226022,0.664914925956682,0.666027466103047,0.665196842569962,0.662878353021294,0.662369646461653,0.661845876572993,0.660831622664910,0.662105608660698,0.668288564711808,0.675281880700874,0.680777479357417,0.684871324405974,0.686174741630031,0.683306433517932,0.675391026145276,0.241556322814776,0.156267080382325,0.155851151781744,0.154559389100076,0.154190136144917,0.153502643685246,0.138423060232753,0.139469105683203,0.139719992707020,0.139134369750846,0.138883588155457,0.138647777963046,0.137313645453697,0.136143323357166,0.136096131704793,0.135288464467902,0.134337322873821,0.134833596619485,0.135099872638296,0.134337406184935,0.133774462140690,0.132468114029275,0.131431412631261,0.131711092938892,0.132691646440304,0.133049125854348,0.134125344762425,0.136014803791597,0.138147083261747,0.139055312060954,
0.660941502787574,0.666982072334735,0.667042906309752,0.666174634158876,0.664718444154288,0.663922444206790,0.665133350406477,0.664819771406723,0.663718336550450,0.663650641825527,0.663135696363172,0.661398083104109,0.661953193785312,0.667200597226085,0.673976041000740,0.679670229174107,0.680670802226201,0.674735102298072,0.632058570410217,0.392883622720625,0.156326785066315,0.156174207093260,0.154205124804388,0.154209542018791,0.153862645399939,0.136239239298630,0.137068684841070,0.138293252987977,0.138718583127389,0.138680747550519,0.138967662848383,0.139642595461761,0.138967166649729,0.137702420564943,0.137066932878361,0.135975300057019,0.132780777365238,0.131899896303218,0.131360661070628,0.131552317082137,0.132781396531486,0.132324837655094,0.133140442382652,0.132802909544024,0.134418040630367,0.135759630912741,0.136780575894002,0.138530445141703,0.140207345274326,0.140323632545574,
0.656363993092051,0.662193432845043,0.664523872617403,0.664067769190750,0.662859973314970,0.662482629517704,0.664278312063431,0.665000072525983,0.665043227263447,0.665645760775152,0.665779875268073,0.663558186672070,0.663210487781760,0.667145719598669,0.672944896703725,0.678207503032084,0.681019669195080,0.673622414682365,0.562635075233419,0.164318486172429,0.147760830296683,0.145546274620235,0.138802630502336,0.135835325281674,0.135624224298322,0.136247238532636,0.136958008526027,0.137839823109991,0.137909339713931,0.138878535673750,0.139730846749990,0.140780857758103,0.140531879174872,0.139723771892388,0.138028094785507,0.135560553861681,0.133147054002008,0.132211386078577,0.131537749630753,0.131229291181059,0.132135296589599,0.132597895622122,0.133339421580314,0.132867885562701,0.134790137674234,0.136180156578394,0.137486311436309,0.138852934256798,0.140685783072254,0.140097824972919,
0.651965989245068,0.657231091498604,0.663121379953203,0.662422328931955,0.661033300833807,0.660829866114976,0.663159553142189,0.664546025025122,0.665188676079965,0.666145193763543,0.666216708554139,0.664819963476501,0.665341293453391,0.668628352370715,0.673040481773697,0.677307112227154,0.675925093528790,0.652786448775295,0.325437720427449,0.137943098169428,0.138708808229900,0.134999248658474,0.134308387087415,0.135380286911827,0.136290010803839,0.136701562195418,0.137291302972130,0.138372483210929,0.138866098140103,0.139304482223157,0.140379529942103,0.141273566586435,0.141065341049004,0.140133350749928,0.139342423415478,0.136854134543246,0.133733517883299,0.132299190124067,0.132553847555104,0.132156562454274,0.131626392258621,0.132123382521681,0.133732034179442,0.133822923099482,0.134711627151094,0.136611448447547,0.137730884955922,0.139602928934790,0.140866390998496,0.140600409336062,
0.655169488287825,0.657099173312629,0.660686589425508,0.660337953405299,0.659166221732047,0.659589909534776,0.661875853335686,0.663068025777381,0.663817111270471,0.665269480487130,0.666540098235900,0.666467757042575,0.667529515333930,0.669627634781547,0.672809931868442,0.676154874758568,0.676708820626456,0.294926442069250,0.136373403594334,0.137438388825597,0.137643030976260,0.135993046653731,0.135675181094839,0.136215029111430,0.137423595753421,0.137765994641349,0.138805659335297,0.138508203383136,0.139156211701616,0.139203698890240,0.140224409693687,0.140654354059332,0.140790353521640,0.140664678035372,0.138174926070673,0.134594277803166,0.132999301510771,0.131799073752579,0.130830744526835,0.129824990493182,0.129842203007805,0.132666968123945,0.135013549986288,0.135638210572648,0.135285621863599,0.136435358466772,0.137643584457250,0.139368227149678,0.139058224305813,0.138531731453027,
0.654424831250606,0.655560948858154,0.658488578611956,0.658489685458743,0.657756120199052,0.659035902918984,0.662503488536118,0.664202965488114,0.664577430354210,0.664905068809791,0.665855124521800,0.665938945983704,0.667532335295586,0.670098902997794,0.672434702131035,0.675321696417479,0.412882219265724,0.134850258208751,0.135417800169207,0.136582302499040,0.137109054301983,0.136186208619910,0.136357527970602,0.137127335333560,0.137971624827774,0.138072937511695,0.137927575500652,0.137705458209753,0.138893052982090,0.139188407452418,0.139542368546556,0.139146872751726,0.140903747786490,0.141194185769510,0.136592477845003,0.134746745026030,0.133047858946378,0.131538639798938,0.131042876512427,0.131003311307331,0.130834617224488,0.132142284447426,0.133006479722125,0.133132621419794,0.132853772378481,0.133302820645832,0.130751951636807,0.130154463585923,0.130242055147821,0.129550875120083,
0.648828583141027,0.650447469081364,0.653278302241188,0.654998337080408,0.655422270921496,0.656882236328807,0.658345013294688,0.658498678229469,0.660284935542865,0.661696480284243,0.662734850086692,0.662041640188933,0.660720530144931,0.662145017698614,0.630669350166517,0.453564759664961,0.136458967984841,0.136213432743160,0.136144863407965,0.137060246673184,0.137061167813514,0.136363569951140,0.137171797564925,0.137431856075542,0.138179925023775,0.137576807628660,0.136378138181719,0.136626512651089,0.137501276860926,0.137572007996376,0.137560800502144,0.139109048969215,0.138433231714414,0.137656242599959,0.136102951308647,0.134755804039182,0.132673439213616,0.131242343509514,0.131403420298564,0.131355373854790,0.130879899815233,0.131331014839784,0.132007967215349,0.132629476208941,0.132515404008358,0.132673824300426,0.131805590903788,0.130741548115796,0.129794666237193,0.129136851399589,
0.648216705128349,0.649788037121943,0.653448682542822,0.655046272365587,0.655964123663607,0.657613054458230,0.659227651690168,0.659685924627148,0.660479958580571,0.661394708239315,0.661112882629541,0.659262492928252,0.658748271030048,0.659560511182340,0.510327558123106,0.140881325043020,0.135431789171433,0.135627279470381,0.135873190683936,0.136599409751014,0.136472913393144,0.136875300222671,0.137413110204084,0.136718174815592,0.135521699263063,0.136133031838604,0.136141875207805,0.135839765923620,0.134542947268643,0.136156274266476,0.135519698585971,0.130209116816195,0.130514537523269,0.130852759880152,0.131907977771480,0.132615758915681,0.132428485000193,0.131947387655803,0.131830488560328,0.131146350923954,0.130698440150827,0.130961408879849,0.130986006490244,0.131185106859768,0.130900127161801,0.131306659415255,0.131777395346962,0.131242941856070,0.130568713271638,0.129990192544613,
0.650188277642893,0.650261516354093,0.653960920027581,0.656226322472698,0.657206499970137,0.659004208993627,0.660712257548016,0.660765525557591,0.659701349196118,0.661401484099115,0.660553633344518,0.657747168385920,0.655751517116213,0.374992679122768,0.160177109333149,0.136730038727209,0.135923970169000,0.135706442159842,0.136259899339039,0.136776369009933,0.136533108489746,0.137023561172221,0.136989448800090,0.135846546884435,0.131815463939633,0.131591922723134,0.133342547690156,0.135149425093445,0.135059415230937,0.135798578354276,0.134343600923270,0.131703153408160,0.130883331377496,0.131631485489083,0.132494541311525,0.133083359485724,0.133219417691853,0.132591904481766,0.132021458831797,0.130971330257672,0.130757074327809,0.130508176048899,0.129866857901767,0.129338553219651,0.128691676288149,0.129192578946855,0.129956568782148,0.130228092403492,0.129761022630047,0.129060814901204,
0.649468411502324,0.649014115662294,0.651860962006115,0.654956820899700,0.658135388306702,0.660368074908902,0.661110297807417,0.660603684975341,0.658327476587832,0.655905523631900,0.648942979515033,0.644843370139116,0.338468948105889,0.231945336960488,0.139382977976501,0.138114474544134,0.136799554354236,0.136077100053413,0.136946190698200,0.137265097752448,0.136907103665722,0.136636770249053,0.136958811184371,0.129819799299458,0.131136648084304,0.131721604476365,0.132881069945902,0.133769044564897,0.134443393944547,0.133665678306270,0.134221696162981,0.132848245353596,0.132270269627484,0.132554940869139,0.133118394714351,0.133244258626038,0.132262697415988,0.130770485818426,0.129806970962860,0.129010077603437,0.129259692008621,0.129490948376549,0.128608175867582,0.127631053157192,0.126391768345428,0.126068736816751,0.126270533013068,0.126382117967746,0.125648166953997,0.124819556155449,
0.650527657405568,0.651506053360888,0.654340152874052,0.655687739661125,0.656924241058622,0.659305962954353,0.661520755908881,0.660477677077997,0.658453489619293,0.654824723706464,0.652646190903065,0.417255485138369,0.218049447567965,0.139350751441648,0.138705064767652,0.138736628126076,0.138073050804239,0.136313111705305,0.135577785748916,0.132210652160588,0.130877435002344,0.131716652906208,0.129503803996297,0.130251598798842,0.131237893432936,0.132127646540487,0.133000383959947,0.133772906098982,0.134692353642571,0.133934448758144,0.131281187309555,0.130565099550432,0.130281317706237,0.130277227882270,0.130526123780133,0.130499716104371,0.128959198842730,0.127241521610292,0.126007316601576,0.125728697512641,0.126830681978152,0.127596504175870,0.126855447223660,0.125704756757332,0.124084371994725,0.122826635579610,0.122048170100320,0.121729954167419,0.121596113698727,0.121068276900841,
0.636788620901975,0.643110548871021,0.648591947199115,0.651022009134445,0.650156065695801,0.648055445885150,0.646693660595122,0.647280541261653,0.645738878455276,0.646902099522469,0.376013090080902,0.159571866793354,0.136651121814596,0.137905022773782,0.137872450385968,0.139143210240929,0.134176691066349,0.135194280689103,0.131166124540412,0.132154568330745,0.131951421976390,0.131812105433141,0.131475553756045,0.131760767452139,0.132071606998603,0.132146664624308,0.133285307864827,0.134815181145031,0.134821650438747,0.132015978855082,0.128111223180074,0.126012672754633,0.125510926193210,0.125905828142463,0.126218624002286,0.126393397555152,0.125017790296855,0.123114694920529,0.122037571669779,0.122498792141478,0.124256490532876,0.125491962826576,0.125340623730839,0.124067250000220,0.121735364872929,0.119651043483239,0.118635700710212,0.118821434427086,0.119030170690626,0.118563291940271,
0.639945332523195,0.641567577455795,0.644952955223193,0.648438422847131,0.649200783344310,0.647900524528746,0.647203658451033,0.647353747849788,0.647309309270228,0.219155350450216,0.136695024866173,0.134811624618365,0.135535533674766,0.136347710004304,0.137310700532784,0.135714978364997,0.132831076409462,0.128549047174766,0.130614910856661,0.131910795805731,0.132166530229175,0.132087787383811,0.132408320309685,0.132515024485985,0.132153672757001,0.132545291333676,0.133177717643982,0.134128782021263,0.132267042489196,0.127933238715682,0.123224214913823,0.120586970405165,0.119997738249671,0.121862073971899,0.123313192721355,0.123307010100205,0.121699947643021,0.119682342616171,0.118959076952318,0.120166919916291,0.122121907723721,0.123760431196958,0.123809689640907,0.122025202271871,0.119132527903149,0.117015497439742,0.116075854857090,0.116311063408206,0.116532970532447,0.116252142432990,
0.642160687501233,0.643139065904603,0.644515950683548,0.646198891403467,0.647475487961388,0.648351395292931,0.647348044969191,0.341224292950810,0.161635813138158,0.132863551347066,0.131728799983023,0.133714553169845,0.135073914183722,0.135559332528344,0.133939050533372,0.134827574194583,0.128486619399983,0.128722270787819,0.130046736177730,0.130660848690139,0.131375931130546,0.132379335232611,0.132828713735059,0.131756318614902,0.131134404328223,0.129739603944279,0.131687759154529,0.131370450012709,0.127992214238745,0.123587922444253,0.119377998731800,0.116961149502291,0.116753322127747,0.119306533291578,0.121142153492437,0.121019524782545,0.119926795681874,0.117941915379092,0.117108993070456,0.118641655246820,0.121153949290435,0.122862087388326,0.122549255802244,0.120012881397672,0.117053787028854,0.114816265392403,0.114508595127864,0.115217784211244,0.115690277151504,0.115597068266568,
0.642805551944794,0.643804077145273,0.644399595173654,0.645375831391023,0.647691729133641,0.649072814841109,0.167202818475195,0.143862908790003,0.133420336669829,0.132433179149170,0.132061285765356,0.133312850437703,0.134759916001311,0.133212223198308,0.132848408641733,0.128759132055288,0.128574752589322,0.127668522480143,0.128977711417209,0.128929167755616,0.130309761102519,0.130256338430999,0.128579552584258,0.129120428920264,0.129248646064796,0.129462186122206,0.129200341159648,0.126820505141400,0.123503796740833,0.119933158340773,0.116705775221460,0.115358795734842,0.116166040483010,0.118390286651165,0.119771956728294,0.120078132710813,0.119625146860479,0.118156137472800,0.116973780881039,0.118030514962273,0.120612993413711,0.122273691649726,0.121744882465272,0.119069167167490,0.116565953863760,0.114794228177567,0.115482370325750,0.116460491783128,0.117153792515863,0.117205868152967,
0.626897547145057,0.635260295950087,0.639004177961347,0.641505347451008,0.638154971906979,0.152334816855413,0.146132511109516,0.135949318704118,0.135033490376629,0.133439935734507,0.132680549074736,0.133156590225647,0.131537321970497,0.130626281954509,0.130897248432831,0.127460872291088,0.127583319958900,0.128061736320811,0.127888164614563,0.127435900940462,0.127709100901979,0.129319806491169,0.129342930381982,0.129852318596924,0.129988059724678,0.128110526223869,0.125487509442587,0.122337079502917,0.120146267045294,0.117318496963988,0.115260605104922,0.115250091567744,0.116852885767660,0.118566154567001,0.119084203806947,0.119399648940579,0.119490840130495,0.118788155519427,0.117677781314901,0.117832836889076,0.120007237311317,0.121378092973035,0.120641186769882,0.118727537342100,0.116991414258793,0.116502315288212,0.117611180915746,0.118659740652784,0.119509689778270,0.119880673832270,
0.559660586571677,0.566970039873938,0.553503118808169,0.464291426139212,0.147301958194133,0.145118428216803,0.138212172030142,0.137244100116397,0.137183102969387,0.136132022500299,0.135156573374079,0.134578268233601,0.133012536002996,0.131859152777434,0.129234292111497,0.128868697962621,0.126354064139080,0.127159468794653,0.126268169473294,0.126053689495310,0.127347625346491,0.128801498803464,0.129755208689665,0.130455760104454,0.129162507729015,0.126046565877468,0.122442591988793,0.119670252286734,0.117886149391615,0.115830470570185,0.115546892451489,0.116393397243169,0.117832775000747,0.118869558527225,0.119190493109465,0.119412699650637,0.119227350460307,0.118929544464068,0.118591955637196,0.118053200953543,0.119015967415995,0.119691654771771,0.118484360521215,0.117113901732824,0.116157027101627,0.116528252360631,0.117876676530786,0.119420253043887,0.120925085347995,0.122342478137579,
0.378789009868867,0.433078581933290,0.303688240165194,0.145909145407623,0.144779358326266,0.140872820829030,0.139756216326437,0.139342155234254,0.139944644130206,0.139789227663684,0.139674023393662,0.138103330361602,0.136540234578174,0.134623937288502,0.131729323271718,0.129871619592988,0.124772404215618,0.125468361616336,0.125311872615558,0.126340806936075,0.127500537220914,0.128957777614942,0.130388525915374,0.130345106379211,0.127429837579535,0.124003705436435,0.120756871751153,0.118401555707522,0.116917918202755,0.116054803439296,0.116594233773944,0.117150957903548,0.117972543970487,0.118722047675073,0.119583735356279,0.120059227224189,0.119644759843424,0.118973845987076,0.118681294530587,0.117321299491057,0.117091843809628,0.117530342946441,0.116554868144908,0.115493729136736,0.115046637713302,0.115835828760073,0.117130880653029,0.118743221832903,0.120313681207445,0.122346894236617,
0.189012418053851,0.201027546583117,0.143070585826921,0.145630188177742,0.143898751454517,0.142066685630919,0.141209842697839,0.141247807204877,0.142478522590752,0.143238271603686,0.143479785101057,0.143391397128697,0.141915099098627,0.136802466106749,0.134507175901164,0.126226585927476,0.124834806493155,0.124569833897030,0.124994565364689,0.126369464658530,0.127444573795647,0.128406796381950,0.129616357281168,0.129247985820758,0.126273180831049,0.122940534236635,0.120264598325733,0.117883858537098,0.116330552204992,0.115817901391517,0.116137703872090,0.116322698602692,0.117042760045393,0.117746570179643,0.119329852477471,0.120380632803971,0.120056112132784,0.118823281578504,0.118161199426477,0.116884465880259,0.115836914777871,0.115449561830903,0.115219485166803,0.115031038503812,0.114955176496085,0.115855867640672,0.116682537937545,0.117919212551678,0.119076360039357,0.120872073477617,
0.143182350086171,0.142303822218505,0.143804664553040,0.145795790152309,0.145164944138219,0.143415314086842,0.142786362886514,0.142681210713594,0.143796889521221,0.145007743603875,0.146809037884504,0.148533195244475,0.148684628847678,0.136699931956183,0.135072179198377,0.125992675690966,0.126420889325358,0.126397978015539,0.126331352682032,0.127228513701218,0.127779486251567,0.127395922342198,0.127483147456543,0.127042574017366,0.125338797500032,0.122445844931208,0.120441923886315,0.117947122964843,0.115606417852583,0.114552421640665,0.114319708260306,0.114995294578129,0.116028672430849,0.117321340870075,0.119414202351953,0.120609152161470,0.120591448693463,0.119268028046826,0.118199225682291,0.117201477068327,0.116067391013899,0.115259032013455,0.115103590742030,0.115350569081689,0.115545954123382,0.116263004788878,0.116995610375021,0.118235136905310,0.119059010945845,0.119899612273474,
0.141110459685359,0.142096341409350,0.144472241972713,0.146762812190643,0.146795260816721,0.145744878189215,0.145413392638025,0.144345985731626,0.144502855495744,0.146153806723513,0.149343904480388,0.152647515414201,0.152002350928905,0.136140090784679,0.130397999335304,0.129014919729256,0.129240514544224,0.129021518475183,0.128733386283042,0.128862004896260,0.128451104174221,0.127067723489058,0.126496984737807,0.126139897087884,0.125259586487422,0.123226771396265,0.121053756651363,0.118191047916302,0.115592639399432,0.114152774443181,0.113902255140941,0.114813759505987,0.115955124213362,0.117267652338808,0.119227327154659,0.121404101057412,0.121796624386415,0.121073814914198,0.119991653993074,0.118591015051771,0.117291461774422,0.116430790043897,0.116666109315341,0.116434531616610,0.116833739510931,0.117818817063029,0.118985667806728,0.119991764390069,0.120542687246026,0.120793378670681,
0.140625056530564,0.142780960234499,0.146385812556764,0.148880471770531,0.148206404121740,0.147144173447213,0.146703550221976,0.145888551756824,0.146207112322252,0.148598053146137,0.151919581043517,0.155534323427637,0.154913409805449,0.132604340916993,0.131215684859782,0.130457524123173,0.131177948100638,0.132115386741695,0.132309604634104,0.131525923447809,0.129347003388600,0.126932408928715,0.125494669961987,0.125152827028890,0.124756347229141,0.123518532921312,0.120856650943619,0.118096664317626,0.115759425251194,0.114695629178252,0.114760277561035,0.115483561227156,0.116317933244838,0.116934865330291,0.118554361436392,0.121574105763634,0.122965984637558,0.123298739424277,0.122101932723438,0.120157252157306,0.118774139152015,0.117850610626621,0.118077456355706,0.117602137480926,0.117789603589916,0.119095362853795,0.120612126171078,0.121604650597836,0.121835902273757,0.121232677347846,
0.141250801027242,0.143815159838464,0.148622650594039,0.151049359127847,0.149498298051173,0.147103468781952,0.146655070806245,0.146358692883154,0.146981646413363,0.150782006404179,0.154227655927520,0.155497175873140,0.153577875142606,0.133752799202209,0.132544156048611,0.130946432541970,0.132637109750988,0.135199806221006,0.135294112817423,0.133439300248588,0.129979899470400,0.126746923637189,0.124653259608213,0.123881293381723,0.123736563465727,0.122410185283607,0.119445986611398,0.117273317069125,0.115870831627976,0.115734194862927,0.116012086018425,0.116395277569092,0.116381102664390,0.116636227231079,0.118042450590782,0.121035427691707,0.123296196509287,0.124592375095659,0.123331648566328,0.121152045079230,0.119693232262660,0.118688555484318,0.118076208907663,0.117400806331436,0.117157794850974,0.118977290753191,0.120461319234930,0.121192819774532,0.121312789515654,0.120505649599225,
};
double result_higher_order_tv[2500]={ 0.721812691089675,0.721460537913923,0.720381582156480,0.719043637696869,0.717413884071931,0.715547278842269,0.713555119470613,0.711576123157469,0.709752713145011,0.708200524897696,0.706998943925693,0.706187590832159,0.705716191065495,0.706279538640679,0.707149043100163,0.708399066150389,0.709998284776012,0.711885873222690,0.713970515768564,0.716134604618211,0.718265919425784,0.720270862311452,0.722075471495970,0.723625958225599,0.724892037168900,0.725866743044943,0.726564321917222,0.727017591905444,0.727272503585701,0.727381899748351,0.727400275811963,0.727378472118456,0.727358453061230,0.727369437055122,0.727426009815385,0.727528445094144,0.727664662965829,0.727813338468868,0.727947936417299,0.728041052162061,0.728068693014065,0.728013897092358,0.727869004822804,0.727636445067114,0.727328547431420,0.726966926648341,0.726581897587785,0.726211783483738,0.725899365750350,0.725685086963185,
0.721238142663713,0.720957977797926,0.720094028963360,0.718806310489904,0.717193116306170,0.715344119578917,0.713372840001167,0.711414554872290,0.709609097509857,0.708072941373508,0.706893910606794,0.706134530204620,0.705758421842428,0.706217595700315,0.707072646086489,0.708319406996491,0.709914828820214,0.711795016632627,0.713867972254808,0.716017755940921,0.718132658007913,0.720119648574113,0.721907529866297,0.723442421778780,0.724694292869152,0.725656479762490,0.726343776830651,0.726789237240542,0.727038854644532,0.727145568165330,0.727163824142077,0.727144117521748,0.727127909572622,0.727143933881891,0.727206359467386,0.727315087590484,0.727457671438750,0.727612425405557,0.727752505969152,0.727850375960356,0.727882061422415,0.727830645728692,0.727688504030420,0.727458136645975,0.727151735136696,0.726789844856864,0.726400467321722,0.726021512962609,0.725708328310023,0.725538592430555,
0.720350921380159,0.720081147954551,0.719304450699716,0.718089101100282,0.716531964794258,0.714739227251793,0.712829466081944,0.710934642868387,0.709190280333683,0.707711500640308,0.706583966448632,0.705880246461228,0.705636518121080,0.706004764120115,0.706842408947229,0.708082000867314,0.709664854807732,0.711522504249805,0.713561806319199,0.715670722322374,0.717739389653481,0.719675199187658,0.721414174145078,0.722903555731968,0.724114204724611,0.725040184162113,0.725697450471943,0.726119859432770,0.726353579541974,0.726451609110471,0.726468189993353,0.726453018305910,0.726446339028007,0.726475577637475,0.726553666854440,0.726679380297872,0.726839177642861,0.727010435728457,0.727165549959304,0.727276531065417,0.727319280931269,0.727276911289133,0.727141821138390,0.726916582783211,0.726613618332927,0.726253773548882,0.725864824935247,0.725482796371646,0.725164639029281,0.725027173791634,
0.719034128906203,0.718779681930068,0.718054245132492,0.716913859591743,0.715442435477370,0.713744261695597,0.711937092122279,0.710147796118971,0.708504830702219,0.707121099739086,0.706081277620567,0.705451248159262,0.705303136903971,0.705663206361845,0.706485757315284,0.707708400431421,0.709265512858264,0.711082958659500,0.713067162586839,0.715109963486177,0.717103144735890,0.718958747714709,0.720618433304609,0.722034090801549,0.723178362330491,0.724046339886292,0.724655214896077,0.725040016279537,0.725247327452478,0.725330041419393,0.725341813489568,0.725331111821044,0.725336579069174,0.725383776128385,0.725483720510816,0.725633402033646,0.725817514660379,0.726011950358279,0.726188028704798,0.726317088272150,0.726374728496458,0.726344084582197,0.726217886486970,0.725999245611070,0.725701090632675,0.725344604815048,0.724958048426134,0.724578085934818,0.724261508993230,0.724138572498784,
0.717260765710470,0.717027373369724,0.716357743235714,0.715305188948105,0.713946536311859,0.712379137686324,0.710714627085928,0.709072418717853,0.707571735676309,0.706319509589011,0.705399785675426,0.704873045271359,0.704803614784368,0.705194670864775,0.706017626139014,0.707220616996495,0.708739013751342,0.710497080704171,0.712408064410838,0.714363801812556,0.716244406723942,0.717998045294618,0.719552820228736,0.720868694479219,0.721923501274960,0.722713927770663,0.723257900614450,0.723591516733617,0.723761992866272,0.723821945731386,0.723823889587168,0.723814499213334,0.723830748191547,0.723895914061494,0.724018648354480,0.724193647799752,0.724403470093499,0.724622185408433,0.724819768191662,0.724966692448821,0.725038178679978,0.725017548054741,0.724898323044743,0.724684833964327,0.724391189912824,0.724039241506672,0.723657415540877,0.723282987508202,0.722974099630986,0.722860794243596,
0.715044826386854,0.714836048998962,0.714235141931585,0.713290519986237,0.712072670023590,0.710670903756428,0.709187809448052,0.707732877197170,0.706414314868807,0.705329888913257,0.704559301839857,0.704160352384892,0.704178874427186,0.704618189739975,0.705453074617044,0.706637068043211,0.708107650281223,0.709788438707899,0.711615540133121,0.713478720612353,0.715185394155999,0.716810004962599,0.718245823515244,0.719445411301998,0.720392052181899,0.721087259140471,0.721551110853707,0.721820797517890,0.721944045533399,0.721972879226836,0.721957988978409,0.721943432178219,0.721964834946815,0.722042669919586,0.722182995933764,0.722377870209290,0.722607693389230,0.722844703376706,0.723057454042437,0.723215505688286,0.723293841443922,0.723276406565280,0.723158179951875,0.722945494510193,0.722654423737213,0.722307920884623,0.721934297719459,0.721571072601840,0.721276418076893,0.721176128738695,
0.712419013847302,0.712238645961592,0.711719613095775,0.710904338657248,0.709855357060744,0.708652347550012,0.707387022128221,0.706156935772686,0.705057692088282,0.704175656159731,0.703582101733485,0.703330142100726,0.703452402397136,0.703951647812161,0.704804768943526,0.705969428659729,0.707388745381394,0.708986223916416,0.710671409948124,0.712364406657809,0.713970413059589,0.715448475602182,0.716738757914642,0.717801694445956,0.718623245789800,0.719208055772593,0.719578506784706,0.719772707810183,0.719838455988996,0.719826932767016,0.719786129467574,0.719756873776660,0.719773545430107,0.719853447353952,0.720000049147808,0.720202402782595,0.720439122327384,0.720680865885614,0.720894934493098,0.721050238280245,0.721122026000460,0.721095537768328,0.720967971060360,0.720748605467223,0.720456589215110,0.720116502327528,0.719755159076605,0.719411853976607,0.719143645632113,0.719065783750854,
0.709427402402720,0.709279545352482,0.708854726345225,0.708188744267654,0.707334578885192,0.706360704538771,0.705346367209165,0.704374721484139,0.703527711464327,0.702878219973653,0.702487111638605,0.702398963204020,0.702638108732578,0.703205344577222,0.704078517470720,0.705216854562733,0.706566610738608,0.708061350324147,0.709617333087315,0.711153202836428,0.712608925200714,0.713925014821934,0.715053177885350,0.715963553623937,0.716646377936998,0.717108996599657,0.717375813113543,0.717485267460158,0.717484023300320,0.717422484351744,0.717343309102263,0.717287824350249,0.717286222883443,0.717352416381974,0.717488312336216,0.717679658079938,0.717903629527099,0.718129744951311,0.718324459811687,0.718456601510748,0.718502478101178,0.718449447785271,0.718297760266610,0.718060731394348,0.717761849769413,0.717428249856271,0.717082926167368,0.716768151580912,0.716546995017590,0.716509117462888,
0.706122760971002,0.706011130951874,0.705691730338670,0.705192390330185,0.704555250064119,0.703836767158221,0.703101914974424,0.702417416186797,0.701849974572992,0.701457187520407,0.701287787572087,0.701376794565421,0.701741284804026,0.702379767823808,0.703271212621071,0.704377847516781,0.705649442256977,0.707026299543074,0.708439066945113,0.709815208255694,0.711099578302650,0.712239027063842,0.713193444780468,0.713940756471258,0.714475716771985,0.714808553935367,0.714965451531876,0.714984652956131,0.714909443201711,0.714789971860071,0.714651809799701,0.714555811105858,0.714521400945577,0.714555682645986,0.714658729384066,0.714815361136531,0.715001718282662,0.715186701338571,0.715336517905560,0.715420702127332,0.715417463365393,0.715316986745481,0.715123422474017,0.714855642986189,0.714542109013952,0.714207995986535,0.713878699443881,0.713593420481819,0.713438843305566,0.713460744646203,
0.702564809965770,0.702492453364625,0.702288058482003,0.701968959647704,0.701566502349667,0.701124346146456,0.700690590193732,0.700316603556549,0.700047555876343,0.699928458218830,0.699992556382907,0.700265248123314,0.700757839962389,0.701465851408500,0.702369121258779,0.703434168337999,0.704616887433670,0.705864742361738,0.707120018284657,0.708323345473466,0.709423327208568,0.710375457240216,0.711148628291413,0.711727214801004,0.712109881246755,0.712309878765255,0.712354610642435,0.712281811875675,0.712132518867665,0.711934277913557,0.711734418542498,0.711576914424222,0.711484645453415,0.711467392984442,0.711512208452782,0.711606867326603,0.711727188702816,0.711842385005777,0.711919489977568,0.711929736165281,0.711853907994217,0.711685431123911,0.711433207982760,0.711124895223293,0.710799404199422,0.710438908015328,0.710101375331483,0.709832496616924,0.709726142561644,0.709758238708663,
0.698818859476030,0.698788037899448,0.698706102566545,0.698577243210573,0.698422848661111,0.698270105333002,0.698149000941556,0.698102119809450,0.698142286010708,0.698301936392504,0.698602769224888,0.699057980885414,0.699673355484177,0.700442259539645,0.701345502043926,0.702354788124576,0.703434034405012,0.704539810257853,0.705624848618808,0.706641792938825,0.707547184606410,0.708305660256844,0.708894527779670,0.709303359373124,0.709533926785600,0.709602935252318,0.709538279593148,0.709368714316441,0.709145462482774,0.708859434559713,0.708587538704216,0.708351154329806,0.708175114297389,0.708084589424874,0.708043395969019,0.708046400898773,0.708070761583102,0.708086767395095,0.708063499570278,0.707975172434480,0.707806001456151,0.707553407353213,0.707233056958803,0.706887885211354,0.706604644518545,0.706196611820376,0.705730752983801,0.705442441148213,0.705269225538710,0.704875475754129,
0.694953746329761,0.694967402189756,0.695013229061443,0.695083124369306,0.695185248242117,0.695325876099503,0.695519755132153,0.695797322208285,0.696150758740298,0.696585122291532,0.697113017013459,0.697739920519452,0.698464364835559,0.699277249873406,0.700161893848689,0.701096463589393,0.702053962149853,0.703001689255873,0.703903684095862,0.704723439938876,0.705427128072968,0.705990187297024,0.706396378153693,0.706639233384973,0.706722431978558,0.706666316443728,0.706507189544328,0.706248587566604,0.705950489901079,0.705544784537050,0.705187573056362,0.704868547212936,0.704588327177318,0.704398409759512,0.704247137861677,0.704130603543313,0.704030135325649,0.703919020989865,0.703769685940339,0.703560543426400,0.703280646869086,0.702932733433421,0.702544769447492,0.702207942963585,0.701684393948710,0.701173686739248,0.700753832354021,0.700357904766340,0.700098919292635,0.699845673195632,
0.691038479883647,0.691106465355493,0.691283937059343,0.691554901932205,0.691903293401046,0.692323507525891,0.692852062710138,0.693431970530591,0.694078816960661,0.694776128884217,0.695514678509257,0.696291413312410,0.697100634997270,0.697931960373354,0.698772551163115,0.699608497255163,0.700422840531738,0.701194758347781,0.701901021623772,0.702516051225307,0.703013372445499,0.703383270418706,0.703613938620368,0.703701695397858,0.703650897098878,0.703479476526731,0.703239675187993,0.702965780198097,0.702459709945894,0.701983558512746,0.701537330295163,0.701123249010594,0.700737622740847,0.700414217278410,0.700129440886347,0.699870354966558,0.699620697040074,0.699358493700832,0.699061127108752,0.698711604615646,0.698305198907635,0.697847933560448,0.697349080445415,0.696832345845030,0.696309385479802,0.695841667379963,0.695485407805569,0.695167676720496,0.694900921710809,0.695136517147513,
0.687145566982656,0.687286904877741,0.687595771357340,0.688052351269746,0.688597066530559,0.689215600852916,0.690132554928881,0.691039713151992,0.691956379598599,0.692879772680582,0.693794971316236,0.694688873224723,0.695549434277282,0.696365833786362,0.697130879037880,0.697840075652269,0.698487569381611,0.699065198539691,0.699563754497955,0.699970881906653,0.700262090769505,0.700443796859925,0.700510265421435,0.700460647866863,0.700302819000629,0.700065932326540,0.699674240152816,0.699243370297743,0.698729356249076,0.698191137232403,0.697655098466176,0.697133773627464,0.696632649972182,0.696164198727456,0.695723512737182,0.695300597270672,0.694882314031013,0.694451660866330,0.693990888601591,0.693485903050708,0.692935966334995,0.692354799407688,0.691766463494576,0.691178649820299,0.690651287690839,0.690242772331252,0.690005412376874,0.689927603993797,0.689859143445394,0.689432012922257,
0.683263508614981,0.683535618218813,0.683983451950864,0.684636031820484,0.685335381306953,0.686426244565694,0.687514130190239,0.688639943355352,0.689777321076221,0.690888593620018,0.691940429089724,0.692909378618660,0.693779284429176,0.694541121377655,0.695194938553466,0.695746992249772,0.696203888757838,0.696570487626074,0.696851449308449,0.697047802102044,0.697139370015338,0.697144532005106,0.697062694980924,0.696895383103460,0.696637566955795,0.696274485322741,0.695854469650353,0.695353738242385,0.694793641178521,0.694193635582159,0.693572653803245,0.692941934631200,0.692312882930378,0.691692779571046,0.691083316062345,0.690482052781867,0.689882945517538,0.689276249343957,0.688646904668285,0.687985482319400,0.687297486971010,0.686599163673979,0.685921416644359,0.685291686717958,0.684770463947342,0.684417920185972,0.684247362897277,0.684226830240685,0.684199771158566,0.683584458641233,
0.679490866240784,0.679902414294936,0.680484666038288,0.681304615201097,0.682361353042093,0.683594872410594,0.684894532577538,0.686228614756600,0.687549529452214,0.688800923384500,0.689938512901792,0.690932195291175,0.691763525354317,0.692427419175152,0.692933432035623,0.693299587718104,0.693545242358125,0.693689492295567,0.693751097020838,0.693741386728917,0.693642657649337,0.693484973078476,0.693273431870848,0.693011919058664,0.692693972646117,0.692291509934575,0.691834847147496,0.691301855414140,0.690704212183516,0.690050079905827,0.689350626601311,0.688613535607761,0.687852165900432,0.687075849458205,0.686290979192681,0.685504093103020,0.684719918979352,0.683942383671543,0.683149508191450,0.682338428475397,0.681524291574012,0.680724852537384,0.679968587555787,0.679300853974252,0.678782086050416,0.678475676243359,0.678412931992365,0.678574451635613,0.678763939247936,0.678565413548720,
0.676087071827030,0.676561135622454,0.677243979825309,0.678226403844943,0.679454925824185,0.680848976140142,0.682329111639286,0.683829741827397,0.685280276945143,0.686613929880148,0.687779992588051,0.688743192303874,0.689484968939488,0.690007801771417,0.690333918231506,0.690492369861483,0.690510131058058,0.690426643301771,0.690279987850280,0.690058570117577,0.689796262830776,0.689502226368428,0.689195792113674,0.688881190600895,0.688540426947788,0.688145215436586,0.687690520905102,0.687157100249200,0.686544637267178,0.685854015221165,0.685088003191378,0.684250639526684,0.683357990781906,0.682424969085928,0.681463551471755,0.680490021414873,0.679521906212452,0.678588652203495,0.677647632970673,0.676704633822512,0.675783522038201,0.674905344977607,0.674091661226443,0.673395030970010,0.672892692303752,0.672629824720012,0.672741478386871,0.673328869728432,0.673819201437618,0.672686959103547,
0.673029763379407,0.673557754436002,0.674313637527359,0.675390941201193,0.676734337428185,0.678252460142953,0.679857100853823,0.681460214795782,0.682975740733789,0.684329213283055,0.685462761579362,0.686338188534673,0.686940639441248,0.687283095135900,0.687403699060728,0.687343884805519,0.687121332022785,0.686807560187923,0.686517298968826,0.686026958352980,0.685619979953677,0.685242013022821,0.684900314565558,0.684590567364691,0.684281814545894,0.683939300033109,0.683529047199071,0.683032947522076,0.682436019131840,0.681733571813323,0.680916572847897,0.679989987248330,0.678971691054204,0.677882764023372,0.676749457078678,0.675597771509453,0.674463499627314,0.673384520825806,0.672307412837062,0.671265993475924,0.670270362325230,0.669338487260178,0.668500239559852,0.667786208782493,0.667348629735885,0.667113587788091,0.667220904332095,0.668030791486264,0.669886679721911,0.662710048230250,
0.670331780432352,0.670894165660011,0.671701195381528,0.672835997832036,0.674245322203970,0.675833041249136,0.677495920246362,0.679132365809525,0.680644918145225,0.681952307922895,0.682991592944541,0.683724710773553,0.684143566017437,0.684271442736217,0.684161711881363,0.683881280940350,0.683423918758777,0.682880031812686,0.682310134880822,0.681737894085432,0.681228744777622,0.680808492325784,0.680492557653070,0.680252936661225,0.680042858506583,0.679819054522136,0.679493669987911,0.679074716913737,0.678522376659813,0.677844192080085,0.676990123667279,0.675987049300800,0.674854804629688,0.673604530120997,0.672303486324492,0.670980911173774,0.669677195086668,0.668481754154160,0.667312805476961,0.666223827896833,0.665215416303064,0.664236313733629,0.663400667292406,0.662682481673705,0.662355970007817,0.662208111509506,0.662188117002386,0.661754718439967,0.643474663176861,0.619629715217847,
0.667994079155561,0.668564966805199,0.669421102581257,0.670574223823247,0.672001561917931,0.673601546268518,0.675254060713586,0.676853576741834,0.678294513251325,0.679489950813778,0.680376733596705,0.680920418233398,0.681120785666126,0.681011257849295,0.680652812777836,0.680119896077166,0.679433315692664,0.678690514591134,0.677949410253389,0.677281710211104,0.676728568175323,0.676339259551361,0.676125331127290,0.676036164765027,0.675985380120714,0.675955692456043,0.675757415308743,0.675464995720229,0.674968597776000,0.674352908331949,0.673476181868311,0.672404338421027,0.671166530922426,0.669747062224212,0.668268847994926,0.666786480645399,0.665319186173566,0.664098601406805,0.662850383572797,0.661746087945221,0.660847671259945,0.659863506368142,0.658913542822143,0.658269721194249,0.657993904623942,0.658076551142132,0.658415998026603,0.658013537343220,0.571491918259095,0.510273955535391,
0.666011591627285,0.666511109778804,0.667445656679749,0.668612777736962,0.670012106936512,0.671558664098186,0.673128733874415,0.674619586195765,0.675922334579216,0.676946448237886,0.677631221917180,0.677949419479331,0.677908527075810,0.677558701121108,0.677028540656232,0.676135870911592,0.675229543555118,0.674334136760096,0.673498204278134,0.672791812404136,0.672276820600417,0.672008250861019,0.671978258507528,0.672158406046418,0.672354904002803,0.672538946180133,0.672501356889965,0.672370287001475,0.671976745780456,0.671411919445487,0.670534782924070,0.669397606778301,0.668049351796244,0.666479514697273,0.664822487352538,0.663178382177162,0.661621905273462,0.660324693452809,0.659031792004639,0.657911612219923,0.657261851257540,0.656620454528867,0.655061606258463,0.654728239423490,0.654207369394240,0.654167149997709,0.655580485288150,0.578667249207461,0.467741214621116,0.407495593961236,
0.664527313480127,0.665042388566222,0.665829659654251,0.666910584126466,0.668228770563394,0.669663287270438,0.671093553570716,0.672412137567434,0.673516039047137,0.674318335204959,0.674763173783652,0.674834222932362,0.674546207020425,0.673931997204236,0.673040571082771,0.672020423494887,0.670963076753733,0.669960063856775,0.669087171149332,0.668417509229253,0.668016948501234,0.667920881390264,0.668105686146897,0.668626357351266,0.669392774303207,0.669701937333871,0.669908348737507,0.669794520111852,0.669727322719815,0.669121511797567,0.668224492296310,0.667090279519627,0.665526033967750,0.663894249625919,0.662106222630242,0.660115053402416,0.658966440143572,0.657277567892813,0.655751602140248,0.654730874343876,0.653941583584574,0.654793647284293,0.650561053788741,0.651927062893860,0.651398795483450,0.649662191935101,0.597182193918784,0.474532640581214,0.348070400011410,0.304827034176258,
0.663245965104939,0.663733923787142,0.664436877177626,0.665398045693806,0.666587906351967,0.667829715664309,0.669080048310832,0.670189438190197,0.671054338847795,0.671598746457233,0.671775599212729,0.671579393912440,0.671036798676860,0.670196393392207,0.669096431730090,0.667911530438921,0.666744362446810,0.665694655885458,0.664846923444420,0.664263844486472,0.663974386666279,0.663955901786148,0.664349603012795,0.664520740645436,0.666733077812129,0.667150247300871,0.668206505313517,0.667562440928608,0.668251381642036,0.667503785284655,0.666358484874318,0.665425458344613,0.663308174439859,0.661550709356185,0.660077654275896,0.656037333085504,0.656941693105951,0.655207739254811,0.652544478747531,0.652175291014174,0.649332797870618,0.617991242027846,0.603194395098135,0.591792832593505,0.568618135115296,0.501558983761890,0.414995768297398,0.300684015579274,0.231700134508828,0.194350312271971,
0.662118380501919,0.662538777779931,0.663160562089486,0.664002288821097,0.664994178336654,0.666042902091329,0.667056939924960,0.667911396791570,0.668507388719360,0.668776635708444,0.668681751291674,0.668228579092714,0.667460677718406,0.666418167262329,0.665178484410865,0.663882621051084,0.662662496887113,0.661632550730747,0.660866850571161,0.660380657829702,0.660094381505118,0.659637615859104,0.660701034137767,0.655952021014845,0.629954555532863,0.634457719929711,0.630366908249074,0.620903277764024,0.606633628769177,0.586206462823664,0.569021919368133,0.578141026512457,0.604155532101049,0.615670777627512,0.624359279621297,0.626380003793233,0.625072415106422,0.609312364633902,0.594383560118750,0.545935235808915,0.484331528927800,0.433124776286030,0.403280519297007,0.396700202766417,0.371742667976941,0.294797912194782,0.218124071960968,0.188390158942982,0.187901453066257,0.189188439396539,
0.660988365449252,0.661332956577200,0.661846024684991,0.662541120958226,0.663345514477376,0.664177293440093,0.664936219172393,0.665517296878919,0.665837883256908,0.665837244200134,0.665491455411325,0.664808519242472,0.663862311071691,0.662650730371225,0.661334140172716,0.659999564134972,0.658786992424672,0.657833033982972,0.657217635938559,0.656872887412073,0.656481029481272,0.649490315187522,0.547289048333548,0.501116771330412,0.451050537711252,0.413881402252777,0.391386003093396,0.372597849287793,0.372444283330722,0.352718151610812,0.310592680147279,0.276031574181095,0.259395842754242,0.241327875257103,0.240405092444219,0.248565629715273,0.274403824019899,0.289902763070067,0.276521622382399,0.270591183264688,0.235359772624850,0.207659054070598,0.187829082361687,0.184606179714234,0.182704020499494,0.181556312039019,0.182086818185159,0.183441538866012,0.184027151800985,0.184690670265168,
0.659691595068356,0.659971104543786,0.660372735341702,0.660908208508885,0.661516910449628,0.662118467214832,0.662617217625988,0.662929828195196,0.662996968240081,0.662753524967862,0.662204568220978,0.661365569625440,0.660275413708359,0.659000894073109,0.657656247241750,0.656339062504856,0.655175751832105,0.654312107336888,0.653913635772305,0.654083334239988,0.635905965764632,0.505285278122724,0.383335552059931,0.312143692217432,0.273102830785025,0.224075879314971,0.208833939255669,0.202807736313144,0.198012708676405,0.191855144061341,0.189348356849395,0.190688754112905,0.187938433331297,0.185881643455088,0.186944818142909,0.184874584579880,0.186235141204696,0.182824876839412,0.181644733407705,0.180474972492620,0.182207006984688,0.178843661755687,0.179378227089097,0.178817590669895,0.178406585087497,0.178037766498084,0.178160747995566,0.178742999422953,0.179371994230146,0.179772133211897,
0.658074583831856,0.658287546282710,0.658582141613366,0.658960746601781,0.659374393831997,0.659749350198661,0.660001844236263,0.660064607204398,0.659922128145830,0.659485023379366,0.658780153999899,0.657843750934795,0.656715800058025,0.655470532702310,0.654194540144903,0.652968965975752,0.651881286724283,0.651021002429505,0.650563285876520,0.628967947689022,0.500363769267320,0.375568253682300,0.254574838841811,0.215504885170534,0.201150909642353,0.198642510574121,0.197037110776440,0.192925314955637,0.189870592118893,0.188702075842990,0.187065182775950,0.186434463471822,0.185033029005304,0.183495680212162,0.182824799196154,0.181283851634772,0.180586531703208,0.179288249896693,0.178170605560846,0.177119307142101,0.176946986291005,0.175421560263409,0.174475976774095,0.173893654223370,0.173538404755407,0.173353508316723,0.173380675607353,0.173576525121224,0.173981424141039,0.174356739954518,
0.655964605205515,0.656115086311948,0.656311180807523,0.656546336252989,0.656784386956136,0.656967288602682,0.657022614549088,0.656878257927767,0.656557044834148,0.655996930755752,0.655217699112482,0.654265426100542,0.653195344950970,0.652081216320405,0.650988870398254,0.649947592303004,0.648926497979526,0.647914941672892,0.646640774546416,0.512033965861954,0.364975560854012,0.244224241000478,0.205601225899556,0.198527926814898,0.197153258524662,0.194502731755471,0.191774507711737,0.189043736529084,0.186541501711439,0.184851030814583,0.183478898800927,0.182104240820439,0.180740828070826,0.179535246733073,0.178381439945866,0.177230772754219,0.175905371850454,0.174788047274698,0.173702436946411,0.172744813423274,0.171697778588299,0.170628388501062,0.169528479734853,0.168698841332513,0.168119342241987,0.167778688782339,0.167633983377181,0.167606006539956,0.167742540787411,0.168136045206470,
0.653205098093900,0.653304695804350,0.653418142752326,0.653537181764732,0.653639731238173,0.653691760582240,0.653613382270528,0.653414295368138,0.652893626211112,0.652254114980188,0.651491359722323,0.650630894307310,0.649726601868288,0.648849575140769,0.648062734763098,0.647343952543418,0.646460233637279,0.629575711530879,0.537647122171491,0.395541837900414,0.255760729008633,0.198701163038445,0.196789130625924,0.193944188457518,0.192128969268827,0.189897579962326,0.187115410362219,0.184489679110539,0.182158859013328,0.180150159577729,0.178546974603506,0.176954253946045,0.175466333730510,0.174208664401295,0.172936457897295,0.171821552671537,0.170524014191889,0.169337971860870,0.168177979759387,0.167147843821333,0.165930110526055,0.164815612829050,0.163719750822786,0.162770183559070,0.162023124975267,0.161487185605579,0.161140303420585,0.160930649701920,0.160796541441670,0.160772568925390,
0.649673699302137,0.649743484139274,0.649800686395006,0.649842895830445,0.649857638258080,0.649863755855671,0.649606601985219,0.649254307870307,0.648808331744980,0.648249939243111,0.647618321107593,0.646956453026267,0.646318233203782,0.645766154049230,0.645361146518269,0.645145044034433,0.644952200153355,0.598885449591543,0.441004393957148,0.283886436478412,0.195764775264478,0.192593369264771,0.190460775201446,0.188613586475849,0.186646394051302,0.184405411640279,0.181763845682639,0.179095372489054,0.176659055903197,0.174464771958830,0.172566524737061,0.170821480359684,0.169238624300928,0.167871382336123,0.166561158365278,0.165361921831505,0.164139204831412,0.162947776956918,0.161771238483248,0.160662813272506,0.159473782107558,0.158315298419578,0.157206826466083,0.156201295215099,0.155349816681557,0.154667122725805,0.154151272938798,0.153806951736699,0.153618077064907,0.153478805976008,
0.645296661408887,0.645360686244213,0.645396126828465,0.645416895973876,0.645410898060615,0.645365426596413,0.645095548866803,0.644770968814940,0.644408600380329,0.644010236435053,0.643606322354176,0.643238248376242,0.642955058469446,0.642804151541326,0.642771610651057,0.642735505124072,0.598347616706249,0.487939653095699,0.344582313416845,0.199572215397953,0.188756459465685,0.186749852232432,0.184675615413745,0.182776297843145,0.180643675473526,0.178225941905171,0.175566376870122,0.172832985210326,0.170249251531544,0.167897252325167,0.165798392590812,0.163927536825018,0.162278378980564,0.160832754307278,0.159513890136193,0.158280037243297,0.157093667076965,0.155931670582906,0.154788085158094,0.153664603966973,0.152522041076236,0.151381966261828,0.150281796443298,0.149263047937509,0.148361792451708,0.147599178273000,0.146982287256729,0.146537453088433,0.146390605563143,0.146771753157053,
0.640063777340194,0.640142424721166,0.640186734223406,0.640238516633993,0.640359456635492,0.640248179914668,0.640059879907526,0.639880850620335,0.639703714961065,0.639549585090516,0.639457994140262,0.639469495760132,0.639604926649096,0.639909653652683,0.640284189428209,0.640670762314677,0.527000508492838,0.369196618246246,0.221031989604437,0.180862309828904,0.181403285905381,0.180513280331803,0.178722970492622,0.176604317950509,0.174205744497056,0.171558666995145,0.168751319854596,0.165913876653135,0.163204739307834,0.160731064017176,0.158519081333331,0.156577499890252,0.154896171633344,0.153423464816564,0.152112196694781,0.150902357508828,0.149762278336785,0.148655140719636,0.147569618445347,0.146485759041493,0.145399287154996,0.144315397964100,0.143260035704933,0.142266404663474,0.141363256373078,0.140574381487886,0.139912190817806,0.139371551600522,0.138986012327708,0.139052967141053,
0.634006715584730,0.634121705509810,0.634214526750234,0.634314874413890,0.634440553818448,0.634512052107479,0.634565051048876,0.634631667026207,0.634740378736555,0.634916614039229,0.635196544528849,0.635648822398094,0.636273903345185,0.637133604372174,0.637846207237652,0.559424545407564,0.405845265775147,0.250487327423108,0.176661183305890,0.176205659673576,0.175666523944479,0.174477126056689,0.172557761696356,0.170161492171531,0.167467552171138,0.164576398770820,0.161589850344325,0.158630175018075,0.155829689820581,0.153285253033501,0.151033178541585,0.149081958627553,0.147410812563356,0.145963706824634,0.144692642331417,0.143544723525460,0.142476557515690,0.141450627967256,0.140447576740126,0.139445258099621,0.138441150253100,0.137440284533456,0.136460673780244,0.135526313525440,0.134658472224204,0.133872762804651,0.133177535256271,0.132561195375214,0.131955151519595,0.131378382809034,
0.627183259739295,0.627353032124349,0.627539219852648,0.627785484686213,0.628074576859272,0.628387946198435,0.628728123666245,0.629116289047479,0.629600668634209,0.630205701382497,0.630892145343603,0.631713009107720,0.632782964007302,0.634249618306807,0.551021558090661,0.418751644630255,0.273606125689739,0.173798241707723,0.172898803859760,0.171901842658560,0.170517749671215,0.168651296452069,0.166290303621199,0.163543791664059,0.160555407259564,0.157438992422361,0.154295733757526,0.151244963734151,0.148405981319396,0.145859541094990,0.143638148556536,0.141738692618367,0.140126578762974,0.138749048768014,0.137556079361551,0.136498816877774,0.135529084754415,0.134609743324573,0.133715596793257,0.132826550388870,0.131934726465424,0.131043097938799,0.130166058147085,0.129322530906568,0.128529390091297,0.127795007308280,0.127121139890247,0.126516408303654,0.125951258183912,0.125133371386023,
0.619716477933717,0.619961137601786,0.620294334877656,0.620757045964632,0.621321622429312,0.621969658653532,0.622679285667562,0.623446930320825,0.624337065859271,0.625472266364873,0.626720828237610,0.627566354805319,0.628837992906859,0.570212355114410,0.430863976796839,0.289368974586041,0.172514077179337,0.170863493440435,0.169253677965201,0.167485298466420,0.165351841600775,0.162827831654568,0.159965350330710,0.156853277723215,0.153599476879022,0.150303481783655,0.147063459690474,0.143991434703654,0.141190184497890,0.138719762565890,0.136596319897811,0.134802283023175,0.133295254050167,0.132025731277936,0.130945251244671,0.130005505463623,0.129159709687504,0.128370194127170,0.127608147475798,0.126853225507755,0.126094808019229,0.125334325388133,0.124583817871877,0.123860794338401,0.123182627481619,0.122559615665693,0.121989340483548,0.121479667031287,0.121164003435237,0.121376287884206,
0.611779123542413,0.612104799295914,0.612639339602409,0.613397346554187,0.614324631428686,0.615391225243578,0.616566578147905,0.617783290502512,0.618998781538482,0.620494220508403,0.622855537770692,0.623240832348451,0.579715248740850,0.443090856811236,0.305584177030846,0.172345118035692,0.169976026213507,0.167802894299612,0.165449529867694,0.162864109331923,0.160016561084308,0.156914786230117,0.153612420520455,0.150189505554306,0.146735022408341,0.143336411816342,0.140085545277710,0.137080369725290,0.134398492293720,0.132074539301887,0.130105853983670,0.128463339954324,0.127102992750948,0.125978524862773,0.125043161306967,0.124248343501077,0.123548684911547,0.122905906542107,0.122289652055250,0.121679101923689,0.121064356676448,0.120447164801072,0.119838528250174,0.119255429751974,0.118717603289702,0.118247133883909,0.117865258949382,0.117573441977710,0.117375882533723,0.117545656574039,
0.603597302926524,0.604022416659587,0.604805797444768,0.605927023217195,0.607286431813510,0.608819697203222,0.610515721309197,0.612309224377702,0.613850675540127,0.614774692034412,0.606172173048469,0.589252719731162,0.453347760469027,0.315612013195441,0.177062880372092,0.170602441119419,0.167268164165137,0.164234655048218,0.161174914630141,0.157925552516805,0.154493137057815,0.150928754132693,0.147292007801858,0.143654831295081,0.140095590780197,0.136693230774541,0.133528455828893,0.130676948643484,0.128186521529848,0.126067152555718,0.124300764342858,0.122851842262703,0.121677333340193,0.120732900701188,0.119971654339243,0.119344529103883,0.118806031220376,0.118318114391468,0.117851385612446,0.117386938472121,0.116917310763269,0.116445231690539,0.115981272686272,0.115541812962453,0.115145846783082,0.114813596819051,0.114569391715282,0.114436498627313,0.114391817958206,0.114406394281531,
0.595482329876792,0.595997116884290,0.597059938248714,0.598570403651762,0.600430058244929,0.602451690043427,0.604574289507808,0.606879197094522,0.609245532793941,0.595641252615494,0.583591685502672,0.459574605562942,0.325651245308579,0.188371747719343,0.167848775388055,0.166227114051050,0.163421364983163,0.160049367083142,0.156437382009288,0.152667465848209,0.148804030502478,0.144918161092093,0.141075349935359,0.137343104512656,0.133792885516614,0.130493793062183,0.127509301179256,0.124887952838794,0.122648829307934,0.120782200166762,0.119259535923087,0.118042238886503,0.117087943364997,0.116351773305864,0.115784978958682,0.115338017641335,0.114966276792846,0.114633784340635,0.114314253898312,0.113992076818857,0.113662298852417,0.113328362996883,0.112999858618777,0.112691531427639,0.112421930676500,0.112210564673021,0.112075869577173,0.112037234198279,0.112084438143372,0.112037551421281,
0.587539446185797,0.588214523094497,0.589555075722261,0.591438118772951,0.593846141018672,0.596459899384399,0.598939676449576,0.600958326235120,0.578804956394153,0.536252849022436,0.422944139564836,0.305746783179695,0.197317942350538,0.168904646670736,0.164958537287129,0.162072828045578,0.158899407130496,0.155255442639030,0.151284655024170,0.147158595699126,0.143014297181159,0.138949781953208,0.135035189358037,0.131333998570041,0.127908900541603,0.124814167583287,0.122091444459583,0.119762580012969,0.117823372910935,0.116249694946028,0.115006441707896,0.114052708551058,0.113344383591398,0.112833781142631,0.112470414796883,0.112205854276085,0.111998779436401,0.111817217115215,0.111638857600748,0.111451114753828,0.111250792182797,0.111042090271339,0.110834083548958,0.110639579549297,0.110475071467793,0.110359134572084,0.110307998488405,0.110330252331746,0.110411315571544,0.110358259633506,
0.579590400802301,0.580634727592044,0.582301072994304,0.584430176795961,0.587226710863403,0.590540381026189,0.593986633501859,0.588970113687634,0.491959769032154,0.377669381565278,0.260776874836626,0.176624241134386,0.166177559773750,0.163460576409045,0.160890716133610,0.157737574126329,0.154108624770269,0.150105915292480,0.145847497712971,0.141494161556996,0.137207721073255,0.133100568111195,0.129242313144453,0.125689313986571,0.122491315171742,0.119684571636240,0.117288159336206,0.115300509765202,0.113700090964845,0.112452597126723,0.111517364849186,0.110849780367693,0.110401727402847,0.110122483118697,0.109961962777217,0.109875393087380,0.109826372964602,0.109787632844718,0.109740756956171,0.109675789945820,0.109590812065773,0.109490771605888,0.109384905534906,0.109284856514363,0.109204550325863,0.109159837385459,0.109165295893473,0.109224532020674,0.109311857402684,0.109267041139789,
0.571502847897733,0.573178611242343,0.575285333387890,0.577475544757690,0.579639554180554,0.582848453539089,0.537978884802330,0.435045444350078,0.333104214174414,0.223153282823321,0.170371252991348,0.168504541422390,0.164227567369852,0.160280047748183,0.156854499131479,0.153165028515876,0.149088731241852,0.144737029158213,0.140247887148680,0.135775319030120,0.131471682655809,0.127443070124388,0.123751794428596,0.120443875686075,0.117553528423380,0.115098623211129,0.113077581846662,0.111468829511140,0.110237076066822,0.109340024796118,0.108730944832528,0.108359787160838,0.108174427410041,0.108123280338986,0.108159209100756,0.108242479134620,0.108341814343269,0.108434427034573,0.108505719247563,0.108548596117943,0.108562654468308,0.108553464562470,0.108530576831203,0.108505227697962,0.108489434656221,0.108495888931236,0.108536151921295,0.108612242043749,0.108694533615639,0.108658734347198,
0.562298766293644,0.565147146428720,0.568277564988692,0.571107157423682,0.569612613963837,0.492771868041918,0.382720286506258,0.282696829042459,0.189742911048380,0.169632228657845,0.167374922551504,0.164752295010453,0.161146518600960,0.156922014267368,0.152698437383662,0.148379385600050,0.143870286752361,0.139233477638037,0.134598141242923,0.130108079193471,0.125892601830792,0.122039120140513,0.118600796656467,0.115612580625171,0.113091445245571,0.111035135478820,0.109423123303609,0.108218209900957,0.107373569708618,0.106838708330876,0.106560313942155,0.106483202608837,0.106553297984990,0.106720875048170,0.106943073660669,0.107185009368406,0.107419967498305,0.107629522535907,0.107803337999264,0.107937624646070,0.108034011741355,0.108098637907496,0.108140982755979,0.108172065152217,0.108202932535230,0.108243972873394,0.108303567805130,0.108382443140276,0.108454281032259,0.108426370098483,
0.546168110802728,0.551608033316264,0.546076617117301,0.525784687495135,0.440269155259422,0.352267081326080,0.260009003514192,0.175544773842674,0.170361799480728,0.167636849341435,0.164825383093216,0.161445749448787,0.157463091885998,0.152962410263869,0.148242809319636,0.143424915720904,0.138556092766031,0.133719973565103,0.129026918260943,0.124602686269635,0.120553769873671,0.116949553152433,0.113829758519818,0.111214290273830,0.109102343700566,0.107472073001995,0.106285311743762,0.105492643810988,0.105038015225012,0.104862300991642,0.104905627261042,0.105109625065239,0.105420832709713,0.105793006664685,0.106187623635837,0.106573921614913,0.106929225749246,0.107239527354783,0.107499690920624,0.107709333944191,0.107872355839651,0.107995635594165,0.108088260296420,0.108160665176130,0.108223332204377,0.108285487204434,0.108353512430721,0.108427104652370,0.108486094401008,0.108465559193983,
0.469999405049101,0.470485673392634,0.439151712018564,0.379283948522270,0.304206259430532,0.224925460949652,0.175446555666603,0.173149090922553,0.169413060169900,0.165877904286306,0.162291383157498,0.158222103008165,0.153661513465766,0.148741058958971,0.143612635638790,0.138423179025433,0.133295690690072,0.128342498244969,0.123669159302006,0.119379572914677,0.115555556464714,0.112253211823352,0.109495587139630,0.107281402530499,0.105591901040958,0.104390907543982,0.103626018680844,0.103236211739931,0.103157099868876,0.103322271615032,0.103666564429174,0.104130402335373,0.104662569911339,0.105220770817674,0.105770470432321,0.106284348744208,0.106743347005261,0.107137850390016,0.107468849965699,0.107739304210271,0.107955104851034,0.108124056020867,0.108255032644117,0.108357622430623,0.108441477055847,0.108515100518760,0.108584125787620,0.108648312699889,0.108694019264792,0.108680605363934,
0.356628789467802,0.357005285384448,0.307454756682550,0.237968590361662,0.186228683127359,0.177557513836760,0.174765489628543,0.171704580404746,0.168054999700398,0.164024183485593,0.159721743157100,0.155015529114980,0.149905556982908,0.144531333154551,0.139024469407754,0.133545179909981,0.128245177668986,0.123251012318520,0.118667635251256,0.114575781382455,0.111023769733960,0.108049599422027,0.105664401612694,0.103850548515066,0.102572155983285,0.101780677559664,0.101413212597536,0.101398526926263,0.101663964506551,0.102137905446340,0.102752165248081,0.103447243922802,0.104174820916370,0.104896705575816,0.105582174251306,0.106206005199606,0.106751220655716,0.107214385029012,0.107601868861399,0.107920355003960,0.108177300618944,0.108381274248019,0.108541276371715,0.108666288244628,0.108764926269564,0.108844754390463,0.108911030400987,0.108964497870556,0.108997726081544,0.108990627073751,
0.240767657644929,0.237212876515527,0.196285324157767,0.185163325703888,0.182581454193691,0.178399168355908,0.174597575627410,0.170737859891539,0.166590280143237,0.162065016375505,0.157192988017247,0.151943915375450,0.146362643819598,0.140559221668357,0.134706668618040,0.128996725978507,0.123583019558558,0.118610757996928,0.114183474860504,0.110331108668281,0.107078080283700,0.104435709446429,0.102404149253369,0.100960480611052,0.100058702192857,0.099637290885938,0.099623373625571,0.099938329726094,0.100502891945535,0.101241782856254,0.102086075138410,0.102977265393082,0.103869987211211,0.104730495046632,0.105532486054495,0.106250682750668,0.106862490023674,0.107380447396241,0.107811819469308,0.108167071813467,0.108455502720749,0.108686140821702,0.108868066034566,0.109009964120742,0.109119651181766,0.109203681749026,0.109266786464816,0.109310787288470,0.109333654514202,0.109331797132966,
0.189785592146244,0.190851523017601,0.189850213308844,0.185845074367943,0.182112241026232,0.178227563773795,0.174166881993485,0.169841546482781,0.165213565430804,0.160188207333084,0.154892302652737,0.149173959811518,0.143230882088603,0.137062072130263,0.130887173650898,0.124993820152265,0.119506144010226,0.114588122831571,0.110379208368979,0.106777729394232,0.103815370942449,0.101487794339293,0.099776098718113,0.098652108543314,0.098069541209383,0.097959306185922,0.098238945119357,0.098823550478304,0.099630247385402,0.100581363197514,0.101608368396582,0.102655042862735,0.103679483315057,0.104652319974651,0.105552093649809,0.106354610063307,0.107010618578491,0.107568918592450,0.108033976602087,0.108416531947985,0.108728163776647,0.108978754822646,0.109177273403315,0.109332033200160,0.109450295585119,0.109537894404975,0.109599069222070,0.109636439912322,0.109652190972495,0.109655098559388,
0.190083671505031,0.189849357523544,0.188584391349184,0.185584836345200,0.181777924988224,0.177784227378552,0.173547728111111,0.168916753588871,0.164007337365258,0.158580549234229,0.153042496512559,0.146932758214390,0.140663376932855,0.134195520126842,0.127751714531649,0.121706148568850,0.116184991021554,0.111324581854030,0.107376087155484,0.104036350203159,0.101327219551674,0.099265522889340,0.097821504857955,0.096953457118901,0.096616161156132,0.096741725785998,0.097242785343645,0.098027662875042,0.099011671679008,0.100116887448596,0.101275071291593,0.102432805197404,0.103554151795219,0.104616113625412,0.105596434180736,0.106469931222150,0.107155226105072,0.107734911577284,0.108222914486442,0.108625706885617,0.108954103702906,0.109219024487224,0.109429780678233,0.109594318355398,0.109719345257395,0.109810196270758,0.109870843071787,0.109904511783066,0.109916424229657,0.109924044956589,
0.190067957872676,0.189545837505222,0.187860468208117,0.185079939846698,0.181322475194511,0.177231270449471,0.172923209966922,0.168067421460332,0.162913523981469,0.157381143134221,0.151682490809129,0.145552123129031,0.138897652715884,0.131972285878569,0.125358659317473,0.119187081563661,0.113703352587382,0.109025645717769,0.105252399650536,0.102164599542147,0.099677223795507,0.097807843442470,0.096546258765904,0.095850971893075,0.095675402651783,0.095954409067574,0.096600661868761,0.097516477586157,0.098613988313487,0.099816446240489,0.101056235064232,0.102281117838203,0.103463710335281,0.104602401673772,0.105678797291951,0.106547352342952,0.107269474418973,0.107860341744127,0.108355971037679,0.108769932654560,0.109110228698352,0.109385658097055,0.109605121646965,0.109776530659208,0.109906415523132,0.109999879850591,0.110060805880622,0.110092813380558,0.110102946050660,0.110114241400352,
0.189988211006262,0.189545110751451,0.187777162973164,0.184518087918290,0.180531210223993,0.176285663608057,0.172123406002155,0.167745724661565,0.161778220287309,0.156950067710583,0.150406398543599,0.145070353319924,0.138384085744781,0.130404637421021,0.123539740714697,0.117201932850583,0.111713304344236,0.108096640872240,0.104382865505966,0.101240514674573,0.098777108923311,0.096981569536774,0.095812778077279,0.095213374700669,0.095127575617934,0.095490790117087,0.096219747569838,0.097215407696235,0.098384188898369,0.099647059749927,0.100936483846124,0.102198670063960,0.103408611178716,0.104607351119365,0.105961256063823,0.106589272289120,0.107293852713924,0.107917010424345,0.108434425725813,0.108858267667765,0.109203465462861,0.109482201536872,0.109704308492418,0.109877805396125,0.110009110000356,0.110103189235824,0.110163859363152,0.110194744676534,0.110202972617005,0.110213109035898,
};
#endif
| 648.93311
| 938
| 0.86146
|
sstefan
|
765cd70f5a96b89546dc72335dfd316028616f4e
| 1,348
|
cpp
|
C++
|
Accepted_The 2000's ACM-ICPC/P2670 (Euro Efficiency).cpp
|
peneksglazami/acm-icpc-training
|
a3c41b65b8f8523713f9859b076f300a12c4e7f3
|
[
"CC0-1.0"
] | null | null | null |
Accepted_The 2000's ACM-ICPC/P2670 (Euro Efficiency).cpp
|
peneksglazami/acm-icpc-training
|
a3c41b65b8f8523713f9859b076f300a12c4e7f3
|
[
"CC0-1.0"
] | null | null | null |
Accepted_The 2000's ACM-ICPC/P2670 (Euro Efficiency).cpp
|
peneksglazami/acm-icpc-training
|
a3c41b65b8f8523713f9859b076f300a12c4e7f3
|
[
"CC0-1.0"
] | null | null | null |
/************************************
Problem: 2670 - Euro Efficiency
Europe - Northwestern - 2002/2003
Solved by Andrey Grigorov
************************************/
#include <stdio.h>
#include <string.h>
const int maxn = 10000, maxc = 6;
int i,j,test,sum,max,a[2*maxn+1],c[maxc],q1[2*maxn+1],q2[2*maxn+1],q1_cnt,q2_cnt,step;
int n_to_m(int n){
return n+maxn;
}
int main(){
scanf("%d",&test);
while (test--){
memset(a,0,(2*maxn+1)*sizeof(a[0]));
q1_cnt = maxc;
for (i = 0; i < maxc; i++){
scanf("%d",&c[i]);
a[n_to_m(c[i])] = 1;
q1[i] = c[i];
}
step = 0;
do{
step++;
for (i = 0; i <= q1_cnt; i++){
q2[i] = q1[i];
q2[i] = q1[i];
}
q2_cnt = q1_cnt;
q1_cnt = 0;
for (i = 0; i < q2_cnt; i++)
for (j = 0; j < maxc; j++){
if (q2[i] - c[j] >= -maxn){
if (!a[n_to_m(q2[i]-c[j])]){
a[n_to_m(q2[i]-c[j])] = a[n_to_m(q2[i])]+1;
q1[q1_cnt++] = q2[i]-c[j];
}
}
if (q2[i] + c[j] <= maxn){
if (!a[n_to_m(q2[i]+c[j])]){
a[n_to_m(q2[i]+c[j])] = a[n_to_m(q2[i])]+1;
q1[q1_cnt++] = q2[i]+c[j];
}
}
}
}while (q1_cnt && (step <= 100));
sum = 0;
max = 0;
for (i = 1; i <= 100; i++){
sum+=a[n_to_m(i)];
if (max < a[n_to_m(i)])
max = a[n_to_m(i)];
}
printf("%0.2f %d\n",(float)sum/100,max);
}
return 0;
}
| 21.396825
| 86
| 0.445846
|
peneksglazami
|
765cd867436a8af3275530578ab62cb5cffd5ff3
| 1,301
|
cpp
|
C++
|
src/main.cpp
|
Xpost2000/Killbot
|
8cc287758e0c26d0350343f383f5adfe0acac0e9
|
[
"MIT"
] | null | null | null |
src/main.cpp
|
Xpost2000/Killbot
|
8cc287758e0c26d0350343f383f5adfe0acac0e9
|
[
"MIT"
] | null | null | null |
src/main.cpp
|
Xpost2000/Killbot
|
8cc287758e0c26d0350343f383f5adfe0acac0e9
|
[
"MIT"
] | null | null | null |
/*
* KILLBOT
*
* is an open source game about robot survival.
* You play as a killbot in a small arena in which
* other killbots are sent to destroy you. For the
* moment killbots aren't very strong and have strength
* in numbers.
*
* You have a cannon. Use it effectively
*/
#include "Engine.h"
#include "include\cef_app.h"
int main(int argc, char** argv){
//CefManager::instance()->getSettings().windowless_rendering_enabled = true;
int result = CefManager::instance()->InitializeCEF(argc, argv);
if (result >= 0){
return result;
}
Engine::InitSDL();
SDL_DisplayMode desktopDisplay;
// should usually adopt the desktop display mode .
SDL_GetDesktopDisplayMode(0, &desktopDisplay);
// this is for the preview version
if (GameVersionId == GameVersionPreview || GameVersionId == GameVersionFinal){
// start fullscreen, or just read from a cfg file....
Engine::Init("Killbot Engine", desktopDisplay.w, desktopDisplay.h, true);
}
else if (GameVersionId == GameVersionDeveloper){
Engine::Init("Killbot Engine", 1024, 768, false);
}
Engine* gameEngine = Engine::instance();
gameEngine->processArguments(argc, argv);
gameEngine->run();
delete gameEngine;
Engine::QuitSDL();
CefManager::instance()->ShutdownCEF();
return 0;
}
| 30.97619
| 80
| 0.697925
|
Xpost2000
|
766558655aec767615863693988008bb3f665d4c
| 594
|
hpp
|
C++
|
include/menu/menu.hpp
|
tanacchi/rogue_game
|
fd8f655f95932513f6aa63e0c413bbe110a4418a
|
[
"MIT"
] | 10
|
2018-09-13T14:47:07.000Z
|
2022-01-10T11:46:12.000Z
|
include/menu/menu.hpp
|
tanacchi/rogue_game
|
fd8f655f95932513f6aa63e0c413bbe110a4418a
|
[
"MIT"
] | 13
|
2018-09-18T19:36:32.000Z
|
2020-11-12T16:26:22.000Z
|
include/menu/menu.hpp
|
tanacchi/rogue_game
|
fd8f655f95932513f6aa63e0c413bbe110a4418a
|
[
"MIT"
] | null | null | null |
#ifndef INCLUDED_MENU_HPP
#define INCLUDED_MENU_HPP
#include <functional>
#include <memory>
#include <map>
class GameStatus;
class GameMaster;
class MenuHandler;
class Menu
{
public:
friend MenuHandler;
using MenuPtr = std::unique_ptr<Menu>;
using ContentType = std::multimap<std::string, std::function<GameStatus(MenuPtr&)> >;
Menu(const ContentType& content = base_content);
const ContentType& get_content() const;
private:
static const ContentType base_content;
static ContentType item_content;
ContentType content_;
};
#endif // INCLUDED_MENU_HPP
| 20.482759
| 89
| 0.739057
|
tanacchi
|
7670b032c7e811bd9a5216aa86fb9dd93b453465
| 1,956
|
cpp
|
C++
|
src/libdbcppp/ValueTableImpl.cpp
|
jgelinske/dbcppp
|
ce1b91a7dda0468ac27c6e15c290102bb052d4f8
|
[
"MIT"
] | null | null | null |
src/libdbcppp/ValueTableImpl.cpp
|
jgelinske/dbcppp
|
ce1b91a7dda0468ac27c6e15c290102bb052d4f8
|
[
"MIT"
] | null | null | null |
src/libdbcppp/ValueTableImpl.cpp
|
jgelinske/dbcppp
|
ce1b91a7dda0468ac27c6e15c290102bb052d4f8
|
[
"MIT"
] | null | null | null |
#include "../../include/dbcppp/Network.h"
#include "ValueTableImpl.h"
using namespace dbcppp;
std::unique_ptr<ValueTable> ValueTable::create(
std::string&& name
, boost::optional<std::unique_ptr<SignalType>>&& signal_type
, std::unordered_map<int64_t, std::string>&& value_encoding_descriptions)
{
boost::optional<SignalTypeImpl> st;
if (signal_type)
{
st = std::move(static_cast<SignalTypeImpl&>(**signal_type));
(*signal_type).reset(nullptr);
}
tsl::robin_map<int64_t, std::string> veds;
for (auto&& ved : value_encoding_descriptions)
{
veds.insert(std::move(ved));
}
return std::make_unique<ValueTableImpl>(std::move(name), std::move(st), std::move(veds));
}
ValueTableImpl::ValueTableImpl(
std::string&& name
, boost::optional<SignalTypeImpl>&& signal_type
, tsl::robin_map<int64_t, std::string>&& value_encoding_descriptions)
: _name(std::move(name))
, _signal_type(std::move(signal_type))
, _value_encoding_descriptions(std::move(value_encoding_descriptions))
{}
std::unique_ptr<ValueTable> ValueTableImpl::clone() const
{
return std::make_unique<ValueTableImpl>(*this);
}
const std::string& ValueTableImpl::getName() const
{
return _name;
}
boost::optional<const SignalType&> ValueTableImpl::getSignalType() const
{
if (_signal_type)
{
return *_signal_type;
}
return boost::none;
}
const std::string* ValueTableImpl::getvalueEncodingDescriptionByValue(int64_t value) const
{
const std::string* result = nullptr;
auto iter = _value_encoding_descriptions.find(value);
if (iter != _value_encoding_descriptions.end())
{
result = &iter->second;
}
return result;
}
void ValueTableImpl::forEachValueEncodingDescription(std::function<void(int64_t, const std::string&)>&& cb) const
{
for (const auto& ved : _value_encoding_descriptions)
{
cb(ved.first, ved.second);
}
}
| 29.19403
| 113
| 0.68865
|
jgelinske
|
767756c6d1dfd5a1775d08cb4906735249b67ea5
| 1,596
|
cpp
|
C++
|
cpp/tests/data_structures/ray.cpp
|
LawrenceRafferty/ray-tracer-challenge
|
f54dfd4eb717e44c9e313be4bd28f8fad00094d0
|
[
"MIT"
] | null | null | null |
cpp/tests/data_structures/ray.cpp
|
LawrenceRafferty/ray-tracer-challenge
|
f54dfd4eb717e44c9e313be4bd28f8fad00094d0
|
[
"MIT"
] | null | null | null |
cpp/tests/data_structures/ray.cpp
|
LawrenceRafferty/ray-tracer-challenge
|
f54dfd4eb717e44c9e313be4bd28f8fad00094d0
|
[
"MIT"
] | null | null | null |
#define CATCH_CONFIG_MAIN
#include "../framework/catch.hpp"
#include "../../src/data_structures/four_tuple/four_tuple.cpp"
#include "../../src/data_structures/matrix/matrix.cpp"
#include "../../src/data_structures/ray/ray.cpp"
using data_structures::four_tuple;
using data_structures::matrix;
using data_structures::ray;
TEST_CASE("creating and querying a ray")
{
auto origin = four_tuple::point(1, 2, 3);
auto direction = four_tuple::vector(4, 5, 6);
auto r = ray(origin, direction);
REQUIRE(origin == r.getOrigin());
REQUIRE(direction == r.getDirection());
}
TEST_CASE("computing a point from a distance")
{
auto origin = four_tuple::point(2, 3, 4);
auto r = ray(origin, four_tuple::vector(1, 0, 0));
REQUIRE(origin == r.getPositionAt(0));
auto expected = four_tuple::point(3, 3, 4);
REQUIRE(expected == r.getPositionAt(1));
expected = four_tuple::point(1, 3, 4);
REQUIRE(expected == r.getPositionAt(-1));
expected = four_tuple::point(4.5, 3, 4);
REQUIRE(expected == r.getPositionAt(2.5));
}
TEST_CASE("translating a ray")
{
auto r = ray(four_tuple::point(1, 2, 3), four_tuple::vector(0, 1, 0));
auto m = matrix::translation(3, 4, 5);
auto r2 = r.getTransformed(m);
REQUIRE(four_tuple::point(4, 6, 8) == r2.getOrigin());
REQUIRE(four_tuple::vector(0, 1, 0) == r2.getDirection());
}
TEST_CASE("scaling a ray")
{
auto r = ray(four_tuple::point(1, 2, 3), four_tuple::vector(0, 1, 0));
auto m = matrix::scaling(2, 3, 4);
auto r2 = r.getTransformed(m);
REQUIRE(four_tuple::point(2, 6, 12) == r2.getOrigin());
REQUIRE(four_tuple::vector(0, 3, 0) == r2.getDirection());
}
| 31.92
| 71
| 0.684211
|
LawrenceRafferty
|
767e6b89e4818d63cbcce2ea9819112e26c3d0cf
| 952
|
cpp
|
C++
|
uva/10139.cpp
|
larc/competitive_programming
|
deccd7152a14adf217c58546d1cf8ac6b45f1c52
|
[
"MIT"
] | 1
|
2019-05-23T19:05:39.000Z
|
2019-05-23T19:05:39.000Z
|
uva/10139.cpp
|
larc/oremor
|
deccd7152a14adf217c58546d1cf8ac6b45f1c52
|
[
"MIT"
] | null | null | null |
uva/10139.cpp
|
larc/oremor
|
deccd7152a14adf217c58546d1cf8ac6b45f1c52
|
[
"MIT"
] | null | null | null |
// 10139 - Factovisors
#include <cstdio>
#define N 46340
int primes[N], n_primes = 0;
void sieve()
{
bool not_prime[N] = { 0 };
primes[n_primes++] = 2;
for(int i = 3; i < N ; ++i)
if(!not_prime[i])
{
primes[n_primes++] = i;
for(int j = i * i; j < N; j += (i << 1))
not_prime[j] = 1;
}
}
int factovisors(int n, const int & p)
{
int count = 0;
while(n)
{
count += n / p;
n /= p;
}
return count;
}
int prime_pow(int & n, const int & p)
{
int count = 0;
while(n % p == 0)
{
count++;
n /= p;
}
return count;
}
bool divide(int m, int n)
{
for(int i = 0; i < n_primes && primes[i] <= m; ++i)
{
if(prime_pow(m, primes[i]) > factovisors(n, primes[i]))
return 0;
}
if(m > 1) return n >= m;
return 1;
}
int main()
{
sieve();
int n, m;
while(scanf("%d %d", &n, &m) != EOF)
if(n >= m || divide(m, n)) printf("%d divides %d!\n", m, n);
else printf("%d does not divide %d!\n", m, n);
return 0;
}
| 13.222222
| 62
| 0.515756
|
larc
|
768ba2602a8160d7e2db21f5c03cdc9a19e19fae
| 2,777
|
cpp
|
C++
|
Algorithms/tree_t(G)/Correctness/bruteForceValidator.cpp
|
lucaskeiler/AlgoritmosTCC
|
eccf14c2c872acb9e0728eb8948eee121b274f2e
|
[
"MIT"
] | null | null | null |
Algorithms/tree_t(G)/Correctness/bruteForceValidator.cpp
|
lucaskeiler/AlgoritmosTCC
|
eccf14c2c872acb9e0728eb8948eee121b274f2e
|
[
"MIT"
] | null | null | null |
Algorithms/tree_t(G)/Correctness/bruteForceValidator.cpp
|
lucaskeiler/AlgoritmosTCC
|
eccf14c2c872acb9e0728eb8948eee121b274f2e
|
[
"MIT"
] | null | null | null |
#include <vector>
#include "bruteForceValidator.hpp"
#include <string>
#include <algorithm>
#include <iostream>
void cleanInfectedArray(int *infected,int n,std::vector<int> infected_at_0){
for(int i=0;i<=n;i++)
infected[i] = -1;
for(auto vertex : infected_at_0)
infected[vertex] = 0;
}
int simulate(Graph *g, int* infected,int k){
bool veredict = false;
int total_infected, current_time, infected_neighbors;
bool infection_occured;
total_infected = k;
current_time = 0;
do{
infection_occured = false;
for(int i=0;i<g->n;i++){
if(infected[i] != -1)continue;
infected_neighbors = 0;
for(auto x : g->adjList[i]){
if(infected[x] != -1 && infected[x] <= current_time){
infected_neighbors++;
}
}
//std::cout << i << " -> " << g->perc_limit[i] << " => " << infected_neighbors << std::endl;
if(infected_neighbors >= g->perc_limit[i]){
// if(debug)
// std::cout << "Infecting " << i << " at time" << current_time+1 << std::endl;
infection_occured = true;
total_infected++;
infected[i] = current_time + 1;
}
}
current_time++;
}while(infection_occured);
if(total_infected == g->n)
return current_time - 1;
return -1;
}
int testIfSetSizeKPercolates(Graph *g,int k){
//std::cout << "Testing size " << k << std::endl;
int n = g->n;
std::vector<int> infected_at_0;
std::vector<int> remainingVertices;
//Detect degree 1 vertices
// for(int i=0;i<g->n;i++){
// if(g->adjList[i].size() == 1){
// infected_at_0.push_back(i);
// }else
// {
// remainingVertices.push_back(i);
// }
// }
// int permutationVertices = remainingVertices.size();
std::string infectedSet = "";
for(int i=0;i<n;i++){
if(i>=(n - k))
infectedSet.push_back('1');
else
infectedSet.push_back('0');
}
int infected[n+1];
int infectionTimeK = -1;
int maxTime = -1;
do{
cleanInfectedArray(infected,n,infected_at_0);
//std::cout << infectedSet << " -> ";
for(int i=0;i<n;i++){
if(infectedSet[i] == '1')
infected[ i ] = 0;
}
// bool debug;
// std::cin >> debug;
infectionTimeK = simulate(g,infected,k);
//std::cout << infectionTimeK << std::endl;
if(infectionTimeK != -1)
maxTime = std::max(maxTime,infectionTimeK);
}while( std::next_permutation(infectedSet.begin(),infectedSet.end()));
return maxTime;
}
| 24.359649
| 104
| 0.521066
|
lucaskeiler
|
371d97ef72bb564a2b56f6e68fd1e922a1730088
| 663
|
cpp
|
C++
|
Algorithm/unionfind/unionfind_xwd.cpp
|
andywu1998/C_and_Cpp
|
dd1eaed4f2321cca9bb23e91791668e2eb2622cf
|
[
"MIT"
] | null | null | null |
Algorithm/unionfind/unionfind_xwd.cpp
|
andywu1998/C_and_Cpp
|
dd1eaed4f2321cca9bb23e91791668e2eb2622cf
|
[
"MIT"
] | 1
|
2017-12-26T11:47:06.000Z
|
2017-12-26T11:47:06.000Z
|
Algorithm/unionfind/unionfind_xwd.cpp
|
andywu1998/C_and_Cpp
|
dd1eaed4f2321cca9bb23e91791668e2eb2622cf
|
[
"MIT"
] | 2
|
2017-12-25T12:32:56.000Z
|
2017-12-26T15:16:06.000Z
|
#include <stdio.h>
int pre[100];
int find(int x);
void unite(int x, int y);
int main()
{
int i, x, y;
for (i = 0; i < 100; i++)
{
pre[i] = i;
// printf("%d ", pre[i]);
}
int t;
scanf("%d", &t);
while (t--)
{
scanf("%d%d", &x, &y);
unite(x, y);
}
scanf("%d", &t);
while (t--)
{
scanf("%d%d", &x, &y);
if(find(x) == find(y))
{
printf("1\n");
}
else
{
printf("0\n");
}
}
}
int find(int x)
{
return x == pre[x] ? x : pre[x] = find(pre[x]);
}
void unite(int x, int y)
{
pre[find(x)] = find(y);
}
| 15.418605
| 51
| 0.363499
|
andywu1998
|
37234c4c16d92cdee36d57b50d1381c3e4e672e3
| 3,044
|
cpp
|
C++
|
tools/converter/source/optimizer/merge/EliminateSqueezeExpandDims.cpp
|
JujuDel/MNN
|
8a82f5c5a7ae37192784c2dbd6dfc8ca8833565a
|
[
"Apache-2.0"
] | 6,958
|
2019-05-06T02:38:02.000Z
|
2022-03-31T18:08:48.000Z
|
tools/converter/source/optimizer/merge/EliminateSqueezeExpandDims.cpp
|
JujuDel/MNN
|
8a82f5c5a7ae37192784c2dbd6dfc8ca8833565a
|
[
"Apache-2.0"
] | 1,775
|
2019-05-06T04:40:19.000Z
|
2022-03-30T15:39:24.000Z
|
tools/converter/source/optimizer/merge/EliminateSqueezeExpandDims.cpp
|
JujuDel/MNN
|
8a82f5c5a7ae37192784c2dbd6dfc8ca8833565a
|
[
"Apache-2.0"
] | 1,511
|
2019-05-06T02:38:05.000Z
|
2022-03-31T16:59:39.000Z
|
//
// EliminateSqueezeExpandDims.cpp
// MNNConverter
//
// Created by MNN on 2020/12/03.
// Copyright © 2018, Alibaba Group Holding Limited
//
#include "../TemplateMerge.hpp"
#include "MNN/expr/ExprCreator.hpp"
#include "MNN_generated.h"
namespace MNN {
namespace Express {
class EliminateSqueezeExpandDims {
public:
EliminateSqueezeExpandDims();
};
EliminateSqueezeExpandDims::EliminateSqueezeExpandDims() {
auto match = [this](EXPRP expr) -> bool {
if (!expr->get()) {
return false;
}
if ((expr->get()->type() != OpType_Squeeze) && (expr->get()->type() != OpType_ExpandDims)) {
return false;
}
VARP input = expr->inputs().at(0);
const Op* inputOp = input->expr().first->get();
if (inputOp == nullptr) {
return false;
}
if (input->expr().first->outputSize() != 1) {
return false;
}
if (expr->get()->type() == OpType_Squeeze) {
if (inputOp->type() != OpType_ExpandDims) {
return false;
}
auto squeezeDims = expr->get()->main_as_SqueezeParam()->squeezeDims();
int expandDim = inputOp->main_as_ExpandDims()->axis();
if (squeezeDims->size() != 1) { // squeeze can apply to multi-dimension, but expand_dims can only have single axis value
return false;
}
if (expandDim != squeezeDims->data()[0]) {
return false;
}
}
if (expr->get()->type() == OpType_ExpandDims) {
if (inputOp->type() != OpType_Squeeze) {
return false;
}
auto squeezeDims = inputOp->main_as_SqueezeParam()->squeezeDims();
int expandDim = expr->get()->main_as_ExpandDims()->axis();
if (squeezeDims->size() != 1) { // squeeze can apply to multi-dimension, but expand_dims can only have single axis value
return false;
}
if (expandDim != squeezeDims->data()[0]) {
return false;
}
}
return true;
};
auto fold = [this](EXPRP expr) -> bool {
VARP input = expr->inputs().at(0);
input = input->expr().first->inputs().at(0);
auto* identity = new MNN::ExtraT;
identity->type = "Identity";
identity->engine = "Tensorflow";
std::unique_ptr<MNN::OpT> identity_op(new MNN::OpT);
identity_op->name = expr->name();
identity_op->type = OpType_Extra;
identity_op->main.type = OpParameter_Extra;
identity_op->main.value = identity;
EXPRP identity_expr = Expr::create(identity_op.get(), {input});
Expr::replace(expr, identity_expr);
return true /*modified*/;
};
TemplateMerge::getInstance("Merge").insertTemplate("EliminateSqueezeExpandDims", match, fold);
}
static EliminateSqueezeExpandDims g_eliminate_squeeze_expand_dims;
} // namespace Express
} // namespace MNN
| 31.381443
| 132
| 0.563403
|
JujuDel
|
37239605b4e641979c520fc3e11b184be411ffcd
| 4,222
|
cpp
|
C++
|
tests/atomic.cpp
|
drbobbeaty/DKit
|
b3ae323449a8ad6c93e46dd4d07443f8fcc1a001
|
[
"Unlicense"
] | 19
|
2015-01-16T10:11:39.000Z
|
2022-02-17T01:48:25.000Z
|
tests/atomic.cpp
|
drbobbeaty/DKit
|
b3ae323449a8ad6c93e46dd4d07443f8fcc1a001
|
[
"Unlicense"
] | null | null | null |
tests/atomic.cpp
|
drbobbeaty/DKit
|
b3ae323449a8ad6c93e46dd4d07443f8fcc1a001
|
[
"Unlicense"
] | 3
|
2015-06-28T13:20:15.000Z
|
2015-12-01T08:35:35.000Z
|
/**
* This is the tests for the atomic integers and boolean values
*/
// System Headers
#include <iostream>
#include <string>
// Third-Party Headers
// Other Headers
#include "atomic.h"
int main(int argc, char *argv[]) {
bool error = false;
/**
* Check the atomic bool - setting values, flipping values, etc.
*/
abool b = true;
if (!error) {
if (!b) {
error = true;
std::cout << "ERROR - the abool could not be assigned the initial value 'true'!" << std::endl;
} else {
std::cout << "Passed - the abool can be assigned an initial value" << std::endl;
}
}
if (!error) {
b = false;
if (b) {
error = true;
std::cout << "ERROR - the abool could not be assigned the value 'false'!" << std::endl;
} else {
std::cout << "Passed - the abool can be assigned a value" << std::endl;
}
}
if (!error) {
b = true;
if (++b) {
error = true;
std::cout << "ERROR - the abool could not be pre-incremented!" << std::endl;
} else {
std::cout << "Passed - the abool can be pre-incremented" << std::endl;
}
}
if (!error) {
if (b++) {
error = true;
std::cout << "ERROR - the abool could not be post-incremented!" << std::endl;
} else {
std::cout << "Passed - the abool can be post-incremented" << std::endl;
}
if (!b) {
error = true;
std::cout << "ERROR - the abool is not correct post-incremented!" << std::endl;
} else {
std::cout << "Passed - the abool is corrent post-incremented" << std::endl;
}
}
if (!error) {
if (--b) {
error = true;
std::cout << "ERROR - the abool could not be pre-decremented!" << std::endl;
} else {
std::cout << "Passed - the abool can be pre-decremented" << std::endl;
}
}
if (!error) {
if (b--) {
error = true;
std::cout << "ERROR - the abool could not be post-decremented!" << std::endl;
} else {
std::cout << "Passed - the abool can be post-decremented" << std::endl;
}
if (!b) {
error = true;
std::cout << "ERROR - the abool is not correct post-decremented!" << std::endl;
} else {
std::cout << "Passed - the abool is correct post-decremented" << std::endl;
}
}
if (!error) {
b = true;
b += 3;
if (b) {
error = true;
std::cout << "ERROR - the abool could not be incremented by 3 (to false)!" << std::endl;
} else {
std::cout << "Passed - the abool can be incremented by 3 (to " << b << ")" << std::endl;
}
}
/**
* Check the atomic int32_t - setting values, changing values, etc.
*/
aint32_t i;
if (!error) {
if (i != 0) {
error = true;
std::cout << "ERROR - the aint32_t does not have the correct default value (0)!" << std::endl;
} else {
std::cout << "Passed - the aint32_t has the correct default value (0)" << std::endl;
}
}
if (!error) {
i = 10;
if (i != 10) {
error = true;
std::cout << "ERROR - the aint32_t could not be assigned the value 10!" << std::endl;
} else {
std::cout << "Passed - the aint32_t can be assigned a value (" << i << ")" << std::endl;
}
}
if (!error) {
if (++i != 11) {
error = true;
std::cout << "ERROR - the aint32_t could not be pre-incremented!" << std::endl;
} else {
std::cout << "Passed - the aint32_t can be pre-incremented" << std::endl;
}
}
if (!error) {
if (i++ != 11) {
error = true;
std::cout << "ERROR - the aint32_t could not be post-incremented!" << std::endl;
} else {
std::cout << "Passed - the aint32_t can be post-incremented" << std::endl;
}
if (i != 12) {
error = true;
std::cout << "ERROR - the aint32_t is not correct post-incremented!" << std::endl;
} else {
std::cout << "Passed - the aint32_t is correct post-incremented" << std::endl;
}
}
if (!error) {
i = 10;
i += 10;
if (i != 20) {
error = true;
std::cout << "ERROR - the aint32_t can not be incremented!" << std::endl;
} else {
std::cout << "Passed - the aint32_t can be incremented" << std::endl;
}
aint32_t j = 20;
if (i != j) {
error = true;
std::cout << "ERROR - the aint32_t does not properly '!=' itself!" << std::endl;
} else {
std::cout << "Passed - the aint32_t properly handles '!='" << std::endl;
}
}
std::cout << (error ? "FAILED!" : "SUCCESS") << std::endl;
return (error ? 1 : 0);
}
| 26.721519
| 97
| 0.570346
|
drbobbeaty
|
3725f0bb72b44597e4a3159092120954a2dd3e42
| 343
|
cpp
|
C++
|
Development/Games/Test_Game1/Game1.cpp
|
AaronAppel/QwerkE_Engine
|
662a4386b5068066b9139ea24e3c7fb14ed3177d
|
[
"BSD-3-Clause"
] | 1
|
2018-03-31T18:16:43.000Z
|
2018-03-31T18:16:43.000Z
|
Development/Games/Test_Game1/Game1.cpp
|
AaronAppel/QwerkE_Engine
|
662a4386b5068066b9139ea24e3c7fb14ed3177d
|
[
"BSD-3-Clause"
] | null | null | null |
Development/Games/Test_Game1/Game1.cpp
|
AaronAppel/QwerkE_Engine
|
662a4386b5068066b9139ea24e3c7fb14ed3177d
|
[
"BSD-3-Clause"
] | null | null | null |
#include "Game1.h"
// #include "../../../QwerkE_Framework/QwerkE.h"
// #include "../../../Source/Engine.h"
using namespace QwerkE;
int main()
{
// Engine engine;
// engine.Startup();
//
// Scenes::AddScene(new GameScene());
// Scenes::SetCurrentScene()->SetIsEnabled(true);
//
// engine.Run();
//
// engine.TearDown();
return 0;
}
| 17.15
| 50
| 0.606414
|
AaronAppel
|
37270f79fde9771f1381c6a47baf9d74082fbfbc
| 516
|
cpp
|
C++
|
UVAprograms/PC12356.cpp
|
Landon-Brown1/1063-DS-Brown
|
64220948fbc69f7bfbd1ab234fe22da5de97fa6e
|
[
"MIT"
] | 1
|
2019-12-23T16:26:20.000Z
|
2019-12-23T16:26:20.000Z
|
UVAprograms/PC12356.cpp
|
Landon-Brown1/1063-DS-Brown
|
64220948fbc69f7bfbd1ab234fe22da5de97fa6e
|
[
"MIT"
] | null | null | null |
UVAprograms/PC12356.cpp
|
Landon-Brown1/1063-DS-Brown
|
64220948fbc69f7bfbd1ab234fe22da5de97fa6e
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
int main(){
int lineSize = 0;
int lossReports = 0;
bool new_line = true;
ifstream inFile;
inFile.open("12356.txt");
while(!inFile.eof()){
if(new_line == true){
inFile >> lineSize;
inFile >> lossReports;
new_line = false;
}
vector<int> V(lineSize);
for(int i = 0; i < lineSize; i++){
V.push_back(i);
}
}
return 0;
}
| 19.111111
| 42
| 0.517442
|
Landon-Brown1
|
372c62dc7c3aedcbe1666820c0365408f0572976
| 678
|
cpp
|
C++
|
src/desktop/core/window/WindowEventHandler.cpp
|
Yellowkingg/algine
|
4d1a45cd65eb5569212866bd5470b1f0d3b43064
|
[
"MIT"
] | 1
|
2022-02-05T21:39:36.000Z
|
2022-02-05T21:39:36.000Z
|
src/desktop/core/window/WindowEventHandler.cpp
|
Yellowkingg/algine
|
4d1a45cd65eb5569212866bd5470b1f0d3b43064
|
[
"MIT"
] | null | null | null |
src/desktop/core/window/WindowEventHandler.cpp
|
Yellowkingg/algine
|
4d1a45cd65eb5569212866bd5470b1f0d3b43064
|
[
"MIT"
] | null | null | null |
#include <algine/core/window/WindowEventHandler.h>
namespace algine {
// so that you don't need to implement handling of each event
void WindowEventHandler::mouseMove(double x, double y) {}
void WindowEventHandler::mouseClick(MouseKey key) {}
void WindowEventHandler::mouseKeyPress(MouseKey key) {}
void WindowEventHandler::mouseKeyRelease(MouseKey key) {}
void WindowEventHandler::keyboardKeyPress(KeyboardKey key) {}
void WindowEventHandler::keyboardKeyRelease(KeyboardKey key) {}
void WindowEventHandler::keyboardKeyRepeat(KeyboardKey key) {}
void WindowEventHandler::windowSizeChange(int width, int height) {}
void WindowEventHandler::windowPosChange(int x, int y) {}
}
| 37.666667
| 67
| 0.803835
|
Yellowkingg
|
37319c0319c9beec633d4ef1869cea76b5a6f4ca
| 4,997
|
cpp
|
C++
|
src/test/rand/main.cpp
|
WebWorksCollection/treefrog-framework
|
9da400135c5fa6c4effa878cca395d8f200cf0f0
|
[
"BSD-3-Clause"
] | null | null | null |
src/test/rand/main.cpp
|
WebWorksCollection/treefrog-framework
|
9da400135c5fa6c4effa878cca395d8f200cf0f0
|
[
"BSD-3-Clause"
] | 1
|
2021-09-27T23:44:17.000Z
|
2021-09-27T23:44:17.000Z
|
src/test/rand/main.cpp
|
WebWorksCollection/treefrog-framework
|
9da400135c5fa6c4effa878cca395d8f200cf0f0
|
[
"BSD-3-Clause"
] | null | null | null |
#include <QTest>
#include <QtCore>
#include <QHostInfo>
#include <tglobal.h>
#include <stdio.h>
#include <random>
static QMutex mutex;
static QByteArray randomString()
{
QByteArray data;
data.reserve(128);
#if QT_VERSION >= 0x040700
data.append(QByteArray::number(QDateTime::currentMSecsSinceEpoch()));
#else
QDateTime now = QDateTime::currentDateTime();
data.append(QByteArray::number(now.toTime_t()));
data.append(QByteArray::number(now.time().msec()));
#endif
data.append(QHostInfo::localHostName());
data.append(QByteArray::number(QCoreApplication::applicationPid()));
data.append(QByteArray::number((qulonglong)QThread::currentThread()));
data.append(QByteArray::number((qulonglong)qApp));
data.append(QByteArray::number(Tf::randXor128()));
return QCryptographicHash::hash(data, QCryptographicHash::Sha1).toHex();
}
static QByteArray randomString(int length)
{
static char ch[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
const int num = strlen(ch) - 1;
QByteArray ret;
ret.reserve(length);
for (int i = 0; i < length; ++i) {
ret += ch[Tf::random(0, num)];
}
return ret;
}
class Thread : public QThread
{
void run()
{
for (;;) {
for (int i = 0; i < 1000; ++i) {
Tf::randXor128();
}
usleep(1);
}
}
};
class TestRand : public QObject
{
Q_OBJECT
private slots:
void initTestCase();
void cleanupTestCase();
void tf_randXor128_data();
void tf_randXor128();
void tf_randXor128_bench_data();
void tf_randXor128_bench();
void tf_rand_r();
void random_device();
void mt19937();
void mt19937_64();
void mt19937_with_uniform();
void minstd_rand();
void ranlux24_base();
void ranlux48_base();
void randomstring1();
void randomstring2();
private:
enum {
#ifdef Q_OS_LINUX
THREADS_NUM = 256,
#else
THREADS_NUM = 64,
#endif
};
Thread *thread[THREADS_NUM];
};
void TestRand::initTestCase()
{
// put load for benchmarks
for (int i = 0; i < THREADS_NUM; ++i) {
thread[i] = new Thread;
thread[i]->start();
}
Tf::msleep(100);
}
void TestRand::cleanupTestCase()
{
for (int i = 0; i < THREADS_NUM; ++i) {
thread[i]->terminate();
}
for (int i = 0; i < THREADS_NUM; ++i) {
thread[i]->wait();
delete thread[i];
}
}
void TestRand::tf_randXor128_data()
{
QTest::addColumn<int>("seed");
QTest::newRow("1") << 1;
QTest::newRow("2") << 10;
QTest::newRow("3") << 100;
}
void TestRand::tf_randXor128()
{
QFETCH(int, seed);
Tf::srandXor128(seed);
for (int i = 0; i < 10; ++i)
printf("rand: %u\n", Tf::randXor128());
}
void TestRand::tf_randXor128_bench_data()
{
Tf::srandXor128(1222);
}
void TestRand::tf_randXor128_bench()
{
QBENCHMARK {
Tf::randXor128();
}
}
void TestRand::tf_rand_r()
{
QBENCHMARK {
Tf::rand32_r();
}
}
void TestRand::random_device()
{
std::random_device rd;
QBENCHMARK {
mutex.lock();
rd();
mutex.unlock();
}
}
// Mersenne Twister 32bit
void TestRand::mt19937()
{
std::mt19937 mt(1);
QBENCHMARK {
mutex.lock();
mt();
mutex.unlock();
}
}
// Mersenne Twister 64bit
void TestRand::mt19937_64()
{
std::mt19937_64 mt(1);
QBENCHMARK {
mutex.lock();
mt();
mutex.unlock();
}
}
// Mersenne Twister / uniform_int_distribution
void TestRand::mt19937_with_uniform()
{
std::mt19937 mt(1);
std::uniform_int_distribution<int> form(0, 65536);
QBENCHMARK {
mutex.lock();
form(mt);
mutex.unlock();
}
}
// Linear congruential generator
void TestRand::minstd_rand()
{
std::minstd_rand mr(1);
QBENCHMARK {
mr();
}
}
// Lagged Fibonacci 24bit
void TestRand::ranlux24_base()
{
std::ranlux24_base rb(1);
QBENCHMARK {
mutex.lock();
rb();
mutex.unlock();
}
}
// Lagged Fibonacci 48bit
void TestRand::ranlux48_base()
{
std::ranlux48_base rb(1);
QBENCHMARK {
mutex.lock();
rb();
mutex.unlock();
}
}
void TestRand::randomstring1()
{
QBENCHMARK {
randomString();
}
}
void TestRand::randomstring2()
{
QBENCHMARK {
randomString(20);
}
}
QTEST_APPLESS_MAIN(TestRand)
#include "main.moc"
/*
rand: 3656013425
rand: 503675675
rand: 4013738704
rand: 4013743934
rand: 1693336950
rand: 1359361875
rand: 1483021801
rand: 1370094836
rand: 1199228482
rand: 665247057
rand: 3656013434
rand: 503675664
rand: 4013738715
rand: 4013721446
rand: 1693336957
rand: 1359376139
rand: 1483021794
rand: 1399432767
rand: 1169867906
rand: 665224457
rand: 3656013332
rand: 503675774
rand: 4013738677
rand: 4013945878
rand: 1693336851
rand: 1359289467
rand: 1483021708
rand: 1223347666
rand: 1580916481
rand: 665187961
*/
| 17.782918
| 88
| 0.618971
|
WebWorksCollection
|
373221d575996760a4e03ecf2738d41cff5db1e7
| 628
|
cpp
|
C++
|
Data Structures Using C++, Second Edition, D.S. Malik/Chapter 1 - SOFTWARE ENGINEERING PRINCIPLES AND C++ CLASSES/Software Development Phase/pre-1.cpp
|
jesushilarioh/data-structures-and-algorithms
|
6c519f81920371a86566a77b4b57995747e71c64
|
[
"MIT"
] | null | null | null |
Data Structures Using C++, Second Edition, D.S. Malik/Chapter 1 - SOFTWARE ENGINEERING PRINCIPLES AND C++ CLASSES/Software Development Phase/pre-1.cpp
|
jesushilarioh/data-structures-and-algorithms
|
6c519f81920371a86566a77b4b57995747e71c64
|
[
"MIT"
] | null | null | null |
Data Structures Using C++, Second Edition, D.S. Malik/Chapter 1 - SOFTWARE ENGINEERING PRINCIPLES AND C++ CLASSES/Software Development Phase/pre-1.cpp
|
jesushilarioh/data-structures-and-algorithms
|
6c519f81920371a86566a77b4b57995747e71c64
|
[
"MIT"
] | null | null | null |
#include <iostream>
using namespace std;
// Precondition: The value of inches must be nonnegative.
// Postcondition: If the value of inches is < 0, the
// function returns -1.0; otherwise, the function
// returns the equivalent length in centimeters.
double inchesToCentimeters(double inches)
{
if (inches < 0)
{
cerr << "The given measurement must be nonnegative." << endl;
return -1.0;
}
else
return 2.54 * inches;
}
int main()
{
double number = inchesToCentimeters(19);
cout << endl;
cout << "number = " << number << endl;
cout << endl;
return 0;
}
| 23.259259
| 69
| 0.621019
|
jesushilarioh
|
373243be3a0f0bb7946ab34f880cdbd482e9e951
| 1,007
|
hpp
|
C++
|
XmlInterface.hpp
|
rafaelgc/EasyReceipt
|
c4dae474fff0bba14f0f64ff485e3e3e19a9f399
|
[
"MIT"
] | 1
|
2021-07-12T06:36:10.000Z
|
2021-07-12T06:36:10.000Z
|
XmlInterface.hpp
|
rafaelgc/SplitQt
|
c4dae474fff0bba14f0f64ff485e3e3e19a9f399
|
[
"MIT"
] | null | null | null |
XmlInterface.hpp
|
rafaelgc/SplitQt
|
c4dae474fff0bba14f0f64ff485e3e3e19a9f399
|
[
"MIT"
] | null | null | null |
#ifndef XMLINTERFACE_HPP
#define XMLINTERFACE_HPP
#include <QMessageBox>
#include <QInputDialog>
#include <QFileDialog>
#include "Economy/TicketContainer.hpp"
#include "Economy/Ticket.hpp"
#include "Persistence/XmlExporter.hpp"
#include "Persistence/XmlImporter.hpp"
#include "Config.hpp"
#include "TicketLoadedListener.hpp"
class XmlInterface
{
private:
TicketContainer *ticketContainer;
QWidget *parent;
Config *config;
bool noTicket();
QString askForATicketName();
QString askForSavePath(Ticket *ticket);
QString askForSaveFolder();
bool exportToXml(Ticket *ticket, const QString &path);
bool loadXml(const QString &fileName, TicketLoadedListener *listener);
QStringList loadPaths();
public:
XmlInterface(QWidget *parent, TicketContainer *ticketContainer, Config *config);
void askForTicketAndSave();
void saveTicket(Ticket *ticket);
void saveAllTickets();
void loadTicket(TicketLoadedListener *listener);
};
#endif // XMLINTERFACE_HPP
| 24.560976
| 84
| 0.754717
|
rafaelgc
|
373ad04fad47d05df1c6c5b5d2d61046989670c6
| 588
|
cpp
|
C++
|
atcoder/abc082/C/main.cpp
|
xirc/cp-algorithm
|
89c67cff2f00459c5bb020ab44bff5ae419a1728
|
[
"Apache-2.0"
] | 8
|
2020-12-23T07:54:53.000Z
|
2021-11-23T02:46:35.000Z
|
atcoder/abc082/C/main.cpp
|
xirc/cp-algorithm
|
89c67cff2f00459c5bb020ab44bff5ae419a1728
|
[
"Apache-2.0"
] | 1
|
2020-11-07T13:22:29.000Z
|
2020-12-20T12:54:00.000Z
|
atcoder/abc082/C/main.cpp
|
xirc/cp-algorithm
|
89c67cff2f00459c5bb020ab44bff5ae419a1728
|
[
"Apache-2.0"
] | 1
|
2021-01-16T03:40:10.000Z
|
2021-01-16T03:40:10.000Z
|
#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> A;
int solve() {
map<int,int> M;
for (auto ai : A) {
++M[ai];
}
int ans = 0;
for (auto e : M) {
auto v = e.first, c = e.second;
if (v < c) {
ans += (c - v);
} else if (v > c) {
ans += c;
}
}
return ans;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin >> N;
A.assign(N, 0);
for (int i = 0; i < N; ++i) {
cin >> A[i];
}
cout << solve() << endl;
return 0;
}
| 15.473684
| 39
| 0.411565
|
xirc
|
373ae37e35d86789d2c4e8f93a36588181b1ac15
| 85,817
|
cpp
|
C++
|
layers/image.cpp
|
ViveStudiosCN/vulkan-openvr-sample
|
5ad8a610ceb1c4592994fd2ebebd5e99c885dccc
|
[
"Apache-2.0",
"BSD-3-Clause"
] | 1
|
2017-06-03T17:30:24.000Z
|
2017-06-03T17:30:24.000Z
|
layers/image.cpp
|
ViveStudiosCN/vulkan-openvr-sample
|
5ad8a610ceb1c4592994fd2ebebd5e99c885dccc
|
[
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null |
layers/image.cpp
|
ViveStudiosCN/vulkan-openvr-sample
|
5ad8a610ceb1c4592994fd2ebebd5e99c885dccc
|
[
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null |
/* Copyright (c) 2015-2016 The Khronos Group Inc.
* Copyright (c) 2015-2016 Valve Corporation
* Copyright (c) 2015-2016 LunarG, Inc.
* Copyright (C) 2015-2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Author: Jeremy Hayes <jeremy@lunarg.com>
* Author: Mark Lobodzinski <mark@lunarg.com>
* Author: Mike Stroyan <mike@LunarG.com>
* Author: Tobin Ehlis <tobin@lunarg.com>
*/
// Allow use of STL min and max functions in Windows
#define NOMINMAX
#include <algorithm>
#include <assert.h>
#include <cinttypes>
#include <memory>
#include <mutex>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <unordered_map>
#include <vector>
#include <bitset>
#include "vk_loader_platform.h"
#include "vk_dispatch_table_helper.h"
#include "vk_struct_string_helper_cpp.h"
#include "image.h"
#include "vk_layer_config.h"
#include "vk_layer_extension_utils.h"
#include "vk_layer_table.h"
#include "vk_layer_data.h"
#include "vk_layer_extension_utils.h"
#include "vk_layer_utils.h"
#include "vk_layer_logging.h"
#include "vk_validation_error_messages.h"
using namespace std;
namespace image {
struct layer_data {
VkInstance instance;
debug_report_data *report_data;
vector<VkDebugReportCallbackEXT> logging_callback;
VkLayerDispatchTable *device_dispatch_table;
VkLayerInstanceDispatchTable *instance_dispatch_table;
VkPhysicalDevice physicalDevice;
VkPhysicalDeviceProperties physicalDeviceProperties;
unordered_map<VkImage, IMAGE_STATE> imageMap;
layer_data()
: report_data(nullptr), device_dispatch_table(nullptr), instance_dispatch_table(nullptr), physicalDevice(0),
physicalDeviceProperties(){};
};
static unordered_map<void *, layer_data *> layer_data_map;
static std::mutex global_lock;
static void init_image(layer_data *my_data, const VkAllocationCallbacks *pAllocator) {
layer_debug_actions(my_data->report_data, my_data->logging_callback, pAllocator, "lunarg_image");
}
static IMAGE_STATE const *getImageState(layer_data const *dev_data, VkImage image) {
auto it = dev_data->imageMap.find(image);
if (it == dev_data->imageMap.end()) {
return nullptr;
}
return &it->second;
}
VKAPI_ATTR VkResult VKAPI_CALL
CreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT *pMsgCallback) {
layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
VkResult res = my_data->instance_dispatch_table->CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pMsgCallback);
if (res == VK_SUCCESS) {
res = layer_create_msg_callback(my_data->report_data, false, pCreateInfo, pAllocator, pMsgCallback);
}
return res;
}
VKAPI_ATTR void VKAPI_CALL DestroyDebugReportCallbackEXT(VkInstance instance,
VkDebugReportCallbackEXT msgCallback,
const VkAllocationCallbacks *pAllocator) {
layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
my_data->instance_dispatch_table->DestroyDebugReportCallbackEXT(instance, msgCallback, pAllocator);
layer_destroy_msg_callback(my_data->report_data, msgCallback, pAllocator);
}
VKAPI_ATTR void VKAPI_CALL
DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objType, uint64_t object,
size_t location, int32_t msgCode, const char *pLayerPrefix, const char *pMsg) {
layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
my_data->instance_dispatch_table->DebugReportMessageEXT(instance, flags, objType, object, location, msgCode, pLayerPrefix,
pMsg);
}
VKAPI_ATTR VkResult VKAPI_CALL
CreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkInstance *pInstance) {
VkLayerInstanceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO);
assert(chain_info->u.pLayerInfo);
PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr;
PFN_vkCreateInstance fpCreateInstance = (PFN_vkCreateInstance)fpGetInstanceProcAddr(NULL, "vkCreateInstance");
if (fpCreateInstance == NULL) {
return VK_ERROR_INITIALIZATION_FAILED;
}
// Advance the link info for the next element on the chain
chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext;
VkResult result = fpCreateInstance(pCreateInfo, pAllocator, pInstance);
if (result != VK_SUCCESS)
return result;
layer_data *my_data = get_my_data_ptr(get_dispatch_key(*pInstance), layer_data_map);
my_data->instance = *pInstance;
my_data->instance_dispatch_table = new VkLayerInstanceDispatchTable;
layer_init_instance_dispatch_table(*pInstance, my_data->instance_dispatch_table, fpGetInstanceProcAddr);
my_data->report_data = debug_report_create_instance(my_data->instance_dispatch_table, *pInstance,
pCreateInfo->enabledExtensionCount, pCreateInfo->ppEnabledExtensionNames);
init_image(my_data, pAllocator);
return result;
}
VKAPI_ATTR void VKAPI_CALL DestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) {
// Grab the key before the instance is destroyed.
dispatch_key key = get_dispatch_key(instance);
layer_data *my_data = get_my_data_ptr(key, layer_data_map);
VkLayerInstanceDispatchTable *pTable = my_data->instance_dispatch_table;
pTable->DestroyInstance(instance, pAllocator);
// Clean up logging callback, if any
while (my_data->logging_callback.size() > 0) {
VkDebugReportCallbackEXT callback = my_data->logging_callback.back();
layer_destroy_msg_callback(my_data->report_data, callback, pAllocator);
my_data->logging_callback.pop_back();
}
layer_debug_report_destroy_instance(my_data->report_data);
delete my_data->instance_dispatch_table;
layer_data_map.erase(key);
}
VKAPI_ATTR VkResult VKAPI_CALL CreateDevice(VkPhysicalDevice physicalDevice,
const VkDeviceCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) {
layer_data *my_instance_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map);
VkLayerDeviceCreateInfo *chain_info = get_chain_info(pCreateInfo, VK_LAYER_LINK_INFO);
assert(chain_info->u.pLayerInfo);
PFN_vkGetInstanceProcAddr fpGetInstanceProcAddr = chain_info->u.pLayerInfo->pfnNextGetInstanceProcAddr;
PFN_vkGetDeviceProcAddr fpGetDeviceProcAddr = chain_info->u.pLayerInfo->pfnNextGetDeviceProcAddr;
PFN_vkCreateDevice fpCreateDevice = (PFN_vkCreateDevice)fpGetInstanceProcAddr(my_instance_data->instance, "vkCreateDevice");
if (fpCreateDevice == NULL) {
return VK_ERROR_INITIALIZATION_FAILED;
}
// Advance the link info for the next element on the chain
chain_info->u.pLayerInfo = chain_info->u.pLayerInfo->pNext;
VkResult result = fpCreateDevice(physicalDevice, pCreateInfo, pAllocator, pDevice);
if (result != VK_SUCCESS) {
return result;
}
layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(*pDevice), layer_data_map);
// Setup device dispatch table
my_device_data->device_dispatch_table = new VkLayerDispatchTable;
layer_init_device_dispatch_table(*pDevice, my_device_data->device_dispatch_table, fpGetDeviceProcAddr);
my_device_data->report_data = layer_debug_report_create_device(my_instance_data->report_data, *pDevice);
my_device_data->physicalDevice = physicalDevice;
my_instance_data->instance_dispatch_table->GetPhysicalDeviceProperties(physicalDevice,
&(my_device_data->physicalDeviceProperties));
return result;
}
VKAPI_ATTR void VKAPI_CALL DestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) {
dispatch_key key = get_dispatch_key(device);
layer_data *my_data = get_my_data_ptr(key, layer_data_map);
my_data->device_dispatch_table->DestroyDevice(device, pAllocator);
delete my_data->device_dispatch_table;
layer_data_map.erase(key);
}
static const VkExtensionProperties instance_extensions[] = {{VK_EXT_DEBUG_REPORT_EXTENSION_NAME, VK_EXT_DEBUG_REPORT_SPEC_VERSION}};
static const VkLayerProperties global_layer = {
"VK_LAYER_LUNARG_image", VK_LAYER_API_VERSION, 1, "LunarG Validation Layer",
};
// Start of the Image layer proper
VKAPI_ATTR VkResult VKAPI_CALL CreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkImage *pImage) {
bool skip_call = false;
VkResult result = VK_ERROR_VALIDATION_FAILED_EXT;
VkImageFormatProperties ImageFormatProperties;
layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
VkPhysicalDevice physicalDevice = device_data->physicalDevice;
layer_data *phy_dev_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map);
if (pCreateInfo->format != VK_FORMAT_UNDEFINED) {
VkFormatProperties properties;
phy_dev_data->instance_dispatch_table->GetPhysicalDeviceFormatProperties(device_data->physicalDevice, pCreateInfo->format,
&properties);
if ((pCreateInfo->tiling == VK_IMAGE_TILING_LINEAR) && (properties.linearTilingFeatures == 0)) {
std::stringstream ss;
ss << "vkCreateImage format parameter (" << string_VkFormat(pCreateInfo->format) << ") is an unsupported format";
skip_call |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT,
0, __LINE__, VALIDATION_ERROR_02150, "IMAGE", "%s. %s", ss.str().c_str(),
validation_error_map[VALIDATION_ERROR_02150]);
}
if ((pCreateInfo->tiling == VK_IMAGE_TILING_OPTIMAL) && (properties.optimalTilingFeatures == 0)) {
std::stringstream ss;
ss << "vkCreateImage format parameter (" << string_VkFormat(pCreateInfo->format) << ") is an unsupported format";
skip_call |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT,
0, __LINE__, VALIDATION_ERROR_02155, "IMAGE", "%s. %s", ss.str().c_str(),
validation_error_map[VALIDATION_ERROR_02155]);
}
// Validate that format supports usage as color attachment
if (pCreateInfo->usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) {
if ((pCreateInfo->tiling == VK_IMAGE_TILING_OPTIMAL) &&
((properties.optimalTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) == 0)) {
std::stringstream ss;
ss << "vkCreateImage: VkFormat for TILING_OPTIMAL image (" << string_VkFormat(pCreateInfo->format)
<< ") does not support requested Image usage type VK_IMAGE_USAGE_COLOR_ATTACHMENT";
skip_call |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_02158, "IMAGE",
"%s. %s", ss.str().c_str(), validation_error_map[VALIDATION_ERROR_02158]);
}
if ((pCreateInfo->tiling == VK_IMAGE_TILING_LINEAR) &&
((properties.linearTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) == 0)) {
std::stringstream ss;
ss << "vkCreateImage: VkFormat for TILING_LINEAR image (" << string_VkFormat(pCreateInfo->format)
<< ") does not support requested Image usage type VK_IMAGE_USAGE_COLOR_ATTACHMENT";
skip_call |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_02153, "IMAGE",
"%s. %s", ss.str().c_str(), validation_error_map[VALIDATION_ERROR_02153]);
}
}
// Validate that format supports usage as depth/stencil attachment
if (pCreateInfo->usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) {
if ((pCreateInfo->tiling == VK_IMAGE_TILING_OPTIMAL) &&
((properties.optimalTilingFeatures & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) == 0)) {
std::stringstream ss;
ss << "vkCreateImage: VkFormat for TILING_OPTIMAL image (" << string_VkFormat(pCreateInfo->format)
<< ") does not support requested Image usage type VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT";
skip_call |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_02159, "IMAGE",
"%s. %s", ss.str().c_str(), validation_error_map[VALIDATION_ERROR_02159]);
}
if ((pCreateInfo->tiling == VK_IMAGE_TILING_LINEAR) &&
((properties.linearTilingFeatures & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) == 0)) {
std::stringstream ss;
ss << "vkCreateImage: VkFormat for TILING_LINEAR image (" << string_VkFormat(pCreateInfo->format)
<< ") does not support requested Image usage type VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT";
skip_call |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, VALIDATION_ERROR_02154, "IMAGE",
"%s. %s", ss.str().c_str(), validation_error_map[VALIDATION_ERROR_02154]);
}
}
} else {
skip_call |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__,
VALIDATION_ERROR_00715, "IMAGE", "vkCreateImage: VkFormat for image must not be VK_FORMAT_UNDEFINED. %s",
validation_error_map[VALIDATION_ERROR_00715]);
}
// Internal call to get format info. Still goes through layers, could potentially go directly to ICD.
phy_dev_data->instance_dispatch_table->GetPhysicalDeviceImageFormatProperties(
physicalDevice, pCreateInfo->format, pCreateInfo->imageType, pCreateInfo->tiling, pCreateInfo->usage, pCreateInfo->flags,
&ImageFormatProperties);
VkDeviceSize imageGranularity = device_data->physicalDeviceProperties.limits.bufferImageGranularity;
imageGranularity = imageGranularity == 1 ? 0 : imageGranularity;
// Make sure all required dimension are non-zero at least.
bool failedMinSize = false;
switch (pCreateInfo->imageType) {
case VK_IMAGE_TYPE_3D:
if (pCreateInfo->extent.depth == 0) {
failedMinSize = true;
}
// Intentional fall-through
case VK_IMAGE_TYPE_2D:
if (pCreateInfo->extent.height == 0) {
failedMinSize = true;
}
// Intentional fall-through
case VK_IMAGE_TYPE_1D:
if (pCreateInfo->extent.width == 0) {
failedMinSize = true;
}
break;
default:
break;
}
// TODO: VALIDATION_ERROR_00716
// this is *almost* VU 00716, except should not be condidtional on image type - all extents must be non-zero for all types
if (failedMinSize) {
skip_call |=
log_msg(phy_dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, 0, __LINE__,
IMAGE_INVALID_FORMAT_LIMITS_VIOLATION, "Image",
"CreateImage extents is 0 for at least one required dimension for image of type %d: "
"Width = %d Height = %d Depth = %d.",
pCreateInfo->imageType, pCreateInfo->extent.width, pCreateInfo->extent.height, pCreateInfo->extent.depth);
}
// TODO: VALIDATION_ERROR_02125 VALIDATION_ERROR_02126 VALIDATION_ERROR_02128 VALIDATION_ERROR_00720
// All these extent-related VUs should be checked here
if ((pCreateInfo->extent.depth > ImageFormatProperties.maxExtent.depth) ||
(pCreateInfo->extent.width > ImageFormatProperties.maxExtent.width) ||
(pCreateInfo->extent.height > ImageFormatProperties.maxExtent.height)) {
skip_call |= log_msg(phy_dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, 0,
__LINE__, IMAGE_INVALID_FORMAT_LIMITS_VIOLATION, "Image",
"CreateImage extents exceed allowable limits for format: "
"Width = %d Height = %d Depth = %d: Limits for Width = %d Height = %d Depth = %d for format %s.",
pCreateInfo->extent.width, pCreateInfo->extent.height, pCreateInfo->extent.depth,
ImageFormatProperties.maxExtent.width, ImageFormatProperties.maxExtent.height,
ImageFormatProperties.maxExtent.depth, string_VkFormat(pCreateInfo->format));
}
uint64_t totalSize = ((uint64_t)pCreateInfo->extent.width * (uint64_t)pCreateInfo->extent.height *
(uint64_t)pCreateInfo->extent.depth * (uint64_t)pCreateInfo->arrayLayers *
(uint64_t)pCreateInfo->samples * (uint64_t)vk_format_get_size(pCreateInfo->format) +
(uint64_t)imageGranularity) &
~(uint64_t)imageGranularity;
if (totalSize > ImageFormatProperties.maxResourceSize) {
skip_call |= log_msg(phy_dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, 0,
__LINE__, IMAGE_INVALID_FORMAT_LIMITS_VIOLATION, "Image",
"CreateImage resource size exceeds allowable maximum "
"Image resource size = 0x%" PRIxLEAST64 ", maximum resource size = 0x%" PRIxLEAST64 " ",
totalSize, ImageFormatProperties.maxResourceSize);
}
// TODO: VALIDATION_ERROR_02132
if (pCreateInfo->mipLevels > ImageFormatProperties.maxMipLevels) {
skip_call |= log_msg(phy_dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, 0,
__LINE__, IMAGE_INVALID_FORMAT_LIMITS_VIOLATION, "Image",
"CreateImage mipLevels=%d exceeds allowable maximum supported by format of %d", pCreateInfo->mipLevels,
ImageFormatProperties.maxMipLevels);
}
if (pCreateInfo->arrayLayers > ImageFormatProperties.maxArrayLayers) {
skip_call |= log_msg(
phy_dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, 0, __LINE__,
VALIDATION_ERROR_02133, "Image", "CreateImage arrayLayers=%d exceeds allowable maximum supported by format of %d. %s",
pCreateInfo->arrayLayers, ImageFormatProperties.maxArrayLayers, validation_error_map[VALIDATION_ERROR_02133]);
}
if ((pCreateInfo->samples & ImageFormatProperties.sampleCounts) == 0) {
skip_call |=
log_msg(phy_dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, 0, __LINE__,
VALIDATION_ERROR_02138, "Image", "CreateImage samples %s is not supported by format 0x%.8X. %s",
string_VkSampleCountFlagBits(pCreateInfo->samples), ImageFormatProperties.sampleCounts,
validation_error_map[VALIDATION_ERROR_02138]);
}
if (pCreateInfo->initialLayout != VK_IMAGE_LAYOUT_UNDEFINED && pCreateInfo->initialLayout != VK_IMAGE_LAYOUT_PREINITIALIZED) {
skip_call |= log_msg(phy_dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, 0,
__LINE__, VALIDATION_ERROR_00731, "Image",
"vkCreateImage parameter, pCreateInfo->initialLayout, must be VK_IMAGE_LAYOUT_UNDEFINED or "
"VK_IMAGE_LAYOUT_PREINITIALIZED. %s",
validation_error_map[VALIDATION_ERROR_00731]);
}
if (!skip_call) {
result = device_data->device_dispatch_table->CreateImage(device, pCreateInfo, pAllocator, pImage);
}
if (result == VK_SUCCESS) {
std::lock_guard<std::mutex> lock(global_lock);
device_data->imageMap[*pImage] = IMAGE_STATE(pCreateInfo);
}
return result;
}
VKAPI_ATTR void VKAPI_CALL DestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks *pAllocator) {
layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
std::unique_lock<std::mutex> lock(global_lock);
device_data->imageMap.erase(image);
lock.unlock();
device_data->device_dispatch_table->DestroyImage(device, image, pAllocator);
}
VKAPI_ATTR VkResult VKAPI_CALL CreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) {
layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
bool skip_call = false;
for (uint32_t i = 0; i < pCreateInfo->attachmentCount; ++i) {
if (pCreateInfo->pAttachments[i].format == VK_FORMAT_UNDEFINED) {
std::stringstream ss;
ss << "vkCreateRenderPass: pCreateInfo->pAttachments[" << i << "].format is VK_FORMAT_UNDEFINED";
skip_call |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__,
IMAGE_RENDERPASS_INVALID_ATTACHMENT, "IMAGE", "%s", ss.str().c_str());
}
}
if (skip_call) {
return VK_ERROR_VALIDATION_FAILED_EXT;
}
VkResult result = my_data->device_dispatch_table->CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass);
return result;
}
VKAPI_ATTR void VKAPI_CALL CmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout,
const VkClearColorValue *pColor, uint32_t rangeCount,
const VkImageSubresourceRange *pRanges) {
bool skipCall = false;
layer_data *device_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
if (imageLayout != VK_IMAGE_LAYOUT_GENERAL && imageLayout != VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL) {
char const str[] =
"vkCmdClearColorImage parameter, imageLayout, must be VK_IMAGE_LAYOUT_GENERAL or VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL";
skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
(uint64_t)commandBuffer, __LINE__, VALIDATION_ERROR_01086, "IMAGE", "%s. %s", str,
validation_error_map[VALIDATION_ERROR_01086]);
}
// For each range, image aspect must be color only
// TODO: this is a 'must' in the spec, so there should be a VU enum for it
for (uint32_t i = 0; i < rangeCount; i++) {
if (pRanges[i].aspectMask != VK_IMAGE_ASPECT_COLOR_BIT) {
char const str[] =
"vkCmdClearColorImage aspectMasks for all subresource ranges must be set to VK_IMAGE_ASPECT_COLOR_BIT";
skipCall |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
(uint64_t)commandBuffer, __LINE__, IMAGE_INVALID_IMAGE_ASPECT, "IMAGE", str);
}
}
auto image_state = getImageState(device_data, image);
if (image_state) {
if (vk_format_is_depth_or_stencil(image_state->format)) {
char const str[] = "vkCmdClearColorImage called with depth/stencil image.";
skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
reinterpret_cast<uint64_t &>(image), __LINE__, VALIDATION_ERROR_01088, "IMAGE", "%s. %s", str,
validation_error_map[VALIDATION_ERROR_01088]);
} else if (vk_format_is_compressed(image_state->format)) {
char const str[] = "vkCmdClearColorImage called with compressed image.";
skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
reinterpret_cast<uint64_t &>(image), __LINE__, VALIDATION_ERROR_01088, "IMAGE", "%s. %s", str,
validation_error_map[VALIDATION_ERROR_01088]);
}
if (!(image_state->usage & VK_IMAGE_USAGE_TRANSFER_DST_BIT)) {
char const str[] = "vkCmdClearColorImage called with image created without VK_IMAGE_USAGE_TRANSFER_DST_BIT.";
skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
reinterpret_cast<uint64_t &>(image), __LINE__, VALIDATION_ERROR_01084, "IMAGE", "%s. %s", str,
validation_error_map[VALIDATION_ERROR_01084]);
}
}
if (!skipCall) {
device_data->device_dispatch_table->CmdClearColorImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges);
}
}
VKAPI_ATTR void VKAPI_CALL CmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout,
const VkClearDepthStencilValue *pDepthStencil, uint32_t rangeCount,
const VkImageSubresourceRange *pRanges) {
bool skipCall = false;
layer_data *device_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
// For each range, Image aspect must be depth or stencil or both
for (uint32_t i = 0; i < rangeCount; i++) {
if (((pRanges[i].aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT) != VK_IMAGE_ASPECT_DEPTH_BIT) &&
((pRanges[i].aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT) != VK_IMAGE_ASPECT_STENCIL_BIT)) {
char const str[] = "vkCmdClearDepthStencilImage aspectMasks for all subresource ranges must be "
"set to VK_IMAGE_ASPECT_DEPTH_BIT and/or VK_IMAGE_ASPECT_STENCIL_BIT";
skipCall |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
(uint64_t)commandBuffer, __LINE__, IMAGE_INVALID_IMAGE_ASPECT, "IMAGE", str);
}
}
auto image_state = getImageState(device_data, image);
if (image_state && !vk_format_is_depth_or_stencil(image_state->format)) {
char const str[] = "vkCmdClearDepthStencilImage called without a depth/stencil image.";
skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
reinterpret_cast<uint64_t &>(image), __LINE__, VALIDATION_ERROR_01103, "IMAGE", "%s. %s", str,
validation_error_map[VALIDATION_ERROR_01103]);
}
if (!skipCall) {
device_data->device_dispatch_table->CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount,
pRanges);
}
}
// Returns true if [x, xoffset] and [y, yoffset] overlap
static bool RangesIntersect(int32_t start, uint32_t start_offset, int32_t end, uint32_t end_offset) {
bool result = false;
uint32_t intersection_min = std::max(static_cast<uint32_t>(start), static_cast<uint32_t>(end));
uint32_t intersection_max = std::min(static_cast<uint32_t>(start) + start_offset, static_cast<uint32_t>(end) + end_offset);
if (intersection_max > intersection_min) {
result = true;
}
return result;
}
// Returns true if two VkImageCopy structures overlap
static bool RegionIntersects(const VkImageCopy *src, const VkImageCopy *dst, VkImageType type) {
bool result = true;
if ((src->srcSubresource.mipLevel == dst->dstSubresource.mipLevel) &&
(RangesIntersect(src->srcSubresource.baseArrayLayer, src->srcSubresource.layerCount, dst->dstSubresource.baseArrayLayer,
dst->dstSubresource.layerCount))) {
switch (type) {
case VK_IMAGE_TYPE_3D:
result &= RangesIntersect(src->srcOffset.z, src->extent.depth, dst->dstOffset.z, dst->extent.depth);
// Intentionally fall through to 2D case
case VK_IMAGE_TYPE_2D:
result &= RangesIntersect(src->srcOffset.y, src->extent.height, dst->dstOffset.y, dst->extent.height);
// Intentionally fall through to 1D case
case VK_IMAGE_TYPE_1D:
result &= RangesIntersect(src->srcOffset.x, src->extent.width, dst->dstOffset.x, dst->extent.width);
break;
default:
// Unrecognized or new IMAGE_TYPE enums will be caught in parameter_validation
assert(false);
}
}
return result;
}
// Returns true if offset and extent exceed image extents
static bool ExceedsBounds(const VkOffset3D *offset, const VkExtent3D *extent, const IMAGE_STATE *image) {
bool result = false;
// Extents/depths cannot be negative but checks left in for clarity
switch (image->imageType) {
case VK_IMAGE_TYPE_3D: // Validate z and depth
if ((offset->z + extent->depth > image->extent.depth) || (offset->z < 0) ||
((offset->z + static_cast<int32_t>(extent->depth)) < 0)) {
result = true;
}
// Intentionally fall through to 2D case to check height
case VK_IMAGE_TYPE_2D: // Validate y and height
if ((offset->y + extent->height > image->extent.height) || (offset->y < 0) ||
((offset->y + static_cast<int32_t>(extent->height)) < 0)) {
result = true;
}
// Intentionally fall through to 1D case to check width
case VK_IMAGE_TYPE_1D: // Validate x and width
if ((offset->x + extent->width > image->extent.width) || (offset->x < 0) ||
((offset->x + static_cast<int32_t>(extent->width)) < 0)) {
result = true;
}
break;
default:
assert(false);
}
return result;
}
bool PreCallValidateCmdCopyImage(VkCommandBuffer command_buffer, VkImage src_image, VkImage dst_image, uint32_t region_count,
const VkImageCopy *regions) {
bool skip = false;
layer_data *device_data = get_my_data_ptr(get_dispatch_key(command_buffer), layer_data_map);
auto src_image_entry = getImageState(device_data, src_image);
auto dst_image_entry = getImageState(device_data, dst_image);
// TODO: This does not cover swapchain-created images. This should fall out when this layer is moved
// into the core_validation layer
if (src_image_entry && dst_image_entry) {
for (uint32_t i = 0; i < region_count; i++) {
if (regions[i].srcSubresource.layerCount == 0) {
std::stringstream ss;
ss << "vkCmdCopyImage: number of layers in pRegions[" << i << "] srcSubresource is zero";
skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, reinterpret_cast<uint64_t &>(command_buffer),
__LINE__, IMAGE_MISMATCHED_IMAGE_ASPECT, "IMAGE", "%s", ss.str().c_str());
}
if (regions[i].dstSubresource.layerCount == 0) {
std::stringstream ss;
ss << "vkCmdCopyImage: number of layers in pRegions[" << i << "] dstSubresource is zero";
skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, reinterpret_cast<uint64_t &>(command_buffer),
__LINE__, IMAGE_MISMATCHED_IMAGE_ASPECT, "IMAGE", "%s", ss.str().c_str());
}
// For each region the layerCount member of srcSubresource and dstSubresource must match
if (regions[i].srcSubresource.layerCount != regions[i].dstSubresource.layerCount) {
std::stringstream ss;
ss << "vkCmdCopyImage: number of layers in source and destination subresources for pRegions[" << i
<< "] do not match";
skip |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
reinterpret_cast<uint64_t &>(command_buffer), __LINE__, VALIDATION_ERROR_01198, "IMAGE", "%s. %s",
ss.str().c_str(), validation_error_map[VALIDATION_ERROR_01198]);
}
// For each region, the aspectMask member of srcSubresource and dstSubresource must match
if (regions[i].srcSubresource.aspectMask != regions[i].dstSubresource.aspectMask) {
char const str[] = "vkCmdCopyImage: Src and dest aspectMasks for each region must match";
skip |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
reinterpret_cast<uint64_t &>(command_buffer), __LINE__, VALIDATION_ERROR_01197, "IMAGE", "%s. %s", str,
validation_error_map[VALIDATION_ERROR_01197]);
}
// AspectMask must not contain VK_IMAGE_ASPECT_METADATA_BIT
if ((regions[i].srcSubresource.aspectMask & VK_IMAGE_ASPECT_METADATA_BIT) ||
(regions[i].dstSubresource.aspectMask & VK_IMAGE_ASPECT_METADATA_BIT)) {
std::stringstream ss;
ss << "vkCmdCopyImage: pRegions[" << i << "] may not specify aspectMask containing VK_IMAGE_ASPECT_METADATA_BIT";
skip |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
reinterpret_cast<uint64_t &>(command_buffer), __LINE__, VALIDATION_ERROR_01222, "IMAGE", "%s. %s",
ss.str().c_str(), validation_error_map[VALIDATION_ERROR_01222]);
}
// For each region, if aspectMask contains VK_IMAGE_ASPECT_COLOR_BIT, it must not contain either of
// VK_IMAGE_ASPECT_DEPTH_BIT or VK_IMAGE_ASPECT_STENCIL_BIT
if ((regions[i].srcSubresource.aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) &&
(regions[i].srcSubresource.aspectMask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT))) {
char const str[] = "vkCmdCopyImage aspectMask cannot specify both COLOR and DEPTH/STENCIL aspects";
skip |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
reinterpret_cast<uint64_t &>(command_buffer), __LINE__, VALIDATION_ERROR_01221, "IMAGE", "%s. %s", str,
validation_error_map[VALIDATION_ERROR_01221]);
}
// If either of the calling command's src_image or dst_image parameters are of VkImageType VK_IMAGE_TYPE_3D,
// the baseArrayLayer and layerCount members of both srcSubresource and dstSubresource must be 0 and 1, respectively
if (((src_image_entry->imageType == VK_IMAGE_TYPE_3D) || (dst_image_entry->imageType == VK_IMAGE_TYPE_3D)) &&
((regions[i].srcSubresource.baseArrayLayer != 0) || (regions[i].srcSubresource.layerCount != 1) ||
(regions[i].dstSubresource.baseArrayLayer != 0) || (regions[i].dstSubresource.layerCount != 1))) {
std::stringstream ss;
ss << "vkCmdCopyImage: src or dstImage type was IMAGE_TYPE_3D, but in subRegion[" << i
<< "] baseArrayLayer was not zero or layerCount was not 1.";
skip |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
reinterpret_cast<uint64_t &>(command_buffer), __LINE__, VALIDATION_ERROR_01199, "IMAGE", "%s. %s",
ss.str().c_str(), validation_error_map[VALIDATION_ERROR_01199]);
}
// MipLevel must be less than the mipLevels specified in VkImageCreateInfo when the image was created
if (regions[i].srcSubresource.mipLevel >= src_image_entry->mipLevels) {
std::stringstream ss;
ss << "vkCmdCopyImage: pRegions[" << i
<< "] specifies a src mipLevel greater than the number specified when the srcImage was created.";
skip |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
reinterpret_cast<uint64_t &>(command_buffer), __LINE__, VALIDATION_ERROR_01223, "IMAGE", "%s. %s",
ss.str().c_str(), validation_error_map[VALIDATION_ERROR_01223]);
}
if (regions[i].dstSubresource.mipLevel >= dst_image_entry->mipLevels) {
std::stringstream ss;
ss << "vkCmdCopyImage: pRegions[" << i
<< "] specifies a dst mipLevel greater than the number specified when the dstImage was created.";
skip |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
reinterpret_cast<uint64_t &>(command_buffer), __LINE__, VALIDATION_ERROR_01223, "IMAGE", "%s. %s",
ss.str().c_str(), validation_error_map[VALIDATION_ERROR_01223]);
}
// (baseArrayLayer + layerCount) must be less than or equal to the arrayLayers specified in VkImageCreateInfo when the
// image was created
if ((regions[i].srcSubresource.baseArrayLayer + regions[i].srcSubresource.layerCount) > src_image_entry->arraySize) {
std::stringstream ss;
ss << "vkCmdCopyImage: srcImage arrayLayers was " << src_image_entry->arraySize << " but subRegion[" << i
<< "] baseArrayLayer + layerCount is "
<< (regions[i].srcSubresource.baseArrayLayer + regions[i].srcSubresource.layerCount);
skip |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
reinterpret_cast<uint64_t &>(command_buffer), __LINE__, VALIDATION_ERROR_01224, "IMAGE", "%s. %s",
ss.str().c_str(), validation_error_map[VALIDATION_ERROR_01224]);
}
if ((regions[i].dstSubresource.baseArrayLayer + regions[i].dstSubresource.layerCount) > dst_image_entry->arraySize) {
std::stringstream ss;
ss << "vkCmdCopyImage: dstImage arrayLayers was " << dst_image_entry->arraySize << " but subRegion[" << i
<< "] baseArrayLayer + layerCount is "
<< (regions[i].dstSubresource.baseArrayLayer + regions[i].dstSubresource.layerCount);
skip |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
reinterpret_cast<uint64_t &>(command_buffer), __LINE__, VALIDATION_ERROR_01224, "IMAGE", "%s. %s",
ss.str().c_str(), validation_error_map[VALIDATION_ERROR_01224]);
}
// The source region specified by a given element of regions must be a region that is contained within srcImage
if (ExceedsBounds(®ions[i].srcOffset, ®ions[i].extent, src_image_entry)) {
std::stringstream ss;
ss << "vkCmdCopyImage: srcSubResource in pRegions[" << i << "] exceeds extents srcImage was created with";
skip |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
reinterpret_cast<uint64_t &>(command_buffer), __LINE__, VALIDATION_ERROR_01175, "IMAGE", "%s. %s",
ss.str().c_str(), validation_error_map[VALIDATION_ERROR_01175]);
}
// The destination region specified by a given element of regions must be a region that is contained within dst_image
if (ExceedsBounds(®ions[i].dstOffset, ®ions[i].extent, dst_image_entry)) {
std::stringstream ss;
ss << "vkCmdCopyImage: dstSubResource in pRegions[" << i << "] exceeds extents dstImage was created with";
skip |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
reinterpret_cast<uint64_t &>(command_buffer), __LINE__, VALIDATION_ERROR_01176, "IMAGE", "%s. %s",
ss.str().c_str(), validation_error_map[VALIDATION_ERROR_01176]);
}
// The union of all source regions, and the union of all destination regions, specified by the elements of regions,
// must not overlap in memory
if (src_image == dst_image) {
for (uint32_t j = 0; j < region_count; j++) {
if (RegionIntersects(®ions[i], ®ions[j], src_image_entry->imageType)) {
std::stringstream ss;
ss << "vkCmdCopyImage: pRegions[" << i << "] src overlaps with pRegions[" << j << "].";
skip |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
reinterpret_cast<uint64_t &>(command_buffer), __LINE__, VALIDATION_ERROR_01177, "IMAGE",
"%s. %s", ss.str().c_str(), validation_error_map[VALIDATION_ERROR_01177]);
}
}
}
}
// The formats of src_image and dst_image must be compatible. Formats are considered compatible if their texel size in bytes
// is the same between both formats. For example, VK_FORMAT_R8G8B8A8_UNORM is compatible with VK_FORMAT_R32_UINT because
// because both texels are 4 bytes in size. Depth/stencil formats must match exactly.
if (vk_format_is_depth_or_stencil(src_image_entry->format) || vk_format_is_depth_or_stencil(dst_image_entry->format)) {
if (src_image_entry->format != dst_image_entry->format) {
char const str[] = "vkCmdCopyImage called with unmatched source and dest image depth/stencil formats.";
skip |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
reinterpret_cast<uint64_t &>(command_buffer), __LINE__, IMAGE_MISMATCHED_IMAGE_FORMAT, "IMAGE", str);
}
} else {
size_t srcSize = vk_format_get_size(src_image_entry->format);
size_t destSize = vk_format_get_size(dst_image_entry->format);
if (srcSize != destSize) {
char const str[] = "vkCmdCopyImage called with unmatched source and dest image format sizes.";
skip |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
reinterpret_cast<uint64_t &>(command_buffer), __LINE__, VALIDATION_ERROR_01184, "IMAGE", "%s. %s", str,
validation_error_map[VALIDATION_ERROR_01184]);
}
}
}
return skip;
}
VKAPI_ATTR void VKAPI_CALL CmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage,
VkImageLayout srcImageLayout, VkImage dstImage,
VkImageLayout dstImageLayout, uint32_t regionCount,
const VkImageCopy *pRegions) {
bool skip = false;
layer_data *device_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
skip = PreCallValidateCmdCopyImage(commandBuffer, srcImage, dstImage, regionCount, pRegions);
if (!skip) {
device_data->device_dispatch_table->CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout,
regionCount, pRegions);
}
}
VKAPI_ATTR void VKAPI_CALL CmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount,
const VkClearAttachment *pAttachments, uint32_t rectCount,
const VkClearRect *pRects) {
bool skipCall = false;
VkImageAspectFlags aspectMask;
layer_data *device_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
for (uint32_t i = 0; i < attachmentCount; i++) {
aspectMask = pAttachments[i].aspectMask;
if (0 == aspectMask) {
skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)commandBuffer, __LINE__,
VALIDATION_ERROR_01128, "IMAGE", "%s", validation_error_map[VALIDATION_ERROR_01128]);
} else if (aspectMask & VK_IMAGE_ASPECT_METADATA_BIT) {
skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)commandBuffer, __LINE__,
VALIDATION_ERROR_01126, "IMAGE", "%s", validation_error_map[VALIDATION_ERROR_01126]);
} else if (aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) {
if ((aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT) || (aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT)) {
char const str[] =
"vkCmdClearAttachments aspectMask [%d] must set only VK_IMAGE_ASPECT_COLOR_BIT of a color attachment. %s";
skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)commandBuffer, __LINE__,
VALIDATION_ERROR_01125, "IMAGE", str, i, validation_error_map[VALIDATION_ERROR_01125]);
}
} else {
// Having eliminated all other possibilities, image aspect must be depth or stencil or both
if (((aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT) != VK_IMAGE_ASPECT_DEPTH_BIT) &&
((aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT) != VK_IMAGE_ASPECT_STENCIL_BIT)) {
char const str[] = "vkCmdClearAttachments aspectMask [%d] must be set to VK_IMAGE_ASPECT_DEPTH_BIT and/or "
"VK_IMAGE_ASPECT_STENCIL_BIT. %s";
skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)commandBuffer, __LINE__,
VALIDATION_ERROR_01127, "IMAGE", str, i, validation_error_map[VALIDATION_ERROR_01127]);
}
}
}
if (!skipCall) {
device_data->device_dispatch_table->CmdClearAttachments(commandBuffer, attachmentCount, pAttachments, rectCount, pRects);
}
}
static bool ValidateBufferImageCopyData(layer_data *dev_data, uint32_t regionCount, const VkBufferImageCopy *pRegions,
VkImage image, const char *function) {
bool skip = false;
for (uint32_t i = 0; i < regionCount; i++) {
auto image_info = getImageState(dev_data, image);
if (image_info) {
if ((image_info->imageType == VK_IMAGE_TYPE_1D) || (image_info->imageType == VK_IMAGE_TYPE_2D)) {
if ((pRegions[i].imageOffset.z != 0) || (pRegions[i].imageExtent.depth != 1)) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
reinterpret_cast<uint64_t &>(image), __LINE__, VALIDATION_ERROR_01269, "IMAGE",
"%s(): pRegion[%d] imageOffset.z is %d and imageExtent.depth is %d. These must be 0 and 1, "
"respectively. %s",
function, i, pRegions[i].imageOffset.z, pRegions[i].imageExtent.depth,
validation_error_map[VALIDATION_ERROR_01269]);
}
}
// BufferOffset must be a multiple of the calling command's VkImage parameter's texel size
auto texel_size = vk_format_get_size(image_info->format);
if (vk_safe_modulo(pRegions[i].bufferOffset, texel_size) != 0) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
reinterpret_cast<uint64_t &>(image), __LINE__, VALIDATION_ERROR_01263, "IMAGE",
"%s(): pRegion[%d] bufferOffset 0x%" PRIxLEAST64
" must be a multiple of this format's texel size (" PRINTF_SIZE_T_SPECIFIER "). %s",
function, i, pRegions[i].bufferOffset, texel_size, validation_error_map[VALIDATION_ERROR_01263]);
}
// BufferOffset must be a multiple of 4
if (vk_safe_modulo(pRegions[i].bufferOffset, 4) != 0) {
skip |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
reinterpret_cast<uint64_t &>(image), __LINE__, VALIDATION_ERROR_01264, "IMAGE",
"%s(): pRegion[%d] bufferOffset 0x%" PRIxLEAST64 " must be a multiple of 4. %s", function, i,
pRegions[i].bufferOffset, validation_error_map[VALIDATION_ERROR_01264]);
}
// BufferRowLength must be 0, or greater than or equal to the width member of imageExtent
if ((pRegions[i].bufferRowLength != 0) && (pRegions[i].bufferRowLength < pRegions[i].imageExtent.width)) {
skip |= log_msg(
dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
reinterpret_cast<uint64_t &>(image), __LINE__, VALIDATION_ERROR_01265, "IMAGE",
"%s(): pRegion[%d] bufferRowLength (%d) must be zero or greater-than-or-equal-to imageExtent.width (%d). %s",
function, i, pRegions[i].bufferRowLength, pRegions[i].imageExtent.width,
validation_error_map[VALIDATION_ERROR_01265]);
}
// BufferImageHeight must be 0, or greater than or equal to the height member of imageExtent
if ((pRegions[i].bufferImageHeight != 0) && (pRegions[i].bufferImageHeight < pRegions[i].imageExtent.height)) {
skip |= log_msg(
dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
reinterpret_cast<uint64_t &>(image), __LINE__, VALIDATION_ERROR_01266, "IMAGE",
"%s(): pRegion[%d] bufferImageHeight (%d) must be zero or greater-than-or-equal-to imageExtent.height (%d). %s",
function, i, pRegions[i].bufferImageHeight, pRegions[i].imageExtent.height,
validation_error_map[VALIDATION_ERROR_01266]);
}
const int num_bits = sizeof(VkFlags) * CHAR_BIT;
std::bitset<num_bits> aspect_mask_bits(pRegions[i].imageSubresource.aspectMask);
if (aspect_mask_bits.count() != 1) {
skip |=
log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
reinterpret_cast<uint64_t &>(image), __LINE__, VALIDATION_ERROR_01280, "IMAGE",
"%s: aspectMasks for imageSubresource in each region must have only a single bit set. %s", function,
validation_error_map[VALIDATION_ERROR_01280]);
}
}
}
return skip;
}
static bool PreCallValidateCmdCopyImageToBuffer(layer_data *dev_data, VkImage srcImage, uint32_t regionCount,
const VkBufferImageCopy *pRegions, const char *func_name) {
return ValidateBufferImageCopyData(dev_data, regionCount, pRegions, srcImage, "vkCmdCopyImageToBuffer");
}
VKAPI_ATTR void VKAPI_CALL CmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout,
VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy *pRegions) {
layer_data *device_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
if (!PreCallValidateCmdCopyImageToBuffer(device_data, srcImage, regionCount, pRegions, "vkCmdCopyImageToBuffer()")) {
device_data->device_dispatch_table->CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount,
pRegions);
}
}
static bool PreCallValidateCmdCopyBufferToImage(layer_data *dev_data, VkImage dstImage, uint32_t regionCount,
const VkBufferImageCopy *pRegions, const char *func_name) {
return ValidateBufferImageCopyData(dev_data, regionCount, pRegions, dstImage, "vkCmdCopyBufferToImage");
}
VKAPI_ATTR void VKAPI_CALL CmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage,
VkImageLayout dstImageLayout, uint32_t regionCount,
const VkBufferImageCopy *pRegions) {
layer_data *device_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
if (!PreCallValidateCmdCopyBufferToImage(device_data, dstImage, regionCount, pRegions, "vkCmdCopyBufferToImage()")) {
device_data->device_dispatch_table->CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount,
pRegions);
}
}
VKAPI_ATTR void VKAPI_CALL CmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout,
VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount,
const VkImageBlit *pRegions, VkFilter filter) {
bool skipCall = false;
layer_data *device_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
// Warn for zero-sized regions
for (uint32_t i = 0; i < regionCount; i++) {
if ((pRegions[i].srcOffsets[0].x == pRegions[i].srcOffsets[1].x) ||
(pRegions[i].srcOffsets[0].y == pRegions[i].srcOffsets[1].y) ||
(pRegions[i].srcOffsets[0].z == pRegions[i].srcOffsets[1].z)) {
std::stringstream ss;
ss << "vkCmdBlitImage: pRegions[" << i << "].srcOffsets specify a zero-volume area.";
skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, reinterpret_cast<uint64_t>(commandBuffer), __LINE__,
IMAGE_INVALID_EXTENTS, "IMAGE", "%s", ss.str().c_str());
}
if ((pRegions[i].dstOffsets[0].x == pRegions[i].dstOffsets[1].x) ||
(pRegions[i].dstOffsets[0].y == pRegions[i].dstOffsets[1].y) ||
(pRegions[i].dstOffsets[0].z == pRegions[i].dstOffsets[1].z)) {
std::stringstream ss;
ss << "vkCmdBlitImage: pRegions[" << i << "].dstOffsets specify a zero-volume area.";
skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, reinterpret_cast<uint64_t>(commandBuffer), __LINE__,
IMAGE_INVALID_EXTENTS, "IMAGE", "%s", ss.str().c_str());
}
}
auto srcImageEntry = getImageState(device_data, srcImage);
auto dstImageEntry = getImageState(device_data, dstImage);
if (srcImageEntry && dstImageEntry) {
VkFormat srcFormat = srcImageEntry->format;
VkFormat dstFormat = dstImageEntry->format;
// Validate consistency for unsigned formats
if (vk_format_is_uint(srcFormat) != vk_format_is_uint(dstFormat)) {
std::stringstream ss;
ss << "vkCmdBlitImage: If one of srcImage and dstImage images has unsigned integer format, "
<< "the other one must also have unsigned integer format. "
<< "Source format is " << string_VkFormat(srcFormat) << " Destination format is " << string_VkFormat(dstFormat);
skipCall |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
(uint64_t)commandBuffer, __LINE__, VALIDATION_ERROR_02191, "IMAGE", "%s. %s", ss.str().c_str(),
validation_error_map[VALIDATION_ERROR_02191]);
}
// Validate consistency for signed formats
if (vk_format_is_sint(srcFormat) != vk_format_is_sint(dstFormat)) {
std::stringstream ss;
ss << "vkCmdBlitImage: If one of srcImage and dstImage images has signed integer format, "
<< "the other one must also have signed integer format. "
<< "Source format is " << string_VkFormat(srcFormat) << " Destination format is " << string_VkFormat(dstFormat);
skipCall |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
(uint64_t)commandBuffer, __LINE__, VALIDATION_ERROR_02190, "IMAGE", "%s. %s", ss.str().c_str(),
validation_error_map[VALIDATION_ERROR_02190]);
}
// Validate aspect bits and formats for depth/stencil images
if (vk_format_is_depth_or_stencil(srcFormat) || vk_format_is_depth_or_stencil(dstFormat)) {
if (srcFormat != dstFormat) {
std::stringstream ss;
ss << "vkCmdBlitImage: If one of srcImage and dstImage images has a format of depth, stencil or depth "
<< "stencil, the other one must have exactly the same format. "
<< "Source format is " << string_VkFormat(srcFormat) << " Destination format is " << string_VkFormat(dstFormat);
skipCall |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
(uint64_t)commandBuffer, __LINE__, VALIDATION_ERROR_02192, "IMAGE", "%s. %s", ss.str().c_str(),
validation_error_map[VALIDATION_ERROR_02192]);
}
// TODO: Confirm that all these checks are intended to be nested under depth/stencil only
for (uint32_t i = 0; i < regionCount; i++) {
if (pRegions[i].srcSubresource.layerCount == 0) {
char const str[] = "vkCmdBlitImage: number of layers in source subresource is zero";
// TODO: Verify against Valid Use section of spec, if this case yields undefined results, then it's an error
skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)commandBuffer, __LINE__,
IMAGE_MISMATCHED_IMAGE_ASPECT, "IMAGE", str);
}
if (pRegions[i].dstSubresource.layerCount == 0) {
char const str[] = "vkCmdBlitImage: number of layers in destination subresource is zero";
// TODO: Verify against Valid Use section of spec, if this case yields undefined results, then it's an error
skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)commandBuffer, __LINE__,
IMAGE_MISMATCHED_IMAGE_ASPECT, "IMAGE", str);
}
if (pRegions[i].srcSubresource.layerCount != pRegions[i].dstSubresource.layerCount) {
char const str[] = "vkCmdBlitImage: number of layers in source and destination subresources must match";
skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)commandBuffer, __LINE__,
IMAGE_MISMATCHED_IMAGE_ASPECT, "IMAGE", str);
}
VkImageAspectFlags srcAspect = pRegions[i].srcSubresource.aspectMask;
VkImageAspectFlags dstAspect = pRegions[i].dstSubresource.aspectMask;
if (srcAspect != dstAspect) {
std::stringstream ss;
ss << "vkCmdBlitImage: Image aspects of depth/stencil images should match";
// TODO: Verify against Valid Use section of spec, if this case yields undefined results, then it's an error
skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)commandBuffer, __LINE__,
IMAGE_INVALID_IMAGE_ASPECT, "IMAGE", "%s", ss.str().c_str());
}
if (vk_format_is_depth_and_stencil(srcFormat)) {
if ((srcAspect != VK_IMAGE_ASPECT_DEPTH_BIT) && (srcAspect != VK_IMAGE_ASPECT_STENCIL_BIT)) {
std::stringstream ss;
ss << "vkCmdBlitImage: Combination depth/stencil image formats must have only one of "
"VK_IMAGE_ASPECT_DEPTH_BIT "
<< "and VK_IMAGE_ASPECT_STENCIL_BIT set in srcImage and dstImage";
skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)commandBuffer, __LINE__,
IMAGE_INVALID_IMAGE_ASPECT, "IMAGE", "%s", ss.str().c_str());
}
} else if (vk_format_is_stencil_only(srcFormat)) {
if (srcAspect != VK_IMAGE_ASPECT_STENCIL_BIT) {
std::stringstream ss;
ss << "vkCmdBlitImage: Stencil-only image formats must have only the VK_IMAGE_ASPECT_STENCIL_BIT "
<< "set in both the srcImage and dstImage";
skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)commandBuffer, __LINE__,
IMAGE_INVALID_IMAGE_ASPECT, "IMAGE", "%s", ss.str().c_str());
}
} else if (vk_format_is_depth_only(srcFormat)) {
if (srcAspect != VK_IMAGE_ASPECT_DEPTH_BIT) {
std::stringstream ss;
ss << "vkCmdBlitImage: Depth-only image formats must have only the VK_IMAGE_ASPECT_DEPTH "
<< "set in both the srcImage and dstImage";
skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)commandBuffer, __LINE__,
IMAGE_INVALID_IMAGE_ASPECT, "IMAGE", "%s", ss.str().c_str());
}
}
}
}
// Validate filter
if (vk_format_is_depth_or_stencil(srcFormat) && (filter != VK_FILTER_NEAREST)) {
std::stringstream ss;
ss << "vkCmdBlitImage: If the format of srcImage is a depth, stencil, or depth stencil "
<< "then filter must be VK_FILTER_NEAREST.";
skipCall |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
(uint64_t)commandBuffer, __LINE__, VALIDATION_ERROR_02193, "IMAGE", "%s. %s", ss.str().c_str(),
validation_error_map[VALIDATION_ERROR_02193]);
}
if (vk_format_is_int(srcFormat) && (filter != VK_FILTER_NEAREST)) {
std::stringstream ss;
ss << "vkCmdBlitImage: If the format of srcImage is an integer-based format "
<< "then filter must be VK_FILTER_NEAREST.";
skipCall |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
(uint64_t)commandBuffer, __LINE__, IMAGE_INVALID_FILTER, "IMAGE", "%s", ss.str().c_str());
}
}
if (!skipCall) {
device_data->device_dispatch_table->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout,
regionCount, pRegions, filter);
}
}
VKAPI_ATTR void VKAPI_CALL
CmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask,
VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers,
uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers,
uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers) {
bool skipCall = false;
layer_data *device_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
for (uint32_t i = 0; i < imageMemoryBarrierCount; ++i) {
VkImageMemoryBarrier const *const barrier = (VkImageMemoryBarrier const *const) & pImageMemoryBarriers[i];
// TODO: add VALIDATION_ERROR_00309 (sType == VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER) here
if (barrier->sType == VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER) {
// TODO: this check should include VALIDATION_ERROR_00301 and VALIDATION_ERROR_00316
if (barrier->subresourceRange.layerCount == 0) {
std::stringstream ss;
ss << "vkCmdPipelineBarrier called with 0 in ppMemoryBarriers[" << i << "]->subresourceRange.layerCount.";
skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0,
__LINE__, IMAGE_INVALID_IMAGE_RESOURCE, "IMAGE", "%s", ss.str().c_str());
}
}
}
if (skipCall) {
return;
}
device_data->device_dispatch_table->CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags,
memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount,
pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
}
VKAPI_ATTR void VKAPI_CALL CmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout,
VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount,
const VkImageResolve *pRegions) {
bool skipCall = false;
layer_data *device_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
auto srcImageEntry = getImageState(device_data, srcImage);
auto dstImageEntry = getImageState(device_data, dstImage);
// For each region, the number of layers in the image subresource should not be zero
// For each region, src and dest image aspect must be color only
for (uint32_t i = 0; i < regionCount; i++) {
if (pRegions[i].srcSubresource.layerCount == 0) {
char const str[] = "vkCmdResolveImage: number of layers in source subresource is zero";
// TODO: Verify against Valid Use section of spec. Generally if something yield an undefined result, it's invalid/error
skipCall |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
(uint64_t)commandBuffer, __LINE__, IMAGE_MISMATCHED_IMAGE_ASPECT, "IMAGE", str);
}
if (pRegions[i].dstSubresource.layerCount == 0) {
char const str[] = "vkCmdResolveImage: number of layers in destination subresource is zero";
// TODO: Verify against Valid Use section of spec. Generally if something yield an undefined result, it's invalid/error
skipCall |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
(uint64_t)commandBuffer, __LINE__, IMAGE_MISMATCHED_IMAGE_ASPECT, "IMAGE", str);
}
// TODO: VALIDATION_ERROR_01339
if ((pRegions[i].srcSubresource.aspectMask != VK_IMAGE_ASPECT_COLOR_BIT) ||
(pRegions[i].dstSubresource.aspectMask != VK_IMAGE_ASPECT_COLOR_BIT)) {
char const str[] =
"vkCmdResolveImage: src and dest aspectMasks for each region must specify only VK_IMAGE_ASPECT_COLOR_BIT";
skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)commandBuffer, __LINE__,
VALIDATION_ERROR_01338, "IMAGE", "%s. %s", str, validation_error_map[VALIDATION_ERROR_01338]);
}
}
if (srcImageEntry && dstImageEntry) {
if (srcImageEntry->format != dstImageEntry->format) {
char const str[] = "vkCmdResolveImage called with unmatched source and dest formats.";
skipCall |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
(uint64_t)commandBuffer, __LINE__, IMAGE_MISMATCHED_IMAGE_FORMAT, "IMAGE", str);
}
if (srcImageEntry->imageType != dstImageEntry->imageType) {
char const str[] = "vkCmdResolveImage called with unmatched source and dest image types.";
skipCall |=
log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT,
(uint64_t)commandBuffer, __LINE__, IMAGE_MISMATCHED_IMAGE_TYPE, "IMAGE", str);
}
if (srcImageEntry->samples == VK_SAMPLE_COUNT_1_BIT) {
char const str[] = "vkCmdResolveImage called with source sample count less than 2.";
skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)commandBuffer, __LINE__,
VALIDATION_ERROR_01320, "IMAGE", "%s. %s", str, validation_error_map[VALIDATION_ERROR_01320]);
}
if (dstImageEntry->samples != VK_SAMPLE_COUNT_1_BIT) {
char const str[] = "vkCmdResolveImage called with dest sample count greater than 1.";
skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, (uint64_t)commandBuffer, __LINE__,
VALIDATION_ERROR_01321, "IMAGE", "%s. %s", str, validation_error_map[VALIDATION_ERROR_01321]);
}
}
if (!skipCall) {
device_data->device_dispatch_table->CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout,
regionCount, pRegions);
}
}
VKAPI_ATTR void VKAPI_CALL GetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource *pSubresource,
VkSubresourceLayout *pLayout) {
bool skipCall = false;
layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
VkFormat format;
auto imageEntry = getImageState(device_data, image);
// Validate that image aspects match formats
if (imageEntry) {
format = imageEntry->format;
if (vk_format_is_color(format)) {
if (pSubresource->aspectMask != VK_IMAGE_ASPECT_COLOR_BIT) {
std::stringstream ss;
ss << "vkGetImageSubresourceLayout: For color formats, the aspectMask field of VkImageSubresource must be "
"VK_IMAGE_ASPECT_COLOR.";
skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
(uint64_t)image, __LINE__, VALIDATION_ERROR_00741, "IMAGE", "%s. %s", ss.str().c_str(),
validation_error_map[VALIDATION_ERROR_00741]);
}
} else if (vk_format_is_depth_or_stencil(format)) {
if ((pSubresource->aspectMask != VK_IMAGE_ASPECT_DEPTH_BIT) &&
(pSubresource->aspectMask != VK_IMAGE_ASPECT_STENCIL_BIT)) {
std::stringstream ss;
ss << "vkGetImageSubresourceLayout: For depth/stencil formats, the aspectMask selects either the depth or stencil "
"image aspectMask.";
skipCall |= log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
(uint64_t)image, __LINE__, VALIDATION_ERROR_00741, "IMAGE", "%s. %s", ss.str().c_str(),
validation_error_map[VALIDATION_ERROR_00741]);
}
}
}
if (!skipCall) {
device_data->device_dispatch_table->GetImageSubresourceLayout(device, image, pSubresource, pLayout);
}
}
VKAPI_ATTR void VKAPI_CALL
GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties) {
layer_data *phy_dev_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map);
phy_dev_data->instance_dispatch_table->GetPhysicalDeviceProperties(physicalDevice, pProperties);
}
VKAPI_ATTR VkResult VKAPI_CALL
EnumerateInstanceLayerProperties(uint32_t *pCount, VkLayerProperties *pProperties) {
return util_GetLayerProperties(1, &global_layer, pCount, pProperties);
}
VKAPI_ATTR VkResult VKAPI_CALL
EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, VkLayerProperties *pProperties) {
return util_GetLayerProperties(1, &global_layer, pCount, pProperties);
}
VKAPI_ATTR VkResult VKAPI_CALL
EnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, VkExtensionProperties *pProperties) {
if (pLayerName && !strcmp(pLayerName, global_layer.layerName))
return util_GetExtensionProperties(1, instance_extensions, pCount, pProperties);
return VK_ERROR_LAYER_NOT_PRESENT;
}
VKAPI_ATTR VkResult VKAPI_CALL EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
const char *pLayerName, uint32_t *pCount,
VkExtensionProperties *pProperties) {
// Image does not have any physical device extensions
if (pLayerName && !strcmp(pLayerName, global_layer.layerName))
return util_GetExtensionProperties(0, NULL, pCount, pProperties);
assert(physicalDevice);
dispatch_key key = get_dispatch_key(physicalDevice);
layer_data *my_data = get_my_data_ptr(key, layer_data_map);
VkLayerInstanceDispatchTable *pTable = my_data->instance_dispatch_table;
return pTable->EnumerateDeviceExtensionProperties(physicalDevice, NULL, pCount, pProperties);
}
static PFN_vkVoidFunction
intercept_core_instance_command(const char *name);
static PFN_vkVoidFunction
intercept_core_device_command(const char *name);
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetDeviceProcAddr(VkDevice device, const char *funcName) {
PFN_vkVoidFunction proc = intercept_core_device_command(funcName);
if (proc)
return proc;
assert(device);
layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
VkLayerDispatchTable *pTable = my_data->device_dispatch_table;
{
if (pTable->GetDeviceProcAddr == NULL)
return NULL;
return pTable->GetDeviceProcAddr(device, funcName);
}
}
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetInstanceProcAddr(VkInstance instance, const char *funcName) {
PFN_vkVoidFunction proc = intercept_core_instance_command(funcName);
if (!proc)
proc = intercept_core_device_command(funcName);
if (proc)
return proc;
assert(instance);
layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
proc = debug_report_get_instance_proc_addr(my_data->report_data, funcName);
if (proc)
return proc;
VkLayerInstanceDispatchTable *pTable = my_data->instance_dispatch_table;
if (pTable->GetInstanceProcAddr == NULL)
return NULL;
return pTable->GetInstanceProcAddr(instance, funcName);
}
static PFN_vkVoidFunction
intercept_core_instance_command(const char *name) {
static const struct {
const char *name;
PFN_vkVoidFunction proc;
} core_instance_commands[] = {
{ "vkGetInstanceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(GetInstanceProcAddr) },
{ "vkCreateInstance", reinterpret_cast<PFN_vkVoidFunction>(CreateInstance) },
{ "vkDestroyInstance", reinterpret_cast<PFN_vkVoidFunction>(DestroyInstance) },
{ "vkCreateDevice", reinterpret_cast<PFN_vkVoidFunction>(CreateDevice) },
{ "vkEnumerateInstanceLayerProperties", reinterpret_cast<PFN_vkVoidFunction>(EnumerateInstanceLayerProperties) },
{ "vkEnumerateDeviceLayerProperties", reinterpret_cast<PFN_vkVoidFunction>(EnumerateDeviceLayerProperties) },
{ "vkEnumerateInstanceExtensionProperties", reinterpret_cast<PFN_vkVoidFunction>(EnumerateInstanceExtensionProperties) },
{ "vkEnumerateDeviceExtensionProperties", reinterpret_cast<PFN_vkVoidFunction>(EnumerateDeviceExtensionProperties) },
{ "vkGetPhysicalDeviceProperties", reinterpret_cast<PFN_vkVoidFunction>(GetPhysicalDeviceProperties) },
};
for (size_t i = 0; i < ARRAY_SIZE(core_instance_commands); i++) {
if (!strcmp(core_instance_commands[i].name, name))
return core_instance_commands[i].proc;
}
return nullptr;
}
static PFN_vkVoidFunction
intercept_core_device_command(const char *name) {
static const struct {
const char *name;
PFN_vkVoidFunction proc;
} core_device_commands[] = {
{"vkGetDeviceProcAddr", reinterpret_cast<PFN_vkVoidFunction>(GetDeviceProcAddr)},
{"vkDestroyDevice", reinterpret_cast<PFN_vkVoidFunction>(DestroyDevice)},
{"vkCreateImage", reinterpret_cast<PFN_vkVoidFunction>(CreateImage)},
{"vkDestroyImage", reinterpret_cast<PFN_vkVoidFunction>(DestroyImage)},
{"vkCreateRenderPass", reinterpret_cast<PFN_vkVoidFunction>(CreateRenderPass)},
{"vkCmdClearColorImage", reinterpret_cast<PFN_vkVoidFunction>(CmdClearColorImage)},
{"vkCmdClearDepthStencilImage", reinterpret_cast<PFN_vkVoidFunction>(CmdClearDepthStencilImage)},
{"vkCmdClearAttachments", reinterpret_cast<PFN_vkVoidFunction>(CmdClearAttachments)},
{"vkCmdCopyImage", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyImage)},
{"vkCmdCopyImageToBuffer", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyImageToBuffer)},
{"vkCmdCopyBufferToImage", reinterpret_cast<PFN_vkVoidFunction>(CmdCopyBufferToImage)},
{"vkCmdBlitImage", reinterpret_cast<PFN_vkVoidFunction>(CmdBlitImage)},
{"vkCmdPipelineBarrier", reinterpret_cast<PFN_vkVoidFunction>(CmdPipelineBarrier)},
{"vkCmdResolveImage", reinterpret_cast<PFN_vkVoidFunction>(CmdResolveImage)},
{"vkGetImageSubresourceLayout", reinterpret_cast<PFN_vkVoidFunction>(GetImageSubresourceLayout)},
};
for (size_t i = 0; i < ARRAY_SIZE(core_device_commands); i++) {
if (!strcmp(core_device_commands[i].name, name))
return core_device_commands[i].proc;
}
return nullptr;
}
} // namespace image
// vk_layer_logging.h expects these to be defined
VKAPI_ATTR VkResult VKAPI_CALL
vkCreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT *pMsgCallback) {
return image::CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pMsgCallback);
}
VKAPI_ATTR void VKAPI_CALL
vkDestroyDebugReportCallbackEXT(VkInstance instance,
VkDebugReportCallbackEXT msgCallback,
const VkAllocationCallbacks *pAllocator) {
image::DestroyDebugReportCallbackEXT(instance, msgCallback, pAllocator);
}
VKAPI_ATTR void VKAPI_CALL
vkDebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objType, uint64_t object,
size_t location, int32_t msgCode, const char *pLayerPrefix, const char *pMsg) {
image::DebugReportMessageEXT(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg);
}
// loader-layer interface v0, just wrappers since there is only a layer
VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, VkExtensionProperties *pProperties) {
return image::EnumerateInstanceExtensionProperties(pLayerName, pCount, pProperties);
}
VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
vkEnumerateInstanceLayerProperties(uint32_t *pCount, VkLayerProperties *pProperties) {
return image::EnumerateInstanceLayerProperties(pCount, pProperties);
}
VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, VkLayerProperties *pProperties) {
// the layer command handles VK_NULL_HANDLE just fine internally
assert(physicalDevice == VK_NULL_HANDLE);
return image::EnumerateDeviceLayerProperties(VK_NULL_HANDLE, pCount, pProperties);
}
VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
const char *pLayerName, uint32_t *pCount,
VkExtensionProperties *pProperties) {
// the layer command handles VK_NULL_HANDLE just fine internally
assert(physicalDevice == VK_NULL_HANDLE);
return image::EnumerateDeviceExtensionProperties(VK_NULL_HANDLE, pLayerName, pCount, pProperties);
}
VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice dev, const char *funcName) {
return image::GetDeviceProcAddr(dev, funcName);
}
VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char *funcName) {
return image::GetInstanceProcAddr(instance, funcName);
}
| 59.512483
| 132
| 0.658331
|
ViveStudiosCN
|
373b117f6a75884a889f895a41693f0ca8d20e70
| 1,229
|
cpp
|
C++
|
src/game/Engine.cpp
|
jumptohistory/jaymod
|
92d0a0334ac27da94b12280b0b42b615b8813c23
|
[
"Apache-2.0"
] | 25
|
2016-05-27T11:53:58.000Z
|
2021-10-17T00:13:41.000Z
|
src/game/Engine.cpp
|
jumptohistory/jaymod
|
92d0a0334ac27da94b12280b0b42b615b8813c23
|
[
"Apache-2.0"
] | 1
|
2016-07-09T05:25:03.000Z
|
2016-07-09T05:25:03.000Z
|
src/game/Engine.cpp
|
jumptohistory/jaymod
|
92d0a0334ac27da94b12280b0b42b615b8813c23
|
[
"Apache-2.0"
] | 16
|
2016-05-28T23:06:50.000Z
|
2022-01-26T13:47:12.000Z
|
#include <bgame/impl.h>
///////////////////////////////////////////////////////////////////////////////
namespace {
static char argbuf[MAX_STRING_CHARS];
}
///////////////////////////////////////////////////////////////////////////////
size_t
Engine::argc()
{
return ptr( G_ARGC );
}
///////////////////////////////////////////////////////////////////////////////
size_t
Engine::argl( string& out )
{
ostringstream oss;
vector<string> argList;
const size_t max = args( argList );
for ( size_t i = 0; i < max; i++ ) {
if (i)
oss << ' ';
oss << argList[i];
}
out = oss.str();
return out.length();
}
///////////////////////////////////////////////////////////////////////////////
size_t
Engine::args( vector<string>& out )
{
const size_t count = ptr( G_ARGC );
out.resize( count );
for (size_t i = 0; i < count; i++) {
ptr( G_ARGV, i, argbuf, sizeof(argbuf) );
out[i] = argbuf;
}
return out.size();
}
///////////////////////////////////////////////////////////////////////////////
size_t
Engine::argv( size_t n, string& out )
{
ptr( G_ARGV, n, argbuf, sizeof(argbuf) );
out = argbuf;
return out.length();
}
| 20.483333
| 79
| 0.369406
|
jumptohistory
|
373efcd83c6bc392ddaa79202534dfe9e9e1ffeb
| 10,749
|
cpp
|
C++
|
src/ta_package_generator.cpp
|
temoto-framework/temoto_action_assistant
|
4bfc5683c134763b6f0da8a2f0821bb82e657100
|
[
"Apache-2.0"
] | 1
|
2019-01-24T14:38:51.000Z
|
2019-01-24T14:38:51.000Z
|
src/ta_package_generator.cpp
|
temoto-telerobotics/temoto_action_assistant
|
4bfc5683c134763b6f0da8a2f0821bb82e657100
|
[
"Apache-2.0"
] | null | null | null |
src/ta_package_generator.cpp
|
temoto-telerobotics/temoto_action_assistant
|
4bfc5683c134763b6f0da8a2f0821bb82e657100
|
[
"Apache-2.0"
] | null | null | null |
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright 2019 TeMoto Telerobotics
*
* 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.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Author: Robert Valner */
#include "temoto_action_assistant/ta_package_generator.h"
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
#include <fstream>
namespace temoto_action_assistant
{
ActionPackageGenerator::ActionPackageGenerator(const std::string& file_template_path)
: file_template_path_(file_template_path + "/")
, file_templates_loaded_(false)
{
if (file_template_path_.empty())
{
return;
}
// Import the CMakeLists template
t_cmakelists = tp::TemplateContainer(file_template_path_ + "file_templates/temoto_ta_cmakelists.xml");
// Import the package.xml template
t_packagexml = tp::TemplateContainer(file_template_path_ + "file_templates/temoto_ta_packagexml.xml");
// Import the action test templates
t_testlaunch_standalone = tp::TemplateContainer(file_template_path_ + "file_templates/temoto_ta_action_test_standalone.xml");
t_testlaunch_separate = tp::TemplateContainer(file_template_path_ + "file_templates/temoto_ta_action_test_separate.xml");
t_umrf_graph = tp::TemplateContainer(file_template_path_ + "file_templates/temoto_ta_umrf_graphtxt.xml");
// Import the macros.h template
t_macros_header = tp::TemplateContainer(file_template_path_ + "file_templates/temoto_ta_macros_header.xml");
// Import the temoto_action.h template
t_bridge_header = tp::TemplateContainer(file_template_path_ + "file_templates/temoto_ta_bridge_header.xml");
// Import the action implementation c++ code templates
t_class_base = tp::TemplateContainer(file_template_path_ + "file_templates/ta_class_base.xml");
t_execute_action = tp::TemplateContainer(file_template_path_ + "file_templates/ta_execute_action.xml");
t_parameter_in = tp::TemplateContainer(file_template_path_ + "file_templates/ta_parameter_in.xml");
t_parameter_out = tp::TemplateContainer(file_template_path_ + "file_templates/ta_parameter_out.xml");
t_parameter_decl = tp::TemplateContainer(file_template_path_ + "file_templates/ta_parameter_decl.xml");
t_comment = tp::TemplateContainer(file_template_path_ + "file_templates/ta_comment_block.xml");
t_line_comment = tp::TemplateContainer(file_template_path_ + "file_templates/ta_line_comment.xml");
file_templates_loaded_ = true;
}
void ActionPackageGenerator::generatePackage(const Umrf& umrf, const std::string& package_path)
{
if (!file_templates_loaded_)
{
std::cout << "Could not generate a TeMoto action package because the file templates are not loaded" << std::endl;
return;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* CREATE AI PACKAGE DIRECTORY STRUCTURE
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
// Get the name of the package
const std::string ta_package_name = umrf.getPackageName();
const std::string ta_dst_path = package_path + "/" + ta_package_name + "/";
// Create a package directory
boost::filesystem::create_directories(ta_dst_path + "/src");
boost::filesystem::create_directories(ta_dst_path + "/launch");
boost::filesystem::create_directories(ta_dst_path + "/test");
boost::filesystem::create_directories(ta_dst_path + "/include/" + ta_package_name);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* GENERATE THE CONTENT
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Extract the necessary datastructures from the umrf
*/
std::string ta_class_name = umrf.getName();
/*
* Generate umrf.json
*/
std::ofstream umrf_json_file;
umrf_json_file.open (ta_dst_path + "/umrf.json");
umrf_json_file << umrf_json_converter::toUmrfJsonStr(umrf);
umrf_json_file.close();
/*
* Generate invoker_umrf.json
*/
std::ofstream invoker_umrf_json_file;
Umrf invoker_umrf = umrf;
invoker_umrf.getInputParametersNc().clear();
// Give input parameters some dummy values
for (auto& param_in : umrf.getInputParameters())
{
if (param_in.getType() == "string")
{
ActionParameters::ParameterContainer pc = param_in;
pc.setData(boost::any(std::string("MODIFY THIS FIELD")));
invoker_umrf.getInputParametersNc().setParameter(pc, true);
}
else if (param_in.getType() == "number")
{
ActionParameters::ParameterContainer pc = param_in;
pc.setData(boost::any(double(0.0)));
invoker_umrf.getInputParametersNc().setParameter(pc, true);
}
}
invoker_umrf.setSuffix("0");
invoker_umrf_json_file.open (ta_dst_path + "/test/invoker_umrf.json");
invoker_umrf_json_file << umrf_json_converter::toUmrfJsonStr(invoker_umrf);
invoker_umrf_json_file.close();
/*
* Generate CMakeLists.txt
*/
t_cmakelists.setArgument("ta_name", ta_package_name);
t_cmakelists.processAndSaveTemplate(ta_dst_path, "CMakeLists");
/*
* Generate package.xml
*/
t_packagexml.setArgument("ta_name", ta_package_name);
t_packagexml.processAndSaveTemplate(ta_dst_path, "package");
/*
* Generate the macros header
*/
t_macros_header.setArgument("ta_package_name", ta_package_name);
std::ofstream macros_header_file;
macros_header_file.open (ta_dst_path + "/include/" + ta_package_name + "/macros.h");
macros_header_file << t_macros_header.processTemplate();
macros_header_file.close();
/*
* Generate the temoto_action header
*/
t_bridge_header.setArgument("ta_package_name", ta_package_name);
std::ofstream bridge_header_file;
bridge_header_file.open (ta_dst_path + "/include/" + ta_package_name + "/temoto_action.h");
bridge_header_file << t_bridge_header.processTemplate();
bridge_header_file.close();
/*
* Generate action_test_standalone.launch
*/
t_testlaunch_standalone.setArgument("ta_package_name", ta_package_name);
t_testlaunch_standalone.processAndSaveTemplate(ta_dst_path + "launch/", "action_test_standalone");
/*
* Generate action_test_separate.launch
*/
t_testlaunch_separate.setArgument("ta_package_name", ta_package_name);
t_testlaunch_separate.processAndSaveTemplate(ta_dst_path + "launch/", "action_test_separate");
/*
* Generate umrf_graph.txt
*/
t_umrf_graph.setArgument("umrf_name", "invoker_umrf.json");
t_umrf_graph.processAndSaveTemplate(ta_dst_path + "test/", "umrf_graph");
/*
* Generate the action implementation c++ source file
*/
std::string generated_content_cpp;
/*
* Get input parameters
*/
if (!umrf.getInputParameters().empty())
{
t_line_comment.setArgument("comment", "Input parameters");
t_line_comment.setArgument("whitespace", " ");
generated_content_cpp += t_line_comment.processTemplate();
}
for (const auto& input_param : umrf.getInputParameters())
{
std::string parameter_name = input_param.getName();
boost::replace_all(parameter_name, "::", "_");
t_parameter_in.setArgument("param_name", input_param.getName());
t_parameter_in.setArgument("param_name_us", parameter_name);
if (action_parameter::PARAMETER_MAP.find(input_param.getType()) != action_parameter::PARAMETER_MAP.end())
{
t_parameter_in.setArgument("param_type", action_parameter::PARAMETER_MAP.at(input_param.getType()));
}
else
{
t_parameter_in.setArgument("param_type", input_param.getType());
}
generated_content_cpp += " " + t_parameter_in.processTemplate();
}
/*
* Declare output parameters
*/
if (!umrf.getOutputParameters().empty())
{
t_line_comment.setArgument("comment", "Declaration of output parameters");
t_line_comment.setArgument("whitespace", "\n ");
generated_content_cpp += t_line_comment.processTemplate();
}
for (const auto& output_param : umrf.getOutputParameters())
{
std::string parameter_name = output_param.getName();
boost::replace_all(parameter_name, "::", "_");
t_parameter_decl.setArgument("param_name_us", parameter_name);
if (action_parameter::PARAMETER_MAP.find(output_param.getType()) != action_parameter::PARAMETER_MAP.end())
{
t_parameter_decl.setArgument("param_type", action_parameter::PARAMETER_MAP.at(output_param.getType()));
}
else
{
t_parameter_decl.setArgument("param_type", output_param.getType());
}
generated_content_cpp += " " + t_parameter_decl.processTemplate();
}
// Add a placeholder comment
t_comment.setArgument("comment", "YOUR CODE HERE");
generated_content_cpp += t_comment.processTemplate();
/*
* Set the output parameters
*/
if (!umrf.getOutputParameters().empty())
{
t_line_comment.setArgument("comment", "Pass the output parameters to the action engine");
t_line_comment.setArgument("whitespace", "\n ");
generated_content_cpp += t_line_comment.processTemplate();
}
for (const auto& output_param : umrf.getOutputParameters())
{
std::string parameter_name = output_param.getName();
boost::replace_all(parameter_name, "::", "_");
t_parameter_out.setArgument("param_name_us", parameter_name);
t_parameter_out.setArgument("param_name", output_param.getName());
if (action_parameter::PARAMETER_MAP.find(output_param.getType()) != action_parameter::PARAMETER_MAP.end())
{
t_parameter_out.setArgument("param_type", action_parameter::PARAMETER_MAP.at(output_param.getType()));
}
else
{
t_parameter_out.setArgument("param_type", output_param.getType());
}
generated_content_cpp += " " + t_parameter_out.processTemplate();
}
t_execute_action.setArgument("function_body", generated_content_cpp);
// Create action class base
t_class_base.setArgument("ta_class_name", ta_class_name);
t_class_base.setArgument("ta_package_name", ta_package_name);
t_class_base.setArgument("ta_class_body", t_execute_action.processTemplate());
/*
* Save the generated c++ content
*/
tp::saveStrToFile(t_class_base.processTemplate(), ta_dst_path + "/src", ta_package_name, ".cpp");
}
}// temoto_action_assistant namespace
| 37.848592
| 127
| 0.704438
|
temoto-framework
|
3740c2da7ab325a306aea76d62eeb8a790c628b3
| 597
|
cpp
|
C++
|
lib/Direction.cpp
|
prakashutoledo/pacman-cpp
|
0d3e46bd79970d722bc83fd5aeb52a34ad6c27e5
|
[
"Apache-2.0"
] | 1
|
2021-04-19T12:10:01.000Z
|
2021-04-19T12:10:01.000Z
|
lib/Direction.cpp
|
prakashutoledo/pacman-cpp
|
0d3e46bd79970d722bc83fd5aeb52a34ad6c27e5
|
[
"Apache-2.0"
] | null | null | null |
lib/Direction.cpp
|
prakashutoledo/pacman-cpp
|
0d3e46bd79970d722bc83fd5aeb52a34ad6c27e5
|
[
"Apache-2.0"
] | null | null | null |
#include "Direction.h"
string Direction::String()
{
stringstream result;
result << "X: " << x << " Y: " << y << " ";
return result.str();
}
Direction* Direction::GetRandomly(double min_abs)
{
Direction *new_obj = new Direction();
new_obj->SetRandomly(min_abs);
return new_obj;
}
void Direction::SetRandomly(double min_abs)
{
Random * random = Random::Instance();
x = 0; y = 0;
while(fabs(x) < min_abs)
x = random->Generate();
while(fabs(y) < min_abs)
y = random->Generate();
}
| 19.258065
| 51
| 0.536013
|
prakashutoledo
|
37602fbe5eb07598c10c0661ea94e5507ae8dd8e
| 11,346
|
cpp
|
C++
|
XPowerControl/FirstSetup.cpp
|
snowpoke/XPowerControl
|
a5e4493cde4bdc06df30dba69a9460247074fdcd
|
[
"MIT"
] | 4
|
2021-11-11T17:03:20.000Z
|
2022-01-14T18:13:41.000Z
|
XPowerControl/FirstSetup.cpp
|
snowpoke/XPowerControl
|
a5e4493cde4bdc06df30dba69a9460247074fdcd
|
[
"MIT"
] | 1
|
2022-01-14T00:39:49.000Z
|
2022-01-14T00:39:49.000Z
|
XPowerControl/FirstSetup.cpp
|
snowpoke/XPowerControl
|
a5e4493cde4bdc06df30dba69a9460247074fdcd
|
[
"MIT"
] | null | null | null |
#define _WINSOCK_DEPRECATED_NO_WARNINGS
#include "afxdialogex.h"
#include "FirstSetup.h"
#include "FirstSetupDlg2.h"
#include "FirstSetupDlg3.h"
#include "FirstSetupDlg4.h"
#include "wstring_transform.h"
#include "TokenRetriever.h"
#include "Version.h"
#include <memory>
#include <iostream>
#include <string>
#include <cstring> ///< memset
#include <errno.h> ///< errno
#include <winsock2.h> ///< socket
#include <WS2tcpip.h>
#include <boost/format.hpp>
#include "bit7zlibrary.hpp"
#include "bitextractor.hpp"
#include "bitformat.hpp"
#include "bitexception.hpp"
#include "bitmemextractor.hpp"
#include "logging.h"
#include <io.h>
#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <shlobj.h>
#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "urlmon.lib")
using namespace std;
void FirstSetup::setup_mitm()
{
// retrieve home path for user running the program
logging::log_ptr _logger = logging::get_logger(DEFAULT_LOG);
wchar_t home_path[MAX_PATH];
HANDLE current_user;
OpenProcessToken(GetCurrentProcess(), TOKEN_READ, ¤t_user);
SHGetFolderPath(NULL, CSIDL_PROFILE, current_user, SHGFP_TYPE_CURRENT, home_path);
wstring cert_path = wstring(home_path) + L"\\.mitmproxy\\";
_logger->info("Saving certificates to path {}", transform::ws2s(cert_path));
CreateDirectory(cert_path.c_str(), NULL);
// delete existing certificates
vector<wstring> cert_names = { L"mitmproxy-ca.p12", L"mitmproxy-ca.pem", L"mitmproxy-ca-cert.cer",
L"mitmproxy-ca-cert.p12", L"mitmproxy-ca-cert.pem", L"mitmproxy-dhparam.pem" };
for (wstring name : cert_names) {
DeleteFile((cert_path + name).c_str());
}
try {
bit7z::Bit7zLibrary lib{ L"7zxa.dll" };
bit7z::BitExtractor extractor{ lib, bit7z::BitFormat::SevenZip };
extractor.extract(L"mitmproxy_certs.7z", cert_path);
_logger->info("Successfully extracted mitmproxy certificates.");
}
catch (const bit7z::BitException & ex) {
_logger->error("Failed to extract mitmproxy certificates. ex.what() returned: {}", (string) ex.what());
AfxMessageBox(transform::s2ws(ex.what()).c_str());
AfxThrowUserException();
}
}
HANDLE FirstSetup::job_to_process_handle(HANDLE job_handle) {
// get process handle from job object
JOBOBJECT_BASIC_PROCESS_ID_LIST id_list;
DWORD return_size;
QueryInformationJobObject(job_handle, JobObjectBasicProcessIdList, &id_list, sizeof(JOBOBJECT_BASIC_PROCESS_ID_LIST), &return_size);
DWORD process_id = id_list.ProcessIdList[0];
return OpenProcess(PROCESS_QUERY_INFORMATION | SYNCHRONIZE, true, process_id);
}
void FirstSetup::setup_bs() {
setup_bs(optional<CWnd*>());
}
BOOL CALLBACK kill_proxywin(HWND hwnd, LPARAM lParam) {
wchar_t title[1024];
GetWindowText(hwnd, title, 1024);
//wcout << title << L"\n";
bool visibility = IsWindowVisible(hwnd);
HWND parent = GetParent(hwnd);
wchar_t parent_title[1024];
if (parent != NULL)
GetWindowText(parent, parent_title, 1024);
WINDOWINFO window_info;
window_info.cbSize = sizeof(WINDOWINFO);
GetWindowInfo(hwnd, &window_info);
auto width = window_info.rcWindow.right - window_info.rcWindow.left;
auto height = window_info.rcWindow.bottom - window_info.rcWindow.top;
if (wstring(title) == L"BlueStacks" && to_wstring(window_info.dwExStyle) == L"3758164225" && visibility == true) {
logging::log_ptr _logger = logging::get_logger(DEFAULT_LOG);
_logger->info("Closing window with the following parameters:\n\
Window Title: {}\nVisibility: {}\nHas Parent: {}\nWindow rect: {}x{}\nExtended window styles: {}",
transform::ws2s(title), to_string(visibility), to_string(parent != NULL),
to_string(height), to_string(width), to_string(window_info.dwExStyle));
if (parent != NULL)
_logger->info("Parent Title: {}", transform::ws2s(parent_title));
// we send a WM_CLOSE message to the program
SendMessage(hwnd, WM_CLOSE, NULL, NULL);
}
return true;
}
void FirstSetup::setup_bs(optional<CWnd*> feedback_win) {
CRegKey registry;
ULONG sz_datadir = MAX_PATH;
ULONG sz_installdir = MAX_PATH;
ULONG sz_version = 20;
CString cstr_datadir = CString();
CString cstr_installdir = CString();
CString bs_version_str;
logging::log_ptr _logger = logging::get_logger(DEFAULT_LOG);
if (feedback_win) {
(*feedback_win)->SetWindowTextW(L"Moving emulator data...");
}
_logger->info("Moving Root.vdi");
// Computer\HKEY_LOCAL_MACHINE\SOFTWARE\BlueStacks has info we need in DataDir and InstallDir
registry.Open(HKEY_LOCAL_MACHINE, L"SOFTWARE\\BlueStacks", KEY_READ);
registry.QueryStringValue(L"DataDir", cstr_datadir.GetBuffer(sz_datadir), &sz_datadir);
registry.QueryStringValue(L"InstallDir", cstr_installdir.GetBuffer(sz_installdir), &sz_installdir);
registry.QueryStringValue(L"ClientVersion", bs_version_str.GetBuffer(sz_version), &sz_version);
wstring datadir = wstring(cstr_datadir);
wstring installdir = wstring(cstr_installdir);
Version bs_version = Version::from_string(transform::ws2s(wstring(bs_version_str)));
_logger->info("DataDir for BlueStacks: {}", transform::ws2s(datadir));
_logger->info("InstallDir for BlueStacks: {}", transform::ws2s(installdir));
// move Root.vdi
wstring vdi_path = datadir + L"Android\\Root.vdi";
DeleteFile(vdi_path.c_str());
MoveFile(L"Root.vdi", vdi_path.c_str());
if (feedback_win)
(*feedback_win)->SetWindowTextW(L"Adjusting android proxy settings...");
_logger->info("Adjusting android proxy settings.");
// launch BlueStacks
HANDLE bs_handle = TokenRetriever::run_command(datadir + L"..\\Client\\Bluestacks.exe");
// keep running proxy setup until it returns success code
DWORD exit_code;
DWORD gui_count = 0;
HANDLE process_handle;
HANDLE exec_handle;
vector<HANDLE> proxy_handles;
// run code to set a proxy - this only works when the BlueStacks emulator has loaded, so after this loop ends, we know that the emulator is running
bool proxy_assigned = false;
while (!proxy_assigned) {
exec_handle = TokenRetriever::run_command(wstring(L"\"") + installdir + L"HD-ConfigHttpProxy.exe\" set " + transform::s2ws(get_local_ip()) + L" 8080", installdir.data(), DETACHED_PROCESS);
proxy_handles.push_back(exec_handle);
process_handle = job_to_process_handle(exec_handle);
//WaitForSingleObject(process_handle, INFINITE); //TODO: This would work way better if we regularly checked if the window has opened
// every second the proxy configurator runs, check if a window is open
while (WaitForSingleObject(process_handle, 1000) != WAIT_OBJECT_0) {
// if GetGuiResources returns a non-zero value, a UI window has been opened (which means the proxy change succeeded)
gui_count = GetGuiResources(process_handle, GR_USEROBJECTS);
_logger->info("Got GUI count: {}", to_string(gui_count));
if (!GetExitCodeProcess(process_handle, &exit_code)) {
_logger->info("GetExitCodeProgress Error: {}", to_string(GetLastError()));
break; // try to call the proxy configurator again
}
_logger->info("Exit code: {}", to_string(exit_code));
if (exit_code == 259 && gui_count > 3) { // this code is active when a pop-up is on the screen, we can force quit from here
// close all instances of the proxy program we've opened so far
EnumWindows(kill_proxywin, NULL); // sends WM_CLOSE to the proxy window
//for_each(proxy_handles.begin(), proxy_handles.end(), [](HANDLE h) {CloseHandle(h); });
_logger->info("Sending WM_CLOSE to proxy window");
proxy_assigned = true;
break; // since proxy_assigned, this will also leave the overarching loop
}
}
WaitForSingleObject(process_handle, 5000);
Sleep(10);
}
if (feedback_win)
(*feedback_win)->SetWindowTextW(L"Waiting for emulator to automatically shut down...");
// we run HD-Quit.exe to quit bluestacks
HANDLE quit_handle = TokenRetriever::run_command(installdir + L"HD-Quit.exe");
HANDLE bs_process_handle = job_to_process_handle(bs_handle);
WaitForSingleObject(bs_process_handle, INFINITE);
//CloseHandle(bs_handle);
if (feedback_win)
(*feedback_win)->SetWindowTextW(L"Installing Nintendo Switch Online app...");
// run code to install NSO app
exec_handle = TokenRetriever::run_command(installdir + L"HD-ApkHandler.exe nso.apk");
process_handle = job_to_process_handle(exec_handle);
WaitForSingleObject(process_handle, INFINITE);
GetExitCodeProcess(process_handle, &exit_code);
}
void FirstSetup::cleanup()
{
DeleteFile(L"Root.7z.001");
DeleteFile(L"Root.7z.002");
DeleteFile(L"Root.7z.003");
DeleteFile(L"Root.7z.004");
DeleteFile(L"Root.7z");
DeleteFile(L"nso.apk");
DeleteFile(L"installer_bs.exe");
DeleteFile(L"installer_mitm.exe");
DeleteFile(L"Root.vdi");
DeleteFile(L"mitmproxy_certs.7z");
logging::log_ptr _logger = logging::get_logger(DEFAULT_LOG);
_logger->info("Deleted temporary installer files.");
}
// using script from https://stackoverflow.com/a/49336660
string FirstSetup::get_local_ip() {
const char* google_dns_server = "8.8.8.8";
int dns_port = 53;
int startup_ret;
int retries = 0;
logging::log_ptr _logger = logging::get_logger(DEFAULT_LOG);
do {
WORD w_version_requested = MAKEWORD(2, 2);
WSADATA wsa_data;
startup_ret = WSAStartup(w_version_requested, &wsa_data);
if (startup_ret != 0)
_logger->warn("Startup error {}", to_string(startup_ret));
} while (startup_ret != 0 && ++retries < 2);
struct sockaddr_in serv;
SOCKET sock = socket(AF_INET, SOCK_DGRAM, 0);
//Socket could not be created
if (sock == INVALID_SOCKET)
_logger->error("Socket error {}", to_string(WSAGetLastError()));
memset(&serv, 0, sizeof(serv));
serv.sin_family = AF_INET;
serv.sin_addr.s_addr = inet_addr(google_dns_server);
serv.sin_port = htons(dns_port);
int err = connect(sock, (const struct sockaddr*) & serv, sizeof(serv));
if (err < 0)
_logger->error("Error number: {} -- Error message: {}", to_string(errno), strerror(errno));
struct sockaddr_in name;
socklen_t namelen = sizeof(name);
err = getsockname(sock, (struct sockaddr*) & name, &namelen);
char buffer[80];
const char* p = inet_ntop(AF_INET, &name.sin_addr, buffer, 80);
if (p != NULL)
_logger->info("Local IP address is: {}", buffer);
else
_logger->error("Error number: {} -- Error message: {}", to_string(errno), strerror(errno));
closesocket(sock);
WSACleanup();
return buffer;
}
int FirstSetup::confirm_exit(HWND owner)
{
return (MessageBox(owner, L"This will exit the setup process. Are you sure?", L"Exit Setup", MB_YESNO | MB_ICONINFORMATION) == IDYES);
}
| 38.20202
| 890
| 0.681738
|
snowpoke
|
376321fc2ec835fbfc84816e748a90c2b50a0e89
| 646
|
hpp
|
C++
|
libs/renderer/include/sge/renderer/texture/scoped_volume_lock.hpp
|
cpreh/spacegameengine
|
313a1c34160b42a5135f8223ffaa3a31bc075a01
|
[
"BSL-1.0"
] | 2
|
2016-01-27T13:18:14.000Z
|
2018-05-11T01:11:32.000Z
|
libs/renderer/include/sge/renderer/texture/scoped_volume_lock.hpp
|
cpreh/spacegameengine
|
313a1c34160b42a5135f8223ffaa3a31bc075a01
|
[
"BSL-1.0"
] | null | null | null |
libs/renderer/include/sge/renderer/texture/scoped_volume_lock.hpp
|
cpreh/spacegameengine
|
313a1c34160b42a5135f8223ffaa3a31bc075a01
|
[
"BSL-1.0"
] | 3
|
2018-05-11T01:11:34.000Z
|
2021-04-24T19:47:45.000Z
|
// Copyright Carl Philipp Reh 2006 - 2019.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef SGE_RENDERER_TEXTURE_SCOPED_VOLUME_LOCK_HPP_INCLUDED
#define SGE_RENDERER_TEXTURE_SCOPED_VOLUME_LOCK_HPP_INCLUDED
#include <sge/image3d/tag.hpp>
#include <sge/renderer/color_buffer/scoped_volume_lock.hpp>
#include <sge/renderer/texture/scoped_volume_lock_fwd.hpp>
#include <sge/renderer/texture/detail/declare_basic_scoped_lock.hpp>
SGE_RENDERER_TEXTURE_DETAIL_DECLARE_BASIC_SCOPED_LOCK(sge::image3d::tag);
#endif
| 38
| 73
| 0.803406
|
cpreh
|
3766313757ecf2bfeabf5864df8634b6c4924128
| 304
|
hpp
|
C++
|
include/BeatMap.hpp
|
thejsa/rhythm-run
|
ab11f97e7552c217bfa4a8392ec96aadf0f9f6b1
|
[
"CC-BY-3.0"
] | 1
|
2022-02-01T19:33:21.000Z
|
2022-02-01T19:33:21.000Z
|
include/BeatMap.hpp
|
thejsa/rhythm-run
|
ab11f97e7552c217bfa4a8392ec96aadf0f9f6b1
|
[
"CC-BY-3.0"
] | null | null | null |
include/BeatMap.hpp
|
thejsa/rhythm-run
|
ab11f97e7552c217bfa4a8392ec96aadf0f9f6b1
|
[
"CC-BY-3.0"
] | null | null | null |
/*
* Rhythm Run for Nintendo 3DS
* Lauren Kelly, 2021
*/
#pragma once
#include <deque>
#include <fstream>
#include <iostream>
class BeatMap {
public:
float bpm = 150;
std::deque<long> beats;
BeatMap() {};
BeatMap(std::ifstream& a_file);
long peekBeat();
long popBeat();
};
| 13.818182
| 35
| 0.621711
|
thejsa
|
376846471bf98a465d05a96852d9b1522f7795af
| 10,279
|
cpp
|
C++
|
src/qt/qtbase/tests/auto/widgets/graphicsview/qgraphicspolygonitem/tst_qgraphicspolygonitem.cpp
|
power-electro/phantomjs-Gohstdriver-DIY-openshift
|
a571d301a9658a4c1b524d07e15658b45f8a0579
|
[
"BSD-3-Clause"
] | 1
|
2020-04-30T15:47:35.000Z
|
2020-04-30T15:47:35.000Z
|
src/qt/qtbase/tests/auto/widgets/graphicsview/qgraphicspolygonitem/tst_qgraphicspolygonitem.cpp
|
power-electro/phantomjs-Gohstdriver-DIY-openshift
|
a571d301a9658a4c1b524d07e15658b45f8a0579
|
[
"BSD-3-Clause"
] | null | null | null |
src/qt/qtbase/tests/auto/widgets/graphicsview/qgraphicspolygonitem/tst_qgraphicspolygonitem.cpp
|
power-electro/phantomjs-Gohstdriver-DIY-openshift
|
a571d301a9658a4c1b524d07e15658b45f8a0579
|
[
"BSD-3-Clause"
] | null | null | null |
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtTest/QtTest>
#include <qgraphicsitem.h>
#include <qpen.h>
class tst_QGraphicsPolygonItem : public QObject
{
Q_OBJECT
public slots:
void initTestCase();
void cleanupTestCase();
void init();
void cleanup();
private slots:
void qgraphicspolygonitem_data();
void qgraphicspolygonitem();
void boundingRect_data();
void boundingRect();
void contains_data();
void contains();
void fillRule_data();
void fillRule();
void isObscuredBy_data();
void isObscuredBy();
void opaqueArea_data();
void opaqueArea();
void polygon_data();
void polygon();
void shape_data();
void shape();
void extension_data();
void extension();
void setExtension_data();
void setExtension();
void supportsExtension_data();
void supportsExtension();
};
// Subclass that exposes the protected functions.
class SubQGraphicsPolygonItem : public QGraphicsPolygonItem
{
public:
enum Extension {
UserExtension = QGraphicsItem::UserExtension
};
SubQGraphicsPolygonItem(QGraphicsItem *parent = 0) : QGraphicsPolygonItem(parent)
{
}
SubQGraphicsPolygonItem(const QPolygonF &polygon, QGraphicsItem *parent = 0) : QGraphicsPolygonItem(polygon, parent)
{
}
QVariant call_extension(QVariant const& variant) const
{ return SubQGraphicsPolygonItem::extension(variant); }
void call_setExtension(SubQGraphicsPolygonItem::Extension extension, QVariant const& variant)
{ return SubQGraphicsPolygonItem::setExtension((QGraphicsItem::Extension)extension, variant); }
bool call_supportsExtension(SubQGraphicsPolygonItem::Extension extension) const
{ return SubQGraphicsPolygonItem::supportsExtension((QGraphicsItem::Extension)extension); }
};
// This will be called before the first test function is executed.
// It is only called once.
void tst_QGraphicsPolygonItem::initTestCase()
{
}
// This will be called after the last test function is executed.
// It is only called once.
void tst_QGraphicsPolygonItem::cleanupTestCase()
{
}
// This will be called before each test function is executed.
void tst_QGraphicsPolygonItem::init()
{
}
// This will be called after every test function.
void tst_QGraphicsPolygonItem::cleanup()
{
}
void tst_QGraphicsPolygonItem::qgraphicspolygonitem_data()
{
}
void tst_QGraphicsPolygonItem::qgraphicspolygonitem()
{
SubQGraphicsPolygonItem item;
item.boundingRect();
item.contains(QPoint());
item.isObscuredBy(0);
item.opaqueArea();
//item.paint();
item.shape();
item.type();
item.call_extension(QVariant());
item.call_setExtension(SubQGraphicsPolygonItem::UserExtension, QVariant());
item.call_supportsExtension(SubQGraphicsPolygonItem::UserExtension);
item.fillRule();
item.polygon();
item.setFillRule(Qt::OddEvenFill);
item.setPolygon(QPolygonF());
}
void tst_QGraphicsPolygonItem::boundingRect_data()
{
QTest::addColumn<QPolygonF>("polygon");
QTest::addColumn<QRectF>("boundingRect");
QTest::newRow("null") << QPolygonF() << QRectF();
QPolygonF example;
example << QPointF(10.4, 20.5) << QPointF(20.2, 30.2);
QTest::newRow("example") << example << example.boundingRect();
// ### set pen width?
}
// public QRectF boundingRect() const
void tst_QGraphicsPolygonItem::boundingRect()
{
QFETCH(QPolygonF, polygon);
QFETCH(QRectF, boundingRect);
SubQGraphicsPolygonItem item(polygon);
item.setPen(QPen(Qt::black, 0));
QCOMPARE(item.boundingRect(), boundingRect);
}
void tst_QGraphicsPolygonItem::contains_data()
{
QTest::addColumn<QPolygonF>("polygon");
QTest::addColumn<QPointF>("point");
QTest::addColumn<bool>("contains");
QTest::newRow("null") << QPolygonF() << QPointF() << false;
}
// public bool contains(QPointF const& point) const
void tst_QGraphicsPolygonItem::contains()
{
QFETCH(QPolygonF, polygon);
QFETCH(QPointF, point);
QFETCH(bool, contains);
SubQGraphicsPolygonItem item(polygon);
QCOMPARE(item.contains(point), contains);
}
Q_DECLARE_METATYPE(Qt::FillRule)
void tst_QGraphicsPolygonItem::fillRule_data()
{
QTest::addColumn<QPolygonF>("polygon");
QTest::addColumn<Qt::FillRule>("fillRule");
QTest::newRow("OddEvenFill") << QPolygonF() << Qt::OddEvenFill;
QTest::newRow("WindingFill") << QPolygonF() << Qt::WindingFill;
}
// public Qt::FillRule fillRule() const
void tst_QGraphicsPolygonItem::fillRule()
{
QFETCH(QPolygonF, polygon);
QFETCH(Qt::FillRule, fillRule);
SubQGraphicsPolygonItem item(polygon);
item.setFillRule(fillRule);
QCOMPARE(item.fillRule(), fillRule);
// ### Check that the painting is different?
}
void tst_QGraphicsPolygonItem::isObscuredBy_data()
{
QTest::addColumn<QPolygonF>("polygon");
QTest::addColumn<QPolygonF>("otherPolygon");
QTest::addColumn<bool>("isObscuredBy");
QTest::newRow("null") << QPolygonF() << QPolygonF() << false;
//QTest::newRow("ontop-inside") << QPixmap(10, 10) << QPixmap(5, 5) << false;
//QTest::newRow("ontop-larger") << QPixmap(10, 10) << QPixmap(11, 11) << true;
}
// public bool isObscuredBy(QGraphicsItem const* item) const
void tst_QGraphicsPolygonItem::isObscuredBy()
{
QFETCH(QPolygonF, polygon);
QFETCH(QPolygonF, otherPolygon);
QFETCH(bool, isObscuredBy);
SubQGraphicsPolygonItem item(polygon);
SubQGraphicsPolygonItem otherItem(otherPolygon);
QCOMPARE(item.isObscuredBy(&otherItem), isObscuredBy);
}
Q_DECLARE_METATYPE(QPainterPath)
void tst_QGraphicsPolygonItem::opaqueArea_data()
{
QTest::addColumn<QPolygonF>("polygon");
QTest::addColumn<QPainterPath>("opaqueArea");
QTest::newRow("null") << QPolygonF() << QPainterPath();
// Currently QGraphicsPolygonItem just calls QGraphicsItem test there
}
// public QPainterPath opaqueArea() const
void tst_QGraphicsPolygonItem::opaqueArea()
{
QFETCH(QPolygonF, polygon);
QFETCH(QPainterPath, opaqueArea);
SubQGraphicsPolygonItem item(polygon);
QCOMPARE(item.opaqueArea(), opaqueArea);
}
void tst_QGraphicsPolygonItem::polygon_data()
{
QTest::addColumn<QPolygonF>("polygon");
QTest::newRow("null") << QPolygonF();
QPolygonF example;
example << QPointF(10.4, 20.5) << QPointF(20.2, 30.2);
QTest::newRow("example") << example;
}
// public QPolygonF polygon() const
void tst_QGraphicsPolygonItem::polygon()
{
QFETCH(QPolygonF, polygon);
SubQGraphicsPolygonItem item;
item.setPolygon(polygon);
QCOMPARE(item.polygon(), polygon);
}
void tst_QGraphicsPolygonItem::shape_data()
{
QTest::addColumn<QPainterPath>("shape");
QTest::newRow("null") << QPainterPath();
// ### what should a normal shape look like?
}
// public QPainterPath shape() const
void tst_QGraphicsPolygonItem::shape()
{
QFETCH(QPainterPath, shape);
SubQGraphicsPolygonItem item;
QCOMPARE(item.shape(), shape);
}
void tst_QGraphicsPolygonItem::extension_data()
{
QTest::addColumn<QVariant>("variant");
QTest::addColumn<QVariant>("extension");
QTest::newRow("null") << QVariant() << QVariant();
}
// protected QVariant extension(QVariant const& variant) const
void tst_QGraphicsPolygonItem::extension()
{
QFETCH(QVariant, variant);
QFETCH(QVariant, extension);
SubQGraphicsPolygonItem item;
QCOMPARE(item.call_extension(variant), extension);
}
Q_DECLARE_METATYPE(SubQGraphicsPolygonItem::Extension)
void tst_QGraphicsPolygonItem::setExtension_data()
{
QTest::addColumn<SubQGraphicsPolygonItem::Extension>("extension");
QTest::addColumn<QVariant>("variant");
QTest::newRow("null") << SubQGraphicsPolygonItem::Extension() << QVariant();
}
// protected void setExtension(SubQGraphicsPolygonItem::Extension extension, QVariant const& variant)
void tst_QGraphicsPolygonItem::setExtension()
{
QFETCH(SubQGraphicsPolygonItem::Extension, extension);
QFETCH(QVariant, variant);
SubQGraphicsPolygonItem item;
item.call_setExtension(extension, variant);
}
void tst_QGraphicsPolygonItem::supportsExtension_data()
{
QTest::addColumn<SubQGraphicsPolygonItem::Extension>("extension");
QTest::addColumn<bool>("supportsExtension");
QTest::newRow("null") << SubQGraphicsPolygonItem::Extension() << false;
}
// protected bool supportsExtension(SubQGraphicsPolygonItem::Extension extension) const
void tst_QGraphicsPolygonItem::supportsExtension()
{
QFETCH(SubQGraphicsPolygonItem::Extension, extension);
QFETCH(bool, supportsExtension);
SubQGraphicsPolygonItem item;
QCOMPARE(item.call_supportsExtension(extension), supportsExtension);
}
QTEST_MAIN(tst_QGraphicsPolygonItem)
#include "tst_qgraphicspolygonitem.moc"
| 30.055556
| 120
| 0.716704
|
power-electro
|
37749d961f01c43bf3172501e515b69ebf892a3c
| 2,808
|
cpp
|
C++
|
gddadrv/extrapi.cpp
|
SiZiOUS/wcegdda
|
3c003e2e3d9a7f128c87ebbba540ac247a02fd39
|
[
"MIT"
] | 4
|
2018-04-08T14:48:52.000Z
|
2020-03-10T19:55:02.000Z
|
gddadrv/extrapi.cpp
|
SiZiOUS/wcegdda
|
3c003e2e3d9a7f128c87ebbba540ac247a02fd39
|
[
"MIT"
] | null | null | null |
gddadrv/extrapi.cpp
|
SiZiOUS/wcegdda
|
3c003e2e3d9a7f128c87ebbba540ac247a02fd39
|
[
"MIT"
] | 2
|
2018-03-25T17:32:11.000Z
|
2018-08-23T15:41:10.000Z
|
#include "extrapi.hpp"
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function:
StrStr
Description:
Finds the first occurrence of a substring within a string.
The comparison is case sensitive.
Arguments:
LPCTSTR lpFirst - Address of the string being searched.
LPCTSTR lpSrch - Substring to search for.
Return Value:
Returns the address of the first occurrence of the matching substring
if successful, or NULL otherwise.
-------------------------------------------------------------------*/
// Thanks Techie Delight
// http://www.techiedelight.com/implement-strstr-function-c-iterative-recursive/
LPTSTR
StrStr( LPCTSTR lpFirst, LPCTSTR lpSrch )
{
size_t n = _tcslen( lpSrch );
while( *lpFirst )
{
if (!memcmp(lpFirst, lpSrch, n))
return const_cast <LPTSTR> (lpFirst);
lpFirst++;
}
return NULL;
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function:
StrCat
Description:
Appends one string to another.
Arguments:
PTSTR psz1 - A pointer to a null-terminated string. When this function returns
successfully, this string contains its original content with the
string psz2 appended. This buffer must be large enough to hold
both strings and the terminating null character.
PCTSTR psz2 - A pointer to a null-terminated string to be appended to psz1.
Return Value:
Returns a pointer to psz1, which holds the combined strings.
-------------------------------------------------------------------*/
PTSTR StrCat( PTSTR psz1, PCTSTR psz2 )
{
size_t nLength1 = _tcslen( psz1 );
size_t nLength2 = _tcslen( psz2 );
memcpy( psz1 + nLength1, psz2, nLength2 * sizeof(TCHAR) );
size_t nFinalLength = nLength1 + nLength2 + 1;
psz1[ nFinalLength ] = '\0';
return psz1;
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Function:
PathFileExists
Description:
Determines whether a path to a file system object such as a file or folder is valid.
This function is a rewrite of the PathFileExists from Shlwapi, which is not available
on Windows CE, at least for the Sega Dreamcast.
Arguments:
LPCTSTR pszPath - A pointer to a null-terminated string of maximum length
MAX_PATH that contains the full path of the object to verify.
Return Value:
true if the file exists; otherwise, false.
Call GetLastError for extended error information.
-------------------------------------------------------------------*/
BOOL
PathFileExists( LPCTSTR pszPath )
{
BOOL result = FALSE;
HANDLE hFile = CreateFile( pszPath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL );
result = (hFile == INVALID_HANDLE_VALUE);
if (!result)
{
CloseHandle( hFile );
}
return result;
}
| 22.464
| 99
| 0.605769
|
SiZiOUS
|
3779527e6930d3d8605ce0926ea65da5acf8ca8d
| 1,485
|
hpp
|
C++
|
include/eve/module/real/core/function/regular/simd/arm/neon/refine_rec.hpp
|
orao/eve
|
a8bdc6a9cab06d905e8749354cde63776ab76846
|
[
"MIT"
] | null | null | null |
include/eve/module/real/core/function/regular/simd/arm/neon/refine_rec.hpp
|
orao/eve
|
a8bdc6a9cab06d905e8749354cde63776ab76846
|
[
"MIT"
] | null | null | null |
include/eve/module/real/core/function/regular/simd/arm/neon/refine_rec.hpp
|
orao/eve
|
a8bdc6a9cab06d905e8749354cde63776ab76846
|
[
"MIT"
] | null | null | null |
//==================================================================================================
/**
EVE - Expressive Vector Engine
Copyright : EVE Contributors & Maintainers
SPDX-License-Identifier: MIT
**/
//==================================================================================================
#pragma once
#include <eve/concept/value.hpp>
#include <eve/detail/category.hpp>
#include <eve/detail/implementation.hpp>
namespace eve::detail
{
template<floating_real_scalar_value T, typename N, arm_abi ABI>
EVE_FORCEINLINE wide<T, N, ABI> refine_rec_(EVE_SUPPORTS(neon128_)
, wide<T, N, ABI> const& a0
, wide<T, N, ABI> const& a1) noexcept
{
constexpr auto cat = categorize<wide<T, N, ABI>>();
if constexpr( cat == category::float32x2) return vmul_f32(vrecps_f32(a0, a1), a1);
else if constexpr( cat == category::float32x4) return vmulq_f32(vrecpsq_f32(a0, a1), a1);
else if constexpr( current_api >= asimd)
{
if constexpr( cat == category::float64x1)
{
auto x = vmul_f64(vrecps_f64(a0, a1), a1);
return vmul_f64(vrecps_f64(a0, x), x);
}
else if constexpr( cat == category::float64x2)
{
auto x = vmulq_f64(vrecpsq_f64(a0, a1), a1);
return vmulq_f64(vrecpsq_f64(a0, x), x);
}
}
else return map(refine_rec_, a0, a1);
}
}
| 36.219512
| 100
| 0.506397
|
orao
|
37804293d66a8519f002ff1a111e65f7c9fbc8a2
| 9,345
|
cpp
|
C++
|
Graph.cpp
|
taniho0707/libmouse
|
a8ea7ac0a54d798d2010e594a7f60c5af6cbbf1d
|
[
"MIT"
] | null | null | null |
Graph.cpp
|
taniho0707/libmouse
|
a8ea7ac0a54d798d2010e594a7f60c5af6cbbf1d
|
[
"MIT"
] | null | null | null |
Graph.cpp
|
taniho0707/libmouse
|
a8ea7ac0a54d798d2010e594a7f60c5af6cbbf1d
|
[
"MIT"
] | null | null | null |
#include "Graph.h"
using namespace std;
Graph::Graph() :
WEIGHT_STRAIGHT(90),
WEIGHT_DIAGO(63)
{
nodes = new std::array<Node*, 1986>;
for (int i=0; i<(1984+2); ++i) {
nodes->at(i) = new Node(i);
}
resetCosts();
}
Graph::~Graph(){
for (int i=0; i<(1984+2); ++i) {
delete nodes->at(i);
}
delete nodes;
}
void Graph::resetCosts() {
dij_done &= 0;
dij_cost.fill(MAX);
}
/// @todo 範囲外アクセスしないようにあれこれする
uint16_t Graph::cnvCoordinateToNum(int16_t x, int16_t y, MazeAngle angle){
if (x == 0 && y == 0 && angle == MazeAngle::SOUTH) return 1984;
if (x > 31 || x < 0 || y > 31 || y < 0
|| (angle == MazeAngle::NORTH && y == 31)
|| (angle == MazeAngle::EAST && x == 31)
) {
return 1985;
}
if (x == 31 && angle == MazeAngle::NORTH) {
return (1953 + y);
} else if (x == 31 && angle == MazeAngle::SOUTH) {
return (1953 + y - 1);
}
uint16_t ret = 1985;
if (angle == MazeAngle::SOUTH) return cnvCoordinateToNum(x, y-1, MazeAngle::NORTH);
else if (angle == MazeAngle::WEST) return cnvCoordinateToNum(x-1, y, MazeAngle::EAST);
else if (angle == MazeAngle::NORTH) ret = 63*x + y*2 + 1;
else ret = 63*x + y*2;
if (ret >= 1985) ret = 1985;
return ret;
}
void Graph::cnvNumToCoordinate(uint16_t num, int16_t& x, int16_t& y, MazeAngle& angle){
if (num == 1984) {
x = 0; y = 0; angle = MazeAngle::SOUTH;
return;
} else if (num > 1984) {
x = 0; y = 0; angle = MazeAngle::SOUTH; /// @todo この返り値でいいの?
return;
} else if (num >= 1953) {
x = 31; y = num-1953; angle = MazeAngle::NORTH;
return;
}
x = num/63;
if ((num%63)%2 == 0) {
angle = MazeAngle::EAST;
y = (num%63)/2;
} else {
angle = MazeAngle::NORTH;
y = (num%63-1)/2;
}
}
void Graph::cnvNumToPosition(uint16_t num, float& x, float& y) {
/// @todo ハーフサイズにしか対応していない
if (num == 1984) {
x = 0.045f;
y = 0.0f;
return;
}
if (num >= 1985) {
x = 10.0f;
y = 10.0f;
return;
}
int16_t coor_x, coor_y;
MazeAngle coor_a;
cnvNumToCoordinate(num, coor_x, coor_y, coor_a);
if (coor_a == MazeAngle::NORTH) {
x = 0.09 * coor_x + 0.045;
y = 0.09 * (coor_y + 1);
} else { // coor_a == MazeAngle::EAST
x = 0.09 * (coor_x + 1);
y = 0.09 * coor_y + 0.045;
}
}
void Graph::connectNodes(const uint16_t node1, const uint16_t node2, const uint16_t weight){
if (node1 >= 1985 || node2 >= 1985) return;
nodes->at(node1)->pushTo(node2);
nodes->at(node1)->pushCost(weight);
nodes->at(node2)->pushTo(node1);
nodes->at(node2)->pushCost(weight);
}
void Graph::connectNodes(int16_t from_x, int16_t from_y, MazeAngle from_angle,
int16_t to_x, int16_t to_y, MazeAngle to_angle,
const uint16_t weight){
connectNodes(cnvCoordinateToNum(from_x, from_y, from_angle), cnvCoordinateToNum(to_x, to_y, to_angle), weight);
}
/// @todo 動作検証
void Graph::disconnectNodes(const uint16_t node1, const uint16_t node2){
for (int i=0; i<nodes->at(node1)->edges_to.size(); ++i) {
if (nodes->at(node1)->edges_to.at(i) == node2) {
nodes->at(node1)->edges_to.at(i) = MAX;
nodes->at(node1)->edges_cost.at(i) = MAX;
}
}
for (int i=0; i<nodes->at(node2)->edges_to.size(); ++i) {
if (nodes->at(node2)->edges_to.at(i) == node1) {
nodes->at(node2)->edges_to.at(i) = MAX;
nodes->at(node2)->edges_cost.at(i) = MAX;
}
}
}
void Graph::disconnectNodes(const uint16_t node1) {
int node2 = 1985;
for (int j=0; j<nodes->at(node1)->edges_to.size(); ++j) {
node2 = nodes->at(node1)->edges_to.at(j);
if (node2 == MAX) continue;
for (int i=0; i<nodes->at(node2)->edges_to.size(); ++i) {
if (nodes->at(node2)->edges_to.at(i) == node1) {
nodes->at(node2)->edges_to.at(i) = MAX;
nodes->at(node2)->edges_cost.at(i) = MAX;
}
}
}
nodes->at(node1)->edges_to.fill(MAX);
nodes->at(node1)->edges_cost.fill(MAX);
}
void Graph::disconnectNodesFromWalldata(int16_t x, int16_t y, MazeAngle a, Walldata wall) {
Walldata walldata = Walldata::rotateWallToAbsolute(wall, a);
if (walldata.isExistWall(MouseAngle::FRONT)) disconnectNodes(cnvCoordinateToNum(x, y, MazeAngle::NORTH));
if (walldata.isExistWall(MouseAngle::RIGHT)) disconnectNodes(cnvCoordinateToNum(x, y, MazeAngle::EAST));
if (walldata.isExistWall(MouseAngle::BACK)) disconnectNodes(cnvCoordinateToNum(x, y, MazeAngle::SOUTH));
if (walldata.isExistWall(MouseAngle::LEFT)) disconnectNodes(cnvCoordinateToNum(x, y, MazeAngle::WEST));
}
uint16_t Graph::getNextNodeStraight(uint16_t from, uint16_t current) {
int16_t s_from = static_cast<int16_t>(from);
int16_t s_current = static_cast<int16_t>(current);
int16_t s_ret;
int16_t dif = s_current - s_from;
int16_t from_x, from_y, current_x, current_y;
MazeAngle from_a, current_a;
cnvNumToCoordinate(from, from_x, from_y, from_a);
cnvNumToCoordinate(current, current_x, current_y, current_a);
if (abs(dif) == 62) {
dif = -1 * (dif/abs(dif));
} else if(abs(dif) == 64) {
dif = (dif/abs(dif));
} else if(abs(dif) == 1) {
if (from_x == current_x && from_y == current_y) {
dif = -62 * (dif/abs(dif));
} else {
dif = 64 * (dif/abs(dif));
}
}
if (from == 3 && current == 1) {
s_ret = 1984;
} else {
s_ret = s_current + dif;
}
if (s_ret < 0 || s_ret > 1984) {
s_ret = 1985;
}
return static_cast<uint16_t>(s_ret);
}
void Graph::connectWithMap(Map& map, bool enable_unwatched){
saved_map = map;
connectNodes(0, 0, MazeAngle::SOUTH, 0, 0, MazeAngle::NORTH, WEIGHT_STRAIGHT);
for (int i=0; i<32; ++i) {
for (int j=0; j<31; ++j) {
if (!map.isExistWall(i, j, MazeAngle::NORTH)) {
if ((!map.isExistWall(i, j+1, MazeAngle::EAST ))
&& (enable_unwatched || map.hasWatched(i, j+1, MazeAngle::EAST))
)
connectNodes(i, j+1, MazeAngle::SOUTH, i, j+1, MazeAngle::EAST, WEIGHT_DIAGO);
if ((!map.isExistWall(i, j+1, MazeAngle::NORTH))
&& (enable_unwatched || map.hasWatched(i, j+1, MazeAngle::NORTH))
)
connectNodes(i, j+1, MazeAngle::SOUTH, i, j+1, MazeAngle::NORTH, WEIGHT_STRAIGHT);
if ((!map.isExistWall(i, j+1, MazeAngle::WEST ))
&& (enable_unwatched || map.hasWatched(i, j+1, MazeAngle::WEST))
)
connectNodes(i, j+1, MazeAngle::SOUTH, i, j+1, MazeAngle::WEST, WEIGHT_DIAGO);
if ((!map.isExistWall(i, j, MazeAngle::EAST ))
&& (enable_unwatched || map.hasWatched(i, j , MazeAngle::EAST))
)
connectNodes(i, j+1, MazeAngle::SOUTH, i, j, MazeAngle::EAST, WEIGHT_DIAGO);
if ((!map.isExistWall(i, j, MazeAngle::WEST ))
&& (enable_unwatched || map.hasWatched(i, j , MazeAngle::WEST))
)
connectNodes(i, j+1, MazeAngle::SOUTH, i, j, MazeAngle::WEST, WEIGHT_DIAGO);
}
}
}
for (int i=0; i<30; ++i) {
for (int j=0; j<32; ++j) {
if (!map.isExistWall(i, j, MazeAngle::EAST)) {
if ((!map.isExistWall(i+1, j, MazeAngle::EAST))
&& (enable_unwatched || map.hasWatched(i+1, j, MazeAngle::EAST))
)
connectNodes(i, j, MazeAngle::EAST, i+1, j, MazeAngle::EAST, WEIGHT_STRAIGHT);
}
}
}
}
Footmap Graph::cnvGraphToFootmap(const vector<uint16_t>& graph){
Path path;
int16_t x = 0;
int16_t y = 0;
MazeAngle a = MazeAngle::EAST;
Footmap fm;
for (int i=graph.size()-1; i>=0; --i) {
if (dij_cost.at(graph.at(i)) != 0){
Graph::cnvNumToCoordinate(graph.at(i), x, y, a);
if (a == MazeAngle::EAST) {
fm.setFootmap(x, y, 0);
fm.setFootmap(x+1, y, 0);
} else { // NORTH
fm.setFootmap(x, y, 0);
fm.setFootmap(x, y+1, 0);
}
}
}
x=4; y=4;
for (int i=0; i<1024; ++i) {
/// @todo ゴール座標は4か9マス
fm.setFootmap(x, y, i);
if (x == 0 && y == 0) break;
if (fm.getFootmap(x-1, y, 1024) == 0 && ((x-1) != 5 || y != 5)){
x -= 1;
} else if (fm.getFootmap(x+1, y, 1024) == 0 && ((x+1) != 5 || y != 5)){
x += 1;
} else if (fm.getFootmap(x, y-1, 1024) == 0 && (x != 5 || (y-1) != 5)){
y -= 1;
} else if (fm.getFootmap(x, y+1, 1024) == 0 && (x != 5 || (y+1) != 5)){
y += 1;
}
}
return fm;
}
vector<uint16_t> Graph::dijkstra(uint16_t start, uint16_t end){
auto comparator = [this](Node* left, Node* right){
return dij_cost.at(left->num) > dij_cost.at(right->num);
};
priority_queue<Node*, vector<Node*>, decltype(comparator) > q(comparator);
resetCosts();
dij_cost.at(start) = 0;
q.push(nodes->at(start));
while (!q.empty()) {
Node* node_done = q.top(); q.pop();
if (dij_done.test(node_done->num)) continue;
dij_done.set(node_done->num);
for (uint16_t i=0; i<node_done->edges_to.size(); ++i) {
if (node_done->edges_to.at(i) == Node::MAX) continue;
uint16_t from = node_done->num;
uint16_t to = node_done->edges_to.at(i);
uint16_t cost = node_done->edges_cost.at(i) + dij_cost.at(from);
while (true) {
if (cost < dij_cost.at(to)) {
dij_cost.at(to) = cost;
nodes->at(to)->from = from;
q.push(nodes->at(to));
}
if (!nodes->at(to)->isConnected(getNextNodeStraight(from, nodes->at(to)->num))) {
break;
} else {
Node* node_next = nodes->at(to);
to = getNextNodeStraight(from, nodes->at(to)->num);
cost = node_done->edges_cost.at(i) + dij_cost.at(node_next->num) - 10; /// @todo 適当な値を減算しているけど適当すぎてポ!!!
from = node_next->num;
}
}
}
}
vector<uint16_t> ret;
Node* node_ret;
node_ret = nodes->at(end);
if (dij_cost.at(node_ret->num) != MAX) {
int i=0;
while(dij_cost.at(node_ret->num) != 0 && i++ < 300) { /// @todo 300はてきとう
ret.push_back(node_ret->num);
node_ret = nodes->at(node_ret->from);
}
}
return ret;
}
| 29.021739
| 112
| 0.617335
|
taniho0707
|
3782003357d5a0d68c01be2606319991802725a7
| 3,288
|
hpp
|
C++
|
src/configure/lua/Type.hpp
|
hotgloupi/configure
|
888cf725c93df5a1cf01794cc0a581586a82855c
|
[
"BSD-3-Clause"
] | 1
|
2015-11-13T10:37:35.000Z
|
2015-11-13T10:37:35.000Z
|
src/configure/lua/Type.hpp
|
hotgloupi/configure
|
888cf725c93df5a1cf01794cc0a581586a82855c
|
[
"BSD-3-Clause"
] | 19
|
2015-02-10T17:18:58.000Z
|
2015-07-11T11:31:08.000Z
|
src/configure/lua/Type.hpp
|
hotgloupi/configure
|
888cf725c93df5a1cf01794cc0a581586a82855c
|
[
"BSD-3-Clause"
] | null | null | null |
#pragma once
#include "State.hpp"
#include "store_exception.hpp"
#include <configure/error.hpp>
#include <boost/units/detail/utility.hpp>
#include <functional>
namespace configure { namespace lua {
namespace convert {
template<typename T>
inline T& to_ref(T& value) { return value; }
template<typename T>
inline T& to_ref(std::shared_ptr<T>& value) { return *value.get(); }
template<typename T>
inline T& to_ref(std::reference_wrapper<T>& value) { return value.get(); }
}
namespace return_policy {
struct copy {
template<typename T>
struct get {
typedef typename std::remove_cv<
typename std::remove_reference<T>::type
>::type type;
};
};
struct ref {
template<typename T>
struct get {
typedef typename std::reference_wrapper<
typename copy::get<T>::type
> type;
};
};
}
template<
typename T
, typename Storage = T
>
struct Type
{
private:
State* _state;
public:
explicit Type(State& state, std::string const& name = "")
: _state(&state)
{
_state->push_metatable<Storage>(name);
_state->push("__index");
_state->pushvalue(-2);
_state->settable(-3);
}
Type(Type const&) = delete;
Type(Type&& other)
: _state(other._state)
{ other._state = nullptr; }
~Type() { if (_state != nullptr) _state->pop(); }
public:
template<typename ReturnPolicy = return_policy::copy, typename Ret, typename... Args>
Type& def(char const* name,
Ret (T::*method)(Args...))
{
typedef typename ReturnPolicy::template get<Ret>::type return_type;
_state->push(name);
_state->push_callable(
std::function<return_type(Storage&, Args...)>(
[method](Storage& self, Args&&... args) -> Ret {
return (convert::to_ref(self).*method)(std::forward<Args>(args)...);
}
)
);
_state->settable(-3);
return *this;
}
template<typename ReturnPolicy = return_policy::copy, typename Ret, typename... Args>
Type& def(char const* name,
Ret (T::*method)(Args...) const)
{
typedef typename ReturnPolicy::template get<Ret>::type return_type;
_state->push(name);
_state->push_callable(
std::function<return_type(Storage&, Args...)>(
[method](Storage& self, Args&&... args) -> Ret {
return (convert::to_ref(self).*method)(std::forward<Args>(args)...);
}
)
);
_state->settable(-3);
return *this;
}
typedef int (*raw_signature)(lua_State*);
Type& def(char const* name, raw_signature fn)
{
_state->push(name);
lua_pushlightuserdata(_state->ptr(), (void*)fn);
_state->push(name);
lua_pushcclosure(_state->ptr(), &_call_raw, 2);
_state->settable(-3);
return *this;
}
private:
static std::string type_name()
{ return boost::units::detail::demangle(typeid(T).name()); }
static std::string method_name(char const* name)
{ return type_name() + "::" + name + "()"; }
static int _call_raw(lua_State* state)
{
void* fn_ptr = lua_touserdata(state, lua_upvalueindex(1));
char const* name = lua_tostring(state, lua_upvalueindex(2));
if (raw_signature fn = (raw_signature) fn_ptr)
{
return store_exception<int>(
state,
[&] { return fn(state); },
[&] { return method_name(name); }
);
}
std::abort();
}
};
}}
| 22.675862
| 87
| 0.630474
|
hotgloupi
|
37889071201521bff9d3155ea996b928e481dd1e
| 511
|
cpp
|
C++
|
src/s2mJointIntraBone.cpp
|
CamWilhelm/biorbd
|
67d36e77d90cc09aa748c3acf2c2bdff5065d3c9
|
[
"MIT"
] | null | null | null |
src/s2mJointIntraBone.cpp
|
CamWilhelm/biorbd
|
67d36e77d90cc09aa748c3acf2c2bdff5065d3c9
|
[
"MIT"
] | null | null | null |
src/s2mJointIntraBone.cpp
|
CamWilhelm/biorbd
|
67d36e77d90cc09aa748c3acf2c2bdff5065d3c9
|
[
"MIT"
] | null | null | null |
#define BIORBD_API_EXPORTS
#include "../include/s2mJointIntraBone.h"
s2mJointIntraBone::s2mJointIntraBone() :
Joint() {
setType();
//ctor
}
s2mJointIntraBone::s2mJointIntraBone(RigidBodyDynamics::JointType joint_type) :
Joint(joint_type){
setType();
}
s2mJointIntraBone::s2mJointIntraBone(RigidBodyDynamics::JointType joint_type, RigidBodyDynamics::Math::Vector3d axis) :
Joint(joint_type, axis){
setType();
}
s2mJointIntraBone::~s2mJointIntraBone()
{
//dtor
}
| 23.227273
| 119
| 0.714286
|
CamWilhelm
|
378996174b6f92cff6b5a2057a01377928d7b9c4
| 1,542
|
hpp
|
C++
|
test/node-gdal-async/src/utils/warp_options.hpp
|
mmomtchev/yatag
|
37802e760a33939b65ceaa4379634529d0dc0092
|
[
"0BSD"
] | 42
|
2021-03-26T17:34:52.000Z
|
2022-03-18T14:15:31.000Z
|
test/node-gdal-async/src/utils/warp_options.hpp
|
mmomtchev/yatag
|
37802e760a33939b65ceaa4379634529d0dc0092
|
[
"0BSD"
] | 29
|
2021-06-03T14:24:01.000Z
|
2022-03-23T15:43:58.000Z
|
test/node-gdal-async/src/utils/warp_options.hpp
|
mmomtchev/yatag
|
37802e760a33939b65ceaa4379634529d0dc0092
|
[
"0BSD"
] | 8
|
2021-05-14T19:26:37.000Z
|
2022-03-21T13:44:42.000Z
|
#ifndef __WARP_OPTIONS_H__
#define __WARP_OPTIONS_H__
// node
#include <node.h>
// nan
#include "../nan-wrapper.h"
// gdal
#include <gdal_priv.h>
#include <gdalwarper.h>
#include "../gdal_dataset.hpp"
#include "number_list.hpp"
#include "string_list.hpp"
using namespace v8;
namespace node_gdal {
// A class for parsing a V8::Value and constructing a GDALWarpOptions struct
//
// see: https://www.gdal.org/doxygen/structGDALWarpOptions.html
//
// {
// options : string[] | object
// memoryLimit : int
// resampleAlg : string
// src: Dataset
// dst: Dataset
// srcBands: int | int[]
// dstBands: int | int[]
// nBands: int
// srcAlphaBand: int
// dstAlphaBand: int
// srcNoData: double
// dstNoData: double
// cutline: geometry
// blend: double
// }
class WarpOptions {
public:
int parse(Local<Value> value);
int parseResamplingAlg(Local<Value> value);
WarpOptions();
~WarpOptions();
inline GDALWarpOptions *get() {
return options;
}
inline bool useMultithreading() {
return multi;
}
inline std::vector<Local<Object>> datasetObjects() {
return {src_obj, dst_obj};
}
inline std::vector<long> datasetUids() {
return {src ? src->uid : 0, dst ? dst->uid : 0};
}
private:
GDALWarpOptions *options;
Local<Object> src_obj;
Local<Object> dst_obj;
Dataset *src;
Dataset *dst;
StringList additional_options;
IntegerList src_bands;
IntegerList dst_bands;
double *src_nodata;
double *dst_nodata;
bool multi;
};
} // namespace node_gdal
#endif
| 18.804878
| 76
| 0.672503
|
mmomtchev
|
378dec74cbc6fe09bcd5fdb39d8363a5d569ee54
| 18,593
|
cpp
|
C++
|
Extern/mssdk_dx7/samples/Multimedia/DPlay/src/DPSlots/client.cpp
|
Ybalrid/orbiter
|
7bed82f845ea8347f238011367e07007b0a24099
|
[
"MIT"
] | 1,040
|
2021-07-27T12:12:06.000Z
|
2021-08-02T14:24:49.000Z
|
Extern/mssdk_dx7/samples/Multimedia/DPlay/src/DPSlots/client.cpp
|
Ybalrid/orbiter
|
7bed82f845ea8347f238011367e07007b0a24099
|
[
"MIT"
] | 20
|
2021-07-27T12:25:22.000Z
|
2021-08-02T12:22:19.000Z
|
Extern/mssdk_dx7/samples/Multimedia/DPlay/src/DPSlots/client.cpp
|
Ybalrid/orbiter
|
7bed82f845ea8347f238011367e07007b0a24099
|
[
"MIT"
] | 71
|
2021-07-27T14:19:49.000Z
|
2021-08-02T05:51:52.000Z
|
//-----------------------------------------------------------------------------
// File: Client.cpp
//
// Desc: Slot machine client DirectPlay.
//
// Copyright (C) 1996-1999 Microsoft Corporation. All Rights Reserved.
//-----------------------------------------------------------------------------
#include <windows.h>
#include <windowsx.h>
#include <mmsystem.h>
#include <stdio.h>
#include "dpslots.h"
#include "resource.h"
//-----------------------------------------------------------------------------
// Globals
//-----------------------------------------------------------------------------
const DWORD SLOTWIDTH = 110; // Width of slot
const DWORD SLOTHEIGHT = 119; // Height of slot
const DWORD SLOTBORDER = 9; // Space between slots
const DWORD REVSPERSECOND = 1; // # revolutions per second
const DWORD PIXELSPERSLOT = SLOTHEIGHT - SLOTBORDER; // Dimensions
const DWORD PIXELSPERREV = PIXELSPERSLOT * SLOTSPERWHEEL; // Rate
const DWORD PIXELSPERSECOND = PIXELSPERREV * REVSPERSECOND; // Rate
const UINT TIMERID = 1; // Timer ID to use
const UINT TIMERINTERVAL = 50; // Timer interval
const UINT MAXSTRING = 200; // Max size of a string
// Window messages
const UINT WM_USER_UPDATEBALANCE = WM_USER + BALANCERESPONSE;
const UINT WM_USER_STARTSPINNING = WM_USER + SPINRESPONSE;
// Main window
HWND g_hwndClient = NULL;
// WHEELINFO struct for data on the slot machine wheel
struct WHEELINFO
{
DWORD dwIndex; // Index of wheel slot to show
DWORD dwStartTicks; // Time wheel started spinning
DWORD dwDuration; // Duration wheel should spin
};
//-----------------------------------------------------------------------------
// Function prototypes
//-----------------------------------------------------------------------------
HRESULT SendBalanceRequest( DPLAYINFO* pDPInfo );
HRESULT SendSpinRequest( DPLAYINFO* pDPInfo, DWORD dwAmountBet );
VOID DrawWheels( WHEELINFO* pWheels, HBITMAP hWheelBitmap, HDC hDC,
RECT* prcBounds );
VOID StartSpinning( WHEELINFO* pWheels );
BOOL SpinWheels( HWND hWnd, WHEELINFO* pWheels, HBITMAP hWheelBitmap );
//-----------------------------------------------------------------------------
// Name: ClientWndProc()
// Desc:
//-----------------------------------------------------------------------------
BOOL CALLBACK ClientWndProc( HWND hWnd, UINT uMsg, WPARAM wParam,
LPARAM lParam )
{
static DPLAYINFO* pDPInfo = NULL;
static UINT idTimer = 0;
static HBITMAP hWheelBitmap = NULL;
static WHEELINFO WheelInfo[NUMWHEELS];
static MSG_SPINRESPONSE SpinResponse;
CHAR strStr[MAXSTRING];
DWORD i;
DWORD dwAmountBet;
switch(uMsg)
{
case WM_INITDIALOG:
// save the connection info pointer
pDPInfo = (DPLAYINFO*)lParam;
// store global window
g_hwndClient = hWnd;
// get slots bitmap
hWheelBitmap = LoadBitmap(ghInstance, MAKEINTRESOURCE(IDB_SLOTSBITMAP));
// initialize slots
for (i = 0; i < NUMWHEELS; i++)
WheelInfo[i].dwIndex = ((DWORD)rand()) % SLOTSPERWHEEL;
// get starting balance
SendBalanceRequest(pDPInfo);
break;
case WM_DESTROY:
// stop the timer
if (idTimer)
{
KillTimer(hWnd, idTimer);
idTimer = 0;
}
// free the bitmap handle
if (hWheelBitmap)
{
DeleteObject(hWheelBitmap);
hWheelBitmap = NULL;
}
g_hwndClient = NULL;
break;
case WM_USER_UPDATEBALANCE:
// balance is in lParam
sprintf( strStr, "$%4d", lParam);
// display new balance
SetDlgItemText(hWnd, IDC_EDIT_BALANCE, strStr );
break;
case WM_USER_STARTSPINNING:
// copy spin response message from lParam
SpinResponse = *((MSG_SPINRESPONSE*)lParam);
GlobalFreePtr( (VOID*)lParam ); // free memory
// check for valid spin
if FAILED(SpinResponse.hr)
{
SetDlgItemText(hWnd, IDC_RESULTEDIT, "You don't have enough money!");
}
else
{
// copy slot settings specified by server
for (i = 0; i < NUMWHEELS; i++)
WheelInfo[i].dwIndex = SpinResponse.dwIndex[i];
// clear win or lose
SetDlgItemText(hWnd, IDC_RESULTEDIT, "");
// start things spinning
StartSpinning(WheelInfo);
idTimer = SetTimer(hWnd, TIMERID, TIMERINTERVAL, NULL);
// disable spin button while spinning
EnableDlgButton(hWnd, IDC_SPINBUTTON, FALSE);
}
break;
case WM_TIMER:
// readraw any spinning wheels
if (!SpinWheels(hWnd, WheelInfo, hWheelBitmap))
{
KillTimer(hWnd, idTimer);
idTimer = 0;
// display amount won or lost
if (SpinResponse.dwAmountWonOrLost > 0)
{
sprintf(strStr,"You win $%d!", SpinResponse.dwAmountWonOrLost);
PlaySound(MAKEINTRESOURCE(IDR_WINWAVE), ghInstance, SND_ASYNC | SND_RESOURCE);
}
else if (SpinResponse.dwAmountWonOrLost < 0)
{
sprintf(strStr,"You lose $%d!", -SpinResponse.dwAmountWonOrLost);
PlaySound(MAKEINTRESOURCE(IDR_LOSEWAVE), ghInstance, SND_ASYNC | SND_RESOURCE);
}
else
{
strcpy(strStr, "");
}
// display win or loss
SetDlgItemText( hWnd, IDC_RESULTEDIT, strStr );
PostMessage( hWnd, WM_USER_UPDATEBALANCE, 0, (LPARAM)SpinResponse.dwBalance );
// enable spin button again
EnableDlgButton( hWnd, IDC_SPINBUTTON, TRUE );
}
break;
case WM_DRAWITEM:
{
DRAWITEMSTRUCT *diInfo;
diInfo = (DRAWITEMSTRUCT *) lParam;
switch (diInfo->CtlID)
{
case IDC_SLOTS:
if (diInfo->itemAction == ODA_DRAWENTIRE)
{
DrawWheels(WheelInfo, hWheelBitmap, diInfo->hDC, &diInfo->rcItem);
}
break;
}
}
break;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_SPINBUTTON:
// find out how much was bet
dwAmountBet = 0;
// one dollar
if (DlgItemIsChecked(hWnd, IDC_BET1CHECK))
dwAmountBet += 1;
// five dollars
if (DlgItemIsChecked(hWnd, IDC_BET2CHECK))
dwAmountBet += 5;
// ten dollars
if (DlgItemIsChecked(hWnd, IDC_BET3CHECK))
dwAmountBet += 10;
// ask server for results of spin using this bet
SendSpinRequest(pDPInfo, dwAmountBet);
break;
case IDCANCEL:
EndDialog(hWnd, FALSE);
break;
}
break;
}
// Allow for default processing
return FALSE;
}
//-----------------------------------------------------------------------------
// Name: ClientApplicationMessage()
// Desc:
//-----------------------------------------------------------------------------
VOID ClientApplicationMessage( DPLAYINFO* pDPInfo, DPMSG_GENERIC* pMsg,
DWORD dwMsgSize, DPID idFrom, DPID idTo )
{
switch( pMsg->dwType )
{
case BALANCERESPONSE:
{
MSG_BALANCERESPONSE* pBalance = (MSG_BALANCERESPONSE*)pMsg;
PostMessage( g_hwndClient, WM_USER_UPDATEBALANCE, 0,
pBalance->dwBalance );
break;
}
case SPINRESPONSE:
{
MSG_SPINRESPONSE* pSpin = (MSG_SPINRESPONSE*)pMsg;
MSG_SPINRESPONSE* pSpinCopy;
// make a copy of the message so we can pass it to the wndproc
pSpinCopy = (MSG_SPINRESPONSE*)GlobalAllocPtr(GHND, sizeof(MSG_SPINRESPONSE));
if( pSpinCopy == NULL )
break;
*pSpinCopy = *pSpin;
PostMessage( g_hwndClient, WM_USER_STARTSPINNING, 0,
(LPARAM)pSpinCopy );
break;
}
}
}
//-----------------------------------------------------------------------------
// Name: ClientSystemMessage()
// Desc:
//-----------------------------------------------------------------------------
VOID ClientSystemMessage( DPLAYINFO* pDPInfo, DPMSG_GENERIC* pMsg,
DWORD dwMsgSize, DPID idFrom, DPID idTo )
{
// The body of each case is there so you can set a breakpoint and examine
// the contents of the message received.
switch( pMsg->dwType )
{
case DPSYS_CREATEPLAYERORGROUP:
{
DPMSG_CREATEPLAYERORGROUP* p = (DPMSG_CREATEPLAYERORGROUP*)pMsg;
break;
}
case DPSYS_DESTROYPLAYERORGROUP:
{
DPMSG_DESTROYPLAYERORGROUP* p = (DPMSG_DESTROYPLAYERORGROUP*)pMsg;
break;
}
case DPSYS_ADDPLAYERTOGROUP:
{
DPMSG_ADDPLAYERTOGROUP* p = (DPMSG_ADDPLAYERTOGROUP*)pMsg;
break;
}
case DPSYS_DELETEPLAYERFROMGROUP:
{
DPMSG_DELETEPLAYERFROMGROUP* p = (DPMSG_DELETEPLAYERFROMGROUP*)pMsg;
break;
}
case DPSYS_SESSIONLOST:
{
DPMSG_SESSIONLOST* p = (DPMSG_SESSIONLOST*)pMsg;
break;
}
case DPSYS_HOST:
{
DPMSG_HOST* p = (DPMSG_HOST*)pMsg;
break;
}
case DPSYS_SETPLAYERORGROUPDATA:
{
DPMSG_SETPLAYERORGROUPDATA* p = (DPMSG_SETPLAYERORGROUPDATA*)pMsg;
break;
}
case DPSYS_SETPLAYERORGROUPNAME:
{
DPMSG_SETPLAYERORGROUPNAME* p = (DPMSG_SETPLAYERORGROUPNAME*)pMsg;
break;
}
case DPSYS_SECUREMESSAGE:
{
DPMSG_SECUREMESSAGE* p = (DPMSG_SECUREMESSAGE*)pMsg;
ClientApplicationMessage( pDPInfo, (DPMSG_GENERIC*)p->lpData,
p->dwDataSize, p->dpIdFrom, idTo );
break;
}
}
}
//-----------------------------------------------------------------------------
// Name: SendBalanceRequest()
// Desc:
//-----------------------------------------------------------------------------
HRESULT SendBalanceRequest( DPLAYINFO* pDPInfo )
{
MSG_BALANCEREQUEST Msg;
ZeroMemory(&Msg, sizeof(MSG_BALANCEREQUEST));
Msg.dwType = BALANCEREQUEST;
return pDPInfo->pDPlay->Send( pDPInfo->dpidPlayer,
DPID_SERVERPLAYER,
SENDFLAGS(pDPInfo->bIsSecure),
&Msg, sizeof(MSG_BALANCEREQUEST) );
}
//-----------------------------------------------------------------------------
// Name: SendSpinRequest()
// Desc:
//-----------------------------------------------------------------------------
HRESULT SendSpinRequest( DPLAYINFO* pDPInfo, DWORD dwAmountBet )
{
MSG_SPINREQUEST Msg;
ZeroMemory(&Msg, sizeof(MSG_SPINREQUEST));
Msg.dwType = SPINREQUEST;
Msg.dwAmountBet = dwAmountBet;
return pDPInfo->pDPlay->Send( pDPInfo->dpidPlayer,
DPID_SERVERPLAYER,
SENDFLAGS(pDPInfo->bIsSecure),
&Msg, sizeof(MSG_SPINREQUEST) );
}
#define RECTWIDTH(lpRect) ((lpRect)->right - (lpRect)->left)
#define RECTHEIGHT(lpRect) ((lpRect)->bottom - (lpRect)->top)
//-----------------------------------------------------------------------------
// Name: PaintBitmap()
// Desc:
//-----------------------------------------------------------------------------
BOOL PaintBitmap( HDC hDC, RECT* pDCRect, HBITMAP hDDB, RECT* pDDBRect )
{
HDC hMemDC; // Handle to memory DC
HBITMAP hOldBitmap; // Handle to previous bitmap
BOOL bSuccess = FALSE; // Success/fail flag
// Create a memory DC
hMemDC = CreateCompatibleDC( hDC );
if( !hMemDC )
return FALSE;
// Select bitmap into the memory DC
hOldBitmap = (HBITMAP)SelectObject( hMemDC, hDDB );
// Make sure to use the stretching mode best for color pictures
SetStretchBltMode( hDC, COLORONCOLOR );
// Determine whether to call StretchBlt() or BitBlt()
if( ( RECTWIDTH(pDCRect) == RECTWIDTH(pDDBRect) ) &&
( RECTHEIGHT(pDCRect) == RECTHEIGHT(pDDBRect) ) )
bSuccess = BitBlt( hDC, pDCRect->left, pDCRect->top,
pDCRect->right - pDCRect->left,
pDCRect->bottom - pDCRect->top, hMemDC,
pDDBRect->left, pDDBRect->top, SRCCOPY );
else
bSuccess = StretchBlt( hDC, pDCRect->left, pDCRect->top,
pDCRect->right - pDCRect->left,
pDCRect->bottom - pDCRect->top, hMemDC,
pDDBRect->left, pDDBRect->top,
pDDBRect->right - pDDBRect->left,
pDDBRect->bottom - pDDBRect->top, SRCCOPY );
// Clean up
SelectObject( hMemDC, hOldBitmap );
DeleteDC( hMemDC );
return bSuccess;
}
//-----------------------------------------------------------------------------
// Name: DrawWheels()
// Desc:
//-----------------------------------------------------------------------------
VOID DrawWheels( WHEELINFO* pWheels, HBITMAP hWheelBitmap, HDC hDC,
RECT* pBoundsRect )
{
if( hWheelBitmap == NULL )
return;
RECT rectDC, rectSlot;
DWORD dwWidth = pBoundsRect->right - pBoundsRect->left;
DWORD dwHeight = pBoundsRect->bottom - pBoundsRect->top;
DWORD dwXOffset = (dwWidth - (SLOTWIDTH * NUMWHEELS)) / (NUMWHEELS + 1);
DWORD dwYOffset = (dwHeight - SLOTHEIGHT) / 2;
SetRect( &rectDC, dwXOffset, dwYOffset,
dwXOffset + SLOTWIDTH, dwYOffset + SLOTHEIGHT );
for( DWORD i = 0; i < NUMWHEELS; i++ )
{
SetRect( &rectSlot, 0, 0, SLOTWIDTH, SLOTHEIGHT );
OffsetRect( &rectSlot, 0, pWheels[i].dwIndex * PIXELSPERSLOT );
PaintBitmap( hDC, &rectDC, hWheelBitmap, &rectSlot );
OffsetRect( &rectDC, SLOTWIDTH + dwXOffset, 0 );
}
}
//-----------------------------------------------------------------------------
// Name: StartSpinning()
// Desc:
//-----------------------------------------------------------------------------
VOID StartSpinning( WHEELINFO* lpWheels )
{
DWORD i;
for (i = 0; i < NUMWHEELS; i++)
{
lpWheels[i].dwStartTicks = GetTickCount();
lpWheels[i].dwStartTicks -= lpWheels[i].dwIndex * PIXELSPERSLOT * 1000 / PIXELSPERREV;
lpWheels[i].dwDuration = 1000 * (i + 1) + 1000;
}
}
//-----------------------------------------------------------------------------
// Name: SpinWheels()
// Desc:
//-----------------------------------------------------------------------------
BOOL SpinWheels( HWND hWnd, WHEELINFO* pWheels, HBITMAP hWheelBitmap )
{
HDC hDC;
RECT rectBounds;
RECT rectDC, rectSlot;
DWORD dwTicks, dwStoppedCount;
if( hWheelBitmap == NULL )
return (FALSE);
hDC = GetWindowDC( GetDlgItem( hWnd, IDC_SLOTS ) );
if( hDC == NULL )
return FALSE;
if( !GetWindowRect( GetDlgItem( hWnd, IDC_SLOTS ), &rectBounds ) )
return FALSE;
RECT* pBoundsRect = &rectBounds;
DWORD dwWidth = pBoundsRect->right - pBoundsRect->left;
DWORD dwHeight = pBoundsRect->bottom - pBoundsRect->top;
DWORD dwXOffset = (dwWidth - (SLOTWIDTH * NUMWHEELS)) / (NUMWHEELS + 1);
DWORD dwYOffset = (dwHeight - SLOTHEIGHT) / 2;
DWORD dwYStart;
SetRect( &rectDC, dwXOffset, dwYOffset,
dwXOffset + SLOTWIDTH, dwYOffset + SLOTHEIGHT );
dwStoppedCount = 0;
for( DWORD i = 0; i < NUMWHEELS; i++ )
{
if( pWheels[i].dwDuration == 0 )
{
dwStoppedCount++;
}
else
{
dwTicks = GetTickCount() - pWheels[i].dwStartTicks;
dwYStart = (dwTicks * PIXELSPERSECOND) / 1000;
dwYStart %= PIXELSPERREV;
if( dwTicks >= pWheels[i].dwDuration )
{
// pWheels[i].value = ((dwYStart + (PIXELSPERSLOT - 1)) / PIXELSPERSLOT) % SLOTSPERWHEEL;
SetRect( &rectSlot, 0, 0, SLOTWIDTH, SLOTHEIGHT );
OffsetRect( &rectSlot, 0, pWheels[i].dwIndex * PIXELSPERSLOT );
PaintBitmap( hDC, &rectDC, hWheelBitmap, &rectSlot );
pWheels[i].dwDuration = 0;
if( dwStoppedCount == (NUMWHEELS - 1) )
PlaySound( MAKEINTRESOURCE(IDR_STOPWAVE), ghInstance, SND_RESOURCE );
else
PlaySound( MAKEINTRESOURCE(IDR_STOPWAVE), ghInstance, SND_ASYNC | SND_RESOURCE );
}
else
{
SetRect( &rectSlot, 0, 0, SLOTWIDTH, SLOTHEIGHT );
OffsetRect( &rectSlot, 0, dwYStart );
if( rectSlot.bottom > PIXELSPERREV )
{
RECT rectSlotTmp, rectDCTmp;
DWORD height;
// copy from bottom end of bitmap
height = PIXELSPERREV - rectSlot.top;
rectSlotTmp = rectSlot;
rectSlotTmp.bottom = rectSlotTmp.top + height;
rectDCTmp = rectDC;
rectDCTmp.bottom = rectDCTmp.top + height;
PaintBitmap( hDC, &rectDCTmp, hWheelBitmap, &rectSlotTmp );
height = rectSlot.bottom - PIXELSPERREV;
rectSlotTmp = rectSlot;
rectSlotTmp.top = 0;
rectSlotTmp.bottom = height;
rectDCTmp = rectDC;
rectDCTmp.top = rectDCTmp.bottom - height;
PaintBitmap( hDC, &rectDCTmp, hWheelBitmap, &rectSlotTmp );
}
else
PaintBitmap( hDC, &rectDC, hWheelBitmap, &rectSlot );
}
}
OffsetRect( &rectDC, SLOTWIDTH + dwXOffset, 0 );
}
return( dwStoppedCount != NUMWHEELS );
}
| 31.248739
| 102
| 0.500834
|
Ybalrid
|
378df4622128c9a616d54f2f47b4ba413121e0c7
| 9,065
|
cpp
|
C++
|
dsp++/src/arch/x86/sse.cpp
|
andrzejc/dsp-
|
fd39d2395a37ade36e3b551d261de0177b78296b
|
[
"MIT"
] | null | null | null |
dsp++/src/arch/x86/sse.cpp
|
andrzejc/dsp-
|
fd39d2395a37ade36e3b551d261de0177b78296b
|
[
"MIT"
] | null | null | null |
dsp++/src/arch/x86/sse.cpp
|
andrzejc/dsp-
|
fd39d2395a37ade36e3b551d261de0177b78296b
|
[
"MIT"
] | null | null | null |
#include <dsp++/platform.h>
#ifdef DSP_ARCH_FAMILY_X86
#include <algorithm>
#include <dsp++/simd.h>
#include "sse.h"
#include "sse_utils.h"
#include <xmmintrin.h>
void* dsp::simd::detail::x86_sse_alloc(int size, int align) {
return _mm_malloc(size, align);
}
void dsp::simd::detail::x86_sse_free(void *p) {
_mm_free(p);
}
//! @brief Piecewise vector multiplication using SSE instructions
#if defined(_MSC_VER) && !defined(_WIN64)
// testing inline assembly :)
void dsp::simd::detail::x86_sse_mulf(float* res, const float* x, const float* b, size_t N) {
__asm {
mov eax, dword ptr [N]
mov edi, dword ptr [res]
mov esi, dword ptr [x]
mov edx, dword ptr [b]
mov ecx, eax
shr ecx, 5
test ecx, ecx
jz done
loop1:
movaps xmm0, [esi + 0*4];
movaps xmm1, [esi + 4*4];
mulps xmm0, [edx + 0*4];
mulps xmm1, [edx + 4*4];
movaps [edi + 0*4], xmm0;
movaps xmm2, [esi + 8*4];
movaps [edi + 4*4], xmm1;
mulps xmm2, [edx + 8*4];
movaps xmm3, [esi + 12*4];
movaps [edi + 8*4], xmm2;
mulps xmm3, [edx + 12*4];
movaps xmm4, [esi + 16*4];
movaps [edi + 12*4], xmm3;
mulps xmm4, [edx + 16*4];
movaps xmm5, [esi + 20*4];
movaps [edi + 16*4], xmm4;
mulps xmm5, [edx + 20*4];
movaps xmm6, [esi + 24*4];
movaps [edi + 20*4], xmm5;
mulps xmm6, [edx + 24*4];
movaps xmm7, [esi + 28*4];
movaps [edi + 24*4], xmm6;
mulps xmm7, [edx + 28*4];
movaps [edi + 28*4], xmm7;
add esi, 4 * 32;
add edx, 4 * 32;
add edi, 4 * 32;
loop loop1;
shr eax, 2;
and eax, 7;
jz done;
mov ecx, eax;
loop2:
movaps xmm0, [esi];
mulps xmm0, [edx];
movaps [edi], xmm0;
add esi, 4*4;
add edx, 4*4;
add edi, 4*4;
loop loop2;
done:
}}
#else
SSE_FVVV(dsp::simd::detail::x86_sse_mulf, mul_ps)
#endif
//! @brief Vector-scalar multiplication using SSE instructions
SSE_FVSV(dsp::simd::detail::x86_sse_mulf, mul_ps)
//! @brief Piecewise vector addition using SSE instructions
SSE_FVVV(dsp::simd::detail::x86_sse_addf, add_ps)
SSE_FVSV(dsp::simd::detail::x86_sse_addf, add_ps)
//! @brief Piecewise vector addition using SSE instructions
SSE_FVVV(dsp::simd::detail::x86_sse_subf, sub_ps)
SSE_FVSV(dsp::simd::detail::x86_sse_subf, sub_ps)
//! @brief Piecewise vector division (a/b) using SSE instructions
SSE_FVVV(dsp::simd::detail::x86_sse_divf, div_ps)
//! @brief Vector-scalar division using SSE instructions
SSE_FVSV(dsp::simd::detail::x86_sse_divf, div_ps)
//!@brief Dot product using SSE instruction set.
SSE_SUM_FVVS(dsp::simd::detail::x86_sse_dotf, mul_ps)
SSE_FVV(dsp::simd::detail::x86_sse_sqrtf, sqrt_ps)
SSE_FVV(dsp::simd::detail::x86_sse_rcpf, rcp_ps)
SSE_FVV(dsp::simd::detail::x86_sse_rsqrtf, rcp_ps)
//! @brief Piecewise complex vector multiplication using SSE instructions
void dsp::simd::detail::x86_sse_mulcf(std::complex<float>* res_c, const std::complex<float>* a_c, const std::complex<float>* b_c, size_t len)
{
float *res = reinterpret_cast<float*>(res_c);
const float* a = reinterpret_cast<const float*>(a_c);
const float* b = reinterpret_cast<const float*>(b_c);
__m128 x0, x1, x2, x3, x4;
float DSP_ALIGNED(16) mul[] = {-1.0f, 1.0f, -1.0f, 1.0f};
size_t n = len / 2; // each complex has 2 floats, so divide by 2 not 4
x4 = _mm_load_ps(mul);
for (size_t i = 0; i < n; ++i, a += 4, b += 4, res += 4) {
x1 = _mm_load_ps(b);
x0 = _mm_load_ps(a);
x2 = x1;
x3 = x0;
x2 = _mm_shuffle_ps(x2, x1, 0xA0);
x1 = _mm_shuffle_ps(x1, x1, 0xF5);
x3 = _mm_shuffle_ps(x3, x0, 0xB1);
x3 = _mm_mul_ps(x3, x1);
x3 = _mm_mul_ps(x3, x4);
x0 = _mm_add_ps(x0, x3);
_mm_store_ps(res, x0);
}
}
// TODO implement complex mul/div using SSE3 instructions according to Ex 6-9
//! @brief Dot product of complex vectors using SSE instructions
std::complex<float> dsp::simd::detail::x86_sse_dotcf(const std::complex<float>* a_c, const std::complex<float>* b_c, size_t len)
{
const float* a = reinterpret_cast<const float*>(a_c);
const float* b = reinterpret_cast<const float*>(b_c);
__m128 x0, x1, x2, x3, x4, x5;
float DSP_ALIGNED(16) mul[] = {-1.0f, 1.0f, -1.0f, 1.0f};
size_t n = len / 2; // each complex has 2 floats, so divide by 2 not 4
x5 = _mm_set1_ps(0.f); // write zeros to result
x4 = _mm_load_ps(mul);
for (size_t i = 0; i < n; ++i, a += 4, b += 4) {
x0 = _mm_load_ps(a);
x1 = _mm_load_ps(b);
x2 = x1;
x3 = x0;
x2 = _mm_shuffle_ps(x2, x1, 0xA0);
x1 = _mm_shuffle_ps(x1, x1, 0xF5);
x3 = _mm_shuffle_ps(x3, x0, 0xB1);
x0 = _mm_mul_ps(x0, x2);
x3 = _mm_mul_ps(x3, x1);
x3 = _mm_mul_ps(x3, x4);
x0 = _mm_add_ps(x0, x3);
x5 = _mm_add_ps(x5, x0);
}
// x5 now has 2 complex numbers which need to be added
x0 = _mm_movehl_ps(x0, x5);
x0 = _mm_add_ps(x0, x5);
_mm_store_ps(mul, x0);
return *reinterpret_cast<std::complex<float>*>(mul);
}
float dsp::simd::detail::x86_sse_filter_df2(float* w, const float* b, const size_t M, const float* a, const size_t N)
{
float ardot = 0.f, madot = 0, *ws = w, b0 = *b;
__m128 c0, c1, c2, c3, x0, x1, x2, x3;
size_t L = std::min(N, M);
size_t n = L / 16;
// Simultaneous calculation of both AR- and MA- component dot products, first in 16-, then 4- element chunks
for (size_t i = 0; i < n; ++i, a += 16, w += 16, b += 16) {
SSE_LOADU16(x, w); // x = w
SSE_LOAD16(c, a); // c = a
SSE_MUL16(c, c, x); // c *= x (c = w * a)
SSE_HSUM16(c0, c);
ardot += _mm_cvtss_f32(c0);
SSE_LOAD16(c, b); // c = b
SSE_MUL16(c, c, x); // c *= x (c = w * b)
SSE_HSUM16(c0, c); // c0 = sum(c)
madot += _mm_cvtss_f32(c0);
}
n = (L % 16) / 4;
for (size_t i = 0; i < n; ++i, a += 4, w += 4, b += 4) {
x0 = _mm_loadu_ps(w);
c0 = _mm_load_ps(a);
c0 = _mm_mul_ps(c0, x0);
SSE_HSUM(c0, c0, c1);
ardot += _mm_cvtss_f32(c0);
c0 = _mm_load_ps(b);
c0 = _mm_mul_ps(c0, x0);
SSE_HSUM(c0, c0, c1);
madot += _mm_cvtss_f32(c0);
}
L = std::max(N, M) - L;
n = L / 16;
if (N > M) {
// Calculate only the remaining AR-component product
for (size_t i = 0; i < n; ++i, a += 16, w += 16) {
SSE_LOADU16(x, w); // x = w
SSE_LOAD16(c, a); // c = a
SSE_MUL16(c, c, x); // c *= x (c = w * a)
SSE_HSUM16(c0, c);
ardot += _mm_cvtss_f32(c0);
}
n = (L % 16) / 4;
for (size_t i = 0; i < n; ++i, a += 4, w += 4) {
x0 = _mm_loadu_ps(w);
c0 = _mm_load_ps(a);
c0 = _mm_mul_ps(c0, x0);
SSE_HSUM(c0, c0, c1);
ardot += _mm_cvtss_f32(c0);
}
}
else {
// Calculate only the remaining MA-component
for (size_t i = 0; i < n; ++i, b += 16, w += 16) {
SSE_LOADU16(x, w); // x = w
SSE_LOAD16(c, b); // c = b
SSE_MUL16(c, c, x); // c *= x (x = w * b)
SSE_HSUM16(c0, c); // c0 = sum(c)
madot += _mm_cvtss_f32(c0);
}
n = (L % 16) / 4;
for (size_t i = 0; i < n; ++i, b += 4, w += 4) {
x0 = _mm_loadu_ps(w);
c0 = _mm_load_ps(b);
c0 = _mm_mul_ps(c0, x0);
SSE_HSUM(c0, c0, c1);
madot += _mm_cvtss_f32(c0);
}
}
// In canonical equation, AR product should be computed first and subtracted from w[0] (which is in fact input sample)
// before calculating MA product. Since we computed them simultaneously, MA product must be corrected now, taking into
// account that w[0] was multiplied by b[0].
madot -= ardot * b0;
// Update w[0] as well.
*ws -= ardot;
return madot;
}
float dsp::simd::detail::x86_sse_filter_sos_df2(float x, size_t N, const bool* scale_only, float* w, const float* b, const float* a, size_t step)
{
__m128 cx, wx, xx, slack;
xx = _mm_set_ss(x); // xx[0] = x; xx[1-3] = 0; xx[0] will hold the result between the steps
for (size_t i = 0; i < N; ++i, w += step, b += step, a += step, ++scale_only) {
if (*scale_only) {
cx = _mm_load_ss(b); // load only 0th element from b
xx = _mm_mul_ss(xx, cx); // xx[0] *= cx[0]; don't need to write intermediate results back to w for scale-only section (we don't use it)
}
else {
cx = _mm_load_ps(a);
wx = _mm_load_ps(w);
wx = _mm_move_ss(wx, xx); // put result of previous iteration in wx[0]
cx = _mm_mul_ps(cx, wx);
SSE_HSUM(cx, cx, slack); // cx[0] now has dot(a, w)
wx = _mm_sub_ss(wx, cx); // wx[0] -= dot(a, w);
_mm_store_ps(w, wx); // update the delay line for next sample, write wx to memory
cx = _mm_load_ps(b);
cx = _mm_mul_ps(cx, wx); //
SSE_HSUM(xx, cx, slack); // xx[0] = dot(b, w)
}
}
return _mm_cvtss_f32(xx);
}
float dsp::simd::detail::x86_sse_accf(const float* x, size_t N)
{
__m128 x0, x1, x2, x3, x4, x5, x6, r;
r = _mm_setzero_ps();
size_t n = N / 28;
for (size_t i = 0; i < n; ++i, x += 28) {
x0 = _mm_load_ps(x);
x1 = _mm_load_ps(x + 4);
x2 = _mm_load_ps(x + 8);
x0 = _mm_add_ps(x0, x1);
x3 = _mm_load_ps(x + 12);
x4 = _mm_load_ps(x + 16);
x2 = _mm_add_ps(x2, x3);
x5 = _mm_load_ps(x + 20);
x6 = _mm_load_ps(x + 24);
x4 = _mm_add_ps(x4, x5);
x0 = _mm_add_ps(x0, x6);
x2 = _mm_add_ps(x2, x4);
x0 = _mm_add_ps(x0, x2);
r = _mm_add_ps(r, x0);
}
n = (n % 28) / 4;
for (size_t i = 0; i < n; ++i, x += 4) {
x0 = _mm_load_ps(x);
r = _mm_add_ps(r, x0);
}
SSE_HSUM(r, r, x0);
return _mm_cvtss_f32(r);
}
#endif // DSP_ARCH_FAMILY_X86
| 29.241935
| 145
| 0.615996
|
andrzejc
|
378e1170828fea2214614aa5942e6ade3016e53f
| 5,024
|
hpp
|
C++
|
PlayRho/Dynamics/Joints/FunctionalJointVisitor.hpp
|
ivorne/PlayRho
|
6ef036f46cd0c901f174f944ce40d56ec052248e
|
[
"Zlib"
] | null | null | null |
PlayRho/Dynamics/Joints/FunctionalJointVisitor.hpp
|
ivorne/PlayRho
|
6ef036f46cd0c901f174f944ce40d56ec052248e
|
[
"Zlib"
] | null | null | null |
PlayRho/Dynamics/Joints/FunctionalJointVisitor.hpp
|
ivorne/PlayRho
|
6ef036f46cd0c901f174f944ce40d56ec052248e
|
[
"Zlib"
] | null | null | null |
/*
* Copyright (c) 2017 Louis Langholtz https://github.com/louis-langholtz/PlayRho
*
* 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.
*/
#ifndef PLAYRHO_DYNAMICS_JOINTS_FUNCTIONALJOINTVISITOR_HPP
#define PLAYRHO_DYNAMICS_JOINTS_FUNCTIONALJOINTVISITOR_HPP
#include <PlayRho/Dynamics/Joints/JointVisitor.hpp>
#include <functional>
#include <tuple>
#include <utility>
namespace playrho {
namespace d2 {
/// @brief Functional joint visitor class.
/// @note This class is intended to provide an alternate interface for visiting joints
/// via the use of lambdas instead of having to subclass <code>JointVisitor</code>.
class FunctionalJointVisitor: public JointVisitor
{
public:
/// @brief Procedure alias.
template <class T>
using Proc = std::function<void(T)>;
//using Tuple = std::tuple<Proc<Types>...>;
//FunctionalJointVisitor(const Tuple& v): procs{v} {}
/// @brief Tuple alias.
using Tuple = std::tuple<
Proc<const RevoluteJoint&>,
Proc< RevoluteJoint&>,
Proc<const PrismaticJoint&>,
Proc< PrismaticJoint&>,
Proc<const DistanceJoint&>,
Proc< DistanceJoint&>,
Proc<const PulleyJoint&>,
Proc< PulleyJoint&>,
Proc<const TargetJoint&>,
Proc< TargetJoint&>,
Proc<const GearJoint&>,
Proc< GearJoint&>,
Proc<const WheelJoint&>,
Proc< WheelJoint&>,
Proc<const WeldJoint&>,
Proc< WeldJoint&>,
Proc<const FrictionJoint&>,
Proc< FrictionJoint&>,
Proc<const RopeJoint&>,
Proc< RopeJoint&>,
Proc<const MotorJoint&>,
Proc< MotorJoint&>
>;
Tuple procs; ///< Procedures.
/// @brief Uses given procedure.
/// @note Provide a builder pattern mutator method.
template <class T>
FunctionalJointVisitor& Use(const Proc<T>& proc) noexcept
{
std::get<Proc<T>>(procs) = proc;
return *this;
}
// Overrides of all the base class's Visit methods...
// Uses decltype to ensure the correctly typed invocation of the Handle method.
void Visit(const RevoluteJoint& arg) override { Handle<decltype(arg)>(arg); }
void Visit(RevoluteJoint& arg) override { Handle<decltype(arg)>(arg); }
void Visit(const PrismaticJoint& arg) override { Handle<decltype(arg)>(arg); }
void Visit(PrismaticJoint& arg) override { Handle<decltype(arg)>(arg); }
void Visit(const DistanceJoint& arg) override { Handle<decltype(arg)>(arg); }
void Visit(DistanceJoint& arg) override { Handle<decltype(arg)>(arg); }
void Visit(const PulleyJoint& arg) override { Handle<decltype(arg)>(arg); }
void Visit(PulleyJoint& arg) override { Handle<decltype(arg)>(arg); }
void Visit(const TargetJoint& arg) override { Handle<decltype(arg)>(arg); }
void Visit(TargetJoint& arg) override { Handle<decltype(arg)>(arg); }
void Visit(const GearJoint& arg) override { Handle<decltype(arg)>(arg); }
void Visit(GearJoint& arg) override { Handle<decltype(arg)>(arg); }
void Visit(const WheelJoint& arg) override { Handle<decltype(arg)>(arg); }
void Visit(WheelJoint& arg) override { Handle<decltype(arg)>(arg); }
void Visit(const WeldJoint& arg) override { Handle<decltype(arg)>(arg); }
void Visit(WeldJoint& arg) override { Handle<decltype(arg)>(arg); }
void Visit(const FrictionJoint& arg) override { Handle<decltype(arg)>(arg); }
void Visit(FrictionJoint& arg) override { Handle<decltype(arg)>(arg); }
void Visit(const RopeJoint& arg) override { Handle<decltype(arg)>(arg); }
void Visit(RopeJoint& arg) override { Handle<decltype(arg)>(arg); }
void Visit(const MotorJoint& arg) override { Handle<decltype(arg)>(arg); }
void Visit(MotorJoint& arg) override { Handle<decltype(arg)>(arg); }
private:
/// @brief Handles the joint through the established function.
template <class T>
inline void Handle(T arg) const
{
const auto& proc = std::get<Proc<T>>(procs);
if (proc)
{
proc(arg);
}
}
};
} // namespace d2
} // namespace playrho
#endif // PLAYRHO_DYNAMICS_JOINTS_FUNCTIONALJOINTVISITOR_HPP
| 39.873016
| 86
| 0.671377
|
ivorne
|
3790d94c9ddbd8c850a24caac5c31df82b0b92c1
| 482
|
cpp
|
C++
|
main.cpp
|
dominikbelter/stdThreadExamples
|
9120beb27a1ffb42223b52362c894872d072f200
|
[
"MIT"
] | null | null | null |
main.cpp
|
dominikbelter/stdThreadExamples
|
9120beb27a1ffb42223b52362c894872d072f200
|
[
"MIT"
] | null | null | null |
main.cpp
|
dominikbelter/stdThreadExamples
|
9120beb27a1ffb42223b52362c894872d072f200
|
[
"MIT"
] | null | null | null |
#include <thread>
#include <iostream>
int main()
{
try {
std::cout << "Thread examples. Run demo programs:\n";
std::cout << "threads_demo - single thread\n";
std::cout << "async_demo - asynchronous demo\n";
std::cout << "false_sharing_demo - false sharing demo\n";
std::cout << "mutex_demo - mutex demo\n";
}
catch (const std::exception& ex) {
std::cerr << ex.what() << std::endl;
return 1;
}
return 0;
}
| 25.368421
| 65
| 0.556017
|
dominikbelter
|
3791bf11e977b00f496e4eee16b400c2a8151c1e
| 1,121
|
hpp
|
C++
|
include/RadonFramework/IO/Decoders/ImageDecoder.hpp
|
tak2004/RF_UI
|
848518a6defc6bf871f8cd306d6bd5d486ee401f
|
[
"Apache-2.0"
] | null | null | null |
include/RadonFramework/IO/Decoders/ImageDecoder.hpp
|
tak2004/RF_UI
|
848518a6defc6bf871f8cd306d6bd5d486ee401f
|
[
"Apache-2.0"
] | null | null | null |
include/RadonFramework/IO/Decoders/ImageDecoder.hpp
|
tak2004/RF_UI
|
848518a6defc6bf871f8cd306d6bd5d486ee401f
|
[
"Apache-2.0"
] | null | null | null |
#ifndef RF_IO_DECODERS_IMAGEDECODER_HPP
#define RF_IO_DECODERS_IMAGEDECODER_HPP
#if _MSC_VER > 1000
#pragma once
#endif
#include <RadonFramework/Drawing/PixelFormat.hpp>
#include <RadonFramework/IO/Decoder.hpp>
#include <RadonFramework/Memory/AutoPointerArray.hpp>
namespace RadonFramework::Drawing
{
class Image;
}
namespace RadonFramework::IO::Decoders
{
class ImageDecoder : public Decoder
{
public:
ImageDecoder();
const RF_Draw::PixelFormat& PixelFormat() const;
const RF_Type::UInt32 Width() const;
const RF_Type::UInt32 Height() const;
const RF_Type::UInt32 Layers() const;
virtual RF_Mem::AutoPointerArray<RF_Type::UInt8>
LoadLayer(RF_Type::UInt32 Layer) = 0;
const RF_Type::Bool ConvertToImage(RF_Draw::Image& Destination);
protected:
RF_Draw::PixelFormat m_PixelFormat;
RF_Type::UInt32 m_Width;
RF_Type::UInt32 m_Height;
RF_Type::UInt32 m_Layers;
};
} // namespace RadonFramework::IO::Decoders
#ifndef RF_SHORTHAND_NAMESPACE_DECODERS
#define RF_SHORTHAND_NAMESPACE_DECODERS
namespace RF_Decoders = RadonFramework::IO::Decoders;
#endif
#endif // RF_IO_DECODERS_IMAGEDECODER_HPP
| 24.369565
| 66
| 0.790366
|
tak2004
|
3792a28db32c68e4ad8f2e598277e288e4b51fb4
| 7,556
|
cpp
|
C++
|
estimation/test/test_srukf_imu7z3q_linux.cpp
|
blobrobots/libs
|
cc11f56bc4e1112033e8b7352e5653f98f1bfc13
|
[
"MIT"
] | 1
|
2015-10-21T14:36:43.000Z
|
2015-10-21T14:36:43.000Z
|
estimation/test/test_srukf_imu7z3q_linux.cpp
|
blobrobots/libs
|
cc11f56bc4e1112033e8b7352e5653f98f1bfc13
|
[
"MIT"
] | null | null | null |
estimation/test/test_srukf_imu7z3q_linux.cpp
|
blobrobots/libs
|
cc11f56bc4e1112033e8b7352e5653f98f1bfc13
|
[
"MIT"
] | null | null | null |
/********* blob robotics 2014 *********
* title: test_linux.cpp
* brief: test for ukf library (linux)
* author: adrian jimenez-gonzalez
* e-mail: blob.robotics@gmail.com
/*************************************/
#include <iostream>
#include <sstream>
#include <fstream>
#include <math.h>
#include <blob/math.h>
#include <blob/srukf.h>
#define N 7 // Number of states
#define T 0.01
#define Tacc 0.02
#define Tmag 0.05
#define qq 0 // 0
#define qbg 0.0001 // 0.0001
#define racc 0.1
#define rmag 0.25
#define qq_T (qq*T)
#define qbg_T (qq*T)
#define racc_T (racc*Tacc)
#define rmag_T (rmag*Tmag)
typedef struct {
real_t u[3];
real_t dt;
} fargs_t;
typedef struct {
real_t dt;
} hargs_t;
void f(real_t *x, void *args, real_t * res)
{
// x = [q0, q1, q2, q3, gbx, gby, gbz]
// u = [gx, gy, gz]
fargs_t *fargs = (fargs_t *)args;
real_t q0 = x[0], q1 = x[1], q2 = x[2], q3 = x[3], gbx = x[4], gby = x[5], gbz = x[6];
real_t gx = fargs->u[0] - gbx;
real_t gy = fargs->u[1] - gby;
real_t gz = fargs->u[2] - gbz;
// predict new state (FRD)
res[0] = q0 + (-q1*gx - q2*gy - q3*gz)*fargs->dt/2;
res[1] = q1 + ( q0*gx + q3*gy - q2*gz)*fargs->dt/2;
res[2] = q2 + (-q3*gx + q0*gy + q1*gz)*fargs->dt/2;
res[3] = q3 + ( q2*gx - q1*gy + q0*gz)*fargs->dt/2;
res[4] = gbx;
res[5] = gby;
res[6] = gbz;
// re-normalize quaternion
real_t qnorm = blob::math::sqrt(res[0]*res[0] + res[1]*res[1] + res[2]*res[2] + res[3]*res[3]);
res[0] = res[0]/qnorm;
res[1] = res[1]/qnorm;
res[2] = res[2]/qnorm;
res[3] = res[3]/qnorm;
}
void ha(real_t *x, void *args, real_t * res)
{
// x = [q0, q1, q2, q3, gbx, gby, gbx]
// z = [ax, ay, az]
real_t q0 = x[0], q1 = x[1], q2 = x[2], q3 = x[3];
// estimated direction of gravity (NED)
res[0] = 2*(q0*q2 - q1*q3); // ax
res[1] = -2*(q0*q1 + q2*q3); // ay
res[2] = -q0*q0 + q1*q1 + q2*q2 - q3*q3; // az
}
void hm(real_t *x, void *args, real_t * res)
{
// x = [q0, q1, q2, q3, gbx, gby, gbx]
// z = [mx, my, mz]
real_t q0 = x[0], q1 = x[1], q2 = x[2], q3 = x[3];
// estimated direction of flux (NED)
res[0] = q0*q0 + q1*q1 - q2*q2 - q3*q3; // mx
res[1] = 2*(q1*q2 - q0*q3); // my
res[2] = 2*(q0*q2 + q1*q3); // mz
}
// covariance of process
real_t sq[] = { qq_T, 0, 0, 0, 0, 0, 0,
0, qq_T, 0, 0, 0, 0, 0,
0, 0, qq_T, 0, 0, 0, 0,
0, 0, 0, qq_T, 0, 0, 0,
0, 0, 0, 0, qbg_T, 0, 0,
0, 0, 0, 0, 0, qbg_T, 0,
0, 0, 0, 0, 0, 0, qbg_T };
// covariance of measurement
real_t sa[] = { racc_T, 0, 0,
0, racc_T, 0,
0, 0, racc_T };
// covariance of measurement
real_t sm[] = { rmag_T, 0, 0,
0, rmag_T, 0,
0, 0, rmag_T };
int main(int argc, char* argv[])
{
bool result = true;
real_t za[3] = {0, 0, -1};
real_t zm[3] = {0, 0, 0};
real_t x[N] = {1, 0, 0, 0, 0, 0, 0};
if(argc == 3)
{
std::ifstream input_file (argv[1]);
std::ofstream output_file (argv[2]);
if (input_file.is_open())
{
if (output_file.is_open())
{
std::string line;
real_t ta = 0, tm = 0;
blob::SRUKF srukf(N, x);
fargs_t fargs;
while ( getline (input_file,line) )
{
if((line[0] == '-') || ((line[0] >= '0')&&(line[0] <='9')))
{
real_t gx, gy, gz, ax, ay, az, mx, my, mz, anorm, mnorm, roll, pitch, yaw;
std::stringstream lineinput(line);
lineinput >> gx >> gy >> gz >> ax >> ay >> az >> mx >> my >> mz;
//if(sizeof(real_t) == sizeof(double)) // FIXME: change to stringstream >>
// sscanf(line.c_str(),"%lf %lf %lf %lf %lf %lf %lf %lf %lf"
// , &gx, &gy, &gz, &ax, &ay, &az, &mx, &my, &mz);
//else
// sscanf(line.c_str(),"%f %f %f %f %f %f %f %f %f"
// , &gx, &gy, &gz, &ax, &ay, &az, &mx, &my, &mz);
ta += T;
tm += T;
// normalise measurements
anorm = blob::math::sqrt(ax*ax + ay*ay + az*az);
if (anorm > 0)
{
ax = ax/anorm;
ay = ay/anorm;
az = az/anorm;
}
mnorm = blob::math::sqrt(mx*mx + my*my + mz*mz);
if (mnorm > 0)
{
mx = mx/mnorm;
my = my/mnorm;
mz = mz/mnorm;
}
fargs.u[0] = gx;
fargs.u[1] = gy;
fargs.u[2] = gz;
fargs.dt = T;
#if defined(__DEBUG__) & defined(__linux__)
std::cout << "[test] - predicting over u=[" << fargs.u[0] << ", " << fargs.u[1] <<
", " << fargs.u[2] << "], dt=" << fargs.dt << std::endl;
#endif
result &= srukf.predict(&f, &fargs, sq);
if ((result==true)&&(ta>=Tacc))
{
za[0] = ax; za[1] = ay; za[2] = az;
#if defined(__DEBUG__) & defined(__linux__)
std::cout << "[test] - updating over za=[" << za[0] << ", " << za[1] <<
", " << za[2] << "], dta=" << ta << std::endl;
#endif
result &= srukf.update (&ha, NULL, 3, za, sa);
ta = 0;
}
if ((result==true)&&(tm >= Tmag))
{
zm[0] = mx; zm[1] = my; zm[2] = mz;
#if defined(__DEBUG__) & defined(__linux__)
std::cout << "[test] - updating over zm=[" << zm[0] << ", " << zm[1] <<
", " << zm[2] << "], dtm=" << tm << std::endl;
#endif
result &= srukf.update (&hm, NULL, 3, zm, sm);
tm = 0;
}
// re-normalize quaternion
real_t *q = srukf.getState();
real_t qnorm = blob::math::sqrt(q[0]*q[0] + q[1]*q[1] + q[2]*q[2] + q[3]*q[3]);
q[0] = q[0]/qnorm;
q[1] = q[1]/qnorm;
q[2] = q[2]/qnorm;
q[3] = q[3]/qnorm;
roll = atan2(2*(q[0]*q[1] + q[2]*q[3]), 1 - 2*(q[1]*q[1] + q[2]*q[2]));
pitch = asin(2*(q[0]*q[2] - q[1]*q[3]));
yaw = atan2(2*(q[0]*q[3] + q[1]*q[2]), 1 - 2*(q[2]*q[2] + q[3]*q[3]));
#if defined(__DEBUG__) & defined(__linux__)
std::cout << "[test] - got state x=[";
#endif
for(int i = 0; i < srukf.getNumStates(); i++)
{
output_file << srukf.getState(i) << " ";
#if defined(__DEBUG__) & defined(__linux__)
std::cout << srukf.getState(i) << " ";
#endif
}
output_file << roll << " " << pitch << " " << yaw << std::endl;
#if defined(__DEBUG__) & defined(__linux__)
std::cout << "] rpy=[" << roll << ", " << pitch << ", " << yaw << "]" << std::endl;;
#endif
}
if (result == false)
return -1;
}
input_file.close();
output_file.close();
}
else
std::cerr << "[test] - file i/o error: unable to open file " << argv[2] << std::endl;
}
else
std::cerr << "[test] - file i/o error: unable to open file " << argv[1] << std::endl;
}
else
std::cerr << "[test] - usage: ./test input_file output_file" << std::endl;
return 0;
}
| 29.400778
| 97
| 0.426284
|
blobrobots
|
3794edcf7df1f9337c3a59405d7b01c19ac47473
| 27,441
|
cpp
|
C++
|
EventManager.cpp
|
fredenigma/VesselBuilder1
|
4f332ec4e6fa80e1a63d8d920bb50e033c5b67f6
|
[
"MIT"
] | null | null | null |
EventManager.cpp
|
fredenigma/VesselBuilder1
|
4f332ec4e6fa80e1a63d8d920bb50e033c5b67f6
|
[
"MIT"
] | null | null | null |
EventManager.cpp
|
fredenigma/VesselBuilder1
|
4f332ec4e6fa80e1a63d8d920bb50e033c5b67f6
|
[
"MIT"
] | null | null | null |
#include "VesselBuilder1.h"
#include "DialogControl.h"
#include "EventManager.h"
#include "MeshManager.h"
#include "AnimationManager.h"
#include "MET.h"
#include "ConfigurationManager.h"
#include <Windows.h>
#pragma comment (lib, "winmm.lib")
Event::Event(VesselBuilder1 *_VB1) {
VB1 = _VB1;
Trigger.Type = TRIGGER::TRIGGERTYPE::NULL_TRIG;
Consumed = false;
Enabled = true;
DefaultEnabled = true;
return;
}
Event::~Event() {}
Event::TRIGGER::TRIGGERTYPE Event::GetTriggerType() {
return Trigger.Type;
}
void Event::SetTrigger(TRIGGER _trig) {
Trigger = _trig;
return;
}
void Event::SetConsumed(bool set) {
Consumed = set;
return;
}
bool Event::IsEventConsumed() {
return Consumed;
}
void Event::ConsumeEvent() {
return;
}
void Event::Trig() {
if (Trigger.repeat_mode == TRIGGER::REPEAT_MODE::ONCE) {
if (!IsEventConsumed()) {
ConsumeEvent();
SetConsumed(true);
}
}
else {
ConsumeEvent();
}
return;
}
void Event::EventPreStep(double simt, double simdt, double mjd) {
switch (Trigger.Type)
{
case TRIGGER::ALTITUDE:
{
double altitude = VB1->GetAltitude();
if (Trigger.condition == TRIGGER::ABOVE) {
if (altitude > Trigger.TriggerValue) {
Trig();
}
}
else if (Trigger.condition == TRIGGER::BELOW) {
if (altitude < Trigger.TriggerValue) {
Trig();
}
}
break;
}
case TRIGGER::VELOCITY:
{
double ref_speed;
if (Trigger.vel_mode == TRIGGER::GROUNDSPEED) {
ref_speed = VB1->GetGroundspeed();
}
else if (Trigger.vel_mode == TRIGGER::VEL_MODE::AIRSPEED) {
ref_speed = VB1->GetAirspeed();
}
else if (Trigger.vel_mode == TRIGGER::VEL_MODE::ORBITALSPEED) {
VECTOR3 r_vel;
VB1->GetRelativeVel(VB1->GetSurfaceRef(), r_vel);
ref_speed = length(r_vel);
}
else if (Trigger.vel_mode == TRIGGER::MACH) {
ref_speed = VB1->GetMachNumber();
}
if (Trigger.condition == TRIGGER::ABOVE) {
if (ref_speed > Trigger.TriggerValue) {
Trig();
}
}
else if (Trigger.condition == TRIGGER::BELOW) {
if (ref_speed < Trigger.TriggerValue) {
Trig();
}
}
break;
}
case TRIGGER::MAINFUELTANK_LEVEL:
{
double tank_level = (VB1->GetPropellantMass(VB1->GetDefaultPropellantResource())) / (VB1->GetPropellantMaxMass(VB1->GetDefaultPropellantResource()));
if (tank_level <= Trigger.TriggerValue) {
Trig();
}
break;
}
case TRIGGER::DYNPRESSURE:
{
double ref_p = VB1->GetDynPressure();
if (Trigger.condition == TRIGGER::ABOVE) {
if (ref_p > Trigger.TriggerValue) {
Trig();
}
}
else if (Trigger.condition == TRIGGER::BELOW) {
if (ref_p < Trigger.TriggerValue) {
Trig();
}
}
break;
}
case TRIGGER::TIME:
{
double ref_time;
if (Trigger.time_mode == TRIGGER::MJD) {
ref_time = oapiGetSimMJD();
}
else if (Trigger.time_mode == TRIGGER::MET) {
ref_time = VB1->GetMET();
}
if (ref_time >= Trigger.TriggerValue) {
Trig();
}
break;
}
case TRIGGER::SIMSTART:
{
if (oapiGetSimTime() >= 0) {
Trig();
}
break;
}
case TRIGGER::OTHER_EVENT:
{
if (Trigger.Other_event_h) {
if (Trigger.Other_event_h->IsEventConsumed()) {
Trig();
}
}
break;
}
}
return;
}
void Event::ConsumeBufferedKey(DWORD key, bool down, char *kstate) {
if (!down)return;
if (VB1->Playback())return;
if ((Trigger.KeyMods.Alt ? KEYMOD_ALT(kstate) : !KEYMOD_ALT(kstate)) && (Trigger.KeyMods.Ctrl ? KEYMOD_CONTROL(kstate) : !KEYMOD_CONTROL(kstate)) && (Trigger.KeyMods.Shift ? KEYMOD_SHIFT(kstate) : !KEYMOD_SHIFT(kstate)) && key == Trigger.Key) {
Trig();
}
return;
}
void Event::EventDockEvent(int dock, OBJHANDLE mate) {
if (dock == Trigger.DockingPort) {
if (Trigger.WhenDocking && mate != NULL) {
if (Trigger.AnyMate) {
Trig();
}
else {
char matenamebuf[256] = { '\0' };
oapiGetObjectName(mate, matenamebuf, 256);
string matename(matenamebuf);
if (matename.compare(Trigger.MateName) == 0) {
Trig();
}
}
}
else if (!Trigger.WhenDocking && mate == NULL) {
Trig();
}
}
}
UINT Event::GetID() {
return id;
}
void Event::SetName(string newname) {
name = newname;
return;
}
string Event::GetName() {
return name;
}
NullEvent::NullEvent(VesselBuilder1 *VB1) : Event(VB1){}
NullEvent::~NullEvent(){}
void NullEvent::ConsumeEvent() {
return;
}
Child_Spawn::Child_Spawn(VesselBuilder1 *VB1,string v_name,string v_class,VECTOR3 _ofs,VECTOR3 _vel, VECTOR3 _rot_vel, int _mesh_to_del):Event(VB1){
spawned_vessel_name = v_name;
spawned_vessel_class = v_class;
ofs = _ofs;
vel = _vel;
rot_vel = _rot_vel;
mesh_to_del = _mesh_to_del;
return;
}
Child_Spawn::~Child_Spawn(){}
void Child_Spawn::ConsumeEvent() {
char buf[256] = { '\0' };
sprintf(buf, "%s", spawned_vessel_name.c_str());
OBJHANDLE h_ves = oapiGetVesselByName(buf);
if (!oapiIsVessel(h_ves)) {
VECTOR3 rofs;
VESSELSTATUS2 vs;
memset(&vs, 0, sizeof(vs));
vs.version = 2;
VB1->GetStatusEx(&vs);
VB1->Local2Rel(ofs, vs.rpos);
VB1->GlobalRot(vel, rofs);
vs.rvel += rofs;
vs.vrot += rot_vel;
spawend_vessel_h = oapiCreateVesselEx(spawned_vessel_name.c_str(), spawned_vessel_class.c_str(), &vs);
if (mesh_to_del >= 0) {
VB1->DelMesh(mesh_to_del);
VB1->MshMng->mesh_deleted.push_back(mesh_to_del);
}
}
return;
}
void Child_Spawn::SetSpawnedVesselName(string newName) {
spawned_vessel_name = newName;
return;
}
void Child_Spawn::SetSpawnedVesselClass(string newClass) {
spawned_vessel_class = newClass;
return;
}
void Child_Spawn::SetOfs(VECTOR3 _ofs) {
ofs = _ofs;
return;
}
void Child_Spawn::SetVel(VECTOR3 _vel) {
vel = _vel;
}
void Child_Spawn::SetRotVel(VECTOR3 _rot_Vel) {
rot_vel = _rot_Vel;
return;
}
string Child_Spawn::GetSpawnedVesselName() {
return spawned_vessel_name;
}
string Child_Spawn::GetSpawnedVesselClass() {
return spawned_vessel_class;
}
VECTOR3 Child_Spawn::GetOfs() {
return ofs;
}
VECTOR3 Child_Spawn::GetVel() {
return vel;
}
VECTOR3 Child_Spawn::GetRotVel() {
return rot_vel;
}
Anim_Trigger::Anim_Trigger(VesselBuilder1* VB1, UINT _anim_idx, bool _forward):Event(VB1){
anim_idx = _anim_idx;
forward = _forward;
return;
}
Anim_Trigger::~Anim_Trigger() {}
void Anim_Trigger::ConsumeEvent() {
if (forward) {
VB1->AnimMng->StartAnimationForward(anim_idx);
}
else {
VB1->AnimMng->StartAnimationBackward(anim_idx);
}
return;
}
void Anim_Trigger::SetAnimIdx(UINT _anim_idx) {
anim_idx = _anim_idx;
return;
}
UINT Anim_Trigger::GetAnimIdx() {
return anim_idx;
}
void Anim_Trigger::SetForward(bool set) {
forward = set;
return;
}
bool Anim_Trigger::GetForward() {
return forward;
}
Thruster_Fire::Thruster_Fire(VesselBuilder1* VB1, THRUSTER_HANDLE _th, double _level):Event(VB1) {
th = _th;
level = _level;
return;
}
Thruster_Fire::~Thruster_Fire() {}
void Thruster_Fire::ConsumeEvent() {
VB1->SetThrusterLevel(th, level);
}
void Thruster_Fire::SetThrusterTH(THRUSTER_HANDLE _th) {
th = _th;
return;
}
THRUSTER_HANDLE Thruster_Fire::GetThrusterTH() {
return th;
}
void Thruster_Fire::SetLevel(double _Level) {
level = _Level;
return;
}
double Thruster_Fire::Thruster_Fire::GetLevel() {
return level;
}
ThrusterGroup_Fire::ThrusterGroup_Fire(VesselBuilder1* VB1, THGROUP_TYPE thgroup_type, double _level):Event(VB1) {
thgroup = thgroup_type;
level = _level;
return;
}
ThrusterGroup_Fire::~ThrusterGroup_Fire() {}
void ThrusterGroup_Fire::ConsumeEvent() {
VB1->SetThrusterGroupLevel(thgroup, level);
}
void ThrusterGroup_Fire::SetThGroup(THGROUP_TYPE thgrp_type) {
thgroup = thgrp_type;
}
THGROUP_TYPE ThrusterGroup_Fire::GetThGroup() {
return thgroup;
}
void ThrusterGroup_Fire::SetLevel(double _level) {
level = _level;
}
double ThrusterGroup_Fire::GetLevel() {
return level;
}
Payload_Jettison::Payload_Jettison(VesselBuilder1* VB1, bool _next, UINT _dock_idx) :Event(VB1) {
next = _next;
dock_idx = _dock_idx;
return;
}
Payload_Jettison::~Payload_Jettison(){}
void Payload_Jettison::ConsumeEvent() {
if (next) {
VB1->JettisonNextDock();
}
else {
VB1->JettisonDock(dock_idx);
}
return;
}
void Payload_Jettison::SetDockIdx(UINT _dock_idx) {
dock_idx = _dock_idx;
return;
}
UINT Payload_Jettison::GetDockIdx() {
return dock_idx;
}
void Payload_Jettison::SetNext(bool set) {
next = set;
return;
}
bool Payload_Jettison::GetNext() {
return next;
}
Reset_Met::Reset_Met(VesselBuilder1* VB1, bool _now, double _newmjd0):Event(VB1) {
now = _now;
newmjd0 = _newmjd0;
}
Reset_Met::~Reset_Met(){}
void Reset_Met::ConsumeEvent() {
VB1->Met->SetMJD0(now ? oapiGetSimMJD() : newmjd0 );
return;
}
void Reset_Met::SetNow(bool set) {
now = set;
return;
}
bool Reset_Met::GetNow() {
return now;
}
void Reset_Met::SetNewMJD0(double _newmjd0) {
newmjd0 = _newmjd0;
return;
}
double Reset_Met::GetNewMJD0() {
return newmjd0;
}
Reconfiguration::Reconfiguration(VesselBuilder1* VB1, UINT _newconfig) :Event(VB1) {
newconfig = _newconfig;
return;
}
Reconfiguration::~Reconfiguration(){}
void Reconfiguration::SetNewConfig(UINT _newconfig) {
newconfig = _newconfig;
return;
}
UINT Reconfiguration::GetNewConfig() {
return newconfig;
}
void Reconfiguration::ConsumeEvent() {
VB1->ConfigMng->ApplyConfiguration(newconfig);
return;
}
ShiftCG::ShiftCG(VesselBuilder1* VB1, VECTOR3 _shift) : Event(VB1) {
shift = _shift;
return;
}
ShiftCG::~ShiftCG(){}
void ShiftCG::ConsumeEvent() {
VB1->ShiftCG(shift);
return;
}
void ShiftCG::SetShift(VECTOR3 _shift) {
shift = _shift;
return;
}
VECTOR3 ShiftCG::GetShift() {
return shift;
}
TextureSwap::TextureSwap(VesselBuilder1* VB1, UINT _mesh, DWORD _texidx, string texture):Event(VB1) {
mesh = _mesh;
texidx = _texidx;
texture_name = texture;
return;
}
TextureSwap::~TextureSwap(){}
void TextureSwap::ConsumeEvent() {
SURFHANDLE tex = oapiLoadTexture(texture_name.c_str());
DEVMESHHANDLE devmesh = VB1->GetDevMesh(VB1->visual, mesh);
oapiSetTexture(devmesh, texidx, tex);
return;
}
void TextureSwap::SetMesh(UINT _mesh) {
mesh = _mesh;
return;
}
UINT TextureSwap::GetMesh() {
return mesh;
}
void TextureSwap::SetTexIdx(DWORD _texidx) {
texidx = _texidx;
return;
}
DWORD TextureSwap::GetTexIdx() {
return texidx;
}
void TextureSwap::SetTextureName(string _texture) {
texture_name = _texture;
return;
}
string TextureSwap::GetTextureName() {
return texture_name;
}
Delete_Me::Delete_Me(VesselBuilder1* VB1) : Event(VB1) {}
Delete_Me::~Delete_Me(){}
void Delete_Me::ConsumeEvent() {
oapiDeleteVessel(VB1->GetHandle());
return;
}
PlaySoundEvent::PlaySoundEvent(VesselBuilder1* VB1, string _soundfile) :Event(VB1) {
soundfile = _soundfile;
}
PlaySoundEvent::~PlaySoundEvent(){}
void PlaySoundEvent::ConsumeEvent() {
PlaySound(soundfile.c_str(), NULL, SND_FILENAME | SND_ASYNC | SND_NODEFAULT);
}
void PlaySoundEvent::SetSoundFile(string filename) {
soundfile = filename;
}
string PlaySoundEvent::GetSoundFile() {
return soundfile;
}
EnableEvent::EnableEvent(VesselBuilder1* VB1, Event* _ev, bool _enable) :Event(VB1) {
ev = _ev;
enable = _enable;
return;
}
EnableEvent::~EnableEvent(){}
void EnableEvent::ConsumeEvent() {
ev->Enable(enable);
}
EventManager::EventManager(VesselBuilder1 *_VB1) {
VB1 = _VB1;
Events.clear();
return;
}
EventManager::~EventManager() {
VB1 = NULL;
}
Event* EventManager::CreateGeneralVBEvent(string name, Event::TYPE type, Event::TRIGGER _Trigger) {
Event* ev = NULL;
string empty;
empty.clear();
if (type == Event::NULL_EVENT) {
ev = CreateNullEvent(name, _Trigger);
}
else if (type == Event::CHILD_SPAWN) {
ev = CreateChildSpawnEvent(name, _Trigger, empty, empty);
}
else if (type == Event::ANIMATION_TRIGGER) {
ev = CreateAnimTriggerEvent(name, _Trigger, 0, true);
}
else if (type == Event::THRUSTER_FIRING) {
ev = CreateThrusterFireEvent(name, _Trigger, NULL);
}
else if (type == Event::THRUSTERGROUP_LEVEL) {
ev = CreateThrusterGroupLevelEvent(name, _Trigger, THGROUP_MAIN);
}
else if (type == Event::PAYLOAD_JETTISON) {
ev = CreatePayloadJettisonEvent(name, _Trigger);
}
else if (type == Event::RESET_MET) {
ev = CreateResetMetEvent(name, _Trigger);
}
else if (type == Event::RECONFIG) {
ev = CreateReconfigurationEvent(name, _Trigger, 0);
}
else if (type == Event::SHIFT_CG) {
ev = CreateShiftCGEvent(name, _Trigger);
}
else if (type == Event::TEXTURE_SWAP) {
ev = CreateTextureSwapEvent(name, _Trigger, 0, 0, empty);
}
else if (type == Event::DELETE_ME) {
ev = CreateDeleteMeEvent(name, _Trigger);
}
else if (type == Event::PLAYSOUND) {
ev = CreatePlaySoundEvent(name, _Trigger, empty);
}
else if (type == Event::ENABLE_EVENT) {
ev = CreateEnableEvent(name, _Trigger, NULL, true);
}
if (ev) {
ev->SetDefaultEnabled(true);
}
/*if (ev) {
ev->id = id_counter;
id_counter++;
ev->SetTrigger(_Trigger);
//ev->SetName(name);
}
Events.push_back(ev);*/
return ev;
}
Event* EventManager::CreateNullEvent(string name, Event::TRIGGER _Trigger) {
Event* ev = new NullEvent(VB1);
ev->SetTrigger(_Trigger);
string evname;
if (name.size() <= 0) {
char nbuf[256] = { '\0' };
sprintf(nbuf, "Null Event %i", Events.size());
evname.assign(nbuf);
}
else {
evname = name;
}
ev->SetName(evname);
ev->id = id_counter;
id_counter++;
Events.push_back(ev);
return ev;
}
Event* EventManager::CreateChildSpawnEvent(string name, Event::TRIGGER _Trigger, string v_name, string v_class, VECTOR3 ofs, VECTOR3 vel, VECTOR3 rot_vel, int mesh_to_del) {
Event* ev = new Child_Spawn(VB1, v_name, v_class, ofs, vel, rot_vel, mesh_to_del);
ev->SetTrigger(_Trigger);
string evname;
if (name.size() <= 0) {
char nbuf[256] = { '\0' };
sprintf(nbuf, "Child Spawn %i", Events.size());
evname.assign(nbuf);
}
else {
evname = name;
}
ev->SetName(evname);
ev->id = id_counter;
id_counter++;
Events.push_back(ev);
return ev;
}
Event* EventManager::CreateAnimTriggerEvent(string name, Event::TRIGGER _Trigger, UINT _anim_idx, bool _forward) {
Event* ev = new Anim_Trigger(VB1, _anim_idx, _forward);
ev->SetTrigger(_Trigger);
string evname;
if (name.size() <= 0) {
char nbuf[256] = { '\0' };
sprintf(nbuf, "Start Animation %i", Events.size());
evname.assign(nbuf);
}
else {
evname = name;
}
ev->SetName(evname);
ev->id = id_counter;
id_counter++;
Events.push_back(ev);
return ev;
}
Event* EventManager::CreateThrusterFireEvent(string name, Event::TRIGGER _Trigger, THRUSTER_HANDLE th, double level) {
Event* ev = new Thruster_Fire(VB1, th, level);
ev->SetTrigger(_Trigger);
string evname;
if (name.size() <= 0) {
char nbuf[256] = { '\0' };
sprintf(nbuf, "Thruster Fire %i", Events.size());
evname.assign(nbuf);
}
else {
evname = name;
}
ev->SetName(evname);
ev->id = id_counter;
id_counter++;
Events.push_back(ev);
return ev;
}
Event* EventManager::CreateThrusterGroupLevelEvent(string name, Event::TRIGGER _Trigger, THGROUP_TYPE thgroup_type, double level) {
Event* ev = new ThrusterGroup_Fire(VB1, thgroup_type, level);
ev->SetTrigger(_Trigger);
string evname;
if (name.size() <= 0) {
char nbuf[256] = { '\0' };
sprintf(nbuf, "Thruster Group Level %i", Events.size());
evname.assign(nbuf);
}
else {
evname = name;
}
ev->SetName(evname);
ev->id = id_counter;
id_counter++;
Events.push_back(ev);
return ev;
}
Event* EventManager::CreatePayloadJettisonEvent(string name, Event::TRIGGER _Trigger, bool next, UINT dock_idx) {
Event* ev = new Payload_Jettison(VB1, next, dock_idx);
ev->SetTrigger(_Trigger);
string evname;
if (name.size() <= 0) {
char nbuf[256] = { '\0' };
sprintf(nbuf, "Dock Jettison %i", Events.size());
evname.assign(nbuf);
}
else {
evname = name;
}
ev->SetName(evname);
ev->id = id_counter;
id_counter++;
Events.push_back(ev);
return ev;
}
Event* EventManager::CreateResetMetEvent(string name, Event::TRIGGER _Trigger, bool now , double newmjd0) {
Event* ev = new Reset_Met(VB1, now, newmjd0);
ev->SetTrigger(_Trigger);
string evname;
if (name.size() <= 0) {
char nbuf[256] = { '\0' };
sprintf(nbuf, "Reset MET %i", Events.size());
evname.assign(nbuf);
}
else {
evname = name;
}
ev->SetName(evname);
ev->id = id_counter;
id_counter++;
Events.push_back(ev);
return ev;
}
Event* EventManager::CreateReconfigurationEvent(string name, Event::TRIGGER _Trigger, UINT newconfig) {
Event* ev = new Reconfiguration(VB1, newconfig);
ev->SetTrigger(_Trigger);
string evname;
if (name.size() <= 0) {
char nbuf[256] = { '\0' };
sprintf(nbuf, "Reconfiguration %i", Events.size());
evname.assign(nbuf);
}
else {
evname = name;
}
ev->SetName(evname);
ev->id = id_counter;
id_counter++;
Events.push_back(ev);
return ev;
}
Event* EventManager::CreateShiftCGEvent(string name, Event::TRIGGER _Trigger, VECTOR3 shift) {
Event* ev = new ShiftCG(VB1, shift);
ev->SetTrigger(_Trigger);
string evname;
if (name.size() <= 0) {
char nbuf[256] = { '\0' };
sprintf(nbuf, "Shift CG %i", Events.size());
evname.assign(nbuf);
}
else {
evname = name;
}
ev->SetName(evname);
ev->id = id_counter;
id_counter++;
Events.push_back(ev);
return ev;
}
Event* EventManager::CreateTextureSwapEvent(string name, Event::TRIGGER _Trigger, UINT mesh, DWORD texidx, string texture_name) {
Event* ev = new TextureSwap(VB1, mesh,texidx,texture_name);
ev->SetTrigger(_Trigger);
string evname;
if (name.size() <= 0) {
char nbuf[256] = { '\0' };
sprintf(nbuf, "Texture Change %i", Events.size());
evname.assign(nbuf);
}
else {
evname = name;
}
ev->SetName(evname);
ev->id = id_counter;
id_counter++;
Events.push_back(ev);
return ev;
}
Event* EventManager::CreateDeleteMeEvent(string name, Event::TRIGGER _Trigger) {
Event* ev = new Delete_Me(VB1);
ev->SetTrigger(_Trigger);
string evname;
if (name.size() <= 0) {
char nbuf[256] = { '\0' };
sprintf(nbuf, "Delete Me %i", Events.size());
evname.assign(nbuf);
}
else {
evname = name;
}
ev->SetName(evname);
ev->id = id_counter;
id_counter++;
Events.push_back(ev);
return ev;
}
Event* EventManager::CreatePlaySoundEvent(string name, Event::TRIGGER _Trigger, string _soundfile) {
Event* ev = new PlaySoundEvent(VB1, _soundfile);
ev->SetTrigger(_Trigger);
string evname;
if (name.size() <= 0) {
char nbuf[256] = { '\0' };
sprintf(nbuf, "PlaySound %i", Events.size());
evname.assign(nbuf);
}
else {
evname = name;
}
ev->SetName(evname);
ev->id = id_counter;
id_counter++;
Events.push_back(ev);
return ev;
}
Event* EventManager::CreateEnableEvent(string name, Event::TRIGGER _Trigger, Event* _ev, bool _enable) {
Event* ev = new EnableEvent(VB1, _ev, _enable);
ev->SetTrigger(_Trigger);
string evname;
if (name.size() <= 0) {
char nbuf[256] = { '\0' };
sprintf(nbuf, "Enable %i", Events.size());
evname.assign(nbuf);
}
else {
evname = name;
}
ev->SetName(evname);
ev->id = id_counter;
id_counter++;
Events.push_back(ev);
return ev;
}
void EventManager::DeleteEvent(Event* ev) {
VBVector<Event*>::iterator it = find(Events.begin(), Events.end(), ev);
if (it != Events.end()) {
delete ev;
Events.erase(it);
}
return;
}
void EventManager::PreStep(double simt, double simdt, double mjd) {
for (UINT i = 0; i < Events.size(); i++) {
if (!Events[i]->IsEnabled()) { continue; }
Events[i]->EventPreStep(simt, simdt, mjd);
}
return;
}
void EventManager::ConsumeBufferedKey(DWORD key, bool down, char *kstate) {
if (Events.size() <= 0) { return; }
for (UINT i = 0; i < Events.size(); i++) {
if (!Events[i]->IsEnabled()) { continue; }
if (Events[i]->GetTriggerType()==Event::TRIGGER::TRIGGERTYPE::KEYPRESS){
Events[i]->ConsumeBufferedKey(key, down, kstate);
}
}
return;
}
void EventManager::DockEvent(int dock, OBJHANDLE mate) {
if (Events.size() <= 0) { return; }
for (UINT i = 0; i < Events.size(); i++) {
if (!Events[i]->IsEnabled()) { continue; }
if (Events[i]->GetTriggerType() == Event::TRIGGER::TRIGGERTYPE::DOCK_EVENT) {
Events[i]->EventDockEvent(dock, mate);
}
}
}
UINT EventManager::GetEventsCount() {
return Events.size();
}
string EventManager::GetEventName(UINT idx) {
return Events[idx]->GetName();
}
Event::TRIGGER::TRIGGERTYPE EventManager::GetEventTriggerType(UINT idx) {
return Events[idx]->GetTriggerType();
}
Event::TRIGGER EventManager::GetEventTrigger(UINT idx) {
return Events[idx]->GetTrigger();
}
void EventManager::SetEventName(UINT idx, string newname) {
Events[idx]->SetName(newname);
return;
}
Event* EventManager::GetEventH(UINT idx) {
return Events[idx];
}
void EventManager::Clear() {
/*aaVBVector<Event*>::iterator it = find(Events.begin(), Events.end(), ev);
if (it != Events.cend()) {
delete ev;
Events.erase(it);
}*/
for (UINT i = 0; i < Events.size(); i++) {
delete Events[i];
}
Events.clear();
return;
}
Event::TYPE EventManager::GetEventType(UINT idx) {
return Events[idx]->Type();
}
UINT EventManager::GetEventIdx(Event* ev) {
//int idx;
//Events.VBFind(ev, idx);
for (UINT i = 0; i < Events.size(); i++) {
if (Events[i] == ev) {
return i;
}
}
return 0;
}
void EventManager::SetSpawnedVesselName(UINT idx, string newName) {
((Child_Spawn*)Events[idx])->SetSpawnedVesselName(newName);
return;
}
void EventManager::SetSpawnedVesselClass(UINT idx, string newClass) {
((Child_Spawn*)Events[idx])->SetSpawnedVesselClass(newClass);
return;
}
void EventManager::SetOfs(UINT idx, VECTOR3 ofs) {
((Child_Spawn*)Events[idx])->SetOfs(ofs);
return;
}
void EventManager::SetVel(UINT idx, VECTOR3 vel) {
((Child_Spawn*)Events[idx])->SetVel(vel);
return;
}
void EventManager::SetRotVel(UINT idx, VECTOR3 rot_Vel) {
((Child_Spawn*)Events[idx])->SetRotVel(rot_Vel);
return;
}
string EventManager::GetSpawnedVesselName(UINT idx) {
return ((Child_Spawn*)Events[idx])->GetSpawnedVesselName();
}
string EventManager::GetSpawnedVesselClass(UINT idx) {
return ((Child_Spawn*)Events[idx])->GetSpawnedVesselClass();
}
VECTOR3 EventManager::GetOfs(UINT idx) {
return ((Child_Spawn*)Events[idx])->GetOfs();
}
VECTOR3 EventManager::GetVel(UINT idx) {
return ((Child_Spawn*)Events[idx])->GetVel();
}
VECTOR3 EventManager::GetRotVel(UINT idx) {
return ((Child_Spawn*)Events[idx])->GetRotVel();
}
int EventManager::GetMeshToDel(UINT idx) {
return ((Child_Spawn*)Events[idx])->GetMeshToDel();
}
void EventManager::SetMeshToDel(UINT idx, int msh) {
((Child_Spawn*)Events[idx])->SetMeshToDel(msh);
return;
}
void EventManager::SetAnimIdx(UINT idx, UINT _anim_idx) {
((Anim_Trigger*)Events[idx])->SetAnimIdx(_anim_idx);
return;
}
UINT EventManager::GetAnimIdx(UINT idx) {
return ((Anim_Trigger*)Events[idx])->GetAnimIdx();
}
void EventManager::SetForward(UINT idx, bool set) {
((Anim_Trigger*)Events[idx])->SetForward(set);
return;
}
bool EventManager::GetForward(UINT idx) {
return ((Anim_Trigger*)Events[idx])->GetForward();
}
void EventManager::SetThrusterTH(UINT idx, THRUSTER_HANDLE _th) {
((Thruster_Fire*)Events[idx])->SetThrusterTH(_th);
return;
}
THRUSTER_HANDLE EventManager::GetThrusterTH(UINT idx) {
return ((Thruster_Fire*)Events[idx])->GetThrusterTH();
}
void EventManager::SetThLevel(UINT idx, double _Level) {
((Thruster_Fire*)Events[idx])->SetLevel(_Level);
return;
}
double EventManager::GetThLevel(UINT idx) {
return ((Thruster_Fire*)Events[idx])->GetLevel();
}
void EventManager::SetThGroup(UINT idx, THGROUP_TYPE thgrp_type) {
((ThrusterGroup_Fire*)Events[idx])->SetThGroup(thgrp_type);
return;
}
THGROUP_TYPE EventManager::GetThGroup(UINT idx) {
return ((ThrusterGroup_Fire*)Events[idx])->GetThGroup();
}
void EventManager::SetThGLevel(UINT idx, double _level) {
((ThrusterGroup_Fire*)Events[idx])->SetLevel(_level);
return;
}
double EventManager::GetThGLevel(UINT idx) {
return ((ThrusterGroup_Fire*)Events[idx])->GetLevel();
}
void EventManager::SetDockIdx(UINT idx, UINT _dock_idx) {
((Payload_Jettison*)Events[idx])->SetDockIdx(_dock_idx);
return;
}
UINT EventManager::GetDockIdx(UINT idx) {
return ((Payload_Jettison*)Events[idx])->GetDockIdx();
}
void EventManager::SetNext(UINT idx, bool set) {
((Payload_Jettison*)Events[idx])->SetNext(set);
return;
}
bool EventManager::GetNext(UINT idx) {
return ((Payload_Jettison*)Events[idx])->GetNext();
}
void EventManager::SetNow(UINT idx, bool set) {
((Reset_Met*)Events[idx])->SetNow(set);
return;
}
bool EventManager::GetNow(UINT idx) {
return ((Reset_Met*)Events[idx])->GetNow();
}
void EventManager::SetNewMJD0(UINT idx, double _newmjd0) {
((Reset_Met*)Events[idx])->SetNewMJD0(_newmjd0);
return;
}
double EventManager::GetNewMJD0(UINT idx) {
return ((Reset_Met*)Events[idx])->GetNewMJD0();
}
void EventManager::SetNewConfig(UINT idx, UINT _newconfig) {
((Reconfiguration*)Events[idx])->SetNewConfig(_newconfig);
return;
}
UINT EventManager::GetNewConfig(UINT idx) {
return ((Reconfiguration*)Events[idx])->GetNewConfig();
}
void EventManager::SetShift(UINT idx, VECTOR3 _shift) {
((ShiftCG*)Events[idx])->SetShift(_shift);
return;
}
VECTOR3 EventManager::GetShift(UINT idx) {
return ((ShiftCG*)Events[idx])->GetShift();
}
void EventManager::SetMesh(UINT idx, UINT _mesh) {
((TextureSwap*)Events[idx])->SetMesh(_mesh);
return;
}
UINT EventManager::GetMesh(UINT idx) {
return ((TextureSwap*)Events[idx])->GetMesh();
}
void EventManager::SetTexIdx(UINT idx, DWORD _texidx) {
((TextureSwap*)Events[idx])->SetTexIdx(_texidx);
return;
}
DWORD EventManager::GetTexIdx(UINT idx) {
return ((TextureSwap*)Events[idx])->GetTexIdx();
}
void EventManager::SetTextureName(UINT idx, string _texture) {
((TextureSwap*)Events[idx])->SetTextureName(_texture);
return;
}
string EventManager::GetTextureName(UINT idx) {
return ((TextureSwap*)Events[idx])->GetTextureName();
}
void EventManager::SetSoundFile(UINT idx, string filename) {
((PlaySoundEvent*)Events[idx])->SetSoundFile(filename);
return;
}
string EventManager::GetSoundFile(UINT idx) {
return ((PlaySoundEvent*)Events[idx])->GetSoundFile();
}
void EventManager::SetToEnable(UINT idx, bool set) {
((EnableEvent*)Events[idx])->SetEnable(set);
return;
}
void EventManager::SetEventToEnable(UINT idx, Event* _ev) {
((EnableEvent*)Events[idx])->SetEvent(_ev);
return;
}
Event* EventManager::GetEventToEnable(UINT idx) {
return ((EnableEvent*)Events[idx])->GetEvent();
}
bool EventManager::GetToEnable(UINT idx) {
return ((EnableEvent*)Events[idx])->GetEnable();
}
void EventManager::SetEventTrigger(UINT idx, Event::TRIGGER _Trigger) {
Events[idx]->SetTrigger(_Trigger);
return;
}
bool EventManager::IsEventEnabled(UINT idx) {
return Events[idx]->IsEnabled();
}
void EventManager::SetEnableEvent(UINT idx, bool set) {
Events[idx]->Enable(set);
return;
}
bool EventManager::GetEventDefaultEnabled(UINT idx) {
return Events[idx]->GetDefaultEnabled();
}
void EventManager::SetEventDefaultEnabled(UINT idx, bool set) {
Events[idx]->SetDefaultEnabled(set);
return;
}
VBVector<UINT> EventManager::GetEventsConsumed() {
VBVector<UINT> consumed;
consumed.clear();
for (UINT i = 0; i < Events.size(); i++) {
if (Events[i]->IsEventConsumed()) {
consumed.push_back(i);
}
}
return consumed;
}
void EventManager::SetEventConsumed(UINT idx, bool set) {
Events[idx]->SetConsumed(set);
return;
}
VBVector<UINT> EventManager::GetEventsToReconsume() {
VBVector<UINT> to_reconsume;
to_reconsume.clear();
for (UINT i = 0; i < Events.size(); i++) {
if (Events[i]->IsEventConsumed()) {
if ((Events[i]->Type() == Event::TYPE::TEXTURE_SWAP) || (Events[i]->Type() == Event::TYPE::ENABLE_EVENT)) {
to_reconsume.push_back(i);
}
}
}
return to_reconsume;
}
void EventManager::ConsumeEvent(UINT idx) {
Events[idx]->ConsumeEvent();
return;
}
| 24.479037
| 245
| 0.698845
|
fredenigma
|
3794faa7d3354e109bf0ec34929b8c36b94d2603
| 1,249
|
cpp
|
C++
|
1828. Queries on Number of Points Inside a Circle/solution.cpp
|
ChrisKonstantinou/leetcode
|
f5ff58e4040a2352053c9db6106da3d94a3cf1e5
|
[
"MIT"
] | null | null | null |
1828. Queries on Number of Points Inside a Circle/solution.cpp
|
ChrisKonstantinou/leetcode
|
f5ff58e4040a2352053c9db6106da3d94a3cf1e5
|
[
"MIT"
] | 7
|
2022-02-20T14:18:22.000Z
|
2022-03-13T20:29:06.000Z
|
1828. Queries on Number of Points Inside a Circle/solution.cpp
|
ChrisKonstantinou/leetcode
|
f5ff58e4040a2352053c9db6106da3d94a3cf1e5
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;
class Solution
{
public:
bool isInside(vector<int>& point, vector<int>& circle)
{
// point[0] = x coord, point[1] = y coord
// circle[0] = x center coord, circle[1] = y circle coord, circle[2] = radius
int distance_square = ((circle[0] - point[0]) * (circle[0] - point[0])) +
((circle[1] - point[1]) * (circle[1] - point[1]));
return sqrt(distance_square) <= (double)circle[2];
}
vector<int> countPoints(vector<vector<int>>& points, vector<vector<int>>& queries)
{
vector<int> result;
int answer;
int q_size = queries.size();
int p_size = points.size();
for (int i = 0; i < q_size; i++)
{
answer = 0;
for (int j = 0; j < p_size; j++) if (isInside(points[j], queries[i])) answer++;
result.push_back(answer);
}
return result;
}
};
int main ()
{
Solution solution;
vector<vector<int>> points = {{1, 3}, {3, 3}, {5, 3}, {2, 2}};
vector<vector<int>> queries = {{2, 3, 1}, {4, 3, 1}, {1, 1, 2}};
for (int x : solution.countPoints(points, queries)) cout << x << " ";
}
| 27.755556
| 91
| 0.52522
|
ChrisKonstantinou
|
379aa88d0fd8b835dfac8525c194d99f492b523a
| 877
|
cpp
|
C++
|
Lavio/Lavio/Source/World.cpp
|
landon912/Lavio
|
c726f43ed98f630d68ea6bc234f367b67578c918
|
[
"MIT"
] | 1
|
2021-04-29T12:43:59.000Z
|
2021-04-29T12:43:59.000Z
|
Lavio/Lavio/Source/World.cpp
|
landon912/Lavio
|
c726f43ed98f630d68ea6bc234f367b67578c918
|
[
"MIT"
] | null | null | null |
Lavio/Lavio/Source/World.cpp
|
landon912/Lavio
|
c726f43ed98f630d68ea6bc234f367b67578c918
|
[
"MIT"
] | null | null | null |
// **************************************** Lavio Engine ****************************************
// **************************** Copyright (c) 2017 All Rights Reserved **************************
// ***************************** Landon Kirk (landonaddison@yahoo.com) **************************
#include "World.h"
#include "Platform/Factories/InputFactory.h"
namespace Lavio
{
World *World::worldInstance = nullptr;
World::World(Graphics::IWindow *window, API::APIManager *api)
{
Log::DebugLog("Created World");
Window = window;
this->APIManager = api;
LoadInput();
}
void World::LoadInput()
{
Input = API::InputFactory::CreateInput(APIManager->GetCurrentAPI());
Window->AssignedInputModule = Input;
Input->SetContextCallbacks(Window->GetWindow());
}
World::~World()
{
delete Window;
delete Input;
delete APIManager;
delete FontManager;
}
}
| 25.057143
| 97
| 0.549601
|
landon912
|
379f04c5eedbb1337c257086c7490d6ab37b31f1
| 240
|
cpp
|
C++
|
qscoj/The 16th UESTC Programming Contest Warmup # 2/data.cpp
|
emengdeath/acmcode
|
cc1b0e067464e754d125856004a991d6eb92a2cd
|
[
"MIT"
] | null | null | null |
qscoj/The 16th UESTC Programming Contest Warmup # 2/data.cpp
|
emengdeath/acmcode
|
cc1b0e067464e754d125856004a991d6eb92a2cd
|
[
"MIT"
] | null | null | null |
qscoj/The 16th UESTC Programming Contest Warmup # 2/data.cpp
|
emengdeath/acmcode
|
cc1b0e067464e754d125856004a991d6eb92a2cd
|
[
"MIT"
] | null | null | null |
#include<bits/stdc++.h>
using namespace std;
int main(){
// freopen("j.in","w",stdout);
srand((int)time(0));
int n=100;
cout<<n<<endl;
for (int i=1;i<=n;i++){
int x=rand()%10000;
// if (rand()&1)x=-x;
cout<<x<<' ';
}
return 0;
}
| 16
| 30
| 0.545833
|
emengdeath
|
37a053f8b73053329a2969d5247bcc914ff93211
| 3,255
|
cpp
|
C++
|
src/autowiring/test/DtorCorrectnessTest.cpp
|
CaseyCarter/autowiring
|
48e95a71308318c8ffb7ed1348e034fd9110f70c
|
[
"Apache-2.0"
] | 87
|
2015-01-18T00:43:06.000Z
|
2022-02-11T17:40:50.000Z
|
src/autowiring/test/DtorCorrectnessTest.cpp
|
CaseyCarter/autowiring
|
48e95a71308318c8ffb7ed1348e034fd9110f70c
|
[
"Apache-2.0"
] | 274
|
2015-01-03T04:50:49.000Z
|
2021-03-08T09:01:09.000Z
|
src/autowiring/test/DtorCorrectnessTest.cpp
|
CaseyCarter/autowiring
|
48e95a71308318c8ffb7ed1348e034fd9110f70c
|
[
"Apache-2.0"
] | 15
|
2015-09-30T20:58:43.000Z
|
2020-12-19T21:24:56.000Z
|
// Copyright (C) 2012-2018 Leap Motion, Inc. All rights reserved.
#include "stdafx.h"
#include <autowiring/CoreThread.h>
#include ATOMIC_HEADER
using namespace std;
class CtorDtorListener;
template<int i>
class MyCtorDtorListenerN;
class DtorCorrectnessTest :
public testing::Test
{
public:
DtorCorrectnessTest(void);
void SetUp(void) override;
AutoRequired<MyCtorDtorListenerN<1>> listener1;
AutoRequired<MyCtorDtorListenerN<2>> listener2;
};
class CtorDtorCopyCounter {
public:
static std::atomic<int> s_outstanding;
static std::atomic<size_t> s_construction;
CtorDtorCopyCounter(void) {
s_outstanding++;
s_construction++;
}
CtorDtorCopyCounter(const CtorDtorCopyCounter&) {
s_outstanding++;
s_construction++;
}
~CtorDtorCopyCounter(void) {
s_outstanding--;
}
};
std::atomic<int> CtorDtorCopyCounter::s_outstanding;
std::atomic<size_t> CtorDtorCopyCounter::s_construction;
class MyCtorDtorListener:
public CoreThread
{
public:
MyCtorDtorListener(void):
CoreThread("MyCtorDtorListener")
{}
bool m_hitDeferred = false;
void DoDeferred(CtorDtorCopyCounter ctr) {
*this += [this] {
m_hitDeferred = true;
};
}
};
template<int i>
class MyCtorDtorListenerN:
public MyCtorDtorListener
{
public:
MyCtorDtorListenerN(void)
{}
};
DtorCorrectnessTest::DtorCorrectnessTest(void) {
}
void DtorCorrectnessTest::SetUp(void) {
// Reset counter:
CtorDtorCopyCounter::s_outstanding = 0;
CtorDtorCopyCounter::s_construction = 0;
}
TEST_F(DtorCorrectnessTest, VerifyDeferringDtors) {
AutoCurrentContext()->Initiate();
{
CtorDtorCopyCounter tempCounter;
ASSERT_EQ(1UL, CtorDtorCopyCounter::s_construction) << "Constructor count was not incremented correctly";
CtorDtorCopyCounter::s_construction = 0;
}
ASSERT_EQ(0, CtorDtorCopyCounter::s_outstanding) << "Unexpected number of outstanding instances";
// Simple check of anonymous instance handling:
CtorDtorCopyCounter();
ASSERT_EQ(1UL, CtorDtorCopyCounter::s_construction) << "Constructor count was not incremented correctly";
CtorDtorCopyCounter::s_construction = 0;
ASSERT_EQ(0, CtorDtorCopyCounter::s_outstanding) << "Unexpected number of outstanding instances";
// Verify that the thread didn't exit too soon:
ASSERT_FALSE(listener1->ShouldStop()) << "Thread was signalled to stop even though it should have been deferring";
// Now try deferring:
listener1->DoDeferred({});
listener2->DoDeferred({});
// Process all deferred elements and then check to see what we got:
AutoCurrentContext ctxt;
ctxt->Initiate();
listener1->Stop(true);
listener2->Stop(true);
listener1->Wait();
listener2->Wait();
// Verify that we actually hit something:
ASSERT_TRUE(listener1->m_hitDeferred) << "Failed to hit listener #1's deferred call";
ASSERT_TRUE(listener2->m_hitDeferred) << "Failed to hit listener #2's deferred call";
// Release all of our pointers:
listener1.reset();
listener2.reset();
// Verify hit counts:
ASSERT_LE(2UL, CtorDtorCopyCounter::s_construction) << "Counter constructors were not invoked the expected number of times when deferred";
ASSERT_EQ(0, CtorDtorCopyCounter::s_outstanding) << "Counter mismatch under deferred events";
}
| 26.463415
| 140
| 0.745008
|
CaseyCarter
|
37a05ea2d6f3a57b95a6bdf3ad31ea6489f607a5
| 1,350
|
cpp
|
C++
|
dynamic_programming/basic/codeforces/F1363B/Solution.cpp
|
ashtishad/problem-solving
|
5dfb71b04c2334c2cce53afd089ae1634b7e8100
|
[
"MIT"
] | 17
|
2020-11-12T17:41:41.000Z
|
2021-10-01T13:19:42.000Z
|
dynamic_programming/basic/codeforces/F1363B/Solution.cpp
|
ashtishad/problem-solving
|
5dfb71b04c2334c2cce53afd089ae1634b7e8100
|
[
"MIT"
] | 15
|
2019-09-23T06:33:47.000Z
|
2020-06-04T18:55:45.000Z
|
dynamic_programming/basic/codeforces/F1363B/Solution.cpp
|
ashtishad/problem-solving
|
5dfb71b04c2334c2cce53afd089ae1634b7e8100
|
[
"MIT"
] | 16
|
2019-09-21T23:19:58.000Z
|
2020-06-18T07:26:39.000Z
|
// problem name: Subsequence Hate
// problem link: https://codeforces.com/contest/1363/problem/B
// contest link: https://codeforces.com/contest/1363
// time: (?)
// author: reyad
// other_tags: data structures, brute force, strings, implementation
// difficulty_level: beginner
#include <bits/stdc++.h>
using namespace std;
#define N 1024
char s[N];
int one[N];
int zero[N];
int main() {
int tc;
scanf("%d", &tc);
for(int cc=0; cc<tc; cc++) {
scanf("%s", s);
int n = strlen(s);
for(int i=0; i<n; i++) {
one[i] = 0;
zero[i] = 0;
}
for(int i=0; i<n; i++) {
if(s[i] == '1') {
one[i] = ((i == 0) ? 1 : (one[i-1] + 1));
zero[i] = ((i == 0) ? 0 : zero[i-1]);
} else {
one[i] = ((i == 0) ? 0 : one[i-1]);
zero[i] = ((i == 0) ? 1 : (zero[i-1] + 1));
}
}
// printf("%d %d\n", one[n-1], zero[n-1]);
int mn = 987654321;
for(int i=0; i<n; i++) {
// taking 0..i as left and i+1...n-1 as right
// taking left all 0 and right 1: so we've to change left 1's and right 0's
mn = min(one[i] + zero[n-1] - zero[i], mn);
// printf("%d: %d %d\n", i, one[i], zero[n-1] - zero[i]);
// taking left all 1 and right 0: so we've to change left 0's and right 1's
mn = min(zero[i] + one[n-1] - one[i], mn);
}
printf("%d\n", mn);
}
return 0;
}
| 25
| 79
| 0.508889
|
ashtishad
|
37a1124543c026461cc4d855173c2bf58440d67b
| 5,716
|
cpp
|
C++
|
IndieLib/tutorials/basic/03_IND_Image/Tutorial03.cpp
|
DarthMike/indielib-crossplatform
|
473a589ae050b6d1c274cf58adf08731e63ae870
|
[
"Zlib"
] | 29
|
2015-03-05T08:11:23.000Z
|
2020-11-11T08:27:22.000Z
|
IndieLib/tutorials/basic/03_IND_Image/Tutorial03.cpp
|
PowerOlive/indielib-crossplatform
|
473a589ae050b6d1c274cf58adf08731e63ae870
|
[
"Zlib"
] | 1
|
2019-04-03T18:59:01.000Z
|
2019-04-14T11:46:45.000Z
|
IndieLib/tutorials/basic/03_IND_Image/Tutorial03.cpp
|
PowerOlive/indielib-crossplatform
|
473a589ae050b6d1c274cf58adf08731e63ae870
|
[
"Zlib"
] | 9
|
2015-03-05T08:17:10.000Z
|
2021-08-09T07:15:37.000Z
|
/*****************************************************************************************
* Desc: Tutorial a) 03 Ind_Image
*****************************************************************************************/
/*********************************** The zlib License ************************************
*
* Copyright (c) 2013 Indielib-crossplatform Development Team
*
* 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 "CIndieLib.h"
#include "IND_Surface.h"
#include "IND_Entity2d.h"
#include "IND_Image.h"
#include "../../WorkingPath.h"
/*
==================
Main
==================
*/
Indielib_Main
{
//Sets the working path at the resources directory. Resources paths are relative to that directory
if (!WorkingPathSetup::setWorkingPath(WorkingPathSetup::resourcesDirectory())) {
std::cout<<"\nUnable to Set the working path !";
}
// ----- IndieLib intialization -----
CIndieLib *mI = CIndieLib::instance();
if (!mI->init()) return 0;
// ----- Loading of the original image and making 4 duplicates -----
IND_Image *mImageBugOriginal = IND_Image::newImage();
if (!mI->_imageManager->add(mImageBugOriginal, "Enemy Bug.png")) return 0;
IND_Image *mImageBugGaussian = IND_Image::newImage();
if (!mI->_imageManager->clone(mImageBugGaussian, mImageBugOriginal)) return 0;
IND_Image *mImageBugPixelize = IND_Image::newImage();
if (!mI->_imageManager->clone(mImageBugPixelize, mImageBugOriginal)) return 0;
IND_Image *mImageBugContrast = IND_Image::newImage();
if (!mI->_imageManager->clone(mImageBugContrast, mImageBugOriginal)) return 0;
// ----- Applying filters -----
mImageBugGaussian->gaussianBlur(5);
mImageBugPixelize->pixelize(5);
mImageBugContrast->contrast(60);
// ----- Surface creation -----
// Loading Background
IND_Surface *mSurfaceBack = IND_Surface::newSurface();
if (!mI->_surfaceManager->add(mSurfaceBack, "blue_background.jpg", IND_OPAQUE, IND_32)) return 0;
// Creating the "Original Bug" surface from the IND_Image
IND_Surface *mOriginalSurface = IND_Surface::newSurface();
if (!mI->_surfaceManager->add(mOriginalSurface, mImageBugOriginal, IND_ALPHA, IND_32)) return 0;
// Creating the "Gaussian bug" surface from the IND_Image
IND_Surface *mGaussianSurface = IND_Surface::newSurface();
if (!mI->_surfaceManager->add(mGaussianSurface, mImageBugGaussian, IND_ALPHA, IND_32)) return 0;
// Creating the "Pixelize bug" surface from the IND_Image
IND_Surface *mPixelizeSurface = IND_Surface::newSurface();
if (!mI->_surfaceManager->add(mPixelizeSurface, mImageBugPixelize, IND_ALPHA, IND_32)) return 0;
// Creating the "Contrast bug" surface from the IND_Image
IND_Surface *mContrastSurface = IND_Surface::newSurface();
if (!mI->_surfaceManager->add(mContrastSurface, mImageBugContrast, IND_ALPHA, IND_32)) return 0;
// ----- Deleting of images -----
mI->_imageManager->remove(mImageBugOriginal);
mI->_imageManager->remove(mImageBugGaussian);
mI->_imageManager->remove(mImageBugPixelize);
mI->_imageManager->remove(mImageBugContrast);
// ----- Set the surfaces into the 2d entities -----
// Creating 2d entity for the background
IND_Entity2d *mBack = IND_Entity2d::newEntity2d();
mI->_entity2dManager->add(mBack); // Entity adding
mBack->setSurface(mSurfaceBack); // Set the surface into the entity
// Creating 2d entity for the "Original bug"
IND_Entity2d *mOriginal = IND_Entity2d::newEntity2d();
mI->_entity2dManager->add(mOriginal); // Entity adding
mOriginal->setSurface(mOriginalSurface); // Set the surface into the entity
// Creating 2d entity for the "Gaussian bug"
IND_Entity2d *mGaussian = IND_Entity2d::newEntity2d();
mI->_entity2dManager->add(mGaussian); // Entity adding
mGaussian->setSurface(mGaussianSurface); // Set the surface into the entity
// Creating 2d entity for the "pixelize bug"
IND_Entity2d *mPixelize = IND_Entity2d::newEntity2d();
mI->_entity2dManager->add(mPixelize); // Entity adding
mPixelize->setSurface(mPixelizeSurface); // Set the surface into the entity
// Creating 2d entity for the "Contrast bug"
IND_Entity2d *mContrast = IND_Entity2d::newEntity2d();
mI->_entity2dManager->add(mContrast); // Entity adding
mContrast->setSurface(mContrastSurface); // Set the surface into the entity
// ----- Changing the attributes of the 2d entities -----
mOriginal->setPosition(290, 90, 0);
mGaussian->setPosition( 50, 230, 0);
mPixelize->setPosition(290, 230, 0);
mContrast->setPosition(520, 230, 0);
// ----- Main Loop -----
while (!mI->_input->onKeyPress(IND_ESCAPE) && !mI->_input->quit())
{
mI->_input->update();
mI->_render->beginScene();
mI->_entity2dManager->renderEntities2d();
mI->_render->endScene();
}
// ----- Free -----
mI->end();
return 0;
}
| 37.116883
| 102
| 0.675297
|
DarthMike
|
37a112fa7652063fbe656f38c8492f2670566def
| 23,614
|
cpp
|
C++
|
test/test.cpp
|
bb107/Certificate
|
161cbf04132a437718a338f378672cfd0010c244
|
[
"Apache-2.0"
] | 2
|
2019-11-20T18:23:04.000Z
|
2020-09-23T03:14:19.000Z
|
test/test.cpp
|
bb107/Certificate
|
161cbf04132a437718a338f378672cfd0010c244
|
[
"Apache-2.0"
] | null | null | null |
test/test.cpp
|
bb107/Certificate
|
161cbf04132a437718a338f378672cfd0010c244
|
[
"Apache-2.0"
] | null | null | null |
#include "../Certificate/stdafx.h"
#include <cstdio>
#pragma warning(disable:4996)
LPCSTR ekus[] = {
szOID_PKIX_KP_SERVER_AUTH,
szOID_PKIX_KP_CLIENT_AUTH,
szOID_PKIX_KP_CODE_SIGNING,
szOID_PKIX_KP_EMAIL_PROTECTION,
szOID_PKIX_KP_IPSEC_END_SYSTEM,
szOID_PKIX_KP_IPSEC_TUNNEL,
szOID_PKIX_KP_IPSEC_USER,
szOID_PKIX_KP_TIMESTAMP_SIGNING,
szOID_PKIX_KP_OCSP_SIGNING,
szOID_PKIX_OCSP_NOCHECK,
szOID_PKIX_OCSP_NONCE,
szOID_IPSEC_KP_IKE_INTERMEDIATE,
szOID_PKINIT_KP_KDC,
szOID_KP_CTL_USAGE_SIGNING,
szOID_KP_TIME_STAMP_SIGNING,
szOID_SERVER_GATED_CRYPTO,
szOID_SGC_NETSCAPE,
szOID_KP_EFS,
szOID_EFS_RECOVERY,
szOID_WHQL_CRYPTO,
szOID_ATTEST_WHQL_CRYPTO,
szOID_NT5_CRYPTO,
szOID_OEM_WHQL_CRYPTO,
szOID_EMBEDDED_NT_CRYPTO,
szOID_ROOT_LIST_SIGNER,
szOID_KP_QUALIFIED_SUBORDINATION,
szOID_KP_KEY_RECOVERY,
szOID_KP_DOCUMENT_SIGNING,
szOID_KP_LIFETIME_SIGNING,
szOID_KP_MOBILE_DEVICE_SOFTWARE,
szOID_KP_SMART_DISPLAY,
szOID_KP_CSP_SIGNATURE,
szOID_KP_FLIGHT_SIGNING,
szOID_PLATFORM_MANIFEST_BINARY_ID,
szOID_DRM,
szOID_DRM_INDIVIDUALIZATION,
szOID_LICENSES,
szOID_LICENSE_SERVER,
szOID_KP_SMARTCARD_LOGON,
szOID_KP_KERNEL_MODE_CODE_SIGNING,
szOID_KP_KERNEL_MODE_TRUSTED_BOOT_SIGNING,
szOID_REVOKED_LIST_SIGNER,
szOID_WINDOWS_KITS_SIGNER,
szOID_WINDOWS_RT_SIGNER,
szOID_PROTECTED_PROCESS_LIGHT_SIGNER,
szOID_WINDOWS_TCB_SIGNER,
szOID_PROTECTED_PROCESS_SIGNER,
szOID_WINDOWS_THIRD_PARTY_COMPONENT_SIGNER,
szOID_WINDOWS_SOFTWARE_EXTENSION_SIGNER,
szOID_DISALLOWED_LIST,
szOID_IUM_SIGNING,
szOID_EV_WHQL_CRYPTO,
szOID_BIOMETRIC_SIGNING,
szOID_ENCLAVE_SIGNING,
szOID_SYNC_ROOT_CTL_EXT,
szOID_HPKP_DOMAIN_NAME_CTL,
szOID_HPKP_HEADER_VALUE_CTL,
szOID_KP_KERNEL_MODE_HAL_EXTENSION_SIGNING,
szOID_WINDOWS_STORE_SIGNER,
szOID_DYNAMIC_CODE_GEN_SIGNER,
szOID_MICROSOFT_PUBLISHER_SIGNER
};
//
// Root CA
//
PCERT_INFO CreateRootCA(
_Out_ LPBYTE* cer,
_Out_ LPDWORD len,
_Out_ PHANDLE Key) {
*cer = nullptr;
*len = 0;
*Key = nullptr;
HANDLE hBuilder = nullptr;
HANDLE hKey = nullptr;
KEY_USAGE ku{};
ku.Flags = 0x80ff;
SYSTEMTIME NotBefore, NotAfter;
NotBefore.wYear = 2021;
NotBefore.wMonth = 1;
NotBefore.wDayOfWeek = 5;
NotBefore.wDay = 1;
NotBefore.wHour = 0;
NotBefore.wMinute = 0;
NotBefore.wSecond = 0;
NotBefore.wMilliseconds = 0;
NotAfter.wYear = 2040;
NotAfter.wMonth = 12;
NotAfter.wDayOfWeek = 1;
NotAfter.wDay = 31;
NotAfter.wHour = 23;
NotAfter.wMinute = 59;
NotAfter.wSecond = 59;
NotAfter.wMilliseconds = 999;
PCERT_INFO cert = nullptr;
LPBYTE signedCert = nullptr;
DWORD signedCertLength = 0;
BOOL success = FALSE;
do {
if (!CreateRSAKey(&hKey, 2048))break;
if (!CreateX509CertBuilder(&hBuilder, nullptr))break;
if (!X509CertBuilderSetSubjectName(hBuilder, "CN=TEST Root CA"))break;
if (!X509CertBuilderSetEffectiveTime(hBuilder, &NotBefore, &NotAfter))break;
if (!X509CertBuilderSetIssuerName(hBuilder, nullptr))break;
if (!X509CertBuilderSetSignatureAlgorithm(hBuilder, SIGNATURE_ALGORITHM::sha256RSA, nullptr))break;
if (!X509CertBuilderSetSubjectKeyIdentifier(hBuilder, hKey, FALSE))break;
if (!X509CertBuilderSetKeyUsage(hBuilder, ku, TRUE))break;
if (!X509CertBuilderSetBasicConstraint(hBuilder, 10, X509_CERT_SUBJECT_TYPE_CA, FALSE))break;
if (!X509CertBuilderSetSubjectPublicKeyInfo(hBuilder, hKey))break;
if (!X509CertBuilderCreateCertInfo(&cert, hBuilder))break;
if (!IssuerSignCertificate(&signedCert, &signedCertLength, cert, hKey))break;
success = TRUE;
} while (false);
CloseX509CertBuilder(hBuilder);
if (!success) {
X509CertBuilderFreeCertInfo(cert);
CloseRSAKey(hKey);
cert = nullptr;
}
else {
*cer = signedCert;
*len = signedCertLength;
*Key = hKey;
}
return cert;
}
//
// SSL CA
//
PCERT_INFO CreateSSLSubjectCA(
_In_ PCERT_INFO issuer,
_In_ HANDLE issuerKey,
_Out_ LPBYTE* cer,
_Out_ LPDWORD len,
_Out_ PHANDLE subjectKey) {
*cer = nullptr;
*len = 0;
*subjectKey = nullptr;
HANDLE hBuilder = nullptr;
HANDLE hKey = nullptr;
KEY_USAGE ku{};
ku.DigitalSignature = TRUE;
ku.KeyEncipherment = TRUE;
ku.KeyCertSign = TRUE;
LPBYTE buffer = new BYTE[sizeof(CERT_ENHANCED_KEY_USAGE_LIST) + sizeof(LPCSTR) * 2];
PCERT_ENHANCED_KEY_USAGE_LIST el = (PCERT_ENHANCED_KEY_USAGE_LIST)buffer;
el->dwEnhancedKeyUsage = 2;
el->EKUs[0] = szOID_PKIX_KP_CLIENT_AUTH;
el->EKUs[1] = szOID_PKIX_KP_SERVER_AUTH;
CERT_POLICY_QUALIFIER qualifier{};
CERT_POLICY policiesBuffer[2];
BYTE policiesListBuffer[sizeof(CERT_POLICY_LIST) + sizeof(PCERT_POLICY) * 2];
PCERT_POLICY_LIST policies = PCERT_POLICY_LIST(&policiesListBuffer[0]);
policies->dwPolicyInfo = 2;
policies->Policies = policiesBuffer;
policies->Policies[0].dwPolicyQualifier = 0;
policies->Policies[0].PolicyIdentifier = "2.23.140.1.1";
policies->Policies[1].dwPolicyQualifier = 1;
policies->Policies[1].PolicyIdentifier = "2.16.840.1.114412.2.1";
policies->Policies[1].PolicyQualifiers = &qualifier;
qualifier.PolicyQualifierId = X509_CERT_POLICY_QUALIFIER_CPS;
qualifier.Qualifier = "http://127.0.0.1";
PCERT_INFO cert = nullptr;
LPBYTE signedCert = nullptr;
DWORD signedCertLength = 0;
BOOL success = FALSE;
do {
if (!CreateRSAKey(&hKey, 2048))break;
if (!CreateX509CertBuilder(&hBuilder, nullptr))break;
if (!X509CertBuilderSetSubjectName(hBuilder, "CN=TEST SSL RSA CA G1"))break;
if (!X509CertBuilderSetIssuerName(hBuilder, &issuer->Subject))break;
if (!X509CertBuilderSetSignatureAlgorithm(hBuilder, SIGNATURE_ALGORITHM::sha256RSA, nullptr))break;
if (!X509CertBuilderSetSubjectKeyIdentifier(hBuilder, hKey, FALSE))break;
if (!X509CertBuilderSetAuthorityKeyIdentifier(hBuilder, nullptr, nullptr, issuerKey, FALSE))break;
if (!X509CertBuilderSetKeyUsage(hBuilder, ku, TRUE))break;
if (!X509CertBuilderSetBasicConstraint(hBuilder, -1, X509_CERT_SUBJECT_TYPE_CA, FALSE))break;
if (!X509CertBuilderSetEnhancedKeyUsage(hBuilder, el, FALSE))break;
if (!X509CertBuilderSetSubjectPublicKeyInfo(hBuilder, hKey))break;
if (!X509CertBuilderSetPolicies(hBuilder, policies, FALSE))break;
if (!X509CertBuilderCreateCertInfo(&cert, hBuilder))break;
if (!IssuerSignCertificate(&signedCert, &signedCertLength, cert, issuerKey))break;
success = TRUE;
} while (false);
CloseX509CertBuilder(hBuilder);
if (!success) {
X509CertBuilderFreeCertInfo(cert);
CloseRSAKey(hKey);
cert = nullptr;
}
else {
*cer = signedCert;
*len = signedCertLength;
*subjectKey = hKey;
}
return cert;
}
//
// Code Signing CA
//
PCERT_INFO CreateCodeSignSubjectCA(
_In_ PCERT_INFO issuer,
_In_ HANDLE issuerKey,
_Out_ LPBYTE* cer,
_Out_ LPDWORD len,
_Out_ PHANDLE subjectKey) {
*cer = nullptr;
*len = 0;
*subjectKey = nullptr;
HANDLE hBuilder = nullptr;
HANDLE hKey = nullptr;
KEY_USAGE ku{};
ku.DigitalSignature = TRUE;
ku.DataEncipherment = TRUE;
ku.KeyCertSign = TRUE;
LPBYTE buffer = new BYTE[sizeof(CERT_ENHANCED_KEY_USAGE_LIST) + sizeof(ekus)];
PCERT_ENHANCED_KEY_USAGE_LIST el = (PCERT_ENHANCED_KEY_USAGE_LIST)buffer;
el->dwEnhancedKeyUsage = sizeof(ekus) / sizeof(LPCSTR);
RtlCopyMemory(
&el->EKUs[0],
&ekus[0],
sizeof(ekus)
);
PCERT_INFO cert = nullptr;
LPBYTE signedCert = nullptr;
DWORD signedCertLength = 0;
BOOL success = FALSE;
do {
if (!CreateRSAKey(&hKey, 2048))break;
if (!CreateX509CertBuilder(&hBuilder, nullptr))break;
if (!X509CertBuilderSetSubjectName(hBuilder, "CN=TEST Code Signing RSA CA G1"))break;
if (!X509CertBuilderSetIssuerName(hBuilder, &issuer->Subject))break;
if (!X509CertBuilderSetSignatureAlgorithm(hBuilder, SIGNATURE_ALGORITHM::sha256RSA, nullptr))break;
if (!X509CertBuilderSetSubjectKeyIdentifier(hBuilder, hKey, FALSE))break;
if (!X509CertBuilderSetAuthorityKeyIdentifier(hBuilder, nullptr, nullptr, issuerKey, FALSE))break;
if (!X509CertBuilderSetKeyUsage(hBuilder, ku, TRUE))break;
if (!X509CertBuilderSetBasicConstraint(hBuilder, -1, X509_CERT_SUBJECT_TYPE_CA, FALSE))break;
if (!X509CertBuilderSetEnhancedKeyUsage(hBuilder, el, FALSE))break;
if (!X509CertBuilderSetSubjectPublicKeyInfo(hBuilder, hKey))break;
if (!X509CertBuilderCreateCertInfo(&cert, hBuilder))break;
if (!IssuerSignCertificate(&signedCert, &signedCertLength, cert, issuerKey))break;
success = TRUE;
} while (false);
CloseX509CertBuilder(hBuilder);
if (!success) {
X509CertBuilderFreeCertInfo(cert);
CloseRSAKey(hKey);
cert = nullptr;
}
else {
*cer = signedCert;
*len = signedCertLength;
*subjectKey = hKey;
}
return cert;
}
//
// SSL Server: *.localhost.com
//
PCERT_INFO CreateSSLSubject(
_In_ PCERT_INFO issuer,
_In_ HANDLE issuerKey,
_Out_ LPBYTE* cer,
_Out_ LPDWORD len,
_Out_ PHANDLE subjectKey) {
*cer = nullptr;
*len = 0;
*subjectKey = nullptr;
HANDLE hBuilder = nullptr;
HANDLE hKey = nullptr;
KEY_USAGE ku{};
ku.DigitalSignature = TRUE;
ku.KeyEncipherment = TRUE;
BYTE buffer[sizeof(CERT_ENHANCED_KEY_USAGE_LIST) + sizeof(LPCSTR) * 2];
PCERT_ENHANCED_KEY_USAGE_LIST el = (PCERT_ENHANCED_KEY_USAGE_LIST)&buffer[0];
el->dwEnhancedKeyUsage = 2;
el->EKUs[0] = szOID_PKIX_KP_CLIENT_AUTH;
el->EKUs[1] = szOID_PKIX_KP_SERVER_AUTH;
BYTE sanBuffer[sizeof(CERT_SAN) * 2];
CERT_SAN_LIST san{};
san.dwSAN = 2;
san.SANs = PCERT_SAN(&sanBuffer[0]);
san.SANs[0].type = X509_CERT_SAN_TYPE_DNS;
san.SANs[0].SAN = "*.localhost.com";
san.SANs[1].type = X509_CERT_SAN_TYPE_DNS;
san.SANs[1].SAN = "test.localhost.com";
CERT_POLICY_QUALIFIER qualifier{};
CERT_POLICY policiesBuffer[2];
BYTE policiesListBuffer[sizeof(CERT_POLICY_LIST) + sizeof(PCERT_POLICY) * 2];
PCERT_POLICY_LIST policies=PCERT_POLICY_LIST(&policiesListBuffer[0]);
policies->dwPolicyInfo = 2;
policies->Policies = policiesBuffer;
policies->Policies[0].dwPolicyQualifier = 0;
policies->Policies[0].PolicyIdentifier = "2.23.140.1.1";
policies->Policies[1].dwPolicyQualifier = 1;
policies->Policies[1].PolicyIdentifier = "2.16.840.1.114412.2.1";
policies->Policies[1].PolicyQualifiers = &qualifier;
qualifier.PolicyQualifierId = X509_CERT_POLICY_QUALIFIER_CPS;
qualifier.Qualifier = "http://127.0.0.1";
BYTE aiaBuffer[sizeof(CERT_AUTHORITY_INFO_ACCESS_LIST) * 2];
PCERT_AUTHORITY_INFO_ACCESS_LIST aia=(PCERT_AUTHORITY_INFO_ACCESS_LIST)&aiaBuffer[0];
aia->dwAccDescr = 2;
aia->AccDescrs[0].AccessMethod = X509_CERT_AYTHORITY_INFO_ACCESS_METHOD_OCSP;
aia->AccDescrs[0].AccessLocation.dwType = X509_CERT_AUTHORITY_INFO_ACCESS_LOCATION_URL;
aia->AccDescrs[0].AccessLocation.Name = "http://127.0.0.1";
aia->AccDescrs[1].AccessMethod = X509_CERT_AYTHORITY_INFO_ACCESS_METHOD_CA_ISSUERS;
aia->AccDescrs[1].AccessLocation.dwType = X509_CERT_AUTHORITY_INFO_ACCESS_LOCATION_URL;
aia->AccDescrs[1].AccessLocation.Name = "http://127.0.0.1/certs/sslca.cer";
CERT_CRL_DIST_POINT_NAME_LIST crl{};
CERT_CRL_DIST_POINT_LIST crll{};
crl.dwName = 1;
crl.dwType = X509_CERT_CRL_DIST_POINT_NAME_TYPE_FULL_NAME;
crl.Names[0].dwType = X509_CERT_CRL_DIST_POINT_NAME_URL;
crl.Names[0].Name = "http://127.0.0.1";
crll.dwCRL = 1;
crll.CRLs->DistPointNames = &crl;
PCERT_INFO cert = nullptr;
LPBYTE signedCert = nullptr;
DWORD signedCertLength = 0;
BOOL success = FALSE;
do {
if (!CreateRSAKey(&hKey, 2048))break;
if (!CreateX509CertBuilder(&hBuilder, nullptr))break;
if (!X509CertBuilderSetSubjectName(hBuilder, "CN=test.localhost.com,S=ShanDong,C=CN,2.5.4.15=TEST,1.3.6.1.4.1.311.60.2.1.3=CN,2.5.4.5=123456"))break;
if (!X509CertBuilderSetIssuerName(hBuilder, &issuer->Subject))break;
if (!X509CertBuilderSetSignatureAlgorithm(hBuilder, SIGNATURE_ALGORITHM::sha256RSA, nullptr))break;
if (!X509CertBuilderSetSubjectKeyIdentifier(hBuilder, hKey, FALSE))break;
if (!X509CertBuilderSetAuthorityKeyIdentifier(hBuilder, nullptr, nullptr, issuerKey, FALSE))break;
if (!X509CertBuilderSetKeyUsage(hBuilder, ku, TRUE))break;
if (!X509CertBuilderSetBasicConstraint(hBuilder, -1, X509_CERT_SUBJECT_TYPE_END, TRUE))break;
if (!X509CertBuilderSetEnhancedKeyUsage(hBuilder, el, FALSE))break;
if (!X509CertBuilderSetSubjectAlternativeName(hBuilder, &san, FALSE))break;
if (!X509CertBuilderSetPolicies(hBuilder, policies, FALSE))break;
if (!X509CertBuilderSetSubjectPublicKeyInfo(hBuilder, hKey))break;
if (!X509CertBuilderSetAuthorityInfoAccess(hBuilder, aia, FALSE))break;
if (!X509CertBuilderSetCRL(hBuilder, &crll, FALSE))break;
if (!X509CertBuilderCreateCertInfo(&cert, hBuilder))break;
if (!IssuerSignCertificate(&signedCert, &signedCertLength, cert, issuerKey))break;
success = TRUE;
} while (false);
CloseX509CertBuilder(hBuilder);
if (!success) {
X509CertBuilderFreeCertInfo(cert);
CloseRSAKey(hKey);
cert = nullptr;
}
else {
*cer = signedCert;
*len = signedCertLength;
*subjectKey = hKey;
}
return cert;
}
//
// SSL Client: TEST
//
PCERT_INFO CreateSSLClientSubject(
_In_ PCERT_INFO issuer,
_In_ HANDLE issuerKey,
_Out_ LPBYTE* cer,
_Out_ LPDWORD len,
_Out_ PHANDLE subjectKey) {
*cer = nullptr;
*len = 0;
*subjectKey = nullptr;
HANDLE hBuilder = nullptr;
HANDLE hKey = nullptr;
KEY_USAGE ku{};
ku.DigitalSignature = TRUE;
ku.KeyEncipherment = TRUE;
BYTE buffer[sizeof(CERT_ENHANCED_KEY_USAGE_LIST) + sizeof(LPCSTR) * 1];
PCERT_ENHANCED_KEY_USAGE_LIST el = (PCERT_ENHANCED_KEY_USAGE_LIST)&buffer[0];
el->dwEnhancedKeyUsage = 1;
el->EKUs[0] = szOID_PKIX_KP_CLIENT_AUTH;
BYTE sanBuffer[sizeof(CERT_SAN) * 1];
CERT_SAN_LIST san{};
san.dwSAN = 1;
san.SANs = PCERT_SAN(&sanBuffer[0]);
san.SANs[0].type = X509_CERT_SAN_TYPE_DNS;
san.SANs[0].SAN = "WMS";
BYTE aiaBuffer[sizeof(CERT_AUTHORITY_INFO_ACCESS_LIST) * 2];
PCERT_AUTHORITY_INFO_ACCESS_LIST aia = (PCERT_AUTHORITY_INFO_ACCESS_LIST)&aiaBuffer[0];
aia->dwAccDescr = 2;
aia->AccDescrs[0].AccessMethod = X509_CERT_AYTHORITY_INFO_ACCESS_METHOD_OCSP;
aia->AccDescrs[0].AccessLocation.dwType = X509_CERT_AUTHORITY_INFO_ACCESS_LOCATION_URL;
aia->AccDescrs[0].AccessLocation.Name = "http://127.0.0.1";
aia->AccDescrs[1].AccessMethod = X509_CERT_AYTHORITY_INFO_ACCESS_METHOD_CA_ISSUERS;
aia->AccDescrs[1].AccessLocation.dwType = X509_CERT_AUTHORITY_INFO_ACCESS_LOCATION_URL;
aia->AccDescrs[1].AccessLocation.Name = "http://127.0.0.1/certs/sslca.cer";
PCERT_INFO cert = nullptr;
LPBYTE signedCert = nullptr;
DWORD signedCertLength = 0;
BOOL success = FALSE;
do {
if (!CreateRSAKey(&hKey, 2048))break;
if (!CreateX509CertBuilder(&hBuilder, nullptr))break;
if (!X509CertBuilderSetSubjectName(hBuilder, "CN=TEST"))break;
if (!X509CertBuilderSetIssuerName(hBuilder, &issuer->Subject))break;
if (!X509CertBuilderSetSignatureAlgorithm(hBuilder, SIGNATURE_ALGORITHM::sha256RSA, nullptr))break;
if (!X509CertBuilderSetSubjectKeyIdentifier(hBuilder, hKey, FALSE))break;
if (!X509CertBuilderSetAuthorityKeyIdentifier(hBuilder, nullptr, nullptr, issuerKey, FALSE))break;
if (!X509CertBuilderSetKeyUsage(hBuilder, ku, TRUE))break;
if (!X509CertBuilderSetBasicConstraint(hBuilder, -1, X509_CERT_SUBJECT_TYPE_END, TRUE))break;
if (!X509CertBuilderSetEnhancedKeyUsage(hBuilder, el, FALSE))break;
if (!X509CertBuilderSetSubjectAlternativeName(hBuilder, &san, FALSE))break;
if (!X509CertBuilderSetSubjectPublicKeyInfo(hBuilder, hKey))break;
if (!X509CertBuilderSetAuthorityInfoAccess(hBuilder, aia, FALSE))break;
if (!X509CertBuilderCreateCertInfo(&cert, hBuilder))break;
if (!IssuerSignCertificate(&signedCert, &signedCertLength, cert, issuerKey))break;
success = TRUE;
} while (false);
CloseX509CertBuilder(hBuilder);
if (!success) {
X509CertBuilderFreeCertInfo(cert);
CloseRSAKey(hKey);
cert = nullptr;
}
else {
*cer = signedCert;
*len = signedCertLength;
*subjectKey = hKey;
}
return cert;
}
//
// Code Signing
//
PCERT_INFO CreateCodeSignSubject(
_In_ PCERT_INFO issuer,
_In_ HANDLE issuerKey,
_Out_ LPBYTE* cer,
_Out_ LPDWORD len,
_Out_ PHANDLE subjectKey) {
*cer = nullptr;
*len = 0;
*subjectKey = nullptr;
HANDLE hBuilder = nullptr;
HANDLE hKey = nullptr;
KEY_USAGE ku{};
ku.DigitalSignature = TRUE;
ku.KeyEncipherment = TRUE;
BYTE buffer[sizeof(CERT_ENHANCED_KEY_USAGE_LIST) + sizeof(LPCSTR) * 2];
PCERT_ENHANCED_KEY_USAGE_LIST el = (PCERT_ENHANCED_KEY_USAGE_LIST)&buffer[0];
el->dwEnhancedKeyUsage = 2;
el->EKUs[0] = szOID_PKIX_KP_CODE_SIGNING;
el->EKUs[1] = szOID_NT5_CRYPTO;
CERT_POLICY policiesBuffer[3];
BYTE policiesListBuffer[sizeof(CERT_POLICY_LIST) + sizeof(PCERT_POLICY) * 3];
PCERT_POLICY_LIST policies = PCERT_POLICY_LIST(&policiesListBuffer[0]);
policies->dwPolicyInfo = 3;
policies->Policies = policiesBuffer;
policies->Policies[0].dwPolicyQualifier = 0;
policies->Policies[0].PolicyIdentifier = "2.23.140.1.3";
policies->Policies[1].dwPolicyQualifier = 0;
policies->Policies[1].PolicyIdentifier = "2.23.140.1.4.1";
policies->Policies[2].dwPolicyQualifier = 0;
policies->Policies[2].PolicyIdentifier = "2.16.840.1.114412.3.1";
BYTE aiaBuffer[sizeof(CERT_AUTHORITY_INFO_ACCESS_LIST) * 2];
PCERT_AUTHORITY_INFO_ACCESS_LIST aia = (PCERT_AUTHORITY_INFO_ACCESS_LIST)&aiaBuffer[0];
aia->dwAccDescr = 2;
aia->AccDescrs[0].AccessMethod = X509_CERT_AYTHORITY_INFO_ACCESS_METHOD_OCSP;
aia->AccDescrs[0].AccessLocation.dwType = X509_CERT_AUTHORITY_INFO_ACCESS_LOCATION_URL;
aia->AccDescrs[0].AccessLocation.Name = "http://127.0.0.1";
aia->AccDescrs[1].AccessMethod = X509_CERT_AYTHORITY_INFO_ACCESS_METHOD_CA_ISSUERS;
aia->AccDescrs[1].AccessLocation.dwType = X509_CERT_AUTHORITY_INFO_ACCESS_LOCATION_URL;
aia->AccDescrs[1].AccessLocation.Name = "http://127.0.0.1/certs/codesignca.cer";
CERT_CRL_DIST_POINT_NAME_LIST crl{};
CERT_CRL_DIST_POINT_LIST crll{};
crl.dwName = 1;
crl.dwType = X509_CERT_CRL_DIST_POINT_NAME_TYPE_FULL_NAME;
crl.Names[0].dwType = X509_CERT_CRL_DIST_POINT_NAME_URL;
crl.Names[0].Name = "http://127.0.0.1";
crll.dwCRL = 1;
crll.CRLs->DistPointNames = &crl;
PCERT_INFO cert = nullptr;
LPBYTE signedCert = nullptr;
DWORD signedCertLength = 0;
BOOL success = FALSE;
do {
if (!CreateRSAKey(&hKey, 2048))break;
if (!CreateX509CertBuilder(&hBuilder, nullptr))break;
if (!X509CertBuilderSetSubjectName(hBuilder, "CN=TEST,S=ShanDong,C=CN,2.5.4.15=TEST,1.3.6.1.4.1.311.60.2.1.3=CN"))break;
if (!X509CertBuilderSetIssuerName(hBuilder, &issuer->Subject))break;
if (!X509CertBuilderSetSignatureAlgorithm(hBuilder, SIGNATURE_ALGORITHM::sha256RSA, nullptr))break;
if (!X509CertBuilderSetSubjectKeyIdentifier(hBuilder, hKey, FALSE))break;
if (!X509CertBuilderSetAuthorityKeyIdentifier(hBuilder, nullptr, nullptr, issuerKey, FALSE))break;
if (!X509CertBuilderSetKeyUsage(hBuilder, ku, TRUE))break;
if (!X509CertBuilderSetBasicConstraint(hBuilder, -1, X509_CERT_SUBJECT_TYPE_END, TRUE))break;
if (!X509CertBuilderSetEnhancedKeyUsage(hBuilder, el, FALSE))break;
if (!X509CertBuilderSetPolicies(hBuilder, policies, FALSE))break;
if (!X509CertBuilderSetSubjectPublicKeyInfo(hBuilder, hKey))break;
if (!X509CertBuilderSetAuthorityInfoAccess(hBuilder, aia, FALSE))break;
if (!X509CertBuilderSetCRL(hBuilder, &crll, FALSE))break;
if (!X509CertBuilderCreateCertInfo(&cert, hBuilder))break;
if (!IssuerSignCertificate(&signedCert, &signedCertLength, cert, issuerKey))break;
success = TRUE;
} while (false);
CloseX509CertBuilder(hBuilder);
if (!success) {
X509CertBuilderFreeCertInfo(cert);
CloseRSAKey(hKey);
cert = nullptr;
}
else {
*cer = signedCert;
*len = signedCertLength;
*subjectKey = hKey;
}
return cert;
}
VOID SaveFile(LPCSTR FileName, LPVOID Buffer, DWORD Length) {
auto file = fopen(FileName, "wb");
if (file) {
fwrite(Buffer, Length, 1, file);
fclose(file);
}
}
BOOL WINAPI Write(LPCVOID param, LPVOID data, DWORD len) {
SaveFile(LPCSTR(param), data, len);
return TRUE;
}
VOID IssueSubject() {
PCERT_INFO cert;
HANDLE hKey;
LPBYTE buffer;
DWORD len;
OpenX509CertificateFromFile(&cert, "SSLCA.cer");
OpenRSAKeyFromFile(&hKey, "SSLCA.pvk");
if (cert) {
HANDLE SSL_Key;
PCERT_INFO SSL_Cert = CreateSSLSubject(cert, hKey, &buffer, &len, &SSL_Key);
if (SSL_Cert) {
SaveFile("SSL.cer", buffer, len);
RSAKeySave(SSL_Key, Write, "SSL.pvk");
HeapFree(GetProcessHeap(), 0, buffer);
X509CertBuilderFreeCertInfo(SSL_Cert);
CloseRSAKey(SSL_Key);
}
CloseX509Certificate(cert);
CloseRSAKey(hKey);
}
OpenX509CertificateFromFile(&cert, "CodeSigningCA.cer");
OpenRSAKeyFromFile(&hKey, "CodeSigningCA.pvk");
if (cert) {
HANDLE CodeSigning_Key;
PCERT_INFO CodeSigning_Cert = CreateCodeSignSubject(cert, hKey, &buffer, &len, &CodeSigning_Key);
if (CodeSigning_Cert) {
SaveFile("CodeSigning.cer", buffer, len);
RSAKeySave(CodeSigning_Key, Write, "CodeSigning.pvk");
HeapFree(GetProcessHeap(), 0, buffer);
X509CertBuilderFreeCertInfo(CodeSigning_Cert);
CloseRSAKey(CodeSigning_Key);
}
CloseX509Certificate(cert);
CloseRSAKey(hKey);
}
}
VOID IssueSSLClient() {
PCERT_INFO cert;
HANDLE hKey;
LPBYTE buffer;
DWORD len;
OpenX509CertificateFromFile(&cert, "SSLCA.cer");
OpenRSAKeyFromFile(&hKey, "SSLCA.pvk");
if (cert) {
HANDLE SSL_Key;
PCERT_INFO SSL_Cert = CreateSSLClientSubject(cert, hKey, &buffer, &len, &SSL_Key);
if (SSL_Cert) {
SaveFile("SSLClient.cer", buffer, len);
RSAKeySave(SSL_Key, Write, "SSLClient.pvk");
HeapFree(GetProcessHeap(), 0, buffer);
X509CertBuilderFreeCertInfo(SSL_Cert);
CloseRSAKey(SSL_Key);
}
CloseX509Certificate(cert);
CloseRSAKey(hKey);
}
}
VOID BuildCertificateChain() {
LPBYTE buffer;
DWORD len;
HANDLE RootCertKey;
PCERT_INFO RootCert = CreateRootCA(&buffer, &len, &RootCertKey);
if (RootCert) {
SaveFile("RootCA.cer", buffer, len);
RSAKeySave(RootCertKey, Write, "RootCA.pvk");
HeapFree(GetProcessHeap(), 0, buffer);
HANDLE SSLCA_Key;
PCERT_INFO SSLCA_Cert = CreateSSLSubjectCA(RootCert, RootCertKey, &buffer, &len, &SSLCA_Key);
if (SSLCA_Cert) {
SaveFile("SSLCA.cer", buffer, len);
RSAKeySave(SSLCA_Key, Write, "SSLCA.pvk");
HeapFree(GetProcessHeap(), 0, buffer);
HANDLE SSL_Key;
PCERT_INFO SSL_Cert = CreateSSLSubject(SSLCA_Cert, SSLCA_Key, &buffer, &len, &SSL_Key);
if (SSL_Cert) {
SaveFile("SSL.cer", buffer, len);
RSAKeySave(SSL_Key, Write, "SSL.pvk");
HeapFree(GetProcessHeap(), 0, buffer);
X509CertBuilderFreeCertInfo(SSL_Cert);
CloseRSAKey(SSL_Key);
}
SSL_Cert = CreateSSLClientSubject(SSLCA_Cert, SSLCA_Key, &buffer, &len, &SSL_Key);
if (SSL_Cert) {
SaveFile("SSLClient.cer", buffer, len);
RSAKeySave(SSL_Key, Write, "SSLClient.pvk");
HeapFree(GetProcessHeap(), 0, buffer);
X509CertBuilderFreeCertInfo(SSL_Cert);
CloseRSAKey(SSL_Key);
}
X509CertBuilderFreeCertInfo(SSLCA_Cert);
CloseRSAKey(SSLCA_Key);
}
HANDLE CodeSigningCA_Key;
PCERT_INFO CodeSigningCA_Cert = CreateCodeSignSubjectCA(RootCert, RootCertKey, &buffer, &len, &CodeSigningCA_Key);
if (CodeSigningCA_Cert) {
SaveFile("CodeSigningCA.cer", buffer, len);
RSAKeySave(CodeSigningCA_Key, Write, "CodeSigningCA.pvk");
HeapFree(GetProcessHeap(), 0, buffer);
HANDLE CodeSigning_Key;
PCERT_INFO CodeSigning_Cert = CreateCodeSignSubject(CodeSigningCA_Cert, CodeSigningCA_Key, &buffer, &len, &CodeSigning_Key);
if (CodeSigning_Cert) {
SaveFile("CodeSigning.cer", buffer, len);
RSAKeySave(CodeSigning_Key, Write, "CodeSigning.pvk");
HeapFree(GetProcessHeap(), 0, buffer);
X509CertBuilderFreeCertInfo(CodeSigning_Cert);
CloseRSAKey(CodeSigning_Key);
}
X509CertBuilderFreeCertInfo(CodeSigningCA_Cert);
CloseRSAKey(CodeSigningCA_Key);
}
X509CertBuilderFreeCertInfo(RootCert);
CloseRSAKey(RootCertKey);
}
}
int main() {
//TestCodeSignCreate();
//TestCodeSignIssue();
BuildCertificateChain();
return 0;
}
| 30.119898
| 151
| 0.76425
|
bb107
|
37ad0e0fc07e22114787a54cd5df7e28c3de5468
| 1,441
|
cpp
|
C++
|
networklib/src/request.cpp
|
zina1995/Twitter-API-C-Library
|
87b29c63b89be6feb05adbe05ebed0213aa67f9b
|
[
"MIT"
] | null | null | null |
networklib/src/request.cpp
|
zina1995/Twitter-API-C-Library
|
87b29c63b89be6feb05adbe05ebed0213aa67f9b
|
[
"MIT"
] | null | null | null |
networklib/src/request.cpp
|
zina1995/Twitter-API-C-Library
|
87b29c63b89be6feb05adbe05ebed0213aa67f9b
|
[
"MIT"
] | null | null | null |
#include <networklib/request.hpp>
#include <ostream>
#include <sstream>
#include <string>
#include <networklib/detail/encode.hpp>
namespace network {
auto to_string(Request const& x) -> std::string
{
constexpr char const* CR = "\r\n";
auto encoded_body = detail::key_value_encode(x.messages);
auto result = std::string{};
// Request Line
result.append(x.HTTP_method).append(1, ' ').append(x.URI);
if (!x.queries.empty())
result.append(1, '?').append(detail::key_value_encode(x.queries));
result.append(1, ' ').append(x.HTTP_version).append(CR);
// Header
result.append("Accept: ").append(x.accept).append(CR);
result.append("User-Agent: ").append(x.user_agent).append(CR);
result.append("Content-Type: ").append(x.content_type).append(CR);
if (!x.authorization.empty())
result.append("Authorization: ").append(x.authorization).append(CR);
result.append("Content-Length: ")
.append(std::to_string(encoded_body.length()))
.append(CR);
result.append("Host: ").append(x.host).append(CR);
for (auto const& [key, value] : x.headers)
result.append(key).append(": ").append(value).append(CR);
// Message Body
result.append(CR).append(std::move(encoded_body));
return result;
}
auto operator<<(std::ostream& os, Request const& request) -> std::ostream&
{
return os << to_string(request);
}
} // namespace network
| 27.711538
| 76
| 0.650243
|
zina1995
|
37ad35a16ede8eb936bcc03102047f13a9632826
| 1,848
|
cpp
|
C++
|
src/format.cpp
|
SusannaMaria/CppND-System-Monitor-Project-Updated
|
a07c51465107c38c51fb7ee12122b87068d9c7e0
|
[
"MIT"
] | null | null | null |
src/format.cpp
|
SusannaMaria/CppND-System-Monitor-Project-Updated
|
a07c51465107c38c51fb7ee12122b87068d9c7e0
|
[
"MIT"
] | null | null | null |
src/format.cpp
|
SusannaMaria/CppND-System-Monitor-Project-Updated
|
a07c51465107c38c51fb7ee12122b87068d9c7e0
|
[
"MIT"
] | null | null | null |
/**
* @file format.cpp
* @author Susanna Maria, David Silver
* @brief Implementation of Helper function to print out Strings of monitor in
* NCurses UI
* @version 1.0
* @date 2020-06-21
*
* @copyright MIT License
*
*/
#include "format.h"
#include <iomanip>
#include <sstream>
#include <string>
using namespace std;
using std::string;
/**
* Return time as string in HH:MM:SS format
*
* Because uptime of system is likely more than 1d, I decided to extend the
* return string if day > 0, it is added as prefix to the HH:MM:SS
*
* @param uptime TIme in seconds
* @return string Used in function in NCursesDisplay namespace
*/
string Format::ElapsedTime(long uptime) {
int day = uptime / (24 * 3600);
uptime = uptime % (24 * 3600);
int hour = uptime / 3600;
uptime %= 3600;
int minutes = uptime / 60;
uptime %= 60;
int seconds = uptime;
std::stringstream ss;
if (day > 0) {
ss << day << " day";
if (day > 1) {
ss << "s";
}
ss << ", ";
}
ss << setfill('0') << setw(2) << hour << ":" << setfill('0') << setw(2)
<< minutes << ":" << setfill('0') << setw(2) << seconds;
return ss.str();
}
/**
* Pad string to specific size with specific character
*
* Because of display problem of User and commandline with various length of
* string, I decided to provide function which returns string which has defined
* length
*
* @param str String which will be extended or shorten to reach size
* @param num Size of return string
* @param paddingChar Fill out string to required size with character
* @return std::string Used in function in NCursesDisplay namespace
*/
std::string Format::padTo(const std::string str, const size_t num,
const char paddingChar = ' ') {
std::string result = str;
result.resize(num, paddingChar);
return result;
}
| 24
| 79
| 0.645563
|
SusannaMaria
|
37b112b16b98220f644b2b135a7a83815ee1630b
| 2,008
|
cpp
|
C++
|
main.cpp
|
chenillax/E4C_Challenge_Carbozer
|
3c23b9f106d6b148b84ff2af7e87f8a4ece8b771
|
[
"Apache-2.0"
] | null | null | null |
main.cpp
|
chenillax/E4C_Challenge_Carbozer
|
3c23b9f106d6b148b84ff2af7e87f8a4ece8b771
|
[
"Apache-2.0"
] | null | null | null |
main.cpp
|
chenillax/E4C_Challenge_Carbozer
|
3c23b9f106d6b148b84ff2af7e87f8a4ece8b771
|
[
"Apache-2.0"
] | null | null | null |
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include "user.hpp"
#include "datacenter.hpp"
#include "view.hpp"
#include "video.hpp"
int main(){
//First Example : Sylvain watching Squeezie's FAQ
DataCenter datacenter = DataCenter();
std::string name_video = "CECI EST UNE FOIRE AUX QUESTIONS #2 (FAQ Squeezie)";
Video video = Video(name_video,3800, 6000000,0.23);
std::string name = "Sylvain";
Terminal terminal = Terminal(Terminal_device::Phone);
Quality quality = Quality::p1080;
Stream stream = Stream ::Net;
Localisation localisation = Localisation::France;
View sylvain = View(1, name, terminal, quality, stream,localisation,video);
std::cout << name << " emitted " << sylvain.emission_by_watching() << " gCO2eq while watching "<< name_video << ".\n The carbon cost of the video shared with the viewer is "<< sylvain.emission_shared() << "\nFinally "<< name << " emitted "<< sylvain.total_emission() <<" gCO2eq \n"<< std::endl;
std::cout << video.get_name() << "emitted " << video.emission() << "gC02eq for its creation" << std::endl;
//Second Example : Natascha listenned to "Alors,Alors" on Youtube
//DataCenter datacenter;
name_video = "Alors,Alors";
video = Video(name_video,26000000,36000000,0.07);
name = "Natascha";
terminal = Terminal(Terminal_device::Pc);
quality = Quality::Auto;
stream = Stream ::Wifi;
localisation = Localisation::Germany;
View natascha = View(1, name, terminal, quality, stream,localisation,video);
std::cout << name << " emitted " << natascha.emission_by_watching() << " gCO2eq while watching "<< video.get_name() << ".\n The carbon cost of the video shared with the viewer is "<< natascha.emission_shared() << "gCO2eq.\n Finally "<< name << " emitted "<< natascha.total_emission() <<" gCO2eq.\n"<< std::endl;
std::cout << video.get_name() << "emitted " << video.emission() << "gC02eq for its creation" << std::endl;
return 0;
}
| 51.487179
| 315
| 0.669323
|
chenillax
|
37b4f8a260b833543e131848f43871ed9cfae0fd
| 2,351
|
hpp
|
C++
|
src/opengl/glengine/MenuItem.hpp
|
Sebanisu/Field-Map-Editor
|
2f37986459785a78766de34e38fc3e21db8b6f14
|
[
"Unlicense"
] | null | null | null |
src/opengl/glengine/MenuItem.hpp
|
Sebanisu/Field-Map-Editor
|
2f37986459785a78766de34e38fc3e21db8b6f14
|
[
"Unlicense"
] | 66
|
2021-09-27T23:58:02.000Z
|
2022-01-10T20:41:36.000Z
|
src/opengl/glengine/MenuItem.hpp
|
Sebanisu/Field-Map-Editor
|
2f37986459785a78766de34e38fc3e21db8b6f14
|
[
"Unlicense"
] | null | null | null |
//
// Created by pcvii on 11/29/2021.
//
#ifndef MYPROJECT_MenuItem_HPP
#define MYPROJECT_MenuItem_HPP
#include "Event/EventItem.hpp"
namespace glengine
{
class MenuItem
{
private:
class MenuItemConcept
{
protected:
MenuItemConcept() = default;
MenuItemConcept(const MenuItemConcept &) = default;
MenuItemConcept(MenuItemConcept &&) noexcept = default;
MenuItemConcept &operator=(const MenuItemConcept &) = default;
MenuItemConcept &operator=(MenuItemConcept &&) noexcept = default;
public:
virtual ~MenuItemConcept(){};
virtual void OnUpdate(float) const = 0;
virtual void OnRender() const = 0;
virtual void OnImGuiUpdate() const = 0;
virtual void OnEvent(const Event::Item &) const = 0;
};
template<Renderable renderableT>
class MenuItemModel final : public MenuItemConcept
{
public:
MenuItemModel(renderableT t)
: m_renderable(std::move(t))
{
}
void OnUpdate(float ts) const final
{
return m_renderable.OnUpdate(ts);
}
void OnRender() const final
{
return m_renderable.OnRender();
}
void OnImGuiUpdate() const final
{
return m_renderable.OnImGuiUpdate();
}
void OnEvent(const Event::Item &e) const final
{
return m_renderable.OnEvent(e);
}
MenuItemModel() = default;
private:
renderableT m_renderable;
};
mutable std::unique_ptr<const MenuItemConcept> m_impl{ nullptr };
public:
void OnUpdate(float ts);
void OnRender();
void OnImGuiUpdate();
void OnEvent(const Event::Item &);
MenuItem()
: m_impl(nullptr)
{
}
template<typename T, typename... argsT>
MenuItem(std::in_place_type_t<T>, argsT &&...args) noexcept
: m_impl(std::make_unique<MenuItemModel<std::decay_t<T>>>(
std::forward<argsT>(args)...))
{
static_assert(Renderable<T>);
}
template<typename T>
[[maybe_unused]] MenuItem(T t)
: MenuItem(std::in_place_type_t<T>{}, std::move(t))
{
}
MenuItem(const MenuItem &other) = delete;
MenuItem &operator=(const MenuItem &other) = delete;
MenuItem(MenuItem &&other) noexcept = default;
MenuItem &operator=(MenuItem &&other) noexcept = default;
operator bool() const;
};
};// namespace glengine
#endif// MYPROJECT_MenuItem_HPP
| 25.554348
| 70
| 0.652063
|
Sebanisu
|
37ba15b1ec8e073b656f3d253374420a9ebd6803
| 1,796
|
cpp
|
C++
|
HDUOJ/3452/dp_tree.cpp
|
codgician/ACM
|
391f3ce9b89b0a4bbbe3ff60eb2369fef57460d4
|
[
"MIT"
] | 2
|
2018-02-14T01:59:31.000Z
|
2018-03-28T03:30:45.000Z
|
HDUOJ/3452/dp_tree.cpp
|
codgician/ACM
|
391f3ce9b89b0a4bbbe3ff60eb2369fef57460d4
|
[
"MIT"
] | null | null | null |
HDUOJ/3452/dp_tree.cpp
|
codgician/ACM
|
391f3ce9b89b0a4bbbe3ff60eb2369fef57460d4
|
[
"MIT"
] | 2
|
2017-12-30T02:46:35.000Z
|
2018-03-28T03:30:49.000Z
|
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <iomanip>
#include <climits>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <functional>
#include <iterator>
#include <cassert>
using namespace std;
#define SIZE 1010
typedef struct _Edge
{
int to;
long long int len;
int next;
} Edge;
Edge arr[SIZE << 1];
int head[SIZE], arrPt;
long long int dp[SIZE];
void addEdge(int from, int to, long long int len)
{
arr[arrPt] = {to, len, head[from]};
head[from] = arrPt++;
}
void dfs(int cntPt, int parentPt)
{
dp[cntPt] = LLONG_MAX;
long long int cntAns = 0;
for (int i = head[cntPt]; i != -1; i = arr[i].next)
{
int nextPt = arr[i].to;
if (nextPt == parentPt)
continue;
dfs(nextPt, cntPt);
cntAns += min(arr[i].len, dp[nextPt]);
}
if (cntAns != 0)
dp[cntPt] = cntAns;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int vertexNum, rootPt;
while (cin >> vertexNum >> rootPt)
{
if (vertexNum == 0 && rootPt == 0)
break;
rootPt--;
memset(head, -1, sizeof(head));
arrPt = 0;
for (int i = 1; i < vertexNum; i++)
{
int from, to, len;
cin >> from >> to >> len;
from--;
to--;
addEdge(from, to, len);
addEdge(to, from, len);
}
if (vertexNum <= 1)
{
cout << 0 << endl;
continue;
}
dfs(rootPt, -1);
cout << dp[rootPt] << endl;
}
return 0;
}
| 19.311828
| 56
| 0.490535
|
codgician
|
37be33dbf8395c489cc1daa664a0908997bcc1bb
| 185
|
cpp
|
C++
|
zerojudge/a004.cpp
|
yangszwei/notes
|
a144981b42fb268832eb69926c0076cc28c82e26
|
[
"MIT"
] | null | null | null |
zerojudge/a004.cpp
|
yangszwei/notes
|
a144981b42fb268832eb69926c0076cc28c82e26
|
[
"MIT"
] | null | null | null |
zerojudge/a004.cpp
|
yangszwei/notes
|
a144981b42fb268832eb69926c0076cc28c82e26
|
[
"MIT"
] | null | null | null |
#include <iostream>
using namespace std;
int main() {
int y;
while (cin >> y) {
cout << (((y % 4 == 0 && y % 100 != 0) || y % 400 == 0) ? "閏年" : "平年") << endl;
}
}
| 18.5
| 87
| 0.416216
|
yangszwei
|
37bf269a10fe76efc66400ed4c75b58005f56f01
| 357
|
cpp
|
C++
|
world/source/unit_tests/World_test.cpp
|
sidav/shadow-of-the-wyrm
|
747afdeebed885b1a4f7ab42f04f9f756afd3e52
|
[
"MIT"
] | 60
|
2019-08-21T04:08:41.000Z
|
2022-03-10T13:48:04.000Z
|
world/source/unit_tests/World_test.cpp
|
cleancoindev/shadow-of-the-wyrm
|
51b23e98285ecb8336324bfd41ebf00f67b30389
|
[
"MIT"
] | 3
|
2021-03-18T15:11:14.000Z
|
2021-10-20T12:13:07.000Z
|
world/source/unit_tests/World_test.cpp
|
cleancoindev/shadow-of-the-wyrm
|
51b23e98285ecb8336324bfd41ebf00f67b30389
|
[
"MIT"
] | 8
|
2019-11-16T06:29:05.000Z
|
2022-01-23T17:33:43.000Z
|
#include "gtest/gtest.h"
TEST(SW_World_World, serialization_id)
{
World world;
EXPECT_EQ(ClassIdentifier::CLASS_ID_WORLD, world.get_class_identifier());
}
TEST(SW_World_World, saveload)
{
World world, world2;
ostringstream ss;
world.serialize(ss);
istringstream iss(ss.str());
world2.deserialize(iss);
EXPECT_TRUE(world == world2);
}
| 15.521739
| 75
| 0.731092
|
sidav
|
37c2a64b88c868bbf773b3640a6d79f75be43a0a
| 3,518
|
cpp
|
C++
|
test/unittests/lib/parser/test_ParserFuncType.cpp
|
WasmVM/wass
|
e35962e1637a1445ab8ad97e5a06ee4d59b49fd7
|
[
"BSD-3-Clause"
] | null | null | null |
test/unittests/lib/parser/test_ParserFuncType.cpp
|
WasmVM/wass
|
e35962e1637a1445ab8ad97e5a06ee4d59b49fd7
|
[
"BSD-3-Clause"
] | null | null | null |
test/unittests/lib/parser/test_ParserFuncType.cpp
|
WasmVM/wass
|
e35962e1637a1445ab8ad97e5a06ee4d59b49fd7
|
[
"BSD-3-Clause"
] | null | null | null |
#include <gtest/gtest.h>
#include <any>
#include <vector>
#include <Error.hpp>
#include <structure/FuncType.hpp>
#include <parser/ParserContext.hpp>
#include <parser/ParserFuncType.hpp>
#include <Helper.hpp>
TEST(unittest_ParserFuncType, empty){
std::vector<char> data(create_char_vector("(func)"));
ParserContext context(data);
ParserFuncType result(context);
EXPECT_EQ(context.cursor, data.end());
EXPECT_TRUE(result.has_value());
FuncType funcType = *result;
EXPECT_EQ(funcType.params.size(), 0);
EXPECT_EQ(funcType.results.size(), 0);
}
TEST(unittest_ParserFuncType, regular){
std::vector<char> data(create_char_vector("(func (param i32) (result i64))"));
ParserContext context(data);
ParserFuncType result(context);
EXPECT_EQ(context.cursor, data.end());
EXPECT_TRUE(result.has_value());
FuncType funcType = *result;
EXPECT_EQ(funcType.params.size(), 1);
EXPECT_EQ(funcType.params[0], ValueType::i32);
EXPECT_EQ(funcType.results.size(), 1);
EXPECT_EQ(funcType.results[0], ValueType::i64);
}
TEST(unittest_ParserFuncType, more_param){
std::vector<char> data(create_char_vector("(func (param i32) (param f32) (result i64))"));
ParserContext context(data);
ParserFuncType result(context);
EXPECT_EQ(context.cursor, data.end());
EXPECT_TRUE(result.has_value());
FuncType funcType = *result;
EXPECT_EQ(funcType.params.size(), 2);
EXPECT_EQ(funcType.params[0], ValueType::i32);
EXPECT_EQ(funcType.params[1], ValueType::f32);
EXPECT_EQ(funcType.results.size(), 1);
EXPECT_EQ(funcType.results[0], ValueType::i64);
}
TEST(unittest_ParserFuncType, more_result){
std::vector<char> data(create_char_vector("(func (param i32) (result f32) (result i64))"));
ParserContext context(data);
ParserFuncType result(context);
EXPECT_EQ(context.cursor, data.end());
EXPECT_TRUE(result.has_value());
FuncType funcType = *result;
EXPECT_EQ(funcType.params.size(), 1);
EXPECT_EQ(funcType.params[0], ValueType::i32);
EXPECT_EQ(funcType.results.size(), 2);
EXPECT_EQ(funcType.results[0], ValueType::f32);
EXPECT_EQ(funcType.results[1], ValueType::i64);
}
TEST(unittest_ParserFuncType, param_only){
std::vector<char> data(create_char_vector("(func (param i32))"));
ParserContext context(data);
ParserFuncType result(context);
EXPECT_EQ(context.cursor, data.end());
EXPECT_TRUE(result.has_value());
FuncType funcType = *result;
EXPECT_EQ(funcType.params.size(), 1);
EXPECT_EQ(funcType.params[0], ValueType::i32);
EXPECT_EQ(funcType.results.size(), 0);
}
TEST(unittest_ParserFuncType, param_with_id){
std::vector<char> data(create_char_vector("(func (param i32) (param $aaa f32))"));
ParserContext context(data);
ParserFuncType result(context);
EXPECT_EQ(context.cursor, data.end());
EXPECT_TRUE(result.has_value());
FuncType funcType = *result;
EXPECT_EQ(funcType.params.size(), 2);
EXPECT_EQ(funcType.params[0], ValueType::i32);
EXPECT_EQ(funcType.params[1], ValueType::f32);
EXPECT_EQ(funcType.results.size(), 0);
EXPECT_EQ(funcType.paramMap.size(), 1);
EXPECT_EQ(funcType.paramMap["aaa"], 1);
}
TEST(unittest_ParserFuncType, result_only){
std::vector<char> data(create_char_vector("(func (result i64))"));
ParserContext context(data);
ParserFuncType result(context);
EXPECT_EQ(context.cursor, data.end());
EXPECT_TRUE(result.has_value());
FuncType funcType = *result;
EXPECT_EQ(funcType.params.size(), 0);
EXPECT_EQ(funcType.results.size(), 1);
EXPECT_EQ(funcType.results[0], ValueType::i64);
}
| 36.268041
| 93
| 0.73394
|
WasmVM
|
37c44b9eb8e5081e2dff69fae128a98ac4500c9e
| 5,072
|
hh
|
C++
|
include/GB01BOptrChangeCrossSection.hh
|
BahHas/VParticles
|
3548dffdebfde0634b8c1b649a1d6dcacfaf12bb
|
[
"Unlicense"
] | null | null | null |
include/GB01BOptrChangeCrossSection.hh
|
BahHas/VParticles
|
3548dffdebfde0634b8c1b649a1d6dcacfaf12bb
|
[
"Unlicense"
] | null | null | null |
include/GB01BOptrChangeCrossSection.hh
|
BahHas/VParticles
|
3548dffdebfde0634b8c1b649a1d6dcacfaf12bb
|
[
"Unlicense"
] | null | null | null |
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file GB01/include/GB01BOptrChangeCrossSection.hh
/// \brief Definition of the GB01BOptrChangeCrossSection class
//
//---------------------------------------------------------------
//
// GB01BOptrChangeCrossSection
//
// Class Description:
// A G4VBiasingOperator concrete implementation example to
// illustrate how to bias physics processes cross-section for
// one particle type.
// The G4VBiasingOperation G4BOptnChangeCrossSection is
// selected by this operator, and is sent to each process
// calling the operator.
// A simple constant bias to the cross-section is applied,
// but more sophisticated changes can be applied.
//
//---------------------------------------------------------------
//
#ifndef GB01BOptrChangeCrossSection_hh
#define GB01BOptrChangeCrossSection_hh 1
#include "G4VBiasingOperator.hh"
class G4BOptnChangeCrossSection;
class G4ParticleDefinition;
#include <map>
class GB01BOptrChangeCrossSection : public G4VBiasingOperator {
public:
// ------------------------------------------------------------
// -- Constructor: takes the name of the particle type to bias:
// ------------------------------------------------------------
GB01BOptrChangeCrossSection(G4String particleToBias, G4String name = "ChangeXS");
virtual ~GB01BOptrChangeCrossSection();
// -- method called at beginning of run:
virtual void StartRun();
private:
// -----------------------------
// -- Mandatory from base class:
// -----------------------------
// -- This method returns the biasing operation that will bias the physics process occurence.
virtual G4VBiasingOperation*
ProposeOccurenceBiasingOperation(const G4Track* track,
const G4BiasingProcessInterface* callingProcess);
// -- Methods not used:
virtual G4VBiasingOperation*
ProposeFinalStateBiasingOperation(const G4Track*, const G4BiasingProcessInterface*)
{return 0;}
virtual G4VBiasingOperation*
ProposeNonPhysicsBiasingOperation(const G4Track*, const G4BiasingProcessInterface*)
{return 0;}
private:
// -- ("using" is avoid compiler complaining against (false) method shadowing.)
using G4VBiasingOperator::OperationApplied;
// -- Optionnal base class method implementation.
// -- This method is called to inform the operator that a proposed operation has been applied.
// -- In the present case, it means that a physical interaction occured (interaction at
// -- PostStepDoIt level):
virtual void OperationApplied( const G4BiasingProcessInterface* callingProcess,
G4BiasingAppliedCase biasingCase,
G4VBiasingOperation* occurenceOperationApplied,
G4double weightForOccurenceInteraction,
G4VBiasingOperation* finalStateOperationApplied,
const G4VParticleChange* particleChangeProduced );
private:
// -- List of associations between processes and biasing operations:
std::map< const G4BiasingProcessInterface*,
G4BOptnChangeCrossSection* > fChangeCrossSectionOperations;
G4bool fSetup;
const G4ParticleDefinition* fParticleToBias;
};
#endif
| 47.849057
| 98
| 0.581625
|
BahHas
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.