blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 201 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 7 100 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 260
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 11.4k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 80
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 8 9.86M | extension stringclasses 52
values | content stringlengths 8 9.86M | authors listlengths 1 1 | author stringlengths 0 119 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
19fd97b03ee8317c6564939b1ada04e91cec8f8e | 5640410ad4250d04c2f780d94d8270630998cc79 | /kryptofranccore/src/qt/optionsmodel.cpp | 75789951245a6bbe9c4535a9ead655e6db4a7e1b | [
"MIT"
] | permissive | NicolasChoukroun/Kryptofranc | 217c516d8c67c24a67956ba51abf859ab2977c13 | 6fbac7f2ad44387bd7e46c2aa3054d20931cbcf7 | refs/heads/master | 2020-06-15T18:17:29.082409 | 2020-05-26T13:33:58 | 2020-05-26T13:33:58 | 195,359,046 | 5 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 18,975 | cpp | // Copyright (c) 2011-2018 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#if defined(HAVE_CONFIG_H)
#include <config/bitcoin-config.h>
#endif
#include <qt/optionsmodel.h>
#include <qt/bitcoinunits.h>
#include <qt/guiconstants.h>
#include <qt/guiutil.h>
#include <interfaces/node.h>
#include <validation.h> // For DEFAULT_SCRIPTCHECK_THREADS
#include <net.h>
#include <netbase.h>
#include <txdb.h> // for -dbcache defaults
#include <qt/intro.h>
#include <QNetworkProxy>
#include <QSettings>
#include <QStringList>
const char *DEFAULT_GUI_PROXY_HOST = "127.0.0.1";
static const QString GetDefaultProxyAddress();
OptionsModel::OptionsModel(interfaces::Node& node, QObject *parent, bool resetSettings) :
QAbstractListModel(parent), m_node(node)
{
Init(resetSettings);
}
void OptionsModel::addOverriddenOption(const std::string &option)
{
strOverriddenByCommandLine += QString::fromStdString(option) + "=" + QString::fromStdString(gArgs.GetArg(option, "")) + " ";
}
// Writes all missing QSettings with their default values
void OptionsModel::Init(bool resetSettings)
{
if (resetSettings)
Reset();
checkAndMigrate();
QSettings settings;
// Ensure restart flag is unset on client startup
setRestartRequired(false);
// These are Qt-only settings:
// Window
if (!settings.contains("fHideTrayIcon"))
settings.setValue("fHideTrayIcon", false);
fHideTrayIcon = settings.value("fHideTrayIcon").toBool();
Q_EMIT hideTrayIconChanged(fHideTrayIcon);
if (!settings.contains("fMinimizeToTray"))
settings.setValue("fMinimizeToTray", false);
fMinimizeToTray = settings.value("fMinimizeToTray").toBool() && !fHideTrayIcon;
if (!settings.contains("fMinimizeOnClose"))
settings.setValue("fMinimizeOnClose", false);
fMinimizeOnClose = settings.value("fMinimizeOnClose").toBool();
// Display
if (!settings.contains("nDisplayUnit"))
settings.setValue("nDisplayUnit", KryptofrancUnits::KYF);
nDisplayUnit = settings.value("nDisplayUnit").toInt();
if (!settings.contains("strThirdPartyTxUrls"))
settings.setValue("strThirdPartyTxUrls", "");
strThirdPartyTxUrls = settings.value("strThirdPartyTxUrls", "").toString();
if (!settings.contains("fCoinControlFeatures"))
settings.setValue("fCoinControlFeatures", false);
fCoinControlFeatures = settings.value("fCoinControlFeatures", false).toBool();
// These are shared with the core or have a command-line parameter
// and we want command-line parameters to overwrite the GUI settings.
//
// If setting doesn't exist create it with defaults.
//
// If gArgs.SoftSetArg() or gArgs.SoftSetBoolArg() return false we were overridden
// by command-line and show this in the UI.
// Main
if (!settings.contains("bPrune"))
settings.setValue("bPrune", false);
if (!settings.contains("nPruneSize"))
settings.setValue("nPruneSize", 2);
// Convert prune size from GB to MiB:
const uint64_t nPruneSizeMiB = (settings.value("nPruneSize").toInt() * GB_BYTES) >> 20;
if (!m_node.softSetArg("-prune", settings.value("bPrune").toBool() ? std::to_string(nPruneSizeMiB) : "0")) {
addOverriddenOption("-prune");
}
if (!settings.contains("nDatabaseCache"))
settings.setValue("nDatabaseCache", (qint64)nDefaultDbCache);
if (!m_node.softSetArg("-dbcache", settings.value("nDatabaseCache").toString().toStdString()))
addOverriddenOption("-dbcache");
if (!settings.contains("nThreadsScriptVerif"))
settings.setValue("nThreadsScriptVerif", DEFAULT_SCRIPTCHECK_THREADS);
if (!m_node.softSetArg("-par", settings.value("nThreadsScriptVerif").toString().toStdString()))
addOverriddenOption("-par");
if (!settings.contains("strDataDir"))
settings.setValue("strDataDir", Intro::getDefaultDataDirectory());
// Wallet
#ifdef ENABLE_WALLET
if (!settings.contains("bSpendZeroConfChange"))
settings.setValue("bSpendZeroConfChange", true);
if (!m_node.softSetBoolArg("-spendzeroconfchange", settings.value("bSpendZeroConfChange").toBool()))
addOverriddenOption("-spendzeroconfchange");
#endif
// Network
if (!settings.contains("fUseUPnP"))
settings.setValue("fUseUPnP", DEFAULT_UPNP);
if (!m_node.softSetBoolArg("-upnp", settings.value("fUseUPnP").toBool()))
addOverriddenOption("-upnp");
if (!settings.contains("fListen"))
settings.setValue("fListen", DEFAULT_LISTEN);
if (!m_node.softSetBoolArg("-listen", settings.value("fListen").toBool()))
addOverriddenOption("-listen");
if (!settings.contains("fUseProxy"))
settings.setValue("fUseProxy", false);
if (!settings.contains("addrProxy"))
settings.setValue("addrProxy", GetDefaultProxyAddress());
// Only try to set -proxy, if user has enabled fUseProxy
if (settings.value("fUseProxy").toBool() && !m_node.softSetArg("-proxy", settings.value("addrProxy").toString().toStdString()))
addOverriddenOption("-proxy");
else if(!settings.value("fUseProxy").toBool() && !gArgs.GetArg("-proxy", "").empty())
addOverriddenOption("-proxy");
if (!settings.contains("fUseSeparateProxyTor"))
settings.setValue("fUseSeparateProxyTor", false);
if (!settings.contains("addrSeparateProxyTor"))
settings.setValue("addrSeparateProxyTor", GetDefaultProxyAddress());
// Only try to set -onion, if user has enabled fUseSeparateProxyTor
if (settings.value("fUseSeparateProxyTor").toBool() && !m_node.softSetArg("-onion", settings.value("addrSeparateProxyTor").toString().toStdString()))
addOverriddenOption("-onion");
else if(!settings.value("fUseSeparateProxyTor").toBool() && !gArgs.GetArg("-onion", "").empty())
addOverriddenOption("-onion");
// Display
if (!settings.contains("language"))
settings.setValue("language", "");
if (!m_node.softSetArg("-lang", settings.value("language").toString().toStdString()))
addOverriddenOption("-lang");
language = settings.value("language").toString();
}
/** Helper function to copy contents from one QSettings to another.
* By using allKeys this also covers nested settings in a hierarchy.
*/
static void CopySettings(QSettings& dst, const QSettings& src)
{
for (const QString& key : src.allKeys()) {
dst.setValue(key, src.value(key));
}
}
/** Back up a QSettings to an ini-formatted file. */
static void BackupSettings(const fs::path& filename, const QSettings& src)
{
qWarning() << "Backing up GUI settings to" << GUIUtil::boostPathToQString(filename);
QSettings dst(GUIUtil::boostPathToQString(filename), QSettings::IniFormat);
dst.clear();
CopySettings(dst, src);
}
void OptionsModel::Reset()
{
QSettings settings;
// Backup old settings to chain-specific datadir for troubleshooting
BackupSettings(GetDataDir(true) / "guisettings.ini.bak", settings);
// Save the strDataDir setting
QString dataDir = Intro::getDefaultDataDirectory();
dataDir = settings.value("strDataDir", dataDir).toString();
// Remove all entries from our QSettings object
settings.clear();
// Set strDataDir
settings.setValue("strDataDir", dataDir);
// Set that this was reset
settings.setValue("fReset", true);
// default setting for OptionsModel::StartAtStartup - disabled
if (GUIUtil::GetStartOnSystemStartup())
GUIUtil::SetStartOnSystemStartup(false);
}
int OptionsModel::rowCount(const QModelIndex & parent) const
{
return OptionIDRowCount;
}
struct ProxySetting {
bool is_set;
QString ip;
QString port;
};
static ProxySetting GetProxySetting(QSettings &settings, const QString &name)
{
static const ProxySetting default_val = {false, DEFAULT_GUI_PROXY_HOST, QString("%1").arg(DEFAULT_GUI_PROXY_PORT)};
// Handle the case that the setting is not set at all
if (!settings.contains(name)) {
return default_val;
}
// contains IP at index 0 and port at index 1
QStringList ip_port = settings.value(name).toString().split(":", QString::SkipEmptyParts);
if (ip_port.size() == 2) {
return {true, ip_port.at(0), ip_port.at(1)};
} else { // Invalid: return default
return default_val;
}
}
static void SetProxySetting(QSettings &settings, const QString &name, const ProxySetting &ip_port)
{
settings.setValue(name, ip_port.ip + ":" + ip_port.port);
}
static const QString GetDefaultProxyAddress()
{
return QString("%1:%2").arg(DEFAULT_GUI_PROXY_HOST).arg(DEFAULT_GUI_PROXY_PORT);
}
// read QSettings values and return them
QVariant OptionsModel::data(const QModelIndex & index, int role) const
{
if(role == Qt::EditRole)
{
QSettings settings;
switch(index.row())
{
case StartAtStartup:
return GUIUtil::GetStartOnSystemStartup();
case HideTrayIcon:
return fHideTrayIcon;
case MinimizeToTray:
return fMinimizeToTray;
case MapPortUPnP:
#ifdef USE_UPNP
return settings.value("fUseUPnP");
#else
return false;
#endif
case MinimizeOnClose:
return fMinimizeOnClose;
// default proxy
case ProxyUse:
return settings.value("fUseProxy", false);
case ProxyIP:
return GetProxySetting(settings, "addrProxy").ip;
case ProxyPort:
return GetProxySetting(settings, "addrProxy").port;
// separate Tor proxy
case ProxyUseTor:
return settings.value("fUseSeparateProxyTor", false);
case ProxyIPTor:
return GetProxySetting(settings, "addrSeparateProxyTor").ip;
case ProxyPortTor:
return GetProxySetting(settings, "addrSeparateProxyTor").port;
#ifdef ENABLE_WALLET
case SpendZeroConfChange:
return settings.value("bSpendZeroConfChange");
#endif
case DisplayUnit:
return nDisplayUnit;
case ThirdPartyTxUrls:
return strThirdPartyTxUrls;
case Language:
return settings.value("language");
case CoinControlFeatures:
return fCoinControlFeatures;
case Prune:
return settings.value("bPrune");
case PruneSize:
return settings.value("nPruneSize");
case DatabaseCache:
return settings.value("nDatabaseCache");
case ThreadsScriptVerif:
return settings.value("nThreadsScriptVerif");
case Listen:
return settings.value("fListen");
default:
return QVariant();
}
}
return QVariant();
}
// write QSettings values
bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, int role)
{
bool successful = true; /* set to false on parse error */
if(role == Qt::EditRole)
{
QSettings settings;
switch(index.row())
{
case StartAtStartup:
successful = GUIUtil::SetStartOnSystemStartup(value.toBool());
break;
case HideTrayIcon:
fHideTrayIcon = value.toBool();
settings.setValue("fHideTrayIcon", fHideTrayIcon);
Q_EMIT hideTrayIconChanged(fHideTrayIcon);
break;
case MinimizeToTray:
fMinimizeToTray = value.toBool();
settings.setValue("fMinimizeToTray", fMinimizeToTray);
break;
case MapPortUPnP: // core option - can be changed on-the-fly
settings.setValue("fUseUPnP", value.toBool());
m_node.mapPort(value.toBool());
break;
case MinimizeOnClose:
fMinimizeOnClose = value.toBool();
settings.setValue("fMinimizeOnClose", fMinimizeOnClose);
break;
// default proxy
case ProxyUse:
if (settings.value("fUseProxy") != value) {
settings.setValue("fUseProxy", value.toBool());
setRestartRequired(true);
}
break;
case ProxyIP: {
auto ip_port = GetProxySetting(settings, "addrProxy");
if (!ip_port.is_set || ip_port.ip != value.toString()) {
ip_port.ip = value.toString();
SetProxySetting(settings, "addrProxy", ip_port);
setRestartRequired(true);
}
}
break;
case ProxyPort: {
auto ip_port = GetProxySetting(settings, "addrProxy");
if (!ip_port.is_set || ip_port.port != value.toString()) {
ip_port.port = value.toString();
SetProxySetting(settings, "addrProxy", ip_port);
setRestartRequired(true);
}
}
break;
// separate Tor proxy
case ProxyUseTor:
if (settings.value("fUseSeparateProxyTor") != value) {
settings.setValue("fUseSeparateProxyTor", value.toBool());
setRestartRequired(true);
}
break;
case ProxyIPTor: {
auto ip_port = GetProxySetting(settings, "addrSeparateProxyTor");
if (!ip_port.is_set || ip_port.ip != value.toString()) {
ip_port.ip = value.toString();
SetProxySetting(settings, "addrSeparateProxyTor", ip_port);
setRestartRequired(true);
}
}
break;
case ProxyPortTor: {
auto ip_port = GetProxySetting(settings, "addrSeparateProxyTor");
if (!ip_port.is_set || ip_port.port != value.toString()) {
ip_port.port = value.toString();
SetProxySetting(settings, "addrSeparateProxyTor", ip_port);
setRestartRequired(true);
}
}
break;
#ifdef ENABLE_WALLET
case SpendZeroConfChange:
if (settings.value("bSpendZeroConfChange") != value) {
settings.setValue("bSpendZeroConfChange", value);
setRestartRequired(true);
}
break;
#endif
case DisplayUnit:
setDisplayUnit(value);
break;
case ThirdPartyTxUrls:
if (strThirdPartyTxUrls != value.toString()) {
strThirdPartyTxUrls = value.toString();
settings.setValue("strThirdPartyTxUrls", strThirdPartyTxUrls);
setRestartRequired(true);
}
break;
case Language:
if (settings.value("language") != value) {
settings.setValue("language", value);
setRestartRequired(true);
}
break;
case CoinControlFeatures:
fCoinControlFeatures = value.toBool();
settings.setValue("fCoinControlFeatures", fCoinControlFeatures);
Q_EMIT coinControlFeaturesChanged(fCoinControlFeatures);
break;
case Prune:
if (settings.value("bPrune") != value) {
settings.setValue("bPrune", value);
setRestartRequired(true);
}
break;
case PruneSize:
if (settings.value("nPruneSize") != value) {
settings.setValue("nPruneSize", value);
setRestartRequired(true);
}
break;
case DatabaseCache:
if (settings.value("nDatabaseCache") != value) {
settings.setValue("nDatabaseCache", value);
setRestartRequired(true);
}
break;
case ThreadsScriptVerif:
if (settings.value("nThreadsScriptVerif") != value) {
settings.setValue("nThreadsScriptVerif", value);
setRestartRequired(true);
}
break;
case Listen:
if (settings.value("fListen") != value) {
settings.setValue("fListen", value);
setRestartRequired(true);
}
break;
default:
break;
}
}
Q_EMIT dataChanged(index, index);
return successful;
}
/** Updates current unit in memory, settings and emits displayUnitChanged(newUnit) signal */
void OptionsModel::setDisplayUnit(const QVariant &value)
{
if (!value.isNull())
{
QSettings settings;
nDisplayUnit = value.toInt();
settings.setValue("nDisplayUnit", nDisplayUnit);
Q_EMIT displayUnitChanged(nDisplayUnit);
}
}
bool OptionsModel::getProxySettings(QNetworkProxy& proxy) const
{
// Directly query current base proxy, because
// GUI settings can be overridden with -proxy.
proxyType curProxy;
if (m_node.getProxy(NET_IPV4, curProxy)) {
proxy.setType(QNetworkProxy::Socks5Proxy);
proxy.setHostName(QString::fromStdString(curProxy.proxy.ToStringIP()));
proxy.setPort(curProxy.proxy.GetPort());
return true;
}
else
proxy.setType(QNetworkProxy::NoProxy);
return false;
}
void OptionsModel::setRestartRequired(bool fRequired)
{
QSettings settings;
return settings.setValue("fRestartRequired", fRequired);
}
bool OptionsModel::isRestartRequired() const
{
QSettings settings;
return settings.value("fRestartRequired", false).toBool();
}
void OptionsModel::checkAndMigrate()
{
// Migration of default values
// Check if the QSettings container was already loaded with this client version
QSettings settings;
static const char strSettingsVersionKey[] = "nSettingsVersion";
int settingsVersion = settings.contains(strSettingsVersionKey) ? settings.value(strSettingsVersionKey).toInt() : 0;
if (settingsVersion < CLIENT_VERSION)
{
// -dbcache was bumped from 100 to 300 in 0.13
// see https://github.com/kryptofranc/kryptofranc/pull/8273
// force people to upgrade to the new value if they are using 100MB
if (settingsVersion < 130000 && settings.contains("nDatabaseCache") && settings.value("nDatabaseCache").toLongLong() == 100)
settings.setValue("nDatabaseCache", (qint64)nDefaultDbCache);
settings.setValue(strSettingsVersionKey, CLIENT_VERSION);
}
// Overwrite the 'addrProxy' setting in case it has been set to an illegal
// default value (see issue #12623; PR #12650).
if (settings.contains("addrProxy") && settings.value("addrProxy").toString().endsWith("%2")) {
settings.setValue("addrProxy", GetDefaultProxyAddress());
}
// Overwrite the 'addrSeparateProxyTor' setting in case it has been set to an illegal
// default value (see issue #12623; PR #12650).
if (settings.contains("addrSeparateProxyTor") && settings.value("addrSeparateProxyTor").toString().endsWith("%2")) {
settings.setValue("addrSeparateProxyTor", GetDefaultProxyAddress());
}
}
| [
"nicolas.choukroun@yandex.com"
] | nicolas.choukroun@yandex.com |
54df99dede73afb2c9286c25a966ecf8f80c4e91 | 739830e7ec59dcb59dd406ef56a2da246e8df2a1 | /Sesion.7/49.sesion7.cpp | f31c6711276f0c40657c44cd8f6011db352b688b | [] | no_license | JJavier98/FP | 304295cc3536f5fce6acb3e5745e889b61fd449e | b198a527068e2878122d9ff841bbf25a04625491 | refs/heads/master | 2021-05-12T08:18:01.265949 | 2018-01-12T18:32:01 | 2018-01-12T18:32:01 | 117,274,996 | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 1,075 | cpp | /*
49.- Diremos que un número entero positivo es secuenciable si se puede generar como
suma de números consecutivos (al menos dos). Por ejemplo, 6 = 1+2+3, 15 = 7+8.
Esta descomposición no tiene por qué ser única. Por ejemplo, 15 = 7+8 = 4+5+6 =
1+2+3+4+5. Escriba un programa que lea un entero n 1 e imprima todas las
descomposiciones posibles. En este ejercicio puede mezclar operaciones de E/S y C
dentro del mismo bucle.
*/
#include <iostream>
using namespace std;
int main(){
// Variables
int numero,
suma,
inicializador,
final,
Valor_suma;
// Introduccion de datos
cout << "Introduzca un valor para mostrarlo como una suma de números consecutivos. \n Valor: ";
cin >> numero;
// Cómputos y resultados
for (inicializador = 1 ; inicializador < numero ; inicializador++){
suma = 0;
for (final = inicializador ; suma < numero ; final++){
suma = suma + final;
if (suma == numero){
for (Valor_suma = inicializador ; Valor_suma <= final ; Valor_suma++)
cout << Valor_suma << " + ";
cout << " | ";
}
}
}
}
| [
"jjavier.ar98@gmail.com"
] | jjavier.ar98@gmail.com |
55761a1a2e0c3f4f8bef439deed58edf2244879b | 9b48da12e8d70fb3d633b988b9c7d63a954434bf | /ECC8.1/Server/kennel/svdb_comb/svapiold/ObjCache.cpp | 17c5e999089d07cd5637f6f6613f58fd701ade50 | [] | no_license | SiteView/ECC8.1.3 | 446e222e33f37f0bb6b67a9799e1353db6308095 | 7d7d8c7e7d7e7e03fa14f9f0e3ce5e04aacdb033 | refs/heads/master | 2021-01-01T18:07:05.104362 | 2012-08-30T08:58:28 | 2012-08-30T08:58:28 | 4,735,167 | 1 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 21,519 | cpp |
#include "ObjCache.h"
#include "QueryData.h"
#include "util.h"
#include <Monitor.h>
#include <Entity.h>
string ObjectCache::svdbuser("default");
string ObjectCache::svdbaddr("localhost");
map<int, OBJECT> ObjectCache::MonitorTPL;
map<string, OBJECT> ObjectCache::EntityTPL;
map<string, OBJECT> ObjectCache::EntityGroup;
map<string, OBJECT> ObjectCache::Res;
map<string,map<string, OBJECT> > ObjectCache::Reskey;
map<string, VerOBJECT> ObjectCache::Svses;
map<string, VerOBJECT> ObjectCache::Monitors;
map<string, VerOBJECT> ObjectCache::Entities;
map<string, VerOBJECT> ObjectCache::Groups;
map<string, SingelRecord> ObjectCache::Dyns;
Mutex ObjectCache::m_LockMonitorTPL;
Mutex ObjectCache::m_LockEntityTPL;
Mutex ObjectCache::m_LockEntityGroup;
Mutex ObjectCache::m_LockRes;
Mutex ObjectCache::m_LockReskey;
Mutex ObjectCache::m_LockSvses;
Mutex ObjectCache::m_LockMonitors;
Mutex ObjectCache::m_LockEntities;
Mutex ObjectCache::m_LockGroups;
Mutex ObjectCache::m_LockDyns;
OBJECT ObjectCache::FastGetSVSE(string id)
{
map<string, VerOBJECT>::iterator it= Svses.find(id);
if( it != Svses.end() )
{
if( (it->second).obj != INVALID_VALUE )
{
if( CheckLatest(it->second,S_SVSE,id) )
return (it->second).obj;
}
}
ost::MutexLock lock(m_LockSvses);
if( it != Svses.end() )
{
if( (it->second).obj!= INVALID_VALUE )
CloseSVSE( (it->second).obj );
Svses.erase(it);
}
S_UINT ver;
OBJECT obj= GetSVSEWithVer( id, svdbuser, svdbaddr, ver );
if( obj==INVALID_VALUE )
return INVALID_VALUE;
char charver[256];
sprintf(charver,"%d",ver);
VerOBJECT vobj;
vobj.ver=charver;
vobj.obj=obj;
Svses.insert(make_pair(id, vobj));
return obj;
}
OBJECT ObjectCache::RefreshFastGetMonitor(string id)
{
map<string, VerOBJECT>::iterator it= Monitors.find(id);
if( it != Monitors.end() )
{
if( (it->second).obj != INVALID_VALUE )
return (it->second).obj;
}
ost::MutexLock lock(m_LockMonitors);
S_UINT ver;
OBJECT obj= GetMonitorWithVer( id, svdbuser, svdbaddr, ver );
if( obj==INVALID_VALUE )
return INVALID_VALUE;
char charver[256];
sprintf(charver,"%d",ver);
VerOBJECT vobj;
vobj.ver=charver;
vobj.obj=obj;
Monitors.insert(make_pair(id, vobj));
return obj;
}
OBJECT ObjectCache::FastGetMonitor(string id)
{
map<string, VerOBJECT>::iterator it= Monitors.find(id);
if( it != Monitors.end() )
{
if( (it->second).obj != INVALID_VALUE )
{
if( CheckLatest(it->second,S_MONITOR,id) )
return (it->second).obj;
}
}
ost::MutexLock lock(m_LockMonitors);
if( it != Monitors.end() )
{
if( (it->second).obj!= INVALID_VALUE )
CloseMonitor( (it->second).obj );
Monitors.erase(it);
}
S_UINT ver;
OBJECT obj= GetMonitorWithVer( id, svdbuser, svdbaddr, ver );
if( obj==INVALID_VALUE )
return INVALID_VALUE;
char charver[256];
sprintf(charver,"%d",ver);
VerOBJECT vobj;
vobj.ver=charver;
vobj.obj=obj;
Monitors.insert(make_pair(id, vobj));
return obj;
}
OBJECT ObjectCache::FastGetGroup(string id)
{
map<string, VerOBJECT>::iterator it= Groups.find(id);
if( it != Groups.end() )
{
if( (it->second).obj != INVALID_VALUE )
{
if( CheckLatest(it->second,S_GROUP,id) )
return (it->second).obj;
}
}
ost::MutexLock lock(m_LockGroups);
if( it != Groups.end() )
{
if( (it->second).obj!= INVALID_VALUE )
CloseGroup( (it->second).obj );
Groups.erase(it);
}
S_UINT ver;
OBJECT obj= GetGroupWithVer( id, svdbuser, svdbaddr, ver );
if( obj==INVALID_VALUE )
return INVALID_VALUE;
char charver[256];
sprintf(charver,"%d",ver);
VerOBJECT vobj;
vobj.ver=charver;
vobj.obj=obj;
Groups.insert(make_pair(id, vobj));
return obj;
}
OBJECT ObjectCache::RefreshFastGetEntity(string id)
{
map<string, VerOBJECT>::iterator it= Entities.find(id);
if( it != Entities.end() )
{
if( (it->second).obj != INVALID_VALUE )
return (it->second).obj;
}
ost::MutexLock lock(m_LockEntities);
S_UINT ver;
OBJECT obj= GetEntityWithVer( id, svdbuser, svdbaddr, ver );
if( obj==INVALID_VALUE )
return INVALID_VALUE;
char charver[256];
sprintf(charver,"%d",ver);
VerOBJECT vobj;
vobj.ver=charver;
vobj.obj=obj;
Entities.insert(make_pair(id, vobj));
return obj;
}
OBJECT ObjectCache::FastGetEntity(string id)
{
map<string, VerOBJECT>::iterator it= Entities.find(id);
if( it != Entities.end() )
{
if( (it->second).obj != INVALID_VALUE )
{
if( CheckLatest(it->second,S_ENTITY,id) )
return (it->second).obj;
}
}
ost::MutexLock lock(m_LockEntities);
if( it != Entities.end() )
{
if( (it->second).obj!= INVALID_VALUE )
CloseEntity( (it->second).obj );
Entities.erase(it);
}
S_UINT ver;
OBJECT obj= GetEntityWithVer( id, svdbuser, svdbaddr, ver );
if( obj==INVALID_VALUE )
return INVALID_VALUE;
char charver[256];
sprintf(charver,"%d",ver);
VerOBJECT vobj;
vobj.ver=charver;
vobj.obj=obj;
Entities.insert(make_pair(id, vobj));
return obj;
}
OBJECT ObjectCache::FastGetMonitorTPL(int id)
{
map<int,OBJECT>::iterator it= MonitorTPL.find(id);
if( it != MonitorTPL.end() )
return it->second;
OBJECT obj= GetMonitorTemplet( id, svdbuser, svdbaddr );
if( obj==INVALID_VALUE )
return INVALID_VALUE;
ost::MutexLock lock(m_LockMonitorTPL);
MonitorTPL.insert(make_pair(id, obj));
return obj;
}
OBJECT ObjectCache::FastGetEntityTPL(string id)
{
map<string, OBJECT>::iterator it= EntityTPL.find(id);
if( it != EntityTPL.end() )
return it->second;
OBJECT obj= GetEntityTemplet( id, svdbuser, svdbaddr );
if( obj==INVALID_VALUE )
return INVALID_VALUE;
ost::MutexLock lock(m_LockEntityTPL);
EntityTPL.insert(make_pair(id, obj));
return obj;
}
OBJECT ObjectCache::FastGetEntityGroup(string id)
{
map<string, OBJECT>::iterator it= EntityGroup.find(id);
if( it != EntityGroup.end() )
return it->second;
OBJECT obj= GetEntityGroup( id, svdbuser, svdbaddr );
if( obj==INVALID_VALUE )
return INVALID_VALUE;
ost::MutexLock lock(m_LockEntityGroup);
EntityGroup.insert(make_pair(id, obj));
return obj;
}
OBJECT ObjectCache::FastLoadResource(string lan)
{
map<string, OBJECT>::iterator it= Res.find(lan);
if( it != Res.end() )
return it->second;
OBJECT obj= LoadResource( lan, svdbaddr );
if( obj==INVALID_VALUE )
return INVALID_VALUE;
ost::MutexLock lock(m_LockRes);
Res.insert(make_pair(lan, obj));
return obj;
}
OBJECT ObjectCache::FastLoadResourceByKeys(string keys,string lan)
{
map<string,map<string, OBJECT> >::iterator mit= Reskey.find(lan);
map<string,OBJECT>::iterator it;
if( mit != Reskey.end() )
{
it= (mit->second).find(keys);
if( it!=(mit->second).end() )
return it->second;
}
OBJECT obj= LoadResourceByKeys( keys, lan, svdbaddr );
if( obj==INVALID_VALUE )
return INVALID_VALUE;
ost::MutexLock lock(m_LockReskey);
if( mit == Reskey.end() )
{
map<string, OBJECT> newkeys;
Reskey.insert(make_pair(lan,newkeys));
mit= Reskey.find(lan);
if( mit == Reskey.end() )
return obj;
}
(mit->second).insert(make_pair(keys, obj));
return obj;
}
bool ObjectCache::RefreshMonitors(string pid)
{
if(Monitors.empty())
return true;
PAIRLIST retlist; PAIRLIST::iterator lit;
if( !GetAllMonitorsInfo(retlist,"ObjectVersion",pid,svdbaddr) )
return false;
map<string, VerOBJECT>::iterator it;
for( lit=retlist.begin();lit!=retlist.end();lit++)
{
it= Monitors.find(lit->name);
if( it != Monitors.end() )
{
if( (it->second).ver.compare(lit->value) != 0 )
{
if( (it->second).obj!= INVALID_VALUE )
CloseMonitor( (it->second).obj );
ost::MutexLock lock(m_LockMonitors);
Monitors.erase(it);
}
}
}
return true;
}
bool ObjectCache::RefreshEntities(string pid)
{
if(Entities.empty())
return true;
PAIRLIST retlist; PAIRLIST::iterator lit;
if( !GetAllEntitysInfo(retlist,"ObjectVersion",pid,svdbaddr) )
return false;
map<string, VerOBJECT>::iterator it;
for( lit=retlist.begin();lit!=retlist.end();lit++)
{
it= Entities.find(lit->name);
if( it != Entities.end() )
{
if( (it->second).ver.compare(lit->value) != 0 )
{
if( (it->second).obj!= INVALID_VALUE )
CloseEntity( (it->second).obj );
ost::MutexLock lock(m_LockEntities);
Entities.erase(it);
}
}
}
return true;
}
void ObjectCache::SetUserAddr(string user,string addr)
{
svdbuser= user;
svdbaddr= addr;
for(map<int,OBJECT>::iterator it= MonitorTPL.begin(); it!=MonitorTPL.end(); ++it)
CloseMonitorTemplet( it->second );
MonitorTPL.clear();
for(map<string,OBJECT>::iterator it= EntityTPL.begin(); it!=EntityTPL.end(); ++it)
CloseEntityTemplet( it->second );
EntityTPL.clear();
for(map<string,OBJECT>::iterator it= EntityGroup.begin(); it!=EntityGroup.end(); ++it)
CloseEntityGroup( it->second );
EntityGroup.clear();
for(map<string,OBJECT>::iterator it= Res.begin(); it!=Res.end(); ++it)
CloseResource( it->second );
Res.clear();
for(map<string,map<string, OBJECT> >::iterator mit= Reskey.begin(); mit!=Reskey.end(); ++mit)
{
for(map<string,OBJECT>::iterator it= (mit->second).begin(); it!= (mit->second).end(); ++it)
CloseResource( it->second );
mit->second.clear();
}
Reskey.clear();
for(map<string,VerOBJECT>::iterator it= Monitors.begin(); it!=Monitors.end(); ++it)
CloseMonitor( (it->second).obj );
Monitors.clear();
for(map<string,VerOBJECT>::iterator it= Entities.begin(); it!=Entities.end(); ++it)
CloseEntity( (it->second).obj );
Entities.clear();
for(map<string,VerOBJECT>::iterator it= Groups.begin(); it!=Groups.end(); ++it)
CloseGroup( (it->second).obj );
Groups.clear();
for(map<string,VerOBJECT>::iterator it= Svses.begin(); it!=Svses.end(); ++it)
CloseSVSE( (it->second).obj );
Svses.clear();
for(map<string, SingelRecord>::iterator it= Dyns.begin(); it!=Dyns.end(); ++it)
{
if( it->second.data != NULL )
delete [] (it->second.data);
}
Dyns.clear();
}
bool ObjectCache::CheckLatest(VerOBJECT & vobj, int dtype, string id)
{
if(vobj.obj==INVALID_VALUE)
return false;
if(id.size()>=MAXQUEREYSTRINGLEN)
return false;
if(vobj.ver.size()>=MAXUSERLEN)
return false;
try{
SVDBQUERY querybuf={0};
querybuf.len = sizeof(SVDBQUERY);
querybuf.querytype=QUERY_LATEST;
querybuf.datatype= dtype;
querybuf.datalen=0;
strcpy(querybuf.idcuser, vobj.ver.c_str());
strcpy(querybuf.qstr, id.c_str());
QueryData qd;
S_UINT len=0;
char *pdata=NULL;
if(qd.Query(&querybuf,(void **)&pdata,len,svdbaddr))
{
if(pdata)
{
if(len>0)
{
int *pret=(int*)pdata;
if(*pret==SVDB_OK)
{
delete [] pdata;
return true;
}
}
delete [] pdata;
}
}
}catch(...)
{
return false;
}
return false;
}
bool ObjectCache::FastGetSVDYN(string id,SVDYN &dyn)
{
map<string, SingelRecord>::iterator it= Dyns.find(id);
if( it!=Dyns.end() && (it->second.data)!=NULL )
{
bool bret(false);
try{
bret=builddyn(it->second.data,it->second.datalen,dyn,true);
if(bret)
return true;
}catch(...)
{
printf("Exception to builddyn in Cache_GetSVDYN.");
}
}
return false;
}
bool ObjectCache::QuerySVDYNs( string pid, std::list<SingelRecord> & listrcd, std::list<SingelRecord> & listrcd_out )
{
unsigned int tlen= GetMassRecordListRawDataSize(listrcd);
svutil::buffer tbuf;
if(!tbuf.checksize(tlen))
return false;
const char *data= GetMassRecordListRawData(listrcd,tbuf,tlen);
if(data==NULL)
return false;
QueryData qd;
char *pdata=NULL;
S_UINT rlen=0;
S_UINT len=0;
SVDBQUERY querybuf={0};
querybuf.len = sizeof(SVDBQUERY);
querybuf.querytype=QUERY_MASSDYN;
querybuf.datatype=S_DB;
strcpy(querybuf.qstr,pid.c_str());
INIQUERY iquery={0};
iquery.len=sizeof(INIQUERY);
iquery.datatype=D_STRING;
iquery.datalen=tlen;
len+=sizeof(INIQUERY);
len+=tlen;
querybuf.datalen=len;
buffer buf;
if(!buf.checksize(len))
return INVALID_VALUE;
char *pt=buf.getbuffer();
memcpy(pt,&iquery,sizeof(INIQUERY));
pt+=sizeof(INIQUERY);
memmove(pt,data,tlen);
if(qd.Query(&querybuf,buf,len,(void **)&pdata,rlen,svdbaddr))
{
try{
std::list<SingelRecord> listrcd2;
std::list<SingelRecord>::iterator lit;
if( CreateMassRecordListByRawData(listrcd2,pdata,rlen) )
{
for(lit=listrcd2.begin(); lit!=listrcd2.end(); ++lit)
{
SingelRecord rcd;
rcd.monitorid= lit->monitorid;
rcd.datalen= lit->datalen;
char * tempchar= new char[lit->datalen];
memmove(tempchar,lit->data,lit->datalen);
rcd.data= tempchar;
listrcd_out.push_back(rcd);
}
return true;
}
}catch(...)
{
printf("Exception to QuerySVDYNs in RefreshSVDYNs.");
}
}
if(pdata!=NULL)
delete [] pdata;
return false;
}
bool ObjectCache::RefreshSVDYNs(string pid)
{
if(pid.empty())
return false;
if(pid.compare("default")==0)
return false;
if(pid.size()>MAXQUEREYSTRINGLEN)
return false;
std::list<SingelRecord> listrcd;
map<string, SingelRecord>::iterator mit;
for(mit=Dyns.begin(); mit!=Dyns.end(); ++mit)
{
if( (mit->first).find(pid+".")!=0 )
continue;
SingelRecord rcd;
rcd.monitorid= mit->first;
rcd.data= mit->second.data;
rcd.datalen= sizeof(svutil::TTime);
listrcd.push_back(rcd);
}
std::list<SingelRecord> listrcd_out;
if( !QuerySVDYNs(pid,listrcd,listrcd_out) )
return false;
if(listrcd_out.empty())
return true;
ost::MutexLock lock(m_LockDyns);
std::list<SingelRecord>::iterator lit;
for(lit=listrcd_out.begin(); lit!=listrcd_out.end(); ++lit)
{
mit= Dyns.find(lit->monitorid);
if(mit==Dyns.end())
{
Dyns.insert(std::make_pair(lit->monitorid, *lit));
continue;
}
if( mit->second.data != NULL )
{
delete [] (mit->second.data);
mit->second.data =NULL;
}
mit->second= *lit;
}
return true;
}
bool ObjectCache::QueryMassMonitor( string pid, StringMap & smap, std::list<SingelRecord> & listrcd_out )
{
unsigned int tlen= smap.GetRawDataSize();
svutil::buffer tbuf;
if(!tbuf.checksize(tlen))
return false;
const char *data= smap.GetRawData(tbuf, tlen);
if(data==NULL)
return false;
QueryData qd;
char *pdata=NULL;
S_UINT rlen=0;
S_UINT len=0;
SVDBQUERY querybuf={0};
querybuf.len = sizeof(SVDBQUERY);
querybuf.querytype=QUERY_MASSMONITOR;
querybuf.datatype=S_MONITOR;
strcpy(querybuf.qstr,pid.c_str());
INIQUERY iquery={0};
iquery.len=sizeof(INIQUERY);
iquery.datatype=D_STRING;
iquery.datalen=tlen;
len+=sizeof(INIQUERY);
len+=tlen;
querybuf.datalen=len;
buffer buf;
if(!buf.checksize(len))
return INVALID_VALUE;
char *pt=buf.getbuffer();
memcpy(pt,&iquery,sizeof(INIQUERY));
pt+=sizeof(INIQUERY);
memmove(pt,data,tlen);
if(qd.Query(&querybuf,buf,len,(void **)&pdata,rlen,svdbaddr))
{
try{
std::list<SingelRecord> listrcd2;
std::list<SingelRecord>::iterator lit;
if( CreateMassRecordListByRawData(listrcd2,pdata,rlen) )
{
for(lit=listrcd2.begin(); lit!=listrcd2.end(); ++lit)
{
SingelRecord rcd;
rcd.monitorid= lit->monitorid;
rcd.datalen= lit->datalen;
char * tempchar= new char[lit->datalen];
memmove(tempchar,lit->data,lit->datalen);
rcd.data= tempchar;
listrcd_out.push_back(rcd);
}
return true;
}
}catch(...)
{
printf("Exception to QueryMassMonitor in RefreshMonitors_new.");
}
}
if(pdata!=NULL)
delete [] pdata;
return false;
}
bool ObjectCache::RefreshMonitors_new(string pid)
{
if(pid.empty())
return false;
if(pid.size()>MAXQUEREYSTRINGLEN)
return false;
bool isdefault(false);
if(pid.compare("default")==0)
isdefault=true;
StringMap smap(577);
map<string, VerOBJECT>::iterator mit;
for(mit=Monitors.begin(); mit!=Monitors.end(); ++mit)
{
if( !isdefault && (mit->first).find(pid+".")!=0)
continue;
smap[mit->first.c_str()]= mit->second.ver.c_str();
}
std::list<SingelRecord> listrcd_out;
if( !QueryMassMonitor(pid,smap,listrcd_out) )
return false;
if(listrcd_out.empty())
return true;
ost::MutexLock lock(m_LockMonitors);
std::list<SingelRecord>::iterator lit;
for(lit=listrcd_out.begin(); lit!=listrcd_out.end(); ++lit)
{
if(lit->data == NULL)
continue;
S_UINT ver(0);
OBJECT ret=INVALID_VALUE;
Monitor *pm=new Monitor();
if(pm)
{
const char * pdata= lit->data;
try{
if(pm->CreateObjectByRawData(pdata+sizeof(S_UINT),(lit->datalen)-sizeof(S_UINT)))
ret=reinterpret_cast<OBJECT>(pm);
memmove(&ver,pdata,sizeof(S_UINT));
}catch(...)
{
ret=INVALID_VALUE;
}
}
delete [] (lit->data);
if(ret==INVALID_VALUE)
{
if(pm)
delete pm;
continue;
}
char charver[256];
sprintf(charver,"%d",ver);
mit= Monitors.find(lit->monitorid);
if(mit==Monitors.end())
{
VerOBJECT vobj;
vobj.ver=charver;
vobj.obj=ret;
Monitors.insert(make_pair(lit->monitorid, vobj));
continue;
}
if( mit->second.obj != INVALID_VALUE )
CloseMonitor(mit->second.obj);
mit->second.ver= charver;
mit->second.obj= ret;
}
return true;
}
bool ObjectCache::QueryMassEntity( string pid, StringMap & smap, std::list<SingelRecord> & listrcd_out )
{
unsigned int tlen= smap.GetRawDataSize();
svutil::buffer tbuf;
if(!tbuf.checksize(tlen))
return false;
const char *data= smap.GetRawData(tbuf, tlen);
if(data==NULL)
return false;
QueryData qd;
char *pdata=NULL;
S_UINT rlen=0;
S_UINT len=0;
SVDBQUERY querybuf={0};
querybuf.len = sizeof(SVDBQUERY);
querybuf.querytype=QUERY_MASSENTITY;
querybuf.datatype=S_ENTITY;
strcpy(querybuf.qstr,pid.c_str());
INIQUERY iquery={0};
iquery.len=sizeof(INIQUERY);
iquery.datatype=D_STRING;
iquery.datalen=tlen;
len+=sizeof(INIQUERY);
len+=tlen;
querybuf.datalen=len;
buffer buf;
if(!buf.checksize(len))
return INVALID_VALUE;
char *pt=buf.getbuffer();
memcpy(pt,&iquery,sizeof(INIQUERY));
pt+=sizeof(INIQUERY);
memmove(pt,data,tlen);
if(qd.Query(&querybuf,buf,len,(void **)&pdata,rlen,svdbaddr))
{
try{
std::list<SingelRecord> listrcd2;
std::list<SingelRecord>::iterator lit;
if( CreateMassRecordListByRawData(listrcd2,pdata,rlen) )
{
for(lit=listrcd2.begin(); lit!=listrcd2.end(); ++lit)
{
SingelRecord rcd;
rcd.monitorid= lit->monitorid;
rcd.datalen= lit->datalen;
char * tempchar= new char[lit->datalen];
memmove(tempchar,lit->data,lit->datalen);
rcd.data= tempchar;
listrcd_out.push_back(rcd);
}
return true;
}
}catch(...)
{
printf("Exception to QueryMassEntity in RefreshEntities_new.");
}
}
if(pdata!=NULL)
delete [] pdata;
return false;
}
bool ObjectCache::RefreshEntities_new(string pid)
{
if(pid.empty())
return false;
if(pid.size()>MAXQUEREYSTRINGLEN)
return false;
bool isdefault(false);
if(pid.compare("default")==0)
isdefault=true;
StringMap smap(577);
map<string, VerOBJECT>::iterator mit;
for(mit=Entities.begin(); mit!=Entities.end(); ++mit)
{
if( !isdefault && (mit->first).find(pid+".")!=0)
continue;
smap[mit->first.c_str()]= mit->second.ver.c_str();
}
std::list<SingelRecord> listrcd_out;
if( !QueryMassEntity(pid,smap,listrcd_out) )
return false;
if(listrcd_out.empty())
return true;
ost::MutexLock lock(m_LockEntities);
std::list<SingelRecord>::iterator lit;
for(lit=listrcd_out.begin(); lit!=listrcd_out.end(); ++lit)
{
if(lit->data == NULL)
continue;
S_UINT ver(0);
OBJECT ret=INVALID_VALUE;
Entity *pm=new Entity();
if(pm)
{
const char * pdata= lit->data;
try{
if(pm->CreateObjectByRawData(pdata+sizeof(S_UINT),(lit->datalen)-sizeof(S_UINT)))
ret=reinterpret_cast<OBJECT>(pm);
memmove(&ver,pdata,sizeof(S_UINT));
}catch(...)
{
ret=INVALID_VALUE;
}
}
delete [] (lit->data);
if(ret==INVALID_VALUE)
{
if(pm)
delete pm;
continue;
}
char charver[256];
sprintf(charver,"%d",ver);
mit= Entities.find(lit->monitorid);
if(mit==Entities.end())
{
VerOBJECT vobj;
vobj.ver=charver;
vobj.obj=ret;
Entities.insert(make_pair(lit->monitorid, vobj));
continue;
}
if( mit->second.obj != INVALID_VALUE )
CloseEntity(mit->second.obj);
mit->second.ver= charver;
mit->second.obj= ret;
}
return true;
}
SVAPI_API
void SetCacheUserAddr(string user,string addr)
{
ObjectCache::SetUserAddr( user,addr);
}
SVAPI_API
bool CacheRefreshMonitors(string parentid)
{
return ObjectCache::RefreshMonitors_new( parentid );
}
SVAPI_API
bool CacheRefreshEntities(string parentid)
{
return ObjectCache::RefreshEntities_new( parentid );
}
SVAPI_API
bool Cache_GetSVDYN(string monitorid,SVDYN &dyn)
{
return ObjectCache::FastGetSVDYN( monitorid, dyn );
}
SVAPI_API
bool CacheRefreshSVDYNs(string parentid)
{
return ObjectCache::RefreshSVDYNs(parentid);
}
| [
"136122085@163.com"
] | 136122085@163.com |
74cc516694df80b8cd5f260bbc57ae9dd9e1c7fc | c6e9ceb6b0359eed6b451e5199ee408d492636b8 | /src/compiler/backend/mips/instruction-scheduler-mips.cc | d967586a57188ed4e1d927a5690efb089cd8e048 | [
"bzip2-1.0.6",
"SunPro",
"BSD-3-Clause",
"Apache-2.0"
] | permissive | gsathya/v8 | ed5bfe5a9495dc2df7aa02bf37a160f70b6347ab | ee96d8bf16ba1c9961324a009060b18eb04d93f6 | refs/heads/master | 2021-05-02T06:49:17.368931 | 2020-06-09T09:40:19 | 2020-06-09T10:35:33 | 76,900,229 | 0 | 0 | null | 2016-12-19T21:52:45 | 2016-12-19T21:52:45 | null | UTF-8 | C++ | false | false | 44,311 | cc | // Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/compiler/backend/code-generator.h"
#include "src/compiler/backend/instruction-scheduler.h"
namespace v8 {
namespace internal {
namespace compiler {
bool InstructionScheduler::SchedulerSupported() { return true; }
int InstructionScheduler::GetTargetInstructionFlags(
const Instruction* instr) const {
switch (instr->arch_opcode()) {
case kMipsAbsD:
case kMipsAbsS:
case kMipsAdd:
case kMipsAddD:
case kMipsAddOvf:
case kMipsAddPair:
case kMipsAddS:
case kMipsAnd:
case kMipsByteSwap32:
case kMipsCeilWD:
case kMipsCeilWS:
case kMipsClz:
case kMipsCmp:
case kMipsCmpD:
case kMipsCmpS:
case kMipsCtz:
case kMipsCvtDS:
case kMipsCvtDUw:
case kMipsCvtDW:
case kMipsCvtSD:
case kMipsCvtSUw:
case kMipsCvtSW:
case kMipsDiv:
case kMipsDivD:
case kMipsDivS:
case kMipsDivU:
case kMipsExt:
case kMipsF64x2Abs:
case kMipsF64x2Neg:
case kMipsF64x2Sqrt:
case kMipsF64x2Add:
case kMipsF64x2Sub:
case kMipsF64x2Mul:
case kMipsF64x2Div:
case kMipsF64x2Min:
case kMipsF64x2Max:
case kMipsF64x2Eq:
case kMipsF64x2Ne:
case kMipsF64x2Lt:
case kMipsF64x2Le:
case kMipsF64x2Splat:
case kMipsF64x2ExtractLane:
case kMipsF64x2ReplaceLane:
case kMipsI64x2Add:
case kMipsI64x2Sub:
case kMipsI64x2Mul:
case kMipsI64x2Neg:
case kMipsI64x2Shl:
case kMipsI64x2ShrS:
case kMipsI64x2ShrU:
case kMipsF32x4Abs:
case kMipsF32x4Add:
case kMipsF32x4AddHoriz:
case kMipsF32x4Eq:
case kMipsF32x4ExtractLane:
case kMipsF32x4Le:
case kMipsF32x4Lt:
case kMipsF32x4Max:
case kMipsF32x4Min:
case kMipsF32x4Mul:
case kMipsF32x4Div:
case kMipsF32x4Ne:
case kMipsF32x4Neg:
case kMipsF32x4Sqrt:
case kMipsF32x4RecipApprox:
case kMipsF32x4RecipSqrtApprox:
case kMipsF32x4ReplaceLane:
case kMipsF32x4SConvertI32x4:
case kMipsF32x4Splat:
case kMipsF32x4Sub:
case kMipsF32x4UConvertI32x4:
case kMipsFloat32Max:
case kMipsFloat32Min:
case kMipsFloat32RoundDown:
case kMipsFloat32RoundTiesEven:
case kMipsFloat32RoundTruncate:
case kMipsFloat32RoundUp:
case kMipsFloat64ExtractHighWord32:
case kMipsFloat64ExtractLowWord32:
case kMipsFloat64InsertHighWord32:
case kMipsFloat64InsertLowWord32:
case kMipsFloat64Max:
case kMipsFloat64Min:
case kMipsFloat64RoundDown:
case kMipsFloat64RoundTiesEven:
case kMipsFloat64RoundTruncate:
case kMipsFloat64RoundUp:
case kMipsFloat64SilenceNaN:
case kMipsFloorWD:
case kMipsFloorWS:
case kMipsI16x8Add:
case kMipsI16x8AddHoriz:
case kMipsI16x8AddSaturateS:
case kMipsI16x8AddSaturateU:
case kMipsI16x8Eq:
case kMipsI16x8ExtractLaneU:
case kMipsI16x8ExtractLaneS:
case kMipsI16x8GeS:
case kMipsI16x8GeU:
case kMipsI16x8RoundingAverageU:
case kMipsI16x8GtS:
case kMipsI16x8GtU:
case kMipsI16x8MaxS:
case kMipsI16x8MaxU:
case kMipsI16x8MinS:
case kMipsI16x8MinU:
case kMipsI16x8Mul:
case kMipsI16x8Ne:
case kMipsI16x8Neg:
case kMipsI16x8ReplaceLane:
case kMipsI16x8SConvertI32x4:
case kMipsI16x8SConvertI8x16High:
case kMipsI16x8SConvertI8x16Low:
case kMipsI16x8Shl:
case kMipsI16x8ShrS:
case kMipsI16x8ShrU:
case kMipsI16x8Splat:
case kMipsI16x8Sub:
case kMipsI16x8SubSaturateS:
case kMipsI16x8SubSaturateU:
case kMipsI16x8UConvertI32x4:
case kMipsI16x8UConvertI8x16High:
case kMipsI16x8UConvertI8x16Low:
case kMipsI16x8Abs:
case kMipsI16x8BitMask:
case kMipsI32x4Add:
case kMipsI32x4AddHoriz:
case kMipsI32x4Eq:
case kMipsI32x4ExtractLane:
case kMipsI32x4GeS:
case kMipsI32x4GeU:
case kMipsI32x4GtS:
case kMipsI32x4GtU:
case kMipsI32x4MaxS:
case kMipsI32x4MaxU:
case kMipsI32x4MinS:
case kMipsI32x4MinU:
case kMipsI32x4Mul:
case kMipsI32x4Ne:
case kMipsI32x4Neg:
case kMipsI32x4ReplaceLane:
case kMipsI32x4SConvertF32x4:
case kMipsI32x4SConvertI16x8High:
case kMipsI32x4SConvertI16x8Low:
case kMipsI32x4Shl:
case kMipsI32x4ShrS:
case kMipsI32x4ShrU:
case kMipsI32x4Splat:
case kMipsI32x4Sub:
case kMipsI32x4UConvertF32x4:
case kMipsI32x4UConvertI16x8High:
case kMipsI32x4UConvertI16x8Low:
case kMipsI32x4Abs:
case kMipsI32x4BitMask:
case kMipsI8x16Add:
case kMipsI8x16AddSaturateS:
case kMipsI8x16AddSaturateU:
case kMipsI8x16Eq:
case kMipsI8x16ExtractLaneU:
case kMipsI8x16ExtractLaneS:
case kMipsI8x16GeS:
case kMipsI8x16GeU:
case kMipsI8x16RoundingAverageU:
case kMipsI8x16GtS:
case kMipsI8x16GtU:
case kMipsI8x16MaxS:
case kMipsI8x16MaxU:
case kMipsI8x16MinS:
case kMipsI8x16MinU:
case kMipsI8x16Mul:
case kMipsI8x16Ne:
case kMipsI8x16Neg:
case kMipsI8x16ReplaceLane:
case kMipsI8x16SConvertI16x8:
case kMipsI8x16Shl:
case kMipsI8x16ShrS:
case kMipsI8x16ShrU:
case kMipsI8x16Splat:
case kMipsI8x16Sub:
case kMipsI8x16SubSaturateS:
case kMipsI8x16SubSaturateU:
case kMipsI8x16UConvertI16x8:
case kMipsI8x16Abs:
case kMipsI8x16BitMask:
case kMipsIns:
case kMipsLsa:
case kMipsMaddD:
case kMipsMaddS:
case kMipsMaxD:
case kMipsMaxS:
case kMipsMinD:
case kMipsMinS:
case kMipsMod:
case kMipsModU:
case kMipsMov:
case kMipsMsubD:
case kMipsMsubS:
case kMipsMul:
case kMipsMulD:
case kMipsMulHigh:
case kMipsMulHighU:
case kMipsMulOvf:
case kMipsMulPair:
case kMipsMulS:
case kMipsNegD:
case kMipsNegS:
case kMipsNor:
case kMipsOr:
case kMipsPopcnt:
case kMipsRor:
case kMipsRoundWD:
case kMipsRoundWS:
case kMipsS128And:
case kMipsS128Not:
case kMipsS128Or:
case kMipsS128Select:
case kMipsS128Xor:
case kMipsS128Zero:
case kMipsS128AndNot:
case kMipsS16x2Reverse:
case kMipsS16x4Reverse:
case kMipsS16x8InterleaveEven:
case kMipsS16x8InterleaveLeft:
case kMipsS16x8InterleaveOdd:
case kMipsS16x8InterleaveRight:
case kMipsS16x8PackEven:
case kMipsS16x8PackOdd:
case kMipsV8x16AllTrue:
case kMipsV8x16AnyTrue:
case kMipsV32x4AllTrue:
case kMipsV32x4AnyTrue:
case kMipsV16x8AllTrue:
case kMipsV16x8AnyTrue:
case kMipsS32x4InterleaveEven:
case kMipsS32x4InterleaveLeft:
case kMipsS32x4InterleaveOdd:
case kMipsS32x4InterleaveRight:
case kMipsS32x4PackEven:
case kMipsS32x4PackOdd:
case kMipsS32x4Shuffle:
case kMipsS8x16Concat:
case kMipsS8x16InterleaveEven:
case kMipsS8x16InterleaveLeft:
case kMipsS8x16InterleaveOdd:
case kMipsS8x16InterleaveRight:
case kMipsS8x16PackEven:
case kMipsS8x16PackOdd:
case kMipsS8x16Shuffle:
case kMipsS8x16Swizzle:
case kMipsS8x2Reverse:
case kMipsS8x4Reverse:
case kMipsS8x8Reverse:
case kMipsSar:
case kMipsSarPair:
case kMipsSeb:
case kMipsSeh:
case kMipsShl:
case kMipsShlPair:
case kMipsShr:
case kMipsShrPair:
case kMipsSqrtD:
case kMipsSqrtS:
case kMipsSub:
case kMipsSubD:
case kMipsSubOvf:
case kMipsSubPair:
case kMipsSubS:
case kMipsTruncUwD:
case kMipsTruncUwS:
case kMipsTruncWD:
case kMipsTruncWS:
case kMipsTst:
case kMipsXor:
return kNoOpcodeFlags;
case kMipsLb:
case kMipsLbu:
case kMipsLdc1:
case kMipsLh:
case kMipsLhu:
case kMipsLw:
case kMipsLwc1:
case kMipsMsaLd:
case kMipsPeek:
case kMipsUldc1:
case kMipsUlh:
case kMipsUlhu:
case kMipsUlw:
case kMipsUlwc1:
case kMipsS8x16LoadSplat:
case kMipsS16x8LoadSplat:
case kMipsS32x4LoadSplat:
case kMipsS64x2LoadSplat:
case kMipsI16x8Load8x8S:
case kMipsI16x8Load8x8U:
case kMipsI32x4Load16x4S:
case kMipsI32x4Load16x4U:
case kMipsI64x2Load32x2S:
case kMipsI64x2Load32x2U:
case kMipsWord32AtomicPairLoad:
return kIsLoadOperation;
case kMipsModD:
case kMipsModS:
case kMipsMsaSt:
case kMipsPush:
case kMipsSb:
case kMipsSdc1:
case kMipsSh:
case kMipsStackClaim:
case kMipsStoreToStackSlot:
case kMipsSw:
case kMipsSwc1:
case kMipsUsdc1:
case kMipsUsh:
case kMipsUsw:
case kMipsUswc1:
case kMipsSync:
case kMipsWord32AtomicPairStore:
case kMipsWord32AtomicPairAdd:
case kMipsWord32AtomicPairSub:
case kMipsWord32AtomicPairAnd:
case kMipsWord32AtomicPairOr:
case kMipsWord32AtomicPairXor:
case kMipsWord32AtomicPairExchange:
case kMipsWord32AtomicPairCompareExchange:
return kHasSideEffect;
#define CASE(Name) case k##Name:
COMMON_ARCH_OPCODE_LIST(CASE)
#undef CASE
// Already covered in architecture independent code.
UNREACHABLE();
}
UNREACHABLE();
}
enum Latency {
BRANCH = 4, // Estimated max.
RINT_S = 4, // Estimated.
RINT_D = 4, // Estimated.
MULT = 4,
MULTU = 4,
MADD = 4,
MADDU = 4,
MSUB = 4,
MSUBU = 4,
MUL = 7,
MULU = 7,
MUH = 7,
MUHU = 7,
DIV = 50, // Min:11 Max:50
DIVU = 50,
ABS_S = 4,
ABS_D = 4,
NEG_S = 4,
NEG_D = 4,
ADD_S = 4,
ADD_D = 4,
SUB_S = 4,
SUB_D = 4,
MAX_S = 4, // Estimated.
MAX_D = 4, // Estimated.
C_cond_S = 4,
C_cond_D = 4,
MUL_S = 4,
MADD_S = 4,
MSUB_S = 4,
NMADD_S = 4,
NMSUB_S = 4,
CABS_cond_S = 4,
CABS_cond_D = 4,
CVT_D_S = 4,
CVT_PS_PW = 4,
CVT_S_W = 4,
CVT_S_L = 4,
CVT_D_W = 4,
CVT_D_L = 4,
CVT_S_D = 4,
CVT_W_S = 4,
CVT_W_D = 4,
CVT_L_S = 4,
CVT_L_D = 4,
CEIL_W_S = 4,
CEIL_W_D = 4,
CEIL_L_S = 4,
CEIL_L_D = 4,
FLOOR_W_S = 4,
FLOOR_W_D = 4,
FLOOR_L_S = 4,
FLOOR_L_D = 4,
ROUND_W_S = 4,
ROUND_W_D = 4,
ROUND_L_S = 4,
ROUND_L_D = 4,
TRUNC_W_S = 4,
TRUNC_W_D = 4,
TRUNC_L_S = 4,
TRUNC_L_D = 4,
MOV_S = 4,
MOV_D = 4,
MOVF_S = 4,
MOVF_D = 4,
MOVN_S = 4,
MOVN_D = 4,
MOVT_S = 4,
MOVT_D = 4,
MOVZ_S = 4,
MOVZ_D = 4,
MUL_D = 5,
MADD_D = 5,
MSUB_D = 5,
NMADD_D = 5,
NMSUB_D = 5,
RECIP_S = 13,
RECIP_D = 26,
RSQRT_S = 17,
RSQRT_D = 36,
DIV_S = 17,
SQRT_S = 17,
DIV_D = 32,
SQRT_D = 32,
MTC1 = 4,
MTHC1 = 4,
DMTC1 = 4,
LWC1 = 4,
LDC1 = 4,
LDXC1 = 4,
LUXC1 = 4,
LWXC1 = 4,
MFC1 = 1,
MFHC1 = 1,
MFHI = 1,
MFLO = 1,
DMFC1 = 1,
SWC1 = 1,
SDC1 = 1,
SDXC1 = 1,
SUXC1 = 1,
SWXC1 = 1,
};
int ClzLatency() {
if (IsMipsArchVariant(kLoongson)) {
return (6 + 2 * Latency::BRANCH);
} else {
return 1;
}
}
int RorLatency(bool is_operand_register = true) {
if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) {
return 1;
} else {
if (is_operand_register) {
return 4;
} else {
return 3; // Estimated max.
}
}
}
int AdduLatency(bool is_operand_register = true) {
if (is_operand_register) {
return 1;
} else {
return 2; // Estimated max.
}
}
int XorLatency(bool is_operand_register = true) {
return AdduLatency(is_operand_register);
}
int AndLatency(bool is_operand_register = true) {
return AdduLatency(is_operand_register);
}
int OrLatency(bool is_operand_register = true) {
return AdduLatency(is_operand_register);
}
int SubuLatency(bool is_operand_register = true) {
return AdduLatency(is_operand_register);
}
int MulLatency(bool is_operand_register = true) {
if (is_operand_register) {
if (IsMipsArchVariant(kLoongson)) {
return Latency::MULT + 1;
} else {
return Latency::MUL + 1;
}
} else {
if (IsMipsArchVariant(kLoongson)) {
return Latency::MULT + 2;
} else {
return Latency::MUL + 2;
}
}
}
int NorLatency(bool is_operand_register = true) {
if (is_operand_register) {
return 1;
} else {
return 2;
}
}
int InsLatency() {
if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) {
return 1;
} else {
return SubuLatency(false) + 7;
}
}
int ShlPairLatency(bool is_operand_register = true) {
if (is_operand_register) {
int latency =
AndLatency(false) + NorLatency() + OrLatency() + AndLatency(false) + 4;
if (IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r6)) {
return latency + Latency::BRANCH + 2;
} else {
return latency + 2;
}
} else {
return 2;
}
}
int ShrPairLatency(bool is_operand_register = true, uint32_t shift = 0) {
if (is_operand_register) {
int latency =
AndLatency(false) + NorLatency() + OrLatency() + AndLatency(false) + 4;
if (IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r6)) {
return latency + Latency::BRANCH + 2;
} else {
return latency + 2;
}
} else {
// Estimated max.
return (InsLatency() + 2 > OrLatency() + 3) ? InsLatency() + 2
: OrLatency() + 3;
}
}
int SarPairLatency(bool is_operand_register = true, uint32_t shift = 0) {
if (is_operand_register) {
return AndLatency(false) + NorLatency() + OrLatency() + AndLatency(false) +
Latency::BRANCH + 6;
} else {
shift = shift & 0x3F;
if (shift == 0) {
return 2;
} else if (shift < 32) {
if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) {
return InsLatency() + 2;
} else {
return OrLatency() + 3;
}
} else if (shift == 32) {
return 2;
} else {
return 2;
}
}
}
int ExtLatency() {
if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) {
return 1;
} else {
// Estimated max.
return 2;
}
}
int LsaLatency() {
// Estimated max.
return AdduLatency() + 1;
}
int SltLatency(bool is_operand_register = true) {
if (is_operand_register) {
return 1;
} else {
return 2; // Estimated max.
}
}
int SltuLatency(bool is_operand_register = true) {
return SltLatency(is_operand_register);
}
int AddPairLatency() { return 3 * AdduLatency() + SltLatency(); }
int SubPairLatency() { return SltuLatency() + 3 * SubuLatency(); }
int MuluLatency(bool is_operand_register = true) {
int latency = 0;
if (!is_operand_register) latency++;
if (!IsMipsArchVariant(kMips32r6)) {
return latency + Latency::MULTU + 2;
} else {
return latency + Latency::MULU + Latency::MUHU;
}
}
int MulPairLatency() {
return MuluLatency() + 2 * MulLatency() + 2 * AdduLatency();
}
int MaddSLatency() {
if (IsMipsArchVariant(kMips32r2)) {
return Latency::MADD_D;
} else {
return Latency::MUL_D + Latency::ADD_D;
}
}
int MaddDLatency() {
if (IsMipsArchVariant(kMips32r2)) {
return Latency::MADD_D;
} else {
return Latency::MUL_D + Latency::ADD_D;
}
}
int MsubSLatency() {
if (IsMipsArchVariant(kMips32r2)) {
return Latency::MSUB_S;
} else {
return Latency::MUL_S + Latency::SUB_S;
}
}
int MsubDLatency() {
if (IsMipsArchVariant(kMips32r2)) {
return Latency::MSUB_D;
} else {
return Latency::MUL_D + Latency::SUB_D;
}
}
int Mfhc1Latency() {
if (IsFp32Mode()) {
return Latency::MFC1;
} else {
return 1;
}
}
int Mthc1Latency() {
if (IsFp32Mode()) {
return Latency::MTC1;
} else {
return 1;
}
}
int MoveLatency(bool is_double_register = true) {
if (!is_double_register) {
return Latency::MTC1 + 1;
} else {
return Mthc1Latency() + 1; // Estimated.
}
}
int Float64RoundLatency() {
if (IsMipsArchVariant(kMips32r6)) {
return Latency::RINT_D + 4;
} else {
// For ceil_l_d, floor_l_d, round_l_d, trunc_l_d latency is 4.
return Mfhc1Latency() + ExtLatency() + Latency::BRANCH + Latency::MOV_D +
4 + MoveLatency() + 1 + Latency::BRANCH + Latency::CVT_D_L;
}
}
int Float32RoundLatency() {
if (IsMipsArchVariant(kMips32r6)) {
return Latency::RINT_S + 4;
} else {
// For ceil_w_s, floor_w_s, round_w_s, trunc_w_s latency is 4.
return Latency::MFC1 + ExtLatency() + Latency::BRANCH + Latency::MOV_S + 4 +
Latency::MFC1 + Latency::BRANCH + Latency::CVT_S_W;
}
}
int CvtDUwLatency() {
if (IsFp64Mode()) {
return Latency::MTC1 + Mthc1Latency() + Latency::CVT_D_L;
} else {
return Latency::BRANCH + Latency::MTC1 + 1 + Latency::MTC1 +
Mthc1Latency() + Latency::CVT_D_W + Latency::BRANCH +
Latency::ADD_D + Latency::CVT_D_W;
}
}
int CvtSUwLatency() { return CvtDUwLatency() + Latency::CVT_S_D; }
int Floor_w_dLatency() {
if (IsMipsArchVariant(kLoongson)) {
return Mfhc1Latency() + Latency::FLOOR_W_D + Mthc1Latency();
} else {
return Latency::FLOOR_W_D;
}
}
int FloorWDLatency() { return Floor_w_dLatency() + Latency::MFC1; }
int Ceil_w_dLatency() {
if (IsMipsArchVariant(kLoongson)) {
return Mfhc1Latency() + Latency::CEIL_W_D + Mthc1Latency();
} else {
return Latency::CEIL_W_D;
}
}
int CeilWDLatency() { return Ceil_w_dLatency() + Latency::MFC1; }
int Round_w_dLatency() {
if (IsMipsArchVariant(kLoongson)) {
return Mfhc1Latency() + Latency::ROUND_W_D + Mthc1Latency();
} else {
return Latency::ROUND_W_D;
}
}
int RoundWDLatency() { return Round_w_dLatency() + Latency::MFC1; }
int Trunc_w_dLatency() {
if (IsMipsArchVariant(kLoongson)) {
return Mfhc1Latency() + Latency::TRUNC_W_D + Mthc1Latency();
} else {
return Latency::TRUNC_W_D;
}
}
int MovnLatency() {
if (IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r6)) {
return Latency::BRANCH + 1;
} else {
return 1;
}
}
int Trunc_uw_dLatency() {
return 1 + Latency::MTC1 + Mthc1Latency() + Latency::BRANCH + Latency::SUB_D +
Latency::TRUNC_W_D + Latency::MFC1 + OrLatency(false) +
Latency::BRANCH + Latency::TRUNC_W_D + Latency::MFC1;
}
int Trunc_uw_sLatency() {
return 1 + Latency::MTC1 + Latency::BRANCH + Latency::SUB_S +
Latency::TRUNC_W_S + Latency::MFC1 + OrLatency(false) +
Latency::TRUNC_W_S + Latency::MFC1;
}
int MovzLatency() {
if (IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r6)) {
return Latency::BRANCH + 1;
} else {
return 1;
}
}
int FmoveLowLatency() {
if (IsFp32Mode()) {
return Latency::MTC1;
} else {
return Latency::MFHC1 + Latency::MTC1 + Latency::MTHC1;
}
}
int SebLatency() {
if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) {
return 1;
} else {
return 2;
}
}
int SehLatency() {
if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) {
return 1;
} else {
return 2;
}
}
int UlhuLatency() {
if (IsMipsArchVariant(kMips32r6)) {
return 1;
} else {
return 4;
}
}
int UlhLatency() {
if (IsMipsArchVariant(kMips32r6)) {
return 1;
} else {
return 4;
}
}
int AdjustBaseAndOffsetLatency() {
return 3; // Estimated max.
}
int UshLatency() {
if (IsMipsArchVariant(kMips32r6)) {
return 1;
} else {
return AdjustBaseAndOffsetLatency() + 4; // Estimated max.
}
}
int UlwLatency() {
if (IsMipsArchVariant(kMips32r6)) {
return 1;
} else {
return AdjustBaseAndOffsetLatency() + 3; // Estimated max.
}
}
int UswLatency() {
if (IsMipsArchVariant(kMips32r6)) {
return 1;
} else {
return AdjustBaseAndOffsetLatency() + 2;
}
}
int Ulwc1Latency() {
if (IsMipsArchVariant(kMips32r6)) {
return Latency::LWC1;
} else {
return UlwLatency() + Latency::MTC1;
}
}
int Uswc1Latency() {
if (IsMipsArchVariant(kMips32r6)) {
return Latency::SWC1;
} else {
return Latency::MFC1 + UswLatency();
}
}
int Ldc1Latency() {
int latency = AdjustBaseAndOffsetLatency() + Latency::LWC1;
if (IsFp32Mode()) {
return latency + Latency::LWC1;
} else {
return latency + 1 + Mthc1Latency();
}
}
int Uldc1Latency() {
if (IsMipsArchVariant(kMips32r6)) {
return Ldc1Latency();
} else {
return 2 * UlwLatency() + Latency::MTC1 + Mthc1Latency();
}
}
int Sdc1Latency() {
int latency = AdjustBaseAndOffsetLatency() + Latency::SWC1;
if (IsFp32Mode()) {
return latency + Latency::SWC1;
} else {
return latency + Mfhc1Latency() + 1;
}
}
int Usdc1Latency() {
if (IsMipsArchVariant(kMips32r6)) {
return Sdc1Latency();
} else {
return Latency::MFC1 + 2 * UswLatency() + Mfhc1Latency();
}
}
int PushRegisterLatency() { return AdduLatency(false) + 1; }
int ByteSwapSignedLatency() {
// operand_size == 4
if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) {
return 2;
} else if (IsMipsArchVariant(kMips32r1) || IsMipsArchVariant(kLoongson)) {
return 10;
}
}
int LlLatency(int offset) {
bool is_one_instruction =
IsMipsArchVariant(kMips32r6) ? is_int9(offset) : is_int16(offset);
if (is_one_instruction) {
return 1;
} else {
return 3;
}
}
int ExtractBitsLatency(int size, bool sign_extend) {
int latency = 1 + ExtLatency();
if (size == 8) {
if (sign_extend) {
return latency + SebLatency();
} else {
return 0;
}
} else if (size == 16) {
if (sign_extend) {
return latency + SehLatency();
} else {
return 0;
}
} else {
UNREACHABLE();
}
}
int NegLatency() { return 1; }
int InsertBitsLatency() {
return RorLatency() + InsLatency() + SubuLatency(false) + NegLatency() +
RorLatency();
}
int ScLatency(int offset) {
bool is_one_instruction =
IsMipsArchVariant(kMips32r6) ? is_int9(offset) : is_int16(offset);
if (is_one_instruction) {
return 1;
} else {
return 3;
}
}
int BranchShortHelperR6Latency() {
return 2; // Estimated max.
}
int BranchShortHelperLatency() {
return SltLatency() + 2; // Estimated max.
}
int BranchShortLatency(BranchDelaySlot bdslot = PROTECT) {
if (IsMipsArchVariant(kMips32r6) && bdslot == PROTECT) {
return BranchShortHelperR6Latency();
} else {
return BranchShortHelperLatency();
}
}
int Word32AtomicExchangeLatency(bool sign_extend, int size) {
return AdduLatency() + 1 + SubuLatency() + 2 + LlLatency(0) +
ExtractBitsLatency(size, sign_extend) + InsertBitsLatency() +
ScLatency(0) + BranchShortLatency() + 1;
}
int Word32AtomicCompareExchangeLatency(bool sign_extend, int size) {
return AdduLatency() + 1 + SubuLatency() + 2 + LlLatency(0) +
ExtractBitsLatency(size, sign_extend) + BranchShortLatency() + 1;
}
int AddOverflowLatency() {
return 6; // Estimated max.
}
int SubOverflowLatency() {
return 6; // Estimated max.
}
int MulhLatency(bool is_operand_register = true) {
if (is_operand_register) {
if (!IsMipsArchVariant(kMips32r6)) {
return Latency::MULT + Latency::MFHI;
} else {
return Latency::MUH;
}
} else {
if (!IsMipsArchVariant(kMips32r6)) {
return 1 + Latency::MULT + Latency::MFHI;
} else {
return 1 + Latency::MUH;
}
}
}
int MulhuLatency(bool is_operand_register = true) {
if (is_operand_register) {
if (!IsMipsArchVariant(kMips32r6)) {
return Latency::MULTU + Latency::MFHI;
} else {
return Latency::MUHU;
}
} else {
if (!IsMipsArchVariant(kMips32r6)) {
return 1 + Latency::MULTU + Latency::MFHI;
} else {
return 1 + Latency::MUHU;
}
}
}
int MulOverflowLatency() {
return MulLatency() + 4; // Estimated max.
}
int ModLatency(bool is_operand_register = true) {
if (is_operand_register) {
if (!IsMipsArchVariant(kMips32r6)) {
return Latency::DIV + Latency::MFHI;
} else {
return 1;
}
} else {
if (!IsMipsArchVariant(kMips32r6)) {
return 1 + Latency::DIV + Latency::MFHI;
} else {
return 2;
}
}
}
int ModuLatency(bool is_operand_register = true) {
return ModLatency(is_operand_register);
}
int DivLatency(bool is_operand_register = true) {
if (is_operand_register) {
if (!IsMipsArchVariant(kMips32r6)) {
return Latency::DIV + Latency::MFLO;
} else {
return Latency::DIV;
}
} else {
if (!IsMipsArchVariant(kMips32r6)) {
return 1 + Latency::DIV + Latency::MFLO;
} else {
return 1 + Latency::DIV;
}
}
}
int DivuLatency(bool is_operand_register = true) {
if (is_operand_register) {
if (!IsMipsArchVariant(kMips32r6)) {
return Latency::DIVU + Latency::MFLO;
} else {
return Latency::DIVU;
}
} else {
if (!IsMipsArchVariant(kMips32r6)) {
return 1 + Latency::DIVU + Latency::MFLO;
} else {
return 1 + Latency::DIVU;
}
}
}
int CtzLatency() {
if (IsMipsArchVariant(kMips32r6)) {
return RorLatency(false) + 2 + ClzLatency();
} else {
return AdduLatency(false) + XorLatency() + AndLatency() + ClzLatency() + 1 +
SubuLatency();
}
}
int PopcntLatency() {
return 4 * AndLatency() + SubuLatency() + 2 * AdduLatency() + MulLatency() +
8;
}
int CompareFLatency() { return Latency::C_cond_S; }
int CompareIsNanFLatency() { return CompareFLatency(); }
int CompareIsNanF32Latency() { return CompareIsNanFLatency(); }
int Neg_sLatency() {
if (IsMipsArchVariant(kMips32r6)) {
return Latency::NEG_S;
} else {
// Estimated.
return CompareIsNanF32Latency() + 2 * Latency::BRANCH + Latency::NEG_S +
Latency::MFC1 + 1 + XorLatency() + Latency::MTC1;
}
}
int CompareIsNanF64Latency() { return CompareIsNanFLatency(); }
int Neg_dLatency() {
if (IsMipsArchVariant(kMips32r6)) {
return Latency::NEG_D;
} else {
// Estimated.
return CompareIsNanF64Latency() + 2 * Latency::BRANCH + Latency::NEG_D +
Mfhc1Latency() + 1 + XorLatency() + Mthc1Latency();
}
}
int CompareF32Latency() { return CompareFLatency(); }
int Move_sLatency() {
return Latency::MOV_S; // Estimated max.
}
int Float32MaxLatency() {
// Estimated max.
int latency = CompareIsNanF32Latency() + Latency::BRANCH;
if (IsMipsArchVariant(kMips32r6)) {
return latency + Latency::MAX_S;
} else {
return latency + 5 * Latency::BRANCH + 2 * CompareF32Latency() +
Latency::MFC1 + Move_sLatency();
}
}
int CompareF64Latency() { return CompareF32Latency(); }
int Move_dLatency() {
return Latency::MOV_D; // Estimated max.
}
int Float64MaxLatency() {
// Estimated max.
int latency = CompareIsNanF64Latency() + Latency::BRANCH;
if (IsMipsArchVariant(kMips32r6)) {
return latency + Latency::MAX_D;
} else {
return latency + 5 * Latency::BRANCH + 2 * CompareF64Latency() +
Latency::MFHC1 + 2 * Move_dLatency();
}
}
int PrepareCallCFunctionLatency() {
int frame_alignment = TurboAssembler::ActivationFrameAlignment();
if (frame_alignment > kSystemPointerSize) {
return 1 + SubuLatency(false) + AndLatency(false) + 1;
} else {
return SubuLatency(false);
}
}
int MovToFloatParametersLatency() { return 2 * MoveLatency(); }
int CallLatency() {
// Estimated.
return AdduLatency(false) + Latency::BRANCH + 3;
}
int CallCFunctionHelperLatency() {
// Estimated.
int latency = AndLatency(false) + Latency::BRANCH + 2 + CallLatency();
if (base::OS::ActivationFrameAlignment() > kSystemPointerSize) {
latency++;
} else {
latency += AdduLatency(false);
}
return latency;
}
int CallCFunctionLatency() { return 1 + CallCFunctionHelperLatency(); }
int MovFromFloatResultLatency() { return MoveLatency(); }
int Float32MinLatency() {
// Estimated max.
return CompareIsNanF32Latency() + Latency::BRANCH +
2 * (CompareF32Latency() + Latency::BRANCH) + Latency::MFC1 +
2 * Latency::BRANCH + Move_sLatency();
}
int Float64MinLatency() {
// Estimated max.
return CompareIsNanF64Latency() + Latency::BRANCH +
2 * (CompareF64Latency() + Latency::BRANCH) + Mfhc1Latency() +
2 * Latency::BRANCH + Move_dLatency();
}
int SmiUntagLatency() { return 1; }
int PrepareForTailCallLatency() {
// Estimated max.
return 2 * (LsaLatency() + AdduLatency(false)) + 2 + Latency::BRANCH +
Latency::BRANCH + 2 * SubuLatency(false) + 2 + Latency::BRANCH + 1;
}
int AssemblePopArgumentsAdaptorFrameLatency() {
return 1 + Latency::BRANCH + 1 + SmiUntagLatency() +
PrepareForTailCallLatency();
}
int JumpLatency() {
// Estimated max.
return 1 + AdduLatency(false) + Latency::BRANCH + 2;
}
int AssertLatency() { return 1; }
int MultiPushLatency() {
int latency = SubuLatency(false);
for (int16_t i = kNumRegisters - 1; i >= 0; i--) {
latency++;
}
return latency;
}
int MultiPushFPULatency() {
int latency = SubuLatency(false);
for (int16_t i = kNumRegisters - 1; i >= 0; i--) {
latency += Sdc1Latency();
}
return latency;
}
int PushCallerSavedLatency(SaveFPRegsMode fp_mode) {
int latency = MultiPushLatency();
if (fp_mode == kSaveFPRegs) {
latency += MultiPushFPULatency();
}
return latency;
}
int MultiPopFPULatency() {
int latency = 0;
for (int16_t i = 0; i < kNumRegisters; i++) {
latency += Ldc1Latency();
}
return latency++;
}
int MultiPopLatency() {
int latency = 0;
for (int16_t i = 0; i < kNumRegisters; i++) {
latency++;
}
return latency++;
}
int PopCallerSavedLatency(SaveFPRegsMode fp_mode) {
int latency = 0;
if (fp_mode == kSaveFPRegs) {
latency += MultiPopFPULatency();
}
return latency + MultiPopLatency();
}
int AssembleArchJumpLatency() {
// Estimated max.
return Latency::BRANCH;
}
int AssembleArchBinarySearchSwitchLatency(int cases) {
if (cases < CodeGenerator::kBinarySearchSwitchMinimalCases) {
return cases * (1 + Latency::BRANCH) + AssembleArchJumpLatency();
}
return 1 + Latency::BRANCH + AssembleArchBinarySearchSwitchLatency(cases / 2);
}
int GenerateSwitchTableLatency() {
int latency = 0;
if (kArchVariant >= kMips32r6) {
latency = LsaLatency() + 2;
} else {
latency = 6;
}
latency += 2;
return latency;
}
int AssembleArchTableSwitchLatency() {
return Latency::BRANCH + GenerateSwitchTableLatency();
}
int AssembleReturnLatency() {
// Estimated max.
return AdduLatency(false) + MultiPopLatency() + MultiPopFPULatency() +
Latency::BRANCH + 1 + AdduLatency() + 8;
}
int TryInlineTruncateDoubleToILatency() {
return 2 + Latency::TRUNC_W_D + Latency::MFC1 + 2 + AndLatency(false) +
Latency::BRANCH;
}
int CallStubDelayedLatency() { return 1 + CallLatency(); }
int TruncateDoubleToIDelayedLatency() {
// TODO(mips): This no longer reflects how TruncateDoubleToI is called.
return TryInlineTruncateDoubleToILatency() + 1 + SubuLatency(false) +
Sdc1Latency() + CallStubDelayedLatency() + AdduLatency(false) + 1;
}
int CheckPageFlagLatency() {
return 2 * AndLatency(false) + 1 + Latency::BRANCH;
}
int InstructionScheduler::GetInstructionLatency(const Instruction* instr) {
// Basic latency modeling for MIPS32 instructions. They have been determined
// in an empirical way.
switch (instr->arch_opcode()) {
case kArchCallCodeObject:
case kArchCallWasmFunction:
return CallLatency();
case kArchTailCallCodeObjectFromJSFunction:
case kArchTailCallCodeObject: {
int latency = 0;
if (instr->arch_opcode() == kArchTailCallCodeObjectFromJSFunction) {
latency = AssemblePopArgumentsAdaptorFrameLatency();
}
return latency + JumpLatency();
}
case kArchTailCallWasm:
case kArchTailCallAddress:
return JumpLatency();
case kArchCallJSFunction: {
int latency = 0;
if (FLAG_debug_code) {
latency = 1 + AssertLatency();
}
return latency + 1 + AdduLatency(false) + CallLatency();
}
case kArchPrepareCallCFunction:
return PrepareCallCFunctionLatency();
case kArchSaveCallerRegisters: {
auto fp_mode =
static_cast<SaveFPRegsMode>(MiscField::decode(instr->opcode()));
return PushCallerSavedLatency(fp_mode);
}
case kArchRestoreCallerRegisters: {
auto fp_mode =
static_cast<SaveFPRegsMode>(MiscField::decode(instr->opcode()));
return PopCallerSavedLatency(fp_mode);
}
case kArchPrepareTailCall:
return 2; // Estimated max.
case kArchCallCFunction:
return CallCFunctionLatency();
case kArchJmp:
return AssembleArchJumpLatency();
case kArchBinarySearchSwitch:
return AssembleArchBinarySearchSwitchLatency((instr->InputCount() - 2) /
2);
case kArchTableSwitch:
return AssembleArchTableSwitchLatency();
case kArchAbortCSAAssert:
return CallLatency() + 1;
case kArchComment:
case kArchDeoptimize:
return 0;
case kArchRet:
return AssembleReturnLatency();
case kArchTruncateDoubleToI:
return TruncateDoubleToIDelayedLatency();
case kArchStoreWithWriteBarrier:
return AdduLatency() + 1 + CheckPageFlagLatency();
case kArchStackSlot: {
// Estimated max.
return AdduLatency(false) + AndLatency(false) + AssertLatency() +
AdduLatency(false) + AndLatency(false) + BranchShortLatency() + 1 +
SubuLatency() + AdduLatency();
}
case kArchWordPoisonOnSpeculation:
return AndLatency();
case kIeee754Float64Acos:
case kIeee754Float64Acosh:
case kIeee754Float64Asin:
case kIeee754Float64Asinh:
case kIeee754Float64Atan:
case kIeee754Float64Atanh:
case kIeee754Float64Atan2:
case kIeee754Float64Cos:
case kIeee754Float64Cosh:
case kIeee754Float64Cbrt:
case kIeee754Float64Exp:
case kIeee754Float64Expm1:
case kIeee754Float64Log:
case kIeee754Float64Log1p:
case kIeee754Float64Log10:
case kIeee754Float64Log2:
case kIeee754Float64Pow:
case kIeee754Float64Sin:
case kIeee754Float64Sinh:
case kIeee754Float64Tan:
case kIeee754Float64Tanh:
return PrepareCallCFunctionLatency() + MovToFloatParametersLatency() +
CallCFunctionLatency() + MovFromFloatResultLatency();
case kMipsAdd:
return AdduLatency(instr->InputAt(1)->IsRegister());
case kMipsAnd:
return AndLatency(instr->InputAt(1)->IsRegister());
case kMipsOr:
return OrLatency(instr->InputAt(1)->IsRegister());
case kMipsXor:
return XorLatency(instr->InputAt(1)->IsRegister());
case kMipsSub:
return SubuLatency(instr->InputAt(1)->IsRegister());
case kMipsNor:
return NorLatency(instr->InputAt(1)->IsRegister());
case kMipsAddOvf:
return AddOverflowLatency();
case kMipsSubOvf:
return SubOverflowLatency();
case kMipsMul:
return MulLatency(false);
case kMipsMulHigh:
return MulhLatency(instr->InputAt(1)->IsRegister());
case kMipsMulHighU:
return MulhuLatency(instr->InputAt(1)->IsRegister());
case kMipsMulOvf:
return MulOverflowLatency();
case kMipsMod:
return ModLatency(instr->InputAt(1)->IsRegister());
case kMipsModU:
return ModuLatency(instr->InputAt(1)->IsRegister());
case kMipsDiv: {
int latency = DivLatency(instr->InputAt(1)->IsRegister());
if (IsMipsArchVariant(kMips32r6)) {
return latency++;
} else {
return latency + MovzLatency();
}
}
case kMipsDivU: {
int latency = DivuLatency(instr->InputAt(1)->IsRegister());
if (IsMipsArchVariant(kMips32r6)) {
return latency++;
} else {
return latency + MovzLatency();
}
}
case kMipsClz:
return ClzLatency();
case kMipsCtz:
return CtzLatency();
case kMipsPopcnt:
return PopcntLatency();
case kMipsShlPair: {
if (instr->InputAt(2)->IsRegister()) {
return ShlPairLatency();
} else {
return ShlPairLatency(false);
}
}
case kMipsShrPair: {
if (instr->InputAt(2)->IsRegister()) {
return ShrPairLatency();
} else {
// auto immediate_operand = ImmediateOperand::cast(instr->InputAt(2));
// return ShrPairLatency(false, immediate_operand->inline_value());
return 1;
}
}
case kMipsSarPair: {
if (instr->InputAt(2)->IsRegister()) {
return SarPairLatency();
} else {
return SarPairLatency(false);
}
}
case kMipsExt:
return ExtLatency();
case kMipsIns:
return InsLatency();
case kMipsRor:
return RorLatency(instr->InputAt(1)->IsRegister());
case kMipsLsa:
return LsaLatency();
case kMipsModS:
case kMipsModD:
return PrepareCallCFunctionLatency() + MovToFloatParametersLatency() +
CallCFunctionLatency() + MovFromFloatResultLatency();
case kMipsAddPair:
return AddPairLatency();
case kMipsSubPair:
return SubPairLatency();
case kMipsMulPair:
return MulPairLatency();
case kMipsMaddS:
return MaddSLatency();
case kMipsMaddD:
return MaddDLatency();
case kMipsMsubS:
return MsubSLatency();
case kMipsMsubD:
return MsubDLatency();
case kMipsNegS:
return Neg_sLatency();
case kMipsNegD:
return Neg_dLatency();
case kMipsFloat64RoundDown:
case kMipsFloat64RoundTruncate:
case kMipsFloat64RoundUp:
case kMipsFloat64RoundTiesEven:
return Float64RoundLatency();
case kMipsFloat32RoundDown:
case kMipsFloat32RoundTruncate:
case kMipsFloat32RoundUp:
case kMipsFloat32RoundTiesEven:
return Float32RoundLatency();
case kMipsFloat32Max:
return Float32MaxLatency();
case kMipsFloat64Max:
return Float64MaxLatency();
case kMipsFloat32Min:
return Float32MinLatency();
case kMipsFloat64Min:
return Float64MinLatency();
case kMipsCvtSUw:
return CvtSUwLatency();
case kMipsCvtDUw:
return CvtDUwLatency();
case kMipsFloorWD:
return FloorWDLatency();
case kMipsCeilWD:
return CeilWDLatency();
case kMipsRoundWD:
return RoundWDLatency();
case kMipsTruncWD:
return Trunc_w_dLatency() + Latency::MFC1;
case kMipsTruncWS:
return Latency::TRUNC_W_S + Latency::MFC1 + AdduLatency(false) +
SltLatency() + MovnLatency();
case kMipsTruncUwD:
return Trunc_uw_dLatency();
case kMipsTruncUwS:
return Trunc_uw_sLatency() + AdduLatency(false) + MovzLatency();
case kMipsFloat64ExtractLowWord32:
return Latency::MFC1;
case kMipsFloat64ExtractHighWord32:
return Mfhc1Latency();
case kMipsFloat64InsertLowWord32: {
if (IsFp32Mode()) {
return Latency::MTC1;
} else {
return Latency::MFHC1 + Latency::MTC1 + Latency::MTHC1;
}
}
case kMipsFloat64InsertHighWord32:
return Mthc1Latency();
case kMipsFloat64SilenceNaN:
return Latency::SUB_D;
case kMipsSeb:
return SebLatency();
case kMipsSeh:
return SehLatency();
case kMipsUlhu:
return UlhuLatency();
case kMipsUlh:
return UlhLatency();
case kMipsUsh:
return UshLatency();
case kMipsUlw:
return UlwLatency();
case kMipsUsw:
return UswLatency();
case kMipsUlwc1:
return Ulwc1Latency();
case kMipsSwc1:
return MoveLatency(false) + Latency::SWC1; // Estimated max.
case kMipsUswc1:
return MoveLatency(false) + Uswc1Latency(); // Estimated max.
case kMipsLdc1:
return Ldc1Latency();
case kMipsUldc1:
return Uldc1Latency();
case kMipsSdc1:
return MoveLatency(false) + Sdc1Latency(); // Estimated max.
case kMipsUsdc1:
return MoveLatency(false) + Usdc1Latency(); // Estimated max.
case kMipsPush: {
if (instr->InputAt(0)->IsFPRegister()) {
auto op = LocationOperand::cast(instr->InputAt(0));
switch (op->representation()) {
case MachineRepresentation::kFloat32:
return Latency::SWC1 + SubuLatency(false);
break;
case MachineRepresentation::kFloat64:
return Sdc1Latency() + SubuLatency(false);
break;
default: {
UNREACHABLE();
break;
}
}
} else {
return PushRegisterLatency();
}
break;
}
case kMipsPeek: {
if (instr->OutputAt(0)->IsFPRegister()) {
auto op = LocationOperand::cast(instr->OutputAt(0));
if (op->representation() == MachineRepresentation::kFloat64) {
return Ldc1Latency();
} else {
return Latency::LWC1;
}
} else {
return 1;
}
break;
}
case kMipsStackClaim:
return SubuLatency(false);
case kMipsStoreToStackSlot: {
if (instr->InputAt(0)->IsFPRegister()) {
auto op = LocationOperand::cast(instr->InputAt(0));
if (op->representation() == MachineRepresentation::kFloat64) {
return Sdc1Latency();
} else if (op->representation() == MachineRepresentation::kFloat32) {
return Latency::SWC1;
} else {
return 1; // Estimated value.
}
} else {
return 1;
}
break;
}
case kMipsByteSwap32:
return ByteSwapSignedLatency();
case kWord32AtomicLoadInt8:
case kWord32AtomicLoadUint8:
case kWord32AtomicLoadInt16:
case kWord32AtomicLoadUint16:
case kWord32AtomicLoadWord32:
return 2;
case kWord32AtomicStoreWord8:
case kWord32AtomicStoreWord16:
case kWord32AtomicStoreWord32:
return 3;
case kWord32AtomicExchangeInt8:
return Word32AtomicExchangeLatency(true, 8);
case kWord32AtomicExchangeUint8:
return Word32AtomicExchangeLatency(false, 8);
case kWord32AtomicExchangeInt16:
return Word32AtomicExchangeLatency(true, 16);
case kWord32AtomicExchangeUint16:
return Word32AtomicExchangeLatency(false, 16);
case kWord32AtomicExchangeWord32: {
return 1 + AdduLatency() + Ldc1Latency() + 1 + ScLatency(0) +
BranchShortLatency() + 1;
}
case kWord32AtomicCompareExchangeInt8:
return Word32AtomicCompareExchangeLatency(true, 8);
case kWord32AtomicCompareExchangeUint8:
return Word32AtomicCompareExchangeLatency(false, 8);
case kWord32AtomicCompareExchangeInt16:
return Word32AtomicCompareExchangeLatency(true, 16);
case kWord32AtomicCompareExchangeUint16:
return Word32AtomicCompareExchangeLatency(false, 16);
case kWord32AtomicCompareExchangeWord32:
return AdduLatency() + 1 + LlLatency(0) + BranchShortLatency() + 1;
case kMipsTst:
return AndLatency(instr->InputAt(1)->IsRegister());
case kMipsCmpS:
return MoveLatency() + CompareF32Latency();
case kMipsCmpD:
return MoveLatency() + CompareF64Latency();
case kArchNop:
case kArchThrowTerminator:
case kMipsCmp:
return 0;
case kArchDebugBreak:
case kArchFramePointer:
case kArchParentFramePointer:
case kMipsShl:
case kMipsShr:
case kMipsSar:
case kMipsMov:
case kMipsMaxS:
case kMipsMinS:
case kMipsMaxD:
case kMipsMinD:
case kMipsLbu:
case kMipsLb:
case kMipsSb:
case kMipsLhu:
case kMipsLh:
case kMipsSh:
case kMipsLw:
case kMipsSw:
case kMipsLwc1:
return 1;
case kMipsAddS:
return Latency::ADD_S;
case kMipsSubS:
return Latency::SUB_S;
case kMipsMulS:
return Latency::MUL_S;
case kMipsAbsS:
return Latency::ABS_S;
case kMipsAddD:
return Latency::ADD_D;
case kMipsSubD:
return Latency::SUB_D;
case kMipsAbsD:
return Latency::ABS_D;
case kMipsCvtSD:
return Latency::CVT_S_D;
case kMipsCvtDS:
return Latency::CVT_D_S;
case kMipsMulD:
return Latency::MUL_D;
case kMipsFloorWS:
return Latency::FLOOR_W_S;
case kMipsCeilWS:
return Latency::CEIL_W_S;
case kMipsRoundWS:
return Latency::ROUND_W_S;
case kMipsCvtDW:
return Latency::CVT_D_W;
case kMipsCvtSW:
return Latency::CVT_S_W;
case kMipsDivS:
return Latency::DIV_S;
case kMipsSqrtS:
return Latency::SQRT_S;
case kMipsDivD:
return Latency::DIV_D;
case kMipsSqrtD:
return Latency::SQRT_D;
default:
return 1;
}
}
} // namespace compiler
} // namespace internal
} // namespace v8
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
08601d9628b06479c6d9d8cb03a10e7c1f7086b6 | cb142e98b043e7088f0fe009f5159928877acf1b | /Nano_Basic/Nano_Basic3_x2_ok_sample2_send_ok2/BBK2GPS.ino | df3d54b6592351818042f02e30d1189a74d5ab13 | [] | no_license | wetnt/Arduino_public | ef30502b4a30e099a09e2617fd58fd3a9801cf13 | 4cc331e2f43dda0df8f78d9cfe924da130ca5df3 | refs/heads/master | 2021-01-23T09:38:43.302783 | 2019-09-12T00:29:43 | 2019-09-12T00:29:43 | 33,909,041 | 2 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 5,871 | ino | //===================================================================
#include <SoftwareSerial.h>
#include <Time.h>//时间日期库
#include <TinyGPS++.h>//GPS解析库
//===================================================================
static const int GPSBaud = 9600;
int gpsZone = +8;//时区
static float homeW = 39.9718170, homeJ = 116.3248100;
static float homeL = 0;
//===================================================================
//#define gpsTR Serial2
SoftwareSerial gpsTR(11, 10); //RX,TX
TinyGPSPlus gpsTY;
//===================================================================
void GPS_setup() {
gpsTR.begin(GPSBaud);
lgln(F("gps.Serial.start!"));
}
//===================================================================
static void GPS_Feed()
{
//-------------------------------
gpsTR.listen();
while (gpsTR.available()) {
char c = gpsTR.read();
gpsTY.encode(c);
//lgs.write(c);
}
//-------------------------------
}
//=========================================================================
//#########################################################################
//=========================================================================
typedef struct GpsInfo
{
//----------------------------------------------------------------
int tz = 8;//time_zone
time_t tl = 0, tu = 0;//local_time,utc_time
//----------------------------------------------------------------
int dy, dm, dd, th, tm, ts; //year,month,day,hour,min,second
double w, j, h, v, x; //lat,long,high,speed,fangxiang
//----------------------------------------------------------------
int n, r; //sat_number,sat_hdop
bool k, p; //GPS_Location_flag
//char p;//GPS_Location_type
//----------------------------------------------------------------
};
typedef struct GpsInfoString
{
//----------------------------------------------------------------
char tl[15], tu[15]; //time_utc/local
char d[12], t[10]; //YMD,HMS
char ds[6], ts[6]; //MD,HM
char w[14], j[14], h[8], v[8], x[8]; //WJHVF
char p[2], k[2], n[4], r[4], z[4]; //KT;KK;SN;SR;HZ;
//----------------------------------------------------------------
};
//=========================================================================
//#########################################################################
//=========================================================================
GpsInfo g;
GpsInfoString gs;
//=========================================================================
//#########################################################################
//=========================================================================
void GpsValueSet() {
//-------------------------------------------------------------------------
g.tz = gpsZone;
//-------------------------------------------------------------------------
setTime(
gpsTY.time.hour(), gpsTY.time.minute(), gpsTY.time.second(),
gpsTY.date.day(), gpsTY.date.month(), gpsTY.date.year()
);
//setTime(10, 30, 38, 1, 10, 2015);
g.tu = now();
setTime(
gpsTY.time.hour() + g.tz, gpsTY.time.minute(), gpsTY.time.second(),
gpsTY.date.day(), gpsTY.date.month(), gpsTY.date.year()
);
//setTime(10, 30, 38, 1, 10, 2015);
g.tl = now();
//-------------------------------------------------------------------------
g.dy = year(); g.dm = month(); g.dd = day();
g.th = hour(); g.tm = minute(); g.ts = second();
//-------------------------------------------------------------------------
g.k = gpsTY.gpsDataGood;
g.p = gpsTY.date.isValid();//.sentencesWithFix();//gpsTY.sentenceHasFix - 46;
//-------------------------------------------------------------------------
g.n = gpsTY.satellites.value();
g.r = gpsTY.hdop.value();
g.w = gpsTY.location.lat();
g.j = gpsTY.location.lng();
g.h = gpsTY.altitude.meters();
g.x = gpsTY.course.deg();
g.v = gpsTY.speed.kmph();
//-------------------------------------------------------------------------
if (0) {
g.w = 39.977123456; g.j = 116.332; g.h = 50;
g.x = 180; g.v = 80; g.n = 4; g.r = 100;
}
//-------------------------------------------------------------------------
}
static void GpsStringSet() {
//-------------------------------------------------------------------------
dtostrf(g.k, 1, 0, gs.k);
dtostrf(g.p, 1, 0, gs.p);
//gs.p = g.p;
//gs.k = g.k; //dtostrf(g.p, 1, 0, gs.p);
//-------------------------------------------------------------------------
sprintf(gs.d, "%02d-%02d-%02d", g.dy, g.dm, g.dd);
sprintf(gs.t, "%02d:%02d:%02d", g.th, g.tm, g.ts);
sprintf(gs.ds, "%02d-%02d", g.dm, g.dd);
sprintf(gs.ts, "%02d:%02d", g.th, g.tm);
//-------------------------------------------------------------------------
dtostrf((uint32_t)g.tu, 10, 0, gs.tu);
dtostrf((uint32_t)g.tl, 10, 0, gs.tl);
//-------------------------------------------------------------------------
dtostrf(g.w, 3, 7, gs.w); dtostrf(g.j, 3, 7, gs.j);
dtostrf(g.h, 4, 0, gs.h); dtostrf(g.v, 3, 1, gs.v);
dtostrf(g.x, 3, 0, gs.x);
dtostrf(g.n, 2, 0, gs.n); dtostrf(g.r, 4, 0, gs.r);
//-------------------------------------------------------------------------
}
//=========================================================================
//#########################################################################
//=========================================================================
void GpsToHome() {
homeL = TinyGPSPlus::distanceBetween(g.w, g.j, homeW, homeJ) / 1000;
}
void GpsLineShow() {
//--------------------------------------------------------
lg(gs.d); lg(" "); lg(gs.t); lg(" ");
lg(gs.w); lg(","); lg(gs.j); lg(","); lg(gs.h); lg(",");
lg(gs.v); lg(","); lg(gs.x); lg(","); lg(gs.n); lg(",");
lg(homeL); lgln("");
//--------------------------------------------------------
}
//===============================================================
| [
"jinping.xu@woqu.com"
] | jinping.xu@woqu.com |
b3dab9214c560568f471fe2bc3d231ff27f9cff1 | 13240a810679cc98b5345fe884650f6f69f6b2e5 | /boj/4949.cpp | feeef18933806958c0108dd0fdef284b13164b82 | [] | no_license | tristan3716/Problem-Solving | a7d76941f089e1a54fd7772bc7fa79236e3ac12b | c0df0748084eae31626985e00b1884d4adf29f3f | refs/heads/master | 2021-07-09T11:07:17.223598 | 2021-04-09T14:25:01 | 2021-04-09T14:25:01 | 240,870,428 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 751 | cpp | #include <iostream>
#include <string>
#include <stack>
bool IsPair(const char cc, const char co) {
switch (cc) {
case ')':
return co == '(' ? true : false;
case ']':
return co == '[' ? true : false;
}
return false;
}
bool solution(std::string in) {
std::stack<char> ps;
for (char c : in) {
switch (c) {
case '(':
case '[':
ps.push(c);
break;
case ')':
case ']':
if (ps.empty() || !IsPair(c, ps.top()))
return false;
ps.pop();
break;
}
}
if (ps.empty())
return true;
else
return false;
}
int main() {
while (1) {
std::string in;
getline(std::cin, in);
if (in[0] == '.')
break;
if (solution(in))
std::cout << "yes" << std::endl;
else
std::cout << "no" << std::endl;
}
return 0;
} | [
"tristan3716@gmail.com"
] | tristan3716@gmail.com |
98b85e39f14c9512db94a2c825594a861e8a0b54 | b90a15c7dbb02f4f1e38ba7c60ea349de3cef110 | /Source/SeamlessTravel/MyPlayerController.cpp | 46567d0ff7b6fc7fd75b668cf08dc7e8a7a05714 | [] | no_license | sambsp/UE4_SeamlessTraval_Standalone | f4d0de041299ebca067706e9a2b15f74608dac90 | cb50130d71a1b4d54f0e126908303178edc3f60c | refs/heads/main | 2023-04-21T21:02:24.987075 | 2021-04-22T08:20:29 | 2021-04-22T08:20:29 | 360,432,119 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 278 | cpp | // Fill out your copyright notice in the Description page of Project Settings.
#include "MyPlayerController.h"
void AMyPlayerController::DoTravel(FString map) {
UE_LOG(LogTemp, Warning, TEXT("Do the travel.........................."));
ClientTravel(map, TRAVEL_Relative);
} | [
"hua.zhou@enigmatrixgames.com"
] | hua.zhou@enigmatrixgames.com |
a9da2461ec1979fb840bfe170985017ed0b1599f | 47d6cdb9b21e2d729f23dca519ad07ff71df3066 | /third/boost/boost/date_time/posix_time/posix_time_legacy_io.hpp | 373540772618e8b13b7da9c359e743fab28535a0 | [
"BSL-1.0"
] | permissive | fiskercui/testcommon | f71ca147a7a5e4fa3cefe46efd65e2d835721c7b | 9e4f61950816202cf5c6d4d00dd521dfcdd08c8a | refs/heads/master | 2021-01-13T02:10:36.072343 | 2013-08-10T14:36:18 | 2013-08-10T14:36:18 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,691 | hpp | #ifndef POSIX_TIME_PRE133_OPERATORS_HPP___
#define POSIX_TIME_PRE133_OPERATORS_HPP___
/* Copyright (c) 2002-2004 CrystalClear Software, Inc.
* Use, modification and distribution is subject to the
* Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
* Author: Jeff Garland, Bart Garst
* $Date: 2008-02-27 10:51:14 -0800 (Wed, 27 Feb 2008) $
*/
/*! @file posix_time_pre133_operators.hpp
* These input and output operators are for use with the
* pre 1.33 version of the date_time libraries io facet code.
* The operators used in version 1.33 and later can be found
* in posix_time_io.hpp */
#include <iostream>
#include <string>
#include <sstream>
#include "boost/date_time/compiler_config.hpp"
#include "boost/date_time/gregorian/gregorian.hpp"
#include "boost/date_time/posix_time/posix_time_duration.hpp"
#include "boost/date_time/posix_time/ptime.hpp"
#include "boost/date_time/posix_time/time_period.hpp"
#include "boost/date_time/time_parsing.hpp"
namespace boost {
namespace posix_time {
//The following code is removed for configurations with poor std::locale support (eg: MSVC6, gcc 2.9x)
#ifndef BOOST_DATE_TIME_NO_LOCALE
#if defined(USE_DATE_TIME_PRE_1_33_FACET_IO)
//! ostream operator for posix_time::time_duration
template <class charT, class traits>
inline
std::basic_ostream<charT, traits>&
operator<<(std::basic_ostream<charT, traits>& os, const time_duration& td)
{
typedef boost::date_time::ostream_time_duration_formatter<time_duration, charT> duration_formatter;
duration_formatter::duration_put(td, os);
return os;
}
//! ostream operator for posix_time::ptime
template <class charT, class traits>
inline
std::basic_ostream<charT, traits>&
operator<<(std::basic_ostream<charT, traits>& os, const ptime& t)
{
typedef boost::date_time::ostream_time_formatter<ptime, charT> time_formatter;
time_formatter::time_put(t, os);
return os;
}
//! ostream operator for posix_time::time_period
template <class charT, class traits>
inline
std::basic_ostream<charT, traits>&
operator<<(std::basic_ostream<charT, traits>& os, const time_period& tp)
{
typedef boost::date_time::ostream_time_period_formatter<time_period, charT> period_formatter;
period_formatter::period_put(tp, os);
return os;
}
#endif // USE_DATE_TIME_PRE_1_33_FACET_IO
/******** input streaming ********/
template<class charT>
inline
std::basic_istream<charT>& operator>>(std::basic_istream<charT>& is, time_duration& td)
{
// need to create a std::string and parse it
std::basic_string<charT> inp_s;
std::stringstream out_ss;
is >> inp_s;
typename std::basic_string<charT>::iterator b = inp_s.begin();
// need to use both iterators because there is no requirement
// for the data held by a std::basic_string<> be terminated with
// any marker (such as '\0').
typename std::basic_string<charT>::iterator e = inp_s.end();
while(b != e){
out_ss << out_ss.narrow(*b, 0);
++b;
}
td = date_time::parse_delimited_time_duration<time_duration>(out_ss.str());
return is;
}
template<class charT>
inline
std::basic_istream<charT>& operator>>(std::basic_istream<charT>& is, ptime& pt)
{
gregorian::date d(not_a_date_time);
time_duration td(0,0,0);
is >> d >> td;
pt = ptime(d, td);
return is;
}
/** operator>> for time_period. time_period must be in
* "[date time_duration/date time_duration]" format. */
template<class charT>
inline
std::basic_istream<charT>& operator>>(std::basic_istream<charT>& is, time_period& tp)
{
gregorian::date d(not_a_date_time);
time_duration td(0,0,0);
ptime beg(d, td);
ptime end(beg);
std::basic_string<charT> s;
// get first date string and remove leading '['
is >> s;
{
std::basic_stringstream<charT> ss;
ss << s.substr(s.find('[')+1);
ss >> d;
}
// get first time_duration & second date string, remove the '/'
// and split into 2 strings
is >> s;
{
std::basic_stringstream<charT> ss;
ss << s.substr(0, s.find('/'));
ss >> td;
}
beg = ptime(d, td);
{
std::basic_stringstream<charT> ss;
ss << s.substr(s.find('/')+1);
ss >> d;
}
// get last time_duration and remove the trailing ']'
is >> s;
{
std::basic_stringstream<charT> ss;
ss << s.substr(0, s.find(']'));
ss >> td;
}
end = ptime(d, td);
tp = time_period(beg,end);
return is;
}
#endif //BOOST_DATE_TIME_NO_LOCALE
} } // namespaces
#endif // POSIX_TIME_PRE133_OPERATORS_HPP___
| [
"fisker@ubuntu.(none)"
] | fisker@ubuntu.(none) |
bc63c1a1fbfb3710171305ff710364c2e296e9c8 | c57819bebe1a3e1d305ae0cb869cdcc48c7181d1 | /src/qt/src/3rdparty/webkit/Source/WebCore/editing/TypingCommand.cpp | 4d48e6c18837f5beb57a8376aef05d3476b437a2 | [
"BSD-3-Clause",
"BSD-2-Clause",
"LGPL-2.1-only",
"LGPL-2.0-only",
"Qt-LGPL-exception-1.1",
"LicenseRef-scancode-generic-exception",
"GPL-3.0-only",
"GPL-1.0-or-later",
"GFDL-1.3-only"
] | permissive | blowery/phantomjs | 255829570e90a28d1cd597192e20314578ef0276 | f929d2b04a29ff6c3c5b47cd08a8f741b1335c72 | refs/heads/master | 2023-04-08T01:22:35.426692 | 2012-10-11T17:43:24 | 2012-10-11T17:43:24 | 6,177,895 | 1 | 0 | BSD-3-Clause | 2023-04-03T23:09:40 | 2012-10-11T17:39:25 | C++ | UTF-8 | C++ | false | false | 29,342 | cpp | /*
* Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "TypingCommand.h"
#include "BeforeTextInsertedEvent.h"
#include "BreakBlockquoteCommand.h"
#include "DeleteSelectionCommand.h"
#include "Document.h"
#include "Editor.h"
#include "Element.h"
#include "Frame.h"
#include "HTMLNames.h"
#include "InsertLineBreakCommand.h"
#include "InsertParagraphSeparatorCommand.h"
#include "InsertTextCommand.h"
#include "RenderObject.h"
#include "SelectionController.h"
#include "TextIterator.h"
#include "VisiblePosition.h"
#include "htmlediting.h"
#include "visible_units.h"
namespace WebCore {
using namespace HTMLNames;
static bool canAppendNewLineFeed(const VisibleSelection& selection)
{
Node* node = selection.rootEditableElement();
if (!node)
return false;
RefPtr<BeforeTextInsertedEvent> event = BeforeTextInsertedEvent::create(String("\n"));
ExceptionCode ec = 0;
node->dispatchEvent(event, ec);
return event->text().length();
}
TypingCommand::TypingCommand(Document *document, ETypingCommand commandType, const String &textToInsert, Options options, TextGranularity granularity, TextCompositionType compositionType)
: CompositeEditCommand(document)
, m_commandType(commandType)
, m_textToInsert(textToInsert)
, m_openForMoreTyping(true)
, m_selectInsertedText(options & SelectInsertedText)
, m_smartDelete(options & SmartDelete)
, m_granularity(granularity)
, m_compositionType(compositionType)
, m_killRing(options & KillRing)
, m_openedByBackwardDelete(false)
, m_shouldRetainAutocorrectionIndicator(options & RetainAutocorrectionIndicator)
, m_shouldPreventSpellChecking(options & PreventSpellChecking)
{
updatePreservesTypingStyle(m_commandType);
}
void TypingCommand::deleteSelection(Document* document, Options options)
{
ASSERT(document);
Frame* frame = document->frame();
ASSERT(frame);
if (!frame->selection()->isRange())
return;
EditCommand* lastEditCommand = frame->editor()->lastEditCommand();
if (isOpenForMoreTypingCommand(lastEditCommand)) {
TypingCommand* lastTypingCommand = static_cast<TypingCommand*>(lastEditCommand);
lastTypingCommand->setShouldPreventSpellChecking(options & PreventSpellChecking);
lastTypingCommand->deleteSelection(options & SmartDelete);
return;
}
TypingCommand::create(document, DeleteSelection, "", options)->apply();
}
void TypingCommand::deleteKeyPressed(Document *document, Options options, TextGranularity granularity)
{
ASSERT(document);
Frame* frame = document->frame();
ASSERT(frame);
EditCommand* lastEditCommand = frame->editor()->lastEditCommand();
if (granularity == CharacterGranularity && isOpenForMoreTypingCommand(lastEditCommand)) {
TypingCommand* lastTypingCommand = static_cast<TypingCommand*>(lastEditCommand);
updateSelectionIfDifferentFromCurrentSelection(lastTypingCommand, frame);
lastTypingCommand->setShouldPreventSpellChecking(options & PreventSpellChecking);
lastTypingCommand->deleteKeyPressed(granularity, options & KillRing);
return;
}
TypingCommand::create(document, DeleteKey, "", options, granularity)->apply();
}
void TypingCommand::forwardDeleteKeyPressed(Document *document, Options options, TextGranularity granularity)
{
// FIXME: Forward delete in TextEdit appears to open and close a new typing command.
ASSERT(document);
Frame* frame = document->frame();
ASSERT(frame);
EditCommand* lastEditCommand = frame->editor()->lastEditCommand();
if (granularity == CharacterGranularity && isOpenForMoreTypingCommand(lastEditCommand)) {
TypingCommand* lastTypingCommand = static_cast<TypingCommand*>(lastEditCommand);
updateSelectionIfDifferentFromCurrentSelection(lastTypingCommand, frame);
lastTypingCommand->setShouldPreventSpellChecking(options & PreventSpellChecking);
lastTypingCommand->forwardDeleteKeyPressed(granularity, options & KillRing);
return;
}
TypingCommand::create(document, ForwardDeleteKey, "", options, granularity)->apply();
}
void TypingCommand::updateSelectionIfDifferentFromCurrentSelection(TypingCommand* typingCommand, Frame* frame)
{
ASSERT(frame);
VisibleSelection currentSelection = frame->selection()->selection();
if (currentSelection == typingCommand->endingSelection())
return;
typingCommand->setStartingSelection(currentSelection);
typingCommand->setEndingSelection(currentSelection);
}
void TypingCommand::insertText(Document* document, const String& text, Options options, TextCompositionType composition)
{
ASSERT(document);
Frame* frame = document->frame();
ASSERT(frame);
if (!text.isEmpty())
document->frame()->editor()->updateMarkersForWordsAffectedByEditing(isSpaceOrNewline(text.characters()[0]));
insertText(document, text, frame->selection()->selection(), options, composition);
}
// FIXME: We shouldn't need to take selectionForInsertion. It should be identical to SelectionController's current selection.
void TypingCommand::insertText(Document* document, const String& text, const VisibleSelection& selectionForInsertion, Options options, TextCompositionType compositionType)
{
ASSERT(document);
RefPtr<Frame> frame = document->frame();
ASSERT(frame);
VisibleSelection currentSelection = frame->selection()->selection();
bool changeSelection = currentSelection != selectionForInsertion;
String newText = text;
if (Node* startNode = selectionForInsertion.start().containerNode()) {
if (startNode->rootEditableElement() && compositionType != TextCompositionUpdate) {
// Send BeforeTextInsertedEvent. The event handler will update text if necessary.
ExceptionCode ec = 0;
RefPtr<BeforeTextInsertedEvent> evt = BeforeTextInsertedEvent::create(text);
startNode->rootEditableElement()->dispatchEvent(evt, ec);
newText = evt->text();
}
}
if (newText.isEmpty())
return;
// Set the starting and ending selection appropriately if we are using a selection
// that is different from the current selection. In the future, we should change EditCommand
// to deal with custom selections in a general way that can be used by all of the commands.
RefPtr<EditCommand> lastEditCommand = frame->editor()->lastEditCommand();
if (isOpenForMoreTypingCommand(lastEditCommand.get())) {
TypingCommand* lastTypingCommand = static_cast<TypingCommand*>(lastEditCommand.get());
if (lastTypingCommand->endingSelection() != selectionForInsertion) {
lastTypingCommand->setStartingSelection(selectionForInsertion);
lastTypingCommand->setEndingSelection(selectionForInsertion);
}
lastTypingCommand->setCompositionType(compositionType);
lastTypingCommand->setShouldRetainAutocorrectionIndicator(options & RetainAutocorrectionIndicator);
lastTypingCommand->setShouldPreventSpellChecking(options & PreventSpellChecking);
lastTypingCommand->insertText(newText, options & SelectInsertedText);
return;
}
RefPtr<TypingCommand> cmd = TypingCommand::create(document, InsertText, newText, options, compositionType);
if (changeSelection) {
cmd->setStartingSelection(selectionForInsertion);
cmd->setEndingSelection(selectionForInsertion);
}
applyCommand(cmd);
if (changeSelection) {
cmd->setEndingSelection(currentSelection);
frame->selection()->setSelection(currentSelection);
}
}
void TypingCommand::insertLineBreak(Document *document, Options options)
{
ASSERT(document);
Frame* frame = document->frame();
ASSERT(frame);
EditCommand* lastEditCommand = frame->editor()->lastEditCommand();
if (isOpenForMoreTypingCommand(lastEditCommand)) {
TypingCommand* lastTypingCommand = static_cast<TypingCommand*>(lastEditCommand);
lastTypingCommand->setShouldRetainAutocorrectionIndicator(options & RetainAutocorrectionIndicator);
lastTypingCommand->insertLineBreak();
return;
}
applyCommand(TypingCommand::create(document, InsertLineBreak, "", options));
}
void TypingCommand::insertParagraphSeparatorInQuotedContent(Document *document)
{
ASSERT(document);
Frame* frame = document->frame();
ASSERT(frame);
EditCommand* lastEditCommand = frame->editor()->lastEditCommand();
if (isOpenForMoreTypingCommand(lastEditCommand)) {
static_cast<TypingCommand*>(lastEditCommand)->insertParagraphSeparatorInQuotedContent();
return;
}
applyCommand(TypingCommand::create(document, InsertParagraphSeparatorInQuotedContent));
}
void TypingCommand::insertParagraphSeparator(Document *document, Options options)
{
ASSERT(document);
Frame* frame = document->frame();
ASSERT(frame);
EditCommand* lastEditCommand = frame->editor()->lastEditCommand();
if (isOpenForMoreTypingCommand(lastEditCommand)) {
TypingCommand* lastTypingCommand = static_cast<TypingCommand*>(lastEditCommand);
lastTypingCommand->setShouldRetainAutocorrectionIndicator(options & RetainAutocorrectionIndicator);
lastTypingCommand->insertParagraphSeparator();
return;
}
applyCommand(TypingCommand::create(document, InsertParagraphSeparator, "", options));
}
bool TypingCommand::isOpenForMoreTypingCommand(const EditCommand* cmd)
{
return cmd && cmd->isTypingCommand() && static_cast<const TypingCommand*>(cmd)->isOpenForMoreTyping();
}
void TypingCommand::closeTyping(EditCommand* cmd)
{
if (isOpenForMoreTypingCommand(cmd))
static_cast<TypingCommand*>(cmd)->closeTyping();
}
void TypingCommand::doApply()
{
if (!endingSelection().isNonOrphanedCaretOrRange())
return;
if (m_commandType == DeleteKey)
if (m_commands.isEmpty())
m_openedByBackwardDelete = true;
switch (m_commandType) {
case DeleteSelection:
deleteSelection(m_smartDelete);
return;
case DeleteKey:
deleteKeyPressed(m_granularity, m_killRing);
return;
case ForwardDeleteKey:
forwardDeleteKeyPressed(m_granularity, m_killRing);
return;
case InsertLineBreak:
insertLineBreak();
return;
case InsertParagraphSeparator:
insertParagraphSeparator();
return;
case InsertParagraphSeparatorInQuotedContent:
insertParagraphSeparatorInQuotedContent();
return;
case InsertText:
insertText(m_textToInsert, m_selectInsertedText);
return;
}
ASSERT_NOT_REACHED();
}
EditAction TypingCommand::editingAction() const
{
return EditActionTyping;
}
void TypingCommand::markMisspellingsAfterTyping(ETypingCommand commandType)
{
#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD)
if (!document()->frame()->editor()->isContinuousSpellCheckingEnabled()
&& !document()->frame()->editor()->isAutomaticQuoteSubstitutionEnabled()
&& !document()->frame()->editor()->isAutomaticLinkDetectionEnabled()
&& !document()->frame()->editor()->isAutomaticDashSubstitutionEnabled()
&& !document()->frame()->editor()->isAutomaticTextReplacementEnabled())
return;
#else
if (!document()->frame()->editor()->isContinuousSpellCheckingEnabled())
return;
#endif
// Take a look at the selection that results after typing and determine whether we need to spellcheck.
// Since the word containing the current selection is never marked, this does a check to
// see if typing made a new word that is not in the current selection. Basically, you
// get this by being at the end of a word and typing a space.
VisiblePosition start(endingSelection().start(), endingSelection().affinity());
VisiblePosition previous = start.previous();
if (previous.isNotNull()) {
VisiblePosition p1 = startOfWord(previous, LeftWordIfOnBoundary);
VisiblePosition p2 = startOfWord(start, LeftWordIfOnBoundary);
if (p1 != p2) {
RefPtr<Range> range = makeRange(p1, p2);
String strippedPreviousWord;
if (range && (commandType == TypingCommand::InsertText || commandType == TypingCommand::InsertLineBreak || commandType == TypingCommand::InsertParagraphSeparator || commandType == TypingCommand::InsertParagraphSeparatorInQuotedContent))
strippedPreviousWord = plainText(range.get()).stripWhiteSpace();
document()->frame()->editor()->markMisspellingsAfterTypingToWord(p1, endingSelection(), !strippedPreviousWord.isEmpty());
} else if (commandType == TypingCommand::InsertText)
document()->frame()->editor()->startCorrectionPanelTimer();
}
}
void TypingCommand::typingAddedToOpenCommand(ETypingCommand commandTypeForAddedTyping)
{
updatePreservesTypingStyle(commandTypeForAddedTyping);
#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD)
document()->frame()->editor()->appliedEditing(this);
// Since the spellchecking code may also perform corrections and other replacements, it should happen after the typing changes.
if (!m_shouldPreventSpellChecking)
markMisspellingsAfterTyping(commandTypeForAddedTyping);
#else
// The old spellchecking code requires that checking be done first, to prevent issues like that in 6864072, where <doesn't> is marked as misspelled.
markMisspellingsAfterTyping(commandTypeForAddedTyping);
document()->frame()->editor()->appliedEditing(this);
#endif
}
void TypingCommand::insertText(const String &text, bool selectInsertedText)
{
// FIXME: Need to implement selectInsertedText for cases where more than one insert is involved.
// This requires support from insertTextRunWithoutNewlines and insertParagraphSeparator for extending
// an existing selection; at the moment they can either put the caret after what's inserted or
// select what's inserted, but there's no way to "extend selection" to include both an old selection
// that ends just before where we want to insert text and the newly inserted text.
unsigned offset = 0;
size_t newline;
while ((newline = text.find('\n', offset)) != notFound) {
if (newline != offset)
insertTextRunWithoutNewlines(text.substring(offset, newline - offset), false);
insertParagraphSeparator();
offset = newline + 1;
}
if (!offset)
insertTextRunWithoutNewlines(text, selectInsertedText);
else {
unsigned length = text.length();
if (length != offset)
insertTextRunWithoutNewlines(text.substring(offset, length - offset), selectInsertedText);
}
}
void TypingCommand::insertTextRunWithoutNewlines(const String &text, bool selectInsertedText)
{
RefPtr<InsertTextCommand> command;
if (!document()->frame()->selection()->typingStyle() && !m_commands.isEmpty()) {
EditCommand* lastCommand = m_commands.last().get();
if (lastCommand->isInsertTextCommand())
command = static_cast<InsertTextCommand*>(lastCommand);
}
if (!command) {
command = InsertTextCommand::create(document());
applyCommandToComposite(command);
}
if (endingSelection() != command->endingSelection()) {
command->setStartingSelection(endingSelection());
command->setEndingSelection(endingSelection());
}
command->input(text, selectInsertedText,
m_compositionType == TextCompositionNone ? InsertTextCommand::RebalanceLeadingAndTrailingWhitespaces : InsertTextCommand::RebalanceAllWhitespaces);
typingAddedToOpenCommand(InsertText);
}
void TypingCommand::insertLineBreak()
{
if (!canAppendNewLineFeed(endingSelection()))
return;
applyCommandToComposite(InsertLineBreakCommand::create(document()));
typingAddedToOpenCommand(InsertLineBreak);
}
void TypingCommand::insertParagraphSeparator()
{
if (!canAppendNewLineFeed(endingSelection()))
return;
applyCommandToComposite(InsertParagraphSeparatorCommand::create(document()));
typingAddedToOpenCommand(InsertParagraphSeparator);
}
void TypingCommand::insertParagraphSeparatorInQuotedContent()
{
// If the selection starts inside a table, just insert the paragraph separator normally
// Breaking the blockquote would also break apart the table, which is unecessary when inserting a newline
if (enclosingNodeOfType(endingSelection().start(), &isTableStructureNode)) {
insertParagraphSeparator();
return;
}
applyCommandToComposite(BreakBlockquoteCommand::create(document()));
typingAddedToOpenCommand(InsertParagraphSeparatorInQuotedContent);
}
bool TypingCommand::makeEditableRootEmpty()
{
Element* root = endingSelection().rootEditableElement();
if (!root || !root->firstChild())
return false;
if (root->firstChild() == root->lastChild() && root->firstElementChild() && root->firstElementChild()->hasTagName(brTag)) {
// If there is a single child and it could be a placeholder, leave it alone.
if (root->renderer() && root->renderer()->isBlockFlow())
return false;
}
while (Node* child = root->firstChild())
removeNode(child);
addBlockPlaceholderIfNeeded(root);
setEndingSelection(VisibleSelection(firstPositionInNode(root), DOWNSTREAM));
return true;
}
void TypingCommand::deleteKeyPressed(TextGranularity granularity, bool killRing)
{
document()->frame()->editor()->updateMarkersForWordsAffectedByEditing(false);
VisibleSelection selectionToDelete;
VisibleSelection selectionAfterUndo;
switch (endingSelection().selectionType()) {
case VisibleSelection::RangeSelection:
selectionToDelete = endingSelection();
selectionAfterUndo = selectionToDelete;
break;
case VisibleSelection::CaretSelection: {
// After breaking out of an empty mail blockquote, we still want continue with the deletion
// so actual content will get deleted, and not just the quote style.
if (breakOutOfEmptyMailBlockquotedParagraph())
typingAddedToOpenCommand(DeleteKey);
m_smartDelete = false;
SelectionController selection;
selection.setSelection(endingSelection());
selection.modify(SelectionController::AlterationExtend, DirectionBackward, granularity);
if (killRing && selection.isCaret() && granularity != CharacterGranularity)
selection.modify(SelectionController::AlterationExtend, DirectionBackward, CharacterGranularity);
if (endingSelection().visibleStart().previous(CannotCrossEditingBoundary).isNull()) {
// When the caret is at the start of the editable area in an empty list item, break out of the list item.
if (breakOutOfEmptyListItem()) {
typingAddedToOpenCommand(DeleteKey);
return;
}
// When there are no visible positions in the editing root, delete its entire contents.
if (endingSelection().visibleStart().next(CannotCrossEditingBoundary).isNull() && makeEditableRootEmpty()) {
typingAddedToOpenCommand(DeleteKey);
return;
}
}
VisiblePosition visibleStart(endingSelection().visibleStart());
// If we have a caret selection on an empty cell, we have nothing to do.
if (isEmptyTableCell(visibleStart.deepEquivalent().containerNode()))
return;
// If the caret is at the start of a paragraph after a table, move content into the last table cell.
if (isStartOfParagraph(visibleStart) && isFirstPositionAfterTable(visibleStart.previous(CannotCrossEditingBoundary))) {
// Unless the caret is just before a table. We don't want to move a table into the last table cell.
if (isLastPositionBeforeTable(visibleStart))
return;
// Extend the selection backward into the last cell, then deletion will handle the move.
selection.modify(SelectionController::AlterationExtend, DirectionBackward, granularity);
// If the caret is just after a table, select the table and don't delete anything.
} else if (Node* table = isFirstPositionAfterTable(visibleStart)) {
setEndingSelection(VisibleSelection(positionBeforeNode(table), endingSelection().start(), DOWNSTREAM));
typingAddedToOpenCommand(DeleteKey);
return;
}
selectionToDelete = selection.selection();
if (granularity == CharacterGranularity && selectionToDelete.end().containerNode() == selectionToDelete.start().containerNode()
&& selectionToDelete.end().computeOffsetInContainerNode() - selectionToDelete.start().computeOffsetInContainerNode() > 1) {
// If there are multiple Unicode code points to be deleted, adjust the range to match platform conventions.
selectionToDelete.setWithoutValidation(selectionToDelete.end(), selectionToDelete.end().previous(BackwardDeletion));
}
if (!startingSelection().isRange() || selectionToDelete.base() != startingSelection().start())
selectionAfterUndo = selectionToDelete;
else
// It's a little tricky to compute what the starting selection would have been in the original document.
// We can't let the VisibleSelection class's validation kick in or it'll adjust for us based on
// the current state of the document and we'll get the wrong result.
selectionAfterUndo.setWithoutValidation(startingSelection().end(), selectionToDelete.extent());
break;
}
case VisibleSelection::NoSelection:
ASSERT_NOT_REACHED();
break;
}
ASSERT(!selectionToDelete.isNone());
if (selectionToDelete.isNone())
return;
if (selectionToDelete.isCaret() || !document()->frame()->selection()->shouldDeleteSelection(selectionToDelete))
return;
if (killRing)
document()->frame()->editor()->addToKillRing(selectionToDelete.toNormalizedRange().get(), false);
// Make undo select everything that has been deleted, unless an undo will undo more than just this deletion.
// FIXME: This behaves like TextEdit except for the case where you open with text insertion and then delete
// more text than you insert. In that case all of the text that was around originally should be selected.
if (m_openedByBackwardDelete)
setStartingSelection(selectionAfterUndo);
CompositeEditCommand::deleteSelection(selectionToDelete, m_smartDelete);
setSmartDelete(false);
typingAddedToOpenCommand(DeleteKey);
}
void TypingCommand::forwardDeleteKeyPressed(TextGranularity granularity, bool killRing)
{
document()->frame()->editor()->updateMarkersForWordsAffectedByEditing(false);
VisibleSelection selectionToDelete;
VisibleSelection selectionAfterUndo;
switch (endingSelection().selectionType()) {
case VisibleSelection::RangeSelection:
selectionToDelete = endingSelection();
selectionAfterUndo = selectionToDelete;
break;
case VisibleSelection::CaretSelection: {
m_smartDelete = false;
// Handle delete at beginning-of-block case.
// Do nothing in the case that the caret is at the start of a
// root editable element or at the start of a document.
SelectionController selection;
selection.setSelection(endingSelection());
selection.modify(SelectionController::AlterationExtend, DirectionForward, granularity);
if (killRing && selection.isCaret() && granularity != CharacterGranularity)
selection.modify(SelectionController::AlterationExtend, DirectionForward, CharacterGranularity);
Position downstreamEnd = endingSelection().end().downstream();
VisiblePosition visibleEnd = endingSelection().visibleEnd();
if (visibleEnd == endOfParagraph(visibleEnd))
downstreamEnd = visibleEnd.next(CannotCrossEditingBoundary).deepEquivalent().downstream();
// When deleting tables: Select the table first, then perform the deletion
if (downstreamEnd.containerNode() && downstreamEnd.containerNode()->renderer() && downstreamEnd.containerNode()->renderer()->isTable()
&& downstreamEnd.computeOffsetInContainerNode() <= caretMinOffset(downstreamEnd.containerNode())) {
setEndingSelection(VisibleSelection(endingSelection().end(), positionAfterNode(downstreamEnd.containerNode()), DOWNSTREAM));
typingAddedToOpenCommand(ForwardDeleteKey);
return;
}
// deleting to end of paragraph when at end of paragraph needs to merge the next paragraph (if any)
if (granularity == ParagraphBoundary && selection.selection().isCaret() && isEndOfParagraph(selection.selection().visibleEnd()))
selection.modify(SelectionController::AlterationExtend, DirectionForward, CharacterGranularity);
selectionToDelete = selection.selection();
if (!startingSelection().isRange() || selectionToDelete.base() != startingSelection().start())
selectionAfterUndo = selectionToDelete;
else {
// It's a little tricky to compute what the starting selection would have been in the original document.
// We can't let the VisibleSelection class's validation kick in or it'll adjust for us based on
// the current state of the document and we'll get the wrong result.
Position extent = startingSelection().end();
if (extent.containerNode() != selectionToDelete.end().containerNode())
extent = selectionToDelete.extent();
else {
int extraCharacters;
if (selectionToDelete.start().containerNode() == selectionToDelete.end().containerNode())
extraCharacters = selectionToDelete.end().computeOffsetInContainerNode() - selectionToDelete.start().computeOffsetInContainerNode();
else
extraCharacters = selectionToDelete.end().computeOffsetInContainerNode();
extent = Position(extent.containerNode(), extent.computeOffsetInContainerNode() + extraCharacters, Position::PositionIsOffsetInAnchor);
}
selectionAfterUndo.setWithoutValidation(startingSelection().start(), extent);
}
break;
}
case VisibleSelection::NoSelection:
ASSERT_NOT_REACHED();
break;
}
ASSERT(!selectionToDelete.isNone());
if (selectionToDelete.isNone())
return;
if (selectionToDelete.isCaret() || !document()->frame()->selection()->shouldDeleteSelection(selectionToDelete))
return;
if (killRing)
document()->frame()->editor()->addToKillRing(selectionToDelete.toNormalizedRange().get(), false);
// make undo select what was deleted
setStartingSelection(selectionAfterUndo);
CompositeEditCommand::deleteSelection(selectionToDelete, m_smartDelete);
setSmartDelete(false);
typingAddedToOpenCommand(ForwardDeleteKey);
}
void TypingCommand::deleteSelection(bool smartDelete)
{
CompositeEditCommand::deleteSelection(smartDelete);
typingAddedToOpenCommand(DeleteSelection);
}
void TypingCommand::updatePreservesTypingStyle(ETypingCommand commandType)
{
switch (commandType) {
case DeleteSelection:
case DeleteKey:
case ForwardDeleteKey:
case InsertParagraphSeparator:
case InsertLineBreak:
m_preservesTypingStyle = true;
return;
case InsertParagraphSeparatorInQuotedContent:
case InsertText:
m_preservesTypingStyle = false;
return;
}
ASSERT_NOT_REACHED();
m_preservesTypingStyle = false;
}
bool TypingCommand::isTypingCommand() const
{
return true;
}
} // namespace WebCore
| [
"ariya.hidayat@gmail.com"
] | ariya.hidayat@gmail.com |
f56723647e441ef228c6eb41e837a23bb554c426 | 9d37bd005abaf9cfb69393da2cf5b0d6e35d9536 | /Smart_electric_rod.ino | f1f3ae29a2d80e26eb7ba6bc73d9ed35fc417cf9 | [] | no_license | muskanmahajan37/Arduino_learning | 7708df82e2da7147aef6d6e975858714e80ee831 | ec6a7f2d59c4800f45c63961c03b09d0362899d8 | refs/heads/master | 2022-04-02T00:04:51.201485 | 2020-01-15T03:15:06 | 2020-01-15T03:15:06 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,472 | ino |
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
int switch1 = 11;
int switch2 = 12;
int start =10;
int Rod =8;
int val=0;
int sum=0;
void setup()
{
lcd.begin();
lcd.backlight();
Serial.begin(9600);
pinMode(Rod,OUTPUT);
Serial.println("*************** Welcome to new Idea************");
lcd.print("Welcome to new Idea");
}
void loop()
{
lcd.clear();
// lcd.print("Pardeep");
// lcd.setCursor (0,1);
// lcd.print("Mandeep");
// delay(2000);
digitalWrite(Rod,LOW);
int a1 = digitalRead(switch1);
int b1 = digitalRead(switch2);
int b2 =analogRead(A0);
int b3 = analogRead(A1);
//Serial.println(b2); //0
Serial.println(b3); //
delay(500);
lcd.print("New Idea");
//Switch 1 for increment time
if(b3>1000)
{
val++;
sum = val;
Serial.println(sum);
lcd.setCursor(0,1);
lcd.print(sum);
delay(1000);
}
// Switch 2 for decrement time
else if(b3==0)
{
val--;
sum = val;
Serial.println(sum);
lcd.setCursor(0,1);
lcd.print(sum);
delay(1000);
}
// 1000->1 second
// 60,000->1 m
// 300,000->5 m
// 600,000->10 m
// 900,000->15 m
// if time is == 5 next ask for press start button
//
else if(sum == 1)
{
// press switch for start
lcd.setCursor(0,1);
lcd.print("Press ok button");
Serial.println("Press ok button");
delay(500);
int c1 = digitalRead(start);
if (c1== LOW)
{
lcd.setCursor (0,1);
lcd.print("Activate wait 1 Min..");
Serial.println("Activate wait 1 Min..");
digitalWrite(Rod,HIGH);
int del1 = 1;
delay(60000*del1);
}
}
else if(sum == 2)
{
// press switch for start
lcd.setCursor(0,1);
lcd.print("Press ok button");
Serial.println("Press ok button");
delay(500);
int c1 = digitalRead(start);
if (c1== LOW)
{
lcd.setCursor (0,1);
lcd.print("Activate wait 2 Min..");
Serial.println("Activate wait 2 Min..");
digitalWrite(Rod,HIGH);
int del2 = 2;
delay(60000*del2);
}
}
else if(sum == 3)
{
// press switch for start
lcd.setCursor(0,1);
lcd.print("Press ok button");
Serial.println("Press ok button");
delay(500);
int c1 = digitalRead(start);
if (c1== LOW)
{
lcd.setCursor (0,1);
lcd.print("Activate wait 3 Min..");
Serial.println("Activate wait 3 Min..");
digitalWrite(Rod,HIGH);
int del3 = 3;
delay(60000*del3);
}
}
else if(sum == 4)
{
// press switch for start
lcd.setCursor(0,1);
lcd.print("Press ok button");
Serial.println("Press ok button");
delay(500);
int c1 = digitalRead(start);
if (c1== LOW)
{
lcd.setCursor (0,1);
lcd.print("Activate wait 4 Min..");
Serial.println("Activate wait 4 Min..");
digitalWrite(Rod,HIGH);
int del4 = 4;
delay(60000*del4);
}
}
else if(sum == 5)
{
// press switch for start
lcd.setCursor(0,1);
lcd.print("Press ok button");
Serial.println("Press ok button");
delay(500);
int c1 = digitalRead(start);
if (c1== LOW)
{
lcd.setCursor (0,1);
lcd.print("Activate wait 5 Min..");
Serial.println("Activate wait 5 Min..");
digitalWrite(Rod,HIGH);
int del5 = 5;
delay(60000*del5);
}
}
else if(sum == 6)
{
// press switch for start
lcd.setCursor(0,1);
lcd.print("Press ok button");
Serial.println("Press ok button");
delay(500);
int c1 = digitalRead(start);
if (c1== LOW)
{
lcd.setCursor (0,1);
lcd.print("Activate wait 6 Min..");
Serial.println("Activate wait 6 Min..");
digitalWrite(Rod,HIGH);
int del6 = 6;
delay(60000*del6);
}
}
else if(sum == 7)
{
// press switch for start
lcd.setCursor(0,1);
lcd.print("Press ok button");
Serial.println("Press ok button");
delay(500);
int c1 = digitalRead(start);
if (c1== LOW)
{
lcd.setCursor (0,1);
lcd.print("Activate wait 7 Min..");
Serial.println("Activate wait 7 Min..");
digitalWrite(Rod,HIGH);
int del7 = 7;
delay(60000*del7);
}
}
else if(sum == 8)
{
// press switch for start
lcd.setCursor(0,1);
lcd.print("Press ok button");
Serial.println("Press ok button");
delay(500);
int c1 = digitalRead(start);
if (c1== LOW)
{
lcd.setCursor (0,1);
lcd.print("Activate wait 8 Min..");
Serial.println("Activate wait 8 Min..");
digitalWrite(Rod,HIGH);
int del8 = 8;
delay(60000*del8);
}
}
else if(sum == 9)
{
// press switch for start
lcd.setCursor(0,1);
lcd.print("Press ok button");
Serial.println("Press ok button");
delay(500);
int c1 = digitalRead(start);
if (c1== LOW)
{
lcd.setCursor (0,1);
lcd.print("Activate wait 9 Min..");
Serial.println("Activate wait 9 Min..");
digitalWrite(Rod,HIGH);
int del9 = 9;
delay(60000*del9);
}
}
else if(sum == 1)
{
// press switch for start
lcd.setCursor(0,1);
lcd.print("Press ok button");
Serial.println("Press ok button");
delay(500);
int c1 = digitalRead(start);
if (c1== LOW)
{
lcd.setCursor (0,1);
lcd.print("Activate wait 10 Min..");
Serial.println("Activate wait 10 Min..");
digitalWrite(Rod,HIGH);
int del10 = 10;
delay(60000*del10);
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
24c8e33840086fafb6be2a06dbf7bf22ff044732 | 89cc0ce7a08079a1e0ee111a7424ad591b59345b | /src/libzerocoin/Params.cpp | b88c7e249455b1bdcfaee07e381c4e790c5bfdd7 | [
"MIT"
] | permissive | niko117/new-pos | 031d78435369a2b02d3ff29c03a0f908f7b1df2b | 764f53966b6df5bc497e0284fa8afed4ad94565a | refs/heads/master | 2020-04-01T19:33:39.636987 | 2018-10-23T14:23:22 | 2018-10-23T14:23:22 | 153,560,130 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,442 | cpp | /**
* @file Params.cpp
*
* @brief Parameter class for Zerocoin.
*
* @author Ian Miers, Christina Garman and Matthew Green
* @date June 2013
*
* @copyright Copyright 2013 Ian Miers, Christina Garman and Matthew Green
* @license This project is released under the MIT license.
**/
// Copyright (c) 2015-2017 The PIVX developers
// Copyright (c) 2017-2018 The NXBoost & Bitfineon developers
#include "Params.h"
#include "ParamGeneration.h"
namespace libzerocoin {
ZerocoinParams::ZerocoinParams(CBigNum N, uint32_t securityLevel) {
this->zkp_hash_len = securityLevel;
this->zkp_iterations = securityLevel;
this->accumulatorParams.k_prime = ACCPROOF_KPRIME;
this->accumulatorParams.k_dprime = ACCPROOF_KDPRIME;
// Generate the parameters
CalculateParams(*this, N, ZEROCOIN_PROTOCOL_VERSION, securityLevel);
this->accumulatorParams.initialized = true;
this->initialized = true;
}
AccumulatorAndProofParams::AccumulatorAndProofParams() {
this->initialized = false;
}
IntegerGroupParams::IntegerGroupParams() {
this->initialized = false;
}
CBigNum IntegerGroupParams::randomElement() const {
// The generator of the group raised
// to a random number less than the order of the group
// provides us with a uniformly distributed random number.
return this->g.pow_mod(CBigNum::randBignum(this->groupOrder),this->modulus);
}
} /* namespace libzerocoin */
| [
"support@zeboost.com"
] | support@zeboost.com |
1adb3c5b9f937b48966d3ee03108f0a9585f551f | 5fc5955fc122f5fec54ca61e0b74d95a24842bf0 | /2014/Summer1/Conditionals/Register/Register.cpp | 7334556df2491f48cb7b5e3a74d505363bf354be | [] | no_license | jannunzi/CS1500 | 7ed14c46179c519a854389ee929f802abdbc747f | 46eddc4ce5d5f23413eced02c62f58a07cf3a9eb | refs/heads/master | 2020-06-01T09:22:01.025380 | 2015-06-24T12:54:51 | 2015-06-24T12:54:51 | 14,442,407 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 551 | cpp | #include <iostream> // for cout, cin, endl
#include <string> // for string datatype
#include <conio.h> // for getch()
using namespace std;// for std::
void main() {
string username;
string password1;
string password2;
string choice;
cout << "Username: ";
cin >> username;
do {
cout << "Password: ";
cin >> password1;
cout << "Verify password: ";
cin >> password2;
if (password1 != password2) {
cout << "Passwords must match." << endl;
}
} while (password1 != password2);
cout << "Registration complete" << endl;
getch();
}
| [
"jannunzi@gmail.com"
] | jannunzi@gmail.com |
e9f7c2b9fb0ccce448af92195c0d80c431281d92 | c9f6a1d35a6879fb3cd18b57a6b89d2fd5d316d6 | /src/include/common/macros.h | f57ccaf538cf82fe393628129ac58c76fc51bfbb | [
"MIT"
] | permissive | kevinjzhang/bustub | 1b1c446a40841263d6c93ab0642ae104818f4edd | 4e1ac2fa482054ec4e9d90580067a06df0fada31 | refs/heads/master | 2020-11-24T02:56:11.917553 | 2020-01-31T12:45:07 | 2020-01-31T12:45:07 | 227,935,446 | 0 | 0 | MIT | 2019-12-13T22:56:20 | 2019-12-13T22:56:19 | null | UTF-8 | C++ | false | false | 1,086 | h | //===----------------------------------------------------------------------===//
//
// BusTub
//
// macros.h
//
// Identification: src/include/common/macros.h
//
// Copyright (c) 2015-2019, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//
#pragma once
#include <cassert>
#include <stdexcept>
namespace bustub {
#define BUSTUB_ASSERT(expr, message) assert((expr) && (message))
#define UNREACHABLE(message) throw std::logic_error(message)
// Macros to disable copying and moving
#define DISALLOW_COPY(cname) \
cname(const cname &) = delete; /* NOLINT */ \
cname &operator=(const cname &) = delete; /* NOLINT */
#define DISALLOW_MOVE(cname) \
cname(cname &&) = delete; /* NOLINT */ \
cname &operator=(cname &&) = delete; /* NOLINT */
#define DISALLOW_COPY_AND_MOVE(cname) \
DISALLOW_COPY(cname); \
DISALLOW_MOVE(cname);
} // namespace bustub
| [
"root@DESKTOP-P2AL5JC.localdomain"
] | root@DESKTOP-P2AL5JC.localdomain |
0ac0d30d0bc8e801f82568a0372f90b2801ab099 | 0ddd402852fa0b41b82c1d774ae1037163e295b5 | /DP/lcs.cpp | 7639b7ea14a02ac3a51307e7717a5da80d5f5d7a | [] | no_license | kanvkumar/Cormen | 4c18b8825a07483a296f6b147c15792b2fc7aab7 | 97b413fdcd314a47e3d9865b964541506799c67a | refs/heads/master | 2020-05-27T22:23:45.266923 | 2015-03-30T16:49:27 | 2015-03-30T16:49:27 | 32,121,801 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,991 | cpp | //Kanv Kumar
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define CLR(a) a.clear()
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)
#define TR(v,it) for( LET(it,v.begin()) ; it != v.end() ; it++)//vector Traversal
#define FORi(i,a,b) for(LET(i,a) ; i<b; i++)
#define repi(i,n) for(int i=0; i<(int)n;i++)
#define si(n) scanf("%d",&n)
#define sii(n,m) scanf("%d%d",&n,&m)
#define ss(x) scanf("%s",x)
#define sll(n) scanf("%lld",&n)
#define pi(n) printf("%d",n)
#define piw(n) printf("%d ",n)// white space
#define pin(n) printf("%d\n",n)// newline
#define sortv(a) sort(a.begin(),a.end())// vector sort
#define all(a) a.begin(),a.end()
#define DRT() int t; cin>>t; while(t--)
#define DRI(n) int n; cin>>n;
#define DRII(n,m) int n,m; cin>>n>>m;
#define TRACE
using namespace std;
//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
#ifdef TRACE
#define trace1(x) cerr << #x << ": " << x << endl;
#define trace2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z) cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
#else
#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)
#endif
typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector< PII > VPII;
typedef vector< pair< int , PII > > VPIII;
int main()
{
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
//cout.tie(NULL);
//int k,t;
//cin>>t;
//for(k=1;k<=t;k++)
//{
int n,m,c[1002][1002],i,j;
int x[1002],y[1002];
cin>>n>>m;
for(i=0;i<n;i++)
cin>>x[i];
for(i=0;i<m;i++)
cin>>y[i];
for(i=0;i<=n;i++)
{
for(j=0;j<=m;j++)
{
if(i==0 || j==0)
c[i][j]=0;
else if(x[i-1]==y[j-1])
c[i][j]=c[i-1][j-1]+1;//added to lcs
else
c[i][j]=max(c[i-1][j],c[i][j-1]);
}
}
//cout<<"Case "<<k<<": "<<min(n,m)+max(n,m)-c[n][m]<<endl;
//}
//cout<<c[n][m]<<endl;
int len=c[n][m];
int lcs[len],temp;
i=n;
j=m;
temp=len;
while(i>0&&j>0)
{
if(x[i-1]==y[j-1])
{
lcs[len-1]=x[i-1];
i--;
j--;
len--;
}
else if(c[i-1][j]>c[i][j-1])
{
i--;
}
else //if(c[i][j-1]>c[i-1][j])
{
j--;
}
}
for(i=0;i<temp;i++)
cout<<lcs[i]<<" ";
cout<<endl;
return 0;
}
| [
"kanv.k13@gmail.com"
] | kanv.k13@gmail.com |
c206fe314cccd4e27a37676630002aef99f0e369 | 6516c21b81957cc60d0ff35aa213419c56e28046 | /C++语言程序设计 郑莉 第四版(课件、课后答案、例题源代码)/C++语言程序设计案例的源代码和目录/10852C++案例教程源代码/case03/3_30.cpp | 0dad9e2b7904fef5fdb59f509ce7c0d780b45666 | [] | no_license | zhushiqi123/ios- | 72c47044f54be33c47f3f596fa602912f6152a57 | 8e2b8ee47273e0886ae5df6c30acc2a1d140d4e4 | refs/heads/master | 2020-07-04T13:00:11.365860 | 2019-10-15T02:52:01 | 2019-10-15T02:52:01 | 202,292,015 | 1 | 0 | null | null | null | null | GB18030 | C++ | false | false | 301 | cpp | #include <iostream >
#include <ctime >
#include <conio.h>
using namespace std;
void main(void)
{ time_t start,end;
start = time(NULL);
cout << "请按Enter键!\n";
for (;;) { if (getch()=='\r') break; }
end = time(NULL);
cout << "按键前后相差:"<<difftime(end,start)<<" 秒";
}
| [
"18710943589@163.com"
] | 18710943589@163.com |
9644edd5d41437bc3785ef80e67f5f5604c9b331 | ba6c276381769ced3767b56b76b75a84802a981a | /two.cpp | 3524f73d3eca210d2232e23a5344060a12e8900a | [] | no_license | zihuzi/auto-print | 542e27471194f2769518c5ec56474a77ef445e74 | 84ecce41c867a2d900a40de2f0b72c0ac433ff2a | refs/heads/main | 2023-08-29T03:19:24.969761 | 2021-10-22T11:02:12 | 2021-10-22T11:02:12 | 401,828,461 | 0 | 0 | null | 2021-09-19T07:42:43 | 2021-08-31T20:00:07 | C | UTF-8 | C++ | false | false | 208 | cpp | #include <iostream.h>
void main()
{
char ch; //声明字符型变量
ch='a';
int i; //声明整型变量并赋初值
i=(int)ch;
cout<<ch<<endl; //输出
cout<<i<<endl;
}
| [
"noreply@github.com"
] | noreply@github.com |
f4bccfc7149cd343bd69ead44590ffaf434c7610 | 9256bbaad9fb490f50578c0c3ed0905c5f159f39 | /typed_python/PyCompositeTypeInstance.cpp | 2103086f1dc4cb9c284ac24a8c603d20e84a458c | [
"Apache-2.0"
] | permissive | npang1/nativepython | 97c13ad0892ce0bec83bcd363f7b4ecc973b4afc | df311a5614a9660c15a8183b2dc606ff3e4600df | refs/heads/dev | 2020-04-22T05:57:41.084036 | 2019-02-11T15:59:15 | 2019-02-11T15:59:15 | 170,173,499 | 0 | 0 | Apache-2.0 | 2019-02-11T17:44:55 | 2019-02-11T17:44:46 | Python | UTF-8 | C++ | false | false | 5,510 | cpp | #include "PyCompositeTypeInstance.hpp"
CompositeType* PyCompositeTypeInstance::type() {
return (CompositeType*)extractTypeFrom(((PyObject*)this)->ob_type);
}
Tuple* PyTupleInstance::type() {
return (Tuple*)extractTypeFrom(((PyObject*)this)->ob_type);
}
NamedTuple* PyNamedTupleInstance::type() {
return (NamedTuple*)extractTypeFrom(((PyObject*)this)->ob_type);
}
PyObject* PyCompositeTypeInstance::sq_item_concrete(Py_ssize_t ix) {
if (ix < 0 || ix >= (int64_t)type()->getTypes().size()) {
PyErr_SetString(PyExc_IndexError, "index out of range");
return NULL;
}
Type* eltType = type()->getTypes()[ix];
return extractPythonObject(type()->eltPtr(dataPtr(), ix), eltType);
}
Py_ssize_t PyCompositeTypeInstance::mp_and_sq_length_concrete() {
return type()->getTypes().size();
}
void PyNamedTupleInstance::copyConstructFromPythonInstanceConcrete(NamedTuple* namedTupleT, instance_ptr tgt, PyObject* pyRepresentation, bool isExplicit) {
if (PyDict_Check(pyRepresentation)) {
if (namedTupleT->getTypes().size() < PyDict_Size(pyRepresentation)) {
throw std::runtime_error("Couldn't initialize type of " + namedTupleT->name() + " because supplied dictionary had too many items");
}
long actuallyUsed = 0;
namedTupleT->constructor(tgt,
[&](uint8_t* eltPtr, int64_t k) {
const std::string& name = namedTupleT->getNames()[k];
Type* t = namedTupleT->getTypes()[k];
PyObject* o = PyDict_GetItemString(pyRepresentation, name.c_str());
if (o) {
copyConstructFromPythonInstance(t, eltPtr, o);
actuallyUsed++;
}
else if (namedTupleT->is_default_constructible()) {
t->constructor(eltPtr);
} else {
throw std::logic_error("Can't default initialize argument " + name);
}
});
if (actuallyUsed != PyDict_Size(pyRepresentation)) {
throw std::runtime_error("Couldn't initialize type of " + namedTupleT->name() + " because supplied dictionary had unused arguments");
}
return;
}
PyInstance::copyConstructFromPythonInstanceConcrete(namedTupleT, tgt, pyRepresentation, isExplicit);
}
void PyNamedTupleInstance::constructFromPythonArgumentsConcrete(NamedTuple* namedTupleT, uint8_t* data, PyObject* args, PyObject* kwargs) {
long actuallyUsed = 0;
if (kwargs) {
namedTupleT->constructor(
data,
[&](uint8_t* eltPtr, int64_t k) {
Type* eltType = namedTupleT->getTypes()[k];
PyObject* o = PyDict_GetItemString(kwargs, namedTupleT->getNames()[k].c_str());
if (o) {
copyConstructFromPythonInstance(eltType, eltPtr, o);
actuallyUsed++;
}
else if (eltType->is_default_constructible()) {
eltType->constructor(eltPtr);
} else {
throw std::logic_error("Can't default initialize argument " + namedTupleT->getNames()[k]);
}
});
if (actuallyUsed != PyDict_Size(kwargs)) {
namedTupleT->destroy(data);
throw std::runtime_error("Couldn't initialize type of " + namedTupleT->name() + " because supplied dictionary had unused arguments");
}
return;
}
return PyInstance::constructFromPythonArgumentsConcrete(namedTupleT, data, args, kwargs);
}
PyObject* PyNamedTupleInstance::tp_getattr_concrete(PyObject* pyAttrName, const char* attrName) {
//see if its a member of our held type
int ix = type()->indexOfName(attrName);
if (ix >= 0) {
return extractPythonObject(
type()->eltPtr(dataPtr(), ix),
type()->getTypes()[ix]
);
}
return PyInstance::tp_getattr_concrete(pyAttrName, attrName);
}
void PyTupleInstance::mirrorTypeInformationIntoPyTypeConcrete(Tuple* tupleT, PyTypeObject* pyType) {
PyObject* res = PyTuple_New(tupleT->getTypes().size());
for (long k = 0; k < tupleT->getTypes().size(); k++) {
PyTuple_SetItem(res, k, incref(typePtrToPyTypeRepresentation(tupleT->getTypes()[k])));
}
//expose 'ElementType' as a member of the type object
PyDict_SetItemString(pyType->tp_dict, "ElementTypes", res);
}
void PyNamedTupleInstance::mirrorTypeInformationIntoPyTypeConcrete(NamedTuple* tupleT, PyTypeObject* pyType) {
PyObjectStealer types(PyTuple_New(tupleT->getTypes().size()));
for (long k = 0; k < tupleT->getTypes().size(); k++) {
PyTuple_SetItem(types, k, incref(typePtrToPyTypeRepresentation(tupleT->getTypes()[k])));
}
PyObjectStealer names(PyTuple_New(tupleT->getNames().size()));
for (long k = 0; k < tupleT->getNames().size(); k++) {
PyObject* namePtr = PyUnicode_FromString(tupleT->getNames()[k].c_str());
PyTuple_SetItem(names, k, namePtr);
}
//expose 'ElementType' as a member of the type object
PyDict_SetItemString(pyType->tp_dict, "ElementTypes", types);
PyDict_SetItemString(pyType->tp_dict, "ElementNames", names);
}
int PyNamedTupleInstance::tp_setattr_concrete(PyObject* attrName, PyObject* attrVal) {
PyErr_Format(
PyExc_AttributeError,
"Cannot set attributes on instance of type '%s' because it is immutable",
type()->name().c_str()
);
return -1;
} | [
"braxton@aprioriinvestments.com"
] | braxton@aprioriinvestments.com |
4e89af971a00dac1670ebfe62cb6243da317720f | 26f007f08ea7d0e6d53b0a2146590f7ed6ac3e84 | /project/armsim_QT/loader.h | 124cb169164b40162a25e1a788d552eb43ab3336 | [] | no_license | AbrahamSteenhoek/ARMv5-Simulator | eb4736ec53ed7610c9982b6564f39c9f31b910e2 | 95ff47d46b7899ebcb91970c9ab3328d97d51579 | refs/heads/master | 2020-04-06T17:40:44.173710 | 2018-11-15T07:24:42 | 2018-11-15T07:24:42 | 157,669,025 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,388 | h | /*----------------------------------------------------------------------------/
* Abraham Steenhoek | class: CPS310 | login: astee529 | BJUID: 160520
*
* loader.h
* - contains the declarations of all methods for the Loader class
* --------------------------------------------------------------------------*/
#include "memory.h"
#include <cmath>
#include <cstring>
#include <algorithm>
#include "elf.h"
#include "stdio.h"
#include "computer.h"
#include <cstdio>
#ifndef LOADER_H
#define LOADER_H
/*----------------------------------------------------------------------------/
* Class: Loader
* - Loads a given file in ELF format into an instance of simulated RAM
* - Displays logging messages during the loading process
* --------------------------------------------------------------------------*/
class Loader
{
// name of the ELF file
QString filename;
// instance of the simulated RAM
//Memory *ram;
// indicates completed loading process
bool success;
// reference to the CPU to set PC to program entry point
CPU *cpu;
public:
Loader(QString _filename, CPU *cpu);
void load_elf_file();
void load_elf_segment(FILE *elf_file, Elf32_Phdr &progHeader, Memory *ram);
bool isElf(Elf32_Ehdr elfHeader);
bool loaded() { return success; }
void logMessage(QString class_method, QString status);
};
#endif // LOADER_H
| [
"astee529@students.bju.edu"
] | astee529@students.bju.edu |
f0ff2a68e772fee61dc63a3cd6a21066e73e33de | 63c10f9398c7b6cb8159618bffc39ff0a4ec6197 | /arduino/src/request.h | 4b521fe7e7a9841c7369c81b59bf48ed23ef6ff3 | [
"MIT"
] | permissive | ComputerScienceHouse/EventLCD | 50dee61b49a1784d90548a3b6ef57626cce5a0cb | e033be6e8a3041f55047cae5d51a1e9e94a1213a | refs/heads/master | 2021-06-13T12:07:32.455199 | 2017-01-20T10:30:19 | 2017-01-20T10:30:19 | 51,719,842 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,541 | h | /* HTTP Request object. */
#ifndef _REQUEST_H
#define _REQUEST_H
#include <Arduino.h>
#include <Ethernet.h>
#include <inttypes.h>
// Possible request states
typedef enum {
STATE_DISCONNECTED,
STATE_CONNECTING,
STATE_CONNECTED,
STATE_FAILED,
STATE_SUCCESS,
} RequestState;
// HTTP response codes
typedef enum {
HTTP_OK = 200,
HTTP_BAD_REQUEST = 400,
HTTP_FORBIDDEN = 403,
HTTP_NOT_FOUND = 404,
HTTP_INTERNAL_ERROR = 500,
HTTP_NOT_IMPLEMENTED = 501,
HTTP_BAD_GATEWAY = 502,
HTTP_SERVICE_UNAVAILABLE = 503,
HTTP_TIMEOUT = 504,
} HTTPResponseCode;
const uint16_t default_port = 80;
const uint16_t buffer_length = 500;
class Request {
public:
void setup(const char *host, const char *path, uint16_t port);
/* Runs next step in connection process.
Returns true if it should be called again. */
bool step();
bool connected();
bool failed();
RequestState getState();
const char *getData();
const char *getStatusString();
const char *getErrorMessage();
const char *getResponseStatus();
private:
/* Returns true if connection was successful and should proceed. */
bool connect();
/* Sends a GET request. */
void get();
bool downloadResponse();
EthernetClient client;
char buffer[buffer_length];
uint16_t buffer_next;
uint16_t http_status;
uint16_t newline_seq;
bool capturing_body;
const char *host;
uint16_t port;
const char *path;
RequestState state;
char *error_message;
};
#endif
| [
"gottlieb.drew@gmail.com"
] | gottlieb.drew@gmail.com |
9ce516a818ddacab06a918f86b4f6c630821493d | bc1c43d7ebb8fbb23d022f1554e1639285f276b2 | /osl/full/osl/game_playing/winCountTracer.cc | 4962bb0a38f2ce047a33ebcd7efff1134c32d2e8 | [] | no_license | ai5/gpsfish | d1eafdece0c7c203c32603892ff9263a8fbcba59 | b6ed91f77478fdb51b8747e2fcd78042d79271d5 | refs/heads/master | 2020-12-24T06:54:11.062234 | 2016-07-02T20:42:10 | 2016-07-02T20:42:10 | 62,468,733 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,778 | cc | /* winCountTracer.cc
*/
#include "osl/game_playing/winCountTracer.h"
#include "osl/game_playing/openingBookTracer.h"
#include "osl/book/openingBook.h"
#include "osl/random.h"
#include <iostream>
osl::game_playing::
WinCountTracer::WinCountTracer(WinCountBook& b, int r, bool v)
: book(b), state_index(0), turn(BLACK), randomness(r), verbose(v)
{
if (randomness < 0)
randomness = 0;
}
osl::game_playing::
WinCountTracer::WinCountTracer(const WinCountTracer& copy)
: OpeningBookTracer(copy),
book(copy.book), state_index(copy.state_index), turn(copy.turn),
randomness(copy.randomness), verbose(copy.verbose),
state_stack(copy.state_stack)
{
}
osl::game_playing::OpeningBookTracer* osl::game_playing::
WinCountTracer::clone() const
{
return new WinCountTracer(*this);
}
void osl::game_playing::
WinCountTracer::update(Move move)
{
state_stack.push(state_index);
assert(move.player() == turn);
turn = alt(turn);
if (! isOutOfBook())
{
const std::vector<book::OBMove>& moves = book.moves(state_index);
for (size_t i=0; i<moves.size(); i++)
{
if(moves[i].move == move)
{
state_index = moves[i].stateIndex();
if (verbose)
std::cerr << "book: "
<< state_stack.top() << "->" << state_index << "\n";
return;
}
}
if (verbose)
std::cerr << "book: end" << "\n";
}
state_index = -1;
}
void osl::game_playing::
WinCountTracer::popMove()
{
state_index = state_stack.top();
state_stack.pop();
turn = alt(turn);
}
bool osl::game_playing::
WinCountTracer::isOutOfBook() const
{
return state_index < 0;
}
const osl::Move osl::game_playing::
WinCountTracer::selectMove() const
{
assert(randomness >= 0);
int maxWin = -1, maxIndex = -1;
std::vector<book::OBMove> moves = book.moves(state_index);
for (size_t index=0; index<moves.size(); ++index)
{
Move move=moves[index].move;
const int curIndex = moves[index].stateIndex();
const int winNum = (book.winCount(curIndex)
+ (randomness ? (time_seeded_random() % randomness) : 0));
const int loseNum = (book.loseCount(curIndex)
+ (randomness ? (time_seeded_random() % randomness) : 0));
if (verbose)
std::cerr << move << "," << winNum << "/" << loseNum << std::endl;
if (turn == BLACK)
{
if (winNum >= maxWin + randomness)
{
maxWin=winNum;
maxIndex=index;
}
}
else
{
if (loseNum >= maxWin + randomness)
{
maxWin=winNum;
maxIndex=index;
}
}
}
if (verbose)
std::cerr << std::endl;
if (maxIndex >= 0)
return moves[maxIndex].move;
return Move::INVALID();
}
/* ------------------------------------------------------------------------- */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
| [
"taibarax@gmail.com"
] | taibarax@gmail.com |
405c367f82c7adc31314d68f3c873fec7d2d5d80 | eba7632ce4c916327badae269685819768fd331b | /server/Server/GameServerLib/ScriptLuaPlayerBind.h | 1c454d87fa06180e5a7b1844a797daded60a210c | [] | no_license | xiaofengzhiyu/Creator-mmo | 0ce03922219286e34116a53e72a9021ec65dbcc1 | b0f738a9961d738fab13794460d0d5ea02f76c47 | refs/heads/master | 2022-12-07T14:18:32.566307 | 2020-08-26T15:55:21 | 2020-08-26T15:55:21 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 249 | h | #pragma once
namespace OGSLib
{
class DomainPlay;
class ScriptLuaPlayerBind
{
public:
ScriptLuaPlayerBind(void);
virtual ~ScriptLuaPlayerBind(void);
void init(lua_State* l);
void bind(lua_State* l,DomainPlay* player);
};
} | [
"drawmoon@163.com"
] | drawmoon@163.com |
0cfed3b4fd6873cf42202541e402ba88a8c46da5 | b864b992187e2e1c5c8da6fdabeeab5040058fe9 | /QT Example/QT5/QT5 Development Demo/CH13/CH1302/SQLEx/main.cpp | 261dbb08ad99f08d22ff7fdc81020dc4adf5d4d6 | [] | no_license | Mr-Phoebe/ProgramLanguage | 5384afeef20c8a12cd89cf3720beb0337bd38fc9 | 1588aea62e15304339efb73d55653be1b4e57156 | refs/heads/master | 2023-02-06T11:59:06.272680 | 2023-02-06T04:00:14 | 2023-02-06T04:00:14 | 65,252,634 | 52 | 37 | null | null | null | null | UTF-8 | C++ | false | false | 467 | cpp | #include "mainwindow.h"
#include <QApplication>
#include <QDialog>
#include <QFile>
#include "connectdlg.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
//MainWindow w;
//w.show();
ConnDlg dialog;
if (dialog.exec() != QDialog::Accepted)
return -1;
//dialog.show();
QFile *carDetails = new QFile("attribs.xml");
MainWindow window("factory", "cars", carDetails);
window.show();
return a.exec();
}
| [
"whn289467822@outlook.com"
] | whn289467822@outlook.com |
68be69f6ba4d3a9d54648c4ba15e213606e556f0 | 91a882547e393d4c4946a6c2c99186b5f72122dd | /Source/XPSP1/NT/admin/dcpromo/exe/answerfile.hpp | 04a59cc446fd36c29fb74856bd137a87092b7a45 | [] | no_license | IAmAnubhavSaini/cryptoAlgorithm-nt5src | 94f9b46f101b983954ac6e453d0cf8d02aa76fc7 | d9e1cdeec650b9d6d3ce63f9f0abe50dabfaf9e2 | refs/heads/master | 2023-09-02T10:14:14.795579 | 2021-11-20T13:47:06 | 2021-11-20T13:47:06 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 642 | hpp | // Copyright (C) 1997 Microsoft Corporation
//
// answerfile reader object
//
// 12-15-97 sburns
#ifndef ANSWER_HPP_INCLUDED
#define ANSWER_HPP_INCLUDED
class AnswerFile
{
public:
explicit
AnswerFile(const String& filename);
~AnswerFile();
bool
IsKeyPresent(
const String& section,
const String& key);
String
ReadKey(const String& section, const String& key);
EncodedString
EncodedReadKey(const String& section, const String& key);
void
WriteKey(const String& section, const String& key, const String& value);
private:
String filename;
};
#endif // ANSWER_HPP_INCLUDED
| [
"support@cryptoalgo.cf"
] | support@cryptoalgo.cf |
cb1157f5364db6a59c7b6590672223554c2dc979 | ea7d2e4e43ae26a6b3d3b79f8ed66ee3e708acc4 | /RL/random.cpp | 439e836dafe2ee659eb52d1b556e39568f7e1483 | [] | no_license | chrisdepas/Simple-RogueLike | 54c0b2393b2e1f96941b11a49a36959a1962f140 | 6f22c063552ef720a7bc61b46f333b9d637de847 | refs/heads/master | 2020-03-13T18:36:38.251017 | 2018-04-27T07:06:57 | 2018-04-27T07:06:57 | 131,238,335 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,997 | cpp | #include "stdafx.h"
#include "random.h"
#include <ctime>
CRandom::CRandom()
{
}
void CRandom::Init( int Seed1, int Seed2 )
{
}
void CRandom::Init()
{
/* this is probably bad */
m_iSeed1 = (int) time( NULL );
srand( m_iSeed1 + 2 );
m_iSeed2 = rand();
m_iNoiseSeed1 = m_iSeed1;
m_iNoiseSeed2 = m_iSeed2;
}
unsigned int CRandom::NextRandomNumber()
{
m_iSeed1 = 36969 * (m_iSeed1 & 65535) + (m_iSeed1 >> 16);
m_iSeed2 = 18000 * (m_iSeed2 & 65535) + (m_iSeed2 >> 16);
return (m_iSeed1 << 16) + m_iSeed2;
}
float CRandom::RandFloat()
{
return (float)NextRandomNumber() / 0xFFFFFFFF;
}
float CRandom::RandFloat( float Min, float Max )
{
float randfloat1 = (float)NextRandomNumber() / 0xFFFFFFFF;
float randfloat2 = (float)NextRandomNumber() / 0xFFFFFFFF;
return ( Min + (Max - Min) * randfloat1 + randfloat2 );
}
int CRandom::RandInt( int Min, int Max )
{
float randfloat = (float)NextRandomNumber() / 0xFFFFFFFF;
return (int)( (float)Min + (Max - Min) * randfloat + 0.5f );
}
float CRandom::Noise( int iX, int iY )
{
iX += 7*m_iNoiseSeed1;
iY -= 17*m_iNoiseSeed2;
int n=(int)iX+(int)iY*57;
n=(n<<13)^n;
int nn=(n*(n*n*60493+19990303)+1376312589)&0x7fffffff;
return (float)(1.0-((double)nn/1073741824.0));
/*
int Input = ( (iY+m_iNoiseSeed1) * 15731 + ((iX+m_iNoiseSeed2) << 16) ) + m_iNoiseSeed1*m_iNoiseSeed2;
Input = (Input <<13) ^ Input;
return ( 1.0f - ( (Input * (Input * Input * 789221 + 15731) + 6871) & 0x7fffffff) / 1073741824.0f);*/
}
float CRandom::SmoothNoise(int iX, int iY)
{
float fAvgCorners = ( Noise(iX-1, iY-1) + Noise(iX+1, iY-1) + Noise(iX-1, iY+1) + Noise(iX+1, iY+1) ) / 16; //4/16 = 1/4
float fAvgSides = ( Noise(iX-1, iY) + Noise(iX+1, iY) + Noise(iX, iY-1) + Noise(iX, iY+1) ) / 8; //4/8 = 1/2 (Up to 3/4 now)
float fCentre = Noise(iX, iY) / 4; // Last 1/4 of noise
return ( fAvgCorners + fAvgSides + fCentre );
}
float CRandom::Interpolate( float fA, float fB, float fMu )
{
float rot = fMu * 3.1415927f;
float f = (1 - cos(rot)) * 0.5f;
return fA*(1-f) + fB*f;
}
float CRandom::InterpolatedNoise( float fX, float fY )
{
int iX = (int)fX;
float fFractionX = fX - (float)iX;
int iY = (int)fY;
float fFractionY = fY - (float)iY;
float fNoiseX1 = SmoothNoise( iX, iY );
float fNoiseX2 = SmoothNoise( iX+1, iY );
float fXNoise = Interpolate( fNoiseX1, fNoiseX2, fFractionX );
float fNoiseY1 = SmoothNoise( iX, iY+1 );
float fNoiseY2 = SmoothNoise( iX+1, iY+1 );
float fYNoise = Interpolate( fNoiseY1, fNoiseY2, fFractionX );
return Interpolate( fXNoise, fYNoise, fFractionY ) + 0.5f;
}
float CRandom::PerlinNoise( float fX, float fY, int iOctaves, float fPersistance )
{
float perlinvalue = 0.0f;
for ( int i = 0; i < iOctaves; i++ )
{
float freq = pow( 2.0f, i );
float amplitude = pow( fPersistance, i );
perlinvalue += InterpolatedNoise( fX * freq, fY * freq ) * amplitude;
}
return perlinvalue;
}
| [
"cdep@squale.me"
] | cdep@squale.me |
82fdcdb5206f3c97e5c1cbf128366bbf52dd1ec5 | 9de17b2f81489d8a2bda3e4acecfadcf355f22fe | /node/tests/slave.cpp | 2c74ad329f74cb50f44a5f95b203935c6ec3b387 | [] | no_license | cocaine/cocaine-plugins | c804549469a5a1282bc6f12b4159831b10968fca | b7771e5a931a3d2be701755bfe7173fd46c1860e | refs/heads/master | 2020-04-12T07:26:13.530370 | 2018-01-17T08:51:45 | 2018-01-17T10:12:12 | 4,738,266 | 9 | 20 | null | 2017-07-19T17:30:23 | 2012-06-21T11:24:30 | C++ | UTF-8 | C++ | false | false | 3,031 | cpp | #include <asio/io_service.hpp>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
// node -> [app]
// app -> state
// state -> thread + loop. on stop -> work.reset + timer(loop.stop) +
// thread.join.
// state -> overseer.
// overseer -> [slave]
// slave -> state_machine
// state_machine -> overseer.
// all secondary operations must be performed in a loop thread.
namespace cocaine {
namespace detail {
namespace service {
namespace node {
namespace io {
using asio::io_service;
} // namespace io
template <class Overseer>
class state_machine {
public:
typedef Overseer overseer_type;
private:
std::shared_ptr<overseer_type> overseer;
std::error_code shutdown_reason;
public:
explicit state_machine(std::shared_ptr<overseer_type> overseer)
: overseer(std::move(overseer)) {}
~state_machine() {
const auto uuid = "";
const auto on_death =
std::bind(&overseer_type::notify_death, overseer, uuid, shutdown_reason);
overseer->get_io_service().post(std::move(on_death));
}
};
template <class Manifest, class Profile, class Overseer>
class slave {
public:
typedef Manifest manifest_type;
typedef Profile profile_type;
typedef Overseer overseer_type;
private:
typedef state_machine<Overseer> machine_t;
private:
std::shared_ptr<machine_t> d;
public:
/// Constructs the slave.
slave(manifest_type manifest, profile_type profile, std::shared_ptr<overseer_type> overseer)
: d(std::make_shared<machine_t>(std::move(overseer))) {}
~slave() {}
};
} // namespace node
} // namespace service
} // namespace detail
} // namespace cocaine
namespace io {
using asio::io_service;
} // namespace io
namespace testing {
namespace mock {
struct manifest_t {};
struct profile_t {};
struct overseer_t {
MOCK_METHOD0(get_io_service, io::io_service&());
MOCK_METHOD2(notify_death, void(const std::string&, const std::error_code&));
};
} // namespace mock
} // namespace testing
namespace testing {
typedef cocaine::detail::service::node::slave<mock::manifest_t, mock::profile_t, mock::overseer_t>
slave_t;
TEST(slave, constructor) {
mock::manifest_t manifest;
mock::profile_t profile;
auto overseer = std::make_shared<mock::overseer_t>();
io::io_service io;
EXPECT_CALL(*overseer, get_io_service()).Times(1).WillOnce(ReturnRef(io));
slave_t slave(std::move(manifest), std::move(profile), overseer);
}
TEST(slave, notifies_on_death) {
mock::manifest_t manifest;
mock::profile_t profile;
auto overseer = std::make_shared<mock::overseer_t>();
io::io_service io;
std::unique_ptr<slave_t> slave(new slave_t(std::move(manifest), std::move(profile), overseer));
EXPECT_CALL(*overseer, get_io_service()).Times(1).WillOnce(ReturnRef(io));
EXPECT_CALL(*overseer, notify_death(_, std::error_code())).Times(1);
// Slave will post its completion handler during state machine destruction.
slave.reset();
io.run();
}
} // namespace testing
| [
"division494@gmail.com"
] | division494@gmail.com |
8e1d84471eb64ab0633bb2d1ccdef90c96061a11 | 564fc933ff14bce0641e6ddd6175b5a7a276d162 | /test/src/perf/conv_dbn_mp.cpp | 63e816801ade647c4cb9e7eb1c7ef76b7a5b63fb | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | DiGiDeoni/dll | 4dc9509318415d9f8691717a67ad44d2b1ec4b5a | ee547753b461d235dbf62bdd1e92ae34dec85a33 | refs/heads/master | 2021-01-20T01:36:05.923690 | 2017-04-21T13:03:16 | 2017-04-21T13:03:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,100 | cpp | //=======================================================================
// Copyright (c) 2014-2016 Baptiste Wicht
// Distributed under the terms of the MIT License.
// (See accompanying file LICENSE or copy at
// http://opensource.org/licenses/MIT)
//=======================================================================
#include <deque>
#include "catch.hpp"
#define DLL_SVM_SUPPORT
#include "dll/rbm/conv_rbm_mp.hpp"
#include "dll/dbn.hpp"
#include "mnist/mnist_reader.hpp"
#include "mnist/mnist_utils.hpp"
TEST_CASE("conv_dbn_mp/mnist_slow", "[cdbn][slow][benchmark]") {
typedef dll::dbn_desc<
dll::dbn_layers<
dll::conv_rbm_mp_desc_square<1, 28, 40, 13, 2, dll::momentum, dll::batch_size<25>>::layer_t,
dll::conv_rbm_mp_desc_square<40, 8, 40, 5, 2, dll::momentum, dll::batch_size<25>>::layer_t>>::dbn_t dbn_t;
auto dataset = mnist::read_dataset_direct<std::vector, etl::fast_dyn_matrix<double, 1, 28, 28>>(250);
mnist::binarize_dataset(dataset);
auto dbn = std::make_unique<dbn_t>();
dbn->pretrain(dataset.training_images, 20);
}
| [
"baptiste.wicht@gmail.com"
] | baptiste.wicht@gmail.com |
09763c79fe3525d2cd5795c5b44032c18ee0a76b | 4f267de5c3abde3eaf3a7b89d71cd10d3abad87c | /ThirdParty/Libigl/igl/copyleft/tetgen/mesh_with_skeleton.cpp | 5c920b36d40f30659a9d1d020e02447c60fd0334 | [
"GPL-1.0-or-later",
"MPL-2.0",
"MIT"
] | permissive | MeshGeometry/IogramSource | 5f627ca3102e85cd4f16801f5ee67557605eb506 | a82302ccf96177dde3358456c6dc8e597c30509c | refs/heads/master | 2022-02-10T19:19:18.984763 | 2018-01-31T20:09:08 | 2018-01-31T20:09:08 | 83,458,576 | 29 | 17 | MIT | 2022-02-01T13:45:33 | 2017-02-28T17:07:02 | C++ | UTF-8 | C++ | false | false | 3,654 | cpp | // This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#include "mesh_with_skeleton.h"
#include "tetrahedralize.h"
#include "../../sample_edges.h"
#include "../../cat.h"
#include <iostream>
// Default settings pq2Y tell tetgen to mesh interior of triangle mesh and
// to produce a graded tet mesh
const static std::string DEFAULT_TETGEN_FLAGS = "pq2Y";
IGL_INLINE bool igl::copyleft::tetgen::mesh_with_skeleton(
const Eigen::MatrixXd & V,
const Eigen::MatrixXi & F,
const Eigen::MatrixXd & C,
const Eigen::VectorXi & /*P*/,
const Eigen::MatrixXi & BE,
const Eigen::MatrixXi & CE,
const int samples_per_bone,
const std::string & tetgen_flags,
Eigen::MatrixXd & VV,
Eigen::MatrixXi & TT,
Eigen::MatrixXi & FF)
{
using namespace Eigen;
using namespace std;
const string eff_tetgen_flags =
(tetgen_flags.length() == 0?DEFAULT_TETGEN_FLAGS:tetgen_flags);
// Collect all edges that need samples:
MatrixXi BECE = cat(1,BE,CE);
MatrixXd S;
// Sample each edge with 10 samples. (Choice of 10 doesn't seem to matter so
// much, but could under some circumstances)
sample_edges(C,BECE,samples_per_bone,S);
// Vertices we'll constrain tet mesh to meet
MatrixXd VS = cat(1,V,S);
// Use tetgen to mesh the interior of surface, this assumes surface:
// * has no holes
// * has no non-manifold edges or vertices
// * has consistent orientation
// * has no self-intersections
// * has no 0-volume pieces
cerr<<"tetgen begin()"<<endl;
int status = tetrahedralize( VS,F,eff_tetgen_flags,VV,TT,FF);
cerr<<"tetgen end()"<<endl;
if(FF.rows() != F.rows())
{
// Issue a warning if the surface has changed
cerr<<"mesh_with_skeleton: Warning: boundary faces != input faces"<<endl;
}
if(status != 0)
{
cerr<<
"***************************************************************"<<endl<<
"***************************************************************"<<endl<<
"***************************************************************"<<endl<<
"***************************************************************"<<endl<<
"* mesh_with_skeleton: tetgen failed. Just meshing convex hull *"<<endl<<
"***************************************************************"<<endl<<
"***************************************************************"<<endl<<
"***************************************************************"<<endl<<
"***************************************************************"<<endl;
// If meshing convex hull then use more regular mesh
status = tetrahedralize(VS,F,"q1.414",VV,TT,FF);
// I suppose this will fail if the skeleton is outside the mesh
assert(FF.maxCoeff() < VV.rows());
if(status != 0)
{
cerr<<"mesh_with_skeleton: tetgen failed again."<<endl;
return false;
}
}
return true;
}
IGL_INLINE bool igl::copyleft::tetgen::mesh_with_skeleton(
const Eigen::MatrixXd & V,
const Eigen::MatrixXi & F,
const Eigen::MatrixXd & C,
const Eigen::VectorXi & P,
const Eigen::MatrixXi & BE,
const Eigen::MatrixXi & CE,
const int samples_per_bone,
Eigen::MatrixXd & VV,
Eigen::MatrixXi & TT,
Eigen::MatrixXi & FF)
{
return mesh_with_skeleton(
V,F,C,P,BE,CE,samples_per_bone,DEFAULT_TETGEN_FLAGS,VV,TT,FF);
}
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
#endif
| [
"daniel@meshconsultants.ca"
] | daniel@meshconsultants.ca |
de7baa538c066249e9dafb3c9977d28b4665ebae | 274dc75c4e869c1029d62ac45543186da7d09030 | /pso/time_counter.hpp | d3a5ef93bc62566ee2024d682d50d95fb11cf207 | [] | no_license | jesterbiu/hb_executor | 41f530877c0cb875c52d29bee523188abc56abbc | 60ab90373fc3e9c7d6304d27a60c608bc224733c | refs/heads/master | 2023-03-31T13:41:15.197219 | 2021-04-01T02:52:10 | 2021-04-01T02:52:10 | 325,259,766 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 448 | hpp | #include <chrono>
#include <vector>
namespace hungbiu
{
template <typename TimeUnit = std::chrono::milliseconds>
class time_counter
{
public:
using clock_t = std::chrono::high_resolution_clock;
using duration_t = TimeUnit;
private:
clock_t::time_point start_;
public:
time_counter() :
start_(clock_t::now())
{}
TimeUnit get_time_elapsed()
{
return std::chrono::duration_cast<TimeUnit>(clock_t::now() - start_);
}
};
} | [
"jesterpure@outlook.com"
] | jesterpure@outlook.com |
4002890dd90706cc0f1cd1b6408343743ee3eb3e | 7306583460435703546b8f0d33a251356a54bd0b | /src/main.h | bc7590f31fe979457e7f5f007d877a6659694927 | [
"MIT"
] | permissive | bcsh/bitcash | 398f10ccba110b31604d4f6aea28c7bfe1b13eac | 67ee3f16957dbe1a09b7ae162aa2450000c3db79 | refs/heads/master | 2021-01-19T19:37:55.969988 | 2014-08-23T18:30:14 | 2014-08-23T18:30:14 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 45,424 | h | // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_MAIN_H
#define BITCOIN_MAIN_H
#include "bignum.h"
#include "sync.h"
#include "net.h"
#include "script.h"
#include "scrypt.h"
#include "hashblock.h"
#include <list>
class CWallet;
class CBlock;
class CBlockIndex;
class CKeyItem;
class CReserveKey;
class COutPoint;
class CAddress;
class CInv;
class CRequestTracker;
class CNode;
static const unsigned int MAX_BLOCK_SIZE = 1000000;
static const unsigned int MAX_BLOCK_SIZE_GEN = MAX_BLOCK_SIZE/2;
static const unsigned int MAX_BLOCK_SIGOPS = MAX_BLOCK_SIZE/50;
static const unsigned int MAX_ORPHAN_TRANSACTIONS = MAX_BLOCK_SIZE/100;
static const unsigned int MAX_INV_SZ = 50000;
static const int64 MIN_TX_FEE = 0.001 * CENT;
static const int64 MIN_RELAY_TX_FEE = 0 * CENT;
static const int64 MAX_MONEY = 10000000 * COIN; //
static const int64 CIRCULATION_MONEY = MAX_MONEY;
static const double TAX_PERCENTAGE = 0.00; //no tax
static const int64 MAX_CLOAK_PROOF_OF_STAKE = 0.05 * COIN; // annual interest
static const int CUTOFF_POW_BLOCK = 1055520;
static const int64 MIN_TXOUT_AMOUNT = MIN_TX_FEE;
inline bool MoneyRange(int64 nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
// Threshold for nLockTime: below this value it is interpreted as block number, otherwise as UNIX timestamp.
static const unsigned int LOCKTIME_THRESHOLD = 500000000; // Tue Nov 5 00:53:20 1985 UTC
#ifdef USE_UPNP
static const int fHaveUPnP = true;
#else
static const int fHaveUPnP = false;
#endif
static const uint256 hashGenesisBlockOfficial("0x0000024031f313ae1cf22e7fb09bc00d37f728a3a3501f67a17191c5ef423295");
static const uint256 hashGenesisBlockTestNet ("0x0000024031f313ae1cf22e7fb09bc00d37f728a3a3501f67a17191c5ef423295");
static const int64 nClockDriftSwitchHeight = 3000;
static const int64 nMaxClockDriftOrig = 2 * 60 * 60;
static const int64 nMaxClockDrift = 8 * 60; // 8 minutes // 2 * 60 * 60; // two hours
inline int64 GetMaxClockDrift(int nHeight) { return nHeight > nClockDriftSwitchHeight ? nMaxClockDrift : nMaxClockDriftOrig; }
extern CScript COINBASE_FLAGS;
extern CCriticalSection cs_main;
extern std::map<uint256, CBlockIndex*> mapBlockIndex;
extern std::set<std::pair<COutPoint, unsigned int> > setStakeSeen;
extern uint256 hashGenesisBlock;
extern CBlockIndex* pindexGenesisBlock;
extern unsigned int nStakeMinAge;
extern int nCoinbaseMaturity;
extern int nBestHeight;
extern CBigNum bnBestChainTrust;
extern CBigNum bnBestInvalidTrust;
extern uint256 hashBestChain;
extern CBlockIndex* pindexBest;
extern unsigned int nTransactionsUpdated;
extern uint64 nLastBlockTx;
extern uint64 nLastBlockSize;
extern int64 nLastCoinStakeSearchInterval;
extern const std::string strMessageMagic;
extern double dHashesPerSec;
extern int64 nHPSTimerStart;
extern int64 nTimeBestReceived;
extern CCriticalSection cs_setpwalletRegistered;
extern std::set<CWallet*> setpwalletRegistered;
extern unsigned char pchMessageStart[4];
extern std::map<uint256, CBlock*> mapOrphanBlocks;
// Settings
extern int64 nTransactionFee;
// Minimum disk space required - used in CheckDiskSpace()
static const uint64 nMinDiskSpace = 52428800;
class CReserveKey;
class CTxDB;
class CTxIndex;
void RegisterWallet(CWallet* pwalletIn);
void UnregisterWallet(CWallet* pwalletIn);
void SyncWithWallets(const CTransaction& tx, const CBlock* pblock = NULL, bool fUpdate = false, bool fConnect = true);
bool ProcessBlock(CNode* pfrom, CBlock* pblock);
bool CheckDiskSpace(uint64 nAdditionalBytes=0);
FILE* OpenBlockFile(unsigned int nFile, unsigned int nBlockPos, const char* pszMode="rb");
FILE* AppendBlockFile(unsigned int& nFileRet);
bool LoadBlockIndex(bool fAllowNew=true);
void PrintBlockTree();
CBlockIndex* FindBlockByHeight(int nHeight);
bool ProcessMessages(CNode* pfrom);
bool SendMessages(CNode* pto, bool fSendTrickle);
bool LoadExternalBlockFile(FILE* fileIn);
void GenerateBitcoins(bool fGenerate, CWallet* pwallet);
CBlock* CreateNewBlock(CWallet* pwallet, bool fProofOfStake=false);
void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& nExtraNonce);
void FormatHashBuffers(CBlock* pblock, char* pmidstate, char* pdata, char* phash1);
bool CheckWork(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey);
bool CheckProofOfWork(uint256 hash, unsigned int nBits);
int64 GetProofOfWorkReward(int nHeight, int64 nFees, uint256 prevHash);
int64 GetProofOfStakeReward(int64 nCoinAge, unsigned int nBits, unsigned int nTime, int nHeight);
unsigned int ComputeMinWork(unsigned int nBase, int64 nTime);
unsigned int ComputeMinStake(unsigned int nBase, int64 nTime, unsigned int nBlockTime);
int GetNumBlocksOfPeers();
bool IsInitialBlockDownload();
std::string GetWarnings(std::string strFor);
bool GetTransaction(const uint256 &hash, CTransaction &tx, uint256 &hashBlock);
uint256 WantedByOrphan(const CBlock* pblockOrphan);
const CBlockIndex* GetLastBlockIndex(const CBlockIndex* pindex, bool fProofOfStake);
void BitcoinMiner(CWallet *pwallet, bool fProofOfStake);
void ResendWalletTransactions();
bool GetWalletFile(CWallet* pwallet, std::string &strWalletFileOut);
/** Position on disk for a particular transaction. */
class CDiskTxPos
{
public:
unsigned int nFile;
unsigned int nBlockPos;
unsigned int nTxPos;
CDiskTxPos()
{
SetNull();
}
CDiskTxPos(unsigned int nFileIn, unsigned int nBlockPosIn, unsigned int nTxPosIn)
{
nFile = nFileIn;
nBlockPos = nBlockPosIn;
nTxPos = nTxPosIn;
}
IMPLEMENT_SERIALIZE( READWRITE(FLATDATA(*this)); )
void SetNull() { nFile = (unsigned int) -1; nBlockPos = 0; nTxPos = 0; }
bool IsNull() const { return (nFile == (unsigned int) -1); }
friend bool operator==(const CDiskTxPos& a, const CDiskTxPos& b)
{
return (a.nFile == b.nFile &&
a.nBlockPos == b.nBlockPos &&
a.nTxPos == b.nTxPos);
}
friend bool operator!=(const CDiskTxPos& a, const CDiskTxPos& b)
{
return !(a == b);
}
std::string ToString() const
{
if (IsNull())
return "null";
else
return strprintf("(nFile=%u, nBlockPos=%u, nTxPos=%u)", nFile, nBlockPos, nTxPos);
}
void print() const
{
printf("%s", ToString().c_str());
}
};
/** An inpoint - a combination of a transaction and an index n into its vin */
class CInPoint
{
public:
CTransaction* ptx;
unsigned int n;
CInPoint() { SetNull(); }
CInPoint(CTransaction* ptxIn, unsigned int nIn) { ptx = ptxIn; n = nIn; }
void SetNull() { ptx = NULL; n = (unsigned int) -1; }
bool IsNull() const { return (ptx == NULL && n == (unsigned int) -1); }
};
/** An outpoint - a combination of a transaction hash and an index n into its vout */
class COutPoint
{
public:
uint256 hash;
unsigned int n;
COutPoint() { SetNull(); }
COutPoint(uint256 hashIn, unsigned int nIn) { hash = hashIn; n = nIn; }
IMPLEMENT_SERIALIZE( READWRITE(FLATDATA(*this)); )
void SetNull() { hash = 0; n = (unsigned int) -1; }
bool IsNull() const { return (hash == 0 && n == (unsigned int) -1); }
friend bool operator<(const COutPoint& a, const COutPoint& b)
{
return (a.hash < b.hash || (a.hash == b.hash && a.n < b.n));
}
friend bool operator==(const COutPoint& a, const COutPoint& b)
{
return (a.hash == b.hash && a.n == b.n);
}
friend bool operator!=(const COutPoint& a, const COutPoint& b)
{
return !(a == b);
}
std::string ToString() const
{
return strprintf("COutPoint(%s, %u)", hash.ToString().substr(0,10).c_str(), n);
}
void print() const
{
printf("%s\n", ToString().c_str());
}
};
/** An input of a transaction. It contains the location of the previous
* transaction's output that it claims and a signature that matches the
* output's public key.
*/
class CTxIn
{
public:
COutPoint prevout;
CScript scriptSig;
unsigned int nSequence;
CTxIn()
{
nSequence = std::numeric_limits<unsigned int>::max();
}
explicit CTxIn(COutPoint prevoutIn, CScript scriptSigIn=CScript(), unsigned int nSequenceIn=std::numeric_limits<unsigned int>::max())
{
prevout = prevoutIn;
scriptSig = scriptSigIn;
nSequence = nSequenceIn;
}
CTxIn(uint256 hashPrevTx, unsigned int nOut, CScript scriptSigIn=CScript(), unsigned int nSequenceIn=std::numeric_limits<unsigned int>::max())
{
prevout = COutPoint(hashPrevTx, nOut);
scriptSig = scriptSigIn;
nSequence = nSequenceIn;
}
IMPLEMENT_SERIALIZE
(
READWRITE(prevout);
READWRITE(scriptSig);
READWRITE(nSequence);
)
bool IsFinal() const
{
return (nSequence == std::numeric_limits<unsigned int>::max());
}
friend bool operator==(const CTxIn& a, const CTxIn& b)
{
return (a.prevout == b.prevout &&
a.scriptSig == b.scriptSig &&
a.nSequence == b.nSequence);
}
friend bool operator!=(const CTxIn& a, const CTxIn& b)
{
return !(a == b);
}
std::string ToStringShort() const
{
return strprintf(" %s %d", prevout.hash.ToString().c_str(), prevout.n);
}
std::string ToString() const
{
std::string str;
str += "CTxIn(";
str += prevout.ToString();
if (prevout.IsNull())
str += strprintf(", coinbase %s", HexStr(scriptSig).c_str());
else
str += strprintf(", scriptSig=%s", scriptSig.ToString().substr(0,24).c_str());
if (nSequence != std::numeric_limits<unsigned int>::max())
str += strprintf(", nSequence=%u", nSequence);
str += ")";
return str;
}
void print() const
{
printf("%s\n", ToString().c_str());
}
};
/** An output of a transaction. It contains the public key that the next input
* must be able to sign with to claim it.
*/
class CTxOut
{
public:
int64 nValue;
CScript scriptPubKey;
CTxOut()
{
SetNull();
}
CTxOut(int64 nValueIn, CScript scriptPubKeyIn)
{
nValue = nValueIn;
scriptPubKey = scriptPubKeyIn;
}
IMPLEMENT_SERIALIZE
(
READWRITE(nValue);
READWRITE(scriptPubKey);
)
void SetNull()
{
nValue = -1;
scriptPubKey.clear();
}
bool IsNull()
{
return (nValue == -1);
}
void SetEmpty()
{
nValue = 0;
scriptPubKey.clear();
}
bool IsEmpty() const
{
return (nValue == 0 && scriptPubKey.empty());
}
uint256 GetHash() const
{
return SerializeHash(*this);
}
friend bool operator==(const CTxOut& a, const CTxOut& b)
{
return (a.nValue == b.nValue &&
a.scriptPubKey == b.scriptPubKey);
}
friend bool operator!=(const CTxOut& a, const CTxOut& b)
{
return !(a == b);
}
std::string ToStringShort() const
{
return strprintf(" out %s %s", FormatMoney(nValue).c_str(), scriptPubKey.ToString(true).c_str());
}
std::string ToString() const
{
if (IsEmpty()) return "CTxOut(empty)";
if (scriptPubKey.size() < 6)
return "CTxOut(error)";
return strprintf("CTxOut(nValue=%s, scriptPubKey=%s)", FormatMoney(nValue).c_str(), scriptPubKey.ToString().c_str());
}
void print() const
{
printf("%s\n", ToString().c_str());
}
};
enum GetMinFee_mode
{
GMF_BLOCK,
GMF_RELAY,
GMF_SEND,
};
typedef std::map<uint256, std::pair<CTxIndex, CTransaction> > MapPrevTx;
/** The basic transaction that is broadcasted on the network and contained in
* blocks. A transaction can contain multiple inputs and outputs.
*/
class CTransaction
{
public:
static const int CURRENT_VERSION=1;
int nVersion;
unsigned int nTime;
std::vector<CTxIn> vin;
std::vector<CTxOut> vout;
unsigned int nLockTime;
// Denial-of-service detection:
mutable int nDoS;
bool DoS(int nDoSIn, bool fIn) const { nDoS += nDoSIn; return fIn; }
CTransaction()
{
SetNull();
}
IMPLEMENT_SERIALIZE
(
READWRITE(this->nVersion);
nVersion = this->nVersion;
READWRITE(nTime);
READWRITE(vin);
READWRITE(vout);
READWRITE(nLockTime);
)
void SetNull()
{
nVersion = CTransaction::CURRENT_VERSION;
nTime = GetAdjustedTime();
vin.clear();
vout.clear();
nLockTime = 0;
nDoS = 0; // Denial-of-service prevention
}
bool IsNull() const
{
return (vin.empty() && vout.empty());
}
uint256 GetHash() const
{
return SerializeHash(*this);
}
bool IsFinal(int nBlockHeight=0, int64 nBlockTime=0) const
{
// Time based nLockTime implemented in 0.1.6
if (nLockTime == 0)
return true;
if (nBlockHeight == 0)
nBlockHeight = nBestHeight;
if (nBlockTime == 0)
nBlockTime = GetAdjustedTime();
if ((int64)nLockTime < ((int64)nLockTime < LOCKTIME_THRESHOLD ? (int64)nBlockHeight : nBlockTime))
return true;
BOOST_FOREACH(const CTxIn& txin, vin)
if (!txin.IsFinal())
return false;
return true;
}
bool IsNewerThan(const CTransaction& old) const
{
if (vin.size() != old.vin.size())
return false;
for (unsigned int i = 0; i < vin.size(); i++)
if (vin[i].prevout != old.vin[i].prevout)
return false;
bool fNewer = false;
unsigned int nLowest = std::numeric_limits<unsigned int>::max();
for (unsigned int i = 0; i < vin.size(); i++)
{
if (vin[i].nSequence != old.vin[i].nSequence)
{
if (vin[i].nSequence <= nLowest)
{
fNewer = false;
nLowest = vin[i].nSequence;
}
if (old.vin[i].nSequence < nLowest)
{
fNewer = true;
nLowest = old.vin[i].nSequence;
}
}
}
return fNewer;
}
bool IsCoinBase() const
{
return (vin.size() == 1 && vin[0].prevout.IsNull() && vout.size() >= 1);
}
bool IsCoinStake() const
{
// ppcoin: the coin stake transaction is marked with the first output empty
return (vin.size() > 0 && (!vin[0].prevout.IsNull()) && vout.size() >= 2 && vout[0].IsEmpty());
}
bool IsCoinBaseOrStake() const
{
return (IsCoinBase() || IsCoinStake());
}
/** Check for standard transaction types
@return True if all outputs (scriptPubKeys) use only standard transaction forms
*/
bool IsStandard() const;
/** Check for standard transaction types
@param[in] mapInputs Map of previous transactions that have outputs we're spending
@return True if all inputs (scriptSigs) use only standard transaction forms
@see CTransaction::FetchInputs
*/
bool AreInputsStandard(const MapPrevTx& mapInputs) const;
/** Count ECDSA signature operations the old-fashioned (pre-0.6) way
@return number of sigops this transaction's outputs will produce when spent
@see CTransaction::FetchInputs
*/
unsigned int GetLegacySigOpCount() const;
/** Count ECDSA signature operations in pay-to-script-hash inputs.
@param[in] mapInputs Map of previous transactions that have outputs we're spending
@return maximum number of sigops required to validate this transaction's inputs
@see CTransaction::FetchInputs
*/
unsigned int GetP2SHSigOpCount(const MapPrevTx& mapInputs) const;
/** Amount of bitcoins spent by this transaction.
@return sum of all outputs (note: does not include fees)
*/
int64 GetValueOut() const
{
int64 nValueOut = 0;
BOOST_FOREACH(const CTxOut& txout, vout)
{
nValueOut += txout.nValue;
if (!MoneyRange(txout.nValue) || !MoneyRange(nValueOut))
throw std::runtime_error("CTransaction::GetValueOut() : value out of range");
}
return nValueOut;
}
/** Amount of bitcoins coming in to this transaction
Note that lightweight clients may not know anything besides the hash of previous transactions,
so may not be able to calculate this.
@param[in] mapInputs Map of previous transactions that have outputs we're spending
@return Sum of value of all inputs (scriptSigs)
@see CTransaction::FetchInputs
*/
int64 GetValueIn(const MapPrevTx& mapInputs) const;
static bool AllowFree(double dPriority)
{
// Large (in bytes) low-priority (new, small-coin) transactions
// need a fee.
return dPriority > COIN * 2880 / 250;
}
int64 GetMinFee(unsigned int nBlockSize=1, bool fAllowFree=false, enum GetMinFee_mode mode=GMF_BLOCK, unsigned int nBytes = 0) const;
bool ReadFromDisk(CDiskTxPos pos, FILE** pfileRet=NULL)
{
CAutoFile filein = CAutoFile(OpenBlockFile(pos.nFile, 0, pfileRet ? "rb+" : "rb"), SER_DISK, CLIENT_VERSION);
if (!filein)
return error("CTransaction::ReadFromDisk() : OpenBlockFile failed");
// Read transaction
if (fseek(filein, pos.nTxPos, SEEK_SET) != 0)
return error("CTransaction::ReadFromDisk() : fseek failed");
try {
filein >> *this;
}
catch (std::exception &e) {
return error("%s() : deserialize or I/O error", __PRETTY_FUNCTION__);
}
// Return file pointer
if (pfileRet)
{
if (fseek(filein, pos.nTxPos, SEEK_SET) != 0)
return error("CTransaction::ReadFromDisk() : second fseek failed");
*pfileRet = filein.release();
}
return true;
}
friend bool operator==(const CTransaction& a, const CTransaction& b)
{
return (a.nVersion == b.nVersion &&
a.nTime == b.nTime &&
a.vin == b.vin &&
a.vout == b.vout &&
a.nLockTime == b.nLockTime);
}
friend bool operator!=(const CTransaction& a, const CTransaction& b)
{
return !(a == b);
}
std::string ToStringShort() const
{
std::string str;
str += strprintf("%s %s", GetHash().ToString().c_str(), IsCoinBase()? "base" : (IsCoinStake()? "stake" : "user"));
return str;
}
std::string ToString() const
{
std::string str;
str += IsCoinBase()? "Coinbase" : (IsCoinStake()? "Coinstake" : "CTransaction");
str += strprintf("(hash=%s, nTime=%d, ver=%d, vin.size=%"PRIszu", vout.size=%"PRIszu", nLockTime=%d)\n",
GetHash().ToString().substr(0,10).c_str(),
nTime,
nVersion,
vin.size(),
vout.size(),
nLockTime
);
for (unsigned int i = 0; i < vin.size(); i++)
str += " " + vin[i].ToString() + "\n";
for (unsigned int i = 0; i < vout.size(); i++)
str += " " + vout[i].ToString() + "\n";
return str;
}
void print() const
{
printf("%s", ToString().c_str());
}
bool ReadFromDisk(CTxDB& txdb, COutPoint prevout, CTxIndex& txindexRet);
bool ReadFromDisk(CTxDB& txdb, COutPoint prevout);
bool ReadFromDisk(COutPoint prevout);
bool DisconnectInputs(CTxDB& txdb);
/** Fetch from memory and/or disk. inputsRet keys are transaction hashes.
@param[in] txdb Transaction database
@param[in] mapTestPool List of pending changes to the transaction index database
@param[in] fBlock True if being called to add a new best-block to the chain
@param[in] fMiner True if being called by CreateNewBlock
@param[out] inputsRet Pointers to this transaction's inputs
@param[out] fInvalid returns true if transaction is invalid
@return Returns true if all inputs are in txdb or mapTestPool
*/
bool FetchInputs(CTxDB& txdb, const std::map<uint256, CTxIndex>& mapTestPool,
bool fBlock, bool fMiner, MapPrevTx& inputsRet, bool& fInvalid);
/** Sanity check previous transactions, then, if all checks succeed,
mark them as spent by this transaction.
@param[in] inputs Previous transactions (from FetchInputs)
@param[out] mapTestPool Keeps track of inputs that need to be updated on disk
@param[in] posThisTx Position of this transaction on disk
@param[in] pindexBlock
@param[in] fBlock true if called from ConnectBlock
@param[in] fMiner true if called from CreateNewBlock
@param[in] fStrictPayToScriptHash true if fully validating p2sh transactions
@return Returns true if all checks succeed
*/
bool ConnectInputs(CTxDB& txdb, MapPrevTx inputs,
std::map<uint256, CTxIndex>& mapTestPool, const CDiskTxPos& posThisTx,
const CBlockIndex* pindexBlock, bool fBlock, bool fMiner, bool fStrictPayToScriptHash=true);
bool ClientConnectInputs();
bool CheckTransaction() const;
bool AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs=true, bool* pfMissingInputs=NULL);
bool GetCoinAge(CTxDB& txdb, uint64& nCoinAge) const; // ppcoin: get transaction coin age
protected:
const CTxOut& GetOutputFor(const CTxIn& input, const MapPrevTx& inputs) const;
};
/** A transaction with a merkle branch linking it to the block chain. */
class CMerkleTx : public CTransaction
{
public:
uint256 hashBlock;
std::vector<uint256> vMerkleBranch;
int nIndex;
// memory only
mutable bool fMerkleVerified;
CMerkleTx()
{
Init();
}
CMerkleTx(const CTransaction& txIn) : CTransaction(txIn)
{
Init();
}
void Init()
{
hashBlock = 0;
nIndex = -1;
fMerkleVerified = false;
}
IMPLEMENT_SERIALIZE
(
nSerSize += SerReadWrite(s, *(CTransaction*)this, nType, nVersion, ser_action);
nVersion = this->nVersion;
READWRITE(hashBlock);
READWRITE(vMerkleBranch);
READWRITE(nIndex);
)
int SetMerkleBranch(const CBlock* pblock=NULL);
int GetDepthInMainChain(CBlockIndex* &pindexRet) const;
int GetDepthInMainChain() const { CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet); }
bool IsInMainChain() const { return GetDepthInMainChain() > 0; }
int GetBlocksToMaturity() const;
bool AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs=true);
bool AcceptToMemoryPool();
};
/** A txdb record that contains the disk location of a transaction and the
* locations of transactions that spend its outputs. vSpent is really only
* used as a flag, but having the location is very helpful for debugging.
*/
class CTxIndex
{
public:
CDiskTxPos pos;
std::vector<CDiskTxPos> vSpent;
CTxIndex()
{
SetNull();
}
CTxIndex(const CDiskTxPos& posIn, unsigned int nOutputs)
{
pos = posIn;
vSpent.resize(nOutputs);
}
IMPLEMENT_SERIALIZE
(
if (!(nType & SER_GETHASH))
READWRITE(nVersion);
READWRITE(pos);
READWRITE(vSpent);
)
void SetNull()
{
pos.SetNull();
vSpent.clear();
}
bool IsNull()
{
return pos.IsNull();
}
friend bool operator==(const CTxIndex& a, const CTxIndex& b)
{
return (a.pos == b.pos &&
a.vSpent == b.vSpent);
}
friend bool operator!=(const CTxIndex& a, const CTxIndex& b)
{
return !(a == b);
}
int GetDepthInMainChain() const;
};
/** Nodes collect new transactions into a block, hash them into a hash tree,
* and scan through nonce values to make the block's hash satisfy proof-of-work
* requirements. When they solve the proof-of-work, they broadcast the block
* to everyone and the block is added to the block chain. The first transaction
* in the block is a special one that creates a new coin owned by the creator
* of the block.
*
* Blocks are appended to blk0001.dat files on disk. Their location on disk
* is indexed by CBlockIndex objects in memory.
*/
class CBlock
{
public:
// header
static const int CURRENT_VERSION=4;
int nVersion;
uint256 hashPrevBlock;
uint256 hashMerkleRoot;
unsigned int nTime;
unsigned int nBits;
unsigned int nNonce;
// network and disk
std::vector<CTransaction> vtx;
// ppcoin: block signature - signed by one of the coin base txout[N]'s owner
std::vector<unsigned char> vchBlockSig;
// memory only
mutable std::vector<uint256> vMerkleTree;
// Denial-of-service detection:
mutable int nDoS;
bool DoS(int nDoSIn, bool fIn) const { nDoS += nDoSIn; return fIn; }
CBlock()
{
SetNull();
}
IMPLEMENT_SERIALIZE
(
READWRITE(this->nVersion);
nVersion = this->nVersion;
READWRITE(hashPrevBlock);
READWRITE(hashMerkleRoot);
READWRITE(nTime);
READWRITE(nBits);
READWRITE(nNonce);
// ConnectBlock depends on vtx following header to generate CDiskTxPos
if (!(nType & (SER_GETHASH|SER_BLOCKHEADERONLY)))
{
READWRITE(vtx);
READWRITE(vchBlockSig);
}
else if (fRead)
{
const_cast<CBlock*>(this)->vtx.clear();
const_cast<CBlock*>(this)->vchBlockSig.clear();
}
)
void SetNull()
{
nVersion = CBlock::CURRENT_VERSION;
hashPrevBlock = 0;
hashMerkleRoot = 0;
nTime = 0;
nBits = 0;
nNonce = 0;
vtx.clear();
vchBlockSig.clear();
vMerkleTree.clear();
nDoS = 0;
}
bool IsNull() const
{
return (nBits == 0);
}
uint256 GetHash() const
{
return Hash9(BEGIN(nVersion), END(nNonce));
}
int64 GetBlockTime() const
{
return (int64)nTime;
}
void UpdateTime(const CBlockIndex* pindexPrev);
// ppcoin: entropy bit for stake modifier if chosen by modifier
unsigned int GetStakeEntropyBit(unsigned int nHeight) const
{
// Take last bit of block hash as entropy bit
unsigned int nEntropyBit = ((GetHash().Get64()) & 1llu);
if (fDebug && GetBoolArg("-printstakemodifier"))
printf("GetStakeEntropyBit: nHeight=%u hashBlock=%s nEntropyBit=%u\n", nHeight, GetHash().ToString().c_str(), nEntropyBit);
return nEntropyBit;
}
// ppcoin: two types of block: proof-of-work or proof-of-stake
bool IsProofOfStake() const
{
return (vtx.size() > 1 && vtx[1].IsCoinStake());
}
bool IsProofOfWork() const
{
return !IsProofOfStake();
}
std::pair<COutPoint, unsigned int> GetProofOfStake() const
{
return IsProofOfStake()? std::make_pair(vtx[1].vin[0].prevout, vtx[1].nTime) : std::make_pair(COutPoint(), (unsigned int)0);
}
// ppcoin: get max transaction timestamp
int64 GetMaxTransactionTime() const
{
int64 maxTransactionTime = 0;
BOOST_FOREACH(const CTransaction& tx, vtx)
maxTransactionTime = std::max(maxTransactionTime, (int64)tx.nTime);
return maxTransactionTime;
}
uint256 BuildMerkleTree() const
{
vMerkleTree.clear();
BOOST_FOREACH(const CTransaction& tx, vtx)
vMerkleTree.push_back(tx.GetHash());
int j = 0;
for (int nSize = vtx.size(); nSize > 1; nSize = (nSize + 1) / 2)
{
for (int i = 0; i < nSize; i += 2)
{
int i2 = std::min(i+1, nSize-1);
vMerkleTree.push_back(Hash(BEGIN(vMerkleTree[j+i]), END(vMerkleTree[j+i]),
BEGIN(vMerkleTree[j+i2]), END(vMerkleTree[j+i2])));
}
j += nSize;
}
return (vMerkleTree.empty() ? 0 : vMerkleTree.back());
}
std::vector<uint256> GetMerkleBranch(int nIndex) const
{
if (vMerkleTree.empty())
BuildMerkleTree();
std::vector<uint256> vMerkleBranch;
int j = 0;
for (int nSize = vtx.size(); nSize > 1; nSize = (nSize + 1) / 2)
{
int i = std::min(nIndex^1, nSize-1);
vMerkleBranch.push_back(vMerkleTree[j+i]);
nIndex >>= 1;
j += nSize;
}
return vMerkleBranch;
}
static uint256 CheckMerkleBranch(uint256 hash, const std::vector<uint256>& vMerkleBranch, int nIndex)
{
if (nIndex == -1)
return 0;
BOOST_FOREACH(const uint256& otherside, vMerkleBranch)
{
if (nIndex & 1)
hash = Hash(BEGIN(otherside), END(otherside), BEGIN(hash), END(hash));
else
hash = Hash(BEGIN(hash), END(hash), BEGIN(otherside), END(otherside));
nIndex >>= 1;
}
return hash;
}
bool WriteToDisk(unsigned int& nFileRet, unsigned int& nBlockPosRet)
{
// Open history file to append
CAutoFile fileout = CAutoFile(AppendBlockFile(nFileRet), SER_DISK, CLIENT_VERSION);
if (!fileout)
return error("CBlock::WriteToDisk() : AppendBlockFile failed");
// Write index header
unsigned int nSize = fileout.GetSerializeSize(*this);
fileout << FLATDATA(pchMessageStart) << nSize;
// Write block
long fileOutPos = ftell(fileout);
if (fileOutPos < 0)
return error("CBlock::WriteToDisk() : ftell failed");
nBlockPosRet = fileOutPos;
fileout << *this;
// Flush stdio buffers and commit to disk before returning
fflush(fileout);
if (!IsInitialBlockDownload() || (nBestHeight+1) % 500 == 0)
FileCommit(fileout);
return true;
}
bool ReadFromDisk(unsigned int nFile, unsigned int nBlockPos, bool fReadTransactions=true)
{
SetNull();
// Open history file to read
CAutoFile filein = CAutoFile(OpenBlockFile(nFile, nBlockPos, "rb"), SER_DISK, CLIENT_VERSION);
if (!filein)
return error("CBlock::ReadFromDisk() : OpenBlockFile failed");
if (!fReadTransactions)
filein.nType |= SER_BLOCKHEADERONLY;
// Read block
try {
filein >> *this;
}
catch (std::exception &e) {
return error("%s() : deserialize or I/O error", __PRETTY_FUNCTION__);
}
// Check the header
if (fReadTransactions && IsProofOfWork() && !CheckProofOfWork(GetHash(), nBits))
return error("CBlock::ReadFromDisk() : errors in block header");
return true;
}
void print() const
{
printf("CBlock(hash=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%u, vtx=%"PRIszu", vchBlockSig=%s)\n",
GetHash().ToString().c_str(),
nVersion,
hashPrevBlock.ToString().c_str(),
hashMerkleRoot.ToString().c_str(),
nTime, nBits, nNonce,
vtx.size(),
HexStr(vchBlockSig.begin(), vchBlockSig.end()).c_str());
for (unsigned int i = 0; i < vtx.size(); i++)
{
printf(" ");
vtx[i].print();
}
printf(" vMerkleTree: ");
for (unsigned int i = 0; i < vMerkleTree.size(); i++)
printf("%s ", vMerkleTree[i].ToString().substr(0,10).c_str());
printf("\n");
}
bool DisconnectBlock(CTxDB& txdb, CBlockIndex* pindex);
bool ConnectBlock(CTxDB& txdb, CBlockIndex* pindex, bool fJustCheck=false);
bool ReadFromDisk(const CBlockIndex* pindex, bool fReadTransactions=true);
bool SetBestChain(CTxDB& txdb, CBlockIndex* pindexNew);
bool AddToBlockIndex(unsigned int nFile, unsigned int nBlockPos);
bool CheckBlock(bool fCheckPOW=true, bool fCheckMerkleRoot=true) const;
bool AcceptBlock();
bool GetCoinAge(uint64& nCoinAge) const; // ppcoin: calculate total coin age spent in block
bool SignBlock(const CKeyStore& keystore);
bool CheckBlockSignature() const;
private:
bool SetBestChainInner(CTxDB& txdb, CBlockIndex *pindexNew);
};
/** The block chain is a tree shaped structure starting with the
* genesis block at the root, with each block potentially having multiple
* candidates to be the next block. pprev and pnext link a path through the
* main/longest chain. A blockindex may have multiple pprev pointing back
* to it, but pnext will only point forward to the longest branch, or will
* be null if the block is not part of the longest chain.
*/
class CBlockIndex
{
public:
const uint256* phashBlock;
CBlockIndex* pprev;
CBlockIndex* pnext;
unsigned int nFile;
unsigned int nBlockPos;
CBigNum bnChainTrust; // ppcoin: trust score of block chain
int nHeight;
int64 nMint;
int64 nMoneySupply;
unsigned int nFlags; // ppcoin: block index flags
enum
{
BLOCK_PROOF_OF_STAKE = (1 << 0), // is proof-of-stake block
BLOCK_STAKE_ENTROPY = (1 << 1), // entropy bit for stake modifier
BLOCK_STAKE_MODIFIER = (1 << 2), // regenerated stake modifier
};
uint64 nStakeModifier; // hash modifier for proof-of-stake
unsigned int nStakeModifierChecksum; // checksum of index; in-memeory only
// proof-of-stake specific fields
COutPoint prevoutStake;
unsigned int nStakeTime;
uint256 hashProofOfStake;
// block header
int nVersion;
uint256 hashMerkleRoot;
unsigned int nTime;
unsigned int nBits;
unsigned int nNonce;
CBlockIndex()
{
phashBlock = NULL;
pprev = NULL;
pnext = NULL;
nFile = 0;
nBlockPos = 0;
nHeight = 0;
bnChainTrust = 0;
nMint = 0;
nMoneySupply = 0;
nFlags = 0;
nStakeModifier = 0;
nStakeModifierChecksum = 0;
hashProofOfStake = 0;
prevoutStake.SetNull();
nStakeTime = 0;
nVersion = 0;
hashMerkleRoot = 0;
nTime = 0;
nBits = 0;
nNonce = 0;
}
CBlockIndex(unsigned int nFileIn, unsigned int nBlockPosIn, CBlock& block)
{
phashBlock = NULL;
pprev = NULL;
pnext = NULL;
nFile = nFileIn;
nBlockPos = nBlockPosIn;
nHeight = 0;
bnChainTrust = 0;
nMint = 0;
nMoneySupply = 0;
nFlags = 0;
nStakeModifier = 0;
nStakeModifierChecksum = 0;
hashProofOfStake = 0;
if (block.IsProofOfStake())
{
SetProofOfStake();
prevoutStake = block.vtx[1].vin[0].prevout;
nStakeTime = block.vtx[1].nTime;
}
else
{
prevoutStake.SetNull();
nStakeTime = 0;
}
nVersion = block.nVersion;
hashMerkleRoot = block.hashMerkleRoot;
nTime = block.nTime;
nBits = block.nBits;
nNonce = block.nNonce;
}
CBlock GetBlockHeader() const
{
CBlock block;
block.nVersion = nVersion;
if (pprev)
block.hashPrevBlock = pprev->GetBlockHash();
block.hashMerkleRoot = hashMerkleRoot;
block.nTime = nTime;
block.nBits = nBits;
block.nNonce = nNonce;
return block;
}
uint256 GetBlockHash() const
{
return *phashBlock;
}
int64 GetBlockTime() const
{
return (int64)nTime;
}
CBigNum GetBlockTrust() const;
bool IsInMainChain() const
{
return (pnext || this == pindexBest);
}
bool CheckIndex() const
{
return true;
}
enum { nMedianTimeSpan=11 };
int64 GetMedianTimePast() const
{
int64 pmedian[nMedianTimeSpan];
int64* pbegin = &pmedian[nMedianTimeSpan];
int64* pend = &pmedian[nMedianTimeSpan];
const CBlockIndex* pindex = this;
for (int i = 0; i < nMedianTimeSpan && pindex; i++, pindex = pindex->pprev)
*(--pbegin) = pindex->GetBlockTime();
std::sort(pbegin, pend);
return pbegin[(pend - pbegin)/2];
}
int64 GetMedianTime() const
{
const CBlockIndex* pindex = this;
for (int i = 0; i < nMedianTimeSpan/2; i++)
{
if (!pindex->pnext)
return GetBlockTime();
pindex = pindex->pnext;
}
return pindex->GetMedianTimePast();
}
/**
* Returns true if there are nRequired or more blocks of minVersion or above
* in the last nToCheck blocks, starting at pstart and going backwards.
*/
static bool IsSuperMajority(int minVersion, const CBlockIndex* pstart,
unsigned int nRequired, unsigned int nToCheck);
bool IsProofOfWork() const
{
return !(nFlags & BLOCK_PROOF_OF_STAKE);
}
bool IsProofOfStake() const
{
return (nFlags & BLOCK_PROOF_OF_STAKE);
}
void SetProofOfStake()
{
nFlags |= BLOCK_PROOF_OF_STAKE;
}
unsigned int GetStakeEntropyBit() const
{
return ((nFlags & BLOCK_STAKE_ENTROPY) >> 1);
}
bool SetStakeEntropyBit(unsigned int nEntropyBit)
{
if (nEntropyBit > 1)
return false;
nFlags |= (nEntropyBit? BLOCK_STAKE_ENTROPY : 0);
return true;
}
bool GeneratedStakeModifier() const
{
return (nFlags & BLOCK_STAKE_MODIFIER);
}
void SetStakeModifier(uint64 nModifier, bool fGeneratedStakeModifier)
{
nStakeModifier = nModifier;
if (fGeneratedStakeModifier)
nFlags |= BLOCK_STAKE_MODIFIER;
}
std::string ToString() const
{
return strprintf("CBlockIndex(nprev=%p, pnext=%p, nFile=%u, nBlockPos=%-6d nHeight=%d, nMint=%s, nMoneySupply=%s, nFlags=(%s)(%d)(%s), nStakeModifier=%016"PRI64x", nStakeModifierChecksum=%08x, hashProofOfStake=%s, prevoutStake=(%s), nStakeTime=%d merkle=%s, hashBlock=%s)",
pprev, pnext, nFile, nBlockPos, nHeight,
FormatMoney(nMint).c_str(), FormatMoney(nMoneySupply).c_str(),
GeneratedStakeModifier() ? "MOD" : "-", GetStakeEntropyBit(), IsProofOfStake()? "PoS" : "PoW",
nStakeModifier, nStakeModifierChecksum,
hashProofOfStake.ToString().c_str(),
prevoutStake.ToString().c_str(), nStakeTime,
hashMerkleRoot.ToString().c_str(),
GetBlockHash().ToString().c_str());
}
void print() const
{
printf("%s\n", ToString().c_str());
}
};
/** Used to marshal pointers into hashes for db storage. */
class CDiskBlockIndex : public CBlockIndex
{
public:
uint256 hashPrev;
uint256 hashNext;
CDiskBlockIndex()
{
hashPrev = 0;
hashNext = 0;
}
explicit CDiskBlockIndex(CBlockIndex* pindex) : CBlockIndex(*pindex)
{
hashPrev = (pprev ? pprev->GetBlockHash() : 0);
hashNext = (pnext ? pnext->GetBlockHash() : 0);
}
IMPLEMENT_SERIALIZE
(
if (!(nType & SER_GETHASH))
READWRITE(nVersion);
READWRITE(hashNext);
READWRITE(nFile);
READWRITE(nBlockPos);
READWRITE(nHeight);
READWRITE(nMint);
READWRITE(nMoneySupply);
READWRITE(nFlags);
READWRITE(nStakeModifier);
if (IsProofOfStake())
{
READWRITE(prevoutStake);
READWRITE(nStakeTime);
READWRITE(hashProofOfStake);
}
else if (fRead)
{
const_cast<CDiskBlockIndex*>(this)->prevoutStake.SetNull();
const_cast<CDiskBlockIndex*>(this)->nStakeTime = 0;
const_cast<CDiskBlockIndex*>(this)->hashProofOfStake = 0;
}
// block header
READWRITE(this->nVersion);
READWRITE(hashPrev);
READWRITE(hashMerkleRoot);
READWRITE(nTime);
READWRITE(nBits);
READWRITE(nNonce);
)
uint256 GetBlockHash() const
{
CBlock block;
block.nVersion = nVersion;
block.hashPrevBlock = hashPrev;
block.hashMerkleRoot = hashMerkleRoot;
block.nTime = nTime;
block.nBits = nBits;
block.nNonce = nNonce;
return block.GetHash();
}
std::string ToString() const
{
std::string str = "CDiskBlockIndex(";
str += CBlockIndex::ToString();
str += strprintf("\n hashBlock=%s, hashPrev=%s, hashNext=%s)",
GetBlockHash().ToString().c_str(),
hashPrev.ToString().c_str(),
hashNext.ToString().c_str());
return str;
}
void print() const
{
printf("%s\n", ToString().c_str());
}
};
/** Describes a place in the block chain to another node such that if the
* other node doesn't have the same branch, it can find a recent common trunk.
* The further back it is, the further before the fork it may be.
*/
class CBlockLocator
{
protected:
std::vector<uint256> vHave;
public:
CBlockLocator()
{
}
explicit CBlockLocator(const CBlockIndex* pindex)
{
Set(pindex);
}
explicit CBlockLocator(uint256 hashBlock)
{
std::map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashBlock);
if (mi != mapBlockIndex.end())
Set((*mi).second);
}
CBlockLocator(const std::vector<uint256>& vHaveIn)
{
vHave = vHaveIn;
}
IMPLEMENT_SERIALIZE
(
if (!(nType & SER_GETHASH))
READWRITE(nVersion);
READWRITE(vHave);
)
void SetNull()
{
vHave.clear();
}
bool IsNull()
{
return vHave.empty();
}
void Set(const CBlockIndex* pindex)
{
vHave.clear();
int nStep = 1;
while (pindex)
{
vHave.push_back(pindex->GetBlockHash());
// Exponentially larger steps back
for (int i = 0; pindex && i < nStep; i++)
pindex = pindex->pprev;
if (vHave.size() > 10)
nStep *= 2;
}
vHave.push_back((!fTestNet ? hashGenesisBlock : hashGenesisBlockTestNet));
}
int GetDistanceBack()
{
// Retrace how far back it was in the sender's branch
int nDistance = 0;
int nStep = 1;
BOOST_FOREACH(const uint256& hash, vHave)
{
std::map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hash);
if (mi != mapBlockIndex.end())
{
CBlockIndex* pindex = (*mi).second;
if (pindex->IsInMainChain())
return nDistance;
}
nDistance += nStep;
if (nDistance > 10)
nStep *= 2;
}
return nDistance;
}
CBlockIndex* GetBlockIndex()
{
// Find the first block the caller has in the main chain
BOOST_FOREACH(const uint256& hash, vHave)
{
std::map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hash);
if (mi != mapBlockIndex.end())
{
CBlockIndex* pindex = (*mi).second;
if (pindex->IsInMainChain())
return pindex;
}
}
return pindexGenesisBlock;
}
uint256 GetBlockHash()
{
// Find the first block the caller has in the main chain
BOOST_FOREACH(const uint256& hash, vHave)
{
std::map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hash);
if (mi != mapBlockIndex.end())
{
CBlockIndex* pindex = (*mi).second;
if (pindex->IsInMainChain())
return hash;
}
}
return (!fTestNet ? hashGenesisBlock : hashGenesisBlockTestNet);
}
int GetHeight()
{
CBlockIndex* pindex = GetBlockIndex();
if (!pindex)
return 0;
return pindex->nHeight;
}
};
class CTxMemPool
{
public:
mutable CCriticalSection cs;
std::map<uint256, CTransaction> mapTx;
std::map<COutPoint, CInPoint> mapNextTx;
bool accept(CTxDB& txdb, CTransaction &tx,
bool fCheckInputs, bool* pfMissingInputs);
bool addUnchecked(const uint256& hash, CTransaction &tx);
bool remove(CTransaction &tx);
void clear();
void queryHashes(std::vector<uint256>& vtxid);
unsigned long size()
{
LOCK(cs);
return mapTx.size();
}
bool exists(uint256 hash)
{
return (mapTx.count(hash) != 0);
}
CTransaction& lookup(uint256 hash)
{
return mapTx[hash];
}
};
extern CTxMemPool mempool;
#endif
| [
"coin@hashlung.com"
] | coin@hashlung.com |
a5de72a03edaba03c70de565968dfdd8af3f1997 | 624d28b7da6b547d64706f59e336c99f92d5a26e | /Caravel/DRODLib1.5/TarMother.h | a8c61827fbd58f11f33cbc78868c79b7837ba0d4 | [] | no_license | anderssonn/drod | 543828e11956bc56dca631ad3371cc430098e432 | 48f99a4c261824f41694cfa446daccb09228598a | refs/heads/master | 2020-12-01T11:38:34.588601 | 2013-10-20T19:44:24 | 2013-10-20T19:44:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,008 | h | /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Deadly Rooms of Death.
*
* The Initial Developer of the Original Code is
* Caravel Software.
* Portions created by the Initial Developer are Copyright (C) 1995, 1996,
* 1997, 2000, 2001, 2002 Caravel Software. All Rights Reserved.
*
* Contributor(s):
* Michael Welsh Duggan (md5i)
*
* ***** END LICENSE BLOCK ***** */
//TarMother.h
//Declarations for CTarMother.
//Class for handling tar mother monster game logic.
#ifndef TARMOTHER_H
#define TARMOTHER_H
#include "Monster.h"
#include "MonsterFactory.h"
class CTarMother : public CMonster
{
public:
CTarMother(CCurrentGame *pSetCurrentGame = NULL)
: CMonster(M_TARMOTHER, pSetCurrentGame)
, bEyeSet(false)
{ }
IMPLEMENT_CLONE(CMonster, CTarMother)
virtual bool IsAggressive(void) {return false;}
virtual void Process(const int nLastCommand, CCueEvents &CueEvents);
private:
bool TarCanFindSwordsman() const;
bool bEyeSet, bLeftEye;
};
#endif //...#ifndef TARMOTHER_H
// $Log: TarMother.h,v $
// Revision 1.1 2003/02/25 00:01:41 erikh2000
// Initial check-in.
//
// Revision 1.14 2002/11/18 18:35:10 mrimer
// Added IsAggressive().
//
// Revision 1.13 2002/11/15 01:25:33 mrimer
// Added vars to tell whether this is a right or left eye.
//
// Revision 1.12 2002/11/14 19:25:04 mrimer
// Added object copy support.
// Made virtual methods explicit.
//
// Revision 1.11 2002/09/19 17:47:30 mrimer
// Added player invisibility rule for tar growth.
//
// Revision 1.10 2002/08/29 21:59:25 mrimer
// Changed Process' return type to void.
//
// Revision 1.9 2002/07/17 20:38:10 erikh2000
// Removed commented out code.
//
// Revision 1.8 2002/06/21 04:25:57 mrimer
// Revised includes.
//
// Revision 1.7 2002/05/14 17:22:51 mrimer
// Now basing particle explosion direction on sword movement (not orientation).
// Changed tar babies' stab appearance to TarStabEffect.
//
// Revision 1.6 2002/04/28 23:40:53 erikh2000
// Revised #includes.
//
// Revision 1.5 2002/03/05 01:54:10 erikh2000
// Added 2002 copyright notice to top of file.
//
// Revision 1.4 2001/11/25 02:31:31 erikh2000
// Changed CIDLists used for cue events to new CCueEvents class.
//
// Revision 1.3 2001/11/19 09:25:52 erikh2000
// Added monster type and process sequence params to CMonster constructor call.
//
// Revision 1.2 2001/11/13 05:35:54 md5i
// Added TarMother and growing tar.
//
// Revision 1.1.1.1 2001/10/01 22:20:32 erikh2000
// Initial check-in.
//
| [
"binji@chromium.org"
] | binji@chromium.org |
2b377b9362a2bdd3196c613e050275743f5678ea | 44f7618c16fc3d035fc041e9e99379c2829dbf3e | /MatrixAddition.cpp | 9c74b9acb2c22628fbb55939e0d721953f2ac61e | [] | no_license | hardikkumar01/CppPrograms | ed246bacac0f90356e1b0ac65af7047624b6ff14 | a5840701081dfd3a42479de1534dd6e20f6b4d37 | refs/heads/master | 2022-12-20T21:26:32.547952 | 2020-10-04T18:10:08 | 2020-10-04T18:10:08 | 300,042,044 | 1 | 3 | null | 2020-10-04T18:10:09 | 2020-09-30T19:44:00 | C++ | UTF-8 | C++ | false | false | 828 | cpp | #include <bits/stdc++.h>
#define N 4
using namespace std;
//Subtraction of two Matrices
void AddMat(int A[][N], int B[][N], int C[][N]){
int i,j;
for(i=0;i<N;i++){
for(j=0;j<N;j++){
C[i][j]=A[i][j]+B[i][j];
}
}
}
int main(){
int A[N][N] = { {1, 1, 1, 1},
{2, 2, 2, 2},
{3, 3, 3, 3},
{4, 4, 4, 4}};
int B[N][N] = { {0, 1, 1, 1},
{2, 0, 2, 2},
{3, 3, 0, 3},
{4, 4, 4, 0}};
int C[N][N];
int i,j;
AddMat(A,B,C);
cout<<"Result Matrix is :"<<endl;
for (i = 0; i < N; i++)
{
for (j = 0; j < N; j++)
cout << C[i][j] << " ";
cout << endl;
}
return 0;
}
| [
"noreply@github.com"
] | noreply@github.com |
e94f0742739b636e76eb97895494d5593fdd26ba | dd80a584130ef1a0333429ba76c1cee0eb40df73 | /external/chromium_org/third_party/WebKit/Source/core/svg/SVGViewSpec.cpp | b3201072998c43f8e1cec0671f7a81c95b0fe88f | [
"GPL-1.0-or-later",
"LGPL-2.0-or-later",
"Apache-2.0",
"MIT",
"BSD-3-Clause",
"LGPL-2.0-only",
"BSD-2-Clause",
"LGPL-2.1-only"
] | permissive | karunmatharu/Android-4.4-Pay-by-Data | 466f4e169ede13c5835424c78e8c30ce58f885c1 | fcb778e92d4aad525ef7a995660580f948d40bc9 | refs/heads/master | 2021-03-24T13:33:01.721868 | 2017-02-18T17:48:49 | 2017-02-18T17:48:49 | 81,847,777 | 0 | 2 | MIT | 2020-03-09T00:02:12 | 2017-02-13T16:47:00 | null | UTF-8 | C++ | false | false | 11,198 | cpp | /*
* Copyright (C) 2007, 2010 Rob Buis <buis@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "core/svg/SVGViewSpec.h"
#include "SVGNames.h"
#include "bindings/v8/ExceptionState.h"
#include "core/dom/Document.h"
#include "core/svg/SVGAnimatedTransformList.h"
#include "core/svg/SVGParserUtilities.h"
namespace WebCore {
// Define custom animated property 'viewBox'.
const SVGPropertyInfo* SVGViewSpec::viewBoxPropertyInfo()
{
static const SVGPropertyInfo* s_propertyInfo = 0;
if (!s_propertyInfo) {
s_propertyInfo = new SVGPropertyInfo(AnimatedRect,
PropertyIsReadOnly,
SVGNames::viewBoxAttr,
viewBoxIdentifier(),
0,
0);
}
return s_propertyInfo;
}
// Define custom animated property 'preserveAspectRatio'.
const SVGPropertyInfo* SVGViewSpec::preserveAspectRatioPropertyInfo()
{
static const SVGPropertyInfo* s_propertyInfo = 0;
if (!s_propertyInfo) {
s_propertyInfo = new SVGPropertyInfo(AnimatedPreserveAspectRatio,
PropertyIsReadOnly,
SVGNames::preserveAspectRatioAttr,
preserveAspectRatioIdentifier(),
0,
0);
}
return s_propertyInfo;
}
// Define custom non-animated property 'transform'.
const SVGPropertyInfo* SVGViewSpec::transformPropertyInfo()
{
static const SVGPropertyInfo* s_propertyInfo = 0;
if (!s_propertyInfo) {
s_propertyInfo = new SVGPropertyInfo(AnimatedTransformList,
PropertyIsReadOnly,
SVGNames::transformAttr,
transformIdentifier(),
0,
0);
}
return s_propertyInfo;
}
SVGViewSpec::SVGViewSpec(WeakPtr<SVGSVGElement> contextElement)
: m_contextElement(contextElement)
, m_zoomAndPan(SVGZoomAndPanMagnify)
{
ASSERT(m_contextElement);
ScriptWrappable::init(this);
}
const AtomicString& SVGViewSpec::viewBoxIdentifier()
{
DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGViewSpecViewBoxAttribute", AtomicString::ConstructFromLiteral));
return s_identifier;
}
const AtomicString& SVGViewSpec::preserveAspectRatioIdentifier()
{
DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGViewSpecPreserveAspectRatioAttribute", AtomicString::ConstructFromLiteral));
return s_identifier;
}
const AtomicString& SVGViewSpec::transformIdentifier()
{
DEFINE_STATIC_LOCAL(AtomicString, s_identifier, ("SVGViewSpecTransformAttribute", AtomicString::ConstructFromLiteral));
return s_identifier;
}
void SVGViewSpec::setZoomAndPan(unsigned short, ExceptionState& exceptionState)
{
// SVGViewSpec and all of its content is read-only.
exceptionState.throwUninformativeAndGenericDOMException(NoModificationAllowedError);
}
void SVGViewSpec::setTransformString(const String& transform)
{
if (!m_contextElement)
return;
SVGTransformList newList;
newList.parse(transform);
if (SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SVGElement, SVGAnimatedTransformList>(m_contextElement.get(), transformPropertyInfo()))
static_cast<SVGAnimatedTransformList*>(wrapper)->detachListWrappers(newList.size());
m_transform = newList;
}
String SVGViewSpec::transformString() const
{
return SVGPropertyTraits<SVGTransformList>::toString(m_transform);
}
String SVGViewSpec::viewBoxString() const
{
return SVGPropertyTraits<SVGRect>::toString(viewBoxBaseValue());
}
String SVGViewSpec::preserveAspectRatioString() const
{
return SVGPropertyTraits<SVGPreserveAspectRatio>::toString(preserveAspectRatioBaseValue());
}
SVGElement* SVGViewSpec::viewTarget() const
{
if (!m_contextElement)
return 0;
Element* element = m_contextElement.get()->treeScope().getElementById(m_viewTargetString);
if (!element || !element->isSVGElement())
return 0;
return toSVGElement(element);
}
SVGTransformListPropertyTearOff* SVGViewSpec::transform()
{
if (!m_contextElement)
return 0;
// Return the animVal here, as its readonly by default - which is exactly what we want here.
return static_cast<SVGTransformListPropertyTearOff*>(static_pointer_cast<SVGAnimatedTransformList>(lookupOrCreateTransformWrapper(this))->animVal());
}
PassRefPtr<SVGAnimatedRect> SVGViewSpec::viewBox()
{
if (!m_contextElement)
return 0;
return static_pointer_cast<SVGAnimatedRect>(lookupOrCreateViewBoxWrapper(this));
}
PassRefPtr<SVGAnimatedPreserveAspectRatio> SVGViewSpec::preserveAspectRatio()
{
if (!m_contextElement)
return 0;
return static_pointer_cast<SVGAnimatedPreserveAspectRatio>(lookupOrCreatePreserveAspectRatioWrapper(this));
}
PassRefPtr<SVGAnimatedProperty> SVGViewSpec::lookupOrCreateViewBoxWrapper(SVGViewSpec* ownerType)
{
ASSERT(ownerType);
ASSERT(ownerType->contextElement());
return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedRect, SVGRect>(ownerType->contextElement(), viewBoxPropertyInfo(), ownerType->m_viewBox);
}
PassRefPtr<SVGAnimatedProperty> SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper(SVGViewSpec* ownerType)
{
ASSERT(ownerType);
ASSERT(ownerType->contextElement());
return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedPreserveAspectRatio, SVGPreserveAspectRatio>(ownerType->contextElement(), preserveAspectRatioPropertyInfo(), ownerType->m_preserveAspectRatio);
}
PassRefPtr<SVGAnimatedProperty> SVGViewSpec::lookupOrCreateTransformWrapper(SVGViewSpec* ownerType)
{
ASSERT(ownerType);
ASSERT(ownerType->contextElement());
return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedTransformList, SVGTransformList>(ownerType->contextElement(), transformPropertyInfo(), ownerType->m_transform);
}
void SVGViewSpec::reset()
{
m_zoomAndPan = SVGZoomAndPanMagnify;
m_transform.clear();
m_viewBox = SVGRect();
m_preserveAspectRatio = SVGPreserveAspectRatio();
m_viewTargetString = emptyString();
}
static const LChar svgViewSpec[] = {'s', 'v', 'g', 'V', 'i', 'e', 'w'};
static const LChar viewBoxSpec[] = {'v', 'i', 'e', 'w', 'B', 'o', 'x'};
static const LChar preserveAspectRatioSpec[] = {'p', 'r', 'e', 's', 'e', 'r', 'v', 'e', 'A', 's', 'p', 'e', 'c', 't', 'R', 'a', 't', 'i', 'o'};
static const LChar transformSpec[] = {'t', 'r', 'a', 'n', 's', 'f', 'o', 'r', 'm'};
static const LChar zoomAndPanSpec[] = {'z', 'o', 'o', 'm', 'A', 'n', 'd', 'P', 'a', 'n'};
static const LChar viewTargetSpec[] = {'v', 'i', 'e', 'w', 'T', 'a', 'r', 'g', 'e', 't'};
template<typename CharType>
bool SVGViewSpec::parseViewSpecInternal(const CharType* ptr, const CharType* end)
{
if (!skipString(ptr, end, svgViewSpec, WTF_ARRAY_LENGTH(svgViewSpec)))
return false;
if (ptr >= end || *ptr != '(')
return false;
ptr++;
while (ptr < end && *ptr != ')') {
if (*ptr == 'v') {
if (skipString(ptr, end, viewBoxSpec, WTF_ARRAY_LENGTH(viewBoxSpec))) {
if (ptr >= end || *ptr != '(')
return false;
ptr++;
SVGRect viewBox;
if (!SVGFitToViewBox::parseViewBox(&m_contextElement.get()->document(), ptr, end, viewBox, false))
return false;
setViewBoxBaseValue(viewBox);
if (ptr >= end || *ptr != ')')
return false;
ptr++;
} else if (skipString(ptr, end, viewTargetSpec, WTF_ARRAY_LENGTH(viewTargetSpec))) {
if (ptr >= end || *ptr != '(')
return false;
const CharType* viewTargetStart = ++ptr;
while (ptr < end && *ptr != ')')
ptr++;
if (ptr >= end)
return false;
setViewTargetString(String(viewTargetStart, ptr - viewTargetStart));
ptr++;
} else
return false;
} else if (*ptr == 'z') {
if (!skipString(ptr, end, zoomAndPanSpec, WTF_ARRAY_LENGTH(zoomAndPanSpec)))
return false;
if (ptr >= end || *ptr != '(')
return false;
ptr++;
if (!parseZoomAndPan(ptr, end, m_zoomAndPan))
return false;
if (ptr >= end || *ptr != ')')
return false;
ptr++;
} else if (*ptr == 'p') {
if (!skipString(ptr, end, preserveAspectRatioSpec, WTF_ARRAY_LENGTH(preserveAspectRatioSpec)))
return false;
if (ptr >= end || *ptr != '(')
return false;
ptr++;
SVGPreserveAspectRatio preserveAspectRatio;
if (!preserveAspectRatio.parse(ptr, end, false))
return false;
setPreserveAspectRatioBaseValue(preserveAspectRatio);
if (ptr >= end || *ptr != ')')
return false;
ptr++;
} else if (*ptr == 't') {
if (!skipString(ptr, end, transformSpec, WTF_ARRAY_LENGTH(transformSpec)))
return false;
if (ptr >= end || *ptr != '(')
return false;
ptr++;
parseTransformAttribute(m_transform, ptr, end, DoNotClearList);
if (ptr >= end || *ptr != ')')
return false;
ptr++;
} else
return false;
if (ptr < end && *ptr == ';')
ptr++;
}
if (ptr >= end || *ptr != ')')
return false;
return true;
}
bool SVGViewSpec::parseViewSpec(const String& spec)
{
if (spec.isEmpty() || !m_contextElement)
return false;
if (spec.is8Bit()) {
const LChar* ptr = spec.characters8();
const LChar* end = ptr + spec.length();
return parseViewSpecInternal(ptr, end);
}
const UChar* ptr = spec.characters16();
const UChar* end = ptr + spec.length();
return parseViewSpecInternal(ptr, end);
}
}
| [
"karun.matharu@gmail.com"
] | karun.matharu@gmail.com |
bdbb39f4c517bb1f0dc50b224516470c2d7c1985 | 4ef911522f28384d38c26e2468d8a1ff858bb33b | /Mesh.h | 8a5c923abb2760b45d44b27a54b0613bab007f0f | [] | no_license | fbgtoke/VJ3D | 215b5d24eacb663dc1809cdeeec07f68d622c6e2 | f4c399a6c5257f9b00015ac285ec6b2e579147c7 | refs/heads/master | 2021-09-03T10:20:05.448115 | 2018-01-08T10:05:30 | 2018-01-08T10:05:30 | 109,996,340 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,096 | h | #ifndef _MESH_INCLUDE
#define _MESH_INCLUDE
#include "utils.h"
class Mesh {
public:
Mesh();
~Mesh();
void initVAO();
void updateVAO();
void freeVAO();
GLuint getVAO() const;
void setVertices(float* vertices, unsigned int nelem);
void setNormals(float* normals, unsigned int nelem);
void setTexCoords(float* texcoords, unsigned int nelem);
float* vertices();
float* normals();
float* texcoords();
unsigned int verticesSize() const;
unsigned int normalsSize() const;
unsigned int texcoordsSize() const;
unsigned int numVertices() const;
void getMinMaxVertices(glm::vec3& min, glm::vec3& max) const;
glm::vec3 center() const;
glm::vec3 sizeInTiles() const;
glm::vec3 size() const;
protected:
GLuint mVAO;
GLuint mVBO_vertices, mVBO_normals, mVBO_texcoord;
GLuint mLoc_vertices, mLoc_normals, mLoc_texcoord;
unsigned int nFloatsVertices;
unsigned int nFloatsNormals;
unsigned int nFloatsTexCoords;
glm::vec3 min, max;
float* mVertices = nullptr;
float* mNormals = nullptr;
float* mTexCoords = nullptr;
};
#endif // _MESH_INCLUDE | [
"fbg.toke@gmail.com"
] | fbg.toke@gmail.com |
d7193821767abd649f5e92e4d28e23ae08e9787f | 11fca4022d5abcbccdbcfc993b1de4e7a6d3539d | /C/recursion.cpp | f2925ff71b643781a80fb8684a666233181d2c18 | [] | no_license | CodeKul/UnityGameDevelopment-FullStack-27-May-2019 | eefc3658510c96f59e1a340de18353368c7c3fd4 | 15c34cab84ce0b1dbf159a2cc83feac84e8d0acd | refs/heads/master | 2020-05-29T13:46:49.220873 | 2019-07-29T12:28:34 | 2019-07-29T12:28:34 | 189,170,002 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 624 | cpp | /*Sum of Natural numbers using Rescursion*/
#include<stdio.h>
int SumOfNumber(int start,int end);
int SumOfNumberUpper(int end);
int main(){
int upper,lower,sum;
printf("Enter Upper Limit : ");
scanf("%d",&upper);
// printf("Enter Lower Limit : ");
// scanf("%d",&lower);
//sum = SumOfNumber(lower,upper);
sum = SumOfNumberUpper(upper);
printf("\n sum = %d",sum);
}
int SumOfNumber(int start,int end){
if(start == end){
return start;
}else{
return start + SumOfNumber(start+1,end);
}
}
int SumOfNumberUpper(int end){
if(end == 1){
return end;
}else{
return end + SumOfNumberUpper(end-1);
}
}
| [
"melayer.jay@gmail.com"
] | melayer.jay@gmail.com |
fc8fc7e362c8739b8e2e67df65a0855626df38e8 | 1cc37e16e2d69b67965e76556255873502f8f71b | /tests/common.h | dad0cb1316245cf2f6bc97b291ef7276507882d0 | [] | no_license | cor3ntin/cedilla | 58fc0c0785cad66b1a728b3cc51a14241d1962fe | 87ed4705e6902b8b509ab575d591796b8a7c5f5c | refs/heads/master | 2021-04-06T00:22:09.663981 | 2018-05-20T12:49:00 | 2018-05-20T12:49:00 | 124,688,717 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 755 | h | #pragma once
#include <catch2/catch.hpp>
#include <string>
#include <iostream>
#include <fstream>
#include <regex>
#include <sstream>
#include <vector>
template<typename I>
std::string n2hexstr(I w, size_t hex_len = sizeof(I) << 1) {
static const char* digits = "0123456789ABCDEF";
std::string rc(hex_len, '0');
for(size_t i = 0, j = (hex_len - 1) * 4; i < hex_len; ++i, j -= 4)
rc[i] = digits[(w >> j) & 0x0f];
return rc;
}
inline std::ostream& operator<<(std::ostream& os, std::u32string const& value) {
for(auto codepoint : value) {
os << std::hex << "U+" << n2hexstr(codepoint, 8) << " ";
}
return os;
}
struct test_data {
std::u32string c1, c2, c3, c4, c5;
};
std::vector<test_data> test_cases();
| [
"corentinjabot@gmail.com"
] | corentinjabot@gmail.com |
0ba1271521850d353a9a913832ecf9b7af7ca1a3 | aadf05f05571d021bf01b6f01fb792516689e5fc | /src/arith_uint256.cpp | 198d8cd7d571006e3bea1d6317a1519f79e92e95 | [
"MIT"
] | permissive | ak-toktor/Source | 0117a603adb9562f5481393a933b5f525eab4a14 | e417cd3690c03b11f7775e9be43bf4d60aaacda0 | refs/heads/master | 2020-04-07T19:58:01.689240 | 2018-11-22T11:40:40 | 2018-11-22T11:40:40 | 158,670,199 | 0 | 1 | null | 2018-11-22T08:57:09 | 2018-11-22T08:57:08 | null | UTF-8 | C++ | false | false | 9,169 | cpp | // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2017 The PIVX developers
// Copyright (c) 2017 The Deviant developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "arith_uint256.h"
#include "crypto/common.h"
#include "uint256.h"
#include "uint512.h"
#include "utilstrencodings.h"
#include <stdio.h>
#include <string.h>
template <>
std::string base_uint<256>::GetHex() const
{
return ArithToUint256(*this).GetHex();
}
template <>
void base_uint<256>::SetHex(const char* psz)
{
*this = UintToArith256(uint256S(psz));
}
template <>
std::string base_uint<512>::GetHex() const
{
return ArithToUint512(*this).GetHex();
}
template <>
void base_uint<512>::SetHex(const char* psz)
{
*this = UintToArith512(uint512S(psz));
}
template <unsigned int BITS>
base_uint<BITS>::base_uint(const std::string& str)
{
SetHex(str);
}
template <unsigned int BITS>
base_uint<BITS>::base_uint(const std::vector<unsigned char>& vch)
{
if (vch.size() != sizeof(pn))
throw uint_error("Converting vector of wrong size to base_uint");
memcpy(pn, &vch[0], sizeof(pn));
}
template <unsigned int BITS>
base_uint<BITS>& base_uint<BITS>::operator<<=(unsigned int shift)
{
base_uint<BITS> a(*this);
for (int i = 0; i < WIDTH; i++)
pn[i] = 0;
int k = shift / 32;
shift = shift % 32;
for (int i = 0; i < WIDTH; i++) {
if (i + k + 1 < WIDTH && shift != 0)
pn[i + k + 1] |= (a.pn[i] >> (32 - shift));
if (i + k < WIDTH)
pn[i + k] |= (a.pn[i] << shift);
}
return *this;
}
template <unsigned int BITS>
base_uint<BITS>& base_uint<BITS>::operator>>=(unsigned int shift)
{
base_uint<BITS> a(*this);
for (int i = 0; i < WIDTH; i++)
pn[i] = 0;
int k = shift / 32;
shift = shift % 32;
for (int i = 0; i < WIDTH; i++) {
if (i - k - 1 >= 0 && shift != 0)
pn[i - k - 1] |= (a.pn[i] << (32 - shift));
if (i - k >= 0)
pn[i - k] |= (a.pn[i] >> shift);
}
return *this;
}
template <unsigned int BITS>
base_uint<BITS>& base_uint<BITS>::operator*=(uint32_t b32)
{
uint64_t carry = 0;
for (int i = 0; i < WIDTH; i++) {
uint64_t n = carry + (uint64_t)b32 * pn[i];
pn[i] = n & 0xffffffff;
carry = n >> 32;
}
return *this;
}
template <unsigned int BITS>
base_uint<BITS>& base_uint<BITS>::operator*=(const base_uint& b)
{
base_uint<BITS> a = *this;
*this = 0;
for (int j = 0; j < WIDTH; j++) {
uint64_t carry = 0;
for (int i = 0; i + j < WIDTH; i++) {
uint64_t n = carry + pn[i + j] + (uint64_t)a.pn[j] * b.pn[i];
pn[i + j] = n & 0xffffffff;
carry = n >> 32;
}
}
return *this;
}
template <unsigned int BITS>
base_uint<BITS>& base_uint<BITS>::operator/=(const base_uint& b)
{
base_uint<BITS> div = b; // make a copy, so we can shift.
base_uint<BITS> num = *this; // make a copy, so we can subtract.
*this = 0; // the quotient.
int num_bits = num.bits();
int div_bits = div.bits();
if (div_bits == 0)
throw uint_error("Division by zero");
if (div_bits > num_bits) // the result is certainly 0.
return *this;
int shift = num_bits - div_bits;
div <<= shift; // shift so that div and num align.
while (shift >= 0) {
if (num >= div) {
num -= div;
pn[shift / 32] |= (1 << (shift & 31)); // set a bit of the result.
}
div >>= 1; // shift back.
shift--;
}
// num now contains the remainder of the division.
return *this;
}
template <unsigned int BITS>
int base_uint<BITS>::CompareTo(const base_uint<BITS>& b) const
{
for (int i = WIDTH - 1; i >= 0; i--) {
if (pn[i] < b.pn[i])
return -1;
if (pn[i] > b.pn[i])
return 1;
}
return 0;
}
template <unsigned int BITS>
bool base_uint<BITS>::EqualTo(uint64_t b) const
{
for (int i = WIDTH - 1; i >= 2; i--) {
if (pn[i])
return false;
}
if (pn[1] != (b >> 32))
return false;
if (pn[0] != (b & 0xfffffffful))
return false;
return true;
}
template <unsigned int BITS>
double base_uint<BITS>::getdouble() const
{
double ret = 0.0;
double fact = 1.0;
for (int i = 0; i < WIDTH; i++) {
ret += fact * pn[i];
fact *= 4294967296.0;
}
return ret;
}
template <unsigned int BITS>
void base_uint<BITS>::SetHex(const std::string& str)
{
SetHex(str.c_str());
}
template <unsigned int BITS>
std::string base_uint<BITS>::ToString() const
{
return (GetHex());
}
template <unsigned int BITS>
unsigned int base_uint<BITS>::bits() const
{
for (int pos = WIDTH - 1; pos >= 0; pos--) {
if (pn[pos]) {
for (int bits = 31; bits > 0; bits--) {
if (pn[pos] & 1 << bits)
return 32 * pos + bits + 1;
}
return 32 * pos + 1;
}
}
return 0;
}
// Explicit instantiations for base_uint<256>
template base_uint<256>::base_uint(const std::string&);
template base_uint<256>::base_uint(const std::vector<unsigned char>&);
template base_uint<256>& base_uint<256>::operator<<=(unsigned int);
template base_uint<256>& base_uint<256>::operator>>=(unsigned int);
template base_uint<256>& base_uint<256>::operator*=(uint32_t b32);
template base_uint<256>& base_uint<256>::operator*=(const base_uint<256>& b);
template base_uint<256>& base_uint<256>::operator/=(const base_uint<256>& b);
template int base_uint<256>::CompareTo(const base_uint<256>&) const;
template bool base_uint<256>::EqualTo(uint64_t) const;
template double base_uint<256>::getdouble() const;
template std::string base_uint<256>::ToString() const;
template void base_uint<256>::SetHex(const char*);
template void base_uint<256>::SetHex(const std::string&);
template unsigned int base_uint<256>::bits() const;
// Explicit instantiations for base_uint<512>
template base_uint<512>::base_uint(const std::string&);
template base_uint<512>::base_uint(const std::vector<unsigned char>&);
template base_uint<512>& base_uint<512>::operator<<=(unsigned int);
template base_uint<512>& base_uint<512>::operator>>=(unsigned int);
template base_uint<512>& base_uint<512>::operator*=(uint32_t b32);
template base_uint<512>& base_uint<512>::operator*=(const base_uint<512>& b);
template base_uint<512>& base_uint<512>::operator/=(const base_uint<512>& b);
template int base_uint<512>::CompareTo(const base_uint<512>&) const;
template bool base_uint<512>::EqualTo(uint64_t) const;
template double base_uint<512>::getdouble() const;
template std::string base_uint<512>::ToString() const;
//template void base_uint<512>::SetHex(const char*);
template void base_uint<512>::SetHex(const std::string&);
template unsigned int base_uint<512>::bits() const;
// This implementation directly uses shifts instead of going
// through an intermediate MPI representation.
arith_uint256& arith_uint256::SetCompact(uint32_t nCompact, bool* pfNegative, bool* pfOverflow)
{
int nSize = nCompact >> 24;
uint32_t nWord = nCompact & 0x007fffff;
if (nSize <= 3) {
nWord >>= 8 * (3 - nSize);
*this = nWord;
} else {
*this = nWord;
*this <<= 8 * (nSize - 3);
}
if (pfNegative)
*pfNegative = nWord != 0 && (nCompact & 0x00800000) != 0;
if (pfOverflow)
*pfOverflow = nWord != 0 && ((nSize > 34) ||
(nWord > 0xff && nSize > 33) ||
(nWord > 0xffff && nSize > 32));
return *this;
}
uint32_t arith_uint256::GetCompact(bool fNegative) const
{
int nSize = (bits() + 7) / 8;
uint32_t nCompact = 0;
if (nSize <= 3) {
nCompact = GetLow64() << 8 * (3 - nSize);
} else {
arith_uint256 bn = *this >> 8 * (nSize - 3);
nCompact = bn.GetLow64();
}
// The 0x00800000 bit denotes the sign.
// Thus, if it is already set, divide the mantissa by 256 and increase the exponent.
if (nCompact & 0x00800000) {
nCompact >>= 8;
nSize++;
}
assert((nCompact & ~0x007fffff) == 0);
assert(nSize < 256);
nCompact |= nSize << 24;
nCompact |= (fNegative && (nCompact & 0x007fffff) ? 0x00800000 : 0);
return nCompact;
}
uint256 ArithToUint256(const arith_uint256& a)
{
uint256 b;
for (int x = 0; x < a.WIDTH; ++x)
WriteLE32(b.begin() + x * 4, a.pn[x]);
return b;
}
arith_uint256 UintToArith256(const uint256& a)
{
arith_uint256 b;
for (int x = 0; x < b.WIDTH; ++x)
b.pn[x] = ReadLE32(a.begin() + x * 4);
return b;
}
uint512 ArithToUint512(const arith_uint512& a)
{
uint512 b;
for (int x = 0; x < a.WIDTH; ++x)
WriteLE32(b.begin() + x * 4, a.pn[x]);
return b;
}
arith_uint512 UintToArith512(const uint512& a)
{
arith_uint512 b;
for (int x = 0; x < b.WIDTH; ++x)
b.pn[x] = ReadLE32(a.begin() + x * 4);
return b;
}
| [
"35767046+Deviantcoin@users.noreply.github.com"
] | 35767046+Deviantcoin@users.noreply.github.com |
cdce2d0910670e864a7e44ef23f53a5e1878c2df | 3f94fde265e466368ca72a9b26c7a404cf2fba8f | /Engine/src/animation/linearcurveevaluator.cpp | e60bce1c4f030e6ff7d69798aa8247997c055aff | [] | no_license | HanfeiChen/ray-tracer | f0c3937525a81205281ce19b90fe4d250003dd94 | 83657818d45cb4f495c2068dc9595960bc0bf1f0 | refs/heads/master | 2022-11-10T06:38:25.432149 | 2020-06-26T21:22:27 | 2020-06-26T21:22:27 | 275,250,143 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 687 | cpp | /****************************************************************************
* Copyright ©2017 Brian Curless. All rights reserved. Permission is hereby
* granted to students registered for University of Washington CSE 457 or CSE
* 557 for use solely during Autumn Quarter 2017 for purposes of the course.
* No other use, copying, distribution, or modification is permitted without
* prior written consent. Copyrights for third-party components of this work
* must be honored. Instructors interested in reusing these course materials
* should contact the author.
****************************************************************************/
#include "linearcurveevaluator.h"
| [
"paquinn@cs.washington.edu"
] | paquinn@cs.washington.edu |
79d3da4bd0a5d04bd62c2841e7e17fd50deafdd1 | da527f1a95dd671ec425ac8d14aed7837fbba889 | /Phronesis/Sources/Phronesis/Graphics/RenderUtils.hpp | f30f820ef70911d89b6a1d9c6bb11c4092333d1d | [] | no_license | asyzruffz/ProjectPhronesis | 30313507370f9975dce0c8cdfeef349547720727 | 300af98e2a33108ae9d2f9dbbcb3a4e29932b575 | refs/heads/master | 2022-12-23T22:48:37.427079 | 2022-12-13T16:11:25 | 2022-12-13T16:11:25 | 24,268,947 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 383 | hpp | #pragma once
#include <string>
#include <vector>
#include <vulkan/vulkan.h>
struct GLFWwindow;
namespace Phronesis
{
class RenderUtils
{
public:
static void checkVk(const VkResult &result);
private:
static std::string stringifyResultVk(const VkResult &result);
static std::string stringifyMessageSeverity(const VkDebugUtilsMessageSeverityFlagBitsEXT &severity);
};
}
| [
"asyzruffz@gmail.com"
] | asyzruffz@gmail.com |
213e9e2ef5d12a22db1b1b1b1a4c041e4ae9b5d9 | 4352b5c9e6719d762e6a80e7a7799630d819bca3 | /tutorials/eulerVortex.twitch/eulerVortex.cyclic.twitch.test.test/processor1/4.96/U | 958a1915f4481945b0b387446e4e59d5493126cb | [] | no_license | dashqua/epicProject | d6214b57c545110d08ad053e68bc095f1d4dc725 | 54afca50a61c20c541ef43e3d96408ef72f0bcbc | refs/heads/master | 2022-02-28T17:20:20.291864 | 2019-10-28T13:33:16 | 2019-10-28T13:33:16 | 184,294,390 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 129,826 | /*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 6
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "4.96";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField nonuniform List<vector>
5625
(
(0.866435 0.432874 0)
(0.868224 0.433368 0)
(0.871177 0.434517 0)
(0.874943 0.43618 0)
(0.879215 0.43823 0)
(0.883732 0.440543 0)
(0.888299 0.442974 0)
(0.892763 0.445394 0)
(0.896991 0.447688 0)
(0.900893 0.4497 0)
(0.904434 0.451221 0)
(0.90761 0.452071 0)
(0.91049 0.452066 0)
(0.913209 0.450994 0)
(0.915913 0.448674 0)
(0.918832 0.444966 0)
(0.922364 0.439773 0)
(0.926978 0.433168 0)
(0.93312 0.4254 0)
(0.941228 0.416728 0)
(0.951646 0.407438 0)
(0.9645 0.398051 0)
(0.979785 0.389302 0)
(0.997442 0.381837 0)
(1.01711 0.376108 0)
(1.03796 0.372605 0)
(1.05911 0.371893 0)
(1.07992 0.374369 0)
(1.09957 0.380129 0)
(1.11687 0.388991 0)
(1.1308 0.400519 0)
(1.14093 0.414161 0)
(1.14697 0.429358 0)
(1.14855 0.44535 0)
(1.14538 0.461058 0)
(1.13754 0.475403 0)
(1.12546 0.487682 0)
(1.10983 0.497526 0)
(1.09163 0.504707 0)
(1.07187 0.509173 0)
(1.05136 0.511155 0)
(1.03067 0.511088 0)
(1.01037 0.509426 0)
(0.990991 0.50658 0)
(0.972917 0.502944 0)
(0.956336 0.498893 0)
(0.941327 0.494711 0)
(0.92802 0.490532 0)
(0.916614 0.486368 0)
(0.907276 0.482196 0)
(0.900019 0.478026 0)
(0.894678 0.473914 0)
(0.890988 0.469926 0)
(0.88871 0.466091 0)
(0.887712 0.462389 0)
(0.887975 0.458753 0)
(0.889539 0.45511 0)
(0.892409 0.451418 0)
(0.896474 0.447697 0)
(0.901444 0.444045 0)
(0.906851 0.440636 0)
(0.9121 0.437686 0)
(0.916569 0.435414 0)
(0.91974 0.433981 0)
(0.921305 0.43345 0)
(0.921221 0.433766 0)
(0.919699 0.43477 0)
(0.917121 0.43624 0)
(0.913935 0.437942 0)
(0.91056 0.439672 0)
(0.907321 0.441282 0)
(0.904429 0.442685 0)
(0.901985 0.443844 0)
(0.900012 0.444762 0)
(0.898474 0.445465 0)
(0.866458 0.432242 0)
(0.867679 0.432456 0)
(0.870158 0.433387 0)
(0.873551 0.43489 0)
(0.877532 0.43684 0)
(0.88183 0.439113 0)
(0.886251 0.441571 0)
(0.890622 0.444081 0)
(0.894803 0.446523 0)
(0.898711 0.448758 0)
(0.902296 0.450629 0)
(0.905531 0.451963 0)
(0.908454 0.452573 0)
(0.911159 0.452289 0)
(0.913771 0.450961 0)
(0.9165 0.448424 0)
(0.919654 0.444587 0)
(0.923549 0.439538 0)
(0.92852 0.433406 0)
(0.934966 0.4263 0)
(0.943245 0.41852 0)
(0.953552 0.410657 0)
(0.965951 0.403285 0)
(0.980333 0.396774 0)
(0.996306 0.391547 0)
(1.01331 0.388219 0)
(1.03084 0.387292 0)
(1.04827 0.388925 0)
(1.06462 0.393121 0)
(1.07894 0.399826 0)
(1.09069 0.408822 0)
(1.09946 0.419703 0)
(1.10471 0.431903 0)
(1.10593 0.444645 0)
(1.10302 0.457043 0)
(1.09624 0.468388 0)
(1.08602 0.47826 0)
(1.07297 0.486361 0)
(1.05786 0.492447 0)
(1.04145 0.49646 0)
(1.02429 0.4986 0)
(1.00687 0.499188 0)
(0.989709 0.498522 0)
(0.973292 0.49687 0)
(0.957953 0.494512 0)
(0.943852 0.491723 0)
(0.931098 0.488696 0)
(0.919863 0.485501 0)
(0.910358 0.482136 0)
(0.902718 0.478598 0)
(0.896914 0.474934 0)
(0.892768 0.471229 0)
(0.890039 0.467562 0)
(0.888541 0.463967 0)
(0.888194 0.460423 0)
(0.889015 0.456872 0)
(0.891053 0.453258 0)
(0.894297 0.449565 0)
(0.898597 0.445844 0)
(0.903624 0.442228 0)
(0.908882 0.438917 0)
(0.913776 0.436146 0)
(0.917722 0.434129 0)
(0.920273 0.433005 0)
(0.921212 0.432801 0)
(0.920586 0.433422 0)
(0.918666 0.434676 0)
(0.915861 0.436325 0)
(0.912606 0.438135 0)
(0.909289 0.439912 0)
(0.906189 0.441526 0)
(0.903475 0.442905 0)
(0.901218 0.444029 0)
(0.899416 0.444908 0)
(0.898026 0.445575 0)
(0.86673 0.431752 0)
(0.867347 0.431636 0)
(0.869305 0.432296 0)
(0.872276 0.433597 0)
(0.875925 0.435411 0)
(0.879974 0.437601 0)
(0.884218 0.440032 0)
(0.888471 0.442592 0)
(0.892585 0.44515 0)
(0.89647 0.447564 0)
(0.900068 0.44971 0)
(0.903352 0.451441 0)
(0.906322 0.452585 0)
(0.909017 0.452985 0)
(0.911559 0.452499 0)
(0.914162 0.450991 0)
(0.917023 0.448397 0)
(0.920321 0.44472 0)
(0.924357 0.439976 0)
(0.92953 0.434299 0)
(0.93614 0.428065 0)
(0.944315 0.421709 0)
(0.954116 0.415511 0)
(0.965508 0.409795 0)
(0.978274 0.405138 0)
(0.992062 0.402102 0)
(1.00639 0.400923 0)
(1.02058 0.401694 0)
(1.03385 0.404584 0)
(1.04564 0.409645 0)
(1.05548 0.416632 0)
(1.0628 0.425131 0)
(1.06698 0.434644 0)
(1.06775 0.444565 0)
(1.06521 0.454274 0)
(1.05959 0.463315 0)
(1.0512 0.471358 0)
(1.0405 0.478101 0)
(1.02812 0.483315 0)
(1.01457 0.486974 0)
(1.0003 0.489238 0)
(0.985734 0.490312 0)
(0.971354 0.490366 0)
(0.957591 0.489565 0)
(0.944714 0.488112 0)
(0.932866 0.486206 0)
(0.922182 0.483969 0)
(0.912862 0.481432 0)
(0.905105 0.478592 0)
(0.899008 0.475472 0)
(0.894509 0.472148 0)
(0.891424 0.468724 0)
(0.889547 0.465281 0)
(0.888745 0.461848 0)
(0.888986 0.458404 0)
(0.890316 0.454896 0)
(0.892782 0.451286 0)
(0.896345 0.447582 0)
(0.900816 0.443872 0)
(0.905823 0.440321 0)
(0.910849 0.437155 0)
(0.915309 0.434617 0)
(0.918671 0.432907 0)
(0.92057 0.432135 0)
(0.920886 0.432282 0)
(0.919749 0.433214 0)
(0.917481 0.434708 0)
(0.914502 0.436517 0)
(0.91123 0.438411 0)
(0.908008 0.440213 0)
(0.905071 0.441811 0)
(0.902549 0.443153 0)
(0.900481 0.44423 0)
(0.898851 0.445064 0)
(0.897606 0.44569 0)
(0.867275 0.431439 0)
(0.867259 0.430945 0)
(0.868655 0.431282 0)
(0.871154 0.432331 0)
(0.874426 0.43396 0)
(0.878192 0.436026 0)
(0.882226 0.438393 0)
(0.886329 0.44095 0)
(0.890353 0.443575 0)
(0.894198 0.446132 0)
(0.897792 0.448497 0)
(0.901089 0.450537 0)
(0.904079 0.45212 0)
(0.906796 0.45311 0)
(0.90934 0.453353 0)
(0.911835 0.452727 0)
(0.914393 0.451186 0)
(0.917212 0.448697 0)
(0.92061 0.44525 0)
(0.924856 0.440986 0)
(0.930084 0.436177 0)
(0.936422 0.431052 0)
(0.944054 0.425852 0)
(0.953029 0.421021 0)
(0.963148 0.417075 0)
(0.974086 0.414313 0)
(0.985441 0.412887 0)
(0.996708 0.413045 0)
(1.00737 0.415015 0)
(1.01696 0.418742 0)
(1.02495 0.423954 0)
(1.03074 0.43037 0)
(1.03394 0.437652 0)
(1.03447 0.445342 0)
(1.03243 0.452989 0)
(1.02792 0.460254 0)
(1.02112 0.466844 0)
(1.01243 0.472468 0)
(1.00232 0.476945 0)
(0.991186 0.480282 0)
(0.979375 0.482585 0)
(0.967283 0.483948 0)
(0.955352 0.484444 0)
(0.943938 0.484177 0)
(0.933251 0.483299 0)
(0.923424 0.48195 0)
(0.914616 0.4802 0)
(0.907035 0.478057 0)
(0.900856 0.475526 0)
(0.896135 0.472658 0)
(0.892781 0.46955 0)
(0.890621 0.466311 0)
(0.889488 0.463018 0)
(0.889301 0.45969 0)
(0.890071 0.456299 0)
(0.89186 0.452801 0)
(0.894704 0.449177 0)
(0.898528 0.445467 0)
(0.903096 0.44179 0)
(0.907998 0.438346 0)
(0.912703 0.43538 0)
(0.916653 0.433134 0)
(0.919378 0.431785 0)
(0.920608 0.431401 0)
(0.920318 0.431916 0)
(0.918713 0.433154 0)
(0.916156 0.434871 0)
(0.913064 0.436813 0)
(0.909823 0.438765 0)
(0.906732 0.440567 0)
(0.90398 0.442131 0)
(0.901658 0.443422 0)
(0.899783 0.444444 0)
(0.89832 0.445227 0)
(0.897213 0.44581 0)
(0.868118 0.431331 0)
(0.867454 0.430424 0)
(0.868243 0.430388 0)
(0.870221 0.431131 0)
(0.873073 0.432522 0)
(0.876514 0.434415 0)
(0.880299 0.436677 0)
(0.884223 0.439187 0)
(0.888132 0.441825 0)
(0.891914 0.444472 0)
(0.895481 0.447 0)
(0.898774 0.449292 0)
(0.901775 0.451237 0)
(0.904522 0.452701 0)
(0.907068 0.453547 0)
(0.909455 0.453681 0)
(0.911794 0.453054 0)
(0.914318 0.451599 0)
(0.917252 0.449303 0)
(0.920696 0.446282 0)
(0.924766 0.442692 0)
(0.929708 0.438688 0)
(0.935709 0.434548 0)
(0.942711 0.430677 0)
(0.950519 0.427392 0)
(0.958966 0.424876 0)
(0.967818 0.423387 0)
(0.976686 0.423229 0)
(0.985126 0.424501 0)
(0.992697 0.427081 0)
(0.998922 0.430832 0)
(1.00338 0.435626 0)
(1.00585 0.441193 0)
(1.00629 0.447149 0)
(1.00469 0.453166 0)
(1.00105 0.458992 0)
(0.99553 0.464365 0)
(0.988486 0.469032 0)
(0.980262 0.472862 0)
(0.97114 0.475866 0)
(0.961417 0.478086 0)
(0.951467 0.479531 0)
(0.941674 0.480216 0)
(0.932315 0.480213 0)
(0.923553 0.479639 0)
(0.915517 0.478586 0)
(0.908384 0.477085 0)
(0.902356 0.475135 0)
(0.897575 0.472756 0)
(0.894054 0.470022 0)
(0.891688 0.46704 0)
(0.89032 0.463919 0)
(0.88983 0.46072 0)
(0.890185 0.45745 0)
(0.891428 0.454078 0)
(0.893627 0.450568 0)
(0.896794 0.446925 0)
(0.90081 0.443223 0)
(0.905392 0.439616 0)
(0.910097 0.436333 0)
(0.914392 0.433631 0)
(0.917758 0.43174 0)
(0.919807 0.430802 0)
(0.920366 0.430834 0)
(0.919505 0.431722 0)
(0.917491 0.433252 0)
(0.914711 0.435164 0)
(0.911566 0.437209 0)
(0.908405 0.439188 0)
(0.905477 0.440967 0)
(0.902927 0.442479 0)
(0.900812 0.443706 0)
(0.899127 0.444666 0)
(0.897827 0.445393 0)
(0.896851 0.44593 0)
(0.869273 0.431458 0)
(0.867958 0.430115 0)
(0.868106 0.429657 0)
(0.869518 0.430038 0)
(0.871902 0.431136 0)
(0.874972 0.432804 0)
(0.878469 0.434911 0)
(0.88218 0.437328 0)
(0.885944 0.439935 0)
(0.889636 0.442612 0)
(0.893154 0.445247 0)
(0.89643 0.447739 0)
(0.899443 0.449967 0)
(0.902204 0.451799 0)
(0.904721 0.453139 0)
(0.907039 0.453927 0)
(0.909288 0.45407 0)
(0.911624 0.453473 0)
(0.914129 0.452154 0)
(0.916896 0.450214 0)
(0.920142 0.447735 0)
(0.92409 0.444827 0)
(0.928764 0.441734 0)
(0.934073 0.438738 0)
(0.939996 0.436044 0)
(0.9465 0.433869 0)
(0.953351 0.432514 0)
(0.960183 0.43219 0)
(0.966658 0.432908 0)
(0.972451 0.434619 0)
(0.977201 0.437318 0)
(0.980616 0.440911 0)
(0.982543 0.445138 0)
(0.982885 0.449713 0)
(0.981549 0.454425 0)
(0.978544 0.459076 0)
(0.974057 0.463425 0)
(0.96836 0.467264 0)
(0.961685 0.470506 0)
(0.954238 0.473143 0)
(0.94629 0.475156 0)
(0.938184 0.476502 0)
(0.930233 0.477172 0)
(0.922645 0.477224 0)
(0.915548 0.476747 0)
(0.909082 0.475792 0)
(0.903426 0.474365 0)
(0.898764 0.472466 0)
(0.895196 0.470132 0)
(0.892702 0.467452 0)
(0.891172 0.464539 0)
(0.890476 0.461486 0)
(0.890539 0.45834 0)
(0.891369 0.455095 0)
(0.893032 0.451718 0)
(0.895589 0.448188 0)
(0.899017 0.444535 0)
(0.903148 0.440869 0)
(0.907653 0.437382 0)
(0.912063 0.434325 0)
(0.915858 0.431956 0)
(0.918579 0.430481 0)
(0.919928 0.429997 0)
(0.919835 0.430464 0)
(0.918452 0.431717 0)
(0.9161 0.433512 0)
(0.913168 0.435584 0)
(0.910033 0.437696 0)
(0.906997 0.439671 0)
(0.904259 0.441403 0)
(0.901923 0.442847 0)
(0.900017 0.444001 0)
(0.898517 0.444892 0)
(0.897372 0.44556 0)
(0.89652 0.44605 0)
(0.870735 0.431844 0)
(0.868796 0.430051 0)
(0.868286 0.429137 0)
(0.869085 0.429104 0)
(0.87095 0.429847 0)
(0.873602 0.431233 0)
(0.876771 0.433132 0)
(0.880233 0.43541 0)
(0.883819 0.437931 0)
(0.887391 0.440586 0)
(0.890837 0.443281 0)
(0.894079 0.445906 0)
(0.897087 0.448329 0)
(0.899847 0.450451 0)
(0.902352 0.452214 0)
(0.904652 0.453528 0)
(0.906843 0.454271 0)
(0.908988 0.454395 0)
(0.911149 0.453952 0)
(0.913483 0.452971 0)
(0.916181 0.45145 0)
(0.919311 0.449489 0)
(0.922854 0.447312 0)
(0.926861 0.445115 0)
(0.931404 0.443055 0)
(0.936382 0.441357 0)
(0.941537 0.440256 0)
(0.946639 0.439866 0)
(0.951507 0.440213 0)
(0.955887 0.441353 0)
(0.959472 0.443319 0)
(0.962043 0.445994 0)
(0.963473 0.449166 0)
(0.963641 0.452661 0)
(0.962452 0.456346 0)
(0.959947 0.460035 0)
(0.956302 0.463511 0)
(0.9517 0.466622 0)
(0.946286 0.46931 0)
(0.94023 0.471538 0)
(0.933787 0.473241 0)
(0.927256 0.474351 0)
(0.920876 0.474862 0)
(0.914795 0.474825 0)
(0.909127 0.474297 0)
(0.904017 0.473301 0)
(0.899646 0.471829 0)
(0.896164 0.469889 0)
(0.893631 0.467534 0)
(0.892001 0.464861 0)
(0.891168 0.461979 0)
(0.891035 0.458966 0)
(0.891571 0.455846 0)
(0.892819 0.452603 0)
(0.894852 0.449207 0)
(0.897712 0.445656 0)
(0.901332 0.442015 0)
(0.905492 0.438431 0)
(0.909818 0.435128 0)
(0.913832 0.432371 0)
(0.917046 0.430409 0)
(0.919074 0.429409 0)
(0.91972 0.429409 0)
(0.919012 0.430311 0)
(0.917177 0.431907 0)
(0.914565 0.433932 0)
(0.911557 0.436122 0)
(0.908491 0.438261 0)
(0.905619 0.440202 0)
(0.903092 0.441865 0)
(0.900977 0.443226 0)
(0.899278 0.444298 0)
(0.897956 0.445116 0)
(0.896958 0.445725 0)
(0.89622 0.446167 0)
(0.872486 0.432497 0)
(0.869983 0.430275 0)
(0.868809 0.428876 0)
(0.868965 0.428374 0)
(0.870265 0.428704 0)
(0.872445 0.429753 0)
(0.875236 0.431387 0)
(0.878412 0.433464 0)
(0.881789 0.435851 0)
(0.885208 0.43844 0)
(0.888549 0.441137 0)
(0.891741 0.443818 0)
(0.894735 0.446371 0)
(0.897485 0.44873 0)
(0.899983 0.450823 0)
(0.902271 0.452527 0)
(0.9044 0.453756 0)
(0.906404 0.454516 0)
(0.90837 0.454808 0)
(0.910433 0.45458 0)
(0.91268 0.453841 0)
(0.915131 0.452731 0)
(0.917849 0.451407 0)
(0.920938 0.449968 0)
(0.924401 0.448544 0)
(0.928099 0.447341 0)
(0.931889 0.446525 0)
(0.935679 0.446171 0)
(0.939322 0.446358 0)
(0.942568 0.44718 0)
(0.945184 0.448642 0)
(0.947035 0.450622 0)
(0.948015 0.452992 0)
(0.947997 0.455667 0)
(0.946912 0.458536 0)
(0.94482 0.461419 0)
(0.941854 0.464142 0)
(0.938127 0.466605 0)
(0.933735 0.46876 0)
(0.928837 0.470541 0)
(0.923666 0.471858 0)
(0.918465 0.472649 0)
(0.913404 0.472917 0)
(0.908593 0.472701 0)
(0.904139 0.472032 0)
(0.900196 0.470908 0)
(0.896927 0.469319 0)
(0.894449 0.467284 0)
(0.892782 0.464873 0)
(0.891865 0.462186 0)
(0.891605 0.459317 0)
(0.891942 0.456323 0)
(0.892886 0.45321 0)
(0.8945 0.449955 0)
(0.896854 0.446538 0)
(0.899956 0.442982 0)
(0.903689 0.439391 0)
(0.90778 0.435948 0)
(0.911821 0.432906 0)
(0.915341 0.430533 0)
(0.917903 0.42905 0)
(0.919211 0.428571 0)
(0.919174 0.429071 0)
(0.917911 0.430395 0)
(0.915706 0.432296 0)
(0.912919 0.434502 0)
(0.909909 0.436763 0)
(0.906966 0.438891 0)
(0.90429 0.440768 0)
(0.901989 0.442342 0)
(0.900097 0.443608 0)
(0.898598 0.444592 0)
(0.897446 0.445335 0)
(0.896584 0.445883 0)
(0.895952 0.446279 0)
(0.874481 0.433405 0)
(0.871508 0.430805 0)
(0.869703 0.428919 0)
(0.869199 0.427906 0)
(0.86989 0.42777 0)
(0.871544 0.428421 0)
(0.873909 0.429724 0)
(0.876755 0.431537 0)
(0.879882 0.433739 0)
(0.883113 0.436215 0)
(0.886327 0.438846 0)
(0.889448 0.441521 0)
(0.892401 0.444161 0)
(0.895125 0.446689 0)
(0.897613 0.448997 0)
(0.899897 0.450987 0)
(0.901994 0.452632 0)
(0.903927 0.453915 0)
(0.905769 0.454765 0)
(0.907608 0.455133 0)
(0.909492 0.455096 0)
(0.91147 0.454765 0)
(0.91363 0.454178 0)
(0.916031 0.453382 0)
(0.918623 0.452529 0)
(0.921331 0.451799 0)
(0.92412 0.451297 0)
(0.926929 0.45109 0)
(0.929591 0.45128 0)
(0.931907 0.451943 0)
(0.933747 0.453051 0)
(0.935026 0.454522 0)
(0.935631 0.456307 0)
(0.93545 0.45836 0)
(0.934453 0.460573 0)
(0.932702 0.462785 0)
(0.930282 0.464868 0)
(0.927251 0.466761 0)
(0.923692 0.468412 0)
(0.919759 0.469735 0)
(0.915655 0.470638 0)
(0.911562 0.471075 0)
(0.907597 0.471058 0)
(0.903848 0.470616 0)
(0.900425 0.469754 0)
(0.897476 0.468456 0)
(0.895143 0.466716 0)
(0.893502 0.464569 0)
(0.892545 0.462093 0)
(0.892206 0.459385 0)
(0.892414 0.456521 0)
(0.893146 0.453535 0)
(0.894441 0.450418 0)
(0.896375 0.447147 0)
(0.898997 0.443718 0)
(0.902273 0.440189 0)
(0.906028 0.436701 0)
(0.909941 0.433477 0)
(0.913589 0.430784 0)
(0.916524 0.428879 0)
(0.918383 0.427938 0)
(0.918969 0.428012 0)
(0.918294 0.429008 0)
(0.916556 0.430719 0)
(0.914073 0.432875 0)
(0.9112 0.435207 0)
(0.908256 0.43749 0)
(0.905482 0.439568 0)
(0.903027 0.441355 0)
(0.90096 0.442824 0)
(0.899289 0.443987 0)
(0.897982 0.444879 0)
(0.896988 0.445547 0)
(0.89625 0.446035 0)
(0.895713 0.446385 0)
(0.876651 0.434536 0)
(0.873343 0.431646 0)
(0.870974 0.4293 0)
(0.869816 0.427759 0)
(0.869863 0.427104 0)
(0.870946 0.427291 0)
(0.872836 0.428199 0)
(0.875302 0.429693 0)
(0.878128 0.43165 0)
(0.88114 0.433947 0)
(0.884208 0.436457 0)
(0.887224 0.43908 0)
(0.8901 0.441744 0)
(0.892787 0.444351 0)
(0.89528 0.446791 0)
(0.897567 0.449012 0)
(0.899633 0.450988 0)
(0.90151 0.45265 0)
(0.903267 0.453925 0)
(0.904955 0.454819 0)
(0.906603 0.455393 0)
(0.90827 0.45567 0)
(0.910028 0.455646 0)
(0.911892 0.455407 0)
(0.91383 0.455105 0)
(0.915832 0.454845 0)
(0.917893 0.454671 0)
(0.919937 0.454663 0)
(0.921819 0.454928 0)
(0.923421 0.45551 0)
(0.924681 0.45638 0)
(0.925523 0.457507 0)
(0.92583 0.458883 0)
(0.925522 0.460465 0)
(0.924607 0.462142 0)
(0.923139 0.463795 0)
(0.921154 0.465346 0)
(0.918682 0.466748 0)
(0.915806 0.467935 0)
(0.912679 0.468814 0)
(0.909466 0.46931 0)
(0.90629 0.469397 0)
(0.90323 0.46909 0)
(0.900365 0.468403 0)
(0.897811 0.467327 0)
(0.895704 0.46584 0)
(0.894153 0.463943 0)
(0.893201 0.461687 0)
(0.892819 0.459155 0)
(0.892944 0.456431 0)
(0.893533 0.453572 0)
(0.894597 0.45059 0)
(0.896197 0.447467 0)
(0.898404 0.444184 0)
(0.901236 0.440766 0)
(0.904604 0.437311 0)
(0.908278 0.434001 0)
(0.911901 0.431087 0)
(0.915048 0.428839 0)
(0.917323 0.427481 0)
(0.918451 0.427132 0)
(0.918341 0.427768 0)
(0.917099 0.429233 0)
(0.914982 0.431279 0)
(0.912321 0.433628 0)
(0.909447 0.436026 0)
(0.906631 0.438282 0)
(0.904063 0.440274 0)
(0.901845 0.441948 0)
(0.900014 0.4433 0)
(0.898555 0.444355 0)
(0.897428 0.445155 0)
(0.89658 0.445747 0)
(0.895955 0.446178 0)
(0.895503 0.446484 0)
(0.878907 0.435839 0)
(0.875435 0.432776 0)
(0.872616 0.430036 0)
(0.870835 0.427976 0)
(0.870222 0.426771 0)
(0.870698 0.426434 0)
(0.872066 0.426881 0)
(0.874096 0.427993 0)
(0.876575 0.42964 0)
(0.879328 0.431689 0)
(0.882209 0.434024 0)
(0.885087 0.436546 0)
(0.88787 0.43916 0)
(0.890517 0.441768 0)
(0.892997 0.444292 0)
(0.895262 0.446684 0)
(0.897298 0.448882 0)
(0.899155 0.450805 0)
(0.900878 0.452418 0)
(0.902475 0.453745 0)
(0.903967 0.454789 0)
(0.905417 0.455523 0)
(0.906879 0.455981 0)
(0.908354 0.456265 0)
(0.90984 0.456456 0)
(0.911353 0.456585 0)
(0.912876 0.456702 0)
(0.914329 0.456908 0)
(0.915627 0.45729 0)
(0.91672 0.457856 0)
(0.917564 0.458592 0)
(0.918072 0.459506 0)
(0.91815 0.460599 0)
(0.917764 0.461814 0)
(0.916938 0.463055 0)
(0.915704 0.464251 0)
(0.914069 0.465359 0)
(0.912056 0.466334 0)
(0.909756 0.4671 0)
(0.907304 0.467569 0)
(0.904824 0.467691 0)
(0.902395 0.467457 0)
(0.900078 0.466881 0)
(0.897952 0.465958 0)
(0.896129 0.464667 0)
(0.894729 0.462993 0)
(0.893825 0.460955 0)
(0.893429 0.458611 0)
(0.893502 0.456042 0)
(0.893997 0.453315 0)
(0.894899 0.450465 0)
(0.896248 0.447486 0)
(0.898111 0.444359 0)
(0.900541 0.441084 0)
(0.903513 0.437719 0)
(0.906879 0.434406 0)
(0.910358 0.431365 0)
(0.913574 0.428864 0)
(0.916127 0.427155 0)
(0.91769 0.426413 0)
(0.918091 0.426682 0)
(0.917342 0.427864 0)
(0.915627 0.429747 0)
(0.913239 0.432059 0)
(0.910499 0.434529 0)
(0.907701 0.436933 0)
(0.905065 0.439115 0)
(0.902729 0.440991 0)
(0.900756 0.442535 0)
(0.899155 0.44376 0)
(0.897897 0.444704 0)
(0.896937 0.445413 0)
(0.89622 0.445934 0)
(0.895697 0.446309 0)
(0.89532 0.446576 0)
(0.881155 0.437238 0)
(0.877694 0.434145 0)
(0.874574 0.431126 0)
(0.872259 0.428594 0)
(0.871005 0.426824 0)
(0.870844 0.425917 0)
(0.871639 0.425845 0)
(0.873183 0.426506 0)
(0.87527 0.427773 0)
(0.877719 0.42951 0)
(0.880364 0.431608 0)
(0.883071 0.433964 0)
(0.885749 0.436468 0)
(0.888333 0.439025 0)
(0.89076 0.441573 0)
(0.892991 0.444047 0)
(0.895031 0.446367 0)
(0.896901 0.448474 0)
(0.898595 0.450358 0)
(0.900113 0.452013 0)
(0.901504 0.453401 0)
(0.902827 0.454507 0)
(0.9041 0.455384 0)
(0.905319 0.456094 0)
(0.906501 0.456656 0)
(0.907668 0.457097 0)
(0.908795 0.457492 0)
(0.909825 0.457929 0)
(0.910719 0.458441 0)
(0.911461 0.459026 0)
(0.912001 0.459694 0)
(0.912262 0.460471 0)
(0.912186 0.461355 0)
(0.911773 0.462285 0)
(0.911046 0.463189 0)
(0.910007 0.464026 0)
(0.908657 0.464771 0)
(0.907034 0.46538 0)
(0.905227 0.465773 0)
(0.903342 0.465883 0)
(0.901464 0.465681 0)
(0.899646 0.465169 0)
(0.897941 0.46435 0)
(0.896431 0.46321 0)
(0.895221 0.461725 0)
(0.894404 0.45989 0)
(0.894025 0.457738 0)
(0.894071 0.455335 0)
(0.894503 0.45275 0)
(0.895294 0.450034 0)
(0.896459 0.447198 0)
(0.898052 0.444228 0)
(0.900138 0.441113 0)
(0.902734 0.43788 0)
(0.905762 0.43463 0)
(0.909018 0.431549 0)
(0.912182 0.428886 0)
(0.914879 0.426905 0)
(0.916762 0.425822 0)
(0.917593 0.42574 0)
(0.917306 0.426623 0)
(0.916005 0.428305 0)
(0.913929 0.430534 0)
(0.91138 0.43303 0)
(0.908656 0.435547 0)
(0.906002 0.437897 0)
(0.903584 0.439965 0)
(0.901496 0.441702 0)
(0.899767 0.443104 0)
(0.898386 0.4442 0)
(0.897315 0.445034 0)
(0.896506 0.445654 0)
(0.895907 0.446106 0)
(0.895473 0.44643 0)
(0.895163 0.44666 0)
(0.883297 0.438651 0)
(0.880013 0.435679 0)
(0.876776 0.432527 0)
(0.874061 0.429619 0)
(0.872223 0.427314 0)
(0.871417 0.425815 0)
(0.8716 0.425165 0)
(0.872615 0.425306 0)
(0.874262 0.426121 0)
(0.876353 0.427486 0)
(0.878718 0.429285 0)
(0.881223 0.431405 0)
(0.883761 0.433733 0)
(0.886242 0.436182 0)
(0.888601 0.438682 0)
(0.890808 0.441158 0)
(0.892853 0.443535 0)
(0.894713 0.445772 0)
(0.896372 0.447848 0)
(0.89786 0.449721 0)
(0.899224 0.451354 0)
(0.900482 0.452754 0)
(0.901625 0.453957 0)
(0.902669 0.454983 0)
(0.903655 0.455838 0)
(0.904593 0.456558 0)
(0.90545 0.457213 0)
(0.906198 0.457851 0)
(0.906832 0.458473 0)
(0.907339 0.459089 0)
(0.907668 0.459734 0)
(0.907762 0.460432 0)
(0.907602 0.461158 0)
(0.907205 0.461861 0)
(0.906578 0.462505 0)
(0.905711 0.463068 0)
(0.904609 0.463525 0)
(0.903323 0.463823 0)
(0.901938 0.463898 0)
(0.90053 0.463705 0)
(0.899149 0.463233 0)
(0.897831 0.462488 0)
(0.896633 0.461464 0)
(0.895639 0.460137 0)
(0.894941 0.458487 0)
(0.894603 0.456526 0)
(0.894641 0.454298 0)
(0.895031 0.451868 0)
(0.895743 0.449292 0)
(0.896775 0.4466 0)
(0.898163 0.443787 0)
(0.899967 0.440839 0)
(0.902229 0.437763 0)
(0.90492 0.434627 0)
(0.907903 0.431579 0)
(0.910926 0.42884 0)
(0.913654 0.426672 0)
(0.91574 0.425314 0)
(0.91691 0.424919 0)
(0.917027 0.425509 0)
(0.916125 0.426969 0)
(0.914382 0.429077 0)
(0.912065 0.43156 0)
(0.909466 0.434154 0)
(0.906842 0.436645 0)
(0.904383 0.438889 0)
(0.90221 0.440811 0)
(0.900374 0.442389 0)
(0.898882 0.443643 0)
(0.897707 0.444609 0)
(0.896807 0.445337 0)
(0.896133 0.445873 0)
(0.895638 0.446262 0)
(0.895281 0.446539 0)
(0.895028 0.446735 0)
(0.88525 0.440001 0)
(0.882286 0.437275 0)
(0.879114 0.434161 0)
(0.876166 0.431023 0)
(0.873857 0.428264 0)
(0.872446 0.426184 0)
(0.872 0.424921 0)
(0.872437 0.424479 0)
(0.873594 0.424776 0)
(0.875279 0.425698 0)
(0.87732 0.427127 0)
(0.879577 0.428939 0)
(0.881934 0.431028 0)
(0.884288 0.433308 0)
(0.886565 0.435696 0)
(0.888727 0.438108 0)
(0.890744 0.440482 0)
(0.892585 0.442777 0)
(0.894245 0.444949 0)
(0.895743 0.446949 0)
(0.897097 0.448755 0)
(0.898303 0.45038 0)
(0.899368 0.451828 0)
(0.900326 0.45309 0)
(0.901205 0.454176 0)
(0.901997 0.455129 0)
(0.902683 0.455993 0)
(0.903262 0.456779 0)
(0.90374 0.457492 0)
(0.904095 0.458161 0)
(0.904285 0.458816 0)
(0.904289 0.45946 0)
(0.904114 0.46006 0)
(0.903768 0.460589 0)
(0.903243 0.461035 0)
(0.902534 0.461388 0)
(0.901659 0.461613 0)
(0.900675 0.461656 0)
(0.89965 0.461469 0)
(0.898636 0.461032 0)
(0.897661 0.460347 0)
(0.896759 0.459416 0)
(0.89599 0.45822 0)
(0.895432 0.456739 0)
(0.895158 0.454964 0)
(0.895204 0.452919 0)
(0.895566 0.450657 0)
(0.896222 0.448234 0)
(0.897157 0.44569 0)
(0.89839 0.443034 0)
(0.899969 0.440256 0)
(0.901943 0.437353 0)
(0.90432 0.434367 0)
(0.907016 0.431409 0)
(0.909839 0.428671 0)
(0.912506 0.426399 0)
(0.914689 0.424843 0)
(0.916097 0.424189 0)
(0.916549 0.424513 0)
(0.91601 0.425748 0)
(0.9146 0.427712 0)
(0.912542 0.430146 0)
(0.910108 0.432782 0)
(0.907558 0.435385 0)
(0.9051 0.437784 0)
(0.902874 0.439879 0)
(0.900957 0.441631 0)
(0.89937 0.443042 0)
(0.898101 0.444146 0)
(0.897115 0.444987 0)
(0.896367 0.445614 0)
(0.895812 0.446072 0)
(0.895408 0.446402 0)
(0.895118 0.446637 0)
(0.894913 0.446802 0)
(0.886963 0.44123 0)
(0.884397 0.438829 0)
(0.881464 0.435919 0)
(0.878476 0.432735 0)
(0.875849 0.429658 0)
(0.873922 0.427062 0)
(0.872868 0.425184 0)
(0.872701 0.424111 0)
(0.873315 0.423824 0)
(0.874542 0.424233 0)
(0.876215 0.425216 0)
(0.878182 0.426653 0)
(0.880313 0.428439 0)
(0.882502 0.430485 0)
(0.884672 0.432693 0)
(0.886766 0.434978 0)
(0.88874 0.437283 0)
(0.890562 0.43956 0)
(0.892227 0.441753 0)
(0.893734 0.443818 0)
(0.895077 0.44574 0)
(0.89626 0.447514 0)
(0.897306 0.449121 0)
(0.898241 0.450545 0)
(0.899068 0.451804 0)
(0.899776 0.452934 0)
(0.900367 0.453949 0)
(0.900858 0.454847 0)
(0.901252 0.45564 0)
(0.901525 0.456363 0)
(0.901654 0.457031 0)
(0.901635 0.457632 0)
(0.901484 0.45814 0)
(0.901206 0.458545 0)
(0.90079 0.458846 0)
(0.900238 0.459031 0)
(0.899581 0.459065 0)
(0.89887 0.458901 0)
(0.898154 0.458512 0)
(0.897463 0.457894 0)
(0.896822 0.45705 0)
(0.896269 0.455973 0)
(0.895864 0.454644 0)
(0.895673 0.453046 0)
(0.895746 0.451187 0)
(0.896096 0.449104 0)
(0.896711 0.446847 0)
(0.897574 0.444461 0)
(0.898689 0.441968 0)
(0.900092 0.439363 0)
(0.901829 0.436643 0)
(0.903925 0.43383 0)
(0.906338 0.431007 0)
(0.908931 0.428335 0)
(0.911469 0.426037 0)
(0.913659 0.424361 0)
(0.915213 0.423515 0)
(0.915918 0.423614 0)
(0.915692 0.424641 0)
(0.914595 0.426451 0)
(0.912805 0.428813 0)
(0.910565 0.43146 0)
(0.908128 0.434144 0)
(0.90571 0.436674 0)
(0.903468 0.438926 0)
(0.901496 0.44084 0)
(0.899836 0.442407 0)
(0.898487 0.443648 0)
(0.897423 0.444606 0)
(0.896606 0.445328 0)
(0.895992 0.445861 0)
(0.895541 0.446249 0)
(0.895215 0.446526 0)
(0.894982 0.446723 0)
(0.894817 0.446861 0)
(0.88843 0.442317 0)
(0.886269 0.440261 0)
(0.883687 0.437664 0)
(0.880858 0.434629 0)
(0.878105 0.431432 0)
(0.875798 0.428447 0)
(0.874208 0.426002 0)
(0.873445 0.424289 0)
(0.873478 0.423364 0)
(0.874197 0.423182 0)
(0.875452 0.423646 0)
(0.87708 0.424643 0)
(0.878942 0.426062 0)
(0.88093 0.427797 0)
(0.88296 0.429752 0)
(0.884958 0.431851 0)
(0.886868 0.434029 0)
(0.888657 0.436222 0)
(0.890312 0.438371 0)
(0.891822 0.44044 0)
(0.893171 0.442408 0)
(0.894365 0.444248 0)
(0.895425 0.445935 0)
(0.89636 0.447467 0)
(0.897165 0.448855 0)
(0.897839 0.450108 0)
(0.898403 0.451223 0)
(0.898871 0.452201 0)
(0.899237 0.453061 0)
(0.899481 0.453827 0)
(0.8996 0.454499 0)
(0.899609 0.455061 0)
(0.899518 0.455501 0)
(0.899325 0.455819 0)
(0.899023 0.456015 0)
(0.898628 0.456069 0)
(0.898176 0.455949 0)
(0.89771 0.455626 0)
(0.89726 0.45509 0)
(0.896844 0.454344 0)
(0.896486 0.453385 0)
(0.89623 0.452201 0)
(0.896133 0.450775 0)
(0.896248 0.449103 0)
(0.896598 0.447207 0)
(0.897184 0.44513 0)
(0.897993 0.442913 0)
(0.89902 0.440589 0)
(0.900287 0.438162 0)
(0.901833 0.435631 0)
(0.90369 0.433007 0)
(0.90584 0.430353 0)
(0.90819 0.4278 0)
(0.910556 0.425547 0)
(0.912683 0.423828 0)
(0.914299 0.422862 0)
(0.915179 0.422791 0)
(0.915204 0.42364 0)
(0.914387 0.425304 0)
(0.912858 0.427581 0)
(0.910829 0.430213 0)
(0.908534 0.432951 0)
(0.906191 0.435586 0)
(0.903967 0.437975 0)
(0.901973 0.440038 0)
(0.900263 0.441751 0)
(0.898851 0.443127 0)
(0.897721 0.444201 0)
(0.896841 0.44502 0)
(0.896173 0.445632 0)
(0.895676 0.44608 0)
(0.895313 0.446404 0)
(0.895052 0.446635 0)
(0.894867 0.446799 0)
(0.894737 0.446914 0)
(0.889664 0.44326 0)
(0.887882 0.441539 0)
(0.885688 0.439299 0)
(0.883155 0.436551 0)
(0.880482 0.433445 0)
(0.877985 0.430273 0)
(0.87598 0.427388 0)
(0.874674 0.425076 0)
(0.874131 0.423491 0)
(0.874303 0.422658 0)
(0.875081 0.422528 0)
(0.876316 0.423007 0)
(0.877866 0.423982 0)
(0.879615 0.425337 0)
(0.881463 0.426979 0)
(0.883329 0.42883 0)
(0.885154 0.430812 0)
(0.886896 0.432853 0)
(0.888528 0.434898 0)
(0.89003 0.436911 0)
(0.891391 0.438855 0)
(0.892609 0.440697 0)
(0.893689 0.442414 0)
(0.894634 0.444002 0)
(0.895447 0.445461 0)
(0.89614 0.446779 0)
(0.896726 0.447949 0)
(0.897207 0.448982 0)
(0.897575 0.449892 0)
(0.897833 0.450683 0)
(0.897992 0.451346 0)
(0.898065 0.451873 0)
(0.898055 0.452263 0)
(0.897957 0.452521 0)
(0.897777 0.452639 0)
(0.897541 0.452592 0)
(0.897285 0.452356 0)
(0.897037 0.451918 0)
(0.896815 0.451281 0)
(0.896635 0.450447 0)
(0.896524 0.449409 0)
(0.896528 0.448154 0)
(0.896693 0.446672 0)
(0.897054 0.444972 0)
(0.897622 0.443085 0)
(0.89839 0.441052 0)
(0.89935 0.438907 0)
(0.900513 0.436663 0)
(0.901907 0.434326 0)
(0.903563 0.431903 0)
(0.905479 0.429444 0)
(0.907594 0.427053 0)
(0.909765 0.424903 0)
(0.911778 0.423213 0)
(0.913385 0.4222 0)
(0.914366 0.422023 0)
(0.914579 0.422738 0)
(0.913998 0.424277 0)
(0.912713 0.426466 0)
(0.910897 0.429068 0)
(0.908766 0.431834 0)
(0.906529 0.434547 0)
(0.904356 0.437049 0)
(0.902368 0.439242 0)
(0.900634 0.44109 0)
(0.899179 0.442593 0)
(0.897998 0.443781 0)
(0.897067 0.444697 0)
(0.89635 0.445388 0)
(0.895811 0.445899 0)
(0.895413 0.446272 0)
(0.895125 0.446539 0)
(0.894919 0.44673 0)
(0.894773 0.446864 0)
(0.894671 0.446959 0)
(0.890676 0.444056 0)
(0.88924 0.442644 0)
(0.887425 0.440765 0)
(0.885249 0.438375 0)
(0.882816 0.435525 0)
(0.880337 0.432395 0)
(0.878098 0.429275 0)
(0.876359 0.426488 0)
(0.875283 0.424279 0)
(0.874906 0.422772 0)
(0.875164 0.421985 0)
(0.87595 0.42186 0)
(0.877136 0.422305 0)
(0.878596 0.423212 0)
(0.880221 0.424478 0)
(0.881923 0.426009 0)
(0.883634 0.427724 0)
(0.885306 0.429553 0)
(0.886898 0.431439 0)
(0.88838 0.433334 0)
(0.889741 0.435196 0)
(0.890978 0.436986 0)
(0.892086 0.438682 0)
(0.893061 0.440272 0)
(0.893906 0.441741 0)
(0.894637 0.443075 0)
(0.895262 0.444268 0)
(0.895781 0.445328 0)
(0.896192 0.446259 0)
(0.896502 0.447055 0)
(0.896728 0.447703 0)
(0.896881 0.448201 0)
(0.896963 0.448554 0)
(0.896974 0.448764 0)
(0.896928 0.448818 0)
(0.896853 0.448695 0)
(0.896777 0.44838 0)
(0.89672 0.44787 0)
(0.896696 0.447172 0)
(0.896722 0.446284 0)
(0.896831 0.445199 0)
(0.897063 0.443905 0)
(0.897451 0.442406 0)
(0.898013 0.440721 0)
(0.89875 0.438885 0)
(0.899657 0.436931 0)
(0.900737 0.434882 0)
(0.902011 0.432746 0)
(0.903501 0.430534 0)
(0.905215 0.428286 0)
(0.90711 0.426089 0)
(0.909079 0.424095 0)
(0.910945 0.4225 0)
(0.91249 0.42151 0)
(0.913507 0.421293 0)
(0.913846 0.421925 0)
(0.913454 0.423369 0)
(0.912384 0.425481 0)
(0.910777 0.428044 0)
(0.908821 0.430818 0)
(0.906712 0.433584 0)
(0.904618 0.436174 0)
(0.902666 0.438477 0)
(0.900934 0.440443 0)
(0.899459 0.442061 0)
(0.898243 0.443356 0)
(0.897272 0.444364 0)
(0.896515 0.445133 0)
(0.895939 0.445708 0)
(0.89551 0.446131 0)
(0.895196 0.446437 0)
(0.89497 0.446655 0)
(0.894809 0.44681 0)
(0.894695 0.44692 0)
(0.894616 0.446997 0)
(0.8915 0.444724 0)
(0.890354 0.443574 0)
(0.888888 0.442034 0)
(0.887079 0.440024 0)
(0.884968 0.437527 0)
(0.882676 0.434623 0)
(0.880408 0.431505 0)
(0.878414 0.42845 0)
(0.876909 0.425743 0)
(0.876015 0.423602 0)
(0.875747 0.422134 0)
(0.876047 0.421344 0)
(0.876814 0.421178 0)
(0.87793 0.421547 0)
(0.879284 0.422351 0)
(0.880781 0.423491 0)
(0.882344 0.424877 0)
(0.883912 0.426435 0)
(0.885436 0.428103 0)
(0.886884 0.42982 0)
(0.888238 0.431539 0)
(0.889487 0.433223 0)
(0.890618 0.434848 0)
(0.891627 0.436388 0)
(0.892518 0.437821 0)
(0.893299 0.439133 0)
(0.893975 0.440317 0)
(0.894546 0.441373 0)
(0.895021 0.442295 0)
(0.89541 0.443072 0)
(0.895726 0.443698 0)
(0.895972 0.444173 0)
(0.896153 0.444499 0)
(0.896279 0.44467 0)
(0.896372 0.444672 0)
(0.896456 0.444493 0)
(0.896549 0.444127 0)
(0.896664 0.443579 0)
(0.896815 0.442851 0)
(0.897025 0.441938 0)
(0.897328 0.440834 0)
(0.897753 0.439537 0)
(0.898323 0.43806 0)
(0.899043 0.436431 0)
(0.899913 0.434681 0)
(0.900931 0.432834 0)
(0.90211 0.430908 0)
(0.903466 0.428918 0)
(0.905006 0.426899 0)
(0.906702 0.424926 0)
(0.908472 0.423129 0)
(0.910172 0.421685 0)
(0.911617 0.420785 0)
(0.912619 0.420594 0)
(0.913028 0.421199 0)
(0.912776 0.422586 0)
(0.911889 0.424637 0)
(0.910476 0.427159 0)
(0.908699 0.429927 0)
(0.906734 0.432724 0)
(0.904744 0.435376 0)
(0.902855 0.437765 0)
(0.901152 0.439828 0)
(0.899678 0.441547 0)
(0.898448 0.442937 0)
(0.897451 0.444032 0)
(0.896664 0.444876 0)
(0.896058 0.445512 0)
(0.895602 0.445984 0)
(0.895264 0.446329 0)
(0.89502 0.446577 0)
(0.894844 0.446754 0)
(0.89472 0.446879 0)
(0.894633 0.446968 0)
(0.894572 0.447031 0)
(0.892164 0.445279 0)
(0.891257 0.444353 0)
(0.890092 0.443101 0)
(0.888628 0.441451 0)
(0.886861 0.439347 0)
(0.884852 0.436786 0)
(0.882729 0.433867 0)
(0.88068 0.430786 0)
(0.878912 0.427801 0)
(0.877602 0.425164 0)
(0.876846 0.42306 0)
(0.87665 0.421585 0)
(0.876959 0.420745 0)
(0.87768 0.420493 0)
(0.878709 0.420747 0)
(0.879951 0.421411 0)
(0.88132 0.422392 0)
(0.882747 0.423609 0)
(0.884179 0.424989 0)
(0.885575 0.42647 0)
(0.886903 0.427996 0)
(0.888144 0.429526 0)
(0.889287 0.431027 0)
(0.89033 0.432469 0)
(0.891271 0.433824 0)
(0.892108 0.435078 0)
(0.892842 0.436222 0)
(0.89348 0.437245 0)
(0.894031 0.438132 0)
(0.894507 0.438874 0)
(0.894915 0.439468 0)
(0.89526 0.439916 0)
(0.895551 0.440214 0)
(0.895803 0.440351 0)
(0.896036 0.440314 0)
(0.89627 0.440098 0)
(0.896517 0.439705 0)
(0.896787 0.439141 0)
(0.8971 0.438405 0)
(0.897478 0.437493 0)
(0.897948 0.436402 0)
(0.898535 0.435139 0)
(0.899249 0.433724 0)
(0.900091 0.432188 0)
(0.901061 0.430556 0)
(0.902165 0.42885 0)
(0.903411 0.427092 0)
(0.904805 0.425316 0)
(0.906326 0.423591 0)
(0.907909 0.422029 0)
(0.909438 0.420786 0)
(0.910759 0.420035 0)
(0.911704 0.41993 0)
(0.912137 0.420564 0)
(0.911982 0.421936 0)
(0.911245 0.423951 0)
(0.910008 0.426437 0)
(0.908406 0.429185 0)
(0.906596 0.43199 0)
(0.904729 0.434679 0)
(0.902927 0.437128 0)
(0.901277 0.439266 0)
(0.899828 0.441067 0)
(0.898601 0.442539 0)
(0.897594 0.443711 0)
(0.896789 0.444623 0)
(0.896162 0.445317 0)
(0.895684 0.445836 0)
(0.895327 0.446219 0)
(0.895066 0.446496 0)
(0.894877 0.446695 0)
(0.894743 0.446837 0)
(0.894649 0.446938 0)
(0.894582 0.447009 0)
(0.894536 0.447059 0)
(0.892696 0.44573 0)
(0.891985 0.444995 0)
(0.891065 0.443991 0)
(0.889897 0.442656 0)
(0.888467 0.440925 0)
(0.886782 0.438756 0)
(0.884905 0.436172 0)
(0.882963 0.433279 0)
(0.881125 0.430259 0)
(0.879565 0.427343 0)
(0.878422 0.424754 0)
(0.877771 0.422659 0)
(0.877614 0.421143 0)
(0.877903 0.420216 0)
(0.87856 0.419837 0)
(0.879496 0.419936 0)
(0.880625 0.420425 0)
(0.88187 0.421217 0)
(0.883169 0.422236 0)
(0.884476 0.423413 0)
(0.885754 0.424689 0)
(0.886975 0.42601 0)
(0.888122 0.427336 0)
(0.889185 0.428633 0)
(0.890161 0.429874 0)
(0.891049 0.431036 0)
(0.891846 0.432102 0)
(0.892555 0.433056 0)
(0.893188 0.433886 0)
(0.893752 0.434583 0)
(0.894256 0.43514 0)
(0.894705 0.435555 0)
(0.89511 0.435817 0)
(0.895486 0.43592 0)
(0.895853 0.435855 0)
(0.896223 0.435622 0)
(0.896609 0.435224 0)
(0.897022 0.434663 0)
(0.897482 0.433939 0)
(0.898011 0.43305 0)
(0.898628 0.432001 0)
(0.899348 0.430808 0)
(0.900174 0.429495 0)
(0.901108 0.428089 0)
(0.90215 0.426618 0)
(0.903306 0.425105 0)
(0.904577 0.423589 0)
(0.905944 0.422133 0)
(0.907355 0.420837 0)
(0.908715 0.419837 0)
(0.909897 0.419287 0)
(0.910759 0.419325 0)
(0.91118 0.420037 0)
(0.911084 0.421434 0)
(0.910466 0.423436 0)
(0.909385 0.425893 0)
(0.907952 0.428616 0)
(0.906304 0.431411 0)
(0.904574 0.43411 0)
(0.902878 0.436591 0)
(0.901302 0.438778 0)
(0.8999 0.440639 0)
(0.898696 0.442176 0)
(0.897695 0.443411 0)
(0.896885 0.444381 0)
(0.896246 0.445127 0)
(0.895754 0.445691 0)
(0.895382 0.446109 0)
(0.895107 0.446415 0)
(0.894907 0.446636 0)
(0.894764 0.446794 0)
(0.894662 0.446906 0)
(0.894591 0.446986 0)
(0.894542 0.447043 0)
(0.894507 0.447083 0)
(0.893111 0.446089 0)
(0.892561 0.445513 0)
(0.891842 0.44472 0)
(0.890927 0.443654 0)
(0.889789 0.442255 0)
(0.888418 0.440473 0)
(0.886834 0.43828 0)
(0.88511 0.435711 0)
(0.883363 0.432871 0)
(0.88173 0.429929 0)
(0.880355 0.427083 0)
(0.879351 0.424532 0)
(0.878777 0.422427 0)
(0.878638 0.420842 0)
(0.878895 0.419793 0)
(0.87948 0.419251 0)
(0.880316 0.41916 0)
(0.881328 0.419444 0)
(0.882449 0.42002 0)
(0.883629 0.420813 0)
(0.884825 0.421762 0)
(0.886001 0.42281 0)
(0.88713 0.423908 0)
(0.8882 0.425013 0)
(0.889199 0.426094 0)
(0.890126 0.427122 0)
(0.890979 0.428077 0)
(0.89176 0.428939 0)
(0.892473 0.429692 0)
(0.893125 0.430325 0)
(0.893721 0.430832 0)
(0.89427 0.431203 0)
(0.894786 0.431427 0)
(0.895284 0.431499 0)
(0.895775 0.431416 0)
(0.896271 0.43118 0)
(0.896782 0.430793 0)
(0.897324 0.430254 0)
(0.897914 0.429564 0)
(0.89857 0.428727 0)
(0.899308 0.427756 0)
(0.900132 0.426673 0)
(0.901043 0.425504 0)
(0.90204 0.424278 0)
(0.903123 0.423026 0)
(0.904289 0.421787 0)
(0.905519 0.420622 0)
(0.906772 0.41962 0)
(0.90797 0.418899 0)
(0.909011 0.41859 0)
(0.909776 0.418814 0)
(0.91016 0.41965 0)
(0.910095 0.421105 0)
(0.909568 0.423116 0)
(0.908623 0.42555 0)
(0.90735 0.428238 0)
(0.905862 0.431003 0)
(0.90428 0.433688 0)
(0.902708 0.436174 0)
(0.901226 0.438383 0)
(0.89989 0.44028 0)
(0.898727 0.441861 0)
(0.897748 0.443144 0)
(0.896946 0.444161 0)
(0.896306 0.444951 0)
(0.895807 0.445553 0)
(0.895426 0.446004 0)
(0.895141 0.446336 0)
(0.894932 0.446578 0)
(0.894781 0.446752 0)
(0.894674 0.446876 0)
(0.894599 0.446964 0)
(0.894546 0.447027 0)
(0.89451 0.447071 0)
(0.894484 0.447103 0)
(0.893434 0.446375 0)
(0.893014 0.445927 0)
(0.892459 0.445308 0)
(0.891745 0.444467 0)
(0.890852 0.443354 0)
(0.889763 0.441918 0)
(0.888476 0.440117 0)
(0.88702 0.437935 0)
(0.885461 0.435412 0)
(0.883903 0.432653 0)
(0.882464 0.429804 0)
(0.881258 0.427037 0)
(0.880376 0.42452 0)
(0.879867 0.422387 0)
(0.879735 0.420716 0)
(0.879947 0.419528 0)
(0.88045 0.418803 0)
(0.881185 0.418494 0)
(0.882087 0.418538 0)
(0.883097 0.418866 0)
(0.884167 0.419411 0)
(0.885256 0.420112 0)
(0.886339 0.420915 0)
(0.887392 0.42177 0)
(0.8884 0.422638 0)
(0.889354 0.42349 0)
(0.890249 0.424298 0)
(0.891087 0.425036 0)
(0.89187 0.425686 0)
(0.892601 0.426235 0)
(0.893286 0.426673 0)
(0.893933 0.42699 0)
(0.894554 0.427175 0)
(0.895162 0.427222 0)
(0.895766 0.42713 0)
(0.896375 0.426902 0)
(0.897001 0.426539 0)
(0.897659 0.426043 0)
(0.898362 0.425416 0)
(0.899123 0.424668 0)
(0.899948 0.423819 0)
(0.900842 0.422896 0)
(0.901802 0.42193 0)
(0.902823 0.420953 0)
(0.903899 0.420008 0)
(0.905012 0.419152 0)
(0.906124 0.418465 0)
(0.907173 0.418048 0)
(0.908077 0.418011 0)
(0.908738 0.418453 0)
(0.909071 0.419441 0)
(0.909018 0.42098 0)
(0.908563 0.423014 0)
(0.907739 0.425427 0)
(0.906616 0.428071 0)
(0.905289 0.430787 0)
(0.90386 0.433432 0)
(0.902422 0.435894 0)
(0.901049 0.438097 0)
(0.899796 0.440005 0)
(0.898693 0.441608 0)
(0.897751 0.442921 0)
(0.896971 0.443972 0)
(0.896339 0.444796 0)
(0.895841 0.445429 0)
(0.895457 0.445907 0)
(0.895166 0.446263 0)
(0.894951 0.446523 0)
(0.894795 0.446711 0)
(0.894683 0.446846 0)
(0.894605 0.446943 0)
(0.89455 0.447011 0)
(0.894511 0.44706 0)
(0.894484 0.447095 0)
(0.894465 0.447121 0)
(0.893683 0.446597 0)
(0.893362 0.446253 0)
(0.892939 0.445774 0)
(0.892393 0.445121 0)
(0.891699 0.444247 0)
(0.890845 0.443106 0)
(0.889823 0.441657 0)
(0.888638 0.439867 0)
(0.887322 0.43773 0)
(0.885935 0.435288 0)
(0.884564 0.432634 0)
(0.883308 0.429893 0)
(0.882258 0.427213 0)
(0.881486 0.424735 0)
(0.881032 0.422579 0)
(0.8809 0.420819 0)
(0.881069 0.419482 0)
(0.881498 0.418558 0)
(0.882139 0.418016 0)
(0.882935 0.417807 0)
(0.883836 0.417869 0)
(0.884801 0.418142 0)
(0.885799 0.418574 0)
(0.886803 0.419112 0)
(0.887792 0.419711 0)
(0.888749 0.420332 0)
(0.889668 0.420944 0)
(0.890546 0.42152 0)
(0.891384 0.42204 0)
(0.892182 0.422485 0)
(0.892944 0.422839 0)
(0.893679 0.423091 0)
(0.894394 0.423233 0)
(0.895099 0.423259 0)
(0.895801 0.423169 0)
(0.896507 0.422962 0)
(0.89723 0.42264 0)
(0.897983 0.42221 0)
(0.898776 0.421681 0)
(0.899614 0.421071 0)
(0.900499 0.420403 0)
(0.901426 0.419706 0)
(0.902393 0.419017 0)
(0.903389 0.418379 0)
(0.904396 0.417846 0)
(0.905381 0.417487 0)
(0.906295 0.417387 0)
(0.90707 0.417635 0)
(0.907632 0.418311 0)
(0.907911 0.419465 0)
(0.907861 0.421097 0)
(0.907466 0.423156 0)
(0.906749 0.425544 0)
(0.905767 0.428132 0)
(0.904597 0.430779 0)
(0.903324 0.433358 0)
(0.902029 0.435767 0)
(0.900779 0.437936 0)
(0.899623 0.439826 0)
(0.898592 0.441428 0)
(0.897702 0.442752 0)
(0.896954 0.443821 0)
(0.896343 0.444666 0)
(0.895854 0.445322 0)
(0.895473 0.445822 0)
(0.895182 0.446196 0)
(0.894964 0.446473 0)
(0.894804 0.446674 0)
(0.894689 0.44682 0)
(0.894608 0.446923 0)
(0.894551 0.446997 0)
(0.894511 0.44705 0)
(0.894484 0.447088 0)
(0.894464 0.447115 0)
(0.89445 0.447135 0)
(0.893872 0.446767 0)
(0.893629 0.446507 0)
(0.893307 0.446139 0)
(0.892891 0.445635 0)
(0.892364 0.44496 0)
(0.891704 0.444068 0)
(0.890904 0.442921 0)
(0.889965 0.441485 0)
(0.888894 0.439736 0)
(0.887724 0.437676 0)
(0.886509 0.43534 0)
(0.885323 0.43281 0)
(0.884242 0.430196 0)
(0.883336 0.42762 0)
(0.882664 0.425199 0)
(0.882262 0.423034 0)
(0.882136 0.421196 0)
(0.882269 0.419718 0)
(0.882629 0.418603 0)
(0.883179 0.417831 0)
(0.883879 0.417364 0)
(0.884685 0.417152 0)
(0.88556 0.417145 0)
(0.886475 0.417296 0)
(0.887409 0.417561 0)
(0.888342 0.417897 0)
(0.889261 0.418266 0)
(0.890157 0.418638 0)
(0.891028 0.41899 0)
(0.891874 0.419301 0)
(0.892696 0.419551 0)
(0.893498 0.419726 0)
(0.894287 0.41982 0)
(0.895067 0.419828 0)
(0.895847 0.41975 0)
(0.896633 0.419587 0)
(0.897434 0.419339 0)
(0.898256 0.419014 0)
(0.899105 0.41863 0)
(0.899982 0.418211 0)
(0.900885 0.417786 0)
(0.901805 0.417389 0)
(0.902731 0.41706 0)
(0.903645 0.416848 0)
(0.90452 0.416815 0)
(0.905316 0.417028 0)
(0.90598 0.417558 0)
(0.906453 0.418463 0)
(0.906683 0.419776 0)
(0.906632 0.421495 0)
(0.90629 0.423572 0)
(0.905673 0.425921 0)
(0.904825 0.428432 0)
(0.903808 0.430986 0)
(0.902692 0.433473 0)
(0.901544 0.435801 0)
(0.900424 0.437907 0)
(0.899375 0.439755 0)
(0.898429 0.441332 0)
(0.897601 0.442646 0)
(0.896898 0.443717 0)
(0.896315 0.444571 0)
(0.895844 0.445239 0)
(0.895472 0.445753 0)
(0.895185 0.446141 0)
(0.894968 0.44643 0)
(0.894808 0.446642 0)
(0.894692 0.446796 0)
(0.894609 0.446906 0)
(0.89455 0.446985 0)
(0.89451 0.447041 0)
(0.894482 0.447081 0)
(0.894462 0.44711 0)
(0.894449 0.447131 0)
(0.894439 0.447147 0)
(0.894012 0.446893 0)
(0.893833 0.446699 0)
(0.893592 0.446423 0)
(0.893275 0.446038 0)
(0.892875 0.445518 0)
(0.892375 0.444832 0)
(0.891759 0.443941 0)
(0.891026 0.442807 0)
(0.890179 0.441408 0)
(0.889231 0.439726 0)
(0.88821 0.437768 0)
(0.887164 0.435566 0)
(0.886152 0.433185 0)
(0.885235 0.430717 0)
(0.884466 0.428262 0)
(0.883894 0.425918 0)
(0.883548 0.423772 0)
(0.883432 0.421887 0)
(0.883537 0.420299 0)
(0.883843 0.419018 0)
(0.88432 0.418037 0)
(0.884937 0.417329 0)
(0.885657 0.416858 0)
(0.88645 0.416583 0)
(0.887291 0.416463 0)
(0.888162 0.416461 0)
(0.889048 0.416541 0)
(0.889935 0.416669 0)
(0.890814 0.416817 0)
(0.891683 0.416963 0)
(0.892539 0.417089 0)
(0.893386 0.417181 0)
(0.894224 0.417227 0)
(0.895058 0.417222 0)
(0.895891 0.417165 0)
(0.896729 0.417061 0)
(0.897575 0.416916 0)
(0.898433 0.416741 0)
(0.899301 0.416556 0)
(0.900176 0.416388 0)
(0.901051 0.416267 0)
(0.901914 0.416233 0)
(0.90275 0.416327 0)
(0.903532 0.416597 0)
(0.904229 0.417096 0)
(0.904798 0.417877 0)
(0.905198 0.41898 0)
(0.90539 0.420428 0)
(0.905345 0.422208 0)
(0.905055 0.424279 0)
(0.904533 0.426567 0)
(0.903814 0.428979 0)
(0.902946 0.431416 0)
(0.901983 0.433782 0)
(0.900984 0.436001 0)
(0.899997 0.438016 0)
(0.899062 0.439794 0)
(0.898209 0.441324 0)
(0.897453 0.442608 0)
(0.896803 0.443663 0)
(0.896258 0.444512 0)
(0.895813 0.445183 0)
(0.895456 0.445703 0)
(0.895178 0.446099 0)
(0.894965 0.446396 0)
(0.894806 0.446616 0)
(0.894689 0.446776 0)
(0.894606 0.446892 0)
(0.894547 0.446975 0)
(0.894507 0.447034 0)
(0.894478 0.447076 0)
(0.894459 0.447107 0)
(0.894446 0.447128 0)
(0.894437 0.447145 0)
(0.89443 0.447157 0)
(0.894118 0.44699 0)
(0.89398 0.446843 0)
(0.893805 0.446635 0)
(0.893572 0.446348 0)
(0.893267 0.445955 0)
(0.892886 0.445428 0)
(0.892424 0.444743 0)
(0.891864 0.443867 0)
(0.891203 0.442769 0)
(0.890456 0.441429 0)
(0.889633 0.439837 0)
(0.888759 0.438003 0)
(0.887872 0.435954 0)
(0.887024 0.433743 0)
(0.886264 0.431443 0)
(0.885628 0.429134 0)
(0.885153 0.426898 0)
(0.884866 0.424808 0)
(0.884773 0.422921 0)
(0.884867 0.421269 0)
(0.885134 0.419869 0)
(0.885551 0.418722 0)
(0.886097 0.417815 0)
(0.886745 0.417124 0)
(0.887469 0.416616 0)
(0.888246 0.416259 0)
(0.889061 0.416026 0)
(0.889902 0.415885 0)
(0.890756 0.415807 0)
(0.891616 0.415769 0)
(0.892479 0.415754 0)
(0.89334 0.415751 0)
(0.894199 0.415748 0)
(0.895055 0.415739 0)
(0.89591 0.41572 0)
(0.896765 0.415697 0)
(0.897622 0.41568 0)
(0.898478 0.415686 0)
(0.899327 0.415737 0)
(0.90016 0.415857 0)
(0.900966 0.416075 0)
(0.901729 0.416427 0)
(0.902431 0.416952 0)
(0.903045 0.417688 0)
(0.903541 0.41867 0)
(0.903886 0.419924 0)
(0.904052 0.421458 0)
(0.904021 0.423259 0)
(0.903785 0.425287 0)
(0.903356 0.427483 0)
(0.902759 0.429767 0)
(0.902032 0.432057 0)
(0.901219 0.434278 0)
(0.900366 0.436362 0)
(0.899515 0.438262 0)
(0.898698 0.439949 0)
(0.897943 0.441408 0)
(0.897265 0.442643 0)
(0.896675 0.443666 0)
(0.896173 0.444496 0)
(0.895758 0.445158 0)
(0.895422 0.445675 0)
(0.895157 0.446073 0)
(0.894952 0.446374 0)
(0.894798 0.446599 0)
(0.894684 0.446763 0)
(0.894601 0.446882 0)
(0.894543 0.446968 0)
(0.894502 0.447029 0)
(0.894474 0.447073 0)
(0.894456 0.447104 0)
(0.894443 0.447126 0)
(0.894434 0.447143 0)
(0.894427 0.447156 0)
(0.894423 0.447165 0)
(0.894195 0.447056 0)
(0.894098 0.446951 0)
(0.893962 0.446797 0)
(0.893788 0.446582 0)
(0.893566 0.446287 0)
(0.893284 0.44589 0)
(0.892931 0.445369 0)
(0.892507 0.444698 0)
(0.892007 0.443852 0)
(0.891427 0.442806 0)
(0.890779 0.441546 0)
(0.890078 0.440066 0)
(0.889348 0.438372 0)
(0.888616 0.436492 0)
(0.88792 0.434468 0)
(0.887301 0.432357 0)
(0.886789 0.430223 0)
(0.886412 0.42813 0)
(0.886187 0.426139 0)
(0.886124 0.424298 0)
(0.88622 0.422642 0)
(0.886465 0.421188 0)
(0.886843 0.419942 0)
(0.887335 0.418902 0)
(0.887922 0.418054 0)
(0.888585 0.417376 0)
(0.889307 0.416844 0)
(0.890072 0.416438 0)
(0.890869 0.416137 0)
(0.891686 0.415919 0)
(0.892517 0.415768 0)
(0.893355 0.415669 0)
(0.894199 0.415615 0)
(0.895044 0.415604 0)
(0.895888 0.415635 0)
(0.896724 0.41571 0)
(0.89755 0.415839 0)
(0.89836 0.416038 0)
(0.899147 0.416327 0)
(0.899899 0.41673 0)
(0.900602 0.417272 0)
(0.901239 0.417977 0)
(0.901789 0.418872 0)
(0.90223 0.41998 0)
(0.90254 0.421315 0)
(0.902698 0.422877 0)
(0.902689 0.424647 0)
(0.90251 0.42659 0)
(0.902171 0.428656 0)
(0.901691 0.430781 0)
(0.901099 0.432901 0)
(0.900428 0.434951 0)
(0.899715 0.436877 0)
(0.898993 0.438638 0)
(0.898293 0.44021 0)
(0.897637 0.441581 0)
(0.897041 0.442749 0)
(0.896516 0.443725 0)
(0.896063 0.444523 0)
(0.895684 0.445165 0)
(0.895374 0.445672 0)
(0.895126 0.446065 0)
(0.894932 0.446365 0)
(0.894784 0.446589 0)
(0.894673 0.446756 0)
(0.894593 0.446877 0)
(0.894536 0.446964 0)
(0.894496 0.447027 0)
(0.894469 0.447071 0)
(0.89445 0.447103 0)
(0.894438 0.447126 0)
(0.89443 0.447142 0)
(0.894424 0.447155 0)
(0.89442 0.447165 0)
(0.894417 0.447172 0)
(0.894248 0.447105 0)
(0.894178 0.447027 0)
(0.894082 0.446915 0)
(0.893953 0.446757 0)
(0.893786 0.446538 0)
(0.893576 0.44624 0)
(0.893317 0.445848 0)
(0.893001 0.445343 0)
(0.892623 0.444698 0)
(0.892183 0.443895 0)
(0.891686 0.442917 0)
(0.89114 0.441752 0)
(0.890555 0.440397 0)
(0.889954 0.438859 0)
(0.889362 0.437161 0)
(0.888808 0.435338 0)
(0.888322 0.433434 0)
(0.887926 0.431497 0)
(0.887642 0.42958 0)
(0.887485 0.427732 0)
(0.887461 0.425995 0)
(0.887569 0.424399 0)
(0.887802 0.422964 0)
(0.88815 0.4217 0)
(0.888602 0.420609 0)
(0.889141 0.419687 0)
(0.889752 0.418922 0)
(0.890418 0.418299 0)
(0.89113 0.417806 0)
(0.891877 0.417432 0)
(0.892646 0.417162 0)
(0.893431 0.416984 0)
(0.894224 0.416891 0)
(0.895018 0.416882 0)
(0.895809 0.416956 0)
(0.896592 0.417122 0)
(0.897357 0.417387 0)
(0.898093 0.417762 0)
(0.898788 0.418261 0)
(0.899433 0.4189 0)
(0.900013 0.419697 0)
(0.900513 0.420665 0)
(0.900916 0.421816 0)
(0.901203 0.423151 0)
(0.901361 0.424668 0)
(0.901381 0.426347 0)
(0.901262 0.428158 0)
(0.90101 0.430058 0)
(0.900639 0.431995 0)
(0.900171 0.433919 0)
(0.899631 0.435777 0)
(0.899049 0.437526 0)
(0.898452 0.439133 0)
(0.897865 0.440573 0)
(0.897307 0.441837 0)
(0.896793 0.442923 0)
(0.896334 0.443838 0)
(0.895934 0.444593 0)
(0.895594 0.445206 0)
(0.895312 0.445694 0)
(0.895084 0.446075 0)
(0.894903 0.446368 0)
(0.894764 0.44659 0)
(0.894659 0.446756 0)
(0.894582 0.446877 0)
(0.894527 0.446965 0)
(0.894489 0.447027 0)
(0.894462 0.447072 0)
(0.894445 0.447104 0)
(0.894434 0.447127 0)
(0.894426 0.447143 0)
(0.894421 0.447156 0)
(0.894417 0.447165 0)
(0.894415 0.447172 0)
(0.894413 0.447177 0)
(0.894291 0.447137 0)
(0.894236 0.447083 0)
(0.894166 0.447001 0)
(0.894074 0.446884 0)
(0.893952 0.446723 0)
(0.893797 0.446506 0)
(0.893605 0.446214 0)
(0.893371 0.445832 0)
(0.893091 0.445349 0)
(0.892765 0.444742 0)
(0.892388 0.443995 0)
(0.891967 0.443095 0)
(0.891514 0.442037 0)
(0.89104 0.440818 0)
(0.890562 0.439445 0)
(0.890098 0.437937 0)
(0.88967 0.436323 0)
(0.8893 0.434639 0)
(0.889009 0.432921 0)
(0.888811 0.431209 0)
(0.888718 0.429542 0)
(0.888736 0.427959 0)
(0.888863 0.426485 0)
(0.889095 0.42514 0)
(0.889423 0.423936 0)
(0.889841 0.42288 0)
(0.890337 0.421974 0)
(0.890896 0.421214 0)
(0.891507 0.420594 0)
(0.892158 0.420107 0)
(0.892841 0.41975 0)
(0.893546 0.419516 0)
(0.894262 0.419401 0)
(0.894981 0.419401 0)
(0.895693 0.419517 0)
(0.896387 0.419754 0)
(0.897057 0.420118 0)
(0.897693 0.420617 0)
(0.898284 0.421259 0)
(0.898815 0.42205 0)
(0.899272 0.422996 0)
(0.899644 0.424102 0)
(0.899918 0.425364 0)
(0.900085 0.426772 0)
(0.900137 0.428307 0)
(0.900075 0.429942 0)
(0.899902 0.431643 0)
(0.899629 0.433369 0)
(0.899273 0.435078 0)
(0.898853 0.436729 0)
(0.898391 0.438288 0)
(0.89791 0.439725 0)
(0.897428 0.441022 0)
(0.896964 0.442168 0)
(0.896531 0.443161 0)
(0.896137 0.444003 0)
(0.895789 0.444705 0)
(0.895489 0.445279 0)
(0.895238 0.44574 0)
(0.895032 0.446104 0)
(0.894868 0.446386 0)
(0.894739 0.446601 0)
(0.894642 0.446763 0)
(0.894569 0.446882 0)
(0.894517 0.446968 0)
(0.89448 0.447031 0)
(0.894455 0.447075 0)
(0.894438 0.447107 0)
(0.894428 0.447129 0)
(0.894421 0.447146 0)
(0.894416 0.447157 0)
(0.894414 0.447166 0)
(0.894412 0.447173 0)
(0.89441 0.447178 0)
(0.894409 0.447182 0)
(0.894319 0.447159 0)
(0.89428 0.44712 0)
(0.894228 0.447062 0)
(0.894159 0.446978 0)
(0.894072 0.446858 0)
(0.89396 0.446698 0)
(0.89382 0.446485 0)
(0.893649 0.446206 0)
(0.893442 0.445843 0)
(0.8932 0.445388 0)
(0.89292 0.444826 0)
(0.892607 0.444146 0)
(0.892264 0.443334 0)
(0.891897 0.442387 0)
(0.891521 0.441309 0)
(0.891149 0.440106 0)
(0.890796 0.438792 0)
(0.890478 0.43739 0)
(0.890213 0.43593 0)
(0.890014 0.434443 0)
(0.889894 0.432958 0)
(0.889859 0.431505 0)
(0.889914 0.430114 0)
(0.890061 0.428811 0)
(0.890295 0.427615 0)
(0.890608 0.426539 0)
(0.890994 0.425592 0)
(0.891446 0.424782 0)
(0.891952 0.424111 0)
(0.892501 0.423577 0)
(0.893083 0.423177 0)
(0.893687 0.422912 0)
(0.894304 0.422783 0)
(0.894925 0.42279 0)
(0.895539 0.422934 0)
(0.896135 0.423214 0)
(0.896702 0.423633 0)
(0.897229 0.424194 0)
(0.897706 0.424898 0)
(0.898123 0.425746 0)
(0.898469 0.426735 0)
(0.898734 0.427856 0)
(0.89891 0.429099 0)
(0.898993 0.430447 0)
(0.898981 0.431876 0)
(0.898878 0.433355 0)
(0.898692 0.434853 0)
(0.898433 0.436336 0)
(0.898118 0.437772 0)
(0.897763 0.439133 0)
(0.897384 0.440394 0)
(0.896998 0.44154 0)
(0.896619 0.442559 0)
(0.896261 0.443449 0)
(0.895931 0.444212 0)
(0.895635 0.444852 0)
(0.895377 0.445381 0)
(0.895158 0.44581 0)
(0.894975 0.446151 0)
(0.894827 0.446418 0)
(0.89471 0.446623 0)
(0.89462 0.446778 0)
(0.894553 0.446893 0)
(0.894505 0.446977 0)
(0.89447 0.447038 0)
(0.894447 0.447081 0)
(0.894431 0.447111 0)
(0.894422 0.447133 0)
(0.894416 0.447148 0)
(0.894412 0.447159 0)
(0.894411 0.447168 0)
(0.894409 0.447174 0)
(0.894409 0.447179 0)
(0.894408 0.447183 0)
(0.894407 0.447186 0)
(0.894339 0.447174 0)
(0.894312 0.447145 0)
(0.894273 0.447103 0)
(0.894223 0.447043 0)
(0.89416 0.446958 0)
(0.89408 0.446842 0)
(0.893977 0.446684 0)
(0.893853 0.446478 0)
(0.893703 0.446213 0)
(0.893524 0.445878 0)
(0.89332 0.445459 0)
(0.893089 0.444947 0)
(0.892834 0.444336 0)
(0.892559 0.443618 0)
(0.892271 0.442789 0)
(0.891982 0.441853 0)
(0.891703 0.440819 0)
(0.891446 0.439698 0)
(0.891222 0.438507 0)
(0.891044 0.43727 0)
(0.890922 0.436012 0)
(0.890865 0.434758 0)
(0.890878 0.433534 0)
(0.890965 0.432363 0)
(0.891126 0.431266 0)
(0.891359 0.43026 0)
(0.891654 0.42936 0)
(0.892007 0.428574 0)
(0.892409 0.427912 0)
(0.892855 0.427382 0)
(0.893334 0.426987 0)
(0.893835 0.426726 0)
(0.894347 0.4266 0)
(0.894861 0.426611 0)
(0.895369 0.426762 0)
(0.895859 0.427053 0)
(0.89632 0.427481 0)
(0.896743 0.428044 0)
(0.897117 0.428739 0)
(0.897434 0.429561 0)
(0.897687 0.430501 0)
(0.897868 0.431546 0)
(0.897972 0.432679 0)
(0.898001 0.43388 0)
(0.897955 0.435126 0)
(0.897841 0.43639 0)
(0.897665 0.437646 0)
(0.897438 0.438867 0)
(0.897174 0.440029 0)
(0.896886 0.441114 0)
(0.896586 0.442107 0)
(0.896286 0.442997 0)
(0.895996 0.44378 0)
(0.895725 0.444457 0)
(0.895478 0.44503 0)
(0.895259 0.445508 0)
(0.89507 0.4459 0)
(0.894912 0.446214 0)
(0.894782 0.446462 0)
(0.894678 0.446654 0)
(0.894598 0.4468 0)
(0.894537 0.446909 0)
(0.894492 0.446989 0)
(0.89446 0.447047 0)
(0.894439 0.447089 0)
(0.894425 0.447118 0)
(0.894416 0.447139 0)
(0.894411 0.447153 0)
(0.894408 0.447163 0)
(0.894406 0.44717 0)
(0.894406 0.447175 0)
(0.894406 0.44718 0)
(0.894405 0.447183 0)
(0.894405 0.447187 0)
(0.894405 0.447189 0)
(0.894353 0.447184 0)
(0.894331 0.447163 0)
(0.894307 0.447133 0)
(0.894272 0.447089 0)
(0.894223 0.447028 0)
(0.894163 0.446943 0)
(0.894092 0.44683 0)
(0.894003 0.446681 0)
(0.893895 0.446488 0)
(0.893766 0.44624 0)
(0.893617 0.445931 0)
(0.893448 0.445554 0)
(0.89326 0.445101 0)
(0.893058 0.444562 0)
(0.892845 0.443936 0)
(0.892628 0.443224 0)
(0.892414 0.442428 0)
(0.892211 0.441555 0)
(0.892031 0.440617 0)
(0.891883 0.439629 0)
(0.891776 0.438608 0)
(0.891717 0.437577 0)
(0.891711 0.436554 0)
(0.891762 0.435558 0)
(0.891869 0.43461 0)
(0.892033 0.433729 0)
(0.892254 0.432932 0)
(0.892526 0.432229 0)
(0.892841 0.431629 0)
(0.893193 0.431142 0)
(0.893574 0.430777 0)
(0.893975 0.430538 0)
(0.894387 0.430426 0)
(0.8948 0.430443 0)
(0.895204 0.430588 0)
(0.895591 0.430861 0)
(0.895953 0.431261 0)
(0.896281 0.431782 0)
(0.896565 0.432417 0)
(0.896799 0.433158 0)
(0.896977 0.433991 0)
(0.897098 0.434904 0)
(0.897157 0.435878 0)
(0.897156 0.436893 0)
(0.897097 0.437929 0)
(0.896987 0.438964 0)
(0.896833 0.439976 0)
(0.896645 0.440947 0)
(0.896432 0.441859 0)
(0.896204 0.442701 0)
(0.895971 0.443462 0)
(0.895742 0.444139 0)
(0.895524 0.444729 0)
(0.895323 0.445233 0)
(0.895142 0.445658 0)
(0.894984 0.446007 0)
(0.894848 0.446291 0)
(0.894736 0.446516 0)
(0.894645 0.446693 0)
(0.894573 0.446828 0)
(0.894519 0.44693 0)
(0.894479 0.447005 0)
(0.89445 0.44706 0)
(0.89443 0.447098 0)
(0.894417 0.447126 0)
(0.89441 0.447145 0)
(0.894405 0.447158 0)
(0.894403 0.447167 0)
(0.894403 0.447174 0)
(0.894403 0.447179 0)
(0.894403 0.447182 0)
(0.894403 0.447185 0)
(0.894404 0.447188 0)
(0.894404 0.44719 0)
(0.894403 0.447192 0)
(0.894366 0.44719 0)
(0.894351 0.447175 0)
(0.894327 0.447152 0)
(0.894302 0.447121 0)
(0.89427 0.447077 0)
(0.894229 0.447017 0)
(0.894174 0.446935 0)
(0.89411 0.446826 0)
(0.894033 0.446686 0)
(0.893941 0.446507 0)
(0.893835 0.446283 0)
(0.893713 0.446007 0)
(0.893579 0.445672 0)
(0.893431 0.445275 0)
(0.893274 0.444811 0)
(0.893114 0.444278 0)
(0.892954 0.443677 0)
(0.892803 0.443013 0)
(0.892666 0.442294 0)
(0.89255 0.441528 0)
(0.892462 0.440728 0)
(0.892408 0.439907 0)
(0.892394 0.439084 0)
(0.892423 0.438275 0)
(0.892497 0.437497 0)
(0.892616 0.436765 0)
(0.892778 0.436094 0)
(0.892982 0.435498 0)
(0.893223 0.434989 0)
(0.893493 0.434573 0)
(0.893786 0.434258 0)
(0.894097 0.434051 0)
(0.894417 0.433957 0)
(0.89474 0.433977 0)
(0.895055 0.43411 0)
(0.895354 0.434353 0)
(0.895629 0.434702 0)
(0.895875 0.435153 0)
(0.896085 0.435699 0)
(0.896255 0.43633 0)
(0.896378 0.437031 0)
(0.896453 0.437789 0)
(0.896481 0.438588 0)
(0.896463 0.439411 0)
(0.896404 0.44024 0)
(0.896306 0.441059 0)
(0.896178 0.441851 0)
(0.896026 0.442602 0)
(0.895859 0.443301 0)
(0.895684 0.44394 0)
(0.895507 0.444511 0)
(0.895336 0.445015 0)
(0.895175 0.44545 0)
(0.895028 0.445819 0)
(0.894897 0.446127 0)
(0.894784 0.446379 0)
(0.894689 0.446581 0)
(0.894611 0.44674 0)
(0.894549 0.446862 0)
(0.894501 0.446955 0)
(0.894465 0.447024 0)
(0.894439 0.447074 0)
(0.894422 0.447109 0)
(0.894411 0.447135 0)
(0.894404 0.447152 0)
(0.894401 0.447164 0)
(0.894399 0.447172 0)
(0.894399 0.447177 0)
(0.894399 0.447182 0)
(0.8944 0.447184 0)
(0.894401 0.447187 0)
(0.894402 0.447189 0)
(0.894402 0.447191 0)
(0.894402 0.447192 0)
(0.894402 0.447193 0)
(0.89437 0.447192 0)
(0.894361 0.447182 0)
(0.894348 0.447166 0)
(0.894326 0.447142 0)
(0.894301 0.447111 0)
(0.89427 0.447068 0)
(0.894236 0.447008 0)
(0.894189 0.44693 0)
(0.894133 0.44683 0)
(0.894068 0.446701 0)
(0.893993 0.44654 0)
(0.893907 0.44634 0)
(0.89381 0.446096 0)
(0.893705 0.445805 0)
(0.893593 0.445466 0)
(0.893477 0.445074 0)
(0.893361 0.444629 0)
(0.893249 0.444133 0)
(0.893147 0.443591 0)
(0.89306 0.44301 0)
(0.892991 0.442399 0)
(0.892947 0.441768 0)
(0.892932 0.441128 0)
(0.89295 0.440494 0)
(0.893002 0.439879 0)
(0.893088 0.439296 0)
(0.893207 0.438756 0)
(0.893356 0.438271 0)
(0.893535 0.437856 0)
(0.89374 0.437519 0)
(0.893964 0.437265 0)
(0.894199 0.437097 0)
(0.894441 0.437021 0)
(0.894683 0.437039 0)
(0.894921 0.437153 0)
(0.895146 0.437359 0)
(0.895352 0.437653 0)
(0.895532 0.438028 0)
(0.895682 0.438476 0)
(0.895799 0.438989 0)
(0.895882 0.439555 0)
(0.895929 0.440162 0)
(0.895939 0.440795 0)
(0.895915 0.441441 0)
(0.895859 0.442086 0)
(0.895778 0.442716 0)
(0.895675 0.44332 0)
(0.895556 0.443887 0)
(0.895428 0.444411 0)
(0.895296 0.444885 0)
(0.895165 0.445307 0)
(0.895039 0.445675 0)
(0.894921 0.44599 0)
(0.894815 0.446254 0)
(0.894722 0.446473 0)
(0.894643 0.44665 0)
(0.894578 0.446791 0)
(0.894525 0.4469 0)
(0.894484 0.446983 0)
(0.894453 0.447046 0)
(0.89443 0.447091 0)
(0.894414 0.447123 0)
(0.894404 0.447145 0)
(0.894398 0.447161 0)
(0.894395 0.447171 0)
(0.894395 0.447178 0)
(0.894395 0.447182 0)
(0.894396 0.447185 0)
(0.894397 0.447187 0)
(0.894399 0.447189 0)
(0.8944 0.447191 0)
(0.894401 0.447192 0)
(0.894401 0.447193 0)
(0.894402 0.447194 0)
(0.894402 0.447195 0)
(0.89438 0.447194 0)
(0.894369 0.447186 0)
(0.894357 0.447175 0)
(0.894345 0.447158 0)
(0.894326 0.447134 0)
(0.894303 0.447102 0)
(0.894275 0.447061 0)
(0.894245 0.447005 0)
(0.894206 0.446933 0)
(0.894159 0.446839 0)
(0.894105 0.446722 0)
(0.894045 0.44658 0)
(0.893979 0.446407 0)
(0.893904 0.446196 0)
(0.893824 0.445949 0)
(0.893743 0.445664 0)
(0.893661 0.445339 0)
(0.893581 0.444976 0)
(0.893505 0.444576 0)
(0.893441 0.444144 0)
(0.893393 0.443687 0)
(0.893362 0.443213 0)
(0.893351 0.44273 0)
(0.89336 0.442246 0)
(0.893394 0.441772 0)
(0.893455 0.441322 0)
(0.893543 0.440906 0)
(0.893655 0.440531 0)
(0.893787 0.440205 0)
(0.893936 0.439938 0)
(0.894101 0.439738 0)
(0.894278 0.43961 0)
(0.894459 0.439555 0)
(0.89464 0.439574 0)
(0.894814 0.439668 0)
(0.894978 0.439834 0)
(0.895126 0.440071 0)
(0.895256 0.440373 0)
(0.895363 0.44073 0)
(0.895444 0.441135 0)
(0.895497 0.441578 0)
(0.895522 0.442048 0)
(0.895521 0.442536 0)
(0.895495 0.44303 0)
(0.895447 0.443519 0)
(0.895381 0.443993 0)
(0.895299 0.444443 0)
(0.895208 0.444863 0)
(0.89511 0.445248 0)
(0.895012 0.445593 0)
(0.894915 0.445898 0)
(0.894824 0.446162 0)
(0.894741 0.446386 0)
(0.894666 0.446572 0)
(0.894601 0.446724 0)
(0.894546 0.446845 0)
(0.894501 0.44694 0)
(0.894466 0.447014 0)
(0.894439 0.447068 0)
(0.89442 0.447108 0)
(0.894407 0.447137 0)
(0.894399 0.447157 0)
(0.894394 0.44717 0)
(0.894392 0.447178 0)
(0.894391 0.447184 0)
(0.894392 0.447187 0)
(0.894393 0.447189 0)
(0.894395 0.447191 0)
(0.894396 0.447192 0)
(0.894398 0.447193 0)
(0.894399 0.447193 0)
(0.8944 0.447194 0)
(0.8944 0.447195 0)
(0.894401 0.447196 0)
(0.894401 0.447196 0)
(0.894382 0.447196 0)
(0.894377 0.447189 0)
(0.894366 0.447181 0)
(0.894355 0.447168 0)
(0.894343 0.447151 0)
(0.894328 0.447127 0)
(0.894309 0.447097 0)
(0.894283 0.447057 0)
(0.894257 0.447004 0)
(0.894226 0.44694 0)
(0.894189 0.446857 0)
(0.894146 0.446752 0)
(0.894097 0.446627 0)
(0.894047 0.44648 0)
(0.893993 0.446304 0)
(0.893935 0.446097 0)
(0.893876 0.445862 0)
(0.893821 0.445599 0)
(0.893771 0.445311 0)
(0.893727 0.444997 0)
(0.89369 0.444661 0)
(0.893666 0.44431 0)
(0.893658 0.443951 0)
(0.893668 0.443592 0)
(0.893695 0.44324 0)
(0.893738 0.442901 0)
(0.893801 0.442586 0)
(0.893882 0.442303 0)
(0.89398 0.442059 0)
(0.89409 0.441859 0)
(0.89421 0.441707 0)
(0.894337 0.441611 0)
(0.894469 0.441572 0)
(0.8946 0.441592 0)
(0.894727 0.441669 0)
(0.894844 0.441802 0)
(0.894949 0.441987 0)
(0.895039 0.442221 0)
(0.895112 0.442497 0)
(0.895165 0.442808 0)
(0.895198 0.443147 0)
(0.895211 0.443505 0)
(0.895203 0.443872 0)
(0.895178 0.444241 0)
(0.895137 0.444604 0)
(0.895084 0.444954 0)
(0.895022 0.445284 0)
(0.894953 0.445589 0)
(0.894881 0.445867 0)
(0.894808 0.446113 0)
(0.894738 0.446329 0)
(0.894673 0.446514 0)
(0.894613 0.446669 0)
(0.894562 0.446798 0)
(0.894517 0.446901 0)
(0.894481 0.446983 0)
(0.894452 0.447046 0)
(0.894429 0.447093 0)
(0.894413 0.447127 0)
(0.894401 0.447151 0)
(0.894394 0.447168 0)
(0.894389 0.447179 0)
(0.894388 0.447186 0)
(0.894388 0.44719 0)
(0.894389 0.447192 0)
(0.89439 0.447194 0)
(0.894392 0.447194 0)
(0.894394 0.447195 0)
(0.894396 0.447195 0)
(0.894398 0.447195 0)
(0.894399 0.447195 0)
(0.8944 0.447196 0)
(0.8944 0.447196 0)
(0.894401 0.447197 0)
(0.894401 0.447197 0)
(0.894387 0.447197 0)
(0.894381 0.447192 0)
(0.894374 0.447183 0)
(0.894366 0.447174 0)
(0.894356 0.447162 0)
(0.894344 0.447146 0)
(0.894329 0.447123 0)
(0.894314 0.447094 0)
(0.894294 0.447056 0)
(0.89427 0.447008 0)
(0.894245 0.44695 0)
(0.894216 0.446878 0)
(0.894184 0.446789 0)
(0.894148 0.446681 0)
(0.894111 0.446556 0)
(0.894073 0.446411 0)
(0.894033 0.446245 0)
(0.893995 0.446056 0)
(0.89396 0.445847 0)
(0.89393 0.445621 0)
(0.893907 0.445381 0)
(0.893892 0.445128 0)
(0.893886 0.444868 0)
(0.893892 0.444606 0)
(0.893913 0.444348 0)
(0.893947 0.444102 0)
(0.893992 0.44387 0)
(0.894049 0.443661 0)
(0.894119 0.443481 0)
(0.894199 0.443336 0)
(0.894287 0.443227 0)
(0.894379 0.443159 0)
(0.894472 0.443132 0)
(0.894565 0.443151 0)
(0.894655 0.443214 0)
(0.894738 0.443318 0)
(0.894811 0.443462 0)
(0.894872 0.44364 0)
(0.89492 0.443849 0)
(0.894954 0.444084 0)
(0.894973 0.444337 0)
(0.894978 0.444603 0)
(0.894968 0.444875 0)
(0.894946 0.445146 0)
(0.894912 0.44541 0)
(0.89487 0.445662 0)
(0.894822 0.445899 0)
(0.894771 0.446118 0)
(0.894718 0.446314 0)
(0.894665 0.446488 0)
(0.894615 0.446638 0)
(0.894569 0.446765 0)
(0.894528 0.44687 0)
(0.894492 0.446955 0)
(0.894462 0.447023 0)
(0.894438 0.447076 0)
(0.894419 0.447116 0)
(0.894405 0.447145 0)
(0.894395 0.447166 0)
(0.894389 0.44718 0)
(0.894386 0.447188 0)
(0.894385 0.447194 0)
(0.894386 0.447197 0)
(0.894387 0.447198 0)
(0.894389 0.447198 0)
(0.894391 0.447198 0)
(0.894392 0.447198 0)
(0.894394 0.447197 0)
(0.894396 0.447197 0)
(0.894397 0.447197 0)
(0.894398 0.447197 0)
(0.894399 0.447197 0)
(0.8944 0.447198 0)
(0.8944 0.447198 0)
(0.8944 0.447198 0)
(0.894387 0.447194 0)
(0.894384 0.447192 0)
(0.894381 0.447189 0)
(0.894374 0.44718 0)
(0.894365 0.447169 0)
(0.894357 0.447158 0)
(0.894347 0.447142 0)
(0.894334 0.447119 0)
(0.89432 0.447092 0)
(0.894305 0.447059 0)
(0.894286 0.447016 0)
(0.894266 0.446964 0)
(0.894244 0.446902 0)
(0.89422 0.446826 0)
(0.894195 0.446737 0)
(0.89417 0.446635 0)
(0.894145 0.446518 0)
(0.894119 0.446385 0)
(0.894095 0.446238 0)
(0.894075 0.446078 0)
(0.894061 0.445907 0)
(0.894053 0.445727 0)
(0.894052 0.445542 0)
(0.894058 0.445355 0)
(0.894072 0.44517 0)
(0.894096 0.444993 0)
(0.89413 0.444828 0)
(0.894173 0.44468 0)
(0.894224 0.444552 0)
(0.894281 0.444447 0)
(0.894343 0.444371 0)
(0.894409 0.444326 0)
(0.894475 0.444311 0)
(0.89454 0.444329 0)
(0.894602 0.444378 0)
(0.894658 0.444458 0)
(0.894708 0.444568 0)
(0.894749 0.444703 0)
(0.89478 0.444859 0)
(0.894801 0.445033 0)
(0.894809 0.44522 0)
(0.894808 0.445413 0)
(0.894796 0.44561 0)
(0.894777 0.445806 0)
(0.89475 0.445996 0)
(0.894718 0.446176 0)
(0.894681 0.446343 0)
(0.894642 0.446495 0)
(0.894603 0.446631 0)
(0.894566 0.44675 0)
(0.89453 0.446852 0)
(0.894498 0.446938 0)
(0.89447 0.447008 0)
(0.894446 0.447064 0)
(0.894426 0.447107 0)
(0.894411 0.447139 0)
(0.8944 0.447163 0)
(0.894392 0.44718 0)
(0.894387 0.447191 0)
(0.894384 0.447197 0)
(0.894383 0.447201 0)
(0.894384 0.447203 0)
(0.894385 0.447203 0)
(0.894387 0.447202 0)
(0.894389 0.447202 0)
(0.894391 0.447201 0)
(0.894393 0.4472 0)
(0.894395 0.447199 0)
(0.894396 0.447199 0)
(0.894397 0.447198 0)
(0.894398 0.447198 0)
(0.894399 0.447198 0)
(0.8944 0.447198 0)
(0.8944 0.447199 0)
(0.8944 0.447199 0)
(0.894392 0.447197 0)
(0.894388 0.447193 0)
(0.894382 0.447189 0)
(0.894379 0.447185 0)
(0.894374 0.447177 0)
(0.894367 0.447167 0)
(0.894358 0.447153 0)
(0.894349 0.447138 0)
(0.89434 0.447118 0)
(0.894328 0.447094 0)
(0.894316 0.447063 0)
(0.894302 0.447025 0)
(0.894287 0.446981 0)
(0.894272 0.44693 0)
(0.894256 0.446867 0)
(0.894236 0.446794 0)
(0.894219 0.446711 0)
(0.894205 0.44662 0)
(0.894192 0.446518 0)
(0.894179 0.446406 0)
(0.89417 0.446285 0)
(0.894165 0.446159 0)
(0.894165 0.44603 0)
(0.894171 0.4459 0)
(0.894184 0.445771 0)
(0.894203 0.445647 0)
(0.894227 0.445531 0)
(0.894258 0.445427 0)
(0.894294 0.445338 0)
(0.894335 0.445267 0)
(0.894378 0.445216 0)
(0.894424 0.445186 0)
(0.89447 0.44518 0)
(0.894516 0.445198 0)
(0.894558 0.445238 0)
(0.894596 0.445299 0)
(0.894627 0.445381 0)
(0.894653 0.445481 0)
(0.894672 0.445596 0)
(0.894684 0.445723 0)
(0.894688 0.445859 0)
(0.894684 0.446 0)
(0.894673 0.446141 0)
(0.894656 0.446279 0)
(0.894635 0.446413 0)
(0.89461 0.446539 0)
(0.894583 0.446655 0)
(0.894555 0.44676 0)
(0.894526 0.446852 0)
(0.894499 0.446931 0)
(0.894474 0.446998 0)
(0.894452 0.447054 0)
(0.894433 0.447099 0)
(0.894418 0.447134 0)
(0.894406 0.447161 0)
(0.894396 0.447179 0)
(0.894389 0.447192 0)
(0.894384 0.4472 0)
(0.894382 0.447205 0)
(0.894382 0.447208 0)
(0.894382 0.447208 0)
(0.894384 0.447208 0)
(0.894386 0.447207 0)
(0.894388 0.447205 0)
(0.89439 0.447204 0)
(0.894392 0.447202 0)
(0.894394 0.447201 0)
(0.894395 0.4472 0)
(0.894397 0.4472 0)
(0.894398 0.447199 0)
(0.894398 0.447199 0)
(0.894399 0.447199 0)
(0.894399 0.447199 0)
(0.8944 0.447199 0)
(0.8944 0.447199 0)
(0.894392 0.447198 0)
(0.89439 0.447194 0)
(0.894387 0.44719 0)
(0.894383 0.447186 0)
(0.894378 0.44718 0)
(0.894372 0.447172 0)
(0.894368 0.447164 0)
(0.894362 0.447152 0)
(0.894353 0.447136 0)
(0.894345 0.447118 0)
(0.894337 0.447097 0)
(0.894328 0.447071 0)
(0.894317 0.447038 0)
(0.894306 0.447 0)
(0.894296 0.446958 0)
(0.894286 0.446908 0)
(0.894275 0.44685 0)
(0.894265 0.446785 0)
(0.894257 0.446714 0)
(0.89425 0.446637 0)
(0.894246 0.446555 0)
(0.894243 0.446469 0)
(0.894246 0.446379 0)
(0.894253 0.446289 0)
(0.894263 0.446201 0)
(0.894276 0.446116 0)
(0.894294 0.446037 0)
(0.894317 0.445967 0)
(0.894344 0.445907 0)
(0.894372 0.445861 0)
(0.894403 0.445829 0)
(0.894435 0.445812 0)
(0.894467 0.445811 0)
(0.894497 0.445826 0)
(0.894525 0.445858 0)
(0.89455 0.445906 0)
(0.894571 0.445968 0)
(0.894588 0.446042 0)
(0.894598 0.446125 0)
(0.894603 0.446217 0)
(0.894602 0.446314 0)
(0.894597 0.446414 0)
(0.894587 0.446514 0)
(0.894573 0.446611 0)
(0.894556 0.446703 0)
(0.894536 0.44679 0)
(0.894515 0.446869 0)
(0.894495 0.446939 0)
(0.894475 0.447001 0)
(0.894456 0.447053 0)
(0.894439 0.447097 0)
(0.894423 0.447132 0)
(0.89441 0.447158 0)
(0.8944 0.447179 0)
(0.894392 0.447194 0)
(0.894387 0.447204 0)
(0.894384 0.44721 0)
(0.894382 0.447213 0)
(0.894381 0.447214 0)
(0.894382 0.447214 0)
(0.894383 0.447212 0)
(0.894385 0.44721 0)
(0.894387 0.447209 0)
(0.894389 0.447207 0)
(0.894391 0.447205 0)
(0.894393 0.447203 0)
(0.894394 0.447202 0)
(0.894396 0.447201 0)
(0.894397 0.4472 0)
(0.894398 0.4472 0)
(0.894399 0.4472 0)
(0.894399 0.447199 0)
(0.8944 0.447199 0)
(0.8944 0.447199 0)
(0.8944 0.447199 0)
(0.894395 0.447196 0)
(0.894393 0.447197 0)
(0.894389 0.447192 0)
(0.894386 0.447188 0)
(0.894383 0.447184 0)
(0.89438 0.447178 0)
(0.894373 0.447171 0)
(0.89437 0.447161 0)
(0.894366 0.447151 0)
(0.894358 0.447137 0)
(0.894351 0.44712 0)
(0.894346 0.447101 0)
(0.89434 0.447079 0)
(0.894332 0.447052 0)
(0.894324 0.44702 0)
(0.894318 0.446986 0)
(0.894313 0.446947 0)
(0.894306 0.446902 0)
(0.8943 0.446852 0)
(0.894298 0.4468 0)
(0.894298 0.446745 0)
(0.894298 0.446687 0)
(0.8943 0.446626 0)
(0.894305 0.446565 0)
(0.894313 0.446505 0)
(0.894325 0.446449 0)
(0.89434 0.446398 0)
(0.894356 0.446352 0)
(0.894375 0.446313 0)
(0.894395 0.446283 0)
(0.894416 0.446263 0)
(0.894438 0.446255 0)
(0.89446 0.446258 0)
(0.89448 0.446273 0)
(0.894499 0.446299 0)
(0.894515 0.446336 0)
(0.894527 0.446382 0)
(0.894536 0.446437 0)
(0.894542 0.446498 0)
(0.894543 0.446563 0)
(0.894541 0.446632 0)
(0.894535 0.446701 0)
(0.894526 0.446771 0)
(0.894514 0.446839 0)
(0.894501 0.446902 0)
(0.894486 0.44696 0)
(0.89447 0.447012 0)
(0.894455 0.447058 0)
(0.894441 0.447098 0)
(0.894427 0.447131 0)
(0.894416 0.447159 0)
(0.894406 0.44718 0)
(0.894398 0.447195 0)
(0.894392 0.447206 0)
(0.894387 0.447213 0)
(0.894383 0.447217 0)
(0.894382 0.447219 0)
(0.894381 0.447219 0)
(0.894382 0.447218 0)
(0.894383 0.447216 0)
(0.894385 0.447214 0)
(0.894387 0.447211 0)
(0.894389 0.447209 0)
(0.894391 0.447207 0)
(0.894392 0.447205 0)
(0.894394 0.447203 0)
(0.894395 0.447202 0)
(0.894397 0.447201 0)
(0.894397 0.4472 0)
(0.894398 0.4472 0)
(0.894399 0.4472 0)
(0.894399 0.4472 0)
(0.894399 0.447199 0)
(0.8944 0.4472 0)
(0.8944 0.447199 0)
(0.894393 0.447196 0)
(0.894393 0.447194 0)
(0.894393 0.447195 0)
(0.894389 0.447191 0)
(0.894385 0.447187 0)
(0.894383 0.447182 0)
(0.894382 0.447176 0)
(0.894377 0.447168 0)
(0.894372 0.447161 0)
(0.894369 0.44715 0)
(0.894364 0.447138 0)
(0.894358 0.447124 0)
(0.894354 0.447108 0)
(0.89435 0.447089 0)
(0.894346 0.447067 0)
(0.89434 0.447041 0)
(0.894336 0.447014 0)
(0.894336 0.446985 0)
(0.894334 0.446953 0)
(0.894332 0.446915 0)
(0.89433 0.446875 0)
(0.894332 0.446836 0)
(0.894338 0.446798 0)
(0.894343 0.446759 0)
(0.894349 0.446719 0)
(0.894357 0.446681 0)
(0.894367 0.446647 0)
(0.89438 0.446619 0)
(0.894394 0.446597 0)
(0.894409 0.44658 0)
(0.894423 0.446569 0)
(0.894438 0.446566 0)
(0.894453 0.446572 0)
(0.894466 0.446585 0)
(0.894478 0.446606 0)
(0.894487 0.446633 0)
(0.894495 0.446668 0)
(0.8945 0.446708 0)
(0.894502 0.446753 0)
(0.894501 0.4468 0)
(0.894498 0.446849 0)
(0.894492 0.446898 0)
(0.894484 0.446945 0)
(0.894475 0.44699 0)
(0.894464 0.447033 0)
(0.894453 0.447072 0)
(0.894442 0.447107 0)
(0.894431 0.447136 0)
(0.89442 0.44716 0)
(0.89441 0.44718 0)
(0.894402 0.447196 0)
(0.894396 0.447207 0)
(0.89439 0.447215 0)
(0.894387 0.447221 0)
(0.894384 0.447224 0)
(0.894383 0.447224 0)
(0.894382 0.447223 0)
(0.894383 0.447221 0)
(0.894384 0.447219 0)
(0.894385 0.447216 0)
(0.894387 0.447214 0)
(0.894389 0.447211 0)
(0.89439 0.447209 0)
(0.894392 0.447206 0)
(0.894393 0.447205 0)
(0.894395 0.447203 0)
(0.894396 0.447202 0)
(0.894397 0.447201 0)
(0.894398 0.4472 0)
(0.894398 0.4472 0)
(0.894399 0.4472 0)
(0.894399 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.894399 0.4472 0)
(0.894394 0.447196 0)
(0.894391 0.447193 0)
(0.894393 0.447192 0)
(0.89439 0.447189 0)
(0.894387 0.447185 0)
(0.894383 0.447181 0)
(0.894381 0.447176 0)
(0.894379 0.447168 0)
(0.894375 0.44716 0)
(0.894372 0.447152 0)
(0.894369 0.447141 0)
(0.894366 0.447127 0)
(0.894362 0.447114 0)
(0.89436 0.4471 0)
(0.894358 0.447083 0)
(0.894355 0.447062 0)
(0.894353 0.447039 0)
(0.894353 0.447018 0)
(0.894355 0.446996 0)
(0.894356 0.446971 0)
(0.894357 0.446944 0)
(0.894359 0.446915 0)
(0.894364 0.44689 0)
(0.894372 0.446867 0)
(0.89438 0.446845 0)
(0.894387 0.446823 0)
(0.894395 0.446804 0)
(0.894405 0.446791 0)
(0.894415 0.446782 0)
(0.894427 0.446779 0)
(0.894437 0.44678 0)
(0.894446 0.446786 0)
(0.894455 0.446799 0)
(0.894462 0.446817 0)
(0.894469 0.446839 0)
(0.894472 0.446864 0)
(0.894474 0.446893 0)
(0.894473 0.446924 0)
(0.894472 0.446958 0)
(0.894468 0.446992 0)
(0.894463 0.447026 0)
(0.894456 0.447059 0)
(0.894448 0.447089 0)
(0.894439 0.447117 0)
(0.894431 0.447142 0)
(0.894423 0.447164 0)
(0.894415 0.447183 0)
(0.894408 0.447198 0)
(0.894401 0.447209 0)
(0.894396 0.447218 0)
(0.894391 0.447223 0)
(0.894388 0.447226 0)
(0.894385 0.447227 0)
(0.894384 0.447227 0)
(0.894383 0.447226 0)
(0.894384 0.447224 0)
(0.894384 0.447222 0)
(0.894385 0.447218 0)
(0.894387 0.447215 0)
(0.894389 0.447213 0)
(0.89439 0.44721 0)
(0.894392 0.447208 0)
(0.894394 0.447206 0)
(0.894395 0.447204 0)
(0.894396 0.447203 0)
(0.894397 0.447202 0)
(0.894398 0.447201 0)
(0.894398 0.447201 0)
(0.894399 0.4472 0)
(0.894399 0.4472 0)
(0.894399 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.894395 0.447198 0)
(0.894398 0.447199 0)
(0.894396 0.447196 0)
(0.894391 0.447193 0)
(0.894392 0.447191 0)
(0.89439 0.447189 0)
(0.894388 0.447184 0)
(0.894386 0.447179 0)
(0.894383 0.447175 0)
(0.894381 0.447169 0)
(0.894379 0.44716 0)
(0.894377 0.447152 0)
(0.894374 0.447145 0)
(0.894371 0.447134 0)
(0.894369 0.447121 0)
(0.894369 0.447108 0)
(0.89437 0.447097 0)
(0.894368 0.447083 0)
(0.894367 0.447065 0)
(0.894367 0.447048 0)
(0.89437 0.447033 0)
(0.894374 0.447017 0)
(0.894377 0.447001 0)
(0.89438 0.446983 0)
(0.894383 0.446967 0)
(0.894389 0.446953 0)
(0.894397 0.446942 0)
(0.894405 0.446933 0)
(0.894411 0.446926 0)
(0.894417 0.446922 0)
(0.894425 0.446921 0)
(0.894432 0.446925 0)
(0.894439 0.446933 0)
(0.894444 0.446943 0)
(0.894448 0.446956 0)
(0.894451 0.446974 0)
(0.894454 0.446994 0)
(0.894455 0.447017 0)
(0.894454 0.44704 0)
(0.89445 0.447063 0)
(0.894446 0.447086 0)
(0.894442 0.447109 0)
(0.894436 0.447131 0)
(0.894431 0.447152 0)
(0.894424 0.447171 0)
(0.894418 0.447186 0)
(0.894411 0.447199 0)
(0.894405 0.44721 0)
(0.8944 0.447219 0)
(0.894396 0.447225 0)
(0.894392 0.447228 0)
(0.894389 0.44723 0)
(0.894387 0.447231 0)
(0.894386 0.44723 0)
(0.894385 0.447228 0)
(0.894385 0.447226 0)
(0.894386 0.447223 0)
(0.894387 0.44722 0)
(0.894388 0.447217 0)
(0.89439 0.447214 0)
(0.894391 0.447211 0)
(0.894392 0.447209 0)
(0.894393 0.447207 0)
(0.894394 0.447205 0)
(0.894396 0.447204 0)
(0.894396 0.447203 0)
(0.894397 0.447202 0)
(0.894398 0.447201 0)
(0.894399 0.447201 0)
(0.894399 0.447201 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.894398 0.447197 0)
(0.894396 0.447197 0)
(0.894396 0.447197 0)
(0.894396 0.447194 0)
(0.894393 0.447192 0)
(0.894392 0.44719 0)
(0.89439 0.447187 0)
(0.894389 0.447183 0)
(0.894388 0.447179 0)
(0.894385 0.447175 0)
(0.894383 0.447169 0)
(0.89438 0.447162 0)
(0.89438 0.447156 0)
(0.894381 0.447148 0)
(0.894378 0.44714 0)
(0.894375 0.44713 0)
(0.894375 0.447119 0)
(0.894377 0.44711 0)
(0.894379 0.447101 0)
(0.894379 0.447089 0)
(0.894379 0.447076 0)
(0.894381 0.447065 0)
(0.894385 0.447056 0)
(0.89439 0.447047 0)
(0.894394 0.447037 0)
(0.894398 0.447028 0)
(0.894401 0.447021 0)
(0.894407 0.447017 0)
(0.894414 0.447015 0)
(0.894419 0.447016 0)
(0.894424 0.447018 0)
(0.894427 0.447022 0)
(0.894432 0.447029 0)
(0.894437 0.447039 0)
(0.894439 0.44705 0)
(0.89444 0.447063 0)
(0.89444 0.447078 0)
(0.894439 0.447094 0)
(0.894439 0.447111 0)
(0.894437 0.447129 0)
(0.894434 0.447146 0)
(0.894429 0.447161 0)
(0.894424 0.447176 0)
(0.894419 0.447188 0)
(0.894414 0.4472 0)
(0.89441 0.447211 0)
(0.894405 0.447219 0)
(0.8944 0.447224 0)
(0.894396 0.447228 0)
(0.894393 0.447231 0)
(0.894391 0.447232 0)
(0.894389 0.447232 0)
(0.894388 0.447231 0)
(0.894388 0.447229 0)
(0.894387 0.447227 0)
(0.894388 0.447224 0)
(0.894388 0.447221 0)
(0.894389 0.447218 0)
(0.89439 0.447215 0)
(0.894391 0.447213 0)
(0.894393 0.44721 0)
(0.894394 0.447208 0)
(0.894395 0.447206 0)
(0.894396 0.447204 0)
(0.894397 0.447203 0)
(0.894398 0.447202 0)
(0.894398 0.447202 0)
(0.894399 0.447201 0)
(0.894399 0.447201 0)
(0.894399 0.4472 0)
(0.894399 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.894398 0.447199 0)
(0.894397 0.447196 0)
(0.894398 0.447196 0)
(0.894396 0.447196 0)
(0.894395 0.447194 0)
(0.894393 0.447191 0)
(0.894394 0.447189 0)
(0.894391 0.447188 0)
(0.894389 0.447183 0)
(0.894388 0.447179 0)
(0.894388 0.447175 0)
(0.894388 0.44717 0)
(0.894384 0.447163 0)
(0.894382 0.447158 0)
(0.894383 0.447153 0)
(0.894385 0.447147 0)
(0.894384 0.447138 0)
(0.894382 0.44713 0)
(0.894383 0.447123 0)
(0.894385 0.447116 0)
(0.894388 0.44711 0)
(0.894389 0.447102 0)
(0.89439 0.447093 0)
(0.894393 0.447087 0)
(0.894397 0.447083 0)
(0.894401 0.44708 0)
(0.894405 0.447077 0)
(0.894409 0.447075 0)
(0.894412 0.447074 0)
(0.894416 0.447076 0)
(0.89442 0.44708 0)
(0.894424 0.447086 0)
(0.894427 0.447092 0)
(0.894428 0.4471 0)
(0.894429 0.44711 0)
(0.89443 0.447122 0)
(0.894431 0.447133 0)
(0.894429 0.447145 0)
(0.894427 0.447157 0)
(0.894424 0.447169 0)
(0.894421 0.447181 0)
(0.894419 0.447192 0)
(0.894416 0.447202 0)
(0.894412 0.44721 0)
(0.894408 0.447217 0)
(0.894404 0.447223 0)
(0.894401 0.447227 0)
(0.894398 0.447231 0)
(0.894396 0.447233 0)
(0.894393 0.447233 0)
(0.894391 0.447233 0)
(0.89439 0.447231 0)
(0.894389 0.447229 0)
(0.894389 0.447227 0)
(0.894389 0.447224 0)
(0.89439 0.447221 0)
(0.894391 0.447218 0)
(0.894392 0.447216 0)
(0.894392 0.447213 0)
(0.894393 0.44721 0)
(0.894394 0.447208 0)
(0.894395 0.447207 0)
(0.894396 0.447206 0)
(0.894397 0.447204 0)
(0.894397 0.447203 0)
(0.894398 0.447202 0)
(0.894398 0.447201 0)
(0.894399 0.447201 0)
(0.894399 0.447201 0)
(0.894399 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.894399 0.447199 0)
(0.894395 0.447196 0)
(0.894397 0.447195 0)
(0.894398 0.447196 0)
(0.894396 0.447194 0)
(0.894393 0.447191 0)
(0.894393 0.447188 0)
(0.894393 0.447187 0)
(0.894392 0.447184 0)
(0.894389 0.447179 0)
(0.894388 0.447176 0)
(0.894389 0.447173 0)
(0.894389 0.447167 0)
(0.894387 0.44716 0)
(0.894386 0.447155 0)
(0.894387 0.447152 0)
(0.894389 0.447147 0)
(0.894389 0.44714 0)
(0.894389 0.447134 0)
(0.894391 0.447129 0)
(0.894393 0.447126 0)
(0.894396 0.447123 0)
(0.894398 0.447119 0)
(0.8944 0.447115 0)
(0.894402 0.447113 0)
(0.894406 0.447112 0)
(0.894409 0.447114 0)
(0.894412 0.447116 0)
(0.894415 0.447118 0)
(0.894417 0.44712 0)
(0.894419 0.447125 0)
(0.894421 0.447133 0)
(0.894422 0.447141 0)
(0.894423 0.447149 0)
(0.894423 0.447157 0)
(0.894423 0.447166 0)
(0.894422 0.447176 0)
(0.89442 0.447185 0)
(0.894419 0.447194 0)
(0.894416 0.447202 0)
(0.894413 0.447209 0)
(0.89441 0.447216 0)
(0.894408 0.447221 0)
(0.894405 0.447226 0)
(0.894402 0.447229 0)
(0.894399 0.447231 0)
(0.894397 0.447232 0)
(0.894395 0.447232 0)
(0.894393 0.447232 0)
(0.894392 0.447231 0)
(0.894392 0.447229 0)
(0.894392 0.447227 0)
(0.894392 0.447224 0)
(0.894391 0.447221 0)
(0.894391 0.447218 0)
(0.894392 0.447216 0)
(0.894393 0.447213 0)
(0.894394 0.447211 0)
(0.894394 0.447209 0)
(0.894395 0.447207 0)
(0.894396 0.447205 0)
(0.894397 0.447204 0)
(0.894398 0.447203 0)
(0.894398 0.447203 0)
(0.894399 0.447202 0)
(0.894399 0.447201 0)
(0.894399 0.447201 0)
(0.894399 0.4472 0)
(0.894399 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.894397 0.447196 0)
(0.894399 0.447199 0)
(0.894401 0.4472 0)
(0.894396 0.447196 0)
(0.894395 0.447194 0)
(0.894397 0.447194 0)
(0.894398 0.447194 0)
(0.894395 0.447191 0)
(0.894393 0.447187 0)
(0.894394 0.447186 0)
(0.894394 0.447185 0)
(0.894392 0.44718 0)
(0.89439 0.447176 0)
(0.894391 0.447173 0)
(0.894392 0.44717 0)
(0.894391 0.447165 0)
(0.89439 0.447159 0)
(0.894391 0.447155 0)
(0.894392 0.447153 0)
(0.894393 0.44715 0)
(0.894394 0.447146 0)
(0.894395 0.447141 0)
(0.894397 0.447139 0)
(0.894399 0.447138 0)
(0.894401 0.447137 0)
(0.894404 0.447137 0)
(0.894405 0.447136 0)
(0.894407 0.447137 0)
(0.894409 0.44714 0)
(0.894412 0.447145 0)
(0.894414 0.447149 0)
(0.894415 0.447154 0)
(0.894415 0.447159 0)
(0.894416 0.447165 0)
(0.894417 0.447172 0)
(0.894417 0.447179 0)
(0.894417 0.447186 0)
(0.894415 0.447193 0)
(0.894414 0.447201 0)
(0.894413 0.447207 0)
(0.894411 0.447213 0)
(0.894409 0.447219 0)
(0.894406 0.447223 0)
(0.894404 0.447227 0)
(0.894402 0.447229 0)
(0.894401 0.447231 0)
(0.894399 0.447232 0)
(0.894397 0.447232 0)
(0.894395 0.447231 0)
(0.894394 0.44723 0)
(0.894393 0.447228 0)
(0.894393 0.447226 0)
(0.894393 0.447223 0)
(0.894393 0.447221 0)
(0.894394 0.447219 0)
(0.894394 0.447216 0)
(0.894395 0.447214 0)
(0.894395 0.447211 0)
(0.894396 0.447209 0)
(0.894396 0.447208 0)
(0.894397 0.447206 0)
(0.894397 0.447205 0)
(0.894398 0.447204 0)
(0.894398 0.447203 0)
(0.894398 0.447202 0)
(0.894399 0.447201 0)
(0.894399 0.447201 0)
(0.894399 0.447201 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.447201 0)
(0.894397 0.447197 0)
(0.894398 0.447197 0)
(0.894401 0.447199 0)
(0.894399 0.447197 0)
(0.894396 0.447194 0)
(0.894395 0.447193 0)
(0.894398 0.447193 0)
(0.894398 0.447192 0)
(0.894394 0.447188 0)
(0.894393 0.447185 0)
(0.894395 0.447184 0)
(0.894395 0.447181 0)
(0.894394 0.447176 0)
(0.894393 0.447174 0)
(0.894394 0.447172 0)
(0.894394 0.447168 0)
(0.894393 0.447164 0)
(0.894393 0.447161 0)
(0.894394 0.447158 0)
(0.894396 0.447156 0)
(0.894397 0.447154 0)
(0.894399 0.447153 0)
(0.8944 0.447151 0)
(0.894401 0.447151 0)
(0.894402 0.447152 0)
(0.894405 0.447154 0)
(0.894406 0.447155 0)
(0.894407 0.447157 0)
(0.894408 0.44716 0)
(0.894409 0.447165 0)
(0.894411 0.447171 0)
(0.894412 0.447176 0)
(0.894413 0.447182 0)
(0.894413 0.447187 0)
(0.894412 0.447193 0)
(0.894411 0.447199 0)
(0.894411 0.447205 0)
(0.894411 0.44721 0)
(0.894409 0.447215 0)
(0.894408 0.44722 0)
(0.894406 0.447224 0)
(0.894404 0.447227 0)
(0.894403 0.447228 0)
(0.894401 0.44723 0)
(0.894399 0.44723 0)
(0.894398 0.447231 0)
(0.894397 0.44723 0)
(0.894397 0.447229 0)
(0.894396 0.447227 0)
(0.894396 0.447225 0)
(0.894395 0.447223 0)
(0.894395 0.447221 0)
(0.894395 0.447218 0)
(0.894395 0.447215 0)
(0.894395 0.447213 0)
(0.894395 0.447211 0)
(0.894396 0.44721 0)
(0.894397 0.447208 0)
(0.894397 0.447206 0)
(0.894398 0.447205 0)
(0.894398 0.447204 0)
(0.894399 0.447203 0)
(0.894399 0.447203 0)
(0.894399 0.447202 0)
(0.894399 0.447201 0)
(0.894399 0.447201 0)
(0.894399 0.447201 0)
(0.894399 0.447201 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.447199 0)
(0.894402 0.447201 0)
(0.894399 0.447198 0)
(0.894396 0.447196 0)
(0.894399 0.447197 0)
(0.894401 0.447198 0)
(0.894399 0.447195 0)
(0.894396 0.447192 0)
(0.894396 0.447191 0)
(0.894399 0.447191 0)
(0.894398 0.447188 0)
(0.894395 0.447185 0)
(0.894395 0.447183 0)
(0.894396 0.447181 0)
(0.894396 0.447178 0)
(0.894395 0.447175 0)
(0.894396 0.447172 0)
(0.894397 0.44717 0)
(0.894397 0.447167 0)
(0.894397 0.447165 0)
(0.894397 0.447163 0)
(0.894397 0.447162 0)
(0.894398 0.447161 0)
(0.8944 0.447161 0)
(0.894401 0.447161 0)
(0.894401 0.447161 0)
(0.894402 0.447163 0)
(0.894404 0.447167 0)
(0.894405 0.44717 0)
(0.894406 0.447173 0)
(0.894406 0.447176 0)
(0.894407 0.44718 0)
(0.894408 0.447186 0)
(0.894408 0.447191 0)
(0.894409 0.447197 0)
(0.894409 0.447202 0)
(0.894408 0.447207 0)
(0.894407 0.447211 0)
(0.894406 0.447216 0)
(0.894405 0.447219 0)
(0.894404 0.447222 0)
(0.894404 0.447225 0)
(0.894403 0.447228 0)
(0.894402 0.447229 0)
(0.894401 0.44723 0)
(0.8944 0.44723 0)
(0.894399 0.447229 0)
(0.894398 0.447228 0)
(0.894397 0.447227 0)
(0.894397 0.447225 0)
(0.894397 0.447223 0)
(0.894396 0.447221 0)
(0.894396 0.447219 0)
(0.894397 0.447217 0)
(0.894397 0.447215 0)
(0.894397 0.447212 0)
(0.894398 0.44721 0)
(0.894398 0.447208 0)
(0.894398 0.447207 0)
(0.894398 0.447205 0)
(0.894398 0.447204 0)
(0.894398 0.447203 0)
(0.894399 0.447203 0)
(0.894399 0.447202 0)
(0.894399 0.447202 0)
(0.894399 0.447201 0)
(0.8944 0.447201 0)
(0.8944 0.447201 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.894399 0.447198 0)
(0.894397 0.447198 0)
(0.8944 0.4472 0)
(0.894402 0.447199 0)
(0.894398 0.447196 0)
(0.894397 0.447195 0)
(0.8944 0.447196 0)
(0.894401 0.447195 0)
(0.894399 0.447192 0)
(0.894396 0.44719 0)
(0.894397 0.44719 0)
(0.894399 0.447188 0)
(0.894399 0.447184 0)
(0.894398 0.447182 0)
(0.894397 0.44718 0)
(0.894398 0.447177 0)
(0.894398 0.447175 0)
(0.894397 0.447173 0)
(0.894397 0.447172 0)
(0.894398 0.44717 0)
(0.894399 0.447168 0)
(0.894399 0.447167 0)
(0.894399 0.447166 0)
(0.8944 0.447167 0)
(0.894401 0.447168 0)
(0.894401 0.44717 0)
(0.894401 0.447171 0)
(0.894401 0.447173 0)
(0.894402 0.447176 0)
(0.894403 0.447181 0)
(0.894404 0.447186 0)
(0.894404 0.44719 0)
(0.894404 0.447193 0)
(0.894404 0.447197 0)
(0.894404 0.447202 0)
(0.894404 0.447207 0)
(0.894404 0.447212 0)
(0.894404 0.447216 0)
(0.894404 0.44722 0)
(0.894404 0.447223 0)
(0.894403 0.447226 0)
(0.894402 0.447227 0)
(0.894402 0.447228 0)
(0.894401 0.447229 0)
(0.8944 0.447229 0)
(0.8944 0.447229 0)
(0.8944 0.447229 0)
(0.894399 0.447228 0)
(0.894399 0.447226 0)
(0.894398 0.447224 0)
(0.894398 0.447222 0)
(0.894399 0.447219 0)
(0.894398 0.447217 0)
(0.894398 0.447214 0)
(0.894398 0.447213 0)
(0.894398 0.447211 0)
(0.894399 0.44721 0)
(0.894399 0.447208 0)
(0.894399 0.447207 0)
(0.894399 0.447205 0)
(0.894399 0.447204 0)
(0.894399 0.447203 0)
(0.8944 0.447202 0)
(0.8944 0.447202 0)
(0.8944 0.447201 0)
(0.8944 0.447201 0)
(0.8944 0.447201 0)
(0.8944 0.447201 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.894402 0.447201 0)
(0.894401 0.447199 0)
(0.894399 0.447197 0)
(0.894398 0.447198 0)
(0.894402 0.447199 0)
(0.894401 0.447197 0)
(0.894398 0.447194 0)
(0.894398 0.447193 0)
(0.8944 0.447194 0)
(0.894402 0.447192 0)
(0.8944 0.447188 0)
(0.894399 0.447187 0)
(0.894399 0.447186 0)
(0.8944 0.447184 0)
(0.8944 0.447182 0)
(0.894399 0.447179 0)
(0.894399 0.447177 0)
(0.894399 0.447175 0)
(0.894399 0.447173 0)
(0.894399 0.447172 0)
(0.894399 0.447171 0)
(0.8944 0.447171 0)
(0.894399 0.447171 0)
(0.894398 0.447171 0)
(0.894398 0.447172 0)
(0.894399 0.447174 0)
(0.8944 0.447177 0)
(0.8944 0.44718 0)
(0.894399 0.447182 0)
(0.894399 0.447185 0)
(0.8944 0.44719 0)
(0.894401 0.447195 0)
(0.894401 0.4472 0)
(0.894401 0.447204 0)
(0.894401 0.447209 0)
(0.894401 0.447213 0)
(0.894401 0.447217 0)
(0.894401 0.44722 0)
(0.894401 0.447223 0)
(0.894401 0.447226 0)
(0.894401 0.447228 0)
(0.894401 0.44723 0)
(0.894401 0.447231 0)
(0.894401 0.447231 0)
(0.894401 0.447231 0)
(0.8944 0.447229 0)
(0.8944 0.447228 0)
(0.8944 0.447227 0)
(0.8944 0.447225 0)
(0.8944 0.447223 0)
(0.8944 0.447221 0)
(0.8944 0.447219 0)
(0.8944 0.447217 0)
(0.8944 0.447215 0)
(0.8944 0.447213 0)
(0.8944 0.447211 0)
(0.8944 0.447209 0)
(0.8944 0.447207 0)
(0.8944 0.447206 0)
(0.8944 0.447205 0)
(0.8944 0.447204 0)
(0.8944 0.447203 0)
(0.8944 0.447202 0)
(0.8944 0.447202 0)
(0.8944 0.447201 0)
(0.8944 0.447201 0)
(0.8944 0.447201 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.894398 0.447198 0)
(0.894401 0.4472 0)
(0.894402 0.4472 0)
(0.894401 0.447198 0)
(0.894398 0.447196 0)
(0.8944 0.447197 0)
(0.894402 0.447197 0)
(0.894401 0.447194 0)
(0.8944 0.447191 0)
(0.8944 0.447191 0)
(0.894401 0.447191 0)
(0.894401 0.447189 0)
(0.894401 0.447186 0)
(0.8944 0.447183 0)
(0.894401 0.447182 0)
(0.894402 0.44718 0)
(0.894401 0.447178 0)
(0.8944 0.447176 0)
(0.894399 0.447175 0)
(0.8944 0.447173 0)
(0.894399 0.447172 0)
(0.894398 0.447172 0)
(0.894399 0.447174 0)
(0.894399 0.447175 0)
(0.894398 0.447176 0)
(0.894397 0.447177 0)
(0.894397 0.44718 0)
(0.894398 0.447184 0)
(0.894398 0.447189 0)
(0.894398 0.447192 0)
(0.894397 0.447195 0)
(0.894396 0.4472 0)
(0.894397 0.447205 0)
(0.894398 0.44721 0)
(0.894398 0.447214 0)
(0.894398 0.447218 0)
(0.894399 0.447222 0)
(0.894399 0.447226 0)
(0.8944 0.447228 0)
(0.8944 0.44723 0)
(0.8944 0.447232 0)
(0.8944 0.447233 0)
(0.8944 0.447233 0)
(0.894401 0.447233 0)
(0.894401 0.447233 0)
(0.894402 0.447232 0)
(0.894402 0.44723 0)
(0.894402 0.447228 0)
(0.894402 0.447226 0)
(0.894402 0.447224 0)
(0.894402 0.447221 0)
(0.894402 0.447219 0)
(0.894402 0.447217 0)
(0.894402 0.447215 0)
(0.894401 0.447213 0)
(0.894401 0.447211 0)
(0.894401 0.447209 0)
(0.894401 0.447208 0)
(0.894401 0.447206 0)
(0.894401 0.447205 0)
(0.894401 0.447204 0)
(0.8944 0.447203 0)
(0.8944 0.447203 0)
(0.8944 0.447202 0)
(0.8944 0.447201 0)
(0.8944 0.447201 0)
(0.8944 0.447201 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.894402 0.4472 0)
(0.894398 0.447198 0)
(0.8944 0.447198 0)
(0.894402 0.447199 0)
(0.894402 0.447198 0)
(0.8944 0.447195 0)
(0.8944 0.447194 0)
(0.894403 0.447194 0)
(0.894403 0.447194 0)
(0.894402 0.447191 0)
(0.894402 0.447188 0)
(0.894403 0.447187 0)
(0.894403 0.447185 0)
(0.894403 0.447183 0)
(0.894402 0.447181 0)
(0.894402 0.447179 0)
(0.894401 0.447178 0)
(0.894402 0.447176 0)
(0.894401 0.447175 0)
(0.8944 0.447175 0)
(0.8944 0.447175 0)
(0.894399 0.447174 0)
(0.894397 0.447174 0)
(0.894396 0.447177 0)
(0.894397 0.44718 0)
(0.894396 0.447183 0)
(0.894395 0.447185 0)
(0.894393 0.447188 0)
(0.894393 0.447193 0)
(0.894394 0.447199 0)
(0.894395 0.447204 0)
(0.894394 0.447208 0)
(0.894394 0.447212 0)
(0.894394 0.447217 0)
(0.894395 0.447222 0)
(0.894396 0.447226 0)
(0.894396 0.447229 0)
(0.894397 0.447232 0)
(0.894398 0.447235 0)
(0.894398 0.447237 0)
(0.894399 0.447238 0)
(0.8944 0.447239 0)
(0.894401 0.447238 0)
(0.894402 0.447238 0)
(0.894402 0.447237 0)
(0.894402 0.447235 0)
(0.894403 0.447234 0)
(0.894403 0.447232 0)
(0.894403 0.447229 0)
(0.894404 0.447227 0)
(0.894403 0.447224 0)
(0.894403 0.447222 0)
(0.894403 0.447219 0)
(0.894403 0.447216 0)
(0.894403 0.447214 0)
(0.894403 0.447212 0)
(0.894403 0.44721 0)
(0.894402 0.447208 0)
(0.894402 0.447207 0)
(0.894402 0.447205 0)
(0.894401 0.447204 0)
(0.894401 0.447203 0)
(0.894401 0.447202 0)
(0.894401 0.447202 0)
(0.8944 0.447201 0)
(0.894401 0.447201 0)
(0.894401 0.447201 0)
(0.894401 0.447201 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.894403 0.447199 0)
(0.894401 0.447198 0)
(0.8944 0.447197 0)
(0.894401 0.447197 0)
(0.894403 0.447197 0)
(0.894403 0.447194 0)
(0.894402 0.447193 0)
(0.894403 0.447192 0)
(0.894404 0.44719 0)
(0.894404 0.447188 0)
(0.894404 0.447186 0)
(0.894404 0.447184 0)
(0.894404 0.447182 0)
(0.894404 0.44718 0)
(0.894404 0.447178 0)
(0.894403 0.447177 0)
(0.894403 0.447176 0)
(0.894402 0.447175 0)
(0.8944 0.447174 0)
(0.894399 0.447175 0)
(0.894398 0.447177 0)
(0.894397 0.447178 0)
(0.894395 0.44718 0)
(0.894394 0.447182 0)
(0.894393 0.447186 0)
(0.894393 0.447192 0)
(0.894392 0.447196 0)
(0.89439 0.447201 0)
(0.894389 0.447206 0)
(0.89439 0.447212 0)
(0.89439 0.447218 0)
(0.89439 0.447223 0)
(0.894391 0.447228 0)
(0.894391 0.447232 0)
(0.894392 0.447237 0)
(0.894394 0.44724 0)
(0.894395 0.447243 0)
(0.894396 0.447246 0)
(0.894398 0.447247 0)
(0.894399 0.447248 0)
(0.8944 0.447248 0)
(0.894401 0.447247 0)
(0.894402 0.447246 0)
(0.894403 0.447244 0)
(0.894404 0.447242 0)
(0.894405 0.447239 0)
(0.894405 0.447236 0)
(0.894405 0.447233 0)
(0.894406 0.44723 0)
(0.894406 0.447228 0)
(0.894406 0.447225 0)
(0.894406 0.447222 0)
(0.894405 0.447219 0)
(0.894405 0.447216 0)
(0.894404 0.447213 0)
(0.894403 0.447211 0)
(0.894403 0.447209 0)
(0.894403 0.447208 0)
(0.894403 0.447206 0)
(0.894402 0.447205 0)
(0.894402 0.447204 0)
(0.894402 0.447203 0)
(0.894401 0.447202 0)
(0.894401 0.447201 0)
(0.8944 0.447201 0)
(0.8944 0.447201 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.894401 0.447198 0)
(0.8944 0.447198 0)
(0.894402 0.447198 0)
(0.894403 0.447198 0)
(0.894402 0.447196 0)
(0.894402 0.447195 0)
(0.894403 0.447195 0)
(0.894405 0.447193 0)
(0.894404 0.44719 0)
(0.894405 0.447188 0)
(0.894405 0.447187 0)
(0.894405 0.447185 0)
(0.894406 0.447182 0)
(0.894406 0.44718 0)
(0.894405 0.447178 0)
(0.894405 0.447177 0)
(0.894404 0.447175 0)
(0.894403 0.447174 0)
(0.894402 0.447175 0)
(0.8944 0.447175 0)
(0.894398 0.447176 0)
(0.894396 0.447178 0)
(0.894395 0.447182 0)
(0.894394 0.447186 0)
(0.894391 0.44719 0)
(0.894389 0.447194 0)
(0.894387 0.4472 0)
(0.894387 0.447207 0)
(0.894387 0.447214 0)
(0.894386 0.44722 0)
(0.894385 0.447226 0)
(0.894385 0.447232 0)
(0.894386 0.447239 0)
(0.894387 0.447245 0)
(0.894388 0.44725 0)
(0.89439 0.447254 0)
(0.894391 0.447257 0)
(0.894393 0.44726 0)
(0.894395 0.447261 0)
(0.894397 0.447262 0)
(0.894399 0.447262 0)
(0.894401 0.447261 0)
(0.894402 0.44726 0)
(0.894404 0.447258 0)
(0.894405 0.447255 0)
(0.894406 0.447252 0)
(0.894407 0.447249 0)
(0.894408 0.447245 0)
(0.894408 0.447241 0)
(0.894408 0.447237 0)
(0.894407 0.447233 0)
(0.894407 0.447229 0)
(0.894407 0.447225 0)
(0.894407 0.447222 0)
(0.894407 0.447219 0)
(0.894407 0.447216 0)
(0.894406 0.447213 0)
(0.894405 0.447211 0)
(0.894404 0.447209 0)
(0.894403 0.447207 0)
(0.894403 0.447205 0)
(0.894402 0.447204 0)
(0.894402 0.447203 0)
(0.894402 0.447203 0)
(0.894401 0.447202 0)
(0.894401 0.447201 0)
(0.894401 0.447201 0)
(0.894401 0.447201 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.894401 0.4472 0)
(0.894402 0.447198 0)
(0.894401 0.447197 0)
(0.894403 0.447196 0)
(0.894403 0.447196 0)
(0.894404 0.447194 0)
(0.894405 0.447192 0)
(0.894405 0.447191 0)
(0.894406 0.44719 0)
(0.894406 0.447187 0)
(0.894407 0.447184 0)
(0.894408 0.447182 0)
(0.894407 0.44718 0)
(0.894407 0.447179 0)
(0.894407 0.447177 0)
(0.894406 0.447176 0)
(0.894404 0.447175 0)
(0.894403 0.447174 0)
(0.894401 0.447175 0)
(0.894399 0.447177 0)
(0.894397 0.447181 0)
(0.894394 0.447184 0)
(0.894391 0.447188 0)
(0.894389 0.447194 0)
(0.894387 0.447201 0)
(0.894386 0.447209 0)
(0.894383 0.447216 0)
(0.894381 0.447224 0)
(0.89438 0.447232 0)
(0.89438 0.447241 0)
(0.894381 0.447249 0)
(0.894381 0.447257 0)
(0.894381 0.447264 0)
(0.894383 0.44727 0)
(0.894384 0.447275 0)
(0.894387 0.447279 0)
(0.894389 0.447282 0)
(0.894392 0.447284 0)
(0.894395 0.447285 0)
(0.894397 0.447285 0)
(0.894399 0.447283 0)
(0.894401 0.447281 0)
(0.894404 0.447278 0)
(0.894406 0.447275 0)
(0.894408 0.44727 0)
(0.894409 0.447266 0)
(0.89441 0.447261 0)
(0.894411 0.447256 0)
(0.894411 0.447251 0)
(0.894412 0.447246 0)
(0.894412 0.447241 0)
(0.894412 0.447236 0)
(0.894411 0.447231 0)
(0.89441 0.447227 0)
(0.894409 0.447222 0)
(0.894408 0.447219 0)
(0.894407 0.447216 0)
(0.894406 0.447213 0)
(0.894406 0.447211 0)
(0.894405 0.447209 0)
(0.894404 0.447207 0)
(0.894403 0.447205 0)
(0.894403 0.447204 0)
(0.894402 0.447203 0)
(0.894402 0.447202 0)
(0.894401 0.447202 0)
(0.894401 0.447201 0)
(0.894401 0.447201 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.894402 0.447198 0)
(0.894402 0.447199 0)
(0.894403 0.447198 0)
(0.894403 0.447196 0)
(0.894404 0.447194 0)
(0.894405 0.447193 0)
(0.894405 0.447192 0)
(0.894407 0.447189 0)
(0.894408 0.447188 0)
(0.894409 0.447185 0)
(0.894409 0.447183 0)
(0.894409 0.44718 0)
(0.894409 0.447178 0)
(0.894408 0.447176 0)
(0.894407 0.447175 0)
(0.894406 0.447174 0)
(0.894404 0.447175 0)
(0.894402 0.447177 0)
(0.8944 0.447179 0)
(0.894396 0.447182 0)
(0.894393 0.447187 0)
(0.894391 0.447194 0)
(0.894388 0.447201 0)
(0.894384 0.447209 0)
(0.89438 0.447218 0)
(0.894378 0.447229 0)
(0.894376 0.447241 0)
(0.894375 0.447252 0)
(0.894374 0.447263 0)
(0.894373 0.447274 0)
(0.894373 0.447283 0)
(0.894375 0.447293 0)
(0.894377 0.447301 0)
(0.894379 0.447308 0)
(0.894381 0.447313 0)
(0.894384 0.447317 0)
(0.894387 0.44732 0)
(0.894391 0.447321 0)
(0.894394 0.44732 0)
(0.894398 0.447318 0)
(0.894402 0.447315 0)
(0.894405 0.447311 0)
(0.894407 0.447305 0)
(0.894409 0.4473 0)
(0.894411 0.447293 0)
(0.894413 0.447287 0)
(0.894414 0.447279 0)
(0.894415 0.447272 0)
(0.894415 0.447265 0)
(0.894415 0.447257 0)
(0.894415 0.447251 0)
(0.894415 0.447244 0)
(0.894414 0.447239 0)
(0.894414 0.447234 0)
(0.894413 0.447229 0)
(0.894412 0.447224 0)
(0.89441 0.44722 0)
(0.894409 0.447216 0)
(0.894408 0.447213 0)
(0.894406 0.44721 0)
(0.894406 0.447208 0)
(0.894405 0.447206 0)
(0.894404 0.447205 0)
(0.894403 0.447204 0)
(0.894402 0.447203 0)
(0.894402 0.447202 0)
(0.894401 0.447201 0)
(0.894401 0.447201 0)
(0.894401 0.447201 0)
(0.894401 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.894402 0.447199 0)
(0.894403 0.447197 0)
(0.894403 0.447197 0)
(0.894405 0.447196 0)
(0.894405 0.447194 0)
(0.894406 0.447192 0)
(0.894408 0.44719 0)
(0.894408 0.447188 0)
(0.894409 0.447185 0)
(0.89441 0.447183 0)
(0.89441 0.447181 0)
(0.89441 0.447179 0)
(0.89441 0.447177 0)
(0.894409 0.447176 0)
(0.894408 0.447175 0)
(0.894406 0.447176 0)
(0.894403 0.447178 0)
(0.8944 0.447181 0)
(0.894397 0.447187 0)
(0.894393 0.447194 0)
(0.894388 0.447202 0)
(0.894383 0.447211 0)
(0.894379 0.447223 0)
(0.894376 0.447237 0)
(0.894372 0.44725 0)
(0.894369 0.447265 0)
(0.894366 0.44728 0)
(0.894364 0.447295 0)
(0.894364 0.44731 0)
(0.894365 0.447324 0)
(0.894366 0.447337 0)
(0.894367 0.447348 0)
(0.89437 0.447358 0)
(0.894374 0.447365 0)
(0.894378 0.447371 0)
(0.894382 0.447374 0)
(0.894387 0.447376 0)
(0.894392 0.447375 0)
(0.894396 0.447371 0)
(0.8944 0.447367 0)
(0.894404 0.44736 0)
(0.894409 0.447353 0)
(0.894412 0.447344 0)
(0.894415 0.447335 0)
(0.894418 0.447325 0)
(0.89442 0.447315 0)
(0.894421 0.447305 0)
(0.894422 0.447295 0)
(0.894422 0.447285 0)
(0.894422 0.447275 0)
(0.894422 0.447266 0)
(0.894421 0.447257 0)
(0.894419 0.447249 0)
(0.894417 0.447242 0)
(0.894416 0.447235 0)
(0.894415 0.44723 0)
(0.894413 0.447225 0)
(0.894412 0.44722 0)
(0.89441 0.447216 0)
(0.894409 0.447213 0)
(0.894407 0.44721 0)
(0.894406 0.447208 0)
(0.894405 0.447206 0)
(0.894404 0.447205 0)
(0.894403 0.447203 0)
(0.894402 0.447202 0)
(0.894402 0.447202 0)
(0.894401 0.447201 0)
(0.894401 0.447201 0)
(0.894401 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.894403 0.447198 0)
(0.894403 0.447198 0)
(0.894404 0.447196 0)
(0.894405 0.447194 0)
(0.894407 0.447194 0)
(0.894408 0.447191 0)
(0.894409 0.447189 0)
(0.89441 0.447187 0)
(0.894411 0.447184 0)
(0.894412 0.447181 0)
(0.894412 0.447179 0)
(0.894412 0.447178 0)
(0.894411 0.447177 0)
(0.894409 0.447177 0)
(0.894407 0.447178 0)
(0.894404 0.447181 0)
(0.8944 0.447185 0)
(0.894396 0.447192 0)
(0.894391 0.447201 0)
(0.894386 0.447212 0)
(0.89438 0.447226 0)
(0.894374 0.447242 0)
(0.894369 0.447259 0)
(0.894363 0.447277 0)
(0.894359 0.447298 0)
(0.894356 0.44732 0)
(0.894353 0.447341 0)
(0.894352 0.447362 0)
(0.894352 0.447381 0)
(0.894352 0.4474 0)
(0.894355 0.447416 0)
(0.894359 0.447431 0)
(0.894364 0.447443 0)
(0.894369 0.447451 0)
(0.894374 0.447456 0)
(0.894381 0.447458 0)
(0.894387 0.447457 0)
(0.894393 0.447453 0)
(0.8944 0.447447 0)
(0.894406 0.447438 0)
(0.894412 0.447427 0)
(0.894417 0.447414 0)
(0.894421 0.447401 0)
(0.894424 0.447386 0)
(0.894426 0.447371 0)
(0.894428 0.447355 0)
(0.894429 0.44734 0)
(0.89443 0.447325 0)
(0.89443 0.447311 0)
(0.894429 0.447298 0)
(0.894429 0.447285 0)
(0.894427 0.447274 0)
(0.894426 0.447263 0)
(0.894424 0.447254 0)
(0.894422 0.447245 0)
(0.89442 0.447237 0)
(0.894417 0.447231 0)
(0.894415 0.447225 0)
(0.894413 0.44722 0)
(0.894411 0.447216 0)
(0.894409 0.447212 0)
(0.894407 0.447209 0)
(0.894406 0.447207 0)
(0.894405 0.447205 0)
(0.894404 0.447204 0)
(0.894403 0.447203 0)
(0.894402 0.447202 0)
(0.894402 0.447201 0)
(0.894401 0.447201 0)
(0.894401 0.4472 0)
(0.894401 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.894403 0.447198 0)
(0.894405 0.447197 0)
(0.894406 0.447196 0)
(0.894407 0.447194 0)
(0.894408 0.447191 0)
(0.894409 0.44719 0)
(0.894411 0.447188 0)
(0.894412 0.447185 0)
(0.894413 0.447183 0)
(0.894414 0.44718 0)
(0.894413 0.447179 0)
(0.894412 0.447178 0)
(0.894411 0.447179 0)
(0.894408 0.447181 0)
(0.894405 0.447185 0)
(0.8944 0.447192 0)
(0.894395 0.447201 0)
(0.894388 0.447213 0)
(0.894381 0.447227 0)
(0.894374 0.447245 0)
(0.894366 0.447267 0)
(0.894359 0.44729 0)
(0.894353 0.447317 0)
(0.894346 0.447344 0)
(0.894341 0.447373 0)
(0.894337 0.447403 0)
(0.894334 0.447433 0)
(0.894334 0.447462 0)
(0.894336 0.447489 0)
(0.894339 0.447514 0)
(0.894342 0.447535 0)
(0.894348 0.447553 0)
(0.894355 0.447567 0)
(0.894363 0.447576 0)
(0.894372 0.447581 0)
(0.894381 0.447581 0)
(0.894391 0.447577 0)
(0.8944 0.447568 0)
(0.894408 0.447556 0)
(0.894415 0.44754 0)
(0.894423 0.447522 0)
(0.894429 0.447502 0)
(0.894434 0.44748 0)
(0.894438 0.447458 0)
(0.894441 0.447435 0)
(0.894442 0.447413 0)
(0.894443 0.44739 0)
(0.894443 0.447369 0)
(0.894443 0.447349 0)
(0.894441 0.44733 0)
(0.894439 0.447312 0)
(0.894437 0.447296 0)
(0.894434 0.447282 0)
(0.894431 0.447269 0)
(0.894428 0.447258 0)
(0.894426 0.447248 0)
(0.894423 0.447239 0)
(0.89442 0.447232 0)
(0.894417 0.447225 0)
(0.894415 0.44722 0)
(0.894412 0.447215 0)
(0.89441 0.447212 0)
(0.894408 0.447209 0)
(0.894406 0.447206 0)
(0.894405 0.447204 0)
(0.894404 0.447203 0)
(0.894403 0.447202 0)
(0.894402 0.447201 0)
(0.894402 0.447201 0)
(0.894401 0.4472 0)
(0.894401 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.894404 0.447198 0)
(0.894405 0.447196 0)
(0.894407 0.447195 0)
(0.894409 0.447194 0)
(0.89441 0.447192 0)
(0.894411 0.447189 0)
(0.894413 0.447186 0)
(0.894414 0.447184 0)
(0.894415 0.447183 0)
(0.894414 0.447182 0)
(0.894413 0.447181 0)
(0.894412 0.447182 0)
(0.894409 0.447186 0)
(0.894405 0.447191 0)
(0.894399 0.447199 0)
(0.894393 0.447211 0)
(0.894385 0.447227 0)
(0.894376 0.447247 0)
(0.894366 0.447271 0)
(0.894356 0.447299 0)
(0.894346 0.44733 0)
(0.894337 0.447365 0)
(0.894328 0.447404 0)
(0.894321 0.447445 0)
(0.894315 0.447487 0)
(0.894312 0.447529 0)
(0.89431 0.44757 0)
(0.89431 0.447609 0)
(0.894313 0.447647 0)
(0.894318 0.44768 0)
(0.894326 0.447708 0)
(0.894335 0.447731 0)
(0.894346 0.447747 0)
(0.894358 0.447757 0)
(0.894371 0.44776 0)
(0.894384 0.447757 0)
(0.894397 0.447748 0)
(0.89441 0.447732 0)
(0.894421 0.447712 0)
(0.894432 0.447687 0)
(0.89444 0.447658 0)
(0.894448 0.447627 0)
(0.894453 0.447594 0)
(0.894458 0.44756 0)
(0.894461 0.447526 0)
(0.894462 0.447492 0)
(0.894462 0.44746 0)
(0.894461 0.447429 0)
(0.89446 0.4474 0)
(0.894457 0.447374 0)
(0.894454 0.447349 0)
(0.894451 0.447327 0)
(0.894447 0.447307 0)
(0.894442 0.44729 0)
(0.894438 0.447274 0)
(0.894433 0.447261 0)
(0.894429 0.447249 0)
(0.894425 0.44724 0)
(0.894422 0.447232 0)
(0.894418 0.447225 0)
(0.894415 0.447219 0)
(0.894413 0.447214 0)
(0.89441 0.447211 0)
(0.894408 0.447208 0)
(0.894406 0.447205 0)
(0.894405 0.447204 0)
(0.894404 0.447202 0)
(0.894403 0.447201 0)
(0.894402 0.447201 0)
(0.894401 0.4472 0)
(0.894401 0.4472 0)
(0.894401 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.894405 0.447199 0)
(0.894407 0.447197 0)
(0.894408 0.447195 0)
(0.894409 0.447193 0)
(0.894412 0.447191 0)
(0.894414 0.447189 0)
(0.894415 0.447188 0)
(0.894415 0.447185 0)
(0.894415 0.447183 0)
(0.894415 0.447184 0)
(0.894413 0.447187 0)
(0.894409 0.447191 0)
(0.894404 0.447198 0)
(0.894398 0.447209 0)
(0.894389 0.447225 0)
(0.894379 0.447245 0)
(0.894368 0.44727 0)
(0.894356 0.447301 0)
(0.894343 0.447338 0)
(0.894329 0.44738 0)
(0.894316 0.447428 0)
(0.894304 0.44748 0)
(0.894293 0.447535 0)
(0.894284 0.447593 0)
(0.894278 0.447653 0)
(0.894274 0.447712 0)
(0.894274 0.44777 0)
(0.894277 0.447825 0)
(0.894283 0.447875 0)
(0.894292 0.447919 0)
(0.894304 0.447956 0)
(0.894319 0.447985 0)
(0.894336 0.448005 0)
(0.894354 0.448015 0)
(0.894372 0.448016 0)
(0.894391 0.448008 0)
(0.894409 0.447991 0)
(0.894426 0.447966 0)
(0.894442 0.447933 0)
(0.894455 0.447895 0)
(0.894467 0.447852 0)
(0.894477 0.447805 0)
(0.894484 0.447755 0)
(0.894489 0.447705 0)
(0.894491 0.447655 0)
(0.894492 0.447606 0)
(0.894491 0.447559 0)
(0.894488 0.447514 0)
(0.894484 0.447473 0)
(0.89448 0.447435 0)
(0.894474 0.4474 0)
(0.894468 0.447369 0)
(0.894462 0.447342 0)
(0.894456 0.447318 0)
(0.89445 0.447297 0)
(0.894444 0.447279 0)
(0.894439 0.447263 0)
(0.894433 0.44725 0)
(0.894428 0.44724 0)
(0.894424 0.447231 0)
(0.89442 0.447224 0)
(0.894416 0.447218 0)
(0.894413 0.447213 0)
(0.89441 0.447209 0)
(0.894408 0.447206 0)
(0.894406 0.447204 0)
(0.894405 0.447203 0)
(0.894403 0.447201 0)
(0.894402 0.447201 0)
(0.894402 0.4472 0)
(0.894401 0.4472 0)
(0.894401 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.894405 0.447198 0)
(0.894407 0.447197 0)
(0.89441 0.447196 0)
(0.894412 0.447194 0)
(0.894412 0.447191 0)
(0.894414 0.447189 0)
(0.894416 0.447188 0)
(0.894416 0.447188 0)
(0.894415 0.447189 0)
(0.894413 0.447191 0)
(0.894408 0.447197 0)
(0.894403 0.447207 0)
(0.894395 0.447222 0)
(0.894385 0.44724 0)
(0.894372 0.447266 0)
(0.894359 0.447298 0)
(0.894343 0.447338 0)
(0.894325 0.447386 0)
(0.894307 0.44744 0)
(0.894289 0.447503 0)
(0.894272 0.447573 0)
(0.894256 0.447647 0)
(0.894243 0.447727 0)
(0.894232 0.447809 0)
(0.894226 0.447893 0)
(0.894223 0.447975 0)
(0.894225 0.448055 0)
(0.894231 0.44813 0)
(0.894242 0.448198 0)
(0.894258 0.448257 0)
(0.894277 0.448305 0)
(0.894298 0.448342 0)
(0.894323 0.448366 0)
(0.894349 0.448377 0)
(0.894376 0.448374 0)
(0.894403 0.448359 0)
(0.894429 0.448331 0)
(0.894453 0.448292 0)
(0.894474 0.448243 0)
(0.894493 0.448186 0)
(0.894508 0.448121 0)
(0.89452 0.448052 0)
(0.894528 0.44798 0)
(0.894533 0.447907 0)
(0.894535 0.447835 0)
(0.894534 0.447764 0)
(0.894531 0.447696 0)
(0.894526 0.447632 0)
(0.894519 0.447573 0)
(0.894512 0.447519 0)
(0.894503 0.447471 0)
(0.894494 0.447428 0)
(0.894485 0.447389 0)
(0.894476 0.447356 0)
(0.894467 0.447327 0)
(0.894458 0.447303 0)
(0.894451 0.447282 0)
(0.894443 0.447265 0)
(0.894436 0.447251 0)
(0.89443 0.447239 0)
(0.894425 0.44723 0)
(0.894421 0.447222 0)
(0.894417 0.447216 0)
(0.894413 0.447211 0)
(0.89441 0.447208 0)
(0.894408 0.447205 0)
(0.894406 0.447203 0)
(0.894404 0.447202 0)
(0.894403 0.447201 0)
(0.894402 0.4472 0)
(0.894401 0.4472 0)
(0.894401 0.4472 0)
(0.8944 0.447199 0)
(0.8944 0.447199 0)
(0.8944 0.447199 0)
(0.894407 0.447199 0)
(0.894408 0.447197 0)
(0.89441 0.447196 0)
(0.894413 0.447194 0)
(0.894415 0.447194 0)
(0.894416 0.447192 0)
(0.894416 0.447191 0)
(0.894414 0.447193 0)
(0.894412 0.447198 0)
(0.894408 0.447206 0)
(0.894401 0.447217 0)
(0.894391 0.447233 0)
(0.894379 0.447257 0)
(0.894364 0.44729 0)
(0.894346 0.44733 0)
(0.894325 0.44738 0)
(0.894302 0.44744 0)
(0.894279 0.447511 0)
(0.894255 0.447592 0)
(0.89423 0.447682 0)
(0.894208 0.447782 0)
(0.894188 0.447889 0)
(0.894172 0.448001 0)
(0.89416 0.448116 0)
(0.894154 0.448232 0)
(0.894153 0.448346 0)
(0.894158 0.448455 0)
(0.89417 0.448556 0)
(0.894188 0.448647 0)
(0.894211 0.448726 0)
(0.89424 0.44879 0)
(0.894273 0.448837 0)
(0.894309 0.448866 0)
(0.894347 0.448877 0)
(0.894386 0.44887 0)
(0.894423 0.448845 0)
(0.894459 0.448802 0)
(0.894492 0.448744 0)
(0.894522 0.448672 0)
(0.894547 0.448589 0)
(0.894568 0.448497 0)
(0.894583 0.448397 0)
(0.894593 0.448294 0)
(0.894598 0.448189 0)
(0.894599 0.448085 0)
(0.894596 0.447984 0)
(0.894589 0.447888 0)
(0.89458 0.447797 0)
(0.894569 0.447713 0)
(0.894556 0.447637 0)
(0.894543 0.447568 0)
(0.894529 0.447508 0)
(0.894516 0.447455 0)
(0.894502 0.447409 0)
(0.89449 0.447369 0)
(0.894478 0.447336 0)
(0.894467 0.447308 0)
(0.894457 0.447285 0)
(0.894448 0.447265 0)
(0.89444 0.44725 0)
(0.894433 0.447237 0)
(0.894426 0.447228 0)
(0.894421 0.44722 0)
(0.894417 0.447214 0)
(0.894413 0.447209 0)
(0.89441 0.447206 0)
(0.894407 0.447203 0)
(0.894405 0.447202 0)
(0.894403 0.4472 0)
(0.894402 0.4472 0)
(0.894402 0.447199 0)
(0.894401 0.447199 0)
(0.894401 0.447199 0)
(0.8944 0.447199 0)
(0.8944 0.447199 0)
(0.894408 0.4472 0)
(0.89441 0.447199 0)
(0.894412 0.447198 0)
(0.894413 0.447196 0)
(0.894414 0.447195 0)
(0.894415 0.447197 0)
(0.894415 0.4472 0)
(0.894412 0.447204 0)
(0.894406 0.447212 0)
(0.894398 0.447227 0)
(0.894387 0.447249 0)
(0.894372 0.447278 0)
(0.894353 0.447316 0)
(0.89433 0.447365 0)
(0.894305 0.447427 0)
(0.894276 0.447502 0)
(0.894244 0.44759 0)
(0.894211 0.447693 0)
(0.894178 0.44781 0)
(0.894147 0.447939 0)
(0.894117 0.448079 0)
(0.894092 0.448229 0)
(0.894072 0.448384 0)
(0.894059 0.448543 0)
(0.894053 0.448702 0)
(0.894056 0.448858 0)
(0.894067 0.449006 0)
(0.894087 0.449142 0)
(0.894115 0.449263 0)
(0.894151 0.449367 0)
(0.894194 0.44945 0)
(0.894241 0.449511 0)
(0.894293 0.449547 0)
(0.894347 0.449558 0)
(0.894401 0.449544 0)
(0.894454 0.449506 0)
(0.894505 0.449444 0)
(0.89455 0.44936 0)
(0.894591 0.449258 0)
(0.894624 0.44914 0)
(0.894652 0.449009 0)
(0.894671 0.44887 0)
(0.894684 0.448724 0)
(0.89469 0.448577 0)
(0.894689 0.448431 0)
(0.894682 0.448288 0)
(0.894671 0.448153 0)
(0.894657 0.448025 0)
(0.894639 0.447907 0)
(0.89462 0.4478 0)
(0.8946 0.447704 0)
(0.89458 0.447619 0)
(0.894559 0.447545 0)
(0.89454 0.447481 0)
(0.894521 0.447427 0)
(0.894505 0.447381 0)
(0.894489 0.447343 0)
(0.894475 0.447311 0)
(0.894462 0.447285 0)
(0.894451 0.447264 0)
(0.894442 0.447248 0)
(0.894434 0.447235 0)
(0.894427 0.447225 0)
(0.894421 0.447217 0)
(0.894416 0.447211 0)
(0.894412 0.447207 0)
(0.894409 0.447204 0)
(0.894406 0.447202 0)
(0.894404 0.4472 0)
(0.894403 0.4472 0)
(0.894402 0.447199 0)
(0.894401 0.447199 0)
(0.8944 0.447199 0)
(0.8944 0.447199 0)
(0.8944 0.447199 0)
(0.894408 0.447201 0)
(0.89441 0.447201 0)
(0.894413 0.4472 0)
(0.894414 0.4472 0)
(0.894414 0.447202 0)
(0.894413 0.447204 0)
(0.89441 0.447211 0)
(0.894404 0.447222 0)
(0.894395 0.44724 0)
(0.894382 0.447263 0)
(0.894364 0.447297 0)
(0.894341 0.447343 0)
(0.894314 0.447402 0)
(0.894281 0.447477 0)
(0.894243 0.447568 0)
(0.894202 0.447677 0)
(0.894159 0.447805 0)
(0.894115 0.447952 0)
(0.894071 0.448117 0)
(0.894028 0.448298 0)
(0.893991 0.448493 0)
(0.893959 0.448699 0)
(0.893936 0.448912 0)
(0.893921 0.449128 0)
(0.893917 0.449343 0)
(0.893925 0.449552 0)
(0.893945 0.44975 0)
(0.893976 0.449931 0)
(0.894018 0.450091 0)
(0.894071 0.450227 0)
(0.894132 0.450336 0)
(0.894201 0.450413 0)
(0.894274 0.450458 0)
(0.894349 0.450469 0)
(0.894424 0.450446 0)
(0.894498 0.45039 0)
(0.894568 0.450303 0)
(0.894631 0.450187 0)
(0.894687 0.450046 0)
(0.894734 0.449882 0)
(0.89477 0.449702 0)
(0.894796 0.449509 0)
(0.894812 0.449308 0)
(0.894818 0.449105 0)
(0.894815 0.448902 0)
(0.894804 0.448704 0)
(0.894787 0.448515 0)
(0.894764 0.448338 0)
(0.894738 0.448174 0)
(0.894709 0.448024 0)
(0.894679 0.447891 0)
(0.894649 0.447772 0)
(0.894619 0.447669 0)
(0.894591 0.447581 0)
(0.894565 0.447506 0)
(0.894541 0.447443 0)
(0.89452 0.44739 0)
(0.8945 0.447348 0)
(0.894483 0.447313 0)
(0.894468 0.447285 0)
(0.894455 0.447262 0)
(0.894444 0.447245 0)
(0.894434 0.447232 0)
(0.894427 0.447222 0)
(0.89442 0.447214 0)
(0.894415 0.447209 0)
(0.894411 0.447205 0)
(0.894408 0.447202 0)
(0.894405 0.4472 0)
(0.894403 0.447199 0)
(0.894402 0.447199 0)
(0.894401 0.447198 0)
(0.8944 0.447198 0)
(0.8944 0.447198 0)
(0.8944 0.447198 0)
(0.894409 0.447204 0)
(0.89441 0.447204 0)
(0.894412 0.447205 0)
(0.894413 0.447207 0)
(0.894411 0.447211 0)
(0.894408 0.447219 0)
(0.894402 0.447231 0)
(0.89439 0.44725 0)
(0.894375 0.447278 0)
(0.894355 0.447318 0)
(0.894328 0.447371 0)
(0.894294 0.447439 0)
(0.894253 0.447527 0)
(0.894206 0.447637 0)
(0.894155 0.44777 0)
(0.894098 0.447926 0)
(0.894038 0.448107 0)
(0.893978 0.448312 0)
(0.893919 0.448541 0)
(0.893864 0.448791 0)
(0.893816 0.449057 0)
(0.893777 0.449337 0)
(0.89375 0.449625 0)
(0.893735 0.449915 0)
(0.893736 0.450201 0)
(0.893751 0.450477 0)
(0.893783 0.450737 0)
(0.89383 0.450974 0)
(0.893893 0.451184 0)
(0.893968 0.45136 0)
(0.894054 0.451499 0)
(0.89415 0.451597 0)
(0.894251 0.451652 0)
(0.894356 0.451663 0)
(0.89446 0.45163 0)
(0.894562 0.451553 0)
(0.894657 0.451434 0)
(0.894743 0.451277 0)
(0.894819 0.451086 0)
(0.894882 0.450866 0)
(0.894932 0.450623 0)
(0.894967 0.450362 0)
(0.894987 0.450089 0)
(0.894994 0.449812 0)
(0.894989 0.449536 0)
(0.894972 0.449266 0)
(0.894946 0.449007 0)
(0.894913 0.448763 0)
(0.894874 0.448538 0)
(0.894833 0.448332 0)
(0.894789 0.448147 0)
(0.894745 0.447983 0)
(0.894703 0.447841 0)
(0.894662 0.447718 0)
(0.894625 0.447614 0)
(0.894591 0.447527 0)
(0.89456 0.447456 0)
(0.894533 0.447397 0)
(0.89451 0.44735 0)
(0.894489 0.447312 0)
(0.894472 0.447282 0)
(0.894457 0.447259 0)
(0.894444 0.447241 0)
(0.894434 0.447228 0)
(0.894426 0.447218 0)
(0.894419 0.447211 0)
(0.894414 0.447206 0)
(0.89441 0.447202 0)
(0.894406 0.4472 0)
(0.894404 0.447199 0)
(0.894402 0.447198 0)
(0.894401 0.447198 0)
(0.8944 0.447198 0)
(0.8944 0.447198 0)
(0.8944 0.447198 0)
(0.894408 0.447208 0)
(0.89441 0.447209 0)
(0.89441 0.447212 0)
(0.894409 0.447217 0)
(0.894405 0.447226 0)
(0.894398 0.44724 0)
(0.894386 0.447261 0)
(0.894369 0.447293 0)
(0.894344 0.447337 0)
(0.894312 0.447396 0)
(0.894272 0.447477 0)
(0.894224 0.44758 0)
(0.894165 0.447707 0)
(0.894099 0.447863 0)
(0.894027 0.448051 0)
(0.893949 0.448271 0)
(0.893869 0.448522 0)
(0.893789 0.448805 0)
(0.893712 0.449117 0)
(0.893642 0.449454 0)
(0.893581 0.449812 0)
(0.893534 0.450185 0)
(0.893502 0.450567 0)
(0.893489 0.450949 0)
(0.893495 0.451323 0)
(0.893523 0.451683 0)
(0.893572 0.45202 0)
(0.893641 0.452326 0)
(0.893729 0.452595 0)
(0.893834 0.45282 0)
(0.893954 0.452996 0)
(0.894085 0.45312 0)
(0.894224 0.453188 0)
(0.894366 0.453198 0)
(0.894507 0.453152 0)
(0.894645 0.45305 0)
(0.894774 0.452894 0)
(0.894892 0.452688 0)
(0.894995 0.452437 0)
(0.895081 0.452147 0)
(0.895148 0.451826 0)
(0.895196 0.45148 0)
(0.895224 0.451118 0)
(0.895233 0.450748 0)
(0.895225 0.450378 0)
(0.895201 0.450014 0)
(0.895164 0.449665 0)
(0.895116 0.449334 0)
(0.895061 0.449027 0)
(0.895002 0.448746 0)
(0.89494 0.448494 0)
(0.894878 0.44827 0)
(0.894818 0.448074 0)
(0.894761 0.447906 0)
(0.894708 0.447764 0)
(0.89466 0.447644 0)
(0.894617 0.447546 0)
(0.89458 0.447466 0)
(0.894547 0.447401 0)
(0.894518 0.44735 0)
(0.894494 0.447309 0)
(0.894474 0.447278 0)
(0.894458 0.447254 0)
(0.894444 0.447237 0)
(0.894433 0.447223 0)
(0.894424 0.447214 0)
(0.894417 0.447207 0)
(0.894412 0.447203 0)
(0.894408 0.4472 0)
(0.894405 0.447198 0)
(0.894403 0.447197 0)
(0.894401 0.447197 0)
(0.8944 0.447197 0)
(0.8944 0.447197 0)
(0.894399 0.447197 0)
(0.894407 0.447214 0)
(0.894407 0.447217 0)
(0.894406 0.447223 0)
(0.894402 0.447232 0)
(0.894394 0.447248 0)
(0.894382 0.447271 0)
(0.894362 0.447306 0)
(0.894334 0.447355 0)
(0.894297 0.447422 0)
(0.89425 0.447511 0)
(0.894191 0.447627 0)
(0.894121 0.447774 0)
(0.89404 0.447957 0)
(0.893948 0.448177 0)
(0.893849 0.448437 0)
(0.893744 0.448739 0)
(0.893637 0.449083 0)
(0.893532 0.449465 0)
(0.893432 0.449883 0)
(0.893343 0.450332 0)
(0.893268 0.450805 0)
(0.893212 0.451294 0)
(0.893177 0.45179 0)
(0.893168 0.452284 0)
(0.893184 0.452765 0)
(0.893228 0.453225 0)
(0.8933 0.453652 0)
(0.893399 0.454039 0)
(0.893522 0.454377 0)
(0.893666 0.454658 0)
(0.893828 0.454878 0)
(0.894005 0.455032 0)
(0.894191 0.455115 0)
(0.894381 0.455127 0)
(0.894571 0.455066 0)
(0.894754 0.454935 0)
(0.894927 0.454736 0)
(0.895085 0.454473 0)
(0.895224 0.454153 0)
(0.89534 0.453781 0)
(0.895432 0.453367 0)
(0.895497 0.452919 0)
(0.895536 0.452448 0)
(0.89555 0.451965 0)
(0.895539 0.451478 0)
(0.895507 0.450997 0)
(0.895456 0.450533 0)
(0.895391 0.450091 0)
(0.895315 0.449679 0)
(0.895233 0.449301 0)
(0.895146 0.448959 0)
(0.89506 0.448656 0)
(0.894976 0.44839 0)
(0.894896 0.448161 0)
(0.894821 0.447967 0)
(0.894754 0.447804 0)
(0.894694 0.447669 0)
(0.894642 0.44756 0)
(0.894597 0.447472 0)
(0.894558 0.447402 0)
(0.894525 0.447347 0)
(0.894498 0.447305 0)
(0.894476 0.447273 0)
(0.894457 0.447249 0)
(0.894443 0.447231 0)
(0.894431 0.447218 0)
(0.894422 0.44721 0)
(0.894415 0.447204 0)
(0.89441 0.4472 0)
(0.894406 0.447197 0)
(0.894403 0.447196 0)
(0.894402 0.447196 0)
(0.8944 0.447196 0)
(0.8944 0.447196 0)
(0.894399 0.447196 0)
(0.894405 0.447222 0)
(0.894403 0.447228 0)
(0.894399 0.447239 0)
(0.89439 0.447256 0)
(0.894376 0.447281 0)
(0.894355 0.447317 0)
(0.894324 0.44737 0)
(0.894282 0.447443 0)
(0.894227 0.447542 0)
(0.894158 0.447672 0)
(0.894075 0.447838 0)
(0.893976 0.448045 0)
(0.893863 0.448299 0)
(0.893739 0.448602 0)
(0.893605 0.448958 0)
(0.893465 0.449367 0)
(0.893325 0.449827 0)
(0.893188 0.450334 0)
(0.893061 0.450885 0)
(0.89295 0.451471 0)
(0.89286 0.452083 0)
(0.892794 0.452711 0)
(0.892759 0.453344 0)
(0.892757 0.45397 0)
(0.89279 0.454575 0)
(0.892857 0.455148 0)
(0.89296 0.455678 0)
(0.893096 0.456156 0)
(0.893264 0.456571 0)
(0.893458 0.456916 0)
(0.893674 0.457183 0)
(0.893907 0.457369 0)
(0.894152 0.457469 0)
(0.894402 0.457483 0)
(0.894651 0.457408 0)
(0.894892 0.457247 0)
(0.89512 0.457001 0)
(0.895329 0.456676 0)
(0.895514 0.456279 0)
(0.89567 0.455815 0)
(0.895794 0.455296 0)
(0.895884 0.454732 0)
(0.89594 0.454133 0)
(0.895961 0.453515 0)
(0.89595 0.452888 0)
(0.895909 0.452265 0)
(0.895843 0.451659 0)
(0.895756 0.45108 0)
(0.895654 0.450535 0)
(0.895542 0.450033 0)
(0.895424 0.449578 0)
(0.895305 0.449171 0)
(0.895189 0.448814 0)
(0.895079 0.448505 0)
(0.894976 0.448241 0)
(0.894883 0.44802 0)
(0.8948 0.447837 0)
(0.894728 0.447688 0)
(0.894665 0.447568 0)
(0.894612 0.447473 0)
(0.894567 0.447399 0)
(0.89453 0.447342 0)
(0.8945 0.447298 0)
(0.894475 0.447266 0)
(0.894456 0.447242 0)
(0.89444 0.447225 0)
(0.894428 0.447213 0)
(0.894419 0.447205 0)
(0.894413 0.4472 0)
(0.894408 0.447197 0)
(0.894404 0.447195 0)
(0.894402 0.447194 0)
(0.8944 0.447195 0)
(0.894399 0.447195 0)
(0.894399 0.447195 0)
(0.894399 0.447234 0)
(0.894395 0.447245 0)
(0.894386 0.447262 0)
(0.894371 0.447288 0)
(0.894348 0.447327 0)
(0.894314 0.447383 0)
(0.894267 0.447461 0)
(0.894205 0.447568 0)
(0.894126 0.447709 0)
(0.894028 0.447893 0)
(0.893911 0.448124 0)
(0.893775 0.448412 0)
(0.893622 0.448759 0)
(0.893454 0.44917 0)
(0.893275 0.449647 0)
(0.893092 0.450189 0)
(0.892911 0.450795 0)
(0.892738 0.451457 0)
(0.892579 0.452168 0)
(0.892444 0.452917 0)
(0.892337 0.453694 0)
(0.892266 0.454484 0)
(0.892233 0.455271 0)
(0.892244 0.456043 0)
(0.892299 0.456785 0)
(0.8924 0.457483 0)
(0.892543 0.458124 0)
(0.892728 0.458696 0)
(0.89295 0.459191 0)
(0.893205 0.459601 0)
(0.893487 0.459918 0)
(0.893789 0.460138 0)
(0.894104 0.460256 0)
(0.894426 0.460272 0)
(0.894746 0.460184 0)
(0.895058 0.459993 0)
(0.895353 0.459703 0)
(0.895626 0.459316 0)
(0.895868 0.458839 0)
(0.896076 0.45828 0)
(0.896243 0.457649 0)
(0.896368 0.456957 0)
(0.896448 0.456218 0)
(0.896484 0.455447 0)
(0.896475 0.454658 0)
(0.896428 0.453869 0)
(0.896345 0.453095 0)
(0.896234 0.452348 0)
(0.8961 0.451642 0)
(0.895951 0.450985 0)
(0.895793 0.450386 0)
(0.895633 0.449848 0)
(0.895475 0.449373 0)
(0.895325 0.44896 0)
(0.895185 0.448607 0)
(0.895057 0.44831 0)
(0.894943 0.448063 0)
(0.894844 0.447862 0)
(0.894758 0.4477 0)
(0.894685 0.447571 0)
(0.894624 0.44747 0)
(0.894574 0.447393 0)
(0.894532 0.447334 0)
(0.8945 0.44729 0)
(0.894473 0.447258 0)
(0.894453 0.447235 0)
(0.894437 0.447219 0)
(0.894425 0.447208 0)
(0.894416 0.447201 0)
(0.89441 0.447196 0)
(0.894405 0.447194 0)
(0.894402 0.447193 0)
(0.8944 0.447193 0)
(0.894399 0.447194 0)
(0.894398 0.447194 0)
(0.894391 0.447249 0)
(0.894382 0.447267 0)
(0.894366 0.447295 0)
(0.894341 0.447334 0)
(0.894305 0.447392 0)
(0.894255 0.447474 0)
(0.894186 0.447587 0)
(0.894096 0.447739 0)
(0.893983 0.447938 0)
(0.893847 0.448193 0)
(0.893685 0.448511 0)
(0.8935 0.448901 0)
(0.893295 0.449367 0)
(0.893073 0.449914 0)
(0.89284 0.450543 0)
(0.892604 0.451249 0)
(0.892373 0.45203 0)
(0.892158 0.452877 0)
(0.891966 0.453776 0)
(0.891805 0.454714 0)
(0.891684 0.455675 0)
(0.89161 0.456642 0)
(0.891588 0.457598 0)
(0.89162 0.458524 0)
(0.891708 0.459405 0)
(0.891852 0.460227 0)
(0.892048 0.460975 0)
(0.892293 0.46164 0)
(0.892583 0.46221 0)
(0.89291 0.46268 0)
(0.893268 0.463042 0)
(0.89365 0.463292 0)
(0.894048 0.463429 0)
(0.894453 0.463449 0)
(0.894857 0.463351 0)
(0.89525 0.463137 0)
(0.895626 0.462807 0)
(0.895974 0.462365 0)
(0.896288 0.461816 0)
(0.896561 0.461167 0)
(0.896784 0.460427 0)
(0.896956 0.459608 0)
(0.897071 0.458725 0)
(0.897129 0.457792 0)
(0.897132 0.456829 0)
(0.897081 0.455854 0)
(0.896984 0.454886 0)
(0.896846 0.453944 0)
(0.896676 0.453046 0)
(0.896483 0.452203 0)
(0.896277 0.451427 0)
(0.896065 0.450726 0)
(0.895855 0.450103 0)
(0.895653 0.449559 0)
(0.895464 0.449091 0)
(0.895291 0.448695 0)
(0.895136 0.448366 0)
(0.895 0.448095 0)
(0.894883 0.447877 0)
(0.894784 0.447704 0)
(0.894701 0.447568 0)
(0.894632 0.447463 0)
(0.894577 0.447383 0)
(0.894532 0.447323 0)
(0.894497 0.44728 0)
(0.89447 0.447249 0)
(0.894449 0.447227 0)
(0.894433 0.447212 0)
(0.894421 0.447202 0)
(0.894413 0.447197 0)
(0.894407 0.447193 0)
(0.894403 0.447192 0)
(0.8944 0.447191 0)
(0.894398 0.447192 0)
(0.894398 0.447193 0)
(0.894377 0.447271 0)
(0.894361 0.447299 0)
(0.894336 0.447339 0)
(0.894298 0.447399 0)
(0.894243 0.447483 0)
(0.894167 0.4476 0)
(0.894069 0.44776 0)
(0.893942 0.447972 0)
(0.893786 0.448246 0)
(0.893598 0.448592 0)
(0.89338 0.449022 0)
(0.893133 0.449541 0)
(0.892861 0.450158 0)
(0.892572 0.450873 0)
(0.892274 0.451685 0)
(0.891976 0.452589 0)
(0.89169 0.453576 0)
(0.891428 0.454633 0)
(0.891201 0.455743 0)
(0.891018 0.456887 0)
(0.89089 0.458044 0)
(0.890823 0.459194 0)
(0.89082 0.460315 0)
(0.890886 0.46139 0)
(0.891019 0.4624 0)
(0.891219 0.463332 0)
(0.891481 0.464172 0)
(0.891798 0.46491 0)
(0.892166 0.465539 0)
(0.892577 0.466053 0)
(0.893022 0.466449 0)
(0.893494 0.466723 0)
(0.893983 0.466873 0)
(0.89448 0.466897 0)
(0.894976 0.466796 0)
(0.895462 0.466568 0)
(0.895928 0.466213 0)
(0.896365 0.465734 0)
(0.896763 0.465133 0)
(0.897114 0.464414 0)
(0.89741 0.463585 0)
(0.897643 0.462655 0)
(0.897809 0.461637 0)
(0.897904 0.460549 0)
(0.897928 0.45941 0)
(0.897884 0.458241 0)
(0.897776 0.457066 0)
(0.897613 0.455909 0)
(0.897406 0.45479 0)
(0.897164 0.45373 0)
(0.8969 0.452745 0)
(0.896626 0.451847 0)
(0.896351 0.451042 0)
(0.896084 0.450334 0)
(0.895832 0.449721 0)
(0.895601 0.4492 0)
(0.895393 0.448764 0)
(0.89521 0.448405 0)
(0.895052 0.448114 0)
(0.894917 0.447882 0)
(0.894805 0.447699 0)
(0.894712 0.447558 0)
(0.894637 0.447451 0)
(0.894577 0.44737 0)
(0.89453 0.447311 0)
(0.894493 0.447269 0)
(0.894465 0.447239 0)
(0.894443 0.447219 0)
(0.894428 0.447206 0)
(0.894417 0.447197 0)
(0.894409 0.447193 0)
(0.894403 0.44719 0)
(0.8944 0.44719 0)
(0.894398 0.44719 0)
(0.894397 0.447191 0)
)
;
boundaryField
{
emptyPatches_empt
{
type empty;
}
top_cyc
{
type cyclic;
}
bottom_cyc
{
type cyclic;
}
inlet_cyc
{
type cyclic;
}
outlet_cyc
{
type cyclic;
}
procBoundary1to0
{
type processor;
value nonuniform List<vector>
75
(
(0.866172 0.433148 0)
(0.866811 0.432854 0)
(0.867711 0.432734 0)
(0.868885 0.432809 0)
(0.870328 0.433095 0)
(0.872027 0.433609 0)
(0.873944 0.434342 0)
(0.876022 0.435271 0)
(0.878194 0.436359 0)
(0.880377 0.437551 0)
(0.882486 0.438785 0)
(0.884448 0.44 0)
(0.88621 0.441137 0)
(0.88774 0.442165 0)
(0.889042 0.443072 0)
(0.890139 0.443862 0)
(0.891044 0.444529 0)
(0.891779 0.445092 0)
(0.892377 0.445564 0)
(0.892855 0.445946 0)
(0.893229 0.446253 0)
(0.893522 0.4465 0)
(0.893749 0.44669 0)
(0.893921 0.446835 0)
(0.894049 0.446945 0)
(0.894145 0.447027 0)
(0.894217 0.447086 0)
(0.894264 0.447126 0)
(0.894304 0.447155 0)
(0.89433 0.447174 0)
(0.894347 0.447186 0)
(0.89436 0.447194 0)
(0.894372 0.447196 0)
(0.894375 0.447199 0)
(0.894383 0.447199 0)
(0.894385 0.4472 0)
(0.894388 0.4472 0)
(0.894389 0.447198 0)
(0.894393 0.4472 0)
(0.894393 0.447199 0)
(0.894396 0.447199 0)
(0.894394 0.447196 0)
(0.894398 0.447201 0)
(0.894398 0.447199 0)
(0.894396 0.447196 0)
(0.894399 0.4472 0)
(0.894399 0.4472 0)
(0.894399 0.447198 0)
(0.894398 0.447199 0)
(0.894401 0.447201 0)
(0.894397 0.447197 0)
(0.894402 0.447201 0)
(0.894399 0.447199 0)
(0.894399 0.447199 0)
(0.894402 0.447201 0)
(0.8944 0.447199 0)
(0.894401 0.4472 0)
(0.894401 0.447199 0)
(0.894401 0.447199 0)
(0.894402 0.447199 0)
(0.894401 0.447199 0)
(0.894402 0.447199 0)
(0.894403 0.447199 0)
(0.894403 0.447199 0)
(0.894404 0.447199 0)
(0.894405 0.4472 0)
(0.894405 0.447201 0)
(0.894406 0.447202 0)
(0.894407 0.447204 0)
(0.894407 0.447208 0)
(0.894406 0.447212 0)
(0.894404 0.447218 0)
(0.894401 0.447226 0)
(0.894395 0.447238 0)
(0.894386 0.447253 0)
)
;
}
procBoundary1to0throughoutlet_cyc
{
type processorCyclic;
value nonuniform List<vector>
75
(
(0.897313 0.445986 0)
(0.896985 0.446065 0)
(0.89668 0.446148 0)
(0.896396 0.446233 0)
(0.896136 0.446318 0)
(0.8959 0.446401 0)
(0.895687 0.446482 0)
(0.895497 0.44656 0)
(0.895329 0.446633 0)
(0.895182 0.446701 0)
(0.895054 0.446763 0)
(0.894943 0.44682 0)
(0.894849 0.446872 0)
(0.894769 0.446918 0)
(0.894702 0.446958 0)
(0.894645 0.446994 0)
(0.894599 0.447025 0)
(0.89456 0.447052 0)
(0.894529 0.447075 0)
(0.894503 0.447095 0)
(0.894482 0.447112 0)
(0.894465 0.447127 0)
(0.894451 0.447139 0)
(0.89444 0.44715 0)
(0.894432 0.447159 0)
(0.894424 0.447166 0)
(0.894419 0.447172 0)
(0.894414 0.447178 0)
(0.894411 0.447182 0)
(0.894408 0.447185 0)
(0.894406 0.447189 0)
(0.894404 0.447191 0)
(0.894403 0.447193 0)
(0.894402 0.447195 0)
(0.894402 0.447196 0)
(0.894401 0.447197 0)
(0.894401 0.447198 0)
(0.8944 0.447198 0)
(0.8944 0.447199 0)
(0.8944 0.447199 0)
(0.8944 0.447199 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.4472 0)
(0.8944 0.447199 0)
(0.8944 0.447199 0)
(0.8944 0.447199 0)
(0.8944 0.447199 0)
(0.894399 0.447198 0)
(0.894399 0.447198 0)
(0.894399 0.447197 0)
(0.894398 0.447196 0)
(0.894398 0.447195 0)
(0.894397 0.447194 0)
(0.894396 0.447192 0)
)
;
}
procBoundary1to3
{
type processor;
value nonuniform List<vector>
75
(
(0.866632 0.433609 0)
(0.868945 0.434336 0)
(0.872324 0.435659 0)
(0.876421 0.437447 0)
(0.880951 0.439557 0)
(0.885656 0.441855 0)
(0.890344 0.444224 0)
(0.894877 0.446535 0)
(0.899121 0.44864 0)
(0.90298 0.450349 0)
(0.906462 0.451456 0)
(0.909604 0.451764 0)
(0.912446 0.451051 0)
(0.915125 0.449055 0)
(0.917899 0.445599 0)
(0.921111 0.440597 0)
(0.925228 0.433943 0)
(0.930794 0.42564 0)
(0.938333 0.415984 0)
(0.948348 0.405469 0)
(0.961254 0.39456 0)
(0.977155 0.383714 0)
(0.995838 0.373559 0)
(1.01708 0.364869 0)
(1.04064 0.35839 0)
(1.06582 0.354753 0)
(1.09134 0.354482 0)
(1.11603 0.357946 0)
(1.13909 0.365357 0)
(1.1595 0.37668 0)
(1.17599 0.391376 0)
(1.18765 0.408507 0)
(1.19421 0.427214 0)
(1.19562 0.446778 0)
(1.19183 0.466195 0)
(1.18285 0.48415 0)
(1.16894 0.499516 0)
(1.15071 0.511656 0)
(1.12921 0.520295 0)
(1.10574 0.525407 0)
(1.08142 0.52727 0)
(1.05704 0.526431 0)
(1.03322 0.523525 0)
(1.01055 0.519145 0)
(0.989477 0.513836 0)
(0.970201 0.508106 0)
(0.95277 0.502356 0)
(0.937255 0.496809 0)
(0.923824 0.491516 0)
(0.912662 0.486441 0)
(0.90382 0.481556 0)
(0.897159 0.476879 0)
(0.8924 0.472448 0)
(0.889259 0.46828 0)
(0.887549 0.464346 0)
(0.887205 0.460568 0)
(0.888251 0.456858 0)
(0.890702 0.453148 0)
(0.894475 0.449427 0)
(0.89932 0.44576 0)
(0.904799 0.442287 0)
(0.910326 0.439206 0)
(0.915254 0.436728 0)
(0.919004 0.435029 0)
(0.921182 0.434202 0)
(0.921659 0.434229 0)
(0.920573 0.434981 0)
(0.918271 0.436259 0)
(0.915199 0.437834 0)
(0.911805 0.439497 0)
(0.908455 0.441085 0)
(0.9054 0.442496 0)
(0.902778 0.443681 0)
(0.900633 0.44463 0)
(0.898945 0.445364 0)
)
;
}
procBoundary1to3throughbottom_cyc
{
type processorCyclic;
value nonuniform List<vector>
75
(
(0.894357 0.447302 0)
(0.894331 0.447342 0)
(0.894291 0.447401 0)
(0.894234 0.447486 0)
(0.894154 0.447606 0)
(0.894047 0.44777 0)
(0.893907 0.447991 0)
(0.893731 0.448281 0)
(0.893517 0.448652 0)
(0.893264 0.449117 0)
(0.892974 0.449686 0)
(0.892649 0.450368 0)
(0.892296 0.451167 0)
(0.891927 0.452084 0)
(0.891553 0.453114 0)
(0.891185 0.454245 0)
(0.89084 0.455464 0)
(0.890532 0.456752 0)
(0.890274 0.458084 0)
(0.890077 0.459437 0)
(0.889952 0.460785 0)
(0.889905 0.462104 0)
(0.889938 0.463372 0)
(0.890053 0.464567 0)
(0.890248 0.465675 0)
(0.890519 0.466682 0)
(0.890859 0.467578 0)
(0.891262 0.468356 0)
(0.891718 0.469013 0)
(0.89222 0.469545 0)
(0.892759 0.469952 0)
(0.893325 0.470234 0)
(0.893909 0.47039 0)
(0.894503 0.47042 0)
(0.895096 0.470322 0)
(0.89568 0.470097 0)
(0.896244 0.469741 0)
(0.896778 0.469254 0)
(0.897273 0.468634 0)
(0.897716 0.467883 0)
(0.898099 0.467002 0)
(0.898412 0.465999 0)
(0.898646 0.464883 0)
(0.898797 0.463668 0)
(0.89886 0.462374 0)
(0.898837 0.461023 0)
(0.898732 0.459642 0)
(0.898552 0.45826 0)
(0.898309 0.456905 0)
(0.898016 0.455604 0)
(0.897689 0.45438 0)
(0.897342 0.453251 0)
(0.896989 0.452229 0)
(0.896643 0.451321 0)
(0.896314 0.450531 0)
(0.896009 0.449853 0)
(0.895733 0.449283 0)
(0.895488 0.448811 0)
(0.895276 0.448426 0)
(0.895095 0.448118 0)
(0.894944 0.447875 0)
(0.894819 0.447687 0)
(0.894718 0.447543 0)
(0.894637 0.447434 0)
(0.894573 0.447355 0)
(0.894524 0.447298 0)
(0.894486 0.447257 0)
(0.894458 0.447229 0)
(0.894437 0.447211 0)
(0.894422 0.4472 0)
(0.894412 0.447193 0)
(0.894405 0.447189 0)
(0.8944 0.447188 0)
(0.894397 0.447188 0)
(0.894396 0.447189 0)
)
;
}
}
// ************************************************************************* //
| [
"tdg@debian"
] | tdg@debian | |
aeb8b5f821bbf981ecc04b6af6fea1385988fd62 | 5942065ed2ccf5378f854a012a05df3f8351acf9 | /KinectGestureLib/Src/Hand.cpp | b779262a79b72947dec7e5cd928b7555b95ba0eb | [] | no_license | jecy123/KinectGestureRecognizer | 3b55aaef38e604c71a78fd66288e879cf2f97ce1 | 5d5743a0e04e54b6e01006920256f29fabf679fc | refs/heads/master | 2020-03-06T21:57:16.646062 | 2018-04-28T14:43:15 | 2018-04-28T14:43:15 | 127,090,654 | 1 | 1 | null | null | null | null | GB18030 | C++ | false | false | 12,520 | cpp | #define DLL_IMPLEMENT
#include "Hand.h"
#include "utils.h"
HandPoint cMaxYhandPoint;
inline bool cmp(HandPoint p1, HandPoint p2)
{
int ret = HandPoint::crossProduct(cMaxYhandPoint, p1, p2);
if (ret < 0)
return true;
if (ret > 0)
return false;
return false;
}
Hand::Hand()
{
initHandArray();
initVisited();
maxDis = 0;
m_depthThreshold = cThreshold;
}
void Hand::initHandArray()
{
for (int i = 0; i < cDepthHeight; i++)
{
for (int j = 0; j < cDepthWidth; j++)
{
m_pHandAreaArray[i][j] = false;
m_pHandLineArray[i][j] = false;
//m_pHandOutLineArray[i][j] = false;
}
}
}
void Hand::initFingerArray()
{
/*for (int i = 0; i < MAX_FINGERCNT; i++)
{
m_pMax5FingerPoint[i].m_depthX = 0;
m_pMax5FingerPoint[i].m_depthY = 0;
m_pMax5FingerPoint[i].m_cameraZ = 0;
m_pMax5FingerPoint[i].m_disFromCenter = 0.0;
}
for (int i = 0; i < MAX_IN_FINGER; i++)
{
m_pMin4FingerPoint[i].m_depthX = 0;
m_pMin4FingerPoint[i].m_depthY = 0;
m_pMin4FingerPoint[i].m_cameraZ = 0;
m_pMin4FingerPoint[i].m_disFromCenter = FLT_MAX;
}*/
HandFingers.clear();
}
void Hand::refreshHandData(ICoordinateMapper * mapper, IBody * pBody, UINT16 * depthArray)
{
if (pBody != NULL)
{
Joint joints[JointType_Count];
pBody -> GetJoints(JointType_Count, joints);
//获取手掌的状态
if (this->m_handType == __handType::typeRightHand){
pBody->get_HandRightState(&m_handState);
}
else if (this->m_handType == __handType::typeLeftHand)
{
pBody->get_HandLeftState(&m_handState);
}
this -> refreshHandData(mapper, joints, depthArray);
}
}
void Hand::getHandArea(ICoordinateMapper * mapper, UINT16 * depthArray)
{
for (int i = m_leftTopHandPoint.m_depthY; i <= m_rightBottomHandPoint.m_depthY; i++)
{
for (int j = m_leftTopHandPoint.m_depthX; j <= m_rightBottomHandPoint.m_depthX; j++)
{
int k = i * cDepthWidth + j;
float CameradepthZ = getCameraZFromDepthXY(mapper, j, i, depthArray[k]);
float threshold = m_depthThreshold / 1000;
if (CameradepthZ >= this->HandCenter.m_cameraZ - threshold && CameradepthZ <= this->HandCenter.m_cameraZ + threshold)
{
m_pHandAreaArray[i][j] = true;
}
else{
m_pHandAreaArray[i][j] = false;
}
}
}
}
void Hand::getHandOutline(ICoordinateMapper * mapper, UINT16 * depthArray)
{
int maxI = 0;
for (int i = m_leftTopHandPoint.m_depthY; i <= m_rightBottomHandPoint.m_depthY; i++)
{
for (int j = m_leftTopHandPoint.m_depthX; j <= m_rightBottomHandPoint.m_depthX; j++)
{
//m_pHandLineArray[i][j] = checkIsOutline(j, i);
if (m_pHandAreaArray[i][j])
{
bool top = i - 1 >= 0 ? m_pHandAreaArray[i - 1][j] : false;
bool bottom = i + 1 < cDepthHeight ? m_pHandAreaArray[i + 1][j] : false;
bool left = j - 1 >= 0 ? m_pHandAreaArray[i][j - 1] : false;
bool right = j + 1 < cDepthWidth ? m_pHandAreaArray[i][j + 1] : false;
bool isInContour = !top || !bottom || !left || !right;
m_pHandLineArray[i][j] = isInContour;
if (isInContour)
{
HandPoint p(j, i, getCameraZFromDepthXY(mapper, j, i, depthArray[i * cDepthWidth + j]));
if (i > maxI)
{
maxI = i;
HandOutline.insert(HandOutline.begin(), p);
}
else{
HandOutline.push_back(p);
}
}
}
}
}
//轮廓点数组排序
/*if (HandOutline.size()>2)
{
cMaxYhandPoint = HandOutline[0];
sort(HandOutline.begin() + 1, HandOutline.end(), cmp);
}*/
for (int i = 0; i < HandOutline.size(); i++)
{
HandOutline[i].m_disFromCenter = HandPoint::disBtw2Points(HandOutline[i], HandCenter);
}
}
void Hand::refreshHandData(ICoordinateMapper * mapper, Joint joints[JointType_Count],UINT16 * depthArray)
{
initHandArray();
initFingerArray();
clearHandOutLineVector();
maxDis = 0;
//手的掌心点:
CameraSpacePoint pointCenter;
//手的腕关节点
CameraSpacePoint pointWrist;
//手的指尖节点
CameraSpacePoint pointTip;
//手拇指节点
CameraSpacePoint pointThumb;
if (m_handType == __handType::typeRightHand)
{
pointCenter = joints[JointType_HandRight].Position;
pointWrist = joints[JointType_WristRight].Position;
pointTip = joints[JointType_HandTipRight].Position;
pointThumb = joints[JointType_ThumbRight].Position;
}
else{
pointCenter = joints[JointType_HandLeft].Position;
pointWrist = joints[JointType_WristLeft].Position;
pointTip = joints[JointType_HandTipLeft].Position;
pointThumb = joints[JointType_ThumbLeft].Position;
}
this->HandCenter = HandPoint::getHandPoint(mapper, pointCenter);
//this->HandWrist = HandPoint::getHandPoint(mapper, pointWrist);
this->HandTip = HandPoint::getHandPoint(mapper, pointTip);
this->HandThumb = HandPoint::getHandPoint(mapper, pointThumb);
this->HandWrist.m_cameraZ = this->HandCenter.m_cameraZ;
this->HandWrist.m_depthX = this->HandCenter.m_depthX;
this->HandWrist.m_depthY = this->HandCenter.m_depthY + 20;
//mapper->MapDepthFrameToCameraSpace(cDepthHeight * cDepthWidth, depthArray, cDepthHeight*cDepthWidth, m_points);
calculateHandRect();
getHandArea(mapper, depthArray);
getHandOutline(mapper, depthArray);
//
float longestDis = 0;
for (int i = 0; i < HandOutline.size(); i++)
{
if (longestDis < HandOutline[i].m_disFromCenter && HandOutline[i].m_depthY < HandCenter.m_depthY)
{
longestDis = HandOutline[i].m_disFromCenter;
this->FingerTip = HandOutline[i];
}
}
//checkFingerPoint();
}
void Hand::clearHandOutLineVector()
{
HandOutline.clear();
}
Hand::~Hand()
{
clearHandOutLineVector();
}
UINT16 Hand::conventArray(int x, int y, __checkType type)
{
bool(*array)[cDepthHeight][cDepthWidth];
if (type == TYPE_HAND_AREA)
{
array = &m_pHandAreaArray;
}
else{
array = &m_pHandLineArray;
}
if ((*array)[y][x])
{
return 0x1;
}
return 0x0;
}
bool Hand::dealWithOutline(int x, int y)
{
if (m_pHandLineArray[y][x])
{
UINT16 handCheck = 0x0000 |
conventArray(x, y, TYPE_HAND_OUTLINE) << 8 |
conventArray(x - 1, y - 1, TYPE_HAND_OUTLINE) << 7 |
conventArray(x - 1, y, TYPE_HAND_OUTLINE) << 6 |
conventArray(x - 1, y + 1, TYPE_HAND_OUTLINE) << 5 |
conventArray(x, y + 1, TYPE_HAND_OUTLINE) << 4 |
conventArray(x + 1, y + 1, TYPE_HAND_OUTLINE) << 3 |
conventArray(x + 1, y, TYPE_HAND_OUTLINE) << 2 |
conventArray(x + 1, y - 1, TYPE_HAND_OUTLINE) << 1 |
conventArray(x, y - 1, TYPE_HAND_OUTLINE);
//去除直角点
if (handCheck & 0x0141 == 0x0141
|| handCheck & 0x0101 == 0x0101
|| handCheck & 0x0150 == 0x0150
|| handCheck & 0x0114 == 0x0114)
{
return false;
}
int cnt = 0;
for (int i = 0; i <= 8; i++)
{
if ((handCheck >> i) & 0x0001 == 0x0001)
{
cnt++;
}
}
if (cnt == 3)
{
return true;
}
return false;
}
return false;
}
bool Hand::checkIsOutline(int x, int y)
{
if (x == 0 || x == cDepthWidth-1||y == 0 || y==cDepthHeight-1)
{
return false;
}
/*UINT16 handCheck = 0x0000 |
conventArray(x, y) << 8 |
conventArray(x - 1, y - 1) << 7 |
conventArray(x - 1, y) << 6 |
conventArray(x - 1, y + 1) << 5 |
conventArray(x, y + 1) << 4 |
conventArray(x + 1, y + 1) << 3 |
conventArray(x + 1, y) << 2 |
conventArray(x + 1, y - 1) << 1 |
conventArray(x, y - 1);
*/
UCHAR handCheck = 0x00 |
conventArray(x, y) << 4 |
conventArray(x - 1, y) << 3 |
conventArray(x + 1, y) << 2 |
conventArray(x, y - 1) << 1 |
conventArray(x, y + 1);
if (handCheck == 0x1f || handCheck == 0x00)
{
return false;
}
return true;
}
float Hand::getCameraZFromDepthXY(ICoordinateMapper * mapper, int x, int y, UINT16 DepthZ)
{
DepthSpacePoint depthPoint;
CameraSpacePoint cameraPoint;
depthPoint.X = (float)x;
depthPoint.Y = (float)y;
mapper->MapDepthPointToCameraSpace(depthPoint, DepthZ, &cameraPoint);
return cameraPoint.Z;
//return m_points[y * cDepthWidth + x].Z;
}
void Hand::calculateHandRect()
{
/*float distanceHandTip = HandPoint::disBtw2Points(HandTip, HandCenter);
float distanceHandThumb = HandPoint::disBtw2Points(HandThumb, HandCenter);
float distanceMax = max(distanceHandTip, distanceHandThumb);
int XOffsetFromCenter = 2 * static_cast<int>(distanceMax);
int YOffsetFromCenter = 2 * static_cast<int>(distanceMax);*/
int XOffsetFromCenter = static_cast<int>(40 * (2 - HandCenter.m_cameraZ));
int YOffsetFromCenter = static_cast<int>(60 * (2 - HandCenter.m_cameraZ));
m_leftTopHandPoint.m_depthX = max(HandCenter.m_depthX - XOffsetFromCenter, 0);
m_leftTopHandPoint.m_depthY = max(HandCenter.m_depthY - YOffsetFromCenter, 0);
m_rightBottomHandPoint.m_depthX = min(HandCenter.m_depthX + XOffsetFromCenter, cDepthWidth - 1);
m_rightBottomHandPoint.m_depthY = min(HandCenter.m_depthY + YOffsetFromCenter, cDepthHeight - 1);
}
void Hand::initVisited()
{
for (int i = 0; i < cDepthHeight; i++)
{
for (int j = 0; j < cDepthWidth; j++)
{
m_visited[i][j] = false;
}
}
}
void Hand::setHandType(__handType type)
{
this->m_handType = type;
}
void Hand::checkFingerPoint()
{
int k = 2;
int j = 0;
for (int i = k; i + k < HandOutline.size(); i++)
{
/*float dis1 = HandPoint::disBtw2Points(HandOutline[i - k], HandCenter);
float dis2 = HandPoint::disBtw2Points(HandOutline[i], HandCenter);
float dis3 = HandPoint::disBtw2Points(HandOutline[i + k], HandCenter);
bool isSharpPoint = dis2 > dis1 && dis2 > dis3;*/
bool isAboveCenter = HandOutline[i].m_depthY < HandWrist.m_depthY;
bool isAcuteAngle = HandPoint::cosin(HandOutline[i], HandOutline[i - k], HandOutline[i + k]) >= 0.5;
bool isFinger = HandPoint::crossProduct(HandOutline[i], HandOutline[i - k], HandOutline[i + k]) > 20;
if (isAboveCenter && isAcuteAngle && isFinger)
{
HandFingers.push_back(HandOutline[i]);
/*m_pMax5FingerPoint[j++] = HandOutline[i];
if (j == 10)
{
break;
}*/
}
/*
float dis1 = HandPoint::disBtw2Points(HandOutline[i - k], HandCenter);
float dis2 = HandPoint::disBtw2Points(HandOutline[i], HandCenter);
float dis3 = HandPoint::disBtw2Points(HandOutline[i + k], HandCenter);
if (dis2 > dis1 && dis2 > dis3)
{
m_pMax5FingerPoint[j++] = HandOutline[i];
if (j == 5)
{
break;
}
}*/
}
}
//void Hand::checkFingerPoint(ICoordinateMapper * mapper, UINT16 * depthArray)
//{
// initVisited();
// clearHandOutLineVector();
// //找到第一个轮廓点:
// int x = HandCenter.m_depthX;
// int y = HandCenter.m_depthY;
// while (!m_pHandLineArray[y][x]){
// x--;
// if (x == 0)
// {
// break;
// }
// }
//
// if (!m_pHandLineArray[y][x])
// {
// return;
// }
// int nx, ny;
//
// while (true){
//
// float z = getCameraZFromDepthXY(mapper, x, y, depthArray[y * cDepthWidth + x]);
// HandPoint *point = new HandPoint(x, y, z);
//
// HandOutline.push_back(point);
//
// findNextXY(x, y, nx, ny);
// if (nx == -1 && ny == -1)
// {
// break;
// }
// x = nx;
// y = ny;
// }
//
//}
void Hand::findNextXY(const int & oldX, const int & oldY, int & newX, int & newY)
{
if (m_pHandLineArray == nullptr)
{
return;
}
int startX = oldX - 1;
int startY = oldY - 1;
int endX = oldX - 1;
int endY = oldY;
if (oldY == 0)
{
//左上边界:
if (oldX == 0)
{
startX = oldX + 1;
startY = oldY;
endX = oldX;
endY = oldY + 1;
}
//右上边界:
else if(oldX == cDepthWidth - 1){
startX = oldX;
startY = oldY + 1;
endX = oldX - 1;
endY = oldY;
}
//上边界:
else{
startX = oldX + 1;
startY = oldY;
endX = oldX - 1;
endY = oldY;
}
}
if (oldY == cDepthHeight - 1)
{
//左下边界:
if (oldX == 0)
{
startX = oldX;
startY = oldY - 1;
endX = oldX + 1;
endY = oldY;
}
//右下边界:
else if (oldX == cDepthWidth - 1){
startX = oldX - 1;
startY = oldY;
endX = oldX;
endY = oldY - 1;
}
//下边界:
else{
startX = oldX - 1;
startY = oldY;
endX = oldX + 1;
endY = oldY;
}
}
while (true)
{
if (!m_visited[startY][startX] && m_pHandLineArray[startY][startX])
{
m_visited[startY][startX] = true;
break;
}
m_visited[startY][startX] = true;
if (startX == endX && startY == endY)
{
break;
}
if (startY == oldY - 1 && startX < oldX + 1)
{
startX++;
}
if (startX == oldX + 1 && startY < oldY + 1)
{
startY++;
}
if (startY == oldY + 1 && startX > oldX - 1)
{
startX--;
}
if (startX == oldX - 1 && startY > oldY - 1)
{
startY--;
}
}
if (m_pHandLineArray[startY][startX])
{
newX = startX;
newY = startY;
}
else
{
newX = -1;
newY = -1;
}
}
void Hand::addThreshold(float val)
{
this->m_depthThreshold += val;
} | [
"774172772@qq.com"
] | 774172772@qq.com |
a8e77e7d4949f0d8ac1fbde5f2e0694e78f61025 | c8b39acfd4a857dc15ed3375e0d93e75fa3f1f64 | /Engine/Plugins/Editor/USDImporter/Source/ThirdParty/USD/include/boost/container/detail/multiallocation_chain.hpp | 32f87c8ae9b7d819f90b967ff914da1b9dbe3a04 | [
"BSL-1.0",
"MIT",
"LicenseRef-scancode-proprietary-license"
] | permissive | windystrife/UnrealEngine_NVIDIAGameWorks | c3c7863083653caf1bc67d3ef104fb4b9f302e2a | b50e6338a7c5b26374d66306ebc7807541ff815e | refs/heads/4.18-GameWorks | 2023-03-11T02:50:08.471040 | 2022-01-13T20:50:29 | 2022-01-13T20:50:29 | 124,100,479 | 262 | 179 | MIT | 2022-12-16T05:36:38 | 2018-03-06T15:44:09 | C++ | UTF-8 | C++ | false | false | 10,052 | hpp | //////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/container for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_CONTAINER_DETAIL_MULTIALLOCATION_CHAIN_HPP
#define BOOST_CONTAINER_DETAIL_MULTIALLOCATION_CHAIN_HPP
#ifndef BOOST_CONFIG_HPP
# include <boost/config.hpp>
#endif
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp>
// container
#include <boost/container/container_fwd.hpp>
// container/detail
#include <boost/container/detail/to_raw_pointer.hpp>
#include <boost/container/detail/transform_iterator.hpp>
#include <boost/container/detail/type_traits.hpp>
// intrusive
#include <boost/intrusive/slist.hpp>
#include <boost/intrusive/pointer_traits.hpp>
// move
#include <boost/move/utility_core.hpp>
namespace boost {
namespace container {
namespace container_detail {
template<class VoidPointer>
class basic_multiallocation_chain
{
private:
typedef bi::slist_base_hook<bi::void_pointer<VoidPointer>
,bi::link_mode<bi::normal_link>
> node;
typedef typename boost::intrusive::pointer_traits
<VoidPointer>::template rebind_pointer<char>::type char_ptr;
typedef typename boost::intrusive::
pointer_traits<char_ptr>::difference_type difference_type;
typedef bi::slist< node
, bi::linear<true>
, bi::cache_last<true>
, bi::size_type<typename boost::container::container_detail::make_unsigned<difference_type>::type>
> slist_impl_t;
slist_impl_t slist_impl_;
typedef typename boost::intrusive::pointer_traits
<VoidPointer>::template rebind_pointer<node>::type node_ptr;
typedef typename boost::intrusive::
pointer_traits<node_ptr> node_ptr_traits;
static node & to_node(const VoidPointer &p)
{ return *static_cast<node*>(static_cast<void*>(container_detail::to_raw_pointer(p))); }
static VoidPointer from_node(node &n)
{ return node_ptr_traits::pointer_to(n); }
static node_ptr to_node_ptr(const VoidPointer &p)
{ return node_ptr_traits::static_cast_from(p); }
BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_multiallocation_chain)
public:
typedef VoidPointer void_pointer;
typedef typename slist_impl_t::iterator iterator;
typedef typename slist_impl_t::size_type size_type;
basic_multiallocation_chain()
: slist_impl_()
{}
basic_multiallocation_chain(const void_pointer &b, const void_pointer &before_e, size_type n)
: slist_impl_(to_node_ptr(b), to_node_ptr(before_e), n)
{}
basic_multiallocation_chain(BOOST_RV_REF(basic_multiallocation_chain) other)
: slist_impl_(::boost::move(other.slist_impl_))
{}
basic_multiallocation_chain& operator=(BOOST_RV_REF(basic_multiallocation_chain) other)
{
slist_impl_ = ::boost::move(other.slist_impl_);
return *this;
}
bool empty() const
{ return slist_impl_.empty(); }
size_type size() const
{ return slist_impl_.size(); }
iterator before_begin()
{ return slist_impl_.before_begin(); }
iterator begin()
{ return slist_impl_.begin(); }
iterator end()
{ return slist_impl_.end(); }
iterator last()
{ return slist_impl_.last(); }
void clear()
{ slist_impl_.clear(); }
iterator insert_after(iterator it, void_pointer m)
{ return slist_impl_.insert_after(it, to_node(m)); }
void push_front(const void_pointer &m)
{ return slist_impl_.push_front(to_node(m)); }
void push_back(const void_pointer &m)
{ return slist_impl_.push_back(to_node(m)); }
void_pointer pop_front()
{
node & n = slist_impl_.front();
void_pointer ret = from_node(n);
slist_impl_.pop_front();
return ret;
}
void splice_after(iterator after_this, basic_multiallocation_chain &x, iterator before_b, iterator before_e, size_type n)
{ slist_impl_.splice_after(after_this, x.slist_impl_, before_b, before_e, n); }
void splice_after(iterator after_this, basic_multiallocation_chain &x)
{ slist_impl_.splice_after(after_this, x.slist_impl_); }
void erase_after(iterator before_b, iterator e, size_type n)
{ slist_impl_.erase_after(before_b, e, n); }
void_pointer incorporate_after(iterator after_this, const void_pointer &b, size_type unit_bytes, size_type num_units)
{
typedef typename boost::intrusive::pointer_traits<char_ptr> char_pointer_traits;
char_ptr elem = char_pointer_traits::static_cast_from(b);
if(num_units){
char_ptr prev_elem = elem;
elem += unit_bytes;
for(size_type i = 0; i != num_units-1; ++i, elem += unit_bytes){
::new (container_detail::to_raw_pointer(prev_elem)) void_pointer(elem);
prev_elem = elem;
}
slist_impl_.incorporate_after(after_this, to_node_ptr(b), to_node_ptr(prev_elem), num_units);
}
return elem;
}
void incorporate_after(iterator after_this, void_pointer b, void_pointer before_e, size_type n)
{ slist_impl_.incorporate_after(after_this, to_node_ptr(b), to_node_ptr(before_e), n); }
void swap(basic_multiallocation_chain &x)
{ slist_impl_.swap(x.slist_impl_); }
static iterator iterator_to(const void_pointer &p)
{ return slist_impl_t::s_iterator_to(to_node(p)); }
std::pair<void_pointer, void_pointer> extract_data()
{
std::pair<void_pointer, void_pointer> ret
(slist_impl_.begin().operator->()
,slist_impl_.last().operator->());
slist_impl_.clear();
return ret;
}
};
template<class T>
struct cast_functor
{
typedef typename container_detail::add_reference<T>::type result_type;
template<class U>
result_type operator()(U &ptr) const
{ return *static_cast<T*>(static_cast<void*>(&ptr)); }
};
template<class MultiallocationChain, class T>
class transform_multiallocation_chain
: public MultiallocationChain
{
private:
BOOST_MOVABLE_BUT_NOT_COPYABLE(transform_multiallocation_chain)
//transform_multiallocation_chain(const transform_multiallocation_chain &);
//transform_multiallocation_chain & operator=(const transform_multiallocation_chain &);
typedef typename MultiallocationChain::void_pointer void_pointer;
typedef typename boost::intrusive::pointer_traits
<void_pointer> void_pointer_traits;
typedef typename void_pointer_traits::template
rebind_pointer<T>::type pointer;
typedef typename boost::intrusive::pointer_traits
<pointer> pointer_traits;
static pointer cast(const void_pointer &p)
{ return pointer_traits::static_cast_from(p); }
public:
typedef transform_iterator
< typename MultiallocationChain::iterator
, container_detail::cast_functor <T> > iterator;
typedef typename MultiallocationChain::size_type size_type;
transform_multiallocation_chain()
: MultiallocationChain()
{}
transform_multiallocation_chain(BOOST_RV_REF(transform_multiallocation_chain) other)
: MultiallocationChain(::boost::move(static_cast<MultiallocationChain&>(other)))
{}
transform_multiallocation_chain(BOOST_RV_REF(MultiallocationChain) other)
: MultiallocationChain(::boost::move(static_cast<MultiallocationChain&>(other)))
{}
transform_multiallocation_chain& operator=(BOOST_RV_REF(transform_multiallocation_chain) other)
{
return static_cast<MultiallocationChain&>
(this->MultiallocationChain::operator=(::boost::move(static_cast<MultiallocationChain&>(other))));
}
/*
void push_front(const pointer &mem)
{ holder_.push_front(mem); }
void push_back(const pointer &mem)
{ return holder_.push_back(mem); }
void swap(transform_multiallocation_chain &other_chain)
{ holder_.swap(other_chain.holder_); }
void splice_after(iterator after_this, transform_multiallocation_chain &x, iterator before_b, iterator before_e, size_type n)
{ holder_.splice_after(after_this.base(), x.holder_, before_b.base(), before_e.base(), n); }
void incorporate_after(iterator after_this, pointer b, pointer before_e, size_type n)
{ holder_.incorporate_after(after_this.base(), b, before_e, n); }
*/
pointer pop_front()
{ return cast(this->MultiallocationChain::pop_front()); }
/*
bool empty() const
{ return holder_.empty(); }
iterator before_begin()
{ return iterator(holder_.before_begin()); }
*/
iterator begin()
{ return iterator(this->MultiallocationChain::begin()); }
/*
iterator end()
{ return iterator(holder_.end()); }
iterator last()
{ return iterator(holder_.last()); }
size_type size() const
{ return holder_.size(); }
void clear()
{ holder_.clear(); }
*/
iterator insert_after(iterator it, pointer m)
{ return iterator(this->MultiallocationChain::insert_after(it.base(), m)); }
static iterator iterator_to(const pointer &p)
{ return iterator(MultiallocationChain::iterator_to(p)); }
std::pair<pointer, pointer> extract_data()
{
std::pair<void_pointer, void_pointer> data(this->MultiallocationChain::extract_data());
return std::pair<pointer, pointer>(cast(data.first), cast(data.second));
}
/*
MultiallocationChain &extract_multiallocation_chain()
{ return holder_; }*/
};
}}}
// namespace container_detail {
// namespace container {
// namespace boost {
#include <boost/container/detail/config_end.hpp>
#endif //BOOST_CONTAINER_DETAIL_MULTIALLOCATION_CHAIN_HPP
| [
"tungnt.rec@gmail.com"
] | tungnt.rec@gmail.com |
51ef3e2f9a11db5ef8af54dcab0ba2eda593c1ec | bd0b341c3839734e4c2ed9a61ea90deae83f7b8d | /Marlin/ServerEvent.h | 3fdfac13e27c4b5ea7821fa0e5b2393bebf636c7 | [] | no_license | robertbjarum/CXHibernate | 976e823ae037a4715ac77786e2951ee157cb2216 | 4fa4c366ab6975fc2174144fb65cd9276941ab43 | refs/heads/master | 2023-06-03T08:25:02.008286 | 2021-06-26T15:04:56 | 2021-06-26T15:04:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,719 | h | /////////////////////////////////////////////////////////////////////////////////
//
// SourceFile: ServerEvent.h
//
// Marlin Server: Internet server/client
//
// Copyright (c) 2015-2018 ir. W.E. Huisman
// 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.
//
#pragma once
// Server push event
class ServerEvent
{
public:
// Standard constructores
ServerEvent() { m_id = 0; };
ServerEvent(CString p_event) { m_id = 0;m_event = p_event; };
ServerEvent(ServerEvent* p_event)
{
m_id = p_event->m_id;
m_event = p_event->m_event;
m_data = p_event->m_data;
}
// Event data
UINT m_id;
CString m_event;
CString m_data;
};
| [
"edwig.huisman@hetnet.nl"
] | edwig.huisman@hetnet.nl |
1ffd4a9e83d8d7183a967fbd5762572ce2273662 | 7122467c9db9d3392271587717701d6bf0b68024 | /第四章:树与二叉树/4.3节习题/problem_6.cpp | 70d3a94c1b31a98265ff299069ff1f3cc4ee3c79 | [] | no_license | Happyxianyueveryday/wdpl | bb0795f9f412efe8ffa01bcbcbb5b7dee2edd026 | ff9f3d1f31807e86ef4ce77b5e68fd696dbd08b9 | refs/heads/master | 2020-05-20T10:22:28.692484 | 2019-08-12T15:33:30 | 2019-08-12T15:33:30 | 185,524,489 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,362 | cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* buildTree(vector<int>& preorder, vector<int>& inorder) {
if(!preorder.size()||!inorder.size())
return NULL;
// 1. 前序遍历序列的首元素就是根结点
TreeNode *root=new TreeNode(preorder[0]);
preorder.erase(preorder.begin()); // 弹出根结点
// 2. 在中序遍历序列中查找根结点的值的位置,该位置左侧为根结点的左子树,该位置右侧为根结点的右子树
vector<int> left, right;
int index=-1;
for(int i=0;i<inorder.size();i++)
{
if(inorder[i]==root->val)
{
index=i;
break;
}
}
for(int i=0;i<inorder.size();i++)
{
if(i<index)
left.push_back(inorder[i]);
if(i>index)
right.push_back(inorder[i]);
}
// 3. 递归生成根结点的左子树和右子树
root->left=buildTree(preorder, left);
root->right=buildTree(preorder, right);
return root;
}
}; | [
"noreply@github.com"
] | noreply@github.com |
e070ee3a814c2f2b04b08fe7cd6d9af38f778e67 | 57fa84e55f5944a435ec2510bfc9a64532ab9d92 | /src/bench/mempool_eviction.cpp | 64679d9b3abbe9ade4994b4930f45397131b84ee | [
"MIT"
] | permissive | barrystyle/deftchain-0.17 | 133d3bffec152738166a01bd14d6d2a26962432a | d93b9307d8919117b10129a2828cb98833a1c9a1 | refs/heads/master | 2020-04-17T01:26:28.232962 | 2018-09-30T12:18:20 | 2018-09-30T12:20:27 | 166,091,970 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 5,298 | cpp | // Copyright (c) 2011-2018 The Bitcoin Core developers
// Copyright (c) 2018 The Deftchain developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <bench/bench.h>
#include <policy/policy.h>
#include <txmempool.h>
#include <list>
#include <vector>
static void AddTx(const CTransactionRef& tx, const CAmount& nFee, CTxMemPool& pool) EXCLUSIVE_LOCKS_REQUIRED(pool.cs)
{
int64_t nTime = 0;
unsigned int nHeight = 1;
bool spendsCoinbase = false;
unsigned int sigOpCost = 4;
LockPoints lp;
pool.addUnchecked(tx->GetHash(), CTxMemPoolEntry(
tx, nFee, nTime, nHeight,
spendsCoinbase, sigOpCost, lp));
}
// Right now this is only testing eviction performance in an extremely small
// mempool. Code needs to be written to generate a much wider variety of
// unique transactions for a more meaningful performance measurement.
static void MempoolEviction(benchmark::State& state)
{
CMutableTransaction tx1 = CMutableTransaction();
tx1.vin.resize(1);
tx1.vin[0].scriptSig = CScript() << OP_1;
tx1.vin[0].scriptWitness.stack.push_back({1});
tx1.vout.resize(1);
tx1.vout[0].scriptPubKey = CScript() << OP_1 << OP_EQUAL;
tx1.vout[0].nValue = 10 * COIN;
CMutableTransaction tx2 = CMutableTransaction();
tx2.vin.resize(1);
tx2.vin[0].scriptSig = CScript() << OP_2;
tx2.vin[0].scriptWitness.stack.push_back({2});
tx2.vout.resize(1);
tx2.vout[0].scriptPubKey = CScript() << OP_2 << OP_EQUAL;
tx2.vout[0].nValue = 10 * COIN;
CMutableTransaction tx3 = CMutableTransaction();
tx3.vin.resize(1);
tx3.vin[0].prevout = COutPoint(tx2.GetHash(), 0);
tx3.vin[0].scriptSig = CScript() << OP_2;
tx3.vin[0].scriptWitness.stack.push_back({3});
tx3.vout.resize(1);
tx3.vout[0].scriptPubKey = CScript() << OP_3 << OP_EQUAL;
tx3.vout[0].nValue = 10 * COIN;
CMutableTransaction tx4 = CMutableTransaction();
tx4.vin.resize(2);
tx4.vin[0].prevout.SetNull();
tx4.vin[0].scriptSig = CScript() << OP_4;
tx4.vin[0].scriptWitness.stack.push_back({4});
tx4.vin[1].prevout.SetNull();
tx4.vin[1].scriptSig = CScript() << OP_4;
tx4.vin[1].scriptWitness.stack.push_back({4});
tx4.vout.resize(2);
tx4.vout[0].scriptPubKey = CScript() << OP_4 << OP_EQUAL;
tx4.vout[0].nValue = 10 * COIN;
tx4.vout[1].scriptPubKey = CScript() << OP_4 << OP_EQUAL;
tx4.vout[1].nValue = 10 * COIN;
CMutableTransaction tx5 = CMutableTransaction();
tx5.vin.resize(2);
tx5.vin[0].prevout = COutPoint(tx4.GetHash(), 0);
tx5.vin[0].scriptSig = CScript() << OP_4;
tx5.vin[0].scriptWitness.stack.push_back({4});
tx5.vin[1].prevout.SetNull();
tx5.vin[1].scriptSig = CScript() << OP_5;
tx5.vin[1].scriptWitness.stack.push_back({5});
tx5.vout.resize(2);
tx5.vout[0].scriptPubKey = CScript() << OP_5 << OP_EQUAL;
tx5.vout[0].nValue = 10 * COIN;
tx5.vout[1].scriptPubKey = CScript() << OP_5 << OP_EQUAL;
tx5.vout[1].nValue = 10 * COIN;
CMutableTransaction tx6 = CMutableTransaction();
tx6.vin.resize(2);
tx6.vin[0].prevout = COutPoint(tx4.GetHash(), 1);
tx6.vin[0].scriptSig = CScript() << OP_4;
tx6.vin[0].scriptWitness.stack.push_back({4});
tx6.vin[1].prevout.SetNull();
tx6.vin[1].scriptSig = CScript() << OP_6;
tx6.vin[1].scriptWitness.stack.push_back({6});
tx6.vout.resize(2);
tx6.vout[0].scriptPubKey = CScript() << OP_6 << OP_EQUAL;
tx6.vout[0].nValue = 10 * COIN;
tx6.vout[1].scriptPubKey = CScript() << OP_6 << OP_EQUAL;
tx6.vout[1].nValue = 10 * COIN;
CMutableTransaction tx7 = CMutableTransaction();
tx7.vin.resize(2);
tx7.vin[0].prevout = COutPoint(tx5.GetHash(), 0);
tx7.vin[0].scriptSig = CScript() << OP_5;
tx7.vin[0].scriptWitness.stack.push_back({5});
tx7.vin[1].prevout = COutPoint(tx6.GetHash(), 0);
tx7.vin[1].scriptSig = CScript() << OP_6;
tx7.vin[1].scriptWitness.stack.push_back({6});
tx7.vout.resize(2);
tx7.vout[0].scriptPubKey = CScript() << OP_7 << OP_EQUAL;
tx7.vout[0].nValue = 10 * COIN;
tx7.vout[1].scriptPubKey = CScript() << OP_7 << OP_EQUAL;
tx7.vout[1].nValue = 10 * COIN;
CTxMemPool pool;
LOCK(pool.cs);
// Create transaction references outside the "hot loop"
const CTransactionRef tx1_r{MakeTransactionRef(tx1)};
const CTransactionRef tx2_r{MakeTransactionRef(tx2)};
const CTransactionRef tx3_r{MakeTransactionRef(tx3)};
const CTransactionRef tx4_r{MakeTransactionRef(tx4)};
const CTransactionRef tx5_r{MakeTransactionRef(tx5)};
const CTransactionRef tx6_r{MakeTransactionRef(tx6)};
const CTransactionRef tx7_r{MakeTransactionRef(tx7)};
while (state.KeepRunning()) {
AddTx(tx1_r, 10000LL, pool);
AddTx(tx2_r, 5000LL, pool);
AddTx(tx3_r, 20000LL, pool);
AddTx(tx4_r, 7000LL, pool);
AddTx(tx5_r, 1000LL, pool);
AddTx(tx6_r, 1100LL, pool);
AddTx(tx7_r, 9000LL, pool);
pool.TrimToSize(pool.DynamicMemoryUsage() * 3 / 4);
pool.TrimToSize(GetVirtualTransactionSize(tx1));
}
}
BENCHMARK(MempoolEviction, 41000);
| [
"barrystyle@westnet.com.au"
] | barrystyle@westnet.com.au |
a1ad8b921f9660f7b6588f94619e0fcc9db7f87c | 792e697ba0f9c11ef10b7de81edb1161a5580cfb | /tools/clang/lib/CodeGen/CGVTT.cpp | 564d9f354e64658d8509328199724d0b0db30c9d | [
"Apache-2.0",
"LLVM-exception",
"NCSA"
] | permissive | opencor/llvmclang | 9eb76cb6529b6a3aab2e6cd266ef9751b644f753 | 63b45a7928f2a8ff823db51648102ea4822b74a6 | refs/heads/master | 2023-08-26T04:52:56.472505 | 2022-11-02T04:35:46 | 2022-11-03T03:55:06 | 115,094,625 | 0 | 1 | Apache-2.0 | 2021-08-12T22:29:21 | 2017-12-22T08:29:14 | LLVM | UTF-8 | C++ | false | false | 7,012 | cpp | //===--- CGVTT.cpp - Emit LLVM Code for C++ VTTs --------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This contains code dealing with C++ code generation of VTTs (vtable tables).
//
//===----------------------------------------------------------------------===//
#include "CodeGenModule.h"
#include "CGCXXABI.h"
#include "clang/AST/RecordLayout.h"
#include "clang/AST/VTTBuilder.h"
using namespace clang;
using namespace CodeGen;
static llvm::GlobalVariable *
GetAddrOfVTTVTable(CodeGenVTables &CGVT, CodeGenModule &CGM,
const CXXRecordDecl *MostDerivedClass,
const VTTVTable &VTable,
llvm::GlobalVariable::LinkageTypes Linkage,
VTableLayout::AddressPointsMapTy &AddressPoints) {
if (VTable.getBase() == MostDerivedClass) {
assert(VTable.getBaseOffset().isZero() &&
"Most derived class vtable must have a zero offset!");
// This is a regular vtable.
return CGM.getCXXABI().getAddrOfVTable(MostDerivedClass, CharUnits());
}
return CGVT.GenerateConstructionVTable(MostDerivedClass,
VTable.getBaseSubobject(),
VTable.isVirtual(),
Linkage,
AddressPoints);
}
void
CodeGenVTables::EmitVTTDefinition(llvm::GlobalVariable *VTT,
llvm::GlobalVariable::LinkageTypes Linkage,
const CXXRecordDecl *RD) {
VTTBuilder Builder(CGM.getContext(), RD, /*GenerateDefinition=*/true);
llvm::ArrayType *ArrayType =
llvm::ArrayType::get(CGM.Int8PtrTy, Builder.getVTTComponents().size());
SmallVector<llvm::GlobalVariable *, 8> VTables;
SmallVector<VTableAddressPointsMapTy, 8> VTableAddressPoints;
for (const VTTVTable *i = Builder.getVTTVTables().begin(),
*e = Builder.getVTTVTables().end(); i != e; ++i) {
VTableAddressPoints.push_back(VTableAddressPointsMapTy());
VTables.push_back(GetAddrOfVTTVTable(*this, CGM, RD, *i, Linkage,
VTableAddressPoints.back()));
}
SmallVector<llvm::Constant *, 8> VTTComponents;
for (const VTTComponent *i = Builder.getVTTComponents().begin(),
*e = Builder.getVTTComponents().end(); i != e; ++i) {
const VTTVTable &VTTVT = Builder.getVTTVTables()[i->VTableIndex];
llvm::GlobalVariable *VTable = VTables[i->VTableIndex];
VTableLayout::AddressPointLocation AddressPoint;
if (VTTVT.getBase() == RD) {
// Just get the address point for the regular vtable.
AddressPoint =
getItaniumVTableContext().getVTableLayout(RD).getAddressPoint(
i->VTableBase);
} else {
AddressPoint = VTableAddressPoints[i->VTableIndex].lookup(i->VTableBase);
assert(AddressPoint.AddressPointIndex != 0 &&
"Did not find ctor vtable address point!");
}
llvm::Value *Idxs[] = {
llvm::ConstantInt::get(CGM.Int32Ty, 0),
llvm::ConstantInt::get(CGM.Int32Ty, AddressPoint.VTableIndex),
llvm::ConstantInt::get(CGM.Int32Ty, AddressPoint.AddressPointIndex),
};
llvm::Constant *Init = llvm::ConstantExpr::getGetElementPtr(
VTable->getValueType(), VTable, Idxs, /*InBounds=*/true,
/*InRangeIndex=*/1);
Init = llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast(Init,
CGM.Int8PtrTy);
VTTComponents.push_back(Init);
}
llvm::Constant *Init = llvm::ConstantArray::get(ArrayType, VTTComponents);
VTT->setInitializer(Init);
// Set the correct linkage.
VTT->setLinkage(Linkage);
if (CGM.supportsCOMDAT() && VTT->isWeakForLinker())
VTT->setComdat(CGM.getModule().getOrInsertComdat(VTT->getName()));
// Set the right visibility.
CGM.setGVProperties(VTT, RD);
}
llvm::GlobalVariable *CodeGenVTables::GetAddrOfVTT(const CXXRecordDecl *RD) {
assert(RD->getNumVBases() && "Only classes with virtual bases need a VTT");
SmallString<256> OutName;
llvm::raw_svector_ostream Out(OutName);
cast<ItaniumMangleContext>(CGM.getCXXABI().getMangleContext())
.mangleCXXVTT(RD, Out);
StringRef Name = OutName.str();
// This will also defer the definition of the VTT.
(void) CGM.getCXXABI().getAddrOfVTable(RD, CharUnits());
VTTBuilder Builder(CGM.getContext(), RD, /*GenerateDefinition=*/false);
llvm::ArrayType *ArrayType =
llvm::ArrayType::get(CGM.Int8PtrTy, Builder.getVTTComponents().size());
unsigned Align = CGM.getDataLayout().getABITypeAlignment(CGM.Int8PtrTy);
llvm::GlobalVariable *GV = CGM.CreateOrReplaceCXXRuntimeVariable(
Name, ArrayType, llvm::GlobalValue::ExternalLinkage, Align);
GV->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
return GV;
}
uint64_t CodeGenVTables::getSubVTTIndex(const CXXRecordDecl *RD,
BaseSubobject Base) {
BaseSubobjectPairTy ClassSubobjectPair(RD, Base);
SubVTTIndiciesMapTy::iterator I = SubVTTIndicies.find(ClassSubobjectPair);
if (I != SubVTTIndicies.end())
return I->second;
VTTBuilder Builder(CGM.getContext(), RD, /*GenerateDefinition=*/false);
for (llvm::DenseMap<BaseSubobject, uint64_t>::const_iterator I =
Builder.getSubVTTIndicies().begin(),
E = Builder.getSubVTTIndicies().end(); I != E; ++I) {
// Insert all indices.
BaseSubobjectPairTy ClassSubobjectPair(RD, I->first);
SubVTTIndicies.insert(std::make_pair(ClassSubobjectPair, I->second));
}
I = SubVTTIndicies.find(ClassSubobjectPair);
assert(I != SubVTTIndicies.end() && "Did not find index!");
return I->second;
}
uint64_t
CodeGenVTables::getSecondaryVirtualPointerIndex(const CXXRecordDecl *RD,
BaseSubobject Base) {
SecondaryVirtualPointerIndicesMapTy::iterator I =
SecondaryVirtualPointerIndices.find(std::make_pair(RD, Base));
if (I != SecondaryVirtualPointerIndices.end())
return I->second;
VTTBuilder Builder(CGM.getContext(), RD, /*GenerateDefinition=*/false);
// Insert all secondary vpointer indices.
for (llvm::DenseMap<BaseSubobject, uint64_t>::const_iterator I =
Builder.getSecondaryVirtualPointerIndices().begin(),
E = Builder.getSecondaryVirtualPointerIndices().end(); I != E; ++I) {
std::pair<const CXXRecordDecl *, BaseSubobject> Pair =
std::make_pair(RD, I->first);
SecondaryVirtualPointerIndices.insert(std::make_pair(Pair, I->second));
}
I = SecondaryVirtualPointerIndices.find(std::make_pair(RD, Base));
assert(I != SecondaryVirtualPointerIndices.end() && "Did not find index!");
return I->second;
}
| [
"agarny@hellix.com"
] | agarny@hellix.com |
84e195ed124fb62b34afa50e41208e70d5f72d1d | 86ded80f80d33fa6122410576a4d07799be8c14b | /Toph Solution/Running Average.cpp | 2973167bafb4802a07830f8f20283260fddf33e9 | [] | no_license | mahfuzur-mafu/Problem-Solving- | 4bfb742b8d6ff52145c31039f7542f80797fd987 | 2b6fe2ba8b2778de4b761a7bee5479b1880084d1 | refs/heads/master | 2023-07-02T21:56:56.220276 | 2021-08-07T16:04:52 | 2021-08-07T16:04:52 | 297,142,699 | 5 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 279 | cpp | #include<iostream>
using namespace std;
int main()
{
int n,i;
cin>>n;
float a[1000];
float sum=0;
for(i=1;i<=n;i++)
{
cin>>a[i];
sum=sum+a[i];
float res;
res= sum/i;
cout<<res<<endl;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
1bc875216c4ebcbc75f9ea90d011c4e39ed75ec6 | eec07678af5f2b6a1c510e4eefc0f7a6bcbe3521 | /Codeforces/DP/serejaSuffixes.cpp | 7c6aa42171fa950bc327b2e9ab3e3f8eb901a0c5 | [] | no_license | vjacIIT/Codes | 7236018f1a9840a24e407fb293671f0a7b773c1d | 94c304dae14339e8b868f3bc91aad0ac90eba40f | refs/heads/master | 2022-03-04T15:48:06.603333 | 2022-02-20T16:46:04 | 2022-02-20T16:46:04 | 153,982,754 | 0 | 0 | null | 2020-08-20T20:02:34 | 2018-10-21T07:12:43 | C++ | UTF-8 | C++ | false | false | 405 | cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
vector<int> v(n,0);
vector<int> f(n,0);
set<int> s;
for(int i=0; i<n; i++) cin>>v[i];
s.insert(v[n-1]);
f[n-1]=1;
for(int i=n-2; i>=0; i--){
if(s.find(v[i])==s.end()){
f[i]=f[i+1]+1;
s.insert(v[i]);
}
else f[i]=f[i+1];
}
for(int i=0; i<m; i++){
cin>>n;
n--;
cout<<f[n]<<endl;
}
return 0;
}
| [
"noreply@github.com"
] | noreply@github.com |
7237ec73f87f46d90450f43a3d807f57ae528612 | f14626611951a4f11a84cd71f5a2161cd144a53a | /Server/GameServer/App/Message/logmessage.cpp | 9ed0e74c20ab29def9f37f4dc364b8c1fd2a2da0 | [] | no_license | Deadmanovi4/mmo-resourse | 045616f9be76f3b9cd4a39605accd2afa8099297 | 1c310e15147ae775a59626aa5b5587c6895014de | refs/heads/master | 2021-05-29T06:14:28.650762 | 2015-06-18T01:16:43 | 2015-06-18T01:16:43 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 7,881 | cpp | #include "StdAfx.h"
#include "SequenceString.h"
#include "../BillApp/accountauthen.h"
#include "../Player.h"
#include "../PlayerMan/PlayerMan.h"
#include "../RgnManager.h"
#include "../ServerRegion.h"
#include "../Session/CPlug.h"
#include "../Session/CSessionFactory.h"
#include "../../Server/BillClient.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// 响应LOG消息
void OnLogMessage(CMessage* pMsg)
{
char pszLogingInfo[512]="";
switch(pMsg->GetType())
{
case MSG_C2S_LOG_PLAYERENTER://新玩家连接到gameserver
{
long lSignCode = pMsg->GetLong();
CGUID PlayerID;
pMsg -> GetGUID(PlayerID);
char szCdkey[128];
pMsg->GetStr(szCdkey, sizeof(szCdkey));
// 登陆时角色存在于GameServer 并且player不为NULL,说明已经进去了游戏
CPlayer* player = GetGame()->FindPlayer(PlayerID);
//如果Player存在,做错误说明输出。
if (player)
{
char szPlayerID[50] = "";
PlayerID.tostring(szPlayerID);
Log4c::Trace(ROOT_MODULE,"error,when the player(Name:%s,RegionID:%d)connect the gs,that has the same guid player!", player->GetName(),player->GetRegionID());
}
long lLoginCount = GameManager::GetInstance()->AddLoginSession(pMsg->GetSocketID());
// 正常
CMessage msg(MSG_S2W_LOG_QUEST_PLAYERDATA);
msg.Add((long)lSignCode);
msg.Add(PlayerID);
msg.Add(lLoginCount);
msg.Add(szCdkey);
msg.Add(pMsg->GetIP());
msg.Send();
}
break;
case MSG_W2S_LOG_KICKPLAYER://worldserver通知踢一个特定ID的玩家
{
}
break;
case MSG_W2S_LOG_ANSWER_PLAYERDATA://worldserver返回玩家的详细属性
{
#ifdef _RUNSTACKINFO3_
char pszStatckInfo[1024]="";
CMessage::AsyWriteFile(GetGame()->GetStatckFileName(),"MSG_W2S_LOG_ANSWER_PLAYERDATA Start");
#endif
long lSignCode = pMsg->GetLong();
long lFlag=pMsg->GetLong();
CGUID PlayerID;
pMsg->GetGUID(PlayerID);
long lLoginCount = pMsg->GetLong();
char szPlayerID[40];
PlayerID.tostring(szPlayerID);
#ifdef _RUNSTACKINFO3_
char pszGUID[50]="";
PlayerID.tostring(pszGUID);
_snprintf(pszStatckInfo,1024,"playerID:%s,flag:%d",pszGUID,lFlag);
CMessage::AsyWriteFile(GetGame()->GetStatckFileName(),pszStatckInfo);
#endif
long lC2SSocketID = GameManager::GetInstance()->RemoveLoginSessionByCountNum(lLoginCount);
// login server上没有该玩家
if (lFlag==0)
{
CMessage msg1(MSG_S2C_LOG_ANSWER_PLAYERDATA);
msg1.Add(lSignCode);
msg1.Add((long)0);
msg1.SendToSocket(lC2SSocketID);
Log4c::Trace(ROOT_MODULE,"返回玩家的详细属性时 (%s) 没有正常登陆,已被勒令断开!", szPlayerID);
GetGame()->GetNetServer()->DisConn(lC2SSocketID);
return;
}
// 该玩家在线
if (lFlag==-1)
{
CMessage msg1(MSG_S2C_LOG_ANSWER_PLAYERDATA);
msg1.Add(lSignCode);
msg1.Add((long)0);
msg1.SendToSocket(lC2SSocketID);
Log4c::Trace(ROOT_MODULE,"返回玩家的详细属性时 (%s) 该玩家在线!", szPlayerID);
GetGame()->GetNetServer()->DisConn(lC2SSocketID);
return;
}
// GameServer非法
if (lFlag==-2)
{
CMessage msg1(MSG_S2C_LOG_ANSWER_PLAYERDATA);
msg1.Add(lSignCode);
msg1.Add((long)0);
msg1.SendToSocket(lC2SSocketID);
Log4c::Warn(ROOT_MODULE,"返回玩家的详细属性时 (%s) GameServer非法!", szPlayerID);
GetGame()->GetNetServer()->DisConn(lC2SSocketID);
return;
}
// 验证码错误
if (lFlag==-3)
{
CMessage msg1(MSG_S2C_LOG_ANSWER_PLAYERDATA);
msg1.Add(lSignCode);
msg1.Add((long)0);
msg1.SendToSocket(lC2SSocketID);
Log4c::Warn(ROOT_MODULE,"返回玩家的详细属性时 (%s) GameServer非法!", szPlayerID);
GetGame()->GetNetServer()->DisConn(lC2SSocketID);
return;
}
//该连接已经断开
if(lC2SSocketID == 0)
{
//##发送消息
CMessage msg( MSG_S2W_LOG_PLAYERQUIT );
msg.Add( PlayerID );
msg.Add((long)-1); // 非正常退出
msg.Add(0L);
msg.Add("");
msg.Send();
return;
}
// 该玩家不存在于PlayerList,也就是说没有收到该玩家的 MSG_C2S_LOG_PLAYERENTER 消息,或者在中间被其他登陆踢掉了
if( lFlag == 1 )
{
// 起用了这个功能
if( GetGame()->GetSetup()->dwMsgValidateTime )
{
// 添加到MAP里
//GetGame()->RemoveValidateTime(lPlayerID);
GetGame()->AppendValidateTime(PlayerID, true);
// 发送GamerSErver 的时间到Cleint
CMessage msgServerTime(MSG_S2C_LOG_GAMESERVERTIME);
unsigned long ulServerTime = /*(ULONG)time(NULL)*/ timeGetTime();
msgServerTime.Add( PlayerID );
msgServerTime.Add( ulServerTime );
//! 添加一个日期时间发送到客户端[2008-1-3]
long ldatatime = 0;
time(&ldatatime);
msgServerTime.Add(ldatatime);
//!
msgServerTime.SendToSocket(lC2SSocketID);
}
CPlayer *pPlayer = GetGame()->FindPlayer(PlayerID);
if(pPlayer)
{
//进入此处,程序逻辑发生了错误,要查找bug
//如果情况发生做一些强制性处理
Log4c::Error(ROOT_MODULE,"%-15s error,when the player(Name:%s,RegionID:%d) enter the game,the gs has the same guid player",
__FUNCTION__,pPlayer->GetName(),pPlayer->GetRegionID());
CServerRegion* pRegion = dynamic_cast<CServerRegion*>(pPlayer->GetFather());
if(pRegion)
pRegion->RemoveObject(pPlayer);
}
else
{
pPlayer = OBJ_CREATE(CPlayer);
if(pPlayer)
pPlayer->SetExID(PlayerID);
}
pPlayer->SetSignCode(lSignCode);
// 初始化玩家数据
DBReadSet setReadDB;
pMsg->GetDBReadSet(setReadDB);
pPlayer->DecodeFromDataBlock(setReadDB);
//GetGame()->FreeShareDB(ByteData);
//关联SocketID到PlayerID
CMessage::MapPlayerIDSocket(PlayerID, lC2SSocketID);
GetGame()->AddPlayer(pPlayer);
// Fox@20081110 增加玩家
GetInst(CPlayerMan).AddPlayer(pPlayer);
// 进入游戏
if(!pPlayer->OnEnter())
{
GetGame()->KickPlayer(pPlayer->GetExID());
}
if(GetGame()->IsBSConnected())
{
CMessage msg(MSG_S2B_GET_BALANCE);
msg.Add(pPlayer->GetAccount());
msg.Add(pPlayer->GetExID());
msg.SendToBS();
}
}
#ifdef _RUNSTACKINFO3_
CMessage::AsyWriteFile(GetGame()->GetStatckFileName(),"MSG_W2S_LOG_ANSWER_PLAYERDATA End");
#endif
}
break;
case MSG_W2S_LOG_REPEAT_LOGIN:
{
CGUID PlayerID;
pMsg->GetGUID(PlayerID);
char strCDKey[256];
pMsg -> GetStr( strCDKey, 256 );
char szPlayerID[40] = {0};
PlayerID.tostring(szPlayerID);
CPlayer* pPlayer = GetGame() -> FindPlayer( PlayerID );
if( pPlayer )
{
//##首先发送消息给该玩家。
CMessage repeateLoginMsg(MSG_S2C_OTHER_REPEATLOGIN);
repeateLoginMsg.Add("有人尝试从其他地方登陆游戏,你被强制下线了.");
repeateLoginMsg.SendToPlayer(PlayerID);
GetGame()->OnPlayerExit(PlayerID, FALSE);
GetGame()->RemovePlayer(PlayerID);
// 断掉连接
GetGame()->KickPlayer(PlayerID);
}
else
{
//##发送消息
CMessage msg( MSG_S2W_LOG_PLAYERQUIT );
msg.Add( PlayerID );
msg.Add((long)-1); // 非正常退出
msg.Add(0L);
msg.Add( strCDKey );
msg.Send();
}
}
break;
case MSG_W2S_LOG_FCM_TIME:
{
CGUID playerID;
pMsg->GetGUID(playerID);
long lTime = pMsg->GetLong();
CPlayer* pPlayer = GetGame()->FindPlayer(playerID);
if(pPlayer)
{
CMessage msg(MSG_L2C_LOG_FCM_TIME);
msg.Add(lTime);
msg.SendToPlayer(playerID);
}
}
break;
}
}
| [
"yco.chen@gmail.com"
] | yco.chen@gmail.com |
ad4f049e8789b1e45129933868a54b0bdb382a59 | 942e6d29b3e6193c8541b31140ea9aef5554379b | /Sources/Animations/Skin/SkinLoader.cpp | d9a27a93ceff0900abc99f6ea18e4f7f85c7e6db | [
"MIT"
] | permissive | hhYanGG/Acid | e7da2457bdd5820f7cba38b1602762f426dbd849 | f5543e9290aee5e25c6ecdafe8a3051054b203c0 | refs/heads/master | 2020-03-27T13:11:56.488574 | 2018-08-28T17:47:35 | 2018-08-28T18:10:46 | 146,595,670 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,683 | cpp | #include "SkinLoader.hpp"
namespace acid
{
SkinLoader::SkinLoader(LoadedValue *libraryControllers, const int &maxWeights) :
m_skinData(libraryControllers->GetChild("controller")->GetChild("skin")),
m_maxWeights(maxWeights),
m_jointOrder(std::vector<std::string>()),
m_verticesSkinData(std::vector<VertexSkinData *>())
{
LoadJointsList();
auto weights = LoadWeights();
LoadedValue *weightsDataNode = m_skinData->GetChild("vertex_weights");
auto effectorJointCounts = GetEffectiveJointsCounts(weightsDataNode);
GetSkinData(weightsDataNode, effectorJointCounts, weights);
}
SkinLoader::~SkinLoader()
{
for (auto &vertex : m_verticesSkinData)
{
delete vertex;
}
}
void SkinLoader::LoadJointsList()
{
LoadedValue *inputNode = m_skinData->GetChild("vertex_weights");
std::string jointDataId = inputNode->GetChildWithAttribute("input", "semantic", "JOINT")->GetAttribute("source").substr(1);
LoadedValue *jointsNode = m_skinData->GetChildWithAttribute("source", "id", jointDataId)->GetChild("Name_array");
m_jointOrder = FormatString::Split(jointsNode->GetValue(), " ");
}
std::vector<float> SkinLoader::LoadWeights()
{
LoadedValue *inputNode = m_skinData->GetChild("vertex_weights");
std::string weightsDataId = inputNode->GetChildWithAttribute("input", "semantic", "WEIGHT")->GetAttribute("source").substr(1);
LoadedValue *weightsNode = m_skinData->GetChildWithAttribute("source", "id", weightsDataId)->GetChild("float_array");
auto rawData = FormatString::Split(weightsNode->GetValue(), " ");
auto weights = std::vector<float>(rawData.size());
for (uint32_t i = 0; i < weights.size(); i++)
{
weights[i] = std::stof(rawData[i]);
}
return weights;
}
std::vector<int> SkinLoader::GetEffectiveJointsCounts(LoadedValue *weightsDataNode)
{
auto rawData = FormatString::Split(weightsDataNode->GetChild("vcount")->GetString(), " ");
auto counts = std::vector<int>(rawData.size());
for (uint32_t i = 0; i < rawData.size(); i++)
{
counts[i] = std::stoi(rawData[i]);
}
return counts;
}
void SkinLoader::GetSkinData(LoadedValue *weightsDataNode, const std::vector<int> &counts, const std::vector<float> &weights)
{
auto rawData = FormatString::Split(weightsDataNode->GetChild("v")->GetString(), " ");
int pointer = 0;
for (auto count : counts)
{
auto skinData = new VertexSkinData();
for (int i = 0; i < count; i++)
{
int jointId = std::stoi(rawData[pointer++]);
int weightId = std::stoi(rawData[pointer++]);
skinData->AddJointEffect(jointId, weights[weightId]);
}
skinData->LimitJointNumber(m_maxWeights);
m_verticesSkinData.emplace_back(skinData);
}
}
}
| [
"mattparks5855@gmail.com"
] | mattparks5855@gmail.com |
0e2fe39ba84ab22cd3834ecc027adb041c218964 | db843df43e8c0aab14b48f9f76c06d2be2f3a109 | /node/monte_carlo_mi.cpp | bb9045f07a3c9322dde1c1c75133a1c43d430fd9 | [] | no_license | sportdeath/range_mi | 6c256f3af1ee4fe836d1bfc851b173204d4e5270 | 909772c1374ffcaf17fa6ab2072be650d8410584 | refs/heads/master | 2023-02-08T09:58:33.223204 | 2021-01-01T20:59:43 | 2021-01-01T20:59:43 | 181,079,565 | 16 | 7 | null | null | null | null | UTF-8 | C++ | false | false | 9,247 | cpp | #include <ros/ros.h>
#include <random>
#include <nav_msgs/OccupancyGrid.h>
#include <range_mi/MIGrid.h>
#include <range_mi/grid_line.hpp>
unsigned int num_iterations = 999;
class MonteCarloMI {
public:
MonteCarloMI() {
// Initialize the uniform distribution
gen = std::mt19937(random_device());
dist = std::uniform_real_distribution<double>(0, 1);
// Initialize the node handle
n = ros::NodeHandle("~");
// Fetch the ROS parameters
std::string map_topic, mi_topic;
n.getParam("map_topic", map_topic);
n.getParam("mi_topic", mi_topic);
// Ray tracing parameters
n.getParam("num_beams", num_beams);
// Visualization vvv
std::string mi_map_topic,
binary_map_topic, conditional_map_topic;
n.getParam("visualize", visualize);
n.getParam("visualize_more", visualize_more);
n.getParam("mi_map_topic", mi_map_topic);
n.getParam("binary_map_topic", binary_map_topic);
n.getParam("conditional_map_topic", conditional_map_topic);
// Construct a publisher for mutual information
mi_pub = n.advertise<range_mi::MIGrid>(mi_topic, 1, true);
mi_map_pub = n.advertise<nav_msgs::OccupancyGrid>(mi_map_topic, 1, true);
binary_map_pub = n.advertise<nav_msgs::OccupancyGrid>(binary_map_topic, 1, true);
conditional_map_pub = n.advertise<nav_msgs::OccupancyGrid>(conditional_map_topic, 1, true);
// Subscribe to the map
map_sub = n.subscribe(map_topic, 1, &MonteCarloMI::map_callback, this);
}
void map_callback(const nav_msgs::OccupancyGrid & map_msg) {
// Store map information
map_info = map_msg.info;
map_header = map_msg.header;
// Convert to probability
vacancy = std::vector<double>(map_info.height * map_info.width);
for (unsigned int i = 0; i < vacancy.size(); i++) {
vacancy[i] = 1 - map_msg.data[i]/99.;
if (vacancy[i] < 0 or vacancy[i] > 1) {
vacancy[i] = 0;
}
vacancy[i] = std::pow(vacancy[i], map_info.resolution);
}
// Also initialize a place for randomized and conditional vacancies
binary_vacancy = std::vector<double>(map_info.height * map_info.width);
conditional_vacancy = std::vector<double>(map_info.height * map_info.width);
cconditional_vacancy = std::vector<double>(map_info.height * map_info.width);
conditional_vacancy_viz = std::vector<double>(map_info.height * map_info.width);
// And a place for drawing lines
line = std::vector<unsigned int>(2 * std::max(map_info.height, map_info.width));
widths = std::vector<double>(2 * std::max(map_info.height, map_info.width));
// And the mutual information map
mi = std::vector<double>(map_info.height * map_info.width, 0);
compute_mi();
}
static double entropy(const std::vector<double> & v) {
double e = 0;
for (unsigned int i = 0; i < v.size(); i++) {
if (v[i] > 0 and v[i] < 1) {
// Accumulate the binary entropy
e -=
v[i] * std::log(v[i]) +
(1 - v[i]) * std::log(1 - v[i]);
}
}
return e;
}
void compute_mi() {
// Clear the mutual information
std::fill(mi.begin(), mi.end(), 0);
// Compute the entropy of the map
double map_entropy = entropy(vacancy);
for (unsigned int it = 0; it < num_iterations and ros::ok(); it++) {
// Randomly assign binary vacancy values based
// on the vacancy probabilities
for (unsigned int cell = 0; cell < vacancy.size(); cell++) {
double random = dist(gen);
if (random < vacancy[cell]) {
binary_vacancy[cell] = 1;
} else {
binary_vacancy[cell] = 0;
}
}
// Initialize the map to equal the original vacancies
for (unsigned int i = 0; i < vacancy.size(); i++) {
cconditional_vacancy[i] = vacancy[i];
}
// If we are conditioning
if (false) {
// Compute a scan at the conditioned point
for (int beam = 0; beam < num_beams; beam++) {
double theta = beam * (2 * M_PI)/(num_beams);
range_mi::grid_line::draw(
map_info.height,
map_info.width,
73.5, 44.5, theta,
line.data(),
widths.data(),
num_cells);
// Iterate over the beam
for (unsigned int i = 0; i < num_cells; i++) {
unsigned int line_cell = line[i];
cconditional_vacancy[line_cell] = binary_vacancy[line_cell];
// Stop if we have reached an occupied cell
if (binary_vacancy[line_cell] == 0) break;
}
}
// Compute the entropy of the map
map_entropy = entropy(cconditional_vacancy);
}
// Given the randomized "ground truth" values compute
// the result of a scan in the map and how the entropy changed.
for (unsigned int cell = 0; cell < vacancy.size(); cell++) {
// Initialize the map to equal the conditioned vacancies
for (unsigned int i = 0; i < vacancy.size(); i++) {
conditional_vacancy[i] = cconditional_vacancy[i];
}
// For each beam cast rays and update the map
for (int beam = 0; beam < num_beams; beam++) {
double theta = beam * (2 * M_PI)/(num_beams);
double y = std::floor(cell/map_info.width);
double x = cell - y * map_info.width;
y += 0.5;
x += 0.5;
// Draw a beam
range_mi::grid_line::draw(
map_info.height,
map_info.width,
x, y, theta,
line.data(),
widths.data(),
num_cells);
// Iterate over the beam
for (unsigned int i = 0; i < num_cells; i++) {
unsigned int line_cell = line[i];
conditional_vacancy[line_cell] = binary_vacancy[line_cell];
// Stop if we have reached an occupied cell
if (binary_vacancy[line_cell] == 0) break;
}
}
// Choose the center cell for visualization purposes
if (cell == (map_info.height * map_info.width)/2 + map_info.width/2) {
for (unsigned int i = 0; i < vacancy.size(); i++) {
conditional_vacancy_viz[i] = conditional_vacancy[i];
}
conditional_vacancy_viz[cell] = 0;
}
// Compute the entropy of the new map
double conditional_map_entropy = entropy(conditional_vacancy);
// Accumulate
mi[cell] += (map_entropy - conditional_map_entropy);
}
// Visualize
if (visualize and visualize_more) draw_map();
// Plot
publish_mi();
}
}
void publish_mi() {
// Construct a message for the mutual information
range_mi::MIGrid mi_msg;
mi_msg.header = map_header;
mi_msg.data = mi;
mi_msg.height = map_info.height;
mi_msg.width = map_info.width;
// Publish
mi_pub.publish(mi_msg);
}
void draw_map() {
// Convert to an occupancy map for visualization
nav_msgs::OccupancyGrid mi_map_msg;
mi_map_msg.header = map_header;
mi_map_msg.info = map_info;
mi_map_msg.data = std::vector<int8_t>(mi.size());
double mi_max = *std::max_element(mi.begin(), mi.end());
for (size_t i = 0; i < mi.size(); i++) {
// Normalize between 0 and 1
double normalized = mi[i]/mi_max;
// Change to 100%
mi_map_msg.data[i] = 100 * (1 - normalized);
}
mi_map_pub.publish(mi_map_msg);
// Publish the binary map
nav_msgs::OccupancyGrid binary_map_msg = mi_map_msg;
for (size_t i = 0; i < mi.size(); i++) {
binary_map_msg.data[i] = 100 * (1 - binary_vacancy[i]);
}
binary_map_pub.publish(binary_map_msg);
// Publish the conditioned map
nav_msgs::OccupancyGrid conditional_map_msg = mi_map_msg;
for (size_t i = 0; i < mi.size(); i++) {
conditional_map_msg.data[i] = 100 * (1 - conditional_vacancy_viz[i]);
}
conditional_map_pub.publish(conditional_map_msg);
}
private:
ros::NodeHandle n;
ros::Subscriber map_sub;
ros::Publisher mi_pub;
ros::Publisher
mi_map_pub,
binary_map_pub,
conditional_map_pub;
// Random number generator
std::random_device random_device;
std::mt19937 gen;
std::uniform_real_distribution<double> dist;
// Parameters
int num_beams;
bool visualize, visualize_more;
// Map data
nav_msgs::MapMetaData map_info;
std_msgs::Header map_header;
std::vector<double> mi;
std::vector<double> vacancy, binary_vacancy, conditional_vacancy, cconditional_vacancy, conditional_vacancy_viz;
// Line data
std::vector<unsigned int> line;
std::vector<double> widths;
unsigned int num_cells;
};
int main(int argc, char ** argv) {
ros::init(argc, argv, "monte_carlo_mi");
MonteCarloMI mc_mi;
ros::spin();
return 0;
}
| [
"tfh@mit.edu"
] | tfh@mit.edu |
71e2f8a875eba148868efafcc330d20242e1a6ad | 1985ce7f7568f7cd76686aa2d93c2fb11e96ab83 | /espledclock/espledclock.ino | 0fd17c8002be9353afd70a8ebf10f92a8d148638 | [] | no_license | ReinVelt/Arduino-rein | 3f4352619c4e3f762ce459971e2c99e928442dfa | fd6e6b7796e981a4869d994fee1ff8be1c903e26 | refs/heads/master | 2021-01-04T02:42:08.103999 | 2016-12-10T12:41:25 | 2016-12-10T12:41:25 | 76,112,047 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,924 | ino | /*
Udp NTP Client
Get the time from a Network Time Protocol (NTP) time server
Demonstrates use of UDP sendPacket and ReceivePacket
For more on NTP time servers and the messages needed to communicate with them,
see http://en.wikipedia.org/wiki/Network_Time_Protocol
created 4 Sep 2010
by Michael Margolis
modified 9 Apr 2012
by Tom Igoe
updated for the ESP8266 12 Apr 2015
by Ivan Grokhotkov
This code is in the public domain.
*/
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
char ssid[] = "M3CH4N1C4P3"; // your network SSID (name)
char pass[] = "mechanicape"; // your network password
unsigned int localPort = 2390; // local port to listen for UDP packets
/* Don't hardwire the IP address or we won't get the benefits of the pool.
* Lookup the IP address for the host name instead */
//IPAddress timeServer(129, 6, 15, 28); // time.nist.gov NTP server
IPAddress timeServerIP; // time.nist.gov NTP server address
const char* ntpServerName = "time.nist.gov";
const int NTP_PACKET_SIZE = 48; // NTP time stamp is in the first 48 bytes of the message
byte packetBuffer[ NTP_PACKET_SIZE]; //buffer to hold incoming and outgoing packets
// A UDP instance to let us send and receive packets over UDP
WiFiUDP udp;
void setup()
{
Serial.begin(115200);
Serial.println();
Serial.println();
// We start by connecting to a WiFi network
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
Serial.println("Starting UDP");
udp.begin(localPort);
Serial.print("Local port: ");
Serial.println(udp.localPort());
}
// send an NTP request to the time server at the given address
unsigned long sendNTPpacket(IPAddress& address)
{
Serial.println("sending NTP packet...");
// set all bytes in the buffer to 0
memset(packetBuffer, 0, NTP_PACKET_SIZE);
// Initialize values needed to form NTP request
// (see URL above for details on the packets)
packetBuffer[0] = 0b11100011; // LI, Version, Mode
packetBuffer[1] = 0; // Stratum, or type of clock
packetBuffer[2] = 6; // Polling Interval
packetBuffer[3] = 0xEC; // Peer Clock Precision
// 8 bytes of zero for Root Delay & Root Dispersion
packetBuffer[12] = 49;
packetBuffer[13] = 0x4E;
packetBuffer[14] = 49;
packetBuffer[15] = 52;
// all NTP fields have been given values, now
// you can send a packet requesting a timestamp:
udp.beginPacket(address, 123); //NTP requests are to port 123
udp.write(packetBuffer, NTP_PACKET_SIZE);
udp.endPacket();
}
void loop()
{
//get a random server from the pool
WiFi.hostByName(ntpServerName, timeServerIP);
sendNTPpacket(timeServerIP); // send an NTP packet to a time server
// wait to see if a reply is available
delay(1000);
int cb = udp.parsePacket();
if (!cb) {
Serial.println("no packet yet");
}
else {
Serial.print("packet received, length=");
Serial.println(cb);
// We've received a packet, read the data from it
udp.read(packetBuffer, NTP_PACKET_SIZE); // read the packet into the buffer
//the timestamp starts at byte 40 of the received packet and is four bytes,
// or two words, long. First, esxtract the two words:
unsigned long highWord = word(packetBuffer[40], packetBuffer[41]);
unsigned long lowWord = word(packetBuffer[42], packetBuffer[43]);
// combine the four bytes (two words) into a long integer
// this is NTP time (seconds since Jan 1 1900):
unsigned long secsSince1900 = highWord << 16 | lowWord;
Serial.print("Seconds since Jan 1 1900 = " );
Serial.println(secsSince1900);
// now convert NTP time into everyday time:
Serial.print("Unix time = ");
// Unix time starts on Jan 1 1970. In seconds, that's 2208988800:
const unsigned long seventyYears = 2208988800UL;
// subtract seventy years:
unsigned long epoch = secsSince1900 - seventyYears;
// print Unix time:
Serial.println(epoch);
// print the hour, minute and second:
Serial.print("The UTC time is "); // UTC is the time at Greenwich Meridian (GMT)
Serial.print((epoch % 86400L) / 3600); // print the hour (86400 equals secs per day)
Serial.print(':');
if ( ((epoch % 3600) / 60) < 10 ) {
// In the first 10 minutes of each hour, we'll want a leading '0'
Serial.print('0');
}
Serial.print((epoch % 3600) / 60); // print the minute (3600 equals secs per minute)
Serial.print(':');
if ( (epoch % 60) < 10 ) {
// In the first 10 seconds of each minute, we'll want a leading '0'
Serial.print('0');
}
Serial.println(epoch % 60); // print the second
}
// wait ten seconds before asking for the time again
delay(10000);
}
| [
"rein@velt.org"
] | rein@velt.org |
e0700f68d3079ecee551d5bbf88b5ad3d1ef4ea5 | 753a57645d0824a750fa07176bdf7e37369940f6 | /Engine/Plugins/UnrealCS/Source/MonoPlugin/Private/GeneratedScriptLibraries/InstancedStaticMeshComponent.script.h | c90590c88cc77d5b7bd2e3915fded32c4c89fa4e | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | marynate/UnrealCS | 5782c4dd1b3fe6e136dcee54ce430aabd97b70a4 | de43f7e42ca037445202d59c8114fafc30e031ec | refs/heads/master | 2021-01-19T13:01:35.048880 | 2017-02-22T02:18:33 | 2017-02-22T02:18:33 | 82,354,770 | 2 | 1 | null | 2017-02-18T02:17:07 | 2017-02-18T02:17:06 | null | UTF-8 | C++ | false | false | 3,907 | h | #pragma once
namespace UnrealEngine
{
class _UInstancedStaticMeshComponent
{
static MonoArray* GetInstancesOverlappingBox(UInstancedStaticMeshComponent* _this,FBox* Box,int32 bBoxInWorldSpace)
{
TArray<int32> ___ret = _this->GetInstancesOverlappingBox(*Box,bBoxInWorldSpace>0?true:false);
return TArrayToMonoArray(___ret,"System.Int32,mscorlib");
}
static MonoArray* GetInstancesOverlappingSphere(UInstancedStaticMeshComponent* _this,FVector* Center,float Radius,int32 bSphereInWorldSpace)
{
TArray<int32> ___ret = _this->GetInstancesOverlappingSphere(*Center,Radius,bSphereInWorldSpace>0?true:false);
return TArrayToMonoArray(___ret,"System.Int32,mscorlib");
}
static void SetCullDistances(UInstancedStaticMeshComponent* _this,int32 StartCullDistance,int32 EndCullDistance)
{
_this->SetCullDistances(StartCullDistance,EndCullDistance);
}
static int32 GetInstanceCount(UInstancedStaticMeshComponent* _this)
{
int32 ___ret = _this->GetInstanceCount();
return ___ret;
}
static void ClearInstances(UInstancedStaticMeshComponent* _this)
{
_this->ClearInstances();
}
static int32 RemoveInstance(UInstancedStaticMeshComponent* _this,int32 InstanceIndex)
{
bool ___ret = _this->RemoveInstance(InstanceIndex);
return ___ret?1:0;
}
static int32 UpdateInstanceTransform(UInstancedStaticMeshComponent* _this,int32 InstanceIndex,FTransform* NewInstanceTransform,int32 bWorldSpace,int32 bMarkRenderStateDirty,int32 bTeleport)
{
bool ___ret = _this->UpdateInstanceTransform(InstanceIndex,*NewInstanceTransform,bWorldSpace>0?true:false,bMarkRenderStateDirty>0?true:false,bTeleport>0?true:false);
return ___ret?1:0;
}
static int32 GetInstanceTransform(UInstancedStaticMeshComponent* _this,int32 InstanceIndex,FTransform* OutInstanceTransform,int32 bWorldSpace)
{
bool ___ret = _this->GetInstanceTransform(InstanceIndex,*OutInstanceTransform,bWorldSpace>0?true:false);
return ___ret?1:0;
}
static int32 AddInstanceWorldSpace(UInstancedStaticMeshComponent* _this,FTransform* WorldTransform)
{
int32 ___ret = _this->AddInstanceWorldSpace(*WorldTransform);
return ___ret;
}
static int32 AddInstance(UInstancedStaticMeshComponent* _this,FTransform* InstanceTransform)
{
int32 ___ret = _this->AddInstance(*InstanceTransform);
return ___ret;
}
static UClass* StaticClass(){return UInstancedStaticMeshComponent::StaticClass();}
public:
static void BindFunctions()
{
mono_add_internal_call("UnrealEngine.UInstancedStaticMeshComponent::GetInstancesOverlappingBox",(const void*)GetInstancesOverlappingBox);
mono_add_internal_call("UnrealEngine.UInstancedStaticMeshComponent::GetInstancesOverlappingSphere",(const void*)GetInstancesOverlappingSphere);
mono_add_internal_call("UnrealEngine.UInstancedStaticMeshComponent::SetCullDistances",(const void*)SetCullDistances);
mono_add_internal_call("UnrealEngine.UInstancedStaticMeshComponent::GetInstanceCount",(const void*)GetInstanceCount);
mono_add_internal_call("UnrealEngine.UInstancedStaticMeshComponent::ClearInstances",(const void*)ClearInstances);
mono_add_internal_call("UnrealEngine.UInstancedStaticMeshComponent::RemoveInstance",(const void*)RemoveInstance);
mono_add_internal_call("UnrealEngine.UInstancedStaticMeshComponent::UpdateInstanceTransform",(const void*)UpdateInstanceTransform);
mono_add_internal_call("UnrealEngine.UInstancedStaticMeshComponent::GetInstanceTransform",(const void*)GetInstanceTransform);
mono_add_internal_call("UnrealEngine.UInstancedStaticMeshComponent::AddInstanceWorldSpace",(const void*)AddInstanceWorldSpace);
mono_add_internal_call("UnrealEngine.UInstancedStaticMeshComponent::AddInstance",(const void*)AddInstance);
mono_add_internal_call("UnrealEngine.UInstancedStaticMeshComponent::StaticClass",(const void*)StaticClass);
}
}
;
}
| [
"xg_55@126.com"
] | xg_55@126.com |
4e8cac8d3866a6b4823c62b15dbf8b154567fd30 | 0308bd8baccff9a59c7ac931ec00d418486d9e15 | /algorithms/algorithms2/116533_소인수분해.cpp | 645f3749529b10bf7d368f9430d602f81abe4e4e | [] | no_license | nanenchanga53/BackJoonAlgorithems | 55d2b532a8d54ba2c014346880657643cfa27ce4 | 9ac62dc26f3021a39bca518d16285447179d8daa | refs/heads/master | 2021-06-03T13:47:13.697788 | 2021-02-19T06:08:24 | 2021-02-19T06:08:24 | 134,537,167 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 459 | cpp | #include<iostream>
#include<algorithm>
#include<vector>
#include<climits>
#include<cmath>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
int n;
cin >> n;
int divNum=2;
while (n % divNum == 0 && n > 1)
{
n /= divNum ;
cout << 2 << '\n';
}
for (divNum = 3; divNum <= n; divNum += 2)
{
while (n % divNum == 0 && n > 1)
{
n /= divNum;
cout << divNum << '\n';
}
}
return 0;
} | [
"nanenchanga53@gmail.com"
] | nanenchanga53@gmail.com |
d782b51c90091fad338d2464f80ce0c0b3dfea20 | 6cecdbbe6eb721a0e43c07ed2b31bdcc9e553c55 | /Sail2D/Runs/first_flatplate_75_6/case/4000/nuTilda | 48137c348c83642529ae9bdf9c0e2982164144d8 | [] | no_license | kiranhegde/Gmsh | 799d8cbefb7dd3f3d35ded15b40292fd3ede6468 | fefa906dabfddd9b87cc1f0256df81b4735420e1 | refs/heads/master | 2021-01-19T23:21:57.414954 | 2015-01-21T02:02:37 | 2015-01-21T02:02:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 66,770 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "4000";
object nuTilda;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField nonuniform List<scalar>
6694
(
0.067551
0.061678
0.0561586
0.051076
0.0465269
0.042612
0.0394156
0.036944
0.0349507
0.0324731
0.02918
0.0257746
0.0734624
0.069248
0.0654487
0.0620829
0.0591751
0.0567423
0.0547881
0.0533007
0.0522462
0.0515699
0.0512077
0.0511077
0.07861
0.0755643
0.0728713
0.0705368
0.0685637
0.0669452
0.0656648
0.0646984
0.0640157
0.0635827
0.0633656
0.0633307
0.0830201
0.0807902
0.0788327
0.0771496
0.0757337
0.074572
0.0736483
0.0729441
0.0724393
0.0721145
0.0719503
0.0719278
0.0867668
0.0850841
0.083611
0.0823429
0.0812707
0.0803833
0.0796695
0.0791176
0.078716
0.0784538
0.0783204
0.0783047
0.0899174
0.0886144
0.08747
0.0864776
0.0856302
0.0849203
0.0843412
0.0838868
0.083551
0.0833285
0.083214
0.0832013
0.0925672
0.0915343
0.0906195
0.089817
0.0891232
0.0885345
0.0880481
0.087661
0.0873707
0.0871759
0.0870744
0.0870634
0.0948014
0.0939681
0.0932189
0.0925515
0.0919665
0.0914643
0.0910449
0.0907077
0.090451
0.0902757
0.0901843
0.0901749
0.0967017
0.0960151
0.095388
0.0948193
0.094313
0.0938739
0.0935043
0.0932067
0.0929787
0.0928142
0.0927315
0.0927251
0.0983406
0.0977558
0.0972213
0.0967246
0.0962725
0.0958794
0.0955466
0.0952794
0.095087
0.0949188
0.0948447
0.0948465
0.0268566
0.0307763
0.0331127
0.0354337
0.038232
0.0416386
0.0456401
0.0501733
0.0551626
0.0605276
0.0661833
0.0720781
0.0511837
0.0514669
0.0520745
0.0530653
0.0544879
0.0563767
0.058748
0.0615971
0.064898
0.0686072
0.0726695
0.0770501
0.063433
0.0636835
0.0641392
0.0648323
0.065794
0.067053
0.0686336
0.0705519
0.0728139
0.0754142
0.0783365
0.0815738
0.0720228
0.0722411
0.0726127
0.0731558
0.0738883
0.074828
0.0759916
0.0773931
0.079043
0.080947
0.0831056
0.0855276
0.0783925
0.0785875
0.0789066
0.0793595
0.0799562
0.0807065
0.0816198
0.0827047
0.0839696
0.0854215
0.0870653
0.0889104
0.0832819
0.0834583
0.0837403
0.0841326
0.0846401
0.0852674
0.0860182
0.0868965
0.0879071
0.0890548
0.0903452
0.0917821
0.087138
0.0872996
0.0875537
0.0879024
0.0883473
0.0888891
0.0895277
0.090263
0.0910966
0.0920309
0.0930683
0.0942032
0.0902439
0.0903928
0.0906251
0.090941
0.0913398
0.0918194
0.0923769
0.0930086
0.0937143
0.0944943
0.0953481
0.0962659
0.0927876
0.0929256
0.0931402
0.0934304
0.093794
0.0942268
0.0947242
0.0952767
0.0958882
0.0965539
0.0972726
0.0980248
0.0948973
0.0950259
0.0952254
0.0954944
0.0958295
0.0962236
0.0966742
0.0971662
0.0977138
0.0982918
0.098916
0.0995446
0.0364862
0.0308629
0.0253855
0.0203044
0.0158291
0.0120658
0.00900398
0.00655981
0.00463039
0.00311702
0.00192707
0.00122501
0.0366768
0.0316282
0.0267466
0.0222042
0.0181277
0.014576
0.0115435
0.00898002
0.00681154
0.00495218
0.00341746
0.00223671
0.0369433
0.0324512
0.0281119
0.0240361
0.0202965
0.0169261
0.0139225
0.0112529
0.0088535
0.00661551
0.00480724
0.00320962
0.0372407
0.0332407
0.0293569
0.0256599
0.022193
0.0189757
0.0160054
0.0132563
0.010676
0.00821128
0.0060955
0.00411739
0.0375533
0.0339676
0.0304592
0.0270692
0.0238239
0.0207348
0.0177979
0.0149903
0.0122718
0.009642
0.00726465
0.00495149
0.0378466
0.0346217
0.0314266
0.0282893
0.0252264
0.0222444
0.0193379
0.016486
0.0136576
0.0108897
0.0083026
0.00570465
0.0381322
0.035208
0.0322752
0.0293484
0.0264376
0.0235458
0.0206662
0.0177788
0.0148602
0.0119741
0.00921473
0.00637631
0.0383886
0.0357292
0.03302
0.0302716
0.0274893
0.0246737
0.0218172
0.0189003
0.0159051
0.0129173
0.010012
0.00696688
0.0386174
0.0361873
0.0336718
0.0310789
0.0284069
0.0256544
0.0228153
0.0198705
0.0168086
0.0137355
0.0107118
0.00750111
0.0388188
0.0365762
0.034225
0.031786
0.0292179
0.0265099
0.02367
0.0206682
0.0175074
0.01434
0.0112008
0.00782947
0.00108874
0.00129957
0.00184973
0.00240276
0.00300979
0.00377393
0.00487682
0.00654944
0.00870782
0.0114152
0.0147506
0.0188115
0.00155675
0.00169625
0.00222573
0.0028113
0.00350213
0.00440644
0.00565053
0.00737022
0.0095021
0.0121019
0.0152372
0.0189951
0.00205552
0.00204657
0.00257741
0.00323176
0.00404186
0.0050935
0.00645828
0.00821399
0.0103164
0.0128104
0.0157494
0.0192
0.00254175
0.00235788
0.00290964
0.00365752
0.0045989
0.00578489
0.0072453
0.00902981
0.0111027
0.0134981
0.0162629
0.019479
0.00299841
0.00264073
0.00322945
0.00408389
0.00515412
0.00645599
0.00799329
0.00980046
0.0118452
0.0141518
0.0167554
0.0196828
0.00341859
0.00290223
0.00353977
0.00450427
0.0056937
0.00709445
0.00869501
0.0105199
0.0125377
0.0147623
0.0172183
0.0199423
0.00380112
0.00314576
0.00383909
0.00491145
0.00620853
0.00769395
0.00934813
0.0111874
0.0131791
0.0153285
0.0176496
0.0201482
0.00414169
0.00337546
0.00413266
0.00530626
0.00669712
0.008253
0.00995254
0.0118032
0.0137697
0.0158496
0.0180488
0.02038
0.00446879
0.00358571
0.00438549
0.00565265
0.00713084
0.0087607
0.0105094
0.0123732
0.0143162
0.0163307
0.0184147
0.020559
0.00463285
0.00379177
0.00476156
0.00612954
0.00769546
0.00931743
0.0110442
0.0128696
0.0147561
0.0166951
0.0186862
0.0207131
0.00165119
0.00560196
0.0105445
0.01596
0.0213027
0.0262942
0.0309057
0.0358994
0.0416933
0.0480975
0.0549136
0.0620495
0.000927891
0.00474805
0.00846551
0.012396
0.0167413
0.0213562
0.026063
0.0309914
0.0361868
0.0421595
0.0493603
0.0571598
0.000647195
0.00332479
0.00775784
0.0123157
0.016405
0.0203929
0.0245021
0.0288702
0.0335496
0.0387166
0.0451019
0.0529983
0.000590927
0.00301951
0.00711827
0.0120831
0.0166204
0.0206919
0.0244963
0.0283146
0.0324014
0.0369416
0.0421155
0.0495322
0.000527276
0.00269698
0.00634102
0.0113222
0.0163935
0.020922
0.0249003
0.0285192
0.0321342
0.0361014
0.0406704
0.0468585
0.000490615
0.00250924
0.00590002
0.0106675
0.0159551
0.0208751
0.0252031
0.0289397
0.0323384
0.0358491
0.0399018
0.0449513
0.000456007
0.00233975
0.00549811
0.0100145
0.0153939
0.0206178
0.0252959
0.0293016
0.0327214
0.0359532
0.0395573
0.0440331
0.000428214
0.00220464
0.00517934
0.00945913
0.0147996
0.0202333
0.0252097
0.0295179
0.0331075
0.0362408
0.0395003
0.0435082
0.000403749
0.00208791
0.00490361
0.00896873
0.014205
0.0197732
0.0249942
0.029588
0.0334146
0.0365908
0.0396278
0.0432295
0.000382376
0.00198687
0.00466537
0.00854002
0.013634
0.0192714
0.0246883
0.0295361
0.0336172
0.0369277
0.0398574
0.0431181
0.000363329
0.00189766
0.00445529
0.00816
0.0130967
0.0187498
0.0243199
0.0293884
0.0337171
0.0372127
0.0401346
0.0431641
0.000346242
0.00181823
0.00426823
0.00782084
0.0125975
0.0182244
0.0239097
0.0291673
0.0337263
0.0374296
0.0404167
0.0432851
0.000330863
0.00174688
0.00410031
0.00751572
0.0121366
0.0177064
0.0234731
0.0288913
0.0336595
0.0375753
0.0406768
0.0434541
0.000319112
0.00168215
0.00394846
0.00723949
0.011712
0.0172031
0.0230218
0.028575
0.0335305
0.0376538
0.0409
0.0436472
0.000309722
0.00162305
0.00381021
0.00698782
0.0113205
0.0167187
0.0225638
0.028229
0.0333509
0.0376705
0.0410767
0.0438339
0.000301121
0.00156887
0.00368361
0.00675731
0.010959
0.0162555
0.0221052
0.0278619
0.0331308
0.0376341
0.0412116
0.0440482
0.000293204
0.00151891
0.00356695
0.00654498
0.0106239
0.015814
0.0216498
0.0274791
0.0328771
0.0375493
0.0412961
0.0442087
0.000285907
0.00147275
0.0034591
0.00634855
0.0103125
0.0153945
0.0212006
0.0270854
0.0325961
0.0374232
0.0413384
0.0443697
0.000279172
0.00143005
0.00335922
0.00616653
0.0100229
0.0149971
0.020761
0.026686
0.0322948
0.037264
0.0413442
0.0445066
0.000272934
0.00139042
0.00326644
0.00599729
0.0097527
0.0146209
0.0203329
0.0262849
0.0319787
0.0370779
0.0413167
0.0446165
0.000267232
0.00135349
0.00317988
0.00583932
0.0094999
0.0142648
0.0199176
0.0258847
0.031652
0.0368696
0.0412593
0.0446989
0.000263749
0.00131888
0.00309895
0.0056915
0.00926285
0.0139277
0.0195158
0.0254878
0.0313177
0.0366428
0.0411741
0.0447516
0.000267661
0.00128627
0.00302328
0.00555296
0.00904025
0.0136087
0.0191281
0.0250958
0.0309785
0.0364011
0.0410652
0.0447815
0.000299341
0.0012595
0.00295355
0.00542327
0.00883108
0.0133067
0.0187548
0.0247104
0.0306371
0.0361477
0.0409362
0.044789
0.000332925
0.00123413
0.00288816
0.00530142
0.0086342
0.0130209
0.0183961
0.0243327
0.030295
0.0358845
0.0407872
0.0447658
0.000357373
0.0012093
0.00282636
0.00518663
0.00844857
0.0127501
0.0180517
0.0239633
0.0299537
0.0356136
0.0406224
0.0447265
0.000375513
0.0011854
0.00276789
0.00507832
0.00827328
0.0124933
0.0177212
0.0236027
0.0296142
0.0353366
0.0404426
0.0446622
0.000389073
0.00116249
0.00271253
0.00497586
0.00810737
0.0122494
0.017404
0.0232513
0.0292774
0.0350551
0.0402508
0.0445836
0.000399151
0.00114068
0.00266006
0.00487889
0.00795015
0.0120175
0.0170996
0.0229088
0.028944
0.0347706
0.0400496
0.0444916
0.000406304
0.0011198
0.00261027
0.00478684
0.00780068
0.0117964
0.016807
0.0225751
0.0286141
0.0344836
0.039839
0.044382
0.00041069
0.0010997
0.00256286
0.00469924
0.00765847
0.0115855
0.0165258
0.0222505
0.0282888
0.0341962
0.039624
0.0442713
0.000412179
0.0010803
0.00251775
0.0046159
0.00752301
0.0113841
0.0162555
0.0219348
0.0279684
0.0339089
0.0394024
0.0441396
0.000410104
0.00106122
0.00247463
0.0045364
0.00739359
0.0111914
0.0159953
0.0216275
0.0276525
0.0336215
0.0391767
0.0440083
0.000403658
0.00104215
0.0024334
0.00446056
0.0072702
0.0110072
0.0157454
0.0213296
0.0273432
0.0333378
0.0389538
0.0438843
0.000393014
0.00102296
0.00239398
0.00438823
0.00715235
0.010831
0.0155051
0.0210405
0.0270394
0.0330543
0.0387187
0.0437043
0.000380575
0.00100411
0.00235628
0.00431918
0.00703975
0.0106623
0.0152739
0.0207596
0.0267409
0.0327722
0.0384837
0.0435526
0.000369711
0.000986354
0.00232048
0.00425328
0.00693198
0.0105005
0.0150513
0.0204868
0.0264475
0.0324912
0.0382441
0.0433757
0.000362297
0.000970161
0.00228657
0.00419034
0.00682893
0.0103455
0.0148371
0.0202225
0.026161
0.0322154
0.0380123
0.0432351
0.000358328
0.000955661
0.00225449
0.00413033
0.00673039
0.010197
0.0146313
0.0199669
0.0258818
0.0319445
0.0377791
0.0430577
0.000356894
0.000942621
0.00222417
0.00407306
0.00663606
0.0100546
0.0144334
0.0197197
0.0256091
0.0316762
0.0375412
0.0428668
0.000357013
0.000930783
0.00219544
0.00401831
0.00654579
0.00991814
0.0142431
0.0194804
0.0253427
0.0314109
0.0373023
0.0426777
0.000357999
0.000920029
0.00216825
0.003966
0.00645925
0.00978702
0.0140596
0.0192479
0.0250814
0.0311471
0.0370602
0.0424763
0.000359409
0.000910113
0.00214237
0.00391591
0.00637605
0.00966072
0.0138823
0.0190222
0.0248256
0.0308874
0.0368236
0.0422978
0.000360981
0.000900969
0.00211778
0.00386793
0.00629612
0.00953911
0.0137111
0.0188031
0.0245757
0.0306322
0.0365883
0.0421027
0.000362579
0.000892429
0.00209433
0.00382178
0.00621914
0.00942174
0.0135455
0.0185901
0.0243311
0.03038
0.0363516
0.0418997
0.000364135
0.000884481
0.0020719
0.00377742
0.00614491
0.00930839
0.0133852
0.0183828
0.0240913
0.0301308
0.0361168
0.0417077
0.000365619
0.000877028
0.00205051
0.00373474
0.00607322
0.00919873
0.0132297
0.018181
0.0238563
0.0298853
0.0358863
0.0415255
0.000367025
0.000870028
0.00203007
0.00369366
0.0060042
0.00909301
0.0130796
0.0179857
0.0236284
0.0296481
0.0356684
0.0413652
0.000368368
0.000863512
0.00201059
0.00365431
0.00593786
0.00899124
0.0129348
0.0177968
0.0234072
0.0294158
0.0354454
0.0411501
0.000369663
0.000857392
0.00199202
0.0036165
0.00587386
0.00889294
0.0127947
0.0176134
0.0231907
0.0291854
0.0352203
0.0409472
0.000370893
0.000851605
0.00197422
0.00358011
0.0058122
0.00879802
0.0126592
0.0174355
0.0229797
0.0289601
0.0350026
0.0407678
0.000372081
0.000846177
0.00195727
0.00354517
0.00575279
0.00870646
0.0125283
0.017263
0.0227743
0.0287393
0.034786
0.0405698
0.000373213
0.000841045
0.00194097
0.00351145
0.00569532
0.00861769
0.0124011
0.0170946
0.0225724
0.0285208
0.0345705
0.0403805
0.000374267
0.000836156
0.00192537
0.00347895
0.00563971
0.00853178
0.012278
0.0169319
0.0223777
0.0283129
0.0343769
0.0402515
0.000375259
0.000831501
0.00191036
0.00344754
0.00558599
0.00844864
0.0121588
0.016774
0.022188
0.0281072
0.0341692
0.0400147
0.000376164
0.000827062
0.00189586
0.00341709
0.00553379
0.00836778
0.0120425
0.0166192
0.0220007
0.0279018
0.0339615
0.0398317
0.00037699
0.00082287
0.00188205
0.00338785
0.00548343
0.00828972
0.0119302
0.0164697
0.0218193
0.0277027
0.0337631
0.0396581
0.000377761
0.000818863
0.00186883
0.00335976
0.00543499
0.00821441
0.0118216
0.0163243
0.021641
0.0275021
0.0335489
0.0394131
0.000378507
0.000815113
0.00185618
0.00333277
0.00538828
0.00814158
0.0117162
0.0161823
0.0214656
0.0273041
0.0333445
0.0392451
0.000379224
0.000811516
0.00184405
0.0033068
0.00534303
0.00807085
0.0116135
0.0160436
0.0212929
0.0271075
0.0331373
0.0390307
0.000379864
0.000807988
0.00183229
0.00328156
0.0052991
0.00800195
0.0115132
0.0159074
0.0211226
0.0269133
0.0329354
0.0388515
0.000380459
0.000804627
0.00182091
0.00325704
0.00525626
0.00793466
0.011415
0.0157738
0.0209555
0.0267235
0.032742
0.038685
0.000381007
0.000801384
0.00180986
0.00323317
0.0052145
0.00786896
0.011319
0.0156429
0.0207917
0.0265382
0.0325538
0.0385159
0.000381487
0.000798238
0.00179918
0.00320999
0.00517377
0.00780484
0.0112252
0.0155153
0.0206324
0.0263588
0.0323735
0.0383607
0.000381927
0.000795189
0.00178882
0.00318747
0.00513423
0.00774252
0.0111342
0.0153916
0.0204782
0.026185
0.0321971
0.0381953
0.000382325
0.000792243
0.00177877
0.00316567
0.00509586
0.00768201
0.0110458
0.0152712
0.0203276
0.0260137
0.0320172
0.0380101
0.000382689
0.000789428
0.00176911
0.00314462
0.00505868
0.00762334
0.01096
0.0151542
0.0201807
0.0258452
0.0318394
0.0378365
0.000383017
0.00078664
0.00175973
0.00312423
0.00502272
0.00756649
0.0108767
0.0150404
0.0200368
0.025678
0.0316574
0.0376404
0.00038332
0.000784021
0.00175074
0.00310459
0.00498796
0.00751144
0.0107959
0.0149296
0.019896
0.0255135
0.031481
0.0374768
0.000383678
0.000781368
0.00174184
0.00308538
0.00495408
0.00745779
0.010717
0.0148211
0.0197575
0.0253513
0.0313067
0.0373045
0.00038396
0.00077911
0.00173381
0.00306755
0.0049221
0.00740666
0.0106413
0.0147164
0.0196236
0.0251953
0.0311437
0.0371634
0.000384654
0.000775744
0.00172415
0.00304831
0.00488919
0.00735518
0.0105661
0.0146135
0.019493
0.0250427
0.0309784
0.0369816
0.000384617
0.000777136
0.00172133
0.00303574
0.00486378
0.00731262
0.010501
0.0145206
0.0193704
0.0248943
0.0308111
0.0368001
0.000389575
0.000761297
0.00170471
0.00302411
0.00484398
0.00727395
0.0104351
0.0144233
0.0192428
0.0247413
0.0306398
0.0366214
0.000348273
0.000789408
0.00163188
0.00287578
0.00465112
0.00705547
0.0102021
0.0141812
0.018996
0.0244997
0.0304182
0.0364343
0.00163683
0.00580465
0.010484
0.01562
0.021174
0.0271026
0.0333552
0.0398704
0.0465899
0.0534639
0.0604435
0.0675202
0.000425337
0.00181185
0.00521359
0.00937413
0.0143719
0.0201131
0.0264842
0.0333632
0.0406252
0.0481496
0.0558278
0.0635928
0.000472982
0.00162621
0.00412962
0.00746087
0.0116757
0.0167414
0.0226086
0.0291957
0.0363878
0.0440446
0.0520142
0.0601675
0.000726318
0.00156927
0.0036545
0.00649752
0.010167
0.0146826
0.0200524
0.0262467
0.0331902
0.0407623
0.0488072
0.0571698
0.000769149
0.00141658
0.00325071
0.00577078
0.00906278
0.0131718
0.0181392
0.023974
0.03064
0.0380482
0.0460586
0.0545078
0.000768678
0.00127032
0.0029228
0.00520577
0.00821499
0.012007
0.016643
0.0221589
0.0285505
0.0357607
0.0436736
0.05213
0.000763359
0.0011558
0.00266618
0.00476451
0.00754848
0.0110828
0.0154396
0.0206736
0.0268054
0.0338059
0.0415856
0.0499994
0.000757888
0.00106607
0.00245972
0.00440742
0.00700532
0.0103243
0.0144427
0.0194281
0.0253199
0.0321132
0.0397442
0.0480915
0.000753399
0.000993857
0.00228937
0.00411066
0.00655117
0.00968664
0.0135984
0.0183632
0.024035
0.0306278
0.0380983
0.0463293
0.000749609
0.00093468
0.00214664
0.00386008
0.00616547
0.00914199
0.0128725
0.0174405
0.0229108
0.0293137
0.0366277
0.044782
0.00074604
0.000885482
0.00202542
0.00364564
0.00583337
0.00867077
0.012241
0.0166321
0.0219177
0.0281412
0.0352974
0.0433159
0.000743119
0.000848549
0.00192094
0.00345954
0.00554364
0.00825802
0.0116851
0.0159163
0.0210322
0.0270863
0.0340865
0.0419725
0.000742334
0.000832531
0.0018298
0.00329614
0.00528802
0.00789264
0.011191
0.0152769
0.0202364
0.0261325
0.0329893
0.0407869
0.000743429
0.000830417
0.00174967
0.00315141
0.00506072
0.00756634
0.0107481
0.0147015
0.0195168
0.0252656
0.0319852
0.039665
0.000745115
0.000832477
0.00167885
0.00302244
0.00485766
0.00727279
0.0103484
0.0141801
0.018862
0.024472
0.0310553
0.0385991
0.000746566
0.000834497
0.00161595
0.0029068
0.00467483
0.00700696
0.00998532
0.0137051
0.0182629
0.0237415
0.0301925
0.0376131
0.000747536
0.000835421
0.00155975
0.00280245
0.00450904
0.00676484
0.00965375
0.0132698
0.0177114
0.0230646
0.0293847
0.036664
0.000748022
0.00083556
0.00150929
0.00270772
0.00435782
0.00654317
0.00934941
0.0128691
0.0172018
0.0224372
0.0286393
0.0358418
0.000748159
0.0008352
0.00146484
0.0026213
0.00421921
0.00633927
0.00906883
0.0124988
0.0167295
0.0218535
0.0279395
0.0350063
0.000748157
0.000835487
0.00143288
0.00254232
0.00409161
0.00615095
0.00880911
0.012155
0.0162897
0.0213077
0.0272812
0.0342368
0.000748321
0.000838076
0.0014188
0.00247032
0.00397368
0.00597627
0.00856778
0.011835
0.0158794
0.0207989
0.0266761
0.0335861
0.000748789
0.000843072
0.00141674
0.00240472
0.00386431
0.00581362
0.0083428
0.0115362
0.0154958
0.0203215
0.0260977
0.0328595
0.000749468
0.000849328
0.00141915
0.00234483
0.00376277
0.00566244
0.00813254
0.0112564
0.0151358
0.019872
0.0255514
0.0322285
0.00075018
0.000855616
0.00142182
0.00228989
0.00366839
0.00552162
0.0079356
0.010994
0.0147975
0.0194485
0.0250366
0.0316254
0.0007508
0.000861185
0.00142315
0.00223926
0.00358049
0.00538997
0.00775069
0.0107471
0.0144784
0.0190479
0.0245461
0.031028
0.000751249
0.000865788
0.00142275
0.00219232
0.00349834
0.00526648
0.00757661
0.0105142
0.014177
0.0186686
0.0240827
0.0304928
0.000751479
0.000869438
0.00142066
0.00214861
0.00342138
0.00515032
0.00741234
0.0102941
0.0138917
0.0183098
0.0236466
0.0299894
0.000751569
0.000872232
0.00141721
0.00210775
0.00334906
0.00504077
0.007257
0.0100857
0.0136213
0.0179691
0.0232291
0.0294776
0.000751503
0.000874306
0.00141263
0.00206966
0.00328091
0.00493723
0.00710984
0.00988799
0.0133646
0.0176454
0.022833
0.0290174
0.000751294
0.000875821
0.00140737
0.00203532
0.00321666
0.00483916
0.00697015
0.00970024
0.0131206
0.0173375
0.022455
0.028561
0.000751014
0.000877019
0.00140247
0.00200825
0.00315619
0.00474622
0.00683745
0.00952174
0.0128884
0.0170436
0.0220914
0.0281122
0.000750734
0.000878262
0.0013995
0.00199214
0.00309961
0.004658
0.00671116
0.00935176
0.0126669
0.0167626
0.0217427
0.0276903
0.000750516
0.000879968
0.00139947
0.00198597
0.00304697
0.00457425
0.00659112
0.00918956
0.0124552
0.0164933
0.0214072
0.0272791
0.000750355
0.000882323
0.00140223
0.0019858
0.00299809
0.00449477
0.00647707
0.00903461
0.0122527
0.0162354
0.0210875
0.0269056
0.000750344
0.00088524
0.00140705
0.00198818
0.00295264
0.00441939
0.00636855
0.00888654
0.0120588
0.0159885
0.0207818
0.0265365
0.000750435
0.00088849
0.00141293
0.00199099
0.00291016
0.0043478
0.00626509
0.00874482
0.0118731
0.0157517
0.0204877
0.0261756
0.00075055
0.00089183
0.00141901
0.00199318
0.00287025
0.00427965
0.0061662
0.008609
0.011695
0.0155245
0.0202048
0.0258325
0.00075067
0.00089506
0.00142475
0.00199435
0.00283259
0.00421473
0.00607159
0.00847873
0.0115238
0.0153055
0.0199298
0.0254828
0.000750796
0.000898028
0.00142986
0.00199438
0.00279686
0.00415278
0.00598097
0.00835361
0.0113592
0.0150946
0.0196657
0.0251704
0.000750912
0.000900637
0.00143418
0.0019933
0.00276291
0.00409353
0.00589404
0.00823331
0.0112007
0.0148912
0.0194099
0.0248496
0.000750994
0.000902921
0.00143772
0.0019912
0.00273065
0.00403686
0.0058106
0.0081176
0.0110481
0.0146954
0.0191661
0.0245696
0.000751021
0.000904875
0.00144045
0.00198824
0.00270031
0.00398262
0.00573044
0.00800617
0.0109009
0.0145066
0.0189294
0.0242677
0.000751013
0.000906531
0.0014425
0.00198474
0.00267278
0.00393067
0.00565335
0.00789875
0.0107591
0.0143244
0.0187019
0.0240009
0.000750936
0.000907945
0.001444
0.00198129
0.00265013
0.003881
0.00557911
0.00779516
0.0106223
0.014149
0.0184833
0.0237378
0.000750879
0.000909193
0.00144539
0.00197885
0.00263441
0.00383385
0.0055077
0.00769529
0.0104903
0.0139796
0.018271
0.0234691
0.000750853
0.000910365
0.00144703
0.0019782
0.00262588
0.00378937
0.00543906
0.00759932
0.010363
0.0138162
0.018067
0.0232296
0.000750857
0.000911575
0.00144923
0.00197966
0.00262293
0.00374753
0.00537313
0.00750708
0.0102402
0.0136587
0.0178711
0.0229963
0.000750909
0.000912971
0.0014522
0.00198306
0.00262344
0.00370828
0.00530985
0.00741835
0.0101216
0.0135067
0.0176819
0.0227649
0.000751004
0.000914573
0.00145592
0.00198793
0.00262564
0.00367139
0.00524916
0.0073329
0.0100072
0.01336
0.017499
0.0225415
0.000751163
0.000916361
0.00146027
0.00199373
0.00262839
0.00363655
0.00519086
0.00725053
0.00989676
0.0132182
0.0173214
0.0223195
0.000751357
0.000918299
0.00146503
0.00199996
0.00263102
0.00360358
0.0051349
0.00717118
0.0097901
0.0130811
0.0171494
0.0221105
0.000751627
0.000920294
0.00147004
0.00200628
0.00263316
0.00357225
0.00508115
0.00709466
0.00968698
0.0129484
0.0169826
0.0219019
0.000751947
0.000922321
0.00147512
0.00201238
0.00263463
0.00354238
0.0050295
0.00702085
0.00958736
0.01282
0.0168209
0.0217026
0.000752277
0.000924291
0.00148005
0.0020181
0.00263538
0.0035138
0.0049798
0.00694963
0.00949106
0.0126957
0.016664
0.0215085
0.000752679
0.00092629
0.00148475
0.00202333
0.00263543
0.00348647
0.00493204
0.00688095
0.0093979
0.0125753
0.016512
0.0213204
0.000753154
0.000928196
0.00148914
0.00202802
0.00263478
0.00346035
0.00488609
0.00681467
0.00930786
0.0124588
0.0163646
0.0211358
0.000753623
0.00092997
0.00149317
0.00203214
0.00263354
0.00343548
0.00484188
0.00675069
0.00922079
0.012346
0.0162216
0.0209566
0.000754116
0.000931648
0.00149686
0.00203571
0.00263182
0.00341217
0.00479938
0.006689
0.00913661
0.0122366
0.0160825
0.0207825
0.000754631
0.000933192
0.00150018
0.0020388
0.00262983
0.00339102
0.0047586
0.0066295
0.00905517
0.0121309
0.0159481
0.0206149
0.000755168
0.000934652
0.00150317
0.00204149
0.00262788
0.00337294
0.00471955
0.00657212
0.00897651
0.0120284
0.0158176
0.0204519
0.000755794
0.000936047
0.00150595
0.00204398
0.00262646
0.00335897
0.00468235
0.00651688
0.00890064
0.0119294
0.0156923
0.0203006
0.000756481
0.000937398
0.00150856
0.00204649
0.00262601
0.00334957
0.00464717
0.00646381
0.00882763
0.0118338
0.0155688
0.0201281
0.000757257
0.000938715
0.00151113
0.00204921
0.00262685
0.00334449
0.0046141
0.00641293
0.00875761
0.0117415
0.0154517
0.0200027
0.000758105
0.000940028
0.00151374
0.00205233
0.00262911
0.00334287
0.00458316
0.0063643
0.00869049
0.0116527
0.0153371
0.0198368
0.00075906
0.000941408
0.00151652
0.002056
0.00263276
0.00334383
0.00455444
0.00631809
0.00862638
0.0115673
0.015226
0.0196986
0.000760152
0.000942895
0.00151954
0.00206026
0.00263759
0.00334647
0.00452788
0.00627428
0.00856514
0.0114855
0.0151209
0.0195775
0.000761405
0.000944462
0.00152284
0.00206511
0.00264338
0.00335009
0.00450341
0.00623297
0.00850716
0.0114079
0.0150237
0.0194735
0.000762846
0.00094619
0.00152643
0.00207049
0.00264988
0.00335433
0.00448107
0.00619437
0.00845263
0.0113348
0.0149301
0.0193418
0.000764543
0.000948077
0.00153035
0.00207636
0.00265693
0.00335893
0.00446092
0.00615869
0.00840163
0.0112664
0.0148432
0.0192441
0.000766581
0.000950161
0.00153457
0.00208266
0.00266438
0.00336381
0.00444316
0.00612623
0.00835495
0.0112032
0.0147627
0.0191425
0.000768967
0.000952371
0.00153908
0.00208932
0.00267217
0.00336898
0.00442792
0.00609752
0.00831315
0.0111462
0.0146885
0.0190422
0.000772064
0.000955098
0.00154431
0.00209681
0.00268078
0.00337505
0.00441678
0.00607434
0.00827789
0.0110965
0.0146222
0.0189538
0.000775292
0.000956572
0.00154796
0.00210266
0.0026877
0.00337971
0.00440533
0.00605233
0.00824562
0.0110518
0.0145596
0.018844
0.000783546
0.000969122
0.00156521
0.00212316
0.0027103
0.00340148
0.00442479
0.00606438
0.008246
0.0110348
0.0145211
0.0188154
0.000766546
0.00091713
0.00151595
0.00207551
0.00265865
0.00333694
0.00432367
0.00594702
0.00812398
0.0109173
0.0144173
0.0186957
0.100584
0.0648587
0.0443058
0.0458495
0.0614964
0.0297294
0.157667
0.130922
0.140031
0.082563
0.139938
0.0815643
0.100831
0.13341
0.109465
0.135493
0.0602593
0.137628
0.105062
0.138244
0.116233
0.0250298
0.0890747
0.107954
0.0528988
0.138468
0.133753
0.139984
0.047198
0.138223
0.0684384
0.129442
0.130334
0.138185
0.0805832
0.0903936
0.0410801
0.0552275
0.208261
0.137098
0.0487144
0.0499637
0.0710334
0.102983
0.139851
0.134816
0.0545117
0.144656
0.0550208
0.108792
0.0621395
0.137983
0.142449
0.102288
0.11152
0.0960428
0.139417
0.134614
0.138071
0.0194045
0.109363
0.0553171
0.0521912
0.111055
0.0618619
0.118224
0.0553375
0.0332942
0.052439
0.138202
0.116148
0.0576045
0.0912137
0.13151
0.060492
0.0568642
0.0377623
0.107071
0.138994
0.117081
0.0818188
0.130173
0.140026
0.138079
0.134807
0.124404
0.0629339
0.0515192
0.0606672
0.116118
0.136916
0.0664886
0.044503
0.132978
0.139646
0.149833
0.136187
0.138565
0.0891657
0.140986
0.138077
0.0673389
0.0989971
0.0589403
0.139804
0.146698
0.0598911
0.139649
0.146653
0.118289
0.132773
0.139364
0.0796896
0.117321
0.116394
0.122687
0.0574254
0.0370817
0.139641
0.119992
0.101846
0.0517635
0.139995
0.136772
0.132959
0.0737858
0.139437
0.0771983
0.0559407
0.12474
0.139967
0.0596021
0.135308
0.0627525
0.138519
0.138709
0.138291
0.133678
0.115245
0.0637322
0.138436
0.0686866
0.133388
0.0528744
0.0936015
0.116568
0.0934051
0.132532
0.0832385
0.0636286
0.133291
0.102351
0.0474149
0.0528696
0.115685
0.0576562
0.0562554
0.134501
0.0269248
0.0970828
0.139595
0.054314
0.023441
0.0392727
0.0881139
0.0926038
0.0766995
0.109136
0.0642613
0.109956
0.0567223
0.139916
0.0571407
0.11645
0.068443
0.0806444
0.0496959
0.102359
0.0922623
0.135785
0.0509403
0.0542381
0.121863
0.0471401
0.138331
0.0434449
0.139637
0.119265
0.055257
0.138242
0.140006
0.0466231
0.125959
0.0997523
0.114201
0.123065
0.13736
0.136828
0.0721318
0.0497353
0.139574
0.136727
0.138436
0.135347
0.0473351
0.0526016
0.0267582
0.0269458
0.134846
0.061539
0.139569
0.0858949
0.0842792
0.118806
0.135805
0.139987
0.048053
0.090384
0.0920543
0.0512516
0.129969
0.0938146
0.127715
0.093211
0.0607216
0.0527171
0.0986628
0.0704188
0.0995016
0.111198
0.130299
0.0896037
0.11723
0.139307
0.0455898
0.0623322
0.0507239
0.0373997
0.132871
0.140045
0.077801
0.0661329
0.0276924
0.0889865
0.120925
0.04482
0.134142
0.0419693
0.0451524
0.139976
0.166695
0.134263
0.136489
0.146408
0.096527
0.138517
0.138454
0.0563772
0.138216
0.0583857
0.101186
0.137038
0.0562377
0.0475498
0.0579037
0.0911933
0.0835091
0.13885
0.0708184
0.135951
0.0996253
0.0555997
0.10559
0.0910021
0.104398
0.139007
0.0602235
0.139018
0.139209
0.0539429
0.139782
0.113256
0.0754798
0.0584716
0.14003
0.126168
0.0581027
0.112975
0.0984273
0.0604511
0.101475
0.0181823
0.138978
0.109167
0.111519
0.053024
0.0590137
0.131337
0.0992383
0.0732696
0.0585598
0.0961699
0.0479789
0.132287
0.0550203
0.0903982
0.0859439
0.0548223
0.138767
0.0725248
0.10357
0.0908582
0.138684
0.120116
0.139304
0.146428
0.0101429
0.0694916
0.0688562
0.135451
0.123378
0.129074
0.0483996
0.00579093
0.112971
0.117298
0.137769
0.174912
0.139956
0.0548257
0.0859654
0.0712067
0.13641
0.140392
0.144184
0.0279472
0.139187
0.134097
0.120086
0.0953565
0.138758
0.138181
0.0936707
0.137963
0.134436
0.131711
0.135114
0.0802313
0.112239
0.125411
0.120024
0.058629
0.138629
0.112402
0.139476
0.111769
0.106308
0.0558492
0.0515436
0.119502
0.065062
0.137743
0.0776338
0.110717
0.0754624
0.138295
0.139999
0.0524177
0.130165
0.0791417
0.0506039
0.0507937
0.0478219
0.140014
0.110953
0.122344
0.0289182
0.0533235
0.049907
0.120429
0.0470976
0.0685194
0.105516
0.0322801
0.0843876
0.115352
0.0510436
0.068171
0.0262228
0.0875975
0.0878649
0.136671
0.0336362
0.131825
0.109251
0.118421
0.113228
0.0917279
0.0594758
0.124432
0.15352
0.139281
0.133624
0.130406
0.184269
0.12636
0.0592104
0.108212
0.13946
0.0512043
0.138995
0.116205
0.0829861
0.13974
0.115539
0.0581716
0.106625
0.110416
0.143364
0.130456
0.0862577
0.139746
0.0692213
0.13608
0.0660282
0.166004
0.131911
0.0504041
0.139883
0.132605
0.0534538
0.181065
0.133084
0.115618
0.134586
0.103031
0.0463991
0.116483
0.104236
0.136552
0.0255202
0.139007
0.130063
0.128092
0.0516515
0.13693
0.0672472
0.08679
0.120099
0.0466351
0.0396621
0.126065
0.0937928
0.0890969
0.0589381
0.138309
0.133335
0.045678
0.137496
0.0468419
0.0520415
0.0906595
0.128568
0.0316594
0.0618647
0.138414
0.101563
0.0582827
0.119069
0.138313
0.0439184
0.105445
0.100656
0.0430959
0.114503
0.117745
0.118233
0.111811
0.0769281
0.0638462
0.0838113
0.136862
0.134525
0.140033
0.0339238
0.116025
0.110968
0.133839
0.0830381
0.134022
0.134073
0.139229
0.0563098
0.062639
0.0565485
0.136337
0.139761
0.138254
0.134609
0.0568545
0.103831
0.122031
0.136793
0.122084
0.139507
0.145199
0.0476947
0.139011
0.140038
0.0976755
0.0278738
0.137577
0.125508
0.101184
0.133114
0.13771
0.0587762
0.0599628
0.0941614
0.140098
0.0929539
0.106625
0.0176137
0.139536
0.0551609
0.0789832
0.071319
0.0412246
0.134168
0.135125
0.130413
0.0519185
0.139612
0.137371
0.093405
0.105708
0.134495
0.0709895
0.139706
0.154284
0.10454
0.0429327
0.117706
0.135187
0.0752525
0.127392
0.120829
0.117393
0.138311
0.101163
0.140855
0.0936945
0.135704
0.159884
0.137146
0.138899
0.138519
0.0757082
0.133498
0.0250475
0.119353
0.139754
0.0687415
0.101825
0.0125169
0.0475819
0.132644
0.14002
0.0273524
0.0887902
0.139566
0.0997636
0.111916
0.0250967
0.149821
0.0498366
0.0445715
0.0805831
0.136219
0.101331
0.0478174
0.110859
0.246537
0.212881
0.0885676
0.136942
0.0244786
0.082087
0.131443
0.108971
0.137885
0.084553
0.28581
0.137079
0.132822
0.054127
0.0877682
0.138206
0.139888
0.139229
0.119795
0.046438
0.251638
0.124813
0.133561
0.0781503
0.0523296
0.139994
0.0245461
0.0517424
0.124032
0.0543184
0.1398
0.0522991
0.0631959
0.0544378
0.0524174
0.0843281
0.115813
0.139321
0.138466
0.0579674
0.122459
0.138655
0.285755
0.123371
0.125251
0.124412
0.0433148
0.0421266
0.150054
0.00455656
0.0401156
0.0498814
0.0663559
0.112513
0.098142
0.140039
0.123906
0.0403774
0.110323
0.0382942
0.187904
0.136356
0.129841
0.0283995
0.109709
0.0821822
0.114833
0.209101
0.12356
0.107578
0.103197
0.139432
0.106756
0.193258
0.0498456
0.135764
0.13938
0.0633027
0.131052
0.0298788
0.140481
0.096027
0.360084
0.0811015
0.0495485
0.34928
0.0498168
0.0501233
0.0892471
0.130566
0.0616393
0.0467686
0.101106
0.0907467
0.136177
0.139694
0.0410039
0.0627289
0.0393669
0.0632839
0.111965
0.138305
0.133457
0.0678382
0.116168
0.159193
0.0636555
0.168622
0.137819
0.137322
0.0380923
0.12085
0.24271
0.0477524
0.0551437
0.0840962
0.128126
0.139744
0.0535572
0.139694
0.138724
0.139212
0.126329
0.131299
0.126813
0.0774734
0.0417653
0.0468585
0.133014
0.107722
0.0700814
0.129871
0.0559697
0.109919
0.0706871
0.0953519
0.135655
0.0321797
0.0619727
0.155707
0.138904
0.129312
0.0738533
0.0631632
0.100934
0.0965028
0.12348
0.056455
0.0685108
0.0798213
0.125493
0.040848
0.0910052
0.0881722
0.113705
0.106797
0.242788
0.0627266
0.0521125
0.138
0.116362
0.0431647
0.135254
0.13767
0.100955
0.123204
0.108531
0.0729622
0.0461279
0.139472
0.085498
0.139889
0.120466
0.153815
0.137271
0.060894
0.136128
0.0351107
0.100296
0.0457125
0.0648158
0.131556
0.134296
0.0988665
0.0849584
0.140012
0.128093
0.0406802
0.0760027
0.069956
0.0951236
0.135409
0.117511
0.137788
0.135459
0.0533863
0.132654
0.166687
0.0588572
0.061315
0.0679733
0.118741
0.125449
0.0988465
0.103618
0.0291685
0.219046
0.136293
0.0668268
0.120184
0.13598
0.0989744
0.10701
0.139123
0.0636334
0.132971
0.0520945
0.0673875
0.0641103
0.114273
0.138614
0.139819
0.105963
0.113987
0.131307
0.105021
0.103925
0.093839
0.108883
0.0874194
0.138119
0.168344
0.124062
0.146686
0.1039
0.114529
0.135515
0.137551
0.136272
0.0618028
0.0531368
0.137405
0.172234
0.0326447
0.126981
0.0958977
0.105455
0.129089
0.0737559
0.0754815
0.0609879
0.0574021
0.0475899
0.0558967
0.126443
0.0577893
0.0572683
0.0500503
0.0681862
0.0796858
0.0773544
0.0628185
0.288801
0.138381
0.137999
0.0566442
0.102762
0.139068
0.139127
0.0981853
0.111439
0.100582
0.0585253
0.130397
0.120185
0.116033
0.0613228
0.126579
0.106663
0.0341025
0.077286
0.139846
0.12377
0.0659684
0.10347
0.138023
0.0378764
0.139194
0.0437687
0.0600765
0.11776
0.147908
0.0335527
0.0664345
0.0533323
0.0764368
0.0933312
0.075922
0.066723
0.0462663
0.0795613
0.0585704
0.0533301
0.0832535
0.0559604
0.105095
0.138659
0.10669
0.110213
0.0632546
0.162002
0.0821202
0.0627952
0.0625263
0.0430974
0.103332
0.138137
0.0483082
0.0932891
0.0435603
0.187796
0.0485115
0.139118
0.133798
0.0864152
0.044666
0.138971
0.0524629
0.271272
0.0920295
0.0578895
0.105675
0.117626
0.0949536
0.0567864
0.0726515
0.0494196
0.0541537
0.0941354
0.138347
0.0794646
0.0959904
0.109828
0.0961465
0.056578
0.138493
0.13839
0.0937813
0.123642
0.110734
0.137727
0.138049
0.0474577
0.115497
0.12272
0.108211
0.0854863
0.0732015
0.0547819
0.109148
0.0615339
0.136829
0.0308657
0.106026
0.129665
0.0546114
0.116924
0.114645
0.0778098
0.0655994
0.139261
0.125516
0.139684
0.139045
0.0492717
0.0956118
0.117747
0.0728073
0.140467
0.139024
0.0579814
0.0698039
0.125112
0.0706831
0.13354
0.0471577
0.119117
0.109667
0.0675677
0.049884
0.0489288
0.0630568
0.0490038
0.0499132
0.0397612
0.102953
0.0531671
0.137363
0.139748
0.103812
0.0329706
0.140084
0.113088
0.0538497
0.0889501
0.0986785
0.0993967
0.0441215
0.0477651
0.136665
0.0471502
0.138926
0.0733514
0.0327396
0.105396
0.0457588
0.118663
0.139488
0.0283
0.124516
0.0263934
0.125469
0.130791
0.0300464
0.112399
0.0369293
0.139662
0.272216
0.101283
0.0551792
0.0458129
0.135218
0.144376
0.0460581
0.138942
0.139744
0.133955
0.137952
0.0720996
0.0224987
0.134308
0.135383
0.0723911
0.0585217
0.128536
0.125376
0.0587313
0.138639
0.106422
0.100816
0.0538248
0.134897
0.125403
0.140021
0.0715664
0.0988785
0.139253
0.138268
0.0457828
0.0989976
0.12657
0.133694
0.141973
0.127709
0.152768
0.121399
0.135859
0.137805
0.113913
0.139249
0.0970102
0.0481138
0.0405412
0.135312
0.136996
0.132548
0.139701
0.298772
0.0824042
0.0651454
0.0501818
0.085
0.128171
0.0966788
0.108522
0.139892
0.0542946
0.137152
0.0555704
0.13924
0.0909447
0.0842854
0.202834
0.0271943
0.0642423
0.333249
0.123558
0.20233
0.137562
0.107403
0.0268056
0.0525057
0.0317283
0.11077
0.109349
0.136695
0.137325
0.0778065
0.098661
0.130611
0.12031
0.0833042
0.0828968
0.0525561
0.114652
0.101369
0.0650301
0.138177
0.0661525
0.137368
0.108692
0.0980947
0.0417358
0.140135
0.130069
0.139193
0.142911
0.163443
0.110871
0.0502976
0.0314358
0.104515
0.137033
0.136052
0.0660774
0.102647
0.0641168
0.137385
0.0544635
0.0949826
0.0102306
0.127633
0.113574
0.170532
0.0353495
0.13965
0.105607
0.139519
0.11102
0.137457
0.0741783
0.040793
0.116512
0.139718
0.0909046
0.139251
0.108226
0.0613244
0.0544646
0.103807
0.136138
0.080602
0.339155
0.0918313
0.13894
0.0353888
0.140496
0.139707
0.134144
0.0491111
0.0557914
0.135813
0.0920664
0.121126
0.0670208
0.0622266
0.135442
0.0740193
0.120725
0.139319
0.128711
0.0495463
0.136495
0.088472
0.103959
0.123591
0.0571588
0.124821
0.0939668
0.0461409
0.065347
0.101363
0.108964
0.147851
0.0940201
0.134894
0.143697
0.190721
0.131313
0.140036
0.134532
0.0882134
0.116313
0.136523
0.136575
0.13618
0.0970688
0.12486
0.140796
0.138635
0.131216
0.0454069
0.0998948
0.0388815
0.0499324
0.195177
0.132722
0.130774
0.131718
0.118717
0.139786
0.13067
0.139414
0.0893912
0.134165
0.102115
0.129996
0.0596389
0.0635348
0.118872
0.138706
0.122998
0.116363
0.129258
0.145105
0.0567516
0.134681
0.0824572
0.0658448
0.13939
0.138206
0.0839112
0.210512
0.143192
0.0619169
0.221094
0.0618218
0.0420812
0.0892946
0.045323
0.03508
0.14037
0.0909373
0.0571102
0.0962993
0.140007
0.107735
0.10925
0.0545759
0.0635514
0.0498158
0.0790019
0.0942647
0.140018
0.0587331
0.0912009
0.0624245
0.0446966
0.115133
0.125355
0.0994577
0.117948
0.0596453
0.131516
0.138025
0.134183
0.103227
0.13248
0.134554
0.183615
0.0825952
0.0581015
0.041747
0.102297
0.0889993
0.144091
0.0723083
0.134302
0.0864877
0.106671
0.13471
0.135856
0.132479
0.0779234
0.0960383
0.101146
0.0484495
0.0610456
0.0749331
0.049265
0.138118
0.111114
0.13977
0.14004
0.132297
0.143946
0.0596687
0.12474
0.136392
0.0282393
0.0465543
0.121514
0.110383
0.104935
0.0521261
0.139998
0.101989
0.123563
0.134444
0.13892
0.349615
0.05235
0.139864
0.112185
0.113224
0.13955
0.135723
0.0715951
0.125367
0.117307
0.065484
0.0976976
0.0428814
0.140326
0.126664
0.0523337
0.0425827
0.132498
0.133865
0.138597
0.17133
0.132102
0.0889652
0.139879
0.100539
0.0217297
0.0749413
0.116818
0.139496
0.141157
0.0577469
0.131449
0.188065
0.106433
0.137826
0.0555501
0.0473498
0.077731
0.104619
0.0605202
0.105822
0.13535
0.11563
0.141673
0.0748448
0.138667
0.024429
0.0494732
0.12377
0.0735575
0.077224
0.137741
0.0817289
0.139275
0.0279205
0.131466
0.107865
0.084474
0.136645
0.127068
0.061259
0.139794
0.121573
0.0936861
0.113715
0.1081
0.129512
0.140012
0.121777
0.0758179
0.0556277
0.139324
0.138608
0.0589747
0.115734
0.0115891
0.135943
0.132035
0.128562
0.052313
0.132957
0.0225704
0.0596524
0.044429
0.139899
0.102116
0.133546
0.0882601
0.138625
0.126762
0.0498029
0.284513
0.127381
0.20703
0.140379
0.105869
0.131791
0.123542
0.105798
0.0775901
0.0998343
0.140463
0.122281
0.308653
0.0307603
0.105586
0.132467
0.0785
0.101714
0.0487255
0.138429
0.0921985
0.0443077
0.057594
0.137384
0.139165
0.129356
0.0346555
0.139202
0.0819363
0.126764
0.164671
0.124076
0.121412
0.0827096
0.13752
0.11832
0.134198
0.0965215
0.0548967
0.0791194
0.126206
0.0920807
0.104519
0.0565626
0.0740592
0.0465306
0.157232
0.127156
0.103878
0.0928225
0.107874
0.0342704
0.139999
0.121619
0.103369
0.0502004
0.0268788
0.0978779
0.140017
0.139645
0.136499
0.0983656
0.122262
0.134683
0.116267
0.06092
0.137288
0.0674611
0.0539324
0.0502769
0.0618948
0.131563
0.0521802
0.259619
0.0376127
0.354421
0.107651
0.113205
0.134454
0.143461
0.105835
0.135545
0.0918285
0.122995
0.120728
0.0372604
0.113273
0.0369136
0.139096
0.139574
0.0962235
0.139675
0.092691
0.135035
0.10763
0.0502475
0.0600668
0.120035
0.1115
0.0519124
0.139485
0.118412
0.0693401
0.0487656
0.136021
0.0228306
0.0538372
0.0672799
0.135889
0.0936869
0.12162
0.358839
0.0755931
0.137582
0.138896
0.032413
0.139918
0.138773
0.12733
0.119221
0.0536789
0.0952998
0.0626099
0.0732396
0.0667055
0.34969
0.0988994
0.0301598
0.0575445
0.0700604
0.0542928
0.139524
0.106269
0.139245
0.025161
0.137123
0.138667
0.0620952
0.10715
0.112179
0.121912
0.130083
0.103638
0.0559619
0.0597672
0.137925
0.0767316
0.139995
0.0992929
0.138531
0.135149
0.106027
0.0668746
0.138693
0.0792198
0.0409496
0.138301
0.0396757
0.0977566
0.101569
0.113189
0.0513053
0.103087
0.0813687
0.125926
0.110834
0.0987165
0.135216
0.0252915
0.116421
0.0699182
0.115402
0.0546168
0.134392
0.0958459
0.319299
0.0778205
0.136149
0.130014
0.0999653
0.100777
0.13988
0.0981628
0.138574
0.103465
0.121753
0.120707
0.165734
0.120613
0.0903245
0.0602247
0.127301
0.0717647
0.0495653
0.139442
0.140011
0.168118
0.103203
0.118384
0.114838
0.0587647
0.0304213
0.139948
0.137534
0.0537334
0.112922
0.134361
0.0871803
0.0458545
0.0820576
0.0505588
0.0501822
0.12281
0.145333
0.0349471
0.126707
0.129206
0.050575
0.140051
0.140019
0.0529646
0.103997
0.130894
0.138718
0.138148
0.127366
0.134923
0.131609
0.0971671
0.100672
0.138023
0.0856348
0.077638
0.0954148
0.139964
0.0758429
0.121847
0.11796
0.113696
0.0451837
0.104388
0.133774
0.0782734
0.0984486
0.0900824
0.137719
0.139201
0.0596948
0.120768
0.0935226
0.0914739
0.0804958
0.0933956
0.0718207
0.0486018
0.0887232
0.0594319
0.130354
0.104284
0.0432133
0.116435
0.0612736
0.132649
0.051033
0.116856
0.0575674
0.140013
0.0803682
0.0498114
0.0946862
0.105999
0.100829
0.113556
0.0501075
0.140003
0.0611894
0.119314
0.0489834
0.0810933
0.158603
0.10165
0.0420618
0.131157
0.0976833
0.0867003
0.104091
0.0466708
0.103131
0.111178
0.128996
0.14
0.014359
0.0916313
0.129495
0.036984
0.120334
0.0457348
0.0407674
0.0359513
0.0333022
0.137002
0.0949898
0.0713716
0.0535545
0.148555
0.139981
0.139739
0.0559502
0.139908
0.0513869
0.0748038
0.0907462
0.0336804
0.139364
0.045264
0.0524031
0.107057
0.110831
0.137059
0.120222
0.0506058
0.056809
0.0940265
0.139192
0.0254393
0.133235
0.132607
0.136262
0.138234
0.208148
0.102899
0.0395824
0.140004
0.142646
0.156087
0.339625
0.0847257
0.058746
0.0317357
0.135028
0.303066
0.0598206
0.0583113
0.129951
0.118368
0.138797
0.0956168
0.134357
0.0624759
0.0540386
0.0537498
0.138973
0.135672
0.128747
0.0620194
0.139342
0.134773
0.138277
0.0225807
0.13979
0.249916
0.129063
0.0541533
0.0870699
0.0955973
0.102163
0.0465761
0.148414
0.0468983
0.0350531
0.139859
0.0328602
0.0283335
0.139568
0.137544
0.125003
0.130653
0.136675
0.0659862
0.0244358
0.0740793
0.102547
0.139897
0.113681
0.0835685
0.0550395
0.139407
0.106939
0.138139
0.0537257
0.0593092
0.082017
0.153171
0.0635343
0.030551
0.12902
0.137736
0.0573319
0.188932
0.070655
0.0145648
0.0333881
0.105862
0.112137
0.137539
0.19382
0.138603
0.0635533
0.134648
0.047821
0.101584
0.0675662
0.0327794
0.139578
0.0689409
0.0286123
0.139982
0.103697
0.135835
0.0472394
0.0705674
0.132857
0.0603129
0.026579
0.102759
0.0110613
0.131745
0.119633
0.12228
0.132741
0.0655061
0.134304
0.136558
0.137988
0.0300408
0.138778
0.0589155
0.139441
0.134346
0.0780099
0.13193
0.0441154
0.0474255
0.0657297
0.109424
0.137835
0.0307005
0.114354
0.187644
0.176727
0.0835355
0.0429567
0.0891624
0.042845
0.0584699
0.053778
0.090858
0.10801
0.0539058
0.13868
0.132965
0.135022
0.063857
0.0523706
0.0629
0.134367
0.0498115
0.0751509
0.049258
0.136209
0.0596132
0.0587212
0.130979
0.123389
0.132776
0.0560176
0.0535844
0.136831
0.129449
0.28267
0.0422118
0.127326
0.0489314
0.10401
0.0887915
0.0484003
0.0565506
0.139536
0.0528197
0.0409952
0.0952072
0.125572
0.0827641
0.0593823
0.138402
0.1399
0.109201
0.13742
0.052306
0.0441029
0.0549448
0.0648881
0.37287
0.0856504
0.0740817
0.126376
0.140004
0.04089
0.140028
0.096944
0.0849538
0.056662
0.139994
0.0881583
0.0496976
0.301707
0.0495627
0.0776929
0.0866353
0.0228462
0.133535
0.0431893
0.138042
0.101964
0.085441
0.0677638
0.0503126
0.130141
0.137051
0.0292492
0.125712
0.0959336
0.0383445
0.0749778
0.164311
0.119492
0.0684317
0.122973
0.13556
0.0711289
0.0087123
0.0404898
0.094868
0.13194
0.121853
0.0379544
0.0665529
0.0728207
0.0761093
0.119188
0.0461659
0.0976823
0.0840782
0.068026
0.0979085
0.139413
0.141189
0.134281
0.134564
0.0175199
0.0777854
0.0994173
0.117374
0.0230578
0.140028
0.42649
0.13897
0.159129
0.100062
0.134659
0.108752
0.0847636
0.369508
0.0325749
0.131731
0.0677239
0.131562
0.181697
0.144086
0.138762
0.11761
0.107964
0.0615575
0.133341
0.166605
0.0940768
0.156714
0.0506575
0.140285
0.137325
0.117113
0.135409
0.11502
0.276196
0.130679
0.044093
0.137802
0.140637
0.0579268
0.101315
0.0371542
0.0570563
0.0473276
0.0668323
0.135652
0.135534
0.128017
0.105548
0.112542
0.126907
0.130435
0.114608
0.128927
0.123456
0.0529361
0.0691717
0.139573
0.125431
0.061176
0.0990856
0.12736
0.0752963
0.121491
0.0441494
0.0468565
0.0960562
0.0786074
0.134384
0.138165
0.116058
0.0641483
0.0495155
0.0679829
0.0787137
0.139979
0.0911088
0.0165019
0.0884646
0.139198
0.0586201
0.139847
0.0933716
0.0227879
0.10331
0.128925
0.107886
0.0407268
0.0489666
0.139588
0.0240178
0.0985602
0.103749
0.0916888
0.133832
0.0957627
0.203572
0.0997461
0.0923256
0.0547501
0.127412
0.129087
0.132804
0.0581548
0.143127
0.137789
0.104084
0.119608
0.136386
0.137712
0.131676
0.100195
0.349556
0.138236
0.0526588
0.14133
0.0726243
0.0969811
0.137331
0.100049
0.125905
0.10178
0.067132
0.0449495
0.00728281
0.10093
0.0505634
0.120898
0.022781
0.134369
0.091682
0.131595
0.0451119
0.117931
0.139921
0.112369
0.0727668
0.0613233
0.139012
0.119852
0.0501568
0.135369
0.0719452
0.113142
0.135054
0.0726604
0.133384
0.038675
0.0609613
0.04246
0.13589
0.107978
0.122229
0.137153
0.138393
0.0526371
0.0545218
0.105852
0.0994298
0.184975
0.105952
0.135218
0.140025
0.00752715
0.13707
0.0346058
0.128302
0.139715
0.0574101
0.119482
0.12375
0.139124
0.0849655
0.167082
0.116254
0.349152
0.135274
0.0295974
0.129037
0.114861
0.13703
0.133225
0.0755774
0.123222
0.23124
0.0227401
0.116353
0.13916
0.0754131
0.132917
0.121188
0.137266
0.077012
0.113811
0.125783
0.0388943
0.0944264
0.125086
0.119407
0.121848
0.0662867
0.109188
0.0385247
0.102852
0.108944
0.0693763
0.129187
0.127096
0.167049
0.0679172
0.13417
0.0140967
0.0862761
0.12523
0.114677
0.0233061
0.0252428
0.139584
0.141767
0.139787
0.0976503
0.0547355
0.0650343
0.125668
0.148277
0.132465
0.12634
0.0502736
0.0426689
0.129087
0.216346
0.104083
0.049832
0.120242
0.100155
0.0982605
0.117081
0.0832388
0.0588011
0.106105
0.0990864
0.0716086
0.139197
0.139338
0.139388
0.127026
0.12865
0.0513642
0.127283
0.133552
0.119423
0.0286459
0.0350135
0.128325
0.113884
0.111586
0.101264
0.0319817
0.0331849
0.112894
0.083217
0.147608
0.0649759
0.14271
0.1325
0.104054
0.0735193
0.118622
0.0867408
0.222539
0.104961
0.0395529
0.10071
0.0603797
0.136846
0.118607
0.138761
0.372002
0.0524849
0.0423564
0.0969704
0.138592
0.0570385
0.137785
0.139774
0.0765603
0.139994
0.132956
0.100315
0.00924604
0.124436
0.00434844
0.283981
0.0441627
0.0560296
0.115099
0.0414084
0.0494419
0.343022
0.0766034
0.0550938
0.0213248
0.0901264
0.114368
0.0484679
0.106564
0.139688
0.0967495
0.330943
0.163786
0.13468
0.140007
0.0863903
0.140027
0.00903572
0.13672
0.0323858
0.127233
0.0560847
0.133764
0.127538
0.109703
0.0967032
0.0911504
0.0653111
0.0674019
0.0431839
0.0282607
0.125778
0.0960548
0.0972487
0.0742426
0.138656
0.0602851
0.128729
0.0995264
0.117421
0.0679828
0.0858362
0.128155
0.094247
0.125071
0.00953936
0.084961
0.118431
0.0821677
0.0645195
0.0790217
0.137843
0.136322
0.0886033
0.044988
0.14002
0.136982
0.03945
0.15301
0.0440967
0.0646631
0.0678985
0.0438329
0.0315029
0.137307
0.121782
0.140022
0.0564996
0.0746042
0.107481
0.0495336
0.0787185
0.136923
0.0495543
0.136835
0.0772612
0.0905268
0.101631
0.0393601
0.127217
0.109452
0.0629763
0.0475678
0.0396262
0.119234
0.120549
0.106435
0.13468
0.0649905
0.121539
0.0295068
0.00860554
0.0875907
0.139967
0.0561413
0.109259
0.111178
0.0780978
0.139968
0.0444263
0.12867
0.0474937
0.0809455
0.0405792
0.0937557
0.113701
0.10178
0.11377
0.0778315
0.127485
0.0467042
0.0812487
0.0305172
0.129919
0.125168
0.129013
0.137395
0.0504637
0.141335
0.0313538
0.110303
0.0518196
0.0948827
0.0430246
0.0830856
0.0816679
0.0568889
0.139471
0.140316
0.0960181
0.0676755
0.0316154
0.085649
0.064057
0.125497
0.0971093
0.0497524
0.0313978
0.0636085
0.0236793
0.123615
0.044271
0.13224
0.0435411
0.136984
0.0346863
0.11047
0.146326
0.119579
0.0663816
0.232624
0.0499947
0.160908
0.123434
0.0853949
0.137764
0.0435659
0.137736
0.139602
0.0683035
0.139399
0.119867
0.0144965
0.0797086
0.0483361
0.113847
0.139997
0.088785
0.098045
0.127867
0.0244598
0.212354
0.145427
0.0937432
0.0614688
0.0908371
0.135329
0.072325
0.140009
0.0147732
0.139977
0.139985
0.111545
0.0960698
0.116079
0.0788313
0.127551
0.0809966
0.116451
0.101371
0.0639548
0.0516166
0.115977
0.119672
0.124097
0.135659
0.122856
0.225716
0.192249
0.119625
0.115982
0.149965
0.066151
0.0883724
0.102663
0.086511
0.0493766
0.0803773
0.0505115
0.00685897
0.057556
0.137177
0.133152
0.170432
0.04574
0.140004
0.109169
0.113285
0.0382074
0.118042
0.112315
0.121901
0.136585
0.0513825
0.128769
0.0819992
0.0691877
0.084966
0.102317
0.0719674
0.104
0.119091
0.13748
0.138607
0.0582286
0.0761631
0.137835
0.0896894
0.124057
0.137413
0.216174
0.0692541
0.138262
0.139616
0.0205163
0.112133
0.100639
0.0951499
0.12983
0.0821843
0.049989
0.136517
0.139528
0.132091
0.0892308
0.131007
0.138803
0.138594
0.0549173
0.138982
0.135928
0.0869531
0.0374092
0.129091
0.1022
0.138642
0.053312
0.136602
0.0561425
0.112395
0.125507
0.0620209
0.109462
0.125687
0.0776309
0.0325382
0.129984
0.11779
0.0492948
0.102292
0.0248779
0.0547015
0.157336
0.135987
0.0386716
0.105737
0.0469587
0.0672964
0.138807
0.144278
0.0966854
0.0604917
0.0260056
0.133275
0.0474481
0.0801085
0.117765
0.0532595
0.138045
0.0926335
0.0481073
0.0950007
0.109469
0.106068
0.0954094
0.0270537
0.127754
0.0524001
0.060812
0.0476416
0.0925939
0.135642
0.0562226
0.138852
0.103495
0.0602808
0.027692
0.0617345
0.0673322
0.0520547
0.0564521
0.0590174
0.00546339
0.138525
0.107066
0.0456418
0.0951368
0.120797
0.125838
0.133101
0.105684
0.0672448
0.138584
0.055333
0.0688348
0.127703
0.0488807
0.00845233
0.106579
0.100794
0.125469
0.109426
0.10526
0.139998
0.139981
0.092353
0.0411158
0.116256
0.0389133
0.081374
0.139103
0.123922
0.13839
0.133741
0.119628
0.0931404
0.40227
0.111691
0.140461
0.0556939
0.059477
0.0776028
0.0789608
0.0569917
0.130207
0.087212
0.037148
0.0733347
0.0897306
0.124376
0.0894257
0.0976875
0.0452775
0.0851019
0.112193
0.067596
0.0492759
0.136136
0.104328
0.0794522
0.117459
0.138685
0.0737437
0.0549954
0.0406381
0.132945
0.137206
0.052614
0.0931232
0.0942862
0.0671437
0.0878122
0.133647
0.135797
0.106707
0.124144
0.121335
0.373637
0.0738258
0.0660604
0.108626
0.0806042
0.0750954
0.0617798
0.137459
0.068507
0.210464
0.0702056
0.135278
0.0702746
0.0420476
0.1344
0.142765
0.137719
0.138832
0.110563
0.132978
0.0266059
0.136032
0.0527153
0.0773741
0.0833261
0.126461
0.0422988
0.121827
0.122774
0.139489
0.11755
0.0227909
0.0994811
0.0979183
0.0995408
0.13449
0.13961
0.113053
0.117669
0.0514361
0.139398
0.113652
0.132725
0.123472
0.0368969
0.0451264
0.135281
0.118461
0.0661827
0.091005
0.104296
0.133531
0.098183
0.0964726
0.0869343
0.135848
0.0418459
0.121917
0.108474
0.0867811
0.138363
0.050093
0.355463
0.35677
0.138142
0.0467968
0.0731447
0.116183
0.0588134
0.0305783
0.0844278
0.0264402
0.116871
0.0351483
0.066268
0.147566
0.0599887
0.0357074
0.076519
0.114737
0.0328689
0.114397
0.107483
0.0634806
0.0876409
0.0592929
0.0944818
0.134302
0.118976
0.0730795
0.139533
0.140011
0.10401
0.11433
0.13852
0.138749
0.0987995
0.122119
0.283076
0.149453
0.138783
0.0686643
0.0555655
0.0672706
0.128274
0.121017
0.0597665
0.147283
0.100135
0.0881946
0.0478405
0.0605505
0.0563759
0.139655
0.128534
0.140026
0.117041
0.0979185
0.139964
0.137604
0.356407
0.136683
0.137052
0.023403
0.0497158
0.129117
0.0740244
0.124687
0.139794
0.108659
0.130117
0.102192
0.139881
0.0986447
0.0411646
0.00837928
0.12957
0.115501
0.167873
0.0332637
0.0606047
0.100267
0.0768811
0.10651
0.0285867
0.131653
0.129033
0.131851
0.223475
0.135742
0.0473564
0.12987
0.110728
0.356786
0.136333
0.115856
0.124283
0.0704138
0.123693
0.0688003
0.131637
0.0577938
0.104852
0.139345
0.0576683
0.119382
0.114701
0.135899
0.047294
0.0542114
0.130657
0.077242
0.138903
0.0492699
0.374478
0.0433607
0.067675
0.0500935
0.128203
0.0465079
0.0837225
0.0390059
0.106533
0.0334393
0.0610508
0.119759
0.0667464
0.319383
0.0526683
0.070143
0.13236
0.112784
0.0831998
0.0641766
0.111454
0.0570323
0.0395602
0.0696103
0.0790333
0.0804059
0.00643193
0.0975707
0.0394333
0.10358
0.139759
0.0368619
0.13596
0.0574281
0.141511
0.0997501
0.0609683
0.114145
0.139439
0.055668
0.105299
0.217448
0.0107067
0.136815
0.0627978
0.139363
0.0557485
0.105369
0.110348
0.140338
0.10648
0.130437
0.109506
0.138309
0.0991371
0.135623
0.140001
0.0895512
0.136759
0.114346
0.112016
0.0977517
0.0695974
0.016354
0.103896
0.0948533
0.115945
0.0407156
0.132494
0.137768
0.0192199
0.0969674
0.138698
0.102898
0.055088
0.0465547
0.047497
0.121748
0.136253
0.0949606
0.0718439
0.0473901
0.0815597
0.134984
0.0271979
0.0657831
0.0460995
0.127616
0.132964
0.0503806
0.138615
0.0777669
0.104387
0.0844218
0.131852
0.123068
0.0637615
0.123368
0.052619
0.0567602
0.170471
0.0510186
0.0809048
0.0593664
0.0750336
0.0691432
0.104237
0.100642
0.136153
0.128996
0.0665847
0.110368
0.13283
0.0475582
0.130815
0.134931
0.140243
0.0491881
0.0782506
0.0469724
0.101183
0.0701754
0.0921204
0.101238
0.139926
0.0688742
0.102004
0.0232538
0.0496982
0.131355
0.138058
0.0550055
0.128879
0.1392
0.0955882
0.126784
0.126175
0.0498076
0.056718
0.136342
0.03296
0.116871
0.138022
0.0431311
0.121559
0.137384
0.0609656
0.0973435
0.0377736
0.127278
0.0466939
0.0472793
0.0945784
0.128655
0.0394827
0.11644
0.132071
0.0531597
0.0489104
0.114949
0.0190613
0.0606197
0.0511646
0.131575
0.0233914
0.101489
0.0536654
0.139803
0.0153604
0.139373
0.0671512
0.112234
0.257466
0.100232
0.122771
0.112547
0.123868
0.167531
0.0995234
0.109256
0.139521
0.113581
0.052237
0.139739
0.111611
0.0766856
0.0974352
0.136228
0.290738
0.13546
0.118404
0.13918
0.137155
0.0383584
0.102962
0.0607826
0.127965
0.256924
0.13992
0.0519814
0.0498105
0.101644
0.126342
0.135895
0.0995945
0.140034
0.0493589
0.0497139
0.112865
0.0617443
0.127938
0.0528943
0.0347637
0.0750979
0.119605
0.0488808
0.124595
0.135108
0.0975703
0.0433163
0.151461
0.135696
0.136834
0.103209
0.0328818
0.0452928
0.0227054
0.0886625
0.0545437
0.22001
0.0801915
0.0620726
0.0345786
0.0183878
0.0723874
0.0993777
0.0101236
0.121044
0.0879837
0.126035
0.286389
0.121951
0.121559
0.13232
0.0836461
0.135423
0.0543976
0.190748
0.0559221
0.126461
0.139811
0.0564352
0.120105
0.0548875
0.0705018
0.084921
0.130159
0.0573385
0.13375
0.0520242
0.0962329
0.00722417
0.140834
0.0752063
0.0861976
0.103194
0.139581
0.0573618
0.0466161
0.0659913
0.11526
0.0902572
0.134993
0.0566276
0.0560905
0.129042
0.0547714
0.0234496
0.127342
0.0725446
0.127091
0.0715099
0.113118
0.131915
0.0448512
0.125189
0.0521673
0.106091
0.0599521
0.0593125
0.10699
0.138955
0.0868989
0.0606064
0.139106
0.13106
0.110821
0.0961026
0.127694
0.100489
0.133017
0.137392
0.143241
0.0288771
0.0731308
0.114269
0.135945
0.100057
0.130052
0.0974778
0.0372283
0.127152
0.0595388
0.0792273
0.139374
0.139439
0.127725
0.123203
0.139551
0.0642668
0.100041
0.0967781
0.0532541
0.127486
0.0555272
0.102723
0.104287
0.0597097
0.136388
0.054933
0.121502
0.138366
0.131052
0.138926
0.116983
0.0464346
0.0373056
0.0564076
0.0855843
0.139154
0.136858
0.0955462
0.0119069
0.153042
0.13935
0.0751695
0.134927
0.114349
0.131634
0.0574019
0.128489
0.138573
0.155093
0.0724317
0.0989817
0.139878
0.0565498
0.0846309
0.137619
0.132903
0.114168
0.120846
0.0461447
0.0274058
0.042807
0.097272
0.123955
0.0446761
0.102028
0.0516638
0.024795
0.0530952
0.0519585
0.194466
0.139393
0.0975516
0.0512232
0.100712
0.0819851
0.0685186
0.138833
0.0638764
0.136746
0.138393
0.0435608
0.101155
0.0501401
0.0953746
0.132604
0.139186
0.139713
0.0901266
0.0955462
0.078264
0.139175
0.14003
0.0509512
0.119732
0.13608
0.0580087
0.0716917
0.12438
0.13954
0.123624
0.0668851
0.0299096
0.0471585
0.10965
0.0628945
0.137342
0.139901
0.136325
0.024059
0.30501
0.0973904
0.0237089
0.0583231
0.142446
0.131281
0.0495781
0.0980844
0.127946
0.140154
0.139328
0.21937
0.193116
0.104042
0.118341
0.0846323
0.139979
0.137948
0.0885815
0.118932
0.139638
0.135572
0.113434
0.0150355
0.111431
0.066341
0.0476444
0.126932
0.129016
0.134943
0.0691538
0.137794
0.0691641
0.0558988
0.146356
0.139775
0.0868033
0.00542861
0.138901
0.0381324
0.374129
0.116151
0.138753
0.139525
0.0969936
0.234142
0.125187
0.049914
0.0121787
0.0649096
0.0616935
0.137232
0.227714
0.060684
0.127706
0.17768
0.0786464
0.119554
0.0507575
0.139541
0.136283
0.111482
0.0353089
0.046713
0.0672024
0.129128
0.0522666
0.137668
0.127075
0.108748
0.115692
0.130592
0.131678
0.0439362
0.127964
0.13477
0.13742
0.0659691
0.105772
0.132317
0.0960788
0.0421848
0.0316143
0.135731
0.113233
0.128258
0.135062
0.107645
0.0758462
0.130095
0.0669829
0.0395796
0.0395063
0.0897476
0.132045
0.0380008
0.131188
0.137217
0.0758255
0.0244947
0.137274
0.123265
0.128508
0.116089
0.118484
0.0476457
0.138371
0.0877236
0.140001
0.0859056
0.0396347
0.129993
0.133447
0.128818
0.111901
0.0723291
0.0250672
0.06393
0.0989194
0.130461
0.103524
0.135491
0.139476
0.0667807
0.0461066
0.126114
0.125274
0.0472614
0.202594
0.139938
0.039962
0.166266
0.0879365
0.137796
0.123291
0.0959928
0.0548685
0.314618
0.112796
0.137914
0.138175
0.0734887
0.091088
0.056609
0.130811
0.0505274
0.0546304
0.123225
0.139074
0.0406341
0.134921
0.0597549
0.130919
0.0998713
0.00590366
0.0567887
0.138935
0.0676777
0.124589
0.0829167
0.110146
0.00667484
0.0530374
0.12456
0.0911664
0.139967
0.138794
0.125903
0.0846174
0.134739
0.137879
0.0635293
0.110318
0.13994
0.0752931
0.106162
0.0464744
0.105473
0.0302227
0.0471356
0.138432
0.070683
0.131505
0.13776
0.0336181
0.122191
0.0976835
0.140041
0.0293459
0.106995
0.0894295
0.080167
0.0803684
0.0705247
0.140023
0.0373616
0.133285
0.139611
0.120639
0.138905
0.139437
0.110625
0.0649386
0.138342
0.301907
0.0464606
0.0745189
0.077267
0.0961397
0.0245048
0.0988248
0.131916
0.0551988
0.10483
0.0438545
0.140056
0.0113539
0.043872
0.128876
0.0730842
0.0420103
0.0491491
0.0340223
0.050199
0.136487
0.0475282
0.021955
0.0231297
0.0477532
0.0608292
0.0933191
0.0530344
0.0291622
0.123732
0.0625093
0.0417568
0.059747
0.0540198
0.137398
0.126675
0.0126678
0.138107
0.121937
0.125613
0.12942
0.0543008
0.00399681
0.139946
0.0526235
0.0741426
0.13871
0.139795
0.06047
0.0441529
0.0466497
0.136753
0.12492
0.0827861
0.0553934
0.12125
0.0595252
0.129723
0.0620218
0.0562357
0.137315
0.080357
0.0789994
0.0527436
0.0576356
0.0449888
0.061704
0.0445203
0.0991907
0.0848287
0.0605205
0.038398
0.0887769
0.0478598
0.127482
0.122853
0.360221
0.108482
0.0496979
0.101861
0.0442676
0.102057
0.138253
0.0483211
0.0830589
0.0539626
0.0848676
0.0361508
0.108925
0.0328088
0.100868
0.138719
0.13701
0.111597
0.101203
0.0328953
0.0643957
0.139762
0.0694198
0.0580154
0.0439126
0.047839
0.0469688
0.118085
0.0508015
0.125685
0.139761
0.0485642
0.029441
0.131836
0.0798796
0.097874
0.124941
0.0747482
0.138599
0.0634966
0.0818839
0.085915
0.09849
0.0274211
0.0341704
0.0289947
0.0767202
0.125638
0.131602
0.132424
0.131443
0.107858
0.1395
0.124763
0.139432
0.133613
0.0492124
0.0292041
0.139592
0.0892356
0.0447055
0.0737467
0.106362
0.0361422
0.13875
0.129131
0.0949045
0.137736
0.115947
0.0947122
0.135898
0.131324
0.139725
0.139025
0.0972255
0.13089
0.138464
0.0572206
0.111663
0.108451
0.0530404
0.121601
0.115363
0.131886
0.0999837
0.0160269
0.0571279
0.0469566
0.137773
0.0819902
0.0288684
0.0973364
0.0487368
0.115259
0.139465
0.127016
0.136403
0.0958593
0.0427849
0.135621
0.0602354
0.0831512
0.0402214
0.0692739
0.0538448
0.0982773
0.0404584
0.112258
0.0958866
0.0804347
0.136025
0.0666361
0.0535489
0.0432328
0.0718632
0.0595091
0.0272583
0.139241
0.133973
0.0537164
0.0202698
0.115983
0.133533
0.013458
0.00452607
0.119668
0.135525
0.0472651
0.0261135
0.122264
0.0511009
0.129137
0.0421014
0.124831
0.125473
0.101398
0.119259
0.0438014
0.125527
0.124034
0.0499506
0.0782059
0.0904172
0.0248947
0.138465
0.133335
0.111308
0.137407
0.132803
0.139501
0.127482
0.0584991
0.0507268
0.105799
0.0842333
0.0968844
0.135521
0.116131
0.0886851
0.158244
0.0741195
0.0799327
0.0954579
0.135584
0.0354305
0.120931
0.0937938
0.0734668
0.133926
0.0990156
0.136958
0.0941891
0.0984368
0.135577
0.0589984
0.130066
0.153233
0.132735
0.0938048
0.144214
0.133686
0.00620164
0.0609171
0.0267319
0.125152
0.106524
0.0576159
0.0625071
0.092756
0.140037
0.129376
0.121144
0.0838667
0.153185
0.0516441
0.0658245
0.121577
0.138
0.0516527
0.0155467
0.126819
0.139245
0.0649341
0.139861
0.100755
0.138688
0.152587
0.119219
0.0586487
0.0414654
0.0475557
0.140048
0.137906
0.04105
0.138616
0.0841839
0.0437753
0.110977
0.0553972
0.0739864
0.0526723
0.140014
0.139972
0.162044
0.128815
0.125402
0.0349153
0.128549
0.0729929
0.0501485
0.131759
0.0487688
0.111781
0.0158904
0.139936
0.00911759
0.0447475
0.132938
0.082292
0.137065
0.0912113
0.0869775
0.116232
0.0528363
0.122075
0.076284
0.107839
0.14014
0.110883
0.139366
0.061812
0.138642
0.138827
0.0361156
0.1003
0.13928
0.144724
0.108855
0.131513
0.135489
0.138077
0.0938547
0.119588
0.0926551
0.208852
0.133019
0.13519
0.0313712
0.115776
0.138591
0.10856
0.0387615
0.0121278
0.139998
0.0733419
0.125606
0.139646
0.0724886
0.0971135
0.0535765
0.155595
0.0554337
0.147237
0.127618
0.0526954
0.110413
0.138386
0.112016
0.13366
0.0577532
0.0537216
0.0899012
0.127578
0.133855
0.0721581
0.127866
0.0973713
0.136799
0.136045
0.138546
0.0552818
0.0589706
0.156532
0.0686722
0.0626459
0.111588
0.0758607
0.129156
0.0527442
0.121986
0.0521021
0.128372
0.0636425
0.0487279
0.100568
0.141113
0.0564765
0.0872134
0.0443695
0.109727
0.0816262
0.0506854
0.108775
0.133301
0.124103
0.111046
0.126364
0.0194259
0.0721282
0.103628
0.136531
0.0454705
0.0988149
0.130075
0.08289
0.162167
0.0986032
0.105957
0.0894123
0.138297
0.0353103
0.0902546
0.133519
0.139835
0.134064
0.101034
0.135534
0.0876717
0.0870909
0.107416
0.0543753
0.139107
0.138976
0.13748
0.00521667
0.0760215
0.133808
0.13797
0.126871
0.105884
0.0175578
0.0517258
0.139584
0.137122
0.116984
0.130107
0.113324
0.140274
0.0916902
0.0652353
0.0319847
0.122785
0.0721336
0.129126
0.16813
0.124666
0.137309
0.129879
0.107952
0.341041
0.133276
0.130316
0.0446128
0.115386
0.136365
0.0799693
0.0423308
0.0130674
0.139984
0.100838
0.156905
0.1304
0.131711
0.111498
0.135919
0.0837402
0.139434
0.13024
0.0991343
0.136232
0.134722
0.101681
0.140235
0.115066
0.0675883
0.0756851
0.102977
0.1281
0.102571
0.134059
0.0659926
0.108314
0.139537
0.0314229
0.0820103
0.106605
0.169104
0.133551
0.0786737
0.104086
0.0193817
0.134611
0.10483
0.131599
0.100323
0.0588999
0.13041
0.0507808
0.127699
0.0468154
0.13021
0.12159
0.126333
0.119158
0.141755
0.336652
0.138917
0.100431
0.0986352
0.104085
0.123038
0.132668
0.0391293
0.0275959
0.131289
0.0169739
0.0798092
0.138102
0.0477453
0.109403
0.136461
0.12386
0.100909
0.124034
0.0391457
0.0989253
0.134728
0.087885
0.133468
0.109295
0.112995
0.135564
0.130942
0.0997635
0.0872762
0.122665
0.0290069
0.129216
0.0108926
0.0993731
0.138668
0.139383
0.2645
0.138848
0.138835
0.0991149
0.0576424
0.123229
0.0551836
0.0854104
0.139038
0.127002
0.13822
0.0990746
0.133765
0.137331
0.158984
0.087548
0.132735
0.0561148
0.0986025
0.136569
0.296687
0.0215065
0.135646
0.066185
0.0358384
0.133132
0.133448
0.0849987
0.131253
0.0567026
0.131775
0.136911
0.11718
0.13147
0.0585648
0.138895
0.138578
0.142388
0.051738
0.138457
0.123782
0.109411
0.0443803
0.13887
0.0682459
0.0556301
0.0463523
0.130996
0.18586
0.137136
0.117737
0.139238
0.121337
0.102653
0.13749
0.120194
0.0817993
0.0514927
0.0673866
0.0522706
0.0992222
0.117568
0.119177
0.139852
0.139408
0.389334
0.0520981
0.139589
0.258093
0.137456
0.0499
0.140039
0.0482933
0.0629023
0.0648903
0.132552
0.0502261
0.0878487
0.0569337
0.124253
0.0530168
0.119823
0.0543139
0.12813
0.12154
0.118426
0.131593
0.139385
0.0539571
0.116107
0.139271
0.0688866
0.0515825
0.0602993
0.108245
0.12445
0.139092
0.0514451
0.118122
0.138591
0.13166
0.0344979
0.0673164
0.108167
0.019796
0.120544
0.062677
0.064959
0.0518433
0.0564864
0.13878
0.134568
0.127534
0.112166
0.0485758
0.0994657
0.138043
0.106709
0.0451129
0.0768333
0.121502
0.332673
0.0381238
0.139248
0.137823
0.0936738
0.127729
0.130428
0.0569795
0.130831
0.0983609
0.109215
0.134129
0.0450196
0.102855
0.0984618
0.0546219
0.102554
0.138296
0.138849
0.137626
0.128483
0.112846
0.12565
0.102946
0.031446
0.131126
0.0981563
0.0874655
0.074711
0.134741
0.130531
0.0490456
0.139708
0.0228024
0.0949775
0.114665
0.126147
0.0835683
0.0880398
0.109257
0.109013
0.0842807
0.126846
0.140045
0.123417
0.00597576
0.0984113
0.0915942
0.103072
0.366178
0.0885321
0.139173
0.0464507
0.0986909
0.038803
0.132151
0.134344
0.0923035
0.0801008
0.135059
0.136003
0.125977
0.0998169
0.123954
0.0921343
0.114522
0.101379
0.104377
0.13638
0.125897
0.132677
0.136207
0.163723
0.104675
0.135381
0.135875
0.128665
0.10756
0.0760331
0.0466357
0.107034
0.0556159
0.139621
0.137385
0.138982
0.138902
0.0931012
0.119207
0.125351
0.0842556
0.134412
0.126527
0.0723113
0.133642
0.102556
0.11226
0.127609
0.135642
0.0368141
0.123141
0.0789832
0.136315
0.132118
0.126457
0.0809752
0.106563
0.057424
0.0766743
0.0478365
0.0606519
0.139786
0.294391
0.135505
0.129986
0.05482
0.0347218
0.113036
0.101606
0.0531866
0.0469167
0.130064
0.0949927
0.125463
0.111118
0.13833
0.10875
0.0531255
0.0658649
0.136916
0.117903
0.0553665
0.0794152
0.0915662
0.146335
0.0353916
0.0787574
0.12914
0.104623
0.12317
0.139825
0.113808
0.123254
0.121042
0.0887391
0.121912
0.13999
0.0559215
0.0994377
0.136781
0.0844039
0.120273
0.136606
0.121769
0.111143
0.0997599
0.050147
0.130912
0.0988386
0.0989888
0.152808
0.0581854
0.139206
0.104084
0.131338
0.166958
0.101354
0.110061
0.0470702
0.139072
0.0721177
0.0554396
0.127253
0.0889692
0.122436
0.139536
0.103466
0.0880516
0.0394014
0.124479
0.112598
0.120661
0.135961
0.0218058
0.132119
0.0992283
0.139673
0.128646
0.146643
0.0873064
0.103012
0.106141
0.0453719
0.137027
0.124207
0.1322
0.137994
0.0535331
0.0868807
0.0243473
0.0597576
0.103003
0.0886171
0.0834241
0.11544
0.1323
0.00498139
0.137017
0.120617
0.0776189
0.137917
0.121938
0.0919642
0.0858551
0.113698
0.137093
0.074564
0.114756
0.128766
0.133872
0.0491334
0.136011
0.0744469
0.126671
0.107761
0.0791614
0.0508074
0.136999
0.0361862
0.117614
0.108437
0.139428
0.0616307
0.0226732
0.132548
0.134044
0.101766
0.0167176
0.107869
0.138397
0.0520887
0.123253
0.0440421
0.0404179
0.055573
0.137366
0.11223
0.0559479
0.138783
0.138665
0.0503819
0.0435776
0.143536
0.134517
0.132597
0.13389
0.122024
0.078071
0.132075
0.11658
0.103598
0.120146
0.126239
0.138693
0.119152
0.129312
0.104895
0.138298
0.0801712
0.107198
0.100366
0.0532008
0.138756
0.110914
0.0710432
0.139984
0.038541
0.132889
0.128566
0.055102
0.130267
0.134704
0.0188206
0.108705
0.136366
0.112415
0.125573
0.104358
0.13975
0.0236335
0.136339
0.0265604
0.046879
0.0453797
0.0924979
0.0511805
0.118998
0.100591
0.0611417
0.0629212
0.0251717
0.0207903
0.0337624
0.136174
0.126337
0.0489584
0.107281
0.113161
0.0280542
)
;
boundaryField
{
wings
{
type fixedValue;
value uniform 0;
}
outlet
{
type freestream;
freestreamValue uniform 0.14;
value nonuniform List<scalar>
20
(
0.120024
0.288801
0.162002
0.221094
0.135856
0.354421
0.0952072
0.143127
0.134369
0.222539
0.137177
0.133531
0.139345
0.374478
0.135696
0.374129
0.1395
0.125606
0.156905
0.102556
)
;
}
tunnel
{
type fixedValue;
value uniform 0;
}
inlet
{
type freestream;
freestreamValue uniform 0.14;
value uniform 0.14;
}
defaultFaces
{
type empty;
}
}
// ************************************************************************* //
| [
"rlee32@gatech.edu"
] | rlee32@gatech.edu | |
df5aacbee7ce302ee7c3a824130813ca39800cb1 | e5f2e6b61ce0e309b8754727b5c7a058888b7ab1 | /src/test/absyn/DirichletSimpleTest.cpp | e1707bb45fe8be363f2226459d7f7ea7ddbe12f2 | [
"BSD-2-Clause"
] | permissive | glguida/swift | 899e506ed5856d4f5cc7ddaaf9881e029548cc8b | 57c4a4cd065f1149f86f3d04402f8dbdce1ac5ff | refs/heads/master | 2020-04-08T05:53:45.947327 | 2017-12-02T06:16:30 | 2017-12-02T06:16:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,303 | cpp | #include "DirichletSimpleTest.h"
namespace test_absyn {
using namespace swift::absyn;
DirichletSimpleTest::DirichletSimpleTest() :root(NULL){}
DirichletSimpleTest::~DirichletSimpleTest() {
if (root != NULL) delete root;
}
BlogProgram* DirichletSimpleTest::getRoot() {
return root;
}
/*
random RealMatrix w ~ Dirichlet(1.0, 2.0, 3.0);
random Integer x ~ Discrete(w);
query x;
*/
void DirichletSimpleTest::build(){
BlogProgram *blog = new BlogProgram(0, 0);
root = blog;
/*
random RealMatrix w ~ Dirichlet(1.0, 2.0, 3.0);
*/
{
FuncApp *dis = new FuncApp(0, 0, Symbol("Dirichlet"));
dis->add(new DoubleLiteral(0, 0, 1.0));
dis->add(new DoubleLiteral(0, 0, 2.0));
dis->add(new DoubleLiteral(0, 0, 3.0));
FuncDecl *fd = new FuncDecl(0, 0, true, Symbol("RealMatrix"), Symbol("w"), dis);
blog->add(fd);
}
/*
random Integer x ~ Discrete(w);
*/
{
FuncApp *dis = new FuncApp(0, 0, Symbol("Discrete"));
dis->add(new FuncApp(0, 0, Symbol("w")));
FuncDecl *fd = new FuncDecl(0, 0, true, Symbol("Integer"), Symbol("x"), dis);
blog->add(fd);
}
/*
query x;
*/
{
blog->add(new Query(0, 0, new FuncApp(0, 0, Symbol("x"))));
}
}
void DirichletSimpleTest::test(FILE *file)
{
build();
if(file != NULL) root->print(file, 0);
}
}
| [
"jxwuyi@gmail.com"
] | jxwuyi@gmail.com |
0a5428a1e82cb59ef9d840031640fa50b8bd1e28 | c4a54ce1b87cc3f1e36b58a48fbd4e70fb62a61b | /sinstar3_core/ShellExecuteMonitor.cpp | 23047ca49d1875ab06eb825050a7571ddc44fd9a | [
"MIT"
] | permissive | Tobacco-cn/sinstar3 | 7105230ae28de7c7c9f8619d6cef4fcc8b53eac2 | baafb0894678c8ed5bbee698152e4aa8d593facf | refs/heads/master | 2023-03-17T09:08:15.352386 | 2018-08-22T07:14:41 | 2018-08-22T07:14:41 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,511 | cpp | #include "stdafx.h"
#include "ShellExecuteMonitor.h"
#include <shellapi.h>
CShellExecuteMonitor::CShellExecuteMonitor(SHELLEXECUTEDATA *pData, HWND hMsgRecv)
{
m_shellExecuteInfo = new SHELLEXECUTEDATA;
m_shellExecuteInfo->nType = pData->nType;
m_shellExecuteInfo->strFileName = pData->strFileName;
m_shellExecuteInfo->strOp = pData->strOp;
m_hWndRecv = hMsgRecv;
m_exitCode = -1;
}
CShellExecuteMonitor::~CShellExecuteMonitor()
{
delete m_shellExecuteInfo;
}
HANDLE CShellExecuteMonitor::ShellExe(LPCTSTR pszOp,LPCTSTR pszFileName)
{
SHELLEXECUTEINFO ShExecInfo = { 0 };
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = pszOp;
ShExecInfo.lpFile = pszFileName;
ShExecInfo.lpParameters = NULL;
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOWDEFAULT;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
return ShExecInfo.hProcess;
}
UINT CShellExecuteMonitor::Run()
{
HANDLE hProc = ShellExe(m_shellExecuteInfo->strOp,m_shellExecuteInfo->strFileName);
if (!hProc)
{
PostMessage(m_hWndRecv, UM_PROCESSEXIT, 0, (LPARAM)this);
return -1;
}
HANDLE hWaitObjs[2] = { m_evtStop,hProc };
DWORD dwRet = WaitForMultipleObjects(2, hWaitObjs, FALSE, INFINITE);
if (dwRet == WAIT_OBJECT_0 + 1)
{
GetExitCodeProcess(hProc, &m_exitCode);
PostMessage(m_hWndRecv, UM_PROCESSEXIT, 1, (LPARAM)this);
}
CloseHandle(hProc);
return 0;
}
| [
"setoutsoft@qq.com"
] | setoutsoft@qq.com |
acae2306a4a91a554d52d42572131716f63c1269 | c0b577f881c8f7a9bcea05aaad364a7e82bdec8a | /Source/ISS/Development/CommonInterfaceControlLayer/Cicl_Devices/AtxmlSLSerial/AtxmlSLSerial/AtxmlSLS.cpp | 2a3215c8898f9a1adac0ac17dc6daa792ec7316a | [] | no_license | 15831944/GPATS-Compare | 7e6c8495bfb2bb6f5f651e9886a50cf23809399f | d467c68381d4011f7c699d07467cbccef6c8ed9a | refs/heads/main | 2023-08-14T09:15:18.986272 | 2021-09-23T16:56:13 | 2021-09-23T16:56:13 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 20,920 | cpp | //2345678901234567890123456789012345678901234567890123456789012345678901234567890
///////////////////////////////////////////////////////////////////////////
// File: SLS232A.cpp
//
// Date: 13FEB06
//
// Purpose: Instrument Driver for SLS232A
//
// Instrument: SLS232A <device description> (DMM)
//
// Required Libraries / DLL's
//
// Library/DLL Purpose
// ===================== ===============================================
// AtXmlWrapper.lib ..\..\Common\lib (EADS Wrapper support functions)
//
//
//
// Revision History described in SLS232A_T.cpp
//
///////////////////////////////////////////////////////////////////////////////
// Includes
#include "AtxmlWrapper.h"
#include "AtxmlSLS_T.h"
#include <sys/stat.h>
// Local Defines
#define MAX_DEVICES 10
// Static Variables
static int s_NumDev = 0;
static ATXMLW_DEVINFO s_DevInfo[MAX_DEVICES]; // Device and Address information
// Local Function Prototypes
//++++/////////////////////////////////////////////////////////////////////////
// Exposed Functions
///////////////////////////////////////////////////////////////////////////////
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
;
}
return TRUE;
}
///////////////////////////////////////////////////////////////////////////////
// Function: ATXMLW_WRAP_FNC Initialize
//
// Purpose: Initialize the instrument driver Called for each Base/Physical/Virtual
// Resource
//
// Input Parameters
// Parameter Type Purpose
// =============== ============== ===========================================
// Instno int System assigned instrument number
// ResourceType int Type of Resource Base, Physical, Virtual
// ResourceName char* Station resource name
// Sim int Simulation flag value (0/1)
// Dbglvl int Debug flag value
// AddressInfoPtr InstAddPtr* Contains all addressing information available
//
// Output Parameters
// Parameter Type Purpose
// =============== =================== ===========================================
// Response ATXMLW_INTF_RESPONSE* Return any error codes and messages
//
// Return:
// 0 on success.
// -ErrorCode on failure
//
///////////////////////////////////////////////////////////////////////////////
ATXMLW_WRAP_FNC int Initialize(int Instno, int ResourceType, char* ResourceName, int Sim, int Dbglvl, ATXMLW_INSTRUMENT_ADDRESS *AddressInfoPtr, ATXMLW_INTF_RESPONSE* Response, int Buffersize)
{
char TmpBuf[_MAX_PATH];
struct _stat StatBuf;
if (DE_BUG == 0) {
sprintf(TmpBuf, "%s", DEBUG_PCI);
DE_BUG = _stat(TmpBuf, &StatBuf) == -1 ? 0 : 1;
}
// Insure Response is empty
if(Response != NULL)
{
memset(Response, '\0', Buffersize);
}
// Check if not already initialized
if(s_NumDev == 0)
{
memset(s_DevInfo,'\0',sizeof(s_DevInfo));
}
if(ResourceType == ATXMLW_RESTYPE_BASE)
{
// Check for MAX Driver Overflow
if(s_NumDev >= MAX_DEVICES)
{
atxmlw_ErrorResponse(ResourceName,Response,Buffersize, "Initialize ", ATXMLW_WRAPPER_ERRCD_TOO_MANY_DEVICES, ATXMLW_WRAPPER_ERRMSG_TOO_MANY_DEVICES);
return(ATXMLW_WRAPPER_ERRCD_TOO_MANY_DEVICES);
}
// Save Device Array Info
s_DevInfo[s_NumDev].InstNo = Instno;
s_DevInfo[s_NumDev].ResourceType = ResourceType;
if(ResourceName)
{
strnzcpy(s_DevInfo[s_NumDev].ResourceName, ResourceName, ATXMLW_MAX_NAME);
}
s_DevInfo[s_NumDev].Dbg = Dbglvl;
s_DevInfo[s_NumDev].Sim = Sim;
// Save Address Information
if(AddressInfoPtr)
{
s_DevInfo[s_NumDev].AddressInfo.ResourceAddress = AddressInfoPtr->ResourceAddress;
if(AddressInfoPtr->InstrumentQueryID)
{
strnzcpy(s_DevInfo[s_NumDev].AddressInfo.InstrumentQueryID, AddressInfoPtr->InstrumentQueryID, ATXMLW_MAX_NAME);
}
s_DevInfo[s_NumDev].AddressInfo.InstrumentTypeNumber = AddressInfoPtr->InstrumentTypeNumber;
if(AddressInfoPtr->ControllerType)
{
strnzcpy(s_DevInfo[s_NumDev].AddressInfo.ControllerType, AddressInfoPtr->ControllerType, ATXMLW_MAX_NAME);
}
s_DevInfo[s_NumDev].AddressInfo.ControllerNumber = AddressInfoPtr->ControllerNumber;
s_DevInfo[s_NumDev].AddressInfo.PrimaryAddress = AddressInfoPtr->PrimaryAddress;
s_DevInfo[s_NumDev].AddressInfo.SecondaryAddress = AddressInfoPtr->SecondaryAddress;
s_DevInfo[s_NumDev].AddressInfo.SubModuleAddress = AddressInfoPtr->SubModuleAddress;
}
s_DevInfo[s_NumDev].DriverClass = new CSLS232A_T(s_DevInfo[s_NumDev].InstNo, s_DevInfo[s_NumDev].ResourceType, s_DevInfo[s_NumDev].ResourceName, s_DevInfo[s_NumDev].Sim,
s_DevInfo[s_NumDev].Dbg, &s_DevInfo[s_NumDev].AddressInfo, Response, Buffersize);
s_NumDev++;
}
return (0);
}
///////////////////////////////////////////////////////////////////////////////
// Function: ATXMLW_WRAP_FNC Close
//
// Purpose: Close the instrument driver
//
// Input Parameters
// Parameter Type Purpose
// =============== ============== ===========================================
//
// Output Parameters
// Parameter Type Purpose
// =============== ============== ===========================================
//
// Return:
// 0 on success.
// -ErrorCode on failure
//
///////////////////////////////////////////////////////////////////////////////
ATXMLW_WRAP_FNC int Close(void)
{
int i;
for(i = 0; i < s_NumDev; i++)
{
if(s_DevInfo[i].DriverClass != NULL)
{
delete((CSLS232A_T *)(s_DevInfo[i].DriverClass));
}
s_DevInfo[i].DriverClass = NULL;
}
s_NumDev = 0;
// CoUninitialize();
return 0;
}
///////////////////////////////////////////////////////////////////////////////
// Function: ATXMLW_WRAP_FNC RegisterTSF
//
// Purpose: Send an ATXMLW IEEE 1641 (TSF) description to the instrument driver
// For efficency sake, This function is not currently implemented
// When implemented, It will cash the TSF locally and Interseed
// IssueSignal via local static routines.
// It will not pass it on to the _T processing!
//
// Input Parameters
// Parameter Type Purpose
// ================= ================== ===========================================
//
// Output Parameters
// Parameter Type Purpose
// =============== =================== ===========================================
//
// Return:
// 0 on success.
// -ErrorCode on failure
//
///////////////////////////////////////////////////////////////////////////////
#pragma warning(disable:4100)
ATXMLW_WRAP_FNC int RegisterTSF(ATXMLW_XML_FILENAME* TSFSignalDefinition, ATXMLW_XML_FILENAME* TSFLibrary, ATXMLW_XML_FILENAME* STDTSF, ATXMLW_XML_FILENAME* STDBSC)
{
return(ATXMLW_WRAPPER_ERRCD_REGISTER_TSF_NOT_IMPLEMENTED);
}
///////////////////////////////////////////////////////////////////////////////
// Function: ATXMLW_WRAP_FNC IssueSignal
//
// Purpose: Send an ATXMLW IEEE 1641 (BSC) signal description to the instrument driver
//
// Input Parameters
// Parameter Type Purpose
// ================= ================== ===========================================
// Instno int System assigned instrument number
// ResourceType int Type of Resource Base, Physical, Virtual
// ResourceName char* Station resource name
// SignalDescription ATXMLW_INTF_SIGDESC* IEEE 1641 BSC Signal description + action/resource
//
// Output Parameters
// Parameter Type Purpose
// =============== =================== ===========================================
// Response ATXMLW_INTF_RESPONSE* Return any error codes and messages
//
// Return:
// 0 on success.
// -ErrorCode on failure
//
///////////////////////////////////////////////////////////////////////////////
ATXMLW_WRAP_FNC int IssueSignal(int Instno, int ResourceType, char* ResourceName, ATXMLW_INTF_SIGDESC* SignalDescription, ATXMLW_INTF_RESPONSE* Response, int BufferSize)
{
int i;
char cInstNo[20];
void *DriverClass = NULL;
// Insure Response is empty
if(Response != NULL)
{
memset(Response, '\0', BufferSize);
}
// Find the class to invoke via Instno or ResourceName etc.
for(i = 0; i < s_NumDev; i++)
{
if(s_DevInfo[i].InstNo == Instno)
{
DriverClass = (void *)(s_DevInfo[i].DriverClass);
break;
}
}
// Any Errors ?
if(i >= s_NumDev)
{
itoa(Instno,cInstNo,10);
atxmlw_ErrorResponse(cInstNo, Response, BufferSize, "IssueSignal ", ATXMLW_WRAPPER_ERRCD_DEVICE_NOT_FOUND, ATXMLW_WRAPPER_ERRMSG_DEVICE_NOT_FOUND);
return(ATXMLW_WRAPPER_ERRCD_DEVICE_NOT_FOUND);
}
//
((CSLS232A_T *)(DriverClass))->IssueSignalSLS232A(SignalDescription, Response, BufferSize);
return(0);
}
///////////////////////////////////////////////////////////////////////////////
// Function: ATXMLW_WRAP_FNC Status
//
// Purpose: Query the instrument status
//
// Input Parameters
// Parameter Type Purpose
// ================= ================== ===========================================
// Instno int System assigned instrument number
// ResourceType int Type of Resource Base, Physical, Virtual
// ResourceName char* Station resource name
//
// Output Parameters
// Parameter Type Purpose
// =============== =================== ===========================================
// Response ATXMLW_INTF_RESPONSE* Return any error codes and messages
//
// Return:
// 0 on success.
// -ErrorCode on failure
//
///////////////////////////////////////////////////////////////////////////////
ATXMLW_WRAP_FNC int Status(int Instno, int ResourceType, char* ResourceName, ATXMLW_INTF_RESPONSE* Response, int BufferSize)
{
int i;
char cInstNo[20];
void *DriverClass = NULL;
// Insure Response is empty
if(Response != NULL)
{
memset(Response, '\0', BufferSize);
}
// Find the class to invoke via Instno or ResourceName etc.
for(i = 0; i < s_NumDev; i++)
{
if(s_DevInfo[i].InstNo == Instno)
{
DriverClass = (void *)(s_DevInfo[i].DriverClass);
break;
}
}
// Any Errors ?
if(i >= s_NumDev)
{
itoa(Instno,cInstNo,10);
atxmlw_ErrorResponse(cInstNo, Response, BufferSize, "Status ", ATXMLW_WRAPPER_ERRCD_DEVICE_NOT_FOUND, ATXMLW_WRAPPER_ERRMSG_DEVICE_NOT_FOUND);
return(ATXMLW_WRAPPER_ERRCD_DEVICE_NOT_FOUND);
}
((CSLS232A_T *)(DriverClass))->StatusSLS232A(Response, BufferSize);
return(0);
}
///////////////////////////////////////////////////////////////////////////////
// Function: ATXMLW_WRAP_FNC RegCal
//
// Purpose: Register the latest Calibration Factors to the Instrument Driver
//
// Input Parameters
// Parameter Type Purpose
// ================= ================== ===========================================
// Instno int System assigned instrument number
// ResourceType int Type of Resource Base, Physical, Virtual
// ResourceName char* Station resource name
// CalData ATXMLW_INTF_CALDATA* XML String for cal data
//
// Output Parameters
// Parameter Type Purpose
// =============== =================== ===========================================
//
// Return:
// 0 on success.
// -ErrorCode on failure
//
///////////////////////////////////////////////////////////////////////////////
ATXMLW_WRAP_FNC int RegCal(int Instno, int ResourceType, char* ResourceName, ATXMLW_INTF_CALDATA* CalData)
{
int i;
void *DriverClass = NULL;
// Find the class to invoke via Instno or ResourceName etc.
for(i = 0; i < s_NumDev; i++)
{
if(s_DevInfo[i].InstNo == Instno)
{
DriverClass = (void *)(s_DevInfo[i].DriverClass);
break;
}
}
// Any Errors ?
if(i >= s_NumDev)
{
return(ATXMLW_WRAPPER_ERRCD_DEVICE_NOT_FOUND);
}
((CSLS232A_T *)(DriverClass))->RegCalSLS232A(CalData);
return(0);
}
///////////////////////////////////////////////////////////////////////////////
// Function: ATXMLW_WRAP_FNC Reset
//
// Purpose: Reset the instrument
//
// Input Parameters
// Parameter Type Purpose
// ================= ================== ===========================================
// Instno int System assigned instrument number
// ResourceType int Type of Resource Base, Physical, Virtual
// ResourceName char* Station resource name
//
// Output Parameters
// Parameter Type Purpose
// =============== =================== ===========================================
// Response ATXMLW_INTF_RESPONSE* Return any error codes and messages
//
// Return:
// 0 on success.
// -ErrorCode on failure
//
///////////////////////////////////////////////////////////////////////////////
ATXMLW_WRAP_FNC int Reset(int Instno, int ResourceType, char* ResourceName, ATXMLW_INTF_RESPONSE* Response, int BufferSize)
{
int i;
void *DriverClass = NULL;
char localResponse[2048];
int localBufferSize = sizeof(localResponse);
localResponse[0] = 0;
// Insure Response is empty
if(Response != NULL)
{
memset(Response, '\0', BufferSize);
}
// Find the class to invoke via Instno or ResourceName etc.
for(i = 0; i < s_NumDev; i++)
{
// Reset All devices on Instno = 0 (Probably never used)
if((Instno == 0) || (s_DevInfo[i].InstNo == Instno))
{
if(s_DevInfo[i].DriverClass)
((CSLS232A_T *)(s_DevInfo[i].DriverClass))->ResetSLS232A(localResponse, localBufferSize);
}
}
if( Response != 0 && BufferSize > 0 )
{
strncpy( Response, localResponse, BufferSize );
}
return(0);
}
///////////////////////////////////////////////////////////////////////////////
// Function: ATXMLW_WRAP_FNC Ist
//
// Purpose: Invoke Instrument Self Test and return response
//
// Input Parameters
// Parameter Type Purpose
// ================= ================== ===========================================
// Instno int System assigned instrument number
// ResourceType int Type of Resource Base, Physical, Virtual
// ResourceName char* Station resource name
// Level int Instrument Self Test Level ATXMLW_IST_LVL
//
// Output Parameters
// Parameter Type Purpose
// =============== =================== ===========================================
// Response ATXMLW_INTF_RESPONSE* Return any error codes and messages
//
// Return:
// 0 on success.
// -ErrorCode on failure
//
///////////////////////////////////////////////////////////////////////////////
ATXMLW_WRAP_FNC int Ist(int Instno, int ResourceType, char* ResourceName, int Level, ATXMLW_INTF_RESPONSE* Response, int BufferSize)
{
int i;
char cInstNo[20];
void *DriverClass = NULL;
// Insure Response is empty
if(Response != NULL)
{
memset(Response, '\0', BufferSize);
}
// Find the class to invoke via Instno or ResourceName etc.
for(i = 0; i < s_NumDev; i++)
{
if(s_DevInfo[i].InstNo == Instno)
{
DriverClass = (void *)(s_DevInfo[i].DriverClass);
break;
}
}
// Any Errors ?
if(i >= s_NumDev)
{
itoa(Instno,cInstNo,10);
atxmlw_ErrorResponse(cInstNo, Response, BufferSize, "Ist ", ATXMLW_WRAPPER_ERRCD_DEVICE_NOT_FOUND, ATXMLW_WRAPPER_ERRMSG_DEVICE_NOT_FOUND);
return(ATXMLW_WRAPPER_ERRCD_DEVICE_NOT_FOUND);
}
((CSLS232A_T *)(DriverClass))->IstSLS232A(Level, Response, BufferSize);
return(0);
}
//++++/////////////////////////////////////////////////////////////////////////
// Special Non-ATXMLW Cheat Functions
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Function: ATXMLW_WRAP_FNC IssueNativeCmds
//
// Purpose: Invoke Instrument Self Test and return response
//
// Input Parameters
// Parameter Type Purpose
// ================= ================== ========================================
// Instno int System assigned instrument number
// ResourceType int Type of Resource Base, Physical, Virtual
// ResourceName char* Station resource name
// InstrumentCmds ATXMLW_INTF_INSTCMD* XML String for Instrument Commands
//
// Output Parameters
// Parameter Type Purpose
// =============== =================== ===========================================
// Response ATXMLW_INTF_RESPONSE* Return any error codes and messages
//
// Return:
// 0 on success.
// -ErrorCode on failure
//
///////////////////////////////////////////////////////////////////////////////
ATXMLW_WRAP_FNC int IssueNativeCmds(int Instno, int ResourceType, char* ResourceName, ATXMLW_INTF_INSTCMD* InstrumentCmds, ATXMLW_INTF_RESPONSE* Response, int BufferSize)
{
int i;
char cInstNo[20];
void *DriverClass = NULL;
int Status = 0;
// Insure Response is empty
if(Response != NULL)
{
memset(Response, '\0', BufferSize);
}
// Find the class to invoke via Instno or ResourceName etc.
for(i = 0; i < s_NumDev; i++)
{
if(s_DevInfo[i].InstNo == Instno)
{
DriverClass = (void *)(s_DevInfo[i].DriverClass);
break;
}
}
// Any Errors ?
if(i >= s_NumDev)
{
itoa(Instno,cInstNo,10);
atxmlw_ErrorResponse(cInstNo, Response, BufferSize, "IssueNativeCmds ", ATXMLW_WRAPPER_ERRCD_DEVICE_NOT_FOUND, ATXMLW_WRAPPER_ERRMSG_DEVICE_NOT_FOUND);
return(ATXMLW_WRAPPER_ERRCD_DEVICE_NOT_FOUND);
}
Status = ((CSLS232A_T *)(DriverClass))->IssueNativeCmdsSLS232A(InstrumentCmds,
Response, BufferSize);
return(Status);
}
///////////////////////////////////////////////////////////////////////////////
// Function: ATXMLW_WRAP_FNC IssueDriverFunctionCall
//
// Purpose: Invoke Instrument Self Test and return response
//
// Input Parameters
// Parameter Type Purpose
// ================= ================== ========================================
// Instno int System assigned instrument number
// ResourceType int Type of Resource Base, Physical, Virtual
// ResourceName char* Station resource name
// DriverFunction ATXMLW_INTF_DRVRFNC* XML String for Driver Function and parameters
//
// Output Parameters
// Parameter Type Purpose
// =============== =================== ===========================================
// Response ATXMLW_INTF_RESPONSE* Return any error codes and messages
//
// Return:
// 0 on success.
// -ErrorCode on failure
//
///////////////////////////////////////////////////////////////////////////////
ATXMLW_WRAP_FNC int IssueDriverFunctionCall(int Instno, int ResourceType, char* ResourceName, ATXMLW_INTF_DRVRFNC* DriverFunction, ATXMLW_INTF_RESPONSE* Response, int BufferSize)
{
int i;
char cInstNo[20];
void *DriverClass = NULL;
// Insure Response is empty
if(Response != NULL)
{
memset(Response, '\0', BufferSize);
}
// Find the class to invoke via Instno or ResourceName etc.
for(i = 0; i < s_NumDev; i++)
{
if(s_DevInfo[i].InstNo == Instno)
{
DriverClass = (void *)(s_DevInfo[i].DriverClass);
break;
}
}
// Any Errors ?
if(i >= s_NumDev)
{
itoa(Instno,cInstNo,10);
atxmlw_ErrorResponse(cInstNo, Response, BufferSize, "IssueDriverFunctionCall ", ATXMLW_WRAPPER_ERRCD_DEVICE_NOT_FOUND, ATXMLW_WRAPPER_ERRMSG_DEVICE_NOT_FOUND);
return(ATXMLW_WRAPPER_ERRCD_DEVICE_NOT_FOUND);
}
((CSLS232A_T *)(DriverClass))->IssueDriverFunctionCallSLS232A(DriverFunction, Response, BufferSize);
return(0);
}
//++++/////////////////////////////////////////////////////////////////////////
// Local Static Functions
///////////////////////////////////////////////////////////////////////////////
| [
"josselyn.webb@gmail.com"
] | josselyn.webb@gmail.com |
82941a0245089c89bab02571136dd659ebfdb98d | 73bede5ba9f9369c8c3108e42da8f3fffdec7dc4 | /structures/list/New Text Document.h | 8f88c129352fb52d7a1f7700cd5d170330ba633e | [] | no_license | EatTheGiant/Algorithms-and-Data-Structures-2 | 9028260f3075386e4a49f7330f3cb79a081ae74c | 1b094ceab5ddc7cdc6e46b9e5f7a92ccf0c7e797 | refs/heads/master | 2023-05-05T04:59:43.810881 | 2021-05-23T17:52:11 | 2021-05-23T17:52:11 | 370,120,959 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,052 | h | #pragma once
#include "list.h"
#include "../ds_routines.h"
#include "../heap_monitor.h"
namespace structures {
template<typename T>
class ObojZretLinkedListItem : public DataItem<T>
{
public:
/// <summary> Konstruktor. </summary>
/// <param name = "data"> Data, ktore uchovava. </param>
ObojZretLinkedListItem(T data);
/// <summary> Kopirovaci konstruktor. </summary>
/// <param name = "other"> Prvok jednstranne zretazeneho zoznamu, z ktoreho sa prevezmu vlastnosti.. </param>
ObojZretLinkedListItem(const ObojZretLinkedListItem<T>& other);
/// <summary> Destruktor. </summary>
~ObojZretLinkedListItem();
/// <summary> Getter nasledujuceho prvku zretazeneho zoznamu. </summary>
/// <returns> Nasledujuci prvok zretazeneho zoznamu. </returns>
ObojZretLinkedListItem<T>* getNext();
/// <summary> Getter predchadzajuceho prvku zretazeneho zoznamu. </summary>
/// <returns> Predchadzajuci prvok zretazeneho zoznamu. </returns>
ObojZretLinkedListItem<T>* getPrevious();
/// <summary> Setter nasledujuceho prvku zretazeneho zoznamu. </summary>
/// <param name´= "next"> Novy nasledujuci prvok zretazeneho zoznamu. </param>
void setNext(ObojZretLinkedListItem<T>* next);
/// <summary> Setter predchadzajuceho prvku zretazeneho zoznamu. </summary>
/// <param name´= "next"> Novy predchadzajuci prvok zretazeneho zoznamu. </param>
void setPrevious(ObojZretLinkedListItem<T>* previous);
private:
/// <summary> Nasledujuci prvok zretazeneho zoznamu. </summary>
ObojZretLinkedListItem<T>* next_;
/// <summary> Predchadzajuci prvok zretazeneho zoznamu. </summary>
ObojZretLinkedListItem<T>* previous_;
};
/// <summary> Jednostranne zretazeny zoznam. </summary>
/// <typeparam name = "T"> Typ dat ukladanych v zozname. </typepram>
template<typename T>
class ObojZretLinkedList : public List<T>
{
public:
/// <summary> Konstruktor. </summary>
ObojZretLinkedList();
/// <summary> Kopirovaci konstruktor. </summary>
/// <param name = "other"> LinkedList, z ktoreho sa prevezmu vlastnosti. </param>
ObojZretLinkedList(const ObojZretLinkedList<T>& other);
/// <summary> Destruktor. </summary>
~ObojZretLinkedList();
/// <summary> Operacia klonovania. Vytvori a vrati duplikat zoznamu. </summary>
/// <returns> Ukazovatel na klon struktury. </returns>
Structure* clone() const override;
/// <summary> Vrati pocet prvkov v zozname. </summary>
/// <returns> Pocet prvkov v zozname. </returns>
size_t size() const override;
/// <summary> Operator priradenia. </summary>
/// <param name = "other"> Zoznam, z ktoreho ma prebrat vlastnosti. </param>
/// <returns> Adresa, na ktorej sa tento zoznam nachadza po priradeni. </returns>
List<T>& operator=(const List<T>& other) override;
/// <summary> Operator priradenia. </summary>
/// <param name = "other"> Zoznam, z ktoreho ma prebrat vlastnosti. </param>
/// <returns> Adresa, na ktorej sa tento zoznam nachadza po priradeni. </returns>
ObojZretLinkedList<T>& operator=(const ObojZretLinkedList<T>& other);
/// <summary> Vrati adresou prvok na indexe. </summary>
/// <param name = "index"> Index prvku. </param>
/// <returns> Adresa prvku na danom indexe. </returns>
/// <exception cref="std::out_of_range"> Vyhodena, ak index nepatri do zoznamu. </exception>
T& operator[](const int index) override;
/// <summary> Vrati hodnotou prvok na indexe. </summary>
/// <param name = "index"> Index prvku. </param>
/// <returns> Hodnota prvku na danom indexe. </returns>
/// <exception cref="std::out_of_range"> Vyhodena, ak index nepatri do zoznamu. </exception>
const T operator[](const int index) const override;
/// <summary> Prida prvok do zoznamu. </summary>
/// <param name = "data"> Pridavany prvok. </param>
void add(const T& data) override;
/// <summary> Vlozi prvok do zoznamu na dany index. </summary>
/// <param name = "data"> Pridavany prvok. </param>
/// <param name = "index"> Index prvku. </param>
/// <exception cref="std::out_of_range"> Vyhodena, ak index nepatri do zoznamu. </exception>
/// <remarks> Ak je ako index zadana hodnota poctu prvkov (teda prvy neplatny index), metoda insert sa sprava ako metoda add. </remarks>
void insert(const T& data, const int index) override;
/// <summary> Odstrani prvy vyskyt prvku zo zoznamu. </summary>
/// <param name = "data"> Odstranovany prvok. </param>
/// <returns> true, ak sa podarilo prvok zo zoznamu odobrat, false inak. </returns>
bool tryRemove(const T& data) override;
/// <summary> Odstrani zo zoznamu prvok na danom indexe. </summary>
/// <param name = "index"> Index prvku. </param>
/// <returns> Odstraneny prvok. </returns>
/// <exception cref="std::out_of_range"> Vyhodena, ak index nepatri do zoznamu. </exception>
T removeAt(const int index) override;
/// <summary> Vrati index prveho vyskytu prvku v zozname. </summary>
/// <param name = "data"> Prvok, ktoreho index sa hlada. </param>
/// <returns> Index prveho vyskytu prvku v zozname, ak sa prvok v zozname nenachadza, vrati -1. </returns>
int getIndexOf(const T& data) override;
/// <summary> Vymaze zoznam. </summary>
void clear() override;
/// <summary> Vrati skutocny iterator na zaciatok struktury </summary>
/// <returns> Iterator na zaciatok struktury. </returns>
/// <remarks> Zabezpecuje polymorfizmus. </remarks>
Iterator<T>* getBeginIterator() const override;
/// <summary> Vrati skutocny iterator na koniec struktury </summary>
/// <returns> Iterator na koniec struktury. </returns>
/// <remarks> Zabezpecuje polymorfizmus. </remarks>
Iterator<T>* getEndIterator() const override;
private:
/// <summary> Pocet prvkov v zozname. </summary>
size_t size_;
/// <summary> Prvy prvok zoznamu. </summary>
ObojZretLinkedListItem<T>* first_;
/// <summary> Posledny prvok zoznamu. </summary>
ObojZretLinkedListItem<T>* last_;
private:
/// <summary> Vrati prvok zoznamu na danom indexe. </summary>
/// <param name = "index"> Pozadovany index. </summary>
/// <returns> Prvok zoznamu na danom indexe. </param>
/// <exception cref="std::out_of_range"> Vyhodena, ak index nepatri do zoznamu. </exception>
ObojZretLinkedListItem<T>* getItemAtIndex(int index) const;
};
template<typename T>
inline ObojZretLinkedListItem<T>::ObojZretLinkedListItem(T data) :
DataItem<T>(data),
next_(nullptr),
previous_(nullptr)
{
}
template<typename T>
inline ObojZretLinkedListItem<T>::ObojZretLinkedListItem(const ObojZretLinkedListItem<T>& other) :
DataItem<T>(other),
next_(other.next_),
previous_(other.previous_)
{
}
template<typename T>
inline ObojZretLinkedListItem<T>::~ObojZretLinkedListItem()
{
next_ = nullptr;
previous_ = nullptr;
}
template<typename T>
inline ObojZretLinkedListItem<T>* ObojZretLinkedListItem<T>::getNext()
{
return next_;
}
template<typename T>
inline ObojZretLinkedListItem<T>* ObojZretLinkedListItem<T>::getPrevious()
{
return previous_;
}
template<typename T>
inline void ObojZretLinkedListItem<T>::setNext(ObojZretLinkedListItem<T>* next)
{
next_ = next;
}
template<typename T>
inline void ObojZretLinkedListItem<T>::setPrevious(ObojZretLinkedListItem<T>* previous)
{
previous_ = previous;
}
template<typename T>
inline ObojZretLinkedList<T>::ObojZretLinkedList() :
List<T>(),
size_(0),
first_(nullptr),
last_(nullptr)
{
}
template<typename T>
inline ObojZretLinkedList<T>::ObojZretLinkedList(const ObojZretLinkedList<T>& other)
{
*this = other;
}
template<typename T>
inline ObojZretLinkedList<T>::~ObojZretLinkedList()
{
clear();
}
template<typename T>
inline Structure* ObojZretLinkedList<T>::clone() const
{
return new ObojZretLinkedList<T>(*this);
}
template<typename T>
inline size_t ObojZretLinkedList<T>::size() const
{
return size_;
}
template<typename T>
inline List<T>& ObojZretLinkedList<T>::operator=(const List<T>& other)
{
if (this != &other)
{
*this = dynamic_cast<const ObojZretLinkedList<T>&>(other);
}
return *this;
}
template<typename T>
inline ObojZretLinkedList<T>& ObojZretLinkedList<T>::operator=(const ObojZretLinkedList<T>& other)
{
if (this != &other)
{
clear();
ObojZretLinkedListItem<T>* pom = other.first_;
bool hasNext = true;
while (hasNext)
{
add(pom->accessData()); //takymto sposobom si naplnam zoznam
pom = pom->getNext(); // idem na dalsieho
if (pom == nullptr) {
//cout << "Presiel som pri kopirovani dobre " << endl;
hasNext = false;; // ak uz nema dalsieho tak sa prestane vykonavat
}
}
}
return *this;
}
template<typename T>
inline T& ObojZretLinkedList<T>::operator[](const int index)
{
DSRoutines::rangeCheckExcept(index, size_, "DoubleLinkedList<T>::operator[]: Invalid index.");
ObojZretLinkedListItem <T>* item = getItemAtIndex(index);
return item->accessData();
}
template<typename T>
inline const T ObojZretLinkedList<T>::operator[](const int index) const
{
DSRoutines::rangeCheckExcept(index, size_, "DoubleLinkedList<T>::operator[]: Invalid index.");
ObojZretLinkedListItem <T>* item = getItemAtIndex(index);
return item->accessData();
}
template<typename T>
inline void ObojZretLinkedList<T>::add(const T& data)
{
ObojZretLinkedListItem <T>* newItem = new ObojZretLinkedListItem<T>(data);
if (size_ == 0)
{
first_ = newItem;
last_ = newItem;
}
else {
last_->setNext(newItem);
newItem->setPrevious(last_);
last_ = newItem;
}
size_++;
}
template<typename T>
inline void ObojZretLinkedList<T>::insert(const T& data, const int index)
{
if (index == static_cast<int>(size_)) //prazdny zoznam
{
this->add(data);
}
else
{
DSRoutines::rangeCheckExcept(index, size_ + 1, "Invalid index in ObojZretLinkedList!");
ObojZretLinkedListItem<T>* newItem = new ObojZretLinkedListItem<T>(data);
if (index == 0) //prvy prvok
{
newItem->setNext(first_);
first_->setPrevious(newItem);
first_ = newItem;
}
else//Tu uz mam vylucene ze je to prvy alebo posledny prvok
//cachrovanie s prvkami, rozpajanie zoznamu, pridanie prvku a zase spojenie ho do kopy
{
ObojZretLinkedListItem<T>* nextItem;
ObojZretLinkedListItem<T>* previousItem;
if (index < static_cast<int>(size_) / 2)// prva polka zoznamu
{
nextItem = this->getItemAtIndex(index - 1);
previousItem = nextItem->getNext();
}
else// druha polka zoznamu
{
previousItem = this->getItemAtIndex(index);
nextItem = previousItem->getPrevious();
}
nextItem->setNext(newItem);
newItem->setNext(previousItem);
previousItem->setPrevious(newItem);
newItem->setPrevious(nextItem);
}
size_++;
}
}
template<typename T>
inline bool ObojZretLinkedList<T>::tryRemove(const T& data)
{
int index = getIndexOf(data);
if (index < 0)
{
return false;
}
removeAt(index);
return true;
}
template<typename T>
inline T ObojZretLinkedList<T>::removeAt(const int index)
{
DSRoutines::rangeCheckExcept(index, size_, "Invalid index in ObojZretLinkedList!");
ObojZretLinkedListItem<T>* delItem;
if (size_ == 1) { // || size_ == last_
delItem = first_;
first_ = nullptr;
last_ = nullptr;
}
else {
if (index == 0) { // prvy item
delItem = first_;
first_ = first_->getNext();
first_->setPrevious(nullptr);
}
else if (index == size_ - 1)//posledny item
{
delItem = last_;
last_ = last_->getPrevious();
last_->setNext(nullptr);
}
else { //Tu uz mam vylucene ze je to prvy alebo posledny prvok
ObojZretLinkedListItem<T>* previousItem;
ObojZretLinkedListItem<T>* nextItem;
if (index < static_cast<int>(size_) / 2) //prva polka zoznamu
{
previousItem = this->getItemAtIndex(index - 1);
delItem = previousItem->getNext();
nextItem = delItem->getNext();
}
else // druha polka zoznamu
{
nextItem = this->getItemAtIndex(index + 1);
delItem = nextItem->getPrevious();
previousItem = delItem->getPrevious();
}
previousItem->setNext(nextItem);
nextItem->setPrevious(previousItem);
}
}
T result = delItem->accessData();
delete delItem;
size_--; // ten item sa v skutocnosti nedeletne ale uz k nemu nemame pristup, potom ho len prepiseme ked bude treba
return result;
}
template<typename T>
inline int ObojZretLinkedList<T>::getIndexOf(const T& data)
{
ObojZretLinkedListItem<T>* result = first_;
int index = 0;
while (result != nullptr) {
if (result->accessData() == data)// just btw accessData sa nachadza v DataItem, cpp nam umoznuje dedit viacero krat
{
return index;
}
index++;
result = result->getNext();
cout << "Tu sa sekam " << endl;
}
return -1;
}
template<typename T>
inline void ObojZretLinkedList<T>::clear()
{
if (size_ != 0)
{
ObojZretLinkedListItem<T>* delItem = first_;
while (delItem != nullptr) {
first_ = delItem->getNext();
delete delItem;
delItem = first_;
}
size_ = 0;
first_ = nullptr;
last_ = nullptr;
}
}
template<typename T>
inline Iterator<T>* ObojZretLinkedList<T>::getBeginIterator() const
{
throw std::exception("ImplicitStack<T>::operator=: Not implemented yet.");
}
template<typename T>
inline Iterator<T>* ObojZretLinkedList<T>::getEndIterator() const
{
throw std::exception("ImplicitStack<T>::operator=: Not implemented yet.");
}
template<typename T>
inline ObojZretLinkedListItem<T>* ObojZretLinkedList<T>::getItemAtIndex(int index) const
{
DSRoutines::rangeCheckExcept(index, size_, "Invalid index in ObojZretLinkedList!");
if (index < static_cast<int>(size_) / 2) // prva polka zoznamu
{
ObojZretLinkedListItem<T>* item = first_;
for (int i = 0; i < index; i++)
{
item = item->getNext();
}
return item;
}
else // druha polka zoznamu
{
ObojZretLinkedListItem<T>* item = last_;
for (size_t i = 0; i < size_ - 1 - index; i++)
{
item = item->getPrevious();
}
return item;
}
}
} | [
"grexa.patrik1@gmail.com"
] | grexa.patrik1@gmail.com |
2466b594cc17789bff1f605b737fb7f10608ff77 | 75d2330d43c186f08bef17b4274e97b5401cce61 | /BNDS_NOIP/2016.09.07/A1.cpp | 50790b3e2ac09fd987022e3c9317379fccbe4019 | [] | no_license | AD1024/Algo-Practice | 709d89d0c301d0f798cab316a9fdb436ad9de642 | 6d0efa62859aea9798fc78c5c78b8394ac480972 | refs/heads/master | 2021-01-12T06:36:18.289920 | 2018-04-23T01:02:46 | 2018-04-23T01:02:46 | 77,384,339 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 822 | cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <stack>
using namespace std;
//#define OJ
#define eps 1e-5
int depth;
double target;
double ABS(double x){
return x>0?x:-x;
}
stack<int> ans;
bool f(int dep,double sum,int idx){
if(dep==depth){
if(ABS(target-sum)<eps){
return true;
}else return false;
}else{
int gap=(depth-dep)/(target-sum);
while(idx<=gap){
if(f(dep+1,sum+1.0/idx,idx+1)){
ans.push(idx);
return true;
}
++idx;
}
}
return false;
}
int main(){
#ifdef OJ
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
double a,b;
cin>>a>>b;
target=a/b;
depth=1;
while(!f(0,0.0,(int)(1.0/target)+1)) ++depth;
while(ans.size()){
printf("%d ",ans.top());
ans.pop();
}
#ifdef OJ
fclose(stdin);
fclose(stdout);
#endif
return 0;
} | [
"ccoderad@gmail.com"
] | ccoderad@gmail.com |
9e106c871e2fd496dcfb5fa1ab7c870a3e01e996 | 2648197438b4af567172abcb781ab423c2df9f3e | /app_sdk/protocol/sdk_pro.h | e66bce3c0a5fe5549baf6e306974da21fe54b952 | [
"MIT"
] | permissive | 7956968/NIM_PC_Demo | 44d69d9845153492c589523b671092ab68b50c64 | dd3e90828db635136f9b132df76d6682b9b00a87 | refs/heads/master | 2020-07-03T21:41:49.795460 | 2019-08-01T11:24:11 | 2019-08-01T11:24:11 | 202,057,885 | 0 | 1 | null | 2019-08-13T03:35:50 | 2019-08-13T03:35:49 | null | GB18030 | C++ | false | false | 4,553 | h | #pragma once
#include "base/http/http_protocol_interface_define.h"
namespace app_sdk
{
/** @class SDK_PRO
* @brief app_sdk 协议定义
* @copyright (c) 2018, NetEase Inc. All rights reserved
* @date 2018/4/26
*/
class SDK_PRO
{
private:
/** @class ResponseBase
* @brief app_sdk 应答基类
* @copyright (c) 2018, NetEase Inc. All rights reserved
* @date 2018/4/26
*/
class ResponseBase : public IHttpResponse
{
public:
ResponseBase() = default;
virtual ~ResponseBase() = default;
//解析应答数据
virtual void Parse(const std::string& response) override;
//获取原始应答数据
std::string GetReplyContent() const;
//获取协议定义的业务返回码
virtual int32_t GetProtocolReplyCode() const;
protected:
virtual void OnParse(const std::string& response);
void SetProtocolReplyCode(int code);
private:
std::string reply_content_;//应答原始数据
int32_t pro_reply_code_;//业务返回码
};
/** @class RequestBase
* @brief app_sdk 请求基类
* @copyright (c) 2018, NetEase Inc. All rights reserved
* @date 2018/4/26
*/
class RequestBase : public IHttpRequest
{
public:
RequestBase() = default;
virtual ~RequestBase() = default;
virtual std::string GetAPIURL() const override;
virtual bool UsePostMethod() const override;
virtual void GetRequestContent(std::string& content) const override;
virtual void GetRequestHead(std::map<std::string, std::string>& heads) override;
protected:
virtual bool IsUsePostMethod() const;
virtual void OnGetRequestContent(std::string& content) const;
//获取请求的连接地址,可以直接返回,或者由OnGetHost与OnGetApi拼起来,可以参考示例程序
virtual std::string OnGetAPIURL() const;
virtual std::string OnGetHost() const;
virtual std::string OnGetAPI() const;
virtual void OnGetRequestHead(std::map<std::string, std::string>& heads) const;
private:
mutable std::string app_url_;
};
//注册账号请求/应答
class RegisterAccountRequest : public RequestBase
{
public:
RegisterAccountRequest(std::string username, std::string password, std::string nickname);
protected:
virtual std::string OnGetHost() const override;
virtual std::string OnGetAPI() const override;
virtual void OnGetRequestHead(std::map<std::string, std::string>& heads) const override;
virtual void OnGetRequestContent(std::string& content) const override;
public:
std::string username_;
std::string password_;
std::string nickname_;
};
class RegisterAccountResponse : public ResponseBase
{
protected:
virtual void OnParse(const std::string& response) override;
public:
std::string err_msg_;
};
//获取聊天室列表请求/应答
class GetChatroomListRequest : public RequestBase
{
protected:
virtual std::string OnGetAPIURL() const;
virtual std::string OnGetAPI() const override;
virtual bool IsUsePostMethod() const override;
};
class GetChatroomListResponse : public ResponseBase
{
protected:
virtual void OnParse(const std::string& response) override;
public:
std::vector<nim_chatroom::ChatRoomInfo> chatroom_list_;
};
//获取聊天室连接地址请求/应答
class GetChatroomAddressRequest : public RequestBase
{
public:
GetChatroomAddressRequest();
protected:
virtual std::string OnGetAPIURL() const;
virtual std::string OnGetAPI() const override;
virtual void OnGetRequestContent(std::string& content) const override;
public:
__int64 room_id_;
std::string uid_;
int type_;
};
class GetChatroomAddressResponse : public ResponseBase
{
protected:
virtual void OnParse(const std::string& response) override;
public:
std::list<std::string> address_; /**< 聊天室地址,地址通过应用服务器接口获取 */
};
public:
/****************************对外暴露定义*****************************/
//注册账号请求/应答
using RegisterAccountReq = TSharedHttpRequest<RegisterAccountRequest>;
using RegisterAccountRsp = TSharedHttpResponse<RegisterAccountResponse>;
//获取聊天室列表请求/应答
using GetChatroomListReq = TSharedHttpRequest<GetChatroomListRequest>;
using GetChatroomListRsp = TSharedHttpResponse<GetChatroomListResponse>;
//获取聊天室列表请求/应答
using GetChatroomAddressReq = TSharedHttpRequest<GetChatroomAddressRequest>;
using GetChatroomAddressRsp = TSharedHttpResponse<GetChatroomAddressResponse>;
};
}
using app_sdk_pro = app_sdk::SDK_PRO; | [
"cqu227hk@163.com"
] | cqu227hk@163.com |
2b7a83193f84dabbb8a2267419c725383ce59256 | 30a9b10558e71bf05128c2aff3eee23298ebcbe4 | /external/asio/include/asio/detail/impl/handler_tracking.ipp | 915f9d74a0a904775bcf2db9c47a1d70d94f4c4d | [
"BSL-1.0"
] | permissive | obergner/wally-io | e404718ddc585cedfd31cbcf720f143280d0b798 | ece72f22f24c7b91dc6338be18c1cf8c766a7acc | refs/heads/master | 2020-04-12T06:41:17.001595 | 2020-02-02T17:21:02 | 2020-02-02T17:21:02 | 37,421,244 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,171 | ipp | //
// detail/impl/handler_tracking.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef ASIO_DETAIL_IMPL_HANDLER_TRACKING_IPP
#define ASIO_DETAIL_IMPL_HANDLER_TRACKING_IPP
#if defined( _MSC_VER ) && ( _MSC_VER >= 1200 )
#pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include "asio/detail/config.hpp"
#if defined( ASIO_ENABLE_HANDLER_TRACKING )
#include "asio/detail/handler_tracking.hpp"
#include <cstdarg>
#include <cstdio>
#if defined( ASIO_HAS_BOOST_DATE_TIME )
#include "asio/time_traits.hpp"
#else // defined(ASIO_HAS_BOOST_DATE_TIME)
#if defined( ASIO_HAS_STD_CHRONO )
#include <chrono>
#elif defined( ASIO_HAS_BOOST_CHRONO )
#include <boost/chrono/system_clocks.hpp>
#endif
#include "asio/detail/chrono_time_traits.hpp"
#include "asio/wait_traits.hpp"
#endif // defined(ASIO_HAS_BOOST_DATE_TIME)
#if !defined( ASIO_WINDOWS )
#include <unistd.h>
#endif // !defined(ASIO_WINDOWS)
#include "asio/detail/push_options.hpp"
namespace asio
{
namespace detail
{
struct handler_tracking_timestamp
{
uint64_t seconds;
uint64_t microseconds;
handler_tracking_timestamp( )
{
#if defined( ASIO_HAS_BOOST_DATE_TIME )
boost::posix_time::ptime epoch( boost::gregorian::date( 1970, 1, 1 ) );
boost::posix_time::time_duration now = boost::posix_time::microsec_clock::universal_time( ) - epoch;
#elif defined( ASIO_HAS_STD_CHRONO )
typedef chrono_time_traits<std::chrono::system_clock, asio::wait_traits<std::chrono::system_clock>>
traits_helper;
traits_helper::posix_time_duration now( std::chrono::system_clock::now( ).time_since_epoch( ) );
#elif defined( ASIO_HAS_BOOST_CHRONO )
typedef chrono_time_traits<boost::chrono::system_clock, asio::wait_traits<boost::chrono::system_clock>>
traits_helper;
traits_helper::posix_time_duration now( boost::chrono::system_clock::now( ).time_since_epoch( ) );
#endif
seconds = static_cast<uint64_t>( now.total_seconds( ) );
microseconds = static_cast<uint64_t>( now.total_microseconds( ) % 1000000 );
}
};
struct handler_tracking::tracking_state
{
static_mutex mutex_;
uint64_t next_id_;
tss_ptr<completion>* current_completion_;
};
handler_tracking::tracking_state* handler_tracking::get_state( )
{
static tracking_state state = {ASIO_STATIC_MUTEX_INIT, 1, 0};
return &state;
}
void handler_tracking::init( )
{
static tracking_state* state = get_state( );
state->mutex_.init( );
static_mutex::scoped_lock lock( state->mutex_ );
if ( state->current_completion_ == 0 )
state->current_completion_ = new tss_ptr<completion>;
}
void handler_tracking::creation( handler_tracking::tracked_handler* h,
const char* object_type,
void* object,
const char* op_name )
{
static tracking_state* state = get_state( );
static_mutex::scoped_lock lock( state->mutex_ );
h->id_ = state->next_id_++;
lock.unlock( );
handler_tracking_timestamp timestamp;
uint64_t current_id = 0;
if ( completion* current_completion = *state->current_completion_ )
current_id = current_completion->id_;
write_line(
#if defined( ASIO_WINDOWS )
"@asio|%I64u.%06I64u|%I64u*%I64u|%.20s@%p.%.50s\n",
#else // defined(ASIO_WINDOWS)
"@asio|%llu.%06llu|%llu*%llu|%.20s@%p.%.50s\n",
#endif // defined(ASIO_WINDOWS)
timestamp.seconds, timestamp.microseconds, current_id, h->id_, object_type, object, op_name );
}
handler_tracking::completion::completion( handler_tracking::tracked_handler* h )
: id_( h->id_ ), invoked_( false ), next_( *get_state( )->current_completion_ )
{
*get_state( )->current_completion_ = this;
}
handler_tracking::completion::~completion( )
{
if ( id_ )
{
handler_tracking_timestamp timestamp;
write_line(
#if defined( ASIO_WINDOWS )
"@asio|%I64u.%06I64u|%c%I64u|\n",
#else // defined(ASIO_WINDOWS)
"@asio|%llu.%06llu|%c%llu|\n",
#endif // defined(ASIO_WINDOWS)
timestamp.seconds, timestamp.microseconds, invoked_ ? '!' : '~', id_ );
}
*get_state( )->current_completion_ = next_;
}
void handler_tracking::completion::invocation_begin( )
{
handler_tracking_timestamp timestamp;
write_line(
#if defined( ASIO_WINDOWS )
"@asio|%I64u.%06I64u|>%I64u|\n",
#else // defined(ASIO_WINDOWS)
"@asio|%llu.%06llu|>%llu|\n",
#endif // defined(ASIO_WINDOWS)
timestamp.seconds, timestamp.microseconds, id_ );
invoked_ = true;
}
void handler_tracking::completion::invocation_begin( const asio::error_code& ec )
{
handler_tracking_timestamp timestamp;
write_line(
#if defined( ASIO_WINDOWS )
"@asio|%I64u.%06I64u|>%I64u|ec=%.20s:%d\n",
#else // defined(ASIO_WINDOWS)
"@asio|%llu.%06llu|>%llu|ec=%.20s:%d\n",
#endif // defined(ASIO_WINDOWS)
timestamp.seconds, timestamp.microseconds, id_, ec.category( ).name( ), ec.value( ) );
invoked_ = true;
}
void handler_tracking::completion::invocation_begin( const asio::error_code& ec, std::size_t bytes_transferred )
{
handler_tracking_timestamp timestamp;
write_line(
#if defined( ASIO_WINDOWS )
"@asio|%I64u.%06I64u|>%I64u|ec=%.20s:%d,bytes_transferred=%I64u\n",
#else // defined(ASIO_WINDOWS)
"@asio|%llu.%06llu|>%llu|ec=%.20s:%d,bytes_transferred=%llu\n",
#endif // defined(ASIO_WINDOWS)
timestamp.seconds, timestamp.microseconds, id_, ec.category( ).name( ), ec.value( ),
static_cast<uint64_t>( bytes_transferred ) );
invoked_ = true;
}
void handler_tracking::completion::invocation_begin( const asio::error_code& ec, int signal_number )
{
handler_tracking_timestamp timestamp;
write_line(
#if defined( ASIO_WINDOWS )
"@asio|%I64u.%06I64u|>%I64u|ec=%.20s:%d,signal_number=%d\n",
#else // defined(ASIO_WINDOWS)
"@asio|%llu.%06llu|>%llu|ec=%.20s:%d,signal_number=%d\n",
#endif // defined(ASIO_WINDOWS)
timestamp.seconds, timestamp.microseconds, id_, ec.category( ).name( ), ec.value( ), signal_number );
invoked_ = true;
}
void handler_tracking::completion::invocation_begin( const asio::error_code& ec, const char* arg )
{
handler_tracking_timestamp timestamp;
write_line(
#if defined( ASIO_WINDOWS )
"@asio|%I64u.%06I64u|>%I64u|ec=%.20s:%d,%.50s\n",
#else // defined(ASIO_WINDOWS)
"@asio|%llu.%06llu|>%llu|ec=%.20s:%d,%.50s\n",
#endif // defined(ASIO_WINDOWS)
timestamp.seconds, timestamp.microseconds, id_, ec.category( ).name( ), ec.value( ), arg );
invoked_ = true;
}
void handler_tracking::completion::invocation_end( )
{
if ( id_ )
{
handler_tracking_timestamp timestamp;
write_line(
#if defined( ASIO_WINDOWS )
"@asio|%I64u.%06I64u|<%I64u|\n",
#else // defined(ASIO_WINDOWS)
"@asio|%llu.%06llu|<%llu|\n",
#endif // defined(ASIO_WINDOWS)
timestamp.seconds, timestamp.microseconds, id_ );
id_ = 0;
}
}
void handler_tracking::operation( const char* object_type, void* object, const char* op_name )
{
static tracking_state* state = get_state( );
handler_tracking_timestamp timestamp;
unsigned long long current_id = 0;
if ( completion* current_completion = *state->current_completion_ )
current_id = current_completion->id_;
write_line(
#if defined( ASIO_WINDOWS )
"@asio|%I64u.%06I64u|%I64u|%.20s@%p.%.50s\n",
#else // defined(ASIO_WINDOWS)
"@asio|%llu.%06llu|%llu|%.20s@%p.%.50s\n",
#endif // defined(ASIO_WINDOWS)
timestamp.seconds, timestamp.microseconds, current_id, object_type, object, op_name );
}
void handler_tracking::write_line( const char* format, ... )
{
using namespace std; // For sprintf (or equivalent).
va_list args;
va_start( args, format );
char line[256] = "";
#if defined( ASIO_HAS_SECURE_RTL )
int length = vsprintf_s( line, sizeof( line ), format, args );
#else // defined(ASIO_HAS_SECURE_RTL)
int length = vsprintf( line, format, args );
#endif // defined(ASIO_HAS_SECURE_RTL)
va_end( args );
#if defined( ASIO_WINDOWS )
HANDLE stderr_handle = ::GetStdHandle( STD_ERROR_HANDLE );
DWORD bytes_written = 0;
::WriteFile( stderr_handle, line, length, &bytes_written, 0 );
#else // defined(ASIO_WINDOWS)
::write( STDERR_FILENO, line, length );
#endif // defined(ASIO_WINDOWS)
}
} // namespace detail
} // namespace asio
#include "asio/detail/pop_options.hpp"
#endif // defined(ASIO_ENABLE_HANDLER_TRACKING)
#endif // ASIO_DETAIL_IMPL_HANDLER_TRACKING_IPP
| [
"olaf.bergner@gmx.de"
] | olaf.bergner@gmx.de |
76c23b5506a78c4afd622748913faa20f4182a3d | 7cb43fd70b2b0c51c6d14be144df8ce0b1b7f40c | /Vector3 class test/main.cpp | 5004516e793d23cb844c0fd34677268642720ed3 | [] | no_license | tidus9000/BasicRaytracer | f1e11a418521588f9a10d015bfb67a6892d7e2a5 | 46283e6cf495743ec8dda68dcd2355a7d5c3f632 | refs/heads/master | 2021-07-21T14:25:26.912166 | 2017-10-31T17:35:06 | 2017-10-31T17:35:06 | 109,030,166 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,227 | cpp | #include "Vector3.h"
#include "Ray.h"
#include "Sphere.h"
#include "LightSource.h"
#include <iostream>
#include <fstream>
int main()
{
Ray::color outputColor;
Vector3 newvector(1, 2, 3);
Vector3 secondVector(-2, 1, -3);
Vector3 crossedVector;
int imageWidth = 255;
int imageHeight = 255;
newvector.print();
std::cout << "\nHello\n";
secondVector.print();
std::cout << "\nCross Product:\n";
crossedVector = newvector.crossProduct(secondVector);
crossedVector.print();
float dotProduct = newvector.dotProduct(secondVector);
std::cout << "\nDot Product:\n";
std::cout << dotProduct << std::endl;
int numberOfSpheres = 2;
Ray* testRay;
Sphere* sphereArray = new Sphere[numberOfSpheres];
sphereArray[0] = Sphere(15, 3, 3, 1, 0, 0, 255);
sphereArray[1] = Sphere(15, 3, -3, 1, 255, 255, 0);
std::ofstream img("picture14.png");
img << "P3" << std::endl;
img << imageWidth << " " << imageHeight << std::endl;
img << "255" << std::endl;
float planeWidth = 7, planeHeight = 7;
double widthIncrement = planeWidth / imageWidth;
double heightIncrement = planeHeight / imageHeight;
std::cout << "Drawing...\n";
for (float i = 0 + (planeHeight / 2); i > 0 - (planeHeight / 2); i = i - heightIncrement)
{
for (float j = 0 - (planeWidth / 2); j < (planeWidth / 2); j = j + widthIncrement)
{
testRay = new Ray(Vector3(0, 0, 0), Vector3(13, i, j));
bool anyIntersection = false;
for (int sphereInc = 0; sphereInc < numberOfSpheres; sphereInc++)
{
if (testRay->checkCollisionSphere(sphereArray[sphereInc], &outputColor))
{
//std::cout << "Ray (" << "1.5, " << i << ", " << j << ") collides with sphere!\n";
//std::cout << "*";
//img << 0 << " " << 0 << " " << 255 << std::endl;
anyIntersection = true;
}
else
{
//std::cout << "Ray (" << "1.5, " << i << ", " << j << ") doesn't collide with sphere\n";
//std::cout << ".";
//img << 0 << " " << 0 << " " << 0 << std::endl;
}
}
if (anyIntersection)
{
img << outputColor.r << " " << outputColor.g << " " << outputColor.b << std::endl;
}
else
{
img << 0 << " " << 0 << " " << 0 << std::endl;
}
delete testRay;
}
std::cout << std::endl;
}
return 0;
} | [
"tidus9000@gmail.com"
] | tidus9000@gmail.com |
0e2c8ca83cdf8d287d20abf9903e6c07f64822ae | 3b26427a5afe4bd4fa50875dbec7996a8c9d8f62 | /catkin_ws/src/emergency_stop_for_tests/src/emergency_activation_for_tests.cpp | daf74816791499194422ff355d1991bece6f9583 | [] | no_license | Anton1B/Base_mobile_MaD | 26ca8854863fa30ef7db582aed4e62fb35409178 | 46a1cda6167e40c5203bb865802edcca1a4c8263 | refs/heads/main | 2023-08-14T21:07:48.631852 | 2021-09-13T12:50:19 | 2021-09-13T12:50:19 | 373,205,357 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,212 | cpp | #include <ros/ros.h>
#include "std_msgs/Bool.h"
#include "std_msgs/String.h"
#include "std_msgs/Int32.h"
#include <pthread.h>
#include <iostream>
static volatile bool keep_running = true;
static void *userInput_thread(void *)
{
while (keep_running)
{
if (std::cin.get() != '\0')
{
//Si on a une interruption au clavier
system("rosnode kill turtlebot3_teleop_keyboard");
keep_running = false;
}
}
}
int main(int argc, char **argv)
{
// Initialisation du noeud
ros::init(argc, argv, "emergency_activation_for_tests");
ros::NodeHandle nh;
ros::Publisher client_pub = nh.advertise<std_msgs::String>("client", 1);
// Publication sur le topic /motor_power sur lequel le noeud va publier l'information oour arrêter les moteurs dynamixel
ros::Publisher activ_pub = nh.advertise<std_msgs::Bool>("motor_power", 1);
ros::Rate loop_rate(10);
std_msgs::String message;
std_msgs::Bool etat_moteurs;
int flag = 0; //Test pour la publication des messages
// Création d'un vecteur qui va prendre la liste des noeuds en cours d'utilisation
std::vector<std::string> V;
std::vector<std::string>::iterator it;
ros::master::getNodes(V);
bool alive = false;
bool docking = false;
it = V.begin();
// On va regarder si le noeud /noeud battery_monitoring est vivant, si ce n'est pas le cas alors cela signifie que l'on doit redémarrer /simple_navigation_goals
for (it = V.begin(); it < V.end(); it++)
{
if (*it == "/battery_monitoring")
{
alive = true;
}
if (*it == "/ar_track_alvar")
{
docking = true;
}
}
while (ros::ok)
{
if (flag == 2) //Pourquoi 2 ? Je ne sais pas, avec 1 cela ne suffisait pas
{
ROS_INFO("\nReactivation des moteurs en cours\n");
message.data = "Les moteurs du robot ont été réactivés, vous pouvez utiliser le clavier pour commander\n";
client_pub.publish(message);
break;
}
etat_moteurs.data = true;
activ_pub.publish(etat_moteurs);
ros::Duration(2).sleep();
flag++;
ros::spinOnce();
}
ROS_INFO("\nLa commande au clavier va s'activer\n");
system("gnome-terminal -x roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch");
ROS_INFO("\nRelancer les nodes en appuyant sur une touche du clavier puis Enter \n");
pthread_t tId;
(void)pthread_create(&tId, 0, userInput_thread, 0);
while (keep_running)
{
}
(void)pthread_join(tId, NULL);
ros::spinOnce();
ROS_INFO("\nRéactivation des fonctionnalités en cours\n");
message.data = "La reactivation des fonctionnalites du robot est en cours";
client_pub.publish(message);
if (alive == true)
{
system("gnome-terminal -x rosrun simple_navigation_goals simple_navigation_goals");
}
if (docking == true)
{
system("gnome-terminal -x rosrun turtlebot3_automatic_parking_vision automatic_parking_vision");
}
//system("gnome-terminal -x roslaunch emergency_stop activ_arm.launch");
return 0;
}
| [
"betaille.antonin@gmail.com"
] | betaille.antonin@gmail.com |
80d665403ef9fa46d861f8b98f060de755ebd070 | 9f65b341f176aead0aa6f3de881db793ced46a9d | /cpp/SUBP.cpp | 8c0858b8c003486161bd6db9800cc84394c21277 | [] | no_license | itsjustwinds/study-path | 2e66c0d85a431983e60ffde126131cb3dd8e865b | 5bfd3cc1c4d3f0b20c2bbc852f43dfbf3d726507 | refs/heads/master | 2020-05-30T07:51:30.320218 | 2020-04-05T11:29:02 | 2020-04-05T11:29:02 | 189,585,900 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 787 | cpp | #include<bits/stdc++.h>
#define maxn 10005
using namespace std;
char s[maxn];
int n,f[maxn][maxn],res;
bool check(int i,int j)
{
int sum=0;
int minn=1e9;
for (int k=i;k<=j;++k)
{
if (s[k]=='(') sum++;
else sum--;
minn=min(minn,sum);
}
return (sum==0&&minn>=0);
}
int main()
{
freopen("SUBP.inp","r",stdin);
freopen("SUBP.out","w",stdout);
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>(s+1);
n=strlen(s+1);
for (int i=1;i<=n;++i)
for (int j=i+1;j<=n;j+=2)
if (check(i,j))
{
res=max(res,j-i+1);
}
cout<<res;
return 0;
}
| [
"hminhhuy2000@gmail.com"
] | hminhhuy2000@gmail.com |
85f00c2cc4351b83a350838d6080c2eb1854cbcd | 1ec534b06cf2136313fea924151debb5aaa90c8a | /WindowedMeasuresQueue.cpp | 0be93260925b7beeb857bce41f87b0268a3e143b | [] | no_license | Nachiket18/WindowMeasures | 4d9247216697955b8099ca0fce3969cce1eb9f7d | ddd766db5e0f2e028fcc2e76c16764e849c4a324 | refs/heads/master | 2022-12-04T23:41:16.995733 | 2020-08-16T13:54:39 | 2020-08-16T13:54:39 | 273,708,420 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,581 | cpp |
#include <deque>
#include <iostream>
using namespace std;
void calcWindowMeasureswithQueue(int arr[], int temp[], int window, int n) {
deque<int> holder;
deque<int>::iterator it;
int k = 0;
/* Stage 1 - We calculate the maximum value during first window elements.
The dequeue structure works - if the current element is greater
than holder.back() then we pop it otherwise insert it at back.
*/
holder.push_back(0);
for (int i = 1; i < window; i++) {
for (it = holder.end(); it != holder.begin(); --it) {
if (arr[i] > arr[holder.back()] && !holder.empty())
holder.pop_back();
else {
holder.push_back(i);
break;
}
}
}
/* Code used while testing
for (it = holder.begin(); it != holder.end(); ++it){
cout << '\t' << *it;
}
*/
/* In second stage of algorithm
1. We add the value present at deque.front to temp array(output array)
From element at index at window we perform
2. If element(contains index of the input array) at front of queue is out
of the window of the element being scanned then we remove it (window has
shifted ahead than max element calculated).
3. If the element (contains index of the input array ) at back is lesser
than that of element being scanned, we pop it. We break the loop once such
element is found
*/
k = window - 1;
temp[k] = arr[holder.front()];
k++;
for (int i = window; i < n; i++) {
// printing the largest element of the previous window before moving forward
deque<int>::iterator it1;
deque<int>::iterator it2;
for (it1 = holder.begin(); it1 != holder.end(); ++it1) {
if (holder.front() < i - (window - 1)) {
holder.pop_front();
} else
break;
}
for (it2 = holder.end(); it2 != holder.begin(); --it2) {
if (arr[holder.back()] < arr[i]) {
holder.pop_back();
} else
break;
}
holder.push_back(i);
temp[k] = arr[holder.front()];
k++;
}
for (int i = window - 1; i < n; i++) {
cout << temp[i] << '\t';
}
}
int main() {
int window;
int n;
cout << "Please enter the number of elements";
cin >> n;
int arr[n];
int temp[n];
cout << "Please enter the array for windowed measures" << endl;
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
cout << "Please enter the window" << endl;
cin >> window;
calcWindowMeasureswithQueue(arr, temp, window, n);
}
| [
"noreply@github.com"
] | noreply@github.com |
d7761e555c7be75731c6c3d30c6cffa4ab1f9210 | c9aba59915a4c1e406593f3f6fc0344cec5913ad | /include/kernel/ioport.hpp | 148c916e8315c0692f55648a524661fc5b981418 | [
"MIT"
] | permissive | xlauko/bootable-thingy | d713bafa851be8d8b75556b181c270ed017f9c94 | 1e91c2178a224b872775d7f973bde5f7806ef595 | refs/heads/master | 2021-04-26T22:30:20.649433 | 2018-08-21T23:51:55 | 2018-08-21T23:51:55 | 124,102,666 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 589 | hpp | #pragma once
#include <cstdint>
namespace kernel::dev {
static inline uint8_t inb( int port ) {
int ret;
asm volatile ("xorl %eax,%eax");
asm volatile ("inb %%dx,%%al":"=a" (ret):"d"(port));
return ret;
}
static inline void outb( uint16_t port, uint8_t data ) {
asm volatile ("outb %0, %1" : : "a"(data), "Nd"(port));
}
static inline uint16_t inw( int port ) {
int ret;
asm volatile ("xorl %eax,%eax");
asm volatile ("inw %%dx,%%ax":"=a" (ret):"d"(port));
return ret;
}
} //namespace hw
| [
"xlauko@mail.muni.cz"
] | xlauko@mail.muni.cz |
cd6a0fa6527052dfe6183c4f70354afe9ac346f6 | edaba67044ef3c9dc52ec12c7a4968921e551498 | /light1236.cpp | a4c116660999bf90eee67fb5ce1659fddf3a3765 | [] | no_license | JahedulKaderForman/LightOj-Problem-Solution | 9fe839c668a522b21ac5d2c728c16d0c848b4bdb | bac2f85815497e8c6697087092ea3c06ffc91549 | refs/heads/master | 2020-03-26T11:24:16.507907 | 2018-08-19T19:08:17 | 2018-08-19T19:08:17 | 144,841,102 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,106 | cpp | #include <bits/stdc++.h>
using namespace std;
#define isc(a) scanf("%d", &a)
#define llsc(a) scanf("%lld", &a)
#define casepf(a) printf("Case %d: ", a)
typedef long long int ll;
typedef unsigned long long ull;
/// Memory Efficient Sieve by bitset ***given maximum memory limit 32MB
#define m 10000009
bitset<10000013>bs;
int p[777777],x;
void seive(){
bs.set();
bs[0]=0;
bs[1]=0;
x=0;
for(ll i=2;i<m;i++){
if(bs[i]==1){
for(ll j=i*i;j<m;j+=i){
bs[j]=0;
}
p[x]=(int)i;
x++;
}
}
}
/// primefactorization and formula of number of all pair lcm ((2*e1+1)*(2*e2+1)....*(2*e^n+1))+1 / 2
ll factor(ll n){
ll temp=sqrt(n)+1;
ll ans=1;
for(int i=0;p[i]<=temp && i<x;i++){
int e=0;
if(n%p[i]==0){
while(n%p[i]==0){
n/=p[i];
e++;
}
ans*=(2*e)+1;
temp=sqrt(n); /// reduce time complexity
}
}
if(n>1){
ans*=(2*1)+1;
}
return ans+1;
}
int main(){
int t;
ll x,res;
isc(t);
seive();
for(int i=1;i<=t;i++){
llsc(x);
res=factor(x);
res=res/2;
printf("Case %d: %lld\n",i,res);
}
}
| [
"formankhan2014@gmail.com"
] | formankhan2014@gmail.com |
142667443fcb355521548af8be8a8fb9fd2ea850 | ab1c643f224197ca8c44ebd562953f0984df321e | /services/sched/svc_core/task.hxx | b79bff12a5373ef79757822e4c99b8b572604d07 | [] | no_license | KernelPanic-OpenSource/Win2K3_NT_admin | e162e0452fb2067f0675745f2273d5c569798709 | d36e522f16bd866384bec440517f954a1a5c4a4d | refs/heads/master | 2023-04-12T13:25:45.807158 | 2021-04-13T16:33:59 | 2021-04-13T16:33:59 | 357,613,696 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,617 | hxx | //+---------------------------------------------------------------------------
//
// Microsoft Windows
// Copyright (C) Microsoft Corporation, 1992 - 1993.
//
// File: task.hxx
//
// Contents: CTask class definition.
//
// Classes: CTask
//
// Functions: None.
//
// History: 25-Oct-95 MarkBl Created
//
//----------------------------------------------------------------------------
#ifndef __TASK_HXX__
#define __TASK_HXX__
//+---------------------------------------------------------------------------
//
// Class: CTask
//
// Synopsis: Classes inherit from this for task abstraction.
//
// History: 6-Apr-95 MarkBl Created
//
// Notes: None.
//
//----------------------------------------------------------------------------
//
// Task status flag values.
//
#define TASK_STATUS_UNSERVICED 0x00
#define TASK_STATUS_IN_SERVICE 0x01
class CTask
{
public:
CTask(VOID) : _cReferences(1), _rgfStatus(0) { TRACE3(CTask, CTask); }
virtual ~CTask() { TRACE3(CTask, ~CTask); }
virtual void PerformTask(void) = 0;
BOOL IsInService(void) {
return(_rgfStatus & TASK_STATUS_IN_SERVICE ? TRUE : FALSE);
}
void InService(void) {
_rgfStatus |= TASK_STATUS_IN_SERVICE;
}
void UnServiced(void) {
_rgfStatus &= ~TASK_STATUS_IN_SERVICE;
}
ULONG AddRef(void);
ULONG Release(void);
//
// Be *extremely* careful with this member!
//
ULONG GetReferenceCount() { return(_cReferences); }
private:
ULONG _cReferences;
BYTE _rgfStatus;
};
#endif // __TASK_HXX__
| [
"polarisdp@gmail.com"
] | polarisdp@gmail.com |
b33c8b7dc4c046bfad838b6375341092f158388c | e70bc6102caecb60a35327c567ac43b661c2c5ad | /经典问题/全排列的非递归(下一个全排列).cpp | bc09bbfb181c00f733c7ae151bcd4819fdb758d1 | [] | no_license | heroinetty/ACM | 3a4a64e608e3b15c3ac8801c2c2c3467649b1cf4 | 8df4132cbac404d16b335a7a4fd02b44a3b252e9 | refs/heads/master | 2020-03-21T01:59:11.508034 | 2018-11-08T14:29:16 | 2018-11-08T14:29:16 | 137,973,109 | 0 | 1 | null | null | null | null | GB18030 | C++ | false | false | 1,397 | cpp | // 起点:字典序最小的全排列,例如12345
// 终点:过程 从当前排列生成字典序刚好比它大的下一个全排列
// 如:21543的下一个排列是23145
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;
char str[] = "926520";
void swap(char *a, char *b)
{
char temp = *a;
*a = *b;
*b = temp;
}
// 反转区间
void Reverse(char *a, char *b)
{
while(a < b)
swap(a ++, b --);
}
// 下一个全排列
bool Next_permutation(char a[])
{
char *pEnd = a + strlen(a);
if(a == pEnd) return false;
char *p, *q, *pFind;
pEnd --;
p = pEnd;
while(p != a)
{
q = p;
--p;
if(*p < *q) // 从降序的相邻的2数,前一个数即替换数
{
// 从反向前找比替换点大的第一个数
pFind = pEnd;
while(*pFind <= *p) --pFind;
// 替换
swap(pFind, p);
// 替换点后的数全部反转
Reverse(q, pEnd);
return true;
}
}
Reverse(p, pEnd);// 没有下一个全排列 ,全部反转后返回true;
return false;
}
int main()
{
puts(str);
if(Next_permutation(str))// if(next_permutation(str, str + 6))
puts(str);
else puts("Oh, no!");
return 0;
}
| [
"noreply@github.com"
] | noreply@github.com |
0d8544564dfd23abb287a9e693497c9b2aa31b62 | be7bcea8dd27a3c5c520bfc5c5d68c79db6690eb | /derivative.hpp | aaceb5ba2ccbfabf8c5e204e2a579b0c6de3d390 | [] | no_license | jyotirmoy16/neural-nets | 3ab03826fe53098e6f3164e2e6d916ec6b11e4ff | 8fab873e49c96941ed43ed9cbb1e2ed115f229db | refs/heads/master | 2020-04-14T00:14:20.040228 | 2018-12-29T21:03:35 | 2018-12-29T21:03:35 | 163,528,530 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 177 | hpp | #ifndef derivative_hpp
#define derivative_hpp
namespace derviative{
namespace activation{
}
namespace weight{
}
namespace biases{
}
}
#endif | [
"Jyotirmoy.Pain@oyorooms.com"
] | Jyotirmoy.Pain@oyorooms.com |
3b22bcaf549e1bf7dcd94663e8379c3d368e80da | ef7b70b62476c407320d570645393b9fe52a7cdb | /cs_1124/rec05/labs.cpp | 8e838b91a0aeb58b6adbf3d5f8b6667f9f5f8100 | [] | no_license | Abd-Elrazek/CPlusPractice | e4363fef0a6aaedf0f625feb9f9c7c8f8aed157d | b6d2b518e70d3d4d8b49e0edb4fbd587d1cfc627 | refs/heads/master | 2020-04-18T10:31:42.545902 | 2018-11-21T06:12:44 | 2018-11-21T06:12:44 | 167,469,961 | 1 | 0 | null | 2019-01-25T02:13:52 | 2019-01-25T02:13:52 | null | UTF-8 | C++ | false | false | 4,477 | cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
class TimeSlot {
public:
TimeSlot(const string& _day, int _time) : day(_day), time(_time) {}
void display() {
cout << day << " " << time << endl;
}
private:
string day;
int time;
};
class Student {
public:
Student(const string& _name) : name(_name), grades(13, -1) {}
string getName() {
return name;
}
void setGrade(int grade, int week) {
grades[week] = grade;
}
void display() {
cout << "Student: " << name << "; Grades: ";
for (int i = 0; i < grades.size(); i++) {
cout << grades[i] << " ";
}
cout << "\n";
}
private:
string name;
vector<int> grades;
};
class Section {
public:
Section(const string& _section, const string& _day, int _time) : section(_section), timeslot(TimeSlot(_day, _time)) {}
void addGrade(const string& studentName, int grade, int week) {
for (int i = 0; i < students.size(); i++) {
if (students[i]->getName() == studentName) {
students[i]->setGrade(grade, week);
}
}
}
void addStudent(const string& name) {
Student* student = new Student(name);
students.push_back(student);
}
void display() {
cout << "Section: " << section << "; ";
timeslot.display();
}
void displayStudents() {
for (int i = 0; i < students.size(); i++) {
students[i]->display();
}
}
void reset() {
for (int i = 0; i < students.size(); i++) {
delete students[i];
}
students.clear();
}
private:
string section;
TimeSlot timeslot;
vector<Student*> students;
};
class LabWorker {
public:
LabWorker(const string& _name) : name(_name), section(nullptr) {}
void addSection(Section& _section) {
*section = _section;
}
void addGrade(const string& studentName, int grade, int week) {
section->addGrade(studentName, grade, week);
}
void displayGrades() {
cout << name << " has ";
section->display();
}
private:
string name;
Section* section;
};
int main() {
// lab workers
LabWorker moe( "Moe" );
LabWorker jane( "Jane" );
// sections and setup and testing
Section secA2( "A2", "Tuesday", 16 );
//secA2.loadStudentsFromFile( "A2.txt" );
secA2.addStudent("John");
secA2.addStudent("George");
secA2.addStudent("Paul");
secA2.addStudent("Ringo");
cout << "\ntest A2\n"; // here the modeler-programmer checks that load worked
secA2.display(); // YOU'll DO THIS LATER AS: cout << secA2 << endl;
moe.addSection( secA2 );
moe.displayGrades(); // here the modeler-programmer checks that adding the Section worked
Section secB3( "B3", "Thursday", 11 );
//secB3.loadStudentsFromFile( "B3.txt" );
secB3.addStudent("Thorin");
secB3.addStudent("Dwalin");
secB3.addStudent("Balin");
secB3.addStudent("Kili");
secB3.addStudent("Fili");
secB3.addStudent("Dori");
secB3.addStudent("Nori");
secB3.addStudent("Ori");
secB3.addStudent("Oin");
secB3.addStudent("Gloin");
secB3.addStudent("Bifur");
secB3.addStudent("Bofur");
secB3.addStudent("Bombur");
cout << "\ntest B3\n"; // here the modeler-programmer checks that load worked
secB3.display(); // YOU'll DO THIS LATER AS: cout << secB3 << endl;
jane.addSection( secB3 );
jane.displayGrades(); // here the modeler-programmer checks that adding Instructor worked
// setup is complete, now a real world scenario can be written in the code
// [NOTE: the modeler-programmer is only modeling joe's actions for the rest of the program]
// week one activities
cout << "\nModeling week: 1\n";
moe.addGrade( "John", 7, 1 );
moe.addGrade( "Paul", 9, 1 );
moe.addGrade( "George", 7, 1 );
moe.addGrade( "Ringo", 7, 1 );
cout << "End of week one\n";
moe.displayGrades();
// week two activities
cout << "\nModeling week: 2\n";
moe.addGrade( "John", 5, 2 );
moe.addGrade( "Paul", 10, 2 );
moe.addGrade( "Ringo", 0, 2 );
cout << "End of week two\n";
moe.displayGrades();
//test that reset works // NOTE: can we check that the heap data was dealt with?
cout << "\ntesting reset()\n";
secA2.reset();
secA2.display();
moe.displayGrades();
} // main
| [
"chrislegolife@gmail.com"
] | chrislegolife@gmail.com |
572c97060ea0479cacb8c25b36e089b90dcc7751 | bbcbb3a228c523751b51ccd62e8ea0f73fd64a3d | /lab5_q10.cpp | 8d31862605b6966ffd8d852c26188ec787dbf8ad | [] | no_license | debankit/cs141 | 9e43dbe46cd0d318f8ff2f6da3c7548b52f77fb6 | 9dceec608cc36596e63be0d5e9430866a8e0183d | refs/heads/master | 2020-03-25T17:49:10.470767 | 2018-10-12T05:21:47 | 2018-10-12T05:21:47 | 143,997,719 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 432 | cpp | #include<iostream>
using namespace std;
//main function
int main()
{
//declaring variables
char a;
//asking the user to enter an alphabet
cout<< "Enter an alphabet"<< endl;
//storing the character
cin>>a;
//using conditional statement
if(65<=a && a<=90)
{
cout<< a<<" is a uppercase alphabet "<<endl;
}
else if(97<=a && a<=122)
{
cout<<a<<" is a lowercase alphabet"<<endl;
}
else
cout<<" not valid input";
}
| [
"noreply@github.com"
] | noreply@github.com |
7039dbc5433ebfcf9f1cccf4edf8cf95a8480917 | eaa64a4b73fe76125d34177c33e1aadedfaf4e46 | /src/videocapture/RotateBy180DegreesSampleConverter.cpp | 4c3d42353f019af604996614fd203834cfcc75e5 | [
"Apache-2.0"
] | permissive | brianfcoleman/libvideocapture | 1d856f3f8658a7d834fad5d094927783092897bc | 3357c0d31603c94890960676a38253275a52c1b3 | refs/heads/master | 2020-04-28T01:55:24.483921 | 2010-10-10T20:23:32 | 2010-10-10T20:23:32 | 35,434,467 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,524 | cpp | #include "RotateBy180DegreesSampleConverter.hpp"
namespace VideoCapture {
RotateBy180DegreesSampleConverter::RotateBy180DegreesSampleConverter() {
}
RGBVideoFormat RotateBy180DegreesSampleConverter::convertedSampleFormat(
RGBVideoFormat inputSampleFormat) const {
if (!inputSampleFormat) {
return inputSampleFormat;
}
boost::int32_t angleRotationDegrees(inputSampleFormat.angleRotationDegrees());
angleRotationDegrees = (angleRotationDegrees + kAngleHalfRotationDegrees);
angleRotationDegrees = (angleRotationDegrees % kAngleFullRotationDegrees);
RGBVideoFormat outputSampleFormat(
inputSampleFormat.uuid(),
inputSampleFormat.sizePixels(),
angleRotationDegrees,
inputSampleFormat.rgbFormat());
return outputSampleFormat;
}
void RotateBy180DegreesSampleConverter::convertSample(
RGBVideoSampleRef inputSample,
RGBVideoSampleRef outputSample) const {
typedef RGBVideoFrame::ImageViewType ImageViewType;
typedef RGBVideoSample::SampleDataSharedPtr SampleDataSharedPtr;
if (!inputSample) {
return;
}
if (!outputSample) {
return;
}
SampleDataSharedPtr pInputSample(inputSample.sampleData());
SampleDataSharedPtr pOutputSample(outputSample.sampleData());
ImageViewType inputImageView(pInputSample->imageView());
ImageViewType outputImageView(pOutputSample->imageView());
boost::gil::copy_pixels(
boost::gil::rotated180_view(inputImageView),
outputImageView);
}
} // VideoCapture
| [
"brianfcoleman@gmail.com"
] | brianfcoleman@gmail.com |
43b5d7b4604f895d668b719239246b7449d5dbd2 | dcced388ee83ff57a270f115757f46bdf5bd3868 | /ezEnrollment/ezEnrollment-MEDS/AdvancePCS/Recap2/Recap2/include/client/FileMatrix.h | 05ead63bbc614d0f4ee874893418b3e7f1e3f52e | [] | no_license | VB6Hobbyst7/vault_repo | a6aebc1dfd9f9f111b21829d92c5f8bdde80d068 | e6f074bfcf04c6a7598edd43f0cbef3ed4c50d01 | refs/heads/master | 2021-12-03T21:58:16.422079 | 2014-11-19T13:23:08 | 2014-11-19T13:23:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 405 | h | #ifndef ___FILE_MATRIX___
#define ___FILE_MATRIX___
#include "Matrix.h"
#define DEFAULT_LINE_SEPARATOR "\n"
class FileMatrix : public StringMatrix {
public:
FileMatrix(wxString& filename,
int number = -1,
wxString& lineSeparator=wxString(DEFAULT_LINE_SEPARATOR),
wxString& colSeparator=wxString(DEFAULT_COLUMN_SEPARATOR));
};
#endif // ___FILE_MATRIX___ | [
"yaworsky@gmail.com"
] | yaworsky@gmail.com |
35beb56e2707f541047dbaf61d41eeac107a333c | 827a08f595f37e1d24c1ec3f8844842eeb0ee5a8 | /extensions/ringqt/codeeditor.cpp | b1e435cd17fb2aa5d014a1add7c26596d58c767a | [
"MIT"
] | permissive | moneytech/ring-lang | ad65e973c6fac4eed2721ee05298a3d7d432b599 | 808f3e5fb9bc0c6306c7803dc769c9e3a0f82ca2 | refs/heads/master | 2020-11-27T07:37:47.082894 | 2017-03-20T13:00:43 | 2017-03-20T13:00:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,677 | cpp | /****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
/*
File is modified to be merged with RingQt
Updated by : Mahmoud Fayed <msfclipper@yahoo.com>
Date : 2017.01.29
*/
#include <QtWidgets>
#include "codeeditor.h"
#include "ring.h"
CodeEditor::CodeEditor(QWidget *parent, VM *pVM) : GPlainTextEdit(parent,pVM) , c(0)
{
lineNumberArea = new LineNumberArea(this);
connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int)));
connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int)));
updateLineNumberAreaWidth(0);
}
int CodeEditor::lineNumberAreaWidth()
{
int digits = 1;
int max = qMax(1, blockCount());
while (max >= 10) {
max /= 10;
++digits;
}
int space = 3 + fontMetrics().width(QLatin1Char('9')) * digits;
return space*2;
}
void CodeEditor::updateLineNumberAreaWidth(int /* newBlockCount */)
{
setViewportMargins(lineNumberAreaWidth(), 0, 0, 0);
}
void CodeEditor::updateLineNumberArea(const QRect &rect, int dy)
{
if (dy)
lineNumberArea->scroll(0, dy);
else
lineNumberArea->update(0, rect.y(), lineNumberArea->width(), rect.height());
if (rect.contains(viewport()->rect()))
updateLineNumberAreaWidth(0);
}
void CodeEditor::resizeEvent(QResizeEvent *e)
{
QPlainTextEdit::resizeEvent(e);
QRect cr = contentsRect();
lineNumberArea->setGeometry(QRect(cr.left(), cr.top(), lineNumberAreaWidth(), cr.height()));
}
void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent *event)
{
QPainter painter(lineNumberArea);
QFont font = painter.font() ;
font.setPointSize(fontMetrics().height());
painter.setFont(font);
painter.fillRect(event->rect(), Qt::cyan);
QTextBlock block = firstVisibleBlock();
int blockNumber = block.blockNumber();
int top = (int) blockBoundingGeometry(block).translated(contentOffset()).top();
int bottom = top + (int) blockBoundingRect(block).height();
while (block.isValid() && top <= event->rect().bottom()) {
if (block.isVisible() && bottom >= event->rect().top()) {
QString number = QString::number(blockNumber + 1);
painter.setPen(Qt::black);
painter.drawText(0, top, lineNumberArea->width(), bottom-top,
Qt::AlignCenter, number);
}
block = block.next();
top = bottom;
bottom = top + (int) blockBoundingRect(block).height();
++blockNumber;
}
}
void CodeEditor::setCompleter(QCompleter *completer)
{
if (c) {
QObject::disconnect(c, 0, this, 0);
delete c;
}
c = completer;
if (!c)
return;
c->setWidget(this);
c->setCompletionMode(QCompleter::PopupCompletion);
c->setCaseSensitivity(Qt::CaseInsensitive);
QObject::connect(c, SIGNAL(activated(QString)),
this, SLOT(insertCompletion(QString)));
}
QCompleter *CodeEditor::completer() const
{
return c;
}
void CodeEditor::insertCompletion(const QString& completion)
{
if (c->widget() != this)
return;
QTextCursor tc = textCursor();
int extra = completion.length() - c->completionPrefix().length();
tc.movePosition(QTextCursor::Left);
tc.movePosition(QTextCursor::EndOfWord);
tc.insertText(completion.right(extra));
setTextCursor(tc);
}
QString CodeEditor::textUnderCursor() const
{
QTextCursor tc = textCursor();
tc.select(QTextCursor::WordUnderCursor);
return tc.selectedText();
}
void CodeEditor::focusInEvent(QFocusEvent *e)
{
if (c)
c->setWidget(this);
GPlainTextEdit::focusInEvent(e);
}
void CodeEditor::keyPressEvent(QKeyEvent *e)
{
if (c && c->popup()->isVisible()) {
// The following keys are forwarded by the completer to the widget
switch (e->key()) {
case Qt::Key_Enter:
case Qt::Key_Return:
case Qt::Key_Escape:
case Qt::Key_Tab:
case Qt::Key_Backtab:
e->ignore();
return; // let the completer do default behavior
default:
break;
}
}
bool isShortcut = ((e->modifiers() & Qt::ControlModifier) && e->key() == Qt::Key_E); // CTRL+E
if (!c || !isShortcut) // do not process the shortcut when we have a completer
GPlainTextEdit::keyPressEvent(e);
const bool ctrlOrShift = e->modifiers() & (Qt::ControlModifier | Qt::ShiftModifier);
if (!c || (ctrlOrShift && e->text().isEmpty()))
return;
static QString eow("~!#%^&*()+{}|:<>?,/;[]\\-="); // end of word
bool hasModifier = (e->modifiers() != Qt::NoModifier) && !ctrlOrShift;
QString completionPrefix = textUnderCursor();
if (!isShortcut && (hasModifier || e->text().isEmpty()|| completionPrefix.length() < 3
|| eow.contains(e->text().right(1)))) {
c->popup()->hide();
return;
}
if (completionPrefix != c->completionPrefix()) {
c->setCompletionPrefix(completionPrefix);
c->popup()->setCurrentIndex(c->completionModel()->index(0, 0));
}
QRect cr = cursorRect();
cr.setWidth(c->popup()->sizeHintForColumn(0)
+ c->popup()->verticalScrollBar()->sizeHint().width());
c->complete(cr); // popup it up!
} | [
"msfclipper@yahoo.com"
] | msfclipper@yahoo.com |
0dfc6725de155b3a22ede7d5d3dca0f6f7b54791 | 84a18c4777a6fc0d6832d0beaedd8bb38fd6e584 | /LOG/log.h | 07ccb43adbada714b7638b3ae5826c4242c12085 | [] | no_license | xxsong5/PrivateLibraries | 3654cf3c6600a33c5881749e102995e3d16fbb6b | 388332aa1e01ef2d288726bc8f39a4d664e76d60 | refs/heads/master | 2021-05-14T13:41:41.886723 | 2018-03-05T13:30:41 | 2018-03-05T13:30:41 | 116,445,773 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,899 | h | #ifndef __XUXIANSONG_LOGGER__
#define __XUXIANSONG_LOGGER__
#include <iostream>
#include <sstream>
#include <string>
#include <ctime>
#include <mutex>
#include <thread>
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
class Logger {
public:
static Logger* getInstance(){
std::lock_guard<std::mutex> lck(Logger::x_mutex);
if (NULL == Logger::pInstance){
Logger::pInstance = new Logger;
}
return Logger::pInstance;
}
static void destroyInstance(){
if (NULL != Logger::pInstance){
delete Logger::pInstance;
Logger::pInstance = NULL;
}
}
void Config(bool isToFile= false, std::string filePrefix="log"){
m_btoFile = isToFile;
m_filePrifix = filePrefix;
}
bool isWrite2File(){
return m_btoFile;
}
void write2File(std::string strlog){
if (access(m_logdir,R_OK|W_OK) < 0)
mkdir(m_logdir,S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
std::string fileName =std::string(m_logdir) + "/" + m_filePrifix + "_" + FNGenerator();
{//fresh
static int counts = 0;
++counts;
if (counts > 100){
counts = 0;
if (m_pfile){
fflush(m_pfile);
}
}
if (m_preFileName != fileName){
if (m_pfile){
fflush(m_pfile);
fclose(m_pfile);
m_pfile = NULL;
}
m_preFileName = m_preFileName != fileName ? fileName : m_preFileName;
}
}
if (NULL == m_pfile){
m_pfile = fopen(fileName.c_str(), "wb+");
}
if (NULL != m_pfile){
fwrite(strlog.c_str(), strlog.length(), 1, m_pfile);
}
}
std::mutex& getMutex(){
return Logger::x_mutex;
}
std::string gettid(){
char strIds[100] = {};
int pid = (int)getpid();
int tid = (int)syscall(__NR_gettid);
sprintf(strIds, "%08d@@%08d",pid, tid);
return std::string(strIds);
}
~Logger(){
if (m_pfile){
fflush(m_pfile);
fclose(m_pfile);
m_pfile = NULL;
}
}
private:
Logger(bool toFile = false, std::string filePrefix = "log"): m_btoFile(toFile),
m_logdir("LOG"), m_pfile(NULL), m_filePrifix(filePrefix), m_preFileName(""){ }
Logger(const Logger&) = delete;
Logger& operator = (const Logger &);
std::string FNGenerator(){
time_t rawtime;
struct tm *timeinfo;
char buffer[80];
time(&rawtime);
timeinfo = localtime(&rawtime);
strftime (buffer,80,"%F",timeinfo);
return std::string(buffer);
}
private:
static Logger *pInstance;
static std::mutex x_mutex;
bool m_btoFile;
const char *m_logdir;
FILE *m_pfile;
std::string m_filePrifix;
std::string m_preFileName;
};
#define __GREEN_COLOR__ "\033[1;32m"
#define __RED_COLOR__ "\033[1;31m"
#define __YELLOW_COLOR__ "\033[1;33m"
#define __CLOSE_COLOR__ "\033[0m"
#define LOGCONFIG(is2File, filePrefix) do { \
bool _2File = (bool)is2File; \
std::string fileP = std::string(filePrefix); \
Logger *_logger = Logger::getInstance(); \
_logger->Config(_2File, fileP); \
}while(0) \
#define LOGCFG(is2File) do { \
bool _2File = (bool)is2File; \
Logger *_logger = Logger::getInstance(); \
_logger->Config(_2File); \
}while(0) \
#define LOGINFO(astring) do{ \
Logger * _logger = Logger::getInstance(); \
if (_logger){ \
char headInfo[1000]={}; \
sprintf(headInfo, "[LOGINFO__%s__%s__%06d]:\t", _logger->gettid().c_str(), __FILE__, __LINE__); \
std::lock_guard<std::mutex> lck(_logger->getMutex()); \
if (!_logger->isWrite2File()) { \
std::cout << __GREEN_COLOR__ << std::string(headInfo) << astring << __CLOSE_COLOR__ << std::endl; \
}else { \
std::stringstream ss; \
ss << headInfo; \
ss << astring; \
ss << "\n"; \
_logger->write2File(ss.str()); \
} \
} \
}while(0) \
#define LOGWARN(astring) do{ \
Logger * _logger = Logger::getInstance(); \
if (_logger){ \
char headInfo[1000]={}; \
sprintf(headInfo, "[LOGWARN__%s__%s__%06d]:\t", _logger->gettid().c_str(), __FILE__, __LINE__); \
std::lock_guard<std::mutex> lck(_logger->getMutex()); \
if (!_logger->isWrite2File()) { \
std::cout << __YELLOW_COLOR__ << std::string(headInfo) << astring << __CLOSE_COLOR__ << std::endl; \
}else { \
std::stringstream ss; \
ss << headInfo; \
ss << astring; \
ss << "\n"; \
_logger->write2File(ss.str()); \
} \
} \
}while(0) \
#define LOGERROR(astring) do{ \
Logger * _logger = Logger::getInstance(); \
if (_logger){ \
char headInfo[1000]={}; \
sprintf(headInfo, "[LOGERROR__%s__%s__%06d]:\t", _logger->gettid().c_str(), __FILE__, __LINE__); \
std::lock_guard<std::mutex> lck(_logger->getMutex()); \
if (!_logger->isWrite2File()) { \
std::cout << __RED_COLOR__ << std::string(headInfo) << astring << __CLOSE_COLOR__ << std::endl; \
}else { \
std::stringstream ss; \
ss << headInfo; \
ss << astring; \
ss << "\n"; \
_logger->write2File(ss.str()); \
} \
} \
}while(0) \
#define LOGS \
Logger * _logger = Logger::getInstance(); \
char headInfo[1000] = {}; \
if (_logger) \
sprintf(headInfo, "[LOG__%s__%s__%06d]:\t", _logger->gettid().c_str(), __FILE__, __LINE__); \
std::cout << __GREEN_COLOR__ << std::string(headInfo)
#define LOGE \
__CLOSE_COLOR__ << std::endl;
#endif | [
"1519451737@qq.com"
] | 1519451737@qq.com |
20af92013e0210ff9a2a9d558845eb0fb32e740f | ed1b0c14f1c853db5d93af23009a0cd3f4696b65 | /src/gpunet/tx.cpp | e4e4097be01747fdd176fee93c3e20234673798a | [] | no_license | hibengler/hibs_stock_analysis | b19c23403762f81f3926f24cb8f3970fb3906e62 | 717952b63af942abcd31d3cf26ee14240798caa0 | refs/heads/master | 2021-07-23T00:28:19.033024 | 2014-12-20T16:52:45 | 2014-12-20T16:52:45 | 109,216,320 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,407 | cpp | #include "lwneuralnet.h"
#include <stdio.h>
#include "network.c"
void net_compute_fast(struct network_ts *net, const float *input, float *output);
float net_compute_output_error_fast(
struct network_ts *net, const float *target);
void net_train_fast(struct network_ts *net);
void net_learn_cycle_fast(
struct network_ts *net,
const float *input,
const float *target,
int loops,
int iterations,
int next_input_offset,
int next_output_offset,
int accuracy_start,
int accuracy_first_output,
int accuracy_skip_offset,
int no_accuracies
);
void net_learn_cycle(
struct network_ts *net,
const float *input,
const float *target,
int loops,
int iterations,
int next_input_offset,
int next_output_offset,
int accuracy_start,
int accuracy_first_output,
int accuracy_skip_offset,
int no_accuracies
);
void net_run_batch(
struct network_ts *net,
const float *input,
float *output,
float *accuracies,
int iterations,
int next_input_offset,
int next_output_offset,
int accuracy_start,
int no_accuracies
);
main() {
network_t *net,*net2;
int i;
float input[10000];
float output[10000];
float accuracies[10000];
float *target=input+6;
net = net_allocate(3,6,2000,2);
net2 = net_copy(net);
net_use_bias(net,1);
net_use_bias(net2,1);
for (i=0;i<10000;i++) {
input[i]=sin(((double)i)*.30);
output[i]=sin(((double)i)*.30);
}
/* set the weights by hand */
net_set_learning_rate(net,.001);
net_set_learning_rate(net2,.001);
net_learn_cycle_fast(net,input,target,10,2000
,1,1,
1,0,1,1);
net_run_batch(net,output,output+6,accuracies,50,1,1,1,1);
for (i=0;i<50;i++) {
printf("%d %3.2f %3.2f +-%f\n",i,input[i],output[i],accuracies[i]);
}
exit(0);
printf("fast is still %f %f %f %f\n",*output,output[1],output[2],output[3]);
net_learn_cycle(net2,input,target,100,20,1,1,2,0,1,2);
net_compute(net2,input,output);
printf("\nregular is %f %f %f %f\n",*output,output[1],output[2],output[3]);
exit(0);
for (i=1;i<2;i++) {
net_set_learning_rate(net,.0001);
net_set_learning_rate(net2,.0001);
// if ((i % 2) ==0) printf("\nrun on iteration %d is %f\n",i,*output);
net_compute(net,input,output);
if ((i % 99) ==0) printf("\nrun on iteration2 %d is %f\n",i,*output);
}
}
| [
"h@killercool.net"
] | h@killercool.net |
7958d5feecda933d57f6c7875bfc2093bec2f925 | a1696b6a4f65ede24dc5ab65586f1be3d83452df | /timed_killer-runner.cpp | a0f540b7cf133303267030b6e7b5405600c48525 | [] | no_license | Highstaker/Timed_killer-runner | 4677bac49df6bc84b67009f448da8c90bc585de4 | 81bd639343326bd3458ceb8161c2ab9c7b731777 | refs/heads/master | 2020-05-20T00:58:40.467294 | 2013-03-12T16:46:39 | 2013-03-12T16:46:39 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,491 | cpp | #include "timed_killer-runner.h"
//////////////////////
//////GLOBALS
/////////////////
int life_time = 5;
bool keypress_detected = false;
string programPath = "";
int kill_name_specified = 0;
string *killName;
bool input_detection = true;
///////////////////////
/////////MAIN//////////
//////////////////////
int main(int argc, char **argv)
{
option_reading(argc, argv);
display_opener();
screen_window_opener();
pid_t pid;
pid = launch_process(pid);
pthread_t keypress_detector;
pthread_create(&keypress_detector,NULL,&keypress_detector_function,NULL);
struct timeval start, end;
gettimeofday(&start, NULL);
gettimeofday(&end, NULL);
cout << endl;
while(true)
{
gettimeofday(&end, NULL);
printf("\033[A");
printf("seconds left: %d \n", life_time - (int)(end.tv_sec - start.tv_sec) );
if(keypress_detected)
{
gettimeofday(&start, NULL);
gettimeofday(&end, NULL);
keypress_detected =false;
//cerr << "keypress processed" << endl;//debug
}
if((end.tv_sec - start.tv_sec) > life_time)
{
gettimeofday(&start, NULL);
gettimeofday(&end, NULL);
cerr << "time up. Killing process " << pid << endl;//debug
//killing
if(!kill_name_specified)
kill_including_children(pid);
else
{
for(int i=0;i<kill_name_specified;i++)
{
string command = "killall ";
command += killName[i];
system(command.c_str());
}
}
pid = launch_process(pid);
}
sleep(1);
}
return 0;
}
void* keypress_detector_function(void* a)
{
if(input_detection)
{
while(true)
{
if(kbdActivity(display) || mouse_moved(display,frame_window))
{
keypress_detected = true;
//cerr << "keypress detected" << endl;//debug
}
usleep(100000);
}
}
else
{
while(true)
{
cin.ignore();//wait for keypress
keypress_detected = true;
cerr << "keypress detected" << endl;//debug
}
}
}
pid_t launch_process(pid_t pid)
{
pid = fork(); // Create a child process
switch (pid)
{
case -1: // Error
std::cerr << "fork() failed.\n";
exit(1);
case 0: // Child process - on sucess fork() returns PID in PARENT and 0 in child
execl(programPath.c_str(), "", (const char*)NULL); // Execute the program with no argumets in CHILD
std::cerr << "execl() failed!"; // execl doesn't return unless there's an error
exit(1);
default: // Parent process
std::cout << "Process created with pid " << pid << "\n";
}
return pid;
}
void timer_set_exit()
{
cerr<<"timer already set. exiting" << endl;
exit(1);
}
void option_reading(int argc, char **argv)
{
bool timer_set = false;
for(int i = 0; i<argc; i++)
{
if((string)argv[i] == "--no-input-detection")
{
input_detection = false;
}
if((string)argv[i] == "-stimer")
{
if(timer_set){timer_set_exit();}
i++;
life_time = atoi(argv[i]);
timer_set = true;
}
if((string)argv[i] == "-mtimer")
{
if(timer_set){timer_set_exit();}
i++;
life_time = atoi(argv[i])*60;
timer_set = true;
}
if((string)argv[i] == "-htimer")
{
if(timer_set){timer_set_exit();}
i++;
life_time = atoi(argv[i])*3600;
timer_set = true;
}
if((string)argv[i] == "-prog")
{
i++;
programPath = argv[i];
cerr << "path " << programPath << endl;//debug
}
if((string)argv[i] == "-killname")
{
//kill_name_specified = true;
i++; int j = 0;string killNametemp[1000];
while((string)argv[i] != "0")
{
cerr << argv[i] << endl;
killNametemp[j] = argv[i];
i++; j++;kill_name_specified++;
}
killName = new string[j];
for(int k =0; k<j; k++)
{
killName[k] = killNametemp[k];
}
}
}
}
void kill_including_children(pid_t pid)//not including children yet
{
kill(pid,SIGTERM);
}
void display_opener()
{
display = XOpenDisplay(NULL); if(display == NULL){printf("Can't open display. Keyboard and mouse movement detection will not be available.",0);}
}
void screen_window_opener()
{
XSetWindowAttributes frame_attributes;
XWindowAttributes window_attributes;
frame_attributes.override_redirect = true;
frame_attributes.background_pixel = XWhitePixel(display, 0);
XGetWindowAttributes(display, XRootWindow(display, 0), &window_attributes);
frame_window = XCreateWindow(display, XRootWindow(display, 0),
0,0, window_attributes.width, window_attributes.height, 0, DefaultDepth(display, 0),
InputOutput, DefaultVisual(display, 0), CWBackPixel|CWOverrideRedirect,
&frame_attributes);
}
int mouse_moved(Display *d, Window w)
{
bool query;
Window root, child;
int rootx, rooty, childx, childy;
unsigned int mask;
query = XQueryPointer(d, w , &root, &child, &rootx, &rooty, &childx, &childy, &mask);
if ((rootx == rootx_buf) && (rooty == rooty_buf))
{return false;}
else{rootx_buf = rootx; rooty_buf = rooty; return true;}
}//end mouse_moved
bool kbdActivity(Display* display) // checks for key presses
{char keymap[32];
XQueryKeymap(display, keymap); // asks x server for current keymap
for (int i=0; i<32; i++) // for 0 to 32 (keymap size)
{
if (prevKeymap[i] != keymap[i]) // if previous keymap does not
{ // equal current keymap
XQueryKeymap(display, prevKeymap); // ask for new keymap
return true; // exit with true
}
}
return false; // no change == no activity
}//KbdActivity | [
"heights999@yandex.ru"
] | heights999@yandex.ru |
6cbc894a16fc85478e8fb090bd21b81048792771 | 0148ee77ddc30b51cb4db85000a66a95b3d4ab28 | /sdk/foobar2000/SDK/track_property.h | 63c9959bca7b7ea1296b45bff14c09cfbfbf56a3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | AshkanRafiee/foo_scrobble | 5ffbbd5e5d1eb10c1e90479cc92cddfc6b05b8c4 | d8a212dd442906054c2ce9d3972d5efd45ea30bd | refs/heads/master | 2020-06-06T09:43:09.124931 | 2018-07-29T18:18:13 | 2018-07-29T18:18:13 | 192,704,548 | 1 | 0 | MIT | 2019-06-19T09:45:50 | 2019-06-19T09:45:49 | null | UTF-8 | C++ | false | false | 4,628 | h | //! Callback interface for track_property_provider::enumerate_properties().
class NOVTABLE track_property_callback {
public:
//! Sets a property list entry to display. Called by track_property_provider::enumerate_properties() implementation.
//! @param p_group Name of group to put the entry in, case-sensitive. Note that non-standard groups are sorted alphabetically.
//! @param p_sortpriority Sort priority of the property inside its group (smaller value means earlier in the list), pass 0 if you don't care (alphabetic order by name used when more than one item has same priority).
//! @param p_name Name of the property.
//! @param p_value Value of the property.
virtual void set_property(const char * p_group,double p_sortpriority,const char * p_name,const char * p_value) = 0;
protected:
track_property_callback() {}
~track_property_callback() {}
private:
track_property_callback(track_property_callback const &) = delete;
track_property_callback const & operator=(track_property_callback const &) = delete;
};
//! Extended version of track_property_callback
class NOVTABLE track_property_callback_v2 : public track_property_callback {
public:
//! Returns a boolean value indicating whether the specified group is wanted; can be used to suppress expensive processing of information that will not be actually shown. \n
//! See also set_property() p_group parameter.
virtual bool is_group_wanted(const char * p_group) = 0;
protected:
~track_property_callback_v2() {}
};
//! Service for adding custom entries in "Properties" tab of the properties dialog.
class NOVTABLE track_property_provider : public service_base {
public:
//! Enumerates properties of specified track list.
//! @param p_tracks List of tracks to enumerate properties on.
//! @param p_out Callback interface receiving enumerated properties.
virtual void enumerate_properties(metadb_handle_list_cref p_tracks, track_property_callback & p_out) = 0;
//! Returns whether specified tech info filed is processed by our service and should not be displayed among unknown fields.
//! @param p_name Name of tech info field being queried.
//! @returns True if the field is among fields processed by this track_property_provider implementation and should not be displayed among unknown fields, false otherwise.
virtual bool is_our_tech_info(const char * p_name) = 0;
FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(track_property_provider);
};
class NOVTABLE track_property_provider_v2 : public track_property_provider {
FB2K_MAKE_SERVICE_INTERFACE(track_property_provider_v2,track_property_provider)
public:
virtual void enumerate_properties_v2(metadb_handle_list_cref p_tracks, track_property_callback_v2 & p_out) = 0;
};
class NOVTABLE track_property_provider_v3_info_source {
public:
virtual metadb_info_container::ptr get_info(size_t index) = 0;
};
class track_property_provider_v3_info_source_impl : public track_property_provider_v3_info_source {
public:
track_property_provider_v3_info_source_impl(metadb_handle_list_cref items) : m_items(items) {}
metadb_info_container::ptr get_info(size_t index) {return m_items[index]->get_info_ref();}
private:
metadb_handle_list_cref m_items;
};
class track_property_callback_v2_proxy : public track_property_callback_v2 {
public:
track_property_callback_v2_proxy(track_property_callback & callback) : m_callback(callback) {}
void set_property(const char * p_group,double p_sortpriority,const char * p_name,const char * p_value) {m_callback.set_property(p_group, p_sortpriority, p_name, p_value);}
bool is_group_wanted(const char*) {return true;}
private:
track_property_callback & m_callback;
};
//! \since 1.3
class NOVTABLE track_property_provider_v3 : public track_property_provider_v2 {
FB2K_MAKE_SERVICE_INTERFACE(track_property_provider_v3,track_property_provider_v2)
public:
virtual void enumerate_properties_v3(metadb_handle_list_cref items, track_property_provider_v3_info_source & info, track_property_callback_v2 & callback) = 0;
void enumerate_properties(metadb_handle_list_cref p_tracks, track_property_callback & p_out) {track_property_provider_v3_info_source_impl src(p_tracks); track_property_callback_v2_proxy cb(p_out); enumerate_properties_v3(p_tracks, src, cb);}
void enumerate_properties_v2(metadb_handle_list_cref p_tracks, track_property_callback_v2 & p_out) {track_property_provider_v3_info_source_impl src(p_tracks); enumerate_properties_v3(p_tracks, src, p_out);}
};
template<typename T>
class track_property_provider_factory_t : public service_factory_single_t<T> {};
| [
"nico.rieck@gmail.com"
] | nico.rieck@gmail.com |
fd3d3198d12e61a8d91bc1032021dcc66915c1f9 | cd6c496ab6b7384d4b69d61d6dff2695b2f195af | /Projecte_Oficial_VERSIO 2019 NOMES PAU/ModuleIcoinScreen.cpp | ffcdf76006ba8facdaf09c0f72c09846283ba45b | [] | no_license | MarcArizaAlborni/Hit-The-Meat-Studio | 03ae1587644b4a65f97d8abdb1bb79aeccdf0c5e | 88a0e2c7ecc64c27593c970181cd6bac66787420 | refs/heads/master | 2021-06-15T09:48:03.290795 | 2021-06-06T20:06:31 | 2021-06-06T20:06:31 | 171,440,784 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,242 | cpp | #include "Globals.h"
#include "Application.h"
#include "SDL/include/SDL.h"
#include "SDL_image/include/SDL_image.h"
#include "ModuleTextures.h"
#include "ModuleRender.h"
#include "ModulePlayer.h"
#include "ModuleInput.h"
#include "ModuleFadeToBlack.h"
#include "MemLeaks.h"
#include "ModuleWelcomeScreen.h"
#include "ModuleIcoinScreen.h"
#include "ModuleStartScreen.h"
#include "Animation.h"
#include "ModuleSceneKen.h"
ModuleIcoinScreen::ModuleIcoinScreen()
{
icoin_screen.x = 0;
icoin_screen.y = 0;
icoin_screen.w = SCREEN_WIDTH;
icoin_screen.h = SCREEN_HEIGHT;
}
ModuleIcoinScreen::~ModuleIcoinScreen()
{
}
// Load assets
bool ModuleIcoinScreen::Start()
{
LOG("Loading Welcome screen");
graphics = App->textures->Load("StartScreenIII_II.png");
return true;
}
// UnLoad assets
bool ModuleIcoinScreen::CleanUp()
{
LOG("Unloading Introduce coin Screen");
App->textures->Unload(graphics);
return true;
}
// Update: draw background
update_status ModuleIcoinScreen::Update()
{
//Animation* current_animation = &idle;
App->render->Blit(graphics, 0, 0, &icoin_screen, 0.75f);
if (App->input->keyboard[SDL_SCANCODE_SPACE] == 1) {
App->fade->FadeToBlack(App->icoin_screen, App->scene_ken, 1.0f);
}
return UPDATE_CONTINUE;
} | [
"angotov@gmail.com"
] | angotov@gmail.com |
0e0bacce2f4a3b358dd2556cb261e407ed5a60aa | cd45522531371b0cd592353b16589095401cbddd | /파일처리/파일처리 과제 3/src/fixtext.h | 73a2eaa1ea962d75b85ade79d19a552c7a03c0e2 | [] | no_license | grachegrache/homeworks | 193c72760f328ca684a7f8a51eb98a2bd6addfa6 | 0ac6b4fe724c761cfe526ad7090e6ef5ee00db9f | refs/heads/master | 2020-04-11T08:43:07.631209 | 2017-07-01T09:46:13 | 2017-07-01T09:46:13 | 61,027,843 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,493 | h | // fixtext.h
// Copyright 1997, Gregory A. Riccardi
#ifndef FIXTEXT_H
#define FIXTEXT_H
#include "IOBuffer.h"
class FixedTextBuffer : public IOBuffer
// a buffer which holds a specific number of fixed sized text fields.
{
public:
FixedTextBuffer(int maxFields = 10, int maxChars = 1000); // construct with a maximum of maxFields
FixedTextBuffer(int numFields, int * FieldSize);
// construct with fields of specific size
int NumberOfFields() const; // return number of fields
void Clear(); // clear field values from buffer
int AddField(int fieldSize);
int Read(istream &);
int Write(ostream &) const;
int Pack(const char *, int size = -1); // set the value of the next field of the buffer;
int Unpack(char *); // extract the value of the next field of the buffer
void Print(ostream &) const;
int Init(int numFields, int maxChars = 1000);
int Init(int numFields, int * fieldSize);
private:
// char * Buffer; // character array to hold field values
// int BufferSize; // sum of the sizes of declared fields
int * FieldSize; // array to hold field sizes
int MaxFields; // maximum number of fields
int MaxChars; // maximum number of characters in the buffer
int NumFields; // actual number of defined fields
int NextField; // index of next field to be packed/unpacked
int NumFieldValues; // number of fields which are packed
int Packing; // TRUE if in packing phase, FALSE o/w
int NextCharacter; // packing/unpacking position in buffer
};
#endif
| [
"hoonse07@naver.com"
] | hoonse07@naver.com |
c60720cfc4bfdf3dc3a721b1efbab00d499aa0be | 8815b5e144c31e4b0bb74e36d412d82e162b1ba1 | /DJI_F550_Lights.ino | 00a8add1672d1e169262cd4b9934cb0a0bcae93b | [] | no_license | vonfrank/DJI_F550_Lights | bfe0d5d356d7a9dbe35e9ccf4d4d914c8ef463b4 | f80bbdd4d257d102d596cc4114421e6a3e49aa9a | refs/heads/master | 2021-01-12T12:12:39.320254 | 2016-10-30T17:10:40 | 2016-10-30T17:10:40 | 72,361,537 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,784 | ino | #include <Adafruit_NeoPixel.h>
//Constants
#define TRANSMITTER_PIN 2 //Transmitter
#define LIGHT_PIN_01 7 //Tail
#define LIGHT_PIN_02 8 //Center
#define LIGHT_PIN_03 9 //Front
#define ARRAY_SIZE 3 //Array size
//Variables
double channel_value;
Adafruit_NeoPixel neopixels[ARRAY_SIZE] = {Adafruit_NeoPixel(1, LIGHT_PIN_01, NEO_GRB + NEO_KHZ800), Adafruit_NeoPixel(1, LIGHT_PIN_02, NEO_GRB + NEO_KHZ800), Adafruit_NeoPixel(1, LIGHT_PIN_03, NEO_GRB + NEO_KHZ800)};
void setup() {
//Setup serial
Serial.begin(9600);
Serial.println("============================================================\n ______ ___ ___ _______ _______ _______ _______ \n| | | || | | || || || _ |\n| _ | | || | | ___|| ____|| ____|| | | |\n| | | | | || | | |___ | |____ | |____ | | | |\n| |_| | ___| || | | ___||_____ ||_____ || |_| |\n| || || | | | _____| | _____| || |\n|______| |_______||___| |___| |_______||_______||_______|\n ___ ___ _______ __ __ _______ _______ \n| | | || || | | || || | \n| | | || ___|| |_| ||_ _|| _____| \n| | | || | __ | | | | | |_____ \n| |___ | || || || | | | |_____ | \n| || || |_| || _ | | | _____| | \n|_______||___||_______||__| |__| |___| |_______| \n\n============================================================\n");
//Initialize transmitter
pinMode(TRANSMITTER_PIN, INPUT);
Serial.println("Transmitter has been initialized");
Serial.println("");
//Initialize NeoPixels
for(int i = 0; i < ARRAY_SIZE; i++){
neopixels[i].begin();
neopixels[i].show();
Serial.print("NeoPixel nr. ");
Serial.print(i);
Serial.println(" has been initialized");
}
Serial.println("");
SetModeOff();
}
void loop() {
channel_value = pulseIn(2, HIGH);
if(channel_value < 1250){
SetModeOff();
} else if(channel_value > 1250 && channel_value < 1750){
SetModePosHold();
} else if(channel_value > 1750){
SetModeRTL();
}
}
void ShowAll() {
for(int i = 0; i < ARRAY_SIZE; i++){
neopixels[i].show();
}
channel_value = pulseIn(2, HIGH);
}
void SetModeOff(){
Serial.println("Lights are OFF");
while(channel_value < 1250){
for(int i = 0; i < ARRAY_SIZE; i++){
neopixels[i].setPixelColor(0, 0, 0, 0);
}
ShowAll();
}
}
void SetModePosHold(){
Serial.println("Mode 2 is selected");
neopixels[0].setPixelColor(0, 0, 255, 0);
neopixels[1].setPixelColor(0, 0, 0, 0);
neopixels[2].setPixelColor(0, 255, 0, 0);
ShowAll();
while(channel_value > 1250 && channel_value < 1750){
delay(1000);
neopixels[1].setPixelColor(0, 255, 255, 255);
ShowAll();
delay(50);
neopixels[1].setPixelColor(0, 0, 0, 0);
ShowAll();
delay(100);
neopixels[1].setPixelColor(0, 255, 255, 255);
ShowAll();
delay(50);
neopixels[1].setPixelColor(0, 0, 0, 0);
ShowAll();
}
}
void SetModeRTL(){
Serial.println("Mode RTL is selected");
for(int i = 0; i < ARRAY_SIZE; i++){
neopixels[i].setPixelColor(0, 0, 0, 0);
}
ShowAll();
while(channel_value > 1750){
delay(1000);
for(int i = 0; i < ARRAY_SIZE; i++){
neopixels[i].setPixelColor(0, 255, 0, 0);
}
ShowAll();
delay(50);
for(int i = 0; i < ARRAY_SIZE; i++){
neopixels[i].setPixelColor(0, 0, 0, 0);
}
ShowAll();
delay(100);
for(int i = 0; i < ARRAY_SIZE; i++){
neopixels[i].setPixelColor(0, 255, 0, 0);
}
ShowAll();
delay(50);
for(int i = 0; i < ARRAY_SIZE; i++){
neopixels[i].setPixelColor(0, 0, 0, 0);
}
ShowAll();
}
}
| [
"henrik@vonfrank.dk"
] | henrik@vonfrank.dk |
c3ce91e6e86ea6f834605e73f7fd0877838ca50a | 1eff429522e7926cea640ff2cfef8946d6343e3b | /DP/perfect_square_279.cpp | 82af3ea796d25f93cfe7a2f00c460ba96f3b500d | [] | no_license | avishekkumar0204/leetcode-solutions | 8efdc740a3a1f74bd09ce1d9410dfb4df6d1a660 | 9e12fa5d86e11e0b44c50bcc3527222702d0861e | refs/heads/main | 2023-06-12T23:30:26.581950 | 2021-07-05T06:21:16 | 2021-07-05T06:21:16 | 355,780,798 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 443 | cpp | class Solution
{
public:
#define maxSize 10005
int numSquares(int n)
{
int minNumber[maxSize];
minNumber[0] = 0, minNumber[1] = 1;
for (int i = 2; i < maxSize; i++)
{
minNumber[i] = INT_MAX;
for (int j = 1; j * j <= i; j++)
minNumber[i] = min(minNumber[i - j * j], minNumber[i]);
minNumber[i]++;
}
return minNumber[n];
}
}; | [
"kumaravishek84@gmail.com"
] | kumaravishek84@gmail.com |
533947c5f3cdbfc84830ac1945e0b037fea3e541 | ec2543cfd2dd398cce211f54f8bf3300294704a4 | /src/wifiantenna/model/wifi-antenna-model.h | f9e6532c75397b89f5270abb657aa26cde61362f | [] | no_license | devanxu1991/ns-3-directionalfdwifi | 54dd19833497b30c95af6464a4a43e9e1f93397c | a36216e42b2de76901f9d28044c2624f75ae1057 | refs/heads/master | 2021-01-17T21:47:06.822881 | 2014-10-21T03:50:08 | 2014-10-21T03:50:08 | 57,971,271 | 1 | 0 | null | 2016-05-03T13:27:59 | 2016-05-03T13:27:59 | null | UTF-8 | C++ | false | false | 3,375 | h | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2011 CTTC
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Nicola Baldo <nbaldo@cttc.es>
*/
#ifndef WIFI_ANTENNA_MODEL_H
#define WIFI_ANTENNA_MODEL_H
#include <ns3/object.h>
#include <ns3/angles.h>
#include <ns3/orientation-model.h>
namespace ns3 {
class MobilityModel;
class MobilityModel;
class WifiAntennaListener
{
public:
virtual ~WifiAntennaListener ();
virtual void NotifyChangeAntennaMode (int mode) = 0;
};
/**
* \ingroup antenna
*
* \brief interface for antenna radiation pattern models
*
* This class provides an interface for the definition of antenna
* radiation pattern models. This interface is based on the use of
* spherical coordinates, in particular of the azimuth and inclination
* angles. This choice is the one proposed "Antenna Theory - Analysis
* and Design", C.A. Balanis, Wiley, 2nd Ed., see in particular
* section 2.2 "Radiation pattern".
*
*
*/
class WifiAntennaModel : public Object
{
public:
const static int NUMBER_OF_ANTENNA_MODES = 5;
int m_antennaMode;
WifiAntennaModel ();
virtual ~WifiAntennaModel ();
// inherited from Object
static TypeId GetTypeId ();
/**
* this method takes the orientation of nodes and calculates the gain
*
* this allows for the calculation of the angle based on the node orientation
* and antenna orientation
*
* \param oriOfNode orientation of the node the antenna is on
* \param oriToOtherNode orientaion of the other node
* \return gain in db
*/
virtual double GetGainDb (Ptr<MobilityModel> src, Ptr<MobilityModel> dest);
virtual void SetAntennaMode (int mode);
virtual void SetAntennaMode (Angles bet);
virtual int GetNextAntennaMode (Angles bet);
int GetAntennaMode ();
void SetOrientationModel (Ptr<OrientationModel> orientation);
Angles GetOrientation ();
void SetOrientation (const Angles &orientation);
void RegisterListener (WifiAntennaListener *listener);
void NotifyChangeAntennaMode (int mode);
protected:
typedef std::vector<WifiAntennaListener *> Listeners;
Listeners m_listeners;
private:
/**
* this method is expected to be re-implemented by each antenna model
*
* \param a the spherical angles at which the radiation pattern should
* be evaluated
*
* \return the power gain in dBi of the antenna radiation pattern at
* the specified angles; dBi means dB with respect to the gain of an
* isotropic radiator. Since a power gain is used, the efficiency of
* the antenna is expected to be included in the gain value.
*/
virtual double DoGetGainDb (Angles a) = 0;
Ptr<OrientationModel> m_orientation;
};
} // namespace ns3
#endif // WIFIANTENNA_MODEL_H
| [
"sugiyama@aurum.cs.inf.shizuoka.ac.jp"
] | sugiyama@aurum.cs.inf.shizuoka.ac.jp |
57c027bee299682922b7c32c3d0af97db95ca48c | 113a3a8b2f873c8cc38beed48c1c534b00dba2c7 | /1042 - Secret Origins.cpp | 828a5777b9d95facc677ce687223e2d2cccd0c6e | [] | no_license | dhimanda/LightOJ | e301395d9a1a7fc7c3c692e25c764f3c0e2a589a | 4c1a2e8cc0428a0654a4fd48227fe6283317fa41 | refs/heads/master | 2021-08-22T08:09:03.050299 | 2021-05-18T09:33:04 | 2021-05-18T09:33:04 | 250,885,045 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,563 | cpp | /// Coded by Dhiman Sarker Bappy (Dhimanda) - RMSTU
// Problem Link : http://lightoj.com/volume_showproblem.php?problem=1042
#include<bits/stdc++.h>
using namespace std;
#define in_file freopen("input.txt", "r", stdin)
#define out_file freopen("output.txt", "w", stdout)
#define F first
#define S second
#define pb push_back
#define popb pop_back
#define pf push_front
#define popf pop_front
#define lcm(a,b) (a*b)/gcd(a,b)
#define gcd(a,b) __gcd(a,b)
#define pi 2*acos(0)
#define elif else if
#define ll long long
#define sp fixed<<setprecision
int main()
{
//in_file;
//out_file;
int t=Int;
int kase = 0;
while(t--){
ll n;
cin >> n;
string a="";
while(n){
if(n%2) a+= '1';
else a += '0';
n/=2;
}
reverse(a.begin(),a.end());
a = '0' + a;
//cout<<a<<endl;
for(int i= a.size()-1 ; i >= 1 ; i--){
if(a[i]=='1' && a[i-1]=='0'){
a[i] = '0';
a[i-1] = '1';
sort(a.begin()+i,a.end());
break;
}
}
//cout<<a<<endl;
ll ans = 0;
ll two = 1;
for(int i= a.size()-1 ; i >= 0 ; i--){
if(a[i]=='1'){
ans += two;
}
two = two * 2;
}
printf("Case %d: " , ++kase);
cout<<ans<<endl;
}
return 0;
}
| [
"noreply@github.com"
] | noreply@github.com |
0e6ce488587c634b6172092668f8d9042ee6a71e | dda16dbfc3efb86d4e249ca87f490e6a9926151e | /Projects/KerneyTextbook/classVolumeCalculator/main.cpp | f13c43018512fd5e36b867538dee513185ab8005 | [] | no_license | janavarro95/CPP_Work | d4085368b5d4a4a023904a80968bb32b01204f74 | d16b62f413a47030fafd78fa912f443e8a9db4ed | refs/heads/master | 2020-03-09T23:05:51.064788 | 2018-04-16T04:48:57 | 2018-04-16T04:48:57 | 129,050,810 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 512 | cpp | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main() {
vector <int> power;
int input = 0;
cout<<"Please input an integer."<<endl;
cin >> input;
if(!cin) {
cout<<"Invalid input!"<<endl;
return 0;
}
for (int i = 0; i < 5; i++){
int temp = 0;
temp = pow(input, i+1);
cout << temp << endl;
power.push_back(temp);
}
for (int i=1; i <=power.size(); i++){
cout << power.at(power.size()-i) << endl;
}
}
| [
"JoshuaNavarro@DESKTOP-1AFQIIL.localdomain"
] | JoshuaNavarro@DESKTOP-1AFQIIL.localdomain |
303c9661bff62193a4ad2761692a31459d26e98f | a1ad174b354bf6b365b4a8d5beea57ee5b377c61 | /src/OWAIterator.h | 0aae3a2f6e3925ea45663ae7095d0cb13b8a19e9 | [
"MIT"
] | permissive | chawkinsuf/ImageTL | 7d401e5efbeb329fd2800f3b5d45fabe94b3bd06 | fb101bd4b240f2fa34563b51aff00c33df2ede87 | refs/heads/master | 2021-01-19T07:13:23.803740 | 2014-06-04T03:59:33 | 2014-06-04T03:59:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 987 | h | #ifndef __OWAITERATOR_H__
#define __OWAITERATOR_H__
// Disable warnings about ignoring throws declarations
#pragma warning( disable : 4290 )
#include <numeric>
#include <iterator>
#include <algorithm>
#include <cmath>
#include "Image.h"
#include "ImageException.h"
#include "Template.h"
#include "ConvolutionIterator.h"
namespace ImageTL
{
template<class Type> class OWAIterator : public ConvolutionIterator<Type>
{
public:
OWAIterator(const Image<Type>* image);
OWAIterator(const Image<Type>* image, ConstantTemplate<Type>* tLinkC);
~OWAIterator();
virtual typename ConvolutionIterator<Type>::value_type operator*();
void normalizeLinkedTemplate();
protected:
typename ConvolutionIterator<Type>::data_container* m_temData;
ConstantTemplate<Type>* m_tLinkC;
};
}
// Include the function definitions in the header if we aren't using a compiled library
#ifdef IMAGETL_NO_LIBRARY
#include "OWAIterator.cpp"
#endif
#endif | [
"chawkinsuf@gmail.com"
] | chawkinsuf@gmail.com |
e64fba86d4576b3b10ec363b65ae6f567f85c29a | 66e0df8dc407c101e57e2b877d06aab872020a6c | /public/MLSandbox/FeldmanCousins.h | 96fb67f66368bf9864aac8936c50d4724ae5bfe4 | [] | no_license | sflis/MLSandbox | ebf0237c0b2b1340d7e44397e4770bc6fb19cc29 | 8fb079e7e564f5f39f035c2a14ef4e9c5f5e96dd | refs/heads/master | 2021-01-17T04:10:50.293921 | 2018-06-04T08:54:03 | 2018-06-04T08:54:03 | 50,674,109 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,888 | h | // Copyright (C) 2015
// Samuel Flis <samuel.flis@fysik.su.se>
// and the IceCube Collaboration <http://www.icecube.wisc.edu>
//
// This file is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>
#ifndef MLSANDBOX_FELDMAN_COUSINS_H
#define MLSANDBOX_FELDMAN_COUSINS_H
#include "Likelihood.h"
#include "Minimizer.h"
#include "FCRanks.h"
#include <boost/shared_ptr.hpp>
#include <gsl/gsl_errno.h>
#include <gsl/gsl_spline.h>
#include <inttypes.h>
#include <vector>
#include <string>
#include <math.h>
#include <iostream>
#include <boost/numpy.hpp>
/**class: FeldmanCousinsAnalysis is a class which encapsulates the
* FC analysis proceedures.
**/
namespace bn=boost::numpy;
class FeldmanCousinsAnalysis{
public:
FeldmanCousinsAnalysis(
boost::shared_ptr<Likelihood> llh,
double cl
)
: llh_(llh)
, cl_(cl)
, computedBestFit_(false)
, ranksCompSet_(false),
likelihoodState_(0)
{
}
///Returns the log value of the FC test-statistic for a given likelihood parameter
///\param xi likelihood parameter for which the test statistic should be calculated
///\return the log of the FC test-statistic = log(L(xi)/L(xi_best))
double EvaluateTestsStatistic(double xi){
if(!computedBestFit_ || llh_->Changed()){
minimizer_.ComputeBestFit(*llh_);
computedBestFit_ = true;
}
return (*llh_).EvaluateLLH(xi) - minimizer_.bestFitLLH_;
}
void SetFCRanks(FCRanks const &ranks){
ranksCompSet_ = true;
ranks_ = ranks;
}
void Sample(double xi){
llh_->SampleEvents(xi);
computedBestFit_ = false;
}
///Generates an ensemble of pseudo experiments to construct upper and
///lower limits distributions at a given likelihood parameter value xi
///\param xi
///\param up
///\param down
///\param cl
///\param nExperiments
void GenerateLimitsEnsemble(double xi,
bn::ndarray &up,
bn::ndarray &down,
uint64_t nExperiments,
double cl = -1
);
void ComputeLimits(double &upper, double &lower);
void ComputeLimits(double &upper, double &lower, bool assumeChi2){
bool assumeChi2_old = assumeChi2_;
ranks_.AssumeChiSqure(assumeChi2_);
ComputeLimits(upper, lower);
ranks_.AssumeChiSqure(assumeChi2_old);
}
void ComputeRanks(uint64_t nExperiments,
double minXi,
double maxXi,
uint64_t nSteps,
uint64_t nThreads = 1);
FCRanks &GetRanks(){return ranks_;}
FCRanks ranks_;
FCRanks globalBestFits_;
Minimizer minimizer_;
private:
boost::shared_ptr<Likelihood> llh_;
static double likelihoodRatioCrossings(double xi, void *params);
double cl_;
bool computedBestFit_;
bool assumeChi2_;
bool ranksCompSet_;
uint32_t likelihoodState_;
};
#endif
| [
"samuel.d.flis@gmail.com"
] | samuel.d.flis@gmail.com |
44be0abfc524ab2cff1dcc024fd50eca06f1ec22 | 45c84e64a486a3c48bd41a78e28252acbc0cc1b0 | /src/chrome/browser/web_applications/web_app_provider.h | dc9cf98658f66d2d0f57c6b76779c168d8f2f060 | [
"BSD-3-Clause",
"MIT"
] | permissive | stanleywxc/chromium-noupdator | 47f9cccc6256b1e5b0cb22c598b7a86f5453eb42 | 637f32e9bf9079f31430c9aa9c64a75247993a71 | refs/heads/master | 2022-12-03T22:00:20.940455 | 2019-10-04T16:29:31 | 2019-10-04T16:29:31 | 212,851,250 | 1 | 2 | MIT | 2022-11-17T09:51:04 | 2019-10-04T15:49:33 | null | UTF-8 | C++ | false | false | 4,985 | h | // Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_PROVIDER_H_
#define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_PROVIDER_H_
#include <memory>
#include <vector>
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/one_shot_event.h"
#include "chrome/browser/web_applications/components/app_registrar.h"
#include "chrome/browser/web_applications/components/pending_app_manager.h"
#include "chrome/browser/web_applications/components/web_app_helpers.h"
#include "chrome/browser/web_applications/components/web_app_provider_base.h"
class Profile;
namespace content {
class WebContents;
}
namespace user_prefs {
class PrefRegistrySyncable;
}
namespace web_app {
// Forward declarations of generalized interfaces.
class AppRegistryController;
class AppIconManager;
class ExternalWebAppManager;
class FileHandlerManager;
class InstallFinalizer;
class ManifestUpdateManager;
class SystemWebAppManager;
class WebAppAudioFocusIdMap;
class WebAppInstallManager;
class WebAppPolicyManager;
class WebAppUiManager;
// Forward declarations for new extension-independent subsystems.
class WebAppDatabaseFactory;
// Connects Web App features, such as the installation of default and
// policy-managed web apps, with Profiles (as WebAppProvider is a
// Profile-linked KeyedService) and their associated PrefService.
//
// Lifecycle notes:
// All subsystems are constructed independently of each other in the
// WebAppProvider constructor.
// Subsystem construction should have no side effects and start no tasks.
// Tests can replace any of the subsystems before Start() is called.
// Similarly, in destruction, subsystems should not refer to each other.
class WebAppProvider : public WebAppProviderBase {
public:
static WebAppProvider* Get(Profile* profile);
static WebAppProvider* GetForWebContents(content::WebContents* web_contents);
explicit WebAppProvider(Profile* profile);
~WebAppProvider() override;
// Start the Web App system. This will run subsystem startup tasks.
void Start();
// WebAppProviderBase:
AppRegistrar& registrar() override;
AppRegistryController& registry_controller() override;
InstallManager& install_manager() override;
InstallFinalizer& install_finalizer() override;
ManifestUpdateManager& manifest_update_manager() override;
PendingAppManager& pending_app_manager() override;
WebAppPolicyManager& policy_manager() override;
WebAppUiManager& ui_manager() override;
WebAppAudioFocusIdMap& audio_focus_id_map() override;
FileHandlerManager& file_handler_manager() override;
AppIconManager& icon_manager() override;
SystemWebAppManager& system_web_app_manager();
// KeyedService:
void Shutdown() override;
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
// Signals when app registry becomes ready.
const base::OneShotEvent& on_registry_ready() const {
return on_registry_ready_;
}
protected:
virtual void StartImpl();
// Create subsystems that work with either BMO and Extension backends.
void CreateCommonSubsystems(Profile* profile);
// Create extension-independent subsystems.
void CreateWebAppsSubsystems(Profile* profile);
// ... or create legacy extension-based subsystems.
void CreateBookmarkAppsSubsystems(Profile* profile);
// Wire together subsystems but do not start them (yet).
void ConnectSubsystems();
// Start registry controller. All other subsystems depend on it.
void StartRegistryController();
void OnRegistryControllerReady();
void CheckIsConnected() const;
// New extension-independent subsystems:
std::unique_ptr<WebAppDatabaseFactory> database_factory_;
// Generalized subsystems:
std::unique_ptr<AppRegistrar> registrar_;
std::unique_ptr<AppRegistryController> registry_controller_;
std::unique_ptr<ExternalWebAppManager> external_web_app_manager_;
std::unique_ptr<FileHandlerManager> file_handler_manager_;
std::unique_ptr<AppIconManager> icon_manager_;
std::unique_ptr<InstallFinalizer> install_finalizer_;
std::unique_ptr<ManifestUpdateManager> manifest_update_manager_;
std::unique_ptr<PendingAppManager> pending_app_manager_;
std::unique_ptr<SystemWebAppManager> system_web_app_manager_;
std::unique_ptr<WebAppAudioFocusIdMap> audio_focus_id_map_;
std::unique_ptr<WebAppInstallManager> install_manager_;
std::unique_ptr<WebAppPolicyManager> web_app_policy_manager_;
std::unique_ptr<WebAppUiManager> ui_manager_;
base::OneShotEvent on_registry_ready_;
Profile* profile_;
// Ensures that ConnectSubsystems() is not called after Start().
bool started_ = false;
bool connected_ = false;
base::WeakPtrFactory<WebAppProvider> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(WebAppProvider);
};
} // namespace web_app
#endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_PROVIDER_H_
| [
"stanley@moon.lan"
] | stanley@moon.lan |
74e0fda8fa7ea199754b885c72669383947a376e | dd0897ed4d7e7415668ded39f225a646983d1e25 | /PokerSimulator/OwnPokerSimulator/test_cases/createPreflopTableFile.cpp | 20367f9571f791bf1c1d63750cc08d3b67e4d368 | [] | no_license | FabianMoik/BachelorThesis | 9f4d50892a6fac0b7c56fec62bf70fb23220f847 | 44f2eec261d857daf7744f65513da3e7a6655cef | refs/heads/master | 2021-04-09T17:07:43.304898 | 2018-08-27T17:07:31 | 2018-08-27T17:07:31 | 125,757,731 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,012 | cpp | //
// Created by Fabian Moik on 06.02.18.
//
#include <iostream>
#include "../random.h"
#include "../hand_eval/2+2/2P2Evaluator.h"
#include "../hand_eval/handEvalCalc.h"
#include "../game_assets/card.h"
#include <vector>
#include <sys/time.h>
inline double my_clock(void) {
struct timeval t;
gettimeofday(&t, NULL);
return (1.0e-6*t.tv_usec + t.tv_sec);
}
int main() {
seedRandomFastWithRandomSlow();
// Setup 2+2 method
TPTEvaluator::initEvaluator();
int numOpponents = 8;
int numSamples = 1000000;
double winChange;
std::vector<Card> holeCards;
holeCards.resize(2);
std::vector<Card> boardCards;
float winChanges[169][numOpponents];
double start_time, end_time;
start_time = my_clock();
for (int p = 0; p < numOpponents; p++) {
int distinctHandsCount = 0;
for (int i = 14; i > 1; i--) {
for (int j = i; j > 1; j--) {
if (i == j) { //pocket pair
holeCards.at(0) = Card(i, S_SPADES);
holeCards.at(1) = Card(j, S_DIAMONDS);
winChange = getEHSVsNOpponents(holeCards, boardCards, p + 1, numSamples);
winChanges[distinctHandsCount][p] = float(winChange);
distinctHandsCount++;
} else {
// two cases, either suited or unsuited, therefore two calculations
//suited
holeCards.at(0) = Card(i, S_SPADES);
holeCards.at(1) = Card(j, S_SPADES);
winChange = getEHSVsNOpponents(holeCards, boardCards, p + 1, numSamples);
winChanges[distinctHandsCount][p] = float(winChange);
//off-suited
holeCards.at(0) = Card(i, S_SPADES);
holeCards.at(1) = Card(j, S_DIAMONDS);
winChange = getEHSVsNOpponents(holeCards, boardCards, p + 1, numSamples);
winChanges[distinctHandsCount + 1][p] = float(winChange);
distinctHandsCount += 2;
}
std::cout << "Hands done: " << distinctHandsCount << std::endl;
}
}
std::cout << "Distinct Hands Count: " << distinctHandsCount << std::endl;
}
for (int i = 0; i < 169; i++) {
for (int j = 0; j < numOpponents; j++) {
std::cout << winChanges[i][j] << " - ";
}
std::cout << std::endl;
}
end_time = my_clock();
double totalTime = end_time - start_time;
std::cout << "Full preflop table creation took: " << totalTime << "seconds" << std::endl;
/////////////////// SAVING /////////////////////////////
// output the array now that I have it!!
//Convert 2-d array to 1-d array
float winChangesOneD[169 * numOpponents];
int index = 0;
for (int j = 0; j < numOpponents; j++) {
for (int i = 0; i < 169; i++) {
winChangesOneD[index] = winChanges[i][j];
index++;
}
}
std::cout << "Reference Value: " << winChangesOneD[222] << std::endl;
FILE * fout = fopen("../LookupTables/preflopTables.dat", "wb");
if (!fout) {
printf("Problem creating the Output File!\n");
return 1;
}
fwrite(winChangesOneD, sizeof(winChangesOneD), 1, fout); // big write, but quick
fclose(fout);
////////////////////// LOADING /////////////////////////////
// Load the preflopTables.DAT file and map it into the array
printf("Loading preflopTables.DAT file...");
float winChangesInput[169 * numOpponents];
memset(winChangesInput, 0, sizeof(winChangesInput));
FILE * fin = fopen("../LookupTables/preflopTables.dat", "rb");
if (!fin)
return false;
size_t bytesread = fread(winChangesInput, sizeof(winChangesInput), 1, fin); // get the HandRank Array
fclose(fin);
printf("complete.\n\n");
std::cout << "Control Value: " << winChangesInput[222] << std::endl;
return 0;
} | [
"fabian.moik@ut11.net"
] | fabian.moik@ut11.net |
79603101420a5e091162b570ddf3dad43b5c4b4e | c766bece263e5149d0dbab04ea20308bf1191ab8 | /AdobeInDesignCCProductsSDK.2020/source/sdksamples/suppui/SuppUISuppressedUI.cpp | d6ca8f475799d0a5c314be9e046503852c7fb19a | [] | no_license | stevenstong/adobe-tools | 37a36868619db90984d5303187305c9da1e024f7 | c74d61d882363a91da4938fd525b97f83084cb2e | refs/heads/master | 2022-04-08T17:31:35.516938 | 2020-03-18T20:57:40 | 2020-03-18T20:57:40 | 248,061,036 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,048 | cpp | //========================================================================================
//
// $File: //depot/devtech/15.0/plugin/source/sdksamples/suppui/SuppUISuppressedUI.cpp $
//
// Owner: Adobe Developer Technologies
//
// $Author: pmbuilder $
//
// $DateTime: 2019/10/11 10:48:01 $
//
// $Revision: #2 $
//
// $Change: 1061132 $
//
// Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
//
// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
// with the terms of the Adobe license agreement accompanying it. If you have received
// this file from a source other than Adobe, then your use, modification, or
// distribution of it requires the prior written permission of Adobe.
//
//
// ADOBE CONFIDENTIAL
//
//========================================================================================
#include "VCPlugInHeaders.h"
// ----- Interfaces -----
#include "IControlView.h"
#include "IDragDropTarget.h"
#include "IWidgetParent.h"
// ----- Includes -----
#include "CPMUnknown.h"
#include "SuppUISuppressedUI.h"
#include "SuppressedUIXMLDefs.h"
// ----- Utility files -----
// ----- ID.h files -----
#include "SuppUIID.h"
#include "StylePanelID.h"
#include "TextFrameOptionsID.h"
#include "TextStylePanelID.h"
#include "widgetid.h"
/* CREATE_PMINTERFACE
Binds the C++ implementation class onto its
ImplementationID making the C++ code callable by the
application.
*/
CREATE_PMINTERFACE(SuppUISuppressedUI, kSuppUISuppressedUIImpl)
// Actual flags for menu states
bool16 SuppUISuppressedUI::gSuppressStyleChages = kFalse;
bool16 SuppUISuppressedUI::gSuppressFontAndSizeMenus = kFalse;
bool16 SuppUISuppressedUI::gSuppressOpenFileDialogControls = kFalse;
bool16 SuppUISuppressedUI::gSuppressParaStyleQuickApply = kFalse;
/* SuppUISuppressedUI Constructor
*/
SuppUISuppressedUI::SuppUISuppressedUI(IPMUnknown *boss) :
CPMUnknown<ISuppressedUI>(boss)
{
}
/* SuppUISuppressedUI Destructor
*/
SuppUISuppressedUI::~SuppUISuppressedUI()
{
}
/* IsWidgetDisabled
*/
bool16 SuppUISuppressedUI::IsWidgetDisabled( const IControlView* widget ) const
{
// Check to see if we are suppressing style changes
if( gSuppressStyleChages )
{
// See if it's one of the widgets we want to suppress
WidgetID widgetID = GetWidgetID(widget);
switch( widgetID.Get() )
{
case kCharStyleIconWidgetID:
case kParaStyleIconWidgetID:
case kNewCharStyleButtonWidgetID:
case kNewParaStyleButtonWidgetID:
case kDeleteCharStyleButtonWidgetID:
case kDeleteParaStyleButtonWidgetID:
case kNewCharStyleGroupButtonWidgetID:
case kNewParaStyleGroupButtonWidgetID:
return kTrue;
}
}
return kFalse;
}
/* IsWidgetHidden
*/
bool16 SuppUISuppressedUI::IsWidgetHidden( const IControlView* widget ) const
{
// Check to see if we are suppressing style changes
if( gSuppressStyleChages )
{
// See if it's one of the widgets we want to suppress
WidgetID widgetID = GetWidgetID(widget);
switch( widgetID.Get() )
{
case kPreviewButtonWidgetID:
case kOKButtonWidgetID:
{
WidgetID parentWidgetID = GetParentWidgetID(widget);
if( parentWidgetID == kStyleCharParentWidgetID || parentWidgetID == kStyleParaParentWidgetID
|| parentWidgetID == kStyleGroupOptionsDialogBoss )
return kTrue;
}
}
}
return kFalse;
}
/* IsDragDropDisabled
*/
bool16 SuppUISuppressedUI::IsDragDropDisabled( const IDragDropTarget* target, DataObjectIterator* data, const IDragDropSource* source ) const
{
// Check to see if we are suppressing style changes
if( gSuppressStyleChages )
{
// See if it's one of the widgets we want to suppress
InterfacePtr<IControlView> widget(target, UseDefaultIID());
WidgetID widgetID = GetWidgetID(widget);
switch( widgetID.Get() )
{
case kNewCharStyleButtonWidgetID:
case kNewParaStyleButtonWidgetID:
case kDeleteCharStyleButtonWidgetID:
case kDeleteParaStyleButtonWidgetID:
case kNewCharStyleGroupButtonWidgetID:
case kNewParaStyleGroupButtonWidgetID:
case kParaStyleTreeViewWidgetID:
case kParaStyleListParentWidgetId:
case kCharStyleTreeViewWidgetID:
case kCharStyleListParentWidgetId:
return kTrue;
}
}
return kFalse;
}
/* IsActionDisabled
*/
bool16 SuppUISuppressedUI::IsActionDisabled( ActionID action ) const
{
// Check to see if we are suppressing style changes
if( gSuppressStyleChages )
{
// See if it's one of the actions we want to suppress
switch (action.Get())
{
case kLoadParaStylesActionID:
case kParaLoadAllStylesActionID:
case kRedefineParaStyleActionID:
case kNewParaStyleActionID:
case kDeleteParaStyleActionID:
case kParaStyleOptionsActionID:
case kDuplicateParaStyleActionID:
case kParaNewStyleGroupActionID:
case kParaCreateStyleGroupActionID:
case kParaCopyToStyleGroupActionID:
case kContextMenuStyleOptionsActionID:
case kContextMenuDuplicateStyleActionID:
case kContextMenuDeleteStyleActionID:
case kContextMenuRedefineStyleActionID:
case kContextMenuDuplicateStyleGroupActionID:
case kContextMenuDeleteStyleGroupActionID:
case kContextMenuCopyToStyleGroupActionID:
case kContextMenuCreateStyleGroupActionID:
case kContextMenuCreateStyleInGroupActionID:
return kTrue;
break;
}
}
return kFalse;
}
/* IsActionHidden
*/
bool16 SuppUISuppressedUI::IsActionHidden( ActionID action ) const
{
// Check to see if we are suppressing style changes
if( gSuppressStyleChages )
{
// See if it's one of the actions we want to suppress
switch (action.Get())
{
case kLoadCharStylesActionID:
case kCharLoadAllStylesActionID:
case kRedefineCharStyleActionID:
case kNewCharStyleActionID:
case kDeleteCharStyleActionID:
case kCharStyleOptionsActionID:
case kDuplicateCharStyleActionID:
case kCharNewStyleGroupActionID:
case kCharCreateStyleGroupActionID:
case kCharCopyToStyleGroupActionID:
return kTrue;
break;
}
}
return kFalse;
}
/* IsSubMenuDisabled
*/
bool16 SuppUISuppressedUI::IsSubMenuDisabled( const PMString& untranslatedSubMenuName ) const
{
if( gSuppressFontAndSizeMenus )
{
if( untranslatedSubMenuName.IsEqual("Main:&Type:&Font") )
return kTrue;
}
return kFalse;
}
/* IsSubMenuHidden
*/
bool16 SuppUISuppressedUI::IsSubMenuHidden( const PMString& untranslatedSubMenuName ) const
{
if( gSuppressFontAndSizeMenus )
{
if( untranslatedSubMenuName.IsEqual("Main:&Type:Size") )
return kTrue;
}
return kFalse;
}
/* IsPlatformDialogControlSuppressed
*/
bool16 SuppUISuppressedUI::IsPlatformDialogControlSuppressed( const PMString& platformDialogControlIdentifier ) const
{
if ( gSuppressOpenFileDialogControls )
{
// Look for kAllOpenDocDialogCustomControlsValue to suppress all custom controls.
// Look for kAdobeFileDialogOpenDialogButtonValue to suppress the Adobe dialog
// and the "Use Adobe Dialog" button.
if(platformDialogControlIdentifier.IsEqual(SuppressedUIXMLDefs::kAdobeFileDialogOpenDialogButtonValue )||
platformDialogControlIdentifier.IsEqual(SuppressedUIXMLDefs::kAllOpenDocDialogCustomControlsValue ))
{
return kTrue;
}
}
return kFalse;
}
/* Reset
*/
void SuppUISuppressedUI::Reset( )
{
// The Reset() method is useful if you cache the suppressed items.
// This is not useful when the widgets you're supressing are hardcoded.
// See the "Working With The ISuppressedUI API" section in the Suppressed UI
// technote (#10102) for more information.
}
/* GetWidgetID
*/
WidgetID SuppUISuppressedUI::GetWidgetID(const IControlView* widget) const
{
if( widget )
{
return widget->GetWidgetID();
}
return kInvalidWidgetID;
}
/* GetParentWidgetID
*/
WidgetID SuppUISuppressedUI::GetParentWidgetID(const IControlView* widget) const
{
InterfacePtr<IWidgetParent> parentHolder(widget, IID_IWIDGETPARENT);
if(parentHolder)
{
InterfacePtr<IControlView> parentView((IControlView*)parentHolder->QueryParentFor(IID_ICONTROLVIEW));
if( parentView )
{
return parentView->GetWidgetID();
}
}
return kInvalidWidgetID;
}
| [
"steven.tong@hcl.com"
] | steven.tong@hcl.com |
f4dd438264eb2769696e62ccead8d379de8a7543 | f87666bdac0678d2ffffeef4cfa0ff4c25d89ec8 | /rapidxml/rapidxml_print.hpp | b61681799fd75d1202fb57abb2fe046121827a10 | [] | no_license | jacikot/Photoshop | 3f98288fa69727df38784374bf3265c6f674f8e2 | 20f46a97e8400990b1fc94ac376882244f43d12c | refs/heads/master | 2023-04-03T12:36:23.635583 | 2021-04-06T09:49:54 | 2021-04-06T09:49:54 | 355,128,216 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 16,811 | hpp | #ifndef RAPIDXML_PRINT_HPP_INCLUDED
#define RAPIDXML_PRINT_HPP_INCLUDED
// Copyright (C) 2006, 2009 Marcin Kalicinski
// Version 1.13
// Revision $DateTime: 2009/05/13 01:46:17 $
//! \file rapidxml_print.hpp This file contains rapidxml printer implementation
#include "rapidxml.hpp"
// Only include streams if not disabled
#ifndef RAPIDXML_NO_STREAMS
#include <ostream>
#include <iterator>
#endif
namespace rapidxml
{
///////////////////////////////////////////////////////////////////////
// Printing flags
const int print_no_indenting = 0x1; //!< Printer flag instructing the printer to suppress indenting of XML. See print() function.
///////////////////////////////////////////////////////////////////////
// Internal
//! \cond internal
namespace internal
{
///////////////////////////////////////////////////////////////////////////
// Internal character operations
// Copy characters from given range to given output iterator
template<class OutIt, class Ch>
inline OutIt copy_chars(const Ch *begin, const Ch *end, OutIt out)
{
while (begin != end)
*out++ = *begin++;
return out;
}
// Copy characters from given range to given output iterator and expand
// characters into references (< > ' " &)
template<class OutIt, class Ch>
inline OutIt copy_and_expand_chars(const Ch *begin, const Ch *end, Ch noexpand, OutIt out)
{
while (begin != end)
{
if (*begin == noexpand)
{
*out++ = *begin; // No expansion, copy character
}
else
{
switch (*begin)
{
case Ch('<'):
*out++ = Ch('&'); *out++ = Ch('l'); *out++ = Ch('t'); *out++ = Ch(';');
break;
case Ch('>'):
*out++ = Ch('&'); *out++ = Ch('g'); *out++ = Ch('t'); *out++ = Ch(';');
break;
case Ch('\''):
*out++ = Ch('&'); *out++ = Ch('a'); *out++ = Ch('p'); *out++ = Ch('o'); *out++ = Ch('s'); *out++ = Ch(';');
break;
case Ch('"'):
*out++ = Ch('&'); *out++ = Ch('q'); *out++ = Ch('u'); *out++ = Ch('o'); *out++ = Ch('t'); *out++ = Ch(';');
break;
case Ch('&'):
*out++ = Ch('&'); *out++ = Ch('a'); *out++ = Ch('m'); *out++ = Ch('p'); *out++ = Ch(';');
break;
default:
*out++ = *begin; // No expansion, copy character
}
}
++begin; // Step to next character
}
return out;
}
// Fill given output iterator with repetitions of the same character
template<class OutIt, class Ch>
inline OutIt fill_chars(OutIt out, int n, Ch ch)
{
for (int i = 0; i < n; ++i)
*out++ = ch;
return out;
}
// Find character
template<class Ch, Ch ch>
inline bool find_char(const Ch *begin, const Ch *end)
{
while (begin != end)
if (*begin++ == ch)
return true;
return false;
}
///////////////////////////////////////////////////////////////////////////
// Internal printing operations
template<class OutIt, class Ch>
inline OutIt print_children(OutIt out, const xml_node<Ch> *node, int flags, int indent);
template<class OutIt, class Ch>
inline OutIt print_attributes(OutIt out, const xml_node<Ch> *node, int flags);
template<class OutIt, class Ch>
inline OutIt print_data_node(OutIt out, const xml_node<Ch> *node, int flags, int indent);
template<class OutIt, class Ch>
inline OutIt print_cdata_node(OutIt out, const xml_node<Ch> *node, int flags, int indent);
template<class OutIt, class Ch>
inline OutIt print_element_node(OutIt out, const xml_node<Ch> *node, int flags, int indent);
template<class OutIt, class Ch>
inline OutIt print_declaration_node(OutIt out, const xml_node<Ch> *node, int flags, int indent);
template<class OutIt, class Ch>
inline OutIt print_comment_node(OutIt out, const xml_node<Ch> *node, int flags, int indent);
template<class OutIt, class Ch>
inline OutIt print_doctype_node(OutIt out, const xml_node<Ch> *node, int flags, int indent);
template<class OutIt, class Ch>
inline OutIt print_pi_node(OutIt out, const xml_node<Ch> *node, int flags, int indent);
// Print node
template<class OutIt, class Ch>
inline OutIt print_node(OutIt out, const xml_node<Ch> *node, int flags, int indent)
{
// Print proper node type
switch (node->type())
{
// Document
case node_document:
out = print_children(out, node, flags, indent);
break;
// Element
case node_element:
out = print_element_node(out, node, flags, indent);
break;
// Data
case node_data:
out = print_data_node(out, node, flags, indent);
break;
// CDATA
case node_cdata:
out = print_cdata_node(out, node, flags, indent);
break;
// Declaration
case node_declaration:
out = print_declaration_node(out, node, flags, indent);
break;
// Comment
case node_comment:
out = print_comment_node(out, node, flags, indent);
break;
// Doctype
case node_doctype:
out = print_doctype_node(out, node, flags, indent);
break;
// Pi
case node_pi:
out = print_pi_node(out, node, flags, indent);
break;
// Unknown
default:
assert(0);
break;
}
// If indenting not disabled, add line break after node
if (!(flags & print_no_indenting))
*out = Ch('\n'), ++out;
// Return modified iterator
return out;
}
// Print children of the node
template<class OutIt, class Ch>
inline OutIt print_children(OutIt out, const xml_node<Ch> *node, int flags, int indent)
{
for (xml_node<Ch> *child = node->first_node(); child; child = child->next_sibling())
out = print_node(out, child, flags, indent);
return out;
}
// Print attributes of the node
template<class OutIt, class Ch>
inline OutIt print_attributes(OutIt out, const xml_node<Ch> *node, int flags)
{
for (xml_attribute<Ch> *attribute = node->first_attribute(); attribute; attribute = attribute->next_attribute())
{
if (attribute->name() && attribute->value())
{
// Print attribute name
*out = Ch(' '), ++out;
out = copy_chars(attribute->name(), attribute->name() + attribute->name_size(), out);
*out = Ch('='), ++out;
// Print attribute value using appropriate quote type
if (find_char<Ch, Ch('"')>(attribute->value(), attribute->value() + attribute->value_size()))
{
*out = Ch('\''), ++out;
out = copy_and_expand_chars(attribute->value(), attribute->value() + attribute->value_size(), Ch('"'), out);
*out = Ch('\''), ++out;
}
else
{
*out = Ch('"'), ++out;
out = copy_and_expand_chars(attribute->value(), attribute->value() + attribute->value_size(), Ch('\''), out);
*out = Ch('"'), ++out;
}
}
}
return out;
}
// Print data node
template<class OutIt, class Ch>
inline OutIt print_data_node(OutIt out, const xml_node<Ch> *node, int flags, int indent)
{
assert(node->type() == node_data);
if (!(flags & print_no_indenting))
out = fill_chars(out, indent, Ch('\t'));
out = copy_and_expand_chars(node->value(), node->value() + node->value_size(), Ch(0), out);
return out;
}
// Print data node
template<class OutIt, class Ch>
inline OutIt print_cdata_node(OutIt out, const xml_node<Ch> *node, int flags, int indent)
{
assert(node->type() == node_cdata);
if (!(flags & print_no_indenting))
out = fill_chars(out, indent, Ch('\t'));
*out = Ch('<'); ++out;
*out = Ch('!'); ++out;
*out = Ch('['); ++out;
*out = Ch('C'); ++out;
*out = Ch('D'); ++out;
*out = Ch('A'); ++out;
*out = Ch('T'); ++out;
*out = Ch('A'); ++out;
*out = Ch('['); ++out;
out = copy_chars(node->value(), node->value() + node->value_size(), out);
*out = Ch(']'); ++out;
*out = Ch(']'); ++out;
*out = Ch('>'); ++out;
return out;
}
// Print element node
template<class OutIt, class Ch>
inline OutIt print_element_node(OutIt out, const xml_node<Ch> *node, int flags, int indent)
{
assert(node->type() == node_element);
// Print element name and attributes, if any
if (!(flags & print_no_indenting))
out = fill_chars(out, indent, Ch('\t'));
*out = Ch('<'), ++out;
out = copy_chars(node->name(), node->name() + node->name_size(), out);
out = print_attributes(out, node, flags);
// If node is childless
if (node->value_size() == 0 && !node->first_node())
{
// Print childless node tag ending
*out = Ch('/'), ++out;
*out = Ch('>'), ++out;
}
else
{
// Print normal node tag ending
*out = Ch('>'), ++out;
// Test if node contains a single data node only (and no other nodes)
xml_node<Ch> *child = node->first_node();
if (!child)
{
// If node has no children, only print its value without indenting
out = copy_and_expand_chars(node->value(), node->value() + node->value_size(), Ch(0), out);
}
else if (child->next_sibling() == 0 && child->type() == node_data)
{
// If node has a sole data child, only print its value without indenting
out = copy_and_expand_chars(child->value(), child->value() + child->value_size(), Ch(0), out);
}
else
{
// Print all children with full indenting
if (!(flags & print_no_indenting))
*out = Ch('\n'), ++out;
out = print_children(out, node, flags, indent + 1);
if (!(flags & print_no_indenting))
out = fill_chars(out, indent, Ch('\t'));
}
// Print node end
*out = Ch('<'), ++out;
*out = Ch('/'), ++out;
out = copy_chars(node->name(), node->name() + node->name_size(), out);
*out = Ch('>'), ++out;
}
return out;
}
// Print declaration node
template<class OutIt, class Ch>
inline OutIt print_declaration_node(OutIt out, const xml_node<Ch> *node, int flags, int indent)
{
// Print declaration start
if (!(flags & print_no_indenting))
out = fill_chars(out, indent, Ch('\t'));
*out = Ch('<'), ++out;
*out = Ch('?'), ++out;
*out = Ch('x'), ++out;
*out = Ch('m'), ++out;
*out = Ch('l'), ++out;
// Print attributes
out = print_attributes(out, node, flags);
// Print declaration end
*out = Ch('?'), ++out;
*out = Ch('>'), ++out;
return out;
}
// Print comment node
template<class OutIt, class Ch>
inline OutIt print_comment_node(OutIt out, const xml_node<Ch> *node, int flags, int indent)
{
assert(node->type() == node_comment);
if (!(flags & print_no_indenting))
out = fill_chars(out, indent, Ch('\t'));
*out = Ch('<'), ++out;
*out = Ch('!'), ++out;
*out = Ch('-'), ++out;
*out = Ch('-'), ++out;
out = copy_chars(node->value(), node->value() + node->value_size(), out);
*out = Ch('-'), ++out;
*out = Ch('-'), ++out;
*out = Ch('>'), ++out;
return out;
}
// Print doctype node
template<class OutIt, class Ch>
inline OutIt print_doctype_node(OutIt out, const xml_node<Ch> *node, int flags, int indent)
{
assert(node->type() == node_doctype);
if (!(flags & print_no_indenting))
out = fill_chars(out, indent, Ch('\t'));
*out = Ch('<'), ++out;
*out = Ch('!'), ++out;
*out = Ch('D'), ++out;
*out = Ch('O'), ++out;
*out = Ch('C'), ++out;
*out = Ch('T'), ++out;
*out = Ch('Y'), ++out;
*out = Ch('P'), ++out;
*out = Ch('E'), ++out;
*out = Ch(' '), ++out;
out = copy_chars(node->value(), node->value() + node->value_size(), out);
*out = Ch('>'), ++out;
return out;
}
// Print pi node
template<class OutIt, class Ch>
inline OutIt print_pi_node(OutIt out, const xml_node<Ch> *node, int flags, int indent)
{
assert(node->type() == node_pi);
if (!(flags & print_no_indenting))
out = fill_chars(out, indent, Ch('\t'));
*out = Ch('<'), ++out;
*out = Ch('?'), ++out;
out = copy_chars(node->name(), node->name() + node->name_size(), out);
*out = Ch(' '), ++out;
out = copy_chars(node->value(), node->value() + node->value_size(), out);
*out = Ch('?'), ++out;
*out = Ch('>'), ++out;
return out;
}
}
//! \endcond
///////////////////////////////////////////////////////////////////////////
// Printing
//! Prints XML to given output iterator.
//! \param out Output iterator to print to.
//! \param node Node to be printed. Pass xml_document to print entire document.
//! \param flags Flags controlling how XML is printed.
//! \return Output iterator pointing to position immediately after last character of printed text.
template<class OutIt, class Ch>
inline OutIt print(OutIt out, const xml_node<Ch> &node, int flags = 0)
{
return internal::print_node(out, &node, flags, 0);
}
#ifndef RAPIDXML_NO_STREAMS
//! Prints XML to given output stream.
//! \param out Output stream to print to.
//! \param node Node to be printed. Pass xml_document to print entire document.
//! \param flags Flags controlling how XML is printed.
//! \return Output stream.
template<class Ch>
inline std::basic_ostream<Ch> &print(std::basic_ostream<Ch> &out, const xml_node<Ch> &node, int flags = 0)
{
print(std::ostream_iterator<Ch>(out), node, flags);
return out;
}
//! Prints formatted XML to given output stream. Uses default printing flags. Use print() function to customize printing process.
//! \param out Output stream to print to.
//! \param node Node to be printed.
//! \return Output stream.
template<class Ch>
inline std::basic_ostream<Ch> &operator <<(std::basic_ostream<Ch> &out, const xml_node<Ch> &node)
{
return print(out, node);
}
#endif
}
#endif
| [
"jana.toljaga725@yahoo.com"
] | jana.toljaga725@yahoo.com |
3cc2d6adcdc56ada980cffa7493e805749d4867b | a8ac897d9d50350ca891dfe5b712553d7420742f | /recommendation_2.cpp | 32652cadc1f55c62a37ec47fdcb91d76c3b82974 | [] | no_license | tarunprasadg92/recommendation-system | 81082e37a15557a41a4fc45d4a31141692fd7682 | d432a04229fda8eed90f29339442c38d9dbc6b9f | refs/heads/master | 2020-04-04T08:59:07.777179 | 2018-11-02T02:20:18 | 2018-11-02T02:20:18 | 155,802,025 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,241 | cpp | #include "recommendation.h"
using namespace std;
// Helper function for sorting the neighbors in ascending order
bool ascending(const pair<string, float>& a1, const pair<string, float>& a2)
{
return a1.second < a2.second;
}
// Helper function for sorting the neighbors in descending order
bool descending(const pair<string, float>& a1, const pair<string, float>& a2)
{
return a1.second > a2.second;
}
// Default constructor - reading the data into map
recommendation::recommendation()
{
string line;
// Create the map of ISBN and book title
ifstream ifs("BBooks.csv", ios::in);
// Read the entries
while (ifs.good())
{
getline(ifs, line);
if (line != "")
{
// Read line from the file
stringstream ss(line);
string isbn, book_name;
// Split the fields and store them into appropriate variables
getline(ss, isbn, ';');
getline(ss, book_name, ';');
// Store them into the map
book_details[isbn] = book_name;
}
}
ifs.close();
// Create the map of map containing Users and book and rating
ifstream iifs("BRatings.csv", ios::in);
// Read the entries
while (iifs.good())
{
getline(iifs, line);
if (line != "")
{
// Read line from the file
stringstream ss(line);
string user, isbn, rating;
// Split the fields and store them into appropriate variables
getline(ss, user, ';');
getline(ss, isbn, ';');
getline(ss, rating, ';');
// Store them into the map
book_data[user].insert(make_pair(isbn, rating));
}
}
iifs.close();
}
// Helper function to verify if the data is stored correctly
void recommendation::print_data()
{
cout << "Printing the book details : " << endl;
for (map<string, string>::iterator it = book_details.begin(); it != book_details.end(); ++it)
{
cout << "ISBN : " << it->first << " Book Name : " << it->second << endl;
}
cout << "Printing the Users and their ratings : " << endl;
for (map<string, map<string, string> >::iterator it = book_data.begin(); it != book_data.end(); ++it)
{
cout << "User : " << it->first << "\n\n";
map<string, string> &internal_map = it->second;
for (map<string, string>::iterator it2 = internal_map.begin(); it2 != internal_map.end(); ++it2)
{
cout << it2->first << "\t" << it2->second << endl;
}
cout << "---------------------" << endl;
cout << "\n";
}
}
// Function to compute the nearest neighbors using the 4 distance measuring techniques
void recommendation::compute_nearest_neighbors(string name)
{
map<string, string> &user = book_data[name];
if (user.empty())
{
cout << "Invalid user / No details found" << endl;
exit(EXIT_FAILURE);
}
float manhattan_difference = 0.0;
float euclidean_difference = 0.0;
vector<pair<string, float> > manhattan_distance;
vector<pair<string, float> > euclidean_distance;
vector<pair<string, float> > pearson_distance;
vector<pair<string, float> > cosine_distance;
for (map<string, map<string, string> >::iterator it = book_data.begin(); it != book_data.end(); ++it)
{
if (it->first == name)
{
continue;
}
map<string, string> &internal_map = it->second;
int n = 0;
float s_x = 0.0;
float s_y = 0.0;
float s_xsq = 0.0;
float s_ysq = 0.0;
float s_xy = 0.0;
for (map<string, string>::iterator it2 = user.begin(); it2 != user.end(); ++it2)
{
if (internal_map.find(it2->first) != internal_map.end())
{
manhattan_difference += abs(atof(internal_map[it2->first].c_str()) - atof((it2->second).c_str()));
euclidean_difference += pow(abs(atof(internal_map[it2->first].c_str()) - atof((it2->second).c_str())), 2);
float x = atof((it2->second).c_str());
float y = atof(internal_map[it2->first].c_str());
s_x += x;
s_y += y;
s_xy += x * y;
s_xsq += pow(x, 2);
s_ysq += pow(y, 2);
n++;
}
}
manhattan_distance.push_back(make_pair(it->first, manhattan_difference));
euclidean_distance.push_back(make_pair(it->first, sqrt(euclidean_difference)));
// Check if the result produced is a number. If not a number, its discarded
if (!isnan(((n * s_xy) - (s_x * s_y)) / (sqrt(((n * s_xsq) - pow(s_x, 2)) * ((n * s_ysq) - pow(s_y, 2))))))
pearson_distance.push_back(make_pair(it->first, ((n * s_xy) - (s_x * s_y)) / (sqrt(((n * s_xsq) - pow(s_x, 2)) * ((n * s_ysq) - pow(s_y, 2))))));
// Check if the result produced is a number. If not a number, its discarded
if (!isnan(s_xy / (sqrt(s_xsq) * sqrt(s_ysq))))
cosine_distance.push_back(make_pair(it->first, (s_xy / (sqrt(s_xsq) * sqrt(s_ysq)))));
manhattan_difference = 0.0;
euclidean_difference = 0.0;
}
sort(manhattan_distance.begin(), manhattan_distance.end(), ascending);
sort(euclidean_distance.begin(), euclidean_distance.end(), ascending);
sort(pearson_distance.begin(), pearson_distance.end(), descending);
sort(cosine_distance.begin(), cosine_distance.end(), descending);
// Print neighbors for Manhattan and Euclidean is commented out as they produce a long list
// print_neighbors(manhattan_distance, "Manhattan");
// print_neighbors(euclidean_distance, "Euclidean");
print_neighbors(pearson_distance, "Pearson");
print_neighbors(cosine_distance, "Cosine");
}
// Function to print the nearest neighbors
void recommendation::print_neighbors(vector<pair<string, float> > neighbors, string method)
{
int insert_counter = 0;
cout << "Nearest neighbors (" << method << ") : ";
for (vector<pair<string, float> >::iterator it = neighbors.begin(); it != neighbors.end(); ++it)
{
cout << it->first << " " << it->second << " | ";
if (insert_counter == 0)
{
if (method == "Manhattan")
manhattan_neighbor = it->first;
else if (method == "Euclidean")
euclidean_neighbor = it->first;
else if (method == "Pearson")
pearson_neighbor = it->first;
else if (method == "Cosine")
cosine_neighbor = it->first;
insert_counter++;
}
}
cout << endl;
}
// Function to recommend a book for the user
void recommendation::recommend(string name)
{
map<string, string> &user_data = book_data[name];
map<string, string> &m_neighbor_data = book_data[manhattan_neighbor];
map<string, string> &e_neighbor_data = book_data[euclidean_neighbor];
map<string, string> &p_neighbor_data = book_data[pearson_neighbor];
map<string, string> &c_neighbor_data = book_data[cosine_neighbor];
cout << "\nRecommendations (Manhattan) : " << endl;
print_result(user_data, m_neighbor_data);
cout << "\nRecommendations (Euclidean) : " << endl;
print_result(user_data, e_neighbor_data);
cout << "\nRecommendations (Pearson) : " << endl;
print_result(user_data, p_neighbor_data);
cout << "\nRecommendations (Cosine) : " << endl;
print_result(user_data, c_neighbor_data);
}
// Print out the top 20 books recommended for the user
void recommendation::print_result(map<string, string> user_data, map<string, string> neighbor_data)
{
int counter = 0;
for (map<string, string>::iterator it = neighbor_data.begin(); it != neighbor_data.end(); ++it)
{
if ((user_data.find(it->first) == user_data.end()) && (counter < 20))
{
cout << it->first << "\t" << book_details[it->first] << "\t" << it->second << "\n";
counter++;
}
}
}
| [
"tarunprasadg92@gmail.com"
] | tarunprasadg92@gmail.com |
bb32e57ae5fd4eb34d99ff527fd4bfb29db471de | f4f401a1749e558599906ed42ff52f4379574eee | /Source Code/Env.cpp | 1399eec78e084d9069f3014406eaad94e4b82559 | [] | no_license | SamBauter/MSDLang | 3f94dbac8169bc061ef3518e95342780717a1c23 | b43c81b58e4f783b2328699f231d2e8778590749 | refs/heads/master | 2022-04-19T07:35:53.412057 | 2020-04-18T03:41:31 | 2020-04-18T03:41:31 | 256,531,034 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 645 | cpp | //
// Env.cpp
// MSDLang
//
// Created by Samuel Bauter on 3/1/20.
// Copyright © 2020 U of U. All rights reserved.
//
#include "Env.hpp"
#include "Value.hpp"
#include <iostream>
PTR(Env) Env::empty = NEW(EmptyEnv)();
PTR(Val) EmptyEnv::lookup(std::string find_name){
throw std::runtime_error("free variable: " +find_name);
}
ExtendedEnv::ExtendedEnv(std::string name, PTR(Val) val, PTR(Env) rest){
this->name = name;
this->val = val;
this->rest = rest;
}
PTR(Val) ExtendedEnv::lookup(std::string find_name){
if(find_name == name){
return val;
}else{
return rest->lookup(find_name);
}
}
| [
"samuelbauter@gmail.com"
] | samuelbauter@gmail.com |
4b84deff7161ccc8058cffd63b77c276848296b3 | 2c3554cf6e8bd3f2b7f147bd0a07f391b2b938e1 | /cpp/inc/bond/ext/grpc/detail/unary_call_impl.h | 7790954ead7791ad0454998e53da95f11668ffd1 | [
"MIT"
] | permissive | trebconnell/bond | 0333519ac2d90c206444c8e9b5fec858f29e7d45 | 380b2d9e9680ed39e0c0a436e782c877b649b9c8 | refs/heads/master | 2021-05-07T14:32:14.382741 | 2017-11-04T00:08:30 | 2017-11-06T18:39:06 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,310 | h | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#pragma once
#ifdef _MSC_VER
#pragma warning (push)
#pragma warning (disable: 4100 4702)
#endif
#include <grpc++/grpc++.h>
#include <grpc++/impl/codegen/async_unary_call.h>
#include <grpc++/impl/codegen/status.h>
#include <grpc++/impl/codegen/server_context.h>
#ifdef _MSC_VER
#pragma warning (pop)
#endif
#include <bond/core/bonded.h>
#include <bond/ext/grpc/detail/io_manager_tag.h>
#include <boost/assert.hpp>
#include <boost/smart_ptr/intrusive_ptr.hpp>
#include <atomic>
#include <utility>
namespace bond { namespace ext { namespace gRPC { namespace detail {
/// @brief Implementation class that holds the state associated with a
/// single async, unary call.
///
/// Potentually three different objects participate in shared ownership
/// of instances of this class: the user-facing \ref unary_call and \ref
/// shared_unary_call objects, as well as this object itself.
///
/// To ensure that this instance stays alive while sending a response,
/// unary_call_impl creates itself with a ref count of 1, opposed to the
/// usual 0 that many boost::intrusive_ptr implementations use. When the
/// notification that the response has been sent is dequeued from the
/// completion queue, %invoke() calls %Release() on itself, decrementing
/// the ref count, and allowing the remaining unary_call and
/// shared_unary_call objects, if any, to control lifetime.
template <typename TRequest, typename TResponse>
class unary_call_impl final : io_manager_tag
{
public:
unary_call_impl() = default;
unary_call_impl(const unary_call_impl&) = delete;
unary_call_impl& operator=(const unary_call_impl&) = delete;
const grpc::ServerContext& context() const noexcept
{
return _context;
}
grpc::ServerContext& context() noexcept
{
return _context;
}
const TRequest& request() const noexcept
{
return _request;
}
TRequest& request() noexcept
{
return _request;
}
const grpc::ServerAsyncResponseWriter<bond::bonded<TResponse>>& responder() const noexcept
{
return _responder;
}
grpc::ServerAsyncResponseWriter<bond::bonded<TResponse>>& responder() noexcept
{
return _responder;
}
void Finish(const bond::bonded<TResponse>& msg, const grpc::Status& status)
{
bool wasResponseSent = _responseSentFlag.test_and_set();
if (!wasResponseSent)
{
_responder.Finish(msg, status, static_cast<void*>(this));
}
}
void FinishWithError(const grpc::Status& status)
{
bool wasResponseSent = _responseSentFlag.test_and_set();
if (!wasResponseSent)
{
_responder.FinishWithError(status, static_cast<void*>(this));
}
}
private:
void invoke(bool /* ok */) override
{
// The response has been sent, so we no longer need to keep
// ourselves alive: release the implicit initial refcount that
// this instance was constructed with.
Release(ReleaseTrySend::No);
}
enum class ReleaseTrySend
{
No,
Yes
};
void AddRef() noexcept
{
_refCount.fetch_add(1, std::memory_order_relaxed);
}
void Release(ReleaseTrySend trySend)
{
auto oldCount = _refCount.fetch_sub(1, std::memory_order_acq_rel);
switch (oldCount)
{
case 2:
// There are two possible cases when the old count can be 2.
//
// Case 2a (trySend == ReleaseTrySend::Yes): the last
// user reference has just gone away, but Finish was not
// called. In this case, we are responsible for sending
// an error response and decrementing the final ref
// count. FinishWithError will schedule the send of the
// error response, and notification of completion of the
// send via invoke() will decrement the final ref count.
// Since we hold the ref count ourselves, we will not
// get deleted until we're done sending.
//
// Case 2b (trySend == ReleaseTrySend::No): the user
// called Finish/FinishWithError and completion of
// sending that response has just happened via invoke(),
// AND there is still ONE user reference. In this case,
// the user reference could go away at any time and
// delete us, so we can't touch any part of this object.
// But we don't need to send anything anyway.
if (trySend == ReleaseTrySend::Yes)
{
FinishWithError({ grpc::StatusCode::INTERNAL, "An internal server error has occurred." });
}
break;
case 1:
delete this;
break;
default:
break;
}
}
friend void intrusive_ptr_add_ref(unary_call_impl* call) noexcept
{
call->AddRef();
}
friend void intrusive_ptr_release(unary_call_impl* call)
{
call->Release(ReleaseTrySend::Yes);
}
// A pointer to the context is passed to _responder when
// constructing it, so this needs to be declared before _responder.
grpc::ServerContext _context{};
TRequest _request{};
grpc::ServerAsyncResponseWriter<bond::bonded<TResponse>> _responder{ &_context };
std::atomic_flag _responseSentFlag{}; // Tracks whether any response has been sent yet.
// The ref count intentionally starts at 1, because this instance
// needs to keep itself alive until the response has finished being
// sent, regardless of whether there are any outstanding user
// references still alive.
std::atomic<size_t> _refCount{ 1 };
};
/// @brief Detail class that helps implement \ref unary_call and \ref
/// shared_unary_call.
template <typename TRequest, typename TResponse>
class unary_call_base
{
using impl_type = unary_call_impl<TRequest, TResponse>;
public:
void swap(unary_call_base& rhs) noexcept
{
using std::swap;
swap(_impl, rhs._impl);
}
/// @brief Get the server context for this call.
const grpc::ServerContext& context() const noexcept
{
return impl().context();
}
/// @brief Get the server context for this call.
grpc::ServerContext& context() noexcept
{
return impl().context();
}
/// @brief Get the request message for this call.
const TRequest& request() const noexcept
{
return impl().request();
}
/// @brief Get the request message for this call.
TRequest& request() noexcept
{
return impl().request();
}
/// @brief Responds to the client with the given message and status.
///
/// Only the first call to \p Finish or \p FinishWithError will be
/// honored.
void Finish(const TResponse& msg, const grpc::Status& status = grpc::Status::OK)
{
Finish(bond::bonded<TResponse>{ msg }, status);
}
/// @brief Responds to the client with the given message and status.
///
/// Only the first call to \p Finish or \p FinishWithError will be
/// honored.
void Finish(const bond::bonded<TResponse>& msg, const grpc::Status& status = grpc::Status::OK)
{
impl().Finish(msg, status);
}
/// @brief Responds to the client with the given status and no message.
///
/// Only the first call to \p Finish or \p FinishWithError will be
/// honored.
void FinishWithError(const grpc::Status& status)
{
impl().FinishWithError(status);
}
protected:
unary_call_base() = default;
explicit unary_call_base(boost::intrusive_ptr<impl_type> impl) noexcept
: _impl(std::move(impl))
{
BOOST_ASSERT(_impl);
}
explicit operator bool() const noexcept
{
return static_cast<bool>(_impl);
}
private:
impl_type& impl() noexcept
{
BOOST_ASSERT(_impl);
return *_impl;
}
const impl_type& impl() const noexcept
{
BOOST_ASSERT(_impl);
return *_impl;
}
boost::intrusive_ptr<impl_type> _impl;
};
} } } } //namespace bond::ext::gRPC::detail
| [
"me@tedstein.net"
] | me@tedstein.net |
f276672fb7cc3025afcf6613f7647ba7d48d602a | 6aee64c18e277886580b447a6bacb404fb7212ed | /参考/智能主动防御系统/应用程序代码/Defender825/LocalPage.cpp | 458cc90c11282647cffa17d59f0ddd4cefd4e651 | [] | no_license | 15831944/information_security_invitational | acbbcc3b4bd8d373bbd15d4fbf7fac85a8dac83b | 361441f76a238f24853e970631591740c83a0cf5 | refs/heads/master | 2022-04-17T10:13:45.025461 | 2017-05-23T09:43:38 | 2017-05-23T09:43:38 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 48,573 | cpp | // LocalPage.cpp : implementation file
#include "stdafx.h"
#include "defender.h"
#include "LoadcodeDlg.h"
#include "LocalPage.h"
#include "basic/Ado.h"
#include "net/winpcap.h"
#include "net/packet.h"
#include "net/md5.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//要连接的库
#pragma comment(lib,"Iphlpapi.lib")
#pragma comment(lib,"wpcap.lib")
#pragma comment(lib,"ws2_32.lib")
BOOL checknet=TRUE;
BOOL checkhost=TRUE;
//设备驱动句柄
HANDLE driverHandle=NULL;
LPSTR driverDosName=NULL;
UINT gnIDEvent=1;//定时器标识
//过滤开关
UCHAR ICMP_FILTER=1; //是否允许Ping入
UCHAR PACKET_FILTER=1; //是否进行数据包过滤
UCHAR ANTIARP=1; //是否启用ARP防火墙
UCHAR PLAYALLROLE=1; //是否伪装成所有不存活的主机
Adapter netcard[8];//网络适配器
CLocalPage *p_this=NULL;
//列表框指针
CComboBox *p_listAdapter=NULL;
HANDLE m_hNewAttactEvent;
HANDLE m_hCommEvent;
//拦截的攻击次数
UINT g_iDefenceTimes=0;
BOOL bUseCodeDb=FALSE;
//状态栏消息
#define UM_STATUS (WM_USER +12) //自定义状态栏消息
#define UM_MESSLIST (WM_USER +13) //实时信息列表消息
#define UM_PCOUNT (WM_USER +15) //更新已过滤的数据包数消息
//程序当前路径
extern char szCurrentDirectory[256];
//获取网卡相关信息
int GetAdapterInfor(Adapter *adapter);
//判断一块缓冲区是否为全0:全零返回TRUE,非全零返回FALSE
BOOL IsAllZero(unsigned char dat[],int length);
//设置过滤规则(驱动)
int SetFilterRules(UCHAR icmp_filter,UCHAR packet_filter,UCHAR antiarp);
//开始监听
void startlisten();
//监听线程函数
DWORD WINAPI ListenThreadFun( LPVOID lpParameter );
//定时更新存活主机列表
void CALLBACK EXPORT UpdateLiveHost(HWND hWnd,UINT nMsg,UINT nIDEvent,DWORD dwTime );
//向本接口所在的局域网中所有机器发送arp请求
DWORD WINAPI ArpRequestToAll(LPVOID lpParameter );
//数据包处理
void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data);
//发送 数据包
void sendpacket(Adapter * adapter,BYTE * packet,int size);
//发送网关信息(iP,mac)到驱动程序
int SendNetGateInfor(unsigned int netgateip,unsigned char netgatemac[6]);
//开启读取驱动发送的攻击日志信息线程
void StartReadAttackLog();
//读取驱动发送的攻击日志信息
DWORD WINAPI ReadAttackLog(LPVOID lpParameter);
//将收到的新日志信息写入注册表中
void WriteLogToMdb(char *logcontent);
//添加特征到数据库,并将新的特征发送给驱动程序
void InsertDB(char *shellcode);
//判断主机是否在伪装主机列表中
//参数: ip-要判断的主机IP(网络序)
//返回值: 存在-TRUE,不存在-FALSE
BOOL IsInCheateHostList(unsigned int ip);
//查询某不存活主机的某端口是否开放
//参数: ip- ip-要判断的主机IP(网络序) protocol-协议类型 port-要查询的端口(网络序)
//返回值: 找到-TRUE,未找到-FALSE
BOOL IsPortOpen(unsigned int ip,unsigned char protocol,unsigned short port);
//判断伪装主机是否接受ICMP
//参数: ip-要判断的主机IP(网络序)
//返回值: 开放-返回TTL值,不开放-0
unsigned char IsAcceptIcmp(unsigned int ip);
//计算TCP数据包校验和
void PacketCheckSum(unsigned char packet[]);
//获取特征码的数量
void GetShellCodeCount();
/////////////////////////////////////////////////////////////////////////////
// CLocalPage property page
IMPLEMENT_DYNCREATE(CLocalPage, CPropertyPage)
CLocalPage::CLocalPage() : CPropertyPage(CLocalPage::IDD)
{
//{{AFX_DATA_INIT(CLocalPage)
//}}AFX_DATA_INIT
}
CLocalPage::~CLocalPage()
{
}
void CLocalPage::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CLocalPage)
DDX_Control(pDX, IDC_ADAPTER_LIST, m_listAdapter);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CLocalPage, CPropertyPage)
//{{AFX_MSG_MAP(CLocalPage)
ON_CBN_SELCHANGE(IDC_ADAPTER_LIST, OnSelchangeAdapterList)
ON_WM_PAINT()
ON_WM_DESTROY()
ON_NOTIFY(NM_RCLICK, IDC_MESLIST, OnRclickMeslist)
ON_COMMAND(IDM_DELETE, OnDelete)
ON_COMMAND(IDM_DELETEALL, OnDeleteall)
ON_COMMAND(IDM_NETSHOW, OnNetshow)
ON_COMMAND(IDM_HOSTSHOW, OnHostshow)
ON_WM_CTLCOLOR()
//}}AFX_MSG_MAP
ON_MESSAGE(UM_MESSLIST,OnMessageListMessage)
ON_MESSAGE(UM_PCOUNT,OnMessagePcount)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CLocalPage message handlers
BOOL CLocalPage::OnInitDialog()
{
CPropertyPage::OnInitDialog();
p_listAdapter=&m_listAdapter;
p_this=this;
//初始化列表
ListView_SetExtendedListViewStyle(
((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->m_hWnd,
LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT
);
((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->InsertColumn(0, "时间",LVCFMT_LEFT,150);
((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->InsertColumn(1, "监控信息",LVCFMT_LEFT,600);
//设置过滤规则
SetFilterRules(ICMP_FILTER,PACKET_FILTER,ANTIARP);
memset(netcard,0,sizeof(Adapter) *8);
//获取网卡相关信息
if(GetAdapterInfor(&netcard[0]))
{
AfxMessageBox("获取网卡信息失败!");
PostQuitMessage(0);
}else
{
m_listAdapter.SetCurSel(0);
OnSelchangeAdapterList();
}
//启动监听线程
startlisten();
gnIDEvent=1; //计时器表示符
//启动定时更新存活主机列表定时器
this->SetTimer(gnIDEvent,50,UpdateLiveHost);
//开启读取驱动发送的攻击日志信息线程
StartReadAttackLog();
//显示统计信息-特征码数量
GetShellCodeCount();
return TRUE;
}
//显示该网络接口信息
void CLocalPage::OnSelchangeAdapterList()
{
Adapter * padapter=NULL;
int i=0;
char tempbuf[256];
struct in_addr in;
//获取当前网卡名称
memset(tempbuf,0,256);
this->GetDlgItemText(IDC_ADAPTER_LIST,tempbuf,256);
while(!IsAllZero((BYTE *)&netcard[i],sizeof(Adapter)))
{
if(!strcmp(netcard[i].name,tempbuf))
{
padapter=&netcard[i];
break;
}
i++;
}
if(!padapter) return;
//显示接口信息
in.S_un.S_addr=padapter->ipaddress;
//ip
this->SetDlgItemText(IDC_IPADDR,inet_ntoa(in));
in.S_un.S_addr=padapter->netmask;
//netmask
this->SetDlgItemText(IDC_NETMASK,inet_ntoa(in));
in.S_un.S_addr=padapter->netgate;
//net gate
this->SetDlgItemText(IDC_NETGATE,inet_ntoa(in));
memset(tempbuf,0,256);
sprintf(tempbuf,"%02x-%02x-%02x-%02x-%02x-%02x",
padapter->mac[0],
padapter->mac[1],
padapter->mac[2],
padapter->mac[3],
padapter->mac[4],
padapter->mac[5]);
//mac
this->SetDlgItemText(IDC_MACADDR,tempbuf);
}
void CLocalPage::OnPaint()
{
CPaintDC dc(this);
if(GetParent()->IsWindowVisible()==false)
{
this->ShowWindow(SW_HIDE);
return ;
}
//获取统计信息
GetStatistics();
}
//获取网卡相关信息
int GetAdapterInfor(Adapter *adapter)
{
PIP_ADAPTER_INFO pAdapterInfo;
PIP_ADAPTER_INFO pAdapter = NULL;
DWORD dwRetVal = 0;
ULONG ulOutBufLen;
int i=0;
UINT iplen;
pAdapterInfo=(PIP_ADAPTER_INFO)malloc(sizeof(IP_ADAPTER_INFO));
ulOutBufLen = sizeof(IP_ADAPTER_INFO);
// 第一次调用GetAdapterInfo获取ulOutBufLen大小
if (GetAdaptersInfo( pAdapterInfo, &ulOutBufLen) == ERROR_BUFFER_OVERFLOW)
{
free(pAdapterInfo);
pAdapterInfo = (IP_ADAPTER_INFO *) malloc (ulOutBufLen);
}
if ((dwRetVal = GetAdaptersInfo( pAdapterInfo, &ulOutBufLen)) == NO_ERROR) {
pAdapter = pAdapterInfo;
while (pAdapter&&i<7)
{
if(strlen(pAdapter->AdapterName)<200)
{
//ip
adapter->ipaddress=inet_addr(pAdapter->IpAddressList.IpAddress.String);
//netmask
adapter->netmask=inet_addr(pAdapter->IpAddressList.IpMask.String);
//netgate
adapter->netgate=inet_addr(pAdapter->GatewayList.IpAddress.String);
//网段内主机数
iplen=0xFFFFFFFF-ntohl(adapter->netmask);
//起始IP
adapter->ipstart=(ntohl(adapter->ipaddress) & ntohl(adapter->netmask))+1;
//结束IP
adapter->ipend=adapter->ipstart+iplen-2;
//如果不是拨号上网接口
if(adapter->ipstart<adapter->ipend)
{
//adapter name
strcpy(adapter->name,"rpcap://\\Device\\NPF_");
strcat(adapter->name,pAdapter->AdapterName);
p_listAdapter->AddString(adapter->name);
//mac
memcpy(adapter->mac,pAdapter->Address,6);
//将本机ip和mac发送给驱动程序
SendNetGateInfor(adapter->ipaddress,adapter->mac);
// livehostlist 初始化存活主机列表
CreateCollection(adapter->livehostlist);
adapter++;
i++;
}
else
//重置
memset(adapter,0,sizeof(Adapter));
}
pAdapter = pAdapter->Next;
}
}
else
return 1;
return 0;
}
//判断一块缓冲区是否为全0
//全零返回TRUE,非全零返回FALSE
BOOL IsAllZero(unsigned char dat[],int length)
{
int i=0;
for(i=0;i<length;i++)
{
if(dat[i]) return FALSE;
}
return TRUE;
}
//设置过滤规则
int SetFilterRules(UCHAR icmp_filter,UCHAR packet_filter,UCHAR antiarp)
{
unsigned char inBuffer[2]={0};
DWORD bytesReturned=0;
BOOL ret=0;
if(!driverHandle)//如果驱动设备没有打开
{
driverHandle = CreateFile(driverDosName,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if(driverHandle == INVALID_HANDLE_VALUE)
{
AfxMessageBox("打开驱动设备失败!");
return 1;
}
}
inBuffer[0]=icmp_filter;
ret=DeviceIoControl(driverHandle,
IADS_ICMP_FILTER,
inBuffer,
2,
NULL,
0,
&bytesReturned,
NULL);//同步进行
if(!ret) return 1;
inBuffer[0]=packet_filter;
ret=DeviceIoControl(driverHandle,
IADS_PACKET_FILTER,
inBuffer,
2,
NULL,
0,
&bytesReturned,
NULL);//同步进行
if(!ret) return 1;
inBuffer[0]=antiarp;
ret=DeviceIoControl(driverHandle,
IADS_ANTIARP,
inBuffer,
2,
NULL,
0,
&bytesReturned,
NULL);//同步进行
if(!ret) return 1;
return 0;
}
void startlisten()
{
// 开始监听本机所有的网络接口
HANDLE PThreads[8];
DWORD dwThreadId;
int i=0;
while(!IsAllZero((BYTE *)&netcard[i],sizeof(Adapter)))
{
//PostMessage(AfxGetMainWnd()->m_hWnd,WM_USER+12,(WPARAM)0,(LPARAM)"提示信息:正在建立监听线程...");
PThreads[i]=CreateThread(NULL,
0,
ListenThreadFun,
(LPVOID)&netcard[i],
0,
&dwThreadId);
i++;
}
for(;i;i--)
{
CloseHandle(PThreads[i-1]);
}
//PostMessage(AfxGetMainWnd()->m_hWnd,WM_USER+12,(WPARAM)0,(LPARAM)"提示信息:监听线程建立完成!");
}
//监听线程函数
DWORD WINAPI ListenThreadFun(
LPVOID lpParameter // thread data
)
{
Adapter *adapter=(Adapter *)lpParameter;
char errbuf[PCAP_ERRBUF_SIZE];
//打开适配器
if(!adapter->fp)//如果该接口没有打开过
{
if ((adapter->fp= pcap_open(adapter->name, // 设备名
65536, // 要捕捉的数据包的部分
PCAP_OPENFLAG_PROMISCUOUS, // 混杂模式
1000, // 读取超时时间
NULL, // 远程机器验证
errbuf // 错误缓冲池
)) == NULL)
{
PostMessage(AfxGetMainWnd()->m_hWnd,WM_USER+12,(WPARAM)0,(LPARAM)"提示信息:打开适配器出错!");
return 0;
}
}
pcap_loop(adapter->fp, 0, packet_handler, (unsigned char *)lpParameter);
return 0;
}
//数据包处理
void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data)
{
Adapter * adapter=(Adapter *)param;//数据包来自该接口
//已处理数据包数+1
if(PACKET_FILTER)
PostMessage(p_this->m_hWnd,UM_PCOUNT,(WPARAM)0,(LPARAM)0);
if(adapter->scanliveover) //扫描该接口存活主机结束
{
//删除所有失活主机
DeleteFlagZNode(adapter->livehostlist);
}
Dlc_Header *dlc_header;
dlc_header=(Dlc_Header *)pkt_data;
switch(ntohs(dlc_header->ethertype))//判断是IP包还是ARP包
{
case 0x0806://arp包
{
Arp_Frame *arp_frame;
arp_frame=(Arp_Frame *)(pkt_data + sizeof(Dlc_Header));
//如果dest ip与本机不在同一网段则不予处理
if(ntohl(arp_frame->targ_prot_addr)<adapter->ipstart
||ntohl(arp_frame->targ_prot_addr)>adapter->ipend
) return;
if(ntohs(arp_frame->flag)==0x01)//arp request
{
//开机arp广播 srcip=destip
if(arp_frame->send_prot_addr==arp_frame->targ_prot_addr)
{
InsertColletion(adapter->livehostlist,arp_frame->send_prot_addr);
return;
}
if(adapter->hostlistok)//如果存活主机列表已准备好
{
//如果请求的是不存活主机(ip),并且不是本程序的其它实例所发,并且不是发给网关的
//并且伪装主机配置文件中有该主机,则给予虚假应答
if(!FindNode(adapter->livehostlist,arp_frame->targ_prot_addr)
&&(arp_frame->padding)[0]!='x'
&&(arp_frame->padding)[1]!='d'
&&arp_frame->targ_prot_addr!=adapter->netgate
&&IsInCheateHostList(arp_frame->targ_prot_addr))
{
struct in_addr in,in2;
char szMesBuf[256]={0};
//状态栏显示
PostMessage(AfxGetMainWnd()->m_hWnd,UM_STATUS,
(WPARAM)0,(LPARAM)"提示信息:系统发现向不存活主机发起的ARP请求,给予了虚假应答!");
in.S_un.S_addr=arp_frame->send_prot_addr;
in2.S_un.S_addr=arp_frame->targ_prot_addr;
strcpy(szMesBuf,"系统发现主机");
strcat(szMesBuf,inet_ntoa(in));
strcat(szMesBuf,"向不存活主机");
strcat(szMesBuf,inet_ntoa(in2));
strcat(szMesBuf,"发出ARP请求,并给予了虚假应答!");
//实时信息栏显示
if(checknet)
PostMessage(p_this->m_hWnd,UM_MESSLIST,(WPARAM)0,(LPARAM)szMesBuf);
//构造应答数据包
ARP_Packet arp_packet;
//dest mac
memcpy((BYTE *)arp_packet.dlcheader.desmac,(BYTE *)dlc_header->srcmac,6);
//src mac
memcpy((BYTE *)arp_packet.dlcheader.srcmac,(BYTE *)adapter->mac,6);
//ethertype
arp_packet.dlcheader.ethertype=htons(0x0806);
arp_packet.arpframe.flag=htons(0x02);
arp_packet.arpframe.hw_addr_len=0x06;
arp_packet.arpframe.prot_addr_len=0x04;
arp_packet.arpframe.hw_type=htons(0x01);
arp_packet.arpframe.prot_type=htons(0x0800);
//arp src mac
memcpy((BYTE *)arp_packet.arpframe.send_hw_addr,(BYTE *)adapter->mac,6);
//arp dest mac
memcpy((BYTE *)arp_packet.arpframe.targ_hw_addr,(BYTE *)dlc_header->srcmac,6);
//arp src ip
arp_packet.arpframe.send_prot_addr=arp_frame->targ_prot_addr;
//arp dest ip
arp_packet.arpframe.targ_prot_addr=arp_frame->send_prot_addr;
//在附加字节区 加入本程序的标志
arp_packet.arpframe.padding[0]='x';
arp_packet.arpframe.padding[1]='d';
//发送应答
sendpacket(adapter,(BYTE *)&arp_packet,sizeof(ARP_Packet));
return;
}
}
return;
}
else if(ntohs(arp_frame->flag)==0x02)//arp response
{
//如果是发给本机的应答
if(arp_frame->targ_prot_addr==adapter->ipaddress)
{
//如果是网关的应答,则获取其mac地址
if(arp_frame->send_prot_addr==adapter->netgate
&&!adapter->netgatemac[0]
&&!adapter->netgatemac[1]
&&!adapter->netgatemac[2]
&&!adapter->netgatemac[3]
&&!adapter->netgatemac[4]
&&!adapter->netgatemac[5])
{
//在窗体上显示网关MAC地址
char tempbuf[20];
memset(tempbuf,0,20);
sprintf(tempbuf,"%02x-%02x-%02x-%02x-%02x-%02x",
arp_frame->send_hw_addr[0],
arp_frame->send_hw_addr[1],
arp_frame->send_hw_addr[2],
arp_frame->send_hw_addr[3],
arp_frame->send_hw_addr[4],
arp_frame->send_hw_addr[4]);
p_this->SetDlgItemText(IDC_NETGATEMAC,tempbuf);
memcpy(adapter->netgatemac,arp_frame->send_hw_addr,6);
//发送网关信息给驱动程序
SendNetGateInfor(arp_frame->send_prot_addr,arp_frame->send_hw_addr);
}
InsertColletion(adapter->livehostlist,arp_frame->send_prot_addr);
return;
}
return;
}
break;
}
case 0x0800://ip包
{
Ip_Header *ip_header;
ip_header=(Ip_Header *)(pkt_data + sizeof(Dlc_Header));
//只处理dest mac为本接口而dest ip非本接口的数据包
if(ntohl(ip_header->destIP)<adapter->ipstart||ntohl(ip_header->destIP)>adapter->ipend) return;
if(ip_header->destIP==adapter->ipaddress) return;
if(dlc_header->desmac[0]!=adapter->mac[0]
||dlc_header->desmac[1]!=adapter->mac[1]
||dlc_header->desmac[2]!=adapter->mac[2]
||dlc_header->desmac[3]!=adapter->mac[3]
||dlc_header->desmac[4]!=adapter->mac[4]
||dlc_header->desmac[5]!=adapter->mac[5]
) return;
switch(ip_header->proto)
{
case 0x01: //icmp
{
unsigned char ucTtl=0;
Icmp_Packet *picmp_packet;
picmp_packet=(Icmp_Packet *)pkt_data;
//查询配置文件
ucTtl=IsAcceptIcmp(picmp_packet->ip_header.destIP);
if(!ucTtl) return;
//构造icmp包
Icmp_Packet icmp_packet;
//dest mac
memcpy((BYTE *)icmp_packet.dlc_header.desmac,(BYTE *)dlc_header->srcmac,6);
//src mac
memcpy((BYTE *)icmp_packet.dlc_header.srcmac,(BYTE *)adapter->mac,6);
//ether type
icmp_packet.dlc_header.ethertype=dlc_header->ethertype;
icmp_packet.ip_header.ver_len=picmp_packet->ip_header.ver_len;
icmp_packet.ip_header.ident=picmp_packet->ip_header.ident;
icmp_packet.ip_header.proto=picmp_packet->ip_header.proto;
icmp_packet.ip_header.frag_and_flags=picmp_packet->ip_header.frag_and_flags;
icmp_packet.ip_header.destIP=picmp_packet->ip_header.sourceIP;
icmp_packet.ip_header.sourceIP=picmp_packet->ip_header.destIP;
icmp_packet.ip_header.tos=picmp_packet->ip_header.tos;
icmp_packet.ip_header.ttl=ucTtl;
icmp_packet.ip_header.total_len=picmp_packet->ip_header.total_len;
icmp_packet.ip_header.checksum=0;
icmp_packet.ip_header.checksum=checksum((USHORT *)((BYTE *)&icmp_packet+14),20);
icmp_packet.icmp_header.i_code=(BYTE)0;
icmp_packet.icmp_header.i_id=picmp_packet->icmp_header.i_id;
icmp_packet.icmp_header.i_seq=picmp_packet->icmp_header.i_seq;
icmp_packet.icmp_header.i_type=0;
//icmp_packet.icmp_header.timestamp=::GetTickCount();
icmp_packet.icmp_header.i_cksum=0;
memcpy((BYTE *)icmp_packet.icmp_header.padding,(BYTE *)picmp_packet->icmp_header.padding,32);
icmp_packet.icmp_header.i_cksum=checksum((USHORT *)((BYTE *)&icmp_packet+14+20),sizeof(Icmp_Header));
sendpacket(adapter,(BYTE *)&icmp_packet,sizeof(Icmp_Packet));
break;
}
case 0x06://tcp
{
BYTE syn=0,ack=0;//同步确认标志位
Tcp_Header *ptcp_header;
ptcp_header=(Tcp_Header *)(pkt_data+14+20);//tcp头
//目的端口是否开放
if(!IsPortOpen(ip_header->destIP,0x06,ptcp_header->dstport)) return;
//提取syn标志位
if(((ptcp_header->flags) & 2)==2)
syn=1;
else
syn=0;
//提取ack标志位
if(((ptcp_header->flags) & 16)==16)
ack=1;
else
ack=0;
//回应第二次握手
if(syn==1
&&ack==0
&&ptcp_header->acknum==0)
{
unsigned char tcpbuf[66];
unsigned char ucTcpReplyOption[13]={0x02,0x04,0x05,0xb4,0x01,0x01,0x04,0x02,0x01,0x03,0x03,0x02,0x00};
memset(tcpbuf,0,66);
memcpy(tcpbuf,pkt_data,66);
//dest mac
memcpy((BYTE *)(((Dlc_Header *)tcpbuf)->desmac),(BYTE *)(dlc_header->srcmac),6);
//src mac
memcpy((BYTE *)(((Dlc_Header *)tcpbuf)->srcmac),(BYTE *)(dlc_header->desmac),6);
//src ip
((Ip_Header *)(tcpbuf+14))->sourceIP=ip_header->destIP;
//dest ip
((Ip_Header *)(tcpbuf+14))->destIP=ip_header->sourceIP;
//checksum
((Ip_Header *)(tcpbuf+14))->checksum=0;
//ip ttl
((Ip_Header *)(tcpbuf+14))->ttl=80;
//src port
((Tcp_Header *)(tcpbuf+14+20))->srcport=ptcp_header->dstport;
//dest port
((Tcp_Header *)(tcpbuf+14+20))->dstport=ptcp_header->srcport;
//an
((Tcp_Header *)(tcpbuf+14+20))->acknum=htonl(ntohl(ptcp_header->seqnum)+1);
//sn
((Tcp_Header *)(tcpbuf+14+20))->seqnum=htonl(ntohl(ptcp_header->seqnum)+10086);
//flag
((Tcp_Header *)(tcpbuf+14+20))->flags=0x12;
//window
((Tcp_Header *)(tcpbuf+14+20))->window=htons(2920);
//TCP Option
memcpy(tcpbuf+14+20+20,ucTcpReplyOption,12);
//计算校验和
PacketCheckSum(tcpbuf);
//发送
sendpacket(adapter,(BYTE *)tcpbuf,66);
return;
}
else if(ack==1&&syn==0)
{
//两次握手后客户端发送的数据包
BYTE * pscode;//数据包特征部分
int codelen;//特征数据长度
codelen=(ntohs(ip_header->total_len))-((ip_header->ver_len) & 15)*4-((ptcp_header->dataoff)>>4)*4;
//如果附加数据太短则不处理
if(codelen<=10) return;
pscode=(BYTE *)malloc(codelen);
memcpy(pscode,pkt_data+14+((ip_header->ver_len) & 15)*4+((ptcp_header->dataoff)>>4)*4,codelen);
//如果是发给80端口
if(80==ntohs(ptcp_header->dstport))
{
//取得http报文(即pscode)
if(!strncmp((char *)pscode,"GET",3)||!strncmp((char *)pscode,"POST",4))
{
char szCrlf[5]={'\x0d','\x0a','\x0d','\x0a',0};
char *pCrlf=NULL;
pCrlf=strstr((char *)pscode,szCrlf);
//如果HTTP报文中有附加数据
if(pCrlf)
{
if((unsigned char)*(pCrlf+4))
{
//计算特征数据的摘要值
MD5_CTX cmd5;
char result[33];
cmd5.MD5Update(pscode,codelen);
cmd5.MD5Final(result);
//将计算的特征值结果存入数据库
InsertDB(result);
}
}
//应答HTTP请求
unsigned int scriptlen=0;
unsigned char *scriptbuf=NULL;
unsigned char *tcpbuf=NULL;
unsigned int packetsize=0;
CFile cfile;
if(cfile.Open("iisresponse.scri",CFile::modeRead))
{
scriptlen=cfile.GetLength();
//为读取脚本文件分配内存
scriptbuf=(unsigned char *)malloc(scriptlen);
//分配内存失败
if(!scriptbuf)
{
cfile.Close();
return;
}
memset(scriptbuf,0,scriptlen);
//读取脚本文件内容
cfile.Read(scriptbuf,scriptlen);
//计算应答数据包的总长度
packetsize=scriptlen+14+((ip_header->ver_len) & 15)*4+((ptcp_header->dataoff)>>4)*4+4;
//为应答数据包分配内存
tcpbuf=(unsigned char *)malloc(packetsize);
if(!tcpbuf)
{
cfile.Close();
return;
}
memset(tcpbuf,0,packetsize);
//将请求报文的协议头部分拷贝过来
memcpy(tcpbuf,pkt_data,14+((ip_header->ver_len) & 15)*4+((ptcp_header->dataoff)>>4)*4);
//复制应答HTTP报文
memcpy(tcpbuf+14+((ip_header->ver_len) & 15)*4+((ptcp_header->dataoff)>>4)*4,
scriptbuf,scriptlen);
//dest mac
memcpy((BYTE *)(((Dlc_Header *)tcpbuf)->desmac),(BYTE *)(dlc_header->srcmac),6);
//src mac
memcpy((BYTE *)(((Dlc_Header *)tcpbuf)->srcmac),(BYTE *)(dlc_header->desmac),6);
//src ip
((Ip_Header *)(tcpbuf+14))->sourceIP=ip_header->destIP;
//dest ip
((Ip_Header *)(tcpbuf+14))->destIP=ip_header->sourceIP;
//total_len
((Ip_Header *)(tcpbuf+14))->total_len=htons(packetsize-14);
//src port
((Tcp_Header *)(tcpbuf+14+20))->srcport=ptcp_header->dstport;
//dest port
((Tcp_Header *)(tcpbuf+14+20))->dstport=ptcp_header->srcport;
//an
((Tcp_Header *)(tcpbuf+14+20))->acknum=htonl(ntohl(ptcp_header->seqnum)+1);
//sn
((Tcp_Header *)(tcpbuf+14+20))->seqnum=htonl(ntohl(ptcp_header->seqnum)+10086);
//计算校验和
PacketCheckSum(tcpbuf);
//发送
sendpacket(adapter,(BYTE *)tcpbuf,packetsize);
}
cfile.Close();
return;
}
}
//计算特征数据的摘要值
MD5_CTX cmd5;
char result[33]={0};
cmd5.MD5Update(pscode,codelen);
cmd5.MD5Final(result);
//将计算的特征值结果存入数据库
InsertDB(result);
return;
}
break;
}
case 0x11: //udp
{
Udp_Header *pudp_header=NULL;
pudp_header=(Udp_Header *)(pkt_data+14+((ip_header->ver_len) & 15)*4);//udp头
//目的端口是否开放
if(!IsPortOpen(ip_header->destIP,0x11,pudp_header->dstport)) return;
BYTE * pscode=NULL;//数据包特征部分
int codelen;//特征数据长度
codelen=(ntohs(ip_header->total_len))-((ip_header->ver_len) & 15)*4-8;
//如果附加数据太短则不处理
if(codelen<=10) return;
pscode=(BYTE *)malloc(codelen);
if(!pscode) return;
memset(pscode,0,sizeof(BYTE)*codelen);
memcpy(pscode,pkt_data+14+((ip_header->ver_len) & 15)*4+8,codelen);
//计算特征数据的摘要值
MD5_CTX cmd5;
char result[33]={0};
cmd5.MD5Update(pscode,codelen);
cmd5.MD5Final(result);
//将计算的特征值结果存入数据库
/*
if(!bUseCodeDb)
InsertDB(result);*/
free(pscode);
break;
}
default:
break;
}
return;
}
default://其它包,暂不处理
return;
}
return;
}
//发送 数据包
void sendpacket(Adapter * adapter,BYTE * packet,int size)
{
char errbuf[PCAP_ERRBUF_SIZE];
//打开适配器
if(!adapter->fp) //如果该接口没有被打开过
{
if ((adapter->fp= pcap_open(adapter->name, // 设备名
100, // 要捕捉的数据包的部分
PCAP_OPENFLAG_PROMISCUOUS, // 混杂模式
1000, // 读取超时时间
NULL, // 远程机器验证
errbuf // 错误缓冲池
)) == NULL)
{
PostMessage(AfxGetMainWnd()->m_hWnd,WM_USER+12,(WPARAM)0,(LPARAM)"提示信息:打开适配器出错!");
return;
}
}
//发送arp request数据包
if (pcap_sendpacket(adapter->fp, (BYTE *)packet, size) != 0)
{
PostMessage(AfxGetMainWnd()->m_hWnd,WM_USER+12,(WPARAM)0,(LPARAM)"提示信息:发送数据包出错!");
}
return;
}
//发送网关信息(iP,mac)到驱动程序
//参数:(netgateip,网关ip,netgatemac,网关mac)
//返回值:成功返回0,失败返回1
int SendNetGateInfor(unsigned int netgateip,unsigned char netgatemac[6])
{
HostInfor hostinfor;
BOOL ret=0;
DWORD bytesReturned=0;
memset(&hostinfor,0,sizeof(HostInfor));
hostinfor.ip=netgateip;
memcpy(hostinfor.mac,netgatemac,6);
if(!driverHandle)//如果驱动设备没有打开
{
driverHandle = CreateFile(driverDosName,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if(driverHandle == INVALID_HANDLE_VALUE)
{
AfxMessageBox("打开驱动设备失败!");
return 1;
}
}
ret=DeviceIoControl(driverHandle,
IADS_DRIVER_NETGATE,
(unsigned char *)&hostinfor,
sizeof(HostInfor),
NULL,
0,
&bytesReturned,
NULL //同步进行
);
if(!ret) return 1;
return 0;
}
//添加特征到数据库,并将新的特征发送给驱动程序
void InsertDB(char *shellcode)
{
int count=0;
count=p_this->GetDlgItemInt(IDC_TESTCOUNT);
p_this->SetDlgItemInt(IDC_TESTCOUNT,count+1);
bUseCodeDb=TRUE;
DWORD bytesReturned=0;
CString csSql=_T("");
CADODatabase* pAdoDb = new CADODatabase();
if(!pAdoDb) return;
CString strConnection = _T("");
SetCurrentDirectory(szCurrentDirectory);
strConnection = _T("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=code.mdb");
pAdoDb->SetConnectionString(strConnection);
if(pAdoDb->Open())
{
CADORecordset* pAdoRs = new CADORecordset(pAdoDb);
if(!pAdoRs)
{
pAdoDb->Close();
return;
}
csSql="select * from shellcode where shellcode ='";
csSql=csSql+shellcode;
csSql=csSql+"'";
if(pAdoRs->Open(csSql, CADORecordset::openQuery))
{
if(pAdoRs->IsEOF()) //新特征码
{
pAdoRs->AddNew();
pAdoRs->SetFieldValue("shellcode",_variant_t(shellcode));
pAdoRs->Update();
pAdoRs->Close();
if(driverHandle)
{
//将新的特征发送给驱动程序
DeviceIoControl(driverHandle,
IADS_DRIVER_ADDCODE,
(LPVOID)shellcode,
32,
NULL,
0,
&bytesReturned,
NULL //同步进行
);
}
//状态栏显示
PostMessage(AfxGetMainWnd()->m_hWnd,WM_USER+12,(WPARAM)0,(LPARAM)"提示信息:发现新的特征,已入特征库!");
//实时信息显示
if(checknet)
PostMessage(p_this->m_hWnd,UM_MESSLIST,(WPARAM)0,(LPARAM)"提示信息:发现新的特征,已入特征库!");
//统计信息 特征码数量+1
unsigned int uiScount=0;
uiScount=p_this->GetDlgItemInt(IDC_SCCOUNT);
p_this->SetDlgItemInt(IDC_SCCOUNT,++uiScount);
}
pAdoRs->Close();
}
delete pAdoRs;
pAdoDb->Close();
}
else
{
MessageBox(0,"写入特征库失败!","智能主动防御系统",MB_OK);
}
delete pAdoDb;
bUseCodeDb=FALSE;
return;
}
//开启读取驱动发送的攻击日志信息线程
void StartReadAttackLog()
{
HANDLE PThread;//线程句柄
DWORD dwThreadId;
PThread=CreateThread(NULL,
0,
ReadAttackLog,
NULL,
0,
&dwThreadId);
CloseHandle(PThread);//关闭线程句柄
return;
}
//读取驱动发送的攻击日志信息
DWORD WINAPI ReadAttackLog(
LPVOID lpParameter // thread data
)
{
DWORD bytesReturned=0;
BOOL ret=0;
Attack_Infor attack_infor;
struct in_addr in;
char tempbuf[100];
if(!driverHandle)//如果驱动设备没有打开
{
driverHandle = CreateFile(driverDosName,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if(driverHandle == INVALID_HANDLE_VALUE)
{
return 1;
}
}
//创建通信事件
m_hCommEvent = CreateEvent(NULL, false, false, NULL);
//传递通信事件到驱动
DeviceIoControl(driverHandle,
IO_REFERENCE_EVENT,
(LPVOID)m_hCommEvent,
0,
NULL,
0,
&bytesReturned,
NULL);
while(1)
{
//如果不进行数据包过滤,则不用读取日志
if (!PACKET_FILTER) continue;
WaitForSingleObject(m_hCommEvent, INFINITE);
memset(&attack_infor,0,sizeof(Attack_Infor));
//读取新的日志
ret=DeviceIoControl(driverHandle,
IADS_NEWATTACK_EVENT,
NULL,
0,
(LPVOID)&attack_infor,
sizeof(Attack_Infor),
&bytesReturned,
NULL);//同步进行,驱动不返回就阻塞
if(!ret) continue;
//告警信息
in.S_un.S_addr=attack_infor.srcip;
g_iDefenceTimes++;
memset(tempbuf,0,100);
if (attack_infor.flag==1)
sprintf(tempbuf,"提示信息:系统已成功拦截%d次攻击! 源IP:%s 包类型:%s 特征码:%s",g_iDefenceTimes
,inet_ntoa(in),"ARP",attack_infor.code);
else if(attack_infor.flag==2)
sprintf(tempbuf,"提示信息:系统已成功拦截%d次攻击! 源IP:%s 包类型:%s 特征码:%s",g_iDefenceTimes
,inet_ntoa(in),"TCP",attack_infor.code);
else
sprintf(tempbuf,"提示信息:系统已成功拦截%d次攻击! 源IP:%s 包类型:%s 特征码:%s",g_iDefenceTimes
,inet_ntoa(in),"UDP",attack_infor.code);
//将驱动返回的数据写入日志数据库
WriteLogToMdb(tempbuf);
//状态栏提示
PostMessage(AfxGetMainWnd()->m_hWnd,WM_USER+12,(WPARAM)0,(LPARAM)tempbuf);
//实时信息显示
if(checknet)
PostMessage(p_this->m_hWnd,UM_MESSLIST,(WPARAM)0,(LPARAM)tempbuf);
}
return 0;
}
//将新日志信息写入数据库
void WriteLogToMdb(char *logcontent)
{
CADODatabase* pAdoDb = new CADODatabase();
CString strConnection = _T("");
SetCurrentDirectory(szCurrentDirectory);
strConnection = _T("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=log.mdb");
pAdoDb->SetConnectionString(strConnection);
if(pAdoDb->Open())
{
CADORecordset* pAdoRs = new CADORecordset(pAdoDb);
if(pAdoRs->Open("iadslog", CADORecordset::openTable))
{
pAdoRs->AddNew();
pAdoRs->SetFieldValue("log_content",_variant_t(logcontent));
pAdoRs->Update();
pAdoRs->Close();
}
delete pAdoRs;
pAdoDb->Close();
}
else
{
MessageBox(0,"写入日志失败!","智能主动防御系统",MB_OK);
}
delete pAdoDb;
return;
}
//定时更新存活主机列表
void CALLBACK EXPORT UpdateLiveHost(
HWND hWnd,
UINT nMsg,
UINT nIDEvent,
DWORD dwTime
){
p_this->KillTimer(gnIDEvent);//停止计时器
HANDLE PThreads[8];//线程句柄
DWORD dwThreadId;
int i=0;
while(!IsAllZero((BYTE *)&netcard[i],sizeof(Adapter)))
{
PostMessage(AfxGetMainWnd()->m_hWnd,WM_USER+12,(WPARAM)0,(LPARAM)"提示信息:正在扫描存活主机...");
netcard[i].scanliveover=FALSE; //本次扫描未结束
netcard[i].ipnow=netcard[i].ipstart; //扫描起始IP
//存活主机列表 扫描标志复位
ResetNodeFlag(netcard[i].livehostlist);
PThreads[i]=CreateThread(NULL,
0,
ArpRequestToAll,
(LPVOID)&netcard[i],
0,
&dwThreadId);
i++;
}
for(;i;i--)
{
CloseHandle(PThreads[i-1]);//关闭线程句柄
}
return;
}
//向本接口所在的局域网中所有机器发送arp request
DWORD WINAPI ArpRequestToAll(
LPVOID lpParameter // thread data
)
{
Adapter * adapter=(Adapter *)lpParameter ;//数据包来自该接口
ARP_Packet arp_packet;
memset((BYTE *)&arp_packet,0,sizeof(ARP_Packet));
//destmac
memset(arp_packet.dlcheader.desmac,0xFF,6);
//srcmac
memcpy(arp_packet.dlcheader.srcmac,adapter->mac,6);
//ethertype
arp_packet.dlcheader.ethertype=htons(0x0806);
arp_packet.arpframe.flag=htons(0x01);
arp_packet.arpframe.hw_addr_len=0x06;
arp_packet.arpframe.prot_addr_len=0x04;
arp_packet.arpframe.hw_type=htons(0x01);
arp_packet.arpframe.prot_type=htons(0x0800);
memcpy(arp_packet.arpframe.send_hw_addr,adapter->mac,6);
arp_packet.arpframe.send_prot_addr=adapter->ipaddress;
//在附加字节区 加入本程序的标志
arp_packet.arpframe.padding[0]='x';
arp_packet.arpframe.padding[1]='d';
while(adapter->ipnow<=adapter->ipend)
{
arp_packet.arpframe.targ_prot_addr=htonl(adapter->ipnow);
sendpacket(adapter,(BYTE *)&arp_packet,sizeof(ARP_Packet));
if((adapter->ipnow)>=(adapter->ipend))
{
int i=0;
BOOL flag=TRUE;
Sleep(2000);
//本接口本次扫描结束
adapter->scanliveover=TRUE;
//本接口存活主机列表准备完毕
if(!adapter->hostlistok)
adapter->hostlistok=TRUE;
while(!IsAllZero((BYTE *)&netcard[i],sizeof(Adapter)))
{
if(!netcard[i].scanliveover)
{
flag=FALSE;
break;
}
i++;
}
//如果所有接口都扫描结束,则恢复定时器
if(flag)
{
PostMessage(AfxGetMainWnd()->m_hWnd,WM_USER+12,(WPARAM)0,(LPARAM)"提示信息:扫描存活主机完毕!");
p_this->SetTimer(gnIDEvent,UPDATE_LIVEHOST_INTERVAL,UpdateLiveHost);
}
::ExitThread(0);
}
(adapter->ipnow)++;
}
return 0;
}
//判断主机是否在伪装主机列表中
//参数: ip-要判断的主机IP(网络序)
//返回值: 存在-TRUE,不存在-FALSE
BOOL IsInCheateHostList(unsigned int ip)
{
CString csSql=_T("");
struct in_addr in;
//如果伪装所有不存活主机开关已打开
if(PLAYALLROLE) return TRUE;
CADODatabase* pAdoDb = new CADODatabase();
CString strConnection = _T("");
SetCurrentDirectory(szCurrentDirectory);
strConnection = _T("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=CheateSetting.mdb");
pAdoDb->SetConnectionString(strConnection);
if(pAdoDb->Open())
{
//加载IP列表
CADORecordset* pAdoRs = new CADORecordset(pAdoDb);
in.S_un.S_addr=ip;
csSql.Format("select * from host where host_ip='%s'",inet_ntoa(in));
if(pAdoRs->Open(csSql, CADORecordset::openQuery))
{
if(!pAdoRs->IsEOF())
{
pAdoRs->Close();
delete pAdoRs;
pAdoDb->Close();
delete pAdoDb;
return TRUE;
}
pAdoRs->Close();
}
delete pAdoRs;
pAdoDb->Close();
}
else
{
::MessageBox(0,"打开数据库失败!","高级设置",MB_OK);
}
delete pAdoDb;
return FALSE;
}
//判断伪装主机是否接受ICMP
//参数: ip-要判断的主机IP(网络序)
//返回值: 开放-返回TTL值,不开放-0
unsigned char IsAcceptIcmp(unsigned int ip)
{
CString csSql=_T("");
struct in_addr in;
//如果伪装所有不存活主机开关已打开
if(PLAYALLROLE) return 128;
CADODatabase* pAdoDb = new CADODatabase();
CString strConnection = _T("");
SetCurrentDirectory(szCurrentDirectory);
strConnection = _T("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=CheateSetting.mdb");
pAdoDb->SetConnectionString(strConnection);
if(pAdoDb->Open())
{
//加载IP列表
CADORecordset* pAdoRs = new CADORecordset(pAdoDb);
in.S_un.S_addr=ip;
csSql.Format("select * from [host] where host_ip='%s'",inet_ntoa(in));
if(pAdoRs->Open(csSql, CADORecordset::openQuery))
{
if(!pAdoRs->IsEOF())
{
int iIcmpAccept=0;
CString szOs=_T("");
int ttl=0;
pAdoRs->GetFieldValue("host_icmp",iIcmpAccept);
pAdoRs->GetFieldValue("host_os",szOs);
if(iIcmpAccept)
{
pAdoRs->Close();
//取得操作系统对应的TTL值
csSql.Format("select * from [os] where os_name='%s'",szOs);
if(pAdoRs->Open(csSql, CADORecordset::openQuery))
{
if(!pAdoRs->IsEOF())
{
pAdoRs->GetFieldValue("os_ttl",ttl);
}
}
delete pAdoRs;
pAdoDb->Close();
delete pAdoDb;
return (unsigned char)ttl;
}
}
pAdoRs->Close();
}
delete pAdoRs;
pAdoDb->Close();
}
else
{
::MessageBox(0,"打开数据库失败!","高级设置",MB_OK);
}
delete pAdoDb;
return 0;
}
//查询某不存活主机的某端口是否开放
//参数: ip- ip-要判断的主机IP(网络序) protocol-协议类型 port-要查询的端口(网络序)
//返回值: 找到-TRUE,未找到-FALSE
BOOL IsPortOpen(unsigned int ip,unsigned char protocol,unsigned short port)
{
CString csSql=_T("");
struct in_addr in;
//如果伪装所有不存活主机开关已打开
if(PLAYALLROLE) return TRUE;
CADODatabase* pAdoDb = new CADODatabase();
CString strConnection = _T("");
SetCurrentDirectory(szCurrentDirectory);
strConnection = _T("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=CheateSetting.mdb");
pAdoDb->SetConnectionString(strConnection);
if(pAdoDb->Open())
{
CADORecordset* pAdoRs = new CADORecordset(pAdoDb);
in.S_un.S_addr=ip;
csSql.Format("select * from [port] where port_ip='%s' and port_number=%d and port_protocol=%d and port_state=1",
inet_ntoa(in),ntohs(port),protocol);
if(pAdoRs->Open(csSql, CADORecordset::openQuery))
{
if(!pAdoRs->IsEOF())
{
pAdoRs->Close();
delete pAdoRs;
pAdoDb->Close();
delete pAdoDb;
return TRUE;
}
pAdoRs->Close();
}
delete pAdoRs;
pAdoDb->Close();
}
else
{
::MessageBox(0,"打开数据库失败!","高级设置",MB_OK);
}
delete pAdoDb;
return FALSE;
}
//-------------------------------------------------------------------------
// PacketCheckSum
// 计算数据包的校验和
// 参数:packet-待处理数据
//-------------------------------------------------------------------------
void PacketCheckSum(unsigned char packet[])
{
Dlc_Header *pdlc_header=NULL; //以太头指针
Ip_Header *pip_header=NULL; //IP头指针
Udp_Header *pudp_header=NULL; //UDP头指针
pdlc_header=(Dlc_Header *)packet;
//判断ethertype,如果不是IP包则不予处理
if(ntohs(pdlc_header->ethertype)!=0x0800) return;
pip_header=(Ip_Header *)(packet+14);
//TCP包
if(0x06==pip_header->proto)
{
//TCP头以及附加数据的总长度
unsigned int attachsize=0;
Tcp_Header *ptcp_header=NULL; //TCP头指针
Tcp_Psd_Header *ptcp_psd_header=NULL;
ptcp_header=(Tcp_Header *)(packet+14+((pip_header->ver_len)&15)*4);
attachsize=ntohs(pip_header->total_len)-((pip_header->ver_len)&15)*4;
ptcp_psd_header=(Tcp_Psd_Header *)malloc(attachsize+sizeof(Tcp_Psd_Header));
memset(ptcp_psd_header,0,attachsize+sizeof(Tcp_Psd_Header));
//填充伪TCP头
ptcp_psd_header->destip=pip_header->destIP;
ptcp_psd_header->sourceip=pip_header->sourceIP;
ptcp_psd_header->mbz=0;
ptcp_psd_header->ptcl=0x06;
ptcp_psd_header->tcpl=htons(attachsize);
ptcp_header->chksum=0;
memcpy((unsigned char *)ptcp_psd_header+sizeof(Tcp_Psd_Header),
(unsigned char *)ptcp_header,attachsize);
ptcp_header->chksum=checksum((unsigned short *)ptcp_psd_header,
attachsize+sizeof(Tcp_Psd_Header));
//计算ip头的校验和
pip_header->checksum=0;
pip_header->checksum=checksum((unsigned short *)pip_header,((pip_header->ver_len)&15)*4);
return;
}
return;
}
//更新已处理的数据包数
LRESULT CLocalPage::OnMessagePcount(WPARAM wParam, LPARAM lParam)
{
unsigned int uiPcount=0;
uiPcount=this->GetDlgItemInt(IDC_PCOUNT);
this->SetDlgItemInt(IDC_PCOUNT,++uiPcount);
return 0;
}
//处理实时信息列表消息
LRESULT CLocalPage::OnMessageListMessage(WPARAM wParam, LPARAM lParam)
{
char timebuf[512]={0};
SYSTEMTIME systime;
int iIndex=0;
static int number=0;
if (strlen((LPCSTR)lParam)<5) return 0;
memset(&systime,0,sizeof(SYSTEMTIME));
::GetLocalTime(&systime);
sprintf(timebuf,"%04d-%02d-%02d %02d:%02d:%02d ",
systime.wYear,
systime.wMonth,
systime.wDay,
systime.wHour,
systime.wMinute,
systime.wSecond);
int total=((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->GetItemCount();
((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->InsertItem(total,timebuf);
if(checknet==FALSE&&checkhost==TRUE)
{
strcpy(timebuf,(LPCSTR)lParam);
int loc=0;
while(((LPCSTR)lParam)[loc]!='\t')
loc++;
loc++;
memset(timebuf,0,sizeof(timebuf));
strncpy(timebuf,(LPCSTR)lParam,loc-1);
((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->SetItemText(total, 1,timebuf);
int index=loc;
while(((LPCSTR)lParam)[index]!='\t')
index++;
index++;
memset(timebuf,0,sizeof(timebuf));
strncpy(timebuf,&((LPCSTR)lParam)[loc],index-1-loc);
((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->SetItemText(total, 2,timebuf);
memset(timebuf,0,sizeof(timebuf));
strcpy(timebuf,&((LPCSTR)lParam)[index]);
((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->SetItemText(total, 3,timebuf);
}else
{
int i=0;
while(((LPCSTR)lParam)[i]==' '||((LPCSTR)lParam)[i]=='\t')
i++;
((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->SetItemText(total, 1,&((LPCSTR)lParam)[i]);
}
return 0;
}
void CLocalPage::OnDestroy()
{
CPropertyPage::OnDestroy();
}
void CLocalPage::OnRclickMeslist(NMHDR* pNMHDR, LRESULT* pResult)
{
CRect rect;
GetWindowRect(&rect);
CPoint point;
GetCursorPos(&point);
ScreenToClient(&point);
int x=point.x+rect.left;
int y=point.y+rect.top;
CMenu *m_PopMenu=new CMenu;
m_PopMenu->LoadMenu(IDR_MESLIST);//加载菜单
if(checknet)
m_PopMenu->GetSubMenu(0)->CheckMenuItem(0,MF_CHECKED|MF_BYPOSITION);
else
m_PopMenu->GetSubMenu(0)->CheckMenuItem(0,MF_UNCHECKED|MF_BYPOSITION);
if(checkhost)
m_PopMenu->GetSubMenu(0)->CheckMenuItem(1,MF_CHECKED|MF_BYPOSITION);
else
m_PopMenu->GetSubMenu(0)->CheckMenuItem(1,MF_UNCHECKED|MF_BYPOSITION);
TrackPopupMenu(m_PopMenu->GetSubMenu(0)->m_hMenu,0,x,y,0,this->GetSafeHwnd(),&rect);
*pResult = 0;
}
void CLocalPage::OnDelete()
{
if(!((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->GetSelectedCount())
{
return;
}
POSITION pos =((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->GetFirstSelectedItemPosition();
int index;
while(pos)
{
index=((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->GetNextSelectedItem(pos);
((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->DeleteItem(index);
}
}
void CLocalPage::OnDeleteall()
{
if(IDYES==AfxMessageBox("确认清除所有监控信息?",MB_ICONQUESTION|MB_YESNO,0))
{
((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->DeleteAllItems();
}
}
void CLocalPage::UpdateTitle()
{
//先删除所有列名
int nColumnCount = ((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->GetHeaderCtrl()->GetItemCount();
for (int i=0;i < nColumnCount;i++)
{
((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->DeleteColumn(0);
}
if(checkhost&&checknet)
{
((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->InsertColumn(0, "时间",LVCFMT_LEFT,150);
((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->InsertColumn(1, "监控信息",LVCFMT_LEFT,600);
}else if(checknet)
{
((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->InsertColumn(0, "时间",LVCFMT_LEFT,150);
((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->InsertColumn(1, "网络监控信息",LVCFMT_LEFT,600);
}else if(checkhost)
{
((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->InsertColumn(0, "时间",LVCFMT_LEFT,150);
((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->InsertColumn(1, "进程名",LVCFMT_LEFT,150);
((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->InsertColumn(2, "函数名",LVCFMT_LEFT,150);
((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->InsertColumn(3, "路径",LVCFMT_LEFT,400);
}else
{
((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->InsertColumn(0, "时间",LVCFMT_LEFT,150);
((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->InsertColumn(1, "监控信息",LVCFMT_LEFT,600);
}
}
void CLocalPage::OnNetshow()
{
checknet=!checknet;
((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->DeleteAllItems();
UpdateTitle();
}
void CLocalPage::OnHostshow()
{
checkhost=!checkhost;
((CListCtrl *)this->GetDlgItem(IDC_MESLIST))->DeleteAllItems();
UpdateTitle();
}
HBRUSH CLocalPage::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
return CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
}
//获取统计信息
void CLocalPage::GetStatistics()
{
if(PACKET_FILTER)
{
this->SetDlgItemText(IDC_PACKETFILTER,"已开启");
}
else
{
this->SetDlgItemText(IDC_PACKETFILTER,"未开启");
}
if(ANTIARP)
{
this->SetDlgItemText(IDC_ARPFILTER,"已开启");
}
else
{
this->SetDlgItemText(IDC_ARPFILTER,"未开启");
}
if(ICMP_FILTER)
{
this->SetDlgItemText(IDC_ICMPFILTER,"已开启");
}
else
{
this->SetDlgItemText(IDC_ICMPFILTER,"未开启");
}
return;
}
//获取特征码的数量
void GetShellCodeCount()
{
//获取特征码数量
unsigned int uiCodeCount=0;
CADODatabase* pAdoDb = new CADODatabase();
CString strConnection = _T("");
SetCurrentDirectory(szCurrentDirectory);
strConnection = _T("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=code.mdb");
pAdoDb->SetConnectionString(strConnection);
if(pAdoDb->Open())
{
CADORecordset* pAdoRs = new CADORecordset(pAdoDb);
if(pAdoRs->Open("shellcode", CADORecordset::openTable))
{
uiCodeCount=pAdoRs->GetRecordCount();
}
delete pAdoRs;
pAdoDb->Close();
}
delete pAdoDb;
p_this->SetDlgItemInt(IDC_SCCOUNT,uiCodeCount);
}
| [
"sniperstriker@gmail.com"
] | sniperstriker@gmail.com |
ad7ec2af7acb5e0a7e299f242c8d6b6d53e47853 | 0f1adc203c54016d0ab037f82d75d7c29af96eef | /text.h | 80954b41b78f056c5119fec03a72b6ff64bc3827 | [] | no_license | CS3398-Cerulean-HelloWorld/CS3398-Cerulean-S2016 | 9afaaded7461980de36d2f76f6426c1541b05ba8 | 0fcf0849cff537d26046f3f588930a301684609a | refs/heads/master | 2020-09-21T16:19:27.359257 | 2016-12-15T23:52:48 | 2016-12-15T23:52:48 | 67,551,747 | 0 | 0 | null | 2016-12-15T23:52:49 | 2016-09-06T22:35:16 | C++ | UTF-8 | C++ | false | false | 534 | h | #ifndef TEXT_H_INCLUDED
#define TEXT_H_INCLUDED
#include<string>
using namespace std;
#define dataPerLine 9
class text
{
private:
char** story2d;
int storySize;
public:
string storyText;
string option1Text;
string option2Text;
string option3Text;
int option1location;
int option2location;
int option3location;
int healthEffect;
int imageNumber;
void inputText(const char*);
void setVariables(int);
~text();
};
#endif // TEXT_H_INCLUDED
| [
"noreply@github.com"
] | noreply@github.com |
c66fef354fbfaf8466d3ffd6db3518a41457a5be | d68da9c0ead46120795415fa55a7b528fec92630 | /scsdk/c++/scsdk_test/standard_cyborg/algorithms/PlaneEstimationTests.cpp | 3d4155f3222e678c3ea9ca7185ab41468bb9782d | [
"Apache-2.0"
] | permissive | thomasRim/scsdk | e08b6de6c42075e305168c0dd47704ed3f5c0f18 | 92f80bf2a580ebaafa6b0d1052d90d5c8f6682f7 | refs/heads/master | 2023-03-24T14:13:52.578518 | 2021-03-10T09:36:25 | 2021-03-10T09:36:25 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,971 | cpp | /*
Copyright 2020 Standard Cyborg
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 <gtest/gtest.h>
#include "standard_cyborg/algorithms/EstimatePlane.hpp"
#include "standard_cyborg/sc3d/Plane.hpp"
#include "standard_cyborg/sc3d/Face3.hpp"
#include "standard_cyborg/util/DataUtils.hpp"
#include <random>
#include <iostream>
using standard_cyborg::sc3d::Geometry;
using standard_cyborg::sc3d::Polyline;
using standard_cyborg::sc3d::Face3;
using namespace standard_cyborg;
using math::Vec3;
TEST(PlaneEstimationTests, testEstimatePlane) {
std::vector<Vec3> positions {
{4.0f, 2.0f, 0.2f},
{3.0f, 3.0f, 0.2f},
{2.0f, 2.0f, 0.1f},
{3.0f, 1.0f, 0.3f},
{3.0f, 1.0f, 0.1f},
{3.0f, 1.1f, 0.0f},
{3.1f, 1.0f, 0.4f},
};
// We need to make this test deterministic across platforms, and it covers
// a very small set of points, so we seed the initial set manually.
standard_cyborg::sc3d::VertexSelection planeVertices;
planeVertices.insertValue(3);
planeVertices.insertValue(4);
planeVertices.insertValue(6);
standard_cyborg::algorithms::EstimatePlaneResult result = standard_cyborg::algorithms::estimatePlane(positions, planeVertices);
EXPECT_NEAR(result.plane.position.x, 3.03, 0.1);
EXPECT_NEAR(result.plane.position.y, 1.0, 0.1);
EXPECT_NEAR(result.plane.position.z, 0.266, 0.1);
// Dot the result with the expected value and compare the absolute value to 1 to ensure they're roughly identical.
EXPECT_NEAR(std::abs(standard_cyborg::toVector3f(result.plane.normal).transpose() * Eigen::Vector3f(0.0, 1.0, 0.0)), 1.0, 0.01);
// It's a bit of a degenerate case since there aren't more points. It collapses to a plane
// and the error is almost (but not exactly) zero
EXPECT_NEAR(result.rmsProjectedDistance, 0.0f, 1e-6);
EXPECT_TRUE(result.converged);
EXPECT_TRUE(*result.planeVertices == standard_cyborg::sc3d::VertexSelection(7, {3, 4, 6}));
}
TEST(PlaneEstimationTests, testEstimatePlaneFromPointCloud) {
std::vector<Vec3> positions;
int numPts = 10000;
std::uniform_real_distribution<double> uniform(-1.0, 1.0);
std::default_random_engine re;
re.seed(0);
Vec3 position(uniform(re), uniform(re), uniform(re));
Vec3 normal(Vec3(uniform(re), uniform(re), uniform(re)).normalize());
Vec3 tangent(Vec3::cross(Vec3(1, 0 ,0), normal).normalize());
Vec3 bitangent(Vec3::cross(normal, tangent).normalize());
for (int i = 0; i < numPts; i++) {
positions.push_back(position
+ normal * uniform(re) * 0.3
+ tangent * uniform(re)
+ bitangent * uniform(re));
}
standard_cyborg::algorithms::EstimatePlaneResult result = standard_cyborg::algorithms::estimatePlane(positions);
float projectedDistanceFromActualPositionToEstimatedPlane = std::abs(Vec3::dot(result.plane.normal, position - result.plane.position));
EXPECT_LT(projectedDistanceFromActualPositionToEstimatedPlane, 1e-3);
// It could go either way, and this happens to detect the opposite normal. I believe maybe this
// is determined by the relative orientation of the first and second left singular vectors, but
// it's pretty irrelevant (things shouldn't depend on this!) so I've simply negated.
EXPECT_LT(Vec3::angleBetween(-result.plane.normal, normal), 1e-2);
}
| [
"arnebackeric@gmail.com"
] | arnebackeric@gmail.com |
f0464598512067e2fac223c1f8e487cf06e4972c | a12f4485797eb79c0c2aaece0ff570731ee7b0d1 | /main/SignalStackPlotsCategories.cc | 0a28c4d4efee0f3a612498fd1ba7308d2b58aea2 | [] | no_license | cmorgoth/PlotDMSignal | cd223af740eff5862fe010da44e4ebc0992ebc57 | a3983a2d356be1d2609386ffa134992d1e9f3d67 | refs/heads/master | 2016-09-06T04:16:44.620963 | 2015-01-09T22:55:21 | 2015-01-09T22:55:21 | 28,979,208 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 34,531 | cc | /*
Creates Signal and Background Stack Plots
For DM analysis. These plots are use to show
the contribution of different backgrounds and also
how the signal look like in the different MR categories
*/
//C++ INCLUDES
#include <iostream>
#include <fstream>
#include <math.h>
#include <vector>
#include <map>
//ROOT INCLUDES
#include "TROOT.h"
#include "TH1F.h"
#include "TH2F.h"
#include "TFile.h"
#include "TTree.h"
#include "TString.h"
#include "THStack.h"
#include "TLegend.h"
#include "TEfficiency.h"
#include "TCanvas.h"
#include "TLorentzVector.h"
//LOCAL INCLUDES
#include "hlt.hh"
#include "DM_1DRatio.hh"
#include "StructDefinition.hh"
const float BaseDM::RSQ_BinArr[] = {0.5, 0.6, 0.725, 0.85, 2.50};
const float BaseDM::MR_BinArr[] = {200., 300., 400., 600., 3500.};
int main(){
//gROOT->Reset();
const int r2B[4] = {11, 6, 6, 4};
float c1B[] = {0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.9, 0.95, 1.0, 1.2};
float c2B[] = {0.50, 0.575, 0.65, 0.75, 0.85, .950, 1.2};
float c3B[] = {0.50, 0.575, 0.65, 0.75, 0.85, .950, 1.2};
float c4B[] = {0.50, 0.60, 0.70, .950, 1.2};
std::vector<float*> v;
v.push_back(c1B);
v.push_back(c2B);
v.push_back(c3B);
v.push_back(c4B);
TCanvas* ca = new TCanvas("c","c", 640, 640);
TFile* f2 = new TFile("~/Software/git/BkgPredictionDM/trigger/hlt_eff_HTMHT_0mu_BOX_0bTag_Final.root");
TEfficiency* hlt = (TEfficiency*)f2->Get("Eff2d");
TH1F* dy[4];
TH1F* z[4];
TH1F* w[4];
TH1F* tt[4];
TH1F* bkg[4];
TH1F* data[4];
//Getting MR categories plots from Prediction
TString dys, zs, ws, tts, bkgs, datas;
double tt_N[4];//Total contribution #
double dy_N[4];//Total contribution #
double z_N[4];//Total contribution #
double w_N[4];//Total contribution #
double data_N[4];//Total contribution #
TFile* in = new TFile("/Users/cmorgoth/Software/git/BkgPredictionDM/PredFilesAN/MR_Cat_PredV2_NEW_kF.root");
for(int i = 0; i < 4; i++){
dys = TString(Form("cat%d_dy_Pred",i+1));
zs = TString(Form("cat%d_z_Pred",i+1));
ws = TString(Form("cat%d_w_Pred",i+1));
tts = TString(Form("cat%d_tt_Pred",i+1));
bkgs = TString(Form("cat%d_1D_0mu_Box_Pred_sys",i+1));
datas = TString(Form("Data_cat%d_1D_0mu_Box",i+1));
dy[i] = (TH1F*)in->Get(dys);
z[i] = (TH1F*)in->Get(zs);
w[i] = (TH1F*)in->Get(ws);
tt[i] = (TH1F*)in->Get(tts);
bkg[i] = (TH1F*)in->Get(bkgs);
data[i] = (TH1F*)in->Get(datas);
dy_N[i] = dy[i]->Integral();
z_N[i] = z[i]->Integral();
w_N[i] = w[i]->Integral();
tt_N[i] = tt[i]->Integral();
data_N[i] = data[i]->Integral();
}
//Creating Histos for Shape Analysis
TH1F* dy_up[4];
TH1F* z_up[4];
TH1F* w_up[4];
TH1F* tt_up[4];
TH1F* dy_down[4];
TH1F* z_down[4];
TH1F* w_down[4];
TH1F* tt_down[4];
TString bkgn;
for(int i = 0; i < 4; i++){
bkgn = TString(Form("dy_cat%d",i));
dy_up[i] = new TH1F(bkgn, bkgn, r2B[i], v.at(i));
bkgn = TString(Form("dy_down_cat%d",i));
dy_down[i] = new TH1F(bkgn, bkgn, r2B[i], v.at(i));
bkgn = TString(Form("z_up_cat%d",i));
z_up[i] = new TH1F(bkgn, bkgn, r2B[i], v.at(i));
bkgn = TString(Form("z_down_cat%d",i));
z_down[i] = new TH1F(bkgn, bkgn, r2B[i], v.at(i));
bkgn = TString(Form("w_up_cat%d",i));
w_up[i] = new TH1F(bkgn, bkgn, r2B[i], v.at(i));
bkgn = TString(Form("w_down_cat%d",i));
w_down[i] = new TH1F(bkgn, bkgn, r2B[i], v.at(i));
bkgn = TString(Form("tt_up_cat%d",i));
tt_up[i] = new TH1F(bkgn, bkgn, r2B[i], v.at(i));
bkgn = TString(Form("tt_down_cat%d",i));
tt_down[i] = new TH1F(bkgn, bkgn, r2B[i], v.at(i));
double min_norm = 0.0001;
for(int j = 1; j <= dy_up[i]->GetNbinsX(); j++){
dy_up[i]->SetBinContent(j,dy[i]->GetBinContent(j)+dy[i]->GetBinError(j));
if(dy[i]->GetBinContent(j)-dy[i]->GetBinError(j) > 0.0){
dy_down[i]->SetBinContent(j,dy[i]->GetBinContent(j)-dy[i]->GetBinError(j));
}else{
dy_down[i]->SetBinContent(j,min_norm);
}
z_up[i]->SetBinContent(j,z[i]->GetBinContent(j)+z[i]->GetBinError(j));
if(z[i]->GetBinContent(j)-z[i]->GetBinError(j) > 0.0){
z_down[i]->SetBinContent(j,z[i]->GetBinContent(j)-z[i]->GetBinError(j));
}else{
z_down[i]->SetBinContent(j,min_norm);
}
w_up[i]->SetBinContent(j,w[i]->GetBinContent(j)+w[i]->GetBinError(j));
if(w[i]->GetBinContent(j)-w[i]->GetBinError(j) > 0.0){
w_down[i]->SetBinContent(j,w[i]->GetBinContent(j)-w[i]->GetBinError(j));
}else{
w_down[i]->SetBinContent(j,min_norm);
}
tt_up[i]->SetBinContent(j,tt[i]->GetBinContent(j)+tt[i]->GetBinError(j));
if(tt[i]->GetBinContent(j)-tt[i]->GetBinError(j) > 0.0){
tt_down[i]->SetBinContent(j,tt[i]->GetBinContent(j)-tt[i]->GetBinError(j));
}else{
tt_down[i]->SetBinContent(j,min_norm);
}
}
}
TH1F* h_rsq[24][4];
TH1F* h_rsq_ISR_up[24][4];
TH1F* h_rsq_ISR_down[24][4];
TH1F* h_rsq_JES_up[24][4];
TH1F* h_rsq_JES_down[24][4];
TH1F* h_rsq_PDF_up[24][4];
TH1F* h_rsq_PDF_down[24][4];
TH1F* s_up[24][4];
TH1F* s_down[24][4];
std::map<std::string, DmSignalPlots> DmSignalMap;
TString sn;
for(int j = 0; j < 24; j++){
for(int i = 0; i < 4; i++){
sn = TString(Form("signal%d_cat%d",j,i));
h_rsq[j][i] = new TH1F(sn, sn, r2B[i], v.at(i));
h_rsq_ISR_up[j][i] = new TH1F(sn+"ISR_up", sn+"ISR_up", r2B[i], v.at(i));
h_rsq_ISR_down[j][i] = new TH1F(sn+"ISR_down", sn+"ISR_down", r2B[i], v.at(i));
h_rsq_JES_up[j][i] = new TH1F(sn+"JES_up", sn+"JES_up", r2B[i], v.at(i));
h_rsq_JES_down[j][i] = new TH1F(sn+"JES_down", sn+"JES_down", r2B[i], v.at(i));
s_up[j][i] = new TH1F(sn+"_up", sn+"_up", r2B[i], v.at(i));
s_down[j][i] = new TH1F(sn+"_down", sn+"_down", r2B[i], v.at(i));
}
}
//Here the program starts
std::ifstream mfile0("list_DM_BugFixed.list");
std::string fname0;
std::cout.precision(16);
int xs_counter = 0;
TFile* f_acc;
if (mfile0.is_open()){
while ( mfile0.good() ){
mfile0 >> fname0;
if(mfile0.eof())break;
std::cout << fname0 << std::endl;
int low_ = fname0.find("DMm");
int high_ = fname0.find("_testMC_0.root") - low_;
std::string dm_sample = fname0.substr(low_,high_);
std::cout << "============ " << dm_sample << " ==================" << std::endl;
int low_type;
int high_type;
if(fname0.find("AV") != std::string::npos){
low_ = fname0.find("DMm") + 3;
high_ = fname0.rfind("AV") - low_;
low_type = fname0.rfind("AV");
high_type = fname0.find("_testMC_0.root") - low_type;
}else{
low_ = fname0.find("DMm") + 3;
high_ = fname0.rfind("V") - low_;
low_type = fname0.rfind("V");
high_type = fname0.find("_testMC_0.root") - low_type;
}
std::string dm_mass = fname0.substr(low_,high_);
std::string current_type = fname0.substr(low_type,high_type);
std::cout << "============ " << dm_mass << " ==================" << std::endl;
std::cout << "============ " << current_type << " ==================" << std::endl;
TFile* f = new TFile(fname0.c_str());
TTree* eff = (TTree*)f->Get("effTree");
TTree* out = (TTree*)f->Get("outTree");
double mr[4], rsq[4], Jet_PT[20], Jet_Eta[20], Jet_Phi[20], metCorrX[4], metCorrY[4];
double mr_up[4], rsq_up[4], Jet_PT_up[20], Jet_Eta_up[20], Jet_Phi_up[20], metCorrX_up[4], metCorrY_up[4];
double mr_down[4], rsq_down[4], Jet_PT_down[20], Jet_Eta_down[20], Jet_Phi_down[20], metCorrX_down[4], metCorrY_down[4];
double pTHem1, pTHem2, etaHem1, etaHem2, phiHem1, phiHem2;
double pTHem1_up, pTHem2_up, etaHem1_up, etaHem2_up, phiHem1_up, phiHem2_up;
double pTHem1_down, pTHem2_down, etaHem1_down, etaHem2_down, phiHem1_down, phiHem2_down;
int btag, box, N_Jets;
double pu_w, ISR, ISR_up, ISR_down;
double Npassed_In, Npassed_ISR, Npassed_ISR_up, Npassed_ISR_down;
eff->SetBranchStatus("*", 0);
eff->SetBranchStatus("Npassed_In", 1);
eff->SetBranchStatus("Npassed_ISR", 1);
eff->SetBranchStatus("Npassed_ISR_up", 1);
eff->SetBranchStatus("Npassed_ISR_down", 1);
eff->SetBranchAddress("Npassed_In", &Npassed_In);
eff->SetBranchAddress("Npassed_ISR", &Npassed_ISR);
eff->SetBranchAddress("Npassed_ISR_up", &Npassed_ISR_up);
eff->SetBranchAddress("Npassed_ISR_down", &Npassed_ISR_down);
int N_eff = eff->GetEntries();
int Gen_Evts = 0;
int Gen_Evts_isr = 0;
int Gen_Evts_isrUp = 0;
int Gen_Evts_isrDown = 0;
for(int i = 0; i < N_eff; i++){
eff->GetEntry(i);
Gen_Evts += Npassed_In;
Gen_Evts_isr += Npassed_ISR;
Gen_Evts_isrUp += Npassed_ISR_up;
Gen_Evts_isrDown += Npassed_ISR_down;
}
std::cout << "Gen_Events: " << Gen_Evts << std::endl;
std::cout << "Gen_ISR: " << Gen_Evts_isr << std::endl;
std::cout << "Gen_ISR_Up: " << Gen_Evts_isrUp << std::endl;
std::cout << "Gen_ISR_Down: " << Gen_Evts_isrDown << std::endl;
out->SetBranchStatus("*", 0);
out->SetBranchStatus("pu_w", 1);
out->SetBranchStatus("ISR", 1);
out->SetBranchStatus("ISR_up", 1);
out->SetBranchStatus("ISR_down", 1);
out->SetBranchStatus("MR", 1);
out->SetBranchStatus("MR_up", 1);
out->SetBranchStatus("MR_down", 1);
out->SetBranchStatus("RSQ",1);
out->SetBranchStatus("RSQ_up",1);
out->SetBranchStatus("RSQ_down",1);
out->SetBranchStatus("nBtag", 1);
out->SetBranchStatus("BOX_NUM",1);
out->SetBranchStatus("N_Jets",1);
out->SetBranchStatus("Jet_PT",1);
out->SetBranchStatus("Jet_PT_up",1);
out->SetBranchStatus("Jet_PT_down",1);
out->SetBranchStatus("Jet_Phi",1);
out->SetBranchStatus("Jet_Phi_up",1);
out->SetBranchStatus("Jet_Phi_down",1);
out->SetBranchStatus("Jet_Eta",1);
out->SetBranchStatus("Jet_Eta_up",1);
out->SetBranchStatus("Jet_Eta_down",1);
out->SetBranchStatus("pTHem1",1);
out->SetBranchStatus("pTHem1_up",1);
out->SetBranchStatus("pTHem1_down",1);
out->SetBranchStatus("pTHem2",1);
out->SetBranchStatus("pTHem2_up",1);
out->SetBranchStatus("pTHem2_down",1);
out->SetBranchStatus("etaHem1",1);
out->SetBranchStatus("etaHem1_up",1);
out->SetBranchStatus("etaHem1_down",1);
out->SetBranchStatus("etaHem2",1);
out->SetBranchStatus("etaHem2_up",1);
out->SetBranchStatus("etaHem2_down",1);
out->SetBranchStatus("phiHem1",1);
out->SetBranchStatus("phiHem1_up",1);
out->SetBranchStatus("phiHem1_down",1);
out->SetBranchStatus("phiHem2",1);
out->SetBranchStatus("phiHem2_up",1);
out->SetBranchStatus("phiHem2_down",1);
out->SetBranchStatus("metCorrX",1);
out->SetBranchStatus("metCorrX_up",1);
out->SetBranchStatus("metCorrX_down",1);
out->SetBranchStatus("metCorrY",1);
out->SetBranchStatus("metCorrY_up",1);
out->SetBranchStatus("metCorrY_down",1);
///////////////////////////////
///////////Addresses///////////
///////////////////////////////
out->SetBranchAddress("pu_w", &pu_w);
out->SetBranchAddress("ISR", &ISR);
out->SetBranchAddress("ISR_up", &ISR_up);
out->SetBranchAddress("ISR_down", &ISR_down);
out->SetBranchAddress("MR", mr);
out->SetBranchAddress("MR_up", mr_up);
out->SetBranchAddress("MR_down", mr_down);
out->SetBranchAddress("RSQ", rsq);
out->SetBranchAddress("RSQ_up", rsq_up);
out->SetBranchAddress("RSQ_down", rsq_down);
out->SetBranchAddress("nBtag", &btag);
out->SetBranchAddress("BOX_NUM", &box);
out->SetBranchAddress("N_Jets", &N_Jets);
out->SetBranchAddress("Jet_PT", Jet_PT);
out->SetBranchAddress("Jet_PT_up", Jet_PT_up);
out->SetBranchAddress("Jet_PT_down", Jet_PT_down);
out->SetBranchAddress("Jet_Phi", Jet_Phi);
out->SetBranchAddress("Jet_Phi_up", Jet_Phi_up);
out->SetBranchAddress("Jet_Phi_down", Jet_Phi_down);
out->SetBranchAddress("Jet_Eta", Jet_Eta);
out->SetBranchAddress("Jet_Eta_up", Jet_Eta_up);
out->SetBranchAddress("Jet_Eta_down", Jet_Eta_down);
out->SetBranchAddress("pTHem1", &pTHem1);
out->SetBranchAddress("pTHem1_up", &pTHem1_up);
out->SetBranchAddress("pTHem1_down", &pTHem1_down);
out->SetBranchAddress("pTHem2", &pTHem2);
out->SetBranchAddress("pTHem2_up", &pTHem2_up);
out->SetBranchAddress("pTHem2_down", &pTHem2_down);
out->SetBranchAddress("etaHem1", &etaHem1);
out->SetBranchAddress("etaHem1_up", &etaHem1_up);
out->SetBranchAddress("etaHem1_down", &etaHem1_down);
out->SetBranchAddress("etaHem2", &etaHem2);
out->SetBranchAddress("etaHem2_up", &etaHem2_up);
out->SetBranchAddress("etaHem2_down", &etaHem2_down);
out->SetBranchAddress("phiHem1", &phiHem1);
out->SetBranchAddress("phiHem1_up", &phiHem1_up);
out->SetBranchAddress("phiHem1_down", &phiHem1_down);
out->SetBranchAddress("phiHem2", &phiHem2);
out->SetBranchAddress("phiHem2_up", &phiHem2_up);
out->SetBranchAddress("phiHem2_down", &phiHem2_down);
out->SetBranchAddress("metCorrX", metCorrX);
out->SetBranchAddress("metCorrX_up", metCorrX_up);
out->SetBranchAddress("metCorrX_down", metCorrX_down);
out->SetBranchAddress("metCorrY", metCorrY);
out->SetBranchAddress("metCorrY_up", metCorrY_up);
out->SetBranchAddress("metCorrY_down", metCorrY_down);
int N_out = out->GetEntries();
//double Lumi = 18.51;//PromptReco
double Lumi = 18.836;//Jan22Rereco
//double scaleF = Lumi*1000./Gen_Evts;//Scale to 1 pb
double scaleF = Lumi*1000./Gen_Evts_isr;
double scaleF_up = Lumi*1000./Gen_Evts_isrUp;
double scaleF_down = Lumi*1000./Gen_Evts_isrDown;
double N_passed = 0.0;
double N_passed_ISR = 0.0;
double N_passed_ISR_up = 0.0;
double N_passed_ISR_down = 0.0;
double N_passed_JES_up = 0.0;
double N_passed_JES_down = 0.0;
for(int j = 0; j < N_out; j++){
out->GetEntry(j);
double hlt_w = HLTscale(mr[2], rsq[2], hlt);
//Nominal
TLorentzVector j1;
TLorentzVector j2;
j1.SetPtEtaPhiE(pTHem1, etaHem1, phiHem1, pTHem1*cosh(etaHem1));//Hemisphere
j2.SetPtEtaPhiE(pTHem2, etaHem2, phiHem2, pTHem2*cosh(etaHem2));//Hemisphere
double Dphi = j1.DeltaPhi(j2);
if(mr[2] >= 200.0 && rsq[2] >= 0.5 && btag == 0 && box == 0 && fabs(Dphi) < 2.5){
if(mr[2] > 200.0 && mr[2] <= 300.0 ){
if(rsq[2] > 1.2)rsq[2] = 1.1;
h_rsq[xs_counter][0]->Fill(rsq[2], hlt_w*scaleF*pu_w*ISR);
}else if(mr[2] > 300.0 && mr[2] <= 400.0){
if(rsq[2] > 1.2)rsq[2] = 1.1;
h_rsq[xs_counter][1]->Fill(rsq[2], hlt_w*scaleF*pu_w*ISR);
}else if(mr[2] > 400.0 && mr[2] <= 600.0){
if(rsq[2] > 1.2)rsq[2] = 1.1;
h_rsq[xs_counter][2]->Fill(rsq[2], hlt_w*scaleF*pu_w*ISR);
}else if(mr[2] > 600.0 && mr[2] <= 3500.0){
if(rsq[2] > 1.2)rsq[2] = 1.1;
h_rsq[xs_counter][3]->Fill(rsq[2], hlt_w*scaleF*pu_w*ISR);
}
N_passed += hlt_w*pu_w;
N_passed_ISR += hlt_w*pu_w*ISR;
}
//ISR UP
if(mr[2] >= 200.0 && rsq[2] >= 0.5 && btag == 0 && box == 0 && fabs(Dphi) < 2.5){
if(mr[2] > 200.0 && mr[2] <= 300.0 ){
if(rsq[2] > 1.2)rsq[2] = 1.1;
h_rsq_ISR_up[xs_counter][0]->Fill(rsq[2], hlt_w*scaleF_up*pu_w*ISR_up);
}else if(mr[2] > 300.0 && mr[2] <= 400.0){
if(rsq[2] > 1.2)rsq[2] = 1.1;
h_rsq_ISR_up[xs_counter][1]->Fill(rsq[2], hlt_w*scaleF_up*pu_w*ISR_up);
}else if(mr[2] > 400.0 && mr[2] <= 600.0){
if(rsq[2] > 1.2)rsq[2] = 1.1;
h_rsq_ISR_up[xs_counter][2]->Fill(rsq[2], hlt_w*scaleF_up*pu_w*ISR_up);
}else if(mr[2] > 600.0 && mr[2] <= 3500.0){
if(rsq[2] > 1.2)rsq[2] = 1.1;
h_rsq_ISR_up[xs_counter][3]->Fill(rsq[2], hlt_w*scaleF_up*pu_w*ISR_up);
}
N_passed_ISR_up += hlt_w*pu_w*ISR_up;
}
//ISR DOWN
if(mr[2] >= 200.0 && rsq[2] >= 0.5 && btag == 0 && box == 0 && fabs(Dphi) < 2.5){
if(mr[2] > 200.0 && mr[2] <= 300.0 ){
if(rsq[2] > 1.2)rsq[2] = 1.1;
h_rsq_ISR_down[xs_counter][0]->Fill(rsq[2], hlt_w*scaleF_down*pu_w*ISR_down);
}else if(mr[2] > 300.0 && mr[2] <= 400.0){
if(rsq[2] > 1.2)rsq[2] = 1.1;
h_rsq_ISR_down[xs_counter][1]->Fill(rsq[2], hlt_w*scaleF_down*pu_w*ISR_down);
}else if(mr[2] > 400.0 && mr[2] <= 600.0){
if(rsq[2] > 1.2)rsq[2] = 1.1;
h_rsq_ISR_down[xs_counter][2]->Fill(rsq[2], hlt_w*scaleF_down*pu_w*ISR_down);
}else if(mr[2] > 600.0 && mr[2] <= 3500.0){
if(rsq[2] > 1.2)rsq[2] = 1.1;
h_rsq_ISR_down[xs_counter][3]->Fill(rsq[2], hlt_w*scaleF_down*pu_w*ISR_down);
}
N_passed_ISR_down += hlt_w*pu_w*ISR_down;
}
//JES UP
j1.SetPtEtaPhiE(pTHem1_up, etaHem1_up, phiHem1_up, pTHem1_up*cosh(etaHem1_up));//Hemisphere
j2.SetPtEtaPhiE(pTHem2_up, etaHem2_up, phiHem2_up, pTHem2_up*cosh(etaHem2_up));//Hemisphere
Dphi = j1.DeltaPhi(j2);
if(mr_up[2] >= 200.0 && rsq_up[2] >= 0.5 && btag == 0 && box == 0 && fabs(Dphi) < 2.5){
if(mr_up[2] > 200.0 && mr_up[2] <= 300.0 ){
if(rsq_up[2] > 1.2)rsq_up[2] = 1.1;
h_rsq_JES_up[xs_counter][0]->Fill(rsq_up[2], hlt_w*scaleF*pu_w*ISR);
}else if(mr_up[2] > 300.0 && mr_up[2] <= 400.0){
if(rsq_up[2] > 1.2)rsq_up[2] = 1.1;
h_rsq_JES_up[xs_counter][1]->Fill(rsq_up[2], hlt_w*scaleF*pu_w*ISR);
}else if(mr_up[2] > 400.0 && mr_up[2] <= 600.0){
if(rsq_up[2] > 1.2)rsq_up[2] = 1.1;
h_rsq_JES_up[xs_counter][2]->Fill(rsq_up[2], hlt_w*scaleF*pu_w*ISR);
}else if(mr_up[2] > 600.0 && mr_up[2] <= 3500.0){
if(rsq_up[2] > 1.2)rsq_up[2] = 1.1;
h_rsq_JES_up[xs_counter][3]->Fill(rsq_up[2], hlt_w*scaleF*pu_w*ISR);
}
}
//JES DOWN
j1.SetPtEtaPhiE(pTHem1_down, etaHem1_down, phiHem1_down, pTHem1_down*cosh(etaHem1_down));//Hemisphere
j2.SetPtEtaPhiE(pTHem2_down, etaHem2_down, phiHem2_down, pTHem2_down*cosh(etaHem2_down));//Hemisphere
Dphi = j1.DeltaPhi(j2);
if(mr_down[2] >= 200.0 && rsq_down[2] >= 0.5 && btag == 0 && box == 0 && fabs(Dphi) < 2.5){
if(mr_down[2] > 200.0 && mr_down[2] <= 300.0 ){
if(rsq_down[2] > 1.2)rsq_down[2] = 1.1;
h_rsq_JES_down[xs_counter][0]->Fill(rsq_down[2], hlt_w*scaleF*pu_w*ISR);
}else if(mr_down[2] > 300.0 && mr_down[2] <= 400.0){
if(rsq_down[2] > 1.2)rsq_down[2] = 1.1;
h_rsq_JES_down[xs_counter][1]->Fill(rsq_down[2], hlt_w*scaleF*pu_w*ISR);
}else if(mr_down[2] > 400.0 && mr_down[2] <= 600.0){
if(rsq_down[2] > 1.2)rsq_down[2] = 1.1;
h_rsq_JES_down[xs_counter][2]->Fill(rsq_down[2], hlt_w*scaleF*pu_w*ISR);
}else if(mr_down[2] > 600.0 && mr_down[2] <= 3500.0){
if(rsq_down[2] > 1.2)rsq_down[2] = 1.1;
h_rsq_JES_down[xs_counter][3]->Fill(rsq_down[2], hlt_w*scaleF*pu_w*ISR);
}
}
}
double sample_eff_old = N_passed/Gen_Evts;
double sample_eff = N_passed_ISR/Gen_Evts_isr;
double sample_eff_up = N_passed_ISR_up/Gen_Evts_isrUp;
double sample_eff_down = N_passed_ISR_down/Gen_Evts_isrDown;
std::cout << "Sample Eff OLD: " << sample_eff_old*100 << "%" << std::endl;
std::cout << "Sample Eff: " << sample_eff*100 << "%" << std::endl;
std::cout << "Sample Eff Up: " << sample_eff_up*100 << "%" << std::endl;
std::cout << "Sample Eff Down: " << sample_eff_down*100 << "%" << std::endl;
for(int i = 0; i < 4; i++){
for(int j = 1; j <= s_up[xs_counter][i]->GetNbinsX(); j++){
s_up[xs_counter][i]->SetBinContent(j, h_rsq[xs_counter][i]->GetBinContent(j)+h_rsq[xs_counter][i]->GetBinError(j));
s_down[xs_counter][i]->SetBinContent(j, h_rsq[xs_counter][i]->GetBinContent(j)-h_rsq[xs_counter][i]->GetBinError(j));
}
}
if(DmSignalMap.find(dm_mass) != DmSignalMap.end()){
if(current_type.compare("AVu") == 0){
for(int icat = 0; icat < 4; icat++){
DmSignalMap[dm_mass].AVu[icat] = new TH1F(*h_rsq[xs_counter][icat]);
}
}
else if(current_type.compare("AVd") == 0){
for(int icat = 0; icat < 4; icat++){
DmSignalMap[dm_mass].AVd[icat] = new TH1F(*h_rsq[xs_counter][icat]);
}
}
else if(current_type.compare("Vu") == 0){
for(int icat = 0; icat < 4; icat++){
DmSignalMap[dm_mass].Vu[icat] = new TH1F(*h_rsq[xs_counter][icat]);
}
}
else if(current_type.compare("Vd") == 0){
for(int icat = 0; icat < 4; icat++){
DmSignalMap[dm_mass].Vd[icat] = new TH1F(*h_rsq[xs_counter][icat]);
}
}
}
else{
DmSignalPlots aux;
DmSignalMap[dm_mass] = aux;
if(current_type.compare("AVu") == 0){
for(int icat = 0; icat < 4; icat++){
DmSignalMap[dm_mass].AVu[icat] = new TH1F(*h_rsq[xs_counter][icat]);
}
}
else if(current_type.compare("AVd") == 0){
for(int icat = 0; icat < 4; icat++){
DmSignalMap[dm_mass].AVd[icat] = new TH1F(*h_rsq[xs_counter][icat]);
}
}
else if(current_type.compare("Vu") == 0){
for(int icat = 0; icat < 4; icat++){
DmSignalMap[dm_mass].Vu[icat] = new TH1F(*h_rsq[xs_counter][icat]);
}
}
else if(current_type.compare("Vd") == 0){
for(int icat = 0; icat < 4; icat++){
DmSignalMap[dm_mass].Vd[icat] = new TH1F(*h_rsq[xs_counter][icat]);
}
}
}
xs_counter++;
delete out;
delete eff;
}
}else{
std::cout << "Unable to open the file" << std::endl;
}
mfile0.close();
TLegend* leg;
TLegend* leg1;
TLegend* leg2;
TLegend* leg3;
THStack* stack1 = new THStack("stack1", "");
TH1F* dy_v1[4];
TH1F* w_v1[4];
TH1F* z_v1[4];
TH1F* tt_v1[4];
TH1F* dy_v2[4];
TH1F* w_v2[4];
TH1F* z_v2[4];
TH1F* tt_v2[4];
TH1F* data_v1[4];
for(int i = 0; i < 4; i++){
TString s = TString(Form("cat%d_dy",i+1));
dy_v1[i] = new TH1F(s, s, r2B[i], v.at(i));
s = TString(Form("cat%d_dy_v2",i+1));
dy_v2[i] = new TH1F(s, s, r2B[i], v.at(i));
dy_v2[i]->Sumw2();
s = TString(Form("cat%d_z",i+1));;
z_v1[i] = new TH1F(s, s, r2B[i], v.at(i));
s = TString(Form("cat%d_z_v2",i+1));
z_v2[i] = new TH1F(s, s, r2B[i], v.at(i));
z_v2[i]->Sumw2();
s = TString(Form("cat%d_w",i+1));;
w_v1[i] = new TH1F(s, s, r2B[i], v.at(i));
s = TString(Form("cat%d_w_v2",i+1));
w_v2[i] = new TH1F(s, s, r2B[i], v.at(i));
w_v2[i]->Sumw2();
s = TString(Form("cat%d_tt",i+1));;
tt_v1[i] = new TH1F(s, s, r2B[i], v.at(i));
s = TString(Form("cat%d_tt_v2",i+1));
tt_v2[i] = new TH1F(s, s, r2B[i], v.at(i));
tt_v2[i]->Sumw2();
s = TString(Form("cat%d_data",i+1));;
data_v1[i] = new TH1F(s, s, r2B[i], v.at(i));
data_v1[i]->Sumw2();
for(int j = 1; j <= r2B[i]; j++){
double bin_w = (*(v.at(i) + j) - *(v.at(i)+(j-1)))/(*(v.at(i)+1) - *(v.at(i)));
std::cout << "J: " << j << "BIN WIDTH: " << bin_w << std::endl;
dy_v1[i]->SetBinContent(j, dy[i]->GetBinContent(j)/bin_w);
dy_v2[i]->SetBinError(j, dy[i]->GetBinError(j)/bin_w);
dy_v2[i]->SetBinContent(j, dy[i]->GetBinContent(j)/bin_w);
z_v1[i]->SetBinContent(j, z[i]->GetBinContent(j)/bin_w);
z_v2[i]->SetBinError(j, z[i]->GetBinError(j)/bin_w);
z_v2[i]->SetBinContent(j, z[i]->GetBinContent(j)/bin_w);
w_v1[i]->SetBinContent(j, w[i]->GetBinContent(j)/bin_w);
w_v2[i]->SetBinError(j, w[i]->GetBinError(j)/bin_w);
w_v2[i]->SetBinContent(j, w[i]->GetBinContent(j)/bin_w);
tt_v1[i]->SetBinContent(j, tt[i]->GetBinContent(j)/bin_w);
tt_v2[i]->SetBinError(j, tt[i]->GetBinError(j)/bin_w);
tt_v2[i]->SetBinContent(j, tt[i]->GetBinContent(j)/bin_w);
data_v1[i]->SetBinError(j, data[i]->GetBinError(j)/bin_w);
data_v1[i]->SetBinContent(j, data[i]->GetBinContent(j)/bin_w);
std::cout << "b_err: " << w[i]->GetBinError(j) << " new Err: " << w_v2[i]->GetBinError(j) << std::endl;
}
}
//Up and Down Comparison
for( auto tmp : DmSignalMap){
std::cout << "MASS: " << tmp.first << std::endl;
for(int k = 0; k < 4; k++){
stack1 = new THStack("stack1", "");
data_v1[k]->SetMarkerStyle(20);
data_v1[k]->SetLineColor(1);
data_v1[k]->SetMarkerSize(1.5);
tt_v1[k]->SetFillColor(kPink+9);
dy_v1[k]->SetFillColor(kViolet+9);
z_v1[k]->SetFillColor(kYellow-4);
w_v1[k]->SetFillColor(kSpring+4);
//AVu
//tmp.second.AVu[k]->SetLineColor(kBlue-3);
tmp.second.AVu[k]->SetLineColor(kBlack);
tmp.second.AVu[k]->SetLineWidth(3);
tmp.second.AVu[k]->SetLineStyle(2);
//AVd
//tmp.second.AVd[k]->SetLineColor(kGreen-6);
tmp.second.AVd[k]->SetLineColor(kBlack);
tmp.second.AVd[k]->SetLineWidth(3);
tmp.second.AVd[k]->SetLineStyle(9);
//Vu
//tmp.second.Vu[k]->SetLineColor(kBlue-3);
tmp.second.Vu[k]->SetLineColor(kBlack);
tmp.second.Vu[k]->SetLineWidth(3);
tmp.second.Vu[k]->SetLineStyle(2);
//Vd
//tmp.second.Vd[k]->SetLineColor(kGreen-6);
tmp.second.Vd[k]->SetLineColor(kBlack);
tmp.second.Vd[k]->SetLineWidth(3);
tmp.second.Vd[k]->SetLineStyle(9);
//AV legend
TString lstr1 = tmp.first.c_str();
lstr1 = "AVu-DM m = " + lstr1 + " GeV";
TString lstr2 = tmp.first.c_str();
lstr2 = "AVd-DM m = " + lstr2 + " GeV";
leg = new TLegend(0.65,0.7,0.89,0.92);
leg->AddEntry(w_v1[k],"W + jets","f");
leg->AddEntry(z_v1[k],"Z(#nu#bar{#nu}) + jets","f");
leg->AddEntry(tt_v1[k],"t #bar{t} + jets","f");
leg->AddEntry(dy_v1[k],"Z/#gamma^{*}(ll) + jets","f");
leg->AddEntry(data_v1[k],"Data","lep");
leg->AddEntry(tmp.second.AVu[k], lstr1, "l");
leg->AddEntry(tmp.second.AVd[k], lstr2, "l");
//V legend
lstr1 = tmp.first.c_str();
lstr1 = "Vu-DM m = " + lstr1 + " GeV";
lstr2 = tmp.first.c_str();
lstr2 = "Vd-DM m = " + lstr2 + " GeV";
leg1 = new TLegend(0.65,0.7,0.89,0.92);
leg1->AddEntry(w_v1[k],"W + jets","f");
leg1->AddEntry(z_v1[k],"Z(#nu#bar{#nu}) + jets","f");
leg1->AddEntry(tt_v1[k],"t #bar{t} + jets","f");
leg1->AddEntry(dy_v1[k],"Z/#gamma^{*}(ll) + jets","f");
leg1->AddEntry(data_v1[k],"Data","lep");
leg1->AddEntry(tmp.second.Vu[k], lstr1, "l");
leg1->AddEntry(tmp.second.Vd[k], lstr2, "l");
w_v1[k]->SetTitle("");
w_v1[k]->SetStats(0);
tt_v1[k]->SetTitle("");
tt_v1[k]->SetStats(0);
dy_v1[k]->SetTitle("");
dy_v1[k]->SetStats(0);
z_v1[k]->SetTitle("");
z_v1[k]->SetStats(0);
data_v1[k]->SetTitle("");
data_v1[k]->SetStats(0);
stack1->Add(dy_v1[k]);//DY
stack1->Add(tt_v1[k]);//TTbar
stack1->Add(z_v1[k]);//Wjets
stack1->Add(w_v1[k]);//ZJets
stack1->Draw();
( (TAxis*)( stack1->GetXaxis() ) )->SetTitle("R^{2}");
stack1->Draw();
data_v1[k]->Draw("same");
TH1F* aux2 = new TH1F( *dy_v2[k] );
aux2->Sumw2();
aux2->Add(tt_v2[k], 1);
aux2->Add(z_v2[k], 1);
aux2->Add(w_v2[k], 1);
TString DM_mass = tmp.first.c_str();
TString s = TString(Form("SignalStackPlots/Data_MC_cat%d",k+1));
s = s + "_" + DM_mass;
TString y_axis;
if(k == 0){
y_axis = "Events";
}else if(k ==3){
y_axis = "Events";
}else{
y_axis = "Events";
}
RatioPlotsV3(stack1, data_v1[k], aux2, "MC 0 #mu BOX", "Data 0 #mu BOX", s, "RSQ", r2B[k], v.at(k),leg, y_axis);
RatioPlotSignal(stack1, data_v1[k], aux2, "MC 0 #mu BOX", "Data 0 #mu BOX", s+"_signal_Vu", "RSQ", r2B[k], v.at(k),leg, y_axis, tmp.second.AVu[k]);
RatioPlotSignal(stack1, data_v1[k], aux2, "MC 0 #mu BOX", "Data 0 #mu BOX", s+"_DoubleSignal_AV", "RSQ", r2B[k], v.at(k),leg, y_axis,
tmp.second.AVu[k], tmp.second.AVd[k]);
RatioPlotSignal(stack1, data_v1[k], aux2, "MC 0 #mu BOX", "Data 0 #mu BOX", s+"_DoubleSignal_V", "RSQ", r2B[k], v.at(k),leg, y_axis,
tmp.second.Vu[k], tmp.second.Vd[k]);
delete leg, leg1, aux2;
}
}
//Mass Comparison
const int nmasses = 6;
std::string mDM[nmasses] = {"1", "10", "100", "400", "700" , "1000"};
for(int i = 0; i < nmasses; i++){
for(int j = i+1; j < nmasses; j++){
for(int k = 0; k < 4; k++){
stack1 = new THStack("stack1", "");
data_v1[k]->SetMarkerStyle(20);
data_v1[k]->SetLineColor(1);
data_v1[k]->SetMarkerSize(1.5);
tt_v1[k]->SetFillColor(kPink+9);
dy_v1[k]->SetFillColor(kViolet+9);
z_v1[k]->SetFillColor(kYellow-4);
w_v1[k]->SetFillColor(kSpring+4);
//MASS1
//Mass 1 AVu
//DmSignalMap[mDM[i]].AVu[k]->SetLineColor(kBlue-3);
DmSignalMap[mDM[i]].AVu[k]->SetLineColor(kBlack);
DmSignalMap[mDM[i]].AVu[k]->SetLineWidth(3);
DmSignalMap[mDM[i]].AVu[k]->SetLineStyle(2);
//Mass 1 AVd
//DmSignalMap[mDM[i]].AVd[k]->SetLineColor(kBlue-3);
DmSignalMap[mDM[i]].AVd[k]->SetLineColor(kBlack);
DmSignalMap[mDM[i]].AVd[k]->SetLineWidth(3);
DmSignalMap[mDM[i]].AVd[k]->SetLineStyle(2);
//Mass 1 Vu
//DmSignalMap[mDM[i]].Vu[k]->SetLineColor(kBlue-3);
DmSignalMap[mDM[i]].Vu[k]->SetLineColor(kBlack);
DmSignalMap[mDM[i]].Vu[k]->SetLineWidth(3);
DmSignalMap[mDM[i]].Vu[k]->SetLineStyle(2);
//Mass 1 Vd
//DmSignalMap[mDM[i]].Vd[k]->SetLineColor(kBlue-3);
DmSignalMap[mDM[i]].Vd[k]->SetLineColor(kBlack);
DmSignalMap[mDM[i]].Vd[k]->SetLineWidth(3);
DmSignalMap[mDM[i]].Vd[k]->SetLineStyle(2);
//MASS2
//Mass 2 AVu
//DmSignalMap[mDM[j]].AVu[k]->SetLineColor(kGreen-6);
DmSignalMap[mDM[j]].AVu[k]->SetLineColor(kBlack);
DmSignalMap[mDM[j]].AVu[k]->SetLineWidth(3);
DmSignalMap[mDM[j]].AVu[k]->SetLineStyle(9);
//Mass 2 AVd
//DmSignalMap[mDM[j]].AVd[k]->SetLineColor(kGreen-6);
DmSignalMap[mDM[j]].AVd[k]->SetLineColor(kBlack);
DmSignalMap[mDM[j]].AVd[k]->SetLineWidth(3);
DmSignalMap[mDM[j]].AVd[k]->SetLineStyle(9);
//Mass 2 Vu
//DmSignalMap[mDM[j]].Vu[k]->SetLineColor(kGreen-6);
DmSignalMap[mDM[j]].Vu[k]->SetLineColor(kBlack);
DmSignalMap[mDM[j]].Vu[k]->SetLineWidth(3);
DmSignalMap[mDM[j]].Vu[k]->SetLineStyle(9);
//Mass 2 Vd
//DmSignalMap[mDM[j]].Vd[k]->SetLineColor(kGreen-6);
DmSignalMap[mDM[j]].Vd[k]->SetLineColor(kBlack);
DmSignalMap[mDM[j]].Vd[k]->SetLineWidth(3);
DmSignalMap[mDM[j]].Vd[k]->SetLineStyle(9);
//AVu legend
TString lstr1 = mDM[i];
lstr1 = "AVu-DM m = " + lstr1 + " GeV";
TString lstr2 = mDM[j];
lstr2 = "AVu-DM m = " + lstr2 + " GeV";
leg = new TLegend(0.65,0.7,0.89,0.92);
leg->AddEntry(w_v1[k],"W + jets","f");
leg->AddEntry(z_v1[k],"Z(#nu#bar{#nu}) + jets","f");
leg->AddEntry(tt_v1[k],"t #bar{t} + jets","f");
leg->AddEntry(dy_v1[k],"Z/#gamma^{*}(ll) + jets","f");
leg->AddEntry(data_v1[k],"Data","lep");
leg->AddEntry(DmSignalMap[mDM[i]].AVu[k], lstr1, "l");
leg->AddEntry(DmSignalMap[mDM[j]].AVu[k], lstr2, "l");
//AVd legend
lstr1 = mDM[i];
lstr1 = "AVd-DM m = " + lstr1 + " GeV";
lstr2 = mDM[j];
lstr2 = "AVd-DM m = " + lstr2 + " GeV";
leg1 = new TLegend(0.65,0.7,0.89,0.92);
leg1->AddEntry(w_v1[k],"W + jets","f");
leg1->AddEntry(z_v1[k],"Z(#nu#bar{#nu}) + jets","f");
leg1->AddEntry(tt_v1[k],"t #bar{t} + jets","f");
leg1->AddEntry(dy_v1[k],"Z/#gamma^{*}(ll) + jets","f");
leg1->AddEntry(data_v1[k],"Data","lep");
leg1->AddEntry(DmSignalMap[mDM[i]].AVd[k], lstr1, "l");
leg1->AddEntry(DmSignalMap[mDM[j]].AVd[k], lstr2, "l");
//Vu legend
lstr1 = mDM[i];
lstr1 = "Vu-DM m = " + lstr1 + " GeV";
lstr2 = mDM[j];
lstr2 = "Vu-DM m = " + lstr2 + " GeV";
leg2 = new TLegend(0.65,0.7,0.89,0.92);
leg2->AddEntry(w_v1[k],"W + jets","f");
leg2->AddEntry(z_v1[k],"Z(#nu#bar{#nu}) + jets","f");
leg2->AddEntry(tt_v1[k],"t #bar{t} + jets","f");
leg2->AddEntry(dy_v1[k],"Z/#gamma^{*}(ll) + jets","f");
leg2->AddEntry(data_v1[k],"Data","lep");
leg2->AddEntry(DmSignalMap[mDM[i]].Vu[k], lstr1, "l");
leg2->AddEntry(DmSignalMap[mDM[j]].Vu[k], lstr2, "l");
//Vd legend
lstr1 = mDM[i];
lstr1 = "Vd-DM m = " + lstr1 + " GeV";
lstr2 = mDM[j];
lstr2 = "Vd-DM m = " + lstr2 + " GeV";
leg3 = new TLegend(0.65,0.7,0.89,0.92);
leg3->AddEntry(w_v1[k],"W + jets","f");
leg3->AddEntry(z_v1[k],"Z(#nu#bar{#nu}) + jets","f");
leg3->AddEntry(tt_v1[k],"t #bar{t} + jets","f");
leg3->AddEntry(dy_v1[k],"Z/#gamma^{*}(ll) + jets","f");
leg3->AddEntry(data_v1[k],"Data","lep");
leg3->AddEntry(DmSignalMap[mDM[i]].Vd[k], lstr1, "l");
leg3->AddEntry(DmSignalMap[mDM[j]].Vd[k], lstr2, "l");
//COSMETICS
w_v1[k]->SetTitle("");
w_v1[k]->SetStats(0);
tt_v1[k]->SetTitle("");
tt_v1[k]->SetStats(0);
dy_v1[k]->SetTitle("");
dy_v1[k]->SetStats(0);
z_v1[k]->SetTitle("");
z_v1[k]->SetStats(0);
data_v1[k]->SetTitle("");
data_v1[k]->SetStats(0);
stack1->Add(dy_v1[k]);//DY
stack1->Add(tt_v1[k]);//TTbar
stack1->Add(z_v1[k]);//Wjets
stack1->Add(w_v1[k]);//ZJets
stack1->Draw();
( (TAxis*)( stack1->GetXaxis() ) )->SetTitle("R^{2}");
stack1->Draw();
data_v1[k]->Draw("same");
TH1F* aux2 = new TH1F( *dy_v2[k] );
aux2->Sumw2();
aux2->Add(tt_v2[k], 1);
aux2->Add(z_v2[k], 1);
aux2->Add(w_v2[k], 1);
TString s = TString(Form("SignalStackPlots/Data_MC_cat%d",k+1));
s = s + "_m1_" + mDM[i].c_str() + "_m2_" + mDM[j].c_str() ;
TString y_axis;
if(k == 0){
y_axis = "Events";
}else if(k ==3){
y_axis = "Events";
}else{
y_axis = "Events";
}
RatioPlotSignal(stack1, data_v1[k], aux2,
"MC 0 #mu BOX", "Data 0 #mu BOX", s+"_DoubleSignalMass_AVu", "RSQ",
r2B[k], v.at(k),leg, y_axis,
DmSignalMap[mDM[i]].AVu[k], DmSignalMap[mDM[j]].AVu[k]);
RatioPlotSignal(stack1, data_v1[k], aux2,
"MC 0 #mu BOX", "Data 0 #mu BOX", s+"_DoubleSignalMass_AVd", "RSQ",
r2B[k], v.at(k),leg1, y_axis,
DmSignalMap[mDM[i]].AVd[k], DmSignalMap[mDM[j]].AVd[k]);
RatioPlotSignal(stack1, data_v1[k], aux2,
"MC 0 #mu BOX", "Data 0 #mu BOX", s+"_DoubleSignalMass_Vu", "RSQ",
r2B[k], v.at(k),leg2, y_axis,
DmSignalMap[mDM[i]].Vu[k], DmSignalMap[mDM[j]].Vu[k]);
RatioPlotSignal(stack1, data_v1[k], aux2,
"MC 0 #mu BOX", "Data 0 #mu BOX", s+"_DoubleSignalMass_Vd", "RSQ",
r2B[k], v.at(k),leg3, y_axis,
DmSignalMap[mDM[i]].Vd[k], DmSignalMap[mDM[j]].Vd[k]);
delete leg, leg1, leg2, leg3, aux2;
}//end categories loop
}//end second mass loop
}//end first mass lopp
return 0;
}
| [
"cristian.pena@caltech.edu"
] | cristian.pena@caltech.edu |
730feb9f125320208d2b1314ee010507f17993b1 | cea8554cab3be62f324c454940858084db681682 | /onnxruntime/contrib_ops/cuda/bert/cutlass_fmha/fmha_launch_template.h | 00fa265e117bcf78fefcdbae84e7f5148b9d10ea | [
"MIT"
] | permissive | intel/onnxruntime | 30cd350c4ef50a8458bc2ba49f113bb757c2f63e | c961f67b5ee5d433a4bf73554a196af021d6c12a | refs/heads/master | 2023-08-30T15:38:40.673433 | 2023-08-30T01:41:56 | 2023-08-30T01:41:56 | 183,522,394 | 46 | 16 | MIT | 2023-09-12T17:15:38 | 2019-04-25T23:14:54 | C++ | UTF-8 | C++ | false | false | 5,336 | h | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#if USE_FLASH_ATTENTION
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif
#include "contrib_ops/cuda/bert/cutlass_fmha/memory_efficient_attention.h"
#include "41_fused_multi_head_attention/kernel_forward.h"
namespace onnxruntime {
namespace contrib {
namespace cuda {
template <typename T, typename ArchTag, bool is_aligned, int queries_per_block, int keys_per_block, bool single_value_iteration>
void LaunchCutlassFmha(const MemoryEfficientAttentionParams& params) {
using Attention = AttentionKernel<T, ArchTag, is_aligned, queries_per_block, keys_per_block, single_value_iteration>;
typename Attention::Params p;
{ // set parameters
p.query_ptr = const_cast<T*>(reinterpret_cast<const T*>(params.query));
p.key_ptr = const_cast<T*>(reinterpret_cast<const T*>(params.key));
p.value_ptr = const_cast<T*>(reinterpret_cast<const T*>(params.value));
p.attn_bias_ptr = const_cast<T*>(reinterpret_cast<const T*>(params.attn_bias));
p.seqstart_q_ptr = params.seqstart_q_ptr;
p.seqstart_k_ptr = params.seqstart_k_ptr;
p.seqlen_k_ptr = params.seqlen_k_ptr;
p.logsumexp_ptr = nullptr; // [num_heads, num_queries] for backward or nullptr for forward
p.output_ptr = reinterpret_cast<T*>(params.output);
if (Attention::kNeedsOutputAccumulatorBuffer) {
using Acc = typename Attention::accum_t;
// workspace size: batch_size * sequence_length * num_heads * v_head_size * sizeof(float)
ORT_ENFORCE(params.workspace != nullptr, "Need output accumulator buffer but no workspace provided");
p.output_accum_ptr = reinterpret_cast<Acc*>(params.workspace);
} else {
p.output_accum_ptr = nullptr;
}
p.num_heads = params.num_heads;
p.num_batches = params.batch_size;
p.head_dim = params.qk_head_size;
p.head_dim_value = params.v_head_size;
p.scale = params.scale;
// When params.cu_seqlens_q is provided, num_queries is max_seq_q and num_keys will be set inside the kernel
p.num_queries = params.sequence_length;
p.num_keys = params.kv_sequence_length;
if (params.causal) {
p.custom_mask_type = Attention::CausalFromTopLeft;
}
// Input format is BxSxNxH, output is BxSxNxH
p.q_strideH = params.qk_head_size;
p.k_strideH = params.qk_head_size;
p.v_strideH = params.v_head_size;
p.bias_strideH = nullptr == params.attn_bias ? 0 : p.num_queries * p.num_keys;
p.q_strideM = params.num_heads * params.qk_head_size;
p.k_strideM = params.num_heads * params.qk_head_size;
p.v_strideM = params.num_heads * params.v_head_size;
p.o_strideM = params.num_heads * params.v_head_size;
p.bias_strideM = nullptr == params.attn_bias ? 0 : p.num_keys;
p.q_strideB = static_cast<int64_t>(p.q_strideM) * params.sequence_length;
p.k_strideB = static_cast<int64_t>(p.k_strideM) * params.kv_sequence_length;
p.v_strideB = static_cast<int64_t>(p.v_strideM) * params.kv_sequence_length;
p.bias_strideB = params.is_attn_bias_batched ? static_cast<int64_t>(p.bias_strideH) * params.num_heads : 0;
}
constexpr auto kernel_fn = attention_kernel_batched_impl<Attention>;
int smem_bytes = sizeof(typename Attention::SharedStorage);
if (smem_bytes > 0xc000) {
ORT_ENFORCE(params.sm >= 70, "This kernel requires too much shared memory on this machine!");
static bool once = [&]() {
cudaFuncSetAttribute(kernel_fn, cudaFuncAttributeMaxDynamicSharedMemorySize, smem_bytes);
return true;
}();
}
ORT_ENFORCE(Attention::check_supported(p));
kernel_fn<<<p.getBlocksGrid(), p.getThreadsGrid(), smem_bytes, params.stream>>>(p);
}
template <typename T, typename ArchTag, int queries_per_block, int keys_per_block, bool single_value_iteration>
void DispatchIsAligned(const MemoryEfficientAttentionParams& params) {
using AlignedAK = AttentionKernel<T, ArchTag, true, queries_per_block, keys_per_block, single_value_iteration>;
#if defined(_MSC_VER) && !defined(__clang__)
#pragma warning(push)
#pragma warning(disable : 6287)
#endif
// Run a more efficient kernel with `isAligned=True` when memory is correctly aligned.
bool is_aligned = params.qk_head_size % AlignedAK::kAlignmentQ == 0 &&
params.qk_head_size % AlignedAK::kAlignmentK == 0 &&
params.v_head_size % AlignedAK::kAlignmentV == 0;
#if defined(_MSC_VER) && !defined(__clang__)
#pragma warning(pop)
#endif
DISPATCH_BOOL(is_aligned, kIsAligned, ([&]() {
LaunchCutlassFmha<T, ArchTag, kIsAligned, queries_per_block, keys_per_block, single_value_iteration>(params);
}));
}
template <typename T, typename ArchTag>
void DispatchBlockSize(const MemoryEfficientAttentionParams& params) {
if (params.v_head_size <= 64) {
DispatchIsAligned<T, ArchTag, 64, 64, true>(params);
} else if (params.v_head_size <= 128) {
DispatchIsAligned<T, ArchTag, 32, 128, true>(params);
} else {
DispatchIsAligned<T, ArchTag, 32, 128, false>(params);
}
}
} // namespace cuda
} // namespace contrib
} // namespace onnxruntime
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
#endif // USE_FLASH_ATTENTION
| [
"noreply@github.com"
] | noreply@github.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.