hexsha
stringlengths 40
40
| size
int64 7
1.05M
| ext
stringclasses 13
values | lang
stringclasses 1
value | max_stars_repo_path
stringlengths 4
269
| max_stars_repo_name
stringlengths 5
109
| max_stars_repo_head_hexsha
stringlengths 40
40
| max_stars_repo_licenses
listlengths 1
9
| max_stars_count
int64 1
191k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 4
269
| max_issues_repo_name
stringlengths 5
116
| max_issues_repo_head_hexsha
stringlengths 40
40
| max_issues_repo_licenses
listlengths 1
9
| max_issues_count
int64 1
48.5k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 4
269
| max_forks_repo_name
stringlengths 5
116
| max_forks_repo_head_hexsha
stringlengths 40
40
| max_forks_repo_licenses
listlengths 1
9
| max_forks_count
int64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 7
1.05M
| avg_line_length
float64 1.21
330k
| max_line_length
int64 6
990k
| alphanum_fraction
float64 0.01
0.99
| author_id
stringlengths 2
40
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8e27b8f69bd4c6ef07d4ebdc6d55e6ba669c8e09
| 2,382
|
cpp
|
C++
|
Day12/12.cpp
|
Legolaszstudio/aoc2021
|
dc2e341738e11a55232ae0f37aa0cc5625d8d831
|
[
"BSD-3-Clause"
] | null | null | null |
Day12/12.cpp
|
Legolaszstudio/aoc2021
|
dc2e341738e11a55232ae0f37aa0cc5625d8d831
|
[
"BSD-3-Clause"
] | null | null | null |
Day12/12.cpp
|
Legolaszstudio/aoc2021
|
dc2e341738e11a55232ae0f37aa0cc5625d8d831
|
[
"BSD-3-Clause"
] | null | null | null |
#include <string>
#include <fstream>
#include <sstream>
#include <deque>
#include <vector>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <set>
struct Graph {
std::unordered_map<std::string, std::vector<std::string>> tree;
//WARNING It is not the best option to store the entire solutions but I wanted to see all the combinations
std::vector<std::vector<std::string>> solutions;
};
void walkGraph(Graph& graph, std::string currentNode, std::vector<std::string> path, std::multiset<std::string> visited, bool partTwo);
void startSolving(Graph& graph, bool partTwo);
int main() {
Graph graph;
std::string line;
std::ifstream file("12.txt");
while (std::getline(file, line)) {
std::stringstream X(line);
std::string nodeName;
std::vector<std::string> temp = {};
while (std::getline(X, nodeName, '-')) {
temp.push_back(nodeName);
}
graph.tree[temp[0]].push_back(temp[1]);
graph.tree[temp[1]].push_back(temp[0]);
}
startSolving(graph, false);
int solution = graph.solutions.size();
std::cout << "There were " << solution << " possible solutions for part1" << std::endl;
std::cout << "To run second part press enter:" << std::endl << std::endl;
getchar();
graph.solutions = {};
startSolving(graph, true);
solution = graph.solutions.size();
std::cout << "There were " << solution << " possible solutions for part2" << std::endl;
return 0;
}
void startSolving(Graph& graph, bool partTwo) {
// Store solution
std::vector<std::string> path = {};
// Store visited nodes
std::multiset<std::string> visited = {};
// We visited twice
walkGraph(graph, "start", path, visited, partTwo);
}
void walkGraph(Graph& graph, std::string currentNode, std::vector<std::string> path, std::multiset<std::string> visited, bool partTwo) {
if (std::islower(currentNode[0])) {
if (visited.count(currentNode) == 1) { partTwo = false; }
visited.insert(currentNode);
}
path.push_back(currentNode);
if (currentNode == "end") {
graph.solutions.push_back(path);
//Uncomment to print solutions
//for (const auto& item : path) {
// std::cout << item << ",";
//}
//std::cout << std::endl;
} else {
for (const auto& item : graph.tree[currentNode]) {
if (item == "start") continue;
if (!visited.count(item) > 0 || (partTwo && visited.count(item) < 2)) {
walkGraph(graph, item, path, visited, partTwo);
}
}
}
}
| 30.538462
| 136
| 0.669186
|
Legolaszstudio
|
8e2ce4cd297c21145788a920086b875e6bc37617
| 12,262
|
cpp
|
C++
|
groups/bal/balb/balb_leakybucket.cpp
|
AlisdairM/bde
|
bc65db208c32513aa545080f57090cc39c608be0
|
[
"Apache-2.0"
] | 1
|
2022-01-23T11:31:12.000Z
|
2022-01-23T11:31:12.000Z
|
groups/bal/balb/balb_leakybucket.cpp
|
AlisdairM/bde
|
bc65db208c32513aa545080f57090cc39c608be0
|
[
"Apache-2.0"
] | null | null | null |
groups/bal/balb/balb_leakybucket.cpp
|
AlisdairM/bde
|
bc65db208c32513aa545080f57090cc39c608be0
|
[
"Apache-2.0"
] | null | null | null |
// balb_leakybucket.cpp -*-C++-*-
#include <balb_leakybucket.h>
#include <bsls_ident.h>
BSLS_IDENT_RCSID(balb_leakybucket.cpp,"$Id$ $CSID$")
#include <bsl_c_math.h>
namespace BloombergLP {
namespace {
bsls::Types::Uint64 calculateNumberOfUnitsToDrain(
bsls::Types::Uint64* fractionalUnitDrainedInNanoUnits,
bsls::Types::Uint64 drainRate,
const bsls::TimeInterval& timeInterval)
// Return the number of units that would be drained from a leaky bucket
// over the specified 'timeInterval' at the specified 'drainRate', plus the
// specified 'fractionalUnitDrainedInNanoUnits', representing a fractional
// remainder from a previous call to 'calculateNumberOfUnitsToDrain'. Load
// into 'fractionalUnitDrainedInNanoUnits' the fractional remainder
// (between 0.0 and 1.0, represented in nano-units) from this calculation.
// The behavior is undefined unless
// '0 <= *fractionalUnitDrainedInNanoUnits < 1000000000' (i.e., it
// represents a value between 0 and 1 unit) and
// 'timeInterval.seconds() * drainRate <= ULLONG_MAX'. Note that
// 'fractionalUnitDrainedInNanoUnits' is represented in nano-units to avoid
// using a floating point representation.
{
const bsls::Types::Uint64 k_NANOUNITS_PER_UNIT = 1000000000;
BSLS_ASSERT(static_cast<bsls::Types::Uint64>(timeInterval.seconds()) <=
ULLONG_MAX / drainRate);
BSLS_ASSERT(0 != fractionalUnitDrainedInNanoUnits);
BSLS_ASSERT(*fractionalUnitDrainedInNanoUnits < k_NANOUNITS_PER_UNIT);
bsls::Types::Uint64 units = drainRate * timeInterval.seconds();
units += (drainRate / k_NANOUNITS_PER_UNIT) * timeInterval.nanoseconds();
bsls::Types::Uint64 nanounits = 0;
// As long as rate is represented by a whole number, the fractional part
// of number of units to drain comes from fractional part of seconds of
// the time interval
nanounits = *fractionalUnitDrainedInNanoUnits +
(drainRate % k_NANOUNITS_PER_UNIT) * timeInterval.nanoseconds();
*fractionalUnitDrainedInNanoUnits = nanounits % k_NANOUNITS_PER_UNIT;
units += nanounits / k_NANOUNITS_PER_UNIT;
return units;
}
} // close unnamed namespace
namespace balb {
//------------------
// class LeakyBucket
//------------------
// CLASS METHODS
bsls::Types::Uint64 LeakyBucket::calculateCapacity(
bsls::Types::Uint64 drainRate,
const bsls::TimeInterval& timeWindow)
{
BSLS_ASSERT(1 == drainRate ||
timeWindow <= LeakyBucket::calculateDrainTime(ULLONG_MAX,
drainRate,
false));
bsls::Types::Uint64 fractionalUnitsInNanoUnits = 0;
bsls::Types::Uint64 capacity = calculateNumberOfUnitsToDrain(
&fractionalUnitsInNanoUnits,
drainRate,
timeWindow);
// Round the returned capacity to 1, which is okay, because it does not
// affect the drain rate.
return (0 != capacity) ? capacity : 1;
}
bsls::TimeInterval LeakyBucket::calculateDrainTime(
bsls::Types::Uint64 numUnits,
bsls::Types::Uint64 drainRate,
bool ceilFlag)
{
BSLS_ASSERT(drainRate > 1 || numUnits <= LLONG_MAX);
bsls::TimeInterval interval(0,0);
interval.addSeconds(numUnits / drainRate);
bsls::Types::Uint64 remUnits = numUnits % drainRate;
const double nanoSecs = static_cast<double>(remUnits) * 1e9 /
static_cast<double>(drainRate);
interval.addNanoseconds(static_cast<bsls::Types::Int64>(
ceilFlag ? ceil(nanoSecs) : floor(nanoSecs)));
return interval;
}
bsls::TimeInterval LeakyBucket::calculateTimeWindow(
bsls::Types::Uint64 drainRate,
bsls::Types::Uint64 capacity)
{
BSLS_ASSERT(drainRate > 0);
BSLS_ASSERT(drainRate > 1 || capacity <= LLONG_MAX);
bsls::TimeInterval window = LeakyBucket::calculateDrainTime(capacity,
drainRate,
true);
if (0 == window) {
window.addNanoseconds(1);
}
return window;
}
// CREATORS
LeakyBucket::LeakyBucket(bsls::Types::Uint64 drainRate,
bsls::Types::Uint64 capacity,
const bsls::TimeInterval& currentTime)
: d_drainRate(drainRate)
, d_capacity(capacity)
, d_unitsReserved(0)
, d_unitsInBucket(0)
, d_fractionalUnitDrainedInNanoUnits(0)
, d_lastUpdateTime(currentTime)
, d_statSubmittedUnits(0)
, d_statSubmittedUnitsAtLastUpdate(0)
, d_statisticsCollectionStartTime(currentTime)
{
BSLS_ASSERT_OPT(0 < d_drainRate);
BSLS_ASSERT_OPT(0 < d_capacity);
BSLS_ASSERT(LLONG_MIN != currentTime.seconds());
// Calculate the maximum interval between updates that would not cause the
// number of units drained to overflow an unsigned 64-bit integral type.
if (drainRate == 1) {
// 'd_maxUpdateInterval' is a signed 64-bit integral type that can't
// represent 'ULLONG_MAX' number of seconds, so we set
// 'd_maxUpdateInterval' to the maximum representable value when
// 'drainRate' is 1.
d_maxUpdateInterval = bsls::TimeInterval(LLONG_MAX, 999999999);
}
else {
d_maxUpdateInterval = LeakyBucket::calculateDrainTime(ULLONG_MAX,
drainRate,
false);
}
}
// MANIPULATORS
bsls::TimeInterval LeakyBucket::calculateTimeToSubmit(
const bsls::TimeInterval& currentTime)
{
bsls::Types::Uint64 usedUnits = d_unitsInBucket + d_unitsReserved;
// Return 0-length time interval if units can be submitted right now.
if (usedUnits < d_capacity) {
return bsls::TimeInterval(0, 0); // RETURN
}
updateState(currentTime);
// Return 0-length time interval if units can be submitted after the state
// has been updated.
if (d_unitsInBucket + d_unitsReserved < d_capacity) {
return bsls::TimeInterval(0, 0); // RETURN
}
bsls::TimeInterval timeToSubmit(0,0);
bsls::Types::Uint64 backlogUnits;
// From here, 'd_unitsInBucket + d_unitsReserved' is always greater than
// 'd_capacity'
backlogUnits = d_unitsInBucket + d_unitsReserved - d_capacity + 1;
timeToSubmit = LeakyBucket::calculateDrainTime(backlogUnits,
d_drainRate,
true);
// Return 1 nanosecond if the time interval was rounded to zero (in cases
// of high drain rates).
if (timeToSubmit == 0) {
timeToSubmit.addNanoseconds(1);
}
return timeToSubmit;
}
void LeakyBucket::setRateAndCapacity(bsls::Types::Uint64 newRate,
bsls::Types::Uint64 newCapacity)
{
BSLS_ASSERT_SAFE(0 < newRate);
BSLS_ASSERT_SAFE(0 < newCapacity);
d_drainRate = newRate;
d_capacity = newCapacity;
// Calculate the maximum interval between updates that would not cause the
// number of units drained to overflow an unsigned 64-bit integral type.
if (newRate == 1) {
d_maxUpdateInterval = bsls::TimeInterval(LLONG_MAX, 999999999);
}
else {
d_maxUpdateInterval = LeakyBucket::calculateDrainTime(ULLONG_MAX,
newRate,
false);
}
}
void LeakyBucket::updateState(const bsls::TimeInterval& currentTime)
{
BSLS_ASSERT(LLONG_MIN != currentTime.seconds());
bsls::TimeInterval delta = currentTime - d_lastUpdateTime;
d_statSubmittedUnitsAtLastUpdate = d_statSubmittedUnits;
// If delta is greater than the time it takes to drain the maximum number
// of units representable by 64 bit integral type, then reset
// 'unitsInBucket'.
if (delta > d_maxUpdateInterval) {
d_lastUpdateTime = currentTime;
d_unitsInBucket = 0;
d_fractionalUnitDrainedInNanoUnits = 0;
return; // RETURN
}
if (delta >= bsls::TimeInterval(0, 0)) {
bsls::Types::Uint64 units;
units = calculateNumberOfUnitsToDrain(
&d_fractionalUnitDrainedInNanoUnits,
d_drainRate,
delta);
if (units < d_unitsInBucket) {
d_unitsInBucket -= units;
}
else {
d_unitsInBucket = 0;
}
}
else {
// The delta maybe negative when the system clocks are updated. If the
// specified 'currentTime' precedes 'statisticsCollectionStartTime',
// adjust it to prevent the statistics collection interval from going
// negative.
if (currentTime < d_statisticsCollectionStartTime) {
d_statisticsCollectionStartTime = currentTime;
}
}
d_lastUpdateTime = currentTime;
}
bool LeakyBucket::wouldOverflow(const bsls::TimeInterval& currentTime)
{
updateState(currentTime);
if (1 > ULLONG_MAX - d_unitsInBucket - d_unitsReserved ||
d_unitsInBucket + d_unitsReserved + 1 > d_capacity) {
return true; // RETURN
}
return false;
}
// ACCESSORS
void LeakyBucket::getStatistics(bsls::Types::Uint64* submittedUnits,
bsls::Types::Uint64* unusedUnits) const
{
BSLS_ASSERT(0 != submittedUnits);
BSLS_ASSERT(0 != unusedUnits);
*submittedUnits = d_statSubmittedUnitsAtLastUpdate;
bsls::Types::Uint64 fractionalUnits = 0;
// 'monitoredInterval' can not be negative, as the 'updateState' method
// ensures that 'd_lastUpdateTime' always precedes
// 'statisticsCollectionStartTime'.
bsls::TimeInterval monitoredInterval = d_lastUpdateTime -
d_statisticsCollectionStartTime;
bsls::Types::Uint64 drainedUnits = calculateNumberOfUnitsToDrain(
&fractionalUnits,
d_drainRate,
monitoredInterval);
if (drainedUnits < d_statSubmittedUnitsAtLastUpdate) {
*unusedUnits = 0;
}
else {
*unusedUnits = drainedUnits - d_statSubmittedUnitsAtLastUpdate;
}
}
} // close package namespace
} // close enterprise namespace
// ----------------------------------------------------------------------------
// Copyright 2021 Bloomberg Finance L.P.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------- END-OF-FILE ----------------------------------
| 36.494048
| 79
| 0.576333
|
AlisdairM
|
8e2efa1781bfb88bc7793216fa25a00987bde79b
| 681
|
cpp
|
C++
|
framework/source/metadata_backward_compatibility.cpp
|
xrEngine512/interop
|
c80711fbbe08f350ad5d8058163770f57ed20b0c
|
[
"MIT"
] | null | null | null |
framework/source/metadata_backward_compatibility.cpp
|
xrEngine512/interop
|
c80711fbbe08f350ad5d8058163770f57ed20b0c
|
[
"MIT"
] | 4
|
2017-05-31T12:34:10.000Z
|
2018-10-13T18:53:03.000Z
|
framework/source/metadata_backward_compatibility.cpp
|
xrEngine512/MosaicFramework
|
c80711fbbe08f350ad5d8058163770f57ed20b0c
|
[
"MIT"
] | 1
|
2020-04-23T14:09:11.000Z
|
2020-04-23T14:09:11.000Z
|
//
// Created by islam on 14.01.18.
//
#include "metadata_backward_compatibility.h"
#include "exceptions.h"
namespace interop {
module_metadata_t convert_metadata_to_current(const version_t & version, const void * metadata)
{
/** version of module's interop ABI matches version of node **/
if (version == interop_framework_abi_version_m) {
return *reinterpret_cast<const module_metadata_t *>(metadata);
} else {
throw error_t("unable to convert metadata of version " + version.to_string() +
" to current format version (" + interop_framework_abi_version_m.to_string() +
")");
}
}
} // namespace interop
| 32.428571
| 100
| 0.671072
|
xrEngine512
|
8e3f6cf476c45f2b7a7bef65b062dc198e4b0edc
| 13,656
|
hpp
|
C++
|
server/http_context.hpp
|
photonmaster/scymnus
|
bcbf580091a730c63e15b67b6331705a281ba20b
|
[
"MIT"
] | 7
|
2021-08-19T01:11:21.000Z
|
2021-08-31T15:25:51.000Z
|
server/http_context.hpp
|
photonmaster/scymnus
|
bcbf580091a730c63e15b67b6331705a281ba20b
|
[
"MIT"
] | null | null | null |
server/http_context.hpp
|
photonmaster/scymnus
|
bcbf580091a730c63e15b67b6331705a281ba20b
|
[
"MIT"
] | null | null | null |
#pragma once
#include <filesystem>
#include <fstream>
#include <charconv>
#include "core/named_tuple.hpp"
#include "core/traits.hpp"
#include "date_manager.hpp"
#include "external/json.hpp"
#include "http/http_common.hpp"
#include "http/query_parser.hpp"
#include "http_request.hpp"
#include "http_response.hpp"
#include "mime/mime.hpp"
#include "server/memory_resource_manager.hpp"
//#include "url/url.hpp"
#include "external/decimal_from.hpp"
namespace scymnus {
template <int Status> using status_t = std::integral_constant<int, Status>;
template <int Status> constexpr status_t<Status> status;
template <http_content_type ContentType>
using content_t = std::integral_constant<http_content_type, ContentType>;
template <http_content_type ContentType>
constexpr content_t<ContentType> content_type;
struct no_content {};
template <int Status, class T,
http_content_type ContentType = http_content_type::NONE>
struct meta_info {
static constexpr int status = Status;
static constexpr http_content_type content_type = ContentType;
};
struct context {
using allocator_type = std::pmr::polymorphic_allocator<char>;
std::pmr::string *output_buffer_;
explicit context(std::pmr::string *output_buffer,
allocator_type allocator = {})
: output_buffer_{output_buffer}, raw_url_{allocator}, req_{allocator},
res_{allocator} {}
const std::pmr::string &raw_url() const { return raw_url_; }
http_method method() const { return method_; }
// request related methods
const http_request &request() const { return req_; }
const std::pmr::string &request_body() const { return req_.body_; }
void add_request_header(const std::pmr::string &field,
const std::pmr::string &value) {
req_.headers_.emplace(field, value);
}
void add_request_header(std::pmr::string &&field, std::pmr::string &&value) {
req_.headers_.emplace(std::move(field), std::move(value));
}
// response related methods
const http_response &response() const { return res_; }
std::string_view response_body() const { return res_.body_; }
void add_response_header(const std::pmr::string &field,
const std::pmr::string &value) {
res_.headers_.emplace(field, value);
}
void add_response_header(std::pmr::string &&field, std::pmr::string &&value) {
res_.headers_.emplace(std::move(field), std::move(value));
}
template <http_content_type ContentType, int Status, int N, class... H>
auto write_as(status_t<Status> st, const char (&body)[N], H &&...headers) {
start_buffer_position_ = output_buffer_->size();
using json = nlohmann::json;
static_assert(ContentType != http_content_type::NONE,
"a content type, different from NONE, must be selected");
content_type = ContentType;
res_.status_code_ = st;
output_buffer_->append(status_codes.at(Status));
output_buffer_->append(to_string_view(ContentType));
for (auto &v : res_.headers_) {
output_buffer_->append(v.first);
output_buffer_->append(":");
output_buffer_->append(v.second);
output_buffer_->append("\r\n");
}
output_buffer_->append("Content-Length:");
char buff[24];
if constexpr (ContentType == http_content_type::JSON) {
json v = body;
auto payload = v.dump();
auto size = payload.size();
output_buffer_->append(decimal_from(size, buff));
//output_buffer_->append(fmt::format_int(size).c_str());
output_buffer_->append("\r\nServer:scymnus\r\n");
date_manager::instance().append_http_time(*output_buffer_);
output_buffer_->append(payload);
res_.body_ = {output_buffer_->end() - size, output_buffer_->end()};
} else {
output_buffer_->append(decimal_from(N-1, buff));
//output_buffer_->append(fmt::format_int(N - 1).c_str());
output_buffer_->append("\r\nServer:scymnus\r\n");
date_manager::instance().append_http_time(*output_buffer_);
output_buffer_->append(body);
res_.body_ = {output_buffer_->end() - N - 1, output_buffer_->end()};
}
return meta_info<Status, const char *, ContentType>{};
}
template <http_content_type ContentType, int Status, class T, class... H>
auto write_as(status_t<Status> st, T &&body, H &&...headers) {
static_assert(ContentType != http_content_type::NONE,
"a content type, different from NONE, must be selected");
start_buffer_position_ = output_buffer_->size();
using json = nlohmann::json;
content_type = ContentType;
if constexpr (is_string_like_v<T>) {
res_.status_code_ = st;
if constexpr (ContentType == http_content_type::JSON) {
if (json::accept(body)) {
write_response_headers(body.size());
output_buffer_->append(body);
res_.body_ = {output_buffer_->end() - body.size(),
output_buffer_->end()};
} else {
auto payload = json(std::forward<T>(body)).dump();
write_response_headers(payload.size());
output_buffer_->append(payload);
res_.body_ = {output_buffer_->end() - payload.size(),
output_buffer_->end()};
}
return meta_info<sizeof(T)?Status:0, T, http_content_type::JSON>{};
} else { // plain text
write_response_headers(body.size());
output_buffer_->append(body);
res_.body_ = {output_buffer_->end() - body.size(),
output_buffer_->end()};
return meta_info<sizeof(T)?Status:0, T, http_content_type::PLAIN_TEXT>{};
}
}
else if constexpr (std::is_constructible_v<json, std::remove_cv_t<T>>) {
static_assert(sizeof(T) && ContentType == http_content_type::JSON,
"content type must be JSON");
auto payload = json(std::forward<T>(body)).dump();
res_.status_code_ = st;
write_response_headers(payload.size());
output_buffer_->append(payload);
res_.body_ = {output_buffer_->end() - payload.size(),
output_buffer_->end()};
return meta_info<sizeof(T)?Status:0, T, ContentType>{};
}
else {
static_assert(!sizeof(T), "Type not supported");
}
};
template <int Status, int N, class... H>
auto write(status_t<Status> st, const char (&body)[N], H &&...headers) {
start_buffer_position_ = output_buffer_->size();
content_type = http_content_type::PLAIN_TEXT;
res_.status_code_ = st;
output_buffer_->append(status_codes.at(Status));
output_buffer_->append(to_string_view(http_content_type::PLAIN_TEXT));
for (auto &v : res_.headers_) {
output_buffer_->append(v.first);
output_buffer_->append(":");
output_buffer_->append(v.second);
output_buffer_->append("\r\n");
}
output_buffer_->append("Content-Length:");
char buff[24];
output_buffer_->append(decimal_from(N-1, buff));
//output_buffer_->append(fmt::format_int(N - 1).c_str());
output_buffer_->append("\r\nServer:scymnus\r\n");
date_manager::instance().append_http_time(*output_buffer_);
output_buffer_->append(body);
res_.body_ = {output_buffer_->end() - N - 1, output_buffer_->end()};
return meta_info<Status, const char *, http_content_type::PLAIN_TEXT>{};
}
template <int Status, class T, class... H>
auto write(status_t<Status> st, T &&body, H &&...headers) {
using json = nlohmann::json;
start_buffer_position_ = output_buffer_->size();
if constexpr (std::is_same_v<std::remove_cv_t<T>, std::string>) {
content_type = http_content_type::PLAIN_TEXT;
res_.status_code_ = st;
write_response_headers(body.size());
output_buffer_->append(body);
res_.body_ = {output_buffer_->end() - body.size(), output_buffer_->end()};
return meta_info<Status, T, http_content_type::PLAIN_TEXT>{};
} else if constexpr (std::is_constructible_v<json, std::remove_cv_t<T>>) {
json v = std::forward<T>(body);
auto payload = v.dump();
content_type = http_content_type::JSON;
res_.status_code_ = st;
write_response_headers(payload.size());
output_buffer_->append(payload);
res_.body_ = {output_buffer_->end() - payload.size(),
output_buffer_->end()};
return meta_info<Status, T, http_content_type::JSON>{};
}
else {
static_assert(!sizeof(T), "Type is not supported");
}
};
// for No Content
template <int Status, class... H>
[[deprecated("HTTP status code should be 204 when there is no content")]] auto
write(status_t<Status> st, H &&...headers) requires(Status == 200) {
write_no_content<Status>();
return meta_info<Status, no_content, http_content_type::NONE>{};
}
template <int Status, class... H>
auto write(status_t<Status> st, H &&...headers) requires(Status != 200) {
write_no_content<Status>();
return meta_info<Status, no_content, http_content_type::NONE>{};
}
void write_file(const std::filesystem::path &p) {
namespace fs = std::filesystem;
if (!p.has_filename() || !fs::exists(p)) {
write(status<404>);
return;
}
std::ifstream stream(p.c_str(), std::ios::binary);
std::string body(std::istreambuf_iterator<char>{stream}, {});
auto ct = mime_map::content_type(p.extension().string());
if (ct) {
std::pmr::string value{memory_resource_manager::instance().pool()};
value.append(*ct);
add_response_header("Content-Type", std::move(value));
}
res_.status_code_ = 200;
write_response_headers(body.size());
output_buffer_->append(body);
res_.body_ = {output_buffer_->end() - body.size(), output_buffer_->end()};
}
void write_response_headers(std::size_t size) {
if (res_.status_code_.value() == 200)
output_buffer_->append("HTTP/1.1 200 OK\r\n");
else {
auto status = status_codes.at(res_.status_code_.value_or(500), 500);
output_buffer_->append(status);
}
if (content_type != http_content_type::NONE)
output_buffer_->append(to_string_view(content_type));
for (auto &v : res_.headers_) {
output_buffer_->append(v.first);
output_buffer_->append(":");
output_buffer_->append(v.second);
output_buffer_->append("\r\n");
}
output_buffer_->append("Content-Length:");
char buff[24];
output_buffer_->append(decimal_from(size, buff));
//output_buffer_->append(fmt::format_int(size).c_str());
output_buffer_->append("\r\nServer:scymnus\r\n");
date_manager::instance().append_http_time(*output_buffer_);
}
// in case of an exception clear is called to clean up
// the output_buffer
// erase might throw an out of range exception if start_buffer_position is
// beyond end of string
void clear() noexcept {
if (is_response_written()){
res_.reset();
output_buffer_->erase(start_buffer_position_, std::string::npos);
}
}
void reset() {
query_.reset();
raw_url_.clear();
req_.reset();
res_.reset();
start_buffer_position_ = std::numeric_limits<size_t>::max();
}
bool is_response_written() {
return start_buffer_position_ != std::numeric_limits<size_t>::max();
}
// write support
query_string get_query_string() {
if (query_)
return query_.value();
query_ = query_string();
auto query_start = raw_url_.find('?');
if (query_start != std::string::npos && query_start != raw_url_.size()) {
query_.value().parse(
{raw_url_.data() + query_start + 1, raw_url_.size()});
}
return query_.value();
}
http_content_type content_type{http_content_type::NONE};
private:
friend class connection;
template <int Status> void write_no_content() {
start_buffer_position_ = output_buffer_->size();
res_.status_code_ = Status;
output_buffer_->append(status_codes.at(Status));
for (auto &v : res_.headers_) {
output_buffer_->append(v.first);
output_buffer_->append(":");
output_buffer_->append(v.second);
output_buffer_->append("\r\n");
}
output_buffer_->append("Content-Length:0");
output_buffer_->append("\r\nServer:scymnus\r\n");
date_manager::instance().append_http_time(*output_buffer_);
}
http_request req_;
http_response res_;
std::optional<query_string> query_;
http_method method_;
std::pmr::string raw_url_;
std::size_t start_buffer_position_{std::numeric_limits<size_t>::max()};
};
} // namespace scymnus
| 36.126984
| 89
| 0.603691
|
photonmaster
|
8e4db243cb4788f9aafac665ea049faaf53059e3
| 1,105
|
cpp
|
C++
|
Actividad2_recibe/ventanaarchivoexistente.cpp
|
adricatena/I2-puertoSerie
|
cb9efbde2bf30e517649e80a9ebb585449194287
|
[
"MIT"
] | null | null | null |
Actividad2_recibe/ventanaarchivoexistente.cpp
|
adricatena/I2-puertoSerie
|
cb9efbde2bf30e517649e80a9ebb585449194287
|
[
"MIT"
] | null | null | null |
Actividad2_recibe/ventanaarchivoexistente.cpp
|
adricatena/I2-puertoSerie
|
cb9efbde2bf30e517649e80a9ebb585449194287
|
[
"MIT"
] | null | null | null |
#include "ventanaarchivoexistente.h"
#include "ui_ventanaarchivoexistente.h"
VentanaArchivoExistente::VentanaArchivoExistente(QWidget *parent) :
QDialog(parent),
ui(new Ui::VentanaArchivoExistente)
{
ui->setupUi(this);
configuracion = new QSettings("Informatica II", "Actividad 2", this);
}
VentanaArchivoExistente::~VentanaArchivoExistente()
{
delete configuracion;
delete ui;
}
void VentanaArchivoExistente::on_btnAceptar_clicked()
{
if(ui->checkBoxSi->isChecked() && ui->checkBoxNo->isChecked())
{
msj.setText("Error! Ambas opciones estan seleccionadas.");
msj.exec();
}
else
{
if(ui->checkBoxNo->isChecked())
{
QString nombreViejo = configuracion->value("Nombre", "").toString();
QString nombreNuevo = nombreViejo.left(nombreViejo.lastIndexOf('/')) + ui->leNombreArchivo->text();
configuracion->setValue("Nombre", nombreNuevo);
}
QDialog::accept();
}
}
void VentanaArchivoExistente::on_btnCancelar_clicked()
{
close();
}
| 26.95122
| 112
| 0.640724
|
adricatena
|
8e56d9e614f40f44f8657bdba23674583775c8bd
| 2,620
|
cpp
|
C++
|
src/frame_transformation.cpp
|
sakshikakde/human-detector-and-tracker
|
04e1fd08b858ababfa4fa91da8306890ef1d7d00
|
[
"MIT"
] | null | null | null |
src/frame_transformation.cpp
|
sakshikakde/human-detector-and-tracker
|
04e1fd08b858ababfa4fa91da8306890ef1d7d00
|
[
"MIT"
] | 3
|
2021-10-16T05:46:37.000Z
|
2021-10-18T22:16:20.000Z
|
src/frame_transformation.cpp
|
sakshikakde/human-detector-and-tracker
|
04e1fd08b858ababfa4fa91da8306890ef1d7d00
|
[
"MIT"
] | 2
|
2021-10-06T02:52:31.000Z
|
2021-10-06T05:16:28.000Z
|
/**
* MIT License
*
* Copyright (c) 2021 Anubhav Paras, Sakshi Kakde, Siddharth Telang
*
* 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.
*
* @file frame_transformation.cpp
* @author Anubhav Paras (anubhav@umd.edu)
* @author Sakshi Kakde (sakshi@umd.edu)
* @author Siddharth Telang (stelang@umd.edu)
* @brief Performs frame transformation
* @version 0.1
* @date 2021-10-25
*
* @copyright Copyright (c) 2021
*
*/
#include <frame_transformation.hpp>
FrameTransformation::FrameTransformation() {
// camera intrinsic matrix
this->K = Eigen::MatrixXf(3, 3);
this->K << 964.828979, 0, 643.788025, 0, 964.828979, 484.407990, 0, 0, 1;
this->T_c = Eigen::MatrixXf(3, 4);
this->T_c << 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0;
this->T_r = Eigen::MatrixXf(4, 4);;
this->T_r<< 0, 0, 1, 10, -1, 0, 0, 10, 0, -1, 0, 10, 0, 0, 0, 1;
// Projection matrix
this->P = this->K * this->T_c * this->T_r;
}
FrameTransformation::~FrameTransformation() {}
Coord3D FrameTransformation::getRobotFrame(Coord2D imageCoordinates) {
// logic goes here
// Calculate P inverse
Eigen::MatrixXf P_T = this->P.transpose();
Eigen::MatrixXf P_inv = P_T * (this->P * P_T).inverse();
// Image coordinates to homogenous coordinates
Eigen::MatrixXf x(3, 1);
x << imageCoordinates.x, imageCoordinates.y, 1;
Eigen::MatrixXf X = P_inv * x;
// populate Coord3D
Coord3D X_robot;
if (X(3, 0) != 0) {
X_robot.x = X(0, 0) / X(3, 0);
X_robot.y = X(1, 0) / X(3, 0);
X_robot.z = X(2, 0) / X(3, 0);
} else {
return Coord3D(0, 0, 0);
}
return X_robot;
}
| 35.890411
| 81
| 0.681679
|
sakshikakde
|
8e5c5cf73edd2031dd4c597f8ce890c017208f5d
| 3,459
|
hh
|
C++
|
include/tchecker/system/intvar.hh
|
arnabSur/tchecker
|
24ba7703068a41c6e9c613b4ef80ad6c788e65bc
|
[
"MIT"
] | 7
|
2019-08-12T12:22:07.000Z
|
2021-11-18T01:48:27.000Z
|
include/tchecker/system/intvar.hh
|
arnabSur/tchecker
|
24ba7703068a41c6e9c613b4ef80ad6c788e65bc
|
[
"MIT"
] | 40
|
2019-07-03T04:31:19.000Z
|
2022-03-31T03:40:43.000Z
|
include/tchecker/system/intvar.hh
|
arnabSur/tchecker
|
24ba7703068a41c6e9c613b4ef80ad6c788e65bc
|
[
"MIT"
] | 8
|
2019-07-04T06:40:49.000Z
|
2021-12-03T15:51:50.000Z
|
/*
* This file is a part of the TChecker project.
*
* See files AUTHORS and LICENSE for copyright details.
*
*/
#ifndef TCHECKER_SYSTEM_INTVAR_HH
#define TCHECKER_SYSTEM_INTVAR_HH
#include <limits>
#include <stdexcept>
#include <string>
#include <vector>
#include "tchecker/basictypes.hh"
#include "tchecker/system/attribute.hh"
#include "tchecker/variables/intvars.hh"
/*!
\file intvar.hh
\brief Bounded integer variables in systems
*/
namespace tchecker {
namespace system {
/*!
\class intvars_t
\brief Collection of bounded integer variables
*/
class intvars_t {
public:
/*!
\brief Add an integer variable
\param name : variable name
\param size : variable size (array of integer variables)
\param min : minimal value
\param max : maximal value
\param initial : initial calue
\param attr : attributes
\pre name is not a declared integer variable
\post variable name with minimal value min, maximal value max, initial value init and attributes attr has been added
\throw std::invalid_argument : if name is a declared integer variable
*/
void add_intvar(std::string const & name, tchecker::intvar_id_t size = 1,
tchecker::integer_t min = std::numeric_limits<tchecker::integer_t>::min(),
tchecker::integer_t max = std::numeric_limits<tchecker::integer_t>::max(),
tchecker::integer_t initial = std::numeric_limits<tchecker::integer_t>::min(),
tchecker::system::attributes_t const & attr = tchecker::system::attributes_t());
/*!
\brief Accessor
\param kind : kind of declared variable
\return number of declared bounded integer variables if kind = tchecker::VK_DECLARED,
number of flattened bounded integer variables if kind = tchecker::VK_FLATTENED
*/
inline tchecker::intvar_id_t intvars_count(enum tchecker::variable_kind_t kind) const
{
return _integer_variables.size(kind);
}
/*!
\brief Accessor
\param name : variable name
\return identifier of variable name
\throw std::invalid_argument : if name is not am integer variable
*/
inline tchecker::intvar_id_t intvar_id(std::string const & name) const { return _integer_variables.id(name); }
/*!
\brief Accessor
\param id : variable identifier
\return name of integer variable id
\throw std::invalid_argument : if id is not an integer variable
*/
inline std::string const & intvar_name(tchecker::intvar_id_t id) const { return _integer_variables.name(id); }
/*!
\brief Accessor
\param id : integer variable identifier
\return attributes of integer variable id
\throw std::invalid_argument : if id is not an integer variable
*/
tchecker::system::attributes_t const & intvar_attributes(tchecker::intvar_id_t id) const;
/*!
\brief Accessor
\param name : integer variable name
\return true if name is a declared integer variable, false otherwise
*/
bool is_intvar(std::string const & name) const;
/*!
\brief Accessor
\return integer variables
*/
inline tchecker::integer_variables_t const & integer_variables() const { return _integer_variables; }
private:
tchecker::integer_variables_t _integer_variables; /*!< Integer variables */
std::vector<tchecker::system::attributes_t> _integer_variables_attr; /*!< Integer variables attributes */
};
} // end of namespace system
} // end of namespace tchecker
#endif // TCHECKER_SYSTEM_INTVAR_HH
| 31.162162
| 119
| 0.713501
|
arnabSur
|
8e5eff5c63cdb00e353c2626a812851af7f7b89e
| 5,673
|
hpp
|
C++
|
modules/gate_ops/bit_group/bit_group.hpp
|
ICHEC/QNLP
|
2966c7f71e6979c7ddef62520c3749cf6473fabe
|
[
"Apache-2.0"
] | 29
|
2020-04-13T04:40:35.000Z
|
2021-12-17T11:21:35.000Z
|
modules/gate_ops/bit_group/bit_group.hpp
|
ICHEC/QNLP
|
2966c7f71e6979c7ddef62520c3749cf6473fabe
|
[
"Apache-2.0"
] | 6
|
2020-03-12T17:40:00.000Z
|
2021-01-20T12:15:08.000Z
|
modules/gate_ops/bit_group/bit_group.hpp
|
ICHEC/QNLP
|
2966c7f71e6979c7ddef62520c3749cf6473fabe
|
[
"Apache-2.0"
] | 9
|
2020-09-28T05:00:30.000Z
|
2022-03-04T02:11:49.000Z
|
/**
* @file bit_group.hpp
* @author Lee J. O'Riordan (lee.oriordan@ichec.ie)
* @brief Implements grouping of bits to LSB side of register
* @version 0.1
* @date 2019-04-02
* @detailed This header file introduces routines for bit-wise shifting of set bits to the side of a register (ie |01010> -> |00011>).
* Note: yes, we are cheating to reset the qubits by Hadamrding and measuring in Z-basis. Uncompute steps to follow.
*
* @copyright Copyright (c) 2020
*/
#ifndef QNLP_BIT_GROUP
#define QNLP_BIT_GROUP
#include<algorithm>
namespace QNLP{
/**
* @brief Class definition for bit-wise grouping in register.
*
* @tparam SimulatorType
*/
template <class SimulatorType>
class BitGroup{
private:
/**
* @brief Swap the qubits if `qreg_idx0` is set and `qreg_idx1` is not.
* Uses Auxiliary qubits `qaux_idx` which are set to |10> at start and end of operations.
*
* @param qSim Quantum simulator object derived from SimulatorGeneral
* @param qreg_idx0 Index of qubit 0 in qSim qubit register
* @param qreg_idx1 Index of qubit 1 in qSim qubit register
* @param qaux_idx Indices of auxiliary qubits in qSim qubit register that are set to |10>
*/
static void q_ops(SimulatorType& qSim, std::size_t qreg_idx0, std::size_t qreg_idx1, const std::vector<std::size_t>& qaux_idx){
//Swap if C0 is set and C1 is not
qSim.applyGateCCX(qreg_idx0, qaux_idx[0], qaux_idx[1]);
qSim.applyGateCCX(qreg_idx1, qreg_idx0, qaux_idx[1]);
qSim.applyGateCSwap(qaux_idx[1], qreg_idx0, qreg_idx1);
//Reset Aux gate to |0>
qSim.applyGateH(qaux_idx[1]);
qSim.collapseToBasisZ(qaux_idx[1], 0);
}
/*
//@brief WIP:Swaps all qubits in register indices given by qreg_idx to their right-most positions.
// Method works from opposing ends of register and subregisters iteratively until all qubits are in the correct positions.
//
//@param qSim Quantum simulator object derived from SimulatorGeneral
//@param qreg_idx Indices of the qSim register to group to the LSB position.
//@param qaux_idx Indices of auxiliary qubits in qSim register
static void bit_swap_s2e(SimulatorType& qSim, const std::vector<std::size_t>& qreg_idx, const std::vector<std::size_t>& qaux_idx){
assert(qaux_idx.size() >= 2);
std::size_t num_qubits = qreg_idx.size();
//Apply the op from opposite ends of register working towards centre, reduce size from left, then repeat until 2 qubits remain.
qSim.applyGateX(qaux_idx[0]);
for(int num_offset=0; num_offset < qreg_idx.size()/2 + 1 + qreg_idx.size()%2; num_offset++){
for(std::size_t i=0; i < num_qubits/2 + num_qubits%2; i++){
if (i + num_offset == num_qubits - (i+1) + num_offset)
continue;
q_ops(qSim, qreg_idx[i + num_offset], qreg_idx[num_qubits - (i+1) + num_offset], qaux_idx);
}
num_qubits--;
}
qSim.applyGateX(qaux_idx[0]);
}*/
/**
* @brief Swaps all qubits in register indices given by qreg_idx to their right-most positions.
* Method works by pairing qubits using even-odd indexed cycles iteratively until all qubits are in the correct positions.
*
*
* @param qSim Quantum simulator object derived from SimulatorGeneral
* @param qreg_idx Indices of the qSim register to group to the LSB position.
* @param qaux_idx Indices of auxiliary qubits in qSim register in |00> state
*/
static void bit_swap_pair(SimulatorType& qSim, const std::vector<std::size_t>& qreg_idx, const std::vector<std::size_t>& qaux_idx, bool lsb){
bool isOdd = qreg_idx.size() % 2;
qSim.applyGateX(qaux_idx[0]);
for(std::size_t num_steps = 0; num_steps < qreg_idx.size(); num_steps++){
for(int i = 0; i < qreg_idx.size()-1; i+=2){
if(i + 1 + isOdd < qreg_idx.size()){
if(lsb)
q_ops(qSim, qreg_idx[i + isOdd], qreg_idx[i + 1 + isOdd], qaux_idx);
else
q_ops(qSim, qreg_idx[i + 1 + isOdd], qreg_idx[i + isOdd], qaux_idx);
}
}
isOdd = !isOdd;
}
qSim.applyGateX(qaux_idx[0]);
}
public:
/**
* @brief Swaps all qubits in register indices given by qreg_idx to their right-most positions.
* Method works by pairing qubits using even-odd indexed cycles iteratively until all qubits are in the correct positions.
* Intermediate qubit reset operation may not be realisable on all platforms (Hadarmard followed by SigmaZ projection to |0>)
*
* @param qSim Quantum simulator object derived from SimulatorGeneral
* @param qreg_idx Indices of the qSim register to group to the LSB position.
* @param qaux_idx Indices of auxiliary qubits in qSim register in |00> state
* @param lsb Indicates if to shift the values to the MSB or LSB equivalent positions.
*/
static void bit_group(SimulatorType& qSim, const std::vector<std::size_t>& qreg_idx, const std::vector<std::size_t>& qaux_idx, bool lsb=true){
bit_swap_pair(qSim, qreg_idx, qaux_idx, lsb);
}
};
}
#endif
| 47.275
| 150
| 0.609907
|
ICHEC
|
8e60171a198c91c1f18eba310410edbff7d07090
| 4,895
|
cpp
|
C++
|
ngraph/frontend/onnx_import/src/utils/onnx_internal.cpp
|
kenkoyanagi/openvino
|
864b3ba62fb86e685c847ca84016043cdea870c5
|
[
"Apache-2.0"
] | 1
|
2021-04-22T07:28:03.000Z
|
2021-04-22T07:28:03.000Z
|
ngraph/frontend/onnx_import/src/utils/onnx_internal.cpp
|
kenkoyanagi/openvino
|
864b3ba62fb86e685c847ca84016043cdea870c5
|
[
"Apache-2.0"
] | 105
|
2020-06-04T00:23:29.000Z
|
2022-02-21T13:04:33.000Z
|
ngraph/frontend/onnx/onnx_import/src/utils/onnx_internal.cpp
|
mpapaj/openvino
|
37b46de1643a2ba6c3b6a076f81d0a47115ede7e
|
[
"Apache-2.0"
] | 3
|
2021-04-25T06:52:41.000Z
|
2021-05-07T02:01:44.000Z
|
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <onnx/onnx_pb.h>
#include "core/graph.hpp"
#include "core/model.hpp"
#include "core/null_node.hpp"
#include "core/transform.hpp"
#include "onnx_import/onnx_framework_node.hpp"
#include "onnx_import/utils/onnx_internal.hpp"
namespace ngraph
{
namespace onnx_import
{
namespace detail
{
void remove_dangling_parameters(std::shared_ptr<Function>& function)
{
const auto parameters = function->get_parameters();
for (auto parameter : parameters)
{
const auto parameter_users = parameter->get_users();
// if a Parameter is connected to a ONNXFrameworkNode that was not converted
// during convert_function it means, this Parameter is dangling and we can
// remove it from function
const bool is_dangling_parameter = std::all_of(
parameter_users.begin(),
parameter_users.end(),
[](const std::shared_ptr<ngraph::Node>& node) -> bool {
return std::dynamic_pointer_cast<frontend::ONNXFrameworkNode>(node) !=
nullptr;
});
if (is_dangling_parameter)
{
function->remove_parameter(parameter);
}
}
}
void remove_dangling_results(std::shared_ptr<Function>& function)
{
const auto results = function->get_results();
for (auto result : results)
{
// we can remove Result from function if after function conversion,
// Result is connected to NullNode only
const auto result_inputs = result->input_values();
const bool is_dangling_result =
std::all_of(result_inputs.begin(),
result_inputs.end(),
[](const Output<ngraph::Node>& node) -> bool {
return ngraph::op::is_null(node);
});
if (is_dangling_result)
{
function->remove_result(result);
}
}
}
void convert_decoded_function(std::shared_ptr<Function> function)
{
for (const auto& node : function->get_ordered_ops())
{
if (auto raw_node =
std::dynamic_pointer_cast<frontend::ONNXFrameworkNode>(node))
{
if (auto subgraph_node =
std::dynamic_pointer_cast<frontend::ONNXSubgraphFrameworkNode>(
node))
{
subgraph_node->infer_inputs_from_parent();
convert_decoded_function(subgraph_node->get_subgraph_body());
}
const auto& onnx_node = raw_node->get_onnx_node();
OutputVector ng_nodes{onnx_node.get_ng_nodes()};
if (ng_nodes.size() > raw_node->get_output_size())
{
ng_nodes.resize(raw_node->get_output_size());
}
replace_node(raw_node, ng_nodes);
}
else
{
// Have to revalidate node because new intpus can affect shape/type
// propagation for already translated nodes
node->revalidate_and_infer_types();
}
}
remove_dangling_parameters(function);
remove_dangling_results(function);
}
std::shared_ptr<Function> import_onnx_model(ONNX_NAMESPACE::ModelProto& model_proto,
const std::string& model_path)
{
transform::expand_onnx_functions(model_proto);
transform::fixup_legacy_operators(model_proto);
transform::update_external_data_paths(model_proto, model_path);
auto p_model_proto = common::make_unique<ONNX_NAMESPACE::ModelProto>(model_proto);
auto model = common::make_unique<Model>(std::move(p_model_proto));
Graph graph{std::move(model)};
return graph.convert();
}
} // namespace detail
} // namespace onnx_import
} // namespace ngraph
| 43.705357
| 98
| 0.489275
|
kenkoyanagi
|
76a412372c85c9f49be328ce89adba110ab8bef5
| 56,487
|
cpp
|
C++
|
src/test/analysis.cpp
|
akazachk/vpc
|
2339159e963b30287f780b6c03202fcbf0e9c131
|
[
"MIT"
] | 6
|
2019-03-18T00:22:43.000Z
|
2022-03-16T19:21:21.000Z
|
src/test/analysis.cpp
|
akazachk/vpc
|
2339159e963b30287f780b6c03202fcbf0e9c131
|
[
"MIT"
] | 14
|
2019-03-18T03:30:53.000Z
|
2020-10-08T15:32:45.000Z
|
src/test/analysis.cpp
|
akazachk/vpc
|
2339159e963b30287f780b6c03202fcbf0e9c131
|
[
"MIT"
] | 2
|
2021-10-05T17:44:29.000Z
|
2021-11-04T20:45:01.000Z
|
/**
* @file analysis.cpp
* @author A. M. Kazachkov
* @date 2019-03-04
*/
#include "analysis.hpp"
// COIN-OR
#include <OsiSolverInterface.hpp>
#include <OsiCuts.hpp>
#include <CglGMI.hpp>
// Project files
#include "BBHelper.hpp"
#include "CglVPC.hpp"
#include "CutHelper.hpp"
#include "Disjunction.hpp"
#include "PartialBBDisjunction.hpp"
#include "PRLP.hpp"
#include "SolverHelper.hpp"
#include "VPCParameters.hpp"
using namespace VPCParametersNamespace;
#include "utility.hpp" // isInfinity, stringValue
const int countBoundInfoEntries = 11;
const int countGapInfoEntries = 4;
const int countSummaryBBInfoEntries = 4 * 2;
const int countFullBBInfoEntries = static_cast<int>(BB_INFO_CONTENTS.size()) * 4 * 2;
const int countOrigProbEntries = 13;
const int countPostCutProbEntries = 10;
const int countDisjInfoEntries = 12;
const int countCutInfoEntries = 10;
const int countObjInfoEntries = 1 + 4 * static_cast<int>(CglVPC::ObjectiveType::NUM_OBJECTIVE_TYPES);
const int countFailInfoEntries = 1 + static_cast<int>(CglVPC::FailureType::NUM_FAILURE_TYPES);
const int countParamInfoEntries = intParam::NUM_INT_PARAMS + doubleParam::NUM_DOUBLE_PARAMS + stringParam::NUM_STRING_PARAMS;
int countTimeInfoEntries = 0; // set in printHeader
const int countVersionInfoEntries = 5;
const int countExtraInfoEntries = 4;
void printHeader(const VPCParameters& params,
const std::vector<std::string>& time_name,
const char SEP) {
FILE* logfile = params.logfile;
if (logfile == NULL)
return;
countTimeInfoEntries = time_name.size();
// First line of the header details the categories of information displayed
std::string tmpstring = "";
fprintf(logfile, "%c", SEP);
fprintf(logfile, "%s", "PARAM INFO");
tmpstring.assign(countParamInfoEntries, SEP);
fprintf(logfile, "%s", tmpstring.c_str());
fprintf(logfile, "%s", "BOUND INFO");
tmpstring.assign(countBoundInfoEntries, SEP);
fprintf(logfile, "%s", tmpstring.c_str());
fprintf(logfile, "%s", "GAP INFO");
tmpstring.assign(countGapInfoEntries, SEP);
fprintf(logfile, "%s", tmpstring.c_str());
fprintf(logfile, "%s", "BB INFO");
tmpstring.assign(countSummaryBBInfoEntries, SEP);
fprintf(logfile, "%s", tmpstring.c_str());
fprintf(logfile, "%s", "ORIG PROB");
tmpstring.assign(countOrigProbEntries, SEP);
fprintf(logfile, "%s", tmpstring.c_str());
fprintf(logfile, "%s", "POST-CUT PROB");
tmpstring.assign(countPostCutProbEntries, SEP);
fprintf(logfile, "%s", tmpstring.c_str());
fprintf(logfile, "%s", "DISJ INFO");
tmpstring.assign(countDisjInfoEntries, SEP);
fprintf(logfile, "%s", tmpstring.c_str());
fprintf(logfile, "%s", "CUT INFO");
tmpstring.assign(countCutInfoEntries, SEP);
fprintf(logfile, "%s", tmpstring.c_str());
fprintf(logfile, "%s", "OBJ INFO");
tmpstring.assign(countObjInfoEntries, SEP);
fprintf(logfile, "%s", tmpstring.c_str());
fprintf(logfile, "%s", "FAIL INFO");
tmpstring.assign(countFailInfoEntries, SEP);
fprintf(logfile, "%s", tmpstring.c_str());
fprintf(logfile, "%s", "FULL BB INFO");
tmpstring.assign(countFullBBInfoEntries, SEP);
fprintf(logfile, "%s", tmpstring.c_str());
fprintf(logfile, "%s", "TIME INFO");
tmpstring.assign(countTimeInfoEntries, SEP);
fprintf(logfile, "%s", tmpstring.c_str());
fprintf(logfile, "%s", "VERSION INFO");
tmpstring.assign(countVersionInfoEntries, SEP);
fprintf(logfile, "%s", tmpstring.c_str());
fprintf(logfile, "%s", "WRAP UP INFO");
tmpstring.assign(countExtraInfoEntries, SEP);
fprintf(logfile, "%s", tmpstring.c_str());
fprintf(logfile, "%s", "END");
fprintf(logfile, "\n");
fprintf(logfile, "%s%c", "INSTANCE", SEP);
{ // PARAM INFO
//printParams(params, logfile, 1); // names for int/double params
printParams(params, logfile, 7); // names for int/double/string params
} // PARAM INFO
{ // BOUND INFO
int count = 0;
fprintf(logfile, "%s%c", "LP OBJ", SEP); count++; // 1
fprintf(logfile, "%s%c", "BEST DISJ OBJ", SEP); count++; // 2
fprintf(logfile, "%s%c", "WORST DISJ OBJ", SEP); count++; // 3
fprintf(logfile, "%s%c", "IP OBJ", SEP); count++; // 4
fprintf(logfile, "%s%c", "NUM GMIC", SEP); count++; // 5
fprintf(logfile, "%s%c", "GMIC OBJ", SEP); count++; // 6
fprintf(logfile, "%s%c", "NUM L&PC", SEP); count++; // 7
fprintf(logfile, "%s%c", "L&PC OBJ", SEP); count++; // 8
fprintf(logfile, "%s%c", "NUM VPC", SEP); count++; // 9
fprintf(logfile, "%s%c", "VPC OBJ", SEP); count++; // 10
fprintf(logfile, "%s%c", "VPC+GMIC OBJ", SEP); count++; // 11
assert(count == countBoundInfoEntries);
} // BOUND INFO
{ // GAP INFO
int count = 0;
fprintf(logfile, "%s%c", "GMIC % GAP CLOSED", SEP); count++; // 1
fprintf(logfile, "%s%c", "L&PC % GAP CLOSED", SEP); count++; // 2
fprintf(logfile, "%s%c", "VPC % GAP CLOSED", SEP); count++; // 3
fprintf(logfile, "%s%c", "GMIC+VPC % GAP CLOSED", SEP); count++; // 4
assert(count == countGapInfoEntries);
} // GAP INFO
{ // BB INFO
int count = 0;
std::vector<std::string> nameVec = {"NODES", "TIME"};
for (auto name : nameVec) {
fprintf(logfile, "%s%c", ("FIRST REF " + name).c_str(), SEP); count++;
fprintf(logfile, "%s%c", ("FIRST REF+V " + name).c_str(), SEP); count++;
fprintf(logfile, "%s%c", ("BEST REF " + name).c_str(), SEP); count++;
fprintf(logfile, "%s%c", ("BEST REF+V " + name).c_str(), SEP); count++;
}
assert(count == countSummaryBBInfoEntries);
} // BB INFO
{ // ORIG PROB
int count = 0;
fprintf(logfile, "%s%c", "ROWS", SEP); count++;
fprintf(logfile, "%s%c", "COLS", SEP); count++;
fprintf(logfile, "%s%c", "NUM FRAC", SEP); count++;
fprintf(logfile, "%s%c", "MIN FRACTIONALITY", SEP); count++;
fprintf(logfile, "%s%c", "MAX FRACTIONALITY", SEP); count++;
fprintf(logfile, "%s%c", "EQ ROWS", SEP); count++;
fprintf(logfile, "%s%c", "BOUND ROWS", SEP); count++;
fprintf(logfile, "%s%c", "ASSIGN ROWS", SEP); count++;
fprintf(logfile, "%s%c", "FIXED COLS", SEP); count++;
fprintf(logfile, "%s%c", "GEN INT", SEP); count++;
fprintf(logfile, "%s%c", "BINARY", SEP); count++;
fprintf(logfile, "%s%c", "CONTINUOUS", SEP); count++;
fprintf(logfile, "%s%c", "A-DENSITY", SEP); count++;
assert(count == countOrigProbEntries);
} // ORIG PROB
{ // POST-CUT PROB
int count = 0;
fprintf(logfile, "%s%c", "NEW NUM FRAC", SEP); count++;
fprintf(logfile, "%s%c", "NEW MIN FRACTIONALITY", SEP); count++;
fprintf(logfile, "%s%c", "NEW MAX FRACTIONALITY", SEP); count++;
fprintf(logfile, "%s%c", "NEW A-DENSITY", SEP); count++;
fprintf(logfile, "%s%c", "ACTIVE GMIC (gmics)", SEP); count++;
fprintf(logfile, "%s%c", "ACTIVE VPC (gmics)", SEP); count++;
fprintf(logfile, "%s%c", "ACTIVE GMIC (vpcs)", SEP); count++;
fprintf(logfile, "%s%c", "ACTIVE VPC (vpcs)", SEP); count++;
fprintf(logfile, "%s%c", "ACTIVE GMIC (all cuts)", SEP); count++;
fprintf(logfile, "%s%c", "ACTIVE VPC (all cuts)", SEP); count++;
assert(count == countPostCutProbEntries);
} // POST-CUT PROB
{ // DISJ INFO
int count = 0;
fprintf(logfile, "%s%c", "NUM DISJ TERMS", SEP); count++;
fprintf(logfile, "%s%c", "NUM INTEGER SOL", SEP); count++;
fprintf(logfile, "%s%c", "NUM DISJ", SEP); count++;
// fprintf(logfile, "%s%c", "MIN DENSITY PRLP", SEP); count++;
// fprintf(logfile, "%s%c", "MAX DENSITY PRLP", SEP); count++;
fprintf(logfile, "%s%c", "AVG DENSITY PRLP", SEP); count++;
// fprintf(logfile, "%s%c", "MIN ROWS PRLP", SEP); count++;
// fprintf(logfile, "%s%c", "MAX ROWS PRLP", SEP); count++;
fprintf(logfile, "%s%c", "AVG ROWS PRLP", SEP); count++;
// fprintf(logfile, "%s%c", "MIN COLS PRLP", SEP); count++;
// fprintf(logfile, "%s%c", "MAX COLS PRLP", SEP); count++;
fprintf(logfile, "%s%c", "AVG COLS PRLP", SEP); count++;
// fprintf(logfile, "%s%c", "MIN POINTS PRLP", SEP); count++;
// fprintf(logfile, "%s%c", "MAX POINTS PRLP", SEP); count++;
fprintf(logfile, "%s%c", "AVG POINTS PRLP", SEP); count++;
// fprintf(logfile, "%s%c", "MIN RAYS PRLP", SEP); count++;
// fprintf(logfile, "%s%c", "MAX RAYS PRLP", SEP); count++;
fprintf(logfile, "%s%c", "AVG RAYS PRLP", SEP); count++;
fprintf(logfile, "%s%c", "AVG PARTIAL BB EXPLORED NODES", SEP); count++;
fprintf(logfile, "%s%c", "AVG PARTIAL BB PRUNED NODES", SEP); count++;
fprintf(logfile, "%s%c", "AVG PARTIAL BB MIN DEPTH", SEP); count++;
fprintf(logfile, "%s%c", "AVG PARTIAL BB MAX DEPTH", SEP); count++;
assert(count == countDisjInfoEntries);
} // DISJ INFO
{ // CUT INFO
int count = 0;
fprintf(logfile, "%s%c", "NUM ROUNDS", SEP); count++;
fprintf(logfile, "%s%c", "NUM CUTS", SEP); count++; // repeat, but it's ok
fprintf(logfile, "%s%c", "NUM ONE SIDED CUTS", SEP); count++;
fprintf(logfile, "%s%c", "NUM OPTIMALITY CUTS", SEP); count++;
fprintf(logfile, "%s%c", "MIN SUPPORT VPC", SEP); count++;
fprintf(logfile, "%s%c", "MAX SUPPORT VPC", SEP); count++;
fprintf(logfile, "%s%c", "AVG SUPPORT VPC", SEP); count++;
fprintf(logfile, "%s%c", "MIN SUPPORT GOMORY", SEP); count++;
fprintf(logfile, "%s%c", "MAX SUPPORT GOMORY", SEP); count++;
fprintf(logfile, "%s%c", "AVG SUPPORT GOMORY", SEP); count++;
assert(count == countCutInfoEntries);
} // CUT INFO
{ // OBJ INFO
// For each objective: num obj, num fails, num active
int count = 0;
fprintf(logfile, "%s%c", "NUM OBJ", SEP); count++;
for (int obj_ind = 0; obj_ind < static_cast<int>(CglVPC::ObjectiveType::NUM_OBJECTIVE_TYPES); obj_ind++) {
fprintf(logfile, "NUM OBJ %s%c", CglVPC::ObjectiveTypeName[obj_ind].c_str(), SEP); count++;
fprintf(logfile, "NUM CUTS %s%c", CglVPC::ObjectiveTypeName[obj_ind].c_str(), SEP); count++;
fprintf(logfile, "NUM FAILS %s%c", CglVPC::ObjectiveTypeName[obj_ind].c_str(), SEP); count++;
fprintf(logfile, "NUM ACTIVE %s%c", CglVPC::ObjectiveTypeName[obj_ind].c_str(), SEP); count++;
}
assert(count == countObjInfoEntries);
} // OBJ INFO
{ // FAIL INFO
int count = 0;
fprintf(logfile, "%s%c", "NUM FAILS", SEP); count++;
for (int fail_ind = 0; fail_ind < static_cast<int>(CglVPC::FailureType::NUM_FAILURE_TYPES); fail_ind++) {
fprintf(logfile, "%s%c", CglVPC::FailureTypeName[fail_ind].c_str(), SEP); count++;
}
assert(count == countFailInfoEntries);
} // FAIL INFO
{ // FULL BB INFO
int count = 0;
for (std::string name : BB_INFO_CONTENTS) {
fprintf(logfile, "%s%c", ("FIRST REF " + name).c_str(), SEP); count++;
fprintf(logfile, "%s%c", ("FIRST REF+V " + name).c_str(), SEP); count++;
fprintf(logfile, "%s%c", ("BEST REF " + name).c_str(), SEP); count++;
fprintf(logfile, "%s%c", ("BEST REF+V " + name).c_str(), SEP); count++;
fprintf(logfile, "%s%c", ("AVG REF " + name).c_str(), SEP); count++;
fprintf(logfile, "%s%c", ("AVG REF+V " + name).c_str(), SEP); count++;
}
for (std::string name : BB_INFO_CONTENTS) {
fprintf(logfile, "%s%c", ("ALL REF " + name).c_str(), SEP); count++;
}
for (std::string name : BB_INFO_CONTENTS) {
fprintf(logfile, "%s%c", ("ALL REF+V " + name).c_str(), SEP); count++;
}
assert(count == countFullBBInfoEntries);
} // FULL BB INFO
{ // TIME INFO
int count = 0;
for (int t = 0; t < (int) time_name.size(); t++) {
fprintf(logfile, "%s%c", time_name[t].c_str(), SEP); count++;
}
assert(count == countTimeInfoEntries);
} // TIME INFO
{ // VERSION INFO
fprintf(logfile, "%s%c", "vpc_version", SEP);
fprintf(logfile, "%s%c", "cbc_version", SEP);
fprintf(logfile, "%s%c", "clp_version", SEP);
fprintf(logfile, "%s%c", "gurobi_version", SEP);
fprintf(logfile, "%s%c", "cplex_version", SEP);
} // VERSION INFO
{ // WRAP UP INFO
fprintf(logfile, "%s%c", "ExitReason", SEP);
fprintf(logfile, "%s%c", "end_time_string", SEP);
fprintf(logfile, "%s%c", "time elapsed", SEP);
fprintf(logfile, "%s%c", "instname", SEP);
} // WRAP UP INFO
fprintf(logfile, "\n");
fflush(logfile);
} /* printHeader */
void printBoundAndGapInfo(const SummaryBoundInfo& boundInfo, FILE* logfile, const char SEP) {
if (!logfile)
return;
{ // BOUND INFO
int count = 0;
fprintf(logfile, "%s%c", stringValue(boundInfo.lp_obj, "%2.20f").c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(boundInfo.best_disj_obj, "%2.20f").c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(boundInfo.worst_disj_obj, "%2.20f").c_str(), SEP); count++;
if (!isInfinity(std::abs(boundInfo.ip_obj))) {
fprintf(logfile, "%s%c", stringValue(boundInfo.ip_obj, "%2.20f").c_str(), SEP); count++;
} else {
fprintf(logfile, "%c", SEP); count++;
}
fprintf(logfile, "%s%c", stringValue(boundInfo.num_gmic).c_str(), SEP); count++;
if (boundInfo.num_gmic > 0) {
fprintf(logfile, "%s%c", stringValue(boundInfo.gmic_obj, "%2.20f").c_str(), SEP); count++;
} else {
fprintf(logfile, "%c", SEP); count++;
}
fprintf(logfile, "%s%c", stringValue(boundInfo.num_lpc).c_str(), SEP); count++;
if (boundInfo.num_lpc > 0) {
fprintf(logfile, "%s%c", stringValue(boundInfo.lpc_obj, "%2.20f").c_str(), SEP); count++;
} else {
fprintf(logfile, "%c", SEP); count++;
}
fprintf(logfile, "%s%c", stringValue(boundInfo.num_vpc).c_str(), SEP); count++;
if (boundInfo.num_vpc > 0) {
fprintf(logfile, "%s%c", stringValue(boundInfo.vpc_obj, "%2.20f").c_str(), SEP); count++;
} else {
fprintf(logfile, "%c", SEP); count++;
}
if (!isInfinity(std::abs(boundInfo.gmic_vpc_obj))) {
fprintf(logfile, "%s%c", stringValue(boundInfo.gmic_vpc_obj, "%2.20f").c_str(), SEP); count++;
} else {
fprintf(logfile, "%c", SEP); count++;
}
assert(count == countBoundInfoEntries);
} // BOUND INFO
{ // GAP INFO
int count = 0;
if (!isInfinity(std::abs(boundInfo.ip_obj))) {
if (!isInfinity(std::abs(boundInfo.gmic_obj))) {
double val = 100. * (boundInfo.gmic_obj - boundInfo.lp_obj)
/ (boundInfo.ip_obj - boundInfo.lp_obj);
fprintf(logfile, "%s%c", stringValue(val, "%2.6f").c_str(), SEP); count++;
} else {
fprintf(logfile, "%c", SEP); count++; // gmic
}
if (!isInfinity(std::abs(boundInfo.lpc_obj))) {
double val = 100. * (boundInfo.lpc_obj - boundInfo.lp_obj)
/ (boundInfo.ip_obj - boundInfo.lp_obj);
fprintf(logfile, "%s%c", stringValue(val, "%2.6f").c_str(), SEP); count++;
} else {
fprintf(logfile, "%c", SEP); count++; // lpc
}
if (!isInfinity(std::abs(boundInfo.vpc_obj))) {
double val = 100. * (boundInfo.vpc_obj - boundInfo.lp_obj)
/ (boundInfo.ip_obj - boundInfo.lp_obj);
fprintf(logfile, "%s%c", stringValue(val, "%2.6f").c_str(), SEP); count++;
} else {
fprintf(logfile, "%c", SEP); count++; // vpc
}
if (!isInfinity(std::abs(boundInfo.gmic_vpc_obj))) {
double val = 100. * (boundInfo.gmic_vpc_obj - boundInfo.lp_obj)
/ (boundInfo.ip_obj - boundInfo.lp_obj);
fprintf(logfile, "%s%c", stringValue(val, "%2.6f").c_str(), SEP); count++;
} else {
fprintf(logfile, "%c", SEP); count++; // gmic_vpc
}
} else {
fprintf(logfile, "%c", SEP); count++; // gmic
fprintf(logfile, "%c", SEP); count++; // lpc
fprintf(logfile, "%c", SEP); count++; // vpc
fprintf(logfile, "%c", SEP); count++; // gmic+vpc
}
assert(count == countGapInfoEntries);
}
fflush(logfile);
} /* printBoundAndGapInfo */
void printSummaryBBInfo(const std::vector<SummaryBBInfo>& info_vec, FILE* logfile,
const bool print_blanks, const char SEP) {
if (!logfile)
return;
int count = 0;
for (auto info : info_vec) {
if (!print_blanks)
fprintf(logfile, "%ld%c", info.first_bb_info.nodes, SEP);
else
fprintf(logfile, "%c", SEP);
count++;
}
for (auto info : info_vec) {
if (!print_blanks)
fprintf(logfile, "%ld%c", info.best_bb_info.nodes, SEP);
else
fprintf(logfile, "%c", SEP);
count++;
}
for (auto info : info_vec) {
if (!print_blanks)
fprintf(logfile, "%2.3f%c", info.first_bb_info.time, SEP);
else
fprintf(logfile, "%c", SEP);
count++;
}
for (auto info : info_vec) {
if (!print_blanks)
fprintf(logfile, "%2.3f%c", info.best_bb_info.time, SEP);
else
fprintf(logfile, "%c", SEP);
count++;
}
fflush(logfile);
assert(count == countSummaryBBInfoEntries);
} /* printSummaryBBInfo */
void printFullBBInfo(const std::vector<SummaryBBInfo>& info_vec, FILE* logfile,
const bool print_blanks, const char SEP) {
if (!logfile)
return;
// const std::vector<bool> did_branch(info_vec.size());
// for (unsigned i = 0; i < info_vec.size(); i++) {
// did_branch[i] = info_vec[i].vec_bb_info.size() > 0;
// }
int count = 0;
if (!print_blanks) {
for (auto& info : info_vec) {
fprintf(logfile, "%s%c", stringValue(info.first_bb_info.obj, "%2.20f").c_str(), SEP);
count++;
}
for (auto& info : info_vec) {
fprintf(logfile, "%s%c", stringValue(info.best_bb_info.obj, "%2.20f").c_str(), SEP);
count++;
}
for (auto& info : info_vec) {
fprintf(logfile, "%s%c", stringValue(info.avg_bb_info.obj, "%2.20f").c_str(), SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%s%c", stringValue(info.first_bb_info.bound, "%2.20f").c_str(), SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%s%c", stringValue(info.best_bb_info.bound, "%2.20f").c_str(), SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%s%c", stringValue(info.avg_bb_info.bound, "%2.20f").c_str(), SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%ld%c", info.first_bb_info.iters, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%ld%c", info.best_bb_info.iters, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%ld%c", info.avg_bb_info.iters, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%ld%c", info.first_bb_info.nodes, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%ld%c", info.best_bb_info.nodes, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%ld%c", info.avg_bb_info.nodes, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%ld%c", info.first_bb_info.root_passes, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%ld%c", info.best_bb_info.root_passes, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%ld%c", info.avg_bb_info.root_passes, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%2.20f%c", info.first_bb_info.first_cut_pass, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%2.20f%c", info.best_bb_info.first_cut_pass, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%2.20f%c", info.avg_bb_info.first_cut_pass, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%2.20f%c", info.first_bb_info.last_cut_pass, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%2.20f%c", info.best_bb_info.last_cut_pass, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%2.20f%c", info.avg_bb_info.last_cut_pass, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%ld%c", info.first_bb_info.root_iters, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%ld%c", info.best_bb_info.root_iters, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%ld%c", info.avg_bb_info.root_iters, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%2.3f%c", info.first_bb_info.root_time, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%2.3f%c", info.best_bb_info.root_time, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%2.3f%c", info.avg_bb_info.root_time, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%2.3f%c", info.first_bb_info.last_sol_time, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%2.3f%c", info.best_bb_info.last_sol_time, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%2.3f%c", info.avg_bb_info.last_sol_time, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%2.3f%c", info.first_bb_info.time, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%2.3f%c", info.best_bb_info.time, SEP);
count++;
}
for (auto info : info_vec) {
fprintf(logfile, "%2.3f%c", info.avg_bb_info.time, SEP);
count++;
}
// Finally, all
for (auto info : info_vec) {
std::vector<std::string> vec_str;
createStringFromBBInfoVec(info.vec_bb_info, vec_str);
for (unsigned i = 0; i < vec_str.size(); i++) {
fprintf(logfile, "%s%c", vec_str[i].c_str(), SEP);
count++;
}
}
} else {
for (unsigned i = 0; i < BB_INFO_CONTENTS.size() * info_vec.size() * 4; i++) {
fprintf(logfile, "%c", SEP); count++;
}
}
fflush(logfile);
assert(count == countFullBBInfoEntries);
} /* printFullBBInfo */
void printOrigProbInfo(const OsiSolverInterface* const solver, FILE* logfile,
const char SEP) {
if (!logfile)
return;
const int num_rows = solver->getNumRows();
const int num_cols = solver->getNumCols();
// Get row stats
int num_eq_rows = 0, num_bound_rows = 0, num_assign_rows = 0;
const CoinPackedMatrix* mat = solver->getMatrixByRow();
for (int row = 0; row < num_rows; row++) {
const double row_lb = solver->getRowLower()[row];
const double row_ub = solver->getRowUpper()[row];
if (isVal(row_lb, row_ub))
num_eq_rows++;
if (mat->getVectorSize(row) == 1) {
if (isVal(row_lb, row_ub))
num_assign_rows++;
else
num_bound_rows++;
}
}
// Calculate fractionality
int num_frac = 0;
int num_fixed = 0, num_gen_int = 0, num_bin = 0, num_cont = 0;
double min_frac = 1., max_frac = 0.;
for (int col = 0; col < num_cols; col++) {
const double col_lb = solver->getColLower()[col];
const double col_ub = solver->getColUpper()[col];
if (isVal(col_lb, col_ub))
num_fixed++;
if (!solver->isInteger(col)) {
num_cont++;
continue;
}
if (solver->isBinary(col))
num_bin++;
else
num_gen_int++;
const double val = solver->getColSolution()[col];
const double floorxk = std::floor(val);
const double ceilxk = std::ceil(val);
const double frac = CoinMin(val - floorxk, ceilxk - val);
if (!isVal(frac, 0., 1e-5)) {
num_frac++;
if (frac < min_frac)
min_frac = frac;
if (frac > max_frac)
max_frac = frac;
}
}
int count = 0;
fprintf(logfile, "%s%c", stringValue(num_rows).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(num_cols).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(num_frac).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(min_frac, "%.5f").c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(max_frac, "%.5f").c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(num_eq_rows).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(num_bound_rows).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(num_assign_rows).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(num_fixed).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(num_gen_int).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(num_bin).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(num_cont).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue((double) mat->getNumElements() / (num_rows * num_cols)).c_str(), SEP); count++;
fflush(logfile);
assert(count == countOrigProbEntries);
} /* printOrigProbInfo */
/**
* @details Assumed that solver is already with cuts added
*/
void printPostCutProbInfo(const OsiSolverInterface* const solver,
const SummaryCutInfo& cutInfoGMICs, const SummaryCutInfo& cutInfoVPCs,
FILE* logfile, const char SEP) {
if (!logfile)
return;
const int num_rows = solver->getNumRows();
const int num_cols = solver->getNumCols();
// Calculate fractionality
int num_frac = 0;
double min_frac = 1., max_frac = 0.;
for (int col = 0; col < num_cols; col++) {
if (!solver->isInteger(col)) {
continue;
}
const double val = solver->getColSolution()[col];
const double floorxk = std::floor(val);
const double ceilxk = std::ceil(val);
const double frac = CoinMin(val - floorxk, ceilxk - val);
if (!isVal(frac, 0., 1e-5)) {
num_frac++;
if (frac < min_frac)
min_frac = frac;
if (frac > max_frac)
max_frac = frac;
}
}
int count = 0;
fprintf(logfile, "%s%c", stringValue(num_frac).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(min_frac, "%.5f").c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(max_frac, "%.5f").c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue((double) solver->getMatrixByCol()->getNumElements() / (num_rows * num_cols)).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(cutInfoGMICs.num_active_gmic).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(cutInfoVPCs.num_active_gmic).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(cutInfoGMICs.num_active_vpc).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(cutInfoVPCs.num_active_vpc).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(cutInfoGMICs.num_active_all).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(cutInfoVPCs.num_active_all).c_str(), SEP); count++;
fflush(logfile);
assert(count == countPostCutProbEntries);
} /* printPostCutProbInfo */
void printDisjInfo(const SummaryDisjunctionInfo& disjInfo, FILE* logfile,
const char SEP) {
if (!logfile)
return;
int count = 0;
fprintf(logfile, "%s%c", stringValue(disjInfo.avg_num_terms, "%g").c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(disjInfo.num_integer_sol, "%d").c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(disjInfo.num_disj, "%d").c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(disjInfo.avg_density_prlp, "%g").c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(disjInfo.avg_num_rows_prlp, "%g").c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(disjInfo.avg_num_cols_prlp, "%g").c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(disjInfo.avg_num_points_prlp, "%g").c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(disjInfo.avg_num_rays_prlp, "%g").c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(disjInfo.avg_explored_nodes, "%g").c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(disjInfo.avg_pruned_nodes, "%g").c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(disjInfo.avg_min_depth, "%g").c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(disjInfo.avg_max_depth, "%g").c_str(), SEP); count++;
fflush(logfile);
assert(count == countDisjInfoEntries);
} /* printDisjInfo */
void printCutInfo(const SummaryCutInfo& cutInfoGMICs,
const SummaryCutInfo& cutInfo, FILE* logfile, const char SEP) {
if (!logfile)
return;
{ // CUT INFO
int count = 0;
fprintf(logfile, "%s%c", stringValue(cutInfo.num_rounds).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(cutInfo.num_cuts).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(cutInfo.numCutsOfType[static_cast<int>(CglVPC::CutType::ONE_SIDED_CUT)]).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(cutInfo.numCutsOfType[static_cast<int>(CglVPC::CutType::OPTIMALITY_CUT)]).c_str(), SEP); count++;
if (cutInfo.num_cuts > 0) {
fprintf(logfile, "%s%c", stringValue(cutInfo.min_support).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(cutInfo.max_support).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(cutInfo.avg_support, "%.3f").c_str(), SEP); count++;
} else {
fprintf(logfile, "%s%c", stringValue(0).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(0).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(0).c_str(), SEP); count++;
}
if (cutInfoGMICs.num_cuts > 0) {
fprintf(logfile, "%s%c", stringValue(cutInfoGMICs.min_support).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(cutInfoGMICs.max_support).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(cutInfoGMICs.avg_support, "%.3f").c_str(), SEP); count++;
} else {
fprintf(logfile, "%s%c", stringValue(0).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(0).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(0).c_str(), SEP); count++;
}
assert(count == countCutInfoEntries);
} // CUT INFO
{ // OBJ INFO
int count = 0;
fprintf(logfile, "%s%c", stringValue(cutInfo.num_obj_tried).c_str(), SEP); count++;
for (int obj_ind = 0; obj_ind < static_cast<int>(CglVPC::ObjectiveType::NUM_OBJECTIVE_TYPES); obj_ind++) {
fprintf(logfile, "%s%c", stringValue(cutInfo.numObjFromHeur[obj_ind]).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(cutInfo.numCutsFromHeur[obj_ind]).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(cutInfo.numFailsFromHeur[obj_ind]).c_str(), SEP); count++;
fprintf(logfile, "%s%c", stringValue(cutInfo.numActiveFromHeur[obj_ind]).c_str(), SEP); count++;
}
assert(count == countObjInfoEntries);
} // OBJ INFO
{ // FAIL INFO
int count = 0;
fprintf(logfile, "%s%c", stringValue(cutInfo.num_failures).c_str(), SEP); count++;
for (int fail_ind = 0; fail_ind < static_cast<int>(CglVPC::FailureType::NUM_FAILURE_TYPES); fail_ind++) {
fprintf(logfile, "%s%c", stringValue(cutInfo.numFails[fail_ind]).c_str(), SEP); count++;
}
assert(count == countFailInfoEntries);
} // FAIL INFO
fflush(logfile);
} /* printCutInfo */
/// @details Gets cut support size and updates min/max component of \p cutInfo
int checkCutDensity(
/// [in,out] Where to save min and max support
SummaryCutInfo& cutInfo,
/// [in] Row that we want to check
const OsiRowCut* const cut,
/// [in] What counts as a zero coefficient
const double EPS) {
int num_elem = cut->row().getNumElements();
const double* el = cut->row().getElements();
for (int i = 0; i < cut->row().getNumElements(); i++) {
if (isZero(el[i], EPS)) {
num_elem--;
}
}
if (num_elem < cutInfo.min_support)
cutInfo.min_support = num_elem;
if (num_elem > cutInfo.max_support)
cutInfo.max_support = num_elem;
return num_elem;
} // checkCutDensity
/// @brief Find active cuts, and also report density of cuts
bool checkCutActivity(
const OsiSolverInterface* const solver,
const OsiRowCut* const cut) {
if (solver && solver->isProvenOptimal()) {
const double activity = dotProduct(cut->row(), solver->getColSolution());
return isVal(activity, cut->rhs());
} else {
return false;
}
} /* checkCutActivity */
/**
* @details The cut properties we want to look at are:
* 1. Gap closed
* 2. Activity (after adding cuts)
* 3. Density
*/
void analyzeStrength(
const VPCParameters& params,
const OsiSolverInterface* const solver_gmic,
const OsiSolverInterface* const solver_vpc,
const OsiSolverInterface* const solver_all,
SummaryCutInfo& cutInfoGMICs, SummaryCutInfo& cutInfoVPCs,
const OsiCuts* const gmics, const OsiCuts* const vpcs,
const SummaryBoundInfo& boundInfo, std::string& output) {
cutInfoGMICs.num_active_gmic = 0;
cutInfoGMICs.num_active_vpc = 0;
cutInfoGMICs.num_active_all = 0;
cutInfoVPCs.num_active_gmic = 0;
cutInfoVPCs.num_active_vpc = 0;
cutInfoVPCs.num_active_all = 0;
cutInfoVPCs.numActiveFromHeur.resize(static_cast<int>(CglVPC::ObjectiveType::NUM_OBJECTIVE_TYPES), 0);
if (vpcs) {
const int num_vpcs = vpcs->sizeCuts();
int total_support = 0;
for (int cut_ind = 0; cut_ind < num_vpcs; cut_ind++) {
const OsiRowCut* const cut = vpcs->rowCutPtr(cut_ind);
if (checkCutActivity(solver_gmic, cut)) {
cutInfoVPCs.num_active_gmic++;
}
if (checkCutActivity(solver_vpc, cut)) {
cutInfoVPCs.num_active_vpc++;
cutInfoVPCs.numActiveFromHeur[static_cast<int>(cutInfoVPCs.objType[cut_ind])]++;
}
if (checkCutActivity(solver_all, cut)) {
cutInfoVPCs.num_active_all++;
}
total_support += checkCutDensity(cutInfoVPCs, cut, params.get(EPS) / 2.);
}
cutInfoVPCs.avg_support = (double) total_support / num_vpcs;
}
if (gmics) {
const int num_gmics = gmics->sizeCuts();
cutInfoGMICs.num_cuts = num_gmics;
int total_support = 0;
for (int cut_ind = 0; cut_ind < num_gmics; cut_ind++) {
const OsiRowCut* const cut = gmics->rowCutPtr(cut_ind);
if (checkCutActivity(solver_gmic, cut)) {
cutInfoGMICs.num_active_gmic++;
}
if (checkCutActivity(solver_vpc, cut)) {
cutInfoGMICs.num_active_vpc++;
}
if (checkCutActivity(solver_all, cut)) {
cutInfoGMICs.num_active_all++;
}
total_support += checkCutDensity(cutInfoGMICs, cut, params.get(EPS) / 2.);
}
cutInfoGMICs.avg_support = (double) total_support / num_gmics;
}
// Print results from adding cuts
int NAME_WIDTH = 25;
int NUM_DIGITS_BEFORE_DEC = 7;
int NUM_DIGITS_AFTER_DEC = 7;
const double INF = std::numeric_limits<double>::max();
char tmpstring[300];
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char),
"\n## Results from adding cuts ##\n");
output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%-*.*s%s\n",
NAME_WIDTH, NAME_WIDTH, "LP: ",
stringValue(boundInfo.lp_obj, "% -*.*g",
INF,
NUM_DIGITS_BEFORE_DEC,
NUM_DIGITS_AFTER_DEC).c_str());
output += tmpstring;
if (!isInfinity(std::abs(boundInfo.gmic_obj))) {
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char),
"%-*.*s%s (%d cuts", NAME_WIDTH, NAME_WIDTH, "GMICs: ",
stringValue(boundInfo.gmic_obj, "% -*.*g",
INF,
NUM_DIGITS_BEFORE_DEC,
NUM_DIGITS_AFTER_DEC).c_str(),
boundInfo.num_gmic);
output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char),
", %d active GMICs", cutInfoGMICs.num_active_gmic);
output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char),
", %d active VPCs", cutInfoVPCs.num_active_gmic);
output += tmpstring;
output += ")\n";
}
if (!isInfinity(std::abs(boundInfo.vpc_obj))) {
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char),
"%-*.*s%s (%d cuts", NAME_WIDTH, NAME_WIDTH, "VPCs: ",
stringValue(boundInfo.vpc_obj, "% -*.*g",
INF,
NUM_DIGITS_BEFORE_DEC,
NUM_DIGITS_AFTER_DEC).c_str(),
boundInfo.num_vpc);
output += tmpstring;
if (gmics && gmics->sizeCuts() > 0) {
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char),
", %d active GMICs", cutInfoGMICs.num_active_vpc);
output += tmpstring;
}
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char),
", %d active VPCs", cutInfoVPCs.num_active_vpc);
output += tmpstring;
output += ")\n";
}
if (boundInfo.num_gmic + boundInfo.num_lpc > 0) {
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char),
"%-*.*s%s (%d cuts", NAME_WIDTH, NAME_WIDTH, "All: ",
stringValue(boundInfo.all_cuts_obj, "% -*.*g", INF, NUM_DIGITS_BEFORE_DEC, NUM_DIGITS_AFTER_DEC).c_str(),
boundInfo.num_gmic + boundInfo.num_lpc + boundInfo.num_vpc);
output += tmpstring;
if (gmics && gmics->sizeCuts() > 0) {
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char),
", %d active GMICs", cutInfoGMICs.num_active_all);
output += tmpstring;
}
if (vpcs && vpcs->sizeCuts() > 0) {
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char),
", %d active VPCs", cutInfoVPCs.num_active_all);
output += tmpstring;
}
output += ")\n";
}
if (!isInfinity(std::abs(boundInfo.best_disj_obj))) {
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%-*.*s%s\n",
NAME_WIDTH, NAME_WIDTH, "Disjunctive lb: ",
stringValue(boundInfo.best_disj_obj, "% -*.*g",
INF,
NUM_DIGITS_BEFORE_DEC,
NUM_DIGITS_AFTER_DEC).c_str());
output += tmpstring;
}
if (!isInfinity(std::abs(boundInfo.worst_disj_obj))) {
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%-*.*s%s\n",
NAME_WIDTH, NAME_WIDTH, "Disjunctive ub: ",
stringValue(boundInfo.worst_disj_obj, "% -*.*g",
INF,
NUM_DIGITS_BEFORE_DEC,
NUM_DIGITS_AFTER_DEC).c_str());
output += tmpstring;
}
if (!isInfinity(std::abs(boundInfo.ip_obj))) {
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%-*.*s%s\n",
NAME_WIDTH, NAME_WIDTH, "IP: ",
stringValue(boundInfo.ip_obj, "% -*.*g",
INF,
NUM_DIGITS_BEFORE_DEC,
NUM_DIGITS_AFTER_DEC).c_str());
output += tmpstring;
}
} /* analyzeStrength */
/** @details Branch-and-bound itself has already been performed */
void analyzeBB(const VPCParameters& params, SummaryBBInfo& info_nocuts,
SummaryBBInfo& info_mycuts, SummaryBBInfo& info_allcuts, std::string& output) {
if (params.get(BB_RUNS) == 0) {
return;
}
// B&B mode: ones bit = no_cuts, tens bit = w/vpcs, hundreds bit = w/gmics
const int mode_param = params.get(intParam::BB_MODE);
const int mode_ones = mode_param % 10;
const int mode_tens = (mode_param % 100 - (mode_param % 10)) / 10;
const int mode_hundreds = (mode_param % 1000 - (mode_param % 100)) / 100;
const bool branch_with_no_cuts = (mode_ones > 0);
const bool branch_with_vpcs = (mode_tens > 0) && (info_mycuts.num_cuts > 0);
const bool branch_with_gmics = (mode_hundreds > 0) && (info_allcuts.num_cuts > 0);
if (branch_with_no_cuts + branch_with_vpcs + branch_with_gmics == 0) {
return;
}
// Save results to string and also print to the logfile
const int NAME_WIDTH = 10; //25
const int NUM_DIGITS_BEFORE_DEC = 15; //10
const int NUM_DIGITS_AFTER_DEC = 2; //2
const double INF = 1e50; //params.get(doubleParam::INF);
const bool use_gurobi = use_bb_option(params.get(intParam::BB_STRATEGY), BB_Strategy_Options::gurobi);
const bool use_cplex = use_bb_option(params.get(intParam::BB_STRATEGY), BB_Strategy_Options::cplex);
const bool use_cbc = use_bb_option(params.get(intParam::BB_STRATEGY), BB_Strategy_Options::cbc);
const std::string SOLVER =
use_gurobi ? "Gur" :
(use_cplex ? "Cpx" :
(use_cbc ? "Cbc" : "")
);
char tmpstring[300];
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "\n## Branch-and-bound results ##\n"); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%-*s", NAME_WIDTH, ""); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%-*s", NUM_DIGITS_BEFORE_DEC, "Obj"); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%-*s", NUM_DIGITS_BEFORE_DEC, "Bound"); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%-*s", NUM_DIGITS_BEFORE_DEC, "Iters"); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%-*s", NUM_DIGITS_BEFORE_DEC, "Nodes"); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%-*s", NUM_DIGITS_BEFORE_DEC, "Root passes"); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%-*s", NUM_DIGITS_BEFORE_DEC, "First cut pass"); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%-*s", NUM_DIGITS_BEFORE_DEC, "Last cut pass"); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%-*s", NUM_DIGITS_BEFORE_DEC, "Root time"); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%-*s", NUM_DIGITS_BEFORE_DEC, "Last sol time"); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%-*s", NUM_DIGITS_BEFORE_DEC, "Time"); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "\n"); output += tmpstring;
if (branch_with_no_cuts) {
const std::string CURR_NAME = SOLVER;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%-*s", NAME_WIDTH, CURR_NAME.c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_nocuts.avg_bb_info.obj, "%-*.*f", INF, NUM_DIGITS_BEFORE_DEC, NUM_DIGITS_AFTER_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_nocuts.avg_bb_info.bound, "%-*.*f", INF, NUM_DIGITS_BEFORE_DEC, NUM_DIGITS_AFTER_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_nocuts.avg_bb_info.iters, "%-*ld", std::numeric_limits<long double>::max(), NUM_DIGITS_BEFORE_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_nocuts.avg_bb_info.nodes, "%-*ld", std::numeric_limits<long double>::max(), NUM_DIGITS_BEFORE_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_nocuts.avg_bb_info.root_passes, "%-*ld", std::numeric_limits<long double>::max(), NUM_DIGITS_BEFORE_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_nocuts.avg_bb_info.first_cut_pass, "%-*.*f", INF, NUM_DIGITS_BEFORE_DEC, NUM_DIGITS_AFTER_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_nocuts.avg_bb_info.last_cut_pass, "%-*.*f", INF, NUM_DIGITS_BEFORE_DEC, NUM_DIGITS_AFTER_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_nocuts.avg_bb_info.root_time, "%-*.*f", INF, NUM_DIGITS_BEFORE_DEC, NUM_DIGITS_AFTER_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_nocuts.avg_bb_info.last_sol_time, "%-*.*f", INF, NUM_DIGITS_BEFORE_DEC, NUM_DIGITS_AFTER_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_nocuts.avg_bb_info.time, "%-*.*f", INF, NUM_DIGITS_BEFORE_DEC, NUM_DIGITS_AFTER_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "\n"); output += tmpstring;
} // no cuts
if (branch_with_vpcs) {
const std::string CURR_NAME = SOLVER + "V";
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%-*s", NAME_WIDTH, CURR_NAME.c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_mycuts.avg_bb_info.obj, "%-*.*f", INF, NUM_DIGITS_BEFORE_DEC, NUM_DIGITS_AFTER_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_mycuts.avg_bb_info.bound, "%-*.*f", INF, NUM_DIGITS_BEFORE_DEC, NUM_DIGITS_AFTER_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_mycuts.avg_bb_info.iters, "%-*ld", std::numeric_limits<long double>::max(), NUM_DIGITS_BEFORE_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_mycuts.avg_bb_info.nodes, "%-*ld", std::numeric_limits<long double>::max(), NUM_DIGITS_BEFORE_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_mycuts.avg_bb_info.root_passes, "%-*ld", std::numeric_limits<long double>::max(), NUM_DIGITS_BEFORE_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_mycuts.avg_bb_info.first_cut_pass, "%-*.*f", INF, NUM_DIGITS_BEFORE_DEC, NUM_DIGITS_AFTER_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_mycuts.avg_bb_info.last_cut_pass, "%-*.*f", INF, NUM_DIGITS_BEFORE_DEC, NUM_DIGITS_AFTER_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_mycuts.avg_bb_info.root_time, "%-*.*f", INF, NUM_DIGITS_BEFORE_DEC, NUM_DIGITS_AFTER_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_mycuts.avg_bb_info.last_sol_time, "%-*.*f", INF, NUM_DIGITS_BEFORE_DEC, NUM_DIGITS_AFTER_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_mycuts.avg_bb_info.time, "%-*.*f", INF, NUM_DIGITS_BEFORE_DEC, NUM_DIGITS_AFTER_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "\n"); output += tmpstring;
} // vpcs
if (branch_with_gmics) {
const std::string CURR_NAME = SOLVER + "V+G";
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%-*s", NAME_WIDTH, CURR_NAME.c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_allcuts.avg_bb_info.obj, "%-*.*f", INF, NUM_DIGITS_BEFORE_DEC, NUM_DIGITS_AFTER_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_allcuts.avg_bb_info.bound, "%-*.*f", INF, NUM_DIGITS_BEFORE_DEC, NUM_DIGITS_AFTER_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_allcuts.avg_bb_info.iters, "%-*ld", std::numeric_limits<long double>::max(), NUM_DIGITS_BEFORE_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_allcuts.avg_bb_info.nodes, "%-*ld", std::numeric_limits<long double>::max(), NUM_DIGITS_BEFORE_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_allcuts.avg_bb_info.root_passes, "%-*ld", std::numeric_limits<long double>::max(), NUM_DIGITS_BEFORE_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_allcuts.avg_bb_info.first_cut_pass, "%-*.*f", INF, NUM_DIGITS_BEFORE_DEC, NUM_DIGITS_AFTER_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_allcuts.avg_bb_info.last_cut_pass, "%-*.*f", INF, NUM_DIGITS_BEFORE_DEC, NUM_DIGITS_AFTER_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_allcuts.avg_bb_info.root_time, "%-*.*f", INF, NUM_DIGITS_BEFORE_DEC, NUM_DIGITS_AFTER_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_allcuts.avg_bb_info.last_sol_time, "%-*.*f", INF, NUM_DIGITS_BEFORE_DEC, NUM_DIGITS_AFTER_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "%s", stringValue(info_allcuts.avg_bb_info.time, "%-*.*f", INF, NUM_DIGITS_BEFORE_DEC, NUM_DIGITS_AFTER_DEC).c_str()); output += tmpstring;
snprintf(tmpstring, sizeof(tmpstring) / sizeof(char), "\n"); output += tmpstring;
} // gmics
} /* analyzeBB */
double getNumGomoryRounds(const VPCParameters& params,
const OsiSolverInterface* const origSolver,
const OsiSolverInterface* const postCutSolver) {
#ifdef TRACE
printf("\nGetting number rounds of Gomory cuts req'd to get bound.\n");
#endif
const int num_cuts = postCutSolver->getNumRows() - origSolver->getNumRows();
const double post_cut_opt = postCutSolver->getObjValue();
const int min_sic_rounds = (params.get(STRENGTHEN) == 2) ? 2 : 0;
int max_rounds = 1000;
int total_num_sics = 0;
int num_sic_rounds = 0;
double curr_sic_opt = 0.;
std::vector<int> numCutsByRoundSIC;
std::vector<double> boundByRoundSIC;
OsiSolverInterface* copySolver = origSolver->clone();
if (!copySolver->isProvenOptimal()) {
copySolver->initialSolve();
checkSolverOptimality(copySolver, false);
}
while (num_sic_rounds < min_sic_rounds
|| (lessThanVal(curr_sic_opt, post_cut_opt) && total_num_sics < num_cuts)) {
OsiCuts GMICs;
CglGMI gen;
gen.generateCuts(*copySolver, GMICs);
const int curr_num_cuts = GMICs.sizeCuts();
if (curr_num_cuts == 0)
break;
num_sic_rounds++;
total_num_sics += curr_num_cuts;
numCutsByRoundSIC.push_back(curr_num_cuts);
curr_sic_opt = applyCutsCustom(copySolver, GMICs, params.logfile);
boundByRoundSIC.push_back(curr_sic_opt);
// Other stopping conditions:
// Bound does not improve at all after one round
if (num_sic_rounds >= 2
&& !greaterThanVal(curr_sic_opt, boundByRoundSIC[num_sic_rounds - 2])) {
break;
}
// Bound does not significantly improve after five rounds
if (num_sic_rounds > 4) {
const double delta = curr_sic_opt - boundByRoundSIC[num_sic_rounds - 4];
if (!greaterThanVal(delta, 1e-3)) {
break;
}
}
} // do rounds of Gomory cuts
if (max_rounds < num_sic_rounds) {
max_rounds = boundByRoundSIC.size();
}
const double final_sic_bound = copySolver->getObjValue();
return final_sic_bound;
} /* getNumGomoryRounds */
void updateDisjInfo(SummaryDisjunctionInfo& disjInfo, const int num_disj, const CglVPC& gen) {
if (num_disj <= 0)
return;
const Disjunction* const disj = gen.getDisjunction();
const PRLP* const prlp = gen.getPRLP();
if (!prlp)
return;
disjInfo.num_disj = num_disj;
disjInfo.num_integer_sol += !(disj->integer_sol.empty());
disjInfo.avg_num_terms = (disjInfo.avg_num_terms * (num_disj - 1) + disj->num_terms) / num_disj;
disjInfo.avg_density_prlp = (disjInfo.avg_density_prlp * (num_disj - 1) + prlp->density) / num_disj;
disjInfo.avg_num_rows_prlp += (disjInfo.avg_num_rows_prlp * (num_disj - 1) + prlp->getNumRows()) / num_disj;
disjInfo.avg_num_cols_prlp += (disjInfo.avg_num_cols_prlp * (num_disj - 1) + prlp->getNumCols()) / num_disj;
disjInfo.avg_num_points_prlp += (disjInfo.avg_num_points_prlp * (num_disj - 1) + prlp->numPoints) / num_disj;
disjInfo.avg_num_rays_prlp += (disjInfo.avg_num_rays_prlp * (num_disj - 1) + prlp->numRays) / num_disj;
try {
const PartialBBDisjunction* const partialDisj =
dynamic_cast<const PartialBBDisjunction* const >(disj);
disjInfo.avg_explored_nodes += (disjInfo.avg_explored_nodes * (num_disj - 1) + partialDisj->data.num_nodes_on_tree) / num_disj;
disjInfo.avg_pruned_nodes += (disjInfo.avg_pruned_nodes * (num_disj - 1) + partialDisj->data.num_pruned_nodes) / num_disj;
disjInfo.avg_min_depth += (disjInfo.avg_min_depth * (num_disj - 1) + partialDisj->data.min_node_depth) / num_disj;
disjInfo.avg_max_depth += (disjInfo.avg_max_depth * (num_disj - 1) + partialDisj->data.max_node_depth) / num_disj;
} catch (std::exception& e) {
}
} /* updateDisjInfo */
/**
* @details Use this to add to cutInfo (but within one round,
* because the cutType and objType vectors are cleared in gen in each round
* (so tracking that based on isSetupForRepeatedUse does not work,
* and the old cutType and objType stored in cutInfo would be overwritten)
*/
void updateCutInfo(SummaryCutInfo& cutInfo, const CglVPC& gen) {
cutInfo.num_cuts += gen.num_cuts;
cutInfo.num_obj_tried += gen.num_obj_tried;
cutInfo.num_failures += gen.num_failures;
// For cutType and objType, what we do depends on whether the generator is setup for repeated use or not
if (gen.isSetupForRepeatedUse) {
cutInfo.cutType = gen.cutType;
cutInfo.objType = gen.objType;
} else {
cutInfo.cutType.insert(cutInfo.cutType.end(), gen.cutType.begin(), gen.cutType.end());
cutInfo.objType.insert(cutInfo.objType.end(), gen.objType.begin(), gen.objType.end());
}
if (cutInfo.numCutsOfType.size() > 0) {
for (int i = 0; i < static_cast<int>(CglVPC::CutType::NUM_CUT_TYPES); i++) {
cutInfo.numCutsOfType[i] += gen.numCutsOfType[i];
}
} else {
cutInfo.numCutsOfType = gen.numCutsOfType;
}
if (cutInfo.numCutsFromHeur.size() > 0) {
for (int i = 0; i < static_cast<int>(CglVPC::ObjectiveType::NUM_OBJECTIVE_TYPES); i++) {
cutInfo.numCutsFromHeur[i] += gen.numCutsFromHeur[i];
cutInfo.numObjFromHeur[i] += gen.numObjFromHeur[i];
cutInfo.numFailsFromHeur[i] += gen.numFailsFromHeur[i];
}
} else {
cutInfo.numCutsFromHeur = gen.numCutsFromHeur;
cutInfo.numObjFromHeur = gen.numObjFromHeur;
cutInfo.numFailsFromHeur = gen.numFailsFromHeur;
}
if (cutInfo.numFails.size() > 0) {
for (int i = 0; i < static_cast<int>(CglVPC::FailureType::NUM_FAILURE_TYPES); i++) {
cutInfo.numFails[i] += gen.numFails[i];
}
} else {
cutInfo.numFails = gen.numFails;
}
} /* updateCutInfo (within one round) */
/**
* @details Compute total number of cuts / objectives / failures of various types, as well as total activity
*/
void setCutInfo(SummaryCutInfo& cutInfo, const int num_rounds,
const SummaryCutInfo* const oldCutInfos) {
const int numCutTypes = static_cast<int>(CglVPC::CutType::NUM_CUT_TYPES);
const int numObjTypes = static_cast<int>(CglVPC::ObjectiveType::NUM_OBJECTIVE_TYPES);
const int numFailTypes = static_cast<int>(CglVPC::FailureType::NUM_FAILURE_TYPES);
cutInfo.num_cuts = 0;
cutInfo.num_active_gmic = 0;
cutInfo.num_active_vpc = 0;
cutInfo.num_active_all = 0;
cutInfo.num_obj_tried = 0;
cutInfo.num_failures = 0;
cutInfo.num_rounds = num_rounds;
cutInfo.cutType.resize(0);
cutInfo.objType.resize(0);
cutInfo.numCutsOfType.clear();
cutInfo.numCutsOfType.resize(numCutTypes, 0);
cutInfo.numCutsFromHeur.clear();
cutInfo.numCutsFromHeur.resize(numObjTypes, 0);
cutInfo.numObjFromHeur.clear();
cutInfo.numObjFromHeur.resize(numObjTypes, 0);
cutInfo.numFailsFromHeur.clear();
cutInfo.numFailsFromHeur.resize(numObjTypes, 0);
cutInfo.numActiveFromHeur.clear();
cutInfo.numActiveFromHeur.resize(numObjTypes, 0);
cutInfo.numFails.clear();
cutInfo.numFails.resize(numFailTypes, 0);
for (int round = 0; round < num_rounds; round++) {
cutInfo.num_cuts += oldCutInfos[round].num_cuts;
cutInfo.num_active_gmic += oldCutInfos[round].num_active_gmic;
cutInfo.num_active_vpc += oldCutInfos[round].num_active_vpc;
cutInfo.num_active_all += oldCutInfos[round].num_active_all;
cutInfo.num_obj_tried += oldCutInfos[round].num_obj_tried;
cutInfo.num_failures += oldCutInfos[round].num_failures;
for (int i = 0; i < numCutTypes; i++) {
cutInfo.numCutsOfType[i] += oldCutInfos[round].numCutsOfType[i];
}
for (int i = 0; i < numObjTypes; i++) {
cutInfo.numCutsFromHeur[i] += oldCutInfos[round].numCutsFromHeur[i];
cutInfo.numObjFromHeur[i] += oldCutInfos[round].numObjFromHeur[i];
cutInfo.numFailsFromHeur[i] += oldCutInfos[round].numFailsFromHeur[i];
}
if (oldCutInfos[round].numActiveFromHeur.size() > 0) {
for (int i = 0; i < numObjTypes; i++) {
cutInfo.numActiveFromHeur[i] += oldCutInfos[round].numActiveFromHeur[i];
}
}
for (int i = 0; i < numFailTypes; i++) {
cutInfo.numFails[i] += oldCutInfos[round].numFails[i];
}
}
cutInfo.cutType.resize(cutInfo.num_cuts);
cutInfo.objType.resize(cutInfo.num_cuts);
int cut_ind = 0;
for (int round = 0; round < num_rounds; round++) {
for (int i = 0; i < oldCutInfos[round].num_cuts; i++) {
cutInfo.cutType[cut_ind] = oldCutInfos[round].cutType[i];
cutInfo.objType[cut_ind] = oldCutInfos[round].objType[i];
cut_ind++;
}
}
} /* setCutInfo (merge from multiple rounds) */
| 45.849838
| 217
| 0.652876
|
akazachk
|
76a97b05240b232ce4c2d9953ced0cdb79098a1e
| 21,068
|
cc
|
C++
|
src/moorerror.cc
|
CHEN-Lin/OpenMoor
|
f463f586487b9023e7f3678c9d851000558b14d7
|
[
"Apache-2.0"
] | 7
|
2019-02-10T07:03:45.000Z
|
2022-03-04T16:09:38.000Z
|
src/moorerror.cc
|
CHEN-Lin/OpenMoor
|
f463f586487b9023e7f3678c9d851000558b14d7
|
[
"Apache-2.0"
] | null | null | null |
src/moorerror.cc
|
CHEN-Lin/OpenMoor
|
f463f586487b9023e7f3678c9d851000558b14d7
|
[
"Apache-2.0"
] | 4
|
2018-03-01T14:34:52.000Z
|
2018-06-14T12:13:55.000Z
|
// This file is part of OpenMOOR, an Open-source simulation program for MOORing
// systems in offshore renewable energy applications.
//
// Copyright 2018 Lin Chen <l.chen.tj@gmail.com> & Biswajit Basu <basub@tcd.ie>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
#include "moorerror.h"
namespace moor {
std::string ErrorCategory::message(ErrorCode err)
{
switch (err)
{
case ErrorCode::SUCCESS:
return "Successful.";
case ErrorCode::MOORING_FILE_NONEXISTENT:
return "Failed to find main mooring file. It should be a xml file.";
case ErrorCode::MOORING_FILE_ERROR_PARSE:
return "Parse error found in main input xml file. Check xml format.";
case ErrorCode::MOORING_FILE_NO_CASE:
return "Root node of main input file must be 'case'.";
case ErrorCode::MOORING_FILE_INCOMPLETE:
return ("Incomplete components found in mooring input file. "
"Required are: 'constants', 'platform', 'connections', "
"'cables', 'structuralproperties', 'hydroproperties', "
"'seabedproperties', 'currents' and 'solvers'.");
case ErrorCode::MOORING_FILE_INCOMPLETE_CONSTANTS:
return ("Incomplete constants definition. Required are "
"'gravitationalacceleration', 'waterdensity' and "
"'waterdepth'.");
case ErrorCode::MOORING_FILE_NAN_CONSTANT:
return "NaN found in constant definitions.";
case ErrorCode::MOORING_FILE_INCOMPLETE_PLATFORM:
return ("Failed to find platform position definition or incomplete "
"position components provided. Position of the reference "
"point is required to have six component: 'x', 'y', 'z' "
"'roll', 'pitch' and 'yaw'.");
case ErrorCode::MOORING_FILE_NAN_PLATFORM_POSITION:
return "NaN found in platform position definition.";
case ErrorCode::MOORING_FILE_BAD_CONNECTIONS_NUM:
return ("Unacceptable 'number' of 'connections': "
"NaN or nonpositive.");
case ErrorCode::MOORING_FILE_NO_CONNECTION:
return "Failed to find at least one connection definition.";
case ErrorCode::MOORING_FILE_INCOMPLETE_CONNECTION_DEF:
return ("Incomplete connection definition. Required are 'id', "
"'type', 'x', 'y' and 'z'.");
case ErrorCode::MOORING_FILE_NAN_CONNECTION_DEF:
return "NaN found in connection 'id' or position components.";
case ErrorCode::MOORING_FILE_OUTOFRANGE_CONNECTION_ID:
return ("Found connection 'id' out of range of the 'number' of "
"'connections'. ");
case ErrorCode::MOORING_FILE_UNKNOWN_CONNECTION_TYPE:
return ("Found unknown connection 'type'. Currently supported "
"types are 'anchor' and 'fairlead'.");
case ErrorCode::MOORING_FILE_MISSED_REPEATED_CONNECTION_ID:
return ("Found connection missed or repeatedly defined. Check "
"connection 'id' and the 'number' of 'connections'.");
// Cable error.
case ErrorCode::MOORING_FILE_BAD_CABLES_NUM:
return "Unacceptable 'number' of 'cables': NaN or nonpositive.";
case ErrorCode::MOORING_FILE_NO_CABLE_DEF:
return "Failed to find at least one cable.";
case ErrorCode::MOORING_FILE_INCOMPLETE_CABLE_DEF:
return ("Incomplete cable definition. Required are: 'id', "
"'initialstatefile (can be empty)', 'icurrent', 'isolver', "
"'segmentlength', 'istructproperty', "
"'ihydroproperty', 'iseabedproperty', 'iconnection' and "
"'saveflag'.");
case ErrorCode::MOORING_FILE_NAN_CABLE_DEF:
return ("NaN found in cable 'id', 'icurrent', 'isolver', "
"'nodenumber', or 'saveflag'.");
case ErrorCode::MOORING_FILE_OUTOFRANGE_CABLE_ID:
return "Found cable 'id' out of range of the 'number' of 'cables'.";
case ErrorCode::MOORING_FILE_NAN_CABLE_LENGTH:
return "NaN found in cable 'segmentlength'.";
case ErrorCode::MOORING_FILE_NAN_CABLE_STRUCTPROP_INDEX:
return "NaN found in cable 'istructproperty'.";
case ErrorCode::MOORING_FILE_NAN_CABLE_HYDROPROP_INDEX:
return "NaN found in cable 'ihydroproperty'.";
case ErrorCode::MOORING_FILE_NAN_CABLE_SEABEDPROP_INDEX:
return "NaN found in cable 'iseabedproperty'.";
case ErrorCode::MOORING_FILE_NAN_CABLE_CONNECTION_INDEX:
return "NaN found in cable 'iconnection'.";
case ErrorCode::MOORING_FILE_BAD_CABLE_CONNECTION_INDEX:
return "Failed to find two connection indexes for a cable.";
case ErrorCode::MOORING_FILE_MISSED_REPEATED_CABLE_ID:
return ("Found cable missed or repeatedly defined. Check cable 'id'"
" and the 'number' of cables.");
// Structural property error.
case ErrorCode::MOORING_FILE_BAD_STRUCTPROPS_NUM:
return "Unacceptable number of 'structuralproperties'.";
case ErrorCode::MOORING_FILE_NO_STRUCTPROP:
return "Failed to find at least one 'structuralproperty'.";
case ErrorCode::MOORING_FILE_INCOMPLETE_STRUCTPROP_DEF:
return ("Incomplete 'structuralproperty' data. Required are: 'id', "
"'diameter', 'unitlengthmass', 'unitlengthweight', "
"'bendingstiffness', 'torsionalstiffness', and "
"'dampingcoefficient'");
case ErrorCode::MOORING_FILE_NAN_STRUCTPROP:
return "NaN found in 'structuralproperty'.";
case ErrorCode::MOORING_FILE_OUTOFRANGE_STRUCTPROP_ID:
return ("Found 'structuralproperty' out of range of the number of "
"'structuralproperties'.");
case ErrorCode::MOORING_FILE_MISSED_REPEATED_STRUCTPROP_ID:
return ("Found 'structuralproperty' missed or repeatedly defined. "
"Check 'structuralproperty' 'id' and the 'number' of "
"'structuralproperties'.");
// Hydro-property error.
case ErrorCode::MOORING_FILE_BAD_HYDROPROPS_NUM:
return ("Unacceptable number of 'hydroperoperties': "
"NaN or nonpositive.");
case ErrorCode::MOORING_FILE_NO_HYDROPROP:
return "Unable to find at least one 'hydroproperty'.";
case ErrorCode::MOORING_FILE_INCOMPLETE_HYDROPROP_DEF:
return ("Incomplete hydroproperty data. Required are 'id', "
"'addedmasscoefficient' and 'dragcoefficient'");
case ErrorCode::MOORING_FILE_NAN_HYDROPROP:
return "NaN found in 'hydroproperty' 'id'.";
case ErrorCode::MOORING_FILE_OUTOFRANGE_HYDROPROP_ID:
return "Found 'hydroproperty' 'id' out of range.";
case ErrorCode::MOORING_FIEL_INCOMPLETE_HYDRO_COEFFICIENTS:
return ("Incomplete addedmasscoefficient or dragcoefficient data."
"Required are 'tangential', 'normal' and 'binormal' "
"components");
case ErrorCode::MOORING_FIEL_NAN_HYDRO_COEFFICIENTS:
return ("NaN found in 'addedmasscoefficient' or 'dragcoefficient' "
"data");
case ErrorCode::MOORING_FILE_MISSED_REPEATED_HYDROPROP_ID:
return ("Found 'hydroproperty' missed or repeatedly defined. "
"Check 'hydroproperty' 'id' and the 'number' of "
"'hydroproperties'.");
// Seabed property error.
case ErrorCode::MOORING_FILE_BAD_SEABEDPROPS_NUM:
return "Unacceptable number of 'seabedproperties'.";
case ErrorCode::MOORING_FILE_NO_SEABEDPROP:
return "Unable to find at least one 'seabedproperty' definition.";
case ErrorCode::MOORING_FILE_INCOMPLETE_SEABEDPROP_DEF:
return ("Incomplete seabedproperty data. Required are 'id', "
"'dampingcoefficient' and 'stiffnesscoefficient'.");
case ErrorCode::MOORING_FILE_NAN_SEABEDPROP:
return ("NaN found in 'seabedproperty' data.");
case ErrorCode::MOORING_FILE_OUTOFRANGE_SEABEDPROP_ID:
return ("Seabedproperty 'id' is out of range!\n");
case ErrorCode::MOORING_FILE_MISSED_REPEATED_SEABEDPROP_ID:
return ("Found 'seabedproperty' missed or repeatedly defined. "
"Check 'seabedproperty' 'id' and the number of "
"'seabedproperties'.");
// Current error.
case ErrorCode::MOORING_FILE_BAD_CURRENTS_NUM:
return "Unacceptable of number of 'currents'.";
case ErrorCode::MOORING_FILE_NO_CURRENT:
return "Unable find at least one current definition";
case ErrorCode::MOORING_FILE_INCOMPLETE_CURRENT_DEF:
return ("Incomplete current data. Required are 'id', "
"'polyorder' and 'profilefile'.");
case ErrorCode::MOORING_FILE_NAN_CURRENT:
return "NaN found in current 'id' or 'polyorder'.";
case ErrorCode::MOORING_FILE_OUTOFRANGE_CURRENT_ID:
return "Found out of range current 'id'.";
case ErrorCode::MOORING_FILE_MISSED_REPEATED_CURRENT_ID:
return ("Found 'current' missed or repeatedly defined. "
"Check 'current' 'id' and the number of 'currents'.");
case ErrorCode::MOORING_FILE_BAD_CURRENT_DATA:
return ("Unacceptable current profile data or NaN found. Check "
"current data file. Current data file should have one line "
"of header and data matrix with 6 columns containing "
"three coordinates in global reference system and three "
"current velocities.");
// Solver error.
case ErrorCode::MOORING_FILE_BAD_SOLVERS_NUM:
return "Unacceptable number of 'solvers'.";
case ErrorCode::MOORING_FILE_NO_SOLVER:
return "Unable to find at least one 'solver' definition.";
case ErrorCode::MOORING_FILE_INCOMPLETE_SOLVER_DEF:
return ("Incomplete solver definition. Required are 'id', "
"'iterationnumberlimit', 'convergencetolerance', "
"'initialrelaxationfactor', 'relaxationincreasefactor', "
"'relaxationdecreasefactor' and 'lambdainfinity'");
case ErrorCode::MOORING_FILE_NAN_SOLVER:
return "NaN found in 'solver' definition.";
case ErrorCode::MOORING_FILE_OUTOFRANGE_SOLVER_ID:
return ("Found solver 'id' out of range of the 'number' of "
"'solvers'.");
case ErrorCode::MOORING_FILE_MISSED_REPEATED_SOLVER_ID:
return ("Found 'solver' missed or repeatedly defined. "
"Check 'solver' 'id' and the number of 'solvers'.");
// Setting error.
case ErrorCode::SETTING_FILE_NONEXISTENT:
return "Failed to find Setting.xml file.";
case ErrorCode::SETTING_FILE_ERROR_PARSE:
return "Found xml parse error in Setting.xml.";
case ErrorCode::SETTING_FILE_NO_SETTING_NODE:
return "Root node of Setting.xml must be setting.";
case ErrorCode::SETTING_FILE_NO_SIMULATION_TYPE:
return "Failed to find 'simulationtype' definition in Setting.xml.";
case ErrorCode::SETTING_FILE_UNKNOWN_SIMULATION_TYPE:
return ("Found unknown 'simulationtype'. Currently supported are "
"'shooting', 'relaxation', and 'forcedmotion'.");
case ErrorCode::SETTING_FILE_NO_MOORING_FILE_DEF:
return "Failed to find 'mooringinputfile' definition in Setting.xml.";
case ErrorCode::SETTING_FILE_NO_SHOOTING_PARA:
return "Unable to find 'shooting' parameter definition.";
case ErrorCode::SETTING_FILE_INCOMPLETE_SHOOTING_PARA:
return ("Incomplete parameters for shooting. Required are "
"'fairleadpositiontolerance', "
"'fairleadforcerelaxationfactor', "
"'fairleadpositioniterationlimit', "
"'platformpositioniterationlimit', "
"'platformdisplacementtolerance', "
"'platformdisplacementrelaxationfactor', "
"'cableoutofplanestiffness', "
"'platformhydrostaticstiffness' and "
"'platformotherload'.");
case ErrorCode::SETTING_FILE_NAN_SHOOTING_PARA:
return ("NaN found in shooting parameters: "
"'fairleadpositiontolerance', "
"'fairleadforcerelaxationfactor', "
"'fairleadpositioniterationlimit', "
"'platformpositioniterationlimit', "
"'platformdisplacementtolerance' or "
"'platformdisplacementrelaxationfactor'.");
case ErrorCode::SETTING_FILE_INCOMPLETE_SHOOTING_FAIRLEAD_TOLERANCE:
return ("Incomplete definition of 'shooting' parameter "
"fairleadpositiontolerance.");
case ErrorCode::SETTING_FILE_NAN_SHOOTING_FAIRLEAD_TOLERANCE:
return ("NaN found in 'shooting' parameter "
"'fairleadpositiontolerance'.");
case ErrorCode::SETTING_FILE_BAD_SHOOTING_STIFFNESS:
return ("NaN or not 36 elements found in "
"'platformhydrostaticstiffness' for "
"'shooting'.");
case ErrorCode::SETTING_FILE_BAD_SHOOTING_LOAD:
return ("NaN or not 6 elements found in 'platformotherload' for "
"'shooting'.");
case ErrorCode::SETTING_FILE_NO_RELAXATION_PARA:
return "Unable to find 'relaxation' parameter definition.";
case ErrorCode::SETTING_FILE_INCOMPLETE_RELAXATION:
return ("Incomplete parameters for 'relaxation'. Required are "
"'platformvelocitytolerance', 'cablevelocitytolerance', "
"'stoptime', 'timestep', 'platformmass', "
"'platformdamping', 'platformhydrostaticstiffness' and "
"'platformotherload'.");
case ErrorCode::SETTING_FILE_NAN_RELAXATION_PARA:
return ("NaN found in 'relaxation' parameters: "
"'platformvelocitytolerance', 'cablevelocitytolerance'"
"'stoptime', or 'timestep'.");
case ErrorCode::SETTING_FILE_BAD_RELAXATION_MASS:
return ("NaN or not 36 elements found in "
"'platformmass' for 'relaxtion'.");
case ErrorCode::SETTING_FILE_BAD_RELAXATION_DAMPING:
return ("NaN or not 36 elements found in "
"'platformdamping' for 'relaxtion'.");
case ErrorCode::SETTING_FILE_BAD_RELAXATION_STIFFNESS:
return ("NaN or not 36 elements found in "
"'platformhydrostaticstiffness' for 'relaxtion'.");
case ErrorCode::SETTING_FILE_BAD_RELAXATION_LOAD:
return ("NaN or not 6 elements found in 'platformotherload' for "
"'relaxtion'.");
case ErrorCode::SETTING_FILE_NO_MOTION:
return "Unable to find 'forcedmotion' node in Setting.xml.";
case ErrorCode::SETTING_FILE_NO_TIME_HISTORY:
return "Unable to find 'timehistory' file definition.";
// Validation of mooring input data.
case ErrorCode::MOORING_INVALID_CONSTANT:
return "Found nonpositive constants.";
case ErrorCode::MOORING_INVALID_CABLE_CURRENT_INDEX:
return "Cable 'icurrent' is out of range.";
case ErrorCode::MOORING_INVALID_CABLE_SOLVER_INDEX:
return "Cable 'isolver' is out of range.";
case ErrorCode::MOORING_INVALID_CABLE_NODE_NUM:
return "Cable 'nodenumber' is negative.";
case ErrorCode::MOORING_INVALID_CABLE_PROP_ASSOCIATION:
return ("Failed to find at least one group of cable length and "
"associated property or found inconsistent cable segments "
"and properties definitions.");
case ErrorCode::MOORING_INVALID_CABLE_CONNECTION_INDEX:
return ("Two same ends found for a cable or cable connection index "
"out of range. In addtion, currently, the first connection "
"must be an 'anchor' and the second must be a 'fairlead'.");
case ErrorCode::MOORING_INVALID_CABLE_SEGMENT_LENGTH:
return "Cable segmentlength should be positive.";
case ErrorCode::MOORING_INVALID_STRUCT_PROP:
return ("Positive values required for diameter, unitlengthmass, "
" unitlengthweight, and axialstiffness.");
case ErrorCode::MOORING_INVALID_HYDRO_COEFFICIENT:
return ("Nonnegative values required for bending stiffness, "
"torsional stiffness and damping coefficient.");
case ErrorCode::MOORING_INVALID_SEABED:
return ("Nonnegative values required hydrodynamic coefficients.");
case ErrorCode::MOORING_INVALID_CURRENT:
return ("Invalid current data. Required are that polyorder is "
"nonnegative and less then the number of profile data "
"points and at least one data point provided. In addition, "
"the Z coordinate should be negative and decreasing "
"monotonically");
case ErrorCode::MOORING_INVALID_SOLVER:
return ("Invalid solver found: iterationnumberlimit, "
"convergencetolerance, "
"initialrelaxationfactor, relaxationincreasefactor, "
"and relaxationdecreasefactor should be positive numbers; "
"relaxationincreasefactor and relaxationincreasefactor "
"should be no less than 1; lambdainfinity should not be equal "
"to 1 and often between -1 and 0.");
case ErrorCode::MOORING_INVALID_CABLE_STATE:
return ("Initial cable state matrix read successfully, however, "
"the cable coordinate is not valid. The cable coordinate "
"should be positive, begining with zero, increasing "
"monotonically and terminating with full cable length "
"consistent with the sum of segmentlength and at "
"least two nodes are required. Check the first column of "
"initial state file and the 'segmentlength'.");
case ErrorCode::SHOOTING_BAD_PARA:
return ("Found nonpositive tolerance or relaxation factor or "
"negative iteration limit in shooting control.");
case ErrorCode::RELAXATION_BAD_PARA:
return ("Found nonpositive tolerance, steptime, or timestep.");
case ErrorCode::CURRENT_FILE_NONEXISTENT:
return "Unable to find current profile data file.";
case ErrorCode::CURRENT_FILE_BAD_DATA:
return ("Found NaN or wrong column number (expect 6) of current "
"profile data.");
case ErrorCode::MOTION_FILE_NONEXISTENT:
return "Unable to find forcedmotion time history data.";
case ErrorCode::MOTION_FILE_BAD_DATA:
return ("Found NaN or wrong column number (expect 7) of forced "
"motion time history.");
case ErrorCode::FORCED_MOTION_BAD_TIME:
return "Found negative or decreasing time in the forced velocity.";
case ErrorCode::TIME_STEP_TOO_SMALL:
return "Time step too small, no need to update.";
case ErrorCode::SINGULAR_MATRIX_SOLVER:
return ("Singularity found in solving the cable equation. "
"Check input.");
case ErrorCode::NAN_CABLE_SOLUTION:
return ("NaN found in cable state solution.");
}
}
} // End of namespace moor.
| 45.8
| 83
| 0.623078
|
CHEN-Lin
|
76b1445040b47301c1d5ceb15e854fd7590c3876
| 574
|
cpp
|
C++
|
3/3/35.cpp
|
Jamxscape/LearnCPlusPlus
|
9770af743a2f6e9267421ff8fec93eb9d81c1f14
|
[
"Apache-2.0"
] | null | null | null |
3/3/35.cpp
|
Jamxscape/LearnCPlusPlus
|
9770af743a2f6e9267421ff8fec93eb9d81c1f14
|
[
"Apache-2.0"
] | null | null | null |
3/3/35.cpp
|
Jamxscape/LearnCPlusPlus
|
9770af743a2f6e9267421ff8fec93eb9d81c1f14
|
[
"Apache-2.0"
] | null | null | null |
//
// 35.cpp
// 3
//
// Created by 马元 on 2016/12/25.
// Copyright © 2016年 MaYuan. All rights reserved.
//大家提到LTC都佩服的不行,不过,如果竞赛只有这一个题目,我敢保证你和他绝对在一个水平线上你的任务是:计算方程x^2+y^2+z^2= num的一个正整数解。Input输入数据包含多个测试实例,每个实例占一行,仅仅包含一个小于等于10000的正整数num。Output对于每组测试数据,请按照x,y,z递增的顺序输出它的一个最小正整数解,每个实例的输出占一行,题目保证所有测试数据都有解。
#include <iostream>
using namespace std;
int main35()
{
int num,x,y,z;
cin>>num;
for(x=0;x<num;x++)
for(y=0;y<num;y++)
for(z=0;z<num;z++)
if(x*x+y*y+z*z==num)cout<<x<<" "<<y<<" "<<z<<endl;
cout<<endl;
return 0;
}
| 26.090909
| 196
| 0.627178
|
Jamxscape
|
76b2c5fdc93414e954ec805be777754828ea48ef
| 739
|
cpp
|
C++
|
src/VK/SemaphoreWrapper.cpp
|
razerx100/Terra
|
a30738149cb07325283c2da9ac7972f079cb4dbc
|
[
"MIT"
] | null | null | null |
src/VK/SemaphoreWrapper.cpp
|
razerx100/Terra
|
a30738149cb07325283c2da9ac7972f079cb4dbc
|
[
"MIT"
] | null | null | null |
src/VK/SemaphoreWrapper.cpp
|
razerx100/Terra
|
a30738149cb07325283c2da9ac7972f079cb4dbc
|
[
"MIT"
] | null | null | null |
#include <SemaphoreWrapper.hpp>
#include <VKThrowMacros.hpp>
SemaphoreWrapper::SemaphoreWrapper(VkDevice device, size_t count)
: m_deviceRef(device), m_semaphores(count) {
VkSemaphoreCreateInfo semaphoreInfo = {};
semaphoreInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
VkResult result;
for (size_t index = 0u; index < count; ++index)
VK_THROW_FAILED(result,
vkCreateSemaphore(device, &semaphoreInfo, nullptr, &m_semaphores[index])
);
}
SemaphoreWrapper::~SemaphoreWrapper() noexcept {
for (const auto semaphore : m_semaphores)
vkDestroySemaphore(m_deviceRef, semaphore, nullptr);
}
VkSemaphore SemaphoreWrapper::GetSemaphore(size_t index) const noexcept {
return m_semaphores[index];
}
| 29.56
| 76
| 0.759134
|
razerx100
|
76b2d918729e127a4b073b29b126d91cd5f6e0d2
| 1,049
|
cpp
|
C++
|
Chapter_3/p3_16.cpp
|
aalogancheney/CPlusPlus_For_Everyone
|
251247cf1f1ca169826179379831192fadfaa5f9
|
[
"MIT"
] | null | null | null |
Chapter_3/p3_16.cpp
|
aalogancheney/CPlusPlus_For_Everyone
|
251247cf1f1ca169826179379831192fadfaa5f9
|
[
"MIT"
] | null | null | null |
Chapter_3/p3_16.cpp
|
aalogancheney/CPlusPlus_For_Everyone
|
251247cf1f1ca169826179379831192fadfaa5f9
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include <string>
using std::cin;
using std::cout;
using std::endl;
using std::string;
void ClearInputDisplayMessage(const string& message)
{
cout << message << endl;
cin.clear();
string ignore;
getline(cin, ignore);
}
int main(int argc, char *argv[])
{
cout << "Enter the employees name: ";
string name;
getline(cin, name);
while(cin.fail())
{
ClearInputDisplayMessage("Please enter a valid name: ");
getline(cin, name);
}
cout << "Enter the employees hourly wage: ";
double wage;
cin >> wage;
while(cin.fail())
{
ClearInputDisplayMessage("Please enter a valid wage: ");
cin >> wage;
}
cout << "How many hours did " << name << " work last week? ";
double hours;
cin >> hours;
while(cin.fail())
{
ClearInputDisplayMessage("Please enter a valid number of hours: ");
cin >> hours;
}
double totalPay = 0;
if(hours > 40)
{
totalPay += wage * 40 + wage * 1.5 * (hours - 40);
}
else
{
totalPay += wage * hours;
}
cout << name << "'s Paycheck: " << totalPay << endl;
return 0;
}
| 16.919355
| 69
| 0.632984
|
aalogancheney
|
76b4b622cd484e8969d77bfa2d4b292a7158258f
| 2,880
|
hpp
|
C++
|
src/io/FileWriterInterface.hpp
|
spraetor/amdis2
|
53c45c81a65752a8fafbb54f9ae6724a86639dcd
|
[
"MIT"
] | 2
|
2018-07-04T16:44:04.000Z
|
2021-01-03T07:26:27.000Z
|
src/io/FileWriterInterface.hpp
|
spraetor/amdis2
|
53c45c81a65752a8fafbb54f9ae6724a86639dcd
|
[
"MIT"
] | null | null | null |
src/io/FileWriterInterface.hpp
|
spraetor/amdis2
|
53c45c81a65752a8fafbb54f9ae6724a86639dcd
|
[
"MIT"
] | null | null | null |
/** \defgroup Output Output module
* @{ <img src="output.png"> @}
*/
#pragma once
#include <vector>
#include <string>
#include "AMDiS_fwd.hpp"
#include "Mesh.hpp"
namespace AMDiS
{
class FileWriterInterface
{
public:
FileWriterInterface()
: filename(""),
appendIndex(0),
indexLength(5),
indexDecimals(3),
createSubDir(-1),
tsModulo(1),
timeModulo(-1.0),
lastWriteTime(-1.0),
traverseLevel(-1),
traverseFlag(Mesh::CALL_LEAF_EL),
writeElement(NULL)
{}
virtual ~FileWriterInterface() {}
/** \brief
* Interface. Must be overridden in subclasses.
* \param time time index of solution std::vector.
* \param force enforces the output operation for the last timestep.
*/
virtual void writeFiles(AdaptInfo& adaptInfo, bool force,
int level = -1,
Flag traverseFlag = Mesh::CALL_LEAF_EL,
bool (*writeElem)(ElInfo*) = NULL) = 0;
/// Test whether timestep should be written
virtual bool doWriteTimestep(AdaptInfo& adaptInfo, bool force);
std::string getFilename()
{
return filename;
}
void setFilename(std::string n)
{
filename = n;
}
void setWriteModulo(int tsModulo_ = 1, double timeModulo_ = -1.0)
{
tsModulo = tsModulo_;
timeModulo = timeModulo_;
}
void setTraverseProperties(int level,
Flag flag,
bool (*writeElem)(ElInfo*))
{
traverseLevel = level;
traverseFlag |= flag;
writeElement = writeElem;
}
protected:
/// Reads all file writer dependend parameters from the init file.
virtual void readParameters(std::string name);
/// create a filename that includes the timestep and possibly a processor ID in parallel mode
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
void getFilename(AdaptInfo& adaptInfo, std::string& fn, std::string& paraFilename, std::string& postfix);
#else
void getFilename(AdaptInfo& adaptInfo, std::string& fn);
#endif
/// Used filename prefix.
std::string filename;
/// 0: Don't append time index to filename prefix.
/// 1: Append time index to filename prefix.
int appendIndex;
/// Total length of appended time index.
int indexLength;
/// Number of decimals in time index.
int indexDecimals;
/// create a subdirectory where to put the files
int createSubDir;
/// Timestep modulo: write only every tsModulo-th timestep!
int tsModulo;
/// Time modulo: write at first iteration after lastWriteTime + timeModulo
double timeModulo;
double lastWriteTime;
/// Traverse properties
int traverseLevel;
Flag traverseFlag;
bool (*writeElement)(ElInfo*);
};
} // end namespace AMDiS
| 25.263158
| 109
| 0.621875
|
spraetor
|
76b777a4b45c88e0548d0939d5c537fbebce4b59
| 269
|
cpp
|
C++
|
src/ComponentSet.cpp
|
Konijnendijk/Meadows-ECS
|
5ee2619481086edaabcfa235e2455686cb854901
|
[
"BSL-1.0",
"MIT"
] | 1
|
2017-11-22T11:39:25.000Z
|
2017-11-22T11:39:25.000Z
|
src/ComponentSet.cpp
|
Konijnendijk/Meadows-ECS
|
5ee2619481086edaabcfa235e2455686cb854901
|
[
"BSL-1.0",
"MIT"
] | null | null | null |
src/ComponentSet.cpp
|
Konijnendijk/Meadows-ECS
|
5ee2619481086edaabcfa235e2455686cb854901
|
[
"BSL-1.0",
"MIT"
] | null | null | null |
#include "ComponentSet.h"
using namespace Meadows;
ComponentSet::ComponentSet() : componentBitSet(ComponentRegistry::getNumRegisteredComponents()) {
}
ComponentSet::~ComponentSet() {
for (Component* component : components) {
delete(component);
}
}
| 17.933333
| 97
| 0.717472
|
Konijnendijk
|
76be93f1975379ff4d2dbd50e15a7220270d08af
| 304
|
cpp
|
C++
|
cc/tests/test1/submit.cpp
|
DragoonKiller/bruteforces
|
e6283b18c692a3726e7e52a6a60e64ddc903da91
|
[
"MIT"
] | null | null | null |
cc/tests/test1/submit.cpp
|
DragoonKiller/bruteforces
|
e6283b18c692a3726e7e52a6a60e64ddc903da91
|
[
"MIT"
] | null | null | null |
cc/tests/test1/submit.cpp
|
DragoonKiller/bruteforces
|
e6283b18c692a3726e7e52a6a60e64ddc903da91
|
[
"MIT"
] | null | null | null |
static void this_is_a_function_in_brute_gen_in_all_hpp() { }
static void this_is_a_function_in_bits_hpp() { }
#include <bits/stdc++.h>
static void this_is_another_function_in_bits_hpp() { }
#include <chrono>
static void this_is_a_function_outof_brute_gen_in_all_hpp() { }
int main()
{
return 0;
}
| 21.714286
| 63
| 0.776316
|
DragoonKiller
|
76c2f4df9cb8a71855172fdb7ebc46cab2b57915
| 8,603
|
cpp
|
C++
|
src/ui/SciControl/CScintillaController.cpp
|
masmullin2000/codeassistor
|
82389e16dda7be522ee5370aae441724da2e9cf2
|
[
"BSD-4-Clause"
] | null | null | null |
src/ui/SciControl/CScintillaController.cpp
|
masmullin2000/codeassistor
|
82389e16dda7be522ee5370aae441724da2e9cf2
|
[
"BSD-4-Clause"
] | null | null | null |
src/ui/SciControl/CScintillaController.cpp
|
masmullin2000/codeassistor
|
82389e16dda7be522ee5370aae441724da2e9cf2
|
[
"BSD-4-Clause"
] | null | null | null |
/** title info */
#include "CScintillaController.h"
#include "ScintillaSend.h"
#include "common_defs.h"
/* colourizing defines */
#if PLATFORM == MAC
#define DEF_KEYW_1 "#FF627E"
#define DEF_KEYW_2 "#FF00FF"
#define DEF_NUM "#0000FF"
#define DEF_OP "#0000FF"
#define DEF_STRING "#EE9A4D"
#define DEF_STRING_EOL "#D4A9EE"
#define DEF_CHAR "#0022FF"
#define DEF_PREPRO "#C35617"
#define DEF_IDENT "#000000"
#define DEF_COMMENT "#777777"
#define DEF_COMMENT_2 "#444444"
#define DEF_MARGIN "#DADADA"
#define DEF_LINE_NO "#CFCFCF"
#else
#define DEF_KEYW_1 "#FF627E"
#define DEF_KEYW_2 "#FF00FF"
#define DEF_NUM "#AAAAFF"
#define DEF_OP "#DDAADD"
#define DEF_STRING "#EE9A4D"
#define DEF_STRING_EOL "#D4A9EE"
#define DEF_CHAR "#0022FF"
#define DEF_PREPRO "#C35617"
#define DEF_IDENT "#999988"
#define DEF_COMMENT "#777777"
#define DEF_COMMENT_2 "#444444"
#define DEF_MARGIN "#323232"
#define DEF_LINE_NO "#434343"
#endif
#define TAB_WIDTH 2
CScintillaController* CScintillaController::_me = NULL;
/* The CScintillaController is a singleton */
ScintillaController*
CScintillaController::getInstance()
{
if( !_me ) _me = new CScintillaController();
return _me;
}
void
CScintillaController::setDefaultEditor
(
void* sci,
fileType_t subtype
)
{
ScintillaSend* send = ScintillaSend::getInstance();
const char* keywordsToUse = NULL;
const char* secondaryKeywordsToUse = CStdLibrary;
ScintillaController::setDefaultEditor(sci,subtype);
#if PLATFORM != MAC
send->set(sci,SCI_STYLESETBACK,STYLE_DEFAULT,0);
send->set(sci,SCI_STYLESETFORE,STYLE_DEFAULT,0);
send->set(sci,SCI_SETCARETFORE,255,0);
send->set(sci,SCI_STYLECLEARALL,0,0);
#endif
// CPP is used, this is also good for ObjC/Java/C
send->set(sci,SCI_SETLEXER,SCLEX_CPP,0);
send->set(sci,SCI_SETSTYLEBITS,send->get(sci,SCI_GETSTYLEBITSNEEDED),0);
// tabs are replaced with spaces, tabs are 2 spaces wide
send->set(sci,SCI_SETUSETABS,0,0);
send->set(sci,SCI_SETTABWIDTH,TAB_WIDTH,0);
switch( subtype )
{
case CFILE:
keywordsToUse = CKeywords;
break;
case CPPFILE:
keywordsToUse = CppKeywords;
break;
case OBJCFILE:
keywordsToUse = ObjCKeywords;
break;
case OBJCPPFILE:
keywordsToUse = ObjCppKeywords;
break;
case HDFILE:
keywordsToUse = HKeywords;
break;
case JFILE:
keywordsToUse = JKeywords;
secondaryKeywordsToUse = JClasses;
break;
default:
keywordsToUse = "error";
}
send->set(sci,SCI_SETKEYWORDS,0,(void*)keywordsToUse);
send->set(sci,SCI_SETKEYWORDS,1,(void*)secondaryKeywordsToUse);
for( int i = 0; i <= SCE_C_USERLITERAL; i++ )
send->set(sci,SCI_STYLESETFORE,i,"#FFFFFF",true);
send->set(sci,SCI_SETSELFORE,true,255|255<<8|255<<16);
send->set(sci,SCI_SETSELBACK,true,64|64<<8|64<<16);
// set the font for strings (ie "this is a string" ) as itali
send->set(sci,SCI_STYLESETFONT,SCE_C_STRING,ITALIC_STRING);
send->set(sci,SCI_STYLESETITALIC,SCE_C_STRING,1);
send->set(sci,SCI_STYLESETBOLD,SCE_C_STRING,1);
send->set(sci,SCI_STYLESETSIZE,SCE_C_STRING,INITIAL_TEXT_SIZE);
// colourizing
// keywords
send->set(sci,SCI_STYLESETFORE,SCE_C_WORD,DEF_KEYW_1,true);
send->set(sci,SCI_STYLESETFORE,SCE_C_WORD|0x40,DEF_COMMENT,true);
// c standard lib
send->set(sci,SCI_STYLESETFORE,SCE_C_WORD2,DEF_KEYW_2,true);
send->set(sci,SCI_STYLESETFORE,SCE_C_WORD2|0x40,DEF_COMMENT,true);
// numbers
send->set(sci,SCI_STYLESETFORE,SCE_C_NUMBER,DEF_NUM,true);
send->set(sci,SCI_STYLESETFORE,SCE_C_NUMBER|0x40,DEF_COMMENT,true);
// operators/operations
send->set(sci,SCI_STYLESETFORE,SCE_C_OPERATOR,DEF_OP,true);
send->set(sci,SCI_STYLESETFORE,SCE_C_OPERATOR|0x40,DEF_COMMENT,true);
// strings
send->set(sci,SCI_STYLESETFORE,SCE_C_STRING,DEF_STRING,true);
send->set(sci,SCI_STYLESETFORE,SCE_C_STRING|0x40,DEF_COMMENT,true);
send->set(sci,SCI_STYLESETFORE,SCE_C_STRINGEOL,DEF_STRING_EOL,true);
send->set(sci,SCI_STYLESETFORE,SCE_C_STRINGEOL|0x40,DEF_COMMENT,true);
// 'a' characters
send->set(sci,SCI_STYLESETFORE,SCE_C_CHARACTER,DEF_CHAR,true);
send->set(sci,SCI_STYLESETFORE,SCE_C_CHARACTER|0x40,DEF_COMMENT,true);
// preprocessors #define/#include
send->set(sci,SCI_STYLESETFORE,SCE_C_PREPROCESSOR,DEF_PREPRO,true);
send->set(sci,SCI_STYLESETFORE,SCE_C_PREPROCESSOR|0x40,DEF_COMMENT,true);
// identifiers aka everything else
send->set(sci,SCI_STYLESETFORE,SCE_C_IDENTIFIER,DEF_IDENT,true);
send->set(sci,SCI_STYLESETFORE,SCE_C_IDENTIFIER|0x40,DEF_COMMENT,true);
// comments
send->set(sci,SCI_STYLESETFORE,SCE_C_COMMENT,DEF_COMMENT,true);
send->set(sci,SCI_STYLESETFORE,SCE_C_COMMENTLINE,DEF_COMMENT,true);
send->set(sci,SCI_STYLESETFORE,SCE_C_COMMENTDOC,DEF_COMMENT,true);
send->set(sci,SCI_STYLESETFORE,SCE_C_COMMENTLINEDOC,DEF_COMMENT,true);
send->set(sci,SCI_STYLESETFORE,SCE_C_COMMENTDOCKEYWORD,DEF_COMMENT_2,true);
send->set(sci,SCI_STYLESETFORE,SCE_C_COMMENTDOCKEYWORDERROR,DEF_COMMENT_2,true);
// send->set(sci,SCI_STYLESETFORE,SCE_C_GLOBALCLASS,"#FFFFFF",true);
// Line numbering
send->set(sci,SCI_STYLESETFORE,STYLE_LINENUMBER,DEF_IDENT,true);
send->set(sci,SCI_STYLESETBACK,STYLE_LINENUMBER,DEF_LINE_NO,true);
send->set(sci,SCI_SETMARGINTYPEN,0,SC_MARGIN_NUMBER);
send->set(sci,SCI_SETMARGINWIDTHN,0,48);
// long lines
send->set(sci,SCI_SETEDGEMODE,1,0);
send->set(sci,SCI_SETEDGECOLUMN,80,0);
// folding
send->set(sci,SCI_SETFOLDMARGINCOLOUR,true,DEF_MARGIN,true);
send->set(sci,SCI_SETFOLDMARGINHICOLOUR,true,DEF_MARGIN,true);
send->set(sci,SCI_SETMARGINWIDTHN,1,18);
send->set(sci,SCI_SETFOLDFLAGS,SC_FOLDFLAG_LINEAFTER_CONTRACTED,0);
send->set(sci,SCI_SETPROPERTY,"fold","1");
send->set(sci,SCI_SETPROPERTY,"fold.compact","0");
send->set(sci,SCI_SETPROPERTY,"fold.at.else","1");
send->set(sci,SCI_SETPROPERTY,"fold.preprocessor","1");
// these new preprocessor features aren't working out so well for me
send->set(sci,SCI_SETPROPERTY,"lexer.cpp.track.preprocessor","0");
send->set(sci,SCI_SETPROPERTY,"lexer.cpp.update.preprocessor","0");
send->set(sci,SCI_SETMARGINTYPEN, 1, SC_MARGIN_SYMBOL);
send->set(sci,SCI_SETMARGINMASKN, 1, SC_MASK_FOLDERS);
send->set(sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPEN, SC_MARK_ARROWDOWN);
send->set(sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDER, SC_MARK_ARROW);
send->set(sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDERSUB, SC_MARK_EMPTY);
send->set(sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDERTAIL, SC_MARK_EMPTY);
send->set(sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDEREND, SC_MARK_EMPTY);
send->set(sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDEROPENMID, SC_MARK_EMPTY);
send->set(sci,SCI_MARKERDEFINE, SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_EMPTY);
}
/*
Copyright (c) 2010, Michael Mullin <masmullin@gmail.com>
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.
3. All advertising materials mentioning features or use of this software
must display the following acknowledgement:
This product includes software developed by Michael Mullin <masmullin@gmail.com>.
4. Neither the name of Michael Mullin 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 MICHAEL MULLIN ''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 MICHAEL MULLIN 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.
*/
| 37.404348
| 84
| 0.749622
|
masmullin2000
|
76c8aee4977befd247672662a0830efb72cbde0c
| 10,425
|
cpp
|
C++
|
source/printf.cpp
|
Rohansi/RaspberryPi
|
8cc24fa49ae7842ee7a9df954fe9672d32826a4b
|
[
"MIT"
] | 3
|
2015-12-27T21:41:09.000Z
|
2017-03-28T14:29:09.000Z
|
source/printf.cpp
|
Rohansi/RaspberryPi
|
8cc24fa49ae7842ee7a9df954fe9672d32826a4b
|
[
"MIT"
] | null | null | null |
source/printf.cpp
|
Rohansi/RaspberryPi
|
8cc24fa49ae7842ee7a9df954fe9672d32826a4b
|
[
"MIT"
] | 2
|
2016-01-06T21:26:42.000Z
|
2021-02-18T16:47:25.000Z
|
//
// Created by Daniel Lindberg on 2015-11-29.
//
#include <limits.h>
#include "string.h"
#include "printf.h"
#define MAX_INTEGER_SIZE 65
#define FLAG_LEFT_ADJUST 0x01
#define FLAG_ALWAYS_SIGN 0x02
#define FLAG_PREPEND_SPACE 0x04
#define FLAG_ALTERNATIVE 0x08
#define FLAG_PAD_WITH_ZERO 0x10
#define INPUT_TYPE_hh 0
#define INPUT_TYPE_h 1
#define INPUT_TYPE_none 2
#define INPUT_TYPE_l 3
#define INPUT_TYPE_ll 4
#define INPUT_TYPE_j 5
#define INPUT_TYPE_z 6
#define INPUT_TYPE_t 7
#define INPUT_TYPE_L 8
typedef struct {
char *buffer;
char *buffer_end;
} printf_state_t;
typedef struct {
int flags;
size_t min_width;
size_t precision;
int input_type;
int format;
} printf_format_t;
static size_t render_integer(char *buffer, int base, char ten, unsigned long long int val) {
size_t index = MAX_INTEGER_SIZE - 1;
buffer[index--] = '\0';
if (base > 10) {
do {
int mod = (int)(val % base);
if (mod < 10) {
buffer[index--] = (char)('0' + mod);
} else {
buffer[index--] = (char)(ten + mod - 10);
}
val /= base;
} while (val != 0);
} else {
do {
buffer[index--] = (char)('0' + val % base);
val /= base;
} while (val != 0);
}
return index + 1;
}
static inline const char *read_format_integer(const char *format) {
if (*format == '*') {
return format + 1;
}
while (*format >= '0' && *format <= '9') {
format++;
}
return format;
}
static inline int parse_format_integer(const char *beg, const char *end) {
int result = 0;
int multiplier = 1;
while (end != beg) {
end--;
result += multiplier * (*end - '0');
multiplier *= 10;
}
return result;
}
static inline void output_char(printf_state_t *state, char c) {
if (state->buffer != state->buffer_end) {
*state->buffer++ = c;
}
}
static inline void output_n_chars(printf_state_t *state, char c, size_t n) {
size_t left = state->buffer_end - state->buffer;
n = n > left ? left : n;
while (n--) {
*state->buffer++ = c;
}
}
static inline void output_string(printf_state_t *state, const char *str, size_t n) {
size_t left = state->buffer_end - state->buffer;
n = n > left ? left : n;
while (n--) {
*state->buffer++ = *str++;
}
}
static void write_string(printf_state_t *state, printf_format_t fmt, const char *val) {
size_t len = strlen(val);
size_t pad = 0;
if (fmt.precision != UINT_MAX && len > fmt.precision) {
len = (size_t)fmt.precision;
}
if (len < fmt.min_width) {
pad = fmt.min_width - len;
}
if (!(fmt.flags & FLAG_LEFT_ADJUST)) {
output_n_chars(state, ' ', pad);
}
output_string(state, val, len);
if (fmt.flags & FLAG_LEFT_ADJUST) {
output_n_chars(state, ' ', pad);
}
}
static void write_signed(printf_state_t *state, printf_format_t fmt, long long int val) {
char sign = '\0';
char buffer[MAX_INTEGER_SIZE];
size_t index;
size_t length;
size_t padding = 0;
size_t extra_zeroes = 0;
if (fmt.precision == 0 && val == 0) {
index = MAX_INTEGER_SIZE - 1;
length = 0;
buffer[MAX_INTEGER_SIZE - 1] = '\0';
} else {
if (val < 0) {
index = render_integer(buffer, 10, 'a', -val);
} else {
index = render_integer(buffer, 10, 'a', val);
}
length = MAX_INTEGER_SIZE - index - 1;
}
if (fmt.precision != UINT_MAX && length < fmt.precision) {
extra_zeroes = fmt.precision - length;
length += extra_zeroes;
}
if (val < 0 || fmt.flags & FLAG_PREPEND_SPACE || fmt.flags & FLAG_ALWAYS_SIGN) {
length += 1;
}
if (length < fmt.min_width) {
padding = fmt.min_width - length;
}
if (val < 0) {
sign = '-';
} else if (fmt.flags & FLAG_ALWAYS_SIGN) {
sign = '+';
} else if (fmt.flags & FLAG_PREPEND_SPACE) {
sign = ' ';
}
if (!(fmt.flags & FLAG_LEFT_ADJUST)) {
output_n_chars(state, ' ', padding);
}
if (sign != '\0') {
output_char(state, sign);
}
output_n_chars(state, '0', extra_zeroes);
output_string(state, buffer + index, MAX_INTEGER_SIZE - index - 1);
if (fmt.flags & FLAG_LEFT_ADJUST) {
output_n_chars(state, ' ', padding);
}
}
static void write_unsigned(printf_state_t *state, printf_format_t fmt, unsigned long long int val) {
int base = 10;
char ten = 'a';
char buffer[MAX_INTEGER_SIZE];
size_t index;
size_t length;
size_t padding = 0;
size_t extra_zeroes = 0;
if (fmt.format == 'o') {
base = 8;
} else if (fmt.format == 'x') {
base = 16;
} else if (fmt.format == 'X') {
base = 16;
ten = 'A';
}
index = render_integer(buffer, base, ten, val);
length = MAX_INTEGER_SIZE - index - 1;
if (fmt.format == 'o' && fmt.flags & FLAG_ALTERNATIVE) {
if (buffer[index] != '0') {
size_t extra_zero = length + 1;
fmt.precision = fmt.precision < extra_zero ? extra_zero : fmt.precision;
}
} else if (fmt.precision == 0 && val == 0) {
index = MAX_INTEGER_SIZE - 1;
length = 0;
buffer[MAX_INTEGER_SIZE - 1] = '\0';
}
if (fmt.precision != UINT_MAX && length < fmt.precision) {
extra_zeroes = fmt.precision - length;
length += extra_zeroes;
}
if (val != 0 && base == 16 && fmt.flags & FLAG_ALTERNATIVE) {
length += 2;
}
if (length < fmt.min_width) {
padding = fmt.min_width - length;
}
if (!(fmt.flags & FLAG_LEFT_ADJUST)) {
output_n_chars(state, ' ', padding);
}
if (val != 0 && base == 16 && fmt.flags & FLAG_ALTERNATIVE) {
output_char(state, '0');
output_char(state, (char) fmt.format);
}
output_n_chars(state, '0', extra_zeroes);
output_string(state, buffer + index, MAX_INTEGER_SIZE - index - 1);
if (fmt.flags & FLAG_LEFT_ADJUST) {
output_n_chars(state, ' ', padding);
}
}
int vsnprintf(char *buffer, size_t bufsz, const char *format, va_list arg) {
printf_state_t state;
state.buffer = buffer;
state.buffer_end = buffer + bufsz - 1;
while (1) {
char c = *format++;
if (c == '\0') {
break;
} else if (c != '%') {
output_char(&state, c);
} else {
printf_format_t fmt;
fmt.flags = 0;
// parse flags
while (1) {
switch (*format) {
case '-': format++; fmt.flags |= FLAG_LEFT_ADJUST; continue;
case '+': format++; fmt.flags |= FLAG_ALWAYS_SIGN; continue;
case ' ': format++; fmt.flags |= FLAG_PREPEND_SPACE; continue;
case '#': format++; fmt.flags |= FLAG_ALTERNATIVE; continue;
case '0': format++; fmt.flags |= FLAG_PAD_WITH_ZERO; continue;
}
break;
}
// parse minimum width
// TODO: duplicated code with precision
const char *min_width_beg = format;
format = read_format_integer(format);
const char *min_width_end = format;
fmt.min_width = *min_width_beg == '*' ? va_arg(arg, int) : parse_format_integer(min_width_beg, min_width_end);
// parse precision (if there is one)
if (*format != '.') {
fmt.precision = UINT_MAX;
} else {
format++;
const char *precision_beg = format;
format = read_format_integer(format);
const char *precision_end = format;
fmt.precision = *precision_beg == '*' ? va_arg(arg, int) : parse_format_integer(precision_beg, precision_end);
}
// parse input type modifier
switch (*format) {
case 'h': format++; fmt.input_type = *format == 'h' ? INPUT_TYPE_hh : INPUT_TYPE_h; break;
case 'l': format++; fmt.input_type = *format == 'l' ? INPUT_TYPE_ll : INPUT_TYPE_l; break;
case 'j': format++; fmt.input_type = INPUT_TYPE_j; break;
case 'z': format++; fmt.input_type = INPUT_TYPE_z; break;
case 't': format++; fmt.input_type = INPUT_TYPE_t; break;
case 'L': format++; fmt.input_type = INPUT_TYPE_L; break;
default:
fmt.input_type = INPUT_TYPE_none;
break;
}
if (fmt.input_type == INPUT_TYPE_hh || fmt.input_type == INPUT_TYPE_ll) {
format++;
}
char str_buf[2];
const char *str_val;
long long int signed_val;
unsigned long long int unsigned_val;
fmt.format = *format++;
switch (fmt.format) {
case 'c':
signed_val = va_arg(arg, int);
str_buf[0] = (char)signed_val;
str_buf[1] = '\0';
write_string(&state, fmt, str_buf);
break;
case 's':
str_val = va_arg(arg, const char *);
write_string(&state, fmt, str_val);
break;
case 'd': case 'i':
signed_val = va_arg(arg, int);
write_signed(&state, fmt, signed_val);
break;
case 'o': case 'x': case 'X': case 'u':
unsigned_val = va_arg(arg, unsigned int);
write_unsigned(&state, fmt, unsigned_val);
break;
case 'f': case 'F':
case 'e': case 'E':
case 'a': case 'A':
case 'g': case 'G':
case 'n':
case 'p':
// TODO: us
break;
}
}
}
*state.buffer++ = '\0';
return (int)(state.buffer - buffer);
}
int snprintf(char *buffer, size_t bufsz, const char *format, ...) {
va_list arg;
va_start(arg, format);
int ret = vsnprintf(buffer, bufsz, format, arg);
va_end(arg);
return ret;
}
| 28.561644
| 126
| 0.526331
|
Rohansi
|
76d4f57531e01891535353830596594b082f7844
| 2,064
|
hpp
|
C++
|
include/boost/simd/arch/common/scalar/function/if_else_zero.hpp
|
yaeldarmon/boost.simd
|
561316cc54bdc6353ca78f3b6d7e9120acd11144
|
[
"BSL-1.0"
] | null | null | null |
include/boost/simd/arch/common/scalar/function/if_else_zero.hpp
|
yaeldarmon/boost.simd
|
561316cc54bdc6353ca78f3b6d7e9120acd11144
|
[
"BSL-1.0"
] | null | null | null |
include/boost/simd/arch/common/scalar/function/if_else_zero.hpp
|
yaeldarmon/boost.simd
|
561316cc54bdc6353ca78f3b6d7e9120acd11144
|
[
"BSL-1.0"
] | null | null | null |
//==================================================================================================
/*!
@file
@copyright 2015 NumScale SAS
@copyright 2015 J.T. Lapreste
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
*/
//==================================================================================================
#ifndef BOOST_SIMD_ARCH_COMMON_SCALAR_FUNCTION_IF_ELSE_ZERO_HPP_INCLUDED
#define BOOST_SIMD_ARCH_COMMON_SCALAR_FUNCTION_IF_ELSE_ZERO_HPP_INCLUDED
#include <boost/simd/constant/zero.hpp>
#include <boost/simd/function/scalar/is_nez.hpp>
#include <boost/dispatch/function/overload.hpp>
#include <boost/config.hpp>
namespace boost { namespace simd { namespace ext
{
BOOST_DISPATCH_OVERLOAD ( if_else_zero_
, (typename A0, typename A1)
, bd::cpu_
, bd::scalar_< logical_<A0> >
, bd::scalar_< bd::unspecified_<A1> >
)
{
BOOST_FORCEINLINE A1 operator() ( A0 a0, A1 const& a1) const BOOST_NOEXCEPT
{
return is_nez(a0) ? a1 : Zero<A1>();
}
};
BOOST_DISPATCH_OVERLOAD ( if_else_zero_
, (typename A0, typename A1)
, bd::cpu_
, bd::scalar_< bd::unspecified_<A0> >
, bd::scalar_< bd::unspecified_<A1> >
)
{
BOOST_FORCEINLINE A1 operator() ( A0 const& a0, A1 const& a1) const BOOST_NOEXCEPT
{
return is_nez(a0) ? a1 : Zero<A1>();
}
};
BOOST_DISPATCH_OVERLOAD ( if_else_zero_
, (typename A0)
, bd::cpu_
, bd::scalar_< bd::bool_<A0> >
, bd::scalar_< bd::bool_<A0> >
)
{
BOOST_FORCEINLINE bool operator() ( A0 a0, A0 a1) const BOOST_NOEXCEPT
{
return a0 ? a1 : false;
}
};
} } }
#endif
| 31.753846
| 100
| 0.493702
|
yaeldarmon
|
76e571f497eee37ee1d1c998d036ab36c27fb434
| 407
|
cpp
|
C++
|
atcoder.jp/abc176/abc176_c/Main.cpp
|
shikij1/AtCoder
|
7ae2946efdceaea3cc8725e99a2b9c137598e2f8
|
[
"MIT"
] | null | null | null |
atcoder.jp/abc176/abc176_c/Main.cpp
|
shikij1/AtCoder
|
7ae2946efdceaea3cc8725e99a2b9c137598e2f8
|
[
"MIT"
] | null | null | null |
atcoder.jp/abc176/abc176_c/Main.cpp
|
shikij1/AtCoder
|
7ae2946efdceaea3cc8725e99a2b9c137598e2f8
|
[
"MIT"
] | null | null | null |
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n;
cin >> n;
vector<long long> a(n);
for (long long i = 0; i < n; i++)
{
cin >> a[i];
}
long long sum = 0;
for (long long i = 1; i < n; i++)
{
if (a[i - 1] - a[i] > 0)
{
sum += a[i - 1] - a[i];
a[i] = a[i - 1];
}
}
cout << sum << endl;
}
| 17.695652
| 37
| 0.36855
|
shikij1
|
76f414310d4339aaf3d0b460446f0cf8c02a9f17
| 1,078
|
cpp
|
C++
|
Photon/photon/util/Transform.cpp
|
tatjam/Photon
|
a0c1584d10e1422cc2e468a6f94351a8310b7599
|
[
"MIT"
] | 1
|
2017-05-28T12:10:30.000Z
|
2017-05-28T12:10:30.000Z
|
Photon/photon/util/Transform.cpp
|
tatjam/Photon
|
a0c1584d10e1422cc2e468a6f94351a8310b7599
|
[
"MIT"
] | null | null | null |
Photon/photon/util/Transform.cpp
|
tatjam/Photon
|
a0c1584d10e1422cc2e468a6f94351a8310b7599
|
[
"MIT"
] | null | null | null |
#include "Transform.h"
namespace ph
{
glm::mat4 Transform::buildMatrix()
{
mat = glm::mat4();
mat = glm::translate(mat, pos);
glm::mat4 rotm = glm::mat4_cast(rot);
mat *= rotm;
mat = glm::scale(mat, scale);
return mat;
}
void Transform::rotEuler(glm::vec3 eu)
{
glm::quat qP = glm::angleAxis(glm::radians(eu.x), glm::vec3(1, 0, 0));
glm::quat qY = glm::angleAxis(glm::radians(eu.y), glm::vec3(0, 1, 0));
glm::quat qR = glm::angleAxis(glm::radians(eu.z), glm::vec3(0, 0, 1));
rot = qP * qY * qR;
}
glm::vec3 Transform::getEuler()
{
return glm::eulerAngles(rot);
}
void Transform::move(glm::vec3 o)
{
pos += o;
buildMatrix();
}
void Transform::rotate(glm::vec3 eu)
{
glm::vec3 curr = getEuler();
curr += eu;
glm::quat qP = glm::angleAxis(glm::radians(curr.x), glm::vec3(1, 0, 0));
glm::quat qY = glm::angleAxis(glm::radians(curr.y), glm::vec3(0, 1, 0));
glm::quat qR = glm::angleAxis(glm::radians(curr.z), glm::vec3(0, 0, 1));
rot = qP * qY * qR;
}
Transform::Transform()
{
}
Transform::~Transform()
{
}
}
| 17.966667
| 74
| 0.59462
|
tatjam
|
76f529c822bc107727ad263e023f4c0149759b69
| 1,576
|
hpp
|
C++
|
redist/inc/imqdst.hpp
|
gmarcon83/mq-mqi-nodejs
|
27d44772254d0d76438022c6305277f603ff6acb
|
[
"Apache-2.0"
] | null | null | null |
redist/inc/imqdst.hpp
|
gmarcon83/mq-mqi-nodejs
|
27d44772254d0d76438022c6305277f603ff6acb
|
[
"Apache-2.0"
] | null | null | null |
redist/inc/imqdst.hpp
|
gmarcon83/mq-mqi-nodejs
|
27d44772254d0d76438022c6305277f603ff6acb
|
[
"Apache-2.0"
] | null | null | null |
/* @(#) MQMBID sn=p924-L211104 su=_OdbBaj17EeygWfM06SbNXw pn=include/imqdst.pre_hpp */
#ifndef _IMQDST_HPP_
#define _IMQDST_HPP_
// Library: IBM MQ
// Component: IMQI (IBM MQ C++ MQI)
// Part: IMQDST.HPP
//
// Description: "ImqDistributionList" class declaration
// <copyright
// notice="lm-source-program"
// pids=""
// years="1994,2016"
// crc="257479060" >
// Licensed Materials - Property of IBM
//
//
//
// (C) Copyright IBM Corp. 1994, 2016 All Rights Reserved.
//
// US Government Users Restricted Rights - Use, duplication or
// disclosure restricted by GSA ADP Schedule Contract with
// IBM Corp.
// </copyright>
#include <imqque.hpp> // ImqQueue
#define ImqDistributionList ImqDst
class IMQ_EXPORTCLASS ImqDistributionList : public ImqQueue {
ImqQueue * opfirstDistributedQueue;
protected :
friend class ImqQueue ;
// Overloaded "ImqObject" methods:
virtual void openInformationDisperse ( );
virtual ImqBoolean openInformationPrepare ( );
// Overloaded "ImqQueue" methods:
virtual void putInformationDisperse ( ImqPmo & );
virtual ImqBoolean putInformationPrepare ( const ImqMsg &, ImqPmo & );
// New methods:
void setFirstDistributedQueue ( ImqQueue * pqueue = 0 )
{ opfirstDistributedQueue = pqueue ; }
public :
// New methods:
ImqDistributionList ( );
ImqDistributionList ( const ImqDistributionList & );
virtual ~ ImqDistributionList ( );
void operator = ( const ImqDistributionList & );
ImqQueue * firstDistributedQueue ( ) const
{ return opfirstDistributedQueue ; }
} ;
#endif
| 28.142857
| 86
| 0.706853
|
gmarcon83
|
76f885c2f0a786d1eecf066cc26c0cf3da44d3a2
| 230
|
cpp
|
C++
|
src/plane_traits.cpp
|
richard-vock/triplet_match
|
a0375e75e08357c71b8b3945cb508ffb519121f8
|
[
"CC0-1.0"
] | 3
|
2019-02-14T16:55:33.000Z
|
2022-02-07T13:08:47.000Z
|
src/plane_traits.cpp
|
richard-vock/triplet_match
|
a0375e75e08357c71b8b3945cb508ffb519121f8
|
[
"CC0-1.0"
] | 1
|
2019-02-14T17:10:37.000Z
|
2019-02-14T17:10:37.000Z
|
src/plane_traits.cpp
|
richard-vock/triplet_match
|
a0375e75e08357c71b8b3945cb508ffb519121f8
|
[
"CC0-1.0"
] | null | null | null |
#include <plane_traits>
#include <impl/plane_traits.hpp>
namespace triplet_match {
#define INSTANTIATE_PCL_POINT_TYPE(type) \
template struct plane_traits<type>;
#include "pcl_point_types.def"
} // namespace triplet_match
| 20.909091
| 42
| 0.782609
|
richard-vock
|
76fa0b5358e9073caaf294c15fc60955f02be592
| 3,010
|
cpp
|
C++
|
src/stms/curl.cpp
|
RotartsiORG/StoneMason
|
0f6efefad68b29e7e82524e705ce47606ba53665
|
[
"Apache-2.0"
] | 1
|
2021-10-02T19:31:14.000Z
|
2021-10-02T19:31:14.000Z
|
src/stms/curl.cpp
|
RotartsiORG/StoneMason
|
0f6efefad68b29e7e82524e705ce47606ba53665
|
[
"Apache-2.0"
] | 1
|
2020-06-17T01:15:45.000Z
|
2020-06-17T01:16:08.000Z
|
src/stms/curl.cpp
|
RotartsiORG/StoneMason
|
0f6efefad68b29e7e82524e705ce47606ba53665
|
[
"Apache-2.0"
] | 1
|
2020-10-17T23:57:27.000Z
|
2020-10-17T23:57:27.000Z
|
//
// Created by grant on 6/2/20.
//
#include "stms/curl.hpp"
#include <mutex>
#include "stms/logging.hpp"
namespace stms {
void initCurl() {
curl_global_init(CURL_GLOBAL_SSL | CURL_GLOBAL_WIN32);
auto version = curl_version_info(CURLVERSION_NOW);
STMS_INFO("LibCURL {}: On host '{}' with libZ {} & SSL {}", version->version, version->host, version->libz_version, version->ssl_version);
}
void quitCurl() {
curl_global_cleanup();
}
static size_t curlWriteCb(void *buf, size_t size, size_t nmemb, void *userDat) {
auto dat = reinterpret_cast<CURLHandle *>(userDat);
std::lock_guard<std::mutex> lg(dat->resultMtx);
dat->result.append(reinterpret_cast<char *>(buf), size * nmemb);
return size * nmemb;
}
static int curlProgressCb(void *userDat, double dTotal, double dNow, double uTotal, double uNow) {
auto dat = reinterpret_cast<CURLHandle *>(userDat);
dat->downloadTotal = dTotal;
dat->downloadSoFar = dNow;
dat->uploadSoFar = uNow;
dat->uploadTotal = uTotal;
return 0;
}
CURLHandle::CURLHandle(PoolLike *inPool) : pool(inPool), handle(curl_easy_init()) {
curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, curlWriteCb);
curl_easy_setopt(handle, CURLOPT_WRITEDATA, this);
curl_easy_setopt(handle, CURLOPT_NOPROGRESS, 0);
curl_easy_setopt(handle, CURLOPT_PROGRESSFUNCTION, curlProgressCb);
curl_easy_setopt(handle, CURLOPT_PROGRESSDATA, this);
}
CURLHandle::~CURLHandle() {
curl_easy_cleanup(handle);
handle = nullptr;
}
std::future<CURLcode> CURLHandle::perform() {
result.clear(); // Should we require the client to explicitly request this?
std::shared_ptr<std::promise<CURLcode>> prom = std::make_shared<std::promise<CURLcode>>();
pool.load()->submitTask([=]() {
auto err = curl_easy_perform(handle); // This is typically an expensive call so we async it
if (err != CURLE_OK) {
STMS_ERROR("Failed to perform curl operation on url {}", url); // We can't throw an exception so :[
}
prom->set_value(err);
});
return prom->get_future();
}
CURLHandle &CURLHandle::operator=(CURLHandle &&rhs) noexcept {
if (&rhs == this || rhs.handle.load() == handle.load()) {
return *this;
}
std::lock_guard<std::mutex> rlg(rhs.resultMtx);
std::lock_guard<std::mutex> tlg(resultMtx);
result = std::move(rhs.result);
downloadSoFar = rhs.downloadTotal;
downloadTotal = rhs.downloadTotal;
uploadSoFar = rhs.uploadSoFar;
uploadTotal = rhs.uploadTotal;
pool = rhs.pool.load();
handle = rhs.handle.load();
url = std::move(rhs.url);
return *this;
}
CURLHandle::CURLHandle(CURLHandle &&rhs) noexcept : handle(nullptr) {
*this = std::move(rhs);
}
}
| 31.354167
| 146
| 0.619934
|
RotartsiORG
|
76fbe39e413419e717be088742184ad004bd0256
| 1,937
|
cpp
|
C++
|
Engine/src/renderer/material/TexturePNG.cpp
|
Owlinated/SkyHockey
|
787a7fa6c4cd1773c5a5c7e15e014f675947a21e
|
[
"MIT"
] | null | null | null |
Engine/src/renderer/material/TexturePNG.cpp
|
Owlinated/SkyHockey
|
787a7fa6c4cd1773c5a5c7e15e014f675947a21e
|
[
"MIT"
] | null | null | null |
Engine/src/renderer/material/TexturePNG.cpp
|
Owlinated/SkyHockey
|
787a7fa6c4cd1773c5a5c7e15e014f675947a21e
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include <vector>
#include <png.h>
#include <src/support/Logger.h>
#include "TexturePNG.h"
/**
* Load texture from .png file
* @param image_path File of .png file.
* @param mipmap Whether to load/generate mipmaps.
*/
TexturePNG::TexturePNG(const std::string& image_path, bool mipmap) {
const auto fp = fopen(("res/" + image_path).c_str(), "rb");
const auto png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
const auto info = png_create_info_struct(png);
png_init_io(png, fp);
png_read_info(png, info);
// Add alpha channel if png is RGB
if (png_get_color_type(png, info) == PNG_COLOR_TYPE_RGB) {
png_set_add_alpha(png, 0xff, PNG_FILLER_AFTER);
png_read_update_info(png, info);
}
const auto width = png_get_image_width(png, info);
const auto height = png_get_image_height(png, info);
std::vector<unsigned char> data;
data.resize(png_get_rowbytes(png, info) * height);
const auto row_pointers = new png_bytep[height];
for (auto y = 0; y < height; y++)
{
row_pointers[height - 1 - y] = data.data() + y * png_get_rowbytes(png, info);
}
png_read_image(png, row_pointers);
delete[] row_pointers;
glGenTextures(1, &handle);
glBindTexture(GL_TEXTURE_2D, handle);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data.data());
if(mipmap) {
glGenerateMipmap(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
} else {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
this->width = static_cast<int>(width);
this->height = static_cast<int>(height);
}
| 33.396552
| 102
| 0.710893
|
Owlinated
|
0a00f41bfb75f9575dd010edec32c552fcb78c42
| 4,845
|
cc
|
C++
|
packages/solid/Cylinder_3D.cc
|
brbass/ibex
|
5a4cc5b4d6d46430d9667970f8a34f37177953d4
|
[
"MIT"
] | 2
|
2020-04-13T20:06:41.000Z
|
2021-02-12T17:55:54.000Z
|
packages/solid/Cylinder_3D.cc
|
brbass/ibex
|
5a4cc5b4d6d46430d9667970f8a34f37177953d4
|
[
"MIT"
] | 1
|
2018-10-22T21:03:35.000Z
|
2018-10-22T21:03:35.000Z
|
packages/solid/Cylinder_3D.cc
|
brbass/ibex
|
5a4cc5b4d6d46430d9667970f8a34f37177953d4
|
[
"MIT"
] | 3
|
2019-04-03T02:15:37.000Z
|
2022-01-04T05:50:23.000Z
|
#include "Cylinder_3D.hh"
#include "Vector_Functions_3D.hh"
#include <cmath>
using namespace std;
namespace vf3 = Vector_Functions_3D;
Cylinder_3D::
Cylinder_3D(int index,
Surface_Type surface_type,
double radius,
vector<double> const &origin,
vector<double> const &direction):
Cylinder(index,
3, // dimension
surface_type),
radius_(radius),
origin_(origin),
direction_(direction)
{
}
Cylinder_3D::Relation Cylinder_3D::
relation(vector<double> const &particle_position,
bool check_equality) const
{
// Cross product approach
// vector<double> const k0 = vf3::cross(direction_,
// vf3::subtract(particle_position,
// origin_));
// double const r = vf3::magnitude(k0);
// Dot product approach
vector<double> const k0 = vf3::subtract(particle_position,
origin_);
vector<double> const n = vf3::subtract(k0,
vf3::multiply(direction_,
vf3::dot(direction_,
k0)));
double const r = vf3::magnitude(n);
double const dr = r - radius_;
if (check_equality)
{
if (std::abs(dr) <= relation_tolerance_)
{
return Relation::EQUAL;
}
}
if (dr > 0)
{
return Relation::OUTSIDE;
}
else // if (dr > 0)
{
return Relation::INSIDE;
}
}
Cylinder_3D::Intersection Cylinder_3D::
intersection(vector<double> const &particle_position,
vector<double> const &particle_direction) const
{
Intersection intersection;
vector<double> const j0 = vf3::subtract(particle_position,
origin_);
vector<double> const k0 = vf3::subtract(j0,
vf3::multiply(direction_,
vf3::dot(direction_,
j0)));
vector<double> const k1 = vf3::subtract(particle_direction,
vf3::multiply(direction_,
vf3::dot(direction_,
particle_direction)));
double const l0 = vf3::magnitude_squared(k0) - radius_ * radius_;
double const l1 = vf3::dot(k0,
k1);
double const l2 = vf3::magnitude_squared(k1);
double const l3 = l1 * l1 - l0 * l2;
if (l3 < 0)
{
intersection.type = Intersection::Type::NONE;
return intersection;
}
else if (l2 <= intersection_tolerance_)
{
intersection.type = Intersection::Type::PARALLEL;
return intersection;
}
double const l4 = sqrt(l3);
double const s1 = (-l1 + l4) / l2;
double const s2 = (-l1 - l4) / l2;
if (s2 > 0)
{
intersection.distance = s2;
}
else if (s1 > 0)
{
intersection.distance = s1;
}
else
{
intersection.type = Intersection::Type::NEGATIVE;
return intersection;
}
intersection.position = vf3::add(particle_position,
vf3::multiply(particle_direction,
intersection.distance));
if (l3 <= intersection_tolerance_)
{
intersection.type = Intersection::Type::TANGEANT;
return intersection;
}
else
{
intersection.type = Intersection::Type::INTERSECTS;
return intersection;
}
}
Cylinder_3D::Normal Cylinder_3D::
normal_direction(vector<double> const &position,
bool check_normal) const
{
Normal normal;
vector<double> const k0 = vf3::subtract(position,
origin_);
vector<double> const n = vf3::subtract(k0,
vf3::multiply(direction_,
vf3::dot(direction_,
k0)));
if (check_normal)
{
if (std::abs(vf3::magnitude_squared(n) - radius_ * radius_) > normal_tolerance_ * radius_ * radius_)
{
normal.exists = false;
return normal;
}
}
normal.exists = true;
normal.direction = vf3::normalize(n);
return normal;
}
void Cylinder_3D::
check_class_invariants() const
{
Assert(origin_.size() == dimension_);
Assert(direction_.size() == dimension_);
}
| 29.011976
| 108
| 0.490815
|
brbass
|
0a028dcc0da795f0e336636cc08e39356c210a3f
| 7,281
|
cpp
|
C++
|
src/core/Hub.cpp
|
gabrielklein/SensorNode
|
e92dbd56aa0a7d75ab95b9c484f27ba6d0be64df
|
[
"MIT"
] | 2
|
2018-01-21T11:43:36.000Z
|
2019-07-15T20:08:31.000Z
|
src/core/Hub.cpp
|
gabrielklein/SensorNode
|
e92dbd56aa0a7d75ab95b9c484f27ba6d0be64df
|
[
"MIT"
] | null | null | null |
src/core/Hub.cpp
|
gabrielklein/SensorNode
|
e92dbd56aa0a7d75ab95b9c484f27ba6d0be64df
|
[
"MIT"
] | null | null | null |
#include "Hub.h"
#include "../Settings.h"
Hub::Hub() {
};
Hub::~Hub() {
delete(this->webServerSN);
delete(this->apStaClient);
delete(this->led);
delete(this->temp);
delete(this->relay);
delete(this->switc);
delete(this->geiger);
delete(this->mqtt);
delete(this->otaUpdate);
};
/**
* Called at setup time. Use this call to initialize some data.
*/
void Hub::setup() {
// Use serial
Serial.begin ( 115200 );
Serial.println ("\nStarting Hub");
this->fileServ.setup();
#ifdef WEB_SERVER_SN_ENABLE
this->webServerSN = new WebServerSN(&this->fileServ);
this->webServerSN->addServ(this->webServerSN);
this->webServerSN->setup();
#endif
#ifdef WS281X_STRIP_ENABLE
this->led = new Led(&this->fileServ);
this->led->setup();
this->led->rgb(0, 0, 0, 50);
if (this->webServerSN != NULL)
this->webServerSN->addServ(this->led);
#endif
#ifdef AP_SERVER_CLIENT_ENABLE
this->apStaClient = new APStaClient(&this->fileServ, this->led);
isClientMode = this->apStaClient->setup();
if (this->webServerSN != NULL) {
this->webServerSN->addServ(this->apStaClient);
if (!isClientMode) {
this->webServerSN->apModeOnly();
}
}
#endif
#ifdef OTA_ENABLE
this->otaUpdate = new OTAUpdate();
this->otaUpdate->setup();
#endif
if (isClientMode) {
#ifdef TIME_ENABLE
this->iTime = new ITime(&this->fileServ);
this->iTime->setup();
if (this->webServerSN != NULL)
this->webServerSN->addServ(this->iTime);
#endif
#ifdef MQTT_ENABLE
this->mqtt = new MQTT(&this->fileServ);
this->mqtt->setup();
if (this->webServerSN != NULL)
this->webServerSN->addServ(this->mqtt);
#endif
#ifdef TEMP_ENABLE
this->temp = new Temp();
this->temp->setup();
if (this->webServerSN != NULL)
this->webServerSN->addServ(this->temp);
if (this->mqtt != NULL)
this->mqtt->addServ(this->temp);
#endif
#ifdef RELAY_ENABLE
this->relay = new Relay();
this->relay->setup();
if (this->webServerSN != NULL)
this->webServerSN->addServ(this->relay);
if (this->mqtt != NULL)
this->mqtt->addServ(this->relay);
#endif
#ifdef SWITCH_ENABLE
this->switc = new Switch();
this->switc->setup();
if (this->webServerSN != NULL)
this->webServerSN->addServ(this->switc);
if (this->mqtt != NULL)
this->mqtt->addServ(this->switc);
#endif
#ifdef GEIGER_ENABLE
this->geiger = new Geiger(&this->fileServ);
this->geiger->setup();
if (this->webServerSN != NULL)
this->webServerSN->addServ(this->geiger);
if (this->mqtt != NULL)
this->mqtt->addServ(this->geiger);
#endif
}
};
/**
* Loop
*/
void Hub::loop() {
if (this->webServerSN!=NULL) {
unsigned long now = millis();
this->webServerSN->loop();
unsigned long duration = millis() - now;
if (duration > 100) {
Serial.print("Loop for WebServerSN is a bit long: ");
Serial.println(duration);
}
}
if (this->otaUpdate!=NULL) {
unsigned long now = millis();
this->otaUpdate->loop();
unsigned long duration = millis() - now;
if (duration > 100) {
Serial.print("Loop for otaUpdate is a bit long: ");
Serial.println(duration);
}
}
if (!isClientMode) {
return;
}
if (this->iTime!=NULL) {
unsigned long now = millis();
this->iTime->loop();
unsigned long duration = millis() - now;
if (duration > 100) {
Serial.print("Loop for iTime is a bit long: ");
Serial.println(duration);
}
}
if (this->led!=NULL) {
unsigned long now = millis();
this->led->loop();
unsigned long duration = millis() - now;
if (duration > 100) {
Serial.print("Loop for led is a bit long: ");
Serial.println(duration);
}
}
if (this->temp!=NULL) {
unsigned long now = millis();
this->temp->loop();
unsigned long duration = millis() - now;
if (duration > 100) {
Serial.print("Loop for temp is a bit long: ");
Serial.println(duration);
}
}
if (this->apStaClient!=NULL) {
unsigned long now = millis();
this->apStaClient->loop();
unsigned long duration = millis() - now;
if (duration > 100) {
Serial.print("Loop for apStaClient is a bit long: ");
Serial.println(duration);
}
}
if (this->relay!=NULL) {
unsigned long now = millis();
this->relay->loop();
unsigned long duration = millis() - now;
if (duration > 100) {
Serial.print("Loop for relay is a bit long: ");
Serial.println(duration);
}
}
if (this->switc!=NULL) {
unsigned long now = millis();
this->switc->loop();
unsigned long duration = millis() - now;
if (duration > 100) {
Serial.print("Loop for switc is a bit long: ");
Serial.println(duration);
}
}
if (this->geiger!=NULL) {
unsigned long now = millis();
this->geiger->loop();
unsigned long duration = millis() - now;
if (duration > 100) {
Serial.print("Loop for geiger is a bit long: ");
Serial.println(duration);
}
}
if (this->mqtt!=NULL) {
unsigned long now = millis();
this->mqtt->loop();
unsigned long duration = millis() - now;
if (duration > 100) {
Serial.print("Loop for mqtt is a bit long: ");
Serial.println(duration);
}
}
}
| 30.721519
| 77
| 0.439363
|
gabrielklein
|
0a0cf82fe63806cf84c2abc335fc5cb6eda5b4c6
| 563
|
cpp
|
C++
|
Section10/LetterPyramid/main.cpp
|
Yash-Singh1/cpp-programming
|
696c1dcff18af8e798fae6126a3b13f6259af4b7
|
[
"MIT"
] | null | null | null |
Section10/LetterPyramid/main.cpp
|
Yash-Singh1/cpp-programming
|
696c1dcff18af8e798fae6126a3b13f6259af4b7
|
[
"MIT"
] | null | null | null |
Section10/LetterPyramid/main.cpp
|
Yash-Singh1/cpp-programming
|
696c1dcff18af8e798fae6126a3b13f6259af4b7
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include <string>
using namespace std;
int main()
{
cout << "Welcome to the Letter Pyramid Generator!" << endl;
string input;
cout << "Enter the input text: ";
getline(cin, input);
size_t padding{input.length() - 1};
for (size_t i{1}; i <= input.length(); ++i)
{
cout << string(padding, ' ') << input.substr(0, i);
if (i != 1)
{
for (size_t ri{i - 2}; ri > 0; --ri)
{
cout << input[ri];
}
cout << input[0];
}
cout << endl;
--padding;
}
cout << endl;
return 0;
}
| 17.060606
| 61
| 0.520426
|
Yash-Singh1
|
0a0f0a5347be9d4d7b08b04467c4ed9c6c63ce96
| 14,129
|
cpp
|
C++
|
include/h3api/H3Dialogs/H3BaseDialog.cpp
|
Patrulek/H3API
|
91f10de37c6b86f3160706c1fdf4792f927e9952
|
[
"MIT"
] | 14
|
2020-09-07T21:49:26.000Z
|
2021-11-29T18:09:41.000Z
|
include/h3api/H3Dialogs/H3BaseDialog.cpp
|
Day-of-Reckoning/H3API
|
a82d3069ec7d5127b13528608d5350d2b80d57be
|
[
"MIT"
] | 2
|
2021-02-12T15:52:31.000Z
|
2021-02-12T16:21:24.000Z
|
include/h3api/H3Dialogs/H3BaseDialog.cpp
|
Day-of-Reckoning/H3API
|
a82d3069ec7d5127b13528608d5350d2b80d57be
|
[
"MIT"
] | 8
|
2021-02-12T15:52:41.000Z
|
2022-01-31T15:28:10.000Z
|
//////////////////////////////////////////////////////////////////////
// //
// Created by RoseKavalier: //
// rosekavalierhc@gmail.com //
// Created or last updated on: 2021-01-25 //
// ***You may use or distribute these files freely //
// so long as this notice remains present.*** //
// //
//////////////////////////////////////////////////////////////////////
#include "h3api/H3Dialogs/H3BaseDialog.hpp"
#include "h3api/H3DialogControls.hpp"
#include "h3api/H3Dialogs/H3Message.hpp"
#include "h3api/H3Assets/H3Resource.hpp"
#include "h3api/H3Managers/H3WindowManager.hpp"
#include "h3api/H3Assets/H3LoadedDef.hpp"
#include "h3api/H3Assets/H3LoadedPcx.hpp"
namespace h3
{
_H3API_ H3BaseDlg::H3BaseDlg(INT x, INT y, INT w, INT h) :
zOrder(-1), nextDialog(), lastDialog(), flags(0x12), state(),
xDlg(x), yDlg(y), widthDlg(w), heightDlg(h), lastItem(), firstItem(),
focusedItemId(-1), pcx16(), deactivatesCount()
{
}
_H3API_ VOID H3BaseDlg::Redraw(INT32 x, INT32 y, INT32 dx, INT32 dy)
{
H3WindowManager::Get()->H3Redraw(xDlg + x, yDlg + y, dx, dy);
}
_H3API_ VOID H3BaseDlg::Redraw()
{
vRedraw(TRUE, -65535, 65535);
}
_H3API_ INT32 H3BaseDlg::DefaultProc(H3Msg* msg)
{
return DefaultProc(*msg);
}
_H3API_ INT32 H3BaseDlg::DefaultProc(H3Msg& msg)
{
return THISCALL_2(INT32, 0x41B120, this, &msg);
}
_H3API_ H3DlgItem* H3BaseDlg::getDlgItem(UINT16 id, h3func vtable) const
{
H3DlgItem* it = firstItem;
if (it == nullptr)
return it;
do
{
if ((it->GetID() == id) && (*reinterpret_cast<h3func*>(it) == vtable))
break;
} while (it = it->GetNextItem());
return it;
}
_H3API_ INT32 H3BaseDlg::GetWidth() const
{
return widthDlg;
}
_H3API_ INT32 H3BaseDlg::GetHeight() const
{
return heightDlg;
}
_H3API_ INT32 H3BaseDlg::GetX() const
{
return xDlg;
}
_H3API_ INT32 H3BaseDlg::GetY() const
{
return yDlg;
}
_H3API_ BOOL H3BaseDlg::IsTopDialog() const
{
return nextDialog == nullptr;
}
_H3API_ VOID H3BaseDlg::AddControlState(INT32 id, eControlState state)
{
THISCALL_3(VOID, 0x5FF490, this, id, state);
}
_H3API_ VOID H3BaseDlg::RemoveControlState(INT32 id, eControlState state)
{
THISCALL_3(VOID, 0x5FF520, this, id, state);
}
_H3API_ H3DlgItem* H3BaseDlg::AddItem(H3DlgItem* item, BOOL initiate /*= TRUE*/)
{
dlgItems += item;
if (initiate)
return THISCALL_3(H3DlgItem*, 0x5FF270, this, item, -1); // LoadItem
else
return item;
}
_H3API_ H3DlgDef* H3BaseDlg::GetDef(UINT16 id) const
{
return get<H3DlgDef>(id);
}
_H3API_ H3DlgPcx* H3BaseDlg::GetPcx(UINT16 id) const
{
return get<H3DlgPcx>(id);
}
_H3API_ H3DlgEdit* H3BaseDlg::GetEdit(UINT16 id) const
{
return get<H3DlgEdit>(id);
}
_H3API_ H3DlgText* H3BaseDlg::GetText(UINT16 id) const
{
return get<H3DlgText>(id);
}
_H3API_ H3DlgFrame* H3BaseDlg::GetFrame(UINT16 id) const
{
return get<H3DlgFrame>(id);
}
_H3API_ H3DlgPcx16* H3BaseDlg::GetPcx16(UINT16 id) const
{
return get<H3DlgPcx16>(id);
}
_H3API_ H3DlgTextPcx* H3BaseDlg::GetTextPcx(UINT16 id) const
{
return get<H3DlgTextPcx>(id);
}
_H3API_ H3DlgDefButton* H3BaseDlg::GetDefButton(UINT16 id) const
{
return get<H3DlgDefButton>(id);
}
_H3API_ H3DlgScrollbar* H3BaseDlg::GetScrollbar(UINT16 id) const
{
return get<H3DlgScrollbar>(id);
}
_H3API_ H3DlgTransparentItem* H3BaseDlg::GetTransparent(UINT16 id) const
{
return get<H3DlgTransparentItem>(id);
}
_H3API_ H3DlgCustomButton* H3BaseDlg::GetCustomButton(UINT16 id) const
{
return get<H3DlgCustomButton>(id);
}
_H3API_ H3DlgCaptionButton* H3BaseDlg::GetCaptionButton(UINT16 id) const
{
return get<H3DlgCaptionButton>(id);
}
_H3API_ H3DlgScrollableText* H3BaseDlg::GetScrollableText(UINT16 id) const
{
return get<H3DlgScrollableText>(id);
}
_H3API_ H3DlgTransparentItem* H3BaseDlg::CreateHidden(INT32 x, INT32 y, INT32 width, INT32 height, INT32 id)
{
H3DlgTransparentItem* it = H3DlgTransparentItem::Create(x, y, width, height, id);
if (it)
AddItem(it);
return it;
}
_H3API_ H3LoadedPcx16* H3BaseDlg::GetCurrentPcx()
{
return pcx16;
}
_H3API_ H3DlgItem* H3BaseDlg::ItemAtPosition(H3Msg* msg)
{
return ItemAtPosition(*msg);
}
_H3API_ H3DlgItem* H3BaseDlg::ItemAtPosition(H3Msg& msg)
{
return THISCALL_3(H3DlgItem*, 0x5FF9A0, this, msg.GetX(), msg.GetY());
}
_H3API_ H3Vector<H3DlgItem*>& H3BaseDlg::GetList()
{
return dlgItems;
}
_H3API_ H3DlgItem* H3BaseDlg::GetH3DlgItem(UINT16 id)
{
return THISCALL_2(H3DlgItem*, 0x5FF5B0, this, id);
}
_H3API_ VOID H3BaseDlg::RedrawItem(UINT16 itemID)
{
if (H3DlgItem* it = GetH3DlgItem(itemID))
it->Refresh();
}
_H3API_ VOID H3BaseDlg::EnableItem(UINT16 id, BOOL enable)
{
H3DlgItem* it = GetH3DlgItem(id);
if (it)
it->EnableItem(enable);
}
_H3API_ VOID H3BaseDlg::SendCommandToItem(INT32 command, UINT16 itemID, UINT32 parameter)
{
THISCALL_5(VOID, 0x5FF400, this, 0x200, command, itemID, parameter);
}
_H3API_ VOID H3BaseDlg::SendCommandToAllItems(INT32 command, INT32 itemID, INT32 parameter)
{
H3Msg msg;
msg.SetCommand(eMsgCommand::ITEM_COMMAND, eMsgSubtype(command), itemID, eMsgFlag::NONE, 0, 0, parameter, 0);
THISCALL_2(VOID, 0x5FF3A0, this, &msg);
}
_H3API_ VOID H3BaseDlg::AdjustToPlayerColor(INT8 player, UINT16 itemId)
{
if (H3DlgItem* it = GetH3DlgItem(itemId))
it->ColorToPlayer(player);
}
_H3API_ H3DlgFrame* H3BaseDlg::CreateFrame(INT32 x, INT32 y, INT32 width, INT32 height, INT32 id, RGB565 color)
{
H3DlgFrame* frame = H3DlgFrame::Create(x, y, width, height, id, color);
if (frame)
AddItem(frame);
return frame;
}
_H3API_ H3DlgFrame* H3BaseDlg::CreateFrame(INT32 x, INT32 y, INT32 width, INT32 height, RGB565 color)
{
H3DlgFrame* frame = H3DlgFrame::Create(x, y, width, height, 0, color);
if (frame)
AddItem(frame);
return frame;
}
_H3API_ H3DlgFrame* H3BaseDlg::CreateFrame(H3DlgItem* target, RGB565 color, INT id, BOOL around_edge)
{
H3DlgFrame* frame = H3DlgFrame::Create(target, color, id, around_edge);
if (frame)
AddItem(frame);
return frame;
}
_H3API_ H3DlgDef* H3BaseDlg::CreateDef(INT32 x, INT32 y, INT32 width, INT32 height, INT32 id, LPCSTR defName, INT32 frame, INT32 group, INT32 mirror, BOOL closeDialog)
{
H3DlgDef* def = H3DlgDef::Create(x, y, width, height, id, defName, frame, group, mirror, closeDialog);
if (def)
AddItem(def);
return def;
}
_H3API_ H3DlgDef* H3BaseDlg::CreateDef(INT32 x, INT32 y, INT32 id, LPCSTR defName, INT32 frame, INT32 group, INT32 mirror, BOOL closeDialog)
{
H3DlgDef* def = H3DlgDef::Create(x, y, id, defName, frame, group, mirror, closeDialog);
if (def)
AddItem(def);
return def;
}
_H3API_ H3DlgDefButton* H3BaseDlg::CreateButton(INT32 x, INT32 y, INT32 width, INT32 height, INT32 id, LPCSTR defName, INT32 frame, INT32 clickFrame, BOOL closeDialog, INT32 hotkey)
{
H3DlgDefButton* but = H3DlgDefButton::Create(x, y, width, height, id, defName, frame, clickFrame, closeDialog, hotkey);
if (but)
AddItem(but);
return but;
}
_H3API_ H3DlgDefButton* H3BaseDlg::CreateButton(INT32 x, INT32 y, INT32 id, LPCSTR defName, INT32 frame, INT32 clickFrame, BOOL closeDialog, INT32 hotkey)
{
H3DlgDefButton* but = CreateButton(x, y, 0, 0, id, defName, frame, clickFrame, closeDialog, hotkey);
if (but)
{
H3LoadedDef* def = but->GetDef();
if (def)
{
but->SetWidth(def->widthDEF);
but->SetHeight(def->heightDEF);
}
}
return but;
}
_H3API_ H3DlgDefButton* H3BaseDlg::CreateOKButton(INT32 x, INT32 y)
{
H3DlgDefButton* button = H3DlgDefButton::Create(x, y, int(eControlId::OK), NH3Dlg::Assets::OKAY_DEF, 0, 1, TRUE, NH3VKey::H3VK_ENTER);
if (button)
{
AddItem(H3DlgPcx::Create(x - 1, y - 1, NH3Dlg::Assets::BOX_64_30_PCX));
AddItem(button);
}
return button;
}
_H3API_ H3DlgDefButton* H3BaseDlg::CreateSaveButton(INT32 x, INT32 y, LPCSTR button_name)
{
H3DlgDefButton* button = H3DlgDefButton::Create(x, y, int(eControlId::SAVE), button_name, 0, 1, FALSE, NH3VKey::H3VK_S);
if (button)
{
AddItem(H3DlgFrame::Create(button, H3RGB565::Highlight(), 0, TRUE));
//AddItem(H3DlgPcx::Create(x - 1, y - 1, NH3Dlg::Assets::BOX_64_32_PCX));
AddItem(button);
}
return button;
}
_H3API_ H3DlgDefButton* H3BaseDlg::CreateOnOffCheckbox(INT32 x, INT32 y, INT32 id, INT32 frame, INT32 clickFrame)
{
if (clickFrame == -1)
clickFrame = 1 - frame;
H3DlgDefButton* button = H3DlgDefButton::Create(x, y, id, NH3Dlg::Assets::ON_OFF_CHECKBOX, frame, clickFrame, 0, 0);
if (button)
AddItem(button);
return button;
}
_H3API_ H3DlgDefButton* H3BaseDlg::CreateOKButton()
{
H3DlgDefButton* button = H3DlgDefButton::Create(25, heightDlg - 50, int(eControlId::OK), NH3Dlg::Assets::OKAY_DEF, 0, 1, TRUE, NH3VKey::H3VK_ENTER);
if (button)
{
AddItem(H3DlgPcx::Create(25 - 1, heightDlg - 50 - 1, NH3Dlg::Assets::BOX_64_30_PCX));
AddItem(button);
}
return button;
}
_H3API_ H3DlgDefButton* H3BaseDlg::CreateOK32Button(INT32 x, INT32 y)
{
H3DlgDefButton* button = H3DlgDefButton::Create(x, y, int(eControlId::OK), NH3Dlg::Assets::OKAY32_DEF, 0, 1, TRUE, NH3VKey::H3VK_ENTER);
if (button)
{
AddItem(H3DlgPcx::Create(x - 1, y - 1, NH3Dlg::Assets::BOX_66_32_PCX));
AddItem(button);
}
return button;
}
_H3API_ H3DlgDefButton* H3BaseDlg::CreateCancelButton()
{
return CreateCancelButton(widthDlg - 25 - 64, heightDlg - 50);
}
_H3API_ H3DlgDefButton* H3BaseDlg::CreateCancelButton(INT32 x, INT32 y)
{
H3DlgDefButton* button = H3DlgDefButton::Create(x, y, eControlId::CANCEL, NH3Dlg::Assets::CANCEL_DEF, 0, 1, TRUE, NH3VKey::H3VK_ESCAPE);
if (button)
{
AddItem(H3DlgPcx::Create(x - 1, y - 1, NH3Dlg::Assets::BOX_64_30_PCX));
AddItem(button);
}
return button;
}
_H3API_ H3DlgCaptionButton* H3BaseDlg::CreateCaptionButton(INT32 x, INT32 y, INT32 width, INT32 height, INT32 id, LPCSTR defName, LPCSTR text, LPCSTR font, INT32 frame, INT32 group, BOOL closeDialog, INT32 hotkey, INT32 color)
{
H3DlgCaptionButton* but = H3DlgCaptionButton::Create(x, y, width, height, id, defName, text, font, frame, group, closeDialog, hotkey, color);
if (but)
AddItem(but);
return but;
}
_H3API_ H3DlgCustomButton* H3BaseDlg::CreateCustomButton(INT32 x, INT32 y, INT32 width, INT32 height, INT32 id, LPCSTR defName, H3DlgButton_proc customProc, INT32 frame, INT32 clickFrame)
{
H3DlgCustomButton* but = H3DlgCustomButton::Create(x, y, width, height, id, defName, customProc, frame, clickFrame);
if (but)
AddItem(but);
return but;
}
_H3API_ H3DlgCustomButton* H3BaseDlg::CreateCustomButton(INT32 x, INT32 y, INT32 id, LPCSTR defName, H3DlgButton_proc customProc, INT32 frame, INT32 clickFrame)
{
H3DlgCustomButton* but = H3DlgCustomButton::Create(x, y, id, defName, customProc, frame, clickFrame);
if (but)
AddItem(but);
return but;
}
_H3API_ H3DlgCustomButton* H3BaseDlg::CreateCustomButton(INT32 x, INT32 y, LPCSTR defName, H3DlgButton_proc customProc, INT32 frame, INT32 clickFrame)
{
return CreateCustomButton(x, y, 0, defName, customProc, frame, clickFrame);
}
_H3API_ H3DlgPcx* H3BaseDlg::CreatePcx(INT32 x, INT32 y, INT32 width, INT32 height, INT32 id, LPCSTR pcxName)
{
H3DlgPcx* pcx = H3DlgPcx::Create(x, y, width, height, id, pcxName);
if (pcx)
AddItem(pcx);
return pcx;
}
_H3API_ H3DlgPcx* H3BaseDlg::CreatePcx(INT32 x, INT32 y, INT32 id, LPCSTR pcxName)
{
H3DlgPcx* pcx = CreatePcx(x, y, 0, 0, id, pcxName);
if (pcx && pcx->GetPcx())
{
H3LoadedPcx* p = pcx->GetPcx();
pcx->SetWidth(p->width);
pcx->SetHeight(p->height);
}
return pcx;
}
_H3API_ H3DlgPcx* H3BaseDlg::CreateLineSeparator(INT32 x, INT32 y, INT32 width)
{
return CreatePcx(x, y, width, 2, 0, NH3Dlg::HDassets::LINE_SEPARATOR);
}
_H3API_ H3DlgPcx16* H3BaseDlg::CreatePcx16(INT32 x, INT32 y, INT32 width, INT32 height, INT32 id, LPCSTR pcxName)
{
H3DlgPcx16* pcx = H3DlgPcx16::Create(x, y, width, height, id, pcxName);
if (pcx)
AddItem(pcx);
return pcx;
}
_H3API_ H3DlgEdit* H3BaseDlg::CreateEdit(INT32 x, INT32 y, INT32 width, INT32 height, INT32 maxLength, LPCSTR text, LPCSTR fontName, INT32 color, INT32 align, LPCSTR pcxName, INT32 id, INT32 hasBorder, INT32 borderX, INT32 borderY)
{
H3DlgEdit* ed = H3DlgEdit::Create(x, y, width, height, maxLength, text, fontName, color, align, pcxName, id, hasBorder, borderX, borderY);
if (ed)
AddItem(ed);
return ed;
}
_H3API_ H3DlgText* H3BaseDlg::CreateText(INT32 x, INT32 y, INT32 width, INT32 height, LPCSTR text, LPCSTR fontName, INT32 color, INT32 id, eTextAlignment align, INT32 bkColor)
{
H3DlgText* tx = H3DlgText::Create(x, y, width, height, text, fontName, color, id, align, bkColor);
if (tx)
AddItem(tx);
return tx;
}
_H3API_ H3DlgTextPcx* H3BaseDlg::CreateTextPcx(INT32 x, INT32 y, INT32 width, INT32 height, LPCSTR text, LPCSTR fontName, LPCSTR pcxName, INT32 color, INT32 id, INT32 align)
{
H3DlgTextPcx* tx = H3DlgTextPcx::Create(x, y, width, height, text, fontName, pcxName, color, id, align);
if (tx)
AddItem(tx);
return tx;
}
_H3API_ H3DlgScrollableText* H3BaseDlg::CreateScrollableText(LPCSTR text, INT32 x, INT32 y, INT32 width, INT32 height, LPCSTR font, INT32 color, INT32 isBlue)
{
H3DlgScrollableText* sc = H3DlgScrollableText::Create(text, x, y, width, height, font, color, isBlue);
if (sc)
AddItem(sc);
return sc;
}
_H3API_ H3DlgScrollbar* H3BaseDlg::CreateScrollbar(INT32 x, INT32 y, INT32 width, INT32 height, INT32 id, INT32 ticksCount, H3DlgScrollbar_proc scrollbarProc, BOOL isBlue, INT32 stepSize, BOOL arrowsEnabled)
{
H3DlgScrollbar* sc = H3DlgScrollbar::Create(x, y, width, height, id, ticksCount, scrollbarProc, isBlue, stepSize, arrowsEnabled);
if (sc)
AddItem(sc);
return sc;
}
_H3API_ H3ExtendedDlg::H3ExtendedDlg(INT x, INT y, INT w, INT h) :
H3BaseDlg(x, y, w, h)
{
}
} /* namespace h3 */
| 34.293689
| 232
| 0.69375
|
Patrulek
|
0a0f1f29e718edf02fe77504a3c521cca069adde
| 5,283
|
cpp
|
C++
|
mgmtd/source/net/message/nodes/storagepools/ModifyStoragePoolMsgEx.cpp
|
TomatoYoung/beegfs
|
edf287940175ecded493183209719d2d90d45374
|
[
"BSD-3-Clause"
] | null | null | null |
mgmtd/source/net/message/nodes/storagepools/ModifyStoragePoolMsgEx.cpp
|
TomatoYoung/beegfs
|
edf287940175ecded493183209719d2d90d45374
|
[
"BSD-3-Clause"
] | null | null | null |
mgmtd/source/net/message/nodes/storagepools/ModifyStoragePoolMsgEx.cpp
|
TomatoYoung/beegfs
|
edf287940175ecded493183209719d2d90d45374
|
[
"BSD-3-Clause"
] | null | null | null |
#include "ModifyStoragePoolMsgEx.h"
#include <common/app/log/LogContext.h>
#include <common/net/message/nodes/storagepools/ModifyStoragePoolRespMsg.h>
#include <common/net/message/control/GenericResponseMsg.h>
#include <nodes/StoragePoolStoreEx.h>
#include <program/Program.h>
bool ModifyStoragePoolMsgEx::processIncoming(ResponseContext& ctx)
{
if (Program::getApp()->isShuttingDown())
{
ctx.sendResponse(GenericResponseMsg(GenericRespMsgCode_TRYAGAIN, "Mgmtd shutting down."));
return true;
}
StoragePoolStoreEx* storagePoolStore = Program::getApp()->getStoragePoolStore();
if (Program::getApp()->isShuttingDown())
{
ctx.sendResponse(GenericResponseMsg(GenericRespMsgCode_TRYAGAIN, "Mgmtd shutting down."));
return true;
}
FhgfsOpsErr result = FhgfsOpsErr_SUCCESS;
bool changesMade = false;
// check if pool exists
bool poolExists = storagePoolStore->poolExists(poolId);
if (!poolExists)
{
LOG(STORAGEPOOLS, WARNING, "Storage pool ID doesn't exist", poolId);
result = FhgfsOpsErr_INVAL;
goto send_response;
}
bool setDescriptionResp;
if (newDescription && !newDescription->empty()) // changeName
{
setDescriptionResp = storagePoolStore->setPoolDescription(poolId, *newDescription);
if (setDescriptionResp == FhgfsOpsErr_SUCCESS)
{
changesMade = true;
}
else
{
LOG(STORAGEPOOLS, WARNING, "Could not set new description for storage pool");
result = FhgfsOpsErr_INTERNAL;
}
}
else
{
setDescriptionResp = false; // needed later for notifications to metadata nodes
}
if (addTargets) // add targets to the pool
{ // -> this can only happen if targets are in the default pool
for (auto it = addTargets->begin(); it != addTargets->end(); it++)
{
FhgfsOpsErr moveTargetsResp =
storagePoolStore->moveTarget(StoragePoolStore::DEFAULT_POOL_ID, poolId, *it);
if (moveTargetsResp == FhgfsOpsErr_SUCCESS)
{
changesMade = true;
}
else
{
LOG(STORAGEPOOLS, WARNING,
"Could not add target to storage pool. "
"Probably the target doesn't exist or is not a member of the default storage pool.",
poolId, ("targetId",*it));
result = FhgfsOpsErr_INTERNAL;
// however, we still try to move the remaining targets
}
}
}
if (rmTargets) // remove targets from the pool (i.e. move them to the default pool)
{
for (auto it = rmTargets->begin(); it != rmTargets->end(); it++)
{
FhgfsOpsErr moveTargetsResp =
storagePoolStore->moveTarget(poolId, StoragePoolStore::DEFAULT_POOL_ID, *it);
if (moveTargetsResp == FhgfsOpsErr_SUCCESS)
{
changesMade = true;
}
else
{
LOG(STORAGEPOOLS, WARNING,
"Could not remove target from storage pool. "
"Probably the target doesn't exist or is not a member of the storage pool.",
poolId, ("targetId",*it));
result = FhgfsOpsErr_INTERNAL;
// however, we still try to move the remaining targets
}
}
}
if (addBuddyGroups) // add targets to the pool
{ // -> this can only happen if targets are in the default pool
for (auto it = addBuddyGroups->begin(); it != addBuddyGroups->end(); it++)
{
FhgfsOpsErr moveBuddyGroupsResp =
storagePoolStore->moveBuddyGroup(StoragePoolStore::DEFAULT_POOL_ID, poolId, *it);
if (moveBuddyGroupsResp == FhgfsOpsErr_SUCCESS)
{
changesMade = true;
}
else
{
LOG(STORAGEPOOLS, WARNING,
"Could not add buddy group to storage pool. "
"Probably the buddy group doesn't exist "
"or is not a member of the default storage pool.",
poolId, ("buddyGroupId",*it));
result = FhgfsOpsErr_INTERNAL;
// however, we still try to move the remaining buddy groups
}
}
}
if (rmBuddyGroups) // remove targets from the pool (i.e. move them to the default pool)
{
for (auto it = rmBuddyGroups->begin(); it != rmBuddyGroups->end(); it++)
{
FhgfsOpsErr moveBuddyGroupsResp =
storagePoolStore->moveBuddyGroup(poolId, StoragePoolStore::DEFAULT_POOL_ID, *it);
if (moveBuddyGroupsResp == FhgfsOpsErr_SUCCESS)
{
changesMade = true;
}
else
{
LOG(STORAGEPOOLS, WARNING,
"Could not remove buddy group from storage pool. "
"Probably the buddy group doesn't exist or is not a member of the storage pool.",
poolId, ("buddy group",*it));
result = FhgfsOpsErr_INTERNAL;
// however, we still try to move the remaining buddy groups
}
}
}
if (changesMade)
{ // changes were made
Program::getApp()->getHeartbeatMgr()->notifyAsyncRefreshStoragePools();
}
send_response:
ctx.sendResponse(ModifyStoragePoolRespMsg(result));
return true;
}
| 29.847458
| 99
| 0.607609
|
TomatoYoung
|
0a1013d51b3e1a8ab70f40d2abc05e2d462045d7
| 5,677
|
cpp
|
C++
|
mainwindow.cpp
|
diegofps/picker
|
a8e09c74e2d34a17a61ba6e1be08df135cbce60b
|
[
"Apache-2.0"
] | null | null | null |
mainwindow.cpp
|
diegofps/picker
|
a8e09c74e2d34a17a61ba6e1be08df135cbce60b
|
[
"Apache-2.0"
] | null | null | null |
mainwindow.cpp
|
diegofps/picker
|
a8e09c74e2d34a17a61ba6e1be08df135cbce60b
|
[
"Apache-2.0"
] | null | null | null |
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QToolButton>
#include <QShortcut>
#include <QBitmap>
#include <QStyle>
#include <QFile>
#include <QFileInfo>
#include <QDir>
#include <QSet>
#include <QProcess>
using namespace wup;
MainWindow::MainWindow(Params & params, QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
iconSize = params.getInt("iconSize", 64);
ui->setupUi(this);
configureWindow(params);
configureCloseOnEscape();
configureActions(params);
// auto iconFilepath = "/usr/share/virt-manager/icons/hicolor/48x48/actions/vm_import_wizard.png";
// addButton("Button 1", iconFilepath, "q", 0, 0);
// addButton("Button 2", iconFilepath, "w", 0, 1);
// addButton("Button 3", iconFilepath, "e", 0, 2);
// addButton("Button 4", iconFilepath, "r", 1, 0);
// addButton("Button 5", iconFilepath, "t", 1, 1);
// addButton("Button 6", iconFilepath, "y", 1, 2);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::configureWindow(Params ¶ms)
{
if (params.has("fullscreen"))
{
setWindowFlags(Qt::Widget | Qt::FramelessWindowHint);
setParent(nullptr);
setAttribute(Qt::WA_NoSystemBackground, true);
setAttribute(Qt::WA_TranslucentBackground, true);
// setAttribute(Qt::WA_PaintOnScreen);
QMainWindow::showFullScreen();
if (params.len("fullscreen"))
{
auto color = params.getString("fullscreen");
this->setStyleSheet(QString("background-color: #") + color);
}
}
else
{
setWindowFlags(Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint | Qt::FramelessWindowHint);
setParent(nullptr);
setAttribute(Qt::WA_NoSystemBackground, true);
setAttribute(Qt::WA_TranslucentBackground, true);
}
}
void MainWindow::configureCloseOnEscape()
{
auto s = new QShortcut(QKeySequence("Escape"), this);
connect(s, &QShortcut::activated, [this]()
{
close();
});
}
void MainWindow::changeEvent(QEvent * event)
{
QWidget::changeEvent(event);
if (event->type() == QEvent::ActivationChange && !this->isActiveWindow())
close();
}
void MainWindow::configureActions(Params ¶ms)
{
QList<Action*> actions;
const QString actionsFilepath = params.getString("actions");
const int numCols = params.getInt("cols", 5);
loadActions(actionsFilepath, actions);
int i = 0;
int j = 0;
for (auto & a : actions)
{
addButton(a, i, j);
++j;
if (j == numCols)
{
++i;
j = 0;
}
}
}
void MainWindow::loadActions(const QString actionsFilepath, QList<MainWindow::Action *> &actions)
{
QString homeDir = QDir::homePath();
QFileInfo info(actionsFilepath);
QFile file(actionsFilepath);
QSet<QString> shortcuts;
QDir::setCurrent(info.path());
if (!file.open(QIODevice::ReadOnly))
error("Could not open actions file");
int i = 0;
while (!file.atEnd())
{
QByteArray line = file.readLine();
auto cells = line.split(';');
if (cells.size() != 4)
error("Wrong number of cells in actions file at line", i);
auto a = new Action();
a->name = cells[0];
a->iconFilepath = QString(cells[1]).replace("~", homeDir);
a->shortcut = cells[2];
a->cmd = QString(cells[3]).replace("~", homeDir);
if (shortcuts.contains(a->shortcut))
error("Shortcut mapped twice:", a->shortcut);
actions.push_back(a);
++i;
}
}
void MainWindow::addButton(const Action * a,
const int row,
const int col)
{
// Get the icon
QIcon * icon;
if (a->iconFilepath.endsWith("svg"))
{
icon = new QIcon(a->iconFilepath);
}
else
{
QPixmap pixmap(a->iconFilepath);
if (pixmap.width() != iconSize)
{
QPixmap scaled = pixmap.scaled( QSize(iconSize, iconSize), Qt::KeepAspectRatio, Qt::SmoothTransformation );
icon = new QIcon(scaled);
}
else
{
icon = new QIcon(pixmap);
}
}
// Configure the button
auto b = new QToolButton();
b->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
b->setIconSize(QSize(iconSize,iconSize));
b->setIcon(*icon);
b->setText(a->name + "\n(" + a->shortcut + ")");
b->setStyleSheet(
"QToolButton {"
"border: 0px;"
"border-radius: 6px;"
"background-color: #ff222222;"
"color: #fff;"
"padding-top: 7px;"
"padding-bottom: 6px;"
"padding-right: 20px;"
"padding-left: 20px;"
"}"
"QToolButton:hover {"
"background-color: #ff333333;"
"}");
// Callback to execute this action
auto callback = [a, this]()
{
// QProcess::execute(a->cmd);
QDir::setCurrent(QDir::homePath());
QProcess::startDetached(a->cmd);
close();
};
// Configure button click
connect(b, &QToolButton::clicked, callback);
// Configure shortcut
auto s = new QShortcut(QKeySequence(a->shortcut), this);
connect(s, &QShortcut::activated, callback);
// Add button to screen
ui->gridLayout->addWidget(b, row, col);
}
void MainWindow::on_actiona_triggered()
{
print("a");
}
void MainWindow::on_actionb_triggered()
{
print("b");
}
void MainWindow::on_shortcut()
{
print("action");
}
| 24.469828
| 119
| 0.574599
|
diegofps
|
0a116c910ba20a7b92c886dcea15f9b4b3040368
| 24,529
|
cpp
|
C++
|
source/renderer/scene/adaptiveGrid/AdaptiveGrid.cpp
|
DaSutt/VolumetricParticles
|
6ec9bac4bec4a8757343bb770b23110ef2364dfd
|
[
"Apache-2.0"
] | 6
|
2017-06-26T11:42:26.000Z
|
2018-09-10T17:53:53.000Z
|
source/renderer/scene/adaptiveGrid/AdaptiveGrid.cpp
|
DaSutt/VolumetricParticles
|
6ec9bac4bec4a8757343bb770b23110ef2364dfd
|
[
"Apache-2.0"
] | 8
|
2017-06-24T20:25:42.000Z
|
2017-08-09T10:50:40.000Z
|
source/renderer/scene/adaptiveGrid/AdaptiveGrid.cpp
|
DaSutt/VolumetricParticles
|
6ec9bac4bec4a8757343bb770b23110ef2364dfd
|
[
"Apache-2.0"
] | null | null | null |
/*
MIT License
Copyright(c) 2017 Daniel Suttor
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 "AdaptiveGrid.h"
#include "..\..\passResources\ShaderBindingManager.h"
#include "..\..\passes\Passes.h"
#include "..\..\ShadowMap.h"
#include "..\..\resources\BufferManager.h"
#include "..\..\resources\ImageManager.h"
#include "..\..\passes\GuiPass.h"
#include "..\..\wrapper\Surface.h"
#include "..\..\wrapper\Barrier.h"
#include "..\..\wrapper\QueryPool.h"
#include "..\..\..\scene\Scene.h"
#include "..\..\..\utility\Status.h"
#include "AdaptiveGridConstants.h"
#include "debug\DebugData.h"
#include <glm\gtc\matrix_transform.hpp>
#define GLM_ENABLE_EXPERIMENTAL
#include <glm\gtx\component_wise.hpp>
#include <random>
#include <functional>
namespace Renderer
{
constexpr int debugScreenDivision_ = 1;
AdaptiveGrid::AdaptiveGrid(float worldCellSize) :
worldCellSize_{ worldCellSize },
imageAtlas_{GridConstants::imageResolution}
{
//min count for grid level data
gridLevelData_.resize(3);
}
void AdaptiveGrid::SetWorldExtent(const glm::vec3& min, const glm::vec3& max)
{
glm::vec3 scale;
const auto worldScale = max - min;
//grid resolution of root node is 1
std::vector<int> resolutions = { 1, GridConstants::nodeResolution, GridConstants::nodeResolution };
glm::vec3 maxScale = CalcMaxScale(resolutions, GridConstants::nodeResolution);
//add additional levels until the whole world is covered
/*while (glm::compMax(worldScale) > glm::compMax(maxScale))
{
resolutions.push_back(gridResolution_);
maxScale = CalcMaxScale(resolutions, imageResolution_);
}*/
scale = maxScale;
printf("Scene size %f %f %f\n", scale.x, scale.y, scale.z);
//Calculate world extent
const auto center = glm::vec3(0,0,0);
const auto halfScale = scale * 0.5f;
worldBoundingBox_.min = center - halfScale;
worldBoundingBox_.max = center + halfScale;
raymarchingData_.gridMinPosition = worldBoundingBox_.min;
radius_ = glm::distance(worldBoundingBox_.max, glm::vec3(0.0f));
int globalResolution = resolutions[0];
//Initialize all grid levels
for (size_t i = 0; i < resolutions.size(); ++i)
{
if (i > 0)
{
globalResolution *= resolutions[i];
}
gridLevels_.push_back({ resolutions[i] });
gridLevels_.back().SetWorldExtend(worldBoundingBox_.min, scale, static_cast<float>(globalResolution));
}
for (size_t i = 1; i < gridLevels_.size(); ++i)
{
gridLevels_[i].SetParentLevel(&gridLevels_[i - 1]);
}
gridLevels_.back().SetLeafLevel();
mostDetailedParentLevel_ = static_cast<int>(gridLevels_.size() - 2);
raymarchingData_.maxLevel = static_cast<int>(resolutions.size() - 1);
gridLevelData_.resize(resolutions.size());
for (size_t i = 0; i < resolutions.size(); ++i)
{
gridLevelData_[i].gridCellSize = gridLevels_[i].GetGridCellSize();
gridLevelData_[i].gridResolution = GridConstants::nodeResolution;
gridLevelData_[i].childCellSize = gridLevels_[i].GetGridCellSize() / GridConstants::nodeResolution;
}
groundFog_.SetSizes(gridLevels_[1].GetGridCellSize(), scale.x);
particleSystems_.SetGridOffset(worldBoundingBox_.min);
Status::UpdateGrid(scale, worldBoundingBox_.min);
Status::SetParticleSystems(&particleSystems_);
}
void AdaptiveGrid::ResizeConstantBuffers(BufferManager* bufferManager)
{
const auto levelBufferSize = sizeof(LevelData) * gridLevelData_.size();
bufferManager->Ref_RequestBufferResize(cbIndices_[CB_RAYMARCHING_LEVELS], levelBufferSize);
}
void AdaptiveGrid::RequestResources(ImageManager* imageManager, BufferManager* bufferManager, int frameCount)
{
BufferManager::BufferInfo bufferInfo;
bufferInfo.typeBits = BufferManager::BUFFER_CONSTANT_BIT | BufferManager::BUFFER_SCENE_BIT;
bufferInfo.pool = BufferManager::MEMORY_CONSTANT;
bufferInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT;
bufferInfo.bufferingCount = frameCount;
frameCount_ = frameCount;
auto cbIndex = CB_RAYMARCHING;
{
bufferInfo.data = &raymarchingData_;
bufferInfo.size = sizeof(RaymarchingData);
cbIndices_[cbIndex] = bufferManager->Ref_RequestBuffer(bufferInfo);
}
cbIndex = CB_RAYMARCHING_LEVELS;
{
bufferInfo.usage = VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
bufferInfo.data = gridLevelData_.data();
cbIndices_[cbIndex] = bufferManager->Ref_RequestBuffer(bufferInfo);
}
{
BufferManager::BufferInfo gridBufferInfo;
gridBufferInfo.pool = BufferManager::MEMORY_GRID;
gridBufferInfo.size = sizeof(uint32_t);
gridBufferInfo.typeBits = BufferManager::BUFFER_GRID_BIT;
gridBufferInfo.usage = VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
gridBufferInfo.bufferingCount = frameCount;
for (size_t i = GPU_BUFFER_NODE_INFOS; i < GPU_MAX; ++i)
{
gpuResources_[i] = { bufferManager->Ref_RequestBuffer(gridBufferInfo), 1 };
}
}
imageAtlas_.RequestResources(imageManager, bufferManager, ImageManager::MEMORY_POOL_GRID, frameCount);
const int atlasImageIndex = imageAtlas_.GetImageIndex();
const int atlasBufferIndex = imageAtlas_.GetBufferIndex();
debugFilling_.SetGpuResources(atlasImageIndex, atlasBufferIndex);
globalVolume_.RequestResources(bufferManager, frameCount, atlasImageIndex);
groundFog_.RequestResources(imageManager, bufferManager, frameCount, atlasImageIndex);
particleSystems_.RequestResources(bufferManager, frameCount, atlasImageIndex);
mipMapping_.RequestResources(imageManager, bufferManager, frameCount, atlasImageIndex);
neighborCells_.RequestResources(bufferManager, frameCount, atlasImageIndex);
for (size_t i = 0; i < gpuResources_.size(); ++i)
{
gpuResources_[i].maxSize = sizeof(int);
}
}
void AdaptiveGrid::SetImageIndices(int raymarching, int depth, int shadowMap, int noise)
{
raymarchingImageIndex_ = raymarching;
//TODO to test the image atlas
//raymarchingImageIndex_ = mipMapping_.GetImageAtlasIndex();
depthImageIndex_ = depth;
shadowMapIndex_ = shadowMap;
noiseImageIndex_ = noise;
debugTraversal_.SetImageIndices(
imageAtlas_.GetImageIndex(),
depthImageIndex_,
shadowMap,
noise
);
}
void AdaptiveGrid::OnLoadScene(const Scene* scene)
{
particleSystems_.OnLoadScene(scene);
}
void AdaptiveGrid::UpdateParticles(float dt)
{
particleSystems_.Update(dt);
}
int AdaptiveGrid::GetShaderBinding(ShaderBindingManager* bindingManager, Pass pass)
{
ShaderBindingManager::BindingInfo bindingInfo = {};
switch (pass)
{
case GRID_PASS_GLOBAL:
return globalVolume_.GetShaderBinding(bindingManager, frameCount_);
case GRID_PASS_GROUND_FOG:
return groundFog_.GetShaderBinding(bindingManager, frameCount_);
case GRID_PASS_PARTICLES:
return particleSystems_.GetShaderBinding(bindingManager, frameCount_);
case GRID_PASS_DEBUG_FILLING:
return debugFilling_.GetShaderBinding(bindingManager, frameCount_);
case GRID_PASS_MIPMAPPING:
return mipMapping_.GetShaderBinding(bindingManager, frameCount_, pass - GRID_PASS_MIPMAPPING);
case GRID_PASS_MIPMAPPING_MERGING:
return mipMapping_.GetShaderBinding(bindingManager, frameCount_, pass - GRID_PASS_MIPMAPPING);
case GRID_PASS_NEIGHBOR_UPDATE:
return neighborCells_.GetShaderBinding(bindingManager, frameCount_);
case GRID_PASS_RAYMARCHING:
{
bindingInfo.pass = SUBPASS_VOLUME_ADAPTIVE_RAYMARCHING;
bindingInfo.resourceIndex = {
raymarchingImageIndex_,
depthImageIndex_,
imageAtlas_.GetImageIndex(),
//mipMapping_.GetImageAtlasIndex(),
shadowMapIndex_,
noiseImageIndex_,
gpuResources_[GPU_BUFFER_NODE_INFOS].index,
gpuResources_[GPU_BUFFER_ACTIVE_BITS].index,
gpuResources_[GPU_BUFFER_BIT_COUNTS].index,
gpuResources_[GPU_BUFFER_CHILDS].index,
cbIndices_[CB_RAYMARCHING],
cbIndices_[CB_RAYMARCHING_LEVELS]
};
bindingInfo.stages = {
VK_SHADER_STAGE_COMPUTE_BIT,
VK_SHADER_STAGE_COMPUTE_BIT,
VK_SHADER_STAGE_COMPUTE_BIT,
VK_SHADER_STAGE_COMPUTE_BIT,
VK_SHADER_STAGE_COMPUTE_BIT,
VK_SHADER_STAGE_COMPUTE_BIT,
VK_SHADER_STAGE_COMPUTE_BIT,
VK_SHADER_STAGE_COMPUTE_BIT,
VK_SHADER_STAGE_COMPUTE_BIT,
VK_SHADER_STAGE_COMPUTE_BIT,
VK_SHADER_STAGE_COMPUTE_BIT };
bindingInfo.types = {
VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER };
bindingInfo.refactoring_ = { false, false, true, true, true, true, true, true, true, true, true };
bindingInfo.setCount = frameCount_;
}break;
default:
printf("Get shader bindings from adaptive grid for invalid type\n");
break;
}
return bindingManager->RequestShaderBinding(bindingInfo);
}
void AdaptiveGrid::Update(BufferManager* bufferManager, ImageManager* imageManager, Scene* scene, Surface* surface, ShadowMap* shadowMap, int frameIndex)
{
UpdateCBData(scene, surface, shadowMap);
UpdateGrid(scene);
ResizeGpuResources(bufferManager, imageManager);
UpdateGpuResources(bufferManager, frameIndex);
if (GuiPass::GetDebugVisState().nodeRendering)
{
UpdateBoundingBoxes();
}
}
void AdaptiveGrid::Dispatch(QueueManager* queueManager, ImageManager* imageManager, BufferManager* bufferManager,
VkCommandBuffer commandBuffer, Pass pass, int frameIndex, int level)
{
switch (pass)
{
case GRID_PASS_GLOBAL:
{
globalVolume_.Dispatch(imageManager, commandBuffer, frameIndex);
}
break;
case GRID_PASS_GROUND_FOG:
{
groundFog_.Dispatch(queueManager, imageManager, bufferManager, commandBuffer, frameIndex);
} break;
case GRID_PASS_PARTICLES:
particleSystems_.Dispatch(imageManager, commandBuffer, frameIndex);
break;
case GRID_PASS_DEBUG_FILLING:
debugFilling_.Dispatch(imageManager, commandBuffer);
break;
case GRID_PASS_MIPMAPPING:
mipMappingStarted_ = true;
case GRID_PASS_MIPMAPPING_MERGING:
mipMapping_.Dispatch(imageManager, bufferManager, commandBuffer, frameIndex, level, pass - GRID_PASS_MIPMAPPING);
break;
case GRID_PASS_NEIGHBOR_UPDATE:
{
neighborCells_.Dispatch(commandBuffer, imageManager, level, mipMappingStarted_, frameIndex);
}
break;
case GRID_PASS_RAYMARCHING:
mipMappingStarted_ = false;
break;
default:
break;
}
}
namespace
{
uint32_t CalcDispatchSize(uint32_t number, uint32_t multiple)
{
if (number % multiple == 0)
{
return number / multiple;
}
else
{
return number / multiple + 1;
}
}
}
void AdaptiveGrid::Raymarch(ImageManager* imageManager, VkCommandBuffer commandBuffer, uint32_t width, uint32_t height, int frameIndex)
{
if (initialized_)
{
const uint32_t dispatchX = CalcDispatchSize(width / debugScreenDivision_, 16);
const uint32_t dispatchY = CalcDispatchSize(height / debugScreenDivision_, 16);
auto& queryPool = Wrapper::QueryPool::GetInstance();
queryPool.TimestampStart(commandBuffer, Wrapper::TIMESTAMP_GRID_RAYMARCHING, frameIndex);
vkCmdDispatch(commandBuffer, dispatchX, dispatchY, 1);
queryPool.TimestampEnd(commandBuffer, Wrapper::TIMESTAMP_GRID_RAYMARCHING, frameIndex);
ImageManager::BarrierInfo imageAtlasBarrier{};
imageAtlasBarrier.imageIndex = imageAtlas_.GetImageIndex();
imageAtlasBarrier.type = ImageManager::BARRIER_READ_WRITE;
ImageManager::BarrierInfo shadowMapBarrier{};
shadowMapBarrier.imageIndex = shadowMapIndex_;
shadowMapBarrier.type = ImageManager::BARRIER_READ_WRITE;
auto barriers = imageManager->Barrier({ imageAtlasBarrier, shadowMapBarrier });
Wrapper::PipelineBarrierInfo pipelineBarrierInfo{};
pipelineBarrierInfo.src = VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
pipelineBarrierInfo.dst = VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
pipelineBarrierInfo.AddImageBarriers(barriers);
Wrapper::AddPipelineBarrier(commandBuffer, pipelineBarrierInfo);
}
}
void AdaptiveGrid::UpdateDebugTraversal(QueueManager* queueManager, BufferManager* bufferManager, ImageManager* imageManager)
{
const auto& volumeState = GuiPass::GetVolumeState();
if (volumeState.debugTraversal && !previousFrameTraversal_)
{
previousFrameTraversal_ = true;
const glm::ivec2 position = static_cast<glm::ivec2>(volumeState.cursorPosition);
debugTraversal_.Traversal(queueManager, bufferManager, imageManager, position.x, position.y);
}
else
{
previousFrameTraversal_ = false;
}
}
void AdaptiveGrid::UpdateCBData(Scene* scene, Surface* surface, ShadowMap* shadowMap)
{
{
const auto& camera = scene->GetCamera();
raymarchingData_.viewPortToWorld = glm::inverse(camera.GetViewProj());
raymarchingData_.nearPlane = camera.nearZ_;
raymarchingData_.farPlane = camera.farZ_;
raymarchingData_.shadowCascades = shadowMap->GetShadowMatrices();
const auto& screenSize = surface->GetSurfaceSize();
raymarchingData_.screenSize = { screenSize.width, screenSize.height};
static bool printedScreenSize = false;
if (!printedScreenSize)
{
printf("Raymarching resolution %f %f\n", raymarchingData_.screenSize.x, raymarchingData_.screenSize.y);
printedScreenSize = true;
}
}
{
const auto& lightingState = GuiPass::GetLightingState();
const auto& lv = lightingState.lightVector;
const auto& li = lightingState.irradiance;
raymarchingData_.irradiance = glm::vec3(li[0], li[1], li[2]);
const auto lightDir = glm::vec4(lv.x, lv.y, lv.z, 0.0f);
raymarchingData_.lightDirection = lightDir;
const glm::vec4 shadowRayNormalPos = glm::vec4(0, 0, 0, 1)
+ radius_ * lightDir;
raymarchingData_.shadowRayPlaneNormal = lightDir;
raymarchingData_.shadowRayPlaneDistance = glm::dot(-lightDir, shadowRayNormalPos);
}
{
const auto& volumeState = GuiPass::GetVolumeState();
globalMediumData_.scattering = volumeState.globalValue.scattering;
globalMediumData_.extinction = volumeState.globalValue.absorption + volumeState.globalValue.scattering;
globalMediumData_.phaseG = volumeState.globalValue.phaseG;
raymarchingData_.lodScale_Reciprocal = 1.0f / volumeState.lodScale;
raymarchingData_.globalScattering = { globalMediumData_.scattering, globalMediumData_.extinction, globalMediumData_.phaseG, 0.0f };
raymarchingData_.maxDepth = volumeState.maxDepth;
raymarchingData_.jitteringScale = volumeState.jitteringScale;
raymarchingData_.maxSteps = volumeState.stepCount;
raymarchingData_.exponentialScale = log(volumeState.maxDepth);
//TODO check why these values are double
volumeMediaData_.scattering = volumeState.groundFogValue.scattering;
volumeMediaData_.extinction = volumeState.groundFogValue.absorption + volumeState.groundFogValue.scattering;
volumeMediaData_.phaseG = volumeState.groundFogValue.phaseG;
if (volumeState.debugTraversal)
{
DebugData::raymarchData_ = raymarchingData_;
DebugData::levelData_.data = gridLevelData_;
}
groundFog_.UpdateCBData(volumeState.groundFogHeight,
volumeState.groundFogValue.scattering,
volumeState.groundFogValue.absorption,
volumeState.groundFogValue.phaseG,
volumeState.groundFogNoiseScale);
globalVolume_.UpdateCB(&groundFog_);
for (auto& levelData : gridLevelData_)
{
//levelData.minStepSize = levelData.gridCellSize / volumeState.lodScale;
levelData.shadowRayStepSize = levelData.gridCellSize /
static_cast<float>(volumeState.shadowRayPerLevel);
levelData.texelScale = GridConstants::nodeResolution /
((GridConstants::nodeResolution + 2) * imageAtlas_.GetSideLength() *
levelData.gridCellSize);
}
}
{
static std::default_random_engine generator;
static std::uniform_real_distribution<float> distribution(0.0f, 1.0f);
static auto RandPos = std::bind(distribution, generator);
raymarchingData_.randomness = { RandPos(), RandPos(), RandPos() };
}
{
const float nodeResolutionWithBorder = static_cast<float>(GridConstants::nodeResolution + 2);
raymarchingData_.atlasSideLength_Reciprocal = 1.0f / raymarchingData_.atlasSideLength;
raymarchingData_.textureOffset = 1.0f / nodeResolutionWithBorder / raymarchingData_.atlasSideLength;
raymarchingData_.atlasTexelToNodeTexCoord = 1.0f / GridConstants::imageResolution /
static_cast<float>(raymarchingData_.atlasSideLength);
const float relTexelSize = 1.0f / GridConstants::imageResolution / static_cast<float>(raymarchingData_.atlasSideLength);
raymarchingData_.texelHalfSize = relTexelSize * 0.5f;
raymarchingData_.nodeTexelSize = raymarchingData_.atlasSideLength_Reciprocal - relTexelSize;
}
particleSystems_.UpdateCBData(&gridLevels_[2]);
}
void AdaptiveGrid::UpdateGrid(Scene* scene)
{
for (auto& gridLevel : gridLevels_)
{
gridLevel.Reset();
}
gridLevels_[0].AddNode({ 0,0,0 });
//gridLevels_[1].AddNode({ 256, 256, 256 });
//gridLevels_[2].AddNode({ 256, 258,256 });
//gridLevels_[2].AddNode({ 258, 256, 256 });
//gridLevels_[2].AddNode({ 256, 256, 258 });
//gridLevels_[2].AddNode({ 254, 256,256 });
groundFog_.UpdateGridCells(&gridLevels_[1]);
particleSystems_.GridInsertParticleNodes(raymarchingData_.gridMinPosition, &gridLevels_[2]);
int parentChildOffset = 0;
for (auto& level : gridLevels_)
{
parentChildOffset = level.Update(parentChildOffset);
}
imageAtlas_.UpdateSize(gridLevels_.back().GetImageOffset());
const int atlasSideLength = imageAtlas_.GetSideLength();
mipMapping_.UpdateAtlasProperties(atlasSideLength, imageAtlas_.GetResolution());
for (auto& level : gridLevels_)
{
level.UpdateImageIndices(atlasSideLength);
}
particleSystems_.UpdateGpuData(&gridLevels_[1], &gridLevels_[2], atlasSideLength);
const int maxParentLevel = static_cast<int>(gridLevels_.size() - 1);
for (size_t i = 0; i < maxParentLevel; ++i)
{
mipMapping_.UpdateMipMapNodes(&gridLevels_[i], &gridLevels_[i + 1]);
}
//neighborCells_.CalculateNeighbors(gridLevels_);
debugFilling_.SetImageCount(&gridLevels_[2]);
debugFilling_.AddDebugNodes(gridLevels_);
volumeMediaData_.atlasSideLength = atlasSideLength;
volumeMediaData_.imageResolutionOffset = GridConstants::imageResolution;
raymarchingData_.atlasSideLength = atlasSideLength;
//neighborCells_.UpdateAtlasProperties(atlasSideLength);
}
std::array<VkDeviceSize, AdaptiveGrid::GPU_MAX> AdaptiveGrid::GetGpuResourceSize()
{
std::array<VkDeviceSize, GPU_MAX> totalSizes{};
for (const auto& level : gridLevels_)
{
totalSizes[GPU_BUFFER_NODE_INFOS] += level.GetNodeInfoSize();
totalSizes[GPU_BUFFER_ACTIVE_BITS] += level.GetActiveBitSize();
totalSizes[GPU_BUFFER_BIT_COUNTS] += level.GetBitCountsSize();
totalSizes[GPU_BUFFER_CHILDS] += level.GetChildSize();
}
return totalSizes;
}
void AdaptiveGrid::ResizeGpuResources(BufferManager* bufferManager, ImageManager* imageManager)
{
bool resize = false;
std::vector<ResourceResize>resourceResizes;
const auto totalSizes = GetGpuResourceSize();
imageAtlas_.ResizeImage(imageManager);
for (int i = 0; i < GPU_MAX; ++i)
{
const auto totalSize = totalSizes[i];
auto& maxSize = gpuResources_[i].maxSize;
if (maxSize < totalSize)
{
resize = true;
maxSize = totalSize;
}
resourceResizes.push_back({ maxSize, gpuResources_[i].index });
}
resize = groundFog_.ResizeGPUResources(resourceResizes) ? true : resize;
resize = particleSystems_.ResizeGpuResources(resourceResizes) ? true : resize;
resize = mipMapping_.ResizeGpuResources(imageManager, resourceResizes) ? true : resize;
resize = neighborCells_.ResizeGpuResources(resourceResizes) ? true : resize;
if (!initialized_)
{
resize = true;
initialized_ = true;
}
if (resize)
{
bufferManager->Ref_ResizeBuffers(resourceResizes, BufferManager::MEMORY_GRID);
}
resizing_ = resize;
}
namespace
{
struct ResourceInfo
{
void* dataPtr;
int offset;
};
}
void* AdaptiveGrid::GetDebugBufferCopyDst(GridLevel::BufferType type, int size)
{
switch (type)
{
case GridLevel::BUFFER_NODE_INFOS:
DebugData::nodeInfos_.data.resize(size / sizeof(NodeInfo));
return DebugData::nodeInfos_.data.data();
case GridLevel::BUFFER_ACTIVE_BITS:
DebugData::activeBits_.data.resize(size / sizeof(uint32_t));
return DebugData::activeBits_.data.data();
case GridLevel::BUFFER_BIT_COUNTS:
DebugData::bitCounts_.data.resize(size / sizeof(int));
return DebugData::bitCounts_.data.data();
case GridLevel::BUFFER_CHILDS:
DebugData::childIndices_.indices.resize(size / sizeof(int));
return DebugData::childIndices_.indices.data();
default:
printf("Invalid buffer type to get copy dst\n");
break;
}
return nullptr;
}
void AdaptiveGrid::UpdateGpuResources(BufferManager* bufferManager, int frameIndex)
{
const auto& volumeState = GuiPass::GetVolumeState();
std::array<ResourceInfo, GPU_MAX> offsets{};
for (int i = 0; i < GPU_MAX; ++i)
{
offsets[i].dataPtr =
bufferManager->Ref_Map(gpuResources_[i].index, frameIndex, BufferManager::BUFFER_GRID_BIT);
}
for (size_t i = 0; i < gridLevels_.size(); ++i)
{
//TODO check if neccessary
gridLevelData_[i].nodeArrayOffset = offsets[GridLevel::BUFFER_NODE_INFOS].offset;
gridLevelData_[i].childArrayOffset = offsets[GridLevel::BUFFER_CHILDS].offset;
gridLevelData_[i].nodeOffset = gridLevelData_[i].nodeArrayOffset / sizeof(NodeInfo);
gridLevelData_[i].childOffset = gridLevelData_[i].childArrayOffset / sizeof(int);
for (int resourceIndex = 0; resourceIndex < GridLevel::BUFFER_MAX; ++resourceIndex)
{
const auto bufferType = static_cast<GridLevel::BufferType>(resourceIndex);
const int offset = offsets[resourceIndex].offset;
offsets[resourceIndex].offset = gridLevels_[i].CopyBufferData(offsets[resourceIndex].dataPtr,
static_cast<GridLevel::BufferType>(resourceIndex), offsets[resourceIndex].offset);
if (volumeState.debugTraversal)
{
gridLevels_[i].CopyBufferData(GetDebugBufferCopyDst(bufferType, offsets[resourceIndex].offset),
bufferType, offset);
}
}
}
for (int i = GPU_BUFFER_NODE_INFOS; i < GPU_MAX; ++i)
{
bufferManager->Ref_Unmap(gpuResources_[i].index, frameIndex, BufferManager::BUFFER_GRID_BIT);
}
groundFog_.UpdatePerNodeBuffer(bufferManager, &gridLevels_[1], frameIndex, imageAtlas_.GetSideLength());
particleSystems_.UpdateGpuResources(bufferManager, frameIndex);
mipMapping_.UpdateGpuResources(bufferManager, frameIndex);
neighborCells_.UpdateGpuResources(bufferManager, frameIndex);
}
void AdaptiveGrid::UpdateBoundingBoxes()
{
debugBoundingBoxes_.clear();
for (auto& level : gridLevels_)
{
level.UpdateBoundingBoxes();
const auto& nodeData = level.GetNodeData();
glm::vec4 color = glm::vec4(0, 1, 0, 1);
for (size_t i = 0; i < level.nodeBoundingBoxes_.size(); ++i)
{
debugBoundingBoxes_.push_back({
WorldMatrix(level.nodeBoundingBoxes_[i]), color
});
}
}
debugBoundingBoxes_.push_back({ WorldMatrix(worldBoundingBox_), glm::vec4(0,1,0,0) });
}
glm::vec3 AdaptiveGrid::CalcMaxScale(std::vector<int> levelResolutions, int textureResolution)
{
glm::vec3 scale = glm::vec3(worldCellSize_) * static_cast<float>(textureResolution);
for (const auto res : levelResolutions)
{
scale *= static_cast<float>(res);
}
return scale;
}
}
| 34.941595
| 154
| 0.755229
|
DaSutt
|
0a11745da99a17acd76d39f6448e62662e77c7cd
| 826
|
hpp
|
C++
|
iOS/G3MiOSSDK/Commons/Mesh/DirectMesh.hpp
|
RMMJR/g3m
|
990467dc8e2bf584f8b512bdf06ecf4def625185
|
[
"BSD-2-Clause"
] | 1
|
2016-08-23T10:29:44.000Z
|
2016-08-23T10:29:44.000Z
|
iOS/G3MiOSSDK/Commons/Mesh/DirectMesh.hpp
|
RMMJR/g3m
|
990467dc8e2bf584f8b512bdf06ecf4def625185
|
[
"BSD-2-Clause"
] | null | null | null |
iOS/G3MiOSSDK/Commons/Mesh/DirectMesh.hpp
|
RMMJR/g3m
|
990467dc8e2bf584f8b512bdf06ecf4def625185
|
[
"BSD-2-Clause"
] | null | null | null |
//
// DirectMesh.hpp
// G3MiOSSDK
//
// Created by Diego Gomez Deck on 12/1/12.
//
//
#ifndef __G3MiOSSDK__DirectMesh__
#define __G3MiOSSDK__DirectMesh__
#include "AbstractMesh.hpp"
class DirectMesh : public AbstractMesh {
protected:
void rawRender(const G3MRenderContext* rc) const;
Mesh* createNormalsMesh() const;
public:
DirectMesh(const int primitive,
bool owner,
const Vector3D& center,
IFloatBuffer* vertices,
float lineWidth,
float pointSize,
const Color* flatColor = NULL,
IFloatBuffer* colors = NULL,
const float colorsIntensity = 0.0f,
bool depthTest = true,
IFloatBuffer* normals = NULL);
~DirectMesh() {
#ifdef JAVA_CODE
super.dispose();
#endif
}
};
#endif
| 19.209302
| 51
| 0.621065
|
RMMJR
|
0a14825b689f0c39af63ff61ae29ce1652980afa
| 1,250
|
cpp
|
C++
|
src/game/piece/pawn.cpp
|
Aviraj55/Chess
|
51dfdd4a33f18f6cbb9666b6b16ecd4d859ac3e1
|
[
"MIT"
] | null | null | null |
src/game/piece/pawn.cpp
|
Aviraj55/Chess
|
51dfdd4a33f18f6cbb9666b6b16ecd4d859ac3e1
|
[
"MIT"
] | null | null | null |
src/game/piece/pawn.cpp
|
Aviraj55/Chess
|
51dfdd4a33f18f6cbb9666b6b16ecd4d859ac3e1
|
[
"MIT"
] | 1
|
2020-10-03T20:59:17.000Z
|
2020-10-03T20:59:17.000Z
|
#include "pawn.h"
#include "../board.h"
std::vector<Coordinate> Pawn::get_candidate_moves() const {
std::vector<Coordinate> candidate_moves;
int dir = color_ == Color::WHITE ? 1 : -1;
// Pawns may always move one square forward
std::vector<int> forward_moves(1, 1);
if (move_history_.empty()) {
// If this is the first move that this pawn has made, then it may optionally
// move two squares forward
forward_moves.push_back(2);
}
for (int rank_offset : forward_moves) {
Coordinate dest(coordinate_.get_rank() + rank_offset * dir,
coordinate_.get_file());
// When moving forward, pawns may be blocked by pieces of either color (and
// may not capture)
if (board_->piece_at(dest) == nullptr) {
candidate_moves.push_back(dest);
}
}
// Pawns may move diagonally one square to capture an enemy piece
for (int file_offset : {-1, 1}) {
Coordinate dest(coordinate_.get_rank() + dir,
coordinate_.get_file() + file_offset);
Piece *dest_piece = board_->piece_at(dest);
if (dest_piece != nullptr && dest_piece->get_color() != color_) {
candidate_moves.push_back(dest);
}
}
// TODO: Implement en passant
return candidate_moves;
}
| 30.487805
| 80
| 0.656
|
Aviraj55
|
0a20b224df22148e34f8f09e929d28394b7c6c9a
| 18,357
|
hpp
|
C++
|
accessor/scaled_reduced_row_major.hpp
|
JakubTrzcskni/ginkgo
|
8a9988b9c3f8c4ff59fae30050575311f230065e
|
[
"BSD-3-Clause"
] | null | null | null |
accessor/scaled_reduced_row_major.hpp
|
JakubTrzcskni/ginkgo
|
8a9988b9c3f8c4ff59fae30050575311f230065e
|
[
"BSD-3-Clause"
] | null | null | null |
accessor/scaled_reduced_row_major.hpp
|
JakubTrzcskni/ginkgo
|
8a9988b9c3f8c4ff59fae30050575311f230065e
|
[
"BSD-3-Clause"
] | null | null | null |
/*******************************<GINKGO LICENSE>******************************
Copyright (c) 2017-2022, the Ginkgo authors
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
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.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************<GINKGO LICENSE>*******************************/
#ifndef GKO_ACCESSOR_SCALED_REDUCED_ROW_MAJOR_HPP_
#define GKO_ACCESSOR_SCALED_REDUCED_ROW_MAJOR_HPP_
#include <array>
#include <cinttypes>
#include <type_traits>
#include <utility>
#include "accessor_helper.hpp"
#include "index_span.hpp"
#include "range.hpp"
#include "scaled_reduced_row_major_reference.hpp"
#include "utils.hpp"
namespace gko {
/**
* @brief The accessor namespace.
*
* @ingroup accessor
*/
namespace acc {
namespace detail {
// In case of a const type, do not provide a write function
template <int Dimensionality, typename Accessor, typename ScalarType,
bool = std::is_const<ScalarType>::value>
struct enable_write_scalar {
using scalar_type = ScalarType;
};
// In case of a non-const type, enable the write function
template <int Dimensionality, typename Accessor, typename ScalarType>
struct enable_write_scalar<Dimensionality, Accessor, ScalarType, false> {
static_assert(Dimensionality >= 1,
"Dimensionality must be a positive number!");
using scalar_type = ScalarType;
/**
* Writes the scalar value at the given indices.
* The number of indices must be equal to the number of dimensions, even
* if some of the indices are ignored (depending on the scalar mask).
*
* @param value value to write
* @param indices indices where to write the value
*
* @returns the written value.
*/
template <typename... Indices>
constexpr GKO_ACC_ATTRIBUTES scalar_type
write_scalar_masked(scalar_type value, Indices&&... indices) const
{
static_assert(sizeof...(Indices) == Dimensionality,
"Number of indices must match dimensionality!");
scalar_type* GKO_ACC_RESTRICT rest_scalar = self()->scalar_;
return rest_scalar[self()->compute_mask_scalar_index(
std::forward<Indices>(indices)...)] = value;
}
/**
* Writes the scalar value at the given indices.
* Only the actually used indices must be provided, meaning the number of
* specified indices must be equal to the number of set bits in the
* scalar mask.
*
* @param value value to write
* @param indices indices where to write the value
*
* @returns the written value.
*/
template <typename... Indices>
constexpr GKO_ACC_ATTRIBUTES scalar_type
write_scalar_direct(scalar_type value, Indices&&... indices) const
{
scalar_type* GKO_ACC_RESTRICT rest_scalar = self()->scalar_;
return rest_scalar[self()->compute_direct_scalar_index(
std::forward<Indices>(indices)...)] = value;
}
private:
constexpr GKO_ACC_ATTRIBUTES const Accessor* self() const
{
return static_cast<const Accessor*>(this);
}
};
} // namespace detail
/**
* The scaled_reduced_row_major class allows a storage format that is different
* from the arithmetic format (which is returned from the brace operator).
* Additionally, a scalar is used when reading and writing data to allow for
* a shift in range.
* As storage, the StorageType is used.
*
* This accessor uses row-major access. For example, for three dimensions,
* neighboring z coordinates are next to each other in memory, followed by y
* coordinates and then x coordinates.
*
* @tparam Dimensionality The number of dimensions managed by this accessor
*
* @tparam ArithmeticType Value type used for arithmetic operations and
* for in- and output
*
* @tparam StorageType Value type used for storing the actual value to memory
*
* @tparam ScalarMask Binary mask that marks which indices matter for the
* scalar selection (set bit means the corresponding index
* needs to be considered, 0 means it is not). The least
* significand bit corresponds to the last index dimension,
* the second least to the second last index dimension, and
* so on.
* For example, the mask = 0b011101 means that for the 5d
* indices (x1, x2, x3, x4, x5), (x1, x2, x3, x5) are
* considered for the scalar, making the scalar itself 4d.
*
* @note This class only manages the accesses and not the memory itself.
*/
template <std::size_t Dimensionality, typename ArithmeticType,
typename StorageType, std::uint64_t ScalarMask>
class scaled_reduced_row_major
: public detail::enable_write_scalar<
Dimensionality,
scaled_reduced_row_major<Dimensionality, ArithmeticType, StorageType,
ScalarMask>,
ArithmeticType, std::is_const<StorageType>::value> {
public:
using arithmetic_type = std::remove_cv_t<ArithmeticType>;
using storage_type = StorageType;
static constexpr auto dimensionality = Dimensionality;
static constexpr auto scalar_mask = ScalarMask;
static constexpr bool is_const{std::is_const<storage_type>::value};
using scalar_type =
std::conditional_t<is_const, const arithmetic_type, arithmetic_type>;
using const_accessor =
scaled_reduced_row_major<dimensionality, arithmetic_type,
const storage_type, ScalarMask>;
static_assert(!is_complex<ArithmeticType>::value &&
!is_complex<StorageType>::value,
"Both arithmetic and storage type must not be complex!");
static_assert(Dimensionality >= 1,
"Dimensionality must be a positive number!");
static_assert(dimensionality <= 32,
"Only Dimensionality <= 32 is currently supported");
// Allow access to both `scalar_` and `compute_mask_scalar_index()`
friend class detail::enable_write_scalar<
dimensionality, scaled_reduced_row_major, scalar_type>;
friend class range<scaled_reduced_row_major>;
protected:
static constexpr std::size_t scalar_dim{
helper::count_mask_dimensionality<scalar_mask, dimensionality>()};
static constexpr std::size_t scalar_stride_dim{
scalar_dim == 0 ? 0 : (scalar_dim - 1)};
using dim_type = std::array<size_type, dimensionality>;
using storage_stride_type = std::array<size_type, dimensionality - 1>;
using scalar_stride_type = std::array<size_type, scalar_stride_dim>;
using reference_type =
reference_class::scaled_reduced_storage<arithmetic_type, StorageType>;
private:
using index_type = std::int64_t;
protected:
/**
* Creates the accessor for an already allocated storage space with a
* stride. The first stride is used for computing the index for the first
* index, the second stride for the second index, and so on.
*
* @param size multidimensional size of the memory
* @param storage pointer to the block of memory containing the storage
* @param storage_stride stride array used for memory accesses to storage
* @param scalar pointer to the block of memory containing the scalar
* values.
* @param scalar_stride stride array used for memory accesses to scalar
*/
constexpr GKO_ACC_ATTRIBUTES scaled_reduced_row_major(
dim_type size, storage_type* storage,
storage_stride_type storage_stride, scalar_type* scalar,
scalar_stride_type scalar_stride)
: size_(size),
storage_{storage},
storage_stride_(storage_stride),
scalar_{scalar},
scalar_stride_(scalar_stride)
{}
/**
* Creates the accessor for an already allocated storage space with a
* stride. The first stride is used for computing the index for the first
* index, the second stride for the second index, and so on.
*
* @param size multidimensional size of the memory
* @param storage pointer to the block of memory containing the storage
* @param stride stride array used for memory accesses to storage
* @param scalar pointer to the block of memory containing the scalar
* values.
*/
constexpr GKO_ACC_ATTRIBUTES scaled_reduced_row_major(
dim_type size, storage_type* storage, storage_stride_type stride,
scalar_type* scalar)
: scaled_reduced_row_major{
size, storage, stride, scalar,
helper::compute_default_masked_row_major_stride_array<
scalar_mask, scalar_stride_dim, dimensionality>(size)}
{}
/**
* Creates the accessor for an already allocated storage space.
* It is assumed that all accesses are without padding.
*
* @param size multidimensional size of the memory
* @param storage pointer to the block of memory containing the storage
* @param scalar pointer to the block of memory containing the scalar
* values.
*/
constexpr GKO_ACC_ATTRIBUTES scaled_reduced_row_major(dim_type size,
storage_type* storage,
scalar_type* scalar)
: scaled_reduced_row_major{
size, storage,
helper::compute_default_row_major_stride_array(size), scalar}
{}
/**
* Creates an empty accessor (pointing nowhere with an empty size)
*/
constexpr GKO_ACC_ATTRIBUTES scaled_reduced_row_major()
: scaled_reduced_row_major{{0, 0, 0}, nullptr, nullptr}
{}
public:
/**
* Creates a scaled_reduced_row_major range which contains a read-only
* version of the current accessor.
*
* @returns a scaled_reduced_row_major major range which is read-only.
*/
constexpr GKO_ACC_ATTRIBUTES range<const_accessor> to_const() const
{
return range<const_accessor>{size_, storage_, storage_stride_, scalar_,
scalar_stride_};
}
/**
* Reads the scalar value at the given indices. Only indices where the
* scalar mask bit is set are considered, the others are ignored.
*
* @param indices indices which data to access
*
* @returns the scalar value at the given indices.
*/
template <typename... Indices>
constexpr GKO_ACC_ATTRIBUTES scalar_type
read_scalar_masked(Indices&&... indices) const
{
const arithmetic_type* GKO_ACC_RESTRICT rest_scalar = scalar_;
return rest_scalar[compute_mask_scalar_index(
std::forward<Indices>(indices)...)];
}
/**
* Reads the scalar value at the given indices. Only the actually used
* indices must be provided, meaning the number of specified indices must
* be equal to the number of set bits in the scalar mask.
*
* @param indices indices which data to access
*
* @returns the scalar value at the given indices.
*/
template <typename... Indices>
constexpr GKO_ACC_ATTRIBUTES scalar_type
read_scalar_direct(Indices&&... indices) const
{
const arithmetic_type* GKO_ACC_RESTRICT rest_scalar = scalar_;
return rest_scalar[compute_direct_scalar_index(
std::forward<Indices>(indices)...)];
}
/**
* Returns the length in dimension `dimension`.
*
* @param dimension a dimension index
*
* @returns length in dimension `dimension`
*/
constexpr GKO_ACC_ATTRIBUTES size_type length(size_type dimension) const
{
return dimension < dimensionality ? size_[dimension] : 1;
}
/**
* Returns the stored value for the given indices. If the storage is const,
* a value is returned, otherwise, a reference is returned.
*
* @param indices indices which value is supposed to access
*
* @returns the stored value if the accessor is const (if the storage type
* is const), or a reference if the accessor is non-const
*/
template <typename... Indices>
constexpr GKO_ACC_ATTRIBUTES std::enable_if_t<
are_all_integral<Indices...>::value,
std::conditional_t<is_const, arithmetic_type, reference_type>>
operator()(Indices... indices) const
{
return reference_type{storage_ + compute_index(indices...),
read_scalar_masked(indices...)};
}
/**
* Returns a sub-range spinning the current range (x1_span, x2_span, ...)
*
* @param spans span for the indices
*
* @returns a sub-range for the given spans.
*/
template <typename... SpanTypes>
constexpr GKO_ACC_ATTRIBUTES
std::enable_if_t<helper::are_index_span_compatible<SpanTypes...>::value,
range<scaled_reduced_row_major>>
operator()(SpanTypes... spans) const
{
return helper::validate_index_spans(size_, spans...),
range<scaled_reduced_row_major>{
dim_type{
(index_span{spans}.end - index_span{spans}.begin)...},
storage_ + compute_index((index_span{spans}.begin)...),
storage_stride_,
scalar_ +
compute_mask_scalar_index(index_span{spans}.begin...),
scalar_stride_};
}
/**
* Returns the size of the accessor
*
* @returns the size of the accessor
*/
constexpr GKO_ACC_ATTRIBUTES dim_type get_size() const { return size_; }
/**
* Returns a const reference to the storage stride array of size
* dimensionality - 1
*
* @returns a const reference to the storage stride array of size
* dimensionality - 1
*/
constexpr GKO_ACC_ATTRIBUTES const storage_stride_type& get_storage_stride()
const
{
return storage_stride_;
}
/**
* Returns a const reference to the scalar stride array
*
* @returns a const reference to the scalar stride array
*/
constexpr GKO_ACC_ATTRIBUTES const scalar_stride_type& get_scalar_stride()
const
{
return scalar_stride_;
}
/**
* Returns the pointer to the storage data
*
* @returns the pointer to the storage data
*/
constexpr GKO_ACC_ATTRIBUTES storage_type* get_stored_data() const
{
return storage_;
}
/**
* Returns a const pointer to the storage data
*
* @returns a const pointer to the storage data
*/
constexpr GKO_ACC_ATTRIBUTES const storage_type* get_const_storage() const
{
return storage_;
}
/**
* Returns the pointer to the scalar data
*
* @returns the pointer to the scalar data
*/
constexpr GKO_ACC_ATTRIBUTES scalar_type* get_scalar() const
{
return scalar_;
}
/**
* Returns a const pointer to the scalar data
*
* @returns a const pointer to the scalar data
*/
constexpr GKO_ACC_ATTRIBUTES const scalar_type* get_const_scalar() const
{
return scalar_;
}
protected:
template <typename... Indices>
constexpr GKO_ACC_ATTRIBUTES size_type
compute_index(Indices&&... indices) const
{
static_assert(sizeof...(Indices) == dimensionality,
"Number of indices must match dimensionality!");
return helper::compute_row_major_index<index_type, dimensionality>(
size_, storage_stride_, std::forward<Indices>(indices)...);
}
template <typename... Indices>
constexpr GKO_ACC_ATTRIBUTES size_type
compute_mask_scalar_index(Indices&&... indices) const
{
static_assert(sizeof...(Indices) == dimensionality,
"Number of indices must match dimensionality!");
return helper::compute_masked_index<index_type, scalar_mask,
scalar_stride_dim>(
size_, scalar_stride_, std::forward<Indices>(indices)...);
}
template <typename... Indices>
constexpr GKO_ACC_ATTRIBUTES size_type
compute_direct_scalar_index(Indices&&... indices) const
{
static_assert(
sizeof...(Indices) == scalar_dim,
"Number of indices must match number of set bits in scalar mask!");
return helper::compute_masked_index_direct<index_type, scalar_mask,
scalar_stride_dim>(
size_, scalar_stride_, std::forward<Indices>(indices)...);
}
private:
const dim_type size_;
storage_type* const storage_;
const storage_stride_type storage_stride_;
scalar_type* const scalar_;
const scalar_stride_type scalar_stride_;
};
} // namespace acc
} // namespace gko
#endif // GKO_ACCESSOR_SCALED_REDUCED_ROW_MAJOR_HPP_
| 36.861446
| 80
| 0.661873
|
JakubTrzcskni
|
0a25d69676aae709b47041e5d6b4f6c8a7db1610
| 924
|
cpp
|
C++
|
main.cpp
|
hnqiu/cpp-test
|
ec3eafd3126be8468ba4f2d6a26c5863659aa8e3
|
[
"MIT"
] | 1
|
2019-03-21T04:06:13.000Z
|
2019-03-21T04:06:13.000Z
|
main.cpp
|
hnqiu/cpp-test
|
ec3eafd3126be8468ba4f2d6a26c5863659aa8e3
|
[
"MIT"
] | null | null | null |
main.cpp
|
hnqiu/cpp-test
|
ec3eafd3126be8468ba4f2d6a26c5863659aa8e3
|
[
"MIT"
] | null | null | null |
/* Copyright (C) 2019 hnqiu. All rights reserved.
* Licensed under the MIT License. See LICENSE for details.
*/
#include <iostream>
#include "string_test.h"
#include "sizeof_test.h"
#include "continue_test.h"
#include "return_list_test.h"
#include "return_pointer_to_array_test.h"
#include "class_test.h"
#include "cons_des.h"
#include "inheritance_test.h"
#include "template_test.h"
#include "operator_test.h"
#include "predicate_test.h"
#include "bitset_test.h"
#include "clock_test.h"
int main(int argc, char *argv[]) {
//string_test();
//sizeof_test();
//continue_test();
//return_list_test();
//return_pointer_to_array_test();
//class_test();
//smart_ptr_test();
//cons_des();
//inheritance_test();
//template_test();
//template_test_v2();
//operator_test();
// predicate_test();
bitset_test();
c_clock_test();
cpp_clock_test();
return 0;
}
| 22.536585
| 59
| 0.675325
|
hnqiu
|
0a266fc73810200877750334d795b4558aaf7381
| 1,531
|
cpp
|
C++
|
src/vector_types.cpp
|
DoubleJump/waggle
|
06a2fb07d7e3678f990396d1469cf4f85e3863a1
|
[
"MIT"
] | 1
|
2021-04-30T11:14:32.000Z
|
2021-04-30T11:14:32.000Z
|
src/vector_types.cpp
|
DoubleJump/waggle
|
06a2fb07d7e3678f990396d1469cf4f85e3863a1
|
[
"MIT"
] | null | null | null |
src/vector_types.cpp
|
DoubleJump/waggle
|
06a2fb07d7e3678f990396d1469cf4f85e3863a1
|
[
"MIT"
] | null | null | null |
struct Vec2
{
f32 x, y;
f32& operator[](int i){ return (&x)[i]; }
};
struct Vec3
{
f32 x, y, z;
f32& operator[](int i){ return (&x)[i]; }
};
static Vec3 vec3_up = {0,1,0};
static Vec3 vec3_down = {0,-1,0};
static Vec3 vec3_left = {-1,0,0};
static Vec3 vec3_right = {1,0,0};
static Vec3 vec3_forward = {0,0,1};
static Vec3 vec3_back = {0,0,-1};
static Vec3 vec3_zero = {0,0,0};
static Vec3 vec3_one = {1,1,1};
struct Vec4
{
f32 x, y, z, w;
f32& operator[](int i){ return (&x)[i]; }
};
struct Mat3
{
f32 m[9];
f32& operator[](int i){ return m[i]; }
};
struct Mat4
{
f32 m[16];
f32& operator[](int i){ return m[i]; };
};
struct Ray
{
Vec3 origin;
Vec3 direction;
f32 length;
};
struct AABB
{
Vec3 min;
Vec3 max;
};
struct Bezier_Segment
{
Vec3 a,b,c,d;
};
struct Triangle
{
Vec3 a,b,c;
};
struct Plane
{
Vec3 position;
Vec3 normal;
};
struct Sphere
{
Vec3 position;
f32 radius;
};
struct Capsule
{
Vec3 position;
f32 radius;
f32 height;
};
struct Hit_Info
{
b32 hit;
Vec3 point;
Vec3 normal;
f32 t;
};
enum struct Float_Primitive
{
F32 = 0,
VEC2 = 1,
VEC3 = 2,
VEC4 = 3,
QUATERNION = 4,
};
static u32
get_stride(Float_Primitive p)
{
switch(p)
{
case Float_Primitive::F32: return 1;
case Float_Primitive::VEC2: return 2;
case Float_Primitive::VEC3: return 3;
case Float_Primitive::VEC4: return 4;
case Float_Primitive::QUATERNION: return 4;
}
}
| 13.918182
| 46
| 0.580666
|
DoubleJump
|
0a26a32a3eaa6c15d09010643fef518594583b5f
| 1,202
|
cpp
|
C++
|
src/example/greating_client.cpp
|
Nekrolm/grpc_callback
|
1f0db9f2dd60afe1fac400e6541698d8f1fc4c34
|
[
"WTFPL"
] | 3
|
2019-07-27T16:01:01.000Z
|
2022-03-01T00:09:19.000Z
|
src/example/greating_client.cpp
|
Nekrolm/grpc_callback
|
1f0db9f2dd60afe1fac400e6541698d8f1fc4c34
|
[
"WTFPL"
] | null | null | null |
src/example/greating_client.cpp
|
Nekrolm/grpc_callback
|
1f0db9f2dd60afe1fac400e6541698d8f1fc4c34
|
[
"WTFPL"
] | null | null | null |
#include "greating_client.h"
#include <grpcpp/channel.h>
#include <functional>
#include <thread>
#include <memory>
#include <grpc/simplified_async_callback_api.h>
GreatingClient::GreatingClient(std::shared_ptr<grpc::Channel> ch) :
stub_(test::Greeting::NewStub(ch))
{}
GreatingClient::~GreatingClient()
{}
void GreatingClient::greeting(const std::string& name)
{
test::HelloRequest request;
request.set_name(name);
grpc::simple_responce_handler_t<test::HelloReply> callback = [](std::shared_ptr<test::HelloReply> reply,
std::shared_ptr<grpc::Status> status) {
if (status->ok())
std::cout << reply->message() << std::endl;
else
std::cout << "failed!" << std::endl;
};
client_.request(stub_.get(), &test::Greeting::Stub::AsyncSayHello, request, callback);
}
| 35.352941
| 116
| 0.46589
|
Nekrolm
|
0a2a3b88dd3554373e63dcb5ff92d9a0bd52f202
| 10,241
|
hxx
|
C++
|
src/Utils/Table.hxx
|
ebertolazzi/Malloc
|
4c1f8950cd631c185e141aaccfe0cd53daa91490
|
[
"BSD-2-Clause",
"MIT"
] | null | null | null |
src/Utils/Table.hxx
|
ebertolazzi/Malloc
|
4c1f8950cd631c185e141aaccfe0cd53daa91490
|
[
"BSD-2-Clause",
"MIT"
] | null | null | null |
src/Utils/Table.hxx
|
ebertolazzi/Malloc
|
4c1f8950cd631c185e141aaccfe0cd53daa91490
|
[
"BSD-2-Clause",
"MIT"
] | null | null | null |
/*--------------------------------------------------------------------------*\
| |
| Copyright (C) 2021 |
| |
| , __ , __ |
| /|/ \ /|/ \ |
| | __/ _ ,_ | __/ _ ,_ |
| | \|/ / | | | | \|/ / | | | |
| |(__/|__/ |_/ \_/|/|(__/|__/ |_/ \_/|/ |
| /| /| |
| \| \| |
| |
| Enrico Bertolazzi |
| Dipartimento di Ingegneria Industriale |
| Universita` degli Studi di Trento |
| email: enrico.bertolazzi@unitn.it |
| |
\*--------------------------------------------------------------------------*/
///
/// eof: Table.hxx
///
/*\
Based on terminal-table:
https://github.com/Bornageek/terminal-table
Copyright 2015 Andreas Wilhelm
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.
\*/
namespace Utils {
namespace Table {
using std::string;
using std::vector;
class Table;
typedef int integer;
enum Alignment { LEFT, RIGHT, CENTER };
class Style {
private:
char m_border_top = '-';
char m_border_top_mid = '+';
char m_border_top_left = '+';
char m_border_top_right = '+';
char m_border_bottom = '-';
char m_border_bottom_mid = '+';
char m_border_bottom_left = '+';
char m_border_bottom_right = '+';
char m_border_left = '|';
char m_border_left_mid = '+';
char m_border_mid = '-';
char m_border_mid_mid = '+';
char m_border_right = '|';
char m_border_right_mid = '+';
char m_border_middle = '|';
integer m_padding_left = 1;
integer m_padding_right = 1;
Alignment m_Align = Alignment::LEFT;
integer m_Width = 0;
public:
Style() = default;
char border_top() const { return m_border_top; }
void border_top( char borderStyle ) { m_border_top = borderStyle; }
char border_top_mid() const { return m_border_top_mid; }
void border_top_mid( char borderStyle ) { m_border_top_mid = borderStyle; }
char border_top_left() const { return m_border_top_left; }
void border_top_left( char borderStyle ) { m_border_top_left = borderStyle; }
char border_top_right() const { return m_border_top_right; }
void border_top_right( char borderStyle ) { m_border_top_right = borderStyle; }
char border_bottom() const { return m_border_bottom; }
void border_bottom( char borderStyle ) { m_border_bottom = borderStyle; }
char border_bottom_mid() const { return m_border_bottom_mid; }
void border_bottom_mid( char borderStyle ) { m_border_bottom_mid = borderStyle; }
char border_bottom_left() const { return m_border_bottom_left; }
void border_bottom_left( char borderStyle ) { m_border_bottom_left = borderStyle; }
char border_bottom_right() const { return m_border_bottom_right; }
void border_bottom_right( char borderStyle) { m_border_bottom_right = borderStyle; }
char border_left() const { return m_border_left; }
void border_left( char borderStyle ) { m_border_left = borderStyle; }
char border_left_mid() const { return m_border_left_mid; }
void border_left_mid( char borderStyle ) { m_border_left_mid = borderStyle; }
char border_mid() const { return m_border_mid; }
void border_mid( char borderStyle ) { m_border_mid = borderStyle; }
char border_mid_mid() const { return m_border_mid_mid; }
void border_mid_mid( char borderStyle ) { m_border_mid_mid = borderStyle; }
char border_right() const { return m_border_right; }
void border_right( char borderStyle ) { m_border_right = borderStyle; }
char border_right_mid() const { return m_border_right_mid; }
void border_right_mid( char borderStyle ) { m_border_right_mid = borderStyle; }
char border_middle() const { return m_border_middle; }
void border_middle( char borderStyle ) { m_border_middle = borderStyle; }
integer padding_left() const { return m_padding_left; }
void padding_left( integer padding ) { m_padding_left = padding; }
integer padding_right() const { return m_padding_right; }
void padding_right( integer padding ) { m_padding_right = padding; }
Alignment alignment() const { return m_Align; }
void alignment( Alignment align ) { m_Align = align; }
integer width() const { return m_Width; }
void width( integer width ) { m_Width = width; }
};
class Cell {
private:
Table * m_Table = nullptr;
std::string m_Value = "";
Alignment m_Align = Alignment::LEFT;
integer m_col_span = 1;
integer m_Width = 0;
public:
Cell() = default;
explicit
Cell(
Table* table,
std::string const & val = "",
integer col_span = 1
);
std::string const & value() const { return m_Value; }
void value( std::string const & val ) { m_Value = val; }
Alignment alignment() const { return m_Align; }
void alignment( Alignment align ) { m_Align = align; }
integer col_span() const { return m_col_span; }
void col_span( integer col_span ) { m_col_span = col_span; }
integer width( integer col ) const;
integer height() const;
integer maximum_line_width() const;
std::string line( integer idx ) const;
void trim_line( std::string & line ) const;
std::string render( integer line, integer col ) const;
};
class Row {
protected:
typedef std::vector<Cell> vecCell;
typedef std::vector<std::string> vecstr;
Table * m_Table = nullptr;
vecCell m_Cells;
public:
Row() = default;
explicit
Row(
Table * table,
vecstr const & cells = vecstr()
);
Table const * table() const { return m_Table; }
//vecCell & cells() { return m_Cells; }
void cells( vecstr const & cells );
integer num_cells() const { return integer(m_Cells.size()); }
integer cell_width( integer idx ) const;
void cell_col_span( integer idx, integer span );
void cell( std::string const & value );
//Cell& cell( integer idx ) { return m_Cells[idx]; }
Cell const & operator [] ( integer idx ) const { return m_Cells[idx]; }
Cell & operator [] ( integer idx ) { return m_Cells[idx]; }
integer height() const;
std::string render() const;
};
class Table {
public:
typedef std::vector<Row> vecRow;
typedef std::vector<Cell> vecCell;
typedef std::vector<string> vecstr;
typedef std::vector<vecstr> vecvecstr;
typedef int integer;
private:
Style m_Style;
std::string m_Title;
Row m_Headings;
vecRow m_Rows;
public:
Table() = default;
explicit
Table(
Style const & style,
vecvecstr const & rows = vecvecstr()
)
: m_Style(style) {
this->rows(rows);
}
void
setup(
Style const & style,
vecvecstr const & rows = vecvecstr()
) {
m_Style = style;
this->rows(rows);
}
void align_column( integer n, Alignment align );
void add_row( vecstr const & row );
integer cell_spacing() const;
integer cell_padding() const;
vecCell column( integer n ) const;
integer column_width( integer n ) const;
integer num_columns() const;
Style const & style() const { return m_Style; }
void style( Style const & style ) { m_Style = style; }
std::string const & title() const { return m_Title; }
void title( std::string const & title ) { m_Title = title; }
Row const & headings() const { return m_Headings; }
void headings( vecstr const & headings );
Row & row( integer n );
Row const & row( integer n ) const;
Row & operator [] ( integer n ) { return this->row(n); }
Row const & operator [] ( integer n ) const { return this->row(n); }
Cell & operator () ( integer i, integer j ) { return (*this)[i][j]; }
Cell const & operator () ( integer i, integer j ) const { return (*this)[i][j]; }
vecRow const & rows() const { return m_Rows; }
void rows( vecvecstr const & rows );
std::string
render_separator(
char left,
char mid,
char right,
char sep
) const;
std::string render() const;
};
}
}
inline
Utils::ostream_type&
operator << ( Utils::ostream_type& stream, Utils::Table::Row const & row ) {
return stream << row.render();
}
inline
Utils::ostream_type&
operator << ( Utils::ostream_type& stream, Utils::Table::Table const & table ) {
return stream << table.render();
}
///
/// eof: Table.hxx
///
| 31.318043
| 90
| 0.545357
|
ebertolazzi
|
0a2ed7375825eafbffc9a933d77cf1f6cfc96180
| 685
|
cpp
|
C++
|
src/QtYangVrRecord/src/video/yangrecordwin.cpp
|
yangxinghai/yangrecord
|
787eaca132df1e427f5fc5b4391db1436d481088
|
[
"MIT"
] | 1
|
2021-11-11T02:06:55.000Z
|
2021-11-11T02:06:55.000Z
|
src/QtYangVrRecord/src/video/yangrecordwin.cpp
|
yangxinghai/yangrecord
|
787eaca132df1e427f5fc5b4391db1436d481088
|
[
"MIT"
] | null | null | null |
src/QtYangVrRecord/src/video/yangrecordwin.cpp
|
yangxinghai/yangrecord
|
787eaca132df1e427f5fc5b4391db1436d481088
|
[
"MIT"
] | 1
|
2022-01-24T07:59:48.000Z
|
2022-01-24T07:59:48.000Z
|
#include "yangrecordwin.h"
#include "yangutil/yangtype.h"
#include <QMenu>
#include <QAction>
#include <QDebug>
//#include "../tooltip/RDesktopTip.h"
#include "../yangwinutil/yangrecordcontext.h"
YangRecordWin::YangRecordWin(QWidget *parent):QWidget(parent)
{
m_hb=new QHBoxLayout();
m_hb->setMargin(0);
m_hb->setSpacing(1);
setLayout(m_hb);
this->setAutoFillBackground(true);
//m_selectUser=nullptr;
vwin=nullptr;
//this->setWidget(m_centerWdiget);
}
YangRecordWin::~YangRecordWin()
{
// m_mh=nullptr;
//m_selectUser=nullptr;
// if(1) return;
YANG_DELETE(vwin);
YANG_DELETE(m_hb);
}
void YangRecordWin::init(){
}
| 15.222222
| 61
| 0.671533
|
yangxinghai
|
0a2f8e4a67a74949a182496fb002fdf38f79a3e7
| 5,912
|
cpp
|
C++
|
Sources/CEigenBridge/eigen_dbl.cpp
|
taketo1024/swm-eigen
|
952ecdb73a2739641e75909c8d9e724e32b2ed0f
|
[
"MIT"
] | 6
|
2021-09-19T07:55:41.000Z
|
2021-11-10T00:43:47.000Z
|
Sources/CEigenBridge/eigen_dbl.cpp
|
taketo1024/swm-eigen
|
952ecdb73a2739641e75909c8d9e724e32b2ed0f
|
[
"MIT"
] | null | null | null |
Sources/CEigenBridge/eigen_dbl.cpp
|
taketo1024/swm-eigen
|
952ecdb73a2739641e75909c8d9e724e32b2ed0f
|
[
"MIT"
] | null | null | null |
//
// File.cpp
//
//
// Created by Taketo Sano on 2021/06/10.
//
#import "eigen_dbl.h"
#import <iostream>
#import <Eigen/Eigen>
using namespace std;
using namespace Eigen;
using R = double;
using Mat = Matrix<R, Dynamic, Dynamic>;
void *eigen_dbl_init(int_t rows, int_t cols) {
Mat *A = new Mat(rows, cols);
A->setZero();
return static_cast<void *>(A);
}
void eigen_dbl_free(void *ptr) {
Mat *A = static_cast<Mat *>(ptr);
delete A;
}
void eigen_dbl_copy(void *from, void *to) {
Mat *A = static_cast<Mat *>(from);
Mat *B = static_cast<Mat *>(to);
*B = *A;
}
double eigen_dbl_get_entry(void *a, int_t i, int_t j) {
Mat *A = static_cast<Mat *>(a);
return A->coeff(i, j);
}
void eigen_dbl_set_entry(void *a, int_t i, int_t j, double r) {
Mat *A = static_cast<Mat *>(a);
A->coeffRef(i, j) = r;
}
void eigen_dbl_copy_entries(void *a, double *vals) {
Mat *A = static_cast<Mat *>(a);
for(int_t i = 0; i < A->rows(); i++) {
for(int_t j = 0; j < A->cols(); j++) {
*(vals++) = A->coeff(i, j);
}
}
}
int_t eigen_dbl_rows(void *a) {
Mat *A = static_cast<Mat *>(a);
return A->rows();
}
int_t eigen_dbl_cols(void *a) {
Mat *A = static_cast<Mat *>(a);
return A->cols();
}
bool eigen_dbl_is_zero(void *a) {
Mat *A = static_cast<Mat *>(a);
return A->isZero();
}
double eigen_dbl_det(void *a) {
Mat *A = static_cast<Mat *>(a);
return A->determinant();
}
double eigen_dbl_trace(void *a) {
Mat *A = static_cast<Mat *>(a);
return A->trace();
}
void eigen_dbl_inv(void *a, void *b) {
Mat *A = static_cast<Mat *>(a);
Mat *B = static_cast<Mat *>(b);
*B = A->inverse();
}
void eigen_dbl_transpose(void *a, void *b) {
Mat *A = static_cast<Mat *>(a);
Mat *B = static_cast<Mat *>(b);
*B = A->transpose();
}
void eigen_dbl_submatrix(void *a, int_t i, int_t j, int_t h, int_t w, void *b) {
Mat *A = static_cast<Mat *>(a);
Mat *B = static_cast<Mat *>(b);
*B = A->block(i, j, h, w);
}
void eigen_dbl_concat(void *a, void *b, void *c) {
Mat *A = static_cast<Mat *>(a);
Mat *B = static_cast<Mat *>(b);
Mat *C = static_cast<Mat *>(c);
C->leftCols(A->cols()) = *A;
C->rightCols(B->cols()) = *B;
}
void eigen_dbl_stack(void *a, void *b, void *c) {
Mat *A = static_cast<Mat *>(a);
Mat *B = static_cast<Mat *>(b);
Mat *C = static_cast<Mat *>(c);
C->topRows(A->rows()) = *A;
C->bottomRows(B->rows()) = *B;
}
void eigen_dbl_perm_rows(void *a, perm_t p, void *b) {
Mat *A = static_cast<Mat *>(a);
Mat *B = static_cast<Mat *>(b);
Eigen::VectorXi indices(p.length);
for(int_t i = 0; i < p.length; ++i) {
indices[i] = p.indices[i];
}
PermutationMatrix<Eigen::Dynamic> P(indices);
*B = P * (*A);
}
void eigen_dbl_perm_cols(void *a, perm_t p, void *b) {
Mat *A = static_cast<Mat *>(a);
Mat *B = static_cast<Mat *>(b);
Eigen::VectorXi indices(p.length);
for(int_t i = 0; i < p.length; ++i) {
indices[i] = p.indices[i];
}
PermutationMatrix<Eigen::Dynamic> P(indices);
*B = (*A) * P.transpose();
}
bool eigen_dbl_eq(void *a, void *b) {
Mat *A = static_cast<Mat *>(a);
Mat *B = static_cast<Mat *>(b);
return (*A).isApprox(*B);
}
void eigen_dbl_add(void *a, void *b, void *c) {
Mat *A = static_cast<Mat *>(a);
Mat *B = static_cast<Mat *>(b);
Mat *C = static_cast<Mat *>(c);
*C = *A + *B;
}
void eigen_dbl_neg(void *a, void *b) {
Mat *A = static_cast<Mat *>(a);
Mat *B = static_cast<Mat *>(b);
*B = -(*A);
}
void eigen_dbl_minus(void *a, void *b, void *c) {
Mat *A = static_cast<Mat *>(a);
Mat *B = static_cast<Mat *>(b);
Mat *C = static_cast<Mat *>(c);
*C = *A - *B;
}
void eigen_dbl_mul(void *a, void *b, void *c) {
Mat *A = static_cast<Mat *>(a);
Mat *B = static_cast<Mat *>(b);
Mat *C = static_cast<Mat *>(c);
*C = (*A) * (*B);
}
void eigen_dbl_scal_mul(double r, void *a, void *b) {
Mat *A = static_cast<Mat *>(a);
Mat *B = static_cast<Mat *>(b);
*B = r * (*A);
}
void eigen_dbl_lu(void *a, perm_t p, perm_t q, void *l, void *u) {
Mat *A = static_cast<Mat *>(a);
Mat *L = static_cast<Mat *>(l);
Mat *U = static_cast<Mat *>(u);
int_t n = A->rows();
int_t m = A->cols();
if(n == 0 || m == 0) {
L->resize(n, 0);
U->resize(0, m);
} else {
using LU = FullPivLU<Mat>;
LU lu(*A);
int_t r = lu.rank();
// make P
LU::PermutationPType::IndicesType P = lu.permutationP().indices();
for(int_t i = 0; i < n; ++i) {
p.indices[i] = P[i];
}
// make Q
LU::PermutationQType::IndicesType Q = lu.permutationQ().indices();
for(int_t i = 0; i < m; ++i) {
q.indices[i] = Q[i];
}
// make L
L->resize(n, r);
L->setIdentity();
L->triangularView<StrictlyLower>() = lu.matrixLU().block(0, 0, n, r);
// make U
U->resize(r, m);
U->triangularView<Upper>() = lu.matrixLU().block(0, 0, r, m);
}
}
void eigen_dbl_solve_lt(void *l, void *b, void *x) {
Mat *L = static_cast<Mat *>(l);
Mat *B = static_cast<Mat *>(b);
Mat *X = static_cast<Mat *>(x);
using DMat = Matrix<R, Dynamic, Dynamic>;
DMat b_ = *B;
DMat x_ = L->triangularView<Lower>().solve(b_);
*X = x_.sparseView();
}
void eigen_dbl_solve_ut(void *u, void *b, void *x) {
Mat *U = static_cast<Mat *>(u);
Mat *B = static_cast<Mat *>(b);
Mat *X = static_cast<Mat *>(x);
using DMat = Matrix<R, Dynamic, Dynamic>;
DMat b_ = *B;
DMat x_ = U->triangularView<Upper>().solve(b_);
*X = x_.sparseView();
}
void eigen_dbl_dump(void *ptr) {
Mat *m = static_cast<Mat *>(ptr);
cout << *m << endl;
}
| 24.03252
| 80
| 0.538058
|
taketo1024
|
0a30f745e13504ad1b5ed62319ce67bdfb9ab3f3
| 7,152
|
inl
|
C++
|
MathLib/Include/CoordinatePoints.inl
|
bgin/MissileSimulation
|
90adcbf1c049daafb939f3fe9f9dfe792f26d5df
|
[
"MIT"
] | 23
|
2016-08-28T23:20:12.000Z
|
2021-12-15T14:43:58.000Z
|
MathLib/Include/CoordinatePoints.inl
|
bgin/MissileSimulation
|
90adcbf1c049daafb939f3fe9f9dfe792f26d5df
|
[
"MIT"
] | 1
|
2018-06-02T21:29:51.000Z
|
2018-06-05T05:59:31.000Z
|
MathLib/Include/CoordinatePoints.inl
|
bgin/MissileSimulation
|
90adcbf1c049daafb939f3fe9f9dfe792f26d5df
|
[
"MIT"
] | 1
|
2019-07-04T22:38:22.000Z
|
2019-07-04T22:38:22.000Z
|
mathlib::CoordPoints<__m128>::CoordPoints() {
/*Initialize coordinates to zero*/
this->m_F32Coord3D = _mm_setzero_ps();
}
mathlib::CoordPoints<__m128>::CoordPoints(_In_ const float x, _In_ const float y, _In_ const float z) :
m_F32Coord3D(_mm_set_ps(NAN_FLT, z, y, x)) {
}
mathlib::CoordPoints<__m128>::CoordPoints(_In_ const float s) :
m_F32Coord3D(_mm_set_ps(NAN_FLT, s, s, s)) {
}
mathlib::CoordPoints<__m128>::CoordPoints(_In_ const double x, _In_ const double y, _In_ const double z) :
/* Warning: Precion is lost from ~16 digits to ~8*/
m_F32Coord3D(_mm256_cvtpd_ps(_mm256_set_pd(NAN_DBL, z, y, x))) {
}
mathlib::CoordPoints<__m128>::CoordPoints(_In_ float(&ar)[4]) :
m_F32Coord3D(_mm_loadu_ps(&ar[0])) {
}
mathlib::CoordPoints<__m128>::CoordPoints(_In_ const std::initializer_list<float> &list) :
m_F32Coord3D(_mm_loadu_ps(&list.begin()[0])){
}
mathlib::CoordPoints<__m128>::CoordPoints(_In_ const __m128 &v) :
m_F32Coord3D(v) {
}
mathlib::CoordPoints<__m128>::CoordPoints(_In_ const CoordPoints &rhs) :
m_F32Coord3D(rhs.m_F32Coord3D){
}
mathlib::CoordPoints<__m128>::CoordPoints(_In_ CoordPoints &&rhs) :
m_F32Coord3D(std::move(rhs.m_F32Coord3D)) {
}
auto mathlib::CoordPoints<__m128>::operator=(_In_ const CoordPoints &rhs)->mathlib::CoordPoints<__m128> &{
if (this == &rhs) return (*this);
this->m_F32Coord3D = rhs.m_F32Coord3D;
return (*this);
}
auto mathlib::CoordPoints<__m128>::operator=(_In_ const CoordPoints &&rhs)->mathlib::CoordPoints<__m128> & {
if (this == &rhs) return (*this);
this->m_F32Coord3D = std::move(rhs.m_F32Coord3D);
return (*this);
}
auto mathlib::CoordPoints<__m128>::operator+=(_In_ const CoordPoints &rhs)->mathlib::CoordPoints<__m128> & {
this->m_F32Coord3D = _mm_add_ps(this->m_F32Coord3D, rhs.m_F32Coord3D);
return (*this);
}
auto mathlib::CoordPoints<__m128>::operator+=(_In_ const float s)->mathlib::CoordPoints<__m128> & {
this->m_F32Coord3D = _mm_add_ps(this->m_F32Coord3D,_mm_set_ps(NAN_FLT, s, s, s));
return (*this);
}
auto mathlib::CoordPoints<__m128>::operator-=(_In_ const CoordPoints &rhs)->mathlib::CoordPoints<__m128> & {
this->m_F32Coord3D = _mm_sub_ps(this->m_F32Coord3D, rhs.m_F32Coord3D);
return (*this);
}
auto mathlib::CoordPoints<__m128>::operator-=(_In_ const float s)->mathlib::CoordPoints<__m128> & {
this->m_F32Coord3D = _mm_sub_ps(this->m_F32Coord3D, _mm_set_ps(NAN_FLT, s, s, s));
return (*this);
}
auto mathlib::CoordPoints<__m128>::operator*=(_In_ const CoordPoints &rhs)->mathlib::CoordPoints<__m128> & {
this->m_F32Coord3D = _mm_mul_ps(this->m_F32Coord3D, rhs.m_F32Coord3D);
return (*this);
}
auto mathlib::CoordPoints<__m128>::operator*=(_In_ const float s)->mathlib::CoordPoints<__m128> & {
this->m_F32Coord3D = _mm_mul_ps(this->m_F32Coord3D, _mm_set_ps(NAN_FLT, s, s, s));
return (*this);
}
auto mathlib::CoordPoints<__m128>::operator/=(_In_ const CoordPoints &rhs)->mathlib::CoordPoints<__m128> & {
if (!(_mm_testz_ps(rhs.m_F32Coord3D, _mm_set_ps(NAN_FLT, 0.f, 0.f, 0.f)))){
this->m_F32Coord3D = _mm_mul_ps(this->m_F32Coord3D, _mm_rcp_ps(rhs.m_F32Coord3D));
return (*this);
}
}
auto mathlib::CoordPoints<__m128>::operator/=(_In_ const float s)->mathlib::CoordPoints<__m128> & {
if (s != 0.f){
float inv_s{ 1.f / s };
this->m_F32Coord3D = _mm_mul_ps(this->m_F32Coord3D, _mm_set_ps(NAN_FLT, inv_s, inv_s, inv_s));
return (*this);
}
}
auto mathlib::CoordPoints<__m128>::operator==(_In_ const CoordPoints &rhs)const-> __m128 {
return (_mm_cmpeq_ps(this->m_F32Coord3D, rhs.m_F32Coord3D));
}
auto mathlib::CoordPoints<__m128>::operator==(_In_ const float s)const-> __m128 {
// 3rd scalar counting from 0 = Don't care
return (_mm_cmpeq_ps(this->m_F32Coord3D, _mm_set_ps(NAN_FLT, s, s, s)));
}
auto mathlib::CoordPoints<__m128>::operator!=(_In_ const CoordPoints &rhs)const-> __m128 {
return (_mm_cmpneq_ps(this->m_F32Coord3D, rhs.m_F32Coord3D));
}
auto mathlib::CoordPoints<__m128>::operator!=(_In_ const float s)const-> __m128 {
// 3rd scalar counting from 0 = Don't care
return (_mm_cmpneq_ps(this->m_F32Coord3D, _mm_set_ps(NAN_FLT, s, s, s)));
}
mathlib::CoordPoints<__m128>::operator __m128 () {
return this->m_F32Coord3D;
}
mathlib::CoordPoints<__m128>::operator __m128 const () const {
return this->m_F32Coord3D;
}
auto mathlib::operator<<(_In_ std::ostream &os, _In_ const mathlib::CoordPoints<__m128> &rhs)->std::ostream & {
os << "X: " << reinterpret_cast<const double*>(&rhs.m_F32Coord3D)[0] << std::endl;
os << "Y: " << reinterpret_cast<const double*>(&rhs.m_F32Coord3D)[1] << std::endl;
os << "Z: " << reinterpret_cast<const double*>(&rhs.m_F32Coord3D)[2] << std::endl;
return os;
}
inline auto mathlib::CoordPoints<__m128>::getF32Coord3D()const-> __m128 {
return this->m_F32Coord3D;
}
inline auto mathlib::CoordPoints<__m128>::X()const->float {
return (reinterpret_cast<const double*>(&this->m_F32Coord3D)[0]);
}
inline auto mathlib::CoordPoints<__m128>::Y()const->float {
return (reinterpret_cast<const double*>(&this->m_F32Coord3D)[1]);
}
inline auto mathlib::CoordPoints<__m128>::Z()const->float {
return (reinterpret_cast<const double*>(&this->m_F32Coord3D)[2]);
}
inline auto mathlib::CoordPoints<__m128>::CArray()->double * {
double* pF32Coord3D = nullptr;
pF32Coord3D = reinterpret_cast<double*>(&this->m_F32Coord3D);
return (pF32Coord3D);
}
inline auto mathlib::CoordPoints<__m128>::CArray()const->const double * {
const double* pF32Coord3D = nullptr;
pF32Coord3D = reinterpret_cast<const double*>(&this->m_F32Coord3D);
return (pF32Coord3D);
}
inline auto mathlib::CoordPoints<__m128>::setX(_In_ const float s)->void {
this->m_F32Coord3D.m128_f32[0] = s;
}
inline auto mathlib::CoordPoints<__m128>::setY(_In_ const float s)->void {
this->m_F32Coord3D.m128_f32[1] = s;
}
inline auto mathlib::CoordPoints<__m128>::setZ(_In_ const float s)->void {
this->m_F32Coord3D.m128_f32[2] = s;
}
inline auto mathlib::CoordPoints<__m128>::magnitude()const->float {
auto temp(_mm_mul_ps(this->m_F32Coord3D, this->m_F32Coord3D));
return (reinterpret_cast<const double*>(&temp)[0] +
reinterpret_cast<const double*>(&temp)[1] +
reinterpret_cast<const double*>(&temp)[2]);
}
inline auto mathlib::CoordPoints<__m128>::perpendicular()const->float {
auto temp(_mm_mul_ps(this->m_F32Coord3D, this->m_F32Coord3D));
return (reinterpret_cast<const double*>(&temp)[0] + reinterpret_cast<const double*>(&temp)[1]);
}
inline auto mathlib::CoordPoints<__m128>::rho()const->float {
return (std::sqrt(this->perpendicular()));
}
inline auto mathlib::CoordPoints<__m128>::phi()const->float {
return((this->X() == 0.f && this->Y() == 0.f) ? 0.f : std::atan2(this->X(), this->Y()));
}
inline auto mathlib::CoordPoints<__m128>::theta()const->float {
return ((this->X() == 0.f && this->Y() == 0.f && this->Z()) ? 0.f : std::atan2(this->rho(), this->Z()));
}
| 31.646018
| 115
| 0.685263
|
bgin
|
0a37e91c00ea720fe4fc3942d74ef52cc8dae67b
| 3,082
|
cpp
|
C++
|
old.c++/AGIResources/PlatformAbstractionLayer_POSIX.cpp
|
princess-rosella/sierra-agi-resources
|
2755e7b04a4f9782ced4530016e4374ca5b7985b
|
[
"MIT"
] | null | null | null |
old.c++/AGIResources/PlatformAbstractionLayer_POSIX.cpp
|
princess-rosella/sierra-agi-resources
|
2755e7b04a4f9782ced4530016e4374ca5b7985b
|
[
"MIT"
] | null | null | null |
old.c++/AGIResources/PlatformAbstractionLayer_POSIX.cpp
|
princess-rosella/sierra-agi-resources
|
2755e7b04a4f9782ced4530016e4374ca5b7985b
|
[
"MIT"
] | null | null | null |
//
// PlatformAbstractionLayer_POSIX.cpp
// AGI
//
// Copyright (c) 2018 Princess Rosella. All rights reserved.
//
#include "AGIResources.hpp"
#include "PlatformAbstractionLayer_POSIX.hpp"
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
#include <vector>
using namespace AGI::Resources;
PlatformAbstractionLayer_POSIX_FileDescriptor::PlatformAbstractionLayer_POSIX_FileDescriptor(int desc) : _desc(desc) {
}
PlatformAbstractionLayer_POSIX_FileDescriptor::~PlatformAbstractionLayer_POSIX_FileDescriptor() {
if (_desc >= 0)
close(_desc);
}
ssize_t PlatformAbstractionLayer_POSIX_FileDescriptor::readall(void* data, size_t length) {
ssize_t readed = 0;
while (length) {
ssize_t thisRead = read(_desc, data, length);
if (thisRead < 0)
return thisRead;
else if (thisRead == 0)
break;
data = ((uint8_t*)data) + thisRead;
length -= thisRead;
}
if (length)
memset(data, 0, length);
return readed;
}
PlatformAbstractionLayer_POSIX::PlatformAbstractionLayer_POSIX(const std::string& folder) : _folder(folder) {
if (_folder.length() == 0) {
_folder = "./";
return;
}
if (_folder[_folder.length() - 1] == '/')
return;
_folder += '/';
}
std::string PlatformAbstractionLayer_POSIX::fullPathName(const char* fileName) const {
return _folder + fileName;
}
bool PlatformAbstractionLayer_POSIX::fileExists(const char* fileName) const {
if (access(fullPathName(fileName).c_str(), R_OK))
return false;
return true;
}
size_t PlatformAbstractionLayer_POSIX::fileSize(const char* fileName) const {
struct stat st;
if (stat(fullPathName(fileName).c_str(), &st))
return (size_t)-1u;
return (size_t)st.st_size;
}
bool PlatformAbstractionLayer_POSIX::fileRead(const char* fileName, size_t offset, void* data, size_t length) const {
std::unique_ptr<PlatformAbstractionLayer_POSIX_FileDescriptor> fd(new PlatformAbstractionLayer_POSIX_FileDescriptor(open(fullPathName(fileName).c_str(), O_RDONLY)));
if (offset) {
if (lseek(fd->desc(), offset, SEEK_SET) == -1)
throw std::runtime_error(strerror(errno));
}
if (fd->readall(data, length) < 0)
throw std::runtime_error(strerror(errno));
return true;
}
std::vector<std::string> PlatformAbstractionLayer_POSIX::fileList() const {
DIR *dir = opendir(_folder.c_str());
if (!dir)
return std::vector<std::string>();
std::vector<std::string> files;
while (struct dirent *entry = readdir(dir)) {
std::string name(entry->d_name, entry->d_namlen);
if (name == "." || name == ".." || name[0] == '.')
continue;
files.push_back(name);
}
closedir(dir);
return files;
}
std::string AGI::Resources::format(const char* format, ...) {
va_list va;
char buffer[2048];
va_start(va, format);
vsnprintf(buffer, sizeof(buffer), format, va);
va_end(va);
return buffer;
}
| 24.854839
| 169
| 0.658014
|
princess-rosella
|
0a3c83602b58e93c47389718b0ec4248917f4c0e
| 3,644
|
cpp
|
C++
|
PitchedDelay/Source/dsp/simpledetune.cpp
|
elk-audio/lkjb-plugins
|
8cbff01864bdb76493361a46f56d7073d49698da
|
[
"MIT"
] | 82
|
2016-12-02T20:02:30.000Z
|
2022-03-12T22:38:30.000Z
|
PitchedDelay/Source/dsp/simpledetune.cpp
|
elk-audio/lkjb-plugins
|
8cbff01864bdb76493361a46f56d7073d49698da
|
[
"MIT"
] | 6
|
2018-01-19T21:44:46.000Z
|
2022-03-08T08:46:19.000Z
|
PitchedDelay/Source/dsp/simpledetune.cpp
|
elk-audio/lkjb-plugins
|
8cbff01864bdb76493361a46f56d7073d49698da
|
[
"MIT"
] | 16
|
2016-04-13T08:31:36.000Z
|
2022-03-01T03:04:42.000Z
|
#include "simpledetune.h"
DetunerBase::DetunerBase(int bufmax)
: bufMax(bufmax),
windowSize(0),
sampleRate(44100),
buf(bufMax),
win(bufMax)
{
clear();
setWindowSize(bufMax);
}
void DetunerBase::clear()
{
pos0 = 0;
pos1 = 0.f;
pos2 = 0.f;
for(int i=0;i<bufMax;i++)
buf[i] = 0;
}
void DetunerBase::setWindowSize(int size, bool force)
{
//recalculate crossfade window
if (windowSize != size || force)
{
windowSize = size;
if (windowSize >= bufMax)
windowSize = bufMax;
//bufres = 1000.0f * (float)windowSize / sampleRate;
double p=0.0;
double dp = 6.28318530718 / windowSize;
for(int i=0;i<windowSize;i++)
{
win[i] = (float)(0.5 - 0.5 * cos(p));
p+=dp;
}
}
}
void DetunerBase::setPitchSemitones(float newPitch)
{
dpos2 = (float)pow(1.0594631f, newPitch);
dpos1 = 1.0f / dpos2;
}
void DetunerBase::setPitch(float newPitch)
{
dpos2 = newPitch;
dpos1 = 1.0f / dpos2;
}
void DetunerBase::setSampleRate(float newSampleRate)
{
if (sampleRate != newSampleRate)
{
sampleRate = newSampleRate;
setWindowSize(windowSize, true);
}
}
void DetunerBase::processBlock(float* data, int numSamples)
{
float a, b, c, d;
float x;
float p1 = pos1;
float p1f;
float d1 = dpos1;
float p2 = pos2;
float d2 = dpos2;
int p0 = pos0;
int p1i;
int p2i;
int l = windowSize-1;
int lh = windowSize>>1;
float lf = (float) windowSize;
for (int i=0; i<numSamples; ++i)
{
a = data[i];
b = a;
c = 0;
d = 0;
--p0 &= l;
*(buf + p0) = (a); //input
p1 -= d1;
if(p1<0.0f)
p1 += lf; //output
p1i = (int) p1;
p1f = p1 - (float) p1i;
a = *(buf + p1i);
++p1i &= l;
a += p1f * (*(buf + p1i) - a); //linear interpolation
p2i = (p1i + lh) & l; //180-degree ouptut
b = *(buf + p2i);
++p2i &= l;
b += p1f * (*(buf + p2i) - b); //linear interpolation
p2i = (p1i - p0) & l; //crossfade
x = *(win + p2i);
//++p2i &= l;
//x += p1f * (*(win + p2i) - x); //linear interpolation (doesn't do much)
c += b + x * (a - b);
p2 -= d2; //repeat for downwards shift - can't see a more efficient way?
if(p2<0.0f) p2 += lf; //output
p1i = (int) p2;
p1f = p2 - (float) p1i;
a = *(buf + p1i);
++p1i &= l;
a += p1f * (*(buf + p1i) - a); //linear interpolation
p2i = (p1i + lh) & l; //180-degree ouptut
b = *(buf + p2i);
++p2i &= l;
b += p1f * (*(buf + p2i) - b); //linear interpolation
p2i = (p1i - p0) & l; //crossfade
x = *(win + p2i);
//++p2i &= l;
//x += p1f * (*(win + p2i) - x); //linear interpolation (doesn't do much)
d += b + x * (a - b);
data[i] = d;
}
pos0=p0;
pos1=p1;
pos2=p2;
}
int DetunerBase::getWindowSize()
{
return windowSize;
}
// ==============================================================================================================
Detune::Detune(const String& name_, int windowSize)
: name(name_),
tunerL(windowSize),
tunerR(windowSize)
{
}
void Detune::prepareToPlay(double sampleRate, int /*blockSize*/)
{
tunerL.setSampleRate((float) sampleRate);
tunerR.setSampleRate((float) sampleRate);
}
void Detune::processBlock(float* chL, float* chR, int numSamples)
{
tunerL.processBlock(chL, numSamples);
tunerR.processBlock(chR, numSamples);
}
void Detune::processBlock(float* ch, int numSamples)
{
tunerL.processBlock(ch, numSamples);
}
void Detune::setPitch(float newPitch)
{
tunerL.setPitch(newPitch);
tunerR.setPitch(newPitch);
}
int Detune::getLatency()
{
return tunerL.getWindowSize();
}
void Detune::clear()
{
tunerL.clear();
tunerR.clear();
}
String Detune::getName()
{
return name;
}
| 18.591837
| 113
| 0.572448
|
elk-audio
|
0a3e70e44718dea8c998736ac815ba9c233a23c2
| 1,261
|
cc
|
C++
|
src/flow/transform/EmptyBlockElimination.cc
|
christianparpart/libflow
|
29c8a4b4c1ba140c1a3998dcb84885386d312787
|
[
"Unlicense"
] | null | null | null |
src/flow/transform/EmptyBlockElimination.cc
|
christianparpart/libflow
|
29c8a4b4c1ba140c1a3998dcb84885386d312787
|
[
"Unlicense"
] | null | null | null |
src/flow/transform/EmptyBlockElimination.cc
|
christianparpart/libflow
|
29c8a4b4c1ba140c1a3998dcb84885386d312787
|
[
"Unlicense"
] | null | null | null |
// This file is part of the "x0" project, http://github.com/christianparpart/libflow//
// (c) 2009-2014 Christian Parpart <trapni@gmail.com>
//
// Licensed under the MIT License (the "License"); you may not use this
// file except in compliance with the License. You may obtain a copy of
// the License at: http://opensource.org/licenses/MIT
#include <flow/transform/EmptyBlockElimination.h>
#include <flow/ir/BasicBlock.h>
#include <flow/ir/IRHandler.h>
#include <flow/ir/Instructions.h>
#include <list>
namespace flow {
bool EmptyBlockElimination::run(IRHandler* handler) {
std::list<BasicBlock*> eliminated;
for (BasicBlock* bb : handler->basicBlocks()) {
if (bb->instructions().size() != 1) continue;
if (BrInstr* br = dynamic_cast<BrInstr*>(bb->getTerminator())) {
BasicBlock* newSuccessor = br->targetBlock();
eliminated.push_back(bb);
if (bb == handler->getEntryBlock()) {
handler->setEntryBlock(bb);
break;
} else {
for (BasicBlock* pred : bb->predecessors()) {
pred->getTerminator()->replaceOperand(bb, newSuccessor);
}
}
}
}
for (BasicBlock* bb : eliminated) {
bb->parent()->erase(bb);
}
return eliminated.size() > 0;
}
} // namespace flow
| 28.659091
| 86
| 0.656622
|
christianparpart
|
0a4602ec6f7a003112d67433dac9b55f964d6207
| 17,254
|
cpp
|
C++
|
src/Microsoft.DotNet.Wpf/src/WpfGfx/core/common/exports.cpp
|
nsivov/wpf
|
d36941860f05dd7a09008e99d1bcd635b0a69fdb
|
[
"MIT"
] | 2
|
2020-05-18T17:00:43.000Z
|
2021-12-01T10:00:29.000Z
|
src/Microsoft.DotNet.Wpf/src/WpfGfx/core/common/exports.cpp
|
nsivov/wpf
|
d36941860f05dd7a09008e99d1bcd635b0a69fdb
|
[
"MIT"
] | 5
|
2020-05-05T08:05:01.000Z
|
2021-12-11T21:35:37.000Z
|
src/Microsoft.DotNet.Wpf/src/WpfGfx/core/common/exports.cpp
|
nsivov/wpf
|
d36941860f05dd7a09008e99d1bcd635b0a69fdb
|
[
"MIT"
] | 4
|
2020-05-04T06:43:25.000Z
|
2022-02-20T12:02:50.000Z
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//------------------------------------------------------------------------------
//
//
//-------------------------------------------------------------------------
#include "precomp.hpp"
//+------------------------------------------------------------------------
//
// Function: MIL3DCalcProjected2DBounds
//
// Synopsis: Computes the 2D screen bounds of the CMilPointAndSize3F after
// projecting with the current 3D world, view, and projection
// transforms and clipping to the camera's Near and Far
// planes.
//
//-------------------------------------------------------------------------
extern "C"
HRESULT WINAPI
MIL3DCalcProjected2DBounds(
__in_ecount(1) const CMatrix<CoordinateSpace::Local3D,CoordinateSpace::PageInPixels> *pFullTransform3D,
__in_ecount(1) const CMilPointAndSize3F *pboxBounds,
__out_ecount(1) CRectF<CoordinateSpace::PageInPixels> *prcTargetRect
)
{
HRESULT hr = S_OK;
CFloatFPU oGuard;
if (pFullTransform3D == NULL || pboxBounds == NULL || prcTargetRect == NULL)
{
IFC(E_INVALIDARG);
}
CalcProjectedBounds(*pFullTransform3D, pboxBounds, prcTargetRect);
Cleanup:
RRETURN(hr);
}
//+-----------------------------------------------------------------------------
//
// Calculate a mask for the number of "bits to mask" at a "bit offset" from
// the left (high-order bit) of a single byte.
//
// Consider this example:
//
// bitOffset=3
// bitsToMask=3
//
// In memory, this is laid out as:
//
// -------------------------------------------------
// | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
// -------------------------------------------------
// <--- bitOffset --->
// <-- bitsToMask -->
//
// The general algorithm is to start with 0xFF, shift to the right such that
// only bitsToMask number of bits are left on, and then shift back to the
// left to align with the requested bitOffset.
//
// The result will be:
//
// -------------------------------------------------
// | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 |
// -------------------------------------------------
//
//------------------------------------------------------------------------------
BYTE
GetOffsetMask(
__in_range(0, 7) UINT bitOffset,
__in_range(1, 8) UINT bitsToMask
)
{
Assert((bitOffset + bitsToMask) <= 8);
BYTE mask = 0xFF;
UINT maskShift = 8 - bitsToMask;
mask = static_cast<BYTE>(mask >> maskShift);
mask <<= (maskShift - bitOffset);
return mask;
}
//+-----------------------------------------------------------------------------
//
// Return the next byte (or partial byte) from the input buffer starting at the
// specified bit offset and containing no more than the specified remaining
// bits to copy. In the case of a partial byte, the results are left-aligned.
//
// Consider this example:
//
// inputBufferOffsetInBits=5
// bitsRemainingToCopy=4
//
// In memory, this is laid out as:
//
// ---------------------------------------------------------------
// | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 ...
// ---------------------------------------------------------------
// <-- inputBufferOffsetInBits -->
// <- bitsRemainingToCopy->
//
// The result will be a single byte containing the 3 lower bits of the first
// byte plus the 1 upper bit of the second byte.
//
//------------------------------------------------------------------------------
BYTE
GetNextByteFromInputBuffer(
__in_bcount(2) BYTE * pInputBuffer, // Some cases only require 1 byte...
__in_range(0, 7) UINT inputBufferOffsetInBits,
__in_range(1, UINT_MAX) UINT bitsRemainingToCopy
)
{
// bitsRemainingToCopy could be some huge number. We only care about the
// next byte's worth.
if (bitsRemainingToCopy > 8) bitsRemainingToCopy = 8;
if (inputBufferOffsetInBits == 0)
{
BYTE mask = GetOffsetMask(0, bitsRemainingToCopy);
return pInputBuffer[0] & mask;
}
BYTE nextByte = 0;
UINT bitsFromFirstByte = 8 - inputBufferOffsetInBits;
// Read from the first byte. The results are left-aligned.
BYTE mask = GetOffsetMask(inputBufferOffsetInBits, bitsFromFirstByte);
nextByte = pInputBuffer[0] & mask;
nextByte <<= inputBufferOffsetInBits;
bitsRemainingToCopy -= bitsFromFirstByte;
// Read from the second byte, if needed
if (bitsRemainingToCopy > 0)
{
// Note: bitsRemainingToCopy and bitsFromFirstByte are both small
// numbers, so addition is safe from overflow.
if (bitsRemainingToCopy + bitsFromFirstByte == 8)
{
// This is a common case where we are reading 8 bits of data
// straddled across a byte boundary. We can simply invert the
// mask from the first byte for the second byte.
mask = ~mask;
}
else
{
mask = GetOffsetMask(0, bitsRemainingToCopy);
}
nextByte |= static_cast<BYTE>(pInputBuffer[1] & mask) >> bitsFromFirstByte;
}
return nextByte;
}
//+-----------------------------------------------------------------------------
//
// Copies bytes and partial bytes from the input buffer to the output buffer.
// This function handles the case where the bit offsets are different for the
// input and output buffers.
//
//------------------------------------------------------------------------------
VOID
CopyUnalignedPixelBuffer(
__out_bcount(outputBufferSize) BYTE * pOutputBuffer,
__in_range(1, UINT_MAX) UINT outputBufferSize,
__in_range(1, UINT_MAX) UINT outputBufferStride,
__in_range(0, 7) UINT outputBufferOffsetInBits,
__in_bcount(inputBufferSize) BYTE * pInputBuffer,
__in_range(1, UINT_MAX) UINT inputBufferSize,
__in_range(1, UINT_MAX) UINT inputBufferStride,
__in_range(0, 7) UINT inputBufferOffsetInBits,
__in_range(1, UINT_MAX) UINT height,
__in_range(1, UINT_MAX) UINT copyWidthInBits
)
{
for (UINT row = 0; row < height; row++)
{
UINT bitsRemaining = copyWidthInBits;
BYTE * pInputPosition = pInputBuffer;
BYTE * pOutputPosition = pOutputBuffer;
while (bitsRemaining > 0)
{
BYTE nextByte = GetNextByteFromInputBuffer(
pInputPosition,
inputBufferOffsetInBits,
bitsRemaining);
if (bitsRemaining >= 8)
{
if (outputBufferOffsetInBits == 0)
{
// The output buffer is at a byte boundary, so we can just
// write the next byte.
pOutputPosition[0] = nextByte;
}
else
{
// The output buffer has a bit-offset, so the next byte
// will straddle two bytes.
UINT bitsCopiedToFirstByte = 8 - outputBufferOffsetInBits;
// Write to the first byte...
BYTE mask = GetOffsetMask(outputBufferOffsetInBits, bitsCopiedToFirstByte);
pOutputPosition[0] = (pOutputPosition[0] & ~mask) | (static_cast<BYTE>(nextByte >> outputBufferOffsetInBits) & mask);
// Write to the second byte...
pOutputPosition[1] = static_cast<BYTE>((pOutputPosition[1] & mask) | ((nextByte << bitsCopiedToFirstByte) & ~mask));
}
bitsRemaining -= 8;
}
else
{
// Note: by the time we get to this condition, both bitsRemaining and
// outputBufferOffsetInBits are both small numbers, making them safe
// from overflow.
UINT relativeOffsetOfLastBit = outputBufferOffsetInBits + bitsRemaining;
if (relativeOffsetOfLastBit <= 8)
{
// The remaining bits fit inside a single byte.
BYTE mask = GetOffsetMask(outputBufferOffsetInBits, bitsRemaining);
pOutputPosition[0] = (pOutputPosition[0] & ~mask) | (static_cast<BYTE>(nextByte >> outputBufferOffsetInBits) & mask);
}
else
{
// The remaining bits will cross a byte boundary.
UINT bitsCopiedToFirstByte = 8 - outputBufferOffsetInBits;
// Write to the first byte...
BYTE mask = GetOffsetMask(outputBufferOffsetInBits, bitsCopiedToFirstByte);
pOutputPosition[0] = (pOutputPosition[0] & ~mask) | (static_cast<BYTE>(nextByte >> outputBufferOffsetInBits) & mask);
// Write to the second byte...
mask = GetOffsetMask(0, bitsRemaining - bitsCopiedToFirstByte);
pOutputPosition[1] = static_cast<BYTE>((pOutputPosition[1] & ~mask) | ((nextByte << bitsCopiedToFirstByte) & mask));
}
bitsRemaining = 0;
}
pOutputPosition++;
pInputPosition++;
}
pOutputBuffer += outputBufferStride;
pInputBuffer += inputBufferStride;
}
}
//+-----------------------------------------------------------------------------
//
// MilUtility_CopyPixelBuffer
//
// This function copies memory from the input buffer to the output buffer,
// with explicit support for sub-byte pixel formats. Generally speaking, this
// functions treats memory as 2D (width*height). However, the width of the
// buffer often differs from the natural width of the pixels (width *
// bits-per-pixel, converted to bytes), due to memory alignment requirements.
// The actual distance between adjacent rows is known as the stride, and this
// is always specified in bytes.
//
// The buffers are therefore specified by a pointer, a size, and a stride.
// As usual, the size and stride are specified in bytes.
//
// However, the requested area to copy is specified in bits. This includes
// bit offsets into both the input and output buffers, as well as number of
// bits to copy for each row. The number of rows to copy is specified as the
// height. The bit offsets must only specify the offset within the first
// byte (they must range from 0 to 7, inclusive). The buffer pointers should
// be adjusted before calling this method if the bit offset is large.
//
//------------------------------------------------------------------------------
extern "C"
HRESULT WINAPI
MilUtility_CopyPixelBuffer(
__out_bcount(outputBufferSize) BYTE* pOutputBuffer,
UINT outputBufferSize,
UINT outputBufferStride,
UINT outputBufferOffsetInBits,
__in_bcount(inputBufferSize) BYTE* pInputBuffer,
UINT inputBufferSize,
UINT inputBufferStride,
UINT inputBufferOffsetInBits,
UINT height,
UINT copyWidthInBits
)
{
HRESULT hr = S_OK;
if (height == 0 || copyWidthInBits == 0)
{
// Nothing to do.
goto Cleanup;
}
if (outputBufferOffsetInBits > 7 || inputBufferOffsetInBits > 7)
{
// Bit offsets should be 0..7, inclusive.
IFC(E_INVALIDARG);
}
UINT minimumOutputBufferStrideInBits;
minimumOutputBufferStrideInBits = 0;
IFC(UIntAdd(outputBufferOffsetInBits, copyWidthInBits, &minimumOutputBufferStrideInBits));
UINT minimumOutputBufferStride;
minimumOutputBufferStride = BitsToBytes(minimumOutputBufferStrideInBits);
if (outputBufferStride < minimumOutputBufferStride)
{
// The stride of the output buffer is too small.
IFC(E_INVALIDARG);
}
UINT minimumOutputBufferSize;
minimumOutputBufferSize = 0;
IFC(UIntMult(outputBufferStride, (height-1), &minimumOutputBufferSize));
IFC(UIntAdd(minimumOutputBufferSize, minimumOutputBufferStride, &minimumOutputBufferSize));
if (outputBufferSize < minimumOutputBufferSize)
{
// The output buffer is too small.
IFC(E_INVALIDARG);
}
UINT minimumInputBufferStrideInBits;
minimumInputBufferStrideInBits = 0;
IFC(UIntAdd(inputBufferOffsetInBits, copyWidthInBits, &minimumInputBufferStrideInBits));
UINT minimumInputBufferStride;
minimumInputBufferStride = BitsToBytes(minimumInputBufferStrideInBits);
if (inputBufferStride < minimumInputBufferStride)
{
// The stride of the input buffer is too small.
IFC(E_INVALIDARG);
}
UINT minimumInputBufferSize;
minimumInputBufferSize = 0;
IFC(UIntMult(inputBufferStride, (height-1), &minimumInputBufferSize));
IFC(UIntAdd(minimumInputBufferSize, minimumInputBufferStride, &minimumInputBufferSize));
if (inputBufferSize < minimumInputBufferSize)
{
// The input buffer is too small.
IFC(E_INVALIDARG);
}
if (outputBufferOffsetInBits != inputBufferOffsetInBits)
{
CopyUnalignedPixelBuffer(
pOutputBuffer,
outputBufferSize,
outputBufferStride,
outputBufferOffsetInBits,
pInputBuffer,
inputBufferSize,
inputBufferStride,
inputBufferOffsetInBits,
height,
copyWidthInBits);
}
else
{
// Since the input and output offsets are the same, we use more general
// variable names here.
UINT minimumBufferStrideInBits = minimumInputBufferStrideInBits;
UINT minimumBufferStride = minimumInputBufferStride;
UINT bufferOffsetInBits = inputBufferOffsetInBits;
UINT finalByteOffset = minimumBufferStride - 1;
if ((bufferOffsetInBits == 0) && (copyWidthInBits % 8 == 0))
{
if (minimumBufferStride == inputBufferStride &&
inputBufferStride == outputBufferStride)
{
// Fast-Path
// The input and output buffers are on byte boundaries, both
// share the same stride, and we are copying the entire
// stride of each row. These conditions allow us to do a
// single large memory copy instead of multiple copies per row.
memcpy(pOutputBuffer, pInputBuffer, inputBufferStride*height);
}
else
{
// We are copying whole bytes from the input buffer to the
// output buffer, but we still need to copy row-by-row since
// the width is not the same as the stride.
for (UINT i = 0; i < height; i++)
{
memcpy(pOutputBuffer, pInputBuffer, minimumBufferStride);
pOutputBuffer += outputBufferStride;
pInputBuffer += inputBufferStride;
}
}
}
else if (finalByteOffset == 0)
{
// If the first byte is also the final byte, we need to double mask.
BYTE mask = GetOffsetMask(bufferOffsetInBits, copyWidthInBits);
for (UINT i = 0; i < height; i++)
{
pOutputBuffer[0] = (pOutputBuffer[0] & ~mask) | (pInputBuffer[0] & mask);
pOutputBuffer += outputBufferStride;
pInputBuffer += inputBufferStride;
}
}
else
{
// In this final case:
// - only part of either the first or last byte should be copied,
// - the first byte is not the last byte,
// - and there are between 0 and n whole bytes in between to copy.
bool firstByteIsWhole = bufferOffsetInBits == 0;
bool finalByteIsWhole = minimumBufferStrideInBits % 8 == 0;
UINT wholeBytesPerRow = minimumBufferStride - (finalByteIsWhole ? 0 : 1) - (firstByteIsWhole ? 0 : 1);
for (UINT i = 0; i < height; i++)
{
if (!firstByteIsWhole)
{
BYTE mask = GetOffsetMask(bufferOffsetInBits, 8 - bufferOffsetInBits);
pOutputBuffer[0] = (pOutputBuffer[0] & ~mask) | (pInputBuffer[0] & mask);
}
if (wholeBytesPerRow > 0)
{
UINT firstByteOffset = (firstByteIsWhole ? 0 : 1);
memcpy(
pOutputBuffer + firstByteOffset,
pInputBuffer + firstByteOffset,
wholeBytesPerRow);
}
if (!finalByteIsWhole)
{
BYTE mask = GetOffsetMask(0, minimumBufferStrideInBits % 8);
pOutputBuffer[finalByteOffset] = (pOutputBuffer[finalByteOffset] & ~mask) | (pInputBuffer[finalByteOffset] & mask);
}
pOutputBuffer += outputBufferStride;
pInputBuffer += inputBufferStride;
}
}
}
Cleanup:
RRETURN(hr);
}
| 36.946467
| 137
| 0.561261
|
nsivov
|
0a46470e941be66cd0e253e942162108a6e2ef6a
| 932
|
cpp
|
C++
|
242_b.cpp
|
onexmaster/cp
|
b78b0f1e586d6977d86c97b32f48fed33f1469af
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
242_b.cpp
|
onexmaster/cp
|
b78b0f1e586d6977d86c97b32f48fed33f1469af
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
242_b.cpp
|
onexmaster/cp
|
b78b0f1e586d6977d86c97b32f48fed33f1469af
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
// Created by Tanuj Jain
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("inputf.in","r",stdin);
freopen("outputf.in","w",stdout);
#endif
int t;
cin>>t;
//set<pair<int,int>,int>st;
int l=INT_MAX;
int r=-1;
vector<pair<int,int>>v;
for(int i=0;i<t;i++)
{
int a,b;
cin>>a>>b;
l=min(l,a);
r=max(r,b);
v.pb({a,b});
//st.insert{a,b};
}
for(int i=0;i<t;i++)
{
if(v[i].first==l && v[i].second==r)
{
cout<<i+1;
return 0;
}
}
cout<<-1;
return 0;
}
| 18.64
| 106
| 0.60515
|
onexmaster
|
0a4c6282a0249bac1a4d6dbfb95bf3dd1d8c4009
| 23,969
|
cxx
|
C++
|
osprey/be/lno/sclrze.cxx
|
sharugupta/OpenUH
|
daddd76858a53035f5d713f648d13373c22506e8
|
[
"BSD-2-Clause"
] | null | null | null |
osprey/be/lno/sclrze.cxx
|
sharugupta/OpenUH
|
daddd76858a53035f5d713f648d13373c22506e8
|
[
"BSD-2-Clause"
] | null | null | null |
osprey/be/lno/sclrze.cxx
|
sharugupta/OpenUH
|
daddd76858a53035f5d713f648d13373c22506e8
|
[
"BSD-2-Clause"
] | null | null | null |
/*
* Copyright 2002, 2003, 2004, 2005, 2006 PathScale, Inc. All Rights Reserved.
*/
/*
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
*/
// Array Scalarization
// -------------------
//
// Description:
//
// In loops, convert things that look like
// do i
// a[i] = ...
// ... = a[i]
//
// into
//
// do i
// t = ...
// a[i] = t
// ... = t
//
// This is useful because
// 1) It gets rid of loads
// 2) If it gets rid of all the loads to a local array then
// the array equivalencing algorithm will get rid of the array
//
// Because SWP will do 1 as well as we do, we'll only apply this
// algorithm to local arrays (Although it's trivial to change this).
//
/* ====================================================================
* ====================================================================
*
* Module: sclrze.cxx
* $Revision: 1.7 $
* $Date: 05/04/07 19:50:39-07:00 $
* $Author: kannann@iridot.keyresearch $
* $Source: be/lno/SCCS/s.sclrze.cxx $
*
* Revision history:
* dd-mmm-94 - Original Version
*
* Description: Scalarize arrays
*
* ====================================================================
* ====================================================================
*/
#ifdef USE_PCH
#include "lno_pch.h"
#endif // USE_PCH
#pragma hdrstop
const static char *source_file = __FILE__;
const static char *rcs_id = "$Source: be/lno/SCCS/s.sclrze.cxx $ $Revision: 1.7 $";
#include <sys/types.h>
#include "lnopt_main.h"
#include "dep_graph.h"
#include "lwn_util.h"
#include "opt_du.h"
#include "reduc.h"
#include "sclrze.h"
#include "lnoutils.h"
static void Process_Store(WN *, VINDEX16 , ARRAY_DIRECTED_GRAPH16 *, BOOL,
BOOL, REDUCTION_MANAGER *red_manager);
static BOOL Intervening_Write(INT,VINDEX16,
VINDEX16 ,ARRAY_DIRECTED_GRAPH16 *);
static BOOL Is_Invariant(ACCESS_ARRAY *store, WN *store_wn);
static BOOL MP_Problem(WN *wn1, WN *wn2);
static HASH_TABLE<ST *, INT> * Array_Use_Hash;
static int DSE_Count = 0;
extern BOOL ST_Has_Dope_Vector(ST *);
// Query whether 'st' represents a local variable.
static BOOL Is_Local_Var(ST * st)
{
if ((ST_sclass(st) == SCLASS_AUTO)
&& (ST_base_idx(st) == ST_st_idx(st))
&& !ST_has_nested_ref(st)
&& (ST_class(st) == CLASS_VAR))
return TRUE;
return FALSE;
}
// Query whether use references to 'st' is tracked in "Mark_Array_Uses".
// Limit to local allocate arrays.
static BOOL Is_Tracked(ST * st)
{
return (Is_Local_Var(st) && ST_Has_Dope_Vector(st));
}
// bit mask for symbol attributes.
#define HAS_ESCAPE_USE 1 // has a use not reachable by a dominating def.
#define ADDR_TAKEN 2 // is address-taken.
#define HAS_USE 4 // has a use.
#define IS_ALLOC 8 // is allocated/dealloacted.
// Query whether 'store_wn' is dead, i.e., its address is not taken and it has no use.
static BOOL Is_Dead_Store(WN * store_wn)
{
OPERATOR opr = WN_operator(store_wn);
if (!OPERATOR_is_scalar_store(opr)) {
WN * base = WN_array_base(WN_kid(store_wn,1));
if (WN_has_sym(base)) {
ST * st = WN_st(base);
if (st && Is_Tracked(st)
&& Array_Use_Hash
&& (Array_Use_Hash->Find(st) == IS_ALLOC))
return TRUE;
}
}
return FALSE;
}
// Given an array reference 'load_wn", query where there exists a reaching def that dominates it.
static BOOL Has_Dom_Reaching_Def(ARRAY_DIRECTED_GRAPH16 * dep_graph, WN * load_wn)
{
OPERATOR opr = WN_operator(load_wn);
if (!OPERATOR_is_load(opr) || OPERATOR_is_scalar_load(opr))
return FALSE;
VINDEX16 v = dep_graph->Get_Vertex(load_wn);
if (!v)
return FALSE;
WN * kid = WN_kid0(load_wn);
if (WN_operator(kid) != OPR_ARRAY)
return FALSE;
ACCESS_ARRAY * load = (ACCESS_ARRAY *) WN_MAP_Get(LNO_Info_Map, kid);
if (!load)
return FALSE;
for (EINDEX16 e = dep_graph->Get_In_Edge(v); e; e = dep_graph->Get_Next_In_Edge(e)) {
VINDEX16 source = dep_graph->Get_Source(e);
WN * store_wn = dep_graph->Get_Wn(source);
OPERATOR opr = WN_operator(store_wn);
if (OPERATOR_is_store(opr) && !OPERATOR_is_scalar_store(opr)) {
kid = WN_kid1(store_wn);
if (WN_operator(kid) != OPR_ARRAY)
continue;
ACCESS_ARRAY * store = (ACCESS_ARRAY *) WN_MAP_Get(LNO_Info_Map, kid);
if (Equivalent_Access_Arrays(store,load,store_wn,load_wn)
&& (DEPV_COMPUTE::Base_Test(store_wn,NULL,load_wn,NULL) == DEP_CONTINUE)) {
if (Dominates(store_wn, load_wn)
&& !Intervening_Write(dep_graph->Depv_Array(e)->Max_Level(),
source, v, dep_graph)
&& !MP_Problem(store_wn, load_wn))
return TRUE;
}
}
}
return FALSE;
}
// Given an array reference 'store_wn', query whether there exists a kill that post-dominates it.
static BOOL Has_Post_Dom_Kill(ARRAY_DIRECTED_GRAPH16 * dep_graph, WN * store_wn)
{
OPERATOR opr = WN_operator(store_wn);
if (!OPERATOR_is_store(opr) || OPERATOR_is_scalar_store(opr))
return FALSE;
VINDEX16 v = dep_graph->Get_Vertex(store_wn);
if (!v)
return FALSE;
WN * kid = WN_kid1(store_wn);
if (WN_operator(kid) != OPR_ARRAY)
return FALSE;
WN * base = WN_array_base(kid);
if (!WN_has_sym(base))
return FALSE;
ST * st = WN_st(base);
// limit it to local non-address-taken arrays.
if (!Is_Local_Var(st) || !Array_Use_Hash
|| ((Array_Use_Hash->Find(st) & ADDR_TAKEN) != 0))
return FALSE;
ACCESS_ARRAY * store = (ACCESS_ARRAY *) WN_MAP_Get(LNO_Info_Map, kid);
if (!store)
return FALSE;
for (EINDEX16 e = dep_graph->Get_Out_Edge(v); e; e = dep_graph->Get_Next_Out_Edge(e)) {
VINDEX16 sink = dep_graph->Get_Sink(e);
WN * kill_wn = dep_graph->Get_Wn(sink);
if (kill_wn == store_wn)
continue;
OPERATOR opr = WN_operator(kill_wn);
if (OPERATOR_is_store(opr) && !OPERATOR_is_scalar_store(opr)) {
kid = WN_kid1(kill_wn);
if (WN_operator(kid) != OPR_ARRAY)
continue;
ACCESS_ARRAY * kill = (ACCESS_ARRAY *) WN_MAP_Get(LNO_Info_Map, kid);
if (Equivalent_Access_Arrays(store, kill, store_wn, kill_wn)
&& (DEPV_COMPUTE::Base_Test(store_wn, NULL, kill_wn, NULL) == DEP_CONTINUE)) {
if ((LWN_Get_Parent(store_wn) == LWN_Get_Parent(kill_wn))
&& !MP_Problem(store_wn, kill_wn)) {
WN * next = WN_next(store_wn);
while (next) {
if (next == kill_wn)
return TRUE;
next = WN_next(next);
}
}
}
}
}
return FALSE;
}
// Check usage of a local allocate array.
static void Check_use(ST * st, WN * wn, ARRAY_DIRECTED_GRAPH16 * dep_graph, BOOL escape)
{
if (st && Is_Tracked(st)) {
int val = Array_Use_Hash->Find(st);
val |= HAS_USE;
if (escape || !Has_Dom_Reaching_Def(dep_graph, wn)) {
val |= HAS_ESCAPE_USE;
}
if (val) {
Array_Use_Hash->Find_And_Set(st, val);
}
}
}
// Check use references to local allocate arrays and mark attributes.
// Limit it to Fortran programs currently.
static void Mark_Array_Uses(ARRAY_DIRECTED_GRAPH16 * dep_graph, WN * wn)
{
FmtAssert(Array_Use_Hash, ("Expect a hash table."));
WN * kid;
ST * st;
OPERATOR opr = WN_operator(wn);
switch (opr) {
case OPR_BLOCK:
kid = WN_first(wn);
while (kid) {
Mark_Array_Uses(dep_graph, kid);
kid = WN_next(kid);
}
break;
case OPR_LDA:
st = WN_st(wn);
if (Is_Tracked(st)) {
int val = Array_Use_Hash->Find(st);
BOOL is_pure = FALSE;
WN * wn_p = LWN_Get_Parent(wn);
if (wn_p && ST_Has_Dope_Vector(st)) {
OPERATOR p_opr = WN_operator(wn_p);
if (p_opr == OPR_PARM) {
wn_p = LWN_Get_Parent(wn_p);
if (wn_p
&& (WN_operator(wn_p) == OPR_CALL)) {
char * name = ST_name(WN_st_idx(wn_p));
if ((strcmp(name, "_DEALLOCATE") == 0)
|| (strcmp(name, "_DEALLOC") == 0)
|| (strcmp(name, "_F90_ALLOCATE_B") == 0)) {
is_pure = TRUE;
val |= IS_ALLOC;
}
}
}
else if ((p_opr == OPR_STID) && WN_has_sym(wn_p)) {
ST * p_st = WN_st(wn_p);
TY_IDX ty = ST_type(p_st);
if (strncmp(TY_name(ty), ".alloctemp.", 11) == 0)
is_pure = TRUE;
}
}
if (!is_pure)
val |= ADDR_TAKEN;
if (val) {
Array_Use_Hash->Find_And_Set(st, val);
}
}
break;
case OPR_LDID:
if (WN_has_sym(wn)) {
st = WN_st(wn);
WN * store = Find_Containing_Store(wn);
if (store && (WN_operator(store) == OPR_STID)
&& (WN_st(store) != st)) {
if (WN_kid0(store) == wn) {
// Be conservative for direct assignment to a different variable.
// Consider it as an escape use.
Check_use(st, wn, dep_graph, TRUE);
}
else
Check_use(st, wn, dep_graph, FALSE);
}
// Flag ADDR_TAKEN bit for parameters passed by reference.
WN * wn_p = LWN_Get_Parent(wn);
if (wn_p && (WN_operator(wn_p) == OPR_PARM)) {
INT flag = WN_flag(wn_p);
if (flag & WN_PARM_BY_REFERENCE) {
int val = Array_Use_Hash->Find(st);
val |= ADDR_TAKEN;
if (val) {
Array_Use_Hash->Find_And_Set(st, val);
}
}
}
}
break;
case OPR_ILOAD:
kid = WN_kid0(wn);
if (WN_operator(kid) == OPR_ARRAY) {
WN * base = WN_array_base(kid);
if (WN_has_sym(base)) {
st = WN_st(base);
Check_use(st, wn, dep_graph, FALSE);
}
}
break;
default:
;
}
if (opr == OPR_FUNC_ENTRY)
Mark_Array_Uses(dep_graph,WN_func_body(wn));
else {
INT start = (opr == OPR_ARRAY) ? 1 : 0;
for (INT kidno = start; kidno < WN_kid_count(wn); kidno++) {
kid = WN_kid(wn, kidno);
Mark_Array_Uses(dep_graph, kid);
}
}
}
void Scalarize_Arrays(ARRAY_DIRECTED_GRAPH16 *dep_graph,
BOOL do_variants, BOOL do_invariants, REDUCTION_MANAGER *red_manager, WN * wn)
{
if (Get_Trace(TP_LNOPT,TT_LNO_SCLRZE)) {
fprintf(TFile,"Scalarizing arrays \n");
}
Array_Use_Hash = NULL;
PU & pu = Get_Current_PU();
if (Do_Aggressive_Fuse && wn
&& ((PU_src_lang(Get_Current_PU()) & PU_F90_LANG)
|| (PU_src_lang(Get_Current_PU()) & PU_F77_LANG))) {
ST * st;
INT i;
Array_Use_Hash = CXX_NEW((HASH_TABLE<ST *, INT>) (100, &LNO_default_pool),
&LNO_default_pool);
Mark_Array_Uses(Array_Dependence_Graph, wn);
}
// search for a store
VINDEX16 v;
VINDEX16 v_next;
DSE_Count = 0;
for (v = dep_graph->Get_Vertex(); v; v = v_next) {
v_next = dep_graph->Get_Next_Vertex_In_Edit(v);
if (!dep_graph->Vertex_Is_In_Graph(v))
continue;
WN *wn = dep_graph->Get_Wn(v);
OPCODE opcode = WN_opcode(wn);
if (OPCODE_is_store(opcode) && (WN_kid_count(wn) == 2)) {
WN *array = WN_kid1(wn);
if (WN_operator(array) == OPR_ARRAY) {
WN *base = WN_array_base(array);
OPERATOR base_oper = WN_operator(base);
if ((base_oper == OPR_LDID) || (base_oper == OPR_LDA)) {
ST *st = WN_st(base);
// is it local
#ifdef _NEW_SYMTAB
if (ST_level(st) == CURRENT_SYMTAB) {
#else
if (ST_symtab_id(st) == SYMTAB_id(Current_Symtab)) {
#endif
if (ST_sclass(st) == SCLASS_AUTO &&
ST_base_idx(st) == ST_st_idx(st)) {
if (!ST_has_nested_ref(st))
Process_Store(wn,v,dep_graph,do_variants,do_invariants,
red_manager);
}
}
else if (Is_Global_As_Local(st)) {
Process_Store(wn,v,dep_graph,do_variants,do_invariants, red_manager);
}
}
}
}
}
if (DSE_Count > 0) {
if (Get_Trace(TP_LNOPT,TT_LNO_SCLRZE))
printf("####Func: %d scalar replacement delete %d stores.\n", Current_PU_Count(), DSE_Count);
}
if (Array_Use_Hash)
CXX_DELETE(Array_Use_Hash, &LNO_default_pool);
}
// Given a store to an array element 'wn', query whether it is read outside its enclosing loop
// assuming unequal acccess arrays refer to disjointed locations.
static BOOL Live_On_Exit(WN * wn)
{
ARRAY_DIRECTED_GRAPH16 * adg = Array_Dependence_Graph;
OPERATOR opr = WN_operator(wn);
FmtAssert(OPERATOR_is_store(opr) && !OPERATOR_is_scalar_store(opr), ("Expect a store."));
VINDEX16 v = adg->Get_Vertex(wn);
if (!v)
return TRUE;
WN * kid = WN_kid1(wn);
if (WN_operator(kid) != OPR_ARRAY)
return TRUE;
ACCESS_ARRAY * store = (ACCESS_ARRAY *) WN_MAP_Get(LNO_Info_Map, kid);
if (!store)
return TRUE;
WN * loop_st = Enclosing_Loop(wn);
for (EINDEX16 e = adg->Get_Out_Edge(v); e; e = adg->Get_Next_Out_Edge(e)) {
VINDEX16 sink = adg->Get_Sink(e);
WN * load_wn = adg->Get_Wn(sink);
OPERATOR opr = WN_operator(load_wn);
if (OPERATOR_is_load(opr) && !OPERATOR_is_scalar_load(opr)) {
kid = WN_kid0(load_wn);
if (WN_operator(kid) != OPR_ARRAY)
continue;
if (Enclosing_Loop(load_wn) == loop_st)
continue;
ACCESS_ARRAY * load = (ACCESS_ARRAY *) WN_MAP_Get(LNO_Info_Map, kid);
if (Equivalent_Access_Arrays(store,load,wn,load_wn)
&& (DEPV_COMPUTE::Base_Test(wn,NULL,load_wn,NULL) == DEP_CONTINUE)) {
return TRUE;
}
}
}
return FALSE;
}
// Query whether 'wn' is located in a loop nest that allows dead store removal
// after scalarization.
static BOOL Do_Sclrze_Dse(WN * wn)
{
WN * wn_p = LWN_Get_Parent(wn);
while (wn_p) {
if (WN_operator(wn_p) == OPR_DO_LOOP) {
DO_LOOP_INFO * dli = Get_Do_Loop_Info(wn_p);
if (dli && (dli->Sclrze_Dse == 1))
return TRUE;
}
wn_p = LWN_Get_Parent(wn_p);
}
return FALSE;
}
// Delete 'store_wn'.
static void Delete_Store(WN * store_wn, ARRAY_DIRECTED_GRAPH16 * dep_graph)
{
UINT32 limit = LNO_Sclrze_Dse_Limit;
if ((limit > 0) && (DSE_Count > limit))
return;
LWN_Update_Dg_Delete_Tree(store_wn, dep_graph);
LWN_Delete_Tree(store_wn);
DSE_Count++;
}
// Process a store.
static void Process_Store(WN *store_wn, VINDEX16 v,
ARRAY_DIRECTED_GRAPH16 *dep_graph, BOOL do_variants,
BOOL do_invariants, REDUCTION_MANAGER *red_manager)
{
#ifdef TARG_X8664
// Do not sclrze vector stores.
if (MTYPE_is_vector(WN_desc(store_wn))) return;
#endif
#ifdef KEY // Bug 6162 - can not scalarize to MTYPE_M pregs.
if (WN_desc(store_wn) == MTYPE_M) return;
#endif
if (Inside_Loop_With_Goto(store_wn)) return;
INT debug = Get_Trace(TP_LNOPT,TT_LNO_SCLRZE);
BOOL scalarized_this_store = FALSE;
WN_OFFSET preg_num=0;
ST *preg_st=0;
WN *preg_store = NULL;
ACCESS_ARRAY *store =
(ACCESS_ARRAY *) WN_MAP_Get(LNO_Info_Map,WN_kid1(store_wn));
if (debug) {
fprintf(TFile,"Processing the store ");
store->Print(TFile);
fprintf(TFile,"\n");
}
if (Do_Aggressive_Fuse) {
if (Is_Dead_Store(store_wn)) {
if (!red_manager || (red_manager->Which_Reduction(store_wn) == RED_NONE)) {
Delete_Store(store_wn, dep_graph);
return;
}
}
}
BOOL is_invariant = Is_Invariant(store,store_wn);
if (!do_variants && !is_invariant) {
return;
}
if (!do_invariants && is_invariant) {
return;
}
// Don't scalarize reductions as that will break the reduction
if (red_manager && (red_manager->Which_Reduction(store_wn) != RED_NONE)) {
return;
}
char preg_name[20];
TYPE_ID store_type = WN_desc(store_wn);
TYPE_ID type = Promote_Type(store_type);
EINDEX16 e,next_e=0;
BOOL all_loads_scalarized = TRUE;
BOOL has_post_dom_kill = FALSE;
if (Do_Aggressive_Fuse)
has_post_dom_kill = Has_Post_Dom_Kill(dep_graph, store_wn);
for (e = dep_graph->Get_Out_Edge(v); e; e=next_e) {
next_e = dep_graph->Get_Next_Out_Edge(e);
VINDEX16 sink = dep_graph->Get_Sink(e);
WN *load_wn = dep_graph->Get_Wn(sink);
OPCODE opcode = WN_opcode(load_wn);
if (OPCODE_is_load(opcode)) {
if (OPCODE_operator(opcode) != OPR_LDID &&
// Do not scalarize MTYPE_M loads as this may result in a parent MTYPE_M store
// having a child that is not MTYPE_M and function 'Add_def' may not be able to
// handle such stores during coderep creation. The check here catches 'uses' involving
// MTYPE_M whereas the check at the beginning of 'Process_Store' catches 'defs'.
(WN_rtype(load_wn) != MTYPE_M) && (WN_desc(load_wn) != MTYPE_M)) {
ACCESS_ARRAY *load = (ACCESS_ARRAY *)
WN_MAP_Get(LNO_Info_Map,WN_kid0(load_wn));
if (WN_operator(WN_kid0(load_wn)) == OPR_ARRAY &&
Equivalent_Access_Arrays(store,load,store_wn,load_wn) &&
(DEPV_COMPUTE::Base_Test(store_wn,NULL,load_wn,NULL) ==
DEP_CONTINUE)
#ifdef KEY
&&
//Bug 9134: scalarizing only if store to and load from the same field
WN_field_id(store_wn)==WN_field_id(load_wn)
#endif
) {
BOOL scalarized_this_load = FALSE;
if (Dominates(store_wn,load_wn)) {
if (!red_manager ||
(red_manager->Which_Reduction(store_wn) == RED_NONE)) {
if (!Intervening_Write(dep_graph->Depv_Array(e)->Max_Level(),
v,sink,dep_graph)) {
if (!MP_Problem(store_wn,load_wn)) {
scalarized_this_load = TRUE;
if (!scalarized_this_store) {
if (debug) {
fprintf(TFile,"Scalarizing the load ");
load->Print(TFile);
fprintf(TFile,"\n");
}
// Create a new preg
preg_st = MTYPE_To_PREG(type);
char *array_name =
ST_name(WN_st(WN_array_base(WN_kid1(store_wn))));
INT length = strlen(array_name);
if (length < 18) {
strcpy(preg_name,array_name);
preg_name[length] = '_';
preg_name[length+1] = '1';
preg_name[length+2] = 0;
#ifdef _NEW_SYMTAB
preg_num = Create_Preg(type,preg_name);
} else {
preg_num = Create_Preg(type, NULL);
}
#else
preg_num = Create_Preg(type,preg_name, NULL);
} else {
preg_num = Create_Preg(type, NULL, NULL);
}
#endif
// replace A[i] = x with "preg = x; A[i] = preg"
OPCODE preg_s_opcode = OPCODE_make_op(OPR_STID,MTYPE_V,type);
// Insert CVTL if necessary (854441)
WN *wn_value = WN_kid0(store_wn);
if (MTYPE_byte_size(store_type) < MTYPE_byte_size(type))
wn_value = LWN_Int_Type_Conversion(wn_value, store_type);
preg_store = LWN_CreateStid(preg_s_opcode,preg_num,
preg_st, Be_Type_Tbl(type),wn_value);
WN_Set_Linenum(preg_store,WN_Get_Linenum(store_wn));
LWN_Copy_Frequency_Tree(preg_store,store_wn);
LWN_Insert_Block_Before(LWN_Get_Parent(store_wn),
store_wn,preg_store);
OPCODE preg_l_opcode = OPCODE_make_op(OPR_LDID, type,type);
WN *preg_load = WN_CreateLdid(preg_l_opcode,preg_num,
preg_st, Be_Type_Tbl(type));
LWN_Copy_Frequency(preg_load,store_wn);
WN_kid0(store_wn) = preg_load;
LWN_Set_Parent(preg_load,store_wn);
Du_Mgr->Add_Def_Use(preg_store,preg_load);
}
scalarized_this_store = TRUE;
// replace the load with the use of the preg
WN *new_load = WN_CreateLdid(OPCODE_make_op(OPR_LDID,
type,type),preg_num,preg_st,Be_Type_Tbl(type));
LWN_Copy_Frequency_Tree(new_load,load_wn);
WN *parent = LWN_Get_Parent(load_wn);
for (INT i = 0; i < WN_kid_count(parent); i++) {
if (WN_kid(parent,i) == load_wn) {
WN_kid(parent,i) = new_load;
LWN_Set_Parent(new_load,parent);
LWN_Update_Dg_Delete_Tree(load_wn, dep_graph);
LWN_Delete_Tree(load_wn);
break;
}
}
// update def-use for scalar
Du_Mgr->Add_Def_Use(preg_store,new_load);
}
}
if (!scalarized_this_load)
all_loads_scalarized = FALSE;
}
}
}
}
}
}
if (Do_Aggressive_Fuse) {
OPERATOR opr = WN_operator(store_wn);
if (!OPERATOR_is_scalar_store(opr)
&& scalarized_this_store && all_loads_scalarized) {
WN * base = WN_array_base(WN_kid(store_wn,1));
if (WN_has_sym(base)) {
ST * st = WN_st(base);
if (st) {
int val = Array_Use_Hash ? Array_Use_Hash->Find(st) : 0;
if (Is_Global_As_Local(st) && ST_Has_Dope_Vector(st)) {
if (Do_Sclrze_Dse(store_wn)
&& !Live_On_Exit(store_wn)
&& (ST_export(st) == EXPORT_LOCAL)) {
Delete_Store(store_wn, dep_graph);
}
}
else if (val && ((val & ADDR_TAKEN) == 0)
&& ((val & IS_ALLOC) != 0)) {
if (has_post_dom_kill
|| ((val & HAS_ESCAPE_USE) == 0)) {
Delete_Store(store_wn, dep_graph);
}
}
}
}
}
}
}
// Given that there is a must dependence between store and load,
// is there ary other store that might occur between the the store and the
// load
// If there exists a store2, whose maximum dependence level wrt the
// load is greater than store's dependence level (INT level below),
// then store2 is intervening.
//
// If there exists a store2 whose maximum dependence level is equal
// to store's, and there a dependence from store to store2 with dependence
// level >= the previous level, then store2 is intervening
static BOOL Intervening_Write(INT level,VINDEX16 store_v,
VINDEX16 load_v,ARRAY_DIRECTED_GRAPH16 *dep_graph)
{
EINDEX16 e;
for (e=dep_graph->Get_In_Edge(load_v); e; e=dep_graph->Get_Next_In_Edge(e)) {
INT level2 = dep_graph->Depv_Array(e)->Max_Level();
if (level2 > level) {
return TRUE;
} else if (level2 == level) {
VINDEX16 store2_v = dep_graph->Get_Source(e);
EINDEX16 store_store_edge = dep_graph->Get_Edge(store_v,store2_v);
if (store_store_edge) {
INT store_store_level =
dep_graph->Depv_Array(store_store_edge)->Max_Level();
if (store_store_level >= level) {
return TRUE;
}
}
}
}
return FALSE;
}
// Is this reference invariant in its inner loop
static BOOL Is_Invariant(ACCESS_ARRAY *store, WN *store_wn)
{
// find the do loop info of the store
WN *wn = LWN_Get_Parent(store_wn);
while (WN_opcode(wn) != OPC_DO_LOOP) {
wn = LWN_Get_Parent(wn);
}
DO_LOOP_INFO *dli = Get_Do_Loop_Info(wn);
INT depth = dli->Depth;
if (store->Too_Messy || (store->Non_Const_Loops() > depth)) {
return FALSE;
}
for (INT i=0; i<store->Num_Vec(); i++) {
ACCESS_VECTOR *av = store->Dim(i);
if (av->Too_Messy || av->Loop_Coeff(depth)) {
return FALSE;
}
}
return TRUE;
}
// Don't scalarize across parallel boundaries
static BOOL MP_Problem(WN *wn1, WN *wn2)
{
if (Contains_MP) {
WN *mp1 = LWN_Get_Parent(wn1);
while (mp1 && (!Is_Mp_Region(mp1)) &&
((WN_opcode(mp1) != OPC_DO_LOOP) || !Do_Loop_Is_Mp(mp1))) {
mp1 = LWN_Get_Parent(mp1);
}
WN *mp2 = LWN_Get_Parent(wn2);
while (mp2 && (!Is_Mp_Region(mp2)) &&
((WN_opcode(mp2) != OPC_DO_LOOP) || !Do_Loop_Is_Mp(mp2))) {
mp2 = LWN_Get_Parent(mp2);
}
if ((mp1 || mp2) && (mp1 != mp2)) return TRUE;
}
return FALSE;
}
| 29.664604
| 99
| 0.640285
|
sharugupta
|
aeab5fab1b6bc6bce7acf07a3e3bb4f1379c8f8a
| 675
|
hpp
|
C++
|
ablateLibrary/flow/fluxDifferencer/offFluxDifferencer.hpp
|
pakserep/ablate
|
8c8443de8a252b03b3535f7c48b7a50aac1e56e4
|
[
"BSD-3-Clause"
] | null | null | null |
ablateLibrary/flow/fluxDifferencer/offFluxDifferencer.hpp
|
pakserep/ablate
|
8c8443de8a252b03b3535f7c48b7a50aac1e56e4
|
[
"BSD-3-Clause"
] | null | null | null |
ablateLibrary/flow/fluxDifferencer/offFluxDifferencer.hpp
|
pakserep/ablate
|
8c8443de8a252b03b3535f7c48b7a50aac1e56e4
|
[
"BSD-3-Clause"
] | null | null | null |
#ifndef ABLATELIBRARY_OFFFLUXDIFFERENCER_HPP
#define ABLATELIBRARY_OFFFLUXDIFFERENCER_HPP
#include "fluxDifferencer.hpp"
namespace ablate::flow::fluxDifferencer {
/**
* Turns off all flow through the flux differencer. This is good for testing.
*/
class OffFluxDifferencer : public fluxDifferencer::FluxDifferencer {
private:
static void OffDifferencerFunction(PetscReal Mm, PetscReal* sPm, PetscReal* sMm, PetscReal Mp, PetscReal* sPp, PetscReal* sMp);
public:
FluxDifferencerFunction GetFluxDifferencerFunction() override { return OffDifferencerFunction; }
};
} // namespace ablate::flow::fluxDifferencer
#endif // ABLATELIBRARY_OFFFLUXDIFFERENCER_HPP
| 35.526316
| 131
| 0.795556
|
pakserep
|
aeb7b7e5ef4835f5aab62c5420c65d825046fad1
| 1,426
|
cpp
|
C++
|
main/Main.cpp
|
Cararasu/holodec
|
d716d95a787ab7872a49a5c4fb930dc37be95ac7
|
[
"MIT"
] | 215
|
2017-06-22T16:23:52.000Z
|
2022-01-27T23:33:37.000Z
|
main/Main.cpp
|
Cararasu/holodec
|
d716d95a787ab7872a49a5c4fb930dc37be95ac7
|
[
"MIT"
] | 4
|
2017-06-29T16:49:28.000Z
|
2019-02-07T19:58:57.000Z
|
main/Main.cpp
|
Cararasu/holodec
|
d716d95a787ab7872a49a5c4fb930dc37be95ac7
|
[
"MIT"
] | 21
|
2017-10-14T02:10:41.000Z
|
2021-07-13T06:08:38.000Z
|
#include "Main.h"
#include <fstream>
using namespace holodec;
Main* Main::g_main;
bool Main::registerArchitecture (Architecture* arch) {
for (Architecture * a : architectures)
if (caseCmpHString (a->name, arch->name))
return false;
architectures.push_back (arch);
return true;
}
Architecture* Main::getArchitecture (HString arch) {
for (Architecture * a : architectures)
if (caseCmpHString (a->name, arch))
return a;
return nullptr;
}
bool Main::registerFileFormat (FileFormat* fileformat) {
for (FileFormat * ff : fileformats)
if (caseCmpHString (ff->name, fileformat->name))
return false;
fileformats.push_back (fileformat);
return true;
}
FileFormat* Main::getFileFormat (HString fileformat) {
for (FileFormat * ff : fileformats)
if (caseCmpHString (ff->name, fileformat))
return ff;
return nullptr;
}
File* Main::loadDataFromFile (HString file) {
std::ifstream t (file.cstr(), std::ios_base::binary);
size_t size;
std::vector<uint8_t> data;
if (t) {
t.seekg (0, t.end);
size = (size_t) t.tellg();
data.resize(size);
t.seekg (0, t.beg);
uint64_t offset = 0;
while (offset < size) {
t.read((char*)data.data() + offset, size);
uint64_t read = t.gcount();
if (read == 0)
break;
offset += read;
printf("Read %zu chars\n", t.gcount());
}
return new File(file, data);
}
return nullptr;
}
void holodec::Main::initMain() {
g_main = new Main();
}
| 21.283582
| 56
| 0.671809
|
Cararasu
|
aec0575a03cec24039c6073cf35b9875a7db2962
| 353
|
hpp
|
C++
|
SDLTest.hpp
|
gazpachian/ScrabookDL
|
70424e4d866d17d95539242ba86ad0841f030091
|
[
"MIT"
] | null | null | null |
SDLTest.hpp
|
gazpachian/ScrabookDL
|
70424e4d866d17d95539242ba86ad0841f030091
|
[
"MIT"
] | null | null | null |
SDLTest.hpp
|
gazpachian/ScrabookDL
|
70424e4d866d17d95539242ba86ad0841f030091
|
[
"MIT"
] | null | null | null |
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <tr1/memory>
#include "vector.hpp"
#include "controller.hpp"
#include "render.hpp"
//Window constants
const Vector2 DEF_SCREEN_DIMS(1200, 675);
const Vector3 DEF_BG_COL(0xFD, 0xF6, 0xE3);
const char * window_title = "Title of window";
| 23.533333
| 46
| 0.745042
|
gazpachian
|
aeca4b2a297c118a8eb65076e18adcd6c73e2e56
| 6,680
|
cpp
|
C++
|
Interaction/albaDevice.cpp
|
IOR-BIC/ALBA
|
b574968b05d9a3a2756dd2ac61d015a0d20232a4
|
[
"Apache-2.0",
"BSD-3-Clause"
] | 9
|
2018-11-19T10:15:29.000Z
|
2021-08-30T11:52:07.000Z
|
Interaction/albaDevice.cpp
|
IOR-BIC/ALBA
|
b574968b05d9a3a2756dd2ac61d015a0d20232a4
|
[
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null |
Interaction/albaDevice.cpp
|
IOR-BIC/ALBA
|
b574968b05d9a3a2756dd2ac61d015a0d20232a4
|
[
"Apache-2.0",
"BSD-3-Clause"
] | 3
|
2018-06-10T22:56:29.000Z
|
2019-12-12T06:22:56.000Z
|
/*=========================================================================
Program: ALBA (Agile Library for Biomedical Applications)
Module: albaDevice
Authors: Marco Petrone
Copyright (c) BIC
All rights reserved. See Copyright.txt or
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// to be includes first: includes wxWindows too...
#include "albaDefines.h"
// base includes
#include "albaDevice.h"
#include "mmuIdFactory.h"
// GUI
#include "albaGUI.h"
// serialization
#include "albaStorageElement.h"
//------------------------------------------------------------------------------
// Events
//------------------------------------------------------------------------------
ALBA_ID_IMP(albaDevice::DEVICE_NAME_CHANGED)
ALBA_ID_IMP(albaDevice::DEVICE_STARTED)
ALBA_ID_IMP(albaDevice::DEVICE_STOPPED)
albaCxxTypeMacro(albaDevice)
//------------------------------------------------------------------------------
albaDevice::albaDevice()
//------------------------------------------------------------------------------
{
m_Gui = NULL;
m_ID = 0;
m_Start = false;
m_AutoStart = false; // auto is enabled when device is started the first time
m_Locked = false;
m_PersistentFalg = false;
}
//------------------------------------------------------------------------------
albaDevice::~albaDevice()
//------------------------------------------------------------------------------
{
}
//------------------------------------------------------------------------------
void albaDevice::SetName(const char *name)
//------------------------------------------------------------------------------
{
Superclass::SetName(name);
InvokeEvent(this,DEVICE_NAME_CHANGED); // send event to device manager (up)
}
//------------------------------------------------------------------------------
int albaDevice::InternalInitialize()
//------------------------------------------------------------------------------
{
int ret=Superclass::InternalInitialize();
m_AutoStart = 1; // enable auto starting of device
// update the GUI if present
return ret;
}
//------------------------------------------------------------------------------
int albaDevice::Start()
//------------------------------------------------------------------------------
{
if (Initialize())
return ALBA_ERROR;
// send an event to advise interactors this device has been started
InvokeEvent(this,DEVICE_STARTED,MCH_INPUT);
return ALBA_OK;
}
//------------------------------------------------------------------------------
void albaDevice::Stop()
//------------------------------------------------------------------------------
{
if (!m_Initialized)
return;
Shutdown();
// send an event to advise interactors this device has been stopped
InvokeEvent(this,DEVICE_STOPPED,MCH_INPUT);
}
//----------------------------------------------------------------------------
albaGUI *albaDevice::GetGui()
//----------------------------------------------------------------------------
{
if (!m_Gui)
CreateGui();
return m_Gui;
}
//----------------------------------------------------------------------------
void albaDevice::CreateGui()
//----------------------------------------------------------------------------
{
/* //SIL. 07-jun-2006 :
assert(m_Gui == NULL);
m_Gui = new albaGUI(this);
m_Gui->String(ID_NAME,"name",&m_Name);
m_Gui->Divider();
m_Gui->Button(ID_ACTIVATE,"activate device");
m_Gui->Button(ID_SHUTDOWN,"shutdown device");
m_Gui->Bool(ID_AUTO_START,"auto start",&m_AutoStart,0,"automatically start device on application startup");
m_Gui->Enable(ID_ACTIVATE,!IsInitialized());
m_Gui->Enable(ID_SHUTDOWN,IsInitialized()!=0);
*/
assert(m_Gui == NULL);
m_Gui = new albaGUI(this);
m_Gui->String(ID_NAME,"name",&m_Name);
m_Gui->Divider();
m_Gui->Bool(ID_ACTIVATE,"start",&m_Start,0,"activate/deactivate this device");
m_Gui->Bool(ID_AUTO_START,"auto start",&m_AutoStart,0,"automatically activate device on application startup");
//m_Gui->Enable(ID_ACTIVATE,!IsInitialized());
//m_Gui->Enable(ID_SHUTDOWN,IsInitialized()!=0);
m_Gui->Divider();
}
//----------------------------------------------------------------------------
void albaDevice::UpdateGui()
//----------------------------------------------------------------------------
{
if (m_Gui)
{
//m_Gui->Enable(ID_ACTIVATE,!IsInitialized());
//m_Gui->Enable(ID_SHUTDOWN,IsInitialized()!=0);
m_Start = IsInitialized();
m_Gui->Update();
}
}
//----------------------------------------------------------------------------
void albaDevice::OnEvent(albaEventBase *e)
//----------------------------------------------------------------------------
{
albaEvent *ev = albaEvent::SafeDownCast(e);
if (ev&& ev->GetSender()==m_Gui)
{
switch(ev->GetId())
{
case ID_NAME:
SetName(m_Name); // force sending an event
break;
case ID_ACTIVATE:
if(m_Start) // user request to Start
{
if (Initialize())
albaErrorMessage("Cannot Initialize Device","I/O Error");
}
else // user request to Stop
{
Shutdown();
}
UpdateGui();
break;
/* //SIL. 07-jun-2006 :
case ID_SHUTDOWN:
Shutdown();
UpdateGui();
break;
*/
}
return;
}
else
{
// pass event to superclass to be processed
Superclass::OnEvent(e);
}
}
//------------------------------------------------------------------------------
int albaDevice::InternalStore(albaStorageElement *node)
//------------------------------------------------------------------------------
{
if (node->StoreText("Name",m_Name)==ALBA_OK && \
node->StoreInteger("ID",(m_ID-MIN_DEVICE_ID))==ALBA_OK && \
node->StoreInteger("AutoStart",m_AutoStart)==ALBA_OK)
return ALBA_OK;
return ALBA_ERROR;
}
//------------------------------------------------------------------------------
int albaDevice::InternalRestore(albaStorageElement *node)
//------------------------------------------------------------------------------
{
// Device Name
if (node->RestoreText("Name",m_Name)==ALBA_OK)
{
int dev_id;
node->RestoreInteger("ID",dev_id);
SetID(dev_id+MIN_DEVICE_ID);
int flag;
// AutoStart flag (optional)
if (node->RestoreInteger("AutoStart",flag)==ALBA_OK)
{
SetAutoStart(flag!=0);
}
// the ID???
return ALBA_OK;
}
return ALBA_ERROR;
}
| 29.688889
| 112
| 0.448054
|
IOR-BIC
|
aed084fb525b5f25e7ee5eed598324734eff4068
| 1,580
|
cpp
|
C++
|
src/effect_cas.cpp
|
stephanlachnit/vkBasalt
|
dd6a067b7eada67f4f34e56054ef24264f6856d7
|
[
"Zlib"
] | 748
|
2019-10-20T14:21:20.000Z
|
2022-03-22T05:53:42.000Z
|
src/effect_cas.cpp
|
stephanlachnit/vkBasalt
|
dd6a067b7eada67f4f34e56054ef24264f6856d7
|
[
"Zlib"
] | 160
|
2019-10-20T16:35:47.000Z
|
2022-03-30T19:21:56.000Z
|
src/effect_cas.cpp
|
stephanlachnit/vkBasalt
|
dd6a067b7eada67f4f34e56054ef24264f6856d7
|
[
"Zlib"
] | 58
|
2019-10-20T19:15:01.000Z
|
2022-01-02T01:16:08.000Z
|
#include "effect_cas.hpp"
#include <cstring>
#include "image_view.hpp"
#include "descriptor_set.hpp"
#include "buffer.hpp"
#include "renderpass.hpp"
#include "graphics_pipeline.hpp"
#include "framebuffer.hpp"
#include "shader.hpp"
#include "sampler.hpp"
#include "shader_sources.hpp"
namespace vkBasalt
{
CasEffect::CasEffect(LogicalDevice* pLogicalDevice,
VkFormat format,
VkExtent2D imageExtent,
std::vector<VkImage> inputImages,
std::vector<VkImage> outputImages,
Config* pConfig)
{
float sharpness = pConfig->getOption<float>("casSharpness", 0.4f);
vertexCode = full_screen_triangle_vert;
fragmentCode = cas_frag;
VkSpecializationMapEntry sharpnessMapEntry;
sharpnessMapEntry.constantID = 0;
sharpnessMapEntry.offset = 0;
sharpnessMapEntry.size = sizeof(float);
VkSpecializationInfo fragmentSpecializationInfo;
fragmentSpecializationInfo.mapEntryCount = 1;
fragmentSpecializationInfo.pMapEntries = &sharpnessMapEntry;
fragmentSpecializationInfo.dataSize = sizeof(float);
fragmentSpecializationInfo.pData = &sharpness;
pVertexSpecInfo = nullptr;
pFragmentSpecInfo = &fragmentSpecializationInfo;
init(pLogicalDevice, format, imageExtent, inputImages, outputImages, pConfig);
}
CasEffect::~CasEffect()
{
}
} // namespace vkBasalt
| 30.980392
| 86
| 0.635443
|
stephanlachnit
|
aed3281640470573c0c4ef23e1888bd1b850ecee
| 403
|
cpp
|
C++
|
Rafflesia/main.cpp
|
TelepathicFart/Rafflesia
|
9376e06b5a7ab3f712677f31504021c1b62c3f09
|
[
"MIT"
] | 5
|
2021-05-11T02:52:31.000Z
|
2021-09-03T05:10:53.000Z
|
Rafflesia/main.cpp
|
TelepathicFart/Rafflesia
|
9376e06b5a7ab3f712677f31504021c1b62c3f09
|
[
"MIT"
] | null | null | null |
Rafflesia/main.cpp
|
TelepathicFart/Rafflesia
|
9376e06b5a7ab3f712677f31504021c1b62c3f09
|
[
"MIT"
] | 1
|
2022-02-24T13:56:26.000Z
|
2022-02-24T13:56:26.000Z
|
#include <QtWidgets>
#include "MainWindow.h"
#include <istream>
#include <fstream>
int main(int argc, char *argv[])
{
#if defined(Q_OS_WIN)
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
QApplication app(argc, argv);
MainWindow window;
window.show();
window.setWindowTitle(QApplication::translate("toplevel", "Top-level widget"));
return app.exec();
}
| 18.318182
| 83
| 0.704715
|
TelepathicFart
|
aed923244e3a075b6566c3fb94879181634bcba8
| 1,094
|
cpp
|
C++
|
projects/Test_SkeletalAnimation/src/main.cpp
|
codeonwort/pathosengine
|
ea568afeac9af3ebe3f2e53cc5abeecb40714466
|
[
"MIT"
] | 11
|
2016-08-30T12:01:35.000Z
|
2021-12-29T15:34:03.000Z
|
projects/Test_SkeletalAnimation/src/main.cpp
|
codeonwort/pathosengine
|
ea568afeac9af3ebe3f2e53cc5abeecb40714466
|
[
"MIT"
] | 9
|
2016-05-19T03:14:22.000Z
|
2021-01-17T05:45:52.000Z
|
projects/Test_SkeletalAnimation/src/main.cpp
|
codeonwort/pathosengine
|
ea568afeac9af3ebe3f2e53cc5abeecb40714466
|
[
"MIT"
] | null | null | null |
#include "world2.h"
#include "pathos/core_minimal.h"
using namespace std;
using namespace pathos;
constexpr int32 WINDOW_WIDTH = 1920;
constexpr int32 WINDOW_HEIGHT = 1080;
constexpr char* WINDOW_TITLE = "Test: Skeletal Animation";
constexpr float FOVY = 60.0f;
const vector3 CAMERA_POSITION = vector3(0.0f, 0.0f, 300.0f);
constexpr float CAMERA_Z_NEAR = 1.0f;
constexpr float CAMERA_Z_FAR = 10000.0f;
int main(int argc, char** argv) {
EngineConfig conf;
conf.windowWidth = WINDOW_WIDTH;
conf.windowHeight = WINDOW_HEIGHT;
conf.title = WINDOW_TITLE;
conf.rendererType = ERendererType::Deferred;
Engine::init(argc, argv, conf);
const float ar = static_cast<float>(conf.windowWidth) / static_cast<float>(conf.windowHeight);
World* world2 = new World2;
world2->getCamera().lookAt(CAMERA_POSITION, CAMERA_POSITION + vector3(0.0f, 0.0f, -1.0f), vector3(0.0f, 1.0f, 0.0f));
world2->getCamera().changeLens(PerspectiveLens(FOVY, ar, CAMERA_Z_NEAR, CAMERA_Z_FAR));
gEngine->setWorld(world2);
gEngine->start();
return 0;
}
| 33.151515
| 118
| 0.710238
|
codeonwort
|
aede19bebef2025d433365c92bd970cd74a809aa
| 57
|
hpp
|
C++
|
src/boost_fusion_sequence_comparison_equal_to.hpp
|
miathedev/BoostForArduino
|
919621dcd0c157094bed4df752b583ba6ea6409e
|
[
"BSL-1.0"
] | 10
|
2018-03-17T00:58:42.000Z
|
2021-07-06T02:48:49.000Z
|
src/boost_fusion_sequence_comparison_equal_to.hpp
|
miathedev/BoostForArduino
|
919621dcd0c157094bed4df752b583ba6ea6409e
|
[
"BSL-1.0"
] | 2
|
2021-03-26T15:17:35.000Z
|
2021-05-20T23:55:08.000Z
|
src/boost_fusion_sequence_comparison_equal_to.hpp
|
miathedev/BoostForArduino
|
919621dcd0c157094bed4df752b583ba6ea6409e
|
[
"BSL-1.0"
] | 4
|
2019-05-28T21:06:37.000Z
|
2021-07-06T03:06:52.000Z
|
#include <boost/fusion/sequence/comparison/equal_to.hpp>
| 28.5
| 56
| 0.824561
|
miathedev
|
aede8903b4395c28d2a04d5f065094bba39c31da
| 3,738
|
cpp
|
C++
|
Engine/Core/Source/Molten/Renderer/Vulkan/Utility/VulkanDeviceQueues.cpp
|
jimmiebergmann/CurseEngine
|
74a0502e36327f893c8e4f3e7cbe5b9d38fbe194
|
[
"MIT"
] | 2
|
2019-11-11T21:17:14.000Z
|
2019-11-11T22:07:26.000Z
|
Engine/Core/Source/Molten/Renderer/Vulkan/Utility/VulkanDeviceQueues.cpp
|
jimmiebergmann/CurseEngine
|
74a0502e36327f893c8e4f3e7cbe5b9d38fbe194
|
[
"MIT"
] | null | null | null |
Engine/Core/Source/Molten/Renderer/Vulkan/Utility/VulkanDeviceQueues.cpp
|
jimmiebergmann/CurseEngine
|
74a0502e36327f893c8e4f3e7cbe5b9d38fbe194
|
[
"MIT"
] | 1
|
2020-04-05T03:50:57.000Z
|
2020-04-05T03:50:57.000Z
|
/*
* MIT License
*
* Copyright (c) 2021 Jimmie Bergmann
*
* 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.
*
*/
#if defined(MOLTEN_ENABLE_VULKAN)
#include "Molten/Renderer/Vulkan/Utility/VulkanDeviceQueues.hpp"
MOLTEN_UNSCOPED_ENUM_BEGIN
namespace Molten::Vulkan
{
// Device queue indices implemenetations.
DeviceQueueIndices::DeviceQueueIndices() :
graphicsQueue{},
presentQueue{}
{}
// Device queues implementations.
DeviceQueues::DeviceQueues() :
graphicsQueue(VK_NULL_HANDLE),
presentQueue(VK_NULL_HANDLE),
graphicsQueueIndex(0),
presentQueueIndex(0)
{}
// Static implementations.
void FetchQueueFamilyProperties(
QueueFamilyProperties& queueFamilyProperties,
VkPhysicalDevice physicalDevice)
{
queueFamilyProperties.clear();
uint32_t queueFamilyCount = 0;
vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, &queueFamilyCount, nullptr);
if (!queueFamilyCount)
{
return;
}
queueFamilyProperties.resize(queueFamilyCount);
vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, &queueFamilyCount, queueFamilyProperties.data());
}
bool FindRenderableDeviceQueueIndices(
DeviceQueueIndices& queueIndices,
VkPhysicalDevice physicalDevice,
const VkSurfaceKHR surface,
const QueueFamilyProperties& queueFamilies)
{
queueIndices.graphicsQueue.reset();
queueIndices.presentQueue.reset();
uint32_t finalGraphicsQueueIndex = 0;
uint32_t finalPresentQueueIndex = 0;
bool graphicsFamilySupport = false;
bool presentFamilySupport = false;
for (uint32_t i = 0; i < queueFamilies.size(); i++)
{
auto& queueFamily = queueFamilies[i];
if (queueFamily.queueFlags & VK_QUEUE_GRAPHICS_BIT)
{
graphicsFamilySupport = true;
finalGraphicsQueueIndex = i;
}
VkBool32 presentSupport = false;
vkGetPhysicalDeviceSurfaceSupportKHR(physicalDevice, i, surface, &presentSupport);
if (presentSupport)
{
presentFamilySupport = true;
finalPresentQueueIndex = i;
}
if (graphicsFamilySupport && presentFamilySupport)
{
break;
}
}
if (!graphicsFamilySupport || !presentFamilySupport)
{
return false;
}
queueIndices.graphicsQueue = finalGraphicsQueueIndex;
queueIndices.presentQueue = finalPresentQueueIndex;
return true;
}
}
MOLTEN_UNSCOPED_ENUM_END
#endif
| 30.390244
| 114
| 0.67817
|
jimmiebergmann
|
aef16175f836f498e1d48ed7f35241eb600ad19a
| 1,860
|
cpp
|
C++
|
Paladin/BuildSystem/FileFactory.cpp
|
pahefu/Paladin
|
4fcb66c6cda7bb50b7597532bd0d7469fc33655b
|
[
"MIT"
] | 45
|
2018-10-05T21:50:17.000Z
|
2022-01-31T11:52:59.000Z
|
Paladin/BuildSystem/FileFactory.cpp
|
pahefu/Paladin
|
4fcb66c6cda7bb50b7597532bd0d7469fc33655b
|
[
"MIT"
] | 163
|
2018-10-01T23:52:12.000Z
|
2022-02-15T18:05:58.000Z
|
Paladin/BuildSystem/FileFactory.cpp
|
pahefu/Paladin
|
4fcb66c6cda7bb50b7597532bd0d7469fc33655b
|
[
"MIT"
] | 9
|
2018-10-01T23:48:02.000Z
|
2022-01-23T21:28:52.000Z
|
#include "FileFactory.h"
#include "DPath.h"
#include "SourceType.h"
#include "SourceTypeC.h"
#include "SourceTypeLex.h"
#include "SourceTypeLib.h"
#include "SourceTypeResource.h"
#include "SourceTypeRez.h"
#include "SourceTypeShell.h"
#include "SourceTypeText.h"
#include "SourceTypeYacc.h"
FileFactory gFileFactory;
FileFactory::FileFactory(void)
: fList(20,true)
{
LoadTypes();
}
void
FileFactory::LoadTypes(void)
{
// We have this method to update the types. If we had addons to support
// different types, we would be loading those here, too.
fList.AddItem(new SourceTypeC);
fList.AddItem(new SourceTypeLex);
fList.AddItem(new SourceTypeLib);
fList.AddItem(new SourceTypeResource);
fList.AddItem(new SourceTypeRez);
fList.AddItem(new SourceTypeShell);
fList.AddItem(new SourceTypeYacc);
fList.AddItem(new SourceTypeText);
}
SourceFile *
FileFactory::CreateSourceFileItem(const char *path)
{
if (!path)
return NULL;
DPath file(path);
for (int32 i = 0; i < fList.CountItems(); i++)
{
SourceType *item = fList.ItemAt(i);
if (item->HasExtension(file.GetExtension()))
return item->CreateSourceFileItem(path);
}
// The default source file class doesn't do anything significant
SourceFile *sourcefile = new SourceFile(path);
sourcefile->SetBuildFlag(BUILD_NO);
return sourcefile;
}
entry_ref
FileFactory::CreateSourceFile(const char *folder, const char *name, uint32 options)
{
DPath filename(name);
SourceType *type = FindTypeForExtension(filename.GetExtension());
if (!type)
return entry_ref();
return type->CreateSourceFile(folder, name, options);
}
SourceType *
FileFactory::FindTypeForExtension(const char *ext)
{
for (int32 i = 0; i < fList.CountItems(); i++)
{
SourceType *type = fList.ItemAt(i);
if (!type)
continue;
if (type->HasExtension(ext))
return type;
}
return NULL;
}
| 20.666667
| 83
| 0.73172
|
pahefu
|
aef5cba87650b7ddc70acc522f6603139805e75e
| 101
|
hpp
|
C++
|
exercises/4/seminar/8/Matrix/Matrix/utility.hpp
|
triffon/oop-2019-20
|
db199631d59ddefdcc0c8eb3d689de0095618f92
|
[
"MIT"
] | 19
|
2020-02-21T16:46:50.000Z
|
2022-01-26T19:59:49.000Z
|
exercises/4/seminar/9/Matrix/Matrix/utility.hpp
|
triffon/oop-2019-20
|
db199631d59ddefdcc0c8eb3d689de0095618f92
|
[
"MIT"
] | 1
|
2020-03-14T08:09:45.000Z
|
2020-03-14T08:09:45.000Z
|
exercises/4/seminar/8/Matrix - Complete/Matrix/utility.hpp
|
triffon/oop-2019-20
|
db199631d59ddefdcc0c8eb3d689de0095618f92
|
[
"MIT"
] | 11
|
2020-02-23T12:29:58.000Z
|
2021-04-11T08:30:12.000Z
|
#ifndef UTILITY
#define UTILITY
namespace utility {
int gcd(int a, int b);
}
#endif // !UTILITY
| 12.625
| 26
| 0.673267
|
triffon
|
aef61af9e9f86157b2a0dd6386cbb49269321f3f
| 2,670
|
cpp
|
C++
|
Interaction/albaAgentEventHandler.cpp
|
IOR-BIC/ALBA
|
b574968b05d9a3a2756dd2ac61d015a0d20232a4
|
[
"Apache-2.0",
"BSD-3-Clause"
] | 9
|
2018-11-19T10:15:29.000Z
|
2021-08-30T11:52:07.000Z
|
Interaction/albaAgentEventHandler.cpp
|
IOR-BIC/ALBA
|
b574968b05d9a3a2756dd2ac61d015a0d20232a4
|
[
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null |
Interaction/albaAgentEventHandler.cpp
|
IOR-BIC/ALBA
|
b574968b05d9a3a2756dd2ac61d015a0d20232a4
|
[
"Apache-2.0",
"BSD-3-Clause"
] | 3
|
2018-06-10T22:56:29.000Z
|
2019-12-12T06:22:56.000Z
|
/*=========================================================================
Program: Multimod Fundation Library
Module: $RCSfile: albaAgentEventHandler.cpp,v $
Language: C++
Date: $Date: 2006-06-14 14:46:33 $
Version: $Revision: 1.4 $
=========================================================================*/
#include "albaDefines.h" //SIL
#include "albaDecl.h"
#include "albaAgentEventHandler.h"
//----------------------------------------------------------------------------
// Constants
//----------------------------------------------------------------------------
enum DISPATCH_ENUM {ID_DISPATCH_EVENT = MINID};
enum WX_EVENT_ALBA { wxEVT_ALBA = 12000 /* SIL: wxEVT_USER_FIRST*/ + 1234 };
//----------------------------------------------------------------------------
class albaWXEventHandler:public wxEvtHandler
//----------------------------------------------------------------------------
{
protected:
virtual bool ProcessEvent(wxEvent& event);
public:
albaAgentEventHandler *m_Dispatcher;
};
//----------------------------------------------------------------------------
bool albaWXEventHandler::ProcessEvent(wxEvent& event)
//----------------------------------------------------------------------------
{
if (event.GetId()==ID_DISPATCH_EVENT)
{
if (m_Dispatcher)
{
m_Dispatcher->DispatchEvents();
}
}
return true;
}
//------------------------------------------------------------------------------
// Events
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
albaCxxTypeMacro(albaAgentEventHandler);
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
albaAgentEventHandler::albaAgentEventHandler()
//------------------------------------------------------------------------------
{
m_EventHandler = new albaWXEventHandler;
m_EventHandler->m_Dispatcher=this;
}
//------------------------------------------------------------------------------
albaAgentEventHandler::~albaAgentEventHandler()
//------------------------------------------------------------------------------
{
delete m_EventHandler;
//albaWarningMacro("Destroying albaAgentEventHandler");
}
//------------------------------------------------------------------------------
void albaAgentEventHandler::RequestForDispatching()
//------------------------------------------------------------------------------
{
wxIdleEvent wx_event;
wx_event.SetId(ID_DISPATCH_EVENT);
wxPostEvent(m_EventHandler,wx_event);
}
| 33.375
| 80
| 0.345693
|
IOR-BIC
|
aef6d7bb7d3fb685be390278a8c563fcd24b89ed
| 223
|
cpp
|
C++
|
example/generate_word_example.cpp
|
arapelle/wgen
|
53471bd78e7fd64c780f04cd132047e20abf254f
|
[
"MIT"
] | 1
|
2020-06-02T07:25:37.000Z
|
2020-06-02T07:25:37.000Z
|
example/generate_word_example.cpp
|
arapelle/wgen
|
53471bd78e7fd64c780f04cd132047e20abf254f
|
[
"MIT"
] | 6
|
2020-08-28T10:52:25.000Z
|
2020-11-02T18:59:49.000Z
|
example/generate_word_example.cpp
|
arapelle/wgen
|
53471bd78e7fd64c780f04cd132047e20abf254f
|
[
"MIT"
] | 1
|
2020-09-04T10:36:23.000Z
|
2020-09-04T10:36:23.000Z
|
#include <wgen/default_syllabary.hpp>
#include <iostream>
int main()
{
wgen::default_syllabary syllabary;
std::string word = syllabary.random_word(7);
std::cout << word << std::endl;
return EXIT_SUCCESS;
}
| 20.272727
| 48
| 0.686099
|
arapelle
|
aefc2e747d34818630c7f0d8f2d53317886ac392
| 3,739
|
cpp
|
C++
|
Testing/Gui/16_testRWI/testRWILogic.cpp
|
IOR-BIC/ALBA
|
b574968b05d9a3a2756dd2ac61d015a0d20232a4
|
[
"Apache-2.0",
"BSD-3-Clause"
] | 9
|
2018-11-19T10:15:29.000Z
|
2021-08-30T11:52:07.000Z
|
Testing/Gui/16_testRWI/testRWILogic.cpp
|
IOR-BIC/ALBA
|
b574968b05d9a3a2756dd2ac61d015a0d20232a4
|
[
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null |
Testing/Gui/16_testRWI/testRWILogic.cpp
|
IOR-BIC/ALBA
|
b574968b05d9a3a2756dd2ac61d015a0d20232a4
|
[
"Apache-2.0",
"BSD-3-Clause"
] | 3
|
2018-06-10T22:56:29.000Z
|
2019-12-12T06:22:56.000Z
|
/*=========================================================================
Program: ALBA (Agile Library for Biomedical Applications)
Module: testRWILogic
Authors: Silvano Imboden
Copyright (c) BIC
All rights reserved. See Copyright.txt or
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "albaDefines.h"
//----------------------------------------------------------------------------
// NOTE: Every CPP file in the ALBA must include "albaDefines.h" as first.
// This force to include Window,wxWidgets and VTK exactly in this order.
// Failing in doing this will result in a run-time error saying:
// "Failure#0: The value of ESP was not properly saved across a function call"
//----------------------------------------------------------------------------
#include "testRWILogic.h"
#include "albaDecl.h"
#include "albaGUI.h"
#include "testRWIBaseDlg.h"
#include "testRWIDlg.h"
//--------------------------------------------------------------------------------
//const:
//--------------------------------------------------------------------------------
enum
{
ID_D1 = MINID,
ID_D2,
ID_D3,
};
//--------------------------------------------------------------------------------
testRWILogic::testRWILogic()
//--------------------------------------------------------------------------------
{
/**todo: PAOLO please read here */
// RESULT OF RWI TEST :
// RWIBASE produce a memory leak 5600 byte long, as follow -- by me (Silvano) this is not considered an error but a feature :-)
// C:\Program Files\VisualStudio7\Vc7\include\crtdbg.h(689) : {2804} normal block at 0x099C00A8, 5600 bytes long.
// Data: < Buil> 00 00 00 00 00 00 00 00 00 00 00 00 42 75 69 6C
// Object dump complete.
// the leaks is always 5600 bytes long, doesn't matter how many instances of RWI you have created,
// so maybe it is related to something concerned with the initialization of the OpenGL context,
// and the real problem could be in my NVidia OpenGL Driver
m_win = new wxFrame(NULL,-1,"TestRWI",wxDefaultPosition,wxDefaultSize,
wxMINIMIZE_BOX | wxMAXIMIZE_BOX | /*wxRESIZE_BORDER |*/ wxSYSTEM_MENU | wxCAPTION );
albaSetFrame(m_win);
albaGUI *gui = new albaGUI(this);
gui->Divider();
gui->Label("Examples of VTK RenderWindow");
gui->Button(ID_D1,"test RWIBase");
gui->Button(ID_D2,"test RWI");
gui->Label("");
gui->Label("");
gui->Button(ID_D3,"quit");
gui->Reparent(m_win);
m_win->Fit(); // resize m_win to fit it's content
}
//--------------------------------------------------------------------------------
testRWILogic::~testRWILogic()
//--------------------------------------------------------------------------------
{
}
//--------------------------------------------------------------------------------
void testRWILogic::OnEvent(albaEventBase *alba_event)
//--------------------------------------------------------------------------------
{
if (albaEvent *e = albaEvent::SafeDownCast(alba_event))
{
switch(e->GetId())
{
case ID_D1:
{
testRWIBaseDlg d("test RWIBase");
d.ShowModal();
}
break;
case ID_D2:
{
testRWIDlg d("test RWI");
d.ShowModal();
}
break;
case ID_D3:
m_win->Destroy();
break;
}
}
}
//--------------------------------------------------------------------------------
void testRWILogic::Show()
//--------------------------------------------------------------------------------
{
m_win->Show(true);
}
| 33.088496
| 129
| 0.472319
|
IOR-BIC
|
aefc38192acba82870d5413f54a656d15199680b
| 511
|
cpp
|
C++
|
problems/acmicpc_14935.cpp
|
qawbecrdtey/BOJ-sol
|
e3f410e8f4e3a6ade51b68ce2024529870edac64
|
[
"MIT"
] | null | null | null |
problems/acmicpc_14935.cpp
|
qawbecrdtey/BOJ-sol
|
e3f410e8f4e3a6ade51b68ce2024529870edac64
|
[
"MIT"
] | null | null | null |
problems/acmicpc_14935.cpp
|
qawbecrdtey/BOJ-sol
|
e3f410e8f4e3a6ade51b68ce2024529870edac64
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include <string>
#include <vector>
using namespace std;
void f(string &s,int x){
if(x<10){s.push_back(x+'0');return;}
f(s,x/10);
s.push_back(x%10+'0');
}
int main(){
string s;
cin>>s;
vector<string> v;
while(true){
for(auto str:v){
if(s==str)goto A;
}
v.push_back(s);
int x=(s[0]-'0')*(s.length());
string t;
f(t,x);
if(s==t)goto B;
s=t;
}
A: printf("N");
B: printf("FA");
}
| 18.925926
| 40
| 0.471624
|
qawbecrdtey
|
4e05c6ff8543a5859c72437968dd4af1e056ef18
| 253
|
cpp
|
C++
|
server/src/DatabaseProxy/PostgresqlProxy.cpp
|
yuryloshmanov/messenger
|
98c2129cf2b5ca7e00cc5c1ba90535acf8be0ba1
|
[
"MIT"
] | null | null | null |
server/src/DatabaseProxy/PostgresqlProxy.cpp
|
yuryloshmanov/messenger
|
98c2129cf2b5ca7e00cc5c1ba90535acf8be0ba1
|
[
"MIT"
] | null | null | null |
server/src/DatabaseProxy/PostgresqlProxy.cpp
|
yuryloshmanov/messenger
|
98c2129cf2b5ca7e00cc5c1ba90535acf8be0ba1
|
[
"MIT"
] | null | null | null |
/**
* @file PostgresqlProxy.cpp
* @date 22 Feb 2022
* @author Yury Loshmanov
*/
#include "../../include/DatabaseProxy/PostgresqlProxy.hpp"
PostgresqlProxy::PostgresqlProxy(const std::string &endPoint) : connection(endPoint), work(connection) {
}
| 21.083333
| 104
| 0.72332
|
yuryloshmanov
|
4e1306360ebcb70ea72f14a0dd65f5090fec2721
| 961
|
hpp
|
C++
|
include/codegen/include/System/IServiceProvider.hpp
|
Futuremappermydud/Naluluna-Modifier-Quest
|
bfda34370764b275d90324b3879f1a429a10a873
|
[
"MIT"
] | 1
|
2021-11-12T09:29:31.000Z
|
2021-11-12T09:29:31.000Z
|
include/codegen/include/System/IServiceProvider.hpp
|
Futuremappermydud/Naluluna-Modifier-Quest
|
bfda34370764b275d90324b3879f1a429a10a873
|
[
"MIT"
] | null | null | null |
include/codegen/include/System/IServiceProvider.hpp
|
Futuremappermydud/Naluluna-Modifier-Quest
|
bfda34370764b275d90324b3879f1a429a10a873
|
[
"MIT"
] | 2
|
2021-10-03T02:14:20.000Z
|
2021-11-12T09:29:36.000Z
|
// Autogenerated from CppHeaderCreator
// Created by Sc2ad
// =========================================================================
#pragma once
#pragma pack(push, 8)
// Begin includes
// Completed includes
// Begin forward declares
// Forward declaring namespace: System
namespace System {
// Forward declaring type: Type
class Type;
}
// Completed forward declares
// Begin il2cpp-utils forward declares
struct Il2CppObject;
// Completed il2cpp-utils forward declares
// Type namespace: System
namespace System {
// Autogenerated type: System.IServiceProvider
class IServiceProvider {
public:
// public System.Object GetService(System.Type serviceType)
// Offset: 0xFFFFFFFF
::Il2CppObject* GetService(System::Type* serviceType);
}; // System.IServiceProvider
}
#include "extern/beatsaber-hook/shared/utils/il2cpp-type-check.hpp"
DEFINE_IL2CPP_ARG_TYPE(System::IServiceProvider*, "System", "IServiceProvider");
#pragma pack(pop)
| 31
| 80
| 0.700312
|
Futuremappermydud
|
4e13dd68b9e7fa96e93e3acd2797d589a6269baf
| 2,019
|
cc
|
C++
|
core/src/psfcore/unused/psftest.cc
|
ma-laforge/LibPSFC.jl
|
73a5176ca78cade63cc9c5da4d15b36f9042645c
|
[
"MIT"
] | null | null | null |
core/src/psfcore/unused/psftest.cc
|
ma-laforge/LibPSFC.jl
|
73a5176ca78cade63cc9c5da4d15b36f9042645c
|
[
"MIT"
] | null | null | null |
core/src/psfcore/unused/psftest.cc
|
ma-laforge/LibPSFC.jl
|
73a5176ca78cade63cc9c5da4d15b36f9042645c
|
[
"MIT"
] | null | null | null |
#include "psf.h"
#include "psfdata.h"
#include <string>
void noisesummary() {
std::string pnoisefile("/nfs/home/henrik/spectre/1/pnoise.raw/pnoise_pout3g.pnoise");
PSFDataSet psfnoise(pnoisefile);
std::vector<std::string> names = psfnoise.get_signal_names();
double sum=0;
for(std::vector<std::string>::iterator i=names.begin(); i != names.end(); i++) {
if(*i != std::string("out")) {
StructVector *valvec = dynamic_cast<StructVector *>(psfnoise.get_signal_vector(*i));
Struct& data = (*valvec)[3];
if(data.find(std::string("total")) != data.end())
sum += (double)*data[std::string("total")];
delete(valvec);
}
}
std::cout << "Total: " << sum << std::endl;
}
int main() {
std::string dcopfile("../examples/data/opBegin");
std::string pssfdfile("../examples/data/pss0.fd.pss");
std::string tranfile("../examples/data/timeSweep");
std::string srcsweepfile("../examples/data/srcSweep");
// PSFDataSet psftran(tranfile);
// PSFDataSet pssfd(pssfdfile);
// PSFDataSet pssop(dcopfile);
PSFDataSet srcsweep(srcsweepfile);
noisesummary();
//pssop.get_signal_properties("XIRXRFMIXTRIM0.XRDAC4.XR.R1");
std::cout << "Header properties:" << std::endl;
PropertyMap headerprops(srcsweep.get_header_properties());
for(PropertyMap::iterator i=headerprops.begin(); i!=headerprops.end(); i++)
std::cout << i->first << ":" << *i->second << std::endl;
// {
// Float64Vector *parvec = (Float64Vector *)psfnoise.get_param_values();
// }
// Float64Vector *parvec = (Float64Vector *)psftran.get_param_values();
// for(Float64Vector::iterator i=parvec->begin(); i!=parvec->end(); i++)
// std::cout << *i << " ";
// std::cout << std::endl;
// std::cout << "len=" << parvec->size() << std::endl;
//PSFDataVector *valvec = psf.get_signal_vector("tx_lopath_hb_stop.tx_lopath_hb_top.tx_lopath_hb_driver.driver_hb_channel_q.Ismall.Idriver_n.nout_off.imod");
}
| 32.047619
| 161
| 0.634968
|
ma-laforge
|
4e15065ca2ce0f75964a8116c46a77e630f247fe
| 5,766
|
cpp
|
C++
|
src/qt/i2poptionswidget.cpp
|
eddef/anoncoin
|
7a018e15c814bba30e805cfe83f187388eadc0a8
|
[
"MIT"
] | 90
|
2015-01-13T14:32:43.000Z
|
2020-10-15T23:07:11.000Z
|
src/qt/i2poptionswidget.cpp
|
nonlinear-chaos-order-etc-etal/anoncoin
|
5e441d8746240072f1379577e14ff7a17390b81f
|
[
"MIT"
] | 91
|
2015-01-07T03:44:14.000Z
|
2020-12-24T13:56:27.000Z
|
src/qt/i2poptionswidget.cpp
|
nonlinear-chaos-order-etc-etal/anoncoin
|
5e441d8746240072f1379577e14ff7a17390b81f
|
[
"MIT"
] | 42
|
2015-01-28T12:34:14.000Z
|
2021-05-06T16:16:48.000Z
|
// Copyright (c) 2013-2014 The Anoncoin Core developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
// Many builder specific things set in the config file, don't see a need for it here, still better to not forget to include it in your source files.
#if defined(HAVE_CONFIG_H)
#include "config/anoncoin-config.h"
#endif
#include "i2poptionswidget.h"
#include "ui_i2poptionswidget.h"
#include "optionsmodel.h"
#include "monitoreddatamapper.h"
#include "i2pshowaddresses.h"
#include "util.h"
#include "clientmodel.h"
I2POptionsWidget::I2POptionsWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::I2POptionsWidget),
clientModel(0)
{
ui->setupUi(this);
QObject::connect(ui->pushButtonCurrentI2PAddress, SIGNAL(clicked()), this, SLOT(ShowCurrentI2PAddress()));
QObject::connect(ui->pushButtonGenerateI2PAddress, SIGNAL(clicked()), this, SLOT(GenerateNewI2PAddress()));
QObject::connect(ui->checkBoxAllowZeroHop , SIGNAL(stateChanged(int)) , this, SIGNAL(settingsChanged()));
QObject::connect(ui->checkBoxInboundAllowZeroHop , SIGNAL(stateChanged(int)) , this, SIGNAL(settingsChanged()));
QObject::connect(ui->checkBoxUseI2POnly , SIGNAL(stateChanged(int)) , this, SIGNAL(settingsChanged()));
QObject::connect(ui->lineEditSAMHost , SIGNAL(textChanged(QString)), this, SIGNAL(settingsChanged()));
QObject::connect(ui->lineEditTunnelName , SIGNAL(textChanged(QString)), this, SIGNAL(settingsChanged()));
QObject::connect(ui->spinBoxInboundBackupQuality , SIGNAL(valueChanged(int)) , this, SIGNAL(settingsChanged()));
QObject::connect(ui->spinBoxInboundIPRestriction , SIGNAL(valueChanged(int)) , this, SIGNAL(settingsChanged()));
QObject::connect(ui->spinBoxInboundLength , SIGNAL(valueChanged(int)) , this, SIGNAL(settingsChanged()));
QObject::connect(ui->spinBoxInboundLengthVariance , SIGNAL(valueChanged(int)) , this, SIGNAL(settingsChanged()));
QObject::connect(ui->spinBoxInboundQuantity , SIGNAL(valueChanged(int)) , this, SIGNAL(settingsChanged()));
QObject::connect(ui->spinBoxOutboundBackupQuantity, SIGNAL(valueChanged(int)) , this, SIGNAL(settingsChanged()));
QObject::connect(ui->spinBoxOutboundIPRestriction , SIGNAL(valueChanged(int)) , this, SIGNAL(settingsChanged()));
QObject::connect(ui->spinBoxOutboundLength , SIGNAL(valueChanged(int)) , this, SIGNAL(settingsChanged()));
QObject::connect(ui->spinBoxOutboundLengthVariance, SIGNAL(valueChanged(int)) , this, SIGNAL(settingsChanged()));
QObject::connect(ui->spinBoxOutboundPriority , SIGNAL(valueChanged(int)) , this, SIGNAL(settingsChanged()));
QObject::connect(ui->spinBoxOutboundQuantity , SIGNAL(valueChanged(int)) , this, SIGNAL(settingsChanged()));
QObject::connect(ui->spinBoxSAMPort , SIGNAL(valueChanged(int)) , this, SIGNAL(settingsChanged()));
}
I2POptionsWidget::~I2POptionsWidget()
{
delete ui;
}
void I2POptionsWidget::setMapper(MonitoredDataMapper& mapper)
{
mapper.addMapping(ui->checkBoxUseI2POnly , OptionsModel::eI2PUseI2POnly);
mapper.addMapping(ui->lineEditSAMHost , OptionsModel::eI2PSAMHost);
mapper.addMapping(ui->spinBoxSAMPort , OptionsModel::eI2PSAMPort);
mapper.addMapping(ui->lineEditTunnelName , OptionsModel::eI2PSessionName);
mapper.addMapping(ui->spinBoxInboundQuantity , OptionsModel::I2PInboundQuantity);
mapper.addMapping(ui->spinBoxInboundLength , OptionsModel::I2PInboundLength);
mapper.addMapping(ui->spinBoxInboundLengthVariance , OptionsModel::I2PInboundLengthVariance);
mapper.addMapping(ui->spinBoxInboundBackupQuality , OptionsModel::I2PInboundBackupQuantity);
mapper.addMapping(ui->checkBoxInboundAllowZeroHop , OptionsModel::I2PInboundAllowZeroHop);
mapper.addMapping(ui->spinBoxInboundIPRestriction , OptionsModel::I2PInboundIPRestriction);
mapper.addMapping(ui->spinBoxOutboundQuantity , OptionsModel::I2POutboundQuantity);
mapper.addMapping(ui->spinBoxOutboundLength , OptionsModel::I2POutboundLength);
mapper.addMapping(ui->spinBoxOutboundLengthVariance, OptionsModel::I2POutboundLengthVariance);
mapper.addMapping(ui->spinBoxOutboundBackupQuantity, OptionsModel::I2POutboundBackupQuantity);
mapper.addMapping(ui->checkBoxAllowZeroHop , OptionsModel::I2POutboundAllowZeroHop);
mapper.addMapping(ui->spinBoxOutboundIPRestriction , OptionsModel::I2POutboundIPRestriction);
mapper.addMapping(ui->spinBoxOutboundPriority , OptionsModel::I2POutboundPriority);
}
void I2POptionsWidget::setModel(ClientModel* model)
{
clientModel = model;
}
void I2POptionsWidget::ShowCurrentI2PAddress()
{
if (clientModel)
{
const QString pub = clientModel->getPublicI2PKey();
const QString priv = clientModel->getPrivateI2PKey();
const QString b32 = clientModel->getB32Address(pub);
const QString configFile = QString::fromStdString(GetConfigFile().string());
ShowI2PAddresses i2pCurrDialog("Your current I2P-address", pub, priv, b32, configFile, this);
i2pCurrDialog.exec();
}
}
void I2POptionsWidget::GenerateNewI2PAddress()
{
if (clientModel)
{
QString pub, priv;
clientModel->generateI2PDestination(pub, priv);
const QString b32 = clientModel->getB32Address(pub);
const QString configFile = QString::fromStdString(GetConfigFile().string());
ShowI2PAddresses i2pCurrDialog("Generated I2P address", pub, priv, b32, configFile, this);
i2pCurrDialog.exec();
}
}
| 52.899083
| 148
| 0.73153
|
eddef
|
4e17b9dc4559616a2786013d641833dbddf34747
| 2,588
|
cpp
|
C++
|
manager/spline/spline_manager.cpp
|
aconstlink/snakeoil
|
3c6e02655e1134f8422f01073090efdde80fc109
|
[
"MIT"
] | 1
|
2017-08-11T19:12:24.000Z
|
2017-08-11T19:12:24.000Z
|
manager/spline/spline_manager.cpp
|
aconstlink/snakeoil
|
3c6e02655e1134f8422f01073090efdde80fc109
|
[
"MIT"
] | 11
|
2018-07-07T20:09:44.000Z
|
2020-02-16T22:45:09.000Z
|
manager/spline/spline_manager.cpp
|
aconstlink/snakeoil
|
3c6e02655e1134f8422f01073090efdde80fc109
|
[
"MIT"
] | null | null | null |
//------------------------------------------------------------
// snakeoil (c) Alexis Constantin Link
// Distributed under the MIT license
//------------------------------------------------------------
#include "spline_manager.h"
using namespace so_manager ;
//**********************************************************************************************
spline_manager::spline_manager( void_t )
{
}
//**********************************************************************************************
spline_manager::spline_manager( this_rref_t rhv )
{
_linears_res_mgr = std::move( rhv._linears_res_mgr ) ;
_counter = rhv._counter ;
}
//**********************************************************************************************
spline_manager::~spline_manager( void_t )
{
}
//**********************************************************************************************
spline_manager::this_ptr_t spline_manager::create( this_rref_t rhv, so_memory::purpose_cref_t p )
{
return so_manager::memory::alloc( std::move(rhv), p ) ;
}
//**********************************************************************************************
void_t spline_manager::destroy( this_ptr_t ptr )
{
so_manager::memory::dealloc( ptr ) ;
}
//**********************************************************************************************
bool_t spline_manager::acquire( so_manager::key_cref_t key_in,
so_resource::purpose_cref_t p, linears_handle_out_t hnd_out )
{
return _linears_res_mgr.acquire( key_in, p, hnd_out ) ;
}
//**********************************************************************************************
bool_t spline_manager::release( linears_handle_rref_t hnd )
{
return _linears_res_mgr.release( std::move(hnd) ) ;
}
//**********************************************************************************************
so_manager::result spline_manager::insert( so_manager::key_cref_t key_in,
linears_manage_params_cref_t mp )
{
linear_spline_store_item si ;
// fill si
auto si_ptr = so_manager::memory::alloc( std::move(si),
"[so_manager::spline_manager::insert] : linear spline store item for " + key_in ) ;
auto const res = _linears_res_mgr.insert( key_in, si_ptr ) ;
if( so_log::log::error( so_resource::no_success( res ),
"[so_manager::spline_manager::insert] : insert" ) )
{
so_manager::memory::dealloc( si_ptr ) ;
return so_manager::key_already_in_use;
}
return so_manager::ok ;
}
//**********************************************************************************************
| 35.452055
| 97
| 0.435471
|
aconstlink
|
4e1e89ed0e516be46415c2b1cf93c56d4e219c02
| 156
|
cpp
|
C++
|
PredPrey_Attempt2/main.cpp
|
08jne01/Predator-Prey-Attempt2
|
cfb1d259a73d3d038ca122cdf63e231968e93fa9
|
[
"MIT"
] | null | null | null |
PredPrey_Attempt2/main.cpp
|
08jne01/Predator-Prey-Attempt2
|
cfb1d259a73d3d038ca122cdf63e231968e93fa9
|
[
"MIT"
] | null | null | null |
PredPrey_Attempt2/main.cpp
|
08jne01/Predator-Prey-Attempt2
|
cfb1d259a73d3d038ca122cdf63e231968e93fa9
|
[
"MIT"
] | null | null | null |
#include "Header.h"
#include "Program.h"
int main()
{
sf::err().rdbuf(NULL);
Program p(700, 700, 2000, 100, 10, 0.0005, 0.01);
return p.mainLoop();
}
| 13
| 50
| 0.615385
|
08jne01
|
d6077ea40b8d56f29839f9970ac2762b305a2e24
| 8,750
|
cpp
|
C++
|
src/probability.cpp
|
Michael-Stevens-27/silverblaze
|
f0f001710589fe072545b00f0d3524fc993f4cbd
|
[
"MIT"
] | 3
|
2018-03-29T15:54:56.000Z
|
2018-10-15T18:28:59.000Z
|
src/probability.cpp
|
Michael-Stevens-27/silverblaze
|
f0f001710589fe072545b00f0d3524fc993f4cbd
|
[
"MIT"
] | 2
|
2020-02-11T20:44:25.000Z
|
2020-06-18T20:00:32.000Z
|
src/probability.cpp
|
Michael-Stevens-27/silverblaze
|
f0f001710589fe072545b00f0d3524fc993f4cbd
|
[
"MIT"
] | null | null | null |
#include <Rcpp.h>
#include <math.h>
#include "probability.h"
#include "misc.h"
using namespace std;
//------------------------------------------------
// draw a value from an exponential distribution with set rate parameter
double exp1(double rate){
return R::rexp(rate);
}
//------------------------------------------------
// draw a value from a chi squared distribution with set degrees of freedom
double rchisq1(double df){
return R::rchisq(df);
}
//------------------------------------------------
// draw from continuous uniform distribution on interval [0,1)
double runif_0_1() {
return R::runif(0,1);
}
//------------------------------------------------
// draw from continuous uniform distribution on interval [a,b)
double runif1(double a, double b) {
return R::runif(a,b);
}
//------------------------------------------------
// draw from Bernoulli(p) distribution
bool rbernoulli1(double p) {
return R::rbinom(1, p);
}
//------------------------------------------------
// draw from univariate normal distribution
double rnorm1(double mean, double sd) {
return R::rnorm(mean, sd);
}
//------------------------------------------------
// density of univariate normal distribution
double dnorm1(double x, double mean, double sd, bool log_on) {
return R::dnorm(x, mean, sd, log_on);
}
//------------------------------------------------
// density of log-normal distribution
double dlnorm1(double x, double meanlog, double sdlog, bool log_on) {
return R::dlnorm(x, meanlog, sdlog, log_on);
}
//------------------------------------------------
// draw from univariate normal distribution and reflect to interval (a,b)
double rnorm1_interval(double mean, double sd, double a, double b) {
// draw raw value relative to a
double ret = rnorm1(mean, sd) - a;
double interval_difference = b - a;
// std::cout << "Value " << ret << std::endl;
// reflect off boundries at 0 and (b-a)
if (ret < 0 || ret > interval_difference) {
// use multiple reflections to bring into range [-2(b-a), 2(b-a)]
double modded = std::fmod(ret, 2*interval_difference);
// use one more reflection to bring into range [0, (b-a)]
if (modded < 0) {
modded = -1*modded;
}
if (modded > interval_difference) {
modded = 2*interval_difference - modded;
}
ret = modded;
}
// no longer relative to a
ret += a;
// don't let ret equal exactly a or b
if (ret == a) {
ret += UNDERFLO;
} else if (ret == b) {
ret -= UNDERFLO;
}
return ret;
}
//------------------------------------------------
// sample single value from given probability vector (that sums to pSum)
int sample1(vector<double> &p, double pSum) {
double rand = pSum*runif_0_1();
double z = 0;
for (int i=0; i<int(p.size()); i++) {
z += p[i];
if (rand<z) {
return i+1;
}
}
return 0;
}
//------------------------------------------------
// sample single value x that lies between a and b (inclusive) with equal
// probability. Works on positive or negative values of a or b, and works
// irrespective of which of a or b is larger.
int sample2(int a, int b) {
if (a<b) {
return floor(runif1(a, b+1));
} else {
return floor(runif1(b, a+1));
}
}
//------------------------------------------------
// sample a given number of values from a vector without replacement (templated
// for different data types). Note, this function re-arranges the original
// vector (passed in by reference), and the result is stored in the first n
// elements.
// sample3
// DEFINED IN HEADER
//------------------------------------------------
// draw from gamma(shape,rate) distribution
// note all gamma functions from RCPP use a scale parameter in place of a rate,
// for more info see: https://teuder.github.io/rcpp4everyone_en/310_Rmath.html
// this is why all rates are inversed
double rgamma1(double shape, double rate) {
double x = R::rgamma(shape, 1/rate);
// check for zero or infinite values (catches bug present in Visual Studio 2010)
if (x<UNDERFLO) {
x = UNDERFLO;
}
if (x>OVERFLO) {
x = OVERFLO;
}
return x;
}
//------------------------------------------------
// density of gamma(shape,rate) distribution
double dgamma1(double x, double shape, double rate) {
double y = R::dgamma(x, shape, 1/rate, FALSE);
// check for zero or infinite values (catches bug present in Visual Studio 2010)
if (y<UNDERFLO) {
y = UNDERFLO;
}
if (y>OVERFLO) {
y = OVERFLO;
}
return y;
}
//------------------------------------------------
// draw from beta(alpha,beta) distribution
double rbeta1(double shape1, double shape2) {
if (shape1==1 && shape2==1) {
return runif_0_1();
}
return R::rbeta(shape1, shape2);
}
//------------------------------------------------
// probability density of beta(shape1,shape2) distribution
double dbeta1(double x, double shape1, double shape2, bool return_log) {
return R::dbeta(x, shape1, shape2, return_log);
}
//------------------------------------------------
// draw from dirichlet distribution using vector of shape parameters. Return vector of values.
vector<double> rdirichlet1(vector<double> &shapeVec) {
// draw a series of gamma random variables
int n = shapeVec.size();
vector<double> ret(n);
double retSum = 0;
for (int i=0; i<n; i++) {
ret[i] = rgamma1(shapeVec[i], 1.0);
retSum += ret[i];
}
// divide all by the sum
double retSumInv = 1.0/retSum;
for (int i=0; i<n; i++) {
ret[i] *= retSumInv;
}
return(ret);
}
//------------------------------------------------
// draw from dirichlet distribution using bespoke inputs. Outputs are stored in
// x, passed by reference for speed. Shape parameters are equal to alpha+beta,
// where alpha is an integer vector, and beta is a single double.
void rdirichlet2(std::vector<double> &x, std::vector<double> &alpha, double scale_factor) {
int n = x.size();
double xSum = 0;
for (int i = 0; i < n; i++) {
// print(alpha[i]);
x[i] = rgamma1(scale_factor*alpha[i], 1.0);
xSum += x[i];
}
double xSumInv = 1.0/xSum;
// print(scale_factor);
for (int i = 0; i < n; i++) {
x[i] *= xSumInv;
// print(x[i]);
if (x[i] <= UNDERFLO) {
x[i] = UNDERFLO;
}
}
}
//------------------------------------------------
// density of a dirichlet distribution in log space
double ddirichlet(std::vector<double> &x, std::vector<double> &alpha, double scale_factor) {
int n = x.size();
double logSum = 0;
for (int i = 0; i < n; i++) {
logSum += (scale_factor*alpha[i] - 1)*log(x[i]) - lgamma(scale_factor*alpha[i]);
}
return logSum;
}
//------------------------------------------------
// draw from Poisson(rate) distribution
int rpois1(double rate) {
return R::rpois(rate);
}
//------------------------------------------------
// probability mass of Poisson(rate) distribution
double dpois1(int n, double rate, bool returnLog) {
return R::dpois(n,rate,returnLog);
}
//------------------------------------------------
// draw from negative binomial distribution with mean lambda and variance gamma*lambda (gamma must be >1)
int rnbinom1(double lambda, double gamma) {
return R::rnbinom(lambda/(gamma-1), 1/gamma);
}
//------------------------------------------------
// probability mass of negative binomial distribution with mean lambda and
// variance gamma*lambda (gamma must be >1)
double dnbinom1(int n, double lambda, double gamma, bool returnLog) {
return R::dnbinom(n, lambda/(gamma-1), 1/gamma, returnLog);
}
//------------------------------------------------
// probability mass of negative binomial distribution with mean and variance
double dnbinom_mu1(int n, double size, double mean, bool returnLog) {
return R::dnbinom_mu(n, size, mean, returnLog);
}
//------------------------------------------------
// return closest value to a vector of target values
double closest(std::vector<double> const& vec, double value) {
auto const it = std::lower_bound(vec.begin(), vec.end(), value);
if (it == vec.end()) {
return -1;
}
return *it;
}
//------------------------------------------------
// draw from binomial(N,p) distribution
int rbinom1(int N, double p) {
if (p >= 1.0) {
return N;
} else if (p <= 0.0) {
return 0;
}
return R::rbinom(N, p);
}
//------------------------------------------------
// draw from multinomial(N,p) distribution, where p sums to p_sum
void rmultinom1(int N, const vector<double> &p, double p_sum, vector<int> &ret) {
int k = int(p.size());
fill(ret.begin(), ret.end(), 0);
for (int i = 0; i < (k-1); ++i) {
ret[i] = rbinom1(N, p[i] / p_sum);
N -= ret[i];
if (N == 0) {
break;
}
p_sum -= p[i];
}
ret[k-1] = N;
}
| 29.069767
| 105
| 0.551886
|
Michael-Stevens-27
|
d609367837cf3353590aa149bec33ad2091ee04c
| 386
|
cpp
|
C++
|
Chapter13/drills/Drill_01.cpp
|
JohnWoods11/learning_c-
|
094509a4e96518e1aa12205615ca50849932f9fa
|
[
"Apache-2.0"
] | null | null | null |
Chapter13/drills/Drill_01.cpp
|
JohnWoods11/learning_c-
|
094509a4e96518e1aa12205615ca50849932f9fa
|
[
"Apache-2.0"
] | null | null | null |
Chapter13/drills/Drill_01.cpp
|
JohnWoods11/learning_c-
|
094509a4e96518e1aa12205615ca50849932f9fa
|
[
"Apache-2.0"
] | null | null | null |
#include "GUI/Graph.h"
#include "GUI/Simple_window.h"
#include "GUI/std_lib_facilities.h"
#include <iostream>
void drill_1()
{
const Point py(50,50);
Simple_window win(py, 1000, 800, "Drill 1");
win.wait_for_button();
}
int main()
{
try
{
drill_1();
}
catch (...)
{
cout << "MAJOR ERROR!";
return -1;
}
return 0;
}
| 14.296296
| 48
| 0.544041
|
JohnWoods11
|
d61ba495fd2b7c347312e10be17db6a4d5d4f7ad
| 3,409
|
cpp
|
C++
|
src/system.cpp
|
MisaghM/Doodle-Jump
|
850e529547e83e7a3a0607fea635517bf2e3bcc4
|
[
"MIT"
] | 2
|
2021-09-02T20:05:34.000Z
|
2021-11-05T19:38:15.000Z
|
src/system.cpp
|
MisaghM/Doodle-Jump
|
850e529547e83e7a3a0607fea635517bf2e3bcc4
|
[
"MIT"
] | null | null | null |
src/system.cpp
|
MisaghM/Doodle-Jump
|
850e529547e83e7a3a0607fea635517bf2e3bcc4
|
[
"MIT"
] | null | null | null |
#include "system.hpp"
#include "enemies/enemy_normal.hpp"
#include "items/spring.hpp"
#include "platforms/platform_breakable.hpp"
#include "platforms/platform_movable.hpp"
#include "platforms/platform_normal.hpp"
#include "spritesheet.hpp"
System::System(Window* win_)
: win_(win_),
menuScene_(&inputMan_),
pauseScene_(&inputMan_) {
scenes_.push_back(&menuScene_);
}
bool System::update() {
inputMan_.reset();
while (win_->has_pending_event()) {
Event e = win_->poll_for_event();
switch (e.get_type()) {
case Event::EventType::QUIT: return false;
case Event::EventType::KEY_PRESS:
inputMan_.keyPressed(e.get_pressed_key());
break;
case Event::EventType::KEY_RELEASE:
inputMan_.keyReleased(e.get_pressed_key());
break;
case Event::EventType::MMOTION:
inputMan_.setMousePos(e.get_mouse_position());
break;
case Event::EventType::LCLICK:
inputMan_.mouseHandle(InputMouse::Lclick);
break;
case Event::EventType::LRELEASE:
inputMan_.mouseHandle(InputMouse::Lrelease);
break;
default: break;
}
}
if (state_ == SceneState::gameover) scenes_[1]->update(win_, deltaTime, this);
return scenes_.back()->update(win_, deltaTime, this);
}
void System::draw() {
if (state_ == SceneState::pause ||
state_ == SceneState::gameover) scenes_[1]->draw(win_);
scenes_.back()->draw(win_);
}
void System::changeScene(SceneState to) {
switch (state_) {
case SceneState::menu:
if (to == SceneState::game) {
state_ = SceneState::game;
makeGameScene();
scenes_.push_back(gameScene_);
}
break;
case SceneState::game:
if (to == SceneState::pause) {
state_ = SceneState::pause;
scenes_.push_back(&pauseScene_);
}
else if (to == SceneState::gameover) {
state_ = SceneState::gameover;
int height = gameScene_->getScoreHeight();
if (height > recordHeight_) recordHeight_ = height;
gameoverScene_ = new GameoverScene(&inputMan_, height, recordHeight_);
scenes_.push_back(gameoverScene_);
}
break;
case SceneState::pause:
if (to == SceneState::game) {
state_ = SceneState::game;
scenes_.pop_back();
}
break;
case SceneState::gameover:
if (to == SceneState::game) {
state_ = SceneState::game;
delete scenes_.back();
scenes_.pop_back();
delete scenes_.back();
scenes_.pop_back();
makeGameScene();
scenes_.push_back(gameScene_);
}
else if (to == SceneState::menu) {
state_ = SceneState::menu;
delete scenes_.back();
scenes_.pop_back();
delete scenes_.back();
scenes_.pop_back();
}
break;
}
}
void System::makeGameScene() {
int doodleWidth = sprite::doodle[sprite::Doodle::LEFT].w;
int doodleHeight = sprite::doodle[sprite::Doodle::LEFT].h;
gameScene_ = new GameScene(&inputMan_,
RectangleF(win_->get_width() / 2 - doodleWidth / 2, win_->get_height() - doodleHeight, doodleWidth, doodleHeight));
}
| 30.4375
| 146
| 0.581989
|
MisaghM
|
d62204e616f8edb2f0032058d3f6ad907800fbb3
| 1,091
|
cc
|
C++
|
test/test_flann.cc
|
mozuysal/virg-workspace
|
ff0df41ceb288609c5279a85d9d04dbbc178d33e
|
[
"BSD-3-Clause"
] | null | null | null |
test/test_flann.cc
|
mozuysal/virg-workspace
|
ff0df41ceb288609c5279a85d9d04dbbc178d33e
|
[
"BSD-3-Clause"
] | 3
|
2017-02-07T11:26:33.000Z
|
2017-02-07T12:43:41.000Z
|
test/test_flann.cc
|
mozuysal/virg-workspace
|
ff0df41ceb288609c5279a85d9d04dbbc178d33e
|
[
"BSD-3-Clause"
] | null | null | null |
#include "gtest/gtest.h"
#include "flann/flann.hpp"
using flann::Matrix;
using flann::Index;
using flann::LinearIndexParams;
using flann::L2;
using flann::SearchParams;
TEST(flann, linear_index) {
int nn = 2;
float data[4] = { 0.0f, 0.0f,
1.0, 0.5};
Matrix<float> dataset(&data[0], 2, 2);
Index<L2<float> > index(dataset, LinearIndexParams());
index.buildIndex();
float qdata[2] = { 1.0f, 0.0f };
Matrix<float> query(&qdata[0], 1, 2);
Matrix<int> indices(new int[query.rows*nn], query.rows, nn);
Matrix<float> dists(new float[query.rows*nn], query.rows, nn);
index.knnSearch(query, indices, dists, nn, SearchParams());
EXPECT_EQ(1, indices.ptr()[0]);
EXPECT_FLOAT_EQ(0.25f, dists.ptr()[0]);
EXPECT_EQ(0, indices.ptr()[1]);
EXPECT_FLOAT_EQ(1.0f, dists.ptr()[1]);
delete [] indices.ptr();
delete [] dists.ptr();
}
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
| 27.275
| 70
| 0.578368
|
mozuysal
|
d62869904cc8110964fdb3a0ea0fd9355c5e0066
| 44,630
|
cc
|
C++
|
tacacsAuthProxy/src/proxy_server.cc
|
gkumar78/tacacs_auth_proxy
|
bffdfde75e67e075e47f345580bd6adbea8930d5
|
[
"Apache-2.0"
] | null | null | null |
tacacsAuthProxy/src/proxy_server.cc
|
gkumar78/tacacs_auth_proxy
|
bffdfde75e67e075e47f345580bd6adbea8930d5
|
[
"Apache-2.0"
] | null | null | null |
tacacsAuthProxy/src/proxy_server.cc
|
gkumar78/tacacs_auth_proxy
|
bffdfde75e67e075e47f345580bd6adbea8930d5
|
[
"Apache-2.0"
] | null | null | null |
/*
* Copyright 2018-present Open Networking Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <iostream>
#include <memory>
#include <string>
#include <sstream>
#include <grpcpp/health_check_service_interface.h>
#include <grpcpp/ext/proto_server_reflection_plugin.h>
#include <grpcpp/grpcpp.h>
#include <voltha_protos/openolt.grpc.pb.h>
#include <voltha_protos/tech_profile.grpc.pb.h>
#include <voltha_protos/ext_config.grpc.pb.h>
#include "tacacs_controller.h"
#include "logger.h"
using grpc::Channel;
using grpc::ChannelArguments;
using grpc::Server;
using grpc::ServerBuilder;
using grpc::ServerContext;
using grpc::ServerWriter;
using grpc::Status;
using grpc::ClientContext;
using namespace std;
static const std::string base64_chars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789+/";
static inline bool is_base64(unsigned char c) {
return (isalnum(c) || (c == '+') || (c == '/'));
}
static Server* ServerInstance;
std::string base64_decode(std::string const& encoded_string);
class ProxyServiceImpl final : public openolt::Openolt::Service {
TaccController *taccController;
unique_ptr<openolt::Openolt::Stub> openoltClientStub;
public:
TacacsContext extractDataFromGrpc(ServerContext* context) {
LOG_F(MAX, "Extracting the gRPC credentials");
const std::multimap<grpc::string_ref, grpc::string_ref> metadata = context->client_metadata();
std::multimap<grpc::string_ref, grpc::string_ref>::const_iterator data_iter = metadata.find("authorization");
TacacsContext tacCtx;
if(data_iter != metadata.end()) {
string str_withBasic((data_iter->second).data(),(data_iter->second).length());
std::string str_withoutBasic = str_withBasic.substr(6);
std::string decoded_str = base64_decode(str_withoutBasic);
int pos = decoded_str.find(":");
tacCtx.username = decoded_str.substr(0,pos);
tacCtx.password = decoded_str.substr(pos+1);
tacCtx.remote_addr = context->peer();
LOG_F(INFO, "Received gRPC credentials username=%s, password=%s from Remote %s", tacCtx.username.c_str(), tacCtx.password.c_str(), tacCtx.remote_addr.c_str());
} else {
LOG_F(WARNING, "Unable to find or extract credentials from incoming gRPC request");
tacCtx.username = "";
}
return tacCtx;
}
Status processTacacsAuth(TacacsContext* tacCtx){
LOG_F(MAX, "Calling Authenticate");
Status status = taccController->Authenticate(tacCtx);
if(status.error_code() == StatusCode::OK) {
LOG_F(MAX, "Calling Authorize");
status = taccController->Authorize(tacCtx);
}
return status;
}
Status DisableOlt(
ServerContext* context,
const openolt::Empty* request,
openolt::Empty* response) override {
LOG_F(INFO, "DisableOlt invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "disableolt";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling DisableOlt");
status = openoltClientStub->DisableOlt(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling DisableOlt");
return openoltClientStub->DisableOlt(&ctx, *request, response);
}
}
Status ReenableOlt(
ServerContext* context,
const openolt::Empty* request,
openolt::Empty* response) override {
LOG_F(INFO, "ReenableOlt invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "reenableolt";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling ReenableOlt");
status = openoltClientStub->ReenableOlt(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling ReenableOlt");
return openoltClientStub->ReenableOlt(&ctx, *request, response);
}
}
Status ActivateOnu(
ServerContext* context,
const openolt::Onu* request,
openolt::Empty* response) override {
LOG_F(INFO, "ActivateOnu invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "activateonu";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling ActivateOnu");
status = openoltClientStub->ActivateOnu(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling ActivateOnu");
return openoltClientStub->ActivateOnu(&ctx, *request, response);
}
}
Status DeactivateOnu(
ServerContext* context,
const openolt::Onu* request,
openolt::Empty* response) override {
LOG_F(INFO, "DeactivateOnu invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "deactivateonu";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling DeactivateOnu");
status = openoltClientStub->DeactivateOnu(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling DeactivateOnu");
return openoltClientStub->DeactivateOnu(&ctx, *request, response);
}
}
Status DeleteOnu(
ServerContext* context,
const openolt::Onu* request,
openolt::Empty* response) override {
LOG_F(INFO, "DeleteOnu invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "deleteonu";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling DeleteOnu");
status = openoltClientStub->DeleteOnu(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling DeleteOnu");
return openoltClientStub->DeleteOnu(&ctx, *request, response);
}
}
Status OmciMsgOut(
ServerContext* context,
const openolt::OmciMsg* request,
openolt::Empty* response) override {
LOG_F(INFO, "OmciMsgOut invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "omcimsgout";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling OmciMsgOut");
status = openoltClientStub->OmciMsgOut(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling OmciMsgOut");
return openoltClientStub->OmciMsgOut(&ctx, *request, response);
}
}
Status OnuPacketOut(
ServerContext* context,
const openolt::OnuPacket* request,
openolt::Empty* response) override {
LOG_F(INFO, "OnuPacketOut invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "onupacketout";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling OnuPacketOut");
status = openoltClientStub->OnuPacketOut(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling OnuPacketOut");
return openoltClientStub->OnuPacketOut(&ctx, *request, response);
}
}
Status UplinkPacketOut(
ServerContext* context,
const openolt::UplinkPacket* request,
openolt::Empty* response) override {
LOG_F(INFO, "UplinkPacketOut invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "uplinkpacketout";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling UplinkPacketOut");
status = openoltClientStub->UplinkPacketOut(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling UplinkPacketOut");
return openoltClientStub->UplinkPacketOut(&ctx, *request, response);
}
}
Status FlowAdd(
ServerContext* context,
const openolt::Flow* request,
openolt::Empty* response) override {
LOG_F(INFO, "FlowAdd invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "flowadd";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling FlowAdd");
status = openoltClientStub->FlowAdd(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling FlowAdd");
return openoltClientStub->FlowAdd(&ctx, *request, response);
}
}
Status FlowRemove(
ServerContext* context,
const openolt::Flow* request,
openolt::Empty* response) override {
LOG_F(INFO, "FlowRemove invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "flowremove";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling FlowRemove");
status = openoltClientStub->FlowRemove(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling FlowRemove");
return openoltClientStub->FlowRemove(&ctx, *request, response);
}
}
Status EnableIndication(
ServerContext* context,
const ::openolt::Empty* request,
ServerWriter<openolt::Indication>* writer) override {
LOG_F(INFO, "EnableIndication invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "enableindication";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling EnableIndication");
std::unique_ptr<ClientReader<openolt::Indication> > reader = openoltClientStub->EnableIndication(&ctx, *request);
openolt::Indication indication;
while( reader->Read(&indication) ) {
LOG_F(INFO, "Sending out Indication type %d", indication.data_case());
if( !writer->Write(indication) ) {
LOG_F(WARNING, "Grpc Stream broken while sending out Indication");
break;
}
}
status = reader->Finish();
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling EnableIndication");
std::unique_ptr<ClientReader<openolt::Indication> > reader = openoltClientStub->EnableIndication(&ctx, *request);
openolt::Indication indication;
while( reader->Read(&indication) ) {
LOG_F(INFO, "Sending out Indication type %d", indication.data_case());
if( !writer->Write(indication) ) {
LOG_F(WARNING, "Grpc Stream broken while sending out Indication");
break;
}
}
return reader->Finish();
}
}
Status HeartbeatCheck(
ServerContext* context,
const openolt::Empty* request,
openolt::Heartbeat* response) override {
LOG_F(INFO, "HeartbeatCheck invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "heartbeatcheck";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling HeartbeatCheck");
status = openoltClientStub->HeartbeatCheck(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling HeartbeatCheck");
return openoltClientStub->HeartbeatCheck(&ctx, *request, response);
}
}
Status EnablePonIf(
ServerContext* context,
const openolt::Interface* request,
openolt::Empty* response) override {
LOG_F(INFO, "EnablePonIf invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "enableponif";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling EnablePonIf");
status = openoltClientStub->EnablePonIf(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling EnablePonIf");
return openoltClientStub->EnablePonIf(&ctx, *request, response);
}
}
Status DisablePonIf(
ServerContext* context,
const openolt::Interface* request,
openolt::Empty* response) override {
LOG_F(INFO, "DisablePonIf invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "disableponif";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling DisablePonIf");
status = openoltClientStub->DisablePonIf(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling DisablePonIf");
return openoltClientStub->DisablePonIf(&ctx, *request, response);
}
}
Status CollectStatistics(
ServerContext* context,
const openolt::Empty* request,
openolt::Empty* response) override {
LOG_F(INFO, "CollectStatistics invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "collectstatistics";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling CollectStatistics");
status = openoltClientStub->CollectStatistics(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling CollectStatistics");
return openoltClientStub->CollectStatistics(&ctx, *request, response);
}
}
Status Reboot(
ServerContext* context,
const openolt::Empty* request,
openolt::Empty* response) override {
LOG_F(INFO, "Reboot invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "reboot";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling Reboot");
status = openoltClientStub->Reboot(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling Reboot");
return openoltClientStub->Reboot(&ctx, *request, response);
}
}
Status GetDeviceInfo(
ServerContext* context,
const openolt::Empty* request,
openolt::DeviceInfo* response) override {
LOG_F(MAX, "GetDeviceInfo invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "getdeviceinfo";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling GetDeviceInfo");
status = openoltClientStub->GetDeviceInfo(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling GetDeviceInfo");
return openoltClientStub->GetDeviceInfo(&ctx, *request, response);
}
}
Status CreateTrafficSchedulers(
ServerContext* context,
const tech_profile::TrafficSchedulers* request,
openolt::Empty* response) override {
LOG_F(INFO, "CreateTrafficSchedulers invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "createtrafficschedulers";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling CreateTrafficSchedulers");
status = openoltClientStub->CreateTrafficSchedulers(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling CreateTrafficSchedulers");
return openoltClientStub->CreateTrafficSchedulers(&ctx, *request, response);
}
}
Status RemoveTrafficSchedulers(
ServerContext* context,
const tech_profile::TrafficSchedulers* request,
openolt::Empty* response) override {
LOG_F(INFO, "RemoveTrafficSchedulers invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "removetrafficschedulers";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling RemoveTrafficSchedulers");
status = openoltClientStub->RemoveTrafficSchedulers(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling RemoveTrafficSchedulers");
return openoltClientStub->RemoveTrafficSchedulers(&ctx, *request, response);
}
}
Status CreateTrafficQueues(
ServerContext* context,
const tech_profile::TrafficQueues* request,
openolt::Empty* response) override {
LOG_F(INFO, "CreateTrafficQueues invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "createtrafficqueues";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling CreateTrafficQueues");
status = openoltClientStub->CreateTrafficQueues(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling CreateTrafficQueues");
return openoltClientStub->CreateTrafficQueues(&ctx, *request, response);
}
}
Status RemoveTrafficQueues(
ServerContext* context,
const tech_profile::TrafficQueues* request,
openolt::Empty* response) override {
LOG_F(INFO, "RemoveTrafficQueues invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "removetrafficqueues";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling RemoveTrafficQueues");
status = openoltClientStub->RemoveTrafficQueues(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling RemoveTrafficQueues");
return openoltClientStub->RemoveTrafficQueues(&ctx, *request, response);
}
}
Status PerformGroupOperation(
ServerContext* context,
const openolt::Group* request,
openolt::Empty* response) override {
LOG_F(INFO, "PerformGroupOperation invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "performgroupoperation";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling PerformGroupOperation");
status = openoltClientStub->PerformGroupOperation(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling PerformGroupOperation");
return openoltClientStub->PerformGroupOperation(&ctx, *request, response);
}
}
Status DeleteGroup(
ServerContext* context,
const openolt::Group* request,
openolt::Empty* response) override {
LOG_F(INFO, "DeleteGroup invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "deletegroup";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling DeleteGroup");
status = openoltClientStub->DeleteGroup(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling DeleteGroup");
return openoltClientStub->DeleteGroup(&ctx, *request, response);
}
}
Status OnuItuPonAlarmSet(
ServerContext* context,
const config::OnuItuPonAlarm* request,
openolt::Empty* response) override {
LOG_F(INFO, "OnuItuPonAlarmSet invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "onuituponalarmset";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling OnuItuPonAlarmSet");
status = openoltClientStub->OnuItuPonAlarmSet(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling OnuItuPonAlarmSet");
return openoltClientStub->OnuItuPonAlarmSet(&ctx, *request, response);
}
}
Status GetLogicalOnuDistanceZero(
ServerContext* context,
const openolt::Onu* request,
openolt::OnuLogicalDistance* response) override {
LOG_F(INFO, "GetLogicalOnuDistanceZero invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "getlogicalonudistancezero";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling GetLogicalOnuDistanceZero");
status = openoltClientStub->GetLogicalOnuDistanceZero(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling GetLogicalOnuDistanceZero");
return openoltClientStub->GetLogicalOnuDistanceZero(&ctx, *request, response);
}
}
Status GetLogicalOnuDistance(
ServerContext* context,
const openolt::Onu* request,
openolt::OnuLogicalDistance* response) override {
LOG_F(INFO, "GetLogicalOnuDistance invoked");
if (taccController->IsTacacsEnabled()) {
TacacsContext tacCtx = extractDataFromGrpc(context);
if (tacCtx.username.empty()) {
return Status(grpc::INVALID_ARGUMENT,"Unable to find or extract credentials from incoming gRPC request");
}
tacCtx.method_name = "getlogicalonudistance";
taccController->StartAccounting(&tacCtx);
Status status = processTacacsAuth(&tacCtx);
if(status.error_code() == StatusCode::OK) {
ClientContext ctx;
LOG_F(INFO, "Calling GetLogicalOnuDistance");
status = openoltClientStub->GetLogicalOnuDistance(&ctx, *request, response);
}
string error_msg = "no error";
if(status.error_code() != StatusCode::OK) {
error_msg = status.error_message();
}
taccController->StopAccounting(&tacCtx, error_msg);
return status;
} else {
ClientContext ctx;
LOG_F(INFO, "Tacacs disabled.. Calling GetLogicalOnuDistance");
return openoltClientStub->GetLogicalOnuDistance(&ctx, *request, response);
}
}
ProxyServiceImpl(TaccController* tacctrl, const char* addr) {
taccController = tacctrl;
LOG_F(INFO, "Creating GRPC Channel to Openolt Agent on %s", addr);
openoltClientStub = openolt::Openolt::NewStub(grpc::CreateChannel(addr, grpc::InsecureChannelCredentials()));
}
};
std::string base64_decode(std::string const& encoded_string) {
int in_len = encoded_string.size();
int i = 0;
int j = 0;
int in_ = 0;
unsigned char char_array_4[4], char_array_3[3];
std::string ret;
while (in_len-- && ( encoded_string[in_] != '=') && is_base64(encoded_string[in_])) {
char_array_4[i++] = encoded_string[in_]; in_++;
if (i ==4) {
for (i = 0; i <4; i++)
char_array_4[i] = base64_chars.find(char_array_4[i]);
char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
for (i = 0; (i < 3); i++)
ret += char_array_3[i];
i = 0;
}
}
if (i) {
for (j = i; j <4; j++)
char_array_4[j] = 0;
for (j = 0; j <4; j++)
char_array_4[j] = base64_chars.find(char_array_4[j]);
char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2);
char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
for (j = 0; (j < i - 1); j++) ret += char_array_3[j];
}
return ret;
}
void RunServer(int argc, char** argv) {
const char* tacacs_server_address = NULL;
const char* tacacs_secure_key = NULL;
bool tacacs_fallback_pass = true;
const char* interface_address = NULL;
const char* openolt_agent_address = NULL;
TaccController* taccController = NULL;
LOG_F(INFO, "Starting up TACACS Proxy");
for (int i = 1; i < argc; ++i) {
if(strcmp(argv[i-1], "--tacacs_server_address") == 0 ) {
tacacs_server_address = argv[i];
} else if(strcmp(argv[i-1], "--tacacs_secure_key") == 0 ) {
tacacs_secure_key = argv[i];
} else if(strcmp(argv[i-1], "--tacacs_fallback_pass") == 0 ) {
tacacs_fallback_pass = ( *argv[i] == '0') ? false : true;
} else if(strcmp(argv[i-1], "--interface_address") == 0 ) {
interface_address = argv[i];
} else if(strcmp(argv[i-1], "--openolt_agent_address") == 0 ) {
openolt_agent_address = argv[i];
}
}
if(!interface_address || interface_address == ""){
LOG_F(FATAL, "Server Interface Bind address is missing. TACACS Proxy startup failed");
return;
}
if(!openolt_agent_address || openolt_agent_address == ""){
LOG_F(FATAL, "Openolt Agent address is missing. TACACS Proxy startup failed");
return;
}
if(!tacacs_server_address || tacacs_server_address == ""){
LOG_F(WARNING, "TACACS+ Server address is missing. TACACS+ AAA will be disabled");
}
LOG_F(INFO, "TACACS+ Server configured as %s", tacacs_server_address);
LOG_F(INFO, "TACACS Fallback configured as %s", tacacs_fallback_pass ? "PASS": "FAIL");
if(!tacacs_secure_key){
LOG_F(ERROR, "TACACS Secure Key is missing. No encryption will be used for TACACS channel");
tacacs_secure_key = "";
}
LOG_F(MAX, "Creating TaccController");
taccController = new TaccController(tacacs_server_address, tacacs_secure_key, tacacs_fallback_pass);
LOG_F(MAX, "Creating Proxy Server");
ProxyServiceImpl service(taccController, openolt_agent_address);
grpc::EnableDefaultHealthCheckService(true);
ServerBuilder builder;
LOG_F(INFO, "Starting Proxy Server");
builder.AddListeningPort(interface_address, grpc::InsecureServerCredentials());
builder.RegisterService(&service);
std::unique_ptr<Server> server(builder.BuildAndStart());
ServerInstance = server.get();
LOG_F(INFO, "TACACS Proxy listening on %s", interface_address);
server->Wait();
}
void StopServer(int signum) {
LOG_F(INFO, "Received Signal %d", signum);
if( ServerInstance != NULL ) {
LOG_F(INFO, "Shutting down TACACS Proxy");
ServerInstance->Shutdown();
}
exit(0);
}
| 39.741763
| 171
| 0.588438
|
gkumar78
|
d6320ffbbb1fd3681cb234be4d0f345d770834d1
| 3,724
|
cpp
|
C++
|
vnext/Microsoft.ReactNative/ReactNativeHost.cpp
|
tom-un/react-native-windows
|
c09b55cce76604fe0b379b10206a974915dafc25
|
[
"MIT"
] | 2
|
2021-09-05T18:12:44.000Z
|
2021-09-06T02:08:25.000Z
|
vnext/Microsoft.ReactNative/ReactNativeHost.cpp
|
zchronoz/react-native-windows
|
111b727c50b4349b60ffe98f7ff70d487624add3
|
[
"MIT"
] | 2
|
2021-05-09T03:34:28.000Z
|
2021-09-02T14:49:43.000Z
|
vnext/Microsoft.ReactNative/ReactNativeHost.cpp
|
t0rr3sp3dr0/react-native-windows
|
5ed2c5626fb2d126022ba215a71a1cb92f7337b3
|
[
"MIT"
] | null | null | null |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "pch.h"
#include "ReactNativeHost.h"
#include "ReactNativeHost.g.cpp"
#include "ReactInstanceManager.h"
#include "ReactInstanceManagerBuilder.h"
#include "ReactInstanceSettings.h"
#include "ReactRootView.h"
#include "ReactSupport.h"
#include <NativeModuleProvider.h>
#include <ViewManager.h>
#include <ViewManagerProvider.h>
using namespace winrt;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
namespace winrt::Microsoft::ReactNative::implementation {
ReactNativeHost::ReactNativeHost() noexcept {
Init();
}
void ReactNativeHost::Init() noexcept {
#if _DEBUG
facebook::react::InitializeLogging([](facebook::react::RCTLogLevel /*logLevel*/, const char *message) {
std::string str = std::string("ReactNative:") + message;
OutputDebugStringA(str.c_str());
});
#endif
}
Microsoft::ReactNative::ReactInstanceManager ReactNativeHost::CreateReactInstanceManager() noexcept {
auto builder = ReactInstanceManagerBuilder();
builder.InstanceSettings(InstanceSettings());
builder.UseDeveloperSupport(UseDeveloperSupport());
builder.InitialLifecycleState(LifecycleState::BeforeCreate);
builder.JavaScriptBundleFile(JavaScriptBundleFile());
builder.JavaScriptMainModuleName(JavaScriptMainModuleName());
builder.PackageProviders(PackageProviders().GetView());
return builder.Build();
}
std::shared_ptr<ReactRootView> ReactNativeHost::CreateRootView() noexcept {
auto rootView = std::make_shared<ReactRootView>();
return rootView;
}
Microsoft::ReactNative::ReactInstanceManager ReactNativeHost::ReactInstanceManager() noexcept {
if (m_reactInstanceManager == nullptr) {
m_reactInstanceManager = CreateReactInstanceManager();
}
return m_reactInstanceManager;
}
UIElement ReactNativeHost::GetOrCreateRootView(IInspectable initialProps) noexcept {
if (m_reactRootView != nullptr) {
return *m_reactRootView;
}
folly::dynamic props = Microsoft::ReactNative::Bridge::ConvertToDynamic(initialProps);
m_reactRootView = CreateRootView();
assert(m_reactRootView != nullptr);
m_reactRootView->OnCreate(*this);
m_reactRootView->StartReactApplicationAsync(ReactInstanceManager(), MainComponentName(), props);
return *m_reactRootView;
}
auto ReactNativeHost::InstanceSettings() noexcept -> Microsoft::ReactNative::ReactInstanceSettings {
if (!m_instanceSettings) {
m_instanceSettings = make<ReactInstanceSettings>();
m_instanceSettings.UseWebDebugger(false);
m_instanceSettings.UseLiveReload(true);
m_instanceSettings.UseJsi(true);
m_instanceSettings.EnableDeveloperMenu(REACT_DEFAULT_ENABLE_DEVELOPER_MENU);
}
return m_instanceSettings;
}
auto ReactNativeHost::PackageProviders() noexcept -> IVector<IReactPackageProvider> {
if (!m_packageProviders) {
m_packageProviders = single_threaded_vector<IReactPackageProvider>();
}
return m_packageProviders;
}
void ReactNativeHost::OnSuspend() noexcept {
if (HasInstance()) {
ReactInstanceManager().OnSuspend();
}
}
void ReactNativeHost::OnEnteredBackground() noexcept {
if (HasInstance()) {
ReactInstanceManager().OnEnteredBackground();
}
}
void ReactNativeHost::OnLeavingBackground() noexcept {
if (HasInstance()) {
ReactInstanceManager().OnLeavingBackground();
}
}
void ReactNativeHost::OnResume(Microsoft::ReactNative::OnResumeAction const &action) noexcept {
if (HasInstance()) {
ReactInstanceManager().OnResume(action);
}
}
} // namespace winrt::Microsoft::ReactNative::implementation
| 30.276423
| 106
| 0.747046
|
tom-un
|
d63398010a208af19e5347957d12dcf82055b812
| 698
|
cpp
|
C++
|
Utils/StringUtils.cpp
|
paulross80/myoga-utils
|
ecdff503690bb0b3a521e7af66bb84dfbd899799
|
[
"MIT"
] | null | null | null |
Utils/StringUtils.cpp
|
paulross80/myoga-utils
|
ecdff503690bb0b3a521e7af66bb84dfbd899799
|
[
"MIT"
] | null | null | null |
Utils/StringUtils.cpp
|
paulross80/myoga-utils
|
ecdff503690bb0b3a521e7af66bb84dfbd899799
|
[
"MIT"
] | null | null | null |
#include <stdexcept>
#include <algorithm>
#include <cctype>
#include "StringUtils.hpp"
namespace myoga
{
// String to lowercase
auto lowercase(std::string_view str) -> std::string
{
std::string ret(str);
for (std::size_t i = 0U; i < ret.length(); i++)
ret[i] = charToLower(ret[i]);
return ret;
}
// String -> Boolean
auto boolFromStr(std::string_view str) -> bool
{
// Why this always returns false???
//std::istringstream(value.data()) >> std::boolalpha >> boolValue;
auto lowTrim = myoga::lowercase(myoga::trimStr(str.substr(0, 5))); // "false" -> 5 chars
if (lowTrim == "1" || lowTrim == "true")
return true;
return false;
}
} // myoga
| 19.388889
| 93
| 0.617479
|
paulross80
|
d634459a8057739295b11d8375cfb44714bf6d9b
| 4,816
|
cpp
|
C++
|
motif4struct_bin.cpp
|
devuci/bct-cpp
|
bbb33f476bffbb5669e051841f00c3241f4d6f69
|
[
"MIT"
] | null | null | null |
motif4struct_bin.cpp
|
devuci/bct-cpp
|
bbb33f476bffbb5669e051841f00c3241f4d6f69
|
[
"MIT"
] | null | null | null |
motif4struct_bin.cpp
|
devuci/bct-cpp
|
bbb33f476bffbb5669e051841f00c3241f4d6f69
|
[
"MIT"
] | null | null | null |
#include "bct.h"
/*
* Counts occurrences of four-node structural motifs in a binary graph.
*/
VECTOR_T* BCT_NAMESPACE::motif4struct_bin(const MATRIX_T* A, MATRIX_T** F) {
if (safe_mode) check_status(A, SQUARE | BINARY, "motif4struct_bin");
// load motif34lib M4n ID4
VECTOR_T* ID4;
MATRIX_T* M4 = motif4generate(&ID4);
// n=length(A);
int n = length(A);
// F=zeros(199,n);
if (F != NULL) {
*F = zeros(199, n);
}
// f=zeros(199,1);
VECTOR_T* f = zeros_vector(199);
// As=A|A.';
MATRIX_T* A_transpose = MATRIX_ID(alloc)(A->size2, A->size1);
MATRIX_ID(transpose_memcpy)(A_transpose, A);
MATRIX_T* As = logical_or(A, A_transpose);
MATRIX_ID(free)(A_transpose);
// for u=1:n-3
for (int u = 0; u < n - 3; u++) {
// V1=[false(1,u) As(u,u+1:n)];
VECTOR_T* V1 = VECTOR_ID(alloc)(n);
MATRIX_ID(get_row)(V1, As, u);
for (int i = 0; i <= u; i++) {
VECTOR_ID(set)(V1, i, 0.0);
}
// for v1=find(V1)
VECTOR_T* find_V1 = find(V1);
if (find_V1 != NULL) {
for (int i_find_V1 = 0; i_find_V1 < (int)find_V1->size; i_find_V1++) {
int v1 = (int)VECTOR_ID(get)(find_V1, i_find_V1);
// V2=[false(1,u) As(v1,u+1:n)];
VECTOR_T* V2 = VECTOR_ID(alloc)(n);
MATRIX_ID(get_row)(V2, As, v1);
for (int i = 0; i <= u; i++) {
VECTOR_ID(set)(V2, i, 0.0);
}
// V2(V1)=0;
logical_index_assign(V2, V1, 0.0);
// V2=V2|([false(1,v1) As(u,v1+1:n)]);
VECTOR_T* V2_1 = V2;
VECTOR_T* V2_2 = VECTOR_ID(alloc)(n);
MATRIX_ID(get_row)(V2_2, As, u);
for (int i = 0; i <= v1; i++) {
VECTOR_ID(set)(V2_2, i, 0.0);
}
V2 = logical_or(V2_1, V2_2);
VECTOR_ID(free)(V2_1);
VECTOR_ID(free)(V2_2);
// for v2=find(V2)
VECTOR_T* find_V2 = find(V2);
if (find_V2 != NULL) {
for (int i_find_V2 = 0; i_find_V2 < (int)find_V2->size; i_find_V2++) {
int v2 = (int)VECTOR_ID(get)(find_V2, i_find_V2);
// vz=max(v1,v2);
int vz = (v1 > v2) ? v1 : v2;
// V3=([false(1,u) As(v2,u+1:n)]);
VECTOR_T* V3 = VECTOR_ID(alloc)(n);
MATRIX_ID(get_row)(V3, As, v2);
for (int i = 0; i <= u; i++) {
VECTOR_ID(set)(V3, i, 0.0);
}
// V3(V2)=0;
logical_index_assign(V3, V2, 0.0);
// V3=V3|([false(1,v2) As(v1,v2+1:n)]);
VECTOR_T* V3_1 = V3;
VECTOR_T* V3_2 = VECTOR_ID(alloc)(n);
MATRIX_ID(get_row)(V3_2, As, v1);
for (int i = 0; i <= v2; i++) {
VECTOR_ID(set)(V3_2, i, 0.0);
}
V3 = logical_or(V3_1, V3_2);
VECTOR_ID(free)(V3_1);
VECTOR_ID(free)(V3_2);
// V3(V1)=0;
logical_index_assign(V3, V1, 0.0);
// V3=V3|([false(1,vz) As(u,vz+1:n)]);
V3_1 = V3;
V3_2 = VECTOR_ID(alloc)(n);
MATRIX_ID(get_row)(V3_2, As, u);
for (int i = 0; i <= vz; i++) {
VECTOR_ID(set)(V3_2, i, 0.0);
}
V3 = logical_or(V3_1, V3_2);
VECTOR_ID(free)(V3_1);
VECTOR_ID(free)(V3_2);
// for v3=find(V3)
VECTOR_T* find_V3 = find(V3);
if (find_V3 != NULL ) {
for (int i_find_V3 = 0; i_find_V3 < (int)find_V3->size; i_find_V3++) {
int v3 = (int)VECTOR_ID(get)(find_V3, i_find_V3);
// s=uint32(sum(10.^(11:-1:0).*[A(v1,u) A(v2,u) A(v3,u) A(u,v1) A(v2,v1) A(v3,v1) A(u,v2) A(v1,v2) A(v3,v2) A(u,v3) A(v1,v3) A(v2,v3)]));
int A_rows[] = { v1, v2, v3, u, v2, v3, u, v1, v3, u, v1, v2 };
int A_cols[] = { u, u, u, v1, v1, v1, v2, v2, v2, v3, v3, v3 };
VECTOR_T* s = VECTOR_ID(alloc)(12);
for (int i = 0; i < 12; i++) {
VECTOR_ID(set)(s, i, MATRIX_ID(get)(A, A_rows[i], A_cols[i]));
}
// ind=ID4(s==M4n);
int i_M4 = 0;
for ( ; i_M4 < (int)M4->size1; i_M4++) {
VECTOR_ID(view) M4_row_i_M4 = MATRIX_ID(row)(M4, i_M4);
if (compare_vectors(s, &M4_row_i_M4.vector) == 0) {
break;
}
}
VECTOR_ID(free)(s);
if (i_M4 < (int)M4->size1) {
int ind = (int)VECTOR_ID(get)(ID4, i_M4) - 1;
// if nargout==2; F(ind,[u v1 v2 v3])=F(ind,[u v1 v2 v3])+1; end
if (F != NULL) {
int F_cols[] = { u, v1, v2, v3 };
for (int i = 0; i < 4; i++) {
MATRIX_ID(set)(*F, ind, F_cols[i], MATRIX_ID(get)(*F, ind, F_cols[i]) + 1.0);
}
}
// f(ind)=f(ind)+1;
VECTOR_ID(set)(f, ind, VECTOR_ID(get)(f, ind) + 1.0);
}
}
VECTOR_ID(free)(find_V3);
}
VECTOR_ID(free)(V3);
}
VECTOR_ID(free)(find_V2);
}
VECTOR_ID(free)(V2);
}
VECTOR_ID(free)(find_V1);
}
VECTOR_ID(free)(V1);
}
VECTOR_ID(free)(ID4);
MATRIX_ID(free)(M4);
MATRIX_ID(free)(As);
return f;
}
| 27.83815
| 145
| 0.508721
|
devuci
|
d64117aa915e6ae0b088b4a29488fb5f0d38fad0
| 285
|
cpp
|
C++
|
Primer/Trials/check.cpp
|
siddheshpai/hello-world
|
291456962d46c6ce857d75be86bc23634625925f
|
[
"Apache-2.0"
] | null | null | null |
Primer/Trials/check.cpp
|
siddheshpai/hello-world
|
291456962d46c6ce857d75be86bc23634625925f
|
[
"Apache-2.0"
] | null | null | null |
Primer/Trials/check.cpp
|
siddheshpai/hello-world
|
291456962d46c6ce857d75be86bc23634625925f
|
[
"Apache-2.0"
] | 1
|
2020-05-30T04:30:16.000Z
|
2020-05-30T04:30:16.000Z
|
#include <iostream>
int main()
{
int n = 5;
void *p = &n;
int *pi = static_cast<int*>(p);
++*pi;
std::cout << *pi << std::endl;
//Checking ref to const
std::string const &s = "9-99-999-9999";
std::cout << s << std::endl;
return 0;
}
| 15.833333
| 43
| 0.477193
|
siddheshpai
|
d6460c3cda3662f4730f91a14731321247e446ed
| 258
|
cpp
|
C++
|
PETCS/Intermediate/aplusb.cpp
|
dl4us/Competitive-Programming-1
|
d42fab3bd68168adbe4b5f594f19ee5dfcd1389b
|
[
"MIT"
] | null | null | null |
PETCS/Intermediate/aplusb.cpp
|
dl4us/Competitive-Programming-1
|
d42fab3bd68168adbe4b5f594f19ee5dfcd1389b
|
[
"MIT"
] | null | null | null |
PETCS/Intermediate/aplusb.cpp
|
dl4us/Competitive-Programming-1
|
d42fab3bd68168adbe4b5f594f19ee5dfcd1389b
|
[
"MIT"
] | null | null | null |
#include <bits/stdc++.h>
using namespace std;
int N;
int main() {
cin.sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> N;
int a, b;
for(int i = 0; i < N; i++) {
cin >> a >> b;
cout << a+b << "\n";
}
return 0;
}
| 17.2
| 32
| 0.453488
|
dl4us
|
d6468e7220e5b770459d2c4cff62b1dff129a89a
| 9,676
|
cpp
|
C++
|
Widgets/Datalog/dialogplotchannelchoose.cpp
|
cyferc/Empro-Datalog-Viewer
|
8d66cefe64aa254c283e72034f9ea452938ad212
|
[
"MIT"
] | 6
|
2017-03-29T14:44:06.000Z
|
2021-08-17T06:11:09.000Z
|
Widgets/Datalog/dialogplotchannelchoose.cpp
|
cyferc/Empro-Datalog-Viewer
|
8d66cefe64aa254c283e72034f9ea452938ad212
|
[
"MIT"
] | 1
|
2018-11-24T11:12:08.000Z
|
2018-11-24T11:12:08.000Z
|
Widgets/Datalog/dialogplotchannelchoose.cpp
|
cyferc/Empro-Datalog-Viewer
|
8d66cefe64aa254c283e72034f9ea452938ad212
|
[
"MIT"
] | 3
|
2018-01-20T21:53:03.000Z
|
2020-09-23T19:02:42.000Z
|
#include "dialogplotchannelchoose.h"
#include "ui_dialogplotchannelchoose.h"
#include <QGridLayout>
#include <QCheckBox>
#include <QDebug>
#include "plotdatalog.h"
DialogPlotChannelChoose::DialogPlotChannelChoose(std::vector<PointList *> vecOfPointLists, QSplitter *pSplitterPlots, QWidget *pParent) :
QDialog(pParent),
m_pUi(new Ui::DialogPlotChannelChoose),
m_pSplitterPlots(pSplitterPlots),
m_VecOfPointLists(vecOfPointLists)
{
m_pUi->setupUi(this);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
// Add stacked widget for tables
m_pStackedTablesWidget = new QStackedWidget();
QGridLayout *stackedLayout = new QGridLayout(m_pUi->widgetTableContainer);
stackedLayout->setSpacing(0);
stackedLayout->setContentsMargins(0, 0, 0, 0);
stackedLayout->addWidget(m_pStackedTablesWidget);
connect(m_pUi->comboBoxPlotNumber,
static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
m_pStackedTablesWidget,
&QStackedWidget::setCurrentIndex);
// Create table for each plot
for (int plotIndex = 0; plotIndex < pSplitterPlots->count(); plotIndex++)
{
PlotDatalog* plot = qobject_cast<PlotDatalog *>(pSplitterPlots->children().at(plotIndex));
// Add plot number to drop down list
m_pUi->comboBoxPlotNumber->addItem(QString::number(plotIndex + 1));
// Create table for each plot
QTableWidget *table = new QTableWidget(vecOfPointLists.size(), 3, this);
table->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
table->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
table->setSelectionMode(QAbstractItemView::NoSelection);
table->setAlternatingRowColors(true);
table->verticalHeader()->hide();
table->verticalHeader()->setDefaultSectionSize(17);
table->setHorizontalHeaderItem(cColumnChannel, new QTableWidgetItem("Channel"));
table->setColumnWidth(cColumnChannel, 228);
table->setHorizontalHeaderItem(cColumnPlot, new QTableWidgetItem("Plot"));
table->setColumnWidth(cColumnPlot, 40);
table->setHorizontalHeaderItem(cColumnYAxis, new QTableWidgetItem("Y Axis"));
table->setColumnWidth(cColumnYAxis, 40);
// Add channels to table
int vecOfPointListsSize = static_cast<int>(vecOfPointLists.size());
for (int channel = 0; channel < vecOfPointListsSize; channel++)
{
// Column: Channel
PointList *pList = vecOfPointLists[channel];
QTableWidgetItem *itemName = new QTableWidgetItem(pList->getName());
itemName->setFlags(itemName->flags() ^ Qt::ItemIsEditable);
table->setItem(channel, cColumnChannel, itemName);
// Column: Plot
QWidget *chBoxContainerWidget = new QWidget();
QCheckBox *chBoxDraw = new QCheckBox(chBoxContainerWidget);
chBoxDraw->setChecked(plot->vecChannelsDraw[channel]);
QObject::connect(chBoxDraw,
&QCheckBox::stateChanged,
this,
&DialogPlotChannelChoose::checkBoxPlotStateChanged);
// Centre the checkbox
QHBoxLayout *pLayout = new QHBoxLayout(chBoxContainerWidget);
pLayout->addWidget(chBoxDraw);
pLayout->setAlignment(Qt::AlignCenter);
pLayout->setContentsMargins(0, 0, 0, 0);
table->setCellWidget(channel, cColumnPlot, chBoxContainerWidget);
// Column: Y Axis
QWidget *chBoxContainerWidgetYAxis = new QWidget();
QCheckBox *chBoxYAxis = new QCheckBox(chBoxContainerWidgetYAxis);
if (chBoxDraw->isChecked())
{
chBoxYAxis->setChecked(plot->vecChannelsYAxis[channel]);
}
else
{
chBoxYAxis->setEnabled(false);
}
QObject::connect(chBoxYAxis,
&QCheckBox::stateChanged,
this,
&DialogPlotChannelChoose::checkBoxYAxisStateChanged);
// Centre the checkbox
QHBoxLayout *pLayoutYAxis = new QHBoxLayout(chBoxContainerWidgetYAxis);
pLayoutYAxis->addWidget(chBoxYAxis);
pLayoutYAxis->setAlignment(Qt::AlignCenter);
pLayoutYAxis->setContentsMargins(0, 0, 0, 0);
table->setCellWidget(channel, cColumnYAxis, chBoxContainerWidgetYAxis);
}
table->setFocus();
table->selectRow(0);
// Add widget to bottom of stack
m_pStackedTablesWidget->insertWidget(0, table);
m_pStackedTablesWidget->setCurrentIndex(0);
}
}
DialogPlotChannelChoose::~DialogPlotChannelChoose()
{
delete m_pUi;
}
///
/// \brief DialogPlotChannelChoose::getCurrentTable
/// \param index
/// \return Returns table at index. If index is not provided, current table is returned.
///
QTableWidget *DialogPlotChannelChoose::getCurrentTable(int index)
{
QWidget *table;
if (index >= 0)
{
table = m_pStackedTablesWidget->widget(index);
}
else
{
table = m_pStackedTablesWidget->widget(m_pUi->comboBoxPlotNumber->currentIndex());
}
return qobject_cast<QTableWidget*>(table);
}
void DialogPlotChannelChoose::checkBoxPlotStateChanged(int state)
{
int senderRow = -1;
QCheckBox* senderCheckBox = qobject_cast<QCheckBox*>(sender());
// Get the sender row in the table
for (int i = 0; i < getCurrentTable()->rowCount(); i++)
{
if (getCurrentTable()->cellWidget(i, cColumnPlot)->children().at(0) == senderCheckBox)
{
senderRow = i;
break;
}
}
if (senderRow < 0)
{
qDebug() << "sender row not found";
return;
}
QCheckBox *chBoxYAxis = qobject_cast<QCheckBox *>(getCurrentTable()->cellWidget(senderRow, cColumnYAxis)->children().at(0));
if (state == false)
{
chBoxYAxis->setChecked(false);
}
chBoxYAxis->setEnabled(state);
}
void DialogPlotChannelChoose::checkBoxYAxisStateChanged(int /*state*/)
{
int senderRow = -1;
QCheckBox* senderCheckBox = qobject_cast<QCheckBox*>(sender());
// Get the sender row in the table
for (int i = 0; i < getCurrentTable()->rowCount(); i++)
{
if (getCurrentTable()->cellWidget(i, cColumnPlot)->children().at(0) == senderCheckBox)
{
senderRow = i;
break;
}
}
if (senderRow < 0)
{
qDebug() << "sender row not found";
return;
}
}
/*
QVector<QVector<bool>> DialogPlotChannelChoose::getSelectedPlotIndices()
{
// Create / resize 2d vector
QVector<QVector<bool>> isSelectedVector2d(_stackedTables->count());
for(int outer = 0; outer < isSelectedVector2d.size(); outer++)
{
isSelectedVector2d[outer].resize(getCurrentTable()->rowCount());
}
for (int tableIndex = 0; tableIndex < _stackedTables->count(); tableIndex++)
{
for (int channel = 0; channel < getCurrentTable(tableIndex)->rowCount(); channel++)
{
QCheckBox *chBox = qobject_cast<QCheckBox *>(getCurrentTable(tableIndex)->cellWidget(channel, ColumnPlot)->children().at(0));
if (chBox->isChecked())
{
isSelectedVector2d[tableIndex][channel] = true;
}
else
{
isSelectedVector2d[tableIndex][channel] = false;
}
}
}
return isSelectedVector2d;
}
QList<int> DialogPlotChannelChoose::getSelectedYAxisIndices()
{
QList<int> selectedIndices;
for (int row = 0; row < getCurrentTable()->rowCount(); row++)
{
QCheckBox *chBox = qobject_cast<QCheckBox *>(getCurrentTable()->cellWidget(row, ColumnYAxis)->children().at(0));
if (chBox->isChecked())
{
//qDebug() << row;
selectedIndices.append(row);
}
}
return selectedIndices;
}
*/
void DialogPlotChannelChoose::on_btnSelectAll_clicked()
{
for (int row = 0; row < getCurrentTable()->rowCount(); row++)
{
QCheckBox *chBox = qobject_cast<QCheckBox *>(getCurrentTable()->cellWidget(row, cColumnPlot)->children().at(0));
chBox->setChecked(true);
}
}
void DialogPlotChannelChoose::on_btnDeselectAll_clicked()
{
for (int row = 0; row < getCurrentTable()->rowCount(); row++)
{
QCheckBox *chBox = qobject_cast<QCheckBox *>(getCurrentTable()->cellWidget(row, cColumnPlot)->children().at(0));
chBox->setChecked(false);
}
}
void DialogPlotChannelChoose::on_buttonBox_accepted()
{
for (int plotIndex = 0; plotIndex < m_pSplitterPlots->count(); plotIndex++)
{
PlotDatalog* plot = qobject_cast<PlotDatalog*>(m_pSplitterPlots->widget(plotIndex));
// Clear all points from all plots
plot->clearPointLists();
for (int channel = 0; channel < getCurrentTable(plotIndex)->rowCount(); channel++)
{
QCheckBox *chBoxDrawChannel = qobject_cast<QCheckBox *>(getCurrentTable(plotIndex)->cellWidget(channel, cColumnPlot)->children().at(0));
QCheckBox *chBoxYAxis = qobject_cast<QCheckBox *>(getCurrentTable(plotIndex)->cellWidget(channel, cColumnYAxis)->children().at(0));
if (chBoxDrawChannel->isChecked())
{
plot->addPointList(m_VecOfPointLists.at(channel));
}
plot->vecChannelsDraw[channel] = chBoxDrawChannel->isChecked();
plot->vecChannelsYAxis[channel] = chBoxYAxis->isChecked();
}
}
}
| 33.597222
| 148
| 0.632906
|
cyferc
|
d64e446dff7144ca8d332cb99165bcb8e195f0bd
| 707
|
cpp
|
C++
|
src/axl_fsm/axl_fsm_StdRegexNameMgr.cpp
|
wandns/axl
|
5686b94b18033df13a9e1656e1aaaf086c442a21
|
[
"MIT"
] | null | null | null |
src/axl_fsm/axl_fsm_StdRegexNameMgr.cpp
|
wandns/axl
|
5686b94b18033df13a9e1656e1aaaf086c442a21
|
[
"MIT"
] | null | null | null |
src/axl_fsm/axl_fsm_StdRegexNameMgr.cpp
|
wandns/axl
|
5686b94b18033df13a9e1656e1aaaf086c442a21
|
[
"MIT"
] | null | null | null |
//..............................................................................
//
// This file is part of the AXL library.
//
// AXL is distributed under the MIT license.
// For details see accompanying license.txt file,
// the public copy of which is also available at:
// http://tibbo.com/downloads/archive/axl/license.txt
//
//..............................................................................
#include "pch.h"
#include "axl_fsm_StdRegexNameMgr.h"
namespace axl {
namespace fsm {
//..............................................................................
//..............................................................................
} // namespace fsm
} // namespace axl
| 29.458333
| 80
| 0.381895
|
wandns
|
d64e7ea4e4dabafa189a4fea5e17aaaaaa8ecd54
| 4,641
|
hpp
|
C++
|
ext/tatara/array/integer/int_array.hpp
|
S-H-GAMELINKS/tatara
|
b849be7c7a9d097b2c0bd0b5df5bbb21ec96d3c0
|
[
"MIT"
] | 6
|
2019-08-16T11:35:43.000Z
|
2019-11-16T07:57:06.000Z
|
ext/tatara/array/integer/int_array.hpp
|
S-H-GAMELINKS/tatara
|
b849be7c7a9d097b2c0bd0b5df5bbb21ec96d3c0
|
[
"MIT"
] | 378
|
2019-08-15T07:55:18.000Z
|
2020-02-16T12:22:34.000Z
|
ext/tatara/array/integer/int_array.hpp
|
S-H-GAMELINKS/tatara
|
b849be7c7a9d097b2c0bd0b5df5bbb21ec96d3c0
|
[
"MIT"
] | 1
|
2019-09-02T15:32:58.000Z
|
2019-09-02T15:32:58.000Z
|
#ifndef INT_ARRAY_HPP_
#define INT_ARRAY_HPP_
#include <ruby.h>
#include <vector>
#include <algorithm>
#include <iterator>
#include <iostream>
static VALUE int_array_init(VALUE self) {
return self;
}
static VALUE int_array_first(VALUE self) {
return rb_ary_entry(self, 0);
}
static VALUE int_array_last(VALUE self) {
const long length = RARRAY_LEN(self);
if (length == 0) return Qnil;
return rb_ary_entry(self, length - 1);
}
static VALUE int_array_bracket(VALUE self, VALUE index) {
return rb_ary_entry(self, NUM2LONG(index));
}
static VALUE int_array_bracket_equal(VALUE self, VALUE index, VALUE value) {
if (FIXNUM_P(value)) {
long i = NUM2LONG(index);
rb_ary_store(self, i, value);
return value;
} else {
rb_raise(rb_eTypeError, "Worng Type! This Value type is %s !", rb_class_name(value));
return Qnil;
}
}
static VALUE int_array_push(VALUE self, VALUE value) {
if (FIXNUM_P(value)) {
rb_ary_push(self, value);
return self;
} else {
rb_raise(rb_eTypeError, "Worng Type! This Value type is %s !", rb_class_name(value));
return Qnil;
}
}
static VALUE int_array_size(VALUE self) {
return LONG2NUM(RARRAY_LEN(self));
}
static VALUE int_array_clear(VALUE self) {
rb_ary_clear(self);
return self;
}
static VALUE int_array_map(VALUE self) {
std::size_t size = RARRAY_LEN(self);
VALUE collection = rb_obj_dup(self);
for(int i = 0; i < size; i++) {
VALUE val = int_array_bracket(self, INT2NUM(i));
int_array_bracket_equal(collection, INT2NUM(i), rb_yield(val));
}
return collection;
}
static VALUE int_array_destructive_map(VALUE self) {
std::size_t size = RARRAY_LEN(self);
for(int i = 0; i < size; i++) {
VALUE val = int_array_bracket(self, INT2NUM(i));
int_array_bracket_equal(self, INT2NUM(i), rb_yield(val));
}
return self;
}
static VALUE int_array_each_with_index(VALUE self) {
std::size_t size = RARRAY_LEN(self);
VALUE collection = rb_obj_dup(self);
for(int i = 0; i < size; i++) {
VALUE val = int_array_bracket(self, INT2NUM(i));
VALUE key_value = rb_ary_new2(2);
rb_ary_push(key_value, val);
rb_ary_push(key_value, INT2NUM(i));
rb_ary_push(collection, rb_yield(key_value));
}
return collection;
}
static VALUE int_array_convert_array(VALUE self) {
std::size_t size = RARRAY_LEN(self);
VALUE collection = rb_ary_new2(size);
for(int i = 0; i < size; i++) {
VALUE val = int_array_bracket(self, INT2NUM(i));
rb_ary_push(collection, val);
}
return collection;
}
static VALUE int_array_import_array(VALUE self, VALUE ary) {
std::size_t size = RARRAY_LEN(ary);
for(int i = 0; i < size; i++) {
VALUE val = rb_ary_entry(ary, i);
int_array_push(self, val);
}
return self;
}
static VALUE int_array_sum(VALUE self) {
std::size_t size = RARRAY_LEN(self);
long result = 0;
for (int i = 0; i < size; i++) {
VALUE val = int_array_bracket(self, INT2NUM(i));
result += NUM2LONG(val);
}
return LONG2NUM(result);
}
static VALUE int_array_sort(VALUE self) {
return rb_ary_sort(self);
}
extern "C" {
inline void Init_int_array(VALUE mTatara) {
VALUE rb_cIntArray = rb_define_class_under(mTatara, "IntArray", rb_cArray);
rb_define_private_method(rb_cIntArray, "initialize", int_array_init, 0);
rb_define_method(rb_cIntArray, "first", int_array_first, 0);
rb_define_method(rb_cIntArray, "last", int_array_last, 0);
rb_define_method(rb_cIntArray, "[]", int_array_bracket, 1);
rb_define_method(rb_cIntArray, "[]=", int_array_bracket_equal, 2);
rb_define_method(rb_cIntArray, "push", int_array_push, 1);
rb_define_method(rb_cIntArray, "size", int_array_size, 0);
rb_define_method(rb_cIntArray, "clear", int_array_clear, 0);
rb_define_alias(rb_cIntArray, "<<", "push");
rb_define_method(rb_cIntArray, "map", int_array_map, 0);
rb_define_method(rb_cIntArray, "map!", int_array_destructive_map, 0);
rb_define_alias(rb_cIntArray, "each", "map");
rb_define_method(rb_cIntArray, "each_with_index", int_array_each_with_index, 0);
rb_define_method(rb_cIntArray, "to_array", int_array_convert_array, 0);
rb_define_method(rb_cIntArray, "import_array", int_array_import_array, 1);
rb_define_method(rb_cIntArray, "sum", int_array_sum, 0);
rb_define_method(rb_cIntArray, "sort", int_array_sort, 0);
}
}
#endif
| 27.3
| 93
| 0.664081
|
S-H-GAMELINKS
|
d65105f7124e34e006397ffc4eb686cf9b87ab8c
| 627
|
hpp
|
C++
|
src/include/helper.hpp
|
allen880117/Simulated-Quantum-Annealing
|
84ce0a475a9f132502c4bb4e9b4ca5824cdb7630
|
[
"MIT"
] | 2
|
2021-09-08T08:01:27.000Z
|
2021-11-21T00:08:56.000Z
|
src/include/helper.hpp
|
allen880117/Simulated-Quantum-Annealing
|
84ce0a475a9f132502c4bb4e9b4ca5824cdb7630
|
[
"MIT"
] | null | null | null |
src/include/helper.hpp
|
allen880117/Simulated-Quantum-Annealing
|
84ce0a475a9f132502c4bb4e9b4ca5824cdb7630
|
[
"MIT"
] | null | null | null |
#ifndef _HELPER_HPP_
#define _HELPER_HPP_
#include "sqa.hpp"
/* Progress Bar */
#define PBSTR "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
#define PBWIDTH 60
/* Print the progress bar */
void printProgress(double percentage);
/* Generate Random Initial State */
void generateRandomState(spin_t trotters[MAX_NTROT][MAX_NSPIN], int nTrot,
int nSpin);
/* Compute Energy Summation of A Trotter*/
fp_t computeEnergyPerTrotter(int nSpin, spin_t trotter[MAX_NSPIN],
fp_t Jcoup[MAX_NSPIN][MAX_NSPIN],
fp_t h[MAX_NSPIN]);
#endif
| 27.26087
| 76
| 0.590112
|
allen880117
|
d651893644eb14548298ed0bad64c2821f706b20
| 3,457
|
cpp
|
C++
|
RandPass.cpp
|
abdulrahmanabdulazeez/RandPass
|
e7b11c2f577d3ca460358bfa826e7939825cccc4
|
[
"MIT"
] | 2
|
2021-09-13T15:34:30.000Z
|
2021-09-30T22:16:44.000Z
|
RandPass.cpp
|
abdulrahmanabdulazeez/RandPass
|
e7b11c2f577d3ca460358bfa826e7939825cccc4
|
[
"MIT"
] | null | null | null |
RandPass.cpp
|
abdulrahmanabdulazeez/RandPass
|
e7b11c2f577d3ca460358bfa826e7939825cccc4
|
[
"MIT"
] | null | null | null |
//Do not copy:
//More Advanced Version:
//Random Password Generator:
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <fstream>
using namespace std;
void help();
void PASSINTRO(){
cout << "------------------------------------------------------------\n\n";
cout << " RANDOM PASSWORD GENERATOR\n";
cout << "\n\nIf you notice any bug, contact me @ \n"
<< "https://web.facebook.com/abdulrahman.abdulazeez.5243/ \n\n";
cout << "----------------------------------------------------------V2.0\n";
cout << "\n\n";
}
int main(){
system("COLOR A");
srand(time(0));
PASSINTRO();
string optionSelect;
cout << "\n [1] Generate Random Password.\n";
cout << " [2] Help.\n";
cout << " [3] Exit.\n\n";
cout << "Select an option: ";
cin >> optionSelect;
while (optionSelect != "1"){
if (optionSelect == "3"){
return 0;
}
else if (optionSelect == "2"){
help();
string key;
cout << "\n\nEnter any key to continue!";
cin >> key;
system ("CLS");
main();
}
cout << "Wrong Option!";
system ("CLS");
main();
}
if (optionSelect == "1"){
//Nothing;
}
else if (optionSelect == "2"){
return 0;
}
else {
return 0;
}
char NumLetSym[] = "zxcvbnmqpwoeirutyalskdjfhgQWERTYUIOPASDFGHJKLMNBVCZ1234567890:/.,()[]';?>|<!@#$%^&*";
int conv = sizeof(NumLetSym);
cout << "\nWhat do you want to generate a password for? \n\n"
<< "Hint: It could be Facebook, Google, name it and we would do just that \n"
<< "for you. \n\n";
string reason;
cout << "Reason: ";
cin >> reason;
cout << "\nEnter the length of password you want to generate: ";
int n;
cin >>n;
int load;
for (load=0; load <= 100; load++){
system("cls");
PASSINTRO();
cout << "Generating Password......." << load << "%";
cout << "\n\n";
}
int i;
ofstream RandomPass(reason + ".html");
for(i = 0; i < n; i++){
RandomPass << NumLetSym[rand() % conv];
}
RandomPass.close();
string Reader;
ifstream RandomPasser(reason + ".html");
while (getline (RandomPasser, Reader)) {
cout << "===================================================\n";
cout << " " << reason << " generated password: ";
cout << Reader;
cout << "\n===================================================\n\n";
}
cout << "Generated password has been saved in " << reason << ".html on your desktop.\n";
cout << "Note: You are to open it with any text viewer you have available.\n\n";
RandomPasser.close();
cout << "Do you want to re-generate another Password?[Y/N]: ";
string yesNo;
cin >> yesNo;
while (yesNo != "Y"){
if (yesNo == "N"){
return 0;
}
else if (yesNo == "y"){
system ("CLS");
}
else if (yesNo == "n"){
return 0;
}
cout << " Wrong option!!\n\n";
cout << "Do you want to re-generate another Password?[Y/N]: ";
cin >> yesNo;
}
if (yesNo == "Y"){
system("CLS");
cout << "\n";
main();
}
else if (yesNo == "N"){
return 0;
}
else if (yesNo == "y"){
system("CLS");
cout << "\n";
main();
}
else if (yesNo == "n"){
return 0;
}
else {
return 0;
}
return 0;
}
void help(){
cout << "\n\nAn advanced Random Password generator which generates very strong passwords \n"
<< "containing Letters(Small & Capital), Symbols and Numbers. This program also gives \n"
<< "you an option to specify the reason for the password to be created and stores the \n"
<< "generated password on your desktop with the reason you specified as filename \n"
<< "thereby making it easy to check on incase you forget the password generated \n"
<< "\nNote: The password stored on your desktop is in a HTML format. You can choose to \n"
<< "open with any text viewer of your choice.!";
}
| 24.174825
| 105
| 0.596182
|
abdulrahmanabdulazeez
|
d6618d5c25345e95ecb195b5f0d64cc65ad2cd5f
| 275
|
cpp
|
C++
|
2021.10.03-homework-3/Project3/Source.cpp
|
st095227/homework_2021-2022
|
7b3abd8848ead7456972c5d2f0f4404532e299bc
|
[
"Apache-2.0"
] | null | null | null |
2021.10.03-homework-3/Project3/Source.cpp
|
st095227/homework_2021-2022
|
7b3abd8848ead7456972c5d2f0f4404532e299bc
|
[
"Apache-2.0"
] | null | null | null |
2021.10.03-homework-3/Project3/Source.cpp
|
st095227/homework_2021-2022
|
7b3abd8848ead7456972c5d2f0f4404532e299bc
|
[
"Apache-2.0"
] | null | null | null |
#include <iostream>
using namespace std;
int main(int argv, char* argc[])
{
int n = 0;
cin >> n;
int i = 0;
int b = 0;
while (n != 0)
{
++i;
for (int j = 0; j < i && n>0; ++j)
{
++b;
cout << b << ' ';
--n;
}
cout << endl;
}
return EXIT_SUCCESS;
}
| 11.956522
| 36
| 0.461818
|
st095227
|
69936abdf09f2bb3af3d7e3ffd4be62b0809830e
| 1,283
|
cpp
|
C++
|
ReactionPlus/Exec/InputDevice.cpp
|
stricq/AmigaSynergy
|
fd81da853b3c5a50a2bb5c160c5f7320daaa7571
|
[
"MIT"
] | 1
|
2022-03-05T11:30:18.000Z
|
2022-03-05T11:30:18.000Z
|
ReactionPlus/Exec/InputDevice.cpp
|
stricq/AmigaSynergy
|
fd81da853b3c5a50a2bb5c160c5f7320daaa7571
|
[
"MIT"
] | null | null | null |
ReactionPlus/Exec/InputDevice.cpp
|
stricq/AmigaSynergy
|
fd81da853b3c5a50a2bb5c160c5f7320daaa7571
|
[
"MIT"
] | 1
|
2022-03-06T11:22:44.000Z
|
2022-03-06T11:22:44.000Z
|
#include "InputDevice.hpp"
#include <proto/exec.h>
namespace RAPlus {
namespace Exec {
InputDevice::InputDevice() {
stdRequest = new StandardIORequest();
inputBit = stdRequest->getSignal();
inputStat = IExec->OpenDevice("input.device",0,stdRequest->getIORequest(),0);
if (inputStat != 0) {
delete stdRequest;
throw InputDeviceException();
}
}
InputDevice::~InputDevice() {
if (inputStat == 0) IExec->CloseDevice(stdRequest->getIORequest());
delete stdRequest;
}
void InputDevice::addEvent(InputEvent &event) {
stdRequest->setCommand(IND_ADDEVENT);
stdRequest->setData(event.getInputEvent());
stdRequest->setLength(event.getLength());
IExec->DoIO(stdRequest->getIORequest());
}
void InputDevice::writeEvent(InputEvent &event) {
stdRequest->setCommand(IND_WRITEEVENT);
stdRequest->setData(event.getInputEvent());
stdRequest->setLength(event.getLength());
IExec->DoIO(stdRequest->getIORequest());
}
void InputDevice::addHandler(Interrupt &interrupt) {
stdRequest->setCommand(IND_ADDHANDLER);
stdRequest->setData(interrupt.getInterrupt());
IExec->DoIO(stdRequest->getIORequest());
}
}
}
| 18.328571
| 83
| 0.64926
|
stricq
|
6996320db8fe0598e39bb64e6787114c0b66766d
| 1,275
|
hpp
|
C++
|
vcl/math/interpolation/interpolation.hpp
|
PPonc/inf443-vcl
|
4d7bb0130c4bc44e089059464223eca318fdbd00
|
[
"MIT"
] | null | null | null |
vcl/math/interpolation/interpolation.hpp
|
PPonc/inf443-vcl
|
4d7bb0130c4bc44e089059464223eca318fdbd00
|
[
"MIT"
] | null | null | null |
vcl/math/interpolation/interpolation.hpp
|
PPonc/inf443-vcl
|
4d7bb0130c4bc44e089059464223eca318fdbd00
|
[
"MIT"
] | null | null | null |
#pragma once
#include "../../containers/containers.hpp"
namespace vcl
{
/** Interpolate value(x,y) using bilinear interpolation
* - value: grid_2D - coordinates assumed to be its indices
* - (x,y): coordinates assumed to be \in [0,value.dimension.x-1] X [0,value.dimension.y]
*/
template <typename T>
T interpolation_bilinear(grid_2D<T> const& value, float x, float y);
}
namespace vcl
{
template <typename T>
T interpolation_bilinear(grid_2D<T> const& value, float x, float y)
{
int const x0 = int(std::floor(x));
int const y0 = int(std::floor(y));
int const x1 = x0+1;
int const y1 = y0+1;
assert_vcl_no_msg(x0>=0 && x0<value.dimension.x);
assert_vcl_no_msg(x1>=0 && x1<value.dimension.x);
assert_vcl_no_msg(y0>=0 && y0<value.dimension.y);
assert_vcl_no_msg(y1>=0 && y1<value.dimension.y);
float const dx = x-x0;
float const dy = y-y0;
assert_vcl_no_msg(dx>=0 && dx<1);
assert_vcl_no_msg(dy>=0 && dy<1);
T const v =
(1-dx)*(1-dy)*value(x0,y0) +
(1-dx)*dy*value(x0,y1) +
dx*(1-dy)*value(x1,y0) +
dx*dy*value(x1,y1);
return v;
}
}
| 28.333333
| 93
| 0.561569
|
PPonc
|
699a62f6968b573dd616ee87b0562dfe71ffd169
| 413
|
cpp
|
C++
|
AIBattleground/Src/AISystemBase.cpp
|
CerberusDev/AIBattleground
|
78cb72aeb9f33ff630a01df26c3056b7b7027c69
|
[
"MIT"
] | null | null | null |
AIBattleground/Src/AISystemBase.cpp
|
CerberusDev/AIBattleground
|
78cb72aeb9f33ff630a01df26c3056b7b7027c69
|
[
"MIT"
] | null | null | null |
AIBattleground/Src/AISystemBase.cpp
|
CerberusDev/AIBattleground
|
78cb72aeb9f33ff630a01df26c3056b7b7027c69
|
[
"MIT"
] | null | null | null |
// ----------------------------------------------------------------------------
// ------------- AI Battleground, Copyright(C) Maciej Pryc, 2016 --------------
// ----------------------------------------------------------------------------
#include "AISystemBase.h"
AISystemBase::AISystemBase(class Blackboard* argBlackboard) :
Blackboard(argBlackboard)
{
}
AISystemBase::~AISystemBase()
{
}
| 24.294118
| 80
| 0.380145
|
CerberusDev
|
69a07f728b17bc1b66924920a2d4d4642b548472
| 5,304
|
cpp
|
C++
|
nau/src/nau/render/materialSortRenderQueue.cpp
|
Khirion/nau
|
47a2ad8e0355a264cd507da5e7bba1bf7abbff95
|
[
"MIT"
] | 29
|
2015-09-16T22:28:30.000Z
|
2022-03-11T02:57:36.000Z
|
nau/src/nau/render/materialSortRenderQueue.cpp
|
Khirion/nau
|
47a2ad8e0355a264cd507da5e7bba1bf7abbff95
|
[
"MIT"
] | 1
|
2017-03-29T13:32:58.000Z
|
2017-03-31T13:56:03.000Z
|
nau/src/nau/render/materialSortRenderQueue.cpp
|
Khirion/nau
|
47a2ad8e0355a264cd507da5e7bba1bf7abbff95
|
[
"MIT"
] | 10
|
2015-10-15T14:20:15.000Z
|
2022-02-17T10:37:29.000Z
|
#include "nau/render/materialSortRenderQueue.h"
#include "nau.h"
#include "nau/render/iRenderable.h"
#include "nau/geometry/boundingBox.h"
#include "nau/debug/profile.h"
using namespace nau::render;
using namespace nau::scene;
using namespace nau::material;
using namespace nau::math;
using namespace nau;
typedef std::pair<std::shared_ptr<MaterialGroup>, mat4*> pair_MatGroup_Transform;
#pragma warning( disable : 4503)
MaterialSortRenderQueue::MaterialSortRenderQueue(void) {
}
MaterialSortRenderQueue::~MaterialSortRenderQueue(void) {
clearQueue();
}
void
MaterialSortRenderQueue::clearQueue (void) {
std::map<int, std::map<std::shared_ptr<Material>, std::vector<pair_MatGroup_Transform >* >* >::iterator mapIter;
mapIter = m_RenderQueue.begin();
for ( ; mapIter != m_RenderQueue.end(); mapIter++) {
std::map <std::shared_ptr<Material>, std::vector<pair_MatGroup_Transform >* > *aMap;
std::map <std::shared_ptr<Material>, std::vector<pair_MatGroup_Transform >* >::iterator mapIter2;
aMap = (*mapIter).second;
mapIter2 = aMap->begin();
for ( ; mapIter2 != aMap->end(); mapIter2++) {
//if ((*mapIter2).second != NULL)
delete (*mapIter2).second;
}
delete aMap;
}
m_RenderQueue.clear(); /***MARK***/ //Possible memory leak
}
void
MaterialSortRenderQueue::addToQueue (std::shared_ptr<SceneObject> &aObject,
std::map<std::string, MaterialID> &materialMap) {
PROFILE ("Queue add");
int order;
std::shared_ptr<Material> aMaterial;
std::shared_ptr<IRenderable> &aRenderable = aObject->getRenderable();
std::vector<std::shared_ptr<MaterialGroup>> vMaterialGroups = aRenderable->getMaterialGroups();
for (auto &aGroup: vMaterialGroups) {
std::shared_ptr<nau::geometry::IndexData> &indexData = aGroup->getIndexData();
{
PROFILE ("Get material");
aMaterial = materialMap[aGroup->getMaterialName()].m_MatPtr;
}
order = aMaterial->getState()->getPropi(IState::ORDER);
if ((order >= 0) && (aMaterial) && (true == aMaterial->isEnabled())) {
if (0 == m_RenderQueue.count (order)){
m_RenderQueue[order] = new std::map <std::shared_ptr<Material>, std::vector<pair_MatGroup_Transform >* >;
}
std::map<std::shared_ptr<Material>, std::vector<pair_MatGroup_Transform >* > *materialMap = m_RenderQueue[order];
if (0 == materialMap->count (aMaterial)) {
(*materialMap)[aMaterial] = new std::vector<pair_MatGroup_Transform >;
}
std::vector<pair_MatGroup_Transform > *matGroupVec = (*materialMap)[aMaterial];
matGroupVec->push_back (pair_MatGroup_Transform(aGroup, aObject->_getTransformPtr()));
}
}
// ADD BOUNDING BOXES TO QUEUE
#ifdef NAU_RENDER_FLAGS
if (NAU->getRenderFlag(Nau::BOUNDING_BOX_RENDER_FLAG)) {
Profile("Enqueue Bounding Boxes");
vMaterialGroups = nau::geometry::BoundingBox::getGeometry()->getMaterialGroups();
for (auto& aGroup: vMaterialGroups) {
std::shared_ptr<Material> &aMaterial = MATERIALLIBMANAGER->getMaterial(aGroup->getMaterialName());
mat4 *trans = &((nau::geometry::BoundingBox *)(aObject->getBoundingVolume()))->getTransform();
if (0 == m_RenderQueue.count (0)){
m_RenderQueue[0] = new std::map <std::shared_ptr<Material>, std::vector<pair_MatGroup_Transform >* >;
}
std::map<std::shared_ptr<Material>, std::vector<pair_MatGroup_Transform >* > *materialMap = m_RenderQueue[aMaterial->getState()->getPropi(IState::ORDER)];
if (0 == materialMap->count (aMaterial)) {
(*materialMap)[aMaterial] = new std::vector<pair_MatGroup_Transform >;
}
std::vector<pair_MatGroup_Transform > *matGroupVec = (*materialMap)[aMaterial];
nau::geometry::BoundingBox *bb = (nau::geometry::BoundingBox *)(aObject->getBoundingVolume());
matGroupVec->push_back( pair_MatGroup_Transform(aGroup, &(bb->getTransform())));
}
}
#endif
}
void
MaterialSortRenderQueue::processQueue (void) {
PROFILE ("Process queue");
IRenderer *renderer = RENDERER;
std::map <int, std::map<std::shared_ptr<Material>, std::vector<pair_MatGroup_Transform >* >* >::iterator renderQueueIter;
renderQueueIter = m_RenderQueue.begin();
for (; renderQueueIter != m_RenderQueue.end(); ++renderQueueIter) {
std::map<std::shared_ptr<Material>, std::vector<pair_MatGroup_Transform >* >::iterator materialMapIter;
materialMapIter = (*renderQueueIter).second->begin();
for (; materialMapIter != (*renderQueueIter).second->end(); materialMapIter++) {
const std::shared_ptr<Material> &aMat = (*materialMapIter).first;
{
PROFILE ("Material prepare");
RENDERER->setMaterial(aMat);
//aMat->prepare();
}
std::vector<pair_MatGroup_Transform >::iterator matGroupsIter;
matGroupsIter = (*materialMapIter).second->begin();
{
PROFILE ("Geometry rendering");
for (; matGroupsIter != (*materialMapIter).second->end(); ++matGroupsIter) {
bool b = (*matGroupsIter).second->isIdentity();
if (!b) {
renderer->pushMatrix(IRenderer::MODEL_MATRIX);
renderer->applyTransform(IRenderer::MODEL_MATRIX, *(*matGroupsIter).second);
aMat->setUniformValues();
aMat->setUniformBlockValues();
}
{
PROFILE("Draw");
renderer->drawGroup ((*matGroupsIter).first);
}
if (!b)
renderer->popMatrix(IRenderer::MODEL_MATRIX);
}
}
aMat->restore();
}
}
}
| 31.384615
| 158
| 0.697775
|
Khirion
|
69a195aec5b82d7c089d79f41e41520f1653bee4
| 430
|
cpp
|
C++
|
Classes/Retan_class/main.cpp
|
Bernardo1411/Programacao_Avancada
|
5005b60155648872ca9d4f374b3d9ea035aa33a3
|
[
"MIT"
] | null | null | null |
Classes/Retan_class/main.cpp
|
Bernardo1411/Programacao_Avancada
|
5005b60155648872ca9d4f374b3d9ea035aa33a3
|
[
"MIT"
] | null | null | null |
Classes/Retan_class/main.cpp
|
Bernardo1411/Programacao_Avancada
|
5005b60155648872ca9d4f374b3d9ea035aa33a3
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include "ponto.h"
using namespace std;
int main()
{
ponto p1(2,3), p2(5,6);
cout << p1;
cout << p2;
cout << "distancia P1 e P2: " << p1.dist(p2) << endl;
cout << "area P1 e P2: " << p1.area(p2) << endl;
ponto p3 = p1;
cout << p3;
cout << "distancia P3 e P2: " << p3.dist(p2) << endl;
cout << "area P3 e P2: " << p3.area(p2) << endl;
cin.get();
return 0;
}
| 15.925926
| 57
| 0.5
|
Bernardo1411
|
69a390cc0c446131353ccbc58108b6fc8dd3316a
| 26,342
|
cpp
|
C++
|
Testbed/Framework/Main.cpp
|
louis-langholtz/Box2D
|
7c74792bf177cf36640d735de2bba0225bf7f852
|
[
"Zlib"
] | 32
|
2016-10-20T05:55:04.000Z
|
2021-11-25T16:34:41.000Z
|
Testbed/Framework/Main.cpp
|
louis-langholtz/Box2D
|
7c74792bf177cf36640d735de2bba0225bf7f852
|
[
"Zlib"
] | 50
|
2017-01-07T21:40:16.000Z
|
2018-01-31T10:04:05.000Z
|
Testbed/Framework/Main.cpp
|
louis-langholtz/Box2D
|
7c74792bf177cf36640d735de2bba0225bf7f852
|
[
"Zlib"
] | 7
|
2017-02-09T10:02:02.000Z
|
2020-07-23T22:49:04.000Z
|
/*
* Original work Copyright (c) 2006-2013 Erin Catto http://www.box2d.org
* Modified work Copyright (c) 2017 Louis Langholtz https://github.com/louis-langholtz/Box2D
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#include "imgui.h"
#include "RenderGL3.h"
#include "DebugDraw.hpp"
#include "Test.hpp"
#include "TestEntry.hpp"
#include <sstream>
#include <iostream>
#include <iomanip>
#include <memory>
#include <string>
#if defined(__APPLE__)
#include <OpenGL/gl3.h>
#else
#include <GL/glew.h>
#endif
#include <GLFW/glfw3.h>
#include <cstdio>
#if defined(_WIN32) || defined(_WIN64)
#include <direct.h>
#else
#include <cstdlib>
#include <cerrno>
#include <unistd.h>
#endif
#ifdef _MSC_VER
#define snprintf _snprintf
#endif
using namespace box2d;
//
struct UIState
{
bool showMenu;
int scroll;
int scrollarea1;
bool mouseOverMenu;
bool chooseTest;
};
class Selection
{
public:
using size_type = std::size_t;
Selection(size_type size, size_type selection = 0):
m_size(size),
m_selection(selection < size? selection: 0)
{
assert(size > 0);
assert(selection < size);
}
size_type Get() const
{
return m_selection;
}
void Set(size_type selection)
{
assert(selection < m_size);
if (selection < m_size)
{
m_selection = selection;
}
}
void Increment()
{
const auto next = m_selection + 1;
m_selection = (next < m_size)? next: 0;
}
void Decrement()
{
m_selection = (m_selection > 0)? m_selection - 1: m_size - 1;
}
private:
size_type m_selection = 0;
size_type m_size = 0;
};
class TestSuite
{
public:
using size_type = std::size_t;
TestSuite(Span<const TestEntry> testEntries, size_type index = 0):
m_testEntries(testEntries),
m_testIndex(index < testEntries.size()? index: 0)
{
assert(testEntries.size() > 0);
m_test = testEntries[m_testIndex].createFcn();
}
size_type GetTestCount() const
{
return m_testEntries.size();
}
Test* GetTest() const
{
return m_test.get();
}
size_type GetIndex() const
{
return m_testIndex;
}
const char* GetName(std::size_t index) const
{
return m_testEntries[index].name;
}
const char* GetName() const
{
return m_testEntries[m_testIndex].name;
}
void SetIndex(size_type index)
{
assert(index < GetTestCount());
m_testIndex = index;
RestartTest();
}
void RestartTest()
{
m_test = m_testEntries[m_testIndex].createFcn();
}
private:
Span<const TestEntry> m_testEntries;
size_type m_testIndex;
std::unique_ptr<Test> m_test;
};
//
namespace
{
TestSuite *g_testSuite = nullptr;
Selection *g_selection = nullptr;
Camera camera;
UIState ui;
Settings settings;
auto rightMouseDown = false;
auto leftMouseDown = false;
Length2D lastp;
Coord2D mouseScreen = Coord2D{0.0, 0.0};
Length2D mouseWorld = Length2D{0, 0};
const auto menuY = 10;
const auto menuWidth = 200;
auto menuX = 0;
auto menuHeight = 0;
}
static auto GetCwd()
{
// In C++17 this implementation should be replaced with fs::current_path()
auto retval = std::string();
#if defined(_WIN32) || defined(_WIN64)
const auto buffer = _getcwd(NULL, 0);
if (buffer)
{
retval += std::string(buffer);
std::free(buffer);
}
#else
char buffer[1024];
if (getcwd(buffer, sizeof(buffer)))
{
retval += buffer;
}
#endif
return retval;
}
static void CreateUI()
{
ui.showMenu = true;
ui.scroll = 0;
ui.scrollarea1 = 0;
ui.chooseTest = false;
ui.mouseOverMenu = false;
// Init UI
const char* fontPaths[] = {
// Path if Testbed running from MSVS or Xcode Build folder.
"../../Testbed/Data/DroidSans.ttf",
// This is the original path...
"../Data/DroidSans.ttf",
// Path if Testbed app running from Testbed folder
"Data/DroidSans.ttf",
// Possibly a relative path for windows...
"../../../../Data/DroidSans.ttf",
// Try the current working directory...
"./DroidSans.ttf",
};
const auto cwd = GetCwd();
if (cwd.empty())
{
std::perror("GetCwd");
}
for (auto&& fontPath: fontPaths)
{
fprintf(stderr, "Attempting to load font from \"%s/%s\", ", cwd.c_str(), fontPath);
if (RenderGLInitFont(fontPath))
{
fprintf(stderr, "succeeded.\n");
break;
}
fprintf(stderr, " failed.\n");
}
if (!RenderGLInit())
{
fprintf(stderr, "Could not init GUI renderer.\n");
assert(false);
return;
}
}
static void ResizeWindow(GLFWwindow*, int width, int height)
{
camera.m_width = width;
camera.m_height = height;
menuX = camera.m_width - menuWidth - 10;
menuHeight = camera.m_height - 20;
}
static Test::Key GlfwKeyToTestKey(int key)
{
switch (key)
{
case GLFW_KEY_SPACE: return Test::Key_Space;
case GLFW_KEY_COMMA: return Test::Key_Comma;
case GLFW_KEY_MINUS: return Test::Key_Minus;
case GLFW_KEY_PERIOD: return Test::Key_Period;
case GLFW_KEY_EQUAL: return Test::Key_Equal;
case GLFW_KEY_0: return Test::Key_0;
case GLFW_KEY_1: return Test::Key_1;
case GLFW_KEY_2: return Test::Key_2;
case GLFW_KEY_3: return Test::Key_3;
case GLFW_KEY_4: return Test::Key_4;
case GLFW_KEY_5: return Test::Key_5;
case GLFW_KEY_6: return Test::Key_6;
case GLFW_KEY_7: return Test::Key_7;
case GLFW_KEY_8: return Test::Key_8;
case GLFW_KEY_9: return Test::Key_9;
case GLFW_KEY_A: return Test::Key_A;
case GLFW_KEY_B: return Test::Key_B;
case GLFW_KEY_C: return Test::Key_C;
case GLFW_KEY_D: return Test::Key_D;
case GLFW_KEY_E: return Test::Key_E;
case GLFW_KEY_F: return Test::Key_F;
case GLFW_KEY_G: return Test::Key_G;
case GLFW_KEY_H: return Test::Key_H;
case GLFW_KEY_I: return Test::Key_I;
case GLFW_KEY_J: return Test::Key_J;
case GLFW_KEY_K: return Test::Key_K;
case GLFW_KEY_L: return Test::Key_L;
case GLFW_KEY_M: return Test::Key_M;
case GLFW_KEY_N: return Test::Key_N;
case GLFW_KEY_O: return Test::Key_O;
case GLFW_KEY_P: return Test::Key_P;
case GLFW_KEY_Q: return Test::Key_Q;
case GLFW_KEY_R: return Test::Key_R;
case GLFW_KEY_S: return Test::Key_S;
case GLFW_KEY_T: return Test::Key_T;
case GLFW_KEY_U: return Test::Key_U;
case GLFW_KEY_V: return Test::Key_V;
case GLFW_KEY_W: return Test::Key_W;
case GLFW_KEY_X: return Test::Key_X;
case GLFW_KEY_Y: return Test::Key_Y;
case GLFW_KEY_Z: return Test::Key_Z;
case GLFW_KEY_BACKSPACE: return Test::Key_Backspace;
case GLFW_KEY_KP_SUBTRACT: return Test::Key_Subtract;
case GLFW_KEY_KP_ADD: return Test::Key_Add;
}
return Test::Key_Unknown;
}
static void KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
NOT_USED(scancode);
if (action == GLFW_PRESS)
{
switch (key)
{
case GLFW_KEY_ESCAPE:
// Quit
glfwSetWindowShouldClose(window, GL_TRUE);
break;
case GLFW_KEY_LEFT:
// Pan left
if (mods == GLFW_MOD_CONTROL)
{
g_testSuite->GetTest()->ShiftOrigin(Length2D(2.0f * Meter, 0.0f * Meter));
}
else
{
camera.m_center.x -= 0.5f;
}
break;
case GLFW_KEY_RIGHT:
// Pan right
if (mods == GLFW_MOD_CONTROL)
{
g_testSuite->GetTest()->ShiftOrigin(Length2D(-2.0f * Meter, 0.0f * Meter));
}
else
{
camera.m_center.x += 0.5f;
}
break;
case GLFW_KEY_DOWN:
// Pan down
if (mods == GLFW_MOD_CONTROL)
{
g_testSuite->GetTest()->ShiftOrigin(Length2D(0.0f * Meter, 2.0f * Meter));
}
else
{
camera.m_center.y -= 0.5f;
}
break;
case GLFW_KEY_UP:
// Pan up
if (mods == GLFW_MOD_CONTROL)
{
g_testSuite->GetTest()->ShiftOrigin(Length2D(0.0f * Meter, -2.0f * Meter));
}
else
{
camera.m_center.y += 0.5f;
}
break;
case GLFW_KEY_HOME:
// Reset view
camera.m_zoom = 1.0f;
camera.m_center = Coord2D{0.0f, 20.0f};
break;
case GLFW_KEY_Z:
// Zoom out
camera.m_zoom = Min(1.1f * camera.m_zoom, 20.0f);
break;
case GLFW_KEY_X:
// Zoom in
camera.m_zoom = Max(0.9f * camera.m_zoom, 0.02f);
break;
case GLFW_KEY_R:
// Reset test
g_testSuite->RestartTest();
break;
case GLFW_KEY_SPACE:
// Launch a bomb.
if (g_testSuite->GetTest())
{
g_testSuite->GetTest()->LaunchBomb();
}
break;
case GLFW_KEY_P:
// Pause
settings.pause = !settings.pause;
break;
case GLFW_KEY_LEFT_BRACKET:
// Switch to previous test
g_selection->Decrement();
break;
case GLFW_KEY_RIGHT_BRACKET:
// Switch to next test
g_selection->Increment();
break;
case GLFW_KEY_TAB:
ui.showMenu = !ui.showMenu;
default:
if (g_testSuite->GetTest())
{
g_testSuite->GetTest()->KeyboardDown(GlfwKeyToTestKey(key));
}
}
}
else if (action == GLFW_RELEASE)
{
g_testSuite->GetTest()->KeyboardUp(GlfwKeyToTestKey(key));
}
// else GLFW_REPEAT
}
static void MouseButton(GLFWwindow*, const int button, const int action, const int mods)
{
const auto forMenu = (mouseScreen.x >= menuX);
switch (button)
{
case GLFW_MOUSE_BUTTON_LEFT:
{
switch (action)
{
case GLFW_PRESS:
leftMouseDown = true;
if (!forMenu)
{
if (mods == GLFW_MOD_SHIFT)
{
g_testSuite->GetTest()->ShiftMouseDown(mouseWorld);
}
else
{
g_testSuite->GetTest()->MouseDown(mouseWorld);
}
}
break;
case GLFW_RELEASE:
leftMouseDown = false;
if (!forMenu)
{
g_testSuite->GetTest()->MouseUp(mouseWorld);
}
break;
default:
break;
}
break;
}
case GLFW_MOUSE_BUTTON_RIGHT:
{
switch (action)
{
case GLFW_PRESS:
lastp = mouseWorld;
rightMouseDown = true;
break;
case GLFW_RELEASE:
rightMouseDown = false;
break;
default:
break;
}
}
default:
break;
}
}
static void MouseMotion(GLFWwindow*, double xd, double yd)
{
// Expects that xd and yd are the new mouse position coordinates,
// in screen coordinates, relative to the upper-left corner of the
// client area of the window.
mouseScreen = Coord2D{static_cast<float>(xd), static_cast<float>(yd)};
mouseWorld = ConvertScreenToWorld(camera, mouseScreen);
g_testSuite->GetTest()->MouseMove(mouseWorld);
if (rightMouseDown)
{
const auto movement = mouseWorld - lastp;
camera.m_center.x -= static_cast<float>(Real{movement.x / Meter});
camera.m_center.y -= static_cast<float>(Real{movement.y / Meter});
lastp = ConvertScreenToWorld(camera, mouseScreen);
}
}
static void ScrollCallback(GLFWwindow*, double, double dy)
{
if (ui.mouseOverMenu)
{
ui.scroll = -int(dy);
}
else
{
if (dy > 0)
{
camera.m_zoom /= 1.1f;
}
else
{
camera.m_zoom *= 1.1f;
}
}
}
static void Simulate(Drawer& drawer)
{
glEnable(GL_DEPTH_TEST);
settings.dt = (settings.hz != 0)? 1 / settings.hz : 0;
if (settings.pause)
{
if (!settings.singleStep)
{
settings.dt = 0.0f;
}
}
g_testSuite->GetTest()->DrawTitle(drawer, g_testSuite->GetName());
g_testSuite->GetTest()->Step(settings, drawer);
glDisable(GL_DEPTH_TEST);
if (settings.pause)
{
if (settings.singleStep)
{
settings.singleStep = false;
}
}
if (g_testSuite->GetIndex() != g_selection->Get())
{
g_testSuite->SetIndex(g_selection->Get());
camera.m_zoom = 1.0f;
camera.m_center = Coord2D{0.0f, 20.0f};
}
}
static bool UserInterface(int mousex, int mousey, unsigned char mousebutton, int mscroll)
{
auto shouldQuit = false;
imguiBeginFrame(mousex, mousey, mousebutton, mscroll);
ui.mouseOverMenu = false;
if (ui.showMenu)
{
const auto over = imguiBeginScrollArea("Testbed Controls",
menuX, menuY, menuWidth, menuHeight,
&ui.scrollarea1);
if (over) ui.mouseOverMenu = true;
imguiLabel("Test:");
if (imguiButton(g_testSuite->GetName(), true))
{
ui.chooseTest = !ui.chooseTest;
}
imguiSeparatorLine();
const auto defaultLinearSlop = StripUnit(DefaultLinearSlop);
imguiSlider("Reg Vel Iters", &settings.regVelocityIterations, 0, 100, 1, true);
imguiSlider("Reg Pos Iters", &settings.regPositionIterations, 0, 100, 1, true);
imguiSlider("TOI Vel Iters", &settings.toiVelocityIterations, 0, 100, 1, true);
imguiSlider("TOI Pos Iters", &settings.toiPositionIterations, 0, 100, 1, true);
imguiSlider("Max Sub Steps", &settings.maxSubSteps, 0, 100, 1, true);
imguiSlider("Hertz", &settings.hz, -120.0f, 120.0f, 5.0f, true);
imguiSlider("Linear Slop", &settings.linearSlop,
static_cast<float>(defaultLinearSlop / 10),
static_cast<float>(defaultLinearSlop),
static_cast<float>(defaultLinearSlop / 100),
true);
imguiSlider("Angular Slop", &settings.angularSlop,
static_cast<float>(Pi * 2 / 1800.0),
static_cast<float>(Pi * 2 / 18.0), 0.001f,
true);
imguiSlider("Reg Min Sep", &settings.regMinSeparation,
-5 * static_cast<float>(defaultLinearSlop),
-0 * static_cast<float>(defaultLinearSlop),
static_cast<float>(defaultLinearSlop) / 20,
true);
imguiSlider("TOI Min Sep", &settings.toiMinSeparation,
-5 * static_cast<float>(defaultLinearSlop),
-0 * static_cast<float>(defaultLinearSlop),
static_cast<float>(defaultLinearSlop) / 20,
true);
imguiSlider("Max Translation", &settings.maxTranslation, 0.0f, 12.0f, 0.05f, true);
imguiSlider("Max Rotation", &settings.maxRotation, 0.0f, 360.0f, 1.0f, true);
imguiSlider("Max Lin Correct", &settings.maxLinearCorrection, 0.0f, 1.0f, 0.01f, true);
imguiSlider("Max Ang Correct", &settings.maxAngularCorrection, 0.0f, 90.0f, 1.0f, true);
imguiSlider("Reg Resol % Rate", &settings.regPosResRate, 0, 100, 1, true);
imguiSlider("TOI Resol % Rate", &settings.toiPosResRate, 0, 100, 1, true);
if (imguiCheck("Sleep", settings.enableSleep, true))
settings.enableSleep = !settings.enableSleep;
if (imguiCheck("Warm Starting", settings.enableWarmStarting, true))
settings.enableWarmStarting = !settings.enableWarmStarting;
if (imguiCheck("Time of Impact", settings.enableContinuous, true))
settings.enableContinuous = !settings.enableContinuous;
if (imguiCheck("Sub-Stepping", settings.enableSubStepping, true))
settings.enableSubStepping = !settings.enableSubStepping;
imguiSeparatorLine();
if (imguiCheck("Shapes", settings.drawShapes, true))
settings.drawShapes = !settings.drawShapes;
if (imguiCheck("Joints", settings.drawJoints, true))
settings.drawJoints = !settings.drawJoints;
if (imguiCheck("Skins", settings.drawSkins, true))
settings.drawSkins = !settings.drawSkins;
if (imguiCheck("AABBs", settings.drawAABBs, true))
settings.drawAABBs = !settings.drawAABBs;
if (imguiCheck("Contact Points", settings.drawContactPoints, true))
settings.drawContactPoints = !settings.drawContactPoints;
if (imguiCheck("Contact Normals", settings.drawContactNormals, true))
settings.drawContactNormals = !settings.drawContactNormals;
if (imguiCheck("Contact Impulses", settings.drawContactImpulse, true))
settings.drawContactImpulse = !settings.drawContactImpulse;
if (imguiCheck("Friction Impulses", settings.drawFrictionImpulse, true))
settings.drawFrictionImpulse = !settings.drawFrictionImpulse;
if (imguiCheck("Center of Masses", settings.drawCOMs, true))
settings.drawCOMs = !settings.drawCOMs;
if (imguiCheck("Statistics", settings.drawStats, true))
settings.drawStats = !settings.drawStats;
if (imguiCheck("Pause", settings.pause, true))
settings.pause = !settings.pause;
if (imguiButton("Single Step", true))
settings.singleStep = !settings.singleStep;
if (imguiButton("Restart", true))
g_testSuite->RestartTest();
if (imguiButton("Quit", true))
shouldQuit = true;
imguiEndScrollArea();
}
const auto testMenuWidth = 200;
if (ui.chooseTest)
{
static int testScroll = 0;
const auto over = imguiBeginScrollArea("Choose Sample",
camera.m_width - menuWidth - testMenuWidth - 20, 10,
testMenuWidth, camera.m_height - 20,
&testScroll);
if (over) ui.mouseOverMenu = true;
const auto testCount = g_testSuite->GetTestCount();
for (auto i = decltype(testCount){0}; i < testCount; ++i)
{
if (imguiItem(g_testSuite->GetName(i), true))
{
g_selection->Set(i);
g_testSuite->SetIndex(i);
ui.chooseTest = false;
}
}
imguiEndScrollArea();
}
imguiEndFrame();
return !shouldQuit;
}
static void GlfwErrorCallback(int code, const char* str)
{
fprintf(stderr, "GLFW error (%d): %s\n", code, str);
}
static void ShowFrameInfo(double frameTime, double fps)
{
std::stringstream stream;
const auto viewport = ConvertScreenToWorld(camera);
stream << "Zoom=" << camera.m_zoom;
stream << " Center=";
stream << "{" << camera.m_center.x << "," << camera.m_center.y << "}";
stream << " Viewport=";
stream << "{";
stream << viewport.GetLowerBound().x << "..." << viewport.GetUpperBound().x;
stream << ", ";
stream << viewport.GetLowerBound().y << "..." << viewport.GetUpperBound().y;
stream << "}";
stream << std::setprecision(1);
stream << std::fixed;
stream << " Refresh=" << (1000.0 * frameTime) << "ms";
stream << std::setprecision(0);
stream << " FPS=" << fps;
AddGfxCmdText(5, 5, TEXT_ALIGN_LEFT, stream.str().c_str(), static_cast<unsigned int>(WHITE));
}
int main()
{
TestSuite testSuite(GetTestEntries());
Selection selection(testSuite.GetTestCount());
g_testSuite = &testSuite;
g_selection = &selection;
#if defined(_WIN32)
// Enable memory-leak reports
_CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG));
#endif
camera.m_width = 1280; // 1152;
camera.m_height = 960; // 864;
menuX = camera.m_width - menuWidth - 10;
menuHeight = camera.m_height - 20;
if (glfwSetErrorCallback(GlfwErrorCallback))
{
fprintf(stderr, "Warning: overriding previously installed GLFW error callback function.\n");
}
if (glfwInit() == 0)
{
fprintf(stderr, "Failed to initialize GLFW\n");
return -1;
}
const auto buildVersion = GetVersion();
const auto buildDetails = GetBuildDetails();
char title[64];
sprintf(title, "Box2D Testbed Version %d.%d.%d",
buildVersion.major, buildVersion.minor, buildVersion.revision);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
const auto mainWindow = glfwCreateWindow(camera.m_width, camera.m_height, title,
nullptr, nullptr);
if (mainWindow == nullptr)
{
fprintf(stderr, "Failed to open GLFW main window.\n");
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(mainWindow);
printf("Box2D %d.%d.%d (%s), OpenGL %s, GLSL %s\n",
buildVersion.major, buildVersion.minor, buildVersion.revision, buildDetails.c_str(),
glGetString(GL_VERSION), glGetString(GL_SHADING_LANGUAGE_VERSION));
glfwSetScrollCallback(mainWindow, ScrollCallback);
glfwSetWindowSizeCallback(mainWindow, ResizeWindow);
glfwSetKeyCallback(mainWindow, KeyCallback);
glfwSetMouseButtonCallback(mainWindow, MouseButton);
glfwSetCursorPosCallback(mainWindow, MouseMotion);
glfwSetScrollCallback(mainWindow, ScrollCallback);
#if !defined(__APPLE__)
//glewExperimental = GL_TRUE;
GLenum err = glewInit();
if (GLEW_OK != err)
{
fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
exit(EXIT_FAILURE);
}
#endif
CreateUI();
// Control the frame rate. One draw per monitor refresh.
glfwSwapInterval(1);
auto time1 = glfwGetTime();
auto frameTime = 0.0;
auto fps = 0.0;
glClearColor(0.3f, 0.3f, 0.3f, 1.f);
{
DebugDraw drawer(camera);
while (!glfwWindowShouldClose(mainWindow))
{
glViewport(0, 0, camera.m_width, camera.m_height);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
const auto mscroll = ui.scroll;
ui.scroll = 0;
const auto mousex = int(mouseScreen.x);
const auto mousey = camera.m_height - int(mouseScreen.y);
unsigned char mousebutton = (leftMouseDown)? IMGUI_MBUT_LEFT: 0;
if (!UserInterface(mousex, mousey, mousebutton, mscroll))
glfwSetWindowShouldClose(mainWindow, GL_TRUE);
Simulate(drawer);
// Measure speed
const auto time2 = glfwGetTime();
const auto timeElapsed = time2 - time1;
const auto alpha = 0.9;
frameTime = alpha * frameTime + (1.0 - alpha) * timeElapsed;
fps = 0.99 * fps + (1.0 - 0.99) / timeElapsed;
time1 = time2;
ShowFrameInfo(frameTime, fps);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_DEPTH_TEST);
RenderGLFlush(camera.m_width, camera.m_height);
glfwSwapBuffers(mainWindow);
glfwPollEvents();
}
}
RenderGLDestroy();
glfwTerminate();
return 0;
}
| 31.100354
| 101
| 0.558879
|
louis-langholtz
|
69a86172d7133a45894a91551431a5804b3d5263
| 17,851
|
cpp
|
C++
|
src/predefined/FaceDetector.cpp
|
djinn-technologies/depthai-unity
|
4064a0f3ea374e30203ee9a0a2c42f1e59791519
|
[
"MIT"
] | null | null | null |
src/predefined/FaceDetector.cpp
|
djinn-technologies/depthai-unity
|
4064a0f3ea374e30203ee9a0a2c42f1e59791519
|
[
"MIT"
] | null | null | null |
src/predefined/FaceDetector.cpp
|
djinn-technologies/depthai-unity
|
4064a0f3ea374e30203ee9a0a2c42f1e59791519
|
[
"MIT"
] | null | null | null |
/**
* This file contains face detector pipeline and interface for Unity scene called "Face Detector"
* Main goal is to perform face detection + depth
*/
#pragma GCC diagnostic ignored "-Wreturn-type-c-linkage"
#pragma GCC diagnostic ignored "-Wdouble-promotion"
#if _MSC_VER // this is defined when compiling with Visual Studio
#define EXPORT_API __declspec(dllexport) // Visual Studio needs annotating exported functions with this
#else
#define EXPORT_API // XCode does not need annotating exported functions, so define is empty
#endif
// ------------------------------------------------------------------------
// Plugin itself
#include <iostream>
#include <cstdio>
#include <random>
#include "../utility.hpp"
// Common necessary includes for development using depthai library
#include "depthai/depthai.hpp"
#include "depthai/device/Device.hpp"
#include "depthai-unity/predefined/FaceDetector.hpp"
#include "spdlog/sinks/stdout_color_sinks.h"
#include "spdlog/spdlog.h"
#include "nlohmann/json.hpp"
/**
* Pipeline creation based on streams template
*
* @param config pipeline configuration
* @returns pipeline
*/
dai::Pipeline createFaceDetectorPipeline(PipelineConfig *config)
{
dai::Pipeline pipeline;
std::shared_ptr<dai::node::XLinkOut> xlinkOut;
auto colorCam = pipeline.create<dai::node::ColorCamera>();
// Color camera preview
if (config->previewSizeWidth > 0 && config->previewSizeHeight > 0)
{
xlinkOut = pipeline.create<dai::node::XLinkOut>();
xlinkOut->setStreamName("preview");
colorCam->setPreviewSize(config->previewSizeWidth, config->previewSizeHeight);
colorCam->preview.link(xlinkOut->input);
}
// Color camera properties
colorCam->setResolution(dai::ColorCameraProperties::SensorResolution::THE_1080_P);
if (config->colorCameraResolution == 1) colorCam->setResolution(dai::ColorCameraProperties::SensorResolution::THE_4_K);
if (config->colorCameraResolution == 2) colorCam->setResolution(dai::ColorCameraProperties::SensorResolution::THE_12_MP);
if (config->colorCameraResolution == 3) colorCam->setResolution(dai::ColorCameraProperties::SensorResolution::THE_13_MP);
colorCam->setInterleaved(config->colorCameraInterleaved);
colorCam->setColorOrder(dai::ColorCameraProperties::ColorOrder::BGR);
if (config->colorCameraColorOrder == 1) colorCam->setColorOrder(dai::ColorCameraProperties::ColorOrder::RGB);
colorCam->setFps(config->colorCameraFPS);
// neural network
auto nn1 = pipeline.create<dai::node::NeuralNetwork>();
nn1->setBlobPath(config->nnPath1);
colorCam->preview.link(nn1->input);
// output of neural network
auto nnOut = pipeline.create<dai::node::XLinkOut>();
nnOut->setStreamName("detections");
nn1->out.link(nnOut->input);
// Depth
if (config->confidenceThreshold > 0)
{
auto left = pipeline.create<dai::node::MonoCamera>();
auto right = pipeline.create<dai::node::MonoCamera>();
auto stereo = pipeline.create<dai::node::StereoDepth>();
// For RGB-Depth align
if (config->ispScaleF1 > 0 && config->ispScaleF2 > 0) colorCam->setIspScale(config->ispScaleF1, config->ispScaleF2);
if (config->manualFocus > 0) colorCam->initialControl.setManualFocus(config->manualFocus);
// Mono camera properties
left->setResolution(dai::MonoCameraProperties::SensorResolution::THE_400_P);
if (config->monoLCameraResolution == 1) left->setResolution(dai::MonoCameraProperties::SensorResolution::THE_720_P);
if (config->monoLCameraResolution == 2) left->setResolution(dai::MonoCameraProperties::SensorResolution::THE_800_P);
if (config->monoLCameraResolution == 3) left->setResolution(dai::MonoCameraProperties::SensorResolution::THE_480_P);
left->setBoardSocket(dai::CameraBoardSocket::LEFT);
right->setResolution(dai::MonoCameraProperties::SensorResolution::THE_400_P);
if (config->monoRCameraResolution == 1) right->setResolution(dai::MonoCameraProperties::SensorResolution::THE_720_P);
if (config->monoRCameraResolution == 2) right->setResolution(dai::MonoCameraProperties::SensorResolution::THE_800_P);
if (config->monoRCameraResolution == 3) right->setResolution(dai::MonoCameraProperties::SensorResolution::THE_480_P);
right->setBoardSocket(dai::CameraBoardSocket::RIGHT);
// Stereo properties
stereo->setConfidenceThreshold(config->confidenceThreshold);
// LR-check is required for depth alignment
stereo->setLeftRightCheck(config->leftRightCheck);
if (config->depthAlign > 0) stereo->setDepthAlign(dai::CameraBoardSocket::RGB);
stereo->setSubpixel(config->subpixel);
stereo->initialConfig.setMedianFilter(dai::MedianFilter::MEDIAN_OFF);
if (config->medianFilter == 1) stereo->initialConfig.setMedianFilter(dai::MedianFilter::KERNEL_3x3);
if (config->medianFilter == 2) stereo->initialConfig.setMedianFilter(dai::MedianFilter::KERNEL_5x5);
if (config->medianFilter == 3) stereo->initialConfig.setMedianFilter(dai::MedianFilter::KERNEL_7x7);
// Linking
left->out.link(stereo->left);
right->out.link(stereo->right);
auto xoutDepth = pipeline.create<dai::node::XLinkOut>();
xoutDepth->setStreamName("depth");
stereo->depth.link(xoutDepth->input);
}
// SYSTEM INFORMATION
if (config->rate > 0.0f)
{
// Define source and output
auto sysLog = pipeline.create<dai::node::SystemLogger>();
auto xout = pipeline.create<dai::node::XLinkOut>();
xout->setStreamName("sysinfo");
// Properties
sysLog->setRate(config->rate); // 1 hz updates
// Linking
sysLog->out.link(xout->input);
}
// IMU
if (config->freq > 0)
{
auto imu = pipeline.create<dai::node::IMU>();
auto xlinkOutImu = pipeline.create<dai::node::XLinkOut>();
xlinkOutImu->setStreamName("imu");
// enable ROTATION_VECTOR at 400 hz rate
imu->enableIMUSensor(dai::IMUSensor::ROTATION_VECTOR, config->freq);
// above this threshold packets will be sent in batch of X, if the host is not blocked and USB bandwidth is available
imu->setBatchReportThreshold(config->batchReportThreshold);
// maximum number of IMU packets in a batch, if it's reached device will block sending until host can receive it
// if lower or equal to batchReportThreshold then the sending is always blocking on device
// useful to reduce device's CPU load and number of lost packets, if CPU load is high on device side due to multiple nodes
imu->setMaxBatchReports(config->maxBatchReports);
// Link plugins IMU -> XLINK
imu->out.link(xlinkOutImu->input);
}
return pipeline;
}
extern "C"
{
/**
* Pipeline creation based on streams template
*
* @param config pipeline configuration
* @returns pipeline
*/
EXPORT_API bool InitFaceDetector(PipelineConfig *config)
{
dai::Pipeline pipeline = createFaceDetectorPipeline(config);
// If deviceId is empty .. just pick first available device
bool res = false;
if (strcmp(config->deviceId,"NONE")==0 || strcmp(config->deviceId,"")==0) res = DAIStartPipeline(pipeline,config->deviceNum,NULL);
else res = DAIStartPipeline(pipeline,config->deviceNum,config->deviceId);
return res;
}
/**
* Pipeline results
*
* @param frameInfo camera images pointers
* @param getPreview True if color preview image is requested, False otherwise. Requires previewSize in pipeline creation.
* @param useDepth True if depth information is requested, False otherwise. Requires confidenceThreshold in pipeline creation.
* @param retrieveInformation True if system information is requested, False otherwise. Requires rate in pipeline creation.
* @param useIMU True if IMU information is requested, False otherwise. Requires freq in pipeline creation.
* @param deviceNum Device selection on unity dropdown
* @returns Json with results or information about device availability.
*/
/**
* Example of json returned
* { "faces": [ {"label":0,"score":0.0,"xmin":0.0,"ymin":0.0,"xmax":0.0,"ymax":0.0,"xcenter":0.0,"ycenter":0.0},{"label":1,"score":1.0,"xmin":0.0,"ymin":0.0,"xmax":0.0,* "ymax":0.0,"xcenter":0.0,"ycenter":0.0}],"best":{"label":1,"score":1.0,"xmin":0.0,"ymin":0.0,"xmax":0.0,"ymax":0.0,"xcenter":0.0,"ycenter":0.0},"fps":0.0}
*/
EXPORT_API const char* FaceDetectorResults(FrameInfo *frameInfo, bool getPreview, bool drawBestFaceInPreview, bool drawAllFacesInPreview, float faceScoreThreshold, bool useDepth, bool retrieveInformation, bool useIMU, int deviceNum)
{
using namespace std;
using namespace std::chrono;
// Get device deviceNum
std::shared_ptr<dai::Device> device = GetDevice(deviceNum);
// Device no available
if (device == NULL)
{
char* ret = (char*)::malloc(strlen("{\"error\":\"NO_DEVICE\"}"));
::memcpy(ret, "{\"error\":\"NO_DEVICE\"}",strlen("{\"error\":\"NO_DEVICE\"}"));
ret[strlen("{\"error\":\"NO_DEVICE\"}")] = 0;
return ret;
}
// If device deviceNum is running pipeline
if (IsDeviceRunning(deviceNum))
{
// preview image
cv::Mat frame;
std::shared_ptr<dai::ImgFrame> imgFrame;
// other images
cv::Mat depthFrame, depthFrameOrig, dispFrameOrig, dispFrame, monoRFrameOrig, monoRFrame, monoLFrameOrig, monoLFrame;
// face info
nlohmann::json faceDetectorJson = {};
std::shared_ptr<dai::DataOutputQueue> preview;
std::shared_ptr<dai::DataOutputQueue> depthQueue;
// face detector results
auto detections = device->getOutputQueue("detections",1,false);
// if preview image is requested. True in this case.
if (getPreview) preview = device->getOutputQueue("preview",1,false);
// if depth images are requested. All images.
if (useDepth) depthQueue = device->getOutputQueue("depth", 1, false);
int countd;
if (getPreview)
{
auto imgFrames = preview->tryGetAll<dai::ImgFrame>();
countd = imgFrames.size();
if (countd > 0) {
auto imgFrame = imgFrames[countd-1];
if(imgFrame){
frame = toMat(imgFrame->getData(), imgFrame->getWidth(), imgFrame->getHeight(), 3, 1);
}
}
}
vector<std::shared_ptr<dai::ImgFrame>> imgDepthFrames,imgDispFrames,imgMonoRFrames,imgMonoLFrames;
std::shared_ptr<dai::ImgFrame> imgDepthFrame,imgDispFrame,imgMonoRFrame,imgMonoLFrame;
int count;
// In this case we allocate before Texture2D (ARGB32) and memcpy pointer data
if (useDepth)
{
// Depth
imgDepthFrames = depthQueue->tryGetAll<dai::ImgFrame>();
count = imgDepthFrames.size();
if (count > 0)
{
imgDepthFrame = imgDepthFrames[count-1];
depthFrameOrig = imgDepthFrame->getFrame();
cv::normalize(depthFrameOrig, depthFrame, 255, 0, cv::NORM_INF, CV_8UC1);
cv::equalizeHist(depthFrame, depthFrame);
cv::cvtColor(depthFrame, depthFrame, cv::COLOR_GRAY2BGR);
}
}
// Face detection results
struct Detection {
unsigned int label;
float score;
float x_min;
float y_min;
float x_max;
float y_max;
};
vector<Detection> dets;
auto det = detections->get<dai::NNData>();
std::vector<float> detData = det->getFirstLayerFp16();
float maxScore = 0.0;
int maxPos = 0;
nlohmann::json facesArr = {};
nlohmann::json bestFace = {};
if(detData.size() > 0){
int i = 0;
while (detData[i*7] != -1.0f && i*7 < (int)detData.size()) {
Detection d;
d.label = detData[i*7 + 1];
d.score = detData[i*7 + 2];
if (d.score > maxScore)
{
maxScore = d.score;
maxPos = i;
}
d.x_min = detData[i*7 + 3];
d.y_min = detData[i*7 + 4];
d.x_max = detData[i*7 + 5];
d.y_max = detData[i*7 + 6];
i++;
dets.push_back(d);
nlohmann::json face;
face["label"] = d.label;
face["score"] = d.score;
face["xmin"] = d.x_min;
face["ymin"] = d.y_min;
face["xmax"] = d.x_max;
face["ymax"] = d.y_max;
int x1 = d.x_min * frame.cols;
int y1 = d.y_min * frame.rows;
int x2 = d.x_max * frame.cols;
int y2 = d.y_max * frame.rows;
int mx = x1 + ((x2 - x1) / 2);
int my = y1 + ((y2 - y1) / 2);
face["xcenter"] = mx;
face["ycenter"] = my;
if (faceScoreThreshold <= d.score)
{
if (getPreview && countd > 0 && drawAllFacesInPreview) cv::rectangle(frame, cv::Rect(cv::Point(x1, y1), cv::Point(x2, y2)), cv::Scalar(255,255,255));
if (useDepth && count>0)
{
auto spatialData = computeDepth(mx,my,frame.rows,depthFrameOrig);
for(auto depthData : spatialData) {
auto roi = depthData.config.roi;
roi = roi.denormalize(depthFrame.cols, depthFrame.rows);
face["X"] = (int)depthData.spatialCoordinates.x;
face["Y"] = (int)depthData.spatialCoordinates.y;
face["Z"] = (int)depthData.spatialCoordinates.z;
}
}
facesArr.push_back(face);
}
}
}
int i = 0;
for(const auto& d : dets){
if (i == maxPos)
{
int x1 = d.x_min * frame.cols;
int y1 = d.y_min * frame.rows;
int x2 = d.x_max * frame.cols;
int y2 = d.y_max * frame.rows;
int mx = x1 + ((x2 - x1) / 2);
int my = y1 + ((y2 - y1) / 2);
// m_mx = mx;
// m_my = my;
if (faceScoreThreshold <= d.score)
{
bestFace["label"] = d.label;
bestFace["score"] = d.score;
bestFace["xmin"] = d.x_min;
bestFace["ymin"] = d.y_min;
bestFace["xmax"] = d.x_max;
bestFace["ymax"] = d.y_max;
bestFace["xcenter"] = mx;
bestFace["ycenter"] = my;
if (useDepth && count>0)
{
auto spatialData = computeDepth(mx,my,frame.rows,depthFrameOrig);
for(auto depthData : spatialData) {
auto roi = depthData.config.roi;
roi = roi.denormalize(depthFrame.cols, depthFrame.rows);
bestFace["X"] = (int)depthData.spatialCoordinates.x;
bestFace["Y"] = (int)depthData.spatialCoordinates.y;
bestFace["Z"] = (int)depthData.spatialCoordinates.z;
}
}
if (getPreview && countd > 0 && drawBestFaceInPreview) cv::rectangle(frame, cv::Rect(cv::Point(x1, y1), cv::Point(x2, y2)), cv::Scalar(255,255,255));
}
}
i++;
}
if (getPreview && countd>0) toARGB(frame,frameInfo->colorPreviewData);
faceDetectorJson["faces"] = facesArr;
faceDetectorJson["best"] = bestFace;
// SYSTEM INFORMATION
if (retrieveInformation) faceDetectorJson["sysinfo"] = GetDeviceInfo(device);
// IMU
if (useIMU) faceDetectorJson["imu"] = GetIMU(device);
char* ret = (char*)::malloc(strlen(faceDetectorJson.dump().c_str())+1);
::memcpy(ret, faceDetectorJson.dump().c_str(),strlen(faceDetectorJson.dump().c_str()));
ret[strlen(faceDetectorJson.dump().c_str())] = 0;
return ret;
}
char* ret = (char*)::malloc(strlen("{\"error\":\"DEVICE_NOT_RUNNING\"}"));
::memcpy(ret, "{\"error\":\"DEVICE_NOT_RUNNING\"}",strlen("{\"error\":\"DEVICE_NOT_RUNNING\"}"));
ret[strlen("{\"error\":\"DEVICE_NOT_RUNNING\"}")] = 0;
return ret;
}
}
| 42.808153
| 327
| 0.563554
|
djinn-technologies
|
69a9b34733d8e2c7b1fb7c8680cde5cc71073bb5
| 37,002
|
cpp
|
C++
|
packages/monte_carlo/active_region/core/test/tstIndependentPhaseSpaceDimensionDistribution.cpp
|
bam241/FRENSIE
|
e1760cd792928699c84f2bdce70ff54228e88094
|
[
"BSD-3-Clause"
] | 10
|
2019-11-14T19:58:30.000Z
|
2021-04-04T17:44:09.000Z
|
packages/monte_carlo/active_region/core/test/tstIndependentPhaseSpaceDimensionDistribution.cpp
|
bam241/FRENSIE
|
e1760cd792928699c84f2bdce70ff54228e88094
|
[
"BSD-3-Clause"
] | 43
|
2020-03-03T19:59:20.000Z
|
2021-09-08T03:36:08.000Z
|
packages/monte_carlo/active_region/core/test/tstIndependentPhaseSpaceDimensionDistribution.cpp
|
bam241/FRENSIE
|
e1760cd792928699c84f2bdce70ff54228e88094
|
[
"BSD-3-Clause"
] | 6
|
2020-02-12T17:37:07.000Z
|
2020-09-08T18:59:51.000Z
|
//---------------------------------------------------------------------------//
//!
//! \file tstIndependentPhaseSpaceDimensionDistribution.cpp
//! \author Alex Robinson
//! \brief Independent phase space dimension distribution unit tests
//!
//---------------------------------------------------------------------------//
// Std Lib Includes
#include <iostream>
#include <memory>
// FRENSIE Includes
#include "MonteCarlo_IndependentPhaseSpaceDimensionDistribution.hpp"
#include "MonteCarlo_PhaseSpaceDimensionTraits.hpp"
#include "Utility_BasicCartesianCoordinateConversionPolicy.hpp"
#include "Utility_UniformDistribution.hpp"
#include "Utility_DeltaDistribution.hpp"
#include "Utility_DiscreteDistribution.hpp"
#include "Utility_ExponentialDistribution.hpp"
#include "Utility_RandomNumberGenerator.hpp"
#include "Utility_UnitTestHarnessWithMain.hpp"
#include "ArchiveTestHelpers.hpp"
//---------------------------------------------------------------------------//
// Testing Types
//---------------------------------------------------------------------------//
using namespace MonteCarlo;
typedef std::tuple<std::integral_constant<PhaseSpaceDimension,PRIMARY_SPATIAL_DIMENSION>,
std::integral_constant<PhaseSpaceDimension,SECONDARY_SPATIAL_DIMENSION>,
std::integral_constant<PhaseSpaceDimension,TERTIARY_SPATIAL_DIMENSION>,
std::integral_constant<PhaseSpaceDimension,PRIMARY_DIRECTIONAL_DIMENSION>,
std::integral_constant<PhaseSpaceDimension,SECONDARY_DIRECTIONAL_DIMENSION>,
std::integral_constant<PhaseSpaceDimension,TERTIARY_DIRECTIONAL_DIMENSION>,
std::integral_constant<PhaseSpaceDimension,ENERGY_DIMENSION>,
std::integral_constant<PhaseSpaceDimension,TIME_DIMENSION>
> TestPhaseSpaceDimensionsNoWeight;
typedef decltype(std::tuple_cat(TestPhaseSpaceDimensionsNoWeight(),std::make_tuple(std::integral_constant<PhaseSpaceDimension,WEIGHT_DIMENSION>()))) TestPhaseSpaceDimensions;
typedef TestArchiveHelper::TestArchives TestArchives;
//---------------------------------------------------------------------------//
// Testing Variables.
//---------------------------------------------------------------------------//
std::shared_ptr<const Utility::SpatialCoordinateConversionPolicy>
spatial_coord_conversion_policy( new Utility::BasicCartesianCoordinateConversionPolicy );
std::shared_ptr<const Utility::DirectionalCoordinateConversionPolicy>
directional_coord_conversion_policy( new Utility::BasicCartesianCoordinateConversionPolicy );
//---------------------------------------------------------------------------//
// Tests.
//---------------------------------------------------------------------------//
// Test that the dimension can be returned
FRENSIE_UNIT_TEST_TEMPLATE( IndependentPhaseSpaceDimensionDistribution,
getDimension,
TestPhaseSpaceDimensions )
{
FETCH_TEMPLATE_PARAM( 0, WrappedDimension );
constexpr PhaseSpaceDimension Dimension = WrappedDimension::value;
std::shared_ptr<const Utility::UnivariateDistribution> basic_distribution(
new Utility::UniformDistribution( 0.5, 1.5, 0.5 ) );
std::shared_ptr<const MonteCarlo::PhaseSpaceDimensionDistribution>
dimension_distribution( new MonteCarlo::IndependentPhaseSpaceDimensionDistribution<Dimension>( basic_distribution ) );
FRENSIE_CHECK_EQUAL( dimension_distribution->getDimension(), Dimension );
}
//---------------------------------------------------------------------------//
// Test that the dimension class can be returned
FRENSIE_UNIT_TEST_TEMPLATE( IndependentPhaseSpaceDimensionDistribution,
getDimensionClass,
TestPhaseSpaceDimensions )
{
FETCH_TEMPLATE_PARAM( 0, WrappedDimension );
constexpr PhaseSpaceDimension Dimension = WrappedDimension::value;
std::shared_ptr<const Utility::UnivariateDistribution> basic_distribution(
new Utility::UniformDistribution( 0.5, 1.5, 0.5 ) );
std::shared_ptr<const MonteCarlo::PhaseSpaceDimensionDistribution>
dimension_distribution( new MonteCarlo::IndependentPhaseSpaceDimensionDistribution<Dimension>( basic_distribution ) );
FRENSIE_CHECK_EQUAL( dimension_distribution->getDimensionClass(),
MonteCarlo::PhaseSpaceDimensionTraits<Dimension>::getClass() );
}
//---------------------------------------------------------------------------//
// Test that the distribution type name can be returned
FRENSIE_UNIT_TEST_TEMPLATE( IndependentPhaseSpaceDimensionDistribution,
getDistributionTypeName,
TestPhaseSpaceDimensions )
{
FETCH_TEMPLATE_PARAM( 0, WrappedDimension );
constexpr PhaseSpaceDimension Dimension = WrappedDimension::value;
std::shared_ptr<const Utility::UnivariateDistribution> basic_distribution(
new Utility::UniformDistribution( 0.5, 1.5, 0.5 ) );
std::shared_ptr<const MonteCarlo::PhaseSpaceDimensionDistribution>
dimension_distribution( new MonteCarlo::IndependentPhaseSpaceDimensionDistribution<Dimension>( basic_distribution ) );
FRENSIE_CHECK_EQUAL( dimension_distribution->getDistributionTypeName(),
"Uniform Distribution" );
}
//---------------------------------------------------------------------------//
// Test if the distribution is independent
FRENSIE_UNIT_TEST_TEMPLATE( IndependentPhaseSpaceDimensionDistribution,
isIndependent,
TestPhaseSpaceDimensions )
{
FETCH_TEMPLATE_PARAM( 0, WrappedDimension );
constexpr PhaseSpaceDimension Dimension = WrappedDimension::value;
std::shared_ptr<const Utility::UnivariateDistribution> basic_distribution(
new Utility::UniformDistribution( 0.5, 1.5, 0.5 ) );
std::shared_ptr<const MonteCarlo::PhaseSpaceDimensionDistribution>
dimension_distribution( new MonteCarlo::IndependentPhaseSpaceDimensionDistribution<Dimension>( basic_distribution ) );
FRENSIE_CHECK( dimension_distribution->isIndependent() );
}
//---------------------------------------------------------------------------//
// Test if the distribution is dependent on another dimension
FRENSIE_UNIT_TEST_TEMPLATE( IndependentPhaseSpaceDimensionDistribution,
isDependentOnDimension,
TestPhaseSpaceDimensions )
{
FETCH_TEMPLATE_PARAM( 0, WrappedDimension );
constexpr PhaseSpaceDimension Dimension = WrappedDimension::value;
std::shared_ptr<const Utility::UnivariateDistribution> basic_distribution(
new Utility::UniformDistribution( 0.5, 1.5, 0.5 ) );
std::shared_ptr<const MonteCarlo::PhaseSpaceDimensionDistribution>
dimension_distribution( new MonteCarlo::IndependentPhaseSpaceDimensionDistribution<Dimension>( basic_distribution ) );
FRENSIE_CHECK( !dimension_distribution->isDependentOnDimension( MonteCarlo::PRIMARY_SPATIAL_DIMENSION ) );
FRENSIE_CHECK( !dimension_distribution->isDependentOnDimension( MonteCarlo::SECONDARY_SPATIAL_DIMENSION ) );
FRENSIE_CHECK( !dimension_distribution->isDependentOnDimension( MonteCarlo::TERTIARY_SPATIAL_DIMENSION ) );
FRENSIE_CHECK( !dimension_distribution->isDependentOnDimension( MonteCarlo::PRIMARY_DIRECTIONAL_DIMENSION ) );
FRENSIE_CHECK( !dimension_distribution->isDependentOnDimension( MonteCarlo::SECONDARY_DIRECTIONAL_DIMENSION ) );
FRENSIE_CHECK( !dimension_distribution->isDependentOnDimension( MonteCarlo::TERTIARY_DIRECTIONAL_DIMENSION ) );
FRENSIE_CHECK( !dimension_distribution->isDependentOnDimension( MonteCarlo::ENERGY_DIMENSION ) );
FRENSIE_CHECK( !dimension_distribution->isDependentOnDimension( MonteCarlo::TIME_DIMENSION ) );
FRENSIE_CHECK( !dimension_distribution->isDependentOnDimension( MonteCarlo::WEIGHT_DIMENSION ) );
}
//---------------------------------------------------------------------------//
// Test if the distribution is continuous
FRENSIE_UNIT_TEST_TEMPLATE( IndependentPhaseSpaceDimensionDistribution,
isContinuous,
TestPhaseSpaceDimensions )
{
FETCH_TEMPLATE_PARAM( 0, WrappedDimension );
constexpr PhaseSpaceDimension Dimension = WrappedDimension::value;
std::shared_ptr<const Utility::UnivariateDistribution> basic_distribution(
new Utility::UniformDistribution( 0.5, 1.5, 0.5 ) );
std::shared_ptr<const MonteCarlo::PhaseSpaceDimensionDistribution>
dimension_distribution( new MonteCarlo::IndependentPhaseSpaceDimensionDistribution<Dimension>( basic_distribution ) );
FRENSIE_CHECK( dimension_distribution->isContinuous() );
basic_distribution.reset( new Utility::DeltaDistribution( 1.0 ) );
dimension_distribution.reset( new MonteCarlo::IndependentPhaseSpaceDimensionDistribution<Dimension>( basic_distribution ) );
FRENSIE_CHECK( !dimension_distribution->isContinuous() );
}
//---------------------------------------------------------------------------//
// Test if the distribution is tabular
FRENSIE_UNIT_TEST_TEMPLATE( IndependentPhaseSpaceDimensionDistribution,
isTabular,
TestPhaseSpaceDimensions )
{
FETCH_TEMPLATE_PARAM( 0, WrappedDimension );
constexpr PhaseSpaceDimension Dimension = WrappedDimension::value;
std::shared_ptr<const Utility::UnivariateDistribution> basic_distribution(
new Utility::UniformDistribution( 0.5, 1.5, 0.5 ) );
std::shared_ptr<const MonteCarlo::PhaseSpaceDimensionDistribution>
dimension_distribution( new MonteCarlo::IndependentPhaseSpaceDimensionDistribution<Dimension>( basic_distribution ) );
FRENSIE_CHECK( dimension_distribution->isTabular() );
basic_distribution.reset( new Utility::ExponentialDistribution( 1.0, 1.0 ) );
dimension_distribution.reset( new MonteCarlo::IndependentPhaseSpaceDimensionDistribution<Dimension>( basic_distribution ) );
FRENSIE_CHECK( !dimension_distribution->isTabular() );
}
//---------------------------------------------------------------------------//
// Test if the distribution is uniform
FRENSIE_UNIT_TEST_TEMPLATE( IndependentPhaseSpaceDimensionDistribution,
isUniform,
TestPhaseSpaceDimensions )
{
FETCH_TEMPLATE_PARAM( 0, WrappedDimension );
constexpr PhaseSpaceDimension Dimension = WrappedDimension::value;
std::shared_ptr<const Utility::UnivariateDistribution> basic_distribution(
new Utility::UniformDistribution( 0.5, 1.5, 0.5 ) );
std::shared_ptr<const MonteCarlo::PhaseSpaceDimensionDistribution>
dimension_distribution( new MonteCarlo::IndependentPhaseSpaceDimensionDistribution<Dimension>( basic_distribution ) );
FRENSIE_CHECK( dimension_distribution->isUniform() );
basic_distribution.reset( new Utility::ExponentialDistribution( 1.0, 1.0 ) );
dimension_distribution.reset( new MonteCarlo::IndependentPhaseSpaceDimensionDistribution<Dimension>( basic_distribution ) );
FRENSIE_CHECK( !dimension_distribution->isUniform() );
}
//---------------------------------------------------------------------------//
// Test if the distribution has the specified form
FRENSIE_UNIT_TEST_TEMPLATE( IndependentPhaseSpaceDimensionDistribution,
hasForm,
TestPhaseSpaceDimensions )
{
FETCH_TEMPLATE_PARAM( 0, WrappedDimension );
constexpr PhaseSpaceDimension Dimension = WrappedDimension::value;
std::shared_ptr<const Utility::UnivariateDistribution> basic_distribution(
new Utility::UniformDistribution( 0.5, 1.5, 0.5 ) );
std::shared_ptr<const MonteCarlo::PhaseSpaceDimensionDistribution>
dimension_distribution( new MonteCarlo::IndependentPhaseSpaceDimensionDistribution<Dimension>( basic_distribution ) );
FRENSIE_CHECK( dimension_distribution->hasForm( Utility::UNIFORM_DISTRIBUTION ) );
FRENSIE_CHECK( !dimension_distribution->hasForm( Utility::EXPONENTIAL_DISTRIBUTION ) );
basic_distribution.reset( new Utility::ExponentialDistribution( 1.0, 1.0 ) );
dimension_distribution.reset( new MonteCarlo::IndependentPhaseSpaceDimensionDistribution<Dimension>( basic_distribution ) );
FRENSIE_CHECK( !dimension_distribution->hasForm( Utility::UNIFORM_DISTRIBUTION ) );
FRENSIE_CHECK( dimension_distribution->hasForm( Utility::EXPONENTIAL_DISTRIBUTION ) );
}
//---------------------------------------------------------------------------//
// Test if the distribution can be evaluated without a cascade
FRENSIE_UNIT_TEST_TEMPLATE( IndependentPhaseSpaceDimensionDistribution,
evaluateWithoutCascade,
TestPhaseSpaceDimensions )
{
FETCH_TEMPLATE_PARAM( 0, WrappedDimension );
constexpr PhaseSpaceDimension Dimension = WrappedDimension::value;
std::shared_ptr<const Utility::UnivariateDistribution> basic_distribution(
new Utility::UniformDistribution( 0.5, 0.9, 0.5 ) );
std::shared_ptr<const MonteCarlo::PhaseSpaceDimensionDistribution>
dimension_distribution( new MonteCarlo::IndependentPhaseSpaceDimensionDistribution<Dimension>( basic_distribution ) );
MonteCarlo::PhaseSpacePoint point( spatial_coord_conversion_policy,
directional_coord_conversion_policy );
setCoordinate<Dimension>( point, 0.1 );
FRENSIE_CHECK_EQUAL( dimension_distribution->evaluateWithoutCascade( point ),
0.0 );
setCoordinate<Dimension>( point, 0.5 );
FRENSIE_CHECK_EQUAL( dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<Dimension>( point, 0.7 );
FRENSIE_CHECK_EQUAL( dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<Dimension>( point, 0.9 );
FRENSIE_CHECK_EQUAL( dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<Dimension>( point, 1.0 );
FRENSIE_CHECK_EQUAL( dimension_distribution->evaluateWithoutCascade( point ),
0.0 );
}
//---------------------------------------------------------------------------//
// Test if the distribution can be sampled without a cascade
FRENSIE_UNIT_TEST_TEMPLATE( IndependentPhaseSpaceDimensionDistribution,
sampleWithoutCascade,
TestPhaseSpaceDimensionsNoWeight )
{
FETCH_TEMPLATE_PARAM( 0, WrappedDimension );
constexpr PhaseSpaceDimension Dimension = WrappedDimension::value;
std::shared_ptr<const Utility::UnivariateDistribution> basic_distribution(
new Utility::UniformDistribution( 0.1, 0.9, 0.5 ) );
std::shared_ptr<const MonteCarlo::PhaseSpaceDimensionDistribution>
dimension_distribution( new MonteCarlo::IndependentPhaseSpaceDimensionDistribution<Dimension>( basic_distribution ) );
MonteCarlo::PhaseSpacePoint point( spatial_coord_conversion_policy,
directional_coord_conversion_policy );
std::vector<double> fake_stream( 3 );
fake_stream[0] = 0.0;
fake_stream[1] = 0.5;
fake_stream[2] = 1.0 - 1e-15;
Utility::RandomNumberGenerator::setFakeStream( fake_stream );
dimension_distribution->sampleWithoutCascade( point );
FRENSIE_CHECK_EQUAL( getCoordinate<Dimension>( point ), 0.1 );
FRENSIE_CHECK_EQUAL( getCoordinateWeight<Dimension>( point ), 1.0 );
dimension_distribution->sampleWithoutCascade( point );
FRENSIE_CHECK_EQUAL( getCoordinate<Dimension>( point ), 0.5 );
FRENSIE_CHECK_EQUAL( getCoordinateWeight<Dimension>( point ), 1.0 );
dimension_distribution->sampleWithoutCascade( point );
FRENSIE_CHECK_FLOATING_EQUALITY( getCoordinate<Dimension>( point ), 0.9, 1e-15 );
FRENSIE_CHECK_EQUAL( getCoordinateWeight<Dimension>( point ), 1.0 );
}
//---------------------------------------------------------------------------//
// Test if the distribution can be sampled without a cascade and the
// trials can be counted
FRENSIE_UNIT_TEST_TEMPLATE( IndependentPhaseSpaceDimensionDistribution,
sampleAndRecordTrialsWithoutCascade,
TestPhaseSpaceDimensionsNoWeight )
{
FETCH_TEMPLATE_PARAM( 0, WrappedDimension );
constexpr PhaseSpaceDimension Dimension = WrappedDimension::value;
std::shared_ptr<const Utility::UnivariateDistribution> basic_distribution(
new Utility::UniformDistribution( 0.1, 0.9, 0.5 ) );
std::shared_ptr<const MonteCarlo::PhaseSpaceDimensionDistribution>
dimension_distribution( new MonteCarlo::IndependentPhaseSpaceDimensionDistribution<Dimension>( basic_distribution ) );
MonteCarlo::PhaseSpacePoint point( spatial_coord_conversion_policy,
directional_coord_conversion_policy );
typename MonteCarlo::IndependentPhaseSpaceDimensionDistribution<Dimension>::Counter trials = 0;
std::vector<double> fake_stream( 3 );
fake_stream[0] = 0.0;
fake_stream[1] = 0.5;
fake_stream[2] = 1.0 - 1e-15;
Utility::RandomNumberGenerator::setFakeStream( fake_stream );
dimension_distribution->sampleAndRecordTrialsWithoutCascade( point, trials );
FRENSIE_CHECK_EQUAL( getCoordinate<Dimension>( point ), 0.1 );
FRENSIE_CHECK_EQUAL( getCoordinateWeight<Dimension>( point ), 1.0 );
FRENSIE_CHECK_EQUAL( trials, 1 );
dimension_distribution->sampleAndRecordTrialsWithoutCascade( point, trials );
FRENSIE_CHECK_EQUAL( getCoordinate<Dimension>( point ), 0.5 );
FRENSIE_CHECK_EQUAL( getCoordinateWeight<Dimension>( point ), 1.0 );
FRENSIE_CHECK_EQUAL( trials, 2 );
dimension_distribution->sampleAndRecordTrialsWithoutCascade( point, trials );
FRENSIE_CHECK_FLOATING_EQUALITY( getCoordinate<Dimension>( point ), 0.9, 1e-15 );
FRENSIE_CHECK_EQUAL( getCoordinateWeight<Dimension>( point ), 1.0 );
FRENSIE_CHECK_EQUAL( trials, 3 );
}
//---------------------------------------------------------------------------//
// Test that the dimension value can be set and weighted appropriately
FRENSIE_UNIT_TEST_TEMPLATE( IndependentPhaseSpaceDimensionDistribution,
setDimensionValueAndApplyWeight,
TestPhaseSpaceDimensionsNoWeight )
{
FETCH_TEMPLATE_PARAM( 0, WrappedDimension );
constexpr PhaseSpaceDimension Dimension = WrappedDimension::value;
std::shared_ptr<const Utility::UnivariateDistribution> basic_distribution(
new Utility::UniformDistribution( 0.1, 0.9, 0.5 ) );
std::shared_ptr<const MonteCarlo::PhaseSpaceDimensionDistribution>
dimension_distribution( new MonteCarlo::IndependentPhaseSpaceDimensionDistribution<Dimension>( basic_distribution ) );
MonteCarlo::PhaseSpacePoint point( spatial_coord_conversion_policy,
directional_coord_conversion_policy );
dimension_distribution->setDimensionValueAndApplyWeight( point, 0.1 );
FRENSIE_CHECK_EQUAL( getCoordinate<Dimension>( point ), 0.1 );
FRENSIE_CHECK_EQUAL( getCoordinateWeight<Dimension>( point ), 1.25 );
dimension_distribution->setDimensionValueAndApplyWeight( point, 0.5 );
FRENSIE_CHECK_EQUAL( getCoordinate<Dimension>( point ), 0.5 );
FRENSIE_CHECK_EQUAL( getCoordinateWeight<Dimension>( point ), 1.25 );
dimension_distribution->setDimensionValueAndApplyWeight( point, 0.9 );
FRENSIE_CHECK_EQUAL( getCoordinate<Dimension>( point ), 0.9 );
FRENSIE_CHECK_EQUAL( getCoordinateWeight<Dimension>( point ), 1.25 );
}
//---------------------------------------------------------------------------//
// Check that the distribution can be archived
FRENSIE_UNIT_TEST_TEMPLATE_EXPAND( PhaseSpaceDimension,
archive,
TestArchives )
{
FETCH_TEMPLATE_PARAM( 0, RawOArchive );
FETCH_TEMPLATE_PARAM( 1, RawIArchive );
typedef typename std::remove_pointer<RawOArchive>::type OArchive;
typedef typename std::remove_pointer<RawIArchive>::type IArchive;
std::string archive_base_name( "test_independent_phase_dimension_distribution" );
std::ostringstream archive_ostream;
{
std::unique_ptr<OArchive> oarchive;
createOArchive( archive_base_name, archive_ostream, oarchive );
std::shared_ptr<const Utility::UnivariateDistribution> basic_distribution(
new Utility::UniformDistribution( 0.5, 0.9, 0.5 ) );
std::shared_ptr<const MonteCarlo::PhaseSpaceDimensionDistribution>
primary_spatial_dimension_distribution( new MonteCarlo::IndependentPrimarySpatialDimensionDistribution( basic_distribution ) );
std::shared_ptr<const MonteCarlo::PhaseSpaceDimensionDistribution>
secondary_spatial_dimension_distribution( new MonteCarlo::IndependentSecondarySpatialDimensionDistribution( basic_distribution ) );
std::shared_ptr<const MonteCarlo::PhaseSpaceDimensionDistribution>
tertiary_spatial_dimension_distribution( new MonteCarlo::IndependentTertiarySpatialDimensionDistribution( basic_distribution ) );
std::shared_ptr<const MonteCarlo::PhaseSpaceDimensionDistribution>
primary_directional_dimension_distribution( new MonteCarlo::IndependentPrimaryDirectionalDimensionDistribution( basic_distribution ) );
std::shared_ptr<const MonteCarlo::PhaseSpaceDimensionDistribution>
secondary_directional_dimension_distribution( new MonteCarlo::IndependentSecondaryDirectionalDimensionDistribution( basic_distribution ) );
std::shared_ptr<const MonteCarlo::PhaseSpaceDimensionDistribution>
tertiary_directional_dimension_distribution( new MonteCarlo::IndependentTertiaryDirectionalDimensionDistribution( basic_distribution ) );
std::shared_ptr<const MonteCarlo::PhaseSpaceDimensionDistribution>
energy_dimension_distribution( new MonteCarlo::IndependentEnergyDimensionDistribution( basic_distribution ) );
std::shared_ptr<const MonteCarlo::PhaseSpaceDimensionDistribution>
time_dimension_distribution( new MonteCarlo::IndependentTimeDimensionDistribution( basic_distribution ) );
std::shared_ptr<const MonteCarlo::PhaseSpaceDimensionDistribution>
weight_dimension_distribution( new MonteCarlo::IndependentWeightDimensionDistribution( basic_distribution ) );
FRENSIE_REQUIRE_NO_THROW( (*oarchive) << BOOST_SERIALIZATION_NVP(primary_spatial_dimension_distribution) );
FRENSIE_REQUIRE_NO_THROW( (*oarchive) << BOOST_SERIALIZATION_NVP(secondary_spatial_dimension_distribution) );
FRENSIE_REQUIRE_NO_THROW( (*oarchive) << BOOST_SERIALIZATION_NVP(tertiary_spatial_dimension_distribution) );
FRENSIE_REQUIRE_NO_THROW( (*oarchive) << BOOST_SERIALIZATION_NVP(primary_directional_dimension_distribution) );
FRENSIE_REQUIRE_NO_THROW( (*oarchive) << BOOST_SERIALIZATION_NVP(secondary_directional_dimension_distribution) );
FRENSIE_REQUIRE_NO_THROW( (*oarchive) << BOOST_SERIALIZATION_NVP(tertiary_directional_dimension_distribution) );
FRENSIE_REQUIRE_NO_THROW( (*oarchive) << BOOST_SERIALIZATION_NVP(energy_dimension_distribution) );
FRENSIE_REQUIRE_NO_THROW( (*oarchive) << BOOST_SERIALIZATION_NVP(time_dimension_distribution) );
FRENSIE_REQUIRE_NO_THROW( (*oarchive) << BOOST_SERIALIZATION_NVP(weight_dimension_distribution) );
}
// Copy the archive ostream to an istream
std::istringstream archive_istream( archive_ostream.str() );
// Load the archived distributions
std::unique_ptr<IArchive> iarchive;
createIArchive( archive_istream, iarchive );
std::shared_ptr<const MonteCarlo::PhaseSpaceDimensionDistribution>
primary_spatial_dimension_distribution,
secondary_spatial_dimension_distribution,
tertiary_spatial_dimension_distribution,
primary_directional_dimension_distribution,
secondary_directional_dimension_distribution,
tertiary_directional_dimension_distribution,
energy_dimension_distribution,
time_dimension_distribution,
weight_dimension_distribution;
FRENSIE_REQUIRE_NO_THROW( (*iarchive) >> BOOST_SERIALIZATION_NVP(primary_spatial_dimension_distribution) );
FRENSIE_REQUIRE_NO_THROW( (*iarchive) >> BOOST_SERIALIZATION_NVP(secondary_spatial_dimension_distribution) );
FRENSIE_REQUIRE_NO_THROW( (*iarchive) >> BOOST_SERIALIZATION_NVP(tertiary_spatial_dimension_distribution) );
FRENSIE_REQUIRE_NO_THROW( (*iarchive) >> BOOST_SERIALIZATION_NVP(primary_directional_dimension_distribution) );
FRENSIE_REQUIRE_NO_THROW( (*iarchive) >> BOOST_SERIALIZATION_NVP(secondary_directional_dimension_distribution) );
FRENSIE_REQUIRE_NO_THROW( (*iarchive) >> BOOST_SERIALIZATION_NVP(tertiary_directional_dimension_distribution) );
FRENSIE_REQUIRE_NO_THROW( (*iarchive) >> BOOST_SERIALIZATION_NVP(energy_dimension_distribution) );
FRENSIE_REQUIRE_NO_THROW( (*iarchive) >> BOOST_SERIALIZATION_NVP(time_dimension_distribution) );
FRENSIE_REQUIRE_NO_THROW( (*iarchive) >> BOOST_SERIALIZATION_NVP(weight_dimension_distribution) );
iarchive.reset();
{
FRENSIE_CHECK_EQUAL( primary_spatial_dimension_distribution->getDimension(),
PRIMARY_SPATIAL_DIMENSION );
MonteCarlo::PhaseSpacePoint point( spatial_coord_conversion_policy,
directional_coord_conversion_policy );
setCoordinate<PRIMARY_SPATIAL_DIMENSION>( point, 0.1 );
FRENSIE_CHECK_EQUAL( primary_spatial_dimension_distribution->evaluateWithoutCascade( point ),
0.0 );
setCoordinate<PRIMARY_SPATIAL_DIMENSION>( point, 0.5 );
FRENSIE_CHECK_EQUAL( primary_spatial_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<PRIMARY_SPATIAL_DIMENSION>( point, 0.7 );
FRENSIE_CHECK_EQUAL( primary_spatial_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<PRIMARY_SPATIAL_DIMENSION>( point, 0.9 );
FRENSIE_CHECK_EQUAL( primary_spatial_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<PRIMARY_SPATIAL_DIMENSION>( point, 1.0 );
FRENSIE_CHECK_EQUAL( primary_spatial_dimension_distribution->evaluateWithoutCascade( point ),
0.0 );
}
{
FRENSIE_CHECK_EQUAL( secondary_spatial_dimension_distribution->getDimension(),
SECONDARY_SPATIAL_DIMENSION );
MonteCarlo::PhaseSpacePoint point( spatial_coord_conversion_policy,
directional_coord_conversion_policy );
setCoordinate<SECONDARY_SPATIAL_DIMENSION>( point, 0.1 );
FRENSIE_CHECK_EQUAL( secondary_spatial_dimension_distribution->evaluateWithoutCascade( point ),
0.0 );
setCoordinate<SECONDARY_SPATIAL_DIMENSION>( point, 0.5 );
FRENSIE_CHECK_EQUAL( secondary_spatial_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<SECONDARY_SPATIAL_DIMENSION>( point, 0.7 );
FRENSIE_CHECK_EQUAL( secondary_spatial_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<SECONDARY_SPATIAL_DIMENSION>( point, 0.9 );
FRENSIE_CHECK_EQUAL( secondary_spatial_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<SECONDARY_SPATIAL_DIMENSION>( point, 1.0 );
FRENSIE_CHECK_EQUAL( secondary_spatial_dimension_distribution->evaluateWithoutCascade( point ),
0.0 );
}
{
FRENSIE_CHECK_EQUAL( tertiary_spatial_dimension_distribution->getDimension(),
TERTIARY_SPATIAL_DIMENSION );
MonteCarlo::PhaseSpacePoint point( spatial_coord_conversion_policy,
directional_coord_conversion_policy );
setCoordinate<TERTIARY_SPATIAL_DIMENSION>( point, 0.1 );
FRENSIE_CHECK_EQUAL( tertiary_spatial_dimension_distribution->evaluateWithoutCascade( point ),
0.0 );
setCoordinate<TERTIARY_SPATIAL_DIMENSION>( point, 0.5 );
FRENSIE_CHECK_EQUAL( tertiary_spatial_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<TERTIARY_SPATIAL_DIMENSION>( point, 0.7 );
FRENSIE_CHECK_EQUAL( tertiary_spatial_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<TERTIARY_SPATIAL_DIMENSION>( point, 0.9 );
FRENSIE_CHECK_EQUAL( tertiary_spatial_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<TERTIARY_SPATIAL_DIMENSION>( point, 1.0 );
FRENSIE_CHECK_EQUAL( tertiary_spatial_dimension_distribution->evaluateWithoutCascade( point ),
0.0 );
}
{
FRENSIE_CHECK_EQUAL( primary_directional_dimension_distribution->getDimension(),
PRIMARY_DIRECTIONAL_DIMENSION );
MonteCarlo::PhaseSpacePoint point( spatial_coord_conversion_policy,
directional_coord_conversion_policy );
setCoordinate<PRIMARY_DIRECTIONAL_DIMENSION>( point, 0.1 );
FRENSIE_CHECK_EQUAL( primary_directional_dimension_distribution->evaluateWithoutCascade( point ),
0.0 );
setCoordinate<PRIMARY_DIRECTIONAL_DIMENSION>( point, 0.5 );
FRENSIE_CHECK_EQUAL( primary_directional_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<PRIMARY_DIRECTIONAL_DIMENSION>( point, 0.7 );
FRENSIE_CHECK_EQUAL( primary_directional_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<PRIMARY_DIRECTIONAL_DIMENSION>( point, 0.9 );
FRENSIE_CHECK_EQUAL( primary_directional_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<PRIMARY_DIRECTIONAL_DIMENSION>( point, 1.0 );
FRENSIE_CHECK_EQUAL( primary_directional_dimension_distribution->evaluateWithoutCascade( point ),
0.0 );
}
{
FRENSIE_CHECK_EQUAL( secondary_directional_dimension_distribution->getDimension(),
SECONDARY_DIRECTIONAL_DIMENSION );
MonteCarlo::PhaseSpacePoint point( spatial_coord_conversion_policy,
directional_coord_conversion_policy );
setCoordinate<SECONDARY_DIRECTIONAL_DIMENSION>( point, 0.1 );
FRENSIE_CHECK_EQUAL( secondary_directional_dimension_distribution->evaluateWithoutCascade( point ),
0.0 );
setCoordinate<SECONDARY_DIRECTIONAL_DIMENSION>( point, 0.5 );
FRENSIE_CHECK_EQUAL( secondary_directional_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<SECONDARY_DIRECTIONAL_DIMENSION>( point, 0.7 );
FRENSIE_CHECK_EQUAL( secondary_directional_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<SECONDARY_DIRECTIONAL_DIMENSION>( point, 0.9 );
FRENSIE_CHECK_EQUAL( secondary_directional_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<SECONDARY_DIRECTIONAL_DIMENSION>( point, 1.0 );
FRENSIE_CHECK_EQUAL( secondary_directional_dimension_distribution->evaluateWithoutCascade( point ),
0.0 );
}
{
FRENSIE_CHECK_EQUAL( tertiary_directional_dimension_distribution->getDimension(),
TERTIARY_DIRECTIONAL_DIMENSION );
MonteCarlo::PhaseSpacePoint point( spatial_coord_conversion_policy,
directional_coord_conversion_policy );
setCoordinate<TERTIARY_DIRECTIONAL_DIMENSION>( point, 0.1 );
FRENSIE_CHECK_EQUAL( tertiary_directional_dimension_distribution->evaluateWithoutCascade( point ),
0.0 );
setCoordinate<TERTIARY_DIRECTIONAL_DIMENSION>( point, 0.5 );
FRENSIE_CHECK_EQUAL( tertiary_directional_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<TERTIARY_DIRECTIONAL_DIMENSION>( point, 0.7 );
FRENSIE_CHECK_EQUAL( tertiary_directional_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<TERTIARY_DIRECTIONAL_DIMENSION>( point, 0.9 );
FRENSIE_CHECK_EQUAL( tertiary_directional_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<TERTIARY_DIRECTIONAL_DIMENSION>( point, 1.0 );
FRENSIE_CHECK_EQUAL( tertiary_directional_dimension_distribution->evaluateWithoutCascade( point ),
0.0 );
}
{
FRENSIE_CHECK_EQUAL( energy_dimension_distribution->getDimension(),
ENERGY_DIMENSION );
MonteCarlo::PhaseSpacePoint point( spatial_coord_conversion_policy,
directional_coord_conversion_policy );
setCoordinate<ENERGY_DIMENSION>( point, 0.1 );
FRENSIE_CHECK_EQUAL( energy_dimension_distribution->evaluateWithoutCascade( point ),
0.0 );
setCoordinate<ENERGY_DIMENSION>( point, 0.5 );
FRENSIE_CHECK_EQUAL( energy_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<ENERGY_DIMENSION>( point, 0.7 );
FRENSIE_CHECK_EQUAL( energy_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<ENERGY_DIMENSION>( point, 0.9 );
FRENSIE_CHECK_EQUAL( energy_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<ENERGY_DIMENSION>( point, 1.0 );
FRENSIE_CHECK_EQUAL( energy_dimension_distribution->evaluateWithoutCascade( point ),
0.0 );
}
{
FRENSIE_CHECK_EQUAL( time_dimension_distribution->getDimension(),
TIME_DIMENSION );
MonteCarlo::PhaseSpacePoint point( spatial_coord_conversion_policy,
directional_coord_conversion_policy );
setCoordinate<TIME_DIMENSION>( point, 0.1 );
FRENSIE_CHECK_EQUAL( time_dimension_distribution->evaluateWithoutCascade( point ),
0.0 );
setCoordinate<TIME_DIMENSION>( point, 0.5 );
FRENSIE_CHECK_EQUAL( time_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<TIME_DIMENSION>( point, 0.7 );
FRENSIE_CHECK_EQUAL( time_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<TIME_DIMENSION>( point, 0.9 );
FRENSIE_CHECK_EQUAL( time_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<TIME_DIMENSION>( point, 1.0 );
FRENSIE_CHECK_EQUAL( time_dimension_distribution->evaluateWithoutCascade( point ),
0.0 );
}
{
FRENSIE_CHECK_EQUAL( weight_dimension_distribution->getDimension(),
WEIGHT_DIMENSION );
MonteCarlo::PhaseSpacePoint point( spatial_coord_conversion_policy,
directional_coord_conversion_policy );
setCoordinate<WEIGHT_DIMENSION>( point, 0.1 );
FRENSIE_CHECK_EQUAL( weight_dimension_distribution->evaluateWithoutCascade( point ),
0.0 );
setCoordinate<WEIGHT_DIMENSION>( point, 0.5 );
FRENSIE_CHECK_EQUAL( weight_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<WEIGHT_DIMENSION>( point, 0.7 );
FRENSIE_CHECK_EQUAL( weight_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<WEIGHT_DIMENSION>( point, 0.9 );
FRENSIE_CHECK_EQUAL( weight_dimension_distribution->evaluateWithoutCascade( point ),
0.5 );
setCoordinate<WEIGHT_DIMENSION>( point, 1.0 );
FRENSIE_CHECK_EQUAL( weight_dimension_distribution->evaluateWithoutCascade( point ),
0.0 );
}
}
//---------------------------------------------------------------------------//
// Custom setup
//---------------------------------------------------------------------------//
FRENSIE_CUSTOM_UNIT_TEST_SETUP_BEGIN();
FRENSIE_CUSTOM_UNIT_TEST_INIT()
{
// Initialize the random number generator
Utility::RandomNumberGenerator::createStreams();
}
FRENSIE_CUSTOM_UNIT_TEST_SETUP_END();
//---------------------------------------------------------------------------//
// end tstIndependentPhaseSpaceDimensionDistribution.cpp
//---------------------------------------------------------------------------//
| 45.345588
| 174
| 0.690125
|
bam241
|
69b9905adc72eba720b32122f1980ce4698e364f
| 10,627
|
cpp
|
C++
|
src/extern/inventor/lib/database/src/so/nodes/nurbs/libnurbs/mesher.cpp
|
OpenXIP/xip-libraries
|
9f0fef66038b20ff0c81c089d7dd0038e3126e40
|
[
"Apache-2.0"
] | 2
|
2020-05-21T07:06:07.000Z
|
2021-06-28T02:14:34.000Z
|
src/extern/inventor/lib/database/src/so/nodes/nurbs/libnurbs/mesher.cpp
|
OpenXIP/xip-libraries
|
9f0fef66038b20ff0c81c089d7dd0038e3126e40
|
[
"Apache-2.0"
] | null | null | null |
src/extern/inventor/lib/database/src/so/nodes/nurbs/libnurbs/mesher.cpp
|
OpenXIP/xip-libraries
|
9f0fef66038b20ff0c81c089d7dd0038e3126e40
|
[
"Apache-2.0"
] | 6
|
2016-03-21T19:53:18.000Z
|
2021-06-08T18:06:03.000Z
|
/*
*
* Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* 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 Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
* Mountain View, CA 94043, or:
*
* http://www.sgi.com
*
* For further information regarding this notice, see:
*
* http://oss.sgi.com/projects/GenInfo/NoticeExplan/
*
*/
/*
* mesher.c++ - $Revision: 1.2 $
* Derrick Burns - 1991
*/
#include "glimports.h"
#include "myassert.h"
#include "mystdio.h"
#include "mesher.h"
#include "gridvertex.h"
#include "gridtrimvertex.h"
#include "jarcloc.h"
#include "gridline.h"
#include "trimline.h"
#include "uarray.h"
#include "backend.h"
const float Mesher::ZERO = 0.0;
Mesher::Mesher( Backend& b )
: backend( b ),
p( sizeof( GridTrimVertex ), 100, "GridTrimVertexPool" )
{
stacksize = 0;
vdata = 0;
lastedge = 0;
}
Mesher::~Mesher( void )
{
if( vdata ) delete[] vdata;
}
void
Mesher::init( unsigned int npts )
{
p.clear();
if( stacksize < npts ) {
stacksize = 2 * npts;
if( vdata ) delete[] vdata;
vdata = new GridTrimVertex_p[stacksize];
}
}
inline void
Mesher::push( GridTrimVertex *gt )
{
assert( itop+1 != stacksize );
vdata[++itop] = gt;
}
inline void
Mesher::pop( long )
{
}
inline void
Mesher::openMesh()
{
backend.bgntmesh( "addedge" );
}
inline void
Mesher::closeMesh()
{
backend.endtmesh();
}
inline void
Mesher::swapMesh()
{
backend.swaptmesh();
}
inline void
Mesher::clearStack()
{
itop = -1;
last[0] = 0;
}
void
Mesher::finishLower( GridTrimVertex *gtlower )
{
for( push(gtlower);
nextlower( gtlower=new(p) GridTrimVertex );
push(gtlower) )
addLower();
addLast();
}
void
Mesher::finishUpper( GridTrimVertex *gtupper )
{
for( push(gtupper);
nextupper( gtupper=new(p) GridTrimVertex );
push(gtupper) )
addUpper();
addLast();
}
void
Mesher::mesh( void )
{
GridTrimVertex *gtlower, *gtupper;
Hull::init( );
nextupper( gtupper = new(p) GridTrimVertex );
nextlower( gtlower = new(p) GridTrimVertex );
clearStack();
openMesh();
push(gtupper);
nextupper( gtupper = new(p) GridTrimVertex );
nextlower( gtlower );
assert( gtupper->t && gtlower->t );
if( gtupper->t->param[0] < gtlower->t->param[0] ) {
push(gtupper);
lastedge = 1;
if( nextupper( gtupper=new(p) GridTrimVertex ) == 0 ) {
finishLower(gtlower);
return;
}
} else if( gtupper->t->param[0] > gtlower->t->param[0] ) {
push(gtlower);
lastedge = 0;
if( nextlower( gtlower=new(p) GridTrimVertex ) == 0 ) {
finishUpper(gtupper);
return;
}
} else {
if( lastedge == 0 ) {
push(gtupper);
lastedge = 1;
if( nextupper(gtupper=new(p) GridTrimVertex) == 0 ) {
finishLower(gtlower);
return;
}
} else {
push(gtlower);
lastedge = 0;
if( nextlower( gtlower=new(p) GridTrimVertex ) == 0 ) {
finishUpper(gtupper);
return;
}
}
}
while ( 1 ) {
if( gtupper->t->param[0] < gtlower->t->param[0] ) {
push(gtupper);
addUpper();
if( nextupper( gtupper=new(p) GridTrimVertex ) == 0 ) {
finishLower(gtlower);
return;
}
} else if( gtupper->t->param[0] > gtlower->t->param[0] ) {
push(gtlower);
addLower();
if( nextlower( gtlower=new(p) GridTrimVertex ) == 0 ) {
finishUpper(gtupper);
return;
}
} else {
if( lastedge == 0 ) {
push(gtupper);
addUpper();
if( nextupper( gtupper=new(p) GridTrimVertex ) == 0 ) {
finishLower(gtlower);
return;
}
} else {
push(gtlower);
addLower();
if( nextlower( gtlower=new(p) GridTrimVertex ) == 0 ) {
finishUpper(gtupper);
return;
}
}
}
}
}
inline int
Mesher::isCcw( int ilast )
{
REAL area = det3( vdata[ilast]->t, vdata[itop-1]->t, vdata[itop-2]->t );
return (area < ZERO) ? 0 : 1;
}
inline int
Mesher::isCw( int ilast )
{
REAL area = det3( vdata[ilast]->t, vdata[itop-1]->t, vdata[itop-2]->t );
return (area > -ZERO) ? 0 : 1;
}
inline int
Mesher::equal( int x, int y )
{
return( last[0] == vdata[x] && last[1] == vdata[y] );
}
inline void
Mesher::copy( int x, int y )
{
last[0] = vdata[x]; last[1] = vdata[y];
}
inline void
Mesher::move( int x, int y )
{
vdata[x] = vdata[y];
}
inline void
Mesher::output( int x )
{
backend.tmeshvert( vdata[x] );
}
/*---------------------------------------------------------------------------
* addedge - addedge an edge to the triangulation
*
* This code has been re-written to generate large triangle meshes
* from a monotone polygon. Although smaller triangle meshes
* could be generated faster and with less code, larger meshes
* actually give better SYSTEM performance. This is because
* vertices are processed in the backend slower than they are
* generated by this code and any decrease in the number of vertices
* results in a decrease in the time spent in the backend.
*---------------------------------------------------------------------------
*/
void
Mesher::addLast( )
{
register int ilast = itop;
if( lastedge == 0 ) {
if( equal( 0, 1 ) ) {
output( ilast );
swapMesh();
for( register int i = 2; i < ilast; i++ ) {
swapMesh();
output( i );
}
copy( ilast, ilast-1 );
} else if( equal( ilast-2, ilast-1) ) {
swapMesh();
output( ilast );
for( register int i = ilast-3; i >= 0; i-- ) {
output( i );
swapMesh();
}
copy( 0, ilast );
} else {
closeMesh(); openMesh();
output( ilast );
output( 0 );
for( register int i = 1; i < ilast; i++ ) {
swapMesh();
output( i );
}
copy( ilast, ilast-1 );
}
} else {
if( equal( 1, 0) ) {
swapMesh();
output( ilast );
for( register int i = 2; i < ilast; i++ ) {
output( i );
swapMesh();
}
copy( ilast-1, ilast );
} else if( equal( ilast-1, ilast-2) ) {
output( ilast );
swapMesh();
for( register int i = ilast-3; i >= 0; i-- ) {
swapMesh();
output( i );
}
copy( ilast, 0 );
} else {
closeMesh(); openMesh();
output( 0 );
output( ilast );
for( register int i = 1; i < ilast; i++ ) {
output( i );
swapMesh();
}
copy( ilast-1, ilast );
}
}
closeMesh();
//for( register long k=0; k<=ilast; k++ ) pop( k );
}
void
Mesher::addUpper( )
{
register int ilast = itop;
if( lastedge == 0 ) {
if( equal( 0, 1 ) ) {
output( ilast );
swapMesh();
for( register int i = 2; i < ilast; i++ ) {
swapMesh();
output( i );
}
copy( ilast, ilast-1 );
} else if( equal( ilast-2, ilast-1) ) {
swapMesh();
output( ilast );
for( register int i = ilast-3; i >= 0; i-- ) {
output( i );
swapMesh();
}
copy( 0, ilast );
} else {
closeMesh(); openMesh();
output( ilast );
output( 0 );
for( register int i = 1; i < ilast; i++ ) {
swapMesh();
output( i );
}
copy( ilast, ilast-1 );
}
lastedge = 1;
//for( register long k=0; k<ilast-1; k++ ) pop( k );
move( 0, ilast-1 );
move( 1, ilast );
itop = 1;
} else {
if( ! isCcw( ilast ) ) return;
do {
itop--;
} while( (itop > 1) && isCcw( ilast ) );
if( equal( ilast-1, ilast-2 ) ) {
output( ilast );
swapMesh();
for( register int i=ilast-3; i>=itop-1; i-- ) {
swapMesh();
output( i );
}
copy( ilast, itop-1 );
} else if( equal( itop, itop-1 ) ) {
swapMesh();
output( ilast );
for( register int i = itop+1; i < ilast; i++ ) {
output( i );
swapMesh();
}
copy( ilast-1, ilast );
} else {
closeMesh(); openMesh();
output( ilast );
output( ilast-1 );
for( register int i=ilast-2; i>=itop-1; i-- ) {
swapMesh();
output( i );
}
copy( ilast, itop-1 );
}
//for( register int k=itop; k<ilast; k++ ) pop( k );
move( itop, ilast );
}
}
void
Mesher::addLower()
{
register int ilast = itop;
if( lastedge == 1 ) {
if( equal( 1, 0) ) {
swapMesh();
output( ilast );
for( register int i = 2; i < ilast; i++ ) {
output( i );
swapMesh();
}
copy( ilast-1, ilast );
} else if( equal( ilast-1, ilast-2) ) {
output( ilast );
swapMesh();
for( register int i = ilast-3; i >= 0; i-- ) {
swapMesh();
output( i );
}
copy( ilast, 0 );
} else {
closeMesh(); openMesh();
output( 0 );
output( ilast );
for( register int i = 1; i < ilast; i++ ) {
output( i );
swapMesh();
}
copy( ilast-1, ilast );
}
lastedge = 0;
//for( register long k=0; k<ilast-1; k++ ) pop( k );
move( 0, ilast-1 );
move( 1, ilast );
itop = 1;
} else {
if( ! isCw( ilast ) ) return;
do {
itop--;
} while( (itop > 1) && isCw( ilast ) );
if( equal( ilast-2, ilast-1) ) {
swapMesh();
output( ilast );
for( register int i=ilast-3; i>=itop-1; i--) {
output( i );
swapMesh( );
}
copy( itop-1, ilast );
} else if( equal( itop-1, itop) ) {
output( ilast );
swapMesh();
for( register int i=itop+1; i<ilast; i++ ) {
swapMesh( );
output( i );
}
copy( ilast, ilast-1 );
} else {
closeMesh(); openMesh();
output( ilast-1 );
output( ilast );
for( register int i=ilast-2; i>=itop-1; i-- ) {
output( i );
swapMesh( );
}
copy( itop-1, ilast );
}
//for( register int k=itop; k<ilast; k++ ) pop( k );
move( itop, ilast );
}
}
| 21.732106
| 77
| 0.56347
|
OpenXIP
|
69baeb7d6ebe81751f6ae3ba6556c8840ebc1edb
| 533
|
cpp
|
C++
|
cpp/11973.cpp
|
jinhan814/BOJ
|
47d2a89a2602144eb08459cabac04d036c758577
|
[
"MIT"
] | 9
|
2021-01-15T13:36:39.000Z
|
2022-02-23T03:44:46.000Z
|
cpp/11973.cpp
|
jinhan814/BOJ
|
47d2a89a2602144eb08459cabac04d036c758577
|
[
"MIT"
] | 1
|
2021-07-31T17:11:26.000Z
|
2021-08-02T01:01:03.000Z
|
cpp/11973.cpp
|
jinhan814/BOJ
|
47d2a89a2602144eb08459cabac04d036c758577
|
[
"MIT"
] | null | null | null |
#include <bits/stdc++.h>
#define fastio cin.tie(0)->sync_with_stdio(0)
using namespace std;
int n, k, v[50'000];
inline bool Check(const int mid) {
int cnt = 0;
for (int i = 0; i < n;) {
const int j = i;
while (i < n && v[i] - v[j] <= mid << 1) i++;
cnt++;
}
return cnt <= k;
}
int main() {
fastio;
cin >> n >> k;
for (int i = 0; i < n; i++) cin >> v[i];
sort(v, v + n);
int lo = -1, hi = 1e9;
while (lo + 1 < hi) {
int mid = lo + hi >> 1;
if (!Check(mid)) lo = mid;
else hi = mid;
}
cout << hi << '\n';
}
| 17.766667
| 47
| 0.497186
|
jinhan814
|
69c1c472367f84931449ade7a28833db0e376d5c
| 890
|
cpp
|
C++
|
sealtk/core/TrackUtils.cpp
|
BetsyMcPhail/seal-tk
|
49eccad75e501450fbb63524062706968f5f3bef
|
[
"BSD-3-Clause"
] | null | null | null |
sealtk/core/TrackUtils.cpp
|
BetsyMcPhail/seal-tk
|
49eccad75e501450fbb63524062706968f5f3bef
|
[
"BSD-3-Clause"
] | null | null | null |
sealtk/core/TrackUtils.cpp
|
BetsyMcPhail/seal-tk
|
49eccad75e501450fbb63524062706968f5f3bef
|
[
"BSD-3-Clause"
] | null | null | null |
/* 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/core/TrackUtils.hpp>
#include <vital/range/indirect.h>
#include <qtStlUtil.h>
#include <QVariantHash>
namespace kv = kwiver::vital;
namespace kvr = kwiver::vital::range;
namespace sealtk
{
namespace core
{
// ----------------------------------------------------------------------------
kv::detected_object_type_sptr classificationToDetectedObjectType(
QVariantHash const& in)
{
if (in.isEmpty())
{
return nullptr;
}
auto out = std::make_shared<kv::detected_object_type>();
for (auto const& c : in | kvr::indirect)
{
out->set_score(stdString(c.key()), c.value().toDouble());
}
return out;
}
} // namespace core
} // namespace sealtk
| 21.190476
| 79
| 0.641573
|
BetsyMcPhail
|
69c266b24d7f83d369054b9fdb7489b66410c97b
| 2,524
|
cpp
|
C++
|
two-pointers/3-I.cpp
|
forestLoop/Learning-ITMO-Academy-Pilot-Course
|
b70ea387cb6a7c26871d99ecf7109fd8f0237c3e
|
[
"MIT"
] | 6
|
2021-07-04T08:47:48.000Z
|
2022-01-12T09:34:20.000Z
|
two-pointers/3-I.cpp
|
forestLoop/Learning-ITMO-Academy-Pilot-Course
|
b70ea387cb6a7c26871d99ecf7109fd8f0237c3e
|
[
"MIT"
] | null | null | null |
two-pointers/3-I.cpp
|
forestLoop/Learning-ITMO-Academy-Pilot-Course
|
b70ea387cb6a7c26871d99ecf7109fd8f0237c3e
|
[
"MIT"
] | 2
|
2021-11-24T12:18:58.000Z
|
2022-02-06T00:18:51.000Z
|
// I. Segment with the Required Subset
// https://codeforces.com/edu/course/2/lesson/9/3/practice/contest/307094/problem/I
#include <bitset>
#include <iostream>
#include <stack>
#include <vector>
constexpr int MAX_SUM = 1000;
constexpr int BITSET_SIZE = MAX_SUM + 1;
class KnapsackStack {
public:
KnapsackStack() {
bitsets_.push(1);
}
void Push(int value) {
values_.push(value);
const auto &last = bitsets_.top();
bitsets_.push(last | last << value);
}
int TopVal() const {
return values_.top();
}
std::bitset<BITSET_SIZE> TopBitset() const {
return bitsets_.top();
}
void Pop() {
bitsets_.pop();
values_.pop();
}
bool Empty() const {
return values_.empty();
}
private:
std::stack<int> values_{};
std::stack<std::bitset<BITSET_SIZE>> bitsets_{};
};
bool good(KnapsackStack &stack, KnapsackStack &stack_rev, const int expected_sum) {
const auto &bits1 = stack.TopBitset(), &bits2 = stack_rev.TopBitset();
for (int i = 0; i <= expected_sum; ++i) {
if (bits1[i] && bits2[expected_sum - i]) {
return true;
}
}
return false;
}
void add(KnapsackStack &stack, const int value) {
stack.Push(value);
}
void remove(KnapsackStack &stack, KnapsackStack &stack_rev) {
if (stack_rev.Empty()) {
while (!stack.Empty()) {
stack_rev.Push(stack.TopVal());
stack.Pop();
}
}
stack_rev.Pop();
}
// Time: O(NS)
// Space: O(N)
int min_good_segment(const std::vector<int> &arr, const int expected_sum) {
KnapsackStack stack, stack_rev;
const int n = arr.size();
int res = n + 1;
for (int lo = 0, hi = 0; lo < n; ++lo) {
while (hi < n && !good(stack, stack_rev, expected_sum)) {
add(stack, arr[hi++]);
}
if (hi >= n && !good(stack, stack_rev, expected_sum)) {
break;
}
// hi > lo must hold as expected_sum != 0
res = std::min(res, hi - lo);
remove(stack, stack_rev);
}
return (res > n) ? -1 : res;
}
int main() {
int n, s;
while (std::cin >> n >> s) {
std::vector<int> arr(n);
for (int i = 0; i < n; ++i) {
std::cin >> arr[i];
}
std::cout << min_good_segment(arr, s) << std::endl;
}
return 0;
}
static const auto speedup = []() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);
return 0;
}();
| 24.504854
| 83
| 0.554279
|
forestLoop
|
69c44787494404b19eca8b6232646ae83313c677
| 4,925
|
cpp
|
C++
|
Retired_Proj/4_Unmap/unmap.cpp
|
billkarsh/Alignment_Projects
|
f2ce48477da866b09a13fd33f1a53a8af644b35b
|
[
"BSD-3-Clause"
] | 11
|
2015-07-24T14:41:25.000Z
|
2022-03-19T13:27:51.000Z
|
Retired_Proj/4_Unmap/unmap.cpp
|
billkarsh/Alignment_Projects
|
f2ce48477da866b09a13fd33f1a53a8af644b35b
|
[
"BSD-3-Clause"
] | 1
|
2016-05-14T22:26:25.000Z
|
2016-05-14T22:26:25.000Z
|
Retired_Proj/4_Unmap/unmap.cpp
|
billkarsh/Alignment_Projects
|
f2ce48477da866b09a13fd33f1a53a8af644b35b
|
[
"BSD-3-Clause"
] | 18
|
2015-03-10T18:45:58.000Z
|
2021-08-16T13:56:48.000Z
|
#include "File.h"
#include "ImageIO.h"
#include "TAffine.h"
#include <string.h>
// structure for unmapping a global image
struct orig_image {
public:
char *fname;
int w,h;
int xmin, ymin, xmax, ymax; // bounding box in global image of all point that map to this
orig_image(){fname = NULL; xmin = ymin = 1000000000; xmax = ymax = -1000000000;}
orig_image(char *f){fname = f; xmin = ymin = 1000000000; xmax = ymax = -1000000000;}
};
struct one_tform {
public:
int image_id; // which image
TAffine tr; // maps from global space to individual image
};
int main(int argc, char **argv)
{
vector<char *>noa; // non-option arguments
for(int i=1; i<argc; i++) {
// process arguments here
if( argv[i][0] != '-' )
noa.push_back(argv[i]);
else
printf("Ignored option '%s'\n", argv[i]);
}
if( noa.size() < 3 ) {
printf("Usage: unmap <image file> <map file> <file-of-transforms> [<where-to-put>] \n");
exit( 42 );
}
// step 1 - read the image file
uint32 w,h;
uint16* raster = Raster16FromPng(noa[0], w, h);
printf("width is %d, height %d\n", w, h);
// step 2 - read the mapping file
uint32 wm,hm;
uint16* map = Raster16FromPng(noa[1], wm, hm);
printf("width of map is %d, height %d\n", wm, hm);
// Step 3 - read the file of images and transforms
vector<orig_image> images;
vector<one_tform> tforms(1);
FILE *fp = FileOpenOrDie( noa[2], "r" );
{
CLineScan LS;
for(;;) {
if( LS.Get( fp ) <= 0 )
break;
if(strncmp(LS.line,"IMAGE",5) == 0) {
int id;
char fname[2048];
sscanf(LS.line+5, "%d %s", &id, fname);
printf("id %3d name %s\n", id, fname);
if( id != images.size() ) {
printf("Oops - bad image sequence number %d\n", id);
return 42;
}
images.push_back(orig_image(strdup(strtok(fname," '\n"))));
}
else if(strncmp(LS.line,"TRANS",5) == 0) {
int id, image_no;
double a,b,c,d,e,f;
sscanf(LS.line+5,"%d %d %lf %lf %lf %lf %lf %lf", &id, &image_no, &a, &b, &c, &d, &e, &f);
if( id != tforms.size() ) {
printf("Oops - bad transform sequence number %d\n", id);
return 42;
}
one_tform o;
o.image_id = image_no;
o.tr = TAffine(a,b,c,d,e,f);
tforms.push_back(o);
}
else {
printf("UNknown line %s\n", LS.line);
}
}
}
fclose(fp);
// OK, find the bounding bozes for all the images
for(int y=0; y<h; y++) {
for(int x=0; x<w; x++) {
uint16 t = map[x + w*y];
if( t != 0 ) {
int im = tforms[t].image_id;
images[im].xmin = min(images[im].xmin, x);
images[im].ymin = min(images[im].ymin, y);
images[im].xmax = max(images[im].xmax, x);
images[im].ymax = max(images[im].ymax, y);
}
}
}
//Now compute each image one at a time
for(int i=0; i<images.size(); i++) {
int x0 = images[i].xmin;
int x1 = images[i].xmax;
int y0 = images[i].ymin;
int y1 = images[i].ymax;
printf("Image %d, x=[%6d %6d] y = [%6d %6d]\n", i, x0, x1, y0, y1);
uint32 w, h;
//uint8* junk = Raster8FromTif( images[i].fname, w, h );
//RasterFree(junk);
vector<uint8> recon_raster(w*h,0); // create an empty raster
printf("Original size was %d wide by %d tall\n", w, h);
for(int y=y0; y<=y1; y++) {
for(int x=x0; x<=x1; x++) {
uint16 t = map[x + wm*y];
if( t != 0 && tforms[t].image_id == i ) { // maps to image i
Point pt(x,y);
tforms[t].tr.Transform( pt );
if( x == 8557 && y == 431 ) { // just for debugging
printf("X and Y in original image: %d %d. Pixel value is %d\n", x, y, t);
printf("Image id is %d. Transformation is", tforms[t].image_id);
tforms[t].tr.TPrint();
printf("Point in image: x=%f y=%f\n", pt.x, pt.y);
}
// This should be within the image, but double check
if( pt.x > -0.5 && pt.x < w-0.5 && pt.y > -0.5 && pt.y < h-0.5 ) { // it will round to a legal value
int ix = int(pt.x+0.5);
int iy = int(pt.y+0.5);
recon_raster[ix + w*iy] = raster[x + wm*y];
}
else {
printf("X and Y in original image: %d %d. Pixel value is %d\n", x, y, t);
printf("Image id is %d. Transformation is", tforms[t].image_id);
tforms[t].tr.TPrint();
printf("Point out of image: x=%f y=%f\n", pt.x, pt.y);
//return 42;
}
}
}
}
char fname[256];
sprintf(fname,"/tmp/%d.png", i);
Raster8ToPng8(fname, &recon_raster[0], w, h);
}
return 0;
}
| 30.974843
| 116
| 0.503959
|
billkarsh
|
69cd59d6cc01fd94fd58d9248686ed83ccedd3b1
| 134,375
|
inl
|
C++
|
src/fonts/stb_font_arial_50_latin1.inl
|
stetre/moonfonts
|
5c8010c02ea62edcf42902e09478b0cd14af56ea
|
[
"MIT"
] | 3
|
2018-03-13T12:51:57.000Z
|
2021-10-11T11:32:17.000Z
|
src/fonts/stb_font_arial_50_latin1.inl
|
stetre/moonfonts
|
5c8010c02ea62edcf42902e09478b0cd14af56ea
|
[
"MIT"
] | null | null | null |
src/fonts/stb_font_arial_50_latin1.inl
|
stetre/moonfonts
|
5c8010c02ea62edcf42902e09478b0cd14af56ea
|
[
"MIT"
] | null | null | null |
// Font generated by stb_font_inl_generator.c (4/1 bpp)
//
// Following instructions show how to use the only included font, whatever it is, in
// a generic way so you can replace it with any other font by changing the include.
// To use multiple fonts, replace STB_SOMEFONT_* below with STB_FONT_arial_50_latin1_*,
// and separately install each font. Note that the CREATE function call has a
// totally different name; it's just 'stb_font_arial_50_latin1'.
//
/* // Example usage:
static stb_fontchar fontdata[STB_SOMEFONT_NUM_CHARS];
static void init(void)
{
// optionally replace both STB_SOMEFONT_BITMAP_HEIGHT with STB_SOMEFONT_BITMAP_HEIGHT_POW2
static unsigned char fontpixels[STB_SOMEFONT_BITMAP_HEIGHT][STB_SOMEFONT_BITMAP_WIDTH];
STB_SOMEFONT_CREATE(fontdata, fontpixels, STB_SOMEFONT_BITMAP_HEIGHT);
... create texture ...
// for best results rendering 1:1 pixels texels, use nearest-neighbor sampling
// if allowed to scale up, use bilerp
}
// This function positions characters on integer coordinates, and assumes 1:1 texels to pixels
// Appropriate if nearest-neighbor sampling is used
static void draw_string_integer(int x, int y, char *str) // draw with top-left point x,y
{
... use texture ...
... turn on alpha blending and gamma-correct alpha blending ...
glBegin(GL_QUADS);
while (*str) {
int char_codepoint = *str++;
stb_fontchar *cd = &fontdata[char_codepoint - STB_SOMEFONT_FIRST_CHAR];
glTexCoord2f(cd->s0, cd->t0); glVertex2i(x + cd->x0, y + cd->y0);
glTexCoord2f(cd->s1, cd->t0); glVertex2i(x + cd->x1, y + cd->y0);
glTexCoord2f(cd->s1, cd->t1); glVertex2i(x + cd->x1, y + cd->y1);
glTexCoord2f(cd->s0, cd->t1); glVertex2i(x + cd->x0, y + cd->y1);
// if bilerping, in D3D9 you'll need a half-pixel offset here for 1:1 to behave correct
x += cd->advance_int;
}
glEnd();
}
// This function positions characters on float coordinates, and doesn't require 1:1 texels to pixels
// Appropriate if bilinear filtering is used
static void draw_string_float(float x, float y, char *str) // draw with top-left point x,y
{
... use texture ...
... turn on alpha blending and gamma-correct alpha blending ...
glBegin(GL_QUADS);
while (*str) {
int char_codepoint = *str++;
stb_fontchar *cd = &fontdata[char_codepoint - STB_SOMEFONT_FIRST_CHAR];
glTexCoord2f(cd->s0f, cd->t0f); glVertex2f(x + cd->x0f, y + cd->y0f);
glTexCoord2f(cd->s1f, cd->t0f); glVertex2f(x + cd->x1f, y + cd->y0f);
glTexCoord2f(cd->s1f, cd->t1f); glVertex2f(x + cd->x1f, y + cd->y1f);
glTexCoord2f(cd->s0f, cd->t1f); glVertex2f(x + cd->x0f, y + cd->y1f);
// if bilerping, in D3D9 you'll need a half-pixel offset here for 1:1 to behave correct
x += cd->advance;
}
glEnd();
}
*/
#ifndef STB_FONTCHAR__TYPEDEF
#define STB_FONTCHAR__TYPEDEF
typedef struct
{
// coordinates if using integer positioning
float s0,t0,s1,t1;
signed short x0,y0,x1,y1;
int advance_int;
// coordinates if using floating positioning
float s0f,t0f,s1f,t1f;
float x0f,y0f,x1f,y1f;
float advance;
} stb_fontchar;
#endif
#define STB_FONT_arial_50_latin1_BITMAP_WIDTH 256
#define STB_FONT_arial_50_latin1_BITMAP_HEIGHT 580
#define STB_FONT_arial_50_latin1_BITMAP_HEIGHT_POW2 1024
#define STB_FONT_arial_50_latin1_FIRST_CHAR 32
#define STB_FONT_arial_50_latin1_NUM_CHARS 224
#define STB_FONT_arial_50_latin1_LINE_SPACING 32
static unsigned int stb__arial_50_latin1_pixels[]={
0x10266620,0x20001333,0x30000cca,0x64403333,0x8800002c,0x009acba9,
0x5dd4c000,0xccb8009a,0x54c00002,0x019abcca,0xba880000,0xacc8003c,
0x5997000a,0x98000000,0xfd800199,0x7ffdc2ff,0x5ff98004,0xffff3000,
0x01ffd80b,0xfffb5000,0x19ffffff,0x7ffd4000,0x00cfffff,0x0000fffa,
0xffffffb5,0x39ffffff,0xff900000,0xfff80dff,0x07fffff6,0x3fe7ffd0,
0x15ffffff,0xffffffff,0x3fffee07,0x7ffec005,0x027ffdc2,0x0007ff40,
0x806fffd8,0x40006ff8,0xfffffffb,0xcfffffff,0x3ff62000,0xffffffff,
0x07ffd01f,0xfffd7100,0xffffffff,0x07dfffff,0x3fff2000,0x7ffc06ff,
0x9ffffff6,0xff3ffe80,0x2bffffff,0xfffffff8,0xffff983f,0x3f6003ff,
0x7ffdc2ff,0x1ffdc004,0xffff9800,0x07ff9000,0xffffb100,0xffffffff,
0x001dffff,0x3bfffff6,0x0ffffffd,0x4003ffe8,0xfffffffc,0xfedccdef,
0x1effffff,0x3ffea000,0x7fc05fff,0xfffffb6f,0x9fff401f,0xffffffff,
0xffffff15,0xffe887ff,0x002fffdf,0xfb85fffb,0x3e6004ff,0xf90000ff,
0x7c4005ff,0x3e6001ff,0x9acfffff,0xfffca988,0x7d400eff,0x2e21bfff,
0xfe86fffe,0xffd1003f,0x0015bfff,0xfffffd71,0x3ff20007,0x3ffe003f,
0x1fffe446,0x3fe7ffd0,0x209999ff,0xfffb9999,0xe9fffec3,0x98800fff,
0x4ccc4099,0x0fffa000,0x27ffc400,0x037fdc00,0xcfffff88,0xfffc8800,
0x3ff600ef,0x3ffe603f,0x01fff41f,0x67ffff44,0x3f660000,0xe8005fff,
0x664006ff,0x6fff883c,0x7fcfffa0,0x7fd4007f,0x97ffee3f,0x0006fff9,
0x3fea0000,0x3ff20007,0x3ffe0005,0xffffd802,0xfffc8002,0x3fffe03f,
0x1fffe400,0xf300fffa,0x0001bfff,0x1ffffdc0,0x09fff100,0xfffb0000,
0xff9fff40,0x7fd4007f,0x1ffff33f,0x005fffc8,0xffd00000,0x00000009,
0xb80dff90,0x0002ffff,0xf81ffff6,0xffa806ff,0x01fff46f,0x007ffff3,
0x3ffa2000,0xfff1002f,0xf9000007,0x9fff40ff,0x54007fff,0x00003fff,
0x4c000000,0x00001fff,0xfff98000,0x13fffe01,0xffff1000,0x07fffa05,
0xfd033510,0x7fff407f,0x44000002,0x8800fffe,0x00003fff,0xd00fffc8,
0x1fffe7ff,0x07fff500,0x0cccc000,0x81999800,0x4cc06ffd,0x33300019,
0x82fffc03,0x000ffffa,0x05fffd80,0x001bfff9,0xb81fff40,0xa8802fff,
0xf98001cc,0xff9805ff,0x4ccc003f,0x01fff900,0x7ffcfffa,0x7ffd4007,
0x0bfffa03,0x003ffff0,0x445fff98,0x7fc04fff,0x7cc001ff,0x3ff205ff,
0x5fffd80f,0x15930000,0x77fffc40,0x7ffd0000,0x809fff10,0xffffffd9,
0x07fff60d,0x9801fff7,0x7c003fff,0xfff906ff,0x7cfffa01,0x7d4007ff,
0x3ffa03ff,0x7ffe402f,0x7ffe4004,0x00fffe42,0x0013fff2,0x4c05fff9,
0x7fc44fff,0x000003ff,0xfffffa80,0x3ffe8002,0x5c06ffd8,0xffffffff,
0x0fffd0ef,0xf300fffe,0xff8005ff,0x1fff706f,0x7fcfffa0,0x7fd4007f,
0x3fffa03f,0x37ffcc02,0x21fffe00,0xf9806ffe,0x7fc006ff,0x6fff807f,
0x00ffffd4,0xfc800000,0x000dffff,0xff30fffa,0x7ffe403f,0xfffeceff,
0x706fff8e,0xff980fff,0x7ffc002f,0x03fff706,0x7ffcfffa,0x7ffd4007,
0x0bfffa03,0x007fffa0,0x2227ffcc,0xfd004fff,0x3e6003ff,0xffd804ff,
0x3fffee0f,0x40000000,0xffffffd9,0xffd002ff,0x205ffd87,0x40bffffc,
0xffffffe8,0x03fff104,0x0017ffcc,0x7d41bffe,0x7ffd01ff,0x5001fffe,
0x7f407fff,0xffb802ff,0xfff9004f,0x03fffa83,0x009fff70,0x2007fff2,
0x3ee2fffc,0x000007ff,0x5ffffcc0,0x0dfffffe,0x3e1fff40,0xfff302ff,
0xfffe807f,0x3ffa02ff,0x07ffea02,0x20dfff00,0xfd01fffa,0x01fffe7f,
0x407fff50,0x8802fffe,0xf8807fff,0xfffc86ff,0xffff1002,0x0dfff100,
0xc93ffee0,0x00006fff,0x3bffe200,0x3fffff20,0x8fffa03f,0x3fa07ffa,
0xff9803ff,0x3f600fff,0x3ffee03f,0x37ffc001,0xd02fff98,0x1fffe7ff,
0x07fff500,0x8017fff4,0x5402fffd,0xffe83fff,0x3ff6002f,0x7ffd402f,
0xdfff5003,0x0027ffec,0xfff50000,0xffffd301,0x7ffd01df,0xfb827fe4,
0x3fa006ff,0x7fe407ff,0x01bff604,0xf81bffe0,0x7ffd04ff,0x5001fffe,
0x7f407fff,0xff5002ff,0xfffd80bf,0x01ffff80,0x017ffea0,0x2001fffb,
0x3f67fff9,0x000004ff,0x7013ff60,0x81ffffff,0x3ffe2ccb,0x05fffd01,
0x02fffec0,0x7cc17fee,0xff8003ff,0x3fff606f,0xff3ffe81,0xffa800ff,
0x3fffa03f,0x3fffe002,0x0bfff100,0x0003fffe,0x2201ffff,0x22005fff,
0x3ff27fff,0x0000005f,0x3005fff1,0x01dffffd,0xa80fff88,0x64006fff,
0x7e403fff,0xfffe883f,0x6fff8000,0x037ffe60,0x3ffe7ffd,0x7ffd4007,
0x0bfffa03,0x02fffc80,0xf105fff7,0xf9000fff,0x3fee05ff,0x7ffc002f,
0x0dfff70f,0x3e200000,0x3f2005ff,0x7cc05fff,0x7fffb07f,0x2fffc800,
0xb517fec0,0x0007ffff,0xf701bffe,0x3fa5bfff,0x00ffff3f,0x203fffa8,
0x2002fffe,0xfd05fff9,0x3ffe60ff,0xfff98006,0x00fffd05,0x2a3fffd0,
0x00006fff,0x03fffa00,0x1ffffb80,0x741bfea0,0x74001fff,0x7f400fff,
0x3bfff60f,0x3ffe0001,0xffffa806,0x3fe7ffd4,0x7fd4007f,0x3fffa03f,
0x7fff4002,0x827ffcc0,0x0005fff9,0xf981fffd,0xfd8004ff,0xffff31ff,
0x00400001,0x800bfff9,0x2e03fffd,0xffff05ff,0x6fff8001,0x363ffcc0,
0x40001fff,0xf5006fff,0x4fffa9ff,0x54007fff,0x3fa03fff,0x7dc002ff,
0x7ffe43ff,0x0dfff101,0x0fffee00,0x0003fff9,0x7fc1fffd,0x200002ff,
0x3e20bdff,0x5000efff,0x7dc0bfff,0x7fff885f,0x2fffcc00,0xfb17ff20,
0x40009fff,0xfa806fff,0x7ffd4fff,0x5001fffe,0x7f407fff,0x7c4002ff,
0x37ffc6ff,0x00dfff10,0xf1bffe20,0x3a000dff,0x3ff20fff,0xf300004f,
0xffa83fff,0xff003fff,0x2ffdc0bf,0x0037ffc4,0x880fffee,0x7e4c3fff,
0xf0004fff,0xffc80dff,0x7ffd1cef,0x5001fffe,0x7f407fff,0xfd8002ff,
0x7fff30ff,0x007fff80,0x4c3fff60,0xf0003fff,0xfffa8fff,0xfc80000f,
0xfff906ff,0x7cc01bff,0x3fea03ff,0x00ffff06,0x00ffffc4,0xfd80dff9,
0xff8001ff,0x3ffe606f,0xff3ffe85,0xffa800ff,0x3fffa03f,0xfffa8002,
0x801fff93,0x20007ffe,0xff93fffa,0x3fe0001f,0x5ffff86f,0x7ffc4000,
0x3ffea03f,0xff903fff,0x4cbbb63f,0xfffb07ff,0x3fffe400,0x803fff30,
0x8004fff9,0x3f206fff,0x3ffe80ff,0xa800ffff,0x3fa03fff,0xff0002ff,
0x017ffadf,0x0003fffa,0xffd6fff8,0x3fe2000b,0xffffa85f,0xffd10002,
0xfe8801ff,0x321effff,0x3ffa4fff,0x701fff33,0xf1005fff,0x3e60dfff,
0xff9004ff,0xdfff000f,0xe827ffc0,0x0ffff3ff,0x03fffa80,0x000bfffa,
0x7fcfffe4,0xfffc802f,0x3ff20002,0x002fff9f,0x209fff50,0x003ffffe,
0x04ffffd8,0x3ffffee0,0x44fffdcf,0xfff13ffe,0x0dfff503,0x4ffffe88,
0x00ffff98,0x003fff70,0xf306fff8,0x3ffa05ff,0x800ffff3,0x3a03fffa,
0x30002fff,0x1fffdfff,0x09fff500,0x77ffcc00,0x90000fff,0x3e605fff,
0x800cffff,0x05ffffea,0xffffd880,0xfe81efff,0x217ff63f,0x304ffff8,
0x8bffffff,0x002ffffb,0x0007ffea,0x3ea0dfff,0x7ffd01ff,0x5001fffe,
0x7f407fff,0x3a0002ff,0x004fffff,0x0001bffe,0x09fffffd,0x03fff400,
0x3fffffea,0xdba989ad,0x006fffff,0x7ffffd40,0x47ffd01f,0xf980fffb,
0xdb9adfff,0xffffefff,0x1fffffdd,0x17ffcc00,0x41bffe00,0xfd01fffb,
0x01fffe7f,0x407fff50,0x0002fffe,0x07ffffee,0x007ffd80,0x7ffffdc0,
0x3ffe0001,0xffff9805,0xffffffff,0x00efffff,0xfffd8800,0x3ffe81ff,
0x540fffe2,0xffffffff,0xffffa9ef,0x00efffff,0x02fff980,0xb837ffc0,
0xffd01fff,0x001fffe7,0x7407fff5,0x20002fff,0x006ffff8,0x000fffdc,
0x0dffff10,0x17ffcc00,0xffffd880,0xffffffff,0x800003ff,0x40effffb,
0x7fec3ffe,0x3fffee06,0xfd10dfff,0x0bffffff,0x1fffcc00,0x41bffe00,
0xfd00fffb,0x01fffe7f,0x407fff50,0x0002fffe,0x001fffec,0x0013ffe2,
0x007fffb0,0x007ffe40,0x3ffff220,0x0cffffff,0x3e600000,0x7ff44fff,
0x02fffcc3,0x037dfb51,0x159dfdb1,0x406aaa20,0x4003fff9,0xff706fff,
0x4fffa01f,0x54007fff,0x3fa03fff,0x640002ff,0xd8000fff,0x640007ff,
0x20000fff,0x40004fff,0x01acffd8,0x7d400000,0x1fff46ff,0x0027ffe4,
0x7f440000,0xfff301ff,0x6fff8007,0x201fff70,0xffff3ffe,0x3fffa800,
0x00bfffa0,0x00bfff00,0x00bffe60,0x005fff80,0x003ffea0,0x001ffa00,
0x00ff65c0,0x3a0fffe8,0xfff883ff,0x0000002f,0x813fffa2,0x2003fff8,
0xf706fff8,0x3ffa01ff,0x800ffff3,0x3a03fffa,0x20002fff,0x0002fffa,
0x40017ff6,0x0002fffa,0x00017ff6,0x02fbffe2,0x4fffc800,0x43fffb00,
0xff303ffe,0x000019ff,0x5fffe980,0x01fffc40,0x20bfff10,0xfd00fffc,
0x01fffe7f,0x407fff50,0x0002fffe,0x0001bffa,0x0001fff3,0x4000dffd,
0x0001fff8,0x6fffcb88,0x3ffe6000,0x7ffc400e,0x301fff47,0x005fffff,
0xfff91000,0x3ffe00bf,0x3ffe6004,0x40fffb05,0xffff3ffe,0x3fffa800,
0x00bfffa0,0x01fffe40,0x027fec00,0x00ffff20,0x005ffc80,0x2fff8800,
0x3fffe000,0x27ffe405,0xf300fffa,0x015bffff,0xfffb9800,0x3fe004ff,
0xff7000ff,0x17ffe09f,0xfff3ffe8,0xfffa800f,0x0bfffa03,0x3fb2b2e0,
0x80000fff,0x9700fff8,0x1ffffd95,0x3ffe2000,0xfa800000,0x2a0003ff,
0x4c1dffff,0x742ffffd,0xfd8803ff,0x9befffff,0x3ae66201,0x02ffffff,
0x0e7ffe40,0x7ff5c4c4,0x3ff6622f,0x4fffa03f,0xaaaaffff,0x3f2aaaa1,
0x3ffa03ff,0xfffb802f,0x0001ffff,0x5c17fee0,0x1fffffff,0x0fff6000,
0x3732a000,0x001fffff,0x7ffffe40,0xffffffff,0x003ffe83,0x3fffffaa,
0xfeefffff,0xffffffff,0x88000cff,0x26ffffff,0x7ffffffb,0x3ffffffe,
0x7cfffa00,0x5fffffff,0xfffffff1,0x7fff407f,0xffffa802,0x800002ff,
0xffa81ffe,0x0002ffff,0x0001bfe6,0x7fffffec,0xf900003f,0xffffffff,
0x3ffa05ff,0xffda8003,0xffffffff,0xffffffff,0x640000cf,0x366fffff,
0x22ffffff,0x03ffffff,0xfff9fff4,0xf15fffff,0x7fffffff,0x017fff40,
0x1f7fffcc,0xff880000,0xeffff985,0x7fec0003,0xffb00000,0x0003bfff,
0xffffc880,0x3a01ceff,0x220003ff,0xfffffeca,0xbeffffff,0x7d400001,
0x3ffe6fff,0x7ffc2fff,0xffe802ef,0xddddddb3,0x3bbba29d,0x0002eeee,
0x000a9880,0x02a98000,0x00001531,0x000006aa,0x00000062,0x2001a988,
0x00001aaa,0x4d554ccc,0x00000019,0x54c45533,0x0355500a,0x000d5540,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00066660,0x00000000,0x98000000,
0x00001999,0x33330000,0x10000001,0x00001333,0x02666620,0x31000000,
0x00001333,0x99988000,0x7ffe4000,0x0000003f,0x5c40077a,0xffffffec,
0xffffffff,0x7fec000f,0x000002ff,0x7fffe400,0x4c000002,0x0006ffff,
0xfffff100,0xf8000000,0xf000efff,0x40000dff,0x2005fffd,0x2ffffffa,
0xf8800000,0x7fe4403f,0xffffffff,0xffffffff,0xffe8000f,0x0000006f,
0x13fffe20,0xff100000,0x000bffff,0x3fffe600,0x70000003,0x4003ffff,
0x00006fff,0x4017fff6,0xffdefff9,0x4000000f,0x3e600ffb,0xffffffff,
0xffffffff,0x8000ffff,0x002ffff8,0xff700000,0x000000bf,0xfff9fffb,
0x2a000007,0x00007fff,0x07fffd00,0x006fff80,0x17fff600,0x27fffa20,
0x000efff8,0x81bf6000,0xfffffff8,0xeeeeefff,0x0eeeffff,0xbfff3000,
0x20000000,0x0000ffff,0xa7ffe400,0x0001fffd,0x07fff900,0xffa80000,
0xfff8004f,0x3f600006,0xffd805ff,0x17ffee4f,0x4ff80000,0x3fffff60,
0xc83fffff,0x200007ff,0x0001fffa,0x7ffdc000,0x54000001,0x3fe26fff,
0x000000ff,0x0000dffb,0x006ffe80,0x000dfff0,0x004ccc40,0x3a1bffee,
0x00003fff,0xf301ff98,0xffffffff,0xfff907ff,0xffc80000,0x40000005,
0x00003fff,0x0ffffc40,0x001bffee,0x17ff4400,0xffa80000,0xfff0000f,
0x0000000d,0x00000000,0x7dc0ff90,0xffffffff,0x7ffc83ff,0x00000000,
0x00000000,0x00000000,0x00000000,0xf8000000,0x000006ff,0x00000000,
0x205fe800,0xfffffffd,0xfc83ffff,0x2600007f,0x0009abca,0x79530000,
0x00000135,0x26af2a60,0x00000000,0x00000000,0x0037ffc0,0xfb826200,
0xb80005ff,0xb9805fff,0x02ffccdc,0x3ffffffa,0xc83fffff,0x2e0007ff,
0xffffffed,0x00002dff,0x7ffff6dc,0x002dffff,0x7ff6dc00,0x2dffffff,
0x17ffee00,0x3ffee000,0x00bfff75,0x4bfff700,0x65446fff,0xfd000acd,
0x02fffdcb,0x2fffdc00,0xfffffb50,0x7f40bfff,0xffffffff,0x7ffc83ff,
0xfffe9800,0xffffffff,0x40003eff,0xffffffe9,0xefffffff,0x7f4c0003,
0xffffffff,0x803effff,0x0005fffb,0xf75fffb8,0x70000bff,0x7ffcbfff,
0xfffffd16,0xfe8019ff,0x017ffee6,0x17ffee00,0x7fffffe4,0x80efffff,
0xfffffffd,0xfc83ffff,0x7fdc007f,0xffffffff,0x4fffffff,0xffff7000,
0xffffffff,0x009fffff,0x3ffffee0,0xffffffff,0x5c04ffff,0x80005fff,
0xff75fffb,0xf70000bf,0x77ffcbff,0xfffffff9,0x3e01ffff,0x17ffee7f,
0x3ffee000,0xfffffd85,0xfffffbbd,0x7fffe42f,0x3fffffff,0x1007ffc8,
0x9dfffffb,0x3faea635,0x000effff,0xdfffffb1,0x3aea6359,0x00efffff,
0xfffffb10,0x2ea6359d,0x0efffffe,0x00bfff70,0x2bfff700,0x0005fffb,
0x3e5fffb8,0xdfffffff,0xfffffdbb,0x7dcfff02,0xb80005ff,0x7fdc5fff,
0x3fea0bff,0x7d46fffe,0xffffffff,0x7ffc83ff,0xfffffd00,0x3ffaa005,
0xffd006ff,0x2a005fff,0x006ffffe,0x05fffffd,0x3ffffaa0,0x0bfff706,
0xbfff7000,0x0017ffee,0xf97ffee0,0x80dfffff,0x40ffffe8,0x3fee7ff8,
0xfb80005f,0x3ffe25ff,0xe8ffc84f,0x7ff41fff,0xffffffff,0x807ffc83,
0x00dffffb,0x4ffffd80,0x6ffffdc0,0xfffd8000,0x7ffdc04f,0xfd8000df,
0xffb84fff,0xfb80005f,0xbfff75ff,0xfff70000,0x27ffffcb,0x13fffa20,
0x3ee1fff1,0xb80005ff,0x3ff25fff,0x269ff06f,0x7fcc5fff,0xffffffff,
0x407ffc83,0x004ffff8,0x0ffffe40,0x04ffff88,0x7fffe400,0x9ffff101,
0xfffc8000,0x2fffdc1f,0x7ffdc000,0x00bfff75,0x4bfff700,0x800fffff,
0x7cc7fff9,0xbfff71ff,0xfff70000,0x40ffff4b,0x3bfa2ff9,0xfffffb85,
0xfc83ffff,0x7ffec07f,0xffd00006,0x3fff60df,0xffd00006,0x3fff60df,
0xffd00006,0x5fffb8df,0xfffb8000,0x00bfff75,0x4bfff700,0x2003ffff,
0x3e61fffd,0xbfff71ff,0xfff70000,0x41fffe6b,0x20020ffb,0xffffffe8,
0x07ffc83f,0x00bfffe6,0x7fffd400,0x17fffcc1,0xfffa8000,0x7fffcc1f,
0xff500002,0x7ffdc3ff,0xffb80005,0x0bfff75f,0xbfff7000,0x0007fffc,
0x7d45fff5,0xbfff72ff,0xfff70000,0x41bffeab,0x2a0006fd,0x83ffffdc,
0x3f607ffc,0x400005ff,0x7ec4fffe,0x400005ff,0x7ec4fffe,0x400005ff,
0x3ee4fffe,0xb80005ff,0xfff75fff,0xff70000b,0x037ffcbf,0xa93ffe60,
0xfff72fff,0xff70000b,0x13ffeebf,0x0000ffe2,0x641fffc4,0x3ffe07ff,
0x5c00002f,0x7ffc7fff,0x5c00002f,0x7ffc7fff,0x5c00002f,0x3fee7fff,
0xfb80005f,0xbfff75ff,0xfff70000,0x002fffcb,0xfb97ffe2,0xbfff73ff,
0xfff70000,0x20ffff2b,0x00001ffa,0xf907fff1,0x3ffe20ff,0x4400000f,
0xff11ffff,0x800001ff,0xf11ffff8,0x00001fff,0x71ffff88,0x0000bfff,
0x3eebfff7,0xb80005ff,0x3ffe5fff,0x7fff8004,0x7dcfffee,0xb80005ff,
0xfff95fff,0x000ff905,0x41fffc40,0xff307ffc,0x200000ff,0xff33fffe,
0x200000ff,0xff33fffe,0x200000ff,0xff73fffe,0xf70000bf,0x3ffeebff,
0xffb80005,0x00fffe5f,0xfc9fffe0,0xbfff74ff,0xfff70000,0x20ffff2b,
0x200004ff,0xfc83fff8,0xffff507f,0x3f600000,0xffff53ff,0x3f600000,
0xffff53ff,0x3f600000,0xbfff73ff,0xfff70000,0x017ffeeb,0x97ffee00,
0xf8004fff,0x3fff27ff,0x00bfff75,0x2bfff700,0x7cc5fffb,0x2200002f,
0xffc83fff,0x0dfff707,0x3ff60000,0x0dfff74f,0x3ff60000,0x0dfff74f,
0x3ff60000,0x0bfff74f,0xbfff7000,0x0017ffee,0xf97ffee0,0x7c4005ff,
0x3fff66ff,0x00bfff75,0x2bfff700,0x7dc6fffa,0x019a880f,0x20fffe20,
0xff907ffc,0x2000009f,0xff95fffc,0x2000009f,0xff95fffc,0x2000009f,
0xff75fffc,0xf70000bf,0x3ffeebff,0xffb80005,0x01bffe5f,0x6cbfff30,
0xfff76fff,0xff70000b,0x1fffe6bf,0x3ff20bfd,0xfff1002f,0x20fff907,
0x0004fffd,0x2bfff900,0x0004fffd,0x2bfff900,0x0004fffd,0x2bfff900,
0x0005fffb,0xf75fffb8,0x70000bff,0x7ffcbfff,0x7ffdc007,0x5dbfffa3,
0x80005fff,0x3fa5fffb,0x07ff11ff,0x4003fffa,0xfc83fff8,0xbfffb07f,
0x3f600000,0xbfffb4ff,0x3f600000,0xbfffb4ff,0x3f600000,0xbfff74ff,
0xfff70000,0x017ffeeb,0x97ffee00,0x2003ffff,0x3fe0ffff,0xbfff77ff,
0xfff70000,0x477ffdcb,0xffa81ffa,0x3fe2005f,0x07ffc83f,0x000dfff9,
0x4ffffa00,0x0006fffc,0x27fffd00,0x0006fffc,0x27fffd00,0x0005fffb,
0xf75fffb8,0x70000bff,0x7ffcbfff,0xfff7007f,0x57ffff8d,0x0000dfff,
0x7c49fff9,0x87fccfff,0x002ffff8,0x320fffe2,0xfff707ff,0x3e00000f,
0xfff73fff,0x3e00000f,0xfff73fff,0x3e00000f,0xfff53fff,0xff90000d,
0x1bffea9f,0x3fff2000,0x17ffffe4,0x83ffff50,0xff57ffff,0xfb0000df,
0xfffa89ff,0x7fd44fff,0x7c4004ff,0x7ffc83ff,0x01ffff50,0xfff88000,
0x1ffff52f,0xff880000,0xffff52ff,0xf8800001,0xfff52fff,0xffb0000d,
0x1bffea9f,0x3fff6000,0x3fffffe4,0x7ffdc41e,0x7ffff84f,0x000dfff3,
0x907fffd0,0xb9dfffff,0x00bfffff,0x907fff10,0x7ffc0fff,0x5400001f,
0x7ffc7fff,0x5400001f,0x7ffc7fff,0x5400001f,0x3fe67fff,0xfe80006f,
0xdfff33ff,0xfffd0000,0x7fffffc7,0xfffeefff,0xfff80dff,0x0ffff37f,
0x7fffd000,0x3ffffee0,0x0dffffff,0x3fff8800,0x3207ffc8,0x00006fff,
0x3227fff4,0x00006fff,0x3227fff4,0x00006fff,0xf327fff4,0xd0000fff,
0x3fe67fff,0xfe80007f,0x3bffe3ff,0xffffffe8,0x3fe04fff,0x3fffe7ff,
0x7ffc0001,0x3ffe601f,0x01efffff,0x0fffe200,0xfa81fff2,0x00002fff,
0xa83ffff7,0x0002ffff,0x83ffff70,0x002ffffa,0x3ffff700,0x001ffff8,
0xf0ffffc0,0x80003fff,0x3fe1ffff,0x3ffff26f,0x76c01dff,0x3fff65ee,
0x3fee0003,0x67fcc07f,0x0000abca,0xc83fff88,0x7ff407ff,0x440000ff,
0xfd06ffff,0x80001fff,0xd06ffff8,0x0001ffff,0x86ffff88,0x0003fffd,
0xfb1fffee,0x5c0007ff,0x7ffc7fff,0x00aba986,0xffffb800,0xffff0000,
0x01ffb80b,0xfff10000,0x80fff907,0x004ffff9,0x0ffffec0,0x04ffff98,
0x7fffec00,0x9ffff301,0xfffd8000,0xffffb81f,0xffff0000,0x0ffffb8b,
0xbffff000,0x0006fff8,0xffff3000,0xfff7000b,0x06fe805f,0x3fe20000,
0x07ffc83f,0x0dffffc8,0x7fff4400,0x7ffe404f,0x744000df,0x6404ffff,
0x000dffff,0x27ffff44,0x05ffff98,0x2ffffb80,0x02ffffcc,0x17fffdc0,
0x0001bffe,0x643ffff8,0x801effff,0x06ffffe9,0x00027fc4,0x07fff100,
0x3a00fff9,0x002fffff,0x0dfffff5,0x3fffffa0,0xffff5002,0x3ffa00df,
0xf5002fff,0xc80dffff,0x801effff,0x06ffffe9,0x03dffff9,0xdffffd30,
0x000dfff0,0x21ffffc0,0xfffffff8,0xfecbaace,0x401fffff,0x00001ffa,
0x20fffe20,0xb1007ffc,0x79dfffff,0xffd97313,0x2001dfff,0xefffffd8,
0xecb989bc,0x00efffff,0xfffffb10,0x9731379d,0x1dfffffd,0xfffff880,
0xcbaaceff,0x1ffffffe,0xffffff10,0xd97559df,0x03ffffff,0x0000dfff,
0x4c1ffffc,0xfffffffe,0xffffffff,0x7fc801ff,0x7c400000,0x7ffc83ff,
0x7fffe400,0xffffffff,0x004fffff,0xffffff90,0xffffffff,0x20009fff,
0xfffffffc,0xffffffff,0x3a6004ff,0xffffffff,0xffffffff,0x7ff4c01f,
0xffffffff,0x1fffffff,0x000dfff0,0x81ffffc0,0xffffffd8,0xffffffff,
0x0bff000e,0xff880000,0x07ffc83f,0xffffea80,0xffffffff,0x540002ef,
0xfffffffe,0x2effffff,0x7ff54000,0xffffffff,0x8002efff,0xffffffd8,
0xffffffff,0xffb1000e,0xffffffff,0x401dffff,0x00006fff,0x3006eeee,
0xfffffff9,0x40039fff,0x00002ff9,0x41fffc40,0x20007ffc,0xffffffd9,
0x0001cfff,0x7fffecc0,0x01cfffff,0x7fecc000,0xcfffffff,0xfc980001,
0xffffffff,0x930001cf,0xffffffff,0xff0039ff,0x000000df,0x2eea6600,
0x8800099a,0x000000eb,0x5c177744,0x300006ee,0x00335953,0x2a660000,
0x000019ac,0x35953300,0x4c000003,0x099abba9,0x2a660000,0x00099abb,
0x00017bba,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x4ccc0000,0x00000019,
0x00999988,0x99980000,0x80000009,0x00009998,0x13333100,0x30000000,
0x00003333,0x00266620,0x01333310,0x3f6a0000,0x2ffcc0ce,0x7fec0000,
0x000002ff,0x1bfffe20,0x3f200000,0x00002fff,0x77fffcc0,0xf8800000,
0x00006fff,0x7fffcc00,0xf9800005,0x54006fff,0xfe85ffff,0x7e4002ff,
0x9bdfffff,0x00004ffd,0x00dfffd0,0x7fe40000,0x000000ff,0x027fffc4,
0x3fa20000,0x0005ffff,0x5ffff500,0x6c000000,0x0000efff,0x7ffffc40,
0x7fdc005f,0x7fff41ff,0x3ffe6002,0xffffffff,0x000001ff,0x003ffff1,
0xfff10000,0x0000003f,0x000dfff7,0x9fffb000,0x00007fff,0x01bffee0,
0x7fcc0000,0x800000ff,0xfffcfffd,0x7ffe4003,0x017fff45,0x9319ff90,
0x09ffffff,0xff980000,0x8000005f,0x0003fffb,0x1ffff000,0xfb800000,
0x5fffb5ff,0x3f200000,0x000002ff,0x002fffd8,0x4fffc800,0x8003fffb,
0x3fa0fffe,0x3f6002ff,0x2dedb81f,0xf5000000,0x000003ff,0x0005fff8,
0x3fff7000,0xf9800000,0xfff10fff,0x2000003f,0x00006ffe,0x027ffc40,
0x7ffd4000,0x1ffff10e,0x27ff4400,0x0005fffd,0x00000000,0x0017ff20,
0x0effb800,0xfd000000,0x8000007f,0x542ffff8,0x0000efff,0x02ffe880,
0x3ff20000,0xf8800005,0x7fdc1fff,0x7fcc006f,0x05fffd0f,0xabca9800,
0x00000009,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x17fff400,0x3ffb6e00,0x2dffffff,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x2005fffd,
0xffffffe9,0xefffffff,0xff000003,0x5c000fff,0xffffffff,0xffffffff,
0x05ffffff,0x3ffffc00,0x3e000000,0x20007fff,0xfffffffb,0xffffffff,
0x5fffffff,0x013fffee,0xffffd800,0xffffff70,0xffffffff,0xffffffff,
0x8bfffa0b,0xb802fffe,0xffffffff,0xffffffff,0x5400004f,0x002fffff,
0xffffff70,0xffffffff,0xffffffff,0x7fd4000b,0x00002fff,0xfffff500,
0x3fee0005,0xffffffff,0xffffffff,0x7f45ffff,0x80001fff,0x2e3ffffb,
0xffffffff,0xffffffff,0x05ffffff,0x7f45fffd,0x3f6202ff,0x1aceffff,
0xffffd753,0x200001df,0x06fffffd,0xfffff700,0xffffffff,0xffffffff,
0x7ec000bf,0x0006ffff,0xffffb000,0x3ee000df,0xffffffff,0xffffffff,
0x4c5fffff,0x0006ffff,0x22ffffc4,0xfffffffb,0xffffffff,0x5fffffff,
0x745fffd0,0x3fa02fff,0x5002ffff,0x00dffffd,0xfdfff100,0xf70003ff,
0xdddddfff,0xdddddddd,0x009ddddd,0x3fbffe20,0x000001ff,0x7ff7ffc4,
0xffb8001f,0xeeeeeeff,0xeeeeeeee,0xfb84eeee,0x20004fff,0x5c0ffffd,
0xeeeeffff,0xeeeeeeee,0x04eeeeee,0x7f45fffd,0xfff702ff,0xfb0001bf,
0x80009fff,0xfff9fffb,0xfffb8004,0x00000005,0xff9fffb8,0x4000004f,
0xfff9fffb,0xfffb8004,0xe8000005,0x8001ffff,0xb82ffffa,0x00005fff,
0x22fffe80,0xf882fffe,0x40004fff,0x001ffffc,0x7f5bffa0,0x7dc000ff,
0x000005ff,0xd6ffe800,0x00001fff,0xfeb7ff40,0x7dc000ff,0x000005ff,
0x06ffff98,0x2ffffc40,0x005fffb8,0xfffe8000,0x20bfffa2,0x0006fffd,
0x00dfffd0,0x64fffe60,0x5c003fff,0x00005fff,0x7ffcc000,0x007fff93,
0x3ffe6000,0x007fff93,0x005fffb8,0xfff70000,0x7fec007f,0xfff700ef,
0xd000000b,0x7ff45fff,0x7fffcc2f,0xff500002,0xf90003ff,0x3ffe63ff,
0x7ffdc006,0x00000005,0xf98fffe4,0x000006ff,0x3e63fff9,0x7dc006ff,
0x000005ff,0x07ffffa0,0x07fffea0,0x005fffb8,0xfffe8000,0xb0bfffa2,
0x0000bfff,0x004fffe8,0x7f47fff8,0x3ee001ff,0x000005ff,0x23fffc00,
0x0001fffe,0x747fff80,0x2e001fff,0x00005fff,0x3fffe600,0x7fffc406,
0x2fffdc04,0x7f400000,0x3fffa2ff,0x017fffc2,0x3ffee000,0x7ffd4007,
0x027ffdc4,0x00bfff70,0x7d400000,0x7ffdc4ff,0x7d400004,0x7ffdc4ff,
0x3ffee004,0x40000005,0x203ffffb,0xb806fffd,0x00005fff,0x22fffe80,
0x3e22fffe,0x00000fff,0x00ffffc4,0x883fffb0,0x7000ffff,0x0000bfff,
0x7ffec000,0x07fffc41,0xfffb0000,0x0ffff883,0x0bfff700,0xfd000000,
0xff501fff,0xff7003ff,0x000000bf,0x7f45fffd,0x3ffe62ff,0xfd000007,
0x3e2007ff,0xfffb06ff,0x3ffee007,0x00000005,0x360dfff1,0x00003fff,
0x360dfff1,0xf7003fff,0x00000bff,0xbffff300,0x009fffd0,0x0017ffee,
0x3fffa000,0xa8bfffa2,0x00007fff,0x007fffb0,0x5413ffee,0xf7006fff,
0x00000bff,0x13ffee00,0x0037ffd4,0x04fffb80,0x200dfff5,0x0005fffb,
0xfff70000,0x37ffe45f,0x0bfff700,0xffd00000,0x17fff45f,0x000dfff7,
0x13fff600,0x00ffff40,0x7003ffff,0x5555dfff,0x55555555,0x00355555,
0x201fffe8,0x0001ffff,0x201fffe8,0xb801ffff,0xaaaaefff,0xaaaaaaaa,
0x001aaaaa,0xf36fffe8,0x5c003fff,0xaaaaefff,0xaaaaaaaa,0x201aaaaa,
0x3fa2fffe,0x3fff22ff,0xf9000004,0xff300bff,0xfffc80df,0xffffb805,
0xffffffff,0xffffffff,0x3fe6003f,0x7ffe406f,0x7fcc0005,0x7ffe406f,
0xffffb805,0xffffffff,0xffffffff,0xff98003f,0x3fffdbff,0x7fffdc00,
0xffffffff,0xffffffff,0x3fffa03f,0xd8bfffa2,0x00004fff,0x00bfff90,
0x9807fff9,0x5c00ffff,0xffffffff,0xffffffff,0x003fffff,0x300ffff2,
0x0001ffff,0x201fffe4,0x400ffff9,0xfffffffb,0xffffffff,0x03ffffff,
0xfffff700,0xf7000bff,0xffffffff,0xffffffff,0x7407ffff,0x3ffa2fff,
0x17fff62f,0x7fec0000,0x7ffc404f,0xfffe800f,0x7fffdc03,0xffffffff,
0xffffffff,0xfff1003f,0xfffd001f,0x3fe20007,0xffe800ff,0x7ffdc03f,
0xffffffff,0xffffffff,0x3a0003ff,0x00ffffff,0xfffffb80,0xffffffff,
0xffffffff,0x8bfffa03,0x3f22fffe,0x000006ff,0xb807fffd,0xf7005fff,
0xffb80dff,0xaaaaaaef,0xaaaaaaaa,0xf7001aaa,0x3ee00bff,0xf70006ff,
0x3ee00bff,0x7fdc06ff,0xaaaaaaef,0xaaaaaaaa,0x20001aaa,0x02fffff9,
0x5dfff700,0x55555555,0x55555555,0x17fff403,0x7dc5fffd,0x000007ff,
0xe807ffff,0x9999bfff,0xff999999,0x3fee02ff,0x0000005f,0x4cdffff4,
0x99999999,0x8002ffff,0x999bfffe,0xf9999999,0x3ee02fff,0x000005ff,
0xdfff9000,0x7ffdc000,0xe8000005,0x3ffa2fff,0x3fffea2f,0x7c400000,
0x3e602fff,0xffffffff,0xffffffff,0x3fee05ff,0x0000005f,0x3fffffe6,
0xffffffff,0x005fffff,0x7fffffcc,0xffffffff,0x205fffff,0x0005fffb,
0xff700000,0x7dc000bf,0x000005ff,0x3a2fffe8,0x7ffc2fff,0x5400001f,
0x7e407fff,0xffffffff,0xffffffff,0xff700fff,0x000000bf,0x7fffffe4,
0xffffffff,0x00ffffff,0x3fffff20,0xffffffff,0x0fffffff,0x00bfff70,
0x2e000000,0x20005fff,0x0005fffb,0x2fffe800,0xf90bfffa,0x80000dff,
0x7c04fffe,0xffffffff,0xffffffff,0xf703ffff,0x00000bff,0x7fffffc0,
0xffffffff,0x3fffffff,0x3ffffe00,0xffffffff,0xffffffff,0x0bfff703,
0x20000000,0x0005fffb,0x0017ffee,0x3fffa000,0x50bfffa2,0x0005ffff,
0x07fffee0,0x99efffa8,0x99999999,0x6fffc999,0x00bfff70,0x3fea0000,
0x999999ef,0xc9999999,0xf5006fff,0x33333dff,0x33333333,0x2e0dfff9,
0x00005fff,0xfff70000,0x7fdc000b,0x8000005f,0x3fa2fffe,0xfffe82ff,
0x7c40000f,0x7ec06fff,0xf10003ff,0xff705fff,0x000000bf,0x000ffff6,
0x017fffc4,0x001fffec,0x82ffff88,0x0005fffb,0xff700000,0x7dc000bf,
0x000005ff,0x3a2fffe8,0xff982fff,0x6c0004ff,0x2201ffff,0x0000ffff,
0x2e17fffa,0x00005fff,0x0ffff880,0x3fffa000,0x7fffc405,0x3ffa0000,
0x5fffb85f,0x00000000,0x000bfff7,0x002fffdc,0x7fff4000,0xfffc8002,
0x744000df,0x5c04ffff,0x40005fff,0x5c0ffffa,0x00005fff,0x05fffb80,
0x7fffd400,0x17ffee00,0xffff5000,0x05fffb81,0x70000000,0x4000bfff,
0x0005fffb,0x2fffe800,0xe806eeea,0x002fffff,0x0dfffff5,0x005fffd0,
0x4ffff880,0x002fffdc,0x7fff4000,0x7fc40002,0x3ffa04ff,0x7c40002f,
0x7fdc4fff,0x0000005f,0x0bfff700,0x2fffdc00,0x7f400000,0x3fffa2ff,
0x3fff6203,0x989bceff,0xfffffecb,0x7ffcc00e,0xfc80000f,0x7ffdc7ff,
0x4c000005,0x0000ffff,0x307fffc8,0x0001ffff,0xb8ffff90,0x00005fff,
0xfff70000,0x7fdc000b,0x8000005f,0x3fa2fffe,0xffc803ff,0xffffffff,
0x4fffffff,0x0bfff900,0x3ffe6000,0x3fffee2f,0xeeeeeeee,0xeeeeeeee,
0x7fe42eee,0xf300005f,0xff905fff,0x260000bf,0x3ee2ffff,0xeeeeefff,
0xeeeeeeee,0x02eeeeee,0x0bfff700,0x7fffdc00,0xeeeeeeee,0xeeeeeeee,
0xffe82eee,0x0ffffa2f,0x7ffff540,0xffffffff,0x3fe002ef,0x200002ff,
0x3ee5fffe,0xffffffff,0xffffffff,0x43ffffff,0x0002ffff,0x217fffa0,
0x0002ffff,0xb97fffa0,0xffffffff,0xffffffff,0x3fffffff,0xbfff7000,
0x7ffdc000,0xffffffff,0xffffffff,0xfe83ffff,0x3fffa2ff,0x7fecc003,
0xcfffffff,0x7ffd4001,0x7dc00007,0xfff70fff,0xffffffff,0xffffffff,
0x7d47ffff,0x400007ff,0x2a0ffffb,0x00007fff,0xb87fffdc,0xffffffff,
0xffffffff,0x3fffffff,0xbfff7000,0x7ffdc000,0xffffffff,0xffffffff,
0xfe83ffff,0x000002ff,0x03359533,0x27ffec00,0x3fe20000,0xffff74ff,
0xffffffff,0xffffffff,0x7fec7fff,0x4400004f,0x3f64ffff,0x400004ff,
0xf74ffff8,0xffffffff,0xffffffff,0x07ffffff,0x17ffee00,0xffffb800,
0xffffffff,0xffffffff,0xffe83fff,0x0000002f,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x26660000,
0x3fe80019,0x55550000,0x00155550,0x00000000,0x4c0aaa98,0x00001aaa,
0x80000000,0x54c0aaa9,0x555401aa,0x05554c0a,0x81555300,0x0001aaa9,
0x05edc400,0x3ffe6000,0x3fe8004f,0xfff88000,0x00ffff87,0x677ecc00,
0x0007ff81,0x3217ffec,0x00003fff,0x82deec88,0x20000ffd,0x7e42fffd,
0x7ff403ff,0x17ffec0f,0x85fffb00,0x0003fffc,0x3fbfea00,0x3f60001f,
0xb73006ff,0x059dffff,0x1fffe200,0x0003fffe,0xffffffa8,0x05ffc9be,
0x17ffec00,0x000ffff2,0xfffff300,0xfff539df,0xfffd8000,0x01fffe42,
0xfb03fffa,0x7ec005ff,0x7ffe42ff,0x3a000003,0x000bd10e,0x003fffe6,
0xffffffb1,0x005dffff,0xf87fff88,0x10000fff,0xffffffff,0x007fffff,
0x42fffd80,0x0003fffc,0x7ffffec0,0x4fffffff,0x7ffec000,0x01fffe42,
0xfb03fffa,0x7ec005ff,0x7ffe42ff,0xf3000003,0x8000fa85,0x4402fffd,
0xffffffff,0x02ffffff,0x21fffe20,0x0000ffff,0xd711dff5,0x00dfffff,
0x85fffb00,0x0003fffc,0x227ffe20,0xffffffda,0x7fec0000,0x1fffe42f,
0xb03fffa0,0x6c005fff,0x7fe42fff,0x3000003f,0x001fa85f,0x401fffcc,
0xeadffffe,0xfffffdcf,0x00000001,0xa83ffb80,0x00003eed,0x80000000,
0xec984ff9,0x000000ce,0x00000000,0x00000000,0x0db17a00,0x00bff900,
0x743dfff9,0xdfffd53f,0x00000000,0x00000000,0x4d5e54c0,0x00000000,
0x00000000,0x00000000,0x00000000,0x2ffcffb8,0x7c400000,0x1ff41fff,
0x5c3ffff3,0x80005fff,0x0005fffb,0xb7000000,0xfffffffd,0x000005bf,
0x7dc00000,0xffffffff,0xffffffff,0x205fffff,0x0002fffe,0x01ffffe0,
0xfff00000,0x000000ff,0xfd09fff3,0x24fffe87,0x0005fffb,0xf95fffb8,
0x80001fff,0x9804fffa,0xfffffffe,0x3effffff,0xfff00000,0x7dc000ff,
0xffffffff,0xffffffff,0x205fffff,0x0002fffe,0x5fffff50,0x2a000000,
0x002fffff,0x205fffd0,0xfe82fffb,0x72fffdc3,0x0000bfff,0x3f2bfff7,
0x40005fff,0x5c04fffa,0xffffffff,0xffffffff,0x5400004f,0x002fffff,
0xffffff70,0xffffffff,0xffffffff,0x17fff40b,0xfffd8000,0x000006ff,
0xdfffffb0,0x3fffa000,0x03fff902,0x701507fd,0x0000bfff,0x3f2bfff7,
0x0003ffff,0x4413ffea,0xcefffffd,0xffd7531a,0x0001dfff,0x3fffff60,
0xfff70006,0xdddddddf,0xdddddddd,0x7f409ddd,0x880002ff,0x1fffefff,
0x7c400000,0x01fffeff,0x02fffe80,0xfd07fff9,0x7ffdc007,0xffb80005,
0xfffff95f,0x3ea0001f,0xfffd04ff,0x3aa005ff,0x0006ffff,0xffefff88,
0xffb8001f,0x0000005f,0x0005fffd,0xff3fff70,0x8000009f,0xfff9fffb,
0xfffe8004,0x0dfff502,0x7dc007fd,0xb80005ff,0xfff95fff,0x2000bfff,
0xfb84fffa,0x8000dfff,0x004ffffd,0x7cfffdc0,0xfb8004ff,0x000005ff,
0x005fffd0,0x3adffd00,0x00000fff,0x7f5bffa0,0x7f4000ff,0xfff102ff,
0x003fe81f,0x0017ffee,0x657ffee0,0x3fffffff,0x4fffa800,0x027fffc4,
0x3ffff200,0x3ffa0001,0x001fffd6,0x005fffb8,0xfffd0000,0xff980005,
0x07fff93f,0x3fe60000,0x07fff93f,0x02fffe80,0xe87bfffa,0x3fee003f,
0xfb80005f,0xffff95ff,0x8001ffff,0x7ec4fffa,0xd00006ff,0x2000dfff,
0xff93fff9,0xffb8007f,0x0000005f,0x0005fffd,0xf31fffc8,0x00000dff,
0x7cc7fff2,0x7f4006ff,0x3fe602ff,0x3fe9cfff,0x17ffee00,0x3ffee000,
0xff9fff95,0xfa800bff,0x3ffe64ff,0xf500002f,0x90003fff,0x3fe63fff,
0x7fdc006f,0x0000005f,0x0005fffd,0x7f47fff8,0x800001ff,0x7ff47fff,
0x3ffa001f,0x7ffcc02f,0x00cfffff,0x00bfff70,0x2bfff700,0xffabfffc,
0x3ea003ff,0x3fff64ff,0x7f400005,0xff8004ff,0x0ffff47f,0x0bfff700,
0x3fa00000,0x2a0002ff,0x7fdc4fff,0x5400004f,0x7fdc4fff,0x3ffa004f,
0xfff9802f,0xceffffff,0x17ffee01,0x3ffee000,0x367fff95,0x5000ffff,
0x7ffc9fff,0x5c00002f,0x54007fff,0x7fdc4fff,0x3fee004f,0x0000005f,
0x0005fffd,0x220fffec,0x0000ffff,0x107fff60,0x2001ffff,0x1002fffe,
0xffffffd7,0x3ee09fff,0xb80005ff,0xfff95fff,0x17fffe27,0x8a7ffd40,
0x0000ffff,0x0ffffc40,0x83fffb00,0x000ffff8,0x000bfff7,0x3fffa000,
0xfff10002,0x0ffff60d,0x7ffc4000,0x07fffb06,0x00bfffa0,0x3ffff260,
0x5c1effff,0x80005fff,0xff95fffb,0x7fffd47f,0x4fffa803,0x000ffff3,
0x0ffffa00,0x837ffc40,0x7003fffd,0x0000bfff,0x0bfffa00,0x27ffdc00,
0x006fffa8,0x09fff700,0x401bffea,0x0002fffe,0x3fffb7fa,0x7ffdc6ff,
0xffb80005,0x87fff95f,0x400ffffd,0xff54fffa,0x200000ff,0x7003fffd,
0x3ea09fff,0xff7006ff,0x555555df,0x55555555,0xfe803555,0xfd0002ff,
0x7ffc03ff,0xfe80001f,0x3ffe01ff,0xfffe801f,0x4ffa0002,0x23ffffd9,
0x0005fffb,0xf95fffb8,0xfff887ff,0x7ffd405f,0x00dfff74,0x3fff6000,
0x3fffd004,0x00ffffc0,0x7fffffdc,0xffffffff,0x3fffffff,0x017fff40,
0x037ffcc0,0x0017fff2,0x80dfff30,0xe805fffc,0x20002fff,0x7ffe43fe,
0x0bfff70f,0xbfff7000,0x2a0ffff2,0x2a03ffff,0xfff94fff,0x32000009,
0xf9805fff,0x7fe406ff,0xfffb805f,0xffffffff,0xffffffff,0x7ff403ff,
0xffc8002f,0x7ffcc03f,0x3f20000f,0x7fcc03ff,0x7ff400ff,0x3fa0002f,
0x97fffc43,0x0005fffb,0xf95fffb8,0x3ff607ff,0xfff500ff,0x013fff69,
0x7ffe4000,0x3fffc805,0x07fffcc0,0x3ffffee0,0xffffffff,0xffffffff,
0x17fff403,0x3fffe200,0x3fffe800,0xffff1000,0x7fffd001,0x02fffe80,
0x360ffa00,0xfff73fff,0xff70000b,0x0ffff2bf,0x837fffc4,0xffb4fffa,
0x200000bf,0x4404fffd,0xe800ffff,0x7dc03fff,0xaaaaaeff,0xaaaaaaaa,
0x7401aaaa,0x5c002fff,0xf7005fff,0x2e000dff,0xf7005fff,0xffe80dff,
0x40ae602f,0xfffb83fe,0x00bfff75,0x2bfff700,0x2e03fffc,0xfa83ffff,
0xdfff94ff,0x3fa00000,0x7fdc03ff,0xfff7005f,0x5fffb80d,0xfd000000,
0xfe8005ff,0x99999bff,0xfff99999,0xffe8002f,0x999999bf,0xffff9999,
0x0bfffa02,0x741bffea,0x5fffa83f,0x000dfff5,0x329fff90,0x7ec03fff,
0x7fd40fff,0x0ffff74f,0x3ffe0000,0x7fff403f,0x9999999b,0x2ffff999,
0x017ffee0,0x7ff40000,0x3fe6002f,0xffffffff,0xffffffff,0x7fcc005f,
0xffffffff,0xffffffff,0x3fffa05f,0x07fff882,0xfff707fd,0x01bffea7,
0x53fff600,0x4403fffc,0x7d46ffff,0xffff54ff,0xf8800001,0x3e602fff,
0xffffffff,0xffffffff,0x3fee05ff,0x0000005f,0x4005fffd,0xfffffffc,
0xffffffff,0x000fffff,0x3ffffff2,0xffffffff,0x00ffffff,0x3e05fffd,
0x3fe82fff,0xf32fffd8,0xd0000dff,0x3ff27fff,0xfffb803f,0x93ffea3f,
0x0001ffff,0x03fffd40,0x3ffffff2,0xffffffff,0x00ffffff,0x000bfff7,
0x3fffa000,0x3fffe002,0xffffffff,0xffffffff,0x3ffe003f,0xffffffff,
0xffffffff,0xfffd03ff,0x1bfff205,0xfff30ffa,0x1fffe61f,0x3fffa000,
0x007fff93,0x543ffff6,0x3ff24fff,0x7400006f,0x7fc04fff,0xffffffff,
0xffffffff,0xff703fff,0x000000bf,0x400bfffa,0x999efffa,0x99999999,
0x06fffc99,0x33dfff50,0x33333333,0xdfff9333,0x40bfffa0,0x744ffff9,
0x3fffa23f,0x00ffffc4,0x47fffe00,0x1003fffc,0x3eadffff,0x3ffea4ff,
0xf700002f,0x7d403fff,0x99999eff,0x99999999,0xf706fffc,0x00000bff,
0x00bfffa0,0x001fffec,0x02ffff88,0x003fffd8,0x05ffff10,0x6405fffd,
0xfd0dffff,0x1bfffea7,0x000ffff6,0x327fffb8,0x2e003fff,0xffabffff,
0x7ffff44f,0x7fc40000,0x7fec06ff,0xff10003f,0xfff705ff,0x2000000b,
0x8802fffe,0x0000ffff,0x1017fffa,0x0001ffff,0x742ffff4,0x7e402fff,
0xeffeffff,0x81ffffff,0x000ffffb,0x64bffff0,0x6c003fff,0xfffcffff,
0x27fffcc4,0x3fff6000,0x3ffe201f,0x3fa0000f,0xfffb85ff,0xd0000005,
0xf7005fff,0xa8000bff,0x2e00ffff,0x40005fff,0x740ffffa,0xfc802fff,
0xffffffff,0xf301efff,0x7000bfff,0x7e45ffff,0x7c4003ff,0x4fffffff,
0x0dffffc8,0x7fff4400,0x7ffdc04f,0x7fd40005,0x7ffdc0ff,0xd0000005,
0xfd005fff,0x880005ff,0x3a04ffff,0x40002fff,0x744ffff8,0xb5002fff,
0xffffffff,0xfff9009f,0xfd3003df,0xffc8dfff,0xffb8003f,0xd04fffff,
0x005fffff,0x1bffffea,0x00bfffa0,0x9ffff100,0x005fffb8,0xfffd0000,
0xffff9805,0xffc80000,0xffff307f,0xff900001,0x2fffe8ff,0xdffb9800,
0x3fe2000a,0xacefffff,0xffffecba,0x7ffe41ff,0xfffb0003,0x36209fff,
0xbcefffff,0xffecb989,0x4c00efff,0x0000ffff,0x5c7fffc8,0xeeeeffff,
0xeeeeeeee,0x2eeeeeee,0x805fffd0,0x0005fffc,0x05ffff30,0x000bfff9,
0x8bfffe60,0x0002fffe,0x4c000ffa,0xfffffffe,0xffffffff,0xfffc81ff,
0xfff10003,0xfc809fff,0xffffffff,0xffffffff,0xbfff9004,0x3fe60000,
0x3ffee2ff,0xffffffff,0xffffffff,0xfd03ffff,0xfff805ff,0x3a00002f,
0xfff85fff,0x3a00002f,0x3ffa5fff,0x3fa0002f,0x3f620003,0xffffffff,
0x00efffff,0x0007fff9,0x27ffffdc,0x7ffff540,0xffffffff,0x3fe002ef,
0x200002ff,0x3ee5fffe,0xffffffff,0xffffffff,0x03ffffff,0x5405fffd,
0x00007fff,0x507fffdc,0x0000ffff,0xd0ffffb8,0x40005fff,0x980003fe,
0xfffffffc,0x6401cfff,0x40003fff,0x004ffffd,0x3fffff66,0x001cffff,
0x003fffd4,0x3fffee00,0xffffff70,0xffffffff,0xffffffff,0x3fffa07f,
0x13fff602,0xfff10000,0x27ffec9f,0x3fe20000,0x5fffd4ff,0x00e5c000,
0x2ea66000,0x900099ab,0x80007fff,0x004ffff8,0x33595330,0x7ffec000,
0x7c400004,0x00004fff,0x00000000,0x00000000,0xfd000000,0x000005ff,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x5d4c4000,0x00001aac,0x00000000,
0x00015510,0x00333220,0x0000aa88,0x000f32a0,0x54c00000,0x400001aa,
0x26003cca,0x20000aca,0x00004cc8,0x2000732e,0xfffffeb8,0x001cffff,
0x5d4c4000,0xb90009ac,0x17ff4401,0x5ffd8000,0x0bffa200,0x7ffcc000,
0x3faa0001,0xffb8001c,0x003effff,0x01fff980,0xfffffe98,0xffc8000d,
0x3fe00004,0x7fe4000f,0xffffffff,0x001effff,0x7ffed400,0x1dffffff,
0x220dff70,0x0002fffe,0x000effa8,0x005fffd1,0x00fffa00,0xffcefd80,
0x3fff2001,0x03ffffff,0x01fff400,0x7fffffd4,0x22001fff,0x00000fff,
0x4400dff3,0xfffffffe,0xffffffff,0xb80003ff,0xffffffff,0x0dffffff,
0x2e0bffee,0x002fffff,0x00fffc40,0x2fffffb8,0x5ffc8000,0xd13e2000,
0x3ffe600b,0xfffea89b,0xbff90000,0x33fffe00,0x006fffc9,0x00013ff2,
0x5004ffc8,0x9bffffff,0x3feea635,0x0005ffff,0xffffffb1,0xffffffff,
0xfff59fff,0xfffffa87,0x740002ff,0xffa804ff,0x002fffff,0x007ffcc0,
0xfb81f700,0x85ffc800,0x8001fff9,0xb800fffa,0x7fcc0fff,0xfff8802f,
0x3fa00000,0xfff9801f,0xf7000eff,0x800bffff,0xefffffe9,0xeba989ac,
0xffffffff,0xd9dffc84,0x2e0002ff,0xff9006ff,0x005ffb3b,0x017ffc40,
0xf907ea00,0xff500800,0xff88001f,0x7fff002f,0x201bff20,0x00004ffc,
0x7401ffe2,0x8003ffff,0x02ffffe8,0xdfffff10,0x3ffee003,0x3b905fff,
0x80017fec,0x9000fff9,0x017fec3b,0x00bffb00,0x7cc37e00,0x75440004,
0xfd8004ff,0xfff1005f,0x01ffea03,0x0001fff1,0x402ffd40,0x002ffffc,
0x3ffffa20,0xffffd800,0x7ec4000c,0xb0104fff,0xd10005ff,0x404007ff,
0x50002ffd,0x00001dff,0x03ffbfee,0xffffb800,0xeffb8003,0x1fff3000,
0x803ffe60,0x00003ffd,0x2601ffec,0x0005ffff,0x05ffff98,0x01ffffd4,
0xfffffd00,0x0bff6003,0x017ff600,0x00bff600,0x007ffe20,0x05b71000,
0xbfffb000,0xfff88003,0x3ffea001,0x03fff100,0x0003ffe6,0x801fff00,
0x000ffffb,0x1ffff900,0x1bfffe20,0xffffd800,0xffb006ff,0xfffa8005,
0xffd80000,0x4ffe8002,0x00000000,0xfffecb80,0x9ffd000c,0x07ff9800,
0x6c07ffe2,0x400003ff,0xfe806ff9,0x400004ff,0xf502ffff,0x20003fff,
0xfffbfffc,0x2ffd801f,0x0bffe200,0x17fec000,0x01bfee00,0x36ea6000,
0x80001abc,0xc803ffe8,0xf88006ff,0xfff300ff,0x00fff301,0x09ff7000,
0x00ffff98,0x7ffec000,0x0bfffb05,0x47fff200,0xd805ffff,0x3f6002ff,
0x3600004f,0x3e6002ff,0x300000ff,0xfffffffd,0x80007fff,0x7cc06ffb,
0xff0000ff,0x1ffea03f,0x0001ffec,0x2017fec0,0x0006fffc,0x0ffffa80,
0x00ffffc4,0x917ffdc0,0xfb00ffff,0x3fee005f,0x7ec00006,0xffd1002f,
0x3ee00007,0xffffffff,0x440dffff,0xff900cba,0x1fff440f,0x09ffd000,
0x3e617ff6,0x8800007f,0x7ec00fff,0x800005ff,0x541ffff8,0xa8007fff,
0x7fcc3fff,0x7fec00ff,0x1fff9802,0x7fec0000,0x0bff9002,0x3fffa000,
0xfedccdef,0xff84ffff,0x0dfff04f,0x0002ffec,0xf70bffea,0x7ffb03ff,
0xff500000,0x9fffd00b,0x3fe00000,0x7ffdc1ff,0x7ffcc007,0x03ffff04,
0xe802ffd8,0x800003ff,0xfa802ffd,0xb80000ff,0x2602ffff,0x640ffffd,
0xfc9adfff,0xff503fff,0xfd00001f,0xfffd7dff,0x00dff309,0x0fff2000,
0x00ffffa0,0x7fffc000,0x02fffe42,0x409fff10,0x6c02ffff,0x7fe402ff,
0xfb000005,0xfff8805f,0xffd00002,0x3ffa003f,0xffffd83f,0x104fffff,
0x00005fff,0x3fffffa2,0xffe80dff,0xfd000003,0xffff003f,0x3a000005,
0x7fec3fff,0xffd1004f,0x3fffe80b,0x5017fec0,0x00001fff,0xb00bff60,
0x200009ff,0x2005fff9,0xf704fffb,0x05dfffff,0x00027ff4,0x7ffffe40,
0x00dff503,0x1ffe2000,0x017fffc0,0xfffe8000,0x01ffff43,0x400effe8,
0x0004fffd,0x202fff88,0x00bcdcca,0x37fdc000,0x305dd700,0x54003db9,
0x4cc05fff,0x7fdc009a,0x0bbae006,0x3a004c40,0xb97302ff,0x7fdc0037,
0x7ffff004,0x3fe00000,0x7fff43ff,0x0effd803,0x04fffd80,0x04ffd800,
0xfffffff5,0x2600009f,0xf5001fff,0x800005ff,0x0005fff9,0x007ffe60,
0x0017ffd4,0x20dff500,0xdffffffc,0x02ffd800,0x009fffd0,0xffff3000,
0x04fffd85,0x8007ffe4,0x0004fffe,0x54077fdc,0xffffffff,0xe80004ff,
0xff3003ff,0x200005ff,0x05fffda8,0x0fffa000,0x17fffcc0,0x5ffd0000,
0xffffffb0,0xff801dff,0xfffb000f,0xf500000b,0xffc83fff,0x3fff205f,
0x3fffe001,0x3fe60003,0x3bfff01f,0x007fff54,0x00bff900,0x0bffffa2,
0xfd975100,0x0bffffff,0x17ff2000,0x7ffff440,0xff500002,0x3dfff50d,
0x409fff91,0x32006ff9,0x00006fff,0xb87fffb8,0xff706fff,0x7fc4005f,
0x3a0002ff,0xfff503ff,0x05fff503,0x03ffea00,0x7fffff40,0xfffeb802,
0xffffffff,0xa80005ff,0xfd000fff,0x0005ffff,0x3a0bffa0,0xfff984ff,
0x009ff901,0x007fffcc,0x3fff2000,0x87fffa85,0x4003fffa,0x001ffff9,
0x880dff90,0x1fff1019,0x5fff1000,0x3bbff600,0x3fee02ff,0xffffffff,
0x05fffcdf,0x17ffc400,0xfeeffd80,0xfb80002f,0x1fff986f,0x3a09ffd0,
0x7f4001ff,0x200004ff,0x983ffff8,0x3e62ffff,0xfb8004ff,0xf30006ff,
0xb80001ff,0xfb0005ff,0x3ff2009f,0x702ffd8f,0xdfffffff,0x7ffcc379,
0x7fec0005,0x1fff9004,0x00005ffb,0xff505ffd,0x42ffe40f,0xb8007ff8,
0x9001ffff,0x3fff6017,0xbfffd00f,0x0013ffe2,0x00ffffe2,0x00bffe20,
0x05fff300,0x00dff700,0x7ec7ffea,0xffffa82f,0x7fcc00be,0x3ee0005f,
0xfff5006f,0x000bff63,0x2e0dff70,0x3fee06ff,0x005ffa86,0x05ffff88,
0x20cfff88,0x204ffffa,0xfe9ffffa,0xff90005f,0xfb0001ff,0xfb8000bf,
0xf98005ff,0xff9801ff,0x20bff62f,0x000dfffd,0x000bfff5,0x2007ffe6,
0x3f62fff9,0x7fc0002f,0x0bff902f,0x7ec3ffd4,0xff70003f,0xffa805ff,
0xfff8afff,0x7ff400ff,0x000effff,0x06ffff88,0x00fffa80,0xbfffb100,
0x0fffa000,0xb0fffe20,0xffff05ff,0x7ffdc001,0x7ffd0005,0x87fff100,
0x20002ffd,0x3ee06ffb,0x1ffee06f,0x80003ffe,0x204ffffe,0xffffffd9,
0xa803ffff,0x00efffff,0x3ffffb00,0x1fff8800,0xfffd3000,0x3ff20007,
0x09ffd006,0xff985ffb,0x7ff4006f,0xffc8005f,0x09ffd006,0x20005ffb,
0x2e01fff8,0x3fee06ff,0x0037fcc5,0x3ffffe20,0x3ff2201e,0x004fffff,
0x013ffff6,0x3ffffa60,0x4ffe8003,0xffff5000,0x3fe60005,0xfff8800f,
0xffffffff,0xffff34ff,0x3fff2001,0x7fd4005f,0xfff8800f,0xffffffff,
0x7dc004ff,0x3ffd405f,0xfb89ffb0,0xe980004f,0xacefffff,0xfffdba89,
0x2000ffff,0x2efffffc,0xfffff700,0xdff7000b,0x3ffee000,0xfd10000e,
0x3fe2005f,0xffffffff,0xfff14fff,0xfff7009f,0x7c400dff,0xff1002ff,
0xffffffff,0x44009fff,0x7c401fff,0xfff882ff,0x0017ff42,0xffffd880,
0xffffffff,0xffffffff,0xffffb803,0x9aceffff,0xfffedb98,0x4c000dff,
0xa8001fff,0x40005fff,0x54005ffd,0xeaaaaaaa,0x3fa1acff,0xf9302fff,
0x00ffffff,0x2002ffec,0xaaaaaaaa,0x001acffe,0x64017ff2,0x3f662fff,
0x07ffc46f,0x3fee0000,0xffffffff,0xffedffff,0xff502eff,0xfffff97f,
0xffffffff,0x0007ffff,0x0007ffd1,0xfffffff1,0x407fffff,0x0000effa,
0x4c17fec0,0xcdefffff,0xebfffffe,0xfb800fff,0x400000ef,0x44002ffd,
0xf1001fff,0xfffbdfff,0x05ffa85f,0x3faa0000,0xffffffff,0x3fffee0c,
0x1fffd46f,0xffffffd3,0xdfffffff,0x3ff20003,0xfff90005,0xffffffff,
0x3ffe207f,0xfd800001,0xffff502f,0xbfffffff,0x00fffee1,0x0003fff1,
0x005ffb00,0x4005ffc8,0xffffffe9,0x03ffc82f,0xa9880000,0x26009abb,
0x7f45fffe,0xfffb504f,0x39ffffff,0x7ffd4000,0x99970000,0x99999999,
0x13ffa059,0x665c0000,0x3fff6201,0x4c2effff,0x7f406fff,0x7000004f,
0x7c400399,0xc88001ff,0x700deffe,0x00000199,0xfd500000,0x1004e885,
0x00335753,0x00266200,0x4c000000,0x00000019,0x2aea6200,0x26600001,
0x00000001,0x00099880,0x00000100,0x00000000,0x0000000c,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x13333000,0x2e620000,0x100001ab,0x00013333,0x00666660,
0x4cccc000,0x4cccc000,0x33000001,0x00000133,0x26620000,0x04ccc409,
0x0ccccc00,0x33310000,0x00999881,0x3fffea00,0xd930000e,0x3dffffff,
0xffe88000,0xfb00007f,0x00003fff,0x02ffffb8,0x17fffe40,0x3fee0000,
0x320006ff,0xea81efff,0x3fff6000,0x01fffe42,0x17fffe40,0xfffd8000,
0x01fffe42,0xfffff880,0xffc8005f,0xffffffff,0x7cc0005f,0x00003fff,
0x000bfffd,0x04ffff80,0x0dfffb00,0x7ffcc000,0x20004fff,0xd52ffffa,
0x7ec007ff,0x7ffe42ff,0xfffb0003,0x3f60000d,0x7ffe42ff,0xfffd0003,
0x4007fff9,0xdefffffc,0x04ffffff,0x3fffd400,0xfff88000,0xf700001f,
0x44000dff,0x0002fffe,0xfcfffe88,0x260003ff,0xfffffffe,0x3ff6002e,
0x1fffe42f,0xfffe8800,0xffd80002,0x1fffe42f,0x9fffec00,0xa802fffd,
0x4c0cffff,0x001ffffc,0x01fffdc0,0x5fff9800,0xfffd0000,0xff980001,
0xfd80006f,0x3fffd3ff,0x7ffcc000,0xd8002eff,0x7fe42fff,0x3e60003f,
0xd80006ff,0x7fe42fff,0x7fdc003f,0x3fffe26f,0x27fff400,0x00ffffa0,
0x01bff600,0x1fffb800,0x7ffd4000,0xff500001,0x7dc0005f,0x3ffe65ff,
0x7e44000f,0x003fffff,0x88133310,0x40000999,0x0001fffa,0x2204ccc4,
0x26000999,0x7dc1ffff,0xff100eff,0xffa801ff,0xfd00005f,0x6400005f,
0x740005ff,0x400003ff,0x30005ffb,0xfb81ffff,0xfb3006ff,0xfffd9fff,
0x00000003,0x17fee000,0x00000000,0xfa800000,0xff8804ff,0x0000004f,
0x00000000,0x00000000,0x00000000,0x2219fffb,0x0000efff,0x00000000,
0x00000000,0x2e000000,0xfa803fff,0x000003ff,0x00000000,0x00000000,
0x00000000,0xf5017f30,0x00000bff,0x00000000,0x00000000,0x2af72a62,
0x7fff7000,0x01fffb00,0x66dd4c00,0x999801ab,0x04ccc000,0x98001333,
0xa9880099,0x2000abdc,0x4c000999,0x04c00099,0x0005fffb,0x157b9531,
0x32a60000,0x00000abc,0x01579953,0xffffc800,0x402fffff,0x4c02fffc,
0x98004fff,0xfffffffe,0xff103fff,0x7fcc00bf,0x0bfff14f,0x027ffcc0,
0x3ffffff2,0x7c402fff,0x3e6005ff,0x764c04ff,0xffacffff,0x7fe4006f,
0x2fffffff,0xffff7000,0x005fffff,0x3ffffee0,0x4002ffff,0xfffffffa,
0x00dfffff,0xd803fff9,0x5c001fff,0xffffffff,0x40dfffff,0x2005fff8,
0xff14fff9,0x7fcc00bf,0xffff504f,0xffffffff,0x3ffe201b,0x3ffe6005,
0x3ffff204,0xffffffff,0xfffa803f,0xffffffff,0xfb1000df,0xffffffff,
0x22001bff,0xfffffffd,0x800dffff,0xdefffffa,0xffffffdc,0x01fffc81,
0x0017ffe6,0x9bdffffd,0xfffffdb9,0x05fff889,0x453ffe60,0x26005fff,
0xffa84fff,0xfdcdefff,0x881fffff,0x26005fff,0xfe984fff,0xffefffff,
0x407fffff,0xdefffffa,0xffffffdc,0x7fffcc01,0xfffdcdef,0x7cc00eff,
0xdcdeffff,0x00efffff,0x07bfffe2,0x437fffdc,0x3601fffc,0x2e000fff,
0x2602ffff,0x220ffffd,0x26005fff,0xfff14fff,0x7ffcc00b,0x77fffc44,
0xdffff701,0x00bfff10,0x7427ffcc,0x220bffff,0x3fffffe9,0x3dffff10,
0x1bfffee0,0x03dfffd0,0x017fffe6,0x203dfffd,0x205ffff9,0x400dfffd,
0x643fffe9,0xff301fff,0xffe800bf,0xfffd001f,0x02fffc47,0x229fff30,
0x26005fff,0x7fec4fff,0x7f4c00df,0x7ffc43ff,0x3ffe6005,0x0f7ffdc4,
0x17ffff20,0x006fffec,0x40ffffa6,0x8806fffb,0xf701fffe,0xfd100dff,
0xfff503ff,0x3fea001f,0x3fff20ff,0x07fff701,0x02fffcc0,0x449fff70,
0x26005fff,0xfff14fff,0x7ffcc00b,0x03fffea4,0x07fffd40,0x400bfff1,
0x3e24fff9,0xfb001fff,0xffa81fff,0xff5000ff,0xfff881ff,0xfff3000f,
0x1ffff10d,0x1bffe600,0x000ffff6,0x7e47fffd,0xfff701ff,0x76e4c00b,
0x3ffea001,0x017ffe25,0xf14fff98,0x7cc00bff,0x3fff64ff,0x7fff4003,
0x017ffe23,0x324fff98,0x22005fff,0x7ec2ffff,0x7f4003ff,0x7ffe43ff,
0x7ffec003,0x01fffe41,0xd07fff60,0xa8001fff,0x3ff24fff,0xffff101f,
0x30000007,0x7fc4bfff,0x3fe6005f,0x0bfff14f,0xd27ffcc0,0xa8001fff,
0x3fe24fff,0x3fe6005f,0x07fffa4f,0x89fff900,0x4000fffe,0x7ec4fffa,
0x7dc001ff,0x7ffec3ff,0x7ffdc001,0x0037ffc3,0xf937ffc4,0x7fec03ff,
0x00000dff,0x5fffda88,0x8017ffe2,0xff14fff9,0x7fcc00bf,0x01bffe4f,
0x89bffe20,0x26005fff,0x3ffe4fff,0xfffa8007,0x0037ffc5,0x3a37ffc4,
0x4c000fff,0x7ff44fff,0x7fcc000f,0x17ffe64f,0x93fffc00,0x74403fff,
0x001effff,0xffd97510,0x44bfffff,0x26005fff,0xfff14fff,0x7ffcc00b,
0x00bfff34,0xf89fffe0,0x3e6005ff,0xdfff14ff,0xdfff3000,0x002fffcc,
0x7fc7fff8,0xeeeeeeff,0xfeeeeeee,0x7fffc5ff,0xeeeeeeee,0xfffeeeee,
0x013ffea5,0xc87fffc0,0x6c401fff,0x004fffff,0xffffffd7,0xbfffffff,
0x002fffc4,0x3e29fff3,0x3e6005ff,0x9fff54ff,0x3fffe000,0x00bfff10,
0xf9a7ffcc,0xf88005ff,0x3ffea7ff,0xffff0004,0x3ffffe21,0xffffffff,
0x6fffffff,0x3fffffe2,0xffffffff,0x26ffffff,0x0004fffb,0x3f23fffd,
0xff7001ff,0x7dc0bfff,0xffffffff,0x5fffcdff,0x8017ffe2,0xff14fff9,
0x7fcc00bf,0x09fff74f,0x47fffa00,0x2005fff8,0xff54fff9,0x3fe0009f,
0x13ffee7f,0x8ffff400,0xfffffff9,0xffffffff,0x267fffff,0xffffffff,
0xffffffff,0x3ea7ffff,0xff0004ff,0x3fff21ff,0x3ffe6001,0xfffb85ff,
0x1bceffff,0xf897ffe6,0x3e6005ff,0xbfff14ff,0xa7ffcc00,0x0004fffa,
0x3e21ffff,0x3e6005ff,0xbfff34ff,0xffff1000,0x0027ffd4,0xf30ffff8,
0x55555dff,0x55555555,0x7fcc5555,0xaaaaaaef,0xaaaaaaaa,0x3ffe62aa,
0xfff88005,0x007fff27,0x3ffffb10,0x5f7fffd4,0x2fffcc00,0x400dfff1,
0xff14fffa,0x7fd400df,0x0bfff34f,0x4ffff100,0x2006fff8,0xff34fffa,
0xff3000df,0x2fffccdf,0x3fffc400,0x000dfff1,0x06fff880,0x7ffc4000,
0xfff98006,0x007fff27,0xb27ffec0,0x2001bfff,0x3e25fffa,0x3ea006ff,
0xdfff14ff,0xa7ffd400,0x8006fff8,0x3e27fff9,0x3ea006ff,0xffff14ff,
0x9fff5000,0x0037ffc4,0x3e3fffcc,0x00000fff,0x0007fffc,0x03fffe00,
0x4bfff700,0x0001fffc,0x7fcdfff5,0x3ee000ff,0x37ffc5ff,0x49fff900,
0x32006fff,0x3ffe4fff,0x7fdc000f,0x037ffc5f,0x7c9fff90,0x64000fff,
0x7ffc3fff,0x7fdc000f,0x0fffec5f,0x2026a200,0x4001fffd,0xffd809a8,
0x7ff4004f,0x07fff22f,0x3ffe2004,0x00dfff36,0x7c5fffe8,0x3fa007ff,
0x1fffe4ff,0x24fffe80,0x4004fffd,0x7fc2fffe,0x3ffa007f,0x13fff24f,
0x1ffff880,0x0027ffec,0xf90bfffa,0xfc800bff,0x7ffe45ff,0x7ffe4005,
0x07fffcc5,0x0ffffb80,0xd507fff2,0x7ffdc01f,0x01ffff34,0x17ffff20,
0x9007fffd,0x7f49ffff,0xffc803ff,0x3ffe64ff,0xfff7000f,0x3fffe81f,
0x4ffffc80,0x003fffe6,0x4c2fffe4,0x7000ffff,0xf881ffff,0xf1002fff,
0xff883fff,0xff1002ff,0xfff903ff,0xfffa801d,0x0fffe44f,0x7c0bfffb,
0xfff13fff,0xfff7009f,0xfffc8dff,0x3ffee00f,0x3fff24ff,0x3ffee00f,
0x7ffe44ff,0x7ffd400e,0xffffc84f,0x3fffee00,0x77ffec4f,0x7fffdc00,
0x1dfff900,0x4ffffa80,0x03ffff70,0x06fffe88,0x803ffff7,0x106fffe8,
0x815fffff,0x86ffffc8,0x3a21fffc,0x36a0cfff,0x3fa0ffff,0xf9302fff,
0x98ffffff,0x10beffff,0xffffff95,0x77fffcc9,0xfff9510b,0xff889fff,
0x6440afff,0xf306ffff,0x2217dfff,0xffffffca,0x7ffffcc4,0xffffd882,
0x3fffe204,0x7fe440af,0x7ff406ff,0x764c0cff,0x3a01ffff,0x4c0cffff,
0x01ffffec,0x3fffffea,0xffffffee,0x1fffc80e,0x77ffffcc,0x42fffffe,
0xdefffff9,0xbfffffec,0x7ec0fffe,0xffffffff,0x4ffe9fff,0x7fffffec,
0xe9ffffff,0xfffa84ff,0xfffeefff,0x3600efff,0xffffffff,0xffe9ffff,
0xffffe884,0xfffffdef,0xfffa805f,0xfffeefff,0x4c00efff,0xeffffffe,
0x2fffffff,0x7ffff4c0,0xfffffeff,0xfd8802ff,0xffffffff,0xff900dff,
0xffff503f,0x07ffffff,0x3fffffea,0x70dfffff,0xff907fff,0xdfffffff,
0x3213ffa3,0xffffffff,0x09ffd1ef,0x3fffff62,0x0dffffff,0xfffffc80,
0xfd1effff,0x7ffec09f,0xffffffff,0x3ff62003,0xffffffff,0xf91000df,
0xffffffff,0x22005fff,0xfffffffc,0x002fffff,0x7fffff5c,0x7e401dff,
0xffb301ff,0x801bffff,0xffffffd8,0x7ffcc2ef,0xffffd506,0x7ff419df,
0xffffd504,0x7ff419df,0x7fff5c04,0x001dffff,0x7fffff54,0x13ffa0ce,
0xfffffb70,0x20001bff,0xffffffeb,0xb50001df,0xffffffff,0x3f6a0007,
0x3fffffff,0xaba98000,0x10000009,0x80013775,0x001aba98,0x0055cc00,
0x00ab9800,0x55d4c000,0xb9800009,0x4400000a,0x00000aba,0x004d5d4c,
0x35751000,0x54400001,0x000009ab,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x88000000,0x99988199,
0x26660000,0x32000009,0x332e00cc,0x4ccc4001,0x26000001,0x00001999,
0x000ccccc,0x004cccc0,0x5dd4c000,0x0000000a,0x40033333,0x99881998,
0x00ccc809,0x0ffff400,0x000ffff2,0x037fffd4,0x07ff9800,0x0007ffe2,
0x000ffff7,0x3fffe600,0x3e600005,0x40004fff,0x006ffffa,0x3fffa600,
0x0000dfff,0x3fffe600,0x3fffa004,0x417ffec1,0x40003ffd,0x7e41fffe,
0xf98003ff,0x005fffff,0x206ffb80,0xb8007ff9,0x00007fff,0x00dfffb0,
0x6fffd800,0x7ffcc000,0x80005fff,0xfffffffc,0x00001fff,0x00dfffb0,
0x6c1fffe8,0xffa82fff,0x7ff40005,0x1fffe41f,0x3fffa200,0x0003fffc,
0xf7027fe4,0xff7000df,0x300000ff,0x0001ffff,0x07fffcc0,0xfffd1000,
0x0007fff9,0x6fffffdc,0x00ffffff,0x7ffcc000,0x7ff4000f,0x17ffec1f,
0x0003ffc4,0xf907fffa,0xfd8007ff,0x3fffb3ff,0x1fff4000,0x0009ff90,
0x000ffff7,0x05fff900,0xfffd8000,0x7fec0002,0x03fffb3f,0x7ffff300,
0x2ffff541,0x3ff60000,0xffe8001f,0x17ffec1f,0x0001ffe8,0x26206662,
0x3ee00099,0x3ffe26ff,0xfff0000f,0x017ff403,0x00cccc40,0x3ffe2000,
0x7c400004,0x5c0003ff,0x3fe26fff,0x7e4000ff,0xfff505ff,0x7cc0000f,
0x310003ff,0x13331033,0x0013ff20,0x26000000,0x7dc0ffff,0xf98006ff,
0x3ffe207f,0x00000001,0x005ffc80,0x05ffc800,0x7fffcc00,0x037ffdc1,
0x807fffa0,0x0001ffff,0x000bffb0,0xff300000,0x0000000d,0x00000000,
0xf3037fdc,0x000000ff,0x00000000,0x00000000,0x3ffe0000,0x0fffec07,
0x00000000,0xfff00000,0x00000001,0x00000000,0xfb813ff2,0x2aa0006f,
0x0000001a,0x00000000,0x40000000,0x3e01fffe,0x00000fff,0x00000000,
0x000bff60,0x2f36ea60,0x54c0001a,0x401abcdb,0xe9999998,0x99999cff,
0x999dffd9,0xbfff1000,0x2a620000,0x0000abdc,0x15799530,0x32a60000,
0x20000abc,0xf506fffc,0x20000dff,0x1abcdba9,0x00099980,0x3ee04ccc,
0xfd30005f,0xffffffff,0x7f4c007f,0xffffffff,0xffff703f,0xffffffff,
0xffffffff,0x22005fff,0x80004fff,0xfffffffc,0xf70002ff,0xffffffff,
0x3fee0005,0x2fffffff,0xffffa800,0x17fff443,0xfffd3000,0x7fffffff,
0x017ffe20,0x4c4fff98,0xfb8007ff,0xffffffff,0x400dffff,0xfffffffb,
0x0dffffff,0x7fffffdc,0xffffffff,0xffffffff,0xfff3002f,0x7fd40007,
0xffffffff,0xb1000dff,0xffffffff,0x2001bfff,0xffffffd8,0x00dfffff,
0x97fffec0,0x005fffe9,0x3ffffee0,0xffffffff,0x2fffc40d,0x09fff300,
0x74003ffd,0xccdeffff,0x4fffffed,0x3bffffa0,0xfffedccd,0x7ffdc4ff,
0xffffffff,0xffffffff,0x7002ffff,0x20005fff,0xdefffffa,0xffffffdc,
0x7fffcc01,0xfffdcdef,0x7cc00eff,0xdcdeffff,0x00efffff,0x3ffffe20,
0x005ffffd,0x3bffffa0,0xfffedccd,0x7ffc44ff,0x3ffe6005,0x003ffc84,
0x405ffff7,0x80ffffd9,0x202ffffb,0x00ffffd9,0x2e04ffc8,0x3e0005ff,
0x88001fff,0x701effff,0xe80dffff,0xf301efff,0xfe80bfff,0xff301eff,
0xfa800bff,0x4fffffff,0x3ffee000,0x3ff6602f,0x3ffe20ff,0x3ffe6005,
0x006ffa84,0x2003fffd,0xfe83fffe,0xffd001ff,0x5ffd007f,0x0027fec0,
0x005fffd8,0x01bfffb0,0x03fffe98,0x100dfff7,0x2e03fffd,0xe8806fff,
0x6c001fff,0x01efffff,0x0ffff400,0x23fffe80,0x2005fff8,0xf884fff9,
0x7fcc00ff,0x3fee005f,0x2fffcc4f,0x09fff700,0x201fff88,0xc8002ffe,
0x8000ffff,0x000ffffa,0x881ffff5,0x3000ffff,0xff10dfff,0x3e6001ff,
0xfb3006ff,0x009fffff,0x05fff980,0x893ffee0,0x26005fff,0xffd04fff,
0x1edc9805,0x17ffea00,0x4003db93,0x4c05fffa,0x3fe207ff,0x7fec000f,
0xfb0003ff,0xfe8007ff,0x7ffe43ff,0x7ffec003,0x01fffe41,0x007fff60,
0xfffffff9,0x4c0005ff,0x2a001edc,0x3fe25fff,0x3fe6005f,0x09ff704f,
0x7fcc0000,0x2600005f,0x7dc05fff,0x1ffea06f,0x7ffffb00,0x7fff4000,
0x7ffd4000,0x00fffec4,0xb0fffee0,0xb8003fff,0x3f603fff,0xfffaefff,
0x000001ff,0x25fff980,0x2005fff8,0xf304fff9,0x100000df,0x00bfffb5,
0xfffb5100,0x04ffc80b,0xd8017fee,0x0003ffff,0x40037ffc,0x7f46fff8,
0x7cc000ff,0x7fff44ff,0x7ffcc000,0x9ffffb04,0x077fffd4,0x0002f3b2,
0x7ffed440,0x017ffe25,0x204fff98,0x10001fff,0xffffd975,0x4400bfff,
0xffffecba,0x7f405fff,0x13ff602f,0x17fffe40,0x3ffe6000,0xffff0005,
0xeeeffff8,0xeeeeeeee,0x7c5fffee,0xeeeeefff,0xeeeeeeee,0xffc85fff,
0xfffb83ff,0x17fffc5f,0x3b2ea200,0x5fffffff,0x8017ffe2,0x3604fff9,
0x3ae003ff,0xffffffff,0x405fffff,0xffffffeb,0x5fffffff,0x807ffe20,
0xfa802fff,0x80002fff,0x0004fffa,0x3e21ffff,0xffffffff,0xffffffff,
0x3fe26fff,0xffffffff,0xffffffff,0x7ffc46ff,0x3fff603f,0x1ffff33f,
0xffffd700,0xffffffff,0x2fffc4bf,0x09fff300,0x5c02ffd4,0xffffffff,
0xfffcdfff,0xfffff705,0x9bffffff,0x7fdcbfff,0xffffffff,0xffffffff,
0x362fffff,0x00003fff,0x0009fff7,0x7cc7fffa,0xffffffff,0xffffffff,
0x3fe67fff,0xffffffff,0xffffffff,0x7ffe47ff,0x7fff4407,0x05fffcaf,
0x7fffffdc,0xfcdfffff,0x3ffe25ff,0x3ffe6005,0x01ffe204,0xfffffff7,
0x7fcc379d,0xffffb85f,0x21bcefff,0x3ee5fff9,0xffffffff,0xffffffff,
0x22ffffff,0x00007fff,0x0013ffea,0xf987fffc,0xaaaaaeff,0xaaaaaaaa,
0x3fe62aaa,0xaaaaaaef,0xaaaaaaaa,0x7ffec2aa,0xffff8804,0x203fffff,
0xfffffffb,0x3fe61bce,0x17ffe25f,0x04fff980,0xfa817ff4,0x400befff,
0x7d45fff9,0x400befff,0x3ee5fff9,0xffffffff,0xffffffff,0x32ffffff,
0x3000bfff,0x0bfff303,0x4ffff100,0x0006fff8,0x037ffc40,0x7fffc000,
0xffff5001,0x7d40ffff,0x400befff,0x3e25fff9,0x3ea006ff,0x7fe404ff,
0x1bfffb04,0x17ffea00,0x001bfffb,0x9897ffea,0x99bfff99,0xcffe9999,
0x70999999,0x88007fff,0x3fe27fff,0xff98006f,0x07fffc7f,0x3ffe0000,
0x7c00000f,0x2e001fff,0x03ffffff,0x0037fff6,0xf12fffd4,0x7d400dff,
0x7fcc04ff,0x01ffff06,0x22fffdc0,0x2000ffff,0xf105fffb,0x7ffc01ff,
0x5fffa802,0x2fffdc00,0x0003fffe,0xfd8bfff7,0x544001ff,0x1fffd809,
0x404d4400,0x4003fffe,0x407ffffd,0x2000ffff,0x7fc5fffb,0x3ff2006f,
0x0fff804f,0x0037ffcc,0xf997fffa,0x7f4006ff,0xfff305ff,0x007ffc40,
0x003fffc4,0xfb0ffff6,0xfe8009ff,0x7ffe42ff,0x7ffe4005,0x02fffe45,
0x917fff20,0xc800dfff,0x304fffff,0xe800dfff,0x7ffc5fff,0x3fffa007,
0x42ffd804,0x000ffff9,0x4cbffff9,0x9000ffff,0x2e0bffff,0x3fea05ff,
0x3fffe007,0xffff5004,0x0ffff981,0x1ffff700,0x02ffff88,0x83ffff10,
0x002ffff8,0xa83ffff1,0x9003ffff,0x9fffffff,0x01ffff30,0x17ffff20,
0x9007fffd,0x7009ffff,0xfff88bff,0xfffb804f,0x3ffe26ff,0xfffb804f,
0x9ffb06ff,0x002ffe40,0x807ffff7,0x905ffff9,0xa801dfff,0xf704ffff,
0xe8803fff,0xff706fff,0xfe8803ff,0xfffb06ff,0xfffd805f,0x44ffffff,
0x804ffff8,0x46fffffb,0x200ffffc,0x04fffffb,0xfe87ff88,0xf9302fff,
0xe8ffffff,0x9302ffff,0x0fffffff,0xfd80bffa,0x7fec003f,0x32209dff,
0x100effff,0x815fffff,0x06ffffc8,0x067ffff4,0x3ffffb26,0x3ffffa01,
0x7ff64c0c,0xfff301ff,0x32a239ff,0xfbdfffff,0x7f44ffff,0xf9302fff,
0x98ffffff,0x10beffff,0xffffff95,0x07ffa009,0xbdfffff3,0x7fffffd9,
0x7cc1fffd,0xecdeffff,0xfebfffff,0x7ffc40ff,0x00bffe00,0xfffffd10,
0xffffffdf,0xfffa803f,0xfffeefff,0x4c00efff,0xeffffffe,0x2fffffff,
0x7ffff4c0,0xfffffeff,0x7fd402ff,0xffffffff,0x3ee4ffff,0x3e64ffff,
0xecdeffff,0xfebfffff,0x7ffec0ff,0xffffffff,0x004ffe9f,0xff507ff9,
0xffffffff,0x3ffee1bf,0x7ffffd43,0x0dffffff,0xf987fff7,0x3ffe207f,
0xfff90000,0xffffffff,0x3f62001b,0xffffffff,0x91000dff,0xffffffff,
0x2005ffff,0xffffffc8,0x02ffffff,0xfffffd10,0x05ffffff,0xa81ffff9,
0xffffffff,0xff70dfff,0xffff907f,0x23dfffff,0xf5004ffe,0x3ff620df,
0x42efffff,0xd886fff9,0xefffffff,0x237ffcc2,0x3ea05ffb,0x6c40007f,
0xdffffffe,0xffd70002,0x03bfffff,0x3fff6a00,0x003fffff,0xfffffb50,
0x20007fff,0xffffffec,0x3fea00ce,0xffffb101,0xf985dfff,0xffd506ff,
0x7419dfff,0xff1004ff,0x5d4c401f,0x3100001a,0x40003575,0x32a02cca,
0x4c00003c,0x4000009a,0x0009aba9,0x26aea200,0x2a200000,0x000009ab,
0x30006ee6,0x57531005,0xb9800003,0x5c00000a,0x000001cc,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00200000,0x5dd4c000,0x4000009a,0x09acba98,0x01999800,0x00333300,
0x00000008,0x01357953,0x00000000,0x00008000,0x5e554c00,0x0000001a,
0xeda80131,0x000bceff,0x3fffee20,0x000cffff,0x7fffed40,0x00cfffff,
0x003ffff0,0x405fff98,0xcdfffec8,0xdb80000a,0xfffffffe,0x3ee002df,
0xb80005ff,0xa8805fff,0x0cefffec,0xffc98000,0xdfffffff,0xf3000002,
0x3ffa609f,0x3fffffff,0xffffa800,0xffffffff,0xfffb8003,0xffffffff,
0x6400cfff,0x64004fff,0x3ee02fff,0xffffffff,0xfd30002f,0xffffffff,
0x007dffff,0x000bfff7,0x80bfff70,0xfffffffa,0x50003fff,0xfffffffd,
0x7dffffff,0xffe80000,0xfffff984,0x4fffffff,0x3fffe600,0xfffeddff,
0xfb1002ff,0xffffffff,0xdfffffff,0x37ffcc01,0x81fffe00,0xfffffffe,
0x002fffff,0x7fffffdc,0xffffffff,0x7dc04fff,0xb80005ff,0x3f205fff,
0xffffffff,0x22005fff,0xaceffffd,0xffeca999,0x80000eff,0x7c44fffd,
0xa89befff,0x804ffffd,0x81effff8,0x01ffffe9,0x7fffffcc,0xca9889ac,
0x00efffff,0x4007fffa,0xf904fff9,0x5115bfff,0x007ffffb,0xdfffffb1,
0x3aea6359,0x00efffff,0x000bfff7,0x20bfff70,0x9beffffd,0x3ffffda8,
0xcfffe980,0xfff93001,0x7ec0005f,0x7fec4fff,0xfff500ef,0xfffe803f,
0x6fffd805,0x3ffffe20,0xffc8800c,0xff700eff,0x3ff2009f,0xffffa81f,
0x3fffea01,0x7ffff401,0xffd5002f,0x3fee0dff,0xfb80005f,0xfffb85ff,
0x3ffee01f,0x3ffea01f,0xfb10000e,0xd88007ff,0x264fffff,0xfa806fff,
0x3fe205ff,0xff8800ff,0xfffb00ff,0xff90005f,0x3fe207ff,0xfff8807f,
0x07fffd06,0x407fff70,0x00dffffb,0x4ffffd80,0x005fffb8,0x45fffb80,
0x801ffff8,0xf104fffd,0x200009ff,0x7001fffb,0x9fffffff,0x801fffec,
0xf500fffd,0x7e400bff,0xfffb82ff,0x3f60002f,0x3ff607ff,0x7ffd402f,
0x06fff883,0x441bffe0,0x0004ffff,0x20ffffe4,0x0005fffb,0x645fffb8,
0xf5004fff,0x3ffa0dff,0x7dc00004,0x3fa600ef,0x4fffffff,0x001ffff1,
0x640fffe6,0x2a003fff,0xfff84eff,0x7c40004f,0xff502fff,0xfffd80bf,
0x04fffb80,0x203fffa0,0x0006fffd,0xb8dfffd0,0x80005fff,0x7fc5fffb,
0x3fa000ff,0x2ffe40ef,0x37bbbbae,0x7ec02bcc,0xffff705f,0x29fff5df,
0x4006fff9,0xffb07fff,0x2018007f,0x000ffffa,0x05fffd80,0x4403fffe,
0x75105fff,0x7ff4003b,0x7fffcc0f,0xff500002,0x7ffdc3ff,0xffb80005,
0x13ffe65f,0xfff88000,0x7ffffe40,0x00dfffff,0xf881ffd1,0xff33ffff,
0x0fffee9f,0x01fffd00,0x0009fffb,0x02fffec0,0x00ac9800,0xb817ffe4,
0x00002fff,0xfd86fff8,0x400005ff,0x3ee4fffe,0xb80005ff,0x3fee5fff,
0x2e00002f,0xdffc83ff,0xfffeedcc,0x89ff500f,0x261efff8,0xfffb4fff,
0xfffc8005,0x05fffc82,0xffff1000,0x00000007,0x3a0bfff3,0x800007ff,
0xff84fffa,0x400002ff,0x3ee7fffb,0xb80005ff,0x3ff65fff,0x3a00000f,
0x0ffc80ff,0x407ffd10,0x177c47ff,0xfea7ffcc,0x7dc001ff,0xfffa83ff,
0xff500006,0x000003ff,0x03fffa00,0x0009fff3,0x1ffff980,0x007fffc4,
0x3ffe2000,0x0bfff71f,0xbfff7000,0x54437ff4,0x4c00acdc,0x1ff904ff,
0x7037fcc0,0x301445ff,0x3ffe9fff,0x7fd4001f,0xffff884f,0xffb80000,
0x000000ff,0x87fff700,0x0001fffc,0x7ffff910,0x00ffff30,0x3fffa000,
0x00bfff73,0x4bfff700,0x3fa66fff,0x0dffffff,0x3203ff70,0x3fe200ff,
0x013fe207,0xff4fff98,0xfa8001ff,0xfffd04ff,0xff700005,0x000000ff,
0x237ffc40,0x40006fff,0xfffffedc,0x0ffff502,0x3ff60000,0x0bfff73f,
0xbfff7000,0x7cd7ffe2,0xffffffff,0x0ffc81ef,0x6401ff90,0x2ffc05ff,
0x29fff300,0xa8007fff,0x33324fff,0xcccefffe,0xf9002ccc,0x00000dff,
0x0fffd800,0x0007fff3,0xfffffff8,0x1bffee01,0x7fec0000,0x0bfff74f,
0xbfff7000,0x3eb3ffe2,0xffedefff,0x7ec1ffff,0x203ff207,0x401fffb8,
0x3e6006fe,0x7fff8cff,0x5fffa800,0x3ffffffe,0x3fffffff,0x09fffb00,
0xa8000000,0xfff93fff,0x7fc40001,0x1dffffff,0x004fffc8,0xbfff9000,
0x0017ffee,0x4d7ffee0,0xcfffefff,0x7fffdc40,0xf9037f46,0xffffffff,
0xffb007ff,0x67ffcc00,0x8007fff8,0x3fe5fffa,0xffffffff,0xb003ffff,
0x00009fff,0xdfff0000,0x00017ffa,0xffb959b3,0xffd85fff,0x9000004f,
0x3feebfff,0xfb80005f,0xffff35ff,0xff9803ff,0x81bfa3ff,0xfffffffc,
0xfb001dff,0x7ffcc00f,0x007fff8c,0x325fffa8,0xdfffeccc,0x002ccccc,
0x000bfff9,0xff900000,0x005fff3f,0x3ffa6000,0x3fff61ff,0xfb000005,
0x3ffee9ff,0xffb80005,0xfffff35f,0x3ffee007,0x640ffb0f,0xfffcabff,
0x037f4003,0x3e9fff30,0xfb8007ff,0x3ff204ff,0x7dc0003f,0x000006ff,
0xefff9800,0x00000fff,0x937fff40,0x0000dfff,0x5cffffa0,0x80005fff,
0xff35fffb,0xfe800dff,0x01ff92ff,0xff703ff2,0x02ffc00d,0x3e9fff30,
0x5c000fff,0x3ee04fff,0x540005ff,0x00006fff,0xfffd0000,0x000009ff,
0x25ffff30,0x0007fffb,0x27ffff00,0x0006fffa,0xf34fffc8,0xb8009fff,
0x3ff73fff,0x3203ff20,0xff9804ff,0x3ffe6004,0x003ffff4,0x203fffc8,
0x0003fffa,0x007fffcc,0x20001000,0x01fffffb,0xffb00000,0x3fffea9f,
0x7c400000,0xfff52fff,0xffb0000d,0x3fffe29f,0x7ffd4002,0x320bff34,
0x5ffd00ff,0x002ffc80,0x7ed3ffe6,0x7e4001ff,0x3fee02ff,0xff80001f,
0x200002ff,0x1000bdff,0x000dffff,0x7ffdc000,0x007fffe5,0xffff5000,
0x0037ffcc,0xf1ffff40,0x98003fff,0x3ffa5fff,0x300ffc80,0x7fc01fff,
0x7ffcc006,0x005fff94,0x201fffd8,0x0000fffc,0x004fffc8,0x3ffff300,
0x1fffec00,0xf5000000,0x7ffe4dff,0x7f400006,0x3ffe64ff,0xffe80007,
0x0bfffa3f,0x49fff300,0xffc83ffa,0x413ff600,0x4c003ffa,0xfff54fff,
0x7fff8009,0x002fff40,0x0ffffa80,0xfffc8000,0x7ffe4006,0x1bb32000,
0x93ffee00,0x002ffffa,0x3ffff700,0x001ffff8,0x90ffffc0,0xa8009fff,
0x7ffc2fff,0x1007fe41,0xff883fff,0x7fcc000f,0x0ffff14f,0x02fffd40,
0x0001fff5,0x02ffffc0,0x3fffe200,0x2fffc003,0x07fffa00,0x87fff900,
0x000ffffe,0x37fffc40,0x001fffec,0xa8ffff70,0x64006fff,0x7fdc0fff,
0x2007fe46,0x7fec6ffc,0xfff98004,0x007fffa4,0xd01fffec,0x800007ff,
0x002ffffa,0x1ffffd10,0x17ffd400,0x13fff200,0x1fffe880,0x027fffcc,
0x3ffff600,0x0ffffb81,0xbffff000,0x00ffff88,0x6c1fffa0,0x400005ff,
0x30006ffc,0x7fdc9fff,0xfff8805f,0x5ffe880f,0xffd00000,0xfb0007ff,
0xe8009fff,0xfa8006ff,0xf9000fff,0x3ff20fff,0x44000dff,0x304ffffe,
0x000bffff,0xb05ffff7,0x2e00dfff,0xfd105fff,0x880001df,0x0000fffd,
0x7c49fff3,0x3a204fff,0xfe884fff,0xabccaaff,0xf3008801,0x0019ffff,
0x0bffffd5,0x03fffc80,0x0dfffd00,0x05ffff70,0x17fffff4,0xfffffa80,
0x7fffe406,0xffe9801e,0xfff106ff,0xfff980bf,0x3ffe602f,0xfd30002f,
0x4c0005ff,0x7fd44fff,0x7f4c0cff,0x7f440eff,0xffffffff,0x99acefff,
0x3ea05fda,0x9adfffff,0xfffdba98,0x565c06ff,0x00ffffec,0xdffff100,
0xffffb105,0xfffd8809,0x989bceff,0xfffffecb,0x7ffc400e,0xaaceffff,
0xfffffecb,0x3ffee01f,0x3ee20adf,0xe8804fff,0x5002efff,0x003dfffb,
0x84fff980,0xdefffffc,0x81ffffff,0xfffffff8,0xffffffff,0x0fffffff,
0x3ffffe60,0xffffffff,0x400effff,0xfffffffb,0x7fd40001,0xffdeffff,
0x2006ffff,0xfffffffc,0xffffffff,0x3a6004ff,0xffffffff,0xffffffff,
0xfffb801f,0xfffedfff,0x32000eff,0xbcdfffff,0xffffdcba,0xf300005f,
0x3fea09ff,0xffffffff,0x3fff601f,0xffdccdff,0xffffffff,0x7ec402ff,
0xffffffff,0x003fffff,0x5ffffff5,0x3faa0000,0xffffffff,0xea8003ff,
0xffffffff,0x02efffff,0xffffd880,0xffffffff,0x26000eff,0xfffffffe,
0x30005fff,0xfffffffb,0x5bffffff,0x7fcc0000,0x3ff6604f,0x00bfffff,
0x3005ffd4,0xffffffd7,0x3220019f,0xffffffff,0x26000cff,0x003effff,
0xffffb800,0x000dffff,0x7fffecc0,0x01cfffff,0xfffc9800,0xcfffffff,
0xfd910001,0x05bfffff,0xffd71000,0x17dfffff,0xff300000,0x2ea2009f,
0x00a0009a,0x06aeea20,0x75531000,0x98800035,0x8000000a,0x000abba8,
0x59533000,0x40000033,0x99abba99,0x26200000,0x00000abb,0x0026a620,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x40000000,0x00aabca9,0x00010000,0x00002200,
0x2f2aa600,0x2000001a,0x409bdcb9,0x00000998,0x00000000,0x30000000,
0x00359753,0x33332600,0xcccccccc,0x50002ccc,0xffffffd9,0x00017dff,
0x77fff6dc,0xb710001c,0x007dfffd,0x7ffe4c00,0x2dffffff,0xffd50000,
0x6cbfffff,0x300006ff,0x40009fff,0x3fe6fffa,0x0000006f,0x7ffffe4c,
0x0bceffff,0xffffb800,0xffffffff,0x4c004fff,0xfffffffe,0x2fffffff,
0x7fff5400,0x0dffffff,0x3fffea00,0x03ffffff,0x3fffaa00,0xffffffff,
0x20003eff,0xfffffffc,0xffd8efff,0xff300006,0x7d40009f,0x1bffe6ff,
0x74c00000,0xffffffff,0x3fffffff,0x7fffec00,0xffffffff,0x26004fff,
0xffffffff,0xffffffff,0xfff9004f,0xffffffff,0xfd8803ff,0xffffffff,
0x44005fff,0xaceffffd,0xffeca999,0x6c000eff,0xdcefffff,0xffeffffe,
0xff300006,0x7d40009f,0x1bffe6ff,0x3ee00000,0xffffffff,0xffffffff,
0xffd000df,0xffffffff,0x009fffff,0x3bffffe6,0xeba999ab,0x404fffff,
0x9beffff9,0x6ffffb98,0x77fffec0,0xfffba89b,0xffd3005f,0x3260039f,
0x5002ffff,0x301bffff,0x0dffffff,0x3ffe6000,0x3fea0004,0x01bffe6f,
0xffd88000,0x9acdffff,0xfffecb98,0x7c400eff,0x99999dff,0x09999999,
0x5ffffb00,0x3fffaa00,0xfffd101f,0x7fff4c09,0xbffff504,0x3fffa201,
0x77ffd403,0xffb10000,0xfffd007f,0xfffe8809,0xf300006f,0x540009ff,
0x3ffe6fff,0x36000006,0x004fffff,0x13ffffea,0x007fff30,0x3ffe6000,
0x7fc4001f,0xfff505ff,0xffff300d,0x0bfffd01,0x01ffff10,0x0013ffe2,
0x00fffdc0,0x200dfff5,0x006ffff9,0x09fff300,0x37ffd400,0x0000dfff,
0x3bfffea0,0xffe88001,0x3fee01ff,0x7000002f,0x20009fff,0xc80ffffa,
0xfb002fff,0xfffb83ff,0xfff7000f,0x013ffa09,0x3ee004cc,0xfff900ef,
0x7ffec005,0xff300006,0x7d40009f,0x1bffe6ff,0x3fe20000,0xe80006ff,
0x3f205fff,0x000000ff,0x0005fff9,0x6c0ffffc,0xf9001fff,0xfffc87ff,
0x37ff4003,0x9502ffe4,0x07fffffd,0xfe82ffec,0x7fcc007f,0xf300006f,
0x540009ff,0x3ffe6fff,0xfc800006,0x80001fff,0x3a07fffb,0x000007ff,
0x000ffff6,0xd83fffd8,0xf7001fff,0xfffd87ff,0x7ffec001,0x203ffe20,
0xffffffd8,0xe880efff,0x5fff80ff,0x37ffc400,0x0dee5cc0,0x0013ffe6,
0x3e6fffa8,0x665446ff,0x3fe2001b,0x200004ff,0xff02ffff,0x400000bf,
0x0007fffa,0xffb80662,0xfff9002f,0x00ffff83,0x717ffe40,0x3ffa07ff,
0xffca9acf,0x4ffa80ef,0x0027ffcc,0xd5037ffc,0x7fffffff,0x0013ffe6,
0x3e6fffa8,0xfffb16ff,0x5009ffff,0x0000ffff,0xf301bdb8,0x001107ff,
0x7ffff100,0x7c400000,0xff8805ff,0x3fffc46f,0x27ffdc00,0xff901ffd,
0x27ff403d,0x7fd47ff8,0xffe8003f,0xfffff906,0xf39fffff,0x540009ff,
0x3ffe6fff,0xfffffe8e,0x200effff,0x0005fffd,0xfffa8000,0xdffffd72,
0x3fa00039,0x0001dfff,0x07fffd00,0xf84fffd8,0xfc8007ff,0x09ff34ff,
0x8803fff1,0x5ff707ff,0x001fffdc,0x7ec37ff4,0xfdcdffff,0x4fffefff,
0x3ffea000,0x3fffffe6,0xffecceff,0xff881fff,0x000004ff,0xfbfffc80,
0xffffffff,0xffa8003f,0x01ceffff,0x3ffe6000,0x3faa21df,0xffe80eff,
0x7fec000f,0x303ff75f,0x066009ff,0x3ea4ff88,0xff8004ff,0x7fffd46f,
0xfffff505,0x7d40009f,0x3fffe6ff,0xff980eff,0xfff986ff,0x0000002f,
0xffffffd8,0xffffffff,0x7cc000ef,0xffffffff,0x4c0001bd,0xfffffffe,
0xb00dffff,0xe8005fff,0x1ff96fff,0x0003ff70,0xff32ffc0,0xfff000bf,
0x04fffe8d,0x27ffff4c,0xdfff5000,0x02fffffc,0x50bfffa2,0x0003ffff,
0xffff0000,0x97559dff,0x00bfffff,0xfffffd10,0x5bffffff,0x3ff20001,
0x2fffffff,0x037ffdc0,0x2dffff70,0x1ffb07fd,0x37f40000,0x800dfff1,
0x3ea6fff8,0xff5006ff,0x540009ff,0x3ffe6fff,0xffa800ff,0x3fffdc6f,
0x44000000,0x201fffff,0x02ffffe8,0xfffeb880,0xffffffff,0xfb5000cf,
0xffffffff,0x3e2019ff,0xf8804fff,0xdfd6ffff,0x0001ffe0,0xfff8ffb0,
0x3fee001f,0x0ffff26f,0x04fffe80,0x9bffea00,0x2003ffff,0x3ee2fffe,
0x54c006ff,0xaaaaaaaa,0x7fcc2aaa,0xffb001ff,0x4c0001ff,0xffffffeb,
0x402fffff,0xbcfffffb,0xfffffdca,0xbffff701,0x3fffea01,0x20dfd6ff,
0x400007ff,0x7ffdc7fd,0x3fffe005,0x001fff66,0x0009fff7,0xff37ffd4,
0xffb800ff,0x1bfff23f,0xfffff900,0xffffffff,0x88002620,0x0003ffff,
0xfffd9510,0x205fffff,0x204ffffb,0x00ffffe9,0x7bfffffd,0xf5fffb95,
0x41ff6bff,0x00000ffe,0x3ffe1bfa,0xfffc801f,0x01bffe6f,0x009fff30,
0xf37ffd40,0xf9800dff,0x3ffee4ff,0x7ffe4006,0xffffffff,0x6400007f,
0x00004fff,0xffffb510,0xfff883ff,0xfffb003f,0x3fffa20b,0xffffffff,
0xf95fff8a,0x03ffb01f,0xbff00620,0x05ffff70,0xb7ffffe4,0x4005fff8,
0x0004fff8,0xff9bffea,0x7fc4005f,0x1fffea6f,0xfffff900,0xffffffff,
0xffa80000,0x8000006f,0x45ffffea,0x2005fffc,0x201ffff8,0xfffffffc,
0xbfff31ff,0x3ee07fee,0x3ffb004f,0x3a09ff30,0xaabdffff,0xffffffec,
0x009fff36,0x004fff88,0xf9bffea0,0x7c4004ff,0x3ffe67ff,0x2aa6000f,
0xfbaaaaaa,0x400007ff,0x0007fff9,0xfffb1000,0x0ffff41f,0x13fff200,
0x9dffb930,0x34fffa85,0xfff10bff,0x0fffa801,0x3602ffc8,0xffffffff,
0x6fffafff,0x0009fff5,0x40009fff,0x3fe6fffa,0xfff8004f,0x0bfffe27,
0xfff10000,0xf880000f,0x2eaa07ff,0x7c40000c,0x3ffe1fff,0x7fd4000f,
0x7004005f,0x7ff47fff,0x00effb80,0x3e09fff3,0xfffb806f,0x88efffff,
0xfff55fff,0x9fff000b,0x7ffd4000,0x0013ffe6,0xfe8dfff1,0x400005ff,
0x0007fff8,0x037ffcc0,0x0005fffd,0x227fffd0,0x88007fff,0x00006fff,
0xfa87fff2,0x9fffd03f,0xdfffd735,0x007ff501,0x337fb2a2,0x4d7ffe22,
0x44006fff,0x75314fff,0xdfff5001,0x2002fffc,0x7dc5fff9,0x400007ff,
0x6547fff8,0xffa8005c,0x3fff605f,0xffc80005,0x01fffe3f,0x017ffe60,
0x87fff800,0xfc881fff,0xffffffff,0x0fff880e,0x7fcc0000,0x0ffff15f,
0x94fff980,0xf5003fff,0x2fffcbff,0x13ffea00,0x007ffff1,0x3fffc400,
0x000bfffa,0x5c09fff9,0x80007fff,0x3fa1ffff,0x7d4001ff,0x372e64ff,
0x3ffea001,0x206ffb85,0xefffffda,0x013ff602,0x3ffea000,0x003fffa4,
0xf74fffa8,0xff7005ff,0x07fffcbf,0x07fff900,0x003ffffb,0x1fffe200,
0x4009fff9,0x201ffff8,0x004ffff8,0x83fffe60,0x4003fffc,0x3e62fffc,
0x3f6004ff,0xbffb02ff,0x80135100,0x3b206ffc,0x3f6000cd,0x3fff22ff,
0x3fffa004,0x009fff54,0x7fc9fff9,0xff1002ff,0xfff103ff,0x700001df,
0xffa8ffff,0xff9001ff,0xfffb00bf,0xe98001bf,0x7fdc4fff,0xff3000ff,
0x6fff81ff,0x0dfff300,0x0077ff44,0x3fff6200,0x13ffee00,0x07fffd40,
0x001ffff3,0x269ffff5,0x2200ffff,0x3fe2ffff,0xfc800eff,0x3fea04ff,
0x30002fff,0x88fffffd,0xb806fffe,0x9801ffff,0x02efffff,0x1fffff70,
0x01ffffd0,0x84fffe88,0x5404fffd,0x4c02ffff,0x0002ffff,0x805fffd3,
0x400ffffa,0xd85ffff8,0x2600efff,0xf14ffffe,0x3a209fff,0x3fe0ffff,
0x7d406fff,0x7e400fff,0x002dffff,0xffffffb3,0xdffff30d,0xffffb305,
0x7ffd4009,0x9bceffff,0xfffffdca,0xffff102f,0xfff7017d,0x3ffe60df,
0x7fdcc0cf,0xfd1005ff,0x2a005dff,0x801efffd,0x02efffe8,0x01ffffd5,
0x85fffff1,0xffffffb8,0x3bfffee4,0xffffca9b,0x7ffffc4f,0x7fe441df,
0xff9003ff,0x579fffff,0xffffd975,0x5c05ffff,0xdeffffff,0x03ffffff,
0xfffffa80,0xffffffff,0x403fffff,0xeffffffa,0xffffffed,0x3fffea01,
0xfffffdef,0xffc8005f,0xbabcdfff,0x5fffffdc,0x7fffcc00,0xffffefff,
0x3e602fff,0xfeefffff,0x4fffbfff,0x7ffffff4,0x0effffff,0x7ff6fffc,
0xffffeeff,0x7fd4005f,0xffffffff,0xffffffff,0xfea800cf,0xffffffff,
0x220002ff,0xfffffffd,0xefffffff,0xfffd3001,0xffffffff,0xfff7001b,
0xffffffff,0x7ecc0009,0xffffffff,0x002dffff,0xffffff50,0x3dffffff,
0xfffff300,0x3e7fffff,0x7ff444ff,0xffffffff,0x8cfff80e,0xfffffffe,
0x910003ff,0xffffffff,0xbfffffff,0xfff70001,0x019dffff,0x3fb26000,
0xffffffff,0xff70002d,0x5dffffff,0xfffd8800,0x001dffff,0xfffd7100,
0x017dffff,0x3ffaa000,0x02dfffff,0x7fffdc40,0x3ffe2eff,0xfffff704,
0x7fc07bff,0x3ffff24f,0x00001dff,0xffffffb5,0x0037bdff,0x13773100,
0x98800000,0x009abcaa,0x57531000,0x53100003,0x00001357,0x009a9880,
0xaa980000,0x9800009a,0x400009ba,0x0000aba8,0x00037510,0xaba99800,
0x00000001,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x10000000,0x00000000,0x00099988,0x00006662,0x00000000,0x00000000,
0x04fffd80,0x3fffe600,0xffe80003,0xffffffff,0xffffffff,0x5fffffff,
0x7fffc000,0xb8800007,0xbdefffed,0xf9800000,0xfff702ff,0x7ffe4005,
0x00bfff71,0x3fee0000,0xffffffff,0x02ceffff,0x3ffffee0,0xffffffff,
0xffffffff,0x3fffe65f,0xfffb0000,0xff30000d,0xffffffff,0xffffffff,
0xffffffff,0x7fd4000b,0x00002fff,0x3fffffee,0x002fffff,0x17fff400,
0x002fffb8,0x7dc7fff2,0x000005ff,0xffffff70,0xffffffff,0x7007dfff,
0xffffffff,0xffffffff,0x8bffffff,0x8005fffc,0x002ffff9,0xfffffd80,
0xffffffff,0xffffffff,0x005fffff,0x3fffff60,0xfe880006,0xffffffff,
0x0005ffff,0x05ffff90,0x800bffee,0xff71fffc,0x000000bf,0x3fffffee,
0xffffffff,0x03ffffff,0x3fffffee,0xffffffff,0xffffffff,0x0ffffc45,
0x17fffa00,0x3ffe6000,0xffffeeef,0xeeeeeeef,0xeeeeeeee,0xfff10004,
0x0003fffd,0xadffffd8,0xfffeb989,0x7cc0004f,0xf702ffff,0x7e4005ff,
0xbfff71ff,0x2e000000,0xeeeeffff,0xffeeeeee,0x704fffff,0xddddffff,
0xdddddddd,0x09dddddd,0x400dfff7,0x001ffffa,0x46fffd80,0x0004fffc,
0xfff70000,0x0009fff3,0x017fffdc,0x007ffff2,0x7ffff440,0x5fff702f,
0x8fffe400,0x0005fffb,0xbfff7000,0x7ff54400,0xffb83fff,0x8000005f,
0xd002fffe,0x00009fff,0xc85ffff3,0x00004fff,0x2dffd000,0x0000fffe,
0x2005ffff,0x0006fffc,0x5ffffffb,0x00bffee0,0xf71fffc8,0x00000bff,
0x017ffee0,0x7ffffdc0,0x02fffdc1,0x7fd40000,0xfffa807f,0xfd80000f,
0xfffc86ff,0x80000004,0xff93fff9,0xff30007f,0x7fc400bf,0xffa8007f,
0x702fffef,0x64005fff,0xfff71fff,0x9999999d,0x00155579,0x00bfff70,
0x2ffffcc0,0x0017ffee,0x7ffec000,0x1ffff403,0x7ffc4000,0x4fffc82f,
0xc8000000,0xfff31fff,0xfff7000d,0xfffd8007,0x3ffe2001,0x702fffbc,
0x64005fff,0xfff71fff,0xffffffff,0x5dffffff,0x3ffee001,0x7fe40005,
0x3ffee1ff,0x30000005,0x2e01ffff,0x00006fff,0x320dfff9,0x00004fff,
0x47fff800,0x4001fffe,0x4001fffd,0x2002fffc,0xfff76ffd,0x0bffee05,
0x71fffc80,0xffffffff,0xffffffff,0x7007ffff,0x8000bfff,0x2e5ffff8,
0x00005fff,0x13fff200,0x00bfffe2,0x3fffe200,0x09fff902,0xfa800000,
0x7ffdc4ff,0x554c4004,0x7ffec000,0x3fff7002,0x5c0bffee,0x32002fff,
0xfff71fff,0xffffffff,0xffffffff,0xffb805ff,0xfb80005f,0x3ffee7ff,
0x20000005,0x641ffff8,0x00005fff,0x640dfff9,0x00004fff,0x0fffec00,
0x003fffe2,0xffe80000,0xfff9800f,0x40bffee3,0x2002fffb,0xff71fffc,
0x333333bf,0xff755333,0x5c03ffff,0x80005fff,0xf71ffff8,0x00000bff,
0x25fffb80,0x001ffff8,0x2ffff880,0x013fff20,0xff880000,0x7fffb06f,
0x2a000000,0xfd006fff,0x2fffb8df,0x007fff70,0xfb8fffe4,0xd88005ff,
0x2e06ffff,0x00005fff,0x3ee7fffd,0x000005ff,0x91fffe80,0x00009fff,
0x901bfff2,0x00009fff,0x27ffdc00,0x006fffa8,0xfffd0000,0x1fff9009,
0x702fffb8,0x6c007fff,0xfff71fff,0x7fe4000b,0xfff700ff,0x3f20000b,
0xbfff75ff,0x50000000,0xfff1bfff,0xf100001f,0xfc807fff,0xaaaaadff,
0xaaaaaaaa,0x7ff4001a,0x3fffe01f,0x5c000001,0x5400ffff,0xffb83fff,
0x7fff702f,0x8fffec00,0x0005fffb,0x40bfffe2,0x0005fffb,0x2ebfff90,
0xaaaaefff,0xaaaaaaaa,0x001aaaaa,0x7ff7fff4,0xf700003f,0xff900fff,
0xffffffff,0xffffffff,0x7ffcc009,0x2fffe406,0xff500000,0xff8805ff,
0x5fff705f,0x013ffee0,0xf71fffe8,0xe8000bff,0x2aaa4fff,0xaaaefffd,
0x801aaaaa,0xff76fffb,0xffffffff,0xffffffff,0x55307fff,0xfff95555,
0x5557ffff,0x7c001555,0xfc803fff,0xffffffff,0xffffffff,0x3ff2004f,
0x7ffcc03f,0xa800000f,0xd805ffff,0xff700fff,0x3ffee05f,0x3fffe005,
0x00bfff71,0x26fffc80,0xffffffff,0xffffffff,0x6fffb803,0xfffffff7,
0xffffffff,0x07ffffff,0xfffffff9,0xffffffff,0x05ffffff,0x01fffee0,
0x7fffffe4,0xffffffff,0x1004ffff,0xd001ffff,0x00007fff,0x0effffa8,
0x017ffdc0,0x2e05fff7,0xf3007fff,0x3fee3fff,0x7e40005f,0x3fffe5ff,
0xffffffff,0xb803ffff,0xfff76fff,0xffffffff,0xffffffff,0xfff907ff,
0xffffffff,0xffffffff,0x3fe005ff,0xff9003ff,0x555555bf,0x55555555,
0x3ffee003,0xdfff7005,0x7fd40000,0x7c400eff,0x7fdc05ff,0xffff702f,
0xfffe8809,0x0bfff71f,0x4fffd800,0x3fff6aaa,0xaaaaaaae,0xfffb801a,
0x55dfff75,0x55555555,0x35555555,0xdddddd70,0xddffffdd,0x3ddddddd,
0x1ffff700,0x13fff200,0x3fa00000,0x99999bff,0xfff99999,0xfb80002f,
0xe800efff,0x7dc00eff,0xfff702ff,0x7fec05ff,0xfff71fff,0x7fc4000b,
0xfff703ff,0x3f20000b,0xbfff75ff,0x80000000,0x0002fffc,0xffffffd0,
0xffffffff,0x0009ffff,0xffff9800,0xffffffff,0x5fffffff,0x7ffe4000,
0xffb800ef,0xfffb801f,0xfffff702,0xfd7315bf,0x2e3fffff,0x20005fff,
0x701ffffd,0x0000bfff,0x7dd3fff6,0x000005ff,0x17ffe400,0x7ffd4000,
0xffffffff,0xffffffff,0x64000004,0xffffffff,0xffffffff,0x8000ffff,
0x05ffffd8,0x33bfff30,0x93333333,0x13337fff,0x3fffffee,0xffffffff,
0xff71fffd,0xfb1000bf,0x7dc09fff,0xf00005ff,0x3fee7fff,0x2000005f,
0x99999998,0x99bfffc9,0x00999999,0x7ffffff4,0xffffffff,0x004fffff,
0x7fffc000,0xffffffff,0xffffffff,0x7f44003f,0x2e004fff,0xffffffff,
0xffffffff,0xf75fffff,0xffffb5ff,0xff39ffff,0x37ffee3f,0x99999999,
0xffffdcaa,0x3fee00ff,0xf880005f,0xfff71fff,0x6400000b,0xffffffff,
0xffffffff,0x202fffff,0xeeeffffa,0xeeeeeeee,0x004ffffe,0x3ffea000,
0x9999999e,0xfc999999,0x3e6006ff,0x4003ffff,0xfffffffb,0xffffffff,
0x75ffffff,0x3ff25fff,0xff33efff,0x3fffee3f,0xffffffff,0xffffffff,
0x7ffdc02f,0xffc80005,0x17ffee6f,0xffc80000,0xffffffff,0xffffffff,
0x3fa02fff,0xfc8004ff,0x000004ff,0x000ffff6,0x017fffc4,0x17ffffcc,
0x7fffdc00,0xffffffff,0xffffffff,0x85fff75f,0xf7000ab9,0xffffffff,
0xffffffff,0xf7001bff,0x98000bff,0x3ee4ffff,0x000005ff,0x3bbbbbae,
0xeeffffee,0x1eeeeeee,0x01ffff30,0x09fff900,0x3fe20000,0x3a0000ff,
0x7c405fff,0x0001ffff,0x55555551,0xfb555555,0x235559ff,0x0002fffb,
0xffffffb8,0xffffffff,0x2001dfff,0x0005fffb,0x70ffffec,0x0000bfff,
0xfffc8000,0x3ff60002,0xff90005f,0x2000009f,0x0005fffb,0x007fffd4,
0x003ffffd,0xff700000,0x3ffee05f,0xffb80002,0xaaaaaaef,0x00019aaa,
0x0017ffee,0x45ffffa8,0x0005fffb,0x7fe40000,0xff30002f,0x320003ff,
0x00004fff,0x005fffd0,0x4ffff880,0x03ffff70,0x2e000000,0xff702fff,
0xf700005f,0x00000bff,0x017ffee0,0x7ffffdc0,0x02fffdc0,0x32000000,
0xb0002fff,0x4000bfff,0x0004fffc,0x0ffff980,0xfffc8000,0x2ffff887,
0x20000000,0xf702fffb,0x700005ff,0x0000bfff,0x17ffee00,0xfffea880,
0xfffb83ff,0x00000005,0x0017ffe4,0x00ffffcc,0xdffff900,0xdddddddd,
0x3ddddddd,0x005fffc8,0x5ffff300,0xeeffffd8,0xeeeeeeee,0x002eeeee,
0x817ffdc0,0x0002fffb,0x005fffb8,0xfff70000,0xdddddddf,0xffffffdd,
0x3fee07ff,0xeeeeeeff,0xeeeeeeee,0x002eeeee,0x0017ffe4,0x0037ffec,
0x3fffff20,0xffffffff,0x1fffffff,0x0017fffc,0x4bfffd00,0xfffffff9,
0xffffffff,0x003fffff,0x817ffdc0,0x0002fffb,0x005fffb8,0xfff70000,
0xffffffff,0xffffffff,0x7ffdc05d,0xffffffff,0xffffffff,0x4003ffff,
0x4002fffc,0x002ffff8,0x7ffffe40,0xffffffff,0x1fffffff,0x001fffea,
0x1ffff700,0x3fffffea,0xffffffff,0x03ffffff,0x17ffdc00,0x002fffb8,
0x05fffb80,0xff700000,0xffffffff,0xdfffffff,0xffff7005,0xffffffff,
0xffffffff,0xc8007fff,0x64002fff,0x80006fff,0xfffffffc,0xffffffff,
0x361fffff,0x00004fff,0xca7fffc4,0xffffffff,0xffffffff,0x0003ffff,
0xa817ffdc,0x80001eee,0x0005fffb,0xffff7000,0xffffffff,0x40039dff,
0xfffffffb,0xffffffff,0xffffffff,0x00000003,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x88000000,0x0009acba,0x00000000,0x206f72e6,0x26660998,
0x566dd440,0x32e20000,0x02cc980a,0x00000000,0x26206662,0x7fdc0099,
0xffffffff,0x02ceffff,0x3ffffea0,0xffffffff,0xffffffff,0xffffff71,
0xffffffff,0x0159ddff,0x7fffdc00,0x202fffff,0x0006fffa,0x205fffb8,
0xffffffea,0xf93ffa3f,0xfffd13ff,0x0019ffff,0xdfffffa8,0x360fff22,
0x20003fff,0x24fffff8,0xffb5fff8,0x3fffc83f,0x7fddbffe,0xffffffff,
0xefffffff,0xffffa803,0xffffffff,0xffffffff,0xfffff71f,0xffffffff,
0xffffffff,0xffea8005,0xffffffff,0xfffa81ef,0xffb80006,0xffff905f,
0x29ffffff,0x3ffe4ffe,0xfffffe8b,0x001fffff,0xfffffff3,0x03fffdff,
0x0007fffb,0x13ffffe2,0x3f6bfff1,0x7ffe41ff,0x7ddbffe3,0xffffffff,
0xffffffff,0x3ea03fff,0xffffffff,0xffffffff,0xff71ffff,0xffffffff,
0xffffffff,0x2009ffff,0xeffffffa,0xffffffed,0x037ffd41,0x2fffdc00,
0x677fffec,0xedfffebb,0x37ffe4ff,0xdbbdffff,0x802fffff,0xffcadffd,
0xb04fffff,0x10007fff,0x107fffff,0x3ff6bfff,0x1fffe41f,0x3feedfff,
0xeeeeeeff,0xffffeeee,0xff504fff,0xddddddff,0xdddddddd,0x3fee3ddd,
0xccccccef,0xfedccccc,0x403fffff,0x02fffff8,0x41dffff7,0x0006fffa,
0x545fffb8,0xf304ffff,0x7c9fffff,0x80dfffff,0x00ffffe8,0x3aa07ff4,
0x3f604fff,0x7cc003ff,0xf103ffff,0x3fff6bff,0xf1fffe41,0x3ffeedff,
0x3f6a2005,0xfa83ffff,0x400006ff,0x0005fffb,0x1fffff91,0x07fffec0,
0x97fffe60,0x0006fffa,0x745fffb8,0x74403fff,0x3fe4ffff,0x74404fff,
0x55404fff,0xb0026202,0x4c007fff,0x203fffff,0x3315fff8,0x41333103,
0xfff72aaa,0x3fea000b,0x7fd41fff,0x5c00006f,0x40005fff,0x103ffffb,
0x2005ffff,0xf50ffffa,0x70000dff,0x7fd4bfff,0xfff5006f,0x7ffffc9f,
0x7fff9800,0x36000000,0xf3003fff,0x8807ffff,0x00005fff,0x00bfff70,
0x2ffffd40,0x001bffea,0x0bfff700,0xdfffb000,0x017ffee0,0x2a3fffd0,
0x80006fff,0x3f65fffb,0x3fa003ff,0x3fffe4ff,0x3fff6003,0xb0000001,
0xf3007fff,0x1005ffff,0x0000bfff,0x017ffee0,0x3ffff700,0x0037ffd4,
0x17ffee00,0x3ffee000,0x07fffb07,0x53fffc80,0x0000dfff,0x7fcbfff7,
0x7fd4007f,0x03fffe4f,0x02fffa80,0x2f36ea60,0x7ffec01a,0x7fffcc03,
0xfff1002f,0x2e00000b,0x80005fff,0x3ea5fffe,0x400006ff,0x0005fffb,
0x80ffff98,0x4001ffed,0xff53fffb,0xf70000df,0x3ffe2bff,0x7ffcc007,
0x001bffe4,0x9809fff3,0xfffffffe,0xffb03fff,0x7ffcc07f,0x3e2002ff,
0x333105ff,0xf7099980,0x70000bff,0x7fd4ffff,0x5c00006f,0x80005fff,
0x0807fffb,0x1fffd800,0x000dfff5,0x26bfff70,0x44006fff,0x3ffe4fff,
0x7ffc4005,0x3fffee05,0xffffffff,0x7ffec0df,0xfffff303,0xfff88005,
0x03fff905,0xffbb7ffc,0xf880005f,0xfff51fff,0xfb80000d,0xd80005ff,
0x00006fff,0x7d4ffff0,0xb80006ff,0xfff55fff,0x9fff000b,0x40027ffc,
0xffd07fff,0xdb99bdff,0xd89fffff,0xff983fff,0x88001fff,0xff905fff,
0xb7ffc03f,0x0005fffb,0x2a7fffd0,0x00006fff,0x002fffdc,0x13fffe20,
0x3ff20000,0x1bffea5f,0x3ffee000,0x009fff55,0x7fc9ffd0,0xfff8003f,
0x2ffffb87,0x3ffff660,0x30ffff60,0x003fffff,0x417ffe20,0x3e01fffc,
0xbfff76ff,0x3ff60000,0x0dfff55f,0xfffb8000,0x3fea0005,0x00000fff,
0x50ffffdc,0x0000dfff,0x3e6bfff7,0xff8005ff,0x013ffe4f,0x3a1fffe0,
0xfd001fff,0x7ffec7ff,0x3ffffe63,0x3fe20001,0x3fff905f,0xfbb7ffc0,
0x900005ff,0x3feabfff,0xaaaaaaff,0xaaaaaaaa,0x05fffb82,0x3ff2a620,
0x00003fff,0x227fffdc,0xeeeffffa,0xeeeeeeee,0xffeeeeee,0x0dfff15f,
0x24fff880,0x44005fff,0x7fcc6fff,0x3fee005f,0x4ffff64f,0x0ffffff9,
0x3ffe2000,0x03fff905,0xffbb7ffc,0xf700005f,0x3ffeadff,0xffffffff,
0x7fffffff,0xeeffffb8,0xfeeeeeee,0xffffffff,0x7e400005,0xffa84fff,
0xffffffff,0xffffffff,0x25ffffff,0x4c007fff,0x3ffe4fff,0x7ffcc006,
0x00f6e4c5,0x6cbfff50,0xfff9bfff,0x0006ffff,0x6417ffe2,0x3fe01fff,
0x0bfff76f,0x3ffee000,0xffffff56,0xffffffff,0xf70fffff,0xffffffff,
0xffffffff,0x0005ffff,0x4ffffc80,0xffffff50,0xffffffff,0xffffffff,
0x7fff4bff,0x3ffea001,0x001fffe4,0x0007fff7,0xb2fffcc0,0xffffbfff,
0x009fffff,0x417ffe20,0x3e01fffc,0xbfff76ff,0x3fee0000,0xfffff56f,
0xffffffff,0x70ffffff,0xffffffff,0xffffffff,0x00017bff,0x4ffffb80,
0x3bfffea0,0xeeeeeeee,0xeeeeeeee,0x3ff25fff,0x3ffa005f,0x0ffffe4f,
0x00ffff80,0xffda8800,0x3ffff65f,0xffd8efff,0xf88002ff,0xfff905ff,
0xbb7ffc03,0x00005fff,0x3eabfff9,0xaaaaafff,0xaaaaaaaa,0xffffb82a,
0xfeeeeeee,0x000cffff,0xffff3000,0x6fffa809,0xfffb8000,0x07fffe25,
0x93fffea0,0x7007ffff,0x8800dfff,0xffffecba,0x3ff65fff,0xf10effff,
0x8001ffff,0xf905fff8,0x7ffc03ff,0x00bfff76,0x53fffa00,0x0006fffa,
0x02fffdc0,0x37ffff22,0xfd800000,0xffa804ff,0xfb80006f,0x7ffdc5ff,
0x3ffa600e,0x3fffe4ff,0x7ffd405f,0xffeb801f,0xffffffff,0x3ff65fff,
0x7d40efff,0x44005fff,0xff905fff,0xb7ffc03f,0x0005fffb,0x2a7ffff0,
0x00006fff,0x802fffdc,0x00fffffa,0x3ffe2000,0xdfff5007,0xfff70000,
0x5ffffd0b,0xffffff50,0x7fffffc9,0x7ffdc41e,0x7ffdc04f,0xffffffff,
0x365fffcd,0x900effff,0x4007ffff,0xf905fff8,0x7ffc03ff,0x00bfff76,
0x5ffff100,0x001bffea,0x0bfff700,0x37fffd40,0xfff30000,0x3ffea007,
0xffb80006,0xfffe985f,0xffffeeff,0x3fe4fffe,0xefffffff,0x0dfffffe,
0x3ffffee0,0x261bceff,0x3ff65fff,0x7ff400ef,0xff1001ff,0x3fff20bf,
0x5dbffe01,0x80005fff,0xf51ffff9,0x80000dff,0x4005fffb,0x005ffffb,
0x05fff700,0x01bffea0,0x17ffee00,0x7ffffec4,0xff9cffff,0x23bffe4f,
0xfffffffe,0x7fd404ff,0x4c00beff,0x3ff65fff,0xfff9803f,0xff8800ef,
0x3fff905f,0xfbb7ffc0,0xc80005ff,0x3fea7fff,0x5c00006f,0xd8005fff,
0x0003ffff,0x001fffc8,0x000dfff5,0x80bfff70,0xefffffeb,0x7c9fff32,
0xfff916ff,0xb003bfff,0x2001bfff,0x3f65fffa,0xff7003ff,0xff100bff,
0x3fff20bf,0x5dbffe01,0x40005fff,0x2a3ffff9,0x00006fff,0x002fffdc,
0x0fffffc4,0x3fff6000,0xdfff5000,0xfff70000,0x055cc00b,0xff93ffe6,
0x0aba886f,0x03fffe00,0x25fffb80,0x2003fffd,0x403ffffd,0xf905fff8,
0x7ffc03ff,0x00bfff76,0x0ffffd80,0x001bffea,0x0bfff700,0x3fffea00,
0x4cc40006,0x3ffea001,0xffb80006,0xf300005f,0x37ffc9ff,0xfff30000,
0xfffe800d,0x00ffff65,0x1fffff88,0x417ffe20,0x3e01fffc,0xbfff76ff,
0x7ffd4000,0x37ffd44f,0x3fee0000,0x3f60005f,0x00004fff,0x6fffa800,
0xfffb8000,0xff300005,0x037ffc9f,0xffff3000,0x3fff2001,0x0ffff65f,
0xdffff500,0x82fffc40,0x3e01fffc,0xbfff76ff,0x3ffee000,0x7ffd40ff,
0x7dc00006,0x220005ff,0x001fffff,0x7fd40000,0xfb80006f,0x300005ff,
0x7ffc9fff,0x3e200006,0xfb804fff,0x3f66ffff,0xfd8003ff,0xff104fff,
0x3fff20bf,0x5dbffe01,0x22005fff,0x2fffffea,0x006fffa8,0x2fffdc00,
0x3ffee000,0x5550006f,0x3fea0035,0xfb80006f,0x300005ff,0x7ffc9fff,
0x7f400006,0xf9302fff,0x6cffffff,0x88003fff,0x882ffffe,0xff905fff,
0xb7ffc03f,0xeeeffffb,0xffeeeeee,0x02ffffff,0x000dfff5,0x05fffb80,
0xffffd800,0xffff8003,0xdfff5004,0xfff70000,0x3e60000b,0x1bffe4ff,
0xfff30000,0xffd9bdff,0xfffd7fff,0x00ffff61,0x7ffffcc0,0x82fffc40,
0x3e01fffc,0xffff76ff,0xffffffff,0xffffffff,0x37ffd405,0x3fee0000,
0xf880005f,0x4000ffff,0x5004ffff,0x0000dfff,0x000bfff7,0xf93ffe60,
0x800006ff,0xfffffffa,0xf70dffff,0x3fff67ff,0x3ff20003,0x7ffc46ff,
0x03fff905,0xffbb7ffc,0xffffffff,0xefffffff,0x7ffd400b,0x7dc00006,
0x700005ff,0x800bffff,0x5004ffff,0x0000dfff,0x000bfff7,0xf93ffe60,
0x000006ff,0xffffffb1,0xfff985df,0x007fffb6,0x4ffffe80,0x6417ffe2,
0x3fe01fff,0xfffff76f,0xdfffffff,0x5400379b,0x00006fff,0x002fffdc,
0x5ffffd00,0x27fffc00,0x06fffa80,0x5fffb800,0xddd30000,0x002f7747,
0x2ea62000,0xffd8001a,0x7cc0003f,0xff12ffff,0x3fff20bf,0x01bffe01,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0xcdcba800,0x2a20001a,0x0001aacb,
0x19999800,0x00000000,0x00ccccc0,0x10000000,0x00001333,0x00000000,
0x84cccc00,0x00006fff,0x0001bffe,0x7fffe440,0x002effff,0x7fffffe4,
0x007fffb6,0x7fffe400,0x7ffffe42,0x3fe00006,0x7fcc6fff,0x3fff24ff,
0x7d40000f,0xfff304ff,0x3fee01ff,0xffffffff,0x2defffff,0x7ffffec0,
0xffffffff,0xff801bde,0x0dfff3ff,0x37ffc000,0x7fcc0000,0xffffffff,
0xff9005ff,0x36bfffff,0x00003fff,0x3237fff4,0x01ffffff,0xffffa800,
0x37ffec6f,0x017ffff2,0x09fff500,0xdfffffd1,0x3ffffee0,0xffffffff,
0x0bffffff,0xffffffd8,0xffffffff,0x3e01efff,0xdfff3fff,0x7ffc0000,
0x7d400006,0xecdeffff,0x404fffff,0xfffffffa,0x07fffb3f,0xffe88000,
0x3ffff22f,0xd80003ff,0x266fffff,0x7e40ffff,0x0003ffff,0x3613ffea,
0x5fffcfff,0xffffffb8,0xffffffff,0x0effffff,0x7fffffec,0xffffffff,
0xf02fffff,0x3ffe7fff,0x3fe00006,0x2200006f,0x981effff,0x202ffffc,
0x31befffd,0x00ffff61,0x3ffe6000,0x3fffff26,0xff80006f,0x3f66ffff,
0xfffc81ff,0x50000fff,0xffb89fff,0x87fff95f,0xeeeffffb,0xeeeeeeee,
0x45ffffff,0xeeeefffd,0xffeeeeee,0xf81fffff,0xdfff3fff,0x7ffc0000,
0x3f600006,0x7dc00dff,0x3ffa06ff,0x3fff600f,0xf5000003,0x3fff23ff,
0x0001ffff,0x3fffffea,0x207fff36,0x5ffffffc,0x9fff5000,0xd07fffcc,
0x7fdc5fff,0xffb8005f,0x3ff64fff,0x3f62003f,0x99986fff,0x00dfff09,
0x037ffc00,0xffff8800,0x1fffd001,0xb01fffe0,0x00007fff,0xfcaffdc0,
0x03fffdff,0x3fbff600,0x0bff96ff,0x7fffffe4,0xffa8003f,0x5ffff14f,
0x70ffff98,0x2000bfff,0xb0ffffe9,0x70007fff,0x2001ffff,0x00006fff,
0x0001bffe,0x002fffdc,0xf103dff7,0xffd80dff,0x0000003f,0x7fdfffe4,
0xff10006f,0x00dfff7f,0xffffffc8,0x7d4000ff,0x700004ff,0x4000bfff,
0xfb1ffffa,0x3a0007ff,0xff002fff,0x7c0000df,0xb00006ff,0x08003fff,
0x02fffc40,0x000ffff6,0xfff90000,0x003fff95,0xff3fff50,0xffc800df,
0x05ffffcf,0x027ffd40,0x5fffb800,0x7fffc000,0x007fffb3,0x017fff20,
0x88037ffc,0xfff81999,0x0accb986,0x007fffc0,0x7cccc400,0x09999eff,
0x000ffff6,0x90ccc400,0xfff55fff,0x9ffb0007,0x262dfff1,0x3fff2019,
0x03ffffab,0x813ffea0,0x7dc01998,0x6c0005ff,0xfffb5fff,0x3fea0007,
0xdfff006f,0x9ffff700,0x7dcdfff0,0x3effffff,0x007fff88,0xfffff900,
0x45ffffff,0x0003fffd,0x23fff900,0xfff2fffc,0xfff8800d,0xf96fff89,
0x3ff203ff,0x1ffffb3f,0x13ffea00,0x201fffc8,0x0005fffb,0xfdb7ffdc,
0xf70003ff,0x3fe007ff,0x7ffdc06f,0x1dfff03f,0xfffffffb,0xff887fff,
0xf900006f,0xffffffff,0x7ffec5ff,0xf9000003,0x3fff23ff,0x003fff92,
0xff8bffd4,0x03fff96f,0x7c4ffff2,0xf5005fff,0x7fe409ff,0x3ffee01f,
0x7fe40005,0x07fffb5f,0x07fff600,0x7037ffc0,0x7c07ffff,0xffffefff,
0xfffffede,0x01bffe63,0x7f775c00,0x1eeeefff,0x000ffff6,0x8fffe400,
0xff32fffc,0x7fec007f,0x32dfff14,0xff901fff,0x7fffd47f,0x4fffa803,
0x807fff20,0x0005fffb,0xfd9ffff4,0xf98003ff,0x3fe007ff,0xffff506f,
0xfffff807,0x7f4c0aef,0xfff10fff,0xf100000d,0xffd80bff,0x9000003f,
0x3ff23fff,0x01bffe2f,0xf88fffc4,0x3fff96ff,0xb0ffff20,0xa801ffff,
0x3f204fff,0x3fee01ff,0x3ea0005f,0xfffb2fff,0xfffc8007,0x3ffe001f,
0x3ffffa86,0x6fffff80,0x17fffc40,0x0000ffff,0x80bfff10,0x0003fffd,
0x23fff900,0x3f22fffc,0xffb801ff,0x65bffe26,0xff901fff,0xffff887f,
0x27ffd405,0x403fff90,0x0005fffb,0x6cdffff3,0xccccefff,0xffdccccc,
0x7c001eff,0x7ffd46ff,0xffff002f,0xfff9001d,0x007fff49,0x7c406aa0,
0x7fec05ff,0x9000003f,0x3ff23fff,0x0fffe62f,0xf893ff60,0x3fff96ff,
0x20ffff20,0x203ffffa,0x3204fffa,0x3ee01fff,0x262005ff,0x22fffffd,
0xfffffffd,0xffffffff,0xf8000eff,0x3ffea6ff,0x3ffe002f,0xfff3003f,
0x00fffecb,0x10dfff10,0xfd80bfff,0x000003ff,0x3f23fff9,0x37ffc2ff,
0x887ffe20,0xfff96fff,0x0ffff203,0x807fffec,0x3204fffa,0x3ee01fff,
0xeeeeefff,0xffffeeee,0x7ec5ffff,0xffffffff,0xffffffff,0x7fc000cf,
0x5ffff56f,0x2ffff800,0x4bfff100,0x2005fffb,0xf883fffb,0x7fec05ff,
0x9000003f,0x3ff23fff,0x0fffe42f,0xf88dff70,0x3fff96ff,0x40ffff20,
0x506ffff8,0x7e409fff,0x3fee01ff,0xffffffff,0xffffffff,0x7fec0cff,
0xffffffff,0xffffffff,0x3fe002ff,0x4ffffaef,0x0ffff800,0x4dfff100,
0x001ffff8,0xf101fffd,0xffd80bff,0x9000003f,0x3ff23fff,0x1fffcc2f,
0xf887ffd0,0x3fff96ff,0x80ffff20,0xa83ffffb,0x3f204fff,0x3fee01ff,
0xffffffff,0xffffffff,0x9fffb01d,0x33333333,0xffffb753,0x3ffe007f,
0x0fffffff,0x03fffc00,0xb8dfff10,0x6400efff,0xff106fff,0xfffd80bf,
0xf9000003,0x3fff23ff,0x106fff82,0xff881fff,0x03fff96f,0xb00ffff2,
0xfa81ffff,0x3ff204ff,0x3ffee01f,0xffffffff,0x01acceef,0x001fffec,
0x0fffffd4,0x3fe35555,0xffffffff,0x37ffc006,0x0dfff100,0x815ffffd,
0x00ffffd8,0xd80bfff1,0x00003fff,0x323fff90,0xffc82fff,0x86ffb80f,
0xff96fff8,0x3fff203f,0x7fffc403,0x027ffd46,0x5c03fff9,0x00005fff,
0x007fffb0,0x97fffa20,0xfff3ffff,0xffff7fff,0x37ffc007,0x0dfff100,
0xdffffff3,0x5ffffffd,0x02fffc40,0x000ffff6,0x8fffe400,0xf982fffc,
0x3ffe83ff,0xf96fff88,0x3ff203ff,0xfffb803f,0x13ffea3f,0x201fffc8,
0x0005fffb,0x07fffb00,0x7fffe400,0x3e7ffff0,0xff71ffff,0x3fe003ff,
0x3fe2006f,0xfffb106f,0xffffffff,0x5fff8805,0x01fffec0,0xfffc8000,
0x205fff91,0x7fc46fff,0x6fff880f,0x3203fff9,0xfb003fff,0x3fea1fff,
0x3fff204f,0x17ffee01,0x7fec0000,0x3e60003f,0xffff1fff,0xb07fffe7,
0x3e00dfff,0x3e2006ff,0x7f5406ff,0x04ffffff,0x80bfff10,0x0003fffd,
0x23fff900,0xf902fffc,0x37fdc3ff,0xf96fff88,0x3ff203ff,0xfff1003f,
0x13ffeadf,0x201fffc8,0x0005fffb,0x07fffb00,0x2ffff800,0x3fe7ffff,
0xffff886f,0x06fff803,0x01bffe20,0x00d6ffcc,0x017ffe20,0x0007fffb,
0x47fff200,0xf302fffc,0x1fff49ff,0xf96fff88,0x3ff203ff,0x3fee003f,
0x4fffabff,0x807fff20,0x0005fffb,0x07fffb00,0x7fffc400,0x837ffc01,
0x401ffffb,0x22006fff,0xf9006fff,0xf100019f,0xffd80bff,0x9000003f,
0x3ff23fff,0x5bffa02f,0xf100fff9,0x3fff2dff,0x07fff901,0xcffffd80,
0x3f204fff,0x3fee01ff,0xb000005f,0x40007fff,0x400ffffa,0x3fa06fff,
0x7ffc06ff,0x3ffe2006,0xffffd006,0x7fc4001b,0x7ffec05f,0xf9000003,
0x3fff23ff,0x27fff202,0x3e205ffc,0x3fff96ff,0x00ffff20,0xffffff10,
0x7fe409ff,0x3ffee01f,0xfb000005,0x6c0007ff,0xff806fff,0x3ffe606f,
0x1bffe03f,0x06fff880,0x0fffea20,0x05fff880,0x001fffec,0x1fffc800,
0x4c05fff9,0x2ffebfff,0x65bffe20,0xff901fff,0xff70007f,0x409fffff,
0x2e01fffc,0x00005fff,0x007fffb0,0x13fffee0,0x901bffe0,0x3e03ffff,
0x3e2006ff,0xfd8006ff,0x3fe2007f,0x7ffec05f,0xf9000003,0x3fff23ff,
0x7ffff402,0x3fe200ff,0x03fff96f,0x000ffff2,0x7fffffec,0x07fff204,
0x005fffb8,0x7fffb000,0xfffda800,0xfff800ff,0x6fffe806,0x400dfff0,
0x1006fff8,0x00dfff73,0x202fffc4,0xeeeefffd,0xeeeeeeee,0xf901eeee,
0x3fff23ff,0x7fffe402,0x7ffc405f,0x203fff96,0x0003fffc,0x9ffffff1,
0x00fffe40,0x000bfff7,0x3bfff600,0xeeeeeeee,0xffffffee,0xdfff001f,
0x7ffff300,0x400dfff0,0x2606fff8,0xffffffff,0x3ffe2002,0x7fffec05,
0xffffffff,0x1fffffff,0x323fff90,0x7cc02fff,0x4402ffff,0xfff96fff,
0x0ffff203,0xffffb800,0x3fff204f,0x17ffee01,0x7fec0000,0xffffffff,
0xffffffff,0x3fe003ff,0xfff9006f,0x06fff83f,0x81bffe20,0xfffffff9,
0x7ffc4002,0x7fffec05,0xffffffff,0x1fffffff,0x323fff90,0xfe802fff,
0xff8807ff,0x03fff96f,0x000ffff2,0x09ffffb0,0x700fffe4,0x0000bfff,
0x3fffff60,0xffffffff,0x00cfffff,0x8037ffc0,0x7c6ffff8,0x3e2006ff,
0x332606ff,0x10002cce,0xfd80bfff,0xffffffff,0xffffffff,0xfff901ff,
0x00bfff23,0x2017fff2,0xff96fff8,0x3fff203f,0x7fc40003,0x3ff204ff,
0x3ffee01f,0xfb000005,0xffffffff,0x79bddfff,0x00000001,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x97100000,0x05991017,0x00000100,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x26000000,0x2a200999,0x7ffd400a,0x3ff22dff,
0x81322003,0x4c5ffff8,0xffffffff,0xffffffff,0x25ffffff,0x004ffffb,
0x3ffff600,0x3ffffa20,0x7fd40000,0x3ffe61ff,0xfff70007,0x3f2000ff,
0xfffff4ff,0xffffffff,0xffffffff,0x3f27ffff,0x800007ff,0x3fe1ffff,
0xffd103ff,0x7fffc405,0xffefffff,0x9ff7001f,0x2ffffc40,0x3fffffe6,
0xffffffff,0xffffffff,0x0fffff45,0x7ffdc000,0xffff983f,0x3fe20005,
0xffff83ff,0xfffd8001,0xfe8001ff,0xfffff2ff,0xffffffff,0xffffffff,
0x3e67ffff,0x00002fff,0xff1bffea,0xffd107ff,0x77fe405f,0xffffffca,
0xfff5005f,0x7fffc409,0x7ffffcc5,0xffffffff,0xffffffff,0x7fffcc5f,
0x7fc40006,0x3fee05ff,0xfd0003ff,0x3ff60bff,0xfff8003f,0x44003fff,
0x3ffe7fff,0xffffffff,0xffffffff,0x23ffffff,0x0005fffe,0xf0ffff60,
0xffb87fff,0x3fa02fff,0x7fff541f,0xfff5000d,0x7fffc409,0x777774c5,
0xeeeeeeee,0xfffeeeee,0xffffb84f,0x3ff60004,0x7ff400ff,0x7e4001ff,
0xff700fff,0xffa800bf,0x4005ffff,0x3b65fffa,0xeeeeeeee,0xeeeffffe,
0x2eeeeeee,0x003fffee,0x3fffe200,0xa9ffffc0,0x2fffffff,0x9880aaa0,
0x7ffd4000,0x3fffe204,0xe8800005,0xfd00ffff,0x50003fff,0x1005ffff,
0x400dffff,0x202ffffa,0x4007fff9,0x7ffdfffc,0x1fffe400,0x37ffd400,
0xffff8800,0xffb80002,0x0999985f,0xffb3bff9,0x00000005,0x8813ffea,
0x0005ffff,0x1ffffe80,0x1bfffe60,0xbffff100,0x7fffd400,0xffff8804,
0x0ffff804,0x2f7ffa00,0x3a002fff,0xa8001fff,0x20006fff,0x0005fffc,
0x002fffe8,0x2ffd8772,0x50000000,0x7c409fff,0x00005fff,0x01ffffec,
0x01ffffdc,0x01dfffb0,0x1ffffd80,0x037fff40,0x002fffd8,0xff17fff1,
0x3fe2009f,0xff50007f,0x7cc000df,0x20000fff,0x4007fff9,0x002ffd80,
0x157b9531,0x7fdccc00,0x220999cf,0x0005ffff,0x13ffff20,0x1ffffe80,
0x1ffffa80,0xfffe8800,0xffff900f,0x3ffee001,0x3fff7004,0x5401bffa,
0x50004fff,0x8000dfff,0x0003fffe,0x0013fff2,0x200bff60,0xfffffffc,
0x7fcc02ff,0xffffffff,0x027fffc3,0xffffb800,0x7ffcc006,0x7ffc406f,
0x3e60004f,0xffa85fff,0x3e6002ff,0xffb006ff,0x007ffe4d,0x0017ffe4,
0x006fffa8,0x037ffdc0,0x01ffff00,0x05ffb000,0x7fffffd4,0x0dffffff,
0xffffff30,0xff87ffff,0x980004ff,0x000fffff,0x03ffffb8,0x001bfff6,
0x8bffff20,0x004ffff8,0x800ffff8,0x3fea4fff,0xfffe802f,0xfff50000,
0xff88000d,0xfa8000ff,0xb00005ff,0x3fea05ff,0xfdcdefff,0x881fffff,
0xeffffeee,0x7fff42ee,0x7fc40003,0x20001fff,0xa80ffffe,0x0001ffff,
0x21ffffd0,0x0006fffd,0x9803fff9,0x3fe22fff,0x7ffc405f,0x3fea0006,
0xfd80006f,0xfd8003ff,0xb00002ff,0xfff105ff,0x3fee03df,0x7fd406ff,
0x7fff404f,0x7ff40003,0x4c0003ff,0xfe85ffff,0x200004ff,0xfbdffff9,
0x50000fff,0xfb807fff,0x3fff40ff,0x013ffea0,0x06fffa80,0x6fffa800,
0x3fffc400,0x5ffb0000,0x01bfffb0,0x03fffe98,0xb013ffea,0x40005fff,
0x004ffffc,0x5ffff700,0x0037ffe4,0x7fffdc00,0x0002ffff,0xd017ffe2,
0xfff70dff,0x0fffe403,0xdfff5000,0x3ffe0000,0x3fee001f,0x3600004f,
0x7ffd42ff,0xfff5000f,0x3ffea01f,0x0fffec04,0xffffa800,0x7f400006,
0xffff36ff,0x36000003,0x04ffffff,0x07ffe800,0x260fffe2,0x3fa03fff,
0x7d40007f,0x900006ff,0x74009fff,0x00001fff,0xffb0bff6,0xffe8007f,
0x9fff503f,0x01fffc80,0xfffff980,0x7cc00000,0xfffdbfff,0x22000003,
0x006fffff,0x03fff900,0x7c07ffea,0xfff106ff,0xffa8000b,0xf300006f,
0x3e600fff,0x400006ff,0x7ff42ffd,0x7fd4000f,0x9fff504f,0x00fffc80,
0x7ffff440,0xf7000001,0x0bffffff,0xff900000,0x20000bff,0xf903fffa,
0x7ffec0ff,0x03fffa80,0x37ffd400,0xfffd0000,0x5fff9005,0xffd80000,
0x0037ffc2,0xa837ffc4,0x7dc04fff,0x7ec000ff,0x00002fff,0x7fffff40,
0x4000000f,0x3ffffff9,0xfff88000,0x40bfff05,0xfc82fffb,0x540001ff,
0x00006fff,0x2017ffea,0x0000ffff,0xbfff3000,0x1fffe000,0x2027ffd4,
0x64007ffb,0x0004ffff,0xffff9800,0x4000002f,0xfffffff8,0xfe80001f,
0x2fff986f,0x213ffe20,0x80007ffe,0x0006fffa,0x203fffc0,0x0004fffa,
0x3ffea000,0xffff0004,0x09fff501,0x2007ffa8,0x005ffffa,0x3ff20000,
0x8000006f,0xfffefffd,0xfc80006f,0x7ffdc0ff,0x437ff400,0x80004fff,
0x0006fffa,0x017ffe40,0x2003fffb,0x3fe0aaaa,0xfff703ff,0x3ffa0009,
0x4fffa81f,0x803ffcc0,0x00effff9,0x3ee00000,0x000005ff,0x5cffffdc,
0x0004ffff,0x3617ffcc,0xffc806ff,0x0bffe60f,0x3ffea000,0x7cc00006,
0xfff105ff,0x7fffc00d,0x40ffffe3,0x0004fffa,0xf501ffff,0xff9809ff,
0xfffe8806,0x0000001f,0x002fffdc,0xffff3000,0x0ffffec7,0x13ffe000,
0xf5009fff,0x7ffdc3ff,0xffa80000,0xe800006f,0xffb80fff,0x3ffe003f,
0x0ffffe3f,0x002fffcc,0xa83fffc4,0x7c404fff,0xfffd806f,0x0000002f,
0x005fffb8,0xfffd1000,0xfffff88d,0x3ff60000,0x007ffea6,0xfd8fffe2,
0xf500006f,0x00000dff,0xfd07fff7,0x7fc001ff,0x3fffe3ff,0x0dfff103,
0x0ffff300,0x1013ffea,0xffc80bff,0x000004ff,0x0bfff700,0x3ff60000,
0xfffa80ff,0x3ee0005f,0x0fff90ff,0xff2fff40,0x2a00009f,0x00006fff,
0x446fff88,0x7c005fff,0x3ffe3fff,0x3fffe03f,0x7ffdc000,0x09fff505,
0x7d409ff0,0x00005fff,0x3ffee000,0xfb800005,0x3f602fff,0x30003fff,
0x3ffa3fff,0x5ffee005,0x0001fff9,0x00dfff50,0x3fff6000,0x007fff20,
0xfff17f40,0x7ffec05f,0x7fff4004,0x09fff502,0xffff3000,0x0000001d,
0x02fffdc0,0x3ffe6000,0x7ff4405f,0xff0000ff,0x07fff17f,0x547ffcc0,
0x200007ff,0x0006fffa,0x47fff500,0x10006ffe,0x7fff41ff,0x3fffe601,
0xffff7000,0x13ffe601,0xfffd1000,0x0000003f,0x05fffb80,0x7fff4000,
0xfff9800e,0xffb0006f,0x001fff5b,0xffcafff8,0x3ea00005,0x000006ff,
0x7fcdbffe,0xdf50003f,0x400fffc8,0x400efffc,0x204ffffa,0x0006fff9,
0x00ffffec,0x5c000000,0x00005fff,0x007ffff2,0x04ffffc8,0xfceffb80,
0xffd8006f,0x0003ffec,0x01bffea0,0xfffc8000,0x000fffb8,0x7dc5fe88,
0xfff8806f,0x7e440aff,0x7c406fff,0x41abdfff,0x3f21aaaa,0x00002fff,
0xfff70000,0x3ea0000b,0xe8003fff,0x4001ffff,0x4ffffff9,0xfeffb800,
0x200001ff,0x0006fffa,0x2fffe200,0x88005ffe,0x7fd40efe,0xffff5005,
0xffffddff,0xff001dff,0xf8bfffff,0xfff13fff,0xddddddff,0xdddddddd,
0x01dddddd,0x17ffee00,0x3ffe2000,0xff10006f,0xf8001fff,0x002fffff,
0x7fffff88,0x7fd40000,0x4000006f,0x2fffeffd,0x220bb000,0x362004ff,
0xffffffff,0x3000dfff,0x8dffffff,0xff13ffff,0xffffffff,0xffffffff,
0x3fffffff,0x3ffee000,0xffe80005,0x2e0000ff,0x4005ffff,0x00fffffc,
0x9ffffd00,0xffa80000,0x4000006f,0x07fffffa,0x15500200,0xfffd7000,
0x003bffff,0xfffffb30,0xf13ffff8,0xffffffff,0xffffffff,0xffffffff,
0x3fee0003,0x7e40005f,0x80002fff,0x003ffffd,0x017fffea,0x2ffffc80,
0x7fd40000,0x8000006f,0x004fffff,0x80000000,0x0009aba9,0xff013100,
0x3ffe27ff,0xffffffff,0xffffffff,0x01ffffff,0x0bfff700,0x7fffd400,
0xff100004,0x22001fff,0x0003ffff,0x003fffea,0xdfff5000,0xf9000000,
0x00001fff,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0xcb980000,0x5c199502,0xcccccccc,
0xcccccccc,0xddd53ccc,0xdddddddd,0xdddddddd,0x75c00ddd,0x000000ee,
0x4c400500,0x00accdcb,0x15e6dd44,0x6dd4c000,0x40001abc,0x01acdcba,
0x5e654c00,0x2666000a,0x04ccc000,0xfff90000,0x7ff439ff,0x3fffffa0,
0xffffffff,0x56ffffff,0x0b000003,0x007ffe40,0xcdba8800,0x00dfc82b,
0x3fffffea,0x4c1effff,0xffffffff,0x3a6000bf,0xffffffff,0x322003ff,
0xffffffff,0x7fdc002e,0x2fffffff,0x02fffc40,0x3e9fff30,0x3ff63fff,
0xffffb85f,0xfffeffff,0x7fffff47,0xffffffff,0x56ffffff,0x0b000003,
0x007ffe40,0x3fffea00,0xa8bfffff,0xffb106ff,0xffffffff,0x3fee3fff,
0xffffffff,0xffb800ef,0xffffffff,0x4c00dfff,0xffffffff,0x8805ffff,
0xfffffffd,0x100dffff,0x4c00bfff,0xffff4fff,0x42fffec7,0xffdacfff,
0x742fffff,0xffffffff,0xffffffff,0x00355fff,0x6400b000,0x10000fff,
0xfffffffb,0xffffffff,0xffffd101,0xffd999bd,0xffffdfff,0xfffd99bd,
0x7ff401df,0xedccdeff,0x204fffff,0xdefffffa,0x4fffffec,0x3ffffe60,
0xffffdcde,0xfff880ef,0x3ffe6005,0x6c7ffff4,0x7fc45fff,0x7fffe446,
0x99999883,0x99999999,0x50efffc9,0x0b000003,0x007ffe40,0x7ffffc40,
0xfffeccdf,0xff902fff,0x7f4c03df,0x02ffffff,0x20dfffd3,0x202ffffb,
0x80ffffd9,0x81effff8,0x02ffffc9,0x203dfffd,0x885ffff9,0x26005fff,
0xffff4fff,0x22fffec7,0x06601aa8,0x3fe60000,0x0006a1ff,0xfc801600,
0xfd8000ff,0xfd303fff,0x3fe05fff,0xfff5006f,0xfb001dff,0xfffd05ff,
0x3fffa003,0x0dfffd83,0x437ffdc0,0x8806fffb,0x7c41fffe,0x3e6005ff,
0x7ffff4ff,0x002fffec,0xd1000000,0x01a85fff,0x20058000,0x4000fffc,
0x401ffffa,0xa86ffffb,0x3e003fff,0x1002ffff,0xff98dfff,0x3fee005f,
0x7fffc44f,0x1fffd001,0x007fffc4,0x446fff98,0x26005fff,0xfffd4fff,
0x02fffe47,0xb0000000,0x03509fff,0x400b0000,0x2000fffc,0x402ffff8,
0x2ffffff9,0x0007f6dc,0x800bfffd,0x3260fffc,0x3ea001ed,0x7ffdc5ff,
0x3bfee005,0x00ffff21,0x443fffb0,0x26005fff,0xfffb4fff,0x9a7ffdc5,
0xccb98099,0x2a00001a,0x1a80ffff,0x26580000,0xc9999999,0x9999afff,
0x3fee0999,0x7ff4406f,0x0006fffc,0x00ffff60,0x003fff50,0x17ffe600,
0x8003fffb,0x03fffb00,0x23fffb80,0x2005fff8,0xff74fff9,0x97ffcc1f,
0x3ff23fff,0x02ffffff,0x7fffc400,0x00003502,0x3fffe6b0,0xffffffff,
0xffffffff,0x00bfff26,0xfff17ffb,0xb988000f,0x4002fffe,0x0003fff9,
0x2fffed44,0x0003fffe,0x007fff40,0x893ffe60,0x26005fff,0xfff54fff,
0xff1fff88,0x3ffff67f,0x04ffffff,0x17fff200,0x800001a8,0xffffff35,
0xffffffff,0x4dffffff,0x2e01fffd,0x3fff65ff,0xdb751000,0xdfffffff,
0xdddddddd,0x9fffdddd,0x3b2ea200,0x5fffffff,0x001fffe2,0xeeffff80,
0xeeeeeeee,0x25fffeee,0x2005fff8,0xff14fff9,0x7fcfff0d,0xdffffdcf,
0x4ffffffe,0xffff9800,0x00006a00,0x7fffcd60,0xffffffff,0xffffffff,
0x403fffa6,0x3f20eff9,0xfb7101ff,0xffffffff,0xffffffff,0xffffffff,
0x5c0dffff,0xfffffffe,0x25ffffff,0x0006fff8,0xffffff10,0xffffffff,
0x4dffffff,0x2005fff8,0x3fe4fff9,0x3fe6fd85,0x441dffff,0x007ffffa,
0x404fffd8,0x5800001a,0x99999991,0x999fffd9,0x7c799999,0xfff107ff,
0x82fffb83,0xfffffff9,0xffecefff,0xffffffff,0xffffffff,0xffffb87f,
0xdfffffff,0x3e65fffc,0x300006ff,0xffffffff,0xffffffff,0x7c4fffff,
0x3e6005ff,0x206aa4ff,0x3fffe1a9,0x7ffcc04f,0x3fe6002f,0x00d401ff,
0x9002c000,0x22001fff,0xffd06fff,0x87fff705,0xeffffffa,0x3ff60abd,
0xaaaaaabf,0xaaaaaaaa,0x7fffdc2a,0x21bcefff,0x3e25fff9,0x300006ff,
0x5555dfff,0x55555555,0x7c455555,0x3e6005ff,0x3e0004ff,0xf9006fff,
0x7e4009ff,0x01a805ff,0x20058000,0x2000fffc,0xffc87fff,0x45fff904,
0x0adffffa,0x00fffec0,0xffff5000,0xff98017d,0x03fffc5f,0x6fff8800,
0x7fc40000,0x3fea006f,0x02cc884f,0x400bfffe,0x2005fffa,0xa802ffff,
0x05800001,0x003fff20,0x7d47ffe8,0x3fff606f,0x013fff61,0x002fffd8,
0x37fff600,0xbfff5000,0x000fffe8,0x3ffe0d54,0x2200000f,0x2a006fff,
0xffb84fff,0x07fffe03,0x02fffcc0,0x007fffa8,0xb0000035,0x07ffe400,
0x23fffb00,0x3a00fff8,0x3ffe27ff,0x7fff4007,0x4d64c003,0x003fffe0,
0x6c5fffb8,0x22001fff,0x3ff66fff,0x4d44001f,0x006fff80,0x3613fff2,
0x3ffe01ff,0xfff1000f,0x3fff600b,0x00035003,0x7e400b00,0x3f2000ff,
0x05ffd3ff,0xf537ffc4,0x7cc00bff,0x64005fff,0xfff34fff,0xfffe800d,
0x02fffdc5,0x647fff70,0x64005fff,0x7ffc5fff,0x3fffa007,0x0cffff84,
0x2007fff8,0x8806fff8,0x5000ffff,0x0b000003,0x007ffe40,0xf9dfff50,
0xfffc809f,0x01fffea5,0x3fffffd8,0x1ffff100,0x003fffe6,0x22ffffe4,
0x001ffff8,0x7c41fffd,0xf1002fff,0xffe83fff,0xfffc803f,0x7f65444f,
0x37ffc0ff,0x0dfff100,0x00bfff90,0x400000d4,0x3fff2005,0x3ffe2000,
0x7c406fff,0x3fe22fff,0xffc802ff,0x403fffff,0x225fffe8,0xb804ffff,
0xb86fffff,0x6400efff,0xffb86fff,0x7f4401ff,0xfffc86ff,0x3ffee00f,
0x7ffc04ff,0x0037ffc3,0xf00dfff1,0x54003fff,0x05800001,0x003fff20,
0x1fffff70,0x27fff440,0x80f7fff4,0xfccfffea,0x540acfff,0x740ffffe,
0x9302ffff,0x0fffffff,0x02bffffa,0x01ffffb1,0x033ffffa,0x3ffffd93,
0x7dffff30,0x3fff2a21,0x3e604fff,0x37ffc5ff,0x0dfff100,0x006fffa8,
0x400000d4,0x0aaa6005,0x7ffff400,0x7ffd440c,0xfff980ef,0xfedcceff,
0x3fee1eff,0xffeeffff,0xf981ffff,0xecdeffff,0xfebfffff,0xfff980ff,
0xfffeefff,0x3a602fff,0xfeffffff,0x02ffffff,0x3ffffff6,0xe9ffffff,
0xdb9934ff,0xff85ffff,0x3fe2006f,0x7ffec06f,0x000d4003,0x00002c00,
0x3ffff600,0xfffeeeff,0x3ee01fff,0xffffffff,0xffa80dff,0xffffffff,
0x3fea01ef,0xffffffff,0x7fff70df,0x3ffff620,0x2fffffff,0xffffc880,
0xffffffff,0xffffc802,0xd1efffff,0x3ffee9ff,0xff84ffff,0x3fe2006f,
0x7fffc06f,0x000d4000,0xccc8ac00,0xcccccccc,0xcccccccc,0x7fffdc3c,
0xffffffff,0xd8801eff,0xceffffff,0x7ff64c02,0x002effff,0xffffffb1,
0xfff985df,0x7fff5406,0x8004ffff,0xffffffda,0x754003ff,0x0cefffff,
0x7fe53ffa,0xff01dfff,0x7fc400df,0x3ffe606f,0x001a8007,0xfff35800,
0xffffffff,0xffffffff,0x477fccdf,0xffffffd9,0x988002ef,0x200009ba,
0x00009ab9,0x00357531,0x2aea6000,0x75100001,0x30000135,0x31000157,
0x0dfff001,0x037ffc40,0x000bfff7,0xb0000035,0x3fffffe6,0xffffffff,
0x26ffffff,0x54c41ffa,0x000009ab,0x00000000,0x00000000,0x00000000,
0x00000000,0x801bffe0,0x3606fff8,0xa8004fff,0x35800001,0xffffffff,
0xffffffff,0x298dffff,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x4400dfff,0x3fa06fff,0xda8002ff,0xcccccccc,0xcccccccc,
0x0006cccc,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0xdfff0000,0x37ffc400,0x003ffff0,0x20000000,0x88888888,0x88888888,
0x88888888,0x3fffff20,0xffffffff,0xffffffff,0x0002ffff,0x00000000,
0x00000000,0x00000000,0xff000000,0x7fc400df,0xffff106f,0x00000001,
0xfffff900,0xffffffff,0xffffffff,0x3f25ffff,0xffffffff,0xffffffff,
0xffffffff,0x00000002,0x00000000,0x00000000,0x00000000,0x00dfff00,
0x9837ffc4,0x00006fff,0xff900000,0xffffffff,0xffffffff,0x5fffffff,
0x3bbbbbb2,0xeeeeeeee,0xeeeeeeee,0x00002eee,0x00000000,0x00000000,
0x00000000,0xfff00000,0x7ffc400d,0x0bfff506,0x00000000,0x3bbbbbae,
0xeeeeeeee,0xeeeeeeee,0x00001eee,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0xca980000,0x00009acd,0x2af72a62,
0x82666000,0x9980acb8,0x26200199,0x4ccc0999,0x0bcdb980,0x0abcb980,
0x00133310,0x4c426660,0x26620019,0x86662001,0xcb980999,0x999801ac,
0x99999999,0x09999999,0x0a200000,0x200ddd44,0xffffffb8,0x4000efff,
0xfffffffc,0x7fc402ff,0xfffff73f,0x7fffdc3b,0xdfffb002,0x7ec7fff0,
0x85ffffff,0xffffffd8,0x7fff883f,0x4fffb800,0x2005fff9,0x8802ffff,
0x3ffe5fff,0x3fffff23,0xff302fff,0xffffffff,0xffffffff,0xb300000b,
0xffff709f,0x3ffa03df,0xffffffff,0xffa803ff,0xffffffff,0xff100dff,
0xfffff57f,0xfffe81ff,0x7ffdc00f,0x8bfff81f,0xfffffffe,0x3ffa24ff,
0x5fffffff,0x002fffd8,0xfa8ffff4,0xff9804ff,0xffa804ff,0x6cfffe3f,
0xffffffff,0xfff984ff,0xffffffff,0x5fffffff,0xfd710000,0xfffc89ff,
0x6c2fffff,0xcccdffff,0x03fffffd,0x3bffffea,0xfffffdcd,0xbfff881f,
0x5fffffff,0x04ffff88,0x40ffffe6,0xfffecfff,0xfffffedf,0xdefffe8a,
0x41ffffff,0x2005fffa,0x7fc6fff8,0xfffc807f,0xfffc806f,0x3f73ffe0,
0xfffedfff,0x7fcc4fff,0xffffffff,0xffffeeff,0x7e4c0004,0x2a4fffff,
0xfd712dff,0x3bffea1f,0xdfffb100,0x3bfffe20,0xdffff701,0xffffff10,
0x205fb79f,0xd01ffffa,0x7fc0bfff,0x441dffff,0xfffffffd,0x6ffff983,
0x000ffff8,0xfd87fff7,0x7ff401ff,0x7fc00fff,0x7ffffc6f,0x7fd441df,
0x880007ff,0x0005fffe,0x3fffff6a,0x1ffa1dff,0xffc9ffcc,0x7ffc402f,
0xdfffd81f,0x7fff4c00,0x7ffffc43,0xfffd8005,0x0efffc86,0x17ffffe0,
0x3ffffff0,0x43fffd40,0xd002fffc,0xffb81fff,0x3ffe203f,0x3e602fff,
0x7fffc3ff,0x7ffcc04f,0x7ec0002f,0x44000eff,0xffffffeb,0x04ff80cf,
0x3fff57fa,0x43fffb80,0x000ffffa,0x441ffff5,0x000fffff,0x24ffff88,
0x401ffffa,0x400effff,0x804ffffc,0x7cc0fffe,0xff9805ff,0x5fff885f,
0x3fbffea0,0x3ffee04f,0x037fffc0,0x004fffc8,0x03ffff20,0xffffc980,
0x2202efff,0x5bf201ff,0x3000fffe,0x0ffff601,0x47fffd00,0x003ffff8,
0x27fffea0,0x803ffff8,0xa802ffff,0xd800ffff,0xffe81fff,0x7ffe400f,
0x40fffd02,0x6ffcdffc,0x3e1bffa0,0xf5002fff,0x2e000bff,0x5001ffff,
0xfffffffd,0x13fe0039,0xfff75fe8,0xfe80003d,0x7d4000ff,0x3ffe24ff,
0x7e40002f,0x5fffdeff,0x03ffff00,0x00ffff30,0x2e0bfff2,0x7fc03fff,
0x3ffee07f,0xf55ffd01,0xfff101ff,0x03ffff09,0x017ffe60,0x0bfffea0,
0xfffff710,0x80017dff,0x7ff307fe,0x3bffffe6,0xfff8001c,0xfff88006,
0x03fffe26,0x3fffa000,0xf000ffff,0x3e600fff,0xff7006ff,0xdfff105f,
0x027ffd40,0xf109fff3,0x5fff31ff,0xf03fff50,0x22001fff,0x4c005fff,
0x5c03ffff,0xdfffffff,0x3fe60001,0x1ffd712e,0x7fffffe4,0x4c00bdff,
0xf0005fff,0x7ffc4fff,0xff300007,0x4005ffff,0xf3007fff,0x3ee00bff,
0xfffb02ff,0x07fff601,0xf70dfff0,0x427ffcdf,0xfff07ffd,0x7ffc400f,
0x3ffe2006,0xfffc804f,0x00000bef,0xfffffff9,0xffff705f,0x7dffffff,
0x013ffea0,0x887fffc0,0x00006fff,0x013fffee,0x200dfff0,0x7004fff9,
0x3ea05fff,0xfff883ff,0x0fffc806,0xffb27fec,0x209fff0d,0x22006fff,
0xd1006fff,0x3200bfff,0x000cffff,0x7fffd400,0x3f6601ef,0xffffffff,
0x7ffdc0ef,0xfffd0004,0x01bffe23,0xffffc800,0x3ffe000e,0x9fff3006,
0x0bffee00,0xfa86fff8,0xffa803ff,0x517ffc2f,0x7fcc1fff,0x0dfff01f,
0x037ffc40,0x00efffe8,0xffffff90,0x4400003b,0x22001ab9,0xfffffeca,
0x3fea2fff,0xfff0004f,0x1bffe21f,0x7ffcc000,0x3e004fff,0xff3006ff,
0x3fee009f,0x3fff202f,0x007ffec1,0x3e64fff8,0x3ffe20ff,0xf81fff22,
0x3e2006ff,0xffd806ff,0x75c000ff,0xbeffffff,0x00000000,0x3fff6e20,
0x3ffe66ff,0xfff88005,0x01bffe27,0x3fffa200,0xf002ffff,0x3e600dff,
0xff7004ff,0x7ffcc05f,0x017ffe24,0x3ee7ffd8,0x25ffe86f,0x3fe05ffe,
0x3fe2006f,0x7ffe406f,0x3660001f,0xcfffffff,0x33330001,0x32200001,
0xff10ffff,0xff3000df,0x37ffc4ff,0x7ffec000,0x00ffffad,0x3006fff8,
0x2e009fff,0x7f402fff,0x0bffee7f,0xd1fffa80,0xfff909ff,0xf80bffe6,
0x3e2006ff,0x3fee06ff,0x100002ff,0xfffffff9,0x7fdc005d,0x353102ff,
0x3fffe200,0x003fffe3,0x44bfff70,0x40006fff,0xfb0ffffa,0xfff00bff,
0x3ffe600d,0x5fff7004,0xd1fffb80,0xf8800fff,0x2fff8bff,0xfb9fffa8,
0x3ffe00ff,0x3ffe2006,0x9ffff506,0x3ae00000,0xcfffffff,0x3fffe200,
0x09fff704,0xb1fffdc0,0xe8009fff,0x3fe22fff,0x3e20006f,0x3fe22fff,
0x7ffc03ff,0x9fff3006,0x0bffee00,0xf19fff10,0xfd0009ff,0x01fff3bf,
0xffb7fff1,0x06fff80b,0x21bffe20,0x005ffff9,0xffd98000,0x82dfffff,
0x2205fffb,0x3a006fff,0x3fe61fff,0xff7000ff,0x7ffc41ff,0x3ff60006,
0xffffa85f,0x01bffe00,0x8027ffcc,0xd802fffb,0x1fffbeff,0xcfffb800,
0x3ffa06ff,0x7c03fffe,0x3e2006ff,0x7ffc46ff,0x0000005f,0x7ffffe44,
0x77ffc4ff,0x27fff400,0x43fffd40,0x400efffc,0x444ffffa,0x70006fff,
0x3601ffff,0x3fe06fff,0xfff3006f,0x3ffee009,0xffffa802,0xf30006ff,
0x409fffff,0x0ffffffc,0x0037ffc0,0x744dfff1,0x0000efff,0x3faa0000,
0x3fea4fff,0xfffa801f,0xffd501df,0xffff109f,0xffc8815f,0xfff886ff,
0xfff98006,0x3ffe202f,0x0dfff03f,0x013ffe60,0x8017ffdc,0x03ffffff,
0x3ffffa00,0x3ffea02f,0xfff806ff,0x3ffe2006,0x2bffff66,0xaaaaaa99,
0x00aaaaaa,0x3ff66000,0x800fffa4,0xeffffffc,0x5fffffee,0x3ffffea0,
0xfffffeef,0xfff880ef,0xfffe8006,0xffffb805,0x006fff81,0x2009fff3,
0x9002fffb,0x001fffff,0x7ffffe40,0x7ffffc00,0x06fff803,0x45bffe20,
0xffffffff,0xffffffff,0x0002ffff,0x0004c880,0xffffff90,0x07ffffff,
0xfffffb10,0x1bffffff,0x01bffe20,0x01ffff90,0x21bfff60,0xf3006fff,
0x3ee009ff,0xff3002ff,0x98000bff,0xd806ffff,0xf800ffff,0x3e2006ff,
0xffff16ff,0xffffffff,0xffffffff,0x00000005,0x3ff22000,0x2defffff,
0x7fff5c00,0x401dffff,0x2006fff8,0x003ffff9,0xf13fffe2,0x3e600dff,
0xff7004ff,0x7ff4005f,0xff80002f,0xffb803ff,0xdfff006f,0xb7ffc400,
0xfffffff8,0xffffffff,0x002fffff,0x00000000,0x009baa98,0x35753000,
0x00000001,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x30000000,0x88000003,0x00140001,0x0002aaa8,
0x2e099910,0x039972cc,0x08009991,0x90000800,0x00003999,0x00019991,
0x8006aaa6,0x00aacba8,0x026aa660,0x0abb9880,0x00555540,0x00016fe4,
0x000ff440,0xd8004fb8,0xb00007ff,0xfff509ff,0x203ffea1,0xd9003ffe,
0x02f44001,0x01ffffc0,0x1fffe400,0x3fffee00,0x36603eff,0xcfffffff,
0x3fffaa00,0x5c00cfff,0x0dffffff,0x007ffff0,0x017dfff9,0x3fffa000,
0xdfffd911,0x13ffee17,0x00fffb00,0x81fff700,0x7ec3fff8,0x1fff985f,
0x0077fe40,0x002fff44,0x000ffffe,0x0fffff10,0x7ffffe40,0xf983ffff,
0xffffffff,0xffff706f,0x01ffffff,0x3ffffff6,0xfff81eff,0xfffc803f,
0x0001cfff,0x37ffffa2,0xffffffff,0x04ffffdf,0x003ffec0,0x20bffe60,
0xff986ffd,0x06ffd82f,0x03bfffe6,0x1ffffe88,0x0ffffe00,0xffff7000,
0xfff3005f,0xfffd5137,0x0beffe81,0x985fff93,0xda9bdfff,0xffb85fff,
0xfffcabdf,0x03ffff86,0xfffffd98,0x10002eff,0xfffffffd,0xffffffff,
0xfb0009ff,0xfe8000ff,0x2fffa86f,0x881fff90,0x3e604fff,0xe880efff,
0x4002ffff,0x0002eeed,0x37fffff4,0x4c2ffe40,0x3fe61fff,0x89ff901f,
0xffd06ffc,0x83fff88f,0x7fc2fff9,0x2e2003ff,0xffffffff,0x7ec4000c,
0xdbceffff,0x04fffffe,0x00fffb00,0x20fffe40,0x2205fff8,0xffc85fff,
0x3ffe601f,0x3ffa20ef,0x000002ff,0x5fffd400,0x01001fff,0x7103ffea,
0x22ffdc07,0xff701caa,0x206ffb8d,0x5fd06ffc,0x3ff6a000,0x01dfffff,
0x0bffff20,0x00ffffe4,0x007ffd80,0xb0bfff30,0xfb803fff,0x7ffc43ff,
0x3ffe600f,0xfffe88ef,0x0000002f,0xfd6ffd80,0x2a2000bf,0x22004ffe,
0x006ffdb9,0x7ec3ffd8,0x1ffe203f,0x00003fe2,0xffffff91,0xff8807df,
0x7fd400ff,0xffb0005f,0xffd1000f,0x4fffb81f,0x83fffd00,0x5405fffa,
0xffeeffff,0x999102ff,0x99999999,0x99999999,0x3ffe6079,0x001fff72,
0x03ffffb8,0x7fffee54,0x54006fff,0x7ff40fff,0x207ffc02,0x400006fa,
0xffffffea,0xfffb80cf,0x1fffb002,0x0fffb000,0x89fffb00,0x000ffff8,
0xfd0dfff5,0xffa805ff,0x02ffffff,0x3fffffe6,0xffffffff,0x06ffffff,
0x7fc4fff9,0x7fec004f,0xffd501df,0xffffffff,0x7ffdc00d,0x401fff85,
0x3fa21fff,0x93000005,0x7fffffff,0x2007ffc8,0x64c2fffa,0xfccccccc,
0xcccccfff,0x3fea2ccc,0x7ffec0ff,0x7ffec003,0x07fffcc4,0x3ffffea0,
0x7ffcc02f,0xffffffff,0xffffffff,0x4fff886f,0x0007ffe4,0x19fffd97,
0x67ffffcc,0x06ffa8ab,0x05fffd88,0xff805ffd,0x01dfd10f,0xeb880000,
0x7ec4ffff,0x3fe2005f,0x7fffdc3f,0xffffffff,0xffffffff,0x513fffa4,
0x5000ffff,0xfe81ffff,0x7f4404ff,0x4c00ffff,0xffffffff,0xffffffff,
0xfb86ffff,0x7ffcc1ff,0xffd10003,0x8177fec7,0x74c06ffb,0x3f603fff,
0x1ffe202f,0x000000bb,0x27fffdc4,0x88017ffa,0x7fdc3fff,0xffffffff,
0xffffffff,0x3ffea4ff,0x1fffec0f,0x0ffff600,0x401ffff3,0xffffffe8,
0x0000000e,0xd06fff80,0x5c000dff,0x0fffa6ff,0x2a06ffd8,0x6401ffff,
0x3fee05ff,0x00000046,0xfffffd98,0x037fec4f,0xb85fff30,0xffffffff,
0xffffffff,0x7e44ffff,0x7ffc44ff,0xfff5000f,0x05fffd0b,0x7fffff44,
0x0000efff,0x3fea0000,0x5fff502f,0x900cba88,0x27ff4fff,0x706fffb8,
0x3001dfff,0xfd103fff,0x0000009f,0xfffffeb8,0x7fdc0bef,0xfff9001f,
0xfffb0003,0x3fffa000,0x027ffd40,0x540fffe8,0x3a204fff,0xff9affff,
0x50000eff,0xe8003555,0x7ffc07ff,0xf04fff86,0x7ffe4dff,0xffff950a,
0x0bfff70d,0x9bfffd80,0x007ffea8,0xff930000,0x05bfffff,0x4037ffc4,
0x0006fff9,0x2000fffb,0xfd85fff9,0x7fdc01ff,0x77ffc43f,0xffffd100,
0x77fffcc5,0xffff8000,0x3ffe6003,0x0fffe404,0x26b7fff2,0x223ffffc,
0xffffffff,0x7d47ffcf,0xcccccfff,0x7fc40ccc,0xffffffff,0x54000002,
0xfffffffd,0xfffb001c,0x3ffa601b,0xffb0002f,0x7fdc000f,0x2fffc41f,
0x90bfff10,0x3a203fff,0xf982ffff,0x4000efff,0x2003ffff,0x4401fffd,
0xffd85fff,0x4fffffff,0xffffffa8,0x745ffb1e,0xffffffff,0xd880ffff,
0x1effffff,0xf7100000,0x7dffffff,0xfffc8001,0xfda9abff,0x0002ffff,
0x8000fffb,0xffa86ffe,0x1fff902f,0x104fff88,0x405ffffd,0x00effffa,
0x00ffffe0,0x8037ffc4,0xfb80fffd,0x02efffff,0x260de654,0xffff31aa,
0xffffffff,0x6edd401f,0x3000002c,0xfffffffb,0x3f20005b,0xffffffff,
0xffffffff,0x7ffd8002,0x7ffc4000,0x986ffd82,0xffd82fff,0x3fffa206,
0xffffa802,0x3fffe000,0x5fff9003,0x13ffea00,0x0009a998,0x00000000,
0x70000000,0x9fffffff,0x7fe40003,0xffffffff,0xffffffff,0x7fec002f,
0xffb80007,0x43fff887,0xff985ffd,0x17f4401f,0x001ff500,0x00000000,
0x00000000,0x00000000,0xff900000,0x00017dff,0x73ffff88,0x5dffffff,
0x0017fff6,0x0000fffb,0x3ea0fff6,0x1dff50ff,0x2007ffd0,0x00980028,
0xc8000000,0x332600cc,0xcccccccc,0xcccccccc,0x999932cc,0x99999999,
0x99999999,0x00019805,0x80666660,0x0002dffc,0x441ffcc0,0xefd809a9,
0x3ffec000,0x2aa88000,0x2aa35550,0x02aa881a,0x00000000,0x3fe00000,
0x3ffee00f,0xffffffff,0xffffffff,0xfffff74f,0xffffffff,0x9fffffff,
0xfffffd70,0x87620039,0x703ffffb,0x40000039,0x06400039,0x02f76400,
0x00000000,0x00000000,0x80000000,0x7fdc07fe,0xffffffff,0xffffffff,
0xffff74ff,0xffffffff,0xffffffff,0x7ffff449,0x0befffff,0xfc83fd30,
0x000007ff,0x00000000,0x00000000,0x00000000,0x00000000,0xdfb01000,
0x7fffdc10,0xffffffff,0xffffffff,0xffffff74,0xffffffff,0x29ffffff,
0xfffffff8,0xdfffffff,0x1fffecab,0x003fffd8,0x00000000,0x00000000,
0x00000000,0x00000000,0xee800000,0x6d4df90b,0x3333310f,0x33333333,
0x9fff3333,0x26666662,0x99999999,0x10999999,0xffdfffff,0xffffffff,
0x03ffffff,0x000dffd1,0x00000000,0x00000000,0x00000000,0x00000000,
0xff880000,0xebdfdcff,0x00002fff,0x00027ffc,0x56ffc400,0x3fffae20,
0xffffffff,0x5fff300d,0x00000000,0x00000000,0x00000000,0x00000000,
0x40000000,0xfffffffa,0x04ffffff,0x27ffc000,0x7c400000,0xfffd9804,
0x803fffff,0x00005ffa,0x00000000,0x00000000,0x00000000,0x00000000,
0x6dd44000,0xacefffff,0xff800000,0x8000004f,0x65440028,0x0000acdd,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x005fffc8,
0x4fff8000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0xc8000000,0x005ffdff,0x27ffc000,0x4c400000,0x4ccc4099,
0x99999950,0x00399999,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x3ff6dff7,0x3e000005,0xdddd54ff,0xdddddddd,0xdddddddd,
0x70bfff27,0x3fee9fff,0xffffffff,0x0000003f,0x00000000,0x00000000,
0x00000000,0x00000000,0x7ffcc000,0x009fff12,0x53ffe000,0xfffffffb,
0xffffffff,0xf94fffff,0xfffb85ff,0xffffff74,0x007fffff,0x00000000,
0x00000000,0x00000000,0x00000000,0x80000000,0x7fdc5ffa,0xff000004,
0x3fffee9f,0xffffffff,0xffffffff,0xb85fff94,0xfff74fff,0xffffffff,
0x00000007,0x00000000,0x00000000,0x00000000,0x00000000,0xb01d3000,
0x74000005,0xdddd53ee,0xdddddddd,0xdddddddd,0x70bfff27,0x2aa69fff,
0xaaaaaaaa,0x0000001a,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x04ccc400,0x00026662,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,
};
static signed short stb__arial_50_latin1_x[224]={ 0,3,2,0,1,2,1,1,2,2,1,2,3,1,
4,0,1,4,1,1,0,1,1,2,1,1,4,3,2,2,2,1,2,-1,3,2,3,3,3,2,3,4,1,3,
3,3,3,2,3,1,3,2,1,3,0,0,0,0,0,3,0,0,1,-1,1,1,2,1,1,1,0,1,2,2,
-3,2,2,2,2,1,2,1,2,1,0,2,0,0,0,0,0,1,4,1,1,5,5,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,5,2,0,1,-1,
4,1,1,0,1,2,2,1,0,-1,2,1,0,0,4,3,0,4,2,2,0,3,2,2,0,3,-1,-1,-1,-1,
-1,-1,0,2,3,3,3,3,1,3,-1,0,-1,3,2,2,2,2,2,3,1,3,3,3,3,0,3,3,1,1,
1,1,1,1,1,1,1,1,1,1,0,4,-1,0,1,2,1,1,1,1,1,1,2,2,2,2,2,0,2,0,
};
static signed short stb__arial_50_latin1_y[224]={ 40,7,7,7,5,7,7,7,7,7,7,13,35,26,
35,7,7,7,7,7,7,8,7,8,7,7,16,16,13,17,13,7,7,7,7,7,7,7,7,7,7,7,7,7,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,46,7,16,7,16,7,16,7,16,7,7,
7,7,7,16,16,16,16,16,16,16,8,16,16,16,16,16,16,7,7,7,20,12,12,12,12,12,12,12,12,12,
12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,40,16,7,7,13,7,
7,7,7,7,7,18,17,26,7,2,7,13,7,7,7,16,7,21,39,7,7,18,7,7,7,16,-1,-1,-1,0,
1,1,7,7,-1,-1,-1,1,-1,-1,-1,1,7,0,-1,-1,-1,0,1,14,6,-1,-1,-1,1,-1,7,7,7,7,
7,8,7,6,16,16,7,7,7,7,7,7,7,7,7,8,7,7,7,8,7,15,15,7,7,7,7,7,7,7,
};
static unsigned short stb__arial_50_latin1_w[224]={ 0,6,12,25,22,36,28,6,12,12,15,22,6,13,
5,13,22,13,22,22,23,23,22,21,22,22,5,6,22,22,22,22,42,31,25,29,27,25,23,31,26,5,18,27,
21,31,26,31,25,33,29,26,26,26,30,42,30,30,27,9,13,10,19,27,10,22,22,21,21,23,14,21,20,5,
10,21,5,33,20,23,22,21,14,20,13,20,22,32,23,22,22,13,4,13,24,23,23,23,23,23,23,23,23,23,
23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,0,5,21,24,23,26,
4,22,13,34,15,20,22,13,34,27,13,22,15,15,9,20,25,5,10,9,16,19,35,35,37,22,31,31,31,31,
31,31,43,29,25,25,25,25,9,9,15,13,31,26,31,31,31,31,31,20,33,26,26,26,26,30,25,23,22,22,
22,22,22,22,37,21,23,23,23,23,9,9,15,13,23,20,23,23,23,23,23,22,23,20,20,20,20,22,22,22,
};
static unsigned short stb__arial_50_latin1_h[224]={ 0,33,13,34,40,35,34,13,43,43,15,22,12,5,
5,34,34,33,33,34,33,33,34,32,34,34,24,31,23,14,23,33,43,33,33,34,33,33,33,34,33,33,34,33,
33,33,33,34,33,36,33,34,33,34,33,33,33,33,33,42,34,42,18,3,7,25,34,25,34,25,33,34,33,33,
43,33,33,24,24,25,33,33,24,25,33,25,24,24,24,34,24,43,43,43,8,28,28,28,28,28,28,28,28,28,
28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,0,33,42,34,22,33,
43,43,6,34,17,21,14,5,34,4,13,27,17,18,7,33,42,6,11,17,17,21,35,35,35,34,41,41,41,40,
39,39,33,43,41,41,41,39,41,41,41,39,33,40,42,42,42,41,40,20,36,42,42,42,40,41,33,34,34,34,
34,33,34,35,25,33,34,34,34,34,33,33,33,33,34,32,34,34,34,33,34,19,27,34,34,34,34,43,42,43,
};
static unsigned short stb__arial_50_latin1_s[224]={ 255,39,243,47,11,202,168,244,24,60,156,
48,241,232,248,239,1,242,104,102,127,227,184,22,28,51,250,237,219,195,1,
83,131,72,224,49,1,230,29,195,106,248,153,201,81,113,155,125,198,1,53,
1,179,157,206,136,105,74,46,218,241,228,156,96,243,153,172,176,131,198,66,
109,23,249,188,1,229,85,175,22,155,133,46,1,25,222,119,142,61,79,196,
174,213,199,218,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,
44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,255,249,28,
24,24,1,126,103,218,74,192,71,172,232,207,68,242,68,208,176,242,151,50,
249,243,244,224,92,105,69,164,73,33,91,123,120,192,224,28,73,155,65,212,
152,238,1,239,178,198,61,76,108,140,1,88,112,35,172,199,1,34,181,172,
25,49,197,24,178,1,141,115,44,207,120,144,231,103,145,182,235,159,1,114,
96,1,1,183,133,91,72,93,138,220,37,226,1, };
static unsigned short stb__arial_50_latin1_t[224]={ 1,451,485,244,130,172,244,469,1,1,563,
544,544,572,122,172,279,279,349,279,349,314,279,485,314,314,417,451,518,563,544,
383,1,349,417,279,383,349,383,314,383,88,314,383,417,417,417,279,417,172,383,
314,451,279,451,451,451,451,451,1,244,1,544,513,563,485,314,485,314,485,417,
314,417,383,1,417,383,518,518,518,383,383,518,518,451,485,518,518,518,279,518,
1,1,1,563,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,
485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,1,45,45,
279,544,349,1,1,572,314,544,544,563,572,279,513,518,485,544,544,532,349,45,
79,499,451,544,544,172,172,172,244,88,88,88,130,130,130,349,1,88,88,88,
130,88,130,1,130,349,130,45,45,45,88,130,544,172,45,45,45,130,88,349,
209,209,244,244,383,244,172,485,417,209,244,244,209,417,417,417,383,209,485,209,
244,209,451,209,544,485,209,209,209,244,1,45,1, };
static unsigned short stb__arial_50_latin1_a[224]={ 199,199,254,398,398,637,478,137,
238,238,279,418,199,238,199,199,398,398,398,398,398,398,398,398,
398,398,199,199,418,418,418,398,727,478,478,517,517,478,437,557,
517,199,358,478,398,597,517,557,478,557,517,478,437,517,478,676,
478,478,437,199,199,199,336,398,238,398,398,358,398,398,199,398,
398,159,159,358,159,597,398,398,398,398,238,358,199,398,358,517,
358,358,358,239,186,239,418,537,537,537,537,537,537,537,537,537,
537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
537,537,537,537,537,537,537,537,199,238,398,398,398,398,186,398,
238,528,265,398,418,238,528,395,286,393,238,238,238,413,385,199,
238,238,262,398,597,597,597,437,478,478,478,478,478,478,716,517,
478,478,478,478,199,199,199,199,517,517,557,557,557,557,557,418,
557,517,517,517,517,478,478,437,398,398,398,398,398,398,637,358,
398,398,398,398,199,199,199,199,398,398,398,398,398,398,398,393,
437,398,398,398,398,358,398,358, };
// Call this function with
// font: NULL or array length
// data: NULL or specified size
// height: STB_FONT_arial_50_latin1_BITMAP_HEIGHT or STB_FONT_arial_50_latin1_BITMAP_HEIGHT_POW2
// return value: spacing between lines
static void stb_font_arial_50_latin1(stb_fontchar font[STB_FONT_arial_50_latin1_NUM_CHARS],
unsigned char data[STB_FONT_arial_50_latin1_BITMAP_HEIGHT][STB_FONT_arial_50_latin1_BITMAP_WIDTH],
int height)
{
int i,j;
if (data != 0) {
unsigned int *bits = stb__arial_50_latin1_pixels;
unsigned int bitpack = *bits++, numbits = 32;
for (i=0; i < STB_FONT_arial_50_latin1_BITMAP_WIDTH*height; ++i)
data[0][i] = 0; // zero entire bitmap
for (j=1; j < STB_FONT_arial_50_latin1_BITMAP_HEIGHT-1; ++j) {
for (i=1; i < STB_FONT_arial_50_latin1_BITMAP_WIDTH-1; ++i) {
unsigned int value;
if (numbits==0) bitpack = *bits++, numbits=32;
value = bitpack & 1;
bitpack >>= 1, --numbits;
if (value) {
if (numbits < 3) bitpack = *bits++, numbits = 32;
data[j][i] = (bitpack & 7) * 0x20 + 0x1f;
bitpack >>= 3, numbits -= 3;
} else {
data[j][i] = 0;
}
}
}
}
// build font description
if (font != 0) {
float recip_width = 1.0f / STB_FONT_arial_50_latin1_BITMAP_WIDTH;
float recip_height = 1.0f / height;
for (i=0; i < STB_FONT_arial_50_latin1_NUM_CHARS; ++i) {
// pad characters so they bilerp from empty space around each character
font[i].s0 = (stb__arial_50_latin1_s[i]) * recip_width;
font[i].t0 = (stb__arial_50_latin1_t[i]) * recip_height;
font[i].s1 = (stb__arial_50_latin1_s[i] + stb__arial_50_latin1_w[i]) * recip_width;
font[i].t1 = (stb__arial_50_latin1_t[i] + stb__arial_50_latin1_h[i]) * recip_height;
font[i].x0 = stb__arial_50_latin1_x[i];
font[i].y0 = stb__arial_50_latin1_y[i];
font[i].x1 = stb__arial_50_latin1_x[i] + stb__arial_50_latin1_w[i];
font[i].y1 = stb__arial_50_latin1_y[i] + stb__arial_50_latin1_h[i];
font[i].advance_int = (stb__arial_50_latin1_a[i]+8)>>4;
font[i].s0f = (stb__arial_50_latin1_s[i] - 0.5f) * recip_width;
font[i].t0f = (stb__arial_50_latin1_t[i] - 0.5f) * recip_height;
font[i].s1f = (stb__arial_50_latin1_s[i] + stb__arial_50_latin1_w[i] + 0.5f) * recip_width;
font[i].t1f = (stb__arial_50_latin1_t[i] + stb__arial_50_latin1_h[i] + 0.5f) * recip_height;
font[i].x0f = stb__arial_50_latin1_x[i] - 0.5f;
font[i].y0f = stb__arial_50_latin1_y[i] - 0.5f;
font[i].x1f = stb__arial_50_latin1_x[i] + stb__arial_50_latin1_w[i] + 0.5f;
font[i].y1f = stb__arial_50_latin1_y[i] + stb__arial_50_latin1_h[i] + 0.5f;
font[i].advance = stb__arial_50_latin1_a[i]/16.0f;
}
}
}
#ifndef STB_SOMEFONT_CREATE
#define STB_SOMEFONT_CREATE stb_font_arial_50_latin1
#define STB_SOMEFONT_BITMAP_WIDTH STB_FONT_arial_50_latin1_BITMAP_WIDTH
#define STB_SOMEFONT_BITMAP_HEIGHT STB_FONT_arial_50_latin1_BITMAP_HEIGHT
#define STB_SOMEFONT_BITMAP_HEIGHT_POW2 STB_FONT_arial_50_latin1_BITMAP_HEIGHT_POW2
#define STB_SOMEFONT_FIRST_CHAR STB_FONT_arial_50_latin1_FIRST_CHAR
#define STB_SOMEFONT_NUM_CHARS STB_FONT_arial_50_latin1_NUM_CHARS
#define STB_SOMEFONT_LINE_SPACING STB_FONT_arial_50_latin1_LINE_SPACING
#endif
| 69.768951
| 115
| 0.816283
|
stetre
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.