hexsha stringlengths 40 40 | size int64 7 1.05M | ext stringclasses 13
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 269 | max_stars_repo_name stringlengths 5 108 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 9 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 269 | max_issues_repo_name stringlengths 5 116 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 9 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 269 | max_forks_repo_name stringlengths 5 116 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 9 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 7 1.05M | avg_line_length float64 1.21 330k | max_line_length int64 6 990k | alphanum_fraction float64 0.01 0.99 | author_id stringlengths 2 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9742aa30c98975ef40db7c44d5d0b00497c8a943 | 753 | cpp | C++ | functions/fibonnaci.cpp | neerajsingh869/data-structures-and-algorithms | 96087e68fdce743f90f75228af1c7d111f6b92b7 | [
"MIT"
] | null | null | null | functions/fibonnaci.cpp | neerajsingh869/data-structures-and-algorithms | 96087e68fdce743f90f75228af1c7d111f6b92b7 | [
"MIT"
] | null | null | null | functions/fibonnaci.cpp | neerajsingh869/data-structures-and-algorithms | 96087e68fdce743f90f75228af1c7d111f6b92b7 | [
"MIT"
] | null | null | null | #include<iostream>
using namespace std;
void fib(int num){
if(num==1){
cout<<"0 ";
}
else if(num==2){
cout<<"1 ";
}
else{
int first_num = 0;
int second_num = 1;
cout<<first_num<<" "<<second_num<<" ";
int new_second;
for(int i=3; i<=num; i++){
new_second = first_num + second_num;
cout<<new_second<<" ";
first_num = second_num;
second_num = new_second;
}
}
// Since the function type is void, therefore we are not returning anything.
// If the func type is void, then we can drop return statement.
return;
}
int main(){
int n;
cout<<"Enter a number > 0: ";
cin>>n;
fib(n);
return 0;
} | 22.147059 | 80 | 0.5166 | neerajsingh869 |
97462a44b917207be0aea1dad73accc1c6a2a186 | 5,532 | cpp | C++ | src/Renderer_init_rpi.cpp | dem1980/EmulationStation | 019e78d0486178520e0ee36322a212b9c9451052 | [
"MIT"
] | null | null | null | src/Renderer_init_rpi.cpp | dem1980/EmulationStation | 019e78d0486178520e0ee36322a212b9c9451052 | [
"MIT"
] | null | null | null | src/Renderer_init_rpi.cpp | dem1980/EmulationStation | 019e78d0486178520e0ee36322a212b9c9451052 | [
"MIT"
] | 1 | 2021-02-24T23:00:44.000Z | 2021-02-24T23:00:44.000Z | #include "Renderer.h"
#include <iostream>
#include "platform.h"
#include <GLES/gl.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include "Font.h"
#include <SDL/SDL.h>
#include "InputManager.h"
#include "Log.h"
#ifdef _RPI_
#include <bcm_host.h>
#endif
namespace Renderer
{
SDL_Surface* sdlScreen;
EGLDisplay display;
EGLSurface surface;
EGLContext context;
EGLConfig config;
#ifdef _RPI_
static EGL_DISPMANX_WINDOW_T nativewindow;
#else
NativeWindowType nativewindow;
#endif
unsigned int display_width = 0;
unsigned int display_height = 0;
unsigned int getScreenWidth() { return display_width; }
unsigned int getScreenHeight() { return display_height; }
bool createSurface() //unsigned int display_width, unsigned int display_height)
{
LOG(LogInfo) << "Starting SDL...";
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) != 0)
{
LOG(LogError) << "Error initializing SDL!\n " << SDL_GetError() << "\n" << "Are you in the 'video', 'audio', and 'input' groups? Is X closed? Is your firmware up to date? Are you using at least the 192/64 memory split?";
return false;
}
sdlScreen = SDL_SetVideoMode(1, 1, 0, SDL_SWSURFACE);
if(sdlScreen == NULL)
{
LOG(LogError) << "Error creating SDL window for input!";
return false;
}
LOG(LogInfo) << "Creating surface...";
#ifdef _RPI_
DISPMANX_ELEMENT_HANDLE_T dispman_element;
DISPMANX_DISPLAY_HANDLE_T dispman_display;
DISPMANX_UPDATE_HANDLE_T dispman_update;
VC_RECT_T dst_rect;
VC_RECT_T src_rect;
#endif
display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if(display == EGL_NO_DISPLAY)
{
LOG(LogError) << "Error getting display!";
return false;
}
bool result = eglInitialize(display, NULL, NULL);
if(result == EGL_FALSE)
{
LOG(LogError) << "Error initializing display!";
return false;
}
result = eglBindAPI(EGL_OPENGL_ES_API);
if(result == EGL_FALSE)
{
LOG(LogError) << "Error binding API!";
return false;
}
static const EGLint config_attributes[] =
{
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_NONE
};
GLint numConfigs;
result = eglChooseConfig(display, config_attributes, &config, 1, &numConfigs);
if(result == EGL_FALSE)
{
LOG(LogError) << "Error choosing config!";
return false;
}
context = eglCreateContext(display, config, EGL_NO_CONTEXT, NULL);
if(context == EGL_NO_CONTEXT)
{
LOG(LogError) << "Error getting context!\n " << eglGetError();
return false;
}
#ifdef _RPI_
//get hardware info for screen/desktop from BCM interface
if(!display_width || !display_height)
{
bool success = graphics_get_display_size(0, &display_width, &display_height); //0 = LCD
if(success < 0)
{
LOG(LogError) << "Error getting display size!";
return false;
}
}
#else
//get hardware info for screen/desktop from SDL
if(!display_width || !display_height)
{
const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo();
if(videoInfo == NULL)
{
LOG(LogError) << "Error getting display size!";
return false;
}
else
{
display_width = current_w;
display_height = current_h;
}
}
#endif
LOG(LogInfo) << "Resolution: " << display_width << "x" << display_height << "...";
#ifdef _RPI_
dst_rect.x = 0; dst_rect.y = 0;
dst_rect.width = display_width; dst_rect.height = display_height;
src_rect.x = 0; src_rect.y = 0;
src_rect.width = display_width << 16; src_rect.height = display_height << 16;
dispman_display = vc_dispmanx_display_open(0); //0 = LCD
dispman_update = vc_dispmanx_update_start(0);
dispman_element = vc_dispmanx_element_add(dispman_update, dispman_display, 0 /*layer*/, &dst_rect, 0 /*src*/, &src_rect, DISPMANX_PROTECTION_NONE, 0 /*alpha*/, 0 /*clamp*/, DISPMANX_NO_ROTATE /*transform*/);
nativewindow.element = dispman_element;
nativewindow.width = display_width; nativewindow.height = display_height;
vc_dispmanx_update_submit_sync(dispman_update);
#endif
surface = eglCreateWindowSurface(display, config, &nativewindow, NULL);
if(surface == EGL_NO_SURFACE)
{
LOG(LogError) << "Error creating window surface!";
return false;
}
result = eglMakeCurrent(display, surface, surface, context);
if(result == EGL_FALSE)
{
LOG(LogError) << "Error with eglMakeCurrent!";
return false;
}
LOG(LogInfo) << "Created surface successfully!";
return true;
}
void swapBuffers()
{
eglSwapBuffers(display, surface);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
void destroySurface()
{
eglSwapBuffers(display, surface);
eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglDestroySurface(display, surface);
eglDestroyContext(display, context);
eglTerminate(display);
display = EGL_NO_DISPLAY;
surface = EGL_NO_SURFACE;
context = EGL_NO_CONTEXT;
SDL_FreeSurface(sdlScreen);
sdlScreen = NULL;
SDL_Quit();
}
bool init(int w, int h)
{
if(w)
display_width = w;
if(h)
display_height = h;
bool createdSurface = createSurface();
if(!createdSurface)
return false;
glViewport(0, 0, display_width, display_height);
glMatrixMode(GL_PROJECTION);
glOrthof(0, display_width, display_height, 0, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
onInit();
return true;
}
void deinit()
{
onDeinit();
destroySurface();
}
};
| 23.540426 | 223 | 0.685466 | dem1980 |
9747f6de59bbbf91fbcb31e2931c8830241ad624 | 9,557 | cpp | C++ | src/host/optimsocgui/src/executionchart.cpp | koenenwmn/optimsoc | 2cbb92af68c17484b0b65c5e837e71e51eaafebc | [
"MIT"
] | 48 | 2017-06-30T15:28:08.000Z | 2022-03-07T06:47:31.000Z | src/host/optimsocgui/src/executionchart.cpp | koenenwmn/optimsoc | 2cbb92af68c17484b0b65c5e837e71e51eaafebc | [
"MIT"
] | 96 | 2017-06-20T19:51:03.000Z | 2022-03-16T20:22:36.000Z | src/host/optimsocgui/src/executionchart.cpp | nanvix/optimsoc | aaf9de0bdddec921bde8c31b273d829000c5e5b9 | [
"MIT"
] | 20 | 2017-08-17T18:34:51.000Z | 2021-09-05T08:36:25.000Z | /* Copyright (c) 2013 by the author(s)
*
* 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.
*
* Author(s):
* Stefan Wallentowitz <stefan.wallentowitz@tum.de>
*/
#include "executionchart.h"
#include "ui_executionchart.h"
#include "optimsocsystem.h"
#include "optimsocsystemelement.h"
#include "optimsocsystemfactory.h"
#include "systeminterface.h"
#include <QGraphicsTextItem>
#include <QGraphicsRectItem>
#include <QGraphicsLineItem>
#include <QMessageBox>
#include <QPair>
#include <cmath>
ExecutionChart::ExecutionChart(QWidget *parent) :
QWidget(parent),
m_ui(new Ui::ExecutionChart), m_currentMaximum(0), m_autoscroll(true),
m_zoomFactor(10.0), m_slideFactor(0.5), m_sysif(SystemInterface::instance())
{
// Set up user interface
m_ui->setupUi(this);
m_ui->horizontalSpacer->changeSize(qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent) +
qApp->style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing), 0);
// Clear scale plot
m_ui->widget_plot_scale->plotLayout()->clear();
// Create the axes for scale plot
QCPAxisRect *scale_axis = new QCPAxisRect(m_ui->widget_plot_scale);
scale_axis->axis(QCPAxis::atTop)->setVisible(true);
scale_axis->removeAxis(scale_axis->axis(QCPAxis::atBottom));
scale_axis->removeAxis(scale_axis->axis(QCPAxis::atRight));
scale_axis->removeAxis(scale_axis->axis(QCPAxis::atLeft));
// Add axis to scale plot
m_ui->widget_plot_scale->plotLayout()->addElement(0, 0, scale_axis);
// Clear main plot
m_ui->widget_plot->plotLayout()->clear();
// Set interactivity
m_ui->widget_plot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);
// Zoom only along horizontal
scale_axis->setRangeZoom(Qt::Horizontal);
scale_axis->setRangeDrag(Qt::Horizontal);
// Connect the range changes from the plot to the scale plot
connect(this, SIGNAL(rangeChange(QCPRange)), scale_axis->axis(QCPAxis::atTop), SLOT(setRange(QCPRange)));
// Create margin group
QCPMarginGroup *margingrp = new QCPMarginGroup(m_ui->widget_plot);
scale_axis->setMarginGroup(QCP::msLeft | QCP::msRight, margingrp);
connect(&m_plotTimer, SIGNAL(timeout()), this, SLOT(replot()));
m_plotTimer.start(20);
connect(OptimsocSystemFactory::instance(),
SIGNAL(currentSystemChanged(OptimsocSystem*, OptimsocSystem*)),
this,
SLOT(systemChanged(OptimsocSystem*, OptimsocSystem*)));
connect(m_sysif->softwareTraceEventDistributor(),
SIGNAL(softwareTraceEvent(struct SoftwareTraceEvent)),
this,
SLOT(addTraceEvent(struct SoftwareTraceEvent)));
}
ExecutionChart::~ExecutionChart()
{
delete m_ui;
}
void ExecutionChart::systemChanged(OptimsocSystem* oldSystem,
OptimsocSystem* newSystem)
{
Q_UNUSED(oldSystem);
QList<OptimsocSystemElement*> tiles = newSystem->tiles();
unsigned int row = 0;
for (int i=0; i<tiles.size(); ++i) {
QCPAxisRect *coreaxis = new QCPAxisRect(m_ui->widget_plot);
ExecutionChartPlotCore *plot = new ExecutionChartPlotCore(coreaxis->axis(QCPAxis::atBottom), coreaxis->axis(QCPAxis::atLeft), QString("Core %1").arg(i));
m_ui->widget_plot->plotLayout()->addElement(row++, 0, coreaxis);
coreaxis->setRangeZoom(Qt::Horizontal);
coreaxis->setRangeDrag(Qt::Horizontal);
connect(coreaxis->axis(QCPAxis::atBottom), SIGNAL(rangeChanged(QCPRange,QCPRange)), this, SLOT(rangeChanged(QCPRange,QCPRange)));
connect(this, SIGNAL(rangeChange(QCPRange)), coreaxis->axis(QCPAxis::atBottom), SLOT(setRange(QCPRange)));
coreaxis->setMarginGroup(QCP::msLeft | QCP::msRight, m_ui->widget_plot_scale->axisRect(0)->marginGroup(QCP::msLeft));
coreaxis->setMinimumSize(10,50);
coreaxis->setMaximumSize(100000,50);
m_plotCores.resize(m_plotCores.size()+1);
m_plotCores[i] = plot;
QCPAxisRect *loadaxis = new QCPAxisRect(m_ui->widget_plot);
ExecutionChartPlotLoad *plotload = new ExecutionChartPlotLoad(loadaxis->axis(QCPAxis::atBottom), loadaxis->axis(QCPAxis::atLeft));
m_ui->widget_plot->plotLayout()->addElement(row++, 0, loadaxis);
loadaxis->setRangeZoom(Qt::Horizontal);
loadaxis->setRangeDrag(Qt::Horizontal);
connect(loadaxis->axis(QCPAxis::atBottom), SIGNAL(rangeChanged(QCPRange,QCPRange)), this, SLOT(rangeChanged(QCPRange,QCPRange)));
connect(this, SIGNAL(rangeChange(QCPRange)), loadaxis->axis(QCPAxis::atBottom), SLOT(setRange(QCPRange)));
loadaxis->setMarginGroup(QCP::msLeft | QCP::msRight, m_ui->widget_plot_scale->axisRect(0)->marginGroup(QCP::msLeft));
loadaxis->setMinimumSize(10,50);
loadaxis->setMaximumSize(100000,50);
m_plotLoads.resize(m_plotLoads.size()+1);
m_plotLoads[i] = plotload;
}
}
void ExecutionChart::replot()
{
m_ui->widget_plot->replot();
m_ui->widget_plot_scale->replot();
}
void ExecutionChart::rangeChanged(QCPRange oldrange, QCPRange newrange)
{
if (newrange.lower < 0) {
if (oldrange.upper - oldrange.lower == newrange.upper - newrange.lower) {
// If we _move_ don't accidentally zoom
newrange.lower = 0;
newrange.upper = oldrange.upper - oldrange.lower;
} else {
// If we zoom, just spare out the negative part
newrange.lower = 0;
}
}
// If the maximum value is visible we autoscroll
m_autoscroll = m_currentMaximum < newrange.upper;
emit rangeChange(newrange);
}
void ExecutionChart::addTraceEvent(SoftwareTraceEvent event)
{
unsigned int update_extend = 0;
unsigned int tmp_extend;
if (event.core_id < m_plotCores.size()) {
tmp_extend = m_plotCores[event.core_id]->addSoftwareTrace(&event);
if (tmp_extend > update_extend) {
update_extend = tmp_extend;
}
tmp_extend = m_plotLoads[event.core_id]->addSoftwareTrace(&event);
if (tmp_extend > update_extend) {
update_extend = tmp_extend;
}
}
if (update_extend > 0) {
ExecutionChartPlotCore *coreplot;
foreach(coreplot, m_plotCores) {
coreplot->updateExtend(update_extend);
}
ExecutionChartPlotLoad *loadplot;
foreach(loadplot, m_plotLoads) {
loadplot->updateExtend(update_extend);
}
if (m_autoscroll) {
QCPRange range = m_ui->widget_plot_scale->axisRect(0)->axis(QCPAxis::atTop)->range();
// We only scroll if the new extend would not be visible
if (update_extend > range.upper) {
double move = update_extend - range.upper;
range.lower = range.lower + move;
range.upper = range.upper + move;
emit rangeChange(range);
}
}
m_currentMaximum = update_extend;
}
}
void ExecutionChart::on_zoomInButton_clicked()
{
QCPRange range = m_ui->widget_plot_scale->axisRect(0)->axis(QCPAxis::atTop)->range();
double mid = (range.upper + range.lower) / 2;
range.lower = mid - (mid - range.lower) / m_zoomFactor;
range.upper = mid + (range.upper - mid) / m_zoomFactor;
emit rangeChange(range);
}
void ExecutionChart::on_zoomOutButton_clicked()
{
QCPRange range = m_ui->widget_plot_scale->axisRect(0)->axis(QCPAxis::atTop)->range();
double mid = (range.upper + range.lower) / 2;
range.lower = mid - (mid - range.lower) * m_zoomFactor;
range.upper = mid + (range.upper - mid) * m_zoomFactor;
emit rangeChange(range);
}
void ExecutionChart::on_zoomOriginalButton_clicked()
{
QCPRange range;
range.lower = 0;
range.upper = m_currentMaximum;
m_autoscroll = true;
emit rangeChange(range);
}
void ExecutionChart::on_leftButton_clicked()
{
QCPRange range = m_ui->widget_plot_scale->axisRect(0)->axis(QCPAxis::atTop)->range();
double width = range.upper - range.lower;
double move = width * m_slideFactor;
range.lower = range.lower - move;
range.upper = range.upper - move;
emit rangeChange(range);
}
void ExecutionChart::on_rightButton_clicked()
{
QCPRange range = m_ui->widget_plot_scale->axisRect(0)->axis(QCPAxis::atTop)->range();
double width = range.upper - range.lower;
double move = width * m_slideFactor;
range.lower = range.lower + move;
range.upper = range.upper + move;
emit rangeChange(range);
}
| 37.042636 | 161 | 0.68306 | koenenwmn |
97599792c4c62fb301288faa1a481411b209e273 | 10,861 | cpp | C++ | Official Windows Platform Sample/Windows 8.1 Store app samples/[C++]-Windows 8.1 Store app samples/Direct2Dapp printing sample/C++/D2DPageRenderer.cpp | zzgchina888/msdn-code-gallery-microsoft | 21cb9b6bc0da3b234c5854ecac449cb3bd261f29 | [
"MIT"
] | 2 | 2022-01-21T01:40:58.000Z | 2022-01-21T01:41:10.000Z | Official Windows Platform Sample/Windows 8.1 Store app samples/[C++]-Windows 8.1 Store app samples/Direct2Dapp printing sample/C++/D2DPageRenderer.cpp | zzgchina888/msdn-code-gallery-microsoft | 21cb9b6bc0da3b234c5854ecac449cb3bd261f29 | [
"MIT"
] | 1 | 2022-03-15T04:21:41.000Z | 2022-03-15T04:21:41.000Z | Official Windows Platform Sample/Windows 8.1 Store app samples/[C++]-Windows 8.1 Store app samples/Direct2Dapp printing sample/C++/D2DPageRenderer.cpp | zzgchina888/msdn-code-gallery-microsoft | 21cb9b6bc0da3b234c5854ecac449cb3bd261f29 | [
"MIT"
] | null | null | null | //// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
//// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
//// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//// PARTICULAR PURPOSE.
////
//// Copyright (c) Microsoft Corporation. All rights reserved
#include "pch.h"
#include <math.h>
#include "D2DPageRenderer.h"
#include "D2DPageRendererContext.h"
using namespace Microsoft::WRL;
using namespace Microsoft::WRL::Wrappers;
using namespace Windows::Foundation;
using namespace Windows::UI::Core;
using namespace Windows::Graphics::Display;
PageRenderer::PageRenderer()
{
}
void PageRenderer::CreateDeviceIndependentResources()
{
DirectXBase::CreateDeviceIndependentResources();
// Create a DirectWrite text format object for the sample's content.
DX::ThrowIfFailed(
m_dwriteFactory->CreateTextFormat(
L"Segoe UI",
nullptr,
DWRITE_FONT_WEIGHT_NORMAL,
DWRITE_FONT_STYLE_NORMAL,
DWRITE_FONT_STRETCH_NORMAL,
40.0f,
L"en-us", // locale
&m_textFormat
)
);
// Align the text horizontally.
DX::ThrowIfFailed(
m_textFormat->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING)
);
// Center the text vertically.
DX::ThrowIfFailed(
m_textFormat->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER)
);
// Create a DirectWrite text format object for status messages.
DX::ThrowIfFailed(
m_dwriteFactory->CreateTextFormat(
L"Segoe UI",
nullptr,
DWRITE_FONT_WEIGHT_NORMAL,
DWRITE_FONT_STYLE_NORMAL,
DWRITE_FONT_STRETCH_NORMAL,
20.0f,
L"en-us", // locale
&m_messageFormat
)
);
// Center the text horizontally.
DX::ThrowIfFailed(
m_messageFormat->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER)
);
// Center the text vertically.
DX::ThrowIfFailed(
m_messageFormat->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER)
);
}
void PageRenderer::CreateDeviceResources()
{
DirectXBase::CreateDeviceResources();
// Create and initialize sample overlay for sample title.
m_sampleOverlay = ref new SampleOverlay();
m_sampleOverlay->Initialize(
m_d2dDevice.Get(),
m_d2dContext.Get(),
m_wicFactory.Get(),
m_dwriteFactory.Get(),
"Direct2D Windows Store app printing sample"
);
D2D1_SIZE_F size = m_d2dContext->GetSize();
// Exclude sample title from imageable area for image drawing.
float titleHeight = m_sampleOverlay->GetTitleHeightInDips();
// Create and initialize the page renderer context for display.
m_displayPageRendererContext =
ref new PageRendererContext(
D2D1::RectF(0, titleHeight, size.width, size.height),
m_d2dContext.Get(),
DrawTypes::Rendering,
this
);
}
void PageRenderer::UpdateForWindowSizeChange()
{
DirectXBase::UpdateForWindowSizeChange();
m_sampleOverlay->UpdateForWindowSizeChange();
D2D1_SIZE_F size = m_d2dContext->GetSize();
// Exclude sample title from imageable area for image drawing.
float titleHeight = m_sampleOverlay->GetTitleHeightInDips();
D2D1_RECT_F contentBox = D2D1::RectF(0, titleHeight, size.width, size.height);
m_displayPageRendererContext->UpdateTargetBox(
contentBox
);
}
// On-screen rendering.
void PageRenderer::Render()
{
m_d2dContext->BeginDraw();
// Render page context.
m_displayPageRendererContext->Draw(1.0f);
// We ignore D2DERR_RECREATE_TARGET here. This error indicates that the device
// is lost. It will be handled during the next call to Present.
HRESULT hr = m_d2dContext->EndDraw();
if (hr != D2DERR_RECREATE_TARGET)
{
DX::ThrowIfFailed(hr);
}
// Render sample title.
m_sampleOverlay->Render();
// We are accessing D3D resources directly in Present() without D2D's knowledge,
// so we must manually acquire the D2D factory lock.
//
// Note: it's absolutely critical that the factory lock be released upon
// exiting this function, or else the entire app will deadlock. This is
// ensured via the following RAII class.
{
D2DFactoryLock factoryLock(m_d2dFactory.Get());
Present();
}
}
void PageRenderer::DrawPreviewSurface(
_In_ float width,
_In_ float height,
_In_ float scale,
_In_ D2D1_RECT_F contentBox,
_In_ uint32 desiredJobPage,
_In_ IPrintPreviewDxgiPackageTarget* previewTarget
)
{
// We are accessing D3D resources directly without D2D's knowledge, so we
// must manually acquire the D2D factory lock.
//
// Note: it's absolutely critical that the factory lock be released upon
// exiting this function, or else the entire app will deadlock. This is
// ensured via the following RAII class.
D2DFactoryLock factoryLock(m_d2dFactory.Get());
CD3D11_TEXTURE2D_DESC textureDesc(
DXGI_FORMAT_B8G8R8A8_UNORM,
static_cast<uint32>(ceil(width * m_dpi / 96)),
static_cast<uint32>(ceil(height * m_dpi / 96)),
1,
1,
D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE
);
ComPtr<ID3D11Texture2D> texture;
DX::ThrowIfFailed(
m_d3dDevice->CreateTexture2D(
&textureDesc,
nullptr,
&texture
)
);
// Create a preview DXGI surface with given size.
ComPtr<IDXGISurface> dxgiSurface;
DX::ThrowIfFailed(
texture.As<IDXGISurface>(&dxgiSurface)
);
// Create a new D2D device context for rendering the preview surface. D2D
// device contexts are stateful, and hence a unique device context must be
// used on each thread.
ComPtr<ID2D1DeviceContext> d2dContext;
DX::ThrowIfFailed(
m_d2dDevice->CreateDeviceContext(
D2D1_DEVICE_CONTEXT_OPTIONS_NONE,
&d2dContext
)
);
// Update DPI for preview surface as well.
d2dContext->SetDpi(m_dpi, m_dpi);
// Recommend using the screen DPI for better fidelity and better performance in the print preview.
D2D1_BITMAP_PROPERTIES1 bitmapProperties =
D2D1::BitmapProperties1(
D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW,
D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED)
);
// Create surface bitmap on which page content is drawn.
ComPtr<ID2D1Bitmap1> d2dSurfaceBitmap;
DX::ThrowIfFailed(
d2dContext->CreateBitmapFromDxgiSurface(
dxgiSurface.Get(),
&bitmapProperties,
&d2dSurfaceBitmap
)
);
d2dContext->SetTarget(d2dSurfaceBitmap.Get());
// Create and initialize the page renderer context for preview.
PageRendererContext^ previewPageRendererContext =
ref new PageRendererContext(
contentBox,
d2dContext.Get(),
DrawTypes::Preview,
this
);
d2dContext->BeginDraw();
// Draw page content on the preview surface.
// Here contentBox is smaller than the real page size and the scale indicates the proportion.
// It is faster to draw content on a smaller surface.
previewPageRendererContext->Draw(scale);
// The document source handles D2DERR_RECREATETARGET, so it is okay to throw this error
// here.
DX::ThrowIfFailed(
d2dContext->EndDraw()
);
// Must pass the same DPI as used to create the DXGI surface for the correct print preview.
DX::ThrowIfFailed(
previewTarget->DrawPage(
desiredJobPage,
dxgiSurface.Get(),
m_dpi,
m_dpi
)
);
}
void PageRenderer::CreatePrintControl(
_In_ IPrintDocumentPackageTarget* docPackageTarget,
_In_ D2D1_PRINT_CONTROL_PROPERTIES* printControlProperties
)
{
// Explicitly release existing D2D print control.
m_d2dPrintControl = nullptr;
DX::ThrowIfFailed(
m_d2dDevice->CreatePrintControl(
m_wicFactory.Get(),
docPackageTarget,
printControlProperties,
&m_d2dPrintControl
)
);
}
HRESULT PageRenderer::ClosePrintControl()
{
return (m_d2dPrintControl == nullptr) ? S_OK : m_d2dPrintControl->Close();
}
// Print out one page, with the given print ticket.
// This sample has only one page and we ignore pageNumber below.
void PageRenderer::PrintPage(
_In_ uint32 /*pageNumber*/,
_In_ D2D1_RECT_F imageableArea,
_In_ D2D1_SIZE_F pageSize,
_In_opt_ IStream* pagePrintTicketStream
)
{
// Create a new D2D device context for generating the print command list.
// D2D device contexts are stateful, and hence a unique device context must
// be used on each thread.
ComPtr<ID2D1DeviceContext> d2dContext;
DX::ThrowIfFailed(
m_d2dDevice->CreateDeviceContext(
D2D1_DEVICE_CONTEXT_OPTIONS_NONE,
&d2dContext
)
);
ComPtr<ID2D1CommandList> printCommandList;
DX::ThrowIfFailed(
d2dContext->CreateCommandList(&printCommandList)
);
d2dContext->SetTarget(printCommandList.Get());
// Create and initialize the page renderer context for print.
// In this case, we want to use the bitmap source that already has
// the color context embedded in it. Thus, we pass NULL for the
// color context parameter.
PageRendererContext^ printPageRendererContext =
ref new PageRendererContext(
imageableArea,
d2dContext.Get(),
DrawTypes::Printing,
this
);
d2dContext->BeginDraw();
// Draw page content on a command list.
// 1.0f below indicates that the printing content does not scale.
// "DrawTypes::Printing" below indicates it is a printing case.
printPageRendererContext->Draw(1.0f);
// The document source handles D2DERR_RECREATETARGET, so it is okay to throw this error
// here.
DX::ThrowIfFailed(
d2dContext->EndDraw()
);
DX::ThrowIfFailed(
printCommandList->Close()
);
DX::ThrowIfFailed(
m_d2dPrintControl->AddPage(printCommandList.Get(), pageSize, pagePrintTicketStream)
);
}
IDWriteTextFormat* PageRenderer::GetTextFormatNoRef()
{
return m_textFormat.Get();
}
IDWriteTextFormat* PageRenderer::GetMessageFormatNoRef()
{
return m_messageFormat.Get();
}
| 30.855114 | 102 | 0.652518 | zzgchina888 |
975a772cab49b5a436594142e8021addb6541323 | 2,081 | cpp | C++ | sym.cpp | beru/imagefilter | 5e1ded9fb050f377b040d2f0b51231d44f14de41 | [
"MIT"
] | null | null | null | sym.cpp | beru/imagefilter | 5e1ded9fb050f377b040d2f0b51231d44f14de41 | [
"MIT"
] | null | null | null | sym.cpp | beru/imagefilter | 5e1ded9fb050f377b040d2f0b51231d44f14de41 | [
"MIT"
] | null | null | null | #include "sym.h"
#include <windows.h>
#include <Dbghelp.h>
#pragma comment(lib, "Dbghelp.lib")
/*
#pragma comment(lib, "msvcrtd.lib")
// msvcmrtd.lib
extern "C" {
extern char* __unDName(char *,const char*,int,int,int,unsigned short int);
extern char* __unDNameEx(char *,const char*,int,int,int,void *,unsigned short int);
}
*/
class SymImpl {
private:
HANDLE hProcess_;
public:
SymImpl() {
// copied from xtrace
DWORD symOptions = SymGetOptions();
symOptions |= SYMOPT_DEFERRED_LOADS;
symOptions &= ~SYMOPT_UNDNAME;
SymSetOptions(symOptions);
hProcess_ = GetCurrentProcess();
BOOL bInited = SymInitialize(
hProcess_,
NULL,
TRUE
);
int hoge = 0;
}
~SymImpl() {
SymCleanup(hProcess_);
}
std::string GetName(void* p) {
DWORD64 displacement64;
ULONG64 buffer[(sizeof(SYMBOL_INFO) +
MAX_SYM_NAME * sizeof(TCHAR) +
sizeof(ULONG64) - 1) /
sizeof(ULONG64)];
PSYMBOL_INFO pSymbol = (PSYMBOL_INFO)buffer;
pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO);
pSymbol->MaxNameLen = MAX_SYM_NAME;
if (SymFromAddr(hProcess_, (DWORD64)p, 0, pSymbol)) {
//char* pTempName = __unDNameEx(0, pSymbol->Name, 0, (int)malloc, (int)free, 0, UNDNAME_COMPLETE);
//if (pTempName) {
// std::string ret = pTempName;
// free(pTempName);
// return ret;
//}else {
// return "";
//}
const char* pQ = strchr(pSymbol->Name, '?');
if (!pQ) {
return pSymbol->Name;
}
char buff[MAX_SYM_NAME];
strcpy(buff, pQ);
int len = strlen(buff);
if (buff[len-1] == ')') {
buff[len-1] = 0;
}
char demangled[MAX_SYM_NAME];
if (
UnDecorateSymbolName(
buff,
demangled,
MAX_SYM_NAME-1,
UNDNAME_NAME_ONLY
)
) {
return demangled;
}
}
return "Sym::GetName failed";
}
};
Sym::Sym() {
pImpl_ = new SymImpl();
}
Sym::~Sym() {
delete pImpl_;
}
std::string Sym::GetName(void* p) {
return pImpl_->GetName(p);
}
| 20.81 | 102 | 0.588179 | beru |
975de2855a9caa68cbffe7f2d7feb8b4b78bac01 | 18,449 | cpp | C++ | climate-change/src/VS-Project/obj.cpp | jerry871002/CSE201-project | c42cc0e51d0c8367e4d06fc33756ab2ec4118ff4 | [
"MIT"
] | 5 | 2021-05-27T21:50:33.000Z | 2022-01-28T11:54:32.000Z | climate-change/src/VS-Project/obj.cpp | jerry871002/CSE201-project | c42cc0e51d0c8367e4d06fc33756ab2ec4118ff4 | [
"MIT"
] | null | null | null | climate-change/src/VS-Project/obj.cpp | jerry871002/CSE201-project | c42cc0e51d0c8367e4d06fc33756ab2ec4118ff4 | [
"MIT"
] | 1 | 2021-01-04T21:12:05.000Z | 2021-01-04T21:12:05.000Z | #include <iostream>
#include "obj.h"
#include <GodotGlobal.hpp>
#include <Viewport.hpp>
#include <StaticBody2D.hpp>
#include <SceneTree.hpp>
#include <Rect2.hpp>
#include <Label.hpp>
#include <String.hpp>
#include <wchar.h>
#include <string>
#include <stdlib.h>
#include "City.h"
#include "Player.h"
#include <random>
#include <Math.hpp>
using namespace godot;
# define M_PI 3.14159265358979323846 /* pi */
Structure::Structure() {
MenuVisible = false;
Clickable = false;
totalDays = 0;
/*
cost = 0;
energyUse = 0;
maintenance = 0;
satisfaction = 0;
income = 0;
population = 0;
numberOfEmployees = 0;
carbonEmission = 0;
energyDemand = 0;
energySupply = 0;
*/
}
/*
Structure::Structure(double cost, double energyUse, double maintenance, double satisfaction, double income, double population, double numberOfEmployees, double carbonEmission, double energyDemand, double energySupply) :
cost{ cost }, energyUse{ energyUse }, maintenance{ maintenance }, satisfaction{ satisfaction }, income{ income }, population{ population }, numberOfEmployees{ numberOfEmployees }, carbonEmission{ carbonEmission }, energyDemand{ energyDemand }, energySupply{ energySupply }{}
*/
Structure::~Structure() {}
double Structure::get_satisfaction() {
return this->satisfaction;
}
void Structure::set_satisfaction(double sat) {
this->satisfaction = sat;
}
// these are only for houses
int Structure::get_inhabitants() {
return this->numberOfInhabitants;
}
void Structure::set_inhabitants(int value) {
this->numberOfInhabitants = value;
}
double Structure::get_age() {
return this->age;
}
void Structure::set_age(double age) {
this->age = age;
}
double Structure::get_co2emissions() {
if (this->get_main_type() == "Housing") {
double panelsF = 1;
if (this->PanelsOn) { panelsF = 0.7; };
double trees = 0;
if (this->get_node("MeshComponents/Trees")->get("visible")) {
trees = 0.2; // 10 trees absorb 200 kilos of co2 a year
}
return (double)(((this->CO2Emission)-trees) * panelsF);
}
return this->CO2Emission;
}
void Structure::set_co2emissions(double emission) {
this->CO2Emission = emission;
}
double Structure::get_energyuse()
{
if (this->get_main_type() == "Housing") {
double panelsF = 1;
double turbineF = 1;
double glazingF = 1;
if (this->PanelsOn) {
panelsF = 0.6;
}
if (((Housing*)this)->rooftopWindTurbineOn) {
turbineF = 0.9;
}
if (this->get_object_type() == "House") {
if (((House*)this)->houseType == 1) { // If its a low level house then double glazing decrease energyuse
if (((House*)this)->doubleGlazingOn) {
glazingF = 0.75; //when having better insulation of windows, you don't have the 25% loss of heat anymore
}
}
}
return (double)(this->energyUse) * panelsF * turbineF * glazingF;
}
return this->energyUse;
}
void Structure::set_energyuse(double energyUse) {
this->energyUse = energyUse;
}
double Structure::get_energyperDay() {
return this->energyperDay;
}
void Structure::set_energyperDay(double energyperDay) {
this->energyperDay = energyperDay;
}
double Structure::get_environmental_cost() {
return this->environmentalCost;
}
void Structure::set_environmental_cost(double environmentalCost) {
this->environmentalCost = environmentalCost;
}
double Structure::get_cost() {
return this->cost;
}
void Structure::set_cost(double cost) {
this->cost = cost;
}
double Structure::get_employment() {
return this->employment;
}
void Structure::set_employment(double employment) {
this->employment = employment;
}
double Structure::get_building_time() {
return this->buildingTime;
}
void Structure::set_building_time(double buildingTime) {
this->buildingTime = buildingTime;
}
double Structure::get_maintenance() {
return this->maintenance;
}
void Structure::set_maintenance(double maintenance) {
this->maintenance = maintenance;
}
double Structure::get_averageWage() {
return this->averageWage;
}
void Structure::set_averageWage(double averageWage) {
this->averageWage = averageWage;
}
void Structure::_register_methods()
{
register_method((char*)"_process", &Structure::_process);
register_method((char*)"_input", &Structure::_input);
register_method((char*)"_ready", &Structure::_ready);
register_method((char*)"_on_Area_mouse_entered", &Structure::_on_Area_mouse_entered);
register_method((char*)"_on_Area_mouse_exited", &Structure::_on_Area_mouse_exited);
register_property<Structure, String>("object_type", &Structure::set_object_type, &Structure::get_type, "Structure");
register_property<Structure, bool>("updatable", &Structure::updatable, false);
register_property<Structure, double>("CO2Emission", &Structure::set_co2emissions, &Structure::get_co2emissions, 1);
register_property<Structure, double>("satisfaction", &Structure::set_satisfaction, &Structure::get_satisfaction, 1);
register_property<Structure, double>("energyUse", &Structure::set_energyuse, &Structure::get_energyuse, 1);
register_property<Structure, double>("averageWage", &Structure::set_averageWage, &Structure::get_averageWage, 1);
register_property<Structure, double>("maintenance", &Structure::set_maintenance, &Structure::get_maintenance, 1);
register_property<Structure, double>("employment", &Structure::set_employment, &Structure::get_employment, 1);
register_property<Structure, double>("cost", &Structure::set_cost, &Structure::get_cost, 1);
register_property<Structure, double>("environmentalCost", &Structure::set_environmental_cost, &Structure::get_environmental_cost, 1);
register_property<Structure, double>("buildingTime", &Structure::set_building_time, &Structure::get_building_time, 1);
register_property<Structure, double>("age", &Structure::set_age, &Structure::get_age, 1);
register_property<Structure, int>("numberOfInhabitants", &Structure::set_inhabitants, &Structure::get_inhabitants, 0);
//register_method((char*)"get_co2emissions", &Structure::get_co2emissions);
register_property<Structure, double>("solar_panel_subsidies", &Structure::solar_panel_subsidies, 0);
register_property<Structure, double>("efficiency_supercritical", &Structure::efficiency_supercritical, 0);
register_property<Structure, double>("efficiency_cogeneration", &Structure::efficiency_cogeneration, 0);
register_property<Structure, double>("nuclear_prohibited", &Structure::nuclear_prohibited, 0);
register_property<Structure, double>("coal_prohibited", &Structure::coal_prohibited, 0);
register_property<Structure, double>("maximum_CO2", &Structure::maximum_CO2, 0);
register_property<Structure, double>("subsidy_green", &Structure::subsidy_green, 0);
register_property<Structure, double>("pesticideProhibited", &Structure::pesticideProhibited, 0);
register_property<Structure, double>("GMOProhibited", &Structure::GMOProhibited, 0);
register_property<Structure, double>("fertilizerProhibited", &Structure::fertilizerProhibited, 0);
register_property<Structure, double>("solar_panel_subsidies_housing", &Structure::solar_panel_subsidies_housing, 0);
register_property<Structure, double>("wind_turbine_subsidies", &Structure::wind_turbine_subsidies, 0);
}
void Structure::_init()
{
}
void Structure::_ready()
{
object_scale = this->get("scale");
myCity = this->get_tree()->get_root()->get_node("Main/3Dworld");
// COUNT UP ALL THE INITIAL VARIABLES
add_city_counters();
}
void Structure::add_city_counters() {
myCity->set("income", double(myCity->get("income")) + double(this->get("averageWage")));
myCity->set("carbonEmission", double(myCity->get("carbonEmission")) + double(this->get("CO2Emission")));
myCity->set("energyDemand", double(myCity->get("energyDemand")) + double(this->get("energyUse")));
myCity->set("numberOfEmployees", double(myCity->get("numberOfEmployees")) + double(this->get("employment")));
myCity->set("totalSatisfaction", double(myCity->get("totalSatisfaction")) + satisfaction_weight() * double(this->get("satisfaction")));
myCity->set("population", int(myCity->get("population")) + int(this->get("numberOfInhabitants")));
if (this->get_main_type() == String("Housing")) {
myCity->set("HousingCO2", int(myCity->get("HousingCO2")) + int(this->get("CO2Emission")));
} else if (this->get_main_type() == String("Energy")) {
myCity->set("EnergyCO2", int(myCity->get("EnergyCO2")) + int(this->get("CO2Emission")));
}
else if(this->get_main_type() == String("Production")) {
myCity->set("ProductionCO2", int(myCity->get("ProductionCO2")) + int(this->get("CO2Emission")));
}
else if(this->get_main_type() == String("Shop")) {
myCity->set("ShopsCO2", int(myCity->get("ShopsCO2")) + int(this->get("CO2Emission")));
}
}
void Structure::subtract_city_counters() {
myCity->set("income", double(myCity->get("income")) - double(this->get("averageWage")));
myCity->set("carbonEmission", double(myCity->get("carbonEmission")) - double(this->get("CO2Emission")));
myCity->set("environmentalCost", double(myCity->get("environmentalCost")) - double(this->get("environmentalCost")));
myCity->set("energyDemand", double(myCity->get("energyDemand")) - double(this->get("energyUse")));
myCity->set("numberOfEmployees", double(myCity->get("numberOfEmployees")) - double(this->get("employment")));
myCity->set("totalSatisfaction", double(myCity->get("totalSatisfaction")) - satisfaction_weight() * double(this->get("satisfaction")));
myCity->set("population", int(myCity->get("population")) - int(this->get("numberOfInhabitants")));
if (this->get_main_type() == String("Housing")) {
myCity->set("HousingCO2", int(myCity->get("HousingCO2")) - int(this->get("CO2Emission")));
}
else if (this->get_main_type() == String("Energy")) {
myCity->set("EnergyCO2", int(myCity->get("EnergyCO2")) - int(this->get("CO2Emission")));
}
else if (this->get_main_type() == String("Production")) {
myCity->set("ProductionCO2", int(myCity->get("ProductionCO2")) - int(this->get("CO2Emission")));
}
else if (this->get_main_type() == String("Shop")) {
myCity->set("ShopsCO2", int(myCity->get("ShopsCO2")) - int(this->get("CO2Emission")));
}
}
Vector3 Structure::get_position() {
return (Vector3)((Spatial*)this)->get_translation();
}
bool Structure::is_other_structure_within_distance(Vector3 other, double distance) {
Vector3 pos = get_position();
return (sqrtf(other[0] * pos[0] + other[1] * pos[1] + other[2] * pos[2]) <= distance);
}
int Structure::satisfaction_weight() {
String type = this->get_main_type();
if (type == "Energy") {
return 10;
}
if (type == "Housing") {
return 1;
}
if (type == "Production") {
return 5;
}
if (type == "Shop") {
return 3;
}
return 1;
}
void Structure::_process(float delta)
{
if (this->get("updatable")) {
subtract_city_counters();
this->simulate_step((double)(this->get_tree()->get_root()->get_node("Main/3Dworld")->get("day_tick")) - age); // will run the lowest level simulate step function
add_city_counters();
this->set("updatable", false);
}
if (this->hover_animation_active) {
++(this->hover_animation_counter);
this->set("scale", Vector3(object_scale.x, object_scale.y * float(1 + 0.25 * sin(M_PI * hover_animation_counter / 5)), object_scale.z));
if (this->hover_animation_counter == 5) {
this->set("scale", object_scale);
hover_animation_active = false;
hover_animation_counter = 0;
}
}
}
void Structure::simulate_step(double days) {
age += days;
}
void Structure::_input(InputEvent* e)
{
Input* i = Input::get_singleton();
if (i->is_action_just_pressed("ui_select") && Clickable) {
// RECORD MOUSE POSITION
Vector2 mousePos = this->get_viewport()->get_mouse_position();
// PAUSE GAME
this->get_tree()->get_root()->get_node("Main/3Dworld")->set("time_speed", 0);
// PLAYER SHOULD NOT BE MOVABLE
((Player*)(this->get_tree()->get_root()->get_node("Main/3Dworld/Player")))->set("movable", false);
this->get_tree()->get_root()->get_node("Main/2Dworld/Blur")->set("visible", true);
// SET INFO BOX SIZE AND POSITION
int ypos = (int)(((Vector2)(this->get_tree()->get_root()->get_node("Main/2Dworld")->get_node("InfoBox")->get("rect_position"))).y);
int width = (int)(((Vector2)(this->get_tree()->get_root()->get_node("Main/2Dworld")->get_node("InfoBox")->get("rect_size"))).x);
if (mousePos.x > (get_viewport()->get_size().x) / 2)
{
(this->get_tree()->get_root()->get_node("Main/2Dworld/InfoBox"))->set("rect_position", Vector2(60, ypos));
}
else {
(this->get_tree()->get_root()->get_node("Main/2Dworld/InfoBox"))->set("rect_position", Vector2(get_viewport()->get_size().x / 2 - width - 60, ypos));
}
// AJUST POSITION OF MENU TO ENSURE IT IS VISIBLE
if (get_viewport()->get_size().x - mousePos.x <= MenuSize)
{
if (mousePos.y > (get_viewport()->get_size().y / 2)) { mousePos.y -= MenuSize /*- (get_viewport()->get_size().x - mousePos.x)*/; }
else { mousePos.y += MenuSize/* - (get_viewport()->get_size().x - mousePos.x)*/; }
//mousePos.x = get_viewport()->get_size().x - MenuSize;
mousePos.x -= MenuSize;
}
else if (mousePos.x <= MenuSize)
{
if (mousePos.y > (get_viewport()->get_size().y / 2)) { mousePos.y -= MenuSize /*- mousePos.x*/; }
else { mousePos.y += MenuSize /*- mousePos.x*/; }
mousePos.x += 2 * MenuSize;
}
if (get_viewport()->get_size().y - mousePos.y <= MenuSize)
{
if (mousePos.x > (get_viewport()->get_size().x / 2)) { mousePos.x -= MenuSize /*- (get_viewport()->get_size().y - mousePos.y)*/; }
else { mousePos.x += MenuSize /* - (get_viewport()->get_size().y - mousePos.y)*/; }
//mousePos.y = get_viewport()->get_size().y - MenuSize;
mousePos.y -= MenuSize;
}
else if (mousePos.y <= MenuSize)
{
if (mousePos.x > (get_viewport()->get_size().x / 2)) { mousePos.x -= MenuSize/* - mousePos.y*/; }
else { mousePos.x += MenuSize/* - mousePos.y*/; }
mousePos.y += MenuSize;
}
//mousePos = Vector2(real_t((double)(get_viewport()->get_size().x) / 2), real_t((double)(get_viewport()->get_size().y) / 2));
(this->get_tree()->get_root()->get_node("Main/2Dworld/Menus"))->set("position", Vector2(mousePos.x / 2, mousePos.y / 2));
show_menu();
}
}
void Structure::show_menu()
{
this->get_tree()->get_root()->get_node("Main/2Dworld/InvalidInputNotification")->set("visible", false);
this->get_tree()->get_root()->get_node("Main/2Dworld/InfoBox")->set("text", get_object_info());
this->get_tree()->get_root()->get_node("Main/2Dworld/InfoBox")->set("visible", true);
godot::String MenuPathString = "Main/2Dworld/Menus/Menu" + this->get_main_type();
NodePath MenuPath = (NodePath)MenuPathString;
if (this->get_tree()->get_root()->has_node(MenuPath)) {
this->get_tree()->get_root()->get_node(MenuPath)->set("visible", true);
}
else {
Godot::print("A node was not found at the following path: ");
Godot::print(MenuPathString);
}
}
template<typename T> String to_godot_string(T s)
{
std::string standardString = std::to_string(s);
godot::String godotString = godot::String(standardString.c_str());
return godotString;
}
String Structure::get_object_info()
{
String info = String("INFORMATION - ABOUT THIS STRUCTURE") + String("\n") + String("\n") + String("\n");
if (this->get_object_type() == "Building"){
info += "This building is a(n) " + this->get_main_type() + " building. Specifically, it is a " + to_godot_string((int)(((int)(this)->get("age")) / 365)) + " year and " + to_godot_string((int)(((int)(this)->get("age")) % 365)) + " days old Apartment Building." + String("\n") + String("\n");
}
else if (this->get_object_type() == "AgriculturalProduction") {
info += "This is a field. It is able to produce several different crops." + String("\n") + String("\n");
}
else {
info += "This building is a(n) " + this->get_main_type() + " building. Specifically, it is a " + to_godot_string((int)(((int)(this)->get("age")) / 365)) + " year and " + to_godot_string((int)(((int)(this)->get("age")) % 365)) + " days old " + this->get_object_type() + "." + String("\n") + String("\n");
}
return info;
}
void godot::Structure::_on_Area_mouse_entered()
{
Clickable = true;
Input* i = Input::get_singleton();
i->set_default_cursor_shape(i->CURSOR_POINTING_HAND);
this->hover_animation_active = true;
//this->set("scale", Vector3(Vector3(this->get("scale")).x, 1.25 * Vector3(this->get("scale")).y, Vector3(this->get("scale")).z));
}
void godot::Structure::_on_Area_mouse_exited()
{
Clickable = false;
Input* i = Input::get_singleton();
i->set_default_cursor_shape(i->CURSOR_ARROW);
//this->set("scale", Vector3(Vector3(this->get("scale")).x, (1/1.25) * Vector3(this->get("scale")).y, Vector3(this->get("scale")).z));
this->set("scale", object_scale);
hover_animation_active = false;
hover_animation_counter = 0;
}
| 37.497967 | 312 | 0.633313 | jerry871002 |
975e0fbf7db66fa0dabd475718691bce9561d8e8 | 2,306 | cpp | C++ | src/or_ros_plugin_initializer.cpp | UM-ARM-Lab/or_ros_plugin_initializer | eaa0f06cb53277d60cfc940fa1db541276572087 | [
"BSD-2-Clause"
] | null | null | null | src/or_ros_plugin_initializer.cpp | UM-ARM-Lab/or_ros_plugin_initializer | eaa0f06cb53277d60cfc940fa1db541276572087 | [
"BSD-2-Clause"
] | 3 | 2017-09-08T01:31:00.000Z | 2018-02-25T22:03:03.000Z | src/or_ros_plugin_initializer.cpp | UM-ARM-Lab/or_ros_plugin_initializer | eaa0f06cb53277d60cfc940fa1db541276572087 | [
"BSD-2-Clause"
] | null | null | null | #include <openrave/plugin.h>
#include <boost/bind.hpp>
#include <ros/ros.h>
using namespace OpenRAVE;
namespace armlab_or_plugins
{
class ORROSPluginInitializer : public ModuleBase
{
public:
ORROSPluginInitializer(EnvironmentBasePtr penv) : ModuleBase(penv)
{
__description = "A plugin that parses the input data stream back onto argc and argv, then calls ros::init() with the given data.";
RegisterCommand("Initialize", boost::bind(&ORROSPluginInitializer::Initialize, this, _1, _2), "Initializes ROS, parsing the input data into argc and argv for ros::init");
}
private:
bool Initialize(std::ostream& sout, std::istream& sinput)
{
(void)sout;
char buffer[512];
sinput.getline(buffer, 511, '\0');
std::vector<char *> args;
std::istringstream string_stream(buffer);
while(!string_stream.eof())
{
std::string token;
string_stream >> token;
char* arg = new char[token.size() + 1];
std::copy(token.begin(), token.end(), arg);
arg[token.size()] = '\0';
args.push_back(arg);
}
int argc = (int)args.size();
ros::init(argc, args.data(), "openrave_ros_plugin", ros::init_options::NoSigintHandler);
for (char* arg: args)
{
delete[] arg;
}
return true;
}
};
}
// called to create a new plugin
InterfaceBasePtr CreateInterfaceValidated(InterfaceType type, const std::string& interfacename, std::istream& sinput, EnvironmentBasePtr penv)
{
(void)sinput;
if (type == PT_Module && interfacename == "orrosplugininitializer")
{
return InterfaceBasePtr(new armlab_or_plugins::ORROSPluginInitializer(penv));
}
return InterfaceBasePtr();
}
// called to query available plugins
void GetPluginAttributesValidated(PLUGININFO& info)
{
info.interfacenames[PT_Module].push_back("ORROSPluginInitializer");
}
// called before plugin is terminated
OPENRAVE_PLUGIN_API void DestroyPlugin()
{
}
| 31.162162 | 186 | 0.579358 | UM-ARM-Lab |
976068e04faa5cf81f933fc171fcd31c10055d30 | 298 | cpp | C++ | BOJ/code/002562_max_with_index.cpp | sml0399/implementation_of_algorithms | ea0b4e00f836875baea5946cca186ad80d7f5473 | [
"RSA-MD"
] | null | null | null | BOJ/code/002562_max_with_index.cpp | sml0399/implementation_of_algorithms | ea0b4e00f836875baea5946cca186ad80d7f5473 | [
"RSA-MD"
] | 1 | 2021-01-12T05:42:07.000Z | 2021-01-12T05:42:07.000Z | BOJ/code/002562_max_with_index.cpp | sml0399/implementation_of_algorithms | ea0b4e00f836875baea5946cca186ad80d7f5473 | [
"RSA-MD"
] | null | null | null | #include <iostream>
using namespace std;
int main(void){
int init_index=1;
int max_val=-1;
int new_num=1;
for(int i=0;i<9;i++){
cin>>new_num;
if(new_num>max_val){
init_index=i+1;
max_val=new_num;
}
}
cout<<max_val<<"\n";
cout<<init_index<<"\n";
return 0;
}
| 16.555556 | 25 | 0.590604 | sml0399 |
9761c5dea3e304a7ca0027a0edd3606915b8c986 | 32,263 | cpp | C++ | MoravaEngine/src/Renderer/RendererVoxelTerrain.cpp | imgui-works/MoravaEngine_opengl_vulkan_2d_3d_game_engine | b8e6ee3c3c890e9b8cf5de7bcb564b32f6767b6b | [
"Apache-2.0"
] | null | null | null | MoravaEngine/src/Renderer/RendererVoxelTerrain.cpp | imgui-works/MoravaEngine_opengl_vulkan_2d_3d_game_engine | b8e6ee3c3c890e9b8cf5de7bcb564b32f6767b6b | [
"Apache-2.0"
] | null | null | null | MoravaEngine/src/Renderer/RendererVoxelTerrain.cpp | imgui-works/MoravaEngine_opengl_vulkan_2d_3d_game_engine | b8e6ee3c3c890e9b8cf5de7bcb564b32f6767b6b | [
"Apache-2.0"
] | 1 | 2022-01-05T03:51:02.000Z | 2022-01-05T03:51:02.000Z | #include "Renderer/RendererVoxelTerrain.h"
#include "Core/Profiler.h"
#include "Core/ResourceManager.h"
#include "Shader/ShaderMain.h"
RendererVoxelTerrain::RendererVoxelTerrain()
{
SetUniforms();
SetShaders();
}
RendererVoxelTerrain::~RendererVoxelTerrain()
{
}
void RendererVoxelTerrain::Init(Scene* scene)
{
}
void RendererVoxelTerrain::SetUniforms()
{
// common
RendererBasic::GetUniforms().insert(std::make_pair("model", 0));
RendererBasic::GetUniforms().insert(std::make_pair("view", 0));
RendererBasic::GetUniforms().insert(std::make_pair("projection", 0));
RendererBasic::GetUniforms().insert(std::make_pair("nearPlane", 0));
RendererBasic::GetUniforms().insert(std::make_pair("farPlane", 0));
RendererBasic::GetUniforms().insert(std::make_pair("dirLightTransform", 0));
RendererBasic::GetUniforms().insert(std::make_pair("normalMap", 0));
RendererBasic::GetUniforms().insert(std::make_pair("lightPosition", 0));
// main
RendererBasic::GetUniforms().insert(std::make_pair("eyePosition", 0));
// water
RendererBasic::GetUniforms().insert(std::make_pair("reflectionTexture", 0));
RendererBasic::GetUniforms().insert(std::make_pair("refractionTexture", 0));
RendererBasic::GetUniforms().insert(std::make_pair("dudvMap", 0));
RendererBasic::GetUniforms().insert(std::make_pair("depthMap", 0));
RendererBasic::GetUniforms().insert(std::make_pair("moveFactor", 0));
RendererBasic::GetUniforms().insert(std::make_pair("cameraPosition", 0));
RendererBasic::GetUniforms().insert(std::make_pair("lightColor", 0));
// PBR - physically based rendering
RendererBasic::GetUniforms().insert(std::make_pair("albedo", 0));
RendererBasic::GetUniforms().insert(std::make_pair("metallic", 0));
RendererBasic::GetUniforms().insert(std::make_pair("roughness", 0));
RendererBasic::GetUniforms().insert(std::make_pair("ao", 0));
RendererBasic::GetUniforms().insert(std::make_pair("albedoMap", 0));
RendererBasic::GetUniforms().insert(std::make_pair("normalMap", 0));
RendererBasic::GetUniforms().insert(std::make_pair("metallicMap", 0));
RendererBasic::GetUniforms().insert(std::make_pair("roughnessMap", 0));
RendererBasic::GetUniforms().insert(std::make_pair("aoMap", 0));
RendererBasic::GetUniforms().insert(std::make_pair("camPos", 0));
RendererBasic::GetUniforms().insert(std::make_pair("ambientIntensity", 0));
// cubemap shader
RendererBasic::GetUniforms().insert(std::make_pair("equirectangularMap", 0));
// skybox Joey shader
RendererBasic::GetUniforms().insert(std::make_pair("environmentMap", 0));
}
void RendererVoxelTerrain::SetShaders()
{
H2M::RefH2M<MoravaShader> shaderMain = MoravaShader::Create("Shaders/shader.vert", "Shaders/shader.frag");
RendererBasic::GetShaders().insert(std::make_pair("main", shaderMain));
Log::GetLogger()->info("RendererVoxelTerrain: shaderMain compiled [programID={0}]", shaderMain->GetProgramID());
H2M::RefH2M<MoravaShader> shaderRenderInstanced = MoravaShader::Create("Shaders/render_instanced.vs", "Shaders/render_instanced.fs");
RendererBasic::GetShaders().insert(std::make_pair("render_instanced", shaderRenderInstanced));
Log::GetLogger()->info("RendererVoxelTerrain: shaderRenderInstanced compiled [programID={0}]", shaderRenderInstanced->GetProgramID());
H2M::RefH2M<MoravaShader> shaderBasic = MoravaShader::Create("Shaders/basic.vs", "Shaders/basic.fs");
RendererBasic::GetShaders().insert(std::make_pair("basic", shaderBasic));
Log::GetLogger()->info("RendererVoxelTerrain: shaderBasic compiled [programID={0}]", shaderBasic->GetProgramID());
H2M::RefH2M<MoravaShader> shaderMarchingCubes = MoravaShader::Create("Shaders/marching_cubes.vs", "Shaders/marching_cubes.fs");
RendererBasic::GetShaders().insert(std::make_pair("marching_cubes", shaderMarchingCubes));
Log::GetLogger()->info("RendererVoxelTerrain: shaderMarchingCubes compiled [programID={0}]", shaderMarchingCubes->GetProgramID());
H2M::RefH2M<MoravaShader> shaderShadowMap = MoravaShader::Create("Shaders/directional_shadow_map.vert", "Shaders/directional_shadow_map.frag");
RendererBasic::GetShaders().insert(std::make_pair("shadow_map", shaderShadowMap));
Log::GetLogger()->info("RendererEditor: shaderShadowMap compiled [programID={0}]", shaderShadowMap->GetProgramID());
H2M::RefH2M<MoravaShader> shaderOmniShadow = MoravaShader::Create("Shaders/omni_shadow_map.vert", "Shaders/omni_shadow_map.geom", "Shaders/omni_shadow_map.frag");
RendererBasic::GetShaders().insert(std::make_pair("omniShadow", shaderOmniShadow));
Log::GetLogger()->info("RendererVoxelTerrain: shaderOmniShadow compiled [programID={0}]", shaderOmniShadow->GetProgramID());
H2M::RefH2M<MoravaShader> shaderWater = MoravaShader::Create("Shaders/water.vert", "Shaders/water.frag");
RendererBasic::GetShaders().insert(std::make_pair("water", shaderWater));
printf("Renderer: Water shader compiled [programID=%d]\n", shaderWater->GetProgramID());
}
// BEGIN shadow render passes
void RendererVoxelTerrain::RenderPassShadow(Window* mainWindow, Scene* scene, glm::mat4 projectionMatrix)
{
if (!scene->GetSettings().enableShadows) return;
if (!LightManager::directionalLight.GetEnabled()) return;
if (LightManager::directionalLight.GetShadowMap() == nullptr) return;
H2M::RefH2M<MoravaShader> shaderShadowMap = RendererBasic::GetShaders()["shadow_map"];
shaderShadowMap->Bind();
DirectionalLight* light = &LightManager::directionalLight;
glViewport(0, 0, light->GetShadowMap()->GetShadowWidth(), light->GetShadowMap()->GetShadowHeight());
light->GetShadowMap()->BindForWriting();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glDisable(GL_BLEND);
/**** BEGIN shadow_map ****/
shaderShadowMap->SetMat4("u_DirLightTransform", LightManager::directionalLight.CalculateLightTransform());
shaderShadowMap->SetBool("u_Animated", false);
shaderShadowMap->Validate();
/**** END shadow_map ****/
DisableCulling();
std::string passType = "shadow_dir";
scene->Render(mainWindow, projectionMatrix, passType, RendererBasic::GetShaders(), RendererBasic::GetUniforms());
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
void RendererVoxelTerrain::RenderOmniShadows(Window* mainWindow, Scene* scene, glm::mat4 projectionMatrix)
{
if (!scene->GetSettings().enableOmniShadows) return;
for (size_t i = 0; i < LightManager::pointLightCount; i++)
{
if (LightManager::pointLights[i].GetEnabled())
{
RenderPassOmniShadow(&LightManager::pointLights[i], mainWindow, scene, projectionMatrix);
}
}
for (size_t i = 0; i < LightManager::spotLightCount; i++)
{
if (LightManager::spotLights[i].GetBasePL()->GetEnabled())
{
RenderPassOmniShadow((PointLight*)&LightManager::spotLights[i], mainWindow, scene, projectionMatrix);
}
}
}
void RendererVoxelTerrain::RenderPassOmniShadow(PointLight* light, Window* mainWindow, Scene* scene, glm::mat4 projectionMatrix)
{
if (!scene->GetSettings().enableOmniShadows) return;
RendererBasic::GetShaders()["omniShadow"]->Bind();
glViewport(0, 0, light->GetShadowMap()->GetShadowWidth(), light->GetShadowMap()->GetShadowHeight());
light->GetShadowMap()->BindForWriting();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glDisable(GL_BLEND);
RendererBasic::GetShaders()["omniShadow"]->SetFloat3("lightPosition", light->GetPosition());
RendererBasic::GetShaders()["omniShadow"]->SetFloat("farPlane", light->GetFarPlane());
std::vector<glm::mat4> lightMatrices = light->CalculateLightTransform();
for (unsigned int i = 0; i < lightMatrices.size(); i++) {
RendererBasic::GetShaders()["omniShadow"]->SetMat4("lightMatrices[" + std::to_string(i) + "]", lightMatrices[i]);
}
RendererBasic::GetShaders()["omniShadow"]->Validate();
EnableCulling();
std::string passType = "shadow_omni";
scene->Render(mainWindow, projectionMatrix, passType, RendererBasic::GetShaders(), RendererBasic::GetUniforms());
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
// END shadow render passes
// BEGIN water render passes
void RendererVoxelTerrain::RenderWaterEffects(float deltaTime, Window* mainWindow, Scene* scene, glm::mat4 projectionMatrix)
{
if (!scene->GetSettings().enableWaterEffects) return;
glEnable(GL_CLIP_DISTANCE0);
float waterMoveFactor = scene->GetWaterManager()->GetWaterMoveFactor();
waterMoveFactor += WaterManager::m_WaveSpeed * deltaTime;
if (waterMoveFactor >= 1.0f)
{
waterMoveFactor = waterMoveFactor - 1.0f;
}
scene->GetWaterManager()->SetWaterMoveFactor(waterMoveFactor);
float distance = 2.0f * (scene->GetCamera()->GetPosition().y - scene->GetSettings().waterHeight);
glm::vec3 cameraPosition = scene->GetCamera()->GetPosition();
glm::vec3 cameraPositionInverse = scene->GetCamera()->GetPosition();
cameraPositionInverse.y -= distance;
scene->GetCamera()->SetPosition(cameraPositionInverse);
scene->GetCameraController()->InvertPitch();
RenderPassWaterReflection(mainWindow, scene, projectionMatrix);
scene->GetCamera()->SetPosition(cameraPosition);
scene->GetCameraController()->InvertPitch();
RenderPassWaterRefraction(mainWindow, scene, projectionMatrix);
}
void RendererVoxelTerrain::RenderPassWaterReflection(Window* mainWindow, Scene* scene, glm::mat4 projectionMatrix)
{
glViewport(0, 0, scene->GetWaterManager()->GetFramebufferWidth(), scene->GetWaterManager()->GetFramebufferHeight());
scene->GetWaterManager()->GetReflectionFramebuffer()->Bind();
// Clear the window
RendererBasic::Clear();
H2M::RefH2M<ShaderMain> shaderMain = RendererBasic::GetShaders()["main"];
shaderMain->Bind();
RendererBasic::GetUniforms()["model"] = shaderMain->GetUniformLocation("model");
RendererBasic::GetUniforms()["projection"] = shaderMain->GetUniformLocation("projection");
RendererBasic::GetUniforms()["view"] = shaderMain->GetUniformLocation("view");
RendererBasic::GetUniforms()["eyePosition"] = shaderMain->GetUniformLocation("eyePosition");
RendererBasic::GetUniforms()["specularIntensity"] = shaderMain->GetUniformLocationMaterialSpecularIntensity();
RendererBasic::GetUniforms()["shininess"] = shaderMain->GetUniformLocationMaterialShininess();
glUniformMatrix4fv(RendererBasic::GetUniforms()["view"], 1, GL_FALSE, glm::value_ptr(scene->GetCamera()->GetViewMatrix()));
glUniformMatrix4fv(RendererBasic::GetUniforms()["projection"], 1, GL_FALSE, glm::value_ptr(projectionMatrix));
glUniform3f(RendererBasic::GetUniforms()["eyePosition"], scene->GetCamera()->GetPosition().x, scene->GetCamera()->GetPosition().y, scene->GetCamera()->GetPosition().z);
shaderMain->SetMat4("view", scene->GetCamera()->GetViewMatrix());
shaderMain->SetMat4("projection", projectionMatrix);
shaderMain->SetFloat3("eyePosition", scene->GetCamera()->GetPosition());
shaderMain->SetDirectionalLight(&LightManager::directionalLight);
shaderMain->SetPointLights(LightManager::pointLights, LightManager::pointLightCount, scene->GetTextureSlots()["omniShadow"], 0);
shaderMain->SetSpotLights(LightManager::spotLights, LightManager::spotLightCount, scene->GetTextureSlots()["omniShadow"], LightManager::pointLightCount);
shaderMain->SetMat4("dirLightTransform", LightManager::directionalLight.CalculateLightTransform());
LightManager::directionalLight.GetShadowMap()->ReadTexture(scene->GetTextureSlots()["shadow"]);
shaderMain->SetInt("albedoMap", scene->GetTextureSlots()["diffuse"]);
shaderMain->SetInt("normalMap", scene->GetTextureSlots()["normal"]);
shaderMain->SetInt("shadowMap", scene->GetTextureSlots()["shadow"]);
shaderMain->SetFloat4("clipPlane", glm::vec4(0.0f, 1.0f, 0.0f, -scene->GetSettings().waterHeight)); // reflection clip plane
shaderMain->SetFloat4("tintColor", glm::vec4(1.0f, 1.0f, 1.0f, 1.0f));
shaderMain->Validate();
H2M::RefH2M<MoravaShader> shaderRenderInstanced = RendererBasic::GetShaders()["render_instanced"];
shaderRenderInstanced->Bind();
shaderRenderInstanced->SetFloat4("clipPlane", glm::vec4(0.0f, 1.0f, 0.0f, -scene->GetSettings().waterHeight)); // reflection clip plane
shaderRenderInstanced->Validate();
EnableCulling();
std::string passType = "water";
scene->Render(mainWindow, projectionMatrix, passType, RendererBasic::GetShaders(), RendererBasic::GetUniforms());
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
void RendererVoxelTerrain::RenderPassWaterRefraction(Window* mainWindow, Scene* scene, glm::mat4 projectionMatrix)
{
glViewport(0, 0, scene->GetWaterManager()->GetFramebufferWidth(), scene->GetWaterManager()->GetFramebufferHeight());
scene->GetWaterManager()->GetRefractionFramebuffer()->Bind();
scene->GetWaterManager()->GetRefractionFramebuffer()->GetColorAttachment()->Bind(scene->GetTextureSlots()["refraction"]);
scene->GetWaterManager()->GetRefractionFramebuffer()->GetDepthAttachment()->Bind(scene->GetTextureSlots()["depth"]);
// Clear the window
RendererBasic::Clear();
H2M::RefH2M<ShaderMain> shaderMain = RendererBasic::GetShaders()["main"];
shaderMain->Bind();
RendererBasic::GetUniforms()["model"] = shaderMain->GetUniformLocation("model");
RendererBasic::GetUniforms()["projection"] = shaderMain->GetUniformLocation("projection");
RendererBasic::GetUniforms()["view"] = shaderMain->GetUniformLocation("view");
RendererBasic::GetUniforms()["eyePosition"] = shaderMain->GetUniformLocation("eyePosition");
RendererBasic::GetUniforms()["specularIntensity"] = shaderMain->GetUniformLocationMaterialSpecularIntensity();
RendererBasic::GetUniforms()["shininess"] = shaderMain->GetUniformLocationMaterialShininess();
shaderMain->SetMat4("view", scene->GetCamera()->GetViewMatrix());
shaderMain->SetMat4("projection", projectionMatrix);
shaderMain->SetFloat3("eyePosition", scene->GetCamera()->GetPosition());
shaderMain->SetDirectionalLight(&LightManager::directionalLight);
shaderMain->SetPointLights(LightManager::pointLights, LightManager::pointLightCount, scene->GetTextureSlots()["omniShadow"], 0);
shaderMain->SetSpotLights(LightManager::spotLights, LightManager::spotLightCount, scene->GetTextureSlots()["omniShadow"], LightManager::pointLightCount);
shaderMain->SetMat4("dirLightTransform", LightManager::directionalLight.CalculateLightTransform());
LightManager::directionalLight.GetShadowMap()->ReadTexture(scene->GetTextureSlots()["shadow"]);
shaderMain->SetInt("albedoMap", scene->GetTextureSlots()["diffuse"]);
shaderMain->SetInt("normalMap", scene->GetTextureSlots()["normal"]);
shaderMain->SetInt("shadowMap", scene->GetTextureSlots()["shadow"]);
shaderMain->SetFloat4("clipPlane", glm::vec4(0.0f, -1.0f, 0.0f, scene->GetSettings().waterHeight)); // refraction clip plane
shaderMain->SetFloat4("tintColor", glm::vec4(1.0f, 1.0f, 1.0f, 1.0f));
shaderMain->Validate();
H2M::RefH2M<MoravaShader> shaderRenderInstanced = RendererBasic::GetShaders()["render_instanced"];
shaderRenderInstanced->Bind();
shaderRenderInstanced->SetFloat4("clipPlane", glm::vec4(0.0f, -1.0f, 0.0f, scene->GetSettings().waterHeight)); // refraction clip plane
shaderRenderInstanced->Validate();
std::string passType = "water";
scene->Render(mainWindow, projectionMatrix, passType, RendererBasic::GetShaders(), RendererBasic::GetUniforms());
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
// END water render passes
void RendererVoxelTerrain::RenderPassMain(Window* mainWindow, Scene* scene, glm::mat4 projectionMatrix)
{
glDisable(GL_CLIP_DISTANCE0);
glViewport(0, 0, (GLsizei)mainWindow->GetWidth(), (GLsizei)mainWindow->GetHeight());
// Clear the window
RendererBasic::Clear();
/**** BEGIN shaderMain ****/
H2M::RefH2M<ShaderMain> shaderMain = RendererBasic::GetShaders()["main"];
shaderMain->Bind();
RendererBasic::GetUniforms()["model"] = shaderMain->GetUniformLocation("model");
RendererBasic::GetUniforms()["projection"] = shaderMain->GetUniformLocation("projection");
RendererBasic::GetUniforms()["view"] = shaderMain->GetUniformLocation("view");
RendererBasic::GetUniforms()["eyePosition"] = shaderMain->GetUniformLocation("eyePosition");
RendererBasic::GetUniforms()["specularIntensity"] = shaderMain->GetUniformLocationMaterialSpecularIntensity();
RendererBasic::GetUniforms()["shininess"] = shaderMain->GetUniformLocationMaterialShininess();
shaderMain->SetMat4("model", glm::mat4(1.0f));
shaderMain->SetMat4("view", scene->GetCamera()->GetViewMatrix());
shaderMain->SetMat4("projection", projectionMatrix);
shaderMain->SetFloat3("eyePosition", scene->GetCamera()->GetPosition());
// Directional Light
shaderMain->SetInt("directionalLight.base.enabled", LightManager::directionalLight.GetEnabled());
shaderMain->SetFloat3("directionalLight.base.color", LightManager::directionalLight.GetColor());
shaderMain->SetFloat("directionalLight.base.ambientIntensity", LightManager::directionalLight.GetAmbientIntensity());
shaderMain->SetFloat("directionalLight.base.diffuseIntensity", LightManager::directionalLight.GetDiffuseIntensity());
shaderMain->SetFloat3("directionalLight.direction", LightManager::directionalLight.GetDirection());
shaderMain->SetMat4("dirLightTransform", LightManager::directionalLight.CalculateLightTransform());
unsigned int textureUnit;
unsigned int offset;
// Point Lights
textureUnit = scene->GetTextureSlots()["omniShadow"];
offset = 0;
shaderMain->SetInt("pointLightCount", LightManager::pointLightCount);
for (int i = 0; i < (int)LightManager::pointLightCount; i++)
{
shaderMain->SetInt("pointLights[" + std::to_string(i) + "].base.enabled", LightManager::pointLights[i].GetEnabled());
shaderMain->SetFloat3("pointLights[" + std::to_string(i) + "].base.color", LightManager::pointLights[i].GetColor());
shaderMain->SetFloat("pointLights[" + std::to_string(i) + "].base.ambientIntensity", LightManager::pointLights[i].GetAmbientIntensity());
shaderMain->SetFloat("pointLights[" + std::to_string(i) + "].base.diffuseIntensity", LightManager::pointLights[i].GetDiffuseIntensity());
shaderMain->SetFloat3("pointLights[" + std::to_string(i) + "].position", LightManager::pointLights[i].GetPosition());
shaderMain->SetFloat("pointLights[" + std::to_string(i) + "].constant", LightManager::pointLights[i].GetConstant());
shaderMain->SetFloat("pointLights[" + std::to_string(i) + "].linear", LightManager::pointLights[i].GetLinear());
shaderMain->SetFloat("pointLights[" + std::to_string(i) + "].exponent", LightManager::pointLights[i].GetExponent());
LightManager::pointLights[i].GetShadowMap()->ReadTexture(textureUnit + offset + i);
shaderMain->SetInt("omniShadowMaps[" + std::to_string(offset + i) + "].shadowMap", textureUnit + offset + i);
shaderMain->SetFloat("omniShadowMaps[" + std::to_string(offset + i) + "].farPlane", LightManager::pointLights[i].GetFarPlane());
}
// Spot Lights
textureUnit = scene->GetTextureSlots()["omniShadow"];
offset = LightManager::pointLightCount;
shaderMain->SetInt("spotLightCount", LightManager::spotLightCount);
for (int i = 0; i < (int)LightManager::spotLightCount; i++)
{
shaderMain->SetInt("spotLights[" + std::to_string(i) + "].base.base.enabled", LightManager::spotLights[i].GetBasePL()->GetEnabled());
shaderMain->SetFloat3("spotLights[" + std::to_string(i) + "].base.base.color", LightManager::spotLights[i].GetBasePL()->GetColor());
shaderMain->SetFloat("spotLights[" + std::to_string(i) + "].base.base.ambientIntensity", LightManager::spotLights[i].GetBasePL()->GetAmbientIntensity());
shaderMain->SetFloat("spotLights[" + std::to_string(i) + "].base.base.diffuseIntensity", LightManager::spotLights[i].GetBasePL()->GetDiffuseIntensity());
shaderMain->SetFloat3("spotLights[" + std::to_string(i) + "].base.position", LightManager::spotLights[i].GetBasePL()->GetPosition());
shaderMain->SetFloat("spotLights[" + std::to_string(i) + "].base.constant", LightManager::spotLights[i].GetBasePL()->GetConstant());
shaderMain->SetFloat("spotLights[" + std::to_string(i) + "].base.linear", LightManager::spotLights[i].GetBasePL()->GetLinear());
shaderMain->SetFloat("spotLights[" + std::to_string(i) + "].base.exponent", LightManager::spotLights[i].GetBasePL()->GetExponent());
shaderMain->SetFloat3("spotLights[" + std::to_string(i) + "].direction", LightManager::spotLights[i].GetDirection());
shaderMain->SetFloat("spotLights[" + std::to_string(i) + "].edge", LightManager::spotLights[i].GetEdge());
LightManager::spotLights[i].GetShadowMap()->ReadTexture(textureUnit + offset + i);
shaderMain->SetInt("omniShadowMaps[" + std::to_string(offset + i) + "].shadowMap", textureUnit + offset + i);
shaderMain->SetFloat("omniShadowMaps[" + std::to_string(offset + i) + "].farPlane", LightManager::spotLights[i].GetFarPlane());
}
LightManager::directionalLight.GetShadowMap()->ReadTexture(scene->GetTextureSlots()["shadow"]);
shaderMain->SetInt("albedoMap", scene->GetTextureSlots()["diffuse"]);
shaderMain->SetInt("normalMap", scene->GetTextureSlots()["normal"]);
if (scene->GetSettings().enableShadows)
{
shaderMain->SetInt("shadowMap", scene->GetTextureSlots()["shadow"]);
}
shaderMain->SetFloat4("clipPlane", glm::vec4(0.0f, -1.0f, 0.0f, -10000));
shaderMain->SetFloat("tilingFactor", 1.0f);
shaderMain->Validate();
/**** END shaderMain ****/
/**** BEGIN shaderMarchingCubes ****/
H2M::RefH2M<MoravaShader> shaderMarchingCubes = RendererBasic::GetShaders()["marching_cubes"];
shaderMarchingCubes->Bind();
shaderMarchingCubes->SetMat4("model", glm::mat4(1.0f));
shaderMarchingCubes->SetMat4("view", scene->GetCamera()->GetViewMatrix());
shaderMarchingCubes->SetMat4("projection", projectionMatrix);
shaderMarchingCubes->SetFloat3("eyePosition", scene->GetCamera()->GetPosition());
// Directional Light
shaderMarchingCubes->SetInt("directionalLight.base.enabled", LightManager::directionalLight.GetEnabled());
shaderMarchingCubes->SetFloat3("directionalLight.base.color", LightManager::directionalLight.GetColor());
shaderMarchingCubes->SetFloat("directionalLight.base.ambientIntensity", LightManager::directionalLight.GetAmbientIntensity());
shaderMarchingCubes->SetFloat("directionalLight.base.diffuseIntensity", LightManager::directionalLight.GetDiffuseIntensity());
shaderMarchingCubes->SetFloat3("directionalLight.direction", LightManager::directionalLight.GetDirection());
shaderMarchingCubes->SetMat4("dirLightTransform", LightManager::directionalLight.CalculateLightTransform());
// Point Lights
textureUnit = scene->GetTextureSlots()["omniShadow"];
offset = 0;
shaderMarchingCubes->SetInt("pointLightCount", LightManager::pointLightCount);
for (int i = 0; i < (int)LightManager::pointLightCount; i++)
{
shaderMarchingCubes->SetInt("pointLights[" + std::to_string(i) + "].base.enabled", LightManager::pointLights[i].GetEnabled());
shaderMarchingCubes->SetFloat3("pointLights[" + std::to_string(i) + "].base.color", LightManager::pointLights[i].GetColor());
shaderMarchingCubes->SetFloat("pointLights[" + std::to_string(i) + "].base.ambientIntensity", LightManager::pointLights[i].GetAmbientIntensity());
shaderMarchingCubes->SetFloat("pointLights[" + std::to_string(i) + "].base.diffuseIntensity", LightManager::pointLights[i].GetDiffuseIntensity());
shaderMarchingCubes->SetFloat3("pointLights[" + std::to_string(i) + "].position", LightManager::pointLights[i].GetPosition());
shaderMarchingCubes->SetFloat("pointLights[" + std::to_string(i) + "].constant", LightManager::pointLights[i].GetConstant());
shaderMarchingCubes->SetFloat("pointLights[" + std::to_string(i) + "].linear", LightManager::pointLights[i].GetLinear());
shaderMarchingCubes->SetFloat("pointLights[" + std::to_string(i) + "].exponent", LightManager::pointLights[i].GetExponent());
LightManager::pointLights[i].GetShadowMap()->ReadTexture(textureUnit + offset + i);
shaderMarchingCubes->SetInt("omniShadowMaps[" + std::to_string(offset + i) + "].shadowMap", textureUnit + offset + i);
shaderMarchingCubes->SetFloat("omniShadowMaps[" + std::to_string(offset + i) + "].farPlane", LightManager::pointLights[i].GetFarPlane());
}
// Spot Lights
textureUnit = scene->GetTextureSlots()["omniShadow"];
offset = LightManager::pointLightCount;
shaderMarchingCubes->SetInt("spotLightCount", LightManager::spotLightCount);
for (int i = 0; i < (int)LightManager::spotLightCount; i++)
{
shaderMarchingCubes->SetInt("spotLights[" + std::to_string(i) + "].base.base.enabled", LightManager::spotLights[i].GetBasePL()->GetEnabled());
shaderMarchingCubes->SetFloat3("spotLights[" + std::to_string(i) + "].base.base.color", LightManager::spotLights[i].GetBasePL()->GetColor());
shaderMarchingCubes->SetFloat("spotLights[" + std::to_string(i) + "].base.base.ambientIntensity", LightManager::spotLights[i].GetBasePL()->GetAmbientIntensity());
shaderMarchingCubes->SetFloat("spotLights[" + std::to_string(i) + "].base.base.diffuseIntensity", LightManager::spotLights[i].GetBasePL()->GetDiffuseIntensity());
shaderMarchingCubes->SetFloat3("spotLights[" + std::to_string(i) + "].base.position", LightManager::spotLights[i].GetBasePL()->GetPosition());
shaderMarchingCubes->SetFloat("spotLights[" + std::to_string(i) + "].base.constant", LightManager::spotLights[i].GetBasePL()->GetConstant());
shaderMarchingCubes->SetFloat("spotLights[" + std::to_string(i) + "].base.linear", LightManager::spotLights[i].GetBasePL()->GetLinear());
shaderMarchingCubes->SetFloat("spotLights[" + std::to_string(i) + "].base.exponent", LightManager::spotLights[i].GetBasePL()->GetExponent());
shaderMarchingCubes->SetFloat3("spotLights[" + std::to_string(i) + "].direction", LightManager::spotLights[i].GetDirection());
shaderMarchingCubes->SetFloat("spotLights[" + std::to_string(i) + "].edge", LightManager::spotLights[i].GetEdge());
LightManager::spotLights[i].GetShadowMap()->ReadTexture(textureUnit + offset + i);
shaderMarchingCubes->SetInt("omniShadowMaps[" + std::to_string(offset + i) + "].shadowMap", textureUnit + offset + i);
shaderMarchingCubes->SetFloat("omniShadowMaps[" + std::to_string(offset + i) + "].farPlane", LightManager::spotLights[i].GetFarPlane());
}
LightManager::directionalLight.GetShadowMap()->ReadTexture(scene->GetTextureSlots()["shadow"]);
shaderMarchingCubes->SetInt("albedoMap", scene->GetTextureSlots()["diffuse"]);
shaderMarchingCubes->SetInt("normalMap", scene->GetTextureSlots()["normal"]);
if (scene->GetSettings().enableShadows)
shaderMarchingCubes->SetInt("shadowMap", scene->GetTextureSlots()["shadow"]);
shaderMarchingCubes->SetFloat4("clipPlane", glm::vec4(0.0f, -1.0f, 0.0f, -10000));
shaderMarchingCubes->SetFloat("tilingFactor", 1.0f);
shaderMarchingCubes->Validate();
/**** END shaderMarchingCubes ****/
/**** BEGIN shaderRenderInstanced ****/
H2M::RefH2M<MoravaShader> shaderRenderInstanced = RendererBasic::GetShaders()["render_instanced"];
shaderRenderInstanced->Bind();
shaderRenderInstanced->SetMat4("projection", projectionMatrix);
shaderRenderInstanced->SetMat4("view", scene->GetCamera()->GetViewMatrix());
shaderRenderInstanced->SetFloat3("eyePosition", scene->GetCamera()->GetPosition());
// Directional Light
shaderRenderInstanced->SetInt("directionalLight.base.enabled", LightManager::directionalLight.GetEnabled());
shaderRenderInstanced->SetFloat3("directionalLight.base.color", LightManager::directionalLight.GetColor());
shaderRenderInstanced->SetFloat("directionalLight.base.ambientIntensity", LightManager::directionalLight.GetAmbientIntensity());
shaderRenderInstanced->SetFloat("directionalLight.base.diffuseIntensity", LightManager::directionalLight.GetDiffuseIntensity());
shaderRenderInstanced->SetFloat3("directionalLight.direction", LightManager::directionalLight.GetDirection());
shaderRenderInstanced->SetFloat("material.specularIntensity", ResourceManager::s_MaterialSpecular); // TODO - use material attribute
shaderRenderInstanced->SetFloat("material.shininess", ResourceManager::s_MaterialShininess); // TODO - use material attribute
shaderRenderInstanced->SetFloat4("clipPlane", glm::vec4(0.0f, -1.0f, 0.0f, -10000));
shaderRenderInstanced->Validate();
/**** END shaderRenderInstanced ****/
/**** BEGIN shaderBasic ****/
H2M::RefH2M<MoravaShader> shaderBasic = RendererBasic::GetShaders()["basic"];
shaderBasic->Bind();
shaderBasic->SetMat4("projection", projectionMatrix);
shaderBasic->SetMat4("view", scene->GetCamera()->GetViewMatrix());
shaderBasic->Validate();
/**** END shaderBasic ****/
scene->GetSettings().enableCulling ? EnableCulling() : DisableCulling();
std::string passType = "main";
scene->Render(mainWindow, projectionMatrix, passType, RendererBasic::GetShaders(), RendererBasic::GetUniforms());
// shaderMain->Unbind();
// shaderMarchingCubes->Unbind();
// shaderRenderInstanced->Unbind();
// shaderBasic->Unbind();
/**** BEGIN render water ****/
EnableTransparency();
H2M::RefH2M<MoravaShader> shaderWater = RendererBasic::GetShaders()["water"];
shaderWater->Bind();
RendererBasic::GetUniforms()["model"] = shaderWater->GetUniformLocation("model");
RendererBasic::GetUniforms()["projection"] = shaderWater->GetUniformLocation("projection");
RendererBasic::GetUniforms()["view"] = shaderWater->GetUniformLocation("view");
RendererBasic::GetUniforms()["reflectionTexture"] = shaderWater->GetUniformLocation("reflectionTexture");
RendererBasic::GetUniforms()["refractionTexture"] = shaderWater->GetUniformLocation("refractionTexture");
RendererBasic::GetUniforms()["dudvMap"] = shaderWater->GetUniformLocation("dudvMap");
RendererBasic::GetUniforms()["normalMap"] = shaderWater->GetUniformLocation("normalMap");
RendererBasic::GetUniforms()["depthMap"] = shaderWater->GetUniformLocation("depthMap");
RendererBasic::GetUniforms()["moveFactor"] = shaderWater->GetUniformLocation("moveFactor");
RendererBasic::GetUniforms()["cameraPosition"] = shaderWater->GetUniformLocation("cameraPosition");
RendererBasic::GetUniforms()["lightColor"] = shaderWater->GetUniformLocation("lightColor");
RendererBasic::GetUniforms()["lightPosition"] = shaderWater->GetUniformLocation("lightPosition");
RendererBasic::GetUniforms()["nearPlane"] = shaderWater->GetUniformLocation("nearPlane");
RendererBasic::GetUniforms()["farPlane"] = shaderWater->GetUniformLocation("farPlane");
shaderWater->SetMat4("model", glm::mat4(1.0f));
shaderWater->SetMat4("view", scene->GetCamera()->GetViewMatrix());
shaderWater->SetMat4("projection", projectionMatrix);
scene->GetWaterManager()->GetRefractionFramebuffer()->GetDepthAttachment()->Bind(scene->GetTextureSlots()["depth"]);
scene->GetTextures()["waterDuDv"]->Bind(scene->GetTextureSlots()["DuDv"]);
shaderWater->SetFloat("nearPlane", scene->GetSettings().nearPlane);
shaderWater->SetFloat("farPlane", scene->GetSettings().farPlane);
shaderWater->SetInt("reflectionTexture", scene->GetTextureSlots()["reflection"]);
shaderWater->SetInt("refractionTexture", scene->GetTextureSlots()["refraction"]);
shaderWater->SetInt("normalMap", scene->GetTextureSlots()["normal"]);
shaderWater->SetInt("depthMap", scene->GetTextureSlots()["depth"]);
shaderWater->SetInt("dudvMap", scene->GetTextureSlots()["DuDv"]);
shaderWater->SetFloat("moveFactor", scene->GetWaterManager()->GetWaterMoveFactor());
shaderWater->SetFloat3("cameraPosition", scene->GetCamera()->GetPosition());
shaderWater->SetFloat3("lightColor", LightManager::directionalLight.GetColor());
shaderWater->SetFloat3("lightPosition", LightManager::directionalLight.GetPosition());
shaderWater->Validate();
scene->GetSettings().enableCulling ? EnableCulling() : DisableCulling();
passType = "main";
scene->RenderWater(projectionMatrix, passType, RendererBasic::GetShaders(), RendererBasic::GetUniforms());
shaderWater->Unbind();
/**** END render water ****/
}
void RendererVoxelTerrain::BeginFrame()
{
}
void RendererVoxelTerrain::WaitAndRender(float deltaTime, Window* mainWindow, Scene* scene, glm::mat4 projectionMatrix)
{
{
Profiler profiler("RVT::RenderPassShadow");
RenderPassShadow(mainWindow, scene, projectionMatrix);
scene->GetProfilerResults()->insert(std::make_pair(profiler.GetName(), profiler.Stop()));
}
// RenderOmniShadows(mainWindow, scene, projectionMatrix);
{
Profiler profiler("RVT::RenderWaterEffects");
RenderWaterEffects(deltaTime, mainWindow, scene, projectionMatrix);
}
{
Profiler profiler("RVT::RenderPass");
RenderPassMain(mainWindow, scene, projectionMatrix);
scene->GetProfilerResults()->insert(std::make_pair(profiler.GetName(), profiler.Stop()));
}
}
| 54.962521 | 169 | 0.756005 | imgui-works |
97620c5fdaef9b7a0055691c209fd36f7947ad52 | 6,329 | cpp | C++ | lte/gateway/c/core/oai/test/s1ap_task/test_s1ap_mme_handlers_with_injected_state.cpp | nstng/magma | dec2691450f4bdd9e25d1e2eb0a38dc893dfeb7f | [
"BSD-3-Clause"
] | 539 | 2019-02-25T05:03:10.000Z | 2020-07-24T11:13:15.000Z | lte/gateway/c/core/oai/test/s1ap_task/test_s1ap_mme_handlers_with_injected_state.cpp | nstng/magma | dec2691450f4bdd9e25d1e2eb0a38dc893dfeb7f | [
"BSD-3-Clause"
] | 1,729 | 2019-02-25T16:02:33.000Z | 2020-07-24T23:40:07.000Z | lte/gateway/c/core/oai/test/s1ap_task/test_s1ap_mme_handlers_with_injected_state.cpp | nstng/magma | dec2691450f4bdd9e25d1e2eb0a38dc893dfeb7f | [
"BSD-3-Clause"
] | 210 | 2019-02-25T13:34:53.000Z | 2020-07-23T20:16:18.000Z | /**
* Copyright 2021 The Magma Authors.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*
* 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 <gtest/gtest.h>
#include <thread>
#include "lte/gateway/c/core/oai/test/mock_tasks/mock_tasks.hpp"
extern "C" {
#include "lte/gateway/c/core/common/dynamic_memory_check.h"
#include "lte/gateway/c/core/oai/common/log.h"
#include "lte/gateway/c/core/oai/include/mme_config.h"
#include "lte/gateway/c/core/oai/include/s1ap_state.hpp"
#include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h"
}
#include "lte/gateway/c/core/oai/test/s1ap_task/s1ap_mme_test_utils.h"
#include "lte/gateway/c/core/oai/test/s1ap_task/mock_s1ap_op.h"
#include "lte/gateway/c/core/oai/tasks/s1ap/s1ap_state_manager.hpp"
extern bool hss_associated;
namespace magma {
namespace lte {
task_zmq_ctx_t task_zmq_ctx_main_s1ap_with_injected_states;
// mocking the message handler for the ITTI
static int handle_message(zloop_t* loop, zsock_t* reader, void* arg) {
MessageDef* received_message_p = receive_msg(reader);
switch (ITTI_MSG_ID(received_message_p)) {
// TODO: adding the message handler for different types of message
default: {
} break;
}
itti_free_msg_content(received_message_p);
free(received_message_p);
return 0;
}
class S1apMmeHandlersWithInjectedStatesTest : public ::testing::Test {
virtual void SetUp() {
mme_app_handler = std::make_shared<MockMmeAppHandler>();
sctp_handler = std::make_shared<MockSctpHandler>();
itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info,
NULL, NULL);
// initialize mme config
mme_config_init(&mme_config);
create_partial_lists(&mme_config);
mme_config.use_stateless = false;
hss_associated = true;
task_id_t task_id_list[4] = {TASK_MME_APP, TASK_S1AP, TASK_SCTP,
TASK_SERVICE303};
init_task_context(TASK_MAIN, task_id_list, 4, handle_message,
&task_zmq_ctx_main_s1ap_with_injected_states);
std::thread task_mme_app(start_mock_mme_app_task, mme_app_handler);
std::thread task_sctp(start_mock_sctp_task, sctp_handler);
task_mme_app.detach();
task_sctp.detach();
s1ap_mme_init(&mme_config);
// add injection of state loaded in S1AP state manager
std::string magma_root = std::getenv("MAGMA_ROOT");
std::string state_data_path =
magma_root + "/" + DEFAULT_S1AP_STATE_DATA_PATH;
std::string data_folder_path =
magma_root + "/" + DEFAULT_S1AP_CONTEXT_DATA_PATH;
std::string data_list_path =
magma_root + "/" + DEFAULT_S1AP_CONTEXT_DATA_PATH + "data_list.txt";
assoc_id = 37;
stream_id = 1;
number_attached_ue = 2;
mock_read_s1ap_state_db(state_data_path);
name_of_ue_samples =
load_file_into_vector_of_line_content(data_folder_path, data_list_path);
mock_read_s1ap_ue_state_db(name_of_ue_samples);
state = S1apStateManager::getInstance().get_state(false);
}
virtual void TearDown() {
// Sleep to ensure that messages are received and contexts are released
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
send_terminate_message_fatal(&task_zmq_ctx_main_s1ap_with_injected_states);
destroy_task_context(&task_zmq_ctx_main_s1ap_with_injected_states);
itti_free_desc_threads();
free_mme_config(&mme_config);
// Sleep to ensure that messages are received and contexts are released
std::this_thread::sleep_for(std::chrono::milliseconds(1500));
}
protected:
std::shared_ptr<MockMmeAppHandler> mme_app_handler;
std::shared_ptr<MockSctpHandler> sctp_handler;
s1ap_state_t* state;
sctp_assoc_id_t assoc_id;
sctp_stream_id_t stream_id;
std::vector<std::string> name_of_ue_samples;
int number_attached_ue;
};
TEST_F(S1apMmeHandlersWithInjectedStatesTest, GenerateUEContextReleaseCommand) {
ue_description_t ue_ref_p = {
.enb_ue_s1ap_id = 1,
.mme_ue_s1ap_id = 99,
.sctp_assoc_id = assoc_id,
.comp_s1ap_id = S1AP_GENERATE_COMP_S1AP_ID(assoc_id, 1)};
ue_ref_p.s1ap_ue_context_rel_timer.id = -1;
ue_ref_p.s1ap_ue_context_rel_timer.msec = 1000;
S1ap_S1AP_PDU_t pdu_s1;
memset(&pdu_s1, 0, sizeof(pdu_s1));
ASSERT_EQ(RETURNok, generate_s1_setup_request_pdu(&pdu_s1));
// State validation
ASSERT_TRUE(
is_enb_state_valid(state, assoc_id, S1AP_READY, number_attached_ue));
ASSERT_TRUE(is_num_enbs_valid(state, 1));
// Invalid S1 Cause returns error
ASSERT_EQ(RETURNerror, s1ap_mme_generate_ue_context_release_command(
state, &ue_ref_p, S1AP_IMPLICIT_CONTEXT_RELEASE,
INVALID_IMSI64, assoc_id, stream_id, 99, 1));
// Valid S1 Causes passess successfully
ASSERT_EQ(RETURNok, s1ap_mme_generate_ue_context_release_command(
state, &ue_ref_p, S1AP_INITIAL_CONTEXT_SETUP_FAILED,
INVALID_IMSI64, assoc_id, stream_id, 99, 1));
EXPECT_NE(ue_ref_p.s1ap_ue_context_rel_timer.id, S1AP_TIMER_INACTIVE_ID);
// State validation
ASSERT_TRUE(
is_enb_state_valid(state, assoc_id, S1AP_READY, number_attached_ue));
// Freeing pdu and payload data
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1ap_S1AP_PDU, &pdu_s1);
}
TEST_F(S1apMmeHandlersWithInjectedStatesTest, HandleS1apPathSwitchRequest) {
ASSERT_EQ(task_zmq_ctx_main_s1ap_with_injected_states.ready, true);
// State validation
ASSERT_TRUE(
is_enb_state_valid(state, assoc_id, S1AP_READY, number_attached_ue));
ASSERT_TRUE(is_num_enbs_valid(state, 1));
ASSERT_EQ(state->mmeid2associd.num_elements, number_attached_ue);
// Send S1AP_PATH_SWITCH_REQUEST_ACK mimicing MME_APP
ASSERT_EQ(send_s1ap_path_switch_req(assoc_id, 1, 7), RETURNok);
// verify number of ues after sending S1AP_PATH_SWITCH_REQUEST_ACK
ASSERT_TRUE(
is_enb_state_valid(state, assoc_id, S1AP_READY, number_attached_ue));
}
} // namespace lte
} // namespace magma
| 35.55618 | 80 | 0.746089 | nstng |
9762821f1e884562a60ec9eaee98342ec2c480f1 | 937 | cpp | C++ | data/test/cpp/9762821f1e884562a60ec9eaee98342ec2c480f1servicelocator.cpp | harshp8l/deep-learning-lang-detection | 2a54293181c1c2b1a2b840ddee4d4d80177efb33 | [
"MIT"
] | 84 | 2017-10-25T15:49:21.000Z | 2021-11-28T21:25:54.000Z | data/test/cpp/9762821f1e884562a60ec9eaee98342ec2c480f1servicelocator.cpp | vassalos/deep-learning-lang-detection | cbb00b3e81bed3a64553f9c6aa6138b2511e544e | [
"MIT"
] | 5 | 2018-03-29T11:50:46.000Z | 2021-04-26T13:33:18.000Z | data/test/cpp/9762821f1e884562a60ec9eaee98342ec2c480f1servicelocator.cpp | vassalos/deep-learning-lang-detection | cbb00b3e81bed3a64553f9c6aa6138b2511e544e | [
"MIT"
] | 24 | 2017-11-22T08:31:00.000Z | 2022-03-27T01:22:31.000Z | #include "includes/servicelocator.h"
void LogLocator::initialize()
{
std::shared_ptr<LogEngine> null_service(new NullLogEngine);
service_ = null_service;
}
std::shared_ptr<LogEngine> LogLocator::GetLogEngine()
{
return service_;
}
void LogLocator::provide(std::shared_ptr<LogEngine> service)
{
if (!service)
{
initialize();
}
else
{
service_ = service;
service->RecieveNotification();
}
if (GetLogEngine()->getLogFile().empty())
{
GetLogEngine()->setLogFile("debug.log");
}
}
LogLocator::~LogLocator()
{
}
///////////////////////////////////////////////////////////////////////////////
std::shared_ptr<LogEngine> Services::GetLogEngine()
{
return LogLocator::GetLogEngine();
}
void Services::initialize()
{
if (LogLocator::GetLogEngine())
{
LogLocator::GetLogEngine()->RecieveNotification();
}
}
Services::~Services()
{
}
| 16.732143 | 79 | 0.584845 | harshp8l |
9765c8a50f00e6b08d045ca6e3a456fb5457b036 | 7,725 | cpp | C++ | src/main.cpp | hixfield/HixIRBlaster | c3a6954fb1eed82e8ad7cbe9f8f3904e4f9734c6 | [
"MIT"
] | null | null | null | src/main.cpp | hixfield/HixIRBlaster | c3a6954fb1eed82e8ad7cbe9f8f3904e4f9734c6 | [
"MIT"
] | null | null | null | src/main.cpp | hixfield/HixIRBlaster | c3a6954fb1eed82e8ad7cbe9f8f3904e4f9734c6 | [
"MIT"
] | null | null | null | #include "HixConfig.h"
#include "HixMQTT.h"
#include "HixWebServer.h"
#include "secret.h"
#include <Arduino.h>
#include <ArduinoOTA.h>
#include <IRac.h>
#include <IRrecv.h>
#include <IRremoteESP8266.h>
#include <IRtext.h>
#include <IRutils.h>
#include <ir_Samsung.h>
// runtime global variables
HixConfig g_config;
HixWebServer g_webServer(g_config);
HixMQTT g_mqtt(g_config,
Secret::WIFI_SSID,
Secret::WIFI_PWD,
g_config.getMQTTServer(),
g_config.getDeviceType(),
g_config.getDeviceVersion(),
g_config.getRoom(),
g_config.getDeviceTag());
//hardware related
IRSamsungAc g_IRTransmitter(D3);
IRrecv g_IRReciever(D5, 1024, 40, true);
//software global vars
bool g_bACIsOn = false;
//////////////////////////////////////////////////////////////////////////////////
// Helper functions
//////////////////////////////////////////////////////////////////////////////////
void configureOTA() {
Serial.println("Configuring OTA, my hostname:");
Serial.println(g_mqtt.getMqttClientName());
ArduinoOTA.setHostname(g_mqtt.getMqttClientName());
ArduinoOTA.setPort(8266);
//setup handlers
ArduinoOTA.onStart([]() {
Serial.println("OTA -> Start");
});
ArduinoOTA.onEnd([]() {
Serial.println("OTA -> End");
});
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
Serial.printf("OTA -> Progress: %u%%\r", (progress / (total / 100)));
});
ArduinoOTA.onError([](ota_error_t error) {
Serial.printf("OTA -> Error[%u]: ", error);
if (error == OTA_AUTH_ERROR)
Serial.println("OTA -> Auth Failed");
else if (error == OTA_BEGIN_ERROR)
Serial.println("OTA -> Begin Failed");
else if (error == OTA_CONNECT_ERROR)
Serial.println("OTA -> Connect Failed");
else if (error == OTA_RECEIVE_ERROR)
Serial.println("OTA -> Receive Failed");
else if (error == OTA_END_ERROR)
Serial.println("OTA -> End Failed");
});
ArduinoOTA.begin();
}
void resetWithMessage(const char * szMessage) {
Serial.println(szMessage);
delay(2000);
ESP.reset();
}
void printACState() {
Serial.println("Samsung A/C remote is in the following state:");
Serial.printf(" %s\n", g_IRTransmitter.toString().c_str());
}
void AC_On(int nTemperature) {
Serial.print("AC ON to ");
Serial.print(nTemperature);
Serial.println(" C");
//to avoid detecting our own transmitted signal, switch off detector first
g_IRReciever.disableIRIn();
//transmit our commands
g_IRTransmitter.on();
g_IRTransmitter.setFan(kSamsungAcFanAuto);
g_IRTransmitter.setMode(kSamsungAcAuto);
g_IRTransmitter.setTemp(nTemperature);
g_IRTransmitter.setSwing(true);
g_IRTransmitter.send();
//re-enable our IR detector
g_IRReciever.enableIRIn();
//keep our state
g_bACIsOn = true;
}
void AC_Off(void) {
Serial.print("AC OFF");
//to avoid detecting our own transmitted signal, switch off detector first
g_IRReciever.disableIRIn();
//transmit our commands
g_IRTransmitter.off();
g_IRTransmitter.send();
//re-enable our IR detector
g_IRReciever.enableIRIn();
//keep our state
g_bACIsOn = false;
}
void AC_toggle(int nTemperature) {
if (g_bACIsOn)
AC_Off();
else
AC_On(nTemperature);
}
bool handleIRCommand(decode_results results) {
switch (results.value) {
//Telenet IR : play button
case 0x48C6EAFF:
AC_On(28);
return true;
//Telenet IR : pause button
case 0xAA33049:
AC_Off();
return true;
default:
Serial.print("Unrecognized code received ");
Serial.println(resultToHexidecimal(&results));
}
//nothing handled
return false;
}
bool checkIR(void) {
decode_results results;
// Check if the IR code has been received.
if (g_IRReciever.decode(&results)) {
// Check if we got an IR message that was to big for our capture buffer.
if (results.overflow) Serial.println("Error IR capture buffer overflow");
// Display the basic output of what we found.
Serial.print("IR Received: ");
Serial.println(resultToHexidecimal(&results));
//did find something!
return handleIRCommand(results);
}
//return not found
return false;
}
//////////////////////////////////////////////////////////////////////////////////
// Setup
//////////////////////////////////////////////////////////////////////////////////
void setup() {
//print startup config
Serial.begin(115200);
Serial.print(F("Startup "));
Serial.print(g_config.getDeviceType());
Serial.print(F(" "));
Serial.println(g_config.getDeviceVersion());
//disconnect WiFi -> seams to help for bug that after upload wifi does not want to connect again...
Serial.println(F("Disconnecting WIFI"));
WiFi.disconnect();
// configure MQTT
Serial.println(F("Setting up MQTT"));
if (!g_mqtt.begin()) resetWithMessage("MQTT allocation failed, resetting");
//setup SPIFFS
Serial.println(F("Setting up SPIFFS"));
if (!SPIFFS.begin()) resetWithMessage("SPIFFS initialization failed, resetting");
//setup the server
Serial.println(F("Setting up web server"));
g_webServer.begin(); //configure ir transmitter
Serial.println("Setting up IR Transmitter");
g_IRTransmitter.begin();
//configure receiver
Serial.println("Setting up IR Receiver");
g_IRReciever.setUnknownThreshold(12);
g_IRReciever.enableIRIn();
//all done
Serial.println("Setup complete");
//set to known state
AC_Off();
}
//////////////////////////////////////////////////////////////////////////////////
// Loop
//////////////////////////////////////////////////////////////////////////////////
void loop() {
//other loop functions
g_mqtt.loop();
g_webServer.handleClient();
ArduinoOTA.handle();
//my own processing
checkIR();
}
//////////////////////////////////////////////////////////////////////////////////
// Required by the MQTT library
//////////////////////////////////////////////////////////////////////////////////
void onConnectionEstablished() {
//setup OTA
if (g_config.getOTAEnabled()) {
configureOTA();
} else {
Serial.println("OTA is disabled");
}
//publish values
g_mqtt.publishDeviceValues();
g_mqtt.publishStatusValues(false, NULL);
//register for ac temperature
g_mqtt.subscribe(g_mqtt.topicForPath("subscribe/ac_temperature"), [](const String & payload) {
g_config.setACTemperature(payload.toInt());
g_config.commitToEEPROM();
g_mqtt.publishDeviceValues();
if (g_bACIsOn) {
AC_On(g_config.getACTemperature());
}
});
//ACC on
g_mqtt.subscribe(g_mqtt.topicForPath("subscribe/ac_on"), [](const String & payload) {
AC_On(g_config.getACTemperature());
g_mqtt.publishStatusValues(g_bACIsOn, NULL);
});
//ACC off
g_mqtt.subscribe(g_mqtt.topicForPath("subscribe/ac_off"), [](const String & payload) {
AC_Off();
g_mqtt.publishStatusValues(g_bACIsOn, NULL);
});
//ACC toggle
g_mqtt.subscribe(g_mqtt.topicForPath("subscribe/ac_toggle"), [](const String & payload) {
AC_toggle(g_config.getACTemperature());
g_mqtt.publishStatusValues(g_bACIsOn, NULL);
});
//RAW IR send
g_mqtt.subscribe(g_mqtt.topicForPath("subscribe/send_raw_ir"), [](const String & payload) {
Serial.println("Not implemtned yet send_raw_ir");
});
} | 31.024096 | 103 | 0.590421 | hixfield |
9766e69a3f35868c1e6305d430e86f975943c091 | 451 | cpp | C++ | src/prod/src/Transport/Trace.cpp | vishnuk007/service-fabric | d0afdea185ae932cc3c9eacf179692e6fddbc630 | [
"MIT"
] | 2,542 | 2018-03-14T21:56:12.000Z | 2019-05-06T01:18:20.000Z | src/prod/src/Transport/Trace.cpp | vishnuk007/service-fabric | d0afdea185ae932cc3c9eacf179692e6fddbc630 | [
"MIT"
] | 994 | 2019-05-07T02:39:30.000Z | 2022-03-31T13:23:04.000Z | src/prod/src/Transport/Trace.cpp | vishnuk007/service-fabric | d0afdea185ae932cc3c9eacf179692e6fddbc630 | [
"MIT"
] | 300 | 2018-03-14T21:57:17.000Z | 2019-05-06T20:07:00.000Z | // ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------
#include "stdafx.h"
namespace Transport
{
TransportEventSource const trace;
Common::TextTraceComponent<Common::TraceTaskCodes::Transport> textTrace;
}
| 32.214286 | 98 | 0.547672 | vishnuk007 |
9767dfb1a725fa9ae232f2c9e57b067c1937a06b | 1,482 | cpp | C++ | src/test/core/ParserTest.cpp | hypro/hypro | 52ae4ffe0a8427977fce8d7979fffb82a1bc28f6 | [
"MIT"
] | 22 | 2016-10-05T12:19:01.000Z | 2022-01-23T09:14:41.000Z | src/test/core/ParserTest.cpp | hypro/hypro | 52ae4ffe0a8427977fce8d7979fffb82a1bc28f6 | [
"MIT"
] | 23 | 2017-05-08T15:02:39.000Z | 2021-11-03T16:43:39.000Z | src/test/core/ParserTest.cpp | hypro/hypro | 52ae4ffe0a8427977fce8d7979fffb82a1bc28f6 | [
"MIT"
] | 12 | 2017-06-07T23:51:09.000Z | 2022-01-04T13:06:21.000Z | #include "gtest/gtest.h"
#include <fstream>
#include <hypro/datastructures/HybridAutomaton/HybridAutomaton.h>
#include <hypro/datastructures/reachability/Settings.h>
#include <hypro/parser/antlr4-flowstar/ParserWrapper.h>
TEST( ParserTest, ParseAutomaton ) {
using namespace hypro;
// create model-file.
std::ofstream file( "/tmp/automaton.model" );
#include "models/automaton.h"
file << autString;
file.close();
// test content
std::string filename = "/tmp/automaton.model";
std::pair<HybridAutomaton<mpq_class>, ReachabilitySettings> parseResult = parseFlowstarFile<mpq_class>( filename );
ReachabilitySettings settings = parseResult.second;
HybridAutomaton<mpq_class> automaton = parseResult.first;
EXPECT_EQ( unsigned( 3 ), automaton.getLocations().size() );
EXPECT_EQ( unsigned( 3 ), automaton.getTransitions().size() );
}
TEST( ParserTest, ParseAutomaton_2 ) {
using namespace hypro;
// create model-file.
std::ofstream file( "/tmp/automaton_2.model" );
#include "models/automaton_2.h"
file << autString;
file.close();
// test content
std::string filename = "/tmp/automaton_2.model";
std::pair<HybridAutomaton<mpq_class>, ReachabilitySettings> parseResult = parseFlowstarFile<mpq_class>( filename );
ReachabilitySettings settings = parseResult.second;
HybridAutomaton<mpq_class> automaton = parseResult.first;
EXPECT_EQ( unsigned( 2 ), automaton.getLocations().size() );
EXPECT_EQ( unsigned( 3 ), automaton.getTransitions().size() );
}
| 28.5 | 116 | 0.751687 | hypro |
976c4149789956fee078a3de90d99e6043886fad | 416 | cpp | C++ | oj/sp/CRDS.cpp | shivanib01/codes | f0761472a4b4bea3667c0c13b1c9bcfe5b2597a3 | [
"MIT"
] | null | null | null | oj/sp/CRDS.cpp | shivanib01/codes | f0761472a4b4bea3667c0c13b1c9bcfe5b2597a3 | [
"MIT"
] | null | null | null | oj/sp/CRDS.cpp | shivanib01/codes | f0761472a4b4bea3667c0c13b1c9bcfe5b2597a3 | [
"MIT"
] | null | null | null | /*
* Created by
* Shivani Bhardwaj <shivanib134@gmail.com>
*/
#include<iostream>
#define MOD 1000007
using namespace std;
int main()
{
int T;
uint64_t N,r,s;
cin>>T;
while(T--)
{
cin>>N;
r=N*(N+1);
r%=MOD;
s=N*(N-1);
s/=2;
s%=MOD;
r+=s;
r%=MOD;
cout<<r<<"\n";
}
}
| 14.857143 | 44 | 0.377404 | shivanib01 |
9774dcb1f5bcf2b97467e4ec34013ab6e8306940 | 7,165 | cpp | C++ | Samples/NodeEditor/Font/FontGen.cpp | gamekit-developers/gamekit | 74c896af5826ebe8fb72f2911015738f38ab7bb2 | [
"Zlib",
"MIT"
] | 241 | 2015-01-04T00:36:58.000Z | 2022-01-06T19:19:23.000Z | Samples/NodeEditor/Font/FontGen.cpp | slagusev/gamekit | a6e97fcf2a9c3b9b9799bc12c3643818503ffc7d | [
"MIT"
] | 10 | 2015-07-10T18:27:17.000Z | 2019-06-26T20:59:59.000Z | Samples/NodeEditor/Font/FontGen.cpp | slagusev/gamekit | a6e97fcf2a9c3b9b9799bc12c3643818503ffc7d | [
"MIT"
] | 82 | 2015-01-25T18:02:35.000Z | 2022-03-05T12:28:17.000Z | /*
-------------------------------------------------------------------------------
This file is part of OgreKit.
http://gamekit.googlecode.com/
Copyright (c) 2006-2010 Charlie C.
Contributor(s): none yet.
-------------------------------------------------------------------------------
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 <wx/app.h>
#include <wx/image.h>
#include <wx/menu.h>
#include <wx/panel.h>
#include <wx/dcclient.h>
#include <wx/sizer.h>
#include <wx/fontdlg.h>
#include <wx/statbox.h>
#include <wx/button.h>
#include <wx/filedlg.h>
#include <wx/font.h>
#include <wx/dialog.h>
#include <wx/dcmemory.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/font.h>
#include <wx/gauge.h>
#include <wx/spinctrl.h>
#include <wx/checkbox.h>
#include <vector>
#define CHARBEG 32
#define CHAREND 127
#define TOT (CHAREND - CHARBEG)
#define ID_FONT 10002
#define ID_SFONT 10003
#define SIZEX 255
#define SIZEY 72
#define PAD 20
#define PADS 10
static int pow2( int n )
{
--n;
n |= n >> 16;
n |= n >> 8;
n |= n >> 4;
n |= n >> 2;
n |= n >> 1;
++n;
return n;
}
static bool SAVE_IMA = false;
static wxString NAME = wxT( "" );
typedef struct wxTextExtents
{
float width, height;
} wxTextExtents;
typedef struct wxCharacter
{
float xco, yco;
float width, height;
} wxCharacter;
class wxGLFont
{
public:
typedef std::vector<wxCharacter*> CharacterVector;
public:
wxGLFont( const wxFont& font, int size );
~wxGLFont();
void Save( const wxString& out );
private:
void Create();
void Destory();
unsigned char* m_imaData;
wxPoint FindSize( int res );
int m_offset, m_maxChar;
float m_width, m_height;
float m_baseHeight;
float m_baseWidth;
wxCoord m_res;
wxFont m_font;
CharacterVector m_chars;
};
wxGLFont::wxGLFont( const wxFont& font, int size )
{
m_imaData = 0;
m_offset = 0;
m_width = 2;
m_height = 2;
m_baseHeight = 2;
m_res = size;
m_font = font;
Create();
}
wxGLFont::~wxGLFont()
{
Destory();
}
void wxGLFont::Destory()
{
if ( m_imaData )
delete [] m_imaData;
m_imaData = 0;
for ( wxGLFont::CharacterVector::iterator it = m_chars.begin();
it != m_chars.end(); ++it )
delete ( *it );
m_chars.clear();
}
wxPoint wxGLFont::FindSize( int res )
{
wxMemoryDC dc;
m_font.SetPointSize( res );
dc.SetFont( m_font );
wxCoord w, h;
wxCoord mw = 0.0, mh = 0.0;
wxCoord pad = 5;
for ( size_t i = CHARBEG; i < CHAREND; i++ )
{
wxString str( ( wxChar )i );
dc.GetTextExtent( str, &w, &h );
mw = wxMax( w, mw );
mh = wxMax( h, mh );
}
wxCoord r = ( mw + pad ) * ( mh + pad ) * TOT;
wxCoord t = ( wxCoord )sqrtf( ( float )r );
t += wxMax( mw, mh );
wxCoord p = pow2( t );
wxCoord wi = p, he = p;
if ( p* p * 0.5 >= r )
he = p * 0.5;
return wxPoint( wi, he );
}
void wxGLFont::Create()
{
Destory();
wxCoord padding = 5;
wxPoint pt = FindSize( m_res );
m_width = pt.x; m_height = pt.y;
wxMemoryDC dc;
wxBitmap bitmap( m_width, m_height );
dc.SelectObject( bitmap );
m_font.SetPointSize( m_res );
dc.SetBackground( wxColour( 0, 0, 0, 0 ) );
dc.Clear();
dc.SetFont( m_font );
dc.SetTextForeground( wxColour( 0xFFFFFF ) );
wxCoord xpos = 0, ypos = 0;
for ( size_t i = CHARBEG; i < CHAREND; i++ )
{
wxString str( ( wxChar )i );
wxCharacter* ch = new wxCharacter;
ch->xco = ch->yco = 0;
ch->width = ch->height = 0;
m_chars.push_back( ch );
wxCoord w, h;
dc.GetTextExtent( str, &w, &h );
ch->xco = xpos;
ch->yco = ypos;
ch->width = w;
ch->height = h;
m_baseHeight = wxMax( m_baseHeight, h );
m_baseWidth = wxMax( m_baseWidth, w );
/* next char */
dc.DrawText( str, xpos, ypos );
xpos += ( w + padding );
if ( ( xpos + ( w + padding ) ) > ( m_width - m_res ) )
{
xpos = 0;
ypos += ( h + padding );
}
}
wxImage ima = bitmap.ConvertToImage();
if ( SAVE_IMA )
{
wxString tname = NAME;
tname.Replace( wxT( ".font" ), wxT( "" ) );
tname = wxString::Format( wxT( "%s%i.png" ), tname, m_res );
ima.SaveFile( tname );
}
int size = m_width * m_height;
m_imaData = new unsigned char[size];
unsigned char* pixels = ima.GetData();
/* convert to alpha */
for ( int y = 0; y < m_height; y++ )
{
for ( int x = 0; x < m_width; x++ )
{
int in = ( y * m_width + x ) * 3;
int out = ( y * m_width + x );
/* just take red */
m_imaData[out+0] = pixels[in];
}
}
}
void wxGLFont::Save( const wxString& out )
{
// save to C++ compile-able file
}
class FontFrame : public wxDialog
{
public:
FontFrame();
virtual ~FontFrame();
void initialize();
void OnQuit( wxCloseEvent& evt );
void OnSelectFont( wxCommandEvent& evt );
class wxGLFont* m_font;
wxSpinButton* m_resGetter;
int mRes;
DECLARE_EVENT_TABLE();
};
FontFrame::FontFrame() :
wxDialog( NULL, wxID_ANY, wxT( "Font Generator" ), wxDefaultPosition, wxSize( SIZEX, SIZEY ), wxDEFAULT_DIALOG_STYLE )
{
SetMinSize( wxSize( SIZEX, SIZEY ) );
m_font = 0;
m_resGetter = 0;
}
FontFrame::~FontFrame()
{
if ( m_font != 0 )
{
delete m_font;
m_font = 0;
}
}
void FontFrame::initialize()
{
Show( true );
wxSizer* sizer = new wxBoxSizer( wxHORIZONTAL );
sizer->SetMinSize( wxSize( SIZEY * 2, SIZEY ) );
wxButton* button = new wxButton( this, ID_FONT, "Select Font:" );
sizer->Add( button, wxSizerFlags(0).Align(wxCENTER).Border(wxALL, 10));
SetSizer( sizer );
sizer->SetSizeHints( this );
}
void FontFrame::OnQuit( wxCloseEvent& evt )
{
Destroy();
}
void FontFrame::OnSelectFont( wxCommandEvent& evt )
{
wxFontDialog dlg( this );
if ( dlg.ShowModal() == wxID_OK )
{
wxFont font = dlg.GetFontData().GetChosenFont();
if ( font.IsOk() )
{
wxFileDialog dlg( this, wxT( "Save Font File" ), wxT( "" ), wxT( "" ), wxT( "C++ Font files (*.inl)|*.inl" ) );
if ( dlg.ShowModal() == wxID_OK )
{
wxGLFont out(font, font.GetPointSize());
out.Save(dlg.GetPath());
}
}
}
}
BEGIN_EVENT_TABLE( FontFrame, wxDialog )
EVT_CLOSE( FontFrame::OnQuit )
EVT_BUTTON( ID_FONT, FontFrame::OnSelectFont )
END_EVENT_TABLE()
class Application : public wxApp
{
public:
bool OnInit()
{
wxInitAllImageHandlers();
FontFrame* app = new FontFrame();
app->initialize();
return true;
}
};
IMPLEMENT_APP( Application );
| 18.61039 | 119 | 0.619958 | gamekit-developers |
9777594691a8ea3733d7cb02e2b1ca29e91db8e3 | 22,146 | cpp | C++ | SDK/ARKSurvivalEvolved_Chalico_Character_BP_functions.cpp | 2bite/ARK-SDK | c38ca9925309516b2093ad8c3a70ed9489e1d573 | [
"MIT"
] | 10 | 2020-02-17T19:08:46.000Z | 2021-07-31T11:07:19.000Z | SDK/ARKSurvivalEvolved_Chalico_Character_BP_functions.cpp | 2bite/ARK-SDK | c38ca9925309516b2093ad8c3a70ed9489e1d573 | [
"MIT"
] | 9 | 2020-02-17T18:15:41.000Z | 2021-06-06T19:17:34.000Z | SDK/ARKSurvivalEvolved_Chalico_Character_BP_functions.cpp | 2bite/ARK-SDK | c38ca9925309516b2093ad8c3a70ed9489e1d573 | [
"MIT"
] | 3 | 2020-07-22T17:42:07.000Z | 2021-06-19T17:16:13.000Z | // ARKSurvivalEvolved (329.9) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
#include "ARKSurvivalEvolved_Chalico_Character_BP_parameters.hpp"
namespace sdk
{
//---------------------------------------------------------------------------
//Functions
//---------------------------------------------------------------------------
// Function Chalico_Character_BP.Chalico_Character_BP_C.BPOnAnimPlayedNotify
// ()
// Parameters:
// class UAnimMontage** AnimMontage (Parm, ZeroConstructor, IsPlainOldData)
// float* InPlayRate (Parm, ZeroConstructor, IsPlainOldData)
// struct FName* StartSectionName (Parm, ZeroConstructor, IsPlainOldData)
// bool* bReplicate (Parm, ZeroConstructor, IsPlainOldData)
// bool* bReplicateToOwner (Parm, ZeroConstructor, IsPlainOldData)
// bool* bForceTickPoseAndServerUpdateMesh (Parm, ZeroConstructor, IsPlainOldData)
// bool* bForceTickPoseOnServer (Parm, ZeroConstructor, IsPlainOldData)
void AChalico_Character_BP_C::BPOnAnimPlayedNotify(class UAnimMontage** AnimMontage, float* InPlayRate, struct FName* StartSectionName, bool* bReplicate, bool* bReplicateToOwner, bool* bForceTickPoseAndServerUpdateMesh, bool* bForceTickPoseOnServer)
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.BPOnAnimPlayedNotify");
AChalico_Character_BP_C_BPOnAnimPlayedNotify_Params params;
params.AnimMontage = AnimMontage;
params.InPlayRate = InPlayRate;
params.StartSectionName = StartSectionName;
params.bReplicate = bReplicate;
params.bReplicateToOwner = bReplicateToOwner;
params.bForceTickPoseAndServerUpdateMesh = bForceTickPoseAndServerUpdateMesh;
params.bForceTickPoseOnServer = bForceTickPoseOnServer;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.BlueprintCanAttack
// ()
// Parameters:
// int* AttackIndex (Parm, ZeroConstructor, IsPlainOldData)
// float* Distance (Parm, ZeroConstructor, IsPlainOldData)
// float* attackRangeOffset (Parm, ZeroConstructor, IsPlainOldData)
// class AActor** OtherTarget (Parm, ZeroConstructor, IsPlainOldData)
// bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
bool AChalico_Character_BP_C::BlueprintCanAttack(int* AttackIndex, float* Distance, float* attackRangeOffset, class AActor** OtherTarget)
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.BlueprintCanAttack");
AChalico_Character_BP_C_BlueprintCanAttack_Params params;
params.AttackIndex = AttackIndex;
params.Distance = Distance;
params.attackRangeOffset = attackRangeOffset;
params.OtherTarget = OtherTarget;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
return params.ReturnValue;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.CheckForNewBiome
// ()
void AChalico_Character_BP_C::CheckForNewBiome()
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.CheckForNewBiome");
AChalico_Character_BP_C_CheckForNewBiome_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.SelectMudMesh
// ()
void AChalico_Character_BP_C::SelectMudMesh()
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.SelectMudMesh");
AChalico_Character_BP_C_SelectMudMesh_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.HasConflictWithAI
// ()
// Parameters:
// bool NewParam (Parm, OutParm, ZeroConstructor, IsPlainOldData)
void AChalico_Character_BP_C::HasConflictWithAI(bool* NewParam)
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.HasConflictWithAI");
AChalico_Character_BP_C_HasConflictWithAI_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
if (NewParam != nullptr)
*NewParam = params.NewParam;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.CanLookForChalicos
// ()
// Parameters:
// bool canLook (Parm, OutParm, ZeroConstructor, IsPlainOldData)
void AChalico_Character_BP_C::CanLookForChalicos(bool* canLook)
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.CanLookForChalicos");
AChalico_Character_BP_C_CanLookForChalicos_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
if (canLook != nullptr)
*canLook = params.canLook;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.DeactivateThrowMode
// ()
void AChalico_Character_BP_C::DeactivateThrowMode()
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.DeactivateThrowMode");
AChalico_Character_BP_C_DeactivateThrowMode_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.ReactToMudHit
// ()
// Parameters:
// class AActor* Instigator (Parm, ZeroConstructor, IsPlainOldData)
void AChalico_Character_BP_C::ReactToMudHit(class AActor* Instigator)
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.ReactToMudHit");
AChalico_Character_BP_C_ReactToMudHit_Params params;
params.Instigator = Instigator;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.Is FriendlyTarget in Range
// ()
// Parameters:
// class AActor* mudTarget (Parm, ZeroConstructor, IsPlainOldData)
// bool canUseMud (Parm, OutParm, ZeroConstructor, IsPlainOldData)
void AChalico_Character_BP_C::Is_FriendlyTarget_in_Range(class AActor* mudTarget, bool* canUseMud)
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.Is FriendlyTarget in Range");
AChalico_Character_BP_C_Is_FriendlyTarget_in_Range_Params params;
params.mudTarget = mudTarget;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
if (canUseMud != nullptr)
*canUseMud = params.canUseMud;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.CanThrowMud
// ()
// Parameters:
// class AActor* mudTarget (Parm, ZeroConstructor, IsPlainOldData)
// bool canThrow (Parm, OutParm, ZeroConstructor, IsPlainOldData)
void AChalico_Character_BP_C::CanThrowMud(class AActor* mudTarget, bool* canThrow)
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.CanThrowMud");
AChalico_Character_BP_C_CanThrowMud_Params params;
params.mudTarget = mudTarget;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
if (canThrow != nullptr)
*canThrow = params.canThrow;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.CanStandUp
// ()
// Parameters:
// bool canStand (Parm, OutParm, ZeroConstructor, IsPlainOldData)
void AChalico_Character_BP_C::CanStandUp(bool* canStand)
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.CanStandUp");
AChalico_Character_BP_C_CanStandUp_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
if (canStand != nullptr)
*canStand = params.canStand;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.BPPreventRiding
// ()
// Parameters:
// class AShooterCharacter** ByPawn (Parm, ZeroConstructor, IsPlainOldData)
// bool* bDontCheckDistance (Parm, ZeroConstructor, IsPlainOldData)
// bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
bool AChalico_Character_BP_C::BPPreventRiding(class AShooterCharacter** ByPawn, bool* bDontCheckDistance)
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.BPPreventRiding");
AChalico_Character_BP_C_BPPreventRiding_Params params;
params.ByPawn = ByPawn;
params.bDontCheckDistance = bDontCheckDistance;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
return params.ReturnValue;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.BPGetMultiUseEntries
// (NetReliable, NetRequest, Exec, Native, Event, NetResponse, Static, NetMulticast, Public, Private, NetServer, HasOutParms, DLLImport, BlueprintCallable, BlueprintEvent, BlueprintPure)
// Parameters:
// class APlayerController** ForPC (Parm, ZeroConstructor, IsPlainOldData)
// TArray<struct FMultiUseEntry> MultiUseEntries (Parm, OutParm, ZeroConstructor, ReferenceParm)
// TArray<struct FMultiUseEntry> ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm)
TArray<struct FMultiUseEntry> AChalico_Character_BP_C::STATIC_BPGetMultiUseEntries(class APlayerController** ForPC, TArray<struct FMultiUseEntry>* MultiUseEntries)
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.BPGetMultiUseEntries");
AChalico_Character_BP_C_BPGetMultiUseEntries_Params params;
params.ForPC = ForPC;
auto flags = fn->FunctionFlags;
fn->FunctionFlags |= 0x400;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
if (MultiUseEntries != nullptr)
*MultiUseEntries = params.MultiUseEntries;
return params.ReturnValue;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.BPTryMultiUse
// ()
// Parameters:
// class APlayerController** ForPC (Parm, ZeroConstructor, IsPlainOldData)
// int* UseIndex (Parm, ZeroConstructor, IsPlainOldData)
// bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData)
bool AChalico_Character_BP_C::BPTryMultiUse(class APlayerController** ForPC, int* UseIndex)
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.BPTryMultiUse");
AChalico_Character_BP_C_BPTryMultiUse_Params params;
params.ForPC = ForPC;
params.UseIndex = UseIndex;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
return params.ReturnValue;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.ShouldStandUp
// ()
// Parameters:
// bool standUp (Parm, OutParm, ZeroConstructor, IsPlainOldData)
void AChalico_Character_BP_C::ShouldStandUp(bool* standUp)
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.ShouldStandUp");
AChalico_Character_BP_C_ShouldStandUp_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
if (standUp != nullptr)
*standUp = params.standUp;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.BPTimerServer
// ()
void AChalico_Character_BP_C::BPTimerServer()
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.BPTimerServer");
AChalico_Character_BP_C_BPTimerServer_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.CanSitDown
// ()
// Parameters:
// bool canSit (Parm, OutParm, ZeroConstructor, IsPlainOldData)
void AChalico_Character_BP_C::CanSitDown(bool* canSit)
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.CanSitDown");
AChalico_Character_BP_C_CanSitDown_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
if (canSit != nullptr)
*canSit = params.canSit;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.Look for Chalicos
// (NetReliable, Native, NetResponse, Public, Private, NetServer, HasOutParms, DLLImport, BlueprintCallable, BlueprintEvent, BlueprintPure)
void AChalico_Character_BP_C::Look_for_Chalicos()
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.Look for Chalicos");
AChalico_Character_BP_C_Look_for_Chalicos_Params params;
auto flags = fn->FunctionFlags;
fn->FunctionFlags |= 0x400;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.UserConstructionScript
// ()
void AChalico_Character_BP_C::UserConstructionScript()
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.UserConstructionScript");
AChalico_Character_BP_C_UserConstructionScript_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.BlueprintAnimNotifyCustomEvent
// ()
// Parameters:
// struct FName* CustomEventName (Parm, ZeroConstructor, IsPlainOldData)
// class USkeletalMeshComponent** MeshComp (Parm, ZeroConstructor, IsPlainOldData)
// class UAnimSequenceBase** Animation (Parm, ZeroConstructor, IsPlainOldData)
// class UAnimNotify** AnimNotifyObject (ConstParm, Parm, ZeroConstructor, IsPlainOldData)
void AChalico_Character_BP_C::BlueprintAnimNotifyCustomEvent(struct FName* CustomEventName, class USkeletalMeshComponent** MeshComp, class UAnimSequenceBase** Animation, class UAnimNotify** AnimNotifyObject)
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.BlueprintAnimNotifyCustomEvent");
AChalico_Character_BP_C_BlueprintAnimNotifyCustomEvent_Params params;
params.CustomEventName = CustomEventName;
params.MeshComp = MeshComp;
params.Animation = Animation;
params.AnimNotifyObject = AnimNotifyObject;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.standUp
// ()
void AChalico_Character_BP_C::standUp()
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.standUp");
AChalico_Character_BP_C_standUp_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.TrySittingDown
// ()
void AChalico_Character_BP_C::TrySittingDown()
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.TrySittingDown");
AChalico_Character_BP_C_TrySittingDown_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.TryStandingUp
// ()
void AChalico_Character_BP_C::TryStandingUp()
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.TryStandingUp");
AChalico_Character_BP_C_TryStandingUp_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.SetChalicoFocus
// ()
// Parameters:
// class AActor* NewFocus (Parm, ZeroConstructor, IsPlainOldData)
void AChalico_Character_BP_C::SetChalicoFocus(class AActor* NewFocus)
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.SetChalicoFocus");
AChalico_Character_BP_C_SetChalicoFocus_Params params;
params.NewFocus = NewFocus;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.ClearChalicoFocus
// ()
void AChalico_Character_BP_C::ClearChalicoFocus()
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.ClearChalicoFocus");
AChalico_Character_BP_C_ClearChalicoFocus_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.StartMudThrow
// ()
// Parameters:
// class AActor* Target (Parm, ZeroConstructor, IsPlainOldData)
void AChalico_Character_BP_C::StartMudThrow(class AActor* Target)
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.StartMudThrow");
AChalico_Character_BP_C_StartMudThrow_Params params;
params.Target = Target;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.CloseRetaliation
// ()
void AChalico_Character_BP_C::CloseRetaliation()
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.CloseRetaliation");
AChalico_Character_BP_C_CloseRetaliation_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.TryThrowMud
// ()
void AChalico_Character_BP_C::TryThrowMud()
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.TryThrowMud");
AChalico_Character_BP_C_TryThrowMud_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.OnSittingEvent
// ()
void AChalico_Character_BP_C::OnSittingEvent()
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.OnSittingEvent");
AChalico_Character_BP_C_OnSittingEvent_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.OnThrowMudEvent
// ()
void AChalico_Character_BP_C::OnThrowMudEvent()
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.OnThrowMudEvent");
AChalico_Character_BP_C_OnThrowMudEvent_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.ReceiveBeginPlay
// ()
void AChalico_Character_BP_C::ReceiveBeginPlay()
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.ReceiveBeginPlay");
AChalico_Character_BP_C_ReceiveBeginPlay_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.BPUnstasis
// ()
void AChalico_Character_BP_C::BPUnstasis()
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.BPUnstasis");
AChalico_Character_BP_C_BPUnstasis_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.SitDown
// ()
void AChalico_Character_BP_C::SitDown()
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.SitDown");
AChalico_Character_BP_C_SitDown_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.QuickLoadSitState
// ()
void AChalico_Character_BP_C::QuickLoadSitState()
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.QuickLoadSitState");
AChalico_Character_BP_C_QuickLoadSitState_Params params;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
// Function Chalico_Character_BP.Chalico_Character_BP_C.ExecuteUbergraph_Chalico_Character_BP
// ()
// Parameters:
// int EntryPoint (Parm, ZeroConstructor, IsPlainOldData)
void AChalico_Character_BP_C::ExecuteUbergraph_Chalico_Character_BP(int EntryPoint)
{
static auto fn = UObject::FindObject<UFunction>("Function Chalico_Character_BP.Chalico_Character_BP_C.ExecuteUbergraph_Chalico_Character_BP");
AChalico_Character_BP_C_ExecuteUbergraph_Chalico_Character_BP_Params params;
params.EntryPoint = EntryPoint;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| 30.336986 | 249 | 0.745372 | 2bite |
977be7eb035c04b9fbf91842863d924427b0d299 | 3,681 | hpp | C++ | net/simulation/request.hpp | ORNL-QCI/armish-fireplace | 69a270a3f468a9d44f65b6abd77d3dcdd4ca6f91 | [
"BSD-3-Clause"
] | 1 | 2020-06-18T23:09:10.000Z | 2020-06-18T23:09:10.000Z | net/simulation/request.hpp | ORNL-QCI/armish-fireplace | 69a270a3f468a9d44f65b6abd77d3dcdd4ca6f91 | [
"BSD-3-Clause"
] | null | null | null | net/simulation/request.hpp | ORNL-QCI/armish-fireplace | 69a270a3f468a9d44f65b6abd77d3dcdd4ca6f91 | [
"BSD-3-Clause"
] | 1 | 2020-06-18T23:10:30.000Z | 2020-06-18T23:10:30.000Z | #ifndef _NET_SIMULATION_REQUEST_HPP
#define _NET_SIMULATION_REQUEST_HPP
#include <common.hpp>
#include <functional>
#include <rapidjson/document.h>
#include <rapidjson/stringbuffer.h>
#include <rapidjson/writer.h>
/**
* \brief The JSON object name that holds the method string value.
*/
#define NET_MIDDLEWARE_SIMULATION_METHOD_STR "method"
/**
* \brief The JSON object name that holds the parameters array values.
*/
#define NET_MIDDLEWARE_SIMULATION_PARAMS_STR "parameters"
namespace net {
namespace simulation {
/**
* \brief A request for the simulation server.
*/
class request {
public:
/**
* \brief Direct object constructor with cstring.
*
* If reAllocate is true, we copy the method string.
*/
request(const char* const method, const bool reAllocate);
/**
* \brief Copy constructor is disabled.
*/
request(const request&) = delete;
/**
* \brief Move constructor.
*/
request(request&& old);
/**
* \brief Assignment operator is disabled.
*/
request& operator=(const request&) = delete;
/**
* \brief Move assignment operator.
*/
request& operator=(request&& old);
/**
* \brief Add a parameter to the request parameter array.
*
* This returns a reference to the current object as to implement a fluent
* interface.
*
* The reallocate template parameter signifies whether or not we are to
* reallocate the data when adding it to our request. This is by default true,
* which doesn't make a difference when dealing with numeric types. However
* for cstring this means we can skip a copy of the string.
*/
template <typename T, bool reallocate = true>
inline request& add(const T data) {
static_assert(!(
(std::is_same<T, char*>::value ||
std::is_same<T, const char*>::value ||
std::is_same<T, char* const>::value ||
std::is_same<T, const char* const>::value ||
std::is_same<T, unsigned char*>::value ||
std::is_same<T, const unsigned char*>::value ||
std::is_same<T, unsigned char* const>::value ||
std::is_same<T, const unsigned char* const>::value)
&& reallocate),
"Function only takes arrays/buffers as references");
dom[NET_MIDDLEWARE_SIMULATION_PARAMS_STR].PushBack(data, domAllctr);
return *this;
}
/**
* \brief Generate the json string from the request.
*/
void generate_json();
/**
* \brief Return a char array that is a JSON encoding of the object.
*
* \warning You must call generate_json() before calling.
*/
const char* get_json() const {
return jBuffer.GetString();
}
/**
* \brief Return a the length of the JSON string.
*
* \warning This includes the null terminator.
*/
std::size_t get_json_str_size() const {
return jBuffer.GetSize()+1;
}
private:
/**
* \brief The RapidJSON document that stores the request in object form.
*/
::rapidjson::Document dom;
/**
* \brief The allocator for the RapidJSON document, used for faster access.
*/
std::reference_wrapper<::rapidjson::Document::AllocatorType> domAllctr;
/**
* \brief The RapidJSON buffer for the json string.
*/
::rapidjson::StringBuffer jBuffer;
};
/**
* \brief Add a cstring by reference to the parameter array.
*/
template <>
inline request& request::add<const char*, false>(const char* const data) {
dom[NET_MIDDLEWARE_SIMULATION_PARAMS_STR].PushBack(
::rapidjson::Value().SetString(::rapidjson::StringRef(data)),
domAllctr);
return *this;
}
}
}
#endif
| 26.482014 | 81 | 0.645477 | ORNL-QCI |
97807f636c765e316cc56cf2d2e3b4a9bb38ee1c | 303 | cpp | C++ | test/Test_Massey.cpp | NickG-Math/Mackey | 0bd1e5b8aca16f3422c4ab9c5656990e1b501e54 | [
"MIT"
] | null | null | null | test/Test_Massey.cpp | NickG-Math/Mackey | 0bd1e5b8aca16f3422c4ab9c5656990e1b501e54 | [
"MIT"
] | null | null | null | test/Test_Massey.cpp | NickG-Math/Mackey | 0bd1e5b8aca16f3422c4ab9c5656990e1b501e54 | [
"MIT"
] | null | null | null | #ifdef _MSC_VER
#define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS //Eigen won't work otherwise.
#endif
#define MACKEY_USE_OPEN_MP
#include "Groups/C4.hpp"
#include "impl/Test_Massey.ipp"
int main()
{
mackey::test::test_Massey<C4<Eigen::Matrix<short, 1, -1>, Eigen::SparseMatrix<short>>>();
return 0;
} | 23.307692 | 90 | 0.755776 | NickG-Math |
9780d5976b9a2177d795eac9c3e514991b7d4434 | 48 | cpp | C++ | src/Variable.cpp | jonahisadev/jaylang | d4895defbd4439c17337151099bcca906ad59cb0 | [
"MIT"
] | null | null | null | src/Variable.cpp | jonahisadev/jaylang | d4895defbd4439c17337151099bcca906ad59cb0 | [
"MIT"
] | null | null | null | src/Variable.cpp | jonahisadev/jaylang | d4895defbd4439c17337151099bcca906ad59cb0 | [
"MIT"
] | null | null | null | #include <Jay/Variable.h>
namespace Jay {
} | 6.857143 | 25 | 0.645833 | jonahisadev |
97845eee4bcfc72dfc283f98c4fb2bb1682db878 | 1,942 | cc | C++ | control/test_stand/thrust_stand_control_test_bq.cc | sentree/hover-jet | 7c0f03e57ecfd07a7a167b3ae509700fb48b8764 | [
"MIT"
] | 10 | 2018-12-26T23:08:40.000Z | 2021-02-04T23:22:01.000Z | control/test_stand/thrust_stand_control_test_bq.cc | sentree/hover-jet | 7c0f03e57ecfd07a7a167b3ae509700fb48b8764 | [
"MIT"
] | 40 | 2018-12-15T21:10:04.000Z | 2021-07-29T06:21:22.000Z | control/test_stand/thrust_stand_control_test_bq.cc | sentree/hover-jet | 7c0f03e57ecfd07a7a167b3ae509700fb48b8764 | [
"MIT"
] | 6 | 2018-12-15T20:46:19.000Z | 2020-11-27T09:39:34.000Z | // %bin(thrust_stand_control_test_balsaq_main)
#include "control/test_stand/thrust_stand_control_test_bq.hh"
#include "infrastructure/balsa_queue/bq_main_macro.hh"
// %deps(yaml-cpp)
#include <cassert>
namespace jet {
namespace control {
namespace {
// Generate a servo command from the pre-ordained yaml format
QuadraframeStatus servo_commands_from_angle_list(const YAML::Node& yml_node) {
QuadraframeStatus status;
status.servo_0_angle_rad = yml_node[0].as<double>();
status.servo_1_angle_rad = yml_node[1].as<double>();
status.servo_2_angle_rad = yml_node[2].as<double>();
status.servo_3_angle_rad = yml_node[3].as<double>();
return status;
}
} // namespace
void ThrustStandControlTestBq::init(const Config& config) {
//
// Read configuration
//
for (const auto& command : config["commands"]) {
const auto qframe_status = servo_commands_from_angle_list(command);
command_sequence_.push_back(qframe_status);
}
assert(!command_sequence_.empty());
//
// Set up IPC
//
servo_pub_ = make_publisher("servo_command_channel");
}
void ThrustStandControlTestBq::loop() {
//
// Manage location in the command sequence
//
command_index_ += 1;
if (command_index_ % 500 == 0) {
std::cout << "Issuing command: " << command_index_ << std::endl;
}
const int max_command_index = static_cast<int>(command_sequence_.size()) - 1;
if (command_index_ > max_command_index) {
std::cout << "Restarting command sequence" << std::endl;
command_index_ = 0;
}
//
// Issue commands
//
const auto target_qframe_status = command_sequence_.at(command_index_);
SetServoMessage servo_message = create_servo_command(target_qframe_status);
// TODO: Is this method truly non-const?
servo_pub_->publish(servo_message);
}
void ThrustStandControlTestBq::shutdown() {
}
} // namespace control
} // namespace jet
BALSA_QUEUE_MAIN_FUNCTION(jet::control::ThrustStandControlTestBq)
| 25.552632 | 79 | 0.730175 | sentree |
97859008afd24608dfd20917bd641260522e2be5 | 6,191 | cc | C++ | chaps/chapsd.cc | doitmovin/chromiumos-platform2 | 6462aaf43072307b5a40eb045a89e473381b5fda | [
"BSD-3-Clause"
] | null | null | null | chaps/chapsd.cc | doitmovin/chromiumos-platform2 | 6462aaf43072307b5a40eb045a89e473381b5fda | [
"BSD-3-Clause"
] | null | null | null | chaps/chapsd.cc | doitmovin/chromiumos-platform2 | 6462aaf43072307b5a40eb045a89e473381b5fda | [
"BSD-3-Clause"
] | 2 | 2021-01-26T12:37:19.000Z | 2021-05-18T13:37:57.000Z | // Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This is the Chaps daemon. It handles calls from multiple processes via D-Bus.
//
#include <signal.h>
#include <memory>
#include <string>
#include <base/at_exit.h>
#include <base/command_line.h>
#include <base/logging.h>
#include <base/strings/string_number_conversions.h>
#include <base/synchronization/lock.h>
#include <base/synchronization/waitable_event.h>
#include <base/threading/platform_thread.h>
#include <base/threading/thread.h>
#include <brillo/syslog_logging.h>
#include <dbus-c++/dbus.h>
#include "chaps/chaps_adaptor.h"
#include "chaps/chaps_factory_impl.h"
#include "chaps/chaps_service.h"
#include "chaps/chaps_service_redirect.h"
#include "chaps/chaps_utility.h"
#include "chaps/platform_globals.h"
#include "chaps/slot_manager_impl.h"
#if USE_TPM2
#include "chaps/tpm2_utility_impl.h"
#else
#include "chaps/tpm_utility_impl.h"
#endif
using base::AutoLock;
using base::Lock;
using base::PlatformThread;
using base::PlatformThreadHandle;
using base::WaitableEvent;
using std::string;
namespace {
#if USE_TPM2
const char kTpmThreadName[] = "tpm_background_thread";
#endif
} // namespace
namespace chaps {
class AsyncInitThread : public PlatformThread::Delegate {
public:
AsyncInitThread(Lock* lock,
TPMUtility* tpm,
SlotManagerImpl* slot_manager,
ChapsServiceImpl* service)
: started_event_(true, false),
lock_(lock),
tpm_(tpm),
slot_manager_(slot_manager),
service_(service) {}
void ThreadMain() {
// It's important that we acquire 'lock' before signaling 'started_event'.
// This will prevent any D-Bus requests from being processed until we've
// finished initialization.
AutoLock lock(*lock_);
started_event_.Signal();
LOG(INFO) << "Starting asynchronous initialization.";
if (!tpm_->Init())
// Just warn and continue in this case. The effect will be a functional
// daemon which handles dbus requests but any attempt to load a token will
// fail. To a PKCS #11 client this will look like a library with a few
// empty slots.
LOG(WARNING) << "TPM initialization failed (this is expected if no TPM is"
<< " available). PKCS #11 tokens will not be available.";
if (!slot_manager_->Init())
LOG(FATAL) << "Slot initialization failed.";
if (!service_->Init())
LOG(FATAL) << "Service initialization failed.";
}
void WaitUntilStarted() {
started_event_.Wait();
}
private:
WaitableEvent started_event_;
Lock* lock_;
TPMUtility* tpm_;
SlotManagerImpl* slot_manager_;
ChapsServiceImpl* service_;
};
std::unique_ptr<DBus::BusDispatcher> g_dispatcher;
void RunDispatcher(Lock* lock,
chaps::ChapsInterface* service,
chaps::TokenManagerInterface* token_manager) {
CHECK(service) << "Failed to initialize service.";
try {
ChapsAdaptor adaptor(lock, service, token_manager);
g_dispatcher->enter();
} catch (DBus::Error err) {
LOG(FATAL) << "DBus::Error - " << err.what();
}
}
} // namespace chaps
int main(int argc, char** argv) {
base::CommandLine::Init(argc, argv);
base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
brillo::InitLog(brillo::kLogToSyslog | brillo::kLogToStderr);
chaps::ScopedOpenSSL openssl;
chaps::g_dispatcher.reset(new DBus::BusDispatcher());
CHECK(chaps::g_dispatcher.get());
DBus::default_dispatcher = chaps::g_dispatcher.get();
Lock lock;
if (!cl->HasSwitch("lib")) {
// We're using chaps (i.e. not passing through to another PKCS #11 library).
LOG(INFO) << "Starting PKCS #11 services.";
// Run as 'chaps'.
chaps::SetProcessUserAndGroup(chaps::kChapsdProcessUser,
chaps::kChapsdProcessGroup,
true);
// Determine SRK authorization data from the command line.
string srk_auth_data;
if (cl->HasSwitch("srk_password")) {
srk_auth_data = cl->GetSwitchValueASCII("srk_password");
} else if (cl->HasSwitch("srk_zeros")) {
int zero_count = 0;
if (base::StringToInt(cl->GetSwitchValueASCII("srk_zeros"),
&zero_count)) {
srk_auth_data = string(zero_count, 0);
} else {
LOG(WARNING) << "Invalid value for srk_zeros: using empty string.";
}
}
#if USE_TPM2
base::AtExitManager at_exit_manager;
base::Thread tpm_background_thread(kTpmThreadName);
CHECK(tpm_background_thread.StartWithOptions(
base::Thread::Options(base::MessageLoop::TYPE_IO,
0 /* use default stack size */)));
chaps::TPM2UtilityImpl tpm(tpm_background_thread.task_runner());
#else
// Instantiate a TPM1.2 Utility.
chaps::TPMUtilityImpl tpm(srk_auth_data);
#endif
chaps::ChapsFactoryImpl factory;
chaps::SlotManagerImpl slot_manager(
&factory, &tpm, cl->HasSwitch("auto_load_system_token"));
chaps::ChapsServiceImpl service(&slot_manager);
chaps::AsyncInitThread init_thread(&lock, &tpm, &slot_manager, &service);
PlatformThreadHandle init_thread_handle;
if (!PlatformThread::Create(0, &init_thread, &init_thread_handle))
LOG(FATAL) << "Failed to create initialization thread.";
// We don't want to start the dispatcher until the initialization thread has
// had a chance to acquire the lock.
init_thread.WaitUntilStarted();
LOG(INFO) << "Starting D-Bus dispatcher.";
RunDispatcher(&lock, &service, &slot_manager);
PlatformThread::Join(init_thread_handle);
#if USE_TPM2
tpm_background_thread.Stop();
#endif
} else {
// We're passing through to another PKCS #11 library.
string lib = cl->GetSwitchValueASCII("lib");
LOG(INFO) << "Starting PKCS #11 services with " << lib << ".";
chaps::ChapsServiceRedirect service(lib.c_str());
if (!service.Init())
LOG(FATAL) << "Failed to initialize PKCS #11 library: " << lib;
RunDispatcher(&lock, &service, NULL);
}
return 0;
}
| 34.016484 | 80 | 0.678889 | doitmovin |
9785ea135e1f2a8eeccbc91b825cc1c1f3b2a028 | 868 | cc | C++ | src/accepted/12468.cc | cbarnson/UVa | 0dd73fae656613e28b5aaf5880c5dad529316270 | [
"Unlicense",
"MIT"
] | 2 | 2019-09-07T17:00:26.000Z | 2020-08-05T02:08:35.000Z | src/accepted/12468.cc | cbarnson/UVa | 0dd73fae656613e28b5aaf5880c5dad529316270 | [
"Unlicense",
"MIT"
] | null | null | null | src/accepted/12468.cc | cbarnson/UVa | 0dd73fae656613e28b5aaf5880c5dad529316270 | [
"Unlicense",
"MIT"
] | null | null | null | // Problem # : 12468
// Created on : 2018-06-14 01:21:51
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <algorithm>
#include <bitset>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef vector<vector<int>> vec2d;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef long long ll;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int a, b;
while (cin >> a >> b)
{
if (a == -1)
{
break;
}
int x = abs(b - a);
cout << min(x, 100 - x) << endl;
}
return 0;
}
| 15.781818 | 37 | 0.634793 | cbarnson |
9787da1e44fe4e2ac444c1fcae16a13f17576eaf | 20,998 | cpp | C++ | src/libcore/src/libcore/icu/LocaleData.cpp | sparkoss/ccm | 9ed67a7cbdc9c69f4182e72be8e8b6b23d7c3c8d | [
"Apache-2.0"
] | 6 | 2018-05-08T10:08:21.000Z | 2021-11-13T13:22:58.000Z | src/libcore/src/libcore/icu/LocaleData.cpp | sparkoss/ccm | 9ed67a7cbdc9c69f4182e72be8e8b6b23d7c3c8d | [
"Apache-2.0"
] | 1 | 2018-05-08T10:20:17.000Z | 2018-07-23T05:19:19.000Z | src/libcore/src/libcore/icu/LocaleData.cpp | sparkoss/ccm | 9ed67a7cbdc9c69f4182e72be8e8b6b23d7c3c8d | [
"Apache-2.0"
] | 4 | 2018-03-13T06:21:11.000Z | 2021-06-19T02:48:07.000Z | //=========================================================================
// Copyright (C) 2018 The C++ Component Model(CCM) Open Source Project
//
// 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 "ccm/core/AutoLock.h"
#include "ccm/core/CoreUtils.h"
#include "ccm/core/CStringBuilder.h"
#include "ccm/core/StringUtils.h"
#include "ccm/text/DateFormat.h"
#include "ccm/util/CHashMap.h"
#include "ccm/util/CLocale.h"
#include "ccm.core.ICharSequence.h"
#include "ccm.text.IDateFormat.h"
#include "libcore/icu/ICU.h"
#include "libcore/icu/LocaleData.h"
#include <ccmlogger.h>
using ccm::core::AutoLock;
using ccm::core::CoreUtils;
using ccm::core::CStringBuilder;
using ccm::core::E_ASSERTION_ERROR;
using ccm::core::E_NULL_POINTER_EXCEPTION;
using ccm::core::ICharSequence;
using ccm::core::IID_IStringBuilder;
using ccm::core::IStringBuilder;
using ccm::core::StringUtils;
using ccm::text::DateFormat;
using ccm::text::IDateFormat;
using ccm::util::CHashMap;
using ccm::util::CLocale;
using ccm::util::IID_IHashMap;
namespace libcore {
namespace icu {
static AutoPtr<IHashMap> CreateHashMap()
{
AutoPtr<IHashMap> map;
CHashMap::New(IID_IHashMap, (IInterface**)&map);
return map;
}
AutoPtr<IHashMap> LocaleData::GetLocaleDataCache()
{
static AutoPtr<IHashMap> sLocaleDataCache = CreateHashMap();
return sLocaleDataCache;
}
Boolean LocaleData::StaticInitialize()
{
GetInner(CLocale::GetROOT(), nullptr);
GetInner(CLocale::GetUS(), nullptr);
GetInner(CLocale::GetDefault(), nullptr);
return true;
}
CCM_INTERFACE_IMPL_1(LocaleData, SyncObject, ILocaleData);
AutoPtr<ILocale> LocaleData::MapInvalidAndNullLocales(
/* [in] */ ILocale* locale)
{
if (locale == nullptr) {
return CLocale::GetDefault();
}
String language;
locale->ToLanguageTag(&language);
if (language.Equals("und")) {
return CLocale::GetROOT();
}
return locale;
}
ECode LocaleData::Get(
/* [in] */ ILocale* locale,
/* [out] */ ILocaleData** data)
{
VALIDATE_NOT_NULL(data);
static Boolean initialize = StaticInitialize();
return GetInner(locale, data);
}
ECode LocaleData::GetInner(
/* [in] */ ILocale* locale,
/* [out] */ ILocaleData** data)
{
if (locale == nullptr) {
Logger::E("LocaleData", "locale == null");
return E_NULL_POINTER_EXCEPTION;
}
String languageTag;
locale->ToLanguageTag(&languageTag);
AutoPtr<IHashMap> localeDataCache = GetLocaleDataCache();
{
AutoLock lock(ISynchronize::Probe(localeDataCache));
AutoPtr<ILocaleData> localeData;
localeDataCache->Get(CoreUtils::Box(languageTag), (IInterface**)&localeData);
if (localeData != nullptr && data != nullptr) {
localeData.MoveTo(data);
return NOERROR;
}
}
AutoPtr<ILocaleData> newLocaleData;
FAIL_RETURN(InitLocaleData(locale, &newLocaleData));
{
AutoLock lock(ISynchronize::Probe(localeDataCache));
AutoPtr<ICharSequence> key = CoreUtils::Box(languageTag);
AutoPtr<ILocaleData> localeData;
localeDataCache->Get(key, (IInterface**)&localeData);
if (localeData != nullptr && data != nullptr) {
localeData.MoveTo(data);
return NOERROR;
}
localeDataCache->Put(key, newLocaleData);
if (data != nullptr) {
newLocaleData.MoveTo(data);
}
return NOERROR;
}
}
ECode LocaleData::ToString(
/* [out] */ String* desc)
{
VALIDATE_NOT_NULL(desc);
AutoPtr<IStringBuilder> sb;
CStringBuilder::New(IID_IStringBuilder, (IInterface**)&sb);
sb->Append(String("LocaleData["));
sb->Append(String("mFirstDayOfWeek="));
sb->Append(Object::ToString(mFirstDayOfWeek));
sb->Append(String(",mMinimalDaysInFirstWeek="));
sb->Append(Object::ToString(mMinimalDaysInFirstWeek));
sb->Append(String(",mAmPm=("));
for (Long i = 0; i < mAmPm.GetLength(); i++) {
sb->Append(mAmPm[i]);
if (i != mAmPm.GetLength() - 1) {
sb->Append(U',');
}
}
sb->Append(U')');
sb->Append(String(",mEras=("));
for (Long i = 0; i < mEras.GetLength(); i++) {
sb->Append(mEras[i]);
if (i != mEras.GetLength() - 1) {
sb->Append(U',');
}
}
sb->Append(U')');
sb->Append(String(",mLongMonthNames=("));
for (Long i = 0; i < mLongMonthNames.GetLength(); i++) {
sb->Append(mLongMonthNames[i]);
if (i != mLongMonthNames.GetLength() - 1) {
sb->Append(U',');
}
}
sb->Append(U')');
sb->Append(String(",mShortMonthNames=("));
for (Long i = 0; i < mShortMonthNames.GetLength(); i++) {
sb->Append(mShortMonthNames[i]);
if (i != mShortMonthNames.GetLength() - 1) {
sb->Append(U',');
}
}
sb->Append(U')');
sb->Append(String(",mTinyMonthNames=("));
for (Long i = 0; i < mTinyMonthNames.GetLength(); i++) {
sb->Append(mTinyMonthNames[i]);
if (i != mTinyMonthNames.GetLength() - 1) {
sb->Append(U',');
}
}
sb->Append(U')');
sb->Append(String(",mLongStandAloneMonthNames=("));
for (Long i = 0; i < mLongStandAloneMonthNames.GetLength(); i++) {
sb->Append(mLongStandAloneMonthNames[i]);
if (i != mLongStandAloneMonthNames.GetLength() - 1) {
sb->Append(U',');
}
}
sb->Append(U')');
sb->Append(String(",mShortStandAloneMonthNames=("));
for (Long i = 0; i < mShortStandAloneMonthNames.GetLength(); i++) {
sb->Append(mShortStandAloneMonthNames[i]);
if (i != mShortStandAloneMonthNames.GetLength() - 1) {
sb->Append(U',');
}
}
sb->Append(U')');
sb->Append(String(",mTinyStandAloneMonthNames=("));
for (Long i = 0; i < mTinyStandAloneMonthNames.GetLength(); i++) {
sb->Append(mTinyStandAloneMonthNames[i]);
if (i != mTinyStandAloneMonthNames.GetLength() - 1) {
sb->Append(U',');
}
}
sb->Append(U')');
sb->Append(String(",mLongWeekdayNames=("));
for (Long i = 0; i < mLongWeekdayNames.GetLength(); i++) {
sb->Append(mLongWeekdayNames[i]);
if (i != mLongWeekdayNames.GetLength() - 1) {
sb->Append(U',');
}
}
sb->Append(U')');
sb->Append(String(",mShortWeekdayNames=("));
for (Long i = 0; i < mShortWeekdayNames.GetLength(); i++) {
sb->Append(mShortWeekdayNames[i]);
if (i != mShortWeekdayNames.GetLength() - 1) {
sb->Append(U',');
}
}
sb->Append(U')');
sb->Append(String(",mTinyWeekdayNames=("));
for (Long i = 0; i < mTinyWeekdayNames.GetLength(); i++) {
sb->Append(mTinyWeekdayNames[i]);
if (i != mTinyWeekdayNames.GetLength() - 1) {
sb->Append(U',');
}
}
sb->Append(U')');
sb->Append(String(",mLongStandAloneWeekdayNames=("));
for (Long i = 0; i < mLongStandAloneWeekdayNames.GetLength(); i++) {
sb->Append(mLongStandAloneWeekdayNames[i]);
if (i != mLongStandAloneWeekdayNames.GetLength() - 1) {
sb->Append(U',');
}
}
sb->Append(U')');
sb->Append(String(",mShortStandAloneWeekdayNames=("));
for (Long i = 0; i < mShortStandAloneWeekdayNames.GetLength(); i++) {
sb->Append(mShortStandAloneWeekdayNames[i]);
if (i != mShortStandAloneWeekdayNames.GetLength() - 1) {
sb->Append(U',');
}
}
sb->Append(U')');
sb->Append(String(",mTinyStandAloneWeekdayNames=("));
for (Long i = 0; i < mTinyStandAloneWeekdayNames.GetLength(); i++) {
sb->Append(mTinyStandAloneWeekdayNames[i]);
if (i != mTinyStandAloneWeekdayNames.GetLength() - 1) {
sb->Append(U',');
}
}
sb->Append(U')');
sb->Append(String(",mYesterday="));
sb->Append(mYesterday);
sb->Append(String(",mToday="));
sb->Append(mToday);
sb->Append(String(",mTomorrow="));
sb->Append(mTomorrow);
sb->Append(String(",mFullTimeFormat="));
sb->Append(mFullTimeFormat);
sb->Append(String(",mLongTimeFormat="));
sb->Append(mLongTimeFormat);
sb->Append(String(",mMediumTimeFormat="));
sb->Append(mMediumTimeFormat);
sb->Append(String(",mShortTimeFormat="));
sb->Append(mShortTimeFormat);
sb->Append(String(",mFullDateFormat="));
sb->Append(mFullDateFormat);
sb->Append(String(",mLongDateFormat="));
sb->Append(mLongDateFormat);
sb->Append(String(",mMediumDateFormat="));
sb->Append(mMediumDateFormat);
sb->Append(String(",mShortDateFormat="));
sb->Append(mShortDateFormat);
sb->Append(String(",mNarrowAm="));
sb->Append(mNarrowAm);
sb->Append(String(",mNarrowPm="));
sb->Append(mNarrowPm);
sb->Append(String(",mTimeFormat_hm="));
sb->Append(mTimeFormat_hm);
sb->Append(String(",mTimeFormat_Hm="));
sb->Append(mTimeFormat_Hm);
sb->Append(String(",mTimeFormat_hms="));
sb->Append(mTimeFormat_hms);
sb->Append(String(",mTimeFormat_Hms="));
sb->Append(mTimeFormat_Hms);
sb->Append(String(",mZeroDigit="));
sb->Append(mZeroDigit);
sb->Append(String(",mDecimalSeparator="));
sb->Append(mDecimalSeparator);
sb->Append(String(",mGroupingSeparator="));
sb->Append(mGroupingSeparator);
sb->Append(String(",mPatternSeparator="));
sb->Append(mPatternSeparator);
sb->Append(String(",mPercent="));
sb->Append(mPercent);
sb->Append(String(",mPerMill="));
sb->Append(mPerMill);
sb->Append(String(",mMonetarySeparator="));
sb->Append(mMonetarySeparator);
sb->Append(String(",mMinusSign="));
sb->Append(mMinusSign);
sb->Append(String(",mExponentSeparator="));
sb->Append(mExponentSeparator);
sb->Append(String(",mInfinity="));
sb->Append(mInfinity);
sb->Append(String(",mNaN="));
sb->Append(mNaN);
sb->Append(String(",mCurrencySymbol="));
sb->Append(mCurrencySymbol);
sb->Append(String(",mInternationalCurrencySymbol="));
sb->Append(mInternationalCurrencySymbol);
sb->Append(String(",mNumberPattern="));
sb->Append(mNumberPattern);
sb->Append(String(",mIntegerPattern="));
sb->Append(mIntegerPattern);
sb->Append(String(",mCurrencyPattern="));
sb->Append(mCurrencyPattern);
sb->Append(String(",mPercentPattern="));
sb->Append(mPercentPattern);
sb->Append(U']');
return sb->ToString(desc);
}
ECode LocaleData::GetDateFormat(
/* [in] */ Integer style,
/* [out] */ String* dateFormat)
{
VALIDATE_NOT_NULL(dateFormat);
switch(style) {
case IDateFormat::SHORT:
*dateFormat = mShortDateFormat;
return NOERROR;
case IDateFormat::MEDIUM:
*dateFormat = mMediumDateFormat;
return NOERROR;
case IDateFormat::LONG:
*dateFormat = mLongDateFormat;
return NOERROR;
case IDateFormat::FULL:
*dateFormat = mFullDateFormat;
return NOERROR;
}
return E_ASSERTION_ERROR;
}
ECode LocaleData::GetTimeFormat(
/* [in] */ Integer style,
/* [out] */ String* timeFormat)
{
VALIDATE_NOT_NULL(timeFormat);
switch(style) {
case IDateFormat::SHORT:
if (DateFormat::sIs24Hour == nullptr) {
*timeFormat = mShortTimeFormat;
return NOERROR;
}
else {
*timeFormat = CoreUtils::Unbox(DateFormat::sIs24Hour) ?
mTimeFormat_Hm : mTimeFormat_hm;
return NOERROR;
}
case IDateFormat::MEDIUM:
if (DateFormat::sIs24Hour == nullptr) {
*timeFormat = mMediumTimeFormat;
return NOERROR;
}
else {
*timeFormat = CoreUtils::Unbox(DateFormat::sIs24Hour) ?
mTimeFormat_Hms : mTimeFormat_hms;
return NOERROR;
}
case IDateFormat::LONG:
*timeFormat = mLongTimeFormat;
return NOERROR;
case IDateFormat::FULL:
*timeFormat = mFullTimeFormat;
return NOERROR;
}
return E_ASSERTION_ERROR;
}
ECode LocaleData::InitLocaleData(
/* [in] */ ILocale* locale,
/* [out] */ ILocaleData** localeData)
{
AutoPtr<LocaleData> localeDataObj = new LocaleData();
String languageTag;
locale->ToLanguageTag(&languageTag);
if (!ICU::InitLocaleData(languageTag, localeDataObj)) {
Logger::E("LocaleData", "couldn't initialize LocaleData for locale %s", Object::ToString(locale).string());
return E_ASSERTION_ERROR;
}
localeDataObj->mTimeFormat_hm = ICU::GetBestDateTimePattern(String("hm"), locale);
localeDataObj->mTimeFormat_Hm = ICU::GetBestDateTimePattern(String("Hm"), locale);
localeDataObj->mTimeFormat_hms = ICU::GetBestDateTimePattern(String("hms"), locale);
localeDataObj->mTimeFormat_Hms = ICU::GetBestDateTimePattern(String("Hms"), locale);
if (!localeDataObj->mFullTimeFormat.IsNull()) {
// There are some full time format patterns in ICU that use the pattern character 'v'.
// ccm doesn't accept this, so we replace it with 'z' which has about the same result
// as 'v', the timezone name.
// 'v' -> "PT", 'z' -> "PST", v is the generic timezone and z the standard tz
// "vvvv" -> "Pacific Time", "zzzz" -> "Pacific Standard Time"
localeDataObj->mFullTimeFormat = localeDataObj->mFullTimeFormat.Replace(U'v', U'z');
}
if (!localeDataObj->mNumberPattern.IsNull()) {
// The number pattern might contain positive and negative subpatterns. Arabic, for
// example, might look like "#,##0.###;#,##0.###-" because the minus sign should be
// written last. Macedonian supposedly looks something like "#,##0.###;(#,##0.###)".
// (The negative subpattern is optional, though, and not present in most locales.)
// By only swallowing '#'es and ','s after the '.', we ensure that we don't
// accidentally eat too much.
StringUtils::ReplaceAll(localeDataObj->mNumberPattern, String("\\.[#,]*"),
String(""), &localeDataObj->mIntegerPattern);
}
*localeData = (ILocaleData*)localeDataObj.Get();
REFCOUNT_ADD(*localeData);
return NOERROR;
}
ECode LocaleData::GetAmPm(
/* [out, callee] */ Array<String>* ampm)
{
VALIDATE_NOT_NULL(ampm);
*ampm = mAmPm;
return NOERROR;
}
ECode LocaleData::GetCurrencyPattern(
/* [out] */ String* pattern)
{
VALIDATE_NOT_NULL(pattern);
*pattern = mCurrencyPattern;
return NOERROR;
}
ECode LocaleData::GetCurrencySymbol(
/* [out] */ String* currencySymbol)
{
VALIDATE_NOT_NULL(currencySymbol);
*currencySymbol = mCurrencySymbol;
return NOERROR;
}
ECode LocaleData::GetDecimalSeparator(
/* [out] */ Char* decSeparator)
{
VALIDATE_NOT_NULL(decSeparator);
*decSeparator = mDecimalSeparator;
return NOERROR;
}
ECode LocaleData::GetEras(
/* [out, callee] */ Array<String>* eras)
{
VALIDATE_NOT_NULL(eras);
*eras = mEras;
return NOERROR;
}
ECode LocaleData::GetExponentSeparator(
/* [out] */ String* expSeparator)
{
VALIDATE_NOT_NULL(expSeparator);
*expSeparator = mExponentSeparator;
return NOERROR;
}
ECode LocaleData::GetGroupingSeparator(
/* [out] */ Char* grpSeparator)
{
VALIDATE_NOT_NULL(grpSeparator);
*grpSeparator = mGroupingSeparator;
return NOERROR;
}
ECode LocaleData::GetFirstDayOfWeek(
/* [out] */ IInteger** day)
{
VALIDATE_NOT_NULL(day);
*day = mFirstDayOfWeek;
REFCOUNT_ADD(*day);
return NOERROR;
}
ECode LocaleData::GetInfinity(
/* [out] */ String* infinity)
{
VALIDATE_NOT_NULL(infinity);
*infinity = mInfinity;
return NOERROR;
}
ECode LocaleData::GetIntegerPattern(
/* [out] */ String* pattern)
{
VALIDATE_NOT_NULL(pattern);
*pattern = mIntegerPattern;
return NOERROR;
}
ECode LocaleData::GetInternationalCurrencySymbol(
/* [out] */ String* intlCurrencySymbol)
{
VALIDATE_NOT_NULL(intlCurrencySymbol);
*intlCurrencySymbol = mInternationalCurrencySymbol;
return NOERROR;
}
ECode LocaleData::GetLongMonthNames(
/* [out, callee] */ Array<String>* longMonthNames)
{
VALIDATE_NOT_NULL(longMonthNames);
*longMonthNames = mLongMonthNames;
return NOERROR;
}
ECode LocaleData::GetLongStandAloneMonthNames(
/* [out, callee] */ Array<String>* longStandAloneMonthNames)
{
VALIDATE_NOT_NULL(longStandAloneMonthNames);
*longStandAloneMonthNames = mLongStandAloneMonthNames;
return NOERROR;
}
ECode LocaleData::GetLongStandAloneWeekdayNames(
/* [out, callee] */ Array<String>* longStandAloneWeekdayNames)
{
VALIDATE_NOT_NULL(longStandAloneWeekdayNames);
*longStandAloneWeekdayNames = mLongStandAloneWeekdayNames;
return NOERROR;
}
ECode LocaleData::GetLongWeekdayNames(
/* [out, callee] */ Array<String>* longWeekdayNames)
{
VALIDATE_NOT_NULL(longWeekdayNames);
*longWeekdayNames = mLongWeekdayNames;
return NOERROR;
}
ECode LocaleData::GetMinimalDaysInFirstWeek(
/* [out] */ IInteger** days)
{
VALIDATE_NOT_NULL(days);
*days = mMinimalDaysInFirstWeek;
REFCOUNT_ADD(*days);
return NOERROR;
}
ECode LocaleData::GetMinusSign(
/* [out] */ String* sign)
{
VALIDATE_NOT_NULL(sign);
*sign = mMinusSign;
return NOERROR;
}
ECode LocaleData::GetNaN(
/* [out] */ String* nan)
{
VALIDATE_NOT_NULL(nan);
*nan = mNaN;
return NOERROR;
}
ECode LocaleData::GetNumberPattern(
/* [out] */ String* pattern)
{
VALIDATE_NOT_NULL(pattern);
*pattern = mNumberPattern;
return NOERROR;
}
ECode LocaleData::GetPatternSeparator(
/* [out] */ Char* patSeparator)
{
VALIDATE_NOT_NULL(patSeparator);
*patSeparator = mPatternSeparator;
return NOERROR;
}
ECode LocaleData::GetPercent(
/* [out] */ String* percent)
{
VALIDATE_NOT_NULL(percent);
*percent = mPercent;
return NOERROR;
}
ECode LocaleData::GetPercentPattern(
/* [out] */ String* pattern)
{
VALIDATE_NOT_NULL(pattern);
*pattern = mPercentPattern;
return NOERROR;
}
ECode LocaleData::GetPerMill(
/* [out] */ Char* perMill)
{
VALIDATE_NOT_NULL(perMill);
*perMill = mPerMill;
return NOERROR;
}
ECode LocaleData::GetShortMonthNames(
/* [out, callee] */ Array<String>* shortMonthNames)
{
VALIDATE_NOT_NULL(shortMonthNames);
*shortMonthNames = mShortMonthNames;
return NOERROR;
}
ECode LocaleData::GetShortStandAloneMonthNames(
/* [out, callee] */ Array<String>* shortStandAloneMonthNames)
{
VALIDATE_NOT_NULL(shortStandAloneMonthNames);
*shortStandAloneMonthNames = mShortStandAloneMonthNames;
return NOERROR;
}
ECode LocaleData::GetShortStandAloneWeekdayNames(
/* [out, callee] */ Array<String>* shortStandAloneWeekdayNames)
{
VALIDATE_NOT_NULL(shortStandAloneWeekdayNames);
*shortStandAloneWeekdayNames = mShortStandAloneWeekdayNames;
return NOERROR;
}
ECode LocaleData::GetShortWeekdayNames(
/* [out, callee] */ Array<String>* shortWeekdayNames)
{
VALIDATE_NOT_NULL(shortWeekdayNames);
*shortWeekdayNames = mShortWeekdayNames;
return NOERROR;
}
ECode LocaleData::GetTinyMonthNames(
/* [out, callee] */ Array<String>* tinyMonthNames)
{
VALIDATE_NOT_NULL(tinyMonthNames);
*tinyMonthNames = mTinyMonthNames;
return NOERROR;
}
ECode LocaleData::GetTinyStandAloneMonthNames(
/* [out, callee] */ Array<String>* tinyStandAloneMonthNames)
{
VALIDATE_NOT_NULL(tinyStandAloneMonthNames);
*tinyStandAloneMonthNames = mTinyStandAloneMonthNames;
return NOERROR;
}
ECode LocaleData::GetTinyStandAloneWeekdayNames(
/* [out, callee] */ Array<String>* tinyStandAloneWeekdayNames)
{
VALIDATE_NOT_NULL(tinyStandAloneWeekdayNames);
*tinyStandAloneWeekdayNames = mTinyStandAloneWeekdayNames;
return NOERROR;
}
ECode LocaleData::GetTinyWeekdayNames(
/* [out, callee] */ Array<String>* tinyWeekdayNames)
{
VALIDATE_NOT_NULL(tinyWeekdayNames);
*tinyWeekdayNames = mTinyWeekdayNames;
return NOERROR;
}
ECode LocaleData::GetZeroDigit(
/* [out] */ Char* zeroDigit)
{
VALIDATE_NOT_NULL(zeroDigit);
*zeroDigit = mZeroDigit;
return NOERROR;
}
}
} | 27.88579 | 115 | 0.635632 | sparkoss |
978ad894f348097280073ead77b046ee1ec80368 | 2,704 | cpp | C++ | try_basic.cpp | Fisher-Wang/GraphPackaging | 6dd42f65a7d41cc1c5b679e4b41b0a3385e2c7fd | [
"MIT"
] | 1 | 2022-03-21T05:28:49.000Z | 2022-03-21T05:28:49.000Z | try_basic.cpp | Fisher-Wang/GraphPackaging | 6dd42f65a7d41cc1c5b679e4b41b0a3385e2c7fd | [
"MIT"
] | null | null | null | try_basic.cpp | Fisher-Wang/GraphPackaging | 6dd42f65a7d41cc1c5b679e4b41b0a3385e2c7fd | [
"MIT"
] | null | null | null | #include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include "graph.h"
using namespace std;
const double loss_prob = 0.2;
vector<int> edges[NODE_NUM_MAX];
int weight[NODE_NUM_MAX];
int TW;
int n; // tot node number
int in_deg[NODE_NUM_MAX];
double value[NODE_NUM_MAX];
int np; // tot package number
vector<int> seq;
vector<vector<int>> rst;
void evaluate_nodes()
{
for (int x = 1; x <= n; ++x) {
value[x] = 1. / weight[x];
}
}
void make_package()
{
static int cnt[NODE_NUM_MAX];
memset(cnt, 0, sizeof(cnt));
int tw = 0; // current total weight
struct Node {
int index;
double value;
bool operator< (const Node& n) const {
return value < n.value;
}
};
priority_queue<Node> pq; // 大顶堆
pq.push({0,0});
/* Stage 1: decide which node to be packaged */
while (!pq.empty()) {
int cur = pq.top().index;
// printf("pq: cur = %d, weight = %d, v = %.2f\n", cur, weight[cur], pq.top().value * 1000);
pq.pop();
if ((tw + weight[cur]) * 2 > TW * 3)
break;
if (cur != 0) {
tw += weight[cur];
seq.push_back(cur);
}
/* add new nodes to pq */
for (int nxt : edges[cur]) {
double v = value[nxt];
// double v = value[nxt] * pow(loss_prob, cnt[nxt]);
// printf("nxt = %d, weight = %d, v = %.2f, in_deg = %d\n", nxt, weight[nxt], v * 1000, in_deg[nxt]);
pq.push({nxt, v});
++cnt[nxt];
}
}
/* Stage 2: grouping */
int last_i = 0;
int acc_weight = 0;
for (int i = 0; i < (int)seq.size(); ++i)
{
int x = seq[i];
if (weight[x] > PKG_SIZE) {
fprintf(stderr, "[Warning] node %d has too large weight %d\n", x, weight[x]);
continue;
}
if (acc_weight + weight[x] > PKG_SIZE) {
rst.push_back(vector<int>(seq.begin() + last_i, seq.begin() + i));
last_i = i;
acc_weight = weight[x];
}
else
acc_weight += weight[x];
}
rst.push_back(vector<int>(seq.begin() + last_i, seq.end()));
debug_printf("tw = %d\n", tw);
}
int main()
{
if (LOG) {
freopen("log.txt", "w", stdout);
}
char weight_path[] = "data/Out_SliceSize_Basketball_480_Slice16_Gop8_10.log";
char edge_path[] = "data/Out_OutGraph_Basketball_480_Slice16_Gop8_10.log";
char answer_path[] = "result.txt";
read_graph(edge_path, weight_path); debug_printf("TW = %d\n", TW);
evaluate_nodes();
make_package();
output(answer_path);
return 0;
} | 26.509804 | 113 | 0.534763 | Fisher-Wang |
978b0745cdbb9a7290a6b84e53810831e21dadd7 | 822 | hpp | C++ | include/gridtools/storage/common/state_machine.hpp | jdahm/gridtools | 5961932cd2ccf336d3d73b4bc967243828e55cc5 | [
"BSD-3-Clause"
] | null | null | null | include/gridtools/storage/common/state_machine.hpp | jdahm/gridtools | 5961932cd2ccf336d3d73b4bc967243828e55cc5 | [
"BSD-3-Clause"
] | null | null | null | include/gridtools/storage/common/state_machine.hpp | jdahm/gridtools | 5961932cd2ccf336d3d73b4bc967243828e55cc5 | [
"BSD-3-Clause"
] | 1 | 2019-06-14T10:35:50.000Z | 2019-06-14T10:35:50.000Z | /*
* GridTools
*
* Copyright (c) 2014-2019, ETH Zurich
* All rights reserved.
*
* Please, refer to the LICENSE file in the root directory.
* SPDX-License-Identifier: BSD-3-Clause
*/
#pragma once
namespace gridtools {
/** \ingroup storage
* @{
*/
/**
* @brief A class that represents the state machine that is used to determine
* if a storage is currently on the host or on the device and if the
* data on the host or the device is outdated and needs to be updated.
*/
struct state_machine {
bool m_hnu; // hnu = host needs update, set to true if a non-read-only device view is instantiated.
bool m_dnu; // dnu = device needs update, set to true if a non-read-only host view is instantiated.
};
/**
* @}
*/
} // namespace gridtools
| 25.6875 | 107 | 0.63382 | jdahm |
978e020e66f0cc4e3c67b9b86e74a1afac53c2e5 | 8,739 | cc | C++ | src/shared/network/TcpServerBase.cc | codeplayer2org/GameServer | e6fa07e7d2917f1926095fa556f96e088eebb876 | [
"MIT"
] | 1 | 2016-02-25T12:48:59.000Z | 2016-02-25T12:48:59.000Z | src/shared/network/TcpServerBase.cc | codeplayer2org/GameServer | e6fa07e7d2917f1926095fa556f96e088eebb876 | [
"MIT"
] | null | null | null | src/shared/network/TcpServerBase.cc | codeplayer2org/GameServer | e6fa07e7d2917f1926095fa556f96e088eebb876 | [
"MIT"
] | 2 | 2016-02-25T12:49:14.000Z | 2017-07-06T14:00:54.000Z | /*
* =====================================================================================
*
* Filename: TcpServerBase.cc
*
* Description: TcpServerBase
*
* Version: 1.0
* Created: 2015年04月08日 21时00分30秒
* Revision: none
* Compiler: gcc
*
* Author: Petrus (), silencly07@gmail.com
* Organization: http://www.codeplayer.org
*
* =====================================================================================
*/
#include <cstring>
#include "TcpServerBase.h"
#include "TcpWorkerThread.h"
#include "thread/ThreadPool.h"
TcpServerBase::TcpServerBase() {
memset(tcp_connections_, 0, sizeof(TcpConnection*) * SOCKET_HOLDER_SIZE);
bool ret = sLibEvent.NewEventBase(&event_base_, "select");
if (ret) {
LOG_KTRACE("TcpServerBase", "new event_base_ successful");
} else {
LOG_KERROR("TcpServerBase", "new event_base_ failed");
}
}
TcpServerBase::~TcpServerBase() {
if (event_base_) {
delete event_base_;
event_base_ = nullptr;
}
auto it = listenfd_event_map_.cbegin();
for ( ; it != listenfd_event_map_.cend(); ++it) {
RemoveListenSocket(it->first);
}
for (int i = 0; i < SOCKET_HOLDER_SIZE; ++i) {
RemoveTcpConnection(i);
}
}
void TcpServerBase::StartLoop() {
event_base_->Loop();
}
bool TcpServerBase::AddListenSocket(Socket* socket) {
auto it = listenfd_event_map_.find(socket->GetFd());
if (it == listenfd_event_map_.end()) {
Event* listen_event;
event_base_->NewEvent(socket->GetFd(), kEventRead | kEventPersist, TcpServerBase::AcceptCallback, this, &listen_event);
listenfd_event_map_[socket->GetFd()] = listen_event;
listenfd_socket_map_[socket->GetFd()] = socket;
return true;
}
return false;
}
void TcpServerBase::RemoveListenSocket(SOCKET fd) {
auto it = listenfd_event_map_.find(fd);
if (it != listenfd_event_map_.end()) {
delete it->second;
listenfd_event_map_.erase(it);
delete listenfd_event_map_[fd];
listenfd_socket_map_.erase(fd);
}
}
bool TcpServerBase::NewTcpConnection(Socket* socket) {
BufferEvent* buffer_event = nullptr;
SOCKET fd = socket->GetFd();
if (event_base_->NewBufferEvent(fd, kThreadSafe, &buffer_event)) {
TcpConnection* tcp_connection = new TcpConnection(socket, buffer_event);
buffer_event->Enable(kEventRead | kEventWrite | kEventPersist);
buffer_event->SetCallback(TcpServerBase::ServerReadCallback, NULL, TcpServerBase::EventCallback, this);
int result = AddTcpConnection(fd, tcp_connection);
if (result) {
return true;
} else {
delete tcp_connection;
}
}
if (buffer_event) {
delete buffer_event;
}
return false;
}
bool TcpServerBase::AddTcpConnection(EventSocket socket, TcpConnection* tcp_connection) {
if (tcp_connections_[socket] == 0) {
tcp_connections_[socket] = tcp_connection;
bufevent_conn_map_[tcp_connection->buffer_event_->buffer_event_] = tcp_connection;
LOG_TRACE("Add TcpConnection with socket(%d)", socket);
return true;
}
ASSERT(0 != tcp_connections_[socket]);
return false;
}
void TcpServerBase::RemoveTcpConnection(EventSocket socket) {
if (tcp_connections_[socket] != 0) {
auto it = bufevent_conn_map_.find(tcp_connections_[socket]->buffer_event_->buffer_event_);
if (it != bufevent_conn_map_.end()) {
bufevent_conn_map_.erase(tcp_connections_[socket]->buffer_event_->buffer_event_);
}
delete tcp_connections_[socket];
tcp_connections_[socket] = 0;
// event_base_->DeleteBufferEvent(socket);
}
}
TcpConnection* TcpServerBase::GetTcpConnection(BufferEventStruct* buffer_event_struct) {
auto it = bufevent_conn_map_.find(buffer_event_struct);
if (it != bufevent_conn_map_.end()) {
return bufevent_conn_map_[buffer_event_struct];
}
return nullptr;
}
void TcpServerBase::AcceptCallback(EventSocket fd, EventFlagType what, void* arg) {
TcpServerBase* tcp_server = static_cast<TcpServerBase*>(arg);
BufferEvent* buffer_event = nullptr;
SOCKET client_fd = ::accept(fd, NULL, NULL);
Socket* client_socket = new Socket(client_fd);
if (tcp_server->event_base_->NewBufferEvent(client_fd, kThreadSafe, &buffer_event)) {
TcpConnection* tcp_connection = new TcpConnection(client_socket, buffer_event);
buffer_event->Enable(kEventRead | kEventWrite | kEventPersist);
buffer_event->SetCallback(TcpServerBase::ClientReadCallback, NULL, TcpServerBase::EventCallback, tcp_server);
int result = tcp_server->AddTcpConnection(client_fd, tcp_connection);
if (!result) {
LOG_ERROR("Socket(%d) AddTcpConnection failed!", client_fd);
}
} else {
LOG_ERROR("Socket(%d) accept failed!", fd);
}
}
Packet_t* TcpServerBase::ReadCallback(BufferEventStruct* buffer_event_struct, void* arg) {
ASSERT(buffer_event_struct);
ASSERT(arg);
TcpServerBase* tcp_server = static_cast<TcpServerBase*>(arg);
TcpConnection* tcp_connection = tcp_server->GetTcpConnection(buffer_event_struct);
ASSERT(tcp_connection);
if (tcp_connection) {
char* data_buff = new char[DATA_BUFF_SIZE];
size_t data_len = tcp_connection->ReadData(data_buff, DATA_BUFF_SIZE);
ASSERT(data_len < DATA_BUFF_SIZE);
if (data_len < DATA_BUFF_SIZE) {
Packet_t* packet = new Packet_t(tcp_connection->GetSocket(), data_len, data_buff);
return packet;
} else {
LOG_ERROR("Socket(%d) receive data length greater than buffer size(%d)", tcp_connection->GetSocket(), DATA_BUFF_SIZE);
return nullptr;
}
} else {
LOG_ERROR("Can't find TcpConnection in ReadCallback function.");
return nullptr;
}
}
void TcpServerBase::ClientReadCallback(BufferEventStruct* buffer_event_struct, void* arg) {
Packet_t* packet = ReadCallback(buffer_event_struct, arg);
TcpServerBase* tcp_server = static_cast<TcpServerBase*>(arg);
tcp_server->PushClientPacket(packet);
}
void TcpServerBase::ServerReadCallback(BufferEventStruct* buffer_event_struct, void* arg) {
Packet_t* packet = ReadCallback(buffer_event_struct, arg);
TcpServerBase* tcp_server = static_cast<TcpServerBase*>(arg);
tcp_server->PushServerPacket(packet);
}
void TcpServerBase::EventCallback(BufferEventStruct* buffer_event_struct, BufferEventFlagType what, void* arg) {
ASSERT(buffer_event_struct);
ASSERT(arg);
TcpServerBase* tcp_server = static_cast<TcpServerBase*>(arg);
TcpConnection* tcp_connection = tcp_server->GetTcpConnection(buffer_event_struct);
ASSERT(tcp_connection);
if (what & kError) {
LOG_ERROR("Socket(%d) encounter an error.", tcp_connection->GetSocket());
tcp_server->RemoveTcpConnection(tcp_connection->GetSocket());
} else if (what & kEof) {
LOG_TRACE("Socket(%d) encounter Eof.", tcp_connection->GetSocket());
tcp_server->RemoveTcpConnection(tcp_connection->GetSocket());
} else if (what & kConnected) {
LOG_TRACE("Socket(%d) connected.", tcp_connection->GetSocket());
} else if (what & kReading) {
LOG_TRACE("Socket(%d) reading.", tcp_connection->GetSocket());
} else if (what & kWriting) {
LOG_TRACE("Socket(%d) writing.", tcp_connection->GetSocket());
} else if (what & kTimeout) {
LOG_TRACE("Socket(%d) timeout.", tcp_connection->GetSocket());
} else {
LOG_ERROR("Socket(%d) encounter unkonw event.", tcp_connection->GetSocket());
}
}
void TcpServerBase::SendData(SOCKET fd, const void* data, size_t data_len) {
//XXX: 逻辑线程处理完毕后,由此函数统一发送给客户端
if (tcp_connections_[fd]) {
tcp_connections_[fd]->WriteData(data, data_len);
LOG_TRACE("Send data to socket(%d), length(%d)", fd, data_len);
LOG_INFO("Send data: %s", data);
} else {
LOG_ERROR("TcpConnection(%d) not exist, send data failed.", fd);
}
}
void TcpServerBase::PushClientPacket(Packet_t* packet) {
client_recv_queue_.push(packet);
}
Packet_t* TcpServerBase::PopClientPacket() {
if (client_recv_queue_.get_size() > 0) {
Packet_t* packet = client_recv_queue_.pop();
return packet;
} else {
return nullptr;
}
}
void TcpServerBase::PushServerPacket(Packet_t* packet) {
server_recv_queue_.push(packet);
}
Packet_t* TcpServerBase::PopServerPacket() {
if (server_recv_queue_.get_size() > 0) {
Packet_t* packet = server_recv_queue_.pop();
return packet;
} else {
return nullptr;
}
}
| 34.405512 | 130 | 0.662433 | codeplayer2org |
979167cef397012f7958c445b77caeeff49d4dcf | 3,241 | cpp | C++ | src/app/qgsdiscoverrelationsdlg.cpp | dyna-mis/Hilabeling | cb7d5d4be29624a20c8a367162dbc6fd779b2b52 | [
"MIT"
] | null | null | null | src/app/qgsdiscoverrelationsdlg.cpp | dyna-mis/Hilabeling | cb7d5d4be29624a20c8a367162dbc6fd779b2b52 | [
"MIT"
] | null | null | null | src/app/qgsdiscoverrelationsdlg.cpp | dyna-mis/Hilabeling | cb7d5d4be29624a20c8a367162dbc6fd779b2b52 | [
"MIT"
] | 1 | 2021-12-25T08:40:30.000Z | 2021-12-25T08:40:30.000Z | /***************************************************************************
qgsdiscoverrelationsdlg.cpp
---------------------
begin : September 2016
copyright : (C) 2016 by Patrick Valsecchi
email : patrick dot valsecchi at camptocamp dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgsdiscoverrelationsdlg.h"
#include "qgsvectorlayer.h"
#include "qgsrelationmanager.h"
#include <QPushButton>
QgsDiscoverRelationsDlg::QgsDiscoverRelationsDlg( const QList<QgsRelation> &existingRelations, const QList<QgsVectorLayer *> &layers, QWidget *parent )
: QDialog( parent )
, mLayers( layers )
{
setupUi( this );
mButtonBox->button( QDialogButtonBox::Ok )->setEnabled( false );
connect( mRelationsTable->selectionModel(), &QItemSelectionModel::selectionChanged, this, &QgsDiscoverRelationsDlg::onSelectionChanged );
mFoundRelations = QgsRelationManager::discoverRelations( existingRelations, layers );
for ( const QgsRelation &relation : qgis::as_const( mFoundRelations ) )
addRelation( relation );
mRelationsTable->resizeColumnsToContents();
}
void QgsDiscoverRelationsDlg::addRelation( const QgsRelation &rel )
{
const int row = mRelationsTable->rowCount();
mRelationsTable->insertRow( row );
mRelationsTable->setItem( row, 0, new QTableWidgetItem( rel.name() ) );
mRelationsTable->setItem( row, 1, new QTableWidgetItem( rel.referencingLayer()->name() ) );
mRelationsTable->setItem( row, 2, new QTableWidgetItem( rel.fieldPairs().at( 0 ).referencingField() ) );
mRelationsTable->setItem( row, 3, new QTableWidgetItem( rel.referencedLayer()->name() ) );
mRelationsTable->setItem( row, 4, new QTableWidgetItem( rel.fieldPairs().at( 0 ).referencedField() ) );
if ( rel.strength() == QgsRelation::RelationStrength::Composition )
{
mRelationsTable->setItem( row, 5, new QTableWidgetItem( QStringLiteral( "Composition" ) ) );
}
else
{
mRelationsTable->setItem( row, 5, new QTableWidgetItem( QStringLiteral( "Association" ) ) );
}
mRelationsTable->item( row, 5 )->setToolTip( QStringLiteral( "Composition (child features will be copied too) or Association" ) );
}
QList<QgsRelation> QgsDiscoverRelationsDlg::relations() const
{
QList<QgsRelation> result;
const auto constSelectedRows = mRelationsTable->selectionModel()->selectedRows();
for ( const QModelIndex &row : constSelectedRows )
{
result.append( mFoundRelations.at( row.row() ) );
}
return result;
}
void QgsDiscoverRelationsDlg::onSelectionChanged()
{
mButtonBox->button( QDialogButtonBox::Ok )->setEnabled( mRelationsTable->selectionModel()->hasSelection() );
}
| 44.39726 | 151 | 0.62635 | dyna-mis |
9792904fa9b0d2d6dd78e2e6415ed2f7c3b9b867 | 3,942 | cpp | C++ | Shoot/src/CacheFile.cpp | franticsoftware/vlad-heavy-strike | a4da4df617e9ccd6ebd9819ad166d892924638ce | [
"MIT"
] | 3 | 2019-10-04T19:44:44.000Z | 2021-07-27T15:59:39.000Z | Shoot/src/CacheFile.cpp | franticsoftware/vlad-heavy-strike | a4da4df617e9ccd6ebd9819ad166d892924638ce | [
"MIT"
] | 1 | 2019-07-20T05:36:31.000Z | 2019-07-20T22:22:49.000Z | Shoot/src/CacheFile.cpp | aminere/vlad-heavy-strike | a4da4df617e9ccd6ebd9819ad166d892924638ce | [
"MIT"
] | null | null | null | /*
Amine Rehioui
Created: May 31st 2013
*/
#include "Shoot.h"
#include "CacheFile.h"
namespace shoot
{
//! statics
std::map<std::string, CacheFile::Info> CacheFile::m_sCache;
//! clears the cache
void CacheFile::Clear()
{
for(std::map<std::string, CacheFile::Info>::iterator it = m_sCache.begin();
it != m_sCache.end();
++ it)
{
sdelete_array((it->second).m_pData);
}
m_sCache.clear();
}
//! clears a file from the cache
void CacheFile::Clear(const std::string& strPath)
{
std::map<std::string, CacheFile::Info>::iterator it = m_sCache.find(strPath);
if(it != m_sCache.end())
{
sdelete_array((it->second).m_pData);
m_sCache.erase(it);
}
}
//! returns an instance
CacheFile* CacheFile::GetFile(const std::string& strPath)
{
std::map<std::string, CacheFile::Info>::iterator it = m_sCache.find(strPath);
if(it != m_sCache.end())
{
return snew CacheFile(strPath.c_str(), it->second);
}
Info info;
File* pNativeFile = File::CreateNative(strPath.c_str(), File::M_ReadBinary);
pNativeFile->Open();
pNativeFile->SetOffset(0, File::OT_End);
info.m_Size = pNativeFile->GetOffset();
info.m_pData = snew u8[info.m_Size];
pNativeFile->SetOffset(0, File::OT_Start);
pNativeFile->Read(info.m_pData, info.m_Size);
pNativeFile->Close();
delete pNativeFile;
CacheFile* pFile = snew CacheFile(strPath.c_str(), info);
m_sCache[strPath] = info;
return pFile;
}
//! constructor
CacheFile::CacheFile(const char* strPath, const Info& info)
: File(strPath, M_ReadBinary)
, m_Info(info)
{
}
//! opens the file
bool CacheFile::Open(bool bAssertOnFailure /*= true*/)
{
m_Info.m_CurrentOffset = 0;
return true;
}
//! reads data from the file
s32 CacheFile::Read(void* pDest, u32 bytesToRead)
{
SHOOT_ASSERT(m_Info.m_CurrentOffset+bytesToRead <= m_Info.m_Size, "EOF reached");
u8* pData = m_Info.m_pData + m_Info.m_CurrentOffset;
memcpy(pDest, pData, bytesToRead);
m_Info.m_CurrentOffset += bytesToRead;
return bytesToRead;
}
//! reads a string
s32 CacheFile::Read(std::string& dest, char delim1 /*= 0*/, char delim2 /*= 0*/)
{
char c;
while(Read(&c, 1))
{
if(c != '\r'
&& c != '\n'
&& c != ' '
&& c != '\t'
&& ((delim1 == 0) || (c != delim1))
&& ((delim2 == 0) || (c != delim2)))
{
dest += c;
}
else
{
SetOffset(-1);
break;
}
}
return (s32)dest.length();
}
//! reads a line until a delimiter
s32 CacheFile::ReadLine(char* pDest, u32 numChars, char delim /*= '\n'*/)
{
u32 i;
for(i=0; i<numChars; ++i)
{
char c;
if(Read(&c, 1))
{
if(c != delim)
{
pDest[i] = c;
}
else
{
break;
}
}
else
{
break;
}
}
pDest[i] = '\0';
return i;
}
//! peeks a character without advancing the file pointer
char CacheFile::Peek()
{
char c;
Read(&c, 1);
SetOffset(-1);
return c;
}
//! ignores n characters or x characters until the delimiter is found
void CacheFile::Ignore(u32 numChars, char delimiter /*= ' '*/)
{
for(u32 i=0; i<numChars; ++i)
{
char c;
Read(&c, 1);
if(c == delimiter)
{
break;
}
}
}
//! changes the current read/write location in the file
void CacheFile::SetOffset(s32 offset, E_OffsetType eType /*= OT_Current*/)
{
switch(eType)
{
case OT_Current:
m_Info.m_CurrentOffset += offset;
break;
case OT_Start:
m_Info.m_CurrentOffset = offset;
break;
case OT_End:
m_Info.m_CurrentOffset = offset+m_Info.m_Size;
break;
}
SHOOT_ASSERT(m_Info.m_CurrentOffset >= 0 && m_Info.m_CurrentOffset <= s32(m_Info.m_Size), "Invalid file offset");
}
//! returns the current read/write location in the file
u32 CacheFile::GetOffset()
{
return u32(m_Info.m_CurrentOffset);
}
//! returns true if end of file has been reached
bool CacheFile::EOFReached()
{
return (m_Info.m_CurrentOffset >= s32(m_Info.m_Size));
}
}
| 19.809045 | 115 | 0.625824 | franticsoftware |
97930b3d0c3748085ae805bf5c5aa90a79a32826 | 1,103 | cpp | C++ | src/engineprocess.cpp | shogimaru/shogimaru | 90e9ea4048f5c5bef05147694be20a1c5a03cc79 | [
"MIT"
] | 8 | 2022-01-16T02:56:56.000Z | 2022-03-31T02:09:53.000Z | src/engineprocess.cpp | shogimaru/shogimaru | 90e9ea4048f5c5bef05147694be20a1c5a03cc79 | [
"MIT"
] | null | null | null | src/engineprocess.cpp | shogimaru/shogimaru | 90e9ea4048f5c5bef05147694be20a1c5a03cc79 | [
"MIT"
] | null | null | null | #include "engineprocess.h"
#include <QDebug>
#include <QDir>
#include <QFileInfo>
EngineProcess::EngineProcess(const QString &program, QObject *parent) :
QProcess(parent)
{
setProgram(program);
setWorkingDirectory(QFileInfo(program).dir().absolutePath());
}
void EngineProcess::start()
{
// auto data = EngineSettings::instance().currentEngine();
// if (data.path.isEmpty()) {
// qCritical() << "No shogi engine";
// return;
// }
// if (QFileInfo(data.path).exists()) {
// setProgram(data.path);
// } else {
// qCritical() << "Not found such shogi engine:" << data.path;
// return;
// }
if (state() == QProcess::NotRunning) {
QProcess::start(QIODevice::ReadWrite);
waitForStarted();
}
}
void EngineProcess::terminate()
{
QProcess::terminate();
bool res = waitForFinished(500);
if (!res) {
QProcess::kill();
waitForFinished(500);
}
}
// EngineProcess *EngineProcess::instance()
// {
// static EngineProcess engineProcess;
// return &engineProcess;
// }
| 20.425926 | 71 | 0.599275 | shogimaru |
9794dd433874f8d290e4c2a90d8d222ae4ab394c | 200,676 | inl | C++ | 2d_samples/pmj02_23.inl | st-ario/rayme | 315c57c23f4aa4934a8a80e84e3243acd3400808 | [
"MIT"
] | 1 | 2021-12-10T23:35:04.000Z | 2021-12-10T23:35:04.000Z | 2d_samples/pmj02_23.inl | st-ario/rayme | 315c57c23f4aa4934a8a80e84e3243acd3400808 | [
"MIT"
] | null | null | null | 2d_samples/pmj02_23.inl | st-ario/rayme | 315c57c23f4aa4934a8a80e84e3243acd3400808 | [
"MIT"
] | null | null | null | {std::array<float,2>{0.294868559f, 0.486702561f},
std::array<float,2>{0.655109107f, 0.635469735f},
std::array<float,2>{0.930609345f, 0.155407801f},
std::array<float,2>{0.0130536128f, 0.92444694f},
std::array<float,2>{0.229893953f, 0.0536426306f},
std::array<float,2>{0.753561437f, 0.823331594f},
std::array<float,2>{0.516667724f, 0.312864184f},
std::array<float,2>{0.452855378f, 0.579092741f},
std::array<float,2>{0.124997795f, 0.286937594f},
std::array<float,2>{0.966821611f, 0.509004593f},
std::array<float,2>{0.715175748f, 0.0985933021f},
std::array<float,2>{0.372173309f, 0.781413436f},
std::array<float,2>{0.412547648f, 0.216765195f},
std::array<float,2>{0.576672375f, 0.977804422f},
std::array<float,2>{0.824761331f, 0.436413437f},
std::array<float,2>{0.162901416f, 0.708485603f},
std::array<float,2>{0.470359236f, 0.346029967f},
std::array<float,2>{0.534554005f, 0.596176744f},
std::array<float,2>{0.811842501f, 0.0139061837f},
std::array<float,2>{0.193557277f, 0.846000254f},
std::array<float,2>{0.0575622842f, 0.165455595f},
std::array<float,2>{0.89810127f, 0.882751167f},
std::array<float,2>{0.680387437f, 0.457519233f},
std::array<float,2>{0.259927571f, 0.681161165f},
std::array<float,2>{0.126518756f, 0.395849675f},
std::array<float,2>{0.871073246f, 0.744261265f},
std::array<float,2>{0.611710966f, 0.222273245f},
std::array<float,2>{0.385144889f, 0.956369579f},
std::array<float,2>{0.334376246f, 0.0700895041f},
std::array<float,2>{0.740114868f, 0.76985836f},
std::array<float,2>{0.980601311f, 0.256264448f},
std::array<float,2>{0.0670436025f, 0.555959463f},
std::array<float,2>{0.40356496f, 0.417245656f},
std::array<float,2>{0.60275358f, 0.699831784f},
std::array<float,2>{0.849126935f, 0.20089747f},
std::array<float,2>{0.144158617f, 0.985195816f},
std::array<float,2>{0.0892392695f, 0.121307299f},
std::array<float,2>{0.999259949f, 0.798229098f},
std::array<float,2>{0.729527831f, 0.3100667f},
std::array<float,2>{0.313660234f, 0.518714786f},
std::array<float,2>{0.211381346f, 0.335777432f},
std::array<float,2>{0.782333016f, 0.566763103f},
std::array<float,2>{0.558897018f, 0.0429258645f},
std::array<float,2>{0.49477464f, 0.833909154f},
std::array<float,2>{0.27212891f, 0.140304983f},
std::array<float,2>{0.661663294f, 0.912859321f},
std::array<float,2>{0.890344024f, 0.48070693f},
std::array<float,2>{0.0416093729f, 0.641839206f},
std::array<float,2>{0.344770849f, 0.28044644f},
std::array<float,2>{0.692248821f, 0.544625103f},
std::array<float,2>{0.939101934f, 0.085018754f},
std::array<float,2>{0.0973615646f, 0.754955232f},
std::array<float,2>{0.179504141f, 0.240507692f},
std::array<float,2>{0.84112674f, 0.940841734f},
std::array<float,2>{0.587770104f, 0.376211643f},
std::array<float,2>{0.432611614f, 0.727892578f},
std::array<float,2>{0.0224163197f, 0.449311137f},
std::array<float,2>{0.909191728f, 0.668290019f},
std::array<float,2>{0.637484431f, 0.176339567f},
std::array<float,2>{0.303139061f, 0.899396837f},
std::array<float,2>{0.467120022f, 0.0310613122f},
std::array<float,2>{0.50353545f, 0.865179777f},
std::array<float,2>{0.778301299f, 0.359905273f},
std::array<float,2>{0.246911287f, 0.613550663f},
std::array<float,2>{0.324227571f, 0.386205077f},
std::array<float,2>{0.723904312f, 0.72117722f},
std::array<float,2>{0.989348471f, 0.244198367f},
std::array<float,2>{0.081778191f, 0.952701032f},
std::array<float,2>{0.153701723f, 0.0864463598f},
std::array<float,2>{0.856058359f, 0.765574336f},
std::array<float,2>{0.597068071f, 0.265817285f},
std::array<float,2>{0.398288876f, 0.536346614f},
std::array<float,2>{0.0376277119f, 0.369179577f},
std::array<float,2>{0.875115275f, 0.622602105f},
std::array<float,2>{0.67037338f, 0.0217076559f},
std::array<float,2>{0.277605146f, 0.870918214f},
std::array<float,2>{0.487694889f, 0.184384912f},
std::array<float,2>{0.549179316f, 0.891983509f},
std::array<float,2>{0.789504766f, 0.438375175f},
std::array<float,2>{0.207675666f, 0.659387648f},
std::array<float,2>{0.425439f, 0.300551713f},
std::array<float,2>{0.584057152f, 0.529249251f},
std::array<float,2>{0.832600892f, 0.112247601f},
std::array<float,2>{0.180470899f, 0.810857832f},
std::array<float,2>{0.107680582f, 0.192574322f},
std::array<float,2>{0.948182821f, 0.997590244f},
std::array<float,2>{0.696641207f, 0.407967359f},
std::array<float,2>{0.352581948f, 0.692198932f},
std::array<float,2>{0.239884928f, 0.470455438f},
std::array<float,2>{0.771406293f, 0.654996514f},
std::array<float,2>{0.515602589f, 0.129603714f},
std::array<float,2>{0.458757967f, 0.921306968f},
std::array<float,2>{0.312345684f, 0.0333705582f},
std::array<float,2>{0.630749643f, 0.837855697f},
std::array<float,2>{0.920984805f, 0.338235945f},
std::array<float,2>{0.0238046944f, 0.572855234f},
std::array<float,2>{0.444666326f, 0.461498141f},
std::array<float,2>{0.523675919f, 0.679231107f},
std::array<float,2>{0.761802495f, 0.162817389f},
std::array<float,2>{0.219921023f, 0.890485406f},
std::array<float,2>{0.00524654612f, 0.00398689648f},
std::array<float,2>{0.925931275f, 0.855282545f},
std::array<float,2>{0.643326521f, 0.357953489f},
std::array<float,2>{0.285405487f, 0.608320177f},
std::array<float,2>{0.168624237f, 0.261395305f},
std::array<float,2>{0.814590037f, 0.547995925f},
std::array<float,2>{0.567763627f, 0.0755939931f},
std::array<float,2>{0.420890301f, 0.77582711f},
std::array<float,2>{0.366396904f, 0.226795197f},
std::array<float,2>{0.70777005f, 0.967763066f},
std::array<float,2>{0.956394672f, 0.400789857f},
std::array<float,2>{0.11033646f, 0.74159205f},
std::array<float,2>{0.255790532f, 0.322600365f},
std::array<float,2>{0.675171554f, 0.59043479f},
std::array<float,2>{0.900058687f, 0.0563064665f},
std::array<float,2>{0.0518953539f, 0.818142772f},
std::array<float,2>{0.200272217f, 0.142684266f},
std::array<float,2>{0.799876511f, 0.930368662f},
std::array<float,2>{0.545670509f, 0.492276371f},
std::array<float,2>{0.479424626f, 0.631791472f},
std::array<float,2>{0.0729407147f, 0.422537148f},
std::array<float,2>{0.973522007f, 0.71289283f},
std::array<float,2>{0.744802177f, 0.204440057f},
std::array<float,2>{0.339189947f, 0.969539046f},
std::array<float,2>{0.375162542f, 0.107900515f},
std::array<float,2>{0.62090981f, 0.795466125f},
std::array<float,2>{0.862471104f, 0.29654181f},
std::array<float,2>{0.135639966f, 0.504241467f},
std::array<float,2>{0.276339382f, 0.433343887f},
std::array<float,2>{0.667707741f, 0.704344451f},
std::array<float,2>{0.881955922f, 0.211206585f},
std::array<float,2>{0.0348688029f, 0.983090818f},
std::array<float,2>{0.203396887f, 0.096062623f},
std::array<float,2>{0.796040058f, 0.78822428f},
std::array<float,2>{0.551650703f, 0.281554818f},
std::array<float,2>{0.490100831f, 0.512851775f},
std::array<float,2>{0.0830946565f, 0.318048954f},
std::array<float,2>{0.988147199f, 0.584167659f},
std::array<float,2>{0.722649515f, 0.0487833805f},
std::array<float,2>{0.321287692f, 0.827851355f},
std::array<float,2>{0.392793268f, 0.149352387f},
std::array<float,2>{0.599636078f, 0.927990913f},
std::array<float,2>{0.854170442f, 0.48833406f},
std::array<float,2>{0.149121538f, 0.640503943f},
std::array<float,2>{0.453296632f, 0.252980143f},
std::array<float,2>{0.510458052f, 0.55903697f},
std::array<float,2>{0.766424716f, 0.0627630427f},
std::array<float,2>{0.234672293f, 0.766504407f},
std::array<float,2>{0.0290727001f, 0.226139024f},
std::array<float,2>{0.915481329f, 0.959132552f},
std::array<float,2>{0.62666893f, 0.392340779f},
std::array<float,2>{0.305865705f, 0.747793317f},
std::array<float,2>{0.185375988f, 0.453800023f},
std::array<float,2>{0.828387558f, 0.684409976f},
std::array<float,2>{0.57838279f, 0.168567359f},
std::array<float,2>{0.427142709f, 0.876118958f},
std::array<float,2>{0.35585627f, 0.00987428799f},
std::array<float,2>{0.701971352f, 0.850215614f},
std::array<float,2>{0.952174067f, 0.350137323f},
std::array<float,2>{0.104825363f, 0.598487735f},
std::array<float,2>{0.414297998f, 0.47717467f},
std::array<float,2>{0.564540803f, 0.646477282f},
std::array<float,2>{0.817660511f, 0.13628234f},
std::array<float,2>{0.166487381f, 0.909025848f},
std::array<float,2>{0.116109058f, 0.0447644219f},
std::array<float,2>{0.95888865f, 0.830937564f},
std::array<float,2>{0.706480503f, 0.328475863f},
std::array<float,2>{0.361977935f, 0.563969254f},
std::array<float,2>{0.22511515f, 0.306408763f},
std::array<float,2>{0.759421647f, 0.521633625f},
std::array<float,2>{0.527713537f, 0.118886545f},
std::array<float,2>{0.439636797f, 0.801341712f},
std::array<float,2>{0.284187555f, 0.197820857f},
std::array<float,2>{0.647169232f, 0.991168618f},
std::array<float,2>{0.923280239f, 0.419460297f},
std::array<float,2>{0.00341303181f, 0.69631052f},
std::array<float,2>{0.34260729f, 0.366035968f},
std::array<float,2>{0.746756494f, 0.611352205f},
std::array<float,2>{0.9717381f, 0.0272041466f},
std::array<float,2>{0.0771178305f, 0.860539675f},
std::array<float,2>{0.13895911f, 0.172747388f},
std::array<float,2>{0.86572957f, 0.903108954f},
std::array<float,2>{0.621845126f, 0.447784185f},
std::array<float,2>{0.382087171f, 0.667733133f},
std::array<float,2>{0.0500623398f, 0.38103947f},
std::array<float,2>{0.905633509f, 0.733698964f},
std::array<float,2>{0.677945077f, 0.235916764f},
std::array<float,2>{0.250291049f, 0.943407953f},
std::array<float,2>{0.480658233f, 0.0816644728f},
std::array<float,2>{0.540815055f, 0.753840625f},
std::array<float,2>{0.802654386f, 0.273928195f},
std::array<float,2>{0.19856666f, 0.540049374f},
std::array<float,2>{0.368014157f, 0.443581283f},
std::array<float,2>{0.711690962f, 0.66069448f},
std::array<float,2>{0.964731395f, 0.181289241f},
std::array<float,2>{0.117291428f, 0.895209074f},
std::array<float,2>{0.160019919f, 0.0172270089f},
std::array<float,2>{0.823009312f, 0.874122202f},
std::array<float,2>{0.573458195f, 0.373583645f},
std::array<float,2>{0.409424007f, 0.621053636f},
std::array<float,2>{0.00992084388f, 0.27204144f},
std::array<float,2>{0.937002838f, 0.531497896f},
std::array<float,2>{0.650577486f, 0.0929538459f},
std::array<float,2>{0.29170984f, 0.761602104f},
std::array<float,2>{0.448858649f, 0.248538569f},
std::array<float,2>{0.522460282f, 0.948402703f},
std::array<float,2>{0.755053818f, 0.389989376f},
std::array<float,2>{0.233354077f, 0.72596997f},
std::array<float,2>{0.388578147f, 0.340771079f},
std::array<float,2>{0.615735888f, 0.576652288f},
std::array<float,2>{0.8741225f, 0.0386860967f},
std::array<float,2>{0.131782144f, 0.841655731f},
std::array<float,2>{0.0649144799f, 0.126522273f},
std::array<float,2>{0.976957142f, 0.914868951f},
std::array<float,2>{0.736266553f, 0.473161012f},
std::array<float,2>{0.330848396f, 0.65053463f},
std::array<float,2>{0.191133603f, 0.411509782f},
std::array<float,2>{0.806653917f, 0.690419972f},
std::array<float,2>{0.536820114f, 0.190485775f},
std::array<float,2>{0.474762738f, 0.993559301f},
std::array<float,2>{0.2630741f, 0.114654824f},
std::array<float,2>{0.686732948f, 0.805952251f},
std::array<float,2>{0.892376781f, 0.304605603f},
std::array<float,2>{0.0591624975f, 0.527272284f},
std::array<float,2>{0.498882174f, 0.402369738f},
std::array<float,2>{0.556506634f, 0.734979033f},
std::array<float,2>{0.788122714f, 0.231107503f},
std::array<float,2>{0.217017859f, 0.96459955f},
std::array<float,2>{0.0460645594f, 0.0740958601f},
std::array<float,2>{0.885189831f, 0.777801096f},
std::array<float,2>{0.658603847f, 0.263593584f},
std::array<float,2>{0.269417644f, 0.551252961f},
std::array<float,2>{0.1463404f, 0.35540098f},
std::array<float,2>{0.847649753f, 0.604697287f},
std::array<float,2>{0.6088503f, 0.00254869997f},
std::array<float,2>{0.399516851f, 0.855516911f},
std::array<float,2>{0.318145514f, 0.159398884f},
std::array<float,2>{0.731686771f, 0.883502185f},
std::array<float,2>{0.992504954f, 0.468515724f},
std::array<float,2>{0.0929451883f, 0.6730299f},
std::array<float,2>{0.30057317f, 0.292901218f},
std::array<float,2>{0.635896564f, 0.501450181f},
std::array<float,2>{0.910603106f, 0.105396762f},
std::array<float,2>{0.0168308541f, 0.790860951f},
std::array<float,2>{0.245312348f, 0.207560912f},
std::array<float,2>{0.777081311f, 0.975876033f},
std::array<float,2>{0.505584478f, 0.427024037f},
std::array<float,2>{0.461002648f, 0.716967583f},
std::array<float,2>{0.101179883f, 0.499013573f},
std::array<float,2>{0.94333607f, 0.628613949f},
std::array<float,2>{0.68799758f, 0.148119405f},
std::array<float,2>{0.348925054f, 0.934600949f},
std::array<float,2>{0.434986174f, 0.0619955435f},
std::array<float,2>{0.592515349f, 0.813361526f},
std::array<float,2>{0.837637067f, 0.32426393f},
std::array<float,2>{0.174321309f, 0.58905375f},
std::array<float,2>{0.25805074f, 0.459053636f},
std::array<float,2>{0.681916654f, 0.682461739f},
std::array<float,2>{0.894592464f, 0.167935297f},
std::array<float,2>{0.0565992482f, 0.879339993f},
std::array<float,2>{0.192594811f, 0.0134619223f},
std::array<float,2>{0.809227884f, 0.844074011f},
std::array<float,2>{0.533028185f, 0.343993038f},
std::array<float,2>{0.472500503f, 0.595405638f},
std::array<float,2>{0.0698871836f, 0.255281717f},
std::array<float,2>{0.982498944f, 0.557629585f},
std::array<float,2>{0.741481721f, 0.0682790726f},
std::array<float,2>{0.332556009f, 0.77302146f},
std::array<float,2>{0.384100914f, 0.219085366f},
std::array<float,2>{0.610188365f, 0.954278886f},
std::array<float,2>{0.867485285f, 0.397268027f},
std::array<float,2>{0.128123179f, 0.743713439f},
std::array<float,2>{0.450347662f, 0.315144449f},
std::array<float,2>{0.517657757f, 0.581920266f},
std::array<float,2>{0.750410974f, 0.052402053f},
std::array<float,2>{0.228396758f, 0.82211256f},
std::array<float,2>{0.0144894421f, 0.154118016f},
std::array<float,2>{0.933311403f, 0.921985865f},
std::array<float,2>{0.65420115f, 0.485662192f},
std::array<float,2>{0.296377003f, 0.634283006f},
std::array<float,2>{0.161711693f, 0.435285419f},
std::array<float,2>{0.826174915f, 0.710163057f},
std::array<float,2>{0.574686944f, 0.217461318f},
std::array<float,2>{0.411139667f, 0.979544163f},
std::array<float,2>{0.374804676f, 0.0996891111f},
std::array<float,2>{0.718280494f, 0.784899235f},
std::array<float,2>{0.965271831f, 0.287542999f},
std::array<float,2>{0.12134026f, 0.511125803f},
std::array<float,2>{0.431635827f, 0.378749847f},
std::array<float,2>{0.589107692f, 0.729577363f},
std::array<float,2>{0.843681693f, 0.239226893f},
std::array<float,2>{0.177440986f, 0.93928355f},
std::array<float,2>{0.0953942761f, 0.0828182995f},
std::array<float,2>{0.939862907f, 0.757680416f},
std::array<float,2>{0.693374574f, 0.278635681f},
std::array<float,2>{0.346093446f, 0.545480847f},
std::array<float,2>{0.249137312f, 0.361742288f},
std::array<float,2>{0.780692041f, 0.616217792f},
std::array<float,2>{0.500395358f, 0.0284963585f},
std::array<float,2>{0.466515422f, 0.866752386f},
std::array<float,2>{0.301951319f, 0.177960098f},
std::array<float,2>{0.639001966f, 0.900511265f},
std::array<float,2>{0.906481981f, 0.452881396f},
std::array<float,2>{0.0208210982f, 0.670161247f},
std::array<float,2>{0.315449655f, 0.312246263f},
std::array<float,2>{0.728400469f, 0.515851855f},
std::array<float,2>{0.997075856f, 0.123161539f},
std::array<float,2>{0.087096706f, 0.800176442f},
std::array<float,2>{0.141650468f, 0.201411456f},
std::array<float,2>{0.849715531f, 0.987324893f},
std::array<float,2>{0.605311453f, 0.41417411f},
std::array<float,2>{0.404354483f, 0.702639163f},
std::array<float,2>{0.0400000997f, 0.483989298f},
std::array<float,2>{0.88811332f, 0.643202901f},
std::array<float,2>{0.66212225f, 0.137200281f},
std::array<float,2>{0.271211207f, 0.911269963f},
std::array<float,2>{0.493479371f, 0.0394919477f},
std::array<float,2>{0.560998082f, 0.834105611f},
std::array<float,2>{0.784465194f, 0.333245277f},
std::array<float,2>{0.212920114f, 0.569345593f},
std::array<float,2>{0.354965538f, 0.409104675f},
std::array<float,2>{0.698687613f, 0.6936028f},
std::array<float,2>{0.945337415f, 0.194800571f},
std::array<float,2>{0.106119864f, 0.999503374f},
std::array<float,2>{0.183172703f, 0.110587128f},
std::array<float,2>{0.835759759f, 0.809458852f},
std::array<float,2>{0.583516955f, 0.297778934f},
std::array<float,2>{0.423487514f, 0.530516565f},
std::array<float,2>{0.0260130931f, 0.336442679f},
std::array<float,2>{0.919162393f, 0.570757806f},
std::array<float,2>{0.631233454f, 0.0322613716f},
std::array<float,2>{0.3089073f, 0.83892411f},
std::array<float,2>{0.459564954f, 0.130918518f},
std::array<float,2>{0.511825502f, 0.918842316f},
std::array<float,2>{0.772219777f, 0.472426772f},
std::array<float,2>{0.241353512f, 0.653555572f},
std::array<float,2>{0.396454394f, 0.26885733f},
std::array<float,2>{0.59564054f, 0.53789252f},
std::array<float,2>{0.859054625f, 0.0893197805f},
std::array<float,2>{0.154990897f, 0.762924075f},
std::array<float,2>{0.0794222653f, 0.242769524f},
std::array<float,2>{0.991824687f, 0.950679302f},
std::array<float,2>{0.724975169f, 0.38305071f},
std::array<float,2>{0.326454222f, 0.719703853f},
std::array<float,2>{0.210533798f, 0.439824164f},
std::array<float,2>{0.791868389f, 0.656734347f},
std::array<float,2>{0.547064245f, 0.18649222f},
std::array<float,2>{0.486048281f, 0.892758429f},
std::array<float,2>{0.279360861f, 0.0201989207f},
std::array<float,2>{0.668340385f, 0.868325353f},
std::array<float,2>{0.878634751f, 0.368406296f},
std::array<float,2>{0.0352550596f, 0.624975443f},
std::array<float,2>{0.477409124f, 0.495756775f},
std::array<float,2>{0.543854177f, 0.629413009f},
std::array<float,2>{0.798053503f, 0.140938118f},
std::array<float,2>{0.202790245f, 0.931887925f},
std::array<float,2>{0.0530598275f, 0.0566763245f},
std::array<float,2>{0.901728511f, 0.820091724f},
std::array<float,2>{0.673589826f, 0.321951807f},
std::array<float,2>{0.256523997f, 0.592122376f},
std::array<float,2>{0.132952556f, 0.294216543f},
std::array<float,2>{0.861012816f, 0.507240593f},
std::array<float,2>{0.618856907f, 0.105865009f},
std::array<float,2>{0.378274679f, 0.794768989f},
std::array<float,2>{0.337722808f, 0.206615835f},
std::array<float,2>{0.743850231f, 0.972502053f},
std::array<float,2>{0.974749029f, 0.425160319f},
std::array<float,2>{0.0711158812f, 0.711658359f},
std::array<float,2>{0.28775683f, 0.356784046f},
std::array<float,2>{0.641013205f, 0.606012285f},
std::array<float,2>{0.927922249f, 0.00593770854f},
std::array<float,2>{0.00612487411f, 0.851733327f},
std::array<float,2>{0.222253978f, 0.162045971f},
std::array<float,2>{0.764401555f, 0.887126505f},
std::array<float,2>{0.526907563f, 0.46445626f},
std::array<float,2>{0.442171991f, 0.676103175f},
std::array<float,2>{0.112103246f, 0.398888648f},
std::array<float,2>{0.95331955f, 0.738496244f},
std::array<float,2>{0.7095716f, 0.229065061f},
std::array<float,2>{0.365222931f, 0.966227055f},
std::array<float,2>{0.418903828f, 0.0769079179f},
std::array<float,2>{0.568730593f, 0.774702311f},
std::array<float,2>{0.813653469f, 0.25933972f},
std::array<float,2>{0.170349464f, 0.550296664f},
std::array<float,2>{0.307956487f, 0.39422369f},
std::array<float,2>{0.627803624f, 0.749516308f},
std::array<float,2>{0.916502595f, 0.223124221f},
std::array<float,2>{0.0310599636f, 0.958004534f},
std::array<float,2>{0.23823297f, 0.0653941855f},
std::array<float,2>{0.768783391f, 0.768139362f},
std::array<float,2>{0.509503126f, 0.251931012f},
std::array<float,2>{0.456920743f, 0.562404811f},
std::array<float,2>{0.102149576f, 0.34833169f},
std::array<float,2>{0.951053798f, 0.599633276f},
std::array<float,2>{0.700089455f, 0.00905488338f},
std::array<float,2>{0.358910531f, 0.848443389f},
std::array<float,2>{0.428348422f, 0.170814395f},
std::array<float,2>{0.581085801f, 0.877065241f},
std::array<float,2>{0.83099556f, 0.45605725f},
std::array<float,2>{0.185957924f, 0.686690748f},
std::array<float,2>{0.490990788f, 0.283679783f},
std::array<float,2>{0.554511666f, 0.515215993f},
std::array<float,2>{0.794350266f, 0.0954096243f},
std::array<float,2>{0.205872208f, 0.78608942f},
std::array<float,2>{0.0322790928f, 0.2131989f},
std::array<float,2>{0.879836738f, 0.982020199f},
std::array<float,2>{0.665557563f, 0.431086004f},
std::array<float,2>{0.274468243f, 0.705899f},
std::array<float,2>{0.152334362f, 0.490675896f},
std::array<float,2>{0.853280604f, 0.637002468f},
std::array<float,2>{0.598341465f, 0.151282936f},
std::array<float,2>{0.392258704f, 0.926530182f},
std::array<float,2>{0.323715121f, 0.0489415824f},
std::array<float,2>{0.718987226f, 0.824714601f},
std::array<float,2>{0.984545648f, 0.31853649f},
std::array<float,2>{0.0852527022f, 0.583256781f},
std::array<float,2>{0.379096806f, 0.446780056f},
std::array<float,2>{0.623080909f, 0.664213181f},
std::array<float,2>{0.865150034f, 0.174670562f},
std::array<float,2>{0.138557687f, 0.904760659f},
std::array<float,2>{0.0754012391f, 0.0249078292f},
std::array<float,2>{0.969059467f, 0.862383604f},
std::array<float,2>{0.749984443f, 0.364168227f},
std::array<float,2>{0.341483802f, 0.61011523f},
std::array<float,2>{0.196116939f, 0.275696129f},
std::array<float,2>{0.803693354f, 0.542547524f},
std::array<float,2>{0.541179299f, 0.0788597614f},
std::array<float,2>{0.48333025f, 0.751091242f},
std::array<float,2>{0.252940238f, 0.23768197f},
std::array<float,2>{0.677517593f, 0.941698492f},
std::array<float,2>{0.902880788f, 0.379957169f},
std::array<float,2>{0.0481232665f, 0.732095718f},
std::array<float,2>{0.360816032f, 0.330774903f},
std::array<float,2>{0.704368234f, 0.564751446f},
std::array<float,2>{0.959404647f, 0.0454977006f},
std::array<float,2>{0.114360996f, 0.82950598f},
std::array<float,2>{0.16419889f, 0.134127825f},
std::array<float,2>{0.81984818f, 0.906556845f},
std::array<float,2>{0.562730908f, 0.479823172f},
std::array<float,2>{0.417182893f, 0.647325695f},
std::array<float,2>{0.0012182655f, 0.420941502f},
std::array<float,2>{0.924575269f, 0.699212372f},
std::array<float,2>{0.645014584f, 0.195712283f},
std::array<float,2>{0.283152789f, 0.988627553f},
std::array<float,2>{0.438680977f, 0.120166853f},
std::array<float,2>{0.531026542f, 0.804349601f},
std::array<float,2>{0.760628879f, 0.307583094f},
std::array<float,2>{0.223212183f, 0.520355463f},
std::array<float,2>{0.328195423f, 0.476284295f},
std::array<float,2>{0.737662435f, 0.648935616f},
std::array<float,2>{0.978679419f, 0.128547654f},
std::array<float,2>{0.0636808127f, 0.916062593f},
std::array<float,2>{0.130336702f, 0.0369718522f},
std::array<float,2>{0.871266425f, 0.843146026f},
std::array<float,2>{0.614692152f, 0.343532145f},
std::array<float,2>{0.389109462f, 0.574636161f},
std::array<float,2>{0.0606235862f, 0.302460194f},
std::array<float,2>{0.892949522f, 0.523895264f},
std::array<float,2>{0.684711576f, 0.115999863f},
std::array<float,2>{0.263684303f, 0.80807215f},
std::array<float,2>{0.474268585f, 0.189388126f},
std::array<float,2>{0.537305295f, 0.994493604f},
std::array<float,2>{0.806247234f, 0.413765132f},
std::array<float,2>{0.18863152f, 0.688100994f},
std::array<float,2>{0.406924158f, 0.37253812f},
std::array<float,2>{0.571925342f, 0.618237674f},
std::array<float,2>{0.821216881f, 0.0177396983f},
std::array<float,2>{0.15714547f, 0.871952593f},
std::array<float,2>{0.119618259f, 0.182108387f},
std::array<float,2>{0.961482167f, 0.897283792f},
std::array<float,2>{0.714731634f, 0.442091733f},
std::array<float,2>{0.370480627f, 0.664029241f},
std::array<float,2>{0.232221678f, 0.387797117f},
std::array<float,2>{0.75762701f, 0.72276032f},
std::array<float,2>{0.519799888f, 0.246359736f},
std::array<float,2>{0.446260273f, 0.946508944f},
std::array<float,2>{0.290788233f, 0.0914220288f},
std::array<float,2>{0.648748219f, 0.759019732f},
std::array<float,2>{0.934173465f, 0.270079911f},
std::array<float,2>{0.00794606004f, 0.533866823f},
std::array<float,2>{0.463305354f, 0.428742081f},
std::array<float,2>{0.50665468f, 0.715489566f},
std::array<float,2>{0.775112391f, 0.210002512f},
std::array<float,2>{0.242408261f, 0.973086059f},
std::array<float,2>{0.0188574214f, 0.101995371f},
std::array<float,2>{0.914047301f, 0.79157269f},
std::array<float,2>{0.633688748f, 0.289698333f},
std::array<float,2>{0.298417866f, 0.502156019f},
std::array<float,2>{0.172555417f, 0.327641249f},
std::array<float,2>{0.838624537f, 0.58641237f},
std::array<float,2>{0.591462731f, 0.0602238066f},
std::array<float,2>{0.436405659f, 0.816026866f},
std::array<float,2>{0.350441426f, 0.145011604f},
std::array<float,2>{0.690553606f, 0.937419951f},
std::array<float,2>{0.944634438f, 0.496285766f},
std::array<float,2>{0.0992368907f, 0.625981688f},
std::array<float,2>{0.265963823f, 0.264126569f},
std::array<float,2>{0.657236099f, 0.554208875f},
std::array<float,2>{0.884694338f, 0.0715305582f},
std::array<float,2>{0.044260107f, 0.779478371f},
std::array<float,2>{0.214915603f, 0.232987717f},
std::array<float,2>{0.785636187f, 0.961596489f},
std::array<float,2>{0.557802975f, 0.406194985f},
std::array<float,2>{0.496992975f, 0.737956405f},
std::array<float,2>{0.0914059058f, 0.464892268f},
std::array<float,2>{0.995004475f, 0.674817562f},
std::array<float,2>{0.733908296f, 0.157563776f},
std::array<float,2>{0.318705589f, 0.885534227f},
std::array<float,2>{0.400891244f, 0.000411502668f},
std::array<float,2>{0.605674744f, 0.859102786f},
std::array<float,2>{0.845542014f, 0.352247357f},
std::array<float,2>{0.147603467f, 0.602616727f},
std::array<float,2>{0.270303518f, 0.481493503f},
std::array<float,2>{0.663970232f, 0.641476989f},
std::array<float,2>{0.886932313f, 0.139420524f},
std::array<float,2>{0.0405950136f, 0.913974166f},
std::array<float,2>{0.214698344f, 0.0415298231f},
std::array<float,2>{0.783482909f, 0.832369804f},
std::array<float,2>{0.562004209f, 0.334131479f},
std::array<float,2>{0.492906749f, 0.56768018f},
std::array<float,2>{0.086703971f, 0.30916664f},
std::array<float,2>{0.996334553f, 0.518352151f},
std::array<float,2>{0.726900935f, 0.12257275f},
std::array<float,2>{0.314668566f, 0.797707856f},
std::array<float,2>{0.406243593f, 0.199336544f},
std::array<float,2>{0.604080617f, 0.985824585f},
std::array<float,2>{0.850960612f, 0.416369528f},
std::array<float,2>{0.141473025f, 0.700220823f},
std::array<float,2>{0.465789467f, 0.360568136f},
std::array<float,2>{0.501236618f, 0.615201116f},
std::array<float,2>{0.780251861f, 0.02999302f},
std::array<float,2>{0.248466805f, 0.863716066f},
std::array<float,2>{0.0201161429f, 0.176784918f},
std::array<float,2>{0.907892525f, 0.900077164f},
std::array<float,2>{0.640015483f, 0.450471103f},
std::array<float,2>{0.301072478f, 0.669867814f},
std::array<float,2>{0.175965384f, 0.375472039f},
std::array<float,2>{0.842649281f, 0.726956189f},
std::array<float,2>{0.587909937f, 0.242153764f},
std::array<float,2>{0.42977795f, 0.939735889f},
std::array<float,2>{0.347622126f, 0.084959507f},
std::array<float,2>{0.694524288f, 0.754698813f},
std::array<float,2>{0.94119817f, 0.280195236f},
std::array<float,2>{0.0938364342f, 0.542978764f},
std::array<float,2>{0.410473555f, 0.436839551f},
std::array<float,2>{0.575564563f, 0.707455397f},
std::array<float,2>{0.828017414f, 0.215395108f},
std::array<float,2>{0.161043867f, 0.977527976f},
std::array<float,2>{0.122090407f, 0.0990314633f},
std::array<float,2>{0.966399074f, 0.783053458f},
std::array<float,2>{0.717048585f, 0.285424948f},
std::array<float,2>{0.373362541f, 0.50868535f},
std::array<float,2>{0.227285221f, 0.313930929f},
std::array<float,2>{0.751116931f, 0.579800248f},
std::array<float,2>{0.519398272f, 0.0541746728f},
std::array<float,2>{0.449358255f, 0.822905838f},
std::array<float,2>{0.295320809f, 0.155028135f},
std::array<float,2>{0.653068125f, 0.924969673f},
std::array<float,2>{0.932478011f, 0.487691224f},
std::array<float,2>{0.0150525281f, 0.636618078f},
std::array<float,2>{0.333574295f, 0.257753581f},
std::array<float,2>{0.741159439f, 0.554876149f},
std::array<float,2>{0.984010279f, 0.0689886436f},
std::array<float,2>{0.0689682141f, 0.771434009f},
std::array<float,2>{0.127052173f, 0.22071445f},
std::array<float,2>{0.868417859f, 0.955738783f},
std::array<float,2>{0.610982835f, 0.394533783f},
std::array<float,2>{0.383726358f, 0.746060669f},
std::array<float,2>{0.0550942384f, 0.458348274f},
std::array<float,2>{0.895876408f, 0.680389822f},
std::array<float,2>{0.68314904f, 0.164762899f},
std::array<float,2>{0.259740144f, 0.881544292f},
std::array<float,2>{0.471664876f, 0.0146958744f},
std::array<float,2>{0.531945944f, 0.846985579f},
std::array<float,2>{0.80985707f, 0.347356141f},
std::array<float,2>{0.192248389f, 0.596746385f},
std::array<float,2>{0.363722324f, 0.401501864f},
std::array<float,2>{0.71049875f, 0.741118968f},
std::array<float,2>{0.954774797f, 0.227634922f},
std::array<float,2>{0.113150209f, 0.968443692f},
std::array<float,2>{0.171850815f, 0.0746221989f},
std::array<float,2>{0.813273191f, 0.776486695f},
std::array<float,2>{0.570037603f, 0.260330379f},
std::array<float,2>{0.419051021f, 0.547559381f},
std::array<float,2>{0.00712162023f, 0.358668804f},
std::array<float,2>{0.928954124f, 0.608657122f},
std::array<float,2>{0.641923904f, 0.00564635685f},
std::array<float,2>{0.288444042f, 0.854141772f},
std::array<float,2>{0.442834109f, 0.164061531f},
std::array<float,2>{0.525656343f, 0.88907069f},
std::array<float,2>{0.765384674f, 0.462149888f},
std::array<float,2>{0.220768586f, 0.678079724f},
std::array<float,2>{0.377412379f, 0.295134723f},
std::array<float,2>{0.617494345f, 0.505018413f},
std::array<float,2>{0.859790206f, 0.109225102f},
std::array<float,2>{0.134453923f, 0.796137333f},
std::array<float,2>{0.0714957491f, 0.20397532f},
std::array<float,2>{0.976315558f, 0.969744623f},
std::array<float,2>{0.742758512f, 0.423422337f},
std::array<float,2>{0.336599767f, 0.714820325f},
std::array<float,2>{0.201198921f, 0.494136393f},
std::array<float,2>{0.797474384f, 0.632720232f},
std::array<float,2>{0.544511795f, 0.143924713f},
std::array<float,2>{0.47810486f, 0.930684566f},
std::array<float,2>{0.257003993f, 0.0550264344f},
std::array<float,2>{0.672114611f, 0.816516936f},
std::array<float,2>{0.900442064f, 0.323829412f},
std::array<float,2>{0.0544672497f, 0.591718972f},
std::array<float,2>{0.485004723f, 0.438733339f},
std::array<float,2>{0.548460424f, 0.659157515f},
std::array<float,2>{0.792223632f, 0.185035378f},
std::array<float,2>{0.209906146f, 0.891501904f},
std::array<float,2>{0.0370005034f, 0.0232157856f},
std::array<float,2>{0.877206981f, 0.870034158f},
std::array<float,2>{0.668958724f, 0.37050423f},
std::array<float,2>{0.280371696f, 0.621789575f},
std::array<float,2>{0.155321643f, 0.267454475f},
std::array<float,2>{0.857580662f, 0.535741568f},
std::array<float,2>{0.593763649f, 0.0878349394f},
std::array<float,2>{0.394815981f, 0.764634848f},
std::array<float,2>{0.327561557f, 0.245622724f},
std::array<float,2>{0.725990832f, 0.951319754f},
std::array<float,2>{0.990480125f, 0.385437399f},
std::array<float,2>{0.0790592507f, 0.721683145f},
std::array<float,2>{0.309987873f, 0.339615583f},
std::array<float,2>{0.632380664f, 0.573826015f},
std::array<float,2>{0.91889596f, 0.0351471156f},
std::array<float,2>{0.0266941972f, 0.836819589f},
std::array<float,2>{0.240689814f, 0.130528882f},
std::array<float,2>{0.772836924f, 0.920109212f},
std::array<float,2>{0.512762964f, 0.46946016f},
std::array<float,2>{0.460501254f, 0.655479789f},
std::array<float,2>{0.107311293f, 0.406835318f},
std::array<float,2>{0.946772635f, 0.693271101f},
std::array<float,2>{0.69751507f, 0.192088798f},
std::array<float,2>{0.353537172f, 0.996237695f},
std::array<float,2>{0.4226937f, 0.112813681f},
std::array<float,2>{0.58296144f, 0.811572433f},
std::array<float,2>{0.83489424f, 0.298843622f},
std::array<float,2>{0.18208167f, 0.528039753f},
std::array<float,2>{0.281391233f, 0.418723375f},
std::array<float,2>{0.646235049f, 0.695834279f},
std::array<float,2>{0.925697446f, 0.19857268f},
std::array<float,2>{0.000465594087f, 0.991297722f},
std::array<float,2>{0.224435374f, 0.117828764f},
std::array<float,2>{0.76118356f, 0.802507699f},
std::array<float,2>{0.530239522f, 0.305278063f},
std::array<float,2>{0.437882543f, 0.52289474f},
std::array<float,2>{0.11401692f, 0.329482079f},
std::array<float,2>{0.96076262f, 0.56319195f},
std::array<float,2>{0.704078555f, 0.0435201973f},
std::array<float,2>{0.360151052f, 0.831196368f},
std::array<float,2>{0.41698122f, 0.134888962f},
std::array<float,2>{0.564069092f, 0.90994072f},
std::array<float,2>{0.818953335f, 0.478459656f},
std::array<float,2>{0.165240377f, 0.645029247f},
std::array<float,2>{0.483798862f, 0.274752438f},
std::array<float,2>{0.542589366f, 0.539745986f},
std::array<float,2>{0.804388642f, 0.0808007419f},
std::array<float,2>{0.197205052f, 0.752872646f},
std::array<float,2>{0.047691036f, 0.235131368f},
std::array<float,2>{0.903778613f, 0.944847167f},
std::array<float,2>{0.676586688f, 0.382011712f},
std::array<float,2>{0.252260923f, 0.733335912f},
std::array<float,2>{0.137555853f, 0.448901504f},
std::array<float,2>{0.8639431f, 0.666734099f},
std::array<float,2>{0.624498427f, 0.173500329f},
std::array<float,2>{0.380199999f, 0.903948545f},
std::array<float,2>{0.340766579f, 0.0262603499f},
std::array<float,2>{0.748533309f, 0.859906495f},
std::array<float,2>{0.970201015f, 0.366560966f},
std::array<float,2>{0.0748035535f, 0.612541258f},
std::array<float,2>{0.391533345f, 0.489312261f},
std::array<float,2>{0.598702848f, 0.639521599f},
std::array<float,2>{0.852351904f, 0.150334567f},
std::array<float,2>{0.151309028f, 0.928812861f},
std::array<float,2>{0.0842892826f, 0.0469875224f},
std::array<float,2>{0.985728204f, 0.827096999f},
std::array<float,2>{0.720211565f, 0.316966265f},
std::array<float,2>{0.322279811f, 0.585708082f},
std::array<float,2>{0.206300497f, 0.283082992f},
std::array<float,2>{0.793486595f, 0.512431204f},
std::array<float,2>{0.553028345f, 0.0974413902f},
std::array<float,2>{0.491284698f, 0.787238657f},
std::array<float,2>{0.274383277f, 0.212775365f},
std::array<float,2>{0.664094388f, 0.984337807f},
std::array<float,2>{0.880043924f, 0.432100236f},
std::array<float,2>{0.0314919278f, 0.704021513f},
std::array<float,2>{0.357852072f, 0.351165265f},
std::array<float,2>{0.700475276f, 0.598639667f},
std::array<float,2>{0.950018227f, 0.0112954555f},
std::array<float,2>{0.103175774f, 0.850855291f},
std::array<float,2>{0.187162474f, 0.169920489f},
std::array<float,2>{0.831270158f, 0.875789881f},
std::array<float,2>{0.58029443f, 0.454354286f},
std::array<float,2>{0.429270059f, 0.684933126f},
std::array<float,2>{0.0294826683f, 0.391137153f},
std::array<float,2>{0.917516351f, 0.74628669f},
std::array<float,2>{0.628097713f, 0.225285262f},
std::array<float,2>{0.307026148f, 0.960728824f},
std::array<float,2>{0.455431312f, 0.0638132542f},
std::array<float,2>{0.508114815f, 0.767155945f},
std::array<float,2>{0.767826617f, 0.25291726f},
std::array<float,2>{0.237055525f, 0.560450435f},
std::array<float,2>{0.319870085f, 0.467053771f},
std::array<float,2>{0.73285383f, 0.672102928f},
std::array<float,2>{0.995619237f, 0.159176007f},
std::array<float,2>{0.0907710046f, 0.884672105f},
std::array<float,2>{0.146560892f, 0.0038492023f},
std::array<float,2>{0.844614327f, 0.857061505f},
std::array<float,2>{0.606943011f, 0.354010522f},
std::array<float,2>{0.401837647f, 0.6035586f},
std::array<float,2>{0.0432391278f, 0.262693822f},
std::array<float,2>{0.88352704f, 0.55202949f},
std::array<float,2>{0.656926274f, 0.072284624f},
std::array<float,2>{0.267553329f, 0.778435469f},
std::array<float,2>{0.49800244f, 0.231724426f},
std::array<float,2>{0.55728358f, 0.96332258f},
std::array<float,2>{0.786793113f, 0.4037233f},
std::array<float,2>{0.216445088f, 0.735412359f},
std::array<float,2>{0.436762869f, 0.325383127f},
std::array<float,2>{0.590174437f, 0.58794266f},
std::array<float,2>{0.839128196f, 0.0612412319f},
std::array<float,2>{0.173305228f, 0.813599885f},
std::array<float,2>{0.0976996347f, 0.146641597f},
std::array<float,2>{0.943831265f, 0.934260428f},
std::array<float,2>{0.690150142f, 0.499166638f},
std::array<float,2>{0.351535708f, 0.627773583f},
std::array<float,2>{0.243730724f, 0.42602855f},
std::array<float,2>{0.773768187f, 0.718355417f},
std::array<float,2>{0.507013261f, 0.208073542f},
std::array<float,2>{0.464532703f, 0.974825144f},
std::array<float,2>{0.297694534f, 0.103961267f},
std::array<float,2>{0.634189069f, 0.789135635f},
std::array<float,2>{0.912271917f, 0.291262716f},
std::array<float,2>{0.0184218977f, 0.500931442f},
std::array<float,2>{0.446532309f, 0.388736367f},
std::array<float,2>{0.520585895f, 0.725217581f},
std::array<float,2>{0.756200016f, 0.249758109f},
std::array<float,2>{0.231082007f, 0.947374284f},
std::array<float,2>{0.00888521597f, 0.0920119062f},
std::array<float,2>{0.935399711f, 0.760251462f},
std::array<float,2>{0.650383174f, 0.273303717f},
std::array<float,2>{0.289992839f, 0.533024073f},
std::array<float,2>{0.157489225f, 0.37479347f},
std::array<float,2>{0.821866214f, 0.619489491f},
std::array<float,2>{0.570561409f, 0.0162100922f},
std::array<float,2>{0.407231957f, 0.87393117f},
std::array<float,2>{0.369168192f, 0.179710776f},
std::array<float,2>{0.713519871f, 0.895539999f},
std::array<float,2>{0.96222949f, 0.444419742f},
std::array<float,2>{0.120609947f, 0.661848605f},
std::array<float,2>{0.265577376f, 0.303042769f},
std::array<float,2>{0.684254646f, 0.526183546f},
std::array<float,2>{0.893655539f, 0.113965958f},
std::array<float,2>{0.0624086149f, 0.805116177f},
std::array<float,2>{0.188147962f, 0.190108001f},
std::array<float,2>{0.804966867f, 0.993160963f},
std::array<float,2>{0.538110852f, 0.410401851f},
std::array<float,2>{0.472769678f, 0.691103935f},
std::array<float,2>{0.0629301593f, 0.473747313f},
std::array<float,2>{0.980389297f, 0.651867747f},
std::array<float,2>{0.736544907f, 0.125366077f},
std::array<float,2>{0.329735637f, 0.915556908f},
std::array<float,2>{0.389665872f, 0.0379987694f},
std::array<float,2>{0.613620937f, 0.84055829f},
std::array<float,2>{0.872894645f, 0.341597497f},
std::array<float,2>{0.129696429f, 0.577328026f},
std::array<float,2>{0.303791463f, 0.451332539f},
std::array<float,2>{0.638168156f, 0.67178899f},
std::array<float,2>{0.908617795f, 0.179628879f},
std::array<float,2>{0.022575615f, 0.902054667f},
std::array<float,2>{0.247814208f, 0.0278072376f},
std::array<float,2>{0.779253602f, 0.865608752f},
std::array<float,2>{0.502440095f, 0.362879366f},
std::array<float,2>{0.46791482f, 0.615509391f},
std::array<float,2>{0.0966714472f, 0.278065741f},
std::array<float,2>{0.93835783f, 0.546400309f},
std::array<float,2>{0.692777634f, 0.0836646706f},
std::array<float,2>{0.343928665f, 0.756448984f},
std::array<float,2>{0.433021396f, 0.239879087f},
std::array<float,2>{0.586263299f, 0.937536895f},
std::array<float,2>{0.84081769f, 0.377198577f},
std::array<float,2>{0.178607672f, 0.729140043f},
std::array<float,2>{0.495470345f, 0.332605332f},
std::array<float,2>{0.560453773f, 0.569277346f},
std::array<float,2>{0.781531036f, 0.0404139347f},
std::array<float,2>{0.212725401f, 0.835075617f},
std::array<float,2>{0.0428762548f, 0.137753114f},
std::array<float,2>{0.889013171f, 0.911074281f},
std::array<float,2>{0.6606161f, 0.482946545f},
std::array<float,2>{0.272660285f, 0.644077599f},
std::array<float,2>{0.143262982f, 0.415654451f},
std::array<float,2>{0.848584533f, 0.701493263f},
std::array<float,2>{0.602399111f, 0.202940553f},
std::array<float,2>{0.402360976f, 0.986801386f},
std::array<float,2>{0.313182056f, 0.124124423f},
std::array<float,2>{0.729188085f, 0.798901081f},
std::array<float,2>{0.998929858f, 0.311289608f},
std::array<float,2>{0.0879226923f, 0.517550349f},
std::array<float,2>{0.386461228f, 0.397986531f},
std::array<float,2>{0.613270998f, 0.742970288f},
std::array<float,2>{0.869839966f, 0.219930977f},
std::array<float,2>{0.125018835f, 0.95325774f},
std::array<float,2>{0.0675114319f, 0.0666959435f},
std::array<float,2>{0.98218292f, 0.771816671f},
std::array<float,2>{0.738772929f, 0.254505336f},
std::array<float,2>{0.335621744f, 0.55733794f},
std::array<float,2>{0.194405839f, 0.344753683f},
std::array<float,2>{0.810682178f, 0.594595671f},
std::array<float,2>{0.533229411f, 0.0120170843f},
std::array<float,2>{0.469072789f, 0.845388174f},
std::array<float,2>{0.261642456f, 0.166663244f},
std::array<float,2>{0.680853307f, 0.880207717f},
std::array<float,2>{0.896708667f, 0.460377634f},
std::array<float,2>{0.0579403639f, 0.68309176f},
std::array<float,2>{0.371174961f, 0.288442701f},
std::array<float,2>{0.716721356f, 0.510348856f},
std::array<float,2>{0.96867919f, 0.101285622f},
std::array<float,2>{0.123781793f, 0.783250928f},
std::array<float,2>{0.163372949f, 0.218400136f},
std::array<float,2>{0.825240374f, 0.979055047f},
std::array<float,2>{0.577721417f, 0.434290528f},
std::array<float,2>{0.413160473f, 0.709492624f},
std::array<float,2>{0.0120643247f, 0.485087812f},
std::array<float,2>{0.931079566f, 0.63313669f},
std::array<float,2>{0.655883551f, 0.152755663f},
std::array<float,2>{0.293647766f, 0.923684895f},
std::array<float,2>{0.451194912f, 0.0514381528f},
std::array<float,2>{0.516028583f, 0.821051836f},
std::array<float,2>{0.75258255f, 0.315490812f},
std::array<float,2>{0.228869736f, 0.580316722f},
std::array<float,2>{0.33871749f, 0.424693972f},
std::array<float,2>{0.746059597f, 0.712132931f},
std::array<float,2>{0.974144697f, 0.205547109f},
std::array<float,2>{0.0738180578f, 0.971049905f},
std::array<float,2>{0.13645114f, 0.107045263f},
std::array<float,2>{0.862195313f, 0.793556929f},
std::array<float,2>{0.619388223f, 0.293639332f},
std::array<float,2>{0.376871258f, 0.506690443f},
std::array<float,2>{0.0509916283f, 0.321009517f},
std::array<float,2>{0.899253786f, 0.593301535f},
std::array<float,2>{0.674362063f, 0.0584797151f},
std::array<float,2>{0.254829526f, 0.818644464f},
std::array<float,2>{0.480015069f, 0.141705737f},
std::array<float,2>{0.54673022f, 0.933358431f},
std::array<float,2>{0.799416363f, 0.494390935f},
std::array<float,2>{0.199719399f, 0.630479693f},
std::array<float,2>{0.421570539f, 0.258061826f},
std::array<float,2>{0.567063749f, 0.549398124f},
std::array<float,2>{0.815596998f, 0.0772504732f},
std::array<float,2>{0.169122905f, 0.774258912f},
std::array<float,2>{0.110603355f, 0.229746878f},
std::array<float,2>{0.955745101f, 0.965453625f},
std::array<float,2>{0.708200991f, 0.399722993f},
std::array<float,2>{0.366209328f, 0.740206659f},
std::array<float,2>{0.218829229f, 0.463041008f},
std::array<float,2>{0.763467371f, 0.677459359f},
std::array<float,2>{0.524929523f, 0.160864726f},
std::array<float,2>{0.444216818f, 0.887698829f},
std::array<float,2>{0.28706792f, 0.00734818447f},
std::array<float,2>{0.644301116f, 0.852671981f},
std::array<float,2>{0.926768541f, 0.356401265f},
std::array<float,2>{0.00404181285f, 0.606445551f},
std::array<float,2>{0.457906365f, 0.470894217f},
std::array<float,2>{0.513920903f, 0.652761698f},
std::array<float,2>{0.769759655f, 0.131862417f},
std::array<float,2>{0.238511249f, 0.919191957f},
std::array<float,2>{0.0252811667f, 0.0317976177f},
std::array<float,2>{0.920286119f, 0.838157833f},
std::array<float,2>{0.629188776f, 0.337094307f},
std::array<float,2>{0.310686857f, 0.571993291f},
std::array<float,2>{0.180895597f, 0.298087955f},
std::array<float,2>{0.833862543f, 0.529838741f},
std::array<float,2>{0.585928142f, 0.109467879f},
std::array<float,2>{0.424183011f, 0.809672534f},
std::array<float,2>{0.351857603f, 0.194259211f},
std::array<float,2>{0.69591099f, 0.998405397f},
std::array<float,2>{0.948295355f, 0.409256577f},
std::array<float,2>{0.108676173f, 0.694812119f},
std::array<float,2>{0.279128611f, 0.367885411f},
std::array<float,2>{0.67108494f, 0.623251498f},
std::array<float,2>{0.876124084f, 0.0207403805f},
std::array<float,2>{0.038156122f, 0.86743927f},
std::array<float,2>{0.208311394f, 0.186971337f},
std::array<float,2>{0.790428281f, 0.894466817f},
std::array<float,2>{0.550538361f, 0.440518796f},
std::array<float,2>{0.486827224f, 0.657727838f},
std::array<float,2>{0.0806683898f, 0.384360969f},
std::array<float,2>{0.988801062f, 0.719805002f},
std::array<float,2>{0.722795188f, 0.243821517f},
std::array<float,2>{0.325312912f, 0.949670911f},
std::array<float,2>{0.397154599f, 0.0880149826f},
std::array<float,2>{0.596678317f, 0.762382984f},
std::array<float,2>{0.856989324f, 0.268540144f},
std::array<float,2>{0.153144091f, 0.538574219f},
std::array<float,2>{0.251322925f, 0.37922284f},
std::array<float,2>{0.678943574f, 0.731215239f},
std::array<float,2>{0.9049142f, 0.236914679f},
std::array<float,2>{0.0491995998f, 0.943036377f},
std::array<float,2>{0.197885036f, 0.0796543136f},
std::array<float,2>{0.800801933f, 0.750248551f},
std::array<float,2>{0.539301217f, 0.27658233f},
std::array<float,2>{0.48159194f, 0.541969836f},
std::array<float,2>{0.0772721246f, 0.365129143f},
std::array<float,2>{0.971356988f, 0.610934615f},
std::array<float,2>{0.747767627f, 0.023755325f},
std::array<float,2>{0.343330294f, 0.861367285f},
std::array<float,2>{0.381596059f, 0.175050244f},
std::array<float,2>{0.622427821f, 0.906074226f},
std::array<float,2>{0.867028713f, 0.445349008f},
std::array<float,2>{0.140134081f, 0.66519928f},
std::array<float,2>{0.441264749f, 0.308470815f},
std::array<float,2>{0.528804481f, 0.521110594f},
std::array<float,2>{0.758002102f, 0.119322255f},
std::array<float,2>{0.22563374f, 0.802980661f},
std::array<float,2>{0.00254334579f, 0.196917295f},
std::array<float,2>{0.922341049f, 0.989394188f},
std::array<float,2>{0.647693992f, 0.419992596f},
std::array<float,2>{0.283622682f, 0.697868764f},
std::array<float,2>{0.167018831f, 0.478715241f},
std::array<float,2>{0.816640854f, 0.64794004f},
std::array<float,2>{0.565461576f, 0.133263707f},
std::array<float,2>{0.415593892f, 0.908182144f},
std::array<float,2>{0.36292395f, 0.0465514362f},
std::array<float,2>{0.705347717f, 0.828409433f},
std::array<float,2>{0.957749546f, 0.331578255f},
std::array<float,2>{0.11644689f, 0.566153467f},
std::array<float,2>{0.425972641f, 0.455245763f},
std::array<float,2>{0.579522014f, 0.685924709f},
std::array<float,2>{0.829513013f, 0.171111494f},
std::array<float,2>{0.184547812f, 0.878627062f},
std::array<float,2>{0.103947192f, 0.00834808778f},
std::array<float,2>{0.951728821f, 0.848757625f},
std::array<float,2>{0.702844322f, 0.349197328f},
std::array<float,2>{0.357208133f, 0.601106346f},
std::array<float,2>{0.235764906f, 0.250311345f},
std::array<float,2>{0.766960502f, 0.560609758f},
std::array<float,2>{0.511702478f, 0.0661121607f},
std::array<float,2>{0.455066293f, 0.768821836f},
std::array<float,2>{0.304861963f, 0.224213973f},
std::array<float,2>{0.6253106f, 0.958664417f},
std::array<float,2>{0.914800882f, 0.392803907f},
std::array<float,2>{0.0275619645f, 0.749007642f},
std::array<float,2>{0.321352154f, 0.320265919f},
std::array<float,2>{0.720738411f, 0.582491457f},
std::array<float,2>{0.986807287f, 0.0503403358f},
std::array<float,2>{0.0823449939f, 0.825431049f},
std::array<float,2>{0.150335893f, 0.152170599f},
std::array<float,2>{0.854592502f, 0.927665174f},
std::array<float,2>{0.601046562f, 0.491519213f},
std::array<float,2>{0.394007325f, 0.638177812f},
std::array<float,2>{0.0336255543f, 0.430404216f},
std::array<float,2>{0.881315291f, 0.706163526f},
std::array<float,2>{0.666750789f, 0.213945061f},
std::array<float,2>{0.277076781f, 0.981290877f},
std::array<float,2>{0.488648921f, 0.0941732675f},
std::array<float,2>{0.55189532f, 0.786792874f},
std::array<float,2>{0.794999182f, 0.285028964f},
std::array<float,2>{0.204546779f, 0.51367867f},
std::array<float,2>{0.348209918f, 0.497744322f},
std::array<float,2>{0.689129293f, 0.625006318f},
std::array<float,2>{0.941737592f, 0.146263272f},
std::array<float,2>{0.100064829f, 0.935923338f},
std::array<float,2>{0.175574139f, 0.0588976033f},
std::array<float,2>{0.836080253f, 0.81465137f},
std::array<float,2>{0.593000829f, 0.32707864f},
std::array<float,2>{0.434005141f, 0.587051034f},
std::array<float,2>{0.0158310253f, 0.290962249f},
std::array<float,2>{0.911345959f, 0.503329337f},
std::array<float,2>{0.634834588f, 0.10307093f},
std::array<float,2>{0.299538851f, 0.79212147f},
std::array<float,2>{0.462757438f, 0.209243238f},
std::array<float,2>{0.504098475f, 0.973774314f},
std::array<float,2>{0.775660753f, 0.428254694f},
std::array<float,2>{0.244837999f, 0.716019809f},
std::array<float,2>{0.398633152f, 0.352778971f},
std::array<float,2>{0.608059943f, 0.601863384f},
std::array<float,2>{0.845770359f, 0.00179449411f},
std::array<float,2>{0.145497456f, 0.857787669f},
std::array<float,2>{0.0927392244f, 0.156447098f},
std::array<float,2>{0.994128942f, 0.88634485f},
std::array<float,2>{0.730581939f, 0.465981483f},
std::array<float,2>{0.316678047f, 0.673895776f},
std::array<float,2>{0.218102813f, 0.404809177f},
std::array<float,2>{0.787929773f, 0.737296522f},
std::array<float,2>{0.555142641f, 0.233498409f},
std::array<float,2>{0.49970299f, 0.962354839f},
std::array<float,2>{0.268057019f, 0.0712784752f},
std::array<float,2>{0.65952599f, 0.780802071f},
std::array<float,2>{0.886640787f, 0.265100867f},
std::array<float,2>{0.0449309237f, 0.553476155f},
std::array<float,2>{0.475643426f, 0.412702918f},
std::array<float,2>{0.535226107f, 0.689338982f},
std::array<float,2>{0.807752967f, 0.187781334f},
std::array<float,2>{0.189922258f, 0.995177865f},
std::array<float,2>{0.0604913756f, 0.116925687f},
std::array<float,2>{0.891067684f, 0.806693316f},
std::array<float,2>{0.685581565f, 0.300867885f},
std::array<float,2>{0.262204498f, 0.525069892f},
std::array<float,2>{0.131998986f, 0.341845572f},
std::array<float,2>{0.873889625f, 0.575199306f},
std::array<float,2>{0.616990745f, 0.0354177803f},
std::array<float,2>{0.386799544f, 0.842483759f},
std::array<float,2>{0.331127703f, 0.127913564f},
std::array<float,2>{0.734796107f, 0.917301476f},
std::array<float,2>{0.977764487f, 0.475044698f},
std::array<float,2>{0.0660529882f, 0.650068641f},
std::array<float,2>{0.292831838f, 0.271108508f},
std::array<float,2>{0.652194738f, 0.5347929f},
std::array<float,2>{0.936246991f, 0.090535f},
std::array<float,2>{0.0113190562f, 0.758503556f},
std::array<float,2>{0.234179348f, 0.24726668f},
std::array<float,2>{0.754510224f, 0.945844114f},
std::array<float,2>{0.522605717f, 0.386869133f},
std::array<float,2>{0.447768539f, 0.724544346f},
std::array<float,2>{0.118541121f, 0.442491025f},
std::array<float,2>{0.963694811f, 0.66217649f},
std::array<float,2>{0.712346435f, 0.183532014f},
std::array<float,2>{0.368404955f, 0.898195744f},
std::array<float,2>{0.408715457f, 0.019349901f},
std::array<float,2>{0.572662413f, 0.87224853f},
std::array<float,2>{0.824041247f, 0.371587694f},
std::array<float,2>{0.158662438f, 0.618004501f},
std::array<float,2>{0.311117828f, 0.468869001f},
std::array<float,2>{0.62953037f, 0.656087816f},
std::array<float,2>{0.920612812f, 0.13004373f},
std::array<float,2>{0.0246845465f, 0.920666218f},
std::array<float,2>{0.238783121f, 0.034524098f},
std::array<float,2>{0.770027041f, 0.836268604f},
std::array<float,2>{0.514494061f, 0.339134842f},
std::array<float,2>{0.457125455f, 0.573519468f},
std::array<float,2>{0.108904921f, 0.299574524f},
std::array<float,2>{0.949170291f, 0.527612269f},
std::array<float,2>{0.695368052f, 0.112728335f},
std::array<float,2>{0.352076441f, 0.81235677f},
std::array<float,2>{0.424518913f, 0.191530526f},
std::array<float,2>{0.585294783f, 0.996968389f},
std::array<float,2>{0.833431184f, 0.406466216f},
std::array<float,2>{0.181597307f, 0.692653358f},
std::array<float,2>{0.486335099f, 0.370801002f},
std::array<float,2>{0.55002588f, 0.621178985f},
std::array<float,2>{0.791006565f, 0.0226245578f},
std::array<float,2>{0.208711609f, 0.869209111f},
std::array<float,2>{0.0386663154f, 0.185500115f},
std::array<float,2>{0.876844764f, 0.890715361f},
std::array<float,2>{0.671550214f, 0.439300776f},
std::array<float,2>{0.278794259f, 0.65823251f},
std::array<float,2>{0.152356654f, 0.385060072f},
std::array<float,2>{0.85687089f, 0.72217226f},
std::array<float,2>{0.595982134f, 0.245174304f},
std::array<float,2>{0.396761f, 0.952106953f},
std::array<float,2>{0.32615599f, 0.0872472972f},
std::array<float,2>{0.723204672f, 0.763750911f},
std::array<float,2>{0.988652468f, 0.266935199f},
std::array<float,2>{0.0801782683f, 0.53552711f},
std::array<float,2>{0.376165181f, 0.423285216f},
std::array<float,2>{0.619803786f, 0.714223206f},
std::array<float,2>{0.861514747f, 0.203239813f},
std::array<float,2>{0.135996789f, 0.970462441f},
std::array<float,2>{0.0736999512f, 0.108849086f},
std::array<float,2>{0.973833621f, 0.796836972f},
std::array<float,2>{0.745423555f, 0.29580766f},
std::array<float,2>{0.338340193f, 0.505431831f},
std::array<float,2>{0.199632764f, 0.323395461f},
std::array<float,2>{0.799069524f, 0.590861201f},
std::array<float,2>{0.546279669f, 0.0554742403f},
std::array<float,2>{0.479906917f, 0.817076266f},
std::array<float,2>{0.254337788f, 0.144256771f},
std::array<float,2>{0.67398113f, 0.931161284f},
std::array<float,2>{0.89857775f, 0.493179113f},
std::array<float,2>{0.0516610742f, 0.632197261f},
std::array<float,2>{0.365239799f, 0.259849995f},
std::array<float,2>{0.708850026f, 0.547066867f},
std::array<float,2>{0.955532908f, 0.0748471096f},
std::array<float,2>{0.111184172f, 0.777101755f},
std::array<float,2>{0.169528544f, 0.228058398f},
std::array<float,2>{0.816036463f, 0.968209207f},
std::array<float,2>{0.566513777f, 0.402140945f},
std::array<float,2>{0.421330929f, 0.740626931f},
std::array<float,2>{0.00458728569f, 0.462469816f},
std::array<float,2>{0.927427113f, 0.678670824f},
std::array<float,2>{0.643818736f, 0.163544267f},
std::array<float,2>{0.286493182f, 0.889239848f},
std::array<float,2>{0.443444759f, 0.00494887354f},
std::array<float,2>{0.524765253f, 0.853964627f},
std::array<float,2>{0.762708843f, 0.358918995f},
std::array<float,2>{0.219377965f, 0.609065771f},
std::array<float,2>{0.335055232f, 0.395085156f},
std::array<float,2>{0.738629758f, 0.745387673f},
std::array<float,2>{0.981742084f, 0.221430406f},
std::array<float,2>{0.0682835951f, 0.955521643f},
std::array<float,2>{0.125881076f, 0.068810679f},
std::array<float,2>{0.869283259f, 0.770642936f},
std::array<float,2>{0.612548411f, 0.257179856f},
std::array<float,2>{0.385807216f, 0.555590808f},
std::array<float,2>{0.0583282039f, 0.346726388f},
std::array<float,2>{0.89703393f, 0.597587824f},
std::array<float,2>{0.681285679f, 0.0152296852f},
std::array<float,2>{0.260773867f, 0.847613275f},
std::array<float,2>{0.469284952f, 0.164349779f},
std::array<float,2>{0.533837616f, 0.881172657f},
std::array<float,2>{0.811442673f, 0.458833307f},
std::array<float,2>{0.195269793f, 0.679847181f},
std::array<float,2>{0.413760215f, 0.285948902f},
std::array<float,2>{0.577463984f, 0.508251965f},
std::array<float,2>{0.826013625f, 0.0993302986f},
std::array<float,2>{0.163616642f, 0.782256842f},
std::array<float,2>{0.123058483f, 0.214851171f},
std::array<float,2>{0.967888355f, 0.976626277f},
std::array<float,2>{0.716188848f, 0.437215328f},
std::array<float,2>{0.3718566f, 0.707827449f},
std::array<float,2>{0.229265049f, 0.487859666f},
std::array<float,2>{0.752116501f, 0.635950744f},
std::array<float,2>{0.516513646f, 0.154509827f},
std::array<float,2>{0.452127367f, 0.925415933f},
std::array<float,2>{0.293283045f, 0.0542906076f},
std::array<float,2>{0.655717432f, 0.822680235f},
std::array<float,2>{0.931519866f, 0.31427297f},
std::array<float,2>{0.0123529378f, 0.579337955f},
std::array<float,2>{0.468337297f, 0.45072186f},
std::array<float,2>{0.502882302f, 0.669382632f},
std::array<float,2>{0.778512001f, 0.177537203f},
std::array<float,2>{0.247471496f, 0.899447978f},
std::array<float,2>{0.0231914353f, 0.0293766577f},
std::array<float,2>{0.908939481f, 0.863964856f},
std::array<float,2>{0.638531744f, 0.361061513f},
std::array<float,2>{0.304504901f, 0.614480019f},
std::array<float,2>{0.177829057f, 0.279553175f},
std::array<float,2>{0.839961827f, 0.543919623f},
std::array<float,2>{0.58655405f, 0.0842600167f},
std::array<float,2>{0.433255613f, 0.753955901f},
std::array<float,2>{0.344721705f, 0.241359353f},
std::array<float,2>{0.692887723f, 0.940422356f},
std::array<float,2>{0.937713027f, 0.375741959f},
std::array<float,2>{0.0961346105f, 0.727499366f},
std::array<float,2>{0.273397535f, 0.334811181f},
std::array<float,2>{0.660928369f, 0.567973733f},
std::array<float,2>{0.889419019f, 0.041056294f},
std::array<float,2>{0.0421203934f, 0.832959294f},
std::array<float,2>{0.212338179f, 0.139113069f},
std::array<float,2>{0.781765699f, 0.913439929f},
std::array<float,2>{0.559615672f, 0.48231867f},
std::array<float,2>{0.496004641f, 0.640793502f},
std::array<float,2>{0.0886732936f, 0.416816682f},
std::array<float,2>{0.998188972f, 0.701143801f},
std::array<float,2>{0.728613615f, 0.199798927f},
std::array<float,2>{0.312874317f, 0.985960364f},
std::array<float,2>{0.40298906f, 0.12219812f},
std::array<float,2>{0.601805151f, 0.797197402f},
std::array<float,2>{0.847806334f, 0.308812916f},
std::array<float,2>{0.142726496f, 0.517967999f},
std::array<float,2>{0.262443095f, 0.410823256f},
std::array<float,2>{0.686383367f, 0.690868199f},
std::array<float,2>{0.891157269f, 0.189929992f},
std::array<float,2>{0.0595790148f, 0.992483497f},
std::array<float,2>{0.190259129f, 0.113445774f},
std::array<float,2>{0.808262348f, 0.805573225f},
std::array<float,2>{0.536033332f, 0.303607047f},
std::array<float,2>{0.476345837f, 0.525629401f},
std::array<float,2>{0.0659109503f, 0.340869695f},
std::array<float,2>{0.978435755f, 0.577857494f},
std::array<float,2>{0.734948874f, 0.0374911651f},
std::array<float,2>{0.331756413f, 0.839928269f},
std::array<float,2>{0.387561768f, 0.125914037f},
std::array<float,2>{0.616254747f, 0.915377736f},
std::array<float,2>{0.873412967f, 0.474271864f},
std::array<float,2>{0.13241896f, 0.651715398f},
std::array<float,2>{0.44732374f, 0.272786468f},
std::array<float,2>{0.523131251f, 0.532447755f},
std::array<float,2>{0.75435406f, 0.0927482694f},
std::array<float,2>{0.23382318f, 0.760473013f},
std::array<float,2>{0.0108828144f, 0.249284759f},
std::array<float,2>{0.935924768f, 0.948046386f},
std::array<float,2>{0.651393235f, 0.38941884f},
std::array<float,2>{0.292468339f, 0.725092053f},
std::array<float,2>{0.15917027f, 0.445055693f},
std::array<float,2>{0.823678315f, 0.661586046f},
std::array<float,2>{0.572995126f, 0.180322796f},
std::array<float,2>{0.408403039f, 0.896379173f},
std::array<float,2>{0.368776619f, 0.0157233607f},
std::array<float,2>{0.712540925f, 0.873143196f},
std::array<float,2>{0.963100672f, 0.374087214f},
std::array<float,2>{0.118934482f, 0.620098174f},
std::array<float,2>{0.434233308f, 0.499856204f},
std::array<float,2>{0.593729854f, 0.627294958f},
std::array<float,2>{0.836544335f, 0.147284165f},
std::array<float,2>{0.174822196f, 0.934038937f},
std::array<float,2>{0.100430876f, 0.0609079897f},
std::array<float,2>{0.942222774f, 0.814064085f},
std::array<float,2>{0.688559473f, 0.32596159f},
std::array<float,2>{0.34786734f, 0.588668942f},
std::array<float,2>{0.244531602f, 0.291876644f},
std::array<float,2>{0.775962234f, 0.500264525f},
std::array<float,2>{0.504442036f, 0.104478642f},
std::array<float,2>{0.462247938f, 0.789677441f},
std::array<float,2>{0.299312323f, 0.208536714f},
std::array<float,2>{0.635312378f, 0.975484371f},
std::array<float,2>{0.911652744f, 0.426326752f},
std::array<float,2>{0.01657038f, 0.717845201f},
std::array<float,2>{0.317235619f, 0.353625149f},
std::array<float,2>{0.731050193f, 0.60444206f},
std::array<float,2>{0.993563414f, 0.00325315166f},
std::array<float,2>{0.0921074897f, 0.856820047f},
std::array<float,2>{0.144963712f, 0.158650637f},
std::array<float,2>{0.846372426f, 0.884174287f},
std::array<float,2>{0.607607901f, 0.46762079f},
std::array<float,2>{0.399167359f, 0.672508538f},
std::array<float,2>{0.0454805829f, 0.403995961f},
std::array<float,2>{0.885784447f, 0.736020684f},
std::array<float,2>{0.660001516f, 0.232290789f},
std::array<float,2>{0.268478692f, 0.963676453f},
std::array<float,2>{0.499152541f, 0.072897099f},
std::array<float,2>{0.555405855f, 0.778863788f},
std::array<float,2>{0.78720516f, 0.26218012f},
std::array<float,2>{0.218546569f, 0.552619398f},
std::array<float,2>{0.356836617f, 0.455066025f},
std::array<float,2>{0.702516437f, 0.685290515f},
std::array<float,2>{0.951231182f, 0.169011921f},
std::array<float,2>{0.10423293f, 0.875000536f},
std::array<float,2>{0.183660135f, 0.0108077107f},
std::array<float,2>{0.830054402f, 0.851136148f},
std::array<float,2>{0.58004272f, 0.350846678f},
std::array<float,2>{0.426329195f, 0.59928757f},
std::array<float,2>{0.0279925056f, 0.252339751f},
std::array<float,2>{0.914307952f, 0.5598014f},
std::array<float,2>{0.625892758f, 0.0643547624f},
std::array<float,2>{0.305288881f, 0.766794682f},
std::array<float,2>{0.454518884f, 0.224625349f},
std::array<float,2>{0.511087418f, 0.960108042f},
std::array<float,2>{0.767568707f, 0.390720844f},
std::array<float,2>{0.235990182f, 0.746836483f},
std::array<float,2>{0.394269198f, 0.316472471f},
std::array<float,2>{0.601177394f, 0.58520484f},
std::array<float,2>{0.85498935f, 0.0474753119f},
std::array<float,2>{0.149613589f, 0.826273263f},
std::array<float,2>{0.082934998f, 0.149625152f},
std::array<float,2>{0.987109721f, 0.929257691f},
std::array<float,2>{0.721438646f, 0.489888489f},
std::array<float,2>{0.322160304f, 0.638979137f},
std::array<float,2>{0.204843059f, 0.432472795f},
std::array<float,2>{0.795502245f, 0.703444481f},
std::array<float,2>{0.552625418f, 0.212065324f},
std::array<float,2>{0.489074796f, 0.983737946f},
std::array<float,2>{0.276442915f, 0.0969605595f},
std::array<float,2>{0.666121304f, 0.787854612f},
std::array<float,2>{0.881473184f, 0.282414615f},
std::array<float,2>{0.033883132f, 0.512077987f},
std::array<float,2>{0.482238173f, 0.382465541f},
std::array<float,2>{0.539867997f, 0.732636869f},
std::array<float,2>{0.801715612f, 0.234414414f},
std::array<float,2>{0.197561204f, 0.944627404f},
std::array<float,2>{0.0493404828f, 0.0805283412f},
std::array<float,2>{0.904337525f, 0.75241065f},
std::array<float,2>{0.679222524f, 0.274939984f},
std::array<float,2>{0.251909405f, 0.539492726f},
std::array<float,2>{0.140306115f, 0.367066145f},
std::array<float,2>{0.866517186f, 0.612910271f},
std::array<float,2>{0.622896731f, 0.0257710461f},
std::array<float,2>{0.380927265f, 0.859400332f},
std::array<float,2>{0.342861772f, 0.173066705f},
std::array<float,2>{0.747388542f, 0.9037624f},
std::array<float,2>{0.970961869f, 0.448624045f},
std::array<float,2>{0.0779717937f, 0.666380286f},
std::array<float,2>{0.283822328f, 0.304793447f},
std::array<float,2>{0.64823401f, 0.523145914f},
std::array<float,2>{0.922641098f, 0.117422126f},
std::array<float,2>{0.00240748492f, 0.801853836f},
std::array<float,2>{0.226209134f, 0.198837638f},
std::array<float,2>{0.758531451f, 0.991869152f},
std::array<float,2>{0.529015005f, 0.418160588f},
std::array<float,2>{0.440518677f, 0.695319474f},
std::array<float,2>{0.117155939f, 0.477639169f},
std::array<float,2>{0.957361937f, 0.644868791f},
std::array<float,2>{0.705858529f, 0.135647595f},
std::array<float,2>{0.362607718f, 0.909611225f},
std::array<float,2>{0.41509676f, 0.0430527292f},
std::array<float,2>{0.566308439f, 0.83157593f},
std::array<float,2>{0.817174971f, 0.330002606f},
std::array<float,2>{0.16750057f, 0.56284517f},
std::array<float,2>{0.281224161f, 0.440953612f},
std::array<float,2>{0.669866562f, 0.657421708f},
std::array<float,2>{0.87745744f, 0.187314048f},
std::array<float,2>{0.0363414511f, 0.894036353f},
std::array<float,2>{0.209233418f, 0.021106882f},
std::array<float,2>{0.792868495f, 0.867885113f},
std::array<float,2>{0.548144579f, 0.36763975f},
std::array<float,2>{0.484671175f, 0.624020934f},
std::array<float,2>{0.0781261325f, 0.268063396f},
std::array<float,2>{0.990946889f, 0.53877455f},
std::array<float,2>{0.726227045f, 0.0886946991f},
std::array<float,2>{0.327730685f, 0.762056589f},
std::array<float,2>{0.395418882f, 0.243511677f},
std::array<float,2>{0.594592273f, 0.950166702f},
std::array<float,2>{0.8579337f, 0.383964509f},
std::array<float,2>{0.15594992f, 0.720274746f},
std::array<float,2>{0.460338533f, 0.337662369f},
std::array<float,2>{0.513617635f, 0.571397245f},
std::array<float,2>{0.773347616f, 0.031529054f},
std::array<float,2>{0.241013765f, 0.838801801f},
std::array<float,2>{0.0272999648f, 0.132647052f},
std::array<float,2>{0.918143868f, 0.919559419f},
std::array<float,2>{0.632100999f, 0.471434444f},
std::array<float,2>{0.310492933f, 0.653209746f},
std::array<float,2>{0.18216686f, 0.409886301f},
std::array<float,2>{0.834362924f, 0.695125103f},
std::array<float,2>{0.582338095f, 0.193798602f},
std::array<float,2>{0.422203332f, 0.998907745f},
std::array<float,2>{0.354447037f, 0.109956957f},
std::array<float,2>{0.697937727f, 0.810193956f},
std::array<float,2>{0.947048664f, 0.298652917f},
std::array<float,2>{0.106504537f, 0.529657602f},
std::array<float,2>{0.419874042f, 0.400068462f},
std::array<float,2>{0.569411099f, 0.73963964f},
std::array<float,2>{0.812858403f, 0.230455831f},
std::array<float,2>{0.171268851f, 0.964977026f},
std::array<float,2>{0.112730518f, 0.0778895095f},
std::array<float,2>{0.954340279f, 0.77367878f},
std::array<float,2>{0.71005553f, 0.258461952f},
std::array<float,2>{0.364020467f, 0.549086869f},
std::array<float,2>{0.221220419f, 0.35565725f},
std::array<float,2>{0.764659107f, 0.607242525f},
std::array<float,2>{0.526040792f, 0.00701826392f},
std::array<float,2>{0.443145722f, 0.853347063f},
std::array<float,2>{0.289029002f, 0.160211474f},
std::array<float,2>{0.642211139f, 0.888284743f},
std::array<float,2>{0.929608107f, 0.463604748f},
std::array<float,2>{0.00753726996f, 0.676798224f},
std::array<float,2>{0.336220562f, 0.293047726f},
std::array<float,2>{0.742655277f, 0.506106794f},
std::array<float,2>{0.975987673f, 0.10673891f},
std::array<float,2>{0.071807459f, 0.793296099f},
std::array<float,2>{0.134206608f, 0.205960929f},
std::array<float,2>{0.860159397f, 0.971231461f},
std::array<float,2>{0.618066907f, 0.424219012f},
std::array<float,2>{0.377871662f, 0.712445617f},
std::array<float,2>{0.0539606623f, 0.494994313f},
std::array<float,2>{0.901296616f, 0.630055428f},
std::array<float,2>{0.672812521f, 0.142304078f},
std::array<float,2>{0.257438153f, 0.93282032f},
std::array<float,2>{0.477716178f, 0.0580720715f},
std::array<float,2>{0.544103801f, 0.819321394f},
std::array<float,2>{0.797318816f, 0.320614964f},
std::array<float,2>{0.201900512f, 0.592922509f},
std::array<float,2>{0.373923808f, 0.433794916f},
std::array<float,2>{0.717631817f, 0.709201753f},
std::array<float,2>{0.966022491f, 0.21807763f},
std::array<float,2>{0.122753523f, 0.978936911f},
std::array<float,2>{0.160517931f, 0.100892864f},
std::array<float,2>{0.827242911f, 0.783758283f},
std::array<float,2>{0.575947464f, 0.288617551f},
std::array<float,2>{0.410892129f, 0.510097086f},
std::array<float,2>{0.015496687f, 0.316217273f},
std::array<float,2>{0.931942761f, 0.580725431f},
std::array<float,2>{0.65252167f, 0.050887946f},
std::array<float,2>{0.295424968f, 0.820503175f},
std::array<float,2>{0.449734747f, 0.153073877f},
std::array<float,2>{0.518581688f, 0.92310071f},
std::array<float,2>{0.751932025f, 0.484657735f},
std::array<float,2>{0.226732627f, 0.633421004f},
std::array<float,2>{0.383207917f, 0.254261464f},
std::array<float,2>{0.610828578f, 0.556955636f},
std::array<float,2>{0.869056582f, 0.0673410073f},
std::array<float,2>{0.127478823f, 0.772121549f},
std::array<float,2>{0.0684624463f, 0.220593467f},
std::array<float,2>{0.983425498f, 0.953950286f},
std::array<float,2>{0.740528941f, 0.397714049f},
std::array<float,2>{0.333066195f, 0.742566407f},
std::array<float,2>{0.191862151f, 0.460511774f},
std::array<float,2>{0.810312688f, 0.683515429f},
std::array<float,2>{0.531695485f, 0.166349813f},
std::array<float,2>{0.471009284f, 0.880485535f},
std::array<float,2>{0.25918299f, 0.0126196761f},
std::array<float,2>{0.68282479f, 0.844810009f},
std::array<float,2>{0.896013379f, 0.345263362f},
std::array<float,2>{0.055379305f, 0.594098687f},
std::array<float,2>{0.492592216f, 0.482431084f},
std::array<float,2>{0.562435865f, 0.643938124f},
std::array<float,2>{0.784044743f, 0.138223708f},
std::array<float,2>{0.21405755f, 0.910196066f},
std::array<float,2>{0.0404093638f, 0.0406196602f},
std::array<float,2>{0.887301683f, 0.835481644f},
std::array<float,2>{0.663230479f, 0.332054526f},
std::array<float,2>{0.269663692f, 0.568679452f},
std::array<float,2>{0.140660405f, 0.310978711f},
std::array<float,2>{0.851509392f, 0.516653478f},
std::array<float,2>{0.603961885f, 0.124717183f},
std::array<float,2>{0.405756831f, 0.79970932f},
std::array<float,2>{0.315292746f, 0.202600047f},
std::array<float,2>{0.727365553f, 0.987004519f},
std::array<float,2>{0.996656418f, 0.41522342f},
std::array<float,2>{0.0860235319f, 0.702106237f},
std::array<float,2>{0.301582307f, 0.36266309f},
std::array<float,2>{0.640276432f, 0.615788758f},
std::array<float,2>{0.907428145f, 0.0279071387f},
std::array<float,2>{0.0197281446f, 0.865872741f},
std::array<float,2>{0.248811945f, 0.178835392f},
std::array<float,2>{0.779685915f, 0.901408911f},
std::array<float,2>{0.501567543f, 0.452079326f},
std::array<float,2>{0.464974582f, 0.671135187f},
std::array<float,2>{0.0945490822f, 0.377717316f},
std::array<float,2>{0.940508962f, 0.728898287f},
std::array<float,2>{0.695115626f, 0.2393547f},
std::array<float,2>{0.347079426f, 0.938103616f},
std::array<float,2>{0.430454373f, 0.0831366554f},
std::array<float,2>{0.588771105f, 0.75618118f},
std::array<float,2>{0.842078447f, 0.27735886f},
std::array<float,2>{0.176379725f, 0.546186805f},
std::array<float,2>{0.289172173f, 0.387585908f},
std::array<float,2>{0.649839997f, 0.724010944f},
std::array<float,2>{0.934887409f, 0.247749418f},
std::array<float,2>{0.009688491f, 0.945589721f},
std::array<float,2>{0.230554551f, 0.0899313018f},
std::array<float,2>{0.756726265f, 0.758195698f},
std::array<float,2>{0.521040201f, 0.270520091f},
std::array<float,2>{0.447115511f, 0.53429395f},
std::array<float,2>{0.120279975f, 0.371214271f},
std::array<float,2>{0.96268791f, 0.617626727f},
std::array<float,2>{0.713249803f, 0.0189281236f},
std::array<float,2>{0.370054036f, 0.872978508f},
std::array<float,2>{0.407767892f, 0.18283163f},
std::array<float,2>{0.571025431f, 0.897519767f},
std::array<float,2>{0.82151866f, 0.442980468f},
std::array<float,2>{0.157840207f, 0.662799656f},
std::array<float,2>{0.473343909f, 0.301445484f},
std::array<float,2>{0.538989723f, 0.524455011f},
std::array<float,2>{0.805560589f, 0.116373263f},
std::array<float,2>{0.187974975f, 0.807191432f},
std::array<float,2>{0.0618468001f, 0.188384801f},
std::array<float,2>{0.894508839f, 0.995823383f},
std::array<float,2>{0.684034169f, 0.412572205f},
std::array<float,2>{0.264771372f, 0.688759327f},
std::array<float,2>{0.128934786f, 0.475550532f},
std::array<float,2>{0.872205317f, 0.649653554f},
std::array<float,2>{0.614223599f, 0.127433181f},
std::array<float,2>{0.390433908f, 0.917827427f},
std::array<float,2>{0.329137534f, 0.0360473655f},
std::array<float,2>{0.73717159f, 0.841880202f},
std::array<float,2>{0.979544103f, 0.342605025f},
std::array<float,2>{0.0633664951f, 0.575989723f},
std::array<float,2>{0.401976019f, 0.466388434f},
std::array<float,2>{0.606561542f, 0.674767613f},
std::array<float,2>{0.843859076f, 0.156931043f},
std::array<float,2>{0.1473995f, 0.885852337f},
std::array<float,2>{0.09005218f, 0.00114143139f},
std::array<float,2>{0.995270967f, 0.857958555f},
std::array<float,2>{0.733231485f, 0.35311839f},
std::array<float,2>{0.319409281f, 0.602383196f},
std::array<float,2>{0.216136277f, 0.265305698f},
std::array<float,2>{0.786232769f, 0.553121388f},
std::array<float,2>{0.556728661f, 0.0707146451f},
std::array<float,2>{0.497392535f, 0.780754983f},
std::array<float,2>{0.266840428f, 0.233986363f},
std::array<float,2>{0.656476498f, 0.962815404f},
std::array<float,2>{0.88290602f, 0.404720485f},
std::array<float,2>{0.0438940488f, 0.736530423f},
std::array<float,2>{0.350657672f, 0.32656306f},
std::array<float,2>{0.689693987f, 0.587507367f},
std::array<float,2>{0.944115102f, 0.0592323728f},
std::array<float,2>{0.0983472466f, 0.815350652f},
std::array<float,2>{0.173741505f, 0.14551045f},
std::array<float,2>{0.83978045f, 0.936432302f},
std::array<float,2>{0.590664983f, 0.497436911f},
std::array<float,2>{0.437453002f, 0.625675976f},
std::array<float,2>{0.0180538669f, 0.428123236f},
std::array<float,2>{0.912770748f, 0.716424048f},
std::array<float,2>{0.634704292f, 0.20956029f},
std::array<float,2>{0.297075897f, 0.974195123f},
std::array<float,2>{0.464027286f, 0.102890536f},
std::array<float,2>{0.507663667f, 0.792960465f},
std::array<float,2>{0.774043441f, 0.290042937f},
std::array<float,2>{0.243579477f, 0.503860176f},
std::array<float,2>{0.322999954f, 0.492152512f},
std::array<float,2>{0.720225155f, 0.63846606f},
std::array<float,2>{0.986007452f, 0.151558399f},
std::array<float,2>{0.0848577172f, 0.926822126f},
std::array<float,2>{0.150416315f, 0.0502353199f},
std::array<float,2>{0.851741254f, 0.825739861f},
std::array<float,2>{0.599449694f, 0.319497555f},
std::array<float,2>{0.39100796f, 0.582542002f},
std::array<float,2>{0.0318511166f, 0.284459203f},
std::array<float,2>{0.880383849f, 0.514368594f},
std::array<float,2>{0.664788783f, 0.0944326371f},
std::array<float,2>{0.273728639f, 0.786506355f},
std::array<float,2>{0.491748661f, 0.214490965f},
std::array<float,2>{0.553551257f, 0.980692506f},
std::array<float,2>{0.793106496f, 0.430000365f},
std::array<float,2>{0.206854701f, 0.706953466f},
std::array<float,2>{0.428883851f, 0.348907411f},
std::array<float,2>{0.580887079f, 0.600710452f},
std::array<float,2>{0.831690669f, 0.00798787363f},
std::array<float,2>{0.186997816f, 0.849187434f},
std::array<float,2>{0.10294766f, 0.171823591f},
std::array<float,2>{0.949672639f, 0.878177762f},
std::array<float,2>{0.701164544f, 0.455742955f},
std::array<float,2>{0.358242452f, 0.686061382f},
std::array<float,2>{0.236516118f, 0.393410385f},
std::array<float,2>{0.768510163f, 0.748466909f},
std::array<float,2>{0.508318901f, 0.223853528f},
std::array<float,2>{0.455752969f, 0.958485007f},
std::array<float,2>{0.307173491f, 0.065552935f},
std::array<float,2>{0.628670156f, 0.769123673f},
std::array<float,2>{0.917374432f, 0.250534385f},
std::array<float,2>{0.0302340034f, 0.561469436f},
std::array<float,2>{0.438087016f, 0.420796126f},
std::array<float,2>{0.529353261f, 0.697682142f},
std::array<float,2>{0.761674523f, 0.196540356f},
std::array<float,2>{0.22380653f, 0.990133464f},
std::array<float,2>{0.000557274965f, 0.119684704f},
std::array<float,2>{0.924950063f, 0.803240776f},
std::array<float,2>{0.645612717f, 0.307734489f},
std::array<float,2>{0.282080948f, 0.520632029f},
std::array<float,2>{0.165989891f, 0.331093669f},
std::array<float,2>{0.818579972f, 0.565761387f},
std::array<float,2>{0.563856065f, 0.0461914688f},
std::array<float,2>{0.416377068f, 0.829013109f},
std::array<float,2>{0.35961172f, 0.133413836f},
std::array<float,2>{0.703564763f, 0.907528996f},
std::array<float,2>{0.960294902f, 0.479035079f},
std::array<float,2>{0.113328375f, 0.648242652f},
std::array<float,2>{0.252526522f, 0.27706629f},
std::array<float,2>{0.676226258f, 0.541261911f},
std::array<float,2>{0.903989494f, 0.0792517066f},
std::array<float,2>{0.0470706001f, 0.750727057f},
std::array<float,2>{0.196375549f, 0.236329198f},
std::array<float,2>{0.80378741f, 0.942456782f},
std::array<float,2>{0.542471945f, 0.379423022f},
std::array<float,2>{0.484332263f, 0.730609298f},
std::array<float,2>{0.0745865256f, 0.446104586f},
std::array<float,2>{0.970470071f, 0.665967345f},
std::array<float,2>{0.74897939f, 0.175466329f},
std::array<float,2>{0.340277404f, 0.905606806f},
std::array<float,2>{0.380792499f, 0.0242994763f},
std::array<float,2>{0.624550223f, 0.861885428f},
std::array<float,2>{0.863322377f, 0.364526629f},
std::array<float,2>{0.136842623f, 0.610825121f},
std::array<float,2>{0.256297708f, 0.493143857f},
std::array<float,2>{0.673308909f, 0.631299615f},
std::array<float,2>{0.901927233f, 0.143361062f},
std::array<float,2>{0.0535181649f, 0.930045843f},
std::array<float,2>{0.202205881f, 0.0560609624f},
std::array<float,2>{0.798752844f, 0.817852437f},
std::array<float,2>{0.543028951f, 0.323014528f},
std::array<float,2>{0.476685107f, 0.589924037f},
std::array<float,2>{0.0703178719f, 0.296213597f},
std::array<float,2>{0.97552669f, 0.504665554f},
std::array<float,2>{0.743361413f, 0.10799925f},
std::array<float,2>{0.337080866f, 0.794945002f},
std::array<float,2>{0.378801495f, 0.205024853f},
std::array<float,2>{0.61841464f, 0.969103217f},
std::array<float,2>{0.860635579f, 0.422162145f},
std::array<float,2>{0.133567229f, 0.713584542f},
std::array<float,2>{0.441577882f, 0.357670873f},
std::array<float,2>{0.52665329f, 0.607658803f},
std::array<float,2>{0.763891816f, 0.00455625588f},
std::array<float,2>{0.221701697f, 0.854834974f},
std::array<float,2>{0.00677640364f, 0.162241131f},
std::array<float,2>{0.928621292f, 0.889712095f},
std::array<float,2>{0.641325831f, 0.461026102f},
std::array<float,2>{0.287464917f, 0.678928971f},
std::array<float,2>{0.170834035f, 0.401164562f},
std::array<float,2>{0.814448655f, 0.742008686f},
std::array<float,2>{0.569307089f, 0.227170318f},
std::array<float,2>{0.41798231f, 0.966853917f},
std::array<float,2>{0.364609212f, 0.075955838f},
std::array<float,2>{0.709087133f, 0.776340723f},
std::array<float,2>{0.953736544f, 0.261085272f},
std::array<float,2>{0.111364752f, 0.548397422f},
std::array<float,2>{0.42308858f, 0.407639921f},
std::array<float,2>{0.583391249f, 0.691867054f},
std::array<float,2>{0.835227907f, 0.193213195f},
std::array<float,2>{0.183039874f, 0.997517645f},
std::array<float,2>{0.105847806f, 0.111361936f},
std::array<float,2>{0.946202934f, 0.811067045f},
std::array<float,2>{0.698805749f, 0.300154746f},
std::array<float,2>{0.355189115f, 0.528679073f},
std::array<float,2>{0.241762161f, 0.338510662f},
std::array<float,2>{0.771894157f, 0.572444856f},
std::array<float,2>{0.512683034f, 0.0339927673f},
std::array<float,2>{0.459100962f, 0.837282002f},
std::array<float,2>{0.309294969f, 0.129086956f},
std::array<float,2>{0.631669998f, 0.921487272f},
std::array<float,2>{0.919561446f, 0.470009804f},
std::array<float,2>{0.0254936498f, 0.654575586f},
std::array<float,2>{0.326848924f, 0.266509533f},
std::array<float,2>{0.725142419f, 0.536633193f},
std::array<float,2>{0.991518259f, 0.0859401897f},
std::array<float,2>{0.0797826797f, 0.764969468f},
std::array<float,2>{0.154722631f, 0.244814411f},
std::array<float,2>{0.858415961f, 0.952577114f},
std::array<float,2>{0.595009148f, 0.38664645f},
std::array<float,2>{0.395950496f, 0.721327126f},
std::array<float,2>{0.0360471122f, 0.437887937f},
std::array<float,2>{0.87836802f, 0.660084486f},
std::array<float,2>{0.668459654f, 0.183979794f},
std::array<float,2>{0.280121535f, 0.892191887f},
std::array<float,2>{0.485447377f, 0.0222509503f},
std::array<float,2>{0.547605455f, 0.870353162f},
std::array<float,2>{0.791140497f, 0.370003223f},
std::array<float,2>{0.210204765f, 0.62223506f},
std::array<float,2>{0.346223265f, 0.376878023f},
std::array<float,2>{0.69387573f, 0.728093505f},
std::array<float,2>{0.940306246f, 0.240917668f},
std::array<float,2>{0.0947988704f, 0.941314459f},
std::array<float,2>{0.177089885f, 0.0856864303f},
std::array<float,2>{0.842884123f, 0.755449891f},
std::array<float,2>{0.58943224f, 0.280810416f},
std::array<float,2>{0.431121916f, 0.544200003f},
std::array<float,2>{0.0214311089f, 0.359444141f},
std::array<float,2>{0.906927884f, 0.613917232f},
std::array<float,2>{0.639394045f, 0.0304676723f},
std::array<float,2>{0.302411169f, 0.864731431f},
std::array<float,2>{0.46626693f, 0.175886452f},
std::array<float,2>{0.500678003f, 0.898526728f},
std::array<float,2>{0.780912578f, 0.449973851f},
std::array<float,2>{0.249849349f, 0.668612719f},
std::array<float,2>{0.404830456f, 0.309731752f},
std::array<float,2>{0.604674876f, 0.519340992f},
std::array<float,2>{0.85054487f, 0.121958785f},
std::array<float,2>{0.142136365f, 0.798750103f},
std::array<float,2>{0.0875171497f, 0.200503901f},
std::array<float,2>{0.998040318f, 0.984829783f},
std::array<float,2>{0.727569997f, 0.41796279f},
std::array<float,2>{0.316338211f, 0.699539542f},
std::array<float,2>{0.213548288f, 0.481069595f},
std::array<float,2>{0.785062432f, 0.642352641f},
std::array<float,2>{0.561064124f, 0.139831379f},
std::array<float,2>{0.494031042f, 0.91258651f},
std::array<float,2>{0.270738751f, 0.0423393212f},
std::array<float,2>{0.662879646f, 0.833433151f},
std::array<float,2>{0.888190806f, 0.335431337f},
std::array<float,2>{0.0392388441f, 0.567246079f},
std::array<float,2>{0.471709579f, 0.457940876f},
std::array<float,2>{0.532492518f, 0.680797875f},
std::array<float,2>{0.808869004f, 0.165732488f},
std::array<float,2>{0.193162352f, 0.882065237f},
std::array<float,2>{0.0559875108f, 0.0141797857f},
std::array<float,2>{0.895196617f, 0.846667409f},
std::array<float,2>{0.682177901f, 0.346535206f},
std::array<float,2>{0.258366764f, 0.596674681f},
std::array<float,2>{0.128847525f, 0.256747872f},
std::array<float,2>{0.868116617f, 0.556485236f},
std::array<float,2>{0.609696984f, 0.069545947f},
std::array<float,2>{0.384286076f, 0.77033186f},
std::array<float,2>{0.332406074f, 0.221769705f},
std::array<float,2>{0.742104173f, 0.95673722f},
std::array<float,2>{0.983336031f, 0.396382898f},
std::array<float,2>{0.0696720928f, 0.744993329f},
std::array<float,2>{0.296603918f, 0.313328505f},
std::array<float,2>{0.653330028f, 0.578195691f},
std::array<float,2>{0.933001518f, 0.0529278107f},
std::array<float,2>{0.0139833307f, 0.823877275f},
std::array<float,2>{0.227926195f, 0.155997366f},
std::array<float,2>{0.750735939f, 0.924242496f},
std::array<float,2>{0.518355608f, 0.487197369f},
std::array<float,2>{0.450989813f, 0.635021448f},
std::array<float,2>{0.121743366f, 0.435706824f},
std::array<float,2>{0.965524495f, 0.708834827f},
std::array<float,2>{0.718189597f, 0.215938449f},
std::array<float,2>{0.374085218f, 0.978424907f},
std::array<float,2>{0.412100881f, 0.0978178382f},
std::array<float,2>{0.574868679f, 0.782136321f},
std::array<float,2>{0.826708078f, 0.286177397f},
std::array<float,2>{0.161499262f, 0.509431899f},
std::array<float,2>{0.298081189f, 0.427477479f},
std::array<float,2>{0.633144915f, 0.717386782f},
std::array<float,2>{0.913406551f, 0.207087085f},
std::array<float,2>{0.0194697157f, 0.976285756f},
std::array<float,2>{0.242708161f, 0.104504481f},
std::array<float,2>{0.774549901f, 0.790163279f},
std::array<float,2>{0.506268203f, 0.292190105f},
std::array<float,2>{0.463528454f, 0.501638353f},
std::array<float,2>{0.0988241509f, 0.324969649f},
std::array<float,2>{0.944984555f, 0.589358866f},
std::array<float,2>{0.691230774f, 0.0624781214f},
std::array<float,2>{0.350010484f, 0.812962234f},
std::array<float,2>{0.43589589f, 0.147479311f},
std::array<float,2>{0.590853274f, 0.935542345f},
std::array<float,2>{0.837923169f, 0.498514384f},
std::array<float,2>{0.172245339f, 0.628082097f},
std::array<float,2>{0.496436536f, 0.263095409f},
std::array<float,2>{0.55858171f, 0.551399291f},
std::array<float,2>{0.785789609f, 0.0733722225f},
std::array<float,2>{0.215369239f, 0.777941167f},
std::array<float,2>{0.044692263f, 0.230480537f},
std::array<float,2>{0.883953929f, 0.964231133f},
std::array<float,2>{0.657767117f, 0.402868032f},
std::array<float,2>{0.266412884f, 0.734462678f},
std::array<float,2>{0.148174673f, 0.467880934f},
std::array<float,2>{0.844952524f, 0.673355281f},
std::array<float,2>{0.606431305f, 0.160090789f},
std::array<float,2>{0.400402069f, 0.883062541f},
std::array<float,2>{0.319297671f, 0.0020082132f},
std::array<float,2>{0.733521163f, 0.856130064f},
std::array<float,2>{0.994271696f, 0.354654461f},
std::array<float,2>{0.0912733525f, 0.605261683f},
std::array<float,2>{0.389202833f, 0.472900748f},
std::array<float,2>{0.615019441f, 0.651224554f},
std::array<float,2>{0.871908545f, 0.126297072f},
std::array<float,2>{0.130533338f, 0.914272368f},
std::array<float,2>{0.0639698878f, 0.0385567136f},
std::array<float,2>{0.979353845f, 0.841300666f},
std::array<float,2>{0.738168299f, 0.340094179f},
std::array<float,2>{0.329073638f, 0.577023625f},
std::array<float,2>{0.189063296f, 0.304179847f},
std::array<float,2>{0.805685401f, 0.526489496f},
std::array<float,2>{0.537858129f, 0.114865236f},
std::array<float,2>{0.473905861f, 0.806299746f},
std::array<float,2>{0.264494538f, 0.191366538f},
std::array<float,2>{0.685205817f, 0.994033575f},
std::array<float,2>{0.893514931f, 0.411990166f},
std::array<float,2>{0.0614772588f, 0.689617932f},
std::array<float,2>{0.370627731f, 0.373514056f},
std::array<float,2>{0.714193285f, 0.620271027f},
std::array<float,2>{0.96118629f, 0.0166571196f},
std::array<float,2>{0.119767457f, 0.874800742f},
std::array<float,2>{0.156643093f, 0.180953383f},
std::array<float,2>{0.820579052f, 0.894792974f},
std::array<float,2>{0.571503878f, 0.443903267f},
std::array<float,2>{0.406662315f, 0.660524011f},
std::array<float,2>{0.00862300582f, 0.390226722f},
std::array<float,2>{0.933627605f, 0.726125538f},
std::array<float,2>{0.649401188f, 0.248064443f},
std::array<float,2>{0.290231854f, 0.94912976f},
std::array<float,2>{0.44538632f, 0.0936838016f},
std::array<float,2>{0.520096362f, 0.760881543f},
std::array<float,2>{0.75696826f, 0.271509945f},
std::array<float,2>{0.231483608f, 0.531980693f},
std::array<float,2>{0.341077358f, 0.447525233f},
std::array<float,2>{0.74902904f, 0.667173505f},
std::array<float,2>{0.969512522f, 0.172240719f},
std::array<float,2>{0.0758761764f, 0.902486622f},
std::array<float,2>{0.137984529f, 0.0267383549f},
std::array<float,2>{0.864550471f, 0.861278713f},
std::array<float,2>{0.623874485f, 0.365677476f},
std::array<float,2>{0.379818439f, 0.61187005f},
std::array<float,2>{0.0485281125f, 0.273731947f},
std::array<float,2>{0.902519822f, 0.540863931f},
std::array<float,2>{0.676864386f, 0.0814401209f},
std::array<float,2>{0.253546536f, 0.75329572f},
std::array<float,2>{0.482687861f, 0.235594347f},
std::array<float,2>{0.541535854f, 0.944082916f},
std::array<float,2>{0.802796781f, 0.381377935f},
std::array<float,2>{0.195539758f, 0.734002411f},
std::array<float,2>{0.41785863f, 0.328760326f},
std::array<float,2>{0.563395321f, 0.563767552f},
std::array<float,2>{0.819443464f, 0.0439866446f},
std::array<float,2>{0.164670274f, 0.830086231f},
std::array<float,2>{0.114794761f, 0.135924742f},
std::array<float,2>{0.959923923f, 0.908213794f},
std::array<float,2>{0.704876959f, 0.476647854f},
std::array<float,2>{0.361276746f, 0.645895064f},
std::array<float,2>{0.222997695f, 0.419236988f},
std::array<float,2>{0.760200679f, 0.696991086f},
std::array<float,2>{0.530303657f, 0.197616577f},
std::array<float,2>{0.439386904f, 0.990607619f},
std::array<float,2>{0.282453477f, 0.11851722f},
std::array<float,2>{0.645365179f, 0.801055849f},
std::array<float,2>{0.924065113f, 0.305711001f},
std::array<float,2>{0.00194545707f, 0.522232771f},
std::array<float,2>{0.456511497f, 0.391619116f},
std::array<float,2>{0.509152472f, 0.747387767f},
std::array<float,2>{0.769222379f, 0.225924045f},
std::array<float,2>{0.237644076f, 0.959669888f},
std::array<float,2>{0.0303897336f, 0.0630976111f},
std::array<float,2>{0.916644335f, 0.76583904f},
std::array<float,2>{0.627156317f, 0.253849983f},
std::array<float,2>{0.30848828f, 0.559092939f},
std::array<float,2>{0.186513528f, 0.349866837f},
std::array<float,2>{0.830441594f, 0.597807467f},
std::array<float,2>{0.581571639f, 0.0102821225f},
std::array<float,2>{0.427862138f, 0.849995255f},
std::array<float,2>{0.358507007f, 0.168329433f},
std::array<float,2>{0.699669659f, 0.876921058f},
std::array<float,2>{0.950269699f, 0.453489363f},
std::array<float,2>{0.101996697f, 0.683983743f},
std::array<float,2>{0.275310278f, 0.281899422f},
std::array<float,2>{0.665473819f, 0.513507307f},
std::array<float,2>{0.879093051f, 0.0965050906f},
std::array<float,2>{0.032746572f, 0.788871109f},
std::array<float,2>{0.205455884f, 0.211831659f},
std::array<float,2>{0.794485748f, 0.982769549f},
std::array<float,2>{0.554109931f, 0.432878613f},
std::array<float,2>{0.490458131f, 0.705021739f},
std::array<float,2>{0.0858552828f, 0.489028573f},
std::array<float,2>{0.984943092f, 0.639725268f},
std::array<float,2>{0.719695866f, 0.14857924f},
std::array<float,2>{0.323852628f, 0.928636909f},
std::array<float,2>{0.392063648f, 0.0478994288f},
std::array<float,2>{0.598125279f, 0.827291608f},
std::array<float,2>{0.852788448f, 0.317471474f},
std::array<float,2>{0.151509762f, 0.584602952f},
std::array<float,2>{0.286048025f, 0.463923305f},
std::array<float,2>{0.642943084f, 0.676638246f},
std::array<float,2>{0.926567316f, 0.161494166f},
std::array<float,2>{0.00579541922f, 0.887605667f},
std::array<float,2>{0.220454872f, 0.00652057258f},
std::array<float,2>{0.762607872f, 0.852218628f},
std::array<float,2>{0.52429682f, 0.357150376f},
std::array<float,2>{0.445090681f, 0.6059376f},
std::array<float,2>{0.109464802f, 0.259063542f},
std::array<float,2>{0.956783056f, 0.549923062f},
std::array<float,2>{0.707121551f, 0.0762877986f},
std::array<float,2>{0.366810232f, 0.775170565f},
std::array<float,2>{0.420203835f, 0.228591397f},
std::array<float,2>{0.568110228f, 0.966311336f},
std::array<float,2>{0.814988434f, 0.39899078f},
std::array<float,2>{0.16817145f, 0.738991976f},
std::array<float,2>{0.478914827f, 0.321706206f},
std::array<float,2>{0.545173287f, 0.592593253f},
std::array<float,2>{0.800481617f, 0.0572866984f},
std::array<float,2>{0.200791433f, 0.819554806f},
std::array<float,2>{0.0525792278f, 0.141510114f},
std::array<float,2>{0.899632514f, 0.932373762f},
std::array<float,2>{0.675315976f, 0.495578617f},
std::array<float,2>{0.255157113f, 0.629096091f},
std::array<float,2>{0.134841368f, 0.425695926f},
std::array<float,2>{0.863142312f, 0.710983336f},
std::array<float,2>{0.620553732f, 0.206505939f},
std::array<float,2>{0.375834525f, 0.971715987f},
std::array<float,2>{0.339455098f, 0.106390759f},
std::array<float,2>{0.744567335f, 0.794152498f},
std::array<float,2>{0.972736955f, 0.294483095f},
std::array<float,2>{0.0726259202f, 0.507389307f},
std::array<float,2>{0.397683918f, 0.383483469f},
std::array<float,2>{0.597300649f, 0.718904197f},
std::array<float,2>{0.855786443f, 0.242325544f},
std::array<float,2>{0.153995588f, 0.950878799f},
std::array<float,2>{0.0815083534f, 0.0897837132f},
std::array<float,2>{0.990112245f, 0.763225973f},
std::array<float,2>{0.724270523f, 0.269195169f},
std::array<float,2>{0.325074047f, 0.537495196f},
std::array<float,2>{0.20750986f, 0.368804693f},
std::array<float,2>{0.789924443f, 0.624318659f},
std::array<float,2>{0.549381614f, 0.0196750648f},
std::array<float,2>{0.487969637f, 0.868999898f},
std::array<float,2>{0.278092086f, 0.185793266f},
std::array<float,2>{0.670880079f, 0.893335879f},
std::array<float,2>{0.875603676f, 0.440394402f},
std::array<float,2>{0.0372543484f, 0.656792998f},
std::array<float,2>{0.353418201f, 0.296916127f},
std::array<float,2>{0.696832359f, 0.531058252f},
std::array<float,2>{0.947546005f, 0.111097209f},
std::array<float,2>{0.108169973f, 0.808687508f},
std::array<float,2>{0.180060923f, 0.195294142f},
std::array<float,2>{0.832362652f, 0.999566793f},
std::array<float,2>{0.584660113f, 0.408561319f},
std::array<float,2>{0.424898237f, 0.694119573f},
std::array<float,2>{0.0240912344f, 0.472100824f},
std::array<float,2>{0.921692848f, 0.654219568f},
std::array<float,2>{0.630046904f, 0.131790057f},
std::array<float,2>{0.31195578f, 0.918279946f},
std::array<float,2>{0.458248585f, 0.0327729061f},
std::array<float,2>{0.514687955f, 0.839529335f},
std::array<float,2>{0.770763159f, 0.335977346f},
std::array<float,2>{0.239546984f, 0.570864618f},
std::array<float,2>{0.314178109f, 0.414570212f},
std::array<float,2>{0.730371416f, 0.702377856f},
std::array<float,2>{0.999837101f, 0.201865003f},
std::array<float,2>{0.0894673988f, 0.988152742f},
std::array<float,2>{0.143963501f, 0.123778574f},
std::array<float,2>{0.848710001f, 0.800385296f},
std::array<float,2>{0.603384495f, 0.311892569f},
std::array<float,2>{0.403937489f, 0.516246259f},
std::array<float,2>{0.0411732383f, 0.333937943f},
std::array<float,2>{0.889735758f, 0.570042908f},
std::array<float,2>{0.661205888f, 0.0398858227f},
std::array<float,2>{0.271672606f, 0.834921896f},
std::array<float,2>{0.494541019f, 0.137545571f},
std::array<float,2>{0.559285641f, 0.911738992f},
std::array<float,2>{0.783128381f, 0.483674318f},
std::array<float,2>{0.211789519f, 0.642800748f},
std::array<float,2>{0.431971282f, 0.279128045f},
std::array<float,2>{0.586934805f, 0.545071661f},
std::array<float,2>{0.84171015f, 0.0823479667f},
std::array<float,2>{0.179099411f, 0.75732249f},
std::array<float,2>{0.0970290899f, 0.238687173f},
std::array<float,2>{0.938845932f, 0.938686967f},
std::array<float,2>{0.691704988f, 0.378062755f},
std::array<float,2>{0.345649689f, 0.729983747f},
std::array<float,2>{0.246475965f, 0.452488929f},
std::array<float,2>{0.77773118f, 0.67062372f},
std::array<float,2>{0.502983451f, 0.178680703f},
std::array<float,2>{0.467731684f, 0.900890708f},
std::array<float,2>{0.30325824f, 0.0291351359f},
std::array<float,2>{0.636787415f, 0.866500497f},
std::array<float,2>{0.909851193f, 0.361948341f},
std::array<float,2>{0.0215647463f, 0.616880119f},
std::array<float,2>{0.452495813f, 0.48625505f},
std::array<float,2>{0.517379403f, 0.633804023f},
std::array<float,2>{0.753026664f, 0.15365155f},
std::array<float,2>{0.2303112f, 0.922393501f},
std::array<float,2>{0.0133427754f, 0.0522297285f},
std::array<float,2>{0.929774582f, 0.82155627f},
std::array<float,2>{0.654725254f, 0.314673871f},
std::array<float,2>{0.294317335f, 0.581092536f},
std::array<float,2>{0.16229333f, 0.287802726f},
std::array<float,2>{0.824635744f, 0.51160562f},
std::array<float,2>{0.576654792f, 0.100508064f},
std::array<float,2>{0.41287446f, 0.784187317f},
std::array<float,2>{0.373045594f, 0.217145085f},
std::array<float,2>{0.715549827f, 0.980188906f},
std::array<float,2>{0.967585504f, 0.434678018f},
std::array<float,2>{0.124237262f, 0.71053791f},
std::array<float,2>{0.260360926f, 0.344479293f},
std::array<float,2>{0.6801337f, 0.595167279f},
std::array<float,2>{0.897678494f, 0.0130116753f},
std::array<float,2>{0.0569823049f, 0.844583452f},
std::array<float,2>{0.194270551f, 0.167327806f},
std::array<float,2>{0.812307954f, 0.879697263f},
std::array<float,2>{0.534854472f, 0.459925294f},
std::array<float,2>{0.469791859f, 0.681873977f},
std::array<float,2>{0.0666739568f, 0.396956891f},
std::array<float,2>{0.980960011f, 0.743315697f},
std::array<float,2>{0.739435315f, 0.219674736f},
std::array<float,2>{0.334644496f, 0.955006003f},
std::array<float,2>{0.385380238f, 0.0674795434f},
std::array<float,2>{0.612049103f, 0.772548318f},
std::array<float,2>{0.870567322f, 0.255740821f},
std::array<float,2>{0.126339108f, 0.558134198f},
std::array<float,2>{0.268567353f, 0.405680388f},
std::array<float,2>{0.658905685f, 0.737346888f},
std::array<float,2>{0.885588408f, 0.232623458f},
std::array<float,2>{0.046582751f, 0.961338878f},
std::array<float,2>{0.217570454f, 0.0722160935f},
std::array<float,2>{0.789020658f, 0.779988945f},
std::array<float,2>{0.556060493f, 0.264324695f},
std::array<float,2>{0.498454452f, 0.554166615f},
std::array<float,2>{0.0936601311f, 0.351643205f},
std::array<float,2>{0.992689371f, 0.603217065f},
std::array<float,2>{0.7321105f, 0.000825104828f},
std::array<float,2>{0.317508787f, 0.858690083f},
std::array<float,2>{0.400039285f, 0.157787353f},
std::array<float,2>{0.609245479f, 0.885072351f},
std::array<float,2>{0.846745551f, 0.465686828f},
std::array<float,2>{0.145647988f, 0.675495386f},
std::array<float,2>{0.461546838f, 0.289097488f},
std::array<float,2>{0.505270958f, 0.502625883f},
std::array<float,2>{0.776519895f, 0.102278538f},
std::array<float,2>{0.245639428f, 0.791235566f},
std::array<float,2>{0.0172384288f, 0.210695758f},
std::array<float,2>{0.910925329f, 0.97340256f},
std::array<float,2>{0.636627257f, 0.429287434f},
std::array<float,2>{0.30021143f, 0.714910865f},
std::array<float,2>{0.173944265f, 0.496794194f},
std::array<float,2>{0.837070763f, 0.626826048f},
std::array<float,2>{0.591827631f, 0.145276606f},
std::array<float,2>{0.435119003f, 0.936621845f},
std::array<float,2>{0.349122018f, 0.0597524643f},
std::array<float,2>{0.68796587f, 0.815894246f},
std::array<float,2>{0.942522824f, 0.327488244f},
std::array<float,2>{0.100924805f, 0.586561799f},
std::array<float,2>{0.409798741f, 0.441810936f},
std::array<float,2>{0.573943853f, 0.663325965f},
std::array<float,2>{0.822346032f, 0.182282567f},
std::array<float,2>{0.159606323f, 0.896672785f},
std::array<float,2>{0.118005149f, 0.0183460247f},
std::array<float,2>{0.964034438f, 0.871147215f},
std::array<float,2>{0.711333454f, 0.372898817f},
std::array<float,2>{0.367607564f, 0.618937314f},
std::array<float,2>{0.232588485f, 0.269697338f},
std::array<float,2>{0.755634367f, 0.533549488f},
std::array<float,2>{0.521610975f, 0.091004394f},
std::array<float,2>{0.448590606f, 0.759368837f},
std::array<float,2>{0.291190624f, 0.246904954f},
std::array<float,2>{0.650934279f, 0.947023332f},
std::array<float,2>{0.937292874f, 0.388240367f},
std::array<float,2>{0.0103633106f, 0.723429084f},
std::array<float,2>{0.330342293f, 0.342877865f},
std::array<float,2>{0.735708773f, 0.574825644f},
std::array<float,2>{0.977462351f, 0.036363136f},
std::array<float,2>{0.0652802065f, 0.843747675f},
std::array<float,2>{0.131160483f, 0.128086179f},
std::array<float,2>{0.874726236f, 0.916597307f},
std::array<float,2>{0.615606785f, 0.47572425f},
std::array<float,2>{0.388086617f, 0.648906529f},
std::array<float,2>{0.0588661917f, 0.413281679f},
std::array<float,2>{0.892087936f, 0.687832654f},
std::array<float,2>{0.687143564f, 0.188774675f},
std::array<float,2>{0.263515681f, 0.994784355f},
std::array<float,2>{0.475151122f, 0.115260124f},
std::array<float,2>{0.5366171f, 0.808592498f},
std::array<float,2>{0.80714643f, 0.30189532f},
std::array<float,2>{0.190799549f, 0.524073541f},
std::array<float,2>{0.361550182f, 0.480074733f},
std::array<float,2>{0.706561923f, 0.646537304f},
std::array<float,2>{0.958435774f, 0.13466756f},
std::array<float,2>{0.115599535f, 0.906816006f},
std::array<float,2>{0.166885376f, 0.0451676324f},
std::array<float,2>{0.81831044f, 0.82967329f},
std::array<float,2>{0.565315247f, 0.330406636f},
std::array<float,2>{0.414552391f, 0.56532377f},
std::array<float,2>{0.00373628107f, 0.306696445f},
std::array<float,2>{0.923522353f, 0.51954484f},
std::array<float,2>{0.646606028f, 0.120655119f},
std::array<float,2>{0.285117656f, 0.804114223f},
std::array<float,2>{0.439957201f, 0.195861205f},
std::array<float,2>{0.527945995f, 0.988837421f},
std::array<float,2>{0.758876622f, 0.421831399f},
std::array<float,2>{0.225038737f, 0.69838053f},
std::array<float,2>{0.382804364f, 0.363440454f},
std::array<float,2>{0.62136209f, 0.609655678f},
std::array<float,2>{0.865439296f, 0.0246039927f},
std::array<float,2>{0.13930662f, 0.863070428f},
std::array<float,2>{0.0763410181f, 0.174056634f},
std::array<float,2>{0.972394526f, 0.905005336f},
std::array<float,2>{0.746292353f, 0.446562767f},
std::array<float,2>{0.342010498f, 0.664879382f},
std::array<float,2>{0.198865175f, 0.380425274f},
std::array<float,2>{0.802224815f, 0.731792569f},
std::array<float,2>{0.540247083f, 0.23811841f},
std::array<float,2>{0.481067359f, 0.942377388f},
std::array<float,2>{0.250821382f, 0.0782780573f},
std::array<float,2>{0.678485394f, 0.751862288f},
std::array<float,2>{0.905941367f, 0.276114881f},
std::array<float,2>{0.0503091067f, 0.542416155f},
std::array<float,2>{0.489600271f, 0.431336403f},
std::array<float,2>{0.551147044f, 0.705480635f},
std::array<float,2>{0.796723962f, 0.213784531f},
std::array<float,2>{0.203794166f, 0.981759429f},
std::array<float,2>{0.0342405662f, 0.0951158181f},
std::array<float,2>{0.882696867f, 0.785474539f},
std::array<float,2>{0.667252421f, 0.283771425f},
std::array<float,2>{0.275666833f, 0.514752269f},
std::array<float,2>{0.148502529f, 0.31901744f},
std::array<float,2>{0.853994608f, 0.583538175f},
std::array<float,2>{0.600299656f, 0.0494850874f},
std::array<float,2>{0.393551737f, 0.824509025f},
std::array<float,2>{0.320557326f, 0.150507733f},
std::array<float,2>{0.72184068f, 0.926063657f},
std::array<float,2>{0.987318516f, 0.490815818f},
std::array<float,2>{0.0837130845f, 0.637452185f},
std::array<float,2>{0.306400031f, 0.251444936f},
std::array<float,2>{0.626087785f, 0.561607361f},
std::array<float,2>{0.915867269f, 0.0645731986f},
std::array<float,2>{0.0284269825f, 0.767673433f},
std::array<float,2>{0.235000566f, 0.223595396f},
std::array<float,2>{0.765794992f, 0.957096338f},
std::array<float,2>{0.509948552f, 0.393767327f},
std::array<float,2>{0.454080641f, 0.749132574f},
std::array<float,2>{0.105267905f, 0.456904203f},
std::array<float,2>{0.952821076f, 0.68702811f},
std::array<float,2>{0.701596856f, 0.17012018f},
std::array<float,2>{0.35605517f, 0.877569914f},
std::array<float,2>{0.427520484f, 0.00937831588f},
std::array<float,2>{0.578658998f, 0.848017216f},
std::array<float,2>{0.828763485f, 0.348044455f},
std::array<float,2>{0.184899837f, 0.60043478f},
std::array<float,2>{0.284749568f, 0.478054762f},
std::array<float,2>{0.646760762f, 0.645273685f},
std::array<float,2>{0.923750103f, 0.135209739f},
std::array<float,2>{0.00343697215f, 0.9097507f},
std::array<float,2>{0.224652588f, 0.0438278243f},
std::array<float,2>{0.759210348f, 0.831500828f},
std::array<float,2>{0.528193951f, 0.329285413f},
std::array<float,2>{0.440321267f, 0.563449085f},
std::array<float,2>{0.115348645f, 0.305626035f},
std::array<float,2>{0.958248138f, 0.522623062f},
std::array<float,2>{0.706815183f, 0.117928408f},
std::array<float,2>{0.361749858f, 0.802264929f},
std::array<float,2>{0.414817214f, 0.198353931f},
std::array<float,2>{0.56510824f, 0.991600037f},
std::array<float,2>{0.817981839f, 0.418632984f},
std::array<float,2>{0.166613877f, 0.696162641f},
std::array<float,2>{0.48130244f, 0.366442025f},
std::array<float,2>{0.540362179f, 0.612617671f},
std::array<float,2>{0.801787019f, 0.0258888695f},
std::array<float,2>{0.19905065f, 0.860348523f},
std::array<float,2>{0.0506673232f, 0.173630655f},
std::array<float,2>{0.906198561f, 0.904194653f},
std::array<float,2>{0.678266168f, 0.449195206f},
std::array<float,2>{0.250593513f, 0.666939914f},
std::array<float,2>{0.139553472f, 0.382261038f},
std::array<float,2>{0.865710914f, 0.732939422f},
std::array<float,2>{0.621177256f, 0.235025346f},
std::array<float,2>{0.382334232f, 0.945091605f},
std::array<float,2>{0.342234582f, 0.0808328763f},
std::array<float,2>{0.746554673f, 0.752641857f},
std::array<float,2>{0.972574174f, 0.274535924f},
std::array<float,2>{0.0765093416f, 0.53982383f},
std::array<float,2>{0.393281639f, 0.431884468f},
std::array<float,2>{0.600531638f, 0.703633666f},
std::array<float,2>{0.853531778f, 0.212592125f},
std::array<float,2>{0.148823798f, 0.984019816f},
std::array<float,2>{0.0837930739f, 0.0972370058f},
std::array<float,2>{0.987682402f, 0.787518024f},
std::array<float,2>{0.722104788f, 0.282930404f},
std::array<float,2>{0.320482552f, 0.512484133f},
std::array<float,2>{0.203922436f, 0.317150831f},
std::array<float,2>{0.796612382f, 0.585457981f},
std::array<float,2>{0.550914407f, 0.0471464805f},
std::array<float,2>{0.489472568f, 0.826818407f},
std::array<float,2>{0.275573045f, 0.150102794f},
std::array<float,2>{0.667221487f, 0.929163873f},
std::array<float,2>{0.882454515f, 0.489743263f},
std::array<float,2>{0.034572158f, 0.639301419f},
std::array<float,2>{0.356391937f, 0.25263378f},
std::array<float,2>{0.701199114f, 0.560257256f},
std::array<float,2>{0.953114033f, 0.0635642856f},
std::array<float,2>{0.105111606f, 0.767502725f},
std::array<float,2>{0.184732392f, 0.225419238f},
std::array<float,2>{0.829018593f, 0.960652769f},
std::array<float,2>{0.578863859f, 0.391583264f},
std::array<float,2>{0.427426755f, 0.746530116f},
std::array<float,2>{0.0286889337f, 0.454147071f},
std::array<float,2>{0.915705502f, 0.684592426f},
std::array<float,2>{0.626417696f, 0.169600815f},
std::array<float,2>{0.306156784f, 0.875554979f},
std::array<float,2>{0.453673452f, 0.0116310455f},
std::array<float,2>{0.510111511f, 0.85082829f},
std::array<float,2>{0.766068161f, 0.351328313f},
std::array<float,2>{0.235131428f, 0.598950744f},
std::array<float,2>{0.317789644f, 0.403335929f},
std::array<float,2>{0.732265234f, 0.735740364f},
std::array<float,2>{0.993109703f, 0.23161988f},
std::array<float,2>{0.0933155194f, 0.963129461f},
std::array<float,2>{0.145967126f, 0.0727361217f},
std::array<float,2>{0.84693414f, 0.778636277f},
std::array<float,2>{0.609007657f, 0.262235969f},
std::array<float,2>{0.400281459f, 0.551841259f},
std::array<float,2>{0.0468336977f, 0.354378313f},
std::array<float,2>{0.885427237f, 0.603854954f},
std::array<float,2>{0.6591236f, 0.00341800856f},
std::array<float,2>{0.269028246f, 0.857297361f},
std::array<float,2>{0.498230875f, 0.158845782f},
std::array<float,2>{0.555745363f, 0.884491503f},
std::array<float,2>{0.78861779f, 0.467032641f},
std::array<float,2>{0.217490911f, 0.672304809f},
std::array<float,2>{0.435440511f, 0.291258514f},
std::array<float,2>{0.592069626f, 0.500514209f},
std::array<float,2>{0.837183118f, 0.103746414f},
std::array<float,2>{0.174114674f, 0.789362133f},
std::array<float,2>{0.100689009f, 0.208466485f},
std::array<float,2>{0.942860603f, 0.974982202f},
std::array<float,2>{0.687739432f, 0.425975978f},
std::array<float,2>{0.349507302f, 0.718567967f},
std::array<float,2>{0.246006608f, 0.499338239f},
std::array<float,2>{0.776756465f, 0.627561629f},
std::array<float,2>{0.504956007f, 0.146794155f},
std::array<float,2>{0.461801261f, 0.934352517f},
std::array<float,2>{0.299923986f, 0.06139661f},
std::array<float,2>{0.636280596f, 0.813937128f},
std::array<float,2>{0.910732508f, 0.325665921f},
std::array<float,2>{0.0174013991f, 0.588156343f},
std::array<float,2>{0.44829005f, 0.444681168f},
std::array<float,2>{0.52184552f, 0.661910355f},
std::array<float,2>{0.755410612f, 0.179961741f},
std::array<float,2>{0.232667401f, 0.895964026f},
std::array<float,2>{0.0105092609f, 0.0165433269f},
std::array<float,2>{0.93714571f, 0.873597741f},
std::array<float,2>{0.651201844f, 0.37452352f},
std::array<float,2>{0.291272968f, 0.619293809f},
std::array<float,2>{0.15918389f, 0.273083359f},
std::array<float,2>{0.822538793f, 0.532727599f},
std::array<float,2>{0.574052274f, 0.0922413841f},
std::array<float,2>{0.410085499f, 0.759908676f},
std::array<float,2>{0.367213637f, 0.249652594f},
std::array<float,2>{0.711051822f, 0.947610736f},
std::array<float,2>{0.964157104f, 0.388969004f},
std::array<float,2>{0.11767859f, 0.725459695f},
std::array<float,2>{0.263229758f, 0.341440201f},
std::array<float,2>{0.687449038f, 0.577615559f},
std::array<float,2>{0.891736329f, 0.0376724452f},
std::array<float,2>{0.0586016476f, 0.840596378f},
std::array<float,2>{0.190657914f, 0.125068203f},
std::array<float,2>{0.807468474f, 0.916009963f},
std::array<float,2>{0.536166549f, 0.4740448f},
std::array<float,2>{0.475410014f, 0.65222919f},
std::array<float,2>{0.0651653931f, 0.410310537f},
std::array<float,2>{0.977193236f, 0.691352963f},
std::array<float,2>{0.735365391f, 0.190274075f},
std::array<float,2>{0.330285251f, 0.992715418f},
std::array<float,2>{0.387832403f, 0.114133216f},
std::array<float,2>{0.61523515f, 0.804723084f},
std::array<float,2>{0.87475884f, 0.302942157f},
std::array<float,2>{0.131014302f, 0.525992811f},
std::array<float,2>{0.271781802f, 0.416218162f},
std::array<float,2>{0.66156882f, 0.700491786f},
std::array<float,2>{0.88990134f, 0.199612722f},
std::array<float,2>{0.0414079241f, 0.985377967f},
std::array<float,2>{0.211653098f, 0.122863486f},
std::array<float,2>{0.782947838f, 0.797493756f},
std::array<float,2>{0.559404016f, 0.309333503f},
std::array<float,2>{0.494380623f, 0.5182814f},
std::array<float,2>{0.0897620693f, 0.334320635f},
std::array<float,2>{0.999672592f, 0.567404926f},
std::array<float,2>{0.730178118f, 0.0419255309f},
std::array<float,2>{0.314240754f, 0.832074702f},
std::array<float,2>{0.40408501f, 0.139325798f},
std::array<float,2>{0.603172243f, 0.913650513f},
std::array<float,2>{0.849074721f, 0.481854886f},
std::array<float,2>{0.143644631f, 0.641270816f},
std::array<float,2>{0.467438459f, 0.279884368f},
std::array<float,2>{0.503242671f, 0.543373942f},
std::array<float,2>{0.777413607f, 0.0845594853f},
std::array<float,2>{0.246162683f, 0.754501104f},
std::array<float,2>{0.0218869764f, 0.241781294f},
std::array<float,2>{0.909993768f, 0.939610779f},
std::array<float,2>{0.636977017f, 0.3751598f},
std::array<float,2>{0.303559721f, 0.726779699f},
std::array<float,2>{0.178822249f, 0.450368613f},
std::array<float,2>{0.841510475f, 0.669674814f},
std::array<float,2>{0.587221622f, 0.177006721f},
std::array<float,2>{0.431667835f, 0.900390565f},
std::array<float,2>{0.345362693f, 0.030158598f},
std::array<float,2>{0.691578567f, 0.863348365f},
std::array<float,2>{0.938715994f, 0.36068055f},
std::array<float,2>{0.0968215317f, 0.614920974f},
std::array<float,2>{0.412754327f, 0.487409711f},
std::array<float,2>{0.576289594f, 0.63645792f},
std::array<float,2>{0.824397862f, 0.155087978f},
std::array<float,2>{0.162469625f, 0.925228179f},
std::array<float,2>{0.124449827f, 0.0538882613f},
std::array<float,2>{0.96744132f, 0.823227465f},
std::array<float,2>{0.715801358f, 0.313705146f},
std::array<float,2>{0.37268579f, 0.579875231f},
std::array<float,2>{0.230072752f, 0.285335779f},
std::array<float,2>{0.753254056f, 0.508381784f},
std::array<float,2>{0.51724273f, 0.0986717418f},
std::array<float,2>{0.452242464f, 0.78271687f},
std::array<float,2>{0.294109285f, 0.215812698f},
std::array<float,2>{0.654513657f, 0.977122843f},
std::array<float,2>{0.930145502f, 0.436642647f},
std::array<float,2>{0.0136656025f, 0.707262397f},
std::array<float,2>{0.334753633f, 0.347478539f},
std::array<float,2>{0.739521146f, 0.596975207f},
std::array<float,2>{0.981229544f, 0.0150397588f},
std::array<float,2>{0.0665154904f, 0.846822083f},
std::array<float,2>{0.12606065f, 0.164962336f},
std::array<float,2>{0.870334625f, 0.881604731f},
std::array<float,2>{0.612109303f, 0.458108455f},
std::array<float,2>{0.3855308f, 0.680593014f},
std::array<float,2>{0.0568372831f, 0.394815534f},
std::array<float,2>{0.897757292f, 0.745794713f},
std::array<float,2>{0.679789662f, 0.221061245f},
std::array<float,2>{0.260681093f, 0.955859005f},
std::array<float,2>{0.470148027f, 0.069165118f},
std::array<float,2>{0.535143316f, 0.771158993f},
std::array<float,2>{0.812094867f, 0.257337749f},
std::array<float,2>{0.193992883f, 0.554972351f},
std::array<float,2>{0.367091238f, 0.462349534f},
std::array<float,2>{0.707277834f, 0.677961469f},
std::array<float,2>{0.956887007f, 0.163635895f},
std::array<float,2>{0.109830819f, 0.888808787f},
std::array<float,2>{0.16826272f, 0.00549729588f},
std::array<float,2>{0.815229774f, 0.854370117f},
std::array<float,2>{0.568170965f, 0.35840553f},
std::array<float,2>{0.420031309f, 0.608538151f},
std::array<float,2>{0.00560320262f, 0.26068598f},
std::array<float,2>{0.926502109f, 0.547784269f},
std::array<float,2>{0.642697334f, 0.0744277164f},
std::array<float,2>{0.285747051f, 0.776774108f},
std::array<float,2>{0.444926411f, 0.227941111f},
std::array<float,2>{0.524133384f, 0.968608558f},
std::array<float,2>{0.762313604f, 0.40183714f},
std::array<float,2>{0.220594168f, 0.740960658f},
std::array<float,2>{0.375496387f, 0.324177325f},
std::array<float,2>{0.620288193f, 0.591544807f},
std::array<float,2>{0.862810194f, 0.0548639521f},
std::array<float,2>{0.135093153f, 0.816739321f},
std::array<float,2>{0.0723028108f, 0.143695101f},
std::array<float,2>{0.973119378f, 0.930981874f},
std::array<float,2>{0.744352281f, 0.49379155f},
std::array<float,2>{0.339664012f, 0.632370412f},
std::array<float,2>{0.201007798f, 0.423713088f},
std::array<float,2>{0.800651431f, 0.714586198f},
std::array<float,2>{0.544953346f, 0.203649402f},
std::array<float,2>{0.478604168f, 0.970139802f},
std::array<float,2>{0.254921794f, 0.109107748f},
std::array<float,2>{0.675675929f, 0.796172619f},
std::array<float,2>{0.899882972f, 0.295244664f},
std::array<float,2>{0.0523074605f, 0.505135298f},
std::array<float,2>{0.488104999f, 0.385550231f},
std::array<float,2>{0.549769461f, 0.721969068f},
std::array<float,2>{0.789672613f, 0.246008396f},
std::array<float,2>{0.207233712f, 0.951597452f},
std::array<float,2>{0.0373566486f, 0.0874317661f},
std::array<float,2>{0.875830114f, 0.76434052f},
std::array<float,2>{0.670470595f, 0.267189115f},
std::array<float,2>{0.277951986f, 0.535964012f},
std::array<float,2>{0.154058889f, 0.370355606f},
std::array<float,2>{0.855493248f, 0.621935785f},
std::array<float,2>{0.597461164f, 0.023140816f},
std::array<float,2>{0.397934824f, 0.86970228f},
std::array<float,2>{0.324949622f, 0.184785172f},
std::array<float,2>{0.724609137f, 0.891145051f},
std::array<float,2>{0.98990196f, 0.438643336f},
std::array<float,2>{0.0812357143f, 0.658734977f},
std::array<float,2>{0.311593443f, 0.299184978f},
std::array<float,2>{0.630158007f, 0.528163433f},
std::array<float,2>{0.921569586f, 0.113169208f},
std::array<float,2>{0.0243592523f, 0.811811566f},
std::array<float,2>{0.239478081f, 0.192374632f},
std::array<float,2>{0.770531893f, 0.996451437f},
std::array<float,2>{0.515074611f, 0.40706414f},
std::array<float,2>{0.458282232f, 0.693057418f},
std::array<float,2>{0.107930839f, 0.469694823f},
std::array<float,2>{0.94750607f, 0.655661523f},
std::array<float,2>{0.697047353f, 0.13070251f},
std::array<float,2>{0.353179485f, 0.920269132f},
std::array<float,2>{0.425114483f, 0.0348681286f},
std::array<float,2>{0.584833264f, 0.836651921f},
std::array<float,2>{0.832121491f, 0.339363873f},
std::array<float,2>{0.179700807f, 0.574084222f},
std::array<float,2>{0.253789723f, 0.44565779f},
std::array<float,2>{0.677090347f, 0.665410042f},
std::array<float,2>{0.902811885f, 0.175030753f},
std::array<float,2>{0.0487550236f, 0.905990064f},
std::array<float,2>{0.195671454f, 0.0235841218f},
std::array<float,2>{0.802987576f, 0.861746907f},
std::array<float,2>{0.541794538f, 0.364868194f},
std::array<float,2>{0.48244223f, 0.611298859f},
std::array<float,2>{0.0761691704f, 0.276679486f},
std::array<float,2>{0.96932441f, 0.541567862f},
std::array<float,2>{0.749399543f, 0.0798934177f},
std::array<float,2>{0.341027588f, 0.75006026f},
std::array<float,2>{0.37962544f, 0.237076104f},
std::array<float,2>{0.623765409f, 0.94326067f},
std::array<float,2>{0.864283025f, 0.379015088f},
std::array<float,2>{0.137918591f, 0.730986714f},
std::array<float,2>{0.438981712f, 0.331882715f},
std::array<float,2>{0.530718803f, 0.566260338f},
std::array<float,2>{0.759878457f, 0.0468698256f},
std::array<float,2>{0.222865403f, 0.82835871f},
std::array<float,2>{0.00157037564f, 0.132870495f},
std::array<float,2>{0.92415607f, 0.907859623f},
std::array<float,2>{0.645238101f, 0.478889674f},
std::array<float,2>{0.282541603f, 0.64748615f},
std::array<float,2>{0.164935529f, 0.420363247f},
std::array<float,2>{0.819580138f, 0.698201001f},
std::array<float,2>{0.563002527f, 0.197171465f},
std::array<float,2>{0.41752246f, 0.989534914f},
std::array<float,2>{0.36092335f, 0.119527005f},
std::array<float,2>{0.704829574f, 0.802854359f},
std::array<float,2>{0.959620237f, 0.308112144f},
std::array<float,2>{0.115233019f, 0.521338105f},
std::array<float,2>{0.428137809f, 0.392891169f},
std::array<float,2>{0.581992388f, 0.74870187f},
std::array<float,2>{0.830217123f, 0.224370271f},
std::array<float,2>{0.186116442f, 0.958862185f},
std::array<float,2>{0.101649858f, 0.0662209466f},
std::array<float,2>{0.950585783f, 0.768643379f},
std::array<float,2>{0.699278355f, 0.250068545f},
std::array<float,2>{0.358713388f, 0.560866117f},
std::array<float,2>{0.237453386f, 0.349541485f},
std::array<float,2>{0.769289076f, 0.601366997f},
std::array<float,2>{0.508953929f, 0.00858432427f},
std::array<float,2>{0.45622921f, 0.849010289f},
std::array<float,2>{0.308214426f, 0.17122516f},
std::array<float,2>{0.627233982f, 0.878668964f},
std::array<float,2>{0.916925788f, 0.455337375f},
std::array<float,2>{0.0306601357f, 0.685578823f},
std::array<float,2>{0.324001104f, 0.28489846f},
std::array<float,2>{0.719385326f, 0.513944447f},
std::array<float,2>{0.985260427f, 0.0938515589f},
std::array<float,2>{0.0855266005f, 0.787074149f},
std::array<float,2>{0.151782662f, 0.214113131f},
std::array<float,2>{0.852767348f, 0.981037974f},
std::array<float,2>{0.597657859f, 0.430557638f},
std::array<float,2>{0.391646355f, 0.706470311f},
std::array<float,2>{0.0330294706f, 0.491438746f},
std::array<float,2>{0.879159749f, 0.637711525f},
std::array<float,2>{0.665196955f, 0.152004719f},
std::array<float,2>{0.274988443f, 0.927442193f},
std::array<float,2>{0.490656018f, 0.0506279171f},
std::array<float,2>{0.553874552f, 0.825511813f},
std::array<float,2>{0.794681847f, 0.31998533f},
std::array<float,2>{0.205113709f, 0.582058966f},
std::array<float,2>{0.349812508f, 0.428688169f},
std::array<float,2>{0.690982938f, 0.716217697f},
std::array<float,2>{0.945068479f, 0.209010512f},
std::array<float,2>{0.0990349948f, 0.973892689f},
std::array<float,2>{0.172034338f, 0.10338103f},
std::array<float,2>{0.838358939f, 0.792298317f},
std::array<float,2>{0.591300488f, 0.290754139f},
std::array<float,2>{0.43564716f, 0.503044248f},
std::array<float,2>{0.0192005448f, 0.326801658f},
std::array<float,2>{0.91310972f, 0.587304294f},
std::array<float,2>{0.632875502f, 0.0587835349f},
std::array<float,2>{0.298107952f, 0.814913511f},
std::array<float,2>{0.463629901f, 0.146069765f},
std::array<float,2>{0.505998135f, 0.935633719f},
std::array<float,2>{0.774710238f, 0.497903496f},
std::array<float,2>{0.243071362f, 0.625319362f},
std::array<float,2>{0.400740892f, 0.264669389f},
std::array<float,2>{0.606143296f, 0.553439498f},
std::array<float,2>{0.845188916f, 0.0709818006f},
std::array<float,2>{0.148259655f, 0.781147301f},
std::array<float,2>{0.0908397064f, 0.233742699f},
std::array<float,2>{0.994416833f, 0.962073803f},
std::array<float,2>{0.733874023f, 0.405133218f},
std::array<float,2>{0.319016576f, 0.736872256f},
std::array<float,2>{0.215612158f, 0.466132194f},
std::array<float,2>{0.786059499f, 0.674282312f},
std::array<float,2>{0.558277428f, 0.156606793f},
std::array<float,2>{0.496311635f, 0.886552095f},
std::array<float,2>{0.266259551f, 0.00166463375f},
std::array<float,2>{0.65802604f, 0.857470214f},
std::array<float,2>{0.884225428f, 0.352883518f},
std::array<float,2>{0.0446404852f, 0.601581454f},
std::array<float,2>{0.473775834f, 0.474669456f},
std::array<float,2>{0.537656486f, 0.650167346f},
std::array<float,2>{0.805988729f, 0.127594516f},
std::array<float,2>{0.189394623f, 0.917003214f},
std::array<float,2>{0.06105702f, 0.0351826884f},
std::array<float,2>{0.89308095f, 0.842575729f},
std::array<float,2>{0.685373366f, 0.342229247f},
std::array<float,2>{0.264212102f, 0.575483024f},
std::array<float,2>{0.13072814f, 0.301172644f},
std::array<float,2>{0.871774197f, 0.525207758f},
std::array<float,2>{0.61493516f, 0.117088564f},
std::array<float,2>{0.389603943f, 0.807123542f},
std::array<float,2>{0.32883203f, 0.187674358f},
std::array<float,2>{0.737871885f, 0.995395482f},
std::array<float,2>{0.979185283f, 0.412879437f},
std::array<float,2>{0.0643379241f, 0.689186275f},
std::array<float,2>{0.290440679f, 0.371947646f},
std::array<float,2>{0.64908421f, 0.617835462f},
std::array<float,2>{0.933855474f, 0.019129023f},
std::array<float,2>{0.00845374074f, 0.872406721f},
std::array<float,2>{0.231851369f, 0.18330586f},
std::array<float,2>{0.757272124f, 0.898133516f},
std::array<float,2>{0.520500958f, 0.442735702f},
std::array<float,2>{0.445652664f, 0.662476361f},
std::array<float,2>{0.119964026f, 0.387065858f},
std::array<float,2>{0.961081564f, 0.724127948f},
std::array<float,2>{0.713890851f, 0.247338861f},
std::array<float,2>{0.371035844f, 0.946200192f},
std::array<float,2>{0.406457722f, 0.0908097774f},
std::array<float,2>{0.571594357f, 0.758552074f},
std::array<float,2>{0.820451081f, 0.271429449f},
std::array<float,2>{0.156329706f, 0.535082102f},
std::array<float,2>{0.302725971f, 0.376968831f},
std::array<float,2>{0.639644086f, 0.729365766f},
std::array<float,2>{0.907132804f, 0.240059718f},
std::array<float,2>{0.0211127121f, 0.937836111f},
std::array<float,2>{0.249569297f, 0.083827585f},
std::array<float,2>{0.781143606f, 0.756777287f},
std::array<float,2>{0.500891328f, 0.27810213f},
std::array<float,2>{0.465837538f, 0.546785355f},
std::array<float,2>{0.0951510593f, 0.363054305f},
std::array<float,2>{0.939964831f, 0.615421653f},
std::array<float,2>{0.694109678f, 0.0274119284f},
std::array<float,2>{0.346633226f, 0.865258515f},
std::array<float,2>{0.430728525f, 0.179275185f},
std::array<float,2>{0.589833796f, 0.902160823f},
std::array<float,2>{0.843237221f, 0.451464355f},
std::array<float,2>{0.176916063f, 0.67155689f},
std::array<float,2>{0.493828714f, 0.311245084f},
std::array<float,2>{0.561490238f, 0.517159879f},
std::array<float,2>{0.784770727f, 0.12447983f},
std::array<float,2>{0.213771418f, 0.799185753f},
std::array<float,2>{0.0393665433f, 0.20285356f},
std::array<float,2>{0.888574839f, 0.986504316f},
std::array<float,2>{0.6626302f, 0.415959805f},
std::array<float,2>{0.270989239f, 0.701182663f},
std::array<float,2>{0.142397508f, 0.483316183f},
std::array<float,2>{0.850128472f, 0.644392252f},
std::array<float,2>{0.604756415f, 0.138142228f},
std::array<float,2>{0.405252635f, 0.9107548f},
std::array<float,2>{0.316104323f, 0.0401521698f},
std::array<float,2>{0.727949798f, 0.83525914f},
std::array<float,2>{0.997600675f, 0.332819223f},
std::array<float,2>{0.087774612f, 0.569074631f},
std::array<float,2>{0.384570301f, 0.459994555f},
std::array<float,2>{0.609481752f, 0.682775915f},
std::array<float,2>{0.867753983f, 0.166824937f},
std::array<float,2>{0.128532946f, 0.880115688f},
std::array<float,2>{0.0695070699f, 0.0117885536f},
std::array<float,2>{0.98295939f, 0.845553041f},
std::array<float,2>{0.741712213f, 0.345057547f},
std::array<float,2>{0.332266361f, 0.594454706f},
std::array<float,2>{0.192881003f, 0.254777044f},
std::array<float,2>{0.808601856f, 0.557488263f},
std::array<float,2>{0.53227061f, 0.0664998293f},
std::array<float,2>{0.472166002f, 0.771569908f},
std::array<float,2>{0.258698136f, 0.220007628f},
std::array<float,2>{0.682556689f, 0.95338279f},
std::array<float,2>{0.895281553f, 0.398286611f},
std::array<float,2>{0.0556757264f, 0.742763758f},
std::array<float,2>{0.37444225f, 0.315836251f},
std::array<float,2>{0.717913568f, 0.580435991f},
std::array<float,2>{0.965661645f, 0.0517322607f},
std::array<float,2>{0.121837869f, 0.820952415f},
std::array<float,2>{0.16118069f, 0.15234448f},
std::array<float,2>{0.827068806f, 0.923496306f},
std::array<float,2>{0.575005651f, 0.485132009f},
std::array<float,2>{0.411844611f, 0.63304764f},
std::array<float,2>{0.0137665849f, 0.43442896f},
std::array<float,2>{0.932725966f, 0.709829688f},
std::array<float,2>{0.653752863f, 0.218639821f},
std::array<float,2>{0.296823978f, 0.979249299f},
std::array<float,2>{0.450847417f, 0.101418793f},
std::array<float,2>{0.518100023f, 0.783516824f},
std::array<float,2>{0.750704229f, 0.288307041f},
std::array<float,2>{0.227565691f, 0.510679901f},
std::array<float,2>{0.337234706f, 0.494152546f},
std::array<float,2>{0.743520319f, 0.630626619f},
std::array<float,2>{0.975275159f, 0.142080411f},
std::array<float,2>{0.0705925524f, 0.93315053f},
std::array<float,2>{0.133520544f, 0.0582891628f},
std::array<float,2>{0.860470891f, 0.818595886f},
std::array<float,2>{0.61840409f, 0.321107775f},
std::array<float,2>{0.378613055f, 0.593550563f},
std::array<float,2>{0.0533841178f, 0.293887615f},
std::array<float,2>{0.902284741f, 0.506422639f},
std::array<float,2>{0.673007905f, 0.107252218f},
std::array<float,2>{0.256028384f, 0.793838143f},
std::array<float,2>{0.476896405f, 0.205110788f},
std::array<float,2>{0.543413699f, 0.970834553f},
std::array<float,2>{0.798423111f, 0.424442172f},
std::array<float,2>{0.202593878f, 0.712161422f},
std::array<float,2>{0.418391317f, 0.356099755f},
std::array<float,2>{0.5688501f, 0.606889486f},
std::array<float,2>{0.814102173f, 0.00765588181f},
std::array<float,2>{0.17055814f, 0.852961063f},
std::array<float,2>{0.111744702f, 0.161103562f},
std::array<float,2>{0.954074442f, 0.887996018f},
std::array<float,2>{0.709372461f, 0.463329345f},
std::array<float,2>{0.364485502f, 0.677516818f},
std::array<float,2>{0.221939281f, 0.399440646f},
std::array<float,2>{0.764003456f, 0.739957154f},
std::array<float,2>{0.526395321f, 0.229547128f},
std::array<float,2>{0.441751212f, 0.965586305f},
std::array<float,2>{0.287292331f, 0.0775871798f},
std::array<float,2>{0.641449273f, 0.774093032f},
std::array<float,2>{0.928291917f, 0.257926702f},
std::array<float,2>{0.00645326637f, 0.549769044f},
std::array<float,2>{0.459278852f, 0.409538686f},
std::array<float,2>{0.512365758f, 0.694420278f},
std::array<float,2>{0.771517754f, 0.193901256f},
std::array<float,2>{0.24202776f, 0.998176694f},
std::array<float,2>{0.0257116444f, 0.109627612f},
std::array<float,2>{0.919812918f, 0.809840262f},
std::array<float,2>{0.63137579f, 0.298104674f},
std::array<float,2>{0.309446216f, 0.530035913f},
std::array<float,2>{0.182851017f, 0.337254286f},
std::array<float,2>{0.835079253f, 0.572081149f},
std::array<float,2>{0.583008349f, 0.0319897421f},
std::array<float,2>{0.423318475f, 0.838075936f},
std::array<float,2>{0.355431855f, 0.132313758f},
std::array<float,2>{0.69918853f, 0.919156313f},
std::array<float,2>{0.946023762f, 0.470988184f},
std::array<float,2>{0.105656542f, 0.652395129f},
std::array<float,2>{0.279871613f, 0.268213302f},
std::array<float,2>{0.668929815f, 0.538112819f},
std::array<float,2>{0.8779971f, 0.0882279947f},
std::array<float,2>{0.0358456224f, 0.762532771f},
std::array<float,2>{0.21041736f, 0.244034201f},
std::array<float,2>{0.79133743f, 0.949246228f},
std::array<float,2>{0.547661602f, 0.384659767f},
std::array<float,2>{0.485772014f, 0.720035136f},
std::array<float,2>{0.0799411684f, 0.440888584f},
std::array<float,2>{0.991403997f, 0.658115804f},
std::array<float,2>{0.725348711f, 0.186575726f},
std::array<float,2>{0.327049196f, 0.894104958f},
std::array<float,2>{0.395692974f, 0.020932164f},
std::array<float,2>{0.594862759f, 0.867304146f},
std::array<float,2>{0.858873487f, 0.368067265f},
std::array<float,2>{0.154363662f, 0.623339236f},
std::array<float,2>{0.273478538f, 0.488607317f},
std::array<float,2>{0.664963424f, 0.640344322f},
std::array<float,2>{0.880841076f, 0.14915143f},
std::array<float,2>{0.032002721f, 0.927797079f},
std::array<float,2>{0.206657544f, 0.0484799147f},
std::array<float,2>{0.793316662f, 0.828056872f},
std::array<float,2>{0.553371847f, 0.31829989f},
std::array<float,2>{0.491988152f, 0.584235847f},
std::array<float,2>{0.0845324844f, 0.281480998f},
std::array<float,2>{0.986097097f, 0.513132215f},
std::array<float,2>{0.72053045f, 0.0959450454f},
std::array<float,2>{0.322946876f, 0.788406134f},
std::array<float,2>{0.390779436f, 0.211092502f},
std::array<float,2>{0.599153638f, 0.983236969f},
std::array<float,2>{0.852020979f, 0.433560014f},
std::array<float,2>{0.150759384f, 0.704455912f},
std::array<float,2>{0.45587793f, 0.350512803f},
std::array<float,2>{0.508570135f, 0.598360777f},
std::array<float,2>{0.768134475f, 0.0102380365f},
std::array<float,2>{0.236797795f, 0.850454152f},
std::array<float,2>{0.0299384613f, 0.168845221f},
std::array<float,2>{0.917161405f, 0.876278162f},
std::array<float,2>{0.62864399f, 0.453983605f},
std::array<float,2>{0.307510704f, 0.684264243f},
std::array<float,2>{0.186687276f, 0.392328858f},
std::array<float,2>{0.831799924f, 0.747877061f},
std::array<float,2>{0.580801725f, 0.226326078f},
std::array<float,2>{0.429084778f, 0.959453404f},
std::array<float,2>{0.358002037f, 0.0627021566f},
std::array<float,2>{0.700843871f, 0.766231f},
std::array<float,2>{0.949461818f, 0.253339171f},
std::array<float,2>{0.102758907f, 0.55871284f},
std::array<float,2>{0.41601932f, 0.419880748f},
std::array<float,2>{0.563498497f, 0.696610212f},
std::array<float,2>{0.818705559f, 0.19802317f},
std::array<float,2>{0.165651977f, 0.990723073f},
std::array<float,2>{0.113708757f, 0.119037785f},
std::array<float,2>{0.959997833f, 0.801670015f},
std::array<float,2>{0.703351676f, 0.306332767f},
std::array<float,2>{0.359684825f, 0.521744311f},
std::array<float,2>{0.223963842f, 0.328177929f},
std::array<float,2>{0.761248767f, 0.564415455f},
std::array<float,2>{0.529585361f, 0.0445943028f},
std::array<float,2>{0.438246727f, 0.830793679f},
std::array<float,2>{0.281777412f, 0.136529192f},
std::array<float,2>{0.645832539f, 0.908787072f},
std::array<float,2>{0.925064862f, 0.477510214f},
std::array<float,2>{0.000764913391f, 0.646157265f},
std::array<float,2>{0.339910656f, 0.274186462f},
std::array<float,2>{0.74857384f, 0.54045105f},
std::array<float,2>{0.970250785f, 0.0819113478f},
std::array<float,2>{0.0744456425f, 0.753542185f},
std::array<float,2>{0.137160331f, 0.236302614f},
std::array<float,2>{0.863627434f, 0.943644166f},
std::array<float,2>{0.624838114f, 0.381168395f},
std::array<float,2>{0.380397797f, 0.733402133f},
std::array<float,2>{0.0473319702f, 0.448117942f},
std::array<float,2>{0.904254258f, 0.667578816f},
std::array<float,2>{0.675807834f, 0.172503456f},
std::array<float,2>{0.252845675f, 0.903012216f},
std::array<float,2>{0.484106004f, 0.0270030349f},
std::array<float,2>{0.542061508f, 0.860628068f},
std::array<float,2>{0.804116428f, 0.365787178f},
std::array<float,2>{0.196633726f, 0.611599565f},
std::array<float,2>{0.369643986f, 0.389821827f},
std::array<float,2>{0.71292901f, 0.725752532f},
std::array<float,2>{0.962495923f, 0.248947069f},
std::array<float,2>{0.120409235f, 0.94851172f},
std::array<float,2>{0.15807052f, 0.0930570662f},
std::array<float,2>{0.821617901f, 0.761361659f},
std::array<float,2>{0.571084738f, 0.272391945f},
std::array<float,2>{0.408007324f, 0.531420052f},
std::array<float,2>{0.00934985839f, 0.373855859f},
std::array<float,2>{0.9347381f, 0.620761096f},
std::array<float,2>{0.649551094f, 0.0175700951f},
std::array<float,2>{0.289414555f, 0.874392867f},
std::array<float,2>{0.446854442f, 0.181419238f},
std::array<float,2>{0.521243334f, 0.895470321f},
std::array<float,2>{0.756470859f, 0.443650991f},
std::array<float,2>{0.230882972f, 0.66091007f},
std::array<float,2>{0.390175164f, 0.304429561f},
std::array<float,2>{0.614005208f, 0.526988924f},
std::array<float,2>{0.872543991f, 0.114377551f},
std::array<float,2>{0.129370257f, 0.80569011f},
std::array<float,2>{0.063168548f, 0.190867648f},
std::array<float,2>{0.979937375f, 0.993223071f},
std::array<float,2>{0.736843288f, 0.411138147f},
std::array<float,2>{0.329426765f, 0.690012455f},
std::array<float,2>{0.187710077f, 0.473499894f},
std::array<float,2>{0.805333257f, 0.650712132f},
std::array<float,2>{0.538815737f, 0.12693502f},
std::array<float,2>{0.473581076f, 0.914564192f},
std::array<float,2>{0.26512596f, 0.0389299579f},
std::array<float,2>{0.683714747f, 0.841341376f},
std::array<float,2>{0.894242227f, 0.34041971f},
std::array<float,2>{0.0615379214f, 0.576367021f},
std::array<float,2>{0.497266173f, 0.468443155f},
std::array<float,2>{0.557039917f, 0.67318815f},
std::array<float,2>{0.786572218f, 0.15950501f},
std::array<float,2>{0.216006488f, 0.883654773f},
std::array<float,2>{0.0435251258f, 0.00278405612f},
std::array<float,2>{0.883112609f, 0.855715573f},
std::array<float,2>{0.656497657f, 0.355159074f},
std::array<float,2>{0.266993642f, 0.604973972f},
std::array<float,2>{0.147142172f, 0.263248473f},
std::array<float,2>{0.844103694f, 0.550995767f},
std::array<float,2>{0.606809556f, 0.0738253295f},
std::array<float,2>{0.402238607f, 0.777440906f},
std::array<float,2>{0.319789588f, 0.231404394f},
std::array<float,2>{0.732919157f, 0.964810729f},
std::array<float,2>{0.995545924f, 0.402608991f},
std::array<float,2>{0.0902501047f, 0.73532027f},
std::array<float,2>{0.297237039f, 0.324599355f},
std::array<float,2>{0.634487569f, 0.589168429f},
std::array<float,2>{0.913005412f, 0.0617284551f},
std::array<float,2>{0.0177173931f, 0.813182652f},
std::array<float,2>{0.243203998f, 0.148348868f},
std::array<float,2>{0.774230063f, 0.934996188f},
std::array<float,2>{0.50737536f, 0.498570561f},
std::array<float,2>{0.464280963f, 0.62870127f},
std::array<float,2>{0.0985787734f, 0.426962346f},
std::array<float,2>{0.943879962f, 0.717216134f},
std::array<float,2>{0.689902902f, 0.207966849f},
std::array<float,2>{0.35103628f, 0.975791991f},
std::array<float,2>{0.437175065f, 0.105097577f},
std::array<float,2>{0.590541184f, 0.790600359f},
std::array<float,2>{0.839372098f, 0.292564094f},
std::array<float,2>{0.173389927f, 0.501095355f},
std::array<float,2>{0.29575935f, 0.436276466f},
std::array<float,2>{0.652722061f, 0.708033741f},
std::array<float,2>{0.931730866f, 0.216470808f},
std::array<float,2>{0.0151973646f, 0.977668226f},
std::array<float,2>{0.226818681f, 0.0983329639f},
std::array<float,2>{0.751557469f, 0.781548142f},
std::array<float,2>{0.518959641f, 0.286845684f},
std::array<float,2>{0.450074196f, 0.509097457f},
std::array<float,2>{0.122975938f, 0.312519222f},
std::array<float,2>{0.96621418f, 0.578782022f},
std::array<float,2>{0.717303514f, 0.0533493236f},
std::array<float,2>{0.373649597f, 0.823520601f},
std::array<float,2>{0.41070658f, 0.155606657f},
std::array<float,2>{0.575797796f, 0.924785018f},
std::array<float,2>{0.82750088f, 0.486511767f},
std::array<float,2>{0.160385296f, 0.635626674f},
std::array<float,2>{0.470907867f, 0.256090283f},
std::array<float,2>{0.531413913f, 0.555728614f},
std::array<float,2>{0.810213685f, 0.0700331181f},
std::array<float,2>{0.191413969f, 0.769757509f},
std::array<float,2>{0.0554995798f, 0.222516015f},
std::array<float,2>{0.896431029f, 0.95621562f},
std::array<float,2>{0.68305397f, 0.395737797f},
std::array<float,2>{0.259005189f, 0.744464934f},
std::array<float,2>{0.127796173f, 0.457123607f},
std::array<float,2>{0.868801236f, 0.681589484f},
std::array<float,2>{0.610471606f, 0.165130958f},
std::array<float,2>{0.382956743f, 0.882508993f},
std::array<float,2>{0.333420515f, 0.0141122732f},
std::array<float,2>{0.740446806f, 0.845717371f},
std::array<float,2>{0.983779252f, 0.345769018f},
std::array<float,2>{0.0686578453f, 0.595719934f},
std::array<float,2>{0.405413449f, 0.480886459f},
std::array<float,2>{0.603595972f, 0.641858041f},
std::array<float,2>{0.851151705f, 0.140491545f},
std::array<float,2>{0.140894026f, 0.912599981f},
std::array<float,2>{0.0862772912f, 0.042484954f},
std::array<float,2>{0.996937752f, 0.833560944f},
std::array<float,2>{0.727266967f, 0.335576385f},
std::array<float,2>{0.315133721f, 0.566632092f},
std::array<float,2>{0.21412468f, 0.3103351f},
std::array<float,2>{0.783794165f, 0.518921196f},
std::array<float,2>{0.56202817f, 0.121345446f},
std::array<float,2>{0.492266715f, 0.797975659f},
std::array<float,2>{0.269871175f, 0.201153606f},
std::array<float,2>{0.66335237f, 0.985070825f},
std::array<float,2>{0.887517631f, 0.417201698f},
std::array<float,2>{0.040072877f, 0.700172007f},
std::array<float,2>{0.34686622f, 0.360212386f},
std::array<float,2>{0.695012271f, 0.613522708f},
std::array<float,2>{0.940719485f, 0.030956408f},
std::array<float,2>{0.0943287164f, 0.864910245f},
std::array<float,2>{0.176541716f, 0.176587448f},
std::array<float,2>{0.841883183f, 0.899104834f},
std::array<float,2>{0.588491797f, 0.449601918f},
std::array<float,2>{0.430387676f, 0.66799742f},
std::array<float,2>{0.0200062152f, 0.376307011f},
std::array<float,2>{0.90766722f, 0.727593303f},
std::array<float,2>{0.640513897f, 0.24023515f},
std::array<float,2>{0.301299065f, 0.940492988f},
std::array<float,2>{0.465201348f, 0.0853484645f},
std::array<float,2>{0.501912534f, 0.755217433f},
std::array<float,2>{0.779397845f, 0.280698925f},
std::array<float,2>{0.248612761f, 0.544828475f},
std::array<float,2>{0.328004003f, 0.437993437f},
std::array<float,2>{0.726351023f, 0.659576416f},
std::array<float,2>{0.991100967f, 0.184264287f},
std::array<float,2>{0.0785806328f, 0.891608f},
std::array<float,2>{0.156113118f, 0.0217307787f},
std::array<float,2>{0.858397424f, 0.870805085f},
std::array<float,2>{0.594377816f, 0.369460046f},
std::array<float,2>{0.395257384f, 0.623013496f},
std::array<float,2>{0.0364398435f, 0.265978068f},
std::array<float,2>{0.87780118f, 0.536473691f},
std::array<float,2>{0.669528782f, 0.0867877975f},
std::array<float,2>{0.280963272f, 0.765248537f},
std::array<float,2>{0.484589934f, 0.244533703f},
std::array<float,2>{0.548042715f, 0.952920437f},
std::array<float,2>{0.792527616f, 0.385771871f},
std::array<float,2>{0.209225178f, 0.720740259f},
std::array<float,2>{0.421897262f, 0.337923139f},
std::array<float,2>{0.582036018f, 0.573127449f},
std::array<float,2>{0.834157646f, 0.0336569659f},
std::array<float,2>{0.182601169f, 0.837473691f},
std::array<float,2>{0.106743865f, 0.129848227f},
std::array<float,2>{0.946866214f, 0.921135724f},
std::array<float,2>{0.69821322f, 0.470702827f},
std::array<float,2>{0.354163468f, 0.655154824f},
std::array<float,2>{0.240761071f, 0.407838494f},
std::array<float,2>{0.773131013f, 0.691899896f},
std::array<float,2>{0.513250172f, 0.192816541f},
std::array<float,2>{0.460181624f, 0.997992456f},
std::array<float,2>{0.310285568f, 0.111937605f},
std::array<float,2>{0.631967902f, 0.810579836f},
std::array<float,2>{0.918435276f, 0.30040583f},
std::array<float,2>{0.0270500556f, 0.528980255f},
std::array<float,2>{0.442946166f, 0.400390774f},
std::array<float,2>{0.5263533f, 0.7413674f},
std::array<float,2>{0.764999926f, 0.226848587f},
std::array<float,2>{0.221573368f, 0.967398584f},
std::array<float,2>{0.00759974774f, 0.0753787085f},
std::array<float,2>{0.929388225f, 0.775540292f},
std::array<float,2>{0.642463684f, 0.261525124f},
std::array<float,2>{0.288611382f, 0.548205435f},
std::array<float,2>{0.171092913f, 0.358236194f},
std::array<float,2>{0.812532127f, 0.608022332f},
std::array<float,2>{0.569763243f, 0.00432656333f},
std::array<float,2>{0.419652432f, 0.855009973f},
std::array<float,2>{0.363874584f, 0.162999809f},
std::array<float,2>{0.710408807f, 0.890251458f},
std::array<float,2>{0.95439589f, 0.461832255f},
std::array<float,2>{0.1125395f, 0.679628849f},
std::array<float,2>{0.25779593f, 0.296648055f},
std::array<float,2>{0.672567427f, 0.504110515f},
std::array<float,2>{0.901059628f, 0.107459381f},
std::array<float,2>{0.0539135002f, 0.795703351f},
std::array<float,2>{0.201944828f, 0.204309106f},
std::array<float,2>{0.796888351f, 0.969450295f},
std::array<float,2>{0.544386208f, 0.422633141f},
std::array<float,2>{0.477800459f, 0.713211834f},
std::array<float,2>{0.0721779391f, 0.492438853f},
std::array<float,2>{0.975591123f, 0.631478488f},
std::array<float,2>{0.742352068f, 0.142953575f},
std::array<float,2>{0.336005032f, 0.930549264f},
std::array<float,2>{0.377450734f, 0.056400355f},
std::array<float,2>{0.617901981f, 0.817927361f},
std::array<float,2>{0.86000973f, 0.322401285f},
std::array<float,2>{0.133861601f, 0.590610027f},
std::array<float,2>{0.305624485f, 0.45634383f},
std::array<float,2>{0.625710309f, 0.686939001f},
std::array<float,2>{0.914150298f, 0.170482621f},
std::array<float,2>{0.0281495322f, 0.877280414f},
std::array<float,2>{0.236119881f, 0.00882353168f},
std::array<float,2>{0.76720506f, 0.8482126f},
std::array<float,2>{0.510917723f, 0.348513484f},
std::array<float,2>{0.454161555f, 0.600090563f},
std::array<float,2>{0.104267009f, 0.251531243f},
std::array<float,2>{0.95161289f, 0.56206274f},
std::array<float,2>{0.702200413f, 0.0650075749f},
std::array<float,2>{0.356628507f, 0.768387675f},
std::array<float,2>{0.426613241f, 0.222873285f},
std::array<float,2>{0.579748034f, 0.957752585f},
std::array<float,2>{0.829727948f, 0.394301802f},
std::array<float,2>{0.183986381f, 0.749839127f},
std::array<float,2>{0.488880873f, 0.318691462f},
std::array<float,2>{0.55229032f, 0.583149135f},
std::array<float,2>{0.795768142f, 0.0491557904f},
std::array<float,2>{0.204712138f, 0.824967682f},
std::array<float,2>{0.033940006f, 0.150889024f},
std::array<float,2>{0.881609797f, 0.926357806f},
std::array<float,2>{0.666270256f, 0.490397602f},
std::array<float,2>{0.276620626f, 0.636808634f},
std::array<float,2>{0.14979957f, 0.430740505f},
std::array<float,2>{0.855245113f, 0.705615044f},
std::array<float,2>{0.601351142f, 0.213013172f},
std::array<float,2>{0.394522399f, 0.982213855f},
std::array<float,2>{0.321881384f, 0.0955492705f},
std::array<float,2>{0.721234858f, 0.785817027f},
std::array<float,2>{0.986902654f, 0.28320837f},
std::array<float,2>{0.0827500373f, 0.515408754f},
std::array<float,2>{0.381119132f, 0.380274862f},
std::array<float,2>{0.622642159f, 0.732340634f},
std::array<float,2>{0.866367877f, 0.237366572f},
std::array<float,2>{0.140528053f, 0.941643417f},
std::array<float,2>{0.077747114f, 0.078662172f},
std::array<float,2>{0.970902741f, 0.751417637f},
std::array<float,2>{0.7471295f, 0.275457829f},
std::array<float,2>{0.343257427f, 0.542957842f},
std::array<float,2>{0.197386205f, 0.363769948f},
std::array<float,2>{0.801469028f, 0.609967768f},
std::array<float,2>{0.53962636f, 0.0252227131f},
std::array<float,2>{0.482166618f, 0.862605572f},
std::array<float,2>{0.251708567f, 0.174494818f},
std::array<float,2>{0.67948705f, 0.904485762f},
std::array<float,2>{0.904670954f, 0.447210878f},
std::array<float,2>{0.0497304797f, 0.664426148f},
std::array<float,2>{0.362496883f, 0.307294011f},
std::array<float,2>{0.705637455f, 0.520136714f},
std::array<float,2>{0.957201421f, 0.120499998f},
std::array<float,2>{0.116800487f, 0.804537714f},
std::array<float,2>{0.167789161f, 0.19538343f},
std::array<float,2>{0.817075789f, 0.988350809f},
std::array<float,2>{0.566075146f, 0.421304584f},
std::array<float,2>{0.415409058f, 0.698847771f},
std::array<float,2>{0.00207270542f, 0.479595423f},
std::array<float,2>{0.922473788f, 0.647069454f},
std::array<float,2>{0.647997797f, 0.133926839f},
std::array<float,2>{0.283971161f, 0.906439781f},
std::array<float,2>{0.44090876f, 0.0458451137f},
std::array<float,2>{0.52913934f, 0.829163015f},
std::array<float,2>{0.758733273f, 0.330996364f},
std::array<float,2>{0.22635223f, 0.564624667f},
std::array<float,2>{0.33195734f, 0.413998544f},
std::array<float,2>{0.735236883f, 0.688440561f},
std::array<float,2>{0.978267789f, 0.188985601f},
std::array<float,2>{0.0656402633f, 0.994310796f},
std::array<float,2>{0.132581636f, 0.115870461f},
std::array<float,2>{0.873090386f, 0.807765424f},
std::array<float,2>{0.616592646f, 0.302619159f},
std::array<float,2>{0.38739422f, 0.523508191f},
std::array<float,2>{0.0600479245f, 0.343455523f},
std::array<float,2>{0.891489983f, 0.574270427f},
std::array<float,2>{0.686240315f, 0.0368462056f},
std::array<float,2>{0.262681782f, 0.842972755f},
std::array<float,2>{0.476191074f, 0.128901213f},
std::array<float,2>{0.535647213f, 0.916430295f},
std::array<float,2>{0.808590829f, 0.476337165f},
std::array<float,2>{0.190054551f, 0.649273098f},
std::array<float,2>{0.408543378f, 0.270502865f},
std::array<float,2>{0.573027551f, 0.533948958f},
std::array<float,2>{0.823328972f, 0.0916120261f},
std::array<float,2>{0.158778623f, 0.759039819f},
std::array<float,2>{0.118825972f, 0.246158212f},
std::array<float,2>{0.963166773f, 0.946593344f},
std::array<float,2>{0.712755978f, 0.388125628f},
std::array<float,2>{0.36897108f, 0.722961187f},
std::array<float,2>{0.233445749f, 0.442166209f},
std::array<float,2>{0.753908217f, 0.663639784f},
std::array<float,2>{0.523311317f, 0.181796178f},
std::array<float,2>{0.447672725f, 0.89708358f},
std::array<float,2>{0.292191595f, 0.0179964788f},
std::array<float,2>{0.65182668f, 0.871820271f},
std::array<float,2>{0.935706019f, 0.372100145f},
std::array<float,2>{0.0109875072f, 0.618580997f},
std::array<float,2>{0.461993039f, 0.496493995f},
std::array<float,2>{0.504656017f, 0.626228392f},
std::array<float,2>{0.776194811f, 0.144601107f},
std::array<float,2>{0.244298577f, 0.937069714f},
std::array<float,2>{0.0163310897f, 0.0603304692f},
std::array<float,2>{0.91201812f, 0.816176891f},
std::array<float,2>{0.635701418f, 0.328067839f},
std::array<float,2>{0.299057961f, 0.586103678f},
std::array<float,2>{0.175211728f, 0.289795488f},
std::array<float,2>{0.836841702f, 0.502216697f},
std::array<float,2>{0.593472719f, 0.101612449f},
std::array<float,2>{0.434527367f, 0.791756749f},
std::array<float,2>{0.348077148f, 0.210366279f},
std::array<float,2>{0.68872726f, 0.972740233f},
std::array<float,2>{0.942132592f, 0.429072797f},
std::array<float,2>{0.100231104f, 0.715600789f},
std::array<float,2>{0.268105626f, 0.352449656f},
std::array<float,2>{0.659893632f, 0.602923751f},
std::array<float,2>{0.886128128f, 5.07316436e-05f},
std::array<float,2>{0.0456722192f, 0.859332979f},
std::array<float,2>{0.21841386f, 0.157276928f},
std::array<float,2>{0.787394822f, 0.885383725f},
std::array<float,2>{0.555461466f, 0.465108901f},
std::array<float,2>{0.499404788f, 0.675161481f},
std::array<float,2>{0.0918983296f, 0.405956686f},
std::array<float,2>{0.993260264f, 0.738128722f},
std::array<float,2>{0.731324673f, 0.233239144f},
std::array<float,2>{0.317082733f, 0.961882055f},
std::array<float,2>{0.399372071f, 0.0716809928f},
std::array<float,2>{0.607691288f, 0.779762447f},
std::array<float,2>{0.846603096f, 0.263863415f},
std::array<float,2>{0.144671187f, 0.554531991f},
std::array<float,2>{0.261089712f, 0.396979779f},
std::array<float,2>{0.681595206f, 0.744110167f},
std::array<float,2>{0.897386134f, 0.218758047f},
std::array<float,2>{0.0585174859f, 0.954353213f},
std::array<float,2>{0.194855884f, 0.0680137426f},
std::array<float,2>{0.811246812f, 0.773310006f},
std::array<float,2>{0.534169614f, 0.255081922f},
std::array<float,2>{0.469720274f, 0.558072686f},
std::array<float,2>{0.068079561f, 0.344089061f},
std::array<float,2>{0.981684923f, 0.59549135f},
std::array<float,2>{0.73843056f, 0.0134239923f},
std::array<float,2>{0.335432678f, 0.843782127f},
std::array<float,2>{0.386079788f, 0.167493746f},
std::array<float,2>{0.612706721f, 0.879011869f},
std::array<float,2>{0.869556427f, 0.459407926f},
std::array<float,2>{0.125649601f, 0.682186186f},
std::array<float,2>{0.451698333f, 0.287313372f},
std::array<float,2>{0.516206682f, 0.510873735f},
std::array<float,2>{0.752328038f, 0.100027442f},
std::array<float,2>{0.229167789f, 0.784918129f},
std::array<float,2>{0.0126432022f, 0.217731908f},
std::array<float,2>{0.931278229f, 0.979839563f},
std::array<float,2>{0.655417264f, 0.435463548f},
std::array<float,2>{0.292977959f, 0.710330129f},
std::array<float,2>{0.163860291f, 0.485352486f},
std::array<float,2>{0.825734019f, 0.634763956f},
std::array<float,2>{0.577389359f, 0.153934538f},
std::array<float,2>{0.414037764f, 0.922170103f},
std::array<float,2>{0.371735185f, 0.0525275283f},
std::array<float,2>{0.715826571f, 0.821805418f},
std::array<float,2>{0.968221784f, 0.315251142f},
std::array<float,2>{0.123297006f, 0.581666231f},
std::array<float,2>{0.433474004f, 0.452785164f},
std::array<float,2>{0.586816192f, 0.670377254f},
std::array<float,2>{0.840115905f, 0.178146824f},
std::array<float,2>{0.178197905f, 0.900642097f},
std::array<float,2>{0.0957740098f, 0.0285979472f},
std::array<float,2>{0.937806845f, 0.867132902f},
std::array<float,2>{0.693170667f, 0.361571103f},
std::array<float,2>{0.344286174f, 0.616583169f},
std::array<float,2>{0.247128516f, 0.278383791f},
std::array<float,2>{0.77867347f, 0.545667112f},
std::array<float,2>{0.502555549f, 0.0826689824f},
std::array<float,2>{0.468529344f, 0.757359862f},
std::array<float,2>{0.304201722f, 0.238971964f},
std::array<float,2>{0.638310909f, 0.939026356f},
std::array<float,2>{0.908699691f, 0.378465801f},
std::array<float,2>{0.0232372377f, 0.729900658f},
std::array<float,2>{0.312678128f, 0.333351463f},
std::array<float,2>{0.728798985f, 0.569686949f},
std::array<float,2>{0.99832052f, 0.0392261334f},
std::array<float,2>{0.0885071382f, 0.83424598f},
std::array<float,2>{0.142923385f, 0.13682425f},
std::array<float,2>{0.848109245f, 0.911387384f},
std::array<float,2>{0.602021277f, 0.484161615f},
std::array<float,2>{0.403092504f, 0.643332899f},
std::array<float,2>{0.0424099639f, 0.414384812f},
std::array<float,2>{0.889309704f, 0.702906787f},
std::array<float,2>{0.660721004f, 0.201551914f},
std::array<float,2>{0.273139447f, 0.987708211f},
std::array<float,2>{0.49573648f, 0.123427413f},
std::array<float,2>{0.55993551f, 0.800019026f},
std::array<float,2>{0.782083631f, 0.312310785f},
std::array<float,2>{0.21202074f, 0.516072094f},
std::array<float,2>{0.352373898f, 0.472301155f},
std::array<float,2>{0.695629358f, 0.653770268f},
std::array<float,2>{0.948868036f, 0.131130502f},
std::array<float,2>{0.109179407f, 0.918612778f},
std::array<float,2>{0.181222498f, 0.0325955115f},
std::array<float,2>{0.833091021f, 0.839324236f},
std::array<float,2>{0.585011482f, 0.336763144f},
std::array<float,2>{0.424598634f, 0.570393562f},
std::array<float,2>{0.0246092565f, 0.297368258f},
std::array<float,2>{0.920774221f, 0.530692399f},
std::array<float,2>{0.629870832f, 0.110721879f},
std::array<float,2>{0.3113015f, 0.809303403f},
std::array<float,2>{0.457414091f, 0.194375992f},
std::array<float,2>{0.514213502f, 0.999123633f},
std::array<float,2>{0.770423174f, 0.408896744f},
std::array<float,2>{0.239133611f, 0.693729162f},
std::array<float,2>{0.396728158f, 0.368476093f},
std::array<float,2>{0.595892549f, 0.624551475f},
std::array<float,2>{0.856675625f, 0.0204449389f},
std::array<float,2>{0.152821004f, 0.868573785f},
std::array<float,2>{0.0805657506f, 0.186100408f},
std::array<float,2>{0.988417447f, 0.89295125f},
std::array<float,2>{0.723599613f, 0.439588726f},
std::array<float,2>{0.325912416f, 0.656341314f},
std::array<float,2>{0.208789334f, 0.383248687f},
std::array<float,2>{0.790577888f, 0.719402373f},
std::array<float,2>{0.5501073f, 0.242970243f},
std::array<float,2>{0.486580908f, 0.95026356f},
std::array<float,2>{0.278475553f, 0.0888962597f},
std::array<float,2>{0.671854496f, 0.763154268f},
std::array<float,2>{0.87665695f, 0.268561751f},
std::array<float,2>{0.0389012508f, 0.537769735f},
std::array<float,2>{0.479492903f, 0.424821645f},
std::array<float,2>{0.546010315f, 0.711715162f},
std::array<float,2>{0.799257696f, 0.206951633f},
std::array<float,2>{0.199382946f, 0.972314596f},
std::array<float,2>{0.0514634252f, 0.105587199f},
std::array<float,2>{0.898886323f, 0.7944628f},
std::array<float,2>{0.674079776f, 0.294126183f},
std::array<float,2>{0.253988981f, 0.506985366f},
std::array<float,2>{0.135809913f, 0.322256625f},
std::array<float,2>{0.861632049f, 0.591882527f},
std::array<float,2>{0.62002337f, 0.0569600686f},
std::array<float,2>{0.37637049f, 0.819865465f},
std::array<float,2>{0.338072389f, 0.140741751f},
std::array<float,2>{0.745157182f, 0.931844592f},
std::array<float,2>{0.973950922f, 0.496080935f},
std::array<float,2>{0.0733549222f, 0.629641652f},
std::array<float,2>{0.286358416f, 0.259551495f},
std::array<float,2>{0.64373219f, 0.550603509f},
std::array<float,2>{0.927639365f, 0.0767618492f},
std::array<float,2>{0.0047864248f, 0.774618685f},
std::array<float,2>{0.219567284f, 0.229356587f},
std::array<float,2>{0.762979388f, 0.966000378f},
std::array<float,2>{0.524435043f, 0.398620278f},
std::array<float,2>{0.443693995f, 0.738678753f},
std::array<float,2>{0.11094407f, 0.464708f},
std::array<float,2>{0.955084622f, 0.675835013f},
std::array<float,2>{0.708632529f, 0.161695749f},
std::array<float,2>{0.365663379f, 0.886744797f},
std::array<float,2>{0.421051979f, 0.00616212049f},
std::array<float,2>{0.566825807f, 0.852029443f},
std::array<float,2>{0.816394091f, 0.356596559f},
std::array<float,2>{0.169814497f, 0.606299818f},
std::array<float,2>{0.299637824f, 0.498121828f},
std::array<float,2>{0.635040462f, 0.628245533f},
std::array<float,2>{0.911436856f, 0.147720009f},
std::array<float,2>{0.0159039423f, 0.935126781f},
std::array<float,2>{0.244932726f, 0.062090423f},
std::array<float,2>{0.775455058f, 0.812698245f},
std::array<float,2>{0.504257202f, 0.324802041f},
std::array<float,2>{0.462623656f, 0.589677751f},
std::array<float,2>{0.0996868387f, 0.292322546f},
std::array<float,2>{0.94149828f, 0.501820922f},
std::array<float,2>{0.689247012f, 0.104962856f},
std::array<float,2>{0.348462492f, 0.790349841f},
std::array<float,2>{0.433809072f, 0.207368538f},
std::array<float,2>{0.593204558f, 0.976430535f},
std::array<float,2>{0.836274862f, 0.427733898f},
std::array<float,2>{0.175390884f, 0.717632771f},
std::array<float,2>{0.499824375f, 0.354891837f},
std::array<float,2>{0.554804146f, 0.605173767f},
std::array<float,2>{0.787698865f, 0.00240923348f},
std::array<float,2>{0.217999697f, 0.856213272f},
std::array<float,2>{0.0452223606f, 0.159850314f},
std::array<float,2>{0.886279464f, 0.882842064f},
std::array<float,2>{0.659373224f, 0.46826008f},
std::array<float,2>{0.267769933f, 0.673609316f},
std::array<float,2>{0.145253688f, 0.403316617f},
std::array<float,2>{0.845992744f, 0.734719038f},
std::array<float,2>{0.608228207f, 0.230805188f},
std::array<float,2>{0.398891121f, 0.964038491f},
std::array<float,2>{0.316420972f, 0.0737083852f},
std::array<float,2>{0.730727732f, 0.778096199f},
std::array<float,2>{0.993672371f, 0.262838244f},
std::array<float,2>{0.0924175829f, 0.551562071f},
std::array<float,2>{0.387105107f, 0.411852896f},
std::array<float,2>{0.616891742f, 0.689893425f},
std::array<float,2>{0.873668194f, 0.191111684f},
std::array<float,2>{0.132133693f, 0.993879259f},
std::array<float,2>{0.066334866f, 0.115222126f},
std::array<float,2>{0.977869213f, 0.806554556f},
std::array<float,2>{0.73460418f, 0.303768754f},
std::array<float,2>{0.331421226f, 0.526803851f},
std::array<float,2>{0.18966645f, 0.339882046f},
std::array<float,2>{0.808088601f, 0.576660275f},
std::array<float,2>{0.535523653f, 0.0381956138f},
std::array<float,2>{0.475879878f, 0.840984464f},
std::array<float,2>{0.261857182f, 0.126058266f},
std::array<float,2>{0.685951412f, 0.914433002f},
std::array<float,2>{0.890705764f, 0.472841203f},
std::array<float,2>{0.0601108931f, 0.650903881f},
std::array<float,2>{0.368499845f, 0.271824718f},
std::array<float,2>{0.712138653f, 0.532095313f},
std::array<float,2>{0.963466883f, 0.0932632089f},
std::array<float,2>{0.118174411f, 0.761160731f},
std::array<float,2>{0.158362195f, 0.248325109f},
std::array<float,2>{0.823857188f, 0.948910296f},
std::array<float,2>{0.572277904f, 0.390559644f},
std::array<float,2>{0.409148693f, 0.726500392f},
std::array<float,2>{0.0116047896f, 0.444095641f},
std::array<float,2>{0.936366558f, 0.660324454f},
std::array<float,2>{0.652098298f, 0.180869773f},
std::array<float,2>{0.292664468f, 0.894659519f},
std::array<float,2>{0.448222727f, 0.0168784428f},
std::array<float,2>{0.5227952f, 0.874710441f},
std::array<float,2>{0.754719079f, 0.373133391f},
std::array<float,2>{0.234126955f, 0.620458603f},
std::array<float,2>{0.343598425f, 0.381640255f},
std::array<float,2>{0.747831345f, 0.734301388f},
std::array<float,2>{0.971669853f, 0.235721633f},
std::array<float,2>{0.0775047541f, 0.944244385f},
std::array<float,2>{0.139872804f, 0.0810895786f},
std::array<float,2>{0.866761148f, 0.753105521f},
std::array<float,2>{0.622080684f, 0.273629427f},
std::array<float,2>{0.381407678f, 0.540697932f},
std::array<float,2>{0.0489375517f, 0.365258664f},
std::array<float,2>{0.905151665f, 0.612113237f},
std::array<float,2>{0.679178596f, 0.0263806731f},
std::array<float,2>{0.251144588f, 0.860918462f},
std::array<float,2>{0.48179251f, 0.172029242f},
std::array<float,2>{0.539513648f, 0.902793884f},
std::array<float,2>{0.801165819f, 0.447485626f},
std::array<float,2>{0.198166952f, 0.667292714f},
std::array<float,2>{0.415832549f, 0.305970967f},
std::array<float,2>{0.565852582f, 0.522190988f},
std::array<float,2>{0.816689312f, 0.118348293f},
std::array<float,2>{0.167457923f, 0.800799191f},
std::array<float,2>{0.116600238f, 0.1975016f},
std::array<float,2>{0.957778037f, 0.990416646f},
std::array<float,2>{0.70521909f, 0.419181675f},
std::array<float,2>{0.363233179f, 0.697056055f},
std::array<float,2>{0.226054266f, 0.476839751f},
std::array<float,2>{0.758238375f, 0.645545065f},
std::array<float,2>{0.528551996f, 0.13616325f},
std::array<float,2>{0.441135108f, 0.908471823f},
std::array<float,2>{0.283288628f, 0.0443113483f},
std::array<float,2>{0.647855163f, 0.830403388f},
std::array<float,2>{0.921901524f, 0.32897836f},
std::array<float,2>{0.00290793553f, 0.563599169f},
std::array<float,2>{0.454743087f, 0.453307599f},
std::array<float,2>{0.511406004f, 0.683696806f},
std::array<float,2>{0.766809225f, 0.168015912f},
std::array<float,2>{0.235519096f, 0.876557648f},
std::array<float,2>{0.0277495813f, 0.0107242921f},
std::array<float,2>{0.914689004f, 0.849792004f},
std::array<float,2>{0.625102043f, 0.349740863f},
std::array<float,2>{0.305037916f, 0.598002911f},
std::array<float,2>{0.184177384f, 0.253502518f},
std::array<float,2>{0.829322278f, 0.559336305f},
std::array<float,2>{0.579229295f, 0.0633549914f},
std::array<float,2>{0.42611137f, 0.766108692f},
std::array<float,2>{0.3569628f, 0.225610241f},
std::array<float,2>{0.702902794f, 0.959852159f},
std::array<float,2>{0.952046573f, 0.391886652f},
std::array<float,2>{0.103723362f, 0.747191966f},
std::array<float,2>{0.277178377f, 0.317764133f},
std::array<float,2>{0.666673779f, 0.584721267f},
std::array<float,2>{0.880947351f, 0.0483326241f},
std::array<float,2>{0.0334051065f, 0.827515244f},
std::array<float,2>{0.204164103f, 0.14878644f},
std::array<float,2>{0.795406818f, 0.928401172f},
std::array<float,2>{0.552090406f, 0.488934249f},
std::array<float,2>{0.488329768f, 0.639961183f},
std::array<float,2>{0.0821337402f, 0.432738245f},
std::array<float,2>{0.986468732f, 0.704759836f},
std::array<float,2>{0.721108198f, 0.211482182f},
std::array<float,2>{0.32163012f, 0.982526779f},
std::array<float,2>{0.3935799f, 0.0963558108f},
std::array<float,2>{0.600652874f, 0.78878963f},
std::array<float,2>{0.85478735f, 0.282016367f},
std::array<float,2>{0.150118962f, 0.513417363f},
std::array<float,2>{0.254521191f, 0.421986967f},
std::array<float,2>{0.674679279f, 0.713797748f},
std::array<float,2>{0.898932397f, 0.204699486f},
std::array<float,2>{0.0512231439f, 0.968889713f},
std::array<float,2>{0.199999824f, 0.108216539f},
std::array<float,2>{0.799624324f, 0.795409679f},
std::array<float,2>{0.546450675f, 0.295971155f},
std::array<float,2>{0.480263799f, 0.50458771f},
std::array<float,2>{0.0740410164f, 0.322765052f},
std::array<float,2>{0.974388063f, 0.590209365f},
std::array<float,2>{0.745629013f, 0.0557211973f},
std::array<float,2>{0.338461727f, 0.817433238f},
std::array<float,2>{0.37660715f, 0.143209741f},
std::array<float,2>{0.619223893f, 0.92971313f},
std::array<float,2>{0.861948133f, 0.492685109f},
std::array<float,2>{0.136658818f, 0.630927026f},
std::array<float,2>{0.44397071f, 0.260947615f},
std::array<float,2>{0.525176108f, 0.54861021f},
std::array<float,2>{0.763307869f, 0.0757051706f},
std::array<float,2>{0.219130754f, 0.775942206f},
std::array<float,2>{0.00433821371f, 0.227409452f},
std::array<float,2>{0.927183867f, 0.967258573f},
std::array<float,2>{0.644112527f, 0.400984585f},
std::array<float,2>{0.286792189f, 0.74190563f},
std::array<float,2>{0.169286311f, 0.461242318f},
std::array<float,2>{0.815674305f, 0.679162741f},
std::array<float,2>{0.567238033f, 0.162358791f},
std::array<float,2>{0.421693832f, 0.889952719f},
std::array<float,2>{0.365870804f, 0.00476187747f},
std::array<float,2>{0.708456039f, 0.854547083f},
std::array<float,2>{0.955966532f, 0.35762009f},
std::array<float,2>{0.110378347f, 0.607882917f},
std::array<float,2>{0.424026221f, 0.469790429f},
std::array<float,2>{0.585583389f, 0.654505372f},
std::array<float,2>{0.833575964f, 0.129337296f},
std::array<float,2>{0.181132972f, 0.92164129f},
std::array<float,2>{0.108594127f, 0.0338828564f},
std::array<float,2>{0.948573053f, 0.837064087f},
std::array<float,2>{0.696131289f, 0.338811934f},
std::array<float,2>{0.351722449f, 0.572588027f},
std::array<float,2>{0.238605618f, 0.299904734f},
std::array<float,2>{0.769980907f, 0.528465807f},
std::array<float,2>{0.513770163f, 0.111654036f},
std::array<float,2>{0.457679689f, 0.811319947f},
std::array<float,2>{0.310928375f, 0.192960232f},
std::array<float,2>{0.628914535f, 0.997194231f},
std::array<float,2>{0.919985592f, 0.4073264f},
std::array<float,2>{0.0249895919f, 0.691647828f},
std::array<float,2>{0.325659215f, 0.369864941f},
std::array<float,2>{0.723012567f, 0.622408688f},
std::array<float,2>{0.989070833f, 0.0220273137f},
std::array<float,2>{0.0809117407f, 0.870527685f},
std::array<float,2>{0.15306811f, 0.183792189f},
std::array<float,2>{0.857248902f, 0.8924703f},
std::array<float,2>{0.596413434f, 0.4377276f},
std::array<float,2>{0.397231519f, 0.659682631f},
std::array<float,2>{0.0384049639f, 0.386422276f},
std::array<float,2>{0.876240253f, 0.721631825f},
std::array<float,2>{0.671321273f, 0.244937509f},
std::array<float,2>{0.278904289f, 0.952255189f},
std::array<float,2>{0.487226158f, 0.0862445086f},
std::array<float,2>{0.550355196f, 0.764679432f},
std::array<float,2>{0.790206075f, 0.266265124f},
std::array<float,2>{0.208225161f, 0.537107468f},
std::array<float,2>{0.34416315f, 0.44994843f},
std::array<float,2>{0.692400098f, 0.668938935f},
std::array<float,2>{0.93822068f, 0.17609489f},
std::array<float,2>{0.0964064151f, 0.898773551f},
std::array<float,2>{0.178253099f, 0.0306518227f},
std::array<float,2>{0.840448678f, 0.864422262f},
std::array<float,2>{0.585960627f, 0.359685302f},
std::array<float,2>{0.432815284f, 0.614126027f},
std::array<float,2>{0.0229282789f, 0.281126648f},
std::array<float,2>{0.908381701f, 0.544073284f},
std::array<float,2>{0.637709022f, 0.0859130919f},
std::array<float,2>{0.303978682f, 0.755713701f},
std::array<float,2>{0.468113333f, 0.24098818f},
std::array<float,2>{0.502019167f, 0.940949202f},
std::array<float,2>{0.778898954f, 0.376577914f},
std::array<float,2>{0.24772571f, 0.728488266f},
std::array<float,2>{0.402784884f, 0.335141301f},
std::array<float,2>{0.602168083f, 0.566960752f},
std::array<float,2>{0.848160267f, 0.0422209948f},
std::array<float,2>{0.143423125f, 0.833015144f},
std::array<float,2>{0.0882771239f, 0.139940739f},
std::array<float,2>{0.99863106f, 0.912344813f},
std::array<float,2>{0.729428113f, 0.481242508f},
std::array<float,2>{0.313283354f, 0.642107606f},
std::array<float,2>{0.212509155f, 0.41750896f},
std::array<float,2>{0.7814219f, 0.699413121f},
std::array<float,2>{0.560059309f, 0.200430974f},
std::array<float,2>{0.495122343f, 0.984558642f},
std::array<float,2>{0.272763789f, 0.121619776f},
std::array<float,2>{0.660183251f, 0.79848212f},
std::array<float,2>{0.88868922f, 0.309912086f},
std::array<float,2>{0.0426403098f, 0.519150019f},
std::array<float,2>{0.468751997f, 0.396100372f},
std::array<float,2>{0.533522487f, 0.7446661f},
std::array<float,2>{0.810997963f, 0.221941218f},
std::array<float,2>{0.194743633f, 0.956969738f},
std::array<float,2>{0.0578551032f, 0.069696039f},
std::array<float,2>{0.896767795f, 0.77007246f},
std::array<float,2>{0.680977225f, 0.256538004f},
std::array<float,2>{0.26126501f, 0.556360722f},
std::array<float,2>{0.125401869f, 0.346377581f},
std::array<float,2>{0.8699103f, 0.596344173f},
std::array<float,2>{0.612980187f, 0.0144601855f},
std::array<float,2>{0.386571586f, 0.846286058f},
std::array<float,2>{0.335761875f, 0.1658694f},
std::array<float,2>{0.739200294f, 0.882190645f},
std::array<float,2>{0.982034564f, 0.45767042f},
std::array<float,2>{0.0676436275f, 0.681108296f},
std::array<float,2>{0.293812275f, 0.286502212f},
std::array<float,2>{0.656033576f, 0.509549856f},
std::array<float,2>{0.930742443f, 0.098108694f},
std::array<float,2>{0.0119360825f, 0.781794727f},
std::array<float,2>{0.228640959f, 0.216219991f},
std::array<float,2>{0.752859652f, 0.978109896f},
std::array<float,2>{0.515708923f, 0.435800254f},
std::array<float,2>{0.451645017f, 0.708654523f},
std::array<float,2>{0.123751789f, 0.486865282f},
std::array<float,2>{0.968288481f, 0.63482523f},
std::array<float,2>{0.71651268f, 0.156172335f},
std::array<float,2>{0.371542692f, 0.923840702f},
std::array<float,2>{0.413473129f, 0.0531250536f},
std::array<float,2>{0.577893972f, 0.824045002f},
std::array<float,2>{0.825674772f, 0.313120484f},
std::array<float,2>{0.163166314f, 0.5784114f},
std::array<float,2>{0.267092377f, 0.4655734f},
std::array<float,2>{0.657026231f, 0.67563206f},
std::array<float,2>{0.883660674f, 0.158038765f},
std::array<float,2>{0.0430960394f, 0.884966433f},
std::array<float,2>{0.216759041f, 0.000521697511f},
std::array<float,2>{0.78686893f, 0.858578861f},
std::array<float,2>{0.557571173f, 0.351975203f},
std::array<float,2>{0.497636586f, 0.603482902f},
std::array<float,2>{0.0903743431f, 0.26445207f},
std::array<float,2>{0.996051133f, 0.553850532f},
std::array<float,2>{0.732653737f, 0.0718215704f},
std::array<float,2>{0.320255101f, 0.78003943f},
std::array<float,2>{0.401559949f, 0.232885376f},
std::array<float,2>{0.607290626f, 0.960996389f},
std::array<float,2>{0.844290853f, 0.405506581f},
std::array<float,2>{0.146825835f, 0.73757118f},
std::array<float,2>{0.464792699f, 0.327178627f},
std::array<float,2>{0.507292867f, 0.586892545f},
std::array<float,2>{0.773613632f, 0.0598381199f},
std::array<float,2>{0.244116619f, 0.815648377f},
std::array<float,2>{0.0183099117f, 0.14525266f},
std::array<float,2>{0.912387013f, 0.936800241f},
std::array<float,2>{0.633899391f, 0.496865749f},
std::array<float,2>{0.29747951f, 0.626693964f},
std::array<float,2>{0.17307891f, 0.429628462f},
std::array<float,2>{0.839028239f, 0.715236604f},
std::array<float,2>{0.590064943f, 0.210627571f},
std::array<float,2>{0.436930597f, 0.973385096f},
std::array<float,2>{0.351259321f, 0.102459177f},
std::array<float,2>{0.690355182f, 0.791421533f},
std::array<float,2>{0.943443894f, 0.28934744f},
std::array<float,2>{0.0980613083f, 0.502711296f},
std::array<float,2>{0.407573193f, 0.388491541f},
std::array<float,2>{0.570529819f, 0.723317027f},
std::array<float,2>{0.822038651f, 0.246739089f},
std::array<float,2>{0.157265618f, 0.946907938f},
std::array<float,2>{0.120883085f, 0.0910952464f},
std::array<float,2>{0.961990714f, 0.759658039f},
std::array<float,2>{0.713667929f, 0.269785136f},
std::array<float,2>{0.369454056f, 0.533230901f},
std::array<float,2>{0.231374234f, 0.372561753f},
std::array<float,2>{0.755937934f, 0.618826389f},
std::array<float,2>{0.520794332f, 0.0182374213f},
std::array<float,2>{0.446674913f, 0.871491134f},
std::array<float,2>{0.289578497f, 0.182581261f},
std::array<float,2>{0.65011996f, 0.89696151f},
std::array<float,2>{0.935243011f, 0.441613734f},
std::array<float,2>{0.00926912017f, 0.663523793f},
std::array<float,2>{0.329885215f, 0.302122444f},
std::array<float,2>{0.736608207f, 0.524326622f},
std::array<float,2>{0.980045855f, 0.115715533f},
std::array<float,2>{0.0627104267f, 0.808203816f},
std::array<float,2>{0.129414424f, 0.188660711f},
std::array<float,2>{0.872748613f, 0.994950831f},
std::array<float,2>{0.61349982f, 0.413427144f},
std::array<float,2>{0.390092254f, 0.687565744f},
std::array<float,2>{0.0621650703f, 0.47594139f},
std::array<float,2>{0.894014239f, 0.648493409f},
std::array<float,2>{0.684336841f, 0.1283333f},
std::array<float,2>{0.26521793f, 0.916862845f},
std::array<float,2>{0.472923189f, 0.03655627f},
std::array<float,2>{0.538483799f, 0.843353808f},
std::array<float,2>{0.804840326f, 0.343194783f},
std::array<float,2>{0.188393354f, 0.575130165f},
std::array<float,2>{0.360019147f, 0.421603799f},
std::array<float,2>{0.703700781f, 0.698490679f},
std::array<float,2>{0.960614383f, 0.196270838f},
std::array<float,2>{0.114000782f, 0.989057899f},
std::array<float,2>{0.165365174f, 0.121053778f},
std::array<float,2>{0.819299698f, 0.803755999f},
std::array<float,2>{0.564280868f, 0.307047158f},
std::array<float,2>{0.416513205f, 0.519792557f},
std::array<float,2>{0.000132587593f, 0.330166429f},
std::array<float,2>{0.925507605f, 0.565149546f},
std::array<float,2>{0.646289766f, 0.045109503f},
std::array<float,2>{0.281687647f, 0.830058873f},
std::array<float,2>{0.437522978f, 0.134461045f},
std::array<float,2>{0.529989719f, 0.90704459f},
std::array<float,2>{0.760961652f, 0.480427533f},
std::array<float,2>{0.224222466f, 0.646913648f},
std::array<float,2>{0.379965186f, 0.276209354f},
std::array<float,2>{0.624230504f, 0.542085052f},
std::array<float,2>{0.864060283f, 0.0784682855f},
std::array<float,2>{0.137288406f, 0.751617432f},
std::array<float,2>{0.075003989f, 0.237848327f},
std::array<float,2>{0.969832897f, 0.94191736f},
std::array<float,2>{0.748080194f, 0.380757809f},
std::array<float,2>{0.340433538f, 0.731460929f},
std::array<float,2>{0.196985304f, 0.446378469f},
std::array<float,2>{0.804682076f, 0.664560854f},
std::array<float,2>{0.542906165f, 0.174234286f},
std::array<float,2>{0.483599812f, 0.905188262f},
std::array<float,2>{0.251966387f, 0.0248556547f},
std::array<float,2>{0.676495373f, 0.862887681f},
std::array<float,2>{0.903505564f, 0.36362654f},
std::array<float,2>{0.0475928448f, 0.609401703f},
std::array<float,2>{0.49167192f, 0.49099049f},
std::array<float,2>{0.552889585f, 0.637246132f},
std::array<float,2>{0.793799758f, 0.150661305f},
std::array<float,2>{0.206215173f, 0.925916612f},
std::array<float,2>{0.0315945931f, 0.0497099906f},
std::array<float,2>{0.880212367f, 0.824426413f},
std::array<float,2>{0.664419889f, 0.319213778f},
std::array<float,2>{0.274085373f, 0.583927751f},
std::array<float,2>{0.151060313f, 0.284143269f},
std::array<float,2>{0.852067828f, 0.514988303f},
std::array<float,2>{0.598922789f, 0.0949134901f},
std::array<float,2>{0.391257644f, 0.785166085f},
std::array<float,2>{0.322665393f, 0.213522881f},
std::array<float,2>{0.719757199f, 0.981493056f},
std::array<float,2>{0.985446632f, 0.431625903f},
std::array<float,2>{0.0841021314f, 0.705091f},
std::array<float,2>{0.306803674f, 0.347673327f},
std::array<float,2>{0.628283739f, 0.600292623f},
std::array<float,2>{0.917747498f, 0.00975106936f},
std::array<float,2>{0.0295604225f, 0.847658515f},
std::array<float,2>{0.237183899f, 0.170311064f},
std::array<float,2>{0.76761508f, 0.877778769f},
std::array<float,2>{0.507866561f, 0.456650108f},
std::array<float,2>{0.455214322f, 0.687311172f},
std::array<float,2>{0.10347186f, 0.393851489f},
std::array<float,2>{0.949848175f, 0.74948442f},
std::array<float,2>{0.700430334f, 0.223311692f},
std::array<float,2>{0.357590437f, 0.95743233f},
std::array<float,2>{0.42947343f, 0.0648477152f},
std::array<float,2>{0.580393851f, 0.768050909f},
std::array<float,2>{0.831356585f, 0.251170307f},
std::array<float,2>{0.187462822f, 0.561784387f},
std::array<float,2>{0.288096309f, 0.399277776f},
std::array<float,2>{0.641617656f, 0.739112556f},
std::array<float,2>{0.929117143f, 0.228923902f},
std::array<float,2>{0.00695675379f, 0.966587365f},
std::array<float,2>{0.22102268f, 0.0766311511f},
std::array<float,2>{0.76534766f, 0.775071859f},
std::array<float,2>{0.525467753f, 0.259016514f},
std::array<float,2>{0.44260034f, 0.550208151f},
std::array<float,2>{0.11293973f, 0.357390672f},
std::array<float,2>{0.955073118f, 0.605522096f},
std::array<float,2>{0.710727632f, 0.00669424376f},
std::array<float,2>{0.363380671f, 0.852401137f},
std::array<float,2>{0.419297963f, 0.161255121f},
std::array<float,2>{0.570168376f, 0.88728261f},
std::array<float,2>{0.813184559f, 0.464164555f},
std::array<float,2>{0.171464726f, 0.676314116f},
std::array<float,2>{0.478386194f, 0.294853956f},
std::array<float,2>{0.54491353f, 0.507634878f},
std::array<float,2>{0.7978369f, 0.106070921f},
std::array<float,2>{0.201572329f, 0.794399261f},
std::array<float,2>{0.0543524474f, 0.206137478f},
std::array<float,2>{0.900664628f, 0.972166777f},
std::array<float,2>{0.672298253f, 0.425371855f},
std::array<float,2>{0.257231444f, 0.711376905f},
std::array<float,2>{0.13452214f, 0.495169133f},
std::array<float,2>{0.859547675f, 0.62926954f},
std::array<float,2>{0.617345154f, 0.141311675f},
std::array<float,2>{0.376970023f, 0.932144344f},
std::array<float,2>{0.336698949f, 0.0575264655f},
std::array<float,2>{0.742943883f, 0.819806576f},
std::array<float,2>{0.976453185f, 0.321290493f},
std::array<float,2>{0.071556665f, 0.592402458f},
std::array<float,2>{0.394658655f, 0.439977676f},
std::array<float,2>{0.594010115f, 0.657102466f},
std::array<float,2>{0.857712984f, 0.18559736f},
std::array<float,2>{0.155759096f, 0.893251836f},
std::array<float,2>{0.0787482411f, 0.0198922027f},
std::array<float,2>{0.990448534f, 0.868723392f},
std::array<float,2>{0.72567445f, 0.369115174f},
std::array<float,2>{0.32728681f, 0.62426734f},
std::array<float,2>{0.209599137f, 0.269463092f},
std::array<float,2>{0.792394698f, 0.537245393f},
std::array<float,2>{0.548675478f, 0.089559786f},
std::array<float,2>{0.485303849f, 0.763585269f},
std::array<float,2>{0.280636251f, 0.242534667f},
std::array<float,2>{0.669317007f, 0.95103544f},
std::array<float,2>{0.877013862f, 0.383611619f},
std::array<float,2>{0.0366427526f, 0.71920085f},
std::array<float,2>{0.353917718f, 0.336365432f},
std::array<float,2>{0.697313488f, 0.571056366f},
std::array<float,2>{0.946410835f, 0.0329937935f},
std::array<float,2>{0.107057624f, 0.839716733f},
std::array<float,2>{0.18167074f, 0.131428882f},
std::array<float,2>{0.834535956f, 0.917993903f},
std::array<float,2>{0.582615077f, 0.471894592f},
std::array<float,2>{0.422487825f, 0.654004097f},
std::array<float,2>{0.0263920669f, 0.408270657f},
std::array<float,2>{0.918493569f, 0.694047153f},
std::array<float,2>{0.632799685f, 0.194890708f},
std::array<float,2>{0.309597731f, 0.999807239f},
std::array<float,2>{0.460888773f, 0.111064978f},
std::array<float,2>{0.513081133f, 0.809004486f},
std::array<float,2>{0.772580087f, 0.297357172f},
std::array<float,2>{0.240432099f, 0.530857801f},
std::array<float,2>{0.314774394f, 0.483553857f},
std::array<float,2>{0.726742744f, 0.642990947f},
std::array<float,2>{0.996550679f, 0.137276396f},
std::array<float,2>{0.0865968838f, 0.911875069f},
std::array<float,2>{0.141197369f, 0.0396760851f},
std::array<float,2>{0.850828707f, 0.834690094f},
std::array<float,2>{0.604256511f, 0.333544254f},
std::array<float,2>{0.405873984f, 0.570257783f},
std::array<float,2>{0.0407970175f, 0.311650187f},
std::array<float,2>{0.887074172f, 0.51638478f},
std::array<float,2>{0.66364193f, 0.123858668f},
std::array<float,2>{0.270195067f, 0.800738811f},
std::array<float,2>{0.493002445f, 0.202140421f},
std::array<float,2>{0.561542928f, 0.987854064f},
std::array<float,2>{0.783214569f, 0.414986044f},
std::array<float,2>{0.21451959f, 0.702448845f},
std::array<float,2>{0.430028468f, 0.362279296f},
std::array<float,2>{0.588267267f, 0.617154956f},
std::array<float,2>{0.842396677f, 0.0290071517f},
std::array<float,2>{0.176143944f, 0.866415918f},
std::array<float,2>{0.0941901356f, 0.178254753f},
std::array<float,2>{0.94111222f, 0.901365399f},
std::array<float,2>{0.694792867f, 0.452345371f},
std::array<float,2>{0.347254395f, 0.670680404f},
std::array<float,2>{0.248086542f, 0.378193706f},
std::array<float,2>{0.779943943f, 0.730394661f},
std::array<float,2>{0.501086354f, 0.238445267f},
std::array<float,2>{0.4654558f, 0.938926041f},
std::array<float,2>{0.30081892f, 0.082072854f},
std::array<float,2>{0.639801085f, 0.757066488f},
std::array<float,2>{0.90808624f, 0.278906226f},
std::array<float,2>{0.020404581f, 0.545394063f},
std::array<float,2>{0.449508607f, 0.435051978f},
std::array<float,2>{0.519254029f, 0.710764706f},
std::array<float,2>{0.751245022f, 0.216804266f},
std::array<float,2>{0.227436945f, 0.980243981f},
std::array<float,2>{0.0147742489f, 0.100123368f},
std::array<float,2>{0.932156026f, 0.784540832f},
std::array<float,2>{0.653270125f, 0.287904799f},
std::array<float,2>{0.295047641f, 0.511250257f},
std::array<float,2>{0.160732821f, 0.314913124f},
std::array<float,2>{0.827723026f, 0.581300795f},
std::array<float,2>{0.575206399f, 0.0519819818f},
std::array<float,2>{0.410242468f, 0.82134378f},
std::array<float,2>{0.373270273f, 0.153442383f},
std::array<float,2>{0.717031777f, 0.92277211f},
std::array<float,2>{0.966629863f, 0.485966206f},
std::array<float,2>{0.122478999f, 0.634264708f},
std::array<float,2>{0.259412259f, 0.255438089f},
std::array<float,2>{0.683526337f, 0.558473766f},
std::array<float,2>{0.895614326f, 0.0677791685f},
std::array<float,2>{0.0547173694f, 0.772923589f},
std::array<float,2>{0.192097932f, 0.21929203f},
std::array<float,2>{0.809637725f, 0.954678416f},
std::array<float,2>{0.532174766f, 0.396510631f},
std::array<float,2>{0.471328586f, 0.743418634f},
std::array<float,2>{0.0693027303f, 0.45952329f},
std::array<float,2>{0.984204352f, 0.682099998f},
std::array<float,2>{0.740893602f, 0.167143419f},
std::array<float,2>{0.333971977f, 0.879537046f},
std::array<float,2>{0.38342309f, 0.012882988f},
std::array<float,2>{0.611117184f, 0.844369352f},
std::array<float,2>{0.868244171f, 0.344560444f},
std::array<float,2>{0.127347738f, 0.594792187f},
std::array<float,2>{0.263946146f, 0.474507481f},
std::array<float,2>{0.685050189f, 0.651482463f},
std::array<float,2>{0.892634273f, 0.125528067f},
std::array<float,2>{0.0608950518f, 0.915269077f},
std::array<float,2>{0.188790455f, 0.0372307375f},
std::array<float,2>{0.806431055f, 0.840254843f},
std::array<float,2>{0.537371516f, 0.341294318f},
std::array<float,2>{0.474394739f, 0.577901185f},
std::array<float,2>{0.0637748539f, 0.303273141f},
std::array<float,2>{0.978881896f, 0.525711596f},
std::array<float,2>{0.737433314f, 0.113726787f},
std::array<float,2>{0.328458607f, 0.805379093f},
std::array<float,2>{0.388756216f, 0.189569771f},
std::array<float,2>{0.614481926f, 0.99236387f},
std::array<float,2>{0.871484935f, 0.410935849f},
std::array<float,2>{0.130084887f, 0.690535843f},
std::array<float,2>{0.445850432f, 0.374438822f},
std::array<float,2>{0.519548655f, 0.619731784f},
std::array<float,2>{0.757451415f, 0.0158797894f},
std::array<float,2>{0.232171357f, 0.873515248f},
std::array<float,2>{0.00808712281f, 0.180605441f},
std::array<float,2>{0.934443593f, 0.896096408f},
std::array<float,2>{0.648483694f, 0.445113122f},
std::array<float,2>{0.290558517f, 0.661272049f},
std::array<float,2>{0.156907618f, 0.389225215f},
std::array<float,2>{0.820970237f, 0.724774063f},
std::array<float,2>{0.57218951f, 0.249041036f},
std::array<float,2>{0.407211095f, 0.947969079f},
std::array<float,2>{0.370162368f, 0.0924193263f},
std::array<float,2>{0.714484751f, 0.760683894f},
std::array<float,2>{0.96181953f, 0.272537112f},
std::array<float,2>{0.119296744f, 0.532594025f},
std::array<float,2>{0.436143309f, 0.426590294f},
std::array<float,2>{0.591663897f, 0.718098521f},
std::array<float,2>{0.838602483f, 0.208806783f},
std::array<float,2>{0.172765732f, 0.975281239f},
std::array<float,2>{0.0995192304f, 0.104135521f},
std::array<float,2>{0.94456768f, 0.789935708f},
std::array<float,2>{0.690678716f, 0.291624159f},
std::array<float,2>{0.350115001f, 0.500038028f},
std::array<float,2>{0.242506117f, 0.325698614f},
std::array<float,2>{0.775357068f, 0.588398933f},
std::array<float,2>{0.506469071f, 0.0607441664f},
std::array<float,2>{0.463053435f, 0.814258933f},
std::array<float,2>{0.298769861f, 0.147104815f},
std::array<float,2>{0.633499444f, 0.933722258f},
std::array<float,2>{0.913581491f, 0.499551564f},
std::array<float,2>{0.0186311454f, 0.627129853f},
std::array<float,2>{0.318487883f, 0.261836439f},
std::array<float,2>{0.734238803f, 0.552286625f},
std::array<float,2>{0.994678855f, 0.0731897056f},
std::array<float,2>{0.0917039961f, 0.779126346f},
std::array<float,2>{0.147907481f, 0.23201324f},
std::array<float,2>{0.845369697f, 0.96354866f},
std::array<float,2>{0.605723858f, 0.404207468f},
std::array<float,2>{0.401346743f, 0.736168742f},
std::array<float,2>{0.0440440886f, 0.46750918f},
std::array<float,2>{0.884414017f, 0.672722757f},
std::array<float,2>{0.657651365f, 0.158217132f},
std::array<float,2>{0.265680134f, 0.883971751f},
std::array<float,2>{0.496602565f, 0.00308623794f},
std::array<float,2>{0.558100581f, 0.856669664f},
std::array<float,2>{0.785329163f, 0.353881091f},
std::array<float,2>{0.215236872f, 0.60403347f},
std::array<float,2>{0.359250605f, 0.390879393f},
std::array<float,2>{0.699912727f, 0.746749818f},
std::array<float,2>{0.950887859f, 0.225085393f},
std::array<float,2>{0.102535836f, 0.96043998f},
std::array<float,2>{0.185659379f, 0.0639879555f},
std::array<float,2>{0.830649078f, 0.766933739f},
std::array<float,2>{0.581516445f, 0.252076447f},
std::array<float,2>{0.428576857f, 0.559892178f},
std::array<float,2>{0.0309395306f, 0.350600451f},
std::array<float,2>{0.916016996f, 0.59951669f},
std::array<float,2>{0.62761724f, 0.011074204f},
std::array<float,2>{0.307775736f, 0.851344228f},
std::array<float,2>{0.4566603f, 0.169281796f},
std::array<float,2>{0.509572446f, 0.875469387f},
std::array<float,2>{0.768958628f, 0.454809099f},
std::array<float,2>{0.237908706f, 0.685305178f},
std::array<float,2>{0.392472833f, 0.282644749f},
std::array<float,2>{0.59848702f, 0.511857569f},
std::array<float,2>{0.853077352f, 0.0968466327f},
std::array<float,2>{0.151958823f, 0.787836373f},
std::array<float,2>{0.0849977061f, 0.212159783f},
std::array<float,2>{0.984726489f, 0.983473897f},
std::array<float,2>{0.719107985f, 0.432130218f},
std::array<float,2>{0.323391706f, 0.703312278f},
std::array<float,2>{0.205581576f, 0.490201026f},
std::array<float,2>{0.794133723f, 0.638893604f},
std::array<float,2>{0.554416418f, 0.14969638f},
std::array<float,2>{0.490737557f, 0.929522038f},
std::array<float,2>{0.274719834f, 0.0478188358f},
std::array<float,2>{0.665816605f, 0.826620698f},
std::array<float,2>{0.879515767f, 0.316848159f},
std::array<float,2>{0.0325635262f, 0.585404098f},
std::array<float,2>{0.482991844f, 0.448422194f},
std::array<float,2>{0.541263402f, 0.666028619f},
std::array<float,2>{0.803421438f, 0.173209816f},
std::array<float,2>{0.19588384f, 0.903344929f},
std::array<float,2>{0.048042357f, 0.025468234f},
std::array<float,2>{0.903080285f, 0.859638512f},
std::array<float,2>{0.677431285f, 0.366853625f},
std::array<float,2>{0.253388137f, 0.613150239f},
std::array<float,2>{0.138274059f, 0.275260657f},
std::array<float,2>{0.864928246f, 0.539167583f},
std::array<float,2>{0.623425663f, 0.0803028941f},
std::array<float,2>{0.379183084f, 0.751973271f},
std::array<float,2>{0.341600418f, 0.234816939f},
std::array<float,2>{0.749603927f, 0.944371402f},
std::array<float,2>{0.968919992f, 0.382727802f},
std::array<float,2>{0.0754887834f, 0.732879937f},
std::array<float,2>{0.282809794f, 0.329740763f},
std::array<float,2>{0.644773424f, 0.562740266f},
std::array<float,2>{0.924421847f, 0.0433852673f},
std::array<float,2>{0.00127553241f, 0.831925631f},
std::array<float,2>{0.223550588f, 0.135430142f},
std::array<float,2>{0.760303617f, 0.909188151f},
std::array<float,2>{0.530892193f, 0.477999806f},
std::array<float,2>{0.438760072f, 0.64473027f},
std::array<float,2>{0.114575155f, 0.418310553f},
std::array<float,2>{0.959186375f, 0.695794225f},
std::array<float,2>{0.704275668f, 0.199186996f},
std::array<float,2>{0.360408276f, 0.992023647f},
std::array<float,2>{0.417238891f, 0.117576301f},
std::array<float,2>{0.562950075f, 0.802010477f},
std::array<float,2>{0.820153058f, 0.305078208f},
std::array<float,2>{0.164320037f, 0.523390949f},
std::array<float,2>{0.308640361f, 0.406721354f},
std::array<float,2>{0.630916595f, 0.692536891f},
std::array<float,2>{0.919228673f, 0.191886887f},
std::array<float,2>{0.026332844f, 0.996718109f},
std::array<float,2>{0.241598755f, 0.11251431f},
std::array<float,2>{0.772032082f, 0.812089682f},
std::array<float,2>{0.512105703f, 0.299419761f},
std::array<float,2>{0.459792674f, 0.527570665f},
std::array<float,2>{0.106202342f, 0.33887586f},
std::array<float,2>{0.945576489f, 0.573289931f},
std::array<float,2>{0.698359847f, 0.0343657956f},
std::array<float,2>{0.35450995f, 0.836132944f},
std::array<float,2>{0.423735201f, 0.130294129f},
std::array<float,2>{0.583963215f, 0.9206146f},
std::array<float,2>{0.835464418f, 0.46901685f},
std::array<float,2>{0.183571339f, 0.655923963f},
std::array<float,2>{0.486202091f, 0.266835362f},
std::array<float,2>{0.547282279f, 0.53526175f},
std::array<float,2>{0.791698635f, 0.0870684609f},
std::array<float,2>{0.210823983f, 0.764080763f},
std::array<float,2>{0.0355874039f, 0.245572388f},
std::array<float,2>{0.878790736f, 0.951865613f},
std::array<float,2>{0.668199897f, 0.384878248f},
std::array<float,2>{0.279563874f, 0.722533047f},
std::array<float,2>{0.155142829f, 0.439013213f},
std::array<float,2>{0.859369814f, 0.658518732f},
std::array<float,2>{0.595300674f, 0.18515563f},
std::array<float,2>{0.396209568f, 0.891079724f},
std::array<float,2>{0.326319367f, 0.0227054842f},
std::array<float,2>{0.724848449f, 0.869455934f},
std::array<float,2>{0.99199158f, 0.370921046f},
std::array<float,2>{0.0793151185f, 0.621420741f},
std::array<float,2>{0.378043681f, 0.493429661f},
std::array<float,2>{0.61905998f, 0.632055461f},
std::array<float,2>{0.861092567f, 0.144411728f},
std::array<float,2>{0.133073121f, 0.931447923f},
std::array<float,2>{0.0708377957f, 0.0552979596f},
std::array<float,2>{0.974880278f, 0.817327201f},
std::array<float,2>{0.744027674f, 0.323560357f},
std::array<float,2>{0.337450564f, 0.591226995f},
std::array<float,2>{0.20298852f, 0.295485497f},
std::array<float,2>{0.798126221f, 0.505842686f},
std::array<float,2>{0.543587804f, 0.108518757f},
std::array<float,2>{0.477097273f, 0.79643476f},
std::array<float,2>{0.256798148f, 0.203393131f},
std::array<float,2>{0.673343241f, 0.970330119f},
std::array<float,2>{0.901587188f, 0.422852129f},
std::array<float,2>{0.0528394096f, 0.71397239f},
std::array<float,2>{0.3647587f, 0.359366238f},
std::array<float,2>{0.709874988f, 0.609244943f},
std::array<float,2>{0.953562677f, 0.00513163302f},
std::array<float,2>{0.112006396f, 0.853556037f},
std::array<float,2>{0.169958323f, 0.163309306f},
std::array<float,2>{0.813936889f, 0.889640808f},
std::array<float,2>{0.568599939f, 0.46282205f},
std::array<float,2>{0.41854164f, 0.678347588f},
std::array<float,2>{0.00603320962f, 0.402040392f},
std::array<float,2>{0.92820394f, 0.740420997f},
std::array<float,2>{0.640653491f, 0.228406861f},
std::array<float,2>{0.287938505f, 0.967959046f},
std::array<float,2>{0.441960692f, 0.0751579702f},
std::array<float,2>{0.527104914f, 0.777083576f},
std::array<float,2>{0.76442796f, 0.26022166f},
std::array<float,2>{0.222603351f, 0.547230363f},
std::array<float,2>{0.332766354f, 0.458512694f},
std::array<float,2>{0.741342366f, 0.680008113f},
std::array<float,2>{0.982756376f, 0.164154381f},
std::array<float,2>{0.0701222047f, 0.880924642f},
std::array<float,2>{0.12836729f, 0.0154731981f},
std::array<float,2>{0.867301166f, 0.84736681f},
std::array<float,2>{0.610100091f, 0.347038329f},
std::array<float,2>{0.383903116f, 0.597247481f},
std::array<float,2>{0.0562237874f, 0.256871909f},
std::array<float,2>{0.895018697f, 0.555379987f},
std::array<float,2>{0.6816504f, 0.0684706867f},
std::array<float,2>{0.258178145f, 0.770773351f},
std::array<float,2>{0.4722763f, 0.221458942f},
std::array<float,2>{0.532798469f, 0.955154121f},
std::array<float,2>{0.809330821f, 0.395414799f},
std::array<float,2>{0.192808136f, 0.745121181f},
std::array<float,2>{0.411406696f, 0.314153403f},
std::array<float,2>{0.574314058f, 0.579376042f},
std::array<float,2>{0.826416433f, 0.0544559211f},
std::array<float,2>{0.162059322f, 0.822327554f},
std::array<float,2>{0.121133037f, 0.154625624f},
std::array<float,2>{0.965064824f, 0.925628245f},
std::array<float,2>{0.718599796f, 0.488217294f},
std::array<float,2>{0.374749035f, 0.636058688f},
std::array<float,2>{0.228242159f, 0.437412769f},
std::array<float,2>{0.750223517f, 0.707557559f},
std::array<float,2>{0.517852187f, 0.215320751f},
std::array<float,2>{0.450554401f, 0.976914644f},
std::array<float,2>{0.295990556f, 0.0993912816f},
std::array<float,2>{0.653939247f, 0.782703161f},
std::array<float,2>{0.933384717f, 0.285794139f},
std::array<float,2>{0.0141905034f, 0.507977843f},
std::array<float,2>{0.466554046f, 0.375726283f},
std::array<float,2>{0.500200868f, 0.727217376f},
std::array<float,2>{0.780425489f, 0.241625026f},
std::array<float,2>{0.249370798f, 0.940005481f},
std::array<float,2>{0.0206872784f, 0.0839846209f},
std::array<float,2>{0.906557918f, 0.754185557f},
std::array<float,2>{0.638704896f, 0.279528528f},
std::array<float,2>{0.302219182f, 0.543526173f},
std::array<float,2>{0.17772454f, 0.361255527f},
std::array<float,2>{0.843283296f, 0.614593863f},
std::array<float,2>{0.589219034f, 0.029633902f},
std::array<float,2>{0.431243092f, 0.864069939f},
std::array<float,2>{0.345705152f, 0.177476302f},
std::array<float,2>{0.69384557f, 0.89976871f},
std::array<float,2>{0.939575732f, 0.450939804f},
std::array<float,2>{0.0954771638f, 0.669030368f},
std::array<float,2>{0.271461725f, 0.309073389f},
std::array<float,2>{0.662550092f, 0.517602503f},
std::array<float,2>{0.887712181f, 0.122373715f},
std::array<float,2>{0.039663218f, 0.796896517f},
std::array<float,2>{0.213325799f, 0.200020239f},
std::array<float,2>{0.784417987f, 0.986294389f},
std::array<float,2>{0.56064707f, 0.416599661f},
std::array<float,2>{0.493358225f, 0.700873733f},
std::array<float,2>{0.0873371214f, 0.482026935f},
std::array<float,2>{0.997496247f, 0.641098917f},
std::array<float,2>{0.728263497f, 0.138777927f},
std::array<float,2>{0.315894276f, 0.913088739f},
std::array<float,2>{0.404774606f, 0.0414033532f},
std::array<float,2>{0.605143487f, 0.832635283f},
std::array<float,2>{0.850035071f, 0.334644198f},
std::array<float,2>{0.14198409f, 0.568175793f},
std::array<float,2>{0.291960716f, 0.44326514f},
std::array<float,2>{0.650812566f, 0.663033068f},
std::array<float,2>{0.936596334f, 0.183074534f},
std::array<float,2>{0.0101454565f, 0.897918284f},
std::array<float,2>{0.232916474f, 0.0185903534f},
std::array<float,2>{0.755213141f, 0.872667015f},
std::array<float,2>{0.522112489f, 0.371462077f},
std::array<float,2>{0.44912827f, 0.617301285f},
std::array<float,2>{0.117662534f, 0.270958126f},
std::array<float,2>{0.96459192f, 0.534613371f},
std::array<float,2>{0.711480737f, 0.0902184099f},
std::array<float,2>{0.367900968f, 0.757881701f},
std::array<float,2>{0.40928039f, 0.247956559f},
std::array<float,2>{0.573726058f, 0.945414722f},
std::array<float,2>{0.822915554f, 0.387327492f},
std::array<float,2>{0.159703404f, 0.72386539f},
std::array<float,2>{0.474968612f, 0.34243983f},
std::array<float,2>{0.537013173f, 0.57585144f},
std::array<float,2>{0.806987405f, 0.035660699f},
std::array<float,2>{0.191330075f, 0.842142522f},
std::array<float,2>{0.0594704673f, 0.126978785f},
std::array<float,2>{0.892131031f, 0.917551458f},
std::array<float,2>{0.686935902f, 0.475333899f},
std::array<float,2>{0.262881458f, 0.649680078f},
std::array<float,2>{0.131591588f, 0.41222769f},
std::array<float,2>{0.874372423f, 0.688625515f},
std::array<float,2>{0.616088212f, 0.188027456f},
std::array<float,2>{0.388212085f, 0.995874226f},
std::array<float,2>{0.3306126f, 0.116540186f},
std::array<float,2>{0.735852003f, 0.807465672f},
std::array<float,2>{0.976565301f, 0.301626265f},
std::array<float,2>{0.0646588728f, 0.524850607f},
std::array<float,2>{0.399737418f, 0.404532343f},
std::array<float,2>{0.60845685f, 0.73674047f},
std::array<float,2>{0.847365439f, 0.234254271f},
std::array<float,2>{0.146123618f, 0.962592721f},
std::array<float,2>{0.0930469632f, 0.0704588443f},
std::array<float,2>{0.992264152f, 0.780443132f},
std::array<float,2>{0.731827259f, 0.265446454f},
std::array<float,2>{0.318085998f, 0.552921057f},
std::array<float,2>{0.217189595f, 0.353447139f},
std::array<float,2>{0.788491547f, 0.602248609f},
std::array<float,2>{0.556219995f, 0.00132558227f},
std::array<float,2>{0.49861294f, 0.858362198f},
std::array<float,2>{0.269097239f, 0.157024994f},
std::array<float,2>{0.658440292f, 0.886023045f},
std::array<float,2>{0.884842277f, 0.466713309f},
std::array<float,2>{0.0463749617f, 0.674420953f},
std::array<float,2>{0.348831266f, 0.290502131f},
std::array<float,2>{0.688296258f, 0.503429174f},
std::array<float,2>{0.942928672f, 0.102613218f},
std::array<float,2>{0.101546533f, 0.792643726f},
std::array<float,2>{0.174714163f, 0.209753677f},
std::array<float,2>{0.837752521f, 0.974553883f},
std::array<float,2>{0.592574835f, 0.427933902f},
std::array<float,2>{0.434630662f, 0.716575623f},
std::array<float,2>{0.0170637351f, 0.497305095f},
std::array<float,2>{0.91027844f, 0.62582916f},
std::array<float,2>{0.636226296f, 0.145835549f},
std::array<float,2>{0.300479323f, 0.936250448f},
std::array<float,2>{0.461419284f, 0.0594795756f},
std::array<float,2>{0.505825162f, 0.814956427f},
std::array<float,2>{0.777322352f, 0.32634455f},
std::array<float,2>{0.245408714f, 0.587752163f},
std::array<float,2>{0.320854366f, 0.429905176f},
std::array<float,2>{0.722271562f, 0.706562459f},
std::array<float,2>{0.987888217f, 0.21483244f},
std::array<float,2>{0.0833575651f, 0.980793715f},
std::array<float,2>{0.14931567f, 0.0946878493f},
std::array<float,2>{0.85431689f, 0.78630513f},
std::array<float,2>{0.599907875f, 0.284189194f},
std::array<float,2>{0.392926931f, 0.514449954f},
std::array<float,2>{0.0350547619f, 0.319801092f},
std::array<float,2>{0.882144213f, 0.582960904f},
std::array<float,2>{0.667927861f, 0.0498469844f},
std::array<float,2>{0.275881737f, 0.826027632f},
std::array<float,2>{0.489835173f, 0.151726827f},
std::array<float,2>{0.551478386f, 0.927131057f},
std::array<float,2>{0.796289623f, 0.491859406f},
std::array<float,2>{0.203347981f, 0.638332129f},
std::array<float,2>{0.426853895f, 0.250804216f},
std::array<float,2>{0.578237116f, 0.561227918f},
std::array<float,2>{0.828166544f, 0.0658990443f},
std::array<float,2>{0.185223863f, 0.769308865f},
std::array<float,2>{0.104500026f, 0.224039897f},
std::array<float,2>{0.952491045f, 0.958044529f},
std::array<float,2>{0.701782584f, 0.393119365f},
std::array<float,2>{0.355494618f, 0.7482692f},
std::array<float,2>{0.234526426f, 0.455862582f},
std::array<float,2>{0.766201437f, 0.686322153f},
std::array<float,2>{0.510707796f, 0.171596423f},
std::array<float,2>{0.453418851f, 0.878154516f},
std::array<float,2>{0.306150734f, 0.00817542616f},
std::array<float,2>{0.626907647f, 0.849548876f},
std::array<float,2>{0.915091753f, 0.34884575f},
std::array<float,2>{0.0288140196f, 0.600834727f},
std::array<float,2>{0.439905077f, 0.479424149f},
std::array<float,2>{0.527583778f, 0.64804697f},
std::array<float,2>{0.759593546f, 0.13378796f},
std::array<float,2>{0.225524083f, 0.907404959f},
std::array<float,2>{0.00311576994f, 0.046033401f},
std::array<float,2>{0.922946274f, 0.828758478f},
std::array<float,2>{0.647444665f, 0.331328928f},
std::array<float,2>{0.284553021f, 0.565547705f},
std::array<float,2>{0.166228682f, 0.30807066f},
std::array<float,2>{0.817625165f, 0.52094692f},
std::array<float,2>{0.564793885f, 0.119899936f},
std::array<float,2>{0.414398104f, 0.803525388f},
std::array<float,2>{0.362242371f, 0.196306974f},
std::array<float,2>{0.706103623f, 0.989910543f},
std::array<float,2>{0.958574653f, 0.420639873f},
std::array<float,2>{0.115732238f, 0.697380364f},
std::array<float,2>{0.250191271f, 0.364305526f},
std::array<float,2>{0.678145945f, 0.610478699f},
std::array<float,2>{0.905512571f, 0.0240060966f},
std::array<float,2>{0.0498413853f, 0.862232864f},
std::array<float,2>{0.19845736f, 0.175673693f},
std::array<float,2>{0.802373946f, 0.905516088f},
std::array<float,2>{0.540694416f, 0.445863634f},
std::array<float,2>{0.480864674f, 0.665528119f},
std::array<float,2>{0.0767947063f, 0.379800975f},
std::array<float,2>{0.972114146f, 0.73075515f},
std::array<float,2>{0.747035742f, 0.236717939f},
std::array<float,2>{0.342447042f, 0.942678988f},
std::array<float,2>{0.381836176f, 0.0793761611f},
std::array<float,2>{0.621643484f, 0.750787795f},
std::array<float,2>{0.866092682f, 0.277301192f},
std::array<float,2>{0.138754964f, 0.541197717f},
std::array<float,2>{0.277375907f, 0.384191781f},
std::array<float,2>{0.670010805f, 0.720671535f},
std::array<float,2>{0.875300586f, 0.243259743f},
std::array<float,2>{0.0378505774f, 0.94973129f},
std::array<float,2>{0.20788084f, 0.0884309337f},
std::array<float,2>{0.789066553f, 0.761917233f},
std::array<float,2>{0.549059451f, 0.267618537f},
std::array<float,2>{0.48746267f, 0.538992524f},
std::array<float,2>{0.0818861201f, 0.367326111f},
std::array<float,2>{0.98957926f, 0.623630881f},
std::array<float,2>{0.723669052f, 0.0214541759f},
std::array<float,2>{0.324609309f, 0.868118346f},
std::array<float,2>{0.398028553f, 0.187041357f},
std::array<float,2>{0.596919f, 0.89365232f},
std::array<float,2>{0.85620141f, 0.441379547f},
std::array<float,2>{0.153562874f, 0.657624245f},
std::array<float,2>{0.45870176f, 0.298460186f},
std::array<float,2>{0.515344024f, 0.529535353f},
std::array<float,2>{0.7712394f, 0.110311896f},
std::array<float,2>{0.240191728f, 0.810531914f},
std::array<float,2>{0.0235149823f, 0.193434134f},
std::array<float,2>{0.921186507f, 0.998686314f},
std::array<float,2>{0.630387127f, 0.410155028f},
std::array<float,2>{0.312176019f, 0.694929659f},
std::array<float,2>{0.180176541f, 0.471537471f},
std::array<float,2>{0.83280623f, 0.65306443f},
std::array<float,2>{0.584347606f, 0.132469967f},
std::array<float,2>{0.425655812f, 0.919828653f},
std::array<float,2>{0.352801472f, 0.0312831514f},
std::array<float,2>{0.696317017f, 0.838431239f},
std::array<float,2>{0.947785735f, 0.337522686f},
std::array<float,2>{0.107468285f, 0.571619391f},
std::array<float,2>{0.420441866f, 0.463681698f},
std::array<float,2>{0.567521691f, 0.677211583f},
std::array<float,2>{0.814704359f, 0.16058062f},
std::array<float,2>{0.168749124f, 0.888629019f},
std::array<float,2>{0.10991887f, 0.00720956922f},
std::array<float,2>{0.956201136f, 0.853253603f},
std::array<float,2>{0.707649171f, 0.355787963f},
std::array<float,2>{0.366567075f, 0.607096732f},
std::array<float,2>{0.22001411f, 0.258568078f},
std::array<float,2>{0.762049139f, 0.548877358f},
std::array<float,2>{0.523893595f, 0.0776399001f},
std::array<float,2>{0.444404304f, 0.773866415f},
std::array<float,2>{0.285244346f, 0.230119005f},
std::array<float,2>{0.643220842f, 0.965092719f},
std::array<float,2>{0.92617023f, 0.400195867f},
std::array<float,2>{0.00490710465f, 0.739376068f},
std::array<float,2>{0.33897686f, 0.320473939f},
std::array<float,2>{0.745049417f, 0.593230128f},
std::array<float,2>{0.973197222f, 0.0576992594f},
std::array<float,2>{0.0730331242f, 0.818847835f},
std::array<float,2>{0.135341167f, 0.142496139f},
std::array<float,2>{0.862661362f, 0.932957411f},
std::array<float,2>{0.620632648f, 0.494816959f},
std::array<float,2>{0.375435144f, 0.630300701f},
std::array<float,2>{0.0520269684f, 0.423910141f},
std::array<float,2>{0.900278807f, 0.712664187f},
std::array<float,2>{0.674956679f, 0.205674291f},
std::array<float,2>{0.255446374f, 0.971645951f},
std::array<float,2>{0.479023904f, 0.106628612f},
std::array<float,2>{0.545549333f, 0.793031871f},
std::array<float,2>{0.800292075f, 0.293261558f},
std::array<float,2>{0.200498506f, 0.505933046f},
std::array<float,2>{0.372408152f, 0.484425068f},
std::array<float,2>{0.714866579f, 0.633766472f},
std::array<float,2>{0.967154562f, 0.153155953f},
std::array<float,2>{0.124585345f, 0.922863841f},
std::array<float,2>{0.162625685f, 0.0511454903f},
std::array<float,2>{0.825005472f, 0.820757508f},
std::array<float,2>{0.577011406f, 0.316132694f},
std::array<float,2>{0.412310869f, 0.581045926f},
std::array<float,2>{0.0128159765f, 0.288882941f},
std::array<float,2>{0.93019408f, 0.509923518f},
std::array<float,2>{0.654921174f, 0.100733563f},
std::array<float,2>{0.294588745f, 0.784091711f},
std::array<float,2>{0.452913821f, 0.217946902f},
std::array<float,2>{0.517033398f, 0.978634119f},
std::array<float,2>{0.75386703f, 0.433897465f},
std::array<float,2>{0.229510486f, 0.709303916f},
std::array<float,2>{0.384868473f, 0.3454853f},
std::array<float,2>{0.61144489f, 0.593978882f},
std::array<float,2>{0.870817721f, 0.0122595867f},
std::array<float,2>{0.126773089f, 0.84513855f},
std::array<float,2>{0.0673118308f, 0.166218743f},
std::array<float,2>{0.980758488f, 0.880698204f},
std::array<float,2>{0.739801526f, 0.460917056f},
std::array<float,2>{0.33414942f, 0.683260977f},
std::array<float,2>{0.193748921f, 0.397518516f},
std::array<float,2>{0.811642051f, 0.742428899f},
std::array<float,2>{0.534287274f, 0.22032401f},
std::array<float,2>{0.47066769f, 0.953758121f},
std::array<float,2>{0.260117412f, 0.0669071451f},
std::array<float,2>{0.680591941f, 0.77236867f},
std::array<float,2>{0.898405492f, 0.25408268f},
std::array<float,2>{0.057284832f, 0.556858301f},
std::array<float,2>{0.495083749f, 0.415383846f},
std::array<float,2>{0.558778346f, 0.701883554f},
std::array<float,2>{0.782568038f, 0.202183738f},
std::array<float,2>{0.21106483f, 0.987065852f},
std::array<float,2>{0.0417660698f, 0.124976963f},
std::array<float,2>{0.890587926f, 0.799501657f},
std::array<float,2>{0.661906898f, 0.310726702f},
std::array<float,2>{0.272318095f, 0.516971767f},
std::array<float,2>{0.144515648f, 0.332469374f},
std::array<float,2>{0.849563539f, 0.568503797f},
std::array<float,2>{0.602844238f, 0.0407919697f},
std::array<float,2>{0.403345674f, 0.835875571f},
std::array<float,2>{0.313887984f, 0.138470143f},
std::array<float,2>{0.729748905f, 0.91042906f},
std::array<float,2>{0.999417484f, 0.482825816f},
std::array<float,2>{0.0890493467f, 0.643742144f},
std::array<float,2>{0.302808404f, 0.277728975f},
std::array<float,2>{0.637239277f, 0.545994759f},
std::array<float,2>{0.909470975f, 0.0832904503f},
std::array<float,2>{0.0221607219f, 0.756100118f},
std::array<float,2>{0.24659276f, 0.239598289f},
std::array<float,2>{0.778046012f, 0.938325465f},
std::array<float,2>{0.503801763f, 0.377463698f},
std::array<float,2>{0.466970682f, 0.728546262f},
std::array<float,2>{0.0974984616f, 0.451741129f},
std::array<float,2>{0.939403415f, 0.671379864f},
std::array<float,2>{0.69196856f, 0.179169804f},
std::array<float,2>{0.345129639f, 0.901682913f},
std::array<float,2>{0.432219118f, 0.0282399282f},
std::array<float,2>{0.58745867f, 0.866084993f},
std::array<float,2>{0.840959132f, 0.362522781f},
std::array<float,2>{0.179402679f, 0.616055131f}} | 48.993164 | 52 | 0.734652 | st-ario |
9797e8eab2d328bbdc9a06999f723d6130f106ec | 3,533 | cc | C++ | examples/mic.cc | CPqD/asr-sdk-cpp | ca1d0a81a250f54c272b6bc39d2a1c5a1c9f58a1 | [
"Apache-2.0"
] | 4 | 2017-10-12T20:09:31.000Z | 2021-05-24T13:46:26.000Z | examples/mic.cc | CPqD/asr-sdk-cpp | ca1d0a81a250f54c272b6bc39d2a1c5a1c9f58a1 | [
"Apache-2.0"
] | null | null | null | examples/mic.cc | CPqD/asr-sdk-cpp | ca1d0a81a250f54c272b6bc39d2a1c5a1c9f58a1 | [
"Apache-2.0"
] | 4 | 2017-10-04T14:30:11.000Z | 2022-02-25T10:13:06.000Z | /*****************************************************************************
* Copyright 2017 CPqD. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include <iostream>
#include <fstream>
#include <string>
#include <chrono>
#include <thread>
#include <cpqd/asr-client/mic_audio_source.h>
#include <cpqd/asr-client/language_model_list.h>
#include <cpqd/asr-client/recognition_config.h>
#include <cpqd/asr-client/recognition_result.h>
#include <cpqd/asr-client/speech_recog.h>
int main(int argc, char* argv[]) {
if(argc != 3 && argc != 5){
std::cerr << "Usage: " << argv[0] << " <ws_url> <lang_uri> [ <user> <password> ]" << std::endl;
std::cerr << " eg: " << argv[0] << " ws://127.0.0.1:8025/asr-server/asr builtin:grammar/samples/phone " << std::endl;
std::cerr << " eg2: " << argv[0] << " wss://contact/cpqd/and/request/a/key/ builtin:slm/general /path/to/audio.wav myusername mypassword" << std::endl;
return -1;
}
std::unique_ptr<RecognitionConfig> config =
RecognitionConfig::Builder()
.maxSentences(3)
.confidenceThreshold(50)
.noInputTimeoutEnabled(true)
.noInputTimeoutMilliseconds(5000)
.startInputTimers(true)
.build();
std::unique_ptr<LanguageModelList> lm;
std::shared_ptr<AudioSource> audio;
std::string url(argv[1]);
std::string username("");
std::string password("");
if(argc == 5){
username = std::string(argv[3]);
password = std::string(argv[4]);
}
char input = 'r';
std::unique_ptr<SpeechRecognizer> asr = SpeechRecognizer::Builder()
.serverUrl(url)
.recogConfig(std::move(config))
.credentials(username, password)
.connectOnRecognize(false)
.autoClose(false)
.build();
while(1) {
audio = std::make_shared<MicAudioSource>();
lm = LanguageModelList::Builder().addFromURI(argv[2]).build();
std::cout << "Press R to recognize, or anything else to exit" << std::endl;
std::cin >> input;
if(!((input=='r' || input == 'R'))){
break;
}
asr->recognize(audio, std::move(lm));
std::cout << "Recognition wait" << std::endl;
std::vector<RecognitionResult> result = asr->waitRecognitionResult();
std::cout << "Recognition end" << std::endl;
for (RecognitionResult& res : result) {
if (res.getCode() == RecognitionResult::Code::NO_MATCH) {
std::cout << "NO_MATCH" << std::endl;
continue;
}
int i = 0;
for (RecognitionResult::Alternative& alt : res.getAlternatives()) {
std::cout << "Alternativa [" << ++i
<< "] (score = " << alt.getConfidence()
<< "): " << alt.getText() << std::endl;
int j = 0;
for (Interpretation& interpretation : alt.getInterpretations()) {
std::cout << "\t Interpretacao [" << ++j
<< "]: " << interpretation.text_ << std::endl;
}
}
}
}
return 0;
}
| 33.971154 | 156 | 0.596377 | CPqD |
97a09d67d5ae31843d0eb5f235fb669bd50d413a | 1,076 | cpp | C++ | SEM-III-NM/02 Secant Method/02 Secant Method.cpp | AnkitApurv/BCA | 9a7715e098de7029813fd06d3ee7e40a0d31f6c4 | [
"MIT"
] | null | null | null | SEM-III-NM/02 Secant Method/02 Secant Method.cpp | AnkitApurv/BCA | 9a7715e098de7029813fd06d3ee7e40a0d31f6c4 | [
"MIT"
] | null | null | null | SEM-III-NM/02 Secant Method/02 Secant Method.cpp | AnkitApurv/BCA | 9a7715e098de7029813fd06d3ee7e40a0d31f6c4 | [
"MIT"
] | null | null | null | //to find roots of equation usimg Secant's Method
#include<iostream>
#include<cmath>
#include<process.h>
using namespace std;
float secant(float x)
{
return((x*x) - 25);
}
int main(void)
{
float x0, x1, x;
int inter = 0;
float f0, f1, fx, epsilon;
cin.ignore();
cout << endl << "Secant Method" << endl;
cout << endl << "Equation:x^x-25=0";
cout << endl << "x0:";
cin >> x0;
cout << endl << "x1:";
cin >> x1;
cout << endl << "epsilon:";
cin >> epsilon;
f0 = secant(x0);
f1 = secant(x1);
cout << endl << "Sl. No." << "\t\t" << x0 << "\t\t" << x1 << "\t\t" << x << "\t\t" << f0 << "\t\t" << f1 << "\t\t" << fx << endl;
do
{
inter++;
x = (x0*f1 - x1*f0) / (f1 - f0);
fx = secant(x);
if (fabs(f1 - f0) <= epsilon)
{
cout << endl << "Slope is too small.";
exit(0);
}
cout << endl << inter << "\t\t" << x0 << "\t\t" << x1 << "\t\t" << x << "\t\t" << f0 << "\t\t" << f1 << "\t\t" << fx;
x0 = x1;
x1 = x;
f0 = f1;
f1 = fx;
}
while (fabs(fx) > epsilon);
cout << endl << "Root = " << x << " in " << inter << " iterations.";
exit(0);
} | 21.959184 | 130 | 0.482342 | AnkitApurv |
97a2afd505a844aa2fcd8175fddc03dda559acf6 | 420 | cpp | C++ | test_package/example.cpp | abbyssoul/libkasofs | a7e12e5495c85cb65fa913d086152abc559fb3e6 | [
"Apache-2.0"
] | 1 | 2021-09-10T00:49:21.000Z | 2021-09-10T00:49:21.000Z | test_package/example.cpp | abbyssoul/libkasofs | a7e12e5495c85cb65fa913d086152abc559fb3e6 | [
"Apache-2.0"
] | null | null | null | test_package/example.cpp | abbyssoul/libkasofs | a7e12e5495c85cb65fa913d086152abc559fb3e6 | [
"Apache-2.0"
] | null | null | null | #include "kasofs/kasofs.hpp"
#include <cstdlib> // EXIT_SUCCESS/EXIT_FAILURE
int main() {
auto owner = kasofs::User{0, 0};
auto vfs = kasofs::Vfs{owner, kasofs::FilePermissions{0707}};
auto maybeRoot = vfs.nodeById(vfs.rootId());
if (!maybeRoot)
return EXIT_FAILURE;
return (*maybeRoot).userCan(owner, kasofs::Permissions::WRITE)
? EXIT_SUCCESS
: EXIT_FAILURE;
}
| 24.705882 | 66 | 0.640476 | abbyssoul |
97a30db1852441ffd5dca54c1338088dbe2784a9 | 2,669 | cpp | C++ | tests/parsers_test.cpp | simonraschke/vesicle | 3b9b5529c3f36bdeff84596bc59509781b103ead | [
"Apache-2.0"
] | 1 | 2019-03-15T17:24:52.000Z | 2019-03-15T17:24:52.000Z | tests/parsers_test.cpp | simonraschke/vesicle | 3b9b5529c3f36bdeff84596bc59509781b103ead | [
"Apache-2.0"
] | null | null | null | tests/parsers_test.cpp | simonraschke/vesicle | 3b9b5529c3f36bdeff84596bc59509781b103ead | [
"Apache-2.0"
] | null | null | null | // #define BOOST_TEST_MODULE parsers
// #include <boost/test/included/unit_test.hpp>
// #include "systems/system.hpp"
// // #include "parsers/potential_energy.hpp"
// #include "parsers/cluster_parser.hpp"
// BOOST_AUTO_TEST_SUITE(parsers)
// BOOST_AUTO_TEST_CASE(surface_reconstruction_test)
// {
// const char* argv[3] = {nullptr,"--config","../../tests/test_config.ini"};
// System system;
// Parameters prms;
// prms.read(3,argv);
// prms.setup();
// prms.mobile = 10;
// prms.analysis_cluster_volume_extension = -1;
// system.setParameters(prms);
// system.addParticles(ParticleFactory<ParticleMobile>(system.getParameters().mobile));
// system.getParticles()[0]->setCoords(Eigen::Vector3f(1,1,1));
// system.getParticles()[1]->setCoords(Eigen::Vector3f(2,1,1));
// system.getParticles()[2]->setCoords(Eigen::Vector3f(1,2,1));
// system.getParticles()[3]->setCoords(Eigen::Vector3f(1,1,2));
// system.getParticles()[4]->setCoords(Eigen::Vector3f(2,2,1));
// system.getParticles()[5]->setCoords(Eigen::Vector3f(1,2,2));
// system.getParticles()[6]->setCoords(Eigen::Vector3f(2,1,2));
// system.getParticles()[7]->setCoords(Eigen::Vector3f(2,2,2));
// system.getParticles()[8]->setCoords(Eigen::Vector3f(2,1,3));
// system.getParticles()[9]->setCoords(Eigen::Vector3f(2,2,3));
// ClusterParser clusters;
// clusters.setParameters(prms);
// clusters.setTarget(system.getParticles().begin(), system.getParticles().end());
// clusters.scan();
// clusters.getLargest().getStructure().printXML("../../tests/largest.vtu");
// auto centre = clusters.getLargest().getCenter();
// BOOST_CHECK_MESSAGE( std::abs(centre(0) - 1.6) < 1e-3, "centre x calculation wrong. " + std::to_string(centre(0)) );
// BOOST_CHECK_MESSAGE( std::abs(centre(1) - 1.5) < 1e-3, "centre y calculation wrong. " + std::to_string(centre(1)) );
// BOOST_CHECK_MESSAGE( std::abs(centre(2) - 1.8) < 1e-3, "centre z calculation wrong. " + std::to_string(centre(2)) );
// BOOST_CHECK_MESSAGE( clusters.getLargest().size() == 10, "members of structure wrong: " + std::to_string(clusters.getLargest().size()) );
// BOOST_CHECK_MESSAGE( std::abs(clusters.getLargest().getStructure().getVolume() - 1.5) < 1e-3, "volume of structure wrong: " + std::to_string(clusters.getLargest().getStructure().getVolume()) );
// BOOST_CHECK_MESSAGE( std::abs(clusters.getLargest().getStructure().getSurfaceArea() - 8.414) < 1e-3, "surface area of structure wrong: " + std::to_string(clusters.getLargest().getStructure().getSurfaceArea()) );
// }
// BOOST_AUTO_TEST_SUITE_END() | 48.527273 | 218 | 0.666542 | simonraschke |
97a87e267247141171fd05173a28642a5e57f6e6 | 268 | cpp | C++ | GOF_FactoryMethod/GOF_FactoryMethod/concrete_creator.cpp | vigilantmaster/CST276SRS03 | 4af930e690eb69e35f70ec49d2a5b447805a2bd3 | [
"MIT"
] | null | null | null | GOF_FactoryMethod/GOF_FactoryMethod/concrete_creator.cpp | vigilantmaster/CST276SRS03 | 4af930e690eb69e35f70ec49d2a5b447805a2bd3 | [
"MIT"
] | null | null | null | GOF_FactoryMethod/GOF_FactoryMethod/concrete_creator.cpp | vigilantmaster/CST276SRS03 | 4af930e690eb69e35f70ec49d2a5b447805a2bd3 | [
"MIT"
] | null | null | null | #include "stdafx.h"
#include "concrete_creator.h"
#include "concrete_product.h"
concrete_creator::concrete_creator(): creator()
{
}
concrete_creator::~concrete_creator()
= default;
i_product * concrete_creator::create_product()
{
return new concrete_product;
}
| 14.888889 | 47 | 0.761194 | vigilantmaster |
97a96a3b9a3119b9e2727a404fbda6c7ccb0d45d | 9,878 | cpp | C++ | iree/compiler/Dialect/Util/Analysis/Attributes/Range.cpp | smit-hinsu/iree | a385d311b701cdc06cb825000ddb34c8a11c6eef | [
"Apache-2.0"
] | 1 | 2022-02-13T15:27:08.000Z | 2022-02-13T15:27:08.000Z | iree/compiler/Dialect/Util/Analysis/Attributes/Range.cpp | iree-github-actions-bot/iree | 9982f10090527a1a86cd280b4beff9a579b96b38 | [
"Apache-2.0"
] | 1 | 2022-01-27T18:10:51.000Z | 2022-01-27T18:10:51.000Z | iree/compiler/Dialect/Util/Analysis/Attributes/Range.cpp | iree-github-actions-bot/iree | 9982f10090527a1a86cd280b4beff9a579b96b38 | [
"Apache-2.0"
] | null | null | null | // Copyright 2021 The IREE Authors
//
// Licensed under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include "iree/compiler/Dialect/Util/Analysis/Attributes/Range.h"
#include "iree/compiler/Dialect/Util/Analysis/Attributes/PotentialValues.h"
#include "llvm/Support/Debug.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h" // TODO: Remove
#define DEBUG_TYPE "iree-util-attributes"
using llvm::dbgs;
namespace mlir {
namespace iree_compiler {
namespace IREE {
namespace Util {
//===----------------------------------------------------------------------===//
// FloatRangeStats
//===----------------------------------------------------------------------===//
static FloatRangeStats::TruncationFlag determineTruncationFlag(double value) {
double truncValue = trunc(value);
// TODO: I'm sure I need to be doing some ULP comparison.
return truncValue == value ? FloatRangeStats::TRUNC
: FloatRangeStats::TRUNC_UNKNOWN;
}
void FloatRangeStats::addDomainValue(double value) {
if (!valid) {
minValue = value;
maxValue = value;
truncationFlag = determineTruncationFlag(value);
valid = true;
} else {
minValue = std::min(minValue, value);
maxValue = std::max(maxValue, value);
truncationFlag =
unionTruncationFlag(determineTruncationFlag(value), truncationFlag);
}
}
std::string FloatRangeStats::getAsStr() const {
if (!valid) return std::string("<<INVALID>>");
std::string s("[");
s += std::to_string(minValue);
s += ", ";
s += std::to_string(maxValue);
s += ", ";
switch (truncationFlag) {
case TRUNC_UNKNOWN:
s += "!trunc";
break;
case TRUNC:
s += "TRUNC";
break;
}
s += "]";
return s;
}
//===----------------------------------------------------------------------===//
// FloatRangeState
//===----------------------------------------------------------------------===//
void FloatRangeState::applyMinf(const FloatRangeStats &lhs,
const FloatRangeStats &rhs) {
assumed += lhs;
assumed += rhs;
// Narrow the upper bound and preserve the truncation flag.
if (assumed.valid) {
assumed.maxValue = std::min(lhs.maxValue, rhs.maxValue);
}
}
void FloatRangeState::applyMaxf(const FloatRangeStats &lhs,
const FloatRangeStats &rhs) {
assumed += lhs;
assumed += rhs;
// Narrow the lower bound and preserve the truncation flag.
if (assumed.valid) {
assumed.minValue = std::max(lhs.minValue, rhs.minValue);
}
}
void FloatRangeState::applyFloor(const FloatRangeStats &operand) {
assumed += operand;
// Apply floor to the bounds and set the truncation flag.
if (assumed.valid) {
assumed.minValue = std::floor(assumed.minValue);
assumed.maxValue = std::floor(assumed.maxValue);
assumed.truncationFlag = FloatRangeStats::TRUNC;
}
}
//===----------------------------------------------------------------------===//
// FloatRangeValueElement
//===----------------------------------------------------------------------===//
const char FloatRangeValueElement::ID = 0;
// Returns whether the given type is a valid scalar fp type or a shaped type
// of fp types.
// TODO: getElementTypeOrSelf?
static bool isFpType(Type type) {
return getElementTypeOrSelf(type).isa<FloatType>();
}
void FloatRangeValueElement::initializeValue(Value value, DFX::Solver &solver) {
if (!isFpType(value.getType())) {
indicatePessimisticFixpoint();
return;
}
}
ChangeStatus FloatRangeValueElement::updateValue(Value value,
DFX::Solver &solver) {
// TODO: This could be modularized substantially and made common with
// other attributes.
FloatRangeState newState = getState();
// If this is a block argument to a supported parent operation, then
// remap the value we are working on to the correct input from the
// parent. This works because the statistics we are accumulating flow
// layer-wise, and we don't need to pay particular attention to specific
// loop structures.
// TODO: We shouldn't need to hard switch on LinalgOp here and should
// be relying on some kind of concept/interface. It just isn't
// clear what that would be.
if (auto valueBlockArg = value.dyn_cast<BlockArgument>()) {
Block *ownerBlock = valueBlockArg.getOwner();
if (auto linalgParent = llvm::dyn_cast_or_null<linalg::LinalgOp>(
ownerBlock->getParentOp())) {
value = linalgParent->getOperand(valueBlockArg.getArgNumber());
LLVM_DEBUG(dbgs() << " ++ REMAP LINALG BLOCK ARG TO: " << value << "\n");
}
}
// If we can get a full potential value set, then we can derive from that.
auto pvs = solver.getElementFor<ConstantAttributePVS>(
*this, Position::forValue(value), DFX::Resolution::OPTIONAL);
if (pvs.isValidState() && !pvs.isUndefContained()) {
for (Attribute constValue : pvs.getAssumedSet()) {
if (auto scalarValue = constValue.dyn_cast<FloatAttr>()) {
FloatRangeStats stats;
stats.addDomainValue(scalarValue.getValueAsDouble());
newState.setAssumed(stats);
newState.indicateOptimisticFixpoint();
} else if (auto elements = constValue.dyn_cast<ElementsAttr>()) {
FloatRangeStats stats;
for (APFloat elementValue : elements.getValues<APFloat>()) {
stats.addDomainValue(elementValue.convertToDouble());
}
newState.setAssumed(stats);
LLVM_DEBUG(dbgs() << "*** COMPUTED KNOWN RANGE: " << stats.getAsStr()
<< "\n");
newState.indicateOptimisticFixpoint();
} else {
// Unknown.
// TODO
LLVM_DEBUG(dbgs() << "UNKNOWN ATTRIBUTE: " << constValue << "\n");
newState.indicatePessimisticFixpoint();
}
}
}
if (newState.isAtFixpoint()) {
return DFX::clampStateAndIndicateChange(getState(), newState);
}
if (solver.getExplorer().walkDefiningOps(value, [&](OpResult result) {
LLVM_DEBUG(dbgs() << " WALK: " << result << "\n");
Operation *definingOp = result.getDefiningOp();
// TODO: We shouldn't need to hard switch on LinalgOp here and should
// be relying on some kind of concept/interface. It just isn't
// clear what that would be.
if (auto linalgOp = dyn_cast<linalg::LinalgOp>(definingOp)) {
// Because we are working on per-layer statistics, we get to
// ignore the entire loop structure of the linalg op and just
// chase the stats up through the terminator (which will have
// values that match the results).
Block *loopBody = linalgOp.getBlock();
assert(!loopBody->empty());
Operation &terminator = loopBody->back();
Value loopBodyValue = terminator.getOperand(result.getResultNumber());
auto inner = solver.getElementFor<FloatRangeValueElement>(
*this, Position::forValue(loopBodyValue),
DFX::Resolution::REQUIRED);
newState ^= inner;
return WalkResult::advance();
} else if (auto minfOp = dyn_cast<arith::MinFOp>(definingOp)) {
auto lhs = solver.getElementFor<FloatRangeValueElement>(
*this, Position::forValue(minfOp.getLhs()),
DFX::Resolution::REQUIRED);
auto rhs = solver.getElementFor<FloatRangeValueElement>(
*this, Position::forValue(minfOp.getRhs()),
DFX::Resolution::REQUIRED);
newState.applyMinf(lhs.getAssumed(), rhs.getAssumed());
LLVM_DEBUG(dbgs() << "VISITING minf: lhs = " << lhs.getAsStr()
<< ", rhs = " << rhs.getAsStr() << " -> "
<< newState.getAssumed().getAsStr() << "\n");
return WalkResult::advance();
} else if (auto maxfOp = dyn_cast<arith::MaxFOp>(definingOp)) {
auto lhs = solver.getElementFor<FloatRangeValueElement>(
*this, Position::forValue(maxfOp.getLhs()),
DFX::Resolution::REQUIRED);
auto rhs = solver.getElementFor<FloatRangeValueElement>(
*this, Position::forValue(maxfOp.getRhs()),
DFX::Resolution::REQUIRED);
newState.applyMaxf(lhs.getAssumed(), rhs.getAssumed());
LLVM_DEBUG(dbgs() << "VISITING maxf: lhs = " << lhs.getAsStr()
<< ", rhs = " << rhs.getAsStr() << " -> "
<< newState.getAssumed().getAsStr() << "\n");
return WalkResult::advance();
} else if (auto floorOp = dyn_cast<math::FloorOp>(definingOp)) {
auto operand = solver.getElementFor<FloatRangeValueElement>(
*this, Position::forValue(floorOp.getOperand()),
DFX::Resolution::REQUIRED);
newState.applyFloor(operand.getAssumed());
LLVM_DEBUG(dbgs()
<< "VISITING floor: " << operand.getAsStr() << " -> "
<< newState.getAssumed().getAsStr() << "\n");
return WalkResult::advance();
}
// Unrecognized op.
LLVM_DEBUG(dbgs() << "UNRECOGNIZED OP: " << *definingOp
<< " (signalling pessimistic fixpoint for " << value
<< ")\n");
newState.indicatePessimisticFixpoint();
return WalkResult::advance();
}) == TraversalResult::INCOMPLETE) {
newState.indicatePessimisticFixpoint();
}
return DFX::clampStateAndIndicateChange(getState(), newState);
}
const std::string FloatRangeValueElement::getAsStr() const {
auto range = getAssumed();
std::string s("fp-range: ");
s += range.getAsStr();
return s;
}
} // namespace Util
} // namespace IREE
} // namespace iree_compiler
} // namespace mlir
| 38.585938 | 80 | 0.601539 | smit-hinsu |
97b6bfeee73bce76ec634b36cb5a73eaadaccd83 | 274 | cpp | C++ | Acun3D/DirectionalLight.cpp | Catchouli-old/Acun3D | 1a34791d30528a442d9734de31b0bcac86cb32d5 | [
"MIT"
] | 1 | 2018-11-15T18:53:44.000Z | 2018-11-15T18:53:44.000Z | Acun3D/DirectionalLight.cpp | Catchouli-old/Acun3D | 1a34791d30528a442d9734de31b0bcac86cb32d5 | [
"MIT"
] | null | null | null | Acun3D/DirectionalLight.cpp | Catchouli-old/Acun3D | 1a34791d30528a442d9734de31b0bcac86cb32d5 | [
"MIT"
] | null | null | null | #include "DirectionalLight.h"
namespace a3d
{
DirectionalLight::DirectionalLight(Vector direction, Colour colour)
: Light(LightTypes::DIRECTIONAL, colour), _direction(direction)
{
}
const Vector& DirectionalLight::getDirection() const
{
return _direction;
}
} | 18.266667 | 68 | 0.751825 | Catchouli-old |
b6323b4945ccbe85e4773b134f7618dc504394a6 | 1,892 | cpp | C++ | SongPlays.cpp | sivanyo/DS-WET1 | 69476f30ec519cd36534113ee9b7fc1af37d13ff | [
"MIT"
] | 1 | 2020-06-23T06:30:59.000Z | 2020-06-23T06:30:59.000Z | SongPlays.cpp | sivanyo/DS-WET1 | 69476f30ec519cd36534113ee9b7fc1af37d13ff | [
"MIT"
] | null | null | null | SongPlays.cpp | sivanyo/DS-WET1 | 69476f30ec519cd36534113ee9b7fc1af37d13ff | [
"MIT"
] | null | null | null | //
// Created by Mor on 30/04/2020.
//
#include "SongPlays.h"
SongPlays::SongPlays(int songId, int artistId, MostPlayedListNode *ptrToListNode) :
songId(songId), artistId(artistId), ptrToListNode(ptrToListNode), ptrToSong(nullptr) {}
int SongPlays::getSongId() const {
return songId;
}
int SongPlays::getArtistId() const {
return artistId;
}
int SongPlays::getNumberOfPlays() const {
return numberOfPlays;
}
void SongPlays::setNumberOfPlays(int plays) {
SongPlays::numberOfPlays = plays;
}
void SongPlays::incrementNumberOfPlays() {
this->numberOfPlays++;
}
void SongPlays::DecrementNumberOfPlays() {
this->numberOfPlays--;
}
MostPlayedListNode *SongPlays::getPtrToListNode() const {
return ptrToListNode;
}
void SongPlays::setPtrToListNode(MostPlayedListNode *ptr) {
ptrToListNode = ptr;
}
Song *SongPlays::getPtrToSong() const {
return ptrToSong;
}
void SongPlays::setPtrToSong(Song *ptr) {
ptrToSong = ptr;
}
void SongPlays::DeleteSongPlaysNode(TreeNode<SongPlays> *songNode) {
if (songNode->getLeft()) {
DeleteSongPlaysNode(songNode->getLeft());
delete songNode->getLeft();
songNode->setLeft(nullptr);
}
if (songNode->getRight()) {
DeleteSongPlaysNode(songNode->getRight());
delete songNode->getRight();
songNode->setRight(nullptr);
}
SongPlays *temp = songNode->getData();
// Marking the current song as deleted, so we know not to try and delete it again
temp->getPtrToSong()->setNumberOfPlays(-1);
//temp->setNumberOfPlays(-1);
if (songNode->getParent() == nullptr) {
// This is the root of the tree so there is no one else who will try and delete it's contents, need to delete on our own
// to avoid leak
delete songNode->getData();
// TODO: might not need anymore
//songNode->removeValue();
}
}
| 25.917808 | 128 | 0.678118 | sivanyo |
b632f568d5015ffa645885cda063fc7f4d3a5521 | 2,986 | cpp | C++ | RLFPS/Source/RLFPS/Private/SpawningActor.cpp | Verb-Noun-Studios/Symbiotic | d037b3bbe4925f2d4c97d4c44e45ec0abe88c237 | [
"MIT"
] | 3 | 2022-01-11T03:29:03.000Z | 2022-02-03T03:46:44.000Z | RLFPS/Source/RLFPS/Private/SpawningActor.cpp | Verb-Noun-Studios/Symbiotic | d037b3bbe4925f2d4c97d4c44e45ec0abe88c237 | [
"MIT"
] | 27 | 2022-02-02T04:54:29.000Z | 2022-03-27T18:58:15.000Z | RLFPS/Source/RLFPS/Private/SpawningActor.cpp | Verb-Noun-Studios/Symbiotic | d037b3bbe4925f2d4c97d4c44e45ec0abe88c237 | [
"MIT"
] | null | null | null | // Fill out your copyright notice in the Description page of Project Settings.
#include "SpawningActor.h"
#include "GruntCharacter.h"
#include "CustomGameMode.h"
#include "Kismet/GameplayStatics.h"
#include "GameFramework/GameModeBase.h"
#include "DrawDebugHelpers.h"
#include "EngineUtils.h"
#include "SymbioticGameMode.h"
// Sets default values
ASpawningActor::ASpawningActor()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
}
// Called when the game starts or when spawned
void ASpawningActor::BeginPlay()
{
Super::BeginPlay();
FActorSpawnParameters* SpawnParams = new FActorSpawnParameters;
SpawnParams->Owner = this;
SpawnParams->Instigator = GetInstigator();
SpawnParams->SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButDontSpawnIfColliding;
spawnParams = SpawnParams;
player = UGameplayStatics::GetActorOfClass(GetWorld(), playerClass);
location = GetActorLocation();
}
// Called every frame
void ASpawningActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
elapsedTime += DeltaTime;
if (player && activated)
{
if (distanceToPlayer < distanceToPlayerThreshold)
{
if (beaconTime > 0)
{
beaconTime -= DeltaTime;
if (elapsedTime > (60.0 / (EPM * beaconMultiplier)) && (enemiesSpawned < maxEnemies || maxEnemies < 1))
{
SpawnEnemie();
elapsedTime = 0;
}
}
else
{
if (elapsedTime > (60.0 / EPM) && (enemiesSpawned < maxEnemies || maxEnemies < 1))
{
SpawnEnemie();
elapsedTime = 0;
}
}
}
distanceToPlayer = (location - player->GetActorLocation()).Size();
}
}
void ASpawningActor::SpawnEnemie()
{
AGameModeBase* gameMode = UGameplayStatics::GetGameMode(GetWorld());
ASymbioticGameMode* customGameMode = Cast<ASymbioticGameMode>(gameMode);
if (customGameMode->enemiesLeftToSpawn > 0)
{
UWorld* World = GetWorld();
FHitResult result;
FVector start = GetActorLocation();
FCollisionQueryParams CollisionParameters;
FVector end;
for (TActorIterator<AGruntCharacter> it(GetWorld()); it; ++it)
{
CollisionParameters.AddIgnoredActor(*it);
}
do
{
FVector spawnOffset(FMath::RandPointInCircle(spawnRadius), 0);
end = start + spawnOffset;
World->LineTraceSingleByChannel(result, start, end, ECollisionChannel::ECC_Visibility);
} while (result.Actor != nullptr);
AActor* enemie = World->SpawnActor<AActor>(classToSpawn, end, GetActorRotation(), *spawnParams);
if (!enemie)
{
SpawnEnemie();
}
else
{
enemiesSpawned++;
customGameMode->enemiesLeftToSpawn--;
UE_LOG(LogTemp, Warning, TEXT("SpawningActor!"));
}
}
}
void ASpawningActor::ActivateWithBeacon(float BeaconTime, float BeaconMultiplier)
{
beaconTime = BeaconTime;
beaconMultiplier = BeaconMultiplier;
Activate();
UE_LOG(LogTemp, Warning, TEXT("Activating with Beacon!"));
}
| 20.736111 | 123 | 0.713999 | Verb-Noun-Studios |
b634f024a053d4ac9cfdab50eb072f9324e5a902 | 11,999 | cxx | C++ | inetsrv/query/cindex/pmcomp.cxx | npocmaka/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 17 | 2020-11-13T13:42:52.000Z | 2021-09-16T09:13:13.000Z | inetsrv/query/cindex/pmcomp.cxx | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 2 | 2020-10-19T08:02:06.000Z | 2020-10-19T08:23:18.000Z | inetsrv/query/cindex/pmcomp.cxx | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 14 | 2020-11-14T09:43:20.000Z | 2021-08-28T08:59:57.000Z | //+---------------------------------------------------------------------------
//
// Microsoft Windows
// Copyright (C) Microsoft Corporation, 1991 - 1997.
//
// File: PMComp.cxx
//
// Contents: Persistent index decompressor using during master merge
//
// Classes: CMPersDeComp
//
// History: 21-Apr-94 DwightKr Created
//
//----------------------------------------------------------------------------
#include <pch.cxx>
#pragma hdrstop
#include "mindex.hxx"
//+---------------------------------------------------------------------------
//
// Function: CMPersDeComp::CMPersDeComp
//
// Synopsis: Constructor for the persistent compressor capable of dealing
// with two indexes representing the master index. This will
// allow queries to transparently span both indexes.
//
// Arguments: [curDir] -- directory for the current (old) master index
// [curIid] -- index Id of the current (old) master index
// [curIndex] -- physical index of the current (old) master index
// [newDir] -- directory for the new master index
// [newIid] -- index Id of the new master index
// [pKey] -- starting key to look for
// [widMax] -- maximum workid in the new master index
// [splitKey] -- key which seperates current & new master index
// [mutex] -- mutex to control access to dirs during merge
//
// History: 4-10-94 DwightKr Created
//
//----------------------------------------------------------------------------
CMPersDeComp::CMPersDeComp(
PDirectory & curDir,
INDEXID curIid,
CPhysIndex & curIndex,
WORKID curWidMax,
PDirectory & newDir,
INDEXID newIid,
CPhysIndex & newIndex,
const CKey * pKey,
WORKID newWidMax,
const CSplitKeyInfo & splitKeyInfo,
CMutexSem & mutex ) :
CKeyCursor(curIid, 0),
_curDir(curDir),
_curIid(curIid),
_curIndex(curIndex),
_curWidMax(curWidMax),
_newDir(newDir),
_newIid(newIid),
_newIndex(newIndex),
_newWidMax(newWidMax),
_splitKeyInfo(splitKeyInfo),
_pActiveCursor(0),
_fUseNewIndex(FALSE),
_mutex(mutex),
_lastSplitKeyBuf( splitKeyInfo.GetKey() )
{
//
// Note that _mutex is currently held when this constructor is called.
//
// Determine which index the query should start in. If the key is
// less than or equal to the splitkey, start in the new master index.
// Otherwise start in the current (old) master index.
//
BitOffset posKey;
CKeyBuf keyInit;
if ( pKey->Compare( _lastSplitKeyBuf ) <= 0 )
{
//
// Save the offset of the splitKey so that the NextKey() operation
// can quickly determine if we are about to fall off the logical
// end of the index.
//
_newDir.Seek( _lastSplitKeyBuf, 0, _lastSplitKeyOffset );
ciDebugOut(( DEB_PCOMP,
"Constructor: splitkey '%.*ws' offset = 0x%x:0x%x\n",
_lastSplitKeyBuf.StrLen(), _lastSplitKeyBuf.GetStr(),
_lastSplitKeyOffset.Page(), _lastSplitKeyOffset.Offset() ));
_fUseNewIndex = TRUE;
_newDir.Seek( *pKey, &keyInit, posKey );
_widMax = _newWidMax;
_pActiveCursor = new CPersDeComp( _newDir, _newIid, _newIndex,
posKey, keyInit,
pKey, _newWidMax);
}
else
{
_curDir.Seek( *pKey, &keyInit, posKey );
_widMax = _curWidMax;
_pActiveCursor = new CPersDeComp( _curDir, _curIid, _curIndex,
posKey, keyInit,
pKey, _curWidMax );
}
// Update weights so Rank can be computed
UpdateWeight();
ciDebugOut(( DEB_PCOMP, "found key %.*ws at %lx:%lx\n",
keyInit.StrLen(), keyInit.GetStr(),
posKey.Page(), posKey.Offset() ));
} //CMPersDeComp
//+---------------------------------------------------------------------------
//----------------------------------------------------------------------------
CMPersDeComp::~CMPersDeComp()
{
delete _pActiveCursor;
}
//+---------------------------------------------------------------------------
//----------------------------------------------------------------------------
const CKeyBuf * CMPersDeComp::GetKey()
{
Win4Assert( _pActiveCursor );
return _pActiveCursor->GetKey();
}
//+---------------------------------------------------------------------------
//
// Function: CMPersDeComp::GetNextKey()
//
// Synopsis: Obtains the next key from the logical master index.
//
// History: 4-10-94 DwightKr Created
//
// Notes: If we are using the new master index, and the current
// key is the split key, then we have exhausted the new
// master index, and the GetNextKey() operation should
// transparently move to the current master index.
//
// We are comparing BitOffset's here rather than keys
// because it is simplear and faster.
//
//----------------------------------------------------------------------------
const CKeyBuf * CMPersDeComp::GetNextKey()
{
Win4Assert( _pActiveCursor );
//
// Grab the lock to protect access to split key info and the buffers
// in the old index (so the master merge doesn't do a checkpoint
// until after we create a cursor or move the cursor from one page to
// the next. This is really expensive.
//
CLock lock( _mutex );
//
// If we are already using the old master index, then we don't need to
// check the splitkey since we have already crossed over to the old index.
//
if ( !_fUseNewIndex )
return _pActiveCursor->GetNextKey();
//
// We are using the new master index. If we are positioned at the split
// key, the subsequent nextKey() operation will need to take us to
// the old index. Determine if we are about to cross between indexes.
//
BitOffset currentKeyOffset;
_pActiveCursor->GetOffset( currentKeyOffset );
ciDebugOut(( DEB_PCOMP,
"NextKey: splitkey offset = 0x%x:0x%x currentKeyOffset = 0x%x:0x%x\n",
_lastSplitKeyOffset.Page(), _lastSplitKeyOffset.Offset(),
currentKeyOffset.Page(), currentKeyOffset.Offset() ));
if ( _lastSplitKeyOffset > currentKeyOffset )
{
const CKeyBuf *p = _pActiveCursor->GetNextKey();
#if CIDBG == 1
BitOffset boCur;
_pActiveCursor->GetOffset( boCur );
ciDebugOut(( DEB_PCOMP,
"GetNextKey from new index = %.*ws offset = 0x%x:0x%x\n",
p->StrLen(), p->GetStr(),
boCur.Page(), boCur.Offset() ));
#endif // CIDBG == 1
return p;
}
//
// We MAY have crossed over from the new index to the old index.
// Check to see if the split key has moved to verify.
//
if ( !AreEqual( & _lastSplitKeyBuf, & (_splitKeyInfo.GetKey()) ) )
{
_lastSplitKeyBuf = _splitKeyInfo.GetKey();
_newDir.Seek( _lastSplitKeyBuf, 0, _lastSplitKeyOffset );
//
// Check to see if we can continue using the new index since
// the split key has moved.
//
if ( _lastSplitKeyOffset > currentKeyOffset )
{
ciDebugOut(( DEB_PCOMP, "sticking with new index due to split\n" ));
return _pActiveCursor->GetNextKey();
}
}
ciDebugOut(( DEB_PCOMP, "switching to old index given split key %.*ws\n",
_lastSplitKeyBuf.StrLen(), _lastSplitKeyBuf.GetStr() ));
//
// Rebuild the key decompressor to point to the old index on the smallest
// key >= the split key
//
_fUseNewIndex = FALSE;
delete _pActiveCursor;
_pActiveCursor = 0;
BitOffset posKey;
CKeyBuf keyInit;
_curDir.Seek( _lastSplitKeyBuf, &keyInit, posKey );
int iCompare = Compare( &keyInit, &_lastSplitKeyBuf );
// If the split key isn't in the old index, use the next key
if ( iCompare < 0 )
_curDir.SeekNext( _lastSplitKeyBuf, &keyInit, posKey );
ciDebugOut(( DEB_PCOMP, "found key >= (%d) split key = %.*ws at %lx:%lx\n",
iCompare,
keyInit.StrLen(), keyInit.GetStr(),
posKey.Page(), posKey.Offset() ));
// If we're out of keys then say so.
if ( keyInit.IsMaxKey() )
{
ciDebugOut(( DEB_WARN, "at the end of the old index...\n" ));
return 0;
}
_widMax = _curWidMax;
CKey Key( keyInit );
_pActiveCursor = new CPersDeComp( _curDir, _curIid, _curIndex,
posKey, keyInit,
&Key, _curWidMax );
return _pActiveCursor->GetNextKey();
} //GetNextKey
//+---------------------------------------------------------------------------
//----------------------------------------------------------------------------
const CKeyBuf * CMPersDeComp::GetNextKey( BitOffset * pBitOff )
{
Win4Assert( _pActiveCursor );
return _pActiveCursor->GetNextKey( pBitOff );
}
//+---------------------------------------------------------------------------
//----------------------------------------------------------------------------
WORKID CMPersDeComp::WorkId()
{
Win4Assert( _pActiveCursor );
return _pActiveCursor->WorkId();
}
//+---------------------------------------------------------------------------
//----------------------------------------------------------------------------
WORKID CMPersDeComp::NextWorkId()
{
Win4Assert( _pActiveCursor );
return _pActiveCursor->NextWorkId();
}
//+---------------------------------------------------------------------------
//----------------------------------------------------------------------------
ULONG CMPersDeComp::WorkIdCount()
{
Win4Assert( _pActiveCursor );
return _pActiveCursor->WorkIdCount();
}
//+---------------------------------------------------------------------------
//----------------------------------------------------------------------------
OCCURRENCE CMPersDeComp::Occurrence()
{
Win4Assert( _pActiveCursor );
return _pActiveCursor->Occurrence();
}
//+---------------------------------------------------------------------------
//----------------------------------------------------------------------------
OCCURRENCE CMPersDeComp::NextOccurrence()
{
Win4Assert( _pActiveCursor );
return _pActiveCursor->NextOccurrence();
}
//+---------------------------------------------------------------------------
//----------------------------------------------------------------------------
OCCURRENCE CMPersDeComp::MaxOccurrence()
{
Win4Assert( _pActiveCursor );
return _pActiveCursor->MaxOccurrence();
}
//+---------------------------------------------------------------------------
//----------------------------------------------------------------------------
ULONG CMPersDeComp::OccurrenceCount()
{
Win4Assert( _pActiveCursor );
return _pActiveCursor->OccurrenceCount();
}
//+---------------------------------------------------------------------------
//----------------------------------------------------------------------------
ULONG CMPersDeComp::HitCount()
{
Win4Assert( _pActiveCursor );
return _pActiveCursor->HitCount();
}
| 33.991501 | 89 | 0.470373 | npocmaka |
b63afe8194090ac5b4c1ab136c4bc586106ba9d8 | 416 | hpp | C++ | round_down_to_power_of_2/round_down_to_power_of_2.hpp | mstankus/my-common-cpp | 8b3e282e6fd987bf53886a262a96daf9bd9e8a6e | [
"MIT"
] | null | null | null | round_down_to_power_of_2/round_down_to_power_of_2.hpp | mstankus/my-common-cpp | 8b3e282e6fd987bf53886a262a96daf9bd9e8a6e | [
"MIT"
] | null | null | null | round_down_to_power_of_2/round_down_to_power_of_2.hpp | mstankus/my-common-cpp | 8b3e282e6fd987bf53886a262a96daf9bd9e8a6e | [
"MIT"
] | null | null | null | // From https://www.geeksforgeeks.org/find-significant-set-bit-number/
#ifndef INCLUDED_ROUND_DOWN_TO_POWER_OF_2_HPP
#define INCLUDED_ROUND_DOWN_TO_POWER_OF_2_HPP
#include <cstddef>
inline constexpr std::size_t round_down_to_power_of_2(std::size_t n)
{
if (n == 0)
return 0;
int msb = 0;
n = n / 2;
while (n != 0) {
n = n / 2;
msb++;
}
return (1 << msb);
}
#endif
| 18.086957 | 70 | 0.629808 | mstankus |
b63fc4e65fd426699d624b3f0fd5e009206123af | 25,052 | cpp | C++ | Stars45/CampaignSaveGame.cpp | RogerioY/starshatter-open | 3a507e08b1d4e5970b27401a7e6517570d529400 | [
"BSD-3-Clause"
] | null | null | null | Stars45/CampaignSaveGame.cpp | RogerioY/starshatter-open | 3a507e08b1d4e5970b27401a7e6517570d529400 | [
"BSD-3-Clause"
] | 4 | 2019-09-05T22:22:57.000Z | 2021-03-28T02:09:24.000Z | Stars45/CampaignSaveGame.cpp | RogerioY/starshatter-open | 3a507e08b1d4e5970b27401a7e6517570d529400 | [
"BSD-3-Clause"
] | null | null | null | /* Starshatter OpenSource Distribution
Copyright (c) 1997-2004, Destroyer Studios LLC.
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 "Destroyer Studios" 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.
SUBSYSTEM: Stars.exe
FILE: CampaignSaveGame.cpp
AUTHOR: John DiCamillo
OVERVIEW
========
CampaignSaveGame contains the logic needed to save and load
campaign games in progress.
*/
#include "MemDebug.h"
#include "CampaignSaveGame.h"
#include "Campaign.h"
#include "Combatant.h"
#include "CombatAction.h"
#include "CombatEvent.h"
#include "CombatGroup.h"
#include "CombatUnit.h"
#include "CombatZone.h"
#include "Galaxy.h"
#include "Mission.h"
#include "StarSystem.h"
#include "Player.h"
#include "Game.h"
#include "DataLoader.h"
#include "ParseUtil.h"
#include "FormatUtil.h"
static const char* SAVE_DIR = "SaveGame";
// +--------------------------------------------------------------------+
CampaignSaveGame::CampaignSaveGame(Campaign* c)
: campaign(c)
{ }
// +--------------------------------------------------------------------+
CampaignSaveGame::~CampaignSaveGame()
{ }
// +--------------------------------------------------------------------+
Text
CampaignSaveGame::GetSaveDirectory()
{
return GetSaveDirectory(Player::GetCurrentPlayer());
}
Text
CampaignSaveGame::GetSaveDirectory(Player* player)
{
if (player) {
char save_dir[32];
sprintf_s(save_dir, "%s/%02d", SAVE_DIR, player->Identity());
return save_dir;
}
return SAVE_DIR;
}
void
CampaignSaveGame::CreateSaveDirectory()
{
HANDLE hDir = CreateFile(SAVE_DIR, 0, 0, 0, OPEN_EXISTING, 0, 0);
if (hDir == INVALID_HANDLE_VALUE)
CreateDirectory(SAVE_DIR, NULL);
else
CloseHandle(hDir);
hDir = CreateFile(GetSaveDirectory(), 0, 0, 0, OPEN_EXISTING, 0, 0);
if (hDir == INVALID_HANDLE_VALUE)
CreateDirectory(GetSaveDirectory(), NULL);
else
CloseHandle(hDir);
}
// +--------------------------------------------------------------------+
static char multiline[4096];
static char* FormatMultiLine(const char* s)
{
int i = 4095;
char* p = multiline;
while (*s && i > 0) {
if (*s == '\n') {
*p++ = '\\';
*p++ = 'n';
s++;
i -= 2;
}
else if (*s == '"') {
*p++ = '\\';
*p++ = '"';
s++;
i -= 2;
}
else {
*p++ = *s++;
i--;
}
}
*p = 0;
return multiline;
}
static char* ParseMultiLine(const char* s)
{
int i = 4095;
char* p = multiline;
while (*s && i > 0) {
if (*s == '\\') {
s++;
if (*s == 'n') {
*p++ = '\n';
#pragma warning(suppress: 6269)
*s++;
i--;
}
else if (*s == '"') {
*p++ = '"';
#pragma warning(suppress: 6269)
*s++;
i--;
}
else {
*p++ = *s++;
i--;
}
}
else {
*p++ = *s++;
i--;
}
}
*p = 0;
return multiline;
}
void
CampaignSaveGame::Load(const char* filename)
{
Print("-------------------------\nLOADING SAVEGAME (%s).\n", filename);
campaign = 0;
if (!filename || !filename[0]) return;
DataLoader* loader = DataLoader::GetLoader();
bool use_file_sys = loader->IsFileSystemEnabled();
loader->UseFileSystem(true);
loader->SetDataPath(GetSaveDirectory() + "/");
BYTE* block;
loader->LoadBuffer(filename, block, true);
loader->UseFileSystem(use_file_sys);
Sleep(10);
Parser parser(new(__FILE__,__LINE__) BlockReader((const char*) block));
Term* term = parser.ParseTerm();
if (!term) {
Print("ERROR: could not parse save game '%s'\n", filename);
loader->SetDataPath(0);
return;
}
else {
TermText* file_type = term->isText();
if (!file_type || file_type->value() != "SAVEGAME") {
Print("ERROR: invalid save game file '%s'\n", filename);
term->print(10);
loader->SetDataPath(0);
delete term;
return;
}
}
int grp_iff = 0;
int grp_type = 0;
int grp_id = 0;
int status = 0;
double baseTime = 0;
double time = 0;
Text unit;
Text sitrep;
Text orders;
do {
Sleep(5);
delete term; term = 0;
term = parser.ParseTerm();
if (term) {
TermDef* def = term->isDef();
if (def) {
if (def->name()->value() == "campaign") {
Text cname;
int cid=0;
if (def->term()) {
if (def->term()->isText())
cname = def->term()->isText()->value();
else if (def->term()->isNumber())
cid = (int) def->term()->isNumber()->value();
}
if (!campaign) {
List<Campaign>& list = Campaign::GetAllCampaigns();
for (int i = 0; i < list.size() && !campaign; i++) {
Campaign* c = list.at(i);
if (cname == c->Name() || cid == c->GetCampaignId()) {
campaign = c;
campaign->Load();
campaign->Prep(); // restore campaign to pristine state
loader->SetDataPath(GetSaveDirectory() + "/");
}
}
}
}
else if (def->name()->value() == "grp_iff") {
GetDefNumber(grp_iff, def, filename);
}
else if (def->name()->value() == "grp_type") {
GetDefNumber(grp_type, def, filename);
}
else if (def->name()->value() == "grp_id") {
GetDefNumber(grp_id, def, filename);
}
else if (def->name()->value() == "unit") {
GetDefText(unit, def, filename);
}
else if (def->name()->value() == "status") {
GetDefNumber(status, def, filename);
}
else if (def->name()->value() == "basetime") {
GetDefNumber(baseTime, def, filename);
}
else if (def->name()->value() == "time") {
GetDefNumber(time, def, filename);
}
else if (def->name()->value() == "sitrep") {
GetDefText(sitrep, def, filename);
}
else if (def->name()->value() == "orders") {
GetDefText(orders, def, filename);
}
else if (def->name()->value() == "combatant") {
if (!def->term() || !def->term()->isStruct()) {
::Print("WARNING: combatant struct missing in '%s/%s'\n", loader->GetDataPath(), filename);
}
else {
TermStruct* val = def->term()->isStruct();
char name[64];
int iff = 0;
int score = 0;
ZeroMemory(name, sizeof(name));
for (int i = 0; i < val->elements()->size(); i++) {
TermDef* pdef = val->elements()->at(i)->isDef();
if (pdef) {
if (pdef->name()->value() == "name")
GetDefText(name, pdef, filename);
else if (pdef->name()->value() == "iff") {
GetDefNumber(iff, pdef, filename);
}
else if (pdef->name()->value() == "score") {
GetDefNumber(score, pdef, filename);
}
}
}
if (campaign && name[0]) {
Combatant* combatant = campaign->GetCombatant(name);
if (combatant) {
CombatGroup::MergeOrderOfBattle(block, filename, iff, combatant, campaign);
combatant->SetScore(score);
}
else {
::Print("WARNING: could not find combatant '%s' in campaign.\n", name);
}
}
}
}
else if (def->name()->value() == "event") {
if (!def->term() || !def->term()->isStruct()) {
::Print("WARNING: event struct missing in '%s/%s'\n", loader->GetDataPath(), filename);
}
else {
TermStruct* val = def->term()->isStruct();
char type[64];
char source[64];
char region[64];
char title[256];
char file[256];
char image[256];
char scene[256];
char info[4096];
int time = 0;
int team = 0;
int points = 0;
type[0] = 0;
info[0] = 0;
file[0] = 0;
image[0] = 0;
scene[0] = 0;
title[0] = 0;
region[0] = 0;
source[0] = 0;
for (int i = 0; i < val->elements()->size(); i++) {
TermDef* pdef = val->elements()->at(i)->isDef();
if (pdef) {
if (pdef->name()->value() == "type")
GetDefText(type, pdef, filename);
else if (pdef->name()->value() == "source")
GetDefText(source, pdef, filename);
else if (pdef->name()->value() == "region")
GetDefText(region, pdef, filename);
else if (pdef->name()->value() == "title")
GetDefText(title, pdef, filename);
else if (pdef->name()->value() == "file")
GetDefText(file, pdef, filename);
else if (pdef->name()->value() == "image")
GetDefText(image, pdef, filename);
else if (pdef->name()->value() == "scene")
GetDefText(scene, pdef, filename);
else if (pdef->name()->value() == "info")
GetDefText(info, pdef, filename);
else if (pdef->name()->value() == "time")
GetDefNumber(time, pdef, filename);
else if (pdef->name()->value() == "team")
GetDefNumber(team, pdef, filename);
else if (pdef->name()->value() == "points")
GetDefNumber(points, pdef, filename);
}
}
if (campaign && type[0]) {
loader->SetDataPath(campaign->Path());
CombatEvent* event = new(__FILE__,__LINE__)
CombatEvent(campaign,
CombatEvent::TypeFromName(type),
time,
team,
CombatEvent::SourceFromName(source),
region);
if (event) {
event->SetTitle(title);
event->SetFilename(file);
event->SetImageFile(image);
event->SetSceneFile(scene);
event->Load();
if (info[0])
event->SetInformation(ParseMultiLine(info));
event->SetVisited(true);
campaign->GetEvents().append(event);
}
}
}
}
else if (def->name()->value() == "action") {
if (!def->term() || !def->term()->isStruct()) {
::Print("WARNING: action struct missing in '%s/%s'\n", loader->GetDataPath(), filename);
}
else {
TermStruct* val = def->term()->isStruct();
int id = -1;
int stat = 0;
int count = 0;
int after = 0;
for (int i = 0; i < val->elements()->size(); i++) {
TermDef* pdef = val->elements()->at(i)->isDef();
if (pdef) {
if (pdef->name()->value() == "id")
GetDefNumber(id, pdef, filename);
else if (pdef->name()->value() == "stat")
GetDefNumber(stat, pdef, filename);
else if (pdef->name()->value() == "count")
GetDefNumber(count, pdef, filename);
else if (pdef->name()->value().contains("after"))
GetDefNumber(after, pdef, filename);
}
}
if (campaign && id >= 0) {
ListIter<CombatAction> a_iter = campaign->GetActions();
while (++a_iter) {
CombatAction* a = a_iter.value();
if (a->Identity() == id) {
a->SetStatus(stat);
if (count)
a->SetCount(count);
if (after)
a->SetStartAfter(after);
break;
}
}
}
}
}
}
}
}
while (term);
if (term) {
delete term;
term = 0;
}
if (campaign) {
campaign->SetSaveGame(true);
List<Campaign>& list = Campaign::GetAllCampaigns();
if (status < Campaign::CAMPAIGN_SUCCESS) {
campaign->SetStatus(status);
if (sitrep.length()) campaign->SetSituation(sitrep);
if (orders.length()) campaign->SetOrders(orders);
campaign->SetStartTime(baseTime);
campaign->SetLoadTime(baseTime + time);
campaign->LockoutEvents(3600);
campaign->Start();
if (grp_type >= CombatGroup::FLEET && grp_type <= CombatGroup::PRIVATE) {
CombatGroup* player_group = campaign->FindGroup(grp_iff, grp_type, grp_id);
if (player_group) {
CombatUnit* player_unit = 0;
if (unit.length())
player_unit = player_group->FindUnit(unit);
if (player_unit)
campaign->SetPlayerUnit(player_unit);
else
campaign->SetPlayerGroup(player_group);
}
}
}
// failed - restart current campaign:
else if (status == Campaign::CAMPAIGN_FAILED) {
Print("CampaignSaveGame: Loading FAILED campaign, restarting '%s'\n",
campaign->Name());
campaign->Load();
campaign->Prep(); // restore campaign to pristine state
campaign->SetSaveGame(false);
loader->SetDataPath(GetSaveDirectory() + "/");
}
// start next campaign:
else if (status == Campaign::CAMPAIGN_SUCCESS) {
Print("CampaignSaveGame: Loading COMPLETED campaign '%s', searching for next campaign...\n",
campaign->Name());
bool found = false;
for (int i = 0; i < list.size() && !found; i++) {
Campaign* c = list.at(i);
if (c->GetCampaignId() == campaign->GetCampaignId()+1) {
campaign = c;
campaign->Load();
campaign->Prep(); // restore campaign to pristine state
Print("Advanced to campaign %d '%s'\n",
campaign->GetCampaignId(),
campaign->Name());
loader->SetDataPath(GetSaveDirectory() + "/");
found = true;
}
}
// if no next campaign found, start over from the beginning:
for (int i = 0; i < list.size() && !found; i++) {
Campaign* c = list.at(i);
if (c->IsDynamic()) {
campaign = c;
campaign->Load();
campaign->Prep(); // restore campaign to pristine state
Print("Completed full series, restarting at %d '%s'\n",
campaign->GetCampaignId(),
campaign->Name());
loader->SetDataPath(GetSaveDirectory() + "/");
found = true;
}
}
}
}
loader->ReleaseBuffer(block);
loader->SetDataPath(0);
Print("SAVEGAME LOADED (%s).\n\n", filename);
}
// +--------------------------------------------------------------------+
void
CampaignSaveGame::Save(const char* name)
{
if (!campaign) return;
CreateSaveDirectory();
Text s = GetSaveDirectory() + Text("/") + Text(name);
FILE* f;
fopen_s(&f, s, "w");
if (f) {
char timestr[32];
FormatDayTime(timestr, campaign->GetTime());
CombatGroup* player_group = campaign->GetPlayerGroup();
CombatUnit* player_unit = campaign->GetPlayerUnit();
fprintf(f, "SAVEGAME\n\n");
fprintf(f, "campaign: \"%s\"\n\n", campaign->Name());
fprintf(f, "grp_iff: %d\n", (int) player_group->GetIFF());
fprintf(f, "grp_type: %d\n", (int) player_group->Type());
fprintf(f, "grp_id: %d\n", (int) player_group->GetID());
if (player_unit)
fprintf(f, "unit: \"%s\"\n", player_unit->Name().data());
fprintf(f, "status: %d\n", (int) campaign->GetStatus());
fprintf(f, "basetime: %f\n", campaign->GetStartTime());
fprintf(f, "time: %f // %s\n\n",
campaign->GetTime(),
timestr);
fprintf(f, "sitrep: \"%s\"\n", campaign->Situation());
fprintf(f, "orders: \"%s\"\n\n", campaign->Orders());
ListIter<Combatant> c_iter = campaign->GetCombatants();
while (++c_iter) {
Combatant* c = c_iter.value();
fprintf(f, "combatant: {");
fprintf(f, " name:\"%s\",", c->Name());
fprintf(f, " iff:%d,", c->GetIFF());
fprintf(f, " score:%d,", c->Score());
fprintf(f, " }\n");
}
fprintf(f, "\n");
ListIter<CombatAction> a_iter = campaign->GetActions();
while (++a_iter) {
CombatAction* a = a_iter.value();
fprintf(f, "action: { id:%4d, stat:%d", a->Identity(), a->Status());
if (a->Status() == CombatAction::PENDING) {
if (a->Count())
fprintf(f, ", count:%d", a->Count());
if (a->StartAfter())
fprintf(f, ", after:%d", a->StartAfter());
}
fprintf(f, " }\n");
}
fprintf(f, "\n");
ListIter<CombatEvent> e_iter = campaign->GetEvents();
while (++e_iter) {
CombatEvent* e = e_iter.value();
fprintf(f, "event: {");
fprintf(f, " type:%-18s,", e->TypeName());
fprintf(f, " time:0x%08x,", e->Time());
fprintf(f, " team:%d,", e->GetIFF());
fprintf(f, " points:%d,", e->Points());
fprintf(f, " source:\"%s\",", e->SourceName());
fprintf(f, " region:\"%s\",", e->Region());
fprintf(f, " title:\"%s\",", e->Title());
if (e->Filename())
fprintf(f, " file:\"%s\",", e->Filename());
if (e->ImageFile())
fprintf(f, " image:\"%s\",", e->ImageFile());
if (e->SceneFile())
fprintf(f, " scene:\"%s\",", e->SceneFile());
if (!e->Filename() || *e->Filename() == 0)
fprintf(f, " info:\"%s\"", FormatMultiLine(e->Information()));
fprintf(f, " }\n");
}
fprintf(f, "\n// ORDER OF BATTLE:\n\n");
fclose(f);
c_iter.reset();
while (++c_iter) {
Combatant* c = c_iter.value();
CombatGroup* g = c->GetForce();
CombatGroup::SaveOrderOfBattle(s, g);
}
}
}
void
CampaignSaveGame::Delete(const char* name)
{
DeleteFile(GetSaveDirectory() + "/" + name);
}
void
CampaignSaveGame::RemovePlayer(Player* p)
{
List<Text> save_list;
Text save_dir = GetSaveDirectory(p) + "/";
DataLoader* loader = DataLoader::GetLoader();
bool use_file_sys = loader->IsFileSystemEnabled();
loader->UseFileSystem(true);
loader->SetDataPath(save_dir);
loader->ListFiles("*.*", save_list);
loader->SetDataPath(0);
loader->UseFileSystem(use_file_sys);
for (int i = 0; i < save_list.size(); i++) {
Text* filename = save_list[i];
DeleteFile(save_dir + filename->data());
}
save_list.destroy();
RemoveDirectory(GetSaveDirectory(p));
}
// +--------------------------------------------------------------------+
void
CampaignSaveGame::SaveAuto()
{
Save("AutoSave");
}
void
CampaignSaveGame::LoadAuto()
{
Load("AutoSave");
}
// +--------------------------------------------------------------------+
Text
CampaignSaveGame::GetResumeFile()
{
// check for auto save game:
FILE* f;
::fopen_s(&f, GetSaveDirectory() + "/AutoSave", "r");
if (f) {
::fclose(f);
return "AutoSave";
}
return Text();
}
int
CampaignSaveGame::GetSaveGameList(List<Text>& save_list)
{
DataLoader* loader = DataLoader::GetLoader();
bool use_file_sys = loader->IsFileSystemEnabled();
loader->UseFileSystem(true);
loader->SetDataPath(GetSaveDirectory() + "/");
loader->ListFiles("*.*", save_list);
loader->SetDataPath(0);
loader->UseFileSystem(use_file_sys);
return save_list.size();
}
| 32.963158 | 115 | 0.433059 | RogerioY |
b642a8d35135ae8eb5183376dff83b920344d05b | 5,828 | cpp | C++ | JustnEngine/src/Components/Collider.cpp | JustenG/ComputerGraphics | 81a1859206aaeb6498cbbb1607b04ba6d0d2e978 | [
"Unlicense"
] | null | null | null | JustnEngine/src/Components/Collider.cpp | JustenG/ComputerGraphics | 81a1859206aaeb6498cbbb1607b04ba6d0d2e978 | [
"Unlicense"
] | null | null | null | JustnEngine/src/Components/Collider.cpp | JustenG/ComputerGraphics | 81a1859206aaeb6498cbbb1607b04ba6d0d2e978 | [
"Unlicense"
] | null | null | null | #include "Components\Collider.h"
#include "Components\Transform.h"
#include "Components\Terrain.h"
#include "Components\RigidBody.h"
#include "Components\PlayerController.h"
#include "Entitys\GameObject.h"
#include "Physics\PhysXManager.h"
#include "all_includes.h"
#include <algorithm>
Collider::Collider()
{
m_physXManager = PhysXManager::GetInstance();
m_physics = m_physXManager->GetPhysics();
m_cooking = m_physXManager->GetCooking();
m_physXMaterial = m_physics->createMaterial(0.5f, 0.5f, 0.5f);
m_xScale = 1;
m_yScale = 1;
m_zScale = 1;
m_actor = nullptr;
m_shape = nullptr;
m_isBox = true;
m_isSphere = false;
m_isCapsules = false;
m_isPlane = false;
m_isMeshConvex = false;
m_isMeshConcave = false;
m_isTerrain = false;
m_shapeIndex = 0;
m_dataBinder = new ColliderDataBinder(
m_isBox,
m_isSphere,
m_isCapsules,
m_isPlane,
m_isMeshConvex,
m_isMeshConcave,
m_isTerrain);
vector<string> names;
names.push_back("Box");
names.push_back("Sphere");
names.push_back("Capsules");
names.push_back("Plane");
names.push_back("Convex Mesh");
names.push_back("Concave Mesh");
names.push_back("Terrain");
m_dataBinder->SetNames(names);
}
BaseData* Collider::ToData()
{
return m_dataBinder->Get();
}
void Collider::FromData(BaseData* newData)
{
if (Validate(newData))
{
m_dataBinder->Set(newData);
}
else;
//Data not valid
}
bool Collider::Validate(BaseData* newData)
{
vector<BaseData*> children = newData->GetChildren();
bool isDirty = false;
int newIndex = -1;
if (!DataConverter::DataEqualsPrimitive(m_isBox, children[0]))
{
newIndex = 0;
isDirty = true;
}
if(!DataConverter::DataEqualsPrimitive(m_isSphere, children[1]))
{
newIndex = 1;
isDirty = true;
}
if (!DataConverter::DataEqualsPrimitive(m_isCapsules, children[2]))
{
newIndex = 2;
isDirty = true;
}
if (!DataConverter::DataEqualsPrimitive(m_isPlane, children[3]))
{
newIndex = 3;
isDirty = true;
}
if (!DataConverter::DataEqualsPrimitive(m_isMeshConvex, children[4]))
{
newIndex = 4;
isDirty = true;
}
if (!DataConverter::DataEqualsPrimitive(m_isMeshConcave, children[5]))
{
newIndex = 5;
isDirty = true;
}
if(!DataConverter::DataEqualsPrimitive(m_isTerrain, children[6]))
{
newIndex = 6;
isDirty = true;
}
if (isDirty)
{
DataConverter::SetPrimitive(children[m_shapeIndex], false);
m_shapeIndex = newIndex;
}
return isDirty;
}
Collider::~Collider()
{
}
void Collider::Update()
{
if (m_actor == nullptr)
return;
m_myTransform = GetGameObject()->GetComponent<Transform>();
PxVec3 pos = m_actor->getGlobalPose().p;
PxQuat rot = m_actor->getGlobalPose().q;
m_myTransform->SetPosition(pos.x, pos.y, pos.z);
m_myTransform->SetRotation(rot.x, rot.y, rot.z, rot.w);
}
void Collider::Start()
{
if (m_shape != nullptr)
m_shape->release();
m_myTransform = GetGameObject()->GetComponent<Transform>();
if (m_isBox) InitBox();
if (m_isSphere) InitSphere();
if (m_isCapsules) InitCapsules();
if (m_isPlane) InitPlane();
if (m_isMeshConvex) InitMeshConvex();
if (m_isMeshConcave) InitMeshConcave();
if (m_isTerrain) InitTerrain();
}
void Collider::InitBox()
{
m_shape = m_physics->createShape(PxBoxGeometry(m_myTransform->GetScale().x * m_xScale, m_myTransform->GetScale().y * m_yScale, m_myTransform->GetScale().z * m_zScale), *m_physXMaterial);
SetActor();
}
void Collider::InitSphere()
{
float position[] = { m_myTransform->GetScale().x * m_xScale, m_myTransform->GetScale().y * m_yScale, m_myTransform->GetScale().z * m_zScale };
float radius = *std::max_element(position, position + 3);
m_shape = m_physics->createShape(PxSphereGeometry(radius), *m_physXMaterial);
SetActor();
}
void Collider::InitCapsules()
{
float position[] = { m_myTransform->GetScale().x * m_xScale, m_myTransform->GetScale().z * m_zScale };
float radius = *std::max_element(position, position + 2);
m_shape = m_physics->createShape(PxCapsuleGeometry(radius, m_myTransform->GetScale().y/2 * m_yScale), *m_physXMaterial);
SetActor();
}
void Collider::InitPlane()
{
m_shape = m_physics->createShape(PxPlaneGeometry(), *m_physXMaterial);
SetActor();
}
void Collider::InitMeshConvex()
{
}
void Collider::InitMeshConcave()
{
}
void Collider::InitTerrain()
{
m_myTransform = GetGameObject()->GetComponent<Transform>();
Terrain* myTerrain = GetGameObject()->GetComponent<Terrain>();
if (myTerrain == nullptr)
{
printf("Error: GameObject has not Terrain");
return;
}
int size = myTerrain->GetSize();
PxHeightFieldDesc hfDesc;
hfDesc.format = PxHeightFieldFormat::eS16_TM;
hfDesc.nbColumns = size;
hfDesc.nbRows = size;
hfDesc.samples.data = myTerrain->GetHeightMap();
hfDesc.samples.stride = sizeof(PxHeightFieldSample);
hfDesc.thickness = -100.0f;
PxHeightField* heightField = m_cooking->createHeightField(hfDesc, m_physics->getPhysicsInsertionCallback());
PxHeightFieldGeometry hfGeom(heightField, PxMeshGeometryFlags(), m_myTransform->GetScale().y, m_myTransform->GetScale().z, m_myTransform->GetScale().x);
m_shape = m_physics->createShape((PxHeightFieldGeometry)hfGeom, *m_physXMaterial);
SetActor();
}
void Collider::SetActor()
{
if (GetGameObject()->GetComponent<PlayerController>() != nullptr)
{
return;
}
PxTransform pose = PxTransform(PxVec3(m_myTransform->GetPosition().x, m_myTransform->GetPosition().y, m_myTransform->GetPosition().z));
if (m_actor != nullptr)
{
m_physXManager->RemoveActorFromScene(m_actor);
m_actor->release();
}
if (GetGameObject()->GetComponent<RigidBody>() != nullptr)
{
if (GetGameObject()->GetStaticTag() == true)
m_actor = PxCreateStatic(*m_physics, pose, *m_shape);
else
m_actor = PxCreateDynamic(*m_physics, pose, *m_shape, 1);
}
else
{
m_actor = PxCreateStatic(*m_physics, pose, *m_shape);
}
m_physXManager->AddActorToScene(m_actor);
} | 23.595142 | 187 | 0.721174 | JustenG |
b644836c49bc9986a821ec808e76884c645956e2 | 4,930 | cpp | C++ | src/Chapter002/main.cpp | paulkokos/GLFW3_Tutorials | 8935656cd5f3c9a6083196c0b04ed4d7e42451e5 | [
"BSD-3-Clause"
] | 3 | 2020-12-23T14:11:15.000Z | 2021-02-07T07:48:04.000Z | src/Chapter002/main.cpp | paulkokos/GLFW3_Tutorials | 8935656cd5f3c9a6083196c0b04ed4d7e42451e5 | [
"BSD-3-Clause"
] | null | null | null | src/Chapter002/main.cpp | paulkokos/GLFW3_Tutorials | 8935656cd5f3c9a6083196c0b04ed4d7e42451e5 | [
"BSD-3-Clause"
] | null | null | null | #include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <thread>
#include <string>
#include <fstream>
#include <iostream>
#include <sstream>
// Global Variables
const char* APP_TITLE = "Introduction to Modern OpenGL - Hello Window 1";
const int gWindowWidth = 800;
const int gWindowHeight = 600;
void glfw_onKey(GLFWwindow* window, int key, int scancode, int action, int mode);
void glfw_onFramebufferSize(GLFWwindow* window, int width, int height);
void showFPS(GLFWwindow* window);
//-----------------------------------------------------------------------------
// Main Application Entry Point
//-----------------------------------------------------------------------------
int main()
{
if (!glfwInit())
{
// An error occured
std::cerr << "GLFW initialization failed" << std::endl;
return -1;
}
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // forward compatible with newer versions of OpenGL as they become available but not backward compatible (it will not run on devices that do not support OpenGL 3.3
// Create an OpenGL 3.3 core, forward compatible context full screen application
GLFWwindow* pWindow = NULL;
GLFWmonitor* pMonitor = glfwGetPrimaryMonitor();
const GLFWvidmode* pVmode = glfwGetVideoMode(pMonitor);
if (pVmode != NULL)
{
pWindow = glfwCreateWindow(pVmode->width, pVmode->height, APP_TITLE, pMonitor, NULL);
if (pWindow == NULL)
{
std::cerr << "Failed to create GLFW window" << std::endl;
glfwTerminate();
return -1;
}
}
// Make the window's context the current one
glfwMakeContextCurrent(pWindow);
// Initialize GLEW
glewExperimental = GL_TRUE;
if (glewInit() != GLEW_OK)
{
std::cerr << "Failed to initialize GLEW" << std::endl;
return -1;
}
// Set the required callback functions
glfwSetKeyCallback(pWindow, glfw_onKey);
glfwSetFramebufferSizeCallback(pWindow, glfw_onFramebufferSize);
// OpenGL version info
const GLubyte* renderer = glGetString(GL_RENDERER);
const GLubyte* version = glGetString(GL_VERSION);
std::cout << "Renderer: " << renderer << std::endl;
std::cout << "OpenGL version supported: " << version << std::endl;
std::cout << "OpenGL Initialization Complete" << std::endl;
// Main Loop
while (!glfwWindowShouldClose(pWindow))
{
showFPS(pWindow);
// Poll for and process events
glfwPollEvents();
// Render the scene
glClearColor(0.23f, 0.38f, 0.47f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
// Swap front and back buffers
glfwSwapBuffers(pWindow);
}
// Clean up
glfwTerminate();
return 0;
}
//-----------------------------------------------------------------------------
// Is called whenever a key is pressed/released via GLFW
//-----------------------------------------------------------------------------
void glfw_onKey(GLFWwindow* window, int key, int scancode, int action, int mode)
{
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
}
//-----------------------------------------------------------------------------
// Is called when the window is resized
//-----------------------------------------------------------------------------
void glfw_onFramebufferSize(GLFWwindow* window, int width, int height)
{
glViewport(0, 0, width, height);
}
//-----------------------------------------------------------------------------
// Code computes the average frames per second, and also the average time it takes
// to render one frame. These stats are appended to the window caption bar.
//-----------------------------------------------------------------------------
void showFPS(GLFWwindow* window)
{
static double previousSeconds = 0.0;
static int frameCount = 0;
double elapsedSeconds;
double currentSeconds = glfwGetTime(); // returns number of seconds since GLFW started, as double float
elapsedSeconds = currentSeconds - previousSeconds;
// Limit text updates to 4 times per second
if (elapsedSeconds > 0.25)
{
previousSeconds = currentSeconds;
double fps = (double)frameCount / elapsedSeconds;
double msPerFrame = 1000.0 / fps;
// The C++ way of setting the window title
std::ostringstream outs;
outs.precision(3); // decimal places
outs << std::fixed
<< APP_TITLE << " "
<< "FPS: " << fps << " "
<< "Frame Time: " << msPerFrame << " (ms)";
glfwSetWindowTitle(window, outs.str().c_str());
// Reset for next average.
frameCount = 0;
}
frameCount++;
} | 33.087248 | 220 | 0.571805 | paulkokos |
b648b9e0e35ea1d4de14c16bf368c93d4bc9aeae | 13,213 | cpp | C++ | cam-occ/trunk/src/qocc/qoccinputoutput.cpp | play113/swer | 78764c67885dfacb1fa24e494a20681265f5254c | [
"MIT"
] | null | null | null | cam-occ/trunk/src/qocc/qoccinputoutput.cpp | play113/swer | 78764c67885dfacb1fa24e494a20681265f5254c | [
"MIT"
] | null | null | null | cam-occ/trunk/src/qocc/qoccinputoutput.cpp | play113/swer | 78764c67885dfacb1fa24e494a20681265f5254c | [
"MIT"
] | 1 | 2020-07-04T13:58:00.000Z | 2020-07-04T13:58:00.000Z | /****************************************************************************
**
** This file is part of the QtOpenCascade Toolkit.
**
** This file may be used under the terms of the GNU General Public
** License version 2.0 as published by the Free Software Foundation
** and appearing in the file COPYING included in the packaging of
** this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** Copyright (C) Peter Dolbey 2006. All rights reserved.
**
****************************************************************************/
/*!
\class QoccInputOutput
\brief This class provides input/output elements of the QtOpenCascade Toolkit.
Currently a "work-in-progress", based on the standard examples. The
main lesson learnt here is that with Qt4 you cannot directly cast
QString to a "char *", so to transform to a OCC Standard_CString use
<pre>Standard_CString s = aQString.toAscii().data() ;</pre>
\author Peter C. Dolbey
*/
#include <QtGui/QApplication>
#include "qoccinternal.h"
#include "qoccinputoutput.h"
QoccInputOutput::QoccInputOutput(void)
{
}
QoccInputOutput::~QoccInputOutput(void)
{
}
bool QoccInputOutput::importModel( const QString fileName,
const FileFormat format,
const Handle_AIS_InteractiveContext& ic )
{
QApplication::setOverrideCursor( Qt::WaitCursor );
Handle_TopTools_HSequenceOfShape shapes = importModel( format, fileName );
QApplication::restoreOverrideCursor();
if ( shapes.IsNull() || !shapes->Length() )
{
return false;
}
for ( int i = 1; i <= shapes->Length(); i++ )
{
Handle(AIS_Shape) anAISShape = new AIS_Shape( shapes->Value( i ) );
ic->SetMaterial( anAISShape, Graphic3d_NOM_GOLD);
ic->SetColor( anAISShape, Quantity_NOC_RED);
ic->SetDisplayMode( anAISShape, 1, Standard_False );
ic->Display(anAISShape, Standard_False);
}
ic->UpdateCurrentViewer();
return true;
}
Handle_TopTools_HSequenceOfShape QoccInputOutput::importModel( const FileFormat format, const QString& file )
{
Handle_TopTools_HSequenceOfShape shapes;
try {
switch ( format )
{
case FormatBREP:
shapes = importBREP( file );
break;
case FormatIGES:
shapes = importIGES( file );
break;
case FormatSTEP:
shapes = importSTEP( file );
break;
case FormatCSFDB:
shapes = importCSFDB( file );
break;
default:
// To Do - Error message here?
break;
}
} catch ( Standard_Failure ) {
shapes.Nullify();
}
return shapes;
}
/******************************************************************
* EXPORT FUNCTIONALITY
******************************************************************/
bool QoccInputOutput::exportModel( const QString fileName,
const FileFormat format,
const Handle_AIS_InteractiveContext& ic )
{
Handle_TopTools_HSequenceOfShape shapes = getShapes( ic );
if ( shapes.IsNull() || !shapes->Length() )
return false;
QApplication::setOverrideCursor( Qt::WaitCursor );
bool stat = exportModel( format, fileName, shapes );
QApplication::restoreOverrideCursor();
return stat;
}
bool QoccInputOutput::exportModel( const FileFormat format, const QString& file, const Handle_TopTools_HSequenceOfShape& shapes )
{
bool status;
try {
switch ( format )
{
case FormatBREP:
status = exportBREP( file, shapes );
break;
case FormatIGES:
status = exportIGES( file, shapes );
break;
case FormatSTEP:
status = exportSTEP( file, shapes );
break;
case FormatCSFDB:
status = exportCSFDB( file, shapes );
break;
case FormatSTL:
status = exportSTL( file, shapes );
break;
case FormatVRML:
status = exportVRML( file, shapes );
break;
}
} catch ( Standard_Failure ) {
status = false;
}
return status;
}
Handle_TopTools_HSequenceOfShape QoccInputOutput::getShapes( const Handle_AIS_InteractiveContext& ic )
{
Handle_TopTools_HSequenceOfShape aSequence;
Handle_AIS_InteractiveObject picked;
for ( ic->InitCurrent(); ic->MoreCurrent(); ic->NextCurrent() )
{
Handle_AIS_InteractiveObject obj = ic->Current();
if ( obj->IsKind( STANDARD_TYPE( AIS_Shape ) ) )
{
TopoDS_Shape shape = Handle_AIS_Shape::DownCast(obj)->Shape();
if ( aSequence.IsNull() )
aSequence = new TopTools_HSequenceOfShape();
aSequence->Append( shape );
}
}
return aSequence;
}
Handle_TopTools_HSequenceOfShape QoccInputOutput::importBREP( const QString& file )
{
Handle_TopTools_HSequenceOfShape aSequence;
TopoDS_Shape aShape;
BRep_Builder aBuilder;
Standard_Boolean result = BRepTools::Read( aShape, file.toAscii().data(), aBuilder );
if ( result )
{
aSequence = new TopTools_HSequenceOfShape();
aSequence->Append( aShape );
}
return aSequence;
}
Handle_TopTools_HSequenceOfShape QoccInputOutput::importIGES( const QString& file )
{
Handle_TopTools_HSequenceOfShape aSequence;
IGESControl_Reader Reader;
int status = Reader.ReadFile( file.toAscii().data() );
if ( status == IFSelect_RetDone )
{
aSequence = new TopTools_HSequenceOfShape();
Reader.TransferRoots();
TopoDS_Shape aShape = Reader.OneShape();
aSequence->Append( aShape );
}
return aSequence;
}
Handle_TopTools_HSequenceOfShape QoccInputOutput::importSTEP( const QString& file )
{
Handle_TopTools_HSequenceOfShape aSequence;
STEPControl_Reader aReader;
IFSelect_ReturnStatus status = aReader.ReadFile( file.toAscii().data() );
if ( status == IFSelect_RetDone )
{
//#warning changed from Interface_TraceFile
//Messenger_Message::SetDefault();
bool failsonly = false;
aReader.PrintCheckLoad( failsonly, IFSelect_ItemsByEntity );
int nbr = aReader.NbRootsForTransfer();
aReader.PrintCheckTransfer( failsonly, IFSelect_ItemsByEntity );
for ( Standard_Integer n = 1; n <= nbr; n++ )
{
bool ok = aReader.TransferRoot( n );
if (ok)
{
int nbs = aReader.NbShapes();
if ( nbs > 0 )
{
aSequence = new TopTools_HSequenceOfShape();
for ( int i = 1; i <= nbs; i++ )
{
TopoDS_Shape shape = aReader.Shape( i );
aSequence->Append( shape );
}
}
}
}
}
return aSequence;
}
Handle_TopTools_HSequenceOfShape QoccInputOutput::importCSFDB( const QString& file )
{
Handle_TopTools_HSequenceOfShape aSequence;
// Check file type
if ( FSD_File::IsGoodFileType( file.toAscii().data() ) != Storage_VSOk )
return aSequence;
static FSD_File fileDriver;
TCollection_AsciiString aName( file.toAscii().data() );
if ( fileDriver.Open( aName, Storage_VSRead ) != Storage_VSOk )
return aSequence;
Handle(ShapeSchema) schema = new ShapeSchema();
Handle(Storage_Data) data = schema->Read( fileDriver );
if ( data->ErrorStatus() != Storage_VSOk )
return aSequence;
fileDriver.Close();
aSequence = new TopTools_HSequenceOfShape();
Handle(Storage_HSeqOfRoot) roots = data->Roots();
for ( int i = 1; i <= roots->Length() ; i++ )
{
Handle(Storage_Root) r = roots->Value( i );
Handle(Standard_Persistent) p = r->Object();
Handle(PTopoDS_HShape) aPShape = Handle(PTopoDS_HShape)::DownCast(p);
if ( !aPShape.IsNull() )
{
PTColStd_PersistentTransientMap aMap;
TopoDS_Shape aTShape;
MgtBRep::Translate( aPShape, aMap, aTShape, MgtBRep_WithTriangle );
aSequence->Append( aTShape );
}
}
return aSequence;
}
bool QoccInputOutput::exportBREP( const QString& file, const Handle_TopTools_HSequenceOfShape& shapes )
{
if ( shapes.IsNull() || shapes->IsEmpty() )
return false;
TopoDS_Shape shape = shapes->Value( 1 );
return BRepTools::Write( shape, file.toAscii().data() );
}
bool QoccInputOutput::exportIGES( const QString& file, const Handle_TopTools_HSequenceOfShape& shapes )
{
if ( shapes.IsNull() || shapes->IsEmpty() )
return false;
IGESControl_Controller::Init();
IGESControl_Writer writer( Interface_Static::CVal( "XSTEP.iges.unit" ),
Interface_Static::IVal( "XSTEP.iges.writebrep.mode" ) );
for ( int i = 1; i <= shapes->Length(); i++ )
writer.AddShape ( shapes->Value( i ) );
writer.ComputeModel();
return writer.Write( file.toAscii().data() );
}
bool QoccInputOutput::exportSTEP( const QString& file, const Handle_TopTools_HSequenceOfShape& shapes )
{
if ( shapes.IsNull() || shapes->IsEmpty() )
return false;
IFSelect_ReturnStatus status;
STEPControl_Writer writer;
for ( int i = 1; i <= shapes->Length(); i++ )
{
status = writer.Transfer( shapes->Value( i ), STEPControl_AsIs );
if ( status != IFSelect_RetDone )
return false;
}
status = writer.Write( file.toAscii().data() );
switch ( status )
{
case IFSelect_RetError:
myInfo = tr( "INF_DATA_ERROR" );
break;
case IFSelect_RetFail:
myInfo = tr( "INF_WRITING_ERROR" );
break;
case IFSelect_RetVoid:
myInfo = tr( "INF_NOTHING_ERROR" );
break;
default:
break;
}
return status == IFSelect_RetDone;
}
bool QoccInputOutput::exportCSFDB( const QString& file, const Handle_TopTools_HSequenceOfShape& shapes )
{
if ( shapes.IsNull() || shapes->IsEmpty() )
return false;
static FSD_File fileDriver;
Handle(ShapeSchema) schema = new ShapeSchema();
Handle(Storage_Data) data = new Storage_Data();
data->ClearErrorStatus();
data->SetApplicationName( TCollection_ExtendedString( "Sample Import / Export" ) );
data->SetApplicationVersion( "1" );
data->SetDataType( TCollection_ExtendedString( "Shapes" ) );
data->AddToUserInfo( "Storing a persistent set of shapes in a flat file" );
data->AddToComments( TCollection_ExtendedString( "Application is based on CasCade 5.0 Professional" ) );
if ( fileDriver.Open( file.toAscii().data(), Storage_VSWrite ) != Storage_VSOk )
{
myInfo = tr( "INF_TRANSLATE_ERROR_CANTSAVEFILE" ).arg( file );
return false;
}
PTColStd_TransientPersistentMap aMap;
for ( int i = 1; i <= shapes->Length(); i++ )
{
TopoDS_Shape shape = shapes->Value( i );
if ( shape.IsNull() )
{
myInfo = tr( "INF_TRANSLATE_ERROR_INVALIDSHAPE" );
return false;
}
Handle(PTopoDS_HShape) pshape = MgtBRep::Translate( shape, aMap, MgtBRep_WithTriangle );
TCollection_AsciiString objName = TCollection_AsciiString( "Object_" ) + TCollection_AsciiString( i );
data->AddRoot( objName, pshape );
}
schema->Write( fileDriver, data );
fileDriver.Close();
if ( data->ErrorStatus() != Storage_VSOk )
{
myInfo = tr( "INF_TRANSLATE_ERROR_CANTSAVEDATA" );
return false;
}
return true;
}
bool QoccInputOutput::exportSTL( const QString& file, const Handle_TopTools_HSequenceOfShape& shapes )
{
if ( shapes.IsNull() || shapes->IsEmpty() )
return false;
TopoDS_Compound res;
BRep_Builder builder;
builder.MakeCompound( res );
for ( int i = 1; i <= shapes->Length(); i++ )
{
TopoDS_Shape shape = shapes->Value( i );
if ( shape.IsNull() )
{
myInfo = tr( "INF_TRANSLATE_ERROR_INVALIDSHAPE" );
return false;
}
builder.Add( res, shape );
}
StlAPI_Writer writer;
writer.Write( res, file.toAscii().data() );
return true;
}
bool QoccInputOutput::exportVRML( const QString& file, const Handle_TopTools_HSequenceOfShape& shapes )
{
if ( shapes.IsNull() || shapes->IsEmpty() )
return false;
TopoDS_Compound res;
BRep_Builder builder;
builder.MakeCompound( res );
for ( int i = 1; i <= shapes->Length(); i++ )
{
TopoDS_Shape shape = shapes->Value( i );
if ( shape.IsNull() )
{
myInfo = tr( "INF_TRANSLATE_ERROR_INVALIDSHAPE" );
return false;
}
builder.Add( res, shape );
}
VrmlAPI_Writer writer;
writer.Write( res, file.toAscii().data() );
return true;
}
bool QoccInputOutput::checkFacetedBrep( const Handle_TopTools_HSequenceOfShape& shapes )
{
bool err = false;
for ( int i = 1; i <= shapes->Length(); i++ )
{
TopoDS_Shape shape = shapes->Value( i );
for ( TopExp_Explorer fexp( shape, TopAbs_FACE ); fexp.More() && !err; fexp.Next() )
{
Handle(Geom_Surface) surface = BRep_Tool::Surface( TopoDS::Face( fexp.Current() ) );
if ( !surface->IsKind( STANDARD_TYPE( Geom_Plane ) ) )
err = true;
}
for ( TopExp_Explorer eexp( shape, TopAbs_EDGE ); eexp.More() && !err; eexp.Next() )
{
Standard_Real fd, ld;
Handle(Geom_Curve) curve = BRep_Tool::Curve( TopoDS::Edge( eexp.Current() ), fd, ld );
if ( !curve->IsKind( STANDARD_TYPE( Geom_Line ) ) )
err = true;
}
}
return !err;
}
| 29.232301 | 129 | 0.637478 | play113 |
b64aeb0117324a235807b4adb8415b0e30d3cb13 | 1,416 | cpp | C++ | DDCC/a.cpp | yuik46/competition_programming_code | 0c47db99ce7fb9bcf6e3b0dbfb8c84d9cfa165fd | [
"MIT"
] | null | null | null | DDCC/a.cpp | yuik46/competition_programming_code | 0c47db99ce7fb9bcf6e3b0dbfb8c84d9cfa165fd | [
"MIT"
] | null | null | null | DDCC/a.cpp | yuik46/competition_programming_code | 0c47db99ce7fb9bcf6e3b0dbfb8c84d9cfa165fd | [
"MIT"
] | null | null | null | //DISCO presents ディスカバリーチャンネル コードコンテスト2020 予選
#include <iostream>
using namespace std;
int main(){
int X;
int Y;
cin >> X >> Y;
if(X == 1 && Y == 1){
cout << 1000000 << endl;
}
else if(X == 2 && Y == 2){
cout << 400000<< endl;
}
else if(X == 3 && Y == 3){
cout << 200000 << endl;
}
else if(X == 1 && Y == 2){
cout << 500000 << endl;
}
else if(X == 1 && Y == 3){
cout << 400000 << endl;
}
else if(X == 2 && Y == 1){
cout << 500000 << endl;
}
else if(X == 2 && Y == 2){
cout << 300000 << endl;
}
else if(X == 2 && Y == 3){
cout << 300000 << endl;
}
else if(X == 3 && Y == 1){
cout << 400000 << endl;
}
else if(X == 3 && Y == 2){
cout << 300000 << endl;
}
else if(X == 3 && Y == 3){
cout << 200000 << endl;
}
else if(X == 1 && Y >= 4){
cout << 300000 << endl;
}
else if(X == 2 && Y >= 4){
cout << 200000 << endl;
}
else if(X == 3 && Y >= 4){
cout << 100000 << endl;
}
else if(X >= 4 && Y == 1){
cout << 300000 << endl;
}
else if(X >= 4 && Y == 2){
cout << 200000 << endl;
}
else if(X >= 4 && Y == 3){
cout << 100000 << endl;
}
else if(X >= 4 && Y <= 4){
cout << 0 << endl;
}
else{
cout << 0 << endl;
}
}
| 20.521739 | 45 | 0.372881 | yuik46 |
b65080f9dc3bcca437ff3f6bb7fa762a27078faa | 561 | cpp | C++ | Codeforces/Gym101350A.cpp | HeRaNO/OI-ICPC-Codes | 4a4639cd3e347b472520065ca6ab8caadde6906d | [
"MIT"
] | 18 | 2019-01-01T13:16:59.000Z | 2022-02-28T04:51:50.000Z | Codeforces/Gym101350A.cpp | HeRaNO/OI-ICPC-Codes | 4a4639cd3e347b472520065ca6ab8caadde6906d | [
"MIT"
] | null | null | null | Codeforces/Gym101350A.cpp | HeRaNO/OI-ICPC-Codes | 4a4639cd3e347b472520065ca6ab8caadde6906d | [
"MIT"
] | 5 | 2019-09-13T08:48:17.000Z | 2022-02-19T06:59:03.000Z | #include <bits/stdc++.h>
#define MAXN 200010
using namespace std;
int T,n,cnt[MAXN],s[MAXN];
char a[MAXN];
int main()
{
scanf("%d",&T);
while (T--)
{
memset(cnt,0,sizeof cnt);memset(s,0,sizeof s);
scanf("%d",&n);scanf("%s",a+1);int p=1;
for (int i=1;i<=n;i++)
{
if (a[i]-'0'){cnt[++cnt[0]]=p;p=1;}
else ++p;
}
cnt[++cnt[0]]=p;
for (int i=cnt[0];i;i--) s[i]=s[i+2]+cnt[i];
long long ans=0;
for (int i=1;i<cnt[0];i++) ans+=1LL*cnt[i]*s[i+1];
for (int i=1;i<cnt[0];i++) ans-=cnt[i]+cnt[i+1]-1;
printf("%lld\n",ans);
}
return 0;
} | 20.035714 | 52 | 0.527629 | HeRaNO |
b652cac6890f2b0a6b0635531a8a1e3f243f4b43 | 1,807 | cc | C++ | src/proto/test_helper.cc | cuisonghui/tera | 99a3f16de13dd454a64d64e938fcfeb030674d5f | [
"Apache-2.0",
"BSD-3-Clause"
] | 2,003 | 2015-07-13T08:36:45.000Z | 2022-03-26T02:10:07.000Z | src/proto/test_helper.cc | a1e2w3/tera | dbcd28af792d879d961bf9fc7eb60de81b437646 | [
"Apache-2.0",
"BSD-3-Clause"
] | 981 | 2015-07-14T00:03:24.000Z | 2021-05-10T09:50:01.000Z | src/proto/test_helper.cc | a1e2w3/tera | dbcd28af792d879d961bf9fc7eb60de81b437646 | [
"Apache-2.0",
"BSD-3-Clause"
] | 461 | 2015-07-14T02:53:35.000Z | 2022-03-10T10:31:49.000Z | // Copyright (c) 2015, Baidu.com, Inc. All Rights Reserved
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "proto/test_helper.h"
#include "common/base/string_number.h"
#include "proto/table_schema.pb.h"
namespace tera {
TableSchema DefaultTableSchema() {
TableSchema schema;
schema.set_id(0);
schema.set_name("lg0");
schema.set_owner(0);
schema.add_acl(0777);
ColumnFamilySchema* cf_schema = schema.add_column_families();
cf_schema->set_id(0);
cf_schema->set_name("lg0_cf0");
cf_schema->set_locality_group("lg0");
cf_schema->set_owner(0);
cf_schema->add_acl(0777);
LocalityGroupSchema* lg_schema = schema.add_locality_groups();
lg_schema->set_id(0);
lg_schema->set_name("lg0_name");
return schema;
}
ColumnFamilySchema DefaultCFSchema(const std::string& lg_name, uint32_t id) {
ColumnFamilySchema cf_schema;
std::string cf_name("cf");
cf_name += NumberToString(id);
cf_schema.set_id(id);
cf_schema.set_name(lg_name + "_" + cf_name);
cf_schema.set_locality_group(lg_name);
cf_schema.set_owner(0);
cf_schema.add_acl(0777);
return cf_schema;
}
LocalityGroupSchema DefaultLGSchema(uint32_t id) {
LocalityGroupSchema lg_schema;
std::string lg_name("lg");
lg_name += NumberToString(id);
lg_schema.set_id(id);
lg_schema.set_name(lg_name);
return lg_schema;
}
TableSchema DefaultTableSchema(uint32_t id, uint32_t lg_num, uint32_t cf_num) {
TableSchema schema;
std::string name("table");
name += NumberToString(id);
schema.set_id(id);
schema.set_name(name);
schema.set_owner(0);
schema.set_acl(0, 0777);
for (uint32_t lg_id = 0; lg_id < lg_num; ++lg_id) {
LocalityGroupSchema lg_schema = DefaultLGSchema(lg_id);
}
return schema;
}
} // namespace tera
| 24.753425 | 79 | 0.731599 | cuisonghui |
b6578e72e8dc79fb8c89b0c68d441905d7e96261 | 927 | cpp | C++ | src/modules/ModuleInput.cpp | solidajenjo/FluidSimulation | 051bb986b48fa521dbb0ac0a7a7f802a1b79892d | [
"MIT"
] | null | null | null | src/modules/ModuleInput.cpp | solidajenjo/FluidSimulation | 051bb986b48fa521dbb0ac0a7a7f802a1b79892d | [
"MIT"
] | null | null | null | src/modules/ModuleInput.cpp | solidajenjo/FluidSimulation | 051bb986b48fa521dbb0ac0a7a7f802a1b79892d | [
"MIT"
] | null | null | null | #include "ModuleInput.h"
#include "Application.h"
#include "ModuleRender.h"
#include <iostream> //TODO: Create log systemS
#include "GLFW/glfw3.h"
bool ModuleInput::PreUpdate()
{
glfwPollEvents();
if(glfwGetKey(App->m_Render->m_window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
glfwSetWindowShouldClose(App->m_Render->m_window, true);
return true;
}
bool ModuleInput::IsMouseButtonDown(int button) const
{
return glfwGetMouseButton(App->m_Render->m_window, button);
}
bool ModuleInput::IsPressed(int key) const
{
return glfwGetKey(App->m_Render->m_window, key);
}
bool ModuleInput::IsReleased(int key) const
{
return glfwGetKey(App->m_Render->m_window, key);
}
void ModuleInput::GetXYMouseFrameDelta(float& x, float& y)
{
double xpos, ypos;
glfwGetCursorPos(App->m_Render->m_window, &xpos, &ypos);
x = m_LastX - xpos;
y = m_LastY - ypos;
m_LastX = xpos;
m_LastY = ypos;
} | 25.054054 | 74 | 0.704423 | solidajenjo |
b657f26d3d6f34b77e0449a66e73d171a044ee63 | 1,527 | cpp | C++ | cpp/src/msg_server/HttpParserWrapper.cpp | KevinHM/TTServer | c3a8dcb7e0d2dd0d3fc88ff919019ca5f0a81306 | [
"Apache-2.0"
] | 22 | 2015-05-02T11:21:32.000Z | 2022-03-04T09:58:19.000Z | cpp/src/msg_server/HttpParserWrapper.cpp | luyongfugx/TTServer | c3a8dcb7e0d2dd0d3fc88ff919019ca5f0a81306 | [
"Apache-2.0"
] | null | null | null | cpp/src/msg_server/HttpParserWrapper.cpp | luyongfugx/TTServer | c3a8dcb7e0d2dd0d3fc88ff919019ca5f0a81306 | [
"Apache-2.0"
] | 21 | 2015-01-02T01:21:04.000Z | 2021-05-12T09:52:54.000Z | //
// HttpPdu.cpp
// http_msg_server
//
// Created by jianqing.du on 13-9-29.
// Copyright (c) 2013年 ziteng. All rights reserved.
//
#include "HttpParserWrapper.h"
#include "http_parser.h"
CHttpParserWrapper* CHttpParserWrapper::m_instance = NULL;
CHttpParserWrapper::CHttpParserWrapper()
{
}
CHttpParserWrapper* CHttpParserWrapper::GetInstance()
{
if (!m_instance) {
m_instance = new CHttpParserWrapper();
}
return m_instance;
}
void CHttpParserWrapper::ParseHttpContent(const char* buf, uint32_t len)
{
http_parser_init(&m_http_parser, HTTP_REQUEST);
memset(&m_settings, 0, sizeof(m_settings));
m_settings.on_url = OnUrl;
m_settings.on_headers_complete = OnHeadersComplete;
m_settings.on_body = OnBody;
m_settings.on_message_complete = OnMessageComplete;
m_read_all = false;
m_total_length = 0;
m_url.clear();
m_body_content.clear();
http_parser_execute(&m_http_parser, &m_settings, buf, len);
}
int CHttpParserWrapper::OnUrl(http_parser* parser, const char *at, size_t length)
{
m_instance->SetUrl(at, length);
return 0;
}
int CHttpParserWrapper::OnHeadersComplete (http_parser* parser)
{
m_instance->SetTotalLength(parser->nread + (uint32_t)parser->content_length);
return 0;
}
int CHttpParserWrapper::OnBody (http_parser* parser, const char *at, size_t length)
{
m_instance->SetBodyContent(at, length);
return 0;
}
int CHttpParserWrapper::OnMessageComplete (http_parser* parser)
{
m_instance->SetReadAll();
return 0;
}
| 22.455882 | 83 | 0.72888 | KevinHM |
b6580db2284ebba5387c2475713446ccbb7d1b37 | 688 | hpp | C++ | src/fem/mesh_Generated_multi_faults.hpp | XiaoMaResearch/hybrid_tpv14 | 074a0f079120af818eaab7e23acf35c6c068a876 | [
"MIT"
] | 6 | 2019-04-12T19:51:23.000Z | 2021-09-16T07:12:57.000Z | src/fem/mesh_Generated_multi_faults.hpp | XiaoMaResearch/hybrid_tpv14 | 074a0f079120af818eaab7e23acf35c6c068a876 | [
"MIT"
] | null | null | null | src/fem/mesh_Generated_multi_faults.hpp | XiaoMaResearch/hybrid_tpv14 | 074a0f079120af818eaab7e23acf35c6c068a876 | [
"MIT"
] | 1 | 2019-07-07T07:23:58.000Z | 2019-07-07T07:23:58.000Z | //
// mesh_Generated_multi_faults.hpp
// hybrid_fem_bie
//
// Created by Max on 2/13/18.
//
//
#ifndef mesh_Generated_multi_faults_hpp
#define mesh_Generated_multi_faults_hpp
#include <stdio.h>
#include <iostream>
#include <Eigen/Eigen>
#include "Meshrectangular.hpp"
#include "update_mesh_topology.hpp"
#include "share_header.hpp"
using namespace Eigen;
void mesh_Generated_multi_faults(int x_min, int x_max ,int y_min, int y_max, double dx , double dy, int nx, int ny, MatrixXd &Nodes ,MatrixXi_rm &Element, ArrayXi &BIE_top_surf_nodes, ArrayXi &BIE_bot_surf_nodes, MatrixXd &fault_pos, std::vector<std::vector<int>> &fault_nodes);
#endif /* mesh_Generated_multi_faults_hpp */
| 27.52 | 278 | 0.774709 | XiaoMaResearch |
b658d103f5800e6e089c5d0c1154f3950591cc32 | 16,801 | inl | C++ | include/bit/stl/utilities/detail/optional.inl | bitwizeshift/bit-stl | cec555fbda2ea1b6e126fa719637dde8d3f2ddd3 | [
"MIT"
] | 6 | 2017-03-29T07:20:30.000Z | 2021-12-28T20:17:33.000Z | include/bit/stl/utilities/detail/optional.inl | bitwizeshift/bit-stl | cec555fbda2ea1b6e126fa719637dde8d3f2ddd3 | [
"MIT"
] | 6 | 2017-10-11T02:26:07.000Z | 2018-04-16T03:09:48.000Z | include/bit/stl/utilities/detail/optional.inl | bitwizeshift/bit-stl | cec555fbda2ea1b6e126fa719637dde8d3f2ddd3 | [
"MIT"
] | 1 | 2018-08-27T15:03:47.000Z | 2018-08-27T15:03:47.000Z | #ifndef BIT_STL_UTILITIES_DETAIL_OPTIONAL_INL
#define BIT_STL_UTILITIES_DETAIL_OPTIONAL_INL
//----------------------------------------------------------------------------
// Constructor / Destructor
//----------------------------------------------------------------------------
template<typename T>
inline constexpr bit::stl::optional<T>::optional()
noexcept
: m_has_value(false)
{
}
template<typename T>
inline constexpr bit::stl::optional<T>::optional( nullopt_t )
: optional()
{
}
//----------------------------------------------------------------------------
template<typename T>
inline bit::stl::optional<T>::optional( const optional& other )
: m_has_value(other.m_has_value)
{
if(m_has_value)
{
new (val()) value_type( *other.val() );
}
}
template<typename T>
inline bit::stl::optional<T>::optional( optional&& other )
: m_has_value(other.m_has_value)
{
if(m_has_value)
{
new (val()) value_type( std::move(*other.val()) );
}
}
//----------------------------------------------------------------------------
template<typename T>
inline constexpr bit::stl::optional<T>::optional( const value_type& value )
: m_has_value(true)
{
new (val()) value_type(value);
}
template<typename T>
inline constexpr bit::stl::optional<T>::optional( value_type&& value )
: m_has_value(true)
{
new (val()) value_type(std::move(value));
}
//------------------------------------------------------------------------
template<typename T>
template<typename...Args>
inline constexpr bit::stl::optional<T>::
optional( in_place_t, Args&&... args )
: m_has_value(true)
{
new (val()) value_type( std::forward<Args>(args)... );
}
template<typename T>
template<typename U, typename...Args, typename>
inline constexpr bit::stl::optional<T>::
optional( in_place_t, std::initializer_list<U> ilist, Args&&... args )
: m_has_value(true)
{
new (val()) value_type( ilist, std::forward<Args>(args)... );
}
//----------------------------------------------------------------------------
template<typename T>
inline bit::stl::optional<T>::~optional()
{
destruct();
}
//----------------------------------------------------------------------------
// Assignment
//----------------------------------------------------------------------------
template<typename T>
inline bit::stl::optional<T>& bit::stl::optional<T>::operator=( nullopt_t )
{
destruct();
return (*this);
}
template<typename T>
inline bit::stl::optional<T>&
bit::stl::optional<T>::operator=( const optional& other )
{
if(m_has_value && other.m_has_value) {
*val() = *other.val();
} else if( m_has_value ) {
destruct();
} else if( other.m_has_value ) {
new (val()) value_type( *other.val() );
m_has_value = true;
}
return (*this);
}
template<typename T>
inline bit::stl::optional<T>&
bit::stl::optional<T>::operator=( optional&& other )
{
if(m_has_value && other.m_has_value) {
*val() = std::move( *other.val() );
} else if( m_has_value ) {
destruct();
} else if( other.m_has_value ) {
new (val()) value_type( std::move( *other.val() ) );
m_has_value = true;
}
return (*this);
}
template<typename T>
template<typename U, typename>
inline bit::stl::optional<T>&
bit::stl::optional<T>::operator=( U&& value )
{
if(m_has_value) {
*val() = std::forward<U>(value);
} else {
new (val()) value_type( std::forward<U>(value) );
m_has_value = true;
}
return (*this);
}
//----------------------------------------------------------------------------
// Observers
//----------------------------------------------------------------------------
template<typename T>
inline constexpr bit::stl::optional<T>::operator bool()
const noexcept
{
return m_has_value;
}
template<typename T>
inline constexpr bool bit::stl::optional<T>::has_value()
const noexcept
{
return m_has_value;
}
//----------------------------------------------------------------------------
template<typename T>
inline constexpr typename bit::stl::optional<T>::value_type*
bit::stl::optional<T>::operator->()
noexcept
{
return val();
}
template<typename T>
inline constexpr const typename bit::stl::optional<T>::value_type*
bit::stl::optional<T>::operator->()
const noexcept
{
return val();
}
//----------------------------------------------------------------------------
template<typename T>
inline constexpr typename bit::stl::optional<T>::value_type&
bit::stl::optional<T>::operator*()
& noexcept
{
return *val();
}
template<typename T>
inline constexpr typename bit::stl::optional<T>::value_type&&
bit::stl::optional<T>::operator*()
&& noexcept
{
return std::move(*val());
}
//----------------------------------------------------------------------------
template<typename T>
inline constexpr const typename bit::stl::optional<T>::value_type&
bit::stl::optional<T>::operator*()
const & noexcept
{
return *val();
}
template<typename T>
inline constexpr const typename bit::stl::optional<T>::value_type&&
bit::stl::optional<T>::operator*()
const && noexcept
{
return std::move(*val());
}
//----------------------------------------------------------------------------
template<typename T>
inline constexpr typename bit::stl::optional<T>::value_type&
bit::stl::optional<T>::value()
&
{
return bool(*this) ? *val() : throw bad_optional_access();
}
template<typename T>
inline constexpr const typename bit::stl::optional<T>::value_type&
bit::stl::optional<T>::value()
const &
{
return bool(*this) ? *val() : throw bad_optional_access();
}
//----------------------------------------------------------------------------
template<typename T>
inline constexpr typename bit::stl::optional<T>::value_type&&
bit::stl::optional<T>::value()
&&
{
return bool(*this) ? std::move(*val()) : throw bad_optional_access();
}
template<typename T>
inline constexpr const typename bit::stl::optional<T>::value_type&&
bit::stl::optional<T>::value()
const &&
{
return bool(*this) ? std::move(*val()) : throw bad_optional_access();
}
//----------------------------------------------------------------------------
template<typename T>
template<typename U>
inline constexpr typename bit::stl::optional<T>::value_type
bit::stl::optional<T>::value_or( U&& default_value )
const&
{
return bool(*this) ? *val() : std::forward<U>(default_value);
}
template<typename T>
template<typename U>
inline constexpr typename bit::stl::optional<T>::value_type
bit::stl::optional<T>::value_or( U&& default_value )
&&
{
return bool(*this) ? *val() : std::forward<U>(default_value);
}
//----------------------------------------------------------------------------
// Monadic Functionality
//----------------------------------------------------------------------------
template<typename T>
template<typename Fn,typename>
bit::stl::invoke_result_t<Fn,const T&> bit::stl::optional<T>::flat_map( Fn&& fn )
const
{
if( has_value() ) return invoke( std::forward<Fn>(fn), **this );
return nullopt;
}
template<typename T>
template<typename Fn,typename>
bit::stl::optional<bit::stl::invoke_result_t<Fn,const T&>>
bit::stl::optional<T>::map( Fn&& fn )
const
{
if( has_value() ) return make_optional(invoke( std::forward<Fn>(fn), **this ));
return nullopt;
}
//-----------------------------------------------------------------------------
template<typename T>
template<typename U>
bit::stl::optional<std::decay_t<U>> bit::stl::optional<T>::and_then( U&& u )
const
{
if( has_value() ) return make_optional( std::forward<U>(u) );
return nullopt;
}
template<typename T>
template<typename U>
bit::stl::optional<std::decay_t<U>> bit::stl::optional<T>::or_else( U&& u )
const
{
if( !has_value() ) return make_optional( std::forward<U>(u) );
return nullopt;
}
//-----------------------------------------------------------------------------
// Modifiers
//-----------------------------------------------------------------------------
template<typename T>
inline void bit::stl::optional<T>::swap( optional<T>& other )
{
using std::swap;
if( m_has_value && other.m_has_value ){
swap(*val(),*other.val());
} else if( m_has_value ) {
other = std::move(*this);
} else if( other.m_has_value ) {
*this = std::move(other);
}
}
template<typename T>
inline void bit::stl::optional<T>::reset()
noexcept(std::is_nothrow_destructible<T>::value)
{
destruct();
}
//----------------------------------------------------------------------------
template<typename T>
template<typename...Args>
inline void bit::stl::optional<T>::emplace( Args&&...args )
{
destruct();
new (val()) value_type( std::forward<Args>(args)... );
m_has_value = true;
}
template<typename T>
template<typename U, typename...Args>
inline void bit::stl::optional<T>::emplace( std::initializer_list<U> ilist,
Args&&...args )
{
destruct();
new (val()) value_type( std::forward<std::initializer_list<U>>(ilist), std::forward<Args>(args)... );
m_has_value = true;
}
//----------------------------------------------------------------------------
// Private Member Functions
//----------------------------------------------------------------------------
template<typename T>
inline constexpr T* bit::stl::optional<T>::val()
const noexcept
{
return reinterpret_cast<T*>( const_cast<storage_type*>(&m_value) );
}
template<typename T>
inline void bit::stl::optional<T>::destruct()
const
{
if(!std::is_trivially_destructible<T>::value && m_has_value) {
val()->~T();
m_has_value = false;
}
}
//============================================================================
// Equality Operators
//============================================================================
//----------------------------------------------------------------------------
// Compare two optional objects
//----------------------------------------------------------------------------
template<typename T>
inline constexpr bool
bit::stl::operator==( const optional<T>& lhs, const optional<T>& rhs )
{
if(static_cast<bool>(lhs) != static_cast<bool>(rhs)) return false;
if(!static_cast<bool>(lhs)) return true;
return *lhs == *rhs;
}
template<typename T>
inline constexpr bool
bit::stl::operator!=( const optional<T>& lhs, const optional<T>& rhs )
{
if(static_cast<bool>(lhs) != static_cast<bool>(rhs)) return true;
if(!static_cast<bool>(lhs)) return false;
return *lhs != *rhs;
}
template<typename T>
inline constexpr bool
bit::stl::operator<( const optional<T>& lhs, const optional<T>& rhs )
{
if(!static_cast<bool>(rhs)) return false;
if(!static_cast<bool>(lhs)) return true;
return *lhs < *rhs;
}
template<typename T>
inline constexpr bool
bit::stl::operator>( const optional<T>& lhs, const optional<T>& rhs )
{
if(!static_cast<bool>(lhs)) return false;
if(!static_cast<bool>(rhs)) return true;
return *lhs > *rhs;
}
template<typename T>
inline constexpr bool
bit::stl::operator<=( const optional<T>& lhs, const optional<T>& rhs )
{
if(!static_cast<bool>(lhs)) return true;
if(!static_cast<bool>(rhs)) return false;
return *lhs <= *rhs;
}
template<typename T>
inline constexpr bool
bit::stl::operator>=( const optional<T>& lhs, const optional<T>& rhs )
{
if(!static_cast<bool>(rhs)) return true;
if(!static_cast<bool>(lhs)) return false;
return *lhs >= *rhs;
}
//----------------------------------------------------------------------------
// Compare an optional object with a nullopt
//----------------------------------------------------------------------------
template<typename T>
inline constexpr bool
bit::stl::operator==( const optional<T>& opt, nullopt_t )
noexcept
{
return !opt;
}
template<typename T>
inline constexpr bool
bit::stl::operator==( nullopt_t, const optional<T>& opt )
noexcept
{
return !opt;
}
template<typename T>
inline constexpr bool
bit::stl::operator!=( const optional<T>& opt, nullopt_t )
noexcept
{
return static_cast<bool>(opt);
}
template<typename T>
inline constexpr bool
bit::stl::operator!=( nullopt_t, const optional<T>& opt )
noexcept
{
return static_cast<bool>(opt);
}
template<typename T>
inline constexpr bool
bit::stl::operator<( const optional<T>&, nullopt_t )
noexcept
{
return false;
}
template<typename T>
inline constexpr bool
bit::stl::operator<( nullopt_t, const optional<T>& opt )
noexcept
{
return static_cast<bool>(opt);
}
template<typename T>
inline constexpr bool
bit::stl::operator>( const optional<T>& opt, nullopt_t )
noexcept
{
return static_cast<bool>(opt);
}
template<typename T>
inline constexpr bool
bit::stl::operator>( nullopt_t, const optional<T>& )
noexcept
{
return false;
}
template<typename T>
inline constexpr bool
bit::stl::operator<=( const optional<T>& opt, nullopt_t )
noexcept
{
return !opt;
}
template<typename T>
inline constexpr bool
bit::stl::operator<=( nullopt_t, const optional<T>& )
noexcept
{
return true;
}
template<typename T>
inline constexpr bool
bit::stl::operator>=( const optional<T>&, nullopt_t )
noexcept
{
return true;
}
template<typename T>
inline constexpr bool
bit::stl::operator>=( nullopt_t, const optional<T>& opt )
noexcept
{
return !opt;
}
//----------------------------------------------------------------------------
// Compare an optional object with a T
//----------------------------------------------------------------------------
template<typename T>
inline constexpr bool
bit::stl::operator==( const optional<T>& opt, const T& value )
{
return static_cast<bool>(opt) ? *opt == value : false;
}
template<typename T>
inline constexpr bool
bit::stl::operator==( const T& value, const optional<T>& opt )
{
return static_cast<bool>(opt) ? value == *opt : false;
}
template<typename T>
inline constexpr bool
bit::stl::operator!=( const optional<T>& opt, const T& value )
{
return static_cast<bool>(opt) ? *opt != value : true;
}
template<typename T>
inline constexpr bool
bit::stl::operator!=( const T& value, const optional<T>& opt )
{
return static_cast<bool>(opt) ? value != *opt : true;
}
template<typename T>
inline constexpr bool
bit::stl::operator<( const optional<T>& opt, const T& value )
{
return static_cast<bool>(opt) ? *opt < value : true;
}
template<typename T>
inline constexpr bool
bit::stl::operator<( const T& value, const optional<T>& opt )
{
return static_cast<bool>(opt) ? value < *opt : false;
}
template<typename T>
inline constexpr bool
bit::stl::operator>( const optional<T>& opt, const T& value )
{
return static_cast<bool>(opt) ? *opt > value : false;
}
template<typename T>
inline constexpr bool
bit::stl::operator>( const T& value, const optional<T>& opt )
{
return static_cast<bool>(opt) ? value > *opt : true;
}
template<typename T>
inline constexpr bool
bit::stl::operator<=( const optional<T>& opt, const T& value )
{
return static_cast<bool>(opt) ? *opt <= value : true;
}
template<typename T>
inline constexpr bool
bit::stl::operator<=( const T& value, const optional<T>& opt )
{
return static_cast<bool>(opt) ? value <= *opt : false;
}
template<typename T>
inline constexpr bool
bit::stl::operator>=( const optional<T>& opt, const T& value )
{
return static_cast<bool>(opt) ? *opt >= value : false;
}
template<typename T>
inline constexpr bool
bit::stl::operator>=( const T& value, const optional<T>& opt )
{
return static_cast<bool>(opt) ? value >= *opt : true;
}
//----------------------------------------------------------------------------
// Non-member functions
//----------------------------------------------------------------------------
template<typename T>
inline constexpr
bit::stl::optional<std::decay_t<T>> bit::stl::make_optional( T&& value )
{
return optional<std::decay_t<T>>( std::forward<T>(value) );
}
template<typename T, typename... Args >
inline constexpr
bit::stl::optional<T> bit::stl::make_optional( Args&&... args )
{
return optional<T>( in_place, std::forward<Args>(args)... );
}
template<typename T, typename U, typename... Args >
inline constexpr
bit::stl::optional<T> bit::stl::make_optional( std::initializer_list<U> il, Args&&... args )
{
return optional<T>( in_place, std::forward<std::initializer_list<U>>(il), std::forward<Args>(args)... );
}
template<typename T>
inline void bit::stl::swap( optional<T>& lhs, optional<T>& rhs )
{
lhs.swap(rhs);
}
//----------------------------------------------------------------------------
// Hashing
//----------------------------------------------------------------------------
template<typename T>
inline constexpr bit::stl::hash_t bit::stl::hash_value( const optional<T>& s )
noexcept
{
if( s ) {
return hash_value( s.value() );
}
return static_cast<hash_t>(0);
}
#endif /* BIT_STL_UTILITIES_DETAIL_OPTIONAL_INL */
| 24.671072 | 106 | 0.56205 | bitwizeshift |
b65e92954048b8e7386489defc4ff1a542622328 | 1,021 | cpp | C++ | 8/main.cpp | two-six/Advent-of-Code-2015 | 29f8e51971b3a9571a17b84241c1d06926cb2ee2 | [
"MIT"
] | null | null | null | 8/main.cpp | two-six/Advent-of-Code-2015 | 29f8e51971b3a9571a17b84241c1d06926cb2ee2 | [
"MIT"
] | 1 | 2022-01-21T16:26:39.000Z | 2022-01-21T16:55:33.000Z | 8/main.cpp | two-six/Advent-of-Code-2015 | 29f8e51971b3a9571a17b84241c1d06926cb2ee2 | [
"MIT"
] | null | null | null | #include <iostream>
#include <fstream>
unsigned n_of_chars_in_memory(std::string const &s) {
unsigned sum(0);
for(auto i = 1; i < s.size()-1; ++i) {
sum++;
if(s.at(i) == '\\') {
if(s.at(i+1) == 'x')
i+=3;
else
i++;
}
}
return sum;
}
unsigned encoded_line(std::string const &s) {
unsigned sum(6);
for(auto i = 1; i < s.size()-1; ++i) {
sum++;
if(s.at(i) == '\\')
sum++;
else if(s.at(i) == '\"')
sum++;
}
return sum;
}
int main() {
std::fstream input_file("input.txt", std::ios::in);
std::string line;
unsigned raw_sum(0);
unsigned sum(0);
unsigned encoded_sum(0);
while(input_file >> line) {
raw_sum += line.size();
sum += n_of_chars_in_memory(line);
encoded_sum += encoded_line(line);
}
std::cout << "Silver: " << raw_sum - sum << '\n';
std::cout << "Gold: " << encoded_sum - raw_sum << '\n';
} | 23.204545 | 59 | 0.468168 | two-six |
b6652c988d8e8bf637ac1dae29be30633f47d704 | 1,083 | cpp | C++ | src/UtilsForDomination.cpp | georgedeath/TAsK | 14c4abb3b3f9918accd59e9987e9403bd8a0470c | [
"MIT"
] | 28 | 2015-03-05T04:12:58.000Z | 2021-12-16T22:24:41.000Z | src/UtilsForDomination.cpp | joshchea/TAsK | d66d0c7561e30b45308aabcf08f584326779f4ae | [
"MIT"
] | 2 | 2017-02-07T15:37:37.000Z | 2020-06-26T14:06:00.000Z | src/UtilsForDomination.cpp | joshchea/TAsK | d66d0c7561e30b45308aabcf08f584326779f4ae | [
"MIT"
] | 15 | 2015-07-09T11:53:16.000Z | 2022-02-22T04:01:19.000Z | #include "UtilsForDomination.h"
#include "BiObjLabelContainer.h"
const FPType UtilsForDomination::tolerance_ = 1e-15;
bool UtilsForDomination::isDominated(BiObjLabel* first, BiObjLabel* second) {
return (second->getTime() < first->getTime() + tolerance_ &&
second->getToll() <= first->getToll());
};
bool UtilsForDomination::isDominated(FPType newTime, TollType newToll, BiObjLabel* second) {
return (second->getTime() < newTime + tolerance_ &&
second->getToll() <= newToll);
};
bool UtilsForDomination::isDominatedByLabelInDestNode(const BiObjLabelContainer& labels,
int destIndex, FPType newTime, TollType newToll) {
for (LabelsIterator it = labels.begin(destIndex); it != labels.end(destIndex); ++it) {
if (isDominated(newTime, newToll, *it)) {
return true;
}
}
return false;
};
void UtilsForDomination::createPathFromLabel(BiObjLabel* destLabel, std::list<StarLink*> &path) {
BiObjLabel* label = destLabel;
while (label != NULL) {
if (label->getPrevLink() != NULL) path.push_back(label->getPrevLink());
label = label->getPrevLabel();
}
}; | 31.852941 | 97 | 0.720222 | georgedeath |
b66bffd5dc6cb2a385a268134e621c49072d6353 | 778 | cpp | C++ | src/VecOps.cpp | GuMiner/TemperFine | 434afd574a342433756cac2fa0f5073d22f2ff54 | [
"MIT"
] | null | null | null | src/VecOps.cpp | GuMiner/TemperFine | 434afd574a342433756cac2fa0f5073d22f2ff54 | [
"MIT"
] | null | null | null | src/VecOps.cpp | GuMiner/TemperFine | 434afd574a342433756cac2fa0f5073d22f2ff54 | [
"MIT"
] | null | null | null | #include <cmath>
#include "VecOps.h"
vec::vec3 VecOps::Cross(const vec::vec3& first, const vec::vec3& second)
{
return vec::vec3(
first.y * second.z - second.y * first.z,
first.z * second.x - second.z * first.x,
first.x * second.y - second.x * first.y);
}
float VecOps::Dot(const vec::vec3& first, const vec::vec3& second)
{
vec::vec3 multiplied = first * second;
return multiplied.x + multiplied.y + multiplied.z;
}
// Distance between two vectors
float VecOps::Distance(const vec::vec3& first, const vec::vec3& second)
{
return vec::length(second - first);
}
// Angle between two vectors.
float VecOps::Angle(const vec::vec3& first, const vec::vec3& second)
{
return std::acos(Dot(first, second));
}
| 26.827586 | 73 | 0.631105 | GuMiner |
b66fbd2a5f4a1bd9d166b98296b4a14729fbcdc2 | 5,521 | hpp | C++ | src/PluginVis3D/Grid3D.hpp | voxie-viewer/voxie | d2b5e6760519782e9ef2e51f5322a3baa0cb1198 | [
"MIT"
] | 4 | 2016-06-03T18:41:43.000Z | 2020-04-17T20:28:58.000Z | src/PluginVis3D/Grid3D.hpp | voxie-viewer/voxie | d2b5e6760519782e9ef2e51f5322a3baa0cb1198 | [
"MIT"
] | null | null | null | src/PluginVis3D/Grid3D.hpp | voxie-viewer/voxie | d2b5e6760519782e9ef2e51f5322a3baa0cb1198 | [
"MIT"
] | null | null | null | /*
* Copyright (c) 2014-2022 The Voxie Authors
*
* 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.
*/
#pragma once
#include <PluginVisSlice/GridSizeMode.hpp> // TODO: avoid cross-object include
#include <PluginVisSlice/SizeUnit.hpp> // TODO: avoid cross-object include
#include <QColor>
#include <QObject>
#include <Voxie/Vis/OpenGLWidget.hpp>
/**
* @brief This class contains the logic for the grid.
*/
class Grid3D : public QObject {
Q_OBJECT
private:
bool active;
QColor color;
GridSizeMode mode;
float size;
SizeUnit lengthUnit;
int opacity;
bool xyPlane;
bool xzPlane;
bool yzPlane;
typedef vx::visualization::OpenGLDrawWidget::PrimitiveBuffer PrimitiveBuffer;
/**
* @brief setGridSizeForSelf is an setter which sets the size of the grid mesh
* width and should clled only by grid3d itself. This is necessary to prevent
* endlessloops.
* @param float value
*/
void setGridSizeForSelf(float value);
/**
* @brief setUnitForSelf is an setter which sets the unit of the grid mesh
* width and should clled only by grid3d itself. This is necessary to prevent
* endlessloops.
* @param float value
*/
void setUnitForSelf(SizeUnit unit);
/**
* @brief Gives the factor coresponding to the unit
* @return the unit factor
*/
float unit();
/**
* @brief Ensures that the grid is no longer visible.
*/
void removeGrid();
/**
* @brief setBiggerUnit if current unit is not the biggest unit, it sets the
* unit next bigger unit
*/
void setBiggerUnit();
/**
* @brief setSmallerUnit if current unit is not the smallest unit, it sets the
* unit next smaller unit
*/
void setSmallerUnit();
public:
/**
* @brief Draws grid over Slice with current parameter of the grid.
*/
void drawGrid(PrimitiveBuffer& drawingBuffer, const QVector3D& min,
const QVector3D& max, float prefLength);
/**
* @brief Grid3D constructor
* @param Isovisualizer* which is converted to an QObject* isoVis
*/
explicit Grid3D(QObject* isoVis);
Grid3D(Grid3D const&) = delete;
void operator=(Grid3D const&) = delete;
/**
* @brief is true if grid is active.
* @param bool active
*/
void setActive(bool active);
/**
* @brief setColor sets the current color of the Grid.
* @param QColor color
*/
void setColor(QColor color);
/**
* @brief setMode sets the current grid mode.
* @param GridSizeMode mode
*/
void setMode(GridSizeMode mode);
/**
* @brief setSizeForWidget is a sette of the grid mesh width.
* This sette should called only by othe classes.
* @param float size
*/
void setSizeForWidget(float size);
/**
* @brief setUnitForWidget is a setter of the grid mesh width unit.
* This sette should called only by othe classes.
* @param SizeUnit unit
*/
void setUnitForWidget(SizeUnit unit);
/**
* @brief setOpacity is a setter of the grids opacity.
* @param int opacity (Range: 0 to 255)
*/
void setOpacity(int opacity);
/**
* @brief setXYPlane is a Setter for the xy plane. Only active plane will be
* drawn.
* @param bool checked
*/
void setXYPlane(bool checked);
/**
* @brief setXZPlane is a Setter for the xz plane. Only active plane will be
* drawn.
* @param bool checked
*/
void setXZPlane(bool checked);
/**
* @brief setYZPlane is a Setter for the yz plane. Only active plane will be
* drawn.
* @param bool checked
*/
void setYZPlane(bool checked);
/**
* @brief getSize is a getter for the gird mesh width.
* @return float size
*/
float getSize();
/**
* @brief If called checks if active Parameter of grid is true.
* If its true drawGrid is called. Otherwise removeGrid is called.
*/
void updateGrid();
/**
* @brief unitToString returns a String thats the representation of the
* current unit
* @return a String thats the representation of the current unit
*/
QString unitToString();
Q_SIGNALS:
/**
* @brief unitChanged is an signal which is called if the grid length unit has
* changed.
* @param SizeUnit newValue
*/
void unitChanged(SizeUnit newValue);
/**
* @brief sizeChanged is an signal which is called if the grid mesh width
* changed.
* @param float newValue
*/
void sizeChanged(float newValue);
/**
* @brief gridChanged is an signal which is called if the grid has changed.
*/
void gridChanged();
public Q_SLOTS:
};
| 26.671498 | 80 | 0.690636 | voxie-viewer |
b6748794deda6ba4854cdfba72fc1109900a4a6c | 3,214 | cpp | C++ | src/gpu/effects/GrSimpleTextureEffect.cpp | coltorchen/android-skia | 91bb0c6f4224715ab78e3f64ba471a42d5d5a307 | [
"BSD-3-Clause"
] | 2 | 2017-05-19T08:53:12.000Z | 2017-08-28T11:59:26.000Z | src/gpu/effects/GrSimpleTextureEffect.cpp | coltorchen/android-skia | 91bb0c6f4224715ab78e3f64ba471a42d5d5a307 | [
"BSD-3-Clause"
] | 2 | 2017-07-25T09:37:22.000Z | 2017-08-04T07:18:56.000Z | src/gpu/effects/GrSimpleTextureEffect.cpp | coltorchen/android-skia | 91bb0c6f4224715ab78e3f64ba471a42d5d5a307 | [
"BSD-3-Clause"
] | 2 | 2017-08-09T09:03:23.000Z | 2020-05-26T09:14:49.000Z | /*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "GrSimpleTextureEffect.h"
#include "gl/GrGLEffect.h"
#include "gl/GrGLEffectMatrix.h"
#include "gl/GrGLSL.h"
#include "gl/GrGLTexture.h"
#include "GrTBackendEffectFactory.h"
#include "GrTexture.h"
class GrGLSimpleTextureEffect : public GrGLEffect {
public:
GrGLSimpleTextureEffect(const GrBackendEffectFactory& factory, const GrEffectRef&)
: INHERITED (factory) {}
virtual void emitCode(GrGLShaderBuilder* builder,
const GrEffectStage&,
EffectKey key,
const char* vertexCoords,
const char* outputColor,
const char* inputColor,
const TextureSamplerArray& samplers) SK_OVERRIDE {
const char* coordName;
GrSLType coordType = fEffectMatrix.emitCode(builder, key, vertexCoords, &coordName);
builder->fFSCode.appendf("\t%s = ", outputColor);
builder->appendTextureLookupAndModulate(&builder->fFSCode,
inputColor,
samplers[0],
coordName,
coordType);
builder->fFSCode.append(";\n");
}
static inline EffectKey GenKey(const GrEffectStage& stage, const GrGLCaps&) {
const GrSimpleTextureEffect& ste = GetEffectFromStage<GrSimpleTextureEffect>(stage);
return GrGLEffectMatrix::GenKey(ste.getMatrix(),
stage.getCoordChangeMatrix(),
ste.texture(0));
}
virtual void setData(const GrGLUniformManager& uman, const GrEffectStage& stage) SK_OVERRIDE {
const GrSimpleTextureEffect& ste = GetEffectFromStage<GrSimpleTextureEffect>(stage);
fEffectMatrix.setData(uman, ste.getMatrix(), stage.getCoordChangeMatrix(), ste.texture(0));
}
private:
GrGLEffectMatrix fEffectMatrix;
typedef GrGLEffect INHERITED;
};
///////////////////////////////////////////////////////////////////////////////
void GrSimpleTextureEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const {
this->updateConstantColorComponentsForModulation(color, validFlags);
}
const GrBackendEffectFactory& GrSimpleTextureEffect::getFactory() const {
return GrTBackendEffectFactory<GrSimpleTextureEffect>::getInstance();
}
///////////////////////////////////////////////////////////////////////////////
GR_DEFINE_EFFECT_TEST(GrSimpleTextureEffect);
GrEffectRef* GrSimpleTextureEffect::TestCreate(SkRandom* random,
GrContext* context,
GrTexture* textures[]) {
int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
GrEffectUnitTest::kAlphaTextureIdx;
const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random);
return GrSimpleTextureEffect::Create(textures[texIdx], matrix);
}
| 41.205128 | 100 | 0.589919 | coltorchen |
b67505036df98c899510c61ab158cff7395792ad | 2,409 | hpp | C++ | application/include/application_solar.hpp | Mielein/CGLabErickson121588_Trojan121067 | fb8248755ab687dbe4f37fad429783cf0b83eede | [
"MIT"
] | null | null | null | application/include/application_solar.hpp | Mielein/CGLabErickson121588_Trojan121067 | fb8248755ab687dbe4f37fad429783cf0b83eede | [
"MIT"
] | null | null | null | application/include/application_solar.hpp | Mielein/CGLabErickson121588_Trojan121067 | fb8248755ab687dbe4f37fad429783cf0b83eede | [
"MIT"
] | null | null | null | #ifndef APPLICATION_SOLAR_HPP
#define APPLICATION_SOLAR_HPP
#include "application.hpp"
#include "model.hpp"
#include "structs.hpp"
#include "pixel_data.hpp"
#include "texture_loader.hpp"
#include <scene_graph.hpp>
// gpu representation of model
class ApplicationSolar : public Application {
public:
// allocate and initialize objects
ApplicationSolar(std::string const& resource_path);
// free allocated objects
~ApplicationSolar();
//star initialisation
void initializeStars();
//orbit initialisation
void initializeOrbits();
// react to key input
void keyCallback(int key, int action, int mods);
//handle delta mouse movement input
void mouseCallback(double pos_x, double pos_y);
//handle resizing
void resizeCallback(unsigned width, unsigned height);
void scrollCallback(double pos_x, double pos_y);
void tmpfunk();
// draw all objects
void render() ;
Scene_graph scene_graph_;
glm::fmat4 earth_local_transform;
float speed = 1.0f;
bool switch_appearence = false;
bool inverse = false;
bool grayscale = false;
bool mirror_v = false;
bool mirror_h = false;
bool blur = false;
unsigned int m_sunTexture;
unsigned int m_texture;
unsigned int m_mappingtexture;
unsigned int m_skytextures;
unsigned m_width;
unsigned m_height;
protected:
// initialize all objects in the graph to create the sun system
void initializeSceneGraph();
void initializeShaderPrograms();
void initializeFramebuffer(unsigned width, unsigned height);
void initializeGeometry();
void initializeTextures();
void initializeSun();
void initializeSkybox();
// custom render methode for the planets out of the scene graph
void planetrenderer();
void skyboxrenderer();
void starRenderer() const;
void orbitRenderer() const;
// update uniform values
void uploadUniforms();
// upload projection matrix
void uploadProjection();
// upload view matrix
void uploadView();
// cpu representation of model
model_object planet_object;
model_object star_object;
model_object orbit_object;
model_object texture_object;
model_object skybox_object;
model_object quad_object;
framebuffer_object framebuffer_obj;
// camera transform matrix
glm::fmat4 m_view_transform;
// camera projection matrix
glm::fmat4 m_view_projection;
// initialized sceneGraph with information about objects and there rotation
};
#endif | 26.184783 | 77 | 0.7555 | Mielein |
b6759b1c1cb1200bb2efa0ade160b07c458788f0 | 2,714 | cpp | C++ | Flux++/poc1/main.cpp | Glinrens-corner/Fluxpp | ea64b56d2922a0ab2a946c6a75ceb5633c5ec943 | [
"MIT"
] | 2 | 2021-03-25T05:50:17.000Z | 2021-04-06T12:53:18.000Z | Flux++/poc1/main.cpp | Glinrens-corner/Fluxpp | ea64b56d2922a0ab2a946c6a75ceb5633c5ec943 | [
"MIT"
] | 1 | 2021-03-09T00:03:56.000Z | 2021-03-09T00:03:56.000Z | Flux++/poc1/main.cpp | Glinrens-corner/Fluxpp | ea64b56d2922a0ab2a946c6a75ceb5633c5ec943 | [
"MIT"
] | 1 | 2021-04-05T13:10:55.000Z | 2021-04-05T13:10:55.000Z | #include <mem_comparable_closure.hpp>
#include "widget.hpp"
#include "gui_event.hpp"
#include "ui.hpp"
#include "backend/xcb_backend.hpp"
using fluxpp::Ui;
using fluxpp::backend::XCBBackend;
using namespace mem_comparable_closure;
using namespace fluxpp::widgets::screen;
using namespace fluxpp::widgets::application;
using namespace fluxpp::widgets;
using namespace fluxpp::widgets::window;
using fluxpp::events::ButtonPressEvent;
using fluxpp::events::ButtonReleaseEvent;
using fluxpp::widgets::builtin::ColorWidget;
using fluxpp::widgets::builtin::Color;
using fluxpp::widgets::builtin::ColorEnum;
using fluxpp::widgets::builtin::TextWidget;
using fluxpp::widgets::AppEvent;
using fluxpp::widgets::AppEventContainer;
Widget<SubscribeTo<bool>,
ListenFor<ButtonPressEvent, ButtonReleaseEvent>
> button = WidgetBuilder{}
.with_filters(Filter<bool>("state/button"))
.with_render_lambda([](bool clicked){
if ( clicked) {
return make_widget_return_container(Size{.width=300, .height=150},
ColorWidget(Color::from_color_enum( ColorEnum::blue) ).at(0,0),
TextWidget("Click Me").at(0,0)
);
} else {
return make_widget_return_container(Size{.width=300, .height=150},
ColorWidget(Color::from_color_enum( ColorEnum::green) ).at(0,0),
TextWidget("Click Me").at(0,0)
);
};
})
.for_events<ButtonPressEvent, ButtonReleaseEvent>()
.build_with_event_handling_lambdas([](const ButtonPressEvent& event)->AppEventContainer
{
return AppEvent("state/button");},
[] (const ButtonReleaseEvent& event )->AppEventContainer
{
return AppEvent("state/button");}
);
Window<SubscribeTo<>, ListenFor<>> mywindow =WindowBuilder{}
.without_filters()
.with_render_lambda([]( ){
return make_window_return_container( Size{300,400},button); })
.build_without_event_handlers();
Screen<SubscribeTo<>, ListenFor<>> myscreen =ScreenBuilder{}
.without_filters()
.with_render_lambda([]( ){ return make_screen_return_container(ScreenSettings{},mywindow); })
.build_without_event_handlers();
Application<SubscribeTo<>, ListenFor<>> myapp =ApplicationBuilder{}
.without_filters()
.with_render_lambda([]( ){ return make_application_return_container(myscreen); })
.build_without_event_handlers();
int main() {
using namespace fluxpp;
using widgets::AppEvent;
auto backend = XCBBackend::create() ;
Ui mygui= Ui::create(&backend, myapp);
mygui.add_state_slice("state/button", state::StateSlice<bool>(false,
[](bool state, const AppEvent& event ){
return std::make_pair( not state , std::vector<AppEvent>{});
}
)
);
mygui.start();
};
| 31.55814 | 95 | 0.707811 | Glinrens-corner |
b676317b1ede9e2d204abef35f2b4bd07839b3c2 | 1,957 | cpp | C++ | modules/boost/dispatch/unit/meta/is_scalar.cpp | pbrunet/nt2 | 2aeca0f6a315725b335efd5d9dc95d72e10a7fb7 | [
"BSL-1.0"
] | 34 | 2017-05-19T18:10:17.000Z | 2022-01-04T02:18:13.000Z | modules/boost/dispatch/unit/meta/is_scalar.cpp | pbrunet/nt2 | 2aeca0f6a315725b335efd5d9dc95d72e10a7fb7 | [
"BSL-1.0"
] | null | null | null | modules/boost/dispatch/unit/meta/is_scalar.cpp | pbrunet/nt2 | 2aeca0f6a315725b335efd5d9dc95d72e10a7fb7 | [
"BSL-1.0"
] | 7 | 2017-12-02T12:59:17.000Z | 2021-07-31T12:46:14.000Z | //==============================================================================
// Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II
// Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//==============================================================================
#define NT2_UNIT_MODULE "boost::dispatch::meta::is_scalar"
#include <boost/simd/sdk/config/types.hpp>
#include <boost/dispatch/meta/is_scalar.hpp>
#include <nt2/sdk/unit/module.hpp>
#include <nt2/sdk/unit/tests/basic.hpp>
////////////////////////////////////////////////////////////////////////////////
// Test that scalar are scalar (dur)
////////////////////////////////////////////////////////////////////////////////
NT2_TEST_CASE(is_scalar_scalar)
{
using boost::dispatch::meta::is_scalar;
NT2_TEST( is_scalar<double>::value );
NT2_TEST( is_scalar<float>::value );
NT2_TEST( is_scalar<boost::simd::uint64_t>::value );
NT2_TEST( is_scalar<boost::simd::uint32_t>::value );
NT2_TEST( is_scalar<boost::simd::uint16_t>::value );
NT2_TEST( is_scalar<boost::simd::uint8_t>::value );
NT2_TEST( is_scalar<boost::simd::int64_t>::value );
NT2_TEST( is_scalar<boost::simd::int32_t>::value );
NT2_TEST( is_scalar<boost::simd::int16_t>::value );
NT2_TEST( is_scalar<boost::simd::int8_t>::value );
NT2_TEST( is_scalar<bool>::value );
}
////////////////////////////////////////////////////////////////////////////////
// Test that non-scalar types are not scalar
////////////////////////////////////////////////////////////////////////////////
struct foo {}; // type of unknown hierarchy
NT2_TEST_CASE(is_nonscalar)
{
using boost::dispatch::meta::is_scalar;
NT2_TEST( !is_scalar<foo>::value );
}
| 42.543478 | 80 | 0.509964 | pbrunet |
b677bc2892b5acf998fecfd548d31cc6f3e96c29 | 153 | inl | C++ | ace/Shared_Object.inl | azerothcore/lib-ace | c1fedd5f2033951eee9ecf898f6f2b75584aaefc | [
"DOC"
] | null | null | null | ace/Shared_Object.inl | azerothcore/lib-ace | c1fedd5f2033951eee9ecf898f6f2b75584aaefc | [
"DOC"
] | null | null | null | ace/Shared_Object.inl | azerothcore/lib-ace | c1fedd5f2033951eee9ecf898f6f2b75584aaefc | [
"DOC"
] | 1 | 2020-04-26T03:07:12.000Z | 2020-04-26T03:07:12.000Z | // -*- C++ -*-
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE
ACE_Shared_Object::ACE_Shared_Object (void)
{
}
ACE_END_VERSIONED_NAMESPACE_DECL
| 15.3 | 44 | 0.751634 | azerothcore |
b67969dbe4ec3014f810168b0c7477123a4aaa25 | 2,347 | cpp | C++ | labs/lab05/simd-normal.cpp | taylorc1009/set10108 | b22479b3f6e7018ff175a98197950a6934f16df6 | [
"MIT"
] | 3 | 2018-09-17T14:32:01.000Z | 2021-01-15T15:30:53.000Z | labs/lab05/simd-normal.cpp | taylorc1009/set10108 | b22479b3f6e7018ff175a98197950a6934f16df6 | [
"MIT"
] | 1 | 2018-10-08T13:42:12.000Z | 2018-10-08T19:53:59.000Z | labs/lab05/simd-normal.cpp | taylorc1009/set10108 | b22479b3f6e7018ff175a98197950a6934f16df6 | [
"MIT"
] | 12 | 2018-09-16T20:09:14.000Z | 2020-06-23T17:01:38.000Z | #include <iostream>
#include <random>
#include <chrono>
#include <immintrin.h>
using namespace std;
using namespace std::chrono;
union v4
{
__m128 v; // SSE 4 x float vector
float a[4]; // scalar array of 4 floats
};
// Randomly generate vector values
void generate_data(v4 *data, size_t n)
{
// Create random engine
random_device r;
default_random_engine e(r());
// Fill data
for (size_t i = 0; i < n; ++i)
for (size_t j = 0; j < 4; ++j)
data[i].a[j] = e();
}
// Normalises the vector
void normalise_vectors(v4 *data, v4 *result, size_t n)
{
// Normalise the vectors
for (size_t i = 0; i < n; ++i)
{
// Square each component - simply multiply the vectors by themselves
result[i].v = _mm_mul_ps(data[i].v, data[i].v);
// Calculate sum of the components.
// See notes to explain hadd.
result[i].v = _mm_hadd_ps(result[i].v, result[i].v);
result[i].v = _mm_hadd_ps(result[i].v, result[i].v);
// Calculate recipricol square root of the values
// That is 1.0f / sqrt(value) - or the length of the vector
result[i].v = _mm_rsqrt_ps(result[i].v);
// Multiply result by the original data
// As we have the recipricol it is the same as dividing each component
// by the length
result[i].v = _mm_mul_ps(data[i].v, result[i].v);
}
// All vectors now normalised
}
// Check the first 100 results
void check_results(v4 *data, v4 *result)
{
// Check first 100 values
for (size_t i = 0; i < 100; ++i)
{
// Calculate the length of the vector
float l = 0.0f;
// Square each component and add to l
for (size_t j = 0; j < 4; ++j)
l += powf(data[i].a[j], 2.0f);
// Get sqrt of the length
l = sqrtf(l);
// Now check that the individual results
for (size_t j = 0; j < 4; ++j)
cout << data[i].a[j] / l << " : " << result[i].a[j] << endl;
}
}
int main(int argc, char **argv)
{
v4 *data = (v4*)_aligned_malloc(sizeof(v4) * 1000000, 16);
v4 *result = (v4*)_aligned_malloc(sizeof(v4) * 1000000, 16);
generate_data(data, 1000000);
normalise_vectors(data, result, 1000000);
check_results(data, result);
_aligned_free(data);
_aligned_free(result);
return 0;
} | 29.708861 | 78 | 0.586706 | taylorc1009 |
b67adaee3804aaafbb3f8f8a7b5b2af2f26b0466 | 1,601 | cpp | C++ | problems/kickstart/2018/C/fairies-witches/code.cpp | brunodccarvalho/competitive | 4177c439174fbe749293b9da3445ce7303bd23c2 | [
"MIT"
] | 7 | 2020-10-15T22:37:10.000Z | 2022-02-26T17:23:49.000Z | problems/kickstart/2018/C/fairies-witches/code.cpp | brunodccarvalho/competitive | 4177c439174fbe749293b9da3445ce7303bd23c2 | [
"MIT"
] | null | null | null | problems/kickstart/2018/C/fairies-witches/code.cpp | brunodccarvalho/competitive | 4177c439174fbe749293b9da3445ce7303bd23c2 | [
"MIT"
] | null | null | null | #include <bits/stdc++.h>
using namespace std;
// *****
#define MAXN 15
int N;
int M[MAXN][MAXN];
struct edge_t {
int i, j;
};
bool operator<(edge_t lhs, edge_t rhs) noexcept {
return M[lhs.i][lhs.j] < M[rhs.i][rhs.j];
}
bool connected(edge_t lhs, edge_t rhs) {
return lhs.i == rhs.i || lhs.j == rhs.i || lhs.i == rhs.j || lhs.j == rhs.j;
}
int dfs(vector<edge_t> edges, edge_t e0, int minsum) {
auto newbegin = remove_if(begin(edges), end(edges), [e0](edge_t edge) {
return connected(e0, edge);
});
edges.erase(newbegin, end(edges));
int solutions = 0;
while (!edges.empty()) {
edge_t e = edges.back();
edges.pop_back();
solutions += M[e.i][e.j] >= minsum;
int newminsum = max(0, minsum - M[e.i][e.j]);
solutions += dfs(edges, e, newminsum);
}
return solutions;
}
auto solve() {
cin >> N;
memset(M, 0, sizeof(M));
vector<edge_t> edges;
for (int i = 0; i < N; ++i) {
for (int j = 0; j < N; ++j) {
cin >> M[i][j];
if (i < j && M[i][j] > 0) {
edges.push_back({i, j});
}
}
}
sort(begin(edges), end(edges));
int solution = 0;
while (!edges.empty()) {
edge_t e = edges.back();
edges.pop_back();
solution += dfs(edges, e, M[e.i][e.j] + 1);
}
return solution;
}
// *****
int main() {
unsigned T;
cin >> T >> ws;
for (unsigned t = 1; t <= T; ++t) {
auto solution = solve();
cout << "Case #" << t << ": " << solution << '\n';
}
return 0;
}
| 20.792208 | 80 | 0.490319 | brunodccarvalho |
b67d23d70ddb63d1283152d45294363517bb11cc | 541 | cpp | C++ | src/Avokii/Graphics/Resources/Material.cpp | Katipo007/avokii | 3a3d1ff244b078b1f1014726b554ce021c0ce488 | [
"MIT"
] | 1 | 2021-06-28T11:24:42.000Z | 2021-06-28T11:24:42.000Z | src/Avokii/Graphics/Resources/Material.cpp | Katipo007/avokii | 3a3d1ff244b078b1f1014726b554ce021c0ce488 | [
"MIT"
] | null | null | null | src/Avokii/Graphics/Resources/Material.cpp | Katipo007/avokii | 3a3d1ff244b078b1f1014726b554ce021c0ce488 | [
"MIT"
] | null | null | null | #include "Material.hpp"
namespace Avokii::Graphics
{
Material::Material()
{
}
Material::Material( ResourceLoader& r_loader )
{
(void)r_loader;
AV_NOT_IMPLEMENTED;
}
std::shared_ptr<Material> Material::LoadResource( ResourceLoader& r_loader )
{
(void)r_loader;
AV_NOT_IMPLEMENTED;
return {};
}
void Material::SetShader( std::shared_ptr<const Shader> new_shader )
{
mShader = new_shader;
}
void Material::SetTextures( std::vector<std::shared_ptr<const Texture>> new_textures )
{
mTextures = new_textures;
}
}
| 16.90625 | 87 | 0.713494 | Katipo007 |
b67d834a6f32483df43be623bdaa74c5c1a28802 | 6,379 | cpp | C++ | src/io/al_CSVReader.cpp | AlloSphere-Research-Group/al_lib | 94d23fe71b79d3464a658f16ca34c2040e6d7334 | [
"BSD-3-Clause"
] | 26 | 2018-11-05T23:29:43.000Z | 2022-03-17T18:16:49.000Z | src/io/al_CSVReader.cpp | yangevelyn/allolib | 1654be795b6515c058eb8243751b903a2aa6efdc | [
"BSD-3-Clause"
] | 41 | 2018-01-19T18:34:41.000Z | 2022-01-27T23:52:01.000Z | src/io/al_CSVReader.cpp | yangevelyn/allolib | 1654be795b6515c058eb8243751b903a2aa6efdc | [
"BSD-3-Clause"
] | 11 | 2018-01-05T16:42:19.000Z | 2022-01-27T22:08:01.000Z | #include "al/io/al_CSVReader.hpp"
#include <cassert>
#include <cctype>
using namespace al;
CSVReader::~CSVReader() {
for (auto row : mData) {
delete[] row;
}
mData.clear();
}
bool CSVReader::readFile(std::string fileName, bool hasColumnNames) {
if (mBasePath.size() > 0) {
if (mBasePath.back() == '/') {
fileName = mBasePath + fileName;
} else {
fileName = mBasePath + "/" + fileName;
}
}
std::ifstream f(fileName);
if (!f.is_open()) {
std::cout << "Could not open:" << fileName << std::endl;
return false;
}
mColumnNames.clear();
mData.clear();
std::string line;
size_t rowLength = calculateRowLength();
// Infer separator
bool commaSeparated = false;
{
if (hasColumnNames) {
getline(f, line);
}
getline(f, line); // Infer from first line of data
if (std::count(line.begin(), line.end(), ',') > 0) {
commaSeparated = true;
}
// Reset file
f.clear();
f.seekg(0, std::ios::beg);
}
if (hasColumnNames) {
getline(f, line);
std::stringstream columnNameStream(line);
std::string columnName;
if (commaSeparated) {
while (std::getline(columnNameStream, columnName, ',')) {
mColumnNames.push_back(columnName);
}
} else {
while (std::getline(columnNameStream, columnName, ' ')) {
if (columnName.size() > 0) {
mColumnNames.push_back(columnName);
}
}
}
}
// std::cout << line << std::endl;
while (getline(f, line)) {
if (line.size() == 0) {
continue;
}
std::stringstream ss(line);
char *row = new char[rowLength];
memset(row, 0, rowLength);
mData.push_back(row);
if (commaSeparated) {
if ((unsigned long)std::count(line.begin(), line.end(), ',') ==
mDataTypes.size() - 1) { // Check that we have enough commas
size_t byteCount = 0;
for (auto type : mDataTypes) {
std::string field;
std::getline(ss, field, ',');
size_t stringLen = std::min(maxStringSize - 1, field.size());
int64_t intValue;
double doubleValue;
bool booleanValue;
auto data = row + byteCount;
assert((size_t)(data - mData.back()) < rowLength);
switch (type) {
case STRING:
std::memcpy(data, field.data(), stringLen * sizeof(char));
byteCount += maxStringSize * sizeof(char);
break;
case INT64:
intValue = std::atol(field.data());
std::memcpy(data, &intValue, sizeof(int64_t));
byteCount += sizeof(int64_t);
break;
case REAL:
doubleValue = std::atof(field.data());
std::memcpy(data, &doubleValue, sizeof(double));
byteCount += sizeof(double);
break;
case BOOLEAN:
booleanValue = field == "True" || field == "true" || field == "1";
std::memcpy(data, &booleanValue, sizeof(bool));
byteCount += sizeof(bool);
break;
case IGNORE_COLUMN:
break;
}
}
}
} else { // Space separated
int byteCount = 0;
for (auto type : mDataTypes) {
std::string field;
while (field.size() == 0) {
std::getline(ss, field, ' ');
if (ss.eof()) {
break;
}
}
if (field.size() == 0) {
break;
}
// Trim white space from start
field.erase(field.begin(),
std::find_if(field.begin(), field.end(),
[](int ch) { return !std::isspace(ch); }));
// Trim white space from end
field.erase(std::find_if(field.rbegin(), field.rend(),
[](int ch) { return !std::isspace(ch); })
.base(),
field.end());
size_t stringLen = std::min(maxStringSize - 1, field.size());
int64_t intValue;
double doubleValue;
bool booleanValue;
auto data = row + byteCount;
assert((size_t)(data - mData.back()) < rowLength);
switch (type) {
case STRING:
std::memcpy(data, field.data(), stringLen * sizeof(char));
byteCount += maxStringSize * sizeof(char);
break;
case INT64:
intValue = std::atol(field.data());
std::memcpy(data, &intValue, sizeof(int64_t));
byteCount += sizeof(int64_t);
break;
case REAL:
doubleValue = std::atof(field.data());
std::memcpy(data, &doubleValue, sizeof(double));
byteCount += sizeof(double);
break;
case BOOLEAN:
booleanValue = field == "True" || field == "true" || field == "1";
std::memcpy(data, &booleanValue, sizeof(bool));
byteCount += sizeof(bool);
break;
case IGNORE_COLUMN:
break;
}
}
}
}
f.close();
// if (f.bad()) {
// std::cout << "Error ____ reading:" << fileName << std::endl;
// }
return !f.bad();
}
std::vector<double> CSVReader::getColumn(int index) {
std::vector<double> out;
int offset = 0;
for (int i = 0; i < index; i++) {
switch (mDataTypes[i]) {
case STRING:
offset += maxStringSize * sizeof(char);
break;
case INT64:
offset += sizeof(int64_t);
break;
case REAL:
offset += sizeof(double);
break;
case BOOLEAN:
offset += sizeof(bool);
break;
case IGNORE_COLUMN:
break;
}
}
// std::cout << offset << std::endl;
for (auto row : mData) {
double *val = (double *)(row + offset);
out.push_back(*val);
}
return out;
}
size_t CSVReader::calculateRowLength() {
size_t len = 0;
;
for (auto type : mDataTypes) {
switch (type) {
case STRING:
len += maxStringSize * sizeof(char);
break;
case INT64:
len += sizeof(int64_t);
break;
case REAL:
len += sizeof(double);
break;
case BOOLEAN:
len += sizeof(bool);
break;
case IGNORE_COLUMN:
break;
}
}
// std::cout << len << std::endl;
return len;
}
| 27.855895 | 80 | 0.509014 | AlloSphere-Research-Group |
b6806e0c06ff588a1b23005c46c7051582f24587 | 5,331 | cpp | C++ | gcsa/rlcsa_test.cpp | mmuggli/doppelganger | c0f2662188edbaad39da80f58072d5a888f4b1d1 | [
"MIT"
] | 2 | 2018-08-16T18:49:12.000Z | 2020-11-11T13:57:38.000Z | gcsa/rlcsa_test.cpp | mmuggli/doppelganger | c0f2662188edbaad39da80f58072d5a888f4b1d1 | [
"MIT"
] | 1 | 2020-11-01T00:40:12.000Z | 2020-11-01T00:40:12.000Z | gcsa/rlcsa_test.cpp | mmuggli/doppelganger | c0f2662188edbaad39da80f58072d5a888f4b1d1 | [
"MIT"
] | null | null | null | #include <cstdlib>
#include <ctime>
#include <iostream>
#include <vector>
#include <rlcsa.h>
#include "bwasearch.h"
#include "parameter_handler.h"
#include "pattern_classifier.h"
//using namespace CSA;
typedef CSA::usint usint;
typedef CSA::pair_type pair_type;
const pair_type EMPTY_PAIR = CSA::EMPTY_PAIR ;
int main(int argc, char** argv)
{
std::cout << "RLCSA test" << std::endl;
std::cout << std::endl;
GCSA::ParameterHandler handler(argc, argv, true, "Usage: rlcsa_test [options] base_name [patterns]");
if(!(handler.ok)) { handler.printUsage(); return 1; }
handler.printOptions();
const CSA::RLCSA rlcsa(handler.index_name);
if(!rlcsa.isOk()) { return 2; }
rlcsa.reportSize(true);
if(handler.patterns_name == 0) { return 0; }
GCSA::BWASearch<CSA::RLCSA> bwasearch(rlcsa);
std::ifstream patterns(handler.patterns_name, std::ios_base::binary);
if(!patterns)
{
std::cerr << "Error opening pattern file!" << std::endl;
return 3;
}
GCSA::PatternClassifier classifier(handler.write ? handler.patterns_name : "");
std::vector<std::string> rows;
CSA::readRows(patterns, rows, true);
usint total = 0, n = rows.size();
usint found = 0, forward = 0, reverse = 0;
usint forward_occurrences = 0, reverse_occurrences = 0;
usint* edit_distances = new usint[handler.k + 1];
for(usint i = 0; i <= handler.k; i++) { edit_distances[i] = 0; }
usint* match_counts = new usint[n];
for(usint i = 0; i < n; i++) { match_counts[i] = 0; }
double start = CSA::readTimer();
for(usint i = 0; i < n; i++)
{
total += rows[i].length();
bool match = false;
// Always start with exact matching.
pair_type result = bwasearch.find(rows[i], false, handler.skip);
usint temp = bwasearch.handleOccurrences(result, handler.locate, handler.max_matches);
if(temp > 0)
{
forward_occurrences += temp; match_counts[i] += temp;
found++; forward++; match = true;
edit_distances[0]++;
if(handler.write) { classifier.forward(rows[i]); }
}
if(handler.reverse_complement)
{
pair_type reverse_result = bwasearch.find(rows[i], true, handler.skip);
temp = bwasearch.handleOccurrences(reverse_result, handler.locate, handler.max_matches);
if(temp > 0)
{
if(!match) { found++; edit_distances[0]++; }
if(handler.k == 0) { reverse_occurrences += temp; }
else { forward_occurrences += temp; }
match_counts[i] += temp;
if(handler.max_matches > 0 && match_counts[i] > handler.max_matches)
{
match_counts[i] = handler.max_matches + 1;
}
reverse++; match = true;
if(handler.write) { classifier.reverse(rows[i]); }
}
}
if(handler.write && !match) { classifier.notfound(rows[i]); }
// Do approximate matching only if there are no exact matches.
if(handler.k > 0 && !match)
{
std::vector<GCSA::MatchInfo*>* results = bwasearch.find(rows[i], handler.k, handler.indels, handler.penalties);
temp = bwasearch.handleOccurrences(results, handler.locate, handler.max_matches);
if(temp > 0)
{
forward_occurrences += temp; match_counts[i] += temp;
found++;
edit_distances[(*(results->begin()))->errors]++;
}
bwasearch.deleteResults(results);
}
}
double time = CSA::readTimer() - start;
double megabases = total / (double)CSA::MILLION;
std::cout << "Patterns: " << n << " (" << (n / time) << " / sec)" << std::endl;
std::cout << "Total size: " << megabases << " megabases";
if(!(handler.locate))
{
std::cout << " (" << (megabases / time) << " megabases / sec)";
}
std::cout << std::endl;
std::cout << "Found: " << found;
if(handler.k == 0 && handler.reverse_complement)
{
std::cout << " (" << forward << " forward, " << reverse << " reverse complement)";
}
std::cout << std::endl;
if(handler.locate)
{
std::cout << "Occurrences: " << (forward_occurrences + reverse_occurrences) << " (";
if(handler.k == 0 && handler.reverse_complement)
{
std::cout << forward_occurrences << " forward, " << reverse_occurrences << " reverse complement, ";
}
std::cout << ((forward_occurrences + reverse_occurrences) / time) << " / sec)" << std::endl;
}
std::cout << "Time: " << time << " seconds" << std::endl;
std::cout << std::endl;
if(handler.verbose)
{
std::cout << "MATCH STATISTICS" << std::endl << std::endl;
std::cout << "Edit distances for matching patterns" << std::endl;
for(usint i = 0; i <= handler.k; i++) { std::cout << " " << i << " " << edit_distances[i] << std::endl; }
std::cout << std::endl;
std::sort(match_counts, match_counts + n);
std::cout << "Number of matches for matching patterns" << std::endl;
usint curr = 0, count = 0;
for(usint i = 0; i < n; i++)
{
if(match_counts[i] != curr)
{
if(curr > 0) { std::cout << " " << curr << " " << count << std::endl; }
curr = match_counts[i]; count = 1;
}
else
{
count++;
}
}
if(curr > 0) { std::cout << " " << curr << " " << count << std::endl; }
std::cout << std::endl;
}
delete edit_distances; edit_distances = 0;
delete match_counts; match_counts = 0;
return 0;
}
| 32.506098 | 117 | 0.59351 | mmuggli |
b680f864e5316eac3e79dc00d1d7a1a6e6331774 | 1,282 | hpp | C++ | engine/source/system/input/mouse/input_mouse_button_windows.hpp | skarab/coffee-master | 6c3ff71b7f15735e41c9859b6db981b94414c783 | [
"MIT"
] | null | null | null | engine/source/system/input/mouse/input_mouse_button_windows.hpp | skarab/coffee-master | 6c3ff71b7f15735e41c9859b6db981b94414c783 | [
"MIT"
] | null | null | null | engine/source/system/input/mouse/input_mouse_button_windows.hpp | skarab/coffee-master | 6c3ff71b7f15735e41c9859b6db981b94414c783 | [
"MIT"
] | null | null | null | #ifdef COFFEE_OS_WINDOWS
#include "system/input/mouse/input_mouse.h"
#include "wide/application/application.h"
namespace coffee
{
namespace input
{
//-OPERATIONS---------------------------------------------------------------------------------//
void MouseButton::Update(const basic::Time& time_step)
{
if (_Code<=BUTTON_Middle)
{
BUTTON code(_Code);
if (Mouse::Get().IsSwapped())
{
if(_Code==BUTTON_Left)
{
code = BUTTON_Right;
}
else if(_Code==BUTTON_Right)
{
code = BUTTON_Left;
}
}
_ItWasPressed = _ItIsPressed;
_ItIsPressed = Application::IsInstantiated()
&& Application::Get().HasFocus()
&& GetAsyncKeyState(code)!=0;
}
else
{
int32 scroll = Mouse::Get().GetScrollValue();
_ItWasPressed = _ItIsPressed;
_ItIsPressed = Application::IsInstantiated()
&& Application::Get().HasFocus()
&& ((scroll>0 && _Code==BUTTON_ScrollUp)
|| (scroll<0 && _Code==BUTTON_ScrollDown));
}
}
}
}
#endif
| 25.137255 | 100 | 0.457878 | skarab |
b6813ddc36cbf25afa1760a597443c2d9f772a74 | 1,776 | cpp | C++ | Code/EditorPlugins/Kraut/EditorPluginKraut/KrautTreeAsset/KrautTreeAssetObjects.cpp | alinoctavian/ezEngine | 0312c8d777c05ac58911f3fa879e4fd7efcfcb66 | [
"MIT"
] | 1 | 2021-06-23T14:44:02.000Z | 2021-06-23T14:44:02.000Z | Code/EditorPlugins/Kraut/EditorPluginKraut/KrautTreeAsset/KrautTreeAssetObjects.cpp | alinoctavian/ezEngine | 0312c8d777c05ac58911f3fa879e4fd7efcfcb66 | [
"MIT"
] | null | null | null | Code/EditorPlugins/Kraut/EditorPluginKraut/KrautTreeAsset/KrautTreeAssetObjects.cpp | alinoctavian/ezEngine | 0312c8d777c05ac58911f3fa879e4fd7efcfcb66 | [
"MIT"
] | null | null | null | #include <EditorPluginKrautPCH.h>
#include <EditorFramework/EditorApp/EditorApp.moc.h>
#include <EditorPluginKraut/KrautTreeAsset/KrautTreeAssetObjects.h>
// clang-format off
EZ_BEGIN_STATIC_REFLECTED_TYPE(ezKrautAssetMaterial, ezNoBase, 1, ezRTTIDefaultAllocator<ezKrautAssetMaterial>)
{
EZ_BEGIN_PROPERTIES
{
// TODO: make the texture references read-only somehow ?
EZ_MEMBER_PROPERTY("DiffuseTexture", m_sDiffuseTexture)->AddAttributes(new ezAssetBrowserAttribute("Texture 2D")),
EZ_MEMBER_PROPERTY("NormalMapTexture", m_sNormalMapTexture)->AddAttributes(new ezAssetBrowserAttribute("Texture 2D")),
}
EZ_END_PROPERTIES;
}
EZ_END_STATIC_REFLECTED_TYPE;
EZ_BEGIN_DYNAMIC_REFLECTED_TYPE(ezKrautTreeAssetProperties, 1, ezRTTIDefaultAllocator<ezKrautTreeAssetProperties>)
{
EZ_BEGIN_PROPERTIES
{
EZ_MEMBER_PROPERTY("KrautFile", m_sKrautFile)->AddAttributes(new ezFileBrowserAttribute("Select Kraut Tree file", "*.kraut")),
EZ_MEMBER_PROPERTY("UniformScaling", m_fUniformScaling)->AddAttributes(new ezDefaultValueAttribute(1.0f)),
EZ_MEMBER_PROPERTY("LodDistanceScale", m_fLodDistanceScale)->AddAttributes(new ezDefaultValueAttribute(1.0f)),
EZ_MEMBER_PROPERTY("StaticColliderRadius", m_fStaticColliderRadius)->AddAttributes(new ezDefaultValueAttribute(0.4f), new ezClampValueAttribute(0.0f, 10.0f)),
EZ_MEMBER_PROPERTY("Surface", m_sSurface)->AddAttributes(new ezAssetBrowserAttribute("Surface")),
EZ_ARRAY_MEMBER_PROPERTY("Materials", m_Materials)->AddAttributes(new ezContainerAttribute(false, false, false)),
}
EZ_END_PROPERTIES;
}
EZ_END_DYNAMIC_REFLECTED_TYPE;
// clang-format on
ezKrautTreeAssetProperties::ezKrautTreeAssetProperties() = default;
ezKrautTreeAssetProperties::~ezKrautTreeAssetProperties() = default;
| 48 | 162 | 0.817005 | alinoctavian |
b681445beca2d805c50439def8635b8c4066945e | 3,640 | cc | C++ | src/solver/libsolver.cc | nerdling/SBSAT | 6328c6aa105b75693d06bf0dae4a3b5ca220318b | [
"Unlicense"
] | 4 | 2015-03-08T07:56:29.000Z | 2017-10-12T04:19:27.000Z | src/solver/libsolver.cc | nerdling/SBSAT | 6328c6aa105b75693d06bf0dae4a3b5ca220318b | [
"Unlicense"
] | null | null | null | src/solver/libsolver.cc | nerdling/SBSAT | 6328c6aa105b75693d06bf0dae4a3b5ca220318b | [
"Unlicense"
] | null | null | null | /* =========FOR INTERNAL USE ONLY. NO DISTRIBUTION PLEASE ========== */
/*********************************************************************
Copyright 1999-2007, University of Cincinnati. All rights reserved.
By using this software the USER indicates that he or she has read,
understood and will comply with the following:
--- University of Cincinnati hereby grants USER nonexclusive permission
to use, copy and/or modify this software for internal, noncommercial,
research purposes only. Any distribution, including commercial sale
or license, of this software, copies of the software, its associated
documentation and/or modifications of either is strictly prohibited
without the prior consent of University of Cincinnati. Title to copyright
to this software and its associated documentation shall at all times
remain with University of Cincinnati. Appropriate copyright notice shall
be placed on all software copies, and a complete copy of this notice
shall be included in all copies of the associated documentation.
No right is granted to use in advertising, publicity or otherwise
any trademark, service mark, or the name of University of Cincinnati.
--- This software and any associated documentation is provided "as is"
UNIVERSITY OF CINCINNATI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS
OR IMPLIED, INCLUDING THOSE OF MERCHANTABILITY OR FITNESS FOR A
PARTICULAR PURPOSE, OR THAT USE OF THE SOFTWARE, MODIFICATIONS, OR
ASSOCIATED DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS,
TRADEMARKS OR OTHER INTELLECTUAL PROPERTY RIGHTS OF A THIRD PARTY.
University of Cincinnati shall not be liable under any circumstances for
any direct, indirect, special, incidental, or consequential damages
with respect to any claim by USER or any third party on account of
or arising from the use, or inability to use, this software or its
associated documentation, even if University of Cincinnati has been advised
of the possibility of those damages.
*********************************************************************/
#define ITE_INLINE inline
#include "smurffactory.cc"
/* init */
#include "solve.cc"
#include "ksolve.cc"
#include "init_solver.cc"
/* basic brancher */
#include "brancher.cc"
#include "select_bp.cc"
#include "update_heu.cc"
/* backtracking through ... */
#include "backtrack.cc"
#include "backtrack_nl.cc"
#include "backtrack_sbj.cc"
#include "bt_misc.cc"
#include "bt_lemmas.cc"
#include "bt_smurfs.cc"
#include "bt_specfn.cc"
#include "bt_specfn_and.cc"
#include "bt_specfn_xor.cc"
#include "bt_specfn_minmax.cc"
/* null heuristic */
#include "heuristic.cc"
/* lemma heuristic */
#include "l_lemma.cc"
#include "l_heuristic.cc"
/* johnson heuristic */
#include "j_update_heu.cc"
#include "j_smurf.cc"
#include "j_specfn.cc"
#include "j_specfn_and.cc"
#include "j_specfn_xor.cc"
#include "j_specfn_minmax.cc"
#include "j_heuristic.cc"
/* interactive heuristic */
#include "i_heuristic.cc"
#include "autarky.cc"
#include "bdd2smurf.cc"
#include "bdd2specfn_and.cc"
#include "bdd2specfn_xor.cc"
#include "bdd2specfn_minmax.cc"
#include "smurfstates.cc"
#include "state_stacks.cc"
#include "heur_stack.cc"
#include "lemmainfo.cc"
#include "lemmaspace.cc"
#include "lemmawlits.cc"
#include "lemmamisc.cc"
#include "lemmacache.cc"
#include "lemmas.cc"
#include "lemmas_and.cc"
#include "lemmas_xor.cc"
#include "lemmas_minmax.cc"
#include "verify.cc"
#include "display.cc"
#include "display_sf.cc"
#include "recordsol.cc"
#include "transitions.cc"
#include "bddwalk.cc"
#include "wvf.cc"
#include "crtwin.cc"
#include "load_lemmas.cc"
#include "interface.cc"
| 30.847458 | 76 | 0.740385 | nerdling |
b681d88a54998d29575d60c45f96efc581cb8aa1 | 13,914 | hpp | C++ | moondb/src/ciconv.hpp | zzccttu/moondb | 1f5b919917c4ba98d62b0a85ef5e07f0588ee324 | [
"MIT"
] | null | null | null | moondb/src/ciconv.hpp | zzccttu/moondb | 1f5b919917c4ba98d62b0a85ef5e07f0588ee324 | [
"MIT"
] | null | null | null | moondb/src/ciconv.hpp | zzccttu/moondb | 1f5b919917c4ba98d62b0a85ef5e07f0588ee324 | [
"MIT"
] | null | null | null | #pragma once
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <boost/algorithm/string/case_conv.hpp>
#define BOOST_LOCALE_ENABLE_CHAR16_T 1
#define BOOST_LOCALE_ENABLE_CHAR32_T 1
#include <boost/locale.hpp>
#include "crunningerror.hpp"
namespace MoonDb {
class CIconv
{
public:
/**
* @brief 字符集类型
*/
enum CharsetType {
CHARSET_NONE,
CHARSET_ASCII,
CHARSET_UTF8,
CHARSET_GBK
};
/**
* @brief get_charset_length 获取字符集字符的最大长度
* @param ct 字符集
* @return 字符最大字节数
*/
inline static uint8_t get_charset_length(CharsetType ct) noexcept
{
switch(ct) {
case CHARSET_ASCII:
return 1;
case CHARSET_UTF8:
return 4;
case CHARSET_GBK:
return 2;
default:
return 0;
}
}
const static int64_t npos = std::numeric_limits<int64_t>::max();
/**
* @brief substr 截取字符串
* @param str 原字符串
* @param start 起始位置,可为负值
* @param length 长度,可为负值
* @return 返回截取后的字符串
*/
inline static std::string substr_ascii(const std::string& str, int64_t start, int64_t length = npos) noexcept
{
if(length == 0) {
return "";
}
int64_t size = static_cast<int64_t>(str.size());
if(_substr_pre(start, length, size)) {
return "";
}
return str.substr(static_cast<size_t>(start), static_cast<size_t>(length));
}
/**
* @brief truncate_ascii 将ascii字符串截断到length长度
* @param str 待处理字符串
* @param length 截断长度
* @param charnum 字符数
*/
inline static void truncate_ascii(std::string& str, uint32_t length, uint32_t& charnum) noexcept
{
if(str.size() > length) {
str.erase(length);
}
charnum = static_cast<uint32_t>(str.size());
}
/**
* @brief iconv 将字符串str从from字符集转为to字符集
* example: iconv("汉字", CHARSET_GBK, CHARSET_UTF8)
* @param str 待处理字符串
* @param from 源字符串字符集
* @param to 目标字符串字符集
* @return 转换后的字符串
*/
inline static std::string iconv(const std::string& str, CharsetType from, CharsetType to)
{
return boost::locale::conv::between(str, _get_charset_str(to), _get_charset_str(from));
}
/**
* @brief to_char 转换为string类型的utf字符串
* @param str 源字符串
* @param from 原字符集
* @return 转换后的字符串
*/
inline static std::string to_char(const std::string& str, CharsetType from)
{
return boost::locale::conv::to_utf<char>(str, _get_charset_str(from));
}
/**
* @brief to_wchar 将字符串str从from字符集转为unicode wchar字符串
* example: to_wchar("汉字", CHARSET_GBK)
* @param str 源字符串
* @param from 原字符集
* @return 转换后的字符串
*/
inline static std::wstring to_wchar(const std::string& str, CharsetType from)
{
return boost::locale::conv::to_utf<wchar_t>(str, _get_charset_str(from));
}
/**
* @brief to_char16 将字符串str从from字符集转为unicode char16字符串
* @param str 源字符串
* @param from 原字符集
* @return 转换后的字符串
*/
inline static std::u16string to_char16(const std::string& str, CharsetType from)
{
return boost::locale::conv::to_utf<char16_t>(str, _get_charset_str(from));
}
/**
* @brief to_char32 将字符串str从from字符集转为unicode char32字符串
* @param str 源字符串
* @param from 原字符集
* @return 转换后的字符串
*/
inline static std::u32string to_char32(const std::string& str, CharsetType from)
{
return boost::locale::conv::to_utf<char32_t>(str, _get_charset_str(from));
}
/**
* @brief from_char 将字符串str从utf字符串转为to字符集
* @param str 源字符串
* @param to 目标字符集
* @return 转换后的字符串
*/
inline static std::string from_char(const std::string& str, CharsetType to)
{
return boost::locale::conv::from_utf(str, _get_charset_str(to));
}
/**
* @brief from_wchar 将字符串wstr从unicode wchar字符串转为to字符集
* @param wstr 源字符串
* @param to 目标字符集
* @return 转换后的字符串
*/
inline static std::string from_wchar(const std::wstring& wstr, CharsetType to)
{
return boost::locale::conv::from_utf(wstr, _get_charset_str(to));
}
/**
* @brief from_char16 将字符串wstr从unicode u16string字符串转为to字符集
* @param wstr 源字符串
* @param to 目标字符集
* @return 转换后的字符串
*/
inline static std::string from_char16(const std::u16string& wstr, CharsetType to)
{
return boost::locale::conv::from_utf(wstr, _get_charset_str(to));
}
/**
* @brief from_char32 将字符串wstr从unicode u32string字符串转为to字符集
* @param wstr 源字符串
* @param to 目标字符集
* @return 转换后的字符串
*/
inline static std::string from_char32(const std::u32string& wstr, CharsetType to)
{
return boost::locale::conv::from_utf(wstr, _get_charset_str(to));
}
inline static std::wstring utf8_to_wchar(const std::string& str)
{
return boost::locale::conv::utf_to_utf<wchar_t, char>(str);
}
inline static std::u16string utf8_to_char16(const std::string& str)
{
return boost::locale::conv::utf_to_utf<char16_t, char>(str);
}
inline static std::u32string utf8_to_char32(const std::string& str)
{
return boost::locale::conv::utf_to_utf<char32_t, char>(str);
}
inline static std::string wchar_to_utf8(const std::wstring& wstr)
{
return boost::locale::conv::from_utf(wstr, "UTF-8");
}
inline static std::string char16_to_utf8(const std::u16string& wstr)
{
return boost::locale::conv::from_utf(wstr, "UTF-8");
}
inline static std::string char32_to_utf8(const std::u32string& wstr)
{
return boost::locale::conv::from_utf(wstr, "UTF-8");
}
/**
* @brief get_length_utf8 utf8字符长度1-4,根据每个字符第一个字节计算字符长度
0xxxxxxx
110xxxxx 10xxxxxx
1110xxxx 10xxxxxx 10xxxxxx
11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
* @param str
* @return 字符长度
*/
inline static size_t strlen_utf8(const std::string& str)
{
size_t length = 0;
const char* p = str.data();
while(*p) {
p += _charlen_utf8_check(p, length);
length ++;
}
return length;
}
/**
* @brief strlen_gbk gbk字符长度1-2
* @param str
* @return 字符长度
*/
inline static size_t strlen_gbk(const std::string& str) noexcept
{
size_t length = 0;
const char* p = str.data();
while(*p) {
p += _charlen_gbk(p);
length ++;
}
return length;
}
/**
* @brief substr_utf8 截取utf8字符串
* @param str 原字符串
* @param start 起始位置,可为负值
* @param length 长度,可为负值
* @param size utf8字符数量,如果为-1则根据str计算长度
* @return 返回截取后的字符串
*/
inline static std::string substr_utf8(const std::string& str, int64_t start, int64_t length = npos, int64_t size = -1)
{
if(length == 0) {
return "";
}
if(-1 == size) {
size = static_cast<int64_t>(strlen_utf8(str));
}
if(_substr_pre(start, length, size)) {
return "";
}
int64_t i = 0;
const char* p = str.data();
// 计算start_byte起始位置
size_t start_byte = 0;
while(*p) {
if(i >= start) {
break;
}
uint8_t charlen = _charlen_utf8(p);
if(0 == charlen) {
break;
}
i ++;
start_byte += charlen;
p += charlen;
}
// 计算length_byte长度
size_t length_byte = 0;
i = 0;
while(*p) {
if(i >= length) {
break;
}
uint8_t charlen = _charlen_utf8(p);
if(0 == charlen) {
break;
}
i ++;
length_byte += charlen;
p += charlen;
}
return str.substr(static_cast<size_t>(start_byte), static_cast<size_t>(length_byte));
}
/**
* @brief substr_gbk 截取gbk字符串
* @param str 原字符串
* @param start 起始位置,可为负值
* @param length 长度,可为负值
* @param size gbk字符数量,如果为-1则根据str计算长度
* @return 返回截取后的字符串
*/
inline static std::string substr_gbk(const std::string& str, int64_t start, int64_t length = npos, int64_t size = -1) noexcept
{
if(length == 0) {
return "";
}
if(-1 == size) {
size = static_cast<int64_t>(strlen_gbk(str));
}
if(_substr_pre(start, length, size)) {
return "";
}
int64_t i = 0;
const char* p = str.data();
// 计算start_byte起始位置
size_t start_byte = 0;
while(*p) {
if(i >= start) {
break;
}
uint8_t charlen = _charlen_gbk(p);
if(0 == charlen) {
break;
}
i ++;
start_byte += charlen;
p += charlen;
}
// 计算length_byte长度
size_t length_byte = 0;
i = 0;
while(*p) {
if(i >= length) {
break;
}
uint8_t charlen = _charlen_gbk(p);
if(0 == charlen) {
break;
}
i ++;
length_byte += charlen;
p += charlen;
}
return str.substr(static_cast<size_t>(start_byte), static_cast<size_t>(length_byte));
}
/**
* @brief truncate_utf8 将utf8字符串截断到length(字节)长度
* @param str 待处理字符串
* @param length 截断长度
* @param charnum 字符数
*/
inline static void truncate_utf8(std::string& str, uint32_t length, uint32_t& charnum)
{
if(str.size() > length) {
charnum = 0;
size_t trunlength = 0;
const char* p = str.data();
while(*p) {
uint8_t charlen = _charlen_utf8_check(p, charnum);
if(trunlength + charlen > length) {
break;
}
p += charlen;
trunlength += charlen;
charnum++;
}
str.erase(trunlength);
}
else {
charnum = static_cast<uint32_t>(strlen_utf8(str));
}
}
/**
* @brief truncate_gbk 将gbk字符串截断到length(字节)长度
* @param str 待处理字符串
* @param length 截断长度
* @param charnum 字符数
*/
inline static void truncate_gbk(std::string& str, uint32_t length, uint32_t& charnum) noexcept
{
if(str.size() > length) {
charnum = 0;
size_t trunlength = 0;
const char* p = str.data();
while(*p) {
uint8_t charlen = _charlen_gbk(p);
if(trunlength + charlen > length) {
break;
}
p += charlen;
trunlength += charlen;
charnum++;
}
str.erase(trunlength);
}
else {
charnum = static_cast<uint32_t>(strlen_gbk(str));
}
}
/**
* @brief substr 截取字符串
* @param str 原字符串
* @param start 起始位置,可为负值
* @param length 长度,可为负值
* @param charset 字符集
* @return 返回截取后的字符串
*/
inline static std::string substr(const std::string& str, const int64_t& start, const int64_t& length = npos, CharsetType charset = CHARSET_ASCII)
{
switch(charset) {
case CHARSET_ASCII:
return substr_ascii(str, start, length);
case CHARSET_UTF8:
return substr_utf8(str, start, length);
case CHARSET_GBK:
return substr_gbk(str, start, length);
default:
return substr_ascii(str, start, length);
}
}
/**
* @brief strlen 按照字符集计算字符串长度
* @param str 字符串
* @param charset 字符集
* @return 长度
*/
inline static size_t strlen(const std::string& str, CharsetType charset = CHARSET_ASCII)
{
switch(charset) {
case CHARSET_ASCII:
return str.size();
case CHARSET_UTF8:
return strlen_utf8(str);
case CHARSET_GBK:
return strlen_gbk(str);
default:
return str.size();
}
}
/**
* @brief truncate 将字符串截断
* @param str 字符串
* @param length 截断长度
* @param charnum 字符数
* @param charset 字符集
*/
inline static void truncate(std::string& str, uint32_t length, uint32_t& charnum, CharsetType charset = CHARSET_ASCII) noexcept
{
switch(charset) {
case CHARSET_ASCII:
truncate_ascii(str, length, charnum);
break;
case CHARSET_UTF8:
truncate_utf8(str, length, charnum);
break;
case CHARSET_GBK:
truncate_gbk(str, length, charnum);
break;
default:
truncate_ascii(str, length, charnum);
}
}
protected:
inline static bool _substr_pre(int64_t& start, int64_t& length, const int64_t& size) noexcept
{
//if(length == 0) {
// return true;
//}
if(start < 0) {
start = size + start;
if(start < 0) {
return true;
}
}
if(start >= size) {
return true;
}
if(length < 0) {
length = size + length - start;
if(length <= 0) {
return true;
}
}
else if(start + length > size) {
length = size - start;
}
return false;
}
inline static uint8_t _charlen_gbk(const char* p) noexcept
{
if(*p < 0 && (*(p+1) < 0 || *(p+1) > 63)) {//中文汉字情况
return 2;
}
else {
return 1;
}
}
inline static uint8_t _charlen_utf8(const char* p) noexcept
{
//1*******
if(*p & 128) {
//11*******
if(*p & 64) {
//111*****
if(*p & 32) {
//1111****
if(*p & 16) {
//11111***
if(*p & 8) {
// 出现错误
}
//11110***
else {
return 4;
}
}
//1110****
else {
return 3;
}
}
//110*****
else {
return 2;
}
}
//10******
else {
}
}
//0*******
else {
return 1;
}
return 0;
}
// 如果出现错误抛出异常,信息中心含有错误字符的位置(从1开始)
inline static uint8_t _charlen_utf8_check(const char* p, const size_t& length)
{
//1*******
if(*p & 128) {
//11*******
if(*p & 64) {
//111*****
if(*p & 32) {
//1111****
if(*p & 16) {
//11111***
if(*p & 8) {
// 出现错误
ThrowError(ERR_STRING_VALID, "The UTF-8 string is invalid(5,pos:" + std::to_string(length + 1) + ").");
}
//11110***
else {
if(0 == *(p+1) || !((*(p+1) & 128) && !(*(p+1) & 64))) {
ThrowError(ERR_STRING_VALID, "The UTF-8 string is invalid(4,2,pos:" + std::to_string(length + 1) + ").");
}
if(0 == *(p+2) || !((*(p+2) & 128) && !(*(p+2) & 64))) {
ThrowError(ERR_STRING_VALID, "The UTF-8 string is invalid(4,3,pos:" + std::to_string(length + 1) + ").");
}
if(0 == *(p+3) || !((*(p+3) & 128) && !(*(p+3) & 64))) {
ThrowError(ERR_STRING_VALID, "The UTF-8 string is invalid(4,4,pos:" + std::to_string(length + 1) + ").");
}
return 4;
}
}
//1110****
else {
if(0 == *(p+1) || !((*(p+1) & 128) && !(*(p+1) & 64))) {
ThrowError(ERR_STRING_VALID, "The UTF-8 string is invalid(3,2,pos:" + std::to_string(length + 1) + ").");
}
if(0 == *(p+2) || !((*(p+2) & 128) && !(*(p+2) & 64))) {
ThrowError(ERR_STRING_VALID, "The UTF-8 string is invalid(3,3,pos:" + std::to_string(length + 1) + ").");
}
return 3;
}
}
//110*****
else {
if(0 == *(p+1) || !((*(p+1) & 128) && !(*(p+1) & 64))) {
ThrowError(ERR_STRING_VALID, "The UTF-8 string is invalid(2,2,pos:" + std::to_string(length + 1) + ").");
}
return 2;
}
}
//10******
else {
ThrowError(ERR_STRING_VALID, "The UTF-8 string is invalid(1,1,pos:" + std::to_string(length + 1) + ").");
}
}
//0*******
else {
return 1;
}
return 0;
}
inline static const char* _get_charset_str(CharsetType charset) noexcept
{
static const char allcharsets[][6] {"", "ASCII", "UTF-8", "GBK"};
return allcharsets[charset];
}
};
}
| 22.050713 | 146 | 0.617004 | zzccttu |
b68d417fffaab37cc64634972a1a8c89b0820cc5 | 850 | hpp | C++ | src/engine/data/data-container.hpp | DavidPeicho/3DEngine | e27cd4ac72b4bf72cc0213061c5d386f5f670749 | [
"MIT"
] | 2 | 2018-04-17T07:33:48.000Z | 2018-09-12T13:03:23.000Z | src/engine/data/data-container.hpp | DavidPeicho/3DEngine | e27cd4ac72b4bf72cc0213061c5d386f5f670749 | [
"MIT"
] | 2 | 2018-04-30T03:54:51.000Z | 2021-03-09T22:36:13.000Z | src/engine/data/data-container.hpp | DavidPeicho/3DEngine | e27cd4ac72b4bf72cc0213061c5d386f5f670749 | [
"MIT"
] | null | null | null | #pragma once
#include <memory>
#include <vector>
#include <boost/variant.hpp>
#include <components/material/material.hpp>
#include <components/light/light.hpp>
#include <components/light/pointlight.hpp>
#include "data-container.hpp"
#include "singleton.hpp"
namespace Engine
{
namespace Data
{
template <typename ... DataTypes>
class DataContainerType
{
public:
using DataListContainer = std::tuple<std::vector<DataTypes>...>;
public:
template<typename DataType>
std::vector<DataType>&
get()
{
return std::get<std::vector<DataType>>(data_);
}
private:
DataListContainer data_;
};
using DataContainer = DataContainerType<Components::Material::MaterialPtr,
Components::Light::LightPtr>;
} // namespace Data
} // namespace Engine
| 21.25 | 78 | 0.656471 | DavidPeicho |
b6925aa9428f366a426078f537d113393c154362 | 65,944 | cc | C++ | src/debug.cc | martine/v8c | 222c7cd957ea7be31701172e8f66e4c31d0aa3f4 | [
"BSD-3-Clause-Clear"
] | 3 | 2015-01-01T16:04:49.000Z | 2016-05-08T13:54:15.000Z | src/debug.cc | martine/v8c | 222c7cd957ea7be31701172e8f66e4c31d0aa3f4 | [
"BSD-3-Clause-Clear"
] | null | null | null | src/debug.cc | martine/v8c | 222c7cd957ea7be31701172e8f66e4c31d0aa3f4 | [
"BSD-3-Clause-Clear"
] | null | null | null | // Copyright 2006-2008 the V8 project authors. 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 Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "v8.h"
#include "api.h"
#include "arguments.h"
#include "bootstrapper.h"
#include "code-stubs.h"
#include "compiler.h"
#include "debug.h"
#include "execution.h"
#include "global-handles.h"
#include "natives.h"
#include "stub-cache.h"
#include "log.h"
namespace v8 { namespace internal {
static void PrintLn(v8::Local<v8::Value> value) {
v8::Local<v8::String> s = value->ToString();
char* data = NewArray<char>(s->Length() + 1);
if (data == NULL) {
V8::FatalProcessOutOfMemory("PrintLn");
return;
}
s->WriteAscii(data);
PrintF("%s\n", data);
DeleteArray(data);
}
static Handle<Code> ComputeCallDebugBreak(int argc) {
CALL_HEAP_FUNCTION(StubCache::ComputeCallDebugBreak(argc), Code);
}
static Handle<Code> ComputeCallDebugPrepareStepIn(int argc) {
CALL_HEAP_FUNCTION(StubCache::ComputeCallDebugPrepareStepIn(argc), Code);
}
BreakLocationIterator::BreakLocationIterator(Handle<DebugInfo> debug_info,
BreakLocatorType type) {
debug_info_ = debug_info;
type_ = type;
reloc_iterator_ = NULL;
reloc_iterator_original_ = NULL;
Reset(); // Initialize the rest of the member variables.
}
BreakLocationIterator::~BreakLocationIterator() {
ASSERT(reloc_iterator_ != NULL);
ASSERT(reloc_iterator_original_ != NULL);
delete reloc_iterator_;
delete reloc_iterator_original_;
}
void BreakLocationIterator::Next() {
AssertNoAllocation nogc;
ASSERT(!RinfoDone());
// Iterate through reloc info for code and original code stopping at each
// breakable code target.
bool first = break_point_ == -1;
while (!RinfoDone()) {
if (!first) RinfoNext();
first = false;
if (RinfoDone()) return;
// Whenever a statement position or (plain) position is passed update the
// current value of these.
if (RelocInfo::IsPosition(rmode())) {
if (RelocInfo::IsStatementPosition(rmode())) {
statement_position_ =
rinfo()->data() - debug_info_->shared()->start_position();
}
// Always update the position as we don't want that to be before the
// statement position.
position_ = rinfo()->data() - debug_info_->shared()->start_position();
ASSERT(position_ >= 0);
ASSERT(statement_position_ >= 0);
}
// Check for breakable code target. Look in the original code as setting
// break points can cause the code targets in the running (debugged) code to
// be of a different kind than in the original code.
if (RelocInfo::IsCodeTarget(rmode())) {
Address target = original_rinfo()->target_address();
Code* code = Debug::GetCodeTarget(target);
if (code->is_inline_cache_stub() || RelocInfo::IsConstructCall(rmode())) {
break_point_++;
return;
}
if (code->kind() == Code::STUB) {
if (type_ == ALL_BREAK_LOCATIONS) {
if (Debug::IsBreakStub(code)) {
break_point_++;
return;
}
} else {
ASSERT(type_ == SOURCE_BREAK_LOCATIONS);
if (Debug::IsSourceBreakStub(code)) {
break_point_++;
return;
}
}
}
}
// Check for break at return.
if (RelocInfo::IsJSReturn(rmode())) {
// Set the positions to the end of the function.
if (debug_info_->shared()->HasSourceCode()) {
position_ = debug_info_->shared()->end_position() -
debug_info_->shared()->start_position();
} else {
position_ = 0;
}
statement_position_ = position_;
break_point_++;
return;
}
}
}
void BreakLocationIterator::Next(int count) {
while (count > 0) {
Next();
count--;
}
}
// Find the break point closest to the supplied address.
void BreakLocationIterator::FindBreakLocationFromAddress(Address pc) {
// Run through all break points to locate the one closest to the address.
int closest_break_point = 0;
int distance = kMaxInt;
while (!Done()) {
// Check if this break point is closer that what was previously found.
if (this->pc() < pc && pc - this->pc() < distance) {
closest_break_point = break_point();
distance = pc - this->pc();
// Check whether we can't get any closer.
if (distance == 0) break;
}
Next();
}
// Move to the break point found.
Reset();
Next(closest_break_point);
}
// Find the break point closest to the supplied source position.
void BreakLocationIterator::FindBreakLocationFromPosition(int position) {
// Run through all break points to locate the one closest to the source
// position.
int closest_break_point = 0;
int distance = kMaxInt;
while (!Done()) {
// Check if this break point is closer that what was previously found.
if (position <= statement_position() &&
statement_position() - position < distance) {
closest_break_point = break_point();
distance = statement_position() - position;
// Check whether we can't get any closer.
if (distance == 0) break;
}
Next();
}
// Move to the break point found.
Reset();
Next(closest_break_point);
}
void BreakLocationIterator::Reset() {
// Create relocation iterators for the two code objects.
if (reloc_iterator_ != NULL) delete reloc_iterator_;
if (reloc_iterator_original_ != NULL) delete reloc_iterator_original_;
reloc_iterator_ = new RelocIterator(debug_info_->code());
reloc_iterator_original_ = new RelocIterator(debug_info_->original_code());
// Position at the first break point.
break_point_ = -1;
position_ = 1;
statement_position_ = 1;
Next();
}
bool BreakLocationIterator::Done() const {
return RinfoDone();
}
void BreakLocationIterator::SetBreakPoint(Handle<Object> break_point_object) {
// If there is not already a real break point here patch code with debug
// break.
if (!HasBreakPoint()) {
SetDebugBreak();
}
ASSERT(IsDebugBreak());
// Set the break point information.
DebugInfo::SetBreakPoint(debug_info_, code_position(),
position(), statement_position(),
break_point_object);
}
void BreakLocationIterator::ClearBreakPoint(Handle<Object> break_point_object) {
// Clear the break point information.
DebugInfo::ClearBreakPoint(debug_info_, code_position(), break_point_object);
// If there are no more break points here remove the debug break.
if (!HasBreakPoint()) {
ClearDebugBreak();
ASSERT(!IsDebugBreak());
}
}
void BreakLocationIterator::SetOneShot() {
// If there is a real break point here no more to do.
if (HasBreakPoint()) {
ASSERT(IsDebugBreak());
return;
}
// Patch code with debug break.
SetDebugBreak();
}
void BreakLocationIterator::ClearOneShot() {
// If there is a real break point here no more to do.
if (HasBreakPoint()) {
ASSERT(IsDebugBreak());
return;
}
// Patch code removing debug break.
ClearDebugBreak();
ASSERT(!IsDebugBreak());
}
void BreakLocationIterator::SetDebugBreak() {
// If there is already a break point here just return. This might happen if
// the same code is flooded with break points twice. Flooding the same
// function twice might happen when stepping in a function with an exception
// handler as the handler and the function is the same.
if (IsDebugBreak()) {
return;
}
if (RelocInfo::IsJSReturn(rmode())) {
// This path is currently only used on IA32 as JSExitFrame on ARM uses a
// stub.
// Patch the JS frame exit code with a debug break call. See
// VisitReturnStatement and ExitJSFrame in codegen-ia32.cc for the
// precise return instructions sequence.
ASSERT(Debug::kIa32JSReturnSequenceLength >=
Debug::kIa32CallInstructionLength);
rinfo()->patch_code_with_call(Debug::debug_break_return_entry()->entry(),
Debug::kIa32JSReturnSequenceLength - Debug::kIa32CallInstructionLength);
} else {
// Patch the original code with the current address as the current address
// might have changed by the inline caching since the code was copied.
original_rinfo()->set_target_address(rinfo()->target_address());
// Patch the code to invoke the builtin debug break function matching the
// calling convention used by the call site.
Handle<Code> dbgbrk_code(Debug::FindDebugBreak(rinfo()));
rinfo()->set_target_address(dbgbrk_code->entry());
}
ASSERT(IsDebugBreak());
}
void BreakLocationIterator::ClearDebugBreak() {
if (RelocInfo::IsJSReturn(rmode())) {
// Restore the JS frame exit code.
rinfo()->patch_code(original_rinfo()->pc(),
Debug::kIa32JSReturnSequenceLength);
} else {
// Patch the code to the original invoke.
rinfo()->set_target_address(original_rinfo()->target_address());
}
ASSERT(!IsDebugBreak());
}
void BreakLocationIterator::PrepareStepIn() {
// Step in can only be prepared if currently positioned on an IC call or
// construct call.
Address target = rinfo()->target_address();
Code* code = Debug::GetCodeTarget(target);
if (code->is_call_stub()) {
// Step in through IC call is handled by the runtime system. Therefore make
// sure that the any current IC is cleared and the runtime system is
// called. If the executing code has a debug break at the location change
// the call in the original code as it is the code there that will be
// executed in place of the debug break call.
Handle<Code> stub = ComputeCallDebugPrepareStepIn(code->arguments_count());
if (IsDebugBreak()) {
original_rinfo()->set_target_address(stub->entry());
} else {
rinfo()->set_target_address(stub->entry());
}
} else {
// Step in through constructs call requires no changes to the running code.
ASSERT(RelocInfo::IsConstructCall(rmode()));
}
}
// Check whether the break point is at a position which will exit the function.
bool BreakLocationIterator::IsExit() const {
return (RelocInfo::IsJSReturn(rmode()));
}
bool BreakLocationIterator::HasBreakPoint() {
return debug_info_->HasBreakPoint(code_position());
}
// Check whether there is a debug break at the current position.
bool BreakLocationIterator::IsDebugBreak() {
if (RelocInfo::IsJSReturn(rmode())) {
// This is IA32 specific but works as long as the ARM version
// still uses a stub for JSExitFrame.
//
// TODO(1240753): Make the test architecture independent or split
// parts of the debugger into architecture dependent files.
return (*(rinfo()->pc()) == 0xE8);
} else {
return Debug::IsDebugBreak(rinfo()->target_address());
}
}
Object* BreakLocationIterator::BreakPointObjects() {
return debug_info_->GetBreakPointObjects(code_position());
}
bool BreakLocationIterator::RinfoDone() const {
ASSERT(reloc_iterator_->done() == reloc_iterator_original_->done());
return reloc_iterator_->done();
}
void BreakLocationIterator::RinfoNext() {
reloc_iterator_->next();
reloc_iterator_original_->next();
#ifdef DEBUG
ASSERT(reloc_iterator_->done() == reloc_iterator_original_->done());
if (!reloc_iterator_->done()) {
ASSERT(rmode() == original_rmode());
}
#endif
}
bool Debug::has_break_points_ = false;
DebugInfoListNode* Debug::debug_info_list_ = NULL;
// Threading support.
void Debug::ThreadInit() {
thread_local_.last_step_action_ = StepNone;
thread_local_.last_statement_position_ = RelocInfo::kNoPosition;
thread_local_.step_count_ = 0;
thread_local_.last_fp_ = 0;
thread_local_.step_into_fp_ = 0;
thread_local_.after_break_target_ = 0;
}
JSCallerSavedBuffer Debug::registers_;
Debug::ThreadLocal Debug::thread_local_;
char* Debug::ArchiveDebug(char* storage) {
char* to = storage;
memcpy(to, reinterpret_cast<char*>(&thread_local_), sizeof(ThreadLocal));
to += sizeof(ThreadLocal);
memcpy(to, reinterpret_cast<char*>(®isters_), sizeof(registers_));
ThreadInit();
ASSERT(to <= storage + ArchiveSpacePerThread());
return storage + ArchiveSpacePerThread();
}
char* Debug::RestoreDebug(char* storage) {
char* from = storage;
memcpy(reinterpret_cast<char*>(&thread_local_), from, sizeof(ThreadLocal));
from += sizeof(ThreadLocal);
memcpy(reinterpret_cast<char*>(®isters_), from, sizeof(registers_));
ASSERT(from <= storage + ArchiveSpacePerThread());
return storage + ArchiveSpacePerThread();
}
int Debug::ArchiveSpacePerThread() {
return sizeof(ThreadLocal) + sizeof(registers_);
}
// Default break enabled.
bool Debug::disable_break_ = false;
// Default call debugger on uncaught exception.
bool Debug::break_on_exception_ = false;
bool Debug::break_on_uncaught_exception_ = true;
Handle<Context> Debug::debug_context_ = Handle<Context>();
Code* Debug::debug_break_return_entry_ = NULL;
Code* Debug::debug_break_return_ = NULL;
void Debug::HandleWeakDebugInfo(v8::Persistent<v8::Object> obj, void* data) {
DebugInfoListNode* node = reinterpret_cast<DebugInfoListNode*>(data);
RemoveDebugInfo(node->debug_info());
#ifdef DEBUG
node = Debug::debug_info_list_;
while (node != NULL) {
ASSERT(node != reinterpret_cast<DebugInfoListNode*>(data));
node = node->next();
}
#endif
}
DebugInfoListNode::DebugInfoListNode(DebugInfo* debug_info): next_(NULL) {
// Globalize the request debug info object and make it weak.
debug_info_ = Handle<DebugInfo>::cast((GlobalHandles::Create(debug_info)));
GlobalHandles::MakeWeak(reinterpret_cast<Object**>(debug_info_.location()),
this, Debug::HandleWeakDebugInfo);
}
DebugInfoListNode::~DebugInfoListNode() {
GlobalHandles::Destroy(reinterpret_cast<Object**>(debug_info_.location()));
}
void Debug::Setup(bool create_heap_objects) {
ThreadInit();
if (create_heap_objects) {
// Get code to handle entry to debug break on return.
debug_break_return_entry_ =
Builtins::builtin(Builtins::Return_DebugBreakEntry);
ASSERT(debug_break_return_entry_->IsCode());
// Get code to handle debug break on return.
debug_break_return_ =
Builtins::builtin(Builtins::Return_DebugBreak);
ASSERT(debug_break_return_->IsCode());
}
}
bool Debug::CompileDebuggerScript(int index) {
HandleScope scope;
// Bail out if the index is invalid.
if (index == -1) {
return false;
}
// Find source and name for the requested script.
Handle<String> source_code = Bootstrapper::NativesSourceLookup(index);
Vector<const char> name = Natives::GetScriptName(index);
Handle<String> script_name = Factory::NewStringFromAscii(name);
// Compile the script.
bool allow_natives_syntax = FLAG_allow_natives_syntax;
FLAG_allow_natives_syntax = true;
Handle<JSFunction> boilerplate;
boilerplate = Compiler::Compile(source_code, script_name, 0, 0, NULL, NULL);
FLAG_allow_natives_syntax = allow_natives_syntax;
// Silently ignore stack overflows during compilation.
if (boilerplate.is_null()) {
ASSERT(Top::has_pending_exception());
Top::clear_pending_exception();
return false;
}
// Execute the boilerplate function in the debugger context.
Handle<Context> context = Top::global_context();
bool caught_exception = false;
Handle<JSFunction> function =
Factory::NewFunctionFromBoilerplate(boilerplate, context);
Handle<Object> result =
Execution::TryCall(function, Handle<Object>(context->global()),
0, NULL, &caught_exception);
// Check for caught exceptions.
if (caught_exception) {
Handle<Object> message = MessageHandler::MakeMessageObject(
"error_loading_debugger", NULL, HandleVector<Object>(&result, 1),
Handle<String>());
MessageHandler::ReportMessage(NULL, message);
return false;
}
// Mark this script as native and return successfully.
Handle<Script> script(Script::cast(function->shared()->script()));
script->set_type(Smi::FromInt(SCRIPT_TYPE_NATIVE));
return true;
}
bool Debug::Load() {
// Return if debugger is already loaded.
if (IsLoaded()) return true;
// Bail out if we're already in the process of compiling the native
// JavaScript source code for the debugger.
if (Debugger::compiling_natives() || Debugger::is_loading_debugger())
return false;
Debugger::set_loading_debugger(true);
// Disable breakpoints and interrupts while compiling and running the
// debugger scripts including the context creation code.
DisableBreak disable(true);
PostponeInterruptsScope postpone;
// Create the debugger context.
HandleScope scope;
Handle<Context> context =
Bootstrapper::CreateEnvironment(Handle<Object>::null(),
v8::Handle<ObjectTemplate>(),
NULL);
// Use the debugger context.
SaveContext save;
Top::set_context(*context);
Top::set_security_context(*context);
// Expose the builtins object in the debugger context.
Handle<String> key = Factory::LookupAsciiSymbol("builtins");
Handle<GlobalObject> global = Handle<GlobalObject>(context->global());
SetProperty(global, key, Handle<Object>(global->builtins()), NONE);
// Compile the JavaScript for the debugger in the debugger context.
Debugger::set_compiling_natives(true);
bool caught_exception =
!CompileDebuggerScript(Natives::GetIndex("mirror")) ||
!CompileDebuggerScript(Natives::GetIndex("debug"));
Debugger::set_compiling_natives(false);
// Make sure we mark the debugger as not loading before we might
// return.
Debugger::set_loading_debugger(false);
// Check for caught exceptions.
if (caught_exception) return false;
// Debugger loaded.
debug_context_ = Handle<Context>::cast(GlobalHandles::Create(*context));
return true;
}
void Debug::Unload() {
// Return debugger is not loaded.
if (!IsLoaded()) {
return;
}
// Clear debugger context global handle.
GlobalHandles::Destroy(reinterpret_cast<Object**>(debug_context_.location()));
debug_context_ = Handle<Context>();
}
void Debug::Iterate(ObjectVisitor* v) {
#define VISIT(field) v->VisitPointer(reinterpret_cast<Object**>(&(field)));
VISIT(debug_break_return_entry_);
VISIT(debug_break_return_);
#undef VISIT
}
Object* Debug::Break(Arguments args) {
HandleScope scope;
ASSERT(args.length() == 0);
// Get the top-most JavaScript frame.
JavaScriptFrameIterator it;
JavaScriptFrame* frame = it.frame();
// Just continue if breaks are disabled or debugger cannot be loaded.
if (disable_break() || !Load()) {
SetAfterBreakTarget(frame);
return Heap::undefined_value();
}
SaveBreakFrame save;
EnterDebuggerContext enter;
// Postpone interrupt during breakpoint processing.
PostponeInterruptsScope postpone;
// Get the debug info (create it if it does not exist).
Handle<SharedFunctionInfo> shared =
Handle<SharedFunctionInfo>(JSFunction::cast(frame->function())->shared());
Handle<DebugInfo> debug_info = GetDebugInfo(shared);
// Find the break point where execution has stopped.
BreakLocationIterator break_location_iterator(debug_info,
ALL_BREAK_LOCATIONS);
break_location_iterator.FindBreakLocationFromAddress(frame->pc());
// Check whether step next reached a new statement.
if (!StepNextContinue(&break_location_iterator, frame)) {
// Decrease steps left if performing multiple steps.
if (thread_local_.step_count_ > 0) {
thread_local_.step_count_--;
}
}
// If there is one or more real break points check whether any of these are
// triggered.
Handle<Object> break_points_hit(Heap::undefined_value());
if (break_location_iterator.HasBreakPoint()) {
Handle<Object> break_point_objects =
Handle<Object>(break_location_iterator.BreakPointObjects());
break_points_hit = CheckBreakPoints(break_point_objects);
}
// Notify debugger if a real break point is triggered or if performing single
// stepping with no more steps to perform. Otherwise do another step.
if (!break_points_hit->IsUndefined() ||
(thread_local_.last_step_action_ != StepNone &&
thread_local_.step_count_ == 0)) {
// Clear all current stepping setup.
ClearStepping();
// Notify the debug event listeners.
Debugger::OnDebugBreak(break_points_hit);
} else if (thread_local_.last_step_action_ != StepNone) {
// Hold on to last step action as it is cleared by the call to
// ClearStepping.
StepAction step_action = thread_local_.last_step_action_;
int step_count = thread_local_.step_count_;
// Clear all current stepping setup.
ClearStepping();
// Set up for the remaining steps.
PrepareStep(step_action, step_count);
}
// Install jump to the call address which was overwritten.
SetAfterBreakTarget(frame);
return Heap::undefined_value();
}
// Check the break point objects for whether one or more are actually
// triggered. This function returns a JSArray with the break point objects
// which is triggered.
Handle<Object> Debug::CheckBreakPoints(Handle<Object> break_point_objects) {
int break_points_hit_count = 0;
Handle<JSArray> break_points_hit = Factory::NewJSArray(1);
// If there are multiple break points they are in a FixedArray.
ASSERT(!break_point_objects->IsUndefined());
if (break_point_objects->IsFixedArray()) {
Handle<FixedArray> array(FixedArray::cast(*break_point_objects));
for (int i = 0; i < array->length(); i++) {
Handle<Object> o(array->get(i));
if (CheckBreakPoint(o)) {
break_points_hit->SetElement(break_points_hit_count++, *o);
}
}
} else {
if (CheckBreakPoint(break_point_objects)) {
break_points_hit->SetElement(break_points_hit_count++,
*break_point_objects);
}
}
// Return undefined if no break points where triggered.
if (break_points_hit_count == 0) {
return Factory::undefined_value();
}
return break_points_hit;
}
// Check whether a single break point object is triggered.
bool Debug::CheckBreakPoint(Handle<Object> break_point_object) {
// Ignore check if break point object is not a JSObject.
if (!break_point_object->IsJSObject()) return true;
// Get the function CheckBreakPoint (defined in debug.js).
Handle<JSFunction> check_break_point =
Handle<JSFunction>(JSFunction::cast(
debug_context()->global()->GetProperty(
*Factory::LookupAsciiSymbol("IsBreakPointTriggered"))));
// Get the break id as an object.
Handle<Object> break_id = Factory::NewNumberFromInt(Top::break_id());
// Call HandleBreakPointx.
bool caught_exception = false;
const int argc = 2;
Object** argv[argc] = {
break_id.location(),
reinterpret_cast<Object**>(break_point_object.location())
};
Handle<Object> result = Execution::TryCall(check_break_point,
Top::builtins(), argc, argv,
&caught_exception);
// If exception or non boolean result handle as not triggered
if (caught_exception || !result->IsBoolean()) {
return false;
}
// Return whether the break point is triggered.
return *result == Heap::true_value();
}
// Check whether the function has debug information.
bool Debug::HasDebugInfo(Handle<SharedFunctionInfo> shared) {
return !shared->debug_info()->IsUndefined();
}
// Return the debug info for this function. EnsureDebugInfo must be called
// prior to ensure the debug info has been generated for shared.
Handle<DebugInfo> Debug::GetDebugInfo(Handle<SharedFunctionInfo> shared) {
ASSERT(HasDebugInfo(shared));
return Handle<DebugInfo>(DebugInfo::cast(shared->debug_info()));
}
void Debug::SetBreakPoint(Handle<SharedFunctionInfo> shared,
int source_position,
Handle<Object> break_point_object) {
if (!EnsureDebugInfo(shared)) {
// Return if retrieving debug info failed.
return;
}
Handle<DebugInfo> debug_info = GetDebugInfo(shared);
// Source positions starts with zero.
ASSERT(source_position >= 0);
// Find the break point and change it.
BreakLocationIterator it(debug_info, SOURCE_BREAK_LOCATIONS);
it.FindBreakLocationFromPosition(source_position);
it.SetBreakPoint(break_point_object);
// At least one active break point now.
ASSERT(debug_info->GetBreakPointCount() > 0);
}
void Debug::ClearBreakPoint(Handle<Object> break_point_object) {
DebugInfoListNode* node = debug_info_list_;
while (node != NULL) {
Object* result = DebugInfo::FindBreakPointInfo(node->debug_info(),
break_point_object);
if (!result->IsUndefined()) {
// Get information in the break point.
BreakPointInfo* break_point_info = BreakPointInfo::cast(result);
Handle<DebugInfo> debug_info = node->debug_info();
Handle<SharedFunctionInfo> shared(debug_info->shared());
int source_position = break_point_info->statement_position()->value();
// Source positions starts with zero.
ASSERT(source_position >= 0);
// Find the break point and clear it.
BreakLocationIterator it(debug_info, SOURCE_BREAK_LOCATIONS);
it.FindBreakLocationFromPosition(source_position);
it.ClearBreakPoint(break_point_object);
// If there are no more break points left remove the debug info for this
// function.
if (debug_info->GetBreakPointCount() == 0) {
RemoveDebugInfo(debug_info);
}
return;
}
node = node->next();
}
}
void Debug::FloodWithOneShot(Handle<SharedFunctionInfo> shared) {
// Make sure the function has setup the debug info.
if (!EnsureDebugInfo(shared)) {
// Return if we failed to retrieve the debug info.
return;
}
// Flood the function with break points.
BreakLocationIterator it(GetDebugInfo(shared), ALL_BREAK_LOCATIONS);
while (!it.Done()) {
it.SetOneShot();
it.Next();
}
}
void Debug::FloodHandlerWithOneShot() {
StackFrame::Id id = Top::break_frame_id();
for (JavaScriptFrameIterator it(id); !it.done(); it.Advance()) {
JavaScriptFrame* frame = it.frame();
if (frame->HasHandler()) {
Handle<SharedFunctionInfo> shared =
Handle<SharedFunctionInfo>(
JSFunction::cast(frame->function())->shared());
// Flood the function with the catch block with break points
FloodWithOneShot(shared);
return;
}
}
}
void Debug::ChangeBreakOnException(ExceptionBreakType type, bool enable) {
if (type == BreakUncaughtException) {
break_on_uncaught_exception_ = enable;
} else {
break_on_exception_ = enable;
}
}
void Debug::PrepareStep(StepAction step_action, int step_count) {
HandleScope scope;
ASSERT(Debug::InDebugger());
// Remember this step action and count.
thread_local_.last_step_action_ = step_action;
thread_local_.step_count_ = step_count;
// Get the frame where the execution has stopped and skip the debug frame if
// any. The debug frame will only be present if execution was stopped due to
// hitting a break point. In other situations (e.g. unhandled exception) the
// debug frame is not present.
StackFrame::Id id = Top::break_frame_id();
JavaScriptFrameIterator frames_it(id);
JavaScriptFrame* frame = frames_it.frame();
// First of all ensure there is one-shot break points in the top handler
// if any.
FloodHandlerWithOneShot();
// If the function on the top frame is unresolved perform step out. This will
// be the case when calling unknown functions and having the debugger stopped
// in an unhandled exception.
if (!frame->function()->IsJSFunction()) {
// Step out: Find the calling JavaScript frame and flood it with
// breakpoints.
frames_it.Advance();
// Fill the function to return to with one-shot break points.
JSFunction* function = JSFunction::cast(frames_it.frame()->function());
FloodWithOneShot(Handle<SharedFunctionInfo>(function->shared()));
return;
}
// Get the debug info (create it if it does not exist).
Handle<SharedFunctionInfo> shared =
Handle<SharedFunctionInfo>(JSFunction::cast(frame->function())->shared());
if (!EnsureDebugInfo(shared)) {
// Return if ensuring debug info failed.
return;
}
Handle<DebugInfo> debug_info = GetDebugInfo(shared);
// Find the break location where execution has stopped.
BreakLocationIterator it(debug_info, ALL_BREAK_LOCATIONS);
it.FindBreakLocationFromAddress(frame->pc());
// Compute whether or not the target is a call target.
bool is_call_target = false;
if (RelocInfo::IsCodeTarget(it.rinfo()->rmode())) {
Address target = it.rinfo()->target_address();
Code* code = Debug::GetCodeTarget(target);
if (code->is_call_stub()) is_call_target = true;
}
// If this is the last break code target step out is the only possibility.
if (it.IsExit() || step_action == StepOut) {
// Step out: If there is a JavaScript caller frame, we need to
// flood it with breakpoints.
frames_it.Advance();
if (!frames_it.done()) {
// Fill the function to return to with one-shot break points.
JSFunction* function = JSFunction::cast(frames_it.frame()->function());
FloodWithOneShot(Handle<SharedFunctionInfo>(function->shared()));
}
} else if (!(is_call_target || RelocInfo::IsConstructCall(it.rmode())) ||
step_action == StepNext || step_action == StepMin) {
// Step next or step min.
// Fill the current function with one-shot break points.
FloodWithOneShot(shared);
// Remember source position and frame to handle step next.
thread_local_.last_statement_position_ =
debug_info->code()->SourceStatementPosition(frame->pc());
thread_local_.last_fp_ = frame->fp();
} else {
// Fill the current function with one-shot break points even for step in on
// a call target as the function called might be a native function for
// which step in will not stop.
FloodWithOneShot(shared);
// Step in or Step in min
it.PrepareStepIn();
ActivateStepIn(frame);
}
}
// Check whether the current debug break should be reported to the debugger. It
// is used to have step next and step in only report break back to the debugger
// if on a different frame or in a different statement. In some situations
// there will be several break points in the same statement when the code is
// flooded with one-shot break points. This function helps to perform several
// steps before reporting break back to the debugger.
bool Debug::StepNextContinue(BreakLocationIterator* break_location_iterator,
JavaScriptFrame* frame) {
// If the step last action was step next or step in make sure that a new
// statement is hit.
if (thread_local_.last_step_action_ == StepNext ||
thread_local_.last_step_action_ == StepIn) {
// Never continue if returning from function.
if (break_location_iterator->IsExit()) return false;
// Continue if we are still on the same frame and in the same statement.
int current_statement_position =
break_location_iterator->code()->SourceStatementPosition(frame->pc());
return thread_local_.last_fp_ == frame->fp() &&
thread_local_.last_statement_position_ == current_statement_position;
}
// No step next action - don't continue.
return false;
}
// Check whether the code object at the specified address is a debug break code
// object.
bool Debug::IsDebugBreak(Address addr) {
Code* code = GetCodeTarget(addr);
return code->ic_state() == DEBUG_BREAK;
}
// Check whether a code stub with the specified major key is a possible break
// point location when looking for source break locations.
bool Debug::IsSourceBreakStub(Code* code) {
CodeStub::Major major_key = code->major_key();
return major_key == CodeStub::CallFunction;
}
// Check whether a code stub with the specified major key is a possible break
// location.
bool Debug::IsBreakStub(Code* code) {
CodeStub::Major major_key = code->major_key();
return major_key == CodeStub::CallFunction ||
major_key == CodeStub::StackCheck;
}
// Find the builtin to use for invoking the debug break
Handle<Code> Debug::FindDebugBreak(RelocInfo* rinfo) {
// Find the builtin debug break function matching the calling convention
// used by the call site.
RelocInfo::Mode mode = rinfo->rmode();
if (RelocInfo::IsCodeTarget(mode)) {
Address target = rinfo->target_address();
Code* code = Debug::GetCodeTarget(target);
if (code->is_inline_cache_stub()) {
if (code->is_call_stub()) {
return ComputeCallDebugBreak(code->arguments_count());
}
if (code->is_load_stub()) {
return Handle<Code>(Builtins::builtin(Builtins::LoadIC_DebugBreak));
}
if (code->is_store_stub()) {
return Handle<Code>(Builtins::builtin(Builtins::StoreIC_DebugBreak));
}
if (code->is_keyed_load_stub()) {
Handle<Code> result =
Handle<Code>(Builtins::builtin(Builtins::KeyedLoadIC_DebugBreak));
return result;
}
if (code->is_keyed_store_stub()) {
Handle<Code> result =
Handle<Code>(Builtins::builtin(Builtins::KeyedStoreIC_DebugBreak));
return result;
}
}
if (RelocInfo::IsConstructCall(mode)) {
Handle<Code> result =
Handle<Code>(Builtins::builtin(Builtins::ConstructCall_DebugBreak));
return result;
}
if (code->kind() == Code::STUB) {
ASSERT(code->major_key() == CodeStub::CallFunction ||
code->major_key() == CodeStub::StackCheck);
Handle<Code> result =
Handle<Code>(Builtins::builtin(Builtins::StubNoRegisters_DebugBreak));
return result;
}
}
UNREACHABLE();
return Handle<Code>::null();
}
// Simple function for returning the source positions for active break points.
Handle<Object> Debug::GetSourceBreakLocations(
Handle<SharedFunctionInfo> shared) {
if (!HasDebugInfo(shared)) return Handle<Object>(Heap::undefined_value());
Handle<DebugInfo> debug_info = GetDebugInfo(shared);
if (debug_info->GetBreakPointCount() == 0) {
return Handle<Object>(Heap::undefined_value());
}
Handle<FixedArray> locations =
Factory::NewFixedArray(debug_info->GetBreakPointCount());
int count = 0;
for (int i = 0; i < debug_info->break_points()->length(); i++) {
if (!debug_info->break_points()->get(i)->IsUndefined()) {
BreakPointInfo* break_point_info =
BreakPointInfo::cast(debug_info->break_points()->get(i));
if (break_point_info->GetBreakPointCount() > 0) {
locations->set(count++, break_point_info->statement_position());
}
}
}
return locations;
}
void Debug::ClearStepping() {
// Clear the various stepping setup.
ClearOneShot();
ClearStepIn();
ClearStepNext();
// Clear multiple step counter.
thread_local_.step_count_ = 0;
}
// Clears all the one-shot break points that are currently set. Normally this
// function is called each time a break point is hit as one shot break points
// are used to support stepping.
void Debug::ClearOneShot() {
// The current implementation just runs through all the breakpoints. When the
// last break point for a function is removed that function is automatically
// removed from the list.
DebugInfoListNode* node = debug_info_list_;
while (node != NULL) {
BreakLocationIterator it(node->debug_info(), ALL_BREAK_LOCATIONS);
while (!it.Done()) {
it.ClearOneShot();
it.Next();
}
node = node->next();
}
}
void Debug::ActivateStepIn(StackFrame* frame) {
thread_local_.step_into_fp_ = frame->fp();
}
void Debug::ClearStepIn() {
thread_local_.step_into_fp_ = 0;
}
void Debug::ClearStepNext() {
thread_local_.last_step_action_ = StepNone;
thread_local_.last_statement_position_ = RelocInfo::kNoPosition;
thread_local_.last_fp_ = 0;
}
bool Debug::EnsureCompiled(Handle<SharedFunctionInfo> shared) {
if (shared->is_compiled()) return true;
return CompileLazyShared(shared, CLEAR_EXCEPTION);
}
// Ensures the debug information is present for shared.
bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared) {
// Return if we already have the debug info for shared.
if (HasDebugInfo(shared)) return true;
// Ensure shared in compiled. Return false if this failed.
if (!EnsureCompiled(shared)) return false;
// Create the debug info object.
Handle<DebugInfo> debug_info = Factory::NewDebugInfo(shared);
// Add debug info to the list.
DebugInfoListNode* node = new DebugInfoListNode(*debug_info);
node->set_next(debug_info_list_);
debug_info_list_ = node;
// Now there is at least one break point.
has_break_points_ = true;
return true;
}
void Debug::RemoveDebugInfo(Handle<DebugInfo> debug_info) {
ASSERT(debug_info_list_ != NULL);
// Run through the debug info objects to find this one and remove it.
DebugInfoListNode* prev = NULL;
DebugInfoListNode* current = debug_info_list_;
while (current != NULL) {
if (*current->debug_info() == *debug_info) {
// Unlink from list. If prev is NULL we are looking at the first element.
if (prev == NULL) {
debug_info_list_ = current->next();
} else {
prev->set_next(current->next());
}
current->debug_info()->shared()->set_debug_info(Heap::undefined_value());
delete current;
// If there are no more debug info objects there are not more break
// points.
has_break_points_ = debug_info_list_ != NULL;
return;
}
// Move to next in list.
prev = current;
current = current->next();
}
UNREACHABLE();
}
void Debug::SetAfterBreakTarget(JavaScriptFrame* frame) {
// Get the executing function in which the debug break occurred.
Handle<SharedFunctionInfo> shared =
Handle<SharedFunctionInfo>(JSFunction::cast(frame->function())->shared());
if (!EnsureDebugInfo(shared)) {
// Return if we failed to retrieve the debug info.
return;
}
Handle<DebugInfo> debug_info = GetDebugInfo(shared);
Handle<Code> code(debug_info->code());
Handle<Code> original_code(debug_info->original_code());
#ifdef DEBUG
// Get the code which is actually executing.
Handle<Code> frame_code(frame->FindCode());
ASSERT(frame_code.is_identical_to(code));
#endif
// Find the call address in the running code. This address holds the call to
// either a DebugBreakXXX or to the debug break return entry code if the
// break point is still active after processing the break point.
Address addr = frame->pc() - Assembler::kTargetAddrToReturnAddrDist;
// Check if the location is at JS exit.
bool at_js_exit = false;
RelocIterator it(debug_info->code());
while (!it.done()) {
if (RelocInfo::IsJSReturn(it.rinfo()->rmode())) {
at_js_exit = it.rinfo()->pc() == addr - 1;
}
it.next();
}
// Handle the jump to continue execution after break point depending on the
// break location.
if (at_js_exit) {
// First check if the call in the code is still the debug break return
// entry code. If it is the break point is still active. If not the break
// point was removed during break point processing.
if (Assembler::target_address_at(addr) ==
debug_break_return_entry()->entry()) {
// Break point still active. Jump to the corresponding place in the
// original code.
addr += original_code->instruction_start() - code->instruction_start();
}
// Move one byte back to where the call instruction was placed.
thread_local_.after_break_target_ = addr - 1;
} else {
// Check if there still is a debug break call at the target address. If the
// break point has been removed it will have disappeared. If it have
// disappeared don't try to look in the original code as the running code
// will have the right address. This takes care of the case where the last
// break point is removed from the function and therefore no "original code"
// is available. If the debug break call is still there find the address in
// the original code.
if (IsDebugBreak(Assembler::target_address_at(addr))) {
// If the break point is still there find the call address which was
// overwritten in the original code by the call to DebugBreakXXX.
// Find the corresponding address in the original code.
addr += original_code->instruction_start() - code->instruction_start();
}
// Install jump to the call address in the original code. This will be the
// call which was overwritten by the call to DebugBreakXXX.
thread_local_.after_break_target_ = Assembler::target_address_at(addr);
}
}
Code* Debug::GetCodeTarget(Address target) {
// Maybe this can be refactored with the stuff in ic-inl.h?
Code* result =
Code::cast(HeapObject::FromAddress(target - Code::kHeaderSize));
return result;
}
bool Debug::IsDebugGlobal(GlobalObject* global) {
return IsLoaded() && global == Debug::debug_context()->global();
}
bool Debugger::debugger_active_ = false;
bool Debugger::compiling_natives_ = false;
bool Debugger::is_loading_debugger_ = false;
DebugMessageThread* Debugger::message_thread_ = NULL;
v8::DebugMessageHandler Debugger::debug_message_handler_ = NULL;
void* Debugger::debug_message_handler_data_ = NULL;
Handle<Object> Debugger::MakeJSObject(Vector<const char> constructor_name,
int argc, Object*** argv,
bool* caught_exception) {
ASSERT(Top::context() == *Debug::debug_context());
// Create the execution state object.
Handle<String> constructor_str = Factory::LookupSymbol(constructor_name);
Handle<Object> constructor(Top::global()->GetProperty(*constructor_str));
ASSERT(constructor->IsJSFunction());
if (!constructor->IsJSFunction()) {
*caught_exception = true;
return Factory::undefined_value();
}
Handle<Object> js_object = Execution::TryCall(
Handle<JSFunction>::cast(constructor),
Handle<JSObject>(Debug::debug_context()->global()), argc, argv,
caught_exception);
return js_object;
}
Handle<Object> Debugger::MakeExecutionState(bool* caught_exception) {
// Create the execution state object.
Handle<Object> break_id = Factory::NewNumberFromInt(Top::break_id());
const int argc = 1;
Object** argv[argc] = { break_id.location() };
return MakeJSObject(CStrVector("MakeExecutionState"),
argc, argv, caught_exception);
}
Handle<Object> Debugger::MakeBreakEvent(Handle<Object> exec_state,
Handle<Object> break_points_hit,
bool* caught_exception) {
// Create the new break event object.
const int argc = 2;
Object** argv[argc] = { exec_state.location(),
break_points_hit.location() };
return MakeJSObject(CStrVector("MakeBreakEvent"),
argc,
argv,
caught_exception);
}
Handle<Object> Debugger::MakeExceptionEvent(Handle<Object> exec_state,
Handle<Object> exception,
bool uncaught,
bool* caught_exception) {
// Create the new exception event object.
const int argc = 3;
Object** argv[argc] = { exec_state.location(),
exception.location(),
uncaught ? Factory::true_value().location() :
Factory::false_value().location()};
return MakeJSObject(CStrVector("MakeExceptionEvent"),
argc, argv, caught_exception);
}
Handle<Object> Debugger::MakeNewFunctionEvent(Handle<Object> function,
bool* caught_exception) {
// Create the new function event object.
const int argc = 1;
Object** argv[argc] = { function.location() };
return MakeJSObject(CStrVector("MakeNewFunctionEvent"),
argc, argv, caught_exception);
}
Handle<Object> Debugger::MakeCompileEvent(Handle<Script> script,
Handle<Object> script_function,
bool* caught_exception) {
// Create the compile event object.
Handle<Object> exec_state = MakeExecutionState(caught_exception);
Handle<Object> script_source(script->source());
Handle<Object> script_name(script->name());
const int argc = 3;
Object** argv[argc] = { script_source.location(),
script_name.location(),
script_function.location() };
return MakeJSObject(CStrVector("MakeCompileEvent"),
argc,
argv,
caught_exception);
}
Handle<String> Debugger::ProcessRequest(Handle<Object> exec_state,
Handle<Object> request,
bool stopped) {
// Get the function ProcessDebugRequest (declared in debug.js).
Handle<JSFunction> process_denbug_request =
Handle<JSFunction>(JSFunction::cast(
Debug::debug_context()->global()->GetProperty(
*Factory::LookupAsciiSymbol("ProcessDebugRequest"))));
// Call ProcessDebugRequest expect String result. The ProcessDebugRequest
// will never throw an exception (see debug.js).
bool caught_exception;
const int argc = 3;
Object** argv[argc] = { exec_state.location(),
request.location(),
stopped ? Factory::true_value().location() :
Factory::false_value().location()};
Handle<Object> result = Execution::TryCall(process_denbug_request,
Factory::undefined_value(),
argc, argv,
&caught_exception);
if (caught_exception) {
return Factory::empty_symbol();
}
return Handle<String>::cast(result);
}
void Debugger::OnException(Handle<Object> exception, bool uncaught) {
HandleScope scope;
// Bail out based on state or if there is no listener for this event
if (Debug::InDebugger()) return;
if (!Debugger::EventActive(v8::Exception)) return;
// Bail out if exception breaks are not active
if (uncaught) {
// Uncaught exceptions are reported by either flags.
if (!(Debug::break_on_uncaught_exception() ||
Debug::break_on_exception())) return;
} else {
// Caught exceptions are reported is activated.
if (!Debug::break_on_exception()) return;
}
// Enter the debugger. Bail out if the debugger cannot be loaded.
if (!Debug::Load()) return;
SaveBreakFrame save;
EnterDebuggerContext enter;
// Clear all current stepping setup.
Debug::ClearStepping();
// Create the event data object.
bool caught_exception = false;
Handle<Object> exec_state = MakeExecutionState(&caught_exception);
Handle<Object> event_data;
if (!caught_exception) {
event_data = MakeExceptionEvent(exec_state, exception, uncaught,
&caught_exception);
}
// Bail out and don't call debugger if exception.
if (caught_exception) {
return;
}
// Process debug event
ProcessDebugEvent(v8::Exception, event_data);
// Return to continue execution from where the exception was thrown.
}
void Debugger::OnDebugBreak(Handle<Object> break_points_hit) {
HandleScope scope;
// Debugger has already been entered by caller.
ASSERT(Top::context() == *Debug::debug_context());
// Bail out if there is no listener for this event
if (!Debugger::EventActive(v8::Break)) return;
// Debugger must be entered in advance.
ASSERT(Top::context() == *Debug::debug_context());
// Create the event data object.
bool caught_exception = false;
Handle<Object> exec_state = MakeExecutionState(&caught_exception);
Handle<Object> event_data;
if (!caught_exception) {
event_data = MakeBreakEvent(exec_state, break_points_hit,
&caught_exception);
}
// Bail out and don't call debugger if exception.
if (caught_exception) {
return;
}
// Process debug event
ProcessDebugEvent(v8::Break, event_data);
}
void Debugger::OnBeforeCompile(Handle<Script> script) {
HandleScope scope;
// Bail out based on state or if there is no listener for this event
if (Debug::InDebugger()) return;
if (compiling_natives()) return;
if (!EventActive(v8::BeforeCompile)) return;
// Enter the debugger. Bail out if the debugger cannot be loaded.
if (!Debug::Load()) return;
SaveBreakFrame save;
EnterDebuggerContext enter;
// Create the event data object.
bool caught_exception = false;
Handle<Object> event_data = MakeCompileEvent(script,
Factory::undefined_value(),
&caught_exception);
// Bail out and don't call debugger if exception.
if (caught_exception) {
return;
}
// Process debug event
ProcessDebugEvent(v8::BeforeCompile, event_data);
}
// Handle debugger actions when a new script is compiled.
void Debugger::OnAfterCompile(Handle<Script> script, Handle<JSFunction> fun) {
HandleScope scope;
// No compile events while compiling natives.
if (compiling_natives()) return;
// No more to do if not debugging.
if (!debugger_active()) return;
// Enter the debugger. Bail out if the debugger cannot be loaded.
if (!Debug::Load()) return;
SaveBreakFrame save;
EnterDebuggerContext enter;
// If debugging there might be script break points registered for this
// script. Make sure that these break points are set.
// Get the function UpdateScriptBreakPoints (defined in debug-delay.js).
Handle<Object> update_script_break_points =
Handle<Object>(Debug::debug_context()->global()->GetProperty(
*Factory::LookupAsciiSymbol("UpdateScriptBreakPoints")));
if (!update_script_break_points->IsJSFunction()) {
return;
}
ASSERT(update_script_break_points->IsJSFunction());
// Wrap the script object in a proper JS object before passing it
// to JavaScript.
Handle<JSValue> wrapper = GetScriptWrapper(script);
// Call UpdateScriptBreakPoints expect no exceptions.
bool caught_exception = false;
const int argc = 1;
Object** argv[argc] = { reinterpret_cast<Object**>(wrapper.location()) };
Handle<Object> result = Execution::TryCall(
Handle<JSFunction>::cast(update_script_break_points),
Top::builtins(), argc, argv,
&caught_exception);
if (caught_exception) {
return;
}
// Bail out based on state or if there is no listener for this event
if (Debug::InDebugger()) return;
if (!Debugger::EventActive(v8::AfterCompile)) return;
// Create the compile state object.
Handle<Object> event_data = MakeCompileEvent(script,
Factory::undefined_value(),
&caught_exception);
// Bail out and don't call debugger if exception.
if (caught_exception) {
return;
}
// Process debug event
ProcessDebugEvent(v8::AfterCompile, event_data);
}
void Debugger::OnNewFunction(Handle<JSFunction> function) {
return;
HandleScope scope;
// Bail out based on state or if there is no listener for this event
if (Debug::InDebugger()) return;
if (compiling_natives()) return;
if (!Debugger::EventActive(v8::NewFunction)) return;
// Enter the debugger. Bail out if the debugger cannot be loaded.
if (!Debug::Load()) return;
SaveBreakFrame save;
EnterDebuggerContext enter;
// Create the event object.
bool caught_exception = false;
Handle<Object> event_data = MakeNewFunctionEvent(function, &caught_exception);
// Bail out and don't call debugger if exception.
if (caught_exception) {
return;
}
// Process debug event.
ProcessDebugEvent(v8::NewFunction, event_data);
}
void Debugger::ProcessDebugEvent(v8::DebugEvent event,
Handle<Object> event_data) {
// Create the execution state.
bool caught_exception = false;
Handle<Object> exec_state = MakeExecutionState(&caught_exception);
if (caught_exception) {
return;
}
// First notify the builtin debugger.
if (message_thread_ != NULL) {
message_thread_->DebugEvent(event, exec_state, event_data);
}
// Notify registered debug event listeners. The list can contain both C and
// JavaScript functions.
v8::NeanderArray listeners(Factory::debug_event_listeners());
int length = listeners.length();
for (int i = 0; i < length; i++) {
if (listeners.get(i)->IsUndefined()) continue; // Skip deleted ones.
v8::NeanderObject listener(JSObject::cast(listeners.get(i)));
Handle<Object> callback_data(listener.get(1));
if (listener.get(0)->IsProxy()) {
// C debug event listener.
Handle<Proxy> callback_obj(Proxy::cast(listener.get(0)));
v8::DebugEventCallback callback =
FUNCTION_CAST<v8::DebugEventCallback>(callback_obj->proxy());
callback(event,
v8::Utils::ToLocal(Handle<JSObject>::cast(exec_state)),
v8::Utils::ToLocal(Handle<JSObject>::cast(event_data)),
v8::Utils::ToLocal(callback_data));
} else {
// JavaScript debug event listener.
ASSERT(listener.get(0)->IsJSFunction());
Handle<JSFunction> fun(JSFunction::cast(listener.get(0)));
// Invoke the JavaScript debug event listener.
const int argc = 4;
Object** argv[argc] = { Handle<Object>(Smi::FromInt(event)).location(),
exec_state.location(),
event_data.location(),
callback_data.location() };
Handle<Object> result = Execution::TryCall(fun, Top::global(),
argc, argv, &caught_exception);
if (caught_exception) {
// Silently ignore exceptions from debug event listeners.
}
}
}
}
void Debugger::SetMessageHandler(v8::DebugMessageHandler handler, void* data) {
debug_message_handler_ = handler;
debug_message_handler_data_ = data;
if (!message_thread_) {
message_thread_ = new DebugMessageThread();
message_thread_->Start();
}
UpdateActiveDebugger();
}
// Posts an output message from the debugger to the debug_message_handler
// callback. This callback is part of the public API. Messages are
// kept internally as Vector<uint16_t> strings, which are allocated in various
// places and deallocated by the calling function sometime after this call.
void Debugger::SendMessage(Vector< uint16_t> message) {
if (debug_message_handler_ != NULL) {
debug_message_handler_(message.start(), message.length(),
debug_message_handler_data_);
}
}
void Debugger::ProcessCommand(Vector<const uint16_t> command) {
if (message_thread_ != NULL) {
message_thread_->ProcessCommand(
Vector<uint16_t>(const_cast<uint16_t *>(command.start()),
command.length()));
}
}
void Debugger::UpdateActiveDebugger() {
v8::NeanderArray listeners(Factory::debug_event_listeners());
int length = listeners.length();
bool active_listener = false;
for (int i = 0; i < length && !active_listener; i++) {
active_listener = !listeners.get(i)->IsUndefined();
}
set_debugger_active((Debugger::message_thread_ != NULL &&
Debugger::debug_message_handler_ != NULL) ||
active_listener);
if (!debugger_active() && message_thread_)
message_thread_->OnDebuggerInactive();
}
DebugMessageThread::DebugMessageThread()
: host_running_(true),
command_queue_(kQueueInitialSize),
message_queue_(kQueueInitialSize) {
command_received_ = OS::CreateSemaphore(0);
message_received_ = OS::CreateSemaphore(0);
}
// Does not free resources held by DebugMessageThread
// because this cannot be done thread-safely.
DebugMessageThread::~DebugMessageThread() {
}
// Puts an event coming from V8 on the queue. Creates
// a copy of the JSON formatted event string managed by the V8.
// Called by the V8 thread.
// The new copy of the event string is destroyed in Run().
void DebugMessageThread::SendMessage(Vector<uint16_t> message) {
Vector<uint16_t> message_copy = message.Clone();
Logger::DebugTag("Put message on event message_queue.");
message_queue_.Put(message_copy);
message_received_->Signal();
}
void DebugMessageThread::SetEventJSONFromEvent(Handle<Object> event_data) {
v8::HandleScope scope;
// Call toJSONProtocol on the debug event object.
v8::Local<v8::Object> api_event_data =
v8::Utils::ToLocal(Handle<JSObject>::cast(event_data));
v8::Local<v8::String> fun_name = v8::String::New("toJSONProtocol");
v8::Local<v8::Function> fun =
v8::Function::Cast(*api_event_data->Get(fun_name));
v8::TryCatch try_catch;
v8::Local<v8::Value> json_event = *fun->Call(api_event_data, 0, NULL);
v8::Local<v8::String> json_event_string;
if (!try_catch.HasCaught()) {
if (!json_event->IsUndefined()) {
json_event_string = json_event->ToString();
if (FLAG_trace_debug_json) {
PrintLn(json_event_string);
}
v8::String::Value val(json_event_string);
Vector<uint16_t> str(reinterpret_cast<uint16_t*>(*val),
json_event_string->Length());
SendMessage(str);
} else {
SendMessage(Vector<uint16_t>::empty());
}
} else {
PrintLn(try_catch.Exception());
SendMessage(Vector<uint16_t>::empty());
}
}
void DebugMessageThread::Run() {
// Sends debug events to an installed debugger message callback.
while (true) {
// Wait and Get are paired so that semaphore count equals queue length.
message_received_->Wait();
Logger::DebugTag("Get message from event message_queue.");
Vector<uint16_t> message = message_queue_.Get();
if (message.length() > 0) {
Debugger::SendMessage(message);
}
}
}
// This method is called by the V8 thread whenever a debug event occurs in
// the VM.
void DebugMessageThread::DebugEvent(v8::DebugEvent event,
Handle<Object> exec_state,
Handle<Object> event_data) {
if (!Debug::Load()) return;
// Process the individual events.
bool interactive = false;
switch (event) {
case v8::Break:
interactive = true; // Break event is always interactive
break;
case v8::Exception:
interactive = true; // Exception event is always interactive
break;
case v8::BeforeCompile:
break;
case v8::AfterCompile:
break;
case v8::NewFunction:
break;
default:
UNREACHABLE();
}
// Done if not interactive.
if (!interactive) return;
// Get the DebugCommandProcessor.
v8::Local<v8::Object> api_exec_state =
v8::Utils::ToLocal(Handle<JSObject>::cast(exec_state));
v8::Local<v8::String> fun_name =
v8::String::New("debugCommandProcessor");
v8::Local<v8::Function> fun =
v8::Function::Cast(*api_exec_state->Get(fun_name));
v8::TryCatch try_catch;
v8::Local<v8::Object> cmd_processor =
v8::Object::Cast(*fun->Call(api_exec_state, 0, NULL));
if (try_catch.HasCaught()) {
PrintLn(try_catch.Exception());
return;
}
// Notify the debugger that a debug event has occurred.
host_running_ = false;
SetEventJSONFromEvent(event_data);
// Wait for commands from the debugger.
while (true) {
command_received_->Wait();
Logger::DebugTag("Get command from command queue, in interactive loop.");
Vector<uint16_t> command = command_queue_.Get();
ASSERT(!host_running_);
if (!Debugger::debugger_active()) {
host_running_ = true;
return;
}
// Invoke the JavaScript to convert the debug command line to a JSON
// request, invoke the JSON request and convert the JSON response to a text
// representation.
v8::Local<v8::String> fun_name;
v8::Local<v8::Function> fun;
v8::Local<v8::Value> args[1];
v8::TryCatch try_catch;
fun_name = v8::String::New("processDebugCommand");
fun = v8::Function::Cast(*cmd_processor->Get(fun_name));
args[0] = v8::String::New(reinterpret_cast<uint16_t*>(command.start()),
command.length());
v8::Local<v8::Value> result_val = fun->Call(cmd_processor, 1, args);
// Get the result of the command.
v8::Local<v8::String> result_string;
bool running = false;
if (!try_catch.HasCaught()) {
// Get the result as an object.
v8::Local<v8::Object> result = v8::Object::Cast(*result_val);
// Log the JSON request/response.
if (FLAG_trace_debug_json) {
PrintLn(result->Get(v8::String::New("request")));
PrintLn(result->Get(v8::String::New("response")));
}
// Get the running state.
running = result->Get(v8::String::New("running"))->ToBoolean()->Value();
// Get result text.
v8::Local<v8::Value> text_result =
result->Get(v8::String::New("response"));
if (!text_result->IsUndefined()) {
result_string = text_result->ToString();
} else {
result_string = v8::String::New("");
}
} else {
// In case of failure the result text is the exception text.
result_string = try_catch.Exception()->ToString();
}
// Convert text result to C string.
v8::String::Value val(result_string);
Vector<uint16_t> str(reinterpret_cast<uint16_t*>(*val),
result_string->Length());
// Set host_running_ correctly for nested debugger evaluations.
host_running_ = running;
// Return the result.
SendMessage(str);
// Return from debug event processing is VM should be running.
if (running) {
return;
}
}
}
// Puts a command coming from the public API on the queue. Creates
// a copy of the command string managed by the debugger. Up to this
// point, the command data was managed by the API client. Called
// by the API client thread. This is where the API client hands off
// processing of the command to the DebugMessageThread thread.
// The new copy of the command is destroyed in HandleCommand().
void DebugMessageThread::ProcessCommand(Vector<uint16_t> command) {
Vector<uint16_t> command_copy = command.Clone();
Logger::DebugTag("Put command on command_queue.");
command_queue_.Put(command_copy);
command_received_->Signal();
}
void DebugMessageThread::OnDebuggerInactive() {
// Send an empty command to the debugger if in a break to make JavaScript run
// again if the debugger is closed.
if (!host_running_) {
ProcessCommand(Vector<uint16_t>::empty());
}
}
MessageQueue::MessageQueue(int size) : start_(0), end_(0), size_(size) {
messages_ = NewArray<Vector<uint16_t> >(size);
}
MessageQueue::~MessageQueue() {
DeleteArray(messages_);
}
Vector<uint16_t> MessageQueue::Get() {
ASSERT(!IsEmpty());
int result = start_;
start_ = (start_ + 1) % size_;
return messages_[result];
}
void MessageQueue::Put(const Vector<uint16_t>& message) {
if ((end_ + 1) % size_ == start_) {
Expand();
}
messages_[end_] = message;
end_ = (end_ + 1) % size_;
}
void MessageQueue::Expand() {
MessageQueue new_queue(size_ * 2);
while (!IsEmpty()) {
new_queue.Put(Get());
}
Vector<uint16_t>* array_to_free = messages_;
*this = new_queue;
new_queue.messages_ = array_to_free;
// Automatic destructor called on new_queue, freeing array_to_free.
}
LockingMessageQueue::LockingMessageQueue(int size) : queue_(size) {
lock_ = OS::CreateMutex();
}
LockingMessageQueue::~LockingMessageQueue() {
delete lock_;
}
bool LockingMessageQueue::IsEmpty() const {
ScopedLock sl(lock_);
return queue_.IsEmpty();
}
Vector<uint16_t> LockingMessageQueue::Get() {
ScopedLock sl(lock_);
Vector<uint16_t> result = queue_.Get();
Logger::DebugEvent("Get", result);
return result;
}
void LockingMessageQueue::Put(const Vector<uint16_t>& message) {
ScopedLock sl(lock_);
queue_.Put(message);
Logger::DebugEvent("Put", message);
}
void LockingMessageQueue::Clear() {
ScopedLock sl(lock_);
queue_.Clear();
}
} } // namespace v8::internal
| 33.389367 | 80 | 0.681715 | martine |
b6958eef89a7093d2879e57ef381231442a0232b | 10,318 | cpp | C++ | Sources/SolarTears/Rendering/D3D12/D3D12DescriptorCreator.cpp | Sixshaman/SolarTears | 97d07730f876508fce8bf93c9dc90f051c230580 | [
"BSD-3-Clause"
] | 4 | 2021-06-30T16:00:20.000Z | 2021-10-13T06:17:56.000Z | Sources/SolarTears/Rendering/D3D12/D3D12DescriptorCreator.cpp | Sixshaman/SolarTears | 97d07730f876508fce8bf93c9dc90f051c230580 | [
"BSD-3-Clause"
] | null | null | null | Sources/SolarTears/Rendering/D3D12/D3D12DescriptorCreator.cpp | Sixshaman/SolarTears | 97d07730f876508fce8bf93c9dc90f051c230580 | [
"BSD-3-Clause"
] | null | null | null | #include "D3D12DescriptorCreator.hpp"
#include "D3D12SrvDescriptorManager.hpp"
D3D12::DescriptorCreator::DescriptorCreator(FrameGraph* frameGraph, RenderableScene* renderableScene): mFrameGraphToCreateDescriptors(frameGraph), mSceneToMakeDescriptors(renderableScene)
{
mTextureTableRequestState = DescriptorRequestState::NotRequested;
mMaterialDataTableRequestState = DescriptorRequestState::NotRequested;
mFrameDataTableRequestState = DescriptorRequestState::NotRequested;
mObjectDataTableRequestState = DescriptorRequestState::NotRequested;
mTextureDescriptorTableStart = {.ptr = (UINT64)(-1)};
mMaterialDataDescriptorTableStart = {.ptr = (UINT64)(-1)};
mFrameDataDescriptorTableStart = {.ptr = (UINT64)(-1)};
mObjectDataDescriptorTableStart = {.ptr = (UINT64)(-1)};
mSceneDescriptorsCount = 5; //Minimum 1 for each type
mPassDescriptorsCount = 0;
RequestDescriptors();
}
D3D12::DescriptorCreator::~DescriptorCreator()
{
}
UINT D3D12::DescriptorCreator::GetDescriptorCountNeeded()
{
return mSceneDescriptorsCount + mPassDescriptorsCount;
}
void D3D12::DescriptorCreator::RecreateDescriptors(ID3D12Device* device, D3D12_CPU_DESCRIPTOR_HANDLE startDescriptorCpu, D3D12_GPU_DESCRIPTOR_HANDLE startDescriptorGpu)
{
UINT srvDescriptorSize = device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
D3D12_CPU_DESCRIPTOR_HANDLE cpuDescriptorAddress = startDescriptorCpu;
D3D12_GPU_DESCRIPTOR_HANDLE gpuDescriptorAddress = startDescriptorGpu;
RecreateSceneDescriptors(device, cpuDescriptorAddress, gpuDescriptorAddress, srvDescriptorSize);
if(mFrameGraphToCreateDescriptors != nullptr)
{
cpuDescriptorAddress.ptr += mSceneDescriptorsCount * srvDescriptorSize;
gpuDescriptorAddress.ptr += mSceneDescriptorsCount * srvDescriptorSize;
RevalidatePassDescriptors(device, cpuDescriptorAddress, gpuDescriptorAddress);
}
}
void D3D12::DescriptorCreator::RequestDescriptors()
{
mSceneDescriptorsCount = 0;
mPassDescriptorsCount = 0;
if(mFrameGraphToCreateDescriptors != nullptr)
{
for(size_t i = 0; i < mFrameGraphToCreateDescriptors->mRenderPasses.size(); i++)
{
mPassDescriptorsCount += mFrameGraphToCreateDescriptors->mRenderPasses[i]->GetPassDescriptorCountNeeded();
mFrameGraphToCreateDescriptors->mRenderPasses[i]->RequestSceneDescriptors(this);
}
}
if(mTextureTableRequestState != DescriptorRequestState::NotRequested)
{
mSceneDescriptorsCount += std::max((UINT)mSceneToMakeDescriptors->mSceneTextures.size(), 1u);
}
if(mMaterialDataTableRequestState != DescriptorRequestState::NotRequested)
{
mSceneDescriptorsCount += std::max(mSceneToMakeDescriptors->GetMaterialCount(), 1u);
}
if(mFrameDataTableRequestState != DescriptorRequestState::NotRequested)
{
mSceneDescriptorsCount += 1;
}
if(mObjectDataTableRequestState != DescriptorRequestState::NotRequested)
{
uint32_t objectCount = mSceneToMakeDescriptors->GetStaticObjectCount() + mSceneToMakeDescriptors->GetRigidObjectCount();
mSceneDescriptorsCount += std::max(objectCount, 1u);
}
mSceneDescriptorsCount = std::max(mSceneDescriptorsCount, 1u);
}
void D3D12::DescriptorCreator::RecreateSceneDescriptors(ID3D12Device* device, D3D12_CPU_DESCRIPTOR_HANDLE startDescriptorCpu, D3D12_GPU_DESCRIPTOR_HANDLE startDescriptorGpu, UINT descriptorSize)
{
D3D12_CPU_DESCRIPTOR_HANDLE cpuDescriptorAddress = startDescriptorCpu;
D3D12_GPU_DESCRIPTOR_HANDLE gpuDescriptorAddress = startDescriptorGpu;
if(mTextureTableRequestState == DescriptorRequestState::NotYetCreated)
{
mTextureDescriptorTableStart = gpuDescriptorAddress;
if(mSceneToMakeDescriptors->mSceneTextures.size() == 0)
{
D3D12_SHADER_RESOURCE_VIEW_DESC srvDesc;
srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D; //Only 2D-textures are stored in mSceneTextures
srvDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
srvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
srvDesc.Texture2D.MostDetailedMip = 0;
srvDesc.Texture2D.MipLevels = 1;
srvDesc.Texture2D.PlaneSlice = 0;
srvDesc.Texture2D.ResourceMinLODClamp = 0.0f;
device->CreateShaderResourceView(nullptr, nullptr, cpuDescriptorAddress);
cpuDescriptorAddress.ptr += descriptorSize;
gpuDescriptorAddress.ptr += descriptorSize;
}
else
{
for(size_t textureIndex = 0; textureIndex < mSceneToMakeDescriptors->mSceneTextures.size(); textureIndex++)
{
D3D12_SHADER_RESOURCE_VIEW_DESC srvDesc;
srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D; //Only 2D-textures are stored in mSceneTextures
srvDesc.Format = mSceneToMakeDescriptors->mSceneTextures[textureIndex]->GetDesc1().Format;
srvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
srvDesc.Texture2D.MostDetailedMip = 0;
srvDesc.Texture2D.MipLevels = (UINT)-1;
srvDesc.Texture2D.PlaneSlice = 0;
srvDesc.Texture2D.ResourceMinLODClamp = 0.0f;
device->CreateShaderResourceView(mSceneToMakeDescriptors->mSceneTextures[textureIndex].get(), &srvDesc, cpuDescriptorAddress);
cpuDescriptorAddress.ptr += descriptorSize;
gpuDescriptorAddress.ptr += descriptorSize;
}
}
mTextureTableRequestState = DescriptorRequestState::Ready;
}
if(mMaterialDataTableRequestState == DescriptorRequestState::NotYetCreated)
{
uint32_t materialCount = mSceneToMakeDescriptors->GetMaterialCount();
mMaterialDataDescriptorTableStart = gpuDescriptorAddress;
if(materialCount == 0)
{
device->CreateConstantBufferView(nullptr, cpuDescriptorAddress);
cpuDescriptorAddress.ptr += descriptorSize;
gpuDescriptorAddress.ptr += descriptorSize;
}
else
{
for(uint32_t materialIndex = 0; materialIndex < materialCount; materialIndex++)
{
D3D12_CONSTANT_BUFFER_VIEW_DESC cbvDesc;
cbvDesc.BufferLocation = mSceneToMakeDescriptors->GetMaterialDataStart(materialIndex);
cbvDesc.SizeInBytes = mSceneToMakeDescriptors->mMaterialChunkDataSize;
device->CreateConstantBufferView(&cbvDesc, cpuDescriptorAddress);
cpuDescriptorAddress.ptr += descriptorSize;
gpuDescriptorAddress.ptr += descriptorSize;
}
}
mMaterialDataTableRequestState = DescriptorRequestState::Ready;
}
if(mFrameDataTableRequestState == DescriptorRequestState::NotYetCreated)
{
mFrameDataDescriptorTableStart = gpuDescriptorAddress;
D3D12_CONSTANT_BUFFER_VIEW_DESC cbvDesc;
cbvDesc.BufferLocation = mSceneToMakeDescriptors->GetFrameDataStart();
cbvDesc.SizeInBytes = mSceneToMakeDescriptors->mFrameChunkDataSize;
device->CreateConstantBufferView(&cbvDesc, cpuDescriptorAddress);
cpuDescriptorAddress.ptr += descriptorSize;
gpuDescriptorAddress.ptr += descriptorSize;
mFrameDataTableRequestState = DescriptorRequestState::Ready;
}
if(mObjectDataTableRequestState == DescriptorRequestState::NotYetCreated)
{
uint32_t objectCount = mSceneToMakeDescriptors->GetStaticObjectCount() + mSceneToMakeDescriptors->GetRigidObjectCount();
mObjectDataDescriptorTableStart = gpuDescriptorAddress;
if(objectCount == 0)
{
device->CreateConstantBufferView(nullptr, cpuDescriptorAddress);
cpuDescriptorAddress.ptr += descriptorSize;
gpuDescriptorAddress.ptr += descriptorSize;
}
else
{
for(uint32_t objectDataIndex = 0; objectDataIndex < objectCount; objectDataIndex++)
{
D3D12_CONSTANT_BUFFER_VIEW_DESC cbvDesc;
cbvDesc.BufferLocation = mSceneToMakeDescriptors->GetObjectDataStart(objectDataIndex);
cbvDesc.SizeInBytes = mSceneToMakeDescriptors->mObjectChunkDataSize;
device->CreateConstantBufferView(&cbvDesc, cpuDescriptorAddress);
cpuDescriptorAddress.ptr += descriptorSize;
gpuDescriptorAddress.ptr += descriptorSize;
}
}
mObjectDataTableRequestState = DescriptorRequestState::Ready;
}
}
void D3D12::DescriptorCreator::RevalidatePassDescriptors(ID3D12Device* device, D3D12_CPU_DESCRIPTOR_HANDLE startDescriptorCpu, D3D12_GPU_DESCRIPTOR_HANDLE startDescriptorGpu)
{
//Frame graph stores the copy of its descriptors on non-shader-visible heap
if (mPassDescriptorsCount != 0)
{
device->CopyDescriptorsSimple(mPassDescriptorsCount, mFrameGraphToCreateDescriptors->mSrvUavDescriptorHeap->GetCPUDescriptorHandleForHeapStart(), startDescriptorCpu, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
}
for(size_t i = 0; i < mFrameGraphToCreateDescriptors->mRenderPasses.size(); i++)
{
//Frame graph passes will recalculate the new address for descriptors from the old ones
mFrameGraphToCreateDescriptors->mRenderPasses[i]->ValidatePassDescriptors(mFrameGraphToCreateDescriptors->mFrameGraphDescriptorStart, startDescriptorGpu);
mFrameGraphToCreateDescriptors->mRenderPasses[i]->ValidateSceneDescriptors(this);
}
mFrameGraphToCreateDescriptors->mFrameGraphDescriptorStart = startDescriptorGpu;
}
void D3D12::DescriptorCreator::RequestTexturesDescriptorTable()
{
mTextureTableRequestState = DescriptorRequestState::NotYetCreated;
}
void D3D12::DescriptorCreator::RequestMaterialDataDescriptorTable()
{
mMaterialDataTableRequestState = DescriptorRequestState::NotYetCreated;
}
void D3D12::DescriptorCreator::RequestFrameDataDescriptorTable()
{
mFrameDataTableRequestState = DescriptorRequestState::NotYetCreated;
}
void D3D12::DescriptorCreator::RequestObjectDataDescriptorTable()
{
mObjectDataTableRequestState = DescriptorRequestState::NotYetCreated;
}
D3D12_GPU_DESCRIPTOR_HANDLE D3D12::DescriptorCreator::GetTextureDescriptorTableStart() const
{
assert(mTextureTableRequestState == DescriptorRequestState::Ready);
return mTextureDescriptorTableStart;
}
D3D12_GPU_DESCRIPTOR_HANDLE D3D12::DescriptorCreator::GetMaterialDataDescriptorTableStart() const
{
assert(mMaterialDataTableRequestState == DescriptorRequestState::Ready);
return mMaterialDataDescriptorTableStart;
}
D3D12_GPU_DESCRIPTOR_HANDLE D3D12::DescriptorCreator::GetFrameDataDescriptorTableStart() const
{
assert(mFrameDataTableRequestState == DescriptorRequestState::Ready);
return mFrameDataDescriptorTableStart;
}
D3D12_GPU_DESCRIPTOR_HANDLE D3D12::DescriptorCreator::GetObjectDataDescriptorTableStart() const
{
assert(mObjectDataTableRequestState == DescriptorRequestState::Ready);
return mObjectDataDescriptorTableStart;
} | 38.356877 | 208 | 0.804323 | Sixshaman |
b69b33d50d34e906eede8e7ca0ce1a8a7780839b | 697 | hpp | C++ | include/dev/cga_out.hpp | RoseLeBlood/CsOS-i386 | e1b8db4111349c8dfa51aaaa543075f220af50d4 | [
"MIT"
] | 2 | 2017-05-02T13:18:59.000Z | 2020-12-23T03:03:26.000Z | include/dev/cga_out.hpp | RoseLeBlood/CsOS-i386 | e1b8db4111349c8dfa51aaaa543075f220af50d4 | [
"MIT"
] | null | null | null | include/dev/cga_out.hpp | RoseLeBlood/CsOS-i386 | e1b8db4111349c8dfa51aaaa543075f220af50d4 | [
"MIT"
] | null | null | null | #ifndef __DEV_CGA_VIDEO_HPP__
#define __DEV_CGA_VIDEO_HPP__
#include <dev/Driver.hpp>
namespace dev
{
class StdCgaVideo : public Driver
{
public:
StdCgaVideo();
~StdCgaVideo();
virtual bool Probe();
virtual void WriteChar(char c);
virtual void Write(const char* c);
virtual void GotoXY(unsigned short x, unsigned short y);
virtual void Clear();
virtual void TextColor(uint16_t color);
virtual void BackColor(uint16_t color);
virtual uint64_t Read(uint8_t *data, uint64_t offset, uint64_t size);
virtual uint64_t Write(uint8_t *data, uint64_t offset, uint64_t size);
protected:
virtual void ScrollUp();
protected:
uint16_t* m_videomem;
};
}
#endif | 20.5 | 72 | 0.728838 | RoseLeBlood |
b6a36e02385f9315db970bbe5c8d09847232dc6e | 1,744 | cpp | C++ | tothemoon.cpp | AlieZ22/DailyRemoval | d7e7713ab462cf4ffc700bc2aec8a8a06645d9de | [
"MIT"
] | 2 | 2021-04-20T03:24:28.000Z | 2021-12-02T04:35:34.000Z | tothemoon.cpp | AlieZ22/DailyRemoval | d7e7713ab462cf4ffc700bc2aec8a8a06645d9de | [
"MIT"
] | null | null | null | tothemoon.cpp | AlieZ22/DailyRemoval | d7e7713ab462cf4ffc700bc2aec8a8a06645d9de | [
"MIT"
] | null | null | null | #define WIDTH_MAP 10
#define HEIGTH_MAP 10
#include<tothemoon.h>
#include<qpainter.h>
#include <QPixmap>
#include<QDebug>
#include<QDialog>
#include "block.h"
#include"map.h"
extern Map m;
void tothemoon::show(QPainter &paint)//显示
{
QPixmap pix;
pix.load(":/images/res/xuekuai.png");
//pix=splitpixmap(pix,6,16,1);
paint.drawPixmap(KUAI_a*stay.X,KUAI_a*stay.Y+50,KUAI_a,KUAI_a,pix);
}
block* tothemoon::clear(int i,int j)
{
if((i>=0)&&(i<=WIDTH_MAP)&&(j>=0)&&(j<=HEIGTH_MAP)&&(m.map[i][j]->color!=-1))
{
m.map[i][j]=m.map[i][j]->clearBlock();
return m.map[i][j];
}
}
tothemoon::tothemoon()
{
this->yidong=1;
}
block * tothemoon::clearBlock()
{
block * t=new kongkuai;
t->setxy(this->stay.X,this->stay.Y);
int i=this->stay.X;
int j=this->stay.Y;
delete this;
m.map[i][j]=t;
if(this->color>=7&&this->color<=12)
{
clear(i,j+1);
clear(i,j-1);
clear(i,j+2);
clear(i,j-2);
clear(i+1,j);
clear(i-1,j);
clear(i+2,j);
clear(i-2,j);
clear(i+1,j+1);
clear(i-1,j-1);
clear(i+1,j-1);
clear(i-1,j+1);
}
else if(this->color>=13&&this->color<=18)
{
for(int m=0;m<WIDTH_MAP;m++)
{
clear(m,j);
}
}
else if(this->color>=19&&this->color<=24)
{
for(int m=0;m<HEIGTH_MAP;m++)
{
clear(i,m);
}
}
else if(this->color==25)
{
for(int m=0;m<WIDTH_MAP;m++)
{
for(int n=0;n<HEIGTH_MAP;n++)
{
clear(m,n);
}
}
}
return t;
}
void tothemoon::setxy(int x,int y)
{
stay.X=x;stay.Y=y;
}
| 16.609524 | 81 | 0.494839 | AlieZ22 |
b6a54b14e7ca7e67b05b5990701a80e12f9dd7eb | 780 | hpp | C++ | modules/core/src/parallel/parallel.hpp | xipingyan/opencv | 39c3334147ec02761b117f180c9c4518be18d1fa | [
"Apache-2.0"
] | 56,632 | 2016-07-04T16:36:08.000Z | 2022-03-31T18:38:14.000Z | modules/core/src/parallel/parallel.hpp | yusufm423/opencv | 6a2077cbd8a8a0d8cbd3e0e8c3ca239f17e6c067 | [
"Apache-2.0"
] | 13,593 | 2016-07-04T13:59:03.000Z | 2022-03-31T21:04:51.000Z | modules/core/src/parallel/parallel.hpp | yusufm423/opencv | 6a2077cbd8a8a0d8cbd3e0e8c3ca239f17e6c067 | [
"Apache-2.0"
] | 54,986 | 2016-07-04T14:24:38.000Z | 2022-03-31T22:51:18.000Z | // This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#ifndef OPENCV_CORE_SRC_PARALLEL_PARALLEL_HPP
#define OPENCV_CORE_SRC_PARALLEL_PARALLEL_HPP
#include "opencv2/core/parallel/parallel_backend.hpp"
namespace cv { namespace parallel {
extern int numThreads;
std::shared_ptr<ParallelForAPI>& getCurrentParallelForAPI();
#ifndef BUILD_PLUGIN
#ifdef HAVE_TBB
std::shared_ptr<cv::parallel::ParallelForAPI> createParallelBackendTBB();
#endif
#ifdef HAVE_OPENMP
std::shared_ptr<cv::parallel::ParallelForAPI> createParallelBackendOpenMP();
#endif
#endif // BUILD_PLUGIN
}} // namespace
#endif // OPENCV_CORE_SRC_PARALLEL_PARALLEL_HPP
| 26 | 90 | 0.802564 | xipingyan |
b6a698eed4dba9d867227a3281b42e4c1cd27f13 | 5,215 | hpp | C++ | se_core/include/se/io/octomap_io_impl.hpp | hexagon-geo-surv/supereight-public | 29a978956d2b169a3f34eed9bc374e325551c10b | [
"MIT"
] | null | null | null | se_core/include/se/io/octomap_io_impl.hpp | hexagon-geo-surv/supereight-public | 29a978956d2b169a3f34eed9bc374e325551c10b | [
"MIT"
] | null | null | null | se_core/include/se/io/octomap_io_impl.hpp | hexagon-geo-surv/supereight-public | 29a978956d2b169a3f34eed9bc374e325551c10b | [
"MIT"
] | null | null | null | // SPDX-FileCopyrightText: 2018-2020 Smart Robotics Lab, Imperial College London
// SPDX-FileCopyrightText: 2018 Nils Funk, ETH Zürich
// SPDX-FileCopyrightText: 2019-2020 Sotiris Papatheodorou, Imperial College London
// SPDX-License-Identifier: BSD-3-Clause
#ifndef __OCTOMAP_IO_IMPL_HPP
#define __OCTOMAP_IO_IMPL_HPP
#if defined(SE_OCTOMAP) && SE_OCTOMAP
#include <cmath>
#include <fstream>
#include <iostream>
#include <Eigen/Dense>
#include <octomap/octomap.h>
template<typename T>
using VoxelBlockType = typename T::VoxelBlockType;
template<typename VoxelT, typename FunctionT>
octomap::OcTree* se::to_octomap(const se::Octree<VoxelT>& octree,
const FunctionT set_node_value) {
// Test if the octree is initialized.
if (octree.size() == 0) {
return nullptr;
}
// supereight map parameters.
const float voxel_dim = octree.dim() / octree.size();
// The sample point of supereight voxels relative to the voxel
// corner closest to the origin. Typically the sample point is
// the voxel centre.
const Eigen::Vector3f se_sample_offset = se::Octree<VoxelT>::sample_offset_frac_;
// The sample point of octomap voxels relative to the voxel
// corner closest to the origin. The sample point is the voxel
// centre.
const Eigen::Vector3f om_sample_offset = Eigen::Vector3f::Constant(0.5f);
// Add this to supereight voxel coordinates to transform them to
// OctoMap voxel coordinates.
const Eigen::Vector3f se_to_om_offset = - se_sample_offset + om_sample_offset;
// Initialize the octomap.
octomap::OcTree* octomap = new octomap::OcTree(voxel_dim);
se::Node<VoxelT>* node_stack[se::Octree<VoxelT>::max_voxel_depth * 8 + 1];
size_t stack_idx = 0;
se::Node<VoxelT>* node = octree.root();
if (node != nullptr) {
se::Node<VoxelT>* current = node;
node_stack[stack_idx++] = current;
while (stack_idx != 0) {
node = current;
if (node->isBlock()) {
const VoxelBlockType<VoxelT>* block
= static_cast<VoxelBlockType <VoxelT>*>(node);
const Eigen::Vector3i block_coord = block->coordinates();
const int block_size = static_cast<int>(VoxelBlockType<VoxelT>::size_li);
const int x_last = block_coord.x() + block_size;
const int y_last = block_coord.y() + block_size;
const int z_last = block_coord.z() + block_size;
for (int z = block_coord.z(); z < z_last; ++z) {
for (int y = block_coord.y(); y < y_last; ++y) {
for (int x = block_coord.x(); x < x_last; ++x) {
const Eigen::Vector3f voxel_coord_eigen
= voxel_dim * (Eigen::Vector3f(x, y, z) + se_to_om_offset);
const octomap::point3d voxel_coord (
voxel_coord_eigen.x(),
voxel_coord_eigen.y(),
voxel_coord_eigen.z());
const typename VoxelT::VoxelData voxel_data
= block->data(Eigen::Vector3i(x, y, z));
set_node_value(*octomap, voxel_coord, voxel_data);
}
}
}
}
if (node->children_mask() == 0) {
current = node_stack[--stack_idx];
continue;
}
for (int child_idx = 0; child_idx < 8; ++child_idx) {
se::Node<VoxelT>* child = node->child(child_idx);
if (child != nullptr) {
node_stack[stack_idx++] = child;
}
}
current = node_stack[--stack_idx];
}
}
// Make the octree consistent at all levels.
octomap->updateInnerOccupancy();
// Combine children with the same values.
octomap->prune();
// Return the pointer.
return octomap;
}
template<typename VoxelT>
octomap::OcTree* se::to_octomap(const se::Octree<VoxelT>& octree) {
// Create a lambda function to set the state of a single voxel.
const auto set_node_value = [](octomap::OcTree& octomap,
const octomap::point3d& voxel_coord,
const typename VoxelT::VoxelData& voxel_data) {
// Just store the log-odds occupancy probability. Do not store log-odds of
// 0 because OctoMap interprets it as occupied, whereas in supereight it
// means unknown.
if (voxel_data.x != 0.f) {
octomap.setNodeValue(voxel_coord, voxel_data.x, true);
}
};
// Convert to OctoMap and return a pointer.
return se::to_octomap(octree, set_node_value);
}
template<typename VoxelT>
octomap::OcTree* se::to_binary_octomap(const se::Octree<VoxelT>& octree) {
// Create a lambda function to set the state of a single voxel.
const auto set_node_value = [](octomap::OcTree& octomap,
const octomap::point3d& voxel_coord,
const typename VoxelT::VoxelData& voxel_data) {
if (voxel_data.x > 0) {
// Occupied
octomap.updateNode(voxel_coord, true, true);
} else if (voxel_data.x < 0) {
// Free
octomap.updateNode(voxel_coord, false, true);
}
// Do not update unknown voxels.
};
// Convert to OctoMap and return a pointer.
return se::to_octomap(octree, set_node_value);
}
#endif
#endif
| 33.429487 | 83 | 0.632215 | hexagon-geo-surv |
b6a82b1e560222979105dfc6b80da5fc28f01b97 | 9,480 | cpp | C++ | Settings.cpp | meowniverse/TetroRythm | eafc18d4ce623438ccd400e276fed0e5b0515bd0 | [
"MIT"
] | null | null | null | Settings.cpp | meowniverse/TetroRythm | eafc18d4ce623438ccd400e276fed0e5b0515bd0 | [
"MIT"
] | null | null | null | Settings.cpp | meowniverse/TetroRythm | eafc18d4ce623438ccd400e276fed0e5b0515bd0 | [
"MIT"
] | null | null | null | #include "Settings.h"
Settings::Settings(Controls_Settings& settings) : settings(settings)
{
font.loadFromFile("Dense-Regular.otf");
text.setFont(font);
text.setFillColor(Color::White);
}
Settings::~Settings()
{
}
void Settings::keyEvent(State& state, Keyboard::Key key)
{
if (isChanging)
{
changeKey(key);
return;
}
ofstream outFile;
switch (key)
{
case Keyboard::Key::Escape:
outFile.open("Config/Keybinds.txt", ios::out);
for (std::map<string, Keyboard::Key>::iterator it = settings.keybinds.begin(); it != settings.keybinds.end(); ++it)
{
outFile << it->first << ' ' << it->second << endl;
}
outFile.close();
outFile.open("Config/Config.txt", ios::out);
outFile << "DAS " << settings.delayAutoShift << endl;
outFile << "ARR " << settings.autoRepeatRate << endl;
outFile.close();
state = State::MENU;
break;
case Keyboard::Key::Down:
setCursor(cursor + 1);
break;
case Keyboard::Key::Up:
setCursor(cursor - 1);
break;
case Keyboard::Key::Enter:
isChanging = true;
break;
}
}
void Settings::tick(State& state, RenderWindow& window)
{
}
void Settings::render(RenderWindow& window)
{
text.setFillColor(Color::White);
text.setCharacterSize(120);
text.setString("Change key config");
text.setPosition(1024 - text.getLocalBounds().width / 2, 50);
window.draw(text);
for (int i = 0; i < 8; i++)
{
Controls_Key key = static_cast<Controls_Key> (i);
drawKeyConfig(fromControlsToString(key), fromKtoS(settings.keybinds[controlsList[i]]), 500, 300 + 80 * i, window, cursor == i, isChanging);
}
drawKeyConfig("DAS", "< " + to_string(settings.delayAutoShift) + " >", 500, 300 + 80 * 8, window, cursor == 8, isChanging);
drawKeyConfig("ARR", "< " + to_string(settings.autoRepeatRate) + " >", 500, 300 + 80 * 9, window, cursor == 9, isChanging);
}
void Settings::drawKeyConfig(string name, string key, int x, int y, RenderWindow& window, bool isHighlight, bool changing)
{
if (isHighlight)
{
RectangleShape rect(Vector2f(1000, 50));
rect.setPosition(x, y);
rect.setFillColor(Color::White);
window.draw(rect);
if (changing)
{
RectangleShape rect(Vector2f(300, 50));
rect.setPosition(x + 700, y);
rect.setFillColor(Color::Red);
window.draw(rect);
}
text.setFillColor(Color::Black);
}
else
{
text.setFillColor(Color::White);
}
text.setPosition(x, y-15);
text.setCharacterSize(60);
text.setString(name);
window.draw(text);
text.setPosition(x + 825, y-15);
text.setString(key);
window.draw(text);
}
bool Settings::changeKey(Keyboard::Key key)
{
// dismiss special keys
if (key == Keyboard::Key::Escape || key == Keyboard::Key::Unknown || key == Keyboard::Key::R) return false;
if (cursor == 8)
{
if (key == Keyboard::Key::Right)
{
settings.delayAutoShift++;
return true;
}
else if (key == Keyboard::Key::Left)
{
settings.delayAutoShift--;
return true;
}
else if (key == Keyboard::Key::Enter)
{
isChanging = false;
return true;
}
return false;
}
else if (cursor == 9)
{
if (key == Keyboard::Key::Right)
{
settings.autoRepeatRate++;
return true;
}
else if (key == Keyboard::Key::Left)
{
settings.autoRepeatRate--;
return true;
}
else if (key == Keyboard::Key::Enter)
{
isChanging = false;
return true;
}
return false;
}
settings.keybinds[controlsList[cursor]] = key;
isChanging = false;
return true;
}
void Settings::mouseEvent(State& state, RenderWindow& window)
{
}
void Settings::setCursor(int cursor)
{
// clamping from 0 to 9
this->cursor = cursor < 0 ? 0 : cursor >9 ? 9 : cursor;
}
string Settings::fromControlsToString(Controls_Key key)
{
switch (key)
{
case Controls_Key::MOVE_LEFT:
return "Move left";
case Controls_Key::MOVE_RIGHT:
return "Move right";
case Controls_Key::ROTATE_CCW:
return "Rotate CCW";
case Controls_Key::ROTATE_CW:
return "Rotate CW";
case Controls_Key::ROTATE_180:
return "Rotate 180";
case Controls_Key::HOLD:
return "Hold";
case Controls_Key::HARD_DROP:
return "Hard drop";
case Controls_Key::SOFT_DROP:
return "Soft drop";
default:
return "Invalid/unknown key";
}
}
string Settings::fromKtoS(const sf::Keyboard::Key& k) {
string ret;
switch (k) {
case sf::Keyboard::A:
ret = "A";
break;
case sf::Keyboard::B:
ret = "B";
break;
case sf::Keyboard::C:
ret = "C";
break;
case sf::Keyboard::D:
ret = "D";
break;
case sf::Keyboard::E:
ret = "E";
break;
case sf::Keyboard::F:
ret = "F";
break;
case sf::Keyboard::G:
ret = "G";
break;
case sf::Keyboard::H:
ret = "H";
break;
case sf::Keyboard::I:
ret = "I";
break;
case sf::Keyboard::J:
ret = "J";
break;
case sf::Keyboard::K:
ret = "K";
break;
case sf::Keyboard::L:
ret = "L";
break;
case sf::Keyboard::M:
ret = "M";
break;
case sf::Keyboard::N:
ret = "N";
break;
case sf::Keyboard::O:
ret = "O";
break;
case sf::Keyboard::P:
ret = "P";
break;
case sf::Keyboard::Q:
ret = "Q";
break;
case sf::Keyboard::R:
ret = "R";
break;
case sf::Keyboard::S:
ret = "S";
break;
case sf::Keyboard::T:
ret = "T";
break;
case sf::Keyboard::U:
ret = "U";
break;
case sf::Keyboard::V:
ret = "V";
break;
case sf::Keyboard::W:
ret = "W";
break;
case sf::Keyboard::X:
ret = "X";
break;
case sf::Keyboard::Y:
ret = "Y";
break;
case sf::Keyboard::Z:
ret = "Z";
break;
case sf::Keyboard::Num0:
ret = "Num0";
break;
case sf::Keyboard::Num1:
ret = "Num1";
break;
case sf::Keyboard::Num2:
ret = "Num2";
break;
case sf::Keyboard::Num3:
ret = "Num3";
break;
case sf::Keyboard::Num4:
ret = "Num4";
break;
case sf::Keyboard::Num5:
ret = "Num5";
break;
case sf::Keyboard::Num6:
ret = "Num6";
break;
case sf::Keyboard::Num7:
ret = "Num7";
break;
case sf::Keyboard::Num8:
ret = "Num8";
break;
case sf::Keyboard::Num9:
ret = "Num9";
break;
case sf::Keyboard::Escape:
ret = "Escape";
break;
case sf::Keyboard::LControl:
ret = "LControl";
break;
case sf::Keyboard::LShift:
ret = "LShift";
break;
case sf::Keyboard::LAlt:
ret = "LAlt";
break;
case sf::Keyboard::LSystem:
ret = "LSystem";
break;
case sf::Keyboard::RControl:
ret = "RControl";
break;
case sf::Keyboard::RShift:
ret = "RShift";
break;
case sf::Keyboard::RAlt:
ret = "RAlt";
break;
case sf::Keyboard::RSystem:
ret = "RSystem";
break;
case sf::Keyboard::Menu:
ret = "Menu";
break;
case sf::Keyboard::LBracket:
ret = "LBracket";
break;
case sf::Keyboard::RBracket:
ret = "RBracket";
break;
case sf::Keyboard::SemiColon:
ret = "SemiColon";
break;
case sf::Keyboard::Comma:
ret = "Comma";
break;
case sf::Keyboard::Period:
ret = "Period";
break;
case sf::Keyboard::Quote:
ret = "Quote";
break;
case sf::Keyboard::Slash:
ret = "Slash";
break;
case sf::Keyboard::BackSlash:
ret = "BackSlash";
break;
case sf::Keyboard::Tilde:
ret = "Tilde";
break;
case sf::Keyboard::Equal:
ret = "Equal";
break;
case sf::Keyboard::Dash:
ret = "Dash";
break;
case sf::Keyboard::Space:
ret = "Space";
break;
case sf::Keyboard::Return:
ret = "Return";
break;
case sf::Keyboard::BackSpace:
ret = "BackSpace";
break;
case sf::Keyboard::Tab:
ret = "Tab";
break;
case sf::Keyboard::PageUp:
ret = "PageUp";
break;
case sf::Keyboard::PageDown:
ret = "PageDown";
break;
case sf::Keyboard::End:
ret = "End";
break;
case sf::Keyboard::Home:
ret = "Home";
break;
case sf::Keyboard::Insert:
ret = "Insert";
break;
case sf::Keyboard::Delete:
ret = "Delete";
break;
case sf::Keyboard::Add:
ret = "Add";
break;
case sf::Keyboard::Subtract:
ret = "Subtract";
break;
case sf::Keyboard::Multiply:
ret = "Multiply";
break;
case sf::Keyboard::Divide:
ret = "Divide";
break;
case sf::Keyboard::Left:
ret = "Left";
break;
case sf::Keyboard::Right:
ret = "Right";
break;
case sf::Keyboard::Up:
ret = "Up";
break;
case sf::Keyboard::Down:
ret = "Down";
break;
case sf::Keyboard::Numpad0:
ret = "Numpad0";
break;
case sf::Keyboard::Numpad1:
ret = "Numpad1";
break;
case sf::Keyboard::Numpad2:
ret = "Numpad2";
break;
case sf::Keyboard::Numpad3:
ret = "Numpad3";
break;
case sf::Keyboard::Numpad4:
ret = "Numpad4";
break;
case sf::Keyboard::Numpad5:
ret = "Numpad5";
break;
case sf::Keyboard::Numpad6:
ret = "Numpad6";
break;
case sf::Keyboard::Numpad7:
ret = "Numpad7";
break;
case sf::Keyboard::Numpad8:
ret = "Numpad8";
break;
case sf::Keyboard::Numpad9:
ret = "Numpad9";
break;
case sf::Keyboard::F1:
ret = "F1";
break;
case sf::Keyboard::F2:
ret = "F2";
break;
case sf::Keyboard::F3:
ret = "F3";
break;
case sf::Keyboard::F4:
ret = "F4";
break;
case sf::Keyboard::F5:
ret = "F5";
break;
case sf::Keyboard::F6:
ret = "F6";
break;
case sf::Keyboard::F7:
ret = "F7";
break;
case sf::Keyboard::F8:
ret = "F8";
break;
case sf::Keyboard::F9:
ret = "F9";
break;
case sf::Keyboard::F10:
ret = "F10";
break;
case sf::Keyboard::F11:
ret = "F11";
break;
case sf::Keyboard::F12:
ret = "F12";
break;
case sf::Keyboard::F13:
ret = "F13";
break;
case sf::Keyboard::F14:
ret = "F14";
break;
case sf::Keyboard::F15:
ret = "F15";
break;
case sf::Keyboard::Pause:
ret = "Pause";
break;
case sf::Keyboard::KeyCount:
ret = "KeyCount";
break;
default:
ret = "Unknow";
break;
}
return ret;
} | 18.772277 | 141 | 0.623734 | meowniverse |
b6ade1fce511f2d5fe22f475af1429c32d270503 | 4,524 | cpp | C++ | src/gui.cpp | luihabl/mandelbrot | 2db900e5504576226aae819facfce798a5f28fd3 | [
"MIT"
] | 2 | 2021-09-10T09:48:10.000Z | 2021-09-10T20:34:57.000Z | src/gui.cpp | luihabl/mandelbrot | 2db900e5504576226aae819facfce798a5f28fd3 | [
"MIT"
] | null | null | null | src/gui.cpp | luihabl/mandelbrot | 2db900e5504576226aae819facfce798a5f28fd3 | [
"MIT"
] | null | null | null | #include "gui.h"
#include <tinysdl.h>
#include "imgui.h"
#include "imgui_impl_sdl.h"
#include "imgui_impl_opengl3.h"
using namespace MB;
using namespace TinySDL;
GUI::GUI(SDL_Window* _window, SDL_GLContext* context) : window(_window)
{
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGui_ImplSDL2_InitForOpenGL(window, context);
ImGui_ImplOpenGL3_Init("#version 460");
}
GUI::~GUI()
{
ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplSDL2_Shutdown();
ImGui::DestroyContext();
}
ImGuiIO& GUI::io()
{
return ImGui::GetIO();
}
void GUI::setup()
{
ImGui::StyleColorsDark();
ImGui::GetStyle().FrameRounding = 4.0f;
ImGui::GetStyle().GrabRounding = 4.0f;
ImVec4* colors = ImGui::GetStyle().Colors;
colors[ImGuiCol_Text] = ImVec4(0.95f, 0.96f, 0.98f, 1.00f);
colors[ImGuiCol_TextDisabled] = ImVec4(0.36f, 0.42f, 0.47f, 1.00f);
colors[ImGuiCol_WindowBg] = ImVec4(0.11f, 0.15f, 0.17f, 1.00f);
colors[ImGuiCol_ChildBg] = ImVec4(0.15f, 0.18f, 0.22f, 1.00f);
colors[ImGuiCol_PopupBg] = ImVec4(0.08f, 0.08f, 0.08f, 0.94f);
colors[ImGuiCol_Border] = ImVec4(0.08f, 0.10f, 0.12f, 1.00f);
colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
colors[ImGuiCol_FrameBg] = ImVec4(0.20f, 0.25f, 0.29f, 1.00f);
colors[ImGuiCol_FrameBgHovered] = ImVec4(0.12f, 0.20f, 0.28f, 1.00f);
colors[ImGuiCol_FrameBgActive] = ImVec4(0.09f, 0.12f, 0.14f, 1.00f);
colors[ImGuiCol_TitleBg] = ImVec4(0.09f, 0.12f, 0.14f, 0.65f);
colors[ImGuiCol_TitleBgActive] = ImVec4(0.08f, 0.10f, 0.12f, 1.00f);
colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.00f, 0.00f, 0.00f, 0.51f);
colors[ImGuiCol_MenuBarBg] = ImVec4(0.15f, 0.18f, 0.22f, 1.00f);
colors[ImGuiCol_ScrollbarBg] = ImVec4(0.02f, 0.02f, 0.02f, 0.39f);
colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.20f, 0.25f, 0.29f, 1.00f);
colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.18f, 0.22f, 0.25f, 1.00f);
colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.09f, 0.21f, 0.31f, 1.00f);
colors[ImGuiCol_CheckMark] = ImVec4(0.28f, 0.56f, 1.00f, 1.00f);
colors[ImGuiCol_SliderGrab] = ImVec4(0.28f, 0.56f, 1.00f, 1.00f);
colors[ImGuiCol_SliderGrabActive] = ImVec4(0.37f, 0.61f, 1.00f, 1.00f);
colors[ImGuiCol_Button] = ImVec4(0.20f, 0.25f, 0.29f, 1.00f);
colors[ImGuiCol_ButtonHovered] = ImVec4(0.28f, 0.56f, 1.00f, 1.00f);
colors[ImGuiCol_ButtonActive] = ImVec4(0.06f, 0.53f, 0.98f, 1.00f);
colors[ImGuiCol_Header] = ImVec4(0.20f, 0.25f, 0.29f, 0.55f);
colors[ImGuiCol_HeaderHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.80f);
colors[ImGuiCol_HeaderActive] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
colors[ImGuiCol_Separator] = ImVec4(0.20f, 0.25f, 0.29f, 1.00f);
colors[ImGuiCol_SeparatorHovered] = ImVec4(0.10f, 0.40f, 0.75f, 0.78f);
colors[ImGuiCol_SeparatorActive] = ImVec4(0.10f, 0.40f, 0.75f, 1.00f);
colors[ImGuiCol_ResizeGrip] = ImVec4(0.26f, 0.59f, 0.98f, 0.25f);
colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);
colors[ImGuiCol_ResizeGripActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f);
colors[ImGuiCol_Tab] = ImVec4(0.11f, 0.15f, 0.17f, 1.00f);
colors[ImGuiCol_TabHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.80f);
colors[ImGuiCol_TabActive] = ImVec4(0.20f, 0.25f, 0.29f, 1.00f);
colors[ImGuiCol_TabUnfocused] = ImVec4(0.11f, 0.15f, 0.17f, 1.00f);
colors[ImGuiCol_TabUnfocusedActive] = ImVec4(0.11f, 0.15f, 0.17f, 1.00f);
colors[ImGuiCol_PlotLines] = ImVec4(0.61f, 0.61f, 0.61f, 1.00f);
colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f);
colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
colors[ImGuiCol_TextSelectedBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f);
colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);
colors[ImGuiCol_NavHighlight] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.35f);
}
void GUI::render()
{
ImGui::Render();
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
}
void GUI::process_event(SDL_Event* event)
{
ImGui_ImplSDL2_ProcessEvent(event);
}
void GUI::start_frame()
{
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplSDL2_NewFrame(window);
ImGui::NewFrame();
} | 42.280374 | 80 | 0.683687 | luihabl |
b6b02ffcdb4148e2691f6de3a10e42fb34e5751b | 1,255 | cpp | C++ | modules/DGM/GraphPairwiseExt.cpp | Pandinosaurus/DGM | 33a2e9bdaf446378ec63c10b3a07b257e32aa1ef | [
"BSD-3-Clause"
] | 188 | 2016-04-10T20:33:46.000Z | 2022-01-03T10:40:44.000Z | modules/DGM/GraphPairwiseExt.cpp | Pandinosaurus/DGM | 33a2e9bdaf446378ec63c10b3a07b257e32aa1ef | [
"BSD-3-Clause"
] | 25 | 2016-04-06T17:18:22.000Z | 2021-12-15T13:23:31.000Z | modules/DGM/GraphPairwiseExt.cpp | Pandinosaurus/DGM | 33a2e9bdaf446378ec63c10b3a07b257e32aa1ef | [
"BSD-3-Clause"
] | 55 | 2016-08-21T01:21:55.000Z | 2021-12-02T11:09:58.000Z | #include "GraphPairwiseExt.h"
#include "IGraphPairwise.h"
#include "TrainEdge.h"
#include "TrainEdgePottsCS.h"
#include "macroses.h"
namespace DirectGraphicalModels
{
void CGraphPairwiseExt::addDefaultEdgesModel(float val, float weight)
{
if (weight != 1.0f) val = powf(val, weight);
const byte nStates = m_pGraphLayeredExt->getGraph().getNumStates();
m_pGraphLayeredExt->getGraph().setEdges({}, CTrainEdge::getDefaultEdgePotentials(sqrtf(val), nStates));
}
void CGraphPairwiseExt::addDefaultEdgesModel(const Mat &featureVectors, float val, float weight)
{
const byte nStates = m_pGraphLayeredExt->getGraph().getNumStates();
const word nFeatures = featureVectors.channels();
const CTrainEdgePottsCS edgeTrainer(nStates, nFeatures);
fillEdges(edgeTrainer, featureVectors, { val, 0.001f }, weight);
}
void CGraphPairwiseExt::addDefaultEdgesModel(const vec_mat_t &featureVectors, float val, float weight)
{
const byte nStates = m_pGraphLayeredExt->getGraph().getNumStates();
const word nFeatures = static_cast<word>(featureVectors.size());
const CTrainEdgePottsCS edgeTrainer(nStates, nFeatures);
fillEdges(edgeTrainer, featureVectors, { val, 0.001f }, weight);
}
}
| 39.21875 | 106 | 0.733068 | Pandinosaurus |
b6b143763857f7f4243a3c1d6d3c9754f10218ca | 9,121 | cc | C++ | src/ila/var_container.cc | Anonymous-Stranger/ILAng | b39e8fca4a8be1fd2b7283510781ddd1f0035832 | [
"MIT"
] | 1 | 2021-01-14T15:44:24.000Z | 2021-01-14T15:44:24.000Z | src/ila/var_container.cc | Anonymous-Stranger/ILAng | b39e8fca4a8be1fd2b7283510781ddd1f0035832 | [
"MIT"
] | null | null | null | src/ila/var_container.cc | Anonymous-Stranger/ILAng | b39e8fca4a8be1fd2b7283510781ddd1f0035832 | [
"MIT"
] | null | null | null | /// \file
/// Source code for the class VarContainer and its derived classes.
#include <ilang/ila/var_container.h>
#include <ilang/ila/ast_hub.h>
namespace ilang {
VarContainerPtr VarContainer::Make(const std::string& name, const SortPtr& t) {
std::string prefix = name + "_"; // also makes name a bit more private if last variable.
switch (t->uid()) {
case AstUidSort::kBool:
return VarContainerPtr{new VarPrimitive{asthub::NewBoolVar(name)}};
case AstUidSort::kBv:
return VarContainerPtr{new VarPrimitive{asthub::NewBvVar(name, t->bit_width())}};
case AstUidSort::kMem:
return VarContainerPtr{new VarPrimitive{asthub::NewMemVar(name, t->addr_width(), t->data_width())}};
case AstUidSort::kVec:
{
ILA_ASSERT (t->vec_size() >= 0) << "Can't create vector of arbitrary (unknown) size";
vector_container vc {};
for (int i = 0; i != t->vec_size(); ++i) {
vc.push_back(Make(prefix + std::to_string(i) + "_", t->data_atom()));
}
return VarContainerPtr{new VarVector{t, vc}};
}
case AstUidSort::kStruct:
{
struct_container sc {};
for (auto& [name, type] : t->members()) {
sc.emplace_back(name, Make(prefix + name + "_", type));
}
return VarContainerPtr{new VarStruct(t, sc)};
}
default:
ILA_ASSERT(false) << "can't make VarContainer: recieved unknown type";
return nullptr;
}
}
VarContainerPtr VarContainer::from_primitive_expr(const ExprPtr& p) {
return VarContainerPtr{new VarPrimitive{p}};
}
ExprPtr VarContainer::to_primitive_expr() {
invalid_operation_error_("conversion to primitive expr");
return {nullptr};
}
VarContainerPtr VarContainer::nth(size_t idx) {
invalid_operation_error_("vector element access");
return {nullptr};
}
size_t VarContainer::size() const {
invalid_operation_error_("getting vector size");
return 0;
}
const VarContainer::vector_container& VarContainer::elements() {
invalid_operation_error_("getting vector elements");
return empty_vec_;
}
VarContainerPtr VarContainer::member(const std::string& name) {
invalid_operation_error_("struct member access");
return {nullptr};
}
const VarContainer::struct_container& VarContainer::members() {
invalid_operation_error_("getting struct members");
return empty_struct_;
}
VarContainer::partition VarContainer::order_preserving_partition(
size_t n_parts, std::function<size_t(size_t)> which_part
) {
invalid_operation_error_("partitioning");
return empty_vec_;
}
VarContainerPtr VarContainer::zip() {
invalid_operation_error_("zipping members");
return {nullptr};
}
VarContainerPtr VarContainer::unzip() {
invalid_operation_error_("unzipping elements");
return {nullptr};
}
VarContainerPtr VarContainer::project(const std::vector<std::string>& names) {
invalid_operation_error_("projection");
return {nullptr};
}
VarContainerPtr VarContainer::project_without(
const std::vector<std::string>& names
) {
invalid_operation_error_("projection");
return {nullptr};
}
VarContainerPtr VarContainer::join_with(const VarContainerPtr& b) {
invalid_operation_error_("struct joining");
return {nullptr};
}
/* VarPrimitive */
VarPrimitive::VarPrimitive(ExprPtr var): VarContainer(var->sort()), impl_ {var} {}
void VarPrimitive::visit_with(const VarContainer::Visitor& visit) { visit(this); }
/* VarVector */
VarVector::VarVector(const SortPtr& t, const vector_container& elems):
VarContainer(t), impl_ {elems} {}
bool VarVector::is_instance(const SortPtr& s) const {
if (!s || !s->is_vec()) return false;
if (s->vec_size() != size() && s->vec_size() != -1) return false;
for (auto& elem : impl_) {
if (!elem->is_instance(s->data_atom())) return false;
}
return true;
}
void VarVector::visit_with(const VarContainer::Visitor& visit) {
visit(this);
for (auto& elem : impl_) {
elem->visit_with(visit);
}
}
VarContainerPtr VarVector::nth(size_t idx) {
if (idx >= impl_.size()) {
ILA_ASSERT(false) << " index out of bounds: " << idx;
return nullptr;
}
return impl_[idx];
}
VarContainer::partition VarVector::order_preserving_partition(
size_t n_parts, std::function<size_t(size_t)> which_part
) {
std::vector<vector_container> parts(n_parts);
for (size_t i = 0; i != size(); ++i) {
size_t index = which_part(i);
if (index >= n_parts) {
ILA_ASSERT(false) << "partition function out of bounds";
return {};
}
parts[index].push_back(impl_[i]);
}
std::vector<VarContainerPtr> result;
result.reserve(n_parts);
for (size_t i = 0; i != n_parts; ++i) {
auto s = Sort::MakeVectorSort(sort()->data_atom(), parts[i].size());
result.push_back(from_cpp_obj(s, parts[i]));
}
return result;
}
VarContainerPtr VarVector::unzip() {
if (!sort()->data_atom()->is_struct()) {
ILA_ASSERT(false) << "can't unzip vector of data-atoms if they aren't structs";
return nullptr;
}
if (sort()->data_atom()->members().empty()) {
ILA_ASSERT(false) << "can't unzip vector of empty structs";
return nullptr;
}
std::vector<std::pair<std::string, SortPtr>> res_sort {};
std::unordered_map<std::string, vector_container> res {};
for (const auto& [name, da] : sort()->data_atom()->members()) {
res_sort.emplace_back(name, Sort::MakeVectorSort(da, size()));
res[name].reserve(size());
}
for (auto& x : elements()) {
for (auto& [name, m] : x->members()) {
res[name].push_back(m);
}
}
return from_cpp_obj(Sort::MakeStructSort(res_sort), res);
}
/* VarStruct */
VarStruct::VarStruct(const SortPtr& t, const struct_container& members):
VarContainer(t), impl_ {members} {}
bool VarStruct::is_instance(const SortPtr& s) const {
if (!s || !s->is_struct()) return false;
if (s->members().size() != impl_.size()) return false;
for (int i = 0; i != impl_.size(); ++i) {
auto [name, var] = impl_[i];
auto [exp_name, exp_sort] = s->members()[i];
if (name != exp_name || !var->is_instance(exp_sort)) return false;
}
return true;
}
void VarStruct::visit_with(const Visitor& visit) {
visit(this);
for (auto& [_, elem] : impl_) {
elem->visit_with(visit);
}
}
VarContainerPtr VarStruct::member(const std::string& name) {
for (auto& [n, elem] : impl_) {
if (n == name) return elem;
}
ILA_ASSERT(false) << "member '" + name + "' not found";
return nullptr;
}
VarContainerPtr VarStruct::zip() {
if (members().empty()) {
ILA_ASSERT(false) << "can't zip empty struct";
return nullptr;
}
int sz = -1;
std::vector<std::pair<std::string, SortPtr>> da {};
for (const auto& [name, v] : sort()->members()) {
if (!v->is_vec()) {
ILA_ASSERT(false) << "expected vector";
return nullptr;
}
if (sz < 0) sz = v->vec_size();
else if (sz != v->vec_size()) {
ILA_ASSERT(false)
<< "expected vector of size " << sz
<< "got vector of size " << v->vec_size();
return nullptr;
}
da.emplace_back(name, v->data_atom());
}
std::vector<std::vector<std::pair<std::string, VarContainerPtr>>> vec(sz);
for (const auto& [name, v] : members()) {
for (int i = 0; i != sz; ++i) {
vec[i].emplace_back(name, v->nth(i));
}
}
return from_cpp_obj(Sort::MakeVectorSort(Sort::MakeStructSort(da), sz), vec);
}
VarContainerPtr VarStruct::project(const std::vector<std::string>& names) {
std::unordered_map<std::string, VarContainerPtr> ms {members().begin(), members().end()};
std::vector<std::pair<std::string, SortPtr>> srt;
struct_container projection {};
for (const auto& name : names) {
if (ms.find(name) == ms.end()) {
ILA_ASSERT(false) << "member with name " << name << " not found";
return nullptr;
}
srt.emplace_back(name, ms[name]->sort());
projection.emplace_back(name, ms[name]);
}
return from_cpp_obj(Sort::MakeStructSort(srt), projection);
}
VarContainerPtr VarStruct::project_without(
const std::vector<std::string>& names
) {
std::unordered_map<std::string, VarContainerPtr>
ms {members().begin(), members().end()};
for (const auto& name : names) ms.erase(name);
std::vector<std::pair<std::string, SortPtr>> projsort {};
for (const auto& [name, s] : sort()->members()) {
if (ms.find(name) != ms.end()) projsort.emplace_back(name, s);
}
return from_cpp_obj(Sort::MakeStructSort(projsort), ms);
}
VarContainerPtr VarStruct::join_with(const VarContainerPtr& b) {
if (!b->is_struct()) {
ILA_ASSERT (false) << "can't join non-structs";
return {nullptr};
}
std::unordered_map<std::string, VarContainerPtr> ms {members().begin(), members().end()};
ms.insert(b->members().begin(), b->members().end());
if (ms.size() != members().size() + b->members().size()) {
ILA_ASSERT(false) << "structs being merged contained duplicate keys";
return {nullptr};
}
auto joinsort {sort()->members()};
auto bsort_members {b->sort()->members()};
joinsort.insert(joinsort.end(), bsort_members.begin(), bsort_members.end());
return from_cpp_obj(Sort::MakeStructSort(joinsort), ms);
}
} | 30.302326 | 106 | 0.658042 | Anonymous-Stranger |
b6bd6a4be6c79ade41ecdba14303f789e1120662 | 4,176 | hpp | C++ | include/J3D/J3DMaterialData.hpp | Sage-of-Mirrors/J3DUltra | bc823846a6a547e74beb4ed9acad38b3ccd63ad3 | [
"MIT"
] | 1 | 2022-01-31T14:45:12.000Z | 2022-01-31T14:45:12.000Z | include/J3D/J3DMaterialData.hpp | Sage-of-Mirrors/J3DUltra | bc823846a6a547e74beb4ed9acad38b3ccd63ad3 | [
"MIT"
] | null | null | null | include/J3D/J3DMaterialData.hpp | Sage-of-Mirrors/J3DUltra | bc823846a6a547e74beb4ed9acad38b3ccd63ad3 | [
"MIT"
] | null | null | null | #pragma once
#include "GX/GXEnum.hpp"
#include "J3D/J3DTransform.hpp"
#include <cstdint>
#include <glm/vec3.hpp>
#include <glm/vec4.hpp>
#include <glm/mat4x4.hpp>
namespace bStream { class CStream; }
enum class EPixelEngineMode : uint8_t {
Opaque = 1,
AlphaTest = 2,
Translucent = 4
};
struct J3DMaterialComponentBase {
virtual void Deserialize(bStream::CStream* stream) = 0;
virtual size_t GetElementSize() = 0;
};
// Z-buffer settings.
struct J3DZMode : public J3DMaterialComponentBase {
// Enable or disable the Z buffer.
bool Enable = false;
// Function comparing new Z value and the buffered Z value to determine which to discard.
EGXCompareType Function = EGXCompareType::Never;
// Enable or disable updates to the Z buffer.
bool UpdateEnable = false;
virtual void Deserialize(bStream::CStream* stream);
virtual size_t GetElementSize() override { return 4; }
};
// Alpha compare settings. The formula is:
// alpha_pass = (src <CompareFunc0> Reference0) op (src <CompareFunc1> Reference1)
// where src is the alpha value from the last active TEV stage.
struct J3DAlphaCompare : public J3DMaterialComponentBase {
EGXCompareType CompareFunc0 = EGXCompareType::Never;
uint8_t Reference0 = 0;
EGXAlphaOp Operation = EGXAlphaOp::And;
EGXCompareType CompareFunc1 = EGXCompareType::Never;
uint8_t Reference1 = 0;
virtual void Deserialize(bStream::CStream* stream);
virtual size_t GetElementSize() override { return 8; }
};
struct J3DBlendMode : public J3DMaterialComponentBase {
EGXBlendMode Type = EGXBlendMode::None;
EGXBlendModeControl SourceFactor = EGXBlendModeControl::One;
EGXBlendModeControl DestinationFactor = EGXBlendModeControl::Zero;
EGXLogicOp Operation = EGXLogicOp::Copy;
virtual void Deserialize(bStream::CStream* stream);
virtual size_t GetElementSize() override { return 4; }
};
struct J3DFog : public J3DMaterialComponentBase {
EGXFogType Type;
bool Enable;
uint16_t Center;
float StartZ;
float EndZ;
float FarZ;
float NearZ;
glm::vec4 Color;
uint16_t AdjustmentTable[10];
virtual void Deserialize(bStream::CStream* stream);
virtual size_t GetElementSize() override { return 44; }
};
struct J3DColorChannel : public J3DMaterialComponentBase {
bool LightingEnabled;
EGXColorSource MaterialSource;
uint8_t LightMask;
EGXDiffuseFunction DiffuseFunction;
EGXAttenuationFunction AttenuationFunction;
EGXColorSource AmbientSource;
virtual void Deserialize(bStream::CStream* stream);
virtual size_t GetElementSize() override { return 8; }
};
struct J3DTexCoordInfo : public J3DMaterialComponentBase {
EGXTexGenType Type;
EGXTexGenSrc Source;
EGXTexMatrix TexMatrix;
virtual void Deserialize(bStream::CStream* stream);
virtual size_t GetElementSize() override { return 4; }
};
enum class EJ3DTexMatrixProjection : uint8_t {
ST,
STQ
};
struct J3DTexMatrixInfo : public J3DMaterialComponentBase {
EJ3DTexMatrixProjection Projection;
uint8_t Type;
glm::vec3 Origin;
J3DTextureSRTInfo Transform;
glm::mat4 Matrix;
virtual void Deserialize(bStream::CStream* stream);
virtual size_t GetElementSize() override { return 100; }
};
struct J3DNBTScaleInfo : public J3DMaterialComponentBase {
bool Enable;
glm::vec3 Scale;
virtual void Deserialize(bStream::CStream* stream);
virtual size_t GetElementSize() override { return 16; }
};
struct J3DTevOrderInfo : public J3DMaterialComponentBase {
EGXTexCoordSlot TexCoordId;
uint8_t TexMap;
EGXColorChannelId ChannelId;
uint8_t mTexSwapTable[4]{};
uint8_t mRasSwapTable[4]{};
virtual void Deserialize(bStream::CStream* stream);
virtual size_t GetElementSize() override { return 4; }
};
struct J3DTevStageInfo : public J3DMaterialComponentBase {
uint8_t Unknown0;
EGXCombineColorInput ColorInput[4];
EGXTevOp ColorOperation;
EGXTevBias ColorBias;
EGXTevScale ColorScale;
bool ColorClamp;
EGXTevRegister ColorOutputRegister;
EGXCombineAlphaInput AlphaInput[4];
EGXTevOp AlphaOperation;
EGXTevBias AlphaBias;
EGXTevScale AlphaScale;
bool AlphaClamp;
EGXTevRegister AlphaOutputRegister;
uint8_t Unknown1;
virtual void Deserialize(bStream::CStream* stream);
virtual size_t GetElementSize() override { return 20; }
};
| 26.264151 | 90 | 0.780172 | Sage-of-Mirrors |
b6c4a2b499ea346fb7350164c4f270152a1e349d | 2,936 | hpp | C++ | libcaf_core/caf/detail/token_based_credit_controller.hpp | jsiwek/actor-framework | 06cd2836f4671725cb7eaa22b3cc115687520fc1 | [
"BSL-1.0",
"BSD-3-Clause"
] | 4 | 2019-05-03T05:38:15.000Z | 2020-08-25T15:23:19.000Z | libcaf_core/caf/detail/token_based_credit_controller.hpp | jsiwek/actor-framework | 06cd2836f4671725cb7eaa22b3cc115687520fc1 | [
"BSL-1.0",
"BSD-3-Clause"
] | null | null | null | libcaf_core/caf/detail/token_based_credit_controller.hpp | jsiwek/actor-framework | 06cd2836f4671725cb7eaa22b3cc115687520fc1 | [
"BSL-1.0",
"BSD-3-Clause"
] | null | null | null | /******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright 2011-2019 Dominik Charousset *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#pragma once
#include "caf/credit_controller.hpp"
#include "caf/detail/core_export.hpp"
namespace caf::detail {
/// A credit controller that estimates the bytes required to store incoming
/// batches and constrains credit based on upper bounds for memory usage.
class CAF_CORE_EXPORT token_based_credit_controller : public credit_controller {
public:
// -- constants --------------------------------------------------------------
/// Configures how many samples we require for recalculating buffer sizes.
static constexpr int32_t min_samples = 50;
/// Stores how many elements we buffer at most after the handshake.
int32_t initial_buffer_size = 10;
/// Stores how many elements we allow per batch after the handshake.
int32_t initial_batch_size = 2;
// -- constructors, destructors, and assignment operators --------------------
explicit token_based_credit_controller(local_actor* self);
~token_based_credit_controller() override;
// -- interface functions ----------------------------------------------------
void before_processing(downstream_msg::batch& batch) override;
calibration init() override;
calibration calibrate() override;
// -- factory functions ------------------------------------------------------
template <class T>
static auto make(local_actor* self, stream<T>) {
return std::make_unique<token_based_credit_controller>(self);
}
private:
// -- see caf::defaults::stream::token_policy -------------------------------
int32_t batch_size_;
int32_t buffer_size_;
};
} // namespace caf::detail
| 41.352113 | 80 | 0.471049 | jsiwek |
b6c4faa5d72a3120437a5ceb01de317ab111752d | 16,540 | cpp | C++ | src/MultiLayerOptics/tst/units/MultiPaneScattered_102_NonStandardSolar.unit.cpp | LBNL-ETA/Windows-CalcEngine | c81528f25ffb79989fcb15b03f00b7c18da138c4 | [
"BSD-3-Clause-LBNL"
] | 15 | 2018-04-20T19:16:50.000Z | 2022-02-11T04:11:41.000Z | src/MultiLayerOptics/tst/units/MultiPaneScattered_102_NonStandardSolar.unit.cpp | LBNL-ETA/Windows-CalcEngine | c81528f25ffb79989fcb15b03f00b7c18da138c4 | [
"BSD-3-Clause-LBNL"
] | 31 | 2016-04-05T20:56:28.000Z | 2022-03-31T22:02:46.000Z | src/MultiLayerOptics/tst/units/MultiPaneScattered_102_NonStandardSolar.unit.cpp | LBNL-ETA/Windows-CalcEngine | c81528f25ffb79989fcb15b03f00b7c18da138c4 | [
"BSD-3-Clause-LBNL"
] | 6 | 2018-04-20T19:38:58.000Z | 2020-04-06T00:30:47.000Z | #include <memory>
#include <gtest/gtest.h>
#include "WCESpectralAveraging.hpp"
#include "WCEMultiLayerOptics.hpp"
#include "WCESingleLayerOptics.hpp"
#include "WCECommon.hpp"
using namespace SingleLayerOptics;
using namespace FenestrationCommon;
using namespace SpectralAveraging;
using namespace MultiLayerOptics;
// Example on how to create scattered multilayer.
class MultiPaneScattered_102_NonStandardSolar : public testing::Test
{
private:
std::unique_ptr<CMultiLayerScattered> m_Layer;
CSeries loadSolarRadiationFile()
{
CSeries aSolarRadiation;
aSolarRadiation.addProperty(0.3000, 0);
aSolarRadiation.addProperty(0.3050, 9.5);
aSolarRadiation.addProperty(0.3100, 42.3);
aSolarRadiation.addProperty(0.3150, 107.8);
aSolarRadiation.addProperty(0.3200, 181);
aSolarRadiation.addProperty(0.3250, 246);
aSolarRadiation.addProperty(0.3300, 395.3);
aSolarRadiation.addProperty(0.3350, 390.1);
aSolarRadiation.addProperty(0.3400, 435.3);
aSolarRadiation.addProperty(0.3450, 438.9);
aSolarRadiation.addProperty(0.3500, 483.7);
aSolarRadiation.addProperty(0.3600, 520.3);
aSolarRadiation.addProperty(0.3700, 666.2);
aSolarRadiation.addProperty(0.3800, 712.5);
aSolarRadiation.addProperty(0.3900, 720.7);
aSolarRadiation.addProperty(0.4000, 1013.1);
aSolarRadiation.addProperty(0.4100, 1158.2);
aSolarRadiation.addProperty(0.4200, 1184);
aSolarRadiation.addProperty(0.4300, 1071.9);
aSolarRadiation.addProperty(0.4400, 1302);
aSolarRadiation.addProperty(0.4500, 1526);
aSolarRadiation.addProperty(0.4600, 1599.6);
aSolarRadiation.addProperty(0.4700, 1581);
aSolarRadiation.addProperty(0.4800, 1628.3);
aSolarRadiation.addProperty(0.4900, 1539.2);
aSolarRadiation.addProperty(0.5000, 1548.7);
aSolarRadiation.addProperty(0.5100, 1586.5);
aSolarRadiation.addProperty(0.5200, 1484.9);
aSolarRadiation.addProperty(0.5300, 1572.4);
aSolarRadiation.addProperty(0.5400, 1550.7);
aSolarRadiation.addProperty(0.5500, 1561.5);
aSolarRadiation.addProperty(0.5700, 1501.5);
aSolarRadiation.addProperty(0.5900, 1395.5);
aSolarRadiation.addProperty(0.6100, 1485.3);
aSolarRadiation.addProperty(0.6300, 1434.1);
aSolarRadiation.addProperty(0.6500, 1419.9);
aSolarRadiation.addProperty(0.6700, 1392.3);
aSolarRadiation.addProperty(0.6900, 1130);
aSolarRadiation.addProperty(0.7100, 1316.7);
aSolarRadiation.addProperty(0.7180, 1010.3);
aSolarRadiation.addProperty(0.7244, 1043.2);
aSolarRadiation.addProperty(0.7400, 1211.2);
aSolarRadiation.addProperty(0.7525, 1193.9);
aSolarRadiation.addProperty(0.7575, 1175.5);
aSolarRadiation.addProperty(0.7625, 643.1);
aSolarRadiation.addProperty(0.7675, 1030.7);
aSolarRadiation.addProperty(0.7800, 1131.1);
aSolarRadiation.addProperty(0.8000, 1081.6);
aSolarRadiation.addProperty(0.8160, 849.2);
aSolarRadiation.addProperty(0.8237, 785);
aSolarRadiation.addProperty(0.8315, 916.4);
aSolarRadiation.addProperty(0.8400, 959.9);
aSolarRadiation.addProperty(0.8600, 978.9);
aSolarRadiation.addProperty(0.8800, 933.2);
aSolarRadiation.addProperty(0.9050, 748.5);
aSolarRadiation.addProperty(0.9150, 667.5);
aSolarRadiation.addProperty(0.9250, 690.3);
aSolarRadiation.addProperty(0.9300, 403.6);
aSolarRadiation.addProperty(0.9370, 258.3);
aSolarRadiation.addProperty(0.9480, 313.6);
aSolarRadiation.addProperty(0.9650, 526.8);
aSolarRadiation.addProperty(0.9800, 646.4);
aSolarRadiation.addProperty(0.9935, 746.8);
aSolarRadiation.addProperty(1.0400, 690.5);
aSolarRadiation.addProperty(1.0700, 637.5);
aSolarRadiation.addProperty(1.1000, 412.6);
aSolarRadiation.addProperty(1.1200, 108.9);
aSolarRadiation.addProperty(1.1300, 189.1);
aSolarRadiation.addProperty(1.1370, 132.2);
aSolarRadiation.addProperty(1.1610, 339);
aSolarRadiation.addProperty(1.1800, 460);
aSolarRadiation.addProperty(1.2000, 423.6);
aSolarRadiation.addProperty(1.2350, 480.5);
aSolarRadiation.addProperty(1.2900, 413.1);
aSolarRadiation.addProperty(1.3200, 250.2);
aSolarRadiation.addProperty(1.3500, 32.5);
aSolarRadiation.addProperty(1.3950, 1.6);
aSolarRadiation.addProperty(1.4425, 55.7);
aSolarRadiation.addProperty(1.4625, 105.1);
aSolarRadiation.addProperty(1.4770, 105.5);
aSolarRadiation.addProperty(1.4970, 182.1);
aSolarRadiation.addProperty(1.5200, 262.2);
aSolarRadiation.addProperty(1.5390, 274.2);
aSolarRadiation.addProperty(1.5580, 275);
aSolarRadiation.addProperty(1.5780, 244.6);
aSolarRadiation.addProperty(1.5920, 247.4);
aSolarRadiation.addProperty(1.6100, 228.7);
aSolarRadiation.addProperty(1.6300, 244.5);
aSolarRadiation.addProperty(1.6460, 234.8);
aSolarRadiation.addProperty(1.6780, 220.5);
aSolarRadiation.addProperty(1.7400, 171.5);
aSolarRadiation.addProperty(1.8000, 30.7);
aSolarRadiation.addProperty(1.8600, 2);
aSolarRadiation.addProperty(1.9200, 1.2);
aSolarRadiation.addProperty(1.9600, 21.2);
aSolarRadiation.addProperty(1.9850, 91.1);
aSolarRadiation.addProperty(2.0050, 26.8);
aSolarRadiation.addProperty(2.0350, 99.5);
aSolarRadiation.addProperty(2.0650, 60.4);
aSolarRadiation.addProperty(2.1000, 89.1);
aSolarRadiation.addProperty(2.1480, 82.2);
aSolarRadiation.addProperty(2.1980, 71.5);
aSolarRadiation.addProperty(2.2700, 70.2);
aSolarRadiation.addProperty(2.3600, 62);
aSolarRadiation.addProperty(2.4500, 21.2);
aSolarRadiation.addProperty(2.4940, 18.5);
aSolarRadiation.addProperty(2.5370, 3.2);
return aSolarRadiation;
}
std::shared_ptr<CSpectralSampleData> loadSampleData_NFRC_102()
{
auto aMeasurements_102 = CSpectralSampleData::create(
{{0.300, 0.0020, 0.0470, 0.0480}, {0.305, 0.0030, 0.0470, 0.0480},
{0.310, 0.0090, 0.0470, 0.0480}, {0.315, 0.0350, 0.0470, 0.0480},
{0.320, 0.1000, 0.0470, 0.0480}, {0.325, 0.2180, 0.0490, 0.0500},
{0.330, 0.3560, 0.0530, 0.0540}, {0.335, 0.4980, 0.0600, 0.0610},
{0.340, 0.6160, 0.0670, 0.0670}, {0.345, 0.7090, 0.0730, 0.0740},
{0.350, 0.7740, 0.0780, 0.0790}, {0.355, 0.8180, 0.0820, 0.0820},
{0.360, 0.8470, 0.0840, 0.0840}, {0.365, 0.8630, 0.0850, 0.0850},
{0.370, 0.8690, 0.0850, 0.0860}, {0.375, 0.8610, 0.0850, 0.0850},
{0.380, 0.8560, 0.0840, 0.0840}, {0.385, 0.8660, 0.0850, 0.0850},
{0.390, 0.8810, 0.0860, 0.0860}, {0.395, 0.8890, 0.0860, 0.0860},
{0.400, 0.8930, 0.0860, 0.0860}, {0.410, 0.8930, 0.0860, 0.0860},
{0.420, 0.8920, 0.0860, 0.0860}, {0.430, 0.8920, 0.0850, 0.0850},
{0.440, 0.8920, 0.0850, 0.0850}, {0.450, 0.8960, 0.0850, 0.0850},
{0.460, 0.9000, 0.0850, 0.0850}, {0.470, 0.9020, 0.0840, 0.0840},
{0.480, 0.9030, 0.0840, 0.0840}, {0.490, 0.9040, 0.0850, 0.0850},
{0.500, 0.9050, 0.0840, 0.0840}, {0.510, 0.9050, 0.0840, 0.0840},
{0.520, 0.9050, 0.0840, 0.0840}, {0.530, 0.9040, 0.0840, 0.0840},
{0.540, 0.9040, 0.0830, 0.0830}, {0.550, 0.9030, 0.0830, 0.0830},
{0.560, 0.9020, 0.0830, 0.0830}, {0.570, 0.9000, 0.0820, 0.0820},
{0.580, 0.8980, 0.0820, 0.0820}, {0.590, 0.8960, 0.0810, 0.0810},
{0.600, 0.8930, 0.0810, 0.0810}, {0.610, 0.8900, 0.0810, 0.0810},
{0.620, 0.8860, 0.0800, 0.0800}, {0.630, 0.8830, 0.0800, 0.0800},
{0.640, 0.8790, 0.0790, 0.0790}, {0.650, 0.8750, 0.0790, 0.0790},
{0.660, 0.8720, 0.0790, 0.0790}, {0.670, 0.8680, 0.0780, 0.0780},
{0.680, 0.8630, 0.0780, 0.0780}, {0.690, 0.8590, 0.0770, 0.0770},
{0.700, 0.8540, 0.0760, 0.0770}, {0.710, 0.8500, 0.0760, 0.0760},
{0.720, 0.8450, 0.0750, 0.0760}, {0.730, 0.8400, 0.0750, 0.0750},
{0.740, 0.8350, 0.0750, 0.0750}, {0.750, 0.8310, 0.0740, 0.0740},
{0.760, 0.8260, 0.0740, 0.0740}, {0.770, 0.8210, 0.0740, 0.0740},
{0.780, 0.8160, 0.0730, 0.0730}, {0.790, 0.8120, 0.0730, 0.0730},
{0.800, 0.8080, 0.0720, 0.0720}, {0.810, 0.8030, 0.0720, 0.0720},
{0.820, 0.8000, 0.0720, 0.0720}, {0.830, 0.7960, 0.0710, 0.0710},
{0.840, 0.7930, 0.0700, 0.0710}, {0.850, 0.7880, 0.0700, 0.0710},
{0.860, 0.7860, 0.0700, 0.0700}, {0.870, 0.7820, 0.0740, 0.0740},
{0.880, 0.7800, 0.0720, 0.0720}, {0.890, 0.7770, 0.0730, 0.0740},
{0.900, 0.7760, 0.0720, 0.0720}, {0.910, 0.7730, 0.0720, 0.0720},
{0.920, 0.7710, 0.0710, 0.0710}, {0.930, 0.7700, 0.0700, 0.0700},
{0.940, 0.7680, 0.0690, 0.0690}, {0.950, 0.7660, 0.0680, 0.0680},
{0.960, 0.7660, 0.0670, 0.0680}, {0.970, 0.7640, 0.0680, 0.0680},
{0.980, 0.7630, 0.0680, 0.0680}, {0.990, 0.7620, 0.0670, 0.0670},
{1.000, 0.7620, 0.0660, 0.0670}, {1.050, 0.7600, 0.0660, 0.0660},
{1.100, 0.7590, 0.0660, 0.0660}, {1.150, 0.7610, 0.0660, 0.0660},
{1.200, 0.7650, 0.0660, 0.0660}, {1.250, 0.7700, 0.0650, 0.0650},
{1.300, 0.7770, 0.0670, 0.0670}, {1.350, 0.7860, 0.0660, 0.0670},
{1.400, 0.7950, 0.0670, 0.0680}, {1.450, 0.8080, 0.0670, 0.0670},
{1.500, 0.8190, 0.0690, 0.0690}, {1.550, 0.8290, 0.0690, 0.0690},
{1.600, 0.8360, 0.0700, 0.0700}, {1.650, 0.8400, 0.0700, 0.0700},
{1.700, 0.8420, 0.0690, 0.0700}, {1.750, 0.8420, 0.0690, 0.0700},
{1.800, 0.8410, 0.0700, 0.0700}, {1.850, 0.8400, 0.0690, 0.0690},
{1.900, 0.8390, 0.0680, 0.0680}, {1.950, 0.8390, 0.0710, 0.0710},
{2.000, 0.8390, 0.0690, 0.0690}, {2.050, 0.8400, 0.0680, 0.0680},
{2.100, 0.8410, 0.0680, 0.0680}, {2.150, 0.8390, 0.0690, 0.0690},
{2.200, 0.8300, 0.0700, 0.0700}, {2.250, 0.8300, 0.0700, 0.0700},
{2.300, 0.8320, 0.0690, 0.0690}, {2.350, 0.8320, 0.0690, 0.0700},
{2.400, 0.8320, 0.0700, 0.0700}, {2.450, 0.8260, 0.0690, 0.0690},
{2.500, 0.8220, 0.0680, 0.0680}});
return aMeasurements_102;
}
protected:
virtual void SetUp()
{
// Create material from samples
auto thickness = 3.048e-3; // [m]
auto aMaterial_102 = SingleLayerOptics::Material::nBandMaterial(
loadSampleData_NFRC_102(), thickness, MaterialType::Monolithic, WavelengthRange::Solar);
CScatteringLayer Layer102 = CScatteringLayer::createSpecularLayer(aMaterial_102);
// Equivalent BSDF layer
m_Layer = CMultiLayerScattered::create(Layer102);
CSeries solarRadiation{loadSolarRadiationFile()};
m_Layer->setSourceData(solarRadiation);
}
public:
CMultiLayerScattered & getLayer()
{
return *m_Layer;
};
};
TEST_F(MultiPaneScattered_102_NonStandardSolar, TestSpecular1)
{
SCOPED_TRACE("Begin Test: Specular layer - Scattering model front side (normal incidence).");
const double minLambda = 0.3;
const double maxLambda = 2.5;
CMultiLayerScattered & aLayer = getLayer();
Side aSide = Side::Front;
double theta = 0;
double phi = 0;
double T_dir_dir = aLayer.getPropertySimple(
minLambda, maxLambda, PropertySimple::T, aSide, Scattering::DirectDirect, theta, phi);
EXPECT_NEAR(0.836918, T_dir_dir, 1e-6);
double T_dir_dif = aLayer.getPropertySimple(
minLambda, maxLambda, PropertySimple::T, aSide, Scattering::DirectDiffuse, theta, phi);
EXPECT_NEAR(0, T_dir_dif, 1e-6);
double T_dif_dif = aLayer.getPropertySimple(
minLambda, maxLambda, PropertySimple::T, aSide, Scattering::DiffuseDiffuse, theta, phi);
EXPECT_NEAR(0.756157, T_dif_dif, 1e-6);
double R_dir_dir = aLayer.getPropertySimple(
minLambda, maxLambda, PropertySimple::R, aSide, Scattering::DirectDirect, theta, phi);
EXPECT_NEAR(0.075619, R_dir_dir, 1e-6);
double R_dir_dif = aLayer.getPropertySimple(
minLambda, maxLambda, PropertySimple::R, aSide, Scattering::DirectDiffuse, theta, phi);
EXPECT_NEAR(0, R_dir_dif, 1e-6);
double R_dif_dif = aLayer.getPropertySimple(
minLambda, maxLambda, PropertySimple::R, aSide, Scattering::DiffuseDiffuse, theta, phi);
EXPECT_NEAR(0.147130, R_dif_dif, 1e-6);
double A_dir1 = aLayer.getAbsorptanceLayer(1, aSide, ScatteringSimple::Direct, theta, phi);
EXPECT_NEAR(0.087463, A_dir1, 1e-6);
double A_dif1 = aLayer.getAbsorptanceLayer(1, aSide, ScatteringSimple::Diffuse, theta, phi);
EXPECT_NEAR(0.096713, A_dif1, 1e-6);
}
TEST_F(MultiPaneScattered_102_NonStandardSolar, TestSpecular2)
{
SCOPED_TRACE("Begin Test: Specular layer - Scattering model back side (normal incidence).");
const double minLambda = 0.3;
const double maxLambda = 2.5;
CMultiLayerScattered & aLayer = getLayer();
Side aSide = Side::Back;
double theta = 0;
double phi = 0;
double T_dir_dir = aLayer.getPropertySimple(
minLambda, maxLambda, PropertySimple::T, aSide, Scattering::DirectDirect, theta, phi);
EXPECT_NEAR(0.836918, T_dir_dir, 1e-6);
double T_dir_dif = aLayer.getPropertySimple(
minLambda, maxLambda, PropertySimple::T, aSide, Scattering::DirectDiffuse, theta, phi);
EXPECT_NEAR(0, T_dir_dif, 1e-6);
double T_dif_dif = aLayer.getPropertySimple(
minLambda, maxLambda, PropertySimple::T, aSide, Scattering::DiffuseDiffuse, theta, phi);
EXPECT_NEAR(0.756157, T_dif_dif, 1e-6);
double R_dir_dir = aLayer.getPropertySimple(
minLambda, maxLambda, PropertySimple::R, aSide, Scattering::DirectDirect, theta, phi);
EXPECT_NEAR(0.075735, R_dir_dir, 1e-6);
double R_dir_dif = aLayer.getPropertySimple(
minLambda, maxLambda, PropertySimple::R, aSide, Scattering::DirectDiffuse, theta, phi);
EXPECT_NEAR(0, R_dir_dif, 1e-6);
double R_dif_dif = aLayer.getPropertySimple(
minLambda, maxLambda, PropertySimple::R, aSide, Scattering::DiffuseDiffuse, theta, phi);
EXPECT_NEAR(0.147249, R_dif_dif, 1e-6);
double A_dir1 = aLayer.getAbsorptanceLayer(1, aSide, ScatteringSimple::Direct, theta, phi);
EXPECT_NEAR(0.087347, A_dir1, 1e-6);
double A_dif1 = aLayer.getAbsorptanceLayer(1, aSide, ScatteringSimple::Diffuse, theta, phi);
EXPECT_NEAR(0.096594, A_dif1, 1e-6);
}
TEST_F(MultiPaneScattered_102_NonStandardSolar, TestSpecular3)
{
SCOPED_TRACE("Begin Test: Specular layer - Scattering model front side (Theta = 40 deg).");
const double minLambda = 0.3;
const double maxLambda = 2.5;
CMultiLayerScattered & aLayer = getLayer();
Side aSide = Side::Front;
double theta = 40;
double phi = 0;
double T_dir_dir = aLayer.getPropertySimple(
minLambda, maxLambda, PropertySimple::T, aSide, Scattering::DirectDirect, theta, phi);
EXPECT_NEAR(0.821105, T_dir_dir, 1e-6);
double T_dir_dif = aLayer.getPropertySimple(
minLambda, maxLambda, PropertySimple::T, aSide, Scattering::DirectDiffuse, theta, phi);
EXPECT_NEAR(0, T_dir_dif, 1e-6);
double T_dif_dif = aLayer.getPropertySimple(
minLambda, maxLambda, PropertySimple::T, aSide, Scattering::DiffuseDiffuse, theta, phi);
EXPECT_NEAR(0.756157, T_dif_dif, 1e-6);
double R_dir_dir = aLayer.getPropertySimple(
minLambda, maxLambda, PropertySimple::R, aSide, Scattering::DirectDirect, theta, phi);
EXPECT_NEAR(0.083379, R_dir_dir, 1e-6);
double R_dir_dif = aLayer.getPropertySimple(
minLambda, maxLambda, PropertySimple::R, aSide, Scattering::DirectDiffuse, theta, phi);
EXPECT_NEAR(0, R_dir_dif, 1e-6);
double R_dif_dif = aLayer.getPropertySimple(
minLambda, maxLambda, PropertySimple::R, aSide, Scattering::DiffuseDiffuse, theta, phi);
EXPECT_NEAR(0.147130, R_dif_dif, 1e-6);
double A_dir1 = aLayer.getAbsorptanceLayer(1, aSide, ScatteringSimple::Direct, theta, phi);
EXPECT_NEAR(0.095516, A_dir1, 1e-6);
double A_dif1 = aLayer.getAbsorptanceLayer(1, aSide, ScatteringSimple::Diffuse, theta, phi);
EXPECT_NEAR(0.096713, A_dif1, 1e-6);
}
| 46.591549 | 98 | 0.645647 | LBNL-ETA |
b6c6375a0fa098946132ec8224cc762121989ac7 | 14,131 | hpp | C++ | core/src/main/cpp/3rdparty/glm/gtc/type_aligned.hpp | caolongcl/OpenImage | d29e0309bc35ff1766e0c81bfba82b185a7aabb6 | [
"BSD-3-Clause"
] | 2 | 2021-09-16T15:14:39.000Z | 2021-09-17T14:39:52.000Z | core/src/main/cpp/3rdparty/glm/gtc/type_aligned.hpp | caolongcl/OpenImage | d29e0309bc35ff1766e0c81bfba82b185a7aabb6 | [
"BSD-3-Clause"
] | null | null | null | core/src/main/cpp/3rdparty/glm/gtc/type_aligned.hpp | caolongcl/OpenImage | d29e0309bc35ff1766e0c81bfba82b185a7aabb6 | [
"BSD-3-Clause"
] | null | null | null | /// @ref gtc_type_aligned
/// @file glm/gtc/type_aligned.hpp
///
/// @see core (dependence)
///
/// @defgroup gtc_type_aligned GLM_GTC_type_aligned
/// @ingroup gtc
///
/// @brief Aligned types.
/// <glm/gtc/type_aligned.hpp> need to be included to use these features.
#pragma once
#if !GLM_HAS_ALIGNED_TYPE
# error "GLM: Aligned types are not supported on this platform"
#endif
#if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_GTC_type_aligned extension included")
#endif
#include "../vec2.hpp"
#include "../vec3.hpp"
#include "../vec4.hpp"
#include "../gtc/vec1.hpp"
namespace glm {
template<typename T, precision P> struct tvec1;
template<typename T, precision P> struct tvec2;
template<typename T, precision P> struct tvec3;
template<typename T, precision P> struct tvec4;
/// @addtogroup gtc_type_aligned
/// @{
// -- *vec1 --
typedef tvec1<float, aligned_highp> aligned_highp_vec1;
typedef tvec1<float, aligned_mediump> aligned_mediump_vec1;
typedef tvec1<float, aligned_lowp> aligned_lowp_vec1;
typedef tvec1<double, aligned_highp> aligned_highp_dvec1;
typedef tvec1<double, aligned_mediump> aligned_mediump_dvec1;
typedef tvec1<double, aligned_lowp> aligned_lowp_dvec1;
typedef tvec1<int, aligned_highp> aligned_highp_ivec1;
typedef tvec1<int, aligned_mediump> aligned_mediump_ivec1;
typedef tvec1<int, aligned_lowp> aligned_lowp_ivec1;
typedef tvec1<uint, aligned_highp> aligned_highp_uvec1;
typedef tvec1<uint, aligned_mediump> aligned_mediump_uvec1;
typedef tvec1<uint, aligned_lowp> aligned_lowp_uvec1;
typedef tvec1<bool, aligned_highp> aligned_highp_bvec1;
typedef tvec1<bool, aligned_mediump> aligned_mediump_bvec1;
typedef tvec1<bool, aligned_lowp> aligned_lowp_bvec1;
typedef tvec1<float, packed_highp> packed_highp_vec1;
typedef tvec1<float, packed_mediump> packed_mediump_vec1;
typedef tvec1<float, packed_lowp> packed_lowp_vec1;
typedef tvec1<double, packed_highp> packed_highp_dvec1;
typedef tvec1<double, packed_mediump> packed_mediump_dvec1;
typedef tvec1<double, packed_lowp> packed_lowp_dvec1;
typedef tvec1<int, packed_highp> packed_highp_ivec1;
typedef tvec1<int, packed_mediump> packed_mediump_ivec1;
typedef tvec1<int, packed_lowp> packed_lowp_ivec1;
typedef tvec1<uint, packed_highp> packed_highp_uvec1;
typedef tvec1<uint, packed_mediump> packed_mediump_uvec1;
typedef tvec1<uint, packed_lowp> packed_lowp_uvec1;
typedef tvec1<bool, packed_highp> packed_highp_bvec1;
typedef tvec1<bool, packed_mediump> packed_mediump_bvec1;
typedef tvec1<bool, packed_lowp> packed_lowp_bvec1;
// -- *vec2 --
/// 2 components vector of high single-precision floating-point numbers.
/// There is no guarantee on the actual precision.
typedef tvec2<float, aligned_highp> aligned_highp_vec2;
/// 2 components vector of medium single-precision floating-point numbers.
/// There is no guarantee on the actual precision.
typedef tvec2<float, aligned_mediump> aligned_mediump_vec2;
/// 2 components vector of low single-precision floating-point numbers.
/// There is no guarantee on the actual precision.
typedef tvec2<float, aligned_lowp> aligned_lowp_vec2;
/// 2 components vector of high double-precision floating-point numbers.
/// There is no guarantee on the actual precision.
typedef tvec2<double, aligned_highp> aligned_highp_dvec2;
/// 2 components vector of medium double-precision floating-point numbers.
/// There is no guarantee on the actual precision.
typedef tvec2<double, aligned_mediump> aligned_mediump_dvec2;
/// 2 components vector of low double-precision floating-point numbers.
/// There is no guarantee on the actual precision.
typedef tvec2<double, aligned_lowp> aligned_lowp_dvec2;
/// 2 components vector of high precision signed integer numbers.
/// There is no guarantee on the actual precision.
typedef tvec2<int, aligned_highp> aligned_highp_ivec2;
/// 2 components vector of medium precision signed integer numbers.
/// There is no guarantee on the actual precision.
typedef tvec2<int, aligned_mediump> aligned_mediump_ivec2;
/// 2 components vector of low precision signed integer numbers.
/// There is no guarantee on the actual precision.
typedef tvec2<int, aligned_lowp> aligned_lowp_ivec2;
/// 2 components vector of high precision unsigned integer numbers.
/// There is no guarantee on the actual precision.
typedef tvec2<uint, aligned_highp> aligned_highp_uvec2;
/// 2 components vector of medium precision unsigned integer numbers.
/// There is no guarantee on the actual precision.
typedef tvec2<uint, aligned_mediump> aligned_mediump_uvec2;
/// 2 components vector of low precision unsigned integer numbers.
/// There is no guarantee on the actual precision.
typedef tvec2<uint, aligned_lowp> aligned_lowp_uvec2;
/// 2 components vector of high precision bool numbers.
/// There is no guarantee on the actual precision.
typedef tvec2<bool, aligned_highp> aligned_highp_bvec2;
/// 2 components vector of medium precision bool numbers.
/// There is no guarantee on the actual precision.
typedef tvec2<bool, aligned_mediump> aligned_mediump_bvec2;
/// 2 components vector of low precision bool numbers.
/// There is no guarantee on the actual precision.
typedef tvec2<bool, aligned_lowp> aligned_lowp_bvec2;
// -- *vec3 --
/// 3 components vector of high single-precision floating-point numbers.
/// There is no guarantee on the actual precision.
typedef tvec3<float, aligned_highp> aligned_highp_vec3;
/// 3 components vector of medium single-precision floating-point numbers.
/// There is no guarantee on the actual precision.
typedef tvec3<float, aligned_mediump> aligned_mediump_vec3;
/// 3 components vector of low single-precision floating-point numbers.
/// There is no guarantee on the actual precision.
typedef tvec3<float, aligned_lowp> aligned_lowp_vec3;
/// 3 components vector of high double-precision floating-point numbers.
/// There is no guarantee on the actual precision.
typedef tvec3<double, aligned_highp> aligned_highp_dvec3;
/// 3 components vector of medium double-precision floating-point numbers.
/// There is no guarantee on the actual precision.
typedef tvec3<double, aligned_mediump> aligned_mediump_dvec3;
/// 3 components vector of low double-precision floating-point numbers.
/// There is no guarantee on the actual precision.
typedef tvec3<double, aligned_lowp> aligned_lowp_dvec3;
/// 3 components vector of high precision signed integer numbers.
/// There is no guarantee on the actual precision.
typedef tvec3<int, aligned_highp> aligned_highp_ivec3;
/// 3 components vector of medium precision signed integer numbers.
/// There is no guarantee on the actual precision.
typedef tvec3<int, aligned_mediump> aligned_mediump_ivec3;
/// 3 components vector of low precision signed integer numbers.
/// There is no guarantee on the actual precision.
typedef tvec3<int, aligned_lowp> aligned_lowp_ivec3;
/// 3 components vector of high precision unsigned integer numbers.
/// There is no guarantee on the actual precision.
typedef tvec3<uint, aligned_highp> aligned_highp_uvec3;
/// 3 components vector of medium precision unsigned integer numbers.
/// There is no guarantee on the actual precision.
typedef tvec3<uint, aligned_mediump> aligned_mediump_uvec3;
/// 3 components vector of low precision unsigned integer numbers.
/// There is no guarantee on the actual precision.
typedef tvec3<uint, aligned_lowp> aligned_lowp_uvec3;
/// 3 components vector of high precision bool numbers.
typedef tvec3<bool, aligned_highp> aligned_highp_bvec3;
/// 3 components vector of medium precision bool numbers.
typedef tvec3<bool, aligned_mediump> aligned_mediump_bvec3;
/// 3 components vector of low precision bool numbers.
typedef tvec3<bool, aligned_lowp> aligned_lowp_bvec3;
// -- *vec4 --
/// 4 components vector of high single-precision floating-point numbers.
typedef tvec4<float, aligned_highp> aligned_highp_vec4;
/// 4 components vector of medium single-precision floating-point numbers.
typedef tvec4<float, aligned_mediump> aligned_mediump_vec4;
/// 4 components vector of low single-precision floating-point numbers.
typedef tvec4<float, aligned_lowp> aligned_lowp_vec4;
/// 4 components vector of high double-precision floating-point numbers.
typedef tvec4<double, aligned_highp> aligned_highp_dvec4;
/// 4 components vector of medium double-precision floating-point numbers.
typedef tvec4<double, aligned_mediump> aligned_mediump_dvec4;
/// 4 components vector of low double-precision floating-point numbers.
typedef tvec4<double, aligned_lowp> aligned_lowp_dvec4;
/// 4 components vector of high precision signed integer numbers.
typedef tvec4<int, aligned_highp> aligned_highp_ivec4;
/// 4 components vector of medium precision signed integer numbers.
typedef tvec4<int, aligned_mediump> aligned_mediump_ivec4;
/// 4 components vector of low precision signed integer numbers.
typedef tvec4<int, aligned_lowp> aligned_lowp_ivec4;
/// 4 components vector of high precision unsigned integer numbers.
typedef tvec4<uint, aligned_highp> aligned_highp_uvec4;
/// 4 components vector of medium precision unsigned integer numbers.
typedef tvec4<uint, aligned_mediump> aligned_mediump_uvec4;
/// 4 components vector of low precision unsigned integer numbers.
typedef tvec4<uint, aligned_lowp> aligned_lowp_uvec4;
/// 4 components vector of high precision bool numbers.
typedef tvec4<bool, aligned_highp> aligned_highp_bvec4;
/// 4 components vector of medium precision bool numbers.
typedef tvec4<bool, aligned_mediump> aligned_mediump_bvec4;
/// 4 components vector of low precision bool numbers.
typedef tvec4<bool, aligned_lowp> aligned_lowp_bvec4;
// -- default --
#if(defined(GLM_PRECISION_LOWP_FLOAT))
typedef aligned_lowp_vec1 aligned_vec1;
typedef aligned_lowp_vec2 aligned_vec2;
typedef aligned_lowp_vec3 aligned_vec3;
typedef aligned_lowp_vec4 aligned_vec4;
#elif(defined(GLM_PRECISION_MEDIUMP_FLOAT))
typedef aligned_mediump_vec1 aligned_vec1;
typedef aligned_mediump_vec2 aligned_vec2;
typedef aligned_mediump_vec3 aligned_vec3;
typedef aligned_mediump_vec4 aligned_vec4;
#else //defined(GLM_PRECISION_HIGHP_FLOAT)
/// 1 component vector of floating-point numbers.
typedef aligned_highp_vec1 aligned_vec1;
/// 2 components vector of floating-point numbers.
typedef aligned_highp_vec2 aligned_vec2;
/// 3 components vector of floating-point numbers.
typedef aligned_highp_vec3 aligned_vec3;
/// 4 components vector of floating-point numbers.
typedef aligned_highp_vec4 aligned_vec4;
#endif//GLM_PRECISION
#if(defined(GLM_PRECISION_LOWP_DOUBLE))
typedef aligned_lowp_dvec1 aligned_dvec1;
typedef aligned_lowp_dvec2 aligned_dvec2;
typedef aligned_lowp_dvec3 aligned_dvec3;
typedef aligned_lowp_dvec4 aligned_dvec4;
#elif(defined(GLM_PRECISION_MEDIUMP_DOUBLE))
typedef aligned_mediump_dvec1 aligned_dvec1;
typedef aligned_mediump_dvec2 aligned_dvec2;
typedef aligned_mediump_dvec3 aligned_dvec3;
typedef aligned_mediump_dvec4 aligned_dvec4;
#else //defined(GLM_PRECISION_HIGHP_DOUBLE)
/// 1 component vector of double-precision floating-point numbers.
typedef aligned_highp_dvec1 aligned_dvec1;
/// 2 components vector of double-precision floating-point numbers.
typedef aligned_highp_dvec2 aligned_dvec2;
/// 3 components vector of double-precision floating-point numbers.
typedef aligned_highp_dvec3 aligned_dvec3;
/// 4 components vector of double-precision floating-point numbers.
typedef aligned_highp_dvec4 aligned_dvec4;
#endif//GLM_PRECISION
#if(defined(GLM_PRECISION_LOWP_INT))
typedef aligned_lowp_ivec1 aligned_ivec1;
typedef aligned_lowp_ivec2 aligned_ivec2;
typedef aligned_lowp_ivec3 aligned_ivec3;
typedef aligned_lowp_ivec4 aligned_ivec4;
#elif(defined(GLM_PRECISION_MEDIUMP_INT))
typedef aligned_mediump_ivec1 aligned_ivec1;
typedef aligned_mediump_ivec2 aligned_ivec2;
typedef aligned_mediump_ivec3 aligned_ivec3;
typedef aligned_mediump_ivec4 aligned_ivec4;
#else //defined(GLM_PRECISION_HIGHP_INT)
/// 1 component vector of signed integer numbers.
typedef aligned_highp_ivec1 aligned_ivec1;
/// 2 components vector of signed integer numbers.
typedef aligned_highp_ivec2 aligned_ivec2;
/// 3 components vector of signed integer numbers.
typedef aligned_highp_ivec3 aligned_ivec3;
/// 4 components vector of signed integer numbers.
typedef aligned_highp_ivec4 aligned_ivec4;
#endif//GLM_PRECISION
// -- Unsigned integer definition --
#if(defined(GLM_PRECISION_LOWP_UINT))
typedef aligned_lowp_uvec1 aligned_uvec1;
typedef aligned_lowp_uvec2 aligned_uvec2;
typedef aligned_lowp_uvec3 aligned_uvec3;
typedef aligned_lowp_uvec4 aligned_uvec4;
#elif(defined(GLM_PRECISION_MEDIUMP_UINT))
typedef aligned_mediump_uvec1 aligned_uvec1;
typedef aligned_mediump_uvec2 aligned_uvec2;
typedef aligned_mediump_uvec3 aligned_uvec3;
typedef aligned_mediump_uvec4 aligned_uvec4;
#else //defined(GLM_PRECISION_HIGHP_UINT)
/// 1 component vector of unsigned integer numbers.
typedef aligned_highp_uvec1 aligned_uvec1;
/// 2 components vector of unsigned integer numbers.
typedef aligned_highp_uvec2 aligned_uvec2;
/// 3 components vector of unsigned integer numbers.
typedef aligned_highp_uvec3 aligned_uvec3;
/// 4 components vector of unsigned integer numbers.
typedef aligned_highp_uvec4 aligned_uvec4;
#endif//GLM_PRECISION
#if(defined(GLM_PRECISION_LOWP_BOOL))
typedef aligned_lowp_bvec1 aligned_bvec1;
typedef aligned_lowp_bvec2 aligned_bvec2;
typedef aligned_lowp_bvec3 aligned_bvec3;
typedef aligned_lowp_bvec4 aligned_bvec4;
#elif(defined(GLM_PRECISION_MEDIUMP_BOOL))
typedef aligned_mediump_bvec1 aligned_bvec1;
typedef aligned_mediump_bvec2 aligned_bvec2;
typedef aligned_mediump_bvec3 aligned_bvec3;
typedef aligned_mediump_bvec4 aligned_bvec4;
#else //defined(GLM_PRECISION_HIGHP_BOOL)
/// 1 component vector of boolean.
typedef aligned_highp_bvec1 aligned_bvec1;
/// 2 components vector of boolean.
typedef aligned_highp_bvec2 aligned_bvec2;
/// 3 components vector of boolean.
typedef aligned_highp_bvec3 aligned_bvec3;
/// 4 components vector of boolean.
typedef aligned_highp_bvec4 aligned_bvec4;
#endif//GLM_PRECISION
/// @}
}//namespace glm
| 39.035912 | 74 | 0.813884 | caolongcl |
b6c78f8217e5d68b46050dd74cec7336034f4b35 | 2,478 | cpp | C++ | problemsets/Codejam/2011/ROUND 1A/PD/PD.cpp | juarezpaulino/coderemite | a4649d3f3a89d234457032d14a6646b3af339ac1 | [
"Apache-2.0"
] | null | null | null | problemsets/Codejam/2011/ROUND 1A/PD/PD.cpp | juarezpaulino/coderemite | a4649d3f3a89d234457032d14a6646b3af339ac1 | [
"Apache-2.0"
] | null | null | null | problemsets/Codejam/2011/ROUND 1A/PD/PD.cpp | juarezpaulino/coderemite | a4649d3f3a89d234457032d14a6646b3af339ac1 | [
"Apache-2.0"
] | null | null | null | /**
*
* Author: Juarez Paulino(coderemite)
* Email: juarez.paulino@gmail.com
*
*/
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <climits>
#include <string>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <numeric>
using namespace std;
#define FOR(i,a,b) for (int (i) = (a); (i) < (b); (i)++)
#define _FORIT(it, b, e) for (__typeof(b) it = (b); it != (e); it++)
#define FORIT(x...) _FORIT(x)
#define ALL(M) (M).begin(), (M).end()
#define CLR(M, v) memset(M, v, sizeof(M))
#define SI(V) (int)(V.size())
#define PB push_back
#define MP make_pair
#define SORT(M) sort(ALL(M))
template<class T> inline void SORTG(vector<T> &M) { sort(ALL(M), greater<T>()); }
#define UNIQUE(v) SORT(v),(v).resize(unique(ALL(v))-(v).begin())
typedef long long i64;
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int,int> PII;
const int INF = 0x3F3F3F3F;
const i64 LINF = 0x3F3F3F3F3F3F3F3FLL;
const double DINF = 1E14;
const double EPS = 1E-14;
const double PI = 3.1415926535897932384626433832795;
inline int cmp(double x, double y = 0, double tol = EPS) {
return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}
template<class T> T SQR(T x) { return x*x; }
template <class T> T gcd(T a, T b) { return (b!=0) ? gcd(b, a % b) : a; }
////////////////////////////////////////////////////////////////////////////////
int main() {
// freopen("D.in","r",stdin);
// freopen("D-small-attempt0.in","r",stdin);freopen("D-small-attempt0.out","w",stdout);
// freopen("D-small-attempt1.in","r",stdin);freopen("D-small-attempt1.out","w",stdout);
// freopen("D-small-attempt2.in","r",stdin);freopen("D-small-attempt2.out","w",stdout);
freopen("D-large.in","r",stdin);freopen("D-large.ans","w",stdout);
int TC;
scanf("%d ", &TC);
for (int tc = 1; tc <= TC; tc++) {
int N;
int V[1010];
// Read input.
scanf("%d", &N);
for (int i = 1; i <= N; i++) scanf("%d", V+i);
// Process cycles and count result.
int VIS[1010] = {0};
int ret = 0;
for (int i = 1; i <= N; i++) if (!VIS[i]) {
int c = 0;
int p = i;
while (!VIS[p]) {
VIS[p] = 1;
c++;
p = V[p];
}
if (c != 1) ret += c;
}
// Prints result.
printf("Case #%d: %.10lf\n", tc, (double)ret);
}
return 0;
}
| 25.546392 | 87 | 0.536723 | juarezpaulino |
b6d1ccd1a0ccd57e72bd16a71d645bcb3c3c5134 | 118 | cpp | C++ | project762/src/component315/cpp/lib3.cpp | gradle/perf-native-large | af00fd258fbe9c7d274f386e46847fe12062cc71 | [
"Apache-2.0"
] | 2 | 2016-11-23T17:25:24.000Z | 2016-11-23T17:25:27.000Z | project762/src/component315/cpp/lib3.cpp | gradle/perf-native-large | af00fd258fbe9c7d274f386e46847fe12062cc71 | [
"Apache-2.0"
] | 15 | 2016-09-15T03:19:32.000Z | 2016-09-17T09:15:32.000Z | project762/src/component315/cpp/lib3.cpp | gradle/perf-native-large | af00fd258fbe9c7d274f386e46847fe12062cc71 | [
"Apache-2.0"
] | 2 | 2019-11-09T16:26:55.000Z | 2021-01-13T10:51:09.000Z | #include <stdio.h>
#include <component315/lib1.h>
int component315_3 () {
printf("Hello world!\n");
return 0;
}
| 13.111111 | 30 | 0.661017 | gradle |
b6d2f0b95dd1f4736c1502bcb8a27d87bd826a0f | 1,531 | cpp | C++ | test/TestTypeList.cpp | peterlauro/type_list | 945695a5d45362f2a676945d49675b0e78dbee3f | [
"Apache-2.0"
] | null | null | null | test/TestTypeList.cpp | peterlauro/type_list | 945695a5d45362f2a676945d49675b0e78dbee3f | [
"Apache-2.0"
] | null | null | null | test/TestTypeList.cpp | peterlauro/type_list | 945695a5d45362f2a676945d49675b0e78dbee3f | [
"Apache-2.0"
] | null | null | null | #include <type_list.h>
#include <gtest/gtest.h>
namespace stdx::test
{
struct literal
{
constexpr literal() = default;
};
TEST(TypeList, class_template_argument_deduction)
{
{
using my_type_list = stdx::type_list<int, double, literal>;
stdx::type_list tl(int{}, double{}, literal{});
static_assert(std::is_same_v<decltype(tl), my_type_list>);
int val = 0;
if constexpr (std::is_same_v<decltype(tl), my_type_list>)
{
++val;
}
EXPECT_EQ(val, 1);
}
{
using my_type_list = stdx::type_list<int, float, char>;
stdx::type_list tl(1, 0.5f, 'c');
static_assert(std::is_same_v<decltype(tl), my_type_list>);
int val = 0;
if constexpr (std::is_same_v<decltype(tl), my_type_list>)
{
++val;
}
EXPECT_EQ(val, 1);
}
{
using my_type_list = stdx::type_list<int, float, char>;
int i = 5;
float f = 2.0f;
char c = 'f';
stdx::type_list tl(i, f, c);
static_assert(std::is_same_v<decltype(tl), my_type_list>);
int val = 0;
if constexpr (std::is_same_v<decltype(tl), my_type_list>)
{
++val;
}
EXPECT_EQ(val, 1);
}
{
using my_type_list = stdx::type_list<>; //empty type list
stdx::type_list tl;
static_assert(std::is_same_v<decltype(tl), my_type_list>);
int val = 0;
if constexpr (std::is_same_v<decltype(tl), my_type_list>)
{
++val;
}
EXPECT_EQ(val, 1);
}
}
}
| 23.553846 | 65 | 0.568256 | peterlauro |
b6d3feda37fa4e0f6bec953600d6261b6a710baf | 2,357 | cpp | C++ | src/core/header_chain.cpp | mbroemme/bamboo | 07e8a42fa90d9ddd4ea6cfc55f000277b65e5d1b | [
"MIT"
] | null | null | null | src/core/header_chain.cpp | mbroemme/bamboo | 07e8a42fa90d9ddd4ea6cfc55f000277b65e5d1b | [
"MIT"
] | null | null | null | src/core/header_chain.cpp | mbroemme/bamboo | 07e8a42fa90d9ddd4ea6cfc55f000277b65e5d1b | [
"MIT"
] | null | null | null | #include "header_chain.hpp"
#include "api.hpp"
#include "block.hpp"
#include "logger.hpp"
#include <iostream>
using namespace std;
HeaderChain::HeaderChain(string host) {
this->host = host;
this->failed = false;
this->totalWork = 0;
this->chainLength = 0;
}
bool HeaderChain::valid() {
return !this->failed && this->totalWork > 0;
}
string HeaderChain::getHost() {
return this->host;
}
Bigint HeaderChain::getTotalWork() {
if (this->failed) return 0;
return this->totalWork;
}
uint64_t HeaderChain::getChainLength() {
if (this->failed) return 0;
return this->chainLength;
}
void HeaderChain::load() {
uint64_t targetBlockCount;
try {
targetBlockCount = getCurrentBlockCount(this->host);
} catch (...) {
this->failed = true;
return;
}
SHA256Hash lastHash = NULL_SHA256_HASH;
uint64_t numBlocks = 0;
Bigint totalWork = 0;
// download any remaining blocks in batches
for(int i = 1; i <= targetBlockCount; i+=BLOCK_HEADERS_PER_FETCH) {
try {
int end = min(targetBlockCount, (uint64_t) i + BLOCK_HEADERS_PER_FETCH - 1);
bool failure = false;
vector<SHA256Hash>& hashes = this->blockHashes;
vector<BlockHeader> blockHeaders;
readRawHeaders(this->host, i, end, blockHeaders);
for (auto& b : blockHeaders) {
if (failure) return;
vector<Transaction> empty;
Block block(b, empty);
if (!block.verifyNonce()) {
failure = true;
break;
};
if (block.getLastBlockHash() != lastHash) {
failure = true;
break;
}
lastHash = block.getHash();
hashes.push_back(lastHash);
totalWork = addWork(totalWork, block.getDifficulty());
numBlocks++;
}
if (failure) {
this->failed = true;
return;
}
} catch (std::exception& e) {
this->failed = true;
return;
} catch (...) {
this->failed = true;
return;
}
}
this->chainLength = numBlocks;
this->totalWork = totalWork;
this->failed = false;
}
| 27.406977 | 88 | 0.536699 | mbroemme |
b6d4cc78319054635e348aded64612294078730c | 563 | cpp | C++ | July LeetCode Challenge/Day_19.cpp | mishrraG/100DaysOfCode | 3358af290d4f05889917808d68b95f37bd76e698 | [
"MIT"
] | 13 | 2020-08-10T14:06:37.000Z | 2020-09-24T14:21:33.000Z | July LeetCode Challenge/Day_19.cpp | mishrraG/DaysOfCP | 3358af290d4f05889917808d68b95f37bd76e698 | [
"MIT"
] | null | null | null | July LeetCode Challenge/Day_19.cpp | mishrraG/DaysOfCP | 3358af290d4f05889917808d68b95f37bd76e698 | [
"MIT"
] | 1 | 2020-05-31T21:09:14.000Z | 2020-05-31T21:09:14.000Z | class Solution {
public:
string addBinary(string a, string b) {
int n1 = a.size() - 1;
int n2 = b.size() - 1;
int carry = 0;
int sum = 0;
string s;
while (n1 >= 0 || n2 >= 0) {
int c1 = n1 >= 0 ? a[n1] - '0' : 0;
int c2 = n2 >= 0 ? b[n2] - '0' : 0;
sum = c1 + c2 + carry;
carry = 0;
if (sum == 2) {
sum = 0;
carry = 1;
}
if (sum == 3) {
sum = 1;
carry = 1;
}
s.push_back(sum + '0');
n1--;
n2--;
}
if (carry != 0) {
s.push_back(carry + '0');
}
reverse(s.begin(), s.end());
return s;
}
}; | 17.060606 | 39 | 0.436945 | mishrraG |
b6d8fcc2ea0b4a861850a233402fef00db4b63d6 | 643 | cpp | C++ | ares/ws/cpu/dma.cpp | CasualPokePlayer/ares | 58690cd5fc7bb6566c22935c5b80504a158cca29 | [
"BSD-3-Clause"
] | 153 | 2020-07-25T17:55:29.000Z | 2021-10-01T23:45:01.000Z | ares/ws/cpu/dma.cpp | CasualPokePlayer/ares | 58690cd5fc7bb6566c22935c5b80504a158cca29 | [
"BSD-3-Clause"
] | 245 | 2021-10-08T09:14:46.000Z | 2022-03-31T08:53:13.000Z | ares/ws/cpu/dma.cpp | CasualPokePlayer/ares | 58690cd5fc7bb6566c22935c5b80504a158cca29 | [
"BSD-3-Clause"
] | 44 | 2020-07-25T08:51:55.000Z | 2021-09-25T16:09:01.000Z | auto CPU::DMA::transfer() -> void {
//length of 0 or SRAM source address cause immediate termination
if(length == 0 || source.byte(2) == 1) {
enable = 0;
return;
}
self.step(5);
while(length) {
self.step(2);
u16 data = 0;
//once DMA is started; SRAM reads still incur time penalty, but do not transfer
if(source.byte(2) != 1) {
data |= self.read(source + 0) << 0;
data |= self.read(source + 1) << 8;
self.write(target + 0, data >> 0);
self.write(target + 1, data >> 8);
}
source += direction ? -2 : +2;
target += direction ? -2 : +2;
length -= 2;
};
enable = 0;
}
| 25.72 | 83 | 0.547434 | CasualPokePlayer |
b6ddb1a6f3165d14c46d927f42011fc2a07b03aa | 10,912 | cpp | C++ | Src/Common/prefix.cpp | vinjn/glintercept | f82166d3a774bfb02459f6b3ae2a03d4c9eaf64f | [
"MIT"
] | 468 | 2015-04-13T19:03:57.000Z | 2022-03-23T00:11:24.000Z | Src/Common/prefix.cpp | vinjn/glintercept | f82166d3a774bfb02459f6b3ae2a03d4c9eaf64f | [
"MIT"
] | 12 | 2015-05-25T11:15:21.000Z | 2020-10-26T02:46:50.000Z | Src/Common/prefix.cpp | vinjn/glintercept | f82166d3a774bfb02459f6b3ae2a03d4c9eaf64f | [
"MIT"
] | 67 | 2015-04-22T13:22:48.000Z | 2022-03-05T01:11:02.000Z | /*
* BinReloc - a library for creating relocatable executables
* Written by: Mike Hearn <mike@theoretic.com>
* Hongli Lai <h.lai@chello.nl>
* http://autopackage.org/
*
* This source code is public domain. You can relicense this code
* under whatever license you want.
*
* NOTE: if you're using C++ and are getting "undefined reference
* to br_*", try renaming prefix.c to prefix.cpp
*/
/* WARNING, BEFORE YOU MODIFY PREFIX.C:
*
* If you make changes to any of the functions in prefix.c, you MUST
* change the BR_NAMESPACE macro (in prefix.h).
* This way you can avoid symbol table conflicts with other libraries
* that also happen to use BinReloc.
*
* Example:
* #define BR_NAMESPACE(funcName) foobar_ ## funcName
* --> expands br_locate to foobar_br_locate
*/
#ifndef _PREFIX_C_
#define _PREFIX_C_
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifndef BR_PTHREADS
/* Change 1 to 0 if you don't want pthread support */
#define BR_PTHREADS 1
#endif /* BR_PTHREADS */
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <string.h>
#include "prefix.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#undef NULL
#define NULL ((void *) 0)
#ifdef __GNUC__
#define br_return_val_if_fail(expr,val) if (!(expr)) {fprintf (stderr, "** BinReloc (%s): assertion %s failed\n", __PRETTY_FUNCTION__, #expr); return val;}
#else
#define br_return_val_if_fail(expr,val) if (!(expr)) return val
#endif /* __GNUC__ */
static br_locate_fallback_func fallback_func = (br_locate_fallback_func) NULL;
static void *fallback_data = NULL;
#ifdef ENABLE_BINRELOC
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <unistd.h>
/**
* br_locate:
* symbol: A symbol that belongs to the app/library you want to locate.
* Returns: A newly allocated string containing the full path of the
* app/library that func belongs to, or NULL on error. This
* string should be freed when not when no longer needed.
*
* Finds out to which application or library symbol belongs, then locate
* the full path of that application or library.
* Note that symbol cannot be a pointer to a function. That will not work.
*
* Example:
* --> main.c
* #include "prefix.h"
* #include "libfoo.h"
*
* int main (int argc, char *argv[]) {
* printf ("Full path of this app: %s\n", br_locate (&argc));
* libfoo_start ();
* return 0;
* }
*
* --> libfoo.c starts here
* #include "prefix.h"
*
* void libfoo_start () {
* --> "" is a symbol that belongs to libfoo (because it's called
* --> from libfoo_start()); that's why this works.
* printf ("libfoo is located in: %s\n", br_locate (""));
* }
*/
char *
br_locate (void *symbol)
{
char line[5000];
FILE *f;
char *path;
br_return_val_if_fail (symbol != NULL, NULL);
f = fopen ("/proc/self/maps", "r");
if (!f) {
if (fallback_func)
return fallback_func(symbol, fallback_data);
else
return NULL;
}
while (!feof (f))
{
unsigned long start, end;
if (!fgets (line, sizeof (line), f))
continue;
if (!strstr (line, " r-xp ") || !strchr (line, '/'))
continue;
sscanf (line, "%lx-%lx ", &start, &end);
if (symbol >= (void *) start && symbol < (void *) end)
{
char *tmp;
size_t len;
/* Extract the filename; it is always an absolute path */
path = strchr (line, '/');
/* Get rid of the newline */
tmp = strrchr (path, '\n');
if (tmp) *tmp = 0;
/* Get rid of "(deleted)" */
len = strlen (path);
if (len > 10 && strcmp (path + len - 10, " (deleted)") == 0)
{
tmp = path + len - 10;
*tmp = 0;
}
fclose(f);
return strdup (path);
}
}
fclose (f);
return NULL;
}
/**
* br_locate_prefix:
* symbol: A symbol that belongs to the app/library you want to locate.
* Returns: A prefix. This string should be freed when no longer needed.
*
* Locates the full path of the app/library that symbol belongs to, and return
* the prefix of that path, or NULL on error.
* Note that symbol cannot be a pointer to a function. That will not work.
*
* Example:
* --> This application is located in /usr/bin/foo
* br_locate_prefix (&argc); --> returns: "/usr"
*/
char *
br_locate_prefix (void *symbol)
{
char *path, *prefix;
br_return_val_if_fail (symbol != NULL, NULL);
path = br_locate (symbol);
if (!path) return NULL;
prefix = br_extract_prefix (path);
free (path);
return prefix;
}
/**
* br_prepend_prefix:
* symbol: A symbol that belongs to the app/library you want to locate.
* path: The path that you want to prepend the prefix to.
* Returns: The new path, or NULL on error. This string should be freed when no
* longer needed.
*
* Gets the prefix of the app/library that symbol belongs to. Prepend that prefix to path.
* Note that symbol cannot be a pointer to a function. That will not work.
*
* Example:
* --> The application is /usr/bin/foo
* br_prepend_prefix (&argc, "/share/foo/data.png"); --> Returns "/usr/share/foo/data.png"
*/
char *
br_prepend_prefix (void *symbol, char *path)
{
char *tmp, *newpath;
br_return_val_if_fail (symbol != NULL, NULL);
br_return_val_if_fail (path != NULL, NULL);
tmp = br_locate_prefix (symbol);
if (!tmp) return NULL;
if (strcmp (tmp, "/") == 0)
newpath = strdup (path);
else
newpath = br_strcat (tmp, path);
/* Get rid of compiler warning ("br_prepend_prefix never used") */
if (0) br_prepend_prefix (NULL, NULL);
free (tmp);
return newpath;
}
#endif /* ENABLE_BINRELOC */
/* Pthread stuff for thread safetiness */
#if BR_PTHREADS && defined(ENABLE_BINRELOC)
#include <pthread.h>
static pthread_key_t br_thread_key;
static pthread_once_t br_thread_key_once = PTHREAD_ONCE_INIT;
static void
br_thread_local_store_fini ()
{
char *specific;
specific = (char *) pthread_getspecific (br_thread_key);
if (specific)
{
free (specific);
pthread_setspecific (br_thread_key, NULL);
}
pthread_key_delete (br_thread_key);
br_thread_key = 0;
}
static void
br_str_free (void *str)
{
if (str)
free (str);
}
static void
br_thread_local_store_init ()
{
if (pthread_key_create (&br_thread_key, br_str_free) == 0)
atexit (br_thread_local_store_fini);
}
#else /* BR_PTHREADS */
#ifdef ENABLE_BINRELOC
static char *br_last_value = (char *) NULL;
static void
br_free_last_value ()
{
if (br_last_value)
free (br_last_value);
}
#endif /* ENABLE_BINRELOC */
#endif /* BR_PTHREADS */
#ifdef ENABLE_BINRELOC
/**
* br_thread_local_store:
* str: A dynamically allocated string.
* Returns: str. This return value must not be freed.
*
* Store str in a thread-local variable and return str. The next
* you run this function, that variable is freed too.
* This function is created so you don't have to worry about freeing
* strings. Just be careful about doing this sort of thing:
*
* some_function( BR_DATADIR("/one.png"), BR_DATADIR("/two.png") )
*
* Examples:
* char *foo;
* foo = br_thread_local_store (strdup ("hello")); --> foo == "hello"
* foo = br_thread_local_store (strdup ("world")); --> foo == "world"; "hello" is now freed.
*/
const char *
br_thread_local_store (char *str)
{
#if BR_PTHREADS
char *specific;
pthread_once (&br_thread_key_once, br_thread_local_store_init);
specific = (char *) pthread_getspecific (br_thread_key);
br_str_free (specific);
pthread_setspecific (br_thread_key, str);
#else /* BR_PTHREADS */
static int initialized = 0;
if (!initialized)
{
atexit (br_free_last_value);
initialized = 1;
}
if (br_last_value)
free (br_last_value);
br_last_value = str;
#endif /* BR_PTHREADS */
return (const char *) str;
}
#endif /* ENABLE_BINRELOC */
/**
* br_strcat:
* str1: A string.
* str2: Another string.
* Returns: A newly-allocated string. This string should be freed when no longer needed.
*
* Concatenate str1 and str2 to a newly allocated string.
*/
char *
br_strcat (const char *str1, const char *str2)
{
char *result;
size_t len1, len2;
if (!str1) str1 = "";
if (!str2) str2 = "";
len1 = strlen (str1);
len2 = strlen (str2);
result = (char *) malloc (len1 + len2 + 1);
memcpy (result, str1, len1);
memcpy (result + len1, str2, len2);
result[len1 + len2] = '\0';
return result;
}
/* Emulates glibc's strndup() */
static char *
br_strndup (char *str, size_t size)
{
char *result = (char *) NULL;
size_t len;
br_return_val_if_fail (str != (char *) NULL, (char *) NULL);
len = strlen (str);
if (!len) return strdup ("");
if (size > len) size = len;
result = (char *) calloc (sizeof (char), len + 1);
memcpy (result, str, size);
return result;
}
/**
* br_extract_dir:
* path: A path.
* Returns: A directory name. This string should be freed when no longer needed.
*
* Extracts the directory component of path. Similar to g_dirname() or the dirname
* commandline application.
*
* Example:
* br_extract_dir ("/usr/local/foobar"); --> Returns: "/usr/local"
*/
char *
br_extract_dir (const char *path)
{
char *end, *result;
br_return_val_if_fail (path != (char *) NULL, (char *) NULL);
end = strrchr (const_cast<char*>(path), '/');
if (!end) return strdup (".");
while (end > path && *end == '/')
end--;
result = br_strndup ((char *) path, end - path + 1);
if (!*result)
{
free (result);
return strdup ("/");
} else
return result;
}
/**
* br_extract_prefix:
* path: The full path of an executable or library.
* Returns: The prefix, or NULL on error. This string should be freed when no longer needed.
*
* Extracts the prefix from path. This function assumes that your executable
* or library is installed in an LSB-compatible directory structure.
*
* Example:
* br_extract_prefix ("/usr/bin/gnome-panel"); --> Returns "/usr"
* br_extract_prefix ("/usr/local/lib/libfoo.so"); --> Returns "/usr/local"
* br_extract_prefix ("/usr/local/libfoo.so"); --> Returns "/usr"
*/
char *
br_extract_prefix (const char *path)
{
char *end, *tmp, *result;
br_return_val_if_fail (path != (char *) NULL, (char *) NULL);
if (!*path) return strdup ("/");
end = strrchr (const_cast<char*>(path), '/');
if (!end) return strdup (path);
tmp = br_strndup ((char *) path, end - path);
if (!*tmp)
{
free (tmp);
return strdup ("/");
}
end = strrchr (tmp, '/');
if (!end) return tmp;
result = br_strndup (tmp, end - tmp);
free (tmp);
if (!*result)
{
free (result);
result = strdup ("/");
}
return result;
}
/**
* br_set_fallback_function:
* func: A function to call to find the binary.
* data: User data to pass to func.
*
* Sets a function to call to find the path to the binary, in
* case "/proc/self/maps" can't be opened. The function set should
* return a string that is safe to free with free().
*/
void
br_set_locate_fallback_func (br_locate_fallback_func func, void *data)
{
fallback_func = func;
fallback_data = data;
}
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _PREFIX_C */
| 22.592133 | 156 | 0.666331 | vinjn |
b6e37bea2bb13f26e877d500567604e4946de8cb | 745 | cpp | C++ | main/big-sorting/big-sorting.cpp | EliahKagan/old-practice-snapshot | 1b53897eac6902f8d867c8f154ce2a489abb8133 | [
"0BSD"
] | null | null | null | main/big-sorting/big-sorting.cpp | EliahKagan/old-practice-snapshot | 1b53897eac6902f8d867c8f154ce2a489abb8133 | [
"0BSD"
] | null | null | null | main/big-sorting/big-sorting.cpp | EliahKagan/old-practice-snapshot | 1b53897eac6902f8d867c8f154ce2a489abb8133 | [
"0BSD"
] | null | null | null | #include <algorithm>
#include <iostream>
#include <iterator>
#include <string>
#include <utility>
#include <vector>
namespace {
std::vector<std::string> get_strings()
{
std::vector<std::string>::size_type n {};
std::cin >> n;
std::vector<std::string> a;
a.reserve(n);
for (std::string s; n != 0u; --n) {
std::cin >> s;
a.push_back(std::move(s));
}
return a;
}
}
int main()
{
auto a = get_strings();
std::sort(std::begin(a), std::end(a), [](const auto& s, const auto& t) {
const auto slen = s.size(), tlen = t.size();
return slen == tlen ? s < t : slen < tlen;
});
for (const auto& w : a) std::cout << w << '\n';
}
| 20.135135 | 76 | 0.504698 | EliahKagan |
b6e503221d683591490f46a242856e349da208ab | 402 | hpp | C++ | wrbb-v2lib-firm/firmware/gr_common/lib/ArduinoJson/ArduinoJson/Numbers/Integer.hpp | h7ga40/gr_citrus | 07d450b9cc857997c97519e962572b92501282d6 | [
"MIT"
] | 1 | 2018-12-04T02:38:37.000Z | 2018-12-04T02:38:37.000Z | wrbb-v2lib-firm/firmware/gr_common/lib/ArduinoJson/ArduinoJson/Numbers/Integer.hpp | h7ga40/gr_citrus | 07d450b9cc857997c97519e962572b92501282d6 | [
"MIT"
] | 3 | 2019-08-15T06:59:48.000Z | 2019-10-16T10:02:09.000Z | wrbb-v2lib-firm/firmware/gr_common/lib/ArduinoJson/ArduinoJson/Numbers/Integer.hpp | h7ga40/gr_citrus | 07d450b9cc857997c97519e962572b92501282d6 | [
"MIT"
] | 1 | 2019-02-22T08:27:15.000Z | 2019-02-22T08:27:15.000Z | // ArduinoJson - arduinojson.org
// Copyright Benoit Blanchon 2014-2019
// MIT License
#pragma once
#include "../Configuration.hpp"
#include <stdint.h> // int64_t
namespace ARDUINOJSON_NAMESPACE {
#if ARDUINOJSON_USE_LONG_LONG
typedef int64_t Integer;
typedef uint64_t UInt;
#else
typedef long Integer;
typedef unsigned long UInt;
#endif
} // namespace ARDUINOJSON_NAMESPACE
| 19.142857 | 39 | 0.738806 | h7ga40 |
b6e5fddc9312308e7f4772b027e76a4161050cde | 2,416 | hh | C++ | include/dsfs.hh | hspabla/DFS-FUSE | a47e30616f31a78fba23b2b1b0ddb25c97c7beea | [
"Apache-2.0"
] | 3 | 2020-04-08T10:32:44.000Z | 2022-02-17T07:04:07.000Z | include/dsfs.hh | hspabla/DFS-FUSE | a47e30616f31a78fba23b2b1b0ddb25c97c7beea | [
"Apache-2.0"
] | 1 | 2019-10-25T12:24:20.000Z | 2019-10-25T12:24:20.000Z | include/dsfs.hh | hspabla/DFS-FUSE | a47e30616f31a78fba23b2b1b0ddb25c97c7beea | [
"Apache-2.0"
] | null | null | null |
#ifndef dsfs_hh
#define dsfs_hh
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <fuse.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/xattr.h>
#include <unistd.h>
#include <vector>
#include <unordered_map>
#include "log.hh"
#include <map>
//using namespace std;
class DSFS {
private:
const char *_root;
static DSFS *_instance;
std::unordered_map<std::string, std::string> mount_map;
void AbsPath(char dest[PATH_MAX], const char *path);
// temp buffer we keep for files which are written but not yet fsync'ed
// Incase we have to retransmit the data
std::map<int, std::string> dataBuffer;
public:
static DSFS *Instance();
DSFS();
~DSFS();
void setRootDir(const char *path);
int Getattr(const char *path, struct stat *statbuf);
int Mknod(const char *path, mode_t mode, dev_t dev);
int Mkdir(const char *path, mode_t mode);
int Unlink(const char *path);
int Rmdir(const char *path);
int Rename(const char *path, const char *newpath);
int Chmod(const char *path, mode_t mode);
int Chown(const char *path, uid_t uid, gid_t gid);
int Truncate(const char *path, off_t newSize);
int Access(const char *path, int mask);
int Open(const char *path, struct fuse_file_info *fileInfo);
int Read(const char *path, char *buf, size_t size, off_t offset, struct fuse_file_info *fileInfo);
int Write(const char *path, const char *buf, size_t size, off_t offset, struct fuse_file_info *fileInfo);
int Release(const char *path, struct fuse_file_info *fileInfo);
int Fsync(const char *path, int datasync, struct fuse_file_info *fi);
int Setxattr(const char *path, const char *name, const char *value, size_t size, int flags);
int Getxattr(const char *path, const char *name, char *value, size_t size);
int Listxattr(const char *path, char *list, size_t size);
int Removexattr(const char *path, const char *name);
int Readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fileInfo);
int Releasedir(const char *path, struct fuse_file_info *fileInfo);
int Init(struct fuse_conn_info *conn);
//int Flush(const char *path, struct fuse_file_info *fileInfo);
};
#endif //dsfs_hh
| 33.555556 | 120 | 0.682119 | hspabla |
b6e7e930580d7745467e975c038790b896bc10e2 | 1,167 | cpp | C++ | develop/patch.cpp | chriku/cserial | 70fb65373d73757ef58c92195d5b4de0a7f3ba87 | [
"BSD-3-Clause"
] | null | null | null | develop/patch.cpp | chriku/cserial | 70fb65373d73757ef58c92195d5b4de0a7f3ba87 | [
"BSD-3-Clause"
] | null | null | null | develop/patch.cpp | chriku/cserial | 70fb65373d73757ef58c92195d5b4de0a7f3ba87 | [
"BSD-3-Clause"
] | null | null | null | #include "cserial/patch.hpp"
#include "cserial/serialize.hpp"
#include <iostream>
using namespace std::literals;
struct file_content3 {
bool a = false;
};
template <>
struct cserial::serial<file_content3> : serializer<"file_content3", //
field<&file_content3::a, "a">> {};
struct file_content2 {
bool x = false;
};
template <> struct cserial::serial<file_content2> : converter<file_content2, file_content3> {
static void convert(const file_content2& a, file_content3& b) { b.a = a.x; }
static void unconvert(const file_content3& a, file_content2& b) { b.x = a.a; }
};
struct file_content {
file_content2 x;
std::optional<bool> y = true;
};
template <>
struct cserial::serial<file_content> : serializer<"file_content", //
field<&file_content::x, "x">, field<&file_content::y, "y">> {};
int main() {
file_content fc;
cserial::patch::patch p;
std::cout << std::boolalpha << fc.x.x << std::endl;
cserial::patch::apply<file_content>(fc, R"(
{"x":{"a": true},"y":{"1": true}}
)"_json);
std::cout << std::boolalpha << fc.x.x << std::endl;
}
| 30.710526 | 113 | 0.610968 | chriku |
b6ea3fb5ca44876eec9baa809f3cd0b2b23ab2cc | 3,806 | hpp | C++ | ModSource/breakingpoint_ui/config/unused/CfgCommunicationMenu.hpp | nrailuj/breakingpointmod | e102e106b849ca78deb3cb299f3ae18c91c3bfe9 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | 70 | 2017-06-23T21:25:05.000Z | 2022-03-27T02:39:33.000Z | ModSource/breakingpoint_ui/config/unused/CfgCommunicationMenu.hpp | nrailuj/breakingpointmod | e102e106b849ca78deb3cb299f3ae18c91c3bfe9 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | 84 | 2017-08-26T22:06:28.000Z | 2021-09-09T15:32:56.000Z | ModSource/breakingpoint_ui/config/unused/CfgCommunicationMenu.hpp | nrailuj/breakingpointmod | e102e106b849ca78deb3cb299f3ae18c91c3bfe9 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | 71 | 2017-06-24T01:10:42.000Z | 2022-03-18T23:02:00.000Z | // Generated by unRap v1.06 by Kegetys
class CfgCommunicationMenu {
class Default {
text = "";
submenu = "";
expression = "";
icon = "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\call_ca.paa";
iconText = "";
cursor = "";
enable = "";
};
class A {
text = $STR_A3_RADIO_A;
iconText = "A";
expression = "%1";
};
class B {
text = $STR_A3_RADIO_B;
iconText = "B";
expression = "%1";
};
class C {
text = $STR_A3_RADIO_C;
iconText = "C";
expression = "%1";
};
class D {
text = $STR_A3_RADIO_D;
iconText = "D";
expression = "%1";
};
class E {
text = $STR_A3_RADIO_E;
iconText = "E";
expression = "%1";
};
class F {
text = $STR_A3_RADIO_F;
iconText = "F";
expression = "%1";
};
class G {
text = $STR_A3_RADIO_G;
iconText = "G";
expression = "%1";
};
class H {
text = $STR_A3_RADIO_H;
iconText = "H";
expression = "%1";
};
class I {
text = $STR_A3_RADIO_I;
iconText = "I";
expression = "%1";
};
class J {
text = $STR_A3_RADIO_J;
iconText = "J";
expression = "%1";
};
class K {
text = $STR_A3_RADIO_K;
iconText = "K";
expression = "%1";
};
class L {
text = $STR_A3_RADIO_L;
iconText = "L";
expression = "%1";
};
class M {
text = $STR_A3_RADIO_M;
iconText = "M";
expression = "%1";
};
class N {
text = $STR_A3_RADIO_N;
iconText = "N";
expression = "%1";
};
class O {
text = $STR_A3_RADIO_O;
iconText = "O";
expression = "%1";
};
class P {
text = $STR_A3_RADIO_P;
iconText = "P";
expression = "%1";
};
class Q {
text = $STR_A3_RADIO_Q;
iconText = "Q";
expression = "%1";
};
class R {
text = $STR_A3_RADIO_R;
iconText = "R";
expression = "%1";
};
class S {
text = $STR_A3_RADIO_S;
iconText = "S";
expression = "%1";
};
class T {
text = $STR_A3_RADIO_T;
iconText = "T";
expression = "%1";
};
class U {
text = $STR_A3_RADIO_U;
iconText = "U";
expression = "%1";
};
class V {
text = $STR_A3_RADIO_V;
iconText = "V";
expression = "%1";
};
class W {
text = $STR_A3_RADIO_W;
iconText = "W";
expression = "%1";
};
class X {
text = $STR_A3_RADIO_X;
iconText = "X";
expression = "%1";
};
class Y {
text = $STR_A3_RADIO_Y;
iconText = "Y";
expression = "%1";
};
class Z {
text = $STR_A3_RADIO_Z;
iconText = "Z";
expression = "%1";
};
class Call {
text = "$STR_A3_CfgCommunicationMenu_Call_0";
icon = "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\call_ca.paa";
expression = "%1";
};
class Attack {
text = "$STR_A3_CfgCommunicationMenu_Attack_0";
icon = "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\attack_ca.paa";
expression = "%1";
};
class Defend {
text = "$STR_A3_CfgCommunicationMenu_Defend_0";
icon = "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\defend_ca.paa";
expression = "%1";
};
class ArtilleryBase {
text = "$STR_A3_mdl_supp_disp_artillery";
icon = "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\artillery_ca.paa";
cursor = "\A3\ui_f\data\igui\cfg\cursors\iconCursorSupport_ca.paa";
};
class MortarBase {
icon = "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\mortar_ca.paa";
cursor = "\A3\ui_f\data\igui\cfg\cursors\iconCursorSupport_ca.paa";
};
class CASBase {
icon = "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\cas_ca.paa";
cursor = "\A3\ui_f\data\igui\cfg\cursors\iconCursorSupport_ca.paa";
};
class SupplyDropBase {
text = "$STR_A3_mdl_supp_disp_drop";
icon = "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\supplydrop_ca.paa";
cursor = "\A3\ui_f\data\igui\cfg\cursors\iconCursorSupport_ca.paa";
};
class TransportBase {
text = "$STR_A3_mdl_supp_disp_transport";
icon = "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\transport_ca.paa";
cursor = "\A3\ui_f\data\igui\cfg\cursors\iconCursorSupport_ca.paa";
};
};
| 17.62037 | 69 | 0.609827 | nrailuj |
b6eb570c9b2ac7a802c69f5765f523e67005bf39 | 1,565 | cpp | C++ | uploads/test/Disaster.cpp | l3lackclevil/ARIN-grader | fdfc1ff13402ae5cf327be32733a4cc1fdecf811 | [
"Apache-2.0"
] | null | null | null | uploads/test/Disaster.cpp | l3lackclevil/ARIN-grader | fdfc1ff13402ae5cf327be32733a4cc1fdecf811 | [
"Apache-2.0"
] | null | null | null | uploads/test/Disaster.cpp | l3lackclevil/ARIN-grader | fdfc1ff13402ae5cf327be32733a4cc1fdecf811 | [
"Apache-2.0"
] | null | null | null | #include<cstdio>
#include<iostream>
#include<vector>
using namespace std;
int countt[1000]={0},check[400]={0},c=0,n,sth=0,vc[400][400]={0};
char path[400][2],ans[400],bf;
vector<int>v[1000];
void walk(int p)
{
if(c==n+1)
{
if(sth==0)
{
for(int i=0;i<c;i++)
{
printf("%c ",ans[i]);
}
printf("\n");
sth=1;
}
}
else
{
for(int i=0;i<countt[p];i++)
{
if(v[p][i]!=bf and vc[p][v[p][i]]==0)
{
bf=p;
ans[c]=v[p][i];
c++;
vc[p][v[p][i]]=1;
walk(v[p][i]);
c--;
}
}
}
}
int main()
{
char st;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
char a,b;
scanf(" %c%c",&a,&b);
countt[a]++;
countt[b]++;
if(i==0)
{
st=a;
}
v[a].push_back(b);
v[b].push_back(a);
}
for(int i=0;i<1000;i++)
{
c=0;
if(countt[i]%2>0)
{
for(int j=0;j<400;j++)
{
for(int k=0;k<400;k++)
{
vc[j][k]=0;
}
}
ans[c]=i;
c++;
bf=i;
walk(i);
}
if(sth==1)
{
break;
}
}
if(sth==0)
{
c=0;
ans[c]=st;
bf=st;
c++;
walk(st);
}
return 0;
}
| 17.197802 | 66 | 0.292013 | l3lackclevil |
b6ed298b2b87dd2507cd67a323eb786ade9d90e3 | 14,732 | cpp | C++ | src/trace/D3DStadistics/StatsManager.cpp | attila-sim/attila-sim | a64b57240b4e10dc4df7f21eff0232b28df09532 | [
"BSD-3-Clause"
] | 23 | 2016-01-14T04:47:13.000Z | 2022-01-13T14:02:08.000Z | src/trace/D3DStadistics/StatsManager.cpp | attila-sim/attila-sim | a64b57240b4e10dc4df7f21eff0232b28df09532 | [
"BSD-3-Clause"
] | 2 | 2018-03-25T14:39:20.000Z | 2022-03-18T05:11:21.000Z | src/trace/D3DStadistics/StatsManager.cpp | attila-sim/attila-sim | a64b57240b4e10dc4df7f21eff0232b28df09532 | [
"BSD-3-Clause"
] | 17 | 2016-02-13T05:35:35.000Z | 2022-03-24T16:05:40.000Z | #ifdef WORKLOAD_STATS
#include "UserStats.h"
#include "StatsManager.h"
#include <fstream>
#include <iostream>
#include "support.h"
#include "Log.h"
using namespace std;
using namespace workloadStats;
/* Create singleton */
StatsManager& StatsManager::instance()
{
/**
* @fix
*
* Previous code caused a memory leak. The changes applied follow this
* article:
*
* http://gethelp.devx.com/techtips/cpp_pro/10min/10min0200.asp
*
* Previous code:
*
* if ( !sm )
* sm = new StatsManager();
* return *sm;
**/
static StatsManager sm;
return sm;
}
StatsManager::StatsManager(bool ownership) :
maxFrame(0),
minFrame(-1),
currentFrame(1),
currentBatch(0),
nBatches(0),
perBatchStats(true),
perFrameStats(true),
perTraceStats(true),
stillInFrame(false),
ownership(ownership),
pos(0)
{
int i;
batchesInFrameCount.reserve(1000); // optimization
}
StatsManager::~StatsManager()
{
if (ownership)
{
map<string, UserStat*>::iterator it = userStats.begin();
for ( ; it != userStats.end(); it++ )
{
delete (*it).second;
}
}
};
UserStat* StatsManager::addUserStat(UserStat* stat)
{
if(userStats.find(stat->getName()) == userStats.end())
{
userStats[stat->getName()] = stat;
return stat;
}
else
panic("StatsManager.cpp","addUserStat","Already exists another User Stat with the same name");
}
UserStat* StatsManager::getUserStat(string name)
{
map<string, UserStat*>::iterator returnStat;
if((returnStat = userStats.find(name)) != userStats.end())
{
return returnStat->second;
}
else
panic("StatsManager.cpp","getUserStat","User Stats does not exists");
}
void StatsManager::setPerTraceStats( bool mode )
{
perTraceStats = mode;
}
bool StatsManager::isPerTraceStats() const
{
return perTraceStats;
}
void StatsManager::setPerBatchStats( bool mode )
{
perBatchStats = mode;
}
bool StatsManager::isPerBatchStats() const
{
return perBatchStats;
}
void StatsManager::setPerFrameStats( bool mode )
{
perFrameStats = mode;
}
bool StatsManager::isPerFrameStats() const
{
return perFrameStats;
}
void StatsManager::init( int startFrame )
{
currentFrame = startFrame-1;
pos = 0;
stillInFrame = false;
}
void StatsManager::beginBatch()
{
//cout << "ENTERING BEGIN BATCH" << endl;
if ( pos == 0 )
{
if ( perBatchStats )
pos++;
}
else
{
panic("StatsManager", "startBatch()", "Error. We are already in a batch");
}
if (!stillInFrame)
stillInFrame = true;
}
void StatsManager::endBatch()
{
//cout << "ENTERING END BATCH" << endl;
vector<int> newVect;
map<string, UserStat*>::iterator it = userStats.begin();
for ( ; it != userStats.end(); it++ )
{
(*it).second->endBatch();
}
if ( pos == 1 )
pos--;
else
{
// pos != 1
if ( perBatchStats )
panic("StatsManager", "endBatch()", "Error. We are not in a batch");
// else: counting is already in current frame
// We do not have to add current batch counting to current frame counting
currentBatch++;
nBatches++;
return ;
}
/* increase frame counters with batch counting */
/* Can be optimized reducing the number of functions supported */
/* Reduce the code generator functions generated */
currentBatch ++; /* total batches in current frame */
nBatches++; /* total batches */
}
void StatsManager::endFrame()
{
//cout << "ENTERING END FRAME" << endl;
if ( pos != 0 )
panic("StatsManager","endFrame()", "Error. We are not in a frame");
stillInFrame = false;
int i;
map<string, UserStat*>::iterator it = userStats.begin();
for ( ; it != userStats.end(); it++ )
{
(*it).second->endFrame();
}
currentFrame++;
batchesInFrameCount.push_back(currentBatch);
currentBatch = 0; /* reset batch index */
}
void StatsManager::endTrace()
{
if (stillInFrame)
endFrame();
//cout << "ENTERING END TRACE" << endl;
map<string, UserStat*>::iterator it = userStats.begin();
for ( ; it != userStats.end(); it++ )
(*it).second->endTrace();
dumpBatchStats("statsPerBatch.csv", true, 0);
dumpFrameStats("statsPerFrame.csv", true, 0);
dumpTraceStats("statsTraceFile.csv", true);
}
bool StatsManager::dumpBatchStatsVertical( const char* file , int firstFrame, int firstBatch, int lastFrame, int lastBatch)
{
firstFrame--;
firstBatch--;
ofstream f;
f.open(file);
if ( !f.is_open() )
return false; // the file could not be opened to write
unsigned int i, j, k, nB;
f << "BATCH STATS";
// Prints user stats name
map<string, UserStat*>::iterator it = userStats.begin();
for ( ; it != userStats.end(); it++ )
{
f << ";" << (*it).second->getName();
}
f << "\n";
for ( i = firstFrame; i < lastFrame; i++ )
{
nB = batchesInFrameCount[i];
if (i == firstFrame && nB > firstBatch)
j = firstBatch;
else
j = 0;
if (i == lastFrame - 1 && nB > lastBatch)
nB = lastBatch;
for (; j < nB; j++ )
{
f << "Batch " << j+1 << " (F:" << i+1 << ");";
// Write Stats
map<string, UserStat*>::iterator it2 = userStats.begin();
for ( ; it2 != userStats.end(); it2++ )
{
if (it2 != userStats.begin())
f << ";";
(*it2).second->printBatchValue(f,i,j);
}
f << "\n";
}
}
f.close();
return true;
}
bool StatsManager::dumpBatchStatsHorizontal( const char* file , int firstFrame, int firstBatch, int lastFrame, int lastBatch)
{
firstFrame--;
firstBatch--;
ofstream f;
f.open(file);
if ( !f.is_open() )
return false; // the file could not be opened to write
int i, j, k, nB;
f << "BATCH STATS";
for ( i = firstFrame; i < lastFrame; i++ )
{
nB = batchesInFrameCount[i];
if (i == firstFrame && nB > firstBatch)
j = firstBatch;
else
j = 0;
if (i == lastFrame - 1 && nB > lastBatch)
nB = lastBatch;
for (; j < nB; j++ )
f << ";Batch " << j+1 << " (F:" << i+1 << ")";
}
f << endl;
// User Stats
map<string, UserStat*>::iterator it = userStats.begin();
for ( ; it != userStats.end(); it++ )
{
f << (*it).second->getName();
for ( i = firstFrame; i < lastFrame; i++ )
{
nB = batchesInFrameCount[i];
if (i == firstFrame && nB > firstBatch)
j = firstBatch;
else
j = 0;
if (i == lastFrame - 1 && nB > lastBatch)
nB = lastBatch;
for (; j < nB; j++ )
{
f << ";" ; (*it).second->printBatchValue(f,i,j);
}
}
f << endl;
}
f << endl;
f.close();
return true;
}
void StatsManager::dumpBatchStats(const char* file, bool vertical, int splitLevel)
{
if ( !perBatchStats )
{
LOG( 0, Log::log() << "Skipped (perBatchStats = DISABLED)\n")
return;
}
bool ok = true;
if ( splitLevel <= 0 )
{
if ( vertical )
ok = dumpBatchStatsVertical(file, 1, 1, currentFrame-1, currentBatch-1);
else
ok = dumpBatchStatsHorizontal(file, 1, 1, currentFrame-1, currentBatch-1);
}
else
{
unsigned int total_batches = 0;
for (unsigned int i=0; i < currentFrame; i++)
total_batches += batchesInFrameCount[i];
unsigned int iFile, nFiles;
char fileName[256];
unsigned int frameCount = 0;
unsigned int batchesCount = 0;
unsigned int frameBatchesCount = 0;
unsigned int firstFrame, firstBatch, lastFrame, lastBatch;
nFiles = (total_batches / (splitLevel+1)) +1; // splitLevel columns with data + 1 column with labels
while ( batchesCount < total_batches && ok )
{
firstFrame = frameCount;
firstBatch = frameBatchesCount;
frameBatchesCount += splitLevel;
while (frameBatchesCount >= batchesInFrameCount[frameCount])
{
frameBatchesCount =- batchesInFrameCount[frameCount];
frameCount++;
}
batchesCount += splitLevel;
lastFrame = frameCount;
lastBatch = frameBatchesCount;
sprintf(fileName,"%s_%d-%d_%d-%d.csv", file, firstFrame + 1, firstBatch + 1, lastFrame + 1, lastBatch + 1);
if ( vertical )
ok = dumpBatchStatsVertical(fileName, firstFrame + 1, firstBatch + 1, lastFrame, lastBatch);
else
ok = dumpBatchStatsHorizontal(fileName, firstFrame + 1, firstBatch + 1, lastFrame, lastBatch);
}
}
if ( ok )
{
LOG(0, Log::log() << " OK\n";)
}
else
{
LOG(0, Log::log() << " File could not be opened for writing (maybe was already opened)\n";)
}
}
bool StatsManager::dumpFrameStatsVertical( const char* file, int firstFrame, int lastFrame )
{
firstFrame--;
ofstream f;
f.open(file);
if ( !f.is_open() )
return false; // the file could not be opened to write
unsigned int i, j;
/* Create label row */
f << "FRAME STATS";
/* API Calls accounting dump */
f << ";BATCHES"; // It is a built-in stat
// Prints user stats name
map<string, UserStat*>::iterator it = userStats.begin();
for ( ; it != userStats.end(); it++ )
{
f << ";" << (*it).second->getName();
}
f << "\n";
/* Create data rows */
for ( i = firstFrame; i < lastFrame; i++ )
{
/* Write frame */
f << (i+1) << ";";
/* Write Stats */
f << batchesInFrameCount[i] << ";"; /* Batches */
map<string, UserStat*>::iterator it2 = userStats.begin();
for ( ; it2 != userStats.end(); it2++ )
{
if ( it2 != userStats.begin() )
f << ";";
(*it2).second->printFrameValue(f,i);
}
f << "\n";
}
f.close();
return true;
}
bool StatsManager::dumpFrameStatsHorizontal( const char* file, int firstFrame, int lastFrame )
{
firstFrame--;
ofstream f;
f.open(file);
if ( !f.is_open() )
return false;
int i, j;
/* Create labels for frame columns */
f << "FRAME STATS";
j = 0;
for ( i = firstFrame; i < lastFrame; i++ )
f << ";Frame " << i+1;
f << endl;
// Built-in Stats
f << "BATCHES";
for ( j = firstFrame; j < lastFrame; j++ )
{
f << ";" << batchesInFrameCount[j];
}
f << endl;
// The remain of built-in Stats
map<string, UserStat*>::iterator it = userStats.begin();
for ( ; it != userStats.end(); it++ )
{
f << (*it).second->getName();
for ( j = firstFrame; j < lastFrame; j++ )
{
f << ";" ; (*it).second->printFrameValue(f,j);
}
f << endl;
}
f << "\n";
f.close();
return true;
}
void StatsManager::dumpFrameStats( const char* file, bool vertical, int splitLevel )
{
if ( !perFrameStats )
{
LOG( 0, Log::log() << "Skipped (perFrameStats = DISABLED)\n")
return;
}
bool ok = true;
if ( splitLevel <= 0 )
{
if ( vertical )
ok = dumpFrameStatsVertical(file, 1, currentFrame-1);
else
ok = dumpFrameStatsHorizontal(file, 1, currentFrame-1);
}
else
{
int iFile, nFiles;
char fileName[256];
nFiles = (currentFrame / (splitLevel+1)) +1; /* splitLevel columns with data + 1 column with labels */
for ( iFile = 0; iFile < nFiles && ok; iFile++ )
{
int firstFrame = iFile * splitLevel + 1;
int lastFrame = ((iFile+1)*splitLevel > currentFrame ? currentFrame : (iFile+1)*splitLevel);
sprintf(fileName,"%s_%d_%d.csv", file, firstFrame, lastFrame);
if ( vertical )
ok = dumpFrameStatsVertical(fileName, firstFrame, lastFrame);
else
ok = dumpFrameStatsHorizontal(fileName, firstFrame, lastFrame);
}
}
if ( ok )
{
LOG(0, Log::log() << " OK\n";)
}
else
{
LOG(0, Log::log() << " File could not be opened for writing (maybe was already opened)\n";)
}
}
void StatsManager::dumpTraceStats( const char* file, bool vertical )
{
if ( !perTraceStats )
{
LOG( 0, Log::log() << "Skipped (perTraceStats = DISABLED)\n")
return;
}
ofstream f;
f.open(file);
if ( f.is_open() )
{
LOG(0, Log::log() << " OK\n";)
}
else
{
LOG(0, Log::log() << " File could not be opened for writing (maybe was already opened)\n";)
return;
}
/* Write Stats */
int i, j;
f << "TRACE STATS";
if (vertical)
{
f << ";FRAMES;BATCHES;";
map<string, UserStat*>::iterator it = userStats.begin();
for ( ; it != userStats.end(); it++ )
{
f << (*it).second->getName() << ";";
}
f << "\n;";
/* Print number of frames */
f << currentFrame-1 << ";";
unsigned int totalBatches = 0;
for(int i = 0; i < (currentFrame - 1); i++)
totalBatches += batchesInFrameCount[i];
f << totalBatches << ";";
it = userStats.begin();
for ( ; it != userStats.end(); it++ )
{
(*it).second->printTraceValue(f); f << ";";
}
f << "\n";
}
else // Horizontal dump
{
f << "\n";
f << "FRAMES;" << currentFrame-1 << "\n";
unsigned int totalBatches = 0;
for(int i = 0; i < (currentFrame - 1); i++)
totalBatches += batchesInFrameCount[i];
f << "BATCHES;" << totalBatches << "\n";
map<string, UserStat*>::iterator it = userStats.begin();
for ( ; it != userStats.end(); it++ )
{
f << (*it).second->getName() << ";"; (*it).second->printTraceValue(f); f << "\n";
}
}
f.close();
return;
};
#endif // WORKLOAD_STATS | 22.664615 | 125 | 0.523283 | attila-sim |