blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 2
247
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
57
| license_type
stringclasses 2
values | repo_name
stringlengths 4
111
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
58
| visit_date
timestamp[ns]date 2015-07-25 18:16:41
2023-09-06 10:45:08
| revision_date
timestamp[ns]date 1970-01-14 14:03:36
2023-09-06 06:22:19
| committer_date
timestamp[ns]date 1970-01-14 14:03:36
2023-09-06 06:22:19
| github_id
int64 3.89k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 25
values | gha_event_created_at
timestamp[ns]date 2012-06-07 00:51:45
2023-09-14 21:58:52
⌀ | gha_created_at
timestamp[ns]date 2008-03-27 23:40:48
2023-08-24 19:49:39
⌀ | gha_language
stringclasses 159
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 7
10.5M
| extension
stringclasses 111
values | filename
stringlengths 1
195
| text
stringlengths 7
10.5M
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ac5dbd25ed0567627cc3a0c09614da5384febae7
|
d2c89d6da56a30c0d8a09399b48e98bf9d57efcb
|
/Interpret/Interpret.h
|
d7b322f33267e8d386eee82f490edb46148d6328
|
[] |
no_license
|
protectors/Design-pattern
|
5699ae9b3862a9cde6daf5582967476e9d8ee420
|
7eeaa183efb2d06b7b20088c5e5d8a60577abba6
|
refs/heads/master
| 2020-11-25T17:56:52.378850
| 2020-02-18T03:34:35
| 2020-02-18T03:34:35
| 228,782,165
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,097
|
h
|
Interpret.h
|
#ifndef _INTERPRET_H_
#define _INTERPRET_H_
#include <string>
#include <iostream>
using namespace std;
class Context{
public:
Context(){}
~Context(){}
};
class AbstractExpression{
public:
virtual ~AbstractExpression(){}
virtual void Interpret(const Context& c){}
protected:
AbstractExpression(){}
};
class TerminalExpression:public AbstractExpression{
public:
TerminalExpression(const string& statement){
this->_statement=statement;
}
~ TerminalExpression(){}
void Interpret(const Context& c){
cout<<this->_statement<<"TerminalExpression"<<endl;
}
private:
string _statement;
};
class NonterminalExpression:public AbstractExpression{
public:
NonterminalExpression(AbstractExpression* expression,int times){
this->_expression = expression;
this->_times = times;
}
~ NonterminalExpression(){}
void Interpret(const Context& c){
for (int i = 0; i < _times ; i++){
this->_expression->Interpret(c);
}
}
private:
AbstractExpression* _expression;
int _times;
};
#endif
|
cfc7f99531ae787ff2df47799cae90ba46057000
|
e14ffcfbf7f037584b909776d9f1a126cbe6bdcd
|
/build/ros_cellulo/ros_cellulo_core_autogen/4CJARJP7H4/moc_CelluloZoneAngleInterval.cpp
|
895e0e1727d2c04f95b0f0167b0c46e7e274a558
|
[] |
no_license
|
LucaFetz/swarm2
|
5c1be70c2f365cd464d2ec08918b98d90e14fa34
|
5cc4c21d9bda0b4f2108caf8c2d6da5071ec1719
|
refs/heads/master
| 2020-04-29T18:33:20.334552
| 2019-03-18T16:41:23
| 2019-03-18T16:41:23
| 176,327,454
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 20,514
|
cpp
|
moc_CelluloZoneAngleInterval.cpp
|
/****************************************************************************
** Meta object code from reading C++ file 'CelluloZoneAngleInterval.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.11.1)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../../../../src/ros_cellulo/include/CelluloRobot/src/zones/CelluloZoneAngleInterval.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'CelluloZoneAngleInterval.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.11.1. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
struct qt_meta_stringdata_Cellulo__CelluloZoneAngleInterval_t {
QByteArrayData data[12];
char stringdata0[167];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_Cellulo__CelluloZoneAngleInterval_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_Cellulo__CelluloZoneAngleInterval_t qt_meta_stringdata_Cellulo__CelluloZoneAngleInterval = {
{
QT_MOC_LITERAL(0, 0, 33), // "Cellulo::CelluloZoneAngleInte..."
QT_MOC_LITERAL(1, 34, 16), // "fromAngleChanged"
QT_MOC_LITERAL(2, 51, 0), // ""
QT_MOC_LITERAL(3, 52, 14), // "toAngleChanged"
QT_MOC_LITERAL(4, 67, 13), // "isMouseInside"
QT_MOC_LITERAL(5, 81, 13), // "mousePosition"
QT_MOC_LITERAL(6, 95, 11), // "canvasWidth"
QT_MOC_LITERAL(7, 107, 12), // "canvasHeight"
QT_MOC_LITERAL(8, 120, 13), // "physicalWidth"
QT_MOC_LITERAL(9, 134, 14), // "physicalHeight"
QT_MOC_LITERAL(10, 149, 9), // "fromAngle"
QT_MOC_LITERAL(11, 159, 7) // "toAngle"
},
"Cellulo::CelluloZoneAngleInterval\0"
"fromAngleChanged\0\0toAngleChanged\0"
"isMouseInside\0mousePosition\0canvasWidth\0"
"canvasHeight\0physicalWidth\0physicalHeight\0"
"fromAngle\0toAngle"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_Cellulo__CelluloZoneAngleInterval[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
3, 14, // methods
2, 42, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
2, // signalCount
// signals: name, argc, parameters, tag, flags
1, 0, 29, 2, 0x06 /* Public */,
3, 0, 30, 2, 0x06 /* Public */,
// methods: name, argc, parameters, tag, flags
4, 5, 31, 2, 0x02 /* Public */,
// signals: parameters
QMetaType::Void,
QMetaType::Void,
// methods: parameters
QMetaType::Bool, QMetaType::QVector2D, QMetaType::QReal, QMetaType::QReal, QMetaType::QReal, QMetaType::QReal, 5, 6, 7, 8, 9,
// properties: name, type, flags
10, QMetaType::Float, 0x00495103,
11, QMetaType::Float, 0x00495103,
// properties: notify_signal_id
0,
1,
0 // eod
};
void Cellulo::CelluloZoneAngleInterval::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
CelluloZoneAngleInterval *_t = static_cast<CelluloZoneAngleInterval *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->fromAngleChanged(); break;
case 1: _t->toAngleChanged(); break;
case 2: { bool _r = _t->isMouseInside((*reinterpret_cast< QVector2D(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2])),(*reinterpret_cast< qreal(*)>(_a[3])),(*reinterpret_cast< qreal(*)>(_a[4])),(*reinterpret_cast< qreal(*)>(_a[5])));
if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = std::move(_r); } break;
default: ;
}
} else if (_c == QMetaObject::IndexOfMethod) {
int *result = reinterpret_cast<int *>(_a[0]);
{
using _t = void (CelluloZoneAngleInterval::*)();
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&CelluloZoneAngleInterval::fromAngleChanged)) {
*result = 0;
return;
}
}
{
using _t = void (CelluloZoneAngleInterval::*)();
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&CelluloZoneAngleInterval::toAngleChanged)) {
*result = 1;
return;
}
}
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
CelluloZoneAngleInterval *_t = static_cast<CelluloZoneAngleInterval *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< float*>(_v) = _t->getFromAngle(); break;
case 1: *reinterpret_cast< float*>(_v) = _t->getToAngle(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
CelluloZoneAngleInterval *_t = static_cast<CelluloZoneAngleInterval *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setFromAngle(*reinterpret_cast< float*>(_v)); break;
case 1: _t->setToAngle(*reinterpret_cast< float*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
}
QT_INIT_METAOBJECT const QMetaObject Cellulo::CelluloZoneAngleInterval::staticMetaObject = {
{ &CelluloZone::staticMetaObject, qt_meta_stringdata_Cellulo__CelluloZoneAngleInterval.data,
qt_meta_data_Cellulo__CelluloZoneAngleInterval, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *Cellulo::CelluloZoneAngleInterval::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *Cellulo::CelluloZoneAngleInterval::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_Cellulo__CelluloZoneAngleInterval.stringdata0))
return static_cast<void*>(this);
return CelluloZone::qt_metacast(_clname);
}
int Cellulo::CelluloZoneAngleInterval::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = CelluloZone::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 3)
qt_static_metacall(this, _c, _id, _a);
_id -= 3;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 3)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 3;
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 2;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 2;
}
#endif // QT_NO_PROPERTIES
return _id;
}
// SIGNAL 0
void Cellulo::CelluloZoneAngleInterval::fromAngleChanged()
{
QMetaObject::activate(this, &staticMetaObject, 0, nullptr);
}
// SIGNAL 1
void Cellulo::CelluloZoneAngleInterval::toAngleChanged()
{
QMetaObject::activate(this, &staticMetaObject, 1, nullptr);
}
struct qt_meta_stringdata_Cellulo__CelluloZoneAngleIntervalInner_t {
QByteArrayData data[6];
char stringdata0[75];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_Cellulo__CelluloZoneAngleIntervalInner_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_Cellulo__CelluloZoneAngleIntervalInner_t qt_meta_stringdata_Cellulo__CelluloZoneAngleIntervalInner = {
{
QT_MOC_LITERAL(0, 0, 38), // "Cellulo::CelluloZoneAngleInte..."
QT_MOC_LITERAL(1, 39, 9), // "calculate"
QT_MOC_LITERAL(2, 49, 0), // ""
QT_MOC_LITERAL(3, 50, 6), // "xRobot"
QT_MOC_LITERAL(4, 57, 6), // "yRobot"
QT_MOC_LITERAL(5, 64, 10) // "thetaRobot"
},
"Cellulo::CelluloZoneAngleIntervalInner\0"
"calculate\0\0xRobot\0yRobot\0thetaRobot"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_Cellulo__CelluloZoneAngleIntervalInner[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
1, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// methods: name, argc, parameters, tag, flags
1, 3, 19, 2, 0x02 /* Public */,
// methods: parameters
QMetaType::Float, QMetaType::Float, QMetaType::Float, QMetaType::Float, 3, 4, 5,
0 // eod
};
void Cellulo::CelluloZoneAngleIntervalInner::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
CelluloZoneAngleIntervalInner *_t = static_cast<CelluloZoneAngleIntervalInner *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: { float _r = _t->calculate((*reinterpret_cast< float(*)>(_a[1])),(*reinterpret_cast< float(*)>(_a[2])),(*reinterpret_cast< float(*)>(_a[3])));
if (_a[0]) *reinterpret_cast< float*>(_a[0]) = std::move(_r); } break;
default: ;
}
}
}
QT_INIT_METAOBJECT const QMetaObject Cellulo::CelluloZoneAngleIntervalInner::staticMetaObject = {
{ &CelluloZoneAngleInterval::staticMetaObject, qt_meta_stringdata_Cellulo__CelluloZoneAngleIntervalInner.data,
qt_meta_data_Cellulo__CelluloZoneAngleIntervalInner, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *Cellulo::CelluloZoneAngleIntervalInner::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *Cellulo::CelluloZoneAngleIntervalInner::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_Cellulo__CelluloZoneAngleIntervalInner.stringdata0))
return static_cast<void*>(this);
return CelluloZoneAngleInterval::qt_metacast(_clname);
}
int Cellulo::CelluloZoneAngleIntervalInner::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = CelluloZoneAngleInterval::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 1)
qt_static_metacall(this, _c, _id, _a);
_id -= 1;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 1)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 1;
}
return _id;
}
struct qt_meta_stringdata_Cellulo__CelluloZoneAngleIntervalBorder_t {
QByteArrayData data[8];
char stringdata0[115];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_Cellulo__CelluloZoneAngleIntervalBorder_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_Cellulo__CelluloZoneAngleIntervalBorder_t qt_meta_stringdata_Cellulo__CelluloZoneAngleIntervalBorder = {
{
QT_MOC_LITERAL(0, 0, 39), // "Cellulo::CelluloZoneAngleInte..."
QT_MOC_LITERAL(1, 40, 22), // "borderThicknessChanged"
QT_MOC_LITERAL(2, 63, 0), // ""
QT_MOC_LITERAL(3, 64, 9), // "calculate"
QT_MOC_LITERAL(4, 74, 6), // "xRobot"
QT_MOC_LITERAL(5, 81, 6), // "yRobot"
QT_MOC_LITERAL(6, 88, 10), // "thetaRobot"
QT_MOC_LITERAL(7, 99, 15) // "borderThickness"
},
"Cellulo::CelluloZoneAngleIntervalBorder\0"
"borderThicknessChanged\0\0calculate\0"
"xRobot\0yRobot\0thetaRobot\0borderThickness"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_Cellulo__CelluloZoneAngleIntervalBorder[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
2, 14, // methods
1, 32, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
1, // signalCount
// signals: name, argc, parameters, tag, flags
1, 0, 24, 2, 0x06 /* Public */,
// methods: name, argc, parameters, tag, flags
3, 3, 25, 2, 0x02 /* Public */,
// signals: parameters
QMetaType::Void,
// methods: parameters
QMetaType::Float, QMetaType::Float, QMetaType::Float, QMetaType::Float, 4, 5, 6,
// properties: name, type, flags
7, QMetaType::QReal, 0x00495103,
// properties: notify_signal_id
0,
0 // eod
};
void Cellulo::CelluloZoneAngleIntervalBorder::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
CelluloZoneAngleIntervalBorder *_t = static_cast<CelluloZoneAngleIntervalBorder *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->borderThicknessChanged(); break;
case 1: { float _r = _t->calculate((*reinterpret_cast< float(*)>(_a[1])),(*reinterpret_cast< float(*)>(_a[2])),(*reinterpret_cast< float(*)>(_a[3])));
if (_a[0]) *reinterpret_cast< float*>(_a[0]) = std::move(_r); } break;
default: ;
}
} else if (_c == QMetaObject::IndexOfMethod) {
int *result = reinterpret_cast<int *>(_a[0]);
{
using _t = void (CelluloZoneAngleIntervalBorder::*)();
if (*reinterpret_cast<_t *>(_a[1]) == static_cast<_t>(&CelluloZoneAngleIntervalBorder::borderThicknessChanged)) {
*result = 0;
return;
}
}
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
CelluloZoneAngleIntervalBorder *_t = static_cast<CelluloZoneAngleIntervalBorder *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< qreal*>(_v) = _t->getBorderThickness(); break;
default: break;
}
} else if (_c == QMetaObject::WriteProperty) {
CelluloZoneAngleIntervalBorder *_t = static_cast<CelluloZoneAngleIntervalBorder *>(_o);
Q_UNUSED(_t)
void *_v = _a[0];
switch (_id) {
case 0: _t->setBorderThickness(*reinterpret_cast< qreal*>(_v)); break;
default: break;
}
} else if (_c == QMetaObject::ResetProperty) {
}
#endif // QT_NO_PROPERTIES
}
QT_INIT_METAOBJECT const QMetaObject Cellulo::CelluloZoneAngleIntervalBorder::staticMetaObject = {
{ &CelluloZoneAngleInterval::staticMetaObject, qt_meta_stringdata_Cellulo__CelluloZoneAngleIntervalBorder.data,
qt_meta_data_Cellulo__CelluloZoneAngleIntervalBorder, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *Cellulo::CelluloZoneAngleIntervalBorder::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *Cellulo::CelluloZoneAngleIntervalBorder::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_Cellulo__CelluloZoneAngleIntervalBorder.stringdata0))
return static_cast<void*>(this);
return CelluloZoneAngleInterval::qt_metacast(_clname);
}
int Cellulo::CelluloZoneAngleIntervalBorder::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = CelluloZoneAngleInterval::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 2)
qt_static_metacall(this, _c, _id, _a);
_id -= 2;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 2)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 2;
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty
|| _c == QMetaObject::ResetProperty || _c == QMetaObject::RegisterPropertyMetaType) {
qt_static_metacall(this, _c, _id, _a);
_id -= 1;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 1;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 1;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 1;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 1;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 1;
}
#endif // QT_NO_PROPERTIES
return _id;
}
// SIGNAL 0
void Cellulo::CelluloZoneAngleIntervalBorder::borderThicknessChanged()
{
QMetaObject::activate(this, &staticMetaObject, 0, nullptr);
}
struct qt_meta_stringdata_Cellulo__CelluloZoneAngleIntervalDistance_t {
QByteArrayData data[6];
char stringdata0[78];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_Cellulo__CelluloZoneAngleIntervalDistance_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_Cellulo__CelluloZoneAngleIntervalDistance_t qt_meta_stringdata_Cellulo__CelluloZoneAngleIntervalDistance = {
{
QT_MOC_LITERAL(0, 0, 41), // "Cellulo::CelluloZoneAngleInte..."
QT_MOC_LITERAL(1, 42, 9), // "calculate"
QT_MOC_LITERAL(2, 52, 0), // ""
QT_MOC_LITERAL(3, 53, 6), // "xRobot"
QT_MOC_LITERAL(4, 60, 6), // "yRobot"
QT_MOC_LITERAL(5, 67, 10) // "thetaRobot"
},
"Cellulo::CelluloZoneAngleIntervalDistance\0"
"calculate\0\0xRobot\0yRobot\0thetaRobot"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_Cellulo__CelluloZoneAngleIntervalDistance[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
1, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// methods: name, argc, parameters, tag, flags
1, 3, 19, 2, 0x02 /* Public */,
// methods: parameters
QMetaType::Float, QMetaType::Float, QMetaType::Float, QMetaType::Float, 3, 4, 5,
0 // eod
};
void Cellulo::CelluloZoneAngleIntervalDistance::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
CelluloZoneAngleIntervalDistance *_t = static_cast<CelluloZoneAngleIntervalDistance *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: { float _r = _t->calculate((*reinterpret_cast< float(*)>(_a[1])),(*reinterpret_cast< float(*)>(_a[2])),(*reinterpret_cast< float(*)>(_a[3])));
if (_a[0]) *reinterpret_cast< float*>(_a[0]) = std::move(_r); } break;
default: ;
}
}
}
QT_INIT_METAOBJECT const QMetaObject Cellulo::CelluloZoneAngleIntervalDistance::staticMetaObject = {
{ &CelluloZoneAngleInterval::staticMetaObject, qt_meta_stringdata_Cellulo__CelluloZoneAngleIntervalDistance.data,
qt_meta_data_Cellulo__CelluloZoneAngleIntervalDistance, qt_static_metacall, nullptr, nullptr}
};
const QMetaObject *Cellulo::CelluloZoneAngleIntervalDistance::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *Cellulo::CelluloZoneAngleIntervalDistance::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_Cellulo__CelluloZoneAngleIntervalDistance.stringdata0))
return static_cast<void*>(this);
return CelluloZoneAngleInterval::qt_metacast(_clname);
}
int Cellulo::CelluloZoneAngleIntervalDistance::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = CelluloZoneAngleInterval::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 1)
qt_static_metacall(this, _c, _id, _a);
_id -= 1;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 1)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 1;
}
return _id;
}
QT_WARNING_POP
QT_END_MOC_NAMESPACE
|
eaa5478503c68f416cd33bad41f35cf7f204256c
|
604a45107ff36a0362ac9e6a6051b306ef8f186c
|
/SparkCode/DisplayLine.h
|
309a7baaccd5ddc178e0fed801b37783d4bff91d
|
[
"MIT"
] |
permissive
|
pierreca/SparkLedMatrix
|
831997ae0350ed62b950e47bde08780226c67857
|
a7f3628820f29a76780f56b76b30029028ff08d7
|
refs/heads/master
| 2021-01-10T21:25:04.396885
| 2015-06-08T02:56:28
| 2015-06-08T02:56:28
| 30,475,629
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 622
|
h
|
DisplayLine.h
|
#include "LedControl.h"
#define SPARK_API_MSG_SIZE 63
class DisplayLine {
private:
LedControl *ledDisplay;
ColumnsTable *colsTable;
char message[SPARK_API_MSG_SIZE];
int messageLength;
int displayCount;
int scrollIndex;
int scrollDelay;
public:
DisplayLine(int dataPin, int clkPin, int csPin, int numDevices);
~DisplayLine();
void activate(int intensity);
void deactivate();
void setText(char *text, int length);
void refreshDisplay();
void clear();
void setScrollDelay(int scrollDelay);
};
|
77495876b6c509cb1c9c3581b7c90bb203606eaa
|
dde7dc50b7231f03d215091ebf41d3f242b22024
|
/INF1010_TP/TP2/TP2_1905682_1582075/TP2/Rayon.cpp
|
09404ae10fc0ee2337c685f586f6a3ba9a3242f9
|
[] |
no_license
|
jmlasnier/INF1010
|
2f7f4f29fb90d74faf27867451f5fdd514b30499
|
7687a931132df96a7d59e9a850f765fd64755b52
|
refs/heads/master
| 2021-05-02T18:39:41.024516
| 2020-09-19T22:18:53
| 2020-09-19T22:18:53
| 120,663,957
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,426
|
cpp
|
Rayon.cpp
|
/********************************************
* Titre: Travail pratique #2 - Rayon.cpp
* Date: 25 janvier 2018
* Auteur: Timoth�e CHAUVIN
*******************************************/
#include "Rayon.h"
Rayon::Rayon(const string& cat) :
categorie_{ cat }
{
}
Rayon::~Rayon()
{
}
// Methodes d'acces
string Rayon::obtenirCategorie() const
{
return categorie_;
}
vector<Produit*> Rayon::obtenirTousProduits() const
{
return tousProduits_;
}
int Rayon::obtenirCapaciteProduits() const
{
return tousProduits_.capacity();
}
int Rayon::obtenirNombreProduits() const
{
return tousProduits_.size();
}
// Methodes de modification
void Rayon::modifierCategorie(const string& cat)
{
categorie_ = cat;
}
//ajouterProduit avec la surcharge d'operateur += Pour pouvoir ajouter un produit donné en parametre au rayon
Rayon& Rayon::operator+=(Produit& produit)
{
tousProduits_.push_back(&produit);
return *this;
}
//Methode de modification compterDoublons qui compte le nombre présent dans le rayon donné en parametre
int Rayon::compterDoublons(const Produit& produit)
{
int doublons = 0;
for (int i = 0; i < obtenirNombreProduits(); i++)
{
if (*tousProduits_[i] == produit)
doublons++;
}
return doublons;
}
//Surcharge de l'operateur <<
ostream& operator<<(ostream& os, Rayon& rayon)
{
for (int i = 0; i < rayon.obtenirNombreProduits(); i++)
{
os << *rayon.obtenirTousProduits()[i];
}
return os;
}
|
8d355094a192994d678d4318b5d915c8b4b6ab8f
|
0c1476444ca5c5a2f4f08df879c11ad57a74f304
|
/zerojudge/d066.cpp
|
13978f0176dee10e8fc0998cf85646cdba44e8d3
|
[] |
no_license
|
SanhornC/Code
|
f44c932c59ed3d9efe9325f8c5f7acdd47bc36e6
|
51c86df86c67cceabdfdd2c1e17b96c5cb7f175a
|
refs/heads/master
| 2023-01-24T03:06:58.846966
| 2020-11-28T12:37:33
| 2020-11-28T12:37:33
| 289,411,306
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 377
|
cpp
|
d066.cpp
|
//
// main.cpp
// d066.cpp
//
// Created by Sanhorn on 2020/9/1.
// Copyright © 2020 Sanhorn. All rights reserved.
//
#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
int h, m; cin >> h >> m;
int cnt = 60 * h + m;
if(cnt <450 || cnt >=1020)
cout << "Off School";
else
cout << "At School";
return 0;
}
|
e7338457e7ec09d42e2deb37e4ef1156db225bb5
|
ad81708312010e1b90fa2f5e1d638531ae179b19
|
/A3/A3.cpp
|
02999f206c556b9dfa1d0b7afd101eb5e29529a4
|
[] |
no_license
|
JacobBush/cs488
|
474350c93c6ff462dfed6dd350f2bbe3b4241973
|
df2991edaa73b66c13898783293c1fa80cb5c577
|
refs/heads/master
| 2022-03-06T22:21:55.203097
| 2018-07-24T01:48:22
| 2018-07-24T01:48:22
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 31,259
|
cpp
|
A3.cpp
|
#include "A3.hpp"
#include "scene_lua.hpp"
using namespace std;
#include "cs488-framework/GlErrorCheck.hpp"
#include "cs488-framework/MathUtils.hpp"
#include "GeometryNode.hpp"
#include "JointNode.hpp"
#include <imgui/imgui.h>
#include <stack>
#include <list>
#include <glm/gtc/type_ptr.hpp>
#include <glm/gtx/io.hpp>
#include <glm/gtx/transform.hpp>
#include <glm/gtc/matrix_transform.hpp>
using namespace glm;
static bool show_gui = true;
const size_t CIRCLE_PTS = 48;
const int POSITION_MODE = 0;
const int JOINTS_MODE = 1;
//----------------------------------------------------------------------------------------
// Constructor
A3::A3(const std::string & luaSceneFile)
: m_luaSceneFile(luaSceneFile),
m_positionAttribLocation(0),
m_normalAttribLocation(0),
m_vao_meshData(0),
m_vbo_vertexPositions(0),
m_vbo_vertexNormals(0),
m_vao_arcCircle(0),
m_vbo_arcCircle(0),
draw_circle(false),
use_z_buffer(true),
use_frontface_culling(false),
use_backface_culling(false),
interaction_mode(0),
dragging(0),
picking(false),
head_rotation(0),
head(NULL)
{
prev_mouse_posn = vec2(0,0);
mouse_movement = vec2(0,0);
resetAll();
}
//----------------------------------------------------------------------------------------
// Destructor
A3::~A3()
{
}
//----------------------------------------------------------------------------------------
/*
* Called once, at program start.
*/
void A3::init()
{
// Set the background colour.
glClearColor(0.35, 0.35, 0.35, 1.0);
createShaderProgram();
glGenVertexArrays(1, &m_vao_arcCircle);
glGenVertexArrays(1, &m_vao_meshData);
enableVertexShaderInputSlots();
processLuaSceneFile(m_luaSceneFile);
// Load and decode all .obj files at once here. You may add additional .obj files to
// this list in order to support rendering additional mesh types. All vertex
// positions, and normals will be extracted and stored within the MeshConsolidator
// class.
unique_ptr<MeshConsolidator> meshConsolidator (new MeshConsolidator{
getAssetFilePath("cube.obj"),
getAssetFilePath("sphere.obj"),
getAssetFilePath("suzanne.obj")
});
// Acquire the BatchInfoMap from the MeshConsolidator.
meshConsolidator->getBatchInfoMap(m_batchInfoMap);
// Take all vertex data within the MeshConsolidator and upload it to VBOs on the GPU.
uploadVertexDataToVbos(*meshConsolidator);
mapVboDataToVertexShaderInputLocations();
initPerspectiveMatrix();
initViewMatrix();
initLightSources();
clearUndoStack();
clearRedoStack();
// Exiting the current scope calls delete automatically on meshConsolidator freeing
// all vertex data resources. This is fine since we already copied this data to
// VBOs on the GPU. We have no use for storing vertex data on the CPU side beyond
// this point.
}
//----------------------------------------------------------------------------------------
void A3::processLuaSceneFile(const std::string & filename) {
// This version of the code treats the Lua file as an Asset,
// so that you'd launch the program with just the filename
// of a puppet in the Assets/ directory.
// std::string assetFilePath = getAssetFilePath(filename.c_str());
// m_rootNode = std::shared_ptr<SceneNode>(import_lua(assetFilePath));
// This version of the code treats the main program argument
// as a straightforward pathname.
m_rootNode = std::shared_ptr<SceneNode>(import_lua(filename));
if (!m_rootNode) {
std::cerr << "Could not open " << filename << std::endl;
}
}
//----------------------------------------------------------------------------------------
void A3::createShaderProgram()
{
m_shader.generateProgramObject();
m_shader.attachVertexShader( getAssetFilePath("VertexShader.vs").c_str() );
m_shader.attachFragmentShader( getAssetFilePath("FragmentShader.fs").c_str() );
m_shader.link();
m_shader_arcCircle.generateProgramObject();
m_shader_arcCircle.attachVertexShader( getAssetFilePath("arc_VertexShader.vs").c_str() );
m_shader_arcCircle.attachFragmentShader( getAssetFilePath("arc_FragmentShader.fs").c_str() );
m_shader_arcCircle.link();
}
//----------------------------------------------------------------------------------------
void A3::enableVertexShaderInputSlots()
{
//-- Enable input slots for m_vao_meshData:
{
glBindVertexArray(m_vao_meshData);
// Enable the vertex shader attribute location for "position" when rendering.
m_positionAttribLocation = m_shader.getAttribLocation("position");
glEnableVertexAttribArray(m_positionAttribLocation);
// Enable the vertex shader attribute location for "normal" when rendering.
m_normalAttribLocation = m_shader.getAttribLocation("normal");
glEnableVertexAttribArray(m_normalAttribLocation);
CHECK_GL_ERRORS;
}
//-- Enable input slots for m_vao_arcCircle:
{
glBindVertexArray(m_vao_arcCircle);
// Enable the vertex shader attribute location for "position" when rendering.
m_arc_positionAttribLocation = m_shader_arcCircle.getAttribLocation("position");
glEnableVertexAttribArray(m_arc_positionAttribLocation);
CHECK_GL_ERRORS;
}
// Restore defaults
glBindVertexArray(0);
}
//----------------------------------------------------------------------------------------
void A3::uploadVertexDataToVbos (
const MeshConsolidator & meshConsolidator
) {
// Generate VBO to store all vertex position data
{
glGenBuffers(1, &m_vbo_vertexPositions);
glBindBuffer(GL_ARRAY_BUFFER, m_vbo_vertexPositions);
glBufferData(GL_ARRAY_BUFFER, meshConsolidator.getNumVertexPositionBytes(),
meshConsolidator.getVertexPositionDataPtr(), GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
CHECK_GL_ERRORS;
}
// Generate VBO to store all vertex normal data
{
glGenBuffers(1, &m_vbo_vertexNormals);
glBindBuffer(GL_ARRAY_BUFFER, m_vbo_vertexNormals);
glBufferData(GL_ARRAY_BUFFER, meshConsolidator.getNumVertexNormalBytes(),
meshConsolidator.getVertexNormalDataPtr(), GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
CHECK_GL_ERRORS;
}
// Generate VBO to store the trackball circle.
{
glGenBuffers( 1, &m_vbo_arcCircle );
glBindBuffer( GL_ARRAY_BUFFER, m_vbo_arcCircle );
float *pts = new float[ 2 * CIRCLE_PTS ];
for( size_t idx = 0; idx < CIRCLE_PTS; ++idx ) {
float ang = 2.0 * M_PI * float(idx) / CIRCLE_PTS;
pts[2*idx] = cos( ang );
pts[2*idx+1] = sin( ang );
}
glBufferData(GL_ARRAY_BUFFER, 2*CIRCLE_PTS*sizeof(float), pts, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
CHECK_GL_ERRORS;
}
}
//----------------------------------------------------------------------------------------
void A3::mapVboDataToVertexShaderInputLocations()
{
// Bind VAO in order to record the data mapping.
glBindVertexArray(m_vao_meshData);
// Tell GL how to map data from the vertex buffer "m_vbo_vertexPositions" into the
// "position" vertex attribute location for any bound vertex shader program.
glBindBuffer(GL_ARRAY_BUFFER, m_vbo_vertexPositions);
glVertexAttribPointer(m_positionAttribLocation, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
// Tell GL how to map data from the vertex buffer "m_vbo_vertexNormals" into the
// "normal" vertex attribute location for any bound vertex shader program.
glBindBuffer(GL_ARRAY_BUFFER, m_vbo_vertexNormals);
glVertexAttribPointer(m_normalAttribLocation, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
//-- Unbind target, and restore default values:
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
CHECK_GL_ERRORS;
// Bind VAO in order to record the data mapping.
glBindVertexArray(m_vao_arcCircle);
// Tell GL how to map data from the vertex buffer "m_vbo_arcCircle" into the
// "position" vertex attribute location for any bound vertex shader program.
glBindBuffer(GL_ARRAY_BUFFER, m_vbo_arcCircle);
glVertexAttribPointer(m_arc_positionAttribLocation, 2, GL_FLOAT, GL_FALSE, 0, nullptr);
//-- Unbind target, and restore default values:
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
CHECK_GL_ERRORS;
}
//----------------------------------------------------------------------------------------
void A3::initPerspectiveMatrix()
{
float aspect = ((float)m_windowWidth) / m_windowHeight;
m_perpsective = glm::perspective(degreesToRadians(60.0f), aspect, 0.1f, 100.0f);
}
//----------------------------------------------------------------------------------------
void A3::initViewMatrix() {
m_view = glm::lookAt(vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, -1.0f),
vec3(0.0f, 1.0f, 0.0f));
}
//----------------------------------------------------------------------------------------
void A3::initLightSources() {
// World-space position
m_light.position = vec3(-2.0f, 5.0f, 0.5f);
m_light.rgbIntensity = vec3(0.8f); // White light
}
//----------------------------------------------------------------------------------------
void A3::uploadCommonSceneUniforms() {
m_shader.enable();
{
//-- Set Perpsective matrix uniform for the scene:
GLint location = m_shader.getUniformLocation("Perspective");
glUniformMatrix4fv(location, 1, GL_FALSE, value_ptr(m_perpsective));
CHECK_GL_ERRORS;
location = m_shader.getUniformLocation("picking");
glUniform1i( location, picking ? 1 : 0 );
//-- Set LightSource uniform for the scene:
if (!picking)
{
location = m_shader.getUniformLocation("light.position");
glUniform3fv(location, 1, value_ptr(m_light.position));
location = m_shader.getUniformLocation("light.rgbIntensity");
glUniform3fv(location, 1, value_ptr(m_light.rgbIntensity));
CHECK_GL_ERRORS;
}
//-- Set background light ambient intensity
if (!picking)
{
location = m_shader.getUniformLocation("ambientIntensity");
vec3 ambientIntensity(0.05f);
glUniform3fv(location, 1, value_ptr(ambientIntensity));
CHECK_GL_ERRORS;
}
}
m_shader.disable();
}
//----------------------------------------------------------------------------------------
/*
* Called once per frame, before guiLogic().
*/
void A3::appLogic()
{
// Place per frame, application logic here ...
uploadCommonSceneUniforms();
}
//----------------------------------------------------------------------------------------
/*
* Called once per frame, after appLogic(), but before the draw() method.
*/
void A3::guiLogic()
{
if( !show_gui ) {
return;
}
static bool firstRun(true);
if (firstRun) {
ImGui::SetNextWindowPos(ImVec2(50, 50));
firstRun = false;
}
static bool showDebugWindow(true);
ImGuiWindowFlags windowFlags(ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_MenuBar);
float opacity(0.5f);
ImGui::Begin("Properties", &showDebugWindow, ImVec2(100,100), opacity,
windowFlags);
if (ImGui::BeginMenuBar())
{
if (ImGui::BeginMenu("Application"))
{
if( ImGui::MenuItem( "Reset Position", "I" ) ) {
resetPosition();
}
if( ImGui::MenuItem( "Reset Orientation", "O" ) ) {
resetOrientation();
}
if( ImGui::MenuItem( "Reset Joints", "N" ) ) {
resetJoints();
}
if( ImGui::MenuItem( "Reset All", "A" ) ) {
resetAll();
}
if( ImGui::MenuItem( "Quit Application", "Q" ) ) {
glfwSetWindowShouldClose(m_window, GL_TRUE);
}
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Edit"))
{
if (ImGui::MenuItem("Undo", "U")) {
undo();
}
if (ImGui::MenuItem("Redo", "R")) {
redo();
}
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Options"))
{
if (ImGui::MenuItem("Circle", "C", &draw_circle)) {}
if (ImGui::MenuItem("Z-buffer", "Z", &use_z_buffer)) {}
if (ImGui::MenuItem("Backface culling", "B", &use_backface_culling)) {}
if (ImGui::MenuItem("Frontface culling", "F", &use_frontface_culling)) {}
ImGui::EndMenu();
}
ImGui::EndMenuBar();
}
ImGui::RadioButton( "Position / Orientation", &interaction_mode, POSITION_MODE);
ImGui::RadioButton( "Joints", &interaction_mode, JOINTS_MODE);
ImGui::Text( "Framerate: %.1f FPS", ImGui::GetIO().Framerate );
ImGui::End();
}
//----------------------------------------------------------------------------------------
// Update mesh specific shader uniforms:
static void updateShaderUniforms(
const ShaderProgram & shader,
const GeometryNode & node,
const glm::mat4 & viewMatrix,
const bool & picking,
const bool & picked
) {
static Material picked_material;
picked_material.kd = vec3(0.0f, 1.0f, 1.0f);
picked_material.ks = vec3(0.1f, 0.1f, 0.1f);
picked_material.shininess = 10.0f;
shader.enable();
{
//-- Set ModelView matrix:
GLint location = shader.getUniformLocation("ModelView");
mat4 modelView = viewMatrix * node.trans;
glUniformMatrix4fv(location, 1, GL_FALSE, value_ptr(modelView));
CHECK_GL_ERRORS;
//-- Set Material values:
if (picking) {
float r = float(node.m_nodeId&0xff) / 255.0f;
float g = float((node.m_nodeId>>8)&0xff) / 255.0f;
float b = float((node.m_nodeId>>16)&0xff) / 255.0f;
//cout << "drawing r: " << r << ", g: " << g << ", b: " << b;
//cout << "for node: " << node.m_name << ", ID: " << node.m_nodeId << endl;
location = shader.getUniformLocation("material.kd");
glUniform3f( location, r, g, b );
CHECK_GL_ERRORS;
} else {
//-- Set NormMatrix:
location = shader.getUniformLocation("NormalMatrix");
mat3 normalMatrix = glm::transpose(glm::inverse(mat3(modelView)));
glUniformMatrix3fv(location, 1, GL_FALSE, value_ptr(normalMatrix));
CHECK_GL_ERRORS;
location = shader.getUniformLocation("material.kd");
vec3 kd = picked ? picked_material.kd : node.material.kd;
glUniform3fv(location, 1, value_ptr(kd));
CHECK_GL_ERRORS;
location = shader.getUniformLocation("material.ks");
vec3 ks = picked ? picked_material.ks : node.material.ks;
glUniform3fv(location, 1, value_ptr(ks));
CHECK_GL_ERRORS;
location = shader.getUniformLocation("material.shininess");
float shininess = picked ? picked_material.shininess : node.material.shininess;
glUniform1f(location, shininess);
CHECK_GL_ERRORS;
}
}
shader.disable();
}
//----------------------------------------------------------------------------------------
/*
* Called once per frame, after guiLogic().
*/
void A3::draw() {
if (use_z_buffer) glEnable( GL_DEPTH_TEST );
if (use_backface_culling || use_frontface_culling) glEnable( GL_CULL_FACE );
if (use_backface_culling && use_frontface_culling) glCullFace(GL_FRONT_AND_BACK);
if (use_backface_culling && !use_frontface_culling) glCullFace(GL_BACK);
if (!use_backface_culling && use_frontface_culling) glCullFace(GL_FRONT);
dealWithManipulation();
renderSceneGraph(*m_rootNode);
if (draw_circle) {
renderArcCircle();
}
glDisable( GL_DEPTH_TEST );
glDisable( GL_CULL_FACE );
}
//
void A3::renderChildren(list<SceneNode*> children) {
for (const SceneNode * node : children) {
//cout << "parent of " << node->m_name << " is " << node->parent->m_name << endl;
if (node->m_nodeType == NodeType::GeometryNode)
renderGeometryNode((GeometryNode *) node);
else if (node->m_nodeType == NodeType::JointNode)
renderJointNode((JointNode *) node);
}
}
//
void A3::renderJointNode(JointNode * node) {
mat4 oldNodeTransform = node->get_transform();
// Instead of overriding the get_transofmr method in jointNode,
// I'm just going to hardcode the joind behavior here
// Since we've already cached the transform, this will be idempotent
mat4 rx = rotate(float(node->current_jointx), vec3(1,0,0));
mat4 ry = rotate(float(node->current_jointy), vec3(0,1,0));
node->set_transform(node->parent->get_transform() * node->get_transform() * rx * ry);
renderChildren(node->children);
node->set_transform(oldNodeTransform);
}
//
//
void A3::renderGeometryNode(GeometryNode * node) {
mat4 oldNodeTransform = node->get_transform();
node->set_transform(node->parent->get_transform() * oldNodeTransform);
// Hardcoding head == "head"
if (node->m_name == "head") {
node->set_transform(node->get_transform() * rotate(head_rotation, vec3(0,1,0)));
}
renderChildren(node->children);
updateShaderUniforms(m_shader, *node, m_view, picking, node->parentJointIsSelected());
// Get the BatchInfo corresponding to the GeometryNode's unique MeshId.
BatchInfo batchInfo = m_batchInfoMap[node->meshId];
//-- Now render the mesh:
m_shader.enable();
glDrawArrays(GL_TRIANGLES, batchInfo.startIndex, batchInfo.numIndices);
m_shader.disable();
node->set_transform(oldNodeTransform);
}
//----------------------------------------------------------------------------------------
void A3::renderSceneGraph(SceneNode & root) {
// Bind the VAO once here, and reuse for all GeometryNode rendering below.
glBindVertexArray(m_vao_meshData);
// This is emphatically *not* how you should be drawing the scene graph in
// your final implementation. This is a non-hierarchical demonstration
// in which we assume that there is a list of GeometryNodes living directly
// underneath the root node, and that we can draw them in a loop. It's
// just enough to demonstrate how to get geometry and materials out of
// a GeometryNode and onto the screen.
// You'll want to turn this into recursive code that walks over the tree.
// You can do that by putting a method in SceneNode, overridden in its
// subclasses, that renders the subtree rooted at every node. Or you
// could put a set of mutually recursive functions in this class, which
// walk down the tree from nodes of different types.
mat4 root_transform = root.get_transform();
root.set_transform(puppet_translation * root_transform * puppet_rotation);
renderChildren(root.children);
root.set_transform(root_transform);
glBindVertexArray(0);
CHECK_GL_ERRORS;
}
//----------------------------------------------------------------------------------------
// Draw the trackball circle.
void A3::renderArcCircle() {
glBindVertexArray(m_vao_arcCircle);
m_shader_arcCircle.enable();
GLint m_location = m_shader_arcCircle.getUniformLocation( "M" );
float aspect = float(m_framebufferWidth)/float(m_framebufferHeight);
glm::mat4 M;
if( aspect > 1.0 ) {
M = glm::scale( glm::mat4(), glm::vec3( 0.5/aspect, 0.5, 1.0 ) );
} else {
M = glm::scale( glm::mat4(), glm::vec3( 0.5, 0.5*aspect, 1.0 ) );
}
glUniformMatrix4fv( m_location, 1, GL_FALSE, value_ptr( M ) );
glDrawArrays( GL_LINE_LOOP, 0, CIRCLE_PTS );
m_shader_arcCircle.disable();
glBindVertexArray(0);
CHECK_GL_ERRORS;
}
void A3::dealWithPicking() {
if (interaction_mode != JOINTS_MODE) return;
// Just going to copy code for pulling xpos and ypos instead
// of using my already defined prev_mouse_posn
// This way I will know that picking is working
double xpos, ypos;
glfwGetCursorPos( m_window, &xpos, &ypos );
picking = true;
// most of this will be pulled from PickingExample.cpp
uploadCommonSceneUniforms();
glClearColor(1.0, 1.0, 1.0, 1.0 );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glClearColor(0.35, 0.35, 0.35, 1.0);
draw();
CHECK_GL_ERRORS;
// Ugly -- FB coordinates might be different than Window coordinates
// (e.g., on a retina display). Must compensate.
xpos *= double(m_framebufferWidth) / double(m_windowWidth);
// WTF, don't know why I have to measure y relative to the bottom of
// the window in this case.
ypos = m_windowHeight - ypos;
ypos *= double(m_framebufferHeight) / double(m_windowHeight);
//cout << "picking: (" << xpos << ", " << ypos << ")" << endl;
GLubyte buffer[ 4 ] = { 0, 0, 0, 0 };
// A bit ugly -- don't want to swap the just-drawn false colours
// to the screen, so read from the back buffer.
glReadBuffer( GL_BACK );
// Actually read the pixel at the mouse location.
glReadPixels( int(xpos), int(ypos), 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, buffer );
CHECK_GL_ERRORS;
//cout << "buffer: " << int(buffer[0]) << ", " << int(buffer[1]) << ", " <<int(buffer[2]) << ", " <<int(buffer[3]) <<endl;
// Reassemble the object ID.
unsigned int node_id = buffer[0] + (buffer[1] << 8) + (buffer[2] << 16);
selectNode(node_id);
picking = false;
CHECK_GL_ERRORS;
}
SceneNode * recursiveSearchForNode(unsigned int node_id, SceneNode *current_node) {
//cout << "Current node ID being checked: " << current_node->m_nodeId << ", with name: " << current_node->m_name << endl;
if (current_node->m_nodeId == node_id) {
return current_node;
}
for (SceneNode * node : current_node->children) {
current_node = recursiveSearchForNode(node_id, node);
if (current_node != NULL) {
return current_node;
}
}
return NULL;
}
void A3::selectNode(unsigned int node_id) {
//cout << "picking node : " << node_id << endl;
SceneNode *node = recursiveSearchForNode(node_id, m_rootNode.get());
if (node == NULL) return;
//cout << "Picked node " << node->m_name << endl;
// If parent is a joint, we want to "pick" that joint
if (node->parent->m_nodeType == NodeType::JointNode) {
JointNode *parent_joint_node = (JointNode *)(node->parent);
parent_joint_node->picked = !parent_joint_node->picked;
}
}
void recursiveUpdateJointsBy(SceneNode *current_node, float amount) {
if (current_node->m_nodeType == NodeType::JointNode) {
((JointNode * )current_node)->updateJointBy(amount);
}
for (SceneNode * node : current_node->children) {
recursiveUpdateJointsBy(node, amount);
}
}
//
void A3::increaseAllSelectedJointsBy(float amount) {
recursiveUpdateJointsBy(m_rootNode.get(), amount);
}
// Recursively search from node for head
SceneNode *A3::findHead(SceneNode *node) {
if (head != NULL) {
return head;
}
if (node->m_name == "head") {
return node;
}
for (SceneNode * child : node->children) {
SceneNode *potential_head = findHead(child);
if (potential_head != NULL) {
head = potential_head;
return head;
}
}
head = NULL;
return head;
}
//
void A3::dealWithManipulation() {
const float ROTATION_SPEED = 0.01f;
const float TRANSLATION_SPEED = 0.0015f;
const float TRANSLATION_DEPTH_SPEED = 0.0015f;
const float JOINT_ANGLE_SPEED = 0.003f;
const float HEAD_ROTATE_SPEED = 0.003f;
if (interaction_mode == POSITION_MODE) {
if ((dragging >> 0) & 1U) {
// dragging by left
puppet_translation = translate(TRANSLATION_SPEED * vec3(mouse_movement.x, -mouse_movement.y, 0)) * puppet_translation;
}
if ((dragging >> 1) & 1U) {
// dragging by middle
puppet_translation = translate(TRANSLATION_DEPTH_SPEED * vec3(0,0,mouse_movement.y)) * puppet_translation;
}
if ((dragging >> 2) & 1U) {
// dragging by right
puppet_rotation = rotate(ROTATION_SPEED * mouse_movement.x, vec3(0,1,0)) * puppet_rotation;
puppet_rotation = rotate(ROTATION_SPEED * mouse_movement.y, vec3(1,0,0)) * puppet_rotation;
}
mouse_movement = vec2(0.0f,0.0f);
} else if (interaction_mode == JOINTS_MODE) {
if ((dragging >> 0) & 1U) {
// dragging by left
// Do nothing -> handled in picking code
}
if ((dragging >> 1) & 1U) {
// dragging by middle
// Increase joint angles
increaseAllSelectedJointsBy(JOINT_ANGLE_SPEED * mouse_movement.y);
}
if ((dragging >> 2) & 1U) {
// dragging by right
if (((GeometryNode *)findHead(m_rootNode.get()))->parentJointIsSelected()) {
head_rotation += HEAD_ROTATE_SPEED * mouse_movement.x;
if (head_rotation > PI / 2.0f) {
head_rotation = PI / 2.0f;
}
if (head_rotation < -PI / 2.0f) {
head_rotation = -PI / 2.0f;
}
}
}
mouse_movement = vec2(0.0f,0.0f);
}
}
//
void A3::resetPosition() {
puppet_translation = mat4();
}
//
void A3::resetOrientation() {
puppet_rotation = mat4();
}
//
void A3::resetJoints() {
while (!undoStack.empty()) {
undo();
}
clearUndoStack();
clearRedoStack();
}
//
void A3::resetAll() {
resetPosition();
resetOrientation();
resetJoints();
}
//
void A3::saveNeededStates(std::list<A3::JointNodeState> joint_state_list, bool stack_is_undo) {
bool need_to_save_head_rotations = false;
bool need_to_save_joint_rotations = false;
for (A3::JointNodeState jns : joint_state_list) {
if (jns.isHead) {
need_to_save_head_rotations = true;
} else {
need_to_save_joint_rotations = true;
}
}
if (need_to_save_head_rotations) {
saveHeadRotatationToStack(!stack_is_undo);
}
if (need_to_save_joint_rotations){
saveJointRotationsToStack(!stack_is_undo);
}
}
//
void A3::setJointStates(std::list<A3::JointNodeState> joint_state_list) {
for (A3::JointNodeState jns : joint_state_list) {
if (jns.isHead) {
head_rotation = jns.prev_head_rotation;
} else {
jns.joint->current_jointx = jns.x;
jns.joint->current_jointy = jns.y;
}
}
}
//
void A3::undo() {
if (undoStack.empty()) return;
std::list<A3::JointNodeState> joint_state_list = undoStack.top();
undoStack.pop();
saveNeededStates(joint_state_list, true);
setJointStates(joint_state_list);
}
//
void A3::redo() {
if (redoStack.empty()) return;
std::list<A3::JointNodeState> joint_state_list = redoStack.top();
redoStack.pop();
saveNeededStates(joint_state_list, false);
setJointStates(joint_state_list);
}
//
void A3::clearUndoStack() {
undoStack = stack<std::list<A3::JointNodeState>>();
}
//
void A3::clearRedoStack() {
redoStack = stack<std::list<A3::JointNodeState>>();
}
//
void addJointInfoToList (SceneNode * currentRoot, std::list<A3::JointNodeState> *joint_state_list) {
for (SceneNode * child : currentRoot->children) {
addJointInfoToList(child, joint_state_list);
}
if (currentRoot->m_nodeType == NodeType::JointNode) {
JointNode * currentJoint = (JointNode *)currentRoot;
A3::JointNodeState jointState = A3::JointNodeState();
jointState.isHead = false;
jointState.joint = currentJoint;
jointState.x = currentJoint->current_jointx;
jointState.y = currentJoint->current_jointy;
joint_state_list->push_back(jointState);
}
}
//
void A3::saveJointRotationsToStack(bool stack_is_undo) {
std::list<A3::JointNodeState> joint_state_list = std::list<A3::JointNodeState>();
addJointInfoToList(m_rootNode.get(), &joint_state_list);
if (stack_is_undo) {
undoStack.push(joint_state_list);
} else {
redoStack.push(joint_state_list);
}
}
//
void A3::saveHeadRotatationToStack(bool stack_is_undo) {
std::list<A3::JointNodeState> joint_state_list = std::list<A3::JointNodeState>();
A3::JointNodeState jointState = A3::JointNodeState();
jointState.isHead = true;
jointState.prev_head_rotation = head_rotation;
joint_state_list.push_back(jointState);
if (stack_is_undo) {
undoStack.push(joint_state_list);
} else {
redoStack.push(joint_state_list);
}
}
//----------------------------------------------------------------------------------------
/*
* Called once, after program is signaled to terminate.
*/
void A3::cleanup()
{
}
//----------------------------------------------------------------------------------------
/*
* Event handler. Handles cursor entering the window area events.
*/
bool A3::cursorEnterWindowEvent (
int entered
) {
bool eventHandled(false);
// Fill in with event handling code...
return eventHandled;
}
//----------------------------------------------------------------------------------------
/*
* Event handler. Handles mouse cursor movement events.
*/
bool A3::mouseMoveEvent (
double xPos,
double yPos
) {
bool eventHandled(false);
if (!ImGui::IsMouseHoveringAnyWindow()) {
if (dragging) {
mouse_movement.x += xPos - prev_mouse_posn.x;
mouse_movement.y += yPos - prev_mouse_posn.y;
prev_mouse_posn = vec2(xPos, yPos);
eventHandled = true;
}
}
return eventHandled;
}
//----------------------------------------------------------------------------------------
/*
* Event handler. Handles mouse button events.
*/
bool A3::mouseButtonInputEvent (
int button,
int actions,
int mods
) {
bool eventHandled(false);
// dragging is 3 bits right|middle|left
if (!ImGui::IsMouseHoveringAnyWindow()) {
if (button == GLFW_MOUSE_BUTTON_LEFT && actions == GLFW_PRESS) {
prev_mouse_posn = vec2(ImGui::GetMousePos().x, ImGui::GetMousePos().y);
dragging |= 1UL << 0;
dealWithPicking();
eventHandled = true;
}
if (button == GLFW_MOUSE_BUTTON_LEFT && actions == GLFW_RELEASE) {
dragging &= ~(1UL << 0);
eventHandled = true;
}
if (button == GLFW_MOUSE_BUTTON_MIDDLE && actions == GLFW_PRESS) {
prev_mouse_posn = vec2(ImGui::GetMousePos().x, ImGui::GetMousePos().y);
dragging |= 1UL << 1;
if (interaction_mode == JOINTS_MODE) {
saveJointRotationsToStack(true);
clearRedoStack();
}
eventHandled = true;
}
if (button == GLFW_MOUSE_BUTTON_MIDDLE && actions == GLFW_RELEASE) {
dragging &= ~(1UL << 1);
eventHandled = true;
}
if (button == GLFW_MOUSE_BUTTON_RIGHT && actions == GLFW_PRESS) {
prev_mouse_posn = vec2(ImGui::GetMousePos().x, ImGui::GetMousePos().y);
dragging |= 1UL << 2;
if (interaction_mode == JOINTS_MODE &&
((GeometryNode *)findHead(m_rootNode.get()))->parentJointIsSelected()) {
saveHeadRotatationToStack(true);
clearRedoStack();
}
eventHandled = true;
}
if (button == GLFW_MOUSE_BUTTON_RIGHT && actions == GLFW_RELEASE) {
dragging &= ~(1UL << 2);
eventHandled = true;
}
}
return eventHandled;
}
//----------------------------------------------------------------------------------------
/*
* Event handler. Handles mouse scroll wheel events.
*/
bool A3::mouseScrollEvent (
double xOffSet,
double yOffSet
) {
bool eventHandled(false);
// Fill in with event handling code...
return eventHandled;
}
//----------------------------------------------------------------------------------------
/*
* Event handler. Handles window resize events.
*/
bool A3::windowResizeEvent (
int width,
int height
) {
bool eventHandled(false);
initPerspectiveMatrix();
return eventHandled;
}
//----------------------------------------------------------------------------------------
/*
* Event handler. Handles key input events.
*/
bool A3::keyInputEvent (
int key,
int action,
int mods
) {
bool eventHandled(false);
if( action == GLFW_PRESS ) {
if( key == GLFW_KEY_M ) {
show_gui = !show_gui;
eventHandled = true;
} else if ( key == GLFW_KEY_Q ) {
glfwSetWindowShouldClose(m_window, GL_TRUE);
eventHandled = true;
} else if ( key == GLFW_KEY_I ) {
resetPosition();
eventHandled = true;
} else if ( key == GLFW_KEY_O ) {
resetOrientation();
eventHandled = true;
} else if ( key == GLFW_KEY_N ) {
resetJoints();
eventHandled = true;
} else if ( key == GLFW_KEY_A ) {
resetAll();
eventHandled = true;
} else if ( key == GLFW_KEY_U ) {
undo();
eventHandled = true;
} else if ( key == GLFW_KEY_R ) {
redo();
eventHandled = true;
} else if ( key == GLFW_KEY_C ) {
draw_circle = !draw_circle;
eventHandled = true;
} else if ( key == GLFW_KEY_Z ) {
use_z_buffer = !use_z_buffer;
eventHandled = true;
} else if ( key == GLFW_KEY_B ) {
use_backface_culling = !use_backface_culling;
eventHandled = true;
} else if ( key == GLFW_KEY_F ) {
use_frontface_culling = !use_frontface_culling;
eventHandled = true;
} else if ( key == GLFW_KEY_P ) {
interaction_mode = POSITION_MODE;
eventHandled = true;
} else if ( key == GLFW_KEY_J ) {
interaction_mode = JOINTS_MODE;
eventHandled = true;
}
}
// Fill in with event handling code...
return eventHandled;
}
|
b3cbeba83707e4e5a54c76506a08808deee4ff9a
|
74a69eeb6d035659e10046d4e9255f7759874b25
|
/kernel/include/os/Syscall.hpp
|
f893ee31a680d6c65f9f25ca5ca3f3bb2e867ae7
|
[] |
no_license
|
pleasewhy/startos
|
af5a61e0e56ef7c9f7f3c9c2f5ea6eac78fcc470
|
4876b2dc51c369c3df449ae060afaa17962d8a90
|
refs/heads/master
| 2023-06-20T12:10:03.293755
| 2021-07-19T13:13:53
| 2021-07-19T13:13:53
| 370,990,136
| 12
| 0
| null | 2021-06-01T13:51:34
| 2021-05-26T10:13:33
|
C++
|
UTF-8
|
C++
| false
| false
| 421
|
hpp
|
Syscall.hpp
|
#ifndef SYS_CALL_HPP
#define SYS_CALL_HPP
#include "types.hpp"
#include "StartOS.hpp"
void syscall(void);
void syscall_init();
uint64_t argraw(int n);
int argint(int n, int *addr);
int argfd(int n, int *fdp, struct file **fp);
int fetchaddr(uint64_t addr, uint64_t *ip);
int argaddr(int n, uint64_t *ip);
int fetchstr(uint64_t addr, char *buf, int max);
int argstr(int n, char *buf, int max);
void syscall(void);
#endif
|
ca3133efc32c03ed20380931fd33cf5ae69919bd
|
879681c994f1ca9c8d2c905a4e5064997ad25a27
|
/root-2.3.0/run/tutorials/multiphase/twoPhaseEulerFoam/RAS/fluidisedBed/0.87/Theta.particles
|
a73423ab18bd3a59d357b89739f09443cf6bb1e2
|
[] |
no_license
|
MizuhaWatanabe/OpenFOAM-2.3.0-with-Ubuntu
|
3828272d989d45fb020e83f8426b849e75560c62
|
daeb870be81275e8a81f5cbac4ca1906a9bc69c0
|
refs/heads/master
| 2020-05-17T16:36:41.848261
| 2015-04-18T09:29:48
| 2015-04-18T09:29:48
| 34,159,882
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 68,875
|
particles
|
Theta.particles
|
/*--------------------------------*- 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 "0.87";
object Theta.particles;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField nonuniform List<scalar>
6000
(
0.000251134
8.94814e-05
0.000101139
9.99397e-05
6.5319e-05
6.93642e-05
0.000143749
0.000281556
0.000528378
0.00113926
0.00114412
0.0008561
0.000712478
0.000393705
0.000161046
0.000182784
0.00022104
0.000135865
0.000203686
0.000172001
0.000122491
0.000114049
0.000148706
0.000184362
0.000305955
0.0015393
0.00249394
0.00272178
0.00123419
0.00059152
2.85867e-05
5.39572e-06
4.09757e-06
2.82409e-06
3.6428e-06
5.84272e-06
1.05752e-05
2.48253e-05
5.96559e-05
8.09732e-05
7.09113e-05
5.22224e-05
3.29543e-05
1.10117e-05
1.15389e-06
3.75142e-06
6.35218e-06
1.23126e-05
2.14425e-05
2.81187e-05
1.27361e-05
6.75247e-06
5.75849e-06
1.86448e-05
2.52161e-05
3.6335e-05
9.0693e-05
8.07383e-05
1.38089e-05
4.25004e-05
1.4005e-05
6.07495e-05
4.84523e-05
0.000100966
0.000257597
0.000451591
0.000479481
0.000500701
0.000452543
0.000359148
0.000392593
0.000451131
0.000332486
7.69506e-05
0.000100164
0.000108414
9.06648e-05
7.26877e-05
9.30931e-05
0.000237217
0.000365646
0.000452433
0.000528808
0.000424308
0.000223867
1.53907e-05
0.000173565
0.000166052
2.05233e-06
0.000123319
3.37181e-05
6.31378e-05
4.5365e-05
8.76474e-05
0.000179485
0.000242798
0.000211057
0.000168436
0.000226024
0.000222785
0.000258283
0.000315799
0.000186895
3.48216e-05
3.39258e-06
1.60422e-05
5.14151e-05
4.52483e-05
6.24356e-05
0.000197431
0.000233408
0.000184634
0.000119456
1.79817e-05
5.67572e-05
1.3228e-05
5.62005e-05
2.06661e-05
2.15342e-06
7.18218e-05
0.000305237
0.000174457
0.000157302
0.000131335
7.57815e-05
2.86193e-05
9.69461e-06
5.18775e-06
8.39552e-06
9.31854e-06
1.50853e-05
4.23606e-05
2.46402e-05
8.07843e-06
1.16427e-06
4.30348e-06
1.2631e-05
7.26759e-05
0.000223132
0.000232387
0.000116211
2.76852e-05
1.24305e-06
1.40405e-06
1.17807e-05
2.46886e-05
1.0967e-05
6.6118e-06
1.92196e-06
6.34163e-05
0.000517044
0.00015084
9.20475e-05
3.80814e-05
2.14915e-06
2.08762e-07
6.64665e-07
1.26226e-06
1.59807e-06
4.22178e-07
8.55086e-07
8.82092e-06
7.92489e-06
4.0161e-06
4.37401e-07
1.22232e-05
1.79115e-05
0.000185804
0.00013269
1.77667e-05
1.32273e-06
1.25583e-06
2.04078e-06
1.30643e-06
1.50832e-06
9.12459e-06
3.12647e-06
4.49027e-06
2.30711e-06
8.34641e-05
0.000282749
1.3401e-05
4.24787e-06
9.08742e-06
5.06691e-06
8.14773e-07
7.06817e-07
3.79015e-07
7.67565e-07
5.13471e-07
5.3272e-07
2.73106e-06
2.27295e-06
4.4843e-06
1.35636e-05
4.71967e-05
5.43274e-05
9.08907e-05
2.12593e-06
1.42543e-06
1.22843e-06
1.67933e-06
1.53462e-06
1.38316e-06
1.3322e-06
1.00065e-06
1.01956e-06
3.85576e-06
3.08366e-06
0.000104732
0.000126134
7.12873e-07
9.17752e-07
2.10501e-06
9.28856e-06
3.45569e-06
5.73634e-07
1.81275e-07
4.92621e-07
4.26808e-07
3.34533e-07
8.93052e-07
1.65296e-06
1.47053e-05
3.90105e-05
5.5209e-05
4.17772e-05
2.99606e-06
2.05753e-06
1.04253e-06
1.26821e-06
1.69671e-06
1.87428e-06
1.75591e-06
1.61446e-06
1.13564e-06
3.54026e-07
2.15505e-06
4.65392e-06
0.000110397
8.84405e-05
6.32144e-07
8.12105e-07
1.63543e-06
4.4767e-06
8.47642e-06
2.02539e-06
3.50978e-07
5.81396e-07
5.18367e-07
5.16477e-07
2.85581e-07
1.10367e-06
3.87073e-05
8.34263e-05
4.22583e-05
1.07294e-05
2.31848e-06
2.31954e-06
5.29985e-07
8.82968e-07
1.23526e-06
1.60493e-06
1.95781e-06
2.11735e-06
2.23972e-06
1.10552e-06
1.59009e-06
5.70813e-06
0.000103244
5.75864e-05
8.47969e-07
1.04165e-06
1.25525e-06
2.31668e-06
6.80886e-06
4.60936e-06
7.94116e-07
8.24449e-07
7.99447e-07
8.24055e-07
6.46301e-07
6.00541e-07
3.39863e-05
0.000109253
3.78812e-05
2.16298e-06
3.01784e-06
2.18627e-06
2.46268e-07
3.25641e-07
1.30472e-06
2.16334e-06
2.40753e-06
2.62224e-06
2.93228e-06
3.09032e-06
1.60872e-06
5.08629e-06
8.8754e-05
3.67336e-05
9.90461e-07
1.1381e-06
1.68242e-06
2.03395e-06
4.86573e-06
4.70719e-06
1.46972e-06
1.04823e-06
9.83967e-07
9.09023e-07
1.28731e-06
1.03914e-06
1.30016e-05
9.26365e-05
3.39614e-05
7.3317e-07
3.21834e-06
2.53501e-06
5.47179e-07
7.51735e-07
2.14779e-06
2.88533e-06
2.93199e-06
3.39278e-06
4.76876e-06
6.48181e-06
3.97723e-06
9.85025e-06
6.10125e-05
2.22913e-05
1.20723e-06
1.69972e-06
2.2466e-06
2.70205e-06
3.44146e-06
3.19306e-06
2.05525e-06
1.25855e-06
1.2916e-06
1.16232e-06
1.16484e-06
1.5555e-06
5.75491e-06
5.64711e-05
1.55318e-05
1.1666e-06
3.01807e-06
3.0157e-06
3.24166e-06
1.21637e-06
3.3816e-06
4.58558e-06
4.52058e-06
4.5707e-06
7.78937e-06
1.24128e-05
1.174e-05
1.59333e-05
2.22119e-05
1.3642e-05
1.6143e-06
2.30919e-06
2.93131e-06
5.51219e-06
2.62224e-06
3.64077e-06
3.48531e-06
1.88393e-06
1.69466e-06
1.46212e-06
1.49482e-06
1.57716e-06
2.51273e-06
1.09005e-05
5.7164e-06
9.76917e-07
4.65607e-06
4.97156e-06
4.77526e-06
1.66276e-06
4.57113e-06
7.15949e-06
7.52759e-06
6.68508e-06
9.50489e-06
1.54778e-05
1.90286e-05
1.0558e-05
1.13496e-05
8.77531e-06
2.24215e-06
3.10858e-06
3.90692e-06
6.84563e-06
3.74691e-06
3.49291e-06
3.51526e-06
3.02778e-06
1.95753e-06
1.76059e-06
1.55667e-06
2.55738e-06
3.4799e-06
5.64443e-06
9.49684e-06
2.32533e-06
3.7018e-06
7.88831e-06
3.76895e-06
1.63374e-06
4.53137e-06
7.15482e-06
8.81021e-06
9.64344e-06
6.9318e-06
1.01579e-05
1.26897e-05
1.01339e-05
1.80323e-05
6.27992e-06
2.88269e-06
3.96418e-06
5.4681e-06
7.18223e-06
1.18781e-05
4.38465e-06
3.00099e-06
2.22443e-06
2.02738e-06
2.00265e-06
1.78352e-06
2.34329e-06
5.30238e-06
1.12305e-05
1.73704e-05
1.44263e-06
4.0503e-06
6.08677e-06
2.98879e-06
1.99958e-06
3.47925e-06
4.79661e-06
5.87979e-06
1.08019e-05
9.27958e-06
1.88946e-06
6.13621e-06
4.54475e-05
8.01219e-05
4.94451e-06
2.69855e-06
3.92621e-06
6.31632e-06
8.36675e-06
1.41937e-05
7.15664e-06
3.83139e-06
2.14181e-06
1.95705e-06
2.00982e-06
2.8749e-06
1.64191e-06
7.768e-06
2.80481e-05
9.61404e-06
1.00476e-06
2.14511e-06
3.88757e-06
2.59736e-06
5.14654e-06
1.3185e-05
3.39341e-05
1.8437e-05
6.85419e-06
2.21574e-05
0.000169048
0.000264824
0.000473621
0.00026406
4.56028e-06
1.4498e-06
2.23886e-06
3.93814e-06
6.64997e-06
1.50573e-05
1.10541e-05
5.21521e-06
3.03735e-06
2.09851e-06
1.75999e-06
2.58861e-06
3.16113e-06
4.17635e-06
2.82729e-05
1.13883e-05
1.18951e-06
9.39926e-07
2.3992e-06
3.8151e-06
1.297e-05
0.00010136
0.000194514
0.000575084
0.000619469
0.000745042
0.00113866
0.00118018
0.000665995
0.000397478
3.95293e-06
4.82428e-07
6.44406e-07
9.27704e-07
1.48915e-06
5.15195e-06
2.24998e-05
8.00561e-06
4.73554e-06
2.51511e-06
1.99361e-06
1.64476e-06
5.38274e-06
2.87422e-06
1.09018e-05
2.06615e-05
5.32763e-06
2.29272e-06
3.17652e-06
8.89052e-06
4.53406e-05
0.000412835
0.000588076
0.000698802
0.000933987
0.000962656
0.000550744
0.000355698
9.49918e-05
0.000334845
2.09127e-06
3.51444e-07
3.97768e-07
5.32394e-07
5.9572e-07
6.73866e-07
5.77576e-06
1.79061e-05
5.18482e-06
3.69878e-06
2.87005e-06
1.83515e-06
2.95302e-06
6.21071e-06
6.08691e-06
4.57816e-05
1.51181e-05
1.0102e-05
7.76433e-06
2.54394e-05
0.000124249
0.000206792
2.35674e-05
1.86241e-06
2.99233e-06
3.96381e-06
6.84614e-07
6.81177e-07
8.21425e-07
0.000171359
1.66626e-06
1.03342e-06
8.25542e-07
8.98029e-07
8.70422e-07
6.37574e-07
4.25047e-07
6.27691e-06
6.0465e-06
2.77501e-06
3.54164e-06
2.26128e-06
2.7427e-06
1.11294e-05
1.11719e-05
7.49532e-05
2.57399e-05
2.22459e-05
1.61085e-05
2.86622e-05
5.90795e-05
2.07681e-05
1.69559e-06
1.99269e-06
1.53117e-06
1.7249e-06
1.54254e-06
1.52484e-06
1.57702e-06
0.000111023
4.07725e-06
3.49348e-06
2.01475e-06
1.58879e-06
1.29833e-06
9.00713e-07
6.33845e-07
1.26594e-07
7.817e-06
7.00185e-07
2.57207e-06
3.00434e-06
1.23262e-05
8.36051e-06
3.29957e-05
0.000114424
3.46842e-05
2.64472e-05
1.6126e-05
1.79883e-05
2.50612e-05
8.33361e-06
2.40117e-06
2.82026e-06
1.8571e-06
2.12552e-06
1.95666e-06
1.94195e-06
2.0472e-06
7.68996e-05
1.00824e-05
5.70964e-06
2.41836e-06
2.41358e-06
1.46912e-06
5.75072e-07
5.54795e-07
3.57582e-07
1.835e-06
9.73157e-07
2.56187e-06
5.72767e-06
1.50806e-05
3.13284e-05
0.000207319
6.11004e-05
2.93e-05
1.85206e-05
1.02645e-05
9.32769e-06
1.48408e-05
5.87526e-06
3.21455e-06
3.70975e-06
2.54119e-06
2.60716e-06
2.50325e-06
2.39428e-06
2.35689e-06
4.62109e-05
2.06648e-05
6.4552e-06
4.09668e-06
3.30681e-06
9.0629e-07
5.12256e-07
8.32584e-07
1.45748e-06
4.83018e-06
6.12139e-06
6.79472e-06
7.54073e-06
7.06689e-06
0.000160405
7.65214e-05
3.13606e-05
2.01293e-05
1.51928e-05
7.93911e-06
4.389e-06
1.67868e-05
4.69065e-06
3.18715e-06
4.49025e-06
2.9223e-06
3.04071e-06
2.92145e-06
2.70108e-06
2.46798e-06
2.38889e-05
2.35569e-05
4.88287e-06
7.49023e-06
2.21917e-06
6.55559e-07
2.11984e-06
3.05569e-06
3.35613e-06
6.20453e-06
6.58056e-06
6.47168e-06
4.69976e-06
4.29737e-06
2.17196e-05
3.75866e-05
2.55585e-05
4.02599e-05
4.05844e-05
3.19989e-05
2.03893e-05
1.03316e-05
3.05016e-06
1.71787e-06
4.15439e-06
3.00742e-06
2.86479e-06
2.81018e-06
2.49439e-06
2.16039e-06
1.03404e-05
0.0017201
0.000772256
8.61971e-05
2.02883e-06
2.95274e-06
4.51308e-06
5.82517e-06
5.44148e-06
4.50402e-06
3.66066e-06
2.77952e-06
2.41175e-06
9.88978e-06
2.17666e-05
3.03024e-06
6.95363e-06
3.64613e-05
0.00010252
6.23766e-05
4.28594e-05
9.36172e-06
1.15168e-05
7.87207e-07
3.15442e-06
2.53445e-06
2.32318e-06
2.21146e-06
1.86484e-06
1.5038e-06
3.59487e-06
0.00147274
0.00238935
0.0023757
0.000641095
6.92037e-06
7.00971e-06
8.43736e-06
5.00223e-06
2.43333e-06
1.48351e-06
1.35951e-06
6.2465e-06
2.5664e-05
1.35546e-05
3.87041e-05
9.64511e-05
0.00058622
0.000163897
7.52821e-05
5.45008e-05
2.87342e-05
1.18807e-05
4.53235e-06
3.34356e-06
2.23002e-06
1.82095e-06
1.5396e-06
1.18023e-06
8.30077e-07
9.65916e-07
0.000288085
5.815e-05
0.00128893
0.0027115
0.000600693
2.02566e-05
1.37361e-05
4.25484e-06
2.2095e-06
7.1879e-07
2.47125e-06
1.69078e-05
4.51663e-05
0.000420459
0.000556069
0.000879972
0.000943332
0.000948595
0.000629131
3.88693e-05
3.21081e-05
2.18993e-05
8.4079e-06
8.18529e-06
5.1067e-06
3.04624e-06
1.80908e-06
1.09824e-06
6.22511e-07
2.67044e-07
0.000178637
1.75461e-06
1.58834e-06
0.000405444
0.00278979
5.57748e-05
1.16071e-05
4.22186e-06
7.74723e-06
1.18864e-06
3.94982e-06
1.0961e-05
0.000211222
0.000329417
0.000405672
0.000444606
0.000201409
0.000207012
0.000405053
0.0005914
0.00019841
2.96208e-05
1.00652e-05
1.25038e-05
9.67912e-06
6.6687e-06
4.10501e-06
2.31432e-06
1.206e-06
3.76582e-07
0.000142273
2.63212e-06
3.18893e-06
1.42891e-06
0.00116454
0.00198383
4.5119e-06
0.000116013
0.00075219
0.000659338
3.57119e-06
1.16189e-05
0.000186071
4.00009e-05
3.20603e-06
1.74525e-05
6.81457e-06
1.90287e-06
8.53788e-07
7.93425e-05
0.000351687
7.63258e-05
1.08512e-05
9.91259e-06
8.56207e-06
6.65324e-06
4.90502e-06
3.49002e-06
2.257e-06
1.21734e-06
9.8359e-05
3.86944e-06
4.39851e-06
2.99985e-06
2.0058e-06
0.00178269
0.00171257
0.000819033
0.00100087
0.00208591
0.000824452
2.67246e-05
0.000235422
3.40476e-06
6.83372e-06
2.80136e-07
6.10374e-06
3.72261e-06
4.31839e-06
4.57821e-06
3.75552e-05
7.45394e-05
1.1418e-05
5.45964e-06
4.91697e-06
4.23419e-06
3.48946e-06
3.1304e-06
2.67628e-06
2.63519e-06
5.5007e-05
4.50677e-06
4.11392e-06
3.95576e-06
2.91117e-05
4.67874e-05
0.000871187
0.00033124
3.5209e-06
8.69287e-05
0.00192599
0.000690665
0.000105863
5.09549e-06
1.20244e-05
1.72138e-06
1.74106e-06
3.86995e-06
6.26785e-06
3.92505e-06
3.11861e-05
4.52828e-05
8.59989e-06
2.83196e-06
2.3194e-06
2.37161e-06
2.26895e-06
2.46377e-06
2.575e-06
4.3396e-06
3.35788e-05
3.8151e-06
3.33604e-06
7.30204e-06
3.88537e-05
1.75999e-05
7.42258e-07
2.4516e-06
3.31667e-06
2.10186e-06
0.000550436
0.00147099
0.000146133
1.73219e-06
9.99409e-06
4.59487e-06
3.97119e-07
2.78548e-06
3.56811e-06
1.12331e-05
2.96178e-05
2.52147e-05
7.53845e-06
2.48827e-06
1.4308e-06
1.50887e-06
1.62176e-06
2.05525e-06
2.42385e-06
6.30077e-06
2.63726e-05
3.35829e-06
3.25638e-06
1.16634e-05
2.09203e-05
3.50679e-06
1.16462e-06
2.94208e-06
2.82844e-06
2.65873e-06
1.80191e-05
0.00108931
0.000463541
4.25147e-06
3.3609e-06
5.99222e-06
1.08492e-06
2.54404e-06
1.42981e-05
1.18276e-05
7.67513e-06
1.66153e-05
8.04397e-06
3.12302e-06
2.03277e-06
1.46168e-06
1.38184e-06
1.80327e-06
2.16705e-06
8.25115e-06
1.71226e-05
2.94646e-06
4.29965e-06
6.791e-06
7.07441e-06
2.71851e-06
1.10818e-06
2.76507e-06
3.43092e-06
2.36497e-06
3.40753e-06
0.000354842
0.000535785
5.85816e-05
1.50271e-06
5.2294e-06
2.8109e-06
5.34064e-06
4.7388e-06
3.53656e-06
3.68064e-06
5.63979e-06
7.1262e-06
6.48792e-06
2.82401e-06
1.18017e-06
1.0258e-06
1.42839e-06
1.74498e-06
9.43106e-06
9.90274e-06
2.68092e-06
3.53906e-06
3.95099e-06
3.77624e-06
2.99059e-06
9.01607e-07
3.04288e-06
3.6625e-06
1.6363e-06
2.42779e-06
0.000229614
0.000544716
7.90117e-05
1.49616e-06
5.08324e-06
3.76476e-06
2.42816e-06
2.70439e-06
2.49191e-06
3.1868e-06
3.15719e-06
2.14208e-06
2.10624e-06
1.48882e-06
6.71184e-07
5.27058e-07
9.27748e-07
1.31963e-06
9.16472e-06
3.84575e-06
2.27713e-06
2.91942e-06
2.88416e-06
2.70738e-06
2.80262e-06
1.47977e-06
3.11246e-06
2.96295e-06
1.93479e-06
2.85961e-06
0.000174289
0.000680084
9.61933e-05
1.82532e-06
5.48389e-06
4.66368e-06
2.83238e-06
2.52205e-06
2.37741e-06
3.03532e-06
2.31503e-06
1.55781e-06
1.1507e-06
7.62989e-07
4.44247e-07
3.33415e-07
6.70326e-07
1.15382e-06
7.10466e-06
1.40561e-06
1.27318e-06
1.88277e-06
2.16322e-06
2.21599e-06
2.51763e-06
2.20204e-06
1.60632e-06
2.21048e-06
4.68151e-06
4.2446e-06
0.000117319
0.000904386
0.000177359
2.27827e-06
6.29621e-06
4.80507e-06
3.28287e-06
2.46223e-06
2.52397e-06
2.28387e-06
1.59553e-06
1.29392e-06
1.02686e-06
7.05548e-07
4.30432e-07
3.46467e-07
6.69169e-07
1.2042e-06
4.42035e-06
8.13869e-07
6.11042e-07
8.16163e-07
1.1828e-06
1.42207e-06
1.5841e-06
1.67747e-06
1.20403e-06
3.2284e-06
6.19291e-06
5.06105e-06
2.17546e-05
0.000951411
0.000512037
2.59316e-06
7.32236e-06
6.23906e-06
3.49128e-06
2.7991e-06
2.33274e-06
1.49031e-06
1.20379e-06
1.12777e-06
9.38808e-07
6.45486e-07
4.20501e-07
3.85328e-07
7.12412e-07
1.1217e-06
2.36632e-06
5.84951e-07
4.34255e-07
4.42162e-07
5.16388e-07
6.47348e-07
7.71401e-07
9.41519e-07
1.22739e-06
2.04298e-06
6.17926e-06
7.01624e-06
2.56383e-06
0.000325254
0.000931084
7.23355e-05
4.86991e-06
8.22361e-06
3.91967e-06
2.74129e-06
1.79113e-06
1.26096e-06
1.16121e-06
1.06044e-06
7.79289e-07
4.99047e-07
3.52842e-07
3.71115e-07
6.05824e-07
7.89305e-07
1.35089e-06
4.56891e-07
4.14217e-07
3.78669e-07
3.64519e-07
3.53687e-07
3.32482e-07
3.54431e-07
4.72899e-07
4.73198e-07
5.67702e-06
8.49746e-06
4.14378e-06
1.55978e-05
0.000682007
0.000343281
2.70432e-07
6.80697e-06
4.22702e-06
2.49063e-06
1.7725e-06
1.51468e-06
1.26989e-06
9.25807e-07
5.8278e-07
3.4808e-07
2.64102e-07
2.95595e-07
3.98888e-07
5.00387e-07
8.89285e-07
3.94085e-07
4.73703e-07
4.35471e-07
3.72342e-07
3.24683e-07
2.58011e-07
1.84283e-07
1.90874e-07
7.11738e-07
5.3093e-06
9.75742e-06
7.71564e-06
1.54777e-06
0.00014614
0.000541913
7.50666e-05
3.32149e-06
3.9714e-06
2.65218e-06
1.95012e-06
1.53881e-06
1.05664e-06
7.00612e-07
3.9124e-07
2.25953e-07
1.89413e-07
2.14424e-07
2.62968e-07
3.54518e-07
6.33081e-07
2.08474e-07
6.96755e-07
7.40181e-07
4.79288e-07
3.89458e-07
2.92102e-07
1.92134e-07
1.05987e-07
6.32822e-06
8.7232e-06
1.32601e-05
8.85573e-06
4.68607e-06
1.91685e-06
0.000530539
0.000199271
2.31694e-06
2.91258e-06
1.96851e-06
1.36517e-06
1.02662e-06
7.18951e-07
4.41741e-07
2.26608e-07
1.38806e-07
1.44408e-07
1.78573e-07
2.17844e-07
3.04514e-07
4.79182e-07
2.99138e-07
2.70405e-06
1.01003e-06
6.71732e-07
5.3953e-07
3.8278e-07
1.95941e-07
8.02651e-08
5.39239e-06
3.49941e-05
1.77986e-05
1.33491e-05
7.17235e-06
1.35382e-06
0.000269924
0.000371742
7.16508e-06
1.28434e-06
7.17465e-07
6.14519e-07
5.71568e-07
4.38573e-07
2.59497e-07
1.22933e-07
8.56984e-08
1.37588e-07
2.21487e-07
2.74349e-07
3.60751e-07
3.99082e-07
0.000367804
0.00039626
4.30797e-06
9.83931e-07
6.96218e-07
4.7204e-07
1.70073e-07
1.28077e-08
2.61242e-05
3.8534e-05
4.99072e-05
7.19992e-06
1.07946e-05
5.78282e-06
6.72668e-05
0.000235069
1.7657e-05
6.34883e-07
3.23784e-07
3.92092e-07
4.22954e-07
3.27794e-07
1.82126e-07
7.18318e-08
4.57942e-08
1.62137e-07
3.59911e-07
1.19763e-06
1.49999e-06
3.62304e-07
0.000461633
0.000319462
0.000399671
4.39433e-06
9.20741e-07
4.76017e-07
1.83248e-07
4.20123e-08
3.90369e-05
3.32898e-05
0.000136951
1.48787e-05
6.92284e-06
7.11175e-06
9.40264e-06
7.60931e-05
7.38012e-05
1.06757e-06
3.28655e-07
4.50848e-07
5.17159e-07
3.7766e-07
1.97436e-07
6.87139e-08
7.68321e-09
1.4528e-07
8.93704e-07
2.25141e-06
5.63189e-05
4.90293e-06
6.44673e-05
2.90121e-06
0.000278341
0.000329028
3.25167e-06
5.67393e-07
3.57389e-07
9.88955e-06
1.39103e-05
3.64411e-05
7.41239e-05
0.000125902
4.19538e-06
4.06962e-06
1.1517e-05
0.000107072
6.63777e-05
5.8867e-07
2.61424e-07
6.42301e-07
9.87097e-07
7.836e-07
6.37274e-07
4.11324e-07
8.73985e-08
3.44204e-08
7.62402e-07
8.14658e-07
4.92137e-05
6.23199e-05
3.16773e-05
6.58156e-06
3.35791e-06
0.000147908
0.000242263
4.58282e-06
1.52037e-06
6.60232e-06
1.57867e-05
3.21642e-05
3.05987e-05
0.000138498
8.27892e-06
5.30476e-06
2.97257e-05
0.000191285
3.96954e-05
7.59304e-07
2.13946e-07
8.45424e-07
2.28036e-06
4.02277e-06
2.94165e-06
2.27526e-06
1.12959e-06
2.41025e-07
4.28271e-07
5.24208e-06
2.99193e-06
1.43138e-05
1.29375e-05
5.80833e-06
4.77865e-06
3.35017e-06
9.23215e-05
0.000202895
4.33101e-05
6.14987e-06
1.69737e-05
1.80478e-05
2.07112e-05
0.000115263
1.51122e-05
2.02247e-05
7.6429e-05
0.000217321
2.49149e-05
2.94031e-06
7.71459e-07
1.82496e-06
4.67017e-06
2.18211e-05
1.73376e-05
1.12485e-05
3.68221e-06
9.1941e-07
3.57333e-07
2.66901e-06
2.50834e-06
3.88766e-06
4.41279e-06
4.13638e-06
3.49764e-06
3.27805e-06
2.58918e-06
3.24827e-05
0.000103381
2.50279e-05
1.30876e-05
8.51457e-06
1.58967e-05
0.000134139
4.80157e-05
1.65393e-05
0.000315674
0.000173077
1.9698e-05
3.31807e-05
0.000170565
0.000254544
0.000369877
0.000367741
0.000266347
8.39048e-06
5.99525e-06
1.33446e-06
2.14646e-07
5.85227e-07
1.19689e-06
1.37567e-06
4.96547e-06
1.19627e-06
1.21678e-06
2.13363e-06
2.30473e-06
1.54404e-06
6.14658e-06
2.76606e-05
8.11476e-06
1.08853e-05
2.51333e-05
0.000145994
8.10302e-05
3.61048e-05
0.000360758
8.40805e-05
5.89239e-05
0.000314165
0.000458103
0.000331587
0.000220075
4.87539e-05
3.79273e-05
3.54785e-05
1.06406e-06
9.16092e-07
1.50317e-07
5.63434e-08
3.76609e-07
1.08653e-06
8.54462e-07
1.27363e-06
5.64743e-07
5.05759e-07
9.23399e-07
1.50178e-06
4.78917e-06
1.33249e-05
2.17039e-05
6.66183e-06
9.64265e-05
0.000213207
3.70858e-05
7.18021e-05
0.000170358
4.99749e-05
0.000146586
0.000185016
8.71415e-06
1.84435e-06
1.12029e-06
8.79461e-07
6.04503e-07
1.23739e-05
8.04657e-07
4.39971e-07
2.87967e-07
1.55964e-07
4.92061e-07
8.45634e-07
1.41851e-06
1.66012e-06
8.15841e-07
5.79995e-07
6.72884e-07
1.35123e-06
4.53362e-06
2.13089e-05
4.0629e-05
1.43396e-05
0.000212841
0.000236355
7.84454e-06
7.89114e-05
7.97453e-05
4.67106e-05
0.000139959
2.00372e-05
7.11174e-06
1.98463e-06
9.10161e-07
4.23602e-07
1.95866e-07
5.53721e-07
2.79451e-06
5.34124e-07
5.95389e-07
3.94806e-07
6.02871e-07
8.05461e-07
8.80639e-06
7.74486e-06
5.37659e-06
3.65896e-06
2.06955e-06
7.83272e-07
1.69518e-06
4.68098e-05
5.36636e-05
0.000353096
0.000305985
9.83276e-05
1.0959e-05
7.96264e-05
3.8965e-05
5.33887e-05
8.95183e-05
1.36145e-05
7.28625e-06
1.40294e-06
4.20333e-07
1.87738e-07
1.11516e-07
1.86671e-08
1.18816e-06
1.14244e-06
8.20373e-07
5.73178e-07
7.11784e-07
7.52265e-07
4.25194e-05
0.000127966
7.14463e-05
3.19952e-05
2.33758e-05
2.52455e-05
3.7104e-05
6.32522e-05
0.00047335
0.000526228
0.000814219
0.00025174
3.86133e-05
0.000188884
6.00092e-05
9.97965e-05
8.77151e-05
1.27022e-05
7.71497e-06
1.39449e-06
1.12254e-07
7.85508e-08
7.11682e-08
2.92137e-08
3.84216e-07
1.07473e-06
1.33865e-06
6.11555e-07
5.40792e-07
7.1735e-07
0.000174247
0.000184311
0.000216515
0.000239716
0.000285532
0.000134349
0.000230897
0.00086381
0.000268938
0.000521841
0.00229367
0.00157171
0.000695949
0.0005502
0.000488535
0.000194827
9.74316e-05
3.78623e-05
4.73932e-06
6.90236e-07
2.78546e-08
6.60158e-08
9.35443e-08
5.77815e-08
3.20506e-07
2.27463e-06
3.50123e-06
3.33177e-06
2.98039e-06
1.0366e-06
0.000262192
9.0609e-06
1.89956e-05
6.49661e-05
0.000107384
0.000248607
0.000333481
0.000100937
0.000215345
0.000333286
0.00147823
0.0023408
0.00181603
0.000549035
0.000500458
0.000311737
0.00012665
1.38968e-05
2.39707e-05
1.60175e-06
7.48693e-06
1.71549e-05
1.40059e-06
2.52785e-07
8.11269e-07
6.48553e-06
8.66176e-06
0.000215126
0.000155103
8.74695e-06
0.000133106
1.90192e-06
2.8932e-06
4.29697e-06
6.15768e-06
4.40393e-06
2.94594e-08
8.44131e-06
8.08336e-05
0.000175483
0.000262161
0.000660489
0.000732782
0.00015459
7.25333e-05
9.12223e-05
2.22362e-05
1.04465e-05
0.000241301
0.000106162
0.000553307
0.00088197
0.000390206
6.91378e-06
2.96277e-06
8.70279e-06
0.000229374
0.000168972
0.000183935
0.000137659
7.30425e-05
3.64937e-06
3.27014e-06
3.27095e-06
4.86642e-06
4.01052e-06
8.23615e-07
3.20018e-06
2.58212e-05
0.000105825
8.63653e-05
5.03847e-05
5.5839e-05
8.13254e-06
6.05662e-06
1.0459e-05
3.89059e-06
3.98157e-05
0.00033445
0.000877388
0.000763438
0.000681644
0.00108522
0.000743239
7.23015e-05
0.000127894
0.000175443
8.16621e-07
1.58541e-06
0.000195012
4.22135e-05
5.63858e-06
5.92646e-06
5.12143e-06
4.42818e-06
3.68503e-06
1.06878e-06
1.53117e-06
7.98282e-06
4.92301e-05
4.8758e-05
1.46508e-05
2.55992e-06
3.32757e-06
1.11243e-05
7.30014e-06
6.28465e-06
0.000102755
0.000318399
0.000218869
1.92087e-06
6.77473e-07
3.87951e-06
0.000571645
0.000615626
0.000288554
1.01428e-05
3.4193e-06
1.77183e-06
6.59783e-05
1.6631e-05
7.13297e-06
6.9557e-06
6.81348e-06
6.41687e-06
4.03773e-06
2.10168e-06
6.63724e-07
4.47644e-06
1.50937e-05
2.75553e-05
2.28043e-05
3.03267e-06
4.05618e-06
1.61978e-05
8.02745e-06
5.11592e-06
0.000185278
0.000278161
2.41945e-05
2.73089e-06
2.21894e-06
1.89603e-06
1.37354e-06
4.78035e-05
2.68845e-05
1.46332e-05
5.78483e-06
3.13023e-06
4.06594e-05
2.58732e-06
4.75186e-06
6.20639e-06
6.51563e-06
6.93587e-06
6.61097e-06
3.638e-06
1.57438e-06
7.56846e-06
1.35606e-05
1.03256e-05
3.15339e-05
5.44956e-06
6.07676e-06
1.51791e-05
3.63377e-06
1.10437e-05
0.000424231
0.000197393
1.17116e-05
2.17529e-06
1.47306e-06
1.39404e-06
3.21408e-06
7.10205e-06
9.25649e-06
9.45027e-06
7.15543e-06
4.33621e-06
2.27193e-05
1.19594e-06
1.12975e-06
2.32539e-06
4.59674e-06
5.74971e-06
6.57126e-06
6.35221e-06
2.83652e-06
8.81901e-06
2.0381e-05
4.62787e-06
2.52372e-05
1.27432e-05
1.01443e-05
1.47924e-05
1.54715e-06
6.22024e-05
0.000599276
5.78344e-05
7.53887e-06
2.42841e-06
1.86468e-06
2.5656e-06
4.89448e-06
6.83119e-06
7.9557e-06
8.5345e-06
7.03447e-06
4.41212e-06
8.70821e-06
1.19786e-06
8.32176e-07
7.5744e-07
1.19637e-06
2.92033e-06
5.34328e-06
6.1383e-06
3.12487e-06
4.17123e-06
3.04165e-05
4.79551e-06
6.92445e-06
1.39631e-05
1.7394e-05
1.59888e-05
1.22803e-06
0.000165696
0.000362874
1.57452e-05
4.42299e-06
2.40107e-06
2.11855e-06
3.30719e-06
6.1136e-06
7.32775e-06
7.79021e-06
6.99603e-06
4.90336e-06
2.39848e-06
1.66338e-06
8.32957e-07
9.94506e-07
7.27375e-07
6.84e-07
8.39049e-07
1.62666e-06
4.03824e-06
3.7378e-06
2.73101e-06
1.21754e-05
1.60576e-05
4.32132e-06
9.23722e-06
2.17564e-05
1.85253e-05
2.80294e-06
0.000299719
0.000187864
6.36878e-06
3.82678e-06
2.24115e-06
2.55448e-06
4.91211e-06
6.65881e-06
6.25026e-06
6.1756e-06
3.6844e-06
1.40122e-06
6.39988e-07
6.31208e-07
7.32811e-07
7.52754e-07
7.83354e-07
6.40782e-07
6.32662e-07
6.99693e-07
1.1456e-06
1.86207e-06
2.29665e-06
2.67536e-06
2.31793e-05
1.14378e-05
1.79291e-05
2.82861e-05
1.83637e-05
1.39843e-05
0.000414566
5.27739e-05
4.64242e-06
4.40301e-06
2.75274e-06
2.78904e-06
4.45455e-06
4.9382e-06
4.05157e-06
1.86564e-06
9.18149e-07
5.45102e-07
4.0261e-07
4.19221e-07
5.46714e-07
8.2182e-07
6.38391e-07
5.69022e-07
5.72818e-07
5.70413e-07
4.48874e-07
2.6461e-07
2.22095e-06
2.59986e-06
1.27905e-05
1.88215e-05
2.50894e-05
4.81786e-05
2.56419e-05
4.02481e-05
0.000240351
2.46732e-05
7.25872e-06
4.12845e-06
1.88683e-06
1.40409e-06
2.07527e-06
1.44575e-06
1.13685e-06
8.98658e-07
6.39515e-07
4.79438e-07
3.79414e-07
3.01744e-07
3.08147e-07
1.79613e-06
7.39164e-07
4.68352e-07
4.78923e-07
4.74597e-07
2.90964e-07
2.08291e-08
7.2175e-07
1.32584e-05
1.31601e-05
4.41364e-05
5.61754e-05
6.18022e-05
3.71382e-05
7.97804e-05
0.000177683
1.71746e-05
8.76717e-06
5.97854e-06
1.73193e-06
2.15499e-07
2.58876e-07
8.24575e-07
1.04738e-06
7.97261e-07
5.63984e-07
4.75599e-07
3.89011e-07
2.20738e-07
2.77253e-06
0.00031484
5.86121e-06
5.44641e-07
5.12148e-07
4.13298e-07
3.0097e-07
1.62279e-07
2.06658e-06
1.4478e-05
2.76553e-05
4.14451e-05
0.000102337
0.000105128
4.71454e-05
0.000228688
0.000145507
1.39894e-05
1.41759e-05
1.98427e-05
2.85683e-06
1.62122e-07
2.71693e-07
1.12383e-06
1.17375e-06
6.77159e-07
4.96469e-07
5.51845e-07
4.91173e-07
1.66671e-07
0.000390127
0.000517246
0.000573323
4.61067e-05
3.38112e-06
7.96063e-07
4.77065e-07
5.37004e-07
3.30798e-06
9.3098e-06
2.48754e-05
3.7815e-05
7.99411e-05
0.000137505
7.12684e-05
0.000286683
0.000122185
3.75167e-05
2.54088e-05
2.89996e-05
1.9845e-06
3.5412e-07
6.13754e-07
1.80881e-06
1.60179e-06
7.09282e-07
5.57091e-07
8.28984e-07
7.71319e-07
1.7048e-07
0.00049899
5.34333e-06
0.000279432
0.000538317
0.000349965
4.06323e-05
2.63324e-06
1.26815e-06
4.25938e-06
1.00287e-05
1.55722e-05
4.65425e-05
9.29019e-05
0.000146498
8.84128e-05
0.00030444
0.000232521
4.98081e-05
2.17366e-05
2.31102e-05
4.81904e-06
5.85396e-07
1.01306e-06
3.03241e-06
3.18623e-06
1.15193e-06
8.17129e-07
2.30361e-06
3.92656e-05
8.1719e-07
9.63914e-05
8.04622e-06
4.46257e-06
3.62141e-05
0.000267065
0.000387234
0.000144378
1.23879e-05
7.75629e-06
1.14481e-05
1.76035e-05
5.05474e-05
0.000149492
0.000179879
0.000136007
0.000389535
0.000304124
3.94086e-05
2.29738e-05
3.31724e-05
2.18099e-05
1.09068e-06
1.51902e-06
4.18132e-06
6.54195e-06
2.60278e-06
2.27498e-06
0.000109475
0.000969515
0.000630112
5.5363e-05
1.10751e-05
5.61273e-06
4.83871e-06
3.60125e-06
3.24728e-05
0.000197495
0.000154079
2.47387e-05
1.19342e-05
1.84809e-05
6.4483e-05
0.00021471
0.000204746
0.000161297
0.0005463
0.000324246
3.59366e-05
2.98836e-05
3.51527e-05
1.63343e-05
2.03146e-06
2.16627e-06
4.0418e-06
1.05836e-05
9.64592e-06
7.46029e-05
0.000966236
0.000481228
0.00135271
1.19643e-05
8.94449e-06
5.57284e-06
4.60787e-06
4.00043e-06
6.88133e-06
8.34887e-06
4.27948e-05
3.29366e-05
1.88622e-05
2.82555e-05
0.000130829
0.000267437
0.000230358
0.000126397
0.000643993
0.000271529
2.55915e-05
2.02353e-05
1.95803e-05
1.11407e-05
4.20709e-06
1.13799e-06
7.41153e-06
1.33819e-05
7.93337e-05
0.000931128
0.000221837
3.17489e-06
0.000237175
1.12437e-05
2.99695e-06
2.31453e-06
3.17232e-06
4.39089e-06
8.50856e-06
9.80286e-06
4.14319e-06
2.10088e-06
5.28134e-06
4.24631e-05
0.000184979
0.000245712
0.000223287
9.19904e-05
0.000555376
0.000213757
2.24752e-05
9.10459e-06
8.99842e-06
7.7862e-06
4.0037e-06
1.38429e-06
7.42649e-06
1.90773e-05
0.000243229
0.00018971
6.07379e-06
5.62377e-06
0.000114544
1.17029e-05
6.54869e-06
2.51524e-06
1.14636e-06
2.6734e-06
5.9519e-06
7.53046e-06
3.62608e-06
1.06801e-06
4.82511e-07
4.36072e-05
0.000134891
0.000205993
0.000130823
9.69822e-05
0.000383844
0.000110993
2.08211e-05
2.6784e-06
2.57124e-06
4.5918e-06
2.87232e-06
1.01e-06
2.77347e-06
1.39455e-05
4.5424e-05
3.53593e-06
9.28657e-06
6.69053e-06
4.76646e-05
2.49942e-05
1.08415e-05
9.25291e-06
1.59613e-05
1.93227e-05
4.06582e-06
2.6324e-06
2.18245e-06
5.71317e-07
7.54882e-06
5.79679e-05
0.000152249
0.00011941
4.47143e-05
0.000121708
0.00021945
3.32304e-05
1.77053e-05
9.25545e-06
6.69145e-06
2.57383e-06
1.50535e-06
4.61611e-07
1.59067e-06
4.37765e-06
3.58724e-06
3.37157e-06
2.85398e-05
6.80653e-06
1.3761e-05
0.000133817
0.000146112
7.37982e-05
0.000574809
6.38788e-05
2.90419e-05
1.53399e-06
1.18967e-06
2.35828e-06
5.51936e-05
0.000175472
0.000136869
2.80805e-05
1.90437e-05
0.000150856
4.13148e-05
3.05319e-05
5.66152e-05
3.68158e-05
1.35026e-05
1.92388e-06
4.19841e-07
2.76862e-06
3.11681e-06
2.95335e-06
3.62696e-07
5.3894e-07
6.5811e-05
6.00872e-06
5.26857e-06
0.000585374
0.000810548
0.000780871
0.00052207
0.000552692
4.8444e-05
6.88352e-06
2.94428e-06
5.39481e-05
0.000194419
0.000153125
4.46627e-05
8.44244e-06
8.19836e-06
3.02885e-05
2.90832e-05
3.19696e-05
1.96335e-05
7.14475e-05
2.74207e-05
2.26186e-05
7.59982e-05
4.822e-05
1.86677e-05
6.35647e-06
4.53684e-07
2.98149e-06
0.00015154
3.24223e-05
6.11864e-06
0.00084252
9.11153e-05
0.000195057
2.80282e-06
0.000140132
0.000309274
5.36855e-05
6.56929e-05
0.000354648
0.000159108
2.57595e-05
1.00108e-05
7.21297e-06
1.03053e-05
3.44351e-05
0.000207182
0.000126809
4.76785e-05
6.31525e-05
0.000162613
0.00159837
0.00408586
0.00107592
1.34607e-05
1.67333e-05
4.14132e-06
0.000140317
0.000278457
0.000294819
6.17793e-05
0.000517353
9.19691e-06
1.41008e-06
3.9796e-06
6.77751e-07
0.000446378
0.000361843
0.000374752
0.000525261
0.00018454
2.07751e-05
3.29181e-05
8.70389e-05
0.000117932
0.00038304
0.00100594
0.00167868
0.00204935
0.00268903
0.00501729
0.0079544
0.00427986
0.00228016
0.00106188
1.57154e-05
8.60342e-05
0.000567776
5.05483e-05
0.000334341
0.000303337
0.000303896
1.26422e-05
3.26907e-06
4.65576e-06
5.77149e-06
2.70867e-05
0.00101145
0.00198491
0.00231487
0.00153975
0.00100267
0.00108064
0.00140258
0.00169676
0.00281158
0.00346971
0.00520631
0.00634204
0.00756345
0.00663776
0.00133663
2.21628e-05
0.000673872
0.00190607
0.00147545
0.00149246
0.000242782
2.04704e-05
3.94939e-05
0.000437645
0.000193579
1.35971e-05
5.32791e-06
6.14988e-06
6.09279e-06
4.50936e-07
0.000239541
0.00123002
0.00456445
0.00467905
0.00380744
0.00388381
0.00397976
0.00424242
0.0054565
0.00533305
0.00378611
0.00296367
0.00158105
0.000150943
1.3749e-06
9.41564e-07
1.79299e-06
0.000378599
0.00185031
0.000727408
2.98662e-05
2.14316e-05
1.83746e-05
0.00031596
0.000158516
1.44171e-05
1.42605e-05
1.29166e-05
5.58541e-06
4.19327e-05
0.000425844
0.000316317
0.000517775
0.00243781
0.0029353
0.00302645
0.00299887
0.0034148
0.00357804
0.00164056
0.000239234
2.11149e-05
2.35596e-06
1.40272e-06
1.4083e-06
2.71474e-06
4.10078e-06
1.90262e-06
0.000243664
0.000453273
5.74804e-05
2.64561e-05
2.7015e-05
0.00018147
0.000159517
4.03272e-05
9.31775e-05
4.50301e-05
2.08251e-05
0.000272918
0.000476372
5.92681e-05
9.59946e-06
0.000126245
0.000351358
0.000519458
0.000623341
0.000731274
0.000432574
3.91718e-05
2.8748e-06
2.68014e-06
1.87385e-06
2.47066e-06
1.22732e-06
2.65673e-06
6.65554e-06
4.28067e-06
8.6338e-05
0.000446147
0.000170828
2.5851e-05
3.07464e-05
0.000107568
0.000367238
0.000316048
0.000239517
6.56967e-05
0.000178669
0.000360754
0.000147611
3.08637e-06
4.51848e-06
6.29821e-06
7.20633e-06
1.40974e-05
3.24625e-05
6.73442e-05
5.82154e-05
1.9249e-05
2.6056e-06
3.06956e-06
2.30073e-06
1.26966e-06
1.13723e-06
2.54202e-06
2.99354e-06
3.15439e-06
1.49495e-05
0.000323063
0.000434138
5.11373e-05
3.17593e-05
8.03369e-05
0.000844471
0.000266856
0.000102481
0.000141954
0.000363655
8.38649e-05
2.52862e-06
1.64317e-06
2.82736e-06
4.29952e-06
6.67877e-06
1.81546e-05
3.82561e-05
6.64284e-05
4.6652e-05
1.33289e-05
1.88749e-06
2.58374e-06
1.71815e-06
8.87942e-07
1.55554e-06
2.26851e-06
1.70554e-06
1.82913e-06
7.99519e-06
5.62132e-05
0.000608224
0.000301353
5.67074e-05
0.000128028
0.000792429
4.29329e-05
1.32427e-05
0.000179728
0.000315657
9.12308e-06
1.38065e-06
5.12344e-07
1.1611e-06
2.57388e-06
1.20803e-05
2.79452e-05
4.15437e-05
5.39672e-05
2.53909e-05
5.90163e-06
1.10982e-06
2.18125e-06
1.71969e-06
1.28281e-06
1.05862e-06
1.43753e-06
1.3691e-06
1.4085e-06
2.95568e-06
1.22285e-06
0.000397487
0.000700552
0.000163119
0.000169889
0.000621643
2.43819e-05
7.72158e-06
0.000118248
0.000208402
5.34348e-06
9.08851e-07
1.71829e-07
5.33588e-07
4.24004e-06
1.72872e-05
3.31778e-05
3.47456e-05
3.41961e-05
1.04433e-05
2.12127e-06
7.56769e-07
2.11238e-06
2.17796e-06
1.27934e-06
4.67709e-07
8.52158e-07
1.19659e-06
1.62586e-06
1.39185e-06
3.89252e-07
6.73102e-06
0.000730693
0.000854131
0.000349165
0.000416799
2.79101e-05
1.43852e-05
7.15277e-05
0.000214878
6.14907e-06
1.0613e-06
8.05373e-07
1.29811e-06
7.35502e-06
2.23508e-05
3.10913e-05
2.28576e-05
1.37702e-05
3.44253e-06
1.10518e-06
6.96139e-07
1.95119e-06
2.34723e-06
1.02641e-06
2.95639e-07
6.24621e-07
1.30924e-06
1.52217e-06
7.38019e-07
1.96278e-07
8.60615e-07
6.11046e-05
0.00125813
0.00172566
0.000217859
2.47714e-05
1.8659e-05
5.69431e-05
0.000340727
1.29653e-05
1.32458e-06
1.58016e-06
3.45098e-06
1.40317e-05
2.55727e-05
2.07373e-05
8.84705e-06
3.84584e-06
1.03834e-06
5.02275e-07
5.55829e-07
1.7432e-06
2.51195e-06
1.40332e-06
4.99841e-07
5.29058e-07
1.30042e-06
1.38626e-06
2.16866e-07
4.93304e-07
1.333e-06
2.29707e-06
2.17837e-05
0.00182662
0.000117072
2.09645e-05
2.07811e-05
5.40809e-05
0.000415362
1.82526e-05
1.47868e-06
2.98813e-06
8.02892e-06
1.86003e-05
2.06753e-05
9.95447e-06
3.05945e-06
9.82853e-07
3.99729e-07
3.40419e-07
5.02415e-07
1.25874e-06
2.8099e-06
2.38862e-06
8.85095e-07
5.87418e-07
1.15736e-06
1.20114e-06
1.79538e-07
5.06726e-07
2.55694e-06
3.7509e-06
2.77871e-06
0.000979389
4.54305e-05
3.0231e-05
2.42999e-05
6.17078e-05
0.000407964
1.99456e-05
1.54744e-06
4.79814e-06
1.12696e-05
1.8847e-05
1.33555e-05
4.2532e-06
1.19853e-06
5.75426e-07
3.67789e-07
3.21193e-07
4.12134e-07
7.87693e-07
2.46236e-06
3.07728e-06
1.3778e-06
8.54837e-07
1.13624e-06
7.57489e-07
3.25443e-07
1.46939e-06
1.94898e-06
4.11546e-06
6.0541e-06
0.00079441
1.65238e-05
2.3074e-05
3.1025e-05
6.97457e-05
0.000417724
2.65603e-05
1.90213e-06
5.79544e-06
1.25003e-05
1.4662e-05
8.15763e-06
2.65084e-06
1.0992e-06
5.4952e-07
3.69722e-07
3.19221e-07
3.34644e-07
6.09538e-07
1.90076e-06
3.48106e-06
2.13771e-06
1.45079e-06
1.25626e-06
4.2118e-07
6.29855e-07
2.19722e-06
3.52285e-06
2.56888e-06
3.8018e-06
0.000768583
3.0026e-05
1.51263e-05
2.53629e-05
6.63961e-05
0.000476916
3.07466e-05
2.43647e-06
6.7957e-06
1.07647e-05
1.14254e-05
6.8478e-06
2.98363e-06
1.12426e-06
5.1773e-07
3.54765e-07
2.84929e-07
3.43209e-07
6.08595e-07
1.22993e-06
3.63225e-06
3.44524e-06
2.26052e-06
1.13937e-06
4.87078e-07
1.22617e-06
2.68635e-06
3.21435e-06
5.13581e-06
6.08405e-06
0.000574205
3.61575e-05
2.65203e-05
1.98029e-05
0.000138972
0.00051723
2.68498e-05
3.91106e-06
6.19014e-06
9.01172e-06
9.16975e-06
6.2173e-06
3.69287e-06
1.32244e-06
5.05725e-07
3.45629e-07
3.2942e-07
7.02941e-07
6.31127e-07
7.01008e-07
2.86687e-06
4.58215e-06
3.29908e-06
1.076e-06
9.88171e-07
2.29685e-06
4.04871e-06
3.50314e-06
4.14008e-06
7.56801e-06
0.000438925
5.85614e-05
3.71147e-05
2.32204e-05
0.000463341
0.00047271
1.91343e-05
7.60511e-06
6.43254e-06
8.23961e-06
8.51707e-06
5.78571e-06
4.78284e-06
2.0153e-06
4.98316e-07
2.46188e-07
4.56441e-07
9.10324e-07
5.87602e-07
6.35329e-07
1.32796e-06
4.27793e-06
4.15387e-06
1.44132e-06
1.90388e-06
3.60522e-06
4.01605e-06
4.61822e-06
7.6921e-06
1.19907e-05
0.000228718
7.00248e-05
3.48879e-05
0.000264733
0.000609933
7.35091e-05
2.33274e-05
1.74389e-05
5.9951e-06
7.36665e-06
8.20098e-06
5.47131e-06
4.50835e-06
2.45229e-06
5.67245e-07
2.17725e-07
6.97129e-07
1.39615e-06
1.04206e-06
1.18965e-06
2.49875e-07
2.41572e-06
4.45667e-06
2.17389e-06
3.18638e-06
4.57943e-06
5.25025e-06
6.38117e-06
9.7123e-06
2.06564e-05
0.000134087
0.000177353
0.000152582
0.00117302
0.000199559
1.29644e-05
1.58744e-05
2.69826e-05
5.1611e-06
5.42038e-06
6.72196e-06
5.59785e-06
7.183e-06
3.45965e-06
6.01803e-07
3.64485e-07
8.97985e-07
1.73315e-06
2.53719e-06
2.4964e-06
2.11602e-05
1.45212e-06
3.80084e-06
3.32126e-06
4.35701e-06
5.12964e-06
7.13873e-06
1.05215e-05
1.88075e-05
2.80981e-05
5.86923e-05
0.000983602
0.0016657
0.000670266
2.449e-05
1.05442e-05
1.1279e-05
3.45084e-05
5.02779e-06
4.02238e-06
3.96457e-06
4.886e-06
5.90601e-06
4.04249e-06
5.57809e-07
3.03225e-07
9.93539e-07
2.90086e-06
5.64658e-06
2.19372e-06
0.000101744
4.26529e-05
4.58243e-06
4.32506e-06
4.57206e-06
5.72137e-06
9.61622e-06
1.511e-05
1.74569e-05
2.18719e-05
3.98215e-06
0.00155474
0.000286164
1.60413e-06
1.63597e-05
1.28802e-05
4.35941e-06
3.33113e-05
6.14702e-06
3.22262e-06
2.6805e-06
3.20525e-06
8.5482e-06
6.48921e-06
4.94428e-07
4.11527e-07
1.41283e-06
3.05996e-06
8.17762e-06
2.49433e-06
0.000172074
0.000113247
9.78081e-06
4.56277e-06
4.19741e-06
6.96184e-06
1.1094e-05
1.04895e-05
5.29821e-06
3.7794e-06
9.77761e-06
0.000787873
7.19712e-06
1.63814e-06
1.12121e-05
2.03581e-05
6.33542e-07
1.70811e-05
9.93632e-06
2.10645e-06
2.04609e-06
2.12347e-06
8.46191e-06
6.46208e-06
4.74779e-07
3.77361e-07
1.38922e-06
5.59032e-06
7.01407e-06
3.79338e-06
0.000185828
0.00010967
1.49249e-05
4.11711e-06
4.20455e-06
7.72771e-06
6.09181e-06
2.20671e-06
2.19972e-06
5.81022e-06
5.6744e-06
0.00070002
7.12326e-06
1.61063e-06
4.84857e-06
2.92198e-05
3.38243e-07
5.78002e-06
1.92199e-05
1.36507e-06
1.60846e-06
1.32709e-06
6.42269e-06
6.34841e-06
4.35894e-07
4.50433e-07
1.58003e-06
5.63064e-06
4.12086e-06
7.48126e-06
0.000209232
8.20245e-05
1.4693e-05
3.58999e-06
5.06155e-06
4.37759e-06
1.30599e-06
1.70228e-06
3.90565e-06
4.05639e-06
1.53857e-06
0.000633451
5.38254e-06
1.53621e-06
1.97048e-06
2.17186e-05
1.82299e-06
1.72181e-06
2.72346e-05
8.58113e-07
1.15052e-06
9.34549e-07
4.6571e-06
9.22037e-06
5.15953e-07
4.84274e-07
1.61503e-06
4.88353e-06
1.79856e-06
3.98298e-05
0.000253781
5.65279e-05
8.7787e-06
3.84559e-06
3.39824e-06
1.03447e-06
1.33553e-06
3.3269e-06
5.21194e-06
1.31519e-06
1.10742e-05
0.000550474
4.70509e-06
2.29742e-06
8.45089e-07
1.26896e-05
3.90382e-06
4.13123e-07
2.37754e-05
6.15519e-07
8.48563e-07
5.60111e-07
1.89903e-06
1.18044e-05
8.92944e-07
3.80124e-07
2.22955e-06
3.7614e-06
7.36804e-07
8.8525e-05
0.000249032
4.46833e-05
6.43422e-06
2.56668e-06
9.18177e-07
7.59268e-07
3.79151e-06
7.60279e-06
1.01545e-06
0.000127505
0.00118498
0.000471255
4.63932e-06
2.7711e-06
6.63711e-07
7.1742e-06
6.15515e-06
1.64242e-07
1.48845e-05
7.49834e-07
4.71209e-07
5.5771e-07
8.56934e-07
1.07503e-05
1.1762e-06
3.53969e-07
2.27305e-06
3.09018e-06
3.47116e-07
6.32504e-05
0.000218876
5.05367e-05
5.53443e-06
1.19352e-06
4.07156e-07
1.48186e-06
1.10563e-05
3.51493e-06
0.00118582
0.00183482
0.00397515
0.000385557
4.45659e-06
3.8052e-06
8.1013e-07
2.83268e-06
9.77305e-06
3.11845e-07
4.24475e-06
2.17518e-06
3.5125e-07
2.6947e-07
5.59763e-07
6.76819e-06
1.25929e-06
2.26301e-07
2.15844e-06
2.24199e-06
1.87617e-07
2.68132e-05
0.000220195
6.31432e-05
5.11358e-06
5.70817e-07
2.79369e-07
6.556e-06
5.99565e-06
0.000278378
0.00164151
0.00206452
0.00104102
0.00030163
4.80573e-06
4.33957e-06
1.15777e-06
1.32724e-06
1.29301e-05
3.2022e-07
5.81367e-07
1.84243e-06
7.74257e-07
1.82032e-07
1.91529e-07
3.79073e-06
1.31823e-06
1.62972e-07
1.75874e-06
1.64475e-06
1.10962e-07
2.20957e-05
0.000228667
6.49565e-05
4.61612e-06
3.21068e-07
3.60193e-07
6.38833e-06
1.68331e-05
0.00044405
4.01971e-05
8.20777e-07
0.000822278
0.000214891
5.59485e-06
5.17796e-06
2.1445e-06
7.49201e-07
1.75982e-05
1.14479e-06
6.71996e-07
4.98717e-07
1.20835e-06
1.47854e-07
1.2461e-07
2.55986e-06
8.06218e-07
1.65921e-07
1.60933e-06
9.71531e-07
1.37791e-07
1.63395e-05
0.000219294
7.44007e-05
3.86555e-06
5.40614e-07
7.21427e-07
1.03772e-06
2.44204e-05
0.000245681
2.79449e-06
7.37482e-07
0.000800276
0.00013439
7.28617e-06
6.58348e-06
3.50563e-06
9.46513e-07
1.5468e-05
2.57135e-06
8.01477e-07
2.02544e-07
8.97338e-07
2.08155e-07
1.05631e-07
1.24254e-06
3.75405e-07
1.91934e-07
1.49783e-06
6.46237e-07
1.6869e-07
4.69957e-06
0.000212977
0.000119744
3.43046e-06
1.02903e-06
1.70234e-06
6.35066e-06
2.17909e-05
0.000114055
3.798e-06
9.75717e-07
0.00063726
6.75446e-05
1.18699e-05
8.67688e-06
5.35206e-06
2.03451e-06
8.64314e-06
2.2273e-06
1.14493e-06
1.63115e-07
9.21697e-07
2.86143e-07
1.4125e-07
7.76944e-07
8.83604e-07
2.14793e-07
1.44501e-06
5.22951e-07
2.1133e-07
2.67416e-06
0.000187172
0.000179507
3.64784e-06
1.71603e-06
2.89506e-06
1.12318e-05
4.91391e-05
8.02975e-05
1.28862e-06
1.03004e-06
0.000563016
1.90681e-05
1.44028e-05
1.23679e-05
8.00664e-06
4.01603e-06
6.71792e-06
2.14178e-06
1.59056e-06
2.72018e-07
8.11748e-07
4.93754e-07
1.87715e-07
7.59499e-07
4.83634e-07
2.77453e-07
1.22279e-06
5.65095e-07
2.80733e-07
2.45592e-06
0.000116565
0.000289928
4.95182e-06
3.03687e-06
4.66653e-06
1.08744e-05
4.58382e-05
2.03961e-05
1.31215e-06
8.45824e-07
0.000469075
3.7829e-06
7.60714e-06
1.09631e-05
1.09803e-05
7.46301e-06
7.18262e-06
1.45865e-06
2.12966e-06
4.77393e-07
8.39616e-07
5.10749e-07
3.26692e-07
1.26746e-06
2.6087e-07
3.43295e-07
1.35947e-06
6.09722e-07
4.20375e-07
2.75763e-06
1.22365e-05
0.000429481
3.06874e-05
4.43379e-06
5.44343e-06
4.42144e-06
2.41396e-05
2.63639e-05
1.0669e-06
1.26189e-06
0.000403932
5.97495e-06
2.89144e-06
4.26926e-06
8.86317e-06
1.09218e-05
1.2047e-05
1.237e-06
2.15554e-06
9.01961e-07
8.46039e-07
5.70289e-07
3.64717e-07
1.0892e-06
3.01055e-07
3.59477e-07
1.4448e-06
5.79596e-07
7.26813e-07
3.51024e-06
4.73581e-06
0.000137122
0.000272569
5.56956e-06
5.67613e-06
1.04566e-06
2.75272e-05
1.5004e-05
1.4575e-06
1.22169e-06
0.000334617
6.73871e-06
5.49045e-06
2.16402e-06
3.78606e-06
9.3501e-06
2.0118e-05
8.55978e-07
1.82017e-06
8.49359e-07
1.31316e-06
5.90386e-07
2.66756e-07
9.65059e-07
5.26251e-07
6.53722e-07
2.05e-06
4.22687e-07
1.24996e-06
5.5975e-06
3.96001e-06
4.13264e-06
0.000153498
2.31691e-05
2.089e-06
5.75473e-06
2.1371e-05
7.45927e-06
1.39949e-06
1.3885e-06
0.000273878
4.85119e-06
8.27198e-06
5.56302e-06
1.66562e-06
6.49083e-06
2.03788e-05
6.47747e-07
2.01206e-06
8.67183e-07
1.17668e-06
4.65223e-07
3.04998e-07
1.10157e-06
3.95465e-07
1.24784e-06
2.39194e-06
3.89536e-07
2.48087e-06
6.34948e-06
2.98742e-06
9.24801e-07
2.38437e-05
2.97124e-05
4.72475e-06
8.44721e-06
1.4801e-05
5.20877e-06
1.50803e-06
1.44969e-06
0.000224456
2.3709e-06
1.21941e-05
1.14779e-05
3.70952e-06
2.15482e-06
2.71453e-05
1.23922e-06
2.16142e-06
9.20041e-07
1.7441e-06
4.83299e-07
3.88111e-07
1.52806e-06
3.16877e-07
1.4219e-06
2.3348e-06
3.9753e-07
3.97063e-06
4.89665e-06
1.97001e-06
9.08396e-07
6.30865e-06
1.49949e-05
9.17949e-06
9.09999e-06
1.10217e-05
3.86383e-06
1.4968e-06
1.35245e-06
0.000192128
0.000829578
1.08181e-05
1.13488e-05
1.01082e-05
1.34263e-06
3.74451e-05
2.98145e-06
1.59294e-06
1.07241e-06
1.47827e-06
4.19753e-07
5.87687e-07
2.44516e-06
3.58789e-07
1.77583e-06
1.46178e-06
5.85542e-07
4.19339e-06
3.32154e-06
1.30283e-06
9.08416e-07
3.11382e-06
1.13149e-05
1.33312e-05
1.12049e-05
6.92697e-06
2.90418e-06
1.57289e-06
1.26511e-06
0.000167234
0.00262287
0.00111917
0.000164515
5.22544e-06
5.57494e-06
1.87054e-05
1.60636e-05
2.98299e-06
1.19577e-06
1.5948e-06
5.19016e-07
1.03719e-06
2.12446e-06
3.62899e-07
1.88208e-06
1.25838e-06
9.18783e-07
3.99657e-06
2.38932e-06
9.16957e-07
8.54095e-07
2.5447e-06
7.64003e-06
1.06362e-05
8.1626e-06
5.355e-06
2.91731e-06
1.72541e-06
1.26154e-06
0.000151732
0.000584445
0.00453696
0.00088366
0.000142698
5.12059e-06
2.8911e-05
7.57103e-05
1.12534e-05
1.16153e-06
1.81824e-06
8.32128e-07
4.28538e-07
2.92729e-06
3.95341e-07
2.40177e-06
1.12729e-06
1.37917e-06
3.82094e-06
1.74563e-06
6.33354e-07
9.46467e-07
3.09983e-06
4.56235e-06
4.73259e-06
6.05994e-06
5.21838e-06
2.90848e-06
1.80391e-06
1.42117e-06
0.000141541
0.000160754
6.97491e-06
0.00102649
0.000794826
8.55919e-05
8.28693e-05
0.00010902
2.60859e-05
1.53216e-06
1.82383e-06
7.34861e-07
1.56072e-06
1.80633e-06
4.6694e-07
2.9701e-06
1.30118e-06
1.97507e-06
3.88986e-06
1.38244e-06
4.64295e-07
1.31823e-06
3.11344e-06
3.57293e-06
3.50188e-06
4.15757e-06
4.35298e-06
2.79743e-06
1.87518e-06
1.65284e-06
0.000132273
0.000125191
1.73556e-06
2.94269e-07
0.000568872
0.000664647
5.10468e-05
2.70636e-05
4.71133e-05
2.43902e-06
2.44759e-06
1.67818e-06
1.04026e-06
1.35016e-06
6.57146e-07
3.08117e-06
1.33332e-06
2.50242e-06
4.38995e-06
1.17147e-06
3.97068e-07
1.76245e-06
3.72377e-06
4.23013e-06
3.58313e-06
3.05422e-06
3.19585e-06
2.66844e-06
2.17361e-06
1.84369e-06
0.000120801
9.62049e-05
2.51421e-06
1.04906e-06
1.78419e-06
0.000284788
0.000261327
2.24336e-05
3.92228e-05
5.50406e-06
2.05062e-06
2.55149e-06
5.56915e-07
1.00007e-06
5.70022e-07
2.36518e-06
1.60073e-06
3.03242e-06
5.05905e-06
1.03422e-06
3.73651e-07
2.04036e-06
4.40521e-06
4.94574e-06
4.22938e-06
3.29198e-06
2.7727e-06
2.39177e-06
2.55283e-06
1.89619e-06
0.000107438
9.11457e-05
3.32892e-06
9.4265e-07
1.04669e-06
2.78421e-05
0.000166332
5.75236e-05
3.52508e-05
1.01713e-05
2.09647e-06
1.99518e-06
1.15352e-06
1.37263e-06
5.39033e-07
2.6068e-06
1.49039e-06
3.9171e-06
5.45615e-06
9.44897e-07
3.79333e-07
1.85377e-06
5.59515e-06
5.93217e-06
4.89875e-06
4.09766e-06
3.18396e-06
2.53401e-06
2.86026e-06
1.72803e-06
9.37473e-05
8.12753e-05
2.06931e-06
9.34467e-07
1.19703e-06
1.57043e-05
9.84196e-05
6.2287e-05
2.8594e-05
3.43211e-05
1.97544e-06
3.50596e-06
1.36213e-06
1.53626e-06
6.87265e-07
2.47696e-06
1.63435e-06
4.8181e-06
5.29537e-06
8.81708e-07
4.69826e-07
1.79332e-06
5.63645e-06
6.74464e-06
5.37217e-06
4.13529e-06
3.31988e-06
2.77355e-06
3.1445e-06
1.61783e-06
8.01401e-05
6.29577e-05
1.23421e-06
1.13616e-06
1.6465e-06
1.08008e-05
6.11512e-05
4.89525e-05
1.89988e-05
6.22111e-05
9.26537e-07
4.39548e-06
1.1737e-06
1.565e-06
4.91118e-07
2.90001e-06
1.70834e-06
5.494e-06
4.92947e-06
8.95943e-07
8.72962e-07
3.41145e-06
6.12176e-06
5.19159e-06
4.06617e-06
3.30793e-06
2.86952e-06
2.64849e-06
3.20502e-06
1.9444e-06
6.37913e-05
5.35342e-05
1.18722e-06
1.46083e-06
2.31211e-06
9.11619e-06
4.2379e-05
3.17624e-05
9.39584e-06
3.31361e-05
5.87684e-06
1.84477e-06
2.20035e-06
2.20525e-06
7.786e-07
2.81331e-06
1.96007e-06
5.92687e-06
4.65819e-06
1.24125e-06
3.29615e-06
5.5243e-06
3.8792e-06
2.89837e-06
2.71298e-06
2.68735e-06
2.69605e-06
2.82712e-06
3.62066e-06
3.22104e-06
4.21693e-05
4.09767e-05
1.2243e-06
1.77329e-06
3.31468e-06
1.46623e-05
4.05145e-05
1.72425e-05
2.6985e-06
1.96168e-05
1.12835e-05
1.13754e-06
2.99418e-06
2.00998e-06
1.25978e-06
3.06724e-06
2.27082e-06
7.58165e-06
5.66022e-06
3.42096e-06
5.33581e-06
2.5303e-06
1.2351e-06
9.20496e-07
8.47426e-07
9.96704e-07
1.54404e-06
2.38885e-06
3.84612e-06
4.61299e-06
2.01219e-05
3.11711e-05
1.35444e-06
2.31759e-06
5.57987e-06
2.32796e-05
3.12025e-05
9.2947e-06
2.39561e-06
1.31601e-05
1.80678e-05
2.20173e-06
2.82862e-06
1.59246e-06
1.24549e-06
2.57118e-06
2.72961e-06
1.42942e-05
6.97069e-06
3.9149e-06
2.52955e-06
1.95954e-06
1.54034e-06
1.19315e-06
1.04509e-06
8.72506e-07
8.6436e-07
1.10164e-06
2.12655e-06
3.44312e-06
5.4264e-06
2.12077e-05
1.66446e-06
3.60657e-06
7.19015e-06
9.10237e-06
9.59761e-06
9.51164e-06
4.9189e-06
1.46614e-05
4.54628e-05
2.45426e-06
3.05084e-06
1.9465e-06
1.03137e-06
2.32475e-06
2.57574e-06
2.48308e-05
8.67598e-06
1.22279e-06
1.23248e-06
2.08368e-06
2.68917e-06
2.62439e-06
2.01443e-06
1.44469e-06
1.11664e-06
1.00911e-06
1.17293e-06
1.7347e-06
3.39235e-06
1.32574e-05
3.08872e-06
3.45757e-06
1.61346e-06
1.77959e-06
4.26997e-06
7.68371e-06
3.20241e-06
1.00791e-05
8.80734e-05
3.2229e-06
3.3477e-06
2.67535e-06
1.39563e-06
2.89829e-06
2.61482e-06
3.71796e-05
7.69595e-06
4.18183e-07
5.35944e-07
1.22437e-06
2.36137e-06
3.68513e-06
4.08118e-06
3.00037e-06
1.81274e-06
1.16123e-06
9.34788e-07
1.30648e-06
2.38698e-06
6.06507e-06
3.17673e-06
1.31968e-06
7.48981e-07
2.1062e-06
4.09599e-06
4.35989e-06
2.22363e-06
2.60144e-06
4.14803e-05
9.56508e-06
1.38017e-06
1.63666e-06
1.71444e-06
3.84571e-06
5.13264e-06
4.99042e-05
7.70328e-06
6.13398e-07
5.77417e-07
6.87811e-07
1.00207e-06
1.78376e-06
2.72719e-06
3.57774e-06
2.934e-06
1.63155e-06
1.04188e-06
1.2266e-06
2.33829e-06
3.35436e-06
2.53318e-06
1.13924e-06
1.02667e-06
2.64769e-06
3.62752e-06
2.82649e-06
2.72514e-06
1.74183e-06
2.69957e-05
6.8058e-06
1.3749e-06
7.55793e-07
1.33249e-06
3.91317e-06
8.78347e-06
5.23305e-05
9.09071e-06
1.21138e-06
7.91928e-07
5.67438e-07
5.008e-07
6.41071e-07
1.06524e-06
1.81564e-06
2.40873e-06
1.97603e-06
1.23228e-06
1.14284e-06
2.24003e-06
3.32512e-06
1.8104e-06
8.8506e-07
1.12311e-06
2.65453e-06
4.02436e-06
5.35847e-06
1.05563e-05
3.73812e-06
1.59915e-05
1.25585e-05
2.6781e-06
2.41414e-06
9.04626e-07
4.31236e-06
1.07004e-05
3.14837e-05
1.52523e-05
3.69673e-06
1.68108e-06
9.70047e-07
6.44366e-07
5.66837e-07
7.63498e-07
8.15743e-07
1.14213e-06
1.31887e-06
1.01434e-06
8.85768e-07
1.77903e-06
4.70493e-06
1.37318e-06
5.09671e-07
9.01745e-07
3.06861e-06
7.85295e-06
1.84343e-05
1.97303e-05
4.64342e-06
8.08723e-06
1.27089e-05
3.17342e-06
4.81945e-06
1.8042e-06
4.11319e-06
9.4394e-06
1.11652e-05
1.52471e-05
1.6589e-05
6.08628e-06
3.55952e-06
2.1949e-06
1.25597e-06
7.78231e-07
7.30162e-07
6.90815e-07
6.68515e-07
5.78647e-07
5.32612e-07
1.15049e-06
7.82576e-06
9.67332e-07
3.71501e-07
1.16831e-06
4.12236e-06
1.53525e-05
3.80597e-05
2.33565e-05
5.26525e-06
6.92954e-06
9.02772e-06
3.35858e-06
1.76532e-06
3.19391e-06
5.1589e-06
6.13073e-06
8.06431e-06
6.4109e-06
2.03899e-05
2.08392e-05
1.54164e-05
9.61665e-06
4.33227e-06
1.74699e-06
8.73038e-07
5.56776e-07
3.81485e-07
2.60113e-07
2.29579e-07
6.24304e-07
3.0424e-06
1.02461e-07
4.82138e-07
1.75074e-06
5.55059e-06
1.55773e-05
3.4869e-05
2.13194e-05
4.80816e-06
5.08265e-06
1.11171e-05
6.21596e-06
6.98907e-07
2.5516e-06
5.93526e-06
5.83485e-06
1.32492e-05
7.23196e-06
1.36257e-05
2.85051e-05
2.85731e-05
1.74904e-05
7.8968e-06
3.04152e-06
1.14635e-06
4.91179e-07
2.5792e-07
1.58591e-07
1.22399e-07
3.04844e-07
2.10076e-07
2.51408e-07
6.57707e-07
1.85225e-06
3.51666e-06
4.66575e-06
6.13558e-06
9.22169e-06
6.03545e-06
3.17883e-06
1.30869e-05
8.43298e-06
2.13349e-06
2.56882e-06
5.75173e-06
1.1981e-05
2.88402e-05
9.28102e-06
1.88353e-05
3.3463e-05
2.4224e-05
1.24699e-05
5.87713e-06
2.65657e-06
1.08606e-06
4.61321e-07
2.57701e-07
1.71565e-07
1.13099e-07
1.28123e-07
4.08586e-07
2.40185e-06
5.37324e-06
4.04096e-06
3.667e-06
3.9531e-06
3.48055e-06
1.04797e-05
4.30269e-06
2.38637e-06
8.03363e-06
7.93004e-06
2.0975e-06
3.53488e-06
5.2242e-06
3.5408e-05
2.32045e-05
8.01071e-06
2.06643e-05
2.00425e-05
8.95114e-06
4.29391e-06
2.36871e-06
1.51507e-06
9.62487e-07
5.7144e-07
3.71382e-07
2.60886e-07
1.47029e-07
4.33875e-08
9.57532e-06
7.05861e-06
1.27019e-05
1.0864e-05
9.40075e-06
6.81939e-06
5.71941e-06
1.30741e-05
0.000165955
4.78639e-06
6.54041e-06
8.15193e-06
2.83314e-06
4.16627e-06
4.15691e-06
2.4695e-05
9.50916e-06
5.41943e-06
9.03822e-06
6.83956e-06
3.23796e-06
1.69216e-06
1.25759e-06
1.40958e-06
1.80189e-06
2.26684e-06
1.32527e-06
5.91723e-07
2.10584e-07
2.2131e-08
1.12114e-05
9.05899e-06
1.17401e-05
1.44237e-05
1.85456e-05
1.2963e-05
3.18239e-06
1.0514e-06
2.77266e-05
0.000172653
1.45247e-06
7.43553e-06
8.07271e-06
1.17147e-05
3.88732e-06
9.75442e-06
5.73544e-06
2.87925e-06
1.32318e-06
2.24866e-06
2.89103e-06
2.24468e-06
2.41522e-06
3.587e-06
6.63152e-06
8.89864e-06
6.54244e-06
1.9535e-06
2.79776e-07
6.12544e-08
7.8289e-06
8.07196e-06
1.01418e-05
1.42233e-05
2.80615e-06
1.21999e-06
8.26334e-07
6.07712e-07
1.9374e-06
0.000125361
2.91603e-05
6.12784e-06
1.65586e-05
2.88746e-05
5.06373e-06
6.9259e-06
1.08254e-05
2.67832e-06
8.29361e-07
4.87884e-07
4.43781e-06
1.26388e-05
1.08043e-05
1.14567e-05
1.3162e-05
9.59366e-06
5.13312e-06
2.23753e-06
6.5173e-07
2.75247e-07
8.28049e-06
7.91087e-06
2.15546e-06
2.68226e-06
3.97228e-06
3.04207e-06
9.96293e-07
1.34464e-06
3.96079e-06
3.64059e-05
3.27033e-05
4.8112e-06
2.18671e-05
3.37412e-05
7.67501e-06
7.64352e-06
2.55314e-05
4.68584e-06
1.96851e-06
2.84204e-06
1.83798e-05
2.81234e-05
1.29989e-05
1.05215e-05
8.69559e-06
5.60112e-06
3.93167e-06
2.44253e-06
7.91041e-07
4.58979e-07
9.48077e-06
2.3481e-06
4.29599e-06
4.08675e-06
3.69222e-06
1.44917e-06
2.95794e-06
7.43305e-06
1.00202e-05
1.85734e-05
6.29324e-06
8.65714e-06
2.38643e-05
2.03157e-05
1.43677e-05
1.16736e-05
3.70611e-05
9.11488e-06
4.7301e-06
9.04718e-06
1.93227e-05
1.4714e-05
6.76395e-06
4.65666e-06
3.33379e-06
2.33633e-06
1.87006e-06
1.5758e-06
8.45726e-07
3.35546e-07
6.28108e-06
5.3856e-06
4.09878e-06
3.45519e-06
1.27864e-06
3.23516e-06
1.19285e-05
2.00133e-05
6.44753e-06
2.99728e-07
3.79546e-06
1.28762e-05
1.61062e-05
7.29611e-06
2.17968e-05
3.23464e-05
3.67326e-05
1.73046e-05
5.77705e-06
4.99751e-06
7.02238e-06
6.76496e-06
4.58406e-06
3.71736e-06
3.06709e-06
2.44778e-06
2.9918e-06
2.96439e-06
2.71886e-06
2.05982e-06
4.70641e-06
5.5526e-06
3.28669e-06
1.36629e-06
2.23054e-06
7.78423e-06
1.99493e-05
1.06015e-05
3.77193e-07
1.19054e-06
5.27845e-06
9.35866e-06
6.86329e-06
2.84057e-06
2.21595e-05
0.000123163
7.29686e-05
2.26932e-05
4.57036e-06
2.59444e-06
2.4743e-06
2.61179e-06
2.80621e-06
2.7423e-06
2.73466e-06
3.00008e-06
2.67478e-06
4.38766e-06
7.36442e-06
1.13019e-05
8.31617e-06
4.89817e-06
2.02757e-06
1.13001e-06
5.51939e-06
7.08047e-06
8.3764e-06
2.03382e-06
2.91837e-06
3.72482e-06
4.28637e-06
4.72091e-06
2.74107e-06
3.79702e-06
2.91045e-05
0.000125237
6.0939e-05
2.04675e-05
2.40001e-06
9.33799e-07
6.71167e-07
5.06538e-07
6.66376e-07
9.60051e-07
1.6929e-06
4.25019e-06
8.36373e-06
5.52261e-06
6.62122e-06
1.52487e-05
1.81693e-05
4.47728e-06
5.90488e-07
7.86817e-06
8.27643e-06
2.65866e-06
3.82875e-06
1.15568e-05
7.88435e-06
5.46211e-06
3.03267e-06
2.4238e-06
1.82255e-06
3.74481e-06
2.75082e-05
1.88998e-05
4.09517e-06
7.08733e-06
2.20412e-06
3.6618e-07
2.92045e-07
1.20525e-07
3.9789e-08
2.54902e-08
2.40413e-07
1.87147e-06
1.17718e-05
4.07316e-05
0.000674002
0.00199067
1.89359e-05
3.68794e-06
5.92069e-06
1.711e-05
6.04461e-06
1.07717e-07
5.45035e-06
3.48073e-05
1.21562e-05
5.85388e-06
2.28222e-06
1.75841e-06
1.83233e-06
2.25715e-06
1.10334e-05
2.95452e-06
1.27839e-06
2.24401e-07
1.30578e-06
3.46636e-07
4.68378e-07
8.20092e-07
1.44014e-06
8.22552e-07
5.76152e-07
1.23786e-06
2.38338e-05
0.00129712
0.00221206
0.00166953
0.00220378
0.00128064
0.000359694
1.02745e-05
6.01958e-07
2.29965e-07
1.58577e-05
7.85797e-05
2.08148e-05
5.82249e-06
2.41613e-06
1.94657e-06
2.07077e-06
1.93975e-06
3.18948e-06
1.14618e-06
2.26394e-07
1.30321e-05
2.26189e-05
2.47763e-06
9.5877e-07
1.76351e-06
3.60302e-06
2.81313e-06
2.55575e-06
4.89808e-05
0.00125975
0.0018014
7.1185e-05
0.00042574
0.00113189
0.00146303
0.00196504
0.00130752
0.00059556
0.000428414
0.000529032
0.000325974
2.6172e-05
8.69292e-06
3.05177e-06
2.45646e-06
3.42243e-06
3.41187e-06
5.10364e-06
2.8589e-05
0.000465508
0.00083775
0.000504377
0.000194864
5.74653e-06
3.26663e-06
5.89909e-06
3.76392e-06
2.26458e-05
0.00120694
0.00145507
5.65713e-05
1.1877e-05
0.000416458
0.000182467
5.61499e-06
0.000155463
0.0011391
0.00139362
0.00121805
0.0010707
0.00101224
0.00024393
1.36491e-05
3.21038e-06
3.83637e-06
1.00425e-05
1.81133e-05
8.48512e-05
0.0006892
0.00178764
0.00167137
0.000746039
0.000579492
0.000337255
7.17938e-05
6.87354e-06
1.32877e-05
0.00147048
0.00187475
4.07722e-05
1.43748e-05
1.75261e-05
0.000586445
0.000138329
5.83112e-06
1.43483e-06
5.58623e-06
0.000192544
0.000327509
0.000216833
0.000574021
0.00171105
0.000147312
1.26688e-05
2.37901e-05
0.000102808
0.00021532
0.000904414
0.00159356
0.00265166
0.00188299
4.65652e-05
8.38161e-07
0.00012865
2.89439e-05
0.000260977
0.00251973
0.00384951
0.000531441
0.00013724
0.000254523
0.000204981
0.00124119
0.00015672
1.81753e-05
1.02243e-05
8.15935e-06
7.01509e-05
8.85716e-05
0.000102654
0.000150347
0.00197015
0.00237963
0.000564937
0.000232749
6.24033e-05
0.0014747
0.0022022
0.00431304
0.00955555
0.0221151
0.0312587
0.000509461
6.32921e-05
0.000291691
0.0010136
0.00896377
0.00326356
0.00149547
0.000982602
0.00093967
0.000467908
0.00770803
0.000347411
0.000156641
0.000150822
0.000193322
0.00027203
0.000210368
0.00013685
0.000230501
0.000243106
0.00293272
0.00344322
0.00261049
0.00340674
0.0273298
0.0230083
0.0249015
0.0260416
0.0630797
0.0892107
0.152164
0.00203577
0.000307166
0.000439882
3.23527e-05
0.00128372
0.00297256
0.00189016
0.00150066
6.16888e-06
0.000270211
0.00106744
0.000217646
0.000157483
0.000182773
9.79398e-05
4.89386e-05
3.1214e-06
5.18068e-06
8.04308e-05
0.00977811
0.0894377
0.144595
0.255923
0.363081
0.0947636
0.043474
0.0210338
0.0146418
0.0181963
0.0220743
0.032307
0.00122021
0.000826207
0.000304243
3.96885e-05
6.12078e-07
1.99197e-07
1.1491e-05
2.25672e-05
1.92163e-05
0.00424217
4.30077e-06
2.29112e-06
3.79086e-07
1.00448e-06
9.9761e-07
1.27075e-06
0.000142139
0.014321
0.102004
0.23774
0.371806
0.540872
0.253843
0.10674
0.0169356
2.01661e-06
8.11697e-06
4.28709e-05
0.000505543
0.00804545
0.181587
0.00286819
0.000994209
0.000454975
8.64e-05
5.20467e-06
7.51519e-06
0.0147512
0.041411
0.000123301
3.90279e-06
2.41587e-06
2.4418e-06
6.75658e-06
3.99069e-06
0.00324692
0.0352427
0.167581
0.185945
0.0869996
0.0406373
0.0377282
0.0175196
0.0173892
0.000103248
2.96248e-06
2.76734e-05
2.71175e-05
0.000131899
0.0089034
1.54325
1.7708
3.56319
0.00575613
0.000573597
1.70033e-05
3.39031e-06
0.0431196
0.019357
0.00104197
1.96358e-06
1.70003e-07
0.000733396
0.0184106
0.0745588
0.15299
0.144375
0.105458
0.156201
0.0191813
0.00140297
0.000707623
3.5875e-05
2.01589e-06
5.49071e-06
1.85523e-05
2.2143e-05
0.219751
0.000143803
0.0172286
4.96367
4.41418
5.34968
5.87652
0.0162765
0.000363362
2.87888e-05
9.04813e-06
0.00534814
0.0280873
0.000610364
0.0447738
0.0859681
0.0607476
0.0773813
0.13177
0.113644
0.0197499
0.000571776
0.000127299
4.05676e-08
2.23573e-05
2.207e-05
4.53852e-06
1.53213e-05
5.37265e-05
0.866926
0.0518697
0.000261611
3.08812
9.60255
6.80657
5.78708
2.75091
0.502707
0.0133642
0.0142226
0.0003418
3.14514e-05
0.0395641
0.016538
0.0343755
0.0557418
0.0585478
0.0670339
0.0804787
0.0044192
0.000229522
0.000138008
1.97095e-05
2.62874e-07
1.10281e-05
4.119e-05
9.082e-06
1.76236e-05
0.767793
1.82031
0.00278492
0.00125692
7.28528
4.20667
1.84803
0.395809
0.18942
0.164974
0.0565915
0.0100398
0.15412
0.0462212
0.00841644
0.00697414
0.0190584
0.0601481
0.0620406
0.0394022
0.020283
0.000201727
0.000348142
0.000158182
6.75206e-05
3.52002e-06
1.58148e-06
0.000116199
9.69948e-06
1.26353e-06
0.847261
1.38071
0.000102952
0.311554
5.79668
0.737716
0.0436882
0.103829
0.13395
0.231519
0.188644
0.0363382
0.0525795
0.158878
0.042207
0.00197607
1.72717e-05
0.000187707
0.0433194
0.0420467
0.000460362
0.00124701
0.00154798
0.000186732
0.000175021
1.95963e-05
5.06007e-07
0.000119478
0.000503827
2.13996e-06
4.31179e-09
1.35203e-05
4.17124e-05
1.56764
0.91661
0.0354124
0.0030094
0.065128
0.196193
0.263155
0.287289
0.217435
0.0327764
0.0542143
0.00011238
0.294589
0.0457738
8.33292e-06
2.85108e-06
0.0124742
0.000777575
0.0616074
6.58129
3.78505
0.000158448
0.000141128
5.31427e-06
5.8565e-05
0.00229014
0.00122005
1.4869e-06
6.81722e-06
0.047739
0.140522
0.0963417
0.00878261
0.0131686
0.097799
0.180569
0.263039
0.224686
0.25392
0.120998
0.00219388
0.000106152
9.91426e-06
0.127732
0.0722289
2.37844e-05
0.000398367
0.00344924
8.19389
4.96188
3.23529
0.463108
7.9102e-05
6.77118e-05
1.12959e-05
0.00547168
0.0038231
0.00141464
5.387e-05
0.0285303
0.035882
0.0537442
0.166846
0.323869
0.0755806
0.134013
0.176764
0.108511
0.193616
0.00384534
1.16321e-05
0.105559
1.11055e-05
6.18935e-06
4.67413e-07
0.000232515
0.000595125
16.3911
10.5113
8.39801
4.47087
0.836159
7.07351e-05
0.00010615
8.549e-07
0.00870275
0.00948566
0.0124594
0.00985188
0.00164645
0.00449938
0.0364302
0.23168
0.317146
0.211228
0.129974
0.123516
0.0474435
0.167403
3.26569e-05
2.87671e-05
0.000328597
0.164715
1.03338e-06
4.8577e-05
0.000204606
23.8058
16.0557
12.8011
8.44335
6.86835
6.03688
0.000344158
0.000116181
1.30026e-07
0.00449782
0.0212408
0.0225285
0.0206419
0.0206619
0.0196999
0.0130323
0.0257815
0.286112
0.652296
0.263342
0.159455
0.229678
0.168996
0.000129552
0.00388007
6.38209e-05
0.000177514
4.43441e-05
5.66035e-05
20.1271
19.9502
15.3706
10.162
6.33917
3.49571
1.63295
0.0126018
7.69789e-05
2.42339e-06
0.000367458
0.022599
0.0360551
0.0346105
0.0355767
0.0266309
0.0164413
0.0147354
0.104511
0.36468
0.463142
0.409145
0.416919
0.0533906
0.00036011
0.00741658
7.08312e-05
7.15236e-07
1.26985e-05
11.3184
18.0804
14.0944
9.83947
7.14159
5.5875
2.16697
0.143986
3.21908e-05
5.97604e-05
1.84814e-05
6.84155e-07
0.00505331
0.0221039
0.0306863
0.024758
0.0143923
0.0126761
0.000196281
0.034843
0.142762
0.172821
0.142818
0.0270034
0.00192683
0.0140156
0.0143467
2.03923e-05
1.23375e-08
3.74957
11.6772
10.4977
7.03903
4.72646
4.32543
4.64595
1.9056
8.01777e-06
1.35473e-05
2.91757e-05
0.000183505
4.63715e-05
2.65997e-07
0.00296629
0.0070583
0.00481717
0.000306213
5.64243e-05
1.94341e-05
0.00224803
0.0601584
0.0194097
0.00114495
0.00286172
0.0445937
0.0130835
0.0396067
5.09431e-05
1.29135
3.16218
2.61064
2.78283
1.19252
1.38542
4.23913
2.55255
0.0471034
2.93266e-05
2.72281e-05
1.48107e-06
0.000163769
0.00045338
7.57032e-05
6.72809e-07
4.02688e-05
4.39031e-06
1.09995e-05
6.07812e-05
1.01892e-05
4.28822e-05
0.0146146
0.000411741
0.000833002
0.00269476
0.0133577
0.0152344
0.0683722
7.58757e-05
0.240459
0.00455758
0.160286
0.129273
0.368451
3.14243
2.98989
0.202895
4.85992e-05
2.4332e-05
3.94386e-05
4.34868
5.99565
0.000235509
0.000519074
0.000121946
9.71132e-06
2.8785e-05
0.000185787
3.66272e-05
5.44382e-05
1.81807e-06
1.86588e-06
3.24638e-06
6.14797e-05
0.00408575
0.0160051
0.0158789
0.0677343
0.000142134
2.22094e-07
4.43754e-05
0.133828
0.347088
2.10275
2.45388
0.628954
0.0154276
1.47803e-05
5.75414e-05
7.32752e-05
19.8024
15.4845
9.78015
0.000235447
0.000329558
0.000152049
0.000158703
7.42254e-05
18.3123
4.50731e-06
2.28553e-06
2.49861e-05
1.28803e-05
5.10489e-07
2.31734e-05
0.00395346
0.00933667
0.0408531
5.67674e-05
1.34402e-06
2.1431e-05
0.640655
1.30892
1.48201
0.777596
0.263229
0.0288692
9.84225e-06
2.47837e-05
5.12357e-05
76.11
78.5047
40.7688
50.6008
0.000120344
0.000194338
0.000105965
100
65.6422
0.000195056
1.74833e-06
1.4886e-05
2.3634e-05
3.78091e-07
1.84793e-07
5.55086e-08
3.52841e-05
0.022164
2.09608e-06
1.12006e-06
1.3751
1.35687
1.05858
0.605538
0.425447
0.154578
2.96184e-06
1.113e-05
1.1435e-05
7.77082e-06
55.0138
61.0525
100
100
100
100
100
100
56.1033
7.36095e-06
3.64398e-06
3.11565e-05
6.55716e-05
1.08006e-05
1.45249e-06
9.87343e-06
5.55421e-05
0.00259761
2.7657e-06
0.115413
1.2415
0.977673
0.554713
0.390484
0.266454
6.18486e-06
6.50545e-06
1.6717e-05
8.9552e-06
5.34868e-06
1.6324e-05
84.4111
57.7583
100
100
100
100
83.1212
2.37451e-06
8.43114e-06
5.6892e-06
0.00394193
5.39381e-05
3.2547e-05
3.71174e-05
0.000101687
9.74421e-05
5.48068e-05
5.19383e-05
1.4987e-07
0.145561
0.523073
0.351574
0.401788
1.50494e-05
7.14851e-06
1.87838e-05
1.13421e-05
3.09784e-06
1.75728e-06
3.98883e-05
7.61839e-05
98.5923
64.2699
100
100
100
66.3313
4.40721e-06
1.42709e-05
5.83931e-05
0.252858
1.71241
9.30071e-05
2.85213e-05
1.07683e-05
0.0674243
8.48975e-05
1.63384e-06
1.0881e-05
0.818365
0.412821
0.218981
8.46462e-06
6.90098e-06
1.29874e-05
8.17271e-06
6.05129e-06
3.90693e-06
7.27168e-06
0.000288528
0.000119432
3.82167e-05
100
100
100
100
100
7.99525e-05
4.757e-06
4.20534e-05
0.000107335
1.07471
4.28705
1.78634
3.0031e-06
8.58261e-05
0.0571577
9.50087e-07
0.529588
0.783129
0.000219302
3.48092e-06
4.47449e-06
6.29058e-06
1.65069e-05
5.84343e-06
4.61028e-07
1.47244e-06
1.01717e-05
4.29505e-05
2.44649
0.000127431
0.000117213
100
92.2097
100
100
0.329428
2.68116e-05
1.10715e-06
3.10385e-05
2.91665e-05
1.70513
0.0320959
0.131747
4.21528e-05
0.000206089
5.59527e-06
0.227837
1.91123e-06
1.67749e-06
2.8119e-05
1.72606e-06
1.51485e-05
1.10485e-05
1.61597e-06
8.59609e-06
4.5861e-05
1.18812e-05
5.16426e-05
4.84059e-05
16.9605
0.000268874
0.000251907
62.0815
43.2392
16.6068
1.47332e-05
5.37572e-05
0.0273708
0.00843787
1.241e-05
1.09254e-05
0.136418
0.136894
0.323888
8.97974e-05
7.85352e-05
8.71077e-07
1.48671e-06
1.9717e-08
8.81267e-07
3.44908e-05
2.90576e-05
2.88928e-06
4.99467e-06
1.33223e-05
0.602017
0.770679
1.37659
9.07218e-05
7.55525e-05
71.6774
0.000143879
0.000206715
9.4852e-05
5.81243e-05
2.01268e-05
4.69865e-07
0.0350913
0.145134
2.6508e-05
8.40679e-06
1.008e-05
3.61302e-05
0.644616
0.387564
6.54246e-06
9.31545e-07
2.52251e-08
7.50128e-07
3.76318e-05
3.54706e-05
1.76026
15.4882
1.8288
0.99804
0.680525
1.33633
0.685601
11.9091
0.000106886
7.11007e-05
100
0.000163607
0.000186727
3.57192e-05
1.29208e-06
1.84453e-06
3.91433e-06
0.0833542
0.118753
1.683e-05
9.88524e-06
1.23042e-05
8.57156e-05
2.07406
2.99145e-06
5.84746e-08
7.32726e-07
3.65558e-05
3.47732e-05
7.30113
8.74557
5.63068
1.81112
1.54199
1.46949
1.80817
1.41479
0.690594
42.0636
0.000116051
9.43615e-05
21.5038
3.65254e-05
1.59895e-05
3.57273e-07
7.75309e-06
1.05015e-05
0.00062175
0.00230864
0.0487576
1.28348e-05
2.40477
3.55559e-05
0.000259555
8.11695e-06
3.66718e-07
2.79894e-05
3.56619e-05
15.6307
11.2597
11.2816
8.2964
3.88967
2.96269
3.43707
5.34982
7.04796
2.6911
0.992318
39.3488
0.000107307
1.98584e-05
4.56611e-06
7.09488e-06
1.08275e-06
2.26253e-05
4.15663e-05
7.30869e-05
1.772e-05
4.67704e-06
6.31735e-08
3.38829
10.7859
0.000165166
1.01514e-06
1.78871e-05
3.44105e-05
43.2501
25.7707
20.2816
20.5566
17.7798
9.62972
8.62129
10.1579
16.9233
21.9994
12.782
4.53715
2.19685
7.93954
1.35491e-05
4.46303e-06
7.37826e-06
1.29262e-06
1.41946e-05
8.39472e-06
0.718364
6.16782e-05
6.7159e-06
5.4782e-06
7.10954
13.872
1.55735
6.31695e-06
1.40317e-05
70.4335
85.4851
50.8361
36.0875
39.1898
42.3908
33.8346
29.1918
28.5373
30.9853
32.5497
25.9595
11.9675
6.36584
3.08451
2.14944
9.62645e-06
4.85627e-06
4.58663
9.83032e-06
1.68198e-05
4.56714e-06
2.60637
8.60377e-05
3.38757e-05
21.442
18.2905
72.9777
2.27133e-05
49.1009
98.8913
100
100
93.4324
98.2031
100
100
66.2505
45.9782
39.0985
38.4511
36.655
20.9839
10.2571
10.0069
8.37089e-05
1.76643e-05
10.6956
1.10502
75.9446
1.15908e-05
2.59075e-05
3.19053
9.06184e-05
0.000254673
48.4992
99.3211
100
0.0179718
62.1953
100
100
100
100
100
100
100
93.1275
57.1411
44.9501
43.1698
42.5658
31.3072
22.1393
0.00138871
0.000104787
22.0078
5.13509
0.832063
45.1029
78.1357
1.8332e-05
3.87336e-05
7.75447
0.000208886
0.000359366
100
100
2.10912
52.1642
100
100
100
100
100
100
100
93.921
63.8885
50.5256
47.8387
44.1742
37.3165
18.4574
4.6703
27.5306
89.1617
16.1218
0.000418272
14.7585
41.9369
33.6619
4.13792e-05
7.48231e-05
22.5117
0.000404018
0.00244829
100
5.82627
48.082
91.621
100
100
100
99.5343
96.3964
96.5533
82.7922
62.9471
54.4847
52.8442
50.9977
45.4973
40.7596
29.4211
59.142
100
2.21518
0.000325198
49.6788
39.8384
89.3986
0.000103702
9.1592e-05
16.505
33.1894
0.000135106
4.8206
15.7832
42.4644
56.4927
61.7336
65.9362
69.9586
74.3614
79.589
80.1694
70.5679
58.7634
57.5802
60.9456
65.1902
71.2264
73.6644
54.9045
100
100
0.00143713
0.000183357
100
82.3838
100
0.000130225
1.98783e-05
23.8404
26.7043
24.0429
6.17113e-05
20.6211
33.3147
41.3524
46.3957
52.1699
57.9043
63.5766
68.11
63.3182
55.2701
60.7336
66.0877
80.3969
97.8641
100
88.0811
68.2058
100
100
0.000384786
0.000228913
100
100
100
49.076
1.86621e-05
4.43836e-05
37.6003
25.6639
32.1253
21.0648
27.221
36.66
42.7905
48.2251
54.4492
59.3498
58.4854
44.9826
37.4255
65.1926
100
100
100
100
92.1705
68.0794
88.5036
87.975
6.29716e-05
0.00050358
100
100
79.1975
52.1009
4.37671e-05
1.81367e-05
29.9101
33.2593
33.5429
22.5546
29.0391
41.8242
50.1332
56.5704
63.2728
62.451
48.4286
22.4962
28.0606
100
100
100
100
100
95.5756
64.1734
76.9002
96.5686
0.00012163
0.000169133
100
80.3145
58.2238
45.6707
27.5207
1.17619e-05
1.12338e-05
34.5764
49.6047
33.252
42.185
50.4564
60.7305
70.7002
77.3678
63.7305
24.952
4.45929
38.062
100
100
100
99.3621
100
100
92.0966
100
0.000290006
9.34537e-05
79.7633
100
46.6631
39.1902
30.9685
21.2687
20.0926
1.0148e-05
5.57471e-06
45.2213
63.7563
63.6786
60.3003
71.3526
87.6959
86.2704
60.7772
12.2538
3.18536
59.1538
100
65.4367
76.9081
83.4938
100
100
100
100
0.0024202
3.30501e-05
70.1719
100
30.8388
27.5552
23.0227
15.6145
17.0485
5.06272
4.63105e-06
0.105333
100
88.3533
71.0729
85.7453
99.263
99.462
90.1352
0.000125373
0.0870649
100
60.0795
66.9814
68.3484
62.9505
100
100
100
100
0.000212498
9.32397e-05
100
100
23.245
21.3646
17.3664
17.3446
17.056
17.797
2.84174e-06
3.51106e-05
100
100
81.9007
92.9982
98.2713
100
0.000121246
0.000196089
100
72.0846
60.2254
54.5148
46.6716
63.7158
100
100
100
100
7.38843e-05
1.9574
100
100
26.6396
14.8041
15.1646
23.9807
21.4907
22.543
51.3955
1.43397e-05
100
100
86.2198
96.1181
95.9646
70.0074
0.000152643
2.62437
100
59.3484
51.7998
40.0709
45.0981
91.2888
100
100
100
100
0.687202
96.4526
100
100
48.2689
20.194
27.9164
34.7621
30.6841
36.0172
62.3202
27.5068
81.9089
79.222
84.5017
100
100
0.000105811
3.44763e-05
91.0961
82.6405
67.7981
31.0546
41.8943
50.0063
100
100
100
100
100
58.3758
100
100
100
100
64.0669
63.3714
62.3311
58.3658
64.639
57.2159
24.176
27.6344
53.5599
69.781
100
0.000433469
9.3688e-05
44.8755
57.9238
69.6396
68.5234
58.0607
37.7519
100
100
100
100
100
100
90.6957
100
100
100
100
100
88.4297
87.5081
81.0983
78.4917
55.2737
16.2714
)
;
boundaryField
{
inlet
{
type fixedValue;
value uniform 0.0002;
}
outlet
{
type zeroGradient;
}
walls
{
type zeroGradient;
}
frontAndBackPlanes
{
type empty;
}
}
// ************************************************************************* //
|
37072f2dcc1842addcca19425353ac2a84318be0
|
f0ffd0c22a7136d82b8cb22ef28ffe037052d1ca
|
/cequal-interpreter/src/classes/value/LiteralBool.cpp
|
367004a6e116ef84fd92990adea162852c88e33c
|
[] |
no_license
|
0Cristofer/CEqual
|
e161c6d3818ea14ca67d15a45c8b6f25e5be5604
|
c4cd63ec49d1d644049f0a022abdd54adde0bfd2
|
refs/heads/master
| 2020-03-28T21:32:19.750425
| 2019-08-16T06:01:16
| 2019-08-16T06:01:16
| 149,164,111
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 252
|
cpp
|
LiteralBool.cpp
|
/* Leaf node for booleans definitons
Authors: Bruno Cesar, Cristofer Oswald and Narcizo Gabriel
Created: 18/10/2018
Edited: 18/10/2018 */
#include "include/LiteralBool.hpp"
LiteralBool::LiteralBool(bool b): Literal(BOOL, "bool"), val(b){
}
|
f467993f4b5a33a06d6712163b0450ea2db1878f
|
3a3e910d4ab0ae266ca3af46a80f2a59507c2cf9
|
/CCS/shared/system/private/windows/type_p.h
|
52e8af4abad749f618c72583819b77e7eb58d9af
|
[] |
no_license
|
feliciwithme/Multi-machine-Fusion
|
e17c472374b120f76ab081e06488f1e96d8de943
|
66cc7a506f82c338ba64d04c95eabddf7a69dc46
|
refs/heads/master
| 2022-08-03T05:07:03.748508
| 2020-05-29T03:36:30
| 2020-05-29T03:36:30
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 265
|
h
|
type_p.h
|
#ifndef TYPE_P_H
#define TYPE_P_H
#include "private/system_type_p.h"
class type_p : public system_type_p
{
bool isWOW64() const;
public:
type_p();
virtual OSType os_type();
virtual PlatformType platform_type();
};
#endif // TYPE_P_H
|
79924e4603f1c0b3bbf77082a964e63ae4477db3
|
966bbfeba1be9aa7c0707c13f0dc0d7039f9e4f9
|
/src/tools/LWPRType.h
|
24496ff3b187cd4467cc73a7f06b65e1320e8e3f
|
[] |
no_license
|
Warren5382/remotingclient
|
21ba231fd0108edc8111f744b8ede4b1de3274b6
|
738d28cb8a2b171d320a6545f4c8b46cab14545e
|
refs/heads/master
| 2020-12-24T14:45:01.995379
| 2013-10-07T02:47:03
| 2013-10-07T02:47:03
| 12,721,790
| 0
| 1
| null | null | null | null |
GB18030
|
C++
| false
| false
| 1,937
|
h
|
LWPRType.h
|
#ifndef LWPR_LWPR_TYPE_H__
#define LWPR_LWPR_TYPE_H__
#include <cassert>
#include <signal.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/msg.h>
#include <sys/types.h>
#include <sys/select.h>
#include <sys/time.h>
#include <unistd.h>
#include <pthread.h>
#include <vector>
namespace LWPR
{
typedef char BOOL; // bool
typedef unsigned char UINT8; // Unsigned 8 bit quantity
typedef signed char INT8; // Signed 8 bit quantity
typedef unsigned short UINT16; // Unsigned 16 bit quantity
typedef signed short INT16; // Signed 16 bit quantity
typedef unsigned int UINT32; // Unsigned 32 bit quantity
typedef signed int INT32; // Signed 32 bit quantity
typedef unsigned long long UINT64; // Unsigned 64 bit quantity
typedef signed long long INT64; // Signed 64 bit quantity
typedef float FP32; // Single precision floating point
typedef double FP64; // Double precision floating point
#define LWPR_TRUE 1
#define LWPR_FALSE 0
};
namespace LWPR
{
typedef key_t IPCKEY_T;
typedef int IPCID_T;
typedef pid_t PID_T;
typedef msqid_ds MSQ_INFO_T;
const int IPC_INVALID_ID = -1;
typedef enum ipc_create_type
{
CREATE_NEW_ONE, // 创建一个新IPC,如果已经存在,则返回成功
CREATE_NEW_ONE_EXCL, // 创建一个新IPC,如果已经存在,则返回失败
GET_EXIST_ONE, // 取得已经存在的IPC,如果不存在,则返回失败
} IPC_CREATE_TYPE_E;
static const int IPC_DEFAULT_PERM = 0666;
typedef enum permission_e
{
RW,
READ,
WRITE,
} PERMISSION_E;
typedef void (*SIGHANDLER_PFT)(int);
typedef pthread_t THREAD_ID_T;
typedef pthread_key_t THREAD_KEY_T;
typedef pid_t PID_T;
typedef int SOCKET_FD_T;
typedef fd_set SOCKET_SET_T;
typedef std::vector <PID_T> PIDList;
typedef std::vector <IPCID_T> IPCIDList;
typedef std::vector <SOCKET_FD_T> SOCKETFDList;
};
#endif // end of LWPR_LWPR_TYPE_H__
|
d6b39fc35128436544be8697e54c7757fff672f4
|
d92f31835946d64473a036efc5f97ed55b9ceacf
|
/src/object.cpp
|
179c9259b584aaa9369ec6e64b92a620dcada952
|
[] |
no_license
|
vncp/GraphicsIntro
|
9b00a08434be08a63ed3400e08b3c84b6c882f22
|
2972e72063646692e47c8a67182e8260a23b496c
|
refs/heads/master
| 2023-08-01T12:07:15.435089
| 2021-09-13T17:14:40
| 2021-09-13T17:14:40
| 406,062,146
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,495
|
cpp
|
object.cpp
|
#include "object.h"
Object::Object(Args *args)
: Object3D(args),
angleOrbit(0.0f),
angleSpin(0.0f),
isSpinning(true),
isSpinClockwise(true),
isOrbitting(true),
isOrbittingClockwise(true),
spinMultiplier(1.0f),
orbitMultiplier(1.0f)
{
/*
# Blender File for a Cube
o Cube
v 1.000000 -1.000000 -1.000000
v 1.000000 -1.000000 1.angleOrbit
v -1.000000 -1.000000 1.000000
v -1.000000 -1.000000 -1.000000
v 1.000000 1.000000 -0.999999
v 0.999999 1.000000 1.000001
v -1.000000 1.000000 1.000000
v -1.000000 1.000000 -1.000000
s off
f 2 3 4
f 8 7 6
f 1 5 6
f 2 6 7
f 7 8 4
f 1 4 8
f 1 2 4
f 5 8 6
f 2 1 6
f 3 2 7
f 3 7 4
f 5 1 8
*/
std::vector<Vertex> vertices = {
{{1.0f, -1.0f, -1.0f}, {0.0f, 0.0f, 0.0f}},
{{1.0f, -1.0f, 1.0f}, {1.0f, 0.0f, 0.0f}},
{{-1.0f, -1.0f, 1.0f}, {0.0f, 1.0f, 0.0f}},
{{-1.0f, -1.0f, -1.0f}, {0.0f, 0.0f, 1.0f}},
{{1.0f, 1.0f, -1.0f}, {1.0f, 1.0f, 0.0f}},
{{1.0f, 1.0f, 1.0f}, {1.0f, 0.0f, 1.0f}}, {{-1.0f, 1.0f, 1.0f}, {0.0f, 1.0f, 1.0f}},
{{-1.0f, 1.0f, -1.0f}, {1.0f, 1.0f, 1.0f}}
};
std::vector<unsigned int> indices = {
2, 3, 4,
8, 7, 6,
1, 5, 6,
2, 6, 7,
7, 8, 4,
1, 4, 8,
1, 2, 4,
5, 8, 6,
2, 1, 6,
3, 2, 7,
3, 7, 4,
5, 1, 8
};
// The index works at a 0th index
for(unsigned int i = 0; i < indices.size(); i++)
{
indices[i] = indices[i] - 1;
}
setVI(vertices, indices);
initBuffers();
transMat = glm::translate(glm::mat4(1.0f), glm::vec3(7.0f, 0.0f, 0.0f));
}
Object::~Object()
{
}
void Object::Update(unsigned int dt)
{
if (isOrbitting) {
// Calculate Orbit Angle
if (isOrbittingClockwise)
angleOrbit += orbitMultiplier * dt * M_PI/1000;
else
angleOrbit -= orbitMultiplier * dt * M_PI/1000;
// Set Transform Matrix
orbitMat = glm::rotate(glm::mat4(1.0f), (angleOrbit), glm::vec3(0.0f, 1.0f, 0.0f));
}
if (isSpinning) {
// Caculate Angle based on spin
if (isSpinClockwise)
angleSpin += spinMultiplier * dt * M_PI/500;
else
angleSpin -= spinMultiplier * dt * M_PI/500;
// Set Rotation Matrix
spinMat = glm::rotate(glm::mat4(1.0f), (angleSpin), glm::vec3(0.0f, 1.0f, 0.0f));
}
// Calculate Transform Stack
// Note: Applying the inverse of the orbit transform in order to let spinMatrix
// determine entirely the spin of the model. This means spin will change at same
// speed regardless of whether the object is rotating or not.
m_mMat = orbitMat * transMat * spinMat / orbitMat;
}
void Object::toggleSpin() {
isSpinning = !isSpinning;
}
void Object::toggleSpinDirection() {
isSpinClockwise = !isSpinClockwise;
}
void Object::toggleOrbit() {
isOrbitting = !isOrbitting;
}
void Object::toggleOrbitDirection() {
isOrbittingClockwise = !isOrbittingClockwise;
}
void Object::handleEvent(int key) {
switch (key) {
case GLFW_KEY_Z:
toggleSpin(); break;
case GLFW_KEY_X:
toggleOrbit();
break;
case GLFW_KEY_A:
toggleSpinDirection();
break;
case GLFW_KEY_S:
toggleOrbitDirection();
break;
case GLFW_MOUSE_BUTTON_LEFT:
toggleSpinDirection();
break;
}
}
void Object::handleEvent(int key, float *val) {
switch(key) {
// Case spin speed
case -1:
spinMultiplier = *val;
break;
// Case orbit speed
case -2:
orbitMultiplier = *val;
break;
}
}
|
4030d1ea631ca7ce22c66d21c2d928864a62aaaa
|
1f7736bca0ea40ea989f8e3b5598e21aa853c997
|
/sling/util/arena.h
|
00a855627bba7e62637608c131ea9cfb010350c9
|
[
"Apache-2.0"
] |
permissive
|
google/sling
|
93045899c975ef244a3bdd09b4cea3c536db098d
|
f408a148a06bc2d62e853a292a8ba7266c642839
|
refs/heads/master
| 2023-05-31T19:30:22.235743
| 2021-01-22T19:30:50
| 2021-01-22T19:30:50
| 89,349,679
| 2,069
| 322
|
Apache-2.0
| 2021-01-22T21:43:15
| 2017-04-25T10:47:40
|
C++
|
UTF-8
|
C++
| false
| false
| 2,623
|
h
|
arena.h
|
// Copyright 2017 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SLING_UTIL_ARENA_H_
#define SLING_UTIL_ARENA_H_
#include <string.h>
#include <stdlib.h>
#include <string>
#include <vector>
namespace sling {
// Arena allocator for allocating memory from larger memory regions. Arena
// allocation is fast, has low overhead, and all the objects in an arena can be
// efficiently deallocated all at once.
template<typename T = char> class Arena {
public:
// Initialize arena.
Arena(size_t chunk = 1 << 20) : chunk_(chunk) {}
// Deallocate arena.
~Arena() { for (T *r : regions_) free(r); }
// Allocate memory from arena.
T *alloc(size_t size = 1) {
if (free_ < size) expand();
T *ptr = heap_;
heap_ += size;
free_ -= size;
return ptr;
}
// Allocate memory initialized from another memory object.
T *dup(const T *data, size_t size = 1) {
T *ptr = alloc(size);
memcpy(ptr, data, size * sizeof(T));
return ptr;
}
// Deallocate all objects from arena.
void clear() {
for (T *r : regions_) free(r);
regions_.clear();
heap_ = nullptr;
free_ = 0;
}
private:
// Allocate a new region.
void expand() {
T *memory = static_cast<T *>(malloc(chunk_ * sizeof(T)));
heap_ = memory;
free_ = chunk_;
regions_.push_back(memory);
}
// Pointer to the unused part of the current region.
T *heap_ = nullptr;
// Bytes remaining in the unallocated part of of the current region.
size_t free_ = 0;
// Size of each region.
size_t chunk_;
// List of allocated regions.
std::vector<T *> regions_;
};
// Arena for allocating nul-terminated strings.
class StringArena : public Arena<char> {
public:
// Duplicate nul-terminated string.
char *dup(const char *str) {
return Arena::dup(str, strlen(str) + 1);
}
// Allocate nul-terminated string from string object.
char *dup(const std::string &str) {
char *ptr = alloc(str.size() + 1);
memcpy(ptr, str.data(), str.size());
ptr[str.size()] = 0;
return ptr;
}
};
} // namespace sling
#endif // SLING_UTIL_ARENA_H_
|
7f5ba2c1a8a574a9974156b5f108af2a8aff3533
|
65dda9db8260a9830f23a90b2883e5c2260f2948
|
/gtl/gtl/range/iterator_range.h
|
f2109a90b294ee3bd3861900d96ad057837bd418
|
[
"Apache-2.0"
] |
permissive
|
kevinic/gtl
|
00040745757f085ec20290a41835ff025473285b
|
3f3f3c89ba608932bfd30747e40b4eef07e9f417
|
refs/heads/master
| 2021-01-23T13:59:43.110657
| 2013-09-12T04:52:05
| 2013-09-12T04:52:05
| 12,751,797
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,471
|
h
|
iterator_range.h
|
/**
* Copyright 2013 Kevin Lin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef GTL_RANGE_ITERATOR_RANGE_H
#define GTL_RANGE_ITERATOR_RANGE_H
#include <gtl/common.h>
#include <gtl/type_traits.h>
#include <iterator>
#include <algorithm>
namespace gtl {
template <class Iterator> class Iterator_Range
{
public:
typedef Iterator iterator_type;
typedef typename std::iterator_traits<iterator_type>::value_type value_type;
typedef typename std::iterator_traits<iterator_type>::reference ref_type;
typedef value_type const& get_type;
typedef value_type const& set_type;
Iterator_Range(iterator_type begin, iterator_type end) : m_begin(begin), m_end(end) {}
template <class TT>
Iterator_Range(Iterator_Range<TT> const& other) : m_begin(other.m_begin), m_end(other.m_end) {}
ref_type ref() const {return *m_begin;}
get_type get() const {return *m_begin;}
void set(set_type value) const {*m_begin = value;}
void pop()
{
++m_begin;
}
bool empty() const {return m_begin == m_end;}
get_type get(size_t i) const
{
return *(m_begin + i);
}
void set(size_t i, set_type value) const
{
*(m_begin + i) = value;
}
Iterator_Range slice(size_t begin, size_t end) const
{
return Iterator_Range(
m_begin + begin,
m_begin + std::min(size(), end));
}
size_t size() const {return m_end - m_begin;}
iterator_type begin() const {return m_begin;}
iterator_type end() const {return m_end;}
iterator_type m_begin;
iterator_type m_end;
};
template <class T> struct is_random_range<Iterator_Range<T>>
{
typedef typename std::is_same<
typename std::iterator_traits<T>::iterator_category,
std::random_access_iterator_tag
>::type type;
};
template <class Iterator>
Iterator_Range<Iterator> make_range(Iterator begin, Iterator end)
{
return Iterator_Range<Iterator>(begin, end);
}
template <class T, size_t N> Iterator_Range<T*> make_range(T (&a)[N])
{
return Iterator_Range<T*>(a, a + N);
}
} //namespace
#endif
|
c7c0cd31d73e58c8d15c71d3ef50f26bbe528086
|
027db7d8309e6f43567476aade755753ce90ae9e
|
/MapProject.h
|
183d58c0e0245181784f8404c0af6545e34e95b6
|
[
"MIT"
] |
permissive
|
linyuehzzz/GISGraphics
|
4ae7f45da644dc5322e7589015eada8d8e9e060f
|
54818dcbeb01c4801a877fb465898e2a32d13616
|
refs/heads/master
| 2020-03-15T18:51:40.361839
| 2019-12-14T20:35:12
| 2019-12-14T20:35:12
| 132,293,886
| 1
| 3
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 686
|
h
|
MapProject.h
|
// MapProject.h: interface for the CMapProject class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_MAPPROJECT_H__E02D5215_9AA0_464A_B486_5A40E466D9BD__INCLUDED_)
#define AFX_MAPPROJECT_H__E02D5215_9AA0_464A_B486_5A40E466D9BD__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "afxtempl.h"
#define PI 3.141592
#define E 2.71828
class CMapProject
{
public:
void Draw(CDC *pDC);
void getLB(float x,float y,float *L,float *B);
void getXY(float L,float B,float *x,float *y);
CMapProject();
virtual ~CMapProject();
};
#endif // !defined(AFX_MAPPROJECT_H__E02D5215_9AA0_464A_B486_5A40E466D9BD__INCLUDED_)
|
df86e3f83dcff64143739329fe7d68e68c528bad
|
8cbdfde45d4ee766971c04347d1b9270fb822b82
|
/sliding_tile/sliding_tile.h
|
872d26005e2dee538ce07a998ba022e765f28a00
|
[] |
no_license
|
tinamil/dibbs
|
b4e6f2ca87525ddc1982303b865c2dc07c04bd94
|
af0953b84fa12b1a1efc8f9044ecab1808018092
|
refs/heads/master
| 2023-06-17T09:43:17.441819
| 2021-06-17T01:29:24
| 2021-06-17T01:29:24
| 152,330,796
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 12,302
|
h
|
sliding_tile.h
|
#pragma once
#include <cstdint>
#include <cassert>
#include <cstring>
#include <cmath>
#include "hash.hpp"
constexpr int NUM_TILES = 16;
constexpr size_t MEM_LIMIT = 100ui64 * 1024 * 1024 * 1024; //100GB
enum class Direction { forward, backward };
inline Direction OppositeDirection(Direction d) {
if (d == Direction::forward) return Direction::backward;
else return Direction::forward;
}
class SlidingTile {
private:
static uint8_t distances[NUM_TILES][NUM_TILES]; // distances[i][j] = Manhattan distance between location i and location j.
static uint8_t starting[NUM_TILES];
static uint8_t*& DUAL_SOURCE() { static uint8_t* I = nullptr; return I; };
public:
static uint8_t moves[NUM_TILES][5]; // moves[i] = list of possible ways to move the empty tile from location i.
uint8_t empty_location;
Direction dir;
#ifdef HISTORY
std::vector<uint8_t> actions;
#endif
uint8_t source[NUM_TILES];
uint8_t g;
uint8_t h;
uint8_t h2;
uint8_t f;
uint8_t f_bar;
int hdiff;
uint8_t delta;
bool threshold;
uint8_t compute_manhattan() {
if (dir == Direction::forward) {
return compute_manhattan_forward();
}
else {
return compute_manhattan_backward();
}
}
uint8_t compute_manhattan_opposite() {
if (dir == Direction::forward) {
return compute_manhattan_backward();
}
else {
return compute_manhattan_forward();
}
}
uint8_t compute_manhattan_forward()
{
uint8_t LB = 0;
for (int i = 0; i < NUM_TILES; ++i) {
if (source[i] != 0) {
LB += distances[i][source[i]];
}
}
return LB;
}
//_________________________________________________________________________________________________
uint8_t compute_manhattan_backward()
{
uint8_t location_of_tile1[NUM_TILES];
uint8_t location_of_tile2[NUM_TILES];
for (int i = 0; i < NUM_TILES; i++) {
location_of_tile1[source[i]] = i;
location_of_tile2[starting[i]] = i;
}
uint8_t LB = 0;
for (int i = 1; i < NUM_TILES; i++) {
LB += distances[location_of_tile1[i]][location_of_tile2[i]];
}
return LB;
}
/*************************************************************************************************/
static void initialize(uint8_t initial_state[])
{
int cnt, d, i_row, i_col, j, j_row, j_col;
memcpy(starting, initial_state, NUM_TILES);
if (DUAL_SOURCE() == nullptr) DUAL_SOURCE() = new uint8_t[NUM_TILES];
for (int i = 0; i < NUM_TILES; ++i) DUAL_SOURCE()[initial_state[i]] = i;
uint8_t n_rows = (uint8_t)sqrt(NUM_TILES);
uint8_t n_cols = n_rows;
assert(n_cols * n_rows == NUM_TILES);
for (int i = 0; i < NUM_TILES; ++i) {
i_col = 1 + (i % n_rows);
cnt = 0;
// Up.
j = i - n_cols;
if ((0 <= j) && (j < NUM_TILES)) moves[i][++cnt] = j;
// Left
if (i_col > 1) {
j = i - 1;
}
else {
j = -1;
}
if ((0 <= j) && (j < NUM_TILES)) moves[i][++cnt] = j;
// Right.
if (i_col < n_cols) {
j = i + 1;
}
else {
j = -1;
}
if ((0 <= j) && (j < NUM_TILES)) moves[i][++cnt] = j;
// Down.
j = i + n_cols;
if ((0 <= j) && (j < NUM_TILES)) moves[i][++cnt] = j;
moves[i][0] = cnt;
}
// Initializes distances.
// distances[i][j] = Manhattan distance between location i and location j.
for (int i = 0; i < NUM_TILES; ++i) {
i_row = 1 + (i / n_cols);
i_col = 1 + (i % n_rows);
for (j = i; j < NUM_TILES; j++) {
j_row = 1 + (j / n_cols);
j_col = 1 + (j % n_rows);
distances[i][j] = abs(i_row - j_row) + abs(i_col - j_col);
distances[j][i] = distances[i][j];
}
}
}
SlidingTile() {}
SlidingTile(const uint8_t* data, Direction dir) : dir(dir), g(0), h(0), h2(0), f(0), f_bar(0), delta(0)
{
memcpy(source, data, NUM_TILES);
h = compute_manhattan();
f = h;
f_bar = f;
threshold = h == 0;
hdiff = h;
// Find the location of the empty tile.
for (int i = 0; i < NUM_TILES; i++) {
if (source[i] == 0) {
empty_location = i;
break;
}
}
}
SlidingTile(const SlidingTile& copy) : dir(copy.dir), g(copy.g), h(copy.h), h2(copy.h2), f(copy.f), f_bar(copy.f_bar), hdiff(copy.hdiff), delta(copy.delta), threshold(copy.threshold), empty_location(copy.empty_location)
#ifdef HISTORY
, actions(copy.actions)
#endif
{
memcpy(source, copy.source, NUM_TILES);
}
inline static SlidingTile GetSolvedPuzzle(Direction dir) {
uint8_t puzzle[NUM_TILES];
for (int i = 0; i < NUM_TILES; ++i) {
puzzle[i] = i;
}
return SlidingTile(puzzle, dir);
}
inline bool operator==(const SlidingTile& right) const {
return memcmp(source, right.source, NUM_TILES) == 0;
}
void apply_move(int move) {
uint8_t new_empty_location = moves[empty_location][move];
uint8_t tile = source[new_empty_location];
source[empty_location] = tile;
source[new_empty_location] = 0;
if (dir == Direction::forward) {
h = h + distances[empty_location][tile] - distances[new_empty_location][tile];
//assert(h == compute_manhattan());
h2 = h2 + distances[empty_location][DUAL_SOURCE()[tile]] - distances[new_empty_location][DUAL_SOURCE()[tile]];
//assert(h2 == compute_manhattan_opposite());
}
else {
h2 = h2 + distances[empty_location][tile] - distances[new_empty_location][tile];
//assert(h2 == compute_manhattan());
h = h + distances[empty_location][DUAL_SOURCE()[tile]] - distances[new_empty_location][DUAL_SOURCE()[tile]];
//assert(h == compute_manhattan_opposite());
}
empty_location = new_empty_location;
}
size_t num_actions_available() const {
return moves[empty_location][0];
}
SlidingTile apply_action(int i) const {
SlidingTile new_node(*this);
#ifdef HISTORY
new_node.actions.push_back(i);
#endif
new_node.apply_move(i);
new_node.g = g + 1;
new_node.f = new_node.g + new_node.h;
new_node.f_bar = 2 * new_node.g + new_node.h - new_node.h2;
new_node.threshold = threshold || new_node.h <= new_node.h2;
new_node.hdiff = new_node.h - new_node.h2;
new_node.delta = new_node.g - new_node.h2;
assert(new_node.f >= f); //Consistency check
return new_node;
}
};
//Returns smallest f value with largest g value
struct FSort {
bool operator()(const SlidingTile& lhs, const SlidingTile& rhs) const {
return operator()(&lhs, &rhs);
}
bool operator()(const SlidingTile* lhs, const SlidingTile* rhs) const {
if (lhs->f == rhs->f) {
return lhs->g < rhs->g;
}
return lhs->f > rhs->f;
}
};
struct FSortLowGSetComparer {
bool operator()(const SlidingTile& lhs, const SlidingTile& rhs) const {
return operator()(&lhs, &rhs);
}
bool operator()(const SlidingTile* lhs, const SlidingTile* rhs) const {
int cmp = memcmp(lhs->source, rhs->source, NUM_TILES);
if (cmp == 0) {
return false;
}
else if (lhs->f == rhs->f) {
if (lhs->g == rhs->g)
return cmp < 0;
else
return lhs->g > rhs->g;
}
else {
return lhs->f < rhs->f;
}
}
};
//Returns smallest f value with smallest g value
struct FSortLowG {
bool operator()(const SlidingTile& lhs, const SlidingTile& rhs) const {
return operator()(&lhs, &rhs);
}
bool operator()(const SlidingTile* lhs, const SlidingTile* rhs) const {
int cmp = memcmp(lhs->source, rhs->source, NUM_TILES);
if (cmp == 0) {
return false;
}
else if (lhs->f == rhs->f) {
if (lhs->g == rhs->g)
return cmp < 0;
else
return lhs->g < rhs->g;
}
else {
return lhs->f < rhs->f;
}
}
};
//Returns smallest g value
struct GSortLow {
bool operator()(const SlidingTile& lhs, const SlidingTile& rhs) const {
return operator()(&lhs, &rhs);
}
bool operator()(const SlidingTile* lhs, const SlidingTile* rhs) const {
int cmp = memcmp(lhs->source, rhs->source, NUM_TILES);
if (cmp == 0) {
return false;
}
if (lhs->g == rhs->g)
return cmp < 0;
else
return lhs->g < rhs->g;
}
};
struct GSortHigh {
bool operator()(const SlidingTile& lhs, const SlidingTile& rhs) const {
return operator()(&lhs, &rhs);
}
bool operator()(const SlidingTile* lhs, const SlidingTile* rhs) const {
int cmp = memcmp(lhs->source, rhs->source, NUM_TILES);
if (cmp == 0) {
return false;
}
if (lhs->g == rhs->g)
return cmp < 0;
else
return lhs->g > rhs->g;
}
};
//Returns smallest fbar with smallest g value
struct FBarSortLowG {
bool operator()(const SlidingTile& lhs, const SlidingTile& rhs) const {
return operator()(&lhs, &rhs);
}
bool operator()(const SlidingTile* lhs, const SlidingTile* rhs) const {
int cmp = memcmp(lhs->source, rhs->source, NUM_TILES);
if (cmp == 0) {
return false;
}
else if (lhs->f_bar == rhs->f_bar) {
if (lhs->g == rhs->g)
return cmp < 0;
else
return lhs->g < rhs->g;
}
else {
return lhs->f_bar < rhs->f_bar;
}
}
};
//Returns smallest fbar with smallest g value
struct FBarSortHighG
{
bool operator()(const SlidingTile& lhs, const SlidingTile& rhs) const
{
return operator()(&lhs, &rhs);
}
bool operator()(const SlidingTile* lhs, const SlidingTile* rhs) const
{
int cmp = memcmp(lhs->source, rhs->source, NUM_TILES);
if(cmp == 0)
{
return false;
}
else if(lhs->f_bar == rhs->f_bar)
{
if(lhs->g == rhs->g)
return cmp < 0;
else
return lhs->g > rhs->g;
}
else
{
return lhs->f_bar < rhs->f_bar;
}
}
};
struct SlidingTileHash
{
inline std::size_t operator() (const SlidingTile& x) const
{
return operator()(&x);
}
inline std::size_t operator() (const SlidingTile* x) const
{
return SuperFastHash(x->source, NUM_TILES);
}
};
struct FBarSortHighGLowDuplicate {
bool operator()(const SlidingTile& lhs, const SlidingTile& rhs) const {
return operator()(&lhs, &rhs);
}
bool operator()(const SlidingTile* lhs, const SlidingTile* rhs) const {
if (lhs->f_bar == rhs->f_bar) {
return lhs->g < rhs->g;
}
else {
return lhs->f_bar > rhs->f_bar;
}
}
};
struct SlidingTileEqual
{
inline bool operator() (const SlidingTile* x, const SlidingTile* y) const
{
return *x == *y;
}
inline bool operator() (const SlidingTile x, const SlidingTile y) const
{
return x == y;
}
};
struct FSortHighDuplicate {
bool operator()(const SlidingTile& lhs, const SlidingTile& rhs) const {
return operator()(&lhs, &rhs);
}
bool operator()(const SlidingTile* lhs, const SlidingTile* rhs) const {
if (lhs->f == rhs->f) {
return lhs->g > rhs->g;
}
return lhs->f > rhs->f;
}
};
struct GSortHighDuplicate {
bool operator()(const SlidingTile& lhs, const SlidingTile& rhs) const {
return operator()(&lhs, &rhs);
}
bool operator()(const SlidingTile* lhs, const SlidingTile* rhs) const {
if (lhs->g == rhs->g) {
return lhs->h < rhs->h;
}
return lhs->g > rhs->g;
}
};
struct GSortLowDuplicate
{
bool operator()(const SlidingTile& lhs, const SlidingTile& rhs) const
{
return operator()(&lhs, &rhs);
}
bool operator()(const SlidingTile* lhs, const SlidingTile* rhs) const
{
if(lhs->g == rhs->g)
{
return lhs->h > rhs->h;
}
return lhs->g < rhs->g;
}
};
struct DeltaSortHighDuplicate {
bool operator()(const SlidingTile& lhs, const SlidingTile& rhs) const {
return operator()(&lhs, &rhs);
}
bool operator()(const SlidingTile* lhs, const SlidingTile* rhs) const {
uint8_t ld = lhs->g - lhs->h2;
uint8_t rd = rhs->g - rhs->h2;
if (ld == rd) {
return lhs->g < rhs->g;
}
return ld > rd;
}
};
struct FBarSortHighDuplicate {
bool operator()(const SlidingTile& lhs, const SlidingTile& rhs) const {
return operator()(&lhs, &rhs);
}
bool operator()(const SlidingTile* lhs, const SlidingTile* rhs) const {
if (lhs->f_bar == rhs->f_bar) {
return lhs->g > rhs->g;
}
else {
return lhs->f_bar > rhs->f_bar;
}
}
};
|
dec5bfff7da9bf370435563150c34e78f4d62b59
|
1bb929ed638a7205c7b0f5207e95d158016ff42f
|
/hero.h
|
280642f6e2baae05f40ee2ca348c9d5021e38295
|
[] |
no_license
|
SelYui/RunGame
|
f847e9823c5db5f298e3034d254a2b03723c3c42
|
26dba32625d15116bf58c65b8877044d5c19cce2
|
refs/heads/main
| 2023-03-01T02:12:28.354685
| 2021-02-10T17:55:32
| 2021-02-10T17:55:32
| 337,803,794
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,818
|
h
|
hero.h
|
#ifndef HERO_H
#define HERO_H
#include <QObject>
#include <QGraphicsItem>
#include <QGraphicsScene>
#include <QPainter>
#include <QDesktopWidget>
#include <QImage>
/* Подключаем библиотеку, отвечающую за использование WinAPI
* Данная библиотека необходима для асинхронной проверки состояния клавиш
* */
#include <windows.h>
class Hero : public QObject, public QGraphicsItem
{
Q_OBJECT
public:
explicit Hero(QObject *parent = nullptr);
~Hero();
void MovingHero(int pressKey); // Обработку перемещения героя
signals:
/* Сигнал, который передаётся в ядро игры с элементом QGraphicsItem,
* объект на который наткнулся герой, и требуется принять решение о том,
* что с этим элементом делать.
* */
void signalCheckItem(QGraphicsItem *item);
public slots:
void slotPressKey(); // Слот, который обрабатывает нажатие клавишь и вызывает функцию управление героем
protected:
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
private:
void MovingHeroScene();
// Для прыжка
int down_border; // Нижняя граница - земля, по которой бежит герой
double speed, V0, t; // Скорость и время, для вычисления равнозамедленного движения
double g = 9.81; // Ускорение свободного падения
int step; // Признак положения героя: 0- бежит, 1- летит вверх/вниз, 2- смерть, 3- наклонен вниз
// Высота и ширина героя
int heightHero;
int widthHero;
//Для отрисовки героя
QImage *dino_sprite;
//QPixmap dino_sprite;
QPixmap mask;
bool meandr; //для изображения перемещения переключаем ее то на 0, то на 1
int countForSteps; // Счётчик для отсчета тиков таймера, при которых мы переключаем изображение
int pressKey; // Признак нажатия клавиши в игре
//таблица координат героя
const int top_hero = 2;
const int bot_hero = 95;
const int left_hero[8] = {1338,1426,1514,1602,1690,1778,1866,1984};
const int right_hero[8] = {1425,1513,1601,1689,1777,1865,1983,2101};
};
#endif // HERO_H
|
7c4aff658147c31c6b6d544fc4219d3a2c90ca0f
|
98c7cc6e4436c2deb43bd965935f42ed6ab5396f
|
/Server/AException.cpp
|
48a649de8ddc12ad15f5be15001a0b4bc7c6c84d
|
[] |
no_license
|
AndreiVladescu/Noodle
|
276c172fe3288bf5da8d49b936b0d327462fc68e
|
a737a9f196ff44ed2bedc707fb82fa28e4bbbf6e
|
refs/heads/main
| 2023-08-28T03:20:11.616796
| 2021-11-04T16:20:01
| 2021-11-04T16:20:01
| 357,468,256
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 388
|
cpp
|
AException.cpp
|
#include "AException.h"
AException::AException(string exceptionMessage
, int exceptionCode) : p_exceptionCode(exceptionCode), p_exceptionMessage(exceptionMessage)
{
}
string AException::getMessage()
{
return p_exceptionMessage;
}
int AException::getCode()
{
return p_exceptionCode;
}
AException::~AException()
{
p_exceptionMessage.erase();
p_exceptionCode = 0;
}
|
2c627d1074a38f392897a9420e924450fbc37abf
|
295181f54d0fe13641e72698f85a62996951dc4e
|
/src/main.cc
|
e7f553917ae2357b476c0d9a5723da3b3b80b7e6
|
[] |
no_license
|
FengShang/geek_training
|
97496c33b27311b5d5bb6971ce4aeaf0e9a96ea2
|
6028642a5e01f85d215518bee92d1aaee961456e
|
refs/heads/master
| 2020-04-15T02:28:18.834695
| 2014-04-06T07:11:25
| 2014-04-06T07:11:25
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 118
|
cc
|
main.cc
|
#include "game_center.h"
int main(int argc, char *argv[])
{
demo::geek::GameCenter game;
return game.run();
}
|
2b3adb484aa0cb781e00a0db7f2ff7c5aec0051e
|
90c8e33d17c6cafe9bebd439974585182b01466b
|
/team_19s_1/E/20627966_nico123_E.cpp
|
0c00ae8438ec4393276b6ba00de7de7f5dfafe63
|
[] |
no_license
|
neverac/codes
|
fa89f6bb2aeef868b07e3bacefa1b7051e5c9af6
|
816d5039b48a44d5e940fba85dab0649d5427983
|
refs/heads/master
| 2020-06-20T10:57:31.191587
| 2019-07-28T08:46:20
| 2019-07-28T08:46:20
| 197,100,521
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,246
|
cpp
|
20627966_nico123_E.cpp
|
#include<bits/stdc++.h>
#define LL long long
using namespace std;
LL A[30],M[80][80],SS[80],S[80];
int main()
{
LL T,i,N,cursor,j,L,Q,X0,Y0,X1,Y1,ql,qr,l,r,len,SS1,ans;
scanf("%lld",&T);
while(T--)
{
scanf("%lld",&L);
for(i=0;i<L;i++)scanf("%lld",&A[i]);
if(L%2==0)N=2LL*L;
else N=L;
cursor = 0;
for (i = 0;i<2*N ; ++i) {
for (j = 0; j <= i; ++j) {
M[j][i - j] = A[cursor];
cursor = (cursor + 1) % L;
}
}
memset(SS,0,sizeof(SS));
for(i=0LL;i<N;i++)
{
for(j=0LL;j<N;j++)
{
SS[i]=SS[i]+M[i][j];
}
}
scanf("%lld",&Q);
while(Q--)
{
scanf("%lld %lld %lld %lld",&X0,&Y0,&X1,&Y1);
ql=Y0;qr=Y1;ans=0LL;
SS1=0LL;
for(i=0;i<N;i++)
{
S[i]=0LL;
if(ql%N==0)l=ql;
else l=(ql/N+1LL)*N;
if((qr+1LL)%N==0LL)r=qr;
else r=(qr/N)*N-1LL;
len=r-l+1LL;
S[i]=SS[i]*(len/N);
for(j=ql;j<=l-1;j++)S[i]+=M[i][j%N];
for(j=r+1;j<=qr;j++)S[i]+=M[i][j%N];
SS1+=S[i];
}
ql=X0;qr=X1;
if(ql%N==0)l=ql;
else l=(ql/N+1LL)*N;
if((qr+1LL)%N==0LL)r=qr;
else r=(qr/N)*N-1LL;
len=r-l+1LL;
ans=SS1*(len/N);
for(j=ql;j<=l-1;j++)ans+=S[j%N];
for(j=r+1;j<=qr;j++)ans+=S[j%N];
printf("%lld\n",ans);
}
}
;;;
return 0;
}
|
386efcf90ac917e2b9ff796aa8e9c330362d13b9
|
3d36c46c13c50d68ea7405a0443cc5fccb2871d7
|
/Graphs/24.2 Check if given Graph is Strongly Connected or not.cpp
|
42e5493ee9ca7e3b6d378d23c88e22639d768467
|
[] |
no_license
|
arpit353/DSA-Codes
|
41f30daf7ebc03356b50c15629620880661eb0a0
|
5e688e1b53e56336936a0e60038fa7ab0fc4161c
|
refs/heads/master
| 2021-03-16T09:10:07.639621
| 2018-05-07T16:43:22
| 2018-05-07T16:43:22
| 115,899,291
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,268
|
cpp
|
24.2 Check if given Graph is Strongly Connected or not.cpp
|
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
/*
Can we do better?
We can say that G is strongly connected if
1. DFS(G, v) visits all vertices in graph G, then there exists path from v to every other vertex in G and
2. There exists a path from every other vertex in G to v
Proof:
For G to be strongly connected, there should exists a path from x -> y and from y -> x for any pair of vertices (x, y) in the graph.
If Point 1 and Point 2 are true,
We can reach x -> y by going from vertex x to vertex v (from pt. 2) and then from vertex v to vertex y (from pt. 1).
Similarly, we can reach y -> x by going from vertex y to vertex v (from pt. 2) and then from vertex v to vertex x (from pt. 1).
Complete Algorithm –
1. Start DFS(G, v) from a random vertex v of the graph G. If DFS(G, v) fails to reach every other vertex in the graph G, then there is some vertex u, such that there is no directed path from v to u, and thus G is not strongly connected. If it does reach every vertex, then there is a directed path from v to every other vertex in the graph G.
2. Reverse the direction of all edges in the directed graph G.
3. Again run a DFS starting from vertex v. If the DFS fails to reach every vertex, then there is some vertex u, such that in the original graph there is no directed path from u to v. On the other hand, if it does reach every vertex, then in the original graph there is a directed path from every vertex u to v.
Thus if G passes both DFS, it is strongly connected.
*/
// data structure to store graph edges
struct Edge {
int src, dest;
};
// class to represent a graph object
class Graph
{
public:
// An array of vectors to represent adjacency list
vector<int> *adjList;
// Constructor
Graph(vector<Edge> const &edges, int N)
{
// allocate memory
adjList = new vector<int>[N];
// add edges to the directed graph
for (unsigned int i = 0; i < edges.size(); i++)
{
int src = edges[i].src;
int dest = edges[i].dest;
adjList[src].push_back(dest);
}
}
// Destructor
~Graph() {
delete[] adjList;
}
};
// Function to perform DFS Traversal
void DFS(Graph const &graph, int v, vector<bool> &visited)
{
// mark current node as visited
visited[v] = true;
// do for every edge (v -> u)
for (int u : graph.adjList[v])
{
// u is not visited
if (!visited[u])
DFS(graph, u, visited);
}
}
// check if graph is strongly connected or not
bool check(Graph const& graph, int N)
{
// stores vertex is visited or not
vector<bool> visited(N);
// choose random starting point
int v = 0;
// run a DFS starting at v
DFS(graph, v, visited);
// If DFS traversal doesn't visit all vertices,
// then graph is not strongly connected
if (find(visited.begin(), visited.end(), false)
!= visited.end())
return false;
// reset visited vector
fill(visited.begin(), visited.end(), false);
// Reverse the direction of all edges in the
// directed graph
vector<Edge> edges;
for (int i = 0; i < N; i++)
for (int j : graph.adjList[i])
edges.push_back({j, i});
// Create a graph from reversed edges
Graph gr(edges, N);
// Again run a DFS starting at v
DFS(gr, v, visited);
// If DFS traversal doesn't visit all vertices,
// then graph is not strongly connected
if (find(visited.begin(), visited.end(), false)
!= visited.end() )
return false;
// if graph "passes" both DFSs, it is strongly connected
return true;
}
// main function
int main()
{
// vector of graph edges as per above diagram
vector<Edge> edges = {
{0, 4}, {1, 0}, {1, 2}, {2, 1}, {2, 4},
{3, 1}, {3, 2}, {4, 3}
};
// Number of nodes in the graph
int N = 5;
// create a graph from given edges
Graph graph(edges, N);
// check if graph is not strongly connected or not
if (check(graph, N))
cout << "Graph is Strongly Connected";
else
cout << "Graph is not Strongly Connected";
return 0;
}
|
c329656e8876ef6e1fd82369d6b0dfdae95633de
|
b19878a8a4b9c948a0e7460c983384782f9be96c
|
/libxbn/xslt_plugins/1_0/xslt_value_of.cpp
|
1cab72c0c4d410252b7e71447a63f6ae08e9d4fb
|
[] |
no_license
|
manumehta123/xbn
|
a3ad77467f73fdee8aba6e01c68f0a05e147ff90
|
41ca285e094721b58078043bb3a4be47f8a8cd3d
|
refs/heads/master
| 2021-01-19T09:41:45.441130
| 2012-02-09T23:34:48
| 2012-02-09T23:34:48
| 38,676,912
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,452
|
cpp
|
xslt_value_of.cpp
|
/*
libxbn is a small and tiny xml binary node
Copyright (C) 2010 Thomas Kraus (thomentor@gmx.de)
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
#include "xslt_plugins/xbn_xslt_plugins_1_0.h"
#include "xbn_xpath.h"
xsltplugin_xsl_value_of::xsltplugin_xsl_value_of( )
{
name = "xsl:value-of";
min_parameter=1;
max_parameter=2;
/*
The <xsl:value-of> element element extracts the value of a selected node.
The <xsl:value-of> element can be used to select the value of an XML element and add it to the output.
select expression Required. An XPath expression that specifies which node/attribute to extract the value from. It works like navigating a file system where a forward slash (/) selects subdirectories.
disable-output-escaping yes
no Optional. "yes" indicates that special characters (like "<") should be output as is. "no" indicates that special characters (like "<") should be output as "<". Default is "no"
*/
addParameter("select", false, "expression");
addParameter("disable-output-escaping", true, "yes|no");
}
bool xsltplugin_xsl_value_of::testUnit()
{
return false;
}
bool xsltplugin_xsl_value_of::operator() (xbn_state &state, xbn_xslt *p_xbn_xslt )
{
if( !p_xbn_xslt ) return false;
std::string param_select = state.pTemplateNode->getAttributeText( "select" );
std::string param_disable_output_escaping = state.pTemplateNode->getAttributeText( "disable-output-escaping","no" );
// Betroffene nodes
xbnode_list node_col;
xbn_xpath::selectNodes( state.pSourceNode, node_col, param_select, state.pStack );
bool ret = true;
for(xbnode_list::iterator pc=node_col.begin(), pe=node_col.end(); pc!=pe && ret; ++pc )
{
std::string wert = (*pc)->getText();
if( !wert.empty() )
{
state.pCurrentNode->appendText( wert );
}
}
return ret;
}
|
eb51ffdccca8f4267eef86d95012bfb507ccfecd
|
f8dc2eb94958206c03d39ec133d51c6856660784
|
/src/ControlComponent.h
|
9bf5f162d784789d11c0268b90e46907f762c72d
|
[
"MIT"
] |
permissive
|
FroxCode/Portfolio-VTA
|
d997bde5447ade1c9d1b75398f06e600da89a48a
|
9379ff2b8d4a4e26df9b149cad57575915ed0998
|
refs/heads/master
| 2020-05-03T03:50:43.872971
| 2019-03-29T13:44:09
| 2019-03-29T13:44:09
| 178,407,367
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 741
|
h
|
ControlComponent.h
|
#pragma once
#include "Component.h"
class ControlComponent : public Component
{
private:
SDL_Point velocity = { 0, 0 };
double angle = 0;
const int MAX_VELOCITY_X = 10;//need to be edited for pickups
const int MAX_VELOCITY_Y = 10;
public:
ControlComponent() : Component("Control")
{
angle = 300;
};
~ControlComponent() {};
double getAngle()
{
return angle;
}
void setAngle(double a)
{
angle = a;
}
SDL_Point getVelocity() { return velocity; }
void setVelocity(SDL_Point newV) {
this->velocity = newV;
if (this->velocity.x > MAX_VELOCITY_X)
this->velocity.x = MAX_VELOCITY_X;
if (this->velocity.y > MAX_VELOCITY_Y)
this->velocity.y = MAX_VELOCITY_Y;
}
std::string currentMessage = "(UPDATE)";
};
|
65b87bfdc5f30f0ad13527fadfc68e5647b0c2ad
|
ed65e4b26fc0d32c099ddd326f87fed54f2f02ce
|
/C++/SelectionsSort/source.cpp
|
30d2da20df32196305f9f30b0cd1bd33ea3dce85
|
[] |
no_license
|
yu-tree/Algorithm_Basic
|
3798d834821ef50e1b6ca6d92afad4267adfee97
|
2b80e7a8ee9a426ebf9b1bb98b3c7ac94732b82f
|
refs/heads/master
| 2023-08-21T17:55:13.246885
| 2021-10-13T12:55:19
| 2021-10-13T12:55:19
| null | 0
| 0
| null | null | null | null |
UHC
|
C++
| false
| false
| 558
|
cpp
|
source.cpp
|
#include<stdio.h>
int main(void) {
int i, j, tmp, index,min;
int arr[10] = { 1,10,5,8,7,6,4,3,2,9 };
for (i = 0; i < 10; i++) {
min = 999;
for (int j = i; j < 10; j++) {
if (min > arr[j]) {
min = arr[j];
index = j;
}
}
printf("This is min : %d\n", min);
//현재 arr[j]자리에는 i이후의 숫자중에 최소의 값이 들어있음
//해당 arr[j]값을 swap해준다
tmp = arr[i];
arr[i] = arr[index];
arr[index] = tmp;
}
printf("This is sorted numbers");
for (int i = 0; i < 10; i++) {
printf("%d", arr[i]);
}
}
|
287a40c37c23c407560b1f8cf9aee6752a260590
|
5a680f2e4d07539148753f620360b566fc8fbc67
|
/CSharpClasses/MyField.cpp
|
7e04eeceb4c89f575d6d7b2d289ee131ed20fcc9
|
[] |
no_license
|
olferuk/CPP_SharpClasses
|
c582b85920b0c221809bcb78c2f953bccfcd6497
|
ffd91bf2d5f98adf7632446e72e8e03c62504639
|
refs/heads/master
| 2021-05-29T17:34:34.702401
| 2015-04-28T19:08:41
| 2015-04-28T19:08:41
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 47
|
cpp
|
MyField.cpp
|
#include "MyField.h"
MyField::~MyField()
{
}
|
7db7fe445b047f57dd9e9cc5acab815323c0ef5f
|
253b6e90a3d00de25e3d82e096dd38bfc6020be1
|
/src/model.cpp
|
aab9249a6ec074f681c6f2944532191895b71214
|
[] |
no_license
|
pwon111/binary
|
0cc1aed2b46706ffa4ad059c36f8c8fcca223332
|
a952e895f1dcc2a01917bafca449ecb007c6ff6a
|
refs/heads/master
| 2021-01-10T04:45:10.448627
| 2015-11-17T02:15:16
| 2015-11-17T02:15:16
| 46,317,131
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 8,294
|
cpp
|
model.cpp
|
#include "model.hpp"
/****************************** ModelID Controller ****************************/
const ModelID registerNewModelID() {
return next_model_id++;
}
/******************************* ModelName Struct *****************************/
// ModelID ModelName::max_id = 0;
// unordered_map<ModelID, ModelName*> ModelName::registered_models;
// ModelID ModelName::registerModelName(char* name) {
// assert(max_id >= 0);
// assert(registered_models.find(max_id) == registered_models.end());
// ModelName* new_model_name = new ModelName(name);
// registered_models[max_id] = new_model_name;
// max_id++;
// return max_id - 1;
// }
// ModelName* ModelName::getModelName(ModelID id) {
// assert(registered_models.find(id) != registered_models.end());
// return registered_models[id];
// }
// ModelName::ModelName(char* name) : name() {
// for (int i = 0; i < model_name_buffer_size; i++) {
// this->name[i] = name[i];
// }
// }
// ModelName::~ModelName() {
// }
// const bool ModelName::operator==(const ModelName& rhs) const {
// for (unsigned int i = 0; i < model_name_buffer_size; i++) {
// if (this->name[i] == rhs.name[i]) {
// return false;
// }
// }
// return true;
// }
// const bool ModelName::operator==(const char* name) const {
// for (unsigned int i = 0; i < model_name_buffer_size; i++) {
// if (this->name[i] == name[i]) {
// return false;
// }
// }
// return true;
// }
// const bool ModelName::operator!=(const ModelName& rhs) const {
// for (unsigned int i = 0; i < model_name_buffer_size; i++) {
// if (this->name[i] != rhs.name[i]) {
// return true;
// }
// }
// return false;
// }
// const bool ModelName::operator!=(const char* name) const {
// for (unsigned int i = 0; i < model_name_buffer_size; i++) {
// if (this->name[i] != name[i]) {
// return true;
// }
// }
// return false;
// }
/********************************* Model Class ********************************/
unordered_map<ModelID, Model*> Model::models;
Model::Model() :
vbo_vertex_id(),
vbo_index_id(),
v_count(),
vertices(NULL),
indices(NULL),
tes_group_begin()
{
//
}
Model::~Model() {
delete[] this->vertices;
delete[] this->indices;
}
GLuint Model::getVBOVertexID() {
return this->vbo_vertex_id;
}
GLuint Model::getVBOIndexID() {
return this->vbo_index_id;
}
GLuint Model::getVCount() {
return this->v_count;
}
Vertex* Model::getVertices() {
return this->vertices;
}
GLuint* Model::getIndices() {
return this->indices;
}
vector<GLuint>& Model::getTesGroupBegin() {
return this->tes_group_begin;
}
Model* Model::createModel(ModelID model_id) {
if (models.find(model_id) == models.end()) {
printf("%d BLAH\n", model_id);
Model* new_model = new Model();
new_model->genModelBRUTE(model_id);
models[model_id] = new_model;
} else {
fprintf(stderr,
"ERROR Model::create model for ModelID %d already exists\n",
model_id);
}
}
Model* Model::getModel(ModelID model_id) {
if (models.find(model_id) != models.end()) {
return models[model_id];
} else {
fprintf(stderr,
"ERROR Model::get model for ModelID %d does not exist\n",
model_id);
}
}
void Model::deleteModel(ModelID model_id) {
if (models.find(model_id) != models.end()) {
delete models[model_id];
// FIX HERE: remove setup for vbo if setup?
} else {
fprintf(stderr,
"ERROR Model::delete model for ModelID %d does not exist\n",
model_id);
}
}
bool Model::exists(ModelID model_id) {
return models.find(model_id) != models.end();
}
void Model::genModelBRUTE(ModelID model_id) {
printf("%d %d\n", terrain_block_model_id, core_model_id);
if (model_id == terrain_block_model_id) {
this->genTerrainBlockModelBRUTE();
} else if (model_id == core_model_id) {
this->genCoreModelBRUTE();
} else {
printf("NOT READY FOR THIS MODEL ID YET\n");
return;
}
// set up vertex VBO
glGenBuffers(1, &(this->vbo_vertex_id));
glBindBuffer(GL_ARRAY_BUFFER, this->vbo_vertex_id);
glBufferData(
GL_ARRAY_BUFFER,
sizeof(Vertex) * this->v_count,
this->vertices,
GL_STATIC_DRAW);
// set up index VBO
glGenBuffers(1, &(this->vbo_index_id));
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, this->vbo_index_id);
glBufferData(
GL_ELEMENT_ARRAY_BUFFER,
sizeof(GLuint) * this->v_count,
this->indices,
GL_STATIC_DRAW);
}
void Model::genTerrainBlockModelBRUTE() {
this->v_count = 4;
this->vertices = new Vertex[this->v_count];
this->indices = new GLuint[this->v_count];
// SW corner
this->vertices[0].coord[0] = -0.45;
this->vertices[0].coord[1] = -0.45;
this->vertices[0].coord[2] = 0;
this->vertices[0].normal[0] = 0.0;
this->vertices[0].normal[1] = 0.0;
this->vertices[0].normal[2] = 1.0;
this->vertices[0].rgb[0] = 1.0;
this->vertices[0].rgb[1] = 0.0;
this->vertices[0].rgb[2] = 0.0;
this->indices[0] = 0;
// NW corner
this->vertices[1].coord[0] = -0.45;
this->vertices[1].coord[1] = 0.45;
this->vertices[1].coord[2] = 0.0;
this->vertices[1].normal[0] = 0.0;
this->vertices[1].normal[1] = 0.0;
this->vertices[1].normal[2] = 1.0;
this->vertices[1].rgb[0] = 1.0;
this->vertices[1].rgb[1] = 0.0;
this->vertices[1].rgb[2] = 0.0;
this->indices[1] = 1;
// SE corner
this->vertices[2].coord[0] = 0.45;
this->vertices[2].coord[1] = -0.45;
this->vertices[2].coord[2] = 0.0;
this->vertices[2].normal[0] = 0.0;
this->vertices[2].normal[1] = 0.0;
this->vertices[2].normal[2] = 1.0;
this->vertices[2].rgb[0] = 1.0;
this->vertices[2].rgb[1] = 0.0;
this->vertices[2].rgb[2] = 0.0;
this->indices[2] = 2;
// NE corner
this->vertices[3].coord[0] = 0.45;
this->vertices[3].coord[1] = 0.45;
this->vertices[3].coord[2] = 0.0;
this->vertices[3].normal[0] = 0.0;
this->vertices[3].normal[1] = 0.0;
this->vertices[3].normal[2] = 1.0;
this->vertices[3].rgb[0] = 1.0;
this->vertices[3].rgb[1] = 0.0;
this->vertices[3].rgb[2] = 0.0;
this->indices[3] = 3;
// update model.roup_begin by marking the first index of this block
this->tes_group_begin.push_back(0);
}
void Model::genCoreModelBRUTE() {
this->v_count = 4;
this->vertices = new Vertex[this->v_count];
this->indices = new GLuint[this->v_count];
// SW corner
this->vertices[0].coord[0] = -0.4;
this->vertices[0].coord[1] = -0.4;
this->vertices[0].coord[2] = 0.5;
this->vertices[0].normal[0] = 0.0;
this->vertices[0].normal[1] = 0.0;
this->vertices[0].normal[2] = 1.0;
this->vertices[0].rgb[0] = 0.0;
this->vertices[0].rgb[1] = 1.0;
this->vertices[0].rgb[2] = 0.0;
this->indices[0] = 0;
// NW corner
this->vertices[1].coord[0] = -0.3;
this->vertices[1].coord[1] = 0.4;
this->vertices[1].coord[2] = 0.5;
this->vertices[1].normal[0] = 0.0;
this->vertices[1].normal[1] = 0.0;
this->vertices[1].normal[2] = 1.0;
this->vertices[1].rgb[0] = 0.0;
this->vertices[1].rgb[1] = 1.0;
this->vertices[1].rgb[2] = 0.0;
this->indices[1] = 1;
// SE corner
this->vertices[2].coord[0] = 0.4;
this->vertices[2].coord[1] = -0.4;
this->vertices[2].coord[2] = 0.5;
this->vertices[2].normal[0] = 0.0;
this->vertices[2].normal[1] = 0.0;
this->vertices[2].normal[2] = 1.0;
this->vertices[2].rgb[0] = 0.0;
this->vertices[2].rgb[1] = 1.0;
this->vertices[2].rgb[2] = 0.0;
this->indices[2] = 2;
// NE corner
this->vertices[3].coord[0] = 0.3;
this->vertices[3].coord[1] = 0.4;
this->vertices[3].coord[2] = 0.5;
this->vertices[3].normal[0] = 0.0;
this->vertices[3].normal[1] = 0.0;
this->vertices[3].normal[2] = 1.0;
this->vertices[3].rgb[0] = 0.0;
this->vertices[3].rgb[1] = 1.0;
this->vertices[3].rgb[2] = 0.0;
this->indices[3] = 3;
this->tes_group_begin.push_back(0);
}
|
0495b5d26135088c2e2b2982ca7c468ad90139c5
|
a403b2e9308c22fb699e5d1336db081921732a35
|
/CommonAsduAnalyzer103/Common103Analyzer.cpp
|
84a09e8fb5050447b958d7986cc19f24853186aa
|
[] |
no_license
|
CMCC-WY/IEC103PacketAnalyzer
|
358278104943a161188f7d3d85ff6c1512d0c018
|
db19bcd4e09fe87f22f42b7e84b83e825b0b6f56
|
refs/heads/master
| 2020-09-10T22:57:33.207435
| 2018-12-24T03:03:23
| 2018-12-24T03:03:23
| 221,858,839
| 0
| 3
| null | 2019-11-15T06:27:48
| 2019-11-15T06:27:45
| null |
GB18030
|
C++
| false
| false
| 48,732
|
cpp
|
Common103Analyzer.cpp
|
#include "Common103Analyzer.h"
#include <stddef.h>
#include <string>
CCommon103Analyzer::CCommon103Analyzer(void)
{
}
CCommon103Analyzer::~CCommon103Analyzer(void)
{
}
int CCommon103Analyzer::SetDuiValue(int nCotNum, int nCommonAddrNum)
{
m_nAsduNum = ASDU_TYPE_NUM_103;
m_nVsqNum = VSQ_NUM_103;
//传入参数错误的时候取默认值
if (nCotNum <= 0 ||
nCommonAddrNum <= 0)
{
m_nCotNum = 2;
m_nCommonAddrNum = 2;
}
else
{
m_nCotNum = nCotNum;
m_nCommonAddrNum = nCommonAddrNum;
}
m_nFirstInfoAddr = m_nAsduNum + m_nVsqNum + m_nCotNum + m_nCommonAddrNum;
memset(m_chErrBuf, '\0', sizeof(m_chErrBuf));
memset(m_chTimeBuf, '\0', sizeof(m_chTimeBuf));
InitAsduFunctionMap();
return 1;
}
int CCommon103Analyzer::GetAsduType()
{
return m_nAsduType;
}//GetAsduType
int CCommon103Analyzer::WriteLog()
{
//TODO
return 1;
}//WriteLog
char* CCommon103Analyzer::GetLastLogMsg()
{
return m_chErrBuf;
}//GetLastLogMsg
int CCommon103Analyzer::InitAsduFunctionMap(void)
{
m_map_asdu_function[1] = &CCommon103Analyzer::AnalyzeAsdu1;
m_map_asdu_function[2] = &CCommon103Analyzer::AnalyzeAsdu2;
m_map_asdu_function[3] = &CCommon103Analyzer::AnalyzeAsdu3;
m_map_asdu_function[4] = &CCommon103Analyzer::AnalyzeAsdu4;
m_map_asdu_function[5] = &CCommon103Analyzer::AnalyzeAsdu5;
m_map_asdu_function[6] = &CCommon103Analyzer::AnalyzeAsdu6;
m_map_asdu_function[8] = &CCommon103Analyzer::AnalyzeAsdu8;
m_map_asdu_function[9] = &CCommon103Analyzer::AnalyzeAsdu9;
m_map_asdu_function[10] = &CCommon103Analyzer::AnalyzeAsdu10;
m_map_asdu_function[11] = &CCommon103Analyzer::AnalyzeAsdu11;
m_map_asdu_function[23] = &CCommon103Analyzer::AnalyzeAsdu23;
m_map_asdu_function[26] = &CCommon103Analyzer::AnalyzeAsdu26;
m_map_asdu_function[27] = &CCommon103Analyzer::AnalyzeAsdu27;
m_map_asdu_function[28] = &CCommon103Analyzer::AnalyzeAsdu28;
m_map_asdu_function[29] = &CCommon103Analyzer::AnalyzeAsdu29;
m_map_asdu_function[30] = &CCommon103Analyzer::AnalyzeAsdu30;
m_map_asdu_function[31] = &CCommon103Analyzer::AnalyzeAsdu31;
return 1;
}//InitAsduFunctionMap
int CCommon103Analyzer::AnalyzeAsduMsg(unsigned char* chMsg, void* p103Data)
{
if (NULL == chMsg ||
NULL == p103Data)
{
sprintf(m_chErrBuf, "AnalyzeAsduMsg Input Param Is Invalid!");
return -1;
}
//获取报文中asdu类型
m_nAsduType = chMsg[ASDU_TYPE_POISION_103];
//在map中寻找相应的解析函数进行报文解析
std::map<int, pFun> ::iterator itor = m_map_asdu_function.find(m_nAsduType);
if (itor == m_map_asdu_function.end())
{
//没有找到对应的解析函数
sprintf(m_chErrBuf, "Asdu103_ Type %d Not Found Corresponding Function!", m_nAsduType);
return -1;
}
else if (NULL == itor->second)
{
sprintf(m_chErrBuf, "Asdu103_ Type %d Corresponding Function Addr Is NULL!", m_nAsduType);
return -1;
}
else
{
return (this->*(itor->second))(chMsg, p103Data);
}
}//AnalyzeAsduMsg
int CCommon103Analyzer::AnalyzeAsdu1(unsigned char* chMsg, void* p103Data)
{
if (NULL == chMsg ||
NULL == p103Data)
{
sprintf(m_chErrBuf, "AnalyzeAsdu1 Input Param Is Invalid!");
return -1;
}
try
{
int nRet = AnalyzeDataUnitIdentifier(chMsg);
if (-1 == nRet)
{
return -1;
}
if (0x01 != m_dataUnitIdent.nType)
{
//asdu类型不匹配
sprintf(m_chErrBuf, "AnalyzeAsdu1 Asdu103_ Type Not Match!");
return -1;
}
unsigned char* pCh = chMsg;
//指向第一个信息体
pCh += m_nFirstInfoAddr;
Asdu103_1 asdu1;
((CC103Data*)p103Data)->vec_Asdu103_1.clear();
asdu1.dui = m_dataUnitIdent;
{
asdu1.nFUN = pCh[0];
asdu1.nINF = pCh[1];
pCh += 2;
AnalyzeDPI(pCh, asdu1.dpi);
pCh += 1;
int n4ByteTime = AnalyzeCP32Time2a(pCh, m_chTimeBuf);
pCh += 4;
memmove(asdu1.ch4ByteTime, m_chTimeBuf, sizeof(asdu1.ch4ByteTime));
AnalyzeSIN(pCh, asdu1.stru_sin);
pCh += 1;
((CC103Data*)p103Data)->vec_Asdu103_1.push_back(asdu1);
}
return 1;
}
catch ( ... )
{
sprintf(m_chErrBuf, "AnalyzeAsdu1 Caught Unhandled Exception!");
return -1;
}
}//AnalyzeAsdu1
int CCommon103Analyzer::AnalyzeAsdu2(unsigned char* chMsg, void* p103Data)
{
if (NULL == chMsg ||
NULL == p103Data)
{
sprintf(m_chErrBuf, "AnalyzeAsdu2 Input Param Is Invalid!");
return -1;
}
try
{
int nRet = AnalyzeDataUnitIdentifier(chMsg);
if (-1 == nRet)
{
return -1;
}
if (0x02 != m_dataUnitIdent.nType)
{
//asdu类型不匹配
sprintf(m_chErrBuf, "AnalyzeAsdu2 Asdu103_ Type Not Match!");
return -1;
}
unsigned char* pCh = chMsg;
//指向第一个信息体
pCh += m_nFirstInfoAddr;
Asdu103_2 asdu2;
((CC103Data*)p103Data)->vec_Asdu103_2.clear();
asdu2.dui = m_dataUnitIdent;
{
asdu2.nFUN = pCh[0];
asdu2.nINF = pCh[1];
pCh += 2;
AnalyzeDPI(pCh, asdu2.dpi);
pCh += 1;
AnalyzeRET(pCh,asdu2.ret);
pCh += 2;
AnalyzeFAN(pCh,asdu2.fan);
pCh += 2;
int n4ByteTime = AnalyzeCP32Time2a(pCh, m_chTimeBuf);
pCh += 4;
memmove(asdu2.ch4ByteTime, m_chTimeBuf, sizeof(asdu2.ch4ByteTime));
AnalyzeSIN(pCh, asdu2.stru_sin);
pCh += 1;
((CC103Data*)p103Data)->vec_Asdu103_2.push_back(asdu2);
}
return 1;
}
catch ( ... )
{
sprintf(m_chErrBuf, "AnalyzeAsdu2 Caught Unhandled Exception!");
return -1;
}
}//AnalyzeAsdu2
int CCommon103Analyzer::AnalyzeAsdu3(unsigned char* chMsg, void* p103Data)
{
if (NULL == chMsg ||
NULL == p103Data)
{
sprintf(m_chErrBuf, "AnalyzeAsdu3 Input Param Is Invalid!");
return -1;
}
try
{
int nRet = AnalyzeDataUnitIdentifier(chMsg);
if (-1 == nRet)
{
return -1;
}
if (0x03 != m_dataUnitIdent.nType)
{
//asdu类型不匹配
sprintf(m_chErrBuf, "AnalyzeAsdu3 Asdu103_ Type Not Match!");
return -1;
}
unsigned char* pCh = chMsg;
//指向第一个信息体
pCh += m_nFirstInfoAddr;
Asdu103_3 asdu3;
((CC103Data*)p103Data)->vec_Asdu103_3.clear();
asdu3.dui = m_dataUnitIdent;
asdu3.nFUN = pCh[0];
asdu3.nINF = pCh[1];
pCh += 2;
MEA tempMea;
for (int i = 0; i < asdu3.dui.vsq.nVsq; i++)
{
AnalyzeMEA(pCh, tempMea);
asdu3.vec_meaValue.push_back(tempMea);
pCh += 2;
}
((CC103Data*)p103Data)->vec_Asdu103_3.push_back(asdu3);
}
catch ( ... )
{
sprintf(m_chErrBuf, "AnalyzeAsdu3 Caught Unhandled Exception!");
return -1;
}
return 1;
}//AnalyzeAsdu3
int CCommon103Analyzer::AnalyzeAsdu4(unsigned char* chMsg, void* p103Data)
{
if (NULL == chMsg ||
NULL == p103Data)
{
sprintf(m_chErrBuf, "AnalyzeAsdu4 Input Param Is Invalid!");
return -1;
}
try
{
int nRet = AnalyzeDataUnitIdentifier(chMsg);
if (-1 == nRet)
{
return -1;
}
if (0x04 != m_dataUnitIdent.nType)
{
//asdu类型不匹配
sprintf(m_chErrBuf, "AnalyzeAsdu4 Asdu103_ Type Not Match!");
return -1;
}
unsigned char* pCh = chMsg;
//指向第一个信息体
pCh += m_nFirstInfoAddr;
Asdu103_4 asdu4;
((CC103Data*)p103Data)->vec_Asdu103_4.clear();
asdu4.dui = m_dataUnitIdent;
{
asdu4.nFUN = pCh[0];
asdu4.nINF = pCh[1];
pCh += 2;
AnalyzeSCL(pCh, asdu4.scl);
pCh += 4;
AnalyzeRET(pCh, asdu4.ret);
pCh += 2;
AnalyzeFAN(pCh, asdu4.fan);
pCh += 2;
int n4ByteTime = AnalyzeCP32Time2a(pCh, m_chTimeBuf);
pCh += 4;
memmove(asdu4.ch4ByteTime, m_chTimeBuf, sizeof(asdu4.ch4ByteTime));
((CC103Data*)p103Data)->vec_Asdu103_4.push_back(asdu4);
}
return 1;
}
catch ( ... )
{
sprintf(m_chErrBuf, "AnalyzeAsdu4 Caught Unhandled Exception!");
return -1;
}
}//AnalyzeAsdu4
int CCommon103Analyzer::AnalyzeAsdu5(unsigned char* chMsg, void* p103Data)
{
if (NULL == chMsg ||
NULL == p103Data)
{
sprintf(m_chErrBuf, "AnalyzeAsdu5 Input Param Is Invalid!");
return -1;
}
try
{
int nRet = AnalyzeDataUnitIdentifier(chMsg);
if (-1 == nRet)
{
return -1;
}
if (0x05 != m_dataUnitIdent.nType)
{
//asdu类型不匹配
sprintf(m_chErrBuf, "AnalyzeAsdu5 Asdu103_ Type Not Match!");
return -1;
}
unsigned char* pCh = chMsg;
//指向第一个信息体
pCh += m_nFirstInfoAddr;
//int i = 0;
Asdu103_5 asdu5;
((CC103Data*)p103Data)->vec_Asdu103_5.clear();
asdu5.dui = m_dataUnitIdent;
asdu5.nFUN = pCh[0];
asdu5.nINF = pCh[1];
pCh += 2;
AnalyzeCOL(pCh, asdu5.col);
pCh += 1;
asdu5.ASCII1 = pCh[0];
asdu5.ASCII2 = pCh[1];
asdu5.ASCII3 = pCh[2];
asdu5.ASCII4 = pCh[3];
asdu5.ASCII5 = pCh[4];
asdu5.ASCII6 = pCh[5];
asdu5.ASCII7 = pCh[6];
asdu5.ASCII8 = pCh[7];
asdu5.FreeValue1 = pCh[8];
asdu5.FreeValue2 = pCh[9];
asdu5.FreeValue3 = pCh[10];
asdu5.FreeValue4 = pCh[11];
((CC103Data*)p103Data)->vec_Asdu103_5.push_back(asdu5);
return 1;
}
catch ( ... )
{
sprintf(m_chErrBuf, "AnalyzeAsdu5 Caught Unhandled Exception!");
return -1;
}
}//AnalyzeAsdu5
int CCommon103Analyzer::AnalyzeAsdu6(unsigned char* chMsg, void* p103Data)
{
if (NULL == chMsg ||
NULL == p103Data)
{
sprintf(m_chErrBuf, "AnalyzeAsdu6 Input Param Is Invalid!");
return -1;
}
try
{
int nRet = AnalyzeDataUnitIdentifier(chMsg);
if (-1 == nRet)
{
return -1;
}
if (0x06 != m_dataUnitIdent.nType)
{
//asdu类型不匹配
sprintf(m_chErrBuf, "AnalyzeAsdu6 Asdu103_ Type Not Match!");
return -1;
}
unsigned char* pCh = chMsg;
//指向第一个信息体
pCh += m_nFirstInfoAddr;
Asdu103_6 asdu6;
((CC103Data*)p103Data)->vec_Asdu103_6.clear();
asdu6.dui = m_dataUnitIdent;
{
asdu6.nFUN = pCh[0];
asdu6.nINF = pCh[1];
pCh += 2;
int n7ByteTime = AnalyzeCP56Time2a(pCh, m_chTimeBuf);
pCh += 7;
memmove(asdu6.ch7ByteTime, m_chTimeBuf, sizeof(asdu6.ch7ByteTime));
((CC103Data*)p103Data)->vec_Asdu103_6.push_back(asdu6);
}
return 1;
}
catch ( ... )
{
sprintf(m_chErrBuf, "AnalyzeAsdu6 Caught Unhandled Exception!");
return -1;
}
}//AnalyzeAsdu6
int CCommon103Analyzer::AnalyzeAsdu8(unsigned char* chMsg, void* p103Data)
{
if (NULL == chMsg ||
NULL == p103Data)
{
sprintf(m_chErrBuf, "AnalyzeAsdu8 Input Param Is Invalid!");
return -1;
}
try
{
int nRet = AnalyzeDataUnitIdentifier(chMsg);
if (-1 == nRet)
{
return -1;
}
if (0x08 != m_dataUnitIdent.nType)
{
//asdu类型不匹配
sprintf(m_chErrBuf, "AnalyzeAsdu8 Asdu103_ Type Not Match!");
return -1;
}
unsigned char* pCh = chMsg;
//指向第一个信息体
pCh += m_nFirstInfoAddr;
Asdu103_8 asdu8;
((CC103Data*)p103Data)->vec_Asdu103_8.clear();
asdu8.dui = m_dataUnitIdent;
{
asdu8.nFUN = pCh[0];
asdu8.nINF = pCh[1];
pCh += 2;
AnalyzeSCN(pCh, asdu8.scn);
pCh += 1;
((CC103Data*)p103Data)->vec_Asdu103_8.push_back(asdu8);
}
return 1;
}
catch (...)
{
sprintf(m_chErrBuf, "AnalyzeAsdu8 Caught Unhandled Exception!");
return -1;
}
}//AnalyzeAsdu8
int CCommon103Analyzer::AnalyzeAsdu9(unsigned char* chMsg, void* p103Data)
{
if (NULL == chMsg ||
NULL == p103Data)
{
sprintf(m_chErrBuf, "AnalyzeAsdu9 Input Param Is Invalid!");
return -1;
}
try
{
int nRet = AnalyzeDataUnitIdentifier(chMsg);
if (-1 == nRet)
{
return -1;
}
if (0x09 != m_dataUnitIdent.nType)
{
//asdu类型不匹配
sprintf(m_chErrBuf, "AnalyzeAsdu9 Asdu103_ Type Not Match!");
return -1;
}
unsigned char* pCh = chMsg;
//指向第一个信息体
pCh += m_nFirstInfoAddr;
Asdu103_9 asdu9;
((CC103Data*)p103Data)->vec_Asdu103_9.clear();
asdu9.dui = m_dataUnitIdent;
asdu9.nFUN = pCh[0];
asdu9.nINF = pCh[1];
pCh += 2;
MEA tempMea;
for (int i = 0; i < asdu9.dui.vsq.nVsq; i++)
{
AnalyzeMEA(pCh, tempMea);
asdu9.vec_meaValue.push_back(tempMea);
pCh += 2;
}
((CC103Data*)p103Data)->vec_Asdu103_9.push_back(asdu9);
return 1;
}
catch(...)
{
sprintf(m_chErrBuf, "AnalyzeAsdu9 Caught Unhandled Exception!");
return -1;
}
}//AnalyzeAsdu9
int CCommon103Analyzer::AnalyzeAsdu10(unsigned char* chMsg, void* p103Data)
{
if (NULL == chMsg ||
NULL == p103Data)
{
sprintf(m_chErrBuf, "AnalyzeAsdu10 Input Param Is Invalid!");
return -1;
}
try
{
int nRet = AnalyzeDataUnitIdentifier(chMsg);
if (-1 == nRet)
{
return -1;
}
if (0x0a != m_dataUnitIdent.nType)
{
//asdu类型不匹配
sprintf(m_chErrBuf, "AnalyzeAsdu10 Asdu103_ Type Not Match!");
return -1;
}
unsigned char* pCh = chMsg;
//指向第一个信息体
pCh += m_nFirstInfoAddr;
Asdu103_10 asdu10;
((CC103Data*)p103Data)->vec_Asdu103_10.clear();
asdu10.dui = m_dataUnitIdent;
asdu10.nGENTYP = pCh[0];
pCh += 1;
asdu10.nINF = pCh[0];
pCh += 1;
asdu10.nRII = pCh[0];
pCh += 1;
AnalyzeNGD(pCh, asdu10.ngd);
pCh += 1;
unsigned int i = 0;
unsigned int j = 0;
Asdu103_10DataSet tempAsdu103_10DataSet;
GID tempgid;
for (i = 0; i<asdu10.ngd.nNo; i++)
{
AnalyzeGIN(pCh, tempAsdu103_10DataSet.gin);
pCh += 2;
AnalyzeKOD(pCh, tempAsdu103_10DataSet.nKod);
pCh += 1;
AnalyzeGDD(pCh, tempAsdu103_10DataSet.gdd);
pCh += 3;
for (j = 0; j < tempAsdu103_10DataSet.gdd.nNum; j++)
{
AnalyzeGID(pCh, tempAsdu103_10DataSet.gdd.nType, tempAsdu103_10DataSet.gdd.nSize, tempgid);
pCh += tempAsdu103_10DataSet.gdd.nSize;
tempAsdu103_10DataSet.vec_GID.push_back(tempgid);
}
asdu10.vec_Asdu103_10DataSet.push_back(tempAsdu103_10DataSet);
}
((CC103Data*)p103Data)->vec_Asdu103_10.push_back(asdu10);
return 1;
}
catch(...)
{
sprintf(m_chErrBuf, "AnalyzeAsdu9 Caught Unhandled Exception!");
return -1;
}
}//AnalyzeAsdu10
int CCommon103Analyzer::AnalyzeAsdu11(unsigned char* chMsg, void* p103Data)
{
if (NULL == chMsg ||
NULL == p103Data)
{
sprintf(m_chErrBuf, "AnalyzeAsdu11 Input Param Is Invalid!");
return -1;
}
try
{
int nRet = AnalyzeDataUnitIdentifier(chMsg);
if (-1 == nRet)
{
return -1;
}
if (0x0b != m_dataUnitIdent.nType)
{
//asdu类型不匹配
sprintf(m_chErrBuf, "AnalyzeAsdu11 Asdu103_ Type Not Match!");
return -1;
}
unsigned char* pCh = chMsg;
//指向第一个信息体
pCh += m_nFirstInfoAddr;
Asdu103_11 asdu11;
((CC103Data*)p103Data)->vec_Asdu103_11.clear();
asdu11.dui = m_dataUnitIdent;
asdu11.nGENFUN = pCh[0];
pCh += 1;
asdu11.nINF = pCh[0];
pCh += 1;
asdu11.nRII = pCh[0];
pCh += 1;
AnalyzeGIN(pCh, asdu11.gin);
pCh += 2;
AnalyzeNDE(pCh, asdu11.nde);
pCh += 1;
unsigned int i = 0;
unsigned int j = 0;
Asdu103_11DataSet tempAsdu103_11DataSet;
GID tempgid;
for (i = 0; i<asdu11.nde.nNO; i++)
{
AnalyzeKOD(pCh, tempAsdu103_11DataSet.nKod);
pCh += 1;
AnalyzeGDD(pCh, tempAsdu103_11DataSet.gdd);
pCh += 3;
for (j = 0; j < tempAsdu103_11DataSet.gdd.nNum; j++)
{
AnalyzeGID(pCh, tempAsdu103_11DataSet.gdd.nType, tempAsdu103_11DataSet.gdd.nSize, tempgid);
pCh += tempAsdu103_11DataSet.gdd.nSize;
tempAsdu103_11DataSet.vec_GID.push_back(tempgid);
}
asdu11.vec_Asdu103_11DataSet.push_back(tempAsdu103_11DataSet);
}
((CC103Data*)p103Data)->vec_Asdu103_11.push_back(asdu11);
return 1;
}
catch(...)
{
sprintf(m_chErrBuf, "AnalyzeAsdu9 Caught Unhandled Exception!");
return -1;
}
}//AnalyzeAsdu11
int CCommon103Analyzer::AnalyzeAsdu23(unsigned char* chMsg, void* p103Data)
{
if (NULL == chMsg ||
NULL == p103Data)
{
sprintf(m_chErrBuf, "AnalyzeAsdu23 Input Param Is Invalid!");
return -1;
}
try
{
int nRet = AnalyzeDataUnitIdentifier(chMsg);
if (-1 == nRet)
{
return -1;
}
if (0x17 != m_dataUnitIdent.nType)
{
//asdu类型不匹配
sprintf(m_chErrBuf, "AnalyzeAsdu26 Asdu103_ Type Not Match!");
return -1;
}
unsigned char* pCh = chMsg;
//指向第一个信息体
pCh += m_nFirstInfoAddr;
Asdu103_23 asdu23;
((CC103Data*)p103Data)->vec_Asdu103_23.clear();
asdu23.dui = m_dataUnitIdent;
asdu23.nFUN = pCh[0];
//INF规约规定为0
pCh += 2;
Asdu103_23DataSet tempAsdu103_23DataSet;
unsigned int i = 0;
for (i = 1; i <= m_dataUnitIdent.vsq.nVsq; i++)
{
AnalyzeFAN(pCh, tempAsdu103_23DataSet.fan);
pCh += 2;
AnalyzeSOF(pCh, tempAsdu103_23DataSet.sof);
pCh += 1;
int n7ByteTime = AnalyzeCP56Time2a(pCh, m_chTimeBuf);
pCh += 7;
memmove(tempAsdu103_23DataSet.ch7ByteTime, m_chTimeBuf, sizeof(tempAsdu103_23DataSet.ch7ByteTime));
asdu23.vec_Asdu103_23DataSet.push_back(tempAsdu103_23DataSet);
}
((CC103Data*)p103Data)->vec_Asdu103_23.push_back(asdu23);
return 1;
}
catch (...)
{
sprintf(m_chErrBuf, "AnalyzeAsdu23 Caught Unhandled Exception!");
return -1;
}
}//AnalyzeAsdu23
int CCommon103Analyzer::AnalyzeAsdu26(unsigned char* chMsg, void* p103Data)
{
if (NULL == chMsg ||
NULL == p103Data)
{
sprintf(m_chErrBuf, "AnalyzeAsdu26 Input Param Is Invalid!");
return -1;
}
try
{
int nRet = AnalyzeDataUnitIdentifier(chMsg);
if (-1 == nRet)
{
return -1;
}
if (0x1A != m_dataUnitIdent.nType)
{
//asdu类型不匹配
sprintf(m_chErrBuf, "AnalyzeAsdu26 Asdu103_ Type Not Match!");
return -1;
}
unsigned char* pCh = chMsg;
//指向第一个信息体
pCh += m_nFirstInfoAddr;
Asdu103_26 asdu26;
((CC103Data*)p103Data)->vec_Asdu103_26.clear();
asdu26.dui = m_dataUnitIdent;
asdu26.nFUN = pCh[0];
pCh += 3;
AnalyzeTOV(pCh, asdu26.tov);
pCh += 1;
AnalyzeFAN(pCh, asdu26.fan);
pCh += 2;
AnalyzeNOF(pCh, asdu26.nof);
pCh += 2;
AnalyzeNOC(pCh, asdu26.noc);
pCh += 1;
AnalyzeNOE(pCh, asdu26.noe);
pCh += 2;
AnalyzeINT(pCh, asdu26.stru_INT);
pCh += 2;
int n4ByteTime = AnalyzeCP32Time2a(pCh, m_chTimeBuf);
pCh += 4;
memmove(asdu26.ch4ByteTime, m_chTimeBuf, sizeof(asdu26.ch4ByteTime));
((CC103Data*)p103Data)->vec_Asdu103_26.push_back(asdu26);
return 1;
}
catch (...)
{
sprintf(m_chErrBuf, "AnalyzeAsdu26 Caught Unhandled Exception!");
return -1;
}
}//AnalyzeAsdu26
int CCommon103Analyzer::AnalyzeAsdu27(unsigned char* chMsg, void* p103Data)
{
if (NULL == chMsg ||
NULL == p103Data)
{
sprintf(m_chErrBuf, "AnalyzeAsdu27 Input Param Is Invalid!");
return -1;
}
try
{
int nRet = AnalyzeDataUnitIdentifier(chMsg);
if (-1 == nRet)
{
return -1;
}
if (0x1B != m_dataUnitIdent.nType)
{
//asdu类型不匹配
sprintf(m_chErrBuf, "AnalyzeAsdu27 Asdu103_ Type Not Match!");
return -1;
}
unsigned char* pCh = chMsg;
//指向第一个信息体
pCh += m_nFirstInfoAddr;
Asdu103_27 asdu27;
((CC103Data*)p103Data)->vec_Asdu103_27.clear();
asdu27.dui = m_dataUnitIdent;
asdu27.nFUN = pCh[0];
pCh += 3;
AnalyzeTOV(pCh, asdu27.tov);
pCh += 1;
AnalyzeFAN(pCh, asdu27.fan);
pCh += 2;
AnalyzeACC(pCh, asdu27.acc);
pCh += 1;
//一次额定值
AnalyzeIEEE754(pCh, asdu27.fPrimValue);
pCh += 4;
//二次额定值
AnalyzeIEEE754(pCh, asdu27.fSecValue);
pCh += 4;
//参比因子
AnalyzeIEEE754(pCh, asdu27.fRatio);
pCh += 4;
((CC103Data*)p103Data)->vec_Asdu103_27.push_back(asdu27);
return 1;
}
catch (...)
{
sprintf(m_chErrBuf, "AnalyzeAsdu27 Caught Unhandled Exception!");
return -1;
}
}//AnalyzeAsdu27
int CCommon103Analyzer::AnalyzeAsdu28(unsigned char* chMsg, void* p103Data)
{
if (NULL == chMsg ||
NULL == p103Data)
{
sprintf(m_chErrBuf, "AnalyzeAsdu28 Input Param Is Invalid!");
return -1;
}
try
{
int nRet = AnalyzeDataUnitIdentifier(chMsg);
if (-1 == nRet)
{
return -1;
}
if (0x1C != m_dataUnitIdent.nType)
{
//asdu类型不匹配
sprintf(m_chErrBuf, "AnalyzeAsdu28 Asdu103_ Type Not Match!");
return -1;
}
unsigned char* pCh = chMsg;
//指向第一个信息体
pCh += m_nFirstInfoAddr;
Asdu103_28 asdu28;
((CC103Data*)p103Data)->vec_Asdu103_28.clear();
asdu28.dui = m_dataUnitIdent;
asdu28.nFUN = pCh[0];
pCh += 4;
AnalyzeFAN(pCh, asdu28.fan);
pCh += 2;
((CC103Data*)p103Data)->vec_Asdu103_28.push_back(asdu28);
return 1;
}
catch (...)
{
sprintf(m_chErrBuf, "AnalyzeAsdu28 Caught Unhandled Exception!");
return -1;
}
}//AnalyzeAsdu28
int CCommon103Analyzer::AnalyzeAsdu29(unsigned char* chMsg, void* p103Data)
{
if (NULL == chMsg ||
NULL == p103Data)
{
sprintf(m_chErrBuf, "AnalyzeAsdu29 Input Param Is Invalid!");
}
try
{
int nRet = AnalyzeDataUnitIdentifier(chMsg);
if (-1 == nRet)
{
return -1;
}
if (0x1d != m_dataUnitIdent.nType)
{
//asdu类型不匹配
sprintf(m_chErrBuf, "AnalyzeAsdu29 Asdu103_ Type Not Match!");
return -1;
}
unsigned char* pCh = chMsg;
//指向第一个信息体
pCh += m_nFirstInfoAddr;
Asdu103_29 asdu29;
((CC103Data*)p103Data)->vec_Asdu103_29.clear();
asdu29.dui = m_dataUnitIdent;
asdu29.nFUN = pCh[0];
pCh += 2;
AnalyzeFAN(pCh, asdu29.fan);
pCh += 2;
AnalyzeNOT(pCh, asdu29.stru_NOT);
pCh += 1;
AnalyzeTAP(pCh, asdu29.stru_TAP);
pCh += 2;
Asdu103_29DataSet tempAsdu103_29DataSet;
unsigned int i = 0;
for (i = 1; i <= asdu29.stru_NOT.nNot; i++)
{
tempAsdu103_29DataSet.nStateFUN = pCh[0];
tempAsdu103_29DataSet.nStateINF = pCh[1];
pCh += 2;
AnalyzeDPI(pCh, tempAsdu103_29DataSet.dpi);
pCh += 1;
asdu29.vec_Asdu103_29DataSet.push_back(tempAsdu103_29DataSet);
}
((CC103Data*)p103Data)->vec_Asdu103_29.push_back(asdu29);
return 1;
}
catch (...)
{
sprintf(m_chErrBuf, "AnalyzeAsdu29 Caught Unhandled Exception!");
return -1;
}
}//AnalyzeAsdu29
int CCommon103Analyzer::AnalyzeAsdu30(unsigned char* chMsg, void* p103Data)
{
if (NULL == chMsg ||
NULL == p103Data)
{
sprintf(m_chErrBuf, "AnalyzeAsdu30 Input Param Is Invalid!");
return -1;
}
try
{
int nRet = AnalyzeDataUnitIdentifier(chMsg);
if (-1 == nRet)
{
return -1;
}
if (0x1e != m_dataUnitIdent.nType)
{
//asdu类型不匹配
sprintf(m_chErrBuf, "AnalyzeAsdu30 Asdu103_ Type Not Match!");
return -1;
}
unsigned char* pCh = chMsg;
//指向第一个信息体
pCh += m_nFirstInfoAddr;
unsigned int i = 0;
Asdu103_30 asdu30;
((CC103Data*)p103Data)->vec_Asdu103_30.clear();
asdu30.dui = m_dataUnitIdent;
asdu30.nFUN = pCh[0];
pCh += 3;
AnalyzeTOV(pCh, asdu30.tov);
pCh += 1;
AnalyzeFAN(pCh, asdu30.fan);
pCh += 2;
AnalyzeACC(pCh, asdu30.acc);
pCh += 1;
AnalyzeNDV(pCh, asdu30.ndv);
pCh += 2;
AnalyzeNFE(pCh, asdu30.nfe);
pCh += 2;
if (asdu30.ndv.nNDV > 25)
{
sprintf(m_chErrBuf, "NDV is larger than 25,error!");
return -1;
}
//扰动值SDV
for (i=0; i < asdu30.ndv.nNDV; i++)
{
int nSign = (0x80 == (pCh[1] & 0x80)) ? 1 : 0;//符号位
float fvalue = 0.0;
if (1 == nSign)//负数
{
fvalue = -1.0 * (float)((~((pCh[1] << 8) | pCh[0]) & 0xffff) + 0x0001) / 0x8000;
}
else if (0 == nSign)//正数
{
fvalue = (float)((pCh[1] << 8) | pCh[0]) / 0x8000;
}
asdu30.sdv[i] = fvalue;
pCh += 2;
}
((CC103Data*)p103Data)->vec_Asdu103_30.push_back(asdu30);
return 1;
}
catch ( ... )
{
sprintf(m_chErrBuf, "AnalyzeAsdu30 Caught Unhandled Exception!");
return -1;
}
}//AnalyzeAsdu30
int CCommon103Analyzer::AnalyzeAsdu31(unsigned char* chMsg, void* p103Data)
{
if (NULL == chMsg ||
NULL == p103Data)
{
sprintf(m_chErrBuf, "AnalyzeAsdu31 Input Param Is Invalid!");
return -1;
}
try
{
int nRet = AnalyzeDataUnitIdentifier(chMsg);
if (-1 == nRet)
{
return -1;
}
if (0x1f != m_dataUnitIdent.nType)
{
//asdu类型不匹配
sprintf(m_chErrBuf, "AnalyzeAsdu31 Asdu103_ Type Not Match!");
return -1;
}
unsigned char* pCh = chMsg;
//指向第一个信息体
pCh += m_nFirstInfoAddr;
Asdu103_31 asdu31;
((CC103Data*)p103Data)->vec_Asdu103_31.clear();
asdu31.dui = m_dataUnitIdent;
asdu31.nFUN = pCh[0];
pCh += 2;
AnalyzeTOO(pCh, asdu31.too);
pCh += 1;
AnalyzeTOV(pCh, asdu31.tov);
pCh += 1;
AnalyzeFAN(pCh, asdu31.fan);
pCh += 2;
AnalyzeACC(pCh, asdu31.acc);
pCh += 1;
((CC103Data*)p103Data)->vec_Asdu103_31.push_back(asdu31);
return 1;
}
catch ( ... )
{
sprintf(m_chErrBuf, "AnalyzeAsdu31 Caught Unhandled Exception!");
return -1;
}
}//AnalyzeAsdu31
int CCommon103Analyzer::AnalyzeCP56Time2a(unsigned char* chMsg, char chTimeBuf[TIME_BUF_SIZE_103])
{
if (NULL == chMsg ||
NULL == chTimeBuf)
{
sprintf(m_chErrBuf, "AnalyzeCP56Time2a Input Param Is Invalid!");
return -1;
}
try
{
unsigned char* pCh = chMsg;
int nYear = pCh[6] & 0x7f;
int nMonth = pCh[5] & 0x0f;
int nDay = pCh[4] & 0x1f;
int nDate = pCh[4] & 0xe0;
int nHour = pCh[3] & 0x1f;//没有考虑夏令时标志位
int nMinute = pCh[2] & 0x3f;//没有考虑非法标志位
int nMillSec = (pCh[1] << 8) | pCh[0];
memset(chTimeBuf, '\0', sizeof(chTimeBuf));
if (nYear < 70)
{
nYear = nYear + 2000;
}
else if (nYear >= 70)
{
nYear = nYear + 1900;
}
sprintf(chTimeBuf, "%04d-%02d-%02d %02d:%02d:%02d.%03d", nYear, nMonth, nDay, nHour, nMinute, nMillSec / 1000, nMillSec % 1000);
return 1;
}
catch( ... )
{
sprintf(m_chErrBuf, "AnalyzeCP56Time2a Caught Unhandled Exception!");
return -1;
}
}//AnalyzeCP56Time2a
int CCommon103Analyzer::AnalyzeCP16Time2a(unsigned char* chMsg, char chTimeBuf[TIME_BUF_SIZE_103])
{
if (NULL == chMsg ||
NULL == chTimeBuf)
{
sprintf(m_chErrBuf, "AnalyzeCP16Time2a Input Param Is Invalid!");
return -1;
}
try
{
unsigned char* pCh = chMsg;
int nTime = (chMsg[1] << 8) | chMsg[0];
memset(chTimeBuf, '\0', sizeof(chTimeBuf));
sprintf(chTimeBuf, "%04d-%02d-%02d %02d:%02d:%03d.%03d", 0, 0, 0, 0, 0, nTime/1000, nTime%1000);
return 1;//标准规定2字节时标范围是0~59999ms,需要调用者自己判断正确与否
}
catch ( ... )
{
sprintf(m_chErrBuf, "AnalyzeCP16Time2a Caught Unhandled Exception!");
return -1;
}
}//AnalyzeCP16Time2a
int CCommon103Analyzer::AnalyzeCP24Time2a(unsigned char* chMsg, char chTimeBuf[TIME_BUF_SIZE_103])
{
if (NULL == chMsg ||
NULL == chTimeBuf)
{
sprintf(m_chErrBuf, "AnalyzeCP24Time2a Input Param Is Invalid!");
return -1;
}
try
{
unsigned char* pCh = chMsg;
int nMinute = pCh[2] & 0x3f;//未考虑有效位
int nMillSec = (pCh[1] << 8) | pCh[0];
memset(chTimeBuf, '\0', sizeof(chTimeBuf));
sprintf(chTimeBuf, "%04d-%02d-%02d %02d:%02d:%02d.%03d", 0, 0, 0, 0, nMinute, nMillSec / 1000, nMillSec % 1000);
return 1;
}
catch ( ... )
{
sprintf(m_chErrBuf, "AnalyzeCP24Time2a Caught Unhandled Exception!");
return -1;
}
}//AnalyzeCP24Time2a
int CCommon103Analyzer::AnalyzeCP32Time2a(unsigned char* chMsg, char chTimeBuf[TIME_BUF_SIZE_103])
{
if (NULL == chMsg ||
NULL == chTimeBuf)
{
sprintf(m_chErrBuf, "AnalyzeCP32Time2a Input Param Is Invalid!");
return -1;
}
try
{
unsigned char* pCh = chMsg;
int nHour = pCh[3] & 0x1f;//没有考虑夏令时标志位
int nMinute = pCh[2] & 0x3f;//没有考虑非法标志位
int nMillSec = (pCh[1] << 8) | pCh[0];
memset(chTimeBuf, '\0', sizeof(chTimeBuf));
sprintf(chTimeBuf, "%04d-%02d-%02d %02d:%02d:%02d.%03d", 0, 0, 0, nHour, nMinute, nMillSec /1000 , nMillSec % 1000);
return 1;
}
catch (...)
{
sprintf(m_chErrBuf, "AnalyzeCP32Time2a Caught Unhandled Exception!");
return -1;
}
}//AnalyzeCP32Time2a
int CCommon103Analyzer::RevertByteOrder(unsigned char* chMsg, const int nLength, unsigned int& nRet)
{
unsigned char* pCh = chMsg;
int nTemp = nLength;
int nTotalValue = 0;
int nByteValue;
while (nTemp > 0)
{
nByteValue = *(pCh + nTemp - 1) << ((nTemp - 1)*8);
nTotalValue |= nByteValue;
nTemp --;
}
nRet = nTotalValue;
return 1;
}//RevertByteOrder
int CCommon103Analyzer::AnalyzeAsduType(unsigned char* chMsg)
{
return chMsg[0];
}//AnalyzeAsduType
int CCommon103Analyzer::AnalyzeVsq(unsigned char* chMsg, unsigned int& nNum)
{
unsigned char* pCh = chMsg;
//最高字节是chMsg[m_nVsqNum]这个值,将其按位与0x80得到最高位,此位表明后续的信息体中的元素的信息体地址是连续的(1_0x80)还是断续的(0_0x00)
int nVariable = *(pCh + m_nVsqNum -1) & 0x80;
//之后置最高字节的最高位为0,获取信息体个数,结果存在nNum中
*(pCh + m_nVsqNum -1) = *(pCh + m_nVsqNum -1) & 0x7f;
RevertByteOrder(pCh, m_nVsqNum, nNum);
//返回信息体地址顺序规则给调用者
if (0x80 == nVariable)
{
return 1;
}
else if (0x00 == nVariable)
{
return 0;
}
return -1;
}//AnalyzeVsq
int CCommon103Analyzer::AnalyzeCOT(unsigned char* chMsg)
{
unsigned int nNum;
RevertByteOrder(chMsg, m_nCotNum, nNum);
return nNum;
}//AnalyzeCOT
int CCommon103Analyzer::AnalyzeCommonAddr(unsigned char* chMsg)
{
unsigned int nNum;
RevertByteOrder(chMsg, m_nCommonAddrNum, nNum);
return nNum;
}//AnalyzeCommonAddr
int CCommon103Analyzer::AnalyzeDataUnitIdentifier(unsigned char* chMsg)
{
InitDataUnitIdentifier();
unsigned char* pCh = chMsg;
m_dataUnitIdent.nType = AnalyzeAsduType(pCh);
if (m_dataUnitIdent.nType > 0)
{
pCh += m_nAsduNum;
}
else
{
return -1;
}
m_dataUnitIdent.vsq.nContinuous = AnalyzeVsq(pCh, m_dataUnitIdent.vsq.nVsq);
if (-1 != m_dataUnitIdent.vsq.nVsq)
{
pCh += m_nVsqNum;
}
else
{
return -1;
}
m_dataUnitIdent.nCot = AnalyzeCOT(pCh);
if (-1 != m_dataUnitIdent.nCot)
{
pCh += m_nCotNum;
}
else
{
return -1;
}
m_dataUnitIdent.nCommonAddr = AnalyzeCommonAddr(pCh);
if (-1 != m_dataUnitIdent.nCommonAddr)
{
pCh += m_nCommonAddrNum;
}
else
{
return -1;
}
return 1;
}//AnalyzeDataUnitIdentifier
int CCommon103Analyzer::InitDataUnitIdentifier(void)
{
m_dataUnitIdent.nCommonAddr = 0;
m_dataUnitIdent.nCot = 0;
m_dataUnitIdent.nType = 0;
m_dataUnitIdent.vsq.nContinuous = 0;
m_dataUnitIdent.vsq.nVsq = 0;
return 1;
}//InitDataUnitIdentifier
int CCommon103Analyzer::AnalyzeInfoObjAddr(unsigned char* chMsg)
{
unsigned int nNum;
RevertByteOrder(chMsg, m_nInfObjAddrNum, nNum);
return nNum;
}//AnalyzeInfoObjAddr
int CCommon103Analyzer::AnalyzeNVA(unsigned char* chMsg, float& fValue)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
int nSign = (0x80 == (pCh[1] & 0x80))? 1:0;//符号位
if (1 == nSign)//负数
{
fValue = -1.0 * (float)((~((pCh[1] << 8 ) | pCh[0]) & 0xffff) + 0x0001) / 0x8000;
}
else if (0 == nSign)//正数
{
fValue = (float)((pCh[1] << 8 ) | pCh[0]) / 0x8000;
}
return 1;
}
catch ( ... )
{
return -1;
}
}//AnalyzeNVA
int CCommon103Analyzer::AnalyzeSVA(unsigned char* chMsg, int& nValue)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
nValue = (pCh[1] << 8) | pCh[0];
return 1;
}
catch ( ... )
{
return -1;
}
}//AnalyzeSVA
int CCommon103Analyzer::AnalyzeIEEE754(unsigned char* chMsg, float& fValue)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
int nTemp = (pCh[3] << 24) + (pCh[2] << 16) + (pCh[1] << 8) + pCh[0];
memcpy(&fValue, &nTemp, 4);
return 1;
}
catch ( ... )
{
return -1;
}
}//AnalyzeIEEE754
int CCommon103Analyzer::AnalyzeDPI(unsigned char* chMsg, DPI& dpi)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
dpi.nDpi = pCh[0] & 0x03;
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeDPI
int CCommon103Analyzer::AnalyzeSIN(unsigned char* chMsg, SIN& struc_sin)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
struc_sin.nSIN = pCh[0];
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeSIN
int CCommon103Analyzer::AnalyzeRET(unsigned char* chMsg, RET& ret)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
ret.nRET = (pCh[1] << 8) | pCh[0];
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeRET
int CCommon103Analyzer::AnalyzeFAN(unsigned char* chMsg, FAN&fan)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
fan.nFAN = (pCh[1] << 8) | pCh[0];
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeFAN
int CCommon103Analyzer::AnalyzeSCL(unsigned char* chMsg, SCL& scl)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
AnalyzeIEEE754(pCh, scl.fSCL);
//int nTemp = (pCh[3] << 24) + (pCh[2] << 16) + (pCh[1] << 8) + pCh[0];
//memcpy(&scl.fSCL, &nTemp, 4);
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeSCL
int CCommon103Analyzer::AnalyzeCOL(unsigned char* chMsg, COL& col)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
col.nCOL = pCh[0];
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeSIN
int CCommon103Analyzer::AnalyzeSCN(unsigned char* chMsg, SCN& scn)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
scn.nSCN = pCh[0];
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeSCN
int CCommon103Analyzer::AnalyzeTOV(unsigned char* chMsg, TOV& tov)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
tov.nTOV = pCh[0];
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeTOV
int CCommon103Analyzer::AnalyzeNOF(unsigned char* chMsg, NOF& nof)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
nof.nNOF = (pCh[1] << 8) | pCh[0];
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeNOF
int CCommon103Analyzer::AnalyzeNOC(unsigned char* chMsg, NOC& noc)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
noc.nNOC = pCh[0];
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeNOC
int CCommon103Analyzer::AnalyzeNOE(unsigned char* chMsg, NOE& noe)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
noe.nNOE = (pCh[1] << 8) | pCh[0];
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeNOC
int CCommon103Analyzer::AnalyzeINT(unsigned char* chMsg, INT& stru_INT)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
stru_INT.nINT = (pCh[1] << 8) | pCh[0];
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeINT
int CCommon103Analyzer::AnalyzeACC(unsigned char* chMsg, ACC& acc)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
acc.nACC = pCh[0];
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeACC
int CCommon103Analyzer::AnalyzeTOO(unsigned char* chMsg, TOO& too)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
too.nToo = pCh[0];
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeACC
int CCommon103Analyzer::AnalyzeNDV(unsigned char* chMsg, NDV& ndv)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
ndv.nNDV = (pCh[1] << 8) | pCh[0];
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeNDV
int CCommon103Analyzer::AnalyzeNFE(unsigned char* chMsg, NFE& nfe)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
nfe.nNFE = (pCh[1] << 8) | pCh[0];
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeNFE
int CCommon103Analyzer::AnalyzeNOT(unsigned char* chMsg, NOT& stru_NOT)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
stru_NOT.nNot = pCh[0];
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeNOT
int CCommon103Analyzer::AnalyzeTAP(unsigned char* chMsg, TAP& stru_TAP)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
stru_TAP.nTap = (pCh[1] << 8) | pCh[0];
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeTAP
int CCommon103Analyzer::AnalyzeSOF(unsigned char* chMsg, SOF& sof)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
sof.nTP = (0x01 == (pCh[0] & 0x01)) ? 1 : 0;
sof.nTM = (0x02 == (pCh[0] & 0x02)) ? 1 : 0;
sof.nTEST = (0x04 == (pCh[0] & 0x04)) ? 1 : 0;
sof.nOTEV = (0x08 == (pCh[0] & 0x08)) ? 1 : 0;
sof.nRES = (pCh[0] >> 4) & 0x0f;
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeSOF
int CCommon103Analyzer::AnalyzeMEA(unsigned char* chMsg, MEA& mea)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
mea.nOV = (0x01 == (pCh[0] & 0x01)) ? 1 : 0;
mea.nER = (0x02 == (pCh[0] & 0x02)) ? 1 : 0;
mea.nRES = (0x04 == (pCh[0] & 0x04)) ? 1 : 0;
int nSign = (0x80 == (pCh[1] & 0x80)) ? 1 : 0;//符号位
if (1 == nSign)//负数
{
mea.fMVAL = -1.0 * (float)((~((pCh[1] << 8) | (pCh[0] & 0xf8)) & 0xfff8) + 0x0008) / 0x8000;
}
else if (0 == nSign)//正数
{
mea.fMVAL = (float)((pCh[1] << 8) | (pCh[0] & 0xf8)) / 0x8000;
}
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeMEA
int CCommon103Analyzer::AnalyzeNGD(unsigned char* chMsg, NGD& ngd)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
ngd.nNo = pCh[0] & 0x3F;
ngd.nCont = (0x80 == (pCh[0] & 0x80)) ? 1 : 0;
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeNGD
int CCommon103Analyzer::AnalyzeGIN(unsigned char* chMsg, GIN& gin)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
gin.nGroup = pCh[0];
gin.nEntry = pCh[1];
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeGIN
int CCommon103Analyzer::AnalyzeKOD(unsigned char* chMsg, unsigned int& nKod)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
nKod = pCh[0];
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeKOD
int CCommon103Analyzer::AnalyzeGDD(unsigned char* chMsg, GDD& gdd)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
gdd.nType = pCh[0];
gdd.nSize = pCh[1];
gdd.nNum = pCh[2] & 0x7F;
gdd.n_Cont = (0x80 == (pCh[2] & 0x80)) ? 1 : 0;
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeGDD
int CCommon103Analyzer::AnalyzeGID(unsigned char* chMsg, unsigned int& type, unsigned int& size, GID& gid)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
switch (type)
{
case 0: //无数据
return -1;
case 1: //ASCII8位码
AnalyzeASCII(pCh, gid.ASCII);
break;
case 2: //成组8位串
AnalyzeBSI(pCh, gid.bsi);
break;
case 3: //无符号整数
AnalyzeUnnValue(pCh, size, gid.UnnValue);
break;
case 4: //整数
AnalyzenValue(pCh, size, gid.nValue);
break;
case 5: //无符号浮点数
AnalyzeUnfValue(pCh, size, gid.UnfValue);
break;
case 6: //浮点数
AnalyzefValue(pCh, size, gid.fValue);
break;
case 7: //IEEE标准754短实数
AnalyzeIEEE754(pCh, gid.R32);
break;
case 8: //IEEE标准754实数
AnalyzeIEEER64(pCh, gid.R64);
break;
case 9: //双点信息
AnalyzeDPI(pCh, gid.dpi);
break;
case 10: //单点信息
AnalyzeSPI(pCh, gid.spi);
break;
case 11: //带瞬变和差错的双点信息
AnalyzenTEDPI(pCh, gid.nTEDPI);
break;
case 12: //带品质描述词的被测值
AnalyzeMEA(pCh, gid.mea);
break;
case 13: //备用
break;
case 14: //7个8位二进制时间
{
int n7ByteTime = AnalyzeCP56Time2a(pCh, m_chTimeBuf);
memmove(gid.ch7ByteTime, m_chTimeBuf, sizeof(gid.ch7ByteTime));
}
break;
case 15: //通用分类标识序号
AnalyzeGIN(pCh, gid.gin);
break;
case 16: //相对时间
AnalyzeRET(pCh, gid.ret);
break;
case 17: //功能类型和信息序号
gid.nFUN = pCh[0];
gid.nINF = pCh[1];
break;
case 18: //带时标的报文
AnalyzeDPIwiTime(pCh, gid.dpiwitime);
break;
case 19: //带相对时间的时标报文
AnalyzeDPIwiRET(pCh, gid.dpiwiret);
break;
case 20: //带相对时间的时标的被测值
AnalyzeVALwiRET(pCh, gid.valwiret);
break;
case 21: //外部文本序号
break;
case 22: //通用分类回答码
AnalyzeGRC(pCh, gid.grc);
break;
case 23: //数据结构
//AnalyzeGDDaGID(pCh, gddagid);
break;
case 24: //索引
break;
default:
break;
}
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeGID
int CCommon103Analyzer::AnalyzeASCII(unsigned char* chMsg, unsigned int& ASCII)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
ASCII = pCh[0];
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeASCII
int CCommon103Analyzer::AnalyzeUnnValue(unsigned char* chMsg, unsigned int& size, unsigned int& UnnValue)
{
if (NULL == chMsg || size > 4)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
UnnValue = 0;
unsigned int i = 0;
for (i =0 ;i < size; i++)
{
UnnValue |= (pCh[i] << 8 * i);
}
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeUnnValue
int CCommon103Analyzer::AnalyzenValue(unsigned char* chMsg, unsigned int& size, int& nValue)
{
if (NULL == chMsg || size > 4)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
nValue = 0;
unsigned int i = 0;
unsigned int nsign = (0x80 == (pCh[size - 1] & 0x80)) ? 1 : 0;
if (nsign == 0)
{
for (i =0 ;i < size; i++)
{
nValue |= (pCh[i] << 8 * i);
}
}
else
{
if (size < 4)
{
for (i =0 ;i < size; i++)
{
nValue |= (pCh[i] << 8 * i);
}
switch (size)
{
case 1:
nValue = (-1.0) * ((int)((~nValue) & 0x000000ff)+ 0x01);
break;
case 2:
nValue = (-1.0) * ((int)((~nValue) & 0x0000ffff)+ 0x01);
break;
case 3:
nValue = (-1.0) * ((int)((~nValue) & 0x00ffffff)+ 0x01);
break;
default:break;
}
}
else
{
for (i =0 ;i < size; i++)
{
nValue |= (pCh[i] << 8 * i);
}
}
}
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzenValue
int CCommon103Analyzer::AnalyzeUnfValue(unsigned char* chMsg, unsigned int& size, double& UnfValue)
{
if (NULL == chMsg || size != 4)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
UnfValue = 0.0;
unsigned int nValue =0;
unsigned int i = 0;
float temp = 0.0;
float x = 0.0;
int j = 0;
unsigned int nsign = (0x80 == (pCh[size - 1] & 0x80)) ? 1 : 0;
if (nsign == 0)
{
for (i =0 ;i < size; i++)
{
nValue |= (pCh[i] << 8 * i);
}
memcpy(&x, &nValue, 4);
UnfValue = (double)x;
return 1;
}
else
{
nValue = pCh[0] | (pCh[1] << 8) | (pCh[2] << 16) | (pCh[3] << 24);
temp = (nValue & 0x007fffff) * 1.0 / 0x800000;
j = ((nValue & 0xff800000) >> 23) - 127;
UnfValue = pow(2.0 , j);
UnfValue = (1 + temp) * UnfValue;
return 1;
}
}
catch (...)
{
return -1;
}
}//AnalyzeUnfValue
int CCommon103Analyzer::AnalyzefValue(unsigned char* chMsg, unsigned int& size, float& fValue)
{
if (NULL == chMsg || size != 4)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
unsigned int nValue =0;
unsigned int i = 0;
fValue = 0.0;
for (i =0 ;i < size; i++)
{
nValue |= (pCh[i] << 8 * i);
}
memcpy(&fValue, &nValue, 4);
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzefValue
int CCommon103Analyzer::AnalyzeIEEER64(unsigned char* chMsg, double& R64)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
memcpy(&R64, pCh, 8);
return 1;
}
catch ( ... )
{
return -1;
}
}//AnalyzeIEEE754R64
int CCommon103Analyzer::AnalyzeSPI(unsigned char* chMsg, SPI& spi)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
spi.nSpi = pCh[0] & 0x01;
return 1;
}
catch ( ... )
{
return -1;
}
}//AnalyzeSPI
int CCommon103Analyzer::AnalyzenTEDPI(unsigned char* chMsg, unsigned int& nTEDPI)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
nTEDPI = pCh[0] & 0x03;
return 1;
}
catch ( ... )
{
return -1;
}
}//AnalyzenTEDPI
int CCommon103Analyzer::AnalyzeDPIwiTime(unsigned char* chMsg, DPIwiTime& dpiwitime)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
dpiwitime.dpi.nDpi = pCh[0] & 0x03;
pCh += 1;
int n4ByteTime = AnalyzeCP32Time2a(pCh, m_chTimeBuf);
memmove(dpiwitime.ch4ByteTime, m_chTimeBuf, sizeof(dpiwitime.ch4ByteTime));
pCh += 4;
dpiwitime.sin.nSIN = pCh[0];
pCh -= 5;
return 1;
}
catch ( ... )
{
return -1;
}
}//AnalyzeDPIwiTime
int CCommon103Analyzer::AnalyzeDPIwiRET(unsigned char* chMsg, DPIwiRET& dpiwiret)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
dpiwiret.dpi.nDpi = pCh[0] & 0x03;
pCh += 1;
AnalyzeRET(pCh, dpiwiret.ret);
pCh += 2;
AnalyzeFAN(pCh, dpiwiret.fan);
pCh += 2;
int n4ByteTime = AnalyzeCP32Time2a(pCh, m_chTimeBuf);
memmove(dpiwiret.ch4ByteTime, m_chTimeBuf, sizeof(dpiwiret.ch4ByteTime));
pCh += 4;
dpiwiret.sin.nSIN = pCh[0];
pCh -= 9;
return 1;
}
catch ( ... )
{
return -1;
}
}//AnalyzeDPIwiRET
int CCommon103Analyzer::AnalyzeVALwiRET(unsigned char* chMsg, VALwiRET& valwiret)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
AnalyzeIEEE754(pCh, valwiret.R32);
pCh += 4;
AnalyzeRET(pCh, valwiret.ret);
pCh += 2;
AnalyzeFAN(pCh, valwiret.fan);
pCh += 2;
int n4ByteTime = AnalyzeCP32Time2a(pCh, m_chTimeBuf);
memmove(valwiret.ch4ByteTime, m_chTimeBuf, sizeof(valwiret.ch4ByteTime));
pCh -= 8;
return 1;
}
catch ( ... )
{
return -1;
}
}//AnalyzeVALwiRET
int CCommon103Analyzer::AnalyzeGRC(unsigned char* chMsg, GRC& grc)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
grc.nGrc = pCh[0];
return 1;
}
catch ( ... )
{
return -1;
}
}//AnalyzeGRC
/*int CCommon103Analyzer::AnalyzeGDDaGID(unsigned char* chMsg, GDDaGID& gddagid)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
AnalyzeGDD(pCh, gddagid.gdd);
pCh +=3;
AnalyzeGID(pCh, gddagid.gdd.nType, gddagid.gdd.nSize, gddagid.gid);
return 1;
}
catch ( ... )
{
return -1;
}
}*///AnalyzeGRC
int CCommon103Analyzer::AnalyzeBSI(unsigned char* chMsg, BSI_103& bsi)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
bsi.chBsi[0] = pCh[3];
bsi.chBsi[1] = pCh[2];
bsi.chBsi[2] = pCh[1];
bsi.chBsi[3] = pCh[0];
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeBSI
int CCommon103Analyzer::AnalyzeNDE(unsigned char* chMsg, NDE& nde)
{
if (NULL == chMsg)
{
return -1;
}
try
{
unsigned char* pCh = chMsg;
nde.nNO = pCh[0] &0x3f;
nde.nCONT = (0x80 == (pCh[0] & 0x80)) ? 1 : 0;
return 1;
}
catch (...)
{
return -1;
}
}//AnalyzeNDE
|
7de4f1380345fe297c51c375fda4fc0df813358a
|
9f33e0b5854750c8872524ad37d1d7e2827340ae
|
/1/1.4/main.cpp
|
4cbdd5e9b5a5a7b32f8644c369ae273918604848
|
[] |
no_license
|
olegbukatchuk/book-cpp-the-examples-and-tasks-part-2
|
e20582d98150b9e44649a6cfab975293c370d40b
|
6391c66aa902ee88e322dbe3a4d4ee80e65ded5e
|
refs/heads/master
| 2021-09-07T14:00:04.245315
| 2018-02-23T21:01:46
| 2018-02-23T21:01:46
| 115,825,139
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 201
|
cpp
|
main.cpp
|
#include <iostream>
using namespace std;
int main() {
double v;
double t=1.2;
double g=9.8;
v=12.3;
double s=v*t-g*t*t/2;
cout<<"Heught level is "<<s<<"\n";
return 0;
}
|
ba3bfff1d055dde5ecef7af650e373238b536f32
|
0b2f4d37675f91adf6673f94ba40fb20d6c71af0
|
/PWGGA/PHOSTasks/PHOS_Run2embedding/AliPHOSEmbeddingRun2.h
|
34b22c6c1caa973b0363af95fa968e958adc2479
|
[] |
permissive
|
AMechler/AliPhysics
|
7a7af8b459b1c2af55b749e9a44574cdb354a7e7
|
e89a1d4f0104c8f0c78f43815fb30722c082f640
|
refs/heads/master
| 2022-11-08T07:30:11.943491
| 2022-09-23T12:01:24
| 2022-09-23T12:18:01
| 87,077,759
| 1
| 0
|
BSD-3-Clause
| 2021-05-27T07:48:59
| 2017-04-03T13:33:59
|
C++
|
UTF-8
|
C++
| false
| false
| 3,917
|
h
|
AliPHOSEmbeddingRun2.h
|
#ifndef AliPHOSEmbeddingRun2_h
#define AliPHOSEmbeddingRun2_h
// Class to perform embedding on the AOD level
// Author: D.Peressounko
class TChain ;
class TClonesArray ;
class TH2F ;
class AliPHOSClusterizerv1 ;
class AliPHOSReconstructor ;
class AliAODEvent ;
class AliESDEvent ;
class AliESDtrack ;
class AliESDCaloCells ;
#include "AliAnalysisTaskESDfilter.h"
class AliPHOSEmbeddingRun2 : public AliAnalysisTaskESDfilter {
public:
AliPHOSEmbeddingRun2(const char *name = "AliPHOSEmbeddingRun2");
virtual ~AliPHOSEmbeddingRun2() {}
//Standard methods
virtual void UserCreateOutputObjects();
virtual void UserExec(Option_t *option);
virtual void Terminate(Option_t *){}
//Chain with signal AOD for embedding
void SetSignalChains(TChain * signal1,TChain * signal2,TChain * signal3) {fAODChain1 =signal1; fAODChain2 =signal2; fAODChain3 =signal3;}
void SetEmbeddedFlag(Bool_t embpi0, Bool_t embeta,Bool_t embgamma) {fIsPi0Embedded = embpi0; fIsEtaEmbedded =embeta; fIsGammaEmbedded =embgamma;}
void SetPrivateOADBPath(TString path) {fPathPrivateOADB=path;}//simply copy from AliPhysics which you want to use for analysis is enough.
void SetSignalCalibration(Double_t corr) {fSignalECorrection=corr;}
private:
AliPHOSEmbeddingRun2(const AliPHOSEmbeddingRun2&); // not implemented
AliPHOSEmbeddingRun2& operator=(const AliPHOSEmbeddingRun2&); // not implemented
void Init() ;
void InitMF() ; //Mag.Field initialization for track matching
void InitGeometry() ;
void GetNextSignalEvent(void) ;
void GetNextSignalEventPi0(void) ;
void GetNextSignalEventEta(void) ;
void GetNextSignalEventGamma(void) ;
void CopyRecalibrateDigits(void) ;
void MakeEmbedding(AliESDEvent * event, AliAODEvent * signal) ;
void MakeDigits(AliAODEvent* signal) ;
Double_t DecalibrateSignal(Double_t cellAmplitude,Int_t cellNumber) ;
//Add new branch
void ConvertEmbeddedClusters(const AliESDEvent *esd,Int_t what) ;
void ConvertEmbeddedCells(const AliESDEvent *esd,Int_t what) ;
void ConvertMCParticles(const AliAODEvent *aod,Int_t what) ;
Float_t TestCPV(Double_t dx, Double_t dz, Double_t pt, Int_t charge) ;
Float_t TestCPVRun2(Double_t dx, Double_t dz, Double_t pt, Int_t charge) ;
TChain * fAODChain1 ; //Signal1 (pi0)
TChain * fAODChain2 ; //Signal (eta)
TChain * fAODChain3 ; //Signal (gamma)
AliAODEvent * fSignal1 ; //! pi0 signal event
AliAODEvent * fSignal2 ; //! eta signal event
AliAODEvent * fSignal3 ; //! gamma signal event
TTree * fDigitsTree ; //! Digits
TTree * fClustersTree; //! Clusters
TTree * fTreeOut; //Output AOD
TClonesArray * fDigitsArr ; //!
TClonesArray * fEmbeddedClusters1 ; //!
TClonesArray * fEmbeddedClusters2 ; //!
TClonesArray * fEmbeddedClusters3 ; //!
AliAODCaloCells * fEmbeddedCells1 ; //!
AliAODCaloCells * fEmbeddedCells2 ; //!
AliAODCaloCells * fEmbeddedCells3 ; //!
AliESDCaloCells * fCellsPHOS ; //! Old PHOS cells
AliPHOSClusterizerv1 * fClusterizer ; //!
AliPHOSReconstructor * fPHOSReconstructor ; //!
TH2F * fOldPHOSCalibration[5] ; //! Calibration coeff. used in ESD production
AliPHOSCalibData * fSignalCalibData ; //! Decalibration of signal, inverse to OADB. //new memeber variable for an additional calibration.
TString fPathPrivateOADB; //path to private OADB.
Double_t fSignalECorrection; //! Correction for the Signal clibration
Int_t fNSignal ; // Number of signal evetns processed
Int_t fNSignalPi0 ; // Number of signal evetns processed
Int_t fNSignalEta ; // Number of signal evetns processed
Int_t fNSignalGamma ; // Number of signal evetns processed
Int_t fNCaloClustersOld ; //Number of CaloClusters already in ESD
Bool_t fInitialized ; //!
Bool_t fIsPi0Embedded;
Bool_t fIsEtaEmbedded;
Bool_t fIsGammaEmbedded;
ClassDef(AliPHOSEmbeddingRun2, 4); // PHOS analysis task
};
#endif
|
cd353b0b342c0636063b5ede43c1b6c1ebed8f60
|
88ae8695987ada722184307301e221e1ba3cc2fa
|
/third_party/webrtc/api/transport/test/feedback_generator_interface.h
|
6e5118cbf41020950b07aef898eb691f8c68836c
|
[
"Apache-2.0",
"LGPL-2.0-or-later",
"MIT",
"GPL-1.0-or-later",
"LicenseRef-scancode-google-patent-license-webrtc",
"BSD-3-Clause",
"LicenseRef-scancode-google-patent-license-webm",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
iridium-browser/iridium-browser
|
71d9c5ff76e014e6900b825f67389ab0ccd01329
|
5ee297f53dc7f8e70183031cff62f37b0f19d25f
|
refs/heads/master
| 2023-08-03T16:44:16.844552
| 2023-07-20T15:17:00
| 2023-07-23T16:09:30
| 220,016,632
| 341
| 40
|
BSD-3-Clause
| 2021-08-13T13:54:45
| 2019-11-06T14:32:31
| null |
UTF-8
|
C++
| false
| false
| 1,431
|
h
|
feedback_generator_interface.h
|
/*
* Copyright 2019 The WebRTC 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 in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef API_TRANSPORT_TEST_FEEDBACK_GENERATOR_INTERFACE_H_
#define API_TRANSPORT_TEST_FEEDBACK_GENERATOR_INTERFACE_H_
#include <vector>
#include "api/test/simulated_network.h"
#include "api/transport/network_types.h"
namespace webrtc {
class FeedbackGenerator {
public:
struct Config {
BuiltInNetworkBehaviorConfig send_link;
BuiltInNetworkBehaviorConfig return_link;
TimeDelta feedback_interval = TimeDelta::Millis(50);
DataSize feedback_packet_size = DataSize::Bytes(20);
};
virtual ~FeedbackGenerator() = default;
virtual Timestamp Now() = 0;
virtual void Sleep(TimeDelta duration) = 0;
virtual void SendPacket(size_t size) = 0;
virtual std::vector<TransportPacketsFeedback> PopFeedback() = 0;
virtual void SetSendConfig(BuiltInNetworkBehaviorConfig config) = 0;
virtual void SetReturnConfig(BuiltInNetworkBehaviorConfig config) = 0;
virtual void SetSendLinkCapacity(DataRate capacity) = 0;
};
} // namespace webrtc
#endif // API_TRANSPORT_TEST_FEEDBACK_GENERATOR_INTERFACE_H_
|
16f522051dad24f957e36d0bdeec9dd56683e26b
|
ca66721a830468cff42304f7d345a4a4f1605268
|
/rts/optics/material.h
|
33b704f958a4ce1c69382a980666bb9b595d6c83
|
[] |
no_license
|
seberisha/bimsim-cuda
|
f5c484d8e3beb813b244fac8649df95b9f507919
|
a36c95da05c3f605dd64e1d9cfe02ecb7914973e
|
refs/heads/master
| 2020-03-15T07:49:33.946879
| 2018-05-03T19:04:35
| 2018-05-03T19:04:35
| 132,037,894
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 18,719
|
h
|
material.h
|
#ifndef MATERIALSTRUCT_H
#define MATERIALSTRUCT_H
#include <vector>
#include <ostream>
#include <iostream>
#include <fstream>
#include <complex>
#include <algorithm>
#include <sstream>
#include "rts/math/complex.h"
#include "rts/math/function.h"
//#define PI 3.14159
namespace rts{
enum field_type {field_microns, field_wavenumber, field_n, field_k, field_A, field_ignore};
//conversion functions
//convert wavenumber to lambda
template <class T>
static T _wn(T inverse_cm)
{
return (T)10000.0/inverse_cm;
}
template <class T>
static T _2wn(T lambda)
{
return (T)10000.0/lambda;
}
//convert absorbance to k
template <class T>
static T _A(T absorbance, T lambda)
{
return (absorbance * lambda) / (4 * PI);
}
template <class T>
static T _2A(T k, T lambda)
{
return (4 * PI * k)/lambda;
}
//define the dispersion as a single wavelength/refractive index pair
template <class T>
struct refIndex
{
//wavelength (in microns)
T lambda;
complex<T> n;
};
template <class T>
struct entryType
{
//list of value types per entry
std::vector<field_type> valueList;
entryType(std::string format)
{
//location of the end of a parameter
size_t e;
//string storing a token
std::string token;
do
{
//find the end of the first parameter
e = format.find_first_of(',');
//get the substring up to the comma
token = format.substr(0, e);
//turn the token into a val_type
if(token == "microns")
valueList.push_back(field_microns);
else if(token == "wavenumber")
valueList.push_back(field_wavenumber);
else if(token == "n")
valueList.push_back(field_n);
else if(token == "k")
valueList.push_back(field_k);
else if(token == "A")
valueList.push_back(field_A);
else
valueList.push_back(field_ignore);
//remove the first token from the format string
format = format.substr(e+1, format.length()-1);
}while(e != std::string::npos);
}
void addValue(field_type value)
{
valueList.push_back(value);
}
refIndex<T> inputEntry(std::string line, T scaleA = 1.0)
{
T val;
std::stringstream ss(line);
//create a new refractive index
refIndex<T> newRI;
//read the entry from an input string
for(unsigned int i=0; i<valueList.size(); i++)
{
while(ss.peek() < '0' || ss.peek() > '9')
{
//cout<<"bad char"<<endl;
ss.ignore();
}
//retrieve the value
ss>>val;
//cout<<val<<endl;
// std::cout<<"\t\t val: "<<val<<endl;
//store the value in the appropriate location
switch(valueList[i])
{
case field_microns:
newRI.lambda = val;
break;
case field_wavenumber:
newRI.lambda = _wn(val);
break;
case field_n:
newRI.n.real(val);
break;
case field_k:
newRI.n.imag(val);
break;
case field_A:
newRI.n.imag(_A(val * scaleA, newRI.lambda));
break;
}
}
//return the refractive index associated with the entry
return newRI;
}
std::string outputEntry(refIndex<T> material)
{
//std::string result;
std::stringstream ss;
//for each field in the entry
for(int i=0; i<valueList.size(); i++)
{
if(i > 0)
ss<<"\t";
//store the value in the appropriate location
switch(valueList[i])
{
case field_microns:
ss<<material.lambda;
break;
case field_wavenumber:
ss<<_2wn(material.lambda);
break;
case field_n:
ss<<material.n.real();
break;
case field_k:
ss<<material.n.imag();
break;
case field_A:
ss<<_2A(material.n.imag(), material.lambda);
break;
}
}
return ss.str();
}
};
//a material is a list of refractive index values
template <class T>
class material
{
std::string name;
//dispersion (refractive index as a function of wavelength)
//std::vector< refIndex<T> > dispersion;
function< T, complex<T> > dispersion;
//average refractive index (approximately 1.4)
T n0;
/*void add(refIndex<T> ri)
{
//refIndex<T> converted = convert(ri, measurement);
dispersion.push_back(ri);
}*/
//comparison function for sorting
static bool compare(refIndex<T> a, refIndex<T> b)
{
return (a.lambda < b.lambda);
}
//comparison function for searching lambda
/*static bool findCeiling(refIndex<T> a, refIndex<T> b)
{
return (a.lambda > b.lambda);
}*/
public:
void add(T lambda, complex<T> n)
{
// std::cout<<"\t\t====>in add "<<lambda<<","<<n<<std::endl;
dispersion.insert(lambda, n);
}
std::string getName()
{
return name;
}
void setName(std::string n)
{
name = n;
}
T getN0()
{
return n0;
}
void setN0(T n)
{
n0 = n;
}
void setM(function< T, complex<T> > m)
{
dispersion = m;
}
unsigned int nSamples()
{
//return dispersion.size();
//sb: size wasn't part of function.h in rts...guessing getN is the same
return dispersion.getN();
}
material<T> computeN(T _n0, unsigned int n_samples = 0, T pf = 2)
{
/* This function computes the real part of the refractive index
from the imaginary part. The Hilbert transform is required. I
use an FFT in order to simplify this, so either the FFTW or CUFFT
packages are required. CUFFT is used if this file is passed through
a CUDA compiler. Otherwise, FFTW is used if available.
*/
n0 = _n0;
int N;
if(n_samples)
N = n_samples;
else
//N = dispersion.size();
//sb: no size() in function.h of rts...replacing it with getN()
N = dispersion.getN();
#ifdef FFTW_AVAILABLE
//allocate memory for the FFT
complex<T>* Chi2 = (complex<T>*)fftw_malloc(sizeof(complex<T>) * N * pf);
complex<T>* Chi2FFT = (complex<T>*)fftw_malloc(sizeof(complex<T>) * N * pf);
complex<T>* Chi1 = (complex<T>*)fftw_malloc(sizeof(complex<T>) * N * pf);
//create an FFT plan for the forward and inverse transforms
fftw_plan planForward, planInverse;
planForward = fftw_plan_dft_1d(N*pf, (fftw_complex*)Chi2, (fftw_complex*)Chi2FFT, FFTW_FORWARD, FFTW_ESTIMATE);
planInverse = fftw_plan_dft_1d(N*pf, (fftw_complex*)Chi2FFT, (fftw_complex*)Chi1, FFTW_BACKWARD, FFTW_ESTIMATE);
float k, alpha;
T chi_temp;
//the spectrum will be re-sampled in uniform values of wavenumber
// T nuMin = _2wn(dispersion.back().lambda);
// T nuMax = _2wn(dispersion.front().lambda);
//sb: added these to replace the above 2 lines
T nuMin = _2wn(dispersion.backLambda());
T nuMax = _2wn(dispersion.frontLambda());
std::cout<<"\t\t nuMin ---"<<nuMin<<std::endl;
std::cout<<"\t\t nuMax ---"<<nuMax<<std::endl;
T dnu = (nuMax - nuMin)/(N-1);
T lambda, tlambda;
for(int i=0; i<N; i++)
{
//go from back-to-front (wavenumber is the inverse of wavelength)
lambda = _wn(nuMax - i * dnu);
//compute the frequency
k = 2 * PI / (lambda);
//get the absorbance
alpha = getN(lambda).imag() * (2 * k);
//compute chi2
Chi2[i] = -alpha * (n0 / k);
}
//use linear interpolation between the start and end points to pad the spectrum
//complex<T> nMin = dispersion.back();
//complex<T> nMax = dispersion.front();
T a;
for(int i=N; i<N*pf; i++)
{
//a = (T)(i-N)/(T)(N*pf - N);
//Chi2[i] = a * Chi2[0] + ((T)1 - a) * Chi2[N-1];
Chi2[i] = 0.0;//Chi2[N-1];
}
//perform the FFT
fftw_execute(planForward);
//perform the Hilbert transform in the Fourier domain
complex<T> j(0, 1);
for(int i=0; i<N*pf; i++)
{
//if w = 0, set the DC component to zero
if(i == 0)
Chi2FFT[i] *= (T)0.0;
//if w <0, multiply by i
else if(i < N*pf/2.0)
Chi2FFT[i] *= j;
//if i > N/2, multiply by -i
else
Chi2FFT[i] *= -j;
}
//execute the inverse Fourier transform (completing the Hilbert transform)
fftw_execute(planInverse);
//divide the Chi1 values by N
for(int i=0; i<N*pf; i++)
Chi1[i] /= (T)(N*pf);
//create a new material
material<T> newM;
newM.dispersion.clear();
// std::cout<<"\t\t after newM.dispersion.clear==="<<std::endl;
refIndex<T> ri;
for(int i=0; i<N; i++)
{
ri.lambda = _wn(nuMax - i * dnu);
ri.n.real(Chi1[i].real() / (2 * n0) + n0);
ri.n.imag(getN(ri.lambda).imag());
//newM.dispersion.push_back(ri);
//sb: use insert instead
// std::cout<<"\t\t ri.lambda==="<<ri.lambda<<std::endl;
// std::cout<<"\t\t ri.n.real()==="<<ri.n.real()<<std::endl;
// std::cout<<"\t\t ri.n.imag()==="<<ri.n.imag()<<std::endl;
newM.dispersion.insert(ri.lambda, ri.n);
}
//dispersion[i].n.real(Chi1[i].real() / (2 * n0) + n0);
/*//output the Absorbance value
ofstream outOrig("origN.txt");
for(int i=0; i<N; i++)
outOrig<<dispersion[i].lambda<<" "<<dispersion[i].n.real()<<endl;
//output the Chi2 value
ofstream outChi2("chi2.txt");
for(int i=0; i<N; i++)
outChi2<<dispersion[i].lambda<<" "<<Chi2[i].real()<<endl;
//output the Fourier transform
ofstream outFFT("chi2_FFT.txt");
for(int i=0; i<N; i++)
{
float mag = std::sqrt( std::pow(Chi2FFT[i].real(), 2.0) + std::pow(Chi2FFT[i].imag(), 2.0));
outFFT<<dispersion[i].lambda<<" "<<mag<<endl;
}
//output the computed Chi1 value
ofstream outChi1("chi1.txt");
for(int i=0; i<N; i++)
{
outChi1<<dispersion[i].lambda<<" "<<Chi1[i].real()<<" "<<Chi1[i].imag()<<endl;
}
ofstream outN("n.txt");
for(int i=0; i<N; i++)
outN<<dispersion[i].lambda<<" "<<Chi1[i].real() / (2 * n0) + n0<<endl;*/
//de-allocate memory
fftw_destroy_plan(planForward);
fftw_destroy_plan(planInverse);
fftw_free(Chi2);
fftw_free(Chi2FFT);
fftw_free(Chi1);
return newM;
#else
std::cout<<"MATERIAL Error: Must have FFTW in order to compute Kramers-Kronig."<<std::endl;
return material<T>();
#endif
}
material(T lambda = 1.0, T n = 1.4, T k = 0.0)
{
dispersion.insert(lambda, complex<T>(0.0, k));
/*//create a default refractive index
refIndex<T> def;
def.lambda = lambda;
def.n.real(n);
def.n.imag(k);
add(def);
*/
//set n0
n0 = n;
}
material(std::string filename, std::string format = "", T scaleA = 1.0)
{
//std::cout<<"\t\t\t material"<<std::endl;
fromFile(filename, format);
n0 = 0;
}
void fromFile(std::string filename, std::string format = "", T scaleA = 1.0)
{
name = filename;
//clear any previous values
dispersion = rts::function< T, complex<T> >();
//printf("\t\t filename: %s\n",filename.c_str());
//load the file into a string
std::ifstream ifs(filename.c_str());
std::string line;
if(!ifs.is_open())
{
std::cout<<"Material Error -- file not found: "<<filename<<std::endl;
exit(1);
}
//process the file as a string
std::string instr((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
fromStr(instr, format, scaleA);
}
void fromStr(std::string str, std::string format = "", T scaleA = 1.0)
{
//std::cout<<"\t\t\t============>fromStr"<<std::endl;
//create a string stream to process the input data
std::stringstream ss(str);
//this string will be read line-by-line (where each line is an entry)
std::string line;
//if the format is not provided, see if it is in the file, otherwise use a default
if(format == "")
{
//set a default format of "lambda,n,k"
format = "microns,n,k";
//see if the first line is a comment
char c = ss.peek();
if(c == '#')
{
// std::cout<<"\t\t\t============>if(c == '#')"<<std::endl;
//get the first line
getline(ss, line);
//look for a bracket, denoting the start of a format string
int istart = line.find('[');
if(istart != std::string::npos)
{
//look for a bracket terminating the format string
int iend = line.find(']');
if(iend != std::string::npos)
{
//read the string between the brackets
format = line.substr(istart+1, iend - istart - 1);
}
}
}
}
entryType<T> entry(format);
// std::cout<<"Loading material with format: "<<format<<std::endl;
while(!ss.eof())
{
//read a line from the string
getline(ss, line);
// printf("\t\t line: %s\n",line.c_str());
//if the line is not a comment, process it
if(line[0] != '#')
{
//load the entry and add it to the dispersion list
add(entry.inputEntry(line, scaleA).lambda, entry.inputEntry(line, scaleA).n);
}
//generally have to peek to trigger the eof flag
ss.peek();
}
//sort the vector by lambda
//sort(dispersion.begin(), dispersion.end(), &material<T>::compare);
}
//convert the material to a string
std::string toStr(std::string format = "microns,n,k", bool reverse_order = false)
{
std::stringstream ss;
entryType<T> entry(format);
//create a new refractive index
refIndex<T> ri;
if(reverse_order)
{
// for(int l=dispersion.size() - 1; l>=0; l--)
// {
// if(l < dispersion.size() - 1) ss<<std::endl;
// ss<<entry.outputEntry(dispersion[l]);
// }
//sb: no size() in function.h of rts...replacing it with getN()
for(int l=dispersion.getN() - 1; l>=0; l--)
{
ri.lambda = dispersion[l].x;
ri.n = dispersion[l].y;
if(l < dispersion.getN() - 1) ss<<std::endl;
//ss<<entry.outputEntry(dispersion[l]);
ss<<entry.outputEntry(ri);
}
}
else
{
/*
for(unsigned int l=0; l<dispersion.size(); l++)
{
if(l > 0) ss<<std::endl;
ss<<entry.outputEntry(dispersion[l]);
}*/
//sb: no size() in function.h of rts...replacing it with getN()
for(unsigned int l=0; l<dispersion.getN(); l++)
{
ri.lambda = dispersion[l].x;
ri.n = dispersion[l].y;
if(l > 0) ss<<std::endl;
//ss<<entry.outputEntry(dispersion[l]);
ss<<entry.outputEntry(ri);
}
}
return ss.str();
}
void save(std::string filename, std::string format = "microns,n,k", bool reverse_order = false)
{
std::ofstream outfile(filename.c_str());
outfile<<"#material file saved as [" + format + "]"<<std::endl;
outfile<<toStr(format, reverse_order)<<std::endl;
}
//convert between wavelength and wavenumber
/*void nu2lambda(T s = (T)1)
{
for(int i=0; i<dispersion.size(); i++)
dispersion[i].lambda = s/dispersion[i].lambda;
}
void lambda2nu(T s = (T)1)
{
for(int i=0; i<dispersion.size(); i++)
dispersion[i].lambda = s/dispersion[i].lambda;
}*/
refIndex<T>& operator[](unsigned int i)
{
return dispersion[i];
}
complex<T> getN(T l)
{
//return complex<T>(1.0, 0.0);
complex<T> ri = dispersion.linear(l) + n0;
return ri;
}
function<T, complex<T> > getF()
{
return dispersion + complex<T>(n0, 0.0);
}
//returns the scattering efficiency at wavelength l
complex<T> eta(T l)
{
//get the refractive index
complex<T> ri = getN(l);
//convert the refractive index to scattering efficiency
return ri*ri - 1.0;
}
//interpolate the given lambda value and return the index of refraction
complex<T> operator()(T l)
{
//std::cout<<"\t\t\t operator()(T l)"<<std::endl;
return getN(l);
}
};
} //end namespace rts
template <typename T>
std::ostream& operator<<(std::ostream& os, rts::material<T> m)
{
os<<m.toStr();
return os;
}
#endif
|
dbda8b16d3664d8ef891223a123d534d4a6c96c0
|
8eed18ed5726fd6aefacb52cfd3c3095c05f7ef7
|
/vacas.cpp
|
0d177384d5260193ea3dcd6ebe5168c6b462c95d
|
[] |
no_license
|
Luis-Brandao/Competitive-Programming
|
8cdc0742819dd9522e1f8d28db5bc1c95dce2e64
|
258b0005d7805917aa8abf931b23ef151e0c0d28
|
refs/heads/master
| 2020-04-02T00:27:27.195115
| 2018-10-19T15:41:40
| 2018-10-19T15:41:40
| 153,805,879
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 773
|
cpp
|
vacas.cpp
|
#include <iostream>
#include <set>
using namespace std;
set<int> stalls;
bool fits(int k, int c) {
int start = *stalls.begin();
int count = 1;
for(int x : stalls) {
if(x - start >= k) {
start = x;
count++;
}
}
return count >= c;
}
int search(int low, int high, int c) {
int count, start;
int mid = low + ((high - low) / 2);
if(!fits(low, c)) return low - 1;
//cout << "ola" << endl;
if(fits(mid, c)) {
return search(mid+1, high, c);
}else {
return search(low, mid, c);
}
}
int main() {
int n, t, x;
cin >> t;
int c;
while(t--) {
cin >> n;
cin >> c;
while(n--) {
cin >> x;
stalls.insert(x);
}
int high = *(--stalls.end());
int low = 0;
cout << search(low, high, c) << endl;
stalls.clear();
}
}
|
6842c496eec04543ba0e5dfa870569ba0bd0aa29
|
7f69d17fa5b84eb3375e17cd7efa96bb01aeb160
|
/Micro/3Dddd/model/Utilities/modelMacros.h
|
e47e43e6ba60d28ba98949547463c4e710a7de31
|
[] |
no_license
|
ARUN-PRAKASH-95/TMS-3rd_Sem_Programs
|
9a7f8984942b5abd43354d207321dfe904f923d2
|
d2a3a969e26643b4603ac397beeef24a291dc5c2
|
refs/heads/master
| 2020-12-09T19:32:07.177455
| 2020-02-03T12:49:20
| 2020-02-03T12:49:20
| 233,398,215
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,363
|
h
|
modelMacros.h
|
/* This file is part of MODEL, the Mechanics Of Defect Evolution Library.
*
* Copyright (C) 2013 by Giacomo Po <gpo@ucla.edu>.
*
* model is distributed without any warranty under the
* GNU General Public License (GPL) v2 <http://www.gnu.org/licenses/>.
*/
#ifndef _model_macros_h_
#define _model_macros_h_
// see http://eigen.tuxfamily.org/dox-devel/Macros_8h_source.html
#ifdef _MODEL_NO_DEBUG_ // RELEASE MODE
#else // DEBUG MODE
#include <assert.h>
#include <iostream>
#include <cstdlib> // abort
//namespace model
//{
// inline void assert_fail(const char *condition, const char *function, const char *file, int line)
// {
// std::cerr << "assertion failed: " << condition << " in function " << function << " at " << file << ":" << line << std::endl;
// abort();
// }
//}
#endif
/* model_removeAssert *********************************************************/
#ifndef model_removeAssert
#ifdef _MODEL_NO_DEBUG_
// in release mode, model_removeAssert(x,y) removes x from the code
#define model_removeAssert(x)
#else
// in debug mode, model_removeAssert(x,y)=assert(x)
// TO DO: CHANGE THIS DEFINITION BECAUSE assert(x) CAN BE REMOVED BY NDEBUG!!! MUST USE mode::assert_fail
#define model_removeAssert(x) assert(x)
#endif
#endif
/* model_execAssert ***********************************************************/
#ifndef model_execAssert
#ifdef _MODEL_NO_DEBUG_
// in release mode, model_execAssert(x,y,z) executes x
#define model_execAssert(x,y,z) x
#else
// in debug mode, model_execAssert(x,y) executes xy and asserts (xy && z),
// where z is typically a string
// TO DO: CHANGE THIS DEFINITION BECAUSE assert(x) CAN BE REMOVED BY NDEBUG!!! MUST USE mode::assert_fail
#define model_execAssert(x,y,z) assert(x y && z)
//#define model_execAssert(x,y) model::assert_fail(x && y)
#endif
#endif
/* model_execAssert ***********************************************************/
//#ifndef model_checkInput
//#ifdef _MODEL_NO_BAD_INPUT_CHECK_
//// if function inputs are not checked, model_checkInput(x) removes x from the code
//#define model_checkInput(x)
//#else
//// if function inputs are checked, model_checkInput(x)=assert(x)
//// TO DO: CHANGE THIS DEFINITION BECAUSE assert(x) CAN BE REMOVED BY NDEBUG!!! MUST USE mode::assert_fail
//#define model_checkInput(x) assert(x)
//#endif
//#endif
#endif // _model_macros_h_
|
4153a16e3168e241e2dcf7fbef619bd664de420a
|
7d132eae1c4d1e572f42869bf1da5b094c53c25b
|
/Assignments/hw5/stack.h
|
13a641e936a5057490668e768d11fd79f2c18e28
|
[] |
no_license
|
afreet220/CSCI104_DataStructure
|
bf8c83c3b61814daa3fbc550b152a2093ed5af35
|
fb05514608489a858ff36b33cfeec7e531c22b5c
|
refs/heads/master
| 2021-01-10T14:54:38.028428
| 2015-10-15T10:47:03
| 2015-10-15T10:47:03
| 44,303,931
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,222
|
h
|
stack.h
|
#ifndef STACK_H_
#define STACK_H_
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
#include <exception>
#include <cstddef>
#include <stdexcept>
#include "ilist.h"
#include "arraylist.h"
using namespace std;
template <class T>
class Stack : private ArrayList<T>
{
public:
// add appropriate constructors and destructors
Stack();
virtual ~Stack();
bool isEmpty() const;
/* returns whether the stack contains any elements */
void push(const T& val);
/* adds a value to the top of the stack */
void pop();
/* deletes the top value from the stack */
T const & top() const;
/* returns the top value on the stack */
};
template <class T>
Stack<T>::Stack()
{
}
template <class T>
Stack<T>::~Stack()
{
}
template <class T>
bool Stack<T>::isEmpty() const
{
if (ArrayList<T>::size() == 0)
{
return true;
}
else {
return false;
}
}
template <class T>
void Stack<T>::push(const T& val)
{
ArrayList<T>::insert(ArrayList<T>::size(),val);
}
template <class T>
void Stack<T>::pop()
{
ArrayList<T>::remove(ArrayList<T>::size()-1);
}
template <class T>
T const & Stack<T>::top() const
{
return ArrayList<T>::get(ArrayList<T>::size()-1);
}
#endif /* STACK_H_ */
|
5f0011771bf492b6cc940021ae2626d5423d20cd
|
fc25227f1972606fcc3c13219abe52b1af01e7c3
|
/CoursEra/The art of developing in modern C++/1 Basics/Homework/ProductPrice.cpp
|
6c618f7886770f07e91fc2507e5b1722d83fe086
|
[] |
no_license
|
G1nger19/Courses
|
adc379fde90de6d57b8714b3351ecf72b2dfe090
|
41b1db6eacf87908c22098a18ca52935af8a046f
|
refs/heads/master
| 2022-09-05T15:04:13.185381
| 2020-05-30T14:23:52
| 2020-05-30T14:23:52
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 244
|
cpp
|
ProductPrice.cpp
|
#include <iostream>
using namespace std;
int main(){
double n,a,b,x,y;
cin>>n>>a>>b>>x>>y;
if(n>a && n<=b){
cout<<(n-(n/100*x));
}
else if(n>b){
cout<<(n-(n/100*y));
}
else{
cout<<n;
}
}
|
6e2531c2dd40869dc194b159415e78df8aba3cbc
|
6894f4c7ea0968d4f1582796aeb650478cd61424
|
/depends/include/zsummerX/common/common.h
|
61355b8775c7e9e813684c112ab7749e67f04c2b
|
[
"Apache-2.0"
] |
permissive
|
Johance2/breeze
|
4cf8677fff91e9cb6dbf2b38a68e3b50c5fee28b
|
9c8f34f34e59f7b9570c507668dc4c50e20c2769
|
refs/heads/master
| 2021-01-10T23:58:25.636783
| 2016-09-05T12:36:04
| 2016-09-05T12:36:04
| 70,777,598
| 3
| 0
| null | 2016-10-13T06:50:57
| 2016-10-13T06:50:56
| null |
UTF-8
|
C++
| false
| false
| 7,975
|
h
|
common.h
|
/*
* zsummerX License
* -----------
*
* zsummerX is licensed under the terms of the MIT license reproduced below.
* This means that zsummerX is free software and can be used for both academic
* and commercial purposes at absolutely no cost.
*
*
* ===============================================================================
*
* Copyright (C) 2010-2015 YaweiZhang <yawei.zhang@foxmail.com>.
*
* 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.
*
* ===============================================================================
*
* (end of COPYRIGHT)
*/
#pragma once
#ifndef _ZSUMMERX_COMMON_H_
#define _ZSUMMERX_COMMON_H_
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <WS2tcpip.h>
#include <WinSock2.h>
#include <Windows.h>
#include <MSWSock.h>
#pragma comment(lib, "ws2_32")
#else
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <string.h>
#include <netdb.h>
#endif
#include <assert.h>
#include <string>
#include <iostream>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <utility>
#include <memory>
#include <functional>
#include <chrono>
#include <thread>
#include <mutex>
#include <algorithm>
#include <log4z/log4z.h>
#include <rc4/rc4_encryption.h>
#include <atomic>
namespace zsummer
{
namespace network
{
//! NetErrorCode
enum NetErrorCode
{
NEC_SUCCESS = 0,
NEC_ERROR,
NEC_REMOTE_CLOSED,
};
class TcpSocket;
using TcpSocketPtr = std::shared_ptr<TcpSocket>;
//! post callback
using _OnPostHandler = std::function<void()>;
//timer callback
using _OnTimerHandler = std::function<void()>;
//accept callback
using _OnAcceptHandler = std::function<void(NetErrorCode, TcpSocketPtr)>;
//connect callback
using _OnConnectHandler = std::function<void(NetErrorCode)>;
//send or recv callback @int : translate bytes.
using _OnSendHandler = std::function<void(NetErrorCode, int)>;
using _OnRecvHandler = std::function<void(NetErrorCode, int)>;
//udp callback
//! @const char *: remote ip
//! @unsigned short: remote port
//! @int : translate bytes
using _OnRecvFromHandler = std::function<void(NetErrorCode, const char*, unsigned short, int)>;
enum LINK_STATUS
{
LS_UNINITIALIZE, //socket default status
LS_WAITLINK, // socket status after init and will to connect.
LS_ATTACHED, // socket attached will to initialize.
LS_ESTABLISHED, //socket status is established
LS_CLOSED, // socket is closed. don't use it again.
};
class ZSummerEnvironment
{
public:
ZSummerEnvironment();
~ZSummerEnvironment();
inline void addCreatedSocketCount(){ _totalCreatedCTcpSocketObjs++; }
inline void addClosedSocketCount(){ _totalClosedCTcpSocketObjs++; }
inline unsigned int getCreatedSocketCount(){ return _totalCreatedCTcpSocketObjs; }
inline unsigned int getClosedSocketCount(){ return _totalClosedCTcpSocketObjs; }
inline LoggerId getNetCoreLogger(){ return _netLoggerID; }
private:
std::atomic_uint _totalCreatedCTcpSocketObjs;
std::atomic_uint _totalClosedCTcpSocketObjs;
LoggerId _netLoggerID = 0;
};
extern ZSummerEnvironment g_appEnvironment;
inline std::string getHostByName(const std::string & name)
{
if (std::find_if(name.begin(), name.end(), [](char ch) {return !isdigit(ch) && ch != '.'; }) == name.end())
{
return name; //ipv4
}
if (std::find_if(name.begin(), name.end(), [](char ch) {return !isxdigit(ch) && ch != ':'; }) == name.end())
{
return name; //ipv6
}
struct addrinfo *res = nullptr;
struct addrinfo hints;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_PASSIVE;
if (getaddrinfo(name.c_str(), "3306", &hints, &res) == 0)
{
char buf[100] = { 0 };
if (res->ai_family == AF_INET)
{
inet_ntop(res->ai_family, &(((sockaddr_in*)res->ai_addr)->sin_addr), buf, 100);
}
else if (res->ai_family == AF_INET6)
{
inet_ntop(res->ai_family, &(((sockaddr_in6*)res->ai_addr)->sin6_addr), buf, 100);
}
return buf;
}
return "";
}
#ifndef WIN32
inline bool setNonBlock(int fd)
{
return fcntl((fd), F_SETFL, fcntl(fd, F_GETFL)|O_NONBLOCK) == 0;
}
inline bool setNoDelay(int fd)
{
int bTrue = true?1:0;
return setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char*)&bTrue, sizeof(bTrue)) == 0;
}
inline bool setReuse(int fd)
{
int bReuse = 1;
return setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &bReuse, sizeof(bReuse)) == 0;
}
inline bool setIPV6Only(int fd, bool only)
{
int ipv6only = only ? 1 : 0;
return setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &ipv6only, sizeof(ipv6only)) == 0;
}
#else
inline bool setNonBlock(SOCKET s)
{
unsigned long val = 1;
return ioctlsocket(s, FIONBIO, &val) == NO_ERROR;
}
inline bool setNoDelay(SOCKET s)
{
BOOL bTrue = TRUE;
return setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char*)&bTrue, sizeof(bTrue)) == 0;
}
inline bool setReuse(SOCKET s)
{
BOOL bReUseAddr = TRUE;
return setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char*)&bReUseAddr, sizeof(BOOL)) == 0;
}
inline bool setIPV6Only(SOCKET s, bool only)
{
DWORD ipv6only = only ? 1: 0;
return setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&ipv6only, sizeof(ipv6only)) == 0;
}
#endif
}
}
#define LCD( log ) LOG_DEBUG( zsummer::network::g_appEnvironment.getNetCoreLogger(), log )
#define LCI( log ) LOG_INFO( zsummer::network::g_appEnvironment.getNetCoreLogger(), log )
#define LCW( log ) LOG_WARN( zsummer::network::g_appEnvironment.getNetCoreLogger(), log )
#define LCE( log ) LOG_ERROR( zsummer::network::g_appEnvironment.getNetCoreLogger(), log )
#define LCA( log ) LOG_ALARM( zsummer::network::g_appEnvironment.getNetCoreLogger(), log )
#define LCF( log ) LOG_FATAL( zsummer::network::g_appEnvironment.getNetCoreLogger(), log )
#endif
|
f323da14166e32fddf66d64395e12cc6ba2968cd
|
a01fb6831ce9fbcf20c318be6333a54f5e7bb122
|
/ocean_effect.hpp
|
eb5ebd7cfc28c0ac1a469273e0cce735e2d00943
|
[] |
no_license
|
Retardigrades/visuals
|
37ae665d66ce9f582057d1c0d2e3f97d7046fb98
|
2209d8175c838140ca7f74aa4a813a8947defffa
|
refs/heads/master
| 2021-01-20T09:49:04.854347
| 2018-02-21T22:46:04
| 2018-02-21T22:46:04
| 90,289,348
| 0
| 1
| null | 2017-06-16T20:40:51
| 2017-05-04T17:12:44
|
C
|
UTF-8
|
C++
| false
| false
| 221
|
hpp
|
ocean_effect.hpp
|
#ifndef OCEAN_EFFECT_HPP
#define OCEAN_EFFECT_HPP
#include "effect.hpp"
class OceanEffect : public Effect
{
public:
OceanEffect();
void fill(EffectBuffer& buffer, const EffectState& state) override;
};
#endif
|
678a7f46aa051b279b205b25045a71cf4be7742a
|
9f314c14556a1d2ede69c08ff75d9c3e730adc4f
|
/oink/xform_cmd.h
|
8e7efa82af5923ae07b0ab80ab3bdc933f7cae6c
|
[
"LicenseRef-scancode-other-permissive",
"LicenseRef-scancode-public-domain"
] |
permissive
|
zhouzhenghui/oink-stack
|
c1077394f6a64c8aec2f3b4d4a322ada3993bc74
|
12901ab95b3ea60360906b63f6602f060ac3de1f
|
refs/heads/master
| 2020-04-13T07:32:05.388961
| 2016-10-21T00:47:35
| 2016-10-21T00:47:35
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,738
|
h
|
xform_cmd.h
|
// see License.txt for copyright and terms of use
// Process command-line arguments.
#ifndef XFORM_CMD_H
#define XFORM_CMD_H
#include "oink_cmd.h"
#include "oink_file.h" // File
class XformCmd : public virtual OinkCmd {
public:
// print out every declaration allocating a var on the stack
bool print_stack_alloc;
// print out every declaration (1) allocating a var on the stack
// where (2) the var also has its address taken
bool print_stack_alloc_addr_taken;
// heapify every declaration (1) allocating a var on the stack where
// (2) the var also has its address taken
// heapify stack-allocated array variables
bool heapify_stack_arrays;
// heapify stack-allocated variables that have their address taken
bool heapify_stack_alloc_addr_taken;
// insert calls to verify the status of parameters that are pointers
// to a class/struct/union type that is defined in this module
bool verify_cross_module_params;
// localize calls to heap allocation calls: change calls to
// malloc/free etc. so that they call class-local and module-local
// malloc
bool localize_heap_alloc;
// introduce function calls at the call site
bool intro_fun_call;
// jimmy stage
bool jimmy;
// string to use to call free()
const char *free_func;
// string to use to call xmalloc()
const char *xmalloc_func;
// string to use to call verify()
const char *verify_func;
// string with which to suffix altered parameters
const char *verify_param_suffix;
// the string to introduce function calls with
const char *intro_fun_call_str;
XformCmd();
void readOneArg(int &argc, char **&argv);
void dump();
void printHelp();
void initializeFromFlags();
};
#endif // XFORM_CMD_H
|
d9231921a1636857f11efc779df1af1ae0d86373
|
59e024b1dc5ca1e9effa813adf109324c5d43d4c
|
/ReflectionSystem-Cpp/ReflectionSystem-Cpp.cpp
|
3405248a4408511dda55498bafde81a56997ed91
|
[] |
no_license
|
kaushikswapnil/ReflectionSystem-Cpp
|
cada0e50b55186136fd98a757715cf321d4493d1
|
cbc0079c16240d92b21a09d4f9e33c34e039ad15
|
refs/heads/master
| 2022-09-11T15:20:20.517682
| 2022-08-17T23:19:33
| 2022-08-17T23:19:33
| 185,035,092
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,021
|
cpp
|
ReflectionSystem-Cpp.cpp
|
// ReflectionSystem-Cpp.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <typeinfo>
#include "Reflect.h"
#include <windows.h>
struct Node
{
int key{};
double value{};
std::string name{};
std::vector<int> children{};
REFLECT() // Enable reflection
};
struct NodeDerived : public Node
{
int derivedValue{};
REFLECT_INHERITED(Node) // Enable reflection
};
REFLECT_BEGIN(Node)
REFLECT_MEMBER(key)
REFLECT_MEMBER(value)
REFLECT_MEMBER(name)
REFLECT_MEMBER(children)
REFLECT_END()
REFLECT_BEGIN(NodeDerived)
REFLECT_MEMBER(derivedValue)
REFLECT_END()
int main()
{
using namespace ReflectionSystem;
LARGE_INTEGER li;
if (!QueryPerformanceFrequency(&li))
{
return 0;
}
double PC_FREQ = double(li.QuadPart)/1000;
NodeDerived derived;
//Node derived;
derived.key = 1;
derived.value = 3;
derived.name = "Hello World";
derived.children = {5, 6, 7};
derived.derivedValue = 4;
Node* node = &derived;
QueryPerformanceCounter(&li);
unsigned int StartCounter = li.QuadPart;
TypeDescriptor* nodeTypeDesc = node->GetClassDescriptor();
QueryPerformanceCounter(&li);
unsigned int EndCounter = li.QuadPart;
nodeTypeDesc->DumpToOStream(reinterpret_cast<BytePointer>(node), std::cout);
std::cout << std::endl << "Execution Time : " << double((EndCounter - StartCounter)/PC_FREQ);
return 0;
}
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
|
84a9d5df7166fa43e34bdcee7ffa03bf0126b31e
|
98e4e8685174748ce91c817c7eeb7d2dc193f177
|
/bulgeDeformer.cpp
|
60fcdc62f7db30d742945e28e7077f244b04df89
|
[] |
no_license
|
digideskio/Maya-blendMesh
|
6f31fc44baf38f405b77b61731d0d39896bdc263
|
d6f78890d4627a71cf2a24307e459ac93aa75882
|
refs/heads/master
| 2020-12-11T05:27:32.115648
| 2014-01-13T22:47:35
| 2014-01-13T22:47:35
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,587
|
cpp
|
bulgeDeformer.cpp
|
#include "bulgeDeformer.h"
MTypeId BulgeDeformer::id(0x00007174);
MObject BulgeDeformer::aBulgeAmount;
BulgeDeformer::BulgeDeformer()
{
}
BulgeDeformer::~BulgeDeformer()
{
}
void* BulgeDeformer::creator()
{
return new BulgeDeformer();
}
MStatus BulgeDeformer::deform(MDataBlock& data, MItGeometry& itGeo,
const MMatrix& localToWorldMatrix, unsigned int geomIndex)
{
MStatus status;
MArrayDataHandle hInput = data.outputArrayValue(input, &status);
CHECK_MSTATUS_AND_RETURN_IT(status);
status = hInput.jumpToElement(geomIndex);
MDataHandle hInputElement = hInput.outputValue(&status);
MObject oInputGeom = hInputElement.child(inputGeom).asMesh();
MFnMesh fnMesh(oInputGeom, &status);
CHECK_MSTATUS_AND_RETURN_IT(status);
MFloatVectorArray normals;
fnMesh.getVertexNormals(false, normals);
float bulgeAmount = data.inputValue(aBulgeAmount).asFloat();
float env = data.inputValue(envelope).asFloat();
MPoint point;
float w;
for (; !itGeo.isDone(); itGeo.next())
{
w = weightValue(data, geomIndex, itGeo.index());
point = itGeo.position();
point += normals[itGeo.index()] * bulgeAmount * w * env;
itGeo.setPosition(point);
}
return MS::kSuccess;
}
MStatus BulgeDeformer::initialize()
{
MStatus status;
MFnNumericAttribute nAttr;
aBulgeAmount = nAttr.create("bulgeAmount", "bulgeAmount", MFnNumericData::kFloat);
nAttr.setKeyable(true);
addAttribute(aBulgeAmount);
attributeAffects(aBulgeAmount, outputGeom);
MGlobal::executeCommand("makePaintable -attrType multiFloat -sm deformer bulgeMesh weights;");
return MS::kSuccess;
}
|
0de639d8c72165c513fdd2a886dc3a223749796d
|
c53b4c5176f72239ab3107753bd2aea1fe88af81
|
/aslam_cv_calibration/src/target-aprilgrid.cc
|
18a1922952043290d7d2e69292fc23b6133f5d2e
|
[
"Apache-2.0"
] |
permissive
|
ethz-asl/aslam_cv2
|
a7e0c1c4b8feaa467cf749c5011481525eae577a
|
8df54bda80c7c562d19e035fbad3fdb5459059ae
|
refs/heads/master
| 2023-09-04T16:04:25.877334
| 2023-03-30T07:59:26
| 2023-03-30T07:59:26
| 103,947,833
| 200
| 65
|
Apache-2.0
| 2023-03-25T16:22:54
| 2017-09-18T14:13:12
|
C++
|
UTF-8
|
C++
| false
| false
| 10,971
|
cc
|
target-aprilgrid.cc
|
#include <algorithm>
#include <memory>
#include <vector>
#include <apriltags/TagDetector.h>
#include <apriltags/Tag36h11.h>
#include <aslam/common/yaml-serialization.h>
#include <Eigen/Core>
#include <glog/logging.h>
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include "aslam/calibration/target-aprilgrid.h"
#include "aslam/calibration/target-observation.h"
namespace aslam {
namespace calibration {
TargetAprilGrid::TargetConfiguration
TargetAprilGrid::TargetConfiguration::fromYaml(const std::string& yaml_file) {
TargetConfiguration target_config;
try {
const YAML::Node yaml_node = YAML::LoadFile(yaml_file.c_str());
std::string target_type;
YAML::safeGet(yaml_node, "target_type", &target_type);
CHECK_EQ(target_type, "aprilgrid") << "Wrong target type.";
YAML::safeGet(yaml_node, "tagCols", &target_config.num_tag_cols);
CHECK_GT(target_config.num_tag_cols, 0u);
YAML::safeGet(yaml_node, "tagRows", &target_config.num_tag_rows);
CHECK_GT(target_config.num_tag_rows, 0u);
YAML::safeGet(yaml_node, "tagSize", &target_config.tag_size_meter);
CHECK_GT(target_config.tag_size_meter, 0.0);
double relative_tag_spacing;
YAML::safeGet(yaml_node, "tagSpacing", &relative_tag_spacing);
target_config.tag_inbetween_space_meter =
relative_tag_spacing * target_config.tag_size_meter;
CHECK_GT(target_config.tag_inbetween_space_meter, 0.0);
} catch (const YAML::Exception& ex) {
LOG(FATAL) << "Failed to load yaml file " << yaml_file
<< " with the error: \n " << ex.what() << ".";
}
return target_config;
}
TargetAprilGrid::TargetAprilGrid(const TargetAprilGrid::TargetConfiguration& target_config)
: TargetBase(2u * target_config.num_tag_rows,
2u * target_config.num_tag_cols, // 4 points per tag.
createAprilGridPoints(target_config)),
target_config_(target_config) {
CHECK_GT(target_config.tag_size_meter, 0.0);
CHECK_GT(target_config.tag_inbetween_space_meter, 0.0);
}
Eigen::Matrix3Xd createAprilGridPoints(
const TargetAprilGrid::TargetConfiguration& target_config) {
// Point ordering (e.g. 2x2 grid):
//
// 12-----13 14-----15
// | TAG 2 | | TAG 3 |
// 8-------9 10-----11
// 4-------5 6-------7
// y | TAG 0 | | TAG 1 |
// ^ 0-------1 2-------3
// |-->x
const double tag_size = target_config.tag_size_meter;
const double tag_spacing = target_config.tag_inbetween_space_meter;
const size_t num_point_rows = 2u * target_config.num_tag_rows;
const size_t num_point_cols = 2u * target_config.num_tag_cols;
CHECK_GT(tag_size, 0.0);
CHECK_GT(tag_spacing, 0.0);
Eigen::Matrix3Xd grid_points_meters =
Eigen::Matrix3Xd(3, num_point_rows * num_point_cols);
for (size_t row_idx = 0u; row_idx < num_point_rows; ++row_idx) {
for (size_t col_idx = 0u; col_idx < num_point_cols; ++col_idx) {
Eigen::Vector3d point;
point(0) = static_cast<double>(col_idx / 2u) * (tag_size + tag_spacing) +
static_cast<double>(col_idx % 2u) * tag_size;
point(1) = static_cast<double>(row_idx / 2u) * (tag_size + tag_spacing) +
static_cast<double>(row_idx % 2u) * tag_size;
point(2) = 0.0;
grid_points_meters.col(row_idx * num_point_cols + col_idx) = point;
}
}
return grid_points_meters;
}
DetectorAprilGrid::DetectorAprilGrid(
const TargetAprilGrid::Ptr& target,
const DetectorAprilGrid::DetectorConfiguration& detector_config)
: target_(target),
detector_config_(detector_config),
tag_codes_(AprilTags::tagCodes36h11) {
CHECK(target);
tag_detector_.reset(
new AprilTags::TagDetector(tag_codes_, target_->getConfig().black_tag_border_bits));
}
TargetObservation::Ptr DetectorAprilGrid::detectTargetInImage(const cv::Mat& image) const {
// Detect all Apriltags in the image.
std::vector<AprilTags::TagDetection> detections = tag_detector_->extractTags(image);
// Remove bad tags.
std::vector<AprilTags::TagDetection>::iterator iter = detections.begin();
for (iter = detections.begin(); iter != detections.end();) {
bool remove = false;
// Enforce min. distance of corners to the image border (tag removed if violated).
for (int tag_corner_idx = 0; tag_corner_idx < 4; ++tag_corner_idx) {
remove |= iter->p[tag_corner_idx].first < detector_config_.min_border_distance_px;
remove |= iter->p[tag_corner_idx].first >
static_cast<double>(image.cols) - detector_config_.min_border_distance_px;
remove |= iter->p[tag_corner_idx].second < detector_config_.min_border_distance_px;
remove |= iter->p[tag_corner_idx].second >
static_cast<double>(image.rows) - detector_config_.min_border_distance_px;
}
// Flag for removal if tag detection is marked as bad.
if (iter->good != 1) {
remove |= true;
}
// Flag for removal if the tag ID is out-of-range for this grid (faulty detection or wild tag).
if (iter->id >= static_cast<int>(target_->size() / 4.0)) {
remove |= true;
}
// Remove tag from the observation list.
if (remove) {
VLOG(200) << "Tag with ID " << iter->id << " is only partially in image (corners outside) "
<< "and will be removed from the TargetObservation.\n";
// delete the tag and advance in list
iter = detections.erase(iter);
} else {
//advance in list
++iter;
}
}
// Check if enough tags have been found.
if (detections.size() < detector_config_.min_visible_tags_for_valid_obs) {
// Detection failed; return nullptr.
return TargetObservation::Ptr();
}
// Sort detections by tagId.
std::sort(detections.begin(), detections.end(), AprilTags::TagDetection::sortByIdCompare);
// Check for duplicate tag ids that would indicate Apriltags not belonging to calibration target.
if (detections.size() > 1) {
for (size_t tag_idx = 0; tag_idx < detections.size() - 1; ++tag_idx)
if (detections[tag_idx].id == detections[tag_idx + 1].id) {
// Show image of duplicate Apriltag.
cv::destroyAllWindows();
cv::namedWindow("Wild Apriltag detected. Hide them!");
cvStartWindowThread();
cv::Mat image_copy = image.clone();
cv::cvtColor(image_copy, image_copy, CV_GRAY2RGB);
// Mark all duplicate tags in the image.
for (size_t inner_tag_idx = 0; inner_tag_idx < detections.size() - 1; ++inner_tag_idx) {
if (detections[inner_tag_idx].id == detections[inner_tag_idx + 1].id) {
detections[inner_tag_idx].draw(image_copy);
detections[inner_tag_idx + 1].draw(image_copy);
}
}
cv::putText(image_copy, "Duplicate Apriltags detected. Hide them.", cv::Point(50, 50),
CV_FONT_HERSHEY_SIMPLEX, 0.8, CV_RGB(255, 0, 0), 2, 8, false);
cv::putText(image_copy, "Press enter to exit...", cv::Point(50, 80),
CV_FONT_HERSHEY_SIMPLEX, 0.8, CV_RGB(255, 0, 0), 2, 8, false);
cv::imshow("Duplicate Apriltags detected. Hide them", image_copy);
cv::waitKey();
LOG(WARNING) << "Found apriltag not belonging to calibration board. Check the image for "
<< "the tag and hide it.";
return TargetObservation::Ptr();
}
}
// Convert corners to cv::Mat (4 consecutive corners form one tag).
// point ordering here
// 11-----10 15-----14
// | TAG 2 | | TAG 3 |
// 8-------9 12-----13
// 3-------2 7-------6
// y | TAG 0 | | TAG 1 |
// ^ 0-------1 4-------5
// |-->x
cv::Mat tag_corners(4u * detections.size(), 2, CV_32F);
for (size_t tag_idx = 0; tag_idx < detections.size(); tag_idx++) {
for (size_t tag_corner_idx = 0; tag_corner_idx < 4; tag_corner_idx++) {
tag_corners.at<float>(4u * tag_idx + tag_corner_idx, 0) =
detections[tag_idx].p[tag_corner_idx].first;
tag_corners.at<float>(4u * tag_idx + tag_corner_idx, 1) =
detections[tag_idx].p[tag_corner_idx].second;
}
}
// Store a copy of the corner list before subpix refinement.
cv::Mat tag_corners_raw = tag_corners.clone();
// Perform optional subpixel refinement on all tag corners (four corners each tag).
if (detector_config_.run_subpixel_refinement) {
cv::cornerSubPix(image, tag_corners, cv::Size(2, 2), cv::Size(-1, -1),
cv::TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 30, 0.1));
}
// Insert the observed points into the correct location of the grid point array.
// point ordering
// 12-----13 14-----15
// | TAG 2 | | TAG 3 |
// 8-------9 10-----11
// 4-------5 6-------7
// y | TAG 0 | | TAG 1 |
// ^ 0-------1 2-------3
// |-->x
Eigen::VectorXi corner_ids(target_->size());
Eigen::Matrix2Xd image_corners(2, target_->size());
size_t out_point_idx = 0u;
for (size_t tag_idx = 0; tag_idx < detections.size(); ++tag_idx) {
const unsigned int tag_id = detections[tag_idx].id;
// Calculate the grid idx for all four tag corners given the tagId and cols.
const size_t cols = target_->cols();
const unsigned int base_idx =
tag_id * 2 + static_cast<int>(tag_id / (cols / 2)) * cols;
unsigned int point_indices_tag[] = {base_idx,
base_idx + 1,
base_idx + static_cast<unsigned int>(cols + 1),
base_idx + static_cast<unsigned int>(cols)};
// Add four points per tag
for (int tag_corner_idx = 0; tag_corner_idx < 4; tag_corner_idx++) {
const Eigen::Vector2d corner_refined(
tag_corners.row(4 * tag_idx + tag_corner_idx).at<float>(0),
tag_corners.row(4 * tag_idx + tag_corner_idx).at<float>(1));
const Eigen::Vector2d corner_raw(
tag_corners_raw.row(4 * tag_idx + tag_corner_idx).at<float>(0),
tag_corners_raw.row(4 * tag_idx + tag_corner_idx).at<float>(1));
// Add corner points if it has not moved too far in the subpix refinement.
const double subpix_displacement_squarred = (corner_refined - corner_raw).squaredNorm();
if (subpix_displacement_squarred <= detector_config_.max_subpixel_refine_displacement_px_sq) {
corner_ids(out_point_idx) = point_indices_tag[tag_corner_idx];
image_corners.col(out_point_idx) = corner_refined;
++out_point_idx;
}
}
}
corner_ids.conservativeResize(out_point_idx);
image_corners.conservativeResize(Eigen::NoChange, out_point_idx);
return TargetObservation::Ptr(new TargetObservation(target_, image.rows, image.cols,
corner_ids, image_corners));
}
} // namespace calibration
} // namespace aslam
|
0039e74f831d90c7d25cb774f9fb665c55091774
|
25d2e23145f4a3302642b8b1f4b95b5f6cb32d6a
|
/Legacy/621/Final/Osal/SslSocket.cpp
|
8172b6b0101ef59673c9d0c0566cdd176960eb26
|
[] |
no_license
|
mfeingol/almonaster
|
3b167043b29144e96d50e620f03d1015bc74c4a3
|
57caeda258bc4bce60e37f61e122b791767147e7
|
refs/heads/master
| 2023-01-11T07:57:28.278474
| 2023-01-03T23:45:48
| 2023-01-03T23:53:09
| 223,525,538
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 33,608
|
cpp
|
SslSocket.cpp
|
// Socket.cpp: implementation of the Socket class.
//
//////////////////////////////////////////////////////////////////////
//
// OSAL - Operating System Abstraction Library
// Copyright (C) 1998 Max Attar Feingold (maf6@cornell.edu)
//
// 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; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
#define OSAL_BUILD
#include "SslSocket.h"
#undef OSAL_BUILD
#ifdef __WIN32__
#include <stdio.h>
#include "File.h"
#include "Algorithm.h"
SslContext::SslContext() {
memset(&m_serverCreds, 0, sizeof(m_serverCreds));
}
SslContext::~SslContext() {
FreeCredentialsHandle(&m_serverCreds);
}
BYTE* SslContext::ReadFile(const char* pszFileName, size_t* pcbFile) {
*pcbFile = 0;
File fFile;
int iErrCode = fFile.OpenRead(pszFileName);
if (iErrCode != OK)
return NULL;
size_t cbSize;
iErrCode = fFile.GetSize(&cbSize);
if (iErrCode != OK)
return NULL;
BYTE* pbFile = new BYTE[cbSize];
if (pbFile == NULL)
return NULL;
iErrCode = fFile.Read(pbFile, cbSize, pcbFile);
if (iErrCode != OK) {
delete [] pbFile;
return NULL;
}
return pbFile;
}
class AutoClosePCCERT_CONTEXT {
private:
PCCERT_CONTEXT m_ctx;
public:
AutoClosePCCERT_CONTEXT(PCCERT_CONTEXT ctx) {
m_ctx = ctx;
}
~AutoClosePCCERT_CONTEXT() {
CertFreeCertificateContext(m_ctx);
}
};
class AutoCloseHCERTSTORE{
private:
HCERTSTORE m_store;
public:
AutoCloseHCERTSTORE(HCERTSTORE store) {
m_store = store;
}
~AutoCloseHCERTSTORE() {
CertCloseStore(m_store, 0);
}
};
int SslContext::Initialize (const char* pszCertFile, const char* pszKeyFile) {
DWORD cbData;
// Open the public key
size_t cbCert;
BYTE* pbCert = ReadFile(pszCertFile, &cbCert);
if (pbCert == NULL)
return ERROR_FAILURE;
Algorithm::AutoDelete<BYTE> autoCert(pbCert, true);
PCCERT_CONTEXT phPublicKey = CertCreateCertificateContext(
X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
pbCert,
cbCert);
if (phPublicKey == NULL)
return ERROR_FAILURE;
AutoClosePCCERT_CONTEXT autoPublicKey(phPublicKey);
// Open the private key file
size_t cbPfx;
BYTE* pbPfx = ReadFile(pszKeyFile, &cbPfx);
if (pbPfx == NULL)
return ERROR_FAILURE;
Algorithm::AutoDelete<BYTE> autodelete(pbPfx, true);
CRYPT_DATA_BLOB pfxBlob;
pfxBlob.cbData = (DWORD)cbPfx;
pfxBlob.pbData = pbPfx;
HCERTSTORE hTempStore = PFXImportCertStore(&pfxBlob, NULL, 0);
if (hTempStore == NULL)
return ERROR_FAILURE;
AutoCloseHCERTSTORE autoTempStore(hTempStore);
// Make sure the two match
cbData = 0;
CertGetCertificateContextProperty(phPublicKey, CERT_SHA1_HASH_PROP_ID, NULL, &cbData);
BYTE* pbPublicKeySha1Hash = (BYTE*)StackAlloc(cbData);
if (!CertGetCertificateContextProperty(phPublicKey, CERT_SHA1_HASH_PROP_ID, pbPublicKeySha1Hash, &cbData))
return ERROR_FAILURE;
PCCERT_CONTEXT phPrivateKey = NULL;
while ((phPrivateKey = CertEnumCertificatesInStore(hTempStore, phPrivateKey)) != NULL) {
cbData = 0;
CertGetCertificateContextProperty(phPrivateKey, CERT_SHA1_HASH_PROP_ID, NULL, &cbData);
BYTE* pbPrivateKeySha1Hash = (BYTE*)StackAlloc(cbData);
if (!CertGetCertificateContextProperty(phPrivateKey, CERT_SHA1_HASH_PROP_ID, pbPrivateKeySha1Hash, &cbData)) {
CertFreeCertificateContext(phPrivateKey);
return ERROR_FAILURE;
}
if (memcmp(pbPublicKeySha1Hash, pbPrivateKeySha1Hash, cbData) == 0) {
// Make sure the final cert handle has an associated private key
cbData = 0;
CertGetCertificateContextProperty(phPrivateKey, CERT_KEY_PROV_INFO_PROP_ID, NULL, &cbData);
if (cbData > 0) {
CRYPT_KEY_PROV_INFO* pinfo = (CRYPT_KEY_PROV_INFO*) StackAlloc(cbData);
if (CertGetCertificateContextProperty(phPrivateKey, CERT_KEY_PROV_INFO_PROP_ID, pinfo, &cbData))
break;
}
}
}
// Make sure we have a handle to the private key
if (phPrivateKey == NULL)
return ERROR_FAILURE;
AutoClosePCCERT_CONTEXT autoPrivateKey(phPrivateKey);
SCHANNEL_CRED sChannelCred = {0};
sChannelCred.dwVersion = SCHANNEL_CRED_VERSION;
sChannelCred.dwFlags = SCH_CRED_NO_SYSTEM_MAPPER;
sChannelCred.cCreds = 1;
sChannelCred.paCred = &phPrivateKey;
sChannelCred.grbitEnabledProtocols = SP_PROT_SSL3_CLIENT | SP_PROT_SSL3_SERVER |
SP_PROT_TLS1_CLIENT | SP_PROT_TLS1_SERVER;
SECURITY_STATUS ss = AcquireCredentialsHandle(
NULL,
UNISP_NAME,
SECPKG_CRED_INBOUND,
NULL,
&sChannelCred,
NULL,
NULL,
&m_serverCreds,
NULL);
if (ss != SEC_E_OK)
return ERROR_FAILURE;
PSecPkgInfo psecInfo;
ss = QuerySecurityPackageInfo(UNISP_NAME, &psecInfo);
if (ss != SEC_E_OK)
return ERROR_FAILURE;
m_ulMaxInitialChunkSize = psecInfo->cbMaxToken;
FreeContextBuffer(psecInfo);
return OK;
}
SslSocket::SslSocket (SslContext* pSslContext) {
m_pSslContext = pSslContext;
SecInvalidateHandle(&m_ctxHandle);
m_pIncompleteData = NULL;
m_cbIncompleteData = 0;
m_pLeftoverPlainText = NULL;
m_cbLeftoverPlainText = 0;
m_bConnected = false;
m_cbMaxChunkSize = 0;
m_cbHeaderSize = 0;
m_cbTrailerSize = 0;
}
SslSocket::~SslSocket() {
Clear();
}
void SslSocket::Clear() {
// We don't own the SSL context
m_pSslContext = NULL;
if (SecIsValidHandle(&m_ctxHandle)) {
DeleteSecurityContext(&m_ctxHandle);
SecInvalidateHandle(&m_ctxHandle);
}
delete [] m_pIncompleteData;
m_pIncompleteData = NULL;
m_cbIncompleteData = 0;
delete [] m_pLeftoverPlainText;
m_pLeftoverPlainText = NULL;
m_cbLeftoverPlainText = 0;
}
int SslSocket::Close() {
SECURITY_STATUS ss;
if (SecIsValidHandle(&m_ctxHandle)) {
DWORD dwShutdown = SCHANNEL_SHUTDOWN;
SecBuffer inBuffer;
inBuffer.BufferType = SECBUFFER_TOKEN;
inBuffer.cbBuffer = sizeof(DWORD);
inBuffer.pvBuffer = &dwShutdown;
SecBufferDesc inBufferDesc;
inBufferDesc.ulVersion = SECBUFFER_VERSION;
inBufferDesc.cBuffers = 1;
inBufferDesc.pBuffers = &inBuffer;
ss = ApplyControlToken(&m_ctxHandle, &inBufferDesc);
if (ss == SEC_E_OK) {
ULONG ulSSPIOutFlags = 0;
SecBuffer outBuffer;
outBuffer.BufferType = SECBUFFER_TOKEN;
outBuffer.cbBuffer = 0;
outBuffer.pvBuffer = NULL;
SecBufferDesc outBufferDesc;
outBufferDesc.ulVersion = SECBUFFER_VERSION;
outBufferDesc.cBuffers = 1;
outBufferDesc.pBuffers = &outBuffer;
ss = AcceptSecurityContext(
&m_pSslContext->m_serverCreds,
&m_ctxHandle,
NULL,
ASC_REQ_SEQUENCE_DETECT | ASC_REQ_REPLAY_DETECT | ASC_REQ_CONFIDENTIALITY |
ASC_REQ_EXTENDED_ERROR | ASC_REQ_ALLOCATE_MEMORY | ASC_REQ_STREAM,
SECURITY_NATIVE_DREP,
NULL,
&outBufferDesc,
&ulSSPIOutFlags,
NULL);
if (ss == SEC_E_OK && outBuffer.cbBuffer > 0 && outBuffer.pvBuffer != NULL)
// Best effort
SendSecBuffer(outBuffer);
FreeContextBuffer(outBuffer.pvBuffer);
}
}
m_bConnected = false;
Clear();
return Socket::Close();
}
Socket* SslSocket::Accept() {
SslSocket* pSocket = new SslSocket (m_pSslContext);
if (pSocket == NULL) {
return NULL;
}
if (Socket::Accept (pSocket) != OK) {
delete pSocket;
return NULL;
}
return pSocket;
}
int SslSocket::Negotiate() {
const unsigned long cbMaxInitialChunk = m_pSslContext->m_ulMaxInitialChunkSize;
size_t cbExtra = 0;
BYTE* pbRecvBuffer = new BYTE[cbMaxInitialChunk];
if (pbRecvBuffer == NULL)
return ERROR_OUT_OF_MEMORY;
Algorithm::AutoDelete<BYTE> autoDelete (pbRecvBuffer, true);
SecBuffer inSecBuffers[2];
SecBufferDesc inBuffer;
inBuffer.ulVersion = SECBUFFER_VERSION;
inBuffer.cBuffers = countof(inSecBuffers);
inBuffer.pBuffers = inSecBuffers;
SecBuffer outSecBuffer;
SecBufferDesc outBuffer;
outBuffer.ulVersion = SECBUFFER_VERSION;
outBuffer.cBuffers = 1;
outBuffer.pBuffers = &outSecBuffer;
int iErrCode = OK;
SECURITY_STATUS ss = SEC_I_CONTINUE_NEEDED;
bool bRecv = true;
// Loop until we're done, one way or another
while (ss == SEC_I_CONTINUE_NEEDED && iErrCode == OK) {
ULONG ulSSPIOutFlags = 0;
size_t cbRecvd = 0;
if (bRecv) {
cbRecvd = Socket::SocketRecv(pbRecvBuffer + cbExtra, cbMaxInitialChunk - cbExtra);
if (cbRecvd == SOCKET_ERROR || cbRecvd == 0) {
iErrCode = ERROR_FAILURE;
break;
}
}
const size_t cbInputBuffer = cbRecvd + cbExtra;
inSecBuffers[0].BufferType = SECBUFFER_TOKEN;
inSecBuffers[0].cbBuffer = (unsigned long) cbInputBuffer;
inSecBuffers[0].pvBuffer = pbRecvBuffer;
inSecBuffers[1].BufferType = SECBUFFER_EMPTY;
inSecBuffers[1].cbBuffer = 0;
inSecBuffers[1].pvBuffer = NULL;
outSecBuffer.BufferType = SECBUFFER_TOKEN;
outSecBuffer.cbBuffer = 0;
outSecBuffer.pvBuffer = NULL;
ss = AcceptSecurityContext(
&m_pSslContext->m_serverCreds,
SecIsValidHandle(&m_ctxHandle) ? &m_ctxHandle : NULL,
&inBuffer,
ASC_REQ_SEQUENCE_DETECT | ASC_REQ_REPLAY_DETECT | ASC_REQ_CONFIDENTIALITY |
ASC_REQ_EXTENDED_ERROR | ASC_REQ_ALLOCATE_MEMORY | ASC_REQ_STREAM,
SECURITY_NATIVE_DREP,
&m_ctxHandle,
&outBuffer,
&ulSSPIOutFlags,
NULL);
switch (ss) {
case SEC_E_OK:
if (outSecBuffer.cbBuffer > 0 &&
outSecBuffer.pvBuffer != NULL) {
Assert(outSecBuffer.BufferType == SECBUFFER_TOKEN);
iErrCode = SendSecBuffer(outSecBuffer);
}
else Assert(outSecBuffer.BufferType == SECBUFFER_EMPTY);
// Compute max sizes
SecPkgContext_StreamSizes sizes;
if (QueryContextAttributes(&m_ctxHandle, SECPKG_ATTR_STREAM_SIZES, &sizes) != SEC_E_OK) {
iErrCode = ERROR_FAILURE;
} else {
m_cbMaxChunkSize = sizes.cbMaximumMessage;
m_cbHeaderSize = sizes.cbHeader;
m_cbTrailerSize = sizes.cbTrailer;
Assert(inSecBuffers[0].BufferType == SECBUFFER_TOKEN);
if (inSecBuffers[1].BufferType == SECBUFFER_EXTRA) {
Assert(inSecBuffers[1].cbBuffer > 0);
Assert(inSecBuffers[1].pvBuffer == NULL);
Assert(m_pIncompleteData == NULL);
Assert(m_cbIncompleteData == 0);
// Save the extra data for the next Recv
size_t cbIncomplete = inSecBuffers[1].cbBuffer;
m_pIncompleteData = new BYTE[cbIncomplete];
if (m_pIncompleteData == NULL) {
iErrCode = ERROR_OUT_OF_MEMORY;
} else {
m_cbIncompleteData = cbIncomplete;
memcpy(m_pIncompleteData, pbRecvBuffer + cbInputBuffer - cbIncomplete, cbIncomplete);
}
}
else Assert(inSecBuffers[1].BufferType == SECBUFFER_EMPTY);
}
break;
case SEC_E_INCOMPLETE_MESSAGE:
// Receive some more data and try that again
bRecv = true;
cbExtra += cbRecvd;
break;
case SEC_I_CONTINUE_NEEDED:
// We can get an empty out buffer and an extra in buffer
if (outSecBuffer.BufferType == SECBUFFER_EMPTY) {
if (inSecBuffers[1].BufferType == SECBUFFER_EXTRA) {
Assert (inSecBuffers[1].cbBuffer > 0);
Assert (inSecBuffers[1].pvBuffer == NULL);
// Try again using this data
size_t cbIncomplete = inSecBuffers[1].cbBuffer;
memmove(pbRecvBuffer, pbRecvBuffer + cbInputBuffer - cbIncomplete, cbIncomplete);
cbExtra = cbIncomplete;
// Don't receive any more data for the time being, unless we're not making progress
bRecv = !bRecv;
} else {
// What to do...? Receive some more, I guess
cbExtra = 0;
bRecv = true;
}
} else {
Assert(outSecBuffer.BufferType == SECBUFFER_TOKEN);
Assert(outSecBuffer.cbBuffer != 0);
Assert(outSecBuffer.pvBuffer != NULL);
// Send a buffer back to the client and try that again
iErrCode = SendSecBuffer(outSecBuffer);
// Receive some data
cbExtra = 0;
bRecv = true;
}
break;
default:
//printf("AcceptSecurityContext returned 0x%x\n", ss);
// Best effort send back information to the client
if (outSecBuffer.cbBuffer != 0 && (ulSSPIOutFlags & ISC_RET_EXTENDED_ERROR))
SendSecBuffer(outSecBuffer);
// We failed, regardless
iErrCode = ERROR_FAILURE;
break;
}
FreeContextBuffer(outSecBuffer.pvBuffer);
}
m_bConnected = iErrCode == OK;
return iErrCode;
}
int SslSocket::SendSecBuffer(const SecBuffer& secBuffer) {
size_t stSent = PlainTextSocketSend(secBuffer.pvBuffer, secBuffer.cbBuffer);
if (stSent != secBuffer.cbBuffer)
return ERROR_FAILURE;
return OK;
}
size_t SslSocket::PlainTextSocketSend(const void* pData, size_t cbData) {
size_t cbTotalSent = 0;
while (cbTotalSent < cbData) {
size_t cbSent = Socket::SocketSend((BYTE*)pData + cbTotalSent, cbData - cbTotalSent);
if (cbSent == SOCKET_ERROR)
return (size_t)SOCKET_ERROR;
m_stNumBytesSent += cbSent;
cbTotalSent += cbSent;
}
return cbTotalSent;
}
int SslSocket::Connect (const char* pszAddress, short siPort) {
// TODO - Client-side SSL support
Assert (false);
return ERROR_NOT_IMPLEMENTED;
}
// Overridden from base Socket class - this is called on every user send
size_t SslSocket::SocketSend (const void* pData, size_t cbSend) {
if (!m_bConnected)
return (size_t)SOCKET_ERROR;
// We need to send in chunks
size_t cbTotalSent = 0;
while(cbTotalSent < cbSend) {
size_t cbSent = SocketSendChunk(
(BYTE*)pData + cbTotalSent,
min(m_cbMaxChunkSize, cbSend - cbTotalSent));
if (cbSent == SOCKET_ERROR)
return (size_t)SOCKET_ERROR;
cbTotalSent += cbSent;
}
return cbTotalSent;
}
size_t SslSocket::SocketSendChunk(const void* pData, size_t cbPlainTextSend) {
Assert(cbPlainTextSend <= m_cbMaxChunkSize);
BYTE* pbIOBuffer = new BYTE[m_cbHeaderSize + cbPlainTextSend + m_cbTrailerSize];
if (pbIOBuffer == NULL)
return (size_t)SOCKET_ERROR;
Algorithm::AutoDelete<BYTE> autoIOBuffer(pbIOBuffer, true);
BYTE* pbHeader = pbIOBuffer;
BYTE* pbChunk = pbIOBuffer + m_cbHeaderSize;
BYTE* pbTrailer = pbChunk + cbPlainTextSend;
memcpy(pbChunk, pData, cbPlainTextSend);
SecBuffer secBuffers[4];
secBuffers[0].BufferType = SECBUFFER_STREAM_HEADER;
secBuffers[0].cbBuffer = m_cbHeaderSize;
secBuffers[0].pvBuffer = pbHeader;
secBuffers[1].BufferType = SECBUFFER_DATA;
secBuffers[1].cbBuffer = cbPlainTextSend;
secBuffers[1].pvBuffer = pbChunk;
secBuffers[2].BufferType = SECBUFFER_STREAM_TRAILER;
secBuffers[2].cbBuffer = m_cbTrailerSize;
secBuffers[2].pvBuffer = pbTrailer;
secBuffers[3].BufferType = SECBUFFER_EMPTY;
secBuffers[3].cbBuffer = 0;
secBuffers[3].pvBuffer = NULL;
SecBufferDesc secBuffer;
secBuffer.ulVersion = SECBUFFER_VERSION;
secBuffer.cBuffers = countof(secBuffers);
secBuffer.pBuffers = secBuffers;
size_t cbSent;
SECURITY_STATUS ss = EncryptMessage(&m_ctxHandle, 0, &secBuffer, 0);
switch (ss) {
case SEC_E_OK:
{
Assert(secBuffers[0].BufferType == SECBUFFER_STREAM_HEADER);
Assert(secBuffers[1].BufferType == SECBUFFER_DATA);
Assert(secBuffers[2].BufferType == SECBUFFER_STREAM_TRAILER);
Assert(secBuffers[3].BufferType == SECBUFFER_EMPTY);
size_t cbCypherSend = secBuffers[0].cbBuffer + secBuffers[1].cbBuffer + secBuffers[2].cbBuffer;
cbSent = PlainTextSocketSend(pbIOBuffer, cbCypherSend);
if (cbSent != SOCKET_ERROR) {
Assert(cbSent == cbCypherSend);
cbSent = cbPlainTextSend;
}
}
break;
default:
//printf("EncryptMessage returned 0x%x\n", ss);
cbSent = (size_t)SOCKET_ERROR;
break;
}
return cbSent;
}
size_t SslSocket::SocketRecv (void* pData, size_t cbData) {
// If we have some plaintext left over, just return that
if (m_cbLeftoverPlainText > 0) {
size_t cbMin = min(m_cbLeftoverPlainText, cbData);
memcpy(pData, m_pLeftoverPlainText, cbMin);
if (m_cbLeftoverPlainText > cbMin) {
memmove(m_pLeftoverPlainText, m_pLeftoverPlainText + cbMin, m_cbLeftoverPlainText - cbMin);
} else {
delete [] m_pLeftoverPlainText;
m_pLeftoverPlainText = NULL;
m_cbLeftoverPlainText = 0;
}
return cbMin;
}
if (!m_bConnected)
return (size_t)SOCKET_ERROR;
while (true) {
BYTE* pbCypherText;
size_t cbCypherText;
if (m_cbIncompleteData == 0) {
// Nothing in the buffer... Recv some more
pbCypherText = (BYTE*)pData;
cbCypherText = Socket::SocketRecv(pData, cbData);
if (cbCypherText == SOCKET_ERROR || cbCypherText == 0)
return (size_t)SOCKET_ERROR;
} else {
// Take ownership of the incomplete data buffer
pbCypherText = m_pIncompleteData;
cbCypherText = m_cbIncompleteData;
m_pIncompleteData = NULL;
m_cbIncompleteData = 0;
}
size_t cbDecrypted;
int iErrCode = DecryptMessageWrapper(pbCypherText, cbCypherText, &cbDecrypted);
switch (iErrCode) {
case OK:
{
// If the cyphertext we decrypted was in the user's buffer, we're done
if (pbCypherText == pData)
return cbDecrypted;
// Otherwise, we need to copy it over.
// We may have some plaintext left over for the next user Recv
size_t cbMin = min(cbDecrypted, cbData);
memcpy(pData, pbCypherText, cbMin);
if (cbDecrypted > cbMin) {
Assert(m_pLeftoverPlainText == NULL);
m_pLeftoverPlainText = new BYTE[cbDecrypted - cbMin];
if (m_pLeftoverPlainText == NULL)
return (size_t)SOCKET_ERROR;
m_cbLeftoverPlainText = cbDecrypted - cbMin;
memcpy(m_pLeftoverPlainText, pbCypherText + cbMin, m_cbLeftoverPlainText);
}
// Delete the old incomplete data buffer
delete [] pbCypherText;
return cbMin;
}
break;
case WARNING:
{
// Need to recv more for the incomplete data to make sense
Assert(cbCypherText < m_cbMaxChunkSize);
BYTE* pbChunk = new BYTE[m_cbMaxChunkSize];
if (pbChunk == NULL)
return (size_t)SOCKET_ERROR;
if (cbCypherText > 0)
memcpy(pbChunk, pbCypherText, cbCypherText);
// Receive as large a chunk as possible
size_t cbRecvd = Socket::SocketRecv(
pbChunk + cbCypherText,
m_cbMaxChunkSize - cbCypherText);
if (cbRecvd == SOCKET_ERROR || cbRecvd == 0)
return (size_t)SOCKET_ERROR;
// Delete the old incomplete data buffer
if (pbCypherText != pData)
delete [] pbCypherText;
// Put the buffer back into the incomplete data buffer
m_pIncompleteData = pbChunk;
m_cbIncompleteData = cbCypherText + cbRecvd;
}
break;
default:
// Delete the old incomplete data buffer
if (pbCypherText != pData)
delete [] pbCypherText;
return (size_t)SOCKET_ERROR;
}
}
}
int SslSocket::DecryptMessageWrapper(BYTE* pbData, size_t cbCypherData, size_t* pcbPlainData) {
int iErrCode = OK;
Assert(cbCypherData > 0);
*pcbPlainData = 0;
SecBuffer secBuffers[4];
secBuffers[0].BufferType = SECBUFFER_DATA;
secBuffers[0].cbBuffer = cbCypherData;
secBuffers[0].pvBuffer = pbData;
for (int i = 1; i < countof(secBuffers); i ++) {
secBuffers[i].BufferType = SECBUFFER_EMPTY;
secBuffers[i].cbBuffer = 0;
secBuffers[i].pvBuffer = NULL;
}
SecBufferDesc secBuffer;
secBuffer.ulVersion = SECBUFFER_VERSION;
secBuffer.cBuffers = countof(secBuffers);
secBuffer.pBuffers = secBuffers;
SECURITY_STATUS ss = DecryptMessage(&m_ctxHandle, &secBuffer, 0, NULL);
switch (ss) {
case SEC_E_OK:
case SEC_I_CONTEXT_EXPIRED:
{
SecBuffer* pDataBuffer = NULL, * pExtraBuffer = NULL;
for(int i = 1; i < countof(secBuffers); i ++) {
if(secBuffers[i].BufferType == SECBUFFER_DATA) {
Assert (pDataBuffer == NULL);
pDataBuffer = secBuffers + i;
}
if(secBuffers[i].BufferType == SECBUFFER_EXTRA) {
Assert (pExtraBuffer == NULL);
pExtraBuffer = secBuffers + i;
}
}
if (pDataBuffer == NULL) {
*pcbPlainData = 0;
} else {
Assert(cbCypherData >= pDataBuffer->cbBuffer);
*pcbPlainData = pDataBuffer->cbBuffer;
if ((void*)pbData != pDataBuffer->pvBuffer)
memmove(pbData, pDataBuffer->pvBuffer, pDataBuffer->cbBuffer);
}
// Copy any 'extra' data into the incomplete buffer
if (pExtraBuffer != NULL) {
Assert(m_pIncompleteData == NULL);
Assert(pExtraBuffer->cbBuffer > 0);
Assert(pExtraBuffer->pvBuffer != NULL);
m_pIncompleteData = new BYTE[pExtraBuffer->cbBuffer];
if (m_pIncompleteData == NULL) {
iErrCode = ERROR_OUT_OF_MEMORY;
} else {
m_cbIncompleteData = pExtraBuffer->cbBuffer;
memcpy(m_pIncompleteData, pExtraBuffer->pvBuffer, pExtraBuffer->cbBuffer);
}
}
}
break;
case SEC_E_INCOMPLETE_MESSAGE:
// Tell the caller to try again with more data
iErrCode = WARNING;
break;
case SEC_I_RENEGOTIATE:
// Not supported
Assert(false);
default:
// printf("DecryptMessage returned 0x%x\n", ss);
iErrCode = ERROR_FAILURE;
break;
}
return iErrCode;
}
#else
#include "Library.h"
typedef void (__cdecl *FXN_OpenSSL_add_all_algorithms)();
typedef int (__cdecl *FXN_SSL_library_init)();
typedef SSL_CTX* (__cdecl *FXN_SSL_CTX_new) (SSL_METHOD*);
typedef void (__cdecl *FXN_SSL_CTX_free) (SSL_CTX*);
typedef int (__cdecl *FXN_SSL_CTX_check_private_key) (SSL_CTX*);
typedef int (__cdecl *FXN_SSL_CTX_use_certificate_file) (SSL_CTX*, const char*, int);
typedef int (__cdecl *FXN_SSL_CTX_use_PrivateKey_file) (SSL_CTX*, const char*, int);
typedef SSL_METHOD* (__cdecl *FXN_SSL_server_method) (void);
typedef SSL* (__cdecl *FXN_SSL_new) (SSL_CTX*);
typedef void (__cdecl *FXN_SSL_free) (SSL*);
typedef int (__cdecl *FXN_SSL_accept) (SSL*);
typedef int (__cdecl *FXN_SSL_set_fd) (SSL*, int);
typedef int (__cdecl *FXN_SSL_read) (SSL*, void*, int);
typedef int (__cdecl *FXN_SSL_write) (SSL*, const void*, int);
typedef long (__cdecl *FXN_ERR_get_error)();
typedef void (__cdecl *FXN_ERR_error_string_n)(unsigned long, char*, size_t);
class AutoLoadOpenSsl {
private:
Library m_hModuleSsl;
Library m_hModuleLib;
bool m_bEnabled;
public:
FXN_SSL_CTX_new Dyn_SSL_CTX_new;
FXN_SSL_CTX_free Dyn_SSL_CTX_free;
FXN_SSL_CTX_check_private_key Dyn_SSL_CTX_check_private_key;
FXN_SSL_CTX_use_certificate_file Dyn_SSL_CTX_use_certificate_file;
FXN_SSL_CTX_use_PrivateKey_file Dyn_SSL_CTX_use_PrivateKey_file;
FXN_SSL_server_method Dyn_SSL_server_method;
FXN_SSL_new Dyn_SSL_new;
FXN_SSL_free Dyn_SSL_free;
FXN_SSL_accept Dyn_SSL_accept;
FXN_SSL_set_fd Dyn_SSL_set_fd;
FXN_SSL_read Dyn_SSL_read;
FXN_SSL_write Dyn_SSL_write;
FXN_ERR_get_error Dyn_ERR_get_error;
FXN_ERR_error_string_n Dyn_ERR_error_string_n;
AutoLoadOpenSsl() {
m_bEnabled = false;
// Load libraries
if (m_hModuleLib.Open("libeay32.dll") != OK) {
return;
}
if (m_hModuleSsl.Open("ssleay32.dll") != OK) {
return;
}
// Initialize
FXN_OpenSSL_add_all_algorithms Dyn_OpenSSL_add_all_algorithms = (FXN_OpenSSL_add_all_algorithms)
m_hModuleLib.GetExport ("OPENSSL_add_all_algorithms_noconf");
if (Dyn_OpenSSL_add_all_algorithms == NULL) {
return;
}
FXN_SSL_library_init Dyn_SSL_library_init = (FXN_SSL_library_init)
m_hModuleSsl.GetExport ("SSL_library_init");
if (Dyn_OpenSSL_add_all_algorithms == NULL ||
Dyn_SSL_library_init == NULL) {
return;
}
//SSL_load_error_strings();
Dyn_SSL_library_init();
Dyn_OpenSSL_add_all_algorithms();
// Get all proc addresses
Dyn_SSL_CTX_new = (FXN_SSL_CTX_new) m_hModuleSsl.GetExport ("SSL_CTX_new");
Dyn_SSL_CTX_free = (FXN_SSL_CTX_free) m_hModuleSsl.GetExport ("SSL_CTX_free");
Dyn_SSL_CTX_check_private_key = (FXN_SSL_CTX_check_private_key) m_hModuleSsl.GetExport ("SSL_CTX_check_private_key");
Dyn_SSL_CTX_use_certificate_file = (FXN_SSL_CTX_use_certificate_file) m_hModuleSsl.GetExport ("SSL_CTX_use_certificate_file");
Dyn_SSL_CTX_use_PrivateKey_file = (FXN_SSL_CTX_use_PrivateKey_file) m_hModuleSsl.GetExport ("SSL_CTX_use_PrivateKey_file");
Dyn_SSL_server_method = (FXN_SSL_server_method) m_hModuleSsl.GetExport ("SSLv23_server_method");
Dyn_SSL_new = (FXN_SSL_new) m_hModuleSsl.GetExport ("SSL_new");
Dyn_SSL_free = (FXN_SSL_free) m_hModuleSsl.GetExport ("SSL_free");
Dyn_SSL_accept = (FXN_SSL_accept) m_hModuleSsl.GetExport ("SSL_accept");
Dyn_SSL_set_fd = (FXN_SSL_set_fd) m_hModuleSsl.GetExport ("SSL_set_fd");
Dyn_SSL_read = (FXN_SSL_read) m_hModuleSsl.GetExport ("SSL_read");
Dyn_SSL_write = (FXN_SSL_write) m_hModuleSsl.GetExport ("SSL_write");
Dyn_ERR_get_error = (FXN_ERR_get_error) m_hModuleLib.GetExport ("ERR_get_error");
Dyn_ERR_error_string_n = (FXN_ERR_error_string_n) m_hModuleLib.GetExport ("ERR_error_string_n");
if (Dyn_SSL_CTX_new == NULL ||
Dyn_SSL_CTX_free == NULL ||
Dyn_SSL_CTX_check_private_key == NULL ||
Dyn_SSL_CTX_use_certificate_file == NULL ||
Dyn_SSL_CTX_use_PrivateKey_file == NULL ||
Dyn_SSL_server_method == NULL ||
Dyn_SSL_new == NULL ||
Dyn_SSL_free == NULL ||
Dyn_SSL_accept == NULL ||
Dyn_SSL_set_fd == NULL ||
Dyn_SSL_read == NULL ||
Dyn_SSL_write == NULL ||
Dyn_ERR_get_error == NULL ||
Dyn_ERR_error_string_n == NULL
) {
return;
}
m_bEnabled = true;
}
bool IsEnabled() {
return m_bEnabled;
}
};
AutoLoadOpenSsl Ssl;
#define SSL_CTX_new Ssl.Dyn_SSL_CTX_new
#define SSL_CTX_free Ssl.Dyn_SSL_CTX_free
#define SSL_CTX_check_private_key Ssl.Dyn_SSL_CTX_check_private_key
#define SSL_CTX_use_certificate_file Ssl.Dyn_SSL_CTX_use_certificate_file
#define SSL_CTX_use_PrivateKey_file Ssl.Dyn_SSL_CTX_use_PrivateKey_file
#define SSL_server_method Ssl.Dyn_SSL_server_method
#define SSL_new Ssl.Dyn_SSL_new
#define SSL_free Ssl.Dyn_SSL_free
#define SSL_accept Ssl.Dyn_SSL_accept
#define SSL_set_fd Ssl.Dyn_SSL_set_fd
#define SSL_read Ssl.Dyn_SSL_read
#define SSL_write Ssl.Dyn_SSL_write
#define ERR_get_error Ssl.Dyn_ERR_get_error
#define ERR_error_string_n Ssl.Dyn_ERR_error_string_n
SslContext::SslContext() {
m_pCtx = NULL;
}
SslContext::~SslContext() {
if (m_pCtx != NULL) {
SSL_CTX_free (m_pCtx);
m_pCtx = NULL;
}
}
SSL_CTX* SslContext::GetContext() {
return m_pCtx;
}
int SslContext::Initialize (const char* pszCertFile, const char* pszKeyFile) {
if (!Ssl.IsEnabled()) {
return ERROR_FAILURE;
}
SSL_METHOD* pMethod = SSL_server_method();
if (pMethod == NULL) {
return ERROR_FAILURE;
}
SSL_CTX* pCtx = SSL_CTX_new (pMethod);
if (pCtx == NULL) {
return ERROR_FAILURE;
}
if (SSL_CTX_use_certificate_file (pCtx, pszCertFile, SSL_FILETYPE_PEM) != 1) {
SSL_CTX_free (pCtx);
return ERROR_FAILURE;
}
if (SSL_CTX_use_PrivateKey_file (pCtx, pszKeyFile, SSL_FILETYPE_PEM) != 1) {
SSL_CTX_free (pCtx);
return ERROR_FAILURE;
}
if (!SSL_CTX_check_private_key (pCtx)) {
SSL_CTX_free (pCtx);
return ERROR_FAILURE;
}
m_pCtx = pCtx;
return OK;
}
SslSocket::SslSocket (SslContext* pSslContext) {
m_pCtx = pSslContext->GetContext();
m_pSsl = NULL;
}
SslSocket::SslSocket (SSL* pSsl) {
m_pCtx = NULL;
m_pSsl = pSsl;
}
SslSocket::~SslSocket() {
if (m_pSsl != NULL) {
SSL_free (m_pSsl);
m_pSsl = NULL;
}
}
int SslSocket::Connect (const char* pszAddress, short siPort) {
// TODO - Client-side SSL support
Assert (false);
return ERROR_NOT_IMPLEMENTED;
}
int SslSocket::Close() {
if (m_pSsl != NULL) {
SSL_free (m_pSsl);
m_pSsl = NULL;
}
return Socket::Close();
}
Socket* SslSocket::Accept() {
Assert (m_Socket != INVALID_SOCKET);
SSL* pSsl = SSL_new (m_pCtx);
if (pSsl == NULL) {
return NULL;
}
SslSocket* pSocket = new SslSocket (pSsl);
if (pSocket == NULL) {
SSL_free (pSsl);
return NULL;
}
if (Socket::Accept (pSocket) != OK) {
delete pSocket;
return NULL;
}
return pSocket;
}
int SslSocket::Negotiate() {
if (SSL_set_fd (m_pSsl, m_Socket) != 1) {
return ERROR_FAILURE;
}
int ret = SSL_accept (m_pSsl);
if (ret != 1) {
return ERROR_FAILURE;
}
return OK;
}
size_t SslSocket::SocketSend (const void* pData, size_t cbSend) {
return SSL_write (m_pSsl, pData, cbSend);
}
size_t SslSocket::SocketRecv (void* pData, size_t stNumBytes) {
if (m_pSsl == NULL) {
return 0;
}
return SSL_read (m_pSsl, pData, stNumBytes);
}
#endif
|
6a546b40a392b6fc5e1be3fec78aaf7263eb3c90
|
14fe9cb57f1751a0747f371ae26186c5a2528ec4
|
/assign3/blackbear.cpp
|
66bb360dee67aec144d621247c50a4e21025c52e
|
[] |
no_license
|
raginid20/CS162
|
68dc08f106cc69ea013d632cabd00960effa4be5
|
a6c1e59857c65e1ceea58fc2be715e50e19028d8
|
refs/heads/main
| 2023-08-15T04:07:49.897327
| 2021-10-02T03:47:04
| 2021-10-02T03:47:04
| 412,678,276
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 702
|
cpp
|
blackbear.cpp
|
/******************************************************
** Program: blackbear.cpp
** Author: Ragini Dindukurthi
** Date: 5/6/2021
** Description: Zoo Tycoon Game
** Input: N/A
** Output: game statements and information
******************************************************/
#include <iostream>
#include <string>
#include "blackbear.h"
using namespace std;
Blackbear::Blackbear(string stage = "adult"){
if(stage == "adult"){// consider changing to char A= adult B= baby
setAnimal(48, 6000, 2, 3, 600, 3000);
}
else if(stage == "baby"){
setAnimal(0, 6000, 2, 3, 1200, 6000);
}
}
Blackbear::Blackbear(){
setAnimal(0,0,0,0,0,0);
}
|
469ed85dca592085cc6bd97d9a57371c8ebb7155
|
b7f1234d71b5523348caf492ef99ce3b52f52369
|
/PhysiCell/addons/PhysiBoSS/src/maboss_network.h
|
52c4f619999095257c29442fcce4958d5e039d82
|
[
"BSD-3-Clause"
] |
permissive
|
pc4covid19/COVID19
|
9614a0e73d167ff2ed5ae33ef41d591b43c75aa9
|
3bb1047fc12b3062b940126513959f3193e78fd7
|
refs/heads/master
| 2023-05-12T23:54:43.614661
| 2021-10-19T14:56:07
| 2021-10-19T14:56:07
| 250,146,377
| 5
| 9
|
BSD-3-Clause
| 2021-10-19T14:55:58
| 2020-03-26T02:55:14
|
Jupyter Notebook
|
UTF-8
|
C++
| false
| false
| 4,050
|
h
|
maboss_network.h
|
#ifndef _MaBoSS_Net_h_
#define _MaBoSS_Net_h_
#include "StochasticSimulationEngine.h"
#include "BooleanNetwork.h"
#include "RunConfig.h"
#include "utils.h"
#include "../../../core/PhysiCell_utilities.h"
/**
* \class MaBoSSNetwork
* \brief Interface with MaBoSS software
*
* \details The MaBOSS network class contains network configs to handel the initialization and run the simulations given an input.
*
* \date 06/08/2020
* \author Gaelle Letort, Institut Curie
* \author Gerard Pradas, BSC-CNS
*/
class MaBoSSNetwork
{
private:
/** \brief MaBoSS instances: network */
Network* network;
/** \brief MaBoSS instances: configurations */
RunConfig* config;
StochasticSimulationEngine* engine;
NetworkState state;
NetworkState output_mask;
/** \brief Time step between each MaBoSS simulation */
double update_time_step = 12.0;
/** \brief Real time to update, after applying noise */
double time_to_update;
double scaling = 1.0;
/** \brief Initial value probabilities, by node */
std::map< std::string, double > initial_values;
/** \brief Mutations to apply to the network */
std::map< std::string, double > mutations;
std::map< std::string, Node*> nodesByName;
std::map< std::string, const Symbol*> parametersByName;
inline void set_time_to_update(){this->time_to_update = this->get_update_time_step();}
public:
/** Constructor */
MaBoSSNetwork() {
network = NULL;
config = NULL;
engine = NULL;
this->nodesByName.clear();
}
/** Desctructor */
~MaBoSSNetwork() {
delete this->engine;
this->engine = NULL;
delete this->network;
this->network = NULL;
delete this->config;
this->config = NULL;
}
/**
* \brief Class initializer
* \param networkFile,configFile MaBoSS configutation files
*/
void init_maboss( std::string networkFile, std::string configFile);
bool has_init() const { return network != NULL && config != NULL; }
void mutate(std::map<std::string, double> mutations);
void set_initial_values(std::map<std::string, double> initial_values)
{ this->initial_values = initial_values; }
void set_parameters(std::map<std::string, double> parameters);
double get_parameter_value(std::string name);
void set_parameter_value(std::string name, double value);
/**
* \brief Restart a vector of bools, to the init values of the network
* \param node_values Vector of bools to write an initial state of the network
*/
void restart_node_values();
/**
* \brief Run the current network
* \param node_values Vector mapping a boolean network to run a simulation
*/
void run_simulation();
/** \brief Return node of given name current value
*
* Return -1 if node doesn't exit \n
* Return 0 if node is 0 \n
* Return 1 if node is 1 */
// int get_maboss_node_index( std::string name );
bool has_node( std::string name );
void set_node_value(std::string name, bool value);
bool get_node_value(std::string name);
std::string get_state();
/** \brief Return update time value */
inline double get_update_time_step(){ return this->update_time_step; }
/**
* \brief Set update time step
* \param time_step Time step between each MaBoSS simulation
*/
inline void set_update_time_step(double time_step) { this->update_time_step = time_step;}
/** \brief Get time to update*/
inline double get_time_to_update() {return this->time_to_update;}
/** \brief Change simulation mode */
inline void set_discrete_time(bool discrete_time, double time_tick) {
this->engine->setDiscreteTime(discrete_time); this->engine->setTimeTick(time_tick);
}
inline void set_scaling(double scaling) { this->scaling = scaling; }
/**
* \brief Print current state of all the nodes of the network
* \param node_values Boolean vector mapping a boolean network
*/
void print_nodes();
void set_state(NetworkState _state) { state = NetworkState(_state.getState()); }
NetworkState get_maboss_state() { return state;}
};
#endif
|
c2e78552992a8ea4899afdad318e36f1fa33445b
|
58a0ba5ee99ec7a0bba36748ba96a557eb798023
|
/Data Structures/Graph/Centroid Decomposition.cpp
|
fcba435a422bae57703d4c4709e99e6b1a90393c
|
[
"MIT"
] |
permissive
|
adityanjr/code-DS-ALGO
|
5bdd503fb5f70d459c8e9b8e58690f9da159dd53
|
1c104c33d2f56fe671d586b702528a559925f875
|
refs/heads/master
| 2022-10-22T21:22:09.640237
| 2022-10-18T15:38:46
| 2022-10-18T15:38:46
| 217,567,198
| 40
| 54
|
MIT
| 2022-10-18T15:38:47
| 2019-10-25T15:50:28
|
C++
|
UTF-8
|
C++
| false
| false
| 1,793
|
cpp
|
Centroid Decomposition.cpp
|
#include <bits/stdc++.h>
using namespace std;
#define N 100100
int n, x, y;
vector < int > graph[N];
struct CentroidDec {
int root, visited[N], siz[N], layer[N], parent[N];
vector < int > centroidTree[N];
void init() {
for (int i = 0; i < N; i++) {
visited[i] = siz[i] = layer[i] = parent[i] = 0;
centroidTree[i].clear();
}
}
int getCentroid(int u, int p = 0) {
siz[u] = 1;
for (int v : graph[u])
if (v != p && !visited[v]) {
getCentroid(v, u);
siz[u] += siz[v];
}
if (p) return 0;
int par = 0, aux = u, nxt = 0;
while (1) {
for (int v : graph[aux])
if (!visited[v] && v != par && siz[v] > siz[u] / 2)
nxt = v;
if (!nxt) return aux;
else { par = aux; aux = nxt; nxt = 0; }
}
}
void buildTree(int u = 0) {
if (u == 0) {
u = root = getCentroid(1);
visited[u] = 1; layer[u] = 1;
}
for (int v : graph[u])
if (!visited[v]) {
int x = getCentroid(v);
visited[x] = 1; layer[x] = layer[u] + 1; parent[x] = u;
centroidTree[u].push_back(x);
centroidTree[x].push_back(u);
buildTree(x);
}
}
} centroid;
int main() {
scanf("%d", &n);
for (int i = 0; i < n-1; i++) {
scanf("%d %d", &x, &y);
graph[x].push_back(y);
graph[y].push_back(x);
}
centroid.init();
centroid.buildTree();
for (int i = 1; i <= n; i++) {
if (i > 1) printf(" ");
printf("%c", centroid.layer[i] - 1 + 'A');
}
printf("\n");
return 0;
}
|
5f6ea22cc6b9472119799e321676beaed66bb06a
|
a3560e20b1a610860466974cb374f4b84098a214
|
/Src/Flute/Flute_Default.ino
|
86073f35ca2047648b15a94359dfbd2c93c567dc
|
[] |
no_license
|
visvash/Martian-Harmony
|
45c16603a0b3a18c5d7776e62f4f2f9ba4b335fe
|
f0c4df13812f8434985ccd152929491fd92ca85c
|
refs/heads/master
| 2020-05-05T03:09:29.145426
| 2019-04-15T15:47:51
| 2019-04-15T15:47:51
| 179,662,745
| 2
| 0
| null | 2019-04-05T10:33:19
| 2019-04-05T10:33:19
| null |
UTF-8
|
C++
| false
| false
| 16,802
|
ino
|
Flute_Default.ino
|
#include <Servo.h>
#include <Stepper.h>
#define SIZE 200
#define OPEN 0
#define HALF 1
#define FULL 2
#define STEPSPR 150
Servo myservo1,myservo2,myservo3,myservo4,myservo5,myservo6,myservo7; // create servo objects to control a servo. Twelve servo objects can be created on most boards
Stepper stepper(STEPSPR, A0,A1,A2,A3 );
int pos=0;
int posInit1=45,posInit2=45,posInit3=45,posInit4=45,posInit5=45,posInit6=45; // variable to store the servo initial positions
int stepInit=0;
boolean offFlag = false;
int stepC=19,stepC_High=37,stepD=12,stepD_High=9,stepE=5,stepE_High=28,stepF=10,stepF_High=8,stepG=14,stepG_sharp=0,stepA=17,stepA_High=23,stepB=24;//stepB=24,stepC=19
int Open1=30,Open2=0,Open3=0,Open4=30,Open5=0,Open6=30;
int Half1=40,Half2=40,Half3=40,Half4=40,Half5=40,Half6=40;
int Full1=0,Full2=30,Full3=30,Full4=0,Full5=30,Full6=0;
int prevFlag1=0,prevFlag2=0,prevFlag3=0,prevFlag4=0,prevFlag5=0,prevFlag6=0;
int currFlag1=0,currFlag2=0,currFlag3=0,currFlag4=0,currFlag5=0,currFlag6=0;
int iFlute=0;
int t1,t2;
//flag = 0 for open
//flag = 1 for close
//Data for kal ho na ho
char noteFlute[SIZE]={'C','B','C','B','C','B','C','E','D','C','B','A','B','A','B','C','B','C','B','C','B','C','E','D','C','B','A','B','A','B','B','G','A','C','A','F','G','A','G','G','A','C','A','G','F','F','A','A','G'};
int timeFlute[SIZE]={0,642,857,1500,1714,2357,2571,2785,3000,3214,3428,4071,4285,4928,5142,6857,7500,7714,8357,8571,9214,9428,9643,9857,10071,10285,10928,11142,11785,12000,13714,14571,15000,15428,15642,18000,18428,18857,19072,21428,21857,22285,22500,24214,24428,24857,25285,25714,25928};
byte onOffFlute[SIZE]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
//Data for harry potter
//char noteFlute[SIZE]={'B','E','G','F','E','B','A','F','E','G','F','D','F','B','B','E','G','F','E','B','D','C','C','G','C','B','A','F','G','E','G','B','G','B','G','C','B','A','F','G','B','A','A','B','B','G','B','G','B','G','D','C','C','G','C','B','A','F','G','E'};
//int timeFlute[SIZE]={1500,1800,2250,2400,2700,3300,3600,4500,5400,5850,6000,6300,6900,7200,8700,9000,9450,9600,9900,10500,10800,11400,11700,12300,12600,13050,13200,13500,14100,14400,15900,16200,16800,17100,17700,18000,18600,18900,19500,19800,20250,20400,20700,21300,21600,23100,23400,24000,24300,24900,25200,25800,26100,26700,27000,27450,27600,27900,28500,28800};
//byte onOffFlute[SIZE]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
//data for baazigar
//char noteFlute[SIZE]={'D','D','C','D','A','D','D','D','C','D','A','D','D','C','D','A','D','D','D','C','D','A','D','D','C','D','A','D','D','D','C','D','A','D','D','C','D','A','D','D','D','C','D','A','D','D','C','D','A','D','D','D','C','D','A','D','D','C','D','A','D','D','D','C','D','A'};
//int timeFlute[SIZE]={1920,2640,2880,3120,3360,3840,4200,4560,4800,5040,5280,5760,6480,6720,6960,7200,7680,8040,8400,8640,8880,9120,9600,10320,10560,10800,11040,11520,11880,12240,12480,12720,12960,13440,14160,14400,14640,14880,15360,15720,16080,16320,16560,16800,17280,18000,18240,18480,18720,19200,19560,19920,20160,20400,20640,21120,21840,22080,22320,22560,23040,23400,23760,24000,24240,24480};
//byte onOffFlute[SIZE]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
//Data for ek ladki ko dekha
//char noteFlute[SIZE]={'G','C','C','B','C','D','B','C','D','B','C','D','B','C','C','D','B','C','D','B','B','C','D','D','B','C','D','B','C','C','C','C','B','C','C','G','B','A','B','C','C','B','G','B','A','B','C','C','B','G','B','A','A','A','A','G','G','E','F','A','G','G','G','G','F','F','E','F','A','G','G','G','A','A','F','A','C','A','G','G','G','G','G','B','C','E','D','D','D','B','B','G','B','C','E','D','C','D','D','B','C','D','B','C','D','B','C','E','B','C','C','G','B','C','D','C','G','B','C','D','C','G','C','C','C','G','A','E','F','A','G','G','B','C','D','C','G','B','C','D','C','G','C','C','C','G','A','E','F','A','G'};
//int timeFlute[SIZE]={0,8571,11125,11526,11964,12625,13241,13669,14334,14995,15370,16062,16250,16700,17120,21450,21861,22267,22964,23584,23959,24607,24674,25303,25620,25691,26370,26441,26973,27428,28316,28683,28928,29580,29843,30071,30285,30651,30879,31803,32089,32625,33017,33718,34080,34321,35227,35571,35959,36428,37098,37473,37709,38464,38575,38674,39392,39504,39852,40165,40513,40816,41107,41843,42004,42839,42892,43303,43665,43915,44303,44589,45410,45812,46120,46781,46973,47383,47785,47991,48687,48892,49285,50142,50464,50785,51174,51424,52330,52714,53165,53250,53589,53870,54241,54558,54857,60040,63049,63392,63468,64071,64660,65133,65816,66433,66830,67495,67696,68200,68647,70482,81000,81424,81803,81901,82285,84428,84852,85232,85330,85714,87857,88281,88583,88660,88758,89142,91285,91709,92089,92571,94714,95138,95517,95616,96000,98142,98566,98946,99044,99428,101571,101995,102271,102375,102473,102857,105000,105424,105803,106285};
//byte onOffFlute[SIZE]={0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,0,1,1,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1};
//Data for vande mataram
//char noteFlute[SIZE]={'C','D','F','G','F','G','F','G','B','C','B','C','C','C','D','A','B','A','G','G','G','A','F','E','D','D','D','D','D','G','F','E','D','E','D','C','C','C','D','F','G','F','G','G','G','B','A','A','A','G','F','G','B','C','B','C','F','G','B','B','B','B','B','B','B','C','B','C','B','C','B','B','B','B','B','C','B','C','B','C','D','C','B','A','B','A','A','A','G','D','D','D','F','F','F','E','D','D','D','D','D','A','B','A','G','A','G','F','G','B','B','B','B','B','B','B','B','B','C','B','C','F','G','B','C','B','C','F','G','B','C','B','C','G'};
//int timeFlute[SIZE]={0,666,1666,2000,2333,2666,5333,6000,7000,7333,7666,8000,10616,10666,11000,11340,11833,12333,12666,13283,13333,13666,14006,15000,15333,15950,16000,16283,16333,16666,17000,17333,18000,18333,18666,19000,21283,21333,22000,22333,22666,23000,23333,24283,24333,24666,25000,25283,25333,25666,26666,27333,28333,28666,29000,29333,32000,32666,33333,33950,34000,34616,34666,34950,35000,35333,35666,36000,37000,37333,38666,39283,39333,39616,39666,40000,40333,40666,41333,41666,42000,42333,42666,43000,43333,43666,43950,44000,44333,45333,45616,45666,46000,46283,46333,46666,47000,47950,48000,48283,48333,48666,49006,49333,49666,50333,50666,52000,52333,52666,53283,53333,53616,53666,53950,54000,54950,55000,55333,55666,56000,57333,58000,59000,59333,59666,60000,62666,63333,64333,64666,65000,65333,65500};
//byte onOffFlute[SIZE]={1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,O};
//Data For Are re re ye kya hua song :P
//char noteFlute[SIZE]={'A','B','C','A','E','D','C','B','A','B','C','A','F','E','A','B','C','A','E','D','C','B','C','D','E','B','C','B','A','G'};
//int timeFlute[SIZE]={5615,5824,6032,6263,6699,7166,7870,8050,9203,9435,9638,9842,10287,10708,12745,12953,13166,13388,13828,14287,14953,15162,16032,16287,16439,16685,16888,17379,17800,17900};
//byte onOffFlute[SIZE]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0};
//Data for raghupati raghav
//char noteFlute[SIZE]={'D','D','D','G','G','G','G','F','G','A','G','F','E','F','A','A','A','C','B','C','A','A','A','G','A','G','F','E','F','A','G','G','G','B','B','B','B','B','A','G','A','C','C','C','B','C','A','A','A','C','C','C','D','D','D','C','A','A','G'};
//int timeFlute[SIZE]={72,190,552,796,1036,1194,1516,1996,2232,2472,2712,2956,3436,3916,4872,5570,5832,6316,6796,7276,7752,8236,9196,9672,10152,10392,10632,11116,11596,12552,13032,13226,13516,15432,16074,16396,17098,17356,18316,18796,19272,19756,19974,20232,20712,21196,23116,23350,23592,24076,24438,24556,25036,25996,26476,26956,27916,28392,28876};
//byte onOffFlute[SIZE]={1,0,1,1,1,0,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,1,0,1,1,1,1,1,0,1,1,1,1,0,1,1,0,1,1,1,1,1,1,1,1};
void setup() {
Serial.begin(9600);
myservo1.attach(8);
myservo2.attach(9);
myservo3.attach(7);
myservo4.attach(6);
myservo5.attach(5);
myservo6.attach(12);
myservo7.attach(11);
stepper.setSpeed(200);
myservo1.write(45);
myservo2.write(45);
myservo3.write(45);
myservo4.write(45);
myservo5.write(45);
myservo6.write(45);
myservo7.write(5);
t1=millis();
}
void loop()
{
if(1){
t1=millis();
while(1){
t2=millis();
Serial.println(t1);
Serial.println(t2);
if (abs((t2-t1) - timeFlute[iFlute])<140) fluteCall();
//if (abs((t2-t1) - timeFlute[iFlute])<=0) fluteCall();
else if((t2-t1)>timeFlute[iFlute]) {
//iFlute++;
Serial.print("Timer Flute Overflow : ");
Serial.println(t2-t1);
}
}
}
else Serial.println("pinOff");
}
void C(){
pressure(stepInit,stepC);
currFlag1 = 1;//close
currFlag2 = 1;
currFlag3 = 1;
currFlag4 = 0;
currFlag5 = 0;//open
currFlag6 = 0;
newNote();
posInit1=45;
posInit2=45;
posInit3=45;
posInit4=75;
posInit5=15;
posInit6=75;
}
void C_High(){
pressure(stepInit,stepC_High);
currFlag1 = 1;
currFlag2 = 1;
currFlag3 = 1;
currFlag4 = 0;
currFlag5 = 0;
currFlag6 = 0;
newNote();
posInit1=3;
posInit2=63;
posInit3=63;
posInit4=32;
posInit5=32;
posInit6=32;
}
void D(){
pressure(stepInit,stepD);
currFlag1 = 1;
currFlag2 = 1;
currFlag3 = 1;
currFlag4 = 0;
currFlag5 = 0;
currFlag6 = 0;
newNote();
posInit1=45;
posInit2=45;
posInit3=45;
posInit4=75;
posInit5=15;
posInit6=75;
}
void D_High(){
pressure(stepInit,stepD_High);
currFlag1 = 1;
currFlag2 = 1;
currFlag3 = 0;
currFlag4 = 0;
currFlag5 = 0;
currFlag6 = 0;
newNote();
posInit1=3;
posInit2=63;
posInit3=39;
posInit4=32;
posInit5=32;
posInit6=32;
}
void E(){
pressure(stepInit,stepE);
currFlag1 = 1;
currFlag2 = 0;
currFlag3 = 0;
currFlag4 = 0;
currFlag5 = 0;
currFlag6 = 0;
newNote();
posInit1=45;
posInit2=15;
posInit3=15;
posInit4=75;
posInit5=15;
posInit6=75;
}
void F_note(){
pressure(stepInit,stepF);
currFlag1 = 0;
currFlag2 = 0;
currFlag3 = 0;
currFlag4 = 0;
currFlag5 = 0;
currFlag6 = 0;
newNote();
posInit1=75;
posInit2=15;
posInit3=15;
posInit4=75;
posInit5=15;
posInit6=75;
}
void F_High(){
pressure(stepInit,stepF_High);
currFlag1 = 0;
currFlag2 = 0;
currFlag3 = 0;
currFlag4 = 0;
currFlag5 = 0;
currFlag6 = 0;
newNote();
posInit1=32;
posInit2=39;
posInit3=39;
posInit4=32;
posInit5=32;
posInit6=32;}
void G(){
pressure(stepInit,stepG);
currFlag1 = 1;
currFlag2 = 1;
currFlag3 = 1;
currFlag4 = 0;
currFlag5 = 0;
currFlag6 = 0;
newNote();
posInit1=45;
posInit2=45;
posInit3=45;
posInit4=75;
posInit5=15;
posInit6=75;}
void G_High(){
pressure(stepInit,stepG_sharp);
currFlag1 = 1;
currFlag2 = 1;
currFlag3 = 1;
currFlag4 = 1;
currFlag5 = 1;
currFlag6 = 1;
newNote();
posInit1=3;
posInit2=63;
posInit3=63;
posInit4=3;
posInit5=3;
posInit6=3;}
void A(){
pressure(stepInit,stepA);
currFlag1 = 0;
currFlag2 = 1;
currFlag3 = 0;
currFlag4 = 0;
currFlag5 = 0;
currFlag6 = 0;
newNote();
posInit1=75;
posInit2=45;
posInit3=15;
posInit4=75;
posInit5=15;
posInit6=75;
}
void A_High(){
pressure(stepInit,stepA_High);
currFlag1 = 1;
currFlag2 = 1;
currFlag3 = 1;
currFlag4 = 1;
currFlag5 = 1;
currFlag6 = 0;
newNote();
posInit1=3;
posInit2=63;
posInit3=63;
posInit4=3;
posInit5=3;
posInit6=32;
}
void B(){
pressure(stepInit,stepB);
currFlag1 = 1;
currFlag2 = 1;
currFlag3 = 1;
currFlag4 = 1;
currFlag5 = 1;
currFlag6 = 1;
newNote();
posInit1=45;
posInit2=45;
posInit3=45;
posInit4=45;
posInit5=45;
posInit6=45;
}
void fluteCall(){
Serial.print("Timer : ");
Serial.print(t2-t1);
Serial.print(" Flute : ");
Serial.print(timeFlute[iFlute]);
Serial.print(" "); //Serial.println(noteFlute[iFlute]);
//Serial.print(flute);
//Serial.print(" ");
if(onOffFlute[iFlute]==0) {
if(offFlag==false){
for (pos = 5; pos <=35 ; pos += 1)
{
myservo7.write(pos);
delay(10);
offFlag = true;
}
}
Serial.println(noteFlute[iFlute]);
iFlute++;
}
else if(onOffFlute[iFlute]==1){
switch(noteFlute[iFlute]){
case 'A':
if(offFlag==true){
for (pos = 35; pos >=5 ; pos -= 1)
{
myservo7.write(pos);
delay(10);
}
offFlag = false;
}
Serial.println(noteFlute[iFlute]);
A();
break;
case 'B':
if(offFlag==true){
for (pos = 35; pos >=5 ; pos -= 1)
{
myservo7.write(pos);
delay(10);
}
offFlag = false;
}
Serial.println(noteFlute[iFlute]);
B();
break;
case 'C':
if(offFlag==true){
for (pos = 35; pos >=5 ; pos -= 1)
{
myservo7.write(pos);
delay(10);
}
offFlag = false;
}
Serial.println(noteFlute[iFlute]);
C();
break;
case 'D':
if(offFlag==true){
for (pos = 35; pos >=5 ; pos -= 1)
{
myservo7.write(pos);
delay(10);
}
offFlag = false;
}
Serial.println(noteFlute[iFlute]);
D();
break;
case 'E':
if(offFlag==true){
for (pos = 35; pos >=5 ; pos -= 1)
{
myservo7.write(pos);
delay(10);
}
offFlag = false;
}
Serial.println(noteFlute[iFlute]);
E();
break;
case 'F':
if(offFlag==true){
for (pos = 35; pos >=5 ; pos -= 1)
{
myservo7.write(pos);
delay(10);
}
offFlag = false;
}
Serial.println(noteFlute[iFlute]);
F_note();
break;
case 'G':
if(offFlag==true){
for (pos = 30; pos >=0 ; pos -= 1)
{
myservo7.write(pos);
delay(10);
}
offFlag = false;
}
Serial.println(noteFlute[iFlute]);
G();
break;
default:
if(offFlag==false){
for (pos = 5; pos <=35 ; pos += 1)
{
myservo7.write(pos);
delay(10);
offFlag = true;
}
}
}
iFlute++;
}
return;
}
void pressure(int &stepInit, int stepFinal)
{
stepper.step(stepInit - stepFinal);
stepInit = stepFinal;
}
void newNote(){
for(int i=0;i<=30;i++)
{
if (prevFlag1>currFlag1) myservo1.write(posInit1+i);
else if(prevFlag1<currFlag1) myservo1.write(posInit1-i);
if (prevFlag2>currFlag2) myservo2.write(posInit2-i);
else if(prevFlag2<currFlag2) myservo2.write(posInit2+i);
if (prevFlag3>currFlag3) myservo3.write(posInit3-i);
else if(prevFlag3<currFlag3) myservo3.write(posInit3+i);
if (prevFlag4>currFlag4) myservo4.write(posInit4+i);
else if(prevFlag4<currFlag4) myservo4.write(posInit4-i);
if (prevFlag5>currFlag5) myservo5.write(posInit5-i);
else if(prevFlag5<currFlag5) myservo5.write(posInit5+i);
if (prevFlag6>currFlag6) myservo6.write(posInit6+i);
else if(prevFlag6<currFlag6) myservo6.write(posInit6-i);
delay(5);
}
prevFlag1=currFlag1;
prevFlag2=currFlag2;
prevFlag3=currFlag3;
prevFlag4=currFlag4;
prevFlag5=currFlag5;
prevFlag6=currFlag6;
}
|
7e05922076ce6a27640307f3a1de1a2936d0e9e7
|
5b331ae8fabcc43e2ec8d80c8750d87f23d4388b
|
/点云自动配准文章shot.cpp
|
64db574696c9de4fc3c6209a0f8b6e4249c3eaaf
|
[] |
no_license
|
huabowen/Point-cloud-automatic-registration-article-shot
|
249a1df2592906fa2805417243845e76282c6a88
|
c7b5bf7012f64ab344586e893958f6045ab6114f
|
refs/heads/master
| 2020-07-19T23:32:44.662816
| 2019-09-05T10:00:38
| 2019-09-05T10:00:38
| 206,531,921
| 5
| 1
| null | null | null | null |
GB18030
|
C++
| false
| false
| 59,000
|
cpp
|
点云自动配准文章shot.cpp
|
#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/io/ply_io.h>
#include <pcl/point_types.h>
#include <pcl/point_cloud.h>
#include <pcl/kdtree/kdtree_flann.h>
#include <vector>
#include <string>
#include <pcl/features/normal_3d_omp.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/features/fpfh_OMP.h>
#include <pcl/features/pfh.h>
#include <pcl/features/fpfh.h>
#include <pcl/features/shot.h>
#include <pcl/visualization/pcl_plotter.h>
#include <pcl/segmentation/sac_segmentation.h>
#include <pcl/segmentation/extract_clusters.h>
#include <pcl/filters/voxel_grid.h>
#include <pcl/filters/approximate_voxel_grid.h>
#include <pcl/recognition/cg/geometric_consistency.h>
#include <pcl/common/transforms.h>
#include <pcl/recognition/cg/hough_3d.h>
#include <pcl/features/board.h>
#include <pcl/registration/icp.h>
#include <pcl/registration/sample_consensus_prerejective.h>
#include <pcl/registration/correspondence_rejection_one_to_one.h>
#include <pcl/keypoints/uniform_sampling.h>
using namespace std; // 可以加入 std 的命名空间
pcl::PointCloud<pcl::Normal>::Ptr normal_estimation_OMP(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, float leaf_size, float radius = 5) {
pcl::PointCloud<pcl::Normal>::Ptr normals(new pcl::PointCloud<pcl::Normal>());
pcl::NormalEstimationOMP<pcl::PointXYZ, pcl::Normal> ne;
ne.setNumberOfThreads(10);
ne.setInputCloud(cloud);
pcl::search::KdTree<pcl::PointXYZ>::Ptr tree(new pcl::search::KdTree<pcl::PointXYZ>());
ne.setSearchMethod(tree);
ne.setRadiusSearch(leaf_size);
//ne.setKSearch(k);
ne.compute(*normals);
return normals;
}
void show_key_point(pcl::PointCloud<pcl::PointXYZ>::Ptr Acloud, pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_keypoint) {
// 初始化点云可视化对象
pcl::visualization::PCLVisualizer viewer_final("3D Viewer");
viewer_final.setBackgroundColor(255, 255, 255); //白色背景
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> color_cloud(Acloud, 0, 255, 0);//蓝色点云
viewer_final.addPointCloud<pcl::PointXYZ>(Acloud, color_cloud, "1");
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> color_key(cloud_keypoint, 255, 0, 0);//关键点
viewer_final.addPointCloud<pcl::PointXYZ>(cloud_keypoint, color_key, "2");
viewer_final.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 5, "2");
// 等待直到可视化窗口关闭
while (!viewer_final.wasStopped())
{
viewer_final.spinOnce(100);
boost::this_thread::sleep(boost::posix_time::microseconds(100000));
}
}
void show_point_cloud(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud) {
// 初始化点云可视化对象
pcl::visualization::PCLVisualizer viewer_final("3D Viewer");
viewer_final.setBackgroundColor(255, 255, 255); //白色背景
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> color_cloud(cloud, 0, 255, 0);//蓝色点云
viewer_final.addPointCloud<pcl::PointXYZ>(cloud, color_cloud, "1");
// 等待直到可视化窗口关闭
while (!viewer_final.wasStopped())
{
viewer_final.spinOnce(100);
boost::this_thread::sleep(boost::posix_time::microseconds(100000));
}
}
void show_point_clouds(vector<pcl::PointCloud<pcl::PointXYZ>::Ptr> clouds) {
// 初始化点云可视化对象
pcl::visualization::PCLVisualizer viewer_final("3D Viewer");
viewer_final.setBackgroundColor(255, 255, 255); //白色背景
for (int i = 0; i < clouds.size(); i++) {
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> color(clouds[i], rand() % 255, rand() % 255, rand() % 255);
viewer_final.addPointCloud<pcl::PointXYZ>(clouds[i], color, to_string(i));
}
// 等待直到可视化窗口关闭
while (!viewer_final.wasStopped())
{
viewer_final.spinOnce(100);
boost::this_thread::sleep(boost::posix_time::microseconds(100000));
}
}
float com_avg_curvature(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, pcl::PointCloud<pcl::Normal>::Ptr normals, int i, float radius, pcl::search::KdTree<pcl::PointXYZ>::Ptr tree) {
float avg_curvature = 0;
vector<int> point_ind;
vector<float> point_dist;
tree->radiusSearch(cloud->points[i], radius, point_ind, point_dist);
//tree->nearestKSearch(cloud->points[i], num, point_ind, point_dist);
for (int i = 0; i < point_ind.size(); i++) {
avg_curvature += normals->points[point_ind[i]].curvature;
}
avg_curvature = avg_curvature / float(point_ind.size());
return avg_curvature;
}
bool is_max_avg_curvature(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, vector<float> avg_curvatures, int point, vector<bool>& possible_key, vector<bool> possible_key_possible, pcl::search::KdTree<pcl::PointXYZ>::Ptr tree, float radius = 4) {
vector<int> point_ind;
vector<float> point_dis;
tree->radiusSearch(cloud->points[point], radius, point_ind, point_dis);//此处半径为计算曲率和的半径
if (point_ind.size() < 5)
return false;
for (int i = 1; i < point_ind.size(); i++) {
if (possible_key_possible[point_ind[i]]) {
if (avg_curvatures[point_ind[0]] > avg_curvatures[point_ind[i]])
possible_key[point_ind[i]] = false;
else if (avg_curvatures[point_ind[0]] < avg_curvatures[point_ind[i]])
possible_key[point_ind[0]] = false;
}
}
return possible_key[point_ind[0]];
}
float cosa(float nx, float ny, float nz, float cx, float cy, float cz) {
if ((cx == 0 && cy == 0 && cz == 0) || isnan(nx) || isnan(ny) || isnan(nz))
return 0;
float angle = 0;
angle = (nx*cx + ny * cy + nz * cz) / (sqrtf(pow(nx, 2) + pow(ny, 2) + pow(nz, 2))*sqrtf(pow(cx, 2) + pow(cy, 2) + pow(cz, 2)));
return angle;
}
float dist(float nx, float ny, float nz, float cx, float cy, float cz) {
float distance = 0;
distance = sqrtf(pow(nx - cx, 2) + pow(ny - cy, 2) + pow(nz - cz, 2));
return distance;
}
pcl::PFHSignature125 com_feature(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, pcl::PointCloud<pcl::Normal>::Ptr normals, pcl::search::KdTree<pcl::PointXYZ>::Ptr tree, int point, float radius = 3, int num_angle = 25, int num_distance = 8) {
vector<int> sup_ind;
vector<float> sup_dis;
tree->radiusSearch(cloud->points[point], radius, sup_ind, sup_dis);
pcl::PointCloud<pcl::PointXYZ>::Ptr ksearch_keypoint(new pcl::PointCloud<pcl::PointXYZ>());
pcl::PointCloud<pcl::Normal>::Ptr ksearch_normals(new pcl::PointCloud<pcl::Normal>());
pcl::copyPointCloud(*cloud, sup_ind, *ksearch_keypoint);
pcl::copyPointCloud(*normals, sup_ind, *ksearch_normals);
pcl::PFHSignature125 feature;
for (int i = 0; i < feature.descriptorSize(); i++) {
feature.histogram[i] = 0;
}
if (ksearch_keypoint->size() == 0)
return feature;
Eigen::Vector4f centroid; //质心
pcl::compute3DCentroid(*ksearch_keypoint, centroid); //估计质心的坐标
//cout << centroid.x() << " " << centroid.y() << " " << centroid.z() << endl;
vector<float> vec_distance;
for (int i = 0; i < ksearch_keypoint->size(); i++) {
float distance = 0;
distance = dist(ksearch_keypoint->points[i].x, ksearch_keypoint->points[i].y, ksearch_keypoint->points[i].z, centroid.x(), centroid.y(), centroid.z());
vec_distance.push_back(distance);
}
float max_diatance = *std::max_element(std::begin(vec_distance), std::end(vec_distance));
float min_diatance = *std::min_element(std::begin(vec_distance), std::end(vec_distance));
float res_distance = (max_diatance - min_diatance) / num_distance;
//cout << "max_diatance: " << max_diatance << endl;
//cout << "min_diatance: " << min_diatance << endl;
//cout << "res_distance: " << res_distance << endl;
for (int i = 0; i < ksearch_keypoint->size(); i++) {
float angle = 0;
angle = cosa(ksearch_normals->points[i].normal_x, ksearch_normals->points[i].normal_y, ksearch_normals->points[i].normal_z, ksearch_keypoint->points[i].x - centroid.x(), ksearch_keypoint->points[i].y - centroid.y(), ksearch_keypoint->points[i].z - centroid.z());
angle += 1;
int bin_angle = int(angle / (2.0 / num_angle));
int bin_distance = 0;
if (res_distance != 0) {
bin_distance = int((vec_distance[i] - min_diatance) / res_distance);
}
if (bin_distance > num_distance - 1) bin_distance = num_distance - 1;
if (bin_angle > num_angle - 1) bin_angle = num_angle - 1;
//feature.histogram[bin_distance] += 1;
feature.histogram[num_angle*bin_distance + bin_angle] += 1;
}
for (int i = 0; i < feature.descriptorSize(); i++) {
feature.histogram[i] = feature.histogram[i] / (float)(ksearch_keypoint->size());
}
return feature;
}
pcl::PointCloud<pcl::PFHSignature125>::Ptr com_pfh_feature(pcl::PointCloud<pcl::PointXYZ>::Ptr search_cloud, pcl::PointCloud<pcl::Normal>::Ptr normal, pcl::PointCloud<pcl::PointXYZ>::Ptr key, float leaf_size) {
pcl::PointCloud<pcl::PFHSignature125>::Ptr features(new pcl::PointCloud<pcl::PFHSignature125>());
pcl::PFHEstimation<pcl::PointXYZ, pcl::Normal, pcl::PFHSignature125> pfh;
pfh.setInputCloud(key);
pfh.setInputNormals(normal);
pfh.setSearchSurface(search_cloud);
pfh.setRadiusSearch(leaf_size);
pfh.compute(*features);
return features;
}
pcl::PointCloud<pcl::FPFHSignature33>::Ptr com_fpfh_feature(pcl::PointCloud<pcl::PointXYZ>::Ptr search_cloud, pcl::PointCloud<pcl::Normal>::Ptr normal, pcl::PointCloud<pcl::PointXYZ>::Ptr key, float leaf_size) {
pcl::PointCloud<pcl::FPFHSignature33>::Ptr features(new pcl::PointCloud<pcl::FPFHSignature33>());
pcl::FPFHEstimation<pcl::PointXYZ, pcl::Normal, pcl::FPFHSignature33> fpfh;
fpfh.setInputCloud(key);
fpfh.setInputNormals(normal);
fpfh.setSearchSurface(search_cloud);
fpfh.setRadiusSearch(leaf_size);
fpfh.compute(*features);
return features;
}
pcl::PointCloud<pcl::SHOT352>::Ptr com_shot_feature(pcl::PointCloud<pcl::PointXYZ>::Ptr search_cloud, pcl::PointCloud<pcl::Normal>::Ptr normal, pcl::PointCloud<pcl::PointXYZ>::Ptr key, float leaf_size) {
pcl::PointCloud<pcl::SHOT352>::Ptr features(new pcl::PointCloud<pcl::SHOT352>());
pcl::SHOTEstimation<pcl::PointXYZ, pcl::Normal, pcl::SHOT352> fpfh;
fpfh.setInputCloud(key);
fpfh.setInputNormals(normal);
fpfh.setSearchSurface(search_cloud);
fpfh.setRadiusSearch(leaf_size);
fpfh.compute(*features);
return features;
}
pcl::PointCloud<pcl::PointXYZ>::Ptr key_detect_u(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, float leaf_size) {
pcl::PointCloud<pcl::PointXYZ>::Ptr key(new pcl::PointCloud<pcl::PointXYZ>);
pcl::UniformSampling<pcl::PointXYZ> filter;
filter.setInputCloud(cloud);
filter.setRadiusSearch(leaf_size);
filter.filter(*key);
return key;
}
pcl::PointCloud<pcl::PFHSignature125>::Ptr com_features(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, pcl::PointCloud<pcl::Normal>::Ptr normals, pcl::search::KdTree<pcl::PointXYZ>::Ptr tree,
pcl::PointCloud<pcl::PointXYZ>::Ptr key, float radius = 4, int num_angle = 12, int num_distance = 10) {
pcl::PointCloud<pcl::PFHSignature125>::Ptr f(new pcl::PointCloud<pcl::PFHSignature125>());
for (int k = 0; k < key->size(); k++) {
vector<int> sup_ind;
vector<float> sup_dis;
tree->radiusSearch(key->points[k], radius, sup_ind, sup_dis);
pcl::PFHSignature125 features;
for (int i = 0; i < features.descriptorSize(); i++) {
features.histogram[i] = 0;
}
for (int i = 0; i < sup_ind.size(); i++) {
pcl::PFHSignature125 feature = com_feature(cloud, normals, tree, sup_ind[i], radius, num_angle, num_distance);
for (int j = 0; j < features.descriptorSize(); j++) {
features.histogram[j] += feature.histogram[j];
}
}
for (int i = 0; i < features.descriptorSize(); i++) {
features.histogram[i] = features.histogram[i] / (float)(sup_ind.size());
}
f->push_back(features);
}
return f;
}
pcl::PointCloud<pcl::PFHSignature125>::Ptr com_features2(pcl::PointCloud<pcl::PointXYZ>::Ptr key, pcl::PointCloud<pcl::PFHSignature125>::Ptr features, vector<float>& dis) {
pcl::PointCloud<pcl::PFHSignature125>::Ptr new2_features(new pcl::PointCloud<pcl::PFHSignature125>);
pcl::KdTreeFLANN<pcl::PointXYZ>::Ptr kdtree_key(new pcl::KdTreeFLANN<pcl::PointXYZ>);
kdtree_key->setInputCloud(key);
for (int i = 0; i < key->size(); i++) {
std::vector<int> neigh_indices(2); //设置最近邻点的索引
std::vector<float> neigh_sqr_dists(2); //申明最近邻平方距离值
kdtree_key->nearestKSearch(key->at(i), 2, neigh_indices, neigh_sqr_dists);
pcl::PFHSignature125 feature;
for (int j = 0; j < feature.descriptorSize(); j++) {
feature.histogram[j] = 0.5f*(features->points[i].histogram[j] + features->points[neigh_indices[1]].histogram[j]);
}
dis.push_back(sqrt(neigh_sqr_dists[1]));
new2_features->push_back(feature);
}
return new2_features;
}
pcl::PointCloud<pcl::FPFHSignature33>::Ptr com_features2(pcl::PointCloud<pcl::PointXYZ>::Ptr key, pcl::PointCloud<pcl::FPFHSignature33>::Ptr features, vector<float>& dis) {
pcl::PointCloud<pcl::FPFHSignature33>::Ptr new2_features(new pcl::PointCloud<pcl::FPFHSignature33>);
pcl::KdTreeFLANN<pcl::PointXYZ>::Ptr kdtree_key(new pcl::KdTreeFLANN<pcl::PointXYZ>);
kdtree_key->setInputCloud(key);
for (int i = 0; i < key->size(); i++) {
std::vector<int> neigh_indices(2); //设置最近邻点的索引
std::vector<float> neigh_sqr_dists(2); //申明最近邻平方距离值
kdtree_key->nearestKSearch(key->at(i), 2, neigh_indices, neigh_sqr_dists);
pcl::FPFHSignature33 feature;
for (int j = 0; j < feature.descriptorSize(); j++) {
feature.histogram[j] = 0.5f*(features->points[i].histogram[j] + features->points[neigh_indices[1]].histogram[j]);
}
dis.push_back(sqrt(neigh_sqr_dists[1]));
new2_features->push_back(feature);
}
return new2_features;
}
pcl::PointCloud<pcl::SHOT352>::Ptr com_features2(pcl::PointCloud<pcl::PointXYZ>::Ptr key, pcl::PointCloud<pcl::SHOT352>::Ptr features, vector<float>& dis) {
pcl::PointCloud<pcl::SHOT352>::Ptr new2_features(new pcl::PointCloud<pcl::SHOT352>);
pcl::KdTreeFLANN<pcl::PointXYZ>::Ptr kdtree_key(new pcl::KdTreeFLANN<pcl::PointXYZ>);
kdtree_key->setInputCloud(key);
for (int i = 0; i < key->size(); i++) {
std::vector<int> neigh_indices(2); //设置最近邻点的索引
std::vector<float> neigh_sqr_dists(2); //申明最近邻平方距离值
kdtree_key->nearestKSearch(key->at(i), 2, neigh_indices, neigh_sqr_dists);
pcl::SHOT352 feature;
for (int j = 0; j < feature.descriptorSize(); j++) {
feature.descriptor[j] = 0.5f*(features->points[i].descriptor[j] + features->points[neigh_indices[1]].descriptor[j]);
}
dis.push_back(sqrt(neigh_sqr_dists[1]));
new2_features->push_back(feature);
}
return new2_features;
}
pcl::PointCloud<pcl::PointXYZ>::Ptr key_detect(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, pcl::PointCloud<pcl::Normal>::Ptr normals, pcl::search::KdTree<pcl::PointXYZ>::Ptr tree,
float radius_curvature = 5) {
vector<bool> possible_key(cloud->size(), false);
//int nums = 0;
for (int i = 0; i < cloud->size(); i++) {
if (normals->points[i].curvature > 0.01) {
possible_key[i] = true;
//nums += 1;
}
}
vector<bool> possible_key_possible(possible_key);
vector<float> avg_curvatures;
for (int i = 0; i < cloud->size(); i++) {
if (possible_key[i])
avg_curvatures.push_back(com_avg_curvature(cloud, normals, i, radius_curvature, tree));
else
avg_curvatures.push_back(0);
}
//pcl::PointCloud<pcl::PFHSignature125>::Ptr features(new pcl::PointCloud<pcl::PFHSignature125>());
pcl::PointCloud<pcl::PointXYZ>::Ptr key(new pcl::PointCloud<pcl::PointXYZ>);
for (int i = 0; i < cloud->size(); i++) {
if (possible_key[i]) {
if (is_max_avg_curvature(cloud, avg_curvatures, i, possible_key, possible_key_possible, tree, radius_curvature)) {//此处半径为计算曲率和的半径
key->push_back(cloud->points[i]);
//pcl::PFHSignature125 feature = com_features(cloud, normals1, tree, i, radius_curvature*1.5f, 12, 10);//此处半径为计算关键点邻域的半径
//features->push_back(feature);
}
}
}
return key;
}
pcl::CorrespondencesPtr com_correspondence(pcl::PointCloud<pcl::PFHSignature125>::Ptr feature_source, pcl::PointCloud<pcl::PFHSignature125>::Ptr feature_target, float dis) {
// 使用Kdtree找出 Model-Scene 匹配点
pcl::CorrespondencesPtr model_scene_corrs(new pcl::Correspondences());
pcl::KdTreeFLANN<pcl::PFHSignature125> match_search; //设置配准的方法
match_search.setInputCloud(feature_target); //输入模板点云的描述子
//每一个场景的关键点描述子都要找到模板中匹配的关键点描述子并将其添加到对应的匹配向量中。
for (size_t i = 0; i < feature_source->size(); ++i)
{
std::vector<int> neigh_indices(1); //设置最近邻点的索引
std::vector<float> neigh_sqr_dists(1); //申明最近邻平方距离值
int found_neighs = match_search.nearestKSearch(feature_source->at(i), 1, neigh_indices, neigh_sqr_dists);
//scene_descriptors->at (i)是给定点云 1是临近点个数 ,neigh_indices临近点的索引 neigh_sqr_dists是与临近点的索引
if (found_neighs == 1 && sqrt(neigh_sqr_dists[0]) < dis) // 仅当描述子与临近点的平方距离小于0.25(描述子与临近的距离在一般在0到1之间)才添加匹配
{
//neigh_indices[0]给定点, i 是配准数 neigh_sqr_dists[0]与临近点的平方距离
pcl::Correspondence corr(i, neigh_indices[0], sqrt(neigh_sqr_dists[0]));
model_scene_corrs->push_back(corr); //把配准的点存储在容器中
}
}
return model_scene_corrs;
}
pcl::CorrespondencesPtr com_correspondence(pcl::PointCloud<pcl::FPFHSignature33>::Ptr feature_source, pcl::PointCloud<pcl::FPFHSignature33>::Ptr feature_target, float dis) {
// 使用Kdtree找出 Model-Scene 匹配点
pcl::CorrespondencesPtr model_scene_corrs(new pcl::Correspondences());
pcl::KdTreeFLANN<pcl::FPFHSignature33> match_search; //设置配准的方法
match_search.setInputCloud(feature_target); //输入模板点云的描述子
//每一个场景的关键点描述子都要找到模板中匹配的关键点描述子并将其添加到对应的匹配向量中。
for (size_t i = 0; i < feature_source->size(); ++i)
{
std::vector<int> neigh_indices(1); //设置最近邻点的索引
std::vector<float> neigh_sqr_dists(1); //申明最近邻平方距离值
int found_neighs = match_search.nearestKSearch(feature_source->at(i), 1, neigh_indices, neigh_sqr_dists);
//scene_descriptors->at (i)是给定点云 1是临近点个数 ,neigh_indices临近点的索引 neigh_sqr_dists是与临近点的索引
if (found_neighs == 1 && sqrt(neigh_sqr_dists[0]) < dis) // 仅当描述子与临近点的平方距离小于0.25(描述子与临近的距离在一般在0到1之间)才添加匹配
{
//neigh_indices[0]给定点, i 是配准数 neigh_sqr_dists[0]与临近点的平方距离
pcl::Correspondence corr(i, neigh_indices[0], sqrt(neigh_sqr_dists[0]));
model_scene_corrs->push_back(corr); //把配准的点存储在容器中
}
}
return model_scene_corrs;
}
pcl::CorrespondencesPtr com_correspondence(pcl::PointCloud<pcl::SHOT352>::Ptr feature_source, pcl::PointCloud<pcl::SHOT352>::Ptr feature_target, float dis) {
// 使用Kdtree找出 Model-Scene 匹配点
pcl::CorrespondencesPtr model_scene_corrs(new pcl::Correspondences());
pcl::KdTreeFLANN<pcl::SHOT352> match_search; //设置配准的方法
match_search.setInputCloud(feature_target); //输入模板点云的描述子
//每一个场景的关键点描述子都要找到模板中匹配的关键点描述子并将其添加到对应的匹配向量中。
for (size_t i = 0; i < feature_source->size(); ++i)
{
if (!pcl_isfinite(feature_source->at(i).descriptor[0])) //忽略 NaNs点
{
continue;
}
std::vector<int> neigh_indices(1); //设置最近邻点的索引
std::vector<float> neigh_sqr_dists(1); //申明最近邻平方距离值
int found_neighs = match_search.nearestKSearch(feature_source->at(i), 1, neigh_indices, neigh_sqr_dists);
//scene_descriptors->at (i)是给定点云 1是临近点个数 ,neigh_indices临近点的索引 neigh_sqr_dists是与临近点的索引
if (found_neighs == 1 && sqrt(neigh_sqr_dists[0]) < dis) // 仅当描述子与临近点的平方距离小于0.25(描述子与临近的距离在一般在0到1之间)才添加匹配
{
//neigh_indices[0]给定点, i 是配准数 neigh_sqr_dists[0]与临近点的平方距离
pcl::Correspondence corr(i, neigh_indices[0], sqrt(neigh_sqr_dists[0]));
model_scene_corrs->push_back(corr); //把配准的点存储在容器中
}
}
return model_scene_corrs;
}
pcl::CorrespondencesPtr com_correspondence2(pcl::PointCloud<pcl::PFHSignature125>::Ptr feature_source, vector<float> dis_source, pcl::PointCloud<pcl::PFHSignature125>::Ptr feature_target, vector<float> dis_target, float dis, float leaf_size) {
// 使用Kdtree找出 Model-Scene 匹配点
pcl::CorrespondencesPtr model_scene_corrs(new pcl::Correspondences());
pcl::KdTreeFLANN<pcl::PFHSignature125> match_search; //设置配准的方法
match_search.setInputCloud(feature_target); //输入模板点云的描述子
//每一个场景的关键点描述子都要找到模板中匹配的关键点描述子并将其添加到对应的匹配向量中。
for (size_t i = 0; i < feature_source->size(); i++) {
float dis_feature = 0.0f;
for (int j = 0; j < feature_source->points[i].descriptorSize(); j++) {
dis_feature += pow(feature_source->points[i].histogram[j] - feature_target->points[i].histogram[j], 2.0f);
}
dis_feature = sqrt(dis_feature);
if (dis_feature < dis && abs(dis_source[i] - dis_target[i]) < 10.0f*leaf_size) // 仅当描述子与临近点的平方距离小于0.25(描述子与临近的距离在一般在0到1之间)才添加匹配
{
//neigh_indices[0]给定点, i 是配准数 neigh_sqr_dists[0]与临近点的平方距离
pcl::Correspondence corr(i, i, dis_feature);
model_scene_corrs->push_back(corr);//把配准的点存储在容器中
}
}
return model_scene_corrs;
}
pcl::CorrespondencesPtr com_correspondence2(pcl::PointCloud<pcl::FPFHSignature33>::Ptr feature_source, vector<float> dis_source, pcl::PointCloud<pcl::FPFHSignature33>::Ptr feature_target, vector<float> dis_target, float dis, float leaf_size) {
// 使用Kdtree找出 Model-Scene 匹配点
pcl::CorrespondencesPtr model_scene_corrs(new pcl::Correspondences());
pcl::KdTreeFLANN<pcl::FPFHSignature33> match_search; //设置配准的方法
match_search.setInputCloud(feature_target); //输入模板点云的描述子
//每一个场景的关键点描述子都要找到模板中匹配的关键点描述子并将其添加到对应的匹配向量中。
for (size_t i = 0; i < feature_source->size(); i++) {
float dis_feature = 0.0f;
for (int j = 0; j < feature_source->points[i].descriptorSize(); j++) {
dis_feature += pow(feature_source->points[i].histogram[j] - feature_target->points[i].histogram[j], 2.0f);
}
dis_feature = sqrt(dis_feature);
if (dis_feature < dis && abs(dis_source[i] - dis_target[i]) < 10.0f*leaf_size) // 仅当描述子与临近点的平方距离小于0.25(描述子与临近的距离在一般在0到1之间)才添加匹配
{
//neigh_indices[0]给定点, i 是配准数 neigh_sqr_dists[0]与临近点的平方距离
pcl::Correspondence corr(i, i, dis_feature);
model_scene_corrs->push_back(corr);//把配准的点存储在容器中
}
}
return model_scene_corrs;
}
pcl::CorrespondencesPtr com_correspondence2(pcl::PointCloud<pcl::SHOT352>::Ptr feature_source, vector<float> dis_source, pcl::PointCloud<pcl::SHOT352>::Ptr feature_target, vector<float> dis_target, float dis, float leaf_size) {
// 使用Kdtree找出 Model-Scene 匹配点
pcl::CorrespondencesPtr model_scene_corrs(new pcl::Correspondences());
pcl::KdTreeFLANN<pcl::SHOT352> match_search; //设置配准的方法
match_search.setInputCloud(feature_target); //输入模板点云的描述子
//每一个场景的关键点描述子都要找到模板中匹配的关键点描述子并将其添加到对应的匹配向量中。
for (size_t i = 0; i < feature_source->size(); i++) {
float dis_feature = 0.0f;
for (int j = 0; j < feature_source->points[i].descriptorSize(); j++) {
dis_feature += pow(feature_source->points[i].descriptor[j] - feature_target->points[i].descriptor[j], 2.0f);
}
dis_feature = sqrt(dis_feature);
if (dis_feature < dis && abs(dis_source[i] - dis_target[i]) < 10.0f*leaf_size) // 仅当描述子与临近点的平方距离小于0.25(描述子与临近的距离在一般在0到1之间)才添加匹配
{
//neigh_indices[0]给定点, i 是配准数 neigh_sqr_dists[0]与临近点的平方距离
pcl::Correspondence corr(i, i, dis_feature);
model_scene_corrs->push_back(corr);//把配准的点存储在容器中
}
}
return model_scene_corrs;
}
//void show_coor(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_model, pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_scenes, pcl::PointCloud<pcl::PointXYZ>::Ptr keypoints_model, pcl::PointCloud<pcl::PointXYZ>::Ptr keypoints_scenes, pcl::PointCloud<pcl::PFHSignature125>::Ptr features_model, pcl::PointCloud<pcl::PFHSignature125>::Ptr features_scenes, pcl::CorrespondencesPtr corr) {
// for (int i = 0; i < corr->size(); i++) {
// cout << corr->at(i).index_query << "---" << corr->at(i).index_match << "---" << corr->at(i).distance << endl;
//
// //pcl::visualization::PCLPlotter plotter;
// //plotter.addFeatureHistogram<pcl::PFHSignature125>(*features_model, "pfh", corr->at(i).index_query);
// //plotter.addFeatureHistogram<pcl::PFHSignature125>(*features_scenes, "pfh", corr->at(i).index_match);
// pcl::PointCloud<pcl::PointXYZ>::Ptr keypoints_ptr_model(new pcl::PointCloud<pcl::PointXYZ>());
// pcl::PointCloud<pcl::PointXYZ>::Ptr keypoints_ptr_scenes(new pcl::PointCloud<pcl::PointXYZ>());
// keypoints_ptr_model->push_back(keypoints_model->points[corr->at(i).index_query]);
// keypoints_ptr_scenes->push_back(keypoints_scenes->points[corr->at(i).index_match]);
// boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer(new pcl::visualization::PCLVisualizer("3D Viewer"));
// int v1(0);
// viewer->createViewPort(0.0, 0.0, 0.5, 1.0, v1); //4个参数分别是X轴的最小值,最大值,Y轴的最小值,最大值,取值0-1,v1是标识
// viewer->setBackgroundColor(255, 255, 255, v1); //设置视口的背景颜色
// pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> color_key_model(keypoints_ptr_model, 0, 0, 0);
// viewer->addPointCloud<pcl::PointXYZ>(keypoints_ptr_model, color_key_model, "color_key_model", v1);
// viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 15, "color_key_model");
//
// pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> color_cloud_model(cloud_model, 0, 0, 0);
// viewer->addPointCloud<pcl::PointXYZ>(cloud_model, color_cloud_model, "cloud_model", v1);
//
// int v2(0);
// viewer->createViewPort(0.5, 0.0, 1.0, 1.0, v2); //4个参数分别是X轴的最小值,最大值,Y轴的最小值,最大值,取值0-1,v1是标识
// viewer->setBackgroundColor(255, 255, 255, v2); //设置视口的背景颜色
// pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> color_key_scenes(keypoints_ptr_scenes, 0, 0, 0);
// viewer->addPointCloud<pcl::PointXYZ>(keypoints_ptr_scenes, color_key_scenes, "color_key_scenes", v2);
// viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 15, "color_key_scenes");
//
// pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> color_cloud_scenes(cloud_scenes, 0, 0, 0);
// viewer->addPointCloud<pcl::PointXYZ>(cloud_scenes, color_cloud_scenes, "cloud_scenes", v2);
//
// //plotter.plot();
// // 等待直到可视化窗口关闭
// while (!viewer->wasStopped())
// {
// viewer->spinOnce(100);
// //boost::this_thread::sleep(boost::posix_time::microseconds(100000));
// }
// }
//
//}
void show_coor(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_model, pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_scenes, pcl::PointCloud<pcl::PointXYZ> keypoints_model, pcl::PointCloud<pcl::PointXYZ> keypoints_scenes, pcl::PointCloud<pcl::PFHSignature125>::Ptr features_model, pcl::PointCloud<pcl::PFHSignature125>::Ptr features_scenes, pcl::CorrespondencesPtr corr) {
for (int i = 0; i < corr->size(); i++) {
cout << corr->at(i).index_query << "---" << corr->at(i).index_match << "---" << corr->at(i).distance << endl;
//pcl::visualization::PCLPlotter plotter;
//plotter.addFeatureHistogram<pcl::PFHSignature125>(*features_model, "pfh", corr->at(i).index_query);
//plotter.addFeatureHistogram<pcl::PFHSignature125>(*features_scenes, "pfh", corr->at(i).index_match);
cout << features_model->points[corr->at(i).index_query] << endl;
cout << features_scenes->points[corr->at(i).index_match] << endl;
pcl::PointCloud<pcl::PointXYZ>::Ptr keypoints_ptr_model(new pcl::PointCloud<pcl::PointXYZ>());
pcl::PointCloud<pcl::PointXYZ>::Ptr keypoints_ptr_scenes(new pcl::PointCloud<pcl::PointXYZ>());
keypoints_ptr_model->push_back(keypoints_model.points[corr->at(i).index_query]);
keypoints_ptr_scenes->push_back(keypoints_scenes.points[corr->at(i).index_match]);
boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer(new pcl::visualization::PCLVisualizer("3D Viewer"));
int v1(0);
viewer->createViewPort(0.0, 0.0, 0.5, 1.0, v1); //4个参数分别是X轴的最小值,最大值,Y轴的最小值,最大值,取值0-1,v1是标识
viewer->setBackgroundColor(255, 255, 255, v1); //设置视口的背景颜色
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> color_key_model(keypoints_ptr_model, 255, 0, 0);
viewer->addPointCloud<pcl::PointXYZ>(keypoints_ptr_model, color_key_model, "color_key_model", v1);
viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 10, "color_key_model");
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> color_cloud_model(cloud_model, 0, 0, 255);
viewer->addPointCloud<pcl::PointXYZ>(cloud_model, color_cloud_model, "cloud_model", v1);
int v2(0);
viewer->createViewPort(0.5, 0.0, 1.0, 1.0, v2); //4个参数分别是X轴的最小值,最大值,Y轴的最小值,最大值,取值0-1,v1是标识
viewer->setBackgroundColor(255, 255, 255, v2); //设置视口的背景颜色
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> color_key_scenes(keypoints_ptr_scenes, 255, 0, 0);
viewer->addPointCloud<pcl::PointXYZ>(keypoints_ptr_scenes, color_key_scenes, "color_key_scenes", v2);
viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 10, "color_key_scenes");
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> color_cloud_scenes(cloud_scenes, 0, 0, 255);
viewer->addPointCloud<pcl::PointXYZ>(cloud_scenes, color_cloud_scenes, "cloud_scenes", v2);
//plotter.plot();
// 等待直到可视化窗口关闭
while (!viewer->wasStopped())
{
viewer->spinOnce(100);
//boost::this_thread::sleep(boost::posix_time::microseconds(100000));
}
}
}
float get_leaf_size(pcl::PointCloud<pcl::PointXYZ>::Ptr Acloud, int nums = 2000) {
//建立A点云KD-TREE
pcl::KdTreeFLANN<pcl::PointXYZ> kdtree;
kdtree.setInputCloud(Acloud);//Acloud在Bcloud中进行搜索
//进行1邻域点搜索
int K = 2;
std::vector<int> pointIdxNKNSearch(K);//最近点索引
std::vector<float> pointNKNSquaredDistance(K);//最近点距离
//在B点云中计算点与最近邻的平均距离
float avgdistance = 0;
for (int i = 0; i < Acloud->size(); i++) {
kdtree.nearestKSearch(Acloud->points[i], K, pointIdxNKNSearch, pointNKNSquaredDistance);
avgdistance = avgdistance + sqrt(pointNKNSquaredDistance[1]);
pointIdxNKNSearch.clear();
pointNKNSquaredDistance.clear();
}
avgdistance = (float)avgdistance / (float)(Acloud->size());
cout << "平均距离:" << avgdistance << endl;
float num;
num = pow((float)Acloud->points.size() / (float)nums, 1.0 / 3.0);
avgdistance = avgdistance * num;
return avgdistance;
}
pcl::PointCloud<pcl::PointXYZ>::Ptr voxel_grid(pcl::PointCloud<pcl::PointXYZ>::Ptr Acloud, float leaf_size) {
//体素滤波
pcl::PointCloud<pcl::PointXYZ>::Ptr Acloud_filtered(new pcl::PointCloud<pcl::PointXYZ>);
pcl::VoxelGrid<pcl::PointXYZ> sor; //创建滤波对象
sor.setInputCloud(Acloud); //设置需要过滤的点云给滤波对象
sor.setLeafSize(leaf_size, leaf_size, leaf_size); //设置滤波时创建的体素体积
sor.filter(*Acloud_filtered); //执行滤波处理,存储输出
return Acloud_filtered;
}
pcl::PointCloud<pcl::PointXYZ>::Ptr point_cloud_to_num(pcl::PointCloud<pcl::PointXYZ>::Ptr Acloud, float& leaf_size, int point_num = 20000) {
while (Acloud->points.size() >= point_num + point_num * 0.2f) {
leaf_size = get_leaf_size(Acloud, point_num);
*Acloud = *voxel_grid(Acloud, leaf_size);
cout << "点云点数:" << Acloud->size() << endl;
}
return Acloud;
}
pcl::PointCloud<pcl::PointXYZ>::Ptr approximate_voxel_grid(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, float size = 1) {
cout << "before filter: " << cloud->size() << endl;
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_filtered(new pcl::PointCloud<pcl::PointXYZ>);
pcl::ApproximateVoxelGrid<pcl::PointXYZ> avg;
avg.setInputCloud(cloud);
avg.setLeafSize(size, size, size);
avg.filter(*cloud_filtered);
cout << "after filter: " << cloud_filtered->size() << endl;
return cloud_filtered;
}
void show_line(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_source, pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_target, pcl::PointCloud<pcl::PointXYZ>::Ptr key_source, pcl::PointCloud<pcl::PointXYZ>::Ptr key_target, pcl::CorrespondencesPtr corr, float leaf_size) {
pcl::PointCloud<pcl::PointXYZ>::Ptr new_key_source(new pcl::PointCloud<pcl::PointXYZ>());
pcl::PointCloud<pcl::PointXYZ>::Ptr new_key_target(new pcl::PointCloud<pcl::PointXYZ>());
for (int i = 0; i < corr->size(); i++) {
new_key_source->push_back(key_source->points[corr->at(i).index_query]);
new_key_target->push_back(key_target->points[corr->at(i).index_match]);
}
pcl::PointCloud<pcl::PointXYZ>::Ptr new_cloud_source(new pcl::PointCloud<pcl::PointXYZ>);
*new_cloud_source = *cloud_source;
for (int i = 0; i < cloud_source->size(); i++) {
new_cloud_source->points[i].y += 300.0f* leaf_size;
}
for (int i = 0; i < new_key_source->size(); i++) {
new_key_source->points[i].y += 300.0f* leaf_size;
}
pcl::visualization::PCLVisualizer line("line");
line.setBackgroundColor(255, 255, 255);
line.addPointCloud(cloud_target, pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ>(cloud_target, 0.0, 0, 255.0), "cloud_target");
line.addPointCloud(new_cloud_source, pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ>(new_cloud_source, 0.0, 255, 0), "cloud_source");
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ>color_new_key_target(new_key_target, 255, 0, 0);//红色关键点
line.addPointCloud<pcl::PointXYZ>(new_key_target, color_new_key_target, "new_key_target");
line.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 5, "new_key_target");
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> color_new_key_source(new_key_source, 255, 0, 0);//红色关键点
line.addPointCloud<pcl::PointXYZ>(new_key_source, color_new_key_source, "new_key_source");
line.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 5, "new_key_source");
for (int i = 0; i < new_key_source->size(); i++)
{
pcl::PointXYZ source_point = new_key_source->points[i];
pcl::PointXYZ target_point = new_key_target->points[i];
line.addLine(source_point, target_point, 255, 0, 255, to_string(i));
line.setShapeRenderingProperties(pcl::visualization::PCL_VISUALIZER_LINE_WIDTH, 3, to_string(i));
}
line.spin();
}
std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> > show_line(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_model, pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_scenes, pcl::PointCloud<pcl::PointXYZ>::Ptr keypoints_ptr_model, pcl::PointCloud<pcl::PointXYZ>::Ptr keypoints_ptr_scenes, pcl::PointCloud<pcl::Normal>::Ptr normals1_model, pcl::PointCloud<pcl::Normal>::Ptr normals1_scenes, pcl::CorrespondencesPtr corr, float radius) {
std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> > rototranslations;
std::vector<pcl::Correspondences> clustered_corrs;
pcl::PointCloud<pcl::ReferenceFrame>::Ptr model_rf(new pcl::PointCloud<pcl::ReferenceFrame>());
pcl::PointCloud<pcl::ReferenceFrame>::Ptr scene_rf(new pcl::PointCloud<pcl::ReferenceFrame>());
pcl::BOARDLocalReferenceFrameEstimation<pcl::PointXYZ, pcl::Normal, pcl::ReferenceFrame> rf_est;
rf_est.setFindHoles(true);
rf_est.setRadiusSearch(radius);
rf_est.setInputCloud(keypoints_ptr_model);
rf_est.setInputNormals(normals1_model);
rf_est.setSearchSurface(cloud_model);
rf_est.compute(*model_rf);
rf_est.setInputCloud(keypoints_ptr_scenes);
rf_est.setInputNormals(normals1_scenes);
rf_est.setSearchSurface(cloud_scenes);
rf_est.compute(*scene_rf);
// Clustering
pcl::Hough3DGrouping<pcl::PointXYZ, pcl::PointXYZ, pcl::ReferenceFrame, pcl::ReferenceFrame> clusterer;
clusterer.setHoughBinSize(radius);
clusterer.setHoughThreshold(radius);
clusterer.setUseInterpolation(true);
clusterer.setUseDistanceWeight(false);
clusterer.setInputCloud(keypoints_ptr_model);
clusterer.setInputRf(model_rf);
clusterer.setSceneCloud(keypoints_ptr_scenes);
clusterer.setSceneRf(scene_rf);
clusterer.setModelSceneCorrespondences(corr);
//clusterer.cluster (clustered_corrs);
clusterer.recognize(rototranslations, clustered_corrs);
std::cout << "Model instances found: " << rototranslations.size() << std::endl;
for (size_t i = 0; i < rototranslations.size(); ++i)
{
std::cout << "\n Instance " << i + 1 << ":" << std::endl;
std::cout << " Correspondences belonging to this instance: " << clustered_corrs[i].size() << std::endl;
// Print the rotation matrix and translation vector
Eigen::Matrix3f rotation = rototranslations[i].block<3, 3>(0, 0);
Eigen::Vector3f translation = rototranslations[i].block<3, 1>(0, 3);
printf("\n");
printf(" | %6.3f %6.3f %6.3f | \n", rotation(0, 0), rotation(0, 1), rotation(0, 2));
printf(" R = | %6.3f %6.3f %6.3f | \n", rotation(1, 0), rotation(1, 1), rotation(1, 2));
printf(" | %6.3f %6.3f %6.3f | \n", rotation(2, 0), rotation(2, 1), rotation(2, 2));
printf("\n");
printf(" t = < %0.3f, %0.3f, %0.3f >\n", translation(0), translation(1), translation(2));
}
pcl::visualization::PCLVisualizer viewer("Correspondence Grouping");
viewer.setBackgroundColor(255, 255, 255);
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> color_cloud_scenes(cloud_scenes, 0, 0, 255);
viewer.addPointCloud(cloud_scenes, color_cloud_scenes, "cloud_scenes");
viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 2, "cloud_scenes");
pcl::PointCloud<pcl::PointXYZ>::Ptr off_cloud_model(new pcl::PointCloud<pcl::PointXYZ>());
pcl::PointCloud<pcl::PointXYZ>::Ptr off_keypoints_model(new pcl::PointCloud<pcl::PointXYZ>());
// We are translating the model so that it doesn't end in the middle of the scene representation
pcl::transformPointCloud(*cloud_model, *off_cloud_model, Eigen::Vector3f(-200, 0, 0), Eigen::Quaternionf(1, 0, 0, 0));
pcl::transformPointCloud(*keypoints_ptr_model, *off_keypoints_model, Eigen::Vector3f(-200, 0, 0), Eigen::Quaternionf(1, 0, 0, 0));
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> color_off_model(off_cloud_model, 0, 255, 0);
viewer.addPointCloud(off_cloud_model, color_off_model, "off_cloud_model");
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> color_keypoints_ptr_scenes(keypoints_ptr_scenes, 255, 0, 0);
viewer.addPointCloud(keypoints_ptr_scenes, color_keypoints_ptr_scenes, "keypoints_ptr_scenes");
viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 10, "keypoints_ptr_scenes");
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> color_off_keypoints_model(off_keypoints_model, 255, 0, 0);
viewer.addPointCloud(off_keypoints_model, color_off_keypoints_model, "off_keypoints_model");
viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 10, "off_keypoints_model");
for (size_t i = 0; i < rototranslations.size(); ++i)
{
pcl::PointCloud<pcl::PointXYZ>::Ptr rotated_model(new pcl::PointCloud<pcl::PointXYZ>());
pcl::transformPointCloud(*cloud_model, *rotated_model, rototranslations[i]);
std::stringstream ss_cloud;
ss_cloud << "instance" << i;
pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> rotated_model_color_handler(rotated_model, 0, 255, 0);
viewer.addPointCloud(rotated_model, rotated_model_color_handler, ss_cloud.str());
for (size_t j = 0; j < clustered_corrs[i].size(); ++j)
{
std::stringstream ss_line;
ss_line << "correspondence_line" << i << "_" << j;
pcl::PointXYZ& model_point = off_keypoints_model->at(clustered_corrs[i][j].index_query);
pcl::PointXYZ& scene_point = keypoints_ptr_scenes->at(clustered_corrs[i][j].index_match);
// We are drawing a line for each pair of clustered correspondences found between the model and the scene
viewer.addLine<pcl::PointXYZ, pcl::PointXYZ>(model_point, scene_point, 255, 0, 255, ss_line.str());
}
}
while (!viewer.wasStopped())
{
viewer.spinOnce();
}
return rototranslations;
}
pcl::PointCloud<pcl::PointXYZ>::Ptr add_gaussian_noise(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, float m) {
float leaf_size = 0;
pcl::KdTreeFLANN<pcl::PointXYZ> kdtree;
kdtree.setInputCloud(cloud);//Acloud在Bcloud中进行搜索
//进行1邻域点搜索
int K = 2;
std::vector<int> pointIdxNKNSearch(K);//最近点索引
std::vector<float> pointNKNSquaredDistance(K);//最近点距离
//在B点云中计算点与最近邻的平均距离
double avgdistance = 0;
for (int i = 0; i < cloud->size(); i++) {
kdtree.nearestKSearch(cloud->points[i], K, pointIdxNKNSearch, pointNKNSquaredDistance);
leaf_size = leaf_size + sqrt(pointNKNSquaredDistance[1]);
pointIdxNKNSearch.clear();
pointNKNSquaredDistance.clear();
}
leaf_size = (float)leaf_size / (float)(cloud->size());
//添加高斯噪声
pcl::PointCloud<pcl::PointXYZ>::Ptr cloudfiltered(new pcl::PointCloud<pcl::PointXYZ>());
cloudfiltered->points.resize(cloud->points.size());//将点云的cloud的size赋值给噪声
cloudfiltered->header = cloud->header;
cloudfiltered->width = cloud->width;
cloudfiltered->height = cloud->height;
boost::mt19937 rng;
rng.seed(static_cast<unsigned int>(time(0)));
boost::normal_distribution<> nd(0, m*leaf_size);
boost::variate_generator<boost::mt19937&, boost::normal_distribution<>> var_nor(rng, nd);
//添加噪声
for (size_t point_i = 0; point_i < cloud->points.size(); ++point_i)
{
cloudfiltered->points[point_i].x = cloud->points[point_i].x + static_cast<float> (var_nor());
cloudfiltered->points[point_i].y = cloud->points[point_i].y + static_cast<float> (var_nor());
cloudfiltered->points[point_i].z = cloud->points[point_i].z + static_cast<float> (var_nor());
}
return cloudfiltered;
}
float com_leaf(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud) {
pcl::KdTreeFLANN<pcl::PointXYZ> kdtree;
kdtree.setInputCloud(cloud);//Acloud在Bcloud中进行搜索
//进行1邻域点搜索
int K = 2;
std::vector<int> pointIdxNKNSearch(K);//最近点索引
std::vector<float> pointNKNSquaredDistance(K);//最近点距离
//在B点云中计算点与最近邻的平均距离
float leaf_size = 0;
for (int i = 0; i < cloud->size(); i++) {
kdtree.nearestKSearch(cloud->points[i], K, pointIdxNKNSearch, pointNKNSquaredDistance);
leaf_size = leaf_size + sqrt(pointNKNSquaredDistance[1]);
pointIdxNKNSearch.clear();
pointNKNSquaredDistance.clear();
}
leaf_size = (float)leaf_size / (float)(cloud->size());
//cout << "平均距离:" << leaf_size << endl;
return leaf_size;
}
int main(int argc, char** argv) {
double start = 0;
double end = 0;
string road = "D:/code/PCD/自建配准点云/scene+rt/";
vector<string> names = { "a1", "a2","b1","b2","c1","c2","c3","c4","c5","c6","d1","d2","g1","g2","h1","h2" };
//////////////////////读取点云//////////////////////////////////////////////
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_source(new pcl::PointCloud<pcl::PointXYZ>);
pcl::io::loadPLYFile("D:/code/PCD/自建配准点云/scene+rt/d1.ply", *cloud_source);
cout << "滤波前源点云点数:" << cloud_source->size() << endl;
//pcl::PointCloud<pcl::PointXYZ>::Ptr old_cloud_source(new pcl::PointCloud<pcl::PointXYZ>);
//*old_cloud_source = *cloud_source;
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_target(new pcl::PointCloud<pcl::PointXYZ>);
pcl::io::loadPLYFile("D:/code/PCD/自建配准点云/scene+rt/d2.ply", *cloud_target);
cout << "滤波前目标点云点数:" << cloud_target->size() << endl;
//pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_source(new pcl::PointCloud<pcl::PointXYZ>);
//pcl::io::loadPLYFile("D:/code/PCD/识别点云/scene/filter/cheff.ply", *cloud_source);
//cout << "滤波前源点云点数:" << cloud_source->size() << endl;
//pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_target(new pcl::PointCloud<pcl::PointXYZ>);
//pcl::io::loadPLYFile("D:/code/PCD/识别点云/model/filter/cheff.ply", *cloud_target);
//cout << "滤波前目标点云点数:" << cloud_target->size() << endl;
//pcl::visualization::PCLVisualizer visu0("before");
//visu0.setBackgroundColor(255,255,255);
//visu0.addPointCloud(cloud_target, pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ>(cloud_target, 0.0, 0, 255.0), "scen1e2");
//visu0.addPointCloud(cloud_source, pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ>(cloud_source, 0.0, 255, 0), "object1_aligned2");
//visu0.spin();
//*cloud_source = *add_gaussian_noise(cloud_source, 1);
//*cloud_target = *add_gaussian_noise(cloud_target, 1);
//////////////////////循环体素滤波//////////////////////////////////////////////////////////////////////
start = GetTickCount();
float leaf_size = 0;
*cloud_source = *point_cloud_to_num(cloud_source, leaf_size, 20000);
end = GetTickCount();
leaf_size = com_leaf(cloud_source);
end = GetTickCount();
cout << "源点云分辨率:" << leaf_size << endl;
cout << "源点云点数:" << cloud_source->size() << endl;
cout << "源点云循环体素滤波:" << end - start << "ms" << endl;
//pcl::io::savePLYFile("e:/boy1.ply", *cloud_source);
/////////////////源点云特征估计///////////////////////////////////////////////////////////////////////////
pcl::PointCloud<pcl::Normal>::Ptr normals_source(new pcl::PointCloud<pcl::Normal>());
*normals_source = *normal_estimation_OMP(cloud_source, leaf_size*5.0f);
pcl::search::KdTree<pcl::PointXYZ>::Ptr tree_source(new pcl::search::KdTree<pcl::PointXYZ>());
tree_source->setInputCloud(cloud_source);
pcl::PointCloud<pcl::SHOT352>::Ptr features_source(new pcl::PointCloud<pcl::SHOT352>());
pcl::PointCloud<pcl::PointXYZ>::Ptr key_source(new pcl::PointCloud<pcl::PointXYZ>);
start = GetTickCount();
*key_source = *key_detect_u(cloud_source, 20.0*leaf_size);//对比实验
*features_source = *com_shot_feature(cloud_source, normals_source, key_source, 30.0 *leaf_size);//对比实验
end = GetTickCount();
cout << "源点云关键点数目:" << key_source->size() << endl;
cout << "源点云特征估计:" << end - start << "ms" << endl;
//show_key_point(cloud_source, key_source);
//////////////////////循环体素滤波//////////////////////////////////////////////////////////////////////
start = GetTickCount();
*cloud_target = *voxel_grid(cloud_target, leaf_size);
*cloud_target = *point_cloud_to_num(cloud_target, leaf_size, 20000);
leaf_size = com_leaf(cloud_target);
end = GetTickCount();
cout << "目标点云分辨率:" << leaf_size << endl;
cout << "目标点云点数:" << cloud_target->size() << endl;
cout << "目标点云循环体素滤波:" << end - start << "ms" << endl;
//pcl::io::savePLYFile("e:/boy2.ply", *cloud_target);
//////////////////目标点云特征估计//////////////////////////////////////////////////////////////////////////
pcl::PointCloud<pcl::Normal>::Ptr normals_target(new pcl::PointCloud<pcl::Normal>());
*normals_target = *normal_estimation_OMP(cloud_target, leaf_size*5.0f);
pcl::search::KdTree<pcl::PointXYZ>::Ptr tree_target(new pcl::search::KdTree<pcl::PointXYZ>());
tree_target->setInputCloud(cloud_target);
pcl::PointCloud<pcl::SHOT352>::Ptr features_target(new pcl::PointCloud<pcl::SHOT352>());
pcl::PointCloud<pcl::PointXYZ>::Ptr key_target(new pcl::PointCloud<pcl::PointXYZ>);
start = GetTickCount();
*key_target = *key_detect_u(cloud_target, 20.0*leaf_size);//对比实验
*features_target = *com_shot_feature(cloud_target, normals_target, key_target, 30.0 *leaf_size);//对比实验
end = GetTickCount();
cout << "目标点云关键点数目:" << key_target->size() << endl;
cout << "目标点云特征估计:" << end - start << "ms" << endl;
//show_key_point(cloud_target, key_target);
////////////////////初始对应关系估计////////////////////////////////////////////////////////////////////////
start = GetTickCount();
pcl::CorrespondencesPtr corr(new pcl::Correspondences());
float dis = 0.5;
*corr = *com_correspondence(features_source, features_target, dis);
end = GetTickCount();
cout << "初始对应关系数目:" << corr->size() << endl;
cout << "初始对应关系估计:" << end - start << "ms" << endl;
//show_coor(cloud_source, cloud_target, *key_source, *key_target, features_source, features_target, corr);
show_line(cloud_source, cloud_target, key_source, key_target, corr, leaf_size);
pcl::registration::CorrespondenceRejectorOneToOne coo;
coo.setInputCorrespondences(corr);
coo.getRemainingCorrespondences(*corr, *corr);
/////////////////////提取初始对应关系关键点和特征///////////////////////////////////////////////////////////////////////
pcl::PointCloud<pcl::PointXYZ>::Ptr new_key_source(new pcl::PointCloud<pcl::PointXYZ>());
pcl::PointCloud<pcl::PointXYZ>::Ptr new_key_target(new pcl::PointCloud<pcl::PointXYZ>());
pcl::PointCloud<pcl::SHOT352>::Ptr new_features_source(new pcl::PointCloud<pcl::SHOT352>);
pcl::PointCloud<pcl::SHOT352>::Ptr new_features_target(new pcl::PointCloud<pcl::SHOT352>);
for (int i = 0; i < corr->size(); i++) {
new_key_source->push_back(key_source->points[corr->at(i).index_query]);
new_key_target->push_back(key_target->points[corr->at(i).index_match]);
new_features_source->push_back(features_source->points[corr->at(i).index_query]);
new_features_target->push_back(features_target->points[corr->at(i).index_match]);
}
//////////////////去除错误对应关系////////////////////////////////////////////////////////////////////////////////
pcl::PointCloud<pcl::SHOT352>::Ptr new2_features_source(new pcl::PointCloud<pcl::SHOT352>);
vector<float> dis_source;
pcl::PointCloud<pcl::SHOT352>::Ptr new2_features_target(new pcl::PointCloud<pcl::SHOT352>);
vector<float> dis_target;
start = GetTickCount();
*new2_features_source = *com_features2(new_key_source, new_features_source, dis_source);
*new2_features_target = *com_features2(new_key_target, new_features_target, dis_target);
pcl::CorrespondencesPtr corr2(new pcl::Correspondences());
float dis2 = 1;
*corr2 = *com_correspondence2(new2_features_source, dis_source, new2_features_target, dis_target, dis2, leaf_size);
end = GetTickCount();
cout << "对应关系数目:" << corr2->size() << endl;
cout << "对应关系:" << end - start << "ms" << endl;
/////////////////////提取对应关系关键点和特征///////////////////////////////////////////////////////////////////////
pcl::PointCloud<pcl::PointXYZ>::Ptr new3_key_source(new pcl::PointCloud<pcl::PointXYZ>());
pcl::PointCloud<pcl::PointXYZ>::Ptr new3_key_target(new pcl::PointCloud<pcl::PointXYZ>());
pcl::PointCloud<pcl::SHOT352>::Ptr new3_features_source(new pcl::PointCloud<pcl::SHOT352>);
pcl::PointCloud<pcl::SHOT352>::Ptr new3_features_target(new pcl::PointCloud<pcl::SHOT352>);
for (int i = 0; i < corr2->size(); i++) {
new3_key_source->push_back(new_key_source->points[corr2->at(i).index_query]);
new3_key_target->push_back(new_key_target->points[corr2->at(i).index_match]);
new3_features_source->push_back(new2_features_source->points[corr2->at(i).index_query]);
new3_features_target->push_back(new2_features_target->points[corr2->at(i).index_match]);
}
//show_coor(cloud_source, cloud_target, *new_key_source, *new_key_target, new2_features_source, new2_features_target, corr2);
show_line(cloud_source, cloud_target, new_key_source, new_key_target, corr2, leaf_size);
////////////////////SVD////////////////////////////////////////////////////////////////////////
start = GetTickCount();
pcl::registration::TransformationEstimationSVD<pcl::PointXYZ, pcl::PointXYZ, float> svd;
Eigen::Matrix4f trans;
svd.estimateRigidTransformation(*new3_key_source, *new3_key_target, trans);
pcl::transformPointCloud(*new3_key_source, *new3_key_source, trans);
pcl::transformPointCloud(*cloud_source, *cloud_source, trans);
end = GetTickCount();
cout << "SVD:" << end - start << "ms" << endl;
//pcl::visualization::PCLVisualizer visu1("Alignment1");
//visu1.setBackgroundColor(255, 255, 255);
//visu1.addPointCloud(cloud_target, pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ>(cloud_target, 0.0, 0, 0.0), "scene");
//visu1.addPointCloud(cloud_source, pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ>(cloud_source, 0.0, 0.0, 0), "object_aligned");
//visu1.spin();
//////////////////////随机采样一致性//////////////////////////////////////////////////////////////////////
start = GetTickCount();
pcl::SampleConsensusPrerejective<pcl::PointXYZ, pcl::PointXYZ, pcl::SHOT352> align;
align.setInputSource(new3_key_source);
align.setSourceFeatures(new3_features_source);
align.setInputTarget(new3_key_target);
align.setTargetFeatures(new3_features_target);
align.setMaximumIterations(10000); // Number of RANSAC iterations
align.setNumberOfSamples(3); // Number of points to sample for generating/prerejecting a pose
align.setCorrespondenceRandomness(3); // Number of nearest features to use
align.setSimilarityThreshold(0.9f); // Polygonal edge length similarity threshold
align.setMaxCorrespondenceDistance(2.0f*leaf_size); // Inlier threshold
//align.setRANSACOutlierRejectionThreshold(5.0f * leaf_size);
align.setInlierFraction(0.25f); // Required inlier fraction for accepting a pose hypothesis
align.align(*new3_key_source);
end = GetTickCount();
cout << "随机采样一致性:" << end - start << "ms" << endl;
cout << "分数: " << align.getFitnessScore(5.0f*leaf_size) << endl;
Eigen::Matrix4f transformation = align.getFinalTransformation();
pcl::console::print_info("Inliers: %i/%i\n", align.getInliers().size(), new3_key_source->size());
pcl::transformPointCloud(*cloud_source, *cloud_source, transformation);
//Show alignment
//pcl::visualization::PCLVisualizer visu2("Alignment2");
//visu2.setBackgroundColor(255, 255, 255);
//visu2.addPointCloud(cloud_source, pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ>(cloud_source, 0.0, 255.0, 0.0), "scene1");
//visu2.addPointCloud(cloud_target, pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ>(cloud_target, 0.0, 0.0, 255.0), "object_aligned1");
//visu2.spin();
vector<int> indice;
indice = align.getInliers();
//////////////////将点云平移,方便显示////////////////////////////////////////////////////////////////////////
pcl::PointCloud<pcl::PointXYZ>::Ptr new4_key_source(new pcl::PointCloud<pcl::PointXYZ>);
pcl::PointCloud<pcl::PointXYZ>::Ptr new4_key_target(new pcl::PointCloud<pcl::PointXYZ>);
for (int i = 0; i < indice.size(); i++) {
new4_key_source->push_back(new3_key_source->points[indice[i]]);
new4_key_target->push_back(new3_key_target->points[indice[i]]);
}
pcl::PointCloud<pcl::PointXYZ>::Ptr new4_cloud_source(new pcl::PointCloud<pcl::PointXYZ>);
*new4_cloud_source = *cloud_source;
for (int i = 0; i < new4_cloud_source->size(); i++) {
new4_cloud_source->points[i].x += 300.0f* leaf_size;
new4_cloud_source->points[i].y += 300.0f* leaf_size;
}
for (int i = 0; i < new4_key_source->size(); i++) {
new4_key_source->points[i].x += 300.0f* leaf_size;
new4_key_source->points[i].y += 300.0f* leaf_size;
}
////////////////////显示对应点连线//////////////////////////////////////////////////////////////////////
pcl::visualization::PCLVisualizer line("line");
line.setBackgroundColor(255, 255, 255);
line.addPointCloud(new4_cloud_source, pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ>(new4_cloud_source, 0.0, 0, 0), "new4_cloud_source");
line.addPointCloud(cloud_target, pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ>(cloud_target, 0.0, 0.0, 0), "cloud_target");
line.addPointCloud<pcl::PointXYZ>(new4_key_source, pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ>(new4_key_source, 0, 0, 0), "new4_key_source");
line.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 5, "new4_key_source");
line.addPointCloud<pcl::PointXYZ>(new4_key_target, pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ>(new4_key_target, 0, 0, 0), "new4_key_target");
line.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 5, "new4_key_target");
for (int i = 0; i < new4_key_source->size(); i++)
{
line.addLine(new4_key_source->points[i], new4_key_target->points[i], 0, 0, 0, to_string(i));
line.setShapeRenderingProperties(pcl::visualization::PCL_VISUALIZER_LINE_WIDTH, 2, to_string(i));
}
line.spin();
////////////////////ICP////////////////////////////////////////////////////////////////////////
start = GetTickCount();
pcl::IterativeClosestPoint<pcl::PointXYZ, pcl::PointXYZ> icp;
icp.setInputSource(cloud_source);
icp.setInputTarget(cloud_target);
icp.setTransformationEpsilon(5.0f*leaf_size);
icp.setMaxCorrespondenceDistance(5.0f * leaf_size);
icp.setMaximumIterations(3000);
icp.align(*cloud_source);
end = GetTickCount();
cout << "ICP:" << end - start << "ms" << endl;
std::cout << "has converged:" << icp.hasConverged() << " score: " <<
icp.getFitnessScore(5.0f*leaf_size) << std::endl;
std::cout << icp.getFinalTransformation() << std::endl;
pcl::visualization::PCLVisualizer visu("Alignment");
visu.setBackgroundColor(255, 255, 255);
pcl::transformPointCloud(*cloud_source, *cloud_source, icp.getFinalTransformation());
visu.addPointCloud(cloud_source, pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ>(cloud_source, 0.0, 255.0, 0.0), "scene1");
visu.addPointCloud(cloud_target, pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ>(cloud_target, 0.0, 0.0, 255.0), "object_aligned1");
visu.spin();
system("pause");
return 0;
}
|
57c45ebfc5b72123272039ef850292dd76903fc4
|
4fa753608f790ba9233d8b3b7e2a277c580c54d8
|
/e2fdb-helper/Thumb.cpp
|
346ddb6d03859415d6b647e8596c0124dd17ae13
|
[
"MIT"
] |
permissive
|
txe/e2fdb
|
f3b91eb28308978192a7403906a5438c35453042
|
005ef4f3268e6a6e44422cf07bba2099de9aae85
|
refs/heads/master
| 2020-12-24T14:35:45.277922
| 2014-04-15T11:01:29
| 2014-04-15T11:01:29
| null | 0
| 0
| null | null | null | null |
WINDOWS-1251
|
C++
| false
| false
| 3,527
|
cpp
|
Thumb.cpp
|
#include "StdAfx.h"
#include "Thumb.h"
#include <shlobj.h>
#include <atlimage.h>
//-------------------------------------------------------------------------
bool thumb::ExtractThumbnail(const std::wstring & strDirectory, const std::wstring& strFileNameOnly, const std::wstring& strThumbnailFileNameOnly, int nSize)
{
HBITMAP Thumbnail = thumb::GetThumbnailHBitmap(strDirectory, strFileNameOnly, nSize);
if (Thumbnail == 0)
return false;
CImage image;
image.Attach(Thumbnail);
image.Save((strDirectory + strThumbnailFileNameOnly).c_str(), Gdiplus::ImageFormatPNG);
image.Destroy();
return true;
}
//-------------------------------------------------------------------------
HBITMAP thumb::GetThumbnailHBitmap(std::wstring strFolder, std::wstring strFileName, int nSize)
{
HBITMAP result(0);
LPITEMIDLIST pidList = NULL;
DWORD dwPriority = 0;
DWORD dwFlags = IEIFLAG_ASPECT | IEIFLAG_QUALITY;
HRESULT hr = E_NOINTERFACE;
WCHAR szBuffer[MAX_PATH];
IExtractImage *peiURL = NULL;
IShellFolder *psfWorkDir = NULL;
IShellFolder *psfDesktop = NULL;
CoInitialize(NULL);
hr = SHGetDesktopFolder(&psfDesktop);
if(SUCCEEDED(hr))
{
hr = psfDesktop->ParseDisplayName(NULL, NULL, (LPWSTR)strFolder.c_str(), NULL, &pidList, NULL);
if(SUCCEEDED(hr))
{
hr = psfDesktop->BindToObject(pidList, NULL, IID_IShellFolder, (void **)&psfWorkDir);
if(SUCCEEDED(hr))
{
hr = psfWorkDir->ParseDisplayName(NULL, NULL, (LPWSTR)strFileName.c_str(), NULL, &pidList, NULL);
if(SUCCEEDED(hr))
{
LPCITEMIDLIST pidl = pidList;
hr = psfWorkDir->GetUIObjectOf(NULL, 1, &pidl, IID_IExtractImage, NULL,
(void **)&peiURL);
if(SUCCEEDED(hr))
{
SIZE cSize;
cSize.cx = nSize;
cSize.cy = nSize;
hr = peiURL->GetLocation(szBuffer, MAX_PATH, &dwPriority, &cSize, 16, &dwFlags);
if(SUCCEEDED(hr) || hr == E_PENDING)
{
hr = peiURL->Extract(&result);
}
}
}
}
}
ILFree(pidList);
if(peiURL != NULL)
peiURL->Release();
if(psfDesktop != NULL)
psfDesktop->Release();
if(psfWorkDir != NULL)
psfWorkDir->Release();
//CoUninitialize();
}
return result;
}
//-------------------------------------------------------------------------
bool thumb::Strech(const std::wstring& fileName)
{
CImage oldImage, newImage;
oldImage.Load(fileName.c_str());
if (!oldImage)
return false;
int Himg = oldImage.GetHeight();
int Wimg = oldImage.GetWidth();
double coH = (double)Himg/Wimg;
double coW = (double)Wimg/Himg;
int H = 64*min(coH,1); if(H<=0) H=1;
int W = 64*min(coW,1); if(W<=0) W=1;
// Пересохряняем рисунок в формате 64х64
int bpp = oldImage.GetBPP();
newImage.Create(64,64,bpp);
// Белый фон рисунка - оптимизировать!
for(int x=0; x<64; ++x)
for(int y=0; y<64; ++y)
newImage.SetPixel(x,y,RGB(255,255,255));
HDC dch = newImage.GetDC();
SelectObject(dch,newImage);
SetStretchBltMode(dch,HALFTONE);
// Основая функция модификации
oldImage.StretchBlt(dch,(64-W)/2,(64-H)/2,W,H,0,0,Wimg,Himg,SRCCOPY);
newImage.Save(fileName.c_str(), Gdiplus::ImageFormatPNG);
newImage.ReleaseDC();
return true;
}
|
dec3a17c10691a4f98e4fddd3b550e234795f557
|
adf9e2a78f91c5689073f476703a93cc0ddeb190
|
/findInformativeReads.cpp
|
7d444bc3c042fc0fa85d84ac20db70951ede0a4b
|
[] |
no_license
|
rdcrawford/ATLAS
|
27230066ddb62d7a33d03492b16d735bb7bffc73
|
409e3a8ae4d7750d2fa45648c57870f146a6d731
|
refs/heads/master
| 2020-03-11T14:53:37.067819
| 2018-04-19T22:31:10
| 2018-04-19T22:31:10
| 130,068,356
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,456
|
cpp
|
findInformativeReads.cpp
|
#include "api/BamAlignment.h"
#include "api/BamMultiReader.h"
#include "api/BamWriter.h"
#include "BarcodeClass.h"
#include <string>
#include "constants.h"
#include "readData.h"
using namespace BamTools;
// -------------------------------------------------------------------------- //
// Author Ryan D. Crawford
// Date 03/20/2018
// Purpose Step 4 of ATLAS. Creates a dynamically allocated vector with all of
// the informativeReads.
// -------------------------------------------------------------------------- //
// Input 1) Name of the bamFile
// 2) Name of the bam index file
// 3) Name of the chromosome to be searched
// 4-5) Start and end positions for the barcode within the chr
// 6) Vector containing the barcode sequences
// Return A vector containing the indicies of the mate pairs for reads
// containing barcode sequences
// Description Uses the bamtools api to find reads mapping to a specific region
// specified by the arguments and returns the index of the mate pair
// corresponding to that read
std::vector <readData> *findInformativeReads(std::string bamFile,
std::string baiFile, std::string chr, int startPos,
int endPos, vector <Barcode> *barcodes)
{
// Variable Initializations:
BamReader reader; // open the BAM reader
BamWriter writer; // Open the BAM writer
BamAlignment algn; // sore the alignment
bool isOpen; // indicates wheter the bam file was opened
int refID; // Locus of interest for the alignment
int mateID = 0; // ID of the mate pair for the current alignment
readData currentRead; // struct to store data on the current read
int counter = 0;
// stores the index of informative mates
std::vector <readData> *informativeReads;
informativeReads = new std::vector <readData>;
// Open the bam file
isOpen = reader.Open(bamFile);
// If the BAM file was not opened properly print an error and exit
if (!isOpen)
{
std::cout << " Unable to open BAM file: " << bamFile << std::endl;
exit(1);
}
// Define the region of interest
refID = 0;//reader.GetReferenceID(chr);
// BamTools::BamRegion region(refID, startPos, refID, endPos);
// reader.SetRegion(region);
std::string alignedBases; // string to store the sequence of alignment
// iterate through alignments in this region,
// ignoring alignments with a Map quality below the minimium below some cutoff
while (reader.GetNextAlignment(algn))
{
// Update to the bases aligned in this read
alignedBases = algn.QueryBases;
bool isBcAlgn = false; // indicates that a read aligns to the barcode locus
if (algn.RefID == refID)
{
if (algn.Position <= startPos && algn.Position + algn.Length >= endPos)
{
isBcAlgn = true;
}
else if(algn.GetEndPosition() - algn.Length <= startPos &&
algn.GetEndPosition() >= endPos)
{
isBcAlgn = true;
}
}
if (isBcAlgn)
{
int bcNum = 0; // Counter for the barcode index
bool isMatch = false; // Indicates matching barcode in the read
// iterate through the barcodes until the barcode is found or all the
// barcodes have been found
while(!isMatch && bcNum < barcodes->size())
{
// Look for a matching barcode
isMatch = (*barcodes)[bcNum].matchBarcodes(alignedBases,
algn.IsReverseStrand());
if (!isMatch) bcNum ++; // increment the counts
}
if (isMatch) // if the read is a match, mark it for further analysis
{
(*barcodes)[bcNum].incrementReadCount(); // increment the count
// Dudate the current read data
currentRead.bcNum = bcNum;
// Append read index to the barcode's vector for that mate pair
if (algn.IsFirstMate())
{
currentRead.readIndex = counter + 1; //For first mate: next read
}
else
{
currentRead.readIndex = counter - 1; //For second mate: previous read
}
// Add current read data to the vector
informativeReads->push_back(currentRead);
// Get the index of the mate pair
mateID ++;
}
}
counter ++;
}
// close the reader
reader.Close();
return informativeReads;
}
|
187b474d2779d016947762705f559f269e7d794c
|
2f8875802666be2637b32387ae12203d4e2458cc
|
/Cpp_primer/p91-p257/p246/7.24.cpp
|
e328235ebcfc1844c5ffe37120de27d5f7cc7e81
|
[] |
no_license
|
suzumiyayuhi/GrayHistory
|
41394c87dc15cf2700b3c4b1e24b296442d9e143
|
72db503e5a8a13c890152c7c9143f1918a9ec8f5
|
refs/heads/master
| 2020-06-17T17:23:55.278186
| 2017-02-20T08:54:48
| 2017-02-20T08:55:58
| 74,980,202
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 400
|
cpp
|
7.24.cpp
|
#include<iostream>
#include<string>
#include<vector>
using namespace std;
class Screen
{
public:
typedef string::size_type pos;
Screen() = default;
Screen(pos a, pos b) :height(a), width(b) { contents=(a*b, ""); }
Screen(pos a,pos b,char c):height(a),width(b),contents(a*b,c){}
private:
string::size_type curspr = 0;
string::size_type height = 0, width = 0;
string contents;
};
int main() {
}
|
54df25c77683f039445c0a491d064fd0df927a63
|
f38566e7816d955dac2f50e0cf71766a52b2abc1
|
/node_modules/ngmaker/node_modules/nodegit/include/treebuilder.h
|
0f8feda752f3fd23f933ef63542420728e3419a3
|
[
"MIT"
] |
permissive
|
hsleonis/healthy-entrepreneurs
|
410ef4d2a6fea80d3888886cc580701fc38ce6a1
|
b54eda81909d9f94338d79589055bc9e7f4d2a2e
|
refs/heads/master
| 2021-01-10T10:11:46.373397
| 2016-04-30T10:27:13
| 2016-04-30T10:27:13
| 49,309,530
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,388
|
h
|
treebuilder.h
|
#ifndef GITTREEBUILDER_H
#define GITTREEBUILDER_H
// generated from class_header.h
#include <nan.h>
#include <string>
extern "C" {
#include <git2.h>
}
#include "../include/tree_entry.h"
#include "../include/oid.h"
#include "../include/repository.h"
#include "../include/tree.h"
// Forward declaration.
struct git_treebuilder {
};
using namespace node;
using namespace v8;
class GitTreebuilder : public Nan::ObjectWrap {
public:
static Nan::Persistent<Function> constructor_template;
static void InitializeComponent (Local<v8::Object> target);
git_treebuilder *GetValue();
git_treebuilder **GetRefValue();
void ClearValue();
static Local<v8::Value> New(void *raw, bool selfFreeing);
bool selfFreeing;
private:
GitTreebuilder(git_treebuilder *raw, bool selfFreeing);
~GitTreebuilder();
static NAN_METHOD(JSNewFunction);
static NAN_METHOD(Clear);
static NAN_METHOD(Entrycount);
static NAN_METHOD(Free);
static NAN_METHOD(Get);
struct InsertBaton {
int error_code;
const git_error* error;
const git_tree_entry * out;
git_treebuilder * bld;
const char * filename;
const git_oid * id;
bool idNeedsFree;
git_filemode_t filemode;
};
class InsertWorker : public Nan::AsyncWorker {
public:
InsertWorker(
InsertBaton *_baton,
Nan::Callback *callback
) : Nan::AsyncWorker(callback)
, baton(_baton) {};
~InsertWorker() {};
void Execute();
void HandleOKCallback();
private:
InsertBaton *baton;
};
static NAN_METHOD(Insert);
struct CreateBaton {
int error_code;
const git_error* error;
git_treebuilder * out;
git_repository * repo;
const git_tree * source;
};
class CreateWorker : public Nan::AsyncWorker {
public:
CreateWorker(
CreateBaton *_baton,
Nan::Callback *callback
) : Nan::AsyncWorker(callback)
, baton(_baton) {};
~CreateWorker() {};
void Execute();
void HandleOKCallback();
private:
CreateBaton *baton;
};
static NAN_METHOD(Create);
static NAN_METHOD(Remove);
static NAN_METHOD(Write);
git_treebuilder *raw;
};
#endif
|
0097a84ca162b9841464cd35d51f675a71fe816f
|
a7a53c06d9c9bcadd475a160f0b51681f5cd98e4
|
/core/sqf/monitor/linux/reqnodeadd.cxx
|
e82dcf462ecf980a9fa1012b83be2fb8b70e5caa
|
[
"Apache-2.0",
"LicenseRef-scancode-generic-export-compliance",
"BSD-3-Clause",
"MIT"
] |
permissive
|
Wang1995/trafodion
|
182ee82dde03db75db66fcee0643efbf21d9b980
|
1585ac4fa78ecbf2aff86be5c285c14b55f1c138
|
refs/heads/master
| 2020-07-08T18:04:04.938085
| 2019-08-14T16:20:10
| 2019-08-14T16:20:10
| 193,495,001
| 1
| 0
| null | 2019-06-24T11:46:49
| 2019-06-24T11:46:49
| null |
UTF-8
|
C++
| false
| false
| 9,711
|
cxx
|
reqnodeadd.cxx
|
///////////////////////////////////////////////////////////////////////////////
//
// @@@ START COPYRIGHT @@@
//
// (C) Copyright 2012-2015 Hewlett Packard Enterprise Development LP
//
// 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.
//
// @@@ END COPYRIGHT @@@
//
///////////////////////////////////////////////////////////////////////////////
#include <stdio.h>
#include "replicate.h"
#include "reqqueue.h"
#include "montrace.h"
#include "monsonar.h"
#include "monlogging.h"
#include "clusterconf.h"
extern CMonStats *MonStats;
extern CNode *MyNode;
extern CNodeContainer *Nodes;
extern CMonitor *Monitor;
extern CReplicate Replicator;
CExtNodeAddReq::CExtNodeAddReq( reqQueueMsg_t msgType
, int pid
, struct message_def *msg
)
: CExternalReq(msgType, pid, msg)
{
// Add eyecatcher sequence as a debugging aid
memcpy(&eyecatcher_, "RQEX", 4);
priority_ = High;
}
CExtNodeAddReq::~CExtNodeAddReq()
{
// Alter eyecatcher sequence as a debugging aid to identify deleted object
memcpy(&eyecatcher_, "rqex", 4);
}
void CExtNodeAddReq::populateRequestString( void )
{
char strBuf[MON_STRING_BUF_SIZE/2] = { 0 };
snprintf( strBuf, sizeof(strBuf),
"ExtReq(%s) req #=%ld requester(pid=%d) "
"(node_name=%s/first_core=%d/last_core=%d/processors=%d/roles=%d)"
, CReqQueue::svcReqType[reqType_], getId(), pid_
, msg_->u.request.u.node_add.node_name
, msg_->u.request.u.node_add.first_core
, msg_->u.request.u.node_add.last_core
, msg_->u.request.u.node_add.processors
, msg_->u.request.u.node_add.roles );
requestString_.assign( strBuf );
}
void CExtNodeAddReq::performRequest()
{
const char method_name[] = "CExtNodeAddReq::performRequest";
TRACE_ENTRY;
int rc = MPI_SUCCESS;
pnodeConfigInfo_t pnodeConfigInfo;
lnodeConfigInfo_t lnodeConfigInfo;
CClusterConfig *clusterConfig = NULL;
CLNodeConfig *lnodeConfig = NULL;
CPNodeConfig *pnodeConfig = NULL;
CProcess *requester = NULL;
// Trace info about request
if (trace_settings & (TRACE_REQUEST | TRACE_PROCESS))
{
trace_printf("%s@%d request #%ld: NodeAdd, "
"node_name=%s, first_core=%d, last_core=%d, "
"processors=%d, roles=%d\n"
, method_name, __LINE__, id_
, msg_->u.request.u.node_add.node_name
, msg_->u.request.u.node_add.first_core
, msg_->u.request.u.node_add.last_core
, msg_->u.request.u.node_add.processors
, msg_->u.request.u.node_add.roles );
}
requester = MyNode->GetProcess( pid_ );
if ( requester )
{
clusterConfig = Nodes->GetClusterConfig();
if (clusterConfig)
{
if (clusterConfig->GetPNodesCount() <
clusterConfig->GetPNodesConfigMax())
{
// Check for existence of node name in the configuration
pnodeConfig = clusterConfig->GetPNodeConfig( msg_->u.request.u.node_add.node_name );
if (!pnodeConfig)
{
pnodeConfigInfo.pnid = -1;
strncpy( pnodeConfigInfo.nodename
, msg_->u.request.u.node_add.node_name
, sizeof(pnodeConfigInfo.nodename) );
pnodeConfigInfo.excludedFirstCore = -1;
pnodeConfigInfo.excludedLastCore = -1;
clusterConfig->SetCoreMask( pnodeConfigInfo.excludedFirstCore
, pnodeConfigInfo.excludedLastCore
, pnodeConfigInfo.excludedCoreMask );
pnodeConfigInfo.spareCount = 0;
memset( pnodeConfigInfo.sparePNid
, -1
, sizeof(pnodeConfigInfo.sparePNid) );
pnodeConfig = new CPNodeConfig( NULL // pnodesConfig
, pnodeConfigInfo );
if (pnodeConfig)
{
lnodeConfigInfo.nid = -1;
lnodeConfigInfo.pnid = -1;
strncpy( lnodeConfigInfo.nodename
, msg_->u.request.u.node_add.node_name
, sizeof(lnodeConfigInfo.nodename) );
lnodeConfigInfo.firstCore = msg_->u.request.u.node_add.first_core;
lnodeConfigInfo.lastCore = msg_->u.request.u.node_add.last_core;
lnodeConfigInfo.processor = msg_->u.request.u.node_add.processors;
clusterConfig->SetCoreMask( lnodeConfigInfo.lastCore
, lnodeConfigInfo.firstCore
, lnodeConfigInfo.coreMask );
lnodeConfigInfo.zoneType = static_cast<ZoneType>(msg_->u.request.u.node_add.roles);
lnodeConfig = new CLNodeConfig( pnodeConfig
, lnodeConfigInfo );
if (lnodeConfig)
{
// Tell all monitors to add this node to the configuration database
// Replicate request to be processed by CIntNodeAdd in all nodes
CReplNodeAdd *repl = new CReplNodeAdd( lnodeConfig, requester );
if (repl)
{
// we will not reply at this time ... but wait for
// node add to be processed in CIntNodeAddReq
// Retain reference to requester's request buffer so can
// send completion message.
requester->parentContext( msg_ );
msg_->noreply = true;
Replicator.addItem(repl);
}
else
{
delete pnodeConfig;
char la_buf[MON_STRING_BUF_SIZE];
sprintf(la_buf, "[%s], Failed to allocate CReplNodeAdd, no memory!\n",
method_name);
mon_log_write(MON_REQ_NODE_ADD_1, SQ_LOG_ERR, la_buf);
rc = MPI_ERR_NO_MEM;
}
}
else
{
delete pnodeConfig;
char la_buf[MON_STRING_BUF_SIZE];
sprintf(la_buf, "[%s], Failed to allocate CLNodeConfig, no memory!\n",
method_name);
mon_log_write(MON_REQ_NODE_ADD_2, SQ_LOG_ERR, la_buf);
rc = MPI_ERR_NO_MEM;
}
}
else
{
char la_buf[MON_STRING_BUF_SIZE];
sprintf(la_buf, "[%s], Failed to allocate CPNodeConfig, no memory!\n",
method_name);
mon_log_write(MON_REQ_NODE_ADD_3, SQ_LOG_ERR, la_buf);
rc = MPI_ERR_NO_MEM;
}
}
else
{
// Node name already exists
rc = MPI_ERR_NAME;
}
}
else
{
// Already a nodes configuration limit
rc = MPI_ERR_OP;
}
}
else
{
char la_buf[MON_STRING_BUF_SIZE];
sprintf(la_buf, "[%s], Failed to retrieve ClusterConfig object!\n",
method_name);
mon_log_write(MON_REQ_NODE_ADD_4, SQ_LOG_CRIT, la_buf);
rc = MPI_ERR_INTERN;
}
if (rc != MPI_SUCCESS)
{
// Unable to initiate add request
msg_->u.reply.type = ReplyType_Generic;
msg_->u.reply.u.generic.nid = requester->GetNid();
msg_->u.reply.u.generic.pid = pid_;
msg_->u.reply.u.generic.verifier = requester->GetVerifier() ;
msg_->u.reply.u.generic.process_name[0] = '\0';
msg_->u.reply.u.generic.return_code = rc;
// Send reply to requester
lioreply(msg_, pid_);
}
}
else
{
if (trace_settings & (TRACE_REQUEST | TRACE_PROCESS))
trace_printf("%s@%d - Can't find requester, rc=%d\n", method_name, __LINE__, MPI_ERR_NAME);
// We don't know about this process.
errorReply( MPI_ERR_EXITED );
}
TRACE_EXIT;
}
|
87e414647ac1bb0fa0c327245cd3ddbe28a1cff7
|
6a3a50538c544c9f8d65bcb8f96d4e3b68a4e848
|
/Sources/Menu/Welcome.hh
|
1e0477c8a0f8feb3f7e1003a6371e0e74597e654
|
[] |
no_license
|
lejard-h/cpp_bomberman
|
8f2d7eabebc1b872e189f066caeee78bc2550569
|
3ba7dcbc77ac87fb47be006446c537da7055b2dc
|
refs/heads/master
| 2016-09-06T08:57:09.230787
| 2014-07-11T08:55:12
| 2014-07-11T08:55:12
| 21,691,750
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 663
|
hh
|
Welcome.hh
|
//
// Welcome.hh for in /home/maigna_j/rendu/cpp_bomberman/menu
//
// Made by jeremy maignan
// Login <maigna_j@epitech.net>
//
// Started on Thu May 22 13:03:40 2014 jeremy maignan
// Last update Sun Jun 15 02:07:55 2014 Imad Roughi
//
#ifndef WELCOME_HH_
#define WELCOME_HH_
#include "Menu.hh"
class Score;
class Mode;
class Credit;
class Load;
class Option;
class Welcome : public Menu
{
private:
Score *_Score;
Load *_Load;
Credit *_Credit;
Mode *_Mode;
Option *_Option;
static Welcome *_Inst;
public:
Welcome();
~Welcome();
static Welcome *Instance();
void Run();
void Display();
};
#endif
|
b481c719204b22f2892d223bb0247c5759396f00
|
588c8918a348d46d32d6fead870e235ac869b4df
|
/CCButton.cpp
|
5af9fd2b52a44487c1df96b890f0e98d14adc255
|
[
"MIT"
] |
permissive
|
Hyacinth/cocos2dx-ext
|
602988e6056779caae91604dd48d485ef390e2f7
|
b242aca7866ca7e8fb87ceb1631acabcb422928a
|
refs/heads/master
| 2021-01-18T04:42:47.426195
| 2013-03-25T18:18:51
| 2013-03-25T18:18:51
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 6,057
|
cpp
|
CCButton.cpp
|
/****************************************************************************
Copyright (c) 2012-2013 Igor Zavorotkin <ivzave@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "actions/CCActionInstant.h"
#include "actions/CCActionInterval.h"
#include "touch_dispatcher/CCTouchDispatcher.h"
#include "CCDirector.h"
#include "CCCommonExtended.h"
#include "CCGeometryExtended.h"
#include "CCNodeExtended.h"
#include "CCButton.h"
USING_NS_CC;
CCButton* CCButton::create(const CCSize& tSize, CCObject* pTarget, SEL_MenuHandler pSelector)
{
CCButton* pRet = new CCButton();
return pRet->init(tSize, pTarget, pSelector) ? (CCButton*)pRet->autorelease() : (delete pRet, pRet = NULL);
}
CCButton::CCButton() :
m_bIsEnabled(true),
m_bIsSelected(false),
m_fDelay(0.0f),
m_pTarget(NULL),
m_pSelector(NULL)
{
}
bool CCButton::init(const CCSize& tSize, CCObject* pTarget, SEL_MenuHandler pSelector)
{
do
{
CCEnsureElseBreak(CCLayer::init());
m_pTarget = pTarget;
m_pSelector = pSelector;
ignoreAnchorPointForPosition(false);
setContentSize(tSize);
setTouchEnabled(true);
return true;
} while (false);
return false;
}
void CCButton::addNodeWithActions(CCNode* pNode, int nZOrder, CCFiniteTimeAction* pSelectAction, CCFiniteTimeAction* pUnselectAction)
{
m_tComponents.resize(m_tComponents.size() + 1);
CCButtonComponent& tComponent = m_tComponents.back();
tComponent.pNode = pNode;
tComponent.pSelectAction = pSelectAction;
tComponent.pUnselectAction = pUnselectAction;
if (pUnselectAction != NULL)
{
if (pUnselectAction->getDuration() > m_fDelay)
{
m_fDelay = pUnselectAction->getDuration();
}
}
addChild(pNode, nZOrder);
}
void CCButton::registerWithTouchDispatcher()
{
CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, kCCButtonTouchPriority, true);
}
bool CCButton::ccTouchBegan(CCTouch* pTouch, CCEvent* pEvent)
{
CC_UNUSED_PARAM(pEvent);
do
{
CC_BREAK_IF_NOT(CCNodeIsVisibleRecursive(this));
CC_BREAK_IF_NOT(!m_bIsSelected);
CC_BREAK_IF_NOT(m_bIsEnabled);
CC_BREAK_IF_NOT(CCNodeGetLocalBoundingBox(this).containsPoint(convertTouchToNodeSpaceAR(pTouch)));
select();
return true;
} while (false);
return false;
}
void CCButton::ccTouchMoved(CCTouch* pTouch, CCEvent* pEvent)
{
CC_UNUSED_PARAM(pEvent);
bool bTouchInNodeRect(CCNodeGetLocalBoundingBox(this).containsPoint(convertTouchToNodeSpaceAR(pTouch)));
if (m_bIsSelected && !bTouchInNodeRect)
{
unselect();
}
else if (!m_bIsSelected && bTouchInNodeRect)
{
select();
}
}
void CCButton::ccTouchEnded(CCTouch* pTouch, CCEvent* pEvent)
{
CC_UNUSED_PARAM(pTouch);
CC_UNUSED_PARAM(pEvent);
if (m_bIsSelected)
{
unselect();
activate();
}
}
void CCButton::ccTouchCancelled(CCTouch* pTouch, CCEvent* pEvent)
{
CC_UNUSED_PARAM(pTouch);
CC_UNUSED_PARAM(pEvent);
if (m_bIsSelected)
{
unselect();
}
}
void CCButton::select(bool bImmediate)
{
if (!m_bIsSelected)
{
for (std::vector<CCButtonComponent>::iterator pComponent = m_tComponents.begin(); pComponent != m_tComponents.end(); ++pComponent)
{
if (pComponent->pRunningAction != NULL )
{
pComponent->pNode->stopAction(pComponent->pRunningAction);
}
pComponent->pRunningAction = (CCFiniteTimeAction*)pComponent->pNode->runAction((CCFiniteTimeAction*)pComponent->pSelectAction->copy()->autorelease());
if (bImmediate)
{
pComponent->pRunningAction->update(1.0f);
pComponent->pNode->stopAction(pComponent->pRunningAction);
}
}
m_bIsSelected = true;
}
}
void CCButton::unselect()
{
if (m_bIsSelected) // TODO remove double check
{
for (std::vector<CCButtonComponent>::iterator pComponent = m_tComponents.begin(); pComponent != m_tComponents.end(); ++pComponent)
{
if (pComponent->pRunningAction != NULL )
{
pComponent->pNode->stopAction(pComponent->pRunningAction);
}
pComponent->pRunningAction = (CCFiniteTimeAction*)pComponent->pNode->runAction((CCFiniteTimeAction*)pComponent->pUnselectAction->copy()->autorelease());
}
m_bIsSelected = false;
}
}
void CCButton::activate()
{
runAction(CCSequence::create(
CCDelayTime::create(m_fDelay),
CCCallFunc::create(this, callfunc_selector(CCNode::cleanup)),
CCCallFuncO::create(m_pTarget, m_pSelector, this),
NULL));
// TODO important: double click bug
// TODO important: another button clicked before activation happens follows to crash
}
//
// TODO activate sound (action?)
CCButtonToggle* CCButtonToggle::create(const CCSize& tSize, CCObject* pTarget, SEL_MenuHandler pSelector)
{
CCButtonToggle* pRet = new CCButtonToggle();
return pRet->init(tSize, pTarget, pSelector) ? (CCButtonToggle*)pRet->autorelease() : (delete pRet, pRet = NULL);
}
void CCButtonToggle::ccTouchEnded(CCTouch* pTouch, CCEvent* pEvent)
{
CC_UNUSED_PARAM(pTouch);
CC_UNUSED_PARAM(pEvent);
if (getIsSelected())
{
activate();
}
}
void CCButtonToggle::activate()
{
runAction(CCCallFuncO::create(getTarget(), getSelector(), this));
}
|
a440c4231222b043de27d58f8315038ac30ffb9b
|
a4c7d958e45fc68bf8ca43caff4dbfb7cef6a068
|
/GumballGame.cpp
|
3a6c1c71bf0c61a318634874c0bd03268494e3de
|
[] |
no_license
|
traviskaufman/Gumball-Game
|
5e7b60906087a5b1c4f31e6f402776c1c51694f0
|
63380d53aa64dd385d633aec93413ebeea1d963b
|
refs/heads/master
| 2020-04-06T07:21:17.431127
| 2012-02-28T02:14:54
| 2012-02-28T02:14:54
| 3,425,258
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,766
|
cpp
|
GumballGame.cpp
|
/**
* @file GumballGame.cpp
*
* Implements a Game using gumballs where the goal of the game is to get a Yellow gumball
* Author: Travis Kaufman
* Class: Web Programming - Spring 2012
* Version: 1.0.2
*/
#include "GB_Global.h"
#include "GumballMachine.h"
vector<GUMBALL> findMaxColors(vector<GUMBALL>& chosen_colors);
int main() {
cout << "+++ WELCOME TO THE CIMS GUMBALL MACHINE SIMULATOR!! +++" << endl;
cout << "------------------------------------------" << endl;
string gb_names[NUM_GB_COLORS] = {
"Red", "Blue", "White", "Green", "Black", "Purple", "Cyan", "Magenta", "Yellow"
};
GumballMachine *machine = GumballMachine::getInstance();
cout << "You are starting with the following Gumballs:" << endl;
for (int i = 0; i < NUM_GB_COLORS-1; i++) {
GUMBALL gb_cast = (GUMBALL)i;
int gb_count = machine->fill(gb_cast);
cout << gb_count << " " << gb_names[gb_cast] << endl;
} // end for loop
machine->getGumballs()->push_back(YELLOW);
cout << "...and 1 yellow" << endl;
cout << "------------------------------------------" << endl;
cout << "Here are your random purchases:" << endl;
int index = (int)machine->getGumballs()->size() - 1;
random_shuffle(machine->getGumballs()->begin(), machine->getGumballs()->end());
GUMBALL chosen = RED; // pick an arbitrary color
short unsigned int gb_dispensed = 0;
vector<GUMBALL> dispensed_gumballs;
do {
chosen = machine->dispense(index--); // index-- since we pop one off the gumball vector each time
dispensed_gumballs.push_back(chosen);
cout << gb_names[chosen] << endl;
machine->getGumballs()->pop_back();
gb_dispensed++;
} while (chosen != YELLOW); // end do/while
cout << "------------------------------------------" << endl;
cout << "You purchased " << gb_dispensed << " gumballs for a total of $";
printf("%.2f\n", (float)gb_dispensed * 0.25); // printf() still gives better formatting options
vector<GUMBALL> most_purchased = findMaxColors(dispensed_gumballs);
cout << "Most purchased: ";
for (int i = 0; i < (int)most_purchased.size(); i++)
cout << gb_names[most_purchased[i]] << " ";
cout << endl;
delete machine;
return 0;
} // end main()
vector<GUMBALL> findMaxColors(vector<GUMBALL>& chosen_colors) {
int max = 0;
vector<GUMBALL> max_gumballs;
for (int i = 0; i < NUM_GB_COLORS; i++) {
int appearances = (int) count(chosen_colors.begin(), chosen_colors.end(), (GUMBALL)i);
if (appearances > max) {
max = appearances;
if (!max_gumballs.empty())
max_gumballs.clear();
max_gumballs.push_back((GUMBALL)i);
}
else if (appearances == max) {
max_gumballs.push_back((GUMBALL)i);
}
} // end for loop
return max_gumballs;
} // end findMaxColors
|
bfd93e44b267996339c88ccf943da9dbdaeb5068
|
26eecfac0f92adcd74a33f4b9825d35d86b97033
|
/ProjectClass/system.h
|
6450b1f7718b7e618049005b8db9ed82b33dd58c
|
[] |
no_license
|
Katczajk/ProjectClass
|
691145dbe5ac7fd7c43266ad6bd515d36141b2b2
|
92e51c87fb62c20e0e05762874eb181d4d219741
|
refs/heads/master
| 2022-07-16T03:02:10.341886
| 2020-05-15T07:16:31
| 2020-05-15T07:16:31
| 264,018,067
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 176
|
h
|
system.h
|
#pragma once
#ifndef system_h
#define system_h
// Inlcude Guard
#endif // !system_h
class MyPart {
private:
bool sysstat;
public: static void info();
};
int main();
|
623ed08b2cbfe3865485ba70568b7624aa3d9af5
|
184a1ff89af3db673c096ea684d87d3bced61486
|
/source/src/node/buffer/beat-cutter.cpp
|
0f19dbb65a132a33274955454bcfb0b74f0c198b
|
[
"MIT"
] |
permissive
|
zeos/signalflow
|
9d4de067208fbb34018d9526424783f8ca7ce45a
|
1c75030862eeaf6dbe341e23d276880f2f0a991f
|
refs/heads/master
| 2023-05-31T22:03:01.766834
| 2021-06-13T22:56:37
| 2021-06-13T22:56:37
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,538
|
cpp
|
beat-cutter.cpp
|
#include "signalflow/core/random.h"
#include "signalflow/node/buffer/beat-cutter.h"
#include <stdlib.h>
namespace signalflow
{
BeatCutter::BeatCutter(BufferRef buffer,
int segment_count,
NodeRef stutter_probability,
NodeRef stutter_count,
NodeRef jump_probability,
NodeRef duty_cycle,
NodeRef rate,
NodeRef segment_rate)
: buffer(buffer), segment_count(segment_count), stutter_probability(stutter_probability), stutter_count(stutter_count), jump_probability(jump_probability), duty_cycle(duty_cycle), rate(rate), segment_rate(segment_rate)
{
this->name = "beat-cutter";
this->create_input("stutter_probability", this->stutter_probability);
this->create_input("stutter_count", this->stutter_count);
this->create_input("jump_probability", this->jump_probability);
this->create_input("duty_cycle", this->duty_cycle);
this->create_input("rate", this->rate);
this->create_input("segment_rate", this->segment_rate);
this->segment_offsets.resize(segment_count);
this->phase = 0;
this->segment_index = 0;
this->segment_phase = 0;
this->segment_duty = 1.0;
this->current_segment_offset = 0;
this->next_segment_offset = 0;
this->current_stutter_length = 0;
this->current_segment_rate = 1.0;
this->create_buffer("buffer", this->buffer);
this->set_channels(1, 0);
if (buffer)
{
this->set_buffer("buffer", buffer);
}
}
void BeatCutter::set_buffer(std::string name, BufferRef buffer)
{
if (name == "buffer")
{
this->Node::set_buffer(name, buffer);
this->num_output_channels = buffer->get_num_channels();
this->segment_length = (int) ((float) this->buffer->get_num_frames() / this->segment_count);
for (int i = 0; i < this->segment_count; i++)
{
this->segment_offsets[i] = roundf((float) i * this->buffer->get_num_frames() / this->segment_count);
}
this->current_segment_offset = this->segment_offsets[0];
this->next_segment_offset = this->segment_offsets[1];
this->current_stutter_length = this->segment_length;
}
}
void BeatCutter::process(Buffer &out, int num_frames)
{
if (!this->buffer)
{
return;
}
sample rv;
for (int frame = 0; frame < num_frames; frame++)
{
for (int channel = 0; channel < this->num_output_channels; channel++)
{
if (this->segment_duty == 1 || (fmod(this->segment_phase, this->current_stutter_length)) < (this->segment_duty * this->current_stutter_length))
{
rv = this->buffer->get(channel, this->current_segment_offset + fmod(this->segment_phase, this->current_stutter_length));
out[channel][frame] = rv;
}
else
{
out[channel][frame] = 0.0;
}
}
this->phase += this->rate->out[0][frame];
this->segment_phase += this->rate->out[0][frame] * current_segment_rate;
if (this->phase >= this->next_segment_offset)
{
this->segment_index = (this->segment_index + 1) % this->segment_count;
this->segment_phase = 0;
this->current_segment_offset = this->segment_offsets[this->segment_index];
this->current_segment_rate = this->segment_rate->out[0][frame];
if (random_uniform() < this->jump_probability->out[0][frame])
{
// jump
this->current_segment_offset = this->segment_offsets[random_integer(0, this->segment_count)];
}
if (random_uniform() < this->stutter_probability->out[0][frame])
{
// stutter
float current_stutter_count = this->stutter_count->out[0][frame];
this->current_stutter_length = (int) (this->segment_length / current_stutter_count);
}
else
{
this->current_stutter_length = this->segment_length;
}
this->next_segment_offset = this->segment_offsets[(this->segment_index + 1) % this->segment_count];
if (this->next_segment_offset == 0)
this->next_segment_offset = this->buffer->get_num_frames();
this->segment_duty = this->duty_cycle->out[0][frame];
}
this->phase = fmod(this->phase, this->buffer->get_num_frames());
}
}
}
|
3891a8c6c4ca7a729044e0c71db205c8656a3c8d
|
32e8da727732ffc5ba6de149daf2a4ca0b57b292
|
/Duskfall/Source/Duskfall/Components/Equipment/Shield/AdvBaseShield.cpp
|
b6a153294cc54da89ad07e4489b6893e6e3839ba
|
[] |
no_license
|
RoseBush1404/Duskfall
|
3f8160c4f6c5bdff675d372eacee646c7bb5782a
|
94532c78fd52872c9d681c3c25ec4311d866f661
|
refs/heads/master
| 2020-08-06T14:19:25.540441
| 2020-07-01T21:13:46
| 2020-07-01T21:13:46
| 213,003,404
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,168
|
cpp
|
AdvBaseShield.cpp
|
// Duskfall - Michael Rose - r015676g
#include "AdvBaseShield.h"
#include "Components/AnimBillboardComponent.h"
AAdvBaseShield::AAdvBaseShield()
{
//Set Equipment Type
EquipmentType = EEquipmentType::ET_Shield;
EquipmentSize = EEquipmentSize::ES_OneHanded;
}
void AAdvBaseShield::Equipped(UEquipmentManager* EquipmentManager, UAnimBillboardComponent* NewAnimBillboard)
{
Super::Equipped(EquipmentManager, NewAnimBillboard);
GetUsersMovementComponent();
GetUserCameraManager();
}
void AAdvBaseShield::UsePressed()
{
if (AnimBillboard != nullptr)
{
if (ShieldState == EAdvShieldState::ASS_Idle || ShieldState == EAdvShieldState::ASS_WindingDown)
{
HasBeenReleased = false;
ShieldState = EAdvShieldState::ASS_WindingUp;
AnimBillboard->PlayAnimation(ParryAnim);
}
}
}
void AAdvBaseShield::UseReleased()
{
if (AnimBillboard != nullptr)
{
if (ShieldState == EAdvShieldState::ASS_Blocking)
{
ShieldState = EAdvShieldState::ASS_WindingDown;
AnimBillboard->PlayAnimation(LowerShieldAnim);
}
else if (ShieldState == EAdvShieldState::ASS_WindingUp || ShieldState == EAdvShieldState::ASS_Parry)
{
HasBeenReleased = true;
}
}
}
#pragma region Anim Events
void AAdvBaseShield::AnimEventHit_Implementation(FString& AnimMessage)
{
if (AnimMessage == "ParryStart")
{
StartParry();
}
if (AnimMessage == "ParryFinished")
{
FinishParry();
}
if (AnimMessage == "ShieldLowered")
{
ShieldLowered();
}
}
void AAdvBaseShield::StartParry()
{
ShieldState = EAdvShieldState::ASS_Parry;
}
void AAdvBaseShield::FinishParry()
{
// has the block button already bee released?
if (HasBeenReleased)
{
//yes then lower shield
HasBeenReleased = false;
ShieldState = EAdvShieldState::ASS_WindingDown;
AnimBillboard->PlayAnimation(LowerShieldAnim);
}
else
{
//no then go to blocking
ShieldState = EAdvShieldState::ASS_Blocking;
if (AnimBillboard != nullptr)
{
AnimBillboard->PlayAnimation(BlockingAnim);
}
}
}
void AAdvBaseShield::ShieldLowered()
{
ShieldState = EAdvShieldState::ASS_Idle;
if (AnimBillboard != nullptr)
{
AnimBillboard->PlayAnimation(StandardSpriteAnim);
}
}
#pragma endregion
|
582e75a1f6021446686907704f33ba04c7e3f764
|
80b02bff8cfa850dc60497db67e9ff263f671be6
|
/proj/calc2dcmd/src/console/mmCommandLine.cpp
|
9f0b32a5c81565d48678ec0399cd0d5b86031291
|
[
"MIT"
] |
permissive
|
ogx/Calculation2D
|
68a3188e59d9842647af0e00c52fefe036b16d06
|
79f9d05986227e4677a8f88309c2eb6512a3de69
|
refs/heads/master
| 2016-08-03T05:06:23.720417
| 2015-03-26T12:45:07
| 2015-03-26T12:45:07
| 3,526,351
| 3
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,200
|
cpp
|
mmCommandLine.cpp
|
#include <console/mmCommandLine.h>
mmConsole::mmCommandLine::mmCommandLine(void) : m_sElements(1, L"") {
m_sCursor.sElement = m_sElements.begin();
m_sCursor.sCharacter = m_sCursor.sElement->begin();
}
mmConsole::mmCommandLine::mmCommandLine(mmCommandLine const & p_sCommandLine) : m_sElements(p_sCommandLine.m_sElements) {
m_sCursor.sElement = m_sElements.begin() + (p_sCommandLine.m_sCursor.sElement - p_sCommandLine.m_sElements.begin());
m_sCursor.sCharacter = m_sCursor.sElement->begin() + (p_sCommandLine.m_sCursor.sCharacter - p_sCommandLine.m_sCursor.sElement->begin());
}
mmConsole::mmCommandLine mmConsole::mmCommandLine::operator = (mmCommandLine const & p_sCommandLine) {
m_sElements = p_sCommandLine.m_sElements;
m_sCursor.sElement = m_sElements.begin() + (p_sCommandLine.m_sCursor.sElement - p_sCommandLine.m_sElements.begin());
m_sCursor.sCharacter = m_sCursor.sElement->begin() + (p_sCommandLine.m_sCursor.sCharacter - p_sCommandLine.m_sCursor.sElement->begin());
return *this;
}
//void mmConsole::mmCommandLine::Clear(void) {
// m_sElements.clear();
// m_sCursor.sElement = m_sElements.begin();
// m_sCursor.sCharacter = m_sCursor.sElement->begin();
//}
void mmConsole::mmCommandLine::AddParam(void) {
if(m_sCursor.sElement == m_sElements.end())
m_sElements.push_back(L"");
else
m_sCursor.sElement = m_sElements.insert(m_sCursor.sElement + 1, L"");
m_sCursor.sCharacter = m_sCursor.sElement->begin();
}
void mmConsole::mmCommandLine::AddToParam(wchar_t const p_cCharacter) {
if(m_sCursor.sCharacter == m_sCursor.sElement->end())
m_sCursor.sElement->push_back(p_cCharacter);
else
m_sCursor.sCharacter = m_sCursor.sElement->insert(m_sCursor.sCharacter + 1, p_cCharacter);
}
void mmConsole::mmCommandLine::SetParam(std::wstring const p_sValue) {
*m_sCursor.sElement = p_sValue;
m_sCursor.sCharacter = (p_sValue.empty() ? m_sCursor.sElement->begin() : m_sCursor.sElement->end() - 1);
}
bool mmConsole::mmCommandLine::EraseParam(void) {
if(m_sElements.size() > 1) {
m_sCursor.sElement = m_sElements.erase(m_sCursor.sElement);
if(m_sCursor.sElement != m_sElements.begin())
--m_sCursor.sElement;
m_sCursor.sCharacter = (m_sCursor.sElement->empty() ? m_sCursor.sElement->begin() : --m_sCursor.sElement->end());
return true;
} else
return false;
}
bool mmConsole::mmCommandLine::EraseFromParam(void) {
if(! m_sCursor.sElement->empty()) {
m_sCursor.sElement->erase(m_sCursor.sCharacter);
if(m_sCursor.sCharacter != m_sCursor.sElement->begin())
--m_sCursor.sCharacter;
return true;
} else
return false;
}
bool mmConsole::mmCommandLine::IsParamEmpty(void) const {
return m_sCursor.sElement->empty();
}
bool mmConsole::mmCommandLine::IsEmpty(void) const {
return m_sElements.empty();
}
std::pair<std::wstring, std::size_t> mmConsole::mmCommandLine::GetParam(void) const {
return std::make_pair(*m_sCursor.sElement, m_sCursor.sElement - m_sElements.begin());
}
std::wstring mmConsole::mmCommandLine::GetParam(std::size_t const v_iIndex) const {
return v_iIndex < m_sElements.size() ? m_sElements[v_iIndex] : std::wstring(L"");
}
std::vector<std::wstring>mmConsole::mmCommandLine:: GetParams(void) const {
return m_sElements;
}
void mmConsole::mmCommandLine::DecreaseCursorPos(void) {
if(m_sCursor.sCharacter != m_sCursor.sElement->begin()) {
--m_sCursor.sCharacter;
} else if(m_sCursor.sElement != m_sElements.begin()) {
--m_sCursor.sElement;
m_sCursor.sCharacter = m_sCursor.sElement->begin();
}
}
void mmConsole::mmCommandLine::IncreaseCursorPos(void) {
if((m_sCursor.sCharacter + 1) != m_sCursor.sElement->end()) {
++m_sCursor.sCharacter;
} else if((m_sCursor.sElement + 1) != m_sElements.end()) {
++m_sCursor.sElement;
m_sCursor.sCharacter = m_sCursor.sElement->begin();
}
}
std::wstring mmConsole::mmCommandLine::Print(wchar_t const p_cSeparator, wchar_t const p_cEscape) const {
std::wstring v_sLine;
for(std::size_t v_iI = 0; v_iI < m_sElements.size(); ++v_iI) {
v_sLine += m_sElements[v_iI];
if(v_iI != m_sElements.size() - 1)
v_sLine += p_cSeparator;
}
return v_sLine;
}
|
18eaee557cad751236df88fb3a1a7b6d96e38610
|
d36ddabd41274bde9a9fea394ad38277ee22bd7e
|
/TP2_PowerRangers_BMPTerreno/srcBMPTerreno/Parcela.cpp
|
d32912c6055cf7f3505db006cb08b461b743db7c
|
[] |
no_license
|
AgustinLeguizamon/PowerRangers-Granjeros-V2.0
|
408b564c1f97b1fc5dea649e9accdbedc7799e09
|
78299e99daed8abdcdd238e08df1ad5e1c46542d
|
refs/heads/master
| 2020-03-15T01:35:21.874169
| 2018-06-30T00:22:46
| 2018-06-30T00:22:46
| 131,897,089
| 0
| 1
| null | 2018-05-19T16:33:12
| 2018-05-02T19:31:25
|
C++
|
UTF-8
|
C++
| false
| false
| 2,418
|
cpp
|
Parcela.cpp
|
#include "Parcela.h"
#include <string>
#include <iostream>
using namespace std;
Parcela::Parcela(){
this->cultivo = 'X';
this->estadoCosecha = false;
this->estadoRiego = false;
this->estadoSiembra = false;
this->tiempoCrecimiento = 0;
this->tiempoRecuperacion = 0;
this->cultivoPodrido = false;
this->cultivoSeco = false;
}
void Parcela::sembrarParcela(char nombreCultivo, Lista<Semilla*>* semillas){
if (listoParaSembrar()){
CatalogoSemillas informacionCultivo;
this->cultivo = nombreCultivo;
this->tiempoCrecimiento = (informacionCultivo.obtenerInformacionSemilla(semillas, this->cultivo)->obtenerTiempoCrecimiento());
this->estadoSiembra = true;
}
else {
throw string ("La parcela no esta disponible para siembra");
}
}
void Parcela::cosecharParcela(Lista<Semilla*>* semillas){
if (listoParaCosechar()){
CatalogoSemillas informacionCultivo;
this->tiempoRecuperacion = (informacionCultivo.obtenerInformacionSemilla(semillas, this->cultivo)->obtenerTiempoRecuperacion());
this->cultivo = 'X';
this->estadoCosecha = true;
}
else {
throw string ("La parcela no esta disponible para cosecha");
}
}
void Parcela::regarParcela(){ //tener en cuenta para restar la unidad de riego
if (!this->regado()){
this->estadoRiego = true;
}
else {
throw string ("La parcela ya se encuentra regada");
}
}
bool Parcela::sembrado(){
return this->estadoSiembra;
}
bool Parcela::regado(){
return this->estadoRiego;
}
bool Parcela::cosechado(){
return this->estadoCosecha;
}
char Parcela::obtenerCultivo(){
return this->cultivo;
}
bool Parcela::obtenerCultivoPodrido(){
return this->cultivoPodrido;
}
bool Parcela::obtenerCultivoSeco(){
return this->cultivoSeco;
}
int Parcela::obtenerTiempoRecuperacion(){
return this->tiempoRecuperacion;
}
int Parcela::obtenerTiempoCrecimiento(){
return this->tiempoCrecimiento;
}
void Parcela::pudrirParcela() { //esto se usaria al final del turno de cada jugador
if (this->listoParaCosechar()) {
this->cultivoPodrido = true;
this->cultivo = 'X';
this->tiempoRecuperacion = this->tiempoRecuperacion / 2;
}
}
void Parcela::secarParcela() {
if (!this->regado()){
cultivoSeco = true;
this->cultivo = 'X';
}
}
bool Parcela::listoParaCosechar(){
return (!this->cosechado() && this->obtenerTiempoCrecimiento()== 0);
}
bool Parcela::listoParaSembrar() {
return (!this->sembrado() && this->obtenerTiempoRecuperacion() == 0);
}
|
4c6a658ed218e8087757146d2dbe866353d66acb
|
0470293a1b01604579feaa5b376ac0b55685b6e5
|
/Project/Source/Game/Core/StateCore/StateCore_Default.h
|
5c37b94fcb48c4524326dfe0ae3d6820122a0abf
|
[] |
no_license
|
TanakaHirokiHalTokyo/DX9-Game
|
42c5383039d1278deb37527d40edc3158afb4d7e
|
4aebd3fd7e91e3a3492e595f5f7bccafa901e967
|
refs/heads/master
| 2020-03-30T07:19:45.110520
| 2018-10-02T09:52:29
| 2018-10-02T09:52:29
| 150,932,548
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 302
|
h
|
StateCore_Default.h
|
#pragma once
#include "StateCore.h"
class StateCore_UpDown;
class StateCore_Default :public StateCore
{
public:
StateCore_Default();
~StateCore_Default()override;
void UpdateCore(Core* core)override;
void ChangeMoveState(StateCore_UpDown* state);
private:
StateCore_UpDown* state_ = nullptr;
};
|
99101f281d944cf32ec10393271b41289e3e9845
|
6e9b20902f4e232d12e865f192ea5128ae253ba7
|
/Fluid/3.9/U
|
d551ff797dc692c6c00ecda07fbe7efbd13950e9
|
[] |
no_license
|
abarcaortega/FSI_3
|
1de5ed06ca7731016e5136820aecdc0a74042723
|
016638757f56e7b8b33af4a1af8e0635b88ffbbc
|
refs/heads/master
| 2020-08-03T22:28:04.707884
| 2019-09-30T16:33:31
| 2019-09-30T16:33:31
| 211,905,379
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 59,589
|
U
|
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "3.9";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField nonuniform List<vector>
2790
(
(9.94399 0 0.0205231)
(9.87572 0 0.0295875)
(9.77521 0 0.0359893)
(9.64944 0 0.0425559)
(9.50409 0 0.049385)
(9.34007 0 0.0564279)
(9.15655 0 0.0638153)
(8.95264 0 0.0717109)
(8.72748 0 0.0802544)
(8.4801 0 0.0895726)
(8.2093 0 0.0997925)
(7.91368 0 0.111044)
(7.59172 0 0.123459)
(7.24182 0 0.137164)
(6.86238 0 0.152272)
(6.45185 0 0.16887)
(6.00894 0 0.186997)
(5.53276 0 0.206619)
(5.02305 0 0.227591)
(4.48053 0 0.249612)
(3.90725 0 0.272178)
(3.30693 0 0.294527)
(2.68539 0 0.315623)
(2.05072 0 0.334292)
(1.4119 0 0.350611)
(0.798126 0 0.372887)
(0.110837 0 0.325107)
(-0.469552 0 -0.114837)
(-0.453761 0 -0.29717)
(-0.231161 0 -0.423863)
(9.9985 0 0.0407027)
(9.98146 0 0.0623823)
(9.93575 0 0.0791394)
(9.86417 0 0.0966238)
(9.77098 0 0.115123)
(9.65716 0 0.134487)
(9.52207 0 0.154973)
(9.36487 0 0.176941)
(9.18473 0 0.200705)
(8.98069 0 0.226547)
(8.75155 0 0.254741)
(8.49592 0 0.285557)
(8.21224 0 0.319245)
(7.89887 0 0.356019)
(7.55409 0 0.396016)
(7.17626 0 0.439259)
(6.76386 0 0.485589)
(6.31574 0 0.534584)
(5.83134 0 0.58546)
(5.31098 0 0.636953)
(4.75626 0 0.687204)
(4.17053 0 0.733649)
(3.55941 0 0.772959)
(2.93167 0 0.801102)
(2.30006 0 0.813762)
(1.69306 0 0.807271)
(1.10726 0 0.747285)
(0.65896 0 0.547971)
(0.186553 0 0.224676)
(-0.00819889 0 -0.453702)
(9.99559 0 0.0432065)
(9.97556 0 0.0752708)
(9.9318 0 0.103345)
(9.8649 0 0.132369)
(9.77779 0 0.163057)
(9.67155 0 0.195396)
(9.54589 0 0.229739)
(9.40015 0 0.266599)
(9.23367 0 0.306465)
(9.04566 0 0.349801)
(8.83511 0 0.397065)
(8.60084 0 0.448714)
(8.34148 0 0.505183)
(8.05554 0 0.566854)
(7.74143 0 0.634)
(7.3975 0 0.706719)
(7.02218 0 0.784825)
(6.61403 0 0.867712)
(6.17203 0 0.954183)
(5.69574 0 1.04224)
(5.18574 0 1.12888)
(4.64407 0 1.20979)
(4.07491 0 1.27916)
(3.48549 0 1.32934)
(2.88696 0 1.35011)
(2.29957 0 1.32646)
(1.73194 0 1.22082)
(1.21633 0 0.973066)
(0.701197 0 0.570217)
(0.358072 0 -0.156462)
(9.99403 0 0.0494986)
(9.97181 0 0.0932052)
(9.92788 0 0.13357)
(9.86225 0 0.174207)
(9.77694 0 0.216431)
(9.67299 0 0.260657)
(9.55032 0 0.307425)
(9.4085 0 0.357409)
(9.24704 0 0.411284)
(9.06535 0 0.469697)
(8.86271 0 0.533292)
(8.63822 0 0.602712)
(8.39088 0 0.678578)
(8.11956 0 0.761459)
(7.82305 0 0.851803)
(7.50006 0 0.949855)
(7.14931 0 1.05553)
(6.76952 0 1.16822)
(6.35958 0 1.28658)
(5.91869 0 1.40825)
(5.44663 0 1.52945)
(4.94411 0 1.64467)
(4.41328 0 1.74614)
(3.85839 0 1.82323)
(3.28594 0 1.86139)
(2.70651 0 1.84037)
(2.12574 0 1.72607)
(1.55433 0 1.47795)
(0.957996 0 1.08379)
(0.509441 0 0.502429)
(9.99331 0 0.0572129)
(9.96994 0 0.110957)
(9.92593 0 0.162102)
(9.86146 0 0.213345)
(9.77799 0 0.266353)
(9.67635 0 0.32191)
(9.55655 0 0.380696)
(9.41822 0 0.443481)
(9.26098 0 0.511047)
(9.08435 0 0.584159)
(8.88772 0 0.663574)
(8.67041 0 0.750047)
(8.43162 0 0.844316)
(8.17049 0 0.947062)
(7.88612 0 1.05885)
(7.57753 0 1.18005)
(7.24372 0 1.31066)
(6.88368 0 1.45015)
(6.49636 0 1.59719)
(6.08082 0 1.74929)
(5.63626 0 1.90239)
(5.16223 0 2.0503)
(4.65889 0 2.18417)
(4.12734 0 2.29175)
(3.56952 0 2.35659)
(2.989 0 2.35737)
(2.38693 0 2.26504)
(1.76647 0 2.04775)
(1.09004 0 1.69153)
(0.536673 0 1.15429)
(9.99302 0 0.0655378)
(9.96923 0 0.1287)
(9.92556 0 0.190111)
(9.86253 0 0.25184)
(9.78129 0 0.315574)
(9.68245 0 0.382314)
(9.56601 0 0.452868)
(9.43172 0 0.528093)
(9.27921 0 0.60887)
(9.10807 0 0.696071)
(8.91779 0 0.790563)
(8.70776 0 0.893205)
(8.47731 0 1.00483)
(8.22571 0 1.12623)
(7.95219 0 1.25806)
(7.65593 0 1.40078)
(7.33609 0 1.5545)
(6.99171 0 1.71882)
(6.62176 0 1.89251)
(6.2251 0 2.07318)
(5.80038 0 2.25681)
(5.34615 0 2.43718)
(4.86083 0 2.60518)
(4.34283 0 2.74823)
(3.79052 0 2.84958)
(3.2027 0 2.88826)
(2.57668 0 2.83832)
(1.91355 0 2.67174)
(1.1728 0 2.37416)
(0.549991 0 1.89457)
(9.99297 0 0.0740739)
(9.96927 0 0.146312)
(9.92637 0 0.217481)
(9.86509 0 0.289288)
(9.78643 0 0.363351)
(9.69085 0 0.440821)
(9.57835 0 0.522653)
(9.44872 0 0.609802)
(9.30166 0 0.703243)
(9.13679 0 0.80395)
(8.95366 0 0.912882)
(8.75172 0 1.03099)
(8.53036 0 1.15919)
(8.2889 0 1.29837)
(8.02662 0 1.44926)
(7.74273 0 1.61244)
(7.43635 0 1.78814)
(7.10647 0 1.97611)
(6.75188 0 2.17535)
(6.3711 0 2.38377)
(5.96221 0 2.59769)
(5.52276 0 2.81135)
(5.04966 0 3.01613)
(4.53915 0 3.19997)
(3.9868 0 3.34671)
(3.38805 0 3.43604)
(2.73737 0 3.44342)
(2.03634 0 3.34165)
(1.24181 0 3.11376)
(0.563543 0 2.69336)
(9.99306 0 0.082587)
(9.96981 0 0.163604)
(9.92807 0 0.244047)
(9.86885 0 0.325476)
(9.79313 0 0.409441)
(9.70126 0 0.4972)
(9.59323 0 0.589831)
(9.46888 0 0.688386)
(9.32796 0 0.793927)
(9.17015 0 0.907513)
(8.99503 0 1.03019)
(8.80212 0 1.16301)
(8.59083 0 1.30698)
(8.36053 0 1.46305)
(8.11048 0 1.6321)
(7.83984 0 1.81482)
(7.54766 0 2.01161)
(7.23273 0 2.22245)
(6.89358 0 2.44667)
(6.52826 0 2.68263)
(6.1342 0 2.9273)
(5.70798 0 3.17572)
(5.24511 0 3.42033)
(4.73994 0 3.65019)
(4.18564 0 3.85027)
(3.57492 0 4.00097)
(2.89967 0 4.07803)
(2.16223 0 4.05256)
(1.3162 0 3.90192)
(0.583254 0 3.54041)
(9.99326 0 0.0909272)
(9.97072 0 0.180407)
(9.93046 0 0.269665)
(9.87362 0 0.360238)
(9.80118 0 0.453642)
(9.71344 0 0.551203)
(9.61038 0 0.654103)
(9.49188 0 0.763485)
(9.35776 0 0.880491)
(9.20774 0 1.00626)
(9.04146 0 1.14193)
(8.85848 0 1.28864)
(8.65828 0 1.44748)
(8.44023 0 1.61955)
(8.2036 0 1.80581)
(7.94749 0 2.00715)
(7.67083 0 2.22418)
(7.37222 0 2.4572)
(7.04987 0 2.70598)
(6.70136 0 2.96949)
(6.32346 0 3.24559)
(5.91178 0 3.53047)
(5.46052 0 3.81802)
(4.96219 0 4.09897)
(4.4076 0 4.35989)
(3.78659 0 4.58218)
(3.08774 0 4.74122)
(2.31285 0 4.80467)
(1.41074 0 4.74136)
(0.614353 0 4.44224)
(9.99352 0 0.098991)
(9.97191 0 0.196577)
(9.9334 0 0.294192)
(9.87924 0 0.393413)
(9.8104 0 0.49575)
(9.72717 0 0.602582)
(9.62953 0 0.715174)
(9.51741 0 0.83475)
(9.39068 0 0.962529)
(9.24913 0 1.09973)
(9.09246 0 1.24757)
(8.92028 0 1.40726)
(8.73214 0 1.58003)
(8.52743 0 1.76706)
(8.30545 0 1.9695)
(8.06528 0 2.18842)
(7.80576 0 2.42472)
(7.52535 0 2.67908)
(7.22198 0 2.95183)
(6.89285 0 3.24273)
(6.53414 0 3.5507)
(6.14062 0 3.87341)
(5.70522 0 4.20664)
(5.21868 0 4.54335)
(4.66921 0 4.87245)
(4.04309 0 5.17704)
(3.32391 0 5.43246)
(2.50996 0 5.60221)
(1.542 0 5.64383)
(0.664116 0 5.41843)
(9.99384 0 0.106703)
(9.9733 0 0.211998)
(9.9368 0 0.317499)
(9.88558 0 0.424852)
(9.82063 0 0.535584)
(9.74225 0 0.651114)
(9.65044 0 0.772778)
(9.54517 0 0.901873)
(9.42637 0 1.03968)
(9.2939 0 1.1875)
(9.14752 0 1.34661)
(8.98694 0 1.51832)
(8.81175 0 1.70395)
(8.62143 0 1.90482)
(8.41532 0 2.12225)
(8.19254 0 2.35752)
(7.95191 0 2.61188)
(7.69183 0 2.88645)
(7.41011 0 3.18218)
(7.10372 0 3.49975)
(6.76846 0 3.83936)
(6.39848 0 4.20043)
(5.98574 0 4.58109)
(5.5193 0 4.97727)
(4.98463 0 5.38131)
(4.36354 0 5.77962)
(3.63218 0 6.1493)
(2.78037 0 6.45095)
(1.73363 0 6.62892)
(0.744918 0 6.5036)
(9.9942 0 0.114005)
(9.97487 0 0.226573)
(9.94055 0 0.33947)
(9.89252 0 0.45442)
(9.83173 0 0.572978)
(9.75851 0 0.696603)
(9.67288 0 0.826685)
(9.57487 0 0.964581)
(9.46448 0 1.11164)
(9.34161 0 1.2692)
(9.20615 0 1.43862)
(9.05786 0 1.6213)
(8.89644 0 1.81864)
(8.72147 0 2.0321)
(8.53237 0 2.26317)
(8.32837 0 2.51336)
(8.10837 0 2.78425)
(7.87084 0 3.07745)
(7.61366 0 3.3946)
(7.3338 0 3.73736)
(7.02702 0 4.10731)
(6.68728 0 4.50589)
(6.30606 0 4.93398)
(5.87131 0 5.39135)
(5.36605 0 5.87531)
(4.76722 0 6.37828)
(4.04106 0 6.88338)
(3.1618 0 7.35383)
(2.02501 0 7.72372)
(0.880867 0 7.75777)
(9.99459 0 0.120852)
(9.97657 0 0.240223)
(9.94461 0 0.360005)
(9.89995 0 0.481997)
(9.84356 0 0.607791)
(9.77575 0 0.738876)
(9.69662 0 0.876689)
(9.60622 0 1.02263)
(9.50463 0 1.1781)
(9.39184 0 1.34449)
(9.2678 0 1.52322)
(9.13241 0 1.71575)
(8.98546 0 1.92356)
(8.82667 0 2.14823)
(8.65562 0 2.39141)
(8.47167 0 2.65485)
(8.27392 0 2.94043)
(8.06109 0 3.25022)
(7.83129 0 3.58655)
(7.58184 0 3.95202)
(7.30887 0 4.34967)
(7.00676 0 4.78298)
(6.66738 0 5.25593)
(6.2787 0 5.7728)
(5.82275 0 6.33759)
(5.27285 0 6.95239)
(4.58497 0 7.61376)
(3.71044 0 8.30127)
(2.48859 0 8.95888)
(1.12471 0 9.2942)
(9.99501 0 0.12721)
(9.97838 0 0.252883)
(9.94891 0 0.379019)
(9.90779 0 0.507484)
(9.85598 0 0.639904)
(9.79381 0 0.777797)
(9.72142 0 0.922631)
(9.63892 0 1.07585)
(9.54646 0 1.23888)
(9.44411 0 1.41315)
(9.33193 0 1.60013)
(9.20993 0 1.80132)
(9.07803 0 2.01829)
(8.93612 0 2.25269)
(8.78395 0 2.50631)
(8.62114 0 2.78109)
(8.44707 0 3.07918)
(8.2608 0 3.40306)
(8.06095 0 3.75562)
(7.84547 0 4.14033)
(7.61136 0 4.56148)
(7.35416 0 5.0245)
(7.06728 0 5.53631)
(6.74061 0 6.10593)
(6.35822 0 6.74507)
(5.89449 0 7.46882)
(5.30134 0 8.29637)
(4.50955 0 9.2483)
(3.26953 0 10.3427)
(1.60547 0 11.3607)
(9.99545 0 0.13305)
(9.98026 0 0.264503)
(9.95339 0 0.396441)
(9.91595 0 0.530787)
(9.86887 0 0.669196)
(9.81252 0 0.813208)
(9.74707 0 0.964316)
(9.6727 0 1.12398)
(9.58961 0 1.29367)
(9.498 0 1.47482)
(9.398 0 1.66893)
(9.28975 0 1.87753)
(9.17334 0 2.10225)
(9.04882 0 2.34478)
(8.9162 0 2.60702)
(8.77535 0 2.89102)
(8.62603 0 3.19916)
(8.4678 0 3.53417)
(8.29992 0 3.89938)
(8.12128 0 4.29887)
(7.93015 0 4.73787)
(7.724 0 5.22321)
(7.49898 0 5.76413)
(7.24922 0 6.37346)
(6.96523 0 7.06963)
(6.6315 0 7.8805)
(6.21524 0 8.85156)
(5.66703 0 10.0659)
(4.69169 0 11.7318)
(2.68859 0 14.5952)
(0.130891 0 -0.133896)
(0.303766 0 -0.12066)
(0.482434 0 -0.0964077)
(0.635099 0 -0.0743811)
(0.757332 0 -0.0567308)
(0.854468 0 -0.0430336)
(0.932692 0 -0.0325604)
(0.996795 0 -0.0246827)
(1.05033 0 -0.0188596)
(1.09605 0 -0.0146179)
(1.1361 0 -0.0115487)
(1.17207 0 -0.00929607)
(1.20499 0 -0.0075463)
(1.23536 0 -0.00603199)
(1.26318 0 -0.00455555)
(1.28814 0 -0.00301751)
(1.30981 0 -0.00141479)
(1.32784 0 0.000226285)
(1.34196 0 0.00196402)
(1.35169 0 0.00397438)
(1.35615 0 0.00630886)
(1.3547 0 0.00846419)
(1.34699 0 0.0100342)
(1.33461 0 0.0105136)
(1.32091 0 0.00971743)
(1.30906 0 0.00806658)
(1.30052 0 0.00601223)
(1.29546 0 0.00366361)
(1.29451 0 0.00118653)
(1.3002 0 -0.00130246)
(0.10686 0 -0.300933)
(0.272994 0 -0.281659)
(0.436439 0 -0.231688)
(0.578552 0 -0.184724)
(0.69615 0 -0.146879)
(0.793898 0 -0.117473)
(0.87678 0 -0.0949764)
(0.948551 0 -0.0780326)
(1.01196 0 -0.065469)
(1.06914 0 -0.0562664)
(1.12174 0 -0.0495484)
(1.17101 0 -0.0445521)
(1.21781 0 -0.0406005)
(1.26263 0 -0.0371101)
(1.3056 0 -0.0336423)
(1.3466 0 -0.0299748)
(1.38538 0 -0.0261201)
(1.42174 0 -0.0222042)
(1.45576 0 -0.01821)
(1.48756 0 -0.0138244)
(1.51692 0 -0.00875511)
(1.54246 0 -0.00341712)
(1.56321 0 0.0010841)
(1.5795 0 0.0036161)
(1.59351 0 0.0039269)
(1.60779 0 0.00296274)
(1.62349 0 0.00162608)
(1.6407 0 -5.42316e-05)
(1.65855 0 -0.00203846)
(1.67931 0 -0.00344553)
(0.0812792 0 -0.46875)
(0.220435 0 -0.440469)
(0.346712 0 -0.365222)
(0.456322 0 -0.294628)
(0.546448 0 -0.237941)
(0.621745 0 -0.193791)
(0.685953 0 -0.15983)
(0.74176 0 -0.134007)
(0.791177 0 -0.114594)
(0.835768 0 -0.100126)
(0.876772 0 -0.0893549)
(0.915143 0 -0.0811954)
(0.951566 0 -0.0746773)
(0.986457 0 -0.0689501)
(1.01996 0 -0.0633523)
(1.05195 0 -0.0575306)
(1.08215 0 -0.0515124)
(1.11029 0 -0.0455864)
(1.13646 0 -0.0398928)
(1.16116 0 -0.0339531)
(1.18492 0 -0.0267257)
(1.20747 0 -0.0178832)
(1.22741 0 -0.00971913)
(1.2433 0 -0.00560487)
(1.25574 0 -0.00612393)
(1.26691 0 -0.009196)
(1.27755 0 -0.0127965)
(1.28712 0 -0.0161336)
(1.29541 0 -0.0186903)
(1.30522 0 -0.0183704)
(0.0573586 0 -0.595404)
(0.162173 0 -0.552333)
(0.243391 0 -0.454643)
(0.314683 0 -0.365954)
(0.370705 0 -0.296004)
(0.417187 0 -0.241789)
(0.456238 0 -0.200146)
(0.489435 0 -0.168421)
(0.518032 0 -0.144472)
(0.543036 0 -0.126535)
(0.565253 0 -0.113125)
(0.585328 0 -0.102945)
(0.603777 0 -0.0948334)
(0.620997 0 -0.0877547)
(0.637234 0 -0.0808662)
(0.652523 0 -0.0736635)
(0.66651 0 -0.0661234)
(0.678634 0 -0.058677)
(0.688422 0 -0.0518162)
(0.696578 0 -0.0455817)
(0.70474 0 -0.0392448)
(0.714327 0 -0.0318224)
(0.722601 0 -0.023277)
(0.721976 0 -0.015193)
(0.710185 0 -0.00978316)
(0.693711 0 -0.00693816)
(0.676282 0 -0.00525379)
(0.657268 0 -0.00505345)
(0.6378 0 -0.00697181)
(0.618538 0 -0.00793209)
(0.0329646 0 -0.683409)
(0.0971597 0 -0.620452)
(0.127687 0 -0.503592)
(0.157728 0 -0.402656)
(0.175074 0 -0.324481)
(0.188192 0 -0.264071)
(0.196901 0 -0.217661)
(0.202026 0 -0.1822)
(0.204252 0 -0.155311)
(0.204159 0 -0.135079)
(0.202189 0 -0.119911)
(0.198719 0 -0.108429)
(0.194157 0 -0.0993837)
(0.188945 0 -0.0916298)
(0.183513 0 -0.0841793)
(0.178187 0 -0.0763266)
(0.172581 0 -0.0678326)
(0.166155 0 -0.0589715)
(0.156653 0 -0.050162)
(0.143679 0 -0.0412838)
(0.125585 0 -0.0311889)
(0.106231 0 -0.0187661)
(0.0846616 0 -0.00537915)
(0.0672829 0 0.00436788)
(0.0544329 0 0.00745585)
(0.0436057 0 0.0060098)
(0.0391157 0 0.00335012)
(0.0363875 0 5.45998e-05)
(0.0331015 0 -0.00373136)
(0.0238547 0 -0.0124966)
(0.00694721 0 -0.726358)
(0.0250622 0 -0.63959)
(0.00250284 0 -0.506802)
(-0.0114694 0 -0.398776)
(-0.0356813 0 -0.316138)
(-0.0596379 0 -0.252943)
(-0.0854543 0 -0.204735)
(-0.112205 0 -0.168195)
(-0.13943 0 -0.140688)
(-0.166725 0 -0.120113)
(-0.193828 0 -0.104782)
(-0.220503 0 -0.0932699)
(-0.246482 0 -0.0842922)
(-0.271491 0 -0.0767051)
(-0.295245 0 -0.0695734)
(-0.317412 0 -0.0622354)
(-0.337664 0 -0.0543687)
(-0.355799 0 -0.0459938)
(-0.371844 0 -0.0373644)
(-0.385882 0 -0.028688)
(-0.398025 0 -0.0200106)
(-0.407778 0 -0.0113753)
(-0.414929 0 -0.00354574)
(-0.419946 0 0.00188512)
(-0.425807 0 0.00405786)
(-0.43276 0 0.00314885)
(-0.438888 0 0.00165255)
(-0.444317 0 0.000978665)
(-0.450414 0 -0.00075709)
(-0.458249 0 -0.00590683)
(-0.023071 0 -0.717115)
(-0.0557509 0 -0.603192)
(-0.129494 0 -0.463754)
(-0.190509 0 -0.356745)
(-0.255288 0 -0.274489)
(-0.317286 0 -0.212941)
(-0.376177 0 -0.166999)
(-0.431114 0 -0.133039)
(-0.481647 0 -0.108278)
(-0.527585 0 -0.0905214)
(-0.569026 0 -0.0779728)
(-0.606285 0 -0.0691381)
(-0.639764 0 -0.062703)
(-0.669868 0 -0.0575378)
(-0.696907 0 -0.0527754)
(-0.721021 0 -0.0478302)
(-0.742197 0 -0.042383)
(-0.760404 0 -0.0363032)
(-0.775726 0 -0.0295446)
(-0.788422 0 -0.0221087)
(-0.798825 0 -0.0140745)
(-0.807013 0 -0.00576726)
(-0.813428 0 0.00181489)
(-0.81795 0 0.00693593)
(-0.823087 0 0.00900323)
(-0.829261 0 0.0086328)
(-0.835934 0 0.00706251)
(-0.842601 0 0.00456227)
(-0.849167 0 0.000205361)
(-0.853887 0 -0.00533673)
(-0.0591821 0 -0.651943)
(-0.142641 0 -0.518507)
(-0.265266 0 -0.37977)
(-0.371128 0 -0.27606)
(-0.473116 0 -0.20016)
(-0.56558 0 -0.146198)
(-0.64774 0 -0.108307)
(-0.719628 0 -0.0820677)
(-0.78203 0 -0.0643181)
(-0.836133 0 -0.0528108)
(-0.883108 0 -0.0456709)
(-0.924065 0 -0.0414072)
(-0.959957 0 -0.0387876)
(-0.991595 0 -0.0368156)
(-1.01964 0 -0.0348073)
(-1.0445 0 -0.0323614)
(-1.06637 0 -0.0293017)
(-1.08526 0 -0.0255485)
(-1.10121 0 -0.0209906)
(-1.11438 0 -0.0154982)
(-1.12514 0 -0.0090872)
(-1.1339 0 -0.00211922)
(-1.14063 0 0.00437214)
(-1.14642 0 0.00926818)
(-1.1523 0 0.0116733)
(-1.15868 0 0.0117645)
(-1.16564 0 0.010465)
(-1.17319 0 0.00803715)
(-1.18062 0 0.00384738)
(-1.18434 0 -0.000846943)
(-0.101823 0 -0.528538)
(-0.238306 0 -0.384042)
(-0.410871 0 -0.255731)
(-0.555744 0 -0.166538)
(-0.686414 0 -0.104705)
(-0.799785 0 -0.0637911)
(-0.896449 0 -0.038222)
(-0.97794 0 -0.0232982)
(-1.04472 0 -0.0157273)
(-1.10039 0 -0.0124214)
(-1.14761 0 -0.0116605)
(-1.18851 0 -0.0123853)
(-1.22463 0 -0.0137976)
(-1.25666 0 -0.0152165)
(-1.28509 0 -0.0160637)
(-1.31044 0 -0.0160756)
(-1.33295 0 -0.0152831)
(-1.35257 0 -0.0137341)
(-1.36922 0 -0.0112789)
(-1.38302 0 -0.00763994)
(-1.39441 0 -0.00274257)
(-1.40382 0 0.00295708)
(-1.41156 0 0.00847915)
(-1.41888 0 0.0128166)
(-1.42611 0 0.0151188)
(-1.43354 0 0.0153471)
(-1.44145 0 0.0141045)
(-1.45014 0 0.0116087)
(-1.45869 0 0.00766766)
(-1.46341 0 0.00384939)
(-0.156804 0 -0.346409)
(-0.359488 0 -0.204719)
(-0.597969 0 -0.0882364)
(-0.786225 0 -0.0165077)
(-0.936238 0 0.0189941)
(-1.05526 0 0.0347635)
(-1.14961 0 0.0393036)
(-1.22507 0 0.0375556)
(-1.28761 0 0.0329848)
(-1.33985 0 0.02732)
(-1.38414 0 0.0214163)
(-1.42213 0 0.0156046)
(-1.45498 0 0.0101351)
(-1.48395 0 0.00546097)
(-1.5101 0 0.0020013)
(-1.53398 0 -0.000226545)
(-1.55567 0 -0.00152208)
(-1.57491 0 -0.00209098)
(-1.5914 0 -0.00172439)
(-1.60518 0 6.72617e-05)
(-1.61664 0 0.00355165)
(-1.62648 0 0.00832714)
(-1.63578 0 0.0133839)
(-1.64488 0 0.0174702)
(-1.65389 0 0.0196515)
(-1.66287 0 0.0198418)
(-1.67212 0 0.0185551)
(-1.68204 0 0.0160895)
(-1.6914 0 0.0125168)
(-1.69624 0 0.00927829)
(-0.233927 0 -0.0781329)
(-0.491207 0 0.0807825)
(-0.746487 0 0.131504)
(-0.938074 0 0.142324)
(-1.09241 0 0.138038)
(-1.21569 0 0.125838)
(-1.31452 0 0.110466)
(-1.39429 0 0.0943759)
(-1.45929 0 0.0788834)
(-1.51307 0 0.0648697)
(-1.5586 0 0.0526858)
(-1.59791 0 0.0420732)
(-1.63216 0 0.0328234)
(-1.6622 0 0.0251736)
(-1.68899 0 0.0194083)
(-1.71339 0 0.015322)
(-1.73568 0 0.012249)
(-1.7555 0 0.00971389)
(-1.77232 0 0.00799568)
(-1.7862 0 0.00794276)
(-1.79798 0 0.0101591)
(-1.8088 0 0.0143208)
(-1.81956 0 0.0191754)
(-1.83051 0 0.0231523)
(-1.84141 0 0.0251656)
(-1.85198 0 0.0250955)
(-1.86244 0 0.0235355)
(-1.87322 0 0.0210056)
(-1.88304 0 0.0177947)
(-1.88787 0 0.0151012)
(-0.283198 0 0.306892)
(-0.569158 0 0.362229)
(-0.857252 0 0.346254)
(-1.07122 0 0.30932)
(-1.23662 0 0.266849)
(-1.36394 0 0.2251)
(-1.46323 0 0.18751)
(-1.54201 0 0.154877)
(-1.60544 0 0.126962)
(-1.65757 0 0.103885)
(-1.7019 0 0.0853219)
(-1.74066 0 0.0699445)
(-1.7747 0 0.0566567)
(-1.80452 0 0.0455854)
(-1.83122 0 0.0372842)
(-1.85605 0 0.031422)
(-1.87939 0 0.0267226)
(-1.90043 0 0.0221808)
(-1.91811 0 0.0181445)
(-1.9323 0 0.0160645)
(-1.94417 0 0.017091)
(-1.95546 0 0.0209128)
(-1.96735 0 0.0258603)
(-1.97998 0 0.0298947)
(-1.99269 0 0.0316624)
(-2.00475 0 0.031053)
(-2.01622 0 0.0289313)
(-2.02765 0 0.0262042)
(-2.03779 0 0.023341)
(-2.04263 0 0.021182)
(-0.336433 0 0.71089)
(-0.680423 0 0.701747)
(-1.00728 0 0.593819)
(-1.22938 0 0.486934)
(-1.39137 0 0.397058)
(-1.51146 0 0.321411)
(-1.6028 0 0.260318)
(-1.67468 0 0.211639)
(-1.7323 0 0.171922)
(-1.77943 0 0.14034)
(-1.82015 0 0.116369)
(-1.85701 0 0.097211)
(-1.89004 0 0.0802466)
(-1.91883 0 0.0656749)
(-1.94454 0 0.0549351)
(-1.96919 0 0.0477676)
(-1.99343 0 0.0419052)
(-2.01574 0 0.0353764)
(-2.03404 0 0.0285908)
(-2.04786 0 0.0240389)
(-2.05898 0 0.023847)
(-2.07006 0 0.0277158)
(-2.08278 0 0.0332437)
(-2.09712 0 0.0376346)
(-2.11179 0 0.0391405)
(-2.12543 0 0.0377168)
(-2.13783 0 0.0347118)
(-2.1497 0 0.0316262)
(-2.16 0 0.0290953)
(-2.16484 0 0.0274603)
(-0.441693 0 1.21173)
(-0.871366 0 1.10092)
(-1.22662 0 0.855615)
(-1.42751 0 0.653834)
(-1.56377 0 0.514542)
(-1.66265 0 0.404354)
(-1.73572 0 0.321983)
(-1.79413 0 0.26162)
(-1.84201 0 0.212326)
(-1.88087 0 0.172369)
(-1.91548 0 0.143886)
(-1.94945 0 0.122456)
(-1.9812 0 0.102387)
(-2.00814 0 0.0841666)
(-2.03154 0 0.0712995)
(-2.05507 0 0.0639691)
(-2.08011 0 0.0580577)
(-2.10402 0 0.0497322)
(-2.12286 0 0.0394591)
(-2.13546 0 0.0315864)
(-2.14465 0 0.0300643)
(-2.15471 0 0.0345632)
(-2.16807 0 0.041384)
(-2.18435 0 0.0465414)
(-2.20133 0 0.0477568)
(-2.21674 0 0.0451332)
(-2.22993 0 0.0407761)
(-2.2419 0 0.0370935)
(-2.25213 0 0.0349015)
(-2.25691 0 0.0337916)
(-0.654113 0 2.14886)
(-1.18301 0 1.73761)
(-1.55623 0 1.14601)
(-1.68148 0 0.751265)
(-1.75416 0 0.594248)
(-1.81647 0 0.469)
(-1.8586 0 0.373277)
(-1.89764 0 0.306023)
(-1.93506 0 0.245742)
(-1.96343 0 0.194053)
(-1.98845 0 0.164197)
(-2.01842 0 0.146625)
(-2.0493 0 0.126176)
(-2.07369 0 0.103683)
(-2.09287 0 0.087665)
(-2.11403 0 0.0807977)
(-2.14034 0 0.0756317)
(-2.16708 0 0.0650342)
(-2.18687 0 0.0495973)
(-2.1972 0 0.0368913)
(-2.20277 0 0.0340412)
(-2.21073 0 0.0404169)
(-2.22461 0 0.0498707)
(-2.24331 0 0.0565549)
(-2.2632 0 0.0575655)
(-2.28065 0 0.0532912)
(-2.29441 0 0.0469461)
(-2.30594 0 0.0423535)
(-2.31574 0 0.0406208)
(-2.32041 0 0.0401109)
(9.9959 0 0.138445)
(9.98225 0 0.275238)
(9.9581 0 0.412524)
(9.92453 0 0.552272)
(9.88241 0 0.696159)
(9.83215 0 0.845737)
(9.77397 0 1.00251)
(9.70813 0 1.16796)
(9.6349 0 1.34354)
(9.55455 0 1.53073)
(9.46736 0 1.731)
(9.37359 0 1.94592)
(9.27351 0 2.1771)
(9.16737 0 2.42629)
(9.05543 0 2.69541)
(8.9379 0 2.98658)
(8.81498 0 3.30226)
(8.6868 0 3.64534)
(8.55344 0 4.01934)
(8.41491 0 4.42863)
(8.27112 0 4.87884)
(8.12198 0 5.37745)
(7.96743 0 5.93463)
(7.80776 0 6.56472)
(7.64419 0 7.28882)
(7.48173 0 8.13951)
(7.33371 0 9.1708)
(7.29039 0 10.4763)
(7.75051 0 12.2009)
(7.93619 0 14.9205)
(9.99638 0 0.143405)
(9.98434 0 0.285093)
(9.96305 0 0.427253)
(9.93351 0 0.571883)
(9.89655 0 0.720676)
(9.85261 0 0.875187)
(9.80195 0 1.03693)
(9.7449 0 1.20737)
(9.68181 0 1.38797)
(9.61305 0 1.58018)
(9.53902 0 1.78549)
(9.46013 0 2.00543)
(9.37681 0 2.24159)
(9.28956 0 2.49572)
(9.19888 0 2.76969)
(9.10536 0 3.06562)
(9.00965 0 3.38593)
(8.91251 0 3.73348)
(8.81484 0 4.11171)
(8.71783 0 4.52489)
(8.62309 0 4.97842)
(8.53299 0 5.47934)
(8.45126 0 6.03697)
(8.38416 0 6.66388)
(8.34289 0 7.3773)
(8.34956 0 8.20061)
(8.44308 0 9.16395)
(8.67944 0 10.3005)
(9.32759 0 11.5547)
(9.81953 0 12.6409)
(9.99688 0 0.147843)
(9.9865 0 0.293906)
(9.96819 0 0.440405)
(9.94282 0 0.589355)
(9.9112 0 0.742451)
(9.87376 0 0.901244)
(9.83083 0 1.06723)
(9.7828 0 1.24187)
(9.73009 0 1.42659)
(9.67318 0 1.62283)
(9.61257 0 1.83201)
(9.54881 0 2.05564)
(9.48253 0 2.29526)
(9.41442 0 2.55252)
(9.34529 0 2.82924)
(9.27605 0 3.1274)
(9.2078 0 3.44929)
(9.14188 0 3.79753)
(9.07998 0 4.17524)
(9.02432 0 4.58618)
(8.97792 0 5.03494)
(8.94505 0 5.52721)
(8.93202 0 6.06995)
(8.94835 0 6.67155)
(9.00854 0 7.34143)
(9.13475 0 8.08821)
(9.35799 0 8.91369)
(9.68773 0 9.80664)
(10.2536 0 10.7155)
(10.9413 0 11.4298)
(9.9974 0 0.151705)
(9.98873 0 0.301568)
(9.97346 0 0.451813)
(9.95238 0 0.604456)
(9.92621 0 0.761184)
(9.89542 0 0.923532)
(9.86038 0 1.09297)
(9.82153 0 1.27093)
(9.77937 0 1.4588)
(9.73446 0 1.65796)
(9.6874 0 1.86979)
(9.63889 0 2.0957)
(9.58972 0 2.33714)
(9.54079 0 2.59567)
(9.49314 0 2.87293)
(9.44801 0 3.17072)
(9.40688 0 3.49104)
(9.37159 0 3.83617)
(9.34442 0 4.20866)
(9.32836 0 4.61151)
(9.32733 0 5.04809)
(9.34664 0 5.52226)
(9.39353 0 6.03812)
(9.47791 0 6.59964)
(9.61298 0 7.20956)
(9.81558 0 7.86753)
(10.1084 0 8.5664)
(10.5002 0 9.29146)
(11.0576 0 10.0325)
(11.8505 0 10.6765)
(9.99792 0 0.154945)
(9.99101 0 0.307988)
(9.97884 0 0.461342)
(9.96211 0 0.61701)
(9.94148 0 0.776657)
(9.91743 0 0.941791)
(9.89036 0 1.11385)
(9.86077 0 1.2942)
(9.82922 0 1.4842)
(9.79633 0 1.68514)
(9.76283 0 1.89833)
(9.72952 0 2.12507)
(9.69733 0 2.36669)
(9.66733 0 2.62457)
(9.64077 0 2.90015)
(9.61915 0 3.19498)
(9.60423 0 3.5107)
(9.59819 0 3.84909)
(9.60374 0 4.21207)
(9.62425 0 4.60168)
(9.66405 0 5.02002)
(9.72866 0 5.46909)
(9.82516 0 5.95051)
(9.96249 0 6.46495)
(10.1517 0 7.01133)
(10.4059 0 7.58576)
(10.7423 0 8.18009)
(11.1725 0 8.77962)
(11.7196 0 9.37276)
(12.4722 0 9.88466)
(9.99845 0 0.157519)
(9.9933 0 0.31308)
(9.98426 0 0.468865)
(9.97193 0 0.62685)
(9.95688 0 0.788666)
(9.93958 0 0.955781)
(9.9205 0 1.12958)
(9.90016 0 1.31138)
(9.87918 0 1.50245)
(9.85824 0 1.70402)
(9.83814 0 1.91726)
(9.81979 0 2.14337)
(9.80423 0 2.38351)
(9.79265 0 2.63887)
(9.78646 0 2.91066)
(9.78731 0 3.20008)
(9.79718 0 3.50838)
(9.81843 0 3.83682)
(9.85392 0 4.18661)
(9.90714 0 4.55886)
(9.98237 0 4.95449)
(10.0848 0 5.37395)
(10.2209 0 5.81697)
(10.398 0 6.2821)
(10.6251 0 6.76607)
(10.9117 0 7.26311)
(11.2692 0 7.76397)
(11.7054 0 8.2531)
(12.2211 0 8.71381)
(12.8963 0 9.1046)
(9.99898 0 0.159389)
(9.9956 0 0.316767)
(9.9897 0 0.47427)
(9.98175 0 0.633829)
(9.97226 0 0.797031)
(9.9617 0 0.965291)
(9.95055 0 1.13993)
(9.93936 0 1.3222)
(9.92879 0 1.51329)
(9.91958 0 1.7143)
(9.91259 0 1.92631)
(9.90878 0 2.15035)
(9.90927 0 2.38742)
(9.91534 0 2.63848)
(9.92849 0 2.90446)
(9.95045 0 3.18625)
(9.98327 0 3.48467)
(10.0294 0 3.80044)
(10.0915 0 4.13411)
(10.1731 0 4.48599)
(10.2781 0 4.85596)
(10.4111 0 5.24333)
(10.5774 0 5.64652)
(10.7828 0 6.06271)
(11.0339 0 6.48741)
(11.337 0 6.91394)
(11.6982 0 7.33293)
(12.1217 0 7.73098)
(12.6012 0 8.09352)
(13.2061 0 8.40006)
(9.99951 0 0.160521)
(9.99788 0 0.318983)
(9.99509 0 0.477459)
(9.99149 0 0.637821)
(9.9875 0 0.801601)
(9.98358 0 0.970149)
(9.98022 0 1.14472)
(9.978 0 1.32648)
(9.97759 0 1.5165)
(9.97978 0 1.7158)
(9.98543 0 1.92531)
(9.99557 0 2.1459)
(10.0113 0 2.37838)
(10.0341 0 2.62349)
(10.0653 0 2.88187)
(10.1067 0 3.15409)
(10.1603 0 3.44055)
(10.2285 0 3.7415)
(10.3138 0 4.05691)
(10.4193 0 4.38641)
(10.5485 0 4.72913)
(10.7051 0 5.08355)
(10.8933 0 5.44727)
(11.1174 0 5.81678)
(11.3816 0 6.18718)
(11.6899 0 6.5519)
(12.0449 0 6.90267)
(12.4482 0 7.22918)
(12.8921 0 7.5203)
(13.4347 0 7.76474)
(10 0 0.160887)
(10.0001 0 0.319673)
(10.0004 0 0.478352)
(10.0011 0 0.638725)
(10.0025 0 0.802257)
(10.005 0 0.970227)
(10.0093 0 1.1438)
(10.0157 0 1.32406)
(10.0251 0 1.51198)
(10.0382 0 1.70844)
(10.056 0 1.91423)
(10.0793 0 2.13007)
(10.1094 0 2.35657)
(10.1476 0 2.59423)
(10.1954 0 2.84345)
(10.2543 0 3.10447)
(10.3264 0 3.37735)
(10.4137 0 3.66189)
(10.5187 0 3.95762)
(10.6438 0 4.26366)
(10.7919 0 4.57861)
(10.966 0 4.90045)
(11.1691 0 5.2264)
(11.4041 0 5.55275)
(11.6737 0 5.87474)
(11.9796 0 6.18652)
(12.3228 0 6.48124)
(12.7029 0 6.75107)
(13.1123 0 6.98766)
(13.5997 0 7.18419)
(10.0005 0 0.160465)
(10.0023 0 0.318794)
(10.0056 0 0.476889)
(10.0104 0 0.636468)
(10.017 0 0.798918)
(10.0259 0 0.965438)
(10.0374 0 1.13711)
(10.0522 0 1.31491)
(10.071 0 1.4997)
(10.0944 0 1.69223)
(10.1235 0 1.89317)
(10.1592 0 2.10306)
(10.2026 0 2.32232)
(10.2549 0 2.55125)
(10.3175 0 2.79)
(10.3921 0 3.03853)
(10.4802 0 3.2966)
(10.5838 0 3.5637)
(10.7048 0 3.83898)
(10.8454 0 4.12123)
(11.0077 0 4.40875)
(11.194 0 4.69929)
(11.4064 0 4.98997)
(11.6465 0 5.2772)
(11.9157 0 5.55671)
(12.2146 0 5.82351)
(12.5428 0 6.07208)
(12.8989 0 6.29653)
(13.2758 0 6.49082)
(13.7154 0 6.6508)
(10.001 0 0.15924)
(10.0044 0 0.316318)
(10.0106 0 0.473031)
(10.0194 0 0.631003)
(10.0311 0 0.791536)
(10.0459 0 0.955744)
(10.0644 0 1.12461)
(10.0871 0 1.29901)
(10.1147 0 1.4797)
(10.1479 0 1.66731)
(10.1875 0 1.86235)
(10.2345 0 2.0652)
(10.29 0 2.27613)
(10.355 0 2.49525)
(10.4308 0 2.72247)
(10.5189 0 2.95756)
(10.6206 0 3.20001)
(10.7376 0 3.44908)
(10.8715 0 3.70371)
(11.0239 0 3.96246)
(11.1964 0 4.2235)
(11.3905 0 4.48456)
(11.6075 0 4.74286)
(11.8483 0 4.99514)
(12.1133 0 5.23769)
(12.4022 0 5.46642)
(12.7139 0 5.677)
(13.0465 0 5.86508)
(13.3938 0 6.02643)
(13.7923 0 6.15854)
(10.0015 0 0.157205)
(10.0065 0 0.31223)
(10.0154 0 0.466759)
(10.028 0 0.622313)
(10.0444 0 0.780105)
(10.065 0 0.941155)
(10.09 0 1.10635)
(10.1202 0 1.27647)
(10.156 0 1.45214)
(10.1982 0 1.63388)
(10.2475 0 1.82207)
(10.3047 0 2.01695)
(10.371 0 2.21863)
(10.4472 0 2.42705)
(10.5344 0 2.64197)
(10.634 0 2.86295)
(10.747 0 3.08934)
(10.8748 0 3.32023)
(11.0185 0 3.55441)
(11.1794 0 3.79038)
(11.3586 0 4.02632)
(11.557 0 4.26001)
(11.7753 0 4.48895)
(12.0136 0 4.71027)
(12.2717 0 4.92087)
(12.549 0 5.11746)
(12.8438 0 5.29674)
(13.1542 0 5.45555)
(13.4749 0 5.59097)
(13.8381 0 5.7015)
(10.0019 0 0.154359)
(10.0084 0 0.30653)
(10.0199 0 0.458077)
(10.0361 0 0.610412)
(10.0571 0 0.764652)
(10.0829 0 0.921724)
(10.1142 0 1.08242)
(10.1512 0 1.24741)
(10.1946 0 1.41721)
(10.2449 0 1.59224)
(10.3029 0 1.77275)
(10.3694 0 1.95886)
(10.4451 0 2.15054)
(10.531 0 2.34759)
(10.628 0 2.54966)
(10.7371 0 2.75616)
(10.8592 0 2.96635)
(10.9952 0 3.17921)
(11.1462 0 3.3935)
(11.3129 0 3.60773)
(11.4959 0 3.82015)
(11.6958 0 4.02874)
(11.9126 0 4.23128)
(12.1461 0 4.42535)
(12.3959 0 4.6084)
(12.6607 0 4.77786)
(12.939 0 4.93124)
(13.2288 0 5.06629)
(13.5257 0 5.18101)
(13.8586 0 5.27455)
(10.0024 0 0.150706)
(10.0102 0 0.29923)
(10.0241 0 0.447008)
(10.0438 0 0.595339)
(10.0689 0 0.745242)
(10.0997 0 0.89755)
(10.1366 0 1.05296)
(10.1799 0 1.21203)
(10.2301 0 1.37521)
(10.2879 0 1.54277)
(10.3536 0 1.71489)
(10.4282 0 1.89156)
(10.5121 0 2.07265)
(10.6063 0 2.25787)
(10.7113 0 2.44674)
(10.828 0 2.63864)
(10.9572 0 2.83273)
(11.0994 0 3.02798)
(11.2554 0 3.22317)
(11.4254 0 3.41688)
(11.61 0 3.6075)
(11.8091 0 3.79323)
(12.0225 0 3.97218)
(12.2499 0 4.14232)
(12.4903 0 4.30163)
(12.7425 0 4.44811)
(13.005 0 4.57994)
(13.276 0 4.6955)
(13.5515 0 4.79348)
(13.8581 0 4.87343)
(10.0027 0 0.146261)
(10.0119 0 0.290357)
(10.0281 0 0.433595)
(10.0508 0 0.577161)
(10.0798 0 0.721972)
(10.1152 0 0.86877)
(10.1572 0 1.01816)
(10.2062 0 1.1706)
(10.2626 0 1.32645)
(10.3268 0 1.4859)
(10.3994 0 1.64902)
(10.4809 0 1.81573)
(10.5718 0 1.9858)
(10.6728 0 2.15888)
(10.7844 0 2.33443)
(10.9071 0 2.51178)
(11.0415 0 2.69008)
(11.188 0 2.86833)
(11.3469 0 3.04536)
(11.5185 0 3.21987)
(11.7027 0 3.39041)
(11.8994 0 3.55545)
(12.1081 0 3.71336)
(12.3283 0 3.86253)
(12.5589 0 4.00134)
(12.7988 0 4.1283)
(13.0464 0 4.24204)
(13.3001 0 4.34147)
(13.5568 0 4.42571)
(13.8404 0 4.4946)
(10.0031 0 0.141041)
(10.0134 0 0.279948)
(10.0317 0 0.417901)
(10.0573 0 0.555967)
(10.0898 0 0.694969)
(10.1293 0 0.835555)
(10.1759 0 0.978242)
(10.23 0 1.12341)
(10.2918 0 1.27133)
(10.3618 0 1.42211)
(10.4402 0 1.57574)
(10.5276 0 1.73208)
(10.6243 0 1.89085)
(10.7308 0 2.05164)
(10.8474 0 2.21389)
(10.9747 0 2.37691)
(11.1127 0 2.53989)
(11.2618 0 2.70186)
(11.4222 0 2.86175)
(11.5936 0 3.0184)
(11.7761 0 3.17056)
(11.9692 0 3.3169)
(12.1723 0 3.4561)
(12.3848 0 3.58686)
(12.6056 0 3.70793)
(12.8336 0 3.81818)
(13.0673 0 3.91665)
(13.3054 0 4.00256)
(13.5451 0 4.07538)
(13.8086 0 4.1351)
(10.0034 0 0.13507)
(10.0148 0 0.268053)
(10.035 0 0.400001)
(10.0631 0 0.531868)
(10.0988 0 0.664383)
(10.142 0 0.798106)
(10.1927 0 0.933473)
(10.2513 0 1.07079)
(10.3178 0 1.21024)
(10.3927 0 1.35189)
(10.4761 0 1.49565)
(10.5683 0 1.64134)
(10.6697 0 1.78864)
(10.7805 0 1.93712)
(10.901 0 2.08621)
(11.0313 0 2.23525)
(11.1717 0 2.38346)
(11.3221 0 2.52995)
(11.4825 0 2.67377)
(11.6527 0 2.81389)
(11.8324 0 2.94924)
(12.021 0 3.07873)
(12.218 0 3.20127)
(12.4226 0 3.31584)
(12.6337 0 3.42148)
(12.8503 0 3.51736)
(13.0712 0 3.6028)
(13.2951 0 3.67728)
(13.5197 0 3.74047)
(13.7655 0 3.79248)
(10.0037 0 0.128375)
(10.0161 0 0.254727)
(10.0379 0 0.379984)
(10.0684 0 0.50499)
(10.1069 0 0.630383)
(10.1533 0 0.756643)
(10.2076 0 0.884129)
(10.27 0 1.01308)
(10.3406 0 1.14362)
(10.4196 0 1.27575)
(10.5071 0 1.40935)
(10.6033 0 1.54421)
(10.7083 0 1.67998)
(10.8224 0 1.81623)
(10.9456 0 1.95241)
(11.078 0 2.08789)
(11.2195 0 2.22195)
(11.3701 0 2.3538)
(11.5295 0 2.4826)
(11.6975 0 2.60746)
(11.8736 0 2.72747)
(12.0573 0 2.84176)
(12.2479 0 2.94944)
(12.4445 0 3.04972)
(12.6463 0 3.14189)
(12.8523 0 3.22531)
(13.0613 0 3.29954)
(13.2723 0 3.36423)
(13.4834 0 3.4192)
(13.7136 0 3.46461)
(10.004 0 0.120989)
(10.0172 0 0.240034)
(10.0405 0 0.357948)
(10.0731 0 0.475471)
(10.114 0 0.593152)
(10.1632 0 0.7114)
(10.2206 0 0.830504)
(10.2864 0 0.950643)
(10.3604 0 1.07189)
(10.4427 0 1.1942)
(10.5335 0 1.31744)
(10.6328 0 1.44136)
(10.7407 0 1.56562)
(10.8571 0 1.6898)
(10.982 0 1.81338)
(11.1154 0 1.93578)
(11.2572 0 2.05634)
(11.4071 0 2.17439)
(11.5648 0 2.28918)
(11.7299 0 2.39996)
(11.902 0 2.50599)
(12.0804 0 2.60655)
(12.2644 0 2.70094)
(12.4534 0 2.78856)
(12.6463 0 2.86887)
(12.8424 0 2.94143)
(13.0406 0 3.00591)
(13.2399 0 3.06213)
(13.4389 0 3.10999)
(13.6552 0 3.14968)
(10.0042 0 0.112943)
(10.0182 0 0.22404)
(10.0428 0 0.333996)
(10.0771 0 0.443453)
(10.1202 0 0.55288)
(10.1718 0 0.662616)
(10.2319 0 0.772891)
(10.3004 0 0.883833)
(10.3772 0 0.995471)
(10.4623 0 1.10774)
(10.5557 0 1.22047)
(10.6574 0 1.33342)
(10.7672 0 1.44626)
(10.8851 0 1.55858)
(11.011 0 1.66992)
(11.1447 0 1.77974)
(11.286 0 1.88747)
(11.4345 0 1.99252)
(11.5899 0 2.09425)
(11.7518 0 2.19205)
(11.9195 0 2.2853)
(12.0925 0 2.37342)
(12.2702 0 2.45588)
(12.4517 0 2.53222)
(12.6363 0 2.60204)
(12.8232 0 2.66503)
(13.0115 0 2.72098)
(13.2003 0 2.76978)
(13.3885 0 2.81141)
(13.5925 0 2.84608)
(10.0044 0 0.10427)
(10.019 0 0.206813)
(10.0448 0 0.308233)
(10.0807 0 0.409083)
(10.1256 0 0.509757)
(10.1793 0 0.610531)
(10.2415 0 0.711581)
(10.3123 0 0.812993)
(10.3914 0 0.914766)
(10.4787 0 1.01681)
(10.574 0 1.11895)
(10.6774 0 1.22096)
(10.7885 0 1.3225)
(10.9073 0 1.42322)
(11.0335 0 1.52269)
(11.1669 0 1.62044)
(11.3071 0 1.71598)
(11.4538 0 1.80878)
(11.6065 0 1.89834)
(11.7649 0 1.98413)
(11.9282 0 2.06567)
(12.0959 0 2.14249)
(12.2674 0 2.21419)
(12.4419 0 2.28042)
(12.6188 0 2.34088)
(12.7972 0 2.39537)
(12.9765 0 2.44376)
(13.156 0 2.48601)
(13.3344 0 2.52212)
(13.5276 0 2.55231)
(10.0046 0 0.095004)
(10.0198 0 0.188418)
(10.0466 0 0.280761)
(10.0837 0 0.372501)
(10.1302 0 0.463966)
(10.1856 0 0.555373)
(10.2496 0 0.64685)
(10.3222 0 0.73845)
(10.4031 0 0.830146)
(10.492 0 0.921837)
(10.5889 0 1.01335)
(10.6934 0 1.10447)
(10.8053 0 1.19488)
(10.9244 0 1.28427)
(11.0504 0 1.37225)
(11.183 0 1.45843)
(11.3218 0 1.54237)
(11.4663 0 1.62364)
(11.6162 0 1.70182)
(11.7709 0 1.77649)
(11.9298 0 1.84725)
(12.0924 0 1.91375)
(12.2581 0 1.97568)
(12.4261 0 2.03277)
(12.5959 0 2.08483)
(12.7667 0 2.13171)
(12.9379 0 2.17335)
(13.1089 0 2.20972)
(13.2788 0 2.24089)
(13.4623 0 2.26703)
(10.0047 0 0.0851711)
(10.0204 0 0.168912)
(10.0481 0 0.251671)
(10.0863 0 0.333841)
(10.1341 0 0.415682)
(10.1909 0 0.497356)
(10.2564 0 0.578952)
(10.3305 0 0.660494)
(10.4127 0 0.741937)
(10.5029 0 0.823176)
(10.6007 0 0.904048)
(10.7059 0 0.98434)
(10.8181 0 1.06379)
(10.9372 0 1.14211)
(11.0626 0 1.21897)
(11.1941 0 1.29402)
(11.3312 0 1.36691)
(11.4735 0 1.43729)
(11.6204 0 1.50479)
(11.7715 0 1.5691)
(11.9263 0 1.6299)
(12.084 0 1.68691)
(12.2442 0 1.7399)
(12.4063 0 1.78868)
(12.5696 0 1.83312)
(12.7336 0 1.87312)
(12.8976 0 1.90865)
(13.0612 0 1.93972)
(13.2234 0 1.96639)
(13.3985 0 1.98884)
(10.0049 0 0.0747924)
(10.021 0 0.148342)
(10.0494 0 0.221043)
(10.0886 0 0.293218)
(10.1374 0 0.365061)
(10.1954 0 0.43668)
(10.2621 0 0.508129)
(10.3372 0 0.579408)
(10.4205 0 0.650464)
(10.5115 0 0.721191)
(10.6099 0 0.791436)
(10.7155 0 0.861007)
(10.8278 0 0.929674)
(10.9464 0 0.997185)
(11.0711 0 1.06326)
(11.2013 0 1.12762)
(11.3366 0 1.18997)
(11.4765 0 1.25)
(11.6206 0 1.30746)
(11.7683 0 1.36206)
(11.9191 0 1.41358)
(12.0724 0 1.46181)
(12.2277 0 1.50657)
(12.3844 0 1.54772)
(12.5419 0 1.58518)
(12.6998 0 1.61889)
(12.8575 0 1.64884)
(13.0145 0 1.67506)
(13.1701 0 1.69761)
(13.3379 0 1.71665)
(10.005 0 0.0638745)
(10.0216 0 0.126731)
(10.0506 0 0.188935)
(10.0906 0 0.25073)
(10.1403 0 0.312225)
(10.1992 0 0.373475)
(10.2668 0 0.434506)
(10.3428 0 0.495305)
(10.4268 0 0.555815)
(10.5184 0 0.615936)
(10.6172 0 0.67553)
(10.7228 0 0.734431)
(10.8349 0 0.792444)
(10.953 0 0.849355)
(11.0767 0 0.904936)
(11.2055 0 0.958951)
(11.339 0 1.01116)
(11.4767 0 1.06134)
(11.6181 0 1.10926)
(11.7626 0 1.15472)
(11.9098 0 1.19753)
(12.0591 0 1.23755)
(12.21 0 1.27465)
(12.3619 0 1.30873)
(12.5145 0 1.33973)
(12.6671 0 1.36762)
(12.8193 0 1.3924)
(12.9706 0 1.41412)
(13.1206 0 1.43283)
(13.282 0 1.44867)
(10.0051 0 0.052397)
(10.0221 0 0.104067)
(10.0518 0 0.155389)
(10.0925 0 0.206502)
(10.143 0 0.257405)
(10.2026 0 0.308091)
(10.2709 0 0.358561)
(10.3475 0 0.408787)
(10.4319 0 0.458704)
(10.5239 0 0.50822)
(10.6228 0 0.557214)
(10.7284 0 0.605547)
(10.8401 0 0.653058)
(10.9575 0 0.699575)
(11.0802 0 0.744914)
(11.2077 0 0.788891)
(11.3395 0 0.831318)
(11.4751 0 0.872019)
(11.614 0 0.910824)
(11.7557 0 0.947579)
(11.8998 0 0.982152)
(12.0456 0 1.01443)
(12.1926 0 1.04432)
(12.3405 0 1.07176)
(12.4888 0 1.09671)
(12.6369 0 1.11916)
(12.7844 0 1.13912)
(12.931 0 1.15664)
(13.0761 0 1.17175)
(13.2322 0 1.18459)
(10.0053 0 0.0402769)
(10.0228 0 0.0802426)
(10.0533 0 0.120249)
(10.0947 0 0.160232)
(10.1458 0 0.200084)
(10.206 0 0.239786)
(10.2748 0 0.279334)
(10.3518 0 0.318693)
(10.4366 0 0.357797)
(10.5287 0 0.396561)
(10.6277 0 0.434884)
(10.733 0 0.472649)
(10.8443 0 0.509728)
(10.961 0 0.545984)
(11.0828 0 0.581273)
(11.209 0 0.615453)
(11.3392 0 0.648382)
(11.473 0 0.679925)
(11.6098 0 0.709958)
(11.7491 0 0.738368)
(11.8904 0 0.765057)
(12.0333 0 0.789947)
(12.1772 0 0.812976)
(12.3217 0 0.8341)
(12.4664 0 0.853299)
(12.6108 0 0.870567)
(12.7546 0 0.885921)
(12.8973 0 0.89939)
(13.0386 0 0.911021)
(13.1904 0 0.920902)
(10.0056 0 0.0273318)
(10.0239 0 0.0556014)
(10.0551 0 0.0846013)
(10.0971 0 0.113666)
(10.1487 0 0.142567)
(10.2093 0 0.171324)
(10.2785 0 0.19995)
(10.3558 0 0.22841)
(10.4408 0 0.25665)
(10.533 0 0.284607)
(10.6319 0 0.312209)
(10.737 0 0.339377)
(10.8479 0 0.366019)
(10.964 0 0.392041)
(11.0849 0 0.417344)
(11.2101 0 0.441828)
(11.339 0 0.465395)
(11.4713 0 0.487954)
(11.6063 0 0.509418)
(11.7437 0 0.529712)
(11.8829 0 0.548771)
(12.0234 0 0.566541)
(12.1648 0 0.582982)
(12.3066 0 0.598068)
(12.4485 0 0.611786)
(12.59 0 0.624136)
(12.7307 0 0.635131)
(12.8704 0 0.644796)
(13.0086 0 0.653165)
(13.157 0 0.660308)
(10.0068 0 0.0112492)
(10.0271 0 0.026587)
(10.0594 0 0.0438164)
(10.1017 0 0.0613314)
(10.1535 0 0.0788127)
(10.2142 0 0.0963026)
(10.2836 0 0.113796)
(10.361 0 0.131233)
(10.4459 0 0.148553)
(10.538 0 0.165702)
(10.6367 0 0.182626)
(10.7414 0 0.19927)
(10.8518 0 0.215573)
(10.9674 0 0.231474)
(11.0876 0 0.246911)
(11.2119 0 0.261822)
(11.3398 0 0.276149)
(11.4709 0 0.289836)
(11.6047 0 0.302835)
(11.7406 0 0.315101)
(11.8782 0 0.326598)
(12.017 0 0.337297)
(12.1566 0 0.347178)
(12.2965 0 0.356228)
(12.4364 0 0.364442)
(12.5758 0 0.371826)
(12.7145 0 0.37839)
(12.8521 0 0.384155)
(12.9882 0 0.389148)
(13.1344 0 0.39343)
(9.99589 0 0.00092378)
(10.007 0 0.0049565)
(10.0277 0 0.0102656)
(10.0577 0 0.0158084)
(10.0974 0 0.0214233)
(10.1467 0 0.0271371)
(10.2051 0 0.0329402)
(10.272 0 0.0387981)
(10.347 0 0.0446785)
(10.4296 0 0.0505552)
(10.5192 0 0.0564037)
(10.6154 0 0.0621993)
(10.7177 0 0.0679159)
(10.8255 0 0.0735274)
(10.9384 0 0.0790072)
(11.0558 0 0.0843295)
(11.1772 0 0.0894696)
(11.302 0 0.0944041)
(11.4298 0 0.0991117)
(11.56 0 0.103573)
(11.6921 0 0.107773)
(11.8257 0 0.111698)
(11.9603 0 0.115338)
(12.0954 0 0.118685)
(12.2307 0 0.121738)
(12.3657 0 0.124495)
(12.5 0 0.126958)
(12.6334 0 0.129133)
(12.7656 0 0.131023)
(12.9075 0 0.132661)
(9.44874 0 13.086)
(6.23229 0 10.7602)
(-1.01182 0 5.40227)
(10.3681 0 11.211)
(9.80865 0 9.90173)
(8.21821 0 8.08864)
(11.4624 0 11.1231)
(11.6768 0 10.5667)
(11.4185 0 9.65448)
(12.3515 0 10.7306)
(12.6964 0 10.5628)
(12.802 0 10.1455)
(12.917 0 9.99575)
(13.2864 0 9.98821)
(13.5288 0 9.84941)
(13.2913 0 9.22168)
(13.6525 0 9.27881)
(13.9353 0 9.26842)
(13.5576 0 8.5062)
(13.8899 0 8.57877)
(14.1639 0 8.61428)
(13.7464 0 7.85318)
(14.044 0 7.92002)
(14.2931 0 7.96487)
(13.8768 0 7.25638)
(14.1419 0 7.31296)
(14.3645 0 7.3549)
(13.9632 0 6.71021)
(14.2001 0 6.75753)
(14.399 0 6.79399)
(14.0154 0 6.20807)
(14.2284 0 6.2479)
(14.4071 0 6.2792)
(14.0404 0 5.74333)
(14.2332 0 5.77723)
(14.3949 0 5.80426)
(14.0431 0 5.31028)
(14.2188 0 5.33948)
(14.3661 0 5.36307)
(14.0274 0 4.90425)
(14.1885 0 4.92965)
(14.3236 0 4.95043)
(13.9967 0 4.5214)
(14.1452 0 4.54366)
(14.2698 0 4.56209)
(13.9535 0 4.15854)
(14.0912 0 4.17817)
(14.2067 0 4.19458)
(13.9005 0 3.81305)
(14.0286 0 3.83041)
(14.1362 0 3.84507)
(13.8398 0 3.48272)
(13.9596 0 3.49809)
(14.0603 0 3.5112)
(13.7737 0 3.16562)
(13.8861 0 3.17924)
(13.9806 0 3.19094)
(13.7041 0 2.86009)
(13.8101 0 2.87213)
(13.8992 0 2.88255)
(13.6331 0 2.56458)
(13.7334 0 2.57518)
(13.8176 0 2.58441)
(13.5625 0 2.27772)
(13.6577 0 2.287)
(13.7377 0 2.29512)
(13.4941 0 1.99806)
(13.5848 0 2.0061)
(13.6611 0 2.01318)
(13.4293 0 1.72451)
(13.5162 0 1.73138)
(13.5894 0 1.73746)
(13.37 0 1.45522)
(13.4536 0 1.46097)
(13.524 0 1.46608)
(13.3173 0 1.18992)
(13.3981 0 1.19461)
(13.4662 0 1.19879)
(13.2731 0 0.925)
(13.3516 0 0.928607)
(13.4178 0 0.931829)
(13.2378 0 0.663282)
(13.3146 0 0.665898)
(13.3794 0 0.668234)
(13.2138 0 0.395145)
(13.2893 0 0.39659)
(13.353 0 0.397857)
(12.9848 0 0.13327)
(13.0583 0 0.13375)
(13.1203 0 0.134176)
(-2.61285 0 1.52692)
(-1.91949 0 1.26734)
(-2.22578 0 0.754455)
(-2.05427 0 0.695248)
(-1.92413 0 0.748318)
(-1.9564 0 0.566896)
(-1.96867 0 0.375938)
(-1.98831 0 0.300575)
(-2.01773 0 0.25066)
(-2.02861 0 0.203845)
(-2.0337 0 0.18753)
(-2.05888 0 0.17994)
(-2.09368 0 0.153466)
(-2.11729 0 0.116275)
(-2.12978 0 0.0918676)
(-2.14624 0 0.0892717)
(-2.17457 0 0.0903661)
(-2.20621 0 0.0804933)
(-2.22755 0 0.0599816)
(-2.23361 0 0.0414819)
(-2.2326 0 0.0374648)
(-2.23682 0 0.0474771)
(-2.25139 0 0.0611516)
(-2.27353 0 0.0698721)
(-2.29733 0 0.0701881)
(-2.31731 0 0.0630883)
(-2.33128 0 0.0534073)
(-2.34151 0 0.0472318)
(-2.35034 0 0.046259)
(-2.35486 0 0.0466087)
(6.07325 0 5.45376)
(3.60011 0 3.52314)
(1.47587 0 2.06171)
(-1.26975 0 0.560803)
(-1.89329 0 0.396915)
(-2.17967 0 0.193519)
(-2.13239 0 0.236259)
(-2.0391 0 0.419598)
(-2.04656 0 0.406028)
(-2.04371 0 0.267756)
(-2.03304 0 0.17459)
(-2.06876 0 0.171991)
(-2.1208 0 0.151618)
(-2.14228 0 0.1137)
(-2.13503 0 0.0998411)
(-2.13726 0 0.118094)
(-2.16889 0 0.131023)
(-2.21069 0 0.117834)
(-2.2366 0 0.0807122)
(-2.2369 0 0.0431204)
(-2.22541 0 0.0308865)
(-2.22377 0 0.0473275)
(-2.23977 0 0.0690155)
(-2.26718 0 0.0815316)
(-2.29643 0 0.0816161)
(-2.31952 0 0.0714205)
(-2.33289 0 0.0577577)
(-2.3401 0 0.0499627)
(-2.34694 0 0.0511183)
(-2.35132 0 0.0534227)
(10.3468 0 7.61745)
(8.59881 0 5.82811)
(6.67841 0 4.38167)
(4.75237 0 3.15601)
(2.98605 0 2.17684)
(1.5631 0 1.35955)
(-0.66253 0 0.422021)
(-1.6995 0 0.234895)
(-2.07524 0 0.0690068)
(-2.16392 0 -0.0746105)
(-2.06365 0 0.0809173)
(-2.02279 0 0.321113)
(-2.08312 0 0.318867)
(-2.09886 0 0.210291)
(-2.0663 0 0.108295)
(-2.06248 0 0.0933858)
(-2.11456 0 0.11874)
(-2.18116 0 0.105803)
(-2.21796 0 0.055432)
(-2.20634 0 0.00998342)
(-2.1698 0 0.0173105)
(-2.1533 0 0.0592451)
(-2.17182 0 0.0950666)
(-2.20758 0 0.111813)
(-2.2442 0 0.109687)
(-2.27091 0 0.0926559)
(-2.28242 0 0.0695824)
(-2.28396 0 0.0551961)
(-2.28729 0 0.0577991)
(-2.29189 0 0.0630453)
(12.4855 0 8.78149)
(11.6058 0 7.33499)
(10.3743 0 6.02537)
(8.97806 0 4.84767)
(7.49514 0 3.83466)
(6.05764 0 3.01085)
(4.59581 0 2.31027)
(3.22219 0 1.71788)
(1.97689 0 1.18223)
(0.979688 0 0.629004)
(-1.13613 0 0.123121)
(-1.58866 0 0.198752)
(-1.97643 0 0.0776586)
(-2.08358 0 -0.0790777)
(-2.00733 0 -0.0764893)
(-1.95229 0 0.12042)
(-1.9814 0 0.267573)
(-2.07568 0 0.270045)
(-2.11936 0 0.181022)
(-2.07451 0 0.0536126)
(-2.00614 0 -0.00954624)
(-1.99726 0 0.0409966)
(-2.0339 0 0.0942404)
(-2.08596 0 0.113713)
(-2.13413 0 0.10646)
(-2.16664 0 0.0807426)
(-2.17537 0 0.0485382)
(-2.16614 0 0.0327965)
(-2.16178 0 0.0512665)
(-2.16668 0 0.0692829)
(13.6551 0 9.09973)
(13.3678 0 8.09368)
(12.7446 0 7.04475)
(11.8845 0 6.02968)
(10.8619 0 5.10256)
(9.75758 0 4.29364)
(8.608 0 3.57123)
(7.43246 0 2.92308)
(6.26041 0 2.36029)
(5.151 0 1.91324)
(3.98823 0 1.54527)
(2.95302 0 1.20095)
(1.99881 0 0.869113)
(1.21526 0 0.534495)
(-0.0780594 0 0.123187)
(-1.13675 0 0.136618)
(-1.50003 0 0.18436)
(-1.76671 0 0.109566)
(-1.88059 0 -0.0468936)
(-1.82209 0 -0.185062)
(-1.75269 0 -0.10848)
(-1.76105 0 0.0959882)
(-1.80419 0 0.183831)
(-1.878 0 0.204213)
(-1.93695 0 0.190766)
(-1.97026 0 0.156557)
(-1.96621 0 0.108517)
(-1.93038 0 0.0686643)
(-1.91181 0 0.0755429)
(-1.92416 0 0.109463)
(14.2798 0 8.92016)
(14.3592 0 8.30185)
(14.1867 0 7.5538)
(13.7813 0 6.76094)
(13.1856 0 5.97718)
(12.4526 0 5.23662)
(11.6254 0 4.54585)
(10.7334 0 3.91423)
(9.80207 0 3.35373)
(8.8632 0 2.87891)
(7.92162 0 2.4553)
(6.99358 0 2.0609)
(6.086 0 1.70215)
(5.20447 0 1.4089)
(4.32836 0 1.18427)
(3.45005 0 0.991033)
(2.67957 0 0.801529)
(1.97685 0 0.615887)
(1.32995 0 0.418833)
(0.79472 0 0.160415)
(-0.622284 0 -0.00231071)
(-1.05092 0 0.105709)
(-1.34059 0 0.141188)
(-1.49465 0 0.138384)
(-1.59182 0 0.105395)
(-1.65289 0 0.0474976)
(-1.66758 0 -0.0261583)
(-1.62518 0 -0.0729692)
(-1.60999 0 0.00114142)
(-1.62821 0 0.127638)
(14.5853 0 8.48777)
(14.8664 0 8.14843)
(14.9909 0 7.66252)
(14.925 0 7.08954)
(14.6784 0 6.47482)
(14.2831 0 5.8532)
(13.7721 0 5.24652)
(13.172 0 4.67048)
(12.5048 0 4.13654)
(11.7929 0 3.65278)
(11.0546 0 3.21092)
(10.3026 0 2.80514)
(9.54279 0 2.43717)
(8.78047 0 2.12148)
(8.02746 0 1.85315)
(7.28572 0 1.6154)
(6.57765 0 1.38982)
(5.89577 0 1.17242)
(5.22386 0 0.975202)
(4.56817 0 0.839491)
(3.88171 0 0.74455)
(3.24643 0 0.629994)
(2.66318 0 0.52098)
(2.12018 0 0.42719)
(1.60777 0 0.347765)
(1.12525 0 0.274581)
(0.664767 0 0.195101)
(0.228002 0 0.0668785)
(-0.563361 0 0.0824729)
(-0.893011 0 0.296863)
(14.7174 0 7.94531)
(15.0862 0 7.78125)
(15.3794 0 7.49036)
(15.5388 0 7.10366)
(15.5504 0 6.65263)
(15.428 0 6.16569)
(15.1906 0 5.66534)
(14.8559 0 5.1687)
(14.4407 0 4.68885)
(13.9626 0 4.23532)
(13.4381 0 3.81066)
(12.8798 0 3.41451)
(12.2952 0 3.04872)
(11.6918 0 2.71921)
(11.0808 0 2.42553)
(10.472 0 2.16185)
(9.87223 0 1.91623)
(9.27765 0 1.68475)
(8.68202 0 1.47712)
(8.08907 0 1.31074)
(7.50664 0 1.17176)
(6.94365 0 1.04376)
(6.40257 0 0.92556)
(5.87436 0 0.818223)
(5.35518 0 0.720518)
(4.84476 0 0.630949)
(4.3365 0 0.555606)
(3.83409 0 0.511767)
(3.31579 0 0.483269)
(2.60222 0 0.52043)
(14.7607 0 7.37889)
(15.1489 0 7.31194)
(15.5178 0 7.14945)
(15.8059 0 6.90248)
(15.9872 0 6.58859)
(16.0621 0 6.22671)
(16.0376 0 5.83445)
(15.9225 0 5.4272)
(15.7267 0 5.01793)
(15.4621 0 4.61685)
(15.141 0 4.23001)
(14.7736 0 3.86064)
(14.3681 0 3.51215)
(13.9327 0 3.18886)
(13.4769 0 2.89241)
(13.0093 0 2.62008)
(12.5349 0 2.36604)
(12.0534 0 2.12877)
(11.5639 0 1.9136)
(11.0701 0 1.7274)
(10.5805 0 1.56661)
(10.101 0 1.42361)
(9.63073 0 1.2925)
(9.16448 0 1.17228)
(8.69912 0 1.06293)
(8.23287 0 0.965262)
(7.76273 0 0.883987)
(7.28737 0 0.82755)
(6.81608 0 0.800383)
(6.20518 0 0.809519)
(14.7588 0 6.83159)
(15.1322 0 6.81245)
(15.5191 0 6.72599)
(15.8651 0 6.57317)
(16.1418 0 6.36179)
(16.3427 0 6.1024)
(16.4672 0 5.80652)
(16.5168 0 5.48574)
(16.495 0 5.15083)
(16.408 0 4.81106)
(16.2633 0 4.47339)
(16.0683 0 4.14293)
(15.8299 0 3.82412)
(15.5551 0 3.52113)
(15.2513 0 3.23635)
(14.9255 0 2.96942)
(14.5822 0 2.71854)
(14.2235 0 2.48374)
(13.8509 0 2.26815)
(13.4681 0 2.07543)
(13.0814 0 1.90472)
(12.6951 0 1.75126)
(12.3093 0 1.6109)
(11.9216 0 1.48276)
(11.53 0 1.36738)
(11.133 0 1.2661)
(10.7292 0 1.1822)
(10.319 0 1.1207)
(9.91241 0 1.08557)
(9.40096 0 1.07075)
(14.7317 0 6.31846)
(15.0776 0 6.32059)
(15.4524 0 6.27565)
(15.8117 0 6.18118)
(16.13 0 6.03986)
(16.3992 0 5.85673)
(16.6154 0 5.63831)
(16.7755 0 5.3921)
(16.8788 0 5.12591)
(16.9266 0 4.84713)
(16.9224 0 4.56218)
(16.8703 0 4.27642)
(16.7751 0 3.99452)
(16.6417 0 3.72054)
(16.4756 0 3.45738)
(16.2818 0 3.20635)
(16.0646 0 2.96786)
(15.8265 0 2.7429)
(15.5702 0 2.53373)
(15.2991 0 2.34271)
(15.0176 0 2.1699)
(14.7292 0 2.01297)
(14.4349 0 1.86966)
(14.134 0 1.7394)
(13.8256 0 1.62278)
(13.509 0 1.5211)
(13.1841 0 1.43671)
(12.8522 0 1.37241)
(12.5217 0 1.32865)
(12.1038 0 1.29665)
(14.6886 0 5.84129)
(15.0048 0 5.85213)
(15.3554 0 5.829)
(15.7043 0 5.76898)
(16.0308 0 5.67272)
(16.3277 0 5.54243)
(16.5909 0 5.38144)
(16.8158 0 5.19414)
(16.9991 0 4.98564)
(17.1394 0 4.76128)
(17.237 0 4.5262)
(17.2936 0 4.28507)
(17.3113 0 4.04218)
(17.2932 0 3.8013)
(17.2427 0 3.56549)
(17.1632 0 3.33692)
(17.058 0 3.11709)
(16.9296 0 2.90758)
(16.7805 0 2.71036)
(16.6136 0 2.52732)
(16.4324 0 2.35911)
(16.2395 0 2.20502)
(16.0365 0 2.06411)
(15.8235 0 1.9362)
(15.6005 0 1.82189)
(15.3674 0 1.72236)
(15.1249 0 1.63921)
(14.8747 0 1.5737)
(14.6227 0 1.52469)
(14.2978 0 1.48425)
(14.6334 0 5.397)
(14.9222 0 5.41118)
(15.2458 0 5.39967)
(15.5746 0 5.35996)
(15.8916 0 5.29208)
(16.1919 0 5.19705)
(16.4719 0 5.07652)
(16.7276 0 4.93299)
(16.955 0 4.76965)
(17.1514 0 4.59012)
(17.3155 0 4.39817)
(17.447 0 4.19749)
(17.5463 0 3.99165)
(17.6148 0 3.78394)
(17.6541 0 3.57727)
(17.6663 0 3.37401)
(17.6535 0 3.17613)
(17.6177 0 2.98549)
(17.5608 0 2.80398)
(17.4852 0 2.63335)
(17.3934 0 2.47463)
(17.2876 0 2.32806)
(17.1692 0 2.19358)
(17.039 0 2.0714)
(16.8973 0 1.96224)
(16.7447 0 1.86713)
(16.582 0 1.78716)
(16.4108 0 1.72283)
(16.2349 0 1.67269)
(16.0013 0 1.63051)
(14.5685 0 4.98133)
(14.8332 0 4.99667)
(15.1313 0 4.99178)
(15.4375 0 4.9646)
(15.7378 0 4.91503)
(16.0287 0 4.84358)
(16.3082 0 4.75117)
(16.5729 0 4.63925)
(16.8193 0 4.50984)
(17.0445 0 4.36537)
(17.2466 0 4.20854)
(17.4243 0 4.04211)
(17.5771 0 3.86891)
(17.705 0 3.69166)
(17.8085 0 3.51289)
(17.8887 0 3.33489)
(17.9465 0 3.1597)
(17.9833 0 2.9892)
(18.0005 0 2.82524)
(17.9997 0 2.66948)
(17.9826 0 2.52318)
(17.951 0 2.38711)
(17.9062 0 2.26177)
(17.8489 0 2.14772)
(17.7799 0 2.04577)
(17.6999 0 1.95687)
(17.6098 0 1.88187)
(17.5106 0 1.82099)
(17.405 0 1.77315)
(17.2571 0 1.7338)
(14.4954 0 4.59024)
(14.7393 0 4.60581)
(15.0145 0 4.60503)
(15.299 0 4.58617)
(15.5808 0 4.54906)
(15.8574 0 4.49401)
(16.1277 0 4.42154)
(16.3893 0 4.33257)
(16.6394 0 4.22846)
(16.8754 0 4.11088)
(17.0954 0 3.98178)
(17.2978 0 3.84323)
(17.4818 0 3.69744)
(17.6466 0 3.54659)
(17.7921 0 3.39282)
(17.9186 0 3.23817)
(18.0263 0 3.08454)
(18.1161 0 2.93374)
(18.1886 0 2.78749)
(18.245 0 2.64738)
(18.2865 0 2.51476)
(18.3142 0 2.39065)
(18.3292 0 2.27591)
(18.3323 0 2.17134)
(18.3243 0 2.07783)
(18.3059 0 1.9963)
(18.2779 0 1.92753)
(18.2412 0 1.87181)
(18.1971 0 1.82859)
(18.1263 0 1.79489)
(14.4157 0 4.22025)
(14.6415 0 4.23562)
(14.8966 0 4.23755)
(15.1614 0 4.22458)
(15.4252 0 4.1965)
(15.6863 0 4.15344)
(15.9442 0 4.09573)
(16.1971 0 4.02397)
(16.4429 0 3.93909)
(16.6793 0 3.8423)
(16.9047 0 3.73506)
(17.1177 0 3.61895)
(17.3172 0 3.4957)
(17.5024 0 3.36708)
(17.6727 0 3.23488)
(17.8281 0 3.10086)
(17.9683 0 2.96672)
(18.0938 0 2.83411)
(18.2049 0 2.70461)
(18.3023 0 2.57973)
(18.3866 0 2.46079)
(18.4588 0 2.34896)
(18.5196 0 2.24524)
(18.5698 0 2.15059)
(18.61 0 2.06597)
(18.641 0 1.99231)
(18.6634 0 1.93043)
(18.6778 0 1.8808)
(18.685 0 1.84346)
(18.6803 0 1.81677)
(14.3307 0 3.86847)
(14.5408 0 3.88338)
(14.7783 0 3.88716)
(15.0256 0 3.87854)
(15.2729 0 3.85727)
(15.5191 0 3.8234)
(15.7638 0 3.77708)
(16.006 0 3.71871)
(16.2438 0 3.64894)
(16.4754 0 3.56866)
(16.6995 0 3.47897)
(16.9147 0 3.38112)
(17.1201 0 3.27648)
(17.3148 0 3.16651)
(17.4982 0 3.0527)
(17.67 0 2.93655)
(17.8299 0 2.81959)
(17.9778 0 2.70328)
(18.1141 0 2.58907)
(18.239 0 2.47833)
(18.353 0 2.37237)
(18.4566 0 2.27236)
(18.5505 0 2.17938)
(18.6353 0 2.09446)
(18.7116 0 2.01861)
(18.78 0 1.95279)
(18.8412 0 1.89788)
(18.8956 0 1.85461)
(18.9435 0 1.82348)
(18.9929 0 1.80398)
(14.2421 0 3.53249)
(14.4383 0 3.54677)
(14.6604 0 3.55178)
(14.8921 0 3.54641)
(15.1246 0 3.53042)
(15.3569 0 3.50378)
(15.5891 0 3.46653)
(15.8202 0 3.41891)
(16.0488 0 3.36137)
(16.2734 0 3.29456)
(16.4928 0 3.21933)
(16.7059 0 3.13666)
(16.9118 0 3.04765)
(17.1097 0 2.95349)
(17.299 0 2.85545)
(17.4792 0 2.75484)
(17.65 0 2.65296)
(17.8114 0 2.55113)
(17.9632 0 2.45066)
(18.1057 0 2.35283)
(18.2393 0 2.25884)
(18.3642 0 2.16987)
(18.481 0 2.08699)
(18.5902 0 2.01127)
(18.6923 0 1.94372)
(18.788 0 1.88536)
(18.8777 0 1.83715)
(18.9621 0 1.79998)
(19.0412 0 1.77474)
(19.133 0 1.76177)
(14.1513 0 3.21026)
(14.3354 0 3.22376)
(14.5439 0 3.22954)
(14.7617 0 3.22661)
(14.981 0 3.21474)
(15.2007 0 3.19386)
(15.4211 0 3.16395)
(15.6416 0 3.12513)
(15.8609 0 3.07768)
(16.0778 0 3.02211)
(16.2912 0 2.95903)
(16.5002 0 2.88922)
(16.7039 0 2.81356)
(16.9015 0 2.73305)
(17.0926 0 2.64874)
(17.2765 0 2.56175)
(17.453 0 2.47322)
(17.6219 0 2.38433)
(17.7831 0 2.29625)
(17.9367 0 2.21015)
(18.0829 0 2.12715)
(18.222 0 2.04837)
(18.3543 0 1.97487)
(18.4803 0 1.90771)
(18.6006 0 1.8479)
(18.7157 0 1.79648)
(18.8261 0 1.75447)
(18.9325 0 1.72289)
(19.0348 0 1.70287)
(19.159 0 1.69529)
(14.06 0 2.89999)
(14.2334 0 2.91262)
(14.4298 0 2.91879)
(14.6354 0 2.91766)
(14.8428 0 2.90902)
(15.0511 0 2.89276)
(15.2608 0 2.86883)
(15.4714 0 2.83726)
(15.6818 0 2.79825)
(15.891 0 2.75213)
(16.098 0 2.69939)
(16.3019 0 2.64062)
(16.5021 0 2.57654)
(16.6978 0 2.50794)
(16.8884 0 2.43572)
(17.0735 0 2.36082)
(17.2526 0 2.28424)
(17.4257 0 2.20702)
(17.5925 0 2.13018)
(17.7531 0 2.0548)
(17.9076 0 1.98193)
(18.0562 0 1.91258)
(18.1991 0 1.84781)
(18.337 0 1.7886)
(18.4701 0 1.73599)
(18.599 0 1.69098)
(18.7245 0 1.65463)
(18.847 0 1.62804)
(18.9667 0 1.61244)
(19.1154 0 1.60903)
(13.9697 0 2.60007)
(14.1337 0 2.61173)
(14.3195 0 2.618)
(14.5142 0 2.61817)
(14.711 0 2.61203)
(14.9091 0 2.59948)
(15.1091 0 2.58043)
(15.3106 0 2.55487)
(15.5126 0 2.52293)
(15.7144 0 2.48483)
(15.915 0 2.44094)
(16.1136 0 2.39171)
(16.3097 0 2.33771)
(16.5026 0 2.27959)
(16.6916 0 2.21809)
(16.8764 0 2.15401)
(17.0566 0 2.0882)
(17.2319 0 2.02156)
(17.4021 0 1.95502)
(17.5672 0 1.88951)
(17.7273 0 1.826)
(17.8825 0 1.76544)
(18.0331 0 1.70879)
(18.1794 0 1.65703)
(18.322 0 1.61111)
(18.4613 0 1.57204)
(18.598 0 1.54086)
(18.7328 0 1.51867)
(18.8658 0 1.50672)
(19.0334 0 1.50634)
(13.8822 0 2.30904)
(14.0379 0 2.31967)
(14.2142 0 2.32583)
(14.3994 0 2.32688)
(14.5868 0 2.32266)
(14.7758 0 2.31307)
(14.967 0 2.29801)
(15.1601 0 2.27744)
(15.3545 0 2.25143)
(15.5493 0 2.22015)
(15.7437 0 2.18385)
(15.9372 0 2.14289)
(16.129 0 2.09772)
(16.3187 0 2.04885)
(16.5056 0 1.99689)
(16.6893 0 1.94252)
(16.8694 0 1.88644)
(17.0457 0 1.82945)
(17.218 0 1.77234)
(17.3861 0 1.71595)
(17.5502 0 1.66114)
(17.7102 0 1.60878)
(17.8665 0 1.55975)
(18.0194 0 1.51495)
(18.1692 0 1.4753)
(18.3166 0 1.44175)
(18.4621 0 1.41529)
(18.6066 0 1.39698)
(18.7503 0 1.38802)
(18.9327 0 1.38976)
(13.7989 0 2.02541)
(13.9473 0 2.03495)
(14.1154 0 2.04079)
(14.2922 0 2.0424)
(14.4713 0 2.03963)
(14.6522 0 2.03239)
(14.8356 0 2.02059)
(15.0213 0 2.00417)
(15.2087 0 1.98316)
(15.397 0 1.95768)
(15.5857 0 1.92791)
(15.7742 0 1.89413)
(15.9618 0 1.85668)
(16.1481 0 1.81598)
(16.3325 0 1.77253)
(16.5147 0 1.72687)
(16.6942 0 1.67961)
(16.8708 0 1.63141)
(17.0443 0 1.58297)
(17.2144 0 1.535)
(17.3813 0 1.48827)
(17.545 0 1.44356)
(17.7057 0 1.40166)
(17.8637 0 1.36339)
(18.0194 0 1.32959)
(18.1732 0 1.30115)
(18.326 0 1.27899)
(18.4784 0 1.2641)
(18.6309 0 1.25758)
(18.8255 0 1.26071)
(13.7213 0 1.74805)
(13.8634 0 1.75646)
(14.0244 0 1.76183)
(14.1938 0 1.76373)
(14.3657 0 1.76203)
(14.5396 0 1.75665)
(14.7161 0 1.74751)
(14.8951 0 1.73454)
(15.0763 0 1.71776)
(15.2588 0 1.69723)
(15.4423 0 1.67311)
(15.626 0 1.64558)
(15.8097 0 1.61492)
(15.9927 0 1.58147)
(16.1746 0 1.54561)
(16.355 0 1.5078)
(16.5335 0 1.46853)
(16.7099 0 1.42836)
(16.8839 0 1.38788)
(17.0554 0 1.34771)
(17.2244 0 1.30849)
(17.3908 0 1.27092)
(17.555 0 1.23569)
(17.7171 0 1.20354)
(17.8775 0 1.17522)
(18.0367 0 1.15152)
(18.1955 0 1.13329)
(18.3545 0 1.12141)
(18.5143 0 1.11686)
(18.7191 0 1.12081)
(13.6509 0 1.47504)
(13.7876 0 1.48226)
(13.9426 0 1.48703)
(14.1057 0 1.48899)
(14.2713 0 1.48805)
(14.4391 0 1.48413)
(14.6096 0 1.47715)
(14.783 0 1.46706)
(14.9586 0 1.45385)
(15.136 0 1.43758)
(15.3148 0 1.41833)
(15.4943 0 1.39627)
(15.6743 0 1.3716)
(15.8542 0 1.34458)
(16.0336 0 1.31552)
(16.2121 0 1.28478)
(16.3895 0 1.25276)
(16.5653 0 1.21993)
(16.7395 0 1.18676)
(16.9118 0 1.15377)
(17.0822 0 1.12153)
(17.2508 0 1.0906)
(17.4176 0 1.06159)
(17.583 0 1.03514)
(17.7473 0 1.0119)
(17.9109 0 0.992575)
(18.0746 0 0.977888)
(18.2393 0 0.968629)
(18.4052 0 0.965641)
(18.6183 0 0.969972)
(13.5891 0 1.20616)
(13.7213 0 1.21216)
(13.871 0 1.21624)
(14.0289 0 1.21811)
(14.1893 0 1.21768)
(14.3519 0 1.21491)
(14.5174 0 1.20972)
(14.6859 0 1.20206)
(14.8568 0 1.19193)
(15.0299 0 1.17935)
(15.2045 0 1.1644)
(15.3804 0 1.14718)
(15.557 0 1.12785)
(15.7341 0 1.10662)
(15.9112 0 1.08371)
(16.088 0 1.05941)
(16.2641 0 1.03405)
(16.4393 0 1.00797)
(16.6133 0 0.981585)
(16.7861 0 0.955301)
(16.9575 0 0.929574)
(17.1276 0 0.90488)
(17.2965 0 0.881722)
(17.4645 0 0.860627)
(17.6318 0 0.842148)
(17.799 0 0.826873)
(17.9668 0 0.815421)
(18.136 0 0.808457)
(18.3071 0 0.806683)
(18.527 0 0.811004)
(13.5372 0 0.937563)
(13.6658 0 0.942283)
(13.8114 0 0.945549)
(13.9649 0 0.947142)
(14.1211 0 0.947001)
(14.2796 0 0.945083)
(14.4409 0 0.941333)
(14.6053 0 0.935709)
(14.7724 0 0.928201)
(14.9418 0 0.918825)
(15.113 0 0.907631)
(15.2858 0 0.894699)
(15.4596 0 0.880139)
(15.6343 0 0.864098)
(15.8094 0 0.846756)
(15.9845 0 0.828324)
(16.1595 0 0.809046)
(16.3339 0 0.789196)
(16.5077 0 0.769074)
(16.6806 0 0.749009)
(16.8527 0 0.729351)
(17.0238 0 0.710474)
(17.1942 0 0.692776)
(17.3641 0 0.676675)
(17.5338 0 0.662614)
(17.7038 0 0.651064)
(17.8748 0 0.642529)
(18.0476 0 0.637547)
(18.2228 0 0.636692)
(18.4479 0 0.640745)
(13.4964 0 0.672389)
(13.6221 0 0.675867)
(13.7645 0 0.678332)
(13.9148 0 0.679614)
(14.0677 0 0.679676)
(14.2229 0 0.678492)
(14.381 0 0.676022)
(14.5423 0 0.672234)
(14.7064 0 0.667117)
(14.8729 0 0.660681)
(15.0415 0 0.652957)
(15.2117 0 0.643999)
(15.3834 0 0.633882)
(15.5561 0 0.622706)
(15.7295 0 0.610594)
(15.9033 0 0.597695)
(16.0772 0 0.584179)
(16.2509 0 0.570239)
(16.4244 0 0.556088)
(16.5973 0 0.54196)
(16.7697 0 0.528107)
(16.9416 0 0.5148)
(17.1131 0 0.502324)
(17.2843 0 0.490988)
(17.4558 0 0.481115)
(17.6278 0 0.473057)
(17.8012 0 0.467192)
(17.9767 0 0.463934)
(18.1551 0 0.463729)
(18.3846 0 0.467204)
(13.468 0 0.400199)
(13.5918 0 0.402298)
(13.7319 0 0.403798)
(13.8797 0 0.404554)
(14.0303 0 0.404564)
(14.1832 0 0.403825)
(14.3391 0 0.402318)
(14.4981 0 0.40002)
(14.66 0 0.396925)
(14.8244 0 0.39304)
(14.991 0 0.388385)
(15.1594 0 0.38299)
(15.3293 0 0.376902)
(15.5005 0 0.370179)
(15.6726 0 0.362897)
(15.8453 0 0.355143)
(16.0183 0 0.34702)
(16.1914 0 0.338644)
(16.3644 0 0.330144)
(16.5372 0 0.321662)
(16.7096 0 0.313351)
(16.8818 0 0.305375)
(17.0538 0 0.297911)
(17.2258 0 0.291147)
(17.3983 0 0.285286)
(17.5716 0 0.280548)
(17.7465 0 0.277185)
(17.9238 0 0.275489)
(18.1042 0 0.275846)
(18.3357 0 0.279018)
(13.2321 0 0.135085)
(13.3522 0 0.136018)
(13.4883 0 0.13674)
(13.6321 0 0.137184)
(13.7786 0 0.13736)
(13.9274 0 0.137272)
(14.0791 0 0.136912)
(14.2338 0 0.136269)
(14.3914 0 0.13534)
(14.5515 0 0.134126)
(14.7136 0 0.132633)
(14.8776 0 0.130871)
(15.043 0 0.128855)
(15.2095 0 0.126604)
(15.3769 0 0.124143)
(15.5448 0 0.121504)
(15.713 0 0.118722)
(15.8811 0 0.115838)
(16.0491 0 0.112897)
(16.2167 0 0.109949)
(16.3839 0 0.107049)
(16.5507 0 0.104255)
(16.7172 0 0.101631)
(16.8837 0 0.0992458)
(17.0505 0 0.0971721)
(17.2181 0 0.0954929)
(17.3873 0 0.0943052)
(17.559 0 0.0937376)
(17.7344 0 0.0939901)
(17.9613 0 0.0956637)
)
;
boundaryField
{
inlet
{
type fixedValue;
value uniform (10 0 0);
}
outlet
{
type zeroGradient;
}
flap
{
type movingWallVelocity;
value nonuniform List<vector>
33
(
(0 0 6.93889e-16)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 -1.11022e-14)
(0 0 -1.11022e-14)
(0 0 -1.11022e-14)
(0 0 -2.22045e-14)
(6.93889e-16 -2.77556e-15 0)
(0 -2.77556e-15 0)
(0 0 0)
(0 0 6.93889e-16)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 -5.55112e-15)
(0 0 0)
(0 0 -1.11022e-14)
(0 0 0)
(0 0 0)
(0 0 0)
(0 0 0)
(0 -2.77556e-15 -1.11022e-14)
(0 0 -1.11022e-14)
)
;
}
upperWall
{
type noSlip;
}
lowerWall
{
type noSlip;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
|
|
cf2c48bd7a695479d776e6215a0c6dea3d1cf177
|
88678d6377075eb1589fb53e59c908dbc7f26071
|
/angel_1_1/Code/Tetris/TetrisRenderer_OpenGL.h
|
ff818ded2e12573eab5e524b3d4fb39850ceba8b
|
[] |
no_license
|
chrishaukap/GameDev
|
89d76eacdae34ae96e83496f2c34c61e101d2600
|
fb364cea6941e9b9074ecdd0d9569578efb0f937
|
refs/heads/master
| 2020-05-28T11:23:41.750257
| 2013-08-08T21:59:30
| 2013-08-08T21:59:30
| 2,401,748
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 417
|
h
|
TetrisRenderer_OpenGL.h
|
#pragma once
#include "cdhBase.h"
namespace CDH
{
namespace Tetris{
class Game;
}
class TetrisRenderer_OpenGL
{
public:
TetrisRenderer_OpenGL(const Tetris::Game& game);
~TetrisRenderer_OpenGL();
void render() const;
private:
const Tetris::Game& m_game;
TetrisRenderer_OpenGL(const TetrisRenderer_OpenGL& C);
const TetrisRenderer_OpenGL& operator=(const TetrisRenderer_OpenGL& C);
};
}
|
920ebcc2386666eac691655a5dac09d4f1583569
|
73bd731e6e755378264edc7a7b5d16132d023b6a
|
/CodeForces/914B-4.cpp
|
43d9c14ec673d818510cf9ec9398f5a2cecfcdd8
|
[] |
no_license
|
IHR57/Competitive-Programming
|
375e8112f7959ebeb2a1ed6a0613beec32ce84a5
|
5bc80359da3c0e5ada614a901abecbb6c8ce21a4
|
refs/heads/master
| 2023-01-24T01:33:02.672131
| 2023-01-22T14:34:31
| 2023-01-22T14:34:31
| 163,381,483
| 0
| 3
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 473
|
cpp
|
914B-4.cpp
|
// BISMILLAHIR RAHMANIR RAHIM
#include <bits/stdc++.h>
#define MAX 100005
using namespace std;
int main()
{
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int n, counter[MAX] = {0}, value;
vector<int> arr;
cin>>n;
int sum = 0;
for(int i = 0; i < n; i++){
cin>>value;
sum ^= value;
}
//cout<<sum<<endl;
if(sum == 0){
cout<<"Agasa"<<endl;
}
else{
cout<<"Conan"<<endl;
}
return 0;
}
|
6f5620781065535e062b5f3ab445c3eec03aed06
|
ffdc77394c5b5532b243cf3c33bd584cbdc65cb7
|
/mindspore/core/ops/sparse_to_dense_v2.h
|
67f549fbed3ed9b25e192b7b81ac596f51b46bbd
|
[
"Apache-2.0",
"LicenseRef-scancode-proprietary-license",
"MPL-1.0",
"OpenSSL",
"LGPL-3.0-only",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause-Open-MPI",
"MIT",
"MPL-2.0-no-copyleft-exception",
"NTP",
"BSD-3-Clause",
"GPL-1.0-or-later",
"0BSD",
"MPL-2.0",
"LicenseRef-scancode-free-unknown",
"AGPL-3.0-only",
"Libpng",
"MPL-1.1",
"IJG",
"GPL-2.0-only",
"BSL-1.0",
"Zlib",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-python-cwi",
"BSD-2-Clause",
"LicenseRef-scancode-gary-s-brown",
"LGPL-2.1-only",
"LicenseRef-scancode-other-permissive",
"Python-2.0",
"LicenseRef-scancode-mit-nagy",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-unknown-license-reference",
"Unlicense"
] |
permissive
|
mindspore-ai/mindspore
|
ca7d5bb51a3451c2705ff2e583a740589d80393b
|
54acb15d435533c815ee1bd9f6dc0b56b4d4cf83
|
refs/heads/master
| 2023-07-29T09:17:11.051569
| 2023-07-17T13:14:15
| 2023-07-17T13:14:15
| 239,714,835
| 4,178
| 768
|
Apache-2.0
| 2023-07-26T22:31:11
| 2020-02-11T08:43:48
|
C++
|
UTF-8
|
C++
| false
| false
| 2,022
|
h
|
sparse_to_dense_v2.h
|
/**
* Copyright 2022 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINDSPORE_CORE_OPS_SPARSE_TO_DENSE_V2_H_
#define MINDSPORE_CORE_OPS_SPARSE_TO_DENSE_V2_H_
#include <map>
#include <memory>
#include <string>
#include <vector>
#include "mindapi/base/types.h"
#include "ops/base_operator.h"
namespace mindspore {
namespace ops {
constexpr auto kNameSparseToDenseV2 = "SparseToDenseV2";
/// \brief Converts a sparse representation into a dense tensor.
/// Refer to Python API @ref mindspore.ops.SparseToDense for more details.
class MIND_API SparseToDenseV2 : public BaseOperator {
public:
MIND_API_BASE_MEMBER(SparseToDenseV2);
/// \brief Constructor.
SparseToDenseV2() : BaseOperator(kNameSparseToDenseV2) {
InitIOName({"indices", "output_shape", "values", "default_value"}, {"output"});
}
/// \brief Init.
void Init(const bool validate_indices = true);
/// \brief Set validate_indices.
void set_validate_indices(const bool validate_indices);
/// \brief Get validate_indices.
///
/// \return validate_indices.
bool get_validate_indices() const;
};
MIND_API abstract::AbstractBasePtr SparseToDenseV2Infer(const abstract::AnalysisEnginePtr &,
const PrimitivePtr &primitive,
const std::vector<abstract::AbstractBasePtr> &input_args);
} // namespace ops
} // namespace mindspore
#endif // MINDSPORE_CORE_OPS_SPARSE_TO_DENSE_V2_H_
|
7cfe357d1ba5c242f91f9650e0fb1ce328df4ba2
|
cb543047ffa1bdae7453a739e52b0283e44cf963
|
/Zork/Sources/Zork.cpp
|
3c59248301de2fb0927b209e863cd8bce7fa950d
|
[] |
no_license
|
JoshMcGiff/CS4076Project
|
463d15d45fecb4148521a2113d7d25e32e5d1872
|
e6bead1c1963e8630e9a72ab43681ebff5861c3a
|
refs/heads/main
| 2023-04-18T17:07:13.293529
| 2021-04-29T23:07:26
| 2021-04-29T23:07:26
| 332,938,199
| 1
| 3
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 8,005
|
cpp
|
Zork.cpp
|
#include "Zork.hpp"
#include "Item.hpp"
#include <ctime>
__attribute__((unused)) bool thisIsAUsefulVariable = false; //Unused Global Variable, only here due to the spec
namespace Game {
Zork::Zork() : curWorld(nullptr), playerInventory() { //Zork constructor
srand(time(NULL));
/* Generate World 1 */
Game::Npc npc1("Nicki Minaj", "I have the key item for this world! But first, you must answer one simple question!\nIs Nicki Minaj the Queen of Rap?", "Wrong!\nLeave my kingdom at once!", "Yes, I am the Queen of Rap! Take this item!",
{"Nicki's Candle", NICKI_CANDLE, "Pray to Queen Nicki", ItemAttributesBitsEnum::Key}, NpcID::Nicki);
std::vector<Item> items1 = {{"Pink Friday Album", NICKI_ALBUM, "Stream Super Bass", 0}, {"Nicki's Barb Army", NICKI_BARBS, "The Army of Nicki", ItemAttributesBitsEnum::Weapon}, {"Nicki's Wig", NICKI_WIG, "A Pink and White Wig", 0}};
const char world1Name[] = "💄 Nicki's Kingdom"; //Character array, pass to World ctor as pointer
World* world1 = new World(world1Name, "The world dedicated to Nicki Minaj", npc1, Game::Item("👑 Nicki's Crown", NICKI_CROWN, "The Queen's Crown 👑", ItemAttributesBitsEnum::Special), items1);
zorkWorlds[0] = world1;
/* Generate World 2 */
Game::Npc npc2("Clean Bandit", "I have the key item for this world! To get it, you must tell me:\nIs Symphony by Clean Bandit ft. Zara Larsson, the best song ever?", "Tasteless, you are wrong!", "Correct! We are glad you agree - take this key now!",
{"Grace's Cello", CB_CELLO, "Clean Bandit's cello", ItemAttributesBitsEnum::Key|ItemAttributesBitsEnum::Weapon}, NpcID::Bandit);
std::vector<Item> items2 = {{"Jack's Synth", CB_SYNTH, "Clean Bandit's synth", 0}, {"Luke's Drums", CB_DRUMS, "Clean Bandit's drums", 0}, {"What Is Love? The Album", CB_ALBUM, "Clean Bandit's sophmore album", 0}};
const char world2Name[] = "🎼 Clean Bandit Land"; //Character array, pass to World ctor as pointer
World* world2 = new World(world2Name, "The world dedicated to Clean Bandit", npc2, Game::Item("🏆 Grammy Award", CB_GRAMMY, "Clean Bandit's 2014 Grammy Award 🏆", ItemAttributesBitsEnum::Special), items2);
zorkWorlds[1] = world2;
/* Generate World 3 */
Game::Npc npc3("Gen Z Kids", "Omg haiiii!! ✨✨ I've got this, like, key item for this world 🤩\nDo you want it? lol", "Oh okay lol 🙄\n✨Blocked!✨", "Okay here take it lol ✨✨",
{"Viral Tweet", TWT_VIRAL, "A viral Tweet", ItemAttributesBitsEnum::Key}, NpcID::Twitter);
std::vector<Item> items3 = {{"K-Pop Fans", TWT_KPOP, "Be wary of the K-Pop stans", 0}, {"Donald Trump's Banned Account", TWT_TRUMP, "This is Donald Trump's virtual graveyard", 0}, {"Cancelled User", TWT_CANCELLED, "You're cancelled!", ItemAttributesBitsEnum::Weapon}};
const char world3Name[] = "🌐 Twitterverse"; //Character array, pass to World ctor as pointer
World* world3 = new World(world3Name, "The world dedicated to Twitter", npc3, Game::Item("🎉 Verification", TWT_VERIFY, "You got verified on Twitter! 🎉", ItemAttributesBitsEnum::Special), items3);
zorkWorlds[2] = world3;
/* Generate World 4 */
Game::Npc npc4("PewDiePie", "What's going on bros welcome back to my YouTube channel. If you answer this question correctly, I will give you this key!\nAm I Swedish?", "Felaktig!", "Correct, I'm from the land of the Swedes! Here - take this key.",
{"Golden Joystick", GAMER_JOYSTICK, "The best joystick ever", ItemAttributesBitsEnum::Key}, NpcID::Gamer);
std::vector<Item> items4 = {{"Animal Crossing Fans", GAMER_ANIMAL, "The best kind of fans", 0}, {"Candy Crush Parents", GAMER_PARENTS, "All parents are professionals at the point", ItemAttributesBitsEnum::Weapon}, {"iPad Kids", GAMER_KID, "\"Do you have any games? Have you Fortnite?\"", 0}};
const char world4Name[] = "🎮 Gamer Globe"; //Character array, pass to World ctor as pointer
World* world4 = new World(world4Name, "The world dedicated to gaming", npc4, Game::Item("🎮 RGB Keyboard", GAMER_KEYBOARD, "Do you even game bro? 🎮", ItemAttributesBitsEnum::Special), items4);
zorkWorlds[3] = world4;
/* Generate World 5 */
Game::Npc npc5("Bill Gates", "Hey there! I have a key item! Just answer this one simple question...\nDid I drop out of Harvard? ...", "Nope, I actually did!", "I did, but I already had a successful product, Microsoft! Now, take the item!",
{"Skype", CODE_SKYPE, "Skype walked so Microsoft Teams could run", ItemAttributesBitsEnum::Key}, NpcID::Code);
std::vector<Item> items5 = {{"Viber", CODE_VIBER, "Remember Viber?", 0}, {"Internet Explorer", CODE_IE, "R.I.P Internet Explorer 2020", ItemAttributesBitsEnum::Weapon}, {"Nokia Snake", CODE_SNAKE, "Where is the snake now?", 0}};
const char world5Name[] = "💀 Code Graveyard"; //Character array, pass to World ctor as pointer
World* world5 = new World(world5Name, "The world dedicated to forgotten software", npc5, Game::Item("✨ Zork", CODE_ZORK, "Replaced by a Brand New and Exciting Game: Pork! ✨🌟", ItemAttributesBitsEnum::Special), items5);
zorkWorlds[4] = world5;
}
Zork::~Zork() {
for (size_t i = 0; i < zorkWorlds.size(); i++) {
World* world = zorkWorlds[i];
delete world; //delete each world. if world is a nullptr, delete is unaffected as per the C++ standard.
zorkWorlds[i] = nullptr;
}
}
World* Zork::GetCurrentWorld() const {
return curWorld;
}
void Zork::MoveNorth() {
if (curWorld == nullptr) {
throw ZorkException("MoveNorth: World does not exist");
return;
}
curWorld->MoveNorth();
}
void Zork::MoveSouth() {
if (curWorld == nullptr) {
throw ZorkException("MoveSouth: World does not exist");
return;
}
curWorld->MoveSouth();
}
void Zork::MoveEast() {
if (curWorld == nullptr) {
throw ZorkException("MoveEast: World does not exist");
return;
}
curWorld->MoveEast();
}
void Zork::MoveWest() {
if (curWorld == nullptr) {
throw ZorkException("MoveWest: World does not exist");
return;
}
curWorld->MoveWest();
}
bool Zork::SetWorld(size_t index) {
if (index <= zorkWorlds.size()) {
this->curWorld = zorkWorlds[index];
return true;
}
return false;
}
World* Zork::GetWorld(size_t index) {
if (index >= this->zorkWorlds.size()) {
return nullptr;
}
return zorkWorlds[index];
}
size_t Zork::GetWorldAmount() const { //returns size_t as its the return type of std::array::size, for consistency
return zorkWorlds.size();
}
Room* Zork::GetCurrentRoom() const {
if (this->curWorld) {
return this->curWorld->GetCurrentRoom();
}
return nullptr;
}
std::vector<Game::Item>* Zork::GetInventoryItems() {
return &this->playerInventory; //return address of the vector
}
size_t Zork::GetInventoryItemAmount() const { //returns size_t as its the return type of std::array::size, for consistency
return this->playerInventory.size();
}
bool Zork::AddItemToInventory(const Item& item) {
this->playerInventory.push_back(item);
if (this->curWorld && item.IsKey()) {
this->curWorld->CollectKeyItem();
}
return true;
}
bool Zork::RemoveItemFromInventory(const size_t index) {
if (index >= this->playerInventory.size()) {
return false;
}
this->playerInventory.erase(this->playerInventory.begin()+index); //erase takes an iterator, so we need to add index to the interator return from "begin" (begin acts as index 0)
return true;
}
bool Zork::GetItemFromInventory(const size_t index, Game::Item& item) { //returns true if successfully gets item
if (index >= this->playerInventory.size()) {
return false;
}
item = this->playerInventory[index];
return true;
}
void Zork::ClearInventory() {
this->playerInventory.clear();
}
} //namespace Game
|
bccea7f1d1f4bc90f656ffe23e15580779e9bf62
|
05749e63e400dfb2e919e2236b7f2d6ec4108f9e
|
/halley/src/stdafx.h
|
612275829879cdec9049c855115bab0a9822d17a
|
[] |
no_license
|
Aegisub/kanjimemo
|
db91f27185d04fbeb5d9b94f848d4bc444fbc873
|
a50d86cbb007ac64db900b5d6a8ed93c6e2b26ef
|
refs/heads/master
| 2016-09-05T18:08:57.895036
| 2012-08-09T20:14:39
| 2012-08-09T20:14:39
| 5,360,803
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 166
|
h
|
stdafx.h
|
#include <wx/wxprec.h>
#include <map>
#include <vector>
#include <list>
#include <string>
#include <SDL.h>
#include <SDL_opengl.h>
#undef rad1
#undef rad2
|
d6da140239b9e320e88fb15de9212df7c2ab0e4e
|
6f8176e2f5f9e459fd7c40bd9f7f1d9ea3f9eaeb
|
/Ch11AppE04.cpp
|
bec6fe5e4feef376ed81e13f9fbb30e8c51057a4
|
[] |
no_license
|
LewisAndClark-CSD/Cpp5th
|
cfcab8b78bea4ea2bfa740a2c851b9f86ea8f043
|
492c8cfbee088c0b3abb06f75c47e08b6215f328
|
refs/heads/master
| 2021-05-27T12:38:01.335017
| 2014-11-04T16:09:37
| 2014-11-04T16:09:37
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 445
|
cpp
|
Ch11AppE04.cpp
|
//Ch11AppE04.cpp
//Updates the prices stored in a one-dimensional array
//Created/revised by <your name> on <current date>
#include <iostream>
#include <iomanip>
using std::cout;
using std::cin;
using std::endl;
using std::fixed;
using std::setprecision;
int main()
{
cout << fixed << setprecision(2);
//declare array
double prices[10] = {10.5, 25.5, 9.75, 6.0, 35.0, 100.4, 10.65, .56, 14.75, 4.78};
return 0;
} //end of main function
|
918aea8c366b19e321acde7629c18c468001490c
|
15e69e7b247e219a8bc89f1f6a1da18ff4d1cdaf
|
/03 从尾到头打印链表.cpp
|
856751a2d555e01742adc00d264322fcc7abb9c0
|
[] |
no_license
|
liangzai90/Coding-Interviews
|
dd6470fb4a9b5f5edef8510948028b3bb71dcfbc
|
c07bfd6d2d1716d11f19b829f8e24318bffb7234
|
refs/heads/master
| 2020-09-01T15:45:40.251186
| 2017-04-28T06:55:08
| 2017-04-28T06:55:08
| null | 0
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 467
|
cpp
|
03 从尾到头打印链表.cpp
|
//3、输入一个链表,从尾到头打印链表每个节点的值。
struct ListNode {
int val;
struct ListNode *next;
ListNode(int x) :
val(x), next(NULL) {
}
};
class Solution {
public:
vector<int> printListFromTailToHead(ListNode* head) {
vector<int> val;
ListNode* currentNode = head;
while (currentNode != NULL)
{
val.insert(val.begin(), currentNode->val);
currentNode = currentNode->next;
}
return val;
}
};
|
5ed80b85da01b0b20cae2902555203b144c43871
|
44289ecb892b6f3df043bab40142cf8530ac2ba4
|
/Sources/Elastos/Frameworks/Droid/DevSamples/jpk/JSGallery2/elastos/devsamples/node/jsgallery3d/CNodeApp.cpp
|
e3fe0737a2dd6a5ff4c70723b80bc13d0d5ec75d
|
[
"Apache-2.0"
] |
permissive
|
warrenween/Elastos
|
a6ef68d8fb699fd67234f376b171c1b57235ed02
|
5618eede26d464bdf739f9244344e3e87118d7fe
|
refs/heads/master
| 2021-01-01T04:07:12.833674
| 2017-06-17T15:34:33
| 2017-06-17T15:34:33
| 97,120,576
| 2
| 1
| null | 2017-07-13T12:33:20
| 2017-07-13T12:33:20
| null |
UTF-8
|
C++
| false
| false
| 212
|
cpp
|
CNodeApp.cpp
|
#define JSActName CAppGalleryAppImpl
#include "CNodeApplication_impl.h"
#define JSActName CAppMovieActivity
#include "CNodeActivity_impl.h"
#define JSActName CAppGalleryActivity
#include "CNodeActivity_impl.h"
|
c06f2c7b1f58fcb051ef2114d1386423ba276d45
|
a95d068549aea5e5b9a2f5606106d8575af9ecd5
|
/Solved/3182.cpp
|
74024150194e26c4defd69583e990d8710eaffee
|
[] |
no_license
|
cstrnull00/baekjoon
|
1ba40fa0a1b81c76c464908c2572001acb4ad60a
|
b91db6c99ebdc9a500af27efce1e71032a8d97b2
|
refs/heads/main
| 2023-07-19T22:52:07.930285
| 2021-09-01T12:25:59
| 2021-09-01T12:25:59
| 330,640,166
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 767
|
cpp
|
3182.cpp
|
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
void list_clear(int* origin, vector<int>* arr, int n) {
if (arr->size() != 0)
for (int i = 0; i < n; i++)
arr->pop_back();
for (int i = 0; i < n; i++)
arr->push_back(origin[i]);
}
int main() {
int N, max = 0, temp, ans = 0, index, cnt = 0;
cin >> N;
int *senpai = new int[N];
vector<int> list;
for (int i = 0; i < N; i++)
scanf("%d", &senpai[i]);
for (int i = 0; i < N; i++) {
list_clear(senpai, &list, N);
index = i + 1;
while (list.at(index - 1) != -1) {
temp = index;
index = list.at(index - 1);
cnt++;
list.at(temp - 1) = -1;
}
if (cnt > max) {
max = cnt;
ans = i + 1;
}
cnt = 0;
}
cout << ans;
delete[] senpai;
return 0;
}
|
49a48871d1a1c4d9f79435c894db7095abb0a6fa
|
1cfa70f861279ca3acd1e982faa29937b3027e26
|
/Board.cpp
|
97877715af1cd185b7105baff70955dfc2aed8dd
|
[] |
no_license
|
dasv/OOPChess
|
1d6ac117180d705b5bf9216e9b872be975a979fa
|
21be218cd4848805c2c85f1c05591e64f534d546
|
refs/heads/master
| 2021-01-14T14:32:52.037327
| 2016-01-26T05:26:21
| 2016-01-26T05:26:21
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,200
|
cpp
|
Board.cpp
|
/*
* Board.cpp
*
* This class implements a Board class for a variety of games.
*
* Author: David M. Hansen
* Written: 10/5/2004
*
*/
#include "Board.h"
#include "Square.h"
// Constructors
// Default constructor
Board::Board(int dimension)
{
// Create a vector of squares as a template that we can then copy
// into our _board attribute, effectively populating the board with
// copies of this row of squares
vector<Square> rowTemplate(dimension);
for (int i=0; i < dimension; i++)
{
_squares.push_back(rowTemplate);
}
for (int i=0; i < dimension; i++)
{
for (int j=0; j < dimension; j++) {
Square* newSquare = new Square(i, j);
_squares[i][j] = *newSquare;
}
}
}
// Destructor
Board::~Board()
{
}
// Accessors
// Return the square at x,y
Square& Board::squareAt(int x, int y)
{
return _squares.at(x).at(y);
}
// Check for clear verticle
bool Board::isClearVerticle(Square& from, Square& to) const
{
bool isClear = true;
// variable to hold the direction that the loop should iterate in
// (black side of the board to white or vice versa)
int direction = 1;
if (from.getX() > to.getX())
{
direction = -1;
}
// Iterate through all the squares between from and to
// starting at the square that is one away from the from square
// and toward the to square
// then stopping at the square right before the to square
for (int i = 1; i < abs(from.getX() - to.getX()); i++)
{
// If there is a square that is occupied
// the verticle is not clear
if (Board::getBoard().squareAt(from.getX() + i * direction,
from.getY()).occupied())
{
isClear = false;
}
}
return isClear;
}
// Check for clear horizontal
bool Board::isClearHorizontal(Square& from, Square& to) const
{
bool isClear = true;
// variable to hold the direction that the loop should iterate in
// (black side of the board to white or vice versa)
int direction = 1;
if (from.getY() > to.getY())
{
direction = -1;
}
// Iterate through all the squares between from and to
// starting at the square that is one away from the from square
// and toward the to square
// then stopping at the square right before the to square
for (int i = 1; i < abs(from.getY() - to.getY()); i++)
{
// If there is a square that is occupied
// the verticle is not clear
if (Board::getBoard().squareAt(from.getX(),
from.getY()
+ i * direction).occupied())
{
isClear = false;
}
}
return isClear;
}
// Check for clear diagonal
bool Board::isClearDiagonal(Square& from, Square& to) const
{
bool isClear = true;
// variable to hold the direction that the loop should iterate in
// (black side of the board to white or vice versa)
int xDirection = 1;
int yDirection = 1;
if (from.getX() > to.getX())
{
xDirection = -1;
}
if (from.getY() > to.getY())
{
yDirection = -1;
}
// Iterate through all the squares between from and to
// starting at the square that is one away from the from square
// and toward the to square
// then stopping at the square right before the to square
for (int i = 1; i < abs(from.getY() - to.getY()); i++)
{
// If there is a square that is occupied
// the verticle is not clear
if (Board::getBoard().squareAt(from.getX() + i * xDirection,
from.getY()
+ i * yDirection).occupied())
{
isClear = false;
}
}
return isClear;
}
// Display the board
void Board::display(ostream& output) const
{
output << " a b c d e f g h " << endl;
output << " ";
for (int i = 0; i < getDimension(); i++)
{
output << "----";
}
output << endl;
for (int j = 0; j < getDimension(); j++)
{
output << (8 - j) << " ";
for (int k = 0; k < getDimension(); k++)
{
_squares[j][k].display(output);
}
output << " " << (8 - j);
output << endl;
output << " ";
for (int l = 0; l < getDimension(); l++)
{
output << "----";
}
output << endl;
}
output << " a b c d e f g h " << endl;
}
// Get the reference to The Board
Board& Board::getBoard()
{
return _theBoard;
}
// Return dimensions of the board
int Board::getDimension() const
{
// Return the size of the board as the dimension
return _squares.size();
}
// Print the board
ostream& operator<< (ostream& output, const Board& board)
{
// Simply call our display method
board.display(output);
return output;
}
// Fixed size of the board - change this value to use a different size
// board
const int Board::_DIMENSION = 8;
Board Board::_theBoard;
|
4fd0d13fabc0353e408986ec52c93582b609af75
|
54173a065504ee27204d2dd4881ae93b3cc557c1
|
/Commands/RequestPlayersCommand.h
|
6dcb814ffc4ebcddfe2caaf6118ecc6c81dd1da6
|
[] |
no_license
|
arturstaszczyk/QTourneyManager
|
71e99702ab7cb5b4cbc43aec7dbeb479b7531e96
|
620ed286f29f582b51a4a2f04eac16cc45db4d9f
|
refs/heads/master
| 2021-01-17T22:12:11.584136
| 2016-08-02T20:19:16
| 2016-08-02T20:19:16
| 63,812,240
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 506
|
h
|
RequestPlayersCommand.h
|
#ifndef REQUESTPLAYERSCOMMAND_H
#define REQUESTPLAYERSCOMMAND_H
#include "Command.h"
#include <QJsonObject>
#include <QNetworkReply>
class RequestPlayersCommand : public Command
{
Q_OBJECT
public:
explicit RequestPlayersCommand(QString hostAddress, QObject* parent = nullptr);
void execute() override;
public slots:
void onHttpPlayersGet(QNetworkReply* reply);
signals:
void playerParsed(QJsonObject);
private:
QString mHostAddress;
};
#endif // REQUESTPLAYERSCOMMAND_H
|
08d72d3c8f8c16f80886eef754530e348dbb4ad2
|
3eed3c222aa15765e38573a9a2fedf17c04b8a06
|
/algorithms/DP sums/longest-bitonic-sequence.cpp
|
bb31ec36cd2844893a9e9b71a9c286923cec855b
|
[] |
no_license
|
ManoharGovind/algorithms
|
6d1e05229dbdc51c08a382ba413ed52926c68cdf
|
b56b84c34feffe1ffd0e7555152a433729ac790b
|
refs/heads/master
| 2022-06-14T05:27:08.531026
| 2020-05-11T18:04:28
| 2020-05-11T18:04:28
| 197,895,382
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 824
|
cpp
|
longest-bitonic-sequence.cpp
|
// longest bitonic sequence
#include <bits/stdc++.h>
#define usl unsigned long long int
#define lli long long int
#define mod 1000000007
using namespace std;
int main(){
int n,i,j;
cin>>n;
int a[n];
for(i=0;i<n;i++)
cin>>a[i];
int mx=0;
int b[n],c[n];
//memset(c,1,n*sizeof(c));
//memset(b,1,n*sizeof(b));
b[0]=1,c[n-1]=1;
for(i=1;i<n;i++){
b[i]=1;
for(j=0;j<i;j++){
if(a[i]>a[j]){
b[i]=max(b[i],1+b[j]);
}
}
}
for(i=n-2;i>=0;i--){
c[i]=1;
for(j=n-1;j>i;j--){
if(a[i]>a[j]){
c[i]=max(c[i],1+c[j]);
}
}
}
for(i=0;i<n;i++){
// cout<<b[i]<<" "<<c[i]<<"\n";
mx=max(mx,b[i]+c[i]-1);
}
cout<<mx;
}
|
f70cd365283b6dc3fe16e5885629cf9e5b374a06
|
a2fc06cf458f896d2217592ac92098863e755a9c
|
/src/library/tracker/trackcore.cpp
|
2e55eb1c562838f8b70d51d7e36ec66c18adb79a
|
[] |
no_license
|
MrBrood/Stanford-Junior-self-driving-car
|
ba3f2a07a9366d3566def59fd25f90bad55748d2
|
d999e94bb287933666dac82129cad6702923a8e1
|
refs/heads/master
| 2023-07-18T04:56:02.055754
| 2020-08-21T01:31:46
| 2020-08-21T01:31:46
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 6,514
|
cpp
|
trackcore.cpp
|
#include <roadrunner.h>
#include <lltransform.h>
#include <ipc_interface.h>
#include <gls_interface.h>
#include "trackcore.h"
#include "projected_scan.h"
using std::vector;
using namespace dgc;
int point_count = 0;
int use_count = 0;
LaserTracker::LaserTracker(RndfLookup *rl,
SensorManager *sensorManager)
{
this->sensorManager = sensorManager;
this->rl = rl;
ptsProcessed = 0;
useTracker = 1;
groundLevel = -DGC_PASSAT_APPLANIX_ORIGIN_HEIGHT;
sendMessages = false;
}
void
LaserTracker::drawRndfMask()
{
Vec2 bot2=robotPos;
double reso=0.5; //grid resolution
int radius=100; //meters
int steps=(int)(radius/reso); //number of grids
for(int gx=-steps; gx<steps; gx++) {
for(int gy=-steps; gy<steps; gy++) {
Vec2 pos(gx*reso, gy*reso);
Vec2 wPt=pos; wPt.add(bot2);
if (rl->closeToRoad(wPt)) {
glsColor3f(lasertrack_gls, 0.7,0.7,0.7);
} else {
glsColor3f(lasertrack_gls, 0.3,0.3,0.3);
}
draw2DCell(pos, 0.5);
}
}
}
void
LaserTracker::draw2DCell( const Vec2 &pos, double resolution )
{
glsBegin(lasertrack_gls, GLS_QUADS);
double zVal = groundLevel - 0.1;
Vec2 p1 = pos;
Vec2 p2 = p1;
p2.v[0] += resolution;
p2.v[1] += resolution;
glsVertex3f(lasertrack_gls, p1.v[0],p1.v[1],zVal);
glsVertex3f(lasertrack_gls, p2.v[0],p1.v[1],zVal);
glsVertex3f(lasertrack_gls, p2.v[0],p2.v[1],zVal);
glsVertex3f(lasertrack_gls, p1.v[0],p2.v[1],zVal);
glsEnd(lasertrack_gls);
}
void
LaserTracker::gls_render()
{
for(int i=0; i<(signed)sensorManager->sensorList.size(); i++) {
SensorRecord *sr = sensorManager->sensorList[i];
if (!sr->display) continue;
if (lasertrack_vars.showScans && sr->scan) sr->scan->gls_render();
if(lasertrack_vars.showObstacles && useTracker) {
glsPushMatrix(lasertrack_gls);
glsTranslatef(lasertrack_gls, 0, 0, groundLevel + 1);
sr->tracker->gls_render(lasertrack_vars.displayAllCars,
lasertrack_vars.displayInter);
glsPopMatrix(lasertrack_gls);
}
}
if (lasertrack_vars.showRndfMask) drawRndfMask();
}
void
LaserTracker::update( PerceptionRobotPose *pose,
int sensorId, void *sensorMsg,
lasertrack_flags_t &flags )
{
/* update everything with the latest pose */
localizeOffset.set(pose->localize.x_offset, pose->localize.y_offset);
rl->update_localize_offset(localizeOffset);
robotPos.set(pose->pose.x, pose->pose.y);
/* update cached projected scans */
SensorRecord *sr = sensorManager->updateSensor(sensorId, pose, sensorMsg);
#ifdef VERBOSE
cout << endl;
Timer utm("TOTAL");
#endif
/* swap previous and current angle grids, clear marked points
from previous grid, and empty current grid */
projected_scan *scan = sr->scan;
Vec2 vantagePt(scan->laserPos.v[0], scan->laserPos.v[1]);
AngleGrid *ag = sr->agPrev;
AngleGrid *agPrev = sr->ag;
sr->ag = ag;
sr->agPrev = agPrev;
agPrev->unmarkClearedPoints();
ag->clear();
ag->set_robot_pose(vantagePt, scan->laserOri.v[0], scan->timestamp);
/* update tracker bookkeeping */
Tracker *tracker = sr->tracker;
tracker->doTracking = flags.doTracking;
tracker->doGlobalSearch = flags.doGlobalSearch;
tracker->vantagePoint = scan->laserPos;
tracker->ag = ag;
tracker->agPrev = agPrev;
if(useTracker) {
tracker->set_robot_pose(scan->robotPos, scan->robotOri,
scan->timestamp, localizeOffset);
sensorManager->replicateMaturePFs(sensorId);
}
/* mark points that indicate motion */
if(true) {
#ifdef VERBOSE
Timer ptsTm("add-laser-points");
#endif
ptsProcessed = 0;
for(int i = 0; i < scan->num_points; i++)
if(scan->point[i].use) {
Vec2 pt(scan->point[i].x, scan->point[i].y);
if (tracker->junior->externalDist(pt)<1) {
scan->point[i].use=0;
continue;
}
ag->addPoint(pt, scan->point + i);
ptsProcessed++;
use_count++;
}
point_count += scan->num_points;
ag->markClearedPoints(agPrev);
agPrev->markClearedPoints(ag);
}
if(useTracker) {
/* Run the car tracker */
tracker->update(scan->timestamp);
/* classify the original data points */
if(true) {
#ifdef VERBOSE
Timer ptListTm("gen-point-lists");
#endif
for(int i = 0; i < scan->num_points; i++)
if(scan->point[i].use) {
Vec2 pt(scan->point[i].x, scan->point[i].y);
tracker->addObstaclePoint(pt);
}
}
}
// fprintf(stderr, "Points %d total %d used - %d rndf lookups %d true\n",
// point_count, use_count, rl->rndf_count, rl->true_rndf_count);
/* publish IPC obstacle message */
// tracker->generateDynObsList();
makeCombinedMessage();
if (sendMessages) publish_output();
}
void
LaserTracker::makeCombinedMessage() {
DynObsMsgList lst;
for(int i=0; i<(signed)sensorManager->sensorList.size(); i++) {
SensorRecord *sr = sensorManager->sensorList[i];
//add dynamic obs messages
for(int j=0; j<sr->tracker->maturePF.size(); j++) {
DynObsMsg msg;
sr->tracker->maturePF.get(j)->mean->toMsg(&msg);
lst.push_back(msg);
}
//add static obs messages
for(int j=0; j<(signed)(sr->tracker->staticObsList.size()); j++) {
bool addThisObs=true;
Vec2 loc=sr->tracker->staticObsList[j]->origin;
for(int k=0; k<(signed)sensorManager->sensorList.size(); k++) {
DOPFList *maturePF = &(sensorManager->sensorList[k]->tracker->maturePF);
for(int m=0; m< maturePF->size(); m++) {
if (maturePF->get(m)->mean->nearbyPoint(loc) != DO_FAR) {
addThisObs=false;
break;
}
}
if (!addThisObs) break;
}
if (!addThisObs) continue;
DynObsMsg msg;
sr->tracker->staticObsList[j]->toMsg(&msg);
lst.push_back(msg);
}
}
make_msg(lst);
}
void
LaserTracker::make_msg(DynObsMsgList &lst)
{
static vector< PerceptionDynamicObstacle > obsList;
static vector< vector< ObstaclePoint > > ptLists;
static int first=1;
if(first) {
strncpy(msg.host, dgc_hostname(), 10);
first = 0;
}
obsList.clear();
msg.num_obstacles = (signed)lst.size();
for(int i=0; i<(signed)lst.size(); i++) {
PerceptionDynamicObstacle obs = lst[i].msg;
obsList.push_back(obs);
}
msg.obstacle = &(obsList[0]);
}
void
LaserTracker::publish_output()
{
IPC_RETURN_TYPE err;
err = IPC_publishData(DGC_PERCEPTION_OBSTACLELIST_NAME, &msg);
dgc_test_ipc_exit(err, "Could not publish",
DGC_PERCEPTION_OBSTACLELIST_NAME);
}
|
eb1fbec47f3f361593ae9b0fb58fea5a9888dc89
|
37853435f14557740f4147586150d70aeab80f5c
|
/EventMarket/FedEventSender.cpp
|
074c2d9e89c86a4205641ecefb4e7f85ce991f22
|
[] |
no_license
|
rhzg/GERTICO
|
7e1f399e96989c1606a991a8c8ff5e1fc326a70f
|
1bc6642f5fbb447cbd90ccadafc1bcf4debf5f48
|
refs/heads/master
| 2020-07-26T20:56:26.577367
| 2019-09-16T09:45:00
| 2019-09-16T09:45:00
| 208,763,474
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 27,151
|
cpp
|
FedEventSender.cpp
|
/*******************************************************************************
**
** Copyright (c) Fraunhofer IOSB
** All rights reserved.
**
** FedEventSender.cpp
**
*******************************************************************************/
#include "FedEventSender.h"
#include "Util/GeRtiTypes.h"
#include "Util/Mapper.h"
#include <iostream>
/********************************** Gal begin ***************************************/
#ifdef GalDebug
#include "Gal/StdAfx.h"
#include "Gal/repository.h"
#include "Gal/event.h"
static class Repository_l *r=(Repository::getSingleInstance())->getRepository_l("GeRtiEC.res","GeRtiEC");
static class Event *GeRti_EC_d=r->getRefEvent("GeRti_EC_d");
static class Event *GeRti_EC_e=r->getRefEvent("GeRti_EC_e");
static class Event *GeRti_EC_i=r->getRefEvent("GeRti_EC_i");
static class Event *GeRti_EC_w=r->getRefEvent("GeRti_EC_w");
#endif
/********************************** Gal end ***************************************/
#define MAX_TXT 2048
static char galMsg[MAX_TXT];
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
GERTICO::RtiHubEvent::RtiHubEvent(GeRtiFactory::GeRtiHandle const &theSourceType)
{
pushEvent = NULL;
sourceType = theSourceType;
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
GERTICO::RtiHubEvent::~RtiHubEvent(void)
{
if (pushEvent == NULL)
{
delete pushEvent;
}
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
GERTICO::FedEventSender::FedEventSender(GeRtiFactory::GeRtiHandle const &theFederate, GERTICO::InteractionMap &theInteractionMap, GERTICOconf const &theGERTICOconf, GERTICO::GeRtiFedTimeFactory &theGeRtiFedTimeFactory, ACE_Semaphore &thePs) : ps(thePs), geRtiFedTimeFactory(theGeRtiFedTimeFactory), interactionMap(theInteractionMap), GERTICOconfRef(theGERTICOconf)
{
deleted = false;
firstESender = true;
haveOverload = false;
federate = theFederate;
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
GERTICO::FedEventSender::~FedEventSender(void)
{
GERTICO::GeRtiTimeMap::iterator itm;
GERTICO::GeRtiTimeVector geRtiTimeVector;
GERTICO::RtiHubEvent *geRtiEvent;
GERTICO::RtiHubEventVector *eventPtr;
GERTICO::RtiHubEventVector::iterator itGeRtiEventVector;
eventPtr = f_getEvents(true, true);
for (itGeRtiEventVector = eventPtr->begin(); itGeRtiEventVector != eventPtr->end(); itGeRtiEventVector = eventPtr->begin())
{
geRtiEvent = *itGeRtiEventVector;
eventPtr->erase(itGeRtiEventVector);
}
eventPtr = f_getEvents(true, false);
for (itGeRtiEventVector = eventPtr->begin(); itGeRtiEventVector != eventPtr->end(); itGeRtiEventVector = eventPtr->begin())
{
geRtiEvent = *itGeRtiEventVector;
eventPtr->erase(itGeRtiEventVector);
}
toggleFirstESender();
eventPtr = f_getEvents(true, true);
for (itGeRtiEventVector = eventPtr->begin(); itGeRtiEventVector != eventPtr->end(); itGeRtiEventVector = eventPtr->begin())
{
geRtiEvent = *itGeRtiEventVector;
eventPtr->erase(itGeRtiEventVector);
}
eventPtr = f_getEvents(true, false);
for (itGeRtiEventVector = eventPtr->begin(); itGeRtiEventVector != eventPtr->end(); itGeRtiEventVector = eventPtr->begin())
{
geRtiEvent = *itGeRtiEventVector;
eventPtr->erase(itGeRtiEventVector);
}
delete proxyPushSupplierReliable;
pm.acquire();
for (itm = times.begin(); itm != times.end(); itm = times.begin())
{
GERTICO::GeRtiFedTime *geRtiFedTimePtr;
geRtiFedTimePtr = itm->first;
times.erase(itm);
delete geRtiFedTimePtr;
}
pm.release();
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
void GERTICO::FedEventSender::addEvent(GeRtiFactory::GeRtiEvent const &theGeRtiEvent, GeRtiFactory::GeRtiHandle const &theSourceType, GERTICO::HandleSet &theDesiredAttributes)
{
GERTICO::HandleSet regions;
GERTICO::HandleSet::iterator itRegion;
GERTICO::RtiHubEventVector *eventPtr;
bool reliableFlag;
unsigned long numberOfItems;
if (theGeRtiEvent.bestEffort)
{
reliableFlag = false;
}
else
{
reliableFlag = true;
}
// The first "e" is sender, the second will get new event.
eventPtr = f_getEvents(false, reliableFlag);
// Add the event at the end of the vector.
GERTICO::RtiHubEvent *newEvent = new GERTICO::RtiHubEvent(theSourceType);
newEvent->pushEvent = new GeRtiFactory::PushEvent();
numberOfItems = fillEvent(*newEvent->pushEvent, theGeRtiEvent, theDesiredAttributes);
if (numberOfItems == 0)
{
// Zero parameter count is allowed for Interactions.
if (theGeRtiEvent.type == GeRtiFactory::obj)
{
// Do not want event.
delete newEvent;
return;
}
}
eventPtr->push_back(newEvent);
// #ifdef GalDebug // inserted by Gal converter
// E1mBegin(GeRti_EC_w)
// {
// sprintf(galMsg, "Event_vector_size:=%lu", eventPtr->size());
// E2(GeRti_EC_w, "addEvent", galMsg);
// }
// #endif // inserted by Gal converter
checkOverload();
if (eventPtr->size() > 100)
{
ACE_Thread::yield();
// ACE_OS::sleep(ACE_Time_Value(0,1000));
}
if (eventPtr->size() > 200)
{
ACE_Thread::yield();
// ACE_OS::sleep(ACE_Time_Value(0,4000));
}
addTime(theGeRtiEvent.timestamp);
}
// ---------------------------------------------------------------------------
// Fill event.
// ---------------------------------------------------------------------------
CORBA::ULong GERTICO::FedEventSender::fillEvent(GeRtiFactory::PushEvent &theGeRtiEventOut, GeRtiFactory::GeRtiEvent const &theGeRtiEvent, GERTICO::HandleSet &theDesiredAttributes)
{
GeRtiFactory::GeRtiEvent e;
CORBA::ULong indData;
CORBA::ULong j;
CORBA::ULong k;
CORBA::ULong lengthj;
CORBA::ULong lengthk;
e.type = theGeRtiEvent.type;
e.source = theGeRtiEvent.source;
e.theSerialNumber = theGeRtiEvent.theSerialNumber;
e.timestamp.length(theGeRtiEvent.timestamp.length());
e.timestamp = theGeRtiEvent.timestamp;
lengthj = theGeRtiEvent.data.length();
// Set maximum buffer length.
e.data.length(lengthj);
// Reset maximum buffer length.
e.data.length(0);
for (j = 0, indData = 0; j < lengthj; j++)
{
if (theGeRtiEvent.type == GeRtiFactory::obj)
{
if (theGeRtiEvent.obj)
{
if (wantAttribute(theGeRtiEvent.data[j].id, theDesiredAttributes) == false)
{
continue;
}
}
}
// Set used buffer length.
e.data.length(indData + 1);
e.data[indData].id = theGeRtiEvent.data[j].id;
e.data[indData].timestampOrder = theGeRtiEvent.data[j].timestampOrder;
e.data[indData].bestEffort = theGeRtiEvent.data[j].bestEffort;
lengthk = theGeRtiEvent.data[j].value.length();
e.data[indData].value.length(lengthk);
for (k = 0; k < lengthk; k++)
{
e.data[indData].value[k] = theGeRtiEvent.data[j].value[k];
}
indData += 1;
}
e.theTag = theGeRtiEvent.theTag;
e.obj = theGeRtiEvent.obj;
e.reg = theGeRtiEvent.reg;
e._cxx_class = theGeRtiEvent._cxx_class;
e.bestEffort = theGeRtiEvent.bestEffort;
theGeRtiEventOut.e(e);
return indData;
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
bool GERTICO::FedEventSender::wantAttribute(CORBA::ULong const &theEventAttribute, GERTICO::HandleSet const &theSubscriberAttributes)
{
GERTICO::HandleSet::const_iterator itSubscriberAttribute;
bool ret = false;
itSubscriberAttribute = theSubscriberAttributes.find(theEventAttribute);
if (itSubscriberAttribute != theSubscriberAttributes.end())
{
ret = true;
}
return ret;
}
// ---------------------------------------------------------------------------
// Logic to keep track of the timestamps of each event in the
// sequence.
// ---------------------------------------------------------------------------
void GERTICO::FedEventSender::addTime(GeRtiFactory::Time const &theTime)
{
GERTICO::GeRtiFedTime *tmpFedTime = NULL;
GeRtiTimeMap::iterator ita;
unsigned int dummy = 1;
// Do not have a timestamp: ignore!
if (theTime.length() == 0)
{
return;
}
GERTICO::ConvertTime::mapItGeRtiFedTime(geRtiFedTimeFactory, &tmpFedTime, theTime);
pm.acquire();
ita = times.find(tmpFedTime);
if (ita != times.end())
{
ita->second++;
}
else
{
times[tmpFedTime] = dummy;
}
pm.release();
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
void GERTICO::FedEventSender::addDmEvent(GeRtiFactory::GertiDmEvent const &theGertiDmEvent)
{
GERTICO::RtiHubEventVector *eventPtr;
GeRtiFactory::GeRtiHandle sourceType = 1;
GeRtiFactory::GertiTmEvent gertiTmEvent;
// The first "e" is sender, the second will get new event.
eventPtr = f_getEvents(false, true);
// Add the event at the end of the vector.
GERTICO::RtiHubEvent *newEvent = new GERTICO::RtiHubEvent(sourceType);
newEvent->pushEvent = new GeRtiFactory::PushEvent();
newEvent->pushEvent->dmEvent(theGertiDmEvent);
eventPtr->push_back(newEvent);
ps.release();
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
void GERTICO::FedEventSender::addTmEvent(GeRtiFactory::GertiTmEvent const &theGertiTmEvent)
{
GERTICO::RtiHubEventVector *eventPtr;
GeRtiFactory::GeRtiHandle sourceType = 1;
GeRtiFactory::GertiTmEvent gertiTmEvent;
// The first "e" is sender, the second will get new event.
eventPtr = f_getEvents(false, true);
// Add the event at the end of the vector.
GERTICO::RtiHubEvent *newEvent = new GERTICO::RtiHubEvent(sourceType);
newEvent->pushEvent = new GeRtiFactory::PushEvent();
newEvent->pushEvent->tmEvent(theGertiTmEvent);
eventPtr->push_back(newEvent);
ps.release();
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
void GERTICO::FedEventSender::checkOverload(void)
{
#ifdef GalDebug // inserted by Gal converter
E1mBegin(GeRti_EC_w)
{
size_t size0;
size_t size1;
size0 = eVector[0].size();
size1 = eVector[1].size();
if (size0 > 100 || size1 > 100)
{
if (haveOverload == false)
{
strcpy(galMsg, "Overload_true");
E2(GeRti_EC_w, "checkOverload", galMsg);
haveOverload = true;
}
}
else
{
if (haveOverload)
{
strcpy(galMsg, "Overload_false");
E2(GeRti_EC_w, "checkOverload", galMsg); // inserted by Gal converter
haveOverload = false;
}
}
}
#endif // inserted by Gal converter
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
void GERTICO::FedEventSender::clear(void)
{
firstESender = true;
haveOverload = false;
}
// ---------------------------------------------------------------------------
//Return a pointer to the current event sequence to send.
// ---------------------------------------------------------------------------
GERTICO::RtiHubEventVector *GERTICO::FedEventSender::f_getEvents(bool const &isSender, bool const &theReliable)
{
GERTICO::RtiHubEventVector *eventPtr;
pm.acquire();
if (theReliable)
{
if (firstESender)
{
if (isSender)
{
eventPtr = &eVector[1];
}
else
{
eventPtr = &eVector[0];
}
}
else
{
if (isSender)
{
eventPtr = &eVector[0];
}
else
{
eventPtr = &eVector[1];
}
}
}
else
{
if (firstESender)
{
if (isSender)
{
eventPtr = &eVectorBestEffort[1];
}
else
{
eventPtr = &eVectorBestEffort[0];
}
}
else
{
if (isSender)
{
eventPtr = &eVectorBestEffort[0];
}
else
{
eventPtr = &eVectorBestEffort[1];
}
}
}
pm.release();
return eventPtr;
}
// ---------------------------------------------------------------------------
// Send the event sequence.
// ---------------------------------------------------------------------------
void GERTICO::FedEventSender::sendEvents(GERTICO::RtiHubEventVector &theGeRtiEventVector, bool const &theReliable)
{
CORBA::Long d;
CORBA::ULong length;
GERTICO::RtiHubEventVector::iterator itGeRtiEventVector;
GERTICO::RtiHubEventVector::iterator itGeRtiEventTestVector;
GeRtiFactory::GertiPushEvent gertiPushEvent;
GERTICO::RtiHubEvent *geRtiEventPtr;
bool gotEnough = false;
size_t size;
unsigned long i;
unsigned long indx = 0;
unsigned long lenData;
unsigned long sendLength = 0;
unsigned long testLength;
size = theGeRtiEventVector.size();
GERTICO::Mapper::mapULongSizet(length, size);
if (length == 0)
{
// No event to send.
return;
}
gertiPushEvent.e.length(length);
gertiPushEvent.e.length(0);
// Make sure to process all events.
for (itGeRtiEventVector = theGeRtiEventVector.begin(); itGeRtiEventVector != theGeRtiEventVector.end(); itGeRtiEventVector = theGeRtiEventVector.begin())
{
// Have a conditional loop until enough length found - have built-in lookahead logic.
for (itGeRtiEventTestVector = theGeRtiEventVector.begin(); itGeRtiEventTestVector != theGeRtiEventVector.end(); itGeRtiEventTestVector = theGeRtiEventVector.begin())
{
geRtiEventPtr = *itGeRtiEventTestVector;
d = geRtiEventPtr->pushEvent->_d();
switch(d)
{
case 0:
{
testLength = 0;
lenData = geRtiEventPtr->pushEvent->e().data.length();
for (i = 0; i < lenData; i++)
{
testLength += geRtiEventPtr->pushEvent->e().data[i].value.length();
}
if (GERTICOconfRef.dataLength != 0 && GERTICOconfRef.dataLength != 1)
{
if (sendLength + testLength < GERTICOconfRef.dataLength)
{
// Have more capacity, try for more.
gertiPushEvent.e.length(indx + 1);
gertiPushEvent.e[indx] = *geRtiEventPtr->pushEvent;
indx += 1;
theGeRtiEventVector.erase(itGeRtiEventTestVector);
delete geRtiEventPtr;
sendLength += testLength;
continue;
}
}
gotEnough = true;
sendLength += testLength;
break;
}
case 1:
{
// Take the event eg. as piggyback.
break;
}
case 2:
{
// Take the event eg. as piggyback.
break;
}
case 3:
{
// Take the event eg. as piggyback.
break;
}
case 4:
{
// Take the event eg. as piggyback.
break;
}
}
gertiPushEvent.e.length(indx + 1);
gertiPushEvent.e[indx] = *geRtiEventPtr->pushEvent;
indx += 1;
theGeRtiEventVector.erase(itGeRtiEventTestVector);
delete geRtiEventPtr;
if (gotEnough)
{
break;
}
}
try
{
#ifdef GalDebug // inserted by Gal converter
E1mBegin(GeRti_EC_d)
{
unsigned int ind;
unsigned int indItem;
unsigned long lenItems;
unsigned long ul;
unsigned long ul1;
unsigned long ul2;
sprintf(galMsg, "numberOfEvents=%lu", length);
E2(GeRti_EC_d, "sendEvents", galMsg);
for (ind = 0; ind < length; ind++)
{
d = gertiPushEvent.e[ind]._d();
switch(d)
{
case 0:
{
ul = gertiPushEvent.e[ind].e().source;
ul1 = gertiPushEvent.e[ind].e()._cxx_class;
ul2 = gertiPushEvent.e[ind].e().obj;
if (gertiPushEvent.e[ind].e().type == GeRtiFactory::obj)
{
sprintf(galMsg, "source=%lu,class=%lu,object=%lu,update", ul, ul1, ul2);
}
else
{
sprintf(galMsg, "source=%lu,class=%lu,interaction", ul, ul1);
}
E2(GeRti_EC_d, "sendEvents", galMsg); // inserted by Gal converter
lenItems = gertiPushEvent.e[ind].e().data.length();
for (indItem = 0; indItem < lenItems; indItem++)
{
GERTICO::Mapper::printAttributeHandleValue("pushData=", galMsg, gertiPushEvent.e[ind].e().data[indItem]);
E2(GeRti_EC_d, "sendEvents", galMsg); // inserted by Gal converter
}
break;
}
case 1:
{
long l;
l = gertiPushEvent.e[ind].tmEvent().service;
break;
}
}
}
}
#endif // inserted by Gal converter
if (theReliable)
{
gertiPushEvent.reliableFlag = 1;
proxyPushSupplierReliable->pushConsumerVar->push(gertiPushEvent);
}
else
{
gertiPushEvent.reliableFlag = 0;
proxyPushSupplierBestEffort->pushConsumerVar->push(gertiPushEvent);
}
#ifdef GalDebug // inserted by Gal converter
E2(GeRti_EC_d, "sendEvents", "AfterPush");
#endif // inserted by Gal converter
}
catch(CORBA::SystemException& e)
{
ACE_PRINT_EXCEPTION(e, "CORBA::SystemException in GERTICO::EventSender::sendEvents()");
}
// Reset important flags.
gotEnough = false;
indx = 0;
sendLength = 0;
}
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
void GERTICO::FedEventSender::toggleFirstESender()
{
if (firstESender)
{
firstESender = false;
}
else
{
firstESender = true;
}
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
void GERTICO::FedEventSender::addProxyPushSupplier(GeRtiEventMarket_ProxyPushSupplier_i *pps, bool const &theReliableFlag)
{
if (theReliableFlag)
{
proxyPushSupplierReliable = pps;
}
else
{
proxyPushSupplierBestEffort = pps;
}
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
void GERTICO::FedEventSender::delMinTimeStamp(GERTICO::GeRtiFedTime const &theGeRtiFedTime)
{
GERTICO::GeRtiFedTime *geRtiFedTimePtr;
GERTICO::GeRtiTimeMap::iterator itm;
pm.acquire();
for (itm = times.begin(); itm != times.end(); itm = times.begin())
{
if (*itm->first > theGeRtiFedTime)
{
break;
}
geRtiFedTimePtr = itm->first;
times.erase(itm);
delete geRtiFedTimePtr;
}
pm.release();
return;
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
void GERTICO::FedEventSender::getFederateRegions(const GeRtiFactory::GeRtiHandle &theFederate, const GeRtiFactory::GeRtiHandle &theInteraction, GERTICO::HandleBoolMap &theRegions)
{
GERTICO::Interaction *currInteraction;
GERTICO::InteractionMap::iterator itInteraction;
// Check if interactions already administered.
itInteraction = interactionMap.find(theInteraction);
if (itInteraction != interactionMap.end())
{
// Have an interaction.
currInteraction = itInteraction->second;
currInteraction->getFederateRegions(theFederate, theRegions);
}
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
void GERTICO::FedEventSender::getMinTimeStamp(GERTICO::GeRtiFedTime &theGeRtiFedTime)
{
GERTICO::GeRtiTimeMap::iterator itm;
pm.acquire();
itm = times.begin();
if (itm != times.end())
{
theGeRtiFedTime = *itm->first;
}
pm.release();
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
bool GERTICO::FedEventSender::isDeleted(void)
{
return deleted;
}
// ---------------------------------------------------------------------------
// NB: caller must secure the mutex lock.
// ---------------------------------------------------------------------------
void GERTICO::FedEventSender::printTimeStamp(void)
{
GERTICO::GeRtiTimeMap::iterator itm;
size_t size;
char buff[1024];
size = times.size();
for (itm = times.begin(); itm != times.end(); itm++)
{
itm->first->getPrintableString(buff);
}
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
void GERTICO::FedEventSender::print(void)
{
GERTICO::RtiHubEventVector itGeRtiEventVector;
size_t size;
size_t i;
for (i = 0; i < 2; i++)
{
size = eVector[i].size();
// std::cout << "FedEventSender::print::reliable " << size << " " << federate << std::endl;
}
for (i = 0; i < 2; i++)
{
size = eVectorBestEffort[i].size();
// std::cout << "FedEventSender::print::best_effort " << size << " " << federate << std::endl;
}
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
void GERTICO::FedEventSender::processEvents(void)
{
HandleSet::iterator itHS;
GERTICO::RtiHubEventVector *eventPtr;
GERTICO::GeRtiTimeVector geRtiTimeVector;
eventPtr = f_getEvents(true, true);
pm.acquire();
sendEvents(*eventPtr, true);
pm.release();
eventPtr = f_getEvents(true, false);
pm.acquire();
sendEvents(*eventPtr, false);
pm.release();
pm.acquire();
toggleFirstESender();
pm.release();
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
void GERTICO::FedEventSender::requestRetraction(GeRtiFactory::GeRtiHandle const &theHandle)
{
GeRtiFactory::GertiTmEvent gertiTmEvent;
gertiTmEvent.service = 14;
gertiTmEvent.sourceId = federate;
gertiTmEvent.theHandle = theHandle;
addTmEvent(gertiTmEvent);
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
void GERTICO::FedEventSender::setDeleted(void)
{
deleted = true;
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
void GERTICO::FedEventSender::timeAdvanceGrant(GERTICO::GeRtiFedTime &theGeRtiFedTime, GERTICO::GeRtiFedTime &theGaltGeRtiFedTime)
{
char buf[128];
GeRtiFactory::GertiTmEvent gertiTmEvent;
#ifdef GalDebug // inserted by Gal converter
E1mBegin(GeRti_EC_i)
{
unsigned long f;
f = federate;
theGeRtiFedTime.getPrintableString(buf);
sprintf(galMsg,"Federate=%lu,fedTime=%s", f, buf);
E2(GeRti_EC_i,"Federate::timeAdvanceGrant", galMsg);
}
#endif // inserted by Gal converter
theGeRtiFedTime.getPrintableString(buf);
theGaltGeRtiFedTime.getPrintableString(buf);
gertiTmEvent.service = 11;
if (!(theGeRtiFedTime.isPositiveInfinity()))
{
ConvertTime::mapIt(gertiTmEvent.timestamp, theGeRtiFedTime);
}
if (!(theGaltGeRtiFedTime.isPositiveInfinity()))
{
ConvertTime::mapIt(gertiTmEvent.timestampTwo, theGaltGeRtiFedTime);
}
gertiTmEvent.sourceId = federate;
addTmEvent(gertiTmEvent);
delMinTimeStamp(theGaltGeRtiFedTime);
#ifdef GalDebug // inserted by Gal converter
E2(GeRti_EC_i, "Federate::timeAdvanceGrant", "leave");
#endif // inserted by Gal converter
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
void GERTICO::FedEventSender::timeConstrainedEnabled(const GERTICO::GeRtiFedTime &theGeRtiFedTime)
{
GeRtiFactory::GertiTmEvent gertiTmEvent;
gertiTmEvent.service = 4;
GERTICO::ConvertTime::mapIt(gertiTmEvent.timestamp, theGeRtiFedTime);
gertiTmEvent.sourceId = federate;
addTmEvent(gertiTmEvent);
}
// ---------------------------------------------------------------------------
//
// ---------------------------------------------------------------------------
void GERTICO::FedEventSender::timeRegulationEnabled(const GERTICO::GeRtiFedTime &theGeRtiFedTime)
{
GeRtiFactory::GertiTmEvent gertiTmEvent;
gertiTmEvent.service = 1;
GERTICO::ConvertTime::mapIt(gertiTmEvent.timestamp, theGeRtiFedTime);
gertiTmEvent.sourceId = federate;
addTmEvent(gertiTmEvent);
}
|
d002cbc347917096025fb0401032df410829b231
|
a2badfee532cf096e9bd12b0892fdce3b49e54c8
|
/src/blackboard.h
|
d005ddfd8ac98d73092b35014bb78fb9def735f0
|
[
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
unghee/TorchCraftAI
|
5e5e9b218990db8042198a12aeef78651b49f67b
|
e6d596483d2a9a8b796765ed98097fcae39b6ac0
|
refs/heads/master
| 2022-04-16T12:12:10.289312
| 2020-04-20T02:55:22
| 2020-04-20T02:55:22
| 257,154,995
| 0
| 0
|
MIT
| 2020-04-20T02:51:19
| 2020-04-20T02:51:18
| null |
UTF-8
|
C++
| false
| false
| 8,775
|
h
|
blackboard.h
|
/*
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include "cherrypi.h"
#include "common/circularbuffer.h"
#include "module.h"
#include "task.h"
#include "unitsinfo.h"
#include "upc.h"
#include "upcfilter.h"
#include <chrono>
#include <list>
#include <map>
#include <memory>
#include <gflags/gflags.h>
#include <glog/logging.h>
#include <mapbox/variant.hpp>
#include <torchcraft/client.h>
namespace cherrypi {
class UpcStorage;
struct UpcPostData;
class SharedController;
class CherryVisDumperModule;
/// UPCTuple and associated origin
struct UPCData {
public:
std::shared_ptr<UPCTuple> upc = nullptr;
UpcId source = kInvalidUpcId;
Module* origin = nullptr;
UPCData() {}
UPCData(std::shared_ptr<UPCTuple> upc, UpcId source, Module* origin)
: upc(upc), source(source), origin(origin) {}
};
/// Task and associated owner
struct TaskData {
public:
std::shared_ptr<Task> task = nullptr;
Module* owner = nullptr;
bool autoRemove = true;
FrameNum creationFrame = -1;
TaskData() {}
TaskData(
std::shared_ptr<Task> task,
Module* owner,
bool autoRemove,
FrameNum creationFrame)
: task(std::move(task)),
owner(owner),
autoRemove(autoRemove),
creationFrame(creationFrame) {}
};
/**
* Game command are posted with an associated UPC ID.
*/
struct CommandPost {
tc::Client::Command command;
UpcId sourceId;
};
/**
* An access-aware blackboard.
*
* The blackboard provides a means for modules to exchange UPCTuples while
* keeping track of producers and consumers.
*
* Furthermore, there is functionality for holding global state via a simple
* key-value store (post(), hasKey(), get() and remove()).
*
* The blackboard itself will only store active UPCTuple objects, i.e. UPCs
* that have not been consumed and UPCs (as well as their sources) for which
* there are active tasks.
*/
class Blackboard {
public:
/// A variant of types that are allowed in the Blackboard's key-value storage.
using Data = mapbox::util::variant<
bool,
int,
float,
double,
std::string,
Position,
std::shared_ptr<SharedController>,
std::unordered_map<int, int>,
torch::Tensor>;
using UPCMap = std::map<UpcId, std::shared_ptr<UPCTuple>>;
using TaskTimeStats =
std::tuple<UpcId, std::string, std::chrono::milliseconds>;
// A few commonly used keys for post() and get()
static char const* kEnemyRaceKey;
static char const* kEnemyNameKey;
static char const* kBuildOrderKey;
static char const* kBuildOrderSwitchEnabledKey;
static char const* kOpeningBuildOrderKey;
static char const* kMinScoutFrameKey;
static char const* kMaxScoutWorkersKey;
static char const* kMaxScoutExplorersKey;
static char const* kGameUidKey;
static char const* kMineralsPerFramePerGatherer;
static char const* kGasPerFramePerGatherer;
static char const* kGathererMinGasWorkers;
static char const* kGathererMaxGasWorkers;
static char const* kBanditRootKey;
Blackboard(State* state);
virtual ~Blackboard();
void init();
/// Clears the queue of commands
void clearCommands();
/// Updates internal mappings after the torchcraft state has been updated.
void update();
void post(std::string const& key, Data const& data) {
map_[key] = data;
}
bool hasKey(std::string const& key) {
return map_.find(key) != map_.end();
}
Data const& get(std::string const& key) const {
return map_.at(key);
}
template <typename T>
T const& get(std::string const& key) const {
return map_.at(key).get<T>();
}
template <typename T>
T const& get(std::string const& key, T const& defaultValue) const {
auto it = map_.find(key);
if (it == map_.end()) {
return defaultValue;
}
return it->second.get<T>();
}
void remove(std::string const& key) {
map_.erase(key);
}
template <typename T>
void iterValues(T f_do) const {
for (auto it = map_.begin(); it != map_.end(); ++it) {
f_do(it->first, it->second);
}
}
bool isTracked(UnitId uid) const;
void track(UnitId uid);
void untrack(UnitId uid);
// UPC post/query/consume
/**
* Post a UPC tuple.
*
* The UPC tuple will be subject to filtering via UPCFilter objects. The
* filtered UPCTuple object will end up in the Blackboard, and the function
* will return a resulting UPC ID that is unique for this Blackboard instance.
* If the UPCTuple was rejected by a filter, kFilteredUpcId will be returned.
*
* The signature of this function enforces posting UPC tuples via move() as
* UPC filters modify UPC tuples by creating a copy of them. Hence, the
* UPCTuple instance ending up in the Blackboard might be different from the
* one provided to this function.
*/
UpcId postUPC(
std::shared_ptr<UPCTuple>&& upc,
UpcId sourceId,
Module* origin,
std::shared_ptr<UpcPostData> data = nullptr);
void consumeUPCs(std::vector<UpcId> const& ids, Module* consumer);
void consumeUPC(UpcId id, Module* consumer) {
consumeUPCs({id}, consumer);
}
void removeUPCs(std::vector<UpcId> const& ids);
/// Returns all non-consumed UPCs
UPCMap upcs() const;
/// Returns all non-consumed UPCs from a given module
UPCMap upcsFrom(Module* origin) const;
/// Returns all non-consumed UPCs from a given module
UPCMap upcsFrom(std::shared_ptr<Module> origin) const {
return upcsFrom(origin.get());
}
/// Returns all non-consumed UPCs with a Dirac command distribution on cmd
UPCMap upcsWithSharpCommand(Command cmd) const;
/// Returns all non-consumed UPCs with a command distribution where cmd has at
/// least a probability of minProb
UPCMap upcsWithCommand(Command cmd, float minProb) const;
/// Returns the non-consumed UPC with the given ID
std::shared_ptr<UPCTuple> upcWithId(UpcId id) const;
UpcStorage* upcStorage() const;
// UPC filters
void addUPCFilter(std::shared_ptr<UPCFilter> filter);
void removeUPCFilter(std::shared_ptr<UPCFilter> filter);
// Task post/query
void
postTask(std::shared_ptr<Task> task, Module* owner, bool autoRemove = false);
std::shared_ptr<Task> taskForId(UpcId id) const;
std::vector<std::shared_ptr<Task>> tasksOfModule(Module* module) const;
std::shared_ptr<Task> taskWithUnit(Unit* unit) const;
TaskData taskDataWithUnit(Unit* unit) const;
std::shared_ptr<Task> taskWithUnitOfModule(Unit* unit, Module* module) const;
void markTaskForRemoval(UpcId upcId);
void markTaskForRemoval(std::shared_ptr<Task> task) {
markTaskForRemoval(task->upcId());
}
/// This will return `Unknown` for tasks that were never registered
TaskStatus lastStatusOfTask(UpcId id) const;
void updateUnitAccessCounts(tc::Client::Command const& command);
// Game commands
void postCommand(tc::Client::Command const& command, UpcId sourceId);
std::vector<tc::Client::Command> commands(int stepsBack = 0) const;
size_t pastCommandsAvailable() const {
return commands_.size();
}
/// Updates the taskByUnit mapping, should be called after setUnits on a task
void updateTasksByUnit(Task* task);
/// UPC consistency checks
/// Calling this only makes sense in the player's postStep function, once
/// all the UPCs have been converted into commands to be posted to the game.
void checkPostStep();
std::vector<TaskTimeStats> getTaskTimeStats() const {
return taskTimeStats_;
}
void setCollectTimers(bool collect);
void setTraceDumper(std::shared_ptr<CherryVisDumperModule> tracer) {
traceDumper_ = tracer;
}
std::shared_ptr<CherryVisDumperModule> getTraceDumper() {
return traceDumper_;
}
private:
State* state_;
std::unordered_map<std::string, Data> map_;
common::CircularBuffer<std::vector<CommandPost>> commands_;
std::map<UpcId, UPCData> upcs_;
std::unique_ptr<UpcStorage> upcStorage_;
/// UPCs that are on the Blackboard or have active tasks
std::unordered_map<UpcId, std::shared_ptr<UPCTuple>> activeUpcs_;
std::list<std::shared_ptr<UPCFilter>> upcFilters_;
std::set<UnitId> tracked_;
std::list<TaskData> tasks_;
std::map<UpcId, std::list<TaskData>::iterator> tasksById_;
std::unordered_multimap<Module*, std::list<TaskData>::iterator>
tasksByModule_;
std::unordered_map<Unit*, std::list<TaskData>::iterator> tasksByUnit_;
std::vector<UpcId> tasksToBeRemoved_;
std::map<UnitId, size_t> unitAccessCounts_;
std::vector<TaskTimeStats> taskTimeStats_;
std::unordered_map<UpcId, TaskStatus> lastTaskStatus_;
std::shared_ptr<CherryVisDumperModule> traceDumper_;
bool collectTimers_ = false;
};
} // namespace cherrypi
|
ae966f8347441c4049aa727369cbafdf23a77da1
|
9e889555277ac34cd20532b40c10369d132373f3
|
/Codechef/DISTCODE_TESTdata.cpp
|
3bd741b88d02ecb5da7cdd80d1141c0619e76747
|
[] |
no_license
|
devanshu0987/Competitive-Programming
|
a756a093b9ec5fe684e7ceacaa37aba6ec32cd3b
|
000853cb4fd054c3d1328df11c6068d5e7d54aa9
|
refs/heads/master
| 2021-09-24T07:17:14.042005
| 2018-10-02T11:48:00
| 2018-10-02T12:54:40
| 60,449,318
| 0
| 5
| null | 2018-10-05T05:02:08
| 2016-06-05T07:55:41
|
C++
|
UTF-8
|
C++
| false
| false
| 403
|
cpp
|
DISTCODE_TESTdata.cpp
|
#include<iostream>
#include<stdlib.h>
#include<time.h>
#include<string>
using namespace std;
char A[26];
int main()
{
srand(time(NULL));
char c='A';
for(int i=0;i<26;i++)
A[i]=c++;
int T;
T=100;
cout<<T<<endl;
while(T--)
{
int len=rand()%20;
if(len==0 || len==1) len=5;
string s;
while(len--)
{
string temp;
temp.push_back(A[rand()%26]);
s=s+temp;
}
cout<<s<<endl;
}
}
|
2e7c4ee66e50cd87947e2180ef570ade19b4f9f4
|
0636e69f7cc3a94c49d6d481c0120d168d832ebf
|
/Solutions/TopCoder/TCO_10/Qualifier_1A/Palindromize3.cpp
|
98b123ab13941a54633b73192b9bc28ab19f0c95
|
[] |
no_license
|
TurtleShip/ProgrammingContests
|
33e0e261341e8f78c3d8d3bd66bbad0f511acc61
|
2ebd93f9b3d50c10a10c8731d17193e69382ca9b
|
refs/heads/master
| 2021-01-13T02:07:37.539205
| 2016-11-30T18:50:46
| 2016-11-30T18:50:46
| 18,936,833
| 1
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,594
|
cpp
|
Palindromize3.cpp
|
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i,a,b) for(int i=a; i < b; i++)
#define REPE(i, a, b) for(int i=a; i <=b; i++)
int INF = numeric_limits<int>::max();
int nINF = numeric_limits<int>::min();
typedef long long ll;
class Palindromize3 {
public:
string getPalindrome(string);
};
/*
1. Less key press
2. Smaller
*/
string ans;
int opt;
void find(int,int,string,set<char>);
string Palindromize3::getPalindrome(string s) {
ans ="";
set<char>emp;
find(0, s.size()-1, s, emp);
return ans;
}
void find(int i, int j, string cur, set<char> press)
{
if(i >= j)
{
if(ans == "" || (press.size() < opt) || (press.size() == opt && cur < ans))
{
opt = press.size();
ans = cur;
}
return;
}
if(cur[i] != cur[j])
{
string next = cur;
next[i] = next[j] = cur[i];
set<char> next1 = press;
next1.insert(cur[i]);
find(i+1, j-1, next, next1);
next[i] = next[j] = cur[j];
set<char> next2 = press;
next2.insert(cur[j]);
find(i+1, j-1, next, next2);
}
else
find(i+1, j-1, cur, press);
}
// BEGIN KAWIGIEDIT TESTING
// Generated by KawigiEdit 2.1.4 (beta) modified by pivanof
bool KawigiEdit_RunTest(int testNum, string p0, bool hasAnswer, string p1) {
cout << "Test " << testNum << ": [" << "\"" << p0 << "\"";
cout << "]" << endl;
Palindromize3 *obj;
string answer;
obj = new Palindromize3();
clock_t startTime = clock();
answer = obj->getPalindrome(p0);
clock_t endTime = clock();
delete obj;
bool res;
res = true;
cout << "Time: " << double(endTime - startTime) / CLOCKS_PER_SEC << " seconds" << endl;
if (hasAnswer) {
cout << "Desired answer:" << endl;
cout << "\t" << "\"" << p1 << "\"" << endl;
}
cout << "Your answer:" << endl;
cout << "\t" << "\"" << answer << "\"" << endl;
if (hasAnswer) {
res = answer == p1;
}
if (!res) {
cout << "DOESN'T MATCH!!!!" << endl;
} else if (double(endTime - startTime) / CLOCKS_PER_SEC >= 2) {
cout << "FAIL the timeout" << endl;
res = false;
} else if (hasAnswer) {
cout << "Match :-)" << endl;
} else {
cout << "OK, but is it right?" << endl;
}
cout << "" << endl;
return res;
}
int main() {
bool all_right;
all_right = true;
string p0;
string p1;
{
// ----- test 0 -----
p0 = "aszsbsz";
p1 = "zszszsz";
all_right = KawigiEdit_RunTest(0, p0, true, p1) && all_right;
// ------------------
}
{
// ----- test 1 -----
p0 = "ababab";
p1 = "aaaaaa";
all_right = KawigiEdit_RunTest(1, p0, true, p1) && all_right;
// ------------------
}
{
// ----- test 2 -----
p0 = "topcoderopen";
p1 = "nepooeeoopen";
all_right = KawigiEdit_RunTest(2, p0, true, p1) && all_right;
// ------------------
}
{
// ----- test 3 -----
p0 = "dfiuwifuqwieubaoiewhroiahw";
p1 = "wfiiwifueiieuueiieufiwiifw";
all_right = KawigiEdit_RunTest(3, p0, true, p1) && all_right;
// ------------------
}
if (all_right) {
cout << "You're a stud (at least on the example cases)!" << endl;
} else {
cout << "Some of the test cases had errors." << endl;
}
return 0;
}
// END KAWIGIEDIT TESTING
//Powered by KawigiEdit 2.1.4 (beta) modified by pivanof!
|
61c408bdf1e302e4072ca65e9abc64da3fdefa13
|
c7ddaad7fa061218d1e547a974fc6a7853e69c7a
|
/chrome/common/worker_messages.h
|
28fec6245adcb1a8ddd0fdc0f3d9381418ffeee0
|
[
"BSD-3-Clause"
] |
permissive
|
cha63506/chromium-29
|
9adcc9ba819ced9dfe1f5da4807ad10516896142
|
9df275a67dc9038e300bfcad34f634b20dc9e8bc
|
HEAD
| 2017-05-27T06:59:00.183474
| 2011-05-03T04:06:05
| 2011-05-03T04:06:05
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,531
|
h
|
worker_messages.h
|
// Copyright (c) 2009 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.
// Defines messages between the browser and worker process, as well as between
// the renderer and worker process.
#ifndef CHROME_COMMON_WORKER_MESSAGES_H_
#define CHROME_COMMON_WORKER_MESSAGES_H_
#pragma once
#include <string>
#include <vector>
#include "base/basictypes.h"
#include "googleurl/src/gurl.h"
#include "ipc/ipc_message_utils.h"
typedef std::pair<string16, std::vector<int> > QueuedMessage;
// Parameters structure for WorkerHostMsg_PostConsoleMessageToWorkerObject,
// which has too many data parameters to be reasonably put in a predefined
// IPC message. The data members directly correspond to parameters of
// WebWorkerClient::postConsoleMessageToWorkerObject()
struct WorkerHostMsg_PostConsoleMessageToWorkerObject_Params {
WorkerHostMsg_PostConsoleMessageToWorkerObject_Params();
~WorkerHostMsg_PostConsoleMessageToWorkerObject_Params();
int source_identifier;
int message_type;
int message_level;
string16 message;
int line_number;
string16 source_url;
};
// Parameter structure for WorkerProcessMsg_CreateWorker.
struct WorkerProcessMsg_CreateWorker_Params {
WorkerProcessMsg_CreateWorker_Params();
~WorkerProcessMsg_CreateWorker_Params();
GURL url;
bool is_shared;
string16 name;
int route_id;
int creator_process_id;
int creator_appcache_host_id; // Only valid for dedicated workers.
int64 shared_worker_appcache_id; // Only valid for shared workers.
};
namespace IPC {
// Traits for WorkerHostMsg_PostConsoleMessageToWorkerObject_Params structure
// to pack/unpack.
template <>
struct ParamTraits<WorkerHostMsg_PostConsoleMessageToWorkerObject_Params> {
typedef WorkerHostMsg_PostConsoleMessageToWorkerObject_Params param_type;
static void Write(Message* m, const param_type& p);
static bool Read(const Message* m, void** iter, param_type* p);
static void Log(const param_type& p, std::string* l);
};
// Traits for WorkerProcessMsg_CreateWorker_Params.
template <>
struct ParamTraits<WorkerProcessMsg_CreateWorker_Params> {
typedef WorkerProcessMsg_CreateWorker_Params param_type;
static void Write(Message* m, const param_type& p);
static bool Read(const Message* m, void** iter, param_type* p);
static void Log(const param_type& p, std::string* l);
};
} // namespace IPC
#include "chrome/common/worker_messages_internal.h"
#endif // CHROME_COMMON_WORKER_MESSAGES_H_
|
254754d189b3d07a995f00388ff7e6e9bebd2f10
|
efd7adff589e37ca98d2e3eb245aaeb23f64496e
|
/src/libs/utils/htmldocextractor.h
|
f8b563b327de4cb13f5c66b8e1a57059abb8deb7
|
[] |
no_license
|
Andersbakken/CPlusPlus
|
3cf03c28968243587fa1d4661e7e5a388e62eb43
|
400f0b8f19de1c3fc9b794228c7aeec2259fce81
|
refs/heads/master
| 2021-01-10T20:24:54.067140
| 2013-05-28T03:46:50
| 2013-05-28T03:46:50
| 9,491,173
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,005
|
h
|
htmldocextractor.h
|
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** 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 Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef HTMLDOCEXTRACTOR_H
#define HTMLDOCEXTRACTOR_H
#include "utils_global.h"
namespace Utils {
class QTCREATOR_UTILS_EXPORT HtmlDocExtractor
{
public:
HtmlDocExtractor();
enum Mode {
FirstParagraph,
Extended
};
void setMode(Mode mode);
void applyFormatting(const bool format);
QString getClassOrNamespaceBrief(const QString &html, const QString &mark) const;
QString getClassOrNamespaceDescription(const QString &html, const QString &mark) const;
QString getEnumDescription(const QString &html, const QString &mark) const;
QString getTypedefDescription(const QString &html, const QString &mark) const;
QString getMacroDescription(const QString &html, const QString &mark) const;
QString getFunctionDescription(const QString &html,
const QString &mark,
const bool mainOverload = true) const;
QString getQmlComponentDescription(const QString &html, const QString &mark) const;
QString getQmlPropertyDescription(const QString &html, const QString &mark) const;
QString getQMakeVariableOrFunctionDescription(const QString &html,
const QString &mark) const;
QString getQMakeFunctionId(const QString &html,
const QString &mark) const;
private:
QString getClassOrNamespaceMemberDescription(const QString &html,
const QString &startMark,
const QString &endMark) const;
QString getContentsByMarks(const QString &html,
QString startMark,
QString endMark) const;
void processOutput(QString *html) const;
static void stripAllHtml(QString *html);
static void stripHeadings(QString *html);
static void stripLinks(QString *html);
static void stripHorizontalLines(QString *html);
static void stripDivs(QString *html);
static void stripTagsStyles(QString *html);
static void stripTeletypes(QString *html);
static void stripImagens(QString *html);
static void stripBold(QString *html);
static void stripEmptyParagraphs(QString *html);
static void replaceNonStyledHeadingsForBold(QString *html);
static void replaceTablesForSimpleLines(QString *html);
static void replaceListsForSimpleLines(QString *html);
bool m_formatContents;
Mode m_mode;
};
} // namespace Utils
#endif // HTMLDOCEXTRACTOR_H
|
98e8957fb706b154b05f3411934afdc4c9719260
|
67e35916e278f5296feb7756dfc1fa2f8c1acd70
|
/q4/q4.cpp
|
c5d13126293c97f29c57130778a7790c25fa1b6b
|
[] |
no_license
|
toiinnn/lab05
|
7cf7ea2be56df219a882dd6d0ba3875e742b6b8a
|
765eda60db0621006b14ba6c01364a84b54cb7dc
|
refs/heads/master
| 2020-03-18T13:17:42.075409
| 2018-05-29T20:25:50
| 2018-05-29T20:25:50
| 134,774,076
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,489
|
cpp
|
q4.cpp
|
/**
* @file q4.cpp
* @author Silvio da Costa Sampaio
* @author Antonio Marcos Oliveira
* @since 28/05/2018
* @date 28/05/2018
*/
#include <iostream>
using std::cout;
using std::endl;
#include <iterator>
using std::back_inserter;
#include <vector>
using std::vector;
#include <algorithm>
using std::transform;
/**
* @brief Essa função calcula o quadrado de um inteiro passado por parâmetro
* @param val Um inteiro a ser elevado ao quadrado
* @return O quadrado do número
*/
int square(int val) {
return val * val;
}
int main(int argc, char* argv[])
{
//criação de dois vetores dinâmicos com a classe vector
vector<int> col;
vector<int> col2;
//inserção de valores em col
for (int i = 1; i <= 9; ++i) {
col.push_back(i);
}
//O std::transform aplica uma determinada função passada por parametro em um intervalo determinado por iteradores
//e o std::back_inserter serve para inserir elementos no final de um container x.
//Logo, nesse caso o que está acontecendo aqui é: o transform está pegando todo o intervalo de col, e inserindo os valores
//elevados ao quadrado (devido a função square e por estar usando o transform) no final do col2 (devido ao back_inserter).
transform(col.begin(), col.end(), back_inserter(col2), square);
//agora ele itera sobre os valores de col2, imprimindo seus valores
for (vector<int>::iterator it = col2.begin(); it != col2.end(); ++it) {
cout << (*it) << " ";
}
cout << endl;
return 0;
}
|
2cbe3d12d1562f9d9574622a51442be570e68470
|
8f00d6de3c7dc47ab83b782dcb2aa16d1ce36b40
|
/Diablo Edit2/DlgWayPoints.h
|
96ce592d71f7f948a49072cf8757f46e76a73db2
|
[
"MIT"
] |
permissive
|
daidodo/diablo_edit
|
d93935e842fdf75ea51a64b6faacabbeb22d4d3b
|
89adae5067a54bbde7eaa23c4ca80385b488a866
|
refs/heads/master
| 2023-02-27T16:23:30.594060
| 2023-02-07T01:12:31
| 2023-02-07T01:12:31
| 245,823,454
| 142
| 39
|
MIT
| 2022-12-06T02:45:41
| 2020-03-08T13:52:01
|
C++
|
UTF-8
|
C++
| false
| false
| 1,079
|
h
|
DlgWayPoints.h
|
#pragma once
#include "CharacterDialogBase.h"
#include "afxwin.h"
// CDlgWayPoints 对话框
class CDlgWayPoints : public CCharacterDialogBase
{
DECLARE_DYNAMIC(CDlgWayPoints)
public:
CDlgWayPoints(CWnd* pParent = NULL); // 标准构造函数
virtual ~CDlgWayPoints();
// 对话框数据
enum { IDD = IDD_DIALOG_WayPoints };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
DECLARE_MESSAGE_MAP()
// 自定义函数
public:
void UpdateUI(const CD2S_Struct & character);
BOOL GatherData(CD2S_Struct & character);
void ResetAll();
void LoadText(void); //加载控件的字符串内容
private:
void GetOriginData(int level,BOOL * way);
// 自定义成员
private:
static const int TEXT_SIZE = 43;
CString m_sText[TEXT_SIZE];
INT m_nLevel; //当前选择的难度级别,0,1,2
BYTE m_byteOriginData[3][5];
BOOL m_bWayData[3][40];
BOOL m_bUIData[40];
CButton m_nSelAll;
public:
afx_msg void OnBnClickedNormal();
afx_msg void OnBnClickedNightmare();
afx_msg void OnBnClickedHell();
afx_msg void OnBnClicked_SelAll();
};
|
4638af29f7640d6c2306b73ca459a73caf223c67
|
71d9abce508f1e99d96de71adf0c60ff9681ec50
|
/IOI-2007船帆.cpp
|
da0c97f48f1ca4b0da457f597c4e658c37c21fe4
|
[] |
no_license
|
mirache/oi_code
|
ccfe56fb327f6963cf47b3ba86ffa5a7373c8c69
|
306491342ed4f711aa9cd1bb21f1bf481c10f906
|
refs/heads/master
| 2020-05-31T16:30:45.408566
| 2019-06-06T12:13:36
| 2019-06-06T12:13:36
| 190,383,470
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,283
|
cpp
|
IOI-2007船帆.cpp
|
//bzoj-1805
#include <bits/stdc++.h>
inline void read(int&x){
char ch=getchar();x=0;while(!isdigit(ch))ch=getchar();
while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
}
const int N = 101000;
int tag[N<<2], ls[N<<2], rs[N<<2];
int n, H; long long ans = 0ll;
struct node {
int h, k;
inline void in() {read(h), read(k);}
friend inline bool operator < (const node&A, const node&B) {return A.h < B.h;}
}p[N];
inline void down(const int x) {
const int l = x << 1, r = l | 1;
int&v = tag[x];
tag[l] += v, ls[l] += v, rs[l] += v;
tag[r] += v, ls[r] += v, rs[r] += v;
v = 0;
}
void upd(int l, int r, int x, int L, int R) {
if(L <= l and r <= R) return ++tag[x], ++ls[x], ++rs[x], void();
int mid = l + r >> 1; if(tag[x]) down(x);
if(mid < R) upd(mid+1, r, x<<1|1, L, R);
if(L <= mid) upd(l, mid, x<<1, L, R);
ls[x] = ls[x<<1], rs[x] = rs[x<<1|1];
}
int get_sgl(int l, int r, int x, int ps) {
if(l == r) return tag[x];
int mid = l + r >> 1; if(tag[x]) down(x);
if(ps <= mid) return get_sgl(l, mid, x<<1, ps);
else return get_sgl(mid+1, r, x<<1|1, ps);
}
void get_all(int l, int r, int x) {
if(l == r) return ans += (long long)tag[x] * (tag[x]-1), void();
int mid = l + r >> 1; if(tag[x]) down(x);
get_all(l, mid, x<<1);
get_all(mid+1, r, x<<1|1);
}
int get_lpos(int l, int r, int x, int R, int vl) {
if(R < l or ls[x] < vl or rs[x] > vl) return 0;
if(l == r) return l;
int mid = l + r >> 1, res = 0; if(tag[x]) down(x);
if(res = get_lpos(l, mid, x<<1, R, vl)) return res;
return get_lpos(mid+1, r, x<<1|1, R, vl);
}
int get_rpos(int l, int r, int x, int L, int vl) {
if(r < L or ls[x] < vl or rs[x] > vl) return 0;
if(l == r) return l;
int mid = l + r >> 1, res = 0; if(tag[x]) down(x);
if(res = get_rpos(mid+1, r, x<<1|1, L, vl)) return res;
return get_rpos(l, mid, x<<1, L, vl);
}
int main() {
read(n);
for(int i=1;i<=n;++i)
p[i].in(), H = std::max(H, p[i].h);
std::sort(p+1,p+n+1);
for(int i=1;i<=n;++i) {
int&res = p[i].k;
int x = get_sgl(1,H,1,p[i].h-res+1);
int rps = get_rpos(1,H,1,p[i].h-res+1,x);
int lps = get_lpos(1,H,1,p[i].h-res+1,x);
rps = std::min(rps, p[i].h);
if(rps < p[i].h) upd(1,H,1,rps+1,p[i].h);
res -= p[i].h - rps;
upd(1,H,1,lps,lps+res-1);
}
get_all(1,H,1);
printf("%lld\n", ans >> 1);
return 0;
}
|
0de900908b68387d54f0e7eb12ac97cb52713285
|
e398a585764f16511a70d0ef33a3b61da0733b69
|
/3790.1830/src/wdm/bda/europa/src/dgtltransportout.cpp
|
e0430a60328f60e0485aea1ee5c93492f9dd249b
|
[
"MIT"
] |
permissive
|
MichaelDavidGK/WinDDK
|
f9e4fc6872741ee742f8eace04b2b3a30b049495
|
eea187e357d61569e67292ff705550887c4df908
|
refs/heads/master
| 2020-05-30T12:26:40.125588
| 2019-06-01T13:28:10
| 2019-06-01T13:28:10
| 189,732,991
| 0
| 0
| null | 2019-06-01T12:58:11
| 2019-06-01T12:58:11
| null |
UTF-8
|
C++
| false
| false
| 23,515
|
cpp
|
dgtltransportout.cpp
|
//////////////////////////////////////////////////////////////////////////////
//
// (C) Philips Semiconductors 2001
// All rights are reserved. Reproduction in whole or in part is prohibited
// without the written consent of the copyright owner.
//
// Philips reserves the right to make changes without notice at any time.
// Philips makes no warranty, expressed, implied or statutory, including but
// not limited to any implied warranty of merchantability or fitness for any
// particular purpose, or that the use will not infringe any third party
// patent, copyright or trademark. Philips must not be liable for any loss
// or damage arising from its use.
//
//////////////////////////////////////////////////////////////////////////////
#include "34AVStrm.h"
#include "VampDevice.h"
#include "DgtlTransportOutInterface.h"
#include "DgtlTransportOut.h"
//////////////////////////////////////////////////////////////////////////////
//
// Description:
// The constructor of the transport output pin initializes some
// class internal member variables.
//
// Return Value:
// None.
//
//////////////////////////////////////////////////////////////////////////////
CDgtlTransportOut::CDgtlTransportOut()
{
m_pVampTSStream = NULL;
m_pSpinLockObj = NULL;
m_pIKsClock = NULL;
}
//////////////////////////////////////////////////////////////////////////////
//
// Description:
// The destructor of the transport output pin.
// Nothing has to be done here.
//
// Return Value:
// None.
//
//////////////////////////////////////////////////////////////////////////////
CDgtlTransportOut::~CDgtlTransportOut()
{
if( m_pVampTSStream )
{
delete m_pVampTSStream;
m_pVampTSStream = NULL;
}
if( m_pIKsClock )
{
if( m_pIKsClock->Release() != 0 )
{
_DbgPrintF(DEBUGLVL_BLAB,
("Info: m_pIKsClock instances not zero"));
}
m_pIKsClock = NULL;
}
if( m_pSpinLockObj )
{
delete m_pSpinLockObj;
m_pSpinLockObj = NULL;
}
}
//////////////////////////////////////////////////////////////////////////////
//
// Description:
// The create pin is called when the transport output pin is created. It
// creates a spin lock from the 34 HAL and initializes a new transport
// stream object.
// HAL access is performed by this function.
//
// Return Value:
// STATUS_UNSUCCESSFUL Operation failed due to invalid
// arguments.
// STATUS_INSUFFICIENT_RESOURCES Unable to create class
// CVampTransportStream
// STATUS_SUCCESS Operation succeeded.
//
//////////////////////////////////////////////////////////////////////////////
NTSTATUS CDgtlTransportOut::Create
(
IN PKSPIN pKSPin, // Pointer to the pin object
IN PIRP pIrp // Pointer to the Irp that is involved with this
// operation.
)
{
//parameters valid?
if( !pKSPin )
{
_DbgPrintF(DEBUGLVL_ERROR,("Error: Invalid argument"));
return STATUS_UNSUCCESSFUL;
}
// get device resources object from pKSPin
CVampDeviceResources* pDevResObj = GetDeviceResource(pKSPin);
if( !pDevResObj )
{
_DbgPrintF(
DEBUGLVL_ERROR,
("Error: Cannot get device resource object"));
return STATUS_UNSUCCESSFUL;
}
else
{
// if pointer is valid check pointer pointed to by pDevResObj
if( !(pDevResObj->m_pFactory) )
{
_DbgPrintF( DEBUGLVL_ERROR,
("Error: Cannot not get factory object"));
return STATUS_UNSUCCESSFUL;
}
}
m_pSpinLockObj = pDevResObj->m_pFactory->CreateSpinLock(NON_PAGED_POOL);
if( !m_pSpinLockObj )
{
_DbgPrintF(DEBUGLVL_ERROR,
("Error: CreateSpinLock failed, not enough memory"));
return STATUS_INSUFFICIENT_RESOURCES;
}
m_pVampTSStream = new (NON_PAGED_POOL)
CVampTransportStream(pDevResObj, TS_Parallel);
if( !m_pVampTSStream )
{
delete m_pSpinLockObj;
m_pSpinLockObj = NULL;
_DbgPrintF(
DEBUGLVL_ERROR,
("Error: CVampTransportStream failed, not enough memory"));
return STATUS_INSUFFICIENT_RESOURCES;
}
else
{
if( m_pVampTSStream->GetObjectStatus() != STATUS_OK )
{
delete m_pVampTSStream;
m_pVampTSStream = NULL;
delete m_pSpinLockObj;
m_pSpinLockObj = NULL;
_DbgPrintF(
DEBUGLVL_ERROR,
("Error: VampTransportStream object status invalid"));
return STATUS_UNSUCCESSFUL;
}
}
return STATUS_SUCCESS;
}
//////////////////////////////////////////////////////////////////////////////
//
// Description:
// The remove function is called when the transport output pin is removed.
// It deletes the CVampTransportStream class object and the spin lock.
// HAL access is performed by this function.
//
// Return Value:
// This functions always returns with STATUS_SUCCESS
//
//////////////////////////////////////////////////////////////////////////////
NTSTATUS CDgtlTransportOut::Remove
(
IN PKSPIN pKSPin, // Pointer to the pin object
IN PIRP pIrp // Pointer to the Irp that is involved with this
// operation.
)
{
if( m_pVampTSStream )
{
delete m_pVampTSStream;
m_pVampTSStream = NULL;
}
if( m_pSpinLockObj )
{
delete m_pSpinLockObj;
m_pSpinLockObj = NULL;
}
return STATUS_SUCCESS;
}
//////////////////////////////////////////////////////////////////////////////
//
// Description:
// This function opens a new stream at the transport stream object class.
// HAL access is performed by this function.
//
// Return Value:
// STATUS_UNSUCCESSFUL Operation failed due to invalid
// arguments.
// STATUS_SUCCESS Operation succeeded.
//
//////////////////////////////////////////////////////////////////////////////
NTSTATUS CDgtlTransportOut::Open
(
IN PKSPIN pKSPin // Pointer to the pin object
)
{
//parameters valid?
if( !pKSPin )
{
_DbgPrintF(DEBUGLVL_ERROR,("Error: Invalid argument"));
return STATUS_UNSUCCESSFUL;
}
if( !m_pVampTSStream )
{
_DbgPrintF(DEBUGLVL_ERROR,
("Error: Important member not initialized"));
return STATUS_UNSUCCESSFUL;
}
tStreamParms tStreamParams;
RtlZeroMemory( &tStreamParams, sizeof(tStreamParams) );
tStreamParams.nField = EITHER_FIELD;
tStreamParams.pCallbackFktn = dynamic_cast <CCallOnDPC*>(this);
tStreamParams.pCBParam1 = pKSPin; // give Pin to Callback routine
tStreamParams.pCBParam2 = NULL;
tStreamParams.pTimeStamp = NULL;
//open
if( m_pVampTSStream->Open(&tStreamParams) != VAMPRET_SUCCESS )
{
_DbgPrintF(DEBUGLVL_ERROR,("Error: Open TS stream failed"));
return STATUS_UNSUCCESSFUL;
}
return STATUS_SUCCESS;
}
//////////////////////////////////////////////////////////////////////////////
//
// Description:
// This function closes the current stream at the transport stream object
// class and de-allocates the memory of the stream buffer.
// HAL access is performed by this function.
//
// Return Value:
// STATUS_UNSUCCESSFUL Operation failed due to invalid arguments.
// STATUS_SUCCESS Operation succeeded.
//
//////////////////////////////////////////////////////////////////////////////
NTSTATUS CDgtlTransportOut::Close
(
IN PKSPIN pKSPin // Pointer to the pin object
)
{
CVampBuffer* pVampBuffer = NULL;
if( !m_pVampTSStream || !m_pSpinLockObj )
{
_DbgPrintF( DEBUGLVL_ERROR,
("Error: Important member not initialized"));
return STATUS_UNSUCCESSFUL;
}
//aquire spin lock to make sure that we are the only one
//to access the buffer queue at the moment
m_pSpinLockObj->AcquireSpinLock(); // void function
//cancel all buffer that are still in the queue
if( m_pVampTSStream->CancelAllBuffers() != VAMPRET_SUCCESS )
{
//CancelAllBuffers failed
m_pSpinLockObj->ReleaseSpinLock(); // void function
_DbgPrintF(DEBUGLVL_ERROR,("Error: CancelAllBuffers failed"));
return STATUS_UNSUCCESSFUL;
}
//Get all the buffer from the Vamp HAL
while(m_pVampTSStream->GetNextDoneBuffer(&pVampBuffer) ==
VAMPRET_SUCCESS)
{
if( !pVampBuffer )
{
m_pSpinLockObj->ReleaseSpinLock(); // void function
_DbgPrintF(DEBUGLVL_ERROR,("Error: Invalid buffer pointer"));
return STATUS_UNSUCCESSFUL;
}
PKSSTREAM_POINTER pStreamPointer =
static_cast <PKSSTREAM_POINTER>(pVampBuffer->GetContext());
if( pStreamPointer )
{
//release system buffer
KsStreamPointerDelete(pStreamPointer); // void function
pStreamPointer = NULL;
//remove Vamp buffer object
delete pVampBuffer;
pVampBuffer = NULL;
}
else
{
//The streampointer within the buffer context is corrupted
m_pSpinLockObj->ReleaseSpinLock(); // void function
//remove at least Vamp buffer object
delete pVampBuffer;
pVampBuffer = NULL;
_DbgPrintF( DEBUGLVL_ERROR,
("Error: (Buffer-)Stream pointer invalid!"));
return STATUS_UNSUCCESSFUL;
}
}
//release spin lock to give others access to the buffer queue again
m_pSpinLockObj->ReleaseSpinLock(); // void function
//close TS stream
if( m_pVampTSStream->Close() != VAMPRET_SUCCESS )
{
_DbgPrintF(DEBUGLVL_ERROR,("Error: Close TS stream failed"));
return STATUS_UNSUCCESSFUL;
}
return STATUS_SUCCESS;
}
//////////////////////////////////////////////////////////////////////////////
//
// Description:
// This function starts the streaming on the transport output pin.
// HAL access is performed by this function.
//
// Return Value:
// STATUS_UNSUCCESSFUL Operation failed due to invalid
// arguments.
// STATUS_SUCCESS Operation succeeded.
//
//////////////////////////////////////////////////////////////////////////////
NTSTATUS CDgtlTransportOut::Start
(
IN PKSPIN pKSPin // Pointer to the pin object
)
{
//parameters and clock object valid?
if( !pKSPin )
{
_DbgPrintF(DEBUGLVL_ERROR,("Error: Invalid argument"));
return STATUS_UNSUCCESSFUL;
}
if( !m_pVampTSStream )
{
_DbgPrintF( DEBUGLVL_ERROR,
("Error: Important member not initialized"));
return STATUS_UNSUCCESSFUL;
}
NTSTATUS ntStatus = STATUS_UNSUCCESSFUL;
DWORD dwIndex = 0;
do //while system buffers available
{
ntStatus = Process(pKSPin);
dwIndex++;
}
while(ntStatus == STATUS_SUCCESS);
//check, if the number of inserted buffer is equal to
//formerly demanded buffers
if( dwIndex != NUM_TS_STREAM_BUFFER )
{
// This is not a bug but there is a Microsoft restriction
// where sometimes we dont get all the requested buffers.
_DbgPrintF( DEBUGLVL_VERBOSE,
("Warning: Number of buffers do not match!"));
}
// try to get the reference to the master clock object
if( !m_pIKsClock )
{
if( !NT_SUCCESS(KsPinGetReferenceClockInterface(pKSPin,
&m_pIKsClock)) )
{
// If we could not get an interface to the clock,
// don't proceed
m_pIKsClock = NULL;
_DbgPrintF(DEBUGLVL_ERROR,("Error: No clock object available"));
return STATUS_UNSUCCESSFUL;
}
}
if(m_pVampTSStream->Reset() != VAMPRET_SUCCESS )
{
_DbgPrintF( DEBUGLVL_ERROR,
("Error: Unable to reset hardware TS Interface"));
return STATUS_UNSUCCESSFUL;
}
if( m_pVampTSStream->Start() != VAMPRET_SUCCESS )
{
_DbgPrintF(DEBUGLVL_ERROR,("Error: Start transport stream failed"));
return STATUS_UNSUCCESSFUL;
}
return STATUS_SUCCESS;
}
//////////////////////////////////////////////////////////////////////////////
//
// Description:
// This function stops the streaming on the transport output pin.
// HAL access is performed by this function.
//
// Return Value:
// STATUS_UNSUCCESSFUL Operation failed due to invalid
// arguments.
// STATUS_SUCCESS Operation succeeded.
//
//////////////////////////////////////////////////////////////////////////////
NTSTATUS CDgtlTransportOut::Stop
(
IN PKSPIN pKSPin // Pointer to the pin object
)
{
if( !m_pVampTSStream )
{
_DbgPrintF(DEBUGLVL_ERROR,
("Error: Important member not initialized"));
return STATUS_UNSUCCESSFUL;
}
VAMPRET vrResult = m_pVampTSStream->Stop(FALSE);
// release the reference to the master clock
// which was created during start
if( m_pIKsClock )
{
if( m_pIKsClock->Release() != 0 )
{
_DbgPrintF(DEBUGLVL_BLAB,
("Info: m_pIKsClock instances not zero"));
}
m_pIKsClock = NULL;
}
// check whether the stop function was successful or not
if( vrResult != VAMPRET_SUCCESS )
{
_DbgPrintF(DEBUGLVL_ERROR,("Error: Stop TS stream failed"));
return STATUS_UNSUCCESSFUL;
}
return STATUS_SUCCESS;
}
//////////////////////////////////////////////////////////////////////////////
//
// Description:
// This is the DPC call back function of the transport stream.
//
// Return Value:
// This function always returns VAMPRET_SUCCESS.
//
//////////////////////////////////////////////////////////////////////////////
VAMPRET CDgtlTransportOut::CallOnDPC
(
PVOID pStream, // Pointer to the stream the DPC function was
// called by.
PVOID pParam1, // Pointer to a additional parameter.
PVOID pParam2 // Pointer to a additional parameter.
)
{
//parameters valid?
if( !pParam1 )
{
_DbgPrintF(DEBUGLVL_ERROR,("Error: Invalid argument"));
return VAMPRET_NULL_POINTER_PARAMETER;
}
CVampBuffer* pVampBuffer = NULL;
PKSSTREAM_POINTER pStreamPointer = NULL;
if( !m_pVampTSStream || !m_pIKsClock || !m_pSpinLockObj )
{
_DbgPrintF( DEBUGLVL_ERROR,
("Error: Important member not initialized"));
return VAMPRET_GENERAL_ERROR;
}
m_pSpinLockObj->AcquireSpinLock(); // void function
//get all done vamp buffer out of our queue
if( m_pVampTSStream->GetNextDoneBuffer(&pVampBuffer) ==
VAMPRET_SUCCESS )
{
m_pSpinLockObj->ReleaseSpinLock(); // void function
if( !pVampBuffer )
{
_DbgPrintF( DEBUGLVL_ERROR,
("Error: Invalid buffer (invalid buffer pointer)"));
return VAMPRET_GENERAL_ERROR;
}
//get buffer address out of the vampbuffer context
pStreamPointer =
static_cast <PKSSTREAM_POINTER>(pVampBuffer->GetContext());
if( !pStreamPointer )
{
_DbgPrintF( DEBUGLVL_BLAB,
("Info: Invalid buffer (invalid streampointer)"));
return VAMPRET_GENERAL_ERROR;
}
//set data context information
pStreamPointer->StreamHeader->OptionsFlags =
KSSTREAM_HEADER_OPTIONSF_SPLICEPOINT;
pStreamPointer->StreamHeader->DataUsed = M2T_BUFFERSIZE;
pStreamPointer->StreamHeader->Duration = 242000; // 24.2 mS per 8VSB field
pStreamPointer->StreamHeader->PresentationTime.Numerator = 1;
pStreamPointer->StreamHeader->PresentationTime.Denominator = 1;
pStreamPointer->StreamHeader->OptionsFlags |=
KSSTREAM_HEADER_OPTIONSF_TIMEVALID |
KSSTREAM_HEADER_OPTIONSF_DURATIONVALID;
pStreamPointer->StreamHeader->PresentationTime.Time = m_pIKsClock->GetTime();
//give buffer back to the system
KsStreamPointerDelete(pStreamPointer); // void function
pStreamPointer = NULL;
//delete Vamp buffer object
delete pVampBuffer;
pVampBuffer = NULL;
//Make an asynchronous system call to the process function to insert
//a new buffer into the queue. We cannot call Process here directly,
//because we are still in the systems DPC context.
KsPinAttemptProcessing(static_cast <PKSPIN>(pParam1), TRUE); // void function
m_pSpinLockObj->AcquireSpinLock(); // void function
}
m_pSpinLockObj->ReleaseSpinLock(); // void function
return VAMPRET_SUCCESS;
}
//////////////////////////////////////////////////////////////////////////////
//
// Description:
// This function aquires a new buffer from the system, prepares it to meet
// the requirements for SAA7134 TS streaming and passses it to the HAL.
// HAL access is performed by this function.
//
// Return Value:
// STATUS_UNSUCCESSFUL Operation failed due to invalid
// arguments.
// STATUS_SUCCESS Operation succeeded.
//
//////////////////////////////////////////////////////////////////////////////
NTSTATUS CDgtlTransportOut::Process
(
IN PKSPIN pKSPin // Pointer to the pin object.
)
{
if( !pKSPin )
{
_DbgPrintF(DEBUGLVL_ERROR,("Error: Invalid argument"));
return STATUS_UNSUCCESSFUL;
}
if( !m_pSpinLockObj || !m_pVampTSStream )
{
_DbgPrintF( DEBUGLVL_ERROR,
("Error: Important member not initialized"));
return STATUS_UNSUCCESSFUL;
}
NTSTATUS ntStatus = STATUS_UNSUCCESSFUL;
PKSSTREAM_POINTER pStreamPointer =
KsPinGetLeadingEdgeStreamPointer( pKSPin,
KSSTREAM_POINTER_STATE_LOCKED);
if( !pStreamPointer )
{
//no system buffer available
//This case can happen if it is the last pointer in the queue or
//the system cannot give us the required buffer
_DbgPrintF(DEBUGLVL_VERBOSE,("Warning: No system buffer available"));
return STATUS_UNSUCCESSFUL;
}
else
{
PKSSTREAM_POINTER pStreamPointerClone = NULL;
CVampBuffer* pVampBuffer = NULL;
//clone the system buffer
ntStatus = KsStreamPointerClone(pStreamPointer,
NULL,
NULL,
&pStreamPointerClone);
if( !NT_SUCCESS(ntStatus) )
{
//no system buffer available
_DbgPrintF(DEBUGLVL_ERROR,
("Error: Streampointer cloning unsuccessful"));
return STATUS_UNSUCCESSFUL;
}
//set vamp buffer format parameters
tBufferFormat tBufferParams;
RtlZeroMemory( &tBufferParams, sizeof(tBufferParams) ); // void function
//set samples per line, should be 188
tBufferParams.dwSamplesPerLine = M2T_BYTES_IN_LINE;
//set default value (used for audio only)
tBufferParams.dwChannelsPerSample = 1;
//Y only format (grey) has one byte per pixel
tBufferParams.dwBitsPerSample = 8;
//set number of lines, should be 312
tBufferParams.dwNrOfLines = M2T_LINES_IN_FIELD;
//calculate pitch in bytes
tBufferParams.lPitchInBytes =
tBufferParams.dwSamplesPerLine * tBufferParams.dwBitsPerSample/8;
//calculate the buffer length
tBufferParams.lBufferLength =
tBufferParams.lPitchInBytes * tBufferParams.dwNrOfLines;
//dont change the byte order
tBufferParams.ByteOrder = KEEP_AS_IS;
//set buffer queued
tBufferParams.BufferType = CVAMP_BUFFER_QUEUED;
//is the buffer size correct?
if( pStreamPointerClone->StreamHeader->FrameExtent <
(static_cast <DWORD>(tBufferParams.lBufferLength)) )
{
//buffer size incorrect
KsStreamPointerDelete(pStreamPointerClone); // void function
_DbgPrintF(DEBUGLVL_ERROR,("Error: Buffer size incorrect"));
return STATUS_UNSUCCESSFUL;
}
//construct vamp buffer object
pVampBuffer = new (NON_PAGED_POOL) CVampBuffer(
pStreamPointerClone->StreamHeader->Data,
pStreamPointerClone->StreamHeader->FrameExtent,
(PVOID) pStreamPointerClone->Offset,
&tBufferParams,
BUFFER_REGULAR_MAPPING_OS,
false,
false);
if( !pVampBuffer )
{
KsStreamPointerDelete(pStreamPointerClone); // void function
_DbgPrintF(DEBUGLVL_ERROR,
("Error: VampBuffer creation failed, not enough memory"));
return STATUS_INSUFFICIENT_RESOURCES;
}
if( pVampBuffer->GetObjectStatus() != STATUS_OK )
{
//de-allocate memory for the Vamp buffer object
delete pVampBuffer;
pVampBuffer = NULL;
//give buffer back to the system, we cannot use it for some reason
KsStreamPointerDelete(pStreamPointerClone); // void function
_DbgPrintF(DEBUGLVL_ERROR,("Error: Buffer object status failed"));
return STATUS_UNSUCCESSFUL;
}
//set KS stream pointer into the buffer context for use in the
//CallOnDPC function
pVampBuffer->SetContext(static_cast <PVOID>(pStreamPointerClone));
//aquire spin lock to be the only one that has access to the buffer queue
m_pSpinLockObj->AcquireSpinLock(); // void function
//add buffer to Vamp dma queue
if( m_pVampTSStream->AddBuffer(pVampBuffer) != VAMPRET_SUCCESS )
{
//de-allocate memory for the Vamp buffer object
delete pVampBuffer;
pVampBuffer = NULL;
//give buffer back to the system, we cannot use it for some reason
KsStreamPointerDelete(pStreamPointerClone); // void function
m_pSpinLockObj->ReleaseSpinLock(); // void function
_DbgPrintF(DEBUGLVL_ERROR,("Error: AddBuffer to TS stream failed"));
return STATUS_UNSUCCESSFUL;
}
//release the spin lock to give others access to the buffer queue again
m_pSpinLockObj->ReleaseSpinLock(); // void function
//advance stream pointer to the next available data frame
ntStatus = KsStreamPointerAdvance(pStreamPointer);
if( (ntStatus != STATUS_DEVICE_NOT_READY) &&
(ntStatus != STATUS_SUCCESS) )
{
_DbgPrintF( DEBUGLVL_ERROR,
("Error: Video capture Streampointer advacement failed"));
}
}
return ntStatus;
}
|
b4da018762712cff33a6c42690a75f5aebf13e7e
|
6f874ccb136d411c8ec7f4faf806a108ffc76837
|
/code/VCSamples/VC2008Samples/Attributes/General/AutoThread/AutoServer/AutoServer.cpp
|
9a18465ef9e9c7cb7ce137a14dbeb3032b9c4e41
|
[
"MIT"
] |
permissive
|
JetAr/ZDoc
|
c0f97a8ad8fd1f6a40e687b886f6c25bb89b6435
|
e81a3adc354ec33345e9a3303f381dcb1b02c19d
|
refs/heads/master
| 2022-07-26T23:06:12.021611
| 2021-07-11T13:45:57
| 2021-07-11T13:45:57
| 33,112,803
| 8
| 8
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,932
|
cpp
|
AutoServer.cpp
|
// This is a part of the Active Template Library.
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// This source code is only intended as a supplement to the
// Active Template Library Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Active Template Library product.
// AutoServer.cpp : Implementation of WinMain
// Note: Proxy/Stub Information
// To build a separate proxy/stub DLL,
// run nmake -f AutoServerps.mk in the project directory.
#include "stdafx.h"
#include "resource.h"
#include <initguid.h>
#include "AutoServ.h"
const DWORD dwTimeOut = 5000; // time for EXE to be idle before shutting down
const DWORD dwPause = 1000; // time to wait for threads to finish up
[emitidl];
[module(exe, name="AutoServerLib", uuid="{A6D89F0F-35F4-11D2-9375-00C04FD9757C}", helpstring="AutoServer 1.0 Type Library")];
CAtlAutoThreadModule _AtlAutoThreadModule;
class CAppExeModule : public CAtlAutoThreadModule
{
public:
LONG Unlock();
DWORD dwThreadID;
HANDLE hEventShutdown;
void MonitorShutdown();
bool StartMonitor();
bool bActivity;
};
// Passed to CreateThread to monitor the shutdown event
static DWORD WINAPI MonitorProc(void* pv)
{
CAppExeModule* p = (CAppExeModule*)pv;
p->MonitorShutdown();
return 0;
}
LONG CAppExeModule::Unlock()
{
LONG l = _pAtlModule->Unlock();
if (l == 0)
{
bActivity = true;
SetEvent(hEventShutdown); // tell monitor that we transitioned to zero
}
return l;
}
//Monitors the shutdown event
void CAppExeModule::MonitorShutdown()
{
while (1)
{
WaitForSingleObject(hEventShutdown, INFINITE);
DWORD dwWait=0;
do
{
bActivity = false;
dwWait = WaitForSingleObject(hEventShutdown, dwTimeOut);
}
while (dwWait == WAIT_OBJECT_0);
// timed out
if (!bActivity && _pAtlModule->m_nLockCnt == 0) // if no activity let's really bail
{
#if _WIN32_WINNT >= 0x0400 & defined(_ATL_FREE_THREADED)
CoSuspendClassObjects();
if (!bActivity && _pAtlModule->m_nLockCnt == 0)
#endif
break;
}
}
CloseHandle(hEventShutdown);
PostThreadMessage(dwThreadID, WM_QUIT, 0, 0);
}
bool CAppExeModule::StartMonitor()
{
hEventShutdown = CreateEvent(NULL, false, false, NULL);
if (hEventShutdown == NULL)
return false;
DWORD dwThreadID;
HANDLE h = CreateThread(NULL, 0, MonitorProc, this, 0, &dwThreadID);
return (h != NULL);
}
LPCTSTR FindOneOf(LPCTSTR p1, LPCTSTR p2)
{
while (p1 != NULL && *p1 != NULL)
{
LPCTSTR p = p2;
while (p != NULL && *p != NULL)
{
if (*p1 == *p)
return CharNext(p1);
p = CharNext(p);
}
p1 = CharNext(p1);
}
return NULL;
}
|
93f27122a92d1cd53d48623a69ee665b7c6a826b
|
eabe92ff958be0e5894ed7501780d8eb608b6ae9
|
/app/app_paths.cc
|
4b0c873ceaa99effe2b061758c1e233fad71c034
|
[
"BSD-3-Clause"
] |
permissive
|
meego-tablet-ux/meego-app-browser
|
51bf8a8b8f15d702151a3f32a2598d4621b6926d
|
0f4ef17bd4b399c9c990a2f6ca939099495c2b9c
|
refs/heads/master
| 2021-01-10T21:33:19.677680
| 2011-07-20T01:19:53
| 2011-08-01T07:18:37
| 32,045,345
| 1
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,572
|
cc
|
app_paths.cc
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "app/app_paths.h"
#include "base/command_line.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "base/path_service.h"
namespace app {
bool PathProvider(int key, FilePath* result) {
// Assume that we will not need to create the directory if it does not exist.
// This flag can be set to true for the cases where we want to create it.
bool create_dir = false;
FilePath cur;
switch (key) {
case app::DIR_EXTERNAL_EXTENSIONS:
if (!PathService::Get(base::DIR_MODULE, &cur))
return false;
#if defined(OS_MACOSX)
// On Mac, built-in extensions are in Contents/Extensions, a sibling of
// the App dir. If there are none, it may not exist.
cur = cur.DirName();
cur = cur.Append(FILE_PATH_LITERAL("Extensions"));
create_dir = false;
#else
cur = cur.Append(FILE_PATH_LITERAL("extensions"));
create_dir = true;
#endif
break;
default:
return false;
}
if (create_dir && !file_util::PathExists(cur) &&
!file_util::CreateDirectory(cur))
return false;
*result = cur;
return true;
}
// This cannot be done as a static initializer sadly since Visual Studio will
// eliminate this object file if there is no direct entry point into it.
void RegisterPathProvider() {
PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
}
} // namespace app
|
be8935ecfc22791d5ad1312e8b6969924a52c6d2
|
9931d3b3722eb19b218e648e3a3dfc2dfebc236c
|
/Hard/StringSearching/srch.cpp
|
cbc26d00fb1324131da76374fadd1f922f02df2a
|
[] |
no_license
|
DonaldCameron77/CodeEval
|
cdb14c319cc63fc528833846bc4dfde46607c41e
|
58d59e54d9bf15bce963a615a6b538f2f033a894
|
refs/heads/master
| 2021-01-21T21:48:42.174334
| 2016-03-18T22:41:12
| 2016-03-18T22:41:12
| 17,155,845
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,046
|
cpp
|
srch.cpp
|
/*
STRING SEARCHING - CodeEval Hard challenge
CHALLENGE DESCRIPTION:
You are given two strings. Determine if the second string is a substring
of the first (Do NOT use any substr type library function). The second
string may contain an asterisk(*) which should be treated as a regular
expression i.e. matches zero or more characters. The asterisk can be
escaped by a \ char in which case it should be interpreted as a regular
'*' character. To summarize: the strings can contain alphabets, numbers,
* and \ characters.
INPUT SAMPLE:
Your program should accept as its first argument a path to a filename.
The input file contains two comma delimited strings per line. E.g.
Hello,ell
This is good, is
CodeEval,C*Eval
Old,Young
OUTPUT SAMPLE:
If the second string is indeed a substring of the first, print out a
'true'(lowercase), else print out a 'false'(lowercase), one per line.
E.g.
true
true
true
false
#########################################################################
See above for possibility of '*' wildcard in pat.
The * should be treated like .* in normal regex syntax.
* is greedy, which leads to backtracking situations in a general
regex implementationi (e.g., subject = "abfoocdc" and pattern = "ab*cd",
where the first match attempted is "abfoocdc" - with no following 'd',
one must back up to * matching "foo" only, not "foocd" ) ...
but here we're only interested in a correct Boolean, so we
can take the leftmost match. No need to start with the
rightmost candidate and backtrack if it fails.
*/
#include <iostream>
#include <fstream>
#include <string>
#include <cassert>
using namespace std;
//// simple regex match (internal entry point) ////////////////////////////////////////
bool simple_regex_match( const string & subj, int spos,
const string & pat, int ppos) {
int original_spos = spos; // in case we must restart match to the right
int original_ppos = ppos; // in case we must restart match to the right
char scar = subj[spos];
char pcar = pat[ppos];
// first find a starting point where pat[ppos] matches char in subj
while (scar != pcar) {
++spos;
if (spos == subj.length()) {
return false; // hit end of subject without ever matching.
// (note we could stop looking based on not enough characters
// in subject to satisfy pattern, but this is complicated by
// potential for wildcard in pattern)
}
scar = subj[spos];
}
assert(pat[ppos] == subj[spos]); // i.e., scar == pcar
assert(scar == subj[spos]);
// Resume the synchronized traversal of pat and subj,
// matching as far as possible, and restarting recursively
// if the '@' (originally unescaped '*') is encountered.
// Re-matching subj[spos] with pat[spos] simplifies the logic, IMO.
while (true) {
if (scar != pcar) {
if (pcar == '@') {
return simple_regex_match(subj, ++original_spos,
pat, ppos + 1);
}
else {
// fail - try again with next char to right in subj
return simple_regex_match(subj, ++original_spos,
pat, original_ppos);
}
}
++spos; ++ppos;
if (ppos == pat.length()) {
// exhausted the pattern without a mismatch -> success
return true;
}
else if (spos == subj.length()) {
// ran out of subject before match completed
return false;
}
scar = subj[spos];
pcar = pat[ppos];
}
assert(false);
}
//// simple regex match (external entry point) ////////////////////////////////////////
bool simple_regex_match(const string & subj, string & pat) {
/* Before trying to match, this routine does the following
preprocessing:
1. Returns true if the pattern consists of a single '*'
character.
2. Removes a leading or trailing unescaped '*' from pattern.
3. Scans pattern left to right and does the following
a. removes escape character ('\') preceding a '*'.
b. To help simplify the logic, replaces unescaped '*'s with
another character. Any non-alpha character (printable
preferred 8-) is ok ... how about '@'?
*/
if (pat.length() == 1 && pat[0] == '*') {
return true;
}
if (pat[0] == '*') {
pat.erase(0, 1); // lop it off
}
int pat_last_idx = pat.length() - 1;
if (pat[pat_last_idx] == '*' &&
pat[pat_last_idx - 1] != '\\') {
pat.erase(pat_last_idx, 1);
}
int ppos = pat.length();
while (--ppos >= 0) {
if (pat[ppos] == '*') {
if (pat[ppos - 1] != '\\') {
pat[ppos] = '@';
}
else {
--ppos;
pat.erase(ppos, 1);
}
}
}
bool ans = simple_regex_match(subj, 0, pat, 0);
return ans;
}
int main(int argc, char *argv[]) {
if (argc != 2) {
cout << "usage: " << argv[0] << "<filename>\n";
return 1;
}
ifstream ifs(argv[1]);
string line;
while (getline(ifs, line)) {
unsigned comma_pos = line.find(',');
string subj = line.substr(0, comma_pos);
string pat = line.substr(comma_pos + 1, string::npos);
bool ans = simple_regex_match(subj, pat);
cout << (ans ? "true" : "false") << endl;
} // while getline
}
|
f42ff5a1834dd09a01377f592825e166d8fba564
|
c1228cb737f22622eba656078f1cd6ca1341b175
|
/code/OpenNiPrac01.cpp
|
ac469167eeeed1959f27ff74ca3a3391c052d22d
|
[] |
no_license
|
yosse95ai/OpenNIPrac
|
78f23d18855c5df2be5779ad72e035706c45c1de
|
cb0c55fbe7f48fb5c71f90bac8cc371843443487
|
refs/heads/master
| 2022-12-09T16:53:17.506804
| 2020-08-21T16:16:49
| 2020-08-21T16:16:49
| 288,198,578
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,486
|
cpp
|
OpenNiPrac01.cpp
|
#include <iostream>
#include <stdexcept>
#include <OpenNI.h>
#include <opencv2/opencv.hpp>
class DepthSensor
{
public:
void initialize()
{
// デバイスを取得
openni::Status ret = device.open(openni::ANY_DEVICE);
if (ret != openni::STATUS_OK) {
throw std::runtime_error("openni::Device::open() failed.");
}
// カラーストリームを有効にする
colorStream.create(device, openni::SENSOR_COLOR);
//cangeResolution(colorStream);
colorStream.start();
}
// フレームの更新処理
void update()
{
openni::VideoFrameRef colorFrame;
// 更新されたフレームの取得
colorStream.readFrame(&colorFrame);
// フレームデータを表示できる形に変換する
colorImage = showColorStream(colorFrame);
// フレームデータを表示する
cv::imshow("ColotStream", colorImage);
}
private:
void changeResolutioin(openni::VideoStream& stream)
{
openni::VideoMode mode = stream.getVideoMode();
mode.setResolution(640, 480);
mode.setFps(30);
stream.setVideoMode(mode);
}
// カラーストリームを表示できる形に変換する
cv::Mat showColorStream(const openni::VideoFrameRef& colorFrame)
{
// OpeCVの形にする
cv::Mat colorImage = cv::Mat( colorFrame.getHeight(), colorFrame.getWidth(),
CV_8UC3, (unsigned char*)colorFrame.getData());
// BGR 2 RGB
cv::cvtColor(colorImage, colorImage, cv::COLOR_RGB2BGR);
return colorImage;
}
openni::Device device; // 使用するデバイス
openni::VideoStream colorStream; // カラーストリーム
cv::Mat colorImage; // 表示用データ
};
int main(int argc, const char * argv[])
{
try {
// OpenNIを初期化
openni::OpenNI::initialize();
// センサーを初期化する
DepthSensor sensor;
sensor.initialize();
// メインループ
while (1) {
sensor.update();
int key = cv::waitKey(10);
if (key == 'q') {
break;
}
}
}
catch (std::exception&) {
std::cout << openni::OpenNI::getExtendedError() << std::endl;
}
return 0;
}
|
a0e08c620e93bb1be4c128abfe6c13f3b5f8be35
|
4fd7c6b467277c80d84bed41cf1403600f5f3a29
|
/Graphs/1082 - Componentes Conexos.cpp
|
3f4c895e56326263d7ee28a3ef114ba02b9777f3
|
[] |
no_license
|
EvertonCa/ProgrammingMarathon
|
188259db07cf808833c4526a32cdacbd947401ad
|
f36563aba883e4ff281142c2f7000392c36c046b
|
refs/heads/master
| 2021-01-25T09:52:53.287663
| 2018-08-21T18:42:21
| 2018-08-21T18:42:21
| 123,321,150
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,969
|
cpp
|
1082 - Componentes Conexos.cpp
|
#include<iostream>
#include<vector>
#include<queue>
#include<map>
#include<list>
using namespace std;
#define PRETO 0 // Descendentes já estão pretos ou não tem descendentes.
#define CINZA 1 // Descoberto.
#define BRANCO 2 // Não descoberto.
int *cor;
int contador=0;
list<int> componentes;
list<int>::iterator it3;
using namespace std;
vector<int> *g;
void DFS_visit(int vA)
{
int vB;
vector<int>::iterator it;
cor[vA] = CINZA; // Pinta de cinza o vértice que está sendo avaliado no momento, o que significa que ele acaba de ser descoberto.
componentes.push_back(vA);
for(it = g[vA].begin(); it!=g[vA].end(); it++)
{ // Varre o vector, passando por todos os vértices adjacentes ao vértice u.
vB = *it; // Recebe o valor para que o iterador está apontando
if(cor[vB] == BRANCO)
{
DFS_visit(vB); // A função é chamada, recursivamente, para avaliar o vértice adjacente.
}
}
cor[vA] = PRETO; // Pinta de preto o vértice que está sendo avaliado pela função, já que todos os vértices descendentes dele já foram completamente avaliados (e também pintados de preto).
}
int DFS(int numeroDeVertices)
{
// Alocação dinâmica
cor = new int[numeroDeVertices];
char aux;
int vA;
map<int, char> mapa;
map<int, char>::iterator it2;
mapa.insert(pair<int,char>(0,'a'));
mapa.insert(pair<int,char>(1,'b'));
mapa.insert(pair<int,char>(2,'c'));
mapa.insert(pair<int,char>(3,'d'));
mapa.insert(pair<int,char>(4,'e'));
mapa.insert(pair<int,char>(5,'f'));
mapa.insert(pair<int,char>(6,'g'));
mapa.insert(pair<int,char>(7,'h'));
mapa.insert(pair<int,char>(8,'i'));
mapa.insert(pair<int,char>(9,'j'));
mapa.insert(pair<int,char>(10,'k'));
mapa.insert(pair<int,char>(11,'l'));
mapa.insert(pair<int,char>(12,'m'));
mapa.insert(pair<int,char>(13,'n'));
mapa.insert(pair<int,char>(14,'o'));
mapa.insert(pair<int,char>(15,'p'));
mapa.insert(pair<int,char>(16,'q'));
mapa.insert(pair<int,char>(17,'r'));
mapa.insert(pair<int,char>(18,'s'));
mapa.insert(pair<int,char>(19,'t'));
mapa.insert(pair<int,char>(20,'u'));
mapa.insert(pair<int,char>(21,'v'));
mapa.insert(pair<int,char>(22,'w'));
mapa.insert(pair<int,char>(23,'x'));
mapa.insert(pair<int,char>(24,'y'));
mapa.insert(pair<int,char>(25,'z'));
for(vA=0; vA < numeroDeVertices; vA++)
{ // Coloca os valores iniciais em todas as posições dos vetores cor, descoberta e predecessor.
cor[vA] = BRANCO;
}
for(int i=0; i < numeroDeVertices; i++)
{
if(cor[i]==BRANCO)
{
DFS_visit(i); // Chama uma segunda função, que será utilizada recursivamente, enviando o vértice raiz como parâmetro.
componentes.sort();
for(it3=componentes.begin(); it3!=componentes.end(); ++it3)
{
it2 = mapa.find(*it3);
aux = it2->second;
cout<<aux<<",";
}
componentes.clear();
cout<<endl;
contador++;
}
}
return contador;
}
int main()
{
int N, M, testes, aux1, aux2, quant;
char vertice1, vertice2;
map<char, int> mapa;
map<char, int>::iterator it;
mapa.insert(pair<char,int>('a',0));
mapa.insert(pair<char,int>('b',1));
mapa.insert(pair<char,int>('c',2));
mapa.insert(pair<char,int>('d',3));
mapa.insert(pair<char,int>('e',4));
mapa.insert(pair<char,int>('f',5));
mapa.insert(pair<char,int>('g',6));
mapa.insert(pair<char,int>('h',7));
mapa.insert(pair<char,int>('i',8));
mapa.insert(pair<char,int>('j',9));
mapa.insert(pair<char,int>('k',10));
mapa.insert(pair<char,int>('l',11));
mapa.insert(pair<char,int>('m',12));
mapa.insert(pair<char,int>('n',13));
mapa.insert(pair<char,int>('o',14));
mapa.insert(pair<char,int>('p',15));
mapa.insert(pair<char,int>('q',16));
mapa.insert(pair<char,int>('r',17));
mapa.insert(pair<char,int>('s',18));
mapa.insert(pair<char,int>('t',19));
mapa.insert(pair<char,int>('u',20));
mapa.insert(pair<char,int>('v',21));
mapa.insert(pair<char,int>('w',22));
mapa.insert(pair<char,int>('x',23));
mapa.insert(pair<char,int>('y',24));
mapa.insert(pair<char,int>('z',25));
cin>>testes;
for (int k = 0; k < testes; ++k)
{
cin>>N>>M;
g = new vector<int> [N+1];
for(int i=0;i<M;i++)
{
cin>>vertice1>>vertice2;
it = mapa.find(vertice1);
aux1 = it->second;
it = mapa.find(vertice2);
aux2 = it->second;
g[aux1].push_back(aux2);
g[aux2].push_back(aux1);
}
cout<<"Case #"<<k+1<<":"<<endl;
quant = DFS(N);
cout<<quant<<" connected components"<<endl<<endl;
quant = 0;
contador=0;
}
}
|
20c0a00d446e66c6ae60fb61b69d51e614a3d882
|
6839815d8871e878057ff8aa761923b84172f0ec
|
/samples/example_main/main.cpp
|
b0d7aa81e51c1db93967c761685695224906ac9b
|
[
"BSD-3-Clause"
] |
permissive
|
graphprocessing/graph_coarsening
|
7e2d96b9fae5628ecf93a58c4dadaef237b7135f
|
c570c7c301be5fe8d521c418402f20c76b147433
|
refs/heads/master
| 2021-07-13T12:11:12.183890
| 2020-06-24T01:00:24
| 2020-06-24T01:00:24
| 164,952,532
| 3
| 7
|
BSD-3-Clause
| 2020-06-24T01:00:26
| 2019-01-09T23:09:28
|
C++
|
UTF-8
|
C++
| false
| false
| 786
|
cpp
|
main.cpp
|
// Copyright [year] <Copyright Owner>
#include "modules/pch/include/precomp.h"
int main(int argc, char** argv) {
(void) argc; (void) argv;
std::cout << "main" << std::endl;
// Timer sample
std::cout << std::fixed;
std::cout << "Execution time for washington_test (n = 2): "
<< Timer::calculate(washington_test<int>, 2, false)
<< " s" << std::endl << std::endl;
std::cout << "Execution time for washington_test (n = 1e6): "
<< Timer::calculate(washington_test<int>,
1000000, false)
<< " s" << std::endl << std::endl;
std::cout << "graph_visualization" << std::endl;
AL <int> gr = washington_test<int>(100);
export_for_visualization(gr, "graph.txt");
return 0;
}
|
df97b5f7ca0d23c4e14024fcc855ca39e6c7f9ca
|
80b618f3667f97319b7164ac28d65f5c82ea6a6e
|
/Source/SparkPlug/Image.h
|
885a3d28193b897836c5778bd7350021210d2615
|
[] |
no_license
|
henry4k/sparkplug-core
|
1929d1e5b5ad13587cea297dc61aaeee84c85f3d
|
f8c0a27c6e9bdc65b74516a63ae99a806eb3610b
|
refs/heads/master
| 2021-01-23T13:41:41.338324
| 2013-10-14T17:23:00
| 2013-10-14T17:23:00
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 876
|
h
|
Image.h
|
#ifndef __SPARKPLUG_IMAGE__
#define __SPARKPLUG_IMAGE__
#include <SparkPlug/Pixel.h>
namespace SparkPlug
{
class Image
{
public:
Image();
Image( PixelFormat format, int width, int height, int depth );
~Image();
/**
* (Re-)Initializes an image with new content.
* IMPORTANT: The pixel data is not memcopied,
* its used directly as internal data pointer.
*/
void initFromRaw( PixelFormat format, int width, int height, int depth, void* pixels );
const PixelFormat& format() const;
int width() const;
int height() const;
int depth() const;
void* pixels();
const void* pixels() const;
void* pixelAt( int x, int y, int z );
const void* pixelAt( int x, int y, int z ) const;
private:
Image( const Image& source );
Image& operator = ( const Image& source );
PixelFormat m_Format;
int m_Width, m_Height, m_Depth;
char* m_Data;
};
}
#endif
|
4ea11d063a99737882da061e64523dcb5b8ac14f
|
72bb6deb4a8657fc494777847e356c328fe8550d
|
/gicp/gicpwrapper-fuerte/src/ColorOctreeImpl.cpp
|
2b947de1fc034a949af877848e901e455dcd67fe
|
[] |
no_license
|
rising-turtle/study
|
daafeac486e274af47268e9c7d66feacd3476a44
|
76b414d0a47692f997539b34b356c34a3528f34d
|
refs/heads/master
| 2021-12-09T07:23:41.800642
| 2021-12-02T19:34:44
| 2021-12-02T19:34:44
| 90,572,871
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,622
|
cpp
|
ColorOctreeImpl.cpp
|
#include "ColorOctreeImpl.h"
#include "ros/ros.h"
using namespace octomap;
ColorOctreeImpl::ColorOctreeImpl(float res):ColorOcTree(res){}
ColorOctreeImpl::~ColorOctreeImpl(){}
gl_color ColorOctreeImpl::s_octree_color(getRed());
void ColorOctreeImpl::setOctreeColor(gl_color& new_color){ColorOctreeImpl::s_octree_color = new_color;}
void ColorOctreeImpl::insertPointCloud(const Pointcloud& oct_pc, const octomap::point3d& sensor_origin,
double maxrange, bool lazy_eval)
{
ROS_WARN("in the devired class function!");
KeySet free_cells, occupied_cells;
computeUpdate(oct_pc, sensor_origin, free_cells, occupied_cells, maxrange);
for (KeySet::iterator it = free_cells.begin(); it != free_cells.end(); ++it) {
updateNode(*it, false, lazy_eval);
}
for (KeySet::iterator it = occupied_cells.begin(); it != occupied_cells.end(); ++it) {
updateNode(*it, true, lazy_eval);
setNodeColor(*it, s_octree_color.r_, s_octree_color.g_, s_octree_color.b_ );
// ColorOcTreeNode* pNode = search(*it);
// printf("input color is %d, %d, %d\n", pNode->getColor().r, pNode->getColor().g, pNode->getColor().b);
}
}
void ColorOctreeImpl::insertPointCloud(const octomap::Pointcloud& oct_pc, const octomap::point3d& ori_pose, const octomap::pose6d& frame_origin, double maxrange, bool lazy_eval)
{
Pointcloud transformed_scan (oct_pc);
transformed_scan.transform(frame_origin);
point3d transformed_sensor_origin = frame_origin.transform(ori_pose);
insertPointCloud(transformed_scan, transformed_sensor_origin, maxrange, lazy_eval);
}
|
a1b96ca77ab5ef2420216e7c89850a5f9b958f5e
|
ac4e8f26a0c38bd34b4c55d0acc3d8215d55ac9c
|
/dla_barneya/Kod/Kod/RiskApp.cpp
|
83447b8ca6563859ec0d22a55906e3c90dcf887b
|
[] |
no_license
|
kamciak/Ryzyko
|
6e58d13905271328184ea0a76c976d09b910427b
|
e9c758b754b3e0fe5a351e534466e357805a9bfd
|
refs/heads/master
| 2021-01-01T15:41:10.621076
| 2013-01-21T12:17:15
| 2013-01-21T12:17:15
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 537
|
cpp
|
RiskApp.cpp
|
//---------------------------------------------------------------------------
//
// Name: RiskApp.cpp
// Author: Piotrek
// Created: 2012-10-19 20:31:21
// Description:
//
//---------------------------------------------------------------------------
#include "RiskApp.h"
#include "RiskFrm.h"
IMPLEMENT_APP(RiskFrmApp)
bool RiskFrmApp::OnInit()
{
RiskFrm* frame = new RiskFrm(NULL);
SetTopWindow(frame);
frame->Show();
return true;
}
int RiskFrmApp::OnExit()
{
return 0;
}
|
5b84f8ba1c322a0476b7644ff9b40216d1a9723d
|
65ce464a6361d2d4096ee8d0d97bca76c8025a5e
|
/P1_Discrete_Event_Simulation/src/Config.cpp
|
19e9f66b8d6aa2de528b5d7ba9c4ebca63a9cf55
|
[] |
no_license
|
tuh37046/CIS3207
|
857a7aa85ab62cba75481bb31b951e3862799d0c
|
e98219c47930eae59dc7775ae1ef81dd89087752
|
refs/heads/master
| 2020-07-20T08:45:02.680671
| 2019-12-09T05:46:30
| 2019-12-09T05:46:30
| 206,610,915
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 151
|
cpp
|
Config.cpp
|
#include "Config.h"
int find(const std::string &s, char c) {
for(int i=0;i<s.size();i++) {
if(s[i] == c) return i;
}
return -1;
}
|
e4cae152a59fa377245946743c7aba75fdaf5350
|
81e051c660949ac0e89d1e9cf286e1ade3eed16a
|
/quake3ce/code/game/g_cmds.cpp
|
7b19c852ccc653fb7c8b868fc7a16faf94c75a01
|
[] |
no_license
|
crioux/q3ce
|
e89c3b60279ea187a2ebcf78dbe1e9f747a31d73
|
5e724f55940ac43cb25440a65f9e9e12220c9ada
|
refs/heads/master
| 2020-06-04T10:29:48.281238
| 2008-11-16T15:00:38
| 2008-11-16T15:00:38
| 32,103,416
| 5
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 44,729
|
cpp
|
g_cmds.cpp
|
/*
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.
This file is part of Quake III Arena source code.
Quake III Arena source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
Quake III Arena source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foobar; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
//
#include"game_pch.h"
/*
==================
DeathmatchScoreboardMessage
==================
*/
void DeathmatchScoreboardMessage( gentity_t *ent ) {
char entry[1024];
char string[1400];
int stringlength;
int i, j;
gclient_t *cl;
int numSorted, scoreFlags, accuracy, perfect;
// send the latest information on all clients
string[0] = 0;
stringlength = 0;
scoreFlags = 0;
numSorted = level.numConnectedClients;
for (i=0 ; i < numSorted ; i++) {
int ping;
cl = &level.clients[level.sortedClients[i]];
if ( cl->pers.connected == CON_CONNECTING ) {
ping = -1;
} else {
ping = cl->ps.ping < 999 ? cl->ps.ping : 999;
}
if( cl->accuracy_shots ) {
accuracy = cl->accuracy_hits * 100 / cl->accuracy_shots;
}
else {
accuracy = 0;
}
perfect = ( cl->ps.persistant[PERS_RANK] == 0 && cl->ps.persistant[PERS_KILLED] == 0 ) ? 1 : 0;
Com_sprintf (entry, sizeof(entry),
" %i %i %i %i %i %i %i %i %i %i %i %i %i %i", level.sortedClients[i],
cl->ps.persistant[PERS_SCORE], ping, (level.time - cl->pers.enterTime)/60000,
scoreFlags, g_entities[level.sortedClients[i]].s.powerups, accuracy,
cl->ps.persistant[PERS_IMPRESSIVE_COUNT],
cl->ps.persistant[PERS_EXCELLENT_COUNT],
cl->ps.persistant[PERS_GAUNTLET_FRAG_COUNT],
cl->ps.persistant[PERS_DEFEND_COUNT],
cl->ps.persistant[PERS_ASSIST_COUNT],
perfect,
cl->ps.persistant[PERS_CAPTURES]);
j = strlen(entry);
if (stringlength + j > 1024)
break;
strcpy (string + stringlength, entry);
stringlength += j;
}
_G_trap_SendServerCommand( ent-g_entities, va("scores %i %i %i%s", i,
level.teamScores[TEAM_RED], level.teamScores[TEAM_BLUE],
string ) );
}
/*
==================
Cmd_Score_f
Request current scoreboard information
==================
*/
void Cmd_Score_f( gentity_t *ent ) {
DeathmatchScoreboardMessage( ent );
}
/*
==================
CheatsOk
==================
*/
qboolean CheatsOk( gentity_t *ent ) {
if ( !g_cheats.integer ) {
_G_trap_SendServerCommand( ent-g_entities, va("print \"Cheats are not enabled on this server.\n\""));
return qfalse;
}
if ( ent->health <= 0 ) {
_G_trap_SendServerCommand( ent-g_entities, va("print \"You must be alive to use this command.\n\""));
return qfalse;
}
return qtrue;
}
/*
==================
ConcatArgs
==================
*/
char *ConcatArgs( int start ) {
int i, c, tlen;
static char line[MAX_STRING_CHARS];
int len;
char arg[MAX_STRING_CHARS];
len = 0;
c = _G_trap_Argc();
for ( i = start ; i < c ; i++ ) {
_G_trap_Argv( i, arg, sizeof( arg ) );
tlen = strlen( arg );
if ( len + tlen >= MAX_STRING_CHARS - 1 ) {
break;
}
memcpy( line + len, arg, tlen );
len += tlen;
if ( i != c - 1 ) {
line[len] = ' ';
len++;
}
}
line[len] = 0;
return line;
}
/*
==================
SanitizeString
Remove case and control characters
==================
*/
void SanitizeString( char *in, char *out ) {
while ( *in ) {
if ( *in == 27 ) {
in += 2; // skip color code
continue;
}
if ( *in < 32 ) {
in++;
continue;
}
*out++ = tolower( *in++ );
}
*out = 0;
}
/*
==================
ClientNumberFromString
Returns a player number for either a number or name string
Returns -1 if invalid
==================
*/
int ClientNumberFromString( gentity_t *to, char *s ) {
gclient_t *cl;
int idnum;
char s2[MAX_STRING_CHARS];
char n2[MAX_STRING_CHARS];
// numeric values are just slot numbers
if (s[0] >= '0' && s[0] <= '9') {
idnum = atoi( s );
if ( idnum < 0 || idnum >= level.maxclients ) {
_G_trap_SendServerCommand( to-g_entities, va("print \"Bad client slot: %i\n\"", idnum));
return -1;
}
cl = &level.clients[idnum];
if ( cl->pers.connected != CON_CONNECTED ) {
_G_trap_SendServerCommand( to-g_entities, va("print \"Client %i is not active\n\"", idnum));
return -1;
}
return idnum;
}
// check for a name match
SanitizeString( s, s2 );
for ( idnum=0,cl=level.clients ; idnum < level.maxclients ; idnum++,cl++ ) {
if ( cl->pers.connected != CON_CONNECTED ) {
continue;
}
SanitizeString( cl->pers.netname, n2 );
if ( !strcmp( n2, s2 ) ) {
return idnum;
}
}
_G_trap_SendServerCommand( to-g_entities, va("print \"User %s is not on the server\n\"", s));
return -1;
}
/*
==================
Cmd_Give_f
Give items to a client
==================
*/
void Cmd_Give_f (gentity_t *ent)
{
char *name;
gitem_t *it;
int i;
qboolean give_all;
gentity_t *it_ent;
trace_t trace;
if ( !CheatsOk( ent ) ) {
return;
}
name = ConcatArgs( 1 );
if (Q_stricmp(name, "all") == 0)
give_all = qtrue;
else
give_all = qfalse;
if (give_all || Q_stricmp( name, "health") == 0)
{
ent->health = ent->client->ps.stats[STAT_MAX_HEALTH];
if (!give_all)
return;
}
if (give_all || Q_stricmp(name, "weapons") == 0)
{
ent->client->ps.stats[STAT_WEAPONS] = (1 << WP_NUM_WEAPONS) - 1 -
( 1 << WP_GRAPPLING_HOOK ) - ( 1 << WP_NONE );
if (!give_all)
return;
}
if (give_all || Q_stricmp(name, "ammo") == 0)
{
for ( i = 0 ; i < MAX_WEAPONS ; i++ ) {
ent->client->ps.ammo[i] = 999;
}
if (!give_all)
return;
}
if (give_all || Q_stricmp(name, "armor") == 0)
{
ent->client->ps.stats[STAT_ARMOR] = 200;
if (!give_all)
return;
}
if (Q_stricmp(name, "excellent") == 0) {
ent->client->ps.persistant[PERS_EXCELLENT_COUNT]++;
return;
}
if (Q_stricmp(name, "impressive") == 0) {
ent->client->ps.persistant[PERS_IMPRESSIVE_COUNT]++;
return;
}
if (Q_stricmp(name, "gauntletaward") == 0) {
ent->client->ps.persistant[PERS_GAUNTLET_FRAG_COUNT]++;
return;
}
if (Q_stricmp(name, "defend") == 0) {
ent->client->ps.persistant[PERS_DEFEND_COUNT]++;
return;
}
if (Q_stricmp(name, "assist") == 0) {
ent->client->ps.persistant[PERS_ASSIST_COUNT]++;
return;
}
// spawn a specific item right on the player
if ( !give_all ) {
it = BG_FindItem (name);
if (!it) {
return;
}
it_ent = G_Spawn();
VectorCopy( ent->r.currentOrigin, it_ent->s.origin );
it_ent->classname = it->classname;
G_SpawnItem (it_ent, it);
FinishSpawningItem(it_ent );
memset( &trace, 0, sizeof( trace ) );
Touch_Item (it_ent, ent, &trace);
if (it_ent->inuse) {
G_FreeEntity( it_ent );
}
}
}
/*
==================
Cmd_God_f
Sets client to godmode
argv(0) god
==================
*/
void Cmd_God_f (gentity_t *ent)
{
const char *msg;
if ( !CheatsOk( ent ) ) {
return;
}
ent->flags ^= FL_GODMODE;
if (!(ent->flags & FL_GODMODE) )
msg = "godmode OFF\n";
else
msg = "godmode ON\n";
_G_trap_SendServerCommand( ent-g_entities, va("print \"%s\"", msg));
}
/*
==================
Cmd_Notarget_f
Sets client to notarget
argv(0) notarget
==================
*/
void Cmd_Notarget_f( gentity_t *ent ) {
const char *msg;
if ( !CheatsOk( ent ) ) {
return;
}
ent->flags ^= FL_NOTARGET;
if (!(ent->flags & FL_NOTARGET) )
msg = "notarget OFF\n";
else
msg = "notarget ON\n";
_G_trap_SendServerCommand( ent-g_entities, va("print \"%s\"", msg));
}
/*
==================
Cmd_Noclip_f
argv(0) noclip
==================
*/
void Cmd_Noclip_f( gentity_t *ent ) {
const char *msg;
if ( !CheatsOk( ent ) ) {
return;
}
if ( ent->client->noclip ) {
msg = "noclip OFF\n";
} else {
msg = "noclip ON\n";
}
ent->client->noclip = !ent->client->noclip;
_G_trap_SendServerCommand( ent-g_entities, va("print \"%s\"", msg));
}
/*
==================
Cmd_LevelShot_f
This is just to help generate the level pictures
for the menus. It goes to the intermission immediately
and sends over a command to the client to resize the view,
hide the scoreboard, and take a special screenshot
==================
*/
void Cmd_LevelShot_f( gentity_t *ent ) {
if ( !CheatsOk( ent ) ) {
return;
}
// doesn't work in single player
if ( g_gametype.integer != 0 ) {
_G_trap_SendServerCommand( ent-g_entities,
"print \"Must be in g_gametype 0 for levelshot\n\"" );
return;
}
BeginIntermission();
_G_trap_SendServerCommand( ent-g_entities, "clientLevelShot" );
}
/*
==================
Cmd_LevelShot_f
This is just to help generate the level pictures
for the menus. It goes to the intermission immediately
and sends over a command to the client to resize the view,
hide the scoreboard, and take a special screenshot
==================
*/
void Cmd_TeamTask_f( gentity_t *ent ) {
char userinfo[MAX_INFO_STRING];
char arg[MAX_TOKEN_CHARS];
int task;
int client = ent->client - level.clients;
if ( _G_trap_Argc() != 2 ) {
return;
}
_G_trap_Argv( 1, arg, sizeof( arg ) );
task = atoi( arg );
_G_trap_GetUserinfo(client, userinfo, sizeof(userinfo));
Info_SetValueForKey(userinfo, "teamtask", va("%d", task));
_G_trap_SetUserinfo(client, userinfo);
ClientUserinfoChanged(client);
}
/*
=================
Cmd_Kill_f
=================
*/
void Cmd_Kill_f( gentity_t *ent ) {
if ( ent->client->sess.sessionTeam == TEAM_SPECTATOR ) {
return;
}
if (ent->health <= 0) {
return;
}
ent->flags &= ~FL_GODMODE;
ent->client->ps.stats[STAT_HEALTH] = ent->health = -999;
player_die (ent, ent, ent, 100000, MOD_SUICIDE);
}
/*
=================
BroadCastTeamChange
Let everyone know about a team change
=================
*/
void BroadcastTeamChange( gclient_t *client, int oldTeam )
{
if ( client->sess.sessionTeam == TEAM_RED ) {
_G_trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined the red team.\n\"",
client->pers.netname) );
} else if ( client->sess.sessionTeam == TEAM_BLUE ) {
_G_trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined the blue team.\n\"",
client->pers.netname));
} else if ( client->sess.sessionTeam == TEAM_SPECTATOR && oldTeam != TEAM_SPECTATOR ) {
_G_trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined the spectators.\n\"",
client->pers.netname));
} else if ( client->sess.sessionTeam == TEAM_FREE ) {
_G_trap_SendServerCommand( -1, va("cp \"%s" S_COLOR_WHITE " joined the battle.\n\"",
client->pers.netname));
}
}
/*
=================
SetTeam
=================
*/
void SetTeam( gentity_t *ent, const char *s ) {
int team, oldTeam;
gclient_t *client;
int clientNum;
spectatorState_t specState;
int specClient;
int teamLeader;
//
// see what change is requested
//
client = ent->client;
clientNum = client - level.clients;
specClient = 0;
specState = SPECTATOR_NOT;
if ( !Q_stricmp( s, "scoreboard" ) || !Q_stricmp( s, "score" ) ) {
team = TEAM_SPECTATOR;
specState = SPECTATOR_SCOREBOARD;
} else if ( !Q_stricmp( s, "follow1" ) ) {
team = TEAM_SPECTATOR;
specState = SPECTATOR_FOLLOW;
specClient = -1;
} else if ( !Q_stricmp( s, "follow2" ) ) {
team = TEAM_SPECTATOR;
specState = SPECTATOR_FOLLOW;
specClient = -2;
} else if ( !Q_stricmp( s, "spectator" ) || !Q_stricmp( s, "s" ) ) {
team = TEAM_SPECTATOR;
specState = SPECTATOR_FREE;
} else if ( g_gametype.integer >= GT_TEAM ) {
// if running a team game, assign player to one of the teams
specState = SPECTATOR_NOT;
if ( !Q_stricmp( s, "red" ) || !Q_stricmp( s, "r" ) ) {
team = TEAM_RED;
} else if ( !Q_stricmp( s, "blue" ) || !Q_stricmp( s, "b" ) ) {
team = TEAM_BLUE;
} else {
// pick the team with the least number of players
team = PickTeam( clientNum );
}
if ( g_teamForceBalance.integer ) {
int counts[TEAM_NUM_TEAMS];
counts[TEAM_BLUE] = TeamCount( ent->client->ps.clientNum, TEAM_BLUE );
counts[TEAM_RED] = TeamCount( ent->client->ps.clientNum, TEAM_RED );
// We allow a spread of two
if ( team == TEAM_RED && counts[TEAM_RED] - counts[TEAM_BLUE] > 1 ) {
_G_trap_SendServerCommand( ent->client->ps.clientNum,
"cp \"Red team has too many players.\n\"" );
return; // ignore the request
}
if ( team == TEAM_BLUE && counts[TEAM_BLUE] - counts[TEAM_RED] > 1 ) {
_G_trap_SendServerCommand( ent->client->ps.clientNum,
"cp \"Blue team has too many players.\n\"" );
return; // ignore the request
}
// It's ok, the team we are switching to has less or same number of players
}
} else {
// force them to spectators if there aren't any spots free
team = TEAM_FREE;
}
// override decision if limiting the players
if ( (g_gametype.integer == GT_TOURNAMENT)
&& level.numNonSpectatorClients >= 2 ) {
team = TEAM_SPECTATOR;
} else if ( g_maxGameClients.integer > 0 &&
level.numNonSpectatorClients >= g_maxGameClients.integer ) {
team = TEAM_SPECTATOR;
}
//
// decide if we will allow the change
//
oldTeam = client->sess.sessionTeam;
if ( team == oldTeam && team != TEAM_SPECTATOR ) {
return;
}
//
// execute the team change
//
// if the player was dead leave the body
if ( client->ps.stats[STAT_HEALTH] <= 0 ) {
CopyToBodyQue(ent);
}
// he starts at 'base'
client->pers.teamState.state = TEAM_BEGIN;
if ( oldTeam != TEAM_SPECTATOR ) {
// Kill him (makes sure he loses flags, etc)
ent->flags &= ~FL_GODMODE;
ent->client->ps.stats[STAT_HEALTH] = ent->health = 0;
player_die (ent, ent, ent, 100000, MOD_SUICIDE);
}
// they go to the end of the line for tournements
if ( team == TEAM_SPECTATOR ) {
client->sess.spectatorTime = level.time;
}
client->sess.sessionTeam = (team_t)team;
client->sess.spectatorState = specState;
client->sess.spectatorClient = specClient;
client->sess.teamLeader = qfalse;
if ( team == TEAM_RED || team == TEAM_BLUE ) {
teamLeader = TeamLeader( team );
// if there is no team leader or the team leader is a bot and this client is not a bot
if ( teamLeader == -1 || ( !(g_entities[clientNum].r.svFlags & SVF_BOT) && (g_entities[teamLeader].r.svFlags & SVF_BOT) ) ) {
SetLeader( team, clientNum );
}
}
// make sure there is a team leader on the team the player came from
if ( oldTeam == TEAM_RED || oldTeam == TEAM_BLUE ) {
CheckTeamLeader( oldTeam );
}
BroadcastTeamChange( client, oldTeam );
// get and distribute relevent paramters
ClientUserinfoChanged( clientNum );
ClientBegin( clientNum );
}
/*
=================
StopFollowing
If the client being followed leaves the game, or you just want to drop
to free floating spectator mode
=================
*/
void StopFollowing( gentity_t *ent ) {
ent->client->ps.persistant[ PERS_TEAM ] = TEAM_SPECTATOR;
ent->client->sess.sessionTeam = TEAM_SPECTATOR;
ent->client->sess.spectatorState = SPECTATOR_FREE;
ent->client->ps.pm_flags &= ~PMF_FOLLOW;
ent->r.svFlags &= ~SVF_BOT;
ent->client->ps.clientNum = ent - g_entities;
}
/*
=================
Cmd_Team_f
=================
*/
void Cmd_Team_f( gentity_t *ent ) {
int oldTeam;
char s[MAX_TOKEN_CHARS];
if ( _G_trap_Argc() != 2 ) {
oldTeam = ent->client->sess.sessionTeam;
switch ( oldTeam ) {
case TEAM_BLUE:
_G_trap_SendServerCommand( ent-g_entities, "print \"Blue team\n\"" );
break;
case TEAM_RED:
_G_trap_SendServerCommand( ent-g_entities, "print \"Red team\n\"" );
break;
case TEAM_FREE:
_G_trap_SendServerCommand( ent-g_entities, "print \"Free team\n\"" );
break;
case TEAM_SPECTATOR:
_G_trap_SendServerCommand( ent-g_entities, "print \"Spectator team\n\"" );
break;
}
return;
}
if ( ent->client->switchTeamTime > level.time ) {
_G_trap_SendServerCommand( ent-g_entities, "print \"May not switch teams more than once per 5 seconds.\n\"" );
return;
}
// if they are playing a tournement game, count as a loss
if ( (g_gametype.integer == GT_TOURNAMENT )
&& ent->client->sess.sessionTeam == TEAM_FREE ) {
ent->client->sess.losses++;
}
_G_trap_Argv( 1, s, sizeof( s ) );
SetTeam( ent, s );
ent->client->switchTeamTime = level.time + 5000;
}
/*
=================
Cmd_Follow_f
=================
*/
void Cmd_Follow_f( gentity_t *ent ) {
int i;
char arg[MAX_TOKEN_CHARS];
if ( _G_trap_Argc() != 2 ) {
if ( ent->client->sess.spectatorState == SPECTATOR_FOLLOW ) {
StopFollowing( ent );
}
return;
}
_G_trap_Argv( 1, arg, sizeof( arg ) );
i = ClientNumberFromString( ent, arg );
if ( i == -1 ) {
return;
}
// can't follow self
if ( &level.clients[ i ] == ent->client ) {
return;
}
// can't follow another spectator
if ( level.clients[ i ].sess.sessionTeam == TEAM_SPECTATOR ) {
return;
}
// if they are playing a tournement game, count as a loss
if ( (g_gametype.integer == GT_TOURNAMENT )
&& ent->client->sess.sessionTeam == TEAM_FREE ) {
ent->client->sess.losses++;
}
// first set them to spectator
if ( ent->client->sess.sessionTeam != TEAM_SPECTATOR ) {
SetTeam( ent, "spectator" );
}
ent->client->sess.spectatorState = SPECTATOR_FOLLOW;
ent->client->sess.spectatorClient = i;
}
/*
=================
Cmd_FollowCycle_f
=================
*/
void Cmd_FollowCycle_f( gentity_t *ent, int dir ) {
int clientnum;
int original;
// if they are playing a tournement game, count as a loss
if ( (g_gametype.integer == GT_TOURNAMENT )
&& ent->client->sess.sessionTeam == TEAM_FREE ) {
ent->client->sess.losses++;
}
// first set them to spectator
if ( ent->client->sess.spectatorState == SPECTATOR_NOT ) {
SetTeam( ent, "spectator" );
}
if ( dir != 1 && dir != -1 ) {
G_Error( "Cmd_FollowCycle_f: bad dir %i", dir );
}
clientnum = ent->client->sess.spectatorClient;
original = clientnum;
do {
clientnum += dir;
if ( clientnum >= level.maxclients ) {
clientnum = 0;
}
if ( clientnum < 0 ) {
clientnum = level.maxclients - 1;
}
// can only follow connected clients
if ( level.clients[ clientnum ].pers.connected != CON_CONNECTED ) {
continue;
}
// can't follow another spectator
if ( level.clients[ clientnum ].sess.sessionTeam == TEAM_SPECTATOR ) {
continue;
}
// this is good, we can use it
ent->client->sess.spectatorClient = clientnum;
ent->client->sess.spectatorState = SPECTATOR_FOLLOW;
return;
} while ( clientnum != original );
// leave it where it was
}
/*
==================
G_Say
==================
*/
static void G_SayTo( gentity_t *ent, gentity_t *other, int mode, int color, const char *name, const char *message ) {
if (!other) {
return;
}
if (!other->inuse) {
return;
}
if (!other->client) {
return;
}
if ( other->client->pers.connected != CON_CONNECTED ) {
return;
}
if ( mode == SAY_TEAM && !OnSameTeam(ent, other) ) {
return;
}
// no chatting to players in tournements
if ( (g_gametype.integer == GT_TOURNAMENT )
&& other->client->sess.sessionTeam == TEAM_FREE
&& ent->client->sess.sessionTeam != TEAM_FREE ) {
return;
}
_G_trap_SendServerCommand( other-g_entities, va("%s \"%s%c%c%s\"",
mode == SAY_TEAM ? "tchat" : "chat",
name, Q_COLOR_ESCAPE, color, message));
}
#define EC "\x19"
void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText ) {
int j;
gentity_t *other;
int color;
char name[64];
// don't let text be too long for malicious reasons
char text[MAX_SAY_TEXT];
char location[64];
if ( g_gametype.integer < GT_TEAM && mode == SAY_TEAM ) {
mode = SAY_ALL;
}
switch ( mode ) {
default:
case SAY_ALL:
G_LogPrintf( "say: %s: %s\n", ent->client->pers.netname, chatText );
Com_sprintf (name, sizeof(name), "%s%c%c"EC": ", ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE );
color = COLOR_GREEN;
break;
case SAY_TEAM:
G_LogPrintf( "sayteam: %s: %s\n", ent->client->pers.netname, chatText );
if (Team_GetLocationMsg(ent, location, sizeof(location)))
Com_sprintf (name, sizeof(name), EC"(%s%c%c"EC") (%s)"EC": ",
ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE, location);
else
Com_sprintf (name, sizeof(name), EC"(%s%c%c"EC")"EC": ",
ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE );
color = COLOR_CYAN;
break;
case SAY_TELL:
if (target && g_gametype.integer >= GT_TEAM &&
target->client->sess.sessionTeam == ent->client->sess.sessionTeam &&
Team_GetLocationMsg(ent, location, sizeof(location)))
Com_sprintf (name, sizeof(name), EC"[%s%c%c"EC"] (%s)"EC": ", ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE, location );
else
Com_sprintf (name, sizeof(name), EC"[%s%c%c"EC"]"EC": ", ent->client->pers.netname, Q_COLOR_ESCAPE, COLOR_WHITE );
color = COLOR_MAGENTA;
break;
}
Q_strncpyz( text, chatText, sizeof(text) );
if ( target ) {
G_SayTo( ent, target, mode, color, name, text );
return;
}
// echo the text to the console
if ( g_dedicated.integer ) {
G_Printf( "%s%s\n", name, text);
}
// send it to all the apropriate clients
for (j = 0; j < level.maxclients; j++) {
other = &g_entities[j];
G_SayTo( ent, other, mode, color, name, text );
}
}
/*
==================
Cmd_Say_f
==================
*/
static void Cmd_Say_f( gentity_t *ent, int mode, qboolean arg0 ) {
char *p;
if ( _G_trap_Argc () < 2 && !arg0 ) {
return;
}
if (arg0)
{
p = ConcatArgs( 0 );
}
else
{
p = ConcatArgs( 1 );
}
G_Say( ent, NULL, mode, p );
}
/*
==================
Cmd_Tell_f
==================
*/
static void Cmd_Tell_f( gentity_t *ent ) {
int targetNum;
gentity_t *target;
char *p;
char arg[MAX_TOKEN_CHARS];
if ( _G_trap_Argc () < 2 ) {
return;
}
_G_trap_Argv( 1, arg, sizeof( arg ) );
targetNum = atoi( arg );
if ( targetNum < 0 || targetNum >= level.maxclients ) {
return;
}
target = &g_entities[targetNum];
if ( !target || !target->inuse || !target->client ) {
return;
}
p = ConcatArgs( 2 );
G_LogPrintf( "tell: %s to %s: %s\n", ent->client->pers.netname, target->client->pers.netname, p );
G_Say( ent, target, SAY_TELL, p );
// don't tell to the player self if it was already directed to this player
// also don't send the chat back to a bot
if ( ent != target && !(ent->r.svFlags & SVF_BOT)) {
G_Say( ent, ent, SAY_TELL, p );
}
}
static void G_VoiceTo( gentity_t *ent, gentity_t *other, int mode, const char *id, qboolean voiceonly ) {
int color;
const char *cmd;
if (!other) {
return;
}
if (!other->inuse) {
return;
}
if (!other->client) {
return;
}
if ( mode == SAY_TEAM && !OnSameTeam(ent, other) ) {
return;
}
// no chatting to players in tournements
if ( (g_gametype.integer == GT_TOURNAMENT )) {
return;
}
if (mode == SAY_TEAM) {
color = COLOR_CYAN;
cmd = "vtchat";
}
else if (mode == SAY_TELL) {
color = COLOR_MAGENTA;
cmd = "vtell";
}
else {
color = COLOR_GREEN;
cmd = "vchat";
}
_G_trap_SendServerCommand( other-g_entities, va("%s %d %d %d %s", cmd, voiceonly, ent->s.number, color, id));
}
void G_Voice( gentity_t *ent, gentity_t *target, int mode, const char *id, qboolean voiceonly ) {
int j;
gentity_t *other;
if ( g_gametype.integer < GT_TEAM && mode == SAY_TEAM ) {
mode = SAY_ALL;
}
if ( target ) {
G_VoiceTo( ent, target, mode, id, voiceonly );
return;
}
// echo the text to the console
if ( g_dedicated.integer ) {
G_Printf( "voice: %s %s\n", ent->client->pers.netname, id);
}
// send it to all the apropriate clients
for (j = 0; j < level.maxclients; j++) {
other = &g_entities[j];
G_VoiceTo( ent, other, mode, id, voiceonly );
}
}
/*
==================
Cmd_Voice_f
==================
*/
static void Cmd_Voice_f( gentity_t *ent, int mode, qboolean arg0, qboolean voiceonly ) {
char *p;
if ( _G_trap_Argc () < 2 && !arg0 ) {
return;
}
if (arg0)
{
p = ConcatArgs( 0 );
}
else
{
p = ConcatArgs( 1 );
}
G_Voice( ent, NULL, mode, p, voiceonly );
}
/*
==================
Cmd_VoiceTell_f
==================
*/
static void Cmd_VoiceTell_f( gentity_t *ent, qboolean voiceonly ) {
int targetNum;
gentity_t *target;
char *id;
char arg[MAX_TOKEN_CHARS];
if ( _G_trap_Argc () < 2 ) {
return;
}
_G_trap_Argv( 1, arg, sizeof( arg ) );
targetNum = atoi( arg );
if ( targetNum < 0 || targetNum >= level.maxclients ) {
return;
}
target = &g_entities[targetNum];
if ( !target || !target->inuse || !target->client ) {
return;
}
id = ConcatArgs( 2 );
G_LogPrintf( "vtell: %s to %s: %s\n", ent->client->pers.netname, target->client->pers.netname, id );
G_Voice( ent, target, SAY_TELL, id, voiceonly );
// don't tell to the player self if it was already directed to this player
// also don't send the chat back to a bot
if ( ent != target && !(ent->r.svFlags & SVF_BOT)) {
G_Voice( ent, ent, SAY_TELL, id, voiceonly );
}
}
/*
==================
Cmd_VoiceTaunt_f
==================
*/
static void Cmd_VoiceTaunt_f( gentity_t *ent ) {
gentity_t *who;
int i;
if (!ent->client) {
return;
}
// insult someone who just killed you
if (ent->enemy && ent->enemy->client && ent->enemy->client->lastkilled_client == ent->s.number) {
// i am a dead corpse
if (!(ent->enemy->r.svFlags & SVF_BOT)) {
G_Voice( ent, ent->enemy, SAY_TELL, VOICECHAT_DEATHINSULT, qfalse );
}
if (!(ent->r.svFlags & SVF_BOT)) {
G_Voice( ent, ent, SAY_TELL, VOICECHAT_DEATHINSULT, qfalse );
}
ent->enemy = NULL;
return;
}
// insult someone you just killed
if (ent->client->lastkilled_client >= 0 && ent->client->lastkilled_client != ent->s.number) {
who = g_entities + ent->client->lastkilled_client;
if (who->client) {
// who is the person I just killed
if (who->client->lasthurt_mod == MOD_GAUNTLET) {
if (!(who->r.svFlags & SVF_BOT)) {
G_Voice( ent, who, SAY_TELL, VOICECHAT_KILLGAUNTLET, qfalse ); // and I killed them with a gauntlet
}
if (!(ent->r.svFlags & SVF_BOT)) {
G_Voice( ent, ent, SAY_TELL, VOICECHAT_KILLGAUNTLET, qfalse );
}
} else {
if (!(who->r.svFlags & SVF_BOT)) {
G_Voice( ent, who, SAY_TELL, VOICECHAT_KILLINSULT, qfalse ); // and I killed them with something else
}
if (!(ent->r.svFlags & SVF_BOT)) {
G_Voice( ent, ent, SAY_TELL, VOICECHAT_KILLINSULT, qfalse );
}
}
ent->client->lastkilled_client = -1;
return;
}
}
if (g_gametype.integer >= GT_TEAM) {
// praise a team mate who just got a reward
for(i = 0; i < MAX_CLIENTS; i++) {
who = g_entities + i;
if (who->client && who != ent && who->client->sess.sessionTeam == ent->client->sess.sessionTeam) {
if (who->client->rewardTime > level.time) {
if (!(who->r.svFlags & SVF_BOT)) {
G_Voice( ent, who, SAY_TELL, VOICECHAT_PRAISE, qfalse );
}
if (!(ent->r.svFlags & SVF_BOT)) {
G_Voice( ent, ent, SAY_TELL, VOICECHAT_PRAISE, qfalse );
}
return;
}
}
}
}
// just say something
G_Voice( ent, NULL, SAY_ALL, VOICECHAT_TAUNT, qfalse );
}
static const char *gc_orders[] = {
"hold your position",
"hold this position",
"come here",
"cover me",
"guard location",
"search and destroy",
"report"
};
void Cmd_GameCommand_f( gentity_t *ent ) {
int player;
int order;
char str[MAX_TOKEN_CHARS];
_G_trap_Argv( 1, str, sizeof( str ) );
player = atoi( str );
_G_trap_Argv( 2, str, sizeof( str ) );
order = atoi( str );
if ( player < 0 || player >= MAX_CLIENTS ) {
return;
}
if ( order < 0 || order > sizeof(gc_orders)/sizeof(char *) ) {
return;
}
G_Say( ent, &g_entities[player], SAY_TELL, gc_orders[order] );
G_Say( ent, ent, SAY_TELL, gc_orders[order] );
}
/*
==================
Cmd_Where_f
==================
*/
void Cmd_Where_f( gentity_t *ent ) {
_G_trap_SendServerCommand( ent-g_entities, va("print \"%s\n\"", vtos( ent->s.origin ) ) );
}
static const char *gameNames[] = {
"Free For All",
"Tournament",
"Single Player",
"Team Deathmatch",
"Capture the Flag",
"One Flag CTF",
"Overload",
"Harvester"
};
/*
==================
Cmd_CallVote_f
==================
*/
void Cmd_CallVote_f( gentity_t *ent ) {
int i;
char arg1[MAX_STRING_TOKENS];
char arg2[MAX_STRING_TOKENS];
if ( !g_allowVote.integer ) {
_G_trap_SendServerCommand( ent-g_entities, "print \"Voting not allowed here.\n\"" );
return;
}
if ( level.voteTime ) {
_G_trap_SendServerCommand( ent-g_entities, "print \"A vote is already in progress.\n\"" );
return;
}
if ( ent->client->pers.voteCount >= MAX_VOTE_COUNT ) {
_G_trap_SendServerCommand( ent-g_entities, "print \"You have called the maximum number of votes.\n\"" );
return;
}
if ( ent->client->sess.sessionTeam == TEAM_SPECTATOR ) {
_G_trap_SendServerCommand( ent-g_entities, "print \"Not allowed to call a vote as spectator.\n\"" );
return;
}
// make sure it is a valid command to vote on
_G_trap_Argv( 1, arg1, sizeof( arg1 ) );
_G_trap_Argv( 2, arg2, sizeof( arg2 ) );
if( strchr( arg1, ';' ) || strchr( arg2, ';' ) ) {
_G_trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string.\n\"" );
return;
}
if ( !Q_stricmp( arg1, "map_restart" ) ) {
} else if ( !Q_stricmp( arg1, "nextmap" ) ) {
} else if ( !Q_stricmp( arg1, "map" ) ) {
} else if ( !Q_stricmp( arg1, "g_gametype" ) ) {
} else if ( !Q_stricmp( arg1, "kick" ) ) {
} else if ( !Q_stricmp( arg1, "clientkick" ) ) {
} else if ( !Q_stricmp( arg1, "g_doWarmup" ) ) {
} else if ( !Q_stricmp( arg1, "timelimit" ) ) {
} else if ( !Q_stricmp( arg1, "fraglimit" ) ) {
} else {
_G_trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string.\n\"" );
_G_trap_SendServerCommand( ent-g_entities, "print \"Vote commands are: map_restart, nextmap, map <mapname>, g_gametype <n>, kick <player>, clientkick <clientnum>, g_doWarmup, timelimit <time>, fraglimit <frags>.\n\"" );
return;
}
// if there is still a vote to be executed
if ( level.voteExecuteTime ) {
level.voteExecuteTime = 0;
_G_trap_SendConsoleCommand( EXEC_APPEND, va("%s\n", level.voteString ) );
}
// special case for g_gametype, check for bad values
if ( !Q_stricmp( arg1, "g_gametype" ) ) {
i = atoi( arg2 );
if( i == GT_SINGLE_PLAYER || i < GT_FFA || i >= GT_MAX_GAME_TYPE) {
_G_trap_SendServerCommand( ent-g_entities, "print \"Invalid gametype.\n\"" );
return;
}
Com_sprintf( level.voteString, sizeof( level.voteString ), "%s %d", arg1, i );
Com_sprintf( level.voteDisplayString, sizeof( level.voteDisplayString ), "%s %s", arg1, gameNames[i] );
} else if ( !Q_stricmp( arg1, "map" ) ) {
// special case for map changes, we want to reset the nextmap setting
// this allows a player to change maps, but not upset the map rotation
char s[MAX_STRING_CHARS];
_G_trap_Cvar_VariableStringBuffer( "nextmap", s, sizeof(s) );
if (*s) {
Com_sprintf( level.voteString, sizeof( level.voteString ), "%s %s; set nextmap \"%s\"", arg1, arg2, s );
} else {
Com_sprintf( level.voteString, sizeof( level.voteString ), "%s %s", arg1, arg2 );
}
Com_sprintf( level.voteDisplayString, sizeof( level.voteDisplayString ), "%s", level.voteString );
} else if ( !Q_stricmp( arg1, "nextmap" ) ) {
char s[MAX_STRING_CHARS];
_G_trap_Cvar_VariableStringBuffer( "nextmap", s, sizeof(s) );
if (!*s) {
_G_trap_SendServerCommand( ent-g_entities, "print \"nextmap not set.\n\"" );
return;
}
Com_sprintf( level.voteString, sizeof( level.voteString ), "vstr nextmap");
Com_sprintf( level.voteDisplayString, sizeof( level.voteDisplayString ), "%s", level.voteString );
} else {
Com_sprintf( level.voteString, sizeof( level.voteString ), "%s \"%s\"", arg1, arg2 );
Com_sprintf( level.voteDisplayString, sizeof( level.voteDisplayString ), "%s", level.voteString );
}
_G_trap_SendServerCommand( -1, va("print \"%s called a vote.\n\"", ent->client->pers.netname ) );
// start the voting, the caller autoamtically votes yes
level.voteTime = level.time;
level.voteYes = 1;
level.voteNo = 0;
for ( i = 0 ; i < level.maxclients ; i++ ) {
level.clients[i].ps.eFlags &= ~EF_VOTED;
}
ent->client->ps.eFlags |= EF_VOTED;
_G_trap_SetConfigstring( CS_VOTE_TIME, va("%i", level.voteTime ) );
_G_trap_SetConfigstring( CS_VOTE_STRING, level.voteDisplayString );
_G_trap_SetConfigstring( CS_VOTE_YES, va("%i", level.voteYes ) );
_G_trap_SetConfigstring( CS_VOTE_NO, va("%i", level.voteNo ) );
}
/*
==================
Cmd_Vote_f
==================
*/
void Cmd_Vote_f( gentity_t *ent ) {
char msg[64];
if ( !level.voteTime ) {
_G_trap_SendServerCommand( ent-g_entities, "print \"No vote in progress.\n\"" );
return;
}
if ( ent->client->ps.eFlags & EF_VOTED ) {
_G_trap_SendServerCommand( ent-g_entities, "print \"Vote already cast.\n\"" );
return;
}
if ( ent->client->sess.sessionTeam == TEAM_SPECTATOR ) {
_G_trap_SendServerCommand( ent-g_entities, "print \"Not allowed to vote as spectator.\n\"" );
return;
}
_G_trap_SendServerCommand( ent-g_entities, "print \"Vote cast.\n\"" );
ent->client->ps.eFlags |= EF_VOTED;
_G_trap_Argv( 1, msg, sizeof( msg ) );
if ( msg[0] == 'y' || msg[1] == 'Y' || msg[1] == '1' ) {
level.voteYes++;
_G_trap_SetConfigstring( CS_VOTE_YES, va("%i", level.voteYes ) );
} else {
level.voteNo++;
_G_trap_SetConfigstring( CS_VOTE_NO, va("%i", level.voteNo ) );
}
// a majority will be determined in CheckVote, which will also account
// for players entering or leaving
}
/*
==================
Cmd_CallTeamVote_f
==================
*/
void Cmd_CallTeamVote_f( gentity_t *ent ) {
int i, team, cs_offset;
char arg1[MAX_STRING_TOKENS];
char arg2[MAX_STRING_TOKENS];
team = ent->client->sess.sessionTeam;
if ( team == TEAM_RED )
cs_offset = 0;
else if ( team == TEAM_BLUE )
cs_offset = 1;
else
return;
if ( !g_allowVote.integer ) {
_G_trap_SendServerCommand( ent-g_entities, "print \"Voting not allowed here.\n\"" );
return;
}
if ( level.teamVoteTime[cs_offset] ) {
_G_trap_SendServerCommand( ent-g_entities, "print \"A team vote is already in progress.\n\"" );
return;
}
if ( ent->client->pers.teamVoteCount >= MAX_VOTE_COUNT ) {
_G_trap_SendServerCommand( ent-g_entities, "print \"You have called the maximum number of team votes.\n\"" );
return;
}
if ( ent->client->sess.sessionTeam == TEAM_SPECTATOR ) {
_G_trap_SendServerCommand( ent-g_entities, "print \"Not allowed to call a vote as spectator.\n\"" );
return;
}
// make sure it is a valid command to vote on
_G_trap_Argv( 1, arg1, sizeof( arg1 ) );
arg2[0] = '\0';
for ( i = 2; i < _G_trap_Argc(); i++ ) {
if (i > 2)
strcat(arg2, " ");
_G_trap_Argv( i, &arg2[strlen(arg2)], sizeof( arg2 ) - strlen(arg2) );
}
if( strchr( arg1, ';' ) || strchr( arg2, ';' ) ) {
_G_trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string.\n\"" );
return;
}
if ( !Q_stricmp( arg1, "leader" ) ) {
char netname[MAX_NETNAME], leader[MAX_NETNAME];
if ( !arg2[0] ) {
i = ent->client->ps.clientNum;
}
else {
// numeric values are just slot numbers
for (i = 0; i < 3; i++) {
if ( !arg2[i] || arg2[i] < '0' || arg2[i] > '9' )
break;
}
if ( i >= 3 || !arg2[i]) {
i = atoi( arg2 );
if ( i < 0 || i >= level.maxclients ) {
_G_trap_SendServerCommand( ent-g_entities, va("print \"Bad client slot: %i\n\"", i) );
return;
}
if ( !g_entities[i].inuse ) {
_G_trap_SendServerCommand( ent-g_entities, va("print \"Client %i is not active\n\"", i) );
return;
}
}
else {
Q_strncpyz(leader, arg2, sizeof(leader));
Q_CleanStr(leader);
for ( i = 0 ; i < level.maxclients ; i++ ) {
if ( level.clients[i].pers.connected == CON_DISCONNECTED )
continue;
if (level.clients[i].sess.sessionTeam != team)
continue;
Q_strncpyz(netname, level.clients[i].pers.netname, sizeof(netname));
Q_CleanStr(netname);
if ( !Q_stricmp(netname, leader) ) {
break;
}
}
if ( i >= level.maxclients ) {
_G_trap_SendServerCommand( ent-g_entities, va("print \"%s is not a valid player on your team.\n\"", arg2) );
return;
}
}
}
Com_sprintf(arg2, sizeof(arg2), "%d", i);
} else {
_G_trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string.\n\"" );
_G_trap_SendServerCommand( ent-g_entities, "print \"Team vote commands are: leader <player>.\n\"" );
return;
}
Com_sprintf( level.teamVoteString[cs_offset], sizeof( level.teamVoteString[cs_offset] ), "%s %s", arg1, arg2 );
for ( i = 0 ; i < level.maxclients ; i++ ) {
if ( level.clients[i].pers.connected == CON_DISCONNECTED )
continue;
if (level.clients[i].sess.sessionTeam == team)
_G_trap_SendServerCommand( i, va("print \"%s called a team vote.\n\"", ent->client->pers.netname ) );
}
// start the voting, the caller autoamtically votes yes
level.teamVoteTime[cs_offset] = level.time;
level.teamVoteYes[cs_offset] = 1;
level.teamVoteNo[cs_offset] = 0;
for ( i = 0 ; i < level.maxclients ; i++ ) {
if (level.clients[i].sess.sessionTeam == team)
level.clients[i].ps.eFlags &= ~EF_TEAMVOTED;
}
ent->client->ps.eFlags |= EF_TEAMVOTED;
_G_trap_SetConfigstring( CS_TEAMVOTE_TIME + cs_offset, va("%i", level.teamVoteTime[cs_offset] ) );
_G_trap_SetConfigstring( CS_TEAMVOTE_STRING + cs_offset, level.teamVoteString[cs_offset] );
_G_trap_SetConfigstring( CS_TEAMVOTE_YES + cs_offset, va("%i", level.teamVoteYes[cs_offset] ) );
_G_trap_SetConfigstring( CS_TEAMVOTE_NO + cs_offset, va("%i", level.teamVoteNo[cs_offset] ) );
}
/*
==================
Cmd_TeamVote_f
==================
*/
void Cmd_TeamVote_f( gentity_t *ent ) {
int team, cs_offset;
char msg[64];
team = ent->client->sess.sessionTeam;
if ( team == TEAM_RED )
cs_offset = 0;
else if ( team == TEAM_BLUE )
cs_offset = 1;
else
return;
if ( !level.teamVoteTime[cs_offset] ) {
_G_trap_SendServerCommand( ent-g_entities, "print \"No team vote in progress.\n\"" );
return;
}
if ( ent->client->ps.eFlags & EF_TEAMVOTED ) {
_G_trap_SendServerCommand( ent-g_entities, "print \"Team vote already cast.\n\"" );
return;
}
if ( ent->client->sess.sessionTeam == TEAM_SPECTATOR ) {
_G_trap_SendServerCommand( ent-g_entities, "print \"Not allowed to vote as spectator.\n\"" );
return;
}
_G_trap_SendServerCommand( ent-g_entities, "print \"Team vote cast.\n\"" );
ent->client->ps.eFlags |= EF_TEAMVOTED;
_G_trap_Argv( 1, msg, sizeof( msg ) );
if ( msg[0] == 'y' || msg[1] == 'Y' || msg[1] == '1' ) {
level.teamVoteYes[cs_offset]++;
_G_trap_SetConfigstring( CS_TEAMVOTE_YES + cs_offset, va("%i", level.teamVoteYes[cs_offset] ) );
} else {
level.teamVoteNo[cs_offset]++;
_G_trap_SetConfigstring( CS_TEAMVOTE_NO + cs_offset, va("%i", level.teamVoteNo[cs_offset] ) );
}
// a majority will be determined in TeamCheckVote, which will also account
// for players entering or leaving
}
/*
=================
Cmd_SetViewpos_f
=================
*/
void Cmd_SetViewpos_f( gentity_t *ent ) {
bvec3_t origin;
avec3_t angles;
char buffer[MAX_TOKEN_CHARS];
int i;
if ( !g_cheats.integer ) {
_G_trap_SendServerCommand( ent-g_entities, va("print \"Cheats are not enabled on this server.\n\""));
return;
}
if ( _G_trap_Argc() != 5 ) {
_G_trap_SendServerCommand( ent-g_entities, va("print \"usage: setviewpos x y z yaw\n\""));
return;
}
VectorClear( angles );
for ( i = 0 ; i < 3 ; i++ ) {
_G_trap_Argv( i + 1, buffer, sizeof( buffer ) );
origin[i] = MAKE_BFIXED(atof( buffer ));
}
_G_trap_Argv( 4, buffer, sizeof( buffer ) );
angles[YAW] = MAKE_AFIXED(atof( buffer ));
TeleportPlayer( ent, origin, angles );
}
/*
=================
Cmd_Stats_f
=================
*/
void Cmd_Stats_f( gentity_t *ent ) {
/*
int max, n, i;
max = _G_trap_AAS_PointReachabilityAreaIndex( NULL );
n = 0;
for ( i = 0; i < max; i++ ) {
if ( ent->client->areabits[i >> 3] & (1 << (i & 7)) )
n++;
}
//_G_trap_SendServerCommand( ent-g_entities, va("print \"visited %d of %d areas\n\"", n, max));
_G_trap_SendServerCommand( ent-g_entities, va("print \"%d%% level coverage\n\"", n * 100 / max));
*/
}
/*
=================
ClientCommand
=================
*/
void ClientCommand( int clientNum ) {
gentity_t *ent;
char cmd[MAX_TOKEN_CHARS];
ent = g_entities + clientNum;
if ( !ent->client ) {
return; // not fully in game yet
}
_G_trap_Argv( 0, cmd, sizeof( cmd ) );
if (Q_stricmp (cmd, "say") == 0) {
Cmd_Say_f (ent, SAY_ALL, qfalse);
return;
}
if (Q_stricmp (cmd, "say_team") == 0) {
Cmd_Say_f (ent, SAY_TEAM, qfalse);
return;
}
if (Q_stricmp (cmd, "tell") == 0) {
Cmd_Tell_f ( ent );
return;
}
if (Q_stricmp (cmd, "vsay") == 0) {
Cmd_Voice_f (ent, SAY_ALL, qfalse, qfalse);
return;
}
if (Q_stricmp (cmd, "vsay_team") == 0) {
Cmd_Voice_f (ent, SAY_TEAM, qfalse, qfalse);
return;
}
if (Q_stricmp (cmd, "vtell") == 0) {
Cmd_VoiceTell_f ( ent, qfalse );
return;
}
if (Q_stricmp (cmd, "vosay") == 0) {
Cmd_Voice_f (ent, SAY_ALL, qfalse, qtrue);
return;
}
if (Q_stricmp (cmd, "vosay_team") == 0) {
Cmd_Voice_f (ent, SAY_TEAM, qfalse, qtrue);
return;
}
if (Q_stricmp (cmd, "votell") == 0) {
Cmd_VoiceTell_f ( ent, qtrue );
return;
}
if (Q_stricmp (cmd, "vtaunt") == 0) {
Cmd_VoiceTaunt_f ( ent );
return;
}
if (Q_stricmp (cmd, "score") == 0) {
Cmd_Score_f (ent);
return;
}
// ignore all other commands when at intermission
if (level.intermissiontime) {
Cmd_Say_f (ent, qfalse, qtrue);
return;
}
if (Q_stricmp (cmd, "give") == 0)
Cmd_Give_f (ent);
else if (Q_stricmp (cmd, "god") == 0)
Cmd_God_f (ent);
else if (Q_stricmp (cmd, "notarget") == 0)
Cmd_Notarget_f (ent);
else if (Q_stricmp (cmd, "noclip") == 0)
Cmd_Noclip_f (ent);
else if (Q_stricmp (cmd, "kill") == 0)
Cmd_Kill_f (ent);
else if (Q_stricmp (cmd, "teamtask") == 0)
Cmd_TeamTask_f (ent);
else if (Q_stricmp (cmd, "levelshot") == 0)
Cmd_LevelShot_f (ent);
else if (Q_stricmp (cmd, "follow") == 0)
Cmd_Follow_f (ent);
else if (Q_stricmp (cmd, "follownext") == 0)
Cmd_FollowCycle_f (ent, 1);
else if (Q_stricmp (cmd, "followprev") == 0)
Cmd_FollowCycle_f (ent, -1);
else if (Q_stricmp (cmd, "team") == 0)
Cmd_Team_f (ent);
else if (Q_stricmp (cmd, "where") == 0)
Cmd_Where_f (ent);
else if (Q_stricmp (cmd, "callvote") == 0)
Cmd_CallVote_f (ent);
else if (Q_stricmp (cmd, "vote") == 0)
Cmd_Vote_f (ent);
else if (Q_stricmp (cmd, "callteamvote") == 0)
Cmd_CallTeamVote_f (ent);
else if (Q_stricmp (cmd, "teamvote") == 0)
Cmd_TeamVote_f (ent);
else if (Q_stricmp (cmd, "gc") == 0)
Cmd_GameCommand_f( ent );
else if (Q_stricmp (cmd, "setviewpos") == 0)
Cmd_SetViewpos_f( ent );
else if (Q_stricmp (cmd, "stats") == 0)
Cmd_Stats_f( ent );
else
_G_trap_SendServerCommand( clientNum, va("print \"unknown cmd %s\n\"", cmd ) );
}
|
95130540b694f945e37411d0e03ea3e11ae69f3e
|
c80f25d24cee6ed8dba1513c227886c07d83cf75
|
/WeaponGirl_1/Client/trunk/Classes/Mgr/BbsMgr.h
|
f45923e8bbac99489287fb68ed2d2af0b42dd693
|
[
"MIT"
] |
permissive
|
cnsuhao/newProBase
|
c250e54ead43efb57363347d1700649a35617d15
|
4fe81d30740a2a0857ca6e09a281fed1146e6202
|
refs/heads/master
| 2021-08-23T14:19:24.568828
| 2015-11-27T13:37:54
| 2015-11-27T13:37:54
| null | 0
| 0
| null | null | null | null |
WINDOWS-1252
|
C++
| false
| false
| 1,083
|
h
|
BbsMgr.h
|
////////////////////////////////////////////////////////////////////////
// Copyright(c) 2015-9999, WuHan GoodGame, All Rights Reserved
// Moudle: BbsMgr.h
// Author: ÅíÎÄÆæ(Peng Wenqi)
// Created: 2015/11/04
////////////////////////////////////////////////////////////////////////
#ifndef _JYP_BbsMgr_H_
#define _JYP_BbsMgr_H_
#include "Global/Global.h"
class BbsMgr : public Ref
{
public:
static BbsMgr* getInstance();
static void destroyInstance();
private:
BbsMgr();
static BbsMgr* m_pInstance;
public:
void clearBBS();
void addBBS(const BBS_INFO& info, bool bHead = false);
int getBBSSize() const { return m_deqBBS.size(); }
const BBS_INFO& getBbsInfo(int nIndex) const;
void clearReply(DB_KEY idBBS);
void addReply(const BBS_REPLY_INFO& info, bool bHead = false);
int getReplySize() const { return m_deqReply.size(); }
const BBS_REPLY_INFO& getReplyInfo(int nIndex) const;
protected:
std::deque<BBS_INFO> m_deqBBS;
DB_KEY m_idBBS;
std::deque<BBS_REPLY_INFO> m_deqReply;
};
#endif // end of _JYP_BbsMgr_H_
|
3ecbca9111f4b1d919dc018d4e577903ff7ce3a9
|
539bd4489cc30c25a806b2de9816ca354ebb4abf
|
/tests/unit_tests/src/data_structures/match_request_table.cpp
|
d705b2dd500bd5f3eae111fe845845f5a85b41b0
|
[
"LicenseRef-scancode-philippe-de-muyter"
] |
permissive
|
kittobi1992/parkway
|
f4debf2826f73c5df55572a806d907f81ddb9f52
|
6501c96268acc1997894bb577cbca0e21c5e2ac8
|
refs/heads/master
| 2021-05-18T15:04:36.085704
| 2020-03-31T10:35:29
| 2020-03-31T10:35:29
| 251,291,502
| 0
| 0
| null | 2020-03-30T11:59:54
| 2020-03-30T11:59:53
| null |
UTF-8
|
C++
| false
| false
| 274
|
cpp
|
match_request_table.cpp
|
#include "gtest/gtest.h"
#include "data_structures/match_request_table.hpp"
using parkway::data_structures::match_request_table;
TEST(MatchRequestTable, Construction) {
match_request_table table_(10);
ASSERT_EQ(table_.size(), 0);
ASSERT_EQ(table_.capacity(), 10);
}
|
47e7c73216c143a2a077ed436121bd3aa114f345
|
b840893a944c17d57aebd0fa7dcbc40590c210fe
|
/Engine/source/EtRendering/GraphicsTypes/FrameBuffer.cpp
|
6fc988e6fbd462b7a6c1ed53ffa585a0b36fe8fc
|
[
"MIT"
] |
permissive
|
NeroBurner/ETEngine
|
cedd0f5199fed8ef5111c82715474c8be054f1c6
|
3fe039ff65cd1355957bcfce3f851fa411a86d94
|
refs/heads/master
| 2020-12-19T14:39:18.573281
| 2020-01-23T03:03:00
| 2020-01-23T03:03:00
| 235,763,127
| 1
| 0
|
MIT
| 2020-01-23T09:34:13
| 2020-01-23T09:34:12
| null |
UTF-8
|
C++
| false
| false
| 5,065
|
cpp
|
FrameBuffer.cpp
|
#include "stdafx.h"
#include "FrameBuffer.h"
#include "Shader.h"
#include "TextureData.h"
#include <EtCore/FileSystem/FileUtil.h>
#include <EtCore/Content/ResourceManager.h>
#include <EtRendering/GlobalRenderingSystems/GlobalRenderingSystems.h>
namespace et {
namespace render {
FrameBuffer::FrameBuffer(std::string shaderFile, E_DataType const format, uint32 numTargets)
: m_ShaderFile(shaderFile)
, m_Format(format)
, m_NumTargets(numTargets)
{ }
FrameBuffer::~FrameBuffer()
{
I_GraphicsApiContext* const api = Viewport::GetCurrentApiContext();
if (m_VPCallbackId != render::T_ViewportEventDispatcher::INVALID_ID)
{
Viewport::GetCurrentViewport()->GetEventDispatcher().Unregister(m_VPCallbackId);
}
api->DeleteRenderBuffers(1, &m_RboDepthStencil);
for (size_t i = 0; i < m_pTextureVec.size(); i++)
{
SafeDelete(m_pTextureVec[i]);
}
api->DeleteFramebuffers(1, &m_GlFrameBuffer);
}
void FrameBuffer::Initialize()
{
I_GraphicsApiContext* const api = Viewport::GetCurrentApiContext();
//Load and compile Shaders
m_pShader = core::ResourceManager::Instance()->GetAssetData<ShaderData>(GetHash(core::FileUtil::ExtractName(m_ShaderFile)));
//GetAccessTo shader attributes
api->SetShader(m_pShader.get());
AccessShaderAttributes();
//FrameBuffer
api->GenFramebuffers(1, &m_GlFrameBuffer);
GenerateFramebufferTextures();
ET_ASSERT(api->IsFramebufferComplete(), "Creating framebuffer failed!");
m_VPCallbackId = Viewport::GetCurrentViewport()->GetEventDispatcher().Register(render::E_ViewportEvent::VP_Resized, render::T_ViewportEventCallback(
[this](render::T_ViewportEventFlags const, render::ViewportEventData const* const) -> void
{
ResizeFramebufferTextures();
}));
}
void FrameBuffer::AccessShaderAttributes()
{
m_pShader->Upload("texFramebuffer"_hash, 0);
}
void FrameBuffer::Enable(bool active)
{
Viewport::GetCurrentApiContext()->BindFramebuffer(active ? m_GlFrameBuffer : 0);
}
void FrameBuffer::Draw()
{
I_GraphicsApiContext* const api = Viewport::GetCurrentApiContext();
api->SetDepthEnabled(false);
api->SetShader(m_pShader.get());
UploadDerivedVariables();
RenderingSystems::Instance()->GetPrimitiveRenderer().Draw<primitives::Quad>();
}
void FrameBuffer::GenerateFramebufferTextures()
{
I_GraphicsApiContext* const api = Viewport::GetCurrentApiContext();
ivec2 const dim = Viewport::GetCurrentViewport()->GetDimensions();
api->BindFramebuffer(m_GlFrameBuffer);
//Textures
m_pTextureVec.reserve(m_NumTargets);
TextureParameters params(false);
params.wrapS = E_TextureWrapMode::ClampToEdge;
params.wrapT = E_TextureWrapMode::ClampToEdge;
//Depth buffer
if (m_CaptureDepth)
{
TextureData* depthMap = new TextureData(dim, E_ColorFormat::Depth24, E_ColorFormat::Depth, E_DataType::Float);
depthMap->Build();
api->LinkTextureToFboDepth(depthMap->GetLocation());
depthMap->SetParameters(params);
depthMap->CreateHandle();
m_pTextureVec.emplace_back(depthMap);
}
//Color buffers
for (uint32 i = 0; i < m_NumTargets; i++)
{
TextureData* colorBuffer = new TextureData(dim, E_ColorFormat::RGBA16f, E_ColorFormat::RGBA, m_Format);
colorBuffer->Build();
api->LinkTextureToFbo2D(i, colorBuffer->GetLocation(), 0);
colorBuffer->SetParameters(params, true);
colorBuffer->CreateHandle();
m_pTextureVec.emplace_back(colorBuffer);
}
//Render Buffer for depth and stencil
if (!m_CaptureDepth)
{
api->GenRenderBuffers(1, &m_RboDepthStencil);
api->BindRenderbuffer(m_RboDepthStencil);
api->SetRenderbufferStorage(E_RenderBufferFormat::Depth24_Stencil8, dim);
api->LinkRenderbufferToFbo(E_RenderBufferFormat::Depth24_Stencil8, m_RboDepthStencil);
}
api->SetDrawBufferCount(static_cast<size_t>(m_NumTargets));
}
void FrameBuffer::ResizeFramebufferTextures()
{
I_GraphicsApiContext* const api = Viewport::GetCurrentApiContext();
ivec2 const dim = Viewport::GetCurrentViewport()->GetDimensions();
ET_ASSERT(m_pTextureVec.size() > 0);
if(dim.x > m_pTextureVec[0]->GetResolution().x || dim.x > m_pTextureVec[0]->GetResolution().y)
{
api->DeleteRenderBuffers( 1, &m_RboDepthStencil );
for(uint32 i = 0; i < m_pTextureVec.size(); i++)
{
SafeDelete( m_pTextureVec[i] );
}
m_pTextureVec.clear();
api->DeleteFramebuffers( 1, &m_GlFrameBuffer );
api->GenFramebuffers( 1, &m_GlFrameBuffer );
GenerateFramebufferTextures();
return;
}
uint32 offset = 0;
if(m_CaptureDepth)
{
m_pTextureVec[0]->Resize(dim);
++offset;
}
else
{
//completely regenerate the renderbuffer object
api->BindFramebuffer(m_GlFrameBuffer);
api->DeleteRenderBuffers( 1, &m_RboDepthStencil );
api->GenRenderBuffers(1, &m_RboDepthStencil);
api->BindRenderbuffer(m_RboDepthStencil);
api->SetRenderbufferStorage(E_RenderBufferFormat::Depth24_Stencil8, dim);
api->LinkRenderbufferToFbo(E_RenderBufferFormat::Depth24_Stencil8, m_RboDepthStencil);
}
assert( m_pTextureVec.size() >= offset + m_NumTargets );
for(uint32 i = offset; i < offset + m_NumTargets; ++i)
{
m_pTextureVec[i]->Resize(dim);
}
}
} // namespace render
} // namespace et
|
ba3864a6e8849137b97f05affa49e1ed9667bdbe
|
8c837cb96f462e77ccac0711d139656d8c9a970e
|
/KGC/agreement.h
|
73589a00ee19ab91b137716bcb1f2d5b90f0d300
|
[] |
no_license
|
caixianzhang/key_management_base_SM9
|
9e809eca869e39678464a2699c0f8564e2d2814c
|
be885e90a98803afedcd2111841d05e10effee64
|
refs/heads/main
| 2023-04-29T23:39:52.385603
| 2021-05-17T14:26:18
| 2021-05-17T14:26:18
| 368,194,974
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,693
|
h
|
agreement.h
|
#ifndef AGREEMENT_H_
#define AGREEMENT_H_
#include "sm9-sign.h"
#include "sm9-verify.h"
#include "sm9-exchange.h"
#include "sm9-encrypt.h"
#include "sm9-decrypt.h"
#include <string>
using namespace std;
/*
系统主密钥报文协议
盐值由响应方发送给发起方,
发起方生成主密钥后,利用公钥加密主密钥,
填入encmsk[256]中去,然后对盐和密文主密钥签名,
明文主密钥清零。
*/
struct mskmessage{
//明文主密钥长度
size_t msklen;
//加密后的主密钥长度
size_t encmsklen;
//发起方数字签名长度
size_t siglen;
//明文主密钥(固定为139字节)
unsigned char msk[256];
//盐值(此处由响应方填写)
unsigned char rand[32];
//加密后的主密钥(固定为246字节)
unsigned char encmsk[256];
//数字签名(对盐值和加密后的主密钥签名)
unsigned char sig[512];
};
/*
密钥协商发起方
*/
class agreement_Alice{
private:
//存放握手文件的目录(需要预先创建)
string dir;
//系统主密钥(这里规定由Alice生成)
string mskfile;
//密钥协商发起方id
string Alice;
//密钥协商响应方id
string Bob;
//密钥协商主密钥报文
mskmessage *agreemsk;
//发起方A初始化信息
sm9_key_exchange *exchange_ini_A;
sm9_alice *A;
//共享密钥(32字节)
unsigned char SKA[32];
unsigned char RA[65];
unsigned char RB[65];
unsigned char SA[32];
unsigned char SB[32];
public:
agreement_Alice(string Alice, string Bob, mskmessage *agreemsk, string dir);
virtual ~agreement_Alice();
bool Init();
bool sign();
unsigned char *GetRA();
bool compute_share_key(unsigned char RB[65], unsigned char SB[32]);
unsigned char *GetSA();
unsigned char *GetSKA();
};
/*
密钥协商响应方
*/
class agreement_Bob{
private:
//存放握手文件的目录(需要预先创建)
string dir;
//系统主密钥(这里规定由Alice生成)
string mskfile;
//密钥协商发起方id
string Alice;
//密钥协商响应方id
string Bob;
//密钥协商主密钥报文
mskmessage *agreemsk;
sm9_verify *verify_st;
//发起方A初始化信息
sm9_key_exchange *exchange_ini_B;
sm9_bob *B;
//共享密钥(32字节)
unsigned char SKB[32];
unsigned char RA[65];
unsigned char RB[65];
unsigned char SA[32];
unsigned char SB[32];
public:
agreement_Bob(string Alice, string Bob, mskmessage *agreemsk, string dir);
virtual ~agreement_Bob();
bool verify();
bool Init();
unsigned char *GetRB();
bool compute_share_key(unsigned char RA[65]);
unsigned char *GetSB();
unsigned char *GetSKB();
bool checkSA(unsigned char SA[32]);
};
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.