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
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6af5d07c4b54834eed64ebe566859897b6d9556c
|
4010bc072ec3c69b58ff231d8ee03be34948e346
|
/boj/ds/14411.cpp
|
a40ae2d3000e56bbde9eba0ea405626119b6051d
|
[] |
no_license
|
Castlebinia/ALGORITHM
|
8af9e3d237c0ced8d187b981fed362d9b5445e8c
|
3d01db29c9e46a90cd3f5b9380da7a16d35aeee4
|
refs/heads/master
| 2020-03-10T08:31:08.361763
| 2018-11-02T03:44:46
| 2018-11-02T03:44:46
| 129,286,870
| 1
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 651
|
cpp
|
14411.cpp
|
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
vector<pair<ll, ll>>p, rp;
for (int i = 0; i < n; i++) {
ll x, y;
cin >> x >> y;
p.push_back({ x,y });
}
sort(p.begin(), p.end());
for (int i = 0; i < n; i++) {
while (!rp.empty() && rp.back().second < p[i].second) rp.pop_back();
rp.push_back({ p[i].first,p[i].second });
}
ll ret = rp[0].first*rp[0].second;
for (int i =1; i < rp.size(); i++) ret += (rp[i].first - rp[i - 1].first)*rp[i].second;
cout << ret << '\n';
}
|
31997875c53dc7172297d779737e9ce64233326a
|
53f90730b7581e0aa3f936fd96b0064134547a57
|
/Cliente.hpp
|
f5d83daa6f6be07f6a37cd189b5c3ad55080884f
|
[] |
no_license
|
pedrorfs/2021-1-exercicio-revisao-refatoracao
|
7db85d5de002fc58a3652ed1968f4048132a9c65
|
50b48eaf7a4734ff3d404aca67267a6a7623c2c0
|
refs/heads/main
| 2023-07-15T17:57:16.307342
| 2021-08-16T22:25:47
| 2021-08-16T22:25:47
| 396,974,733
| 0
| 0
| null | 2021-08-16T21:13:55
| 2021-08-16T21:13:54
| null |
UTF-8
|
C++
| false
| false
| 411
|
hpp
|
Cliente.hpp
|
#ifndef CLIENTE_HPP
#define CLIENTE_HPP
#include <string>
using namespace std;
class Cliente {
public:
// Construtor
Cliente(string name, string address, string city, string state, string zip, string phone);
void print();
private:
string NOME;
string endereco;
string CIDADE;
string UF;
string cep;
string telefone;
};
#endif
|
b89a4743eca85c58bff45318ca54c3357474b9a3
|
2c760d7d7096f26780a12bc2164c50cdbdf476ec
|
/image_complete/mainwindow.h
|
549406613ebe192cf200309b010a94780dd86da7
|
[] |
no_license
|
czyi/ImageCompletion
|
5c3a3219c52bb64040bf047c8788c7d59b3d8ede
|
e94cc50c9eb09aad9d61bbdbb302bfa27ec9dd75
|
refs/heads/master
| 2021-01-10T12:44:39.461102
| 2017-02-23T09:34:54
| 2017-02-23T09:34:54
| 53,374,616
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,330
|
h
|
mainwindow.h
|
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/core/core.hpp>
#include <string>
using namespace std;
namespace Ui {
class MainWindow;
}
struct Node
{
int x;
int y;
int neighbor;
int ng[4];
int count;
int sam;
};
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
int node;
int x[100], y[100];
int circle;
int cx[100], cy[100];
int line_num;
int line_head[10];
int cir_left, cir_right, cir_up, cir_down;
int line_left[10], line_right[10], line_up[10], line_down[10];
int lineorcircle;
int state;
QPixmap img;
IplImage* src;
IplImage* dst;
IplImage* dst_line;
IplImage* fill_line;
string file;
int w,h;
int px[500], py[500];
Node pn[500];
int jnum, jsam, jx[20],jy[20] ,jsamx[100], jsamy[100];
int pnode, pnode_head[10];
int jointx[20][2], jointy[20][2];
int sx[2000], sy[2000];
int sam_head[10];
int joint[10], joi_num;
int samnum, sammax, patch, radius;
double laprate;
IplImage* fill_cir;
IplImage* all_line;
IplImage* line_heng;
IplImage* line_shu;
int later_circle;
int patchlap, samlap;
int nor;
int flag;
int parallel;
protected:
void mousePressEvent(QMouseEvent *);
void paintEvent(QPaintEvent *event);
private slots:
void on_openButton_clicked();
void on_closeButton_clicked();
void on_clearButton_clicked();
void on_clButton_clicked();
void on_clearcircleButton_clicked();
void on_clearselectButton_clicked();
void on_resetButton_clicked();
void on_filllineButton_clicked();
void on_filllinenextButton_clicked();
void on_nextlineButton_clicked();
void on_circleButton_clicked();
void on_fillcircleButton_clicked();
void on_parallelButton_clicked();
private:
Ui::MainWindow *ui;
double energe_one(int pnum, int samth, int edge, int k);
double energe_one_j(int pnum, int samth);
double energe_two(int pnum, int samq, int samh);
double energe_three(int t, int choose);
int cross_line(int ln, int cr);
};
#endif // MAINWINDOW_H
|
281447c9827d3a8b397dccd2c6334e3e9b33076a
|
0eff74b05b60098333ad66cf801bdd93becc9ea4
|
/second/download/collectd/gumtree/collectd_repos_function_958_collectd-5.6.3.cpp
|
622582155cda5cc825d6a9f8c14ca020ae08b523
|
[] |
no_license
|
niuxu18/logTracker-old
|
97543445ea7e414ed40bdc681239365d33418975
|
f2b060f13a0295387fe02187543db124916eb446
|
refs/heads/master
| 2021-09-13T21:39:37.686481
| 2017-12-11T03:36:34
| 2017-12-11T03:36:34
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 902
|
cpp
|
collectd_repos_function_958_collectd-5.6.3.cpp
|
static int hv2data_source(pTHX_ HV *hash, data_source_t *ds) {
SV **tmp = NULL;
if ((NULL == hash) || (NULL == ds))
return -1;
if (NULL != (tmp = hv_fetch(hash, "name", 4, 0))) {
sstrncpy(ds->name, SvPV_nolen(*tmp), sizeof(ds->name));
} else {
log_err("hv2data_source: No DS name given.");
return -1;
}
if (NULL != (tmp = hv_fetch(hash, "type", 4, 0))) {
ds->type = SvIV(*tmp);
if ((DS_TYPE_COUNTER != ds->type) && (DS_TYPE_GAUGE != ds->type) &&
(DS_TYPE_DERIVE != ds->type) && (DS_TYPE_ABSOLUTE != ds->type)) {
log_err("hv2data_source: Invalid DS type.");
return -1;
}
} else {
ds->type = DS_TYPE_COUNTER;
}
if (NULL != (tmp = hv_fetch(hash, "min", 3, 0)))
ds->min = SvNV(*tmp);
else
ds->min = NAN;
if (NULL != (tmp = hv_fetch(hash, "max", 3, 0)))
ds->max = SvNV(*tmp);
else
ds->max = NAN;
return 0;
}
|
50ddd200f6547c001b745a4fe564c032fe45baf8
|
26262b7fa7b7876626c5fd0855decec7b63b9e01
|
/samples/simple_engine/BlinkProcess.cpp
|
5e0f46a4afc0e44b5baeec1237af02c9a3cddbe0
|
[] |
no_license
|
Vespertinus/SE
|
a8e37025f7cc4e0c85af30821f53e4079dfd11bc
|
5122656a3946d3ce2b75d993b3e411c829c56ca5
|
refs/heads/master
| 2022-05-14T12:42:09.679710
| 2022-05-03T19:32:00
| 2022-05-03T19:32:00
| 106,569,929
| 2
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,331
|
cpp
|
BlinkProcess.cpp
|
#include <GlobalTypes.h>
#include <WorldProcess.h>
#include <BlinkProcess.h>
namespace SE {
BlinkProcess::BlinkProcess(TSceneTree::TSceneNodeWeak pNewTargetNode, const float new_flip_dt, allocator_type oAlloc) :
pTargetNode(pNewTargetNode),
flip_dt(new_flip_dt) {
}
void BlinkProcess::OnUpdate(const float dt) {
cur_dt += dt;
if (on) {
if (cur_dt >= flip_dt) {
if (auto pNode = pTargetNode.lock()) {
pNode->Disable();
on = false;
cur_dt = 0.0f;
}
else {
log_w ("failed to get target node");
Fail();
}
}
}
else {
if (cur_dt >= flip_dt) {
if (auto pNode = pTargetNode.lock()) {
pNode->Enable();
on = true;
cur_dt = 0.0f;
}
else {
log_w ("failed to get target node");
Fail();
}
}
}
}
}
|
904ba4f44af790d472ec7f73c2dc1048ea9f33b1
|
da426fa63ca1009eeac2bd465cc6c413d8a02263
|
/ap_IUT-master/ap_IUT-master/ap/organizer_boxing.cpp
|
f658ecfd920750f3aea605b8d5c6ce56b746b25f
|
[] |
no_license
|
mahdi-hejazi/ap_IUT
|
5a9690030c97b30dbd6d684194045f20fd2aac78
|
9fe80c722e7c7bbf03073954d4cb67fd9b31b8ba
|
refs/heads/master
| 2020-05-30T07:56:49.326533
| 2019-06-20T11:09:27
| 2019-06-20T11:09:27
| 189,610,532
| 0
| 0
| null | 2019-05-31T14:47:07
| 2019-05-31T14:47:06
| null |
UTF-8
|
C++
| false
| false
| 674
|
cpp
|
organizer_boxing.cpp
|
#include "organizer_boxing.h"
#include "ui_organizer_boxing.h"
organizer_boxing::organizer_boxing(QWidget *parent) :
QWidget(parent),
ui(new Ui::organizer_boxing)
{
ui->setupUi(this);
}
organizer_boxing::~organizer_boxing()
{
delete ui;
}
void organizer_boxing::show_participant(){}
void organizer_boxing::show_tournament(){}//and show matches in every tournament
void organizer_boxing::show_score_table(){}
bool organizer_boxing::add_tournament(){return true;}
void organizer_boxing::manage_matches(){}//define matches in a tournoment
void organizer_boxing::update_results(){}
void organizer_boxing::edit_match(){}
void organizer_boxing::cancel_match(){}
|
825241e479dec7d3c58ad2b698787cb805a054bd
|
42c0a0643227f91e9ea8916de436857c4e478c19
|
/1.cpp
|
da08a8f087cada1f88a156fe1d35ea3197cc5c50
|
[] |
no_license
|
henktillman/project-euler
|
b48210c2b1fc400993cfc8f8d69d73eb59a243e4
|
1b5e929f565f168d9f7b88fae8dbd5896ef0eedd
|
refs/heads/master
| 2021-01-20T10:46:04.943271
| 2015-01-05T02:43:00
| 2015-01-05T02:43:00
| 28,763,714
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 438
|
cpp
|
1.cpp
|
// If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
// Find the sum of all the multiples of 3 or 5 below 1000.
#include <iostream>
using namespace std;
int main()
{
int total = 0;
for (int i = 0; i < 1000; i += 3)
total += i;
for (int j = 0; j < 1000; j += 5)
{
if (j % 3 != 0)
total += j;
}
cout << total << endl;
return 0;
}
|
852587ba4cd4a2278755259af5175a6940a7808c
|
30076de029498b0826d70c26e22211221689d708
|
/sealtk/noaa/Main.cpp
|
90f6c729cc1ce28cd00418b465960de95acaa3ea
|
[
"BSD-3-Clause"
] |
permissive
|
Kitware/seal-tk
|
935919a276cbe630524e7813a55332ab227f619e
|
3d7af25e3d71f010672e58a7c254a7e28b9701a8
|
refs/heads/master
| 2023-06-01T11:36:49.733836
| 2021-01-13T14:09:34
| 2021-01-13T14:09:34
| 162,480,407
| 4
| 4
|
BSD-3-Clause
| 2021-01-13T13:48:39
| 2018-12-19T19:15:09
|
C++
|
UTF-8
|
C++
| false
| false
| 4,143
|
cpp
|
Main.cpp
|
/* This file is part of SEAL-TK, and is distributed under the OSI-approved BSD
* 3-Clause License. See top-level LICENSE file or
* https://github.com/Kitware/seal-tk/blob/master/LICENSE for details. */
#include <sealtk/noaa/gui/Resources.hpp>
#include <sealtk/noaa/gui/Window.hpp>
#include <sealtk/noaa/core/Config.h>
#include <sealtk/gui/Resources.hpp>
#include <sealtk/core/AbstractDataSource.hpp>
#include <sealtk/core/Version.h>
#include <vital/plugin_loader/plugin_manager.h>
#include <qtColorScheme.h>
#include <QApplication>
#include <QCommandLineParser>
#include <QDir>
#include <QProcess>
#include <QRegularExpression>
#include <QSettings>
#include <memory>
// ----------------------------------------------------------------------------
int main(int argc, char** argv)
{
sealtk::gui::Resources commonResources;
sealtk::gui::Resources noaaResources;
// Set application attributes
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
// Create application and set identity information
QApplication app{argc, argv};
QApplication::setApplicationName(QStringLiteral("SEAL-TK"));
QApplication::setApplicationVersion(QStringLiteral(SEALTK_VERSION));
QApplication::setOrganizationName(QStringLiteral("Kitware"));
// Set icon theme
auto const& originalTheme = QIcon::themeName();
QIcon::setThemeName("krest");
// Set fallback theme
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
if (!originalTheme.isEmpty())
{
QIcon::setFallbackThemeName(originalTheme);
}
else
{
// QIcon::themeName appears to have a bug that causes it to always return
// an empty string; this is a grotesque work-around to get the theme name
QProcess p{&app};
p.start(
QStringLiteral("gsettings"),
{
QStringLiteral("get"),
QStringLiteral("org.gnome.desktop.interface"),
QStringLiteral("icon-theme")
});
if (p.waitForFinished())
{
auto const& output =
QString::fromLocal8Bit(p.readAllStandardOutput()).trimmed();
auto const re = QRegularExpression{QStringLiteral("'([-\\w]+)'")};
auto const m = re.match(output);
if (m.isValid())
{
QIcon::setFallbackThemeName(m.captured(1));
}
}
}
#endif
// Set up command line parser
QCommandLineParser parser;
parser.setApplicationDescription(
QStringLiteral(
"SEAL-TK, the Stereoscopic Examination of Aquatic Life Tookit"));
parser.addHelpOption();
parser.addVersionOption();
QCommandLineOption pipelineDirectoryOption{
QStringLiteral("pipeline-directory"),
QStringLiteral(
"Alternative directory in which to search for KWIVER pipeline files."),
QStringLiteral("directory")};
parser.addOption(pipelineDirectoryOption);
QCommandLineOption applicationThemeOption{
QStringLiteral("theme"),
QStringLiteral(
"Path to application theme to be used (instead of the system theme)."),
QStringLiteral("file")};
parser.addOption(applicationThemeOption);
// Parse command line options
parser.process(app);
if (parser.isSet(applicationThemeOption))
{
QSettings settings{parser.value(applicationThemeOption),
QSettings::IniFormat};
QApplication::setStyle(settings.value("WidgetStyle").toString());
QApplication::setPalette(qtColorScheme::fromSettings(settings));
}
QString pipelineDirectory;
if (parser.isSet(pipelineDirectoryOption))
{
pipelineDirectory = parser.value(pipelineDirectoryOption);
}
else
{
pipelineDirectory =
QApplication::applicationDirPath() +
QStringLiteral("/" SEALTK_NOAA_RELATIVE_SHARE_DIR "/seal-tk/pipelines");
}
// Load all KWIVER plugins
kwiver::vital::plugin_manager::instance().load_all_plugins();
// Register meta-types
qRegisterMetaType<std::shared_ptr<QAbstractItemModel>>();
// Set up the main window
sealtk::noaa::gui::Window window;
window.setPipelineDirectory(pipelineDirectory);
window.show();
// Hand off to main event loop
return app.exec();
}
|
ae6053755d36dd5acc38e4c760b6c25ff04e0f98
|
5cb23dd4fa75224ae2c5cb63bf96e8271a17d76d
|
/geo/main.cpp
|
a2f476df843f6c559c6984e4371676bcc8653de8
|
[] |
no_license
|
kiorisyshen/testCode
|
9589637f3995549b72f4be1c7c50e30d29da1f95
|
881f40ab8f5b6fdf6d8c9e279eb7cd50d1fa6f90
|
refs/heads/master
| 2020-09-01T06:16:32.004151
| 2020-06-01T14:24:27
| 2020-06-01T14:24:27
| 218,897,056
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,231
|
cpp
|
main.cpp
|
#include <iostream>
#include "spa.h"
int main() {
spa_data dataStruct;
dataStruct.year = 2019;
dataStruct.month = 11;
dataStruct.day = 21;
dataStruct.hour = 9;
dataStruct.minute = 54;
dataStruct.second = 0;
dataStruct.delta_t = 32.184;
dataStruct.timezone = 0;
dataStruct.longitude = 0.441425;
dataStruct.latitude = 51.40081;
dataStruct.elevation = 12;
dataStruct.pressure = 1000;
dataStruct.temperature = 2;
dataStruct.slope = 0;
dataStruct.azm_rotation = 0;
dataStruct.atmos_refract = 0.5667;
dataStruct.function = 0;
spa_calculate(&dataStruct);
std::cout << "Azimuth: " << dataStruct.azimuth << std::endl;
std::cout << "Azimuth180: " << dataStruct.azimuth180 << std::endl;
return 0;
}
// int year; // 4-digit year, valid range: -2000 to 6000, error code: 1
// int month; // 2-digit month, valid range: 1 to 12, error code: 2
// int day; // 2-digit day, valid range: 1 to 31, error code: 3
// int hour; // Observer local hour, valid range: 0 to 24, error code: 4
// int minute; // Observer local minute, valid range: 0 to 59, error code: 5
// int second; // Observer local second, valid range: 0 to 59, error code: 6
// float delta_t; // Difference between earth rotation time and terrestrial time
// // (from observation)
// // valid range: -8000 to 8000 seconds, error code: 7
// float timezone; // Observer time zone (negative west of Greenwich)
// // valid range: -12 to 12 hours, error code: 8
// float longitude; // Observer longitude (negative west of Greenwich)
// // valid range: -180 to 180 degrees, error code: 9
// float latitude; // Observer latitude (negative south of equator)
// // valid range: -90 to 90 degrees, error code: 10
// float elevation; // Observer elevation [meters]
// // valid range: -6500000 or higher meters, error code: 11
// float pressure; // Annual average local pressure [millibars]
// // valid range: 0 to 5000 millibars, error code: 12
// float temperature; // Annual average local temperature [degrees Celsius]
// // valid range: -273 to 6000 degrees Celsius, error code; 13
// float slope; // Surface slope (measured from the horizontal plane)
// // valid range: -360 to 360 degrees, error code: 14
// float azm_rotation; // Surface azimuth rotation (measured from south to projection of
// // surface normal on horizontal plane, negative west)
// // valid range: -360 to 360 degrees, error code: 15
// float atmos_refract; // Atmospheric refraction at sunrise and sunset (0.5667 deg is typical)
// // valid range: -5 to 5 degrees, error code: 16
// int function; // Switch to choose functions for desired output (from enumeration)
|
1a74be2b9a5f391e22dfff3bec66562643e99e2f
|
2bb787bf51d2b404bb6131be29c06b83a3a2fd6a
|
/tags/imkit-r682/Preflet/PApplication.cpp
|
18e7f0dad6064f61fc98a3169c5ac7a81ab615e0
|
[
"BSD-3-Clause"
] |
permissive
|
louisdem/IMKit
|
55f1128a30274ce584ebad67ed8a7c0ace81148e
|
9734cd67c04af047c37a0e17119dc19429855990
|
refs/heads/master
| 2022-02-10T07:19:04.131608
| 2022-01-26T09:17:00
| 2022-01-26T09:17:00
| 19,458,680
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 674
|
cpp
|
PApplication.cpp
|
#include "PApplication.h"
PApplication::PApplication(void)
: BApplication("application/x-vnd.beclan-IMKitPrefs") {
};
PApplication::~PApplication(void) {
// delete fWindow;
};
void PApplication::ReadyToRun(void) {
fWindow = new PWindow();
};
bool PApplication::QuitRequested(void) {
return true;
};
void PApplication::MessageReceived(BMessage *msg) {
//msg->PrintToStream();
BApplication::MessageReceived(msg);
// switch (msg->what) {
// case PRIMARY:
// case SECONDARY:
// case TERTIARY:
// case KEY_SET: {
//
// BMessenger msgr(fWindow);
// msgr.SendMessage(msg);
//
// } break;
// default: {
// BApplication::MessageReceived(msg);
// };
// };
};
|
8feb54e185ea4b797e2789f3e04d5f323b36996b
|
b579d32b04731f0215b9843bc0f9d8812abbae9a
|
/Algo2/Taller/ejercitacion_definicion_clases/src/Libreta.cpp
|
f0bc1d86332130e7ac8b893026b886350427c343
|
[] |
no_license
|
pdbruno/TPsPatricio
|
b693893bf8ff127ad46d9ce3b783a9afa321884e
|
130f3feea6ee3f4546b034b23b8e7ff2b3272673
|
refs/heads/master
| 2021-06-29T19:35:41.109732
| 2021-03-31T19:57:47
| 2021-03-31T19:57:47
| 227,661,643
| 0
| 2
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,104
|
cpp
|
Libreta.cpp
|
#include <set>
#include <map>
#include <utility>
#include <string>
using namespace std;
using uint = unsigned int;
using LU = string;
using Materia = string;
using Nota = uint;
class Libreta {
public:
LU lu();
set<Materia> practicos_aprobados();
set<Materia> finales_aprobados();
Nota nota_final(Materia m);
Libreta(LU);
void aprobar_practico(Materia m);
void aprobar_final(Materia m, Nota nota);
private:
LU lu_;
set<Materia> practicos_;
map<Materia, Nota> finales_;
};
LU Libreta::lu() {
return lu_;
}
set<Materia> Libreta::practicos_aprobados() {
return practicos_;
}
set<Materia> Libreta::finales_aprobados() {
set<Materia> ret;
for (pair<Materia, Nota> pn : finales_) {
ret.insert(pn.first);
}
return ret;
}
Nota Libreta::nota_final(Materia m) {
return finales_.at(m);
}
Libreta::Libreta(LU lu) : lu_(lu), practicos_(), finales_() {}
void Libreta::aprobar_practico(Materia m) {
practicos_.insert(m);
}
void Libreta::aprobar_final(Materia m, Nota n) {
practicos_.insert(m);
finales_.insert(make_pair(m, n));
}
|
83bc956e0bd60b1f1bcd3d4e19575f61edc4c367
|
59424ff5eaf5d0b9f8cc9144a28aba101e385188
|
/deyx.cpp
|
2fe0575d8f1882caa8e08244801f1aa3b962062e
|
[] |
no_license
|
Mr-Computer/Your-beautiful-body
|
7f3502f04cc32032d81cba36471aa2f2d978eef9
|
8c35f93768c02a6e4449005ff77796b552dc578f
|
refs/heads/master
| 2020-03-13T04:42:53.640105
| 2018-05-04T15:26:05
| 2018-05-04T15:26:05
| 130,968,418
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 17,989
|
cpp
|
deyx.cpp
|
#include "deyx.h"
#include "ui_deyx.h"
#include "my_workout.h"
#include <QMessageBox>
#include <QFile>
#include <QTextStream>
#include "string.h"
#include <QDebug>
#include "my_mas.h"
static int _x=1,_d=0;
DeyX::DeyX(QWidget *parent) :
QDialog(parent),
ui(new Ui::DeyX)
{
ui->setupUi(this);
}
DeyX::~DeyX()
{
delete ui;
}
void DeyX::on_pushButton_clicked()
{
QMessageBox::StandardButton _q = QMessageBox::question(this,"Виконання","Ви виконали завдання?",
QMessageBox::Yes | QMessageBox::No);
if(_q == QMessageBox::Yes)
{
ui->pushButton->setStyleSheet("background-color: green");
finish(_x++);
} else
{
ui->pushButton->setStyleSheet("background-color: yellow");
}
}
void DeyX::on_pushButton_2_clicked()
{
QMessageBox::StandardButton _q = QMessageBox::question(this,"Виконання","Ви виконали завдання?",
QMessageBox::Yes | QMessageBox::No);
if(_q == QMessageBox::Yes)
{
ui->pushButton_2->setStyleSheet("background-color: green");
finish(_x++);
} else
{
ui->pushButton_2->setStyleSheet("background-color: yellow");
}
}
void DeyX::on_pushButton_3_clicked()
{
QMessageBox::StandardButton _q = QMessageBox::question(this,"Виконання","Ви виконали завдання?",
QMessageBox::Yes | QMessageBox::No);
if(_q == QMessageBox::Yes)
{
ui->pushButton_3->setStyleSheet("background-color: green");
finish(_x++);
} else
{
ui->pushButton_3->setStyleSheet("background-color: yellow");
}
}
void DeyX::on_pushButton_4_clicked()
{
QMessageBox::StandardButton _q = QMessageBox::question(this,"Виконання","Ви виконали завдання?",
QMessageBox::Yes | QMessageBox::No);
if(_q == QMessageBox::Yes)
{
ui->pushButton_4->setStyleSheet("background-color: green");
finish(_x++);
} else
{
ui->pushButton_4->setStyleSheet("background-color: yellow");
}
}
void DeyX::on_pushButton_5_clicked()
{
QMessageBox::StandardButton _q = QMessageBox::question(this,"Виконання","Ви виконали завдання?",
QMessageBox::Yes | QMessageBox::No);
if(_q == QMessageBox::Yes)
{
ui->pushButton_5->setStyleSheet("background-color: green");
finish(_x++);
} else
{
ui->pushButton_5->setStyleSheet("background-color: yellow");
}
}
void DeyX::on_pushButton_6_clicked()
{
My_workout work(this);
work.setModal(true);
this->close();
work.exec();
}
void DeyX::predock (int x)
{
switch (x) {
case 1:
{ ui->pushButton->setText("50 Присідань");
ui->pushButton_2->setText("20 сек «Планка»");
ui->pushButton_3->setText("20 разів Качання пресу");
ui->pushButton_4->setText("40 разів Махи ногами (на одну ногу)");
ui->pushButton_5->setText("5 разів Віджимання від підлоги");
_d=1;
break;}
case 2:
{ ui->pushButton->setText("55 Присідань");
ui->pushButton_2->setText("20 сек «Планка»");
ui->pushButton_3->setText("25 разів Качання пресу");
ui->pushButton_4->setText("45 разів Махи ногами (на одну ногу)");
ui->pushButton_5->setText("5 разів Віджимання від підлоги");
_d=2;
break;}
case 3:
{ ui->pushButton->setText("60 Присідань");
ui->pushButton_2->setText("30 сек «Планка»");
ui->pushButton_3->setText("25 разів Качання пресу");
ui->pushButton_4->setText("45 разів Махи ногами (на одну ногу)");
ui->pushButton_5->setText("100 разів Стрибки зі скакалкою");
_d=3;
break;}
case 4:
{ ui->pushButton->setText("30 сек «Планка»");
ui->pushButton_2->setText("5 разів Віджимання від підлоги");
ui->pushButton_3->setText("160 разів Стрибки зі скакалкою");
ui->pushButton_4->setText("25 разів Підйом сідниць лежачи");
ui->pushButton_5->setText("30 разів Нахили тулуба (вліво ,вправо , вперед)");
_d=4;
break;}
case 5:
{ ui->pushButton->setText("70 Присідань");
ui->pushButton_2->setText("40 сек «Планка»");
ui->pushButton_3->setText("25 разів Качання пресу");
ui->pushButton_4->setText("45 разів Махи ногами (на одну ногу)");
ui->pushButton_5->setText("10 разів Віджимання від підлоги");
_d=5;
break;}
case 6:
{ ui->pushButton->setText("75 Присідань");
ui->pushButton_2->setText("30 разів Качання пресу");
ui->pushButton_3->setText("50 разів Махи ногами (на одну ногу)");
ui->pushButton_4->setText("200 разів Стрибки зі скакалкою");
ui->pushButton_5->setText("10 разів Віджимання від підлоги");
_d=6;
break;}
case 7:
{ ui->pushButton->setText("80 Присідань");
ui->pushButton_2->setText("45 сек «Планка»");
ui->pushButton_3->setText("35 разів Качання пресу");
ui->pushButton_4->setText("55 разів Махи ногами (на одну ногу)");
ui->pushButton_5->setText("10 разів Віджимання від підлоги");
_d=7;
break;}
case 8:
{ ui->pushButton->setText("45 сек «Планка»");
ui->pushButton_2->setText("260 разів Стрибки зі скакалкою");
ui->pushButton_3->setText("40 разів Підйом сідниць лежачи");
ui->pushButton_4->setText("40 разів Нахили тулуба (вліво ,вправо , вперед)");
ui->pushButton_5->setText("10 разів Скручування тулуба (вліво ,вправо)");
_d=8;
break;}
case 9:
{ ui->pushButton->setText("100 Присідань");
ui->pushButton_2->setText("60 сек «Планка»");
ui->pushButton_3->setText("35 разів Качання пресу");
ui->pushButton_4->setText("55 разів Махи ногами (на одну ногу)");
ui->pushButton_5->setText("12 разів Віджимання від підлоги");
_d=9;
break;}
case 10:
{ ui->pushButton->setText("105 Присідань");
ui->pushButton_2->setText("60 сек «Планка»");
ui->pushButton_3->setText("40 разів Качання пресу");
ui->pushButton_4->setText("60 разів Махи ногами (на одну ногу)");
ui->pushButton_5->setText("12 разів Віджимання від підлоги");
_d=10;
break;}
case 11:
{ ui->pushButton->setText("110 Присідань");
ui->pushButton_2->setText("60 сек «Планка»");
ui->pushButton_3->setText("35 разів Качання пресу");
ui->pushButton_4->setText("65 разів Махи ногами (на одну ногу)");
ui->pushButton_5->setText("300 разів Стрибки зі скакалкою");
_d=11;
break;}
case 12:
{ ui->pushButton->setText("90 сек «Планка»");
ui->pushButton_2->setText("15 разів Віджимання від підлоги");
ui->pushButton_3->setText("360 разів Стрибки зі скакалкою");
ui->pushButton_4->setText("40 разів Підйом сідниць лежачи");
ui->pushButton_5->setText("50 разів Нахили тулуба (вліво ,вправо , вперед)");
_d=12;
break;}
case 13:
{ ui->pushButton->setText("130 Присідань");
ui->pushButton_2->setText("30 разів Качання пресу");
ui->pushButton_3->setText("60 разів Махи ногами (на одну ногу)");
ui->pushButton_4->setText("15 разів Віджимання від підлоги");
ui->pushButton_5->setText("400 разів Стрибки зі скакалкою");
_d=13;
break;}
case 14:
{ ui->pushButton->setText("135 Присідань");
ui->pushButton_2->setText("90 сек «Планка»");
ui->pushButton_3->setText("35 разів Качання пресу");
ui->pushButton_4->setText("65 разів Махи ногами (на одну ногу)");
ui->pushButton_5->setText("460 разів Стрибки зі скакалкою");
_d=14;
break;}
case 15:
{ ui->pushButton->setText("140 Присідань");
ui->pushButton_2->setText("90 сек «Планка»");
ui->pushButton_3->setText("40 разів Качання пресу");
ui->pushButton_4->setText("60 разів Махи ногами (на одну ногу)");
ui->pushButton_5->setText("20 разів Віджимання від підлоги");
_d=15;
break;}
case 16:
{ ui->pushButton->setText("120 сек «Планка»");
ui->pushButton_2->setText("24 разів Віджимання від підлоги");
ui->pushButton_3->setText("500 разів Стрибки зі скакалкою");
ui->pushButton_4->setText("45 разів Підйом сідниць лежачи");
ui->pushButton_5->setText("55 разів Нахили тулуба (вліво ,вправо , вперед)");
_d=16;
break;}
case 17:
{ ui->pushButton->setText("150 Присідань");
ui->pushButton_2->setText("120 сек «Планка»");
ui->pushButton_3->setText("45 разів Качання пресу");
ui->pushButton_4->setText("65 разів Махи ногами (на одну ногу)");
ui->pushButton_5->setText("560 разів Стрибки зі скакалкою");
_d=17;
break;}
case 18:
{ ui->pushButton->setText("155 Присідань");
ui->pushButton_2->setText("150 сек «Планка»");
ui->pushButton_3->setText("50 разів Качання пресу");
ui->pushButton_4->setText("70 разів Махи ногами (на одну ногу)");
ui->pushButton_5->setText("25 разів Віджимання від підлоги");
_d=18;
break;}
case 19:
{ ui->pushButton->setText("160 Присідань");
ui->pushButton_2->setText("55 разів Качання пресу");
ui->pushButton_3->setText("75 разів Махи ногами (на одну ногу)");
ui->pushButton_4->setText("30 разів Віджимання від підлоги");
ui->pushButton_5->setText("600 разів Стрибки зі скакалкою");
_d=19;
break;}
case 20:
{ ui->pushButton->setText("150 сек «Планка»");
ui->pushButton_2->setText("660 разів Стрибки зі скакалкою");
ui->pushButton_3->setText("50 разів Підйом сідниць лежачи");
ui->pushButton_4->setText("60 разів Нахили тулуба (вліво ,вправо , вперед)");
ui->pushButton_5->setText("20 разів Скручування тулуба (вліво ,вправо)");
_d=20;
break;}
case 21:
{ ui->pushButton->setText("180 Присідань");
ui->pushButton_2->setText("150 сек «Планка»");
ui->pushButton_3->setText("50 разів Качання пресу");
ui->pushButton_4->setText("70 разів Махи ногами (на одну ногу)");
ui->pushButton_5->setText("32 разів Віджимання від підлоги");
_d=21;
break;}
case 22:
{ ui->pushButton->setText("185 Присідань");
ui->pushButton_2->setText("180 сек «Планка»");
ui->pushButton_3->setText("55 разів Качання пресу");
ui->pushButton_4->setText("75 разів Махи ногами (на одну ногу)");
ui->pushButton_5->setText("35 разів Віджимання від підлоги");
_d=22;
break;}
case 23:
{ ui->pushButton->setText("190 Присідань");
ui->pushButton_2->setText("210 сек «Планка»");
ui->pushButton_3->setText("55 разів Качання пресу");
ui->pushButton_4->setText("75 разів Махи ногами (на одну ногу)");
ui->pushButton_5->setText("35 разів Віджимання від підлоги");
_d=23;
break;}
case 24:
{ ui->pushButton->setText("210 сек «Планка»");
ui->pushButton_2->setText("700 разів Стрибки зі скакалкою");
ui->pushButton_3->setText("55 разів Підйом сідниць лежачи");
ui->pushButton_4->setText("50 разів Нахили тулуба (вліво ,вправо , вперед)");
ui->pushButton_5->setText("30 разів Скручування тулуба (вліво ,вправо)");
_d=24;
break;}
case 25:
{ ui->pushButton->setText("220 Присідань");
ui->pushButton_2->setText("210 сек «Планка»");
ui->pushButton_3->setText("50 разів Качання пресу");
ui->pushButton_4->setText("70 разів Махи ногами (на одну ногу)");
ui->pushButton_5->setText("38 разів Віджимання від підлоги");
_d=25;
break;}
case 26:
{ ui->pushButton->setText("225 Присідань");
ui->pushButton_2->setText("26 разів Качання пресу");
ui->pushButton_3->setText("65 разів Махи ногами (на одну ногу)");
ui->pushButton_4->setText("40 разів Віджимання від підлоги");
ui->pushButton_5->setText("760 разів Стрибки зі скакалкою");
_d=26;
break;}
case 27:
{ ui->pushButton->setText("230 Присідань");
ui->pushButton_2->setText("240 сек «Планка»");
ui->pushButton_3->setText("60 разів Качання пресу");
ui->pushButton_4->setText("60 разів Махи ногами (на одну ногу)");
ui->pushButton_5->setText("800 разів Стрибки зі скакалкою");
_d=27;
break;}
case 28:
{ ui->pushButton->setText("240 сек «Планка»");
ui->pushButton_2->setText("42 разів Віджимання від підлоги");
ui->pushButton_3->setText("860 разів Стрибки зі скакалкою");
ui->pushButton_4->setText("60 разів Підйом сідниць лежачи");
ui->pushButton_5->setText("60 разів Нахили тулуба (вліво ,вправо , вперед)");
_d=28;
break;}
case 29:
{ ui->pushButton->setText("240 Присідань");
ui->pushButton_2->setText("270 сек «Планка»");
ui->pushButton_3->setText("55 разів Качання пресу");
ui->pushButton_4->setText("65 разів Махи ногами (на одну ногу)");
ui->pushButton_5->setText("45 разів Віджимання від підлоги");
_d=29;
break;}
case 30:
{ ui->pushButton->setText("250 Присідань");
ui->pushButton_2->setText("300 сек «Планка»");
ui->pushButton_3->setText("60 разів Качання пресу");
ui->pushButton_4->setText("70 разів Махи ногами (на одну ногу)");
ui->pushButton_5->setText("50 разів Віджимання від підлоги");
_d=30;
break;}
default:
break;
}
}
void DeyX::finish (int t)
{
if (t == 5)
{ _x=1; eset(_d);
QMessageBox::about(this,"Фіналочка",
"Вітаємо з завершенням сьогоднішнього тренування.");
My_workout work(this);
work.setModal(true);
this->hide();
if (_d%5 == 0)
{
My_mas mas(this);
mas.setModal(true);
mas.exec();
}
work.buttom_paint();
work.exec();
}
}
void DeyX::eset (int x)
{
QFile file("workout.dat");
file.open(QIODevice::ReadWrite);
QString line;
line = file.readAll();
line[x-1]='1';
file.close();
file.open(QIODevice::Truncate);
file.close();
file.open(QIODevice::ReadWrite);
QTextStream stream(&file);
stream<<line;
file.close();
}
|
7be5af0788598f2242935f1cd24eae36d3d006de
|
58a0ba5ee99ec7a0bba36748ba96a557eb798023
|
/Olympiad Solutions/URI/1469.cpp
|
84818fcb3b89a69cc41f1967d6d156067b30e381
|
[
"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,277
|
cpp
|
1469.cpp
|
// Ivan Carvalho
// Solution to https://www.urionlinejudge.com.br/judge/problems/view/1469
#include <cstdio>
#include <algorithm>
#include <set>
#include <queue>
using namespace std;
#define MAXN 700
set<int> grafo[MAXN];
int idade[MAXN],processado[MAXN],N,M,I;
int main(){
while(scanf("%d %d %d",&N,&M,&I)!= EOF){
for(int i=1;i<=N;i++) grafo[i].clear();
for(int i=1;i<=N;i++) scanf("%d",&idade[i]);
while(M--){
int u,v;
scanf("%d %d",&u,&v);
grafo[v].insert(u);
}
while(I--){
char op;
scanf(" %c",&op);
if(op == 'T'){
int a,b;
scanf("%d %d",&a,&b);
swap(grafo[a],grafo[b]);
for(int i=1;i<=N;i++){
int tem_a = grafo[i].count(a);
int tem_b = grafo[i].count(b);
if(tem_a == tem_b) continue;
if(tem_a){
grafo[i].erase(a);
grafo[i].insert(b);
}
if(tem_b){
grafo[i].erase(b);
grafo[i].insert(a);
}
}
}
else{
int davez;
scanf("%d",&davez);
queue<int> bfs;
for(int i=1;i<=N;i++){
processado[i] = 0;
if(grafo[davez].count(i)) bfs.push(i);
}
processado[davez] = 1;
int resp= MAXN;
while(!bfs.empty()){
int v = bfs.front();
bfs.pop();
if(processado[v]) continue;
processado[v] = 1;
resp = min(resp,idade[v]);
for(set<int>::iterator it = grafo[v].begin();it != grafo[v].end();it++){
int u = *it;
bfs.push(u);
}
}
if(resp== MAXN) printf("*\n");
else printf("%d\n",resp);
}
}
}
return 0;
}
|
9331bc9d6bede02f4cc236a4c31f51c42e62bbf1
|
635a31fb5f4fed8f1f630f6f6620e55ce4ae03e6
|
/CODEJAM/CODEJAM 2014/reorder.cpp
|
697d10ca6f506376e527208c381aafea3f6f816d
|
[] |
no_license
|
iCodeIN/Problem-Solving
|
82cd4eef0e4606baf31d8de34135dd5366d19a1e
|
92f13c2cab5dfe914755dae7790c9cf8c6fb8782
|
refs/heads/master
| 2022-11-27T16:49:30.319955
| 2020-08-08T08:47:24
| 2020-08-08T08:47:24
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 703
|
cpp
|
reorder.cpp
|
#include<bits/stdc++h>
using namespcae std;
int fact(int n)
{
if(n==0 || n==1)
return 1;
else
return n*fact(n-1);
}
int main()
{
int iter, Num_Test;
ifstream fin;
fin.open("reorder.in");
fin>>Num_Test;
for(iter=0;iter<Num_Test;iter++){
int N,i,j,k,l,count=0,proceed=0;
fin>>N;
char str[N][10];
for(i=0;i<N;i++){
char* temp=new char[10];
fin>>temp;
strcpy(str[i],temp);
}
int alpha[26]={0};
for(i=0;i<N;i++){
for(j=0;str[i][j]!='\0';j++){
alpha[str[i][j]-'a']++;
}
}
for(i=0;i<26;i++){
if(alpha[i]>1)
proceed=1;
}
if(proceed==0)
cout<<"CASE #"<<iter+1<<":\t"<<fact(N)<<endl;
else{
}
}
}
|
bf333638630107778a00bce267ed648f234a719d
|
38bed5cff8735fa2d14270cc42cd7805e686aa56
|
/led_hat/src/led.cpp
|
87f9e2276f4e7472da45fe8836d4e182a923839d
|
[] |
no_license
|
theicfire/led_sync
|
b36a003d7b4557b5557f593d8131aa3149bbb62a
|
54ba769c2b8db888b33a7610f45dd87cbae2a177
|
refs/heads/master
| 2022-11-17T21:37:48.431751
| 2022-08-23T19:37:00
| 2022-08-23T19:37:00
| 203,098,461
| 4
| 2
| null | 2023-08-23T06:23:19
| 2019-08-19T04:31:05
|
C++
|
UTF-8
|
C++
| false
| false
| 12,373
|
cpp
|
led.cpp
|
#include <Arduino.h>
#include <FastLED.h>
#include "time.h"
#include "friend.h"
#define LED_PIN 5
#define NUM_LEDS 300
//#define BRIGHTNESS 100
#define LED_TYPE WS2811
#define COLOR_ORDER GRB
CRGB leds[NUM_LEDS];
CRGBPalette16 currentPalette;
CRGBPalette16 targetPalette;
TBlendType currentBlending;
#define UPDATES_PER_SECOND 50
//extern const TProgmemPalette16 only_red PROGMEM;
DEFINE_GRADIENT_PALETTE( fireandice_gp ) {
0, 80, 2, 1,
51, 206, 15, 1,
101, 242, 34, 1,
153, 16, 67,128,
204, 2, 21, 69,
255, 1, 2, 4};
DEFINE_GRADIENT_PALETTE( sky_45_gp ) {
0, 249,205, 4,
51, 255,239,123,
87, 5,141, 85,
178, 1, 26, 43,
255, 0, 2, 23};
DEFINE_GRADIENT_PALETTE( es_seadreams_04_gp ) {
0, 137,229,240,
68, 2, 59,119,
158, 16,133,205,
252, 95,233,245,
255, 95,233,245};
DEFINE_GRADIENT_PALETTE( alarm_p1_0_5_gp ) {
0, 182,255,168,
12, 206,255, 63,
25, 255,231, 36,
38, 255,168, 21,
51, 255,114, 12,
63, 255, 68, 6,
76, 255, 35, 3,
89, 255, 13, 1,
102, 255, 2, 1,
114, 255, 1, 6,
127, 255, 1, 52,
140, 255, 1,156,
153, 190, 1,255,
165, 75, 1,255,
178, 19, 1,255,
191, 1, 1,255,
204, 1, 8,255,
216, 1, 44,255,
229, 1,108,255,
242, 1,199,255,
255, 1,255,186};
DEFINE_GRADIENT_PALETTE( BrBG_07_gp ) {
0, 53, 20, 1,
36, 53, 20, 1,
36, 165,117, 25,
72, 165,117, 25,
72, 232,207,130,
109, 232,207,130,
109, 229,233,230,
145, 229,233,230,
145, 133,211,194,
182, 133,211,194,
182, 17,118, 95,
218, 17,118, 95,
218, 1, 33, 21,
255, 1, 33, 21};
// Have green
DEFINE_GRADIENT_PALETTE( bhw1_05_gp ) {
0, 1,221, 53,
255, 73, 3,178};
DEFINE_GRADIENT_PALETTE( bhw1_26_gp ) {
0, 107, 1,205,
35, 255,255,255,
73, 107, 1,205,
107, 10,149,210,
130, 255,255,255,
153, 10,149,210,
170, 27,175,119,
198, 53,203, 56,
207, 132,229,135,
219, 255,255,255,
231, 132,229,135,
252, 53,203, 56,
255, 53,203, 56};
DEFINE_GRADIENT_PALETTE( bhw1_sunconure_gp ) {
0, 20,223, 13,
160, 232, 65, 1,
252, 232, 5, 1,
255, 232, 5, 1};
DEFINE_GRADIENT_PALETTE( bhw2_turq_gp ) {
0, 1, 33, 95,
38, 1,107, 37,
76, 42,255, 45,
127, 255,255, 45,
178, 42,255, 45,
216, 1,107, 37,
255, 1, 33, 95};
DEFINE_GRADIENT_PALETTE( bhw2_10_gp ) {
0, 0, 12, 0,
61, 153,239,112,
127, 0, 12, 0,
165, 106,239, 2,
196, 167,229, 71,
229, 106,239, 2,
255, 0, 12, 0};
DEFINE_GRADIENT_PALETTE( bhw3_61_gp ) {
0, 14, 1, 27,
48, 17, 1, 88,
104, 1, 88,156,
160, 1, 54, 42,
219, 9,235, 52,
255, 139,235,233};
DEFINE_GRADIENT_PALETTE( bhw4_029_gp ) {
0, 28, 7, 75,
43, 73, 22, 74,
79, 177,146,197,
122, 21, 72,137,
165, 15,184, 75,
255, 224,205, 4};
DEFINE_GRADIENT_PALETTE( aspectcolr_gp ) {
0, 255,255,255,
0, 255,255, 0,
63, 0,255, 0,
127, 0,255,255,
191, 255, 0, 0,
255, 255,255, 0};
DEFINE_GRADIENT_PALETTE( only_red ) {
0, 255,0,0,
255, 255,0,0};
DEFINE_GRADIENT_PALETTE( only_green ) {
0, 0,255,0,
255, 0,255,0 };
DEFINE_GRADIENT_PALETTE( only_blue ) {
0, 0,0,255,
255, 0,0,255 };
DEFINE_GRADIENT_PALETTE( only_yellow ) {
0, 255,240,0,
255, 255,240,0 };
DEFINE_GRADIENT_PALETTE( only_purple ) {
0, 255,0,255,
255, 255,0,255 };
DEFINE_GRADIENT_PALETTE( only_teal ) {
0, 0,240,255,
255, 0,240,255 };
DEFINE_GRADIENT_PALETTE( only_orange ) {
0, 255,128,0,
255, 255,128,0 };
void runPaletteGradient(int index, uint8_t brightness)
{
uint8_t colorIndex = index;
for( int i = 0; i < NUM_LEDS; i++) {
leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
colorIndex += 3;
}
}
void runPaletteFullFade(int index) {
uint8_t brightness = 255;
uint8_t colorIndex = index / 4; // slow down
for( int i = 0; i < NUM_LEDS; i++) {
leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
}
}
void setPixel(int Pixel, byte red, byte green, byte blue) {
leds[Pixel].r = red;
leds[Pixel].g = green;
leds[Pixel].b = blue;
}
void runMeteorRain(int index, byte red, byte green, byte blue) {
uint8_t meteorSize = 10;
uint8_t meteorTrailDecay = 64;
// 2x leds to have the tail of the meteor work correctly
int i = index % (NUM_LEDS * 2);
// fade brightness all LEDs one step
for(int j=0; j<NUM_LEDS; j++) {
if(random(10)>5) {
leds[j].fadeToBlackBy( meteorTrailDecay );
}
}
// draw meteor
for (int i = index % 100; i < NUM_LEDS; i+= 100) {
for(int j = 0; j < meteorSize; j++) {
if( ( i-j <NUM_LEDS) && (i-j>=0) ) {
leds[i - j] = ColorFromPalette(currentPalette, index, 0xFF, currentBlending);
}
}
}
}
void ChooseLonerGradient(unsigned long time, int speed)
{
uint8_t secondHand = (time / 1000) % (13 * speed);
static uint8_t lastSecond = 99;
if( lastSecond != secondHand) {
lastSecond = secondHand;
Serial.print("Loner secondHand: "); Serial.println(secondHand);
}
if( secondHand <= 1 * speed) { targetPalette = CloudColors_p; currentBlending = LINEARBLEND; }
else if( secondHand <= 1 * speed + 3) { targetPalette = only_red; currentBlending = LINEARBLEND; }
else if( secondHand <= 3 * speed) { targetPalette = PartyColors_p; currentBlending = LINEARBLEND; }
else if( secondHand <= 3 * speed + 3) { targetPalette = only_blue; currentBlending = LINEARBLEND; }
else if( secondHand <= 5 * speed) { targetPalette = fireandice_gp; currentBlending = LINEARBLEND; }
else if( secondHand <= 5 * speed + 3) { targetPalette = only_yellow; currentBlending = LINEARBLEND; }
else if( secondHand <= 7 * speed) { targetPalette = sky_45_gp; currentBlending = LINEARBLEND; }
else if( secondHand <= 7 * speed + 3) { targetPalette = only_purple; currentBlending = LINEARBLEND; }
else if( secondHand <= 9 * speed) { targetPalette = es_seadreams_04_gp; currentBlending = LINEARBLEND; }
else if( secondHand <= 9 * speed + 3) { targetPalette = only_teal; currentBlending = LINEARBLEND; }
else if( secondHand <= 11 * speed) { targetPalette = alarm_p1_0_5_gp; currentBlending = LINEARBLEND; }
else if( secondHand <= 11 * speed + 3) { targetPalette = only_orange; currentBlending = LINEARBLEND; }
else if( secondHand <= 13 * speed) { targetPalette = BrBG_07_gp; currentBlending = LINEARBLEND; }
}
void ChooseFriendGradient(unsigned long time, int speed)
{
uint8_t secondHand = (time / 1000) % (9 * speed);
static uint8_t lastSecond = 99;
if( lastSecond != secondHand) {
lastSecond = secondHand;
Serial.print("Friend secondHand: "); Serial.println(secondHand);
}
if( secondHand <= 1 * speed) { targetPalette = RainbowColors_p; currentBlending = LINEARBLEND; }
else if( secondHand <= 1 * speed + 3) { targetPalette = only_green; currentBlending = LINEARBLEND; }
else if( secondHand <= 3 * speed) { targetPalette = bhw1_05_gp; currentBlending = LINEARBLEND; }
else if( secondHand <= 3 * speed + 3) { targetPalette = only_red; currentBlending = LINEARBLEND; }
else if( secondHand <= 5 * speed) { targetPalette = bhw1_26_gp; currentBlending = LINEARBLEND; }
else if( secondHand <= 5 * speed + 3) { targetPalette = only_blue; currentBlending = LINEARBLEND; }
else if( secondHand <= 7 * speed) { targetPalette = bhw1_sunconure_gp; currentBlending = LINEARBLEND; }
else if( secondHand <= 7 * speed + 3) { targetPalette = only_yellow; currentBlending = LINEARBLEND; }
else if( secondHand <= 9 * speed) { targetPalette = bhw2_turq_gp; currentBlending = LINEARBLEND; }
else if( secondHand <= 9 * speed + 3) { targetPalette = only_purple; currentBlending = LINEARBLEND; }
else if( secondHand <= 11 * speed) { targetPalette = bhw2_10_gp; currentBlending = LINEARBLEND; }
else if( secondHand <= 11 * speed + 3) { targetPalette = only_teal; currentBlending = LINEARBLEND; }
else if( secondHand <= 13 * speed) { targetPalette = bhw3_61_gp; currentBlending = LINEARBLEND; }
else if( secondHand <= 13 * speed + 3) { targetPalette = only_orange; currentBlending = LINEARBLEND; }
else if( secondHand <= 15 * speed) { targetPalette = bhw4_029_gp; currentBlending = LINEARBLEND; }
else if( secondHand <= 15 * speed + 3) { targetPalette = only_green; currentBlending = LINEARBLEND; }
else if( secondHand <= 17 * speed) { targetPalette = aspectcolr_gp; currentBlending = LINEARBLEND; }
}
void LED_Init() {
FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
//FastLED.setBrightness(BRIGHTNESS);
targetPalette = RainbowColors_p;
currentPalette = RainbowColors_p;
currentBlending = LINEARBLEND;
}
uint8_t get_brightness(bool friendExists) {
uint8_t friend_brightness = 30;
uint8_t loner_brightness = 10;
static unsigned long start_brightness_move = 0;
static bool didFriendExist = false;
if (friendExists != didFriendExist) {
start_brightness_move = millis();
didFriendExist = friendExists;
}
unsigned long brightness_move_fraction_long = (millis() - start_brightness_move) * 255 / 1000;
uint8_t brightness_move_fraction = 255;
if (brightness_move_fraction_long < 250) {
brightness_move_fraction = brightness_move_fraction_long;
}
if (friendExists) {
return ((unsigned long) (friend_brightness - loner_brightness)) * brightness_move_fraction / 255 + loner_brightness;
} else {
return friend_brightness - ((unsigned long) (friend_brightness - loner_brightness)) * brightness_move_fraction / 255;
}
}
void LED_Update()
{
static unsigned long last_brightness_update_time = 0;
uint8_t index = Time_GetTime() / (1000 / UPDATES_PER_SECOND);
int brightness_change = (Time_GetTime() - last_brightness_update_time) / (1000 / 25);
if (friendExists) {
ChooseFriendGradient(Time_GetTime(), 5);
} else {
ChooseLonerGradient(Time_GetTime(), 5);
}
nblendPaletteTowardPalette( currentPalette, targetPalette, 48);
uint8_t brightness = get_brightness(friendExists);
//Serial.println(brightness);
runPaletteGradient(index, brightness);
FastLED.show();
}
//// This function fills the palette with totally random colors.
//void SetupTotallyRandomPalette()
//{
//for( int i = 0; i < 16; i++) {
//currentPalette[i] = CHSV( random8(), 255, random8());
//}
//}
// This function sets up a palette of black and white stripes,
// using code. Since the palette is effectively an array of
// sixteen CRGB colors, the various fill_* functions can be used
// to set them up.
//void SetupBlackAndWhiteStripedPalette()
//{
//// 'black out' all 16 palette entries...
//fill_solid( currentPalette, 16, CRGB::Black);
//// and set every fourth one to white.
//currentPalette[0] = CRGB::White;
//currentPalette[4] = CRGB::White;
//currentPalette[8] = CRGB::White;
//currentPalette[12] = CRGB::White;
//}
//// This function sets up a palette of purple and green stripes.
//void SetupPurpleAndGreenPalette()
//{
//CRGB purple = CHSV( HUE_PURPLE, 255, 255);
//CRGB green = CHSV( HUE_GREEN, 255, 255);
//CRGB black = CRGB::Black;
//currentPalette = CRGBPalette16(
//green, green, black, black,
//purple, purple, black, black,
//green, green, black, black,
//purple, purple, black, black );
//}
//const TProgmemPalette16 only_red PROGMEM =
//{
//CRGB::Red,
//CRGB::Red,
//CRGB::Red,
//CRGB::Red,
//CRGB::Red,
//CRGB::Red,
//CRGB::Red,
//CRGB::Red,
//CRGB::Red,
//CRGB::Red,
//CRGB::Red,
//CRGB::Red,
//CRGB::Red,
//CRGB::Red,
//CRGB::Red,
//CRGB::Red,
//};
|
881917bd36330b9a65977d6c7d56bae13c902daf
|
d69de64466cf1fd39c293133d344e38697550691
|
/osquery/tables/networking/windows/interfaces.h
|
02f1f116846cde4a434b691e97cae4337629d8d1
|
[
"GPL-2.0-only",
"Apache-2.0"
] |
permissive
|
santosomar/osquery
|
a34be751b9db3e44abf3195f3d49d5cb4731d520
|
6eb695bf9bfe35dd51ace957711a7493918780d0
|
refs/heads/master
| 2023-01-04T04:41:46.803854
| 2018-05-02T03:47:22
| 2018-05-02T03:47:22
| 131,799,925
| 1
| 0
|
Apache-2.0
| 2022-12-23T19:20:01
| 2018-05-02T04:55:27
|
C++
|
UTF-8
|
C++
| false
| false
| 550
|
h
|
interfaces.h
|
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under both the Apache 2.0 license (found in the
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
* in the COPYING file in the root directory of this source tree).
* You may select, at your option, one of the above-listed licenses.
*/
#pragma once
#include <osquery/core.h>
#include <osquery/tables.h>
namespace osquery {
namespace tables {
QueryData genInterfaceDetails(QueryContext& context);
}
}
|
2270ff7a5c44a5d5f1f84e4287ff81df32dd6c6b
|
f15e977dbc5b69afd7bb75a0fb9fc6e4f07be850
|
/dynamic_prog/jump_game2.cpp
|
663abc74765f83360fced9a2b31f078df53de845
|
[] |
no_license
|
invrev/hello_world_ints
|
041ea109a12a3b60260c9e59dfe343388e510f87
|
25efc36cd507e79f7808824eaa9359f06f668f52
|
refs/heads/master
| 2020-05-19T13:34:15.872909
| 2015-01-12T11:37:32
| 2015-01-12T11:37:32
| 20,292,167
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 342
|
cpp
|
jump_game2.cpp
|
#include<iostream>
#include<vector>
using namespace std;
int jump(int A[],int n)
{
if (n <= 1)
return 0;
vector<int> s(n);
s[n-1] = 0;
for (int k = n-2; k >= 0; --k) {
for (size_t i=1; i <= A[k] && i < n-k; ++i) {
s[k] = min(s[k], 1 + s[k+i]);
}
}
return s[0];
}
int main () {
}
|
6d76739c4f7ce89199baef38a634d6fc17e3d5c1
|
c5f1a804dbd1f5de123469dd5432633633e80597
|
/GAMELIB_2/src/UI/WorldCanvas.cpp
|
68013f9dfcb8e3ccc45327924d8e1dcaca3b0496
|
[] |
no_license
|
brosell/HTS-Games
|
2d03a8988adc5c613dba1e249a7e0b409593ff11
|
3c7c1cc2ec4fe0ba7865f6eec5cec905faab5a3f
|
refs/heads/master
| 2021-01-22T21:23:38.681074
| 2020-01-12T15:41:47
| 2020-01-12T15:41:47
| 85,423,760
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 261
|
cpp
|
WorldCanvas.cpp
|
#pragma warning (disable : 4786 4503 4530)
#include "WorldCanvas.h"
void WorldCanvas::paint(Display* surface)
{
if (m_world)
{
Rect r=getTranslatedPosition();
m_world->setViewportPhysical(r.x, r.y, r.w, r.h);
m_world->draw(surface);
}
}
|
3a99742fe07fde909c5d8b3aaa6f79af80327203
|
00e9b8471bd2e81ceb667fc82e49240babbb113e
|
/biz/bizutility/sigslot/sigslot.h
|
2b8097ebf5f169608be514939add41d3a7421c75
|
[] |
no_license
|
Xershoo/BM-Client
|
4a6df1e4465d806bca6718391fc2f5c46ab1d2b4
|
2d1b8d26d63bb54b1ac296341353a6e07809b2d6
|
refs/heads/master
| 2020-03-29T05:01:00.564762
| 2019-03-06T01:46:35
| 2019-03-06T01:46:35
| 149,561,359
| 5
| 1
| null | null | null | null |
GB18030
|
C++
| false
| false
| 3,166
|
h
|
sigslot.h
|
#pragma once
#include <vector>
#include <algorithm> // find
// 要当心的问题
// 1. 不支持多线程,多线程会引发很多问题;
// 2. 如何满足信号和槽的随机析构问题,任何一方析构之后维护对应的数据来表示连接状态,
// 主要是信号对象(Signal1)里的信号槽队列Signal1::_vSlots,
// 和信号槽容器里的信号源队列SrcSigContainer::_vSig1s
// 3. 当解除信号关联的时候不光要删除对应的Signal1::_vSlots
// 还要检查当是最后一个关联的这种槽子,要删除槽子对应的信号队列;
// 4. 信号连接信号, SlotSignal1与Signal1要相互引用.
// !!!调用槽的时候可以删除槽子,但是千万不能删除信号源,切记切记!
//boost::signal< void ( const std::string& ) > boostSignal;
namespace biz_utility
{
#define SLOT_OBJ biz_utility::SrcSigContainer _src_sig_container;
class BaseSlot;
class SlotSignal;
class SrcSigContainer;
class BaseSignal
{
friend SlotSignal;
public:
~BaseSignal();
BaseSignal();
void Clear();
void Connect(BaseSlot*);
void DisConnect(BaseSlot*);
BaseSignal(const BaseSignal& rhs);
BaseSignal& operator = (const BaseSignal& rhs);
void CleanDelayDeletes();
void RemoveSlotByContainer(SrcSigContainer* slotContainer);
protected:
std::vector<BaseSlot*> _vSlots;
std::vector<BaseSlot*> _delayRemoves;
std::vector<SlotSignal*> _signal2SlotWrappers; // 将signal包装为slot
BaseSlot* _currentRunSlot;
};
class BaseSlot
{
public:
virtual ~BaseSlot() {}
virtual bool operator == (const BaseSlot&) const = 0;
virtual SrcSigContainer* GetSlotContainer() const { return NULL; }
virtual BaseSlot* Clone4(BaseSignal* owner) const = 0;
// slot对象都是属于signal的临时对象
};
// 使用槽的对象必须声明这个对象通过 SLOT_OBJ
class SrcSigContainer
{
public:
~SrcSigContainer()
{
std::vector<BaseSignal*>::iterator it = _vSigs.begin();
for (; it!=_vSigs.end(); ++it)
(*it)->RemoveSlotByContainer(this);
}
void AddSignal(BaseSignal* sig)
{
if (std::find(_vSigs.begin(), _vSigs.end(), sig) == _vSigs.end())
_vSigs.push_back(sig);
}
void RemoveSignal(BaseSignal* sig)
{
std::vector<BaseSignal*>::iterator it =
std::find(_vSigs.begin(), _vSigs.end(), sig);
if (it != _vSigs.end())
_vSigs.erase(it);
}
private:
std::vector<BaseSignal*> _vSigs;
};
class SlotSignal
{
public:
SlotSignal(BaseSignal* signal, BaseSignal* srcsignal)
:_innerSignal(signal),
_srcsignal(srcsignal)
{
_innerSignal->_signal2SlotWrappers.push_back(this);
}
~SlotSignal()
{
std::vector<SlotSignal*>::iterator it =
std::find(_innerSignal->_signal2SlotWrappers.begin(),
_innerSignal->_signal2SlotWrappers.end(), this);
_innerSignal->_signal2SlotWrappers.erase(it);
}
virtual void OnInnerSignalDestory() = 0;
protected:
BaseSignal* _innerSignal;
BaseSignal* _srcsignal;
};
}
#include "sigslot0.h"
#include "sigslot1.h"
#include "sigslot2.h"
#include "sigslot3.h"
#include "sigslot4.h"
#include "sigslot5.h"
#include "sigslot6.h"
#include "sigslot7.h"
#include "sigslot8.h"
|
ddca2f18712ad5bb95cbf2125c3e2a4c89f2b36e
|
4da2cf1b58751eae35f60e464563227223533bd9
|
/TCPClientThreadPoolTask.cpp
|
3f541e26db9017e01554eb5aba959608e0919387
|
[] |
no_license
|
jssfy/learngit_tcp
|
ac04f5b55a4fad4785fd69d5d245e3a2ebab3a8a
|
9f797f6b6e41516b9f83265e20910b8e08c0d75c
|
refs/heads/master
| 2021-01-23T06:49:18.255920
| 2013-12-24T08:32:45
| 2013-12-24T08:32:45
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,980
|
cpp
|
TCPClientThreadPoolTask.cpp
|
#include "tools.h"
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <unistd.h>
#include <sys/time.h>
#include "ThreadManager.h"
extern char *gInput;
extern unsigned int gLen;
namespace KIDD {
/*int
main (int argc, char *argv[])
{
if (argc != 2)
{
printf ("%s: IPAddress\n", argv[0]);
return 0;
} */
void TCPClientThreadPoolTask::Run() {
char *lServer = NULL;
short sockfd = -1;
char time_buf[30];
char *input = gInput;
struct timeval start, end;
struct timezone tz;
while ((sockfd = PopConnectionQ()) != -1) {
// <deleted, used to create socket and connect to server>
gettimeofday(&start, &tz);
int j = 1;
while (j-- > 0) {
int lSent = 0;
if ((lSent =
send(sockfd, &gLen, sizeof(int),
0)) == -1) {
perror("send");
exit(1);
}
GetLocalTime(&time_buf[0]);
P(("tid:%lu, %s read ready, to send content\n",
pthread_self(), time_buf));
unsigned lToSend = gLen, lIndex = 0;
while (lToSend > 0) {
if (lIndex > 0)
printf
("sent more than once \n");
if ((lSent =
send(sockfd, input, lToSend,
0)) == -1) {
perror("send");
break;
}
if (lSent > 0) {
lIndex += lSent;
lToSend -= lSent;
input += lSent;
}
}
GetLocalTime(&time_buf[0]);
gettimeofday(&end, &tz);
P(("tid:%lu, %s sending finished, consumed %ldus\n",
pthread_self(), time_buf,
end.tv_usec - start.tv_usec + (end.tv_sec -
start.tv_sec) * 1000000));
input -= lIndex;
}
// if (input != NULL)
// delete input;
shutdown(sockfd, 2);
close(sockfd);
// if(buf != NULL)delete [] buf;
//return;
}
}
int ConnectToServer(char*ipServer, short iPort)
{
struct timeval start, end;
gettimeofday(&start, NULL);
int sockfd, numbytes;
struct hostent *he;
struct sockaddr_in their_addr;
int i = 0;
he = gethostbyname(ipServer);
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
{
perror("ConnectToServer->socket");
exit(1);
}
their_addr.sin_port = htons(iPort);
their_addr.sin_family = AF_INET;
their_addr.sin_addr = *((struct in_addr *)he->h_addr);
bzero(&(their_addr.sin_zero), 8);
char time_buf[30];
//char *input = new char[lLen];
//if (NULL == input) {
// perror("ConnectToServer->memory");
// exit(1);
//}
//memcpy(input, lInput, lLen);
//input = lInput;
if (connect
(sockfd, (struct sockaddr *)&their_addr,
sizeof(struct sockaddr)) == -1) {
perror("ConnectToServer->connect");
exit(1);
}
gettimeofday(&end, NULL);
GetLocalTime(&time_buf[0]);
P(("tid:%lu, connected at %s, consumed %ldus\n", pthread_self(),
time_buf, end.tv_usec-start.tv_usec+(end.tv_sec-start.tv_sec)*1000000));
return sockfd;
}
}
|
bfe01151161ff570b0ddf33dfc0ad45c974ef7d3
|
51fdd27bfe20e60dd726b04850a881be110002e3
|
/luogu/1311/1311.cpp
|
d3e611e48481d64fbcbc462cb86ea4723277b25b
|
[] |
no_license
|
MintSummer/TYC
|
0eb4d04851a6ecc8e2d83475a6f16c6d1c6d8f9b
|
23700d4d857d0729b2db3b1ef9afc21b040aecbd
|
refs/heads/master
| 2020-04-11T16:13:18.035139
| 2019-03-10T15:18:53
| 2019-03-10T15:18:53
| 161,916,623
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 824
|
cpp
|
1311.cpp
|
#include<bits/stdc++.h>
using namespace std;
namespace TYC
{
typedef long long ll;
const int N=200010;
int n,k,p,last[110],num[110],sum[110];
ll ans;
inline int read()
{
int x=0,f=0;char ch=getchar();
while(!isdigit(ch)) f|=(ch=='-'),ch=getchar();
while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
return f?-x:x;
}
void work()
{
n=read(),k=read(),p=read();
int mn=0;
for(int i=1;i<=n;i++)
{
int col=read(),cost=read();
if(cost<=p) mn=i;
if(mn>=last[col]) sum[col]=num[col];
last[col]=i;
ans+=sum[col];
num[col]++;
}
printf("%lld\n",ans);
}
}
int main()
{
TYC::work();
return 0;
}
|
896c046556087ceb2604351f3d027cd78c940e5d
|
5934b3a79d7a38f228394b1fbddcb57b74e7c700
|
/Thermometer/Thermometer.ino
|
8df03130467bfeedfbb55813f4b9aa946abc4659
|
[] |
no_license
|
MagedMilad/Arduino_workspace
|
7683c3066a004863ddd9ccd99faef0b4b1c6c8fe
|
a0019dc58fc3a172292ab0272a4b593e9dfd3bb6
|
refs/heads/master
| 2021-01-10T16:57:56.755306
| 2015-11-30T00:24:10
| 2015-11-30T00:24:10
| 43,764,972
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 587
|
ino
|
Thermometer.ino
|
/*
* function : trigger a warning sound and light if the temperature >28
* input : LM35
* output : a led and a buzzer
*/
const int sensor_pin = 14;
const int out_led = 13;
void setup() {
pinMode(out_led,OUTPUT);
Serial.begin(9600);
}
void loop() {
//read the current voltage at 10 bit resolution (0 to 1023)
int val = analogRead(sensor_pin);
//scale the value to temperature (10mV = 1 deg)
float temp = val / 1023.0 * 500;
Serial.println(temp);
if(temp > 28){
digitalWrite(out_led,HIGH);
}
else{
digitalWrite(out_led,LOW);
}
delay(500);
}
|
024517c343ef7010b70b8e5ca6f9e998f52f2b86
|
472b76a6c0a1832eba561702d28f37d32cb08f95
|
/src/set3.cpp
|
fde1895b8283e89106ca4ecde67c65614f97fc02
|
[] |
no_license
|
marysieek/novelty_detection
|
fd1dc87d58827845cf75038c996ebad14d7cdf1d
|
45492538d2f6a00fd5788e0d9ff1a3665c31345d
|
refs/heads/master
| 2021-01-13T09:25:48.827169
| 2016-05-31T08:01:21
| 2016-05-31T08:01:21
| 53,409,812
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 11,970
|
cpp
|
set3.cpp
|
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace std;
using namespace cv;
const int LOW_THRESHOLD = 25;
const int THRESH_RATIO = 3;
const int CANNY_KERNEL_SIZE = 3;
const int BLUR_KERNEL_SIZE = 4;
const float ROUNDNESS_LIMIT_MARGIN = 0.05;
const float ROUNDNESS_PASS_LIMIT = 0.80;
const int HUE_HIST_BINS = 23;
const float HUE_HIST_MIN_CORREL = 0.87;
const int HUE_HIST_MIN_MATCHES = 6;
const float WEIGHT_ROUNDNESS = 0.2;
const float WEIGHT_HUE_HIST = 0.8;
const int OBJECT_TYPES = 6;
typedef struct {
string fileName;
double roundness;
bool roundnessPass;
vector<double> hu;
Mat hueImage;
Mat hueHist;
bool hueHistPass;
float score;
vector<int> huLabels;
} ObjectData;
void sortFiles (vector<string> &names);
vector<ObjectData> analyzeImages (vector<string> &fileNames);
void compareRoundness(vector<ObjectData> training, vector<ObjectData> testing);
void compareHueHistograms(vector<ObjectData> training, vector<ObjectData> testing);
void prepareImageMats(Mat &colorImage, Mat &grayImage, Mat &contourImage);
void cleanContoursWithSigma(vector<Point> &points, double maxDistanceSigma);
void printData(ObjectData &data);
void calculateScore(ObjectData &data);
void clusterHuMoments(vector<ObjectData> &data);
int main(int argc, char **argv) {
// check argument
if (argc < 3) {
cerr << "No enough directories given" << endl;
exit(-1);
}
string trainingFilesPattern = string(argv[1]) + "/*.jpg";
string testFilesPattern = string(argv[2]) + "/*.jpg";
// load file names
vector<string> trainingFileNames, testingFileNames;
glob(trainingFilesPattern, trainingFileNames, false);
glob(testFilesPattern, testingFileNames, false);
// auto numberOfFiles = trainingFileNames.size();
// sortFiles(trainingFileNames);
sortFiles(testingFileNames);
// cout << "Found " << numberOfFiles << " files in " << argv[1] << endl;
namedWindow("COLOR");
namedWindow("GRAY");
namedWindow("CONTOUR");
namedWindow("HUE");
auto trainingData = analyzeImages(trainingFileNames);
auto testingData = analyzeImages(testingFileNames);
// clusterHuMoments(trainingData);
compareRoundness(trainingData, testingData);
compareHueHistograms(trainingData, testingData);
// for (auto object : testingData) {
// calculateScore(object);
// cout << "File: " << object.fileName << endl;
// cout << "\tScore: " << object.score << endl;
// }
exit(0);
}
vector<ObjectData> analyzeImages (vector<string> &fileNames) {
vector<ObjectData> dataBuffer;
for (auto file : fileNames) {
// cout << endl << "Analyzing file: " << file << endl;
Mat colorImage = imread(file.c_str(), CV_LOAD_IMAGE_COLOR);
Mat grayImage, contourImage;
ObjectData data;
data.fileName = file;
// get grayscale and contours
prepareImageMats(colorImage, grayImage, contourImage);
// clean from distant noise
vector<Point> contourPoints;
findNonZero(contourImage, contourPoints);
cleanContoursWithSigma(contourPoints, 2.0);
// limit image to the object
auto boundingBox = boundingRect(contourPoints);
colorImage = Mat(colorImage, boundingBox);
grayImage = Mat(grayImage, boundingBox);
contourImage = Mat(contourImage, boundingBox);
// calculate shape coefficients
vector<Point> hull;
convexHull(contourPoints, hull);
auto area = contourArea(hull);
Point2f circleCenter;
float circleRadius;
minEnclosingCircle(hull, circleCenter, circleRadius);
data.roundness = sqrt(area / (M_PI * pow(circleRadius, 2)));
// calculate contour moments
Moments mu = moments(contourPoints, true);
HuMoments(mu, data.hu);
// calculate hue histograms
Mat hsvImage;
Mat hsvPlanes[3];
cvtColor(colorImage, hsvImage, CV_BGR2HSV);
split(hsvImage, hsvPlanes);
data.hueImage = hsvPlanes[0];
int hueHistSize = HUE_HIST_BINS;
float range [] = {0, 180};
const float *hueHistRange = range;
calcHist(&data.hueImage, 1, 0, Mat(), data.hueHist, 1, &hueHistSize, &hueHistRange, 1, 0);
normalize(data.hueHist, data.hueHist, 0, 1, NORM_MINMAX, -1, Mat());
// debug print
imshow("COLOR", colorImage);
imshow("GRAY", grayImage);
imshow("CONTOUR", contourImage);
imshow("HUE", data.hueImage);
// printData(data);
// backlog data
dataBuffer.push_back(data);
// waitKey(0);
// break;
}
return dataBuffer;
}
void sortFiles (vector<string> &names){
sort (names.begin(), names.end(), [](std::string s1, std::string s2) {
// cout << s1.substr(s1.find_last_of("/") + 1, s1.find_last_of(".")) << endl;
auto number1 = std::stoi(s1.substr(s1.find_last_of("/") + 1, s1.find_last_of(".")));
auto number2 = std::stoi(s2.substr(s2.find_last_of("/") + 1, s2.find_last_of(".")));
return number1 < number2;
});
}
// void clusterHuMoments(vector<ObjectData> &data) {
// const int m = 1;
// vector<Point2f> hu0Samples(data.size());
// transform(
// data.begin(),
// data.end(),
// hu0Samples.begin(),
// [m](ObjectData &object) {
// return Point2f(object.hu[m], 0);
// });
// double eps = accumulate(hu0Samples.begin(), hu0Samples.end(), Point2f(0.0, 0.0)).x / hu0Samples.size() * 0.000001;
// cout << "K-means epsilon: " << eps << endl;
// vector<int> huLabels;
// kmeans(hu0Samples, OBJECT_TYPES, huLabels, TermCriteria(2, 1000, eps), 1, KMEANS_RANDOM_CENTERS);
// cout << "Samples: " << hu0Samples.size() << endl;
// cout << "huLabels: " << huLabels.size() << endl;
// cout << "data: " << data.size() << endl;
// for(unsigned i = 0; i < data.size(); i++) {
// data[i].huLabels.push_back(huLabels[i]);
// cout << huLabels[i];
// }
// cout << endl;
// }
void compareRoundness(vector<ObjectData> training, vector<ObjectData> testing) {
// cout << "Roundness tests" << endl;
double minRoundness = min_element(
training.begin(),
training.end(),
[](ObjectData o1, ObjectData o2) {
return o1.roundness < o2.roundness;
})->roundness;
unsigned passed = 0;
unsigned failed = 0;
// cout << "\tminimal roundness found in training: " << minRoundness << endl;
minRoundness *= 1.0 - ROUNDNESS_LIMIT_MARGIN;
// cout << "\troundness lower limit for pass: " << minRoundness << endl;
for (auto object : testing) {
if (object.roundness > minRoundness) {
passed++;
object.roundnessPass = true;
} else {
failed++;
object.roundnessPass = false;
}
}
// cout << "passed : " << passed << endl;
// cout << "failed : " << failed << endl;
}
void compareHueHistograms(vector<ObjectData> training, vector<ObjectData> testing) {
// cout << "Hue histogram tests" << endl;
int passed = 0;
int failed = 0;
for (auto testObject : testing) {
int matches = 0;
for (auto trainingObject : training) {
auto comparisonResult = compareHist(testObject.hueHist, trainingObject.hueHist, CV_COMP_CORREL);
if (comparisonResult >= HUE_HIST_MIN_CORREL) {
matches++;
}
}
// cout << "File: " << testObject.fileName << endl;
// cout << "\tMatches : " << matches << endl;
if (matches >= HUE_HIST_MIN_MATCHES) {
passed++;
testObject.hueHistPass = true;
} else {
failed++;
testObject.hueHistPass = false;
}
auto fileNameOnly = testObject.fileName.substr(testObject.fileName.find_last_of('/')+1);
cout << fileNameOnly << "\t" << (int)(!testObject.hueHistPass) << endl;
}
// cout << "passed : " << passed << endl;
// cout << "failed : " << failed << endl;
}
void prepareImageMats(Mat &colorImage, Mat &grayImage, Mat &contourImage) {
cvtColor(colorImage, grayImage, CV_BGR2GRAY);
blur(grayImage, grayImage, Size(BLUR_KERNEL_SIZE, BLUR_KERNEL_SIZE));
morphologyEx(
grayImage, grayImage, MORPH_CLOSE,
getStructuringElement(
MORPH_ELLIPSE, Size(CANNY_KERNEL_SIZE + 2, CANNY_KERNEL_SIZE + 2)));
Canny(grayImage, contourImage, LOW_THRESHOLD, LOW_THRESHOLD * THRESH_RATIO,
CANNY_KERNEL_SIZE);
}
void cleanContoursWithSigma(vector<Point> &points, double maxDistanceSigma) {
// calculate mean
auto sum = std::accumulate(points.begin(), points.end(), Point(0, 0));
Point mean(sum.x / points.size(), sum.y / points.size());
// calculate distances
vector<double> pointDistances;
pointDistances.resize(points.size());
transform(points.begin(), points.end(), pointDistances.begin(),
[mean](Point &p) {
return norm(p - mean);
});
// calculate standard deviation
double stdDev =
sqrt(std::accumulate(pointDistances.begin(), pointDistances.end(), 0.0,
[](double x, double y) {
return x + y * y;
}) / pointDistances.size());
// cout << "sigma = " << stdDev << endl;
// clean
// cout << "points before: " << points.size() << endl;
points.erase(remove_if(points.begin(), points.end(),
[maxDistanceSigma, stdDev, mean](Point &p) {
return (norm(p - mean) > maxDistanceSigma * stdDev);
}),
points.end());
// cout << "points after: " << points.size() << endl;
}
void printData(ObjectData &data) {
unsigned wsPad = 12;
auto printKey = [wsPad](string key) {
cout << setfill(' ') << setw(wsPad) << key << " : ";
};
cout << "ObjectData fields:" << endl;
printKey("filename");
cout << data.fileName << endl;
printKey("roundness");
cout << data.roundness << endl;
printKey("hu");
cout << "values:" << endl;
string huFill(' ', wsPad);
for (auto h : data.hu) {
printKey("");
cout << h << endl;
}
}
void calculateScore(ObjectData &data) {
data.score = WEIGHT_ROUNDNESS * (int)data.roundnessPass
+ WEIGHT_HUE_HIST * (int)data.hueHistPass;
}
|
77b8d8cd0cb58110ac1edbb66f4fd8165da340ea
|
29af718d33105bceddd488326e53dab24e1014ef
|
/Programming/Messages/demo_Messages_2.cpp
|
5963f0993979d3c8e6fc78f78c92fb9f90944f21
|
[] |
no_license
|
OKullmann/oklibrary
|
d0f422847f134705c0cd1eebf295434fe5ffe7ed
|
c578d0460c507f23b97329549a874aa0c0b0541b
|
refs/heads/master
| 2023-09-04T02:38:14.642785
| 2023-09-01T11:38:31
| 2023-09-01T11:38:31
| 38,629
| 21
| 64
| null | 2020-10-30T17:13:04
| 2008-07-30T18:20:06
|
C++
|
UTF-8
|
C++
| false
| false
| 2,996
|
cpp
|
demo_Messages_2.cpp
|
// Oliver Kullmann, 3.12.2006 (Swansea)
/* Copyright 2006 - 2007 Oliver Kullmann
This file is part of the OKlibrary. OKlibrary 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 and included in this library; either version 3 of the
License, or any later version. */
/*!
\file Programming/Messages/demo_Messages_2.cpp
\brief Further demonstration of basic usage of Messages-components
*/
#include <sstream>
#include <cassert>
#include <OKlib/Programming/Messages/MessagesMain.hpp>
namespace OKlib {
namespace Messages {
namespace demo {
OKLIB_USING_MESSAGES
/*!
\class Message_2
\brief Speaks english and german, both only in basic level.
*/
struct Message_2 : ::OKlib::Messages::MessagesBase {
OKLIB_MESSAGES_PRINT;
void print(std::ostream& out, L<en_GB>, S<Basic>) const {
out << "English basic";
}
void print(std::ostream& out, L<de_DE>, S<Basic>) const {
out << "Deutsch einfach"; // "German basic"
}
};
}
}
}
int main() {
using namespace OKlib;
std::stringstream out;
const Messages::demo::Message_2 m;
assert(Messages::MessagesBase::language(out) == Messages::en_GB);
assert(Messages::MessagesBase::level(out) == Messages::Basic);
out << m;
assert(out.str() == "English basic");
out.str("");
Messages::MessagesBase::set(out, Messages::Full);
assert(Messages::MessagesBase::level(out) == Messages::Full);
out << m;
assert(out.str() == "English basic");
out.str("");
Messages::MessagesBase::set(out, Messages::Extensive);
assert(Messages::MessagesBase::level(out) == Messages::Extensive);
out <<m;
assert(out.str() == "English basic");
out.str("");
Messages::MessagesBase::set(out, Messages::de_DE);
assert(Messages::MessagesBase::language(out) == Messages::de_DE);
out << m;
assert(out.str() == "Deutsch einfach");
out.str("");
Messages::MessagesBase::set(out, Messages::Full);
assert(Messages::MessagesBase::level(out) == Messages::Full);
out << m;
assert(out.str() == "Deutsch einfach");
out.str("");
Messages::MessagesBase::set(out, Messages::Basic);
assert(Messages::MessagesBase::level(out) == Messages::Basic);
out << m;
assert(out.str() == "Deutsch einfach");
out.str("");
Messages::MessagesBase::set(out, Messages::fr_FR); // french as in France
assert(Messages::MessagesBase::language(out) == Messages::fr_FR);
out << m;
assert(out.str() == "English basic");
out.str("");
Messages::MessagesBase::set(out, Messages::Full);
assert(Messages::MessagesBase::level(out) == Messages::Full);
out << m;
assert(out.str() == "English basic");
out.str("");
Messages::MessagesBase::set(out, Messages::de_AT); // german as in Austria
assert(Messages::MessagesBase::language(out) == Messages::de_AT);
out << m;
assert(out.str() == "Deutsch einfach");
}
|
94612553483ed0bd885b3c25de6647305f168e0f
|
6006085975601a021ba2177071b286c1225ece6a
|
/TextureManager.cpp
|
39d62cc120e2158aba2d7366d2a59b6d32d35180
|
[] |
no_license
|
RyanSwann1/PongSDL2
|
d5d1967bf34e45019c5ef1d67ee10ca1b11c9c33
|
b580d184487e1b6b061ad310496776d0bc24de5c
|
refs/heads/master
| 2021-01-01T04:46:12.203125
| 2016-04-16T13:29:36
| 2016-04-16T13:29:36
| 56,355,527
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,903
|
cpp
|
TextureManager.cpp
|
#include "TextureManager.h"
#include "Game.h"
#include <assert.h>
#include <iostream>
//Static variable shared across all instances of TextureManager#
// Javawag: and with those, you write e.g. static Game *m_instance;
// Javawag: and then you have to put it in the cpp too i.e.Game *Game::m_instance;
//Javawag: and the = nullptr is just setting a default value, if you didnt do that it would be a random number (i.e. invalid pointer)
TextureManager * TextureManager::m_instance = nullptr;
TextureManager::TextureManager()
{
}
TextureManager::~TextureManager()
{
}
//
//TextureManager * TextureManager::instance()
//{
// if (m_pInstance == nullptr) {
// m_pInstance = new TextureManager();
// }
//
// return m_pInstance;
//}
TextureManager * TextureManager::instance()
{
if (m_instance == nullptr) {
m_instance = new TextureManager();
}
return m_instance;
}
void TextureManager::load(std::string ID, std::string path)
{
//Load surface
SDL_Surface* surface = SDL_LoadBMP(path.c_str());
assert(surface != nullptr);
//Optimize said surface
SDL_Surface* optimizedSurface = SDL_ConvertSurface(surface, Game::instance()->getWindowSurface()->format, 0);
assert(optimizedSurface != nullptr);
//Convert surface into texture
SDL_Texture* texture = SDL_CreateTextureFromSurface(Game::instance()->getRenderer(), optimizedSurface);
//Free the surface
SDL_FreeSurface(surface);
if (texture != nullptr) {
m_textures[ID] = texture;
return;
}
}
void TextureManager::draw(int x, int y, int width, int height, SDL_Renderer * renderer, std::string ID)
{
SDL_Rect srcRect;
SDL_Rect destRect;
srcRect.x = 0;
srcRect.y = 0;
srcRect.w = destRect.w = width;
srcRect.h = destRect.h = height;
destRect.x = x;
destRect.y = y;
SDL_RenderCopy(Game::instance()->getRenderer(), m_textures[ID], &srcRect, &destRect);
}
|
0a7b99617775e603f793fe5209ac264119924e0d
|
ec279049433115b5a063b44b40ea413afb8066f0
|
/NDIcontrol.h
|
3e939e46f42db39df76fd53a630e4cd645e75b97
|
[
"CC0-1.0"
] |
permissive
|
iamyila/NST
|
c3971cb1905886cb7e168ad978a644294a48c09f
|
d06f61767ec1061b02462f6f5d021dea044285b0
|
refs/heads/master
| 2023-01-07T13:07:27.318186
| 2020-06-12T17:10:33
| 2020-06-12T17:10:33
| 269,730,327
| 6
| 1
|
CC0-1.0
| 2020-06-14T20:06:10
| 2020-06-05T18:05:05
|
C++
|
UTF-8
|
C++
| false
| false
| 825
|
h
|
NDIcontrol.h
|
/*
* NDIcontrol.h
*
* Created on: 11/07/2012
* Author: Sebastian Frisch
*/
#ifndef NDIcontrol_H_
#define NDIcontrol_H_
#include "ofParameterGroup.h"
#include "ofParameter.h"
#include "ofMain.h"
class NDIcontrol;
template<typename ParameterType>
class ofNDIcontrolParam: public ofReadOnlyParameter<ParameterType,NDIcontrol>{
friend class NDIcontrol;
};
class NDIcontrol {
public:
NDIcontrol();
void setup(string name);
void draw();
ofParameterGroup parameters;
ofParameter<bool> showNDI;
ofParameter<bool> bgTeachnique;
ofParameter<int> bgThreshold;
ofParameter<bool> ndiOut;
ofParameter<bool> audienceFlip;
ofParameter<int> minBlobSize;
ofParameter<int> maxBlobSize;
ofParameter<int> frameCounterBGSet;
};
#endif /* NDIcontrol_H_ */
|
35eff7341ace5087b7b2403244d98ca026f1128a
|
a936b02de6a9f6dc568bb1569eba322fc19f99ec
|
/main.cpp
|
97f280445e79666c6eb80b2cea6fda7f2a7a6880
|
[] |
no_license
|
AhmedBenyahia/24h-Challenge-Tunirobots2017
|
2126fcb8d488de543861be956a5f11f3acfc08b8
|
77b41ac5a9f47799e8c7fe1032dae51159f0bd7a
|
refs/heads/master
| 2021-09-24T01:58:22.679324
| 2017-05-27T08:18:59
| 2017-05-27T08:18:59
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,026
|
cpp
|
main.cpp
|
#include "mbed.h"
#include "HCSR04.h"
#define DIS_NUM 30
//Serial
Serial bluetooth(PE_1,PE_0);//Tx Rx
Serial pc(USBTX,USBRX);
//Def des object
//Def des pin Moteur
//MA
PwmOut LMF(PD_15);
PwmOut LMB(PD_14);
//MB
PwmOut RMF(PD_13);
PwmOut RMB(PD_12);
// Enable
//DigitalOut ENA(PG_13) ;
//DigitalOut ENB(PA_14) ;
//Def des pin des capteur
//Eltra Sond Sonsor
//HCSR04 ES(PC_1, PC_2);
//Scrotche Sonsor
// AnalogIn RS_S(PB_0);
//AnalogIn LS_S(PB_1);
//Line Sonsor
AnalogIn LS_L(PA_3);
AnalogIn MS_L(PA_5);
AnalogIn RS_L(PA_7);
//Number Soonsor
AnalogIn FS_N(PF_9);
AnalogIn AS_N(PF_10);
AnalogIn ES_N(PF_7);
//Def Autre
//Diode
DigitalOut LED(PG_14);
//Global varible
int ScR = 0 ;
int ScL = 0 ;
float RMS=0.36f ; //0.5f
float LMS=0.5f ; //0.3f
char c ;
int S_S = 200 ;
int S_S2 = 700 ;
//Protytype function
int getSValue(AnalogIn,int);
void Forward();
void Back();
void Left();
void Right();
void Stop();
void Power_Right();
void Power_Left();
int main (){
//setup
LED = 0 ;
wait(1.0f);
//Bluetooth setup
bluetooth.baud(9600);
puts("Hi!");
//Partie A : Line Follower
while(1){
int N_SF = getSValue(FS_N,S_S2);
int N_SA = getSValue(AS_N,S_S2);
int N_SE = getSValue(ES_N,S_S2);
puts("***");
printf("%d %d %d",N_SF,N_SE,N_SA);
wait(0.5f);
//line Sensor : Detect line
int L_SM = getSValue(MS_L,S_S);
int L_SL = getSValue(LS_L,S_S);
int L_SR = getSValue(RS_L,S_S);
//if(L_SL && !ScL && L_SM) ScL = 1 ;
//else if(L_SR && !ScR && L_SM) ScR = 1 ;
if(L_SL){ Left(); }
else if (L_SR){ Right(); }
else if(!L_SM && !L_SL && !L_SR) break;
else Forward();
wait(0.2f);
}
//Partie B :
RMS = 0.4f;
LMS = 0.5f;
while(1){
c = 'S' ;
if(bluetooth.readable())
c = bluetooth.getc();
printf("%c ",c);
LED = !LED ;
//int SR = RMS ,SL = LMS;
switch(c){
case 'S' :
Stop();
break;
case 'B' :
Forward();
puts("Back");
break;
case 'F' :
Back();
break;
case 'L' :
Left();
break;
case 'R' :
Right();
break;
}
wait_us(100000);
}
}
//Def des function
//Sensor Function
int getSValue( AnalogIn s, int min){
float meas = s.read(); // Converts and read the analog input value (value from 0.0 to 1.0)
meas = meas * 1023; // Change the value to be in the 0 to 3300 range
printf("|%.0f|", meas);
if(meas > min)return 1;
return 0;
}
//Motor fuction
void Forward(){
RMF = RMS ;
RMB = 0.0f ;
LMF = LMS ;
LMB = 0.0f ;
}
void Back(){
RMF = 0.0f ;
RMB = RMS ;
LMF = 0.0f ;
LMB = LMS ;
}
void Left(){
RMF = RMS ;
RMB = 0.0f ;
LMF = 0.0f ;
LMB = 0.0f ;
ScR = 0 ;
ScL = 0 ;
}
void Right(){
RMF = 0.0f ;
RMB = 0.0f ;
LMF = LMS ;
LMB = 0.0f ;
ScR = 0 ;
ScL = 0 ;
}
void Power_Left(){
RMF = RMS ;
RMB = 0.0f ;
LMF = 0.0f ;
LMB = LMS ;
ScR = 0 ;
ScL = 0 ;
}
void Power_Right(){
RMF = 0.0f ;
RMB = RMS ;
LMF = LMS ;
LMB = 0.0f ;
ScR = 0 ;
ScL = 0 ;
}
void Stop(){
RMF = 0.0f ;
RMB = 0.0f ;
LMF = 0.0f ;
LMB = 0.0f ;
}
|
a33e52e9034a2c1538d0c68bad5c85d00c3fcd9b
|
ba251d54fac8c3aa8a7f450105bc4f27d94a77f9
|
/src/graphics/graphicsresourcefactory.h
|
11e4381b244beb91737979feff1d6cdba9a4254c
|
[] |
no_license
|
JakeClarke/phrix
|
8c365cfae70968edecde8402dafabe24c5a1cdb7
|
05de30ec8e0c23b0f5deb93e1a2e671c22830aef
|
refs/heads/master
| 2016-08-12T20:40:11.547281
| 2015-12-08T13:55:29
| 2015-12-08T13:55:29
| 45,746,530
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 661
|
h
|
graphicsresourcefactory.h
|
#ifndef _H_PHRIX_GRAPHICS_GRAPHICSRESOURCEFACTORY
#define _H_PHRIX_GRAPHICS_GRAPHICSRESOURCEFACTORY
#include "texture2d.h"
#include "rendertexture2d.h"
#include "pixelshader.h"
#include "vertexshader.h"
#include <memory>
namespace phrix {
namespace graphics {
class GraphicsResourceFactory {
virtual std::unique_ptr<Texture2D> makeTexture2D(int width, int height) = 0;
virtual std::unique_ptr<RenderTexture2D> makeRenderTexture2D(int width, int height) = 0;
virtual std::unique_ptr<VertexShader> makeVertexShader() = 0;
virtual std::unique_ptr<PixelShader> makePixelShader() = 0;
};
}
}
#endif // !_H_PHRIX_GRAPHICS_GRAPHICSRESOURCEFACTORY
|
9c9162dbef8c5ef521718c68b242d1c3c9097f5d
|
aea72583d026e29ad8970db5b6c4535bcc52cfe5
|
/src/Lzui/UIImage.cpp
|
c209d3482af45569a3f24f6bbc18c2d5f3945a20
|
[] |
no_license
|
youlanhai/Lazy3D
|
ed2e428fd94efc5e73b7f0d42189ca8afda8f04e
|
a00c02594f42e81ad9fe6ef133c6e82dc166c834
|
refs/heads/master
| 2021-07-08T23:21:09.940640
| 2017-10-05T06:25:50
| 2017-10-05T06:25:50
| 105,855,410
| 3
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,110
|
cpp
|
UIImage.cpp
|
#include "stdafx.h"
#include "UIImage.h"
namespace Lazy
{
Image::Image()
: m_color(0xffffffff)
{
}
Image::~Image(void)
{
}
void Image::create(
const tstring &image,
int x,
int y,
int w,
int h)
{
setPosition(x, y);
setSize(w, h);
setImage(image);
}
void Image::render(IUIRender * pDevice)
{
CRect rc = getGlobalRect();
pDevice->drawRect(rc, m_color, m_texture);
Widget::render(pDevice);
}
void Image::setImage(const tstring & image)
{
m_image = image;
m_texture = TextureMgr::instance()->get(m_image);
}
bool Image::setProperty(LZDataPtr config, const tstring & key, LZDataPtr val)
{
if (key == L"image")
setImage(val->asString());
else if (key == L"color")
setColor(val->asHex());
else
return Widget::setProperty(config, key, val);
return true;
}
//////////////////////////////////////////////////////////////////////////
}//namespace Lazy
|
5bf79ae9fdbec603e0a62ca6ce1f10fa96624c3b
|
97bbfb3d6c95cbe8f09c31a5b41b2bc6afc969e8
|
/pd/stompbox/from-faust/graphic_eq.cpp
|
02582dc0ff5df1759ff031f476b183250135dec6
|
[] |
no_license
|
eberdahl/Satellite-CCRMA-Userland-Scripts-And-Examples-Ubuntu
|
4bada1859c98c71b122fd604f510d5d8b45000b4
|
feed858b5eeadecc129daa6a3c6aebb947b6d590
|
refs/heads/master
| 2020-03-29T21:40:25.379922
| 2016-01-21T08:55:14
| 2016-01-21T08:55:14
| 15,482,029
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 145,726
|
cpp
|
graphic_eq.cpp
|
//-----------------------------------------------------
//
// Code generated with Faust 0.9.58 (http://faust.grame.fr)
//-----------------------------------------------------
/* link with */
#include <math.h>
#include <cmath>
template <int N> inline float faustpower(float x) { return powf(x,N); }
template <int N> inline double faustpower(double x) { return pow(x,N); }
template <int N> inline int faustpower(int x) { return faustpower<N/2>(x) * faustpower<N-N/2>(x); }
template <> inline int faustpower<0>(int x) { return 1; }
template <> inline int faustpower<1>(int x) { return x; }
/************************************************************************
************************************************************************
FAUST Architecture File
Copyright (C) 2006-2011 Albert Graef <Dr.Graef@t-online.de>
---------------------------------------------------------------------
This program 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 program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
************************************************************************
************************************************************************/
/* Pd architecture file, written by Albert Graef <Dr.Graef@t-online.de>.
This was derived from minimal.cpp included in the Faust distribution.
Please note that this is to be compiled as a shared library, which is
then loaded dynamically by Pd as an external. */
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <string>
using namespace std;
// On Intel set FZ (Flush to Zero) and DAZ (Denormals Are Zero)
// flags to avoid costly denormals
#ifdef __SSE__
#include <xmmintrin.h>
#ifdef __SSE2__
#define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8040)
#else
#define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8000)
#endif
#else
#warning *** puredata.cpp: NO SSE FLAG (denormals may slow things down) ***
#define AVOIDDENORMALS
#endif
struct Meta
{
void declare (const char* key, const char* value) {}
};
// abs is now predefined
//template<typename T> T abs (T a) { return (a<T(0)) ? -a : a; }
inline int lsr (int x, int n) { return int(((unsigned int)x) >> n); }
/******************************************************************************
*******************************************************************************
VECTOR INTRINSICS
*******************************************************************************
*******************************************************************************/
//inline void *aligned_calloc(size_t nmemb, size_t size) { return (void*)((unsigned)(calloc((nmemb*size)+15,sizeof(char)))+15 & 0xfffffff0); }
//inline void *aligned_calloc(size_t nmemb, size_t size) { return (void*)((size_t)(calloc((nmemb*size)+15,sizeof(char)))+15 & ~15); }
/******************************************************************************
*******************************************************************************
ABSTRACT USER INTERFACE
*******************************************************************************
*******************************************************************************/
class UI
{
bool fStopped;
public:
UI() : fStopped(false) {}
virtual ~UI() {}
virtual void addButton(const char* label, float* zone) = 0;
virtual void addCheckButton(const char* label, float* zone) = 0;
virtual void addVerticalSlider(const char* label, float* zone, float init, float min, float max, float step) = 0;
virtual void addHorizontalSlider(const char* label, float* zone, float init, float min, float max, float step) = 0;
virtual void addNumEntry(const char* label, float* zone, float init, float min, float max, float step) = 0;
virtual void addHorizontalBargraph(const char* label, float* zone, float min, float max) = 0;
virtual void addVerticalBargraph(const char* label, float* zone, float min, float max) = 0;
virtual void openTabBox(const char* label) = 0;
virtual void openHorizontalBox(const char* label) = 0;
virtual void openVerticalBox(const char* label) = 0;
virtual void closeBox() = 0;
virtual void run() = 0;
void stop() { fStopped = true; }
bool stopped() { return fStopped; }
virtual void declare(float* zone, const char* key, const char* value) {}
};
/***************************************************************************
Pd UI interface
***************************************************************************/
enum ui_elem_type_t {
UI_BUTTON, UI_CHECK_BUTTON,
UI_V_SLIDER, UI_H_SLIDER, UI_NUM_ENTRY,
UI_V_BARGRAPH, UI_H_BARGRAPH,
UI_END_GROUP, UI_V_GROUP, UI_H_GROUP, UI_T_GROUP
};
struct ui_elem_t {
ui_elem_type_t type;
char *label;
float *zone;
float init, min, max, step;
};
class PdUI : public UI
{
public:
int nelems;
ui_elem_t *elems;
PdUI();
PdUI(const char *s);
virtual ~PdUI();
protected:
string path;
void add_elem(ui_elem_type_t type, const char *label = NULL);
void add_elem(ui_elem_type_t type, const char *label, float *zone);
void add_elem(ui_elem_type_t type, const char *label, float *zone,
float init, float min, float max, float step);
void add_elem(ui_elem_type_t type, const char *label, float *zone,
float min, float max);
public:
virtual void addButton(const char* label, float* zone);
virtual void addCheckButton(const char* label, float* zone);
virtual void addVerticalSlider(const char* label, float* zone, float init, float min, float max, float step);
virtual void addHorizontalSlider(const char* label, float* zone, float init, float min, float max, float step);
virtual void addNumEntry(const char* label, float* zone, float init, float min, float max, float step);
virtual void addHorizontalBargraph(const char* label, float* zone, float min, float max);
virtual void addVerticalBargraph(const char* label, float* zone, float min, float max);
virtual void openTabBox(const char* label);
virtual void openHorizontalBox(const char* label);
virtual void openVerticalBox(const char* label);
virtual void closeBox();
virtual void run();
};
static string mangle(const char *s)
{
const char *s0 = s;
string t = "";
if (!s) return t;
while (*s)
if (isalnum(*s))
t += *(s++);
else {
const char *s1 = s;
while (*s && !isalnum(*s)) ++s;
if (s1 != s0 && *s) t += "-";
}
return t;
}
static string normpath(string path)
{
path = string("/")+path;
int pos = path.find("//");
while (pos >= 0) {
path.erase(pos, 1);
pos = path.find("//");
}
return path;
}
static string pathcat(string path, string label)
{
if (path.empty())
return normpath(label);
else if (label.empty())
return normpath(path);
else
return normpath(path+"/"+label);
}
PdUI::PdUI()
{
nelems = 0;
elems = NULL;
path = "";
}
PdUI::PdUI(const char *s)
{
nelems = 0;
elems = NULL;
path = s?s:"";
}
PdUI::~PdUI()
{
if (elems) {
for (int i = 0; i < nelems; i++)
if (elems[i].label)
free(elems[i].label);
free(elems);
}
}
inline void PdUI::add_elem(ui_elem_type_t type, const char *label)
{
ui_elem_t *elems1 = (ui_elem_t*)realloc(elems, (nelems+1)*sizeof(ui_elem_t));
if (elems1)
elems = elems1;
else
return;
string s = pathcat(path, mangle(label));
elems[nelems].type = type;
elems[nelems].label = strdup(s.c_str());
elems[nelems].zone = NULL;
elems[nelems].init = 0.0;
elems[nelems].min = 0.0;
elems[nelems].max = 0.0;
elems[nelems].step = 0.0;
nelems++;
}
inline void PdUI::add_elem(ui_elem_type_t type, const char *label, float *zone)
{
ui_elem_t *elems1 = (ui_elem_t*)realloc(elems, (nelems+1)*sizeof(ui_elem_t));
if (elems1)
elems = elems1;
else
return;
string s = pathcat(path, mangle(label));
elems[nelems].type = type;
elems[nelems].label = strdup(s.c_str());
elems[nelems].zone = zone;
elems[nelems].init = 0.0;
elems[nelems].min = 0.0;
elems[nelems].max = 1.0;
elems[nelems].step = 1.0;
nelems++;
}
inline void PdUI::add_elem(ui_elem_type_t type, const char *label, float *zone,
float init, float min, float max, float step)
{
ui_elem_t *elems1 = (ui_elem_t*)realloc(elems, (nelems+1)*sizeof(ui_elem_t));
if (elems1)
elems = elems1;
else
return;
string s = pathcat(path, mangle(label));
elems[nelems].type = type;
elems[nelems].label = strdup(s.c_str());
elems[nelems].zone = zone;
elems[nelems].init = init;
elems[nelems].min = min;
elems[nelems].max = max;
elems[nelems].step = step;
nelems++;
}
inline void PdUI::add_elem(ui_elem_type_t type, const char *label, float *zone,
float min, float max)
{
ui_elem_t *elems1 = (ui_elem_t*)realloc(elems, (nelems+1)*sizeof(ui_elem_t));
if (elems1)
elems = elems1;
else
return;
string s = pathcat(path, mangle(label));
elems[nelems].type = type;
elems[nelems].label = strdup(s.c_str());
elems[nelems].zone = zone;
elems[nelems].init = 0.0;
elems[nelems].min = min;
elems[nelems].max = max;
elems[nelems].step = 0.0;
nelems++;
}
void PdUI::addButton(const char* label, float* zone)
{ add_elem(UI_BUTTON, label, zone); }
void PdUI::addCheckButton(const char* label, float* zone)
{ add_elem(UI_CHECK_BUTTON, label, zone); }
void PdUI::addVerticalSlider(const char* label, float* zone, float init, float min, float max, float step)
{ add_elem(UI_V_SLIDER, label, zone, init, min, max, step); }
void PdUI::addHorizontalSlider(const char* label, float* zone, float init, float min, float max, float step)
{ add_elem(UI_H_SLIDER, label, zone, init, min, max, step); }
void PdUI::addNumEntry(const char* label, float* zone, float init, float min, float max, float step)
{ add_elem(UI_NUM_ENTRY, label, zone, init, min, max, step); }
void PdUI::addHorizontalBargraph(const char* label, float* zone, float min, float max)
{ add_elem(UI_H_BARGRAPH, label, zone, min, max); }
void PdUI::addVerticalBargraph(const char* label, float* zone, float min, float max)
{ add_elem(UI_V_BARGRAPH, label, zone, min, max); }
void PdUI::openTabBox(const char* label)
{
if (!path.empty()) path += "/";
path += mangle(label);
}
void PdUI::openHorizontalBox(const char* label)
{
if (!path.empty()) path += "/";
path += mangle(label);
}
void PdUI::openVerticalBox(const char* label)
{
if (!path.empty()) path += "/";
path += mangle(label);
}
void PdUI::closeBox()
{
int pos = path.rfind("/");
if (pos < 0) pos = 0;
path.erase(pos);
}
void PdUI::run() {}
/******************************************************************************
*******************************************************************************
FAUST DSP
*******************************************************************************
*******************************************************************************/
//----------------------------------------------------------------
// abstract definition of a signal processor
//----------------------------------------------------------------
class dsp {
protected:
int fSamplingFreq;
public:
dsp() {}
virtual ~dsp() {}
virtual int getNumInputs() = 0;
virtual int getNumOutputs() = 0;
virtual void buildUserInterface(UI* interface) = 0;
virtual void init(int samplingRate) = 0;
virtual void compute(int len, float** inputs, float** outputs) = 0;
};
//----------------------------------------------------------------------------
// FAUST generated signal processor
//----------------------------------------------------------------------------
#ifndef FAUSTFLOAT
#define FAUSTFLOAT float
#endif
typedef long double quad;
#ifndef FAUSTCLASS
#define FAUSTCLASS mydsp
#endif
class mydsp : public dsp {
private:
FAUSTFLOAT fslider0;
int iConst0;
float fConst1;
FAUSTFLOAT fslider1;
float fConst2;
float fConst3;
float fConst4;
float fConst5;
float fConst6;
float fConst7;
float fConst8;
float fConst9;
float fConst10;
float fConst11;
float fConst12;
float fConst13;
FAUSTFLOAT fcheckbox0;
FAUSTFLOAT fslider2;
float fRec4[2];
FAUSTFLOAT fcheckbox1;
FAUSTFLOAT fcheckbox2;
int iRec6[2];
float fRec5[4];
float fConst14;
float fVec0[2];
float fConst15;
float fConst16;
FAUSTFLOAT fslider3;
FAUSTFLOAT fslider4;
float fRec7[2];
float fRec8[2];
float fVec1[2];
FAUSTFLOAT fslider5;
float fRec9[2];
float fVec2[2];
FAUSTFLOAT fslider6;
float fRec10[2];
float fVec3[2];
float fConst17;
float fConst18;
float fConst19;
float fConst20;
float fConst21;
float fConst22;
float fConst23;
float fVec4[2];
float fConst24;
float fRec21[2];
float fConst25;
float fConst26;
float fRec20[3];
float fConst27;
float fConst28;
float fRec19[3];
float fConst29;
float fConst30;
float fConst31;
float fConst32;
float fConst33;
float fConst34;
float fConst35;
float fRec18[3];
float fConst36;
float fConst37;
float fConst38;
float fConst39;
float fConst40;
float fConst41;
float fRec17[3];
float fConst42;
float fConst43;
float fConst44;
float fConst45;
float fConst46;
float fConst47;
float fConst48;
float fRec16[3];
float fConst49;
float fConst50;
float fConst51;
float fConst52;
float fConst53;
float fConst54;
float fRec15[3];
float fConst55;
float fConst56;
float fConst57;
float fConst58;
float fConst59;
float fConst60;
float fConst61;
float fRec14[3];
float fConst62;
float fConst63;
float fConst64;
float fConst65;
float fConst66;
float fConst67;
float fRec13[3];
float fConst68;
float fConst69;
float fConst70;
float fConst71;
float fConst72;
float fConst73;
float fConst74;
float fRec12[3];
float fConst75;
float fConst76;
float fConst77;
float fConst78;
float fConst79;
float fConst80;
float fRec11[3];
FAUSTFLOAT fslider7;
float fRec22[2];
float fConst81;
float fConst82;
float fConst83;
float fConst84;
float fConst85;
float fConst86;
float fRec35[2];
float fRec34[3];
float fRec33[3];
float fVec5[2];
float fConst87;
float fRec32[2];
float fConst88;
float fRec31[3];
float fConst89;
float fConst90;
float fRec30[3];
float fRec29[3];
float fRec28[3];
float fRec27[3];
float fRec26[3];
float fRec25[3];
float fRec24[3];
float fRec23[3];
FAUSTFLOAT fslider8;
float fRec36[2];
float fConst91;
float fConst92;
float fConst93;
float fConst94;
float fConst95;
float fConst96;
float fRec48[2];
float fRec47[3];
float fRec46[3];
float fVec6[2];
float fConst97;
float fRec45[2];
float fConst98;
float fRec44[3];
float fConst99;
float fConst100;
float fRec43[3];
float fRec42[3];
float fRec41[3];
float fRec40[3];
float fRec39[3];
float fRec38[3];
float fRec37[3];
FAUSTFLOAT fslider9;
float fRec49[2];
float fConst101;
float fConst102;
float fConst103;
float fConst104;
float fConst105;
float fConst106;
float fRec60[2];
float fRec59[3];
float fRec58[3];
float fVec7[2];
float fConst107;
float fRec57[2];
float fConst108;
float fRec56[3];
float fConst109;
float fConst110;
float fRec55[3];
float fRec54[3];
float fRec53[3];
float fRec52[3];
float fRec51[3];
float fRec50[3];
FAUSTFLOAT fslider10;
float fRec61[2];
float fConst111;
float fConst112;
float fConst113;
float fConst114;
float fConst115;
float fConst116;
float fRec71[2];
float fRec70[3];
float fRec69[3];
float fVec8[2];
float fConst117;
float fRec68[2];
float fConst118;
float fRec67[3];
float fConst119;
float fConst120;
float fRec66[3];
float fRec65[3];
float fRec64[3];
float fRec63[3];
float fRec62[3];
FAUSTFLOAT fslider11;
float fRec72[2];
float fConst121;
float fConst122;
float fConst123;
float fConst124;
float fConst125;
float fConst126;
float fRec81[2];
float fRec80[3];
float fRec79[3];
float fVec9[2];
float fConst127;
float fRec78[2];
float fConst128;
float fRec77[3];
float fConst129;
float fConst130;
float fRec76[3];
float fRec75[3];
float fRec74[3];
float fRec73[3];
FAUSTFLOAT fslider12;
float fRec82[2];
float fConst131;
float fConst132;
float fConst133;
float fConst134;
float fConst135;
float fConst136;
float fRec90[2];
float fRec89[3];
float fRec88[3];
float fVec10[2];
float fConst137;
float fRec87[2];
float fConst138;
float fRec86[3];
float fConst139;
float fConst140;
float fRec85[3];
float fRec84[3];
float fRec83[3];
FAUSTFLOAT fslider13;
float fRec91[2];
float fConst141;
float fConst142;
float fConst143;
float fConst144;
float fConst145;
float fConst146;
float fRec98[2];
float fRec97[3];
float fRec96[3];
float fVec11[2];
float fConst147;
float fRec95[2];
float fConst148;
float fRec94[3];
float fConst149;
float fConst150;
float fRec93[3];
float fRec92[3];
FAUSTFLOAT fslider14;
float fRec99[2];
float fConst151;
float fConst152;
float fConst153;
float fConst154;
float fConst155;
float fRec105[2];
float fRec104[3];
float fRec103[3];
float fVec12[2];
float fConst156;
float fRec102[2];
float fConst157;
float fRec101[3];
float fConst158;
float fConst159;
float fRec100[3];
FAUSTFLOAT fslider15;
float fRec106[2];
float fRec109[2];
float fRec108[3];
float fRec107[3];
FAUSTFLOAT fslider16;
float fRec110[2];
float fConst160;
float fConst161;
float fRec3[3];
float fConst162;
float fConst163;
float fConst164;
float fRec2[3];
float fConst165;
float fConst166;
float fConst167;
float fRec1[3];
float fConst168;
float fRec0[2];
FAUSTFLOAT fbargraph0;
float fConst169;
float fConst170;
float fConst171;
float fConst172;
float fConst173;
float fConst174;
float fConst175;
float fConst176;
float fConst177;
float fConst178;
float fConst179;
float fConst180;
float fConst181;
float fConst182;
float fConst183;
float fConst184;
float fConst185;
float fConst186;
float fConst187;
float fConst188;
float fConst189;
float fRec117[3];
float fConst190;
float fConst191;
float fConst192;
float fRec116[3];
float fConst193;
float fConst194;
float fConst195;
float fRec115[3];
float fConst196;
float fConst197;
float fConst198;
float fConst199;
float fRec114[3];
float fConst200;
float fConst201;
float fConst202;
float fRec113[3];
float fConst203;
float fConst204;
float fConst205;
float fRec112[3];
float fConst206;
float fRec111[2];
FAUSTFLOAT fbargraph1;
float fConst207;
float fConst208;
float fConst209;
float fConst210;
float fConst211;
float fConst212;
float fConst213;
float fConst214;
float fConst215;
float fConst216;
float fConst217;
float fConst218;
float fConst219;
float fConst220;
float fConst221;
float fConst222;
float fConst223;
float fConst224;
float fConst225;
float fConst226;
float fConst227;
float fRec124[3];
float fConst228;
float fConst229;
float fConst230;
float fRec123[3];
float fConst231;
float fConst232;
float fConst233;
float fRec122[3];
float fConst234;
float fConst235;
float fConst236;
float fConst237;
float fRec121[3];
float fConst238;
float fConst239;
float fConst240;
float fRec120[3];
float fConst241;
float fConst242;
float fConst243;
float fRec119[3];
float fConst244;
float fRec118[2];
FAUSTFLOAT fbargraph2;
float fConst245;
float fConst246;
float fConst247;
float fConst248;
float fConst249;
float fConst250;
float fConst251;
float fConst252;
float fConst253;
float fConst254;
float fConst255;
float fConst256;
float fConst257;
float fConst258;
float fConst259;
float fConst260;
float fConst261;
float fConst262;
float fRec131[3];
float fConst263;
float fConst264;
float fConst265;
float fRec130[3];
float fConst266;
float fConst267;
float fConst268;
float fRec129[3];
float fConst269;
float fConst270;
float fConst271;
float fRec128[3];
float fConst272;
float fConst273;
float fConst274;
float fRec127[3];
float fConst275;
float fConst276;
float fConst277;
float fRec126[3];
float fConst278;
float fRec125[2];
FAUSTFLOAT fbargraph3;
float fConst279;
float fConst280;
float fConst281;
float fConst282;
float fConst283;
float fConst284;
float fConst285;
float fConst286;
float fConst287;
float fConst288;
float fConst289;
float fConst290;
float fConst291;
float fConst292;
float fConst293;
float fConst294;
float fConst295;
float fConst296;
float fConst297;
float fConst298;
float fConst299;
float fRec138[3];
float fConst300;
float fConst301;
float fConst302;
float fRec137[3];
float fConst303;
float fConst304;
float fConst305;
float fRec136[3];
float fConst306;
float fConst307;
float fConst308;
float fConst309;
float fRec135[3];
float fConst310;
float fConst311;
float fConst312;
float fRec134[3];
float fConst313;
float fConst314;
float fConst315;
float fRec133[3];
float fConst316;
float fRec132[2];
FAUSTFLOAT fbargraph4;
float fConst317;
float fConst318;
float fConst319;
float fConst320;
float fConst321;
float fConst322;
float fConst323;
float fConst324;
float fConst325;
float fConst326;
float fConst327;
float fConst328;
float fConst329;
float fConst330;
float fConst331;
float fConst332;
float fConst333;
float fConst334;
float fConst335;
float fConst336;
float fConst337;
float fRec145[3];
float fConst338;
float fConst339;
float fConst340;
float fRec144[3];
float fConst341;
float fConst342;
float fConst343;
float fRec143[3];
float fConst344;
float fConst345;
float fConst346;
float fConst347;
float fRec142[3];
float fConst348;
float fConst349;
float fConst350;
float fRec141[3];
float fConst351;
float fConst352;
float fConst353;
float fRec140[3];
float fConst354;
float fRec139[2];
FAUSTFLOAT fbargraph5;
float fConst355;
float fConst356;
float fConst357;
float fConst358;
float fConst359;
float fConst360;
float fConst361;
float fConst362;
float fConst363;
float fConst364;
float fConst365;
float fConst366;
float fConst367;
float fConst368;
float fConst369;
float fConst370;
float fConst371;
float fConst372;
float fRec152[3];
float fConst373;
float fConst374;
float fConst375;
float fRec151[3];
float fConst376;
float fConst377;
float fConst378;
float fRec150[3];
float fConst379;
float fConst380;
float fConst381;
float fRec149[3];
float fConst382;
float fConst383;
float fConst384;
float fRec148[3];
float fConst385;
float fConst386;
float fConst387;
float fRec147[3];
float fConst388;
float fRec146[2];
FAUSTFLOAT fbargraph6;
float fConst389;
float fConst390;
float fConst391;
float fConst392;
float fConst393;
float fConst394;
float fConst395;
float fConst396;
float fConst397;
float fConst398;
float fConst399;
float fConst400;
float fConst401;
float fConst402;
float fConst403;
float fConst404;
float fConst405;
float fConst406;
float fConst407;
float fConst408;
float fConst409;
float fRec159[3];
float fConst410;
float fConst411;
float fConst412;
float fRec158[3];
float fConst413;
float fConst414;
float fConst415;
float fRec157[3];
float fConst416;
float fConst417;
float fConst418;
float fConst419;
float fRec156[3];
float fConst420;
float fConst421;
float fConst422;
float fRec155[3];
float fConst423;
float fConst424;
float fConst425;
float fRec154[3];
float fConst426;
float fRec153[2];
FAUSTFLOAT fbargraph7;
float fConst427;
float fConst428;
float fConst429;
float fConst430;
float fConst431;
float fConst432;
float fConst433;
float fConst434;
float fConst435;
float fConst436;
float fConst437;
float fConst438;
float fConst439;
float fConst440;
float fConst441;
float fConst442;
float fConst443;
float fConst444;
float fConst445;
float fConst446;
float fConst447;
float fRec166[3];
float fConst448;
float fConst449;
float fConst450;
float fRec165[3];
float fConst451;
float fConst452;
float fConst453;
float fRec164[3];
float fConst454;
float fConst455;
float fConst456;
float fConst457;
float fRec163[3];
float fConst458;
float fConst459;
float fConst460;
float fRec162[3];
float fConst461;
float fConst462;
float fConst463;
float fRec161[3];
float fConst464;
float fRec160[2];
FAUSTFLOAT fbargraph8;
float fConst465;
float fConst466;
float fConst467;
float fConst468;
float fConst469;
float fConst470;
float fConst471;
float fConst472;
float fConst473;
float fConst474;
float fConst475;
float fConst476;
float fConst477;
float fConst478;
float fConst479;
float fConst480;
float fConst481;
float fConst482;
float fRec173[3];
float fConst483;
float fConst484;
float fConst485;
float fRec172[3];
float fConst486;
float fConst487;
float fConst488;
float fRec171[3];
float fConst489;
float fConst490;
float fConst491;
float fRec170[3];
float fConst492;
float fConst493;
float fConst494;
float fRec169[3];
float fConst495;
float fConst496;
float fConst497;
float fRec168[3];
float fConst498;
float fRec167[2];
FAUSTFLOAT fbargraph9;
float fConst499;
float fConst500;
float fConst501;
float fConst502;
float fConst503;
float fConst504;
float fConst505;
float fConst506;
float fConst507;
float fConst508;
float fConst509;
float fConst510;
float fConst511;
float fConst512;
float fConst513;
float fConst514;
float fConst515;
float fConst516;
float fConst517;
float fConst518;
float fConst519;
float fRec180[3];
float fConst520;
float fConst521;
float fConst522;
float fRec179[3];
float fConst523;
float fConst524;
float fConst525;
float fRec178[3];
float fConst526;
float fConst527;
float fConst528;
float fConst529;
float fRec177[3];
float fConst530;
float fConst531;
float fConst532;
float fRec176[3];
float fConst533;
float fConst534;
float fConst535;
float fRec175[3];
float fConst536;
float fRec174[2];
FAUSTFLOAT fbargraph10;
float fConst537;
float fConst538;
float fConst539;
float fConst540;
float fConst541;
float fConst542;
float fConst543;
float fConst544;
float fConst545;
float fConst546;
float fConst547;
float fConst548;
float fConst549;
float fConst550;
float fConst551;
float fConst552;
float fConst553;
float fConst554;
float fConst555;
float fConst556;
float fConst557;
float fRec187[3];
float fConst558;
float fConst559;
float fConst560;
float fRec186[3];
float fConst561;
float fConst562;
float fConst563;
float fRec185[3];
float fConst564;
float fConst565;
float fConst566;
float fConst567;
float fRec184[3];
float fConst568;
float fConst569;
float fConst570;
float fRec183[3];
float fConst571;
float fConst572;
float fConst573;
float fRec182[3];
float fConst574;
float fRec181[2];
FAUSTFLOAT fbargraph11;
float fConst575;
float fConst576;
float fConst577;
float fConst578;
float fConst579;
float fConst580;
float fConst581;
float fConst582;
float fConst583;
float fConst584;
float fConst585;
float fConst586;
float fConst587;
float fConst588;
float fConst589;
float fConst590;
float fConst591;
float fConst592;
float fRec194[3];
float fConst593;
float fConst594;
float fConst595;
float fRec193[3];
float fConst596;
float fConst597;
float fConst598;
float fRec192[3];
float fConst599;
float fConst600;
float fConst601;
float fRec191[3];
float fConst602;
float fConst603;
float fConst604;
float fRec190[3];
float fConst605;
float fConst606;
float fConst607;
float fRec189[3];
float fConst608;
float fRec188[2];
FAUSTFLOAT fbargraph12;
float fConst609;
float fConst610;
float fConst611;
float fConst612;
float fConst613;
float fConst614;
float fConst615;
float fConst616;
float fConst617;
float fConst618;
float fConst619;
float fConst620;
float fConst621;
float fConst622;
float fConst623;
float fConst624;
float fConst625;
float fConst626;
float fConst627;
float fConst628;
float fConst629;
float fRec201[3];
float fConst630;
float fConst631;
float fConst632;
float fRec200[3];
float fConst633;
float fConst634;
float fConst635;
float fRec199[3];
float fConst636;
float fConst637;
float fConst638;
float fConst639;
float fRec198[3];
float fConst640;
float fConst641;
float fConst642;
float fRec197[3];
float fConst643;
float fConst644;
float fConst645;
float fRec196[3];
float fConst646;
float fRec195[2];
FAUSTFLOAT fbargraph13;
float fConst647;
float fConst648;
float fConst649;
float fConst650;
float fConst651;
float fConst652;
float fConst653;
float fConst654;
float fConst655;
float fRec205[3];
float fConst656;
float fConst657;
float fConst658;
float fRec204[3];
float fConst659;
float fConst660;
float fConst661;
float fRec203[3];
float fConst662;
float fRec202[2];
FAUSTFLOAT fbargraph14;
public:
static void metadata(Meta* m) {
m->declare("oscillator.lib/name", "Faust Oscillator Library");
m->declare("oscillator.lib/author", "Julius O. Smith (jos at ccrma.stanford.edu)");
m->declare("oscillator.lib/copyright", "Julius O. Smith III");
m->declare("oscillator.lib/version", "1.11");
m->declare("oscillator.lib/license", "STK-4.3");
m->declare("music.lib/name", "Music Library");
m->declare("music.lib/author", "GRAME");
m->declare("music.lib/copyright", "GRAME");
m->declare("music.lib/version", "1.0");
m->declare("music.lib/license", "LGPL with exception");
m->declare("math.lib/name", "Math Library");
m->declare("math.lib/author", "GRAME");
m->declare("math.lib/copyright", "GRAME");
m->declare("math.lib/version", "1.0");
m->declare("math.lib/license", "LGPL with exception");
m->declare("filter.lib/name", "Faust Filter Library");
m->declare("filter.lib/author", "Julius O. Smith (jos at ccrma.stanford.edu)");
m->declare("filter.lib/copyright", "Julius O. Smith III");
m->declare("filter.lib/version", "1.29");
m->declare("filter.lib/license", "STK-4.3");
m->declare("filter.lib/reference", "https://ccrma.stanford.edu/~jos/filters/");
m->declare("effect.lib/name", "Faust Audio Effect Library");
m->declare("effect.lib/author", "Julius O. Smith (jos at ccrma.stanford.edu)");
m->declare("effect.lib/copyright", "Julius O. Smith III");
m->declare("effect.lib/version", "1.33");
m->declare("effect.lib/license", "STK-4.3");
}
virtual int getNumInputs() { return 1; }
virtual int getNumOutputs() { return 2; }
static void classInit(int samplingFreq) {
}
virtual void instanceInit(int samplingFreq) {
fSamplingFreq = samplingFreq;
fslider0 = 5e+01f;
iConst0 = min(192000, max(1, fSamplingFreq));
fConst1 = (1.0f / float(iConst0));
fslider1 = 0.1f;
fConst2 = tanf((31415.926535897932f / float(iConst0)));
fConst3 = (1.0f / fConst2);
fConst4 = (1.0f / (0.9351401670315425f + ((fConst3 + 0.157482159302087f) / fConst2)));
fConst5 = faustpower<2>(fConst2);
fConst6 = (50.063807016150385f / fConst5);
fConst7 = (0.9351401670315425f + fConst6);
fConst8 = (1.0f / (1.450071084655647f + ((fConst3 + 0.7431304601070396f) / fConst2)));
fConst9 = (11.052052171507189f / fConst5);
fConst10 = (1.450071084655647f + fConst9);
fConst11 = (1.0f / (4.076781969643807f + ((fConst3 + 3.1897274020965583f) / fConst2)));
fConst12 = (0.0017661728399818856f / fConst5);
fConst13 = (0.00040767818495825777f + fConst12);
fcheckbox0 = 0.0;
fslider2 = -2e+01f;
for (int i=0; i<2; i++) fRec4[i] = 0;
fcheckbox1 = 0.0;
fcheckbox2 = 0.0;
for (int i=0; i<2; i++) iRec6[i] = 0;
for (int i=0; i<4; i++) fRec5[i] = 0;
fConst14 = (0.3333333333333333f * iConst0);
for (int i=0; i<2; i++) fVec0[i] = 0;
fConst15 = float(iConst0);
fConst16 = (2.0f / fConst15);
fslider3 = 0.1f;
fslider4 = 49.0f;
for (int i=0; i<2; i++) fRec7[i] = 0;
for (int i=0; i<2; i++) fRec8[i] = 0;
for (int i=0; i<2; i++) fVec1[i] = 0;
fslider5 = -0.1f;
for (int i=0; i<2; i++) fRec9[i] = 0;
for (int i=0; i<2; i++) fVec2[i] = 0;
fslider6 = 0.1f;
for (int i=0; i<2; i++) fRec10[i] = 0;
for (int i=0; i<2; i++) fVec3[i] = 0;
fConst17 = (1 + ((fConst3 + 0.6180339887498947f) / fConst2));
fConst18 = (1.0f / fConst17);
fConst19 = (1.0f / fConst5);
fConst20 = (1.0f / (1 + ((fConst3 + 1.6180339887498947f) / fConst2)));
fConst21 = (1 + fConst3);
fConst22 = (0 - ((1 - fConst3) / fConst21));
fConst23 = (1.0f / fConst21);
for (int i=0; i<2; i++) fVec4[i] = 0;
fConst24 = (0 - fConst3);
for (int i=0; i<2; i++) fRec21[i] = 0;
fConst25 = (1 + ((fConst3 - 1.6180339887498947f) / fConst2));
fConst26 = (2 * (1 - fConst19));
for (int i=0; i<3; i++) fRec20[i] = 0;
fConst27 = (2 * (0 - fConst19));
fConst28 = (1 + ((fConst3 - 0.6180339887498947f) / fConst2));
for (int i=0; i<3; i++) fRec19[i] = 0;
fConst29 = tanf((122.7184630308513f / float(iConst0)));
fConst30 = (1.0f / fConst29);
fConst31 = (1.0f / (1 + ((1.618033988749895f + fConst30) / fConst29)));
fConst32 = (1 + ((fConst30 - 1.618033988749895f) / fConst29));
fConst33 = faustpower<2>(fConst29);
fConst34 = (1.0f / fConst33);
fConst35 = (2 * (1 - fConst34));
for (int i=0; i<3; i++) fRec18[i] = 0;
fConst36 = tanf((245.4369260617026f / float(iConst0)));
fConst37 = (1.0f / fConst36);
fConst38 = (1.0f / (1 + ((1.618033988749895f + fConst37) / fConst36)));
fConst39 = (1 + ((fConst37 - 1.618033988749895f) / fConst36));
fConst40 = (1.0f / faustpower<2>(fConst36));
fConst41 = (2 * (1 - fConst40));
for (int i=0; i<3; i++) fRec17[i] = 0;
fConst42 = tanf((490.8738521234052f / float(iConst0)));
fConst43 = (1.0f / fConst42);
fConst44 = (1.0f / (1 + ((1.618033988749895f + fConst43) / fConst42)));
fConst45 = (1 + ((fConst43 - 1.618033988749895f) / fConst42));
fConst46 = faustpower<2>(fConst42);
fConst47 = (1.0f / fConst46);
fConst48 = (2 * (1 - fConst47));
for (int i=0; i<3; i++) fRec16[i] = 0;
fConst49 = tanf((981.7477042468104f / float(iConst0)));
fConst50 = (1.0f / fConst49);
fConst51 = (1.0f / (1 + ((1.618033988749895f + fConst50) / fConst49)));
fConst52 = (1 + ((fConst50 - 1.618033988749895f) / fConst49));
fConst53 = (1.0f / faustpower<2>(fConst49));
fConst54 = (2 * (1 - fConst53));
for (int i=0; i<3; i++) fRec15[i] = 0;
fConst55 = tanf((1963.4954084936207f / float(iConst0)));
fConst56 = (1.0f / fConst55);
fConst57 = (1.0f / (1 + ((1.618033988749895f + fConst56) / fConst55)));
fConst58 = (1 + ((fConst56 - 1.618033988749895f) / fConst55));
fConst59 = faustpower<2>(fConst55);
fConst60 = (1.0f / fConst59);
fConst61 = (2 * (1 - fConst60));
for (int i=0; i<3; i++) fRec14[i] = 0;
fConst62 = tanf((3926.9908169872415f / float(iConst0)));
fConst63 = (1.0f / fConst62);
fConst64 = (1.0f / (1 + ((1.618033988749895f + fConst63) / fConst62)));
fConst65 = (1 + ((fConst63 - 1.618033988749895f) / fConst62));
fConst66 = (1.0f / faustpower<2>(fConst62));
fConst67 = (2 * (1 - fConst66));
for (int i=0; i<3; i++) fRec13[i] = 0;
fConst68 = tanf((7853.981633974483f / float(iConst0)));
fConst69 = (1.0f / fConst68);
fConst70 = (1.0f / (1 + ((1.618033988749895f + fConst69) / fConst68)));
fConst71 = (1 + ((fConst69 - 1.618033988749895f) / fConst68));
fConst72 = faustpower<2>(fConst68);
fConst73 = (1.0f / fConst72);
fConst74 = (2 * (1 - fConst73));
for (int i=0; i<3; i++) fRec12[i] = 0;
fConst75 = tanf((15707.963267948966f / float(iConst0)));
fConst76 = (1.0f / fConst75);
fConst77 = (1.0f / (1 + ((1.618033988749895f + fConst76) / fConst75)));
fConst78 = (1 + ((fConst76 - 1.618033988749895f) / fConst75));
fConst79 = (1.0f / faustpower<2>(fConst75));
fConst80 = (2 * (1 - fConst79));
for (int i=0; i<3; i++) fRec11[i] = 0;
fslider7 = -1e+01f;
for (int i=0; i<2; i++) fRec22[i] = 0;
fConst81 = (1 + ((0.6180339887498947f + fConst76) / fConst75));
fConst82 = (1.0f / fConst81);
fConst83 = (1.0f / (1 + ((1.6180339887498947f + fConst76) / fConst75)));
fConst84 = (1 + fConst76);
fConst85 = (0 - ((1 - fConst76) / fConst84));
fConst86 = (1.0f / (fConst17 * fConst84));
for (int i=0; i<2; i++) fRec35[i] = 0;
for (int i=0; i<3; i++) fRec34[i] = 0;
for (int i=0; i<3; i++) fRec33[i] = 0;
for (int i=0; i<2; i++) fVec5[i] = 0;
fConst87 = (0 - fConst76);
for (int i=0; i<2; i++) fRec32[i] = 0;
fConst88 = (1 + ((fConst76 - 1.6180339887498947f) / fConst75));
for (int i=0; i<3; i++) fRec31[i] = 0;
fConst89 = (2 * (0 - fConst79));
fConst90 = (1 + ((fConst76 - 0.6180339887498947f) / fConst75));
for (int i=0; i<3; i++) fRec30[i] = 0;
for (int i=0; i<3; i++) fRec29[i] = 0;
for (int i=0; i<3; i++) fRec28[i] = 0;
for (int i=0; i<3; i++) fRec27[i] = 0;
for (int i=0; i<3; i++) fRec26[i] = 0;
for (int i=0; i<3; i++) fRec25[i] = 0;
for (int i=0; i<3; i++) fRec24[i] = 0;
for (int i=0; i<3; i++) fRec23[i] = 0;
fslider8 = -1e+01f;
for (int i=0; i<2; i++) fRec36[i] = 0;
fConst91 = (1 + ((0.6180339887498947f + fConst69) / fConst68));
fConst92 = (1.0f / fConst91);
fConst93 = (1.0f / (1 + ((1.6180339887498947f + fConst69) / fConst68)));
fConst94 = (1 + fConst69);
fConst95 = (0 - ((1 - fConst69) / fConst94));
fConst96 = (1.0f / (fConst81 * fConst94));
for (int i=0; i<2; i++) fRec48[i] = 0;
for (int i=0; i<3; i++) fRec47[i] = 0;
for (int i=0; i<3; i++) fRec46[i] = 0;
for (int i=0; i<2; i++) fVec6[i] = 0;
fConst97 = (0 - fConst69);
for (int i=0; i<2; i++) fRec45[i] = 0;
fConst98 = (1 + ((fConst69 - 1.6180339887498947f) / fConst68));
for (int i=0; i<3; i++) fRec44[i] = 0;
fConst99 = (2 * (0 - fConst73));
fConst100 = (1 + ((fConst69 - 0.6180339887498947f) / fConst68));
for (int i=0; i<3; i++) fRec43[i] = 0;
for (int i=0; i<3; i++) fRec42[i] = 0;
for (int i=0; i<3; i++) fRec41[i] = 0;
for (int i=0; i<3; i++) fRec40[i] = 0;
for (int i=0; i<3; i++) fRec39[i] = 0;
for (int i=0; i<3; i++) fRec38[i] = 0;
for (int i=0; i<3; i++) fRec37[i] = 0;
fslider9 = -1e+01f;
for (int i=0; i<2; i++) fRec49[i] = 0;
fConst101 = (1 + ((0.6180339887498947f + fConst63) / fConst62));
fConst102 = (1.0f / fConst101);
fConst103 = (1.0f / (1 + ((1.6180339887498947f + fConst63) / fConst62)));
fConst104 = (1 + fConst63);
fConst105 = (0 - ((1 - fConst63) / fConst104));
fConst106 = (1.0f / (fConst91 * fConst104));
for (int i=0; i<2; i++) fRec60[i] = 0;
for (int i=0; i<3; i++) fRec59[i] = 0;
for (int i=0; i<3; i++) fRec58[i] = 0;
for (int i=0; i<2; i++) fVec7[i] = 0;
fConst107 = (0 - fConst63);
for (int i=0; i<2; i++) fRec57[i] = 0;
fConst108 = (1 + ((fConst63 - 1.6180339887498947f) / fConst62));
for (int i=0; i<3; i++) fRec56[i] = 0;
fConst109 = (2 * (0 - fConst66));
fConst110 = (1 + ((fConst63 - 0.6180339887498947f) / fConst62));
for (int i=0; i<3; i++) fRec55[i] = 0;
for (int i=0; i<3; i++) fRec54[i] = 0;
for (int i=0; i<3; i++) fRec53[i] = 0;
for (int i=0; i<3; i++) fRec52[i] = 0;
for (int i=0; i<3; i++) fRec51[i] = 0;
for (int i=0; i<3; i++) fRec50[i] = 0;
fslider10 = -1e+01f;
for (int i=0; i<2; i++) fRec61[i] = 0;
fConst111 = (1 + ((0.6180339887498947f + fConst56) / fConst55));
fConst112 = (1.0f / fConst111);
fConst113 = (1.0f / (1 + ((1.6180339887498947f + fConst56) / fConst55)));
fConst114 = (1 + fConst56);
fConst115 = (0 - ((1 - fConst56) / fConst114));
fConst116 = (1.0f / (fConst101 * fConst114));
for (int i=0; i<2; i++) fRec71[i] = 0;
for (int i=0; i<3; i++) fRec70[i] = 0;
for (int i=0; i<3; i++) fRec69[i] = 0;
for (int i=0; i<2; i++) fVec8[i] = 0;
fConst117 = (0 - fConst56);
for (int i=0; i<2; i++) fRec68[i] = 0;
fConst118 = (1 + ((fConst56 - 1.6180339887498947f) / fConst55));
for (int i=0; i<3; i++) fRec67[i] = 0;
fConst119 = (2 * (0 - fConst60));
fConst120 = (1 + ((fConst56 - 0.6180339887498947f) / fConst55));
for (int i=0; i<3; i++) fRec66[i] = 0;
for (int i=0; i<3; i++) fRec65[i] = 0;
for (int i=0; i<3; i++) fRec64[i] = 0;
for (int i=0; i<3; i++) fRec63[i] = 0;
for (int i=0; i<3; i++) fRec62[i] = 0;
fslider11 = -1e+01f;
for (int i=0; i<2; i++) fRec72[i] = 0;
fConst121 = (1 + ((0.6180339887498947f + fConst50) / fConst49));
fConst122 = (1.0f / fConst121);
fConst123 = (1.0f / (1 + ((1.6180339887498947f + fConst50) / fConst49)));
fConst124 = (1 + fConst50);
fConst125 = (0 - ((1 - fConst50) / fConst124));
fConst126 = (1.0f / (fConst111 * fConst124));
for (int i=0; i<2; i++) fRec81[i] = 0;
for (int i=0; i<3; i++) fRec80[i] = 0;
for (int i=0; i<3; i++) fRec79[i] = 0;
for (int i=0; i<2; i++) fVec9[i] = 0;
fConst127 = (0 - fConst50);
for (int i=0; i<2; i++) fRec78[i] = 0;
fConst128 = (1 + ((fConst50 - 1.6180339887498947f) / fConst49));
for (int i=0; i<3; i++) fRec77[i] = 0;
fConst129 = (2 * (0 - fConst53));
fConst130 = (1 + ((fConst50 - 0.6180339887498947f) / fConst49));
for (int i=0; i<3; i++) fRec76[i] = 0;
for (int i=0; i<3; i++) fRec75[i] = 0;
for (int i=0; i<3; i++) fRec74[i] = 0;
for (int i=0; i<3; i++) fRec73[i] = 0;
fslider12 = -1e+01f;
for (int i=0; i<2; i++) fRec82[i] = 0;
fConst131 = (1 + ((0.6180339887498947f + fConst43) / fConst42));
fConst132 = (1.0f / fConst131);
fConst133 = (1.0f / (1 + ((1.6180339887498947f + fConst43) / fConst42)));
fConst134 = (1 + fConst43);
fConst135 = (0 - ((1 - fConst43) / fConst134));
fConst136 = (1.0f / (fConst121 * fConst134));
for (int i=0; i<2; i++) fRec90[i] = 0;
for (int i=0; i<3; i++) fRec89[i] = 0;
for (int i=0; i<3; i++) fRec88[i] = 0;
for (int i=0; i<2; i++) fVec10[i] = 0;
fConst137 = (0 - fConst43);
for (int i=0; i<2; i++) fRec87[i] = 0;
fConst138 = (1 + ((fConst43 - 1.6180339887498947f) / fConst42));
for (int i=0; i<3; i++) fRec86[i] = 0;
fConst139 = (2 * (0 - fConst47));
fConst140 = (1 + ((fConst43 - 0.6180339887498947f) / fConst42));
for (int i=0; i<3; i++) fRec85[i] = 0;
for (int i=0; i<3; i++) fRec84[i] = 0;
for (int i=0; i<3; i++) fRec83[i] = 0;
fslider13 = -1e+01f;
for (int i=0; i<2; i++) fRec91[i] = 0;
fConst141 = (1 + ((0.6180339887498947f + fConst37) / fConst36));
fConst142 = (1.0f / fConst141);
fConst143 = (1.0f / (1 + ((1.6180339887498947f + fConst37) / fConst36)));
fConst144 = (1 + fConst37);
fConst145 = (0 - ((1 - fConst37) / fConst144));
fConst146 = (1.0f / (fConst131 * fConst144));
for (int i=0; i<2; i++) fRec98[i] = 0;
for (int i=0; i<3; i++) fRec97[i] = 0;
for (int i=0; i<3; i++) fRec96[i] = 0;
for (int i=0; i<2; i++) fVec11[i] = 0;
fConst147 = (0 - fConst37);
for (int i=0; i<2; i++) fRec95[i] = 0;
fConst148 = (1 + ((fConst37 - 1.6180339887498947f) / fConst36));
for (int i=0; i<3; i++) fRec94[i] = 0;
fConst149 = (2 * (0 - fConst40));
fConst150 = (1 + ((fConst37 - 0.6180339887498947f) / fConst36));
for (int i=0; i<3; i++) fRec93[i] = 0;
for (int i=0; i<3; i++) fRec92[i] = 0;
fslider14 = -1e+01f;
for (int i=0; i<2; i++) fRec99[i] = 0;
fConst151 = (1.0f / (1 + ((0.6180339887498947f + fConst30) / fConst29)));
fConst152 = (1.0f / (1 + ((1.6180339887498947f + fConst30) / fConst29)));
fConst153 = (1 + fConst30);
fConst154 = (0 - ((1 - fConst30) / fConst153));
fConst155 = (1.0f / (fConst141 * fConst153));
for (int i=0; i<2; i++) fRec105[i] = 0;
for (int i=0; i<3; i++) fRec104[i] = 0;
for (int i=0; i<3; i++) fRec103[i] = 0;
for (int i=0; i<2; i++) fVec12[i] = 0;
fConst156 = (0 - fConst30);
for (int i=0; i<2; i++) fRec102[i] = 0;
fConst157 = (1 + ((fConst30 - 1.6180339887498947f) / fConst29));
for (int i=0; i<3; i++) fRec101[i] = 0;
fConst158 = (2 * (0 - fConst34));
fConst159 = (1 + ((fConst30 - 0.6180339887498947f) / fConst29));
for (int i=0; i<3; i++) fRec100[i] = 0;
fslider15 = -1e+01f;
for (int i=0; i<2; i++) fRec106[i] = 0;
for (int i=0; i<2; i++) fRec109[i] = 0;
for (int i=0; i<3; i++) fRec108[i] = 0;
for (int i=0; i<3; i++) fRec107[i] = 0;
fslider16 = -1e+01f;
for (int i=0; i<2; i++) fRec110[i] = 0;
fConst160 = (4.076781969643807f + ((fConst3 - 3.1897274020965583f) / fConst2));
fConst161 = (2 * (4.076781969643807f - fConst19));
for (int i=0; i<3; i++) fRec3[i] = 0;
fConst162 = (2 * (0.00040767818495825777f - fConst12));
fConst163 = (1.450071084655647f + ((fConst3 - 0.7431304601070396f) / fConst2));
fConst164 = (2 * (1.450071084655647f - fConst19));
for (int i=0; i<3; i++) fRec2[i] = 0;
fConst165 = (2 * (1.450071084655647f - fConst9));
fConst166 = (0.9351401670315425f + ((fConst3 - 0.157482159302087f) / fConst2));
fConst167 = (2 * (0.9351401670315425f - fConst19));
for (int i=0; i<3; i++) fRec1[i] = 0;
fConst168 = (2 * (0.9351401670315425f - fConst6));
for (int i=0; i<2; i++) fRec0[i] = 0;
fConst169 = tanf((19790.793572264363f / float(iConst0)));
fConst170 = (1.0f / fConst169);
fConst171 = (1.0f / (0.9351401670315425f + ((0.157482159302087f + fConst170) / fConst169)));
fConst172 = faustpower<2>(fConst169);
fConst173 = (50.063807016150385f / fConst172);
fConst174 = (0.9351401670315425f + fConst173);
fConst175 = (1.0f / (1.450071084655647f + ((0.7431304601070396f + fConst170) / fConst169)));
fConst176 = (11.052052171507189f / fConst172);
fConst177 = (1.450071084655647f + fConst176);
fConst178 = (1.0f / (4.076781969643807f + ((3.1897274020965583f + fConst170) / fConst169)));
fConst179 = (0.0017661728399818856f / fConst172);
fConst180 = (0.00040767818495825777f + fConst179);
fConst181 = (1.0f / (1.069358407707312f + ((0.168404871113589f + fConst3) / fConst2)));
fConst182 = (53.53615295455673f + fConst19);
fConst183 = (1.0f / (0.689621364484675f + ((0.512478641889141f + fConst3) / fConst2)));
fConst184 = (7.621731298870603f + fConst19);
fConst185 = (1.0f / (0.24529150870616f + ((0.782413046821645f + fConst3) / fConst2)));
fConst186 = (9.9999997055e-05f / fConst5);
fConst187 = (0.000433227200555f + fConst186);
fConst188 = (0.24529150870616f + ((fConst3 - 0.782413046821645f) / fConst2));
fConst189 = (2 * (0.24529150870616f - fConst19));
for (int i=0; i<3; i++) fRec117[i] = 0;
fConst190 = (2 * (0.000433227200555f - fConst186));
fConst191 = (0.689621364484675f + ((fConst3 - 0.512478641889141f) / fConst2));
fConst192 = (2 * (0.689621364484675f - fConst19));
for (int i=0; i<3; i++) fRec116[i] = 0;
fConst193 = (2 * (7.621731298870603f - fConst19));
fConst194 = (1.069358407707312f + ((fConst3 - 0.168404871113589f) / fConst2));
fConst195 = (2 * (1.069358407707312f - fConst19));
for (int i=0; i<3; i++) fRec115[i] = 0;
fConst196 = (2 * (53.53615295455673f - fConst19));
fConst197 = (4.076781969643807f + ((fConst170 - 3.1897274020965583f) / fConst169));
fConst198 = (1.0f / fConst172);
fConst199 = (2 * (4.076781969643807f - fConst198));
for (int i=0; i<3; i++) fRec114[i] = 0;
fConst200 = (2 * (0.00040767818495825777f - fConst179));
fConst201 = (1.450071084655647f + ((fConst170 - 0.7431304601070396f) / fConst169));
fConst202 = (2 * (1.450071084655647f - fConst198));
for (int i=0; i<3; i++) fRec113[i] = 0;
fConst203 = (2 * (1.450071084655647f - fConst176));
fConst204 = (0.9351401670315425f + ((fConst170 - 0.157482159302087f) / fConst169));
fConst205 = (2 * (0.9351401670315425f - fConst198));
for (int i=0; i<3; i++) fRec112[i] = 0;
fConst206 = (2 * (0.9351401670315425f - fConst173));
for (int i=0; i<2; i++) fRec111[i] = 0;
fConst207 = tanf((12467.418707910012f / float(iConst0)));
fConst208 = (1.0f / fConst207);
fConst209 = (1.0f / (0.9351401670315425f + ((0.157482159302087f + fConst208) / fConst207)));
fConst210 = faustpower<2>(fConst207);
fConst211 = (50.063807016150385f / fConst210);
fConst212 = (0.9351401670315425f + fConst211);
fConst213 = (1.0f / (1.450071084655647f + ((0.7431304601070396f + fConst208) / fConst207)));
fConst214 = (11.052052171507189f / fConst210);
fConst215 = (1.450071084655647f + fConst214);
fConst216 = (1.0f / (4.076781969643807f + ((3.1897274020965583f + fConst208) / fConst207)));
fConst217 = (0.0017661728399818856f / fConst210);
fConst218 = (0.00040767818495825777f + fConst217);
fConst219 = (1.0f / (1.069358407707312f + ((0.168404871113589f + fConst170) / fConst169)));
fConst220 = (53.53615295455673f + fConst198);
fConst221 = (1.0f / (0.689621364484675f + ((0.512478641889141f + fConst170) / fConst169)));
fConst222 = (7.621731298870603f + fConst198);
fConst223 = (1.0f / (0.24529150870616f + ((0.782413046821645f + fConst170) / fConst169)));
fConst224 = (9.9999997055e-05f / fConst172);
fConst225 = (0.000433227200555f + fConst224);
fConst226 = (0.24529150870616f + ((fConst170 - 0.782413046821645f) / fConst169));
fConst227 = (2 * (0.24529150870616f - fConst198));
for (int i=0; i<3; i++) fRec124[i] = 0;
fConst228 = (2 * (0.000433227200555f - fConst224));
fConst229 = (0.689621364484675f + ((fConst170 - 0.512478641889141f) / fConst169));
fConst230 = (2 * (0.689621364484675f - fConst198));
for (int i=0; i<3; i++) fRec123[i] = 0;
fConst231 = (2 * (7.621731298870603f - fConst198));
fConst232 = (1.069358407707312f + ((fConst170 - 0.168404871113589f) / fConst169));
fConst233 = (2 * (1.069358407707312f - fConst198));
for (int i=0; i<3; i++) fRec122[i] = 0;
fConst234 = (2 * (53.53615295455673f - fConst198));
fConst235 = (4.076781969643807f + ((fConst208 - 3.1897274020965583f) / fConst207));
fConst236 = (1.0f / fConst210);
fConst237 = (2 * (4.076781969643807f - fConst236));
for (int i=0; i<3; i++) fRec121[i] = 0;
fConst238 = (2 * (0.00040767818495825777f - fConst217));
fConst239 = (1.450071084655647f + ((fConst208 - 0.7431304601070396f) / fConst207));
fConst240 = (2 * (1.450071084655647f - fConst236));
for (int i=0; i<3; i++) fRec120[i] = 0;
fConst241 = (2 * (1.450071084655647f - fConst214));
fConst242 = (0.9351401670315425f + ((fConst208 - 0.157482159302087f) / fConst207));
fConst243 = (2 * (0.9351401670315425f - fConst236));
for (int i=0; i<3; i++) fRec119[i] = 0;
fConst244 = (2 * (0.9351401670315425f - fConst211));
for (int i=0; i<2; i++) fRec118[i] = 0;
fConst245 = (1.0f / (0.9351401670315425f + ((fConst69 + 0.157482159302087f) / fConst68)));
fConst246 = (50.063807016150385f / fConst72);
fConst247 = (0.9351401670315425f + fConst246);
fConst248 = (1.0f / (1.450071084655647f + ((fConst69 + 0.7431304601070396f) / fConst68)));
fConst249 = (11.052052171507189f / fConst72);
fConst250 = (1.450071084655647f + fConst249);
fConst251 = (1.0f / (4.076781969643807f + ((fConst69 + 3.1897274020965583f) / fConst68)));
fConst252 = (0.0017661728399818856f / fConst72);
fConst253 = (0.00040767818495825777f + fConst252);
fConst254 = (1.0f / (1.069358407707312f + ((0.168404871113589f + fConst208) / fConst207)));
fConst255 = (53.53615295455673f + fConst236);
fConst256 = (1.0f / (0.689621364484675f + ((0.512478641889141f + fConst208) / fConst207)));
fConst257 = (7.621731298870603f + fConst236);
fConst258 = (1.0f / (0.24529150870616f + ((0.782413046821645f + fConst208) / fConst207)));
fConst259 = (9.9999997055e-05f / fConst210);
fConst260 = (0.000433227200555f + fConst259);
fConst261 = (0.24529150870616f + ((fConst208 - 0.782413046821645f) / fConst207));
fConst262 = (2 * (0.24529150870616f - fConst236));
for (int i=0; i<3; i++) fRec131[i] = 0;
fConst263 = (2 * (0.000433227200555f - fConst259));
fConst264 = (0.689621364484675f + ((fConst208 - 0.512478641889141f) / fConst207));
fConst265 = (2 * (0.689621364484675f - fConst236));
for (int i=0; i<3; i++) fRec130[i] = 0;
fConst266 = (2 * (7.621731298870603f - fConst236));
fConst267 = (1.069358407707312f + ((fConst208 - 0.168404871113589f) / fConst207));
fConst268 = (2 * (1.069358407707312f - fConst236));
for (int i=0; i<3; i++) fRec129[i] = 0;
fConst269 = (2 * (53.53615295455673f - fConst236));
fConst270 = (4.076781969643807f + ((fConst69 - 3.1897274020965583f) / fConst68));
fConst271 = (2 * (4.076781969643807f - fConst73));
for (int i=0; i<3; i++) fRec128[i] = 0;
fConst272 = (2 * (0.00040767818495825777f - fConst252));
fConst273 = (1.450071084655647f + ((fConst69 - 0.7431304601070396f) / fConst68));
fConst274 = (2 * (1.450071084655647f - fConst73));
for (int i=0; i<3; i++) fRec127[i] = 0;
fConst275 = (2 * (1.450071084655647f - fConst249));
fConst276 = (0.9351401670315425f + ((fConst69 - 0.157482159302087f) / fConst68));
fConst277 = (2 * (0.9351401670315425f - fConst73));
for (int i=0; i<3; i++) fRec126[i] = 0;
fConst278 = (2 * (0.9351401670315425f - fConst246));
for (int i=0; i<2; i++) fRec125[i] = 0;
fConst279 = tanf((4947.698393066091f / float(iConst0)));
fConst280 = (1.0f / fConst279);
fConst281 = (1.0f / (0.9351401670315425f + ((0.157482159302087f + fConst280) / fConst279)));
fConst282 = faustpower<2>(fConst279);
fConst283 = (50.063807016150385f / fConst282);
fConst284 = (0.9351401670315425f + fConst283);
fConst285 = (1.0f / (1.450071084655647f + ((0.7431304601070396f + fConst280) / fConst279)));
fConst286 = (11.052052171507189f / fConst282);
fConst287 = (1.450071084655647f + fConst286);
fConst288 = (1.0f / (4.076781969643807f + ((3.1897274020965583f + fConst280) / fConst279)));
fConst289 = (0.0017661728399818856f / fConst282);
fConst290 = (0.00040767818495825777f + fConst289);
fConst291 = (1.0f / (1.069358407707312f + ((0.168404871113589f + fConst69) / fConst68)));
fConst292 = (53.53615295455673f + fConst73);
fConst293 = (1.0f / (0.689621364484675f + ((0.512478641889141f + fConst69) / fConst68)));
fConst294 = (7.621731298870603f + fConst73);
fConst295 = (1.0f / (0.24529150870616f + ((0.782413046821645f + fConst69) / fConst68)));
fConst296 = (9.9999997055e-05f / fConst72);
fConst297 = (0.000433227200555f + fConst296);
fConst298 = (0.24529150870616f + ((fConst69 - 0.782413046821645f) / fConst68));
fConst299 = (2 * (0.24529150870616f - fConst73));
for (int i=0; i<3; i++) fRec138[i] = 0;
fConst300 = (2 * (0.000433227200555f - fConst296));
fConst301 = (0.689621364484675f + ((fConst69 - 0.512478641889141f) / fConst68));
fConst302 = (2 * (0.689621364484675f - fConst73));
for (int i=0; i<3; i++) fRec137[i] = 0;
fConst303 = (2 * (7.621731298870603f - fConst73));
fConst304 = (1.069358407707312f + ((fConst69 - 0.168404871113589f) / fConst68));
fConst305 = (2 * (1.069358407707312f - fConst73));
for (int i=0; i<3; i++) fRec136[i] = 0;
fConst306 = (2 * (53.53615295455673f - fConst73));
fConst307 = (4.076781969643807f + ((fConst280 - 3.1897274020965583f) / fConst279));
fConst308 = (1.0f / fConst282);
fConst309 = (2 * (4.076781969643807f - fConst308));
for (int i=0; i<3; i++) fRec135[i] = 0;
fConst310 = (2 * (0.00040767818495825777f - fConst289));
fConst311 = (1.450071084655647f + ((fConst280 - 0.7431304601070396f) / fConst279));
fConst312 = (2 * (1.450071084655647f - fConst308));
for (int i=0; i<3; i++) fRec134[i] = 0;
fConst313 = (2 * (1.450071084655647f - fConst286));
fConst314 = (0.9351401670315425f + ((fConst280 - 0.157482159302087f) / fConst279));
fConst315 = (2 * (0.9351401670315425f - fConst308));
for (int i=0; i<3; i++) fRec133[i] = 0;
fConst316 = (2 * (0.9351401670315425f - fConst283));
for (int i=0; i<2; i++) fRec132[i] = 0;
fConst317 = tanf((3116.8546769775025f / float(iConst0)));
fConst318 = (1.0f / fConst317);
fConst319 = (1.0f / (0.9351401670315425f + ((0.157482159302087f + fConst318) / fConst317)));
fConst320 = faustpower<2>(fConst317);
fConst321 = (50.063807016150385f / fConst320);
fConst322 = (0.9351401670315425f + fConst321);
fConst323 = (1.0f / (1.450071084655647f + ((0.7431304601070396f + fConst318) / fConst317)));
fConst324 = (11.052052171507189f / fConst320);
fConst325 = (1.450071084655647f + fConst324);
fConst326 = (1.0f / (4.076781969643807f + ((3.1897274020965583f + fConst318) / fConst317)));
fConst327 = (0.0017661728399818856f / fConst320);
fConst328 = (0.00040767818495825777f + fConst327);
fConst329 = (1.0f / (1.069358407707312f + ((0.168404871113589f + fConst280) / fConst279)));
fConst330 = (53.53615295455673f + fConst308);
fConst331 = (1.0f / (0.689621364484675f + ((0.512478641889141f + fConst280) / fConst279)));
fConst332 = (7.621731298870603f + fConst308);
fConst333 = (1.0f / (0.24529150870616f + ((0.782413046821645f + fConst280) / fConst279)));
fConst334 = (9.9999997055e-05f / fConst282);
fConst335 = (0.000433227200555f + fConst334);
fConst336 = (0.24529150870616f + ((fConst280 - 0.782413046821645f) / fConst279));
fConst337 = (2 * (0.24529150870616f - fConst308));
for (int i=0; i<3; i++) fRec145[i] = 0;
fConst338 = (2 * (0.000433227200555f - fConst334));
fConst339 = (0.689621364484675f + ((fConst280 - 0.512478641889141f) / fConst279));
fConst340 = (2 * (0.689621364484675f - fConst308));
for (int i=0; i<3; i++) fRec144[i] = 0;
fConst341 = (2 * (7.621731298870603f - fConst308));
fConst342 = (1.069358407707312f + ((fConst280 - 0.168404871113589f) / fConst279));
fConst343 = (2 * (1.069358407707312f - fConst308));
for (int i=0; i<3; i++) fRec143[i] = 0;
fConst344 = (2 * (53.53615295455673f - fConst308));
fConst345 = (4.076781969643807f + ((fConst318 - 3.1897274020965583f) / fConst317));
fConst346 = (1.0f / fConst320);
fConst347 = (2 * (4.076781969643807f - fConst346));
for (int i=0; i<3; i++) fRec142[i] = 0;
fConst348 = (2 * (0.00040767818495825777f - fConst327));
fConst349 = (1.450071084655647f + ((fConst318 - 0.7431304601070396f) / fConst317));
fConst350 = (2 * (1.450071084655647f - fConst346));
for (int i=0; i<3; i++) fRec141[i] = 0;
fConst351 = (2 * (1.450071084655647f - fConst324));
fConst352 = (0.9351401670315425f + ((fConst318 - 0.157482159302087f) / fConst317));
fConst353 = (2 * (0.9351401670315425f - fConst346));
for (int i=0; i<3; i++) fRec140[i] = 0;
fConst354 = (2 * (0.9351401670315425f - fConst321));
for (int i=0; i<2; i++) fRec139[i] = 0;
fConst355 = (1.0f / (0.9351401670315425f + ((fConst56 + 0.157482159302087f) / fConst55)));
fConst356 = (50.063807016150385f / fConst59);
fConst357 = (0.9351401670315425f + fConst356);
fConst358 = (1.0f / (1.450071084655647f + ((fConst56 + 0.7431304601070396f) / fConst55)));
fConst359 = (11.052052171507189f / fConst59);
fConst360 = (1.450071084655647f + fConst359);
fConst361 = (1.0f / (4.076781969643807f + ((fConst56 + 3.1897274020965583f) / fConst55)));
fConst362 = (0.0017661728399818856f / fConst59);
fConst363 = (0.00040767818495825777f + fConst362);
fConst364 = (1.0f / (1.069358407707312f + ((0.168404871113589f + fConst318) / fConst317)));
fConst365 = (53.53615295455673f + fConst346);
fConst366 = (1.0f / (0.689621364484675f + ((0.512478641889141f + fConst318) / fConst317)));
fConst367 = (7.621731298870603f + fConst346);
fConst368 = (1.0f / (0.24529150870616f + ((0.782413046821645f + fConst318) / fConst317)));
fConst369 = (9.9999997055e-05f / fConst320);
fConst370 = (0.000433227200555f + fConst369);
fConst371 = (0.24529150870616f + ((fConst318 - 0.782413046821645f) / fConst317));
fConst372 = (2 * (0.24529150870616f - fConst346));
for (int i=0; i<3; i++) fRec152[i] = 0;
fConst373 = (2 * (0.000433227200555f - fConst369));
fConst374 = (0.689621364484675f + ((fConst318 - 0.512478641889141f) / fConst317));
fConst375 = (2 * (0.689621364484675f - fConst346));
for (int i=0; i<3; i++) fRec151[i] = 0;
fConst376 = (2 * (7.621731298870603f - fConst346));
fConst377 = (1.069358407707312f + ((fConst318 - 0.168404871113589f) / fConst317));
fConst378 = (2 * (1.069358407707312f - fConst346));
for (int i=0; i<3; i++) fRec150[i] = 0;
fConst379 = (2 * (53.53615295455673f - fConst346));
fConst380 = (4.076781969643807f + ((fConst56 - 3.1897274020965583f) / fConst55));
fConst381 = (2 * (4.076781969643807f - fConst60));
for (int i=0; i<3; i++) fRec149[i] = 0;
fConst382 = (2 * (0.00040767818495825777f - fConst362));
fConst383 = (1.450071084655647f + ((fConst56 - 0.7431304601070396f) / fConst55));
fConst384 = (2 * (1.450071084655647f - fConst60));
for (int i=0; i<3; i++) fRec148[i] = 0;
fConst385 = (2 * (1.450071084655647f - fConst359));
fConst386 = (0.9351401670315425f + ((fConst56 - 0.157482159302087f) / fConst55));
fConst387 = (2 * (0.9351401670315425f - fConst60));
for (int i=0; i<3; i++) fRec147[i] = 0;
fConst388 = (2 * (0.9351401670315425f - fConst356));
for (int i=0; i<2; i++) fRec146[i] = 0;
fConst389 = tanf((1236.9245982665225f / float(iConst0)));
fConst390 = (1.0f / fConst389);
fConst391 = (1.0f / (0.9351401670315425f + ((0.157482159302087f + fConst390) / fConst389)));
fConst392 = faustpower<2>(fConst389);
fConst393 = (50.063807016150385f / fConst392);
fConst394 = (0.9351401670315425f + fConst393);
fConst395 = (1.0f / (1.450071084655647f + ((0.7431304601070396f + fConst390) / fConst389)));
fConst396 = (11.052052171507189f / fConst392);
fConst397 = (1.450071084655647f + fConst396);
fConst398 = (1.0f / (4.076781969643807f + ((3.1897274020965583f + fConst390) / fConst389)));
fConst399 = (0.0017661728399818856f / fConst392);
fConst400 = (0.00040767818495825777f + fConst399);
fConst401 = (1.0f / (1.069358407707312f + ((0.168404871113589f + fConst56) / fConst55)));
fConst402 = (53.53615295455673f + fConst60);
fConst403 = (1.0f / (0.689621364484675f + ((0.512478641889141f + fConst56) / fConst55)));
fConst404 = (7.621731298870603f + fConst60);
fConst405 = (1.0f / (0.24529150870616f + ((0.782413046821645f + fConst56) / fConst55)));
fConst406 = (9.9999997055e-05f / fConst59);
fConst407 = (0.000433227200555f + fConst406);
fConst408 = (0.24529150870616f + ((fConst56 - 0.782413046821645f) / fConst55));
fConst409 = (2 * (0.24529150870616f - fConst60));
for (int i=0; i<3; i++) fRec159[i] = 0;
fConst410 = (2 * (0.000433227200555f - fConst406));
fConst411 = (0.689621364484675f + ((fConst56 - 0.512478641889141f) / fConst55));
fConst412 = (2 * (0.689621364484675f - fConst60));
for (int i=0; i<3; i++) fRec158[i] = 0;
fConst413 = (2 * (7.621731298870603f - fConst60));
fConst414 = (1.069358407707312f + ((fConst56 - 0.168404871113589f) / fConst55));
fConst415 = (2 * (1.069358407707312f - fConst60));
for (int i=0; i<3; i++) fRec157[i] = 0;
fConst416 = (2 * (53.53615295455673f - fConst60));
fConst417 = (4.076781969643807f + ((fConst390 - 3.1897274020965583f) / fConst389));
fConst418 = (1.0f / fConst392);
fConst419 = (2 * (4.076781969643807f - fConst418));
for (int i=0; i<3; i++) fRec156[i] = 0;
fConst420 = (2 * (0.00040767818495825777f - fConst399));
fConst421 = (1.450071084655647f + ((fConst390 - 0.7431304601070396f) / fConst389));
fConst422 = (2 * (1.450071084655647f - fConst418));
for (int i=0; i<3; i++) fRec155[i] = 0;
fConst423 = (2 * (1.450071084655647f - fConst396));
fConst424 = (0.9351401670315425f + ((fConst390 - 0.157482159302087f) / fConst389));
fConst425 = (2 * (0.9351401670315425f - fConst418));
for (int i=0; i<3; i++) fRec154[i] = 0;
fConst426 = (2 * (0.9351401670315425f - fConst393));
for (int i=0; i<2; i++) fRec153[i] = 0;
fConst427 = tanf((779.213669244376f / float(iConst0)));
fConst428 = (1.0f / fConst427);
fConst429 = (1.0f / (0.9351401670315425f + ((0.157482159302087f + fConst428) / fConst427)));
fConst430 = faustpower<2>(fConst427);
fConst431 = (50.063807016150385f / fConst430);
fConst432 = (0.9351401670315425f + fConst431);
fConst433 = (1.0f / (1.450071084655647f + ((0.7431304601070396f + fConst428) / fConst427)));
fConst434 = (11.052052171507189f / fConst430);
fConst435 = (1.450071084655647f + fConst434);
fConst436 = (1.0f / (4.076781969643807f + ((3.1897274020965583f + fConst428) / fConst427)));
fConst437 = (0.0017661728399818856f / fConst430);
fConst438 = (0.00040767818495825777f + fConst437);
fConst439 = (1.0f / (1.069358407707312f + ((0.168404871113589f + fConst390) / fConst389)));
fConst440 = (53.53615295455673f + fConst418);
fConst441 = (1.0f / (0.689621364484675f + ((0.512478641889141f + fConst390) / fConst389)));
fConst442 = (7.621731298870603f + fConst418);
fConst443 = (1.0f / (0.24529150870616f + ((0.782413046821645f + fConst390) / fConst389)));
fConst444 = (9.9999997055e-05f / fConst392);
fConst445 = (0.000433227200555f + fConst444);
fConst446 = (0.24529150870616f + ((fConst390 - 0.782413046821645f) / fConst389));
fConst447 = (2 * (0.24529150870616f - fConst418));
for (int i=0; i<3; i++) fRec166[i] = 0;
fConst448 = (2 * (0.000433227200555f - fConst444));
fConst449 = (0.689621364484675f + ((fConst390 - 0.512478641889141f) / fConst389));
fConst450 = (2 * (0.689621364484675f - fConst418));
for (int i=0; i<3; i++) fRec165[i] = 0;
fConst451 = (2 * (7.621731298870603f - fConst418));
fConst452 = (1.069358407707312f + ((fConst390 - 0.168404871113589f) / fConst389));
fConst453 = (2 * (1.069358407707312f - fConst418));
for (int i=0; i<3; i++) fRec164[i] = 0;
fConst454 = (2 * (53.53615295455673f - fConst418));
fConst455 = (4.076781969643807f + ((fConst428 - 3.1897274020965583f) / fConst427));
fConst456 = (1.0f / fConst430);
fConst457 = (2 * (4.076781969643807f - fConst456));
for (int i=0; i<3; i++) fRec163[i] = 0;
fConst458 = (2 * (0.00040767818495825777f - fConst437));
fConst459 = (1.450071084655647f + ((fConst428 - 0.7431304601070396f) / fConst427));
fConst460 = (2 * (1.450071084655647f - fConst456));
for (int i=0; i<3; i++) fRec162[i] = 0;
fConst461 = (2 * (1.450071084655647f - fConst434));
fConst462 = (0.9351401670315425f + ((fConst428 - 0.157482159302087f) / fConst427));
fConst463 = (2 * (0.9351401670315425f - fConst456));
for (int i=0; i<3; i++) fRec161[i] = 0;
fConst464 = (2 * (0.9351401670315425f - fConst431));
for (int i=0; i<2; i++) fRec160[i] = 0;
fConst465 = (1.0f / (0.9351401670315425f + ((fConst43 + 0.157482159302087f) / fConst42)));
fConst466 = (50.063807016150385f / fConst46);
fConst467 = (0.9351401670315425f + fConst466);
fConst468 = (1.0f / (1.450071084655647f + ((fConst43 + 0.7431304601070396f) / fConst42)));
fConst469 = (11.052052171507189f / fConst46);
fConst470 = (1.450071084655647f + fConst469);
fConst471 = (1.0f / (4.076781969643807f + ((fConst43 + 3.1897274020965583f) / fConst42)));
fConst472 = (0.0017661728399818856f / fConst46);
fConst473 = (0.00040767818495825777f + fConst472);
fConst474 = (1.0f / (1.069358407707312f + ((0.168404871113589f + fConst428) / fConst427)));
fConst475 = (53.53615295455673f + fConst456);
fConst476 = (1.0f / (0.689621364484675f + ((0.512478641889141f + fConst428) / fConst427)));
fConst477 = (7.621731298870603f + fConst456);
fConst478 = (1.0f / (0.24529150870616f + ((0.782413046821645f + fConst428) / fConst427)));
fConst479 = (9.9999997055e-05f / fConst430);
fConst480 = (0.000433227200555f + fConst479);
fConst481 = (0.24529150870616f + ((fConst428 - 0.782413046821645f) / fConst427));
fConst482 = (2 * (0.24529150870616f - fConst456));
for (int i=0; i<3; i++) fRec173[i] = 0;
fConst483 = (2 * (0.000433227200555f - fConst479));
fConst484 = (0.689621364484675f + ((fConst428 - 0.512478641889141f) / fConst427));
fConst485 = (2 * (0.689621364484675f - fConst456));
for (int i=0; i<3; i++) fRec172[i] = 0;
fConst486 = (2 * (7.621731298870603f - fConst456));
fConst487 = (1.069358407707312f + ((fConst428 - 0.168404871113589f) / fConst427));
fConst488 = (2 * (1.069358407707312f - fConst456));
for (int i=0; i<3; i++) fRec171[i] = 0;
fConst489 = (2 * (53.53615295455673f - fConst456));
fConst490 = (4.076781969643807f + ((fConst43 - 3.1897274020965583f) / fConst42));
fConst491 = (2 * (4.076781969643807f - fConst47));
for (int i=0; i<3; i++) fRec170[i] = 0;
fConst492 = (2 * (0.00040767818495825777f - fConst472));
fConst493 = (1.450071084655647f + ((fConst43 - 0.7431304601070396f) / fConst42));
fConst494 = (2 * (1.450071084655647f - fConst47));
for (int i=0; i<3; i++) fRec169[i] = 0;
fConst495 = (2 * (1.450071084655647f - fConst469));
fConst496 = (0.9351401670315425f + ((fConst43 - 0.157482159302087f) / fConst42));
fConst497 = (2 * (0.9351401670315425f - fConst47));
for (int i=0; i<3; i++) fRec168[i] = 0;
fConst498 = (2 * (0.9351401670315425f - fConst466));
for (int i=0; i<2; i++) fRec167[i] = 0;
fConst499 = tanf((309.2311495666306f / float(iConst0)));
fConst500 = (1.0f / fConst499);
fConst501 = (1.0f / (0.9351401670315425f + ((0.157482159302087f + fConst500) / fConst499)));
fConst502 = faustpower<2>(fConst499);
fConst503 = (50.063807016150385f / fConst502);
fConst504 = (0.9351401670315425f + fConst503);
fConst505 = (1.0f / (1.450071084655647f + ((0.7431304601070396f + fConst500) / fConst499)));
fConst506 = (11.052052171507189f / fConst502);
fConst507 = (1.450071084655647f + fConst506);
fConst508 = (1.0f / (4.076781969643807f + ((3.1897274020965583f + fConst500) / fConst499)));
fConst509 = (0.0017661728399818856f / fConst502);
fConst510 = (0.00040767818495825777f + fConst509);
fConst511 = (1.0f / (1.069358407707312f + ((0.168404871113589f + fConst43) / fConst42)));
fConst512 = (53.53615295455673f + fConst47);
fConst513 = (1.0f / (0.689621364484675f + ((0.512478641889141f + fConst43) / fConst42)));
fConst514 = (7.621731298870603f + fConst47);
fConst515 = (1.0f / (0.24529150870616f + ((0.782413046821645f + fConst43) / fConst42)));
fConst516 = (9.9999997055e-05f / fConst46);
fConst517 = (0.000433227200555f + fConst516);
fConst518 = (0.24529150870616f + ((fConst43 - 0.782413046821645f) / fConst42));
fConst519 = (2 * (0.24529150870616f - fConst47));
for (int i=0; i<3; i++) fRec180[i] = 0;
fConst520 = (2 * (0.000433227200555f - fConst516));
fConst521 = (0.689621364484675f + ((fConst43 - 0.512478641889141f) / fConst42));
fConst522 = (2 * (0.689621364484675f - fConst47));
for (int i=0; i<3; i++) fRec179[i] = 0;
fConst523 = (2 * (7.621731298870603f - fConst47));
fConst524 = (1.069358407707312f + ((fConst43 - 0.168404871113589f) / fConst42));
fConst525 = (2 * (1.069358407707312f - fConst47));
for (int i=0; i<3; i++) fRec178[i] = 0;
fConst526 = (2 * (53.53615295455673f - fConst47));
fConst527 = (4.076781969643807f + ((fConst500 - 3.1897274020965583f) / fConst499));
fConst528 = (1.0f / fConst502);
fConst529 = (2 * (4.076781969643807f - fConst528));
for (int i=0; i<3; i++) fRec177[i] = 0;
fConst530 = (2 * (0.00040767818495825777f - fConst509));
fConst531 = (1.450071084655647f + ((fConst500 - 0.7431304601070396f) / fConst499));
fConst532 = (2 * (1.450071084655647f - fConst528));
for (int i=0; i<3; i++) fRec176[i] = 0;
fConst533 = (2 * (1.450071084655647f - fConst506));
fConst534 = (0.9351401670315425f + ((fConst500 - 0.157482159302087f) / fConst499));
fConst535 = (2 * (0.9351401670315425f - fConst528));
for (int i=0; i<3; i++) fRec175[i] = 0;
fConst536 = (2 * (0.9351401670315425f - fConst503));
for (int i=0; i<2; i++) fRec174[i] = 0;
fConst537 = tanf((194.803417311094f / float(iConst0)));
fConst538 = (1.0f / fConst537);
fConst539 = (1.0f / (0.9351401670315425f + ((0.157482159302087f + fConst538) / fConst537)));
fConst540 = faustpower<2>(fConst537);
fConst541 = (50.063807016150385f / fConst540);
fConst542 = (0.9351401670315425f + fConst541);
fConst543 = (1.0f / (1.450071084655647f + ((0.7431304601070396f + fConst538) / fConst537)));
fConst544 = (11.052052171507189f / fConst540);
fConst545 = (1.450071084655647f + fConst544);
fConst546 = (1.0f / (4.076781969643807f + ((3.1897274020965583f + fConst538) / fConst537)));
fConst547 = (0.0017661728399818856f / fConst540);
fConst548 = (0.00040767818495825777f + fConst547);
fConst549 = (1.0f / (1.069358407707312f + ((0.168404871113589f + fConst500) / fConst499)));
fConst550 = (53.53615295455673f + fConst528);
fConst551 = (1.0f / (0.689621364484675f + ((0.512478641889141f + fConst500) / fConst499)));
fConst552 = (7.621731298870603f + fConst528);
fConst553 = (1.0f / (0.24529150870616f + ((0.782413046821645f + fConst500) / fConst499)));
fConst554 = (9.9999997055e-05f / fConst502);
fConst555 = (0.000433227200555f + fConst554);
fConst556 = (0.24529150870616f + ((fConst500 - 0.782413046821645f) / fConst499));
fConst557 = (2 * (0.24529150870616f - fConst528));
for (int i=0; i<3; i++) fRec187[i] = 0;
fConst558 = (2 * (0.000433227200555f - fConst554));
fConst559 = (0.689621364484675f + ((fConst500 - 0.512478641889141f) / fConst499));
fConst560 = (2 * (0.689621364484675f - fConst528));
for (int i=0; i<3; i++) fRec186[i] = 0;
fConst561 = (2 * (7.621731298870603f - fConst528));
fConst562 = (1.069358407707312f + ((fConst500 - 0.168404871113589f) / fConst499));
fConst563 = (2 * (1.069358407707312f - fConst528));
for (int i=0; i<3; i++) fRec185[i] = 0;
fConst564 = (2 * (53.53615295455673f - fConst528));
fConst565 = (4.076781969643807f + ((fConst538 - 3.1897274020965583f) / fConst537));
fConst566 = (1.0f / fConst540);
fConst567 = (2 * (4.076781969643807f - fConst566));
for (int i=0; i<3; i++) fRec184[i] = 0;
fConst568 = (2 * (0.00040767818495825777f - fConst547));
fConst569 = (1.450071084655647f + ((fConst538 - 0.7431304601070396f) / fConst537));
fConst570 = (2 * (1.450071084655647f - fConst566));
for (int i=0; i<3; i++) fRec183[i] = 0;
fConst571 = (2 * (1.450071084655647f - fConst544));
fConst572 = (0.9351401670315425f + ((fConst538 - 0.157482159302087f) / fConst537));
fConst573 = (2 * (0.9351401670315425f - fConst566));
for (int i=0; i<3; i++) fRec182[i] = 0;
fConst574 = (2 * (0.9351401670315425f - fConst541));
for (int i=0; i<2; i++) fRec181[i] = 0;
fConst575 = (1.0f / (0.9351401670315425f + ((fConst30 + 0.157482159302087f) / fConst29)));
fConst576 = (50.063807016150385f / fConst33);
fConst577 = (0.9351401670315425f + fConst576);
fConst578 = (1.0f / (1.450071084655647f + ((fConst30 + 0.7431304601070396f) / fConst29)));
fConst579 = (11.052052171507189f / fConst33);
fConst580 = (1.450071084655647f + fConst579);
fConst581 = (1.0f / (4.076781969643807f + ((fConst30 + 3.1897274020965583f) / fConst29)));
fConst582 = (0.0017661728399818856f / fConst33);
fConst583 = (0.00040767818495825777f + fConst582);
fConst584 = (1.0f / (1.069358407707312f + ((0.168404871113589f + fConst538) / fConst537)));
fConst585 = (53.53615295455673f + fConst566);
fConst586 = (1.0f / (0.689621364484675f + ((0.512478641889141f + fConst538) / fConst537)));
fConst587 = (7.621731298870603f + fConst566);
fConst588 = (1.0f / (0.24529150870616f + ((0.782413046821645f + fConst538) / fConst537)));
fConst589 = (9.9999997055e-05f / fConst540);
fConst590 = (0.000433227200555f + fConst589);
fConst591 = (0.24529150870616f + ((fConst538 - 0.782413046821645f) / fConst537));
fConst592 = (2 * (0.24529150870616f - fConst566));
for (int i=0; i<3; i++) fRec194[i] = 0;
fConst593 = (2 * (0.000433227200555f - fConst589));
fConst594 = (0.689621364484675f + ((fConst538 - 0.512478641889141f) / fConst537));
fConst595 = (2 * (0.689621364484675f - fConst566));
for (int i=0; i<3; i++) fRec193[i] = 0;
fConst596 = (2 * (7.621731298870603f - fConst566));
fConst597 = (1.069358407707312f + ((fConst538 - 0.168404871113589f) / fConst537));
fConst598 = (2 * (1.069358407707312f - fConst566));
for (int i=0; i<3; i++) fRec192[i] = 0;
fConst599 = (2 * (53.53615295455673f - fConst566));
fConst600 = (4.076781969643807f + ((fConst30 - 3.1897274020965583f) / fConst29));
fConst601 = (2 * (4.076781969643807f - fConst34));
for (int i=0; i<3; i++) fRec191[i] = 0;
fConst602 = (2 * (0.00040767818495825777f - fConst582));
fConst603 = (1.450071084655647f + ((fConst30 - 0.7431304601070396f) / fConst29));
fConst604 = (2 * (1.450071084655647f - fConst34));
for (int i=0; i<3; i++) fRec190[i] = 0;
fConst605 = (2 * (1.450071084655647f - fConst579));
fConst606 = (0.9351401670315425f + ((fConst30 - 0.157482159302087f) / fConst29));
fConst607 = (2 * (0.9351401670315425f - fConst34));
for (int i=0; i<3; i++) fRec189[i] = 0;
fConst608 = (2 * (0.9351401670315425f - fConst576));
for (int i=0; i<2; i++) fRec188[i] = 0;
fConst609 = tanf((77.3077873916577f / float(iConst0)));
fConst610 = (1.0f / fConst609);
fConst611 = (1.0f / (0.9351401670315425f + ((0.157482159302087f + fConst610) / fConst609)));
fConst612 = faustpower<2>(fConst609);
fConst613 = (50.063807016150385f / fConst612);
fConst614 = (0.9351401670315425f + fConst613);
fConst615 = (1.0f / (1.450071084655647f + ((0.7431304601070396f + fConst610) / fConst609)));
fConst616 = (11.052052171507189f / fConst612);
fConst617 = (1.450071084655647f + fConst616);
fConst618 = (1.0f / (4.076781969643807f + ((3.1897274020965583f + fConst610) / fConst609)));
fConst619 = (0.0017661728399818856f / fConst612);
fConst620 = (0.00040767818495825777f + fConst619);
fConst621 = (1.0f / (1.069358407707312f + ((0.168404871113589f + fConst30) / fConst29)));
fConst622 = (53.53615295455673f + fConst34);
fConst623 = (1.0f / (0.689621364484675f + ((0.512478641889141f + fConst30) / fConst29)));
fConst624 = (7.621731298870603f + fConst34);
fConst625 = (1.0f / (0.24529150870616f + ((0.782413046821645f + fConst30) / fConst29)));
fConst626 = (9.9999997055e-05f / fConst33);
fConst627 = (0.000433227200555f + fConst626);
fConst628 = (0.24529150870616f + ((fConst30 - 0.782413046821645f) / fConst29));
fConst629 = (2 * (0.24529150870616f - fConst34));
for (int i=0; i<3; i++) fRec201[i] = 0;
fConst630 = (2 * (0.000433227200555f - fConst626));
fConst631 = (0.689621364484675f + ((fConst30 - 0.512478641889141f) / fConst29));
fConst632 = (2 * (0.689621364484675f - fConst34));
for (int i=0; i<3; i++) fRec200[i] = 0;
fConst633 = (2 * (7.621731298870603f - fConst34));
fConst634 = (1.069358407707312f + ((fConst30 - 0.168404871113589f) / fConst29));
fConst635 = (2 * (1.069358407707312f - fConst34));
for (int i=0; i<3; i++) fRec199[i] = 0;
fConst636 = (2 * (53.53615295455673f - fConst34));
fConst637 = (4.076781969643807f + ((fConst610 - 3.1897274020965583f) / fConst609));
fConst638 = (1.0f / fConst612);
fConst639 = (2 * (4.076781969643807f - fConst638));
for (int i=0; i<3; i++) fRec198[i] = 0;
fConst640 = (2 * (0.00040767818495825777f - fConst619));
fConst641 = (1.450071084655647f + ((fConst610 - 0.7431304601070396f) / fConst609));
fConst642 = (2 * (1.450071084655647f - fConst638));
for (int i=0; i<3; i++) fRec197[i] = 0;
fConst643 = (2 * (1.450071084655647f - fConst616));
fConst644 = (0.9351401670315425f + ((fConst610 - 0.157482159302087f) / fConst609));
fConst645 = (2 * (0.9351401670315425f - fConst638));
for (int i=0; i<3; i++) fRec196[i] = 0;
fConst646 = (2 * (0.9351401670315425f - fConst613));
for (int i=0; i<2; i++) fRec195[i] = 0;
fConst647 = (1.0f / (1.069358407707312f + ((0.168404871113589f + fConst610) / fConst609)));
fConst648 = (53.53615295455673f + fConst638);
fConst649 = (1.0f / (0.689621364484675f + ((0.512478641889141f + fConst610) / fConst609)));
fConst650 = (7.621731298870603f + fConst638);
fConst651 = (1.0f / (0.24529150870616f + ((0.782413046821645f + fConst610) / fConst609)));
fConst652 = (9.9999997055e-05f / fConst612);
fConst653 = (0.000433227200555f + fConst652);
fConst654 = (0.24529150870616f + ((fConst610 - 0.782413046821645f) / fConst609));
fConst655 = (2 * (0.24529150870616f - fConst638));
for (int i=0; i<3; i++) fRec205[i] = 0;
fConst656 = (2 * (0.000433227200555f - fConst652));
fConst657 = (0.689621364484675f + ((fConst610 - 0.512478641889141f) / fConst609));
fConst658 = (2 * (0.689621364484675f - fConst638));
for (int i=0; i<3; i++) fRec204[i] = 0;
fConst659 = (2 * (7.621731298870603f - fConst638));
fConst660 = (1.069358407707312f + ((fConst610 - 0.168404871113589f) / fConst609));
fConst661 = (2 * (1.069358407707312f - fConst638));
for (int i=0; i<3; i++) fRec203[i] = 0;
fConst662 = (2 * (53.53615295455673f - fConst638));
for (int i=0; i<2; i++) fRec202[i] = 0;
}
virtual void init(int samplingFreq) {
classInit(samplingFreq);
instanceInit(samplingFreq);
}
virtual void buildUserInterface(UI* interface) {
interface->openVerticalBox("graphic_eq");
interface->declare(0, "1", "");
interface->openVerticalBox("");
interface->declare(0, "0", "");
interface->declare(0, "tooltip", "See Faust's oscillator.lib for documentation and references");
interface->openVerticalBox("SAWTOOTH OSCILLATOR");
interface->declare(0, "1", "");
interface->openHorizontalBox("");
interface->declare(&fslider2, "1", "");
interface->declare(&fslider2, "style", "knob");
interface->declare(&fslider2, "tooltip", "Sawtooth waveform amplitude");
interface->declare(&fslider2, "unit", "dB");
interface->addVerticalSlider("Amplitude", &fslider2, -2e+01f, -1.2e+02f, 1e+01f, 0.1f);
interface->declare(&fslider4, "2", "");
interface->declare(&fslider4, "style", "knob");
interface->declare(&fslider4, "tooltip", "Sawtooth frequency as a Piano Key (PK) number (A440 = key 49)");
interface->declare(&fslider4, "unit", "PK");
interface->addVerticalSlider("Frequency", &fslider4, 49.0f, 1.0f, 88.0f, 0.01f);
interface->declare(&fslider5, "3", "");
interface->declare(&fslider5, "style", "knob");
interface->declare(&fslider5, "tooltip", "Percentange frequency-shift up or down for second oscillator");
interface->declare(&fslider5, "unit", "%%");
interface->addVerticalSlider("Detuning 1", &fslider5, -0.1f, -1e+01f, 1e+01f, 0.01f);
interface->declare(&fslider6, "4", "");
interface->declare(&fslider6, "style", "knob");
interface->declare(&fslider6, "tooltip", "Percentange frequency-shift up or down for third detuned oscillator");
interface->declare(&fslider6, "unit", "%%");
interface->addVerticalSlider("Detuning 2", &fslider6, 0.1f, -1e+01f, 1e+01f, 0.01f);
interface->declare(&fslider3, "5", "");
interface->declare(&fslider3, "style", "knob");
interface->declare(&fslider3, "tooltip", "Portamento (frequency-glide) time-constant in seconds");
interface->declare(&fslider3, "unit", "sec");
interface->addVerticalSlider("Portamento", &fslider3, 0.1f, 0.01f, 1.0f, 0.001f);
interface->declare(0, "6", "");
interface->openVerticalBox("Alternate Signals");
interface->declare(&fcheckbox2, "0", "");
interface->declare(&fcheckbox2, "tooltip", "Pink Noise (or 1/f noise) is Constant-Q Noise, meaning that it has the same total power in every octave");
interface->addCheckButton("Pink Noise Instead (uses only Amplitude control on the left)", &fcheckbox2);
interface->declare(&fcheckbox1, "1", "");
interface->addCheckButton("External Input Instead (overrides Sawtooth/Noise selection above)", &fcheckbox1);
interface->closeBox();
interface->closeBox();
interface->closeBox();
interface->closeBox();
interface->declare(0, "2", "");
interface->openVerticalBox("");
interface->declare(0, "tooltip", "See Faust's filter.lib for documentation and references");
interface->openVerticalBox("CONSTANT-Q FILTER BANK (Butterworth dyadic tree)");
interface->declare(0, "0", "");
interface->openHorizontalBox("");
interface->declare(&fcheckbox0, "0", "");
interface->declare(&fcheckbox0, "tooltip", "When this is checked, the filter-bank has no effect");
interface->addCheckButton("Bypass", &fcheckbox0);
interface->closeBox();
interface->declare(0, "1", "");
interface->openHorizontalBox("");
interface->declare(&fslider16, "1", "");
interface->declare(&fslider16, "tooltip", "Bandpass filter gain in dB");
interface->declare(&fslider16, "unit", "dB");
interface->addVerticalSlider("", &fslider16, -1e+01f, -7e+01f, 1e+01f, 0.1f);
interface->declare(&fslider15, "2", "");
interface->declare(&fslider15, "tooltip", "Bandpass filter gain in dB");
interface->declare(&fslider15, "unit", "dB");
interface->addVerticalSlider("", &fslider15, -1e+01f, -7e+01f, 1e+01f, 0.1f);
interface->declare(&fslider14, "3", "");
interface->declare(&fslider14, "tooltip", "Bandpass filter gain in dB");
interface->declare(&fslider14, "unit", "dB");
interface->addVerticalSlider("", &fslider14, -1e+01f, -7e+01f, 1e+01f, 0.1f);
interface->declare(&fslider13, "4", "");
interface->declare(&fslider13, "tooltip", "Bandpass filter gain in dB");
interface->declare(&fslider13, "unit", "dB");
interface->addVerticalSlider("", &fslider13, -1e+01f, -7e+01f, 1e+01f, 0.1f);
interface->declare(&fslider12, "5", "");
interface->declare(&fslider12, "tooltip", "Bandpass filter gain in dB");
interface->declare(&fslider12, "unit", "dB");
interface->addVerticalSlider("", &fslider12, -1e+01f, -7e+01f, 1e+01f, 0.1f);
interface->declare(&fslider11, "6", "");
interface->declare(&fslider11, "tooltip", "Bandpass filter gain in dB");
interface->declare(&fslider11, "unit", "dB");
interface->addVerticalSlider("", &fslider11, -1e+01f, -7e+01f, 1e+01f, 0.1f);
interface->declare(&fslider10, "7", "");
interface->declare(&fslider10, "tooltip", "Bandpass filter gain in dB");
interface->declare(&fslider10, "unit", "dB");
interface->addVerticalSlider("", &fslider10, -1e+01f, -7e+01f, 1e+01f, 0.1f);
interface->declare(&fslider9, "8", "");
interface->declare(&fslider9, "tooltip", "Bandpass filter gain in dB");
interface->declare(&fslider9, "unit", "dB");
interface->addVerticalSlider("", &fslider9, -1e+01f, -7e+01f, 1e+01f, 0.1f);
interface->declare(&fslider8, "9", "");
interface->declare(&fslider8, "tooltip", "Bandpass filter gain in dB");
interface->declare(&fslider8, "unit", "dB");
interface->addVerticalSlider("", &fslider8, -1e+01f, -7e+01f, 1e+01f, 0.1f);
interface->declare(&fslider7, "10", "");
interface->declare(&fslider7, "tooltip", "Bandpass filter gain in dB");
interface->declare(&fslider7, "unit", "dB");
interface->addVerticalSlider("", &fslider7, -1e+01f, -7e+01f, 1e+01f, 0.1f);
interface->closeBox();
interface->closeBox();
interface->closeBox();
interface->declare(0, "3", "");
interface->openVerticalBox("");
interface->declare(0, "0", "");
interface->declare(0, "tooltip", "See Faust's filter.lib for documentation and references");
interface->openHorizontalBox("CONSTANT-Q SPECTRUM ANALYZER (6E)");
interface->declare(&fbargraph14, "0", "");
interface->declare(&fbargraph14, "tooltip", "Spectral Band Level in dB");
interface->declare(&fbargraph14, "unit", "dB");
interface->addVerticalBargraph("", &fbargraph14, -5e+01f, 1e+01f);
interface->declare(&fbargraph13, "1", "");
interface->declare(&fbargraph13, "tooltip", "Spectral Band Level in dB");
interface->declare(&fbargraph13, "unit", "dB");
interface->addVerticalBargraph("", &fbargraph13, -5e+01f, 1e+01f);
interface->declare(&fbargraph12, "2", "");
interface->declare(&fbargraph12, "tooltip", "Spectral Band Level in dB");
interface->declare(&fbargraph12, "unit", "dB");
interface->addVerticalBargraph("", &fbargraph12, -5e+01f, 1e+01f);
interface->declare(&fbargraph11, "3", "");
interface->declare(&fbargraph11, "tooltip", "Spectral Band Level in dB");
interface->declare(&fbargraph11, "unit", "dB");
interface->addVerticalBargraph("", &fbargraph11, -5e+01f, 1e+01f);
interface->declare(&fbargraph10, "4", "");
interface->declare(&fbargraph10, "tooltip", "Spectral Band Level in dB");
interface->declare(&fbargraph10, "unit", "dB");
interface->addVerticalBargraph("", &fbargraph10, -5e+01f, 1e+01f);
interface->declare(&fbargraph9, "5", "");
interface->declare(&fbargraph9, "tooltip", "Spectral Band Level in dB");
interface->declare(&fbargraph9, "unit", "dB");
interface->addVerticalBargraph("", &fbargraph9, -5e+01f, 1e+01f);
interface->declare(&fbargraph8, "6", "");
interface->declare(&fbargraph8, "tooltip", "Spectral Band Level in dB");
interface->declare(&fbargraph8, "unit", "dB");
interface->addVerticalBargraph("", &fbargraph8, -5e+01f, 1e+01f);
interface->declare(&fbargraph7, "7", "");
interface->declare(&fbargraph7, "tooltip", "Spectral Band Level in dB");
interface->declare(&fbargraph7, "unit", "dB");
interface->addVerticalBargraph("", &fbargraph7, -5e+01f, 1e+01f);
interface->declare(&fbargraph6, "8", "");
interface->declare(&fbargraph6, "tooltip", "Spectral Band Level in dB");
interface->declare(&fbargraph6, "unit", "dB");
interface->addVerticalBargraph("", &fbargraph6, -5e+01f, 1e+01f);
interface->declare(&fbargraph5, "9", "");
interface->declare(&fbargraph5, "tooltip", "Spectral Band Level in dB");
interface->declare(&fbargraph5, "unit", "dB");
interface->addVerticalBargraph("", &fbargraph5, -5e+01f, 1e+01f);
interface->declare(&fbargraph4, "10", "");
interface->declare(&fbargraph4, "tooltip", "Spectral Band Level in dB");
interface->declare(&fbargraph4, "unit", "dB");
interface->addVerticalBargraph("", &fbargraph4, -5e+01f, 1e+01f);
interface->declare(&fbargraph3, "11", "");
interface->declare(&fbargraph3, "tooltip", "Spectral Band Level in dB");
interface->declare(&fbargraph3, "unit", "dB");
interface->addVerticalBargraph("", &fbargraph3, -5e+01f, 1e+01f);
interface->declare(&fbargraph2, "12", "");
interface->declare(&fbargraph2, "tooltip", "Spectral Band Level in dB");
interface->declare(&fbargraph2, "unit", "dB");
interface->addVerticalBargraph("", &fbargraph2, -5e+01f, 1e+01f);
interface->declare(&fbargraph1, "13", "");
interface->declare(&fbargraph1, "tooltip", "Spectral Band Level in dB");
interface->declare(&fbargraph1, "unit", "dB");
interface->addVerticalBargraph("", &fbargraph1, -5e+01f, 1e+01f);
interface->declare(&fbargraph0, "14", "");
interface->declare(&fbargraph0, "tooltip", "Spectral Band Level in dB");
interface->declare(&fbargraph0, "unit", "dB");
interface->addVerticalBargraph("", &fbargraph0, -5e+01f, 1e+01f);
interface->closeBox();
interface->declare(0, "1", "");
interface->openHorizontalBox("SPECTRUM ANALYZER CONTROLS");
interface->declare(&fslider1, "0", "");
interface->declare(&fslider1, "tooltip", "band-level averaging time in seconds");
interface->declare(&fslider1, "unit", "sec");
interface->addHorizontalSlider("Level Averaging Time", &fslider1, 0.1f, 0.0f, 1.0f, 0.01f);
interface->declare(&fslider0, "1", "");
interface->declare(&fslider0, "tooltip", "Level offset in decibels");
interface->declare(&fslider0, "unit", "dB");
interface->addHorizontalSlider("Level dB Offset", &fslider0, 5e+01f, 0.0f, 1e+02f, 1.0f);
interface->closeBox();
interface->closeBox();
interface->closeBox();
}
virtual void compute (int count, FAUSTFLOAT** input, FAUSTFLOAT** output) {
float fSlow0 = fslider0;
float fSlow1 = expf((0 - (fConst1 / fslider1)));
float fSlow2 = (1.0f - fSlow1);
int iSlow3 = int(fcheckbox0);
float fSlow4 = (0.0010000000000000009f * powf(10,(0.05f * fslider2)));
int iSlow5 = int(fcheckbox1);
int iSlow6 = int(fcheckbox2);
float fSlow7 = expf((0 - (fConst1 / fslider3)));
float fSlow8 = (4.4e+02f * (powf(2.0f,(0.08333333333333333f * (fslider4 - 49.0f))) * (1.0f - fSlow7)));
float fSlow9 = (1 + (0.01f * fslider5));
float fSlow10 = (1.0f / fSlow9);
float fSlow11 = (fConst16 * fSlow9);
float fSlow12 = (fConst15 / fSlow9);
float fSlow13 = (1 + (0.01f * fslider6));
float fSlow14 = (1.0f / fSlow13);
float fSlow15 = (fConst16 * fSlow13);
float fSlow16 = (fConst15 / fSlow13);
float fSlow17 = (0.0010000000000000009f * fslider7);
float fSlow18 = (0.0010000000000000009f * fslider8);
float fSlow19 = (0.0010000000000000009f * fslider9);
float fSlow20 = (0.0010000000000000009f * fslider10);
float fSlow21 = (0.0010000000000000009f * fslider11);
float fSlow22 = (0.0010000000000000009f * fslider12);
float fSlow23 = (0.0010000000000000009f * fslider13);
float fSlow24 = (0.0010000000000000009f * fslider14);
float fSlow25 = (0.0010000000000000009f * fslider15);
float fSlow26 = (0.0010000000000000009f * fslider16);
FAUSTFLOAT* input0 = input[0];
FAUSTFLOAT* output0 = output[0];
FAUSTFLOAT* output1 = output[1];
for (int i=0; i<count; i++) {
fRec4[0] = ((0.999f * fRec4[1]) + fSlow4);
iRec6[0] = (12345 + (1103515245 * iRec6[1]));
fRec5[0] = (((0.5221894f * fRec5[3]) + ((4.656612875245797e-10f * iRec6[0]) + (2.494956002f * fRec5[1]))) - (2.017265875f * fRec5[2]));
fVec0[0] = 0.25f;
fRec7[0] = ((fSlow7 * fRec7[1]) + fSlow8);
fRec8[0] = fmodf((1.0f + fRec8[1]),(fConst15 / fRec7[0]));
float fTemp0 = faustpower<2>(((fConst16 * (fRec7[0] * fRec8[0])) - 1.0f));
fVec1[0] = fTemp0;
fRec9[0] = fmodf((1.0f + fRec9[1]),(fSlow12 / fRec7[0]));
float fTemp1 = faustpower<2>(((fSlow11 * (fRec7[0] * fRec9[0])) - 1.0f));
fVec2[0] = fTemp1;
fRec10[0] = fmodf((1.0f + fRec10[1]),(fSlow16 / fRec7[0]));
float fTemp2 = faustpower<2>(((fSlow15 * (fRec7[0] * fRec10[0])) - 1.0f));
fVec3[0] = fTemp2;
float fTemp3 = (fRec4[0] * ((iSlow5)?(float)input0[i]:((iSlow6)?(((0.049922035f * fRec5[0]) + (0.050612699f * fRec5[2])) - ((0.095993537f * fRec5[1]) + (0.004408786f * fRec5[3]))):(fConst14 * (((fRec4[0] * fVec0[1]) * (((fVec1[0] - fVec1[1]) + (fSlow10 * (fVec2[0] - fVec2[1]))) + (fSlow14 * (fVec3[0] - fVec3[1])))) / fRec7[0])))));
float fTemp4 = ((iSlow3)?0:fTemp3);
fVec4[0] = fTemp4;
fRec21[0] = ((fConst22 * fRec21[1]) + (fConst23 * ((fConst3 * fVec4[0]) + (fConst24 * fVec4[1]))));
fRec20[0] = (fRec21[0] - (fConst20 * ((fConst25 * fRec20[2]) + (fConst26 * fRec20[1]))));
fRec19[0] = ((fConst20 * (((fConst19 * fRec20[0]) + (fConst27 * fRec20[1])) + (fConst19 * fRec20[2]))) - (fConst18 * ((fConst28 * fRec19[2]) + (fConst26 * fRec19[1]))));
float fTemp5 = (fConst35 * fRec18[1]);
fRec18[0] = ((fConst18 * (((fConst19 * fRec19[0]) + (fConst27 * fRec19[1])) + (fConst19 * fRec19[2]))) - (fConst31 * ((fConst32 * fRec18[2]) + fTemp5)));
float fTemp6 = (fConst41 * fRec17[1]);
fRec17[0] = ((fRec18[2] + (fConst31 * (fTemp5 + (fConst32 * fRec18[0])))) - (fConst38 * ((fConst39 * fRec17[2]) + fTemp6)));
float fTemp7 = (fConst48 * fRec16[1]);
fRec16[0] = ((fRec17[2] + (fConst38 * (fTemp6 + (fConst39 * fRec17[0])))) - (fConst44 * ((fConst45 * fRec16[2]) + fTemp7)));
float fTemp8 = (fConst54 * fRec15[1]);
fRec15[0] = ((fRec16[2] + (fConst44 * (fTemp7 + (fConst45 * fRec16[0])))) - (fConst51 * ((fConst52 * fRec15[2]) + fTemp8)));
float fTemp9 = (fConst61 * fRec14[1]);
fRec14[0] = ((fRec15[2] + (fConst51 * (fTemp8 + (fConst52 * fRec15[0])))) - (fConst57 * ((fConst58 * fRec14[2]) + fTemp9)));
float fTemp10 = (fConst67 * fRec13[1]);
fRec13[0] = ((fRec14[2] + (fConst57 * (fTemp9 + (fConst58 * fRec14[0])))) - (fConst64 * ((fConst65 * fRec13[2]) + fTemp10)));
float fTemp11 = (fConst74 * fRec12[1]);
fRec12[0] = ((fRec13[2] + (fConst64 * (fTemp10 + (fConst65 * fRec13[0])))) - (fConst70 * ((fConst71 * fRec12[2]) + fTemp11)));
float fTemp12 = (fConst80 * fRec11[1]);
fRec11[0] = ((fRec12[2] + (fConst70 * (fTemp11 + (fConst71 * fRec12[0])))) - (fConst77 * ((fConst78 * fRec11[2]) + fTemp12)));
fRec22[0] = ((0.999f * fRec22[1]) + fSlow17);
fRec35[0] = ((fConst22 * fRec35[1]) + (fConst23 * (fVec4[0] + fVec4[1])));
fRec34[0] = (fRec35[0] - (fConst20 * ((fConst25 * fRec34[2]) + (fConst26 * fRec34[1]))));
fRec33[0] = ((fConst20 * (fRec34[2] + (fRec34[0] + (2 * fRec34[1])))) - (fConst18 * ((fConst28 * fRec33[2]) + (fConst26 * fRec33[1]))));
float fTemp13 = (fRec33[2] + (fRec33[0] + (2 * fRec33[1])));
fVec5[0] = fTemp13;
fRec32[0] = ((fConst85 * fRec32[1]) + (fConst86 * ((fConst76 * fVec5[0]) + (fConst87 * fVec5[1]))));
fRec31[0] = (fRec32[0] - (fConst83 * ((fConst88 * fRec31[2]) + (fConst80 * fRec31[1]))));
fRec30[0] = ((fConst83 * (((fConst79 * fRec31[0]) + (fConst89 * fRec31[1])) + (fConst79 * fRec31[2]))) - (fConst82 * ((fConst90 * fRec30[2]) + (fConst80 * fRec30[1]))));
float fTemp14 = (fConst35 * fRec29[1]);
fRec29[0] = ((fConst82 * (((fConst79 * fRec30[0]) + (fConst89 * fRec30[1])) + (fConst79 * fRec30[2]))) - (fConst31 * ((fConst32 * fRec29[2]) + fTemp14)));
float fTemp15 = (fConst41 * fRec28[1]);
fRec28[0] = ((fRec29[2] + (fConst31 * (fTemp14 + (fConst32 * fRec29[0])))) - (fConst38 * ((fConst39 * fRec28[2]) + fTemp15)));
float fTemp16 = (fConst48 * fRec27[1]);
fRec27[0] = ((fRec28[2] + (fConst38 * (fTemp15 + (fConst39 * fRec28[0])))) - (fConst44 * ((fConst45 * fRec27[2]) + fTemp16)));
float fTemp17 = (fConst54 * fRec26[1]);
fRec26[0] = ((fRec27[2] + (fConst44 * (fTemp16 + (fConst45 * fRec27[0])))) - (fConst51 * ((fConst52 * fRec26[2]) + fTemp17)));
float fTemp18 = (fConst61 * fRec25[1]);
fRec25[0] = ((fRec26[2] + (fConst51 * (fTemp17 + (fConst52 * fRec26[0])))) - (fConst57 * ((fConst58 * fRec25[2]) + fTemp18)));
float fTemp19 = (fConst67 * fRec24[1]);
fRec24[0] = ((fRec25[2] + (fConst57 * (fTemp18 + (fConst58 * fRec25[0])))) - (fConst64 * ((fConst65 * fRec24[2]) + fTemp19)));
float fTemp20 = (fConst74 * fRec23[1]);
fRec23[0] = ((fRec24[2] + (fConst64 * (fTemp19 + (fConst65 * fRec24[0])))) - (fConst70 * ((fConst71 * fRec23[2]) + fTemp20)));
fRec36[0] = ((0.999f * fRec36[1]) + fSlow18);
fRec48[0] = ((fConst85 * fRec48[1]) + (fConst86 * (fVec5[0] + fVec5[1])));
fRec47[0] = (fRec48[0] - (fConst83 * ((fConst88 * fRec47[2]) + (fConst80 * fRec47[1]))));
fRec46[0] = ((fConst83 * (fRec47[2] + (fRec47[0] + (2 * fRec47[1])))) - (fConst82 * ((fConst90 * fRec46[2]) + (fConst80 * fRec46[1]))));
float fTemp21 = (fRec46[2] + (fRec46[0] + (2 * fRec46[1])));
fVec6[0] = fTemp21;
fRec45[0] = ((fConst95 * fRec45[1]) + (fConst96 * ((fConst69 * fVec6[0]) + (fConst97 * fVec6[1]))));
fRec44[0] = (fRec45[0] - (fConst93 * ((fConst98 * fRec44[2]) + (fConst74 * fRec44[1]))));
fRec43[0] = ((fConst93 * (((fConst73 * fRec44[0]) + (fConst99 * fRec44[1])) + (fConst73 * fRec44[2]))) - (fConst92 * ((fConst100 * fRec43[2]) + (fConst74 * fRec43[1]))));
float fTemp22 = (fConst35 * fRec42[1]);
fRec42[0] = ((fConst92 * (((fConst73 * fRec43[0]) + (fConst99 * fRec43[1])) + (fConst73 * fRec43[2]))) - (fConst31 * ((fConst32 * fRec42[2]) + fTemp22)));
float fTemp23 = (fConst41 * fRec41[1]);
fRec41[0] = ((fRec42[2] + (fConst31 * (fTemp22 + (fConst32 * fRec42[0])))) - (fConst38 * ((fConst39 * fRec41[2]) + fTemp23)));
float fTemp24 = (fConst48 * fRec40[1]);
fRec40[0] = ((fRec41[2] + (fConst38 * (fTemp23 + (fConst39 * fRec41[0])))) - (fConst44 * ((fConst45 * fRec40[2]) + fTemp24)));
float fTemp25 = (fConst54 * fRec39[1]);
fRec39[0] = ((fRec40[2] + (fConst44 * (fTemp24 + (fConst45 * fRec40[0])))) - (fConst51 * ((fConst52 * fRec39[2]) + fTemp25)));
float fTemp26 = (fConst61 * fRec38[1]);
fRec38[0] = ((fRec39[2] + (fConst51 * (fTemp25 + (fConst52 * fRec39[0])))) - (fConst57 * ((fConst58 * fRec38[2]) + fTemp26)));
float fTemp27 = (fConst67 * fRec37[1]);
fRec37[0] = ((fRec38[2] + (fConst57 * (fTemp26 + (fConst58 * fRec38[0])))) - (fConst64 * ((fConst65 * fRec37[2]) + fTemp27)));
fRec49[0] = ((0.999f * fRec49[1]) + fSlow19);
fRec60[0] = ((fConst95 * fRec60[1]) + (fConst96 * (fVec6[0] + fVec6[1])));
fRec59[0] = (fRec60[0] - (fConst93 * ((fConst98 * fRec59[2]) + (fConst74 * fRec59[1]))));
fRec58[0] = ((fConst93 * (fRec59[2] + (fRec59[0] + (2 * fRec59[1])))) - (fConst92 * ((fConst100 * fRec58[2]) + (fConst74 * fRec58[1]))));
float fTemp28 = (fRec58[2] + (fRec58[0] + (2 * fRec58[1])));
fVec7[0] = fTemp28;
fRec57[0] = ((fConst105 * fRec57[1]) + (fConst106 * ((fConst63 * fVec7[0]) + (fConst107 * fVec7[1]))));
fRec56[0] = (fRec57[0] - (fConst103 * ((fConst108 * fRec56[2]) + (fConst67 * fRec56[1]))));
fRec55[0] = ((fConst103 * (((fConst66 * fRec56[0]) + (fConst109 * fRec56[1])) + (fConst66 * fRec56[2]))) - (fConst102 * ((fConst110 * fRec55[2]) + (fConst67 * fRec55[1]))));
float fTemp29 = (fConst35 * fRec54[1]);
fRec54[0] = ((fConst102 * (((fConst66 * fRec55[0]) + (fConst109 * fRec55[1])) + (fConst66 * fRec55[2]))) - (fConst31 * ((fConst32 * fRec54[2]) + fTemp29)));
float fTemp30 = (fConst41 * fRec53[1]);
fRec53[0] = ((fRec54[2] + (fConst31 * (fTemp29 + (fConst32 * fRec54[0])))) - (fConst38 * ((fConst39 * fRec53[2]) + fTemp30)));
float fTemp31 = (fConst48 * fRec52[1]);
fRec52[0] = ((fRec53[2] + (fConst38 * (fTemp30 + (fConst39 * fRec53[0])))) - (fConst44 * ((fConst45 * fRec52[2]) + fTemp31)));
float fTemp32 = (fConst54 * fRec51[1]);
fRec51[0] = ((fRec52[2] + (fConst44 * (fTemp31 + (fConst45 * fRec52[0])))) - (fConst51 * ((fConst52 * fRec51[2]) + fTemp32)));
float fTemp33 = (fConst61 * fRec50[1]);
fRec50[0] = ((fRec51[2] + (fConst51 * (fTemp32 + (fConst52 * fRec51[0])))) - (fConst57 * ((fConst58 * fRec50[2]) + fTemp33)));
fRec61[0] = ((0.999f * fRec61[1]) + fSlow20);
fRec71[0] = ((fConst105 * fRec71[1]) + (fConst106 * (fVec7[0] + fVec7[1])));
fRec70[0] = (fRec71[0] - (fConst103 * ((fConst108 * fRec70[2]) + (fConst67 * fRec70[1]))));
fRec69[0] = ((fConst103 * (fRec70[2] + (fRec70[0] + (2 * fRec70[1])))) - (fConst102 * ((fConst110 * fRec69[2]) + (fConst67 * fRec69[1]))));
float fTemp34 = (fRec69[2] + (fRec69[0] + (2 * fRec69[1])));
fVec8[0] = fTemp34;
fRec68[0] = ((fConst115 * fRec68[1]) + (fConst116 * ((fConst56 * fVec8[0]) + (fConst117 * fVec8[1]))));
fRec67[0] = (fRec68[0] - (fConst113 * ((fConst118 * fRec67[2]) + (fConst61 * fRec67[1]))));
fRec66[0] = ((fConst113 * (((fConst60 * fRec67[0]) + (fConst119 * fRec67[1])) + (fConst60 * fRec67[2]))) - (fConst112 * ((fConst120 * fRec66[2]) + (fConst61 * fRec66[1]))));
float fTemp35 = (fConst35 * fRec65[1]);
fRec65[0] = ((fConst112 * (((fConst60 * fRec66[0]) + (fConst119 * fRec66[1])) + (fConst60 * fRec66[2]))) - (fConst31 * ((fConst32 * fRec65[2]) + fTemp35)));
float fTemp36 = (fConst41 * fRec64[1]);
fRec64[0] = ((fRec65[2] + (fConst31 * (fTemp35 + (fConst32 * fRec65[0])))) - (fConst38 * ((fConst39 * fRec64[2]) + fTemp36)));
float fTemp37 = (fConst48 * fRec63[1]);
fRec63[0] = ((fRec64[2] + (fConst38 * (fTemp36 + (fConst39 * fRec64[0])))) - (fConst44 * ((fConst45 * fRec63[2]) + fTemp37)));
float fTemp38 = (fConst54 * fRec62[1]);
fRec62[0] = ((fRec63[2] + (fConst44 * (fTemp37 + (fConst45 * fRec63[0])))) - (fConst51 * ((fConst52 * fRec62[2]) + fTemp38)));
fRec72[0] = ((0.999f * fRec72[1]) + fSlow21);
fRec81[0] = ((fConst115 * fRec81[1]) + (fConst116 * (fVec8[0] + fVec8[1])));
fRec80[0] = (fRec81[0] - (fConst113 * ((fConst118 * fRec80[2]) + (fConst61 * fRec80[1]))));
fRec79[0] = ((fConst113 * (fRec80[2] + (fRec80[0] + (2 * fRec80[1])))) - (fConst112 * ((fConst120 * fRec79[2]) + (fConst61 * fRec79[1]))));
float fTemp39 = (fRec79[2] + (fRec79[0] + (2 * fRec79[1])));
fVec9[0] = fTemp39;
fRec78[0] = ((fConst125 * fRec78[1]) + (fConst126 * ((fConst50 * fVec9[0]) + (fConst127 * fVec9[1]))));
fRec77[0] = (fRec78[0] - (fConst123 * ((fConst128 * fRec77[2]) + (fConst54 * fRec77[1]))));
fRec76[0] = ((fConst123 * (((fConst53 * fRec77[0]) + (fConst129 * fRec77[1])) + (fConst53 * fRec77[2]))) - (fConst122 * ((fConst130 * fRec76[2]) + (fConst54 * fRec76[1]))));
float fTemp40 = (fConst35 * fRec75[1]);
fRec75[0] = ((fConst122 * (((fConst53 * fRec76[0]) + (fConst129 * fRec76[1])) + (fConst53 * fRec76[2]))) - (fConst31 * ((fConst32 * fRec75[2]) + fTemp40)));
float fTemp41 = (fConst41 * fRec74[1]);
fRec74[0] = ((fRec75[2] + (fConst31 * (fTemp40 + (fConst32 * fRec75[0])))) - (fConst38 * ((fConst39 * fRec74[2]) + fTemp41)));
float fTemp42 = (fConst48 * fRec73[1]);
fRec73[0] = ((fRec74[2] + (fConst38 * (fTemp41 + (fConst39 * fRec74[0])))) - (fConst44 * ((fConst45 * fRec73[2]) + fTemp42)));
fRec82[0] = ((0.999f * fRec82[1]) + fSlow22);
fRec90[0] = ((fConst125 * fRec90[1]) + (fConst126 * (fVec9[0] + fVec9[1])));
fRec89[0] = (fRec90[0] - (fConst123 * ((fConst128 * fRec89[2]) + (fConst54 * fRec89[1]))));
fRec88[0] = ((fConst123 * (fRec89[2] + (fRec89[0] + (2 * fRec89[1])))) - (fConst122 * ((fConst130 * fRec88[2]) + (fConst54 * fRec88[1]))));
float fTemp43 = (fRec88[2] + (fRec88[0] + (2 * fRec88[1])));
fVec10[0] = fTemp43;
fRec87[0] = ((fConst135 * fRec87[1]) + (fConst136 * ((fConst43 * fVec10[0]) + (fConst137 * fVec10[1]))));
fRec86[0] = (fRec87[0] - (fConst133 * ((fConst138 * fRec86[2]) + (fConst48 * fRec86[1]))));
fRec85[0] = ((fConst133 * (((fConst47 * fRec86[0]) + (fConst139 * fRec86[1])) + (fConst47 * fRec86[2]))) - (fConst132 * ((fConst140 * fRec85[2]) + (fConst48 * fRec85[1]))));
float fTemp44 = (fConst35 * fRec84[1]);
fRec84[0] = ((fConst132 * (((fConst47 * fRec85[0]) + (fConst139 * fRec85[1])) + (fConst47 * fRec85[2]))) - (fConst31 * ((fConst32 * fRec84[2]) + fTemp44)));
float fTemp45 = (fConst41 * fRec83[1]);
fRec83[0] = ((fRec84[2] + (fConst31 * (fTemp44 + (fConst32 * fRec84[0])))) - (fConst38 * ((fConst39 * fRec83[2]) + fTemp45)));
fRec91[0] = ((0.999f * fRec91[1]) + fSlow23);
fRec98[0] = ((fConst135 * fRec98[1]) + (fConst136 * (fVec10[0] + fVec10[1])));
fRec97[0] = (fRec98[0] - (fConst133 * ((fConst138 * fRec97[2]) + (fConst48 * fRec97[1]))));
fRec96[0] = ((fConst133 * (fRec97[2] + (fRec97[0] + (2 * fRec97[1])))) - (fConst132 * ((fConst140 * fRec96[2]) + (fConst48 * fRec96[1]))));
float fTemp46 = (fRec96[2] + (fRec96[0] + (2 * fRec96[1])));
fVec11[0] = fTemp46;
fRec95[0] = ((fConst145 * fRec95[1]) + (fConst146 * ((fConst37 * fVec11[0]) + (fConst147 * fVec11[1]))));
fRec94[0] = (fRec95[0] - (fConst143 * ((fConst148 * fRec94[2]) + (fConst41 * fRec94[1]))));
fRec93[0] = ((fConst143 * (((fConst40 * fRec94[0]) + (fConst149 * fRec94[1])) + (fConst40 * fRec94[2]))) - (fConst142 * ((fConst150 * fRec93[2]) + (fConst41 * fRec93[1]))));
float fTemp47 = (fConst35 * fRec92[1]);
fRec92[0] = ((fConst142 * (((fConst40 * fRec93[0]) + (fConst149 * fRec93[1])) + (fConst40 * fRec93[2]))) - (fConst31 * ((fConst32 * fRec92[2]) + fTemp47)));
fRec99[0] = ((0.999f * fRec99[1]) + fSlow24);
fRec105[0] = ((fConst145 * fRec105[1]) + (fConst146 * (fVec11[0] + fVec11[1])));
fRec104[0] = (fRec105[0] - (fConst143 * ((fConst148 * fRec104[2]) + (fConst41 * fRec104[1]))));
fRec103[0] = ((fConst143 * (fRec104[2] + (fRec104[0] + (2 * fRec104[1])))) - (fConst142 * ((fConst150 * fRec103[2]) + (fConst41 * fRec103[1]))));
float fTemp48 = (fRec103[2] + (fRec103[0] + (2 * fRec103[1])));
fVec12[0] = fTemp48;
fRec102[0] = ((fConst154 * fRec102[1]) + (fConst155 * ((fConst30 * fVec12[0]) + (fConst156 * fVec12[1]))));
fRec101[0] = (fRec102[0] - (fConst152 * ((fConst157 * fRec101[2]) + (fConst35 * fRec101[1]))));
fRec100[0] = ((fConst152 * (((fConst34 * fRec101[0]) + (fConst158 * fRec101[1])) + (fConst34 * fRec101[2]))) - (fConst151 * ((fConst159 * fRec100[2]) + (fConst35 * fRec100[1]))));
fRec106[0] = ((0.999f * fRec106[1]) + fSlow25);
fRec109[0] = ((fConst154 * fRec109[1]) + (fConst155 * (fVec12[0] + fVec12[1])));
fRec108[0] = (fRec109[0] - (fConst152 * ((fConst157 * fRec108[2]) + (fConst35 * fRec108[1]))));
fRec107[0] = ((fConst152 * (fRec108[2] + (fRec108[0] + (2 * fRec108[1])))) - (fConst151 * ((fConst159 * fRec107[2]) + (fConst35 * fRec107[1]))));
fRec110[0] = ((0.999f * fRec110[1]) + fSlow26);
float fTemp49 = ((iSlow3)?fTemp3:((((((((((fRec11[2] + (fConst77 * (fTemp12 + (fConst78 * fRec11[0])))) * powf(10,(0.05f * fRec22[0]))) + ((fRec23[2] + (fConst70 * (fTemp20 + (fConst71 * fRec23[0])))) * powf(10,(0.05f * fRec36[0])))) + ((fRec37[2] + (fConst64 * (fTemp27 + (fConst65 * fRec37[0])))) * powf(10,(0.05f * fRec49[0])))) + ((fRec50[2] + (fConst57 * (fTemp33 + (fConst58 * fRec50[0])))) * powf(10,(0.05f * fRec61[0])))) + ((fRec62[2] + (fConst51 * (fTemp38 + (fConst52 * fRec62[0])))) * powf(10,(0.05f * fRec72[0])))) + ((fRec73[2] + (fConst44 * (fTemp42 + (fConst45 * fRec73[0])))) * powf(10,(0.05f * fRec82[0])))) + ((fRec83[2] + (fConst38 * (fTemp45 + (fConst39 * fRec83[0])))) * powf(10,(0.05f * fRec91[0])))) + ((fRec92[2] + (fConst31 * (fTemp47 + (fConst32 * fRec92[0])))) * powf(10,(0.05f * fRec99[0])))) + (fConst151 * (((((fConst34 * fRec100[0]) + (fConst158 * fRec100[1])) + (fConst34 * fRec100[2])) * powf(10,(0.05f * fRec106[0]))) + ((fRec107[2] + (fRec107[0] + (2 * fRec107[1]))) * powf(10,(0.05f * fRec110[0])))))));
fRec3[0] = (fTemp49 - (fConst11 * ((fConst160 * fRec3[2]) + (fConst161 * fRec3[1]))));
fRec2[0] = ((fConst11 * (((fConst13 * fRec3[0]) + (fConst162 * fRec3[1])) + (fConst13 * fRec3[2]))) - (fConst8 * ((fConst163 * fRec2[2]) + (fConst164 * fRec2[1]))));
fRec1[0] = ((fConst8 * (((fConst10 * fRec2[0]) + (fConst165 * fRec2[1])) + (fConst10 * fRec2[2]))) - (fConst4 * ((fConst166 * fRec1[2]) + (fConst167 * fRec1[1]))));
fRec0[0] = ((fSlow1 * fRec0[1]) + (fSlow2 * fabsf((fConst4 * (((fConst7 * fRec1[0]) + (fConst168 * fRec1[1])) + (fConst7 * fRec1[2]))))));
fbargraph0 = (fSlow0 + (20 * log10f(fRec0[0])));
fRec117[0] = (fTemp49 - (fConst185 * ((fConst188 * fRec117[2]) + (fConst189 * fRec117[1]))));
fRec116[0] = ((fConst185 * (((fConst187 * fRec117[0]) + (fConst190 * fRec117[1])) + (fConst187 * fRec117[2]))) - (fConst183 * ((fConst191 * fRec116[2]) + (fConst192 * fRec116[1]))));
fRec115[0] = ((fConst183 * (((fConst184 * fRec116[0]) + (fConst193 * fRec116[1])) + (fConst184 * fRec116[2]))) - (fConst181 * ((fConst194 * fRec115[2]) + (fConst195 * fRec115[1]))));
float fTemp50 = (fConst181 * (((fConst182 * fRec115[0]) + (fConst196 * fRec115[1])) + (fConst182 * fRec115[2])));
fRec114[0] = (fTemp50 - (fConst178 * ((fConst197 * fRec114[2]) + (fConst199 * fRec114[1]))));
fRec113[0] = ((fConst178 * (((fConst180 * fRec114[0]) + (fConst200 * fRec114[1])) + (fConst180 * fRec114[2]))) - (fConst175 * ((fConst201 * fRec113[2]) + (fConst202 * fRec113[1]))));
fRec112[0] = ((fConst175 * (((fConst177 * fRec113[0]) + (fConst203 * fRec113[1])) + (fConst177 * fRec113[2]))) - (fConst171 * ((fConst204 * fRec112[2]) + (fConst205 * fRec112[1]))));
fRec111[0] = ((fSlow1 * fRec111[1]) + (fSlow2 * fabsf((fConst171 * (((fConst174 * fRec112[0]) + (fConst206 * fRec112[1])) + (fConst174 * fRec112[2]))))));
fbargraph1 = (fSlow0 + (20 * log10f(fRec111[0])));
fRec124[0] = (fTemp50 - (fConst223 * ((fConst226 * fRec124[2]) + (fConst227 * fRec124[1]))));
fRec123[0] = ((fConst223 * (((fConst225 * fRec124[0]) + (fConst228 * fRec124[1])) + (fConst225 * fRec124[2]))) - (fConst221 * ((fConst229 * fRec123[2]) + (fConst230 * fRec123[1]))));
fRec122[0] = ((fConst221 * (((fConst222 * fRec123[0]) + (fConst231 * fRec123[1])) + (fConst222 * fRec123[2]))) - (fConst219 * ((fConst232 * fRec122[2]) + (fConst233 * fRec122[1]))));
float fTemp51 = (fConst219 * (((fConst220 * fRec122[0]) + (fConst234 * fRec122[1])) + (fConst220 * fRec122[2])));
fRec121[0] = (fTemp51 - (fConst216 * ((fConst235 * fRec121[2]) + (fConst237 * fRec121[1]))));
fRec120[0] = ((fConst216 * (((fConst218 * fRec121[0]) + (fConst238 * fRec121[1])) + (fConst218 * fRec121[2]))) - (fConst213 * ((fConst239 * fRec120[2]) + (fConst240 * fRec120[1]))));
fRec119[0] = ((fConst213 * (((fConst215 * fRec120[0]) + (fConst241 * fRec120[1])) + (fConst215 * fRec120[2]))) - (fConst209 * ((fConst242 * fRec119[2]) + (fConst243 * fRec119[1]))));
fRec118[0] = ((fSlow1 * fRec118[1]) + (fSlow2 * fabsf((fConst209 * (((fConst212 * fRec119[0]) + (fConst244 * fRec119[1])) + (fConst212 * fRec119[2]))))));
fbargraph2 = (fSlow0 + (20 * log10f(fRec118[0])));
fRec131[0] = (fTemp51 - (fConst258 * ((fConst261 * fRec131[2]) + (fConst262 * fRec131[1]))));
fRec130[0] = ((fConst258 * (((fConst260 * fRec131[0]) + (fConst263 * fRec131[1])) + (fConst260 * fRec131[2]))) - (fConst256 * ((fConst264 * fRec130[2]) + (fConst265 * fRec130[1]))));
fRec129[0] = ((fConst256 * (((fConst257 * fRec130[0]) + (fConst266 * fRec130[1])) + (fConst257 * fRec130[2]))) - (fConst254 * ((fConst267 * fRec129[2]) + (fConst268 * fRec129[1]))));
float fTemp52 = (fConst254 * (((fConst255 * fRec129[0]) + (fConst269 * fRec129[1])) + (fConst255 * fRec129[2])));
fRec128[0] = (fTemp52 - (fConst251 * ((fConst270 * fRec128[2]) + (fConst271 * fRec128[1]))));
fRec127[0] = ((fConst251 * (((fConst253 * fRec128[0]) + (fConst272 * fRec128[1])) + (fConst253 * fRec128[2]))) - (fConst248 * ((fConst273 * fRec127[2]) + (fConst274 * fRec127[1]))));
fRec126[0] = ((fConst248 * (((fConst250 * fRec127[0]) + (fConst275 * fRec127[1])) + (fConst250 * fRec127[2]))) - (fConst245 * ((fConst276 * fRec126[2]) + (fConst277 * fRec126[1]))));
fRec125[0] = ((fSlow1 * fRec125[1]) + (fSlow2 * fabsf((fConst245 * (((fConst247 * fRec126[0]) + (fConst278 * fRec126[1])) + (fConst247 * fRec126[2]))))));
fbargraph3 = (fSlow0 + (20 * log10f(fRec125[0])));
fRec138[0] = (fTemp52 - (fConst295 * ((fConst298 * fRec138[2]) + (fConst299 * fRec138[1]))));
fRec137[0] = ((fConst295 * (((fConst297 * fRec138[0]) + (fConst300 * fRec138[1])) + (fConst297 * fRec138[2]))) - (fConst293 * ((fConst301 * fRec137[2]) + (fConst302 * fRec137[1]))));
fRec136[0] = ((fConst293 * (((fConst294 * fRec137[0]) + (fConst303 * fRec137[1])) + (fConst294 * fRec137[2]))) - (fConst291 * ((fConst304 * fRec136[2]) + (fConst305 * fRec136[1]))));
float fTemp53 = (fConst291 * (((fConst292 * fRec136[0]) + (fConst306 * fRec136[1])) + (fConst292 * fRec136[2])));
fRec135[0] = (fTemp53 - (fConst288 * ((fConst307 * fRec135[2]) + (fConst309 * fRec135[1]))));
fRec134[0] = ((fConst288 * (((fConst290 * fRec135[0]) + (fConst310 * fRec135[1])) + (fConst290 * fRec135[2]))) - (fConst285 * ((fConst311 * fRec134[2]) + (fConst312 * fRec134[1]))));
fRec133[0] = ((fConst285 * (((fConst287 * fRec134[0]) + (fConst313 * fRec134[1])) + (fConst287 * fRec134[2]))) - (fConst281 * ((fConst314 * fRec133[2]) + (fConst315 * fRec133[1]))));
fRec132[0] = ((fSlow1 * fRec132[1]) + (fSlow2 * fabsf((fConst281 * (((fConst284 * fRec133[0]) + (fConst316 * fRec133[1])) + (fConst284 * fRec133[2]))))));
fbargraph4 = (fSlow0 + (20 * log10f(fRec132[0])));
fRec145[0] = (fTemp53 - (fConst333 * ((fConst336 * fRec145[2]) + (fConst337 * fRec145[1]))));
fRec144[0] = ((fConst333 * (((fConst335 * fRec145[0]) + (fConst338 * fRec145[1])) + (fConst335 * fRec145[2]))) - (fConst331 * ((fConst339 * fRec144[2]) + (fConst340 * fRec144[1]))));
fRec143[0] = ((fConst331 * (((fConst332 * fRec144[0]) + (fConst341 * fRec144[1])) + (fConst332 * fRec144[2]))) - (fConst329 * ((fConst342 * fRec143[2]) + (fConst343 * fRec143[1]))));
float fTemp54 = (fConst329 * (((fConst330 * fRec143[0]) + (fConst344 * fRec143[1])) + (fConst330 * fRec143[2])));
fRec142[0] = (fTemp54 - (fConst326 * ((fConst345 * fRec142[2]) + (fConst347 * fRec142[1]))));
fRec141[0] = ((fConst326 * (((fConst328 * fRec142[0]) + (fConst348 * fRec142[1])) + (fConst328 * fRec142[2]))) - (fConst323 * ((fConst349 * fRec141[2]) + (fConst350 * fRec141[1]))));
fRec140[0] = ((fConst323 * (((fConst325 * fRec141[0]) + (fConst351 * fRec141[1])) + (fConst325 * fRec141[2]))) - (fConst319 * ((fConst352 * fRec140[2]) + (fConst353 * fRec140[1]))));
fRec139[0] = ((fSlow1 * fRec139[1]) + (fSlow2 * fabsf((fConst319 * (((fConst322 * fRec140[0]) + (fConst354 * fRec140[1])) + (fConst322 * fRec140[2]))))));
fbargraph5 = (fSlow0 + (20 * log10f(fRec139[0])));
fRec152[0] = (fTemp54 - (fConst368 * ((fConst371 * fRec152[2]) + (fConst372 * fRec152[1]))));
fRec151[0] = ((fConst368 * (((fConst370 * fRec152[0]) + (fConst373 * fRec152[1])) + (fConst370 * fRec152[2]))) - (fConst366 * ((fConst374 * fRec151[2]) + (fConst375 * fRec151[1]))));
fRec150[0] = ((fConst366 * (((fConst367 * fRec151[0]) + (fConst376 * fRec151[1])) + (fConst367 * fRec151[2]))) - (fConst364 * ((fConst377 * fRec150[2]) + (fConst378 * fRec150[1]))));
float fTemp55 = (fConst364 * (((fConst365 * fRec150[0]) + (fConst379 * fRec150[1])) + (fConst365 * fRec150[2])));
fRec149[0] = (fTemp55 - (fConst361 * ((fConst380 * fRec149[2]) + (fConst381 * fRec149[1]))));
fRec148[0] = ((fConst361 * (((fConst363 * fRec149[0]) + (fConst382 * fRec149[1])) + (fConst363 * fRec149[2]))) - (fConst358 * ((fConst383 * fRec148[2]) + (fConst384 * fRec148[1]))));
fRec147[0] = ((fConst358 * (((fConst360 * fRec148[0]) + (fConst385 * fRec148[1])) + (fConst360 * fRec148[2]))) - (fConst355 * ((fConst386 * fRec147[2]) + (fConst387 * fRec147[1]))));
fRec146[0] = ((fSlow1 * fRec146[1]) + (fSlow2 * fabsf((fConst355 * (((fConst357 * fRec147[0]) + (fConst388 * fRec147[1])) + (fConst357 * fRec147[2]))))));
fbargraph6 = (fSlow0 + (20 * log10f(fRec146[0])));
fRec159[0] = (fTemp55 - (fConst405 * ((fConst408 * fRec159[2]) + (fConst409 * fRec159[1]))));
fRec158[0] = ((fConst405 * (((fConst407 * fRec159[0]) + (fConst410 * fRec159[1])) + (fConst407 * fRec159[2]))) - (fConst403 * ((fConst411 * fRec158[2]) + (fConst412 * fRec158[1]))));
fRec157[0] = ((fConst403 * (((fConst404 * fRec158[0]) + (fConst413 * fRec158[1])) + (fConst404 * fRec158[2]))) - (fConst401 * ((fConst414 * fRec157[2]) + (fConst415 * fRec157[1]))));
float fTemp56 = (fConst401 * (((fConst402 * fRec157[0]) + (fConst416 * fRec157[1])) + (fConst402 * fRec157[2])));
fRec156[0] = (fTemp56 - (fConst398 * ((fConst417 * fRec156[2]) + (fConst419 * fRec156[1]))));
fRec155[0] = ((fConst398 * (((fConst400 * fRec156[0]) + (fConst420 * fRec156[1])) + (fConst400 * fRec156[2]))) - (fConst395 * ((fConst421 * fRec155[2]) + (fConst422 * fRec155[1]))));
fRec154[0] = ((fConst395 * (((fConst397 * fRec155[0]) + (fConst423 * fRec155[1])) + (fConst397 * fRec155[2]))) - (fConst391 * ((fConst424 * fRec154[2]) + (fConst425 * fRec154[1]))));
fRec153[0] = ((fSlow1 * fRec153[1]) + (fSlow2 * fabsf((fConst391 * (((fConst394 * fRec154[0]) + (fConst426 * fRec154[1])) + (fConst394 * fRec154[2]))))));
fbargraph7 = (fSlow0 + (20 * log10f(fRec153[0])));
fRec166[0] = (fTemp56 - (fConst443 * ((fConst446 * fRec166[2]) + (fConst447 * fRec166[1]))));
fRec165[0] = ((fConst443 * (((fConst445 * fRec166[0]) + (fConst448 * fRec166[1])) + (fConst445 * fRec166[2]))) - (fConst441 * ((fConst449 * fRec165[2]) + (fConst450 * fRec165[1]))));
fRec164[0] = ((fConst441 * (((fConst442 * fRec165[0]) + (fConst451 * fRec165[1])) + (fConst442 * fRec165[2]))) - (fConst439 * ((fConst452 * fRec164[2]) + (fConst453 * fRec164[1]))));
float fTemp57 = (fConst439 * (((fConst440 * fRec164[0]) + (fConst454 * fRec164[1])) + (fConst440 * fRec164[2])));
fRec163[0] = (fTemp57 - (fConst436 * ((fConst455 * fRec163[2]) + (fConst457 * fRec163[1]))));
fRec162[0] = ((fConst436 * (((fConst438 * fRec163[0]) + (fConst458 * fRec163[1])) + (fConst438 * fRec163[2]))) - (fConst433 * ((fConst459 * fRec162[2]) + (fConst460 * fRec162[1]))));
fRec161[0] = ((fConst433 * (((fConst435 * fRec162[0]) + (fConst461 * fRec162[1])) + (fConst435 * fRec162[2]))) - (fConst429 * ((fConst462 * fRec161[2]) + (fConst463 * fRec161[1]))));
fRec160[0] = ((fSlow1 * fRec160[1]) + (fSlow2 * fabsf((fConst429 * (((fConst432 * fRec161[0]) + (fConst464 * fRec161[1])) + (fConst432 * fRec161[2]))))));
fbargraph8 = (fSlow0 + (20 * log10f(fRec160[0])));
fRec173[0] = (fTemp57 - (fConst478 * ((fConst481 * fRec173[2]) + (fConst482 * fRec173[1]))));
fRec172[0] = ((fConst478 * (((fConst480 * fRec173[0]) + (fConst483 * fRec173[1])) + (fConst480 * fRec173[2]))) - (fConst476 * ((fConst484 * fRec172[2]) + (fConst485 * fRec172[1]))));
fRec171[0] = ((fConst476 * (((fConst477 * fRec172[0]) + (fConst486 * fRec172[1])) + (fConst477 * fRec172[2]))) - (fConst474 * ((fConst487 * fRec171[2]) + (fConst488 * fRec171[1]))));
float fTemp58 = (fConst474 * (((fConst475 * fRec171[0]) + (fConst489 * fRec171[1])) + (fConst475 * fRec171[2])));
fRec170[0] = (fTemp58 - (fConst471 * ((fConst490 * fRec170[2]) + (fConst491 * fRec170[1]))));
fRec169[0] = ((fConst471 * (((fConst473 * fRec170[0]) + (fConst492 * fRec170[1])) + (fConst473 * fRec170[2]))) - (fConst468 * ((fConst493 * fRec169[2]) + (fConst494 * fRec169[1]))));
fRec168[0] = ((fConst468 * (((fConst470 * fRec169[0]) + (fConst495 * fRec169[1])) + (fConst470 * fRec169[2]))) - (fConst465 * ((fConst496 * fRec168[2]) + (fConst497 * fRec168[1]))));
fRec167[0] = ((fSlow1 * fRec167[1]) + (fSlow2 * fabsf((fConst465 * (((fConst467 * fRec168[0]) + (fConst498 * fRec168[1])) + (fConst467 * fRec168[2]))))));
fbargraph9 = (fSlow0 + (20 * log10f(fRec167[0])));
fRec180[0] = (fTemp58 - (fConst515 * ((fConst518 * fRec180[2]) + (fConst519 * fRec180[1]))));
fRec179[0] = ((fConst515 * (((fConst517 * fRec180[0]) + (fConst520 * fRec180[1])) + (fConst517 * fRec180[2]))) - (fConst513 * ((fConst521 * fRec179[2]) + (fConst522 * fRec179[1]))));
fRec178[0] = ((fConst513 * (((fConst514 * fRec179[0]) + (fConst523 * fRec179[1])) + (fConst514 * fRec179[2]))) - (fConst511 * ((fConst524 * fRec178[2]) + (fConst525 * fRec178[1]))));
float fTemp59 = (fConst511 * (((fConst512 * fRec178[0]) + (fConst526 * fRec178[1])) + (fConst512 * fRec178[2])));
fRec177[0] = (fTemp59 - (fConst508 * ((fConst527 * fRec177[2]) + (fConst529 * fRec177[1]))));
fRec176[0] = ((fConst508 * (((fConst510 * fRec177[0]) + (fConst530 * fRec177[1])) + (fConst510 * fRec177[2]))) - (fConst505 * ((fConst531 * fRec176[2]) + (fConst532 * fRec176[1]))));
fRec175[0] = ((fConst505 * (((fConst507 * fRec176[0]) + (fConst533 * fRec176[1])) + (fConst507 * fRec176[2]))) - (fConst501 * ((fConst534 * fRec175[2]) + (fConst535 * fRec175[1]))));
fRec174[0] = ((fSlow1 * fRec174[1]) + (fSlow2 * fabsf((fConst501 * (((fConst504 * fRec175[0]) + (fConst536 * fRec175[1])) + (fConst504 * fRec175[2]))))));
fbargraph10 = (fSlow0 + (20 * log10f(fRec174[0])));
fRec187[0] = (fTemp59 - (fConst553 * ((fConst556 * fRec187[2]) + (fConst557 * fRec187[1]))));
fRec186[0] = ((fConst553 * (((fConst555 * fRec187[0]) + (fConst558 * fRec187[1])) + (fConst555 * fRec187[2]))) - (fConst551 * ((fConst559 * fRec186[2]) + (fConst560 * fRec186[1]))));
fRec185[0] = ((fConst551 * (((fConst552 * fRec186[0]) + (fConst561 * fRec186[1])) + (fConst552 * fRec186[2]))) - (fConst549 * ((fConst562 * fRec185[2]) + (fConst563 * fRec185[1]))));
float fTemp60 = (fConst549 * (((fConst550 * fRec185[0]) + (fConst564 * fRec185[1])) + (fConst550 * fRec185[2])));
fRec184[0] = (fTemp60 - (fConst546 * ((fConst565 * fRec184[2]) + (fConst567 * fRec184[1]))));
fRec183[0] = ((fConst546 * (((fConst548 * fRec184[0]) + (fConst568 * fRec184[1])) + (fConst548 * fRec184[2]))) - (fConst543 * ((fConst569 * fRec183[2]) + (fConst570 * fRec183[1]))));
fRec182[0] = ((fConst543 * (((fConst545 * fRec183[0]) + (fConst571 * fRec183[1])) + (fConst545 * fRec183[2]))) - (fConst539 * ((fConst572 * fRec182[2]) + (fConst573 * fRec182[1]))));
fRec181[0] = ((fSlow1 * fRec181[1]) + (fSlow2 * fabsf((fConst539 * (((fConst542 * fRec182[0]) + (fConst574 * fRec182[1])) + (fConst542 * fRec182[2]))))));
fbargraph11 = (fSlow0 + (20 * log10f(fRec181[0])));
fRec194[0] = (fTemp60 - (fConst588 * ((fConst591 * fRec194[2]) + (fConst592 * fRec194[1]))));
fRec193[0] = ((fConst588 * (((fConst590 * fRec194[0]) + (fConst593 * fRec194[1])) + (fConst590 * fRec194[2]))) - (fConst586 * ((fConst594 * fRec193[2]) + (fConst595 * fRec193[1]))));
fRec192[0] = ((fConst586 * (((fConst587 * fRec193[0]) + (fConst596 * fRec193[1])) + (fConst587 * fRec193[2]))) - (fConst584 * ((fConst597 * fRec192[2]) + (fConst598 * fRec192[1]))));
float fTemp61 = (fConst584 * (((fConst585 * fRec192[0]) + (fConst599 * fRec192[1])) + (fConst585 * fRec192[2])));
fRec191[0] = (fTemp61 - (fConst581 * ((fConst600 * fRec191[2]) + (fConst601 * fRec191[1]))));
fRec190[0] = ((fConst581 * (((fConst583 * fRec191[0]) + (fConst602 * fRec191[1])) + (fConst583 * fRec191[2]))) - (fConst578 * ((fConst603 * fRec190[2]) + (fConst604 * fRec190[1]))));
fRec189[0] = ((fConst578 * (((fConst580 * fRec190[0]) + (fConst605 * fRec190[1])) + (fConst580 * fRec190[2]))) - (fConst575 * ((fConst606 * fRec189[2]) + (fConst607 * fRec189[1]))));
fRec188[0] = ((fSlow1 * fRec188[1]) + (fSlow2 * fabsf((fConst575 * (((fConst577 * fRec189[0]) + (fConst608 * fRec189[1])) + (fConst577 * fRec189[2]))))));
fbargraph12 = (fSlow0 + (20 * log10f(fRec188[0])));
fRec201[0] = (fTemp61 - (fConst625 * ((fConst628 * fRec201[2]) + (fConst629 * fRec201[1]))));
fRec200[0] = ((fConst625 * (((fConst627 * fRec201[0]) + (fConst630 * fRec201[1])) + (fConst627 * fRec201[2]))) - (fConst623 * ((fConst631 * fRec200[2]) + (fConst632 * fRec200[1]))));
fRec199[0] = ((fConst623 * (((fConst624 * fRec200[0]) + (fConst633 * fRec200[1])) + (fConst624 * fRec200[2]))) - (fConst621 * ((fConst634 * fRec199[2]) + (fConst635 * fRec199[1]))));
float fTemp62 = (fConst621 * (((fConst622 * fRec199[0]) + (fConst636 * fRec199[1])) + (fConst622 * fRec199[2])));
fRec198[0] = (fTemp62 - (fConst618 * ((fConst637 * fRec198[2]) + (fConst639 * fRec198[1]))));
fRec197[0] = ((fConst618 * (((fConst620 * fRec198[0]) + (fConst640 * fRec198[1])) + (fConst620 * fRec198[2]))) - (fConst615 * ((fConst641 * fRec197[2]) + (fConst642 * fRec197[1]))));
fRec196[0] = ((fConst615 * (((fConst617 * fRec197[0]) + (fConst643 * fRec197[1])) + (fConst617 * fRec197[2]))) - (fConst611 * ((fConst644 * fRec196[2]) + (fConst645 * fRec196[1]))));
fRec195[0] = ((fSlow1 * fRec195[1]) + (fSlow2 * fabsf((fConst611 * (((fConst614 * fRec196[0]) + (fConst646 * fRec196[1])) + (fConst614 * fRec196[2]))))));
fbargraph13 = (fSlow0 + (20 * log10f(fRec195[0])));
fRec205[0] = (fTemp62 - (fConst651 * ((fConst654 * fRec205[2]) + (fConst655 * fRec205[1]))));
fRec204[0] = ((fConst651 * (((fConst653 * fRec205[0]) + (fConst656 * fRec205[1])) + (fConst653 * fRec205[2]))) - (fConst649 * ((fConst657 * fRec204[2]) + (fConst658 * fRec204[1]))));
fRec203[0] = ((fConst649 * (((fConst650 * fRec204[0]) + (fConst659 * fRec204[1])) + (fConst650 * fRec204[2]))) - (fConst647 * ((fConst660 * fRec203[2]) + (fConst661 * fRec203[1]))));
fRec202[0] = ((fSlow1 * fRec202[1]) + (fSlow2 * fabsf((fConst647 * (((fConst648 * fRec203[0]) + (fConst662 * fRec203[1])) + (fConst648 * fRec203[2]))))));
fbargraph14 = (fSlow0 + (20 * log10f(fRec202[0])));
float fTemp63 = fTemp49;
output0[i] = (FAUSTFLOAT)fTemp63;
output1[i] = (FAUSTFLOAT)fTemp63;
// post processing
fRec202[1] = fRec202[0];
fRec203[2] = fRec203[1]; fRec203[1] = fRec203[0];
fRec204[2] = fRec204[1]; fRec204[1] = fRec204[0];
fRec205[2] = fRec205[1]; fRec205[1] = fRec205[0];
fRec195[1] = fRec195[0];
fRec196[2] = fRec196[1]; fRec196[1] = fRec196[0];
fRec197[2] = fRec197[1]; fRec197[1] = fRec197[0];
fRec198[2] = fRec198[1]; fRec198[1] = fRec198[0];
fRec199[2] = fRec199[1]; fRec199[1] = fRec199[0];
fRec200[2] = fRec200[1]; fRec200[1] = fRec200[0];
fRec201[2] = fRec201[1]; fRec201[1] = fRec201[0];
fRec188[1] = fRec188[0];
fRec189[2] = fRec189[1]; fRec189[1] = fRec189[0];
fRec190[2] = fRec190[1]; fRec190[1] = fRec190[0];
fRec191[2] = fRec191[1]; fRec191[1] = fRec191[0];
fRec192[2] = fRec192[1]; fRec192[1] = fRec192[0];
fRec193[2] = fRec193[1]; fRec193[1] = fRec193[0];
fRec194[2] = fRec194[1]; fRec194[1] = fRec194[0];
fRec181[1] = fRec181[0];
fRec182[2] = fRec182[1]; fRec182[1] = fRec182[0];
fRec183[2] = fRec183[1]; fRec183[1] = fRec183[0];
fRec184[2] = fRec184[1]; fRec184[1] = fRec184[0];
fRec185[2] = fRec185[1]; fRec185[1] = fRec185[0];
fRec186[2] = fRec186[1]; fRec186[1] = fRec186[0];
fRec187[2] = fRec187[1]; fRec187[1] = fRec187[0];
fRec174[1] = fRec174[0];
fRec175[2] = fRec175[1]; fRec175[1] = fRec175[0];
fRec176[2] = fRec176[1]; fRec176[1] = fRec176[0];
fRec177[2] = fRec177[1]; fRec177[1] = fRec177[0];
fRec178[2] = fRec178[1]; fRec178[1] = fRec178[0];
fRec179[2] = fRec179[1]; fRec179[1] = fRec179[0];
fRec180[2] = fRec180[1]; fRec180[1] = fRec180[0];
fRec167[1] = fRec167[0];
fRec168[2] = fRec168[1]; fRec168[1] = fRec168[0];
fRec169[2] = fRec169[1]; fRec169[1] = fRec169[0];
fRec170[2] = fRec170[1]; fRec170[1] = fRec170[0];
fRec171[2] = fRec171[1]; fRec171[1] = fRec171[0];
fRec172[2] = fRec172[1]; fRec172[1] = fRec172[0];
fRec173[2] = fRec173[1]; fRec173[1] = fRec173[0];
fRec160[1] = fRec160[0];
fRec161[2] = fRec161[1]; fRec161[1] = fRec161[0];
fRec162[2] = fRec162[1]; fRec162[1] = fRec162[0];
fRec163[2] = fRec163[1]; fRec163[1] = fRec163[0];
fRec164[2] = fRec164[1]; fRec164[1] = fRec164[0];
fRec165[2] = fRec165[1]; fRec165[1] = fRec165[0];
fRec166[2] = fRec166[1]; fRec166[1] = fRec166[0];
fRec153[1] = fRec153[0];
fRec154[2] = fRec154[1]; fRec154[1] = fRec154[0];
fRec155[2] = fRec155[1]; fRec155[1] = fRec155[0];
fRec156[2] = fRec156[1]; fRec156[1] = fRec156[0];
fRec157[2] = fRec157[1]; fRec157[1] = fRec157[0];
fRec158[2] = fRec158[1]; fRec158[1] = fRec158[0];
fRec159[2] = fRec159[1]; fRec159[1] = fRec159[0];
fRec146[1] = fRec146[0];
fRec147[2] = fRec147[1]; fRec147[1] = fRec147[0];
fRec148[2] = fRec148[1]; fRec148[1] = fRec148[0];
fRec149[2] = fRec149[1]; fRec149[1] = fRec149[0];
fRec150[2] = fRec150[1]; fRec150[1] = fRec150[0];
fRec151[2] = fRec151[1]; fRec151[1] = fRec151[0];
fRec152[2] = fRec152[1]; fRec152[1] = fRec152[0];
fRec139[1] = fRec139[0];
fRec140[2] = fRec140[1]; fRec140[1] = fRec140[0];
fRec141[2] = fRec141[1]; fRec141[1] = fRec141[0];
fRec142[2] = fRec142[1]; fRec142[1] = fRec142[0];
fRec143[2] = fRec143[1]; fRec143[1] = fRec143[0];
fRec144[2] = fRec144[1]; fRec144[1] = fRec144[0];
fRec145[2] = fRec145[1]; fRec145[1] = fRec145[0];
fRec132[1] = fRec132[0];
fRec133[2] = fRec133[1]; fRec133[1] = fRec133[0];
fRec134[2] = fRec134[1]; fRec134[1] = fRec134[0];
fRec135[2] = fRec135[1]; fRec135[1] = fRec135[0];
fRec136[2] = fRec136[1]; fRec136[1] = fRec136[0];
fRec137[2] = fRec137[1]; fRec137[1] = fRec137[0];
fRec138[2] = fRec138[1]; fRec138[1] = fRec138[0];
fRec125[1] = fRec125[0];
fRec126[2] = fRec126[1]; fRec126[1] = fRec126[0];
fRec127[2] = fRec127[1]; fRec127[1] = fRec127[0];
fRec128[2] = fRec128[1]; fRec128[1] = fRec128[0];
fRec129[2] = fRec129[1]; fRec129[1] = fRec129[0];
fRec130[2] = fRec130[1]; fRec130[1] = fRec130[0];
fRec131[2] = fRec131[1]; fRec131[1] = fRec131[0];
fRec118[1] = fRec118[0];
fRec119[2] = fRec119[1]; fRec119[1] = fRec119[0];
fRec120[2] = fRec120[1]; fRec120[1] = fRec120[0];
fRec121[2] = fRec121[1]; fRec121[1] = fRec121[0];
fRec122[2] = fRec122[1]; fRec122[1] = fRec122[0];
fRec123[2] = fRec123[1]; fRec123[1] = fRec123[0];
fRec124[2] = fRec124[1]; fRec124[1] = fRec124[0];
fRec111[1] = fRec111[0];
fRec112[2] = fRec112[1]; fRec112[1] = fRec112[0];
fRec113[2] = fRec113[1]; fRec113[1] = fRec113[0];
fRec114[2] = fRec114[1]; fRec114[1] = fRec114[0];
fRec115[2] = fRec115[1]; fRec115[1] = fRec115[0];
fRec116[2] = fRec116[1]; fRec116[1] = fRec116[0];
fRec117[2] = fRec117[1]; fRec117[1] = fRec117[0];
fRec0[1] = fRec0[0];
fRec1[2] = fRec1[1]; fRec1[1] = fRec1[0];
fRec2[2] = fRec2[1]; fRec2[1] = fRec2[0];
fRec3[2] = fRec3[1]; fRec3[1] = fRec3[0];
fRec110[1] = fRec110[0];
fRec107[2] = fRec107[1]; fRec107[1] = fRec107[0];
fRec108[2] = fRec108[1]; fRec108[1] = fRec108[0];
fRec109[1] = fRec109[0];
fRec106[1] = fRec106[0];
fRec100[2] = fRec100[1]; fRec100[1] = fRec100[0];
fRec101[2] = fRec101[1]; fRec101[1] = fRec101[0];
fRec102[1] = fRec102[0];
fVec12[1] = fVec12[0];
fRec103[2] = fRec103[1]; fRec103[1] = fRec103[0];
fRec104[2] = fRec104[1]; fRec104[1] = fRec104[0];
fRec105[1] = fRec105[0];
fRec99[1] = fRec99[0];
fRec92[2] = fRec92[1]; fRec92[1] = fRec92[0];
fRec93[2] = fRec93[1]; fRec93[1] = fRec93[0];
fRec94[2] = fRec94[1]; fRec94[1] = fRec94[0];
fRec95[1] = fRec95[0];
fVec11[1] = fVec11[0];
fRec96[2] = fRec96[1]; fRec96[1] = fRec96[0];
fRec97[2] = fRec97[1]; fRec97[1] = fRec97[0];
fRec98[1] = fRec98[0];
fRec91[1] = fRec91[0];
fRec83[2] = fRec83[1]; fRec83[1] = fRec83[0];
fRec84[2] = fRec84[1]; fRec84[1] = fRec84[0];
fRec85[2] = fRec85[1]; fRec85[1] = fRec85[0];
fRec86[2] = fRec86[1]; fRec86[1] = fRec86[0];
fRec87[1] = fRec87[0];
fVec10[1] = fVec10[0];
fRec88[2] = fRec88[1]; fRec88[1] = fRec88[0];
fRec89[2] = fRec89[1]; fRec89[1] = fRec89[0];
fRec90[1] = fRec90[0];
fRec82[1] = fRec82[0];
fRec73[2] = fRec73[1]; fRec73[1] = fRec73[0];
fRec74[2] = fRec74[1]; fRec74[1] = fRec74[0];
fRec75[2] = fRec75[1]; fRec75[1] = fRec75[0];
fRec76[2] = fRec76[1]; fRec76[1] = fRec76[0];
fRec77[2] = fRec77[1]; fRec77[1] = fRec77[0];
fRec78[1] = fRec78[0];
fVec9[1] = fVec9[0];
fRec79[2] = fRec79[1]; fRec79[1] = fRec79[0];
fRec80[2] = fRec80[1]; fRec80[1] = fRec80[0];
fRec81[1] = fRec81[0];
fRec72[1] = fRec72[0];
fRec62[2] = fRec62[1]; fRec62[1] = fRec62[0];
fRec63[2] = fRec63[1]; fRec63[1] = fRec63[0];
fRec64[2] = fRec64[1]; fRec64[1] = fRec64[0];
fRec65[2] = fRec65[1]; fRec65[1] = fRec65[0];
fRec66[2] = fRec66[1]; fRec66[1] = fRec66[0];
fRec67[2] = fRec67[1]; fRec67[1] = fRec67[0];
fRec68[1] = fRec68[0];
fVec8[1] = fVec8[0];
fRec69[2] = fRec69[1]; fRec69[1] = fRec69[0];
fRec70[2] = fRec70[1]; fRec70[1] = fRec70[0];
fRec71[1] = fRec71[0];
fRec61[1] = fRec61[0];
fRec50[2] = fRec50[1]; fRec50[1] = fRec50[0];
fRec51[2] = fRec51[1]; fRec51[1] = fRec51[0];
fRec52[2] = fRec52[1]; fRec52[1] = fRec52[0];
fRec53[2] = fRec53[1]; fRec53[1] = fRec53[0];
fRec54[2] = fRec54[1]; fRec54[1] = fRec54[0];
fRec55[2] = fRec55[1]; fRec55[1] = fRec55[0];
fRec56[2] = fRec56[1]; fRec56[1] = fRec56[0];
fRec57[1] = fRec57[0];
fVec7[1] = fVec7[0];
fRec58[2] = fRec58[1]; fRec58[1] = fRec58[0];
fRec59[2] = fRec59[1]; fRec59[1] = fRec59[0];
fRec60[1] = fRec60[0];
fRec49[1] = fRec49[0];
fRec37[2] = fRec37[1]; fRec37[1] = fRec37[0];
fRec38[2] = fRec38[1]; fRec38[1] = fRec38[0];
fRec39[2] = fRec39[1]; fRec39[1] = fRec39[0];
fRec40[2] = fRec40[1]; fRec40[1] = fRec40[0];
fRec41[2] = fRec41[1]; fRec41[1] = fRec41[0];
fRec42[2] = fRec42[1]; fRec42[1] = fRec42[0];
fRec43[2] = fRec43[1]; fRec43[1] = fRec43[0];
fRec44[2] = fRec44[1]; fRec44[1] = fRec44[0];
fRec45[1] = fRec45[0];
fVec6[1] = fVec6[0];
fRec46[2] = fRec46[1]; fRec46[1] = fRec46[0];
fRec47[2] = fRec47[1]; fRec47[1] = fRec47[0];
fRec48[1] = fRec48[0];
fRec36[1] = fRec36[0];
fRec23[2] = fRec23[1]; fRec23[1] = fRec23[0];
fRec24[2] = fRec24[1]; fRec24[1] = fRec24[0];
fRec25[2] = fRec25[1]; fRec25[1] = fRec25[0];
fRec26[2] = fRec26[1]; fRec26[1] = fRec26[0];
fRec27[2] = fRec27[1]; fRec27[1] = fRec27[0];
fRec28[2] = fRec28[1]; fRec28[1] = fRec28[0];
fRec29[2] = fRec29[1]; fRec29[1] = fRec29[0];
fRec30[2] = fRec30[1]; fRec30[1] = fRec30[0];
fRec31[2] = fRec31[1]; fRec31[1] = fRec31[0];
fRec32[1] = fRec32[0];
fVec5[1] = fVec5[0];
fRec33[2] = fRec33[1]; fRec33[1] = fRec33[0];
fRec34[2] = fRec34[1]; fRec34[1] = fRec34[0];
fRec35[1] = fRec35[0];
fRec22[1] = fRec22[0];
fRec11[2] = fRec11[1]; fRec11[1] = fRec11[0];
fRec12[2] = fRec12[1]; fRec12[1] = fRec12[0];
fRec13[2] = fRec13[1]; fRec13[1] = fRec13[0];
fRec14[2] = fRec14[1]; fRec14[1] = fRec14[0];
fRec15[2] = fRec15[1]; fRec15[1] = fRec15[0];
fRec16[2] = fRec16[1]; fRec16[1] = fRec16[0];
fRec17[2] = fRec17[1]; fRec17[1] = fRec17[0];
fRec18[2] = fRec18[1]; fRec18[1] = fRec18[0];
fRec19[2] = fRec19[1]; fRec19[1] = fRec19[0];
fRec20[2] = fRec20[1]; fRec20[1] = fRec20[0];
fRec21[1] = fRec21[0];
fVec4[1] = fVec4[0];
fVec3[1] = fVec3[0];
fRec10[1] = fRec10[0];
fVec2[1] = fVec2[0];
fRec9[1] = fRec9[0];
fVec1[1] = fVec1[0];
fRec8[1] = fRec8[0];
fRec7[1] = fRec7[0];
fVec0[1] = fVec0[0];
for (int i=3; i>0; i--) fRec5[i] = fRec5[i-1];
iRec6[1] = iRec6[0];
fRec4[1] = fRec4[0];
}
}
};
#include <stdio.h>
#include <string.h>
#include "m_pd.h"
#define faust_setup(name) xfaust_setup(name)
#define xfaust_setup(name) name ## _tilde_setup(void)
#define sym(name) xsym(name)
#define xsym(name) #name
// time for "active" toggle xfades in secs
#define XFADE_TIME 0.1f
static t_class *faust_class;
struct t_faust {
t_object x_obj;
#ifdef __MINGW32__
/* This seems to be necessary as some as yet undetermined Pd routine seems
to write past the end of x_obj on Windows. */
int fence; /* dummy field (not used) */
#endif
mydsp *dsp;
PdUI *ui;
string *label;
int active, xfade, n_xfade, rate, n_in, n_out;
t_sample **inputs, **outputs, **buf;
t_outlet *out;
t_sample f;
};
static t_symbol *s_button, *s_checkbox, *s_vslider, *s_hslider, *s_nentry,
*s_vbargraph, *s_hbargraph;
static inline void zero_samples(int k, int n, t_sample **out)
{
for (int i = 0; i < k; i++)
#ifdef __STDC_IEC_559__
/* IEC 559 a.k.a. IEEE 754 floats can be initialized faster like this */
memset(out[i], 0, n*sizeof(t_sample));
#else
for (int j = 0; j < n; j++)
out[i][j] = 0.0f;
#endif
}
static inline void copy_samples(int k, int n, t_sample **out, t_sample **in)
{
for (int i = 0; i < k; i++)
memcpy(out[i], in[i], n*sizeof(t_sample));
}
static t_int *faust_perform(t_int *w)
{
t_faust *x = (t_faust *)(w[1]);
int n = (int)(w[2]);
if (!x->dsp || !x->buf) return (w+3);
AVOIDDENORMALS;
if (x->xfade > 0) {
float d = 1.0f/x->n_xfade, f = (x->xfade--)*d;
d = d/n;
x->dsp->compute(n, x->inputs, x->buf);
if (x->active)
if (x->n_in == x->n_out)
/* xfade inputs -> buf */
for (int j = 0; j < n; j++, f -= d)
for (int i = 0; i < x->n_out; i++)
x->outputs[i][j] = f*x->inputs[i][j]+(1.0f-f)*x->buf[i][j];
else
/* xfade 0 -> buf */
for (int j = 0; j < n; j++, f -= d)
for (int i = 0; i < x->n_out; i++)
x->outputs[i][j] = (1.0f-f)*x->buf[i][j];
else
if (x->n_in == x->n_out)
/* xfade buf -> inputs */
for (int j = 0; j < n; j++, f -= d)
for (int i = 0; i < x->n_out; i++)
x->outputs[i][j] = f*x->buf[i][j]+(1.0f-f)*x->inputs[i][j];
else
/* xfade buf -> 0 */
for (int j = 0; j < n; j++, f -= d)
for (int i = 0; i < x->n_out; i++)
x->outputs[i][j] = f*x->buf[i][j];
} else if (x->active) {
x->dsp->compute(n, x->inputs, x->buf);
copy_samples(x->n_out, n, x->outputs, x->buf);
} else if (x->n_in == x->n_out) {
copy_samples(x->n_out, n, x->buf, x->inputs);
copy_samples(x->n_out, n, x->outputs, x->buf);
} else
zero_samples(x->n_out, n, x->outputs);
return (w+3);
}
static void faust_dsp(t_faust *x, t_signal **sp)
{
int n = sp[0]->s_n, sr = (int)sp[0]->s_sr;
if (x->rate <= 0) {
/* default sample rate is whatever Pd tells us */
PdUI *ui = x->ui;
float *z = NULL;
if (ui->nelems > 0 &&
(z = (float*)malloc(ui->nelems*sizeof(float)))) {
/* save the current control values */
for (int i = 0; i < ui->nelems; i++)
if (ui->elems[i].zone)
z[i] = *ui->elems[i].zone;
}
/* set the proper sample rate; this requires reinitializing the dsp */
x->rate = sr;
x->dsp->init(sr);
if (z) {
/* restore previous control values */
for (int i = 0; i < ui->nelems; i++)
if (ui->elems[i].zone)
*ui->elems[i].zone = z[i];
free(z);
}
}
if (n > 0)
x->n_xfade = (int)(x->rate*XFADE_TIME/n);
dsp_add(faust_perform, 2, x, n);
for (int i = 0; i < x->n_in; i++)
x->inputs[i] = sp[i+1]->s_vec;
for (int i = 0; i < x->n_out; i++)
x->outputs[i] = sp[x->n_in+i+1]->s_vec;
if (x->buf != NULL)
for (int i = 0; i < x->n_out; i++) {
x->buf[i] = (t_sample*)malloc(n*sizeof(t_sample));
if (x->buf[i] == NULL) {
for (int j = 0; j < i; j++)
free(x->buf[j]);
free(x->buf);
x->buf = NULL;
break;
}
}
}
static int pathcmp(const char *s, const char *t)
{
int n = strlen(s), m = strlen(t);
if (n == 0 || m == 0)
return 0;
else if (t[0] == '/')
return strcmp(s, t);
else if (n <= m || s[n-m-1] != '/')
return strcmp(s+1, t);
else
return strcmp(s+n-m, t);
}
static void faust_any(t_faust *x, t_symbol *s, int argc, t_atom *argv)
{
if (!x->dsp) return;
PdUI *ui = x->ui;
if (s == &s_bang) {
for (int i = 0; i < ui->nelems; i++)
if (ui->elems[i].label && ui->elems[i].zone) {
t_atom args[6];
t_symbol *_s;
switch (ui->elems[i].type) {
case UI_BUTTON:
_s = s_button;
break;
case UI_CHECK_BUTTON:
_s = s_checkbox;
break;
case UI_V_SLIDER:
_s = s_vslider;
break;
case UI_H_SLIDER:
_s = s_hslider;
break;
case UI_NUM_ENTRY:
_s = s_nentry;
break;
case UI_V_BARGRAPH:
_s = s_vbargraph;
break;
case UI_H_BARGRAPH:
_s = s_hbargraph;
break;
default:
continue;
}
SETSYMBOL(&args[0], gensym(ui->elems[i].label));
SETFLOAT(&args[1], *ui->elems[i].zone);
SETFLOAT(&args[2], ui->elems[i].init);
SETFLOAT(&args[3], ui->elems[i].min);
SETFLOAT(&args[4], ui->elems[i].max);
SETFLOAT(&args[5], ui->elems[i].step);
outlet_anything(x->out, _s, 6, args);
}
} else {
const char *label = s->s_name;
int count = 0;
for (int i = 0; i < ui->nelems; i++)
if (ui->elems[i].label &&
pathcmp(ui->elems[i].label, label) == 0) {
if (argc == 0) {
if (ui->elems[i].zone) {
t_atom arg;
SETFLOAT(&arg, *ui->elems[i].zone);
outlet_anything(x->out, gensym(ui->elems[i].label), 1, &arg);
}
++count;
} else if (argc == 1 &&
(argv[0].a_type == A_FLOAT ||
argv[0].a_type == A_DEFFLOAT) &&
ui->elems[i].zone) {
float f = atom_getfloat(argv);
*ui->elems[i].zone = f;
++count;
} else
pd_error(x, "[faust] %s: bad control argument: %s",
x->label->c_str(), label);
}
if (count == 0 && strcmp(label, "active") == 0) {
if (argc == 0) {
t_atom arg;
SETFLOAT(&arg, (float)x->active);
outlet_anything(x->out, gensym((char*)"active"), 1, &arg);
} else if (argc == 1 &&
(argv[0].a_type == A_FLOAT ||
argv[0].a_type == A_DEFFLOAT)) {
float f = atom_getfloat(argv);
x->active = (int)f;
x->xfade = x->n_xfade;
}
}
}
}
static void faust_free(t_faust *x)
{
if (x->label) delete x->label;
if (x->dsp) delete x->dsp;
if (x->ui) delete x->ui;
if (x->inputs) free(x->inputs);
if (x->outputs) free(x->outputs);
if (x->buf) {
for (int i = 0; i < x->n_out; i++)
if (x->buf[i]) free(x->buf[i]);
free(x->buf);
}
}
static void *faust_new(t_symbol *s, int argc, t_atom *argv)
{
t_faust *x = (t_faust*)pd_new(faust_class);
int sr = -1;
t_symbol *id = NULL;
x->active = 1;
for (int i = 0; i < argc; i++)
if (argv[i].a_type == A_FLOAT || argv[i].a_type == A_DEFFLOAT)
sr = (int)argv[i].a_w.w_float;
else if (argv[i].a_type == A_SYMBOL || argv[i].a_type == A_DEFSYMBOL)
id = argv[i].a_w.w_symbol;
x->rate = sr;
if (sr <= 0) sr = 44100;
x->xfade = 0; x->n_xfade = (int)(sr*XFADE_TIME/64);
x->inputs = x->outputs = x->buf = NULL;
x->label = new string(sym(mydsp) "~");
x->dsp = new mydsp();
x->ui = new PdUI(id?id->s_name:NULL);
if (!x->dsp || !x->ui || !x->label) goto error;
if (id) {
*x->label += " ";
*x->label += id->s_name;
}
x->n_in = x->dsp->getNumInputs();
x->n_out = x->dsp->getNumOutputs();
if (x->n_in > 0)
x->inputs = (t_sample**)malloc(x->n_in*sizeof(t_sample*));
if (x->n_out > 0) {
x->outputs = (t_sample**)malloc(x->n_out*sizeof(t_sample*));
x->buf = (t_sample**)malloc(x->n_out*sizeof(t_sample*));
}
if ((x->n_in > 0 && x->inputs == NULL) ||
(x->n_out > 0 && (x->outputs == NULL || x->buf == NULL)))
goto error;
for (int i = 0; i < x->n_out; i++)
x->buf[i] = NULL;
x->dsp->init(sr);
x->dsp->buildUserInterface(x->ui);
for (int i = 0; i < x->n_in; i++)
inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
x->out = outlet_new(&x->x_obj, 0);
for (int i = 0; i < x->n_out; i++)
outlet_new(&x->x_obj, &s_signal);
return (void *)x;
error:
faust_free(x);
x->dsp = NULL; x->ui = NULL;
x->inputs = x->outputs = x->buf = NULL;
return (void *)x;
}
extern "C" void faust_setup(mydsp)
{
t_symbol *s = gensym(sym(mydsp) "~");
faust_class =
class_new(s, (t_newmethod)faust_new, (t_method)faust_free,
sizeof(t_faust), CLASS_DEFAULT,
A_GIMME, A_NULL);
class_addmethod(faust_class, (t_method)faust_dsp, gensym((char*)"dsp"), A_NULL);
class_addanything(faust_class, faust_any);
class_addmethod(faust_class, nullfn, &s_signal, A_NULL);
s_button = gensym((char*)"button");
s_checkbox = gensym((char*)"checkbox");
s_vslider = gensym((char*)"vslider");
s_hslider = gensym((char*)"hslider");
s_nentry = gensym((char*)"nentry");
s_vbargraph = gensym((char*)"vbargraph");
s_hbargraph = gensym((char*)"hbargrap");
/* give some indication that we're loaded and ready to go */
mydsp dsp = mydsp();
post("[faust] %s: %d inputs, %d outputs", sym(mydsp) "~",
dsp.getNumInputs(), dsp.getNumOutputs());
}
|
61ded2456d17cce6bd493c7c47aafc55ecfbf217
|
249a3b1b93777661788d01330d03fc682b2a73b2
|
/Battle Tank/BattleTank/Source/BattleTank/Public/TankMovementComponent.h
|
bee536178ef1457c82eaa322c9a0c593bcb71c2b
|
[] |
no_license
|
FireBorn123/04_BattleTank_UnrealCourse
|
d1ac59c8dff8bd03bc1e08fb4158f4fedabd4fae
|
9af9e7c7aa0349a131c0fa3b848e749452f388d0
|
refs/heads/master
| 2021-01-22T17:47:42.269419
| 2018-08-30T20:48:47
| 2018-08-30T20:48:47
| 102,403,156
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 984
|
h
|
TankMovementComponent.h
|
// Copyright Trevor Randall
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/NavMovementComponent.h"
#include "TankMovementComponent.generated.h"
class UTankTracks;
/**
* Responsibe for driving the tank tracks
*/
UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
class BATTLETANK_API UTankMovementComponent : public UNavMovementComponent
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category = "Setup")
void Initialize(UTankTracks* LeftTrackToSet, UTankTracks* RightTrackToSet);
UFUNCTION(BlueprintCallable, Category = "Input")
void IntendMoveForward(float Throw);
UFUNCTION(BlueprintCallable, Category = "Input")
void IntendTurnRight(float Throw);
//TODO check best method protection
private:
//Call from the bathfinding logic by the AI controllers
virtual void RequestDirectMove(const FVector& MoveVelocity, bool bForceMaxSpeed) override;
UTankTracks* LeftTrack = nullptr;
UTankTracks* RightTrack = nullptr;
};
|
5ff941f6aec765f5bb5bcc17c6148adbd726c0da
|
d9acf4a96e2abcf0ca55f03cd30dee90709aa2e4
|
/October_Launch/Launch_Code/Finished_Code/Memory_Storage.h
|
dd8f143b770572c950752bb5eff6293c6a85da8c
|
[] |
no_license
|
perplexinglysimple/ATEX_2018
|
364c490975785397b72bc547704cb70d9c14e06d
|
05a17c713d2961d46621635199fc40e90b18cd85
|
refs/heads/master
| 2021-07-11T08:30:57.402872
| 2017-10-16T00:38:08
| 2017-10-16T00:38:08
| 106,205,260
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,618
|
h
|
Memory_Storage.h
|
//These functions are how to write to the eeprom
void writeEEPROM(int deviceaddress, unsigned int eeaddress, uint8_t data );
byte readEEPROM(int deviceaddress, unsigned int eeaddress );
void writeEEPROM(int deviceaddress, unsigned int eeaddress, uint8_t data )
{
Wire.beginTransmission(deviceaddress);
Wire.write((int)(eeaddress >> 8)); // MSB
Wire.write((int)(eeaddress & 0xFF)); // LSB
Wire.write(data);
Wire.endTransmission();
delay(5);
}
byte readEEPROM(int deviceaddress, unsigned int eeaddress )
{
byte rdata = 0xFF;
Wire.beginTransmission(deviceaddress);
Wire.write((int)(eeaddress >> 8)); // MSB
Wire.write((int)(eeaddress & 0xFF)); // LSB
Wire.endTransmission();
Wire.requestFrom(deviceaddress,1);
if (Wire.available()) rdata = Wire.read();
return rdata;
}
//This is the common sturcture used to contain data from a device
struct devicedata
{
int8_t id;//used to id the device creating this and sees if it is 2 bit or 4 bit
long data;//the data
};
//This is te class that handles the eeprom
class memorystorage
{
public:
memorystorage();
bool writedata(int8_t devicenumber, int32_t data);
bool recycle();
bool dumpbuf();
private:
bool readstruct(devicedata data, uint16_t pos);
bool writestruct(devicedata data, uint16_t pos);
unsigned int thiswrite;
uint16_t bufferpos;
bool full;
float longtofloat(int8_t a);
long last_read [NUM_DEVICES];
};
memorystorage::memorystorage()
{
for(int i = 0; i < NUM_DEVICES; i++)
{
last_read[i] = (long)0x7FFFFFFF;
}
recycle();
}
bool memorystorage::recycle() {
bufferpos = 0;
bufferpos = readEEPROM(ADDRESSOFEEPROM, 0 );
bufferpos = (readEEPROM(ADDRESSOFEEPROM, 1 )<<8) + bufferpos;
thiswrite = bufferpos;
full = readEEPROM(ADDRESSOFEEPROM, 2 );
return 0;
}
bool memorystorage::dumpbuf() {
#ifdef Debug
Serial.begin(38400);
Serial.print("Finished write at ");
Serial.println(thiswrite);
Serial.end();
#endif
writeEEPROM(ADDRESSOFEEPROM, 0, uint8_t(thiswrite&0xFF));
writeEEPROM(ADDRESSOFEEPROM, 1, uint8_t(thiswrite&0xFF00)>>8);
return true;
}
bool memorystorage::writedata(int8_t devicenumber, int32_t data) {
#ifdef Debug
Serial.begin(38400);
Serial.print("Writing for device ");
Serial.print(devicenumber);
Serial.print(". Writing the data ");
Serial.println(data);
Serial.end();
#endif
long last_data;
if(thiswrite + 5 >= MEMORY_SIZE)
return false;
byte byteArray[4];
byteArray[0] = (uint8_t)((data >> 24) & 0xFF);
byteArray[1] = (uint8_t)((data >> 16) & 0xFF);
byteArray[2] = (uint8_t)((data >> 8) & 0xFF);
byteArray[3] = (uint8_t)((data & 0xFF));
int data_diff = data - last_read[devicenumber];
last_read[devicenumber] = data;
if(abs(data_diff) > INT16_MAX) {
writeEEPROM(ADDRESSOFEEPROM, thiswrite + 1, devicenumber);
writeEEPROM(ADDRESSOFEEPROM, thiswrite + 2, byteArray[0]);
writeEEPROM(ADDRESSOFEEPROM, thiswrite + 3, byteArray[1]);
writeEEPROM(ADDRESSOFEEPROM, thiswrite + 4, byteArray[2]);
writeEEPROM(ADDRESSOFEEPROM, thiswrite + 5, byteArray[3]);
thiswrite += 5;
}
else {
#ifdef Debug
Serial.begin(38400);
Serial.print("Going into the 3 byte small write. Diff is ");
Serial.println(data_diff);
Serial.end();
#endif
writeEEPROM(ADDRESSOFEEPROM, thiswrite + 1, ((uint8_t)devicenumber | 0x80));
writeEEPROM(ADDRESSOFEEPROM, thiswrite + 2, (uint8_t)((data_diff >> 8) & 0xFF));
writeEEPROM(ADDRESSOFEEPROM, thiswrite + 3, (uint8_t)(data_diff & 0xFF));
thiswrite += 3;
}
return true;
}
|
c3dc6178fc84bd1d8d12da0dbc2cb64381628743
|
570a21c39b9af163ef0793c149b83f6a302bd84c
|
/folly/detail/SplitStringSimdImpl.h
|
9bec8a53475e05b0ff9a0fd7cab38ccfa09be698
|
[
"MIT",
"Apache-2.0"
] |
permissive
|
facebook/folly
|
544d17b45bda70c51ba593f920e0200bde177927
|
ab45d9b6a7a2a24b2a725447387f36772dd2cc4a
|
refs/heads/main
| 2023-08-17T10:31:22.589640
| 2023-08-17T09:29:35
| 2023-08-17T09:29:35
| 4,524,181
| 23,991
| 5,805
|
Apache-2.0
| 2023-08-23T18:23:26
| 2012-06-01T20:49:04
|
C++
|
UTF-8
|
C++
| false
| false
| 4,048
|
h
|
SplitStringSimdImpl.h
|
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* 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.
*/
#pragma once
#include <folly/Portability.h>
#include <folly/Range.h>
#include <folly/detail/SimdCharPlatform.h>
#include <folly/detail/SimdForEach.h>
#include <folly/lang/Bits.h>
#if FOLLY_X64
#include <immintrin.h>
#endif
#if FOLLY_AARCH64
#include <arm_neon.h>
#endif
// This file is not supposed to be included by users.
// It should be included in CPP file which exposes apis.
// It is a header file to test different platforms.
// All funcitons are force inline because they are merged into big hiddend
// noinline functions
namespace folly {
namespace detail {
template <bool ignoreEmpty, typename Container>
void splitByCharScalar(char sep, folly::StringPiece what, Container& res) {
const char* prev = what.data();
const char* f = prev;
const char* l = what.data() + what.size();
auto emplaceBack = [&](const char* sf, const char* sl) mutable {
if (ignoreEmpty && sf == sl) {
return;
}
res.emplace_back(sf, sl - sf);
};
while (f != l) {
const char* next = f + 1;
if (*f == sep) {
if (!ignoreEmpty || (prev != f)) {
emplaceBack(prev, f);
}
prev = next;
}
f = next;
}
emplaceBack(prev, f);
}
template <typename Platform, bool ignoreEmpty>
struct PlatformSimdSplitByChar {
using reg_t = typename Platform::reg_t;
template <typename Container>
FOLLY_ALWAYS_INLINE void emplaceBack(
Container& res, const char* f, const char* l) const {
if (ignoreEmpty && f == l) {
return;
}
res.emplace_back(f, l - f);
}
template <typename Uint, typename Container>
FOLLY_ALWAYS_INLINE void outputStringsFoMmask(
Uint mmask,
const char* pos,
const char*& prev,
Container& res) const { // reserve was not beneficial on benchmarks.
while (mmask) {
auto counted = folly::findFirstSet(mmask) - 1;
mmask >>= counted;
mmask >>= Platform::kMmaskBitsPerElement;
auto firstSet = counted / Platform::kMmaskBitsPerElement;
const char* split = pos + firstSet;
pos = split + 1;
emplaceBack(res, prev, split);
prev = pos;
}
}
template <typename Container>
struct ForEachDelegate {
const PlatformSimdSplitByChar& self;
char sep;
const char*& prev;
Container& res;
template <typename Ignore, typename UnrollIndex>
FOLLY_ALWAYS_INLINE bool step(
const char* ptr, Ignore ignore, UnrollIndex) const {
reg_t loaded = Platform::loada(ptr, ignore);
auto mmask = Platform::movemask(Platform::equal(loaded, sep));
mmask = Platform::clear(mmask, ignore);
self.outputStringsFoMmask(mmask, ptr, prev, res);
return false;
}
};
template <typename Container>
FOLLY_ALWAYS_INLINE void operator()(
char sep, folly::StringPiece what, Container& res) const {
const char* prev = what.data();
ForEachDelegate<Container> delegate{*this, sep, prev, res};
simd_detail::simdForEachAligning</*unrolling*/ 1>(
Platform::kCardinal, what.data(), what.data() + what.size(), delegate);
emplaceBack(res, prev, what.data() + what.size());
}
};
template <bool ignoreEmpty>
struct PlatformSimdSplitByChar<void, ignoreEmpty> {
template <typename Container>
FOLLY_ALWAYS_INLINE void operator()(
char sep, folly::StringPiece what, Container& res) const {
return splitByCharScalar<ignoreEmpty>(sep, what, res);
}
};
} // namespace detail
} // namespace folly
|
0cccf6e82ab80454477675bf630ec0642850db5e
|
bbda75d4de33a14c7e7a177b3a89ae708ae693c7
|
/non_blocking_timers.cpp
|
6f10a6ce05da32cd9385ecd296e0a6276c8d5afb
|
[] |
no_license
|
ben-jacobson/non_blocking_timers
|
0413b6537a5314273c52a4acad7dd1e947b10fcc
|
ccb52c1188dc59d0998c49e79320d5032ea33ef2
|
refs/heads/main
| 2023-06-02T09:21:43.970199
| 2021-06-18T10:33:06
| 2021-06-18T10:33:06
| 377,454,258
| 2
| 2
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,867
|
cpp
|
non_blocking_timers.cpp
|
#include "non_blocking_timers.h"
non_blocking_timer static_timer_first_in_list; // the first item in the list is an unused timer which acts as the static base
non_blocking_timer *last_timer_in_list = &static_timer_first_in_list; // last timer in linked list, this will continually update as needed. having it continually updated by the algorithm prevents us from needing to traverse it to find the address every time.
void add_new_generic_timer(non_blocking_timer *non_blocking_timer_ptr, unsigned int _end_after, bool _repeating) {
// place this at the end of the list and update the pointers
non_blocking_timer_ptr->prev_timer_in_list = last_timer_in_list; // update the new timers prev timer
last_timer_in_list->next_timer_in_list = non_blocking_timer_ptr; // update the last timer to point to the new timer (even if its the first)
last_timer_in_list = non_blocking_timer_ptr; // then update the last timer in the list
// initialize the rest of the timer
non_blocking_timer_ptr->finished = false;
non_blocking_timer_ptr->repeating = _repeating;
non_blocking_timer_ptr->end_after = _end_after;
non_blocking_timer_ptr->start_time = millis();
}
void delete_timer(non_blocking_timer *non_blocking_timer_ptr) {
non_blocking_timer *prev_timer = non_blocking_timer_ptr->prev_timer_in_list; // there is always a previous timer, the first in the list will link to the static base
if (non_blocking_timer_ptr != last_timer_in_list) { // if removing a timer from the middle of the list
non_blocking_timer *next_timer = non_blocking_timer_ptr->next_timer_in_list;
prev_timer->next_timer_in_list = next_timer; // link the previous item to the next item, thus removing the current item.
next_timer->prev_timer_in_list = prev_timer; // if this happens to the first item in linked lust, it will copy the static base next timer which is nullptr
}
else { // if you are removing the last of the list.
// update the last timer pointer and nullify the next timer pointer
prev_timer->next_timer_in_list = nullptr;
last_timer_in_list = prev_timer; // update last timer pointer.
}
// we'll keep the next and prev pointers within non_blocking_timer_ptr active for now, the update_timer loop relies on them and we can re-init will delete them later.
}
void init_digitalWrite_timer(non_blocking_timer *non_blocking_timer_ptr, unsigned int _end_after, uint8_t _ulPin, uint8_t _ulVal) {
pinMode(_ulPin, OUTPUT); // the pin must be an digital output
non_blocking_timer_ptr->ulPin = _ulPin;
non_blocking_timer_ptr->ulVal = _ulVal;
add_new_generic_timer(non_blocking_timer_ptr, _end_after, false);
}
void init_digitalWrite_oscillator(non_blocking_timer *non_blocking_timer_ptr, unsigned int _cycle_duration, uint32_t _ulPin, uint32_t _start_ulVal) {
pinMode(_ulPin, OUTPUT); // the pin must be an digital output
non_blocking_timer_ptr->ulPin = _ulPin;
non_blocking_timer_ptr->ulVal = _start_ulVal;
add_new_generic_timer(non_blocking_timer_ptr, _cycle_duration, true);
}
void init_function_timer(non_blocking_timer *non_blocking_timer_ptr, unsigned int _end_after, callback_function event_callback, bool _repeating) {
non_blocking_timer_ptr->event_callback = event_callback;
add_new_generic_timer(non_blocking_timer_ptr, _end_after, _repeating);
}
void update_timers(void) {
unsigned long int current_time = millis();
non_blocking_timer *timer_to_update = &static_timer_first_in_list;
while (timer_to_update->next_timer_in_list != nullptr) {
timer_to_update = timer_to_update->next_timer_in_list; // This still relies on the deleted timer to show the original next item in list, and by now the linked list has reset it's order correctly.
if (timer_to_update->finished == false && current_time - timer_to_update->start_time >= timer_to_update->end_after) {
// timer has expired
if (timer_to_update->event_callback != nullptr) { // execute the callback if that's how the timer is set up
timer_to_update->event_callback();
}
else {
digitalWrite(timer_to_update->ulPin, timer_to_update->ulVal); // change our pin value if that's how the timer is set up
if (timer_to_update->repeating == true) {
timer_to_update->ulVal = !timer_to_update->ulVal; // flip the HIGH/LOW if a pin.
}
}
if (timer_to_update->repeating == false) {
timer_to_update->finished = true; // allow this to be used once again.
delete_timer(timer_to_update);
}
else {
timer_to_update->start_time = millis(); // reset timer
}
}
}
}
|
6c213e59acece8587dc7ac7c7d335895944643ee
|
cc2b07d9e4266efcc830451adfb69b925ec10867
|
/PlugIns/EXRCodec/src/OgreEXRCodec.cpp
|
efd4b32de5abf43f25af23f179e3ac57b184fda9
|
[
"MIT"
] |
permissive
|
OGRECave/ogre
|
74c9c318d95010a3e5fba9709ffebc7e781f27a2
|
15631ca2dd44bd0c925e33411bee05ccac95fc55
|
refs/heads/master
| 2023-09-04T21:08:30.326815
| 2023-09-02T10:49:34
| 2023-09-02T10:49:34
| 47,069,819
| 3,716
| 1,178
|
MIT
| 2023-09-14T05:33:08
| 2015-11-29T15:57:03
|
C++
|
UTF-8
|
C++
| false
| false
| 5,223
|
cpp
|
OgreEXRCodec.cpp
|
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2014 Torus Knot Software Ltd
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 "OgreRoot.h"
#include "OgreLogManager.h"
#include "OgreImage.h"
#include "OgreException.h"
#include "OgreEXRCodecExports.h"
#include "OgreEXRCodec.h"
#include "O_IStream.h"
#include <cmath>
#include <ImfOutputFile.h>
#include <ImfInputFile.h>
#include <ImfChannelList.h>
#include <ImfStringAttribute.h>
#include <ImfMatrixAttribute.h>
#include <ImfArray.h>
using namespace Imath;
using namespace Imf;
namespace Ogre {
EXRCodec::EXRCodec()
{
LogManager::getSingleton().logMessage("EXRCodec initialised");
}
EXRCodec::~EXRCodec()
{
LogManager::getSingleton().logMessage("EXRCodec deinitialised");
}
void EXRCodec::decode(const DataStreamPtr& input, const Any& output) const
{
Image* image = any_cast<Image*>(output);
try {
// Make a mutable clone of input to be able to change file pointer
MemoryDataStream myIn(input);
// Now we can simulate an OpenEXR file with that
O_IStream str(myIn, "SomeChunk.exr");
InputFile file(str);
Box2i dw = file.header().dataWindow();
int width = dw.max.x - dw.min.x + 1;
int height = dw.max.y - dw.min.y + 1;
int components = 3;
// Alpha channel present?
const ChannelList &channels = file.header().channels();
if(channels.findChannel("A"))
components = 4;
auto format = components==3 ? PF_FLOAT32_RGB : PF_FLOAT32_RGBA;
// Allocate memory
image->create(format, width, height);
// Construct frame buffer
uchar *pixels = image->getData();
FrameBuffer frameBuffer;
frameBuffer.insert("R", // name
Slice (PixelType::FLOAT, // type
((char *) pixels)+0, // base
4 * components, // xStride
4 * components * width)); // yStride
frameBuffer.insert("G", // name
Slice (PixelType::FLOAT, // type
((char *) pixels)+4, // base
4 * components, // xStride
4 * components * width)); // yStride
frameBuffer.insert("B", // name
Slice (PixelType::FLOAT, // type
((char *) pixels)+8, // base
4 * components, // xStride
4 * components * width)); // yStride
if(components==4) {
frameBuffer.insert("A", // name
Slice (PixelType::FLOAT, // type
((char *) pixels)+12, // base
4 * components, // xStride
4 * components * width)); // yStride
}
file.setFrameBuffer (frameBuffer);
file.readPixels (dw.min.y, dw.max.y);
} catch (const std::exception &exc) {
throw(Exception(Exception::ERR_INTERNAL_ERROR,
"OpenEXR Error",
exc.what()));
}
}
String EXRCodec::getType() const
{
return "exr";
}
String EXRCodec::magicNumberToFileExt(const char* magicNumberPtr, size_t maxbytes) const
{
// look for OpenEXR magic number
if (maxbytes >= 4
&& magicNumberPtr[0] == 0x76
&& magicNumberPtr[1] == 0x2f
&& magicNumberPtr[2] == 0x31
&& magicNumberPtr[3] == 0x01)
return "exr";
return "";
}
#ifndef OGRE_STATIC_LIB
static Codec *mEXRCodec;
extern "C" _OgreEXRPluginExport void dllStartPlugin();
extern "C" _OgreEXRPluginExport void dllStopPlugin();
extern "C" _OgreEXRPluginExport void dllStartPlugin()
{
mEXRCodec = new EXRCodec;
Codec::registerCodec( mEXRCodec );
}
extern "C" _OgreEXRPluginExport void dllStopPlugin()
{
Codec::unregisterCodec( mEXRCodec );
delete mEXRCodec;
}
#endif
}
|
73fec19a409af37b762ac6d2a9bd09bd5c9d696e
|
2c6e88d2f0fc145c7a53ba612b30946755a2846b
|
/Assignments/DX11Starter/Game.cpp
|
6feeb01901e2113f3c0ffb06e68d71490f940118
|
[] |
no_license
|
SButtan93-dev/GGP_Assignments
|
5ea477231fc0b9ae53f17b1b3a74f5b190767c18
|
75b8fb1fefeb1e8dc6cd377a8d5b8c8eb4469fa9
|
refs/heads/master
| 2020-04-22T20:32:46.059134
| 2019-02-14T07:44:23
| 2019-02-14T07:44:23
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 12,893
|
cpp
|
Game.cpp
|
#include "Game.h"
#include "Vertex.h"
#include "GameEntity.h"
// For the DirectX Math library
using namespace DirectX;
// --------------------------------------------------------
// Constructor
//
// DXCore (base class) constructor will set up underlying fields.
// DirectX itself, and our window, are not ready yet!
//
// hInstance - the application's OS-level handle (unique ID)
// --------------------------------------------------------
Game::Game(HINSTANCE hInstance)
: DXCore(
hInstance, // The application's handle
"DirectX Game", // Text for the window's title bar
1280, // Width of the window's client area
720, // Height of the window's client area
true) // Show extra stats (fps) in title bar?
{
#if defined(DEBUG) || defined(_DEBUG)
// Do we want a console window? Probably only in debug mode
CreateConsoleWindow(500, 120, 32, 120);
printf("Console window created successfully. Feel free to printf() here.\n");
#endif
}
// --------------------------------------------------------
// Destructor - Clean up anything our game has created:
// - Release all DirectX objects created here
// - Delete any objects to prevent memory leaks
// --------------------------------------------------------
Game::~Game()
{
// Delete our simple shader objects, which
// will clean up their own internal DirectX stuff
delete MyGameEntity1;
delete MyGameEntity2;
delete MyGameEntity3;
delete MyGameEntity4;
delete MyGameEntity5;
delete MyMesh1;
delete MyMesh2;
delete MyMesh3;
delete MyCamera;
delete MyMaterial;
}
// --------------------------------------------------------
// Called once per program, after DirectX and the window
// are initialized but before the game loop.
// --------------------------------------------------------
void Game::Init()
{
// Helper methods for loading shaders, creating some basic
// geometry to draw and some simple camera matrices.
// - You'll be expanding and/or replacing these later
MyMaterial->LoadShaders(device, context);
CreateMatrices();
//MyMesh1->GetVertexData();
CreateBasicGeometry();
//MyMesh1->CreateBasicGeometry1();
// Tell the input assembler stage of the pipeline what kind of
// geometric primitives (points, lines or triangles) we want to draw.
// Essentially: "What kind of shape should the GPU draw with our data?"
context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
}
// --------------------------------------------------------
// Initializes the matrices necessary to represent our geometry's
// transformations and our 3D camera
// --------------------------------------------------------
void Game::CreateMatrices()
{
// Set up world matrix
// - In an actual game, each object will need one of these and they should
// update when/if the object moves (every frame)
// - You'll notice a "transpose" happening below, which is redundant for
// an identity matrix. This is just to show that HLSL expects a different
// matrix (column major vs row major) than the DirectX Math library
MyGameEntity1->GetWorldMatrix();
XMMATRIX W = XMMatrixIdentity();
XMStoreFloat4x4(&worldMatrix, XMMatrixTranspose(W)); // Transpose for HLSL!
//call and set my projection matrix
MyCamera->SetProjectionMatrix(width, height);
}
// --------------------------------------------------------
// Creates the geometry we're going to draw - a single triangle for now
// --------------------------------------------------------
void Game::CreateBasicGeometry()
{
XMFLOAT4 red = XMFLOAT4(1.0f, 0.0f, 0.0f, 1.0f);
XMFLOAT4 green = XMFLOAT4(0.0f, 1.0f, 0.0f, 1.0f);
XMFLOAT4 blue = XMFLOAT4(0.0f, 0.0f, 1.0f, 1.0f);
Vertex vertices1[] = {
{ XMFLOAT3(1.0f,1.0f , +0.0f), red },
{ XMFLOAT3(1.5f,1.0f , +0.0f), blue },
{ XMFLOAT3(1.5f,0.5f , +0.0f), red },
{ XMFLOAT3(1.5f,0.0f , +0.0f), blue },
{ XMFLOAT3(1.0f,0.0f , +0.0f), green },
{ XMFLOAT3(0.5f,0.5f , +0.0f), green },
};
Vertex vertices2[] =
{
{ XMFLOAT3(-.25f, +.25f, +0.0f), red },
{ XMFLOAT3(+0.25f, -0.25f, +0.0f), blue },
{ XMFLOAT3(-0.25f, -0.25f, +0.0f), green },
{ XMFLOAT3(+0.25f, +0.25f, +0.0f), red },
};
Vertex vertices3[] =
{
{ XMFLOAT3(-1.5f, 1.5f, +0.0f), red },
{ XMFLOAT3(-1.5f, 0.0f, +0.0f), blue },
{ XMFLOAT3(-2.5f, 0.0f, +0.0f), green },
};
int indices[] = { 0, 1, 2, 0, 3, 2 };
//Mesh 1
MyMesh1->GetVertexData(sizeof(vertices2));
MyMesh1->GetResourceVertexData(vertices2);
MyMesh1->DeviceCallForVertex(device);
MyMesh1->GetIndexData(sizeof(indices));
MyMesh1->GetResourceIndexData(indices);
MyMesh1->DeviceCallForIndex(device);
//Mesh 2
MyMesh2->GetVertexData(sizeof(vertices1));
MyMesh2->GetResourceVertexData(vertices1);
MyMesh2->DeviceCallForVertex(device);
int indices1[] = { 0,1,3,1,2,3,0,3,4,0,4,5 };
MyMesh2->GetIndexData(sizeof(indices1));
MyMesh2->GetResourceIndexData(indices1);
MyMesh2->DeviceCallForIndex(device);
//Mesh 3
MyMesh3->GetVertexData(sizeof(vertices3));
MyMesh3->GetResourceVertexData(vertices3);
MyMesh3->DeviceCallForVertex(device);
int indices3[] = { 0, 1, 2 };
MyMesh3->GetIndexData(sizeof(indices3));
MyMesh3->GetResourceIndexData(indices3);
MyMesh3->DeviceCallForIndex(device);
}
// --------------------------------------------------------
// Handle resizing DirectX "stuff" to match the new window size.
// For instance, updating our projection matrix's aspect ratio.
// --------------------------------------------------------
void Game::OnResize()
{
// Handle base-level DX resize stuff
DXCore::OnResize();
// Update our projection matrix since the window size changed
XMMATRIX P = XMMatrixPerspectiveFovLH(
0.25f * 3.1415926535f, // Field of View Angle
(float)width / height, // Aspect ratio
0.1f, // Near clip plane distance
100.0f); // Far clip plane distance
XMStoreFloat4x4(MyCamera->GetProjectionMatrix(), XMMatrixTranspose(P)); // Transpose for HLSL!
}
// --------------------------------------------------------
// Update your game here - user input, move objects, AI, etc.
// --------------------------------------------------------
void Game::Update(float deltaTime, float totalTime)
{
// Quit if the escape key is pressed
if (GetAsyncKeyState(VK_ESCAPE))
Quit();
// Make a value that goes up and down
float sinTime = (sin(totalTime * 10) + 2.0f) / 10.0f;
float cosTime = (cos(totalTime * 10) + 2.0f) / 10.0f;
//for entity 1
MyGameEntity1->SetMyTrans(1.f, 0.f, 0.f);
MyGameEntity1->SetMyRot(totalTime);
MyGameEntity1->SetMyScale(sinTime);
//for entity 2
MyGameEntity2->SetMyTrans(1.f, 0.f, 0.f);
MyGameEntity2->SetMyRot(1-totalTime);
MyGameEntity2->SetMyScale(0.7f);
//for entity 3
float MyLocalCountForScale=totalTime / 10;
if (MyLocalCountForScale < 0.5f)
{
MyGameEntity3->SetMyTrans(1.f, 0.f, 0.f);
MyGameEntity3->SetMyRot((1 - totalTime) * 10);
MyGameEntity3->SetMyScale(MyLocalCountForScale);
}
else
{
MyGameEntity3->SetMyTrans(1.f, 0.f, 0.f);
MyGameEntity3->SetMyRot((1 - totalTime) * 10);
MyGameEntity3->SetMyScale(0.5f);
}
//for entity 4
MyGameEntity4->SetMyTrans(1.f, 0.f, 0.f);
MyGameEntity4->SetMyRot(totalTime);
MyGameEntity4->SetMyScale(sinTime*2);
//for entity 5
MyGameEntity5->SetMyTrans(1.f, 0.f, 0.f);
MyGameEntity5->SetMyRot(totalTime);
MyGameEntity5->SetMyScale(0.8f);
//get viewmatrix from camera class
*&viewMatrix1 = MyCamera->Update(deltaTime,totalTime);
viewMatrix = *viewMatrix1;
}
// --------------------------------------------------------
// Clear the screen, redraw everything, present to the user
// --------------------------------------------------------
void Game::Draw(float deltaTime, float totalTime)
{
// Background color (Cornflower Blue in this case) for clearing
const float color[4] = { 0.4f, 0.6f, 0.75f, 0.0f };
// Clear the render target and depth buffer (erases what's on the screen)
// - Do this ONCE PER FRAME
// - At the beginning of Draw (before drawing *anything*)
context->ClearRenderTargetView(backBufferRTV, color);
context->ClearDepthStencilView(
depthStencilView,
D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL,
1.0f,
0);
//Get Projection matrix from camera for all shader calls
*&projectionMatrix = MyCamera->GetProjectionMatrix();
//Set world matrix for Mesh 1, game entity 1
XMStoreFloat4x4(&worldMatrix, XMMatrixTranspose(MyGameEntity1->GetWorldMatrix()));
//set shaders
MyGameEntity1->PrepareMaterial(worldMatrix, viewMatrix, *projectionMatrix, MyMaterial);
//call draw functions for mesh 1
MyMesh1->CallDrawMethodFunction(context);
MyMesh1->CallMyDrawFunc(context,6);
//Set world matrix for Mesh 2, game entity 2
XMStoreFloat4x4(&worldMatrix, XMMatrixTranspose(MyGameEntity2->GetWorldMatrix()));
//set shaders
MyGameEntity2->PrepareMaterial(worldMatrix, viewMatrix, *projectionMatrix, MyMaterial);
//call draw functions for mesh 2
MyMesh2->CallDrawMethodFunction(context);
MyMesh2->CallMyDrawFunc(context,12);
//Set world matrix for Mesh 3, game entity 3
XMStoreFloat4x4(&worldMatrix, XMMatrixTranspose(MyGameEntity3->GetWorldMatrix()));
//set shaders
MyGameEntity3->PrepareMaterial(worldMatrix, viewMatrix, *projectionMatrix, MyMaterial);
//call draw functions for mesh 3
MyMesh3->CallDrawMethodFunction(context);
MyMesh3->CallMyDrawFunc(context, 3);
//Set world matrix for Mesh 3, game entity 4
XMStoreFloat4x4(&worldMatrix, XMMatrixTranspose(MyGameEntity4->GetWorldMatrix()));
//set shaders
MyGameEntity4->PrepareMaterial(worldMatrix, viewMatrix, *projectionMatrix, MyMaterial);
//call draw functions for mesh 3
MyMesh3->CallDrawMethodFunction(context);
MyMesh3->CallMyDrawFunc(context, 3);
//Set world matrix for Mesh 2, game entity 5
XMStoreFloat4x4(&worldMatrix, XMMatrixTranspose(MyGameEntity5->GetWorldMatrix()));
//set shaders
MyGameEntity5->PrepareMaterial(worldMatrix, viewMatrix, *projectionMatrix, MyMaterial);
//call draw functions for mesh 2
MyMesh2->CallDrawMethodFunction(context);
MyMesh2->CallMyDrawFunc(context, 12);
// Present the back buffer to the user
// - Puts the final frame we're drawing into the window so the user can see it
// - Do this exactly ONCE PER FRAME (always at the very end of the frame)
//swapChain->Present(0, 0);
// Present the back buffer to the user
// - Puts the final frame we're drawing into the window so the user can see it
// - Do this exactly ONCE PER FRAME (always at the very end of the frame)
swapChain->Present(0, 0);
}
#pragma region Mouse Input
// --------------------------------------------------------
// Helper method for mouse clicking. We get this information
// from the OS-level messages anyway, so these helpers have
// been created to provide basic mouse input if you want it.
// --------------------------------------------------------
void Game::OnMouseDown(WPARAM buttonState, int x, int y)
{
// Add any custom code here...
// Save the previous mouse position, so we have it for the future
prevMousePos.x = x;
prevMousePos.y = y;
// Caputure the mouse so we keep getting mouse move
// events even if the mouse leaves the window. we'll be
// releasing the capture once a mouse button is released
SetCapture(hWnd);
}
// --------------------------------------------------------
// Helper method for mouse release
// --------------------------------------------------------
void Game::OnMouseUp(WPARAM buttonState, int x, int y)
{
// Add any custom code here...
// We don't care about the tracking the cursor outside
// the window anymore (we're not dragging if the mouse is up)
ReleaseCapture();
}
// --------------------------------------------------------
// Helper method for mouse movement. We only get this message
// if the mouse is currently over the window, or if we're
// currently capturing the mouse.
// --------------------------------------------------------
void Game::OnMouseMove(WPARAM buttonState, int x, int y)
{
// Add any custom code here...
if (y > prevMousePos.y && (buttonState & 0x0001))
{
MyCamera->SetMyRotation((float)x*-0.00001f, 0);
}
else if (y < prevMousePos.y && (buttonState & 0x0001))
{
MyCamera->SetMyRotation((float)x*0.00001f, 0);
}
else if (x > prevMousePos.x && (buttonState & 0x0002))
{
MyCamera->SetMyRotation(0, (float)y*0.00001f);
}
else if (x < prevMousePos.x && (buttonState & 0x0002))
{
MyCamera->SetMyRotation(0, (float)y*-0.00001f);
}
// Save the previous mouse position, so we have it for the future
prevMousePos.x = x;
prevMousePos.y = y;
}
// --------------------------------------------------------
// Helper method for mouse wheel scrolling.
// WheelDelta may be positive or negative, depending
// on the direction of the scroll
// --------------------------------------------------------
void Game::OnMouseWheel(float wheelDelta, int x, int y)
{
// Add any custom code here...
}
#pragma endregion
|
1eafa5d810a7c82bb46fda8f1ad0ec510796d1bb
|
997ee9cc0726b36ee877dbd6595a64af68ee2e90
|
/src/ContraharmonicMeanFilter.h
|
084a5b47d6f1060ce8eb073e8b411cbae7dd4b71
|
[] |
no_license
|
palkakrzysiek/WOTers
|
ce3e99187d1058a70fb64b8da5651874a7fc1d75
|
779cdbf287358f71099446f02c1c95452e05cdfc
|
refs/heads/master
| 2021-06-06T06:03:12.356738
| 2019-05-06T11:09:12
| 2019-05-06T11:09:12
| 13,294,297
| 2
| 1
| null | 2019-05-06T11:09:13
| 2013-10-03T08:58:55
|
C++
|
UTF-8
|
C++
| false
| false
| 274
|
h
|
ContraharmonicMeanFilter.h
|
#ifndef __CONTRAHARMONIC_MEAN_FILTER_H__
#define __CONTRAHARMONIC_MEAN_FILTER_H__
#include "Operation.h"
class ContraharmonicMeanFilter : public Operation
{
public:
ContraharmonicMeanFilter(double q);
void perform(Image &image);
private:
double order;
};
#endif
|
a5e7ef7687c171ee1fe054804c549a3ba2fe9764
|
d49e008a9314215918e33bef49a9adedc9f29ec5
|
/Source/Functions/functions.hh
|
43695a899b9d5598c14c9dc2bfe15c333e260a7c
|
[] |
no_license
|
jorisVerschaeve/gokstad
|
6712fc8889f361e39d65a3393d24191368fff66e
|
c89add3088e4fb5788d0ecdceb1a662a3d772436
|
refs/heads/master
| 2021-01-01T04:53:44.727822
| 2017-07-14T20:02:36
| 2017-07-14T20:02:36
| 92,031,825
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,414
|
hh
|
functions.hh
|
/*
*
*
*
* Joris Verschaeve
*
*
*
*/
#ifndef GOKSTAD_FUNCTIONS_HH
#define GOKSTAD_FUNCTIONS_HH
namespace gokstad {
//////////////////////FunctionIndexingHelper////////////////////////
int FunctionIndexingHelper2D::getDerivativeSize(int Dtot)
{
return (Dtot+1)*(Dtot+2)/2;
}
int FunctionIndexingHelper2D::getDerivativeIndex(int dx, int dy)
{
int Dtot = dx+dy;
return (Dtot+1)*(Dtot+2)/2 - Dtot + dy - 1;
}
///////////////////////Function1D///////////////////////////////////
template<typename U, typename T>
void Function1D<U,T>::evaluate(const T *const x, int n, U *const f, int d) const
{
for(int i = 0; i < n ; ++i){
f[i] = this->evaluate(x[i],d);
}
}
///////////////////////Function2D///////////////////////////////////
template<typename U, typename T>
void Function2D<U,T>::
evaluate(const T *const x, const T *const y,
int n, int dx, int dy,U *const f) const
{
for(int i = 0; i < n ; ++i){
f[i] = this->evaluate(x[i],y[i],dx,dy);
}
}
template<typename U, typename T>
void Function2D<U,T>::
evaluateAllDerivatives(T x, T y, int Dtot, U *const f) const
{
/// f[DerivativeSize(Dtot)]
for(int d = 0; d <= Dtot ; ++d){
for(int dx = 0; dx <= d ; ++dx){
for(int dy = d-dx; dy >= 0 ; --dy){
f[FunctionIndexingHelper2D::getDerivativeIndex(dx,dy)] =
this->evaluate(x,y,dx,dy);
}
}
}
}
} // namespace gokstad
#endif
|
6d864f3f2ee2aa5edece6cb5e81ad1369b424a0f
|
ece8b6de06a40bd16535c1d5026049141fddb2a7
|
/gridworld/label_evaluator/evaluator_label_collision.cpp
|
67aaa1b7e018041cc3b400f9237e11d129400f8b
|
[
"MIT"
] |
permissive
|
SunTianzhHERE/planner-rules-mcts
|
bb1b24a479cc4f08275613b4cc912906ed9153a7
|
35b09a857d8c3f1c65e0ed80ee4df1b358e45bf4
|
refs/heads/master
| 2023-07-31T15:05:51.184848
| 2021-06-15T13:58:36
| 2021-06-15T13:58:36
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,004
|
cpp
|
evaluator_label_collision.cpp
|
// Copyright (c) 2020 fortiss GmbH
//
// Authors: Klemens Esterle, Luis Gressenbuch
//
// This work is licensed under the terms of the MIT license.
// For a copy, see <https://opensource.org/licenses/MIT>.
#include "gridworld/label_evaluator/evaluator_label_collision.h"
#include <algorithm>
#include "gridworld/label_evaluator/evaluator_label_at_position.h"
bool check_collision(const AgentState &a, const AgentState &b) {
int o_prev = b.x_pos - b.last_action;
int upper_o = std::max(o_prev, b.x_pos);
int lower_o = std::min(o_prev, b.x_pos);
int e_prev = a.x_pos - a.last_action;
int upper_e = std::max(e_prev, a.x_pos);
int lower_e = std::min(e_prev, a.x_pos);
int overlap = std::min(upper_e, upper_o) - std::max(lower_e, lower_o);
bool is_overlapping = false;
if (!((b.last_action != 0 && b.x_pos == e_prev) ||
(a.last_action != 0 && a.x_pos == o_prev)) ||
overlap != 0) {
is_overlapping = overlap >= 0;
}
return ((b.lane == a.lane) && (is_overlapping || (a.x_pos == b.x_pos)));
}
EvaluatorLabelCollision::EvaluatorLabelCollision(const std::string &label_str,
const int merging_point)
: EvaluatorLabelBase(label_str), merging_point_(merging_point) {}
std::vector<std::pair<Label, bool>> EvaluatorLabelCollision::evaluate(
const World &state) const {
// Check if intervals (ego.x_pos - ego.last_action, ego.x_pos] and
// (other.x_pos - other.last_action, other.x_pos] overlap.
EvaluatorLabelAtPosition at_merge("at_merge", merging_point_);
bool ego_at_xing = at_merge.evaluate(state)[0].second;
World other_world(state.first, std::vector<AgentState>());
bool result = false;
for (const auto &agent : state.second) {
other_world.first = agent;
bool agent_at_xing = at_merge.evaluate(other_world)[0].second;
result =
(ego_at_xing && agent_at_xing) || check_collision(state.first, agent);
if (result) {
break;
}
}
return {{get_label(), result}};
}
|
8b9492acddc9737a82610223334ff56493af460c
|
7af6c31502f6b6f614124ce9bd7c27386ec863dc
|
/C09/GlobalVariable.cpp
|
92aef77cb5823c3f0cd55d465034fd6fe6f0abe2
|
[] |
no_license
|
bell0136/TIL
|
7761580b1d7374d46d0ae83d01d2bf4f1576b3d7
|
d54a6746479423e554f3eaa5c6c62884880af37d
|
refs/heads/master
| 2020-09-13T01:20:29.055065
| 2020-07-31T13:05:08
| 2020-07-31T13:05:08
| 222,618,875
| 0
| 0
| null | null | null | null |
UHC
|
C++
| false
| false
| 249
|
cpp
|
GlobalVariable.cpp
|
#include <Stdio.h>
int num;
void add (int i)
{
num+=i;
}
int main (void)
{
printf("%d\n",num);
add(3);
printf("num=%d",num);
num++;
printf("num=%d",num);
}
//지역변수에서 선언이 될 때 같은이름의 전역변수 가리워진다!.
|
03807f799939748887906274ca698abc52caf923
|
7ee1268757e0cda96c22c7a23cd8e4f29ff95290
|
/src/server/game.h
|
69fdd257ecc3a8b1374b03f48246247974387585
|
[] |
no_license
|
SnoozeTime/quizzbot
|
a1a6d32d1356347a8177645248c1d8ae36f2b6a3
|
e9eb4ceae0559059b5a7f253375da957395057eb
|
refs/heads/master
| 2020-03-28T11:36:05.026058
| 2018-10-08T08:14:12
| 2018-10-08T08:14:12
| 148,230,024
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,033
|
h
|
game.h
|
//
// Created by benoit on 18/09/09.
//
#ifndef QUIZZBOT_GAME_H
#define QUIZZBOT_GAME_H
#include <thread>
#include <boost/asio.hpp>
#include <memory>
#include "network.h"
#include "common/event_queue.h"
#include "quizz_system.h"
namespace quizzbot {
class game {
public:
enum class game_state {
WAITING_FOR_ANSWER, // Wait for answer from the clients. Will finish after timeout.
INITIALIZING, // Get a new equation and will send it to all clients.
CLOSING_CURRENT_SESSION, // if somebody has correct answer, add a point
};
game();
void loop();
private:
boost::asio::io_service io_;
// the io service work is used to keep the io loop busy until
// we initialize the server.
boost::asio::io_service::work io_work_;
std::thread io_thread_;
// Why unique_ptr? I want to control the initialization
std::unique_ptr<ChatRoom> participants_;
std::unique_ptr<tcp_server> server_;
std::unique_ptr<QuizzSystem> quizz_system_;
};
}
#endif //QUIZZBOT_GAME_H
|
7ba2d4e16a44cf3c908b869c567b97a89e1537a4
|
c7a0acde24d7a2f2d8305d6808c60eea124475aa
|
/CLRS/VI. Graph Algorithms/24 Single-Source Shortest Paths/Graph_SP.h
|
0110970265cfbdd1dff00d90f384a074ef5592a7
|
[] |
no_license
|
kamalm87/Algs-and-DS
|
6526d2e5e4708bb8541bd9f350b6574bfe9fd8ab
|
74f90a8641deca34f178f52e622d49ccca7c6f6c
|
refs/heads/master
| 2021-01-01T05:32:09.401908
| 2015-04-11T19:22:19
| 2015-04-11T19:22:19
| 24,478,612
| 1
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 11,199
|
h
|
Graph_SP.h
|
#pragma once
#include "Auxiliary/DynamicArray.h"
#include "Auxiliary/Heap.h"
#include "Auxiliary/LinkedList.h"
#include "Auxiliary/Map.h"
#include "Auxiliary/Set.h"
// For std::numerics<int>::max() to mark pseudo-infinite Distance value for untraversed Vertices
#include <limits>
// Forward declaration to give Graph access to certain Vertex private elements
template <typename T, typename W = int>
class Graph;
// Enums used for internally invoked Depth-First Searches
enum VertexColor{ vWHITE = 1, vGRAY, vBLACK };
template <typename T>
struct Vertex{
// Provides Graph access to Vertex attributes related to Depth-First Search, which are
// not explicitly used in any algorithms for Section 24.
friend class Graph<T,int>;
// All explicit construction should use the parametized constructor.
// The default-constructor is intended to function as a boundary points for containers
// Assumption for the Distance variable:
// - all-traversed vertices <= untraversed vertices ( max - 1 ) < default-constructed vertice boundary points ( max )
Vertex() : Data(T()), Predecessor( nullptr ), Distance( std::numeric_limits<int>::max() ){}
Vertex(T data) : Data(data), Predecessor( nullptr ), Distance( std::numeric_limits<int>::max() - 1 ), Color( vWHITE ) {}
T Data;
LinkedList< Vertex<T>* > Adj;
Vertex<T> *Predecessor;
int Distance;
// For operator overloading,
// - The comparison operators are based on the Distance variable, for use with the ordered
// contianers, Min-Heap, Set, and ( by extension of the compound type, VerticePair ) Mapping
// - The equality operators are based on key access, and they assume that vertices have distinct
// Data values for the set of all vertices
friend bool operator<(Vertex<T> &l, Vertex<T> &r){ return l.Distance < r.Distance; }
friend bool operator>(const Vertex<T> &l, const Vertex<T> &r){ return l.Distance > r.Distance; }
friend bool operator==(const Vertex<T> &l, const Vertex<T> &r){ return l.Data == r.Data; }
friend bool operator!=(const Vertex<T> &l, const Vertex<T> &r){ return !( l == r ); }
private:
int Discovered, Finished;
VertexColor Color;
};
// Overloaded T_Less functor for use with Min-Heap based comparisons for Dijkstra's Algorithm,
// which takes a Min-Priority Queue of Vertices, which is implemented as a Min-Heap
template <typename T>
struct T_Less< Vertex<T>* >{
bool operator() ( const Vertex<T> *l, const Vertex<T> *r) const {
return l->Distance < r->Distance;
}
};
// Represents an Edge in a weighted, directed graph.
// - Where u := the starting vertex, v := the destination vertex
// - For all vertices u and v in a graph, it is assumed that can be at most
// 1 edge for each distinct u and v pair
// - Equality is defined by having same starting and destination vertices
// - Ordering is defined by Edge Weight
// ( Note: Currently, all values must explicitly be assigned. And only expected
// to be constructed and assigned in the AddEdge method. )
template <typename T>
struct Edge{
Edge(Vertex<T> *u = nullptr, Vertex<T> *v = nullptr, int weight = 0) : U(u), V(v), Weight(weight) {}
friend bool operator==(const Edge<T> &l, Edge<T> &r){
if (l.U == r.U && l.V == r.V )
return true;
else
return false;
}
friend bool operator<(Edge<T> &l, Edge<T> &r){
if(l.Weight < r.Weight)
return true;
else
return false;
}
Vertex<T> *U, *V;
int Weight;
};
// Used as a key for a pair of Vertices to query for a Graph's Edge, if one exists.
// - U := A starting vertex, V := A destination vertex
// - Equality is deined by having the same u and v
// - Comparisons are currently arbitrarily ordered by first the U value, then V value
// - Example comparisons given T = int and (U,V):
// -- (1,9) < (2,2) == true , ( 2,2 ) < (9,1) == true
template <typename T>
struct VerticePair{
VerticePair(Vertex<T> *u = nullptr, Vertex<T> *v = nullptr) : U(u), V(v) {}
void AssignU(Vertex<T> *u){
U = u;
}
void AssignV(Vertex<T> *v){
V = v;
}
friend bool operator==(const VerticePair<T> &l, const VerticePair<T> &r){
return l.U == r.U && l.V == r.V;
}
friend bool operator<(const VerticePair<T> &l, const VerticePair<T> &r){
if( l.U->Data < r.U->Data )
return true;
else if ( l.U->Data == r.U->Data && l.V->Data < r.V->Data )
return true;
else
return false;
}
private:
Vertex<T> *U, *V;
};
// Represents a directed, weighted graph
// Implements the following algorithms:
// - BellmanFord
// - Directed-Acyclic-Graph Shortest Paths
// - Dijkstra's Algorithm
template <typename T, typename W = int>
class Graph{
public:
Graph(): vNIL(new Vertex<T>()), eNIL(new Edge<T>()){}
bool AddVertex(T u);
bool AddEdge(T u, T v, int weight);
void PrintVerticesInfo();
void PrintEdgesInfo();
void InitializeSingleSource(Vertex<T> *s);
void Relax( Edge<T> *e);
bool BellmanFord( T s );
void DAG_Shortest_Paths(T s);
void Dijkstra(T s);
private:
// Used internally for the internally invoked Depth-First Search
int Time;
// Represent NIL values for Vertices/Edges
Vertex<T> *vNIL;
Edge<T> *eNIL;
// Set of all Vertices/Edges
Set< Vertex<T>* > V;
Set< Edge<T>* > E;
// Mappings for Vertices/Edges
Mapping < T, Vertex<T>* > vMap;
Mapping < VerticePair<T>, Edge<T>* > eMap;
// The following two functions are intended for testing/debugging the graph
// Assumption: the type T is overloaded to support ostream<<
// - If not, need to specialize the template for the given type
void PrintVertexInfo( Vertex<T> *v ){
std::cout << "\tV: " << v->Data << " D: " << v->Distance << std::endl;
}
void PrintEdgeInfo( Edge<T> *e ){
std::cout << "\tE: (" << e->U->Data << "," << e->V->Data << ") W: " << e-> Weight << std::endl;
}
// Returns a LinkedList containing the Graph's Vertices' Data in topologically sorted order
LinkedList<T> DepthFirstSearch(){
LinkedList<T> list;
Vertex<T> *b = V.Minimum(), *e = V.Maximum();
while( b < e ){
b->Color = vWHITE;
b->Predecessor = vNIL;
b = V.Successor(b);
}
Time = 0;
b = V.Minimum();
while ( b < e ){
std::cout << b->Data << ", ";
if( b->Color == vWHITE ){
Visit(b, list);
}
b = V.Successor(b);
}
return list;
}
// Recursive subroutine for Depth-First Search
void Visit(Vertex<T> *u, LinkedList<T> &list){
Time++;
u->Discovered = Time;
u->Color = vGRAY;
// TODO: clean this up sometime.
// - Substitue for LinkedList<T>::Node<T>, which is internally defined within LinkedList
auto vNode = u->Adj.Head;
while(vNode){
Vertex<T> *v = vNode->Data;
if(v->Color == vWHITE){
v->Predecessor = u;
Visit(v, list);
}
vNode = vNode->Next;
}
u->Color = vBLACK;
Time++;
u->Finished = Time;
list.AddToHead(u->Data);
}
};
// Creates a Vertex and adds it to the set of vertices, if the vertex does not exist
// Returns whether the vertex was created
template <typename T, typename W = int>
bool Graph<T>::AddVertex( T u ) {
if(vMap.ContainsKey(u)){
return false;
}
else{
Vertex<T>* vertex = new Vertex<T>(u);
vMap[u] = vertex;
V.Insert(vertex);
return true;
}
}
// Creates a weighted given two vertex keys and a weight, given that vertices exist for
// both keys
// U := starting vertex, V:= destination vertex
// Returns whether an edge was created
template <typename T, typename W = int>
bool Graph<T>::AddEdge( T u, T v, int weight) {
if(vMap.ContainsKey(u) && vMap.ContainsKey(v)){
Vertex<T> *U = vMap[u];
Vertex<T> *V = vMap[v];
Edge<T> *e = new Edge<T>(U, V, weight);
U->Adj.AddToTail(V);
VerticePair<T> vp;
vp.AssignU(U);
vp.AssignV(V);
eMap[vp] = e;
E.Insert(e);
return true;
}
else{
return false;
}
}
// Initializes the distance for a given starting vertex
// Note: Untraversed vertices by default are assigned the max values
// in the parametized vertex constructor
template <typename T, typename W>
void Graph<T>::InitializeSingleSource( Vertex<T> *s){
s->Distance = 0;
}
// Checks and updates the distance of a vertex, if applicable
template <typename T, typename W>
void Graph<T>::Relax( Edge<T> *e ){
Vertex<T> *u = e->U, *v = e->V;
if(v->Distance > u->Distance + e->Weight ){
v->Distance = u->Distance + e->Weight;
v->Predecessor = u;
}
}
// Implementation of the Bellman-Ford algorithm
template <typename T, typename W>
bool Graph<T>::BellmanFord( T s){
Vertex<T> *vS = vMap[s];
InitializeSingleSource(vS);
Edge<T> *b = E.Minimum(), *e = E.Maximum();
for(int i = 0; i < V.Count(); i++){
b = E.Minimum(), e = E.Maximum();
while( b < e){
Relax(b);
b = E.Successor(b);
if(b == e){
Relax(b);
}
}
}
b = E.Minimum(), e = E.Maximum();
while( b < e){
if(b->V->Distance > b->U->Distance + b->Weight)
return false;
b = E.Successor(b);
if(b == e){
if( b->V->Distance > b->U->Distance + b->Weight)
return false;
}
}
return true;
}
// Implementation of the Directed-Acyclic-Graph algorithm
template <typename T>
void Graph<T>::DAG_Shortest_Paths( T s ){
InitializeSingleSource( vMap[s] );
// ts := topologically sorted list of vertex data
LinkedList<T> ts = DepthFirstSearch();
// u/vNode := LinkedList<T>::Node<T> ( Internally defined and declared within LinkedList<T> )
auto uNode = ts.Head;
VerticePair<T> vp;
while(uNode){
Vertex<T> *u = vMap[uNode->Data];
vp.AssignU(u);
auto vNode = u->Adj.Head;
while(vNode){
Vertex<T> *v = vNode->Data;
vp.AssignV(v);
if(eMap.ContainsKey(vp)){
Relax(eMap[vp]);
}
vNode = vNode->Next;
}
uNode = uNode->Next;
}
}
// Implementation of Dijkatra's algorithm
template <typename T>
void Graph<T>::Dijkstra( T s ){
InitializeSingleSource(vMap[s]);
Set< Vertex<T>* > S;
// Q := Min-Heap priority queue of Vertices
Heap< Vertex<T>* > Q(this->V);
VerticePair<T> vp;
while( !Q.Empty() ){
Vertex<T> *u = Q.Extract();
S.Insert(u);
vp.AssignU(u);
// vNode := LinkedList<T>::Node<T> ( Internally defined and declared within LinkedList<T> )
auto vNode = u->Adj.Head;
while(vNode){
Vertex<T> *v = vNode->Data;
vp.AssignV(v);
Relax(eMap[vp]);
vNode = vNode->Next;
}
// Updates the Min-Heap based any Relaxation updates
Q.Build();
}
}
template <typename T>
void Graph<T>::PrintVerticesInfo(){
std::cout << "Vertices:" << std::endl;
Vertex<T> *b = V.Minimum(), *e = V.Maximum();
while( b < e ){
PrintVertexInfo(b);
b = V.Successor(b);
if(b == e){
PrintVertexInfo(b);
}
}
}
template <typename T>
void Graph<T>::PrintEdgesInfo(){
std::cout << "Edges:" << std::endl;
Edge<T> *b = E.Minimum(), *e = E.Maximum();
while ( b < e ){
PrintEdgeInfo(b);
b = E.Successor(b);
if( b == e){
PrintEdgeInfo(b);
}
}
}
|
a6eabc2d2f7cd2b7d37fe19e9152956b6da212d7
|
6c996ca5146bd307a062f38819acec16d710656f
|
/workspace/iw8/code_source/src/gfx_d3d/r_add_dobj_xmodel.cpp
|
ed46592c0f0f53f506dcaf2eda62e3a5200395d6
|
[] |
no_license
|
Omn1z/OpenIW8
|
d46f095d4d743d1d8657f7e396e6d3cf944aa562
|
6c01a9548e4d5f7e1185369a62846f2c6f8304ba
|
refs/heads/main
| 2023-08-15T22:43:01.627895
| 2021-10-10T20:44:57
| 2021-10-10T20:44:57
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 77,112
|
cpp
|
r_add_dobj_xmodel.cpp
|
/*
==============
R_AddDObjSurfacesCamera
==============
*/
int __fastcall R_AddDObjSurfacesCamera(const GfxViewInfo *viewInfo, const GfxSceneEntity *sceneEnt, const unsigned int sceneEntIndex, const GfxModelLightingProbeInfo *lightingInfo, GfxDrawSurf **drawSurfs, GfxDrawSurf **lastDrawSurfs)
{
return ?R_AddDObjSurfacesCamera@@YAHPEIBUGfxViewInfo@@PEIBUGfxSceneEntity@@IPEBUGfxModelLightingProbeInfo@@QEAPEIATGfxDrawSurf@@3@Z(viewInfo, sceneEnt, sceneEntIndex, lightingInfo, drawSurfs, lastDrawSurfs);
}
/*
==============
R_AddXModelSurfacesCamera
==============
*/
int __fastcall R_AddXModelSurfacesCamera(const GfxViewInfo *viewInfo, const XModelDrawInfo *modelInfo, const XModel *model, const DObj *obj, const vec3_t *origin, const GfxModelLightingProbeInfo *lightingInfo, int depthHack, GfxDrawSurf **drawSurfs, GfxDrawSurf **lastDrawSurfs, const unsigned __int16 mapEntLookup, XModelThermalMode thermalMode, unsigned int renderFlags, unsigned __int16 baseGfxEntityDataID, const GfxModelDecalVolumeGridInfo *decalVolumeGridInfo)
{
return ?R_AddXModelSurfacesCamera@@YAHPEIBUGfxViewInfo@@PEIBUXModelDrawInfo@@PEIBUXModel@@PEIBUDObj@@AEBTvec3_t@@PEBUGfxModelLightingProbeInfo@@HQEAPEIATGfxDrawSurf@@6GW4XModelThermalMode@@IGPEBUGfxModelDecalVolumeGridInfo@@@Z(viewInfo, modelInfo, model, obj, origin, lightingInfo, depthHack, drawSurfs, lastDrawSurfs, mapEntLookup, thermalMode, renderFlags, baseGfxEntityDataID, decalVolumeGridInfo);
}
/*
==============
R_AddXModelSurfaces
==============
*/
GfxDrawSurf *__fastcall R_AddXModelSurfaces(const XModelDrawInfo *modelInfo, const XModel *model, MaterialTechniqueType techType, GfxDrawSurf *drawSurf, GfxDrawSurf *lastDrawSurf, const vec3_t *origin, GfxSceneViewType sceneViewType)
{
return ?R_AddXModelSurfaces@@YAPEATGfxDrawSurf@@PEIBUXModelDrawInfo@@PEIBUXModel@@W4MaterialTechniqueType@@PEIAT1@3AEBTvec3_t@@W4GfxSceneViewType@@@Z(modelInfo, model, techType, drawSurf, lastDrawSurf, origin, sceneViewType);
}
/*
==============
R_AddDObjSurfaces
==============
*/
GfxDrawSurf *__fastcall R_AddDObjSurfaces(const GfxSceneEntity *sceneEnt, MaterialTechniqueType techType, GfxDrawSurf *drawSurf, GfxDrawSurf *lastDrawSurf, GfxSceneViewType sceneViewType)
{
return ?R_AddDObjSurfaces@@YAPEATGfxDrawSurf@@PEIBUGfxSceneEntity@@W4MaterialTechniqueType@@PEIAT1@2W4GfxSceneViewType@@@Z(sceneEnt, techType, drawSurf, lastDrawSurf, sceneViewType);
}
/*
==============
R_AddDObjSurfaces
==============
*/
GfxDrawSurf *R_AddDObjSurfaces(const GfxSceneEntity *sceneEnt, MaterialTechniqueType techType, GfxDrawSurf *drawSurf, GfxDrawSurf *lastDrawSurf, GfxSceneViewType sceneViewType)
{
GfxDrawSurf *v5;
MaterialTechniqueType v6;
GfxModelRigidSurface *firstSurf;
const dvar_t *v9;
const GfxSceneEntity *v10;
const DObj *obj;
GfxSceneViewType v12;
unsigned __int32 v13;
unsigned int v14;
__int64 v15;
unsigned int v16;
unsigned int v17;
const XModel *Model;
const XModelLodInfo *LodInfo;
unsigned __int16 surfIndex;
unsigned __int16 numsurfs;
unsigned __int16 v22;
unsigned __int16 v23;
int v24;
Material **Skins;
const GfxModelRigidSurface *v26;
__int64 ModelRigidSurfaceSize;
const XSurface *xsurf;
surfaceType_t v29;
__int64 v30;
int v31;
Material *v32;
__int64 p1_low;
XAssetHeader v34;
int p1;
__int64 v36;
Material *v37;
const MaterialTechniqueSet *techniqueSet;
unsigned __int64 v39;
unsigned __int64 v40;
unsigned __int64 v43;
unsigned __int64 v44;
unsigned int v45;
GfxDrawSurf *v46;
__int64 surfType;
Material **materialHandle;
__int64 v50;
__int64 v51;
bool enabled;
Material **v54;
int NumModels;
unsigned int v56;
unsigned int v57;
GfxModelRigidSurface *modelSurf;
unsigned int v60;
bitarray_base<bitarray<256> > *v61;
GfxDrawSurf *v62;
unsigned int v63;
int v64;
unsigned int v65;
__int64 v66;
GfxDrawSurfFields v67;
vec3_t outOrigin;
GfxDrawSurf *v69;
__int64 v70;
XSurface *surfs;
__int64 v72;
Bounds surfBounds;
Bounds accumulatedSurfBounds;
v72 = -2i64;
v69 = lastDrawSurf;
v5 = drawSurf;
v62 = drawSurf;
v6 = techType;
Profile_Begin(97);
firstSurf = (GfxModelRigidSurface *)sceneEnt->cull.skinnedSurfs.firstSurf;
modelSurf = firstSurf;
v9 = DVARBOOL_dobj_hide_models_with_root_meld_failure;
if ( !DVARBOOL_dobj_hide_models_with_root_meld_failure && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\universal\\dvar.h", 692, ASSERT_TYPE_ASSERT, "(dvar)", "%s\n\tDvar %s accessed after deregistration", "dvar", "dobj_hide_models_with_root_meld_failure") )
__debugbreak();
Dvar_CheckFrontendServerThread(v9);
enabled = v9->current.enabled;
if ( firstSurf )
{
v10 = sceneEnt;
obj = sceneEnt->obj;
v61 = (bitarray_base<bitarray<256> > *)obj;
if ( !obj && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 1305, ASSERT_TYPE_ASSERT, "(obj)", (const char *)&queryFormat, "obj") )
__debugbreak();
NumModels = DObjGetNumModels(obj);
v63 = *((_DWORD *)sceneEnt + 347) & 1;
v64 = *((_DWORD *)sceneEnt + 346) & 0x3FF;
v12 = sceneViewType;
v13 = sceneViewType - 1;
*(_OWORD *)accumulatedSurfBounds.midPoint.v = _xmm_ff7fffff000000000000000000000000;
accumulatedSurfBounds.halfSize.v[1] = FLOAT_N3_4028235e38;
accumulatedSurfBounds.halfSize.v[2] = FLOAT_N3_4028235e38;
v14 = 0;
v56 = 0;
if ( NumModels )
{
v15 = 0i64;
v70 = 0i64;
v16 = NumModels;
do
{
v17 = v10->lods[v15];
if ( v17 != 6 )
{
Model = DObjGetModel(obj, v14);
if ( !Model )
{
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 1337, ASSERT_TYPE_ASSERT, "(model)", (const char *)&queryFormat, "model") )
__debugbreak();
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\xanim\\xmodel_utils.h", 296, ASSERT_TYPE_ASSERT, "(model)", (const char *)&queryFormat, "model") )
__debugbreak();
}
LodInfo = XModelGetLodInfo(Model, v17);
if ( !LodInfo && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\xanim\\xmodel_utils.h", 300, ASSERT_TYPE_ASSERT, "(lodInfo)", (const char *)&queryFormat, "lodInfo") )
__debugbreak();
if ( LodInfo->numsurfs )
{
surfIndex = LodInfo->surfIndex;
numsurfs = Model->numsurfs;
v22 = numsurfs;
if ( surfIndex >= numsurfs )
{
LODWORD(materialHandle) = numsurfs;
LODWORD(surfType) = surfIndex;
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\xanim\\xmodel_utils.h", 303, ASSERT_TYPE_ASSERT, "(unsigned)( lodInfo->surfIndex ) < (unsigned)( model->numsurfs )", "lodInfo->surfIndex doesn't index model->numsurfs\n\t%i not in [0, %i)", surfType, materialHandle) )
__debugbreak();
}
if ( LodInfo->numsurfs + (unsigned int)LodInfo->surfIndex > v22 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\xanim\\xmodel_utils.h", 304, ASSERT_TYPE_ASSERT, "(lodInfo->surfIndex + lodInfo->numsurfs <= model->numsurfs)", (const char *)&queryFormat, "lodInfo->surfIndex + lodInfo->numsurfs <= model->numsurfs") )
__debugbreak();
if ( !LodInfo->surfs )
{
LODWORD(v50) = v17;
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\xanim\\xmodel_utils.h", 310, ASSERT_TYPE_ASSERT, "(lodInfo->surfs)", "%s\n\tModel missing surfs : %s,%u. Perhaps you need to check XModelIsLodUsable()?", "lodInfo->surfs", Model->name, v50) )
__debugbreak();
}
if ( !LodInfo->modelSurfsStaging && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\xanim\\xmodel_utils.h", 311, ASSERT_TYPE_ASSERT, "(lodInfo->modelSurfsStaging)", (const char *)&queryFormat, "lodInfo->modelSurfsStaging") )
__debugbreak();
surfs = LodInfo->surfs;
v23 = LodInfo->numsurfs;
v6 = techType;
}
else
{
surfs = NULL;
v23 = 0;
}
v24 = v23;
v65 = v23;
if ( v17 < Model->shadowCutoffLod )
{
if ( !enabled || (v66 = 1i64, !bitarray_base<bitarray<256>>::testBit(v61 + 304, v14)) )
v66 = 0i64;
}
else
{
if ( v6 != TECHNIQUE_BUILD_SHADOWMAP_DEPTH && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 1345, ASSERT_TYPE_ASSERT, "(techType == TECHNIQUE_BUILD_SHADOWMAP_DEPTH)", (const char *)&queryFormat, "techType == TECHNIQUE_BUILD_SHADOWMAP_DEPTH") )
__debugbreak();
v66 = 1i64;
}
if ( v24 )
{
Skins = (Material **)XModelGetSkins(Model, v17);
v54 = Skins;
if ( !Skins && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 1366, ASSERT_TYPE_ASSERT, "(material)", (const char *)&queryFormat, "material") )
__debugbreak();
}
else
{
Skins = NULL;
v54 = NULL;
}
v60 = 0;
if ( v24 )
{
v26 = modelSurf;
while ( 1 )
{
v57 = 15;
if ( v26->base.skinnedCachedOffset <= -4 )
break;
if ( v26->base.skinnedCachedOffset != -3 )
{
xsurf = v26->xsurf;
if ( v26->base.subdivLodLevel && R_SurfaceHasSubdivision(v26->xsurf) )
{
v29 = SF_XMODEL_SKINNED_SUBDIV;
v57 = 11;
v30 = 11i64;
ModelRigidSurfaceSize = 136i64;
}
else
{
v29 = SF_XMODEL_SKINNED;
v30 = 15i64;
ModelRigidSurfaceSize = 136i64;
}
goto LABEL_66;
}
ModelRigidSurfaceSize = 4i64;
LABEL_111:
++v60;
v54 = ++Skins;
v26 = (const GfxModelRigidSurface *)((char *)v26 + ModelRigidSurfaceSize);
modelSurf = (GfxModelRigidSurface *)v26;
if ( v60 >= v65 )
{
v14 = v56;
goto LABEL_113;
}
}
xsurf = v26->xsurf;
if ( v26->base.subdivLodLevel && R_SurfaceHasSubdivision(v26->xsurf) )
{
v29 = SF_XMODEL_RIGID_SUBDIV;
v57 = 10;
ModelRigidSurfaceSize = R_GetModelRigidSurfaceSize(v26);
v30 = 10i64;
}
else
{
v29 = SF_BEGIN_XMODEL;
if ( v26->base.skinnedCachedOffset > -4 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_model.h", 226, ASSERT_TYPE_ASSERT, "(R_IsRigidSurfaceType( modelSurf->base.skinnedCachedOffset ))", (const char *)&queryFormat, "R_IsRigidSurfaceType( modelSurf->base.skinnedCachedOffset )") )
__debugbreak();
v31 = -3 - v26->base.skinnedCachedOffset;
if ( v31 > 128 )
{
LODWORD(v51) = 128;
LODWORD(v50) = -3 - v26->base.skinnedCachedOffset;
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_model.h", 209, ASSERT_TYPE_ASSERT, "( childCount ) <= ( ( XMODEL_MAX_RIGID_GROUPS ) )", "%s <= %s\n\t%i, %i", "childCount", "MAX_RIGID_CHILD_SURFACES", v50, v51) )
__debugbreak();
}
ModelRigidSurfaceSize = 32i64 * (unsigned int)v31 + 76;
v30 = 15i64;
}
LABEL_66:
v32 = *Skins;
if ( !*Skins && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 1425, ASSERT_TYPE_ASSERT, "(*material)", (const char *)&queryFormat, "*material") )
__debugbreak();
p1_low = LOWORD(v32->drawSurf.packed.p1);
if ( (unsigned int)p1_low >= rgp.materialCount )
{
LODWORD(materialHandle) = rgp.materialCount;
LODWORD(surfType) = LOWORD(v32->drawSurf.packed.p1);
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_local.h", 2247, ASSERT_TYPE_ASSERT, "(unsigned)( mtlSortIndex ) < (unsigned)( rgp.materialCount )", "mtlSortIndex doesn't index rgp.materialCount\n\t%i not in [0, %i)", surfType, materialHandle) )
{
__debugbreak();
v32 = *v54;
}
}
if ( DB_GetMaterialAtIndex(rgp.sortedMaterials[p1_low]) != v32 )
{
v34.physicsLibrary = DB_GetXAssetMasterDefaultHeader(ASSET_TYPE_MATERIAL).physicsLibrary;
p1 = v32->drawSurf.packed.p1;
if ( (unsigned __int16)p1 == (unsigned __int16)v34.physicsLibrary[2].name )
{
R_WarnOncePerFrame(R_WARN_UNSORTED_MATERIAL_INDEX, v32->name);
LABEL_110:
Skins = v54;
goto LABEL_111;
}
v36 = (unsigned __int16)p1;
v37 = v32;
if ( (unsigned __int16)p1 >= rgp.materialCount )
{
LODWORD(materialHandle) = rgp.materialCount;
LODWORD(surfType) = (unsigned __int16)p1;
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_local.h", 2247, ASSERT_TYPE_ASSERT, "(unsigned)( mtlSortIndex ) < (unsigned)( rgp.materialCount )", "mtlSortIndex doesn't index rgp.materialCount\n\t%i not in [0, %i)", surfType, materialHandle) )
{
__debugbreak();
v37 = *v54;
}
}
v32 = v37;
if ( DB_GetMaterialAtIndex(rgp.sortedMaterials[v36]) != v37 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 1438, ASSERT_TYPE_ASSERT, "(R_GetSortedMaterial( ( uint )( *material )->drawSurf.fields.materialSortedIndex ) == *material)", (const char *)&queryFormat, "R_GetSortedMaterial( ( uint )( *material )->drawSurf.fields.materialSortedIndex ) == *material") )
{
__debugbreak();
v32 = *v54;
}
v26 = modelSurf;
}
if ( !v32 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_material_inline.h", 464, ASSERT_TYPE_ASSERT, "(material)", (const char *)&queryFormat, "material") )
__debugbreak();
if ( !v32->techniqueSet && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_material_inline.h", 465, ASSERT_TYPE_ASSERT, "( ( material->techniqueSet ) )", "( material->name ) = %s", v32->name) )
__debugbreak();
techniqueSet = v32->techniqueSet;
if ( !techniqueSet && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_material_inline.h", 515, ASSERT_TYPE_ASSERT, "(techSet)", (const char *)&queryFormat, "techSet") )
__debugbreak();
v6 = techType;
if ( Material_TechSetHasTechnique(techniqueSet, techType) )
{
if ( v62 >= v69 )
{
R_WarnOncePerFrame(R_WARN_MAX_SCENE_DRAWSURFS, "R_AddDObjSurfaces");
v10 = sceneEnt;
v14 = v56;
goto LABEL_115;
}
if ( !v66 )
{
v39 = truncate_cast<unsigned __int64,__int64>((char *)v26 - (char *)frontEndDataOut - 1789440);
if ( (v39 & 3) != 0 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 1460, ASSERT_TYPE_ASSERT, "(!( surfId & 3 ))", (const char *)&queryFormat, "!( surfId & 3 )") )
__debugbreak();
v40 = v39 >> 2;
if ( (unsigned int)v40 >= 0x1000000 )
{
LODWORD(materialHandle) = 0x1000000;
LODWORD(surfType) = v40;
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 1462, ASSERT_TYPE_ASSERT, "(unsigned)( surfId ) < (unsigned)( 1 << 24 )", "surfId doesn't index 1 << MTL_SORT_OBJECT_ID_BITS\n\t%i not in [0, %i)", surfType, materialHandle) )
__debugbreak();
}
_XMM0.fields = (GfxDrawSurfFields)(*v54)->drawSurf;
__asm { vpextrq rcx, xmm0, 1 }
v43 = _RCX & 0xFFFFFFFE007FFFFFui64 | ((unsigned __int64)(unsigned int)v29 << 23) | (_RCX - ((unsigned __int64)v63 << 27)) & 0x1F8000000i64 | 0x200000;
*((_QWORD *)&v67 + 1) = v43;
v44 = (*v54)->drawSurf.packed.p0 & 0xF000000003FFFFFFui64 | ((v40 & 0xFFFFFF) << 26) | -(__int64)(v64 != 0) & 0x4000000000000i64;
*(_QWORD *)&v67 = v44;
if ( R_UGB_UpdateXSurfDataFromXSurf(xsurf) )
{
if ( techType == TECHNIQUE_BUILD_SHADOWMAP_DEPTH )
{
v45 = truncate_cast<unsigned int,unsigned __int64>(v40);
v10 = sceneEnt;
*(_QWORD *)&v67 = v44 & 0xFFFFFFFFFC0003FFui64 | ((unsigned __int64)R_AllocGPUBatchIndexXModel(1u, sceneViewType, sceneEnt, modelSurf, v45, v29, v54) << 10);
}
else
{
v10 = sceneEnt;
}
v62->fields = v67;
v46 = ++v62;
if ( v57 < 0xF )
{
if ( v46 >= v69 )
{
R_WarnOncePerFrame(R_WARN_MAX_SCENE_DRAWSURFS, "R_AddDObjSurfaces");
v14 = v56;
goto LABEL_114;
}
*((_QWORD *)&v67 + 1) = v43 & 0xFFFFFFFFF87FFFFFui64 | (v30 << 23);
v46->fields = v67;
v62 = v46 + 1;
}
if ( (unsigned int)(sceneViewType - 1) <= 2 )
{
GfxSceneEntity_GetPlacementOrigin(v10, &outOrigin);
surfBounds.halfSize = xsurf->surfBounds.halfSize;
surfBounds.midPoint.v[0] = outOrigin.v[0] + xsurf->surfBounds.midPoint.v[0];
surfBounds.midPoint.v[1] = outOrigin.v[1] + xsurf->surfBounds.midPoint.v[1];
surfBounds.midPoint.v[2] = outOrigin.v[2] + xsurf->surfBounds.midPoint.v[2];
R_AccumulateSurfBounds(&surfBounds, &accumulatedSurfBounds);
memset(&outOrigin, 0, sizeof(outOrigin));
}
}
v26 = modelSurf;
}
}
goto LABEL_110;
}
LABEL_113:
v10 = sceneEnt;
LABEL_114:
v6 = techType;
LABEL_115:
v16 = NumModels;
obj = (const DObj *)v61;
}
v56 = ++v14;
v15 = ++v70;
}
while ( v14 < v16 );
v5 = v62;
v13 = sceneViewType - 1;
v12 = sceneViewType;
}
if ( v13 <= 2 )
R_UpdateViewSurfaceBounds(&accumulatedSurfBounds, v12);
}
Profile_EndInternal(NULL);
return v5;
}
/*
==============
R_AddDObjSurfacesCamera
==============
*/
__int64 R_AddDObjSurfacesCamera(const GfxViewInfo *viewInfo, const GfxSceneEntity *sceneEnt, const unsigned int sceneEntIndex, const GfxModelLightingProbeInfo *lightingInfo, GfxDrawSurf **drawSurfs, GfxDrawSurf **lastDrawSurfs)
{
const GfxSceneEntity *v6;
const dvar_t *v7;
unsigned int v8;
_BYTE *firstSurf;
__int64 v10;
unsigned int v11;
const DObj *v12;
GfxSceneViewType v13;
unsigned int v14;
float v15;
unsigned int v16;
bool v17;
bool v18;
const XModel *Model;
const XModelLodInfo *LodInfo;
unsigned __int16 surfIndex;
unsigned __int16 numsurfs;
unsigned __int16 v23;
unsigned __int16 v24;
int v25;
Material **Skins;
__int64 v27;
Material **v28;
XModelMaterialOverride *modelMaterialOverrides;
int v30;
unsigned int materialOverrideCount;
__int64 v32;
__int64 v33;
Material *v34;
int v35;
__int64 v36;
unsigned int v37;
__int64 v38;
XSurface *ModelSurfaceXSurface;
surfaceType_t v40;
__int64 v41;
XSurface *v42;
int v43;
Material *v44;
__int64 p1_low;
XAssetHeader v46;
int p1;
__int64 v48;
Material *v49;
unsigned int cameraRegion;
bool v51;
const GfxModelLightingProbeInfo *v52;
unsigned __int64 v53;
unsigned __int64 v54;
const Material *v55;
unsigned __int64 v57;
__int64 v59;
unsigned __int64 v60;
unsigned int v61;
GfxModelDecalVolumeGridInfo *v62;
__int64 v63;
GfxDrawSurf *v64;
__int128 v65;
__int128 *v66;
const Material *v67;
unsigned __int8 ModelRootBoneIndex;
int integer;
const char *v70;
unsigned int v71;
const char *v72;
const vec4_t *v73;
__int64 v74;
const char *v75;
const dvar_t *v76;
__int64 surfType;
Material **materialHandle;
__int64 v80;
__int64 v81;
char v82;
signed int v83;
bool enabled;
GfxModelDecalVolumeGridInfo *modelSurf;
unsigned int lod;
DObj *obj;
int v89;
unsigned int v90;
unsigned int v91;
int v92;
unsigned int v93;
GfxViewMaterialRenderFeatures renderFeatures;
unsigned int v95;
GfxModelDecalVolumeGridInfo decalVolumeGridInfo;
unsigned int v97;
unsigned int v98;
GfxSceneViewType sceneViewType;
unsigned int v100;
Material **v101;
__int64 v102;
vec3_t origin;
int v104;
unsigned int dobjIndex;
XSurface *xsurf;
const XModel *v107;
unsigned int NumModels;
vec3_t outOrigin;
__int128 v110;
vec3_t v111;
vec3_t v112;
Material **v113;
GfxViewInfo *viewInfoa;
XSurface *surfs;
const GfxModelLightingProbeInfo *v116;
GfxDrawSurf **v117;
__int64 i;
__int64 v119;
Bounds surfBounds;
GfxPlacement placement;
Bounds accumulatedSurfBounds;
DObjAnimMat outMat;
int v124[96];
Material *outPhysicalMaterial[97];
v119 = -2i64;
v116 = lightingInfo;
dobjIndex = sceneEntIndex;
v6 = sceneEnt;
viewInfoa = (GfxViewInfo *)viewInfo;
v117 = drawSurfs;
Profile_Begin(97);
v7 = DVARBOOL_dobj_hide_models_with_root_meld_failure;
if ( !DVARBOOL_dobj_hide_models_with_root_meld_failure && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\universal\\dvar.h", 692, ASSERT_TYPE_ASSERT, "(dvar)", "%s\n\tDvar %s accessed after deregistration", "dvar", "dobj_hide_models_with_root_meld_failure") )
__debugbreak();
Dvar_CheckFrontendServerThread(v7);
enabled = v7->current.enabled;
v8 = 0;
v100 = 0;
firstSurf = v6->cull.skinnedSurfs.firstSurf;
modelSurf = (GfxModelDecalVolumeGridInfo *)firstSurf;
if ( firstSurf )
{
v10 = 0i64;
v92 = 0;
v11 = 0;
v93 = 0;
v95 = 0;
v12 = v6->obj;
obj = (DObj *)v12;
if ( !v12 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 887, ASSERT_TYPE_ASSERT, "(obj)", (const char *)&queryFormat, "obj") )
__debugbreak();
NumModels = DObjGetNumModels(v12);
v97 = *((_DWORD *)v6 + 347) & 1;
v104 = *((_DWORD *)v6 + 346) & 0x3FF;
*(_OWORD *)accumulatedSurfBounds.midPoint.v = _xmm_ff7fffff000000000000000000000000;
accumulatedSurfBounds.halfSize.v[1] = FLOAT_N3_4028235e38;
accumulatedSurfBounds.halfSize.v[2] = FLOAT_N3_4028235e38;
renderFeatures = GFX_VIEW_MTL_FEAT_NONE;
v13 = 32 * v97;
sceneViewType = 32 * v97;
v14 = 0;
v83 = 0;
if ( NumModels )
{
v102 = 0i64;
while ( 1 )
{
if ( !enabled )
goto LABEL_15;
if ( v14 >= 0x100 )
{
LODWORD(materialHandle) = 256;
LODWORD(surfType) = v14;
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\qcommon\\bitarray.h", 257, ASSERT_TYPE_ASSERT, "( pos ) < ( impl()->getBitCount() )", "pos < impl()->getBitCount()\n\t%i, %i", surfType, materialHandle) )
__debugbreak();
}
v82 = 1;
if ( ((0x80000000 >> (v14 & 0x1F)) & v12->modelHasBadRootBoneMeld.array[(unsigned __int64)v14 >> 5]) == 0 )
LABEL_15:
v82 = 0;
lod = v6->lods[v10];
if ( lod == 6 )
goto LABEL_188;
v15 = v6->materialLods[v10];
v16 = (int)v15;
v17 = v15 >= 0.0 && v15 <= 16777216.0;
v18 = v15 >= 0.0 && v15 <= 4294967300.0;
if ( (!v17 || !v18) && CoreAssert_Handler("c:\\workspace\\iw8\\shared\\codware\\core\\core_assert.h", 437, ASSERT_TYPE_ASSERT, (const char *)&queryFormat.fmt + 3, "%s (IntegralType) 0x%jx == (FloatType) %f", "unsigned int __cdecl float_to_integral_cast<unsigned int,float>(float)", v16, v15) )
__debugbreak();
if ( v16 > 1 )
{
LODWORD(v81) = 1;
LODWORD(v80) = (int)v15;
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\xanim\\xmodel_utils.h", 201, ASSERT_TYPE_ASSERT, "( retVal ) <= ( MAX_MATERIAL_LOD )", "%s <= %s\n\t%u, %u", "retVal", "MAX_MATERIAL_LOD", v80, v81) )
__debugbreak();
}
Model = DObjGetModel(v12, v14);
v107 = Model;
if ( !Model )
{
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 919, ASSERT_TYPE_ASSERT, "(model)", (const char *)&queryFormat, "model") )
__debugbreak();
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\xanim\\xmodel_utils.h", 296, ASSERT_TYPE_ASSERT, "(model)", (const char *)&queryFormat, "model") )
__debugbreak();
}
LodInfo = XModelGetLodInfo(Model, lod);
if ( !LodInfo && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\xanim\\xmodel_utils.h", 300, ASSERT_TYPE_ASSERT, "(lodInfo)", (const char *)&queryFormat, "lodInfo") )
__debugbreak();
if ( LodInfo->numsurfs )
{
surfIndex = LodInfo->surfIndex;
numsurfs = Model->numsurfs;
v23 = numsurfs;
if ( surfIndex >= numsurfs )
{
LODWORD(materialHandle) = numsurfs;
LODWORD(surfType) = surfIndex;
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\xanim\\xmodel_utils.h", 303, ASSERT_TYPE_ASSERT, "(unsigned)( lodInfo->surfIndex ) < (unsigned)( model->numsurfs )", "lodInfo->surfIndex doesn't index model->numsurfs\n\t%i not in [0, %i)", surfType, materialHandle) )
__debugbreak();
}
if ( LodInfo->numsurfs + (unsigned int)LodInfo->surfIndex > v23 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\xanim\\xmodel_utils.h", 304, ASSERT_TYPE_ASSERT, "(lodInfo->surfIndex + lodInfo->numsurfs <= model->numsurfs)", (const char *)&queryFormat, "lodInfo->surfIndex + lodInfo->numsurfs <= model->numsurfs") )
__debugbreak();
if ( !LodInfo->surfs )
{
LODWORD(v80) = lod;
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\xanim\\xmodel_utils.h", 310, ASSERT_TYPE_ASSERT, "(lodInfo->surfs)", "%s\n\tModel missing surfs : %s,%u. Perhaps you need to check XModelIsLodUsable()?", "lodInfo->surfs", Model->name, v80) )
__debugbreak();
}
if ( !LodInfo->modelSurfsStaging && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\xanim\\xmodel_utils.h", 311, ASSERT_TYPE_ASSERT, "(lodInfo->modelSurfsStaging)", (const char *)&queryFormat, "lodInfo->modelSurfsStaging") )
__debugbreak();
surfs = LodInfo->surfs;
v24 = LodInfo->numsurfs;
v6 = sceneEnt;
}
else
{
surfs = NULL;
v24 = 0;
}
v91 = v24;
if ( !v24 )
goto LABEL_187;
decalVolumeGridInfo.allocatedVolumeInfoSlot = 0xFFFF;
v25 = v83;
R_DecalVolumesGrid_PrepareVolumeInfo_SceneEnt(viewInfoa, dobjIndex, v6, v83, &decalVolumeGridInfo);
Skins = (Material **)XModelGetSkins(Model, lod);
v101 = Skins;
if ( !Skins && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 934, ASSERT_TYPE_ASSERT, "(material)", (const char *)&queryFormat, "material") )
__debugbreak();
v98 = 0;
if ( !v91 )
goto LABEL_170;
v27 = 16i64 * v83;
for ( i = v27; ; v27 = i )
{
v28 = Skins;
v113 = Skins;
v89 = 96;
if ( v12 )
{
modelMaterialOverrides = v12->modelMaterialOverrides;
if ( modelMaterialOverrides )
{
v30 = 0;
materialOverrideCount = modelMaterialOverrides[v102].materialOverrideCount;
if ( materialOverrideCount )
{
v32 = *(__int64 *)((char *)&modelMaterialOverrides->materialOverride + v27);
while ( 1 )
{
v33 = *(_QWORD *)(v32 + 8i64 * (unsigned int)v30);
if ( v33 )
{
v34 = *(Material **)v33;
if ( *(Material **)v33 == *Skins )
{
v35 = *(_DWORD *)(v33 + 24);
if ( v35 != 3 )
break;
}
}
if ( ++v30 >= materialOverrideCount )
goto LABEL_78;
}
if ( v35 != 2 || (v36 = *(_QWORD *)(v33 + 8), v34->materialType == *(_DWORD *)(v36 + 20)) )
{
v37 = R_CopyMaterialOverrideToPhysicalMaterialData((MaterialOverride *)v33, &outPhysicalMaterial[v30], &renderFeatures);
if ( v37 >= 0x800 )
{
v30 = 96;
R_WarnOncePerFrame(R_WARN_MATERIAL_OVERRIDE_OUT_OF_PHYSICAL_MATERIALS);
}
else
{
v124[v30] = rgp.physicalMaterialSortedIndex[v37];
}
v89 = v30;
if ( v30 < 96 )
{
v28 = &outPhysicalMaterial[v30];
v113 = v28;
}
}
else
{
R_WarnOncePerFrame(R_WARN_MATERIAL_OVERRIDE_MISMATCHED_MATERIAL, v34->name, *(_QWORD *)v36);
v89 = 96;
}
}
}
}
LABEL_78:
if ( !Skins && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 951, ASSERT_TYPE_ASSERT, "(actualMaterial)", (const char *)&queryFormat, "actualMaterial") )
__debugbreak();
v90 = 15;
if ( *(int *)firstSurf <= -4 )
{
v42 = (XSurface *)*((_QWORD *)firstSurf + 7);
xsurf = v42;
if ( firstSurf[54] && R_SurfaceHasSubdivision(v42) )
{
v40 = SF_XMODEL_RIGID_SUBDIV;
v90 = 10;
v41 = 10i64;
}
else
{
v40 = SF_BEGIN_XMODEL;
v41 = 15i64;
}
if ( *(int *)firstSurf > -4 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_model.h", 226, ASSERT_TYPE_ASSERT, "(R_IsRigidSurfaceType( modelSurf->base.skinnedCachedOffset ))", (const char *)&queryFormat, "R_IsRigidSurfaceType( modelSurf->base.skinnedCachedOffset )") )
__debugbreak();
v43 = -3 - *(_DWORD *)firstSurf;
if ( v43 > 128 )
{
LODWORD(v81) = 128;
LODWORD(v80) = -3 - *(_DWORD *)firstSurf;
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_model.h", 209, ASSERT_TYPE_ASSERT, "( childCount ) <= ( ( XMODEL_MAX_RIGID_GROUPS ) )", "%s <= %s\n\t%i, %i", "childCount", "MAX_RIGID_CHILD_SURFACES", v80, v81) )
__debugbreak();
}
v38 = 32i64 * (unsigned int)v43 + 76;
}
else
{
if ( *(_DWORD *)firstSurf == -3 )
{
v38 = 4i64;
goto LABEL_165;
}
ModelSurfaceXSurface = (XSurface *)R_GetModelSurfaceXSurface(firstSurf, SF_XMODEL_SKINNED);
xsurf = ModelSurfaceXSurface;
if ( firstSurf[54] && R_SurfaceHasSubdivision(ModelSurfaceXSurface) )
{
v40 = SF_XMODEL_SKINNED_SUBDIV;
v90 = 11;
v41 = 11i64;
v38 = 136i64;
}
else
{
v40 = SF_XMODEL_SKINNED;
v41 = 15i64;
v38 = 136i64;
}
}
v44 = *Skins;
if ( !*Skins && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 1002, ASSERT_TYPE_ASSERT, "(*actualMaterial)", (const char *)&queryFormat, "*actualMaterial") )
__debugbreak();
p1_low = LOWORD(v44->drawSurf.packed.p1);
if ( (unsigned int)p1_low >= rgp.materialCount )
{
LODWORD(materialHandle) = rgp.materialCount;
LODWORD(surfType) = LOWORD(v44->drawSurf.packed.p1);
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_local.h", 2247, ASSERT_TYPE_ASSERT, "(unsigned)( mtlSortIndex ) < (unsigned)( rgp.materialCount )", "mtlSortIndex doesn't index rgp.materialCount\n\t%i not in [0, %i)", surfType, materialHandle) )
{
__debugbreak();
v44 = *Skins;
}
}
if ( DB_GetMaterialAtIndex(rgp.sortedMaterials[p1_low]) != v44 )
{
v46.physicsLibrary = DB_GetXAssetMasterDefaultHeader(ASSET_TYPE_MATERIAL).physicsLibrary;
p1 = v44->drawSurf.packed.p1;
if ( (unsigned __int16)p1 == (unsigned __int16)v46.physicsLibrary[2].name )
{
R_WarnOncePerFrame(R_WARN_UNSORTED_MATERIAL_INDEX, v44->name);
goto LABEL_164;
}
v48 = (unsigned __int16)p1;
if ( (unsigned __int16)p1 >= rgp.materialCount )
{
LODWORD(materialHandle) = rgp.materialCount;
LODWORD(surfType) = (unsigned __int16)p1;
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_local.h", 2247, ASSERT_TYPE_ASSERT, "(unsigned)( mtlSortIndex ) < (unsigned)( rgp.materialCount )", "mtlSortIndex doesn't index rgp.materialCount\n\t%i not in [0, %i)", surfType, materialHandle) )
{
__debugbreak();
v44 = *Skins;
}
}
if ( DB_GetMaterialAtIndex(rgp.sortedMaterials[v48]) != v44 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 1014, ASSERT_TYPE_ASSERT, "(R_GetSortedMaterial( ( uint )( *actualMaterial )->drawSurf.fields.materialSortedIndex ) == *actualMaterial)", (const char *)&queryFormat, "R_GetSortedMaterial( ( uint )( *actualMaterial )->drawSurf.fields.materialSortedIndex ) == *actualMaterial") )
__debugbreak();
}
v49 = *v28;
if ( SLOBYTE((*v28)->surfaceFlags) < 0 )
goto LABEL_164;
cameraRegion = v49->cameraRegion;
if ( cameraRegion - 2 <= 1 && (unsigned int)(r_drawTransDecalSurfs->current.integer - 3) <= 1 )
goto LABEL_164;
if ( cameraRegion <= 1 && (unsigned int)(r_drawOpaqueSurfs->current.integer - 3) <= 1 || v82 )
goto LABEL_164;
v51 = 0;
if ( !v97 )
goto LABEL_210;
if ( cameraRegion - 2 <= 1 )
{
cameraRegion = 6;
goto LABEL_129;
}
if ( !v49->cameraRegion )
{
cameraRegion = 5;
goto LABEL_129;
}
if ( cameraRegion == 1 )
{
cameraRegion = 7;
}
else
{
LABEL_210:
if ( (*((_BYTE *)sceneEnt + 1388) & 2) != 0 )
v51 = (v49->drawSurf.packed.p1 & 0x180000) == 0x100000i64;
}
LABEL_129:
if ( (*((_BYTE *)sceneEnt + 1388) & 2) != 0 )
{
if ( cameraRegion )
{
switch ( cameraRegion )
{
case 5u:
cameraRegion = 8;
break;
case 1u:
cameraRegion = 11;
break;
case 7u:
cameraRegion = 9;
break;
}
}
else
{
cameraRegion = 10;
}
}
v52 = v116;
if ( !v116 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 1079, ASSERT_TYPE_ASSERT, "(lightingInfo)", (const char *)&queryFormat, "lightingInfo") )
__debugbreak();
modelSurf[5].allocatedVolumeInfoSlot = v52[v102].lgv.allocatedVolumeInfoSlot;
modelSurf[6].allocatedVolumeInfoSlot = decalVolumeGridInfo.allocatedVolumeInfoSlot;
v53 = truncate_cast<unsigned __int64,__int64>((char *)modelSurf - (char *)frontEndDataOut - 1789440);
if ( (v53 & 3) != 0 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 1087, ASSERT_TYPE_ASSERT, "(!( surfId & 3 ))", (const char *)&queryFormat, "!( surfId & 3 )") )
__debugbreak();
v54 = v53 >> 2;
if ( (unsigned int)v54 >= 0x1000000 )
{
LODWORD(materialHandle) = 0x1000000;
LODWORD(surfType) = v54;
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 1089, ASSERT_TYPE_ASSERT, "(unsigned)( surfId ) < (unsigned)( 1 << 24 )", "surfId doesn't index 1 << MTL_SORT_OBJECT_ID_BITS\n\t%i not in [0, %i)", surfType, materialHandle) )
__debugbreak();
}
v55 = *Skins;
_XMM0.fields = (GfxDrawSurfFields)(*Skins)->drawSurf;
*(_QWORD *)&v110 = (*Skins)->drawSurf.packed.p0;
v57 = (unsigned __int64)v97 << 27;
__asm { vpextrq rcx, xmm0, 1 }
*((_QWORD *)&v110 + 1) = _RCX & 0xFFFFFFFE005FFFFFui64 | (_RCX - v57) & 0x1F8000000i64 | ((v97 | (4i64 * (unsigned int)v40)) << 21);
v59 = v110 & 0xE000000003FFFFFFui64 | ((v54 & 0xFFFFFF) << 26) | -(__int64)(v104 != 0) & 0x4000000000000i64;
*(_QWORD *)&v110 = v59;
if ( v89 < 96 )
{
v60 = _RCX & 0xFFFFFFFE005F0000ui64 | ((v97 | (4i64 * (unsigned int)v40)) << 21) & 0xFFFFFFFE07FF0000ui64 | outPhysicalMaterial[v89]->drawSurf.packed.p1 & 0x1F8000000i64 | LOWORD(v124[v89]);
*((_QWORD *)&v110 + 1) = v60 ^ (v60 ^ (v60 - v57)) & 0x1F8000000i64;
}
if ( !rg.distortion && Material_HasDistortion(v55) || !R_UGB_UpdateXSurfDataFromXSurf(xsurf) )
{
Skins = v101;
LABEL_164:
v12 = obj;
LABEL_165:
v62 = modelSurf;
goto LABEL_166;
}
v61 = truncate_cast<unsigned int,unsigned __int64>(v54);
v62 = modelSurf;
*(_QWORD *)&v110 = v59 & 0xFFFFFFFFFC0003FFui64 | ((unsigned __int64)R_AllocGPUBatchIndexXModel(0, sceneViewType, sceneEnt, modelSurf, v61, v40, v101) << 10);
v63 = (__int64)v117;
v64 = v117[cameraRegion];
if ( v64 >= lastDrawSurfs[cameraRegion] )
goto LABEL_168;
v65 = v110;
v64->fields = (GfxDrawSurfFields)v110;
*(_QWORD *)(v63 + 8i64 * cameraRegion) += 16i64;
if ( v51 )
{
*(_OWORD *)*(_QWORD *)(v63 + 96) = v65;
*(_QWORD *)(v63 + 96) += 16i64;
}
v100 = 1;
if ( v90 < 0xF )
break;
LABEL_158:
if ( r_showTriCounts->current.enabled )
{
v92 += R_GetModelSurfaceXSurface(modelSurf, v40)->triCount;
}
else if ( r_showVertCounts->current.enabled )
{
v93 += R_GetModelSurfaceXSurface(modelSurf, v40)->vertCount;
}
GfxSceneEntity_GetPlacementOrigin(sceneEnt, &outOrigin);
surfBounds.halfSize = xsurf->surfBounds.halfSize;
surfBounds.midPoint.v[0] = outOrigin.v[0] + xsurf->surfBounds.midPoint.v[0];
surfBounds.midPoint.v[1] = outOrigin.v[1] + xsurf->surfBounds.midPoint.v[1];
surfBounds.midPoint.v[2] = outOrigin.v[2] + xsurf->surfBounds.midPoint.v[2];
R_AccumulateSurfBounds(&surfBounds, &accumulatedSurfBounds);
v67 = Material_FromHandle(*v113);
R_AccumulateMaterialRenderTechflags(v67, &renderFeatures, &outOrigin);
memset(&outOrigin, 0, sizeof(outOrigin));
Skins = v101;
v12 = obj;
LABEL_166:
++v98;
v101 = ++Skins;
modelSurf = (GfxModelDecalVolumeGridInfo *)((char *)v62 + v38);
firstSurf = (char *)v62 + v38;
if ( v98 >= v91 )
goto LABEL_169;
}
v66 = *(__int128 **)(v63 + 8i64 * cameraRegion);
if ( v66 < (__int128 *)lastDrawSurfs[cameraRegion] )
{
*v66 = v65;
*(_QWORD *)(*(_QWORD *)(v63 + 8i64 * cameraRegion) + 8i64) = *(_QWORD *)(*(_QWORD *)(v63 + 8i64 * cameraRegion) + 8i64) & 0xFFFFFFFFF87FFFFFui64 | (v41 << 23);
*(_QWORD *)(v63 + 8i64 * cameraRegion) += 16i64;
goto LABEL_158;
}
LABEL_168:
R_WarnOncePerFrame(R_WARN_MAX_SCENE_DRAWSURFS, "R_AddDObjSurfacesCamera", cameraRegion);
firstSurf = modelSurf;
LABEL_169:
v6 = sceneEnt;
Model = v107;
v25 = v83;
LABEL_170:
v95 += v91;
if ( r_showModelNames->current.enabled || r_showModelLODs->current.integer || r_showModelLODOutDist->current.enabled )
{
GfxSceneEntity_GetPlacementOrigin(v6, &v111);
v12 = obj;
ModelRootBoneIndex = DObjGetModelRootBoneIndex(obj, v25);
DObjGetBasePoseMatrix(obj, ModelRootBoneIndex, &outMat);
origin.v[0] = outMat.trans.v[0] + v111.v[0];
origin.v[1] = outMat.trans.v[1] + v111.v[1];
origin.v[2] = outMat.trans.v[2] + v111.v[2];
if ( r_showModelNames->current.enabled )
R_AddScaledDebugString(&frontEndDataOut->debugGlobals, &rg.debugViewParms->camera, &origin, &colorCyan, Model->name);
integer = r_showModelLODs->current.integer;
if ( integer && 6 - integer >= lod )
{
v70 = j_va("%u", lod);
R_AddScaledDebugString(&frontEndDataOut->debugGlobals, &rg.debugViewParms->camera, &origin, &colorCyan, v70);
}
if ( r_showModelLODOutDist->current.enabled )
{
v71 = Model->numLods - 1;
v72 = j_va("[%u] %d", v71, (unsigned int)(int)Model->lodInfo[(unsigned __int64)v71].dist);
v73 = &colorCyan;
if ( lod == v71 )
v73 = &colorYellow;
R_AddScaledDebugString(&frontEndDataOut->debugGlobals, &rg.debugViewParms->camera, &origin, v73, v72);
}
memset(&v111, 0, sizeof(v111));
memset(&origin, 0, sizeof(origin));
}
else
{
v12 = obj;
}
if ( (*((_BYTE *)v6 + 1388) & 9) == 0 )
{
GfxSceneEntity_GetPlacementOrigin(v6, &placement.origin);
placement.quat = v6->placement.placement.quat;
CG_DrawHits_OnDrawModel(viewInfoa->clientIndex, (*((_DWORD *)v6 + 346) >> 10) & 0xFFF, &placement, Model, lod);
}
v10 = v102;
LABEL_187:
v14 = v83;
LABEL_188:
v83 = ++v14;
v102 = ++v10;
if ( v14 >= NumModels )
{
LODWORD(v10) = v92;
v11 = v93;
v13 = sceneViewType;
break;
}
}
}
if ( v13 == SCENE_VIEW_CAMERA_DEPTH_HACK )
R_UpdateViewSurfaceBounds(&accumulatedSurfBounds, SCENE_VIEW_CAMERA_DEPTH_HACK);
R_UpdateViewMaterialRenderTechflags(&renderFeatures);
GfxSceneEntity_GetPlacementOrigin(v6, &v112);
if ( r_showTriCounts->current.enabled && (_DWORD)v10 )
{
v74 = (unsigned int)v10;
}
else if ( r_showVertCounts->current.enabled && v11 )
{
v74 = v11;
}
else
{
if ( !r_showSurfCounts->current.enabled || !v95 )
goto LABEL_202;
v74 = v95;
}
v75 = j_va("%i", v74);
R_AddScaledDebugString(&frontEndDataOut->debugGlobals, &rg.debugViewParms->camera, &v112, &colorCyan, v75);
LABEL_202:
v76 = DVARINT_cg_drawFPS;
if ( DVARINT_cg_drawFPS )
{
Dvar_CheckFrontendServerThread(DVARINT_cg_drawFPS);
if ( v76->current.integer >= 3 )
{
if ( rg.stats )
rg.stats->numXModelTriCount += v10;
}
}
v8 = v100;
memset(&v112, 0, sizeof(v112));
}
Profile_EndInternal(NULL);
return v8;
}
/*
==============
R_AddXModelSurfaces
==============
*/
GfxDrawSurf *R_AddXModelSurfaces(const XModelDrawInfo *modelInfo, const XModel *model, MaterialTechniqueType techType, GfxDrawSurf *drawSurf, GfxDrawSurf *lastDrawSurf, const vec3_t *origin, GfxSceneViewType sceneViewType)
{
GfxDrawSurf *v7;
const XModel *v8;
unsigned __int64 v10;
unsigned int v11;
const GfxModelRigidSurface *v12;
int v13;
Material *const *Skins;
unsigned __int32 v15;
unsigned int v16;
unsigned int v17;
int skinnedCachedOffset;
Material *v19;
__int64 p1_low;
XAssetHeader v21;
int p1;
__int64 v23;
const XSurface *xsurf;
surfaceType_t v25;
unsigned __int64 ModelRigidSurfaceSize;
__int64 v27;
Material *v28;
const MaterialTechniqueSet *techniqueSet;
unsigned __int64 v32;
unsigned __int64 v33;
unsigned int v34;
__int64 surfType;
Material **materialHandle;
__int64 v38;
__int64 v39;
int v40;
unsigned int v41;
GfxDrawSurf *v42;
unsigned int v45;
GfxDrawSurfFields v46;
XSurface *surfaces;
Bounds surfBounds;
Bounds accumulatedSurfBounds;
v7 = drawSurf;
v42 = drawSurf;
v8 = model;
Profile_Begin(97);
if ( !v8 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 674, ASSERT_TYPE_ASSERT, "(model)", (const char *)&queryFormat, "model") )
__debugbreak();
v10 = *((_DWORD *)modelInfo + 1) & 0xFFFFFF;
v11 = *(_DWORD *)modelInfo;
v45 = v11 & 1;
v12 = (const GfxModelRigidSurface *)&frontEndDataOut->surfsBuffer[4 * v10];
v13 = (v11 >> 1) & 0xF;
v40 = XModelGetSurfaces(v8, &surfaces, v13);
Skins = XModelGetSkins(v8, v13);
if ( !Skins && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 684, ASSERT_TYPE_ASSERT, "(material)", (const char *)&queryFormat, "material") )
__debugbreak();
v15 = sceneViewType - 1;
*(_OWORD *)accumulatedSurfBounds.midPoint.v = _xmm_ff7fffff000000000000000000000000;
accumulatedSurfBounds.halfSize.v[1] = FLOAT_N3_4028235e38;
accumulatedSurfBounds.halfSize.v[2] = FLOAT_N3_4028235e38;
v16 = 0;
v41 = 0;
v17 = v40;
if ( !v40 )
goto LABEL_71;
while ( 1 )
{
skinnedCachedOffset = v12->base.skinnedCachedOffset;
if ( v12->base.skinnedCachedOffset != -3 )
break;
++v10;
v12 = (const GfxModelRigidSurface *)((char *)v12 + 4);
v7 = v42;
LABEL_67:
v41 = ++v16;
++Skins;
if ( v16 >= v17 )
goto LABEL_70;
}
if ( !*Skins )
{
if ( !v8 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\xanim\\xmodel_utils.h", 121, ASSERT_TYPE_ASSERT, "(model)", (const char *)&queryFormat, "model") )
__debugbreak();
LODWORD(v39) = v40;
LODWORD(v38) = v16;
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 704, ASSERT_TYPE_ASSERT, "(*material)", "%s\n\tR_AddXModelSurfaces failed with xmodel: %s - subMatIndex: %i, numsurfs: %i", "*material", v8->name, v38, v39) )
__debugbreak();
v17 = v40;
}
v19 = *Skins;
p1_low = LOWORD((*Skins)->drawSurf.packed.p1);
if ( (unsigned int)p1_low >= rgp.materialCount )
{
LODWORD(materialHandle) = rgp.materialCount;
LODWORD(surfType) = LOWORD((*Skins)->drawSurf.packed.p1);
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_local.h", 2247, ASSERT_TYPE_ASSERT, "(unsigned)( mtlSortIndex ) < (unsigned)( rgp.materialCount )", "mtlSortIndex doesn't index rgp.materialCount\n\t%i not in [0, %i)", surfType, materialHandle) )
__debugbreak();
}
if ( DB_GetMaterialAtIndex(rgp.sortedMaterials[p1_low]) != v19 )
{
v21.physicsLibrary = DB_GetXAssetMasterDefaultHeader(ASSET_TYPE_MATERIAL).physicsLibrary;
p1 = v19->drawSurf.packed.p1;
if ( (unsigned __int16)p1 == (unsigned __int16)v21.physicsLibrary[2].name )
{
R_WarnOncePerFrame(R_WARN_UNSORTED_MATERIAL_INDEX, v19->name);
v7 = v42;
LABEL_66:
v8 = model;
goto LABEL_67;
}
v23 = (unsigned __int16)p1;
if ( (unsigned __int16)p1 >= rgp.materialCount )
{
LODWORD(materialHandle) = rgp.materialCount;
LODWORD(surfType) = (unsigned __int16)p1;
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_local.h", 2247, ASSERT_TYPE_ASSERT, "(unsigned)( mtlSortIndex ) < (unsigned)( rgp.materialCount )", "mtlSortIndex doesn't index rgp.materialCount\n\t%i not in [0, %i)", surfType, materialHandle) )
{
__debugbreak();
v19 = *Skins;
}
}
if ( DB_GetMaterialAtIndex(rgp.sortedMaterials[v23]) != v19 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 717, ASSERT_TYPE_ASSERT, "(R_GetSortedMaterial( ( uint )( *material )->drawSurf.fields.materialSortedIndex ) == *material)", (const char *)&queryFormat, "R_GetSortedMaterial( ( uint )( *material )->drawSurf.fields.materialSortedIndex ) == *material") )
__debugbreak();
}
xsurf = v12->xsurf;
if ( v12->base.subdivLodLevel && R_SurfaceHasSubdivision(v12->xsurf) )
{
v25 = SF_XMODEL_RIGID_SUBDIV;
if ( skinnedCachedOffset <= -4 )
ModelRigidSurfaceSize = R_GetModelRigidSurfaceSize(v12);
else
ModelRigidSurfaceSize = 108i64;
}
else
{
v25 = SF_BEGIN_XMODEL;
if ( v12->base.skinnedCachedOffset > -4 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_model.h", 226, ASSERT_TYPE_ASSERT, "(R_IsRigidSurfaceType( modelSurf->base.skinnedCachedOffset ))", (const char *)&queryFormat, "R_IsRigidSurfaceType( modelSurf->base.skinnedCachedOffset )") )
__debugbreak();
v27 = (unsigned int)(-3 - v12->base.skinnedCachedOffset);
if ( (int)v27 > 128 )
{
LODWORD(v39) = 128;
LODWORD(v38) = -3 - v12->base.skinnedCachedOffset;
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_model.h", 209, ASSERT_TYPE_ASSERT, "( childCount ) <= ( ( XMODEL_MAX_RIGID_GROUPS ) )", "%s <= %s\n\t%i, %i", "childCount", "MAX_RIGID_CHILD_SURFACES", v38, v39) )
__debugbreak();
}
ModelRigidSurfaceSize = 32 * v27 + 76;
}
v28 = *Skins;
if ( !*Skins && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_material_inline.h", 464, ASSERT_TYPE_ASSERT, "(material)", (const char *)&queryFormat, "material") )
__debugbreak();
if ( !v28->techniqueSet && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_material_inline.h", 465, ASSERT_TYPE_ASSERT, "( ( material->techniqueSet ) )", "( material->name ) = %s", v28->name) )
__debugbreak();
techniqueSet = v28->techniqueSet;
if ( !techniqueSet && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_material_inline.h", 515, ASSERT_TYPE_ASSERT, "(techSet)", (const char *)&queryFormat, "techSet") )
__debugbreak();
v7 = v42;
if ( !Material_TechSetHasTechnique(techniqueSet, techType) )
{
v10 += ModelRigidSurfaceSize >> 2;
v12 = (const GfxModelRigidSurface *)((char *)v12 + ModelRigidSurfaceSize);
LABEL_65:
v17 = v40;
v16 = v41;
goto LABEL_66;
}
if ( v42 >= lastDrawSurf )
goto LABEL_69;
if ( (unsigned int)v10 >= 0x1000000 )
{
LODWORD(materialHandle) = 0x1000000;
LODWORD(surfType) = v10;
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 755, ASSERT_TYPE_ASSERT, "(unsigned)( surfId ) < (unsigned)( 1 << 24 )", "surfId doesn't index 1 << MTL_SORT_OBJECT_ID_BITS\n\t%i not in [0, %i)", surfType, materialHandle) )
__debugbreak();
}
_XMM0.fields = (GfxDrawSurfFields)(*Skins)->drawSurf;
__asm { vpextrq rax, xmm0, 1 }
v32 = _RAX & 0xFFFFFFFFF87FFFFFui64 | ((unsigned __int64)(unsigned int)v25 << 23);
*((_QWORD *)&v46 + 1) = v32;
v33 = (*Skins)->drawSurf.packed.p0 & 0xF000000003FFFFFFui64 | ((v10 & 0xFFFFFF | ((unsigned __int64)v45 << 24)) << 26);
*(_QWORD *)&v46 = v33;
if ( !R_UGB_UpdateXSurfDataFromXSurf(xsurf) )
{
v10 += ModelRigidSurfaceSize >> 2;
v12 = (const GfxModelRigidSurface *)((char *)v12 + ModelRigidSurfaceSize);
v7 = v42;
goto LABEL_65;
}
if ( techType == TECHNIQUE_BUILD_SHADOWMAP_DEPTH )
{
v34 = truncate_cast<unsigned int,unsigned __int64>(v10);
*(_QWORD *)&v46 = v33 & 0xFFFFFFFFFC0003FFui64 | ((unsigned __int64)R_AllocGPUBatchIndexXModel(1u, sceneViewType, NULL, v12, v34, v25, Skins) << 10);
}
v42->fields = v46;
v7 = ++v42;
if ( v25 != SF_XMODEL_RIGID_SUBDIV )
{
LABEL_63:
v10 += ModelRigidSurfaceSize >> 2;
v12 = (const GfxModelRigidSurface *)((char *)v12 + ModelRigidSurfaceSize);
if ( (unsigned int)(sceneViewType - 1) <= 2 )
{
surfBounds.halfSize = xsurf->surfBounds.halfSize;
surfBounds.midPoint.v[0] = origin->v[0] + xsurf->surfBounds.midPoint.v[0];
surfBounds.midPoint.v[1] = xsurf->surfBounds.midPoint.v[1] + origin->v[1];
surfBounds.midPoint.v[2] = xsurf->surfBounds.midPoint.v[2] + origin->v[2];
R_AccumulateSurfBounds(&surfBounds, &accumulatedSurfBounds);
}
goto LABEL_65;
}
if ( v7 < lastDrawSurf )
{
*((_QWORD *)&v46 + 1) = v32 & 0xFFFFFFFFF87FFFFFui64 | 0x5000000;
v7->fields = v46;
v42 = ++v7;
goto LABEL_63;
}
LABEL_69:
R_WarnOncePerFrame(R_WARN_MAX_SCENE_DRAWSURFS, "R_AddXModelSurfaces");
LABEL_70:
v15 = sceneViewType - 1;
LABEL_71:
if ( v15 <= 2 )
R_UpdateViewSurfaceBounds(&accumulatedSurfBounds, sceneViewType);
Profile_EndInternal(NULL);
return v7;
}
/*
==============
R_AddXModelSurfacesCamera
==============
*/
__int64 R_AddXModelSurfacesCamera(const GfxViewInfo *viewInfo, const XModelDrawInfo *modelInfo, const XModel *model, const DObj *obj, const vec3_t *origin, const GfxModelLightingProbeInfo *lightingInfo, int depthHack, GfxDrawSurf **drawSurfs, GfxDrawSurf **lastDrawSurfs, const unsigned __int16 mapEntLookup, XModelThermalMode thermalMode, unsigned int renderFlags, unsigned __int16 baseGfxEntityDataID, const GfxModelDecalVolumeGridInfo *decalVolumeGridInfo)
{
const XModel *v14;
const vec3_t *v16;
unsigned __int64 v17;
unsigned int v18;
unsigned __int8 *v19;
unsigned int v20;
Material *const *Skins;
unsigned int v22;
int v23;
Material *v24;
__int64 p1_low;
XAssetHeader v26;
int p1;
__int64 v28;
Material **v29;
XModelMaterialOverride *modelMaterialOverrides;
__int64 v31;
unsigned int materialOverrideCount;
MaterialOverride **materialOverride;
MaterialOverride *v34;
Material *originalMaterial;
MaterialOverrideType overrideType;
const XSurface *v37;
surfaceType_t v38;
unsigned __int64 ModelRigidSurfaceSize;
Material *overrideMaterial;
unsigned int v41;
int v42;
Material *v43;
unsigned int cameraRegion;
bool v45;
const GfxModelLightingProbeInfo *v46;
const Material *v47;
GfxDrawSurf v48;
__int64 v49;
unsigned __int64 v50;
unsigned __int64 v51;
unsigned int v52;
__int64 v53;
GfxDrawSurf *v54;
__int128 v55;
unsigned int v56;
__int128 *v57;
const XSurface *ModelSurfaceXSurface;
const XSurface *v59;
const XSurface *v60;
vec3_t *v61;
const Material *v62;
int integer;
const char *v64;
unsigned int v65;
const char *v66;
const vec4_t *v67;
__int64 v68;
unsigned int v69;
const char *v70;
const dvar_t *v71;
__int64 surfType;
Material **materialHandle;
__int64 v75;
__int64 v76;
unsigned int v77;
unsigned __int64 val;
int v79;
unsigned int v80;
Material **v81;
int v82;
unsigned int v83;
GfxViewMaterialRenderFeatures renderFeatures;
unsigned int v85;
unsigned int v86;
GfxSceneViewType sceneViewType;
Material **v88;
vec3_t *v89;
unsigned int v90;
const XModel *v91;
DebugXModelStats *v92;
__int128 v93;
const DObj *v94;
GfxDrawSurf **v95;
DebugXModelStats xmodelStats;
__int64 v97;
XSurface *surfaces;
Bounds surfBounds;
Bounds accumulatedSurfBounds;
int v101[96];
Material *outPhysicalMaterial[97];
v97 = -2i64;
v94 = obj;
v14 = model;
v91 = model;
v16 = origin;
v89 = (vec3_t *)origin;
v95 = drawSurfs;
Profile_Begin(97);
if ( !lightingInfo && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 315, ASSERT_TYPE_ASSERT, "(lightingInfo)", (const char *)&queryFormat, "lightingInfo") )
__debugbreak();
if ( !v14 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 316, ASSERT_TYPE_ASSERT, "(model)", (const char *)&queryFormat, "model") )
__debugbreak();
v80 = 0;
v85 = 0;
v92 = NULL;
v79 = 0;
v17 = *((_DWORD *)modelInfo + 1) & 0xFFFFFF;
val = v17;
v18 = *(_DWORD *)modelInfo;
v90 = *(_DWORD *)modelInfo & 1;
v19 = &frontEndDataOut->surfsBuffer[4 * v17];
v20 = (v18 >> 1) & 0xF;
v83 = v20;
v86 = XModelGetSurfaces(v14, &surfaces, v20);
Skins = XModelGetSkins(v14, v20);
v81 = (Material **)Skins;
if ( !Skins && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 340, ASSERT_TYPE_ASSERT, "(material)", (const char *)&queryFormat, "material") )
__debugbreak();
*(_OWORD *)accumulatedSurfBounds.midPoint.v = _xmm_ff7fffff000000000000000000000000;
accumulatedSurfBounds.halfSize.v[1] = FLOAT_N3_4028235e38;
accumulatedSurfBounds.halfSize.v[2] = FLOAT_N3_4028235e38;
renderFeatures = GFX_VIEW_MTL_FEAT_NONE;
sceneViewType = depthHack != 0 ? SCENE_VIEW_CAMERA_DEPTH_HACK : SCENE_VIEW_CAMERA;
if ( !decalVolumeGridInfo && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 355, ASSERT_TYPE_ASSERT, "(decalVolumeGridInfo)", (const char *)&queryFormat, "decalVolumeGridInfo") )
__debugbreak();
if ( rg.showXModelRanking && !depthHack && rg.showXModelRankingFilterMode != 1 )
v92 = R_AddXModelToRankingStats(v14, v20, 1u);
memset(&xmodelStats, 0, sizeof(xmodelStats));
if ( rg.showXModelRemoteConsole && !depthHack && rg.showXModelRankingFilterMode != 1 )
R_InitDebugXmodelStats(v14, 1u, v20, 1u, &xmodelStats);
v77 = 0;
if ( !v86 )
goto LABEL_135;
v22 = 0;
while ( 1 )
{
v23 = *(_DWORD *)v19;
if ( *(_DWORD *)v19 == -3 )
{
++v17;
v19 += 4;
goto LABEL_129;
}
v24 = *Skins;
if ( !*Skins && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 383, ASSERT_TYPE_ASSERT, "(*material)", (const char *)&queryFormat, "*material") )
__debugbreak();
p1_low = LOWORD(v24->drawSurf.packed.p1);
if ( (unsigned int)p1_low >= rgp.materialCount )
{
LODWORD(materialHandle) = rgp.materialCount;
LODWORD(surfType) = LOWORD(v24->drawSurf.packed.p1);
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_local.h", 2247, ASSERT_TYPE_ASSERT, "(unsigned)( mtlSortIndex ) < (unsigned)( rgp.materialCount )", "mtlSortIndex doesn't index rgp.materialCount\n\t%i not in [0, %i)", surfType, materialHandle) )
{
__debugbreak();
v24 = *Skins;
}
}
if ( DB_GetMaterialAtIndex(rgp.sortedMaterials[p1_low]) == v24 )
break;
v26.physicsLibrary = DB_GetXAssetMasterDefaultHeader(ASSET_TYPE_MATERIAL).physicsLibrary;
p1 = v24->drawSurf.packed.p1;
if ( (unsigned __int16)p1 != (unsigned __int16)v26.physicsLibrary[2].name )
{
v28 = (unsigned __int16)p1;
if ( (unsigned __int16)p1 >= rgp.materialCount )
{
LODWORD(materialHandle) = rgp.materialCount;
LODWORD(surfType) = (unsigned __int16)p1;
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_local.h", 2247, ASSERT_TYPE_ASSERT, "(unsigned)( mtlSortIndex ) < (unsigned)( rgp.materialCount )", "mtlSortIndex doesn't index rgp.materialCount\n\t%i not in [0, %i)", surfType, materialHandle) )
{
__debugbreak();
v24 = *Skins;
}
}
if ( DB_GetMaterialAtIndex(rgp.sortedMaterials[v28]) != v24 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 396, ASSERT_TYPE_ASSERT, "(R_GetSortedMaterial( ( uint )( *material )->drawSurf.fields.materialSortedIndex ) == *material)", (const char *)&queryFormat, "R_GetSortedMaterial( ( uint )( *material )->drawSurf.fields.materialSortedIndex ) == *material") )
__debugbreak();
break;
}
R_WarnOncePerFrame(R_WARN_UNSORTED_MATERIAL_INDEX, v24->name);
LABEL_34:
v22 = v77;
LABEL_130:
v77 = ++v22;
v81 = (Material **)++Skins;
if ( v22 >= v86 )
goto LABEL_134;
}
v29 = (Material **)Skins;
v88 = (Material **)Skins;
v82 = 96;
if ( v94 )
{
modelMaterialOverrides = v94->modelMaterialOverrides;
if ( modelMaterialOverrides )
{
v31 = 0i64;
materialOverrideCount = modelMaterialOverrides->materialOverrideCount;
if ( modelMaterialOverrides->materialOverrideCount )
{
materialOverride = modelMaterialOverrides->materialOverride;
while ( 1 )
{
v34 = materialOverride[v31];
if ( v34 )
{
originalMaterial = v34->originalMaterial;
if ( v34->originalMaterial == *Skins )
{
overrideType = v34->overrideType;
if ( overrideType != MATERIAL_OVERRIDETYPE_STICKER_REPLACE )
break;
}
}
v31 = (unsigned int)(v31 + 1);
if ( (unsigned int)v31 >= materialOverrideCount )
goto LABEL_49;
}
if ( overrideType != MATERIAL_OVERRIDETYPE_MATERIAL_REPLACE || (overrideMaterial = v34->overrideMaterial, originalMaterial->materialType == overrideMaterial->materialType) )
{
v41 = R_CopyMaterialOverrideToPhysicalMaterialData(v34, &outPhysicalMaterial[v31], &renderFeatures);
if ( v41 >= 0x800 )
{
LODWORD(v31) = 96;
R_WarnOncePerFrame(R_WARN_MATERIAL_OVERRIDE_OUT_OF_PHYSICAL_MATERIALS);
}
else
{
v101[v31] = rgp.physicalMaterialSortedIndex[v41];
}
v82 = v31;
if ( (int)v31 < 96 )
{
v29 = &outPhysicalMaterial[(int)v31];
v88 = v29;
}
}
else
{
R_WarnOncePerFrame(R_WARN_MATERIAL_OVERRIDE_MISMATCHED_MATERIAL, originalMaterial->name, overrideMaterial->name);
v82 = 96;
}
}
}
}
LABEL_49:
v37 = (const XSurface *)*((_QWORD *)v19 + 7);
if ( v19[54] && R_SurfaceHasSubdivision(*((const XSurface **)v19 + 7)) )
{
v38 = SF_XMODEL_RIGID_SUBDIV;
if ( v23 <= -4 )
ModelRigidSurfaceSize = R_GetModelRigidSurfaceSize((const GfxModelRigidSurface *)v19);
else
ModelRigidSurfaceSize = 108i64;
}
else
{
v38 = SF_BEGIN_XMODEL;
if ( *(int *)v19 > -4 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_model.h", 226, ASSERT_TYPE_ASSERT, "(R_IsRigidSurfaceType( modelSurf->base.skinnedCachedOffset ))", (const char *)&queryFormat, "R_IsRigidSurfaceType( modelSurf->base.skinnedCachedOffset )") )
__debugbreak();
v42 = -3 - *(_DWORD *)v19;
if ( v42 > 128 )
{
LODWORD(v76) = 128;
LODWORD(v75) = -3 - *(_DWORD *)v19;
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_model.h", 209, ASSERT_TYPE_ASSERT, "( childCount ) <= ( ( XMODEL_MAX_RIGID_GROUPS ) )", "%s <= %s\n\t%i, %i", "childCount", "MAX_RIGID_CHILD_SURFACES", v75, v76) )
__debugbreak();
}
ModelRigidSurfaceSize = 32i64 * (unsigned int)v42 + 76;
}
v43 = *v29;
if ( SLOBYTE((*v29)->surfaceFlags) < 0 )
goto LABEL_128;
cameraRegion = v43->cameraRegion;
if ( cameraRegion - 2 <= 1 && (unsigned int)(r_drawTransDecalSurfs->current.integer - 3) <= 1 || cameraRegion <= 1 && (unsigned int)(r_drawOpaqueSurfs->current.integer - 3) <= 1 )
{
Skins = v81;
goto LABEL_34;
}
v45 = 0;
if ( !depthHack )
{
LABEL_82:
if ( (renderFlags & 2) != 0 )
{
v45 = (v43->drawSurf.packed.p1 & 0x180000) == 0x100000i64;
goto LABEL_84;
}
goto LABEL_93;
}
if ( cameraRegion - 2 > 1 )
{
if ( !v43->cameraRegion )
{
cameraRegion = 5;
goto LABEL_84;
}
if ( cameraRegion == 1 )
{
cameraRegion = 7;
goto LABEL_84;
}
goto LABEL_82;
}
cameraRegion = 6;
LABEL_84:
if ( (renderFlags & 2) != 0 )
{
if ( cameraRegion )
{
switch ( cameraRegion )
{
case 5u:
cameraRegion = 8;
break;
case 1u:
cameraRegion = 11;
break;
case 7u:
cameraRegion = 9;
break;
}
}
else
{
cameraRegion = 10;
}
}
LABEL_93:
v46 = lightingInfo;
if ( !lightingInfo )
{
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 486, ASSERT_TYPE_ASSERT, "(lightingInfo)", (const char *)&queryFormat, "lightingInfo") )
__debugbreak();
v46 = NULL;
}
*((GfxModelLightingProbeInfo *)v19 + 5) = (GfxModelLightingProbeInfo)v46->lgv.allocatedVolumeInfoSlot;
*((_WORD *)v19 + 9) = mapEntLookup;
*((GfxModelDecalVolumeGridInfo *)v19 + 6) = (GfxModelDecalVolumeGridInfo)decalVolumeGridInfo->allocatedVolumeInfoSlot;
if ( (unsigned int)val >= 0x1000000 )
{
LODWORD(materialHandle) = 0x1000000;
LODWORD(surfType) = val;
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 494, ASSERT_TYPE_ASSERT, "(unsigned)( surfId ) < (unsigned)( 1 << 24 )", "surfId doesn't index 1 << MTL_SORT_OBJECT_ID_BITS\n\t%i not in [0, %i)", surfType, materialHandle) )
__debugbreak();
}
v47 = *v81;
v48.fields = (GfxDrawSurfFields)(*v81)->drawSurf;
*(_QWORD *)&v93 = v48.packed.p0;
v49 = (__int64)depthHack << 27;
v50 = v48.packed.p0 & 0xE000000003FFFFFFui64 | ((val & 0xFFFFFF | ((unsigned __int64)v90 << 24)) << 26);
*((_QWORD *)&v93 + 1) = v48.packed.p1 & 0xFFFFFFFE005FFFFFui64 | (v48.packed.p1 - v49) & 0x1F8000000i64 | ((depthHack & 1 | (4i64 * (unsigned int)v38)) << 21);
if ( v82 < 96 )
{
v51 = v48.packed.p1 & 0xFFFFFFFE005F0000ui64 | ((depthHack & 1 | (4i64 * (unsigned int)v38)) << 21) & 0xFFFFFFFE07FF0000ui64 | outPhysicalMaterial[v82]->drawSurf.packed.p1 & 0x1F8000000i64 | LOWORD(v101[v82]);
*((_QWORD *)&v93 + 1) = v51 ^ (v51 ^ (v51 - v49)) & 0x1F8000000i64;
}
if ( !rg.distortion && Material_HasDistortion(v47) )
goto LABEL_127;
if ( !v37 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 524, ASSERT_TYPE_ASSERT, "(xsurf)", (const char *)&queryFormat, "xsurf") )
__debugbreak();
if ( !R_UGB_UpdateXSurfDataFromXSurf(v37) )
{
LABEL_127:
v17 = val;
LABEL_128:
v17 += ModelRigidSurfaceSize >> 2;
v22 = v77;
Skins = v81;
v19 += ModelRigidSurfaceSize;
LABEL_129:
val = v17;
goto LABEL_130;
}
v52 = truncate_cast<unsigned int,unsigned __int64>(val);
*(_QWORD *)&v93 = v50 & 0xFFFFFFFFFC0003FFui64 | ((unsigned __int64)R_AllocGPUBatchIndexXModel(0, sceneViewType, NULL, v19, v52, v38, v81) << 10);
v53 = (__int64)v95;
v54 = v95[cameraRegion];
if ( v54 < lastDrawSurfs[cameraRegion] )
{
v55 = v93;
v54->fields = (GfxDrawSurfFields)v93;
*(_QWORD *)(v53 + 8i64 * cameraRegion) += 16i64;
if ( v45 )
{
*(_OWORD *)*(_QWORD *)(v53 + 96) = v55;
*(_QWORD *)(v53 + 96) += 16i64;
}
v56 = 1;
v79 = 1;
if ( v38 == SF_XMODEL_RIGID_SUBDIV )
{
v57 = *(__int128 **)(v53 + 8i64 * cameraRegion);
if ( v57 >= (__int128 *)lastDrawSurfs[cameraRegion] )
{
R_WarnOncePerFrame(R_WARN_MAX_SCENE_DRAWSURFS, "R_AddXModelSurfacesCamera", cameraRegion);
v20 = v83;
v16 = v89;
v14 = v91;
goto LABEL_136;
}
*v57 = v55;
*(_QWORD *)(*(_QWORD *)(v53 + 8i64 * cameraRegion) + 8i64) = *(_QWORD *)(*(_QWORD *)(v53 + 8i64 * cameraRegion) + 8i64) & 0xFFFFFFFFF87FFFFFui64 | 0x5000000;
*(_QWORD *)(v53 + 8i64 * cameraRegion) += 16i64;
}
if ( r_showTriCounts->current.enabled )
{
v80 += R_GetModelSurfaceXSurface(v19, v38)->triCount;
}
else if ( r_showVertCounts->current.enabled )
{
ModelSurfaceXSurface = R_GetModelSurfaceXSurface(v19, v38);
v85 += ModelSurfaceXSurface->vertCount;
}
if ( rg.showXModelRanking && !depthHack && rg.showXModelRankingFilterMode != 1 )
{
v59 = R_GetModelSurfaceXSurface(v19, v38);
R_AddXSurfaceToXModelStats(v59, v92);
}
if ( rg.showXModelRemoteConsole && !depthHack && rg.showXModelRankingFilterMode != 1 )
{
v60 = R_GetModelSurfaceXSurface(v19, v38);
R_AddXSurfaceToXModelStats(v60, &xmodelStats);
}
surfBounds.halfSize = v37->surfBounds.halfSize;
v61 = v89;
surfBounds.midPoint.v[0] = v89->v[0] + v37->surfBounds.midPoint.v[0];
surfBounds.midPoint.v[1] = v89->v[1] + v37->surfBounds.midPoint.v[1];
surfBounds.midPoint.v[2] = v89->v[2] + v37->surfBounds.midPoint.v[2];
R_AccumulateSurfBounds(&surfBounds, &accumulatedSurfBounds);
v62 = Material_FromHandle(*v88);
R_AccumulateMaterialRenderTechflags(v62, &renderFeatures, v61);
goto LABEL_127;
}
R_WarnOncePerFrame(R_WARN_MAX_SCENE_DRAWSURFS, "R_AddXModelSurfacesCamera", cameraRegion);
LABEL_134:
v14 = v91;
v16 = v89;
v20 = v83;
LABEL_135:
v56 = v79;
LABEL_136:
if ( rg.showXModelRemoteConsole )
{
if ( !depthHack )
{
if ( rg.showXModelRankingFilterMode != 1 )
R_PrintDebugXModelStats(&xmodelStats);
goto LABEL_140;
}
LABEL_141:
R_UpdateViewSurfaceBounds(&accumulatedSurfBounds, sceneViewType);
}
else
{
LABEL_140:
if ( depthHack )
goto LABEL_141;
}
R_UpdateViewMaterialRenderTechflags(&renderFeatures);
if ( r_showModelNames->current.enabled )
R_AddScaledDebugString(&frontEndDataOut->debugGlobals, &rg.debugViewParms->camera, v16, &colorCyan, v14->name);
integer = r_showModelLODs->current.integer;
if ( integer && 6 - integer >= v20 )
{
v64 = j_va("%u", v20);
R_AddScaledDebugString(&frontEndDataOut->debugGlobals, &rg.debugViewParms->camera, v16, &colorCyan, v64);
}
if ( r_showModelLODOutDist->current.enabled )
{
v65 = v14->numLods - 1;
v66 = j_va("[%u] %d", v65, (unsigned int)(int)v14->lodInfo[(unsigned __int64)v65].dist);
v67 = &colorCyan;
if ( v20 == v65 )
v67 = &colorYellow;
R_AddScaledDebugString(&frontEndDataOut->debugGlobals, &rg.debugViewParms->camera, v16, v67, v66);
}
if ( r_showTriCounts->current.enabled && v80 )
{
v68 = v80;
goto LABEL_159;
}
if ( r_showVertCounts->current.enabled && (v69 = v85) != 0 || r_showSurfCounts->current.enabled && (v69 = v86) != 0 )
{
v68 = v69;
LABEL_159:
v70 = j_va("%i", v68);
R_AddScaledDebugString(&frontEndDataOut->debugGlobals, &rg.debugViewParms->camera, v16, &colorCyan, v70);
}
v71 = DVARINT_cg_drawFPS;
if ( !DVARINT_cg_drawFPS && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\universal\\dvar.h", 699, ASSERT_TYPE_ASSERT, "(dvar)", "%s\n\tDvar %s accessed after deregistration", "dvar", "cg_drawFPS") )
__debugbreak();
Dvar_CheckFrontendServerThread(v71);
if ( v71->current.integer >= 3 && rg.stats )
rg.stats->numXModelTriCount += v80;
Profile_EndInternal(NULL);
return v56;
}
/*
==============
R_CopyMaterialOverrideToPhysicalMaterialData
==============
*/
__int64 R_CopyMaterialOverrideToPhysicalMaterialData(MaterialOverride *materialOverride, Material **outPhysicalMaterial, GfxViewMaterialRenderFeatures *renderFeatures)
{
Material **p_originalMaterial;
Material *v7;
const Material *v9;
unsigned __int32 v10;
const char *v11;
int v12;
const char *v13;
unsigned int v14;
Material *MaterialAtIndex;
Material *v16;
unsigned __int8 sortKey;
unsigned int textureCount;
signed __int32 v21;
__int64 v22;
MaterialTextureDef *v23;
if ( !materialOverride && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 92, ASSERT_TYPE_ASSERT, "(materialOverride)", (const char *)&queryFormat, "materialOverride") )
__debugbreak();
if ( materialOverride->overrideType == MATERIAL_OVERRIDETYPE_CAMO || (p_originalMaterial = &materialOverride->overrideMaterial, materialOverride->overrideType != MATERIAL_OVERRIDETYPE_MATERIAL_REPLACE) )
p_originalMaterial = &materialOverride->originalMaterial;
v7 = *p_originalMaterial;
if ( !v7 )
{
Com_Printf(8, "WARNING: Material override type of %d doesn't specify a valid material to instance.\n", (unsigned int)materialOverride->overrideType);
return 2048i64;
}
if ( v7->materialType != materialOverride->originalMaterial->materialType )
{
Com_Printf(8, "WARNING: Trying to override material %s, with material %s, but the types don't match.\n", materialOverride->originalMaterial->name, v7->name);
return 2048i64;
}
v9 = Material_FromHandle(v7);
R_AccumulateMaterialRenderTechflags(v9, renderFeatures, &tmpOrg);
if ( ((unsigned __int8)&rgp.materialOverridePhysicalMaterialIndex & 3) != 0 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\qcommon\\threads_interlock_pc.h", 79, ASSERT_TYPE_ASSERT, "( ( IsAligned( addend, sizeof( volatile_int32 ) ) ) )", "( addend ) = %p", &rgp.materialOverridePhysicalMaterialIndex) )
__debugbreak();
v10 = _InterlockedExchangeAdd(&rgp.materialOverridePhysicalMaterialIndex, 1u);
if ( v10 < 0x400 )
{
v14 = v10 + (rgp.materialOverridePhysicalBucketIndex << 10);
if ( v14 >= 0x800 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", 145, ASSERT_TYPE_ASSERT, "(physicalMaterialIndex < MAX_OVERRIDE_PHYSICAL_MATERIALS)", (const char *)&queryFormat, "physicalMaterialIndex < MAX_OVERRIDE_PHYSICAL_MATERIALS") )
__debugbreak();
MaterialAtIndex = DB_GetMaterialAtIndex(v14);
*outPhysicalMaterial = MaterialAtIndex;
v16 = MaterialAtIndex;
_XMM2.fields = (GfxDrawSurfFields)MaterialAtIndex->drawSurf;
sortKey = MaterialAtIndex->sortKey;
*MaterialAtIndex = *v7;
textureCount = MaterialAtIndex->textureCount;
MaterialAtIndex->sortKey = sortKey;
__asm { vpextrq rax, xmm2, 1 }
LOWORD(v16->drawSurf.packed.p1) = _RAX;
if ( ((unsigned __int8)&rgp.materialOverrideTextureTableIndex & 3) != 0 && CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\qcommon\\threads_interlock_pc.h", 79, ASSERT_TYPE_ASSERT, "( ( IsAligned( addend, sizeof( volatile_int32 ) ) ) )", "( addend ) = %p", &rgp.materialOverrideTextureTableIndex) )
__debugbreak();
v21 = _InterlockedExchangeAdd(&rgp.materialOverrideTextureTableIndex, textureCount);
v22 = v16->textureCount;
if ( (unsigned int)(v21 + v22) < 0x1800 )
{
v23 = &rgp.materialOverrideTextureTable[v21 + 6144 * rgp.materialOverrideTextureTableBucketIndex];
v16->textureTable = v23;
memcpy_0(v23, materialOverride->materialTextureDefClone, 16 * v22);
return v14;
}
v11 = "textureTableUsedCount < MAX_OVERRIDE_TEXTURE_TABLE_ENTRIES_PER_BUFFER";
v12 = 168;
v13 = "(textureTableUsedCount < MAX_OVERRIDE_TEXTURE_TABLE_ENTRIES_PER_BUFFER)";
}
else
{
v11 = "materialOverrideCount < MAX_OVERRIDE_PHYSICAL_MATERIALS_PER_BUFFER";
v12 = 137;
v13 = "(materialOverrideCount < MAX_OVERRIDE_PHYSICAL_MATERIALS_PER_BUFFER)";
}
if ( CoreAssert_Handler("c:\\workspace\\iw8\\code_source\\src\\gfx_d3d\\r_add_dobj_xmodel.cpp", v12, ASSERT_TYPE_ASSERT, v13, (const char *)&queryFormat, v11) )
__debugbreak();
return 2048i64;
}
|
11c5279b53ab5fbee14c4df0295335a32bbb4d5c
|
e36c0ddebc270be66a348597d1b01b6c4b040fff
|
/parsetree.h
|
df242137b2a2f5d5f5c8424a542fdb7a0f97fe66
|
[] |
no_license
|
Mustafa-AlHariry/Tiny-Compiler
|
0e216f89ae045f2e394fcf34eae263b4265df4c8
|
646affedb8935bbb3e86932450960c031b7eefe1
|
refs/heads/master
| 2023-02-07T21:50:26.602659
| 2021-01-03T14:32:50
| 2021-01-03T14:32:50
| 320,944,767
| 0
| 2
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 735
|
h
|
parsetree.h
|
#ifndef PARSETREE_H
#define PARSETREE_H
#include <QWidget>
#include "QGraphicsScene"
#include "QGraphicsRectItem"
#include "QGraphicsEllipseItem"
#include "QGraphicsLineItem"
#include "QGraphicsItem"
class ParseTree : public QWidget
{
Q_OBJECT
private:
QVector<QGraphicsItem*>Items;
QGraphicsScene* scene;
QGraphicsView* view;
public:
explicit ParseTree(QWidget *parent = nullptr);
QGraphicsRectItem* addRectangleNode(int x,int y,QString text);
QGraphicsEllipseItem* addEllipseNode(int x,int y,QString text);
QGraphicsLineItem *addEdgeChild(int x1,int y1,int x2,int y2);
QGraphicsLineItem *addEdgeFriend(int x1,int y1,int x2,int y2);
void clearTree(void);
signals:
};
#endif // PARSETREE_H
|
ec9f3df5aa3ffa8638b67929e086314e951d87ee
|
d31eabd5313fcdef9de4f4be8a123a8c4584c20d
|
/Customer.hpp
|
d508fecee3e3d61af92bf2bcbaa2215923629f2a
|
[] |
no_license
|
ahmadniaz98/Data-Structures--Linked-Lists--CPP
|
3cbbdb43d09acd8f8e2742d5b3802cd5b4c582ec
|
432441f8365d32f8b9ae047c028ae4a979f89abe
|
refs/heads/main
| 2023-03-05T19:50:21.804601
| 2021-02-14T12:52:24
| 2021-02-14T12:52:24
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 244
|
hpp
|
Customer.hpp
|
#ifndef Customer_H
#define Customer_H
#include <iostream>
using namespace std;
class Customer
{
public:
int id;
string name;
long phno;
Customer *next = NULL;
Customer(int, string, long);
void displayinfo();
};
#endif
|
aed264ae95e6d3cf68c1e341823c161dd0931800
|
9fd6a552e634a6c0b35964fc55134f887b570600
|
/ProjectEuler/soln12.cpp
|
12e2bc3f7368759ebbc0273b3ec84f7b5f7fb312
|
[] |
no_license
|
aarsh-sharma/Competitive-Programming
|
69b7e843155d94cb2a660ec3bef7a14a73e52735
|
ef760acb6723a9055dc47b647c8868b0b85084bb
|
refs/heads/master
| 2021-06-27T08:37:58.322780
| 2021-06-20T11:44:47
| 2021-06-20T11:44:47
| 202,996,777
| 0
| 1
| null | 2020-10-09T18:18:09
| 2019-08-18T11:53:03
|
C++
|
UTF-8
|
C++
| false
| false
| 1,300
|
cpp
|
soln12.cpp
|
/*aarsh01rsh@gmail.com
Aarsh Sharma*/
#include<bits/stdc++.h>
using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define debug(x) cout << (#x) << " is " << (x) << endl
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
typedef long long int ll;
#define int ll
typedef pair < ll, ll > pll;
typedef vector < vector < ll > > matrix;
typedef vector < ll > vll;
int gcd(int x,int y){return y==0?x:gcd(y,x%y);}
int num_of_divisors(int n) {
int ans = 1, num = 0;
while(n%2 == 0) {
num++;
n /= 2;
}
ans *= (1 + num);
for(int i = 3; i*i <= n; i+=2) {
num = 0;
while(n%i == 0) {
num++;
n /= i;
}
ans *= (1 + num);
}
if(n > 2) {
ans *= 2;
}
return ans;
}
int32_t main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int count = 14000, best = 0;
for(int i = 1; i < count; ++i) {
int sum = (i * (i+1)) / 2;
int temp = num_of_divisors(sum);
if(temp > best) {
best = temp;
}
if(temp > 500) {
cout << sum << "\n";
break;
}
}
cout << best << "\n";
return 0;
}
|
e50cbfa1bad6098a505ac831807aa58f0a0325c1
|
6322afe42dd32f0cc72cfe637c109f042ec4af39
|
/include/lvr2/geometry/LBPointArray.tcc
|
475bd2903f67c13d49925378d623d68ee4be97a2
|
[] |
permissive
|
uos/lvr2
|
3c94d640f3e315e23fd194d85c2bd8e6877cd674
|
9bb03a30441b027c39db967318877e03725112d5
|
refs/heads/develop
| 2023-06-22T11:49:52.100143
| 2021-10-08T15:58:07
| 2021-10-08T15:58:07
| 173,213,176
| 66
| 16
|
BSD-3-Clause
| 2023-05-28T19:10:14
| 2019-03-01T01:18:58
|
C++
|
UTF-8
|
C++
| false
| false
| 14,574
|
tcc
|
LBPointArray.tcc
|
/**
* Copyright (c) 2018, University Osnabrück
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the University Osnabrück nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL University Osnabrück BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <cassert>
namespace lvr2
{
// static helper methods
template<typename T>
static void mallocPointArray(LBPointArray<T>& m) {
m.elements = (T*)malloc(m.width * m.dim * sizeof(T));
}
template<typename T>
static void generatePointArray(LBPointArray<T>& m, int width, int dim)
{
m.dim = dim;
m.width = width;
m.elements = (T*)malloc(m.width * m.dim * sizeof(T) );
}
template<typename T>
static void generatePointArray(int id, LBPointArray<T>& m, int width, int dim)
{
m.dim = dim;
m.width = width;
m.elements = (T*)malloc(m.width * m.dim * sizeof(T) );
}
template<typename T>
static void fillPointArrayWithSequence(LBPointArray<T>& m) {
for(unsigned int i=0;i<m.width*m.dim;i++)
{
m.elements[i] = i;
}
}
// Pool function
template<typename T>
static void fillPointArrayWithSequence(int id, LBPointArray<T>& m) {
for(unsigned int i=0; i<m.width*m.dim; i++)
{
m.elements[i] = i;
}
}
template<typename T>
static void copyVectorInterval(LBPointArray<T>& in, int start, int end, LBPointArray<T>& out) {
for(int i=0; i < (end-start); i++)
{
out.elements[i] = in.elements[i + start];
}
}
template<typename T>
static void copyDimensionToPointArray(LBPointArray<T>& in, int dim, LBPointArray<T>& out) {
for(int i = 0; i<out.width; i++)
{
out.elements[i] = in.elements[i * in.dim + dim];
}
}
template<typename T>
static void splitPointArray(LBPointArray<T>& I, LBPointArray<T>& I_L, LBPointArray<T>& I_R) {
unsigned int i=0;
for(; i < I_L.width * I_L.dim; i++){
I_L.elements[i] = I.elements[i];
}
unsigned int j=0;
for(; i<I.width*I.dim && j<I_R.width*I_R.dim; i++, j++){
I_R.elements[j] = I.elements[i];
}
}
template<typename T, typename U>
static bool checkSortedIndices(const LBPointArray<T>& V, const LBPointArray<U>& sorted_indices,
unsigned int dim, int n)
{
bool check = true;
volatile U last_index = sorted_indices.elements[0];
if(last_index > V.width)
{
std::cout << n << " wrong " << std::endl;
}
for(U i=1; i<sorted_indices.width; i++)
{
volatile U index = sorted_indices.elements[i];
if(index > V.width )
{
std::cout << n << " index: "<< index << " to high: max_size "<< V.width << std::endl;
std::cout << n << " cursed by: " << sorted_indices.elements[i] << std::endl;
check = false;
//exit (EXIT_FAILURE);
continue;
}
if(last_index > V.width)
{
std::cout << n << " last index: "<< last_index << " to high max_size "<< V.width << std::endl;
std::cout << n << " cursed by: " << sorted_indices.elements[i] << std::endl;
check = false;
//exit (EXIT_FAILURE);
continue;
}
if( V.elements[V.dim * index + dim ] < V.elements[V.dim * last_index + dim ] )
{
check = false;
}
last_index = index;
}
return check;
}
template<typename T, typename U>
static void splitPointArrayWithValue(const LBPointArray<T>& V,
const LBPointArray<U>& I, LBPointArray<U>& I_L, LBPointArray<U>& I_R,
int current_dim, T value,
T& deviation_left, T& deviation_right, const unsigned int& orig_dim,
const std::list<U>& critical_indices_left_copy,
const std::list<U>& critical_indices_right_copy)
{
std::list<U> critical_indices_left(critical_indices_left_copy);
std::list<U> critical_indices_right(critical_indices_right_copy);
U i_l = 0;
U i_r = 0;
T smallest_left = std::numeric_limits<T>::max();
T biggest_left = std::numeric_limits<T>::lowest();
T biggest_right = std::numeric_limits<T>::lowest();
T smallest_right = std::numeric_limits<T>::max();
U counter_loop = 0;
for(int i=0; i<I.width; i++)
{
T current_value = V.elements[ I.elements[i] * V.dim + current_dim ];
T dim_value = V.elements[ I.elements[i] * V.dim + orig_dim ];
if(current_value < value && I_L.width > i_l ){
if(dim_value < smallest_left )
{
smallest_left = dim_value;
}
if(dim_value > biggest_left)
{
biggest_left = dim_value;
}
I_L.elements[i_l] = I.elements[i];
i_l++;
} else if(current_value > value && I_R.width > i_r){
if(dim_value > biggest_right)
{
biggest_right = dim_value;
}
if(dim_value < smallest_right)
{
smallest_right = dim_value;
}
I_R.elements[i_r] = I.elements[i];
i_r++;
} else {
bool found = false;
for(auto it = critical_indices_left.begin();
it != critical_indices_left.end();
it++)
{
// std::cout << *it << std::endl;
if(*it == I.elements[i] )
{
I_L.elements[i_l] = I.elements[i];
i_l++;
found = true;
critical_indices_left.erase(it);
break;
}
}
if(!found)
{
for(auto it = critical_indices_right.begin();
it != critical_indices_right.end();
it++)
{
// std::cout << *it << std::endl;
if(*it == I.elements[i] )
{
I_R.elements[i_r] = I.elements[i];
i_r++;
found = true;
critical_indices_right.erase(it);
break;
}
}
}
if(!found)
{
exit (EXIT_FAILURE);
}
}
}
deviation_left = biggest_left - smallest_left;
deviation_right = biggest_right - smallest_right;
}
template<typename T, typename U>
static void splitPointArrayWithValueSet(const LBPointArray<T>& V,
const LBPointArray<U>& I, LBPointArray<U>& I_L, LBPointArray<U>& I_R,
int current_dim, T value,
T& deviation_left, T& deviation_right, const unsigned int& orig_dim,
const std::unordered_set<U>& critical_indices_left,
const std::unordered_set<U>& critical_indices_right)
{
U i_l = 0;
U i_r = 0;
T smallest_left = std::numeric_limits<T>::max();
T biggest_left = std::numeric_limits<T>::lowest();
T biggest_right = std::numeric_limits<T>::lowest();
T smallest_right = std::numeric_limits<T>::max();
U counter_loop = 0;
for(int i=0; i<I.width; i++)
{
const U idx = I.elements[i] * V.dim;
assert(I.elements[i] < V.width);
const T current_value = V.elements[ idx + current_dim ];
const T dim_value = V.elements[ idx + orig_dim ];
if(current_value < value && I_L.width > i_l )
{
if(dim_value < smallest_left )
{
smallest_left = dim_value;
}
if(dim_value > biggest_left)
{
biggest_left = dim_value;
}
I_L.elements[i_l] = I.elements[i];
i_l++;
} else if(current_value > value && I_R.width > i_r){
if(dim_value > biggest_right)
{
biggest_right = dim_value;
}
if(dim_value < smallest_right)
{
smallest_right = dim_value;
}
I_R.elements[i_r] = I.elements[i];
i_r++;
} else {
// CRITICAL
bool found = false;
auto critical_it = critical_indices_left.find( I.elements[i] );
if(critical_it != critical_indices_left.end())
{
I_L.elements[i_l] = I.elements[i];
i_l++;
found = true;
// critical_indices_left.erase(critical_it);
}
if(!found)
{
critical_it = critical_indices_right.find(I.elements[i]);
if(critical_it != critical_indices_right.end())
{
I_R.elements[i_r] = I.elements[i];
i_r++;
found = true;
// critical_indices_right.erase(critical_it);
}
}
assert(found == true);
}
}
deviation_left = biggest_left - smallest_left;
deviation_right = biggest_right - smallest_right;
}
template<typename T>
static unsigned int checkNumberOfBiggerValues(LBPointArray<T>& V, unsigned int dim, T split)
{
unsigned int result = 0;
for(unsigned int i=0; i<V.width; i++)
{
if(V.elements[ i*V.dim + dim] > split)
{
result++;
}
}
return result;
}
static unsigned int checkNumberOfSmallerEqualValues(LBPointArray<float>& V, unsigned int dim, float split)
{
unsigned int result = 0;
for(unsigned int i=0; i<V.width; i++)
{
if(V.elements[ i*V.dim + dim] <= split)
{
result++;
}
}
return result;
}
// SORT FUNCTIONS THREADED
template<typename T, typename U>
static void mergeHostWithIndices(T* a, U* b, unsigned int i1, unsigned int j1,
unsigned int i2, unsigned int j2, int limit)
{
int limit_end = limit;
T* temp = (T*) malloc((j2-i1+1) * sizeof(T)); //array used for merging
U* temp_indices = (U*) malloc((j2-i1+1) * sizeof(U)); //array used for merging
unsigned int i,j,k;
i=i1; //beginning of the first list
j=i2; //beginning of the second list
k=0;
unsigned int counter = 0;
while( i<=j1 && j<=j2 && limit!=0 ) //while elements in both lists
{
counter ++;
limit--;
if(a[i]<a[j]){
temp_indices[k] = b[i];
temp[k++] = a[i++];
}else{
temp_indices[k] = b[j];
temp[k++]=a[j++];
}
}
while(i <= j1 && limit != 0) //copy remaining elements of the first list
{
temp_indices[k] = b[i];
temp[k++]=a[i++];
}
while(j <= j2 && limit!=0 ) { //copy remaining elements of the second list
temp_indices[k] = b[j];
temp[k++]=a[j++];
}
//Transfer elements from temp[] back to a[]
for(i=i1,j=0;i<=j2 && limit_end!=0 ;i++,j++,limit_end--)
{
b[i] = temp_indices[j];
a[i] = temp[j];
}
free(temp_indices);
free(temp);
}
template<typename T, typename U>
static void naturalMergeSort(LBPointArray<T>& in, int dim, LBPointArray<U>& indices, LBPointArray<T>& m, int limit) {
copyDimensionToPointArray<T>(in, dim, m);
unsigned int m_elements = m.width * m.dim;
unsigned int slide_buffer_size = static_cast<unsigned int>(m_elements-0.5);
U* slide_buffer = (U*) malloc(slide_buffer_size * sizeof(U));
//create RUNS
unsigned int num_slides = 1;
slide_buffer[0] = 0;
for(unsigned int i=1; i < slide_buffer_size+1; i++)
{
if(m.elements[i] < m.elements[i-1])
{
slide_buffer[num_slides] = i;
num_slides++;
}
}
slide_buffer[num_slides] = m_elements;
slide_buffer_size = num_slides+1;
//sort
unsigned int count = 0;
int current_limit = -1;
while(num_slides > 1)
{
if(num_slides > 2){
current_limit = limit;
}
unsigned int i;
for(i=2;i<num_slides+1;i+=2)
{
mergeHostWithIndices<T,U>(m.elements,
indices.elements,
slide_buffer[i-2],
slide_buffer[i-1]-1,
slide_buffer[i-1],
slide_buffer[i]-1,
current_limit);
slide_buffer[i/2] = slide_buffer[i];
}
if(num_slides%2 == 1){
slide_buffer[(num_slides+1)/2] = slide_buffer[num_slides];
}
count ++;
num_slides = static_cast<unsigned int>(num_slides/2.0+0.5);
}
free(slide_buffer);
}
template<typename T, typename U>
static void sortByDim(LBPointArray<T>& V, int dim, LBPointArray<U>& indices, LBPointArray<T>& values) {
naturalMergeSort<T,U>(V, dim, indices, values);
}
template<typename T, typename U>
static void generateAndSort(int id, LBPointArray<T>& vertices,
LBPointArray<U>* indices_sorted,
LBPointArray<T>* values_sorted,
int dim)
{
generatePointArray<U>( indices_sorted[dim], vertices.width, 1);
generatePointArray<T>( values_sorted[dim], vertices.width, 1);
fillPointArrayWithSequence<U>( indices_sorted[dim] );
sortByDim<T,U>( vertices, dim, indices_sorted[dim] , values_sorted[dim] );
}
} /* namespace lvr2 */
|
17fb888c9b31d7164fb74cc496e5bc20fd172a60
|
5a92f6db6e8b7698aef17179b3c6864e06968294
|
/tests/gltexture2dms.cpp
|
78d8103027fd712b1959da4cad30a80b30bede7e
|
[
"MIT"
] |
permissive
|
AlbertoGP/finegraphics
|
51de742339d298f43f211121f159fcaabf75e0dd
|
815eb9bc30ac27e8032785ed8963978c2aca758b
|
refs/heads/master
| 2022-01-18T23:10:31.185935
| 2019-01-20T11:14:44
| 2019-01-20T11:14:44
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,452
|
cpp
|
gltexture2dms.cpp
|
#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include <ffw/graphics/gltexture2dms.h>
#include "dummywindow.h"
#include "traits.h"
static bool compareArray(const uint8_t* a, const uint8_t* b, size_t len) {
for (size_t i = 0; i < len; i++) {
if (a[i] != b[i])return false;
}
return true;
}
TEST_CASE("Test functionality", "ffw::GLTexture2DMS") {
DUMMY_APP;
SECTION("default constructor") {
ffw::GLTexture2DMS tex;
REQUIRE(tex.isCreated() == false);
REQUIRE(tex.getHandle() == 0);
REQUIRE(tex.getWidth() == 0);
REQUIRE(tex.getHeight() == 0);
REQUIRE(tex.getDepth() == 0);
REQUIRE(tex.getLayers() == 0);
REQUIRE(tex.getSamples() == 0);
REQUIRE(tex.getInternalFormat() == 0);
REQUIRE(tex.getFormat() == 0);
REQUIRE(tex.getPixelFormat() == 0);
REQUIRE(tex.getTextureFormat() == GL_TEXTURE_2D_MULTISAMPLE);
REQUIRE(tex.isCompressed() == false);
}
SECTION("basic functionality") {
ffw::GLTexture2DMS texA = ffw::GLTexture2DMS(16, 16, GL_RGB8, 4);
ffw::GLTexture2DMS texB;
REQUIRE(texA.isCreated() == true);
REQUIRE(texA.getHandle() != 0);
std::swap(texA, texB);
REQUIRE(texB.isCreated() == true);
REQUIRE(texB.getHandle() != 0);
REQUIRE(texB.getWidth() == 16);
REQUIRE(texB.getHeight() == 16);
REQUIRE(texB.getDepth() == 0);
REQUIRE(texB.getLayers() == 0);
REQUIRE(texB.getSamples() == 4);
REQUIRE(texB.getInternalFormat() == GL_RGB8);
REQUIRE(texB.getFormat() == 0);
REQUIRE(texB.getPixelFormat() == 0);
REQUIRE(texB.getTextureFormat() == GL_TEXTURE_2D_MULTISAMPLE);
REQUIRE(texB.isCompressed() == false);
texB.destroy();
REQUIRE(texB.isCreated() == false);
REQUIRE(texB.getHandle() == 0);
REQUIRE(texB.getWidth() == 0);
REQUIRE(texB.getHeight() == 0);
REQUIRE(texB.getDepth() == 0);
REQUIRE(texB.getLayers() == 0);
REQUIRE(texB.getSamples() == 0);
REQUIRE(texB.getInternalFormat() == 0);
REQUIRE(texB.getFormat() == 0);
REQUIRE(texB.getPixelFormat() == 0);
REQUIRE(texB.getTextureFormat() == GL_TEXTURE_2D_MULTISAMPLE);
REQUIRE(texB.isCompressed() == false);
}
SECTION_TEST_MOVEABLE(ffw::GLTexture2DMS);
SECTION_TEST_NOT_COPYABLE(ffw::GLTexture2DMS);
}
|
f1404a3d614f9b1e4c98700078db67916904a98d
|
c920079b644668fcea120937ec7bec392d2029bd
|
/B5---Artificial-Intelligence/gomoku/src/graphic/Stats.cpp
|
5fa7852e43bcdc206a223d7971a659ddde1700d1
|
[] |
no_license
|
Ankirama/Epitech
|
d23fc8912d19ef657b925496ce0ffcc58dc51d3b
|
3690ab3ec0c8325edee1802b6b0ce6952e3ae182
|
refs/heads/master
| 2021-01-19T08:11:27.374033
| 2018-01-03T10:06:20
| 2018-01-03T10:06:20
| 105,794,978
| 0
| 5
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 416
|
cpp
|
Stats.cpp
|
//
// Created by doT on 28/10/2015.
//
#include "Stats.h"
Stats::Stats(QWidget *widget) {
setupUi(widget);
}
Stats::~Stats() {
}
void Stats::setLabel(){
this->player->setText("Player 2");
}
void Stats::setStoneStole(std::string number){
this->stoneStole->setText(QString::fromStdString(number));
}
void Stats::setTimer(std::string time) {
this->label_4->setText(QString::fromStdString(time));
}
|
6f8d52b0af1591614621778ca27f299a8610cee4
|
ea686b349f8b95f215a1d33fbc6d672a2b68e764
|
/practice/Practice set (Rough)/chef_n_dice.cpp
|
2cdba1a6e45543316480495f347b62f71566f613
|
[] |
no_license
|
selectivegravity/DSA_Practice
|
ac2659828bde901e68d79723c1da07e7af1354b4
|
6e89324d4e9daa99e43c3c535912e6685bc1836f
|
refs/heads/master
| 2023-07-11T20:43:19.166690
| 2021-08-12T12:41:33
| 2021-08-12T12:41:33
| 395,309,835
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,647
|
cpp
|
chef_n_dice.cpp
|
#include<iostream>
#include <sstream>
#include<math.h>
using namespace std;
int DecimalToBinary(int n) {
int binaryNumber[100], num=n;
int i = 0;
while (n > 0) {
binaryNumber[i] = n % 2;
n = n / 2;
i++;
}
int binary=0;
for (int j = i - 1; j >= 0; j--){
int last=binaryNumber[j];
binary=binary*10+last;
}
return binary;
}
// Function to convert binary to decimal
int binaryToDecimal(int n)
{
int num = n;
int dec_value = 0;
// Initializing base value to 1, i.e 2^0
int base = 1;
int temp = num;
while (temp) {
int last_digit = temp % 10;
temp = temp / 10;
dec_value += last_digit * base;
base = base * 2;
}
return dec_value;
}
void printSubsequence(string input, string output,int* idx)
{
if (input.empty()) {
stringstream geek(output);
int x=-1;
geek >> x;
//cout<<binaryToDecimal(x)<<" "<<output<<" "<<endl;;
idx[binaryToDecimal(x)]=1;
return;
}
printSubsequence(input.substr(1), output + input[0],idx);
printSubsequence(input.substr(1), output,idx);
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin>>t;
while(t--){
string s;
cin>>s;
int range = pow(2,s.length())+1;
int idx[range];
for(int i=0;i<range;i++){
idx[i]=-1;
}
printSubsequence(s,"",idx);
for(int i=0;i<range;i++){
if(idx[i]==-1){
cout<<i<<"\n";
break;
}
//cout<<idx[i]<<endl;
}
}
return 0;
}
|
d96a24df90cef22e46f17683286a640831b00089
|
ac8332c8cce1c096f01ad20787c1671c3a8794d4
|
/Exercise4/Exercise4Lib.cpp
|
ccfbd5aeb173972b28c091c6b7049543a9f88040
|
[] |
no_license
|
norbyscook/BjarneCh3
|
642068b8e8f235bb6cb22c768cbaa40578fef5c7
|
6b053009b5d1796ac5b037df6fd126a12ff810f2
|
refs/heads/main
| 2023-07-09T21:24:45.379656
| 2021-08-16T05:04:55
| 2021-08-16T05:04:55
| 373,608,322
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,086
|
cpp
|
Exercise4Lib.cpp
|
#include "Exercise4Lib.h"
// helper functions to get interger from user =======================================
// get integer input from user, redo if input not all integer
int get_int()
{
string input{" "};
bool int_yes {true};
uint8_t sign_count {0};
bool input_valid;
do
{
// get input
cin >> input;
// set the variables to check for correct input
// check for non interger related characters
int_yes = {is_int(input)};
// count the number of signs
sign_count = {sign_counter(sign_count, input)};
input_valid = {input_invald_int(int_yes, sign_count)};
// error message if too many signs or non interger related characters
if (input_valid)
{
cout << "integers please \n";
}
}
while (input_valid);
return stoi(input);
}
// check if a string is all integer
bool is_int(string input)
{
for (auto &ch : input)
{
if (!isdigit(ch) && !ch_is_sign(ch))
{
return false;
}
}
return true;
}
// final check to see if input is a valid number and it has correct number of + and - signs
bool input_invald_int (bool int_yes, uint8_t sign_count)
{
if (!int_yes || sign_count > 1)
{
return true;
}
return false;
}
// find the greatest common divisor of two intergers
int find_gcd_int(int val1, int val2)
{
// make all positive
val1 = {abs(val1)};
val2 = {abs(val2)};
int old_val2 = {val2};
while (val2 > 0)
{
old_val2 = {val2};
val2 = val1 % val2;
val1 = old_val2;
}
return val1;
}
// decide if a character is - or + symbol
bool ch_is_sign (char ch)
{
if (ch == '+' || ch == '-')
{
return true;
}
return false;
}
// helper functions for counting the plus and minus signs of numbers
uint8_t sign_counter(uint8_t sign_count, string input)
{
for (auto &ch : input)
{
if (ch_is_sign(ch))
{
sign_count++;
}
}
return sign_count;
}
|
92feeca5fa0df0eafd57cdc399e650585d75362b
|
4c2ab16671ed9041d709264f7c2af700fa299d84
|
/day5_assingment/example1.cpp
|
26854ccb14c8f560ffc695460463801f7712858e
|
[] |
no_license
|
shubharthaksangharsha/institutional_training
|
0317e07149b33170443d52779fcdc4ddee5da40d
|
b71b70092fb1d68a116121fe722db4818a9084de
|
refs/heads/main
| 2023-06-10T11:44:55.224364
| 2021-07-03T02:13:40
| 2021-07-03T02:13:40
| 377,275,989
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 343
|
cpp
|
example1.cpp
|
#include<iostream>
#include<fstream>
using namespace std;
int main(){
fstream new_file;
new_file.open("random_file_write.txt", ios::out);
if(!new_file)
{
cout<<"File creation failed";
}
else{
cout<<"New file created ";
new_file<<"Hey I am learning c++ file handling";
new_file.close();
}
return 0;
}
|
34d9cd5408e51449b153e93e273d1a7a6cf2f265
|
7988f9d07420d7577df05adfcda47eafef8e39c8
|
/bson/main.cpp
|
2368bd87c561d00d03db1ba8185ac9a23fdafc01
|
[
"LicenseRef-scancode-public-domain"
] |
permissive
|
ekd123/ekode
|
e4998efc88d90b7e8655b22d4296e5f902ff91bf
|
e5ea3e8c701f64f42d0e17992fb4ce637b9a5f20
|
refs/heads/master
| 2021-01-15T15:27:39.790470
| 2018-08-16T10:44:59
| 2018-08-16T10:49:22
| 65,139,699
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 59
|
cpp
|
main.cpp
|
#include <iostream>
#include "bson.h"
using namespace std;
|
118be816557c5e3161f71fd5c04e7c7c195e8b12
|
dd7632e0e77aa4ff03e23bdce7d65234f4712540
|
/algorithms/Student Attendance Record II/Student Attendance Record II.cpp
|
b41b6e55cecf21570164009fffffc53c6f1a9b60
|
[] |
no_license
|
luckcul/LeetCode
|
f979a7771455312471b9b516c1a48cfb53086c2e
|
9fa0ad174e6925fce4aae32a459e4a3c23951060
|
refs/heads/master
| 2021-01-20T18:48:50.657792
| 2020-10-21T22:30:55
| 2020-10-21T22:30:55
| 64,599,280
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,006
|
cpp
|
Student Attendance Record II.cpp
|
class Solution {
int dp[100005][6];
int add(int x, int y) {
int mod = 1e9+7;
x %= mod; y %= mod;
return (x+y) % mod;
}
public:
int checkRecord(int n) {
// vector<vector<int>> dp(n+1, vector<int>(6, 0));
dp[0][0] = 1;
int mod = 1e9+7;
for(int i = 1; i <= n; i++) {
dp[i][0] = add(dp[i-1][0], dp[i][0]);
dp[i][0] = add(dp[i-1][1], dp[i][0]);
dp[i][0] = add(dp[i-1][2], dp[i][0]);
dp[i][1] = add(dp[i-1][0], dp[i][1]);
dp[i][2] = add(dp[i-1][1], dp[i][2]);
dp[i][3] = add(dp[i-1][3], dp[i][3]);
dp[i][3] = add(dp[i-1][4], dp[i][3]);
dp[i][3] = add(dp[i-1][5], dp[i][3]);
dp[i][3] = add(dp[i][0], dp[i][3]);
dp[i][4] = add(dp[i-1][3], dp[i][4]);
dp[i][5] = add(dp[i-1][4], dp[i][5]);
}
int ret = 0;
for(int i = 0; i < 6; i++) ret = add(ret, dp[n][i]);
return ret;
}
};
|
e1fe087748e94ff1500941ec0b7f20ad6ae15cc8
|
6bbf9e68688f50559b228947c43beca264d1ceea
|
/Optimiza/FBExport/fbexport-1.90/fbcopy/args.cpp
|
e10b67f749fe2d146e0fd69b6665cce8380ff3bd
|
[
"MIT"
] |
permissive
|
anerlich/LexianGit
|
dc0dbc743b7a3e41a6d78943708308adcf80f455
|
7e44a62fcb889119ebbeb2a1921b5aee0d81a7df
|
refs/heads/master
| 2023-04-06T04:37:51.968913
| 2021-04-11T05:08:06
| 2021-04-11T05:08:06
| 353,572,978
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,515
|
cpp
|
args.cpp
|
///////////////////////////////////////////////////////////////////////////////
//
// Author : Milan Babuskov (mbabuskov@yahoo.com)
// Purpose : Implementation of Args class
// Parses command line arguments and assigns values to Args
// class attributes. The idea is to take all command-line
// arguments into single class for easy management
//
///////////////////////////////////////////////////////////////////////////////
/*
Copyright (c) 2005,2006 Milan Babuskov
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 <stdio.h>
#include <stdlib.h>
#pragma hdrstop
#include "args.h"
//---------------------------------------------------------------------------
Args::Args(int argc, char **argv)
{
if (argc == 1)
{
Error = "Display help";
return;
}
if (argc != 4)
{
Error = "Wrong number of arguments on the command line.";
return;
}
DisplayDifferences = 0;
FireTriggers = false;
KeepGoing = false;
SingleTransaction = false;
NotNulls = true;
Html = false;
Verbose = false;
Update = false;
Error = "OK"; // initial values (local)
string temp;
Operation = opNone;
for (int i=0; argv[1][i]; i++)
{
char c = argv[1][i]; // allow uppercase/lowercase
if (c >= 'a' && c <= 'z')
c += 'A' - 'a';
switch (c)
{
case 'D': Operation = opDefine; break;
case 'A': Operation = opAlter; break;
case 'C': Operation = opCopy; break;
case 'S': Operation = opSingle; break;
case 'X': Operation = opCompare; break;
case 'K': KeepGoing = true; break;
case 'E': SingleTransaction = true; break;
case 'N': NotNulls = false; break;
case 'H': Html = true; break;
case 'F': FireTriggers = true; break;
case 'V': Verbose = true; break;
case 'U': Update = true; break;
case '1': case '2': case '3': case '4':
DisplayDifferences |= (1 << (c-'1'));
break;
default:
fprintf(stderr, "Unknown option %c.\n", c);
break;
}
}
createDBInfo(Src, argv[2]);
createDBInfo(Dest, argv[3]);
if (Operation == opNone)
Error = "You must specify operation: D, A, C, S or X.";
if (!Html && DisplayDifferences != 0)
Error = "Options 1234 and only available together with H";
if (NotNulls == false && Operation != opAlter)
Error = "Option N is only available with option A";
if (Html && (Operation == opSingle || Operation == opCopy))
Error = "Option H is only available with D, A or X";
if (Update && Operation != opCopy)
Error = "Option U is only avaliable with C";
}
//---------------------------------------------------------------------------
void Args::createDBInfo(DatabaseInfo& db, char *string)
{
db.Charset = "";
db.Hostname = "";
std::string s(string);
std::string::size_type p = s.find("@");
if (p == std::string::npos)
{
char *usr = getenv("ISC_USER");
char *pwd = getenv("ISC_PASSWORD");
if (!usr || !pwd)
{
Error = "Missing @ in path and ISC_USER and ISC_PASSWORD not set.";
return;
}
db.Username = usr;
db.Password = pwd;
}
else
{
std::string left = s.substr(0, p);
s.erase(0, p+1);
p = left.find(":");
if (p == std::string::npos)
{
Error = "Missing : in username:password part";
return;
}
db.Username = left.substr(0, p);
db.Password = left.substr(p+1);
}
p = s.find(":");
if (p != std::string::npos)
{
#ifdef IBPP_WINDOWS
if (p > 1) // to avoid drive letter
{
db.Hostname = s.substr(0, p);
s.erase(0, p+1);
}
#else
db.Hostname = s.substr(0, p);
s.erase(0, p+1);
#endif
}
p = s.find("?");
if (p != std::string::npos)
{
db.Charset = s.substr(p+1);
s.erase(p);
}
db.Database = s;
}
//---------------------------------------------------------------------------
#pragma package(smart_init)
|
3b097368ce767bbbac1bfd946305dc3dfdc2d1a5
|
43e28ce11f5ddd07407a87385809c5e3933f348f
|
/mhdlc/src/GenCodeBlock.hh
|
990608e028da948f59c719ea3eb0c84bdd3e68b7
|
[] |
no_license
|
xinmeng/metahdl
|
5d3421a5f06521d821d089efd94958abf78816f3
|
b9465b3b44c1069382286365211ffb328a0b657f
|
refs/heads/master
| 2022-06-29T18:15:11.937153
| 2015-07-01T06:31:52
| 2015-07-01T06:31:52
| 32,431,363
| 7
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 617
|
hh
|
GenCodeBlock.hh
|
#ifndef __GENCODEBLOCK_HH__
#define __GENCODEBLOCK_HH__
#include "CodeBlock.hh"
extern bool OutputCodeLocation;
class CGenCodeBlock
{
protected:
yy::location _loc;
int _step;
public:
inline CGenCodeBlock(const yy::location &loc): _loc (loc), _step (2) {}
inline CGenCodeBlock(const yy::location &loc, int step): _loc (loc), _step (step) {}
inline yy::location Loc() {return _loc;}
inline void PrintLoc(ostream &os) {
if (OutputCodeLocation) {
os << "// " << _loc << endl;
}
}
virtual void Print(ostream &os=cout) =0;
};
class CGenCodeBlk
#endif
|
c7da5c497ab847e54b52061ae18f35408d50772f
|
dc679291fd34186e69fd6186fe7c1fd346b5e360
|
/src/Day 17 - Spinlock/Spinlock.cpp
|
ee027d65967dc16cdb552378dab624cf2c98ed61
|
[] |
no_license
|
Biendeo/Advent-Of-Code-2017
|
7087610e8898cc094a771930c12e54add4d454a6
|
afbdf7271d64733e9431defd382b418e2cb1354e
|
refs/heads/master
| 2021-08-31T16:34:58.332265
| 2017-12-21T06:51:06
| 2017-12-21T06:51:06
| 112,828,595
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,162
|
cpp
|
Spinlock.cpp
|
// Day 17: Spinlock.cpp
// Definitions for the class that cycles through elements.
#include "Spinlock.h"
#include <fstream>
#include <iostream>
#include <list>
Biendeo::AdventOfCode2017::Day17::Spinlock::Spinlock(int input) {
numSteps = input;
}
int Biendeo::AdventOfCode2017::Day17::Spinlock::ValueAfter2017() {
return cache.Get([&] {
return CalculateValueAfter2017();
});
}
int Biendeo::AdventOfCode2017::Day17::Spinlock::CalculateValueAfter2017() {
std::list<int> buffer{0};
auto it = buffer.begin();
#ifndef AOC_PART2
static const int LIMIT = 2017;
#else
// Part 2 takes way too long. Can it be faster?
static const int LIMIT = 50000000;
#endif
for (int i = 1; i <= LIMIT; ++i) {
for (int j = 0; j < numSteps; ++j) {
++it;
if (it == buffer.end()) {
it = buffer.begin();
}
}
++it;
buffer.insert(it, i);
--it;
if (i % 500000 == 0) {
std::cout << i / 500000 << "%\n";
}
}
++it;
#ifndef AOC_PART2
if (it == buffer.end()) {
it = buffer.begin();
}
#else
// For the second part, you need the value after 0. This will ALWAYS be the second element in
// buffer.
it = buffer.begin();
++it;
#endif
return *it;
}
|
75ad315b0eb162fcb1a5ed8318ef55b74f67186a
|
7218e2cb963d24113e5fee86b86b6ecfc01b8710
|
/GameCamp2016aki/Title.cpp
|
007792db2f5a8c6e45987fc5e34fecdd0b9e5ffc
|
[] |
no_license
|
GamaCamp/GameCampTeam1
|
76f75543d8defc8445eca962bd6743b2ddf3cfdc
|
3aebcb96e876a1606fad79275ba428e1fdbb5d55
|
refs/heads/master
| 2021-05-04T01:02:46.938764
| 2016-10-18T09:49:27
| 2016-10-18T09:49:27
| 71,112,907
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 41
|
cpp
|
Title.cpp
|
#include "Title.h"
#include "common.h"
|
a1d9caaf18525e54614225f1b5f4bbf8edd27714
|
aea20bf993bcb7e0b8c5afbf036c6e072b282da2
|
/src/Settings.cpp
|
07045b80a3bf831f5ccc9cbad8219b11d8165d4a
|
[] |
no_license
|
WANGKuo6/TobiiGame
|
e99e804e75cb3379d71ae838af2133ae9bb96499
|
04db13aea789c74aaf6aca6fe1d50418b82c629d
|
refs/heads/main
| 2023-03-04T14:43:50.782168
| 2021-02-12T20:21:42
| 2021-02-12T20:21:42
| 338,420,363
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,505
|
cpp
|
Settings.cpp
|
#include "Settings.h"
#include "Constants.h"
#include "Utils.h"
core::Settings::Settings(Window *window, MusicManager *musicManager, CursorMovementManager *cmm, Config *config) :
SubMenu(window, musicManager, cmm, config, "Parametres") {
}
core::Settings::~Settings() {
}
void core::Settings::display(Game *game)
{
std::vector<core::fx::Label *> labels;
labels.push_back(new core::fx::Label(window_, "Musiques & Sons", 36, { 20,150 }, { 0x29, 0xb6, 0xf6, 0xFF }));
core::fx::Button enableMusicButton(window_, musicManager_, 1000, "Oui", 36, WHITE_COLOR, "ressources/buttonBackground.png", { window_->get_width() - 400, window_->get_height() - 145,150,70 });
core::fx::Button disableMusicButton(window_, musicManager_, 1000, "Non", 36, WHITE_COLOR, "ressources/buttonBackground.png", { window_->get_width() - 600, window_->get_height() - 145,150,70 });
if (config_->get_bool("music_default_enable", true)) {
enableMusicButton.setVisible(false);
disableMusicButton.setVisible(true);
}
else {
enableMusicButton.setVisible(true);
disableMusicButton.setVisible(false);
}
do {
cursorPosition = cmm_->get_cursor_position();
ExitButton.update(cursorPosition);
pageTitle.update(cursorPosition);
if (ExitButton.isButtonPressed() || inputManager->quitRequested()) {
logger_->info("Quit Settings screen");
break;
}
// Update buttons
enableMusicButton.update(cursorPosition);
disableMusicButton.update(cursorPosition);
if (enableMusicButton.isButtonPressed())
{
enableMusicButton.setVisible(false);
disableMusicButton.setVisible(true);
config_->set_bool("music_default_enable", true);
musicManager_->enable(true);
logger_->info("music_default_enable sets to {}", config_->get_bool("music_default_enable", true));
}
if (disableMusicButton.isButtonPressed())
{
enableMusicButton.setVisible(true);
disableMusicButton.setVisible(false);
config_->set_bool("music_default_enable", false);
musicManager_->enable(false);
logger_->info("music_default_enable sets to {}", config_->get_bool("music_default_enable", true));
}
// Update Labels
for (auto &label : labels) {
label->update(cursorPosition);
}
//Update gaze position
gaze_object.update(cursorPosition);
// update the window when all the texture are displayed
window_->update();
} while (true);
}
|
e6f70803d87a91403bded0eb268c125f732eb938
|
0b92557a16cdd9f0d78618a449f89ebef21e64ea
|
/P3/5.cpp
|
d13f54e8ea4d7b91a8e366d5b21ddc065609e0f4
|
[] |
no_license
|
clijiac/c--primer-pratice
|
0df30f99a6df8a6879425d3e8ea23e6892c7abb3
|
9bb1c3e967b172fdbd50bbe7671890a7066f7523
|
refs/heads/master
| 2021-01-25T08:43:31.061628
| 2012-08-23T09:50:00
| 2012-08-23T09:50:13
| 4,419,355
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 286
|
cpp
|
5.cpp
|
#include <iostream>
#include <string>
using std::cin;
using std::cout;
using std::endl;
using std::string;
int main()
{
string getline1 ,getword;
// while(getline(cin,getline1)){
// cout << getline1 << endl;
// }
while(cin >> getword){
cout << getword << endl;
}
return 0;
}
|
4745af971837263492fe59103caa7a77c0d7af6c
|
c2192b42b2326003683a33adefa25c3e7374daa1
|
/src/reference_t.cpp
|
a33b5c3fe00c7d7cd158056a9e9a992c02bebd71
|
[
"MIT"
] |
permissive
|
masscry/deci.vm
|
0e2ed883167a2a666ce375a9e0d90165595f66ff
|
e2126b6592f798b919de6219c32cbcc41f980e98
|
refs/heads/develop
| 2020-06-06T12:47:17.629507
| 2019-07-11T17:48:05
| 2019-07-11T17:48:05
| 192,744,102
| 12
| 1
|
MIT
| 2019-07-11T11:31:52
| 2019-06-19T14:03:33
|
C++
|
UTF-8
|
C++
| false
| false
| 837
|
cpp
|
reference_t.cpp
|
#include <deci.hpp>
namespace deci {
reference_t* reference_t::Create(value_t* ref) {
reference_t* result = new reference_t(ref);
result->refCount = 1;
return result;
}
value_t* reference_t::Release() {
value_t* result = this->ref;
this->ref = nothing_t::Instance().Copy();
return result;
}
void reference_t::Capture(value_t* newRef) {
this->Release()->Delete();
this->ref = newRef;
}
value_t::type_t reference_t::Type() const {
return value_t::REFERENCE;
}
value_t* reference_t::Copy() const {
++this->refCount;
return const_cast<reference_t*>(this);
}
void reference_t::Delete() {
--this->refCount;
if (this->refCount <= 0) {
delete this;
}
}
std::string reference_t::ToText() const {
return std::string("deci::reference_t");
}
}
|
ec0b66ddefa3ea1c57c61383067dd30645232710
|
656853d6def3b4a78ad371af62f93eaa61f40b9a
|
/include/smtl/select.h
|
64c5c7f9f4491d8c3eb3ad248296f0e4c2c4b60b
|
[] |
no_license
|
mikenz1000/smtl
|
27927b281ededd3f232952c0b4b840e090ac75b7
|
db2141b203f36c122dcaffc19fe8def8ed5608cb
|
refs/heads/master
| 2023-07-11T07:46:45.835079
| 2021-08-22T20:40:56
| 2021-08-22T20:40:56
| 398,792,543
| 0
| 0
| null | 2021-08-22T20:21:18
| 2021-08-22T12:18:27
|
C++
|
UTF-8
|
C++
| false
| false
| 666
|
h
|
select.h
|
#ifndef SMTL_SELECT_H
#define SMTL_SELECT_H
#include "vector.h"
namespace smtl {
template<typename Input, typename op, typename Output=vector<>>
struct select;
template<typename T, T first, T... rest, typename op, T... output>
struct select<vector<first, rest...>, op, vector<output...>>
{
using value = typename select<vector<rest...>,
op, vector<output...,
op::template apply<first>::value
>
>::value;
};
// terminator
template<typename T, typename op, T... output>
struct select<vector<>, op, vector<output...>>
{
using value = vector<output...>;
};
}
#endif //SMTL_SELECT_H
|
c470d6dd6ff2dee1d3054838be591af72c3cf628
|
82886b905471c08a2890d1063676f332b1ac3508
|
/test/kernels/bitwise_not_test.cc
|
6c28c9554d4e21506b2723c1d7121b7ebc74ce9a
|
[
"MIT",
"BSL-1.0"
] |
permissive
|
kpu/intgemm
|
7a125b794ff2f300174994bd4f507b18293544e2
|
f7401513da71758dacce52fed1c7855549abee59
|
refs/heads/master
| 2023-08-24T20:48:47.425081
| 2023-08-10T15:19:16
| 2023-08-10T15:19:16
| 132,884,342
| 54
| 19
|
NOASSERTION
| 2023-01-20T11:14:17
| 2018-05-10T10:18:13
|
C++
|
UTF-8
|
C++
| false
| false
| 1,264
|
cc
|
bitwise_not_test.cc
|
#include "../test.h"
#include "../../intgemm/aligned.h"
#include "../../intgemm/kernels.h"
#include <cstdlib>
#include <numeric>
namespace intgemm {
template <CPUType CPUType_>
void kernel_bitwise_not_test() {
if (kCPU < CPUType_)
return;
using vec_t = vector_t<CPUType_, int>;
constexpr static std::size_t VECTOR_LENGTH = sizeof(vec_t) / sizeof(int);
AlignedVector<int> input(VECTOR_LENGTH);
AlignedVector<int> output(VECTOR_LENGTH);
std::iota(input.begin(), input.end(), 0);
*output.template as<vec_t>() = kernels::bitwise_not(*input.template as<vec_t>());
for (std::size_t i = 0; i < output.size(); ++i)
CHECK(output[i] == ~input[i]);
}
template INTGEMM_SSE2 void kernel_bitwise_not_test<CPUType::SSE2>();
KERNEL_TEST_CASE("bitwise_not SSE2") { return kernel_bitwise_not_test<CPUType::SSE2>(); }
#ifdef INTGEMM_COMPILER_SUPPORTS_AVX2
template INTGEMM_AVX2 void kernel_bitwise_not_test<CPUType::AVX2>();
KERNEL_TEST_CASE("bitwise_not AVX2") { return kernel_bitwise_not_test<CPUType::AVX2>(); }
#endif
#ifdef INTGEMM_COMPILER_SUPPORTS_AVX512BW
template INTGEMM_AVX512BW void kernel_bitwise_not_test<CPUType::AVX512BW>();
KERNEL_TEST_CASE("bitwise_not AVX512BW") { return kernel_bitwise_not_test<CPUType::AVX512BW>(); }
#endif
}
|
cb7dcf2efcbd525052dffc19807c4c4058619f04
|
82fbda2866a2e5e1d2426f74987eb736c87aab89
|
/lab3sol/lab3sol/pieces.h
|
8c0b9b12d7c88b71e266085d9d137f6f76499fb3
|
[] |
no_license
|
quinnwai/tic-tac-toe
|
311ef177289c019e8f1f90ec052a8fa9ea974bde
|
214764ba60a5b9f21749bcd2c98f40c1004d3614
|
refs/heads/master
| 2023-01-06T23:00:20.907642
| 2020-11-09T04:33:52
| 2020-11-09T04:33:52
| 311,223,519
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 508
|
h
|
pieces.h
|
/*pieces.h
Author: Quinn Wai Wong
Email: qwong@wustl.edu
Purpose: setup for relevant game information for the game pieces
Note: I chose to leave the color variable within the game_pieces class just in case this code is needed for future labs
*/
#pragma once
#include<string>
/*struct game_piece holds relevant variables (name and display name) and two constructors
*/
struct game_piece {
std::string name_;
std::string display_;
game_piece();
game_piece(std::string name, std::string display);
};
|
3cc01a1c5843cce62f47ba93fed05fc5e2b7dde8
|
a92b18defb50c5d1118a11bc364f17b148312028
|
/src/prod/src/api/wrappers/ComProxyFaultAnalysisService.h
|
ea4f8b0e257c639846fdb85f8a2288f59055e523
|
[
"MIT"
] |
permissive
|
KDSBest/service-fabric
|
34694e150fde662286e25f048fb763c97606382e
|
fe61c45b15a30fb089ad891c68c893b3a976e404
|
refs/heads/master
| 2023-01-28T23:19:25.040275
| 2020-11-30T11:11:58
| 2020-11-30T11:11:58
| 301,365,601
| 1
| 0
|
MIT
| 2020-11-30T11:11:59
| 2020-10-05T10:05:53
| null |
UTF-8
|
C++
| false
| false
| 7,788
|
h
|
ComProxyFaultAnalysisService.h
|
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------
#pragma once
namespace Api
{
class ComProxyFaultAnalysisService :
public ComProxySystemServiceBase<IFabricFaultAnalysisService>,
public IFaultAnalysisService
{
DENY_COPY(ComProxyFaultAnalysisService);
public:
ComProxyFaultAnalysisService(Common::ComPointer<IFabricFaultAnalysisService> const & comImpl);
virtual ~ComProxyFaultAnalysisService();
virtual Common::AsyncOperationSPtr BeginStartPartitionDataLoss(
FABRIC_START_PARTITION_DATA_LOSS_DESCRIPTION * invokeDataLossDescription,
Common::TimeSpan const,
Common::AsyncCallback const &,
Common::AsyncOperationSPtr const &);
virtual Common::ErrorCode EndStartPartitionDataLoss(
Common::AsyncOperationSPtr const & asyncOperation);
virtual Common::AsyncOperationSPtr BeginGetPartitionDataLossProgress(
FABRIC_TEST_COMMAND_OPERATION_ID operationId,
Common::TimeSpan const,
Common::AsyncCallback const &,
Common::AsyncOperationSPtr const &);
virtual Common::ErrorCode EndGetPartitionDataLossProgress(
Common::AsyncOperationSPtr const & asyncOperation,
IFabricPartitionDataLossProgressResult ** reply);
virtual Common::AsyncOperationSPtr BeginStartPartitionQuorumLoss(
FABRIC_START_PARTITION_QUORUM_LOSS_DESCRIPTION * invokeQuorumLossDescription,
Common::TimeSpan const,
Common::AsyncCallback const &,
Common::AsyncOperationSPtr const &);
virtual Common::ErrorCode EndStartPartitionQuorumLoss(
Common::AsyncOperationSPtr const & asyncOperation);
virtual Common::AsyncOperationSPtr BeginGetPartitionQuorumLossProgress(
FABRIC_TEST_COMMAND_OPERATION_ID operationId,
Common::TimeSpan const,
Common::AsyncCallback const &,
Common::AsyncOperationSPtr const &);
virtual Common::ErrorCode EndGetPartitionQuorumLossProgress(
Common::AsyncOperationSPtr const & asyncOperation,
IFabricPartitionQuorumLossProgressResult ** reply);
virtual Common::AsyncOperationSPtr BeginStartPartitionRestart(
FABRIC_START_PARTITION_RESTART_DESCRIPTION * restartPartitionDescription,
Common::TimeSpan const,
Common::AsyncCallback const &,
Common::AsyncOperationSPtr const &);
virtual Common::ErrorCode EndStartPartitionRestart(
Common::AsyncOperationSPtr const & asyncOperation);
virtual Common::AsyncOperationSPtr BeginGetPartitionRestartProgress(
FABRIC_TEST_COMMAND_OPERATION_ID operationId,
Common::TimeSpan const,
Common::AsyncCallback const &,
Common::AsyncOperationSPtr const &);
virtual Common::ErrorCode EndGetPartitionRestartProgress(
Common::AsyncOperationSPtr const & asyncOperation,
IFabricPartitionRestartProgressResult ** reply);
virtual Common::AsyncOperationSPtr BeginGetTestCommandStatusList(
FABRIC_TEST_COMMAND_LIST_DESCRIPTION * description,
Common::TimeSpan const,
Common::AsyncCallback const &,
Common::AsyncOperationSPtr const &);
virtual Common::ErrorCode EndGetTestCommandStatusList(
Common::AsyncOperationSPtr const & asyncOperation,
IFabricTestCommandStatusResult ** reply);
virtual Common::AsyncOperationSPtr BeginCancelTestCommand(
FABRIC_CANCEL_TEST_COMMAND_DESCRIPTION* description,
Common::TimeSpan const,
Common::AsyncCallback const &,
Common::AsyncOperationSPtr const &);
virtual Common::ErrorCode EndCancelTestCommand(
Common::AsyncOperationSPtr const & asyncOperation);
virtual Common::AsyncOperationSPtr BeginStartChaos(
FABRIC_START_CHAOS_DESCRIPTION * startChaosDescription,
Common::TimeSpan const,
Common::AsyncCallback const &,
Common::AsyncOperationSPtr const &);
virtual Common::ErrorCode EndStartChaos(
Common::AsyncOperationSPtr const & asyncOperation);
virtual Common::AsyncOperationSPtr BeginStopChaos(
Common::TimeSpan const,
Common::AsyncCallback const &,
Common::AsyncOperationSPtr const &);
virtual Common::ErrorCode EndStopChaos(
Common::AsyncOperationSPtr const & asyncOperation);
virtual Common::AsyncOperationSPtr BeginGetChaosReport(
FABRIC_GET_CHAOS_REPORT_DESCRIPTION * description,
Common::TimeSpan const,
Common::AsyncCallback const &,
Common::AsyncOperationSPtr const &);
virtual Common::ErrorCode EndGetChaosReport(
Common::AsyncOperationSPtr const & asyncOperation,
IFabricChaosReportResult ** reply);
virtual Common::AsyncOperationSPtr ComProxyFaultAnalysisService::BeginGetStoppedNodeList(
Common::TimeSpan const timeout,
Common::AsyncCallback const & callback,
Common::AsyncOperationSPtr const & parent);
virtual Common::ErrorCode ComProxyFaultAnalysisService::EndGetStoppedNodeList(
Common::AsyncOperationSPtr const & asyncOperation,
std::wstring & reply);
virtual Common::AsyncOperationSPtr ComProxyFaultAnalysisService::BeginStartNodeTransition(
FABRIC_NODE_TRANSITION_DESCRIPTION* description,
Common::TimeSpan const timeout,
Common::AsyncCallback const & callback,
Common::AsyncOperationSPtr const & parent);
virtual Common::ErrorCode ComProxyFaultAnalysisService::EndStartNodeTransition(
Common::AsyncOperationSPtr const & asyncOperation);
virtual Common::AsyncOperationSPtr BeginGetNodeTransitionProgress(
FABRIC_TEST_COMMAND_OPERATION_ID operationId,
Common::TimeSpan const timeout,
Common::AsyncCallback const & callback,
Common::AsyncOperationSPtr const & parent);
virtual Common::ErrorCode ComProxyFaultAnalysisService::EndGetNodeTransitionProgress(
Common::AsyncOperationSPtr const & asyncOperation,
IFabricNodeTransitionProgressResult ** reply);
// SystemServiceCall
virtual Common::AsyncOperationSPtr BeginCallSystemService(
std::wstring const & action,
std::wstring const & inputBlob,
Common::TimeSpan const timeout,
Common::AsyncCallback const & callback,
Common::AsyncOperationSPtr const & parent);
virtual Common::ErrorCode EndCallSystemService(
Common::AsyncOperationSPtr const & asyncOperation,
__inout std::wstring & outputBlob);
private:
class InvokeDataLossAsyncOperation;
class GetInvokeDataLossProgressAsyncOperation;
class InvokeQuorumLossAsyncOperation;
class GetInvokeQuorumLossProgressAsyncOperation;
class RestartPartitionAsyncOperation;
class GetRestartPartitionProgressAsyncOperation;
class GetTestCommandStatusAsyncOperation;
class CancelTestCommandAsyncOperation;
class GetStoppedNodeListAsyncOperation;
class StartNodeTransitionAsyncOperation;
class GetNodeTransitionProgressAsyncOperation;
class StartChaosAsyncOperation;
class StopChaosAsyncOperation;
class GetChaosReportAsyncOperation;
};
}
|
86db5693dbfa315502cb7fcb193ffcb982c31c11
|
d313a67d684103b0ee7058c63a304c1b975abc0f
|
/open64/osprey1.0/be/region/region_bounds.cxx
|
4a81d6d554bcf8393f173a179933d8e0b02eaf94
|
[
"BSD-2-Clause"
] |
permissive
|
xusx595/upc
|
0bbef930d0f76926f049a034ba8d8e851559d0d1
|
e17f40219d8594ab6bd281b2ff36d542798deac5
|
refs/heads/master
| 2021-01-17T05:28:28.941066
| 2015-03-22T21:39:40
| 2015-03-22T21:39:40
| 32,696,839
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 24,497
|
cxx
|
region_bounds.cxx
|
/*
Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2 of the GNU General Public License as
published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU General Public License along
with this program; if not, write the Free Software Foundation, Inc., 59
Temple Place - Suite 330, Boston MA 02111-1307, USA.
Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
//-*-c++-*-
//============================================================================
//
// Module: region_bounds.cxx
// $Revision: 1.2 $
// $Date: 2005/08/16 20:31:12 $
// $Author: wychen $
// $Source: bitbucket.org:berkeleylab/upc-translator.git/open64/osprey1.0/be/region/region_bounds.cxx $
//
// Revision history:
// 1-MAY-97 dahl - Original Version
//
// Description:
// 1) Generate a conservative boundary set for a region when MainOpt is not
// run. This allows CG to be debugged separately. Called when command
// line options are: -O2 -PHASE:w=0 or -O0 -CG:opt=2
//
// 2) Generate a conservative boundary set when Preopt is run over the
// entire PU (LNO's Preopt). This is for: -PHASE:p or -O3 -PHASE:w=0
// It is basically the same code as for 1) except we do it on the CODEREP
// form.
//
// Algorithm:
// Recursively descend the WHIRL/CODEREP tree looking for STs within the
// region. Enter these variables and pregs on the boundary lists.
//
// REGION_BOUND is just a wrapper for the routines, the trace flag, and
// the alias manager pointer.
//
// REGION_search_preg_set() searches the preg-in and preg-out sets.
//
//============================================================================
#define region_bounds_CXX "region_bounds.cxx"
#ifdef _KEEP_RCS_ID
static char *rcs_id = region_bounds_CXX"$Revision: 1.2 $";
#endif /* _KEEP_RCS_ID */
#include "wn.h" // WN type
#include "wn_util.h" // wn accessors
#include "ir_reader.h" // for fdump_tree
#include "region_util.h" // RID structure
#include "tracing.h" // TFile
#include "opt_main.h" // COMP_UNIT
#include "opt_cfg.h" // CFG
#include "opt_alias_rule.h" // ALIAS_RULE
#include "pragma_weak.h" // pragma weak
#include "opt_points_to.h" // Is_nested_call
#include "region_alias_templates.h" // REGION_search_set
#include "data_layout.h" // Get_ST_formal_preg_num
//============================================================================
// class to hold a couple variables global to traversal
class REGION_BOUND {
private:
BOOL _trace; // trace flag is set by constructor
ALIAS_MANAGER *_alias_mgr; // am for POINTS_TO
POINTS_TO *_all_alias_pt; // "once size fits all" POINTS_TO
STACK<RID *> _rstack; // stack of RIDs from root to current RID
// RGNs with boundary sets only
void Push(RID *rid) { _rstack.Push(rid); }
RID *Pop(void) { return _rstack.Pop(); }
BOOL Is_Empty(void) { return _rstack.Is_Empty(); }
RID *Top(void) { return _rstack.Top(); }
ALIAS_MANAGER *Am(void) { return _alias_mgr; }
POINTS_TO *All_alias_pt(void) { return _all_alias_pt; }
void Set_all_alias_pt(POINTS_TO *pt) { _all_alias_pt = pt; }
BOOL is_global(ST *);
void GRB_merge_var(RID *, WN *);
void GRB_merge_preg(RID *, WN *);
void GRB_formal_ref(RID *, ST *, TY_IDX); // formal refs only
void GRB_merge_preg(RID *, PREG_NUM, ST *); // in-set only (formal ref)
void GRB_merge_var(RID *, ST *, TY_IDX); // in-set only (formal ref)
void Propagate_boundary_up(RID *);
void Convert_ST_list(RID *, WN *); // for barrier calls
public:
REGION_BOUND(ALIAS_MANAGER *alias_mgr, MEM_POOL *pool) :
_alias_mgr(alias_mgr), _rstack(pool) {
// -O0 -CG:opt=2 or -O2 -PHASE:p ==> it is a CG or boundary problem
_trace = Get_Trace(TP_REGION, TT_REGION_CG_DEBUG) ||
Get_Trace(TP_REGION, TT_REGION_BOUND_DEBUG);
_all_alias_pt = NULL;
_rstack.Clear();
Is_True(_alias_mgr != NULL,
("REGION_BOUND::REGION_BOUND alias manager is NULL"));
}
~REGION_BOUND(void) { }
BOOL Trace(void) { return _trace; }
void grb(WN *); // recursive traversal of WHIRL
void prune(RID *); // traverse RID tree and cleanup
};
// decide if a symbol is global or not
inline BOOL
REGION_BOUND::is_global(ST *st)
{
switch (ST_sclass(st)) {
case SCLASS_PSTATIC:
case SCLASS_FSTATIC:
case SCLASS_COMMON:
case SCLASS_EXTERN:
case SCLASS_UGLOBAL:
case SCLASS_DGLOBAL:
return TRUE;
default:
return FALSE;
}
}
// Add a preg to the boundary set.
// Optimization: if all occurrences of a preg are LDIDs, it can
// be kept of out the live_out set.
void
REGION_BOUND::GRB_merge_preg(RID *rid, WN *wn)
{
ST *st = WN_st(wn);
// load_offset and store_offset are unioned
WN_OFFSET off = WN_load_offset(wn);
// REGION_add_preg_* checks for duplicates, creates one from
// the region pool if needed, returns TRUE if it did something
BOOL added = REGION_add_preg_in(rid, off, ST_btype(st));
Is_True(WN_operator(wn) == OPR_STID || WN_operator(wn) == OPR_LDID,
("REGION_BOUND::GRB_merge_preg, unknown operator"));
BOOL is_stid = (WN_operator(wn) == OPR_STID);
// LDID: only add to used_in set
if (is_stid) {
// added: time-saver, we have to try to add to live-out set regardless
// of if it was added to live-in set (e.g. LDIDs followed by STID, it
// is already in the live-in set but we need to try to add to live out
// once we hit the STID. Save time though if STID is not added, don't
// try rest of exits.
added = TRUE;
for (INT i=0; i<RID_num_exits(rid) && added; i++)
added = REGION_add_preg_out(rid, i, off, ST_btype(st));
}
Is_Trace(Trace() && added, (TFile,"REGION_BOUND::GRB_merge_preg, RGN %d, "
"adding %s %d\n",RID_id(rid),ST_name(st),off));
}
//---------------------------------------------------------------------------
// the next three subroutines are for formal-refs
// This is used for f77 formal refs, LDID, STID, or LDA
// add either a preg or a temporary stack location to the live-in sets
inline void
REGION_BOUND::GRB_formal_ref(RID *rid, ST *st, TY_IDX ty)
{
Is_True(st != NULL, ("REGION_BOUND::GRB_formal_ref, NULL ST"));
if (ST_sclass(st) == SCLASS_FORMAL_REF) {
ST *base = Get_ST_formal_ref_base(st);
Is_True(base != NULL,
("REGION_BOUND::GRB_formal_ref, no base for formal ref"));
PREG_NUM preg = Get_ST_formal_preg_num(base);
if (preg != 0) // add a preg
GRB_merge_preg(rid, preg, base);
else // add a temp stack location
GRB_merge_var(rid, st, ty);
}
}
// This is used for f77 formal refs only which are read-only so no need
// to put in live-out set.
void
REGION_BOUND::GRB_merge_preg(RID *rid, PREG_NUM pr, ST *st)
{
// REGION_add_preg_* checks for duplicates, creates one from
// the region pool if needed, returns TRUE if it did something
BOOL added = REGION_add_preg_in(rid, pr, MTYPE_V);
Is_Trace(Trace() && added, (TFile,"REGION_BOUND::GRB_merge_preg2, RGN %d, "
"adding %s %d\n", RID_id(rid), ST_name(st), pr));
}
// Add a variable to the live_in boundary set, don't have WHIRL
// used for formal_refs, searches for duplicates
void
REGION_BOUND::GRB_merge_var(RID *rid, ST *st, TY_IDX ty)
{
Is_True(st != NULL, ("REGION_BOUND::GRB_merge_var2, NULL ST"));
Is_True(ty != (TY_IDX) 0, ("REGION_BOUND::GRB_merge_var2, NULL TY"));
// create points_to and add to live-in set
POINTS_TO pt;
INT64 size = TY_size(ty);
Is_True(size != 0,
("REGION_BOUND::GRB_merge_var2, ST size is wrong"));
pt.Analyze_ST(st, 0/*offset*/, size, 0, 0,
ty, FALSE/*assume has no equiv*/);
// first search for duplicates
if (!REGION_search_set(RID_used_in(rid),
comp_same_pt(&pt, Am()->Rule()))) {
REGION_add_points_to(&RID_used_in(rid), &pt, Am());
Is_Trace(Trace(), (TFile,"REGION_BOUND::GRB_merge_var2, RGN %d, "
"adding %s\n", RID_id(rid), ST_name(st)));
}
}
//---------------------------------------------------------------------------
// POINTS_TO::Meet()
#pragma weak Meet__9POINTS_TOGPC9POINTS_TOP2ST
// Add a variable to the boundary set.
// Optimization: if all occurrences of a variable are LDIDs, it can
// be kept of out the live_out set.
// This routine handles LDID/STID only. The tricky part is adding to
// a set but avoiding duplicates.
void
REGION_BOUND::GRB_merge_var(RID *rid, WN *wn)
{
Is_True(Am() != NULL, ("REGION_BOUNDS:GRB_merge_var(), NULL alias manager"));
// first scan live-in set for duplicates, if none, add to it
POINTS_TO pt;
pt.Analyze_WN_expr(wn);
// for LDID, search live in set, it may not be in live out set (no STID yet)
// for STID, it may only have been put in live in set last time (only have
// seen LDIDs so far), so check live out set
Is_True(WN_operator(wn) == OPR_STID || WN_operator(wn) == OPR_LDID,
("REGION_BOUND::GRB_merge_var, unknown operator"));
BOOL is_stid = (WN_operator(wn) == OPR_STID);
BOOL added = FALSE;
// load or store
if (!REGION_search_set(RID_used_in(rid),
comp_same_pt(&pt, Am()->Rule()))) {
REGION_add_wn_points_to(&RID_used_in(rid), wn, Am());
added = TRUE;
}
// store only
if (is_stid && !REGION_search_set(RID_def_in_live_out(rid),
comp_same_pt(&pt, Am()->Rule()))) {
REGION_add_wn_points_to(&RID_def_in_live_out(rid), wn, Am());
added = TRUE;
}
Is_Trace(Trace() && added, (TFile,"REGION_BOUND::GRB_merge_var, RGN %d, "
"added variable %s to %s\n", RID_id(rid), ST_name(WN_st(wn)),
is_stid ? "in/out sets" : "in set"));
}
// Once a region's boundary set is found, we need to propagate this
// information up the RID tree. The tricky part is that the enclosing
// region may be transparent and so we need to go to the enclosing
// region with a boundary, that is what the stack is for.
// We only need to propagate up one level because when the enclosing
// region is finished it will call this routine also. The parent
// region may have boundaries from sibling regions or its own code
// so need to merge and check for duplicates.
void
REGION_BOUND::Propagate_boundary_up(RID *rid)
{
if ( !Is_Empty() ) {
Is_True(rid != Top(),
("REGION_BOUND::Propagate_boundary_up, TOS is same as rid"));
Is_True(RID_bounds_exist(rid) == REGION_BOUND_EXISTS,
("REGION_BOUND::Propagate_boundary_up, bounds do not exist"));
Is_Trace(Trace(), (TFile,"Propagate up: RGN %d to RGN %d\n",
RID_id(rid), RID_id(Top())));
// variables in/out
for (POINTS_TO_SET *ptmp=RID_used_in(rid); ptmp; ptmp=ptmp->Next) {
if (!REGION_search_set(RID_used_in(Top()),
comp_same_pt(ptmp->Pt, Am()->Rule()))) {
// does not check for duplicates
REGION_add_points_to(&RID_used_in(Top()), ptmp->Pt, Am());
REGION_add_points_to(&RID_def_in_live_out(Top()), ptmp->Pt, Am());
}
}
// pregs in
PREG_LIST *ptmp2;
for (ptmp2=RID_pregs_in(rid); ptmp2;
ptmp2=PREG_LIST_rest(ptmp2)) {
PREG_NUM pr = PREG_LIST_first(ptmp2);
// check for quad and complex quad, avoid duplicates
TYPE_ID type = MTYPE_V;
if (REGION_search_preg_set(RID_pregs_quad(rid), pr))
type = MTYPE_FQ;
else if (REGION_search_preg_set(RID_pregs_complex_quad(rid), pr))
type = MTYPE_CQ;
// add to in-set of enclosing non-transparent region
REGION_add_preg_in(Top(), pr, type);
}
// pregs out, slow but accurate
for (INT32 j=0; j<RID_num_exits(rid); j++) {
for (ptmp2=RID_pregs_out_i(rid, j); ptmp2;
ptmp2=PREG_LIST_rest(ptmp2)) {
PREG_NUM pr = PREG_LIST_first(ptmp2);
// check for quad and complex quad, avoid duplicates
TYPE_ID type = MTYPE_V;
if (REGION_search_preg_set(RID_pregs_quad(rid), pr))
type = MTYPE_FQ;
else if (REGION_search_preg_set(RID_pregs_complex_quad(rid), pr))
type = MTYPE_CQ;
// add to all exits in enclosing non-transparent region
for (INT32 i=0; i<RID_num_exits(Top()); i++)
REGION_add_preg_out(Top(), i, pr, type);
}
}
}
}
// Convert ST list of barrier call to POINTS_TOs
// two cases:
// 1) nested call has list of STs. Convert these to POINTS_TOs and
// add to boundary sets
// 2) nested call has no list, set contains_barrier bit
void
REGION_BOUND::Convert_ST_list(RID *rid, WN *wn)
{
Is_True(WN_opcode(wn) == OPC_FORWARD_BARRIER ||
WN_opcode(wn) == OPC_BACKWARD_BARRIER,
("REGION_BOUND::Convert_ST_list, not a barrier"));
// based on OPT_STAB::Create_barrier_defs
if (WN_kid_count(wn) == 0)
RID_contains_barrier(rid) = TRUE;
else {
for (INT i=0; i<WN_kid_count(wn); i++) {
// create pt for each st in the barrier
ST *st = WN_st(WN_kid(wn, i));
Is_True(ST_class (st) == CLASS_VAR,
("OPT_STAB::Create_barrier_defs: barrier contains non-var ST"));
POINTS_TO pt;
Is_True(ST_sclass(st) != SCLASS_UNKNOWN,(""));
INT64 ofst = 0;
TY& ty = Ty_Table[ST_type (st)];
INT64 size = TY_size (ty);
pt.Analyze_ST(st, ofst, size, 0, 0, ST_type(st), TRUE/*assume has equiv*/);
// see if that pt is in the set already
if (!REGION_search_set(RID_used_in(rid),
comp_same_pt(&pt, Am()->Rule()))) {
REGION_add_points_to(&RID_used_in(rid), &pt, Am());
Is_True(REGION_search_set(RID_def_in_live_out(rid),
comp_same_pt(&pt, Am()->Rule())),
("REGION_BOUND::Convert_ST_list, pt not found in used_in "
"but in live_out"));
REGION_add_points_to(&RID_def_in_live_out(rid), &pt, Am());
}
}
}
}
// Recursive traversal of WHIRL/CODEREPs inside a region, looks for STs to
// put in boundary lists. Note: `node' is either a WN or CFG
void
REGION_BOUND::grb(WN *wn)
{
WN *wtmp;
RID *rid;
INT i;
BOOL push_rid = FALSE;
Is_True(wn != NULL, ("REGION_BOUND::grb NULL WN"));
// figure out what rid to use, cases:
// region with bounds - use rid associated with wn
// region with no bounds - use enclosing rid or NULL if no enclosing region
// not a region - use enclosing rid or NULL if no enclosing region
// The enclosing rid is really the enclosing rid that is not transparent.
if (WN_opcode(wn) == OPC_REGION) {
rid = REGION_get_rid(wn);
Is_True(rid != NULL, ("REGION_BOUND:grb, NULL RID"));
// if the region has no bounds (transparent) then use the enclosing rid
if (RID_TYPE_transparent(rid))
rid = (Is_Empty()) ? NULL : Top();
else
push_rid = TRUE; // region with bounds, push on stack
} else
rid = (Is_Empty()) ? NULL : Top();
switch (WN_operator(wn)) {
// grab the ST and add it to the appropriate boundary sets
// for all other load variants use default case and recurse down
// to LDID, STID, or LDA
case OPR_LDID:
case OPR_STID:
{ // we traverse loads and stores for non-transparent regions only
Is_True(rid != NULL && !RID_TYPE_transparent(rid),
("REGION_BOUND::grb, transparent rgn"));
ST *st = WN_st(wn);
Is_True(st != NULL, ("REGION_BOUND::grb, NULL ST"));
TY_IDX ty = WN_ty(wn);
Is_True(ty != (TY_IDX) 0, ("REGION_BOUND::grb, NULL TY"));
// This IF condition is tricky so compute the opposite which
// is easier to think about:
// 1) Don't have to worry about volatiles, they are always saved
BOOL cond = TY_is_volatile(ty);
// 2) No need to add to boundary set if global and
// already aliased to all globals
cond |= is_global(st) && RID_aliased_to_globals(rid);
if (!cond) {
// adds to both live-in and live-out sets, checks for duplicates
if (ST_class(st) == CLASS_PREG) { // add a preg
// don't add dedicated pregs at this point
if (WN_offset(wn) != 32 && WN_offset(wn) != 2) //PPP
GRB_merge_preg(rid, wn);
} else // add a variable
GRB_merge_var(rid, wn);
}
// handle scalar F77 params that will be split into a preg later
// during lower_to_cg
GRB_formal_ref(rid, st, ty);
// continue traversing down
for (i=0; i<WN_kid_count(wn); i++)
grb(WN_kid(wn,i));
}
break;
case OPR_LDA: // do nothing for RHS LDA, only look at LDA indirectly
// we traverse loads and stores for non-transparent regions only
Is_True(rid != NULL && !RID_TYPE_transparent(rid),
("REGION_BOUND::grb, transparent rgn"));
// handle scalar F77 params that will be split into a preg later
// during lower_to_cg
GRB_formal_ref(rid, WN_st(wn), WN_ty(wn));
break; // when processing ILOAD
case OPR_PARM:
case OPR_ILOAD:
case OPR_MLOAD:
case OPR_ILOADX:
case OPR_ISTORE:
case OPR_MSTORE:
case OPR_ISTOREX:
// we traverse loads and stores for non-transparent regions only
Is_True(rid != NULL && !RID_TYPE_transparent(rid),
("REGION_BOUND::grb, transparent rgn"));
{
POINTS_TO pt;
pt.Analyze_WN_expr(wn);
if (pt.Base_is_fixed() || pt.Restricted() || pt.Unique_pt() ||
pt.F_param()) {
// avoid duplicates
if (!REGION_search_set(RID_used_in(rid),
comp_same_pt(&pt, Am()->Rule()))) {
// conservative, should only add to in-set when load
REGION_add_points_to(&RID_used_in(rid), &pt, Am());
REGION_add_points_to(&RID_def_in_live_out(rid), &pt, Am());
}
} else
RID_aliased_to_indirects(rid) = TRUE;
}
// continue traversing down
for (i=0; i<WN_kid_count(wn); i++)
grb(WN_kid(wn,i));
break;
// ----- the cases below handle the recursive tree walk -----
case OPR_REGION: // skip pragma and exits blocks, no STs there
{ RID *rtmp;
// see if there is a reason to push a new rid on the stack
// and process its contents
if (push_rid) {
Is_True(rid != NULL && REGION_get_rid(wn) == rid &&
!RID_TYPE_transparent(rid),
("REGION_BOUND::grb, rid is wrong for region with bounds"));
Is_True(RID_rwn(REGION_get_rid(wn)) == wn,
("REGION_BOUND::grb, RID <-> WN inconsistency"));
// push this RID on the stack because it has a valid boundary set
Push(rid);
// go through each statement in the region body
for (wtmp=WN_first(WN_region_body(wn)); wtmp; wtmp=WN_next(wtmp))
grb(wtmp);
RID *rtmp2 = Pop();
Is_True(rtmp2 == rid, ("REGION_BOUND::grb, stack inconsistency"));
// whether we actually added to the boundary or not, it has been
// processed
RID_bounds_exist(rid) = REGION_BOUND_EXISTS;
RID_level(rid) = RL_RBI;
// transfer this region boundary information to parent regions
// that have boundaries
Propagate_boundary_up(rid);
} else {
// This region is transparent but if there is another region on
// the stack, we need to scan this region and account for the
// loads/stores to the region on the stack
if (rid != NULL) {
Is_True(rid == Top(),("REGION_BOUND::grb, rid != Top()"));
// go through each statement in the region body and use the stacked
// rid to find the appropriate boundary
for (wtmp=WN_first(WN_region_body(wn)); wtmp; wtmp=WN_next(wtmp))
grb(wtmp);
} else {
// Region is transparent and there is no region on the stack.
// If the region has no child regions, return.
// Otherwise skip to the next region and see if it has work to do.
rid = REGION_get_rid(wn); // rematerialize rid, we had it NULL
// so no one would add a bound to this
// transparent region.
Is_True(rid != NULL, ("REGION_BOUND:grb, NULL RID"));
Is_True(RID_TYPE_transparent(rid),
("REGION_BOUND::grb, region is not transparent"));
for (rtmp = RID_first_kid(rid); rtmp != NULL; rtmp=RID_next(rtmp))
grb(RID_rwn(rtmp));
}
}
}
break;
case OPR_FUNC_ENTRY:
{ RID *rtmp;
Is_True(rid == NULL, ("REGION_BOUND::grb, rid should be NULL here"));
rid = REGION_get_rid(wn);
Is_True(rid != NULL && RID_TYPE_func_entry(rid),
("REGION_BOUND::grb, rid messed up for func_entry"));
Is_Trace(Trace(),(TFile,"===== Generate_region_boundaries (GRB) %s\n",
ST_name(WN_st(wn))));
// Func_entries are transparent (there is no work to do at this level).
// If the PU has no regions, skip everything in this PU and return.
// Otherwise skip to the next region and see if it has work to do.
// We do have to scan all regions because there may be a region with
// boundaries hidden down in the tree.
for (rtmp = RID_first_kid(rid); rtmp != NULL; rtmp = RID_next(rtmp))
grb(RID_rwn(rtmp));
}
break;
case OPR_CALL: // mark all aliased bits on rid
RID_aliased_to_globals(rid) = TRUE;
RID_aliased_to_indirects(rid) = TRUE;
// Is_nested_call is a template that works with Mongoose stab
// or aux_stab. STAB_ADAPTER is from opt_points_to.h
if (Is_nested_call(wn, STAB_ADAPTER())) // opt_alias_analysis.cxx
RID_contains_uplevel(rid) = TRUE; // local vars that are really uplevel
// need to look at parameters because some may be locals
for (i=0; i<WN_kid_count(wn); i++) {
WN *wtmp2 = WN_kid(wn, i);
Is_True(WN_operator(wtmp2) == OPR_PARM,
("REGION_BOUND::grb, CALL sequence error"));
grb(wtmp2);
}
break;
case OPR_FORWARD_BARRIER:
case OPR_BACKWARD_BARRIER:
Convert_ST_list(rid, wn);
break;
case OPR_BLOCK:
for (wtmp=WN_first(wn); wtmp; wtmp=WN_next(wtmp))
grb(wtmp);
break;
default:
for (i=0; i<WN_kid_count(wn); i++)
grb(WN_kid(wn, i));
break;
} // switch
}
void
REGION_BOUND::prune(RID *rid)
{
Is_True(rid != NULL, ("REGION_BOUND::prune, NULL RID"));
Is_Trace(Trace(), (TFile, "REGION_BOUND::prune boundary sets called\n"));
// TODO:
// go through all sets that have boundaries and if the global bit is
// set take out the globals from the variable sets.
}
// Entry point for Generate_region_boundaries, called by be/be/driver.c.
//
// Algorithm (recursive: Generate_region_boundaries):
// scan the WHIRL tree and find all STs.
// for each ST:
// if it is a PREG, add to PREG lists
// if it is a variable, add to variable lists
//
// Requirements:
// requires that region_init has assigned RIDs to all the regions
// first because it uses the fact that a PU RID has a child or not
// to control the traversal. It also uses the RID tree to jump to
// the next WHIRL node that has work to do.
//
// This has the effect of producing a conservative boundary set.
// Note it is not too conservative because only the variables used/def'd
// in the region are added to the boundary set. This is important because
// we do not want variables that are used elsewhere in the PU but not in
// this region to be in the boundary set.
extern "C"
void Generate_region_boundaries(WN *wn, ALIAS_MANAGER *am)
{
Is_True(wn != NULL && WN_opcode(wn) == OPC_FUNC_ENTRY,
("Generate_region_boundaries, NULL WN or not a PU"));
RID *root_rid = REGION_get_rid(wn);
Is_True(root_rid != NULL && RID_TYPE_func_entry(root_rid),
("Generate_region_boundaries, invalid RID type"));
// recursive part, traverses WN tree looking for STs
REGION_BOUND rb(am, ®ION_mem_pool);
rb.grb(wn);
rb.prune(REGION_get_rid(wn));
Is_Trace(rb.Trace(),
(TFile,"Generate_region_boundaries (GRB) final sets:\n"));
Is_Trace_cmd(rb.Trace(), RID_set_print(TFile, root_rid));
}
// =======================================================================
// REGION_search_preg_set: search preg sets
// returns TRUE if a PREG is found in the set
// used to avoid duplicates in boundary sets
// NOTE: this involves linear search and should be improved
// (it is isolated here for your rewriting convenience)
extern "C" BOOL REGION_search_preg_set(PREG_LIST *pset, PREG_NUM pr)
{
PREG_LIST *ptmp;
for (ptmp = pset; ptmp; ptmp = PREG_LIST_rest(ptmp)) {
if (pr == PREG_LIST_first(ptmp))
return TRUE;
}
return FALSE;
}
|
08ef26fc14e67dae2ccd4d65e7fd764e1d180a61
|
93ec41975160e6123d37bdac68ab73ce518545e2
|
/iris/shader.cc
|
a6ca02c993bc57c78c417d52ce0b12a7fe322be7
|
[
"NIST-PD"
] |
permissive
|
usnistgov/hevx
|
97bdb6ac9e7a622216c87e0c70cc5d85905e01c1
|
c2dd2a0c49516ba67cdc04ab36ffe49bbeba776c
|
refs/heads/master
| 2020-03-27T11:35:45.084025
| 2019-09-18T14:19:43
| 2019-09-18T14:19:43
| 146,496,983
| 11
| 2
|
NOASSERTION
| 2019-03-09T21:40:17
| 2018-08-28T19:29:10
|
C++
|
UTF-8
|
C++
| false
| false
| 14,515
|
cc
|
shader.cc
|
#include "shader.h"
#include "config.h"
#include "error.h"
#include "io/read_file.h"
#include "logging.h"
#include "renderer_private.h"
#if PLATFORM_COMPILER_GCC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif
#include "SPIRV/GLSL.std.450.h"
#include "SPIRV/GlslangToSpv.h"
#include "glslang/Public/ShaderLang.h"
#if PLATFORM_COMPILER_GCC
#pragma GCC diagnostic pop
#endif
#include <fstream>
namespace iris {
using namespace std::string_literals;
static const TBuiltInResource DefaultTBuiltInResource = {
/* .MaxLights = */ 32,
/* .MaxClipPlanes = */ 6,
/* .MaxTextureUnits = */ 32,
/* .MaxTextureCoords = */ 32,
/* .MaxVertexAttribs = */ 64,
/* .MaxVertexUniformComponents = */ 4096,
/* .MaxVaryingFloats = */ 64,
/* .MaxVertexTextureImageUnits = */ 32,
/* .MaxCombinedTextureImageUnits = */ 80,
/* .MaxTextureImageUnits = */ 32,
/* .MaxFragmentUniformComponents = */ 4096,
/* .MaxDrawBuffers = */ 32,
/* .MaxVertexUniformVectors = */ 128,
/* .MaxVaryingVectors = */ 8,
/* .MaxFragmentUniformVectors = */ 16,
/* .MaxVertexOutputVectors = */ 16,
/* .MaxFragmentInputVectors = */ 15,
/* .MinProgramTexelOffset = */ -8,
/* .MaxProgramTexelOffset = */ 7,
/* .MaxClipDistances = */ 8,
/* .MaxComputeWorkGroupCountX = */ 65535,
/* .MaxComputeWorkGroupCountY = */ 65535,
/* .MaxComputeWorkGroupCountZ = */ 65535,
/* .MaxComputeWorkGroupSizeX = */ 1024,
/* .MaxComputeWorkGroupSizeY = */ 1024,
/* .MaxComputeWorkGroupSizeZ = */ 64,
/* .MaxComputeUniformComponents = */ 1024,
/* .MaxComputeTextureImageUnits = */ 16,
/* .MaxComputeImageUniforms = */ 8,
/* .MaxComputeAtomicCounters = */ 8,
/* .MaxComputeAtomicCounterBuffers = */ 1,
/* .MaxVaryingComponents = */ 60,
/* .MaxVertexOutputComponents = */ 64,
/* .MaxGeometryInputComponents = */ 64,
/* .MaxGeometryOutputComponents = */ 128,
/* .MaxFragmentInputComponents = */ 128,
/* .MaxImageUnits = */ 8,
/* .MaxCombinedImageUnitsAndFragmentOutputs = */ 8,
/* .MaxCombinedShaderOutputResources = */ 8,
/* .MaxImageSamples = */ 0,
/* .MaxVertexImageUniforms = */ 0,
/* .MaxTessControlImageUniforms = */ 0,
/* .MaxTessEvaluationImageUniforms = */ 0,
/* .MaxGeometryImageUniforms = */ 0,
/* .MaxFragmentImageUniforms = */ 8,
/* .MaxCombinedImageUniforms = */ 8,
/* .MaxGeometryTextureImageUnits = */ 16,
/* .MaxGeometryOutputVertices = */ 256,
/* .MaxGeometryTotalOutputComponents = */ 1024,
/* .MaxGeometryUniformComponents = */ 1024,
/* .MaxGeometryVaryingComponents = */ 64,
/* .MaxTessControlInputComponents = */ 128,
/* .MaxTessControlOutputComponents = */ 128,
/* .MaxTessControlTextureImageUnits = */ 16,
/* .MaxTessControlUniformComponents = */ 1024,
/* .MaxTessControlTotalOutputComponents = */ 4096,
/* .MaxTessEvaluationInputComponents = */ 128,
/* .MaxTessEvaluationOutputComponents = */ 128,
/* .MaxTessEvaluationTextureImageUnits = */ 16,
/* .MaxTessEvaluationUniformComponents = */ 1024,
/* .MaxTessPatchComponents = */ 120,
/* .MaxPatchVertices = */ 32,
/* .MaxTessGenLevel = */ 64,
/* .MaxViewports = */ 16,
/* .MaxVertexAtomicCounters = */ 0,
/* .MaxTessControlAtomicCounters = */ 0,
/* .MaxTessEvaluationAtomicCounters = */ 0,
/* .MaxGeometryAtomicCounters = */ 0,
/* .MaxFragmentAtomicCounters = */ 8,
/* .MaxCombinedAtomicCounters = */ 8,
/* .MaxAtomicCounterBindings = */ 1,
/* .MaxVertexAtomicCounterBuffers = */ 0,
/* .MaxTessControlAtomicCounterBuffers = */ 0,
/* .MaxTessEvaluationAtomicCounterBuffers = */ 0,
/* .MaxGeometryAtomicCounterBuffers = */ 0,
/* .MaxFragmentAtomicCounterBuffers = */ 1,
/* .MaxCombinedAtomicCounterBuffers = */ 1,
/* .MaxAtomicCounterBufferSize = */ 16384,
/* .MaxTransformFeedbackBuffers = */ 4,
/* .MaxTransformFeedbackInterleavedComponents = */ 64,
/* .MaxCullDistances = */ 8,
/* .MaxCombinedClipAndCullDistances = */ 8,
/* .MaxSamples = */ 4,
/* .maxMeshOutputVerticesNV = */ 256,
/* .maxMeshOutputPrimitivesNV = */ 512,
/* .maxMeshWorkGroupSizeX_NV = */ 32,
/* .maxMeshWorkGroupSizeY_NV = */ 1,
/* .maxMeshWorkGroupSizeZ_NV = */ 1,
/* .maxTaskWorkGroupSizeX_NV = */ 32,
/* .maxTaskWorkGroupSizeY_NV = */ 1,
/* .maxTaskWorkGroupSizeZ_NV = */ 1,
/* .maxMeshViewCountNV = */ 4,
/* .limits = */
{
/* .nonInductiveForLoops = */ true,
/* .whileLoops = */ true,
/* .doWhileLoops = */ true,
/* .generalUniformIndexing = */ true,
/* .generalAttributeMatrixVectorIndexing = */ true,
/* .generalVaryingIndexing = */ true,
/* .generalSamplerIndexing = */ true,
/* .generalVariableIndexing = */ true,
/* .generalConstantMatrixVectorIndexing = */ true,
}};
class DirStackIncluder : public glslang::TShader::Includer {
public:
DirStackIncluder() = default;
virtual IncludeResult* includeLocal(char const* headerName,
char const* includerName,
std::size_t inclusionDepth) override {
return readLocalPath(headerName, includerName,
gsl::narrow_cast<int>(inclusionDepth));
}
virtual IncludeResult* includeSystem(char const* headerName,
char const* includerName,
std::size_t inclusionDepth) override {
IRIS_LOG_WARN("system headers are treated as local headers");
return readLocalPath(headerName, includerName,
gsl::narrow_cast<int>(inclusionDepth));
}
virtual void releaseInclude(IncludeResult* result) override {
if (result) {
delete[] static_cast<char*>(result->userData);
delete result;
}
}
virtual void pushExternalLocalDirectory(std::string const& dir) {
dirStack_.push_back(dir);
numExternalLocalDirs_ = gsl::narrow_cast<int>(dirStack_.size());
}
private:
std::vector<std::string> dirStack_{};
int numExternalLocalDirs_{0};
virtual IncludeResult* readLocalPath(std::string const& headerName,
std::string const& includerName,
int depth) {
// Discard popped include directories, and
// initialize when at parse-time first level.
dirStack_.resize(depth + numExternalLocalDirs_);
if (depth == 1) dirStack_.back() = getDirectory(includerName);
// Find a directory that works, using a reverse search of the include stack.
for (auto& dir : dirStack_) {
std::string path = absl::StrCat(dir, "/", headerName);
std::replace(path.begin(), path.end(), '\\', '/');
std::ifstream ifs(path.c_str());
if (ifs) {
ifs.ignore(std::numeric_limits<std::streamsize>::max());
std::streamsize length = ifs.gcount();
ifs.clear();
dirStack_.push_back(getDirectory(path));
return newIncludeResult(path, ifs, gsl::narrow_cast<int>(length));
}
}
return nullptr;
}
virtual IncludeResult* readSystemPath(char const* ) const {
IRIS_LOG_ERROR("including system headers not implemented");
return nullptr;
}
virtual IncludeResult* newIncludeResult(std::string const& path,
std::ifstream& ifs,
int length) const {
char* content = new char[length];
ifs.seekg(0, ifs.beg);
ifs.read(content, length);
return new IncludeResult(path.c_str(), content, length, content);
}
// If no path markers, return current working directory.
// Otherwise, strip file name and return path leading up to it.
virtual std::string getDirectory(const std::string path) const {
size_t last = path.find_last_of("/\\");
return last == std::string::npos ? "." : path.substr(0, last);
}
}; // class DirStackIncluder
[[nodiscard]] static expected<std::vector<std::uint32_t>, std::string>
CompileShader(std::string_view source, VkShaderStageFlagBits shaderStage,
std::filesystem::path const& path,
gsl::span<std::string> macroDefinitions [[maybe_unused]],
std::string const& entryPoint) {
IRIS_LOG_ENTER();
Expects(source.size() > 0);
auto const lang = [&shaderStage]() {
if ((shaderStage & VK_SHADER_STAGE_VERTEX_BIT)) {
return EShLanguage::EShLangVertex;
} else if ((shaderStage & VK_SHADER_STAGE_FRAGMENT_BIT)) {
return EShLanguage::EShLangFragment;
} else if ((shaderStage & VK_SHADER_STAGE_RAYGEN_BIT_NV)) {
return EShLanguage::EShLangRayGenNV;
} else if ((shaderStage & VK_SHADER_STAGE_ANY_HIT_BIT_NV)) {
return EShLanguage::EShLangAnyHitNV;
} else if ((shaderStage & VK_SHADER_STAGE_CLOSEST_HIT_BIT_NV)) {
return EShLanguage::EShLangClosestHitNV;
} else if ((shaderStage & VK_SHADER_STAGE_INTERSECTION_BIT_NV)) {
return EShLanguage::EShLangIntersectNV;
} else if ((shaderStage & VK_SHADER_STAGE_MISS_BIT_NV)) {
return EShLanguage::EShLangMissNV;
} else if ((shaderStage & VK_SHADER_STAGE_CALLABLE_BIT_NV)) {
return EShLanguage::EShLangCallableNV;
} else if ((shaderStage & VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT)) {
return EShLanguage::EShLangTessControl;
} else if ((shaderStage & VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT)) {
return EShLanguage::EShLangTessEvaluation;
} else if ((shaderStage & VK_SHADER_STAGE_GEOMETRY_BIT)) {
return EShLanguage::EShLangGeometry;
} else {
IRIS_LOG_CRITICAL("Unhandled shaderStage: {}", shaderStage);
std::terminate();
}
}();
char const* strings[] = {source.data()};
int lengths[] = {static_cast<int>(source.size())};
char const* names[] = {path.string().c_str()};
std::string preamble;
for (auto&& define : macroDefinitions) {
preamble += define;
preamble += "\n";
}
glslang::TShader shader(lang);
shader.setStringsWithLengthsAndNames(strings, lengths, names, 1);
shader.setPreamble(preamble.c_str());
shader.setEntryPoint(entryPoint.c_str());
shader.setEnvInput(glslang::EShSource::EShSourceGlsl, lang,
glslang::EShClient::EShClientVulkan, 101);
shader.setEnvClient(glslang::EShClient::EShClientVulkan,
glslang::EShTargetClientVersion::EShTargetVulkan_1_1);
shader.setEnvTarget(glslang::EShTargetLanguage::EShTargetSpv,
glslang::EShTargetLanguageVersion::EShTargetSpv_1_0);
DirStackIncluder includer;
includer.pushExternalLocalDirectory(kIRISContentDirectory);
includer.pushExternalLocalDirectory(kIRISContentDirectory +
"/assets/shaders"s);
if (!shader.parse(&DefaultTBuiltInResource, 1, false,
EShMessages::EShMsgDefault, includer)) {
return unexpected(shader.getInfoLog() + "\nsource:\n"s +
std::string(source));
}
glslang::TProgram program;
program.addShader(&shader);
if (!program.link(EShMessages::EShMsgDefault)) {
return unexpected(program.getInfoLog() + "\nsource:\n"s +
std::string(source));
}
if (auto glsl = program.getIntermediate(lang)) {
glslang::SpvOptions options;
options.validate = true;
#ifndef NDEBUG
options.generateDebugInfo = true;
#endif
spv::SpvBuildLogger logger;
std::vector<std::uint32_t> code;
glslang::GlslangToSpv(*glsl, code, &logger, &options);
Ensures(code.size() > 0);
IRIS_LOG_LEAVE();
return code;
} else {
return unexpected(
"cannot get glsl intermediate representation of compiled shader"s);
}
} // CompileShader
} // namespace iris
iris::expected<iris::Shader, std::system_error> iris::CompileShaderFromSource(
std::string_view source, VkShaderStageFlagBits stage,
gsl::span<std::string> macroDefinitions) noexcept {
IRIS_LOG_ENTER();
Expects(Renderer::sDevice != VK_NULL_HANDLE);
Expects(source.size() > 0);
Shader shader;
shader.stage = stage;
auto code =
CompileShader(source, shader.stage, "<inline>", macroDefinitions, "main");
if (!code) {
IRIS_LOG_LEAVE();
return unexpected(
std::system_error(Error::kShaderCompileFailed, code.error()));
}
VkShaderModuleCreateInfo shaderModuleCI = {};
shaderModuleCI.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
// codeSize is count of bytes, not count of words (which is what size() is)
shaderModuleCI.codeSize = gsl::narrow_cast<std::uint32_t>(code->size() * 4);
shaderModuleCI.pCode = code->data();
if (auto result = vkCreateShaderModule(Renderer::sDevice, &shaderModuleCI,
nullptr, &shader.module);
result != VK_SUCCESS) {
IRIS_LOG_LEAVE();
return unexpected(std::system_error(make_error_code(result),
"Cannot create shader module"));
}
Ensures(shader.module != VK_NULL_HANDLE);
IRIS_LOG_LEAVE();
return shader;
} // iris::CompileShaderFromSource
iris::expected<iris::Shader, std::system_error>
iris::LoadShaderFromFile(std::filesystem::path const& path,
VkShaderStageFlagBits stage,
gsl::span<std::string> macroDefinitions) noexcept {
IRIS_LOG_ENTER();
Expects(!path.empty());
Expects(Renderer::sDevice != VK_NULL_HANDLE);
IRIS_LOG_DEBUG("Loading shader {}", path.string());
auto bytes = iris::io::ReadFile(path);
if (!bytes) {
IRIS_LOG_LEAVE();
return unexpected(bytes.error());
}
Shader shader;
shader.stage = stage;
auto code =
CompileShader({reinterpret_cast<char const*>(bytes->data()), bytes->size()},
shader.stage, path, macroDefinitions, "main");
if (!code) {
IRIS_LOG_LEAVE();
return unexpected(
std::system_error(Error::kShaderCompileFailed, code.error()));
}
VkShaderModuleCreateInfo shaderModuleCI = {};
shaderModuleCI.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
// codeSize is count of bytes, not count of words (which is what size() is)
shaderModuleCI.codeSize = gsl::narrow_cast<std::uint32_t>(code->size() * 4u);
shaderModuleCI.pCode = code->data();
if (auto result = vkCreateShaderModule(Renderer::sDevice, &shaderModuleCI,
nullptr, &shader.module);
result != VK_SUCCESS) {
IRIS_LOG_LEAVE();
return unexpected(std::system_error(make_error_code(result),
"Cannot create shader module"));
}
Ensures(shader.module != VK_NULL_HANDLE);
IRIS_LOG_LEAVE();
return shader;
} // iris::LoadShaderFromFile
|
f9e8c4b067bb173fa1ca71e1c606bead40257d19
|
a4774ad99ed53ae7e5bd00d55898406fbceb4e37
|
/Faithfallguys/imports.h
|
eb5d4361f8e10960b62cf33da5b3f64a5d422fd9
|
[] |
no_license
|
Lunarixus/Faithfallguys
|
0cd0124ee2bf0e92093a8f8767f52488cb934e1f
|
8bb8951fe28663384884b385f695f8f9e3091ef6
|
refs/heads/master
| 2022-12-01T18:04:36.005052
| 2020-08-18T02:08:07
| 2020-08-18T02:08:07
| 287,642,310
| 3
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 416
|
h
|
imports.h
|
/*
* Imports needed for entire program
*/
// Well, this is obvious enough
#include <Windows.h>
// Global includes from WinSDK
#include <string>
#include <iostream>
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <thread>
#include <future>
#include <TlHelp32.h>
#include <psapi.h>
#include <sstream>
#include <cstdint>
#include <cstddef>
#include <intrin.h>
#include <math.h>
|
62e82a39a9c17526d090ad9078a46471f727f7f4
|
8ca9069b8ee82f967791f4650d3e8cc16e1504f8
|
/app/misc/misc.cpp
|
dbf57135d45fa1b89cefc506fe69a20e711cd41e
|
[] |
no_license
|
a-pavlov/fantlab
|
de52871add375684521015b6b6741d1f00c89b3a
|
9b7928c9f9e3af38c55efdc298231183cd9382bb
|
refs/heads/master
| 2022-12-03T08:05:54.159611
| 2022-01-13T16:40:00
| 2022-01-13T16:40:00
| 120,786,968
| 1
| 0
| null | 2022-11-16T09:32:25
| 2018-02-08T16:31:02
|
C++
|
UTF-8
|
C++
| false
| false
| 3,018
|
cpp
|
misc.cpp
|
#include "misc.h"
#include <QRegExp>
#include <QStringList>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
QDataStream &operator<<(QDataStream& out, const WorkInfo& wi) {
out << wi.workId
<< wi.name
<< wi.title
<< wi.description
<< wi.workType
<< wi.workTypeId
<< wi.workTypeName
<< wi.workYear
<< wi.genres;
return out;
}
QDataStream &operator>>(QDataStream& in, WorkInfo& wi) {
in >>
wi.workId >>
wi.name >>
wi.title >>
wi.description >>
wi.workType >>
wi.workTypeId >>
wi.workTypeName >>
wi.workYear >>
wi.genres;
return in;
}
int Misc::url2UserId(const QString& url) {
static QRegExp rx("\\D*/user(\\d+)$");
rx.indexIn(url);
QStringList res = rx.capturedTexts();
return res.size()==2?res.at(1).toInt():0;
}
QPair<int, QString> Misc::octaveCost(const QString& input) {
static QRegExp rx("\\s*(\\d+)\\s+\\|\\s+Cost:\\s*([-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)");
rx.indexIn(input);
QStringList res = rx.capturedTexts();
return (res.size() == 4)?qMakePair(res.at(1).toInt(), res.at(2)):qMakePair(0,QString());
}
bool Misc::isIteration(const QString& input) {
static QRegExp rx("^Iteration\\s*\\r?\\n?");
return rx.exactMatch(input);
}
QString Misc::octaveLambda(const QString& input) {
static QRegExp rx("cur_lambda:([-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)");
rx.indexIn(input);
QStringList res = rx.capturedTexts();
return (res.size() == 3)?res.at(1):QString();
}
QString Misc::octaveMinCost(const QString& input) {
static QRegExp rx("min_cost:([-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)");
rx.indexIn(input);
QStringList res = rx.capturedTexts();
return (res.size() == 3)?res.at(1):QString();
}
bool Misc::isLambdaFinished(const QString& input) {
static QRegExp rx("^fin_lambda\\s*\\r?\\n?");
return rx.exactMatch(input);
}
WorkInfo Misc::getWorkInfo(const QJsonDocument& doc) {
WorkInfo wi;
QJsonObject o = doc.object();
wi.workId = o["work_id"].toString().trimmed().toInt();
wi.title = o["title"].toString();
wi.name = o["work_name"].toString();
wi.description = o["work_description"].toString();
wi.workType = o["work_type"].toString();
wi.workTypeId = o["work_type_id"].toString().trimmed().toInt();
wi.workTypeName = o["work_type_name"].toString();
wi.workYear = o["work_year"].toString().trimmed().toInt();
QJsonArray classificatory = o["classificatory"].toArray();
foreach(const QJsonValue& cv, classificatory) {
if (cv.toObject()["genre_group_id"].toInt() == 1) {
QJsonArray ga = cv.toObject()["genre"].toArray();
foreach(const QJsonValue& gv, ga) {
wi.genres.append(gv.toObject()["genre_id"].toInt());
}
break;
}
}
return wi;
}
bool Misc::isSF(const WorkInfo& wi) {
return wi.genres.contains(1);
}
|
ce9e011dbbf540dc67b75ef84f61e366c91fcff2
|
f78751c4ebc42120536b95b0f9ffbbfc6fccace1
|
/pfba/deps/libcross2d/src/sdl2/sdl2_texture.cpp
|
f86c0a662e54d323d06898076493d499e8ac4cf6
|
[] |
no_license
|
jmota/pfba
|
b6abff6df3fc006b1b99ba892cb28d764aff3a07
|
f239f3d2a1d156f1cfc055c38dfb732c9f9c272c
|
refs/heads/master
| 2021-05-15T03:31:08.216170
| 2017-08-04T16:38:01
| 2017-08-04T16:38:01
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,803
|
cpp
|
sdl2_texture.cpp
|
//
// Created by cpasjuste on 01/12/16.
//
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include "sdl2_texture.h"
SDL2Texture::SDL2Texture(SDL_Renderer *renderer, const char *path) : Texture(path) {
this->renderer = renderer;
SDL_Surface *temp = IMG_Load(path);
if (temp == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", path, SDL_GetError());
return;
}
tex = SDL_CreateTextureFromSurface(renderer, temp);
if (!tex) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError());
} else {
SDL_QueryTexture(tex, NULL, NULL, &width, &height);
}
SDL_FreeSurface(temp);
}
SDL2Texture::SDL2Texture(SDL_Renderer *renderer, int w, int h) : Texture(w, h) {
this->renderer = renderer;
tex = SDL_CreateTexture(renderer,
SDL_PIXELFORMAT_RGB565, SDL_TEXTUREACCESS_STREAMING, w, h);
if (!tex) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError());
} else {
SDL_QueryTexture(tex, NULL, NULL, &width, &height);
}
}
void SDL2Texture::SetFiltering(int filter) {
char f[2];
snprintf(f, 2, "%i\n", filter);
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, f);
// SDL2 only set filtering on texture creation :/
if(tex != NULL) {
SDL_DestroyTexture(tex);
tex = NULL;
}
tex = SDL_CreateTexture(renderer,
SDL_PIXELFORMAT_RGB565, SDL_TEXTUREACCESS_STREAMING, width, height);
if (!tex) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError());
}
}
SDL2Texture::~SDL2Texture() {
if(tex != NULL) {
SDL_DestroyTexture(tex);
tex = NULL;
}
}
|
cd2da65dae2c9bc09dbd03960136a754ddd37a5d
|
4b0bbbe8aad650d8e50117ef3f1ab87d69686630
|
/Capítulo 2 - Zeros/Método de Picard-Peano - Sistema de equações.cpp
|
75b43fb1905a2d8dd67d10950bd18dc396447380
|
[] |
no_license
|
nunottlopes/feup-mnum
|
007d908a7004e9a00165b88eac846bb5b1f75a25
|
5e61fc3199ff5ba2ad7b3a0226e7ff0818d25aae
|
refs/heads/master
| 2021-09-03T08:40:29.712141
| 2018-01-07T16:29:45
| 2018-01-07T16:29:45
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 625
|
cpp
|
Método de Picard-Peano - Sistema de equações.cpp
|
#include <iostream>
#include <cmath>
using namespace std;
long double funcaog1(long double x, long double y) {
return sqrt((x*y+5*x-1)/2);
}
long double funcaog2(long double x, long double y) {
return sqrt(x + 3 * log(x));
}
int main() {
long double xn = 4, yn = 4;
unsigned n = 0;
do {
//long double xn1 = xn;
xn = funcaog1(xn, yn);
yn = funcaog2(xn, yn);
n++;
} while (abs(funcaog1(xn,yn)-xn) > pow(10,-4) || abs(funcaog2(xn,yn)-yn) > pow(10,-4));
cout << "xn : " << xn << endl;
cout << "yn : " << yn << endl;
cout << "iteracoes: " << n << endl;
}
|
87bc7cdcd081121251128673b9ec116137102981
|
17f237d79814db31e800909560749a5896c34037
|
/src/rime/gear/chord_composer.h
|
4afa20c03647d92cbbaa58dc83e15a24852f984a
|
[
"BSD-3-Clause",
"MIT",
"GPL-1.0-or-later",
"LGPL-2.1-only",
"Apache-2.0",
"BSD-2-Clause"
] |
permissive
|
rime/librime
|
0dbbeb896da87397b1cb15fbac7268a84a20aa91
|
84321901874ff5802a625bac04d462bf804e5dab
|
refs/heads/master
| 2023-08-31T14:37:54.081480
| 2023-08-26T19:24:41
| 2023-08-26T19:24:41
| 3,776,878
| 2,972
| 621
|
BSD-3-Clause
| 2023-09-08T23:42:36
| 2012-03-20T15:45:06
|
C++
|
UTF-8
|
C++
| false
| false
| 1,377
|
h
|
chord_composer.h
|
//
// Copyright RIME Developers
// Distributed under the BSD License
//
// 2012-06-05 GONG Chen <chen.sst@gmail.com>
//
#ifndef RIME_CHORD_COMPOSER_H_
#define RIME_CHORD_COMPOSER_H_
#include <rime/common.h>
#include <rime/component.h>
#include <rime/key_event.h>
#include <rime/processor.h>
#include <rime/algo/algebra.h>
namespace rime {
class ChordComposer : public Processor {
public:
ChordComposer(const Ticket& ticket);
~ChordComposer();
virtual ProcessResult ProcessKeyEvent(const KeyEvent& key_event);
protected:
ProcessResult ProcessChordingKey(const KeyEvent& key_event);
ProcessResult ProcessFunctionKey(const KeyEvent& key_event);
string SerializeChord();
void UpdateChord();
void FinishChord();
void ClearChord();
bool DeleteLastSyllable();
void OnContextUpdate(Context* ctx);
void OnUnhandledKey(Context* ctx, const KeyEvent& key);
KeySequence chording_keys_;
string delimiter_;
Projection algebra_;
Projection output_format_;
Projection prompt_format_;
bool use_control_ = false;
bool use_alt_ = false;
bool use_shift_ = false;
set<int> pressed_;
set<int> chord_;
bool editing_chord_ = false;
bool sending_chord_ = false;
bool composing_ = false;
string raw_sequence_;
connection update_connection_;
connection unhandled_key_connection_;
};
} // namespace rime
#endif // RIME_CHORD_COMPOSER_H_
|
5f9ac59cc28e47cfe2fa830b2d162556b5257bd3
|
efd7cfc63230d70c91018f909137635a9ee204ea
|
/ProgrammingPrinciplesAndPracticeUsingCPP/Chapter04/Exercise09.cpp
|
9490a4d15dfe5954e0234be199859cfee6378e94
|
[] |
no_license
|
Mendeir/ProgrammingPrinciplesAndPracticeUsingCPP
|
6a742f8c22b9fd7712d7495d6976c2bf64aa4055
|
b90787e1a15c144c77b88be33438ac1f5df038af
|
refs/heads/master
| 2023-02-17T19:46:36.490914
| 2021-01-18T08:11:23
| 2021-01-18T08:11:23
| 281,862,120
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 541
|
cpp
|
Exercise09.cpp
|
// For an int it will only take 31 squares and for a double it takes many iterations
#include "std_lib_facilities.h"
int main ()
{
int rice { 0 };
int square_rice { 1 };
double drice { 0 };
double dsquare_rice { 1 };
for (int square = 1; square <= 1500; ++square) {
rice += square_rice;
drice += dsquare_rice;
square_rice *= 2;
dsquare_rice *= 2;
cout << "Square " << square << ": int rice (" << rice << "), double rice ("
<< drice << ")\n";
}
return 0;
}
|
0c7e7dadeb73e6b1e4a3415f2fff7d7cd11af8fb
|
04230fbf25fdea36a2d473233e45df21b6ff6fff
|
/longest-common-substring.cpp
|
d0ff776ccdb412ad3048ed80a7bd0d229e4cfc0b
|
[
"MIT"
] |
permissive
|
ankiiitraj/questionsSolved
|
48074d674bd39fe67da1f1dc7c944b95a3ceac34
|
8452b120935a9c3d808b45f27dcdc05700d902fc
|
refs/heads/master
| 2021-07-22T10:16:13.538256
| 2021-02-12T11:51:47
| 2021-02-12T11:51:47
| 241,689,398
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,626
|
cpp
|
longest-common-substring.cpp
|
#include<bits/stdc++.h>
#define faster ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
using namespace std;
int dp[101][101];
int rec(string &a, string &b, int n, int m){
if(n < 0 or m < 0)
return 0;
if(dp[n][m] != -1)
return dp[n][m];
rec(a, b, n -1, m);
rec(a, b, n, m -1);
if(a[n] == b[m]){
return dp[n][m] = 1+ rec(a, b, n -1, m -1);
}
return dp[n][m] = 0;
}
int solve(string a, string b, int n, int m){
rec(a, b, n, m);
int ans = 0;
for(int i = 0; i <= n; ++i){
for(int j = 0; j <= m; ++j){
ans = max(ans, dp[i][j]);
}
}
return ans;
}
int iterate(string a, string b, int n, int m){
a = '!' + a;
b = '!' + b;
if(m > n){
string temp = a;
a = b; b = temp;
n ^= m; m ^= n; n ^= m;
}
int dp[n +2][m +2] = {0}, ans = 0;
memset(dp, 0, sizeof dp);
for(int i = 1; i <= n; ++i){
for(int j = 1; j <= m; ++j){
if(a[i] == b[j]){
dp[i][j] = dp[i -1][j -1] +1;
}else{
dp[i][j] = 0;
}
ans = max(ans, dp[i][j]);
}
}
return ans;
}
int main(){
faster;
// #ifndef ONLINE_JUDGE
// freopen("ip.txt", "r", stdin);
// freopen("op.txt", "w", stdout);
// #endif
int t; cin >> t; while(t--){
int n, m;
memset(dp, -1, sizeof dp);
string a, b;
cin >> n >> m >> a >> b;
cout << solve(a, b, n -1, m -1) << endl;
// cout << iterate(a, b, n, m) << endl;
}
return 0;
}
|
b19ddc351bea3673e1c443ab19f7c12f1966e208
|
b11a852fc6f8f521924c819b969809f033ddb4c6
|
/list/后缀表达式计算2.cpp
|
d36e0fb6bd3a69ac96ea8fac5ceb43b851d3b531
|
[] |
no_license
|
metaStor/-_C-
|
8b30a4a9079f1fff5200fcf9cafb9458935337ae
|
e33d188dfa9d4c0105082291ff2476cd70dd06cb
|
refs/heads/master
| 2022-04-08T21:13:21.049434
| 2020-02-25T14:51:10
| 2020-02-25T14:51:10
| 227,164,573
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,422
|
cpp
|
后缀表达式计算2.cpp
|
#include <stdio.h>
#include "stdlib.h"
#include "string.h"
#include "../lib/LinkStack.h"
/*
从键盘上输入一个后缀表达式,试编写算法计算表达式的值。
规定:逆波兰表达式的长度不超过一行,以$符作为输入结束,
操作数之间用空格分隔,操作符只可能有+、-、*、/四种运算。
例如:234 34+2*$
对应四则运算式: (234+34)*2
*/
int compute(int a, char op, int b) {
switch (op) {
case '+' : return (a + b);
case '-' : return (a - b);
case '*' : return (a * b);
case '/' : return (a / b);
default : return 0;
}
}
int isNum(char c) {
if (c >= '0' && c <= '9') return 1;
return 0;
}
int main(int argc, char *argv[]) {
LinkStack *st;
int a, b, t;
char *str = (char*)malloc(sizeof(char)), *p;
printf("Input: ", str);
/*
如果用scanf的话,遇到空格会返回;
如果用gets的话,遇到回车才返回
linux 下用fgets
*/
//gets(str);
fgets(str, 100, stdin);
InitStack(st);
for (p = str; *p != '$'; p++) {
// 操作符, 出栈两个数计算
if (*p == '+' || *p == '-' || *p == '*' || *p == '/' ) {
Pop(st, a);
Pop(st, b);
Push(st, compute(b, *p, a));
}
// 数字, 非空格
else if (*p != ' '){
t = 0;
while (isNum(*p)) {
t = t * 10 + (*p - '0');
if (!isNum(*(p + 1))) break;
p++;
}
Push(st, t);
}
}
Top(st, t);
printf("res=%d\n", t);
return 0;
}
|
f4c9c064c60b64dcf91a6cd609586facf8947182
|
841b36f2771a2eb840e314416a043c3b7dc16e97
|
/VC++/FirstStepMulti/FirstStepMultiDlg.cpp
|
c3547808d6b7e62d203d079b9309f31fc8ec8d8e
|
[] |
no_license
|
LanTenggit/MindVisionCamerasSDK
|
987416983680c6f8eb43f8540bae12d912fec30e
|
7a34cb6ad5b923d17a1543cf54a99c4daaa9d452
|
refs/heads/master
| 2023-01-03T18:54:15.643503
| 2020-11-05T06:23:18
| 2020-11-05T06:23:18
| 310,209,176
| 0
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 7,389
|
cpp
|
FirstStepMultiDlg.cpp
|
// FirstStepMultiDlg.cpp : 实现文件
//
#include "stdafx.h"
#include "FirstStepMulti.h"
#include "FirstStepMultiDlg.h"
#include "afxdialogex.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CFirstStepMultiDlg 对话框
CFirstStepMultiDlg::CFirstStepMultiDlg(CWnd* pParent /*=NULL*/)
: CDialogEx(CFirstStepMultiDlg::IDD, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
ZeroMemory(m_Grabber, sizeof(m_Grabber));
ZeroMemory(m_hCamera, sizeof(m_hCamera));
ZeroMemory(m_DevInfo, sizeof(m_DevInfo));
}
void CFirstStepMultiDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CFirstStepMultiDlg, CDialogEx)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_WM_DESTROY()
ON_BN_CLICKED(IDC_CHECK_PAUSE_1, &CFirstStepMultiDlg::OnBnClickedCheckPause1)
ON_BN_CLICKED(IDC_BUTTON_CM_SET_1, &CFirstStepMultiDlg::OnBnClickedButtonCmSet1)
ON_BN_CLICKED(IDC_BUTTON_SNAPSHOT_1, &CFirstStepMultiDlg::OnBnClickedButtonSnapshot1)
ON_BN_CLICKED(IDC_CHECK_PAUSE_2, &CFirstStepMultiDlg::OnBnClickedCheckPause2)
ON_BN_CLICKED(IDC_BUTTON_CM_SET_2, &CFirstStepMultiDlg::OnBnClickedButtonCmSet2)
ON_BN_CLICKED(IDC_BUTTON_SNAPSHOT_2, &CFirstStepMultiDlg::OnBnClickedButtonSnapshot2)
ON_BN_CLICKED(IDC_CHECK_PAUSE_3, &CFirstStepMultiDlg::OnBnClickedCheckPause3)
ON_BN_CLICKED(IDC_BUTTON_CM_SET_3, &CFirstStepMultiDlg::OnBnClickedButtonCmSet3)
ON_BN_CLICKED(IDC_BUTTON_SNAPSHOT_3, &CFirstStepMultiDlg::OnBnClickedButtonSnapshot3)
ON_BN_CLICKED(IDC_CHECK_PAUSE_4, &CFirstStepMultiDlg::OnBnClickedCheckPause4)
ON_BN_CLICKED(IDC_BUTTON_CM_SET_4, &CFirstStepMultiDlg::OnBnClickedButtonCmSet4)
ON_BN_CLICKED(IDC_BUTTON_SNAPSHOT_4, &CFirstStepMultiDlg::OnBnClickedButtonSnapshot4)
END_MESSAGE_MAP()
// CFirstStepMultiDlg 消息处理程序
BOOL CFirstStepMultiDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
// 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动
// 执行此操作
SetIcon(m_hIcon, TRUE); // 设置大图标
SetIcon(m_hIcon, FALSE); // 设置小图标
CameraSdkInit(1);
UINT CMS_ID[] = { IDC_STATIC_CM1, IDC_STATIC_CM2, IDC_STATIC_CM3, IDC_STATIC_CM4 };
UINT DISPS_ID[] = { IDC_CM_VIEW_1, IDC_CM_VIEW_2, IDC_CM_VIEW_3, IDC_CM_VIEW_4 };
int nDev = 4;
CameraEnumerateDevice(m_DevInfo, &nDev);
for (int i = 0; i < nDev; ++i)
{
if (CameraGrabber_Create(&m_Grabber[i], &m_DevInfo[i]) != CAMERA_STATUS_SUCCESS)
continue;
SetDlgItemText(CMS_ID[i], m_DevInfo[i].acFriendlyName);
CameraGrabber_GetCameraHandle(m_Grabber[i], &m_hCamera[i]);
CameraCreateSettingPage(m_hCamera[i], m_hWnd, m_DevInfo[i].acFriendlyName, NULL, NULL, 0);
CameraGrabber_SetRGBCallback(m_Grabber[i], FrameRGBCallbackEntry, this);
CameraGrabber_SetSaveImageCompleteCallback(m_Grabber[i], SaveImageCompleteEntry, this);
// 黑白相机设置ISP输出灰度图像
// 彩色相机ISP默认会输出BGR24图像
tSdkCameraCapbility cap;
CameraGetCapability(m_hCamera[i], &cap);
if (cap.sIspCapacity.bMonoSensor)
CameraSetIspOutFormat(m_hCamera[i], CAMERA_MEDIA_TYPE_MONO8);
CameraGrabber_SetHWnd(m_Grabber[i], GetDlgItem(DISPS_ID[i])->m_hWnd);
CameraGrabber_StartLive(m_Grabber[i]);
}
return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
}
// 如果向对话框添加最小化按钮,则需要下面的代码
// 来绘制该图标。对于使用文档/视图模型的 MFC 应用程序,
// 这将由框架自动完成。
void CFirstStepMultiDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // 用于绘制的设备上下文
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
// 使图标在工作区矩形中居中
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// 绘制图标
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialogEx::OnPaint();
}
}
//当用户拖动最小化窗口时系统调用此函数取得光标
//显示。
HCURSOR CFirstStepMultiDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}
void CFirstStepMultiDlg::OnDestroy()
{
CDialogEx::OnDestroy();
for (int i = 0; i < ARRAYSIZE(m_Grabber); ++i)
{
CameraGrabber_Destroy(m_Grabber[i]);
}
}
void CFirstStepMultiDlg::OnBnClickedCheckPause1()
{
if (m_Grabber[0] != NULL)
{
if (((CButton*)GetDlgItem(IDC_CHECK_PAUSE_1))->GetCheck() == BST_CHECKED)
CameraGrabber_StopLive(m_Grabber[0]);
else
CameraGrabber_StartLive(m_Grabber[0]);
}
}
void CFirstStepMultiDlg::OnBnClickedButtonCmSet1()
{
if (m_Grabber[0] != NULL)
{
CameraShowSettingPage(m_hCamera[0], TRUE);
}
}
void CFirstStepMultiDlg::OnBnClickedButtonSnapshot1()
{
if (m_Grabber[0] != NULL)
{
CameraGrabber_SaveImageAsync(m_Grabber[0]);
}
}
void CFirstStepMultiDlg::OnBnClickedCheckPause2()
{
if (m_Grabber[1] != NULL)
{
if (((CButton*)GetDlgItem(IDC_CHECK_PAUSE_2))->GetCheck() == BST_CHECKED)
CameraGrabber_StopLive(m_Grabber[1]);
else
CameraGrabber_StartLive(m_Grabber[1]);
}
}
void CFirstStepMultiDlg::OnBnClickedButtonCmSet2()
{
if (m_Grabber[1] != NULL)
{
CameraShowSettingPage(m_hCamera[1], TRUE);
}
}
void CFirstStepMultiDlg::OnBnClickedButtonSnapshot2()
{
if (m_Grabber[1] != NULL)
{
CameraGrabber_SaveImageAsync(m_Grabber[1]);
}
}
void CFirstStepMultiDlg::OnBnClickedCheckPause3()
{
if (m_Grabber[2] != NULL)
{
if (((CButton*)GetDlgItem(IDC_CHECK_PAUSE_3))->GetCheck() == BST_CHECKED)
CameraGrabber_StopLive(m_Grabber[2]);
else
CameraGrabber_StartLive(m_Grabber[2]);
}
}
void CFirstStepMultiDlg::OnBnClickedButtonCmSet3()
{
if (m_Grabber[2] != NULL)
{
CameraShowSettingPage(m_hCamera[2], TRUE);
}
}
void CFirstStepMultiDlg::OnBnClickedButtonSnapshot3()
{
if (m_Grabber[2] != NULL)
{
CameraGrabber_SaveImageAsync(m_Grabber[2]);
}
}
void CFirstStepMultiDlg::OnBnClickedCheckPause4()
{
if (m_Grabber[3] != NULL)
{
if (((CButton*)GetDlgItem(IDC_CHECK_PAUSE_4))->GetCheck() == BST_CHECKED)
CameraGrabber_StopLive(m_Grabber[3]);
else
CameraGrabber_StartLive(m_Grabber[3]);
}
}
void CFirstStepMultiDlg::OnBnClickedButtonCmSet4()
{
if (m_Grabber[3] != NULL)
{
CameraShowSettingPage(m_hCamera[3], TRUE);
}
}
void CFirstStepMultiDlg::OnBnClickedButtonSnapshot4()
{
if (m_Grabber[3] != NULL)
{
CameraGrabber_SaveImageAsync(m_Grabber[3]);
}
}
void CFirstStepMultiDlg::FrameRGBCallback(void* Grabber, BYTE *pFrameBuffer, tSdkFrameHead* pFrameHead)
{
// 数据处理回调
// 由于黑白相机在相机打开后设置了ISP输出灰度图像
// 因此此处pFrameBuffer=8位灰度数据
// 否则会和彩色相机一样输出BGR24数据
// 彩色相机ISP默认会输出BGR24图像
// pFrameBuffer=BGR24数据
}
void CFirstStepMultiDlg::SaveImageComplete(void* Grabber, void* Image, CameraSdkStatus Status)
{
if (Image != NULL)
{
// 初始化保存文件的文件名
CString FileName;
CString strTime = CTime::GetCurrentTime().Format(_T("%Y%m%d%H%M%S"));
GetCurrentDirectory(MAX_PATH, FileName.GetBufferSetLength(MAX_PATH));
FileName.ReleaseBuffer();
FileName.AppendFormat("\\Snapshot%s.bmp", strTime);
if (CameraImage_SaveAsBmp(Image, FileName) == CAMERA_STATUS_SUCCESS)
MessageBox(FileName);
else
MessageBox("保存失败");
CameraImage_Destroy(Image);
}
}
|
9a37595ec3392e96986a52f8308039fd23251a3d
|
f5b5ab44d8a4a4a3cfc3fb0233abb7899233cbe0
|
/src/bhash.h
|
acd04f7d6bd985a9acbfe747ead30bf3a1d9730e
|
[
"MIT"
] |
permissive
|
jdart1/arasan-chess
|
da99eec7dcab747992064dc882a903098f8b0a27
|
1d74b80c4684bfafbd008daa5fb1550f69feba21
|
refs/heads/master
| 2023-09-06T05:16:47.773438
| 2023-09-03T22:47:01
| 2023-09-03T22:47:01
| 10,220,977
| 120
| 39
|
NOASSERTION
| 2023-09-08T02:26:58
| 2013-05-22T13:52:32
|
C++
|
UTF-8
|
C++
| false
| false
| 1,778
|
h
|
bhash.h
|
// Copyright 1992-2015, 2021 by Jon Dart. All Rights Reserved.
#ifndef _BOARDHASH_H_
#define _BOARDHASH_H_
#include "board.h"
#include <cassert>
extern const CACHE_ALIGN hash_t hash_codes[64][16];
extern const CACHE_ALIGN hash_t ep_codes[64];
extern const CACHE_ALIGN hash_t b_castle_status[6];
extern const CACHE_ALIGN hash_t w_castle_status[6];
class BoardHash
{
public:
static hash_t hashCode(const Board &);
static hash_t pawnHash(const Board &, ColorType side);
static FORCEINLINE hash_t Xor( hash_t h, const Square sq, const Piece piece ) {
assert(OnBoard(sq));
return h ^ hash_codes[sq][(int)piece];
}
static hash_t setSideToMove(hash_t input, ColorType side) {
if (side == Black) {
return input & 0x7fffffffffffffffULL;
} else {
return input | 0x8000000000000000ULL;
}
}
static ColorType sideToMove(hash_t input) {
return (input & 0x8000000000000000ULL) ? White : Black;
}
static hash_t kingPawnHash(const Board &b) {
hash_t h = b.pawnHashCodeB;
h ^= b.pawnHashCodeW;
h = Xor(Xor(h,b.kingSquare(White), WhiteKing), b.kingSquare(Black), BlackKing);
return setSideToMove(h,b.sideToMove());
}
static hash_t kingPawnHash(const Board &board, ColorType side) {
if (side == White)
return board.pawnHashCodeW ^ board.pawnHashCodeB ^ hash_codes[board.kingSquare(White)][WhiteKing] ^ w_castle_status[board.castleStatus(White)];
else
return board.pawnHashCodeW ^ board.pawnHashCodeB ^ hash_codes[board.kingSquare(Black)][BlackKing] ^ b_castle_status[board.castleStatus(Black)];
}
};
#endif
|
9344e2f9b4f9e052967c4016e7637fb5ae6b39f6
|
cc410bba79b3d4ac144d8f81d18c2a1965d24a06
|
/Art Institute of Vancouver/Semester_5/VGP220 Algorithms and Data Patterns I/assignments/Vehicle Polymorphism/vehiclepolymorphism/cNode.h
|
d8997228060672978219bfcc257cea1e362efa00
|
[] |
no_license
|
Khillasaurus/School
|
6d1ffc96e4c1d9a28f99cc423ce5e0bdea370380
|
d3c8cefef74ff8786bb172cd4c8925d9bb94af5b
|
refs/heads/master
| 2020-03-30T05:53:48.030096
| 2015-08-07T19:47:03
| 2015-08-07T19:47:03
| 38,567,740
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,223
|
h
|
cNode.h
|
//====================================================================================================
//File: cNode.h
//Created: 2012/09/09
//Copyright: Daniel Schenker
//====================================================================================================
#ifndef CNODE_H
#define CNODE_H
//====================================================================================================
//Includes
//====================================================================================================
//====================================================================================================
// Forward Declarations
//====================================================================================================
class cVehicle;
//====================================================================================================
//Class Declarations
//====================================================================================================
class cNode
{
public:
//Constructors
cNode();
//Deconstructors
~cNode();
//Member Functions
//General
cVehicle* pVehicle;
cNode* pNext;
cNode* pPrev;
//Statics
static int autoRefCount;
};
#endif //CNODE_H
|
cd9c5dfd1dcfd01810c2d9ce35954c7444f037e5
|
f2fd56b840cc4e7cda0cd1bbbac25665fda8ea10
|
/factory/registerclass - 副本.h
|
eabc960d9a1f44bb9453034f7114fbf9efe7c2d2
|
[] |
no_license
|
HAERBINWINE/TestMicrFrame
|
acee50c5e1d54e7aaa4d8f9b5864a639577e7c51
|
1fb3a6d017e77ffb72df1db1ec9419f4b5dd1bce
|
refs/heads/master
| 2020-09-24T16:30:09.558239
| 2019-12-05T06:17:22
| 2019-12-05T06:17:22
| 225,798,824
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,176
|
h
|
registerclass - 副本.h
|
#ifndef REGISTERCLASS_H
#define REGISTERCLASS_H
#include "factory.h"
//该宏定义实现了一个动态类的创建,
// ## 合并操作符 将操作两边的字符合并成一个新的标识符,合并后新的标识符不是字符串
// # 构串操作符 它将实参的字符序列(而不是实参代表的值)转换成字符串常量, 转换后是一个字符串
// class className##Helper : 如className是FileItem,程序将会生成一个FileItemHelper类。
// 构造函数 : 调用工厂类的注册函数,实现了类名和生成类实例函数的绑定
// CreatObjFunc函数 : 生成一个类实例 比如className是FileItem,则new FileItem. 返回void *减少了代码的耦合
#define REGISTERCLASS(className,classparameters) \
class className##Helper { \
public: \
className##Helper() \
{ \
ClassFactory::instance()->RegisterItem(#className, className##Helper::CreatObjFunc); \
} \
static void* CreatObjFunc() \
{ \
return new className; \
} \
}; \
className##Helper className##helper;
//定义了一个成员变量,如FileItemHelper类的成员变量 FileItemhelper
#endif // REGISTERCLASS_H
|
fee0a08ce35d021473c9d5646a5937ff61ac78d8
|
974389431527e451ce83049b11cd3dc42780108d
|
/phase_1/eval/walker/variants/unpatched/src/email.hpp
|
0f8885f8bc9f186a0d55ff4b469effe6518af657
|
[
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] |
permissive
|
cromulencellc/chess-aces
|
21d8e70c8d9853a922ca0c90ffdd2c79ba390fb0
|
8ea5b0d75ddbf45fd74a7b8c5ca03fc4955eba8b
|
refs/heads/main
| 2023-05-24T01:13:07.917910
| 2022-11-02T00:56:52
| 2022-11-02T00:56:52
| 351,277,450
| 7
| 2
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,283
|
hpp
|
email.hpp
|
#ifndef __EMAIL_HPP__
#define __EMAIL_HPP__
#include <iostream>
#include <vector>
typedef struct header {
std::string field;
std::string field_data;
} header;
typedef struct message {
std::vector<std::string> flags;
std::vector<header *> h;
int body_length = 0;
std::string body = "";
struct message *message = NULL;
} message;
int open_message(std::string fn, char **data);
message *parse_message(char *data);
void free_message(message *m);
std::vector<header *> get_all_headers(message *m);
std::string get_header_by_name(message *m, std::string n);
std::vector<header *> get_headers_by_vector(message *m,
std::vector<std::string> vs);
std::string add_flag_to_name(std::string name, char f);
std::string remove_flag_from_name(std::string name, char f);
std::string get_base_name(std::string name);
bool hasflag(std::string fn, char flag);
std::string get_flag_string(std::string fn);
std::string get_internal_date_string(std::string fn);
std::string rfc822(std::string fn);
std::string rfc822_size(std::string fn);
std::string rfc822_header(std::string fn);
std::string rfc822_text(std::string fn);
std::string envelope(std::string fn);
std::string body_headers(std::string fn, std::vector<std::string> body_tokens);
#endif
|
cf0cfbd932a3697f97dfda01874fa94d956d285f
|
ca5f51c4fecdb3cca7ffc0544c17de0c412086f8
|
/Data structures/Advanced/Disjoint Sets/Dish owner.cpp
|
fb982aacc65d5ae8899ab1e688b828bb06075fa3
|
[] |
no_license
|
avinashw50w/ds_algo
|
f517bbb326a922258e6ef7816e6c06593a2d06aa
|
bc73bd617486ab8fcbbdd8a076cacd3761c6c954
|
refs/heads/master
| 2023-07-22T17:44:44.815336
| 2023-07-13T07:38:22
| 2023-07-13T07:38:22
| 193,303,550
| 0
| 3
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,843
|
cpp
|
Dish owner.cpp
|
/*N chef's are there. Each chef has a dish which is given a value (denoted by S[i]). You need to answer 2 queries :
1. 0 x y : Chef containing dish x competes with chef containing dish y.
If both dishes belong to same chef print "Invalid Query!" ,
otherwise the winner of the round will obtain all the dishes of the loser which will then be eliminated.
2. 1 x : Output the chef which contains the dish x.
Input
First line of input contains an integer T denoting the number of test cases. For each test case,
the first line contains an integer N denoting the number of chefs in the contest.
The next line contains N space separated integers where the ith integer represents S[i].
The next line contains an integer Q denoting the number of queries.
Q lines follow where each line can be of the format 0 x y or 1 x as described in the problem statement.
Output
For each test, print in each line the answer for the queries as described in the problem statement .
Constraints
1 ≤ T ≤ 25
1 ≤ N ≤ 10000(104)
0 ≤ S[i] ≤ 1000000(106)
1 ≤ Q ≤ 10000(104)
1 ≤ x, y ≤ N*/
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e4+5;
int N, par[MAXN], rank[MAXN], S[MAXN];
int findSet(int v) {
return (v == par[v]) ? v: (par[v] = findSet(par[v]));
}
void Union(int x, int y) {
x = findSet(x);
y = findSet(y);
if(x == y)
cout << "Invalid query!\n";
if(S[x] < S[y])
par[x] = y;
else if(S[y] < S[x])
par[y] = x;
}
int main() {
int T; cin >> T;
while(T--) {
cin >> N;
for(int i = 1; i <= N; ++i) {
cin >> S[i];
par[i] = i;
}
int Q, c, a, b;
cin >> Q;
while(Q--) {
cin >> c;
if(c == 0) {
cin >> a >> b;
Union(a, b);
}
else {
cin >> a;
cout << findSet(a) << endl;
}
}
}
}
|
404b174cb0d8e1df616ad2a9ed9fdf5e93781b43
|
e6fd74ac5a8283729c08e05dd045dff9fdaeb3cf
|
/1001.cpp
|
aded01130d6896a204511f998cb673370c86ac4c
|
[] |
no_license
|
zenglh666/POJ
|
137b7fa8e66ad4ccf660b587065daa1290a1ff9f
|
d81e1ea1c8119caa58e07ded81faa305f6bf13e6
|
refs/heads/master
| 2021-01-12T13:39:49.639058
| 2016-09-26T05:15:05
| 2016-09-26T05:15:05
| 69,213,943
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,225
|
cpp
|
1001.cpp
|
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
#define max_len_r 6
#define max_len_result 150
int add_r(char *a, int len_a, char *b, int len_b)
{
if (len_a >= len_b)
{
char car = 0;
for (int i = 0; i < len_b; i++)
{
char res_i_j = a[i] + b[i] + car;
a[i] = res_i_j % 10;
car = res_i_j / 10;
}
for (int i = len_b; i < len_a; i++)
{
char res_i_j = a[i] + car;
a[i] = res_i_j % 10;
car = res_i_j / 10;
}
if (car > 0)
{
a[len_a] = car;
return len_a + 1;
}
else
{
return len_a;
}
}
else
{
char car = 0;
for (int i = 0; i < len_a; i++)
{
char res_i_j = a[i] + b[i] + car;
a[i] = res_i_j % 10;
car = res_i_j / 10;
}
for (int i = len_a; i < len_b; i++)
{
char res_i_j = b[i] + car;
a[i] = res_i_j % 10;
car = res_i_j / 10;
}
if (car > 0)
{
a[len_b] = car;
return len_b + 1;
}
else
{
return len_b;
}
}
}
int mul_r(char *a, int len_a, char *b, int len_b)
{
int len_res = 1;
char res[max_len_result];
res[0] = 0;
char res_i[max_len_result];
for (int i = 0; i < len_a; i++)
{
for (int j = 0; j <= i; j++)
{
res_i[j] = 0;
}
for (int j = 0; j < len_b; j++)
{
char res_i_j = a[i] * b[j] + res_i[i + j];
res_i[i + j] = res_i_j % 10;
res_i[i + j + 1] = res_i_j / 10;
}
len_res = add_r(res, len_res, res_i, i + len_b + 1);
}
memcpy(a, res, len_res*sizeof(char));
return len_res;
}
int exp_r(char *r, int len_r, int n, char *res)
{
int len_res = 1;
res[0] = 1;
for (int i = 0; i < n; i++)
{
len_res= mul_r(res, len_res, r, len_r);
}
return len_res;
}
int trim(char *a, int len_a,char *res)
{
int start, end;
for (int i = 0; i < len_a;i++)
{
if (a[i] != '0')
{
start = i;
break;
}
}
for (int i = len_a - 1; i > -1; i--)
{
if (a[i] != '0' && a[i] !='.')
{
end = i;
break;
}
else if (a[i] == '.')
{
end = i - 1;
break;
}
}
strncpy(res, a + start, end - start + 1);
res[end - start + 1] = 0;
return end - start + 1;
}
int strins(char *a, int len_a, char *b, int len_b,int pos)
{
for (int i = len_a + len_b-1; i >= pos; i--)
{
if (i >= pos + len_b)
{
a[i] = a[i - len_b];
}
else
{
a[i] = b[i - pos];
}
}
return(len_a + len_b);
}
int main()
{
char s[max_len_r];
int n;
while (scanf("%s%d", s, &n) == 2)
{
char r[max_len_r];
int len_s = strlen(s);
int pos_dot = len_s - 1;
int len_r = 0;
int k = 0;
for (int i = len_s-1; i > -1; i--)
{
if (s[i] == '.')
{
pos_dot = i;
}
else
{
r[len_r] = s[i] - '0';
len_r++;
}
}
pos_dot = (len_s - pos_dot - 1)*n;
char res [max_len_result];
int len_res=exp_r(r, len_r, n, res);
len_res=strins(res, len_res, ".", 1, pos_dot);
char res_buff[max_len_result];
for (int i = len_res - 1; i > -1; i--)
{
if (res[i] != '.')
{
res_buff[len_res - 1 - i] = res[i]+'0';
}
else
{
res_buff[len_res - 1 - i] = '.';
}
}
len_res = trim(res_buff, len_res, res);
printf("%s\n", res);
}
free(s);
return 0;
}
|
071a9d5b6fc89aee6d0a85b58139558b7d181757
|
1a09ce69a4548b02c5901b0963c9286801cba849
|
/sentencepiece/normalizer.h
|
8803839548bdfcf06ea4c13f46b86682a5004dce
|
[
"Apache-2.0"
] |
permissive
|
LieluoboAi/sentencepiece
|
aa9a0a95394b8dd2a09d63ea5d1c6de66121701e
|
8bbe66cf2fb7ac3c022fc59e39f8405a89a49b22
|
refs/heads/master
| 2020-03-26T13:48:55.624779
| 2019-12-19T06:43:12
| 2019-12-19T06:43:12
| 144,958,118
| 0
| 1
|
Apache-2.0
| 2019-12-19T06:43:13
| 2018-08-16T08:14:45
|
C++
|
UTF-8
|
C++
| false
| false
| 4,530
|
h
|
normalizer.h
|
// Copyright 2016 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.!
#ifndef NORMALIZER_NORMALIZER_H_
#define NORMALIZER_NORMALIZER_H_
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "sentencepiece/common.h"
#include "sentencepiece/sentencepiece_model.pb.h"
// #include "sentencepiece/sentencepiece_processor.h"
#include "sentencepiece/util.h"
#include "absl/strings/string_view.h"
#include "third_party/darts_clone/darts.h"
namespace sentencepiece {
namespace normalizer {
// Normalizer implements a simple text normalizer with
// user-defined string-to-string rules and leftmost longest
// matching. The rules of Normalizer are built with
// Builder::CompileCharsMap() method. Pre-compiled rules are
// also available via Builder::GetPrecompiledCharsMap(<name>) method.
//
// The motivation of Normalizer is to make flexible, user-customizable
// and self-contained normalizer. All the logic of normalization is
// encoded in the model proto which allows us to define language/task
// dependent normalization rules without breaking the default rule.
class Normalizer {
public:
// Instantiates Normalizer with |spec|.
// |spec| should not be deleted until Normalizer is destroyed.
explicit Normalizer(const NormalizerSpec &spec);
virtual ~Normalizer();
// Returns Status.
// Normalizes function is valid only when status is OK.
virtual util::Status status() const { return status_; }
// Normalizes a plain utf8 string into an internal representation for
// Sentencepiece model. |norm_to_orig| stores the byte-alignment from
// normalized string to the original input.
// This function can do the following normalizations:
// - Character normalization.
// (NFKC / full-width to half-width conversion etc).
// - Adds a prefix space.
// - Replaces a space with a meta symbol.
// - Removing heading, tailing and other redundant spaces.
virtual util::Status Normalize(absl::string_view input, std::string *normalized,
std::vector<size_t> *norm_to_orig) const;
// Returns a normalized string without alignments.
// This function is used in sentencepiece training.
virtual std::string Normalize(absl::string_view input) const;
friend class Builder;
private:
FRIEND_TEST(NormalizerTest, EncodeDecodePrecompiledCharsMapTest);
// Normalizes the prefix of |input| and returns the pair of
// normalized prefix and length we must consume after
// normalization.
// Here's the sample code for the full text normalization.
//
// string output;
// absl::string_view input = "...";
// while (!input.empty()) {
// const auto p = normalizer.NormalizePrefix(input);
// output.append(p.first.data(), p.first.size());
// input.remove_prefix(p.second);
// }
std::pair<absl::string_view, int> NormalizePrefix(absl::string_view input) const;
// Encodes trie_blob and normalized string and return compiled blob.
static std::string EncodePrecompiledCharsMap(absl::string_view trie_blob,
absl::string_view normalized);
// Decodes blob into trie_blob and normalized string.
static util::Status DecodePrecompiledCharsMap(absl::string_view blob,
absl::string_view *trie_blob,
absl::string_view *normalized);
// Maximum size of the return value of Trie, which corresponds
// to the maximum size of shared common prefix in the chars map.
static constexpr int kMaxTrieResultsSize = 32;
// Internal trie for efficient longest matching.
std::unique_ptr<Darts::DoubleArray> trie_;
// "\0" delimitered output string.
// the value of |trie_| stores pointers to this string.
const char *normalized_ = nullptr;
// Spec for normalization.
const NormalizerSpec *spec_;
// Normalizer's status.
util::Status status_;
};
} // namespace normalizer
} // namespace sentencepiece
#endif // NORMALIZER_NORMALIZER_H_
|
b418ca80b89814f69c0ff536fe767f9c4a8df1d7
|
96cebee3a91cfbef0b1548ab2aad51d10d821d5f
|
/example.cpp
|
ddbdef41e3282cc72d662e02a5fd67770cc6c691
|
[] |
no_license
|
ksedgwic/antlr-cpp-threading-example
|
36bb1f2e3b3e68ffd917701ac0ec5d7ab5210419
|
cd5fcaa630c21a3c64b360c42615ce0bcd9b4b33
|
refs/heads/master
| 2021-01-19T20:51:07.218467
| 2017-04-18T02:40:00
| 2017-04-18T02:40:00
| 88,568,124
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,835
|
cpp
|
example.cpp
|
#include <cstring>
#include <iostream>
#include <sstream>
#include "antlr4-runtime.h"
#include "PredicateExpressionLexer.h"
#include "PredicateExpressionParser.h"
#include "PredicateExpressionBaseVisitor.h"
using namespace std;
using namespace antlr4;
// The throwstream macro assembles the string argument to the
// exception constructor from an iostream.
//
#define throwstream(__except, __msg) \
do { \
std::ostringstream __ostrm; \
__ostrm << __msg; \
throw __except(__ostrm.str().c_str()); \
} while (false)
size_t const g_numthreads = 100;
size_t const g_numparsers = 100;
class SampleErrorListener : public BaseErrorListener {
public:
SampleErrorListener(ostream & i_ostrm)
: ostrm(i_ostrm)
, sawError(false)
{}
virtual void
syntaxError(Recognizer *recognizer,
Token * offendingSymbol,
size_t line,
size_t charPositionInLine,
const std::string &msg,
std::exception_ptr e) override {
ostrm << "ERROR: line " << line << ':' << charPositionInLine
<< ": " << msg << endl;
sawError = true;
}
ostream & ostrm;
bool sawError;
};
void
create_parse_tree()
{
string stmt = "amenity == \"restaurant\"";
istringstream istrm(stmt);
ANTLRInputStream input(istrm);
PredicateExpressionLexer lexer(&input);
CommonTokenStream tokens(&lexer);
PredicateExpressionParser parser(&tokens);
lexer.removeErrorListener(&ConsoleErrorListener::INSTANCE);
parser.removeErrorListener(&ConsoleErrorListener::INSTANCE);
ostringstream errstrm;
SampleErrorListener errlistener(errstrm);
lexer.addErrorListener(&errlistener);
parser.addErrorListener(&errlistener);
tree::ParseTree * tree = parser.start();
// Real program would visit the parse tree here ...
}
pthread_barrier_t g_barrier;
void *
worker(void * argp)
{
// All threads should start at once ...
pthread_barrier_wait(&g_barrier);
for (size_t ii = 0; ii < g_numparsers; ++ii) {
create_parse_tree();
}
}
int
run(int & argc, char ** & argv)
{
vector<pthread_t> thrds;
pthread_barrier_init(&g_barrier, NULL, g_numthreads);
// Create all the threads.
thrds.resize(g_numthreads);
for (size_t ii = 0; ii < g_numthreads; ++ii)
{
int err = pthread_create(&thrds[ii], NULL, &worker, NULL);
if (err != 0)
throwstream(runtime_error,
"create thread failed: " << strerror(err));
}
// Collect the threads on completion.
for (size_t ii = 0; ii < g_numthreads; ++ii)
pthread_join(thrds[ii], NULL);
return 0;
}
int
main(int argc, char ** argv)
{
try
{
return run(argc, argv);
}
catch (exception const & ex)
{
cerr << "EXCEPTION: " << ex.what() << endl;
return 1;
}
}
|
0552a5ac75d8aed536c576ad2ec6f9425c745138
|
e0551a625376c4f794ee7547772a2578d03a4cd5
|
/Memory_Management_Algorithms/Worst_fit.cpp
|
dd02e0c98f96307af63ace1bb96d3cdac0ba02a3
|
[
"MIT"
] |
permissive
|
Siddhartha-Dhar/Operating_System_Programs
|
752d79f5386d6d2c47262c893e5c467aa1ea83cd
|
5bbfa8f82e270bef1e0511e82b3678de6b42d713
|
refs/heads/main
| 2023-07-14T20:11:41.619461
| 2021-08-07T13:08:23
| 2021-08-07T13:08:23
| 387,990,968
| 1
| 1
|
MIT
| 2021-08-07T13:08:24
| 2021-07-21T04:18:24
|
C++
|
UTF-8
|
C++
| false
| false
| 1,018
|
cpp
|
Worst_fit.cpp
|
#include<iostream>
#include"Query.cpp"
#include<cstdlib>
using namespace std;
//.................................................Input Array
void inut_arr(int n, int *A, string s){
for(int i=0; i<n; i++){
cout << "\n" << s;
cin >> A[i];
getchar();
}
return;
}
//.................................................Main Function
int main(void){
Query q;
int m, p, *mem, *procs;
cout << "\n\tEntering Blocks";
cout << "\n\t===============\n";
cout << "\n Enter the total number of memory Blocks ==> ";
cin >> m;
getchar();
mem = new int[m];
inut_arr(m, mem, "Enter the Block Capacity in KB ==> ");
cout << "\n\tEntering Processes";
cout << "\n\t==================\n";
cout << "\n Enter the total number of processes ==> ";
cin >> p;
getchar();
procs = new int[p];
inut_arr(p, procs, "Enter the process size in KB ==> ");
q.Worst_fit(mem, procs, m, p);
return(0);
}
|
5d0b71e08068d592834585b95dcadd2d9a7804c9
|
58a3dd96d5c234ce4a9a41cd10702f9a5eb24d11
|
/src/Form.h
|
9c6e01c35f749f652b5582aa04b5102343a2582a
|
[
"MIT"
] |
permissive
|
vitalych/GUI
|
d3c0711bf63084f255dc0dedf559310f23b34be6
|
c2c82caec31c5682f31ecaa38655a1dd39983fd0
|
refs/heads/master
| 2021-01-01T23:13:25.373792
| 2020-02-23T19:35:05
| 2020-02-23T19:36:15
| 239,386,166
| 3
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,492
|
h
|
Form.h
|
/// Copyright (c) 2020 Vitaly Chipounov
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in all
/// copies or substantial portions of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
/// SOFTWARE.
#ifndef __GUI_FORM_H__
#define __GUI_FORM_H__
#include "Button.h"
#include "Framebuffer.h"
#include "Label.h"
#include "Rect.h"
#include "Window.h"
namespace gui {
class CForm;
using CFormPtr = std::shared_ptr<CForm>;
class CForm : public CWindow {
protected:
CWindowPtr m_clientArea;
CLabelPtr m_titleBar;
CButtonPtr m_close;
bool m_resizable;
virtual void OnMouseDragHandler(const MouseState &state, int relx, int rely);
virtual bool OnMouseBeginDragHandler(const MouseState &state);
virtual void OnMouseMoveHandler(const MouseState &state);
virtual void OnMouseButtonDownHandler(const MouseState &state, MouseButton button);
private:
enum DragMode {
NONE,
MOVING,
RESIZING_N,
RESIZING_S,
RESIZING_E,
RESIZING_W,
RESIZING_NW,
RESIZING_NE,
RESIZING_SW,
RESIZING_SE
};
DragMode m_dragMode;
DragMode GetResizingMode(int x, int y);
TRect GetTitleBarRect() const {
auto width = GetWidth();
return TRect(TPoint(4, 4), TPoint(width - 5, 24));
}
TRect GetClientRect(int width, int height) const {
return TRect(4, 25, 4 + width - 8 - 1, 25 + height - 29 - 1);
}
TRect GetClientRect() const {
auto width = GetWidth();
auto height = GetHeight();
return GetClientRect(width, height);
}
TRect GetCloseRect() const {
auto tb = GetTitleBarRect();
auto h = tb.Height();
tb.p0.x = tb.p1.x - h;
tb.p0.y += 1;
tb.p1.y -= 1;
return tb;
}
void OnCloseHandler(const MouseState &) {
SetVisible(false);
OnClose.emit(this->shared_from_this());
}
public:
sigc::signal<void, CWindowPtr> OnClose;
CForm(const this_is_private &p, TRect rect) : CWindow(p, rect) {
m_dragMode = NONE;
auto clientRect = GetClientRect(rect.Width(), rect.Height());
m_clientArea = CWindow::Create(clientRect);
m_clientArea->SetColor(RGB(128, 128, 128));
auto tbr = GetTitleBarRect();
tbr.p0.x += 4;
m_titleBar = CLabel::Create(tbr);
m_titleBar->SetText("Form");
m_titleBar->SetVCenter(true);
m_titleBar->SetTextColor(RGB(255, 255, 255));
m_close = CButton::Create(GetCloseRect());
m_close->Mouse.OnClick.connect(sigc::mem_fun(*this, &CForm::OnCloseHandler));
auto lbl = m_close->GetLabel();
lbl->SetText("X");
m_resizable = true;
InterceptChildEvents(true);
}
static CFormPtr Create(TRect rect) {
auto ret = std::make_shared<CForm>(this_is_private{0}, rect);
ret->CWindow::AddChild(ret->m_clientArea);
ret->CWindow::AddChild(ret->m_titleBar);
ret->CWindow::AddChild(ret->m_close);
return ret;
}
virtual void AddChild(const CWindowPtr &child) {
m_clientArea->AddChild(child);
SetDirty(true);
}
virtual void Draw(IFrameBuffer &fb) const;
virtual void SetRect(TRect r) {
CWindow::SetRect(r);
m_close->SetRect(GetCloseRect());
}
CLabelPtr GetTitleBar() const {
return m_titleBar;
}
CWindowPtr GetClientArea() const {
return m_clientArea;
}
void SetResizable(bool b) {
m_resizable = b;
}
};
} // namespace gui
#endif
|
7527a21986824e9ce2b130fa0404930442675c3a
|
90a335e159f1d3f9a353fd210c55f6c52b2cb886
|
/src/submesh.cpp
|
179cc69142915eea1f94d93c3d0823c9dc4a5219
|
[] |
no_license
|
robinfaury/engine
|
6ec902b2a8c5db0e99225dcb491c56b5be930ff1
|
533b9fd795738410ff62c736a5fb0ed35f0584bb
|
refs/heads/master
| 2021-01-20T10:32:35.743664
| 2016-08-26T16:00:55
| 2016-08-26T16:00:55
| 61,558,300
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,390
|
cpp
|
submesh.cpp
|
#include "SubMesh.h"
////////////////////////////////////////////////////////////////////////////////////////
// //
////////////////////////////////////////////////////////////////////////////////////////
SubMesh::SubMesh(std::string name)
: drawingMode_(GL_TRIANGLES)
, VAO_(0)
, VBO_(0)
, EBO_(0)
, visible_(true)
, name_(name) {
}
SubMesh::~SubMesh() {}
const std::vector<VertexDesc>& SubMesh::getVertices() const {
return vertices_;
}
const std::vector<unsigned int>& SubMesh::getIndices() const {
return indices_;
}
GLuint SubMesh::getVAO() const {
return VAO_;
}
GLuint SubMesh::getEBO() const {
return EBO_;
}
GLuint SubMesh::getDrawingMode() const {
return drawingMode_;
}
const bool SubMesh::isVisible() const {
return visible_;
}
void SubMesh::setVisible(bool visibility) {
visible_ = visibility;
}
std::string SubMesh::getName() const {
return name_;
}
void SubMesh::addVertex(VertexDesc& vertex) {
vertices_.push_back(vertex);
}
void SubMesh::addIndice(GLuint indice) {
indices_.push_back(indice);
}
float SubMesh::getMin() {
float minX = FLT_MAX, minY = FLT_MAX, minZ = FLT_MAX;
for (std::vector<VertexDesc>::iterator vertex = vertices_.begin(); vertex != vertices_.end(); ++vertex)
{
if (minX > (*vertex).position.x)
minX = (*vertex).position.x;
if (minY > (*vertex).position.y)
minY = (*vertex).position.y;
if (minZ > (*vertex).position.z)
minZ = (*vertex).position.z;
}
float min = minX;
if (min > minY)
min = minY;
if (min > minZ)
min = minZ;
return min;
}
float SubMesh::getMax() {
float maxX = 0.f, maxY = 0.f, maxZ = 0.f;
for (std::vector<VertexDesc>::iterator vertex = vertices_.begin(); vertex != vertices_.end(); ++vertex)
{
if (maxX < (*vertex).position.x)
maxX = (*vertex).position.x;
if (maxY < (*vertex).position.y)
maxY = (*vertex).position.y;
if (maxZ < (*vertex).position.z)
maxZ = (*vertex).position.z;
}
float max = maxX;
if (max < maxY)
max = maxY;
if (max < maxZ)
max = maxZ;
return max;
}
void SubMesh::scale(float scaleRatio) {
for (std::vector<VertexDesc>::iterator v = vertices_.begin(); v != vertices_.end(); ++v)
{
(*v).position.x = (*v).position.x / scaleRatio;
(*v).position.y = (*v).position.y / scaleRatio;
(*v).position.z = (*v).position.z / scaleRatio;
}
}
void SubMesh::sendOnGraphicCard()
{
glGenVertexArrays(1, &VAO_);
glGenBuffers(1, &VBO_);
glGenBuffers(1, &EBO_);
glBindVertexArray(VAO_);
glBindBuffer(GL_ARRAY_BUFFER, VBO_);
glBufferData(GL_ARRAY_BUFFER, vertices_.size() * sizeof(VertexDesc), &vertices_[0], GL_STATIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO_);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices_.size() * sizeof(GLuint), &indices_[0], GL_STATIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(VertexDesc), (GLvoid*)0);
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(VertexDesc), (GLvoid*)(sizeof(glm::vec3)));
glEnableVertexAttribArray(2);
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(VertexDesc), (GLvoid*)(2*sizeof(glm::vec3)));
glBindVertexArray(0);
}
void SubMesh::draw() {
glBindVertexArray(VAO_);
glDrawElements(GL_TRIANGLES, indices_.size(), GL_UNSIGNED_INT, (void*)0);
glBindVertexArray(0);
}
|
bfde2de77fc99b1af436676af3f7939c2deae4c6
|
012ce8a2a7671ef22803c664be0bc084a9e53de3
|
/src/returnPosition.cpp
|
af210f63fa0eafb083ce7e0d1bb97fee64245c91
|
[] |
no_license
|
ha-younes72/moleculardynamics
|
a855b2a0e64fcb77c5d58968e01affda048f07b3
|
612d193df7e26a4e8fe2b2ca1899ed87822514c3
|
refs/heads/master
| 2020-04-15T12:32:29.926231
| 2019-01-11T09:59:05
| 2019-01-11T09:59:05
| 164,676,180
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 376
|
cpp
|
returnPosition.cpp
|
#include"../include/header.h"
void MolecularDynamics::returnPosition(ofstream& position){
//position.open(ios_base::app);
//position << N <<endl;
for (int row=0; row<N; row++){
position << 1 << '\t';
for (int col=0; col<dimension; col++)
position << Particles[row].returnr(col) << '\t';
if (dimension == 2)
position << 0.0 << '\t';
position << endl;
}
}
|
ce80ad437625cae124d1ee0fcddc0711042db02e
|
146c65138cf8665918193c74a185ceab0ba7009b
|
/src/arch/alpha/faults.cc
|
3433844c1cd2dcc2b7b7eec4fccfd52aacf4bca4
|
[
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-license",
"LGPL-2.0-or-later",
"MIT"
] |
permissive
|
harvard-acc/gem5-aladdin
|
b962dd2103e938354c05d81e6843c145ac05e085
|
d4efbee56d71f9609eab85393eff58f5dbf7763c
|
refs/heads/master
| 2022-11-11T12:25:29.032584
| 2022-01-21T06:26:00
| 2022-01-21T06:26:00
| 70,526,994
| 194
| 66
|
BSD-3-Clause
| 2022-10-06T04:50:52
| 2016-10-10T20:41:00
|
C++
|
UTF-8
|
C++
| false
| false
| 7,775
|
cc
|
faults.cc
|
/*
* Copyright (c) 2003-2005 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer;
* redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Authors: Gabe Black
* Kevin Lim
*/
#include "arch/alpha/faults.hh"
#include "arch/alpha/ev5.hh"
#include "arch/alpha/tlb.hh"
#include "base/trace.hh"
#include "cpu/base.hh"
#include "cpu/thread_context.hh"
#include "mem/page_table.hh"
#include "sim/full_system.hh"
#include "sim/process.hh"
namespace AlphaISA {
FaultName MachineCheckFault::_name = "mchk";
FaultVect MachineCheckFault::_vect = 0x0401;
FaultStat MachineCheckFault::_count;
FaultName AlignmentFault::_name = "unalign";
FaultVect AlignmentFault::_vect = 0x0301;
FaultStat AlignmentFault::_count;
FaultName ResetFault::_name = "reset";
FaultVect ResetFault::_vect = 0x0001;
FaultStat ResetFault::_count;
FaultName ArithmeticFault::_name = "arith";
FaultVect ArithmeticFault::_vect = 0x0501;
FaultStat ArithmeticFault::_count;
FaultName InterruptFault::_name = "interrupt";
FaultVect InterruptFault::_vect = 0x0101;
FaultStat InterruptFault::_count;
FaultName NDtbMissFault::_name = "dtb_miss_single";
FaultVect NDtbMissFault::_vect = 0x0201;
FaultStat NDtbMissFault::_count;
FaultName PDtbMissFault::_name = "dtb_miss_double";
FaultVect PDtbMissFault::_vect = 0x0281;
FaultStat PDtbMissFault::_count;
FaultName DtbPageFault::_name = "dtb_page_fault";
FaultVect DtbPageFault::_vect = 0x0381;
FaultStat DtbPageFault::_count;
FaultName DtbAcvFault::_name = "dtb_acv_fault";
FaultVect DtbAcvFault::_vect = 0x0381;
FaultStat DtbAcvFault::_count;
FaultName DtbAlignmentFault::_name = "unalign";
FaultVect DtbAlignmentFault::_vect = 0x0301;
FaultStat DtbAlignmentFault::_count;
FaultName ItbPageFault::_name = "itbmiss";
FaultVect ItbPageFault::_vect = 0x0181;
FaultStat ItbPageFault::_count;
FaultName ItbAcvFault::_name = "iaccvio";
FaultVect ItbAcvFault::_vect = 0x0081;
FaultStat ItbAcvFault::_count;
FaultName UnimplementedOpcodeFault::_name = "opdec";
FaultVect UnimplementedOpcodeFault::_vect = 0x0481;
FaultStat UnimplementedOpcodeFault::_count;
FaultName FloatEnableFault::_name = "fen";
FaultVect FloatEnableFault::_vect = 0x0581;
FaultStat FloatEnableFault::_count;
/* We use the same fault vector, as for the guest system these should be the
* same, but for host purposes, having differentiation is helpful for
* debug/monitorization purposes. */
FaultName VectorEnableFault::_name = "ven";
FaultVect VectorEnableFault::_vect = 0x0581;
FaultStat VectorEnableFault::_count;
FaultName PalFault::_name = "pal";
FaultVect PalFault::_vect = 0x2001;
FaultStat PalFault::_count;
FaultName IntegerOverflowFault::_name = "intover";
FaultVect IntegerOverflowFault::_vect = 0x0501;
FaultStat IntegerOverflowFault::_count;
void
AlphaFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
{
FaultBase::invoke(tc);
if (!FullSystem)
return;
countStat()++;
PCState pc = tc->pcState();
// exception restart address
if (setRestartAddress() || !(pc.pc() & 0x3))
tc->setMiscRegNoEffect(IPR_EXC_ADDR, pc.pc());
if (skipFaultingInstruction()) {
// traps... skip faulting instruction.
tc->setMiscRegNoEffect(IPR_EXC_ADDR,
tc->readMiscRegNoEffect(IPR_EXC_ADDR) + 4);
}
pc.set(tc->readMiscRegNoEffect(IPR_PAL_BASE) + vect());
tc->pcState(pc);
}
void
ArithmeticFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
{
FaultBase::invoke(tc);
if (!FullSystem)
return;
panic("Arithmetic traps are unimplemented!");
}
void
DtbFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
{
if (FullSystem) {
// Set fault address and flags. Even though we're modeling an
// EV5, we use the EV6 technique of not latching fault registers
// on VPTE loads (instead of locking the registers until IPR_VA is
// read, like the EV5). The EV6 approach is cleaner and seems to
// work with EV5 PAL code, but not the other way around.
if (reqFlags.noneSet(AlphaRequestFlags::VPTE | Request::PREFETCH)) {
// set VA register with faulting address
tc->setMiscRegNoEffect(IPR_VA, vaddr);
// set MM_STAT register flags
MachInst machInst = inst->machInst;
tc->setMiscRegNoEffect(IPR_MM_STAT,
(((Opcode(machInst) & 0x3f) << 11) |
((Ra(machInst) & 0x1f) << 6) |
(flags & 0x3f)));
// set VA_FORM register with faulting formatted address
tc->setMiscRegNoEffect(IPR_VA_FORM,
tc->readMiscRegNoEffect(IPR_MVPTBR) | (vaddr.vpn() << 3));
}
}
AlphaFault::invoke(tc);
}
void
ItbFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
{
if (FullSystem) {
tc->setMiscRegNoEffect(IPR_ITB_TAG, pc);
tc->setMiscRegNoEffect(IPR_IFAULT_VA_FORM,
tc->readMiscRegNoEffect(IPR_IVPTBR) | (VAddr(pc).vpn() << 3));
}
AlphaFault::invoke(tc);
}
void
ItbPageFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
{
if (FullSystem) {
ItbFault::invoke(tc);
return;
}
Process *p = tc->getProcessPtr();
const EmulationPageTable::Entry *pte = p->pTable->lookup(pc);
panic_if(!pte, "Tried to execute unmapped address %#x.\n", pc);
VAddr vaddr(pc);
TlbEntry entry(p->pTable->pid(), vaddr.page(), pte->paddr,
pte->flags & EmulationPageTable::Uncacheable,
pte->flags & EmulationPageTable::ReadOnly);
dynamic_cast<TLB *>(tc->getITBPtr())->insert(vaddr.page(), entry);
}
void
NDtbMissFault::invoke(ThreadContext *tc, const StaticInstPtr &inst)
{
if (FullSystem) {
DtbFault::invoke(tc, inst);
return;
}
Process *p = tc->getProcessPtr();
const EmulationPageTable::Entry *pte = p->pTable->lookup(vaddr);
if (!pte && p->fixupStackFault(vaddr))
pte = p->pTable->lookup(vaddr);
panic_if(!pte, "Tried to access unmapped address %#x.\n", (Addr)vaddr);
TlbEntry entry(p->pTable->pid(), vaddr.page(), pte->paddr,
pte->flags & EmulationPageTable::Uncacheable,
pte->flags & EmulationPageTable::ReadOnly);
dynamic_cast<TLB *>(tc->getDTBPtr())->insert(vaddr.page(), entry);
}
} // namespace AlphaISA
|
62ec259724ae9f52c67f8405fedf9c7936578bfa
|
73706ea168cfccaed81e4aaf5d5f42f90b9a00d2
|
/cpp-lang/data-structures/LinkedList.cpp
|
b6ab6b1a6d7c1fbdadc43587f4ae95f721e7763f
|
[] |
no_license
|
sushantmane/coder
|
9cad2bc79868d62f11e954c48412124ebd866bec
|
e5886be84129d562e386c745543f6db10ed3edbd
|
refs/heads/master
| 2021-05-16T01:49:20.369246
| 2021-03-08T06:39:44
| 2021-03-08T06:39:44
| 41,724,461
| 0
| 0
| null | 2021-03-31T22:00:29
| 2015-09-01T07:43:44
|
Java
|
UTF-8
|
C++
| false
| false
| 493
|
cpp
|
LinkedList.cpp
|
//
// Created by Sushant Mane on 10/24/19.
//
#include <iostream>
#include "LinkedList.h"
void LinkedList::addNode(int data) {
Node *n = new Node();
n->data = data;
n->next = nullptr;
if (!head) {
head = n;
return;
}
Node *ptr = head;
while (ptr->next) {
ptr = ptr->next;
}
ptr->next = n;
}
void LinkedList::print() {
Node *ptr = head;
while (ptr) {
std::cout << ptr->data << " ";
ptr = ptr->next;
}
}
|
94ee8ff5c1ae6764221b6714a145eedc2eef29f9
|
ba90cba096ba4e1a1de31af346e0b769c17ccc9e
|
/include/SLList.hpp
|
6c9fc9e632702d747bd112f7ee584d10f59a759d
|
[
"MIT"
] |
permissive
|
KaravolisL/ARM-ISA-Simulator
|
f5ed222eff2d82c6fdad8ec822fec856570419c9
|
cc5b927ff40054d912e208a469545089125e6911
|
refs/heads/master
| 2023-01-02T03:35:05.483981
| 2020-10-21T00:35:37
| 2020-10-21T00:35:37
| 253,665,149
| 0
| 0
|
MIT
| 2020-09-11T21:59:09
| 2020-04-07T02:19:19
|
C++
|
UTF-8
|
C++
| false
| false
| 10,434
|
hpp
|
SLList.hpp
|
/////////////////////////////////
/// @file SLList.hpp
///
/// @brief Declarations and implementation for
/// singly linked list
///
/// @author Luke Karavolis
/////////////////////////////////
#ifndef SLLIST_HPP
#define SLLIST_HPP
// SYSTEM INCLUDES
#include <iostream> // For std::cout
// C PROJECT INCLUDES
// (None)
// C++ PROJECT INCLUDES
#include "IndexOutOfBoundsException.hpp" // For IndexOutOfBoundsException
////////////////////////////////
/// @class SLList
///
/// @brief Singly List class
/// @tparam T type stored in list
////////////////////////////////
template <typename T>
class SLList
{
private:
////////////////////////////////
/// @struct Node
///
/// @brief Data type used to store
/// data in list and next node pointer
////////////////////////////////
typedef struct Node
{
/// Data held by node
T data;
/// Pointer to the next node
Node* next;
/////////////////////////////////////
/// @brief Constructs a new Node object
///
/// @param[in] data Data to be held by node
/////////////////////////////////////
Node(T data) :
data(data),
next(nullptr)
{}
/////////////////////////////////////
/// @brief Assignment operator
/////////////////////////////////////
Node& operator=(Node const&);
/////////////////////////////////////
/// @brief Copy constructor
/////////////////////////////////////
Node(Node const&);
} Node;
public:
/////////////////////////////////////
/// @brief Constructs a new SLList object
/////////////////////////////////////
SLList() :
head(nullptr),
m_length(0)
{}
/////////////////////////////////////
/// @brief Destroys the SLList object
/////////////////////////////////////
~SLList()
{
Clear();
}
////////////////////////////////
/// @brief Inserts an element at the beginning of the list
///
/// @param element Element to be inserted
////////////////////////////////
void InsertFront(T element)
{
// If the list is empty, make new element the head
if (head == nullptr)
{
head = new Node(element);
}
else
{
// Make this new node the head of the list
Node* newNode = new Node(element);
newNode->next = head;
head = newNode;
}
m_length++;
}
////////////////////////////////
/// @brief Insert an element at the end of the list
///
/// @param element Element to be inserted
////////////////////////////////
void InsertBack(T element)
{
// If the list is empty, make new element the head
if (head == nullptr)
{
head = new Node(element);
}
else
{
// Traverse to the end of the list
Node* pCurrentNode = head;
while (pCurrentNode->next != nullptr)
{
pCurrentNode = pCurrentNode->next;
}
// Append new node to the end
Node* pNewNode = new Node(element);
pCurrentNode->next = pNewNode;
}
m_length++;
}
////////////////////////////////
/// @brief Retrieves an element from the list
///
/// @param index Index of element to return
/// @return Element at given value
/// @throw IndexOutOfBoundsException
////////////////////////////////
T Get(uint32_t index) const
{
return (*this)[index];
}
/////////////////////////////////////
/// @copybrief Get()
///
/// @param[in] index Index of element to get
/// @return Reference to element
/// @throw IndexOutOfBoundsException
/////////////////////////////////////
T& operator[](uint32_t index)
{
for (Node* pCurrentNode = head;
pCurrentNode != nullptr;
pCurrentNode = pCurrentNode->next)
{
if (index-- == 0)
{
return pCurrentNode->data;
}
}
throw IndexOutOfBoundsException(index);
}
/////////////////////////////////////
/// @copydoc T& operator[](uint32_t)
/////////////////////////////////////
const T& operator[](uint32_t index) const
{
for (Node* pCurrentNode = head;
pCurrentNode != nullptr;
pCurrentNode = pCurrentNode->next)
{
if (index-- == 0)
{
return pCurrentNode->data;
}
}
throw IndexOutOfBoundsException(index);
}
////////////////////////////////
/// @brief Frees all nodes in the list
////////////////////////////////
void Clear(void)
{
Node* pNextNode;
for (Node* pCurrentNode = head;
pCurrentNode != nullptr;
pCurrentNode = pNextNode)
{
// Save the next node and delete current
pNextNode = pCurrentNode->next;
delete pCurrentNode;
}
head = nullptr;
m_length = 0;
}
////////////////////////////////
/// @brief Removes a given item from the list
///
/// @param index Index to remove
/// @return Data stored at given index
/// @throw IndexOutOfBoundsException
////////////////////////////////
T Remove(uint32_t index)
{
// Bounds check
if ((index + 1) > m_length) throw IndexOutOfBoundsException(index);
Node* pOldNode;
// Edge case of removing head
if (index == 0)
{
pOldNode = head;
head = head->next;
}
else
{
Node* pPreviousNode = nullptr;
for (Node* pCurrentNode = head;
pCurrentNode != nullptr;
pCurrentNode = pCurrentNode->next)
{
if (index-- == 0)
{
pOldNode = pCurrentNode;
pPreviousNode->next = pCurrentNode->next;
break;
}
pPreviousNode = pCurrentNode;
}
}
// Delete the node and return it's data;
T data = pOldNode->data;
delete pOldNode;
m_length--;
return data;
}
/////////////////////////////////////
/// @brief Gets the Length member
///
/// @return Length of the list
/////////////////////////////////////
uint32_t GetLength(void) const
{
return m_length;
}
////////////////////////////////
/// @brief Prints the list to std::cout
////////////////////////////////
void PrintList(void) const
{
for (Node* pCurrentNode = head;
pCurrentNode != nullptr;
pCurrentNode = pCurrentNode->next)
{
std::cout << pCurrentNode->data;
if (pCurrentNode->next != nullptr)
{
std::cout << "->";
}
else
{
std::cout << "\n";
}
}
}
// Forward declaration of iterator class
class SLListIterator;
////////////////////////////////
/// @brief Obtains an iterator from the beginning
///
/// @return SLListIterator from beginning
////////////////////////////////
SLListIterator GetBegin() const
{
return SLListIterator(head);
}
////////////////////////////////
/// @brief Obtains an iterator from the end
///
/// @return SLListIterator from end
////////////////////////////////
SLListIterator GetEnd() const
{
return SLListIterator(nullptr);
}
////////////////////////////////
/// @class SLListIterator
///
/// @brief Class used to iterate
/// through a linked list
////////////////////////////////
class SLListIterator
{
public:
/////////////////////////////////////
/// @brief Constructs a new SLListIterator object
/////////////////////////////////////
SLListIterator() :
pNextNode(nullptr)
{}
/////////////////////////////////////
/// @brief Constructs a new SLListIterator object
///
/// @param[in] startingNode Node at which to begin
/////////////////////////////////////
SLListIterator(Node* startingNode) :
pNextNode(startingNode)
{}
////////////////////////////////
/// @brief Assignment operator
////////////////////////////////
SLListIterator& operator=(Node* pNode)
{
pNextNode = pNode;
return *this;
}
////////////////////////////////
/// @brief Prefix ++ Operator
////////////////////////////////
SLListIterator& operator++()
{
if (pNextNode != nullptr)
{
pNextNode = pNextNode->next;
}
return *this;
}
////////////////////////////////
/// @brief Postfix ++ Operator
////////////////////////////////
SLListIterator operator++(int)
{
SLListIterator iterator = *this;
++*this;
return iterator;
}
////////////////////////////////
/// @brief Not Equal Operator
////////////////////////////////
bool operator!=(const SLListIterator& iterator)
{
return pNextNode != iterator.pNextNode;
}
////////////////////////////////
/// @brief Dereference Operator
////////////////////////////////
T operator*() const
{
return pNextNode->data;
}
private:
/// Pointer to the next element in the list
SLList::Node* pNextNode;
};
////////////////////////////////
/// @brief Copy Constructer
////////////////////////////////
SLList(SLList const&);
////////////////////////////////
/// @brief Assignment operator
////////////////////////////////
SLList& operator=(SLList const&);
protected:
private:
/// Pointer to the head of the list
Node* head;
/// Number of elements in the list
uint32_t m_length;
};
#endif
|
c3020e7cd35708b0179f402f48b463d101cce44d
|
fb1f2dfbb82409ee0f1c02e9a72f2bb1131b19bf
|
/Fixing_Issues/test.h
|
2af59bb00bea46dad5f1d7065f0144a5ec9fea75
|
[] |
no_license
|
GeorgeDanicico/Object-Oriented-Programming-Year1
|
d18b1d6653cd8a46679d34887472261ee4e94a71
|
6cab2a4915a47da84dbd18e414d2711dd1ffa8ce
|
refs/heads/main
| 2023-06-17T21:50:03.373761
| 2021-07-13T13:44:11
| 2021-07-13T13:44:11
| 349,129,739
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 130
|
h
|
test.h
|
//
// Created by georg on 6/21/2021.
//
#pragma once
#include "Service.h"
class test {
public:
static void test_all();
};
|
5f3b6084bab23be7690f934878bce2b7260e1d83
|
b7c074eb93cb1fcb81a6ab36465ed04f0b169eb8
|
/openvibe-2.2.0-src/extras/plugins/processing/stimulation/src/box-algorithms/ovpCBoxAlgorithmOpenALSoundPlayer.cpp
|
136a1bf321d0ff3c43a1b4b073b0acc9ddcee204
|
[] |
no_license
|
TristanVenot/openvibe2.0
|
824fdd65b14c97a6ffa7de515cdde3508189d0f3
|
f481d3bbe6e3ce9b7449f08965a4a0dd7cdbc9fc
|
refs/heads/master
| 2020-04-28T17:00:46.329723
| 2019-03-14T08:39:05
| 2019-03-14T08:39:05
| 175,430,833
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 10,856
|
cpp
|
ovpCBoxAlgorithmOpenALSoundPlayer.cpp
|
#if defined TARGET_HAS_ThirdPartyOpenAL
#include "ovpCBoxAlgorithmOpenALSoundPlayer.h"
#include <tcptagging/IStimulusSender.h>
using namespace OpenViBE;
using namespace OpenViBE::Kernel;
using namespace OpenViBE::Plugins;
using namespace OpenViBEPlugins;
using namespace OpenViBEPlugins::Stimulation;
using namespace std;
#define boolean OpenViBE::boolean
#define BUFFER_SIZE 32768
#define UNIQUE_SOURCE 1
CBoxAlgorithmOpenALSoundPlayer::CBoxAlgorithmOpenALSoundPlayer(void)
: m_pStimulusSender(NULL)
{
// nop
}
boolean CBoxAlgorithmOpenALSoundPlayer::initialize(void)
{
m_oStreamDecoder.initialize(*this, 0);
m_oStreamEncoder.initialize(*this, 0);
m_ui64PlayTrigger = FSettingValueAutoCast(*this->getBoxAlgorithmContext(),0);
m_ui64StopTrigger = FSettingValueAutoCast(*this->getBoxAlgorithmContext(),1);
m_sFileName = FSettingValueAutoCast(*this->getBoxAlgorithmContext(),2);
m_bLoop = FSettingValueAutoCast(*this->getBoxAlgorithmContext(),3);
m_ui64LastOutputChunkDate = -1;
m_bStartOfSoundSent = false;
m_bEndOfSoundSent = false;
if(alutInit(NULL,NULL) != AL_TRUE)
{
if(alutGetError () == ALUT_ERROR_INVALID_OPERATION)
{
this->getLogManager() << LogLevel_Trace << "ALUT already initialized.\n";
}
else
{
this->getLogManager() << LogLevel_Error << "ALUT initialization returned a bad status.\n";
this->getLogManager() << LogLevel_Error << "ALUT ERROR:\n"<<alutGetErrorString(alutGetError ())<<"\n";
return false;
}
}
m_iFileFormat = FILE_FORMAT_UNSUPPORTED;
string l_sFile((const char *)m_sFileName);
if(l_sFile.find(".wav") !=string::npos)
{
m_iFileFormat = FILE_FORMAT_WAV;
}
if(l_sFile.find(".ogg") !=string::npos)
{
m_iFileFormat = FILE_FORMAT_OGG;
}
m_pStimulusSender = TCPTagging::createStimulusSender();
if (!m_pStimulusSender->connect("localhost", "15361"))
{
this->getLogManager() << LogLevel_Warning << "Unable to connect to AS's TCP Tagging plugin, stimuli wont be forwarded.\n";
}
return openSoundFile();
}
boolean CBoxAlgorithmOpenALSoundPlayer::uninitialize(void)
{
m_oStreamDecoder.uninitialize();
m_oStreamEncoder.uninitialize();
boolean l_bStatus = stopSound(false);
#if UNIQUE_SOURCE
alDeleteSources(1, &m_uiSourceHandle);
#endif
alDeleteBuffers(1, &m_uiSoundBufferHandle);
if(alutExit() != AL_TRUE)
{
if(alutGetError () == ALUT_ERROR_INVALID_OPERATION)
{
this->getLogManager() << LogLevel_Trace << "ALUT already exited.\n";
}
else
{
this->getLogManager() << LogLevel_Error << "ALUT uninitialization returned a bad status.\n";
this->getLogManager() << LogLevel_Error << "ALUT ERROR:\n"<<alutGetErrorString(alutGetError ())<<"\n";
return false;
}
}
if (m_pStimulusSender)
{
delete m_pStimulusSender;
m_pStimulusSender = nullptr;
}
return l_bStatus;
}
boolean CBoxAlgorithmOpenALSoundPlayer::processClock(OpenViBE::CMessageClock& rMessageClock)
{
getBoxAlgorithmContext()->markAlgorithmAsReadyToProcess();
return true;
}
boolean CBoxAlgorithmOpenALSoundPlayer::processInput(uint32 ui32InputIndex)
{
getBoxAlgorithmContext()->markAlgorithmAsReadyToProcess();
return true;
}
boolean CBoxAlgorithmOpenALSoundPlayer::process(void)
{
IBoxIO& l_rDynamicBoxContext=this->getDynamicBoxContext();
if(m_ui64LastOutputChunkDate==(uint64)(-1))
{
// Send header on initialize
m_oStreamEncoder.encodeHeader();
l_rDynamicBoxContext.markOutputAsReadyToSend(0, 0, 0);
m_ui64LastOutputChunkDate=0;
}
// Look for command stimulations
for (uint32 i = 0; i < l_rDynamicBoxContext.getInputChunkCount(0); i++)
{
m_oStreamDecoder.decode(i);
if (m_oStreamDecoder.isHeaderReceived())
{
// NOP
}
if (m_oStreamDecoder.isBufferReceived())
{
const IStimulationSet* l_pStimulationSet = m_oStreamDecoder.getOutputStimulationSet();
for(uint32 j=0; j<l_pStimulationSet->getStimulationCount(); j++)
{
const uint64 l_ui64Stimulation = l_pStimulationSet->getStimulationIdentifier(j);
if(l_ui64Stimulation == m_ui64PlayTrigger)
{
playSound();
m_bEndOfSoundSent = false;
m_bStartOfSoundSent = false;
}
else if(l_ui64Stimulation == m_ui64StopTrigger)
{
stopSound(true);
}
else
{
// Immediate passthrough
m_pStimulusSender->sendStimulation(l_ui64Stimulation);
}
}
}
if (m_oStreamDecoder.isEndReceived())
{
// @fixme potentially bad behavior: the box may send chunks after sending this end
m_oStreamEncoder.encodeEnd();
l_rDynamicBoxContext.markOutputAsReadyToSend(0, m_ui64LastOutputChunkDate, this->getPlayerContext().getCurrentTime());
m_ui64LastOutputChunkDate = this->getPlayerContext().getCurrentTime();
}
}
// n.b. TCP Tagging should be used instead of this socket output. This code is kept for backwards compatibility.
IStimulationSet* l_pOutputStimulationSet = m_oStreamEncoder.getInputStimulationSet();
l_pOutputStimulationSet->clear();
ALint l_uiStatus;
alGetSourcei(m_uiSourceHandle, AL_SOURCE_STATE, &l_uiStatus);
// CASE : the sound has stopped, and we need to send the stimulation
if(l_uiStatus == AL_STOPPED && !m_bEndOfSoundSent)
{
l_pOutputStimulationSet->appendStimulation(
m_ui64StopTrigger,
this->getPlayerContext().getCurrentTime(),
0);
m_bEndOfSoundSent = true;
}
// CASE : the sound has started playing, and we need to send the stimulation
if(l_uiStatus == AL_PLAYING && !m_bStartOfSoundSent)
{
l_pOutputStimulationSet->appendStimulation(
m_ui64PlayTrigger,
this->getPlayerContext().getCurrentTime(),
0);
m_bStartOfSoundSent = true;
}
m_oStreamEncoder.encodeBuffer();
l_rDynamicBoxContext.markOutputAsReadyToSend(0, m_ui64LastOutputChunkDate, this->getPlayerContext().getCurrentTime());
m_ui64LastOutputChunkDate = this->getPlayerContext().getCurrentTime();
return true;
}
boolean CBoxAlgorithmOpenALSoundPlayer::openSoundFile()
{
switch(m_iFileFormat)
{
case FILE_FORMAT_WAV:
{
this->getLogManager() << LogLevel_Trace << "Buffering WAV file (this step may take some times for long files).\n";
m_uiSoundBufferHandle = alutCreateBufferFromFile(m_sFileName);
this->getLogManager() << LogLevel_Trace << "WAV file buffered.\n";
if(m_uiSoundBufferHandle == AL_NONE)
{
this->getLogManager() << LogLevel_Error << "ALUT can't create buffer from file "<<m_sFileName<<"\n";
this->getLogManager() << LogLevel_Error << "ALUT ERROR:\n"<<alutGetErrorString(alutGetError ())<<"\n";
return false;
}
break;
}
case FILE_FORMAT_OGG:
{
// On windows using fopen+ov_open can lead to failure, as stated in the vorbis official documentation:
//http://xiph.org/vorbis/doc/vorbisfile/ov_open.html
// using ov_fopen instead.
//m_oOggVorbisStream.File = fopen((const char *)m_sFileName, "rb");
//if (m_oOggVorbisStream.File == NULL)
//{
// this->getLogManager() << LogLevel_Error << "Can't open file "<<m_sFileName<<": IO error\n.";
// return false;
//}
#if defined TARGET_OS_Windows
if(ov_fopen(const_cast<char*>(m_sFileName.toASCIIString()), &m_oOggVorbisStream.Stream) < 0)
#elif defined TARGET_OS_Linux
if((m_oOggVorbisStream.File = fopen((const char *)m_sFileName, "rb")) == NULL)
{
this->getLogManager() << LogLevel_Error << "Can't open file "<<m_sFileName<<": IO error\n.";
return false;
}
if(ov_open(m_oOggVorbisStream.File, &(m_oOggVorbisStream.Stream), NULL, 0) < 0)
#else
#error "Please port this code"
#endif
{
this->getLogManager() << LogLevel_Error << "Can't open file "<<m_sFileName<<": OGG VORBIS stream error\n";
return false;
}
vorbis_info* l_pInfos = ov_info(&m_oOggVorbisStream.Stream, -1);
m_oOggVorbisStream.Format = l_pInfos->channels == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16;
m_oOggVorbisStream.SampleRate = l_pInfos->rate;
//Now we fill the raw buffer (good for small piece of sound... use buffering for big files)
this->getLogManager() << LogLevel_Trace << "Buffering OGG file (this step may take some times for long files).\n";
int32 l_iBytesRead;
int32 bitStream;
char l_pBuffer[BUFFER_SIZE];
do {
// Read up to a buffer's worth of decoded sound data
l_iBytesRead = ov_read(&m_oOggVorbisStream.Stream, l_pBuffer, BUFFER_SIZE, 0, 2, 1, &bitStream);
// Append to end of buffer
m_vRawOggBufferFromFile.insert(m_vRawOggBufferFromFile.end(), l_pBuffer, l_pBuffer + l_iBytesRead);
} while (l_iBytesRead > 0);
this->getLogManager() << LogLevel_Trace << "OGG file buffered.\n";
//we have decoded all the file. we drop the decoder (file is closed for us).
ov_clear(&m_oOggVorbisStream.Stream);
//create empty buffer
alGenBuffers(1, &m_uiSoundBufferHandle);
//fill it with raw data
alBufferData(m_uiSoundBufferHandle, m_oOggVorbisStream.Format, &m_vRawOggBufferFromFile[0], static_cast < ALsizei > (m_vRawOggBufferFromFile.size()), m_oOggVorbisStream.SampleRate);
break;
}
default:
{
this->getLogManager() << LogLevel_Error << "Unsupported file format. Please use only WAV or OGG files.\n";
return false;
}
}
#if UNIQUE_SOURCE
alGenSources(1, &m_uiSourceHandle);
alSourcei (m_uiSourceHandle, AL_BUFFER, m_uiSoundBufferHandle);
alSourcei (m_uiSourceHandle, AL_LOOPING, (m_bLoop?AL_TRUE:AL_FALSE));
#endif
return true;
}
boolean CBoxAlgorithmOpenALSoundPlayer::playSound()
{
switch(m_iFileFormat)
{
case FILE_FORMAT_WAV:
case FILE_FORMAT_OGG:
{
#if UNIQUE_SOURCE
ALint l_uiStatus;
alGetSourcei(m_uiSourceHandle, AL_SOURCE_STATE, &l_uiStatus);
if(l_uiStatus == AL_PLAYING)
{
// we start back again
alSourceStop(m_uiSourceHandle);
}
alSourcePlay(m_uiSourceHandle);
#else
ALuint l_uiSource;
alGenSources(1, &l_uiSource);
m_vOpenALSources.push_back(l_uiSource);
alSourcei (l_uiSource, AL_BUFFER, m_uiSoundBufferHandle);
alSourcei (l_uiSource, AL_LOOPING, (m_bLoop?AL_TRUE:AL_FALSE));
alSourcePlay(l_uiSource);
#endif
break;
}
default:
{
this->getLogManager() << LogLevel_Error << "Unsupported file format. Please use only WAV or OGG files.\n";
return false;
}
}
m_pStimulusSender->sendStimulation(m_ui64PlayTrigger);
return true;
}
boolean CBoxAlgorithmOpenALSoundPlayer::stopSound(bool bForwardStim)
{
switch(m_iFileFormat)
{
case FILE_FORMAT_WAV:
case FILE_FORMAT_OGG:
{
#if UNIQUE_SOURCE
alSourceStop(m_uiSourceHandle);
#else
for(uint32 i = 0;i<m_vOpenALSources.size();i++)
{
//stop all sources
alSourceStop(m_vOpenALSources[i]);
alDeleteSources(1, &m_vOpenALSources[i]);
}
m_vOpenALSources.clear();
#endif
break;
}
default:
{
this->getLogManager() << LogLevel_Error << "Unsupported file format. Please use only WAV or OGG files.\n";
return false;
}
}
if(bForwardStim)
{
m_pStimulusSender->sendStimulation(m_ui64StopTrigger);
}
return true;
}
#endif //TARGET_HAS_ThirdPartyOpenAL
|
f2fcd368ed18f6107a1b2218ade09cb6b6e8a4b6
|
a181564a3b22c176a50e03669106a923c600f03d
|
/include/tern/loggable.h
|
db98b24112479580acefdaed319c276d6ac9342f
|
[
"BSD-2-Clause"
] |
permissive
|
columbia/xtern
|
d22e80a63fbe52bf43291944adbd5133f1a9b5d4
|
1632f127537d0afc3945fd73aa1dce46c46f7904
|
refs/heads/master
| 2022-11-08T02:11:12.673255
| 2013-11-09T07:42:05
| 2013-11-09T07:42:05
| 9,386,039
| 4
| 6
|
NOASSERTION
| 2022-10-23T23:04:02
| 2013-04-12T03:45:54
|
C++
|
UTF-8
|
C++
| false
| false
| 3,064
|
h
|
loggable.h
|
/* Copyright (c) 2013, Regents of the Columbia University
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* Authors: Heming Cui (heming@cs.columbia.edu), Junfeng Yang (junfeng@cs.columbia.edu) -*- Mode: C++ -*- */
#ifndef __TERN_RECORDER_LOGGABLE_H
#define __TERN_RECORDER_LOGGABLE_H
#include <vector>
#include "llvm/Instruction.h"
namespace tern {
/// NotLogged: instruction (or function body) is not logged at all
///
/// Logged: load or store instructions, calls to external non-sync or
/// summarized functions
//
/// LogSync: synchronization calls, logged, but the instrumentation is
/// handled by syncinstr, not loginstr, because replayer also
/// needs it
///
/// LogBBMarker: for marking instructions that purely for telling the
/// instruction log builder that a basic block is executed. See
/// comments in instLogged() in loggable.cpp. LogBBMarker can be
/// omitted if we use more sophisticated reconstruction algorithm.
///
enum LogTag {NotLogged, Logged, LogSync, LogBBMarker};
// LogTag getInstLoggedMD(const llvm::Instruction *I);
// void setInstLoggedMD(llvm::LLVMContext &C, llvm::Instruction *I, LogTag tag);
/// should we log the instruction? can return all four LogTags
LogTag instLogged(llvm::Instruction *ins);
/// should we log instructions in @func? return value can only be
/// NotLogged or Logged (i.e., can't be LogSync or LogBBMarker)
LogTag funcBodyLogged(llvm::Function *func);
/// Should we log calls to @func? return value can only be NotLogged,
/// Logged, or LogSync (i.e., can't be LogBBMarker)
LogTag funcCallLogged(llvm::Function *func);
/// should we log this call ? return value can only be NotLogged or
/// Logged (i.e., can't be LogBBMarker)
LogTag callLogged(llvm::Instruction *call);
}
#endif
|
2db8c1e0311b94f6a9d8894b76e0dbc277879d80
|
1f4faaed016ad93565cbc510380ad174e872020b
|
/3DViewer/test/ch3_frameBuffer.cpp
|
787e7984e82bef761ced9c09ef6cc5dbd247a306
|
[] |
no_license
|
Kpure1000/3DViewer
|
529f3a485b069cd2d79ecc0a6919379f77a5e228
|
4f4c29cb2748da3db96bb0460281bf7062d597f3
|
refs/heads/master
| 2023-03-31T21:49:32.070138
| 2021-04-09T07:00:02
| 2021-04-09T07:00:02
| 311,005,131
| 0
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 3,719
|
cpp
|
ch3_frameBuffer.cpp
|
#include "ch3_test.h"
#include"../render/Render.h"
#include"../graph//Graph.h"
#include"../event/Event.h"
#include"../system/System.h"
#include"../util/Util.h"
using namespace rtx;
using namespace std;
using render::Window;
using graph::CubeMesh;
using graph::SphereMesh;
using graph::Sprite;
int ch3_frameBuffer_main()
{
Window App(glm::vec2(800, 600), "Depth Test",
Window::ClearMode::DepthMode, false);
glm::vec2 appSize = App.GetSize();
auto cb1 = CubeMesh();
auto sp1 = Sprite();
/*sp1.GetTransform().SetOrigin({ 0.5f, 0.5f, -1.0f });
sp1.GetTransform().SetScale({ 2.0f,2.0f,2.0f });*/
auto camera = FPSCamera(glm::vec3(0.0f, 0.0f, 4.0f), glm::vec3(0.0f),
45.0f, appSize.x / appSize.y, 0.01f, 100.0f, 5.0f);
Texture wall;
wall.LoadFromFile("../data/texture/brickwall.jpg");
Shader shader("../data/shader/ch3_depth.vert", "../data/shader/ch3_depth.frag");
Shader renderShader("../data/shader/ch3_frameBuffer.vert",
"../data/shader/ch3_frameBuffer.frag");
renderShader.Use();
renderShader.SetMatrix4("_view", camera.GetCamera().GetView());
renderShader.SetMatrix4("_projection", camera.GetCamera().GetProjection());
renderShader.SetMatrix4("_model", sp1.GetTransform().GetTransMat());
// 创建帧缓冲
unsigned int fbo;
glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
// 创建颜色附件纹理
unsigned int texColorBf;
glGenTextures(1, &texColorBf);
glBindTexture(GL_TEXTURE_2D, texColorBf);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, appSize.x, appSize.y,
0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texColorBf, 0);
// 创建渲染缓冲对象(深度、模板缓冲)
unsigned int rbo;
glGenRenderbuffers(1, &rbo);
glBindRenderbuffer(GL_RENDERBUFFER, rbo);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, appSize.x, appSize.y);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo);
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
{
cerr << "Framebuffer is not complete!\n";
}
glBindFramebuffer(GL_FRAMEBUFFER, 0);
App.DrawStart(Window::DrawMode::Fill);
while (App.isOpen())
{
if (glfwGetKey(App.GetWindow(), GLFW_KEY_ESCAPE) == GLFW_PRESS)
App.Close();
App.pollEvents();
camera.Update(App);
{
// 绑定帧缓冲
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glEnable(GL_DEPTH_TEST);
App.Clear({ 0.2f,0.4f,0.6f,1.0f });
shader.Use();
shader.SetMatrix4("_view", camera.GetCamera().GetView());
shader.SetMatrix4("_projection", camera.GetCamera().GetProjection());
wall.Bind(1);
shader.Use();
shader.SetSampler2D("_tx", 1);
cb1.GetTransform().SetPosition({ 0.0f, 0.0f, 0.0f });
shader.SetMatrix4("_model", cb1.GetTransform().GetTransMat());
App.Draw(cb1);
}
{
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glDisable(GL_DEPTH_TEST);
App.Clear({ 0.4f,0.6f,0.1f,1.0f });
glBindTexture(GL_TEXTURE_2D, texColorBf);
renderShader.Use();
renderShader.SetSampler2D("_tx", 0);
//renderShader.SetMatrix4("_model", sp1.GetTransform().GetTransMat());
App.Draw(sp1);
glEnable(GL_DEPTH_TEST);
shader.Use();
shader.SetMatrix4("_view", camera.GetCamera().GetView());
shader.SetMatrix4("_projection", camera.GetCamera().GetProjection());
wall.Bind(1);
shader.Use();
shader.SetSampler2D("_tx", 1);
cb1.GetTransform().SetPosition({ 0.0f, 0.0f, 0.0f });
shader.SetMatrix4("_model", cb1.GetTransform().GetTransMat());
App.Draw(cb1);
}
App.Display();
}
return 0;
}
|
d7546dde41c8f0f0b10444140520276b74a0520f
|
a49e352b8a3ce0be7fe9a82ed3c38863737c23c8
|
/src/additional_parts_other.h
|
be0748512322e34a2b2f2b10d9bacfcc0deb3a94
|
[
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] |
permissive
|
VNNikolaidis/nnlib2Rcpp
|
7c954d8d0045746a693b426a3575381f493e0f37
|
1e791f75bf39118da0334cb5c722582afb7b0ed0
|
refs/heads/master
| 2023-04-12T10:19:57.047592
| 2023-04-05T08:28:07
| 2023-04-05T08:28:07
| 247,648,982
| 11
| 5
|
NOASSERTION
| 2021-05-23T10:59:41
| 2020-03-16T08:30:13
|
C++
|
UTF-8
|
C++
| false
| false
| 3,545
|
h
|
additional_parts_other.h
|
#ifndef NNLIB2_ADDITIONAL_PARTS_OTHER_H
#define NNLIB2_ADDITIONAL_PARTS_OTHER_H
#include "nn.h"
using namespace nnlib2;
//--------------------------------------------------------------------------------------------
// example for manual.pdf (vignette)
class MEX_connection: public connection
{
public:
// model-specific behavior during mapping stage:
void recall()
{
destin_pe().receive_input_value(pow( source_pe().output - weight() , 2) );
}
// model-specific behavior during training stage:
// in this example, only the current connection weight (i.e. weight())
// and incoming value from the source node (i.e. source_pe().output) are
// used in a series of calculations that eventually change the
// connection weight (see last line).
void encode()
{
double x = source_pe().output - weight();
double s = .3;
double m = weight();
double pi = 2*acos(0.0);
double f = 1/(s*sqrt(2*pi)) * exp(-0.5*pow((x-m)/s,2));
double d = (f * x) / 2;
weight() = weight() + d;
}
};
typedef Connection_Set < MEX_connection > MEX_connection_set;
//--------------------------------------------------------------------------------------------
// example for manual.pdf (vignette)
class MEX_pe : public pe
{
public:
void recall()
{
pe::recall();
output = sqrt(output);
}
};
typedef Layer < MEX_pe > MEX_layer;
//--------------------------------------------------------------------------------------------
// example (for RBloggers blog post): Perceptron components
// see: https://www.r-bloggers.com/2020/07/creating-custom-neural-networks-with-nnlib2rcpp/
// Perceptron nodes:
class perceptron_pe : public pe
{
public:
DATA threshold_function(DATA value)
{
if(value>0) return 1;
return 0;
}
};
// Percepton layer:
typedef Layer < perceptron_pe > perceptron_layer;
// Perceptron connections:
// Note:
// At the example in the post the destination PE inputs were also used to store
// the desired output (iris class). This is mentioned in the post, but was chosen
// for simplicity and compatibility with the nnlib2Rcpp version then available at CRAN.
//
// This version searches for the desired output in the 'misc' register of the
// destination PEs, thus is more correct: the desired value is not an actual PE input.
// To use this while following the post's example, 'use set_misc_values_at'
// instead of 'set_input_at'. I.e. In the post's example code
// replace:
// p$input_at(3,desired_data_out[c,])
// with:
// p$set_misc_values_at(3,desired_data_out[c,])
class perceptron_connection: public connection
{
public:
// multiply incoming (from source node) value by weight and send it to destination node.
void recall()
{
destin_pe().receive_input_value( weight() * source_pe().output );
}
// for simplicity, learning rate is fixed to 0.3. Desired output in 'misc' (was 'input'):
void encode()
{
weight() = weight() + 0.3 * (destin_pe().misc - destin_pe().output) * source_pe().output;
}
};
// Perceptron group of connections
typedef Connection_Set< perceptron_connection > perceptron_connection_set;
//--------------------------------------------------------------------------------------------
// example: a (useless) pe that just adds 10 to the sum of its inputs when recalling data
class JustAdd10_pe : public pe
{
public:
void recall() { pe::recall(); output = output + 10; }
};
typedef Layer < JustAdd10_pe > JustAdd10_layer;
//--------------------------------------------------------------------------------------------
#endif // NNLIB2_ADDITIONAL_PARTS_OTHER_H
|
e810ffedf98746f461a6c81ce50ea139f72ff7be
|
77dc72febe17b0e092af9c57c0b4062ee7876983
|
/RECIPE.cpp
|
7aa8a0ef24bbb5062645c68806dd497811948acd
|
[] |
no_license
|
gautamits/codechef
|
82bc0190e9afe0dc3b428b5214600e97ef1fdb95
|
4265b020bf1d22dfafd19aef08975bd748c54196
|
refs/heads/master
| 2021-09-08T18:10:08.602923
| 2018-03-11T18:18:15
| 2018-03-11T18:18:15
| 105,926,417
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 555
|
cpp
|
RECIPE.cpp
|
#include <bits/stdc++.h>
using namespace std;
int min(int a,int b){
return a<b?a:b;
}
int max(int a,int b){
return a>b?a:b;
}
int hcf(int a,int b){
int mi=min(a,b);
int ma=max(a,b);
int temp;
while(ma%mi!=0){
temp=ma;
ma=mi;
mi=temp%mi;
}
return mi;
}
int main(){
int t;
cin>>t;
int n;
int h;
while(t--){
cin>>n;
int arr[n];
for(int i=0;i<n;i++) cin>>arr[i];
h=arr[0];
for(int i=1;i<n;i++){
h=hcf(h,arr[i]);
}
//cout<<h<<endl;
for(int i=0;i<n;i++) cout<<arr[i]/h<<" ";
cout<<endl;
}
//cout<<endl;
return 0;
}
|
a1d1bbd69368fbccb9e4f698c845678d5563494b
|
3a4bdd47478af76ade46c4fc85d5de292deb64ff
|
/femmd2D/src/driver.cpp
|
590a03a0faa09e74b4e74a0abe395243143d6a14
|
[] |
no_license
|
valeraml/femmd_old
|
a5a1fd727bdda8d14b99e7f65215df2deda3b33c
|
eefa4a53b734a0833456326f530cc4a39c59c89e
|
refs/heads/master
| 2021-06-12T04:31:41.836318
| 2016-12-15T21:19:51
| 2016-12-15T21:19:51
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,464
|
cpp
|
driver.cpp
|
#ifdef _WIN32
#include <direct.h>
#elif defined __linux__
//#include <sys/stat.h>
#include <unistd.h>
#endif
#include <omp.h>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include "md3dsystem.h"
void runInterpreter(int argc, char *argv[]);
/*
TODO
fixed types bug
evalProps and accumProps kernels //DONE
move moveToDevice and moveToHost ouside doStep //DONE
neighbor list kernels //DONE
kernel pointers: : simplify args to kernels //DONE
bonds kernels // DONE
exclusion lists on nn and cuda //DONE
optimize kernels in do_step //DONE
add thermostat
wall kernels //DONE
periodic boundary condition functions //DONE
add boundaries conditions for top and bottom
fea kernels
add dipole
yukawa potential
cython interface
add save properties
add save file every time steps
optimize energy array in compute forces
change PBC to switch statements
*/
////////////////////////////////////////
void InitCoords(MDSystem *sys, int unitCells, real L)
{
VectorR c, gap;
int n, nx, ny;
gap.x = L / unitCells;
gap.y = L / unitCells;
n = 0;
for (ny = 0; ny < unitCells; ny++) {
for (nx = 0; nx < unitCells; nx++) {
//VSet(c, nx + 0.5, ny + 0.5);
c.x = nx + 0.5;
c.y = ny + 0.5;
//VMul(c, c, gap);
c.x = c.x*gap.x;
c.y = c.y*gap.y;
//VVSAdd(c, -0.5, region);
//sys->particles.pos[n] = c;
sys->particles.addParticle(c.x, c.y, 1.0, 1.0, 0);
++n;
}
}
}
void addElesatorms(MDSystem *sys, int N){
std::ifstream v_file("diskVertices.txt");
if (v_file.bad())
{
// Dump the contents of the file to cout.
std::cout << v_file.rdbuf();
v_file.close();
}
std::vector<real> vtemp;
real temp;
while (v_file >> temp) {
temp = temp;
vtemp.push_back(temp);
}
std::ifstream t_file("diskTriangles.txt");
if (t_file.bad())
{
// Dump the contents of the file to cout.
std::cout << t_file.rdbuf();
t_file.close();
}
std::vector<int> temp_t;
int tempi;
while (t_file >> tempi) {
temp_t.push_back(tempi);
}
// Calculate scale factor s = 1/r0 = 1/(V0/(N*0.9*PI))
// r0 radius of inner particles whet the disk has Radius 1
// V0 = PI*R^2
int Ndisk = vtemp.size() / 2;
real r0 = sqrt(0.5*0.5 / Ndisk); // 0.75 ad hoc factor
real scale = 0.5/r0;
printf("r0 %f scale %f R %f A0 %f Af %f expected A %f\n", r0, scale, scale*r0, PI*r0*r0, PI*r0*r0*scale*scale, PI*0.5*0.5);
//scale simulation box
sys->box.x *= scale;
sys->box.y *= scale;
//scale particles pos
for (int i = 0; i < vtemp.size(); i++){
vtemp[i] *= scale;
}
real L = sys->box.x;
///sys->particles.addElastomer(vtemp.data(), vtemp.size() / 2, temp_t.data(), temp_t.size() / 3, 2*L/3, 2*L/3, 0, 0, 1.0);
//sys->particles.addElastomer(vtemp.data(), vtemp.size() / 2, temp_t.data(), temp_t.size() / 3, 2*L/3, L/3, 0, 0, 1.0);
//return;
VectorR c;
int nx, ny;
real b = L / sqrt(N);
int ncells = L / b;
for (nx = 0; nx < ncells; nx++){
for (ny = 0; ny < ncells; ny++){
c.x = nx + 0.5;
c.y = ny + 0.5;
c.x = c.x*b;
c.y = c.y*b;
sys->particles.addElastomer(vtemp.data(), vtemp.size() / 2, temp_t.data(), temp_t.size() / 3, c.x, c.y, 0, 0, 1.0, N, true);
}
}
}
int c_main(){
//_chdir("C:\\Users\\manuel.valera\\Dropbox\\research\\cuda2\\data");
//_chdir("C:\\tmp");
#ifdef _WIN32
_chdir("C:\\tmp");
#elif defined __linux__
chdir("/home/manuel/tmp");
#endif
int ucells = 20;
int N = ucells*ucells;
//int N = 10;
real dens = 0.5;
real L = sqrt(N / dens);
real T = 0.5;
real v0 = sqrt(2.0 * T * (1.0-1.0/N));
MDSystem sys(0);
sys.setDevice(CPU);
sys.init(L, L);
sys.particles.numTypes = 1;
sys.dt = 0.001;
//sys.makeFCCBox(N, L, 0, 0);
InitCoords(&sys, ucells, L);
//addElesatorms(&sys,N);
sys.useNN = true;
sys.pbcType = XYPBC;
sys.interactions.gravity = 0;
sys.interactions.gravityForce = false;
sys.interactions.E = 5;
sys.interactions.kBond = 10;
sys.interactions.kArea = .0001;
sys.interactions.bondForces = false;
sys.interactions.feaForces = false;
sys.interactions.areaForces = false;
sys.interactions.setElasticConstants();
real eps[] = { 1.0 };
real rCut[] = { pow(2.0, 1.0 / 6.0) };
rCut[0] = 3.0;
real uShift[] = { 1.0 };
uShift[0] = 0.0;
// real eps[] = { 1.0, 1.0, 1.0, 1.0 };
// real r0 = pow(2.0, 1.0 / 6.0);
// real rCut[] = { r0, r0, r0, r0 };
// real uShift[] = { 1.0, 1.0, 1.0, 1.0 };
sys.interactions.setPairForce(eps, rCut, uShift);
sys.particles.setParticlesVel(v0);
sys.allocateCuda();
if(sys.useNN)
sys.neighborlist.init();
//sys.particles.checkOverlap();
//sys.setTemperature(sys.atomGroups[0],T);
sys.saveVTF("movie.vtf", 0);
//sys.saveVtk("movie");
//sys.saveXYZ("movie.xyz", 0);
//return 0;
sys.start = true;
//for (int i = 0; i < 10; i++){
//sys.setTemperature(T);
//sys.integrator.run(100);
//}
for (int i = 0; i<10000; i++){
sys.integrator.run(10000);
printf("%d %f %f %f %f %f\n", sys.steps, sys.props.uKinetic.avgval, sys.props.uPotential.avgval,
sys.props.uTotal.avgval, sys.props.virial.avgval, sys.props.pressure.avgval);
sys.saveVTF("movie.vtf", 1);
//sys.saveXYZ("movie.xyz", 1);
//sys.saveVtk("movie");
//sys.saveVtkXML("movieVTU");
//sys.saveVtkXMLBin("movieVTUBin");
//sys.saveVtkXMLBin1("testVTUBin");
}
return 0;
}
int js_main(int argc, char *argv[]) {
runInterpreter(argc, argv);
return 0;
}
int main(int argc, char *argv[]) {
#ifdef _WIN32
//_chdir("C:\\tmp");
#elif defined __linux__
//chdir("/home/manuel/tmp");
#endif
//return c_main();
return js_main(argc,argv);
}
|
cbaa399d932b791b0d583501626cb4b1067de89b
|
2151bfe9beabe9dbe6bc9cc69233c8a1fae546fd
|
/source/CPP-Mini-project/Client.hpp
|
653b5c25a45f5173f24fb1fd8571bc983ba34ebc
|
[] |
no_license
|
99002620/cpp-mini-project
|
37ad874e4ba05cfa5c109e76c18bb822ea79401e
|
0901adf3391e2253758965838cd22670e2c7e6bf
|
refs/heads/main
| 2023-01-05T13:43:18.996177
| 2020-11-10T11:30:43
| 2020-11-10T11:30:43
| 304,583,055
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,752
|
hpp
|
Client.hpp
|
#ifndef HEADER_H
#define HEADER_H
/**
Author: Pravesh Gaire
Class client contains the methods used for graphics implemented using gtkmm-3.0 and socket implemented in linux
Works on Ubuntu provided that gtkmm is installed
*/
#include<gtkmm.h>
#include<iostream> //cout
#include<string> //string
#include<sys/socket.h> //socket
#include<arpa/inet.h> //inet_addr
#include<netdb.h> //hostent
#include<unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <netinet/in.h>
//#include"client.cpp"
using namespace std;
class Client:public Gtk::Window
{
private:
Gtk::TreeView *treeview;
Gtk::Label *label;
Gtk::Entry *text;
Gtk::ScrolledWindow *scroll;
std::string emessage;
std::string Username;
int sockfd, numbytes;
char buf[256];
struct addrinfo hints, *servinfo, *p;
int rv;
char s[INET6_ADDRSTRLEN];
public:
Client();
bool receiveMessage();
void createClientSocket();
void *get_in_addr(struct sockaddr *);
void sendMessage(const char *);
void login();
void chat();
void on_button4_click();
void on_button3_click();
void on_button2_click();
void on_button1_click();
void showClients();
void displayText(std::string ,string );
void on_login_click(Gtk::Entry *,Gtk::Entry *);
std::string onlineClients();
class ModelColumns:public Gtk::TreeModel::ColumnRecord
{
public:
ModelColumns()
{
add(col_name);add(col_text);add(col_online);
}
Gtk::TreeModelColumn<Glib::ustring>col_name;
Gtk::TreeModelColumn<Glib::ustring>col_text;
Gtk::TreeModelColumn<Glib::ustring>col_online;
};
ModelColumns columns;
Glib::RefPtr<Gtk::ListStore>refTreeModel;
virtual ~Client(){}
};
#endif // HEADER_H
|
61ce48dd11d25e8fcb6b003c1e7daab8104749e6
|
b3e68160720b83bf92bf6d9aaac87f104fedad1f
|
/p6_64位整数乘法.cpp
|
4d6e12e394661d2e0c674feb688d2fdbe2d49750
|
[] |
no_license
|
wjfjfm/Algorithm-competition-advanced-guide
|
8bca9db4f15bcc99bf95cba280e436fba367f842
|
0b76c4db6516e705d51ae7309abd977a22af3ea4
|
refs/heads/master
| 2022-03-14T02:33:26.118805
| 2019-11-11T05:38:34
| 2019-11-11T05:38:34
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 362
|
cpp
|
p6_64位整数乘法.cpp
|
#include<iostream>
long long mul(long long a, long long b, long long p){
a %= p, b%= p;
long long c = (long double) a * b / p;
long long ans = a * b - c * p;
if (ans < 0) ans += p;
else if (ans >= p) ans -= p;
return ans;
}
int main(){
using namespace std;
long long a,b,p;
cout<<"input a b p"<<endl;
cin>>a>>b>>p;
cout<<mul(a,b,p)<<endl;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.