blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 2 247 | content_id stringlengths 40 40 | detected_licenses listlengths 0 57 | license_type stringclasses 2 values | repo_name stringlengths 4 111 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 58 | visit_date timestamp[ns]date 2015-07-25 18:16:41 2023-09-06 10:45:08 | revision_date timestamp[ns]date 1970-01-14 14:03:36 2023-09-06 06:22:19 | committer_date timestamp[ns]date 1970-01-14 14:03:36 2023-09-06 06:22:19 | github_id int64 3.89k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 25 values | gha_event_created_at timestamp[ns]date 2012-06-07 00:51:45 2023-09-14 21:58:52 ⌀ | gha_created_at timestamp[ns]date 2008-03-27 23:40:48 2023-08-24 19:49:39 ⌀ | gha_language stringclasses 159 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 10.5M | extension stringclasses 111 values | filename stringlengths 1 195 | text stringlengths 7 10.5M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
72e997a3388d5af3e584bb37c1775adaeb014ce9 | 7dde42a5287919eb696e146a854fd5fc39056831 | /Option.cpp | b2550af5afd0c76a3b8e68aff1e353b7c8a94cf2 | [] | no_license | jmc000/Pricing_project | a45675961bda4aee1b67e4d61a4332d530d14f5f | 46b0399c25e281038e4a8454e53681ba357d1e5a | refs/heads/master | 2022-12-01T20:19:23.713691 | 2020-02-04T17:58:38 | 2020-02-04T17:58:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 392 | cpp | Option.cpp | //
// Option.cpp
// TD6
//
// Created by Nicolas Lissak on 29/11/2019.
// Copyright © 2019 Nicolas Lissak. All rights reserved.
//
#include "Option.hpp"
Option:: Option(double _K, double _N, OptionType _type) : K(_K), N(_N), type(_type)
{
}
Option :: Option(int N,double S0,double K,double R,double v,double T,OptionType type) : N(N),S0(S0),K(K),R(R),v(v),T(T),type(type)
{
}
|
254b0cc324e47a8bc25ca3295f325c54b95952a1 | 95e6ca11c279630dc3258ff207d4075af14f59e3 | /pyDM.cpp | dce1823dd416fc6f9dc7f85732ec1f2cb4de3a4d | [
"BSD-4.3TAHOE"
] | permissive | danielkangell/pyDM | d08a13b72c9a2ff106f4c62e163946a124a2d75e | be38f1ab98da16c359b7a3a5ac129c9c36ed4c48 | refs/heads/master | 2020-05-30T09:55:21.861851 | 2019-05-31T13:27:24 | 2019-05-31T13:27:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,865 | cpp | pyDM.cpp | // pyDM.cpp : Defines the exported functions for the DLL application.
//
#include "stdafx.h"
#include "pyDM.hpp"
// Since this will be a singleton within each Python process there's little need for a C++ class
// Procedure will work just fine.
///////////////////////////////////////////////////////////////////////////////////////
// Python pyDMPipeline module interface
///////////////////////////////////////////////////////////////////////////////////////
BOOST_PYTHON_MODULE(pyDM)
{
using namespace boost::python;
Py_Initialize(); // Allows useage of PyRun_SimpleString("...") and such
np::initialize();
def( "version", pyDM_version );
def( "connect", pyDM_connect );
def( "getMessage", pyDM_getMessage );
def( "cntMsg", pyDM_checkMessageCount );
def( "getImage", pyDM_getImage );
def( "getImageRaveled", pyDM_getImageRaveled );
def( "sendMessage", pyDM_sendMessage );
def( "executeScript", pyDM_executeScript ); // TRH added
}
bool pyDM_connect()
{
// Connects the .PYD to the .DLL using the shared memory space and the two message queues.
// Instantiate shared memory
try
{
// 0 offset, 2048 x 2048 x 2 byte image
// TODO, RAM: figure out why boost has trouble with windows TCHAR strings.
windows_shared_memory iImage ( open_or_create, "pyDMImageMap", read_write, MEM_SIZE );
mapImage = new mapped_region( iImage, read_write, 0, IMAGE_SIZE );
// windows_shared_memory script_storage ( open_or_create, "pyDMScriptMap", read_write, SCRIPT_MEM_SIZE ); // TRH added
// mapScript = new mapped_region ( script_storage, read_write, 0, MAX_SCRIPT_SIZE ); // TRH added
//get the region address
//void * iaddr = mapImage.get_address();
//create a shared memory buffer in memory
//shared_memory_buffer *data = new (addr) shared_memory_buffer;
// access the mapped region using get_address
//std::strcpy(static_cast<char* >(mapImage.get_address()), "Hell is Digital Micrograph.\n");
// Create message queues for sending commands back and forth
// NOTE: USING OVERLOADED VERSION OF message_queue BUILD ON WINDOWS BACKEND
mqPytoDM = new message_queue( open_or_create, std::string("mqPytoDM").data(), QUEUE_LENGTH, BUF_SIZE );
mqDMtoPy = new message_queue( open_or_create, std::string("mqDMtoPy").data(), QUEUE_LENGTH, BUF_SIZE );
mqScriptstoDM = new message_queue( open_or_create, std::string("mqScriptstoDM").data(), QUEUE_LENGTH, MAX_SCRIPT_SIZE ); // TRH added
}
catch (interprocess_exception& )
{
// Clean up the mess
//cout << "pyDMPipeline: Caught interprocess error : " << e.what() << std::endl;
PyRun_SimpleString( "print \'pyDM: Failed to create inter-process objects\'" );
return false;
}
//cout << "pyDMPipeline: Successfully created interprocess objects.\n " << std::endl;
PyRun_SimpleString( "print \'pyDM: Successfully created interprocess objects.\'" );
//PythonPrinting( "Successfully created interprocess objects." );
// TO DO: send a test message back and forth.
try
{
string hellomessage = "connect";
mqPytoDM->send( hellomessage.data(), hellomessage.size(), priority );
}
catch (interprocess_exception& )
{
PyRun_SimpleString( "print \'pyDM: Failed to send message to DM.\'" );
return false;
}
return true;
}
char const* pyDM_version()
{
return "pyDMPipeline version 0.1";
}
p::str pyDM_getMessage()
{
//PyRun_SimpleString( "print(\'Debug 1\')" );
std::string message = "";
std::size_t message_size = 0;
message.resize( BUF_SIZE );
// This is VS2008 so we cannot use to_string() apparently.
mqDMtoPy->try_receive( &message[0], message.size(), message_size, priority );
// ostringstream printmessage;
// printmessage << "print(\'message size = " << message_size << "\')";
// PyRun_SimpleString( printmessage.str().data() );
if( message_size <= 0 )
{
// PyRun_SimpleString( "print(\'message is null\')" );
p::str pstring( "" );
return pstring;
}
else
{
message.resize( message_size );
p::str pstring( message );
return pstring;
}
}
p::object pyDM_checkMessageCount()
{
size_t cnt = mqDMtoPy->get_num_msg();
p::object py_cnt( (int)cnt );
return py_cnt;
}
np::ndarray pyDM_getImage( int x, int y, size_t bytedepth = 2 )
{
// It may be fastest to pass raveled data from DM to Python...
size_t bytesize = (size_t)x*y*bytedepth;
std::size_t imagesize = mapImage->get_size();
if( bytesize > imagesize )
bytesize = imagesize;
//PyRun_SimpleString( string("print(\'image size = " + to_string(imagesize) + "\')").data() );
const void* imageaddr = mapImage->get_address();
//PyRun_SimpleString( string("print(\'image address = " + to_string(imageaddr) + "\')").data() );
p::tuple cameraShape = p::make_tuple(x,y);
// ...as well as a type for C++ float
// Default for lack of constructor is uint16
np::dtype pixelDType = np::detail::get_int_dtype< 16, true >(); // uint16 unprocessed
if( bytedepth == 2 )
{
// DO NOTHING
//PyRun_SimpleString( string("print(\'Retrieving uint16 image\'").data() );
// np::dtype pixelDType = np::detail::get_int_dtype< 16, true >(); // uint16 unprocessed
//pixelDType = np::dtype::get_builtin<uint16>();
}
else if( bytedepth == 4 ) // int32
// PyRun_SimpleString( string("print(\'Retrieving int32 image\'").data() );
pixelDType = np::detail::get_int_dtype< 32, false >(); // int32 processed
//pixelDType = np::dtype::get_builtin<int32>(); // or int32 for gain normalized images
else
{
PyRun_SimpleString( "print(\'DEBUG: unknown image dtype\')" );
}
// Construct an array with the above shape and type
np::ndarray currentImage = np::empty( cameraShape, pixelDType );
// Now memcpy, row-col stuff may cause problems
//PyRun_SimpleString( "print(\'TO DO: check row-column ordering and unravel\' )" );
std::memcpy( currentImage.get_data(), imageaddr, bytesize );
return currentImage;
}
np::ndarray pyDM_getImageRaveled( int xy, size_t bytedepth = 2 )
{
// It may be fastest to pass raveled data from DM to Python...
// No, seems to make little/no difference, so Boost.Numpy is workign properly.
size_t bytesize = (size_t)xy*bytedepth;
std::size_t imagesize = mapImage->get_size();
if( bytesize > imagesize )
bytesize = imagesize;
//PyRun_SimpleString( string("print(\'image size = " + to_string(imagesize) + "\')").data() );
const void* imageaddr = mapImage->get_address();
//PyRun_SimpleString( string("print(\'image address = " + to_string(imageaddr) + "\')").data() );
// Create a [2048*2048, 1] shape...
p::tuple cameraShape = p::make_tuple(xy, 1);
// ...as well as a type for C++ float
np::dtype pixelDType = np::dtype::get_builtin<unsigned short>(); // uint16
if( bytedepth != 2 )
PyRun_SimpleString( "print(\'TO DO: fix image dtype-ing\')" );
// Construct an array with the above shape and type
np::ndarray currentImage = np::empty( cameraShape, pixelDType );
std::memcpy( currentImage.get_data(), imageaddr, bytesize );
return currentImage;
}
void pyDM_sendMessage(p::str tosend )
{
// See www.sigverse.org, Converting data from C++ to Python and vice versa.
std::string stdsend = p::extract<std::string>(tosend);
mqPytoDM->send( stdsend.data(), stdsend.size(), priority );
}
void pyDM_executeScript(p::str input_script ) // TRH added
{
std::string script_to_send = p::extract<std::string>(input_script);
if( script_to_send.length() <= MAX_SCRIPT_SIZE)
mqScriptstoDM->send( script_to_send.data(), script_to_send.size(), priority );
else
{
std::string err_result = "1";
mqDMtoPy->send(err_result.data(), err_result.size(), priority );
PyRun_SimpleString( "print(\'Script too long. Current limit is MAX_SCRIPT_SIZE. Please reduce size and send again.\')" );
}
}
|
25bd03bdbb94727412a546b0892adf86b54523a2 | 3d84892e1b43337f5611eb4480811820a395fee2 | /gameoflife/Vector2.cpp | 025a07624503f197a4a192a1e4fddf15c814154a | [] | no_license | Tristyn/GameOfLife | e75784dd7c6b3f622ccfdad5c25b8af49e518a25 | cb13cd16d6a47380d27699ed2dd9fc3ee27482dc | refs/heads/master | 2023-01-06T04:16:25.915009 | 2020-10-30T20:01:53 | 2020-10-30T20:01:53 | 308,387,066 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 443 | cpp | Vector2.cpp | #include "Vector2.h"
namespace Conway
{
template<typename T>
Vector2<T>::Vector2(T x, T y) : mX(x), mY(y) { };
template<typename T>
T Vector2<T>::GetX() const
{
return mX;
}
template<typename T>
T Vector2<T>::GetY() const
{
return mY;
}
template<typename T>
T Vector2<T>::SetX()
{
return mX;
}
template<typename T>
T Vector2<T>::SetY()
{
return mY;
}
// Explicit instantiations
template class Vector2<int>;
} |
bdc6e373457c4641949a28fbab0b3e2819f676b9 | fb20d07fe8f6d99534f4b23287f7f4a13f1bddfc | /sensors/beam_pattern_omni.cc | 4a67714fcf98300086b940bc9c929cec0bee48f7 | [
"BSD-2-Clause"
] | permissive | cxzhangqi/UnderSeaModelingLibrary | 4d778bf05f3e53daa3a6ea4630e3b7c3e130a029 | 43365639b435841e1bf2297cf1ac575b8cf91932 | refs/heads/master | 2023-01-02T08:52:36.274408 | 2020-10-28T13:10:10 | 2020-10-28T13:10:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 968 | cc | beam_pattern_omni.cc | /**
* @file beam_pattern_omni.cc
*/
#include <usml/sensors/beam_pattern_omni.h>
using namespace usml::sensors ;
/**
* Default constructor sets the beamID to OMNI
*/
beam_pattern_omni::beam_pattern_omni()
{
_beamID = beam_pattern_model::OMNI ;
}
/**
* Destructor
*/
beam_pattern_omni::~beam_pattern_omni()
{
}
/** Calculates the beam level in de, az, and frequency **/
void beam_pattern_omni::beam_level(
double de, double az,
orientation& orient,
const vector<double>& frequencies,
vector<double>* level )
{
write_lock_guard(_mutex);
noalias(*level) = scalar_vector<double>( frequencies.size(), 1.0 ) ;
}
/**
* The user may call this function but it has no effect on the
* beam level.
*/
void beam_pattern_omni::directivity_index(
const vector<double>& frequencies,
vector<double>* level )
{
write_lock_guard(_mutex);
noalias(*level) = scalar_vector<double>( frequencies.size(), 0.0 ) ;
}
|
50ef3eee145159f44dbba2e9752cc653e368100d | 21f302a6e9fc8b3f386f3e399aa1f53f942b55eb | /sk_app/unix/platform/window/libwpe/WindowLibWPE.cpp | 56bf11c50c6fd5e83420e23475be5bf017e08c28 | [
"MIT"
] | permissive | fredlee12345678/react-native-skia | 3901382a3e01abcb6b62dc62bac48c7a78557d46 | 8abe6a9a6df882927de8e340316bd31f93b96953 | refs/heads/main | 2023-05-14T10:31:53.796480 | 2021-05-31T08:20:28 | 2021-05-31T08:20:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,724 | cpp | WindowLibWPE.cpp | /*
* Copyright 2016 Google Inc.
* Copyright (C) 1994-2021 OpenTV, Inc. and Nagravision S.A.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "src/utils/SkUTF.h"
#include "SkAppUtil.h"
#ifdef SKA_HAS_GPU_SUPPORT
#include "GLWindowContext.h"
#endif
#include "WindowLibWPE.h"
#include "WindowContextFactory.h"
namespace sk_app {
SkTDynamicHash<WindowLibWPE, WPEWindowID> WindowLibWPE::gWindowMap;
bool WindowLibWPE::initViewBackend(wpe_view_backend* viewBackend) {
if (nullptr == viewBackend) {
SK_APP_LOG_ERROR("Invalid View Backend\n");
return false;
}
// Register backend client
static struct wpe_view_backend_client s_backendClient = {
// set_size
[](void* data, uint32_t width, uint32_t height)
{
auto& winwpe = *reinterpret_cast<WindowLibWPE*>(data);
SK_APP_LOG_INFO("View Backend Size (%u x %u)\n", width, height);
winwpe.setViewSize((int)width, (int)height);
},
// frame_displayed
[](void* data)
{
auto& winwpe = *reinterpret_cast<WindowLibWPE*>(data);
SK_APP_UNUSED(winwpe);
},
// padding
nullptr,
nullptr,
nullptr,
nullptr
};
wpe_view_backend_set_backend_client(viewBackend, &s_backendClient, this);
// Register Input client
static struct wpe_view_backend_input_client s_inputClient = {
// handle_keyboard_event
[](void* data, struct wpe_input_keyboard_event* event)
{
SK_APP_NOT_IMPL
auto& winwpe = *reinterpret_cast<WindowLibWPE*>(data);
if (event->pressed
&& event->modifiers & wpe_input_keyboard_modifier_control
&& event->modifiers & wpe_input_keyboard_modifier_shift
&& event->key_code == WPE_KEY_G) {
return;
}
},
// handle_pointer_event
[](void* data, struct wpe_input_pointer_event* event)
{
SK_APP_NOT_IMPL
auto& winwpe = *reinterpret_cast<WindowLibWPE*>(data);
},
// handle_axis_event
[](void* data, struct wpe_input_axis_event* event)
{
SK_APP_NOT_IMPL
auto& winwpe = *reinterpret_cast<WindowLibWPE*>(data);
},
// handle_touch_event
[](void* data, struct wpe_input_touch_event* event)
{
SK_APP_NOT_IMPL
auto& winwpe = *reinterpret_cast<WindowLibWPE*>(data);
},
// padding
nullptr,
nullptr,
nullptr,
nullptr
};
wpe_view_backend_set_input_client(viewBackend, &s_inputClient, this);
wpe_view_backend_initialize(viewBackend);
return true;
}
bool WindowLibWPE::initRenderTarget(wpe_view_backend* viewBackend, wpe_renderer_backend_egl* renderBackend) {
if (nullptr == viewBackend || nullptr == renderBackend) {
SK_APP_LOG_ERROR("Invalid View (%p) or Render (%p) Backend\n", viewBackend, renderBackend);
return false;
}
fRendererTarget = wpe_renderer_backend_egl_target_create(wpe_view_backend_get_renderer_host_fd(viewBackend));
static struct wpe_renderer_backend_egl_target_client s_client = {
// frame_complete
[](void* data)
{
},
// padding
nullptr,
nullptr,
nullptr,
nullptr,
#if defined(ENABLE_WINDOW_ID_PATCH)
//window_id -> This is called from wpebackend-rdk
[](void* data, unsigned int id)
{
SK_APP_NOT_IMPL
}
#endif
};
wpe_renderer_backend_egl_target_set_client(fRendererTarget, &s_client, this);
if( fViewWidth <=0 || fViewHeight <= 0) {
SK_APP_LOG_ERROR("Invalid View Size.. using default width and height\n");
fViewWidth = 1280;
fViewHeight = 720;
}
wpe_renderer_backend_egl_target_initialize(fRendererTarget, renderBackend, std::max(0, fViewWidth), std::max(0, fViewHeight));
return true;
}
bool WindowLibWPE::initWindow(PlatformDisplay *platformDisplay) {
Display* display = (dynamic_cast<PlatformDisplayLibWPE*>(platformDisplay))->native();
if( nullptr == display) {
SK_APP_LOG_ERROR("Invalid display handler\n");
return false;
}
struct wpe_view_backend* viewBackend = display->viewBackend();
struct wpe_renderer_backend_egl* renderBackend = (dynamic_cast<PlatformDisplayLibWPE*>(platformDisplay))->renderBackend();
if (fRequestedDisplayParams.fMSAASampleCount != fMSAASampleCount) {
this->closeWindow();
}
// we already have a window
if (fDisplay) {
return true;
}
if(false == initViewBackend(viewBackend)) {
return false;
}
if(false == initRenderTarget(viewBackend, renderBackend)) {
return false;
}
fWindow = (reinterpret_cast<GLNativeWindowType>(wpe_renderer_backend_egl_target_get_native_window(fRendererTarget)));
fDisplay = display;
fPlatformDisplay = platformDisplay;
fMSAASampleCount = fRequestedDisplayParams.fMSAASampleCount;
// add to hashtable of windows
gWindowMap.add(this);
// init event variables
fPendingPaint = false;
fPendingResize = false;
return true;
}
void WindowLibWPE::setViewSize(int width, int height) {
fViewWidth = width;
fViewHeight = height;
}
void WindowLibWPE::closeWindow() {
if (fDisplay) {
fDisplay = nullptr;
}
if(fRendererTarget) {
wpe_renderer_backend_egl_target_destroy(fRendererTarget);
fRendererTarget = nullptr;
}
}
bool WindowLibWPE::handleEvent() {
SK_APP_NOT_IMPL
return false;
}
void WindowLibWPE::setTitle(const char* title) {
SK_APP_NOT_IMPL
}
void WindowLibWPE::show() {
SK_APP_NOT_IMPL
}
bool WindowLibWPE::attach(BackendType attachType) {
fBackend = attachType;
this->initWindow(fPlatformDisplay);
window_context_factory::UnixWindowInfo winInfo;
winInfo.fWindow = fWindow;
if( fViewWidth > 0 && fViewHeight > 0) {
winInfo.fWidth = fViewWidth;
winInfo.fHeight = fViewHeight;
} else {
SK_APP_LOG_ERROR("Invalid View Size.. using default width and height\n");
winInfo.fWidth = winInfo.fHeight = 0;
}
switch (attachType) {
case kNativeGL_BackendType:
#ifdef SKA_HAS_GPU_SUPPORT
fWindowContext =
window_context_factory::MakeGLForUnix(winInfo, fRequestedDisplayParams);
#else
SK_APP_LOG_ERROR("Cannot create kNativeGL_BackendType context : GPU SUPPORT IS NOT ENABLED \n");
#endif
break;
case kRaster_BackendType:
fWindowContext =
window_context_factory::MakeRasterForUnix(winInfo, fRequestedDisplayParams);
break;
}
this->onBackendCreated();
return (SkToBool(fWindowContext));
}
void WindowLibWPE::didRenderFrame() {
if(fRendererTarget)
wpe_renderer_backend_egl_target_frame_rendered(fRendererTarget);
}
void WindowLibWPE::onInval() {
SK_APP_NOT_IMPL
}
void WindowLibWPE::setRequestedDisplayParams(const DisplayParams& params, bool allowReattach) {
#if defined(SK_VULKAN)
// Vulkan on unix crashes if we try to reinitialize the vulkan context without remaking the
// window.
if (fBackend == kVulkan_BackendType && allowReattach) {
// Need to change these early, so attach() creates the window context correctly
fRequestedDisplayParams = params;
this->detach();
this->attach(fBackend);
return;
}
#endif
INHERITED::setRequestedDisplayParams(params, allowReattach);
}
} // namespace sk_app
|
a9b7bcebdf6e6716b3a61e50f1ca87ce7a458d3c | 864093daa001a093cbf5142f62913480af3a3e73 | /Shielded.cpp | d0528d8e326b31b89d4d9342d65d243cb30c84cd | [
"Apache-2.0"
] | permissive | naderabdalghani/castle-battle-simulator | 0d064c411d5d3800f54a8e0d23dd447ae6531c4a | 4dc1960c9acc9952c2106e3c26e86a7d77b4c5d0 | refs/heads/master | 2020-11-24T14:02:45.623157 | 2020-06-18T03:23:16 | 2020-06-18T03:23:16 | 228,182,379 | 6 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 836 | cpp | Shielded.cpp | #include "Shielded.h"
double Shielded::c1=0;
double Shielded::c2=0;
double Shielded::c3=0;
Shielded::Shielded(int id,int arrival, int EnemyHealth, int fire, int reload,int s,REGION r_region):
Enemy(id,arrival, EnemyHealth, fire, reload,s, r_region,ORANGERED,2)
{}
float Shielded::Priority()
{
return (getFirePower()/GetDistance())*c1+c2/(1+ToShoot())+c3*getHealth();
}
void Shielded::setConst(double a,double b,double c)
{
c1=a;
c2=b;
c3=c;
}
Shielded::~Shielded(void)
{
}
bool Shielded::operator <=(Shielded * E){
return Priority()<E->Priority();
}
void Shielded::DamageToEnemy(int TowerfirePow )
{
Health= Health- ((1.0/ Distance)* TowerfirePow* (1.0));
}
void Shielded::DecrementDist(int d)
{
if (Distance+speed > MinDistance)
Distance-=speed;
else
Distance=MinDistance;
}
|
91cc759d005114ffd76f3809b156d13cef8867b3 | 202b96b76fc7e3270b7a4eec77d6e1fd7d080b12 | /modules/url/url_name.h | 0284b862b7159854433e620f5f529657805cec06 | [] | no_license | prestocore/browser | 4a28dc7521137475a1be72a6fbb19bbe15ca9763 | 8c5977d18f4ed8aea10547829127d52bc612a725 | refs/heads/master | 2016-08-09T12:55:21.058966 | 1995-06-22T00:00:00 | 1995-06-22T00:00:00 | 51,481,663 | 98 | 66 | null | null | null | null | UTF-8 | C++ | false | false | 5,494 | h | url_name.h | /* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
**
** Copyright (C) 2000-2008 Opera Software AS. All rights reserved.
**
** This file is part of the Opera web browser. It may not be distributed
** under any circumstances.
**
** Yngve Pettersen
**
*/
#ifndef _URL_NAME_H_
#define _URL_NAME_H_
#ifdef YNP_WORK
//#define YNP_DEBUG_NAME
#endif
//#include "url_enum.h"
#include "modules/url/url2.h"
#include "modules/url/url_sn.h"
#include "modules/url/url_scheme.h"
struct URL_Name_Components_st
{
public:
const protocol_selentry *scheme_spec;
URLType url_type;
const char *username;
const char *password;
ServerName_Pointer server_name;
uint16 port;
URL_Scheme_Authority_Components_pointer basic_components;
const char *path;
const char *query;
const char *full_url;
public:
/**
* Export escaped string representation of url into a buffer of given length.
*
* @param password_hide Only escaped urls are allowed (KName_*_Escaped*)
* @param output_buffer The buffer where the url will be printed
* @param buffer_len Length of buffer. The buffer should be at least of length op_strlen(full_url) + 1;
* @param linkid URL_NAME_LinkID_None, URL_NAME_LinkID or URL_NAME_LinkID_Unique
*/
void OutputString(URL::URL_NameStringAttribute password_hide, char *output_buffer, size_t buffer_len, int linkid) const;
/**
* Export escaped string representation of url into a buffer of given length.
*
* @param password_hide Only escaped urls are allowed (KUniName_*_Escaped*)
* @param output_buffer The buffer where the url will be printed
* @param buffer_len Length of buffer. The buffer should be at least of length op_strlen(full_url) + 1;
*/
void OutputString(URL::URL_NameStringAttribute password_hide, uni_char *output_buffer, size_t buffer_len) const;
void Clear(){
scheme_spec = NULL;
full_url = NULL;
url_type = URL_NULL_TYPE;
username = NULL;
password = NULL;
server_name = NULL;
port = 0;
path = NULL;
query = NULL;
};
URL_Name_Components_st(){Clear();};
};
class URL_Name
#ifdef YNP_DEBUG_NAME
: public Link
#endif
{
friend class URL_Manager;
friend class CacheTester;
private:
const protocol_selentry* GetProtocolSelentry() const;
URL_Scheme_Authority_Components_pointer basic_components;
OpString16 illegal_original_url;
OpString8 path;
OpString8 query;
#ifdef URL_FILE_SYMLINKS
// Stores the target path if this URL is a symlink, i.e. it reads
// data from this target path instead of the original path.
// See the URL KUniName_For_Data, KUniPath_For_Data and
// KUniPath_SymbolicLinkTarget attributes for more info.
OpString8 symbolic_link_target_path;
#endif // URL_FILE_SYMLINKS
private:
enum { TEMPBUFFER_SHRINK_LIMIT = (MEM_MAN_TMP_BUF_LEN + 255) & ~255 };
OP_STATUS CheckBufferSize(unsigned long templen) const;
#define URL_NAME_LinkID_None 0
#define URL_NAME_LinkID 1
#define URL_NAME_LinkID_Unique 2
public:
URL_Name();
~URL_Name();
OP_STATUS Set_Name(URL_Name_Components_st &url);
/** Content from Name must always be copied immediately, as a temporary buffer is used.
* The content of this buffer will be destroyed on next call to Name(), or on the next call to the constructor
*/
const char* Name(URL::URL_NameStringAttribute password_hide, URL_RelRep* rel_rep = NULL, int linkid=URL_NAME_LinkID_None) const;
/** Content from UniName must always be copied immediately, as a temporary buffer is used.
* The content of this buffer will be destroyed on next call to Name(), or on the next call to the constructor
*/
const uni_char* UniName(URL::URL_UniNameStringAttribute password_hide, unsigned short charsetID, URL_RelRep* rel_rep = NULL) const;
OP_STATUS GetSuggestedFileName(OpString &target, BOOL only_extension = FALSE) const;
uint32 GetAttribute(URL::URL_Uint32Attribute attr) const;
const OpStringC8 GetAttribute(URL::URL_StringAttribute attr, URL_RelRep* rel_rep = NULL) const;
const OpStringC GetAttribute(URL::URL_UniStringAttribute attr, URL_RelRep* rel_rep = NULL) const;
OP_STATUS GetAttribute(URL::URL_StringAttribute attr, OpString8 &val, URL_RelRep* rel_rep = NULL) const;
OP_STATUS GetAttribute(URL::URL_UniStringAttribute attr, OpString &val, URL_RelRep* rel_rep = NULL) const;
const OpStringC8 GetAttribute(URL::URL_NameStringAttribute attr, URL_RelRep* rel_rep = NULL) const;
const OpStringC GetAttribute(URL::URL_UniNameStringAttribute attr, URL_RelRep* rel_rep = NULL) const;
OP_STATUS GetAttribute(URL::URL_NameStringAttribute attr, OpString8 &val, URL_RelRep* rel_rep = NULL) const{return val.Set(GetAttribute(attr,rel_rep));};
OP_STATUS GetAttribute(URL::URL_UniNameStringAttribute attr, unsigned short charsetID, OpString &val, URL_RelRep* rel_rep = NULL) const;
const void *GetAttribute(URL::URL_VoidPAttribute attr) const;
void SetAttribute(URL::URL_Uint32Attribute attr, uint32 value);
OP_STATUS SetAttribute(URL::URL_UniNameStringAttribute attr, const OpStringC &string);
//void SetAttributeL(URL::URL_StringAttribute attr, const OpStringC8 &string);
//void SetAttributeL(URL::URL_UniStringAttribute attr, const OpStringC &string);
//void SetAttributeL(URL::URL_VoidPAttribute attr, const void *param);
/** Some internal buffers can grow quite big. Call this to make them small again. */
static void ShrinkTempBuffers();
#ifdef _OPERA_DEBUG_DOC_
unsigned long GetMemUsed();
#endif
BOOL operator==(const URL_Name &other) const;
};
#endif //_URL_NAME_H_
|
182c6598dbe92e27ee520d91e007ce1501d6ebcd | 9a3f8c3d4afe784a34ada757b8c6cd939cac701d | /leetMaxScoreAfterSplit.cpp | 687a703dd502a86db32963c46792e71c6d427037 | [] | no_license | madhav-bits/Coding_Practice | 62035a6828f47221b14b1d2a906feae35d3d81a8 | f08d6403878ecafa83b3433dd7a917835b4f1e9e | refs/heads/master | 2023-08-17T04:58:05.113256 | 2023-08-17T02:00:53 | 2023-08-17T02:00:53 | 106,217,648 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,148 | cpp | leetMaxScoreAfterSplit.cpp | /*
*
//****************************************1422. Maximum Score After Splitting a String.**************************************
https://leetcode.com/problems/maximum-score-after-splitting-a-string/description/
Given a string s of zeros and ones, return the maximum score after splitting the string into two non-empty substrings (i.e. left
substring and right substring).
The score after splitting a string is the number of zeros in the left substring plus the number of ones in the right substring.
Example 1:
Input: s = "011101"
Output: 5
Explanation:
All possible ways of splitting s into two non-empty substrings are:
left = "0" and right = "11101", score = 1 + 4 = 5
left = "01" and right = "1101", score = 1 + 3 = 4
left = "011" and right = "101", score = 1 + 2 = 3
left = "0111" and right = "01", score = 1 + 1 = 2
left = "01110" and right = "1", score = 2 + 1 = 3
Example 2:
Input: s = "00111"
Output: 5
Explanation: When left = "00" and right = "111", we get the maximum score = 2 + 3 = 5
Example 3:
Input: s = "1111"
Output: 3
Constraints:
2 <= s.length <= 500
The string s consists of characters '0' and '1' only.
*****************************************************************TEST CASES:**********************************************************
//These are the examples I had tweaked and worked on.
"10101011110001000011"
"00001111"
"111100000"
"10011110001011000001100110"
// Time Complexity: O(n).
// Space Complexity: O(1).
//********************************************************THIS IS LEET ACCEPTED CODE.***************************************************
*/
//************************************************************Solution 1:************************************************************
//*****************************************************THIS IS LEET ACCEPTED CODE.***********************************************
// Time Complexity: O(n).
// Space Complexity: O(1).
// This algorithm is observation based. Score if 0s in left part+1s in right part of the array after the split. We iter. over all possi.
// splits, calc. the score at each possib. and update the maxm. score. In order to get right part 1s, we calc. total 1s and subtract
// 1s encountered till now(left part), we add right part 1s with left part 0s and try to update the maxm. score of all possible splits.
class Solution {
public:
int maxScore(string s) {
int totalOnes=0, res=0; // Stores the total 1s and the max. score.
for(auto ch:s){ // Calc. total 1s, 0s.
if(ch=='1') totalOnes++;
}
int zeroes=0, ones=0, remOnes=-1; // Tracks zeroes, ones in indies iter. till then.
for(int i=0;i<s.length()-1;i++){ // Iter. over entire array.
if(s[i]=='0') zeroes++; // Cnt. zeroes, ones.
else ones++;
remOnes=totalOnes-ones; // Calc. ones in the right part.
res=max(res, zeroes+remOnes); // Adding left part 0s, right part 1s and updating max score.
}
return res; // Returning the maxm. score.
}
}; |
afdf1896758be1c3f6ed68a478625bc7b8a6c1e4 | 0c45e412ec43c083e2a5834b6251f519baee10ab | /recontabwidget.cpp | 448fbd4e094e36e4aedc1d12eabe794f4b7965ad | [] | no_license | Hydrogenion/M2R | 0a9e01cd5ad313a6965f7e8597d5e6e0fe7d6160 | d38f3e4674df86da2f4352a9c9e5d30308122f60 | refs/heads/master | 2022-05-07T19:08:54.300865 | 2020-04-29T09:51:32 | 2020-04-29T09:51:32 | 259,886,775 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 243 | cpp | recontabwidget.cpp | #include "recontabwidget.h"
#include "ui_recontabwidget.h"
ReconTabWidget::ReconTabWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::ReconTabWidget)
{
ui->setupUi(this);
}
ReconTabWidget::~ReconTabWidget()
{
delete ui;
}
|
89e0cc6c1ce0305c0782723a3b68438742573c8a | ff18be417439435d0db3756181a9e98c55cf25e3 | /ACM-ICPC/ACM-ICPC_12/Amritapuri/online contest/ACM-ICPC Amritapuri 2012 Online Competition Accepted Solutions/C/cpp/00010338_C_SUMRANGE_amicpc120331.cpp | 7395b160db4c4dc72189f2f9631ef81568769982 | [] | no_license | rovinbhandari/Programming_Scripting | 3952b45636f10e46c05dede29492eb0828857448 | ee67f9289883d3686ed5cf41dbae13e1313bcfb0 | refs/heads/master | 2023-06-22T13:52:03.559222 | 2023-06-20T13:40:32 | 2023-06-20T13:47:22 | 4,378,004 | 6 | 1 | null | 2019-03-25T14:44:18 | 2012-05-19T12:25:13 | C++ | UTF-8 | C++ | false | false | 951 | cpp | 00010338_C_SUMRANGE_amicpc120331.cpp | #include <iostream>
#include <cstdio>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
#define f(i,n) for((i)=0;(i)<(n);(i)++)
int main(int argc, char const *argv[])
{
int i,j,k,l,x;
scanf("%d",&x);
f(l,x){
vector<int> x;
int n,l,h;
scanf("%d %d %d",&n, &l, &h);
f(i,n){
int temp;
scanf("%d", &temp);
x.push_back(temp);
}
sort(x.begin(), x.end());
int count1 = 0;
f(i,n-2){
j = i+1;
k = n-1;
while(j < k){
int S = x[i] + x[j] + x[k];
if(S <= h) {
count1 += k - j;
j += 1;
} else if (S > h) {
k -= 1;
}
}
}
int count2 = 0;
f(i,n-2){
j = i+1;
k = n-1;
while(j < k){
int S = x[i] + x[j] + x[k];
if(S < l) {
count2 += k - j;
j += 1;
} else if (S >= l) {
k -= 1;
}
}
}
printf("%d\n", count1 - count2);
}
return 0;
}
|
294250939fc54702bdf5e2bd16d8cfb2801946f4 | 00694638848e785d577c3039e7d92faa4251c3a5 | /42kthSmallest.cpp | 5cba9344df4488931771ed690257cab6c1c1f0ee | [] | no_license | Starscoder/LSGO50 | 5bd7df425396ae9aef460c7e0f4a3c4ad416dcaf | 9fee1e01e44849b51ef149ea90e0d53afb52d344 | refs/heads/master | 2020-07-11T03:55:45.488213 | 2019-09-30T08:51:01 | 2019-09-30T08:51:01 | 204,439,788 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,639 | cpp | 42kthSmallest.cpp | /**
给定一个二叉搜索树,编写一个函数 kthSmallest 来查找其中第 k 个最小的元素。
说明:
你可以假设 k 总是有效的,1 ≤ k ≤ 二叉搜索树元素个数。
示例 1:
输入: root = [3,1,4,null,2], k = 1
3
/ \
1 4
\
2
输出: 1
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/kth-smallest-element-in-a-bst
**/
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
//递归中序遍历算法:
class Solution1 {
public:
int kthSmallest(TreeNode* root, int k) {
int res = 0;
int cur = 0;
inorder(root,cur,k,res);
return res;
}
void inorder(TreeNode* root,int& cur,int k,int& res){
if(!root) return ;
inorder(root->left,cur,k,res);
cur++;
if(cur == k){
res = root->val;
return ;
}
inorder(root->right,cur,k,res);
}
};
//非递归算法:
class Solution2 {
public:
int kthSmallest(TreeNode* root, int k) {
stack<TreeNode*> s;
int cnt = 0;
TreeNode* p = root;
while(p || !s.empty()){
if(p){
s.push(p);
p = p->left;
}
else{
cnt++;
TreeNode* tmp = s.top();
if(cnt == k){
return tmp->val;
}
s.pop();
p = tmp->right;
}
}
return -1;
}
};
|
d48f1afcfb90fbeb8ae0608a80c8aedd7bed6ee3 | 3cf0f6428b2dfd417cec4995fef24954f2c2c45f | /src/Scene.h | 88d70eea6ff6f562c561d0d711ffeafe23127783 | [] | no_license | RasmusKarlsson/REngine | 0d59ac373ab20a75c4e9212018cbd653990de864 | 7e97264521e438f148edfa1ca1c4a339eff575e9 | refs/heads/master | 2021-01-23T21:01:54.334473 | 2020-11-08T18:02:31 | 2020-11-08T18:02:31 | 90,668,717 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,033 | h | Scene.h | #pragma once
#include <Decal.h>
#include "Camera.h"
#include "Terrain.h"
#include "Quad.h"
#include "Cube.h"
#include "PostEffectManager.h"
#include "RenderTarget.h"
#include "SkyBox.h"
#include "TextMesh.h"
using namespace glm;
using namespace std;
class Scene
{
public:
Scene();
~Scene();
Camera* GetCurrentCamera() { return m_currentCamera; };
PostEffectManager* GetPosteffectManager() { return m_postEffectManager; };
void AddEntity(Entity* entity);
void UpdateScene(double dt);
void RenderScene(double dt);
void RenderWireFrame();
void RenderBoundingBoxes();
void RenderStats();
Decal* m_cube;
Material* m_debugFontMaterial;
Texture* m_debugFontTexture;
private:
vector<Entity*> m_EntityList3D;
vector<Entity*> m_EntityListUI;
PostEffectManager* m_postEffectManager;
Camera* m_currentCamera;
Terrain* m_terrain;
Quad* m_cursorMesh;
TextMesh* m_fpsMesh;
RenderTarget* m_fbo1;
RenderTarget* m_fbo2;
Quad* m_fullscreenQuad;
Quad* m_windowQuad;
Material* m_windowMaterial;
Skybox* m_skybox;
};
|
42d08d42c3a30d31b16b129252863bb905f9c80f | 7b4a80931f91502bde0d56a4d2c1969003dfd462 | /manager_nodes/GJUserScore.h | 33a471bbd8673964518a4b24070cc45f1f65657a | [
"MIT"
] | permissive | absoIute/gd.h | 13ea2fd84032d1768657edfc26820aaaf6dcc354 | 8dbbb51788e61d25f80f4aa57c4f76f9f0b3efcd | refs/heads/main | 2023-07-20T14:55:08.533540 | 2021-09-05T18:14:49 | 2021-09-05T18:14:49 | 403,376,913 | 9 | 1 | MIT | 2021-09-05T17:54:11 | 2021-09-05T17:54:11 | null | UTF-8 | C++ | false | false | 2,838 | h | GJUserScore.h | #ifndef __GJUSERSCORE_H__
#define __GJUSERSCORE_H__
#include <gd.h>
namespace gd {
class GJUserScore : public cocos2d::CCNode {
protected:
std::string userName_;
std::string userUDID_;
int scoreType_; // legacy field, used in 1.9 to determine shown info
int userID_;
int accountID_;
int stars_;
int diamonds_;
int demons_;
int playerRank_;
int creatorPoints_; // note - internally this is named levels
int secretCoins_;
int userCoins_;
int iconID_; // for leaderboards, icon id to show
int color1_;
int color2_;
int special_;
IconType iconType_;
int messageState_;
int friendStatus_;
int commentHistoryStatus_;
std::string youtubeURL_;
std::string twitterURL_;
std::string twitchURL_;
int playerCube_;
int playerShip_;
int playerBall_;
int playerUfo_;
int playerWave_;
int playerRobot_;
int playerSpider_;
int playerStreak_;
bool glowEnabled_ : 4;
int playerExplosion_;
int modBadge_;
int globalRank_;
int friendReqStatus_;
int newMsgCount_;
int friendReqCount_;
bool isBlocked : 4;
std::string lastScoreAge;
public:
// static GJUserScore* create();
// static GJUserScore* create(cocos2d::CCDictionary*);
// bool isCurrentUser();
// void mergeWithScore(GJUserScore*);
inline IconType getIconType() const { return this->iconType_; };
inline int getPlayerCube() const { return this->playerCube_; };
inline int getPlayerShip() const { return this->playerShip_; };
inline int getPlayerBall() const { return this->playerBall_; };
inline int getPlayerUfo() const { return this->playerUfo_; };
inline int getPlayerWave() const { return this->playerWave_; };
inline int getPlayerRobot() const { return this->playerRobot_; };
inline int getPlayerSpider() const { return this->playerSpider_; };
inline int getPlayerStreak() const { return this->playerStreak_; };
inline bool getGlowEnabled() const { return this->glowEnabled_; };
inline int getPlayerExplosion() const { return this->playerExplosion_; };
inline int getPlayerColor1() const { return this->color1_; };
inline int getPlayerColor2() const { return this->color2_; };
inline std::string getPlayerName() const { return this->userName_; };
};
}
#endif
|
f06eff13d26031e2884c35194c07cecb32bde27f | 23e8fe2dcdf76f5f8f8fe1c195631504c4727f8b | /hackerrank/staircase/staircase.cpp | 02337e56afb1a0f871de2357f7630c90454ecbb3 | [] | no_license | captainmoha/competitive_programming | 1f8d50aab92caad9a59eb7f9f56a926724afbd81 | 568bd53422477899339b0678344c8daab25f23b6 | refs/heads/master | 2021-05-04T11:16:07.052065 | 2017-01-31T14:23:12 | 2017-01-31T14:23:12 | 46,484,674 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 315 | cpp | staircase.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
char sp = ' ';
char hash = '#';
int x = n;
for (int i = 0; i < n; i++) {
int j, k;
for (j = 0; j < x - 1; j++) {
cout << sp;
}
for (k = 0; k < n - j; k++) {
cout << hash;
}
cout << endl;
x--;
}
return 0;
}
|
66ae9410c321013320cb9c47c9f88822599c61ec | 70a9bd9f45c623433317be4b357d4d5c3b4be7cf | /yiffurc/yiffurc/net_scan.cpp | fdc506f7f09553aacc85be1bd42fb9d4141baaa7 | [
"MIT"
] | permissive | qtHosting/Furnarchy | e5b5c0ecc39bc6e94fa9a8022c09f22b89ad5e50 | 60bf0811c1dd3ed18a7578932a3a78f3b0eb26be | refs/heads/master | 2022-02-23T12:56:08.922554 | 2016-06-12T18:20:05 | 2016-06-12T18:20:05 | 44,062,051 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 7,632 | cpp | net_scan.cpp | /************************************************************************/
/* Copyright (c) 2006 Cluracan (strangelove@heroinpuppy.com) */
/* */
/* The "MIT" License */
/* */
/* Permission is hereby granted, free of charge, to any person */
/* obtaining a copy of this software and associated documentation */
/* files (the "Software"), to deal in the Software without restriction, */
/* including without limitation the rights to use, copy, modify, merge, */
/* publish, distribute, sublicense, and/or sell copies of the Software, */
/* and to permit persons to whom the Software is furnished to do so, */
/* subject to the following conditions: */
/* */
/* - The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES */
/* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */
/* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */
/* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
/* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, */
/* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER */
/* DEALINGS IN THE SOFTWARE. */
/************************************************************************/
#include "net.h"
#include "pfx_heap.h"
#include "misc.h"
#include <list>
#include <string>
#include <cstdarg>
#ifdef _MSC_VER
#include <xutility>
#endif
#include <cassert>
namespace yiffurc {
int YIFFURC_CALL net_scan( const char* pattern,
const char* subj, int subj_len,
... )
{
assert( pattern );
if (subj_len == -1)
{
assert( subj );
subj_len = strlen( subj );
}
assert( subj );
va_list vargs;
va_start( vargs, subj_len );
int subj_pos = 0;
while (subj_pos < subj_len && pattern[ 0 ])
{
// Format specifier?
if (pattern[ 0 ] == '%')
{
++pattern;
// Read in the length field.
unsigned field_len = 1;
if (pattern[ 0 ] >= '0' && pattern[ 0 ] <= '9')
{
for (field_len = 0; pattern[ 0 ] >= '0' && pattern[ 0 ] <= '9'; ++pattern)
field_len = field_len * 10 + (pattern[ 0 ] - '0');
}
else if (pattern[ 0 ] == '*') // Infinite length.
field_len = -1;
// Read in field.
switch (pattern[ 0 ])
{
case '%': // Literal '%'
{
field_len = 1;
if (subj[ subj_pos ] != '%')
return false;
pattern += 1;
break;
}
case 'c': // One character.
{
const bool is_cstr = (field_len == -1);
if ((unsigned) (subj_len - subj_pos) < field_len)
{
if (field_len == -1)
field_len = subj_len - subj_pos;
else
return false;
}
char* buf = va_arg( vargs, char* );
memcpy( buf, subj + subj_pos, field_len );
if (is_cstr)
buf[ field_len ] = '\0';
pattern += 1;
break;
}
case 's': // Byte-string.
{
if ((unsigned) subj[ subj_pos ] < 35)
return false;
field_len = 1 + ftoi1_220( subj[ subj_pos ] );
if ((unsigned) (subj_len - subj_pos) < field_len)
return false;
char* buf = va_arg( vargs, char* );
memcpy( buf, subj + subj_pos + 1, field_len - 1 );
buf[ field_len - 1 ] = '\0';
pattern += 1;
break;
}
case 'k': // Old-style color code.
{
field_len = 10;
if ((unsigned) (subj_len - subj_pos) < field_len)
return false;
for (unsigned i = 0; i < field_len; ++i)
if ((unsigned) subj[ subj_pos + i ] < 0x20 || (unsigned) subj[ subj_pos + i ] > 0x7E)
return false;
char* buf = va_arg( vargs, char* );
memcpy( buf, subj + subj_pos, field_len );
buf[ field_len ] = '\0';
pattern += 1;
break;
}
case 'K': // New-style color code.
{
field_len = get_color_len( subj + subj_pos, subj_len - subj_pos );
for (unsigned i = 0; i < field_len; ++i)
if ((unsigned) subj[ subj_pos + i ] < 35)
return false;
char* buf = va_arg( vargs, char* );
memcpy( buf, subj + subj_pos, field_len );
buf[ field_len ] = '\0';
pattern += 1;
break;
}
case 'n': // Base-95 digit.
{
if ((unsigned) (subj_len - subj_pos) < field_len)
return false;
for (unsigned i = 0; i < field_len; ++i)
if ((unsigned) subj[ subj_pos + i ] < 0x20 || (unsigned) subj[ subj_pos + i ] > 0x7E)
return false;
unsigned n = 0;
for (unsigned i = 0; i < field_len; ++i)
n = (n * 95) + ((unsigned) subj[ subj_pos + i ] - (unsigned) ' ');
int* buf = va_arg( vargs, int* );
*buf = n;
pattern += 1;
break;
}
case 'N': // Base-220 digit.
{
if ((unsigned) (subj_len - subj_pos) < field_len)
return false;
for (unsigned i = 0; i < field_len; ++i)
if ((unsigned) subj[ subj_pos + i ] < 35)
return false;
unsigned n = 0;
for (unsigned mul = 1, i = 0; i < field_len; mul *= 220, ++i)
n += ((unsigned char) subj[ subj_pos + i ] - (unsigned char) '#') * mul;
int* buf = va_arg( vargs, int* );
*buf = n;
pattern += 1;
break;
}
default: // Unknown. Assume literal '%'
{
field_len = 1;
if (subj[ subj_pos ] != '%')
return false;
// Don't advance the pattern.
break;
}
}
subj_pos += field_len;
}
else // Literal.
{
if (subj[ subj_pos++ ] != (pattern++)[ 0 ])
return false;
}
}
va_end( vargs );
// If exhausted both the pattern and suibject, scan was a success.
return (subj_pos == subj_len && !*pattern);
}
} // namespace yiffurc |
d5b9726b9d79e9a7945717851769852d118eb8a7 | 44a541ac00836644292bb72246f4026fc57e49c5 | /app2/app2_2d.cc | 47811b71ceabbd7a3912cf28e4d6b9cd99baf1cd | [] | no_license | SCOREC/adios2_examples | 555923e96db61db260205f3dda86ca359dbb0888 | 110a91ce685854555589802da774b94861291745 | refs/heads/master | 2022-11-13T19:12:58.439915 | 2020-06-25T02:23:11 | 2020-06-25T02:23:11 | 256,239,820 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 4,479 | cc | app2_2d.cc | #include<iostream>
#include<vector>
#include<assert.h>
#include<adios2.h>
#include<mpi.h>
#include<numeric>
using twoD_vec = std::vector<std::vector<float>>;
void read_density(twoD_vec &density, int rank, int size);
void write_field(const twoD_vec &field, int rank, int size);
int main(int argc, char *argv[])
{
int rank , size, step = 0;
twoD_vec density = {{0.0},{0.0}};
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
while(step < 5)
{
read_density(density, rank, size);
// returning the same varaible density across the loop
write_field(density, rank, size);
std::cout << "This is for time step " << step << std::endl;
step++;
}
MPI_Barrier(MPI_COMM_WORLD);
if( !rank )
{
assert (density[0][0] == (float)0);
std::cout << "The asserted first density value is " << density[0][0] << "\n";
std::cout << "xgc proxy done\n";
}
MPI_Finalize();
return 0;
}
void write_field(const twoD_vec &field, int rank, int size)
{
const std::size_t Nx = field[0].size();
const std::size_t Ny = field.size();
try
{
std::cout << rank << " start writing \n";
adios2::ADIOS xc_adios(MPI_COMM_WORLD, adios2::DebugON);
adios2::IO xfieldIO = xc_adios.DeclareIO("xcIO");
xfieldIO.SetEngine("Sst");
adios2::Dims gdims, start, count;
gdims = {Ny, Nx};
const std::size_t count_x = Nx/size;
start = {0, rank * count_x};
count = {Ny, count_x};
auto bp_xfield = xfieldIO.DefineVariable<float>("bp_xfield", gdims, start, count);
adios2::Engine xfieldWriter = xfieldIO.Open("xfield.bp", adios2::Mode::Write);
xfieldWriter.BeginStep();
xfieldWriter.Put<float>(bp_xfield, (field.data())->data());
xfieldWriter.EndStep();
xfieldWriter.Close();
std::cout << rank << " Done writing \n";
}
catch(std::invalid_argument &e)
{
std::cout << "Invalid argumant exception, STOPPING PROGRAM from rank "
<< rank << "\n";
std::cout << e.what() << "\n";
}
catch(std::ios_base::failure &e)
{
std::cout << "IO system base failure exception, STOPPING PROGRAM from rank "
<< rank << "\n";
std::cout << e.what() << "\n";
}
catch(std::exception &e)
{
std::cout << "Exception, STOPPING PROGRAM from rank " << rank << "\n";
std::cout << e.what() << "\n";
}
}
void read_density(twoD_vec &dens, int rank, int size)
{
try
{
std::cout << rank << " start reading\n";
adios2::ADIOS xc_adios(MPI_COMM_WORLD, adios2::DebugON);
adios2::IO cdensIO = xc_adios.DeclareIO("xcIO");
cdensIO.SetEngine("Sst");
adios2::Engine cdensReader = cdensIO.Open("gdens.bp", adios2::Mode::Read);
cdensReader.BeginStep();
adios2::Variable<float> bp_cdens = cdensIO.InquireVariable<float>("bp_gdens");
auto height = bp_cdens.Shape()[0] ;
auto width = bp_cdens.Shape()[1];
std::cout << "first dim - Incoming variable is of size " << height << std::endl;
std::cout << "second dim - Incoming variable with size " << width << std::endl;
auto shape = bp_cdens.Shape();
size_t data_size = std::accumulate(shape.begin(), shape.end(), 1, std::multiplies<size_t>());
std::cout << "shapes accumulated variable has size " << data_size <<std::endl;
long unsigned int f_count = (width/size);
long unsigned int f_start = rank * f_count;
//if(rank == size - 1) f_count += width%size;
std::cout << "cDensity Reader of rank " << rank << " reading " << f_count
<< " floats starting at element " << f_start << "\n";
const adios2::Dims start{0, f_start};
const adios2::Dims count{height, f_count};
const adios2::Box<adios2::Dims> sel(start, count);
for(int i=0; i < height; i++)
{
dens[i].resize(width);
}
bp_cdens.SetSelection(sel);
cdensReader.Get(bp_cdens, (dens.data())->data());
cdensReader.EndStep();
cdensReader.Close();
std::cout << rank << " done reading\n";
}
catch (std::invalid_argument &e)
{
std::cout << "Invalid argument exception, STOPPING PROGRAM from rank "
<< rank << "\n";
std::cout << e.what() << "\n";
}
catch (std::ios_base::failure &e)
{
std::cout << "IO System base failure exception, STOPPING PROGRAM "
"from rank "
<< rank << "\n";
std::cout << e.what() << "\n";
}
catch (std::exception &e)
{
std::cout << "Exception, STOPPING PROGRAM from rank " << rank << "\n";
std::cout << e.what() << "\n";
}
}
|
c600c722d7ce7bc02ddee58da5e001c3916cbe6e | 3a39b41a8f76d7d51b48be3c956a357cc183ffae | /BeakjoonOJ/6000/6246_풍선놀이.cpp | ff79ed5a8032957660bf545fdeff16b49bb4583a | [] | no_license | Acka1357/ProblemSolving | 411facce03d6bf7fd4597dfe99ef58eb7724ac65 | 17ef7606af8386fbd8ecefcc490a336998a90b86 | refs/heads/master | 2020-05-05T10:27:43.356584 | 2019-11-07T06:23:11 | 2019-11-07T06:23:11 | 179,933,949 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 299 | cpp | 6246_풍선놀이.cpp | #include <cstdio>
bool chk[10001];
int main()
{
int N, Q; scanf("%d %d", &N, &Q);
for(int i = 0, l, t; i < Q; i++){
scanf("%d %d", &l, &t);
for(int j = l; j <= N; j += t)
chk[j] |= true;
}
int ans = 0;
for(int i = 1; i <= N; i++)
ans += !chk[i];
printf("%d\n", ans);
return 0;
} |
543b475b251eb759a40f52c2a500e897202bc2fb | 61c443b9e434f58391f7dc6555cb4b8ecb520cc6 | /ImageProcessor/PoseEngine.h | 2156f30b58a2d9d44aa8ac98ac79a16fe8773601 | [
"Apache-2.0"
] | permissive | iwatake2222/bittle_controlled_by_pose | cc7d72d1f94dafbbe08055e20d018eabb6e514c9 | 6533db3a9b36648ea46d196b59f2654cf6694c74 | refs/heads/master | 2023-06-04T16:23:58.859144 | 2021-06-20T06:45:46 | 2021-06-20T06:45:46 | 378,290,768 | 12 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,922 | h | PoseEngine.h | /* Copyright 2021 iwatake2222
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef POSE_ENGINE_
#define POSE_ENGINE_
/* for general */
#include <cstdint>
#include <cmath>
#include <string>
#include <vector>
#include <array>
#include <memory>
/* for OpenCV */
#include <opencv2/opencv.hpp>
/* for My modules */
#include "InferenceHelper.h"
class PoseEngine {
public:
enum {
RET_OK = 0,
RET_ERR = -1,
};
typedef struct RESULT_ {
std::vector<float> poseScores; // [body]
std::vector<std::vector<float>> poseKeypointScores; // [body][joint]
std::vector<std::vector<std::pair<float, float>>> poseKeypointCoords; // [body][joint][x, y] (0 - 1.0)
double timePreProcess; // [msec]
double timeInference; // [msec]
double timePostProcess; // [msec]
RESULT_() : timePreProcess(0), timeInference(0), timePostProcess(0)
{}
} RESULT;
public:
PoseEngine() {}
~PoseEngine() {}
int32_t initialize(const std::string& workDir, const int32_t numThreads);
int32_t finalize(void);
int32_t invoke(const cv::Mat& originalMat, RESULT& result);
private:
std::unique_ptr<InferenceHelper> m_inferenceHelper;
std::vector<InputTensorInfo> m_inputTensorList;
std::vector<OutputTensorInfo> m_outputTensorList;
};
#endif
|
f7248c4bfbe694620715d3e26d609e175e1d7303 | c1c3aea6db9be1a1e88baadbcdb444f11f2a576a | /full_thread_safe_queue_listing_4_5.cpp | fb9fcf3baff728243b7f23b66af2fa82a2602eef | [] | no_license | SafinaM/concurrency | bb0d5542cc60affbac42485269dc9a410c0334a6 | 701d76d3fec15da8da8e5d250d6431c63f3026ae | refs/heads/master | 2021-06-30T19:49:06.313257 | 2020-11-25T05:56:25 | 2020-11-25T05:56:25 | 194,494,849 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,046 | cpp | full_thread_safe_queue_listing_4_5.cpp | //
// Created by mar on 12.11.2020.
//
#include "common_listing_4.h"
#include <thread>
#include <queue>
#include <mutex>
#include <condition_variable>
#include <iostream>
template <typename T>
class thread_safe_queue {
public:
thread_safe_queue() = default;
thread_safe_queue(const thread_safe_queue& other) {
std::lock_guard<std::mutex> lk(other.mut);
m_queue = other.data_queue;
}
void push(const T& value) {
std::lock_guard<std::mutex>lockGuard(m_mutex);
m_queue.push(value);
m_cond.notify_one();
}
bool try_pop(T& value) {
if (m_queue.empty())
return false;
value = m_queue.front();
m_queue.pop();
}
std::shared_ptr<T> try_pop() {
if (m_queue.empty())
return false;
std::shared_ptr<T> ptr = std::make_shared(m_queue.front());
m_queue.pop();
return ptr;
}
void wait_and_pop(T& value) {
std::unique_lock<std::mutex> uniqueLock(m_mutex);
m_cond.wait(uniqueLock, [this]() {
return !m_queue.empty();
});
value = m_queue.front();
m_queue.pop();
}
std::shared_ptr<T> wait_and_pop(const T& value) {
std::unique_lock<std::mutex> uniqueLock(m_mutex);
m_cond.wait(uniqueLock, [this]() {
return !m_queue.empty();
});
std::shared_ptr<T> ptr = std::make_shared(m_queue.front());
m_queue.pop();
return ptr;
}
bool empty() {
std::lock_guard<std::mutex> lockGuard(m_mutex);
return m_queue.empty();
}
private:
mutable std::mutex m_mutex;
std::condition_variable m_cond;
std::queue<T> m_queue;
};
thread_safe_queue<Data> data_queue;
void data_preparation_thread() {
while(more_data_prepare()) {
Data data = get_data();
data_queue.push(data);
std::cout << "data number " << data.number << " was added!" << std::endl;
}
}
void data_processing_thread() {
while (true) {
Data data;
data_queue.wait_and_pop(data);
std::cout << "Here data should be processed!" << std::endl;
if (data.isLast()) {
break;
}
}
}
int main() {
std::thread thr1(data_preparation_thread);
std::thread thr2(data_processing_thread);
thr1.join();
thr2.join();
return 0;
} |
02c94ec27682c54b2661fcc45684c199cd3c6099 | fdd1021a6e359508bbfa17f414b51ea6849c74ca | /Overloading/OperatorOverloading.cpp | ad907a83974a45e695bc990490802659b4ad2528 | [] | no_license | Anooppandikashala/CPP | b246a63aceda32b938cb83419f9be5aca6c8f15a | 7efe42ce760e75e6342fc502ead0442c24455b9a | refs/heads/master | 2022-11-21T21:35:55.440412 | 2022-11-17T11:54:39 | 2022-11-17T11:54:39 | 161,065,326 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,151 | cpp | OperatorOverloading.cpp | /*
Operator Overloading
use special function operator
return-type operator operator-symbol(arguments)
{
//body
return value
}
//operator-symbol : + - < > ++ --
// . ? ::
Types
1. Overloading unary-operators ++, --
2. Overloading binary-operators +, -
*/
#include<iostream>
class Complex
{
public:
Complex()
{
real = 0;
img = 0;
}
Complex(double r, double i)
{
real = r;
img = i;
}
Complex operator +(const Complex& c)
{
Complex ret;
ret.real = c.real + real;
ret.img = c.img + img;
return ret;
}
Complex operator -(const Complex& c)
{
Complex ret;
ret.real = c.real - real;
ret.img = c.img - img;
return ret;
}
void print()
{
std::cout << real << " + i" << img << std::endl;
}
double real;
double img;
};
int main(int argc, char const *argv[])
{
Complex c1(10,20);
Complex c2(5,10);
Complex c3 = c1 + c2;
c3.print();
Complex c4 = c1 - c2;
c4.print();
return 0;
}
|
3b852b8158456816c696d9da2439867eed136278 | c170c8ac16bc7de902d3172e96bfc86e5d23af30 | /Advent of code 2022/src/Day02.cpp | c59bb58fee46df87cb865c9fbc23a5ce81ed00d8 | [] | no_license | Mabbus44/cProjects | f39ec57c377e89a4733ef1de816851b1d7d4aa39 | 484554f04f52316a2ad9385db446c9ba59c14ebc | refs/heads/master | 2023-08-09T19:23:45.228135 | 2023-07-29T15:06:38 | 2023-07-29T15:06:38 | 184,370,392 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,663 | cpp | Day02.cpp | #include "Day02.h"
Day02::Day02()
{
//ctor
}
Day02::~Day02()
{
//dtor
}
void Day02::part1(string filename){
InputLoader loader(filename);
vector<vector<string>> input = loader.toVectorStr2d({" "});
vector<vector<Play>> plays = inputToPlay(input);
int score = 0;
for(vector<Play> p: plays){
score += scoreForPlay(p);
}
cout << "part 1: " << score << endl;
}
void Day02::part2(string filename){
InputLoader loader(filename);
vector<vector<string>> input = loader.toVectorStr2d({" "});
vector<vector<Play>> plays = inputToPlay2(input);
int score = 0;
for(vector<Play> p: plays){
score += scoreForPlay(p);
}
cout << "part 2: " << score << endl;
}
vector<vector<Play>> Day02::inputToPlay(vector<vector<string>> input)
{
vector<vector<Play>> ret;
for(vector<string> vs: input){
vector<Play> oneMove;
for(string s: vs){
if(s == "A" || s == "X")
oneMove.push_back(ROCK);
if(s == "B" || s == "Y")
oneMove.push_back(PAPER);
if(s == "C" || s == "Z")
oneMove.push_back(SCISSORS);
}
ret.push_back(oneMove);
}
return ret;
}
vector<vector<Play>> Day02::inputToPlay2(vector<vector<string>> input)
{
vector<vector<Play>> ret;
for(vector<string> vs: input){
vector<Play> oneMove;
Play oponentPlay;
if(vs[0] == "A")
oponentPlay = ROCK;
if(vs[0] == "B")
oponentPlay = PAPER;
if(vs[0] == "C")
oponentPlay = SCISSORS;
oneMove.push_back(oponentPlay);
if(vs[1] == "X")
oneMove.push_back(playFromOutcome(oponentPlay, LOSE));
if(vs[1] == "Y")
oneMove.push_back(playFromOutcome(oponentPlay, DRAW));
if(vs[1] == "Z")
oneMove.push_back(playFromOutcome(oponentPlay, WIN));
ret.push_back(oneMove);
}
return ret;
}
Play Day02::playFromOutcome(Play oponentsPlay, Outcome outcome){
if(outcome == DRAW)
return oponentsPlay;
if(outcome == LOSE){
if(oponentsPlay == ROCK)
return SCISSORS;
if(oponentsPlay == PAPER)
return ROCK;
if(oponentsPlay == SCISSORS)
return PAPER;
}
if(oponentsPlay == ROCK)
return PAPER;
if(oponentsPlay == PAPER)
return SCISSORS;
if(oponentsPlay == SCISSORS)
return ROCK;
cout << "MAJOR ERROR";
}
int Day02::scoreForPlay(vector<Play> play){
int score = 0;
if(play[0] == play[1])
score += 3;
else if((play[0] == ROCK && play[1] == PAPER) ||
(play[0] == PAPER && play[1] == SCISSORS) ||
(play[0] == SCISSORS && play[1] == ROCK))
score += 6;
if(play[1] == ROCK)
score += 1;
if(play[1] == PAPER)
score += 2;
if(play[1] == SCISSORS)
score += 3;
return score;
}
|
32a225371711366089c40e92bf0d6863c8224955 | 2c07b718746e38da243cec591d05a95c26ad948a | /SQF/dayz_code_1801/Configs/CfgLoot/BuildingLoot/Caribou_Clothing.hpp | 00291102d2d86378e4fc6452b33eab003fcbc16b | [] | no_license | grafzahl/DayZ-Caribou | 9749f0544b94aca9d5366cd4607778224206e5ed | 204461bdbb69dbf98f805c080740bca3f0059959 | HEAD | 2016-09-08T00:33:35.869722 | 2013-11-05T13:50:57 | 2013-11-05T13:50:57 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 658 | hpp | Caribou_Clothing.hpp | CaribouClothing[] = {
{"Skin_Soldier1_DZ",0.02},
{"Skin_Sniper1_DZ",0.03},
{"Skin_Camo1_DZ",0.02},
{"Skin_Camo2_DZ",0.01},
{"Skin_Rebel1_DZ",0.01},
{"Skin_Rebel2_DZ",0.01},
{"Skin_Rebel3_DZ",0.01},
{"Skin_Rebel4_DZ",0.01},
{"Skin_Rebel5_DZ",0.01},
{"Skin_Rebel6_DZ",0.01},
{"Skin_Diver1_DZ",0.01},
{"Skin_Diver2_DZ",0.01},
{"Skin_Merc1_DZ",0.01},
{"Skin_Merc2_DZ",0.01},
{"Skin_Merc3_DZ",0.01},
{"Skin_Merc4_DZ",0.01},
{"Skin_Merc5_DZ",0.01},
{"Skin_BlackOps1_DZ",0.01},
{"Skin_BlackOps2_DZ",0.01},
{"Skin_BlackOps3_DZ",0.01},
{"Skin_BlackOps4_DZ",0.01},
{"Skin_BlackOps5_DZ",0.01},
{"Skin_Pilot1_DZ",0.01},
{"Skin_Pilot2_DZ",0.01}
}; |
bbff3430277bce5ccb45f2a57745ab086bcda6a5 | 2d6a8a21cf01d13c552b82d043561c5c5eb09bbc | /students/kamyshova_ju/form2.h | a0cdaa85ab24cbe83ded0317b5aa5fff61d9dc15 | [] | no_license | leti-fkti-1381/2013-1381-sem-4 | 1fd42b812ab3e34ff7e49915099111c32715a422 | b40e5985841b73f0661161e71911a590b8801fce | refs/heads/master | 2016-09-11T04:55:28.208734 | 2013-06-11T19:11:53 | 2013-06-11T19:11:53 | 8,007,891 | 0 | 2 | null | 2013-02-04T14:47:36 | 2013-02-04T13:39:58 | null | UTF-8 | C++ | false | false | 6,726 | h | form2.h | #pragma once
#include "stdafx.h"
#include <iostream>
#include "func.h"
using namespace std;
namespace prune_and_search {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Сводка для form2
/// </summary>
public ref class form2 : public System::Windows::Forms::Form
{
public:
int **Mat;
int kolvo, h1;
int kol;
private: System::Windows::Forms::Button^ button1;
public:
private: System::Windows::Forms::Button^ button3;
private: System::Windows::Forms::Button^ button4;
public: form2(int **Matr, int a, int b)
{
InitializeComponent();
Mat = Matr;
kolvo = a;
h1 = b;
kol = 0;
//
//TODO: добавьте код конструктора
//
}
protected:
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
~form2()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::RichTextBox^ richTextBox1;
protected:
private: System::Windows::Forms::Label^ label1;
protected:
private:
/// <summary>
/// Требуется переменная конструктора.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Обязательный метод для поддержки конструктора - не изменяйте
/// содержимое данного метода при помощи редактора кода.
/// </summary>
void InitializeComponent(void)
{
System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(form2::typeid));
this->richTextBox1 = (gcnew System::Windows::Forms::RichTextBox());
this->label1 = (gcnew System::Windows::Forms::Label());
this->button1 = (gcnew System::Windows::Forms::Button());
this->button3 = (gcnew System::Windows::Forms::Button());
this->button4 = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// richTextBox1
//
this->richTextBox1->Location = System::Drawing::Point(26, 53);
this->richTextBox1->Name = L"richTextBox1";
this->richTextBox1->ReadOnly = true;
this->richTextBox1->Size = System::Drawing::Size(577, 249);
this->richTextBox1->TabIndex = 0;
this->richTextBox1->Text = L"";
this->richTextBox1->TextChanged += gcnew System::EventHandler(this, &form2::richTextBox1_TextChanged);
//
// label1
//
this->label1->AutoSize = true;
this->label1->Font = (gcnew System::Drawing::Font(L"Times New Roman", 21.75F, static_cast<System::Drawing::FontStyle>((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic)),
System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(204)));
this->label1->ForeColor = System::Drawing::SystemColors::HotTrack;
this->label1->Location = System::Drawing::Point(167, 9);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(321, 33);
this->label1->TabIndex = 1;
this->label1->Text = L"Пошаговая сортировка";
//
// button1
//
this->button1->Location = System::Drawing::Point(26, 317);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 23);
this->button1->TabIndex = 2;
this->button1->Text = L"Начало";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &form2::button1_Click);
//
// button3
//
this->button3->Location = System::Drawing::Point(413, 317);
this->button3->Name = L"button3";
this->button3->Size = System::Drawing::Size(75, 23);
this->button3->TabIndex = 4;
this->button3->Text = L"Вперёд";
this->button3->UseVisualStyleBackColor = true;
this->button3->Click += gcnew System::EventHandler(this, &form2::button3_Click);
//
// button4
//
this->button4->Location = System::Drawing::Point(528, 317);
this->button4->Name = L"button4";
this->button4->Size = System::Drawing::Size(75, 23);
this->button4->TabIndex = 5;
this->button4->Text = L"Конец";
this->button4->UseVisualStyleBackColor = true;
this->button4->Click += gcnew System::EventHandler(this, &form2::button4_Click);
//
// form2
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->BackColor = System::Drawing::Color::Wheat;
this->ClientSize = System::Drawing::Size(637, 389);
this->Controls->Add(this->button4);
this->Controls->Add(this->button3);
this->Controls->Add(this->button1);
this->Controls->Add(this->label1);
this->Controls->Add(this->richTextBox1);
this->Icon = (cli::safe_cast<System::Drawing::Icon^ >(resources->GetObject(L"$this.Icon")));
this->Name = L"form2";
this->Text = L"QuickSort";
this->Load += gcnew System::EventHandler(this, &form2::form2_Load);
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void form2_Load(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void richTextBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
this->richTextBox1->Text = L"";
kol = 0;
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
if(kol < kolvo)
{
this->richTextBox1->Text += L"Шаг "+ System::Convert::ToString(kol+1)+"\n";
for(int i = 0; i < h1; i++)
{
this->richTextBox1->Text += System::Convert::ToString(Mat[kol][i]);
if(i < (h1 - 1))
this->richTextBox1->Text += " ";
}
this->richTextBox1->Text += "\n";
kol ++;
}
else
MessageBox::Show("Массив уже отсортирован.", "Ок", MessageBoxButtons::OK);
}
private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {
this->richTextBox1->Text = L"";
kol = kolvo;
for(int i = 0; i < kolvo; i++)
{
this->richTextBox1->Text += L"Шаг "+ System::Convert::ToString(i+1)+"\n";
for(int j = 0; j < h1; j ++)
{
this->richTextBox1->Text += System::Convert::ToString(Mat[i][j]);
if(j < (h1 - 1))
this->richTextBox1->Text += " ";
}
this->richTextBox1->Text += "\n";
}
}
};
}
|
2837f8aa1a72b3ae04a2d0405f6df91d618076e8 | 35bd23a9fcb680dd97a68524fff886216b3d8fd1 | /Programming Questions/12. Strings/WaysToDeclareStrings.cpp | 6188f1fa7c213c112315c105e18849dace948c6c | [] | no_license | hrithiksagar/Competetive-Programming | 3736279cb8dc79ccf9d6820870ce2f6c7253cf86 | 9346b007b0ee47d4909d8e5283d35e931c82a90d | refs/heads/main | 2023-07-24T17:30:35.492736 | 2021-08-25T13:05:54 | 2021-08-25T13:05:54 | 379,348,691 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 767 | cpp | WaysToDeclareStrings.cpp | #include<iostream>
#include<string>
using namespace std;
int main(){
// declaring a string
// StringKeyword Identifier
// data type analog s
string str;
string str1(5, 'n');
cout<< str1<<endl; // nnnnn
string str2 = "HrithikSagar";
cout<<str2<<endl; // HrithikSagar
// inputing string with space i.e. entering a statement which will have spaces too in that
string str3;
getline(cin, str3); // take input // hrithik sagar is determined
cout<< str3<<endl; // hrithik sagar is determined
// if we use cin
string str4;
cin>>str4; // hrithik sagar is determined
cout<<str4<< endl; //hrithik // output only displays until it sees first space
// thats why we use getline for strings
return 0;
} |
2c9780ec4386a31171df760bd6eb2e73acde9430 | cbf323b6b406c76658f76896b93a369c24ca924b | /JCEngine/DebugRenderer.cpp | 9bccef7b17e1ca78b7c84c3ca92168e5a37ca20a | [] | no_license | jkcollins1024/game-engine | 523e3c9936516a3fffa9f5c6eab70dc40d190e51 | da2459af69efb370d26b8f5714e4f19c9e825b70 | refs/heads/master | 2023-09-03T18:10:33.072778 | 2021-10-27T02:09:07 | 2021-10-27T02:09:07 | 421,644,255 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,196 | cpp | DebugRenderer.cpp | #include "DebugRenderer.h"
const float PI = 3.14159265358f;
const char* VERTEX_SOURCE = R"(#version 130
in vec2 vertexPosition;
in vec4 vertexColor;
out vec2 fragmentPosition;
out vec4 fragmentColor;
uniform mat4 P;
void main(){
gl_Position.xy = (P * vec4(vertexPosition.x, vertexPosition.y, 0.0, 1.0)).xy;
gl_Position.z = 0.0;
gl_Position.w = 1.0;
fragmentPosition = vertexPosition;
fragmentColor = vertexColor;
})";
const char* FRAGMENT_SOURCE = R"(#version 130
in vec2 fragmentPosition;
in vec4 fragmentColor;
out vec4 color;
void main(){
color = fragmentColor;
})";
namespace JCEngine {
DebugRenderer::DebugRenderer()
{
}
DebugRenderer::~DebugRenderer()
{
dispose();
}
void DebugRenderer::init()
{
//set up shaders
m_program.compileShadersFromSource(VERTEX_SOURCE, FRAGMENT_SOURCE);
m_program.addAttribute("vertexPosition");
m_program.addAttribute("vertexColor");
m_program.linkShaders();
//set up buffers
glGenVertexArrays(1, &m_vao);
glGenBuffers(1, &m_vbo);
glGenBuffers(1, &m_ibo);
glBindVertexArray(m_vao);
glBindBuffer(GL_ARRAY_BUFFER, m_vbo);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ibo);
//position attribute and color attribute
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(DebugVertex), (void *)offsetof(DebugVertex, position));
glVertexAttribPointer(1, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(DebugVertex), (void*)offsetof(DebugVertex, color));
glBindVertexArray(0);
}
void DebugRenderer::end()
{
glBindBuffer(GL_ARRAY_BUFFER, m_vbo);
glBufferData(GL_ARRAY_BUFFER, m_vertices.size() * sizeof(DebugVertex), nullptr, GL_DYNAMIC_DRAW);
glBufferSubData(GL_ARRAY_BUFFER, 0, m_vertices.size() * sizeof(DebugVertex), m_vertices.data());
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ibo);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, m_indices.size() * sizeof(GLuint), nullptr, GL_DYNAMIC_DRAW);
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, m_indices.size() * sizeof(GLuint), m_indices.data());
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
m_numElements = m_indices.size();
m_indices.clear();
m_vertices.clear();
}
glm::vec2 rotate(glm::vec2 position, float angle) {
glm::vec2 newVector(position.x * cos(angle) - position.y * sin(angle),
position.x * sin(angle) + position.y * cos(angle));
return newVector;
}
void DebugRenderer::drawBox(const glm::vec4 destRect, const ColorRGBA8& color, float angle)
{
int i = m_vertices.size();
m_vertices.resize(m_vertices.size() + 4);
glm::vec2 halfDimensions(destRect.z / 2.0f, destRect.w / 2.0f);
//get centered position points
glm::vec2 topLeft(-halfDimensions.x, halfDimensions.y);
glm::vec2 botLeft(-halfDimensions.x, -halfDimensions.y);
glm::vec2 topRight(halfDimensions.x, halfDimensions.y);
glm::vec2 botRight(halfDimensions.x, -halfDimensions.y);
glm::vec2 positionOffset(destRect.x, destRect.y);
m_vertices[i].position = rotate(topLeft, angle) + halfDimensions + positionOffset;
m_vertices[i + 1].position = rotate(botLeft, angle) + halfDimensions + positionOffset;
m_vertices[i + 2].position = rotate(botRight, angle) + halfDimensions + positionOffset;
m_vertices[i + 3].position = rotate(topRight, angle) + halfDimensions + positionOffset;
for (int j = i; j < i + 4; j++) {
m_vertices[j].color = color;
}
m_indices.reserve(m_indices.size() + 8);
//push indices to make line segments
m_indices.push_back(i);
m_indices.push_back(i + 1);
m_indices.push_back(i + 1);
m_indices.push_back(i + 2);
m_indices.push_back(i + 2);
m_indices.push_back(i + 3);
m_indices.push_back(i + 3);
m_indices.push_back(i);
}
void DebugRenderer::drawCircle(const glm::vec2 center, const ColorRGBA8& color, float radius)
{
static const int NUM_VERTICES = 100;
//set up vertexes for circle
int start = m_vertices.size();
m_vertices.resize(m_vertices.size() + NUM_VERTICES);
for (int i = 0; i < NUM_VERTICES; i++) {
float angle = PI * 2.0f * (float)i / NUM_VERTICES;
m_vertices[start + i].position.x = center.x + cos(angle) * radius;
m_vertices[start + i].position.y = center.y + sin(angle) * radius;
m_vertices[start + i].color = color;
}
//set up vertex indices for line segment drawing
m_indices.reserve(m_indices.size() + NUM_VERTICES * 2);
for (int i = 0; i < NUM_VERTICES - 1; i++) {
m_indices.push_back(start + i);
m_indices.push_back(start + i + 1);
}
m_indices.push_back(start + NUM_VERTICES - 1);
m_indices.push_back(start);
}
void DebugRenderer::render(const glm::mat4& projectionMatrix, float lineWidth)
{
m_program.use();
//camera matrix
GLint pUniform = m_program.getUniformLocation("P");
glUniformMatrix4fv(pUniform, 1, GL_FALSE, &projectionMatrix[0][0]);
glBindVertexArray(m_vao);
glLineWidth(lineWidth);
glDrawElements(GL_LINES, m_numElements, GL_UNSIGNED_INT, 0);
glBindVertexArray(0);
m_program.unuse();
}
void DebugRenderer::dispose()
{
if (m_vao)
glDeleteVertexArrays(1, &m_vao);
if (m_vbo)
glDeleteBuffers(1, &m_vbo);
if (m_ibo)
glDeleteBuffers(1, &m_ibo);
m_program.dispose();
}
}
|
32a97ab92dc7873a1271bc61ef87e2d5aa44a2ba | 6329fc5f3bb5c2c5ec9ed622c6c8d4c016614e35 | /graphic.hpp | 120f70cc5c949371e4eb1271fef4f700b6107e71 | [] | no_license | DearVa/DearOS | 4911b0ec70f427464d7582eb4b96952f75771795 | 48117f50b8641f28bb199f64f9bb161839495d52 | refs/heads/master | 2023-06-06T11:03:39.604161 | 2021-06-27T16:38:37 | 2021-06-27T16:38:37 | 380,481,133 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,565 | hpp | graphic.hpp | #pragma once
#include <SPI.h>
#include <TFT_eSPI.h> // 别忘了配置
#include "lua.h"
#include "lauxlib.h"
#define TFT_GREY 0x5AEB
namespace graphic {
TFT_eSPI tft = TFT_eSPI();
void setup() {
tft.init();
tft.setRotation(0);
tft.fillScreen(TFT_GREY);
tft.setTextColor(TFT_GREEN, TFT_GREY);
tft.drawCentreString("DearOS", 64, 64, 1);
}
static int fillScreenLua(lua_State *L) {
int n = lua_gettop(L); // 获取参数个数
if (n != 1) {
lua_pushstring(L, "Incorrect argument");
lua_error(L);
}
tft.fillScreen(luaL_checkinteger(L, 1));
return 0;
}
static int drawPixelLua(lua_State *L) {
int n = lua_gettop(L); // 获取参数个数
if (n != 3) {
lua_pushstring(L, "Incorrect argument");
lua_error(L);
}
tft.drawPixel(luaL_checkinteger(L, 1), luaL_checkinteger(L, 2), luaL_checkinteger(L, 3));
return 0;
}
static int fillCircleLua(lua_State *L) {
int n = lua_gettop(L); // 获取参数个数
if (n != 4) {
lua_pushstring(L, "Incorrect argument");
lua_error(L);
}
tft.fillCircle(luaL_checkinteger(L, 1), luaL_checkinteger(L, 2), luaL_checkinteger(L, 3), luaL_checkinteger(L, 4));
return 0;
}
void registerLua(lua_State *L) {
lua_register(L, "fillScreen", fillScreenLua);
lua_register(L, "drawPixel", drawPixelLua);
lua_register(L, "fillCircle", fillCircleLua);
}
} // namespace graphic |
2aeecd1e7322a77f20a4e5dcf551e8f5bd7ef1d1 | 279b84a9d7ca481ab56dc2eec80d99fdd3c554a1 | /interpolation/Lagrange/lagrange_method.cpp | 729f0dac57421fc6eb63deef0eae622cae474a89 | [] | no_license | dcharrezt/Numerical_Methods | b83651b72e55a7b33627550c23188f6c75211495 | ced01570d05b5dcb7596a7ff2fbc828306115a41 | refs/heads/master | 2020-03-08T10:28:03.835521 | 2018-07-18T23:00:22 | 2018-07-18T23:00:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 971 | cpp | lagrange_method.cpp | #include <iostream>
#include <vector>
using namespace std;
typedef vector< pair<float, float> > coords;
float function( float x ) {
return 1 / x;
}
coords read_input() {
int n_dots;
float x_tmp, y_tmp;
coords dots;
cin >> n_dots;
for(int i = 0; i < n_dots; i++) {
// cin >> x_tmp;
cin >> x_tmp >> y_tmp;
dots.push_back( make_pair( x_tmp, y_tmp) );
}
return dots;
}
void lagrange_interpolation( coords dots, float p_x) {
float L = 0.;
float L_tmp;
for (int i = 0; i < dots.size(); ++i) {
L_tmp = 1;
for (int j = 0; j < dots.size(); ++j) {
if( i != j )
L_tmp *= ((p_x - dots[j].first) / (dots[i].first - dots[j].first));
}
L_tmp *= dots[i].second;
L+=L_tmp;
}
cout << p_x << " " << L << endl;
}
int main() {
coords dots;
dots = read_input();
float p_x;
cin >> p_x;
for (int i = 0; i < dots.size(); ++i) {
cout << dots[i].first << ' ' << dots[i].second << endl;
}
lagrange_interpolation( dots, p_x);
return 0;
}
|
499186c27fe120fd7d9c3ac3957b3b15e844da13 | b510164d0bd5772eb8f1d2c703f5dece060a5e27 | /DLlinklist.cpp | 3a6f5c1d0fbb1abd2d1173b72b45fc91babb131e | [] | no_license | Ishraqsn/Data-Structure | 752b64dcbf2c6e1f8642b45e06ba34fcad241b38 | 2bcd5eabb8e67e4c15b85c1d036133713010e5c4 | refs/heads/master | 2021-05-20T15:48:40.810557 | 2020-04-02T04:28:27 | 2020-04-02T04:28:27 | 252,354,554 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,734 | cpp | DLlinklist.cpp | #include<iostream>
#include<string.h>
#include<conio.h>
using namespace std;
class node
{ public:
int A ;
node *next;
node *prev;
};
class DLL
{
node *first;
public:
DLL()
{
first=NULL;
}
int rev();
int index(int a);
bool isEmpty();
int getsize();
void insert(int a,int index);
void del(int index);
int merge(DLL B,DLL C);
void display();
};
int DLL::index(int a)
{
int index=-1,i=0;
node *cur;
if(first==NULL)// NULL is a macro;
return index;
cur=first;
while(cur->A!=a&&cur!=NULL)
{
cur=cur->next;
i=i+1;
}
index=i;
return index;
}
bool DLL::isEmpty()
{
if(first==NULL)
return true;
return false;
}
int DLL::getsize()
{
int sz=0;
node *cur=first;
while(cur)
{
sz++;
cur=cur->next;
}
return sz;
}
void DLL::insert(int a,int index)
{
if(index<0 ||index>getsize())
{
cout<<"ERROR";
return;
}
node *cur=new node;
node *temp;
cur->A=a;
if(index==0)
{
cur->next=NULL;
cur->prev=NULL;
first=cur;
}
else
{
temp=first;
for(int i=0;i<index-1;i++)
{
temp=temp->next;
}
cur->prev=temp;
temp->next=cur;
cur->next=NULL;
}
}
void DLL::del(int index)
{if(index<0 ||index>getsize())
{
cout<<"ERROR";
return;
}
node *temp,*del;
if(index==0)
{
del=first;
first=del->next;
del->next=NULL;
del->prev=NULL;
delete del;
first->prev=NULL;
}
else
{
temp=first;
for(int i=0;i<index-1;i++)
{
temp=temp->next;
}
del=temp->next;
if(del->next==NULL)
{
del->prev->next=del->next;
del->prev=NULL;
}
else
{
del->prev->next=del->next;
del->next->prev=del->prev;
}
}
delete del;
}
void DLL::display()
{
node *cur=first;
while(cur)
{
cout<<cur->A;
cur=cur->next;
cout<<" ";
}
cout<<endl;
}
int DLL::merge(DLL B,DLL C)
{node *cur;
cur=B.first;
while(cur->next!=NULL)
{
cur=cur->next;
}
cur->next=C.first;
C.first->prev=cur;
}
int DLL::rev()
{
node*cur,*p1,*p2,*p3;
cur=first;
if(cur->next==NULL)
return -1;
p1=cur;
p2=p1->next;
p3=p2->next;
p1->next=NULL;
p1->prev=p2;
p2->next=p1;
while(p3!=NULL)//different ---- p3->next==NULL
{ p1=p2;
p2=p3;
p3=p3->next;
p2->next=p1;
p1->prev=p2;
}
first=p2;
}
int main()
{
DLL l,m;
l.insert(22,0);
l.insert(33,1);
l.insert(44,2);
l.insert(55,3);
l.insert(66,4);
l.insert(77,5);
l.insert(88,6);
l.insert(99,7);
l.display();
l.del(0);
l.del(2);
l.display();
l.del(5);
l.display();
l.rev();
l.display();
l.del(2);
l.display();
l.rev();
l.display();
return 0;
}
|
df6fbe19ce08bffac27d4975cfcd0cd4a071d2c0 | 6799592f780197259b8217c70c7f905da233a2ed | /plugins/network/guid.hpp | cc1e5b5ca6e0e5f4dcbabde43f6f878c483012c0 | [
"BSD-3-Clause"
] | permissive | FarGroup/FarManager | 22b1f754a4cf4bcc6e1822a6ce66408fabf140d5 | da34b0c6da3e03518b8ce7e53783e9fda518bac4 | refs/heads/master | 2023-08-20T04:52:54.443453 | 2023-08-12T20:53:56 | 2023-08-12T20:53:56 | 107,807,404 | 1,691 | 228 | BSD-3-Clause | 2023-09-14T20:07:19 | 2017-10-21T18:55:45 | C++ | UTF-8 | C++ | false | false | 739 | hpp | guid.hpp | // {773B5051-7C5F-4920-A201-68051C4176A4}
DEFINE_GUID(MainGuid, 0x773b5051, 0x7c5f, 0x4920, 0xa2, 0x1, 0x68, 0x5, 0x1c, 0x41, 0x76, 0xa4);
// {24B6DD41-DF12-470A-A47C-8675ED8D2ED4}
DEFINE_GUID(MenuGuid, 0x24b6dd41, 0xdf12, 0x470a, 0xa4, 0x7c, 0x86, 0x75, 0xed, 0x8d, 0x2e, 0xd4);
// {9DB4FB17-5930-45EA-BBB9-ED04E68959E1}
DEFINE_GUID(ConfigDialogGuid, 0x9db4fb17, 0x5930, 0x45ea, 0xbb, 0xb9, 0xed, 0x4, 0xe6, 0x89, 0x59, 0xe1);
// {824A24CF-DA57-4677-8D27-86937BE31BC2}
DEFINE_GUID(DisconnectDialogGuid, 0x824a24cf, 0xda57, 0x4677, 0x8d, 0x27, 0x86, 0x93, 0x7b, 0xe3, 0x1b, 0xc2);
// {C854DDAF-BFE5-446A-9676-9639A61F8ADD}
DEFINE_GUID(UserPassDialogGuid, 0xc854ddaf, 0xbfe5, 0x446a, 0x96, 0x76, 0x96, 0x39, 0xa6, 0x1f, 0x8a, 0xdd);
|
cf38136e201f796abc398a272fe8ae90a1307c4a | 29ba22c4fe73a3f5c6c13ae6ba4bb493fd2f957c | /point.h | 6a1d9fe78afb0696a4e8afbcf9c82586036e93b7 | [] | no_license | mingchengzack/2D-Drawing-System | 6681ac0a023a4951252c87838888b8c2cf53a2cd | 78ea4ea27c8e23434f21ba5e218bd8e51b7074ff | refs/heads/master | 2020-04-11T15:13:00.111927 | 2019-10-10T19:37:12 | 2019-10-10T19:37:12 | 161,883,815 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 752 | h | point.h | #ifndef POINT_H
#define POINT_H
//global variable for the clipping window
extern int xmin, ymin, xmax, ymax;
//define the constant for 4bit code
const int INSIDE = 0; // 0000
const int LEFT = 1; // 0001
const int RIGHT = 2; // 0010
const int BOTTOM = 4; // 0100
const int TOP = 8; // 1000
//point class to store a point (x,y)
class Point
{
float x;
float y;
public:
Point();
Point(const Point &p);
Point(float x, float y);
void translate(float dx, float dy); //translate with (dx, dy) vector
void scale(float factor); //unform scale with factor
void rotate(float degree); //rotate around centroid with degree
~Point();
float getX() { return x; }
float getY() { return y; }
int ComputeCode();
};
#endif |
49cf9c0fa33e9f0ea4ad19536b99b329a8f07fd1 | 386a9cdf9400493173b9b85090c48b874b117f71 | /WorkProcess.h | 83a5ba042491dcb866db21f8e1ec25605e3434b4 | [] | no_license | MooRyong-Kim/chippac_insp | a27920904062bc2a78f3fad7f20b7a9ebeb02065 | e58b207a3555c1564846a55511f366cf4a4c16bc | refs/heads/master | 2020-03-27T00:34:19.173408 | 2018-08-22T01:10:22 | 2018-08-22T01:10:22 | 145,635,253 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,631 | h | WorkProcess.h | //---------------------------------------------------------------------------
#ifndef WorkProcessH
#define WorkProcessH
//---------------------------------------------------------------------------
#include "ConstDefine.h"
#include "SubmapViwer.h"
#include <time.h>
#include <vector>
//---------------------------------------------------------------------------
enum COMM_STATUS {
COMM_STANDBY,
COMM_OK,
COMM_NG,
};
enum INSP_RESULT {
INSP_READY,
INSP_OK,
INSP_NG,
INSP_NONE_TARGET,
};
class TWorkProcess
{
private:
int m_nSort;
bool m_bResevePusher[2];
int m_nCurLane;
String m_strBarcode;
protected:
//Motion Process
void __fastcall StartProcess();
void __fastcall StopProcess();
void __fastcall WorkEndCheck();
void __fastcall CycleStopProcess();
void __fastcall PreCvyProcess();
void __fastcall InspCvyProcess(int nRail);
void __fastcall InspCvyProcess();
void __fastcall UlCvyProcess();
void __fastcall VertUlProcess(bool bSetSlot=false);
void __fastcall HoriUlProcess(bool bSetSlot=false);
void __fastcall UnitProcess();
public:
struct {
int nStart;
int nStop;
int nCycStop;
int nInspCvy[2];
int nUnit;
int nUl;
int nUlCvy;
} pNo;
bool m_bLotChgStart;
bool m_bTempErrIgnore;
bool m_bBoatSent;
int m_nRunMode;
int m_nStatus;
TDateTime m_dtStartTime;
clock_t m_tPrsElapsed;
int m_nUphUnitCnt;
TDateTime m_dtUPHStartTime;
bool m_bUPHStartTimeReset;
int m_nOutStripCnt;
bool m_bProcessNumView;
bool m_bUlEmptySlot[MAX_SLOT];
AnsiString m_sManualCmd[2];
bool m_bReservePusher[2];
bool m_bSetUnload[2];
int nVsnRtyCnt;
bool m_bAllSkip;
typedef struct {
bool bInspSkip;
bool bInspDone;
INSP_RESULT eInspErr;
bool bInspManChkDone;
bool bInspGood;
} UNIT_DATA;
UNIT_DATA unit[MAX_UNIT];
struct RESULT_DATA_MEMORY {
bool bRailRejUnit[2][MAX_UNIT];
bool bMgzRejUnit[MAX_MGZ][MAX_SLOT][MAX_UNIT];
} rltMem;
__fastcall TWorkProcess();
__fastcall ~TWorkProcess();
void __fastcall MainProcess(bool bThread=true);
void __fastcall Stop(int nTwrLmp);
void __fastcall ViewAlarm(AnsiString sErrMsg);
bool __fastcall IsWorkEnd();
void __fastcall ProcessSetZero();
bool isRecvWorkEnd;
bool isLastPcb;
COMM_STATUS SubConfirmPass;
COMM_STATUS MagConfirmPass;
int nCrntSlot;
std::vector<String> MagSubId;
SUB_MAP_INFO SubMapData;
};
extern TWorkProcess Work;
#endif
|
9a5952661e4f0de762c93f0dae31f66a31224010 | 02ed68bc5adee0c7d80ea0c97405cdf499b61029 | /eas_disection/overlay.cc | e8b701b191769140c323708eb07463fea94398a4 | [] | no_license | kfinn6561/conex_new | bf5d648d47c4ff91059582a89bf0ccc15631d477 | 4bbb42b9935984c95e393661e73a630ea31c2ed1 | refs/heads/master | 2021-01-18T04:09:04.861140 | 2017-06-30T09:30:40 | 2017-06-30T09:30:40 | 85,757,278 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,054 | cc | overlay.cc | #include <TCanvas.h>
#include <TROOT.h>
#include <TStyle.h>
#include <TApplication.h>
#include <TGraph.h>
#include <TMultiGraph.h>
#include <TFile.h>
#include <TLegend.h>
#include <TTree.h>
#include <TH1.h>
#include <string>
#include <sstream>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <vector>
#include <cmath>
using namespace std;
const int seed = 30;
// -----------------------------------------------------------
struct graphs {
graphs() : lgE(0), dEdX(0), El(0), Mu(0), dEdXall(0), Elall(0), Muall(0) {}
float lgE;
TGraph* dEdX;
TGraph* El;
TGraph* Mu;
TMultiGraph* dEdXall;
TMultiGraph* Elall;
TMultiGraph* Muall;
void SetColor(const int c) {dEdX->SetLineColor(c); El->SetLineColor(c); Mu->SetLineColor(c);}
void SetWidth(const int w) {dEdX->SetLineWidth(w); El->SetLineWidth(w); Mu->SetLineWidth(w);}
void SetStyle(const int s) {dEdX->SetLineStyle(s); El->SetLineStyle(s); Mu->SetLineStyle(s);}
};
// -----------------------------------------------------------
graphs
getData(const string& prefix,
const int iFstart, const int iFstop,
const string& name)
{
const int nMaxX = 10000;
float Xsum[nMaxX], dEdXsum[nMaxX], Musum[nMaxX], Electronssum[nMaxX];
for(int i=0; i<nMaxX; ++i) {
Xsum[i] = 0;
dEdXsum[i] = 0;
Musum[i] = 0;
Electronssum[i] = 0;
}
graphs gRet;
gRet.dEdXall = new TMultiGraph();
gRet.Elall = new TMultiGraph();
gRet.Muall = new TMultiGraph();
int nX_max = 0;
for(int iF=iFstart; iF<iFstop; ++iF) {
ostringstream fullname;
fullname << prefix;
if (iF>=0)
fullname << iF;
fullname << name;
TFile* file = TFile::Open(fullname.str().c_str());
cout << "Reading file: " << fullname.str() << endl;
if (!file || file->IsZombie()) {
cout << "Could not open file " << fullname.str() << endl;
continue;
}
TTree* tree = (TTree*) file->Get("Shower");
if (!tree) {
cout << "Input file broken: Shower tree not found in " << fullname.str() << endl;
continue;
}
int nX = 0;
float X[nMaxX], dEdX[nMaxX], Mu[nMaxX], Electrons[nMaxX];
tree->SetBranchAddress("lgE", &gRet.lgE);
tree->SetBranchAddress("nX", &nX);
tree->SetBranchAddress("X", X);
tree->SetBranchAddress("dEdX", dEdX);
tree->SetBranchAddress("Mu", Mu);
tree->SetBranchAddress("Electrons", Electrons);
tree->GetEntry(0);
nX_max = max(nX_max, nX);
for(int i=0; i<nX; ++i) {
Xsum[i] = X[i];
dEdXsum[i] += dEdX[i];
Musum[i] += Mu[i];
Electronssum[i] += Electrons[i];
}
TGraph* gdEdX = new TGraph(nX-1, X, dEdX);
gdEdX->SetLineStyle(2);
gRet.dEdXall->Add(gdEdX);
TGraph* gEl = new TGraph(nX, X, Electrons);
gEl->SetLineStyle(2);
gRet.Elall->Add(gEl);
TGraph* gMu = new TGraph(nX, X, Mu);
gMu->SetLineStyle(2);
gRet.Muall->Add(gMu);
file->Close();
}
gRet.dEdX = new TGraph(nX_max-1, Xsum, dEdXsum);
gRet.dEdX->GetHistogram()->SetXTitle("Depth [g/cm^{2}]");
gRet.dEdX->GetHistogram()->SetYTitle("Energy Deposit [GeV cm^{2}/g]");
gRet.dEdX->GetXaxis()->CenterTitle();
gRet.dEdX->GetYaxis()->CenterTitle();
gRet.El = new TGraph(nX_max, Xsum, Electronssum);
gRet.El->GetHistogram()->SetXTitle("Depth [g/cm^{2}]");
gRet.El->GetHistogram()->SetYTitle("Electrons");
gRet.El->GetXaxis()->CenterTitle();
gRet.El->GetYaxis()->CenterTitle();
gRet.Mu = new TGraph(nX_max, Xsum, Musum);
gRet.Mu->GetHistogram()->SetXTitle("Depth [g/cm^{2}]");
gRet.Mu->GetHistogram()->SetYTitle("Muons");
gRet.Mu->GetXaxis()->CenterTitle();
gRet.Mu->GetYaxis()->CenterTitle();
return gRet;
}
// -----------------------------------------------------------
void
overlay(const int seed, const int intMin, const int intMax)
{
const int logY = 1;
TCanvas* cShowerdEdX = new TCanvas("cShowerdEdX");
cShowerdEdX->SetLogy(logY);
TCanvas* cShowerMu = new TCanvas("cShowerMu");
cShowerMu->SetLogy(logY);
TCanvas* cShowerEl = new TCanvas("cShowerEl");
cShowerEl->SetLogy(logY);
TLegend* leg = new TLegend(0.55, 0.75, 0.7, 0.9);
leg->SetFillStyle(0);
leg->SetBorderSize(0);
leg->SetTextFont(42);
leg->SetTextSize(0.035);
ostringstream fullName;
fullName << "sibyll_" << setw(9) << setfill('0') << seed << "_100.root";
graphs gFull = getData("full_",-1, 0, fullName.str());
gFull.SetColor(kBlue+1);
gFull.SetWidth(3);
ostringstream legFull;
legFull << "Proton, 10^{" << gFull.lgE << "}eV";
leg->AddEntry(gFull.dEdX, legFull.str().c_str(), "l");
cShowerdEdX->cd();
gFull.dEdX->Draw("al");
cShowerEl->cd();
gFull.El->Draw("al");
cShowerMu->cd();
gFull.Mu->Draw("al");
ostringstream intName;
intName << "_sibyll_" << setw(9) << setfill('0') << seed << "_100.root";
graphs gInt = getData("int_", intMin, intMax, intName.str());
gInt.SetColor(kRed);
gInt.SetWidth(3);
ostringstream legTxt;
legTxt << intMax - intMin + 1 << " Highest Energy Interactions";
leg->AddEntry(gInt.dEdX, legTxt.str().c_str(), "l");
leg->AddEntry(gInt.dEdXall, "Individual Sub-Showers", "l");
cShowerdEdX->cd();
gInt.dEdX->Draw("l");
gInt.dEdXall->Draw("l");
leg->Draw();
cShowerEl->cd();
gInt.El->Draw("l");
gInt.Elall->Draw("l");
leg->Draw();
cShowerMu->cd();
gInt.Mu->Draw("l");
gInt.Muall->Draw("l");
leg->Draw();
}
// -----------------------------------------------------------
int
main(int argc, char** argv)
{
gROOT->SetStyle("Plain");
gStyle->SetPadBottomMargin(0.13);
gStyle->SetPadLeftMargin(0.12);
gStyle->SetOptTitle(0);
gStyle->SetOptStat(0);
gStyle->SetTitleSize(0.055, "XY");
gStyle->SetTitleFont(42, "XY");
// gStyle->SetHistTitleSize(0.06, "X");
if (argc<4) {
cout << " specify: [seed] [interaction min+max]" << endl;
return 2;
}
const int seed = atoi(argv[1]);
const int intMin = atoi(argv[2]);
const int intMax = atoi(argv[3]);
TApplication app("hold", 0, 0);
overlay(seed, intMin, intMax);
app.Run();
return 0;
}
|
2ce371c59e61206a07cb19cf7d333a66cca3eafb | a2bc4234280b841a1a990328f86473a819413726 | /cpp06/ex01/Data.cpp | 2abd1eeab6aa57304d213a4be33b3954087486bb | [] | no_license | rhc716/cpp_module | 9861f34aa06963e3d3a552279ae106203bb459de | ff2ddb13267a16cea8ebfb3c519575d143565008 | refs/heads/master | 2023-04-09T17:49:44.739682 | 2021-04-15T11:53:55 | 2021-04-15T11:53:55 | 350,720,402 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,748 | cpp | Data.cpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Data.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hroh <hroh@student.42seoul.kr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/04/07 14:37:50 by hroh #+# #+# */
/* Updated: 2021/04/07 18:44:23 by hroh ### ########.fr */
/* */
/* ************************************************************************** */
#include "Data.hpp"
int get_random_int()
{
if (std::rand() % 2 == 0)
return (std::numeric_limits<int>::min() + std::rand());
else
return (std::rand());
}
void *serialize(void)
{
static const char alnum[] =
"0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz";
char *ret = new char[20];
for (int i = 0; i < 8; ++i)
ret[i] += alnum[std::rand() % (sizeof(alnum) - 1)];
*reinterpret_cast<int*>(ret + 8) = get_random_int();
for (int i = 0; i < 8; ++i)
ret[i + 12] += alnum[std::rand() % (sizeof(alnum) - 1)];
return (ret);
}
Data *deserialize(void *raw)
{
Data *ret = new Data();
ret->s1 = std::string(reinterpret_cast<char*>(raw), 8);
ret->n = *reinterpret_cast<int*>(reinterpret_cast<char*>(raw) + 8);
ret->s2 = std::string(reinterpret_cast<char*>(raw) + 12, 8);
return (ret);
}
|
f37105e22bf3176de29e5bd5d92f858b6e5e51e1 | 55cc7ad0bcf70d0f497717b9450ab79b4ebb3321 | /tests/transparent.cpp | d6ffb98e8693613075d240e25470b7887ae711f0 | [] | no_license | elcerdo/supershooter | df7c4339046a203e74ccd981285974bb84801491 | e89c0e18cb32fd0ecab98acb8ebd2f0b16128126 | refs/heads/master | 2021-01-15T12:26:37.593374 | 2010-01-28T10:24:01 | 2010-01-28T10:24:01 | 146,482 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,973 | cpp | transparent.cpp | #include "engine.h"
#include "except.h"
#include "utils.h"
#include "sound.h"
#include <iostream>
using std::cout;
using std::endl;
class Spawner : public Listener {
public:
Spawner() {
a = get_test_sprite(0);
b = get_test_sprite(1);
c = get_test_sprite(2);
a->x = 100;
a->y = 100;
a->z = 2;
b->x = 116;
b->y = 116;
b->z = 1;
c->x = 132;
c->y = 132;
c->z = 0;
}
~Spawner() {
delete a;
delete b;
delete c;
}
protected:
StateSprite *get_test_sprite(int ss) {
StateSprite *foo = dynamic_cast<StateSprite*>(SpriteManager::get()->get_sprite("test"));
foo->state = ss;
foo->factorx = 4;
foo->factory = 4;
return foo;
}
virtual bool key_down(SDLKey key) {
switch (key) {
case SDLK_ESCAPE:
return false; break;
}
return true;
}
virtual bool mouse_down(int button,float x,float y) {
return true;
}
virtual bool frame_entered(float t,float dt) {
c->draw(dt);
b->draw(dt);
a->draw(dt);
return true;
}
virtual void unregister_self() {
}
StateSprite *a;
StateSprite *b;
StateSprite *c;
};
int main() {
try {
SdlManager::init();
SpriteManager::init();
SoundManager::init();
SpriteManager::get()->load_directory("data");
SpriteManager::get()->load_directory("../data");
SpriteManager::get()->load_directory("../../data");
SpriteManager::get()->dump(cout);
{
Spawner spawner;
Fps fps;
SdlManager::get()->register_listener(&fps);
SdlManager::get()->register_listener(&spawner);
SdlManager::get()->main_loop();
}
SoundManager::free();
SdlManager::free();
SpriteManager::free();
} catch (Except e) {
e.dump();
}
}
|
8f516654df5758c8a4ff497a906d305fdcda6b62 | 3c1b7f5151d01828a173a37d0822fe946595da0e | /BDAQ/MakeEnumMap.h | 42f54b4e2e05f7ac56835758702b449987a48bac | [] | no_license | stn57121/daqtest | 1832eb73b6672e9c3b235d26146ecfe0bf17d768 | c18c44fd51ff43568216d25a02762dd73a2fc156 | refs/heads/master | 2020-03-18T14:02:10.233135 | 2018-06-08T07:41:38 | 2018-06-08T07:41:38 | 134,825,614 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,592 | h | MakeEnumMap.h | #ifndef INC_MakeEnumMap
#define INC_MakeEnumMap
#include "EnumMap.h"
EnumMap MakeEnumMap_HV();
EnumMap MakeEnumMap_RC();
EnumMap MakeEnumMap_ONOFF();
EnumMap MakeEnumMap(std::string str);
#endif
//enum class State_HV {
// OFF=2,
// STABLE=11,
// STANDBY=12,
// SHOULDER=13,
// PEAK=14,
// TRANSITION=31,
// RAMPINGUP=32,
// RAMPINGDOWN=33,
// TURNINGON=35,
// TURNINGOFF=36,
// ERROR=41,
// TRIP=42,
// OVER_CURRENT=43,
// OVER_VOLTAGE=44,
// INTERLOCK=45,
// MASKED=50
//};
//
//enum class State_RC {
// OFF=1,
// NOTREADY=2,
// READY=3,
// RUNNING=4,
// PAUSED=5,
// LOADING=6,
// STARTING=7,
// STOPPING=8,
// CONFIGURING=9,
// ERROR=10,
// FATAL=11,
// RECOVERING=12,
// ABORTING=13,
// BOOTING=14
//};
//enum class State_HV {
// OFF(2, "OFF"),
// STABLE(11, "STABLE"),
// STANDBY(12, "STANDBY"),
// SHOULDER(13, "SHOULDER"),
// PEAK(14, "PEAK"),
// TRANSITION(31, "TRANSITION"),
// RAMPINGUP(32, "RAMPINGUP"),
// RAMPINGDOWN(33, "RAMPINGDOWN"),
// TURNINGON(35, "TURNINGON"),
// TURNINGOFF(36, "TURNINGOFF"),
// ERROR(41, "ERROR"),
// TRIP(42, "TRIP")
// OVER_CURRENT(43, "OVER_CURRENT"),
// OVER_VOLTAGE(44, "OVER_VOLTAGE"),
// INTERLOCK(45, "INTERLOCK"),
// MASKED(50, "MASKED")
//};
//enum class State_RC {
// OFF(1, "OFF"),
// NOTREADY(2, "NOTREADY"),
// READY(3, "READY"),
// RUNNING(4, "RUNNING"),
// PAUSED(5, "PAUSED"),
// LOADING(6, "LOADING"),
// STARTING(7, "STARTING"),
// STOPPING(8, "STOPPING"),
// CONFIGURING(9, "CONFIGURE"),
// ERROR(10, "ERROR"),
// FATAL(11, "FATAL"),
// RECOVERING(12, "RECOVERING"),
// ABORTING(13, "ABORTING"),
// BOOTING(14, "BOOTING")
//}; |
f98597abb8b1e73e75de48949e1fc5b2bcf65ec3 | 4adaa8934e0b39080142103094657155480d6120 | /one_to_infinite.cpp | 8d26fd452400ae504775883599f467b89365bbaf | [] | no_license | norichin/AtCoder_technique | 9043846015db0b291c3babfcd9e00b391f962c68 | edd902304f13492500386a5194217ea5bde87ebd | refs/heads/master | 2022-11-23T22:14:30.742454 | 2020-08-02T14:02:21 | 2020-08-02T14:02:21 | 284,471,873 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 198 | cpp | one_to_infinite.cpp | #include <iostream>
#include <cmath>
int func(int n){
if (n==0) return 0;
return func(n-1)+pow(10,n-1);
}
int main(){
int n;
std::cin >> n;
std::cout << func(n) << std::endl;
} |
1c922cff7ae69dac5bdfe2e858efb8dddbdcb1ab | b8e271594e35a84d043694fae3dd715d06e1b183 | /lib/program_tracking_cc_impl.cc | 026bd1b49ed99510033f8b1009264d3cdbe966c3 | [] | no_license | ArtisticZhao/gr-dslwp | 4a00aaec549544853215e4aff5ae7bf43c675f8f | 76327eae11a0e46763057939fd22f7005f9aefd9 | refs/heads/master | 2023-03-15T19:12:26.798117 | 2020-12-16T14:41:43 | 2020-12-16T14:41:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,747 | cc | program_tracking_cc_impl.cc | /* -*- c++ -*- */
/*
* Copyright 2018 <+YOU OR YOUR COMPANY+>.
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gnuradio/io_signature.h>
#include "program_tracking_cc_impl.h"
#include <math.h>
namespace gr {
namespace dslwp {
program_tracking_cc::sptr
program_tracking_cc::make(uint8_t enable, uint32_t timestamp, const std::string& path, float lon, float lat, float alt, float fc, uint32_t samp_rate, bool txrx, bool verbose)
{
return gnuradio::get_initial_sptr
(new program_tracking_cc_impl(enable, timestamp, path, lon, lat, alt, fc, samp_rate, txrx, verbose));
}
/*
* The private constructor
*/
program_tracking_cc_impl::program_tracking_cc_impl(uint8_t enable, uint32_t timestamp, const std::string& path, float lon, float lat, float alt, float fc, uint32_t samp_rate, bool txrx, bool verbose)
: gr::sync_block("program_tracking_cc",
gr::io_signature::make(1, 1, sizeof(gr_complex)),
gr::io_signature::make(1, 1, sizeof(gr_complex))),
d_enable(enable), d_fc(fc), d_samp_rate(samp_rate), d_txrx(txrx), d_verbose(verbose)
{
if(d_enable)
{
d_fp = fopen((const char *)(path.data()), "r");
fprintf(stdout, "\n**** Program tracking\n");
/*
double azm, elv, range;
program_tracking_cc_impl::ecef2aer(-207.8135, 286.0307, 353.5534, 45.0/180*M_PI, 126.0/180*M_PI, &azm, &elv, &range);
fprintf(stdout, "%f, %f, %f\n", azm, elv, range);
*/
double rgs;
program_tracking_cc_impl::lla2ecef(lat/180.0*M_PI, lon/180.0*M_PI, alt/1000.0, &d_rgs_x, &d_rgs_y, &d_rgs_z);
program_tracking_cc_impl::ecef2llr(d_rgs_x, d_rgs_y, d_rgs_z, &d_lat, &d_lon, &rgs);
fprintf(stdout, "Set home location in ECEF: %f, %f, %f\n", d_rgs_x, d_rgs_y, d_rgs_z);
if(fscanf(d_fp, "%010ld %015lf %015lf %015lf %010lf %010lf %010lf\r\n", &d_timestamp0, &d_rsat0_x, &d_rsat0_y, &d_rsat0_z, &d_vsat0_x, &d_vsat0_y, &d_vsat0_z) != 7)
{
fclose(d_fp);
fprintf(stdout, "\n**** Error read tracking file!!!\n");
exit(0);
}
if(d_enable==1)
d_time_curr = time(NULL);
else if(d_enable==2)
d_time_curr = timestamp;
if(d_time_curr < d_timestamp0)
{
struct tm *tblock;
tblock = gmtime(&d_time_curr);
fprintf(stdout, "Current time: %ld, %02d/%02d/%02d %02d:%02d:%02d\n", d_time_curr, tblock->tm_year+1900, tblock->tm_mon+1, tblock->tm_mday, tblock->tm_hour, tblock->tm_min, tblock->tm_sec);
tblock = gmtime((time_t *)&d_timestamp0);
fprintf(stdout, "Tracking start at: %ld, %02d/%02d/%02d %02d:%02d:%02d\n", d_timestamp0, tblock->tm_year+1900, tblock->tm_mon+1, tblock->tm_mday, tblock->tm_hour, tblock->tm_min, tblock->tm_sec);
d_tracking = 0;
}
else
{
while(d_time_curr > d_timestamp0)
{
if(fscanf(d_fp, "%010ld %015lf %015lf %015lf %010lf %010lf %010lf\r\n", &d_timestamp0, &d_rsat0_x, &d_rsat0_y, &d_rsat0_z, &d_vsat0_x, &d_vsat0_y, &d_vsat0_z) != 7)
{
fclose(d_fp);
fprintf(stdout, "\n**** Error read tracking file or EOF!!!\n");
exit(0);
}
}
fprintf(stdout, "\n**** Tracking start!\n");
d_tracking = 1;
double vec_x, vec_y, vec_z, vec_unit_x, vec_unit_y, vec_unit_z;
vec_x = d_rsat0_x - d_rgs_x;
vec_y = d_rsat0_y - d_rgs_y;
vec_z = d_rsat0_z - d_rgs_z;
program_tracking_cc_impl::ecef2azel(vec_x, vec_y, vec_z, d_lat, d_lon, &d_az0, &d_el0);
d_range0 = pow(vec_x*vec_x+vec_y*vec_y+vec_z*vec_z, 0.5);
vec_unit_x = vec_x / d_range0;
vec_unit_y = vec_y / d_range0;
vec_unit_z = vec_z / d_range0;
d_rr0 = d_vsat0_x * vec_unit_x + d_vsat0_y * vec_unit_y + d_vsat0_z * vec_unit_z;
if(fscanf(d_fp, "%010ld %015lf %015lf %015lf %010lf %010lf %010lf\r\n", &d_timestamp1, &d_rsat1_x, &d_rsat1_y, &d_rsat1_z, &d_vsat1_x, &d_vsat1_y, &d_vsat1_z) != 7)
{
fclose(d_fp);
fprintf(stdout, "\n**** Error read tracking file or EOF!!!\n");
exit(0);
}
vec_x = d_rsat1_x - d_rgs_x;
vec_y = d_rsat1_y - d_rgs_y;
vec_z = d_rsat1_z - d_rgs_z;
program_tracking_cc_impl::ecef2azel(vec_x, vec_y, vec_z, d_lat, d_lon, &d_az1, &d_el1);
d_range1 = pow(vec_x*vec_x+vec_y*vec_y+vec_z*vec_z, 0.5);
vec_unit_x = vec_x / d_range1;
vec_unit_y = vec_y / d_range1;
vec_unit_z = vec_z / d_range1;
d_rr1 = d_vsat1_x * vec_unit_x + d_vsat1_y * vec_unit_y + d_vsat1_z * vec_unit_z;
d_rrr = d_rr1 - d_rr0;
struct tm *tblock;
tblock = gmtime((time_t *)&d_timestamp0);
d_doppler = d_rr0/2.99792458e5*d_fc;
d_doppler_rate = d_rrr/2.99792458e5*d_fc;
if(d_txrx)
{
d_doppler = -d_doppler;
d_doppler_rate = -d_doppler_rate;
}
if(d_verbose)
{
fprintf(stdout, "%02d/%02d/%02d %02d:%02d:%02d, az = %.2f, el = %.2f, range = %f, rr = %f, rrr = %f, doppler = %.2f, doppler_rate = %.2f\n", tblock->tm_year+1900, tblock->tm_mon+1, tblock->tm_mday, tblock->tm_hour, tblock->tm_min, tblock->tm_sec, d_az0/M_PI*180.0, d_el0/M_PI*180.0, d_range0, d_rr0, d_rrr, -d_doppler, -d_doppler_rate);
}
}
}
}
/*
* Our virtual destructor.
*/
program_tracking_cc_impl::~program_tracking_cc_impl()
{
fclose(d_fp);
}
void program_tracking_cc_impl::lla2ecef(double lat, double lon, double alt, double *rx, double *ry, double *rz)
{
double a = 6378.137;
double e2 = 0.00669437999013;
double v = a * pow(1-e2*sin(lat)*sin(lat), -0.5);
*rx = (v+alt)*cos(lat)*cos(lon);
*ry = (v+alt)*cos(lat)*sin(lon);
*rz = ((1-e2)*v+alt)*sin(lat);
}
void program_tracking_cc_impl::ecef2llr(double rx, double ry, double rz, double *lat, double *lon, double *r)
{
*lon = acos(rx / sqrt(rx*rx+ry*ry));
if(ry<0)
{
*lon = -*lon;
}
*lat = atan(rz / sqrt(rx*rx+ry*ry));
*r = sqrt(rx*rx + ry*ry + rz*rz);
}
void program_tracking_cc_impl::ecef2azel(double rx, double ry, double rz, double lat, double lon, double *az, double *el)
{
float r1x = cos(lon)*rx + sin(lon)*ry;
float r1y = -sin(lon)*rx + cos(lon)*ry;
float r1z = rz;
float r2x = cos(-lat)*r1x - sin(-lat)*r1z;
float r2y = r1y;
float r2z = sin(-lat)*r1x + cos(-lat)*r1z;
*el = atan(r2x / sqrt(r2y*r2y + r2z*r2z));
*az = acos(r2z / sqrt(r2y*r2y + r2z*r2z));
if(r2y < 0)
{
*az = 2*M_PI - *az;
}
}
int
program_tracking_cc_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const gr_complex *in = (const gr_complex *) input_items[0];
gr_complex *out = (gr_complex *) output_items[0];
int i;
static float k_real = 1, k_imag = 0;
static double current_phase = 0;
static uint32_t sample_in_second = 0;
for(i=0; i<noutput_items; i++)
{
if(d_enable)
{
k_real = cos(current_phase);
k_imag = sin(current_phase);
if(sample_in_second >= d_samp_rate)
{
sample_in_second = 0;
d_time_curr++;
if(d_tracking)
{
d_timestamp0 = d_timestamp1;
d_rsat0_x = d_rsat1_x;
d_rsat0_y = d_rsat1_y;
d_rsat0_z = d_rsat1_z;
d_vsat0_x = d_vsat1_x;
d_vsat0_y = d_vsat1_y;
d_vsat0_z = d_vsat1_z;
d_range0 = d_range1;
d_rr0 = d_rr1;
d_el0 = d_el1;
d_az0 = d_az1;
if(fscanf(d_fp, "%010ld %015lf %015lf %015lf %010lf %010lf %010lf\r\n", &d_timestamp1, &d_rsat1_x, &d_rsat1_y, &d_rsat1_z, &d_vsat1_x, &d_vsat1_y, &d_vsat1_z) != 7)
{
fclose(d_fp);
fprintf(stdout, "\n**** Error read tracking file or EOF!!!\n");
exit(0);
}
double vec_x, vec_y, vec_z, vec_unit_x, vec_unit_y, vec_unit_z;
vec_x = d_rsat1_x - d_rgs_x;
vec_y = d_rsat1_y - d_rgs_y;
vec_z = d_rsat1_z - d_rgs_z;
program_tracking_cc_impl::ecef2azel(vec_x, vec_y, vec_z, d_lat, d_lon, &d_az1, &d_el1);
d_range1 = pow(vec_x*vec_x+vec_y*vec_y+vec_z*vec_z, 0.5);
vec_unit_x = vec_x / d_range1;
vec_unit_y = vec_y / d_range1;
vec_unit_z = vec_z / d_range1;
d_rr1 = d_vsat1_x * vec_unit_x + d_vsat1_y * vec_unit_y + d_vsat1_z * vec_unit_z;
d_rrr = d_rr1 - d_rr0;
d_doppler = d_rr0/2.99792458e5*d_fc;
d_doppler_rate = d_rrr/2.99792458e5*d_fc;
if(d_txrx)
{
d_doppler = -d_doppler;
d_doppler_rate = -d_doppler_rate;
}
struct tm *tblock;
tblock = gmtime((time_t *)&d_timestamp0);
if(d_verbose)
{
fprintf(stdout, "%02d/%02d/%02d %02d:%02d:%02d, az = %.2f, el = %.2f, range = %f, rr = %f, rrr = %f, doppler = %.2f, doppler_rate = %.2f\n", tblock->tm_year+1900, tblock->tm_mon+1, tblock->tm_mday, tblock->tm_hour, tblock->tm_min, tblock->tm_sec, d_az0/M_PI*180.0, d_el0/M_PI*180.0, d_range0, d_rr0, d_rrr, -d_doppler, -d_doppler_rate);
}
}
else
{
{
if(d_time_curr == d_timestamp0)
{
fprintf(stdout, "\n**** Tracking start!\n");
d_tracking = 1;
if(fscanf(d_fp, "%010ld %015lf %015lf %015lf %010lf %010lf %010lf\r\n", &d_timestamp0, &d_rsat0_x, &d_rsat0_y, &d_rsat0_z, &d_vsat0_x, &d_vsat0_y, &d_vsat0_z) != 7)
{
fclose(d_fp);
fprintf(stdout, "\n**** Error read tracking file or EOF!!!\n");
exit(0);
}
double vec_x, vec_y, vec_z, vec_unit_x, vec_unit_y, vec_unit_z;
vec_x = d_rsat0_x - d_rgs_x;
vec_y = d_rsat0_y - d_rgs_y;
vec_z = d_rsat0_z - d_rgs_z;
program_tracking_cc_impl::ecef2azel(vec_x, vec_y, vec_z, d_lat, d_lon, &d_az0, &d_el0);
d_range0 = pow(vec_x*vec_x+vec_y*vec_y+vec_z*vec_z, 0.5);
vec_unit_x = vec_x / d_range0;
vec_unit_y = vec_y / d_range0;
vec_unit_z = vec_z / d_range0;
d_rr0 = d_vsat0_x * vec_unit_x + d_vsat0_y * vec_unit_y + d_vsat0_z * vec_unit_z;
if(fscanf(d_fp, "%010ld %015lf %015lf %015lf %010lf %010lf %010lf\r\n", &d_timestamp1, &d_rsat1_x, &d_rsat1_y, &d_rsat1_z, &d_vsat1_x, &d_vsat1_y, &d_vsat1_z) != 7)
{
fclose(d_fp);
fprintf(stdout, "\n**** Error read tracking file or EOF!!!\n");
exit(0);
}
vec_x = d_rsat1_x - d_rgs_x;
vec_y = d_rsat1_y - d_rgs_y;
vec_z = d_rsat1_z - d_rgs_z;
program_tracking_cc_impl::ecef2azel(vec_x, vec_y, vec_z, d_lat, d_lon, &d_az1, &d_el1);
d_range1 = pow(vec_x*vec_x+vec_y*vec_y+vec_z*vec_z, 0.5);
vec_unit_x = vec_x / d_range1;
vec_unit_y = vec_y / d_range1;
vec_unit_z = vec_z / d_range1;
d_rr1 = d_vsat1_x * vec_unit_x + d_vsat1_y * vec_unit_y + d_vsat1_z * vec_unit_z;
d_rrr = d_rr1 - d_rr0;
struct tm *tblock;
tblock = gmtime((time_t *)&d_timestamp0);
d_doppler = d_rr0/2.99792458e5*d_fc;
d_doppler_rate = d_rrr/2.99792458e5*d_fc;
if(d_txrx)
{
d_doppler = -d_doppler;
d_doppler_rate = -d_doppler_rate;
}
if(d_verbose)
{
fprintf(stdout, "%02d/%02d/%02d %02d:%02d:%02d, az = %.2f, el = %.2f, range = %f, rr = %f, rrr = %f, doppler = %.2f, doppler_rate = %.2f\n", tblock->tm_year+1900, tblock->tm_mon+1, tblock->tm_mday, tblock->tm_hour, tblock->tm_min, tblock->tm_sec, d_az0/M_PI*180.0, d_el0/M_PI*180.0, d_range0, d_rr0, d_rrr, -d_doppler, -d_doppler_rate);
}
}
}
}
}
current_phase += d_doppler/d_samp_rate*2*M_PI;
d_doppler += d_doppler_rate/d_samp_rate;
sample_in_second++;
}
out[i] = k_real * in[i].real() - k_imag * in[i].imag()
+ 1j * (k_real * in[i].imag() + k_imag * in[i].real());
}
// Tell runtime system how many output items we produced.
return noutput_items;
}
} /* namespace dslwp */
} /* namespace gr */
|
65e74cfe67cd1afb1cea2b4e52a4a3a88dd13207 | c25c3177e7ff002605179d15d5dec380268e304b | /src/apps/dr-less/processor.h | 665386d250c8ea02c53d7b0ac1e1f441ff5de501 | [
"MIT"
] | permissive | schwa-lab/libschwa | 659851eca7849cbde08545804c8afb4bb62c782b | 4812d10ad3919629beedb08e406fcdaf4290e3ba | refs/heads/master | 2020-05-19T18:55:23.312854 | 2014-09-05T01:00:14 | 2014-09-05T01:00:14 | 17,270,174 | 7 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 675 | h | processor.h | /* -*- Mode: C++; indent-tabs-mode: nil -*- */
#ifndef SCHWA_DRUI_PROCESSOR_H_
#define SCHWA_DRUI_PROCESSOR_H_
#include <iosfwd>
#include <vector>
#include <schwa/_base.h>
namespace schwa {
namespace dr {
class Doc;
}
namespace dr_less {
class Processor {
private:
class Impl;
Impl *_impl;
public:
Processor(std::ostream &out);
~Processor(void);
void process_doc(const dr::Doc &doc, uint32_t doc_num);
inline void operator ()(const dr::Doc &doc, uint32_t doc_num) { process_doc(doc, doc_num); }
private:
SCHWA_DISALLOW_COPY_AND_ASSIGN(Processor);
};
}
}
#endif // SCHWA_DRUI_PROCESSOR_H_
|
d88089383a55b25674ad6c677790c13cfa4b1601 | 03a1f75edab8d3f1255aa0a3ee54a41619286af6 | /patrolMAV/src/XY_LIB/test_video.cpp | 6c497ce05c56249ede6d8ea27c89cfd75dd7f3e7 | [] | no_license | LeeYoungLeon/Xunyi_mavlink | e8b748aceb89c282379e9031c67f68be640bfb90 | f8708cce9c44a4688d5d614efca96160d2ffff07 | refs/heads/master | 2016-09-12T22:18:28.678549 | 2016-04-24T01:41:55 | 2016-04-24T01:41:55 | 56,948,822 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,849 | cpp | test_video.cpp | #include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/video/video.hpp"
#include "getTargetLoc.hpp"
#include <stdio.h>
#include <string>
#include <iostream>
using namespace std;
using namespace cv;
int main()
{
cv::VideoCapture cap("20160311150924.avi");
//cap.set(CV_CAP_PROP_FRAME_WIDTH, 1280);
//cap.set(CV_CAP_PROP_FRAME_HEIGHT, 720);
//waitKey(2000);
cv::VideoWriter dataWriter("data.avi", CV_FOURCC('M','J','P','G'), 5, Size(1280, 720), true);
cv::VideoWriter resultWriter("result.avi", CV_FOURCC('M','J','P','G'), 5, Size(640, 360), true);
xyVision::GetTarget sample("config_1_10.ini");
//sample.setTimeModel(xyVision::NIGHT);
double rate = cap.get(CV_CAP_PROP_FPS);
cout << "frame rate " << rate;
int rate_int = (int)rate;
int n_frames = (int)cap.get(CV_CAP_PROP_FRAME_COUNT);
namedWindow("result");
cv::Mat img;
cv::Mat rectified;
int k = 200;
while(1)
{
//if (k > 10000)
// break;
////if (k == 21)
////{
//// sample.clearStates();
////}
//char ch[10];
//sprintf(ch, "%.5d", k);
//string file_name = "E:\\lbs\\xunyi\\data\\image_2_18\\2016-2-18 (1)\\image-1\\" + string(ch) + ".jpg";
//img = imread(file_name);
k = k + 1;
cap >> img;
dataWriter << img;
if (img.empty()) break;
if(waitKey(20) >= 0) break;
sample << img;
rectified = sample.rectified;
if (sample.isDetected)
{
// draw rotated rectangle
Point2f vertices[4];
sample.box.points(vertices);
if (sample.targetInfo.targetVersion == 1 || sample.targetInfo.targetVersion == 2)
{
line(rectified, Point((int)vertices[0].x, (int)vertices[0].y), Point((int)vertices[1].x, (int)vertices[1].y), Scalar( 255, 0, 0 ), 3);
line(rectified, Point((int)vertices[1].x, (int)vertices[1].y), Point((int)vertices[2].x, (int)vertices[2].y), Scalar( 255, 0, 0 ), 3);
line(rectified, Point((int)vertices[2].x, (int)vertices[2].y), Point((int)vertices[3].x, (int)vertices[3].y), Scalar( 255, 0, 0 ), 3);
line(rectified, Point((int)vertices[3].x, (int)vertices[3].y), Point((int)vertices[0].x, (int)vertices[0].y), Scalar( 255, 0, 0 ), 3);
}
if (sample.targetInfo.targetVersion == 3)
{
Mat center = Mat(sample.getCurrentLoc());
if (center.rows != 3)
{
center = center.t();
}
Mat centerPixel = Mat(sample.cameraInfo.newCameraMatrix) * (center / center.at<float>(2));
circle(rectified, Point((int)centerPixel.at<float>(0), (int)centerPixel.at<float>(1)), 15, Scalar(255, 0, 0), 3);
}
// show location
Point3f location = sample.getCurrentLoc();
char ch[30];
sprintf(ch, "%.2f", location.x);
putText(rectified, "X = " + string(ch), Point(200, 30), FONT_HERSHEY_SIMPLEX, 1, Scalar(255, 255, 255), 2);
sprintf(ch, "%.2f", location.y);
putText(rectified, "Y = " + string(ch), Point(200, 100), FONT_HERSHEY_SIMPLEX, 1, Scalar(255, 255, 255), 2);
sprintf(ch, "%.2f", location.z);
putText(rectified, "Z = " + string(ch), Point(200, 170), FONT_HERSHEY_SIMPLEX, 1, Scalar(255, 255, 255), 2);
sprintf(ch, "%d", sample.frameCounter);
putText(rectified, "FrameCounter = " + string(ch), Point(200, 250), FONT_HERSHEY_SIMPLEX, 1, Scalar(255, 255, 255), 2);
resultWriter << rectified.clone();
imshow("result", rectified);
}
else
{
putText(rectified, "do not detect! ", Point(400, 30), FONT_HERSHEY_SIMPLEX, 1, Scalar(255, 255, 255), 1);
char ch[30];
sprintf(ch, "%d", sample.frameCounter);
putText(rectified, "FrameCounter = " + string(ch), Point(200, 250), FONT_HERSHEY_SIMPLEX, 1, Scalar(255, 255, 255), 2);
resultWriter << rectified.clone();
imshow("result", rectified);
}
}
} |
aff8d6c546f5a29e30c316c9399b64591d87b86f | 1a77b5eac40055032b72e27e720ac5d43451bbd6 | /VisualC++/Chap3/Dr20_2/Dr20_2/Dr20_2.cpp | 74427b2e8ce4b786ae7b9c1a13d7e5935615a57d | [] | no_license | motonobu-t/algorithm | 8c8d360ebb982a0262069bb968022fe79f2c84c2 | ca7b29d53860eb06a357eb268f44f47ec9cb63f7 | refs/heads/master | 2021-01-22T21:38:34.195001 | 2017-05-15T12:00:51 | 2017-05-15T12:01:00 | 85,451,237 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 920 | cpp | Dr20_2.cpp | // Dr20_2.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//
#include "stdafx.h"
/*
* -------------------------------------
* 逐次探索法(break版) *
* -------------------------------------
*/
#include <stdio.h>
#include <string.h>
#define N 10 /* データ数 */
void main(void)
{
struct girl {
char name[20];
int age;
} a[]={"Ann",18,"Rolla",19,"Nancy",16,"Eluza",17,"Juliet",18,
"Machilda",20,"Emy",15,"Candy",16,"Ema",17,"Mari",18};
char key[20];
int i,flag=0;
printf("検索するdata ? ");scanf_s("%s",key,20);
for (i=0;i<N;i++){
if (strcmp(key,a[i].name)==0){
printf("%s %d\n",a[i].name,a[i].age);
flag=1;
break;
}
}
if (flag!=1)
printf("見つかりませんでした\n");
getchar();getchar();
}
|
700269476b15e972d88bde43d79150584a16c04e | bc349f9674f07d28760abe50242dd16729f0cf86 | /Bodystat/src/ui/subjsortfilterproxymodel.cpp | 86071ca734d6843826b6a8278479438f29771318 | [] | no_license | hym-dn/Bodystat | ddd0b3adde06a95e62ed80709ed8904dd18262db | 1acd632f7fdb8f64b8be22b3c1d9f31f6e58d253 | refs/heads/master | 2020-03-21T10:40:40.600953 | 2018-11-25T14:24:27 | 2018-11-25T14:24:27 | 138,464,648 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,087 | cpp | subjsortfilterproxymodel.cpp | #include"subjsortfilterproxymodel.h"
#include"../data/subjinfo.h"
#include"../data/subject.h"
#include"../data/subjpool.h"
SubjSortFilterProxyModel::SubjSortFilterProxyModel(
QObject *parent/*=Q_NULLPTR*/)
:QSortFilterProxyModel(parent)
,_matchString(){
}
SubjSortFilterProxyModel::~SubjSortFilterProxyModel(){
}
void SubjSortFilterProxyModel::setMatchString(
const QString &string){
beginResetModel();
_matchString=string;
endResetModel();
}
const QString &SubjSortFilterProxyModel::
getMatchString() const{
return(_matchString);
}
bool SubjSortFilterProxyModel::filterAcceptsRow(
int source_row,const QModelIndex &source_parent) const{
if(_matchString.isEmpty()){
return(true);
}else{
const QModelIndex srcIndex=sourceModel()->
index(source_row,0,source_parent);
SubjInfo subjInfo;
if(SubjPool::instance()->getSubjInfo(
srcIndex.row(),subjInfo)<0){
return(false);
}else{
return(subjInfo.getBrief().contains(_matchString));
}
}
}
|
531d62fbafe365fa4904bb8ea3001b34394175e8 | 87c8332fb6289b787090dc50415681e509184186 | /amd_tressfx_sample/prebuilt/include/ObjectManager/include/SuAutoDrawableObject.h | fc89d2edf20a85439f9c6e70c04666f4fc91df83 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | c6burns/TressFX | 380be5ee4360edb7ea8d87dec5fb8b9efd5082b3 | ea9086cf7368ef4027b8dc5b44e1d5fb2ca160cf | refs/heads/master | 2020-04-12T20:03:03.697272 | 2018-12-21T14:43:49 | 2018-12-21T14:43:49 | 162,717,647 | 0 | 0 | MIT | 2018-12-21T14:40:48 | 2018-12-21T13:31:03 | C++ | UTF-8 | C++ | false | false | 2,720 | h | SuAutoDrawableObject.h | //
// Copyright (c) 2016 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#ifndef _SUAUTODRAWABLEOBJECT_H
#define _SUAUTODRAWABLEOBJECT_H
#include "SuTypes.h"
#include "SuRenderManager.h"
/// \brief Interface for objects that can be rendered with a streaming output buffer
// tolua_begin
class SuAutoDrawableObject
{
public:
/// Draws the object using a particular technique of the object's effect using data written to a
/// streaming output buffer. Note that this type of draw call will only work in DirectX10.
///
/// \param ePrimType The primitive type. Note that this should only be POINT_LIST, TRIANGLE_LIST or LINE_LIST.
/// All other choices will generate an error.
/// \param rEffectTechniqueName The name of the technique to use for drawing the object.
///
/// \return true on success, false otherwise or if the user specified an unsupported primitive type
virtual bool DrawAuto( SuRenderManager::PrimType ePrimType, const SuString& rEffectTechniqueName ) = 0;
/// Draws the object using a particular technique of the object's effect using data written to a
/// streaming output buffer. Note that this type of draw call will only work in DirectX10.
///
/// \param rEffectTechniqueName The name of the technique to use for drawing the object.
///
/// \return true on success, false otherwise or if the user specified an unsupported primitive type
virtual bool DrawAuto( const SuString& rEffectTechniqueName ) = 0;
}; // End of SuAutoDrawableObject interface declaration
//tolua_end
#endif // End of _SUAUTODRAWABLEOBJECT_H
|
e37b3655e37157a9048c2caef5a62b866134d690 | 03228736de88197b99ed09a00beb3a42166650f6 | /Practical/untitled folder/Q7.cpp | 2a2d37ecf2a23dc5147c7eb81cc8fdbcf93171c4 | [] | no_license | Vansh983/Computer-Science-Syllabus-Class-XII-CBSE | 8faecd169be21bcba77f03163f0d0ca0298e1746 | a60f1ffd02400937f7e3d424ef672c9ed5c2ed03 | refs/heads/master | 2020-07-06T07:00:17.049575 | 2019-09-14T20:28:31 | 2019-09-14T20:28:31 | 202,932,866 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,495 | cpp | Q7.cpp | #include<iostream>
#include<string.h>
using namespace std;
class employee{
char name[30];
int salary,eno;
public:
void enter()
{
cout<<"ENTER NAME = ";
cin>>name;
cout<<endl;
cout<<"ENTER EMPLOYEE NUMBER = ";
cin>>eno;
cout<<endl;
cout<<"ENTER SALARY = ";
cin>>salary;
cout<<endl;
}
void display()
{
cout<<" NAME = "<<name;
cout<<endl;
cout<<" EMPLOYEE NUMBER = "<<eno;
cout<<endl;
cout<<" SALARY = "<<salary;
cout<<endl;
}
int sal()
{
return salary;
}
char *nam()
{
return name;
}
};
main()
{
employee emp[100], temp;
int i = 0 , j = 0 , num ,s;
char x[100];
cout<<"ENTER NUMBER OF RECORDS = ";
cin>>num;
for(i=0;i<num;i++)
{
emp[i].enter();
cout<<endl;
}
cout<<"PRESS 1 TO DISPLAY RECORDS IN ASCENDING ORDER OF SALARY";
cout<<endl;
cout<<"PRESS 2 TO DISPLAY RECORDS FOR A GIVEN NAME";
cout<<endl;
cout<<"PRESS 0 TO EXIT";
cout<<endl;
cout<<endl;
cin>>s;
while(s!=0)
{
if(s==1)
{
for(j=0;j<num;j++)
{
for(i=0;i<num-1;i++)
{
if(emp[i].sal() > emp[i+1].sal())
{
temp = emp[i];
emp[i] = emp[i+1];
emp[i+1] = temp;
}
}
}
for(i=0;i<num;i++)
{
emp[i].display();
}break;
}
if(s==2)
{
cout<<"ENTER NAME WHOSE RECORDS HAVE TO BE FOUND = ";
cin>>x;
for(i=0;i<num;i++)
{
if(strcmp( x,emp[i].nam() )==0 )
{
break;
}
}
emp[i].display();
}
}
}
|
b71273d6c6f98989aeb08b0a397fb07238a359e9 | 34880511948870687a27160e067d572ffe16c076 | /core-cpp/src/main/c++/javolution/util/NoSuchElementException.hpp | 4232a8da82cf55a119f5d5606c52d043faac331a | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | alicanalbayrak/javolution | 60a7482b7fa309155998a75cdabf2b171a85b48b | 1bed60dee5c9ab358680181544962b2df84c8c14 | refs/heads/master | 2021-01-13T04:20:24.437022 | 2016-12-23T18:24:31 | 2016-12-23T18:24:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,606 | hpp | NoSuchElementException.hpp | /*
* Javolution - Java(TM) Solution for Real-Time and Embedded Systems
* Copyright (C) 2012 - Javolution (http://javolution.org/)
* All rights reserved.
*/
#ifndef _JAVOLUTION_UTIL_NO_SUCH_ELEMENT_EXCEPTION_HPP
#define _JAVOLUTION_UTIL_NO_SUCH_ELEMENT_EXCEPTION_HPP
#include "javolution/lang/RuntimeException.hpp"
namespace javolution {
namespace util {
class NoSuchElementException_API;
class NoSuchElementException : public javolution::lang::RuntimeException {
public:
NoSuchElementException(Type::NullHandle = Type::Null) : javolution::lang::RuntimeException() {} // Null
NoSuchElementException(NoSuchElementException_API* ptr) : javolution::lang::RuntimeException((javolution::lang::RuntimeException_API*)ptr) {}
};
}
}
/**
* Thrown to indicate that there are no more elements in a collection.
*
* @see <a href="http://java.sun.com/javase/6/docs/api/java/util/NoSuchElementException.html">
* Java - NoSuchElementException</a>
* @version 1.0
*/
class javolution::util::NoSuchElementException_API : public javolution::lang::RuntimeException_API {
protected:
NoSuchElementException_API(javolution::lang::String const& message) :
javolution::lang::RuntimeException_API(message) {
};
public:
/**
* Returns the runtime exception having the specified message.
*
* @param message the exception message.
*/
static NoSuchElementException newInstance(javolution::lang::String const& message = Type::Null) {
return new NoSuchElementException_API(message);
}
};
#endif
|
0f6f71116d01a0fb7ee6eb7ad3909c37c8f210d0 | 8424d627b1e9367fe1c2bc6e6796791f8c4b7783 | /190/max.cpp | a1c73896f5c88d9c09193c7acf572a7fb8ba34ed | [] | no_license | lld2006/my-c---practice-project | 72d309f378dea1aaf16ffedf161962684ef25aef | c7e133c79528340f40f1a7192a89956bcc11dd00 | refs/heads/master | 2020-12-25T17:37:28.171658 | 2018-01-21T08:15:49 | 2018-01-21T08:15:49 | 2,707,121 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 415 | cpp | max.cpp | #include "../lib/typedef.h"
#include "../lib/tools.h"
#include <cmath>
#include <cstdio>
double maxmult(int m ){
double x1 = (double) 2/ ( m+1);
double xp = pow(x1, m*(m+1)/2);
for(i64 i = 2; i <= m; ++i)
xp *= power(i, i);
printf("%d %f\n", m, xp);
return xp;
}
int main(){
i64 sum = 0;
for(int i =2; i<= 15; ++i){
sum += maxmult(i);
}
printf("%lld\n", sum);
}
|
d4ed7fd4414d8ecdd181c1086692ea52e1aebbde | 369092e9ee7687d66e1266098bf69245a8a6b639 | /tracer/src/Datadog.Trace.ClrProfiler.Native/debugger_tokens.cpp | a9c04ef8c9e2a17d25fa39b5ff9154e4f84b06aa | [
"MIT",
"BSD-3-Clause",
"Apache-2.0"
] | permissive | pjanotti/signalfx-dotnet-tracing | d3a05ea0a2cd737825d5415ee1d8dbcb7ab877c7 | db3c867780727a1b77987612289522b63c74d430 | refs/heads/master | 2023-07-24T18:57:23.732440 | 2023-06-20T23:26:28 | 2023-06-20T23:26:28 | 253,528,232 | 0 | 0 | NOASSERTION | 2020-04-06T14:50:18 | 2020-04-06T14:50:17 | null | UTF-8 | C++ | false | false | 37,375 | cpp | debugger_tokens.cpp | #include "debugger_tokens.h"
#include "dd_profiler_constants.h"
#include "il_rewriter_wrapper.h"
#include "logger.h"
#include "module_metadata.h"
using namespace shared;
namespace debugger
{
const int signatureBufferSize = 500;
/**
* CALLTARGET CONSTANTS
**/
static const WSTRING managed_profiler_debugger_beginmethod_startmarker_name = WStr("BeginMethod_StartMarker");
static const WSTRING managed_profiler_debugger_beginmethod_endmarker_name = WStr("BeginMethod_EndMarker");
static const WSTRING managed_profiler_debugger_endmethod_startmarker_name = WStr("EndMethod_StartMarker");
static const WSTRING managed_profiler_debugger_endmethod_endmarker_name = WStr("EndMethod_EndMarker");
static const WSTRING managed_profiler_debugger_logexception_name = WStr("LogException");
static const WSTRING managed_profiler_debugger_logarg_name = WStr("LogArg");
static const WSTRING managed_profiler_debugger_loglocal_name = WStr("LogLocal");
static const WSTRING managed_profiler_debugger_method_type = WStr("Datadog.Trace.Debugger.Instrumentation.MethodDebuggerInvoker");
static const WSTRING managed_profiler_debugger_methodstatetype = WStr("Datadog.Trace.Debugger.Instrumentation.MethodDebuggerState");
static const WSTRING managed_profiler_debugger_returntype = WStr("Datadog.Trace.Debugger.Instrumentation.DebuggerReturn");
static const WSTRING managed_profiler_debugger_returntype_generics = WStr("Datadog.Trace.Debugger.Instrumentation.DebuggerReturn`1");
// Line Probe Methods & Types
static const WSTRING managed_profiler_debugger_line_type = WStr("Datadog.Trace.Debugger.Instrumentation.LineDebuggerInvoker");
static const WSTRING managed_profiler_debugger_linestatetype = WStr("Datadog.Trace.Debugger.Instrumentation.LineDebuggerState");
static const WSTRING managed_profiler_debugger_beginline_name = WStr("BeginLine");
static const WSTRING managed_profiler_debugger_endline_name = WStr("EndLine");
/**
* PRIVATE
**/
HRESULT DebuggerTokens::WriteLogArgOrLocal(void* rewriterWrapperPtr, const TypeSignature& argOrLocal,
ILInstr** instruction, bool isArg, bool isMethodProbe)
{
auto hr = EnsureBaseCalltargetTokens();
if (FAILED(hr))
{
return hr;
}
ILRewriterWrapper* rewriterWrapper = (ILRewriterWrapper*) rewriterWrapperPtr;
ModuleMetadata* module_metadata = GetMetadata();
mdMemberRef logArgOrLocalRef;
mdTypeRef stateTypeRef;
mdTypeRef methodOrLineTypeRef;
if (isMethodProbe)
{
logArgOrLocalRef = isArg ? methodLogArgRef : methodLogLocalRef;
stateTypeRef = callTargetStateTypeRef; // MethodDebuggerState
methodOrLineTypeRef = callTargetTypeRef; // MethodDebuggerInvoker
}
else
{
logArgOrLocalRef = isArg ? lineLogArgRef : lineLogLocalRef;
stateTypeRef = lineDebuggerStateTypeRef; // LineDebuggerState
methodOrLineTypeRef = lineInvokerTypeRef; // LineDebuggerInvoker
}
if (logArgOrLocalRef == mdMemberRefNil)
{
auto targetMemberName =
isArg ? managed_profiler_debugger_logarg_name.data() : managed_profiler_debugger_loglocal_name.data();
unsigned callTargetStateBuffer;
auto callTargetStateSize = CorSigCompressToken(stateTypeRef, &callTargetStateBuffer);
unsigned long signatureLength = 10 + callTargetStateSize;
COR_SIGNATURE signature[signatureBufferSize];
unsigned offset = 0;
signature[offset++] = IMAGE_CEE_CS_CALLCONV_GENERIC;
signature[offset++] = 0x01; // one generic argOrLocal (of the argOrLocal)
signature[offset++] = 0x03; // (argumentIndex, argOrLocal, DebuggerState)
signature[offset++] = ELEMENT_TYPE_VOID;
// the argOrLocal
signature[offset++] = ELEMENT_TYPE_BYREF;
signature[offset++] = ELEMENT_TYPE_MVAR;
signature[offset++] = 0x00;
// argumentIndex
signature[offset++] = ELEMENT_TYPE_I4;
// DebuggerState
signature[offset++] = ELEMENT_TYPE_BYREF;
signature[offset++] = ELEMENT_TYPE_VALUETYPE;
memcpy(&signature[offset], &callTargetStateBuffer, callTargetStateSize);
offset += callTargetStateSize;
auto hr = module_metadata->metadata_emit->DefineMemberRef(methodOrLineTypeRef, targetMemberName, signature,
signatureLength, &logArgOrLocalRef);
if (FAILED(hr))
{
Logger::Warn("Wrapper ", isArg ? "methodLogArgRef" : "methodLogLocalRef", " could not be defined.");
return hr;
}
// Set the appropriate field
if (isMethodProbe)
{
if (isArg)
{
methodLogArgRef = logArgOrLocalRef;
}
else
{
methodLogLocalRef = logArgOrLocalRef;
}
}
else
{
if (isArg)
{
lineLogArgRef = logArgOrLocalRef;
}
else
{
lineLogLocalRef = logArgOrLocalRef;
}
}
}
mdMethodSpec logArgMethodSpec = mdMethodSpecNil;
auto signatureLength = 2;
PCCOR_SIGNATURE argumentSignatureBuffer;
ULONG argumentSignatureSize;
const auto [elementType, argTypeFlags] = argOrLocal.GetElementTypeAndFlags();
if (argTypeFlags & TypeFlagByRef)
{
PCCOR_SIGNATURE argSigBuff;
auto signatureSize = argOrLocal.GetSignature(argSigBuff);
if (argSigBuff[0] == ELEMENT_TYPE_BYREF)
{
argumentSignatureBuffer = argSigBuff + 1;
argumentSignatureSize = signatureSize - 1;
signatureLength += signatureSize - 1;
}
else
{
argumentSignatureBuffer = argSigBuff;
argumentSignatureSize = signatureSize;
signatureLength += signatureSize;
}
}
else
{
auto signatureSize = argOrLocal.GetSignature(argumentSignatureBuffer);
argumentSignatureSize = signatureSize;
signatureLength += signatureSize;
}
COR_SIGNATURE signature[signatureBufferSize];
unsigned offset = 0;
signature[offset++] = IMAGE_CEE_CS_CALLCONV_GENERICINST;
signature[offset++] = 0x01;
memcpy(&signature[offset], argumentSignatureBuffer, argumentSignatureSize);
offset += argumentSignatureSize;
hr = module_metadata->metadata_emit->DefineMethodSpec(logArgOrLocalRef, signature, signatureLength,
&logArgMethodSpec);
if (FAILED(hr))
{
Logger::Warn("Error creating log exception method spec.");
return hr;
}
*instruction = rewriterWrapper->CallMember(logArgMethodSpec, false);
return S_OK;
}
HRESULT DebuggerTokens::EnsureBaseCalltargetTokens()
{
auto hr = CallTargetTokens::EnsureBaseCalltargetTokens();
IfFailRet(hr);
ModuleMetadata* module_metadata = GetMetadata();
// *** Ensure lineInvoker type ref
if (lineInvokerTypeRef == mdTypeRefNil)
{
hr = module_metadata->metadata_emit->DefineTypeRefByName(
profilerAssemblyRef, managed_profiler_debugger_line_type.data(), &lineInvokerTypeRef);
if (FAILED(hr))
{
Logger::Warn("Wrapper lineInvokerTypeRef could not be defined.");
return hr;
}
}
// *** Ensure lineDebuggerState type ref
if (lineDebuggerStateTypeRef == mdTypeRefNil)
{
hr = module_metadata->metadata_emit->DefineTypeRefByName(
profilerAssemblyRef, managed_profiler_debugger_linestatetype.data(), &lineDebuggerStateTypeRef);
if (FAILED(hr))
{
Logger::Warn("Wrapper lineDebuggerStateTypeRef could not be defined.");
return hr;
}
}
return S_OK;
}
/**
* PROTECTED
**/
const WSTRING& DebuggerTokens::GetCallTargetType()
{
return managed_profiler_debugger_method_type;
}
const WSTRING& DebuggerTokens::GetCallTargetStateType()
{
return managed_profiler_debugger_methodstatetype;
}
const WSTRING& DebuggerTokens::GetCallTargetReturnType()
{
return managed_profiler_debugger_returntype;
}
const WSTRING& DebuggerTokens::GetCallTargetReturnGenericType()
{
return managed_profiler_debugger_returntype_generics;
}
int DebuggerTokens::GetAdditionalLocalsCount()
{
return 1;
}
void DebuggerTokens::AddAdditionalLocals(COR_SIGNATURE (&signatureBuffer)[500], ULONG& signatureOffset, ULONG& signatureSize)
{
// Gets the calltarget state of line probe type buffer and size
unsigned callTargetStateTypeRefBuffer;
auto callTargetStateTypeRefSize = CorSigCompressToken(lineDebuggerStateTypeRef, &callTargetStateTypeRefBuffer);
// Enlarge the *new* signature size
signatureSize += (1 + callTargetStateTypeRefSize);
// CallTarget state of line probe
signatureBuffer[signatureOffset++] = ELEMENT_TYPE_VALUETYPE;
memcpy(&signatureBuffer[signatureOffset], &callTargetStateTypeRefBuffer, callTargetStateTypeRefSize);
signatureOffset += callTargetStateTypeRefSize;
}
/**
* PUBLIC
**/
DebuggerTokens::DebuggerTokens(ModuleMetadata* module_metadata_ptr) :
CallTargetTokens(module_metadata_ptr, true, true)
{
}
HRESULT DebuggerTokens::WriteBeginMethod_StartMarker(void* rewriterWrapperPtr, const TypeInfo* currentType,
ILInstr** instruction)
{
auto hr = EnsureBaseCalltargetTokens();
if (FAILED(hr))
{
return hr;
}
ILRewriterWrapper* rewriterWrapper = (ILRewriterWrapper*) rewriterWrapperPtr;
ModuleMetadata* module_metadata = GetMetadata();
if (beginMethodStartMarkerRef == mdMemberRefNil)
{
unsigned callTargetStateBuffer;
auto callTargetStateSize = CorSigCompressToken(callTargetStateTypeRef, &callTargetStateBuffer);
unsigned runtimeMethodHandleBuffer;
auto runtimeMethodHandleSize = CorSigCompressToken(runtimeMethodHandleRef, &runtimeMethodHandleBuffer);
unsigned runtimeTypeHandleBuffer;
auto runtimeTypeHandleSize = CorSigCompressToken(runtimeTypeHandleRef, &runtimeTypeHandleBuffer);
unsigned long signatureLength = 10 + callTargetStateSize + runtimeMethodHandleSize + runtimeTypeHandleSize;
COR_SIGNATURE signature[signatureBufferSize];
unsigned offset = 0;
signature[offset++] = IMAGE_CEE_CS_CALLCONV_GENERIC;
signature[offset++] = 0x01; // generic arguments count
signature[offset++] = 0x05; // arguments count
signature[offset++] = ELEMENT_TYPE_VALUETYPE;
memcpy(&signature[offset], &callTargetStateBuffer, callTargetStateSize);
offset += callTargetStateSize;
signature[offset++] = ELEMENT_TYPE_STRING;
signature[offset++] = ELEMENT_TYPE_MVAR;
signature[offset++] = 0x00;
// RuntimeMethodHandle
signature[offset++] = ELEMENT_TYPE_VALUETYPE;
memcpy(&signature[offset], &runtimeMethodHandleBuffer, runtimeMethodHandleSize);
offset += runtimeMethodHandleSize;
// RuntimeTypeHandle
signature[offset++] = ELEMENT_TYPE_VALUETYPE;
memcpy(&signature[offset], &runtimeTypeHandleBuffer, runtimeTypeHandleSize);
offset += runtimeTypeHandleSize;
signature[offset++] = ELEMENT_TYPE_I4; // methodMetadataIndex
auto hr = module_metadata->metadata_emit->DefineMemberRef(
callTargetTypeRef, managed_profiler_debugger_beginmethod_startmarker_name.data(), signature,
signatureLength, &beginMethodStartMarkerRef);
if (FAILED(hr))
{
Logger::Warn("Wrapper beginMethod could not be defined.");
return hr;
}
}
mdMethodSpec beginMethodSpec = mdMethodSpecNil;
bool isValueType = currentType->valueType;
mdToken currentTypeRef = GetCurrentTypeRef(currentType, isValueType);
unsigned currentTypeBuffer;
ULONG currentTypeSize = CorSigCompressToken(currentTypeRef, ¤tTypeBuffer);
auto signatureLength = 3 + currentTypeSize;
COR_SIGNATURE signature[signatureBufferSize];
unsigned offset = 0;
signature[offset++] = IMAGE_CEE_CS_CALLCONV_GENERICINST;
signature[offset++] = 0x01;
if (isValueType)
{
signature[offset++] = ELEMENT_TYPE_VALUETYPE;
}
else
{
signature[offset++] = ELEMENT_TYPE_CLASS;
}
memcpy(&signature[offset], ¤tTypeBuffer, currentTypeSize);
offset += currentTypeSize;
hr = module_metadata->metadata_emit->DefineMethodSpec(beginMethodStartMarkerRef, signature, signatureLength,
&beginMethodSpec);
if (FAILED(hr))
{
Logger::Warn("Error creating begin method spec.");
return hr;
}
*instruction = rewriterWrapper->CallMember(beginMethodSpec, false);
return S_OK;
}
// endmethod with void return
HRESULT DebuggerTokens::WriteEndVoidReturnMemberRef(void* rewriterWrapperPtr, const TypeInfo* currentType,
ILInstr** instruction)
{
auto hr = EnsureBaseCalltargetTokens();
if (FAILED(hr))
{
return hr;
}
ILRewriterWrapper* rewriterWrapper = (ILRewriterWrapper*) rewriterWrapperPtr;
ModuleMetadata* module_metadata = GetMetadata();
if (endVoidMemberRef == mdMemberRefNil)
{
unsigned callTargetReturnVoidBuffer;
auto callTargetReturnVoidSize = CorSigCompressToken(callTargetReturnVoidTypeRef, &callTargetReturnVoidBuffer);
unsigned exTypeRefBuffer;
auto exTypeRefSize = CorSigCompressToken(exTypeRef, &exTypeRefBuffer);
unsigned callTargetStateBuffer;
auto callTargetStateSize = CorSigCompressToken(callTargetStateTypeRef, &callTargetStateBuffer);
auto signatureLength = 8 + callTargetReturnVoidSize + exTypeRefSize + callTargetStateSize;
signatureLength++; // ByRef
COR_SIGNATURE signature[signatureBufferSize];
unsigned offset = 0;
signature[offset++] = IMAGE_CEE_CS_CALLCONV_GENERIC;
signature[offset++] = 0x01;
signature[offset++] = 0x03;
signature[offset++] = ELEMENT_TYPE_VALUETYPE;
memcpy(&signature[offset], &callTargetReturnVoidBuffer, callTargetReturnVoidSize);
offset += callTargetReturnVoidSize;
signature[offset++] = ELEMENT_TYPE_MVAR;
signature[offset++] = 0x00;
signature[offset++] = ELEMENT_TYPE_CLASS;
memcpy(&signature[offset], &exTypeRefBuffer, exTypeRefSize);
offset += exTypeRefSize;
signature[offset++] = ELEMENT_TYPE_BYREF;
signature[offset++] = ELEMENT_TYPE_VALUETYPE;
memcpy(&signature[offset], &callTargetStateBuffer, callTargetStateSize);
offset += callTargetStateSize;
auto hr = module_metadata->metadata_emit->DefineMemberRef(
callTargetTypeRef, managed_profiler_debugger_endmethod_startmarker_name.data(), signature, signatureLength,
&endVoidMemberRef);
if (FAILED(hr))
{
Logger::Warn("Wrapper endVoidMemberRef could not be defined.");
return hr;
}
}
mdMethodSpec endVoidMethodSpec = mdMethodSpecNil;
bool isValueType = currentType->valueType;
mdToken currentTypeRef = GetCurrentTypeRef(currentType, isValueType);
unsigned currentTypeBuffer;
ULONG currentTypeSize = CorSigCompressToken(currentTypeRef, ¤tTypeBuffer);
auto signatureLength = 3 + currentTypeSize;
COR_SIGNATURE signature[signatureBufferSize];
unsigned offset = 0;
signature[offset++] = IMAGE_CEE_CS_CALLCONV_GENERICINST;
signature[offset++] = 0x01;
if (isValueType)
{
signature[offset++] = ELEMENT_TYPE_VALUETYPE;
}
else
{
signature[offset++] = ELEMENT_TYPE_CLASS;
}
memcpy(&signature[offset], ¤tTypeBuffer, currentTypeSize);
offset += currentTypeSize;
hr = module_metadata->metadata_emit->DefineMethodSpec(endVoidMemberRef, signature, signatureLength,
&endVoidMethodSpec);
if (FAILED(hr))
{
Logger::Warn("Error creating end void method method spec.");
return hr;
}
*instruction = rewriterWrapper->CallMember(endVoidMethodSpec, false);
return S_OK;
}
// endmethod with return type
HRESULT DebuggerTokens::WriteEndReturnMemberRef(void* rewriterWrapperPtr, const TypeInfo* currentType,
TypeSignature* returnArgument, ILInstr** instruction)
{
auto hr = EnsureBaseCalltargetTokens();
if (FAILED(hr))
{
return hr;
}
ILRewriterWrapper* rewriterWrapper = (ILRewriterWrapper*) rewriterWrapperPtr;
ModuleMetadata* module_metadata = GetMetadata();
GetTargetReturnValueTypeRef(returnArgument);
// *** Define base MethodMemberRef for the type
mdMemberRef endMethodMemberRef = mdMemberRefNil;
unsigned callTargetReturnTypeRefBuffer;
auto callTargetReturnTypeRefSize = CorSigCompressToken(callTargetReturnTypeRef, &callTargetReturnTypeRefBuffer);
unsigned exTypeRefBuffer;
auto exTypeRefSize = CorSigCompressToken(exTypeRef, &exTypeRefBuffer);
unsigned callTargetStateBuffer;
auto callTargetStateSize = CorSigCompressToken(callTargetStateTypeRef, &callTargetStateBuffer);
auto signatureLength = 14 + callTargetReturnTypeRefSize + exTypeRefSize + callTargetStateSize;
signatureLength++; // ByRef
COR_SIGNATURE signature[signatureBufferSize];
unsigned offset = 0;
signature[offset++] = IMAGE_CEE_CS_CALLCONV_GENERIC;
signature[offset++] = 0x02;
signature[offset++] = 0x04;
signature[offset++] = ELEMENT_TYPE_GENERICINST;
signature[offset++] = ELEMENT_TYPE_VALUETYPE;
memcpy(&signature[offset], &callTargetReturnTypeRefBuffer, callTargetReturnTypeRefSize);
offset += callTargetReturnTypeRefSize;
signature[offset++] = 0x01;
signature[offset++] = ELEMENT_TYPE_MVAR;
signature[offset++] = 0x01;
signature[offset++] = ELEMENT_TYPE_MVAR;
signature[offset++] = 0x00;
signature[offset++] = ELEMENT_TYPE_MVAR;
signature[offset++] = 0x01;
signature[offset++] = ELEMENT_TYPE_CLASS;
memcpy(&signature[offset], &exTypeRefBuffer, exTypeRefSize);
offset += exTypeRefSize;
signature[offset++] = ELEMENT_TYPE_BYREF;
signature[offset++] = ELEMENT_TYPE_VALUETYPE;
memcpy(&signature[offset], &callTargetStateBuffer, callTargetStateSize);
offset += callTargetStateSize;
hr = module_metadata->metadata_emit->DefineMemberRef(callTargetTypeRef,
managed_profiler_debugger_endmethod_startmarker_name.data(),
signature, signatureLength, &endMethodMemberRef);
if (FAILED(hr))
{
Logger::Warn("Wrapper endMethodMemberRef could not be defined.");
return hr;
}
// *** Define Method Spec
mdMethodSpec endMethodSpec = mdMethodSpecNil;
bool isValueType = currentType->valueType;
mdToken currentTypeRef = GetCurrentTypeRef(currentType, isValueType);
unsigned currentTypeBuffer;
ULONG currentTypeSize = CorSigCompressToken(currentTypeRef, ¤tTypeBuffer);
PCCOR_SIGNATURE returnSignatureBuffer;
auto returnSignatureLength = returnArgument->GetSignature(returnSignatureBuffer);
signatureLength = 3 + currentTypeSize + returnSignatureLength;
offset = 0;
signature[offset++] = IMAGE_CEE_CS_CALLCONV_GENERICINST;
signature[offset++] = 0x02;
if (isValueType)
{
signature[offset++] = ELEMENT_TYPE_VALUETYPE;
}
else
{
signature[offset++] = ELEMENT_TYPE_CLASS;
}
memcpy(&signature[offset], ¤tTypeBuffer, currentTypeSize);
offset += currentTypeSize;
memcpy(&signature[offset], returnSignatureBuffer, returnSignatureLength);
offset += returnSignatureLength;
hr = module_metadata->metadata_emit->DefineMethodSpec(endMethodMemberRef, signature, signatureLength,
&endMethodSpec);
if (FAILED(hr))
{
Logger::Warn("Error creating end method member spec.");
return hr;
}
*instruction = rewriterWrapper->CallMember(endMethodSpec, false);
return S_OK;
}
// write log exception
HRESULT DebuggerTokens::WriteLogException(void* rewriterWrapperPtr, const TypeInfo* currentType, bool isMethodProbe)
{
auto hr = EnsureBaseCalltargetTokens();
if (FAILED(hr))
{
return hr;
}
ILRewriterWrapper* rewriterWrapper = (ILRewriterWrapper*) rewriterWrapperPtr;
ModuleMetadata* module_metadata = GetMetadata();
mdTypeRef stateTypeRef = isMethodProbe ? callTargetStateTypeRef : lineDebuggerStateTypeRef; // MethodDebuggerState / LineDebuggerState
mdTypeRef methodOrLineTypeRef = isMethodProbe ? callTargetTypeRef : lineInvokerTypeRef; // MethodDebuggerInvoker / LineDebuggerInvoker
mdMemberRef logExceptionRef = isMethodProbe ? methodLogExceptionRef : lineLogExceptionRef; // MethodDebuggerInvoker.LogException / LineDebuggerInvoker.LogException
if (logExceptionRef == mdMemberRefNil)
{
unsigned exTypeRefBuffer;
auto exTypeRefSize = CorSigCompressToken(exTypeRef, &exTypeRefBuffer);
unsigned callTargetStateBuffer;
auto callTargetStateSize = CorSigCompressToken(stateTypeRef, &callTargetStateBuffer);
auto signatureLength = 7 + exTypeRefSize + callTargetStateSize;
COR_SIGNATURE signature[signatureBufferSize];
unsigned offset = 0;
signature[offset++] = IMAGE_CEE_CS_CALLCONV_GENERIC;
signature[offset++] = 0x01; // One generic argument: TTarget
signature[offset++] = 0x02; // (Exception, DebuggerState)
signature[offset++] = ELEMENT_TYPE_VOID;
signature[offset++] = ELEMENT_TYPE_CLASS;
memcpy(&signature[offset], &exTypeRefBuffer, exTypeRefSize);
offset += exTypeRefSize;
// DebuggerState
signature[offset++] = ELEMENT_TYPE_BYREF;
signature[offset++] = ELEMENT_TYPE_VALUETYPE;
memcpy(&signature[offset], &callTargetStateBuffer, callTargetStateSize);
offset += callTargetStateSize;
auto hr = module_metadata->metadata_emit->DefineMemberRef(methodOrLineTypeRef,
managed_profiler_debugger_logexception_name.data(),
signature, signatureLength, &logExceptionRef);
if (FAILED(hr))
{
Logger::Warn("Wrapper methodLogExceptionRef could not be defined.");
return hr;
}
if (isMethodProbe)
{
methodLogExceptionRef = logExceptionRef;
}
else
{
lineLogExceptionRef = logExceptionRef;
}
}
mdMethodSpec logExceptionMethodSpec = mdMethodSpecNil;
bool isValueType = currentType->valueType;
mdToken currentTypeRef = GetCurrentTypeRef(currentType, isValueType);
unsigned currentTypeBuffer;
ULONG currentTypeSize = CorSigCompressToken(currentTypeRef, ¤tTypeBuffer);
auto signatureLength = 3 + currentTypeSize;
COR_SIGNATURE signature[signatureBufferSize];
unsigned offset = 0;
signature[offset++] = IMAGE_CEE_CS_CALLCONV_GENERICINST;
signature[offset++] = 0x01;
if (isValueType)
{
signature[offset++] = ELEMENT_TYPE_VALUETYPE;
}
else
{
signature[offset++] = ELEMENT_TYPE_CLASS;
}
memcpy(&signature[offset], ¤tTypeBuffer, currentTypeSize);
offset += currentTypeSize;
hr = module_metadata->metadata_emit->DefineMethodSpec(logExceptionRef, signature, signatureLength,
&logExceptionMethodSpec);
if (FAILED(hr))
{
Logger::Warn("Error creating log exception method spec.");
return hr;
}
rewriterWrapper->CallMember(logExceptionMethodSpec, false);
return S_OK;
}
HRESULT DebuggerTokens::WriteLogArg(void* rewriterWrapperPtr, const TypeSignature& argument, ILInstr** instruction, bool isMethodProbe)
{
return WriteLogArgOrLocal(rewriterWrapperPtr, argument, instruction, true /* isArg */, isMethodProbe);
}
HRESULT DebuggerTokens::WriteLogLocal(void* rewriterWrapperPtr, const TypeSignature& local, ILInstr** instruction, bool isMethodProbe)
{
return WriteLogArgOrLocal(rewriterWrapperPtr, local, instruction, false /* isArg */, isMethodProbe);
}
HRESULT DebuggerTokens::WriteBeginOrEndMethod_EndMarker(void* rewriterWrapperPtr, bool isBeginMethod,
ILInstr** instruction)
{
auto hr = EnsureBaseCalltargetTokens();
if (FAILED(hr))
{
return hr;
}
ILRewriterWrapper* rewriterWrapper = (ILRewriterWrapper*) rewriterWrapperPtr;
ModuleMetadata* module_metadata = GetMetadata();
mdMemberRef beginOrEndMethodRef = isBeginMethod ? beginMethodEndMarkerRef : endMethodEndMarkerRef;
const auto beginOrEndMethodName = isBeginMethod ? managed_profiler_debugger_beginmethod_endmarker_name.data()
: managed_profiler_debugger_endmethod_endmarker_name.data();
if (beginOrEndMethodRef == mdMemberRefNil)
{
unsigned callTargetStateBuffer;
auto callTargetStateSize = CorSigCompressToken(callTargetStateTypeRef, &callTargetStateBuffer);
unsigned long signatureLength = 4 + callTargetStateSize;
signatureLength += 1; // ByRef
COR_SIGNATURE signature[signatureBufferSize];
unsigned offset = 0;
signature[offset++] = IMAGE_CEE_CS_CALLCONV_DEFAULT;
signature[offset++] = 0x01; // arguments count
signature[offset++] = ELEMENT_TYPE_VOID;
// DebuggerState
signature[offset++] = ELEMENT_TYPE_BYREF;
signature[offset++] = ELEMENT_TYPE_VALUETYPE;
memcpy(&signature[offset], &callTargetStateBuffer, callTargetStateSize);
offset += callTargetStateSize;
auto hr = module_metadata->metadata_emit->DefineMemberRef(callTargetTypeRef, beginOrEndMethodName, signature,
signatureLength, &beginOrEndMethodRef);
if (FAILED(hr))
{
Logger::Warn("Wrapper beginMethod could not be defined.");
return hr;
}
if (isBeginMethod)
{
beginMethodEndMarkerRef = beginOrEndMethodRef;
}
else
{
endMethodEndMarkerRef = beginOrEndMethodRef;
}
}
*instruction = rewriterWrapper->CallMember(beginOrEndMethodRef, false);
return S_OK;
}
HRESULT DebuggerTokens::WriteBeginMethod_EndMarker(void* rewriterWrapperPtr, ILInstr** instruction)
{
return WriteBeginOrEndMethod_EndMarker(rewriterWrapperPtr, true /* isBeginMethod */, instruction);
}
HRESULT DebuggerTokens::WriteEndMethod_EndMarker(void* rewriterWrapperPtr, ILInstr** instruction)
{
return WriteBeginOrEndMethod_EndMarker(rewriterWrapperPtr, false /* isBeginMethod */, instruction);
}
HRESULT DebuggerTokens::WriteBeginLine(void* rewriterWrapperPtr, const TypeInfo* currentType,
ILInstr** instruction)
{
auto hr = EnsureBaseCalltargetTokens();
if (FAILED(hr))
{
return hr;
}
ILRewriterWrapper* rewriterWrapper = (ILRewriterWrapper*) rewriterWrapperPtr;
ModuleMetadata* module_metadata = GetMetadata();
if (beginLineRef == mdMemberRefNil)
{
unsigned callTargetStateBuffer;
auto lineStateSize = CorSigCompressToken(lineDebuggerStateTypeRef, &callTargetStateBuffer);
unsigned runtimeMethodHandleBuffer;
auto runtimeMethodHandleSize = CorSigCompressToken(runtimeMethodHandleRef, &runtimeMethodHandleBuffer);
unsigned runtimeTypeHandleBuffer;
auto runtimeTypeHandleSize = CorSigCompressToken(runtimeTypeHandleRef, &runtimeTypeHandleBuffer);
unsigned long signatureLength = 12 + lineStateSize + runtimeMethodHandleSize + runtimeTypeHandleSize;
COR_SIGNATURE signature[signatureBufferSize];
unsigned offset = 0;
signature[offset++] = IMAGE_CEE_CS_CALLCONV_GENERIC;
signature[offset++] = 0x01; // generic arguments count
signature[offset++] = 0x07; // arguments count
signature[offset++] = ELEMENT_TYPE_VALUETYPE;
memcpy(&signature[offset], &callTargetStateBuffer, lineStateSize);
offset += lineStateSize;
signature[offset++] = ELEMENT_TYPE_STRING;
signature[offset++] = ELEMENT_TYPE_MVAR;
signature[offset++] = 0x00;
// RuntimeMethodHandle
signature[offset++] = ELEMENT_TYPE_VALUETYPE;
memcpy(&signature[offset], &runtimeMethodHandleBuffer, runtimeMethodHandleSize);
offset += runtimeMethodHandleSize;
// RuntimeTypeHandle
signature[offset++] = ELEMENT_TYPE_VALUETYPE;
memcpy(&signature[offset], &runtimeTypeHandleBuffer, runtimeTypeHandleSize);
offset += runtimeTypeHandleSize;
signature[offset++] = ELEMENT_TYPE_I4; // methodMetadataIndex
signature[offset++] = ELEMENT_TYPE_I4; // lineNumber
signature[offset++] = ELEMENT_TYPE_STRING; // probeFilePath
auto hr = module_metadata->metadata_emit->DefineMemberRef(
lineInvokerTypeRef, managed_profiler_debugger_beginline_name.data(), signature, signatureLength, &beginLineRef);
if (FAILED(hr))
{
Logger::Warn("Wrapper beginMethod could not be defined.");
return hr;
}
}
mdMethodSpec beginMethodSpec = mdMethodSpecNil;
bool isValueType = currentType->valueType;
mdToken currentTypeRef = GetCurrentTypeRef(currentType, isValueType);
unsigned currentTypeBuffer;
ULONG currentTypeSize = CorSigCompressToken(currentTypeRef, ¤tTypeBuffer);
auto signatureLength = 3 + currentTypeSize;
COR_SIGNATURE signature[signatureBufferSize];
unsigned offset = 0;
signature[offset++] = IMAGE_CEE_CS_CALLCONV_GENERICINST;
signature[offset++] = 0x01;
if (isValueType)
{
signature[offset++] = ELEMENT_TYPE_VALUETYPE;
}
else
{
signature[offset++] = ELEMENT_TYPE_CLASS;
}
memcpy(&signature[offset], ¤tTypeBuffer, currentTypeSize);
offset += currentTypeSize;
hr = module_metadata->metadata_emit->DefineMethodSpec(beginLineRef, signature, signatureLength,
&beginMethodSpec);
if (FAILED(hr))
{
Logger::Warn("Error creating begin method spec.");
return hr;
}
*instruction = rewriterWrapper->CallMember(beginMethodSpec, false);
return S_OK;
}
HRESULT DebuggerTokens::WriteEndLine(void* rewriterWrapperPtr, ILInstr** instruction)
{
auto hr = EnsureBaseCalltargetTokens();
if (FAILED(hr))
{
return hr;
}
ILRewriterWrapper* rewriterWrapper = (ILRewriterWrapper*) rewriterWrapperPtr;
ModuleMetadata* module_metadata = GetMetadata();
if (endLineRef == mdMemberRefNil)
{
unsigned callTargetStateBuffer;
auto callTargetStateSize = CorSigCompressToken(lineDebuggerStateTypeRef, &callTargetStateBuffer);
unsigned long signatureLength = 4 + callTargetStateSize;
signatureLength += 1; // ByRef
COR_SIGNATURE signature[signatureBufferSize];
unsigned offset = 0;
signature[offset++] = IMAGE_CEE_CS_CALLCONV_DEFAULT;
signature[offset++] = 0x01; // arguments count
signature[offset++] = ELEMENT_TYPE_VOID;
// DebuggerState
signature[offset++] = ELEMENT_TYPE_BYREF;
signature[offset++] = ELEMENT_TYPE_VALUETYPE;
memcpy(&signature[offset], &callTargetStateBuffer, callTargetStateSize);
offset += callTargetStateSize;
auto hr = module_metadata->metadata_emit->DefineMemberRef(
lineInvokerTypeRef, managed_profiler_debugger_endline_name.data(), signature, signatureLength, &endLineRef);
if (FAILED(hr))
{
Logger::Warn("Wrapper beginMethod could not be defined.");
return hr;
}
}
*instruction = rewriterWrapper->CallMember(endLineRef, false);
return S_OK;
}
HRESULT DebuggerTokens::ModifyLocalSigForLineProbe(ILRewriter* reWriter, ULONG* callTargetStateIndex, mdToken* callTargetStateToken)
{
auto hr = EnsureBaseCalltargetTokens();
if (FAILED(hr))
{
return hr;
}
ModuleMetadata* module_metadata = GetMetadata();
PCCOR_SIGNATURE originalSignature = nullptr;
ULONG originalSignatureSize = 0;
mdToken localVarSig = reWriter->GetTkLocalVarSig();
if (localVarSig != mdTokenNil)
{
IfFailRet(
module_metadata->metadata_import->GetSigFromToken(localVarSig, &originalSignature, &originalSignatureSize));
// Check if the localvarsig has been already rewritten (the last local
// should be the LineDebuggerState)
unsigned temp = 0;
const auto len = CorSigCompressToken(lineDebuggerStateTypeRef, &temp);
if (originalSignatureSize - len > 0)
{
if (originalSignature[originalSignatureSize - len - 1] == ELEMENT_TYPE_VALUETYPE)
{
if (memcmp(&originalSignature[originalSignatureSize - len], &temp, len) == 0)
{
Logger::Warn("The signature for this method has been already modified.");
return E_FAIL;
}
}
}
}
ULONG newLocalsCount = 1;
// Gets the calltarget state type buffer and size
unsigned callTargetStateTypeRefBuffer;
auto callTargetStateTypeRefSize = CorSigCompressToken(lineDebuggerStateTypeRef, &callTargetStateTypeRefBuffer);
// New signature size
ULONG newSignatureSize = originalSignatureSize + (1 + callTargetStateTypeRefSize);
ULONG newSignatureOffset = 0;
ULONG oldLocalsBuffer;
ULONG oldLocalsLen = 0;
unsigned newLocalsBuffer;
ULONG newLocalsLen;
// Calculate the new locals count
if (originalSignatureSize == 0)
{
newSignatureSize += 2;
newLocalsLen = CorSigCompressData(newLocalsCount, &newLocalsBuffer);
}
else
{
oldLocalsLen = CorSigUncompressData(originalSignature + 1, &oldLocalsBuffer);
newLocalsCount += oldLocalsBuffer;
newLocalsLen = CorSigCompressData(newLocalsCount, &newLocalsBuffer);
newSignatureSize += newLocalsLen - oldLocalsLen;
}
// New signature declaration
COR_SIGNATURE newSignatureBuffer[signatureBufferSize];
newSignatureBuffer[newSignatureOffset++] = IMAGE_CEE_CS_CALLCONV_LOCAL_SIG;
// Set the locals count
memcpy(&newSignatureBuffer[newSignatureOffset], &newLocalsBuffer, newLocalsLen);
newSignatureOffset += newLocalsLen;
// Copy previous locals to the signature
if (originalSignatureSize > 0)
{
const auto copyLength = originalSignatureSize - 1 - oldLocalsLen;
memcpy(&newSignatureBuffer[newSignatureOffset], originalSignature + 1 + oldLocalsLen, copyLength);
newSignatureOffset += copyLength;
}
// Add new locals
// CallTarget state value
newSignatureBuffer[newSignatureOffset++] = ELEMENT_TYPE_VALUETYPE;
memcpy(&newSignatureBuffer[newSignatureOffset], &callTargetStateTypeRefBuffer, callTargetStateTypeRefSize);
newSignatureOffset += callTargetStateTypeRefSize;
// Get new locals token
mdToken newLocalVarSig;
hr = module_metadata->metadata_emit->GetTokenFromSig(newSignatureBuffer, newSignatureSize, &newLocalVarSig);
if (FAILED(hr))
{
Logger::Warn("Error creating new locals var signature.");
return hr;
}
reWriter->SetTkLocalVarSig(newLocalVarSig);
*callTargetStateToken = lineDebuggerStateTypeRef;
*callTargetStateIndex = newLocalsCount - 1;
return hr;
}
HRESULT DebuggerTokens::GetDebuggerLocals(void* rewriterWrapperPtr, ULONG* callTargetStateIndex, mdToken* callTargetStateToken)
{
ILRewriterWrapper* rewriterWrapper = (ILRewriterWrapper*) rewriterWrapperPtr;
const auto reWriter = rewriterWrapper->GetILRewriter();
PCCOR_SIGNATURE originalSignature = nullptr;
ULONG originalSignatureSize = 0;
const mdToken localVarSig = reWriter->GetTkLocalVarSig();
if (localVarSig == mdTokenNil)
{
// There must be local signature as the modification of the CallTarget already took place.
Logger::Error("localVarSig is mdTokenNil in GetDebuggerLocals.");
return E_FAIL;
}
HRESULT hr;
ModuleMetadata* module_metadata = GetMetadata();
IfFailRet(module_metadata->metadata_import->GetSigFromToken(localVarSig, &originalSignature, &originalSignatureSize));
ULONG localsLen;
auto bytesRead = CorSigUncompressData(originalSignature + 1, &localsLen);
const auto debuggerAdditionalLocalsCount = GetAdditionalLocalsCount();
*callTargetStateToken = lineDebuggerStateTypeRef;
*callTargetStateIndex = localsLen - /* Accounting for MethodDebuggerState */ 1 - debuggerAdditionalLocalsCount;
return S_OK;
}
} // namespace debugger |
28ac7a0d61207e6304f56b137de961dc93f7a049 | 527e657382351716061080c459818e2349ca0b3e | /376.二叉树的路径和/Solution.cpp | 931fbe7616bca75c50b091b6b3c4926dbc7b0f73 | [] | no_license | GondorFu/Lintcode | e5928461684097c97d40a3d5ac296cea55a53666 | fe719147ec49c9bdc24e5839b4b5e04db5244e98 | refs/heads/master | 2020-12-30T11:39:49.621283 | 2017-10-29T06:00:02 | 2017-10-29T06:00:02 | 91,512,897 | 5 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 909 | cpp | Solution.cpp | """
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
# @param {TreeNode} root the root of binary tree
# @param {int} target an integer
# @return {int[][]} all valid paths
def binaryTreePathSum(self, root, target):
# Write your code here
rlt = []
if root == None:
return rlt
rlt += self.binaryTreePathSum(root.left, target-root.val)
rlt += self.binaryTreePathSum(root.right, target-root.val)
if len(rlt) != 0:
for i, v in enumerate(rlt):
if isinstance(v, list):
rlt[i] = [root.val] + v
else:
rlt[i] = [root.val] + [v]
if root.val == target and root.right == None and root.left == None:
rlt += [[root.val]]
return rlt |
387a64b1c7c883b7cf5ed49b3982127dccbf05c0 | a5878ed35802a874e5c879e68e9d5569a5b9f6ed | /Lab_3/task2.cpp | b99840953a25efd626490ab6d33e540127199752 | [] | no_license | R41NB0W-D4SH/OOP_Lab_Work | 88db7c2d1d92535a6d7d43c74b98ce049b39bcf1 | 40c96e80280010be258ec439a6c153969f866795 | refs/heads/master | 2021-01-02T05:14:23.448289 | 2020-04-06T19:25:19 | 2020-04-06T19:25:19 | 239,503,953 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 568 | cpp | task2.cpp | #include <iostream>
using namespace std;
struct point
{
int x;
int y;
};
int main()
{
setlocale(0, "");
point p1, p2, p3;
cout << "Введите координаты для первой точки : ";
cin >> p1.x >> p1.y;
cout << "Введите координаты для второй точки : ";
cin >> p2.x >> p2.y;
p3.x = p1.x + p2.x;
p3.y = p1.y + p2.y;
cout << "Сумма координат первой и второй точек : " << p3.x << ", " << p3.y << endl;
system("pause");
return 0;
}
|
3fc4c7dc8cdcbc1e0cc0640a5b865bd264a7d212 | 4e38faaa2dc1d03375010fd90ad1d24322ed60a7 | /include/RED4ext/Scripting/Natives/Generated/audio/ContextualAudEventMap.hpp | 6be8be1a6c2567dc0ade7db8b8a5ef5c86972fc5 | [
"MIT"
] | permissive | WopsS/RED4ext.SDK | 0a1caef8a4f957417ce8fb2fdbd821d24b3b9255 | 3a41c61f6d6f050545ab62681fb72f1efd276536 | refs/heads/master | 2023-08-31T08:21:07.310498 | 2023-08-18T20:51:18 | 2023-08-18T20:51:18 | 324,193,986 | 68 | 25 | MIT | 2023-08-18T20:51:20 | 2020-12-24T16:17:20 | C++ | UTF-8 | C++ | false | false | 803 | hpp | ContextualAudEventMap.hpp | #pragma once
// clang-format off
// This file is generated from the Game's Reflection data
#include <cstdint>
#include <RED4ext/Common.hpp>
#include <RED4ext/DynArray.hpp>
#include <RED4ext/Scripting/Natives/Generated/audio/AudioMetadata.hpp>
#include <RED4ext/Scripting/Natives/Generated/audio/ContextualAudEventMapItem.hpp>
namespace RED4ext
{
namespace audio
{
struct ContextualAudEventMap : audio::AudioMetadata
{
static constexpr const char* NAME = "audioContextualAudEventMap";
static constexpr const char* ALIAS = NAME;
DynArray<audio::ContextualAudEventMapItem> contextualAudEventMapItems; // 38
};
RED4EXT_ASSERT_SIZE(ContextualAudEventMap, 0x48);
} // namespace audio
using audioContextualAudEventMap = audio::ContextualAudEventMap;
} // namespace RED4ext
// clang-format on
|
d380727be4b8503728912660a9babc3161d927ff | e85db75c9c26dbe70bac6cfea7c29948cdd591b5 | /CreditCard/mainwindow.cpp | 803cb51ee1f93c04dff8ddc6cd546e466c4a3849 | [] | no_license | AchimGrolimund/HF-ICT-GUI | 69840af0977b8d3b0f94eded8d84248afc01c78f | 383293e3c4e3ea0efa51c960feecb711aa71c67b | refs/heads/master | 2021-09-15T12:56:35.793810 | 2018-06-02T07:22:08 | 2018-06-02T07:22:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 161 | cpp | mainwindow.cpp | #include "mainwindow.h"
#include "widget.h"
#include <QStatusBar>
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
MainWindow w;
w.show();
}
|
5d7fefa3f10beb49d55e82116fddb34ab8a8ffe3 | 57b6fa831fe532cf0739135c77946f0061e3fbf5 | /NWNXLib/API/Linux/API/unknown_PFNGLCREATEPROGRAMOBJECTARBPROC.hpp | 3157c8cc3adef16e6fc0368cc5687f17d1134500 | [
"MIT"
] | permissive | presscad/nwnee | dfcb90767258522f2b23afd9437d3dcad74f936d | 0f36b281524e0b7e9796bcf30f924792bf9b8a38 | refs/heads/master | 2020-08-22T05:26:11.221042 | 2018-11-24T16:45:45 | 2018-11-24T16:45:45 | 216,326,718 | 1 | 0 | MIT | 2019-10-20T07:54:45 | 2019-10-20T07:54:45 | null | UTF-8 | C++ | false | false | 101 | hpp | unknown_PFNGLCREATEPROGRAMOBJECTARBPROC.hpp | #pragma once
namespace NWNXLib {
namespace API {
class PFNGLCREATEPROGRAMOBJECTARBPROC { };
}
}
|
85c4c0ed8588187e4df5d8fe454723d4a0d838e4 | def6391fef416c8772c7a902808352260c8ffcec | /src/fiszki/Collection.cpp | 4ae4ddc41cb66403b595ae2896540fb39c0b5e60 | [] | no_license | DominikaHoszowska/Fiszki | f49dbd19736373c770f3c5afe51f433719b626fc | e3a0b756a01a09a9f6afe6daed7daeeed6de94ed | refs/heads/master | 2020-04-04T11:58:54.520434 | 2019-01-16T01:18:02 | 2019-01-16T01:18:02 | 155,910,064 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,679 | cpp | Collection.cpp | //
// Created by Dominika on 19.11.18.
//
#include "Collection.h"
#include <sqlite3/sqlite3.h>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <codecvt>
//Konstruktory:
Collection::Collection(const std::string &name_, unsigned int id_, Game* game_) : name_(name_),
id_(id_),
game_(game_) {
}
//Gettery:
Game *Collection::getGame_() const {
return game_;
}
const std::string &Collection::getName_() const {
return name_;
}
unsigned int Collection::getId_() const {
return id_;
}
//Inne:
void Collection::addNewFC(const std::string & pl, const std::string &eng, unsigned int id) {
std::shared_ptr<Card>c=std::make_shared<Card>(id,pl,eng);
this->cards_.push_back(c);
char *err_msg = nullptr;
std::string sql="INSERT INTO CARDS VALUES(";
sql+=std::to_string(id);
setlocale( LC_ALL, "" );
sql+=",'"+pl+"','"+eng+"'";
std::locale::global(std::locale::classic());
try {
sql += "," + boost::lexical_cast<std::string>(c->getEF_());
}
catch(const boost::bad_lexical_cast &)
{
std::cout<<"Nie udało się wprowadzić fiszki-błędny wskaźnik uczenia";
return;
}
sql+=",'";
sql+=std::to_string(c->getTimeToRepeat_().year())+"-";
sql+=std::to_string(c->getTimeToRepeat_().month())+"-";
sql+=std::to_string(c->getTimeToRepeat_().day())+"',";
sql+=std::to_string(this->getId_())+" ,";
sql+=std::to_string(c->getI_());
sql+=");";
sqlite3_exec(this->getGame_()->getDb_(), sql.c_str(), nullptr, nullptr, &err_msg);
if(err_msg)
{
std::cout<<"Nie udało się wprowadzić fiszki";
}
}
void Collection::loadFromDB() {
cards_.clear();
sqlite3_stmt *stmt;
std::string sql = "SELECT * FROM Cards WHERE Collection_ID=";
sql += std::to_string(this->getId_());
int rc = sqlite3_prepare_v2(this->game_->getDb_(), sql.c_str(), -1, &stmt, nullptr);
if (rc != SQLITE_OK) {
std::cout<<"error: "<<sqlite3_errmsg(getGame_()->getDb_());
return;
}
while ((rc = sqlite3_step(stmt)) == SQLITE_ROW) {
int id = sqlite3_column_int (stmt, 0);
std::string pl= reinterpret_cast<const char* >(sqlite3_column_text(stmt, 1));
std::string eng= reinterpret_cast<const char* >(sqlite3_column_text(stmt, 2));
double ef = sqlite3_column_double(stmt,3);
std::string date= reinterpret_cast<const char* >(sqlite3_column_text(stmt, 4));
boost::gregorian::date d = boost::gregorian::from_simple_string(date);
int i = sqlite3_column_int (stmt, 5);
cards_.push_back(std::make_shared<Card>(id,pl,eng,ef,d,this,i));
}
sqlite3_finalize(stmt);
}
bool Collection::checkCorrectnessC(const std::string &word) {
if(word.empty())
return false;
if(word.size()>20)
return false;
std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
std::wstring wide = converter.from_bytes(word);
std::locale loc( "pl_PL.utf8" );
for(wchar_t letter:wide)
{
if(!((std::isalpha(letter,loc))||(std::isdigit(letter))||(letter==' ')||(letter=='\'')||(letter=='-')))
return false;
}
return true;
}
void Collection::updateCardsToLearn(Session *session) {
loadFromDB();
for(auto i:cards_)
{
if(i->getTimeToRepeat_()<=boost::gregorian::date(boost::gregorian::day_clock::local_day()))
{
session->addCardToLearn(std::make_shared<Card>(*i));
}
}
}
|
22ca80591e25394a713157db59b443e0073c3358 | 659a112f93aa020034b1d3f2c0d5442ee4112799 | /Pojazd.h | 5c12808ffda2b9dd97e18c4e26dabb261198ff32 | [] | no_license | czercia/SymulacjaRuchuMiejskiego | 4aa56b7cd55844a08ae13b986f21536acc402aea | b4d32879f87ef25a33eb8114e5c9e18a9600010f | refs/heads/master | 2021-01-12T04:30:33.229814 | 2016-12-29T20:16:17 | 2016-12-29T20:16:17 | 77,628,571 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 238 | h | Pojazd.h | //
// Created by Marta on 27.12.2016.
//
#ifndef PROJEKTSEMESTRALNY_POJAZD_H
#define PROJEKTSEMESTRALNY_POJAZD_H
class Pojazd {
int pojemnosc;
int ileTerazPasazerow;
bool wTrasie;
};
#endif //PROJEKTSEMESTRALNY_POJAZD_H
|
f4977d498b00a45861575c470af7a6e0c26e878b | 5557a0793ead7d450f66b13c6c25935d324167ee | /Tx.h | 6372331d461bd83fc86a54ada0c4720201dd94ac | [
"MIT"
] | permissive | harisw/programmingbitcoin-in-cpp | b88fcd6560092288ebb4385ec74a6cedfd048a4a | fa2fff41ca491f09fdf6d83f895a97ee27e22e94 | refs/heads/master | 2022-12-27T15:31:45.515244 | 2020-10-06T06:45:04 | 2020-10-06T06:45:04 | 286,419,088 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 705 | h | Tx.h | #include "TxIn.h"
#include "TxOut.h"
#pragma once
#ifndef TX_H
#define TX_H
#include "Helper.h"
class TxIn;
class TxOut;
class PrivateKey;
class Tx
{
public:
cpp_int version;
vector<TxIn> tx_ins;
vector<TxOut> tx_outs;
cpp_int locktime;
bool testnet;
Tx();
Tx(string input_stream, bool testnet = false);
Tx(cpp_int inp_version, vector<TxIn> inp_tx_ins, vector<TxOut> inp_tx_outs, cpp_int inp_locktime, bool inp_testnet);
void print();
string id();
cpp_int hash();
string serialize();
cpp_int fee();
bool verify();
bool verify_input(int input_index);
string sig_hash(int input_index);
bool sign_input(int input_index, PrivateKey priv_key);
};
#include "PrivateKey.h"
#endif // !TX_H |
1ef05c5e7e292fac15ebe7685d1a7510a58f3cae | e0b4c65a0f8ecb3e89791d7403447e3fca10aebb | /bundle/deepracer_msgs/include/deepracer_msgs/GetModelStatesRequest.h | 926d4ac8a5b79a6f517381db2e3d96efd813ca03 | [
"MIT"
] | permissive | dassd05/deepracer-simapp | 6275a98411a8f210005b73589fcc1dc9d74a52e3 | d0a7e609be429628732cc136a8f5276a794e702a | refs/heads/master | 2023-08-12T21:38:35.755034 | 2021-10-10T18:02:28 | 2021-10-10T18:02:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,123 | h | GetModelStatesRequest.h | // Generated by gencpp from file deepracer_msgs/GetModelStatesRequest.msg
// DO NOT EDIT!
#ifndef DEEPRACER_MSGS_MESSAGE_GETMODELSTATESREQUEST_H
#define DEEPRACER_MSGS_MESSAGE_GETMODELSTATESREQUEST_H
#include <string>
#include <vector>
#include <map>
#include <ros/types.h>
#include <ros/serialization.h>
#include <ros/builtin_message_traits.h>
#include <ros/message_operations.h>
namespace deepracer_msgs
{
template <class ContainerAllocator>
struct GetModelStatesRequest_
{
typedef GetModelStatesRequest_<ContainerAllocator> Type;
GetModelStatesRequest_()
: model_names()
, relative_entity_names() {
}
GetModelStatesRequest_(const ContainerAllocator& _alloc)
: model_names(_alloc)
, relative_entity_names(_alloc) {
(void)_alloc;
}
typedef std::vector<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other > , typename ContainerAllocator::template rebind<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other > >::other > _model_names_type;
_model_names_type model_names;
typedef std::vector<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other > , typename ContainerAllocator::template rebind<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other > >::other > _relative_entity_names_type;
_relative_entity_names_type relative_entity_names;
typedef boost::shared_ptr< ::deepracer_msgs::GetModelStatesRequest_<ContainerAllocator> > Ptr;
typedef boost::shared_ptr< ::deepracer_msgs::GetModelStatesRequest_<ContainerAllocator> const> ConstPtr;
}; // struct GetModelStatesRequest_
typedef ::deepracer_msgs::GetModelStatesRequest_<std::allocator<void> > GetModelStatesRequest;
typedef boost::shared_ptr< ::deepracer_msgs::GetModelStatesRequest > GetModelStatesRequestPtr;
typedef boost::shared_ptr< ::deepracer_msgs::GetModelStatesRequest const> GetModelStatesRequestConstPtr;
// constants requiring out of line definition
template<typename ContainerAllocator>
std::ostream& operator<<(std::ostream& s, const ::deepracer_msgs::GetModelStatesRequest_<ContainerAllocator> & v)
{
ros::message_operations::Printer< ::deepracer_msgs::GetModelStatesRequest_<ContainerAllocator> >::stream(s, "", v);
return s;
}
template<typename ContainerAllocator1, typename ContainerAllocator2>
bool operator==(const ::deepracer_msgs::GetModelStatesRequest_<ContainerAllocator1> & lhs, const ::deepracer_msgs::GetModelStatesRequest_<ContainerAllocator2> & rhs)
{
return lhs.model_names == rhs.model_names &&
lhs.relative_entity_names == rhs.relative_entity_names;
}
template<typename ContainerAllocator1, typename ContainerAllocator2>
bool operator!=(const ::deepracer_msgs::GetModelStatesRequest_<ContainerAllocator1> & lhs, const ::deepracer_msgs::GetModelStatesRequest_<ContainerAllocator2> & rhs)
{
return !(lhs == rhs);
}
} // namespace deepracer_msgs
namespace ros
{
namespace message_traits
{
template <class ContainerAllocator>
struct IsFixedSize< ::deepracer_msgs::GetModelStatesRequest_<ContainerAllocator> >
: FalseType
{ };
template <class ContainerAllocator>
struct IsFixedSize< ::deepracer_msgs::GetModelStatesRequest_<ContainerAllocator> const>
: FalseType
{ };
template <class ContainerAllocator>
struct IsMessage< ::deepracer_msgs::GetModelStatesRequest_<ContainerAllocator> >
: TrueType
{ };
template <class ContainerAllocator>
struct IsMessage< ::deepracer_msgs::GetModelStatesRequest_<ContainerAllocator> const>
: TrueType
{ };
template <class ContainerAllocator>
struct HasHeader< ::deepracer_msgs::GetModelStatesRequest_<ContainerAllocator> >
: FalseType
{ };
template <class ContainerAllocator>
struct HasHeader< ::deepracer_msgs::GetModelStatesRequest_<ContainerAllocator> const>
: FalseType
{ };
template<class ContainerAllocator>
struct MD5Sum< ::deepracer_msgs::GetModelStatesRequest_<ContainerAllocator> >
{
static const char* value()
{
return "cbf135e797ae47a2c0be5146ab829cc2";
}
static const char* value(const ::deepracer_msgs::GetModelStatesRequest_<ContainerAllocator>&) { return value(); }
static const uint64_t static_value1 = 0xcbf135e797ae47a2ULL;
static const uint64_t static_value2 = 0xc0be5146ab829cc2ULL;
};
template<class ContainerAllocator>
struct DataType< ::deepracer_msgs::GetModelStatesRequest_<ContainerAllocator> >
{
static const char* value()
{
return "deepracer_msgs/GetModelStatesRequest";
}
static const char* value(const ::deepracer_msgs::GetModelStatesRequest_<ContainerAllocator>&) { return value(); }
};
template<class ContainerAllocator>
struct Definition< ::deepracer_msgs::GetModelStatesRequest_<ContainerAllocator> >
{
static const char* value()
{
return "string[] model_names # name of Gazebo Model\n"
"string[] relative_entity_names # return pose and twist relative to this entity\n"
" # an entity can be a model, body, or geom\n"
" # be sure to use gazebo scoped naming notation (e.g. [model_name::body_name])\n"
" # leave empty or \"world\" will use inertial world frame\n"
;
}
static const char* value(const ::deepracer_msgs::GetModelStatesRequest_<ContainerAllocator>&) { return value(); }
};
} // namespace message_traits
} // namespace ros
namespace ros
{
namespace serialization
{
template<class ContainerAllocator> struct Serializer< ::deepracer_msgs::GetModelStatesRequest_<ContainerAllocator> >
{
template<typename Stream, typename T> inline static void allInOne(Stream& stream, T m)
{
stream.next(m.model_names);
stream.next(m.relative_entity_names);
}
ROS_DECLARE_ALLINONE_SERIALIZER
}; // struct GetModelStatesRequest_
} // namespace serialization
} // namespace ros
namespace ros
{
namespace message_operations
{
template<class ContainerAllocator>
struct Printer< ::deepracer_msgs::GetModelStatesRequest_<ContainerAllocator> >
{
template<typename Stream> static void stream(Stream& s, const std::string& indent, const ::deepracer_msgs::GetModelStatesRequest_<ContainerAllocator>& v)
{
s << indent << "model_names[]" << std::endl;
for (size_t i = 0; i < v.model_names.size(); ++i)
{
s << indent << " model_names[" << i << "]: ";
Printer<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other > >::stream(s, indent + " ", v.model_names[i]);
}
s << indent << "relative_entity_names[]" << std::endl;
for (size_t i = 0; i < v.relative_entity_names.size(); ++i)
{
s << indent << " relative_entity_names[" << i << "]: ";
Printer<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other > >::stream(s, indent + " ", v.relative_entity_names[i]);
}
}
};
} // namespace message_operations
} // namespace ros
#endif // DEEPRACER_MSGS_MESSAGE_GETMODELSTATESREQUEST_H
|
38ffc682086927ef7128ca2d526902b0dd706f55 | 6e6486f283a7685fe8b83c3581e43db1736b64ab | /Project_3/college.cc | 912ad54cef73f7f9766f22ca299e5121144a4bfc | [] | no_license | collinsgamedev/CS2401 | 37e5938c0c5ec28fbc5eff369a4d675e8c3631e2 | cc50f35ada0cf2cf3c26c47908eb51e07a5d4494 | refs/heads/master | 2020-03-28T16:29:31.577100 | 2018-09-19T23:56:44 | 2018-09-19T23:56:44 | 147,733,535 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,787 | cc | college.cc | /*******************************************************************
This is the implementation file for the College class. For more
information about the class see FBFriend.h.
Edward Collins Ohio University October 6 2017
Last modified: October 13 2017
******************************************************************/
#include "college.h"
#include <string>
College::College()
{
head = NULL; //set the head node to NULL
}
College::College(std::string& name)
{
head = NULL;
username = name; //username constructor
}
College::~College()
{
node *rmptr; //create a node called rmptr
while (head != NULL) //while head is not equal to NULL
{
rmptr = head; //set remove pointer to head pointer
head = head->link(); //set head to head at link
delete rmptr; //delete the remove pointer
}
}
College::College(const College& other)
{
if (other.head == NULL)
{ head = NULL; } //set head to NULL if other head is at NULL
else
{
node *source, *dest; //creates nodes that are pointers known as source and destination (dest for short)
head = new node(other.head->data()); //set head to a new node and have head point at data set to other head at its data
dest = head; //set dest equal to head
source = other.head->link(); //have source set to other head's link
while (source != NULL)
{
dest->set_link(new node(source->data())); //dest will set link and create a new node
dest = dest->link(); //set dest to the dest at link
source = source->link(); //set source to the source link
}
}
}
void College::operator = (const College& other)
{
if (this == &other) //if the address of this is equal to other, return this
{ return; }
node *remove;
while (head != NULL)
{
remove = head;
head = head->link();
delete remove;
}
if (other.head == NULL)
{
head = NULL;
} //set head to NULL if other head is at NULL
else
{
node *source, *dest; //creates nodes that are pointers known as source and destination (dest for short)
head = new node(other.head->data()); //set head to a new node and have head point at data set to other head at its data
dest = head; //set dest equal to head
source = other.head->link(); //have source set to other head's link
while (source != NULL)
{
dest->set_link(new node(source->data())); //dest will set link and create a new node
dest = dest->link(); //set dest to the dest at link
source = source->link(); //set source to the source link
}
}
}
void College::add(course& c)
{
if (head == NULL) //check to see if the head is equal to NULL, this checks to see if the list is empty
{
head = new node(c, NULL); //if so, create a new node and add the course to the list
}
else //if there is a list...
{
node *cursor = NULL, *previous = NULL; //create two nodes know as cursor and previous. Cursor will be used to go through the list and previous is used to assign the last node that the cursor was on
if (c < head->data()) //if the course is less than what is at the beginning of the list
{
cursor = head; //assign cursor to what head is pointing at
head = new node(c, cursor); //create a new node with the course and connect it to the cursor pointer
while(cursor->link() != NULL)
{
cursor = head; //set cursor to point at what head is pointing at
while (cursor->link() != NULL) //while cursor link is not equal to NULL
{
previous = cursor; //set previous to point at what cursor is pointing at
cursor = cursor->link(); //have cursor assigned to the cursor link
}
if (c > cursor->data()) //if c is greater than the course data
{
node *temp; //create a temp node
temp = cursor->link(); //have the temp node hold the cursor link
cursor->set_link(new node(c, temp)); //set the link to the temp node with the course in the data field
}
else
{
node *temp; //createa a temp node
temp = cursor; //have temp be equal to the cursor pointer
previous->set_link(new node(c, temp)); //at the previous node, set a link to a new node that will hold the course added and set a link to temp
}
}
cursor->set_link(NULL); //set the cursor link to NULL to avoid seg fault
}
else //if the course is greater than what is at the beginning of the head of the list
{
cursor = head; //set cursor to point at what head is pointing at
while (cursor->link() != NULL) //while cursor link is not equal to NULL
{
previous = cursor; //set previous to point at what cursor is pointing at
cursor = cursor->link(); //have cursor assigned to the cursor link
}
if (c > cursor->data()) //if c is greater than the course data
{
node *temp; //create a temp node
temp = cursor->link(); //have the temp node hold the cursor link
cursor->set_link(new node(c, temp)); //set the link to the temp node with the course in the data field
}
else
{
node *temp; //createa a temp node
temp = cursor; //have temp be equal to the cursor pointer
previous->set_link(new node(c, temp)); //at the previous node, set a link to a new node that will hold the course added and set a link to temp
}
}
}
}
void College::display(std::ostream& outs)const
{
if (head == NULL) //head is equal to NULL, tell them that they have no course registered
{
std::cout << "You currently have no courses registered.\n";
}
else
{
for (node *temp = head; temp != NULL; temp = temp->link()) //create a temp node, have temp be set to temp at link, and check to see if temp is not equal to NULL
{
std::cout << temp->data(); //go through the list and show the courses in the list
}
}
}
void College::remove(std::string& course)
{
node *remove = NULL, *previous = NULL; //create two node called remove and previous
if (head->data().get_course_number() == course) //if the course that is wanting to be removed is at the head of the list
{
remove = head; //set remove pointer to the head pointer
head = head->link(); //have head be set to head at link
delete remove; //delete the remove pointer
}
else
{
remove = head; //set remove pointer to the head pointer
while (remove != NULL && remove->data().get_course_number() != course) //check to see if remove is not equal to NULL and if the data in remove is
//not equal to the course that is wanting to be removed
{
previous = remove; //set previous to remove
remove = remove->link(); //set remove to the remove at link
}
if (remove != NULL) //remove is not equal to NULL
{
previous->set_link(remove->link()); //set previous at link to the remove at link
delete remove; //delete remove
}
else //else, tell them that the course is not in the list
{
std::cout << "That course is not in your list.\n";
}
}
}
double College::hours()
{
double total_hours = 0; //used to store the total number of hours
for (node *temp = head; temp != NULL; temp = temp->link()) //create a temp node, have temp be set to temp at link, and check to see if temp is not equal to NULL
{
total_hours += temp->data().get_hours(); //go through the list and get the sum of all the hours taken
}
return total_hours; //return the total amount of hours
}
double College::gpa()
{
//used to set the GPA to two (2) decimal points
std::cout.setf(std::ios::fixed);
std::cout.setf(std::ios::showpoint);
std::cout.precision(2);
double current_gpa = 0; //used to store the current gpa
double num_grade = 0; //used to store the number grade times the hours
double total_hours = 0; //used to store the total hours
for (node *temp = head; temp != NULL; temp = temp->link()) //create a temp node, have temp be set to temp at link, and check to see if temp is not equal to NULL
{
num_grade += (temp->data().get_number_grade() * temp->data().get_hours()); //go through the list and get the number grade and get the hours of the course
//then get the sum of all of them
total_hours += temp->data().get_hours(); //go through the list and get the total hours that has be entered
}
current_gpa = num_grade/total_hours; //calculate the current gpa by dividing the num_grade by the total_hours
return current_gpa; //return the current_gpa
}
void College::save(std::ostream& outs)
{
for(node *temp = head; temp != NULL; temp = temp->link())
{
outs << temp->data();
}
}
void College::load(std::istream& ins)
{
course c;
c.input(ins);
while(!ins.eof())
{
add(c);
c.input(ins);
}
}
|
e025a5d9128ddc3663276bbf7fc8f65b8357025f | d49b855c86b1bb576c75e7daef31fea9d100b32a | /oneflow-master-zj/oneflow/user/ops/reshape_op.cpp | 0c0c96a4d50306726892305c5f03b073d733f1f9 | [
"Apache-2.0"
] | permissive | wanghongsheng01/Dubhe | dceabf9525bc04d10326c3ec24aaa5c10148fd15 | a53a8356df34daa6056955bda84269f43ffb40ab | refs/heads/master | 2023-05-30T10:26:19.952824 | 2021-06-22T13:37:05 | 2021-06-22T13:37:05 | 379,215,510 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,191 | cpp | reshape_op.cpp | /*
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "oneflow/core/common/balanced_splitter.h"
#include "oneflow/core/framework/framework.h"
#include "oneflow/user/ops/reshape_user_op_util.h"
#include "oneflow/core/operator/operator.h"
namespace oneflow {
namespace {
Maybe<void> GetSbpFn(user_op::SbpContext* ctx) {
const auto& in_shape = ctx->LogicalTensorDesc4InputArgNameAndIndex("in", 0).shape();
const Shape& shape = ctx->Attr<Shape>("shape");
const auto& outshape = JUST(ReshapeUserOpUtil::GetLogicalOutBlobShape(in_shape, shape));
user_op::UserOpSbpSignatureBuilder builder = ctx->NewBuilder();
return ReshapeUserOpUtil::GetReshapeUserOpSbpSignatures(
in_shape, *outshape, {{"in", 0}}, {{"out", 0}}, ctx->parallel_num(), &builder);
}
Maybe<void> InferParallelDistributionFn(user_op::InferParallelDistributionFnContext* ctx) {
const Shape& in_shape = ctx->LogicalTensorDesc4InputArgNameAndIndex("in", 0).shape();
const Shape& shape = ctx->user_op_conf().attr<Shape>("shape");
const auto& out_shape = JUST(ReshapeUserOpUtil::GetLogicalOutBlobShape(in_shape, shape));
return ReshapeUserOpUtil::InferParallelDistribution(ctx, in_shape, *out_shape);
}
Maybe<void> LogicalTensorDescInferFn(user_op::InferContext* ctx) {
const Shape& shape = ctx->Attr<Shape>("shape");
const user_op::TensorDesc* in_tensor_desc = ctx->TensorDesc4ArgNameAndIndex("in", 0);
user_op::TensorDesc* out_tensor_desc = ctx->OutputTensorDesc("out", 0);
const Shape& in_shape = in_tensor_desc->shape();
Shape* out_shape = out_tensor_desc->mut_shape();
CHECK_OR_RETURN(in_tensor_desc->is_dynamic() == false);
*out_tensor_desc = *in_tensor_desc;
CHECK_GE_OR_RETURN(shape.NumAxes(), 1);
DimVector dim_vec = {shape.dim_vec().begin(), shape.dim_vec().end()};
FOR_RANGE(int32_t, i, 0, dim_vec.size()) { CHECK_GT_OR_RETURN(dim_vec.at(i), 0); }
*out_shape = Shape(dim_vec);
CHECK_EQ_OR_RETURN(out_shape->elem_cnt(), in_shape.elem_cnt());
return Maybe<void>::Ok();
}
Maybe<void> TensorDescInferFn(user_op::InferContext* ctx) {
const Shape& shape = ctx->Attr<Shape>("shape");
CHECK_GE_OR_RETURN(shape.NumAxes(), 1);
FOR_RANGE(int32_t, i, 0, shape.NumAxes()) { CHECK_GT_OR_RETURN(shape.At(i), 0); }
const user_op::TensorDesc* in_tensor_desc = ctx->TensorDesc4ArgNameAndIndex("in", 0);
user_op::TensorDesc* out_tensor_desc = ctx->OutputTensorDesc("out", 0);
const Shape& in_shape = in_tensor_desc->shape();
Shape* out_shape = out_tensor_desc->mut_shape();
CHECK_OR_RETURN(in_tensor_desc->is_dynamic() == false);
*out_tensor_desc->mut_shape() = in_tensor_desc->shape();
*out_tensor_desc->mut_is_dynamic() = in_tensor_desc->is_dynamic();
const auto& parallel_distribution = ctx->ParallelDistribution4ArgNameAndIndex("out", 0);
*out_shape = *JUST(
GetPhysicalShape(shape, parallel_distribution, ctx->parallel_desc(), ctx->parallel_ctx()));
CHECK_EQ_OR_RETURN(out_shape->elem_cnt(), in_shape.elem_cnt());
return Maybe<void>::Ok();
}
Maybe<void> InferDataType(user_op::InferContext* ctx) {
*ctx->OutputDType("out", 0) = ctx->InputDType("in", 0);
return Maybe<void>::Ok();
}
REGISTER_USER_OP("reshape")
.Input("in")
.Output("out")
.Attr<Shape>("shape")
.SetLogicalTensorDescInferFn(LogicalTensorDescInferFn)
.SetPhysicalTensorDescInferFn(TensorDescInferFn)
.SetGetSbpFn(GetSbpFn)
.SetParallelDistributionInferFn(InferParallelDistributionFn)
.SetDataTypeInferFn(InferDataType);
REGISTER_USER_OP_GRAD("reshape").SetGenBackwardOpConfFn([](const user_op::UserOpWrapper& op,
user_op::AddOpFn AddOp) {
if (op.NeedGenGradTensor4OpInput("in", 0)) {
const auto& in_desc = op.TensorDesc4ArgNameAndIndex("in", 0);
user_op::UserOpConfWrapperBuilder builder(op.op_name() + "_grad");
if (in_desc.is_dynamic()) {
user_op::UserOpConfWrapper reshape_grad_op =
builder.Op("reshape_like")
.Input("in", op.GetGradTensorWithOpOutput("out", 0))
.Input("like", op.input("in", 0))
.Output("out")
.Build();
op.BindGradTensorWithOpInput(reshape_grad_op.output("out", 0), "in", 0);
AddOp(reshape_grad_op);
} else {
user_op::UserOpConfWrapper reshape_grad_op =
builder.Op("reshape")
.Input("in", op.GetGradTensorWithOpOutput("out", 0))
.Attr("shape", in_desc.shape())
.Output("out")
.Build();
op.BindGradTensorWithOpInput(reshape_grad_op.output("out", 0), "in", 0);
AddOp(reshape_grad_op);
}
}
});
} // namespace
} // namespace oneflow
|
534a94c11f9532984ed86e325c995be4b3f6d4c7 | cfe48c2eda7c91287b36b4c052224230b708de7d | /zet_keuze.h | 3c5fae95c0786387f01fc1aa390c4c78315915c5 | [] | no_license | teneen/Houdini_6 | 35542996a5b1a0dc71ca1719c243fbeea034aa49 | 6949e461d27f435dee1a2f3b9edff002aeeab398 | refs/heads/main | 2023-04-09T04:27:18.327333 | 2021-04-20T09:41:51 | 2021-04-20T09:41:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,082 | h | zet_keuze.h | /*
*/
#ifndef ZET_KEUZE_H
#define ZET_KEUZE_H
#include "houdini.h"
#include "zet_generatie.h"
#include "stelling.h"
template<typename T>
struct StukVeldTabel
{
const T* operator[](Stuk stuk) const { return tabel[stuk]; }
T* operator[](Stuk stuk) { return tabel[stuk]; }
void clear() { std::memset(tabel, 0, sizeof(tabel)); }
T get(Stuk stuk, Veld naar) { return tabel[stuk][naar]; }
void update(Stuk stuk, Veld naar, T v)
{
tabel[stuk][naar] = v;
}
protected:
T tabel[STUK_N][VELD_N];
};
template<int MaxPlus, int MaxMin>
struct StukVeldStatistiek : StukVeldTabel<SorteerWaardeCompact>
{
static int bereken_offset(Stuk stuk, Veld naar) { return 64 * int(stuk) + int(naar); }
SorteerWaardeCompact valueAtOffset(int offset) const { return *((const SorteerWaardeCompact*)tabel + offset); }
void fill(SorteerWaarde v)
{
int vv = (uint16_t(v) << 16) | uint16_t(v);
std::fill((int *)tabel, (int *)((char *)tabel + sizeof(tabel)), vv);
}
void updatePlus(int offset, SorteerWaarde v)
{
//v = v * 2 * MaxPlus / (MaxPlus + MaxMin);
SorteerWaardeCompact& elem = *((SorteerWaardeCompact*)tabel + offset);
elem -= elem * int(v) / MaxPlus;
elem += v;
}
void updateMinus(int offset, SorteerWaarde v)
{
//v = v * 2 * MaxMin / (MaxPlus + MaxMin);
SorteerWaardeCompact& elem = *((SorteerWaardeCompact*)tabel + offset);
elem -= elem * int(v) / MaxMin;
elem -= v;
}
};
template<typename T>
struct KleurVeldStatistiek
{
const T* operator[](Kleur kleur) const { return tabel[kleur]; }
T* operator[](Kleur kleur) { return tabel[kleur]; }
void clear() { std::memset(tabel, 0, sizeof(tabel)); }
private:
T tabel[KLEUR_N][VELD_N];
};
struct CounterZetFullStats
{
Zet get(Kleur kleur, Zet zet) { return Zet(tabel[kleur][zet & 0xfff]); }
void clear() { std::memset(tabel, 0, sizeof(tabel)); }
void update(Kleur kleur, Zet zet1, Zet zet)
{
tabel[kleur][zet1 & 0xfff] = zet;
}
private:
ZetCompact tabel[KLEUR_N][64 * 64];
};
struct CounterZetFullPieceStats
{
Zet get(Stuk stuk, Zet zet) { return Zet(tabel[stuk][zet & 0xfff]); }
void clear() { std::memset(tabel, 0, sizeof(tabel)); }
void update(Stuk stuk, Zet zet1, Zet zet)
{
tabel[stuk][zet1 & 0xfff] = zet;
}
private:
ZetCompact tabel[STUK_N][64 * 64];
};
struct CounterFollowUpZetStats
{
Zet get(Stuk stuk1, Veld naar1, Stuk stuk2, Veld naar2) { return Zet(tabel[stuk1][naar1][stuk_type(stuk2)][naar2]); }
void clear() { std::memset(tabel, 0, sizeof(tabel)); }
void update(Stuk stuk1, Veld naar1, Stuk stuk2, Veld naar2, Zet zet)
{
tabel[stuk1][naar1][stuk_type(stuk2)][naar2] = zet;
}
private:
ZetCompact tabel[STUK_N][VELD_N][STUKTYPE_N][VELD_N];
};
struct MaxWinstStats
{
Waarde get(Stuk stuk, Zet zet) const { return tabel[stuk][zet & 0x0fff]; }
void clear() { std::memset(tabel, 0, sizeof(tabel)); }
void update(Stuk stuk, Zet zet, Waarde gain)
{
Waarde* pGain = &tabel[stuk][zet & 0x0fff];
*pGain += Waarde((gain - *pGain + 8) >> 4);
}
private:
Waarde tabel[STUK_N][64 * 64];
};
struct SpecialKillerStats
{
static int index_mijn_stukken(const Stelling &pos, Kleur kleur);
static int index_jouw_stukken(const Stelling &pos, Kleur kleur, Veld veld);
Zet get(Kleur kleur, int index) const { return tabel[kleur][index]; }
void clear() { std::memset(tabel, 0, sizeof(tabel)); }
void update(Kleur kleur, int index, Zet zet)
{
tabel[kleur][index] = zet;
}
private:
Zet tabel[KLEUR_N][65536];
};
typedef StukVeldTabel<ZetCompact> CounterZetStats;
typedef StukVeldStatistiek<8192, 8192> ZetWaardeStatistiek;
typedef StukVeldStatistiek<3*8192, 3*8192> CounterZetWaarden;
typedef StukVeldTabel<CounterZetWaarden> CounterZetHistoriek;
inline PikZetEtappe& operator++(PikZetEtappe& d) { return d = PikZetEtappe(int(d) + 1); }
namespace ZetKeuze
{
void init_search(const Stelling&, Zet, Diepte, bool);
void init_qsearch(const Stelling&, Zet, Diepte, Veld);
void init_probcut(const Stelling&, Zet, SeeWaarde);
Zet geef_zet(const Stelling& pos);
template<ZetGeneratie> void score(const Stelling& pos);
}
#endif // #ifndef ZET_KEUZE_H
|
4c100ae80a5e18d0c01896937c0df541ade056d2 | f3c413cf12cfce8842002ad503d81b33735a7247 | /include/ads/quad/gauss.hpp | 703d8ba3f52881c72ba8ad47003c733042945de1 | [
"MIT"
] | permissive | marcinlos/iga-ads | f02d4e9d1e70c809511cb062261bb55372f6cf42 | 4f25e75376361d5b15ddc58f16e7bf7ae0431bd8 | refs/heads/develop | 2023-07-18T21:30:29.279316 | 2023-07-04T20:42:45 | 2023-07-04T20:42:45 | 58,336,078 | 9 | 8 | MIT | 2023-07-04T19:41:43 | 2016-05-08T23:31:46 | C++ | UTF-8 | C++ | false | false | 160,156 | hpp | gauss.hpp | // SPDX-FileCopyrightText: 2015 - 2023 Marcin Łoś <marcin.los.91@gmail.com>
// SPDX-License-Identifier: MIT
#ifndef ADS_QUAD_GAUSS_HPP
#define ADS_QUAD_GAUSS_HPP
#include <cstddef>
namespace ads::quad::gauss {
template <std::size_t N>
struct gauss_data;
extern const double* const Xs[65];
extern const double* const Ws[65];
template <>
struct gauss_data<2> {
static constexpr double X[] = {
-0.57735026918962576450, //
0.57735026918962576450, //
};
static constexpr double W[] = {
1.00000000000000000000, //
1.00000000000000000000, //
};
};
template <>
struct gauss_data<3> {
static constexpr double X[] = {
-0.77459666924148337703, //
0, //
0.77459666924148337703, //
};
static constexpr double W[] = {
0.55555555555555555555, //
0.88888888888888888888, //
0.55555555555555555555, //
};
};
template <>
struct gauss_data<4> {
static constexpr double X[] = {
-0.86113631159405257522, //
-0.33998104358485626480, //
0.33998104358485626480, //
0.86113631159405257522, //
};
static constexpr double W[] = {
0.34785484513745385737, //
0.65214515486254614262, //
0.65214515486254614262, //
0.34785484513745385737, //
};
};
template <>
struct gauss_data<5> {
static constexpr double X[] = {
-0.90617984593866399279, //
-0.53846931010568309103, //
0, //
0.53846931010568309103, //
0.90617984593866399279, //
};
static constexpr double W[] = {
0.23692688505618908751, //
0.47862867049936646804, //
0.56888888888888888888, //
0.47862867049936646804, //
0.23692688505618908751, //
};
};
template <>
struct gauss_data<6> {
static constexpr double X[] = {
-0.93246951420315202781, //
-0.66120938646626451366, //
-0.23861918608319690863, //
0.23861918608319690863, //
0.66120938646626451366, //
0.93246951420315202781, //
};
static constexpr double W[] = {
0.17132449237917034504, //
0.36076157304813860756, //
0.46791393457269104738, //
0.46791393457269104738, //
0.36076157304813860756, //
0.17132449237917034504, //
};
};
template <>
struct gauss_data<7> {
static constexpr double X[] = {
-0.94910791234275852452, //
-0.74153118559939443986, //
-0.40584515137739716690, //
0, //
0.40584515137739716690, //
0.74153118559939443986, //
0.94910791234275852452, //
};
static constexpr double W[] = {
0.12948496616886969327, //
0.27970539148927666790, //
0.38183005050511894495, //
0.41795918367346938775, //
0.38183005050511894495, //
0.27970539148927666790, //
0.12948496616886969327, //
};
};
template <>
struct gauss_data<8> {
static constexpr double X[] = {
-0.96028985649753623168, //
-0.79666647741362673959, //
-0.52553240991632898581, //
-0.18343464249564980493, //
0.18343464249564980493, //
0.52553240991632898581, //
0.79666647741362673959, //
0.96028985649753623168, //
};
static constexpr double W[] = {
0.10122853629037625915, //
0.22238103445337447054, //
0.31370664587788728733, //
0.36268378337836198296, //
0.36268378337836198296, //
0.31370664587788728733, //
0.22238103445337447054, //
0.10122853629037625915, //
};
};
template <>
struct gauss_data<9> {
static constexpr double X[] = {
-0.96816023950762608983, //
-0.83603110732663579429, //
-0.61337143270059039730, //
-0.32425342340380892903, //
0, //
0.32425342340380892903, //
0.61337143270059039730, //
0.83603110732663579429, //
0.96816023950762608983, //
};
static constexpr double W[] = {
0.08127438836157441197, //
0.18064816069485740405, //
0.26061069640293546231, //
0.31234707704000284006, //
0.33023935500125976316, //
0.31234707704000284006, //
0.26061069640293546231, //
0.18064816069485740405, //
0.08127438836157441197, //
};
};
template <>
struct gauss_data<10> {
static constexpr double X[] = {
-0.97390652851717172007, //
-0.86506336668898451073, //
-0.67940956829902440623, //
-0.43339539412924719079, //
-0.14887433898163121088, //
0.14887433898163121088, //
0.43339539412924719079, //
0.67940956829902440623, //
0.86506336668898451073, //
0.97390652851717172007, //
};
static constexpr double W[] = {
0.06667134430868813759, //
0.14945134915058059314, //
0.21908636251598204399, //
0.26926671930999635509, //
0.29552422471475287017, //
0.29552422471475287017, //
0.26926671930999635509, //
0.21908636251598204399, //
0.14945134915058059314, //
0.06667134430868813759, //
};
};
template <>
struct gauss_data<11> {
static constexpr double X[] = {
-0.97822865814605699280, //
-0.88706259976809529907, //
-0.73015200557404932409, //
-0.51909612920681181592, //
-0.26954315595234497233, //
0, //
0.26954315595234497233, //
0.51909612920681181592, //
0.73015200557404932409, //
0.88706259976809529907, //
0.97822865814605699280, //
};
static constexpr double W[] = {
0.05566856711617366648, //
0.12558036946490462463, //
0.18629021092773425142, //
0.23319376459199047991, //
0.26280454451024666218, //
0.27292508677790063071, //
0.26280454451024666218, //
0.23319376459199047991, //
0.18629021092773425142, //
0.12558036946490462463, //
0.05566856711617366648, //
};
};
template <>
struct gauss_data<12> {
static constexpr double X[] = {
-0.98156063424671925069, //
-0.90411725637047485667, //
-0.76990267419430468703, //
-0.58731795428661744729, //
-0.36783149899818019375, //
-0.12523340851146891547, //
0.12523340851146891547, //
0.36783149899818019375, //
0.58731795428661744729, //
0.76990267419430468703, //
0.90411725637047485667, //
0.98156063424671925069, //
};
static constexpr double W[] = {
0.04717533638651182719, //
0.10693932599531843096, //
0.16007832854334622633, //
0.20316742672306592174, //
0.23349253653835480876, //
0.24914704581340278500, //
0.24914704581340278500, //
0.23349253653835480876, //
0.20316742672306592174, //
0.16007832854334622633, //
0.10693932599531843096, //
0.04717533638651182719, //
};
};
template <>
struct gauss_data<13> {
static constexpr double X[] = {
-0.98418305471858814947, //
-0.91759839922297796520, //
-0.80157809073330991279, //
-0.64234933944034022064, //
-0.44849275103644685287, //
-0.23045831595513479406, //
0, //
0.23045831595513479406, //
0.44849275103644685287, //
0.64234933944034022064, //
0.80157809073330991279, //
0.91759839922297796520, //
0.98418305471858814947, //
};
static constexpr double W[] = {
0.04048400476531587952, //
0.09212149983772844791, //
0.13887351021978723846, //
0.17814598076194573828, //
0.20781604753688850231, //
0.22628318026289723841, //
0.23255155323087391019, //
0.22628318026289723841, //
0.20781604753688850231, //
0.17814598076194573828, //
0.13887351021978723846, //
0.09212149983772844791, //
0.04048400476531587952, //
};
};
template <>
struct gauss_data<14> {
static constexpr double X[] = {
-0.98628380869681233884, //
-0.92843488366357351733, //
-0.82720131506976499318, //
-0.68729290481168547014, //
-0.51524863635815409196, //
-0.31911236892788976043, //
-0.10805494870734366206, //
0.10805494870734366206, //
0.31911236892788976043, //
0.51524863635815409196, //
0.68729290481168547014, //
0.82720131506976499318, //
0.92843488366357351733, //
0.98628380869681233884, //
};
static constexpr double W[] = {
0.03511946033175186303, //
0.08015808715976020980, //
0.12151857068790318468, //
0.15720316715819353456, //
0.18553839747793781374, //
0.20519846372129560396, //
0.21526385346315779019, //
0.21526385346315779019, //
0.20519846372129560396, //
0.18553839747793781374, //
0.15720316715819353456, //
0.12151857068790318468, //
0.08015808715976020980, //
0.03511946033175186303, //
};
};
template <>
struct gauss_data<15> {
static constexpr double X[] = {
-0.98799251802048542848, //
-0.93727339240070590430, //
-0.84820658341042721620, //
-0.72441773136017004741, //
-0.57097217260853884753, //
-0.39415134707756336989, //
-0.20119409399743452230, //
0, //
0.20119409399743452230, //
0.39415134707756336989, //
0.57097217260853884753, //
0.72441773136017004741, //
0.84820658341042721620, //
0.93727339240070590430, //
0.98799251802048542848, //
};
static constexpr double W[] = {
0.03075324199611726835, //
0.07036604748810812470, //
0.10715922046717193501, //
0.13957067792615431444, //
0.16626920581699393355, //
0.18616100001556221102, //
0.19843148532711157645, //
0.20257824192556127288, //
0.19843148532711157645, //
0.18616100001556221102, //
0.16626920581699393355, //
0.13957067792615431444, //
0.10715922046717193501, //
0.07036604748810812470, //
0.03075324199611726835, //
};
};
template <>
struct gauss_data<16> {
static constexpr double X[] = {
-0.98940093499164993259, //
-0.94457502307323257607, //
-0.86563120238783174388, //
-0.75540440835500303389, //
-0.61787624440264374844, //
-0.45801677765722738634, //
-0.28160355077925891323, //
-0.09501250983763744018, //
0.09501250983763744018, //
0.28160355077925891323, //
0.45801677765722738634, //
0.61787624440264374844, //
0.75540440835500303389, //
0.86563120238783174388, //
0.94457502307323257607, //
0.98940093499164993259, //
};
static constexpr double W[] = {
0.02715245941175409485, //
0.06225352393864789286, //
0.09515851168249278480, //
0.12462897125553387205, //
0.14959598881657673208, //
0.16915651939500253818, //
0.18260341504492358886, //
0.18945061045506849628, //
0.18945061045506849628, //
0.18260341504492358886, //
0.16915651939500253818, //
0.14959598881657673208, //
0.12462897125553387205, //
0.09515851168249278480, //
0.06225352393864789286, //
0.02715245941175409485, //
};
};
template <>
struct gauss_data<17> {
static constexpr double X[] = {
-0.99057547531441733567, //
-0.95067552176876776122, //
-0.88023915372698590212, //
-0.78151400389680140692, //
-0.65767115921669076585, //
-0.51269053708647696788, //
-0.35123176345387631529, //
-0.17848418149584785585, //
0, //
0.17848418149584785585, //
0.35123176345387631529, //
0.51269053708647696788, //
0.65767115921669076585, //
0.78151400389680140692, //
0.88023915372698590212, //
0.95067552176876776122, //
0.99057547531441733567, //
};
static constexpr double W[] = {
0.02414830286854793196, //
0.05545952937398720112, //
0.08503614831717918088, //
0.11188384719340397109, //
0.13513636846852547328, //
0.15404576107681028808, //
0.16800410215645004450, //
0.17656270536699264632, //
0.17944647035620652545, //
0.17656270536699264632, //
0.16800410215645004450, //
0.15404576107681028808, //
0.13513636846852547328, //
0.11188384719340397109, //
0.08503614831717918088, //
0.05545952937398720112, //
0.02414830286854793196, //
};
};
template <>
struct gauss_data<18> {
static constexpr double X[] = {
-0.99156516842093094673, //
-0.95582394957139775518, //
-0.89260246649755573920, //
-0.80370495897252311568, //
-0.69168704306035320787, //
-0.55977083107394753460, //
-0.41175116146284264603, //
-0.25188622569150550958, //
-0.08477501304173530124, //
0.08477501304173530124, //
0.25188622569150550958, //
0.41175116146284264603, //
0.55977083107394753460, //
0.69168704306035320787, //
0.80370495897252311568, //
0.89260246649755573920, //
0.95582394957139775518, //
0.99156516842093094673, //
};
static constexpr double W[] = {
0.02161601352648331031, //
0.04971454889496979645, //
0.07642573025488905652, //
0.10094204410628716556, //
0.12255520671147846018, //
0.14064291467065065120, //
0.15468467512626524492, //
0.16427648374583272298, //
0.16914238296314359184, //
0.16914238296314359184, //
0.16427648374583272298, //
0.15468467512626524492, //
0.14064291467065065120, //
0.12255520671147846018, //
0.10094204410628716556, //
0.07642573025488905652, //
0.04971454889496979645, //
0.02161601352648331031, //
};
};
template <>
struct gauss_data<19> {
static constexpr double X[] = {
-0.99240684384358440318, //
-0.96020815213483003085, //
-0.90315590361481790164, //
-0.82271465653714282497, //
-0.72096617733522937861, //
-0.60054530466168102346, //
-0.46457074137596094571, //
-0.31656409996362983199, //
-0.16035864564022537586, //
0, //
0.16035864564022537586, //
0.31656409996362983199, //
0.46457074137596094571, //
0.60054530466168102346, //
0.72096617733522937861, //
0.82271465653714282497, //
0.90315590361481790164, //
0.96020815213483003085, //
0.99240684384358440318, //
};
static constexpr double W[] = {
0.01946178822972647703, //
0.04481422676569960033, //
0.06904454273764122658, //
0.09149002162244999946, //
0.11156664554733399471, //
0.12875396253933622767, //
0.14260670217360661177, //
0.15276604206585966677, //
0.15896884339395434764, //
0.16105444984878369597, //
0.15896884339395434764, //
0.15276604206585966677, //
0.14260670217360661177, //
0.12875396253933622767, //
0.11156664554733399471, //
0.09149002162244999946, //
0.06904454273764122658, //
0.04481422676569960033, //
0.01946178822972647703, //
};
};
template <>
struct gauss_data<20> {
static constexpr double X[] = {
-0.99312859918509492478, //
-0.96397192727791379126, //
-0.91223442825132590586, //
-0.83911697182221882339, //
-0.74633190646015079261, //
-0.63605368072651502545, //
-0.51086700195082709800, //
-0.37370608871541956067, //
-0.22778585114164507808, //
-0.07652652113349733375, //
0.07652652113349733375, //
0.22778585114164507808, //
0.37370608871541956067, //
0.51086700195082709800, //
0.63605368072651502545, //
0.74633190646015079261, //
0.83911697182221882339, //
0.91223442825132590586, //
0.96397192727791379126, //
0.99312859918509492478, //
};
static constexpr double W[] = {
0.01761400713915211831, //
0.04060142980038694133, //
0.06267204833410906356, //
0.08327674157670474872, //
0.10193011981724043503, //
0.11819453196151841731, //
0.13168863844917662689, //
0.14209610931838205132, //
0.14917298647260374678, //
0.15275338713072585069, //
0.15275338713072585069, //
0.14917298647260374678, //
0.14209610931838205132, //
0.13168863844917662689, //
0.11819453196151841731, //
0.10193011981724043503, //
0.08327674157670474872, //
0.06267204833410906356, //
0.04060142980038694133, //
0.01761400713915211831, //
};
};
template <>
struct gauss_data<21> {
static constexpr double X[] = {
-0.99375217062038950026, //
-0.96722683856630629431, //
-0.92009933415040082879, //
-0.85336336458331728364, //
-0.76843996347567790861, //
-0.66713880419741231930, //
-0.55161883588721980705, //
-0.42434212020743878357, //
-0.28802131680240109660, //
-0.14556185416089509093, //
0, //
0.14556185416089509093, //
0.28802131680240109660, //
0.42434212020743878357, //
0.55161883588721980705, //
0.66713880419741231930, //
0.76843996347567790861, //
0.85336336458331728364, //
0.92009933415040082879, //
0.96722683856630629431, //
0.99375217062038950026, //
};
static constexpr double W[] = {
0.01601722825777433332, //
0.03695378977085249379, //
0.05713442542685720828, //
0.07610011362837930201, //
0.09344442345603386155, //
0.10879729916714837766, //
0.12183141605372853419, //
0.13226893863333746178, //
0.13988739479107315472, //
0.14452440398997005906, //
0.14608113364969042719, //
0.14452440398997005906, //
0.13988739479107315472, //
0.13226893863333746178, //
0.12183141605372853419, //
0.10879729916714837766, //
0.09344442345603386155, //
0.07610011362837930201, //
0.05713442542685720828, //
0.03695378977085249379, //
0.01601722825777433332, //
};
};
template <>
struct gauss_data<22> {
static constexpr double X[] = {
-0.99429458548239929207, //
-0.97006049783542872712, //
-0.92695677218717400052, //
-0.86581257772030013653, //
-0.78781680597920816200, //
-0.69448726318668278005, //
-0.58764040350691159295, //
-0.46935583798675702640, //
-0.34193582089208422515, //
-0.20786042668822128547, //
-0.06973927331972222121, //
0.06973927331972222121, //
0.20786042668822128547, //
0.34193582089208422515, //
0.46935583798675702640, //
0.58764040350691159295, //
0.69448726318668278005, //
0.78781680597920816200, //
0.86581257772030013653, //
0.92695677218717400052, //
0.97006049783542872712, //
0.99429458548239929207, //
};
static constexpr double W[] = {
0.01462799529827220068, //
0.03377490158481415479, //
0.05229333515268328594, //
0.06979646842452048809, //
0.08594160621706772741, //
0.10041414444288096493, //
0.11293229608053921839, //
0.12325237681051242428, //
0.13117350478706237073, //
0.13654149834601517135, //
0.13925187285563199337, //
0.13925187285563199337, //
0.13654149834601517135, //
0.13117350478706237073, //
0.12325237681051242428, //
0.11293229608053921839, //
0.10041414444288096493, //
0.08594160621706772741, //
0.06979646842452048809, //
0.05229333515268328594, //
0.03377490158481415479, //
0.01462799529827220068, //
};
};
template <>
struct gauss_data<23> {
static constexpr double X[] = {
-0.99476933499755212352, //
-0.97254247121811523195, //
-0.93297108682601610234, //
-0.87675235827044166737, //
-0.80488840161883989215, //
-0.71866136313195019446, //
-0.61960987576364615638, //
-0.50950147784600754968, //
-0.39030103803029083142, //
-0.26413568097034493053, //
-0.13325682429846611093, //
0, //
0.13325682429846611093, //
0.26413568097034493053, //
0.39030103803029083142, //
0.50950147784600754968, //
0.61960987576364615638, //
0.71866136313195019446, //
0.80488840161883989215, //
0.87675235827044166737, //
0.93297108682601610234, //
0.97254247121811523195, //
0.99476933499755212352, //
};
static constexpr double W[] = {
0.01341185948714177208, //
0.03098800585697944431, //
0.04803767173108466857, //
0.06423242140852585212, //
0.07928141177671895492, //
0.09291576606003514747, //
0.10489209146454141007, //
0.11499664022241136494, //
0.12304908430672953046, //
0.12890572218808214997, //
0.13246203940469661737, //
0.13365457218610617535, //
0.13246203940469661737, //
0.12890572218808214997, //
0.12304908430672953046, //
0.11499664022241136494, //
0.10489209146454141007, //
0.09291576606003514747, //
0.07928141177671895492, //
0.06423242140852585212, //
0.04803767173108466857, //
0.03098800585697944431, //
0.01341185948714177208, //
};
};
template <>
struct gauss_data<24> {
static constexpr double X[] = {
-0.99518721999702136017, //
-0.97472855597130949819, //
-0.93827455200273275852, //
-0.88641552700440103421, //
-0.82000198597390292195, //
-0.74012419157855436424, //
-0.64809365193697556925, //
-0.54542147138883953565, //
-0.43379350762604513848, //
-0.31504267969616337438, //
-0.19111886747361630915, //
-0.06405689286260562608, //
0.06405689286260562608, //
0.19111886747361630915, //
0.31504267969616337438, //
0.43379350762604513848, //
0.54542147138883953565, //
0.64809365193697556925, //
0.74012419157855436424, //
0.82000198597390292195, //
0.88641552700440103421, //
0.93827455200273275852, //
0.97472855597130949819, //
0.99518721999702136017, //
};
static constexpr double W[] = {
0.01234122979998719954, //
0.02853138862893366318, //
0.04427743881741980616, //
0.05929858491543678074, //
0.07334648141108030573, //
0.08619016153195327591, //
0.09761865210411388826, //
0.10744427011596563478, //
0.11550566805372560135, //
0.12167047292780339120, //
0.12583745634682829612, //
0.12793819534675215697, //
0.12793819534675215697, //
0.12583745634682829612, //
0.12167047292780339120, //
0.11550566805372560135, //
0.10744427011596563478, //
0.09761865210411388826, //
0.08619016153195327591, //
0.07334648141108030573, //
0.05929858491543678074, //
0.04427743881741980616, //
0.02853138862893366318, //
0.01234122979998719954, //
};
};
template <>
struct gauss_data<25> {
static constexpr double X[] = {
-0.99555696979049809790, //
-0.97666392145951751149, //
-0.94297457122897433941, //
-0.89499199787827536885, //
-0.83344262876083400142, //
-0.75925926303735763057, //
-0.67356636847346836448, //
-0.57766293024122296772, //
-0.47300273144571496052, //
-0.36117230580938783773, //
-0.24386688372098843204, //
-0.12286469261071039638, //
0, //
0.12286469261071039638, //
0.24386688372098843204, //
0.36117230580938783773, //
0.47300273144571496052, //
0.57766293024122296772, //
0.67356636847346836448, //
0.75925926303735763057, //
0.83344262876083400142, //
0.89499199787827536885, //
0.94297457122897433941, //
0.97666392145951751149, //
0.99555696979049809790, //
};
static constexpr double W[] = {
0.01139379850102628794, //
0.02635498661503213726, //
0.04093915670130631265, //
0.05490469597583519192, //
0.06803833381235691720, //
0.08014070033500101801, //
0.09102826198296364981, //
0.10053594906705064420, //
0.10851962447426365311, //
0.11485825914571164833, //
0.11945576353578477222, //
0.12224244299031004168, //
0.12317605372671545120, //
0.12224244299031004168, //
0.11945576353578477222, //
0.11485825914571164833, //
0.10851962447426365311, //
0.10053594906705064420, //
0.09102826198296364981, //
0.08014070033500101801, //
0.06803833381235691720, //
0.05490469597583519192, //
0.04093915670130631265, //
0.02635498661503213726, //
0.01139379850102628794, //
};
};
template <>
struct gauss_data<26> {
static constexpr double X[] = {
-0.99588570114561692900, //
-0.97838544595647099110, //
-0.94715906666171425013, //
-0.90263786198430707421, //
-0.84544594278849801879, //
-0.77638594882067885619, //
-0.69642726041995726486, //
-0.60669229301761806323, //
-0.50844071482450571769, //
-0.40305175512348630648, //
-0.29200483948595689514, //
-0.17685882035689018396, //
-0.05923009342931320709, //
0.05923009342931320709, //
0.17685882035689018396, //
0.29200483948595689514, //
0.40305175512348630648, //
0.50844071482450571769, //
0.60669229301761806323, //
0.69642726041995726486, //
0.77638594882067885619, //
0.84544594278849801879, //
0.90263786198430707421, //
0.94715906666171425013, //
0.97838544595647099110, //
0.99588570114561692900, //
};
static constexpr double W[] = {
0.01055137261734300715, //
0.02441785109263190878, //
0.03796238329436276395, //
0.05097582529714781199, //
0.06327404632957483553, //
0.07468414976565974588, //
0.08504589431348523921, //
0.09421380035591414846, //
0.10205916109442542323, //
0.10847184052857659065, //
0.11336181654631966654, //
0.11666044348529658204, //
0.11832141527926227651, //
0.11832141527926227651, //
0.11666044348529658204, //
0.11336181654631966654, //
0.10847184052857659065, //
0.10205916109442542323, //
0.09421380035591414846, //
0.08504589431348523921, //
0.07468414976565974588, //
0.06327404632957483553, //
0.05097582529714781199, //
0.03796238329436276395, //
0.02441785109263190878, //
0.01055137261734300715, //
};
};
template <>
struct gauss_data<27> {
static constexpr double X[] = {
-0.99617926288898856693, //
-0.97992347596150122285, //
-0.95090055781470500685, //
-0.90948232067749110430, //
-0.85620790801829449030, //
-0.79177163907050822714, //
-0.71701347373942369929, //
-0.63290797194649514092, //
-0.54055156457945689490, //
-0.44114825175002688058, //
-0.33599390363850889973, //
-0.22645936543953685885, //
-0.11397258560952996693, //
0, //
0.11397258560952996693, //
0.22645936543953685885, //
0.33599390363850889973, //
0.44114825175002688058, //
0.54055156457945689490, //
0.63290797194649514092, //
0.71701347373942369929, //
0.79177163907050822714, //
0.85620790801829449030, //
0.90948232067749110430, //
0.95090055781470500685, //
0.97992347596150122285, //
0.99617926288898856693, //
};
static constexpr double W[] = {
0.00979899605129436026, //
0.02268623159618062319, //
0.03529705375741971102, //
0.04744941252061506270, //
0.05898353685983359911, //
0.06974882376624559298, //
0.07960486777305777126, //
0.08842315854375695019, //
0.09608872737002850756, //
0.10250163781774579867, //
0.10757828578853318721, //
0.11125248835684519267, //
0.11347634610896514862, //
0.11422086737895698904, //
0.11347634610896514862, //
0.11125248835684519267, //
0.10757828578853318721, //
0.10250163781774579867, //
0.09608872737002850756, //
0.08842315854375695019, //
0.07960486777305777126, //
0.06974882376624559298, //
0.05898353685983359911, //
0.04744941252061506270, //
0.03529705375741971102, //
0.02268623159618062319, //
0.00979899605129436026, //
};
};
template <>
struct gauss_data<28> {
static constexpr double X[] = {
-0.99644249757395444995, //
-0.98130316537087275369, //
-0.95425928062893819725, //
-0.91563302639213207386, //
-0.86589252257439504894, //
-0.80564137091717917144, //
-0.73561087801363177202, //
-0.65665109403886496121, //
-0.56972047181140171930, //
-0.47587422495511826103, //
-0.37625151608907871022, //
-0.27206162763517807767, //
-0.16456928213338077128, //
-0.05507928988403427042, //
0.05507928988403427042, //
0.16456928213338077128, //
0.27206162763517807767, //
0.37625151608907871022, //
0.47587422495511826103, //
0.56972047181140171930, //
0.65665109403886496121, //
0.73561087801363177202, //
0.80564137091717917144, //
0.86589252257439504894, //
0.91563302639213207386, //
0.95425928062893819725, //
0.98130316537087275369, //
0.99644249757395444995, //
};
static constexpr double W[] = {
0.00912428259309451773, //
0.02113211259277125975, //
0.03290142778230437997, //
0.04427293475900422783, //
0.05510734567571674543, //
0.06527292396699959579, //
0.07464621423456877902, //
0.08311341722890121839, //
0.09057174439303284094, //
0.09693065799792991585, //
0.10211296757806076981, //
0.10605576592284641791, //
0.10871119225829413525, //
0.11004701301647519628, //
0.11004701301647519628, //
0.10871119225829413525, //
0.10605576592284641791, //
0.10211296757806076981, //
0.09693065799792991585, //
0.09057174439303284094, //
0.08311341722890121839, //
0.07464621423456877902, //
0.06527292396699959579, //
0.05510734567571674543, //
0.04427293475900422783, //
0.03290142778230437997, //
0.02113211259277125975, //
0.00912428259309451773, //
};
};
template <>
struct gauss_data<29> {
static constexpr double X[] = {
-0.99667944226059658616, //
-0.98254550526141317487, //
-0.95728559577808772579, //
-0.92118023295305878509, //
-0.87463780492010279041, //
-0.81818548761525244498, //
-0.75246285173447713391, //
-0.67821453760268651515, //
-0.59628179713822782037, //
-0.50759295512422764210, //
-0.41315288817400866389, //
-0.31403163786763993494, //
-0.21135228616600107450, //
-0.10627823013267923017, //
0, //
0.10627823013267923017, //
0.21135228616600107450, //
0.31403163786763993494, //
0.41315288817400866389, //
0.50759295512422764210, //
0.59628179713822782037, //
0.67821453760268651515, //
0.75246285173447713391, //
0.81818548761525244498, //
0.87463780492010279041, //
0.92118023295305878509, //
0.95728559577808772579, //
0.98254550526141317487, //
0.99667944226059658616, //
};
static constexpr double W[] = {
0.00851690387874640965, //
0.01973208505612270598, //
0.03074049220209362264, //
0.04140206251868283610, //
0.05159482690249792391, //
0.06120309065707913854, //
0.07011793325505127856, //
0.07823832713576378382, //
0.08547225736617252754, //
0.09173775713925876334, //
0.09696383409440860630, //
0.10109127375991496612, //
0.10407331007772937391, //
0.10587615509732094140, //
0.10647938171831424424, //
0.10587615509732094140, //
0.10407331007772937391, //
0.10109127375991496612, //
0.09696383409440860630, //
0.09173775713925876334, //
0.08547225736617252754, //
0.07823832713576378382, //
0.07011793325505127856, //
0.06120309065707913854, //
0.05159482690249792391, //
0.04140206251868283610, //
0.03074049220209362264, //
0.01973208505612270598, //
0.00851690387874640965, //
};
};
template <>
struct gauss_data<30> {
static constexpr double X[] = {
-0.99689348407464954027, //
-0.98366812327974720997, //
-0.96002186496830751221, //
-0.92620004742927432587, //
-0.88256053579205268154, //
-0.82956576238276839744, //
-0.76777743210482619491, //
-0.69785049479331579693, //
-0.62052618298924286114, //
-0.53662414814201989926, //
-0.44703376953808917678, //
-0.35270472553087811347, //
-0.25463692616788984643, //
-0.15386991360858354696, //
-0.05147184255531769583, //
0.05147184255531769583, //
0.15386991360858354696, //
0.25463692616788984643, //
0.35270472553087811347, //
0.44703376953808917678, //
0.53662414814201989926, //
0.62052618298924286114, //
0.69785049479331579693, //
0.76777743210482619491, //
0.82956576238276839744, //
0.88256053579205268154, //
0.92620004742927432587, //
0.96002186496830751221, //
0.98366812327974720997, //
0.99689348407464954027, //
};
static constexpr double W[] = {
0.00796819249616660561, //
0.01846646831109095914, //
0.02878470788332336934, //
0.03879919256962704959, //
0.04840267283059405290, //
0.05749315621761906648, //
0.06597422988218049512, //
0.07375597473770520626, //
0.08075589522942021535, //
0.08689978720108297980, //
0.09212252223778612871, //
0.09636873717464425963, //
0.09959342058679526706, //
0.10176238974840550459, //
0.10285265289355884034, //
0.10285265289355884034, //
0.10176238974840550459, //
0.09959342058679526706, //
0.09636873717464425963, //
0.09212252223778612871, //
0.08689978720108297980, //
0.08075589522942021535, //
0.07375597473770520626, //
0.06597422988218049512, //
0.05749315621761906648, //
0.04840267283059405290, //
0.03879919256962704959, //
0.02878470788332336934, //
0.01846646831109095914, //
0.00796819249616660561, //
};
};
template <>
struct gauss_data<31> {
static constexpr double X[] = {
-0.99708748181947707405, //
-0.98468590966515248400, //
-0.96250392509294966178, //
-0.93075699789664816495, //
-0.88976002994827104337, //
-0.83992032014626734008, //
-0.78173314841662494040, //
-0.71577678458685328390, //
-0.64270672292426034618, //
-0.56324916140714926272, //
-0.47819378204490248044, //
-0.38838590160823294306, //
-0.29471806998170161661, //
-0.19812119933557062877, //
-0.09955531215234152032, //
0, //
0.09955531215234152032, //
0.19812119933557062877, //
0.29471806998170161661, //
0.38838590160823294306, //
0.47819378204490248044, //
0.56324916140714926272, //
0.64270672292426034618, //
0.71577678458685328390, //
0.78173314841662494040, //
0.83992032014626734008, //
0.88976002994827104337, //
0.93075699789664816495, //
0.96250392509294966178, //
0.98468590966515248400, //
0.99708748181947707405, //
};
static constexpr double W[] = {
0.00747083157924877585, //
0.01731862079031058246, //
0.02700901918497942180, //
0.03643227391238546402, //
0.04549370752720110290, //
0.05410308242491685371, //
0.06217478656102842691, //
0.06962858323541036616, //
0.07639038659877661642, //
0.08239299176158926390, //
0.08757674060847787612, //
0.09189011389364147821, //
0.09529024291231951280, //
0.09774333538632872509, //
0.09922501122667230787, //
0.09972054479342645142, //
0.09922501122667230787, //
0.09774333538632872509, //
0.09529024291231951280, //
0.09189011389364147821, //
0.08757674060847787612, //
0.08239299176158926390, //
0.07639038659877661642, //
0.06962858323541036616, //
0.06217478656102842691, //
0.05410308242491685371, //
0.04549370752720110290, //
0.03643227391238546402, //
0.02700901918497942180, //
0.01731862079031058246, //
0.00747083157924877585, //
};
};
template <>
struct gauss_data<32> {
static constexpr double X[] = {
-0.99726386184948156354, //
-0.98561151154526833540, //
-0.96476225558750643077, //
-0.93490607593773968917, //
-0.89632115576605212396, //
-0.84936761373256997013, //
-0.79448379596794240696, //
-0.73218211874028968038, //
-0.66304426693021520097, //
-0.58771575724076232904, //
-0.50689990893222939002, //
-0.42135127613063534536, //
-0.33186860228212764977, //
-0.23928736225213707454, //
-0.14447196158279649348, //
-0.04830766568773831623, //
0.04830766568773831623, //
0.14447196158279649348, //
0.23928736225213707454, //
0.33186860228212764977, //
0.42135127613063534536, //
0.50689990893222939002, //
0.58771575724076232904, //
0.66304426693021520097, //
0.73218211874028968038, //
0.79448379596794240696, //
0.84936761373256997013, //
0.89632115576605212396, //
0.93490607593773968917, //
0.96476225558750643077, //
0.98561151154526833540, //
0.99726386184948156354, //
};
static constexpr double W[] = {
0.00701861000947009660, //
0.01627439473090567060, //
0.02539206530926205945, //
0.03427386291302143310, //
0.04283589802222668065, //
0.05099805926237617619, //
0.05868409347853554714, //
0.06582222277636184683, //
0.07234579410884850622, //
0.07819389578707030647, //
0.08331192422694675522, //
0.08765209300440381114, //
0.09117387869576388471, //
0.09384439908080456563, //
0.09563872007927485941, //
0.09654008851472780056, //
0.09654008851472780056, //
0.09563872007927485941, //
0.09384439908080456563, //
0.09117387869576388471, //
0.08765209300440381114, //
0.08331192422694675522, //
0.07819389578707030647, //
0.07234579410884850622, //
0.06582222277636184683, //
0.05868409347853554714, //
0.05099805926237617619, //
0.04283589802222668065, //
0.03427386291302143310, //
0.02539206530926205945, //
0.01627439473090567060, //
0.00701861000947009660, //
};
};
template <>
struct gauss_data<33> {
static constexpr double X[] = {
-0.99742469424645521726, //
-0.98645572623064248811, //
-0.96682290968999276892, //
-0.93869437261116835035, //
-0.90231676774343358304, //
-0.85800965267650406464, //
-0.80616235627416658979, //
-0.74723049644956215785, //
-0.68173195996974278626, //
-0.61024234583637902730, //
-0.53338990478634764354, //
-0.45185001727245069572, //
-0.36633925774807334107, //
-0.27760909715249702940, //
-0.18643929882799157233, //
-0.09363106585473338567, //
0, //
0.09363106585473338567, //
0.18643929882799157233, //
0.27760909715249702940, //
0.36633925774807334107, //
0.45185001727245069572, //
0.53338990478634764354, //
0.61024234583637902730, //
0.68173195996974278626, //
0.74723049644956215785, //
0.80616235627416658979, //
0.85800965267650406464, //
0.90231676774343358304, //
0.93869437261116835035, //
0.96682290968999276892, //
0.98645572623064248811, //
0.99742469424645521726, //
};
static constexpr double W[] = {
0.00660622784758737805, //
0.01532170151293467612, //
0.02391554810174948035, //
0.03230035863232895328, //
0.04040154133166959156, //
0.04814774281871169567, //
0.05547084663166356128, //
0.06230648253031748003, //
0.06859457281865671280, //
0.07427985484395414934, //
0.07931236479488673836, //
0.08364787606703870761, //
0.08724828761884433760, //
0.09008195866063857723, //
0.09212398664331684621, //
0.09335642606559611616, //
0.09376844616020999656, //
0.09335642606559611616, //
0.09212398664331684621, //
0.09008195866063857723, //
0.08724828761884433760, //
0.08364787606703870761, //
0.07931236479488673836, //
0.07427985484395414934, //
0.06859457281865671280, //
0.06230648253031748003, //
0.05547084663166356128, //
0.04814774281871169567, //
0.04040154133166959156, //
0.03230035863232895328, //
0.02391554810174948035, //
0.01532170151293467612, //
0.00660622784758737805, //
};
};
template <>
struct gauss_data<34> {
static constexpr double X[] = {
-0.99757175379084191924, //
-0.98722781640630948504, //
-0.96870826253334428176, //
-0.94216239740510709163, //
-0.90780967771832446880, //
-0.86593463833456446926, //
-0.81688422790093366459, //
-0.76106487662987301418, //
-0.69893911321626290793, //
-0.63102172708052854531, //
-0.55787550066974664273, //
-0.48010654519032703419, //
-0.39835927775864594063, //
-0.31331108133946324745, //
-0.22566669161644948386, //
-0.13615235725918297589, //
-0.04550982195310254274, //
0.04550982195310254274, //
0.13615235725918297589, //
0.22566669161644948386, //
0.31331108133946324745, //
0.39835927775864594063, //
0.48010654519032703419, //
0.55787550066974664273, //
0.63102172708052854531, //
0.69893911321626290793, //
0.76106487662987301418, //
0.81688422790093366459, //
0.86593463833456446926, //
0.90780967771832446880, //
0.94216239740510709163, //
0.96870826253334428176, //
0.98722781640630948504, //
0.99757175379084191924, //
};
static constexpr double W[] = {
0.00622914055590868471, //
0.01445016274859503541, //
0.02256372198549497008, //
0.03049138063844613180, //
0.03816659379638751632, //
0.04552561152335327245, //
0.05250741457267810616, //
0.05905413582752449319, //
0.06511152155407641137, //
0.07062937581425572499, //
0.07556197466003193127, //
0.07986844433977184473, //
0.08351309969984565518, //
0.08646573974703574978, //
0.08870189783569386928, //
0.09020304437064072957, //
0.09095674033025987361, //
0.09095674033025987361, //
0.09020304437064072957, //
0.08870189783569386928, //
0.08646573974703574978, //
0.08351309969984565518, //
0.07986844433977184473, //
0.07556197466003193127, //
0.07062937581425572499, //
0.06511152155407641137, //
0.05905413582752449319, //
0.05250741457267810616, //
0.04552561152335327245, //
0.03816659379638751632, //
0.03049138063844613180, //
0.02256372198549497008, //
0.01445016274859503541, //
0.00622914055590868471, //
};
};
template <>
struct gauss_data<35> {
static constexpr double X[] = {
-0.99770656909960029726, //
-0.98793576444385149803, //
-0.97043761603922983321, //
-0.94534514820782732953, //
-0.91285426135931761446, //
-0.87321912502522233152, //
-0.82674989909222540683, //
-0.77381025228691255526, //
-0.71481450155662878326, //
-0.65022436466589038867, //
-0.58054534474976450993, //
-0.50632277324148861502, //
-0.42813754151781425418, //
-0.34660155443081394587, //
-0.26235294120929605797, //
-0.17605106116598956997, //
-0.08837134327565926360, //
0, //
0.08837134327565926360, //
0.17605106116598956997, //
0.26235294120929605797, //
0.34660155443081394587, //
0.42813754151781425418, //
0.50632277324148861502, //
0.58054534474976450993, //
0.65022436466589038867, //
0.71481450155662878326, //
0.77381025228691255526, //
0.82674989909222540683, //
0.87321912502522233152, //
0.91285426135931761446, //
0.94534514820782732953, //
0.97043761603922983321, //
0.98793576444385149803, //
0.99770656909960029726, //
};
static constexpr double W[] = {
0.00588343342044308497, //
0.01365082834836149226, //
0.02132297991148358088, //
0.02882926010889425404, //
0.03611011586346338053, //
0.04310842232617021878, //
0.04976937040135352980, //
0.05604081621237012857, //
0.06187367196608018888, //
0.06722228526908690396, //
0.07204479477256006466, //
0.07630345715544205353, //
0.07996494224232426293, //
0.08300059372885658837, //
0.08538665339209912522, //
0.08710444699718353424, //
0.08814053043027546297, //
0.08848679490710429063, //
0.08814053043027546297, //
0.08710444699718353424, //
0.08538665339209912522, //
0.08300059372885658837, //
0.07996494224232426293, //
0.07630345715544205353, //
0.07204479477256006466, //
0.06722228526908690396, //
0.06187367196608018888, //
0.05604081621237012857, //
0.04976937040135352980, //
0.04310842232617021878, //
0.03611011586346338053, //
0.02882926010889425404, //
0.02132297991148358088, //
0.01365082834836149226, //
0.00588343342044308497, //
};
};
template <>
struct gauss_data<36> {
static constexpr double X[] = {
-0.99783046248408583619, //
-0.98858647890221223807, //
-0.97202769104969794933, //
-0.94827298439950754520, //
-0.91749777451565906607, //
-0.87992980089039713198, //
-0.83584716699247530641, //
-0.78557623013220651282, //
-0.72948917159355658209, //
-0.66800123658552106209, //
-0.60156765813598053507, //
-0.53068028592624516164, //
-0.45586394443342026720, //
-0.37767254711968921632, //
-0.29668499534402827050, //
-0.21350089231686557894, //
-0.12873610380938478865, //
-0.04301819847370860722, //
0.04301819847370860722, //
0.12873610380938478865, //
0.21350089231686557894, //
0.29668499534402827050, //
0.37767254711968921632, //
0.45586394443342026720, //
0.53068028592624516164, //
0.60156765813598053507, //
0.66800123658552106209, //
0.72948917159355658209, //
0.78557623013220651282, //
0.83584716699247530641, //
0.87992980089039713198, //
0.91749777451565906607, //
0.94827298439950754520, //
0.97202769104969794933, //
0.98858647890221223807, //
0.99783046248408583619, //
};
static constexpr double W[] = {
0.00556571966424504536, //
0.01291594728406557440, //
0.02018151529773547153, //
0.02729862149856877909, //
0.03421381077030722992, //
0.04087575092364489547, //
0.04723508349026597841, //
0.05324471397775991909, //
0.05886014424532481730, //
0.06403979735501548955, //
0.06874532383573644261, //
0.07294188500565306135, //
0.07659841064587067452, //
0.07968782891207160190, //
0.08218726670433970951, //
0.08407821897966193493, //
0.08534668573933862749, //
0.08598327567039474749, //
0.08598327567039474749, //
0.08534668573933862749, //
0.08407821897966193493, //
0.08218726670433970951, //
0.07968782891207160190, //
0.07659841064587067452, //
0.07294188500565306135, //
0.06874532383573644261, //
0.06403979735501548955, //
0.05886014424532481730, //
0.05324471397775991909, //
0.04723508349026597841, //
0.04087575092364489547, //
0.03421381077030722992, //
0.02729862149856877909, //
0.02018151529773547153, //
0.01291594728406557440, //
0.00556571966424504536, //
};
};
template <>
struct gauss_data<37> {
static constexpr double X[] = {
-0.99794458247791364894, //
-0.98918596321431918668, //
-0.97349303005648574432, //
-0.95097234326209482132, //
-0.92178143741246374266, //
-0.88612496215548607894, //
-0.84425298734055596798, //
-0.79645920050990229339, //
-0.74307883398196526254, //
-0.68448630913095935744, //
-0.62109260840892448314, //
-0.55334239186158178123, //
-0.48171087780320555414, //
-0.40670050931832611010, //
-0.32883742988370699949, //
-0.24866779279136575880, //
-0.16675393023985197696, //
-0.08367040895476990194, //
0, //
0.08367040895476990194, //
0.16675393023985197696, //
0.24866779279136575880, //
0.32883742988370699949, //
0.40670050931832611010, //
0.48171087780320555414, //
0.55334239186158178123, //
0.62109260840892448314, //
0.68448630913095935744, //
0.74307883398196526254, //
0.79645920050990229339, //
0.84425298734055596798, //
0.88612496215548607894, //
0.92178143741246374266, //
0.95097234326209482132, //
0.97349303005648574432, //
0.98918596321431918668, //
0.99794458247791364894, //
};
static constexpr double W[] = {
0.00527305727949793935, //
0.01223878010030755652, //
0.01912904448908396604, //
0.02588603699055893352, //
0.03246163984752148106, //
0.03880960250193454448, //
0.04488536466243716665, //
0.05064629765482460160, //
0.05605198799827491780, //
0.06106451652322598613, //
0.06564872287275124948, //
0.06977245155570034488, //
0.07340677724848817272, //
0.07652620757052923788, //
0.07910886183752938076, //
0.08113662450846503050, //
0.08259527223643725089, //
0.08347457362586278725, //
0.08376836099313890479, //
0.08347457362586278725, //
0.08259527223643725089, //
0.08113662450846503050, //
0.07910886183752938076, //
0.07652620757052923788, //
0.07340677724848817272, //
0.06977245155570034488, //
0.06564872287275124948, //
0.06106451652322598613, //
0.05605198799827491780, //
0.05064629765482460160, //
0.04488536466243716665, //
0.03880960250193454448, //
0.03246163984752148106, //
0.02588603699055893352, //
0.01912904448908396604, //
0.01223878010030755652, //
0.00527305727949793935, //
};
};
template <>
struct gauss_data<38> {
static constexpr double X[] = {
-0.99804993053568761981, //
-0.98973945426638557194, //
-0.97484632859015350764, //
-0.95346633093352959567, //
-0.92574133204858439682, //
-0.89185573900463221679, //
-0.85203502193236218885, //
-0.80654416760531681555, //
-0.75568590375397068073, //
-0.69979868037918435591, //
-0.63925441582968170718, //
-0.57445602104780708113, //
-0.50583471792793110324, //
-0.43384716943237648437, //
-0.35897244047943501325, //
-0.28170880979016526136, //
-0.20257045389211670320, //
-0.12208402533786741986, //
-0.04078514790457823991, //
0.04078514790457823991, //
0.12208402533786741986, //
0.20257045389211670320, //
0.28170880979016526136, //
0.35897244047943501325, //
0.43384716943237648437, //
0.50583471792793110324, //
0.57445602104780708113, //
0.63925441582968170718, //
0.69979868037918435591, //
0.75568590375397068073, //
0.80654416760531681555, //
0.85203502193236218885, //
0.89185573900463221679, //
0.92574133204858439682, //
0.95346633093352959567, //
0.97484632859015350764, //
0.98973945426638557194, //
0.99804993053568761981, //
};
static constexpr double W[] = {
0.00500288074963934567, //
0.01161344471646867417, //
0.01815657770961323689, //
0.02457973973823237589, //
0.03083950054517505465, //
0.03689408159402473816, //
0.04270315850467443423, //
0.04822806186075868337, //
0.05343201991033231997, //
0.05828039914699720602, //
0.06274093339213305405, //
0.06678393797914041193, //
0.07038250706689895473, //
0.07351269258474345714, //
0.07615366354844639606, //
0.07828784465821094807, //
0.07990103324352782158, //
0.08098249377059710062, //
0.08152502928038578669, //
0.08152502928038578669, //
0.08098249377059710062, //
0.07990103324352782158, //
0.07828784465821094807, //
0.07615366354844639606, //
0.07351269258474345714, //
0.07038250706689895473, //
0.06678393797914041193, //
0.06274093339213305405, //
0.05828039914699720602, //
0.05343201991033231997, //
0.04822806186075868337, //
0.04270315850467443423, //
0.03689408159402473816, //
0.03083950054517505465, //
0.02457973973823237589, //
0.01815657770961323689, //
0.01161344471646867417, //
0.00500288074963934567, //
};
};
template <>
struct gauss_data<39> {
static constexpr double X[] = {
-0.99814738306643290600, //
-0.99025153685468598363, //
-0.97609870933347105384, //
-0.95577521232465227711, //
-0.92940914848673822969, //
-0.89716711929299288784, //
-0.85925293799990615391, //
-0.81590629743014310435, //
-0.76740124293106349983, //
-0.71404443589453467913, //
-0.65617321343201091073, //
-0.59415345495727798869, //
-0.52837726866043747389, //
-0.45926051230913604866, //
-0.38724016397156145585, //
-0.31277155924818592253, //
-0.23632551246183576733, //
-0.15838533999783779992, //
-0.07944380460875547758, //
0, //
0.07944380460875547758, //
0.15838533999783779992, //
0.23632551246183576733, //
0.31277155924818592253, //
0.38724016397156145585, //
0.45926051230913604866, //
0.52837726866043747389, //
0.59415345495727798869, //
0.65617321343201091073, //
0.71404443589453467913, //
0.76740124293106349983, //
0.81590629743014310435, //
0.85925293799990615391, //
0.89716711929299288784, //
0.92940914848673822969, //
0.95577521232465227711, //
0.97609870933347105384, //
0.99025153685468598363, //
0.99814738306643290600, //
};
static constexpr double W[] = {
0.00475294469163510137, //
0.01103478893916459424, //
0.01725622909372491904, //
0.02336938483217816459, //
0.02933495598390337859, //
0.03511511149813133076, //
0.04067327684793384393, //
0.04597430110891663188, //
0.05098466529212940521, //
0.05567269034091629990, //
0.06000873608859614957, //
0.06396538813868238898, //
0.06751763096623126536, //
0.07064300597060876077, //
0.07332175341426861738, //
0.07553693732283605770, //
0.07727455254468201672, //
0.07852361328737117672, //
0.07927622256836847101, //
0.07952762213944285241, //
0.07927622256836847101, //
0.07852361328737117672, //
0.07727455254468201672, //
0.07553693732283605770, //
0.07332175341426861738, //
0.07064300597060876077, //
0.06751763096623126536, //
0.06396538813868238898, //
0.06000873608859614957, //
0.05567269034091629990, //
0.05098466529212940521, //
0.04597430110891663188, //
0.04067327684793384393, //
0.03511511149813133076, //
0.02933495598390337859, //
0.02336938483217816459, //
0.01725622909372491904, //
0.01103478893916459424, //
0.00475294469163510137, //
};
};
template <>
struct gauss_data<40> {
static constexpr double X[] = {
-0.99823770971055920034, //
-0.99072623869945700645, //
-0.97725994998377426266, //
-0.95791681921379165580, //
-0.93281280827867653336, //
-0.90209880696887429672, //
-0.86595950321225950382, //
-0.82461223083331166319, //
-0.77830565142651938769, //
-0.72731825518992710328, //
-0.67195668461417954837, //
-0.61255388966798023795, //
-0.54946712509512820207, //
-0.48307580168617871290, //
-0.41377920437160500152, //
-0.34199409082575847300, //
-0.26815218500725368114, //
-0.19269758070137109971, //
-0.11608407067525520848, //
-0.03877241750605082193, //
0.03877241750605082193, //
0.11608407067525520848, //
0.19269758070137109971, //
0.26815218500725368114, //
0.34199409082575847300, //
0.41377920437160500152, //
0.48307580168617871290, //
0.54946712509512820207, //
0.61255388966798023795, //
0.67195668461417954837, //
0.72731825518992710328, //
0.77830565142651938769, //
0.82461223083331166319, //
0.86595950321225950382, //
0.90209880696887429672, //
0.93281280827867653336, //
0.95791681921379165580, //
0.97725994998377426266, //
0.99072623869945700645, //
0.99823770971055920034, //
};
static constexpr double W[] = {
0.00452127709853319125, //
0.01049828453115281361, //
0.01642105838190788871, //
0.02224584919416695726, //
0.02793700698002340109, //
0.03346019528254784739, //
0.03878216797447201763, //
0.04387090818567327199, //
0.04869580763507223206, //
0.05322784698393682435, //
0.05743976909939155136, //
0.06130624249292893916, //
0.06480401345660103807, //
0.06791204581523390382, //
0.07061164739128677969, //
0.07288658239580405906, //
0.07472316905796826420, //
0.07611036190062624237, //
0.07703981816424796558, //
0.07750594797842481126, //
0.07750594797842481126, //
0.07703981816424796558, //
0.07611036190062624237, //
0.07472316905796826420, //
0.07288658239580405906, //
0.07061164739128677969, //
0.06791204581523390382, //
0.06480401345660103807, //
0.06130624249292893916, //
0.05743976909939155136, //
0.05322784698393682435, //
0.04869580763507223206, //
0.04387090818567327199, //
0.03878216797447201763, //
0.03346019528254784739, //
0.02793700698002340109, //
0.02224584919416695726, //
0.01642105838190788871, //
0.01049828453115281361, //
0.00452127709853319125, //
};
};
template <>
struct gauss_data<41> {
static constexpr double X[] = {
-0.99832158857477144151, //
-0.99116710969901630825, //
-0.97833867356108338446, //
-0.95990689173034622609, //
-0.93597698749785382568, //
-0.90668594475810117295, //
-0.87220151169244140883, //
-0.83272120040136133124, //
-0.78847114504740937273, //
-0.73970480306992618106, //
-0.68670150203495128958, //
-0.62976483907219632048, //
-0.56922094161021586965, //
-0.50541659919940603270, //
-0.43871727705140708851, //
-0.36950502264048144142, //
-0.29817627734182486592, //
-0.22513960563342277560, //
-0.15081335486399216357, //
-0.07562325898916299692, //
0, //
0.07562325898916299692, //
0.15081335486399216357, //
0.22513960563342277560, //
0.29817627734182486592, //
0.36950502264048144142, //
0.43871727705140708851, //
0.50541659919940603270, //
0.56922094161021586965, //
0.62976483907219632048, //
0.68670150203495128958, //
0.73970480306992618106, //
0.78847114504740937273, //
0.83272120040136133124, //
0.87220151169244140883, //
0.90668594475810117295, //
0.93597698749785382568, //
0.95990689173034622609, //
0.97833867356108338446, //
0.99116710969901630825, //
0.99832158857477144151, //
};
static constexpr double W[] = {
0.00430614035816488768, //
0.00999993877390594533, //
0.01564493840781858853, //
0.02120106336877955307, //
0.02663589920711044546, //
0.03191821173169928178, //
0.03701771670350798843, //
0.04190519519590968942, //
0.04655264836901434206, //
0.05093345429461749478, //
0.05502251924257874188, //
0.05879642094987194499, //
0.06223354258096631647, //
0.06531419645352741043, //
0.06802073676087676673, //
0.07033766062081749748, //
0.07225169686102307339, //
0.07375188202722346993, //
0.07482962317622155189, //
0.07547874709271582402, //
0.07569553564729837231, //
0.07547874709271582402, //
0.07482962317622155189, //
0.07375188202722346993, //
0.07225169686102307339, //
0.07033766062081749748, //
0.06802073676087676673, //
0.06531419645352741043, //
0.06223354258096631647, //
0.05879642094987194499, //
0.05502251924257874188, //
0.05093345429461749478, //
0.04655264836901434206, //
0.04190519519590968942, //
0.03701771670350798843, //
0.03191821173169928178, //
0.02663589920711044546, //
0.02120106336877955307, //
0.01564493840781858853, //
0.00999993877390594533, //
0.00430614035816488768, //
};
};
template <>
struct gauss_data<42> {
static constexpr double X[] = {
-0.99839961899006241502, //
-0.99157728834086091979, //
-0.97934250806374819370, //
-0.96175936533820448874, //
-0.93892355735498817853, //
-0.91095972490412745258, //
-0.87802056981217274271, //
-0.84028598326181690092, //
-0.79796205325548741323, //
-0.75127993568948048956, //
-0.70049459055617121374, //
-0.64588338886924783395, //
-0.58774459748510932284, //
-0.52639574993119228759, //
-0.46217191207042192975, //
-0.39542385204297505767, //
-0.32651612446541151219, //
-0.25582507934287908396, //
-0.18373680656485455085, //
-0.11064502720851986834, //
-0.03694894316535177581, //
0.03694894316535177581, //
0.11064502720851986834, //
0.18373680656485455085, //
0.25582507934287908396, //
0.32651612446541151219, //
0.39542385204297505767, //
0.46217191207042192975, //
0.52639574993119228759, //
0.58774459748510932284, //
0.64588338886924783395, //
0.70049459055617121374, //
0.75127993568948048956, //
0.79796205325548741323, //
0.84028598326181690092, //
0.87802056981217274271, //
0.91095972490412745258, //
0.93892355735498817853, //
0.96175936533820448874, //
0.97934250806374819370, //
0.99157728834086091979, //
0.99839961899006241502, //
};
static constexpr double W[] = {
0.00410599860464908461, //
0.00953622030174850241, //
0.01492244369735749414, //
0.02022786956905264475, //
0.02542295952611304788, //
0.03047924069960346836, //
0.03536907109759211083, //
0.04006573518069226176, //
0.04454357777196587787, //
0.04877814079280324502, //
0.05274629569917407034, //
0.05642636935801838164, //
0.05979826222758665431, //
0.06284355804500257640, //
0.06554562436490897892, //
0.06788970337652194485, //
0.06986299249259415976, //
0.07145471426517098292, //
0.07265617524380410488, //
0.07346081345346752826, //
0.07386423423217287999, //
0.07386423423217287999, //
0.07346081345346752826, //
0.07265617524380410488, //
0.07145471426517098292, //
0.06986299249259415976, //
0.06788970337652194485, //
0.06554562436490897892, //
0.06284355804500257640, //
0.05979826222758665431, //
0.05642636935801838164, //
0.05274629569917407034, //
0.04877814079280324502, //
0.04454357777196587787, //
0.04006573518069226176, //
0.03536907109759211083, //
0.03047924069960346836, //
0.02542295952611304788, //
0.02022786956905264475, //
0.01492244369735749414, //
0.00953622030174850241, //
0.00410599860464908461, //
};
};
template <>
struct gauss_data<43> {
static constexpr double X[] = {
-0.99847233224250771351, //
-0.99195955759324414642, //
-0.98027822098025533150, //
-0.96348661301407999341, //
-0.94167195684763786181, //
-0.91494790720613872945, //
-0.88345376521861686333, //
-0.84735371620931504899, //
-0.80683596413693863527, //
-0.76211174719495512146, //
-0.71341423526895705485, //
-0.66099731375149813316, //
-0.60513425963960093572, //
-0.54611631666008471914, //
-0.48425117678573472406, //
-0.41986137602926925248, //
-0.35328261286430380664, //
-0.28486199803291362710, //
-0.21495624486051820901, //
-0.14392980951071331077, //
-0.07215299087458623542, //
0, //
0.07215299087458623542, //
0.14392980951071331077, //
0.21495624486051820901, //
0.28486199803291362710, //
0.35328261286430380664, //
0.41986137602926925248, //
0.48425117678573472406, //
0.54611631666008471914, //
0.60513425963960093572, //
0.66099731375149813316, //
0.71341423526895705485, //
0.76211174719495512146, //
0.80683596413693863527, //
0.84735371620931504899, //
0.88345376521861686333, //
0.91494790720613872945, //
0.94167195684763786181, //
0.96348661301407999341, //
0.98027822098025533150, //
0.99195955759324414642, //
0.99847233224250771351, //
};
static constexpr double W[] = {
0.00391949025384412728, //
0.00910399663740140331, //
0.01424875643157648610, //
0.01931990142368390039, //
0.02429045661383881590, //
0.02913441326149849491, //
0.03382649208686029234, //
0.03834222219413265757, //
0.04265805719798208376, //
0.04675149475434658001, //
0.05060119278439015652, //
0.05418708031888178686, //
0.05749046195691051942, //
0.06049411524999129451, //
0.06318238044939611232, //
0.06554124212632279749, //
0.06755840222936516919, //
0.06922334419365668428, //
0.07052738776508502812, //
0.07146373425251414129, //
0.07202750197142197434, //
0.07221575169379898797, //
0.07202750197142197434, //
0.07146373425251414129, //
0.07052738776508502812, //
0.06922334419365668428, //
0.06755840222936516919, //
0.06554124212632279749, //
0.06318238044939611232, //
0.06049411524999129451, //
0.05749046195691051942, //
0.05418708031888178686, //
0.05060119278439015652, //
0.04675149475434658001, //
0.04265805719798208376, //
0.03834222219413265757, //
0.03382649208686029234, //
0.02913441326149849491, //
0.02429045661383881590, //
0.01931990142368390039, //
0.01424875643157648610, //
0.00910399663740140331, //
0.00391949025384412728, //
};
};
template <>
struct gauss_data<44> {
static constexpr double X[] = {
-0.99854020063677422493, //
-0.99231639213851580848, //
-0.98115183307791396666, //
-0.96509965042249313939, //
-0.94423950911819409920, //
-0.91867525998417577432, //
-0.88853423828604320233, //
-0.85396659500471037872, //
-0.81514453964513501048, //
-0.77226147924875589901, //
-0.72553105366071700260, //
-0.67518607066612236533, //
-0.62147734590357584780, //
-0.56467245318547076842, //
-0.50505439138820231798, //
-0.44292017452541148383, //
-0.37857935201470713251, //
-0.31235246650278581223, //
-0.24456945692820125150, //
-0.17556801477551678574, //
-0.10569190170865324711, //
-0.03528923696413535905, //
0.03528923696413535905, //
0.10569190170865324711, //
0.17556801477551678574, //
0.24456945692820125150, //
0.31235246650278581223, //
0.37857935201470713251, //
0.44292017452541148383, //
0.50505439138820231798, //
0.56467245318547076842, //
0.62147734590357584780, //
0.67518607066612236533, //
0.72553105366071700260, //
0.77226147924875589901, //
0.81514453964513501048, //
0.85396659500471037872, //
0.88853423828604320233, //
0.91867525998417577432, //
0.94423950911819409920, //
0.96509965042249313939, //
0.98115183307791396666, //
0.99231639213851580848, //
0.99854020063677422493, //
};
static constexpr double W[] = {
0.00374540480311277751, //
0.00870048136752484412, //
0.01361958675557998552, //
0.01847148173681474917, //
0.02323148190201921062, //
0.02787578282128101008, //
0.03238122281206982088, //
0.03672534781380887364, //
0.04088651231034621890, //
0.04484398408197003144, //
0.04857804644835203752, //
0.05207009609170446188, //
0.05530273556372805254, //
0.05825985987759549533, //
0.06092673670156196803, //
0.06329007973320385495, //
0.06533811487918143498, //
0.06706063890629365239, //
0.06844907026936666098, //
0.06949649186157257803, //
0.07019768547355821258, //
0.07054915778935406881, //
0.07054915778935406881, //
0.07019768547355821258, //
0.06949649186157257803, //
0.06844907026936666098, //
0.06706063890629365239, //
0.06533811487918143498, //
0.06329007973320385495, //
0.06092673670156196803, //
0.05825985987759549533, //
0.05530273556372805254, //
0.05207009609170446188, //
0.04857804644835203752, //
0.04484398408197003144, //
0.04088651231034621890, //
0.03672534781380887364, //
0.03238122281206982088, //
0.02787578282128101008, //
0.02323148190201921062, //
0.01847148173681474917, //
0.01361958675557998552, //
0.00870048136752484412, //
0.00374540480311277751, //
};
};
template <>
struct gauss_data<45> {
static constexpr double X[] = {
-0.99860364518193663815, //
-0.99264999844720374174, //
-0.98196871503454056823, //
-0.96660831039689460473, //
-0.94664169099562906178, //
-0.92216393671900038809, //
-0.89329167175324173846, //
-0.86016247596066422533, //
-0.82293422050208633703, //
-0.78178431259390629131, //
-0.73690884894549035262, //
-0.68852168077120052523, //
-0.63685339445322335927, //
-0.58215021256935318668, //
-0.52467282046291606709, //
-0.46469512391963509857, //
-0.40250294385854191407, //
-0.33839265425060216164, //
-0.27266976975237756060, //
-0.20564748978326374571, //
-0.13764520598325302875, //
-0.06898698016314417249, //
0, //
0.06898698016314417249, //
0.13764520598325302875, //
0.20564748978326374571, //
0.27266976975237756060, //
0.33839265425060216164, //
0.40250294385854191407, //
0.46469512391963509857, //
0.52467282046291606709, //
0.58215021256935318668, //
0.63685339445322335927, //
0.68852168077120052523, //
0.73690884894549035262, //
0.78178431259390629131, //
0.82293422050208633703, //
0.86016247596066422533, //
0.89329167175324173846, //
0.92216393671900038809, //
0.94664169099562906178, //
0.96660831039689460473, //
0.98196871503454056823, //
0.99264999844720374174, //
0.99860364518193663815, //
};
static constexpr double W[] = {
0.00358266315528355893, //
0.00832318929621824164, //
0.01303110499158278432, //
0.01767753525793759061, //
0.02223984755057873239, //
0.02669621396757766480, //
0.03102537493451546716, //
0.03520669220160901624, //
0.03922023672930244756, //
0.04304688070916497115, //
0.04666838771837336526, //
0.05006749923795202979, //
0.05322801673126895194, //
0.05613487875978647664, //
0.05877423271884173857, //
0.06113350083106652250, //
0.06320144007381993774, //
0.06496819575072343085, //
0.06642534844984252808, //
0.06756595416360753627, //
0.06838457737866967453, //
0.06887731697766132288, //
0.06904182482923202011, //
0.06887731697766132288, //
0.06838457737866967453, //
0.06756595416360753627, //
0.06642534844984252808, //
0.06496819575072343085, //
0.06320144007381993774, //
0.06113350083106652250, //
0.05877423271884173857, //
0.05613487875978647664, //
0.05322801673126895194, //
0.05006749923795202979, //
0.04666838771837336526, //
0.04304688070916497115, //
0.03922023672930244756, //
0.03520669220160901624, //
0.03102537493451546716, //
0.02669621396757766480, //
0.02223984755057873239, //
0.01767753525793759061, //
0.01303110499158278432, //
0.00832318929621824164, //
0.00358266315528355893, //
};
};
template <>
struct gauss_data<46> {
static constexpr double X[] = {
-0.99866304213381798112, //
-0.99296234890617436407, //
-0.98273366980416686347, //
-0.96802139185399194273, //
-0.94889236344608979562, //
-0.92543379880675395097, //
-0.89775271153394196570, //
-0.86597539486685806291, //
-0.83024683706606605303, //
-0.79073005707527425518, //
-0.74760535961566605400, //
-0.70106951202040569751, //
-0.65133484620199771510, //
-0.59862828971271515317, //
-0.54319033026180263527, //
-0.48527391838816466277, //
-0.42514331328282839732, //
-0.36307287702099571012, //
-0.29934582270187001548, //
-0.23425292220626976862, //
-0.16809117946710352860, //
-0.10116247530558423951, //
-0.03377219001605204151, //
0.03377219001605204151, //
0.10116247530558423951, //
0.16809117946710352860, //
0.23425292220626976862, //
0.29934582270187001548, //
0.36307287702099571012, //
0.42514331328282839732, //
0.48527391838816466277, //
0.54319033026180263527, //
0.59862828971271515317, //
0.65133484620199771510, //
0.70106951202040569751, //
0.74760535961566605400, //
0.79073005707527425518, //
0.83024683706606605303, //
0.86597539486685806291, //
0.89775271153394196570, //
0.92543379880675395097, //
0.94889236344608979562, //
0.96802139185399194273, //
0.98273366980416686347, //
0.99296234890617436407, //
0.99866304213381798112, //
};
static constexpr double W[] = {
0.00343030086810704828, //
0.00796989822972462245, //
0.01247988377098868420, //
0.01693351400783623804, //
0.02130999875413650105, //
0.02558928639713001063, //
0.02975182955220275579, //
0.03377862799910689652, //
0.03765130535738607132, //
0.04135219010967872970, //
0.04486439527731812676, //
0.04817189510171220053, //
0.05125959800714302133, //
0.05411341538585675449, //
0.05672032584399123581, //
0.05906843459554631480, //
0.06114702772465048101, //
0.06294662106439450817, //
0.06445900346713906958, //
0.06567727426778120737, //
0.06659587476845488737, //
0.06721061360067817586, //
0.06751868584903645882, //
0.06751868584903645882, //
0.06721061360067817586, //
0.06659587476845488737, //
0.06567727426778120737, //
0.06445900346713906958, //
0.06294662106439450817, //
0.06114702772465048101, //
0.05906843459554631480, //
0.05672032584399123581, //
0.05411341538585675449, //
0.05125959800714302133, //
0.04817189510171220053, //
0.04486439527731812676, //
0.04135219010967872970, //
0.03765130535738607132, //
0.03377862799910689652, //
0.02975182955220275579, //
0.02558928639713001063, //
0.02130999875413650105, //
0.01693351400783623804, //
0.01247988377098868420, //
0.00796989822972462245, //
0.00343030086810704828, //
};
};
template <>
struct gauss_data<47> {
static constexpr double X[] = {
-0.99871872858421210918, //
-0.99325521098776863469, //
-0.98345100307162370876, //
-0.96934678732656449714, //
-0.95100396925770844258, //
-0.92850269301236064819, //
-0.90194132943852535686, //
-0.87143601579689631694, //
-0.83712013989990212127, //
-0.79914375416774194291, //
-0.75767291844543863357, //
-0.71288897340906430166, //
-0.66498774739033272913, //
-0.61417869995637360859, //
-0.56068400593466419448, //
-0.50473758386357791977, //
-0.44658407310485570272, //
-0.38647776408466713958, //
-0.32468148633773590221, //
-0.26146545921497457030, //
-0.19710611027911180796, //
-0.13188486655451489705, //
-0.06608692391635567516, //
0, //
0.06608692391635567516, //
0.13188486655451489705, //
0.19710611027911180796, //
0.26146545921497457030, //
0.32468148633773590221, //
0.38647776408466713958, //
0.44658407310485570272, //
0.50473758386357791977, //
0.56068400593466419448, //
0.61417869995637360859, //
0.66498774739033272913, //
0.71288897340906430166, //
0.75767291844543863357, //
0.79914375416774194291, //
0.83712013989990212127, //
0.87143601579689631694, //
0.90194132943852535686, //
0.92850269301236064819, //
0.95100396925770844258, //
0.96934678732656449714, //
0.98345100307162370876, //
0.99325521098776863469, //
0.99871872858421210918, //
};
static constexpr double W[] = {
0.00328745384252801488, //
0.00763861629584883361, //
0.01196284846431232096, //
0.01623533314643305967, //
0.02043693814766842764, //
0.02454921165965881853, //
0.02855415070064338650, //
0.03243423551518475676, //
0.03617249658417495161, //
0.03975258612253100378, //
0.04315884864847953826, //
0.04637638908650591120, //
0.04939113774736116960, //
0.05218991178005714487, //
0.05476047278153022595, //
0.05709158029323154022, //
0.05917304094233887597, //
0.06099575300873964533, //
0.06255174622092166264, //
0.06383421660571703063, //
0.06483755623894572670, //
0.06555737776654974025, //
0.06599053358881047453, //
0.06613512962365547965, //
0.06599053358881047453, //
0.06555737776654974025, //
0.06483755623894572670, //
0.06383421660571703063, //
0.06255174622092166264, //
0.06099575300873964533, //
0.05917304094233887597, //
0.05709158029323154022, //
0.05476047278153022595, //
0.05218991178005714487, //
0.04939113774736116960, //
0.04637638908650591120, //
0.04315884864847953826, //
0.03975258612253100378, //
0.03617249658417495161, //
0.03243423551518475676, //
0.02855415070064338650, //
0.02454921165965881853, //
0.02043693814766842764, //
0.01623533314643305967, //
0.01196284846431232096, //
0.00763861629584883361, //
0.00328745384252801488, //
};
};
template <>
struct gauss_data<48> {
static constexpr double X[] = {
-0.99877100725242611860, //
-0.99353017226635075754, //
-0.98412458372282685774, //
-0.97059159254624725046, //
-0.95298770316043086072, //
-0.93138669070655433311, //
-0.90587913671556967282, //
-0.87657202027424788590, //
-0.84358826162439353071, //
-0.80706620402944262708, //
-0.76715903251574033925, //
-0.72403413092381465467, //
-0.67787237963266390521, //
-0.62886739677651362399, //
-0.57722472608397270381, //
-0.52316097472223303367, //
-0.46690290475095840454, //
-0.40868648199071672991, //
-0.34875588629216073815, //
-0.28736248735545557673, //
-0.22476379039468906122, //
-0.16122235606889171805, //
-0.09700469920946269893, //
-0.03238017096286936203, //
0.03238017096286936203, //
0.09700469920946269893, //
0.16122235606889171805, //
0.22476379039468906122, //
0.28736248735545557673, //
0.34875588629216073815, //
0.40868648199071672991, //
0.46690290475095840454, //
0.52316097472223303367, //
0.57722472608397270381, //
0.62886739677651362399, //
0.67787237963266390521, //
0.72403413092381465467, //
0.76715903251574033925, //
0.80706620402944262708, //
0.84358826162439353071, //
0.87657202027424788590, //
0.90587913671556967282, //
0.93138669070655433311, //
0.95298770316043086072, //
0.97059159254624725046, //
0.98412458372282685774, //
0.99353017226635075754, //
0.99877100725242611860, //
};
static constexpr double W[] = {
0.00315334605230583863, //
0.00732755390127626210, //
0.01147723457923453948, //
0.01557931572294384872, //
0.01961616045735552781, //
0.02357076083932437914, //
0.02742650970835694820, //
0.03116722783279808890, //
0.03477722256477043889, //
0.03824135106583070631, //
0.04154508294346474921, //
0.04467456085669428041, //
0.04761665849249047482, //
0.05035903555385447495, //
0.05289018948519366709, //
0.05519950369998416286, //
0.05727729210040321570, //
0.05911483969839563574, //
0.06070443916589388005, //
0.06203942315989266390, //
0.06311419228625402565, //
0.06392423858464818662, //
0.06446616443595008220, //
0.06473769681268392250, //
0.06473769681268392250, //
0.06446616443595008220, //
0.06392423858464818662, //
0.06311419228625402565, //
0.06203942315989266390, //
0.06070443916589388005, //
0.05911483969839563574, //
0.05727729210040321570, //
0.05519950369998416286, //
0.05289018948519366709, //
0.05035903555385447495, //
0.04761665849249047482, //
0.04467456085669428041, //
0.04154508294346474921, //
0.03824135106583070631, //
0.03477722256477043889, //
0.03116722783279808890, //
0.02742650970835694820, //
0.02357076083932437914, //
0.01961616045735552781, //
0.01557931572294384872, //
0.01147723457923453948, //
0.00732755390127626210, //
0.00315334605230583863, //
};
};
template <>
struct gauss_data<49> {
static constexpr double X[] = {
-0.99882015060663537936, //
-0.99378866194416779076, //
-0.98475789591421300435, //
-0.97176220090155538013, //
-0.95485365867413723355, //
-0.93410029475581014905, //
-0.90958565582807328521, //
-0.88140844557300891003, //
-0.84968211984416570103, //
-0.81453442735985543153, //
-0.77610689434544663501, //
-0.73455425423740269621, //
-0.69004382442513211350, //
-0.64275483241923766405, //
-0.59287769410890071245, //
-0.54061324699172606655, //
-0.48617194145249204217, //
-0.42977299334157652465, //
-0.37164350126228488886, //
-0.31201753211974876220, //
-0.25113517861257727350, //
-0.18924159246181358648, //
-0.12658599726967205106, //
-0.06342068498268678602, //
0, //
0.06342068498268678602, //
0.12658599726967205106, //
0.18924159246181358648, //
0.25113517861257727350, //
0.31201753211974876220, //
0.37164350126228488886, //
0.42977299334157652465, //
0.48617194145249204217, //
0.54061324699172606655, //
0.59287769410890071245, //
0.64275483241923766405, //
0.69004382442513211350, //
0.73455425423740269621, //
0.77610689434544663501, //
0.81453442735985543153, //
0.84968211984416570103, //
0.88140844557300891003, //
0.90958565582807328521, //
0.93410029475581014905, //
0.95485365867413723355, //
0.97176220090155538013, //
0.98475789591421300435, //
0.99378866194416779076, //
0.99882015060663537936, //
};
static constexpr double W[] = {
0.00302727898892290507, //
0.00703509959008645147, //
0.01102055103159358049, //
0.01496214493562465102, //
0.01884359585308945844, //
0.02264920158744667649, //
0.02636361892706601696, //
0.02997188462058382535, //
0.03345946679162217434, //
0.03681232096300068981, //
0.04001694576637302136, //
0.04306043698125959798, //
0.04593053935559585354, //
0.04861569588782824027, //
0.05110509433014459067, //
0.05338871070825896852, //
0.05545734967480358869, //
0.05730268153018747548, //
0.05891727576002726602, //
0.06029463095315201730, //
0.06142920097919293629, //
0.06231641732005726740, //
0.06295270746519569947, //
0.06333550929649174859, //
0.06346328140479059771, //
0.06333550929649174859, //
0.06295270746519569947, //
0.06231641732005726740, //
0.06142920097919293629, //
0.06029463095315201730, //
0.05891727576002726602, //
0.05730268153018747548, //
0.05545734967480358869, //
0.05338871070825896852, //
0.05110509433014459067, //
0.04861569588782824027, //
0.04593053935559585354, //
0.04306043698125959798, //
0.04001694576637302136, //
0.03681232096300068981, //
0.03345946679162217434, //
0.02997188462058382535, //
0.02636361892706601696, //
0.02264920158744667649, //
0.01884359585308945844, //
0.01496214493562465102, //
0.01102055103159358049, //
0.00703509959008645147, //
0.00302727898892290507, //
};
};
template <>
struct gauss_data<50> {
static constexpr double X[] = {
-0.99886640442007105018, //
-0.99403196943209071258, //
-0.98535408404800588230, //
-0.97286438510669207371, //
-0.95661095524280794299, //
-0.93665661894487793378, //
-0.91307855665579189308, //
-0.88596797952361304863, //
-0.85542976942994608461, //
-0.82158207085933594835, //
-0.78455583290039926390, //
-0.74449430222606853826, //
-0.70155246870682225108, //
-0.65589646568543936078, //
-0.60770292718495023918, //
-0.55715830451465005431, //
-0.50445814490746420165, //
-0.44980633497403878914, //
-0.39341431189756512739, //
-0.33550024541943735683, //
-0.27628819377953199032, //
-0.21600723687604175684, //
-0.15489058999814590207, //
-0.09317470156008614085, //
-0.03109833832718887611, //
0.03109833832718887611, //
0.09317470156008614085, //
0.15489058999814590207, //
0.21600723687604175684, //
0.27628819377953199032, //
0.33550024541943735683, //
0.39341431189756512739, //
0.44980633497403878914, //
0.50445814490746420165, //
0.55715830451465005431, //
0.60770292718495023918, //
0.65589646568543936078, //
0.70155246870682225108, //
0.74449430222606853826, //
0.78455583290039926390, //
0.82158207085933594835, //
0.85542976942994608461, //
0.88596797952361304863, //
0.91307855665579189308, //
0.93665661894487793378, //
0.95661095524280794299, //
0.97286438510669207371, //
0.98535408404800588230, //
0.99403196943209071258, //
0.99886640442007105018, //
};
static constexpr double W[] = {
0.00290862255315514095, //
0.00675979919574540150, //
0.01059054838365096926, //
0.01438082276148557441, //
0.01811556071348939035, //
0.02178024317012479298, //
0.02536067357001239044, //
0.02884299358053519802, //
0.03221372822357801664, //
0.03545983561514615416, //
0.03856875661258767524, //
0.04152846309014769742, //
0.04432750433880327549, //
0.04695505130394843296, //
0.04940093844946631492, //
0.05165570306958113848, //
0.05371062188899624652, //
0.05555774480621251762, //
0.05718992564772838372, //
0.05860084981322244583, //
0.05978505870426545750, //
0.06073797084177021603, //
0.06145589959031666375, //
0.06193606742068324338, //
0.06217661665534726232, //
0.06217661665534726232, //
0.06193606742068324338, //
0.06145589959031666375, //
0.06073797084177021603, //
0.05978505870426545750, //
0.05860084981322244583, //
0.05718992564772838372, //
0.05555774480621251762, //
0.05371062188899624652, //
0.05165570306958113848, //
0.04940093844946631492, //
0.04695505130394843296, //
0.04432750433880327549, //
0.04152846309014769742, //
0.03856875661258767524, //
0.03545983561514615416, //
0.03221372822357801664, //
0.02884299358053519802, //
0.02536067357001239044, //
0.02178024317012479298, //
0.01811556071348939035, //
0.01438082276148557441, //
0.01059054838365096926, //
0.00675979919574540150, //
0.00290862255315514095, //
};
};
template <>
struct gauss_data<51> {
static constexpr double X[] = {
-0.99890999084890349516, //
-0.99426126043675257462, //
-0.98591599173590299658, //
-0.97390336801932386723, //
-0.95826784861390819455, //
-0.93906754400296238343, //
-0.91637386230978023082, //
-0.89027121802952730327, //
-0.86085671118229237147, //
-0.82823976382306483285, //
-0.79254171209938120523, //
-0.75389535448537552576, //
-0.71244445757703664458, //
-0.66834322117537008686, //
-0.62175570460072327375, //
-0.57285521635130383652, //
-0.52182366936618584251, //
-0.46885090428604106361, //
-0.41413398322630387793, //
-0.35787645668840950977, //
-0.30028760633533193953, //
-0.24158166644779870384, //
-0.18197702695707754532, //
-0.12169542101888876696, //
-0.06096110015057872473, //
0, //
0.06096110015057872473, //
0.12169542101888876696, //
0.18197702695707754532, //
0.24158166644779870384, //
0.30028760633533193953, //
0.35787645668840950977, //
0.41413398322630387793, //
0.46885090428604106361, //
0.52182366936618584251, //
0.57285521635130383652, //
0.62175570460072327375, //
0.66834322117537008686, //
0.71244445757703664458, //
0.75389535448537552576, //
0.79254171209938120523, //
0.82823976382306483285, //
0.86085671118229237147, //
0.89027121802952730327, //
0.91637386230978023082, //
0.93906754400296238343, //
0.95826784861390819455, //
0.97390336801932386723, //
0.98591599173590299658, //
0.99426126043675257462, //
0.99890999084890349516, //
};
static constexpr double W[] = {
0.00279680717108989557, //
0.00650033778325260029, //
0.01018519129782172993, //
0.01383263400647782229, //
0.01742871472340105225, //
0.02095998840170321057, //
0.02441330057378143427, //
0.02777579859416247719, //
0.03103497129016000845, //
0.03417869320418833623, //
0.03719526892326029284, //
0.04007347628549645318, //
0.04280260799788008665, //
0.04537251140765006874, //
0.04777362624062310199, //
0.04999702015005740977, //
0.05203442193669708756, //
0.05387825231304556143, //
0.05552165209573869301, //
0.05695850772025866210, //
0.05818347398259214059, //
0.05919199392296154378, //
0.05998031577750325209, //
0.06054550693473779513, //
0.06088546484485634388, //
0.06099892484120588015, //
0.06088546484485634388, //
0.06054550693473779513, //
0.05998031577750325209, //
0.05919199392296154378, //
0.05818347398259214059, //
0.05695850772025866210, //
0.05552165209573869301, //
0.05387825231304556143, //
0.05203442193669708756, //
0.04999702015005740977, //
0.04777362624062310199, //
0.04537251140765006874, //
0.04280260799788008665, //
0.04007347628549645318, //
0.03719526892326029284, //
0.03417869320418833623, //
0.03103497129016000845, //
0.02777579859416247719, //
0.02441330057378143427, //
0.02095998840170321057, //
0.01742871472340105225, //
0.01383263400647782229, //
0.01018519129782172993, //
0.00650033778325260029, //
0.00279680717108989557, //
};
};
template <>
struct gauss_data<52> {
static constexpr double X[] = {
-0.99895111110395027809, //
-0.99447759092921602924, //
-0.98644619565154984064, //
-0.97488388422174450314, //
-0.95983182693308655253, //
-0.94134385364135905684, //
-0.91948612891642453989, //
-0.89433689053449532252, //
-0.86598616284606758524, //
-0.83453543232673453496, //
-0.80009728343046832433, //
-0.76279499519374496027, //
-0.72276209974998319367, //
-0.68014190422716770209, //
-0.63508697769524592429, //
-0.58775860497957906990, //
-0.53832620928582743837, //
-0.48696674569809607778, //
-0.43386406771876167030, //
-0.37920826911609366924, //
-0.32319500343480782550, //
-0.26602478360500182747, //
-0.20790226415636605968, //
-0.14903550860694918048, //
-0.08963524464890056548, //
-0.02991410979733876604, //
0.02991410979733876604, //
0.08963524464890056548, //
0.14903550860694918048, //
0.20790226415636605968, //
0.26602478360500182747, //
0.32319500343480782550, //
0.37920826911609366924, //
0.43386406771876167030, //
0.48696674569809607778, //
0.53832620928582743837, //
0.58775860497957906990, //
0.63508697769524592429, //
0.68014190422716770209, //
0.72276209974998319367, //
0.76279499519374496027, //
0.80009728343046832433, //
0.83453543232673453496, //
0.86598616284606758524, //
0.89433689053449532252, //
0.91948612891642453989, //
0.94134385364135905684, //
0.95983182693308655253, //
0.97488388422174450314, //
0.98644619565154984064, //
0.99447759092921602924, //
0.99895111110395027809, //
};
static constexpr double W[] = {
0.00269131695004711111, //
0.00625552396297327689, //
0.00980263457946275206, //
0.01331511498234096065, //
0.01678002339630073567, //
0.02018489150798079220, //
0.02351751355398446159, //
0.02676595374650401344, //
0.02991858114714394664, //
0.03296410908971879791, //
0.03589163483509723294, //
0.03869067831042397898, //
0.04135121950056027167, //
0.04386373425900040799, //
0.04621922837278479350, //
0.04840926974407489685, //
0.05042601856634237721, //
0.05226225538390699303, //
0.05391140693275726475, //
0.05536756966930265254, //
0.05662553090236859719, //
0.05768078745252682765, //
0.05852956177181386855, //
0.05916881546604297036, //
0.05959626017124815825, //
0.05981036574529186024, //
0.05981036574529186024, //
0.05959626017124815825, //
0.05916881546604297036, //
0.05852956177181386855, //
0.05768078745252682765, //
0.05662553090236859719, //
0.05536756966930265254, //
0.05391140693275726475, //
0.05226225538390699303, //
0.05042601856634237721, //
0.04840926974407489685, //
0.04621922837278479350, //
0.04386373425900040799, //
0.04135121950056027167, //
0.03869067831042397898, //
0.03589163483509723294, //
0.03296410908971879791, //
0.02991858114714394664, //
0.02676595374650401344, //
0.02351751355398446159, //
0.02018489150798079220, //
0.01678002339630073567, //
0.01331511498234096065, //
0.00980263457946275206, //
0.00625552396297327689, //
0.00269131695004711111, //
};
};
template <>
struct gauss_data<53> {
static constexpr double X[] = {
-0.99898994777632822712, //
-0.99468191930800707863, //
-0.98694703502337152172, //
-0.97581023371498458163, //
-0.96130969462313633236, //
-0.94349535346444187902, //
-0.92242860304281212826, //
-0.89818205787542662592, //
-0.87083929755824135160, //
-0.84049457654580137543, //
-0.80725249841689547822, //
-0.77122765492553230786, //
-0.73254423080751025378, //
-0.69133557560136672354, //
-0.64774374391651006875, //
-0.60191900571376932746, //
-0.55401932827706788101, //
-0.50420983165713343703, //
-0.45266221946184579138, //
-0.39955418695395297739, //
-0.34506880849572235669, //
-0.28939390645162620642, //
-0.23272140372427259364, //
-0.17524666215532575072, //
-0.11716780907195515014, //
-0.05868505430025946502, //
0, //
0.05868505430025946502, //
0.11716780907195515014, //
0.17524666215532575072, //
0.23272140372427259364, //
0.28939390645162620642, //
0.34506880849572235669, //
0.39955418695395297739, //
0.45266221946184579138, //
0.50420983165713343703, //
0.55401932827706788101, //
0.60191900571376932746, //
0.64774374391651006875, //
0.69133557560136672354, //
0.73254423080751025378, //
0.77122765492553230786, //
0.80725249841689547822, //
0.84049457654580137543, //
0.87083929755824135160, //
0.89818205787542662592, //
0.92242860304281212826, //
0.94349535346444187902, //
0.96130969462313633236, //
0.97581023371498458163, //
0.98694703502337152172, //
0.99468191930800707863, //
0.99898994777632822712, //
};
static constexpr double W[] = {
0.00259168372056703181, //
0.00602427622694867328, //
0.00944120228494034438, //
0.01282602614424037917, //
0.01616672525668746392, //
0.01945172110763689538, //
0.02266967305707020839, //
0.02580948251075751771, //
0.02886032361782373626, //
0.03181167845901932306, //
0.03465337258353423795, //
0.03737560980348291567, //
0.03996900584354038212, //
0.04242462063452001359, //
0.04473398910367281021, //
0.04688915034075031402, //
0.04888267503269914042, //
0.05070769106929271529, //
0.05235790722987271819, //
0.05382763486873102904, //
0.05511180752393359900, //
0.05620599838173970980, //
0.05710643553626719177, //
0.05781001499171319631, //
0.05831431136225600755, //
0.05861758623272026331, //
0.05871879415116436452, //
0.05861758623272026331, //
0.05831431136225600755, //
0.05781001499171319631, //
0.05710643553626719177, //
0.05620599838173970980, //
0.05511180752393359900, //
0.05382763486873102904, //
0.05235790722987271819, //
0.05070769106929271529, //
0.04888267503269914042, //
0.04688915034075031402, //
0.04473398910367281021, //
0.04242462063452001359, //
0.03996900584354038212, //
0.03737560980348291567, //
0.03465337258353423795, //
0.03181167845901932306, //
0.02886032361782373626, //
0.02580948251075751771, //
0.02266967305707020839, //
0.01945172110763689538, //
0.01616672525668746392, //
0.01282602614424037917, //
0.00944120228494034438, //
0.00602427622694867328, //
0.00259168372056703181, //
};
};
template <>
struct gauss_data<54> {
static constexpr double X[] = {
-0.99902666686734098385, //
-0.99487511701833888491, //
-0.98742063739734355855, //
-0.97668632885790323720, //
-0.96270764578592358325, //
-0.94553097516499585376, //
-0.92521335986665148625, //
-0.90182228628470158075, //
-0.87543545406556893941, //
-0.84614051597077294942, //
-0.81403478591356783546, //
-0.77922491534625402153, //
-0.74182653880918431628, //
-0.70196388971917291938, //
-0.65976938763198312469, //
-0.61538319833112737072, //
-0.56895276819520942973, //
-0.52063233438593307332, //
-0.47058241248138228368, //
-0.41896926325520452803, //
-0.36596434037219118198, //
-0.31174372083446822888, //
-0.25648752006999730007, //
-0.20037929360621356977, //
-0.14360542731625615394, //
-0.08635451826324821528, //
-0.02881674819934177765, //
0.02881674819934177765, //
0.08635451826324821528, //
0.14360542731625615394, //
0.20037929360621356977, //
0.25648752006999730007, //
0.31174372083446822888, //
0.36596434037219118198, //
0.41896926325520452803, //
0.47058241248138228368, //
0.52063233438593307332, //
0.56895276819520942973, //
0.61538319833112737072, //
0.65976938763198312469, //
0.70196388971917291938, //
0.74182653880918431628, //
0.77922491534625402153, //
0.81403478591356783546, //
0.84614051597077294942, //
0.87543545406556893941, //
0.90182228628470158075, //
0.92521335986665148625, //
0.94553097516499585376, //
0.96270764578592358325, //
0.97668632885790323720, //
0.98742063739734355855, //
0.99487511701833888491, //
0.99902666686734098385, //
};
static constexpr double W[] = {
0.00249748183576158577, //
0.00580561101523998487, //
0.00909936945550939694, //
0.01236332812884764416, //
0.01558630303592413170, //
0.01875752762146937791, //
0.02186645142285308594, //
0.02490274146720877305, //
0.02785630931059587028, //
0.03071734249787067605, //
0.03347633646437264571, //
0.03612412584038355258, //
0.03865191478210251683, //
0.04105130613664497422, //
0.04331432930959701544, //
0.04543346672827671397, //
0.04740167880644499105, //
0.04921242732452888606, //
0.05085969714618814431, //
0.05233801619829874466, //
0.05364247364755361127, //
0.05476873621305798630, //
0.05571306256058998768, //
0.05647231573062596503, //
0.05704397355879459856, //
0.05742613705411211485, //
0.05761753670714702467, //
0.05761753670714702467, //
0.05742613705411211485, //
0.05704397355879459856, //
0.05647231573062596503, //
0.05571306256058998768, //
0.05476873621305798630, //
0.05364247364755361127, //
0.05233801619829874466, //
0.05085969714618814431, //
0.04921242732452888606, //
0.04740167880644499105, //
0.04543346672827671397, //
0.04331432930959701544, //
0.04105130613664497422, //
0.03865191478210251683, //
0.03612412584038355258, //
0.03347633646437264571, //
0.03071734249787067605, //
0.02785630931059587028, //
0.02490274146720877305, //
0.02186645142285308594, //
0.01875752762146937791, //
0.01558630303592413170, //
0.01236332812884764416, //
0.00909936945550939694, //
0.00580561101523998487, //
0.00249748183576158577, //
};
};
template <>
struct gauss_data<55> {
static constexpr double X[] = {
-0.99906141956481854147, //
-0.99505797784741187504, //
-0.98786894119888919852, //
-0.97751573550398920885, //
-0.96403132859313519877, //
-0.94745886804121074185, //
-0.92785142472079169681, //
-0.90527180074400002578, //
-0.87979232241989550606, //
-0.85149460661715447146, //
-0.82046929855932091245, //
-0.78681578112762236589, //
-0.75064185634802190867, //
-0.71206339998663783890, //
-0.67120399031982639579, //
-0.62819451224992814009, //
-0.58317273802603210297, //
-0.53628288590834329672, //
-0.48767515818747409720, //
-0.43750526003717459180, //
-0.38593390074097942975, //
-0.33312627889002388518, //
-0.27925155320080653854, //
-0.22448230064784548340, //
-0.16899396364687320828, //
-0.11296428805932926658, //
-0.05657275381833677632, //
0, //
0.05657275381833677632, //
0.11296428805932926658, //
0.16899396364687320828, //
0.22448230064784548340, //
0.27925155320080653854, //
0.33312627889002388518, //
0.38593390074097942975, //
0.43750526003717459180, //
0.48767515818747409720, //
0.53628288590834329672, //
0.58317273802603210297, //
0.62819451224992814009, //
0.67120399031982639579, //
0.71206339998663783890, //
0.75064185634802190867, //
0.78681578112762236589, //
0.82046929855932091245, //
0.85149460661715447146, //
0.87979232241989550606, //
0.90527180074400002578, //
0.92785142472079169681, //
0.94745886804121074185, //
0.96403132859313519877, //
0.97751573550398920885, //
0.98786894119888919852, //
0.99505797784741187504, //
0.99906141956481854147, //
};
static constexpr double W[] = {
0.00240832361997978881, //
0.00559863226656076735, //
0.00877574610705852817, //
0.01192516071984861217, //
0.01503645833351178821, //
0.01809961452072906240, //
0.02110480166801645412, //
0.02404238800972562200, //
0.02690296145639627066, //
0.02967735776516104122, //
0.03235668922618583168, //
0.03493237287358988740, //
0.03739615786796554528, //
0.03974015187433717960, //
0.04195684631771876239, //
0.04403914042160658989, //
0.04598036394628383810, //
0.04777429855120069555, //
0.04941519771155173948, //
0.05089780512449397922, //
0.05221737154563208456, //
0.05336967000160547272, //
0.05435100932991110207, //
0.05515824600250868759, //
0.05578879419528408710, //
0.05624063407108436802, //
0.05651231824977200140, //
0.05660297644456042544, //
0.05651231824977200140, //
0.05624063407108436802, //
0.05578879419528408710, //
0.05515824600250868759, //
0.05435100932991110207, //
0.05336967000160547272, //
0.05221737154563208456, //
0.05089780512449397922, //
0.04941519771155173948, //
0.04777429855120069555, //
0.04598036394628383810, //
0.04403914042160658989, //
0.04195684631771876239, //
0.03974015187433717960, //
0.03739615786796554528, //
0.03493237287358988740, //
0.03235668922618583168, //
0.02967735776516104122, //
0.02690296145639627066, //
0.02404238800972562200, //
0.02110480166801645412, //
0.01809961452072906240, //
0.01503645833351178821, //
0.01192516071984861217, //
0.00877574610705852817, //
0.00559863226656076735, //
0.00240832361997978881, //
};
};
template <>
struct gauss_data<56> {
static constexpr double X[] = {
-0.99909434380146558435, //
-0.99523122608106974721, //
-0.98829371554016151108, //
-0.97830170914025638337, //
-0.96528590190549018362, //
-0.94928647956196263564, //
-0.93035288024749630054, //
-0.90854362042065549084, //
-0.88392610832782754078, //
-0.85657643376274863540, //
-0.82657913214288165167, //
-0.79402692289386649803, //
-0.75902042270512890220, //
-0.72166783445018808352, //
-0.68208461269447045550, //
-0.64039310680700689426, //
-0.59672218277066332010, //
-0.55120682485553461875, //
-0.50398771838438171419, //
-0.45521081487845957894, //
-0.40502688092709127811, //
-0.35359103217495452096, //
-0.30106225386722066905, //
-0.24760290943433720397, //
-0.19337823863527525824, //
-0.13855584681037624201, //
-0.08330518682243537444, //
-0.02779703528727543709, //
0.02779703528727543709, //
0.08330518682243537444, //
0.13855584681037624201, //
0.19337823863527525824, //
0.24760290943433720397, //
0.30106225386722066905, //
0.35359103217495452096, //
0.40502688092709127811, //
0.45521081487845957894, //
0.50398771838438171419, //
0.55120682485553461875, //
0.59672218277066332010, //
0.64039310680700689426, //
0.68208461269447045550, //
0.72166783445018808352, //
0.75902042270512890220, //
0.79402692289386649803, //
0.82657913214288165167, //
0.85657643376274863540, //
0.88392610832782754078, //
0.90854362042065549084, //
0.93035288024749630054, //
0.94928647956196263564, //
0.96528590190549018362, //
0.97830170914025638337, //
0.98829371554016151108, //
0.99523122608106974721, //
0.99909434380146558435, //
};
static constexpr double W[] = {
0.00232385537577321550, //
0.00540252224601533776, //
0.00846906316330788766, //
0.01150982434038338217, //
0.01451508927802147180, //
0.01747551291140094650, //
0.02038192988240257263, //
0.02322535156256531693, //
0.02599698705839195219, //
0.02868826847382274172, //
0.03129087674731044786, //
0.03379676711561176129, //
0.03619819387231518603, //
0.03848773425924766248, //
0.04065831138474451788, //
0.04270321608466708651, //
0.04461612765269228321, //
0.04639113337300189676, //
0.04802274679360025812, //
0.04950592468304757891, //
0.05083608261779848056, //
0.05200910915174139984, //
0.05302137852401076396, //
0.05386976186571448570, //
0.05455163687088942106, //
0.05506489590176242579, //
0.05540795250324512321, //
0.05557974630651439584, //
0.05557974630651439584, //
0.05540795250324512321, //
0.05506489590176242579, //
0.05455163687088942106, //
0.05386976186571448570, //
0.05302137852401076396, //
0.05200910915174139984, //
0.05083608261779848056, //
0.04950592468304757891, //
0.04802274679360025812, //
0.04639113337300189676, //
0.04461612765269228321, //
0.04270321608466708651, //
0.04065831138474451788, //
0.03848773425924766248, //
0.03619819387231518603, //
0.03379676711561176129, //
0.03129087674731044786, //
0.02868826847382274172, //
0.02599698705839195219, //
0.02322535156256531693, //
0.02038192988240257263, //
0.01747551291140094650, //
0.01451508927802147180, //
0.01150982434038338217, //
0.00846906316330788766, //
0.00540252224601533776, //
0.00232385537577321550, //
};
};
template <>
struct gauss_data<57> {
static constexpr double X[] = {
-0.99912556562526285057, //
-0.99539552367843031113, //
-0.98869657765022204884, //
-0.97904722670946871379, //
-0.96647608517188667911, //
-0.95102062644787674191, //
-0.93272696106710169610, //
-0.91164967852139121272, //
-0.88785167888222132951, //
-0.86140398326204694472, //
-0.83238552115043912082, //
-0.80088289454721824207, //
-0.76699011935945019549, //
-0.73080834474452332282, //
-0.69244555119951773904, //
-0.65201622828097689124, //
-0.60964103290871536542, //
-0.56544642926923675901, //
-0.51956431139118760631, //
-0.47213160951797570958, //
-0.42328988145156395096, //
-0.37318489008659445855, //
-0.32196616839537864059, //
-0.26978657316183876576, //
-0.21680182879612403641, //
-0.16317006259126425104, //
-0.10905133280878780097, //
-0.05460715100164682421, //
0, //
0.05460715100164682421, //
0.10905133280878780097, //
0.16317006259126425104, //
0.21680182879612403641, //
0.26978657316183876576, //
0.32196616839537864059, //
0.37318489008659445855, //
0.42328988145156395096, //
0.47213160951797570958, //
0.51956431139118760631, //
0.56544642926923675901, //
0.60964103290871536542, //
0.65201622828097689124, //
0.69244555119951773904, //
0.73080834474452332282, //
0.76699011935945019549, //
0.80088289454721824207, //
0.83238552115043912082, //
0.86140398326204694472, //
0.88785167888222132951, //
0.91164967852139121272, //
0.93272696106710169610, //
0.95102062644787674191, //
0.96647608517188667911, //
0.97904722670946871379, //
0.98869657765022204884, //
0.99539552367843031113, //
0.99912556562526285057, //
};
static constexpr double W[] = {
0.00224375387225066290, //
0.00521653347471877939, //
0.00817816006782123262, //
0.01111576373233599014, //
0.01402027079075355617, //
0.01688295902344154903, //
0.01969527069948852038, //
0.02244880789077643807, //
0.02513535099091812264, //
0.02774688140218019232, //
0.03027560484269399945, //
0.03271397436637156854, //
0.03505471278231261750, //
0.03729083432441731735, //
0.03941566547548011408, //
0.04142286487080111036, //
0.04330644221621519659, //
0.04506077616138115779, //
0.04668063107364150378, //
0.04816117266168775126, //
0.04949798240201967899, //
0.05068707072492740865, //
0.05172488892051782472, //
0.05260833972917743244, //
0.05333478658481915842, //
0.05390206148329857464, //
0.05430847145249864313, //
0.05455280360476188648, //
0.05463432875658402406, //
0.05455280360476188648, //
0.05430847145249864313, //
0.05390206148329857464, //
0.05333478658481915842, //
0.05260833972917743244, //
0.05172488892051782472, //
0.05068707072492740865, //
0.04949798240201967899, //
0.04816117266168775126, //
0.04668063107364150378, //
0.04506077616138115779, //
0.04330644221621519659, //
0.04142286487080111036, //
0.03941566547548011408, //
0.03729083432441731735, //
0.03505471278231261750, //
0.03271397436637156854, //
0.03027560484269399945, //
0.02774688140218019232, //
0.02513535099091812264, //
0.02244880789077643807, //
0.01969527069948852038, //
0.01688295902344154903, //
0.01402027079075355617, //
0.01111576373233599014, //
0.00817816006782123262, //
0.00521653347471877939, //
0.00224375387225066290, //
};
};
template <>
struct gauss_data<58> {
static constexpr double X[] = {
-0.99915520040738660644, //
-0.99555147659729090260, //
-0.98907900824844263649, //
-0.97975501469435030910, //
-0.96760620250292409015, //
-0.95266755751886909144, //
-0.93498213758825934848, //
-0.91460092856435254068, //
-0.89158269202203017639, //
-0.86599379407480747927, //
-0.83790801333937331635, //
-0.80740632791308814104, //
-0.77457668174965274526, //
-0.73951373102004226784, //
-0.70231857115390811347, //
-0.66309844533212526643, //
-0.62196643526307911103, //
-0.57904113513022503048, //
-0.53444630964884758639, //
-0.48831053721671846361, //
-0.44076683918683956519, //
-0.39195229633075315037, //
-0.34200765359799526124, //
-0.29107691431110918953, //
-0.23930692496615345442, //
-0.18684695183576132137, //
-0.13384825059546685702, //
-0.08046363021414272930, //
-0.02684701236594235580, //
0.02684701236594235580, //
0.08046363021414272930, //
0.13384825059546685702, //
0.18684695183576132137, //
0.23930692496615345442, //
0.29107691431110918953, //
0.34200765359799526124, //
0.39195229633075315037, //
0.44076683918683956519, //
0.48831053721671846361, //
0.53444630964884758639, //
0.57904113513022503048, //
0.62196643526307911103, //
0.66309844533212526643, //
0.70231857115390811347, //
0.73951373102004226784, //
0.77457668174965274526, //
0.80740632791308814104, //
0.83790801333937331635, //
0.86599379407480747927, //
0.89158269202203017639, //
0.91460092856435254068, //
0.93498213758825934848, //
0.95266755751886909144, //
0.96760620250292409015, //
0.97975501469435030910, //
0.98907900824844263649, //
0.99555147659729090260, //
0.99915520040738660644, //
};
static constexpr double W[] = {
0.00216772324962744994, //
0.00503998161265024308, //
0.00790197384999867475, //
0.01074155353287877411, //
0.01355023711298881214, //
0.01631987423497096505, //
0.01904246546189340865, //
0.02171015614014623576, //
0.02431525272496395254, //
0.02685024318198186847, //
0.02930781804416049071, //
0.03168089125380932732, //
0.03396262049341601079, //
0.03614642686708727054, //
0.03822601384585843322, //
0.04019538540986779688, //
0.04204886332958212599, //
0.04378110353364025103, //
0.04538711151481980250, //
0.04686225672902634691, //
0.04820228594541774840, //
0.04940333550896239286, //
0.05046194247995312529, //
0.05137505461828572547, //
0.05214003918366981897, //
0.05275469052637083342, //
0.05321723644657901410, //
0.05352634330405825210, //
0.05368111986333484886, //
0.05368111986333484886, //
0.05352634330405825210, //
0.05321723644657901410, //
0.05275469052637083342, //
0.05214003918366981897, //
0.05137505461828572547, //
0.05046194247995312529, //
0.04940333550896239286, //
0.04820228594541774840, //
0.04686225672902634691, //
0.04538711151481980250, //
0.04378110353364025103, //
0.04204886332958212599, //
0.04019538540986779688, //
0.03822601384585843322, //
0.03614642686708727054, //
0.03396262049341601079, //
0.03168089125380932732, //
0.02930781804416049071, //
0.02685024318198186847, //
0.02431525272496395254, //
0.02171015614014623576, //
0.01904246546189340865, //
0.01631987423497096505, //
0.01355023711298881214, //
0.01074155353287877411, //
0.00790197384999867475, //
0.00503998161265024308, //
0.00216772324962744994, //
};
};
template <>
struct gauss_data<59> {
static constexpr double X[] = {
-0.99918335390929468375, //
-0.99569964038324596468, //
-0.98944236513373093178, //
-0.98042757395671568844, //
-0.96868022168178153135, //
-0.95423300937695105586, //
-0.93712619035345385940, //
-0.91740743878815528135, //
-0.89513171174347208536, //
-0.87036109429288226096, //
-0.84316462581687220147, //
-0.81361810728821157143, //
-0.78180388986236090563, //
-0.74781064527864023188, //
-0.71173311867719773159, //
-0.67367186450493722702, //
-0.63373296623885009751, //
-0.59202774070403014446, //
-0.54867242780839638437, //
-0.50378786655771797876, //
-0.45749915825326669022, //
-0.40993531781041896672, //
-0.36122891416979480999, //
-0.31151570080301370031, //
-0.26093423734281171161, //
-0.20962550339203654492, //
-0.15773250558785796811, //
-0.10539987901634414383, //
-0.05277348408831000395, //
0, //
0.05277348408831000395, //
0.10539987901634414383, //
0.15773250558785796811, //
0.20962550339203654492, //
0.26093423734281171161, //
0.31151570080301370031, //
0.36122891416979480999, //
0.40993531781041896672, //
0.45749915825326669022, //
0.50378786655771797876, //
0.54867242780839638437, //
0.59202774070403014446, //
0.63373296623885009751, //
0.67367186450493722702, //
0.71173311867719773159, //
0.74781064527864023188, //
0.78180388986236090563, //
0.81361810728821157143, //
0.84316462581687220147, //
0.87036109429288226096, //
0.89513171174347208536, //
0.91740743878815528135, //
0.93712619035345385940, //
0.95423300937695105586, //
0.96868022168178153135, //
0.98042757395671568844, //
0.98944236513373093178, //
0.99569964038324596468, //
0.99918335390929468375, //
};
static constexpr double W[] = {
0.00209549228454122340, //
0.00487223916826528476, //
0.00763952945348757514, //
0.01038588550099586219, //
0.01310336630634519101, //
0.01578434731308146614, //
0.01842134275361002936, //
0.02100699828843718735, //
0.02353410539371336342, //
0.02599561973129850018, //
0.02838468020053479790, //
0.03069462783611168323, //
0.03291902427104527775, //
0.03505166963640010878, //
0.03708661981887092269, //
0.03901820301616000950, //
0.04084103553868670766, //
0.04255003681106763866, //
0.04414044353029738069, //
0.04560782294050976983, //
0.04694808518696201919, //
0.04815749471460644038, //
0.04923268067936198577, //
0.05017064634299690281, //
0.05096877742539391685, //
0.05162484939089148214, //
0.05213703364837539138, //
0.05250390264782873905, //
0.05272443385912793196, //
0.05279801262199042141, //
0.05272443385912793196, //
0.05250390264782873905, //
0.05213703364837539138, //
0.05162484939089148214, //
0.05096877742539391685, //
0.05017064634299690281, //
0.04923268067936198577, //
0.04815749471460644038, //
0.04694808518696201919, //
0.04560782294050976983, //
0.04414044353029738069, //
0.04255003681106763866, //
0.04084103553868670766, //
0.03901820301616000950, //
0.03708661981887092269, //
0.03505166963640010878, //
0.03291902427104527775, //
0.03069462783611168323, //
0.02838468020053479790, //
0.02599561973129850018, //
0.02353410539371336342, //
0.02100699828843718735, //
0.01842134275361002936, //
0.01578434731308146614, //
0.01310336630634519101, //
0.01038588550099586219, //
0.00763952945348757514, //
0.00487223916826528476, //
0.00209549228454122340, //
};
};
template <>
struct gauss_data<60> {
static constexpr double X[] = {
-0.99921012322743602203, //
-0.99584052511883817387, //
-0.98978789522222171736, //
-0.98106720175259818561, //
-0.96970178876505273372, //
-0.95572225583999610739, //
-0.93916627611642324949, //
-0.92007847617762755285, //
-0.89851031081004594193, //
-0.87451992264689831512, //
-0.84817198478592963249, //
-0.81953752616214575936, //
-0.78869373993226405456, //
-0.75572377530658568686, //
-0.72071651335573039943, //
-0.68376632738135543722, //
-0.64497282848947706781, //
-0.60444059704851036344, //
-0.56227890075394453917, //
-0.51860140005856974741, //
-0.47352584176170711110, //
-0.42717374158307838930, //
-0.37967005657679797715, //
-0.33114284826844819425, //
-0.28172293742326169169, //
-0.23154355137602933801, //
-0.18073996487342541724, //
-0.12944913539694500314, //
-0.07780933394953656941, //
-0.02595977230124779858, //
0.02595977230124779858, //
0.07780933394953656941, //
0.12944913539694500314, //
0.18073996487342541724, //
0.23154355137602933801, //
0.28172293742326169169, //
0.33114284826844819425, //
0.37967005657679797715, //
0.42717374158307838930, //
0.47352584176170711110, //
0.51860140005856974741, //
0.56227890075394453917, //
0.60444059704851036344, //
0.64497282848947706781, //
0.68376632738135543722, //
0.72071651335573039943, //
0.75572377530658568686, //
0.78869373993226405456, //
0.81953752616214575936, //
0.84817198478592963249, //
0.87451992264689831512, //
0.89851031081004594193, //
0.92007847617762755285, //
0.93916627611642324949, //
0.95572225583999610739, //
0.96970178876505273372, //
0.98106720175259818561, //
0.98978789522222171736, //
0.99584052511883817387, //
0.99921012322743602203, //
};
static constexpr double W[] = {
0.00202681196887375849, //
0.00471272992695356864, //
0.00738993116334545553, //
0.01004755718228798435, //
0.01267816647681596013, //
0.01527461859678479930, //
0.01782990101420772026, //
0.02033712072945728677, //
0.02278951694399781986, //
0.02518047762152124837, //
0.02750355674992479163, //
0.02975249150078894524, //
0.03192121901929632894, //
0.03400389272494642283, //
0.03599489805108450306, //
0.03788886756924344403, //
0.03968069545238079947, //
0.04136555123558475561, //
0.04293889283593564195, //
0.04439647879578711332, //
0.04573437971611448664, //
0.04694898884891220484, //
0.04803703181997118096, //
0.04899557545575683538, //
0.04982203569055018101, //
0.05051418453250937459, //
0.05107015606985562740, //
0.05148845150098093399, //
0.05176794317491018754, //
0.05190787763122063973, //
0.05190787763122063973, //
0.05176794317491018754, //
0.05148845150098093399, //
0.05107015606985562740, //
0.05051418453250937459, //
0.04982203569055018101, //
0.04899557545575683538, //
0.04803703181997118096, //
0.04694898884891220484, //
0.04573437971611448664, //
0.04439647879578711332, //
0.04293889283593564195, //
0.04136555123558475561, //
0.03968069545238079947, //
0.03788886756924344403, //
0.03599489805108450306, //
0.03400389272494642283, //
0.03192121901929632894, //
0.02975249150078894524, //
0.02750355674992479163, //
0.02518047762152124837, //
0.02278951694399781986, //
0.02033712072945728677, //
0.01782990101420772026, //
0.01527461859678479930, //
0.01267816647681596013, //
0.01004755718228798435, //
0.00738993116334545553, //
0.00471272992695356864, //
0.00202681196887375849, //
};
};
template <>
struct gauss_data<61> {
static constexpr double X[] = {
-0.99923559763136347173, //
-0.99597459981512023426, //
-0.99011674523251705096, //
-0.98167601128403707968, //
-0.97067425883318290824, //
-0.95714015191298409137, //
-0.94110898668136114747, //
-0.92262258138295526125, //
-0.90172916247400117064, //
-0.87848323721488103247, //
-0.85294545084766344556, //
-0.82518242810865995066, //
-0.79526659928235964915, //
-0.76327601117231219714, //
-0.72929412344946510968, //
-0.69340959089449115549, //
-0.65571603209507087169, //
-0.61631178519792172470, //
-0.57529965135083061860, //
-0.53278662650292526563, //
-0.48888362226225211882, //
-0.44370517653853160199, //
-0.39736915472575660917, //
-0.34999644220406683453, //
-0.30171062896303071260, //
-0.25263768716905349583, //
-0.20290564251805849922, //
-0.15264424023081530052, //
-0.10198460656227406895, //
-0.05105890670797434936, //
0, //
0.05105890670797434936, //
0.10198460656227406895, //
0.15264424023081530052, //
0.20290564251805849922, //
0.25263768716905349583, //
0.30171062896303071260, //
0.34999644220406683453, //
0.39736915472575660917, //
0.44370517653853160199, //
0.48888362226225211882, //
0.53278662650292526563, //
0.57529965135083061860, //
0.61631178519792172470, //
0.65571603209507087169, //
0.69340959089449115549, //
0.72929412344946510968, //
0.76327601117231219714, //
0.79526659928235964915, //
0.82518242810865995066, //
0.85294545084766344556, //
0.87848323721488103247, //
0.90172916247400117064, //
0.92262258138295526125, //
0.94110898668136114747, //
0.95714015191298409137, //
0.97067425883318290824, //
0.98167601128403707968, //
0.99011674523251705096, //
0.99597459981512023426, //
0.99923559763136347173, //
};
static constexpr double W[] = {
0.00196145336167028267, //
0.00456092400601241718, //
0.00715235499174908958, //
0.00972546183035613373, //
0.01227326350781210462, //
0.01478906588493791454, //
0.01726629298761374359, //
0.01969847774610118133, //
0.02207927314831904400, //
0.02440246718754420291, //
0.02666199852415088966, //
0.02885197208818340150, //
0.03096667436839739482, //
0.03300058827590741063, //
0.03494840751653335109, //
0.03680505042315481738, //
0.03856567320700817274, //
0.04022568259099824736, //
0.04178074779088849206, //
0.04322681181249609790, //
0.04456010203508348827, //
0.04577714005314595937, //
0.04687475075080906597, //
0.04785007058509560716, //
0.04870055505641152608, //
0.04942398534673558993, //
0.05001847410817825342, //
0.05048247038679740464, //
0.05081476366881834320, //
0.05101448703869726354, //
0.05108111944078621797, //
0.05101448703869726354, //
0.05081476366881834320, //
0.05048247038679740464, //
0.05001847410817825342, //
0.04942398534673558993, //
0.04870055505641152608, //
0.04785007058509560716, //
0.04687475075080906597, //
0.04577714005314595937, //
0.04456010203508348827, //
0.04322681181249609790, //
0.04178074779088849206, //
0.04022568259099824736, //
0.03856567320700817274, //
0.03680505042315481738, //
0.03494840751653335109, //
0.03300058827590741063, //
0.03096667436839739482, //
0.02885197208818340150, //
0.02666199852415088966, //
0.02440246718754420291, //
0.02207927314831904400, //
0.01969847774610118133, //
0.01726629298761374359, //
0.01478906588493791454, //
0.01227326350781210462, //
0.00972546183035613373, //
0.00715235499174908958, //
0.00456092400601241718, //
0.00196145336167028267, //
};
};
template <>
struct gauss_data<62> {
static constexpr double X[] = {
-0.99925985930877702969, //
-0.99610229631626713288, //
-0.99042997118929035242, //
-0.98225594909723664949, //
-0.97160072337165180644, //
-0.95849117297392709202, //
-0.94296040139232850382, //
-0.92504763563620375522, //
-0.90479812252109346575, //
-0.88226301283189736307, //
-0.85749923151207092281, //
-0.83056933360400485134, //
-0.80154134610397637153, //
-0.77048859605541931899, //
-0.73748952528315674986, //
-0.70262749222229705512, //
-0.66599056133547944699, //
-0.62767128064688518072, //
-0.58776644795308733800, //
-0.54637686630025109581, //
-0.50360708934475595591, //
-0.45956515724011339520, //
-0.41436232371712604812, //
-0.36811277504656452966, //
-0.32093334159419400407, //
-0.27294320269672634318, //
-0.22426358560416553166, //
-0.17501745924901562855, //
-0.12532922361589680861, //
-0.07532439549623433276, //
-0.02512929142182061472, //
0.02512929142182061472, //
0.07532439549623433276, //
0.12532922361589680861, //
0.17501745924901562855, //
0.22426358560416553166, //
0.27294320269672634318, //
0.32093334159419400407, //
0.36811277504656452966, //
0.41436232371712604812, //
0.45956515724011339520, //
0.50360708934475595591, //
0.54637686630025109581, //
0.58776644795308733800, //
0.62767128064688518072, //
0.66599056133547944699, //
0.70262749222229705512, //
0.73748952528315674986, //
0.77048859605541931899, //
0.80154134610397637153, //
0.83056933360400485134, //
0.85749923151207092281, //
0.88226301283189736307, //
0.90479812252109346575, //
0.92504763563620375522, //
0.94296040139232850382, //
0.95849117297392709202, //
0.97160072337165180644, //
0.98225594909723664949, //
0.99042997118929035242, //
0.99610229631626713288, //
0.99925985930877702969, //
};
static constexpr double W[] = {
0.00189920567951369048, //
0.00441633345693090481, //
0.00692604190183096087, //
0.00941857942842038763, //
0.01188739011701050194, //
0.01432619182380651776, //
0.01672881179017731628, //
0.01908917665857319873, //
0.02140132227766996884, //
0.02365940720868279257, //
0.02585772695402469802, //
0.02799072816331463754, //
0.03005302257398987007, //
0.03203940058162467810, //
0.03394484437941054509, //
0.03576454062276814128, //
0.03749389258228002998, //
0.03912853175196308412, //
0.04066432888241744096, //
0.04209740441038509664, //
0.04342413825804741958, //
0.04464117897712441429, //
0.04574545221457018077, //
0.04673416847841552480, //
0.04760483018410123227, //
0.04835523796347767283, //
0.04898349622051783710, //
0.04948801791969929252, //
0.04986752859495239424, //
0.05012106956904328807, //
0.05024800037525628168, //
0.05024800037525628168, //
0.05012106956904328807, //
0.04986752859495239424, //
0.04948801791969929252, //
0.04898349622051783710, //
0.04835523796347767283, //
0.04760483018410123227, //
0.04673416847841552480, //
0.04574545221457018077, //
0.04464117897712441429, //
0.04342413825804741958, //
0.04209740441038509664, //
0.04066432888241744096, //
0.03912853175196308412, //
0.03749389258228002998, //
0.03576454062276814128, //
0.03394484437941054509, //
0.03203940058162467810, //
0.03005302257398987007, //
0.02799072816331463754, //
0.02585772695402469802, //
0.02365940720868279257, //
0.02140132227766996884, //
0.01908917665857319873, //
0.01672881179017731628, //
0.01432619182380651776, //
0.01188739011701050194, //
0.00941857942842038763, //
0.00692604190183096087, //
0.00441633345693090481, //
0.00189920567951369048, //
};
};
template <>
struct gauss_data<63> {
static constexpr double X[] = {
-0.99928298402912378037, //
-0.99622401277797010860, //
-0.99072854689218946681, //
-0.98280881059372723486, //
-0.97248403469757002280, //
-0.95977944975894192707, //
-0.94472613404100980296, //
-0.92736092062184320544, //
-0.90772630277853155803, //
-0.88587032850785342629, //
-0.86184648236412371953, //
-0.83571355431950284347, //
-0.80753549577345676005, //
-0.77738126299037233556, //
-0.74532464831784741782, //
-0.71144409958484580785, //
-0.67582252811498609013, //
-0.63854710582136538500, //
-0.59970905187762523573, //
-0.55940340948628501326, //
-0.51772881329003324812, //
-0.47478724799480439992, //
-0.43068379879511160066, //
-0.38552639421224789247, //
-0.33942554197458440246, //
-0.29249405858625144003, //
-0.24484679324595336274, //
-0.19660034679150668455, //
-0.14787278635787196856, //
-0.09878335644694527952, //
-0.04945218711615962723, //
0, //
0.04945218711615962723, //
0.09878335644694527952, //
0.14787278635787196856, //
0.19660034679150668455, //
0.24484679324595336274, //
0.29249405858625144003, //
0.33942554197458440246, //
0.38552639421224789247, //
0.43068379879511160066, //
0.47478724799480439992, //
0.51772881329003324812, //
0.55940340948628501326, //
0.59970905187762523573, //
0.63854710582136538500, //
0.67582252811498609013, //
0.71144409958484580785, //
0.74532464831784741782, //
0.77738126299037233556, //
0.80753549577345676005, //
0.83571355431950284347, //
0.86184648236412371953, //
0.88587032850785342629, //
0.90772630277853155803, //
0.92736092062184320544, //
0.94472613404100980296, //
0.95977944975894192707, //
0.97248403469757002280, //
0.98280881059372723486, //
0.99072854689218946681, //
0.99622401277797010860, //
0.99928298402912378037, //
};
static constexpr double W[] = {
0.00183987459557708411, //
0.00427850834686376186, //
0.00671029176596013625, //
0.00912596867632665635, //
0.01151937607688004175, //
0.01388461261611561082, //
0.01621587841033833888, //
0.01850746446016127040, //
0.02075376125803909077, //
0.02294927100488993314, //
0.02508862055334498661, //
0.02716657435909793322, //
0.02917804720828052694, //
0.03111811662221981750, //
0.03298203488377934176, //
0.03476524064535587769, //
0.03646337008545728963, //
0.03807226758434955676, //
0.03958799589154409398, //
0.04100684575966639863, //
0.04232534502081582298, //
0.04354026708302759079, //
0.04464863882594139537, //
0.04564774787629260868, //
0.04653514924538369651, //
0.04730867131226891908, //
0.04796642113799513141, //
0.04850678909788384786, //
0.04892845282051198994, //
0.04923038042374756078, //
0.04941183303991817896, //
0.04947236662393102088, //
0.04941183303991817896, //
0.04923038042374756078, //
0.04892845282051198994, //
0.04850678909788384786, //
0.04796642113799513141, //
0.04730867131226891908, //
0.04653514924538369651, //
0.04564774787629260868, //
0.04464863882594139537, //
0.04354026708302759079, //
0.04232534502081582298, //
0.04100684575966639863, //
0.03958799589154409398, //
0.03807226758434955676, //
0.03646337008545728963, //
0.03476524064535587769, //
0.03298203488377934176, //
0.03111811662221981750, //
0.02917804720828052694, //
0.02716657435909793322, //
0.02508862055334498661, //
0.02294927100488993314, //
0.02075376125803909077, //
0.01850746446016127040, //
0.01621587841033833888, //
0.01388461261611561082, //
0.01151937607688004175, //
0.00912596867632665635, //
0.00671029176596013625, //
0.00427850834686376186, //
0.00183987459557708411, //
};
};
template <>
struct gauss_data<64> {
static constexpr double X[] = {
-0.99930504173577213945, //
-0.99634011677195527934, //
-0.99101337147674432073, //
-0.98333625388462595693, //
-0.97332682778991096374, //
-0.96100879965205371891, //
-0.94641137485840281606, //
-0.92956917213193957582, //
-0.91052213707850280575, //
-0.88931544599511410585, //
-0.86599939815409281976, //
-0.84062929625258036275, //
-0.81326531512279755974, //
-0.78397235894334140761, //
-0.75281990726053189661, //
-0.71988185017161082684, //
-0.68523631305423324256, //
-0.64896547125465733985, //
-0.61115535517239325024, //
-0.57189564620263403428, //
-0.53127946401989454565, //
-0.48940314570705295747, //
-0.44636601725346408798, //
-0.40227015796399160369, //
-0.35722015833766811595, //
-0.31132287199021095615, //
-0.26468716220876741637, //
-0.21742364374000708414, //
-0.16964442042399281803, //
-0.12146281929612055447, //
-0.07299312178779903944, //
-0.02435029266342443250, //
0.02435029266342443250, //
0.07299312178779903944, //
0.12146281929612055447, //
0.16964442042399281803, //
0.21742364374000708414, //
0.26468716220876741637, //
0.31132287199021095615, //
0.35722015833766811595, //
0.40227015796399160369, //
0.44636601725346408798, //
0.48940314570705295747, //
0.53127946401989454565, //
0.57189564620263403428, //
0.61115535517239325024, //
0.64896547125465733985, //
0.68523631305423324256, //
0.71988185017161082684, //
0.75281990726053189661, //
0.78397235894334140761, //
0.81326531512279755974, //
0.84062929625258036275, //
0.86599939815409281976, //
0.88931544599511410585, //
0.91052213707850280575, //
0.92956917213193957582, //
0.94641137485840281606, //
0.96100879965205371891, //
0.97332682778991096374, //
0.98333625388462595693, //
0.99101337147674432073, //
0.99634011677195527934, //
0.99930504173577213945, //
};
static constexpr double W[] = {
0.00178328072169643294, //
0.00414703326056246763, //
0.00650445796897836285, //
0.00884675982636394772, //
0.01116813946013112881, //
0.01346304789671864259, //
0.01572603047602471932, //
0.01795171577569734308, //
0.02013482315353020937, //
0.02227017380838325415, //
0.02435270256871087333, //
0.02637746971505465867, //
0.02833967261425948322, //
0.03023465707240247886, //
0.03205792835485155358, //
0.03380516183714160939, //
0.03547221325688238381, //
0.03705512854024004604, //
0.03855015317861562912, //
0.03995374113272034138, //
0.04126256324262352861, //
0.04247351512365358900, //
0.04358372452932345337, //
0.04459055816375656306, //
0.04549162792741814447, //
0.04628479658131441729, //
0.04696818281621001732, //
0.04754016571483030866, //
0.04799938859645830772, //
0.04834476223480295716, //
0.04857546744150342693, //
0.04869095700913972038, //
0.04869095700913972038, //
0.04857546744150342693, //
0.04834476223480295716, //
0.04799938859645830772, //
0.04754016571483030866, //
0.04696818281621001732, //
0.04628479658131441729, //
0.04549162792741814447, //
0.04459055816375656306, //
0.04358372452932345337, //
0.04247351512365358900, //
0.04126256324262352861, //
0.03995374113272034138, //
0.03855015317861562912, //
0.03705512854024004604, //
0.03547221325688238381, //
0.03380516183714160939, //
0.03205792835485155358, //
0.03023465707240247886, //
0.02833967261425948322, //
0.02637746971505465867, //
0.02435270256871087333, //
0.02227017380838325415, //
0.02013482315353020937, //
0.01795171577569734308, //
0.01572603047602471932, //
0.01346304789671864259, //
0.01116813946013112881, //
0.00884675982636394772, //
0.00650445796897836285, //
0.00414703326056246763, //
0.00178328072169643294, //
};
};
} // namespace ads::quad::gauss
#endif // ADS_QUAD_GAUSS_HPP
|
dae6853d344b10ecdf7bd4c171dabfa7e0378ff4 | c20c4812ac0164c8ec2434e1126c1fdb1a2cc09e | /Source/Source/Tools/KG_BoneChecker/src/KG_Clip.cpp | f533011f02a4706045a9811ef6dc2f60736c43c5 | [
"MIT"
] | permissive | uvbs/FullSource | f8673b02e10c8c749b9b88bf18018a69158e8cb9 | 07601c5f18d243fb478735b7bdcb8955598b9a90 | refs/heads/master | 2020-03-24T03:11:13.148940 | 2018-07-25T18:30:25 | 2018-07-25T18:30:25 | 142,408,505 | 2 | 2 | null | 2018-07-26T07:58:12 | 2018-07-26T07:58:12 | null | GB18030 | C++ | false | false | 11,900 | cpp | KG_Clip.cpp | #include "stdafx.h"
#include "KG_Clip.h"
const DWORD CLIP_FILE_MASK = 0x414E494D;
const DWORD CLIP_FILE_END_FLAG = 0xFFFFFFFF;
////////////////////////////////////////////////////////////////////////////////
KG_Clip::KG_Clip()
{
m_dwBoneNum = 0;
m_pAniFileData = NULL;
m_pAniFileHeader = NULL;
memset(m_pszBoneName, 0, sizeof(char *) * MAX_BONE_NUM);
memset(m_pAnimatedBoneRTS, 0, sizeof(RTS *) * MAX_BONE_NUM);
}
KG_Clip::~KG_Clip()
{
_Clear();
}
int KG_Clip::LoadFromFile(const char cszFileName[])
{
int nResult = false;
unsigned uFileSize = 0;
unsigned uSizeRead = 0;
IFile* piFile = NULL;
//DWORD dwFileEndFlag = 0;
unsigned uBufferSize = 0;
DWORD dwNumFrames = 0;
char *pszBoneNameBegin = NULL;
RTS *pBoneRTSBegin = NULL;
KGLOG_PROCESS_ERROR(cszFileName);
piFile = g_OpenFile(cszFileName);
KGLOG_PROCESS_ERROR(piFile);
uFileSize = piFile->Size();
KGLOG_PROCESS_ERROR(uFileSize > 0);
m_pAniFileData = new char[uFileSize];
KGLOG_PROCESS_ERROR(m_pAniFileData);
uSizeRead = piFile->Read(m_pAniFileData, uFileSize);
KGLOG_PROCESS_ERROR(uSizeRead == uFileSize);
//dwFileEndFlag = *(DWORD *)(m_pAniFileData + uFileSize - sizeof(DWORD));
//KGLOG_PROCESS_ERROR(dwFileEndFlag == CLIP_FILE_END_FLAG);
uBufferSize = uFileSize;
KGLOG_PROCESS_ERROR(uBufferSize > sizeof(AniFileHeaderInfo));
m_pAniFileHeader = (AniFileHeaderInfo *)m_pAniFileData;
KGLOG_PROCESS_ERROR(m_pAniFileHeader->dwMask == CLIP_FILE_MASK);
switch (m_pAniFileHeader->dwType)
{
case ANIMATION_BONE_RTS:
{
m_dwBoneNum = m_pAniFileHeader->BoneAni.dwNumBones;
KGLOG_PROCESS_ERROR(m_dwBoneNum < MAX_BONE_NUM);
uBufferSize -= sizeof(AniFileHeaderInfo);
KGLOG_PROCESS_ERROR(uBufferSize > m_dwBoneNum * MAX_BONENAME_LEN);
pszBoneNameBegin = m_pAniFileData + sizeof(AniFileHeaderInfo);
for (DWORD i = 0; i < m_dwBoneNum; i++)
{
m_pszBoneName[i] = pszBoneNameBegin;
pszBoneNameBegin += MAX_BONENAME_LEN;
}
uBufferSize -= m_dwBoneNum * MAX_BONENAME_LEN;
dwNumFrames = m_pAniFileHeader->BoneAni.dwNumFrames;
// file may end without CLIP_FILE_END_FLAG, so use '>=' instead of '>'
KGLOG_PROCESS_ERROR(uBufferSize >= sizeof(RTS) * dwNumFrames * m_dwBoneNum);
pBoneRTSBegin = (RTS *)pszBoneNameBegin;
for (DWORD i = 0; i < m_dwBoneNum; i++)
{
m_pAnimatedBoneRTS[i] = pBoneRTSBegin;
pBoneRTSBegin += dwNumFrames;
}
break;
}
default:
KGLogPrintf(KGLOG_INFO, "Ignore Animation Type %u", m_pAniFileHeader->dwType);
KG_PROCESS_ERROR(false);
}
m_sClipName = cszFileName;
nResult = true;
Exit0:
if (!nResult)
{
KG_DELETE_ARRAY(m_pAniFileData);
KGLogPrintf(KGLOG_INFO, "ani load failed %s", cszFileName);
}
KG_COM_RELEASE(piFile);
return nResult;
}
int KG_Clip::SkeletonCompare(KG_Bip *pBip, FILE *fpResultFile)
{
int nResult = false;
int nRetCode = false;
const char *cpszBoneName = NULL;
unsigned uBoneIndex = 0;
unsigned uBipBone = 0;
int nDismatchFlag = false;
KGLOG_PROCESS_ERROR(pBip);
KGLOG_PROCESS_ERROR(fpResultFile);
uBipBone = pBip->GetNumBone();
for (unsigned i = 0; i < uBipBone; i++)
{
cpszBoneName = pBip->GetBoneNameByIndex(i);
KGLOG_PROCESS_ERROR(cpszBoneName);
uBoneIndex = _FindBoneIndex(cpszBoneName);
KGLOG_PROCESS_ERROR(uBoneIndex != -1);
if (uBoneIndex != i)
{
nRetCode = _SwapBoneAnimationData(i, uBoneIndex);
KGLOG_PROCESS_ERROR(nRetCode);
nDismatchFlag = true;
}
}
if (nDismatchFlag)
{
nRetCode = _SaveNewFile();
KGLOG_PROCESS_ERROR(nRetCode);
nRetCode = fprintf(fpResultFile, "Adjust! %s\n", m_sClipName.c_str());
KGLOG_PROCESS_ERROR(nRetCode > 0);
}
nResult = true;
Exit0:
return nResult;
}
unsigned KG_Clip::GetBoneNum() const
{
unsigned uRetBoneNum = 0;
KGLOG_PROCESS_ERROR(m_pAniFileHeader);
uRetBoneNum = (unsigned)m_pAniFileHeader->BoneAni.dwNumBones;
Exit0:
return uRetBoneNum;
}
int KG_Clip::_Clear()
{
KG_DELETE_ARRAY(m_pAniFileData);
return true;
}
unsigned KG_Clip::_FindBoneIndex(const char cszBoneName[])
{
unsigned uResult = (unsigned)-1;
KGLOG_PROCESS_ERROR(cszBoneName);
for (DWORD i = 0; i < m_dwBoneNum; i++)
{
ASSERT(m_pszBoneName[i]);
if (!_stricmp(m_pszBoneName[i], cszBoneName))
{
return i;
}
}
Exit0:
return uResult;
}
int KG_Clip::_SwapBoneAnimationData(unsigned uBone1, unsigned uBone2)
{
char *pszBoneNameTemp = NULL;
RTS *pBoneRTSTemp = NULL;
ASSERT(uBone1 != uBone2);
ASSERT(m_pAnimatedBoneRTS[uBone1]);
ASSERT(m_pAnimatedBoneRTS[uBone2]);
pBoneRTSTemp = m_pAnimatedBoneRTS[uBone1];
m_pAnimatedBoneRTS[uBone1] = m_pAnimatedBoneRTS[uBone2];
m_pAnimatedBoneRTS[uBone2] = pBoneRTSTemp;
ASSERT(m_pszBoneName[uBone1]);
ASSERT(m_pszBoneName[uBone2]);
pszBoneNameTemp = m_pszBoneName[uBone1];
m_pszBoneName[uBone1] = m_pszBoneName[uBone2];
m_pszBoneName[uBone2] = pszBoneNameTemp;
return true;
}
int KG_Clip::_SaveNewFile()
{
int nResult = false;
size_t uWriteSize = 0;
FILE* fpFile = NULL;
DWORD dwNumFrames = 0;
fpFile = fopen(m_sClipName.c_str(), "wb");
KGLOG_PROCESS_ERROR(fpFile);
ASSERT(m_pAniFileHeader);
uWriteSize = fwrite(m_pAniFileHeader, sizeof(AniFileHeaderInfo), 1, fpFile);
KGLOG_PROCESS_ERROR(uWriteSize == 1);
for (DWORD i = 0; i < m_dwBoneNum; i++)
{
ASSERT(m_pszBoneName[i]);
uWriteSize = fwrite(m_pszBoneName[i], MAX_BONENAME_LEN, 1, fpFile);
KGLOG_PROCESS_ERROR(uWriteSize == 1);
}
dwNumFrames = m_pAniFileHeader->BoneAni.dwNumFrames;
for (DWORD i = 0; i < m_dwBoneNum; i++)
{
uWriteSize = fwrite(m_pAnimatedBoneRTS[i], sizeof(RTS) * dwNumFrames, 1, fpFile);
KGLOG_PROCESS_ERROR(uWriteSize == 1);
}
uWriteSize = fwrite(&CLIP_FILE_END_FLAG, sizeof(DWORD), 1, fpFile);
KGLOG_PROCESS_ERROR(uWriteSize == 1);
nResult = true;
Exit0:
if (fpFile)
{
fclose(fpFile);
fpFile = NULL;
}
if (!nResult)
{
KGLogPrintf(KGLOG_INFO, "save new clip failed %s", m_sClipName.c_str());
}
return nResult;
}
////////////////////////////////////////////////////////////////////////////////
int _GetAniFilePath(const char cszBipFile[], unsigned uAniFilePathSize, char szAniFilePath[])
{
int nResult = false;
char *pszFind = NULL;
char *pchFind = NULL;
char *pszBipFile = NULL;
unsigned uAniFilePathLength = 0;
ASSERT(cszBipFile);
ASSERT(uAniFilePathSize > 0);
ASSERT(szAniFilePath);
pszBipFile = (char *)cszBipFile;
pszFind = strstr(pszBipFile, "\\模型\\");
if (pszFind)
{
uAniFilePathLength = (unsigned)(pszFind - pszBipFile);
KGLOG_PROCESS_ERROR(uAniFilePathLength + sizeof("\\动作") <= uAniFilePathSize);
memcpy(szAniFilePath, pszBipFile, uAniFilePathLength);
strncpy(szAniFilePath + uAniFilePathLength, "\\动作", uAniFilePathSize - uAniFilePathLength);
szAniFilePath[uAniFilePathSize - 1] = '\0';
KG_PROCESS_SUCCESS(true);
}
pszFind = strstr(pszBipFile, "\\部件\\");
if (pszFind)
{
uAniFilePathLength = (unsigned)(pszFind - pszBipFile);
KGLOG_PROCESS_ERROR(uAniFilePathLength + sizeof("\\动作") <= uAniFilePathSize);
memcpy(szAniFilePath, pszBipFile, uAniFilePathLength);
strncpy(szAniFilePath + uAniFilePathLength, "\\动作", uAniFilePathSize - uAniFilePathLength);
szAniFilePath[uAniFilePathSize - 1] = '\0';
KG_PROCESS_SUCCESS(true);
}
pchFind = strrchr(pszBipFile, '\\');
if (pchFind)
{
uAniFilePathLength = (unsigned)(pchFind - pszBipFile);
KGLOG_PROCESS_ERROR(uAniFilePathLength < uAniFilePathSize);
memcpy(szAniFilePath, pszBipFile, uAniFilePathLength);
szAniFilePath[uAniFilePathLength] = '\0';
KG_PROCESS_SUCCESS(true);
}
KG_PROCESS_ERROR(false);
Exit1:
nResult = true;
Exit0:
return nResult;
}
int _GetAniList(const char cszBipFile[], vector<string> *pvecRetAniList)
{
int nResult = false;
int nRetCode = false;
char szCmd[MAX_PATH];
char szAniFileName[MAX_PATH];
FILE *fpFile = NULL;
char szAniFilePath[MAX_PATH];
ASSERT(cszBipFile);
ASSERT(pvecRetAniList);
nRetCode = _GetAniFilePath(cszBipFile, sizeof(szAniFilePath), szAniFilePath);
KG_PROCESS_ERROR(nRetCode);
nRetCode = snprintf(szCmd, sizeof(szCmd) - 1, "dir /s /b \"%s\\*.ani\" > temp_anilist.dat", szAniFilePath);
ASSERT((nRetCode > 0) && (nRetCode <= sizeof(szCmd) - 1));
szCmd[sizeof(szCmd) - 1] = '\0';
nRetCode = system(szCmd);
KG_PROCESS_ERROR(nRetCode == 0);
fpFile = fopen("temp_anilist.dat", "r");
KGLOG_PROCESS_ERROR(fpFile);
while (true)
{
char *pRetCode = fgets(szAniFileName, sizeof(szAniFileName) - 1, fpFile);
if (!pRetCode)
break;
szAniFileName[sizeof(szAniFileName) - 1] = '\0';
size_t uLen = strlen(szAniFileName);
ASSERT(uLen > 1);
size_t i = uLen - 1;
while (szAniFileName[i] == '\r' || szAniFileName[i] == '\n')
{
ASSERT(i > 0);
--i;
}
szAniFileName[i + 1] = '\0';
pvecRetAniList->push_back(szAniFileName);
}
nResult = true;
Exit0:
if (fpFile)
{
fclose(fpFile);
fpFile = NULL;
}
if (!nResult)
{
KGLogPrintf(KGLOG_INFO, "bip \"%s\" has none ani file", cszBipFile);
}
remove("temp_anilist.dat");
return nResult;
}
int AnalyseAni(vector<string> &vecBipName)
{
int nResult = false;
int nRetCode = false;
vector<string> vecAniList;
size_t uAniListSize = 0;
size_t uBipListSize = 0;
KG_Bip *pBip = NULL;
FILE *fpFile = NULL;
char szResultFileName[MAX_PATH];
time_t tmtNow = 0;
struct tm tmNow;
tmtNow = time(NULL);
localtime_r(&tmtNow, &tmNow);
nRetCode = snprintf(
szResultFileName, sizeof(szResultFileName) - 1,
"AniCheckResult_%d_%2.2d_%2.2d_%2.2d_%2.2d_%2.2d.txt",
tmNow.tm_year + 1900, tmNow.tm_mon + 1, tmNow.tm_mday,
tmNow.tm_hour, tmNow.tm_min, tmNow.tm_sec
);
ASSERT(nRetCode >0 && nRetCode < (sizeof(szResultFileName) - 1));
szResultFileName[sizeof(szResultFileName) - 1] = '\0';
fpFile = fopen(szResultFileName, "w");
KGLOG_PROCESS_ERROR(fpFile);
uBipListSize = vecBipName.size();
for (size_t i = 0; i < uBipListSize; i++)
{
vecAniList.clear();
nRetCode = _GetAniList(vecBipName[i].c_str(), &vecAniList);
if (!nRetCode)
continue;
KG_DELETE(pBip);
pBip = new KG_Bip;
KGLOG_PROCESS_ERROR(pBip);
nRetCode = pBip->LoadFromFile(vecBipName[i].c_str(), false);
if (!nRetCode)
{
nRetCode = fprintf(fpFile, "Bip load failed \"%s\" \n", vecBipName[i].c_str());
KGLOG_PROCESS_ERROR(nRetCode > 0);
continue;
}
uAniListSize = vecAniList.size();
for (size_t j = 0; j < uAniListSize; j++)
{
nRetCode = pBip->CheckClip(vecAniList[j].c_str(), fpFile);
if (!nRetCode)
continue;
}
}
nResult = true;
Exit0:
KG_DELETE(pBip);
if (fpFile)
{
fclose(fpFile);
fpFile = NULL;
}
return nResult;
}
|
7160782901afff5f3c79b12bbb34fe529c6e674b | 492976adfdf031252c85de91a185bfd625738a0c | /src/Game/AI/AI/aiFreezeInWaterSelect.h | 9d39fac121debbee2d5919bc58896b675066c2c1 | [] | no_license | zeldaret/botw | 50ccb72c6d3969c0b067168f6f9124665a7f7590 | fd527f92164b8efdb746cffcf23c4f033fbffa76 | refs/heads/master | 2023-07-21T13:12:24.107437 | 2023-07-01T20:29:40 | 2023-07-01T20:29:40 | 288,736,599 | 1,350 | 117 | null | 2023-09-03T14:45:38 | 2020-08-19T13:16:30 | C++ | UTF-8 | C++ | false | false | 637 | h | aiFreezeInWaterSelect.h | #pragma once
#include "Game/AI/AI/aiInWaterSelect.h"
#include "KingSystem/ActorSystem/actAiAi.h"
namespace uking::ai {
class FreezeInWaterSelect : public InWaterSelect {
SEAD_RTTI_OVERRIDE(FreezeInWaterSelect, InWaterSelect)
public:
explicit FreezeInWaterSelect(const InitArg& arg);
~FreezeInWaterSelect() override;
void enter_(ksys::act::ai::InlineParamPack* params) override;
void leave_() override;
void loadParams_() override;
protected:
// static_param at offset 0x58
const int* mIceBreakTime_s{};
// aitree_variable at offset 0x60
bool* mIsKeepFreeze_a{};
};
} // namespace uking::ai
|
7ef9e9be5fcf0a5cf576fde5e6646c59a42e60e7 | 58e631e84062a18a8202fb68f5cce2c754c0fe49 | /Runtime/Animation/SpriteSequenceAnimation.h | 771e7ad5354ab1ebae9b228a76b31e0c7df2bfe5 | [] | no_license | zhaosiwen1949/Fire_Game_Engine | e816215833cc5a3a006da0c257f0f447c2a7cbbc | f2c13c3f32765fd6df368649fccd1b67564cb3ec | refs/heads/main | 2023-07-06T18:55:12.437310 | 2021-08-06T01:38:12 | 2021-08-06T01:38:12 | 393,214,296 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 713 | h | SpriteSequenceAnimation.h | #pragma once
#include "Runtime/Serializer/Animation.serializer.h"
#include "Animation.h"
namespace Alice {
class SpriteSequenceAnimationKeyFrame : public AnimationKeyFrame {
public:
std::string mSpriteName;
void Init(const Serializer::SpriteSequenceAnimationKeyFrame&key_frame_data);
};
class SpriteSequenceAnimation :public AnimationUnit {
public:
AliceAny mAvatar;
virtual void OnUpdateStepAnimation(AnimationKeyFrame*keyframe);
virtual void OnUpdateLinearAnimation(float animation_time, AnimationKeyFrame*start_frame, AnimationKeyFrame*end_frame) {}
virtual void OnUpdateBezierAnimation(float animation_time, AnimationKeyFrame*start_frame, AnimationKeyFrame*end_frame) {}
};
} |
b64351a1ed0bba47780ea71c0ae1de534e6117d3 | 6e221c2bd267163d6f42ae2a7a9e39ae9e7929ff | /Chapter19/Space Invaders ++/SoundEngine.h | 8f6e8c000b355f912e47983add385a70d01924bd | [
"MIT"
] | permissive | PacktPublishing/Beginning-Cpp-Game-Programming-Second-Edition | b98db90eca4be9213f62b7e86f2b3f84a535e527 | df1d217b4479bb396741406789c75d178641be69 | refs/heads/master | 2023-02-07T19:16:44.456946 | 2023-01-30T10:09:49 | 2023-01-30T10:09:49 | 210,789,651 | 180 | 89 | MIT | 2022-11-17T06:47:57 | 2019-09-25T08:05:14 | C++ | UTF-8 | C++ | false | false | 597 | h | SoundEngine.h | #pragma once
#ifndef SOUND_ENGINE_H
#define SOUND_ENGINE_H
#include <SFML/Audio.hpp>
using namespace sf;
class SoundEngine
{
private:
SoundBuffer m_ShootBuffer;
SoundBuffer m_PlayerExplodeBuffer;
SoundBuffer m_InvaderExplodeBuffer;
SoundBuffer m_ClickBuffer;
Sound m_ShootSound;
Sound m_PlayerExplodeSound;
Sound m_InvaderExplodeSound;
Sound m_UhSound;
Sound m_OhSound;
Sound m_ClickSound;
public:
SoundEngine();
static void playShoot();
static void playPlayerExplode();
static void playInvaderExplode();
static void playClick();
static SoundEngine* m_s_Instance;
};
#endif |
8120afce8dd5276b1a2665526b3e4079e1894d53 | aa6e40d1731dd46d21a234924a7f95d4fd6bf558 | /src/ItemType.cpp | 329ee98dfde56ffb5beea2df11b2ebc1a499504b | [] | no_license | kmk324/Console-kakaotalk-system | 8cf42c220deb30921fb0dcef0c6e9e68b446413d | f45f5971529f6b868eaffcade229b2c9cc90c135 | refs/heads/master | 2020-03-23T19:31:37.887191 | 2018-07-23T09:03:42 | 2018-07-23T09:03:42 | 141,984,803 | 1 | 0 | null | null | null | null | UHC | C++ | false | false | 6,657 | cpp | ItemType.cpp |
#include "ItemType.h"
#include <string>
// Set user id from keyboard.
void ItemType::SetIdFromKB()
{
cout << "\tID : ";
cin >> m_Id;
}
// Set user name from keyboard.
void ItemType::SetNameFromKB()
{
cout << "\tName : ";
cin >> m_sName;
}
// Set user address from keyboard.
void ItemType::SetAddressFromKB()
{
cout << "\tPhoneAddress : ";
cin >> m_sAddress;
}
// Set user Birth from Keyboard.
void ItemType::SetBirthFromKB()
{
cout << "\tBirth : ";
cin >> m_sBirth;
}
// Set user Gender from Keyboard.
void ItemType::SetGenderFromKB()
{
cout << "\tGender : ";
cin >> m_sGender;
}
// Set user StatusMemo from Keyboard.
void ItemType::SetStatusMemoFromKB()
{
cout << "\tStatusMemo : ";
cin >> m_sStatusMemo;
}
// Set user Pw from Keyboard.
void ItemType::SetPwFromKB() // lab03에서 요구하는 Readpw함수.
{
cout << "\tPw : ";
cin >> m_Pw;
}
// Set user BGP from Keyboard.
void ItemType::SetBGPFromKB()
{
cout << "\tBGP : ";
cin >> m_BGP;
}
// Set user record from keyboard.
void ItemType::SetRecordFromKB() // lab03에서 요구하는 readMemberInfo함수.
{
SetIdFromKB();
SetNameFromKB();
SetAddressFromKB();
SetBirthFromKB();
SetGenderFromKB();
SetStatusMemoFromKB();
SetPwFromKB();
SetBGPFromKB();
}
// Read a record from file.
int ItemType::ReadDataFromFile(ifstream& fin)
{
fin >> m_Id;
fin >> m_sName;
fin >> m_sAddress;
fin >> m_sBirth;
fin >> m_sGender;
fin >> m_sStatusMemo;
fin >> m_Pw;
fin >> m_BGP;
return 1;
};
// Write a record into file.
int ItemType::WriteDataToFile(ofstream& fout)
{
fout << endl;
fout << m_Id << " ";
fout << m_sName << " ";
fout << m_sAddress << " ";
fout << m_sBirth << " ";
fout << m_sGender << " ";
fout << m_sStatusMemo << " ";
fout << m_Pw << " ";
fout << m_BGP;
return 1;
}
// Compare two itemtypes.
RelationType ItemType::CompareByID(const ItemType &data)
{
if (this->m_Id > data.m_Id)
return GREATER;
else if (this->m_Id < data.m_Id)
return LESS;
else
return EQUAL;
}
// operator << set.
/*
ItemType &operator <<(ostream &os, ItemType &ref)
{
cout << endl;
ref.DisplayRecordOnScreen();
return ref;
}
*/
// Compare two item types by item id.
bool ItemType::operator>(ItemType item)
{
return (this->GetId()>item.GetId());
} //return 1 if this.id > data.id, 0 if not.
bool ItemType::operator<(ItemType item)
{
return (this->GetId()<item.GetId());
} //return 1 if this.id > data.id, 0 if not.
// Compare two item types by item id.
bool ItemType::operator==(ItemType item)
{
return (this->GetId() == item.GetId());
} //return 1 if this.id == data.id, 0 if not.
// 파라미터 메세지의 리시버와 메세지를 셋팅한다.
void ItemType::GenerateMessage(MessageType& message)
{
message.SetReceiverFromKB();
message.SetMessageFromKB();
}
//파라미터의 메세지타입변수 message를 회원의 채트리스트에 add해준다.
void ItemType::AddMessageToChatList(MessageType message)
{
chatList.Add(message);
}
void ItemType::AddFriendToFriendList(FriendType Friend)
{
friendList.Add(Friend);
}
void ItemType::PrintGroupList()
{
FriendGroup temp;
friendGroupList.ResetList();
for (int i = 0; i< friendGroupList.GetLength(); i++)
{
friendGroupList.GetNextItem(temp);
temp.PrintGroupFriendList();
}
}
//친구그룹에 친구추가.
void ItemType::AddFriendToFriendGroupList()
{
string TempGroupName;// 추가할 친구 그룹의 이름;
cout << "추가할 친구 그룹의 이름을 입력하세요 : ";
cin >> TempGroupName;
FriendGroup* fg = new FriendGroup(TempGroupName);
//친구 목록 출력.
cout << "현재 그룹에 추가 가능한 사용자의 친구리스트는 아래와 같습니다. " << endl;
FriendType m_Array[MAXSIZE];
FriendType tempFriend;
friendList.ResetList();
for (int i = 0; i < friendList.GetLength(); i++)
{
friendList.GetNextItem(tempFriend);
m_Array[i] = tempFriend;
m_Array[i].DisplayRecordd();
cout << endl;
}
//친구 목록 출력.
while (1)
{
cout << "친구를 추가하는 중입니다. 추가할 아이디를입력하세요. 그만 두시려면 0을 입력.";
string TempAddFriendID;
cin >> TempAddFriendID;
tempFriend.SetID(TempAddFriendID);
if (friendList.Get(tempFriend) == 1)//1이면 찾음 ㄱㄱ
{
fg->getGroupFriendList()->Add(tempFriend);
}
else
{
cout << "그런 친구는 없습니다.";
}
if (TempAddFriendID == "0")
{
friendGroupList.Add(*fg);//그룹리스트에 추가.
delete fg; // 메모리해제
break;
}
}
}
//friendList에서 파라미터의 friend의 정보와 일치하는 친구가 있으면 삭제.
int ItemType::DeleteFriendFromFriendList(FriendType tempFriend)
{
FriendType Fren;
Fren = tempFriend;
if (friendList.Get(Fren)) //frend리스트에 일치하는 아이디가 있는지 확인.
{
friendList.Delete(Fren);
return 1;
}
return 0;
}
// 파라미터의 메세지를 GenerateMessage함수로 세팅해준후 AddMessageToChatList함수를 호출하여 그 메세지를 채트리스트에 add해준다.
MessageType ItemType::GetMessage(MessageType& message)
{
GenerateMessage(message);
AddMessageToChatList(message);
return message;
}
//로그인한 회원으로부터 그룹메세지를 생성하여 서버에 보낸다.
void ItemType::GetGroupMessage(MessageType& message,MessageType * temp)
{
//temp= new MessageType[MAXSIZE];
string tempGroupname;
PrintGroupList(); //그룹 리스트 출력
cout << "보낼 그룹의 이름을 입력하세요" << endl;
cin >> tempGroupname;
FriendGroup Temp;
friendGroupList.ResetList();
for (int i = 0; i < friendGroupList.GetLength(); i++)
{
friendGroupList.GetNextItem(Temp);
if (Temp.GetGroupname() == tempGroupname)
{
UnsortedLinkedList<FriendType>* TempGroupFriendList;
TempGroupFriendList = Temp.getGroupFriendList(); // 해당하는 그룹명의 그룹친구리스트를 불러옴.
FriendType TempFriend;
string TempFriendID;
string MessageContents;
int Count = 0;
cout << "그만 입력하시려면 -1을 입력" << endl;
while (1)
{
cout << "Message : ";
cin >> MessageContents;
message.SetMessage(MessageContents);
//message.SetMessageFromKB();
if (message.GetMessage() == "-1")
{
break;
}
TempGroupFriendList->ResetList();
for (int i = Count; i < Count+TempGroupFriendList->GetLength(); i++)
{
TempGroupFriendList->GetNextItem(TempFriend);
TempFriendID = TempFriend.GetID();
message.SetReceiver(TempFriendID);
message.SetGroupNameInMessage(tempGroupname);
AddMessageToChatList(message);
temp[i] = message;
}
Count = Count+ 3;
}
}
else
{ }
}
}
|
e2e41b7f858d4d1cbf0bf8496321d2e9fe93a79a | 06e0dacef819a57e0677b91d5035c61c3cf3884e | /Windows/Eudora71/DirectoryServices/DirServ/src/query.cpp | da54794c74cc6f2ad09242189360d248774705f8 | [
"MIT"
] | permissive | rafsanofficial/EUDORA | ca57ec9f9d2e273b3521254fc636adbc8e4c51c6 | bf43221f5663ec2338aaf90710a89d1490b92ed2 | refs/heads/master | 2023-07-13T20:58:53.434990 | 2021-08-20T11:30:32 | 2021-08-20T11:30:32 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,371 | cpp | query.cpp | /******************************************************************************/
/* */
/* Name : QUERY.CPP */
/* Date : 8/7/1997 */
/* Author : Jim Susoy */
/* Notice : (C) 1997 Qualcomm, Inc. - All Rights Reserved */
/* Copyright (c) 2016, Computer History Museum
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to
the limitations in the disclaimer below) 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 Computer History Museum nor the names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE
COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 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. */
/* Desc. : Directory Services Query Object implementation */
/* */
/******************************************************************************/
#pragma warning(disable : 4514)
#include <afx.h>
#include <ole2.h>
#include "DebugNewHelpers.h"
#include "ISched.h"
#include "factory.h"
#include "record.h"
#include "query.h"
#include "resource.h"
#include "QCUtils.h"
extern long g_cComponents;
//IUnknown * CQuery::CreateInstance()
//{
// CDirServ *pDS = new CDirServ;
//
// if(pDS) {
// return(static_cast<IUnknown *>(pDS));
// }
// return(NULL);
//}
CQuery::CQuery() : m_cRef(1)
{
m_pSched = NULL;
m_pRecList = NULL;
m_pDBList = NULL;
m_pDBFailedList = NULL;
m_nDBCount = 0;
m_pszSearch = NULL;
m_nField = DS_UNKNOWN;
m_dwFlags = 0;
m_pStartCB = NULL;
m_pStartData = NULL;
m_pWaitCB = NULL;
m_pWaitData = NULL;
m_bParentStarted = FALSE;
m_bCallerWaiting = FALSE;
m_LastError = QUERY_OK;
InterlockedIncrement(&g_cComponents);
}
/* Static */
HRESULT CQuery::CreateInstance(IUnknown **pUnk)
{
CQuery *pQuery = DEBUG_NEW_NOTHROW CQuery;
if(!pQuery) {
*pUnk = NULL;
return E_OUTOFMEMORY;
}
*pUnk = static_cast<IUnknown *>(pQuery);
return S_OK;
}
CQuery::~CQuery()
{
if(m_pSched) {
m_pSched->Cancel();
m_pSched->Release();
}
if(m_pDBList) m_pDBList->Release();
if(m_pDBFailedList) m_pDBFailedList->Release();
if(m_pRecList) m_pRecList->Release();
delete [] m_pszSearch;
m_pRecList = NULL;
m_pDBList = NULL;
m_pszSearch = NULL;
m_pSched = NULL;
InterlockedDecrement(&g_cComponents);
}
HRESULT __stdcall CQuery::QueryInterface(REFIID iid, void** ppv)
{
if (iid == IID_IUnknown)
*ppv = static_cast<IUnknown*>(this);
else
if (iid == IID_IDirServ)
*ppv = static_cast<IDSQuery*>(this);
else {
*ppv = NULL;
return E_NOINTERFACE;
}
reinterpret_cast<IUnknown*>(*ppv)->AddRef();
return S_OK;
}
ULONG __stdcall CQuery::AddRef()
{
return InterlockedIncrement(&m_cRef);
}
ULONG __stdcall CQuery::Release()
{
if (0 == InterlockedDecrement(&m_cRef)) {
delete this;
return 0;
}
return m_cRef;
}
/* Static */
void CQuery::QentFreeCB(LPITEM pItem, LPVOID /* pUser */)
{
LPQENT pQent = (LPQENT) pItem;
if(pQent) {
if(pQent->pQuery) {
pQent->pQuery->Cancel();
pQent->pQuery->Release();
pQent->pQuery = NULL;
}
if(pQent->pDatabase) {
pQent->pDatabase->Release();
pQent->pDatabase= NULL;
}
delete pQent;
}
}
void CQuery::RecEntFreeCB(LPITEM pItem, LPVOID /* pUser */)
{
LPRECENT pRec = (LPRECENT) pItem;
if(pRec) {
if(pRec->pRec) pRec->pRec->Release();
pRec->pRec = NULL;
delete pRec;
}
}
HRESULT __stdcall CQuery::AddDatabase(IDSDatabase *pDatabase)
{
HRESULT hErr;
IDSPConfig *pConfig = NULL;
/* Make sure we have been initiliazed!!! */
if(!m_pSched || !m_pDBList)
return E_FAIL;
/* Create the wrapper for this query object */
LPQENT pQent = DEBUG_NEW_NOTHROW QENT;
if(!pQent)
return E_OUTOFMEMORY;
/* Stuff the required fields */
memset(pQent,0,sizeof(QENT));
pQent->pcQuery = this;
pQent->pDatabase = static_cast<CDSDatabase *>(pDatabase);
pConfig = pQent->pDatabase->GetWrappedInterface();
/* Don't forget to keep this database entry around! */
pQent->pDatabase->AddRef();
/* Create a protocol level IDSPQuery object, initialize it and add it to */
/* out list of query objects for this query */
if(SUCCEEDED(hErr = pConfig->CreateObject(IID_IDSPQuery,(void **) &(pQent->pQuery)))) {
if(SUCCEEDED(hErr = pQent->pQuery->InitQuery(m_pszSearch,m_dwFlags,m_nField))) {
m_pDBList->Attach(pQent);
}
}
return hErr;
}
HRESULT __stdcall CQuery::Initialize(LPSTR pszSearch,DWORD dwFlags, DS_FIELD nField)
{
HRESULT hErr;
if(NULL == (m_pszSearch = SafeStrdupMT(pszSearch)))
return E_OUTOFMEMORY;
/* Create our query list object and our scheduling object */
if(SUCCEEDED(hErr = CoCreateInstance(CLSID_IListMan,NULL,CLSCTX_INPROC_SERVER,IID_IListMan,(void **) &m_pDBList))) {
if(SUCCEEDED(hErr = CoCreateInstance(CLSID_IListMan,NULL,CLSCTX_INPROC_SERVER,IID_IListMan,(void **) &m_pDBFailedList))) {
if(SUCCEEDED(hErr = CoCreateInstance(CLSID_IListMan,NULL,CLSCTX_INPROC_SERVER,IID_IListMan,(void **) &m_pRecList))) {
m_pDBList->Initialize(CQuery::QentFreeCB,NULL);
m_pDBFailedList->Initialize(CQuery::QentFreeCB,NULL);
m_pRecList->Initialize(CQuery::RecEntFreeCB,NULL);
if(SUCCEEDED(hErr = CoCreateInstance(CLSID_ISchedule,NULL,CLSCTX_INPROC_SERVER,IID_ISchedule,(void **) &m_pSched))) {
m_nField = nField;
m_dwFlags = dwFlags;
return S_OK;
}
}
}
}
return hErr;
}
HRESULT __stdcall CQuery::SetSearchBase(LPSTR /* pszSearchBase */)
{
return E_NOTIMPL;
}
/* Protected */
void __stdcall CQuery::PushErrorRecord(QUERY_STATUS qErr,LPQENT pQent)
{
LPRECENT pRec = DEBUG_NEW_NOTHROW RECENT;
char szBuf[512];
szBuf[0] = '\0';
pQent->pQuery->GetErrorString(qErr,szBuf,sizeof(szBuf));
if(pRec) {
memset(pRec,0,sizeof(RECENT));
if(NULL != (pRec->pRec = DEBUG_NEW_NOTHROW CErrorRecord(qErr,szBuf))) {
m_pRecList->Attach(pRec);
}
}
}
/* static */
void CQuery::StartCB(LPVOID pCtx)
{
LPQENT pQent = (LPQENT) pCtx;
register CQuery *pcQuery = pQent->pcQuery;
/* If the start failed for this query object, push an error record */
if(QUERY_OK != (pcQuery->m_LastError = pQent->pQuery->GetLastError())) {
LPQENT pTmp = NULL;
pcQuery->PushErrorRecord(pcQuery->m_LastError,pQent);
/* NOTE: We need to keep the query object around until we die, so move */
/* it to another list. The list and its contents are toasted in */
/* our destructor. */
if(NULL != (pTmp = (LPQENT)pcQuery->m_pDBList->Unlink(pQent))) {
pcQuery->m_pDBFailedList->Attach(pTmp);
}
pQent = NULL;
}
else {
pQent->nState = QSTATE_STARTED;
}
/* Call the parent on the first run through */
if(FALSE == pcQuery->m_bParentStarted)
pcQuery->m_pSched->Schedule(pcQuery->m_pStartCB,pcQuery->m_pStartData);
else {
if(TRUE == pcQuery->m_bCallerWaiting && pQent) {
pQent->pQuery->WaitForRecord(CQuery::WaitCB,(void *) pQent);
pQent->nState = QSTATE_WAITING;
}
}
}
void __stdcall CQuery::Start(DBQUERYCB pCB,LPVOID pCtx)
{
int i;
LPQENT pQent = NULL;
DWORD dwCount = 0;
m_pStartCB = pCB;
m_pStartData = pCtx;
/* Get count of query objects to start */
dwCount = m_pDBList->Count();
pQent = (LPQENT) m_pDBList->Head();
for(i=0;i<(int) dwCount;i++) {
pQent->nState = QSTATE_STARTING;
pQent->pQuery->Start(CQuery::StartCB,(void *)pQent);
pQent = (LPQENT) ILIST_ITEMNEXT(pQent);
}
return;
}
/* static */
void CQuery::WaitCB(LPVOID pCtx)
{
LPQENT pQent = (LPQENT) pCtx;
IDSPRecord *pRec = NULL;
QUERY_STATUS qErr;
/* Did we get something??? */
pQent->nState = QSTATE_IDLE;
if(QUERY_OK == (qErr = pQent->pQuery->GetRecord(&pRec))) {
LPRECENT pRecEnt = DEBUG_NEW_NOTHROW RECENT;
if(pRecEnt) {
memset(pRecEnt,0,sizeof(RECENT));
pRecEnt->pRec = pRec;
pQent->pcQuery->m_pRecList->Attach(pRecEnt);
if(TRUE == pQent->pcQuery->m_bCallerWaiting) {
pQent->pcQuery->m_bCallerWaiting = FALSE;
pQent->pcQuery->m_pSched->Schedule(pQent->pcQuery->m_pWaitCB,pQent->pcQuery->m_pWaitData);
}
}
}
/* Either the query is done, or there was an error */
else {
CQuery *pQuery = pQent->pcQuery;
/* Remove the query object from our list so we won't reschedule it */
pQuery->m_pDBList->DeleteItem(pQent);
/* If the caller is waiting and all the queries are done, call 'em */
if(TRUE == pQuery->m_bCallerWaiting && 0 == pQuery->m_pDBList->Count()) {
pQuery->m_bCallerWaiting = FALSE;
pQuery->m_pSched->Schedule(pQuery->m_pWaitCB,pQuery->m_pWaitData);
}
}
}
void __stdcall CQuery::WaitForRecord(DBQUERYCB pCB,LPVOID pCtx)
{
LPQENT pQent = NULL;
DWORD dwCount = 0;
DWORD i;
m_pWaitCB = pCB;
m_pWaitData = pCtx;
/* If we have records in our queue, or all the Queries are done dispatch */
/* the caller CB and return. As Queries finish, the objects are Released */
/* and removed from our list. So if the list is empty, we're done bud! */
if(0 != m_pRecList->Count() || 0 == m_pDBList->Count()) {
m_pSched->Schedule(m_pWaitCB,m_pWaitData);
return;
}
/* Otherwise, we need more data! */
pQent = (LPQENT) m_pDBList->Head();
dwCount = m_pDBList->Count();
for(i=0;i<dwCount;i++) {
/* If the query has been started and is not currently waiting */
if(QSTATE_STARTING != pQent->nState && QSTATE_WAITING != pQent->nState) {
pQent->pQuery->WaitForRecord(CQuery::WaitCB,(void *) pQent);
pQent->nState = QSTATE_WAITING;
}
pQent = (LPQENT) ILIST_ITEMNEXT(pQent);
}
m_bCallerWaiting = TRUE;
return;
}
QUERY_STATUS __stdcall CQuery::GetRecord(IDSPRecord **ppRecord)
{
LPRECENT pRec = NULL;
/* If there is a record to return, give it to them */
if(NULL != (pRec = (LPRECENT) m_pRecList->Pop())) {
pRec->pRec->AddRef();
*ppRecord = pRec->pRec;
RecEntFreeCB((LPITEM)pRec,NULL);
return QUERY_OK;
}
/* If there are no more query objects, we are done... */
if(!m_pDBList->Count())
return QUERY_DONE;
/* Otherwise we are waiting for more data... */
return QUERY_WOULDBLOCK;
}
void __stdcall CQuery::Cancel()
{
DWORD dwCount = 0;
LPQENT pQent = NULL;
DWORD i;
/* Send Cacnel() to all open query objects */
dwCount = m_pDBList->Count();
pQent = (LPQENT) m_pDBList->Head();
for(i=0;i<dwCount;i++) {
pQent->pQuery->Cancel();
pQent = (LPQENT) ILIST_ITEMNEXT(pQent);
}
return;
}
QUERY_STATUS __stdcall CQuery::GetLastError()
{
return m_LastError;
}
HRESULT __stdcall CQuery::GetErrorString(QUERY_STATUS /* nCode */, LPSTR /* pszBuffer */, int /* nlen */)
{
return E_NOTIMPL;
}
|
85269e795382c79f3c5b8d5c85d83a96e72d8e0f | c50a92029877fa3ef3f5c18e8d88506b7eee1c7f | /CodeSignal/Arcade/Intro/17-arrayChange.cpp | ab2a908b3b65247423181bbf1e7d92ee22b0c571 | [
"Unlicense"
] | permissive | phoemur/competitive-programming | 4025995b7904ed431e03316ecf5270e976fa9275 | 8963e450352aac660287551c28c113e2bf1ba38c | refs/heads/master | 2023-08-09T23:43:03.237312 | 2023-08-06T22:45:50 | 2023-08-06T22:45:50 | 145,256,889 | 8 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 943 | cpp | 17-arrayChange.cpp | /*You are given an array of integers. On each move you are allowed to increase exactly one of its element by one. Find the minimal number of moves required to obtain a strictly increasing sequence from the input.
Example
For inputArray = [1, 1, 1], the output should be
arrayChange(inputArray) = 3.
Input/Output
[execution time limit] 0.5 seconds (cpp)
[input] array.integer inputArray
Guaranteed constraints:
3 ≤ inputArray.length ≤ 105,
-105 ≤ inputArray[i] ≤ 105.
[output] integer
The minimal number of moves needed to obtain a strictly increasing sequence from inputArray.
It's guaranteed that for the given test cases the answer always fits signed 32-bit integer type.
*/
int arrayChange(std::vector<int> v) {
unsigned moves=0;
for (unsigned i=0; i<v.size()-1; ++i) {
while (v[i+1] <= v[i]) {
++v[i+1];
++moves;
}
}
return moves;
}
|
802b665ecd8fad98b71f0c4f614e6cb3d641a720 | d08eaa20f397418d5ea31d896476f4c508ff0db8 | /Project25/Project25/Source.cpp | 50a5ab6734af7fcfb7c756ac77eeb8ca2bb0ba3f | [] | no_license | TaniaAAAAAAA/Home-task | 9355f247b441ec356aaa0feb63431296166d1c21 | e6cdcbd466e5e24854bee25bb6dda001d646f8b9 | refs/heads/master | 2022-02-23T23:22:02.240128 | 2019-08-19T19:34:50 | 2019-08-19T19:34:50 | 192,885,275 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,141 | cpp | Source.cpp | #include<iostream>
#include<ctime>
using namespace std;
int main()
{
srand(unsigned(time(NULL)));
const int SIZE = 10;
int mas[SIZE][SIZE];
for(int i = 0; i < SIZE; i++)
{
for(int j = 0; j < SIZE; j++)
{
mas[i][j] = rand() % 50 + 1;
}
}
for (int i = 0; i < SIZE; i++)
{
for (int j = 0; j < SIZE; j++)
{
cout<<"mas ["<<i<<"]["<<j<<"] = "<<mas[i][j]<<endl;
}
cout << "\n";
}
cout << "==========================>>\n";
int min = mas[0][0];
for (int i = 0; i < SIZE; i++)
{
for (int j = 0; j < SIZE; j++)
{
if (mas[i][j] <min)
{
min = mas[ i ][ j ];
}
}
}
cout << " min = " << min<<endl;
cout << "==========================>>\n";
int tmp = 0;
for (int i = 0; i < SIZE; i++)
{
for (int j = 0; j < SIZE; j++)
{
if (min=mas[i][j])
{
tmp = mas[0][0];
mas[0][0] = mas[i][j];
mas[i][j] = tmp;
}
}
}
for (int i = 0; i < SIZE; i++)
{
for (int j = 0; j < SIZE; j++)
{
cout << "mas [" << i << "][" << j << "] = " << mas[i][j] << endl;
}
cout << "\n";
}
cout << "==========================>>\n";
system("pause");
return 0;
} |
55caac9218b9cbc21088e307de57001ea634376a | 73f341280eb9524ce6396966064e79d13d465987 | /src/TfCreator.h | 1d6c6f7e71fda2863bb1cd40a5c6358421e45c72 | [
"MIT",
"ISC"
] | permissive | raphaelmenges/Voraca | 29b42d3adf3822473c324f6d1a5b557ad825af1f | 03bcffecaba70d03f6226551b227caceab78f8af | refs/heads/master | 2021-01-10T05:00:07.207333 | 2016-08-11T14:38:21 | 2016-08-11T14:38:21 | 52,303,800 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,156 | h | TfCreator.h | /**************************************************************************
* Voraca 0.97 (VOlume RAy-CAster)
**************************************************************************
* Copyright (c) 2016, Raphael Philipp Menges
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**************************************************************************/
/*
* TfCreator
*--------------
* Manages creation, loading and saving of transferfunctions.
*
*/
#ifndef TFCREATOR_H_
#define TFCREATOR_H_
#include "OpenGLLoader/gl_core_3_3.h"
#include "GLFW/glfw3.h"
#include "glm/glm.hpp"
#include "RapidXML/rapidxml.hpp"
#include "RapidXML/rapidxml_print.hpp"
#include <string>
#include <fstream>
#include <iostream>
#include <sstream>
#include <vector>
#include "Logger.h"
#include "Transferfunction.h"
#include "CreatorHelper.h"
const std::string TFCREATOR_PATH = std::string(DATA_PATH) + "/Transferfunctions/";
class TfCreator
{
public:
TfCreator();
~TfCreator();
/** Creates new transferfunction */
Transferfunction* create(GLint handle, std::string name);
/** Writes transferfunction to XML-File */
GLboolean writeToFile(Transferfunction* pTransferfunction, GLboolean overwriteExisting);
/** Reads transferfunction from XML-File, assigns handle to it */
Transferfunction* readFromFile(std::string name, GLint handle);
protected:
/** Write methods */
void appendTfPoint(TfPoint* pTfPoint, rapidxml::xml_document<>* pDoc, rapidxml::xml_node<>* pParent);
void appendNormalTfPoints(std::vector<TfPoint>* pTfPoints, rapidxml::xml_document<>* pDoc, rapidxml::xml_node<>* pParent);
void appendPoint(glm::vec2 point, rapidxml::xml_document<>* pDoc, rapidxml::xml_node<>* pParent);
void appendLeftControlPoint(glm::vec2 leftControlPoint, rapidxml::xml_document<>* pDoc, rapidxml::xml_node<>* pParent);
void appendRightControlPoint(glm::vec2 rightControlPoint, rapidxml::xml_document<>* pDoc, rapidxml::xml_node<>* pParent);
/** Read methods */
void extractTfPoint(rapidxml::xml_node<>* pNode, TfPointLocation location, GLint tfPointHandleCounter, Transferfunction* pTransferfunction);
glm::vec2 extractPoint(rapidxml::xml_node<>* pNode, Transferfunction* pTransferfunction);
glm::vec2 extractLeftControlPoint(rapidxml::xml_node<>* pNode, Transferfunction* pTransferfunction);
glm::vec2 extractRightControlPoint(rapidxml::xml_node<>* pNode, Transferfunction* pTransferfunction);
};
#endif
|
c8eb007f317f672626ca15f49ae43cae445051c8 | eb9c1dc78432e67d7fc89407652b605b177af97c | /questions/careercup/level_print.cpp | 299b6e5102532d9b3edae579590269a8fa74f7f4 | [] | no_license | raghu-yemmanuru/code4fun | 1a8e2550681abe60cf0b7077db11c2d453f3c0ba | 19422b93848b8b2c26fa7978f876b2a264c56471 | refs/heads/master | 2020-04-04T21:48:54.262098 | 2015-02-24T22:19:28 | 2015-02-24T22:19:28 | 29,117,492 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,141 | cpp | level_print.cpp | #include <iostream>
#include <queue>
using namespace std;
struct node {
int data;
node *left,*right;
node(int _data):data(_data),left(NULL),right(NULL){}
};
void levelPrint(node *root) {
queue<node *> current_level, next_level;
node *tmp;
if (!root) {
return;
}
current_level.push(root);
while (true) {
while(!current_level.empty()) {
tmp = current_level.front();
cout << tmp->data << " ";
if (tmp->left) {
next_level.push(tmp->left);
}
if (tmp->right) {
next_level.push(tmp->right);
}
current_level.pop();
}
cout << endl;
swap(current_level,next_level);
if (current_level.empty())
break;
}
}
int main () {
node *root = new node(1);
root->left = new node(2);
root->left->left = new node(4);
root->left->right = new node(6);
root->left->left->left = new node(5);
root->right = new node(3);
root->right->right = new node(7);
root->right->right->right = new node(8);
levelPrint(root);
}
|
e3b4364caaf1fc6861bf37351b69047f3514b1cc | 27d802d95b1feb231ef817abfb6b3ad9b428fa23 | /Recursion/even_before_odd.cpp | 2c3d5e8a750d859f7013e32dc1e3788c715fe27f | [] | no_license | virtualvector/DataStructures | 4f052625a0f58c2a29188d538856939e75ca2de2 | afad481823a71e14cbf2557faa483572cd4f1891 | refs/heads/master | 2021-01-23T05:10:12.585018 | 2018-05-31T10:33:38 | 2018-05-31T10:33:38 | 92,958,650 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 231 | cpp | even_before_odd.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
vector<int> v {1,2,3,4,5,6};
sort(v.begin(),v.end(),[](int a,int b)->bool{
if(a%2==0) return true;
});
for(auto& x: v)cout<<x<<" ";
return 0;
}
|
5d10b5d804e091a66820bef3417933a696555d02 | cf64d8d2d02661f0635b6e44c4d0903965eebe2e | /Round 526 (Div. 2)/C.cpp | 691cb7773612887944cb9cc3a483dbadf98d1383 | [] | no_license | LavishGulati/Codeforces | 469b741855ce863877e0f6eb725bbe63bef0b91b | 59756c87e37f903a0e8c84060478207d09b1bad2 | refs/heads/master | 2023-08-30T22:46:23.533386 | 2023-08-21T11:26:18 | 2023-08-21T11:26:18 | 145,226,865 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,576 | cpp | C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unordered_map<int, int> umapii;
typedef unordered_map<int, bool> umapib;
typedef unordered_map<string, int> umapsi;
typedef unordered_map<string, string> umapss;
typedef map<string, int> mapsi;
typedef map<pair<int, int>, int> mappiii;
typedef map<int, int> mapii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define it iterator
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define MOD 1000000007
#define MAX 100005
string s;
ll memo[MAX][2][2];
ll find(ll id, bool chooseA, ll n, bool size){
if(id == n){
if(size){
return 1;
}
else return 0;
}
ll x, y;
if(chooseA) x = 1;
else x = 0;
if(size) y = 1;
else y = 0;
if(memo[id][x][y] != -1) return memo[id][x][y];
if(chooseA){
if(s[id] != 'a') memo[id][x][y] = find(id+1, true, n, size);
else{
ll a = find(id+1, false, n, true);
ll b = find(id+1, true, n, size);
memo[id][x][y] = (a+b)%MOD;
}
}
else{
if(s[id] == 'b') memo[id][x][y] = find(id+1, true, n, size);
else memo[id][x][y] = find(id+1, false, n, size);
}
return memo[id][x][y];
}
int main(){
cin >> s;
ll n = s.length();
for(ll i = 0; i < MAX; i++){
for(ll j = 0; j < 2; j++){
memo[i][j][0] = -1;
memo[i][j][1] = -1;
}
}
cout << find(0, true, n, false) << endl;
}
|
c871100f0c5c879faab85eaae6567741ea48aa63 | 07252a3d5df11c068af2ef484c6207452110844d | /Shortest_path.cpp | 175842813c92981195c9abdd2e9c6a89ef800779 | [] | no_license | neerav5151/Code-dump | ce08f30ac2a5d2df324b6786c5392b3b64c59a92 | e6ae51dbd8941ef9eb1bd64f55ba1ab8f180a094 | refs/heads/master | 2023-09-02T12:44:05.196242 | 2021-10-19T16:31:54 | 2021-10-19T16:31:54 | 414,106,864 | 0 | 0 | null | 2021-10-20T19:13:07 | 2021-10-06T07:10:25 | C++ | UTF-8 | C++ | false | false | 3,484 | cpp | Shortest_path.cpp | // BELLMAN FORD ALGORITHM FOR SHORTEST PATH IN WEIGHTED DIRECTED GRAPH
void bellman( vp v[], ll s, ll n) {
vl dist(n, INF), par(n, -1) ;
dist[s] = 0 ;
int xl = -1 ;
ff(j, 0, n - 1) {
ff(i, 0, n) {
for (auto x : v[i]) {
ll cur_dist = x.f ;
ll v = x.s ;
if (dist[v] > cur_dist + dist[i]) {
dist[v] = cur_dist + dist[i] ; // updating distance.
par[v] = i ; // updating parent for retrieval of path.
xl = v ;
}
}
}
// printing shortest distance after every iteration.
cout << j << "\n" ;
for (auto x : dist)cout << x << " " ;
cout << "\n" ;
}
cout << xl << " cy \n" ;
xl = par[xl] ;
bool ch = 0 ;
ff(i, 0, n) {
for (auto x : v[i]) {
ll cur_dist = x.f ;
ll v = x.s ;
if (dist[v] > cur_dist + dist[i]) {
dist[v] = -INF ; // negative cycle exist to this node
ch = 1 ;
}
// for (auto x : dist) {
// if (x == -INF) cout << "-x " ;
// else cout << x << " " ;
// } cout << "\n" ;
}
}
// int chh = 0 ;
if (ch) cout << "Negative cycle exists\n" ;
// if (par[n - 1] == -1) { cout << "No PAth Exist\n" ;}
// else {
// for ( int i = 5; i != 0; i = par[i]) {
// // if (ch and i == xl and chh) break ;
// // chh = 1 ;
// cout << i << "\n" ; // path printed in reverse order
// }
// }
for (auto x : dist) cout << x << " " ;
}
void bellmanford( vector < vl > & v, ll s, ll n ) {
vl dist(n, INF), par(n, -1) ;
dist[s] = 0, par[s] = -1 ;
ff(k , 0, n - 1) {
ff(i, 0, n) {
ff(j, 0, n) {
if (dist[i] != INF and v[i][j] and dist[j] > dist[i] + v[i][j]) {
dist[j] = dist[i] + v[i][j] ;
par[j] = i ;
}
}
}
}
bool ch = false ;
ff(k , 0, n - 1) {
ff(i, 0, n) {
ff(j, 0, n) {
if ( v[i][j] and dist[j] - v[i][j] > dist[i]) {
dist[j] = -INF ;
ch = 1 ;
}
}
}
}
if (ch) cout << "-VE CYCLE EXISTS !\n" ;
cout << "DISTANCE ARRAY \n" ;
for (int i = 0; i < n; i++)
if (i != s)
cout << s << " - " << i << "\t" << dist[i] << endl;
cout << "\nPARENT ARRAY \n" ;
for (auto x : par) cout << x << " " ;
cout << "\n" ;
//printing source
if (par[n - 1] == -1) cout << "NO PATH EXISTS\n" ;
else {
for (ll i = n - 1; i != -1; i = par[i]) {
cout << i ;
if (i != s)cout << " <--- " ;
}
}
}
void floyd_warshall( vector < vl > v, ll n) {
std::vector<vl> dp = v, par(n, vl(n, -1));
ff(i, 0, n) {
ff(j, 0, n) par[i][j] = j ;
}
ff(k, 0, n) {
ff(i, 0, n) {
ff(j, 0, n) {
if ( dp[i][k] < INF and dp[k][j] < INF) {
if (dp[i][j] > dp[i][k] + dp[k][j]) {
dp[i][j] = dp[i][k] + dp[k][j] ;
par[i][j] = par[i][k] ;
}
}
}
}
}
bool ch = false ;
ff(i, 0, n) {
if (dp[i][i] < 0) {
ch = 1 ;
break ;
}
}
if (ch) cout << "Negative CYCLE EXISTS\n" ;
cout << "Shortest path matrix\n" ;
ff(i, 0, n) {
ff(j, 0, n) {
cout << dp[i][j] << " " ;
} cout << "\n" ;
}
cout << "\nPARENT ARRAY\n" ;
ff(i, 0, n) {
ff(j, 0, n) {
cout << par[i][j] + 1 << " " ;
} cout << "\n" ;
}
cout << "\nretrieval OF PATH\n" ;
ll s = 4 , e = 1 ;
--s , --e ;
if (par[s][e] == e) return ;
while ( s != e) {
cout << s + 1 << " <--- " ;
s = par[s][e] ;
} cout << ++e ;
}
|
a3480caf37c71d6169b287b9b33d942742a85c8f | 2506e551fa32e24a10f2859aba80c607abdf1ed5 | /DatastructPractice/DatastructPractice/myqueue.h | 5f3dc4bf358c6e16b5de4e9b310babe1cc9db1d8 | [] | no_license | MGODY/DataStruct | ee3c2a4a011961a717b40bb7968c1f92ee2d0f3f | 37f5f36b29e937b995057654e9e1ac9941d1e1f0 | refs/heads/master | 2021-01-19T17:31:24.881271 | 2017-08-26T05:08:21 | 2017-08-26T05:08:21 | 101,067,542 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 590 | h | myqueue.h | #ifndef MYQUEUE_H
#define MYQUEUE_H
#include"Vector.h"
#include"list.h"
#include"mystd.h"
#include<initializer_list>
MYSTD_BEGIN
template<typename T>
class Queue:protected mystd::List<T>
{
public:
Queue(std::initializer_list<T> lst) :List<T>(lst)
{
}
Queue() :List<T>()
{
}
const T&front()const
{
return mystd::List<T>::front();
}
void push(const T& t_elem)
{
this->pushback(t_elem);
}
void pop()
{
this->popfront();
}
size_t size()
{
return mystd::List<T>::size();
}
bool empty()
{
return mystd::List<T>::empty();
}
};
MYSTD_END
#endif // !MYQUEUE_H
|
ea33639c96bc025fdb813f453151c995546b3aac | dcc1cdb364e29072329455419aa37b9815f63d92 | /src/VoxelTypeClassifier.cpp | 19e318faf143d861ca2959a98589c1bd58a4439a | [
"MIT"
] | permissive | tmichi/mivol | 9912bcf4c1b7179acac71d1a4b8672b0404c1894 | 89131e7ad75e0acba5e03b6bb26095e32bb70e43 | refs/heads/master | 2021-01-09T05:58:55.121020 | 2016-05-15T03:41:16 | 2016-05-15T03:41:16 | 34,662,873 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,782 | cpp | VoxelTypeClassifier.cpp | /**
* @file VoxelTypeClassifier.hpp
* @author Takashi Michikawa <michikawa@acm.org>
*/
#ifndef MI_VOXEL_TYPE_CLASSIFIER_HPP
#define MI_VOXEL_TYPE_CLASSIFIER_HPP 1
#include <vector>
#include <queue>
#include <cassert>
#include <iostream>
#include <string>
#include <cstdlib>
#include <mi/VoxelType.hpp>
#include <mi/VolumeInfo.hpp>
namespace mi
{
class ComponentCounter : public NonCopyable
{
public:
ComponentCounter ( const std::vector<bool>& voxel ) : _voxel ( voxel )
{
if ( voxel.size() != 27 ) {
std::cerr << "size error of ComponentCounter " << std::endl;
}
return;
}
virtual ~ComponentCounter ( void )
{
return;
}
char countBackgroundComponents ( NeighborType type = NEIGHBOR_26, bool ignoreCenter = false )
{
std::vector<bool> voxel ( 27, false );
for ( int i = 0 ; i < 27 ; i += 1 ) {
voxel[i] = !_voxel[i] ;
}
if ( ignoreCenter ) {
voxel[13] = false;
}
return this->count ( voxel, type );
}
char countForegroundComponents ( NeighborType type = NEIGHBOR_26, bool ignoreCenter = false )
{
std::vector<bool> voxel ( 27, false );
for ( int i = 0 ; i < 27 ; i += 1 ) {
voxel[i] = _voxel[i];
}
if ( ignoreCenter ) {
voxel[13] = false;
}
return this->count ( voxel, type );
}
private:
char count ( const std::vector<bool>& bit, const NeighborType type ) const
{
std::vector<char> label ( 27, -1 );
const char DEFAULT_VALUE = 28;
std::queue<char> snbr;
for ( int i = 0 ; i < 27 ; i += 1 ) {
if ( bit[i] ) {
label[i] = DEFAULT_VALUE;
snbr.push ( i );
}
}
char label_count = 0;
while ( !snbr.empty() ) {
const int target = snbr.front();
snbr.pop();
std::queue<int> q;
q.push ( target );
while ( !q.empty() ) {
const int top = q.front();
q.pop();
if ( label[top] != DEFAULT_VALUE ) {
continue;
}
label[top] = label_count;
const int zz = static_cast<int> ( top / 9 ) ;
const int yy = static_cast<int> ( ( top % 9 ) / 3 );
const int xx = top % 3;
for ( int z = -1 ; z <= 1 ; z += 1 ) {
if ( zz + z < 0 || 2 < zz + z ) {
continue;
}
for ( int y = -1 ; y <= 1 ; y += 1 ) {
if ( yy + y < 0 || 2 < yy + y ) {
continue;
}
for ( int x = -1 ; x <= 1 ; x += 1 ) {
if ( xx + x < 0 || 2 < xx + x ) {
continue;
}
int dist = std::abs ( x ) + std::abs ( y ) + std::abs ( z );
if ( dist == 0 ) {
continue;
}
if ( type == NEIGHBOR_6 && dist > 1 ) {
continue; //6 neigbhor
}
if ( type == NEIGHBOR_18 && dist > 2 ) {
continue; //18 neigbhor
}
const int id = ( zz + z ) * 9 + ( yy + y ) * 3 + ( xx + x );
if ( label[id] == DEFAULT_VALUE ) { // if the voxel is no labelled.
q.push ( id );
}
}
}
}
}
label_count += 1;
while ( !snbr.empty() ) {
if ( label[snbr.front() ] == DEFAULT_VALUE ) {
break;
}
snbr.pop();
}
}
return label_count;
}
private:
std::vector<bool> _voxel;
};
VoxelType
VoxelTypeClassifier::get ( const Point3i& p )
{
const char bgValue = 0;
const VolumeInfo& info = voxel.getInfo();
if ( !info.isValid ( p ) ) {
return Invalid; // return Invalid if position is invalid
}
if ( this->_voxel.get ( p ) == bgValue ) {
return Background;
}
std::vector<bool> bit;
bit.reserve ( 27 );
for ( int dz = -1 ; dz <= 1 ; ++dz ) {
for ( int dy = -1 ; dy <= 1 ; ++dy ) {
for ( int dx = -1 ; dx <= 1 ; ++dx ) {
const Point3i np = p + Point3i ( dx, dy, dz );
const Point3i cp = info.clamp ( np );
bit.push_back ( this->_voxel.get ( cp ) != bgValue );
}
}
}
ComponentCounter counter ( bit );
const char bgnum = counter.countBackgroundComponents ( NEIGHBOR_18, false );
const char fgnum = counter.countForegroundComponents ( NEIGHBOR_26, true );
if ( bgnum == 0 ) {
return InteriorPoint;
} else if ( fgnum == 0 ) {
return IsolatePoint;
} else if ( bgnum == 1 && fgnum == 1 ) {
return BorderPoint;
} else if ( bgnum == 1 && fgnum == 2 ) {
return CurvePoint;
} else if ( bgnum == 1 && fgnum > 2 ) {
return CurvesJunction;
} else if ( bgnum == 2 && fgnum == 1 ) {
return SurfacePoint;
} else if ( bgnum == 2 && fgnum >= 2 ) {
return SurfaceCurveJunction;
} else if ( bgnum > 2 && fgnum == 1 ) {
return SurfacesJunction;
} else if ( bgnum > 2 && fgnum >= 2 ) {
return SurfacesCurvesJunction;
} else {
return Invalid;
}
}
}
|
5812033f3504538897589460cabb7cf90a5bf565 | 955793e76588b7a9323a4e5fbf645f299d0588f3 | /src/src/GithubAPI.cpp | 8c6243125858a241f9a34919e7c137880c6f81e0 | [] | no_license | robbie-li/Langunator | 3307628929f484100408d6ba27bf5a5a9edc1974 | d2169b155670955a60d547822cbd5114bdd719d4 | refs/heads/master | 2020-05-14T23:32:25.618925 | 2013-10-26T21:35:21 | 2013-10-26T21:35:21 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,438 | cpp | GithubAPI.cpp | #include "GithubAPI.h"
#include <QtNetwork>
#include <QtCore>
#include "Vocable.h"
#define ACCESS_TOKEN "?access_token=fb6cc1e8ed683e414df9c8837ecfa62ae1c76a6d"
#define BASE_URL "https://api.github.com/gists"
#define INDEX_URL "https://api.github.com/users/Langunator/gists"
GithubAPI::GithubAPI(QWidget *parent) :
QObject(parent),
oauth(parent),
mapper(this)
{
manager = new QNetworkAccessManager(this);
defaultErrorHandler = [this] (QNetworkReply* reply) {
qWarning() << "Error getting " << reply->url() << " - Error " << reply->errorString();
};
connect(&mapper, static_cast<void (QSignalMapper::*)(QObject*)>(&QSignalMapper::mapped), [](QObject* obj){
ResponseHandler *handler = qobject_cast<ResponseHandler*>(obj);
qDebug() << "callback for " << handler;
if (handler->reply->error() != QNetworkReply::NoError){
handler->error(handler->reply);
}
else {
handler->success(handler->reply);
}
handler->deleteLater();
});
}
GithubAPI::~GithubAPI()
{
}
void GithubAPI::downloadPackages(const CategoriesPtr &packages, std::function<void (QList<Vocable> &packages, const CategoryPtr &cat)> callback
, std::function<void (CategoryPtr, QString )> error)
{
foreach(const CategoryPtr&pack, packages) {
qDebug() << "download " << pack->categoryName() << " from " << pack->sourceFileName;
request(pack->sourceFileName, [callback, error, pack, this](QNetworkReply* reply){
QJsonParseError jsonError;
QList<Vocable> lst;
QJsonDocument doc = QJsonDocument::fromJson(QByteArray::fromBase64(reply->readAll()), &jsonError);
if (doc.isNull() || jsonError.error != QJsonParseError::NoError)
{
error(pack, tr("Package\n\t%1 from %2\nError parsing JSON-Response\n\t%3")
.arg( pack->categoryName(), pack->author, jsonError.errorString()));
return;
}
QJsonArray array = doc.array();
foreach(const QJsonValue &val, array)
lst.append(Vocable(val.toObject(), pack));
callback(lst, pack);
},
[error,pack,this](QNetworkReply*reply){
error(pack, tr("Package\n\t%1 from %2\nNetwork error:\n\t%3")
.arg( pack->categoryName(), pack->author, reply->errorString()));
});
}
}
QBuffer* GithubAPI::prepareUploadFileBuffer(const CategoryPtr&pack) {
QBuffer *buf = new QBuffer(this);
buf->open(QIODevice::WriteOnly);
QJsonArray arr;
DQList<Vocable> vocList = pack->vocables();
for(int i=0;i<vocList.size();i++){
QJsonObject obj;
obj << *vocList.at(i);
arr.append(obj);
}
QJsonObject data;
data << *pack.data();
buf->write("{\n\"description\": \"");
buf->write( QJsonDocument(data).toJson().replace("\"","\\\"").replace("\n"," ") );
buf->write("\",\n \"files\" : {\n");
buf->write(" \"\" : {");
buf->write("\"content\" : \"");
buf->write( QJsonDocument(arr).toJson().toBase64() );
buf->write("\"}\n }\n}");
buf->close();
buf->open(QIODevice::ReadOnly);
buf->seek(0);
return buf;
}
void GithubAPI::uploadPackages(const CategoriesPtr &packages,
std::function<void (CategoryPtr)> callback,
std::function<void (CategoryPtr, QString)> error,
std::function<void ()> uploadDone)
{
QList<SuccessfullUploaded> *successfull = new QList<SuccessfullUploaded>();
int *failed=new int;
*failed=0;
foreach(const CategoryPtr&pack, packages) {
QBuffer *buf = prepareUploadFileBuffer(pack);
qDebug() << "upload " << pack->categoryName() << ": \n" << buf->data();
request(BASE_URL ACCESS_TOKEN, [=](QNetworkReply *reply){
callback(pack);
QString sha = QJsonDocument::fromJson( reply->readAll() ).object().value("sha").toString();
qDebug() << "upload resonse " << sha;
successfull->append( { sha, pack } );
if (successfull->size() + *failed >= packages.size()) {
delete failed;
uploadDone();
}
}, [=](QNetworkReply *reply){
error(pack, tr("Upload of %1 failed:\n\t%2").arg(pack->categoryName(), reply->errorString()));
(*failed)++;
if (successfull->size() + *failed >= packages.size()) {
delete failed;
uploadDone();
}
},buf);
}
}
void GithubAPI::loadIndex(std::function<void (CategoriesPtr &packages)> callback, std::function<void (QNetworkReply*)> error)
{
auto success = [this, callback] (QNetworkReply* reply) {
QJsonDocument content = QJsonDocument::fromJson(reply->readAll());
if (content.isArray() && content.array().isEmpty()) {
qDebug() << "Index is empty";
return;
}
lastAccess = QDateTime::currentDateTime();
index = content.array();
CategoriesPtr cats;
foreach(QJsonValue obj, index) {
QString metadata = obj.toObject().value("description").toString();
QJsonObject val = QJsonDocument::fromJson(metadata.toUtf8()).object();
CategoryPtr cat = CategoryPtr(new Category(val));
cat->sourceFileName = obj.toObject().value("files").toObject().constBegin().value().toObject().value("raw_url").toString();
qDebug() << "Metadata "<< metadata << " @ " << cat->sourceFileName;
cats.append(cat);
}
callback(cats);
};
request(INDEX_URL ACCESS_TOKEN, success, error);
}
void GithubAPI::request(QString url, std::function<void (QNetworkReply*)> success, std::function<void (QNetworkReply*)> error, QIODevice *uplData)
{
qDebug() << "request: " << url;
QNetworkReply *reply;
if (uplData != NULL) {
QNetworkRequest req;
req.setUrl(QUrl(url));
req.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
reply = manager->post(req, uplData);
}
else
reply = manager->get(QNetworkRequest(QUrl(url)));
ResponseHandler *handler = new ResponseHandler(reply, success, ((error==NULL)?defaultErrorHandler:error), uplData);
mapper.setMapping(reply, handler);
connect(reply, SIGNAL(finished()), &mapper, SLOT(map()));
}
|
8d7a1497093ab38afcdb8ac6c0b847e48bd9e8e4 | 8a3b53259d3656ce9aaa9963b7be4362a2918de5 | /tests/gemv.cpp | a54d54bbd4c284a72b2169dd97fcb830211f0cfe | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | crtrott/stdBLAS | fd0c42629d2fc3739198454f17adcfc40658983f | ed408b69abf356f7d8fb70ee0c4988aa5c142f61 | refs/heads/main | 2023-07-14T23:59:58.232270 | 2021-07-22T15:57:53 | 2021-07-22T15:57:53 | 393,449,861 | 0 | 0 | NOASSERTION | 2021-08-06T17:20:59 | 2021-08-06T17:20:59 | null | UTF-8 | C++ | false | false | 4,737 | cpp | gemv.cpp | #include <experimental/linalg>
#include <experimental/mdspan>
#include <vector>
#include "gtest/gtest.h"
#include <iostream>
namespace {
using std::experimental::mdspan;
using std::experimental::dynamic_extent;
using std::experimental::extents;
using std::experimental::layout_left;
using std::experimental::linalg::matrix_vector_product;
using std::experimental::linalg::transposed;
using std::cout;
using std::endl;
template<class MdspanType, class Scalar>
struct FillMatrix {
static void fill(MdspanType A, const Scalar startVal);
};
template<class MdspanType>
struct FillMatrix<MdspanType, int> {
static void fill(MdspanType A, const int startVal)
{
const ptrdiff_t A_numRows = A.extent(0);
const ptrdiff_t A_numCols = A.extent(1);
for (ptrdiff_t j = 0; j < A_numCols; ++j) {
for (ptrdiff_t i = 0; i < A_numRows; ++i) {
A(i,j) = int((i+startVal) + (j+startVal) * A_numRows);
}
}
}
};
template<class MdspanType>
struct FillMatrix<MdspanType, double> {
static void fill(MdspanType A, const double startVal)
{
const ptrdiff_t A_numRows = A.extent(0);
const ptrdiff_t A_numCols = A.extent(1);
for (ptrdiff_t j = 0; j < A_numCols; ++j) {
for (ptrdiff_t i = 0; i < A_numRows; ++i) {
A(i,j) = (double(i)+startVal) +
(double(j)+startVal) * double(A_numRows);
}
}
}
};
template<class MdspanType, class Scalar>
void fill_matrix(MdspanType A, const Scalar startVal) {
FillMatrix<MdspanType, Scalar>::fill(A, startVal);
}
template<class MdspanType, class Scalar>
struct FillVector {
static void fill(MdspanType x, const Scalar startVal);
};
template<class MdspanType>
struct FillVector<MdspanType, int> {
static void fill(MdspanType x, const int startVal)
{
const ptrdiff_t numRows = x.extent(0);
for (ptrdiff_t i = 0; i < numRows; ++i) {
x(i) = int(i+startVal);
}
}
};
template<class MdspanType>
struct FillVector<MdspanType, double> {
static void fill(MdspanType x, const double startVal)
{
const ptrdiff_t numRows = x.extent(0);
for (ptrdiff_t i = 0; i < numRows; ++i) {
x(i) = double(i+startVal);
}
}
};
template<class MdspanType, class Scalar>
void fill_vector(MdspanType x, const Scalar startVal) {
FillVector<MdspanType, Scalar>::fill(x, startVal);
}
template<class Scalar>
struct Magnitude {
using type = Scalar;
};
template<class Real>
struct Magnitude<std::complex<Real>> {
using type = Real;
};
template<class Scalar>
void test_matrix_product()
{
using scalar_t = Scalar;
using real_t = typename Magnitude<Scalar>::type;
using extents_t = extents<dynamic_extent, dynamic_extent>;
using matrix_t = mdspan<scalar_t, extents_t, layout_left>;
using vector_t = mdspan<scalar_t, extents<dynamic_extent>, layout_left>;
constexpr ptrdiff_t maxDim = 7;
constexpr ptrdiff_t storageSize(maxDim*maxDim + 3*maxDim);
std::vector<scalar_t> storage(storageSize);
for (ptrdiff_t numRows : {1, 4, 7}) {
for (ptrdiff_t numCols : {1, 4, 7}) {
ptrdiff_t offset = 0;
matrix_t A(storage.data() + offset, numRows, numCols);
offset += numRows * numCols;
vector_t x(storage.data() + offset, numCols);
offset += numCols;
vector_t y(storage.data() + offset, numRows);
offset += numRows;
vector_t gs(storage.data() + offset, numRows);
fill_matrix(A, scalar_t(real_t(1)));
fill_vector(x, scalar_t(real_t(2)));
// Initialize vector to zero
for (ptrdiff_t i = 0; i < numRows; i++) {
gs(i) = scalar_t(0.0); // this works even for complex
}
// Perform matvec
for (ptrdiff_t j = 0; j < numCols; ++j) {
for (ptrdiff_t i = 0; i < numRows; ++i) {
gs(i) += A(i,j) * x(j);
}
}
// Fill result vector with flag values to make sure that we
// computed everything.
for (ptrdiff_t j = 0; j < numRows; ++j) {
y(j) = std::numeric_limits<scalar_t>::min();
}
cout << " Test y = A(" << numRows << " x " << numCols
<< ") * x = y\n";
matrix_vector_product(A, x, y);
for (ptrdiff_t i = 0; i < numRows; ++i) {
EXPECT_DOUBLE_EQ(y(i), gs(i)) << "Vectors differ at index " << i;
}
} // numCols
} // numRows
}
// Testing int is a way to test the non-BLAS-library implementation.
TEST(BLAS3_gemm, mdspan_int)
{
test_matrix_product<int>();
}
TEST(BLAS3_gemm, mdspan_double)
{
test_matrix_product<double>();
}
}
|
9219d5588466bf4549b0a9bca5cf535d59670e01 | 63114dee535cb0bd57e07e8e66f370923d430277 | /farraylist.h | 5d71724accd96aac7271590279fb4fc469084dc6 | [] | no_license | NivxB/project1_ED | ae15c8d4621ca781d4a0f6648490939071de509f | 7309265976816485561618b170dbc874884c4a3b | refs/heads/master | 2020-04-30T04:40:39.961965 | 2014-02-05T04:08:34 | 2014-02-05T04:08:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,020 | h | farraylist.h | //farraylist.h
#ifndef FARRAYLIST_H
#define FARRAYLIST_H
#include "tdalist.h"
#include "object.h"
#include "dlcursorlist.h"
#include "varraylist.h"
#include "slinkedlist.h" //Lista Enlazada Sencilla
#include "linkedlist.h" //Lista Doblemente Enlazada
class FArrayList:public TDAList{
Object** data;
int capacity;
public:
FArrayList();
FArrayList(int);
virtual ~FArrayList();
virtual bool insert(Object*, int) ;
virtual int indexOf(Object*)const ;
virtual Object* get(int)const ;
virtual Object* remove(int);
virtual bool erase(int) ;
virtual int prev(int) const ;
virtual int next(int) const ;
virtual void reset() ;
virtual Object* first()const ;
virtual Object* last()const ;
virtual void print()const ;
virtual bool isFull()const ;
virtual void clear();
virtual bool isEmpty()const;
TDAList* toDLCursorList()const;
TDAList* toVArrayList()const;
TDAList* toSLinkedList()const;
TDAList* toLinkedList()const;
};
#endif |
c40d73fb4e53132ac03d9fc02fe05d9d7575719a | edd666bd7d63d37b03e421ee6d3fd0145fccf45c | /flags/TTLFlag.h | eb5be07106bfcbec3674254a950c785116259463 | [] | no_license | utt-zachery/ping-plus-plus | 55696c88ea4a58f21d95f5f10f933277e4fe3fc3 | b9873e367fe664c9b2de8f3e0ad6109b621d4ba0 | refs/heads/master | 2022-04-19T11:37:23.116580 | 2020-04-16T20:07:34 | 2020-04-16T20:07:34 | 256,285,696 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 600 | h | TTLFlag.h | #pragma once
#include <string>
#include "AbstractFlag.h"
#include "../exceptions/SyntaxException.h"
//Concrete flag class that allows users to execute a custom command if PING requests are systematically failing
class TTLFlag : public AbstractFlag {
public:
TTLFlag();
//Default behavior will be set to 255. If the user passes in a command string and the threshold is reached, the command will be executed
void parseCommand(int argc, const char ** arg);
void setTTL(int toSet);
int getTTL();
private:
int customTTL;
bool isNumber(const std::string& s);
};
|
51e4405d8c259108e8b7258f7e336726b67daebe | 220c8e3d7d577c12fe7f7b53f5127ab390fdf794 | /include/square.hxx | fea3d70894d2bfd7c378fdd74395e0f9607173ba | [] | no_license | DimartX/oop_exercise_03 | 6f6bc8f523add8514ce2fdbee66d54c3541e5f9f | 8a9c8a37a8ebb8f0f6708a8ce26868cd928c0f14 | refs/heads/master | 2020-09-28T22:23:19.375716 | 2019-12-09T14:27:49 | 2019-12-09T14:27:49 | 217,227,884 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 267 | hxx | square.hxx | #pragma once
#include <include/figure.hxx>
#include <include/rectangle.hxx>
class Square : public Rectangle {
public:
Square(std::vector<Point> const& fig) : Rectangle(fig) {};
void printPoints(std::ostream& out) const override;
~Square() = default;
};
|
9c80ab65cd3e14ef952bfad82d2400cbbb91002d | 075e9aac7274b533fcf4af310247a1c61f153ee5 | /OpenCvPraktikum/Objects/HistogramCreationMethod.h | b5403f2f637f22c315304c9819fc1297aeeaea0d | [] | no_license | WorstConn/cv-praktikum-fh-m | 2f7c84bb188fc62f6eb10478a092481d011a07bc | 4208b707534fe390586722f85fe167528bc404aa | refs/heads/master | 2016-08-12T09:24:12.646590 | 2013-06-09T17:09:09 | 2013-06-09T17:09:09 | 46,610,363 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 550 | h | HistogramCreationMethod.h | /*
* File: HistogramCreationMethod.h
* Author: Julian Cordes, Nils Frenking
*
* Created on 17. Januar 2013, 15:06
*/
#ifndef HISTOGRAMCREATIONMETHOD_H
#define HISTOGRAMCREATIONMETHOD_H
#include "../header.h"
using namespace std;
using namespace cv;
class HistogramCreationMethod {
public:
HistogramCreationMethod();
HistogramCreationMethod(const HistogramCreationMethod& orig);
virtual ~HistogramCreationMethod();
virtual MatND createHistogram(Mat img, Mat mask)=0;
private:
};
#endif /* HISTOGRAMCREATIONMETHOD_H */
|
11f4f41321b515351048dcf0b7add7f045463a05 | 6e0cdf4d488e9974f8ee88b24c5538da55bcfa8f | /leetcode/editor/cn/51_n-queens.cpp | 14ef762c6fe10e72d922473471c93368504bbd2d | [] | no_license | JinyuChata/leetcode_cpp | 70b59410e31714d74eb3fabf08604d95ebd6fcfb | 2ee7778582b759887f598671585e172d0e3fa5e7 | refs/heads/master | 2023-08-18T02:30:28.050723 | 2021-10-14T07:33:37 | 2021-10-14T07:33:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,842 | cpp | 51_n-queens.cpp | //n 皇后问题 研究的是如何将 n 个皇后放置在 n×n 的棋盘上,并且使皇后彼此之间不能相互攻击。
//
// 给你一个整数 n ,返回所有不同的 n 皇后问题 的解决方案。
//
//
//
// 每一种解法包含一个不同的 n 皇后问题 的棋子放置方案,该方案中 'Q' 和 '.' 分别代表了皇后和空位。
//
//
//
// 示例 1:
//
//
//输入:n = 4
//输出:[[".Q..","...Q","Q...","..Q."],["..Q.","Q...","...Q",".Q.."]]
//解释:如上图所示,4 皇后问题存在两个不同的解法。
//
//
// 示例 2:
//
//
//输入:n = 1
//输出:[["Q"]]
//
//
//
//
// 提示:
//
//
// 1 <= n <= 9
// 皇后彼此不能相互攻击,也就是说:任何两个皇后都不能处于同一条横行、纵行或斜线上。
//
//
//
// Related Topics 回溯算法
// 👍 891 👎 0
#include "bits/stdc++.h"
using namespace std;
//leetcode submit region begin(Prohibit modification and deletion)
class Solution {
public:
vector<vector<string>> ress;
bool canPutOnCol(vector<string>& table, int n, int i, int j) {
// 纵行
for (int k = 0; k < n; k++) {
if (table[k][j] != '.') return false;
}
// 斜线
int ii = i, jj = j;
// 向右下角
while (ii < n && jj < n && ii >= 0 && jj >= 0) {
if (table[ii][jj] != '.') return false;
ii++; jj++;
}
ii = i, jj = j;
// 向左上角
while (ii < n && jj < n && ii >= 0 && jj >= 0) {
if (table[ii][jj] != '.') return false;
ii--; jj--;
}
ii = i, jj = j;
// 向左下角
while (ii < n && jj < n && ii >= 0 && jj >= 0) {
if (table[ii][jj] != '.') return false;
ii++; jj--;
}
ii = i, jj = j;
// 向左上角
while (ii < n && jj < n && ii >= 0 && jj >= 0) {
if (table[ii][jj] != '.') return false;
ii--; jj++;
}
return true;
}
void traceback(int n, int i, vector<string>& res) {
// 要放在第i行,看看放在哪
if (i == n) {
ress.emplace_back(res);
return;
}
for (int j = 0; j < n; j++) {
if (canPutOnCol(res, n, i, j)) {
res[i][j] = 'Q';
traceback(n, i+1, res);
res[i][j] = '.';
}
}
}
vector<vector<string>> solveNQueens(int n) {
vector<string> res;
string lineStr;
for (int i = 0; i < n; i++) {
lineStr += ".";
}
for (int i = 0; i < n; i++) {
res.emplace_back(lineStr);
}
traceback(n, 0, res);
return ress;
}
};
//leetcode submit region end(Prohibit modification and deletion)
|
e0f15b6d3f1c4a0b09efcdbdfcc64c6987c3c39a | b695334fc36206cd4167ecab54f3fd56f34b105d | /Course/example0328-2.cc | 3ced73d477a335d450932f57cb5dfd6553a15569 | [] | no_license | scwuaptx/DataStructure | 8ed3d71cd4cabf62a761817debb6705b897ba5f9 | 37a2f6e8a6e3a215cc0f18781c707d876e6f312b | refs/heads/master | 2021-01-10T00:54:26.362765 | 2014-06-05T16:19:24 | 2014-06-05T16:19:24 | 15,038,551 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,407 | cc | example0328-2.cc | #include <iostream>
using namespace std ;
/*vector*/
class Vector {
private :
int *data ;
int rsize ;
int osize ;
public :
Vector() : data(NULL), rsize(0) , osize(0) {}
Vector( int n , int val = 0 ) : osize(n) , rsize(n) {
data = new int[rsize] ;
for( int i = 0 ; i < osize ; ++i ) data[i] = val ;
}
~Vector(){
if ( rsize >0 ){
delete [] data ;
}
}
Vector( const Vector& foo ){
osize = foo.osize ;
rsize - foo.rsize ;
data = new int[rsize] ;
for( int i = 0 ; i < osize ; ++i )
data[i] = foo.data[i] ;
}
Vector& operator= ( const Vector& foo){
if ( this == &foo ) return *this ;
if ( rsize < foo.osize ){
delete [] data ;
rsize = foo.rsize ;
osize = foo.osize ;
data = new int[rsize] ;
for ( int i = 0 ; i < osize ; ++i )
data[i] = foo.data[i] ;
}else{
osize = foo.osize ;
for ( int i = 0 ;i < osize ; ++i )
data[i] = foo.data[i] ;
}
}
int size() const { return osize ; }
void push_back( int v ){
if( rsize == 0 ){
osize = 1 ;
rsize = 0 ;
}else if( osize == rsize ){
rsize = 2 * rsize ;
int *q = new int[rsize] ;
for ( int i = 0 ; i < osize ; ++i ){
q[i] = data[i] ;
}
delete [] data ;
data = q ;
data[osize] = v ;
}else{
data[osize] = v ;
}
++osize ;
}
void pop_back(){
if( osize > 0 ) --osize ;
}
int front() const { return data[0] ;}
int back() const { return data[osize-1] ;}
int& front() { return data[0] ; }
int& back() { return data[osize-1] ;}
int operator[] (int i) const {return data[i] ;}
int& operator[] (int i) {return data[i] ;}
friend ostream& operator<< ( ostream& ostr , const Vector& foo ){
ostr << "[" << foo.osize << "," << foo.rsize << "] : " ;
for( int i = 0 ; i < foo.osize ; ++ i ){
ostr << foo.data[i] << " " ;
}
return ostr ;
}
};
Vector operator+( const Vector& a, const Vector& b ){
Vector c ;
int i ;
for( i = 0 ; i < a.size() ; ++i ) c.push_back(a[i]) ;
for( i = 0 ; i < b.size() ; ++i ) c.push_back(b[i]) ;
return c ;
}
int main(void){
Vector a(3,2) , b , c(2,1) ;
cout << a << '\n' << b << '\n' << c << endl ;
b = a ;
cout << a+c ;
cout << "\n\n\n" ;
for( int i = 0 ; i < 5 ; ++i ){
c.push_back(i) ;
cout << c << endl ;
}
for( int i = 0 ; i < 10 ; ++i ){
c.pop_back() ;
cout << c << endl ;
}
return 0 ;
}
|
0ccc0481bbbd93d59ba2cf8d1fa1bb6fb76cd01f | 066204da477eecf9a083f7102903b742a471e466 | /application/radosgw-admin/Delete.hpp | a5019135eb7c363eabb6115fd059d71bf1c7b1f1 | [] | no_license | siddsinha89/radosgw-admin | 61d12c14e686e6d6d8c7d384d436bc858d1b69d0 | c3f7d6994cc9eba5bcd3ef345f00014082659dd3 | refs/heads/master | 2021-05-15T11:28:57.274154 | 2017-10-26T19:09:54 | 2017-10-26T19:09:54 | 108,334,170 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,458 | hpp | Delete.hpp | #ifndef DELETE_HPP
#define DELETE_HPP
#include "oberon/Subcommand.hpp"
#include "oberon/OptionCollection.hpp"
namespace basic
{
class Delete : public oberon::Subcommand
{
public: // interface
Delete(oberon::OptionCollection sharedOptions) :
oberon::Subcommand("delete", "delete user with uuid from the provided string", sharedOptions)
{
/** **/
}
boost::program_options::options_description uniqueOptions(bool includeHidden, bool enableRestrictions) const
{
boost::program_options::options_description returnOptions;
returnOptions.add_options()
("pid,p", "Thid is the uuid of the user to be deleted");
return returnOptions;
}
boost::program_options::positional_options_description positionalOptions() const
{
/** Now that we have share positional options it is necessary to specify where they should appear in the command
* line for this subcommand. Note here that you as the programmer 'know' the names of the shared options that
* will be present for this subcommand. This in not the best but works just fine in practice.
*/
boost::program_options::positional_options_description positional;
positional.add("uuid-String", 1);
return positional;
}
}; // class
//**********************************************************************************************************************
} // namespace
#endif // DELETE_HPP
|
344b3e833a4456aeedeae31df2e65b3ca6fbe3e2 | 2d2aa582aecfb39563e31b85bb219dc4a14400e8 | /TerrainDirectX2DRender/BitmapClass.h | 62b20687524b79bac7360c9a7ea4c5c04e0e030a | [] | no_license | Porsche7144/TerrainDirectX | 3e9efaaec5d1cc03e45e90bcaaaf83463a2161df | ea7202ec227b1515f5381759d8dc757c3e5564f9 | refs/heads/main | 2023-04-21T19:30:10.408844 | 2021-05-07T06:30:51 | 2021-05-07T06:30:51 | 360,801,357 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 1,441 | h | BitmapClass.h | #pragma once
#include "Texture.h"
struct BitmapVertexType
{
// 구조체 순서도 중요하다..
// TextureUV를 맨 아래에 놓고 color를 중간에 두면
// 텍스처가 컬러 영향 받아서 원래의 텍스처 컬러가 뿌려지지 않음.
// 레이아웃 순서에 영향을 주는 것 같다...
Vector3 pos;
Vector2 TextureUV;
// Vector3 normal; 2D이미지에는 위치 벡터와 텍스쳐 좌표만 필요하다.
};
class BitmapClass
{
public:
ID3D11Buffer* m_pVertexBuffer;
ID3D11Buffer* m_pIndexBuffer;
int m_iVertexCount, m_iIndexCount;
Texture* m_pTextureClass;
int m_ScreenWidth, m_ScreenHeight;
int m_BitmapWidth, m_BitmapHeight;
int m_PrevPosX, m_PrevPosY;
public:
bool Init(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const TCHAR* Filename,
int ScreenWidht, int ScreenHeight, int bitmapWidth, int bitmapHeight);
bool Render(ID3D11DeviceContext* pContext, int PosX, int PosY);
bool Release();
bool ReleaseBuffer();
bool ReleaseTexture();
bool RenderBuffer(ID3D11DeviceContext* pContext);
bool InitBuffers(ID3D11Device* pDevice);
bool LoadTexture(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const TCHAR* Filename);
bool UpdateBuffer(ID3D11DeviceContext* pContext, int PosX, int PosY);
ID3D11ShaderResourceView* GetTexture();
int GetIndexCount();
bool LoadModelText(const TCHAR* texName);
bool ReleaseModelText();
public:
BitmapClass();
~BitmapClass();
};
|
92701ac1c97a5865a634ef622c22f44982328a8b | 95a43c10c75b16595c30bdf6db4a1c2af2e4765d | /codecrawler/_code/hdu2438/16210509.cpp | b5e9735a0ccdfd79404263d6c9d97e93942e3de5 | [] | no_license | kunhuicho/crawl-tools | 945e8c40261dfa51fb13088163f0a7bece85fc9d | 8eb8c4192d39919c64b84e0a817c65da0effad2d | refs/heads/master | 2021-01-21T01:05:54.638395 | 2016-08-28T17:01:37 | 2016-08-28T17:01:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,100 | cpp | 16210509.cpp | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define eps 1e-8
struct point
{
double x;
double y;
};
double w1,w2,l,d;
double cross(point p1,point p2,point p0)
{
return (p1.x-p0.x)*(p2.y-p0.y)-(p2.x-p0.x)*(p1.y-p0.y);
}
double cal(double x)
{
point t1,t2,p0;
double s,y,h;
y=sqrt(l*l-x*x);
t1.x=w1-x,t1.y=-w2;
t2.x=w1,t2.y=-(w2-y);
p0.x=0,p0.y=0;
s=fabs(cross(t1,t2,p0));
h=s/l;
return h;
}
void solve()
{
int i;
double left,right,mid1,mid2,h1,h2;
left=0,right=l;
for(i=0;i<=100;i++)
{
mid1=(left*2+right)/3;
mid2=(left+right*2)/3;
h1=cal(mid1);
h2=cal(mid2);
if(h1>h2)
{
left=mid1;
}
else
{
right=mid2;
}
}
double H=cal(left);
if(H-d>0)
printf("yes\n");
else
printf("no\n");
}
int main()
{
while(scanf("%lf%lf%lf%lf",&w1,&w2,&l,&d)!=EOF)
{
if(d>=w1||d>=w2)
{
printf("no\n");
continue;
}
solve();
}
return 0;
}
|
76f09789d0ac6cf37d712abefab16664118243e0 | 87e8d04c5c32dab8182ba3fcd573a1753d39e185 | /src/messages/fuse/uuid.h | 15fa73455f671ce59787e001338888937f62166b | [
"MIT"
] | permissive | onedata/oneclient | ce3842f1b6ecdd9c0f25c127970d1a56dd9a1966 | 12e564741797e0f702b36475e9ead73b78b367c2 | refs/heads/develop | 2023-08-31T01:45:41.784802 | 2023-08-29T13:46:50 | 2023-08-29T13:46:50 | 45,646,655 | 5 | 3 | MIT | 2020-05-14T16:32:36 | 2015-11-05T23:34:28 | C++ | UTF-8 | C++ | false | false | 817 | h | uuid.h | /**
* @file uuid.h
* @author Bartek Kryza
* @copyright (C) 2022 ACK CYFRONET AGH
* @copyright This software is released under the MIT license cited in
* 'LICENSE.txt'
*/
#pragma once
#include "fuseResponse.h"
namespace one {
namespace messages {
namespace fuse {
/**
* The @c Uuid represents a file Guid in Onedata.
*/
class Uuid : public FuseResponse {
public:
/**
* Constructor.
* @param serverMessage Protocol Buffers message representing
* guid of a file or directory in Onedata.
*/
Uuid(std::unique_ptr<ProtocolServerMessage> serverMessage);
/**
* @return The uuid value.
*/
const std::string &uuid() const;
std::string toString() const override;
private:
std::string m_uuid;
};
} // namespace fuse
} // namespace messages
} // namespace one
|
90e8124d7e67abc48889cd6de7e4eefccf89a7df | 289288d0bf3f0d03fd590946c1c1f293aaf75726 | /Plugins/PaperZD/Source/PaperZDEditor/Private/Graphs/Nodes/PaperZDAnimGraphNode_Transition.cpp | 0cbc6fd222127886148b7a07a5f47d9e3008bbd4 | [] | no_license | BlenderGamer/PitchSample | 4722d9a37875ef23f0a84d1ddb824e46551c7170 | 52fa8941982e36c7cfae043e6d239d46333ed6b9 | refs/heads/master | 2023-02-25T16:57:22.260228 | 2021-02-02T14:42:35 | 2021-02-02T14:42:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,850 | cpp | PaperZDAnimGraphNode_Transition.cpp | // Copyright 2017 Carlos Ibanez Ch. All Rights Reserved.
#include "PaperZDAnimGraphNode_Transition.h"
#include "PaperZDEditor.h"
#include "PaperZDAnimGraphNode_State.h"
#include "PaperZDAnimTransitionGraph.h"
#include "PaperZDAnimTransitionGraphSchema.h"
#include "Kismet2/BlueprintEditorUtils.h"
#include "EdGraphUtilities.h"
#include "AnimNodes/PaperZDAnimNode_Transition.h"
#include "Slate/SPaperZDAnimGraphNode_Transition.h"
//////////////////////////////////////////////////////////////////////////
//// PaperZD Anim Graph Node
//////////////////////////////////////////////////////////////////////////
UPaperZDAnimGraphNode_Transition::UPaperZDAnimGraphNode_Transition(const FObjectInitializer& ObjectInitializer)
: Super(), Color(FColor::White)
{
Priority = 0;
}
void UPaperZDAnimGraphNode_Transition::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
{
if (PropertyChangedEvent.Property && PropertyChangedEvent.Property->GetName().Equals(TEXT("Priority")))
{
Cast<UPaperZDAnimNode_Transition>(AnimNode)->Priority = Priority;
}
}
void UPaperZDAnimGraphNode_Transition::CreateConnections(UPaperZDAnimGraphNode* PreviousState, UPaperZDAnimGraphNode* NextState)
{
// Previous to this
Pins[0]->Modify();
Pins[0]->LinkedTo.Empty();
PreviousState->GetOutputPin()->Modify();
Pins[0]->MakeLinkTo(PreviousState->GetOutputPin());
// This to next
Pins[1]->Modify();
Pins[1]->LinkedTo.Empty();
NextState->GetInputPin()->Modify();
Pins[1]->MakeLinkTo(NextState->GetInputPin());
}
void UPaperZDAnimGraphNode_Transition::AllocateDefaultPins()
{
FCreatePinParams PinParams;
UEdGraphPin* Inputs = CreatePin(EGPD_Input, TEXT("Transition"), TEXT(""), NULL, TEXT("In"), PinParams);
Inputs->bHidden = true;
UEdGraphPin* Outputs = CreatePin(EGPD_Output, TEXT("Transition"), TEXT(""), NULL, TEXT("Out"), PinParams);
Outputs->bHidden = true;
}
void UPaperZDAnimGraphNode_Transition::PinConnectionListChanged(UEdGraphPin* Pin)
{
if (Pin->LinkedTo.Num() == 0)
{
// Commit suicide; transitions must always have an input and output connection
Modify();
// Our parent graph will have our graph in SubGraphs so needs to be modified to record that.
if (UEdGraph* ParentGraph = GetGraph())
{
ParentGraph->Modify();
}
DestroyNode();
}
}
UPaperZDAnimGraphNode* UPaperZDAnimGraphNode_Transition::GetFromNode()
{
if (!GetInputPin()->LinkedTo.Num())
return nullptr;
return Cast<UPaperZDAnimGraphNode>(GetInputPin()->LinkedTo[0]->GetOwningNode());
}
UPaperZDAnimGraphNode* UPaperZDAnimGraphNode_Transition::GetToNode()
{
if (!GetOutputPin()->LinkedTo.Num())
return nullptr;
return Cast<UPaperZDAnimGraphNode>(GetOutputPin()->LinkedTo[0]->GetOwningNode());
}
TSharedPtr<SGraphNode> UPaperZDAnimGraphNode_Transition::CreateVisualWidget()
{
return SNew(SPaperZDAnimGraphNode_Transition, this);
}
|
e9afe31dbe80888e31c4d9ce47b25c334f6529c8 | 56b27974c824a070e551eacbd9c8182860134179 | /s1031418-hw6-master/s1031418hw6_Matrix_Base.hpp | 377974d6cccbcfb659a9ff270dc7fe0fed905d30 | [] | no_license | s1031418/Programming-Homework | 2e5a3a3079cb36e4c87eea75023eae68cec6bacf | 9a71afd6d38102ca02c6077ee825f31e8fb76a22 | refs/heads/master | 2020-03-15T05:20:13.425985 | 2018-05-03T11:40:43 | 2018-05-03T11:40:43 | 131,986,669 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,314 | hpp | s1031418hw6_Matrix_Base.hpp | #pragma once
template <int Row_Size, int Column_Size, class Data_Type, class Column_Type, class Matrix_Type>
class Matrix_Base // Matrix: Column_Size x Row_Size, a 4x3 Matrix has 3 column with 4 elements in each column
{
public:
Column_Type _[Row_Size] ;
typedef Data_Type Data_Type;
inline Column_Type & operator [] ( size_t const& i ) { return _[i]; }
inline Column_Type const& operator [] ( size_t const& i ) const { return _[i]; }
inline size_t Row_num () const { return Column_Size; }
inline size_t Column_num () const { return Row_Size; }
inline size_t Row_size () const { return Row_Size; }
inline size_t Column_size () const { return Column_Size; }
inline Matrix_Type operator + (Matrix_Type const& m) const {
Matrix_Type rm;
for (int i = 0; i < Row_size(); i++)
{
for (int j = 0; j < Column_size(); j++)
{
rm[i][j] = _[i][j];
rm[i][j] += m[i][j];
}
}
return rm;
}
inline Matrix_Type operator - (Matrix_Type const& m) const {
Matrix_Type rm;
for (int i = 0; i < Row_size(); i++)
{
for (int j = 0; j < Column_size(); j++)
{
rm[i][j] = _[i][j];
rm[i][j] -= m[i][j];
}
}
return rm;
}
inline Matrix_Type operator * (Data_Type const& f) const {
Matrix_Type rm;
for (unsigned int i = 0; i < Row_size(); i++)
{
for (unsigned int j = 0; j < Column_size(); j++)
{
rm[i][j] = _[i][j];
rm[i][j] *= f;
}
}
return rm;
}
inline Matrix_Type operator / (Data_Type const& f) const {
Matrix_Type rm;
for (int i = 0; i < Row_size(); i++)
{
for (int j = 0; j < Column_size(); j++)
{
rm[i][j] = _[i][j];
rm[i][j] /= f;
}
}
return rm;
}
template <int Row_Size, int Column_Size, class Data_Type, class Column_Type, class Matrix_Type>
friend ostream &operator <<(ostream& output, const Matrix_Base <Row_Size, Column_Size, Data_Type, Column_Type, Matrix_Type> &mat);
} ;
template <int Row_Size, int Column_Size, class Data_Type, class Column_Type, class Matrix_Type>
ostream &operator << (ostream& output, const Matrix_Base <Row_Size, Column_Size, Data_Type,Column_Type ,Matrix_Type> &mat){
for (int i = 0; i < Row_Size; i++)
{
output << "col[" << i << "]: " << mat[i];
}
return output;
} |
09381d5ea27be71d8bb0bf8f522ab51e51d55d35 | aa5d0259123729f9c3f3e91f310ffc8b5f5acc08 | /D3DGame11_FrameWork/FrameWork/Core/Subsystem/Graphics.h | ec68d916ca255a9329b51ba419f3cd04b6e5d0ab | [] | no_license | jasonwhang/SGA_DirectX11_3DGame | a548de0b27ae12af7b91924622ae06010ca4cfe5 | 1cfbde17385d83aadc0e424231b57d3bcde9979e | refs/heads/master | 2020-04-08T12:52:33.166376 | 2018-12-08T03:05:29 | 2018-12-08T03:05:29 | 159,365,199 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 908 | h | Graphics.h | #pragma once
#include "../Subsystem/ISubsystem.h"
class Graphics : public ISubsystem
{
public:
Graphics(class Context* context);
virtual ~Graphics();
ID3D11Device* GetDevice() const { return device; }
ID3D11DeviceContext* GetDeviceContext() const { return deviceContext; }
IDXGISwapChain* GetSwapChain() const { return swapChain; }
void Initialize() override;
void Update() override {}
void ResizeClient(const uint& width, const uint& height);
void BeginScene();
void EndScene();
private:
ID3D11Device * device;
ID3D11DeviceContext* deviceContext;
IDXGISwapChain* swapChain;
ID3D11Debug* debugDevice;
uint gpuMemorySize;
wstring gpuDescription;
uint numerator;
uint denominator;
D3DXCOLOR clearColor;
ID3D11DepthStencilView* depthStencilView; // 깊이(3D이기 때문에 필요한 변수이다.)
ID3D11RenderTargetView* renderTargetView; // 도화지
D3D11_VIEWPORT viewport;
}; |
ff22f6aabe619ccb60698705b335134447806fbc | 6796e4c70100172c1166a649d7d6d6c32e053c5d | /SdlGame/title_screen.h | 5b88c0b9df36940e746fa9c5707838fe32e52e77 | [] | no_license | KKozlowski/SdlGame | c4a54a52bb857c86b1e286c1c8389182656ed660 | 822413178a595bb15ee0eebcc42128e01c201daa | refs/heads/master | 2021-05-01T15:23:11.046976 | 2016-08-21T14:51:03 | 2016-08-21T14:51:03 | 63,421,713 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 194 | h | title_screen.h | #pragma once
#include "actor.h"
#include <vector>
#include "draw_text.h"
class title_screen : public actor
{
std::vector<text_render *> texts;
public:
title_screen();
~title_screen();
};
|
d368d9a69d1cc9ede16f9dcd37e9e699afb1fbd4 | b070047ea6d1168eb8f9e3fd892f389c3f674ff9 | /res/structs/list.cpp | a2ef2de413c6ea8fc872a64c3f0653fa8dd3fcc9 | [] | no_license | CE-02FED/HARFS | 834771763db773003e86bd4c8c0f319b280390bb | 6b685ef7f6cbcffa5feb162136ad8f29177eceab | refs/heads/master | 2020-04-06T04:22:24.392931 | 2015-06-21T14:36:40 | 2015-06-21T14:36:40 | 37,702,856 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,132 | cpp | list.cpp | #include "list.h"
/* Header */
#define FIRST_DATA 0
#define FIRST_EMPTY 4
#define OFFSET 8
#define DATA 20
/* Valores */
#define NULO -1
#define NOTHING 0
#define INT 4
#define STRING "string"
#define INTEGER "int"
List::List(string pName) {
_file = new RAID(false, pName);
archivoInicial();
_index = 0;
}
List::~List() {
}
void List::insertar(Vector<string>* datos) {
int posRelativa = espacio;
/** Asigna como registro siguiente, si fuera necesario **/
if (_file->read(primer) != NULO)
_file->write(espacio, posRelativa - INT);
/** Clave de registro **/
_file->write(_index, posRelativa);
posRelativa += INT;
_index++;
/** Dato registro **/
int contador = 0;
for (int i = 0; i < datos->getHeight(); i++) {
if ((*_esquema)[i][1] == STRING) {
int tamano = stoi((*_esquema)[i][2]);
_file->write(*(*datos)[i], posRelativa, stoi((*_esquema)[i][2]));
posRelativa += tamano;
contador += tamano;
} else if ((*_esquema)[i][1] == INTEGER) {
int tamano = stoi((*_esquema)[i][2]);
_file->write(stoi(*(*datos)[i]), posRelativa);
posRelativa += tamano;
contador += tamano;
}
}
/** Asigna offset de tamano dato **/
_file->write(contador, OFFSET);
/** Asigna registro siguiente vacio **/
_file->write(NULO, posRelativa);
posRelativa += INT;
/** Establece nuevo primer registro vacio **/
espacio = posRelativa;
_file->write(posRelativa, FIRST_EMPTY);
_file->write(NULO, posRelativa);
_file->write(DATA, FIRST_DATA);
}
void List::archivoInicial() {
if (_file->read(FIRST_DATA) == NULO) {
_file->write(NOTHING, FIRST_DATA); // entero a escribir, desplazamiento
_file->write(DATA, FIRST_EMPTY);
_file->write(NOTHING, OFFSET);
_file->write(NULO, DATA);
}
primer = _file->read(FIRST_DATA);
espacio = _file->read(FIRST_EMPTY);
}
void List::borrar() {
int nodoActual = primer;
int nodoTmp, tamDato;
while (nodoActual != NULO) {
tamDato = _file->read(OFFSET);
nodoTmp = nodoActual;
nodoActual = _file->read(nodoActual + INT + tamDato);
}
_file->write(NULO, nodoTmp + INT + tamDato);
_file->write(nodoActual, FIRST_EMPTY);
}
int List::buscar(string pClave, string pColumna) {
int nodoActual = primer;
while (nodoActual != NULO) {
for (int i = 0; i < _esquema->getHeight(); i++) {
if ((*_esquema)[i][0] == pColumna) {
if (i < 1) {
if (pClave == _file->read(nodoActual + INT, stoi((*_esquema)[i][2]))) {
return nodoActual;
}
} else {
if (pClave == _file->read(nodoActual + INT + stoi((*_esquema)[i - 1][2]), stoi((*_esquema)[i][2]))) {
return nodoActual;
}
}
}
}
}
return 0;
}
void List::definirEsquema(Vector<string>* pEsquema) {
_esquema = pEsquema;
}
Vector<string>* List::getRegistro(int pOffset) {
Vector<string>* respuesta = new Vector<string>(_esquema->getHeight());
for (int i = 0; i < respuesta->lenght(); i++) {
if (i < 1) {
*(*respuesta)[i] = _file->read(pOffset + INT, stoi((*_esquema)[i][2]));
} else {
*(*respuesta)[i] = _file->read(pOffset + INT + stoi((*_esquema)[i - 1][2]), stoi((*_esquema)[i][2]));
}
}
return respuesta;
}
RAID* List::getFile() {
return _file;
}
|
62d906c63a45b6a92241bbf9d2cdbfe48ba120c8 | 582f2cc0cdbff7240741e2a5c3ece1f1dcee282c | /Xtreme/Xtreme2021/coloring-tiles.cpp | e69119829508012d036a112dec47dab5eada2414 | [] | no_license | moondemon68/cp | 7593057a124cdef51341bf75fb780a9b03b8ea12 | 3b5ebd39783253348763ea58f7e84608679c17c3 | refs/heads/master | 2022-02-23T21:04:30.962383 | 2022-02-04T16:31:41 | 2022-02-04T16:31:41 | 149,121,917 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,725 | cpp | coloring-tiles.cpp | #include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define INF 1234567890
#define pii pair<int,int>
#define LL long long
using namespace std;
int main () {
//clock_t start = clock();
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int tc;
cin >> tc;
while (tc--) {
int n, m, c;
cin >> n >> m >> c;
char a[n+5][m+5];
for (int i=1;i<=n;i++) {
string s;
cin >> s;
for (int j=1;j<=m;j++) {
a[i][j] = s[j-1];
}
}
c++; // buat warna kosong
int dp[m+5][c*c];
memset(dp,0,sizeof(dp));
for (int i=0;i<c*c;i++) {
if (i % c == 0) {
dp[1][i] = 1;
} else if (i/c == 0) {
dp[1][i] = 1;
} else {
dp[1][i] = 1;
}
}
for (int i=2;i<=m;i++) {
for (int j=0;j<c*c;j++) {
for (int k=0;k<c*c;k++) {
if (a[1][i-1] == '#' && (j % c > 0)) continue;
if (a[2][i-1] == '#' && (j / c > 0)) continue;
if (a[1][i] == '#' && (k % c > 0)) continue;
if (a[2][i] == '#' && (k / c > 0)) continue;
if (a[1][i-1] == '.' && (j % c == 0)) continue;
if (a[2][i-1] == '.' && (j / c == 0)) continue;
if (a[1][i] == '.' && (k % c == 0)) continue;
if (a[2][i] == '.' && (k / c == 0)) continue;
vector<int> v;
if (a[1][i-1] == '.') v.pb(j%c);
if (a[2][i-1] == '.') v.pb(j/c);
if (a[1][i] == '.') v.pb(k%c);
if (a[2][i] == '.') v.pb(k/c);
sort(v.begin(), v.end());
if (v.size() >= 3 && v[0] == v[1] && v[1] == v[2]) continue;
if (v.size() >= 4 && v[1] == v[2] && v[2] == v[3]) continue;
dp[i][k] += dp[i-1][j];
dp[i][k] %= MOD;
}
}
}
int ans = 0;
for (int i=0;i<c*c;i++) {
if (i % c > 0 && a[1][m] == '#') continue;
if (i / c > 0 && a[2][m] == '#') continue;
ans += dp[m][i];
ans %= MOD;
}
cout << ans << endl;
// for (int i=1;i<=m;i++) {
// for (int j=0;j<c*c;j++) {
// cout << dp[i][j] << " ";
// }
// cout << endl;
// }
}
//cerr << fixed << setprecision(3) << (clock()-start)*1./CLOCKS_PER_SEC << endl;
return 0;
} |
5245dd73a8d949ebdb33940e8ea91b2b98f41f5c | 810dda885341230060dde8b8ce2a6c10b976a96a | /src/modules/core/ThreadPool.cpp | e39a8b13006c72cbe1bd7a6eb53c602342166091 | [] | no_license | aiekick/engine | 99f1d99ccb9c7b5108189d5c4399e294f236d033 | c90c66ede21d11bf7c689e68e461a193dd5cb7d6 | refs/heads/master | 2020-03-11T19:43:06.203687 | 2018-04-16T20:34:51 | 2018-04-16T20:34:51 | 130,215,870 | 1 | 0 | null | 2018-04-19T12:57:21 | 2018-04-19T12:57:21 | null | UTF-8 | C++ | false | false | 1,531 | cpp | ThreadPool.cpp | /**
* @file
*/
#include "ThreadPool.h"
#include "core/String.h"
#include "core/Trace.h"
#include "core/Concurrency.h"
namespace core {
ThreadPool::ThreadPool(size_t threads, const char *name) :
_threads(threads), _name(name) {
if (_name == nullptr) {
_name = "ThreadPool";
}
}
void ThreadPool::init() {
_workers.reserve(_threads);
for (size_t i = 0; i < _threads; ++i) {
_workers.emplace_back([this, i] {
const std::string n = core::string::format("%s-%i", this->_name, (int)i);
setThreadName(n.c_str());
core_trace_thread(n.c_str());
for (;;) {
std::function<void()> task;
{
std::unique_lock<std::mutex> lock(this->_queueMutex);
this->_queueCondition.wait(lock, [this] {
return this->_stop || !this->_tasks.empty();
});
if (this->_stop && (this->_force || this->_tasks.empty())) {
break;
}
task = std::move(this->_tasks.front());
this->_tasks.pop();
}
core_trace_begin_frame();
core_trace_scoped(ThreadPoolWorker);
task();
core_trace_end_frame();
}
++_shutdownCount;
_shutdownCondition.notify_all();
});
}
}
ThreadPool::~ThreadPool() {
shutdown();
}
void ThreadPool::shutdown(bool wait) {
if (_stop) {
return;
}
_force = !wait;
_stop = true;
_queueCondition.notify_all();
{
std::unique_lock<std::mutex> lock(_shutdownMutex);
_shutdownCondition.wait(lock, [&] { return _shutdownCount == (int)_workers.size(); });
}
for (std::thread &worker : _workers) {
worker.join();
}
_workers.clear();
}
}
|
f7efc473931da5f5a679cc4b63b6a796b466c038 | c187567f9da8e004f75bfffe1f9532b4488de1fa | /cpp/include/alibabacloud/open_api_util.hpp | 436e1134a418fa80ddb596e7b631d7fb5f866bc7 | [
"Apache-2.0"
] | permissive | aliyun/darabonba-openapi-util | a90fc42d80998296ad6a2bcfa11d341e2d7a918b | 5406e9db5f83c13e91abff6dbb8875828c29dcfd | refs/heads/master | 2023-08-04T01:14:35.496177 | 2023-08-02T01:37:42 | 2023-08-02T01:37:42 | 286,955,004 | 7 | 20 | null | 2023-08-02T01:32:36 | 2020-08-12T08:07:47 | C++ | UTF-8 | C++ | false | false | 2,224 | hpp | open_api_util.hpp | // This file is auto-generated, don't edit it. Thanks.
#ifndef ALIBABACLOUD_OPENAPIUTIL_H_
#define ALIBABACLOUD_OPENAPIUTIL_H_
#include <boost/any.hpp>
#include <darabonba/core.hpp>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
namespace Alibabacloud_OpenApiUtil {
class Client {
public:
static void convert(shared_ptr<Darabonba::Model> body,
shared_ptr<Darabonba::Model> content);
static string getStringToSign(shared_ptr<Darabonba::Request> request);
static string getROASignature(shared_ptr<string> stringToSign,
shared_ptr<string> secret);
static string toForm(shared_ptr<map<string, boost::any>> filter);
static string getTimestamp();
static map<string, string> query(shared_ptr<map<string, boost::any>> filter);
static string getRPCSignature(shared_ptr<map<string, string>> signedParams,
shared_ptr<string> method,
shared_ptr<string> secret);
static string arrayToStringWithSpecifiedStyle(const boost::any &array,
shared_ptr<string> prefix,
shared_ptr<string> style);
static map<string, boost::any> parseToMap(const boost::any &input);
static string getEndpoint(shared_ptr<string> endpoint,
shared_ptr<bool> serverUse,
shared_ptr<string> endpointType);
static string hexEncode(shared_ptr<vector<uint8_t>> raw);
static vector<uint8_t> hash(shared_ptr<vector<uint8_t>> raw,
shared_ptr<string> signatureAlgorithm);
static string getAuthorization(shared_ptr<Darabonba::Request> request,
shared_ptr<string> signatureAlgorithm,
shared_ptr<string> payload,
shared_ptr<string> acesskey,
shared_ptr<string> accessKeySecret);
static string getEncodePath(shared_ptr<string> path);
static string getEncodeParam(shared_ptr<string> param);
Client() {};
virtual ~Client() = default;
};
} // namespace Alibabacloud_OpenApiUtil
#endif
|
7a1bfc56fa51a666af9e606445bc6b1f4044c2f7 | 23da16219262910cb6473ab4581b0f1df2be4e67 | /source/domini/transaccions/Transaccio.h | 6f4bc85c7233b85c19c70d4ea68ab8f4ee0fcdff | [] | no_license | MrManwe/IES-CadenaDeRestaurants | be2dea5f46f70c46649f0976d7e470fbfaa96ae7 | 83436bddb82156c65821247d37515bf1a169d7f0 | refs/heads/master | 2022-07-22T22:20:22.830412 | 2020-05-10T16:05:13 | 2020-05-10T16:05:13 | 262,822,966 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 99 | h | Transaccio.h | #pragma once
namespace domini
{
class Transaccio
{
public:
virtual void Executar() = 0;
};
} |
60d5b38519de8d293e0406e671274683a111484c | 0ffc09935d2798a866b8500589b0edf888ccc033 | /C++11/STL and C++11/functor_1.cpp | 42c2d91ea8e53682e6f1de51b4520d3fa51e8c25 | [] | no_license | bhargav57/C-11 | 8577a9ca310bbc7b551d8368517a17eefdd9f137 | ecaf2c9db328a085152542f140a78cc8c98c9493 | refs/heads/master | 2023-04-23T21:51:44.809840 | 2023-04-09T06:31:18 | 2023-04-09T06:31:18 | 231,399,429 | 0 | 0 | null | 2020-03-15T14:42:52 | 2020-01-02T14:36:07 | C++ | UTF-8 | C++ | false | false | 1,604 | cpp | functor_1.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
struct containnuts
{
string data;
containnuts(string indata):data(indata){}
bool operator()(string d)
{
return d.compare(data) == 0? true:false;
}
};
int main()
{
std::string s = "Hello my name is Bhargav Patel\n";
vector<char> capital;
std::transform(begin(s), end(s), begin(s), [&](char c)
{
if (isupper(c))
{
capital.push_back(c);
return tolower(c);
}
else
return tolower(c);
});
std::replace_if(begin(s), end(s),
[](const char& c)
{
return iswspace(c)?true:false;
}, '*');
//replace_if(begin(s), end(s), [](const char& c) {return iswspace(c) ? true : false; }, '*');
std::cout << s;
//functor code
vector<string> nuts{ "lemon","apple","walnut","orange" };
/*
Here containnuts is a struct/class has an operator() implemented which takes the string argument
here in the code this find_if fucntion is iterating one by one collection object.
in this case nuts is a collection/vector of string objects
so in any operator overloading fucntion, the left side object which call the operator() fucntion.
in below case, string objects call the operator and that string object which we need to compare that we have to pass as an argument
here we want to comate the "almond" with all nuts collection so we pass that as an() argument and the vector of the string calls that operator.
*/
auto found{std::find_if(begin(nuts),end(nuts),containnuts("almond"))};
} |
9d37ccbbabfeb1e8a5084b8a01441be15e6a3205 | ea2770ac93714bfad1b5e77480c90bc8c3e9ec53 | /NagyHF2/FantasyFilm.cpp | 692c75d891a3a05a978ef0799a0b56cec65ca2d3 | [] | no_license | Agilitis/cpphomework | e8ea006737dadb628fc992ef166c643384dbf742 | e55d38bf9f1d776e079f1ad1ae65557e91ca7d15 | refs/heads/master | 2020-03-08T20:47:12.642721 | 2018-04-14T07:58:48 | 2018-04-14T07:58:48 | 128,391,269 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 360 | cpp | FantasyFilm.cpp | #include "FantasyFilm.h"
FantasyFilm::FantasyFilm()
{
}
FantasyFilm::FantasyFilm(String title, int price, int length, int rating, int year, String genre, int id)
{
this->rentingPrice = price;
this->id = id;
this->title = title;
this->length = length;
this->genre = genre;
this->rating = rating;
this->year = year;
}
FantasyFilm::~FantasyFilm()
{
}
|
19d9c93f32560df51954c7da8177dd7f39059a11 | 74fc54b737d998c8b89a12a4f804cb6fdc2fd508 | /codechef/aprilLong2020/carsell.cpp | f46a14d8c2af796f155000447e27f4238995a30f | [] | no_license | NVS16/competitive_coding | 2953d2689f70f1cbe9b030e3696ad63f1bf71516 | 81091ce49e176eb67d437b48317f9a0e7ed933a0 | refs/heads/master | 2021-04-05T20:10:54.633556 | 2020-05-01T18:07:46 | 2020-05-01T18:07:46 | 248,596,329 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 616 | cpp | carsell.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#define vi vector<int>
#define Z 1000000007
using namespace std;
int findMaxProfit(vi &nums)
{
int maxProfit = 0, i = 0;
sort(nums.begin(), nums.end(), greater<int>());
for (int num: nums) {
maxProfit = (maxProfit + max(0, num - i)) % Z;
i++;
}
return maxProfit;
}
int main()
{
int T, n, temp;
cin >> T;
while (T--) {
cin >> n;
vi nums(n);
for (int i = 0; i < n; i++) {
cin >> nums[i];
}
cout << findMaxProfit(nums) << endl;
}
return 0;
} |
9dd242df4ad281014d9045f7b66dba15f39fc547 | 55c4cc0267d6d59b1ae67353ada3106f36b452e8 | /Arcade Project C++/src/games/nibbler/SnakeBody.hpp | d8a53df2f3d1a382b9c0b8da4734a481c8d82b0b | [] | no_license | titouan01/Project | c8d4f53104b7bb6466747f4fefbf1d99be8c05ce | c041bd0b6cdaeec10ab5c71875b024f4d29c23e8 | refs/heads/master | 2023-04-11T07:43:13.240876 | 2021-04-15T11:02:47 | 2021-04-15T11:02:47 | 334,940,005 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,018 | hpp | SnakeBody.hpp | /*
** EPITECH PROJECT, 2021
** B-OOP-400-MPL-4-1-arcade-richard.habimana
** File description:
** SnakeBody
*/
#ifndef SNAKEBODY_HPP_
#define SNAKEBODY_HPP_
#include "UtilityClasses.hpp"
#include "Nibbler.hpp"
enum Direction;
class SnakeBody {
public:
SnakeBody() {}
SnakeBody(Vector2i, Direction, int, Content);
~SnakeBody();
int getIndex() {return _index;}
Content getContent() {return _content;}
Direction getDirection() {return _direction;}
Vector2i getPos() {return _pos;}
void setNextPart(SnakeBody nexPart);
void updateSnake(Direction);
void updateSnake(SnakeBody);
void setDirection(Direction);
protected:
private:
void checkTurning();
Direction _direction;
Direction _tpmDirecion;
Content _content = BODY;
Vector2i _pos;
int _index;
};
#endif /* !SNAKEBODY_HPP_ */
|
895489af64f9ed8e52e810526655f417977b236d | 5a1cda823e3189282024bdbae231be6785118bf4 | /pat/1034.cpp | 90e00a39688d09edcd8c9555ec19e001f191ecf5 | [] | no_license | v-laughing/codeblog | d2a9dfb4b6f9463541120014bc5e6a6104d4cd11 | 422a79dc99345df77c0bf5651125d997eb918dcb | refs/heads/master | 2022-01-09T01:41:51.221715 | 2019-05-13T12:18:57 | 2019-05-13T12:18:57 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,525 | cpp | 1034.cpp | #include<iostream>
#include<string>
#include<vector>
#include<map>
#include <algorithm>
#include <cstdio>
using namespace std;
int maxn = 26*26*26;
vector<int> visit(maxn, 1), ptime(maxn);
vector<vector<int>> link(maxn), gang;
int hash_name(string name){
return (name[0] - 'A')*26*26 +
(name[1] - 'A')*26 +
(name[2] - 'A');
}
string hash_id(int id){
return string("") + char(id/(26*26) + 'A') +
char((id/26)%26 + 'A') +
char(id%26 + 'A');
}
void dfs(int id, int gi){
if(visit[id]) return ;
visit[id] = 1;
gang[gi].push_back(id);
for(auto i: link[id]) dfs(i, gi);
}
int total_time(vector<int> &v){
int t = 0;
for(auto i: v) t += ptime[i];
return t;
}
int main() {
int n, k; cin >> n >> k;
for (int i = 0; i < n; ++i){
string s1, s2; int t;
cin >> s1 >> s2 >> t;
int id1 = hash_name(s1), id2 = hash_name(s2);
link[id1].push_back(id2);
link[id2].push_back(id1);
ptime[id1] += t;
ptime[id2] += t;
visit[id1] = 0;
visit[id2] = 0;
}
gang.resize(n);
int gi = 0;
for (int i = 0; i < maxn; ++i){
if(visit[i]) continue;
dfs(i, gi);
gi++;
}
map<int, int> gmap;
int gnum = 0;
for (int i = 0; i < gi; ++i){
int size = gang[i].size();
if(size > 2 && total_time(gang[i]) > 2*k){
gnum++;
auto cmp = [](int id1, int id2){ return ::ptime[id1] < ::ptime[id2];};
auto it = max_element(gang[i].begin(), gang[i].end(), cmp);
gmap[*it] = size;
}
}
cout << gmap.size() << endl;
for(auto g: gmap) cout << hash_id(g.first) << " " << g.second << endl;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.