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
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8c4ccc6398c38a0a284c7b2f9375389dda0b45c3
| 74
|
cpp
|
C++
|
source/languages/cpp/examples/#186.cpp
|
DoDoENT/cpp-textmate-grammar
|
f8c66603957ae3240ff828256d6d6d32e01913be
|
[
"MIT"
] | 81
|
2019-02-28T07:46:31.000Z
|
2021-09-07T11:48:50.000Z
|
source/languages/cpp/examples/#186.cpp
|
DoDoENT/cpp-textmate-grammar
|
f8c66603957ae3240ff828256d6d6d32e01913be
|
[
"MIT"
] | 457
|
2019-02-08T23:45:20.000Z
|
2021-09-11T02:22:42.000Z
|
test/fixtures/issues/186.cpp
|
derkallevombau/better-shell-syntax-reloaded
|
7ea63e1db06eea1ce7b1953b41b4592a1c124e98
|
[
"MIT"
] | 35
|
2019-02-28T07:50:23.000Z
|
2021-08-22T00:13:59.000Z
|
std::vector<pair<int,int>> *g = new std::vector<pair<int,int>>[n];
for int
| 37
| 66
| 0.662162
|
DoDoENT
|
8c52a22349eb656c96f2385e319f06d21644b11a
| 2,011
|
hpp
|
C++
|
RealtekCardReader/ClosedRange.hpp
|
MK-986123/RealtekCardReader
|
0b1a4c66082b63d057cba2a54721b62cbf11c0ac
|
[
"BSD-3-Clause"
] | 106
|
2021-07-16T03:27:28.000Z
|
2022-03-31T15:35:50.000Z
|
RealtekCardReader/ClosedRange.hpp
|
MK-986123/RealtekCardReader
|
0b1a4c66082b63d057cba2a54721b62cbf11c0ac
|
[
"BSD-3-Clause"
] | 28
|
2021-07-16T09:03:10.000Z
|
2022-03-28T03:36:47.000Z
|
RealtekCardReader/ClosedRange.hpp
|
MK-986123/RealtekCardReader
|
0b1a4c66082b63d057cba2a54721b62cbf11c0ac
|
[
"BSD-3-Clause"
] | 14
|
2021-07-16T16:15:09.000Z
|
2022-02-24T22:08:21.000Z
|
//
// ClosedRange.hpp
// RealtekCardReader
//
// Created by FireWolf on 9/25/20.
// Copyright © 2020 FireWolf. All rights reserved.
//
#ifndef ClosedRange_hpp
#define ClosedRange_hpp
#include <libkern/OSTypes.h>
#include "Debug.hpp"
/// A structure that describes a closed interval from a lower bound to an upper bound
template <typename Bound = UInt32>
struct ClosedRange
{
/// The lower bound
Bound lowerBound;
/// The upper bound
Bound upperBound;
/// Default constructor
ClosedRange() {}
/// Create a closed range with the given bounds
ClosedRange(Bound lowerBound, Bound upperBound)
{
passert(lowerBound <= upperBound, "The given bounds are invalid.");
this->lowerBound = lowerBound;
this->upperBound = upperBound;
}
///
/// Create a closed range with the given length
///
/// @param start The start position as the lower bound
/// @param length The number of elements in the range
/// @return A closed range that starts at `start` and covers `length` elements.
///
static inline ClosedRange createWithLength(Bound start, Bound length)
{
return ClosedRange(start, start + length - 1);
}
/// Get the number of elements in this range
[[nodiscard]]
inline Bound getLength() const
{
return this->upperBound - this->lowerBound + 1;
}
///
/// Check whether this range is valid
///
/// @return `true` if valid, `false` otherwise.
///
[[nodiscard]]
inline bool isValid() const
{
return this->lowerBound <= this->upperBound;
}
///
/// Check whether the range contains the given value
///
/// @param value The value to be checked
/// @return `true` if the value is within the range, `false` otherwise.
///
[[nodiscard]]
inline bool contains(Bound value) const
{
return this->lowerBound <= value && value <= this->upperBound;
}
};
#endif /* ClosedRange_hpp */
| 24.52439
| 85
| 0.62904
|
MK-986123
|
8c5d3c1f35397cbe8592c7e053cc24436a031613
| 8,399
|
cpp
|
C++
|
sl3.cpp
|
ojwoodford/liegroups
|
2f7c30c2356f3a32e9df71a163085ced08ac3a57
|
[
"BSD-1-Clause"
] | 1
|
2021-09-06T12:09:39.000Z
|
2021-09-06T12:09:39.000Z
|
src/sl3.cpp
|
pangfumin/liegroups
|
8a72700457e35d083f7de4f9ca9b51f7d23980c0
|
[
"BSD-1-Clause"
] | null | null | null |
src/sl3.cpp
|
pangfumin/liegroups
|
8a72700457e35d083f7de4f9ca9b51f7d23980c0
|
[
"BSD-1-Clause"
] | 1
|
2019-10-18T01:24:37.000Z
|
2019-10-18T01:24:37.000Z
|
#include <liegroups/sl3.hpp>
#include <liegroups/scalar.hpp>
#include <liegroups/matrix.hpp>
#include <cmath>
#include <iostream>
template <> const liegroups::SL3<float>
liegroups::SL3<float>::identity = { {1.f, 0.f, 0.f,
0.f, 1.f, 0.f,
0.f, 0.f, 1.f} };
template <> const liegroups::SL3<double>
liegroups::SL3<double>::identity = { {1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0} };
template <class S>
void liegroups::multiply(SL3<S> &ab, const SL3<S> &a, const SL3<S> &b)
{
mat_mult_square<3>(ab.H, a.H, b.H);
}
template void liegroups::multiply<float>(SL3<float>&, const SL3<float>&, const SL3<float> &);
template void liegroups::multiply<double>(SL3<double>&, const SL3<double>&, const SL3<double> &);
template <typename S1, typename S2>
static S2 dot3(const S1 a[3], const S2 b[3])
{
return (S2)(a[0]*b[0] + a[1]*b[1] + a[2]*b[2]);
}
template <class S>
void liegroups::multiply_a_binv(SL3<S> &abinv, const SL3<S> &a, const SL3<S> &b)
{
abinv = a * inverse(b);
}
template void liegroups::multiply_a_binv<float>(SL3<float>&, const SL3<float>&, const SL3<float> &);
template void liegroups::multiply_a_binv<double>(SL3<double>&, const SL3<double>&, const SL3<double> &);
template <class S>
liegroups::SL3<S> liegroups::inverse(const SL3<S> &g)
{
SL3<S> ginv = g;
invert(ginv);
return ginv;
}
template liegroups::SL3<float> liegroups::inverse<float>(const SL3<float>&);
template liegroups::SL3<double> liegroups::inverse<double>(const SL3<double>&);
template <class S>
void liegroups::invert(SL3<S> &g)
{
const S m00 = g.H[4]*g.H[8] - g.H[5]*g.H[7];
const S m10 = g.H[1]*g.H[8] - g.H[2]*g.H[7];
const S m20 = g.H[1]*g.H[5] - g.H[2]*g.H[4];
const S m01 = g.H[3]*g.H[8] - g.H[5]*g.H[6];
const S m02 = g.H[3]*g.H[7] - g.H[4]*g.H[6];
const S m11 = g.H[0]*g.H[8] - g.H[2]*g.H[6];
const S m12 = g.H[0]*g.H[7] - g.H[1]*g.H[6];
const S m21 = g.H[0]*g.H[5] - g.H[2]*g.H[3];
const S m22 = g.H[0]*g.H[4] - g.H[1]*g.H[3];
g.H[0] = m00;
g.H[1] = -m10;
g.H[2] = m20;
g.H[3] = -m01;
g.H[4] = m11;
g.H[5] = -m21;
g.H[6] = m02;
g.H[7] = -m12;
g.H[8] = m22;
}
template void liegroups::invert<float>(SL3<float>&);
template void liegroups::invert<double>(SL3<double>&);
template <class S>
void liegroups::rectify(SL3<S> &g)
{
const S m00 = g.H[4]*g.H[8] - g.H[5]*g.H[7];
const S m10 = g.H[1]*g.H[8] - g.H[2]*g.H[7];
const S m20 = g.H[1]*g.H[5] - g.H[2]*g.H[4];
const S det = g.H[0]*m00 - g.H[3]*m10 + g.H[6]*m20;
const S factor = liegroups::pow(det, (S)(-1.0/3));
for (int i=0; i<9; ++i)
g.H[i] *= factor;
}
template void liegroups::rectify<float>(SL3<float>&);
template void liegroups::rectify<double>(SL3<double>&);
template <class S, class X>
void liegroups::transform_point(X y[3], const SL3<S> &g, const X x[3])
{
S y0 = dot3(&g.H[0], x);
S y1 = dot3(&g.H[3], x);
S y2 = dot3(&g.H[6], x);
y[0] = y0;
y[1] = y1;
y[2] = y2;
}
template void liegroups::transform_point<float,float>(float[3], const SL3<float> &, const float[3]);
template void liegroups::transform_point<double,double>(double[3], const SL3<double> &, const double[3]);
template void liegroups::transform_point<double,float>(float[3], const SL3<double> &, const float[3]);
template void liegroups::transform_point<float,double>(double[3], const SL3<float> &, const double[3]);
template <class S, class X>
void liegroups::transform_point_by_inverse(X y[3], const SL3<S> &g, const X x[3])
{
SL3<S> ginv = inverse(g);
transform_point(y, ginv, x);
}
template void liegroups::transform_point_by_inverse<float,float>(float[3], const SL3<float> &, const float[3]);
template void liegroups::transform_point_by_inverse<double,double>(double[3], const SL3<double> &, const double[3]);
template void liegroups::transform_point_by_inverse<double,float>(float[3], const SL3<double> &, const float[3]);
template void liegroups::transform_point_by_inverse<float,double>(double[3], const SL3<float> &, const double[3]);
template <typename S>
static void to_alg(S h[3*3], const S v[8])
{
h[0] = v[3] + v[4];
h[1] = v[5] - v[2];
h[2] = v[0];
h[3] = v[2] + v[5];
h[4] = v[3] - v[4];
h[5] = v[1];
h[6] = v[6];
h[7] = v[7];
h[8] = (S)-2 * v[3];
}
template <typename S>
static void from_alg(S v[8], const S h[3*3])
{
v[0] = h[2];
v[1] = h[5];
v[2] = (S)0.5 * (h[3] - h[1]);
v[3] = (S)0.5 * (h[0] + h[4]);
v[4] = (S)0.5 * (h[0] - h[4]);
v[5] = (S)0.5 * (h[1] + h[3]);
v[6] = h[6];
v[7] = h[7];
}
template <class S>
void liegroups::exp(SL3<S> &X, const S v[8])
{
S h[3*3];
to_alg(h, v);
if (!liegroups::expm<3>(X.H, h))
X = SL3<S>::identity;
rectify(X);
}
template void liegroups::exp<float>(SL3<float> &, const float[8]);
template void liegroups::exp<double>(SL3<double> &, const double[8]);
template <class S>
bool liegroups::log(S v[8], const SL3<S> &X)
{
S h[3*3];
if (!liegroups::logm<3>(h, X.H)) {
//std::cerr << "logm failed" << std::endl;
return false;
}
from_alg(v, h);
return true;
}
template bool liegroups::log<float>(float[8], const SL3<float> &);
template bool liegroups::log<double>(double[8], const SL3<double> &);
template <class S>
void liegroups::adjoint(S adj[8*8], const SL3<S> &g)
{
const SL3<S> ginv = inverse(g);
const S* L = g.H;
const S* R = ginv.H;
const S m[8*8] = {
L[0]*R[6], L[1]*R[6], L[1]*R[0]-L[0]*R[3], L[0]*R[0]+L[1]*R[3]-(S)2*L[2]*R[6], L[0]*R[0]-L[1]*R[3], L[0]*R[3]+L[1]*R[0], L[2]*R[0], L[2]*R[3],
L[0]*R[7], L[1]*R[7], L[1]*R[1]-L[0]*R[4], L[0]*R[1]+L[1]*R[4]-(S)2*L[2]*R[7], L[0]*R[1]-L[1]*R[4], L[0]*R[4]+L[1]*R[1], L[2]*R[1], L[2]*R[4],
L[0]*R[8], L[1]*R[8], L[1]*R[2]-L[0]*R[5], L[0]*R[2]+L[1]*R[5]-(S)2*L[2]*R[8], L[0]*R[2]-L[1]*R[5], L[0]*R[5]+L[1]*R[2], L[2]*R[2], L[2]*R[5],
L[3]*R[6], L[4]*R[6], L[4]*R[0]-L[3]*R[3], L[3]*R[0]+L[4]*R[3]-(S)2*L[5]*R[6], L[3]*R[0]-L[4]*R[3], L[3]*R[3]+L[4]*R[0], L[5]*R[0], L[5]*R[3],
L[3]*R[7], L[4]*R[7], L[4]*R[1]-L[3]*R[4], L[3]*R[1]+L[4]*R[4]-(S)2*L[5]*R[7], L[3]*R[1]-L[4]*R[4], L[3]*R[4]+L[4]*R[1], L[5]*R[1], L[5]*R[4],
L[3]*R[8], L[4]*R[8], L[4]*R[2]-L[3]*R[5], L[3]*R[2]+L[4]*R[5]-(S)2*L[5]*R[8], L[3]*R[2]-L[4]*R[5], L[3]*R[5]+L[4]*R[2], L[5]*R[2], L[5]*R[5],
L[6]*R[6], L[7]*R[6], L[7]*R[0]-L[6]*R[3], L[6]*R[0]+L[7]*R[3]-(S)2*L[8]*R[6], L[6]*R[0]-L[7]*R[3], L[6]*R[3]+L[7]*R[0], L[8]*R[0], L[8]*R[3],
L[6]*R[7], L[7]*R[7], L[7]*R[1]-L[6]*R[4], L[6]*R[1]+L[7]*R[4]-(S)2*L[8]*R[7], L[6]*R[1]-L[7]*R[4], L[6]*R[4]+L[7]*R[1], L[8]*R[1], L[8]*R[4],
};
for (int i=0; i<8; ++i) {
adj[ 0+i] = m[16+i];
adj[ 8+i] = m[40+i];
adj[16+i] = (S)0.5*(m[24+i] - m[ 8+i]);
adj[24+i] = (S)0.5*(m[ i] + m[32+i]);
adj[32+i] = (S)0.5*(m[ i] - m[32+i]);
adj[40+i] = (S)0.5*(m[ 8+i] + m[24+i]);
adj[48+i] = m[48+i];
adj[56+i] = m[56+i];
}
}
template void liegroups::adjoint<float>(float[8*8], const SL3<float> &);
template void liegroups::adjoint<double>(double[8*8], const SL3<double> &);
template <class S>
void liegroups::adjoint_multiply(S y[8], const SL3<S> &g, const S x[8])
{
S h[3*3];
to_alg(h, x);
const SL3<S> ginv = inverse(g);
// Compute H*alg(h)*H^-1
S gh[3*3];
mat_mult_square<3>(gh, g.H, h);
mat_mult_square<3>(h, gh, ginv.H);
from_alg(y, h);
}
template void liegroups::adjoint_multiply<float>(float[8], const SL3<float> &, const float[8]);
template void liegroups::adjoint_multiply<double>(double[8], const SL3<double> &, const double[8]);
template <class S>
void liegroups::adjoint_T_multiply(S y[8], const SL3<S> &g, const S x[8])
{
S adj[8*8];
adjoint(adj, g);
const S v[8] = {x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7]};
for (int i=0; i<8; ++i) {
S sum = 0;
for (int j=0; j<8; ++j) {
sum += adj[i + j*8] * v[j];
}
y[i] = sum;
}
}
template void liegroups::adjoint_T_multiply<float>(float[8], const SL3<float> &, const float[8]);
template void liegroups::adjoint_T_multiply<double>(double[8], const SL3<double> &, const double[8]);
| 33.329365
| 150
| 0.535659
|
ojwoodford
|
8c623244b6944b6d0bd3e99b6aa3517fc7b43883
| 1,915
|
cpp
|
C++
|
nnforge/cuda/layer_testing_schema.cpp
|
anshumang/nnForgeINST
|
1e9ea1b539cadbb03daa39f5d81025c1b17c21d8
|
[
"Apache-2.0"
] | 2
|
2015-08-19T08:02:59.000Z
|
2017-06-18T21:10:36.000Z
|
nnforge/cuda/layer_testing_schema.cpp
|
yanshanjing/nnForge
|
6d2baa1174a90b8e5e8bf2a4b259ce8a37fbddf1
|
[
"Apache-2.0"
] | null | null | null |
nnforge/cuda/layer_testing_schema.cpp
|
yanshanjing/nnForge
|
6d2baa1174a90b8e5e8bf2a4b259ce8a37fbddf1
|
[
"Apache-2.0"
] | null | null | null |
/*
* Copyright 2011-2013 Maxim Milakov
*
* 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 "layer_testing_schema.h"
#include "neural_network_cuda_exception.h"
namespace nnforge
{
namespace cuda
{
layer_testing_schema::layer_testing_schema()
{
}
layer_testing_schema::~layer_testing_schema()
{
}
layer_testing_schema_smart_ptr layer_testing_schema::create(
const_layer_smart_ptr layer_schema,
cuda_running_configuration_const_smart_ptr cuda_config) const
{
layer_testing_schema_smart_ptr res = create_specific();
res->layer_schema = layer_schema;
res->cuda_config = cuda_config;
return res;
}
layer_tester_cuda_smart_ptr layer_testing_schema::create_tester(
const layer_configuration_specific& input_configuration_specific,
const layer_configuration_specific& output_configuration_specific) const
{
layer_tester_cuda_smart_ptr res = create_tester_specific(
input_configuration_specific,
output_configuration_specific);
res->configure(
input_configuration_specific,
output_configuration_specific,
layer_schema,
cuda_config);
return res;
}
std::vector<const_cuda_linear_buffer_device_smart_ptr> layer_testing_schema::get_schema_buffers() const
{
return std::vector<const_cuda_linear_buffer_device_smart_ptr>();
}
}
}
| 28.161765
| 106
| 0.742559
|
anshumang
|
8c65448f196ac451808eefb9d4c61faeb6c5fd8f
| 2,403
|
hpp
|
C++
|
libcaf_core/caf/detail/tick_emitter.hpp
|
Hamdor/actor-framework
|
ce63edffa2b7acb698cfaea571142029d38e9ef0
|
[
"BSD-3-Clause"
] | 2,517
|
2015-01-04T22:19:43.000Z
|
2022-03-31T12:20:48.000Z
|
libcaf_core/caf/detail/tick_emitter.hpp
|
Hamdor/actor-framework
|
ce63edffa2b7acb698cfaea571142029d38e9ef0
|
[
"BSD-3-Clause"
] | 894
|
2015-01-07T14:21:21.000Z
|
2022-03-30T06:37:18.000Z
|
libcaf_core/caf/detail/tick_emitter.hpp
|
Hamdor/actor-framework
|
ce63edffa2b7acb698cfaea571142029d38e9ef0
|
[
"BSD-3-Clause"
] | 570
|
2015-01-21T18:59:33.000Z
|
2022-03-31T19:00:02.000Z
|
// This file is part of CAF, the C++ Actor Framework. See the file LICENSE in
// the main distribution directory for license terms and copyright or visit
// https://github.com/actor-framework/actor-framework/blob/master/LICENSE.
#pragma once
#include <chrono>
#include <initializer_list>
#include "caf/config.hpp"
#include "caf/detail/core_export.hpp"
namespace caf::detail {
/// Converts realtime into a series of ticks, whereas each tick represents a
/// preconfigured timespan. For example, a tick emitter configured with a
/// timespan of 25ms generates a tick every 25ms after starting it.
class CAF_CORE_EXPORT tick_emitter {
public:
// -- member types -----------------------------------------------------------
/// Discrete point in time.
using clock_type = std::chrono::steady_clock;
/// Discrete point in time.
using time_point = typename clock_type::time_point;
/// Difference between two points in time.
using duration_type = typename time_point::duration;
// -- constructors, destructors, and assignment operators --------------------
tick_emitter();
tick_emitter(time_point now);
/// Queries whether the start time is non-default constructed.
bool started() const;
/// Configures the start time.
void start(time_point now);
/// Resets the start time to 0.
void stop();
/// Configures the time interval per tick.
void interval(duration_type x);
/// Returns the time interval per tick.
duration_type interval() const {
return interval_;
}
/// Advances time and calls `consumer` for each emitted tick.
template <class F>
void update(time_point now, F& consumer) {
CAF_ASSERT(interval_.count() != 0);
auto d = now - start_;
auto current_tick_id = static_cast<size_t>(d.count() / interval_.count());
while (last_tick_id_ < current_tick_id)
consumer(++last_tick_id_);
}
/// Advances time by `t` and returns all triggered periods as bitmask.
size_t timeouts(time_point t, std::initializer_list<size_t> periods);
/// Returns the next time point after `t` that would trigger any of the tick
/// periods, i.e., returns the next time where any of the tick periods
/// triggers `tick id % period == 0`.
time_point next_timeout(time_point t, std::initializer_list<size_t> periods);
private:
time_point start_;
duration_type interval_;
size_t last_tick_id_;
};
} // namespace caf::detail
| 30.417722
| 80
| 0.697878
|
Hamdor
|
8c6808431b37d0adf403a314104b2422f4199369
| 497
|
cpp
|
C++
|
components/config/ConfigSingleton.cpp
|
DigitalFuturesAda/Battleships
|
ce2e4a77bc3f3284ea2a8d8c43204ae9acab61fc
|
[
"BSD-Source-Code"
] | null | null | null |
components/config/ConfigSingleton.cpp
|
DigitalFuturesAda/Battleships
|
ce2e4a77bc3f3284ea2a8d8c43204ae9acab61fc
|
[
"BSD-Source-Code"
] | null | null | null |
components/config/ConfigSingleton.cpp
|
DigitalFuturesAda/Battleships
|
ce2e4a77bc3f3284ea2a8d8c43204ae9acab61fc
|
[
"BSD-Source-Code"
] | 1
|
2021-03-24T00:40:12.000Z
|
2021-03-24T00:40:12.000Z
|
//
// Created by Suraj Lyons on 14/03/2021.
//
#include "ConfigSingleton.h"
#include <utility>
ConfigSingleton* ConfigSingleton::instance = nullptr;
ConfigSingleton* ConfigSingleton::getInstance() {
if (instance == nullptr) {
instance = new ConfigSingleton();
}
return instance;
}
void ConfigSingleton::setValidator(ConfigValidator validator) {
configValidator = std::move(validator);
}
ConfigValidator ConfigSingleton::getValidator() {
return configValidator;
}
| 19.88
| 63
| 0.720322
|
DigitalFuturesAda
|
8c721ddae4f52b1184b13ce2a603b1d5a225d846
| 543
|
cpp
|
C++
|
src/1000/1890.cpp14.cpp
|
upple/BOJ
|
e6dbf9fd17fa2b458c6a781d803123b14c18e6f1
|
[
"MIT"
] | 8
|
2018-04-12T15:54:09.000Z
|
2020-06-05T07:41:15.000Z
|
src/1000/1890.cpp14.cpp
|
upple/BOJ
|
e6dbf9fd17fa2b458c6a781d803123b14c18e6f1
|
[
"MIT"
] | null | null | null |
src/1000/1890.cpp14.cpp
|
upple/BOJ
|
e6dbf9fd17fa2b458c6a781d803123b14c18e6f1
|
[
"MIT"
] | null | null | null |
#include <cstdio>
typedef long long ll;
ll adj[100][100], dp[100][100] = {};
int n;
ll ans(int x, int y)
{
if (dp[x][y] != -1)
return dp[x][y];
dp[x][y] = 0;
for (int i = x-1; i >= 0; i--)
if (i + adj[i][y] == x)
dp[x][y] += ans(i, y);
for (int i = y-1; i >= 0; i--)
if (i + adj[x][i] == y)
dp[x][y] += ans(x, i);
return dp[x][y];
}
int main()
{
scanf("%d", &n);
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
scanf("%lld", &adj[i][j]), dp[i][j]=-1;
dp[0][0] = 1;
printf("%lld", ans(n - 1, n - 1));
}
| 15.970588
| 42
| 0.429098
|
upple
|
8c740923f23a50e712ee2d1c7c3d66da4ec8bb33
| 1,180
|
hpp
|
C++
|
engine/src/gfx/platform/platformframebuffer.hpp
|
TRBFLXR/x808
|
d5ab9e96c5a6109283151a591c261e4183628075
|
[
"MIT"
] | null | null | null |
engine/src/gfx/platform/platformframebuffer.hpp
|
TRBFLXR/x808
|
d5ab9e96c5a6109283151a591c261e4183628075
|
[
"MIT"
] | null | null | null |
engine/src/gfx/platform/platformframebuffer.hpp
|
TRBFLXR/x808
|
d5ab9e96c5a6109283151a591c261e4183628075
|
[
"MIT"
] | null | null | null |
//
// Created by FLXR on 8/8/2018.
//
#ifndef X808_PLATFORMFRAMEBUFFER_HPP
#define X808_PLATFORMFRAMEBUFFER_HPP
#include <unordered_map>
#include <xe/gfx/texture.hpp>
namespace xe::internal {
class PlatformFrameBuffer {
public:
virtual ~PlatformFrameBuffer() = default;
virtual void load(const std::unordered_map<Attachment, const Texture *> &attachments) = 0;
virtual void copy(PlatformFrameBuffer *dest) = 0;
virtual void bindDrawAttachment(Attachment attachment) const = 0;
virtual void bindDrawAttachments(Attachment *attachments, uint size) const = 0;
virtual void bindReadAttachment(Attachment attachment) const = 0;
virtual void bindDraw(Attachment attachment) const = 0;
virtual void bindDraw(Attachment *attachments, uint size) const = 0;
virtual void bindRead(Attachment attachment) const = 0;
virtual void unbind() const = 0;
virtual void bindTexture(Attachment attachment, const Texture *texture) const = 0;
virtual uint getHandle() const = 0;
virtual const string &getName() const = 0;
virtual const Texture *getTexture(Attachment attachment) = 0;
};
}
#endif //X808_PLATFORMFRAMEBUFFER_HPP
| 28.095238
| 94
| 0.738136
|
TRBFLXR
|
8c7898076df441970240f31fc2e5c286cc31b382
| 5,803
|
cpp
|
C++
|
VectorAsteroids/RockController.cpp
|
LanceJZ/SDL2VectorAsteroids
|
4f91590cbd9dccd88a0adb290ca20f3eefa3e5cd
|
[
"Unlicense"
] | 3
|
2015-12-04T08:23:57.000Z
|
2020-08-17T04:54:51.000Z
|
VectorAsteroids/RockController.cpp
|
LanceJZ/SDL2VectorAsteroids
|
4f91590cbd9dccd88a0adb290ca20f3eefa3e5cd
|
[
"Unlicense"
] | null | null | null |
VectorAsteroids/RockController.cpp
|
LanceJZ/SDL2VectorAsteroids
|
4f91590cbd9dccd88a0adb290ca20f3eefa3e5cd
|
[
"Unlicense"
] | 2
|
2015-01-02T14:56:53.000Z
|
2021-05-06T09:06:04.000Z
|
#include "RockController.h"
void RockController::Update(double *Frame)
{
for (int rock = 0; rock < m_LargeRocks.size(); rock++)
{
m_LargeRocks[rock]->Update(Frame);
}
for (int rock = 0; rock < m_MedRocks.size(); rock++)
{
m_MedRocks[rock]->Update(Frame);
}
for (int rock = 0; rock < m_SmallRocks.size(); rock++)
{
m_SmallRocks[rock]->Update(Frame);
}
}
void RockController::Draw(void)
{
for (int rock = 0; rock < m_LargeRocks.size(); rock++)
{
m_LargeRocks[rock]->Draw();
}
for (int rock = 0; rock < m_MedRocks.size(); rock++)
{
m_MedRocks[rock]->Draw();
}
for (int rock = 0; rock < m_SmallRocks.size(); rock++)
{
m_SmallRocks[rock]->Draw();
}
}
void RockController::Initialize(void)
{
ClearAllRocks();
}
void RockController::SpawnNewWave(int NumberOfRocks)
{
for (int rock = 0; rock < NumberOfRocks; rock++)
{
bool spawnnewrock = true;
for (int rockcheck = 0; rockcheck < m_LargeRocks.size(); rockcheck++)
{
if (!m_LargeRocks[rockcheck]->GetActive())
{
spawnnewrock = false;
m_LargeRocks[rockcheck]->Activate(Vector2i(0, GetRandomY()));
break;
}
}
if (spawnnewrock)
{
m_LargeRocks.push_back(new LargeRock(p_ExplosionSound));
m_LargeRocks[m_LargeRocks.size() - 1]->Activate(Vector2i(0, GetRandomY()));
}
}
}
void RockController::SpawnMedRocks(Vector2i location)
{
for (int rock = 0; rock < 2; rock++)
{
bool spawnnewrock = true;
for (int rockcheck = 0; rockcheck < m_MedRocks.size(); rockcheck++)
{
if (!m_MedRocks[rockcheck]->GetActive())
{
spawnnewrock = false;
m_MedRocks[rockcheck]->Activate(location);
break;
}
}
if (spawnnewrock)
{
m_MedRocks.push_back(new MediumRock(p_ExplosionSound));
m_MedRocks[m_MedRocks.size() - 1]->Activate(location);
}
}
}
void RockController::SpawnSmallRocks(Vector2i location)
{
for (int rock = 0; rock < 2; rock++)
{
bool spawnnewrock = true;
for (int rockcheck = 0; rockcheck < m_SmallRocks.size(); rockcheck++)
{
if (!m_SmallRocks[rockcheck]->GetActive())
{
spawnnewrock = false;
m_SmallRocks[rockcheck]->Activate(location);
break;
}
}
if (spawnnewrock)
{
m_SmallRocks.push_back(new SmallRock(p_ExplosionSound));
m_SmallRocks[m_SmallRocks.size() - 1]->Activate(location);
}
}
}
void RockController::SmallRockDistroyed(int rock)
{
m_SmallRocks[rock]->Distroyed();
}
void RockController::MedRockDistroyed(int rock)
{
SpawnSmallRocks(m_MedRocks[rock]->GetLocation());
m_MedRocks[rock]->Distroyed();
}
void RockController::LargeRockDistroyed(int rock)
{
SpawnMedRocks(m_LargeRocks[rock]->GetLocation());
m_LargeRocks[rock]->Distroyed();
}
void RockController::NewGame(void)
{
ClearAllRocks();
m_NumberOfRocks = 4;
SpawnNewWave(m_NumberOfRocks);
}
RockController::RockController() : Common()
{
p_ExplosionSound = Mix_LoadWAV("RockExplosion.wav");
Mix_VolumeChunk(p_ExplosionSound, MIX_MAX_VOLUME / 6);
CreateRocks();
NewGame();
}
RockController::~RockController(void)
{
}
//Private Methods -------------------------------------------------------------------
void RockController::CreateRocks(void)
{
for (int rock = 0; rock < 8; rock++)
{
m_LargeRocks.push_back(new LargeRock(p_ExplosionSound));
}
for (int rock = 0; rock < 16; rock++)
{
m_MedRocks.push_back(new MediumRock(p_ExplosionSound));
}
for (int rock = 0; rock < 32; rock++)
{
m_SmallRocks.push_back(new SmallRock(p_ExplosionSound));
}
}
bool RockController::CheckEndOfWave(void)
{
bool endwave = true;
for (int rock = 0; rock < m_LargeRocks.size(); rock++)
{
if (m_LargeRocks[rock]->GetActive())
return false;
}
for (int rock = 0; rock < m_MedRocks.size(); rock++)
{
if (m_MedRocks[rock]->GetActive())
return false;
}
for (int rock = 0; rock < m_SmallRocks.size(); rock++)
{
if (m_SmallRocks[rock]->GetActive())
return false;
}
return true;
}
void RockController::NewWave(void)
{
if (m_NumberOfRocks < 12)
m_NumberOfRocks++;
SpawnNewWave(m_NumberOfRocks);
}
void RockController::ClearAllRocks(void)
{
for (int rock = 0; rock < m_LargeRocks.size(); rock++)
{
m_LargeRocks[rock]->SetActive(false);
m_LargeRocks[rock]->SetDistroyed(false);
}
for (int rock = 0; rock < m_MedRocks.size(); rock++)
{
m_MedRocks[rock]->SetActive(false);
m_MedRocks[rock]->SetDistroyed(false);
}
for (int rock = 0; rock < m_SmallRocks.size(); rock++)
{
m_SmallRocks[rock]->SetActive(false);
m_SmallRocks[rock]->SetDistroyed(false);
}
}
Vector2i RockController::GetLargeLocation(int rock)
{
return m_LargeRocks[rock]->GetLocation();
}
int RockController::GetLargeRockCount()
{
return m_LargeRocks.size();
}
int RockController::GetLargeRockRadius()
{
return m_LargeRocks[0]->GetRadius();
}
bool RockController::GetLargeRockActive(int rock)
{
return m_LargeRocks[rock]->GetActive();
}
int RockController::GetLargeRockPoints()
{
return m_LargeRocks[0]->PlayerShotRock();
}
Vector2i RockController::GetMedLocation(int rock)
{
return m_MedRocks[rock]->GetLocation();
}
int RockController::GetMedRockCount()
{
return m_MedRocks.size();
}
int RockController::GetMedRockRadius()
{
return m_MedRocks[0]->GetRadius();
}
bool RockController::GetMedRockActive(int rock)
{
return m_MedRocks[rock]->GetActive();
}
int RockController::GetMedRockPoints()
{
return m_MedRocks[0]->PlayerShotRock();
}
Vector2i RockController::GetSmallLocation(int rock)
{
return m_SmallRocks[rock]->GetLocation();
}
int RockController::GetSmallRockCount()
{
return m_SmallRocks.size();
}
int RockController::GetSmallRockRadius()
{
return m_SmallRocks[0]->GetRadius();
}
bool RockController::GetSmallRockActive(int rock)
{
return m_SmallRocks[rock]->GetActive();
}
int RockController::GetSmallRockPoints()
{
return m_SmallRocks[0]->PlayerShotRock();
}
| 19.343333
| 85
| 0.686197
|
LanceJZ
|
8c7c3c467f9db27f3f6a43792beab6c09c20abca
| 9,111
|
cpp
|
C++
|
TrackAlgTLD/src/cvblobs/ComponentLabeling.cpp
|
RayanWang/CameraTrackingFramework
|
1ab2f7289cd000a4baa584bca469744a5486610f
|
[
"MIT"
] | 3
|
2016-11-05T03:31:48.000Z
|
2016-12-07T05:57:28.000Z
|
TrackAlgTLD/src/cvblobs/ComponentLabeling.cpp
|
RayanWang/CameraTrackingFramework
|
1ab2f7289cd000a4baa584bca469744a5486610f
|
[
"MIT"
] | null | null | null |
TrackAlgTLD/src/cvblobs/ComponentLabeling.cpp
|
RayanWang/CameraTrackingFramework
|
1ab2f7289cd000a4baa584bca469744a5486610f
|
[
"MIT"
] | 3
|
2018-11-10T17:19:49.000Z
|
2020-04-11T16:30:26.000Z
|
#include "ComponentLabeling.h"
//! Conversion from freeman code to coordinate increments (counterclockwise)
static const CvPoint freemanCodeIncrement[8] =
{ {1, 0}, {1, -1}, {0, -1}, {-1, -1}, {-1, 0}, {-1, 1}, {0, 1}, {1, 1} };
inline unsigned char GET_ABOVE_IMAGEPIXEL( unsigned char *currentPixel, IplImage *image )
{
return *(currentPixel - image->widthStep);
}
inline unsigned char GET_BELOW_IMAGEPIXEL( unsigned char *currentPixel, IplImage *image )
{
return *(currentPixel + image->widthStep);
}
inline unsigned char GET_IMAGE_PIXEL( IplImage *image, CvPoint p )
{
return *(image->imageData + p.x + p.y *image->widthStep);
}
inline bool GET_IMAGEMASK_PIXEL( IplImage *mask, CvPoint p )
{
if( mask != NULL )
return ((unsigned char)*(mask->imageData + p.x + p.y *mask->widthStep)) > 0;
else
return true;
}
inline bool GET_BELOW_VISITEDPIXEL( bool *currentPixel, int imageWidth )
{
return *( currentPixel + imageWidth );
}
inline void ASSIGN_LABEL( CvPoint p, t_labelType *labels, int imageWidth, int newLabel )
{
*(labels + p.y * imageWidth + p.x) = newLabel;
}
inline void ASSIGN_VISITED( CvPoint p, bool *visitedPoints, int imageWidth )
{
*(visitedPoints + p.y * imageWidth + p.x) = true;
}
bool ComponentLabeling( IplImage* inputImage,
IplImage* maskImage,
unsigned char backgroundColor,
Blob_vector &blobs )
{
int i,j;
// row major vector with visited points
bool *visitedPoints, *pVisitedPoints, internalContour, externalContour;
unsigned char *pInputImage, *pMask, *pAboveInputImage, *pBelowInputImage,
*pAboveMask, *pBelowMask;
int imageWidth, imageHeight, currentLabel, contourLabel;
// row major vector with labelled image
t_labelType *labelledImage, *pLabels;
//! current blob pointer
CBlob *currentBlob;
CvSize imageSizes;
CvPoint currentPoint;
// verify input image
if( !CV_IS_IMAGE( inputImage ) )
return false;
// verify that input image and mask image has same size
if( maskImage )
{
if( !CV_IS_IMAGE(maskImage) ||
maskImage->width != inputImage->width ||
maskImage->height != inputImage->height )
return false;
}
else
{
pMask = NULL;
pAboveMask = NULL;
pBelowMask = NULL;
}
imageSizes = cvSize(inputImage->width,inputImage->height);
imageWidth = inputImage->width;
imageHeight = inputImage->height;
// create auxiliary buffers
labelledImage = (t_labelType*) malloc( inputImage->width * inputImage->height * sizeof(t_labelType) );
visitedPoints = (bool*) malloc( inputImage->width * inputImage->height * sizeof(bool) );
// initialize it to 0
memset(labelledImage, 0, inputImage->width * inputImage->height * sizeof(t_labelType) ) ;
memset(visitedPoints, false, inputImage->width * inputImage->height * sizeof(bool) ) ;
// initialize pointers and label counter
pLabels = labelledImage;
pVisitedPoints = visitedPoints;
currentLabel = 1;
for (j = 0; j < imageHeight; j++ )
{
// don't verify if we area on first or last row, it will verified on pointer access
pAboveInputImage = (unsigned char*) inputImage->imageData + (j-1) * inputImage->widthStep;
pBelowInputImage = (unsigned char*) inputImage->imageData + (j+1) * inputImage->widthStep;
pInputImage = (unsigned char*) inputImage->imageData + j * inputImage->widthStep;
if( maskImage )
{
pMask = (unsigned char*) maskImage->imageData + j * maskImage->widthStep;
// don't verify if we area on first or last row, it will verified on pointer access
pAboveMask = (unsigned char*) maskImage->imageData + (j-1) * maskImage->widthStep;
pBelowMask = (unsigned char*) maskImage->imageData + (j+1) * maskImage->widthStep;
}
for (i = 0; i < imageWidth; i++, pInputImage++, pMask++, pAboveInputImage++, pBelowInputImage++,
pAboveMask++, pBelowMask++ )
{
// ignore background pixels or 0 pixels in mask
if ( (*pInputImage == backgroundColor) || (maskImage && *pMask == 0 ))
{
pLabels++;
pVisitedPoints++;
continue;
}
// new external contour: current label == 0 and above pixel is background
if( j > 0 )
{
externalContour = ((*pAboveInputImage == backgroundColor) ||
(maskImage && *pAboveMask == 0)) &&
(*pLabels == 0);
}
else
externalContour = (*pLabels == 0);
// new internal contour: below pixel is background and not visited
if( !externalContour && j < imageHeight - 1 )
{
internalContour = *pBelowInputImage == backgroundColor &&
!GET_BELOW_VISITEDPIXEL( pVisitedPoints, imageWidth);
}
else
{
internalContour = false;
}
if( externalContour )
{
currentPoint = cvPoint(i,j);
// assign label to labelled image
*pLabels = currentLabel;
// create new blob
currentBlob = new CBlob(currentLabel, currentPoint, imageSizes );
// contour tracing with currentLabel
contourTracing( inputImage, maskImage, currentPoint,
labelledImage, visitedPoints,
currentLabel, false, backgroundColor, currentBlob->GetExternalContour() );
// add new created blob
blobs.push_back(currentBlob);
currentLabel++;
}
else
{
if( internalContour )
{
currentPoint = cvPoint(i,j);
if( *pLabels == 0 )
{
// take left neightbour value as current
if( i > 0 )
contourLabel = *(pLabels - 1);
}
else
{
contourLabel = *pLabels;
}
if(contourLabel>0)
{
currentBlob = blobs[contourLabel-1];
CBlobContour newContour(currentPoint, currentBlob->GetStorage());
// contour tracing with contourLabel
contourTracing( inputImage, maskImage, currentPoint, labelledImage, visitedPoints,
contourLabel, true, backgroundColor, &newContour );
currentBlob->AddInternalContour( newContour );
}
}
// neither internal nor external contour
else
{
// take left neightbour value as current if it is not labelled
if( i > 0 && *pLabels == 0 )
*pLabels = *(pLabels - 1);
}
}
pLabels++;
pVisitedPoints++;
}
}
// free auxiliary buffers
free( labelledImage );
free( visitedPoints );
return true;
}
void contourTracing( IplImage *image,
IplImage *maskImage,
CvPoint contourStart, t_labelType *labels, bool *visitedPoints, t_labelType label,
bool internalContour, unsigned char backgroundColor, CBlobContour *currentBlobcontour )
{
CvPoint t, tnext, tsecond;
short initialMovement, movement;
if( internalContour )
{
initialMovement = 7;//3;
}
else
{
initialMovement = 3;//7;
}
tsecond = tracer( image, maskImage, contourStart, visitedPoints, initialMovement,
backgroundColor, movement );
// assign current label to tnext
ASSIGN_LABEL( contourStart, labels, image->width, label );
// contour corresponds to isolated pixel?
if( tsecond.x == contourStart.x && tsecond.y == contourStart.y )
{
// we are finished with the contour
return;
}
// add chain code to current contour
currentBlobcontour->AddChainCode(movement);
// assign label to next point
ASSIGN_LABEL( tsecond, labels, image->width, label );
tnext.x = tsecond.x;
tnext.y = tsecond.y;
t.x = tnext.x;
t.y = tnext.y;
// while T is different than contourStart and tnext is different than T
// follow contour until start point is reached again
while ( t.x != contourStart.x || t.y != contourStart.y ||
tsecond.x != tnext.x || tsecond.y != tnext.y )
{
t.x = tnext.x;
t.y = tnext.y;
initialMovement = (movement + 5) % 8;
// search for next contour point
tnext = tracer( image, maskImage, t, visitedPoints, initialMovement,
backgroundColor, movement );
// assign label to contour point
ASSIGN_LABEL( tnext, labels, image->width, label );
// add chain code to current contour
currentBlobcontour->AddChainCode(movement);
}
}
CvPoint tracer( IplImage *image, IplImage *maskImage, CvPoint P, bool *visitedPoints,
short initialMovement,
unsigned char backgroundColor, short &movement )
{
int d;
CvPoint pNext;
for (d = 0; d <= 7; d++ )
{
movement = (initialMovement + d) % 8;
pNext.x = P.x + freemanCodeIncrement[movement].x;
pNext.y = P.y + freemanCodeIncrement[movement].y;
// the point is inside image ?
if( pNext.x < 0 || pNext.x >= image->width ||
pNext.y < 0 || pNext.y >= image->height )
{
// try other movement
continue;
}
// image has blobColor value in the new point?
if( (GET_IMAGE_PIXEL( image, pNext ) != backgroundColor ) && GET_IMAGEMASK_PIXEL(maskImage, pNext ) )
{
return pNext;
}
else
{
// mark point as visited
ASSIGN_VISITED( pNext, visitedPoints, image->width );
}
}
// no possible movement was found
movement = -1;
pNext.x = P.x;
pNext.y = P.y;
return pNext;
}
| 27.197015
| 104
| 0.644057
|
RayanWang
|
8c80eb44cf8a1172b7b7eecfb8f758e4f9544ab2
| 1,759
|
cpp
|
C++
|
Token.cpp
|
MarkLeone/WeekendCompiler
|
4c0588e0425f3b374f3a951dbaf05343b11967ef
|
[
"MIT"
] | 15
|
2018-12-15T03:20:18.000Z
|
2022-01-25T20:12:03.000Z
|
Token.cpp
|
MarkLeone/WeekendCompiler
|
4c0588e0425f3b374f3a951dbaf05343b11967ef
|
[
"MIT"
] | null | null | null |
Token.cpp
|
MarkLeone/WeekendCompiler
|
4c0588e0425f3b374f3a951dbaf05343b11967ef
|
[
"MIT"
] | 2
|
2020-03-03T05:27:26.000Z
|
2020-03-28T13:38:10.000Z
|
#include "Token.h"
#include <string>
std::string Token::ToString() const
{
switch( GetTag() )
{
case kTokenNum:
{
std::stringstream stream;
stream << GetNum();
return stream.str();
}
case kTokenId: return GetId();
case kTokenBool: return "bool";
case kTokenTrue: return "true";
case kTokenFalse: return "false";
case kTokenInt: return "int";
case kTokenIf: return "if";
case kTokenElse: return "else";
case kTokenReturn: return "return";
case kTokenWhile: return "while";
case kTokenOperator: return "operator";
case kTokenPlus: return "+";
case kTokenMinus: return "-";
case kTokenTimes: return "*";
case kTokenDiv: return "/";
case kTokenMod: return "%";
case kTokenEQ: return "==";
case kTokenNE: return "!=";
case kTokenLT: return "<";
case kTokenLE: return "<=";
case kTokenGT: return ">";
case kTokenGE: return ">=";
case kTokenAnd: return "&&";
case kTokenOr: return "||";
case kTokenNot: return "!";
case kTokenLbrace: return "{";
case kTokenRbrace: return "}";
case kTokenLparen: return "(";
case kTokenRparen: return ")";
case kTokenComma: return ",";
case kTokenAssign: return "=";
case kTokenSemicolon: return ";";
case kTokenEOF: return "<EOF>";
}
assert(false && "Unhandled token kind");
return "";
}
| 35.18
| 49
| 0.484366
|
MarkLeone
|
8c80eddf6d5bb8c6c50ac591638cd5cd5314399d
| 542
|
cpp
|
C++
|
src/KinectFusionManager.cpp
|
diegomazala/QtKinect
|
c51819980af92b857d87a417d19c5f01d8fada77
|
[
"MIT"
] | 5
|
2016-08-04T14:14:11.000Z
|
2018-05-27T13:46:13.000Z
|
src/KinectFusionManager.cpp
|
diegomazala/QtKinect
|
c51819980af92b857d87a417d19c5f01d8fada77
|
[
"MIT"
] | null | null | null |
src/KinectFusionManager.cpp
|
diegomazala/QtKinect
|
c51819980af92b857d87a417d19c5f01d8fada77
|
[
"MIT"
] | 4
|
2015-12-08T06:22:46.000Z
|
2022-03-15T10:29:17.000Z
|
#include "KinectFusionManager.h"
#include "QKinectGrabberFromFile.h"
#include <iostream>
KinectFusionManager::KinectFusionManager(
QKinectGrabberFromFile* kinect_grabber,
QObject* parent) :
QObject(parent)
, kinectGrabber(kinect_grabber)
{
}
KinectFusionManager::~KinectFusionManager()
{
}
void KinectFusionManager::onNewFrame()
{
if (kinectGrabber)
{
KinectFrame knt;
kinectGrabber->getDepthBuffer(knt.info, knt.depth);
std::cout << "onFileInfo: " << knt.info.size() << ", " << knt.depth.size() << std::endl;
}
}
| 15.941176
| 90
| 0.715867
|
diegomazala
|
8c89159a087d9592332c8cfdf20698405698ce38
| 455
|
cpp
|
C++
|
cf/Educational Codeforces Round 41 (Rated for Div. 2) /a.cpp
|
emengdeath/acmcode
|
cc1b0e067464e754d125856004a991d6eb92a2cd
|
[
"MIT"
] | null | null | null |
cf/Educational Codeforces Round 41 (Rated for Div. 2) /a.cpp
|
emengdeath/acmcode
|
cc1b0e067464e754d125856004a991d6eb92a2cd
|
[
"MIT"
] | null | null | null |
cf/Educational Codeforces Round 41 (Rated for Div. 2) /a.cpp
|
emengdeath/acmcode
|
cc1b0e067464e754d125856004a991d6eb92a2cd
|
[
"MIT"
] | null | null | null |
#include<bits/stdc++.h>
using namespace std;
const int N=1001;
int a[N];
int n,m,sum;
int main(){
ios::sync_with_stdio(false);
cin>>n>>m;
int ans=0;
for (int i=1;i<=m;i++){
int x;
cin>>x;
if (!a[x])sum++;
a[x]++;
if (sum==n){
for (int j=1;j<=n;j++){
a[j]--;
if (!a[j])sum--;
}
ans++;
}
}
cout<<ans;
return 0;
}
| 17.5
| 35
| 0.378022
|
emengdeath
|
8c968038e69428784260048933ce2e591057669a
| 5,343
|
cpp
|
C++
|
Tests/26/Test.cpp
|
SophistSolutions/Stroika
|
f4e5d84767903a054fba0a6b9c7c4bd1aaefd105
|
[
"MIT"
] | 28
|
2015-09-22T21:43:32.000Z
|
2022-02-28T01:35:01.000Z
|
Tests/26/Test.cpp
|
SophistSolutions/Stroika
|
f4e5d84767903a054fba0a6b9c7c4bd1aaefd105
|
[
"MIT"
] | 98
|
2015-01-22T03:21:27.000Z
|
2022-03-02T01:47:00.000Z
|
Tests/26/Test.cpp
|
SophistSolutions/Stroika
|
f4e5d84767903a054fba0a6b9c7c4bd1aaefd105
|
[
"MIT"
] | 4
|
2019-02-21T16:45:25.000Z
|
2022-02-18T13:40:04.000Z
|
/*
* Copyright(c) Sophist Solutions, Inc. 1990-2021. All rights reserved
*/
// TEST Foundation::Containers::SortedMapping
// STATUS Alpha-Late
#include "Stroika/Foundation/StroikaPreComp.h"
#include <iostream>
#include <sstream>
#include "Stroika/Foundation/Containers/Concrete/SortedMapping_stdmap.h"
#include "Stroika/Foundation/Containers/SortedMapping.h"
#include "Stroika/Foundation/Debug/Assertions.h"
#include "Stroika/Foundation/Debug/Trace.h"
#include "Stroika/Foundation/Memory/Optional.h"
#include "../TestCommon/CommonTests_Mapping.h"
#include "../TestHarness/SimpleClass.h"
#include "../TestHarness/TestHarness.h"
using namespace Stroika;
using namespace Stroika::Foundation;
using namespace Stroika::Foundation::Containers;
using Concrete::SortedMapping_stdmap;
namespace {
template <typename CONCRETE_CONTAINER>
void DoTestForConcreteContainer_ ()
{
using namespace CommonTests::MappingTests;
auto testSchema = DEFAULT_TESTING_SCHEMA<CONCRETE_CONTAINER>{};
testSchema.ApplyToContainerExtraTest = [] (const typename CONCRETE_CONTAINER::ArchetypeContainerType& m) {
// verify in sorted order
using value_type = typename CONCRETE_CONTAINER::value_type;
optional<value_type> last;
for (value_type i : m) {
if (last.has_value ()) {
VerifyTestResult (Common::ThreeWayComparerAdapter (m.GetInOrderKeyComparer ()) (last->fKey, i.fKey) <= 0);
}
last = i;
}
};
SimpleMappingTest_All_ (testSchema);
SimpleMappingTest_WithDefaultEqCompaerer_ (testSchema);
}
template <typename CONCRETE_CONTAINER, typename FACTORY, typename VALUE_EQUALS_COMPARER_TYPE>
void DoTestForConcreteContainer_ (FACTORY factory, VALUE_EQUALS_COMPARER_TYPE valueEqualsComparer)
{
using namespace CommonTests::MappingTests;
auto testSchema = DEFAULT_TESTING_SCHEMA<CONCRETE_CONTAINER, FACTORY, VALUE_EQUALS_COMPARER_TYPE>{factory, valueEqualsComparer};
testSchema.ApplyToContainerExtraTest = [] (const typename CONCRETE_CONTAINER::ArchetypeContainerType& m) {
// verify in sorted order
using value_type = typename CONCRETE_CONTAINER::value_type;
optional<value_type> last;
for (value_type i : m) {
if (last.has_value ()) {
VerifyTestResult (Common::ThreeWayComparerAdapter (m.GetInOrderKeyComparer ()) (last->fKey, i.fKey) <= 0);
}
last = i;
}
};
SimpleMappingTest_All_ (testSchema);
}
}
namespace {
namespace Test3_ConvertMapping2SortedMapping {
void TestAll ()
{
Mapping<int, int> m{pair<int, int>{1, 2}, pair<int, int>{2, 4}};
SortedMapping<int, int> ms{m};
VerifyTestResult (ms.size () == 2);
#if __cpp_impl_three_way_comparison >= 201907
VerifyTestResult ((*ms.begin () == pair<int, int>{1, 2}));
#endif
}
}
}
namespace {
void DoRegressionTests_ ()
{
struct MySimpleClassWithoutComparisonOperators_ComparerWithEquals_ : Common::ComparisonRelationDeclaration<Common::ComparisonRelationType::eEquals> {
using value_type = SimpleClassWithoutComparisonOperators;
bool operator() (const value_type& v1, const value_type& v2) const
{
return v1.GetValue () == v2.GetValue ();
}
};
struct MySimpleClassWithoutComparisonOperators_ComparerWithLess_ : Common::ComparisonRelationDeclaration<Common::ComparisonRelationType::eStrictInOrder> {
using value_type = SimpleClassWithoutComparisonOperators;
bool operator() (const value_type& v1, const value_type& v2) const
{
return v1.GetValue () < v2.GetValue ();
}
};
DoTestForConcreteContainer_<SortedMapping<size_t, size_t>> ();
DoTestForConcreteContainer_<SortedMapping<SimpleClass, SimpleClass>> ();
DoTestForConcreteContainer_<SortedMapping<SimpleClassWithoutComparisonOperators, SimpleClassWithoutComparisonOperators>> (
[] () { return SortedMapping<SimpleClassWithoutComparisonOperators, SimpleClassWithoutComparisonOperators> (MySimpleClassWithoutComparisonOperators_ComparerWithLess_{}); },
MySimpleClassWithoutComparisonOperators_ComparerWithEquals_{});
DoTestForConcreteContainer_<SortedMapping_stdmap<size_t, size_t>> ();
DoTestForConcreteContainer_<SortedMapping_stdmap<SimpleClass, SimpleClass>> ();
DoTestForConcreteContainer_<SortedMapping_stdmap<SimpleClassWithoutComparisonOperators, SimpleClassWithoutComparisonOperators>> (
[] () { return SortedMapping_stdmap<SimpleClassWithoutComparisonOperators, SimpleClassWithoutComparisonOperators> (MySimpleClassWithoutComparisonOperators_ComparerWithLess_{}); },
MySimpleClassWithoutComparisonOperators_ComparerWithEquals_{});
Test3_ConvertMapping2SortedMapping::TestAll ();
}
}
int main ([[maybe_unused]] int argc, [[maybe_unused]] const char* argv[])
{
Stroika::TestHarness::Setup ();
return Stroika::TestHarness::PrintPassOrFail (DoRegressionTests_);
}
| 44.525
| 191
| 0.689126
|
SophistSolutions
|
8c9767e075a89dcb702f70516171ceff3b1e90c1
| 10,810
|
tcc
|
C++
|
cxxblas/level3/syrk.tcc
|
ccecka/FLENS
|
b6cd7e630d490fde5432c6e9fc357089861bdffd
|
[
"BSD-3-Clause"
] | 3
|
2015-04-10T18:09:12.000Z
|
2018-03-27T23:43:32.000Z
|
cxxblas/level3/syrk.tcc
|
ccecka/FLENS
|
b6cd7e630d490fde5432c6e9fc357089861bdffd
|
[
"BSD-3-Clause"
] | null | null | null |
cxxblas/level3/syrk.tcc
|
ccecka/FLENS
|
b6cd7e630d490fde5432c6e9fc357089861bdffd
|
[
"BSD-3-Clause"
] | 4
|
2015-09-06T20:24:35.000Z
|
2021-07-31T07:50:55.000Z
|
/*
* Copyright (c) 2009, Michael Lehn
*
* 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 FLENS development group nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CXXBLAS_LEVEL3_SYRK_TCC
#define CXXBLAS_LEVEL3_SYRK_TCC 1
#include <cxxblas/cxxblas.h>
namespace cxxblas {
template <typename IndexType, typename ALPHA, typename MA,
typename BETA, typename MC>
void
syrk_generic(StorageOrder order, StorageUpLo upLoC,
Transpose transA,
IndexType n, IndexType k,
const ALPHA &alpha,
const MA *A, IndexType ldA,
const BETA &beta,
MC *C, IndexType ldC)
{
if (order==ColMajor) {
upLoC = (upLoC==Upper) ? Lower : Upper;
transA = Transpose(transA^Trans);
syrk_generic(RowMajor, upLoC, transA, n, k,
alpha, A, ldA, beta, C, ldC);
return;
}
syscal(order, upLoC, n, beta, C, ldC);
if (k==0) {
return;
}
if (transA==NoTrans) {
for (IndexType l=0; l<k; ++l) {
syr(order, upLoC, n, alpha, A+l, ldA, C, ldC);
}
}
if (transA==Conj) {
for (IndexType l=0; l<k; ++l) {
syr(order, upLoC, n, alpha, A+l, ldA, C, ldC);
}
}
if (transA==Trans) {
for (IndexType l=0; l<k; ++l) {
syr(order, upLoC, n, alpha, A+l*ldA, IndexType(1), C, ldC);
}
}
if (transA==ConjTrans) {
for (IndexType l=0; l<k; ++l) {
syr(order, upLoC, n, alpha, A+l*ldA, IndexType(1), C, ldC);
}
}
}
template <typename IndexType, typename ALPHA, typename MA,
typename BETA, typename MC>
void
syrk(StorageOrder order, StorageUpLo upLo,
Transpose trans,
IndexType n, IndexType k,
const ALPHA &alpha,
const MA *A, IndexType ldA,
const BETA &beta,
MC *C, IndexType ldC)
{
CXXBLAS_DEBUG_OUT("syrk_generic");
syrk_generic(order, upLo, trans, n, k, alpha, A, ldA, beta, C, ldC);
}
#ifdef HAVE_CBLAS
// ssyrk
template <typename IndexType>
typename If<IndexType>::isBlasCompatibleInteger
syrk(StorageOrder order, StorageUpLo upLo,
Transpose trans,
IndexType n, IndexType k,
float alpha,
const float *A, IndexType ldA,
float beta,
float *C, IndexType ldC)
{
CXXBLAS_DEBUG_OUT("[" BLAS_IMPL "] cblas_ssyrk");
cblas_ssyrk(CBLAS::getCblasType(order), CBLAS::getCblasType(upLo),
CBLAS::getCblasType(trans),
n, k,
alpha,
A, ldA,
beta,
C, ldC);
}
// dsyrk
template <typename IndexType>
typename If<IndexType>::isBlasCompatibleInteger
syrk(StorageOrder order, StorageUpLo upLo,
Transpose trans,
IndexType n, IndexType k,
double alpha,
const double *A, IndexType ldA,
double beta,
double *C, IndexType ldC)
{
CXXBLAS_DEBUG_OUT("[" BLAS_IMPL "] cblas_dsyrk");
cblas_dsyrk(CBLAS::getCblasType(order), CBLAS::getCblasType(upLo),
CBLAS::getCblasType(trans),
n, k,
alpha,
A, ldA,
beta,
C, ldC);
}
// csyrk
template <typename IndexType>
typename If<IndexType>::isBlasCompatibleInteger
syrk(StorageOrder order, StorageUpLo upLo,
Transpose trans,
IndexType n, IndexType k,
const ComplexFloat &alpha,
const ComplexFloat *A, IndexType ldA,
const ComplexFloat &beta,
ComplexFloat *C, IndexType ldC)
{
CXXBLAS_DEBUG_OUT("[" BLAS_IMPL "] cblas_csyrk");
cblas_csyrk(CBLAS::getCblasType(order), CBLAS::getCblasType(upLo),
CBLAS::getCblasType(trans),
n, k,
reinterpret_cast<const float *>(&alpha),
reinterpret_cast<const float *>(A), ldA,
reinterpret_cast<const float *>(&beta),
reinterpret_cast<float *>(C), ldC);
}
// zsyrk
template <typename IndexType>
typename If<IndexType>::isBlasCompatibleInteger
syrk(StorageOrder order, StorageUpLo upLo,
Transpose trans,
IndexType n, IndexType k,
const ComplexDouble &alpha,
const ComplexDouble *A, IndexType ldA,
const ComplexDouble &beta,
ComplexDouble *C, IndexType ldC)
{
CXXBLAS_DEBUG_OUT("[" BLAS_IMPL "] cblas_zsyrk");
cblas_zsyrk(CBLAS::getCblasType(order), CBLAS::getCblasType(upLo),
CBLAS::getCblasType(trans),
n, k,
reinterpret_cast<const double *>(&alpha),
reinterpret_cast<const double *>(A), ldA,
reinterpret_cast<const double *>(&beta),
reinterpret_cast<double *>(C), ldC);
}
#endif // HAVE_CBLAS
#ifdef HAVE_CUBLAS
// ssyrk
template <typename IndexType>
typename If<IndexType>::isBlasCompatibleInteger
syrk(StorageOrder order, StorageUpLo upLo,
Transpose trans,
IndexType n, IndexType k,
const float &alpha,
const thrust::device_ptr<const float> A, IndexType ldA,
const float &beta,
thrust::device_ptr<float> C, IndexType ldC)
{
CXXBLAS_DEBUG_OUT("cublasSsyrk");
if (order==RowMajor) {
upLo = (upLo==Upper) ? Lower : Upper;
trans = Transpose(trans^ConjTrans);
syrk(ColMajor, upLo, trans, n, k,
conjugate(alpha), A, ldA,
beta, C, ldC);
return;
}
cublasStatus_t status = cublasSsyrk(CublasEnv::handle(), CUBLAS::getCublasType(upLo),
CUBLAS::getCublasType(trans), n, k,
&alpha,
A.get(), ldA,
&beta,
C.get(), ldC);
checkStatus(status);
}
// dsyrk
template <typename IndexType>
typename If<IndexType>::isBlasCompatibleInteger
syrk(StorageOrder order, StorageUpLo upLo,
Transpose trans,
IndexType n, IndexType k,
const double &alpha,
const thrust::device_ptr<const double> A, IndexType ldA,
const double &beta,
thrust::device_ptr<double> C, IndexType ldC)
{
CXXBLAS_DEBUG_OUT("cublasDsyrk");
if (order==RowMajor) {
upLo = (upLo==Upper) ? Lower : Upper;
trans = Transpose(trans^ConjTrans);
syrk(ColMajor, upLo, trans, n, k,
conjugate(alpha), A, ldA,
beta, C, ldC);
return;
}
cublasStatus_t status = cublasDsyrk(CublasEnv::handle(), CUBLAS::getCublasType(upLo),
CUBLAS::getCublasType(trans), n, k,
&alpha,
A.get(), ldA,
&beta,
C.get(), ldC);
checkStatus(status);
}
// csyrk
template <typename IndexType>
typename If<IndexType>::isBlasCompatibleInteger
syrk(StorageOrder order, StorageUpLo upLo,
Transpose trans,
IndexType n, IndexType k,
const ComplexFloat &alpha,
const thrust::device_ptr<const ComplexFloat> A, IndexType ldA,
const ComplexFloat &beta,
thrust::device_ptr<ComplexFloat> C, IndexType ldC)
{
CXXBLAS_DEBUG_OUT("cublasCsyrk");
if (order==RowMajor) {
upLo = (upLo==Upper) ? Lower : Upper;
trans = Transpose(trans^ConjTrans);
syrk(ColMajor, upLo, trans, n, k,
conjugate(alpha), A, ldA,
beta, C, ldC);
return;
}
cublasStatus_t status = cublasCsyrk(CublasEnv::handle(), CUBLAS::getCublasType(upLo),
CUBLAS::getCublasType(trans), n, k,
reinterpret_cast<const cuFloatComplex*>(&alpha),
reinterpret_cast<const cuFloatComplex*>(A.get()), ldA,
reinterpret_cast<const cuFloatComplex*>(&beta),
reinterpret_cast<cuFloatComplex*>(C.get()), ldC);
checkStatus(status);
}
// zsyrk
template <typename IndexType>
typename If<IndexType>::isBlasCompatibleInteger
syrk(StorageOrder order, StorageUpLo upLo,
Transpose trans,
IndexType n, IndexType k,
const ComplexDouble &alpha,
const thrust::device_ptr<const ComplexDouble> A, IndexType ldA,
const ComplexDouble &beta,
thrust::device_ptr<ComplexDouble> C, IndexType ldC)
{
CXXBLAS_DEBUG_OUT("cublasZsyrk");
if (order==RowMajor) {
upLo = (upLo==Upper) ? Lower : Upper;
trans = Transpose(trans^ConjTrans);
syrk(ColMajor, upLo, trans, n, k,
conjugate(alpha), A, ldA,
beta, C, ldC);
return;
}
cublasStatus_t status = cublasZsyrk(CublasEnv::handle(), CUBLAS::getCublasType(upLo),
CUBLAS::getCublasType(trans), n, k,
reinterpret_cast<const cuDoubleComplex*>(&alpha),
reinterpret_cast<const cuDoubleComplex*>(A.get()), ldA,
reinterpret_cast<const cuDoubleComplex*>(&beta),
reinterpret_cast<cuDoubleComplex*>(C.get()), ldC);
checkStatus(status);
}
#endif // HAVE_CUBLAS
} // namespace cxxblas
#endif // CXXBLAS_LEVEL3_SYRK_TCC
| 33.058104
| 95
| 0.594265
|
ccecka
|
8c97c66f342bae246e6e5f82fa18e4d4fd1dcd2f
| 856
|
hpp
|
C++
|
include/boost/simd/function/combine.hpp
|
yaeldarmon/boost.simd
|
561316cc54bdc6353ca78f3b6d7e9120acd11144
|
[
"BSL-1.0"
] | null | null | null |
include/boost/simd/function/combine.hpp
|
yaeldarmon/boost.simd
|
561316cc54bdc6353ca78f3b6d7e9120acd11144
|
[
"BSL-1.0"
] | null | null | null |
include/boost/simd/function/combine.hpp
|
yaeldarmon/boost.simd
|
561316cc54bdc6353ca78f3b6d7e9120acd11144
|
[
"BSL-1.0"
] | null | null | null |
//==================================================================================================
/*!
@file
@copyright 2016 NumScale SAS
@copyright 2016 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_FUNCTION_COMBINE_HPP_INCLUDED
#define BOOST_SIMD_FUNCTION_COMBINE_HPP_INCLUDED
#if defined(DOXYGEN_ONLY)
namespace boost { namespace simd
{
/*!
@ingroup group-swar
Function object implementing combine capabilities
**/
const boost::dispatch::functor<tag::combine_> combine = {};
} }
#endif
#include <boost/simd/function/scalar/combine.hpp>
#include <boost/simd/function/simd/combine.hpp>
#endif
| 25.939394
| 100
| 0.575935
|
yaeldarmon
|
8c9e9fd090600d28b27ad10d73fa9684ea621563
| 3,510
|
cpp
|
C++
|
src/rosbot/IMU.cpp
|
ygjukim/hFramework
|
994ea7550c34b4943e2fa2d5e9ca447aa555f39e
|
[
"MIT"
] | 33
|
2017-07-03T22:49:30.000Z
|
2022-03-31T19:32:55.000Z
|
src/rosbot/IMU.cpp
|
ygjukim/hFramework
|
994ea7550c34b4943e2fa2d5e9ca447aa555f39e
|
[
"MIT"
] | 6
|
2017-07-13T13:23:22.000Z
|
2019-10-25T17:51:28.000Z
|
src/rosbot/IMU.cpp
|
ygjukim/hFramework
|
994ea7550c34b4943e2fa2d5e9ca447aa555f39e
|
[
"MIT"
] | 17
|
2017-07-01T05:35:47.000Z
|
2022-03-22T23:33:00.000Z
|
#include "hFramework.h"
#include <SparkFunMPU9250-DMP.h>
#include "IMU.h"
MPU9250_DMP mpu;
void quatVisualisation()
{
static uint8_t teapotPacket[14] = {'$', 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0x00, 0x00, '\r', '\n'};
static int i = 0;
if (i == 0)
{
i = 1;
}
teapotPacket[2] = 0xff & (mpu.qw >> 24);
teapotPacket[3] = 0xff & (mpu.qw >> 16);
teapotPacket[4] = 0xff & (mpu.qx >> 24);
teapotPacket[5] = 0xff & (mpu.qx >> 16);
teapotPacket[6] = 0xff & (mpu.qy >> 24);
teapotPacket[7] = 0xff & (mpu.qy >> 16);
teapotPacket[8] = 0xff & (mpu.qz >> 24);
teapotPacket[9] = 0xff & (mpu.qz >> 16);
teapotPacket[11]++; // packetCount, loops at 0xFF on purpose
}
// We're going to have a super cool function now that gets called when a matching API request is sent
// This is the ledToggle function we registered to the "led" Particle.function earlier.
void printIMUData(void)
{
// After calling dmpUpdateFifo() the ax, gx, mx, etc. values
// are all updated.
// Quaternion values are, by default, stored in Q30 long
// format. calcQuat turns them into a float between -1 and 1
float q0 = mpu.calcQuat(mpu.qw);
float q1 = mpu.calcQuat(mpu.qx);
float q2 = mpu.calcQuat(mpu.qy);
float q3 = mpu.calcQuat(mpu.qz);
sys.log("R/P/Y: %f,\t%f,\t%f\r\n", mpu.roll, mpu.pitch, mpu.yaw);
}
const signed char orientationDefault[9] = {0, 1, 0, 0, 0, 1, 1, 0, 0};
void IMU::begin()
{
hSens2.pin1.interruptOn_EdgeRising(); //interruptOn(InterruptEdge::Rising);
if (mpu.begin() != INV_SUCCESS)
{
while (1)
{
sys.log("error MPU-9250\r\n");
//delay(7000);
return;
}
}
mpu.dmpBegin(DMP_FEATURE_6X_LP_QUAT | // Enable 6-axis quat
DMP_FEATURE_GYRO_CAL, // Use gyro calibration
50); // Set DMP FIFO rate to 50 Hz (max 200 Hz)
mpu.dmpSetOrientation(orientationDefault);
// Use enableInterrupt() to configure the MPU-9250's
// interrupt output as a "data ready" indicator.
mpu.enableInterrupt();
sys.log("lpf = %d", mpu.getLPF());
mpu.setLPF(42); //188, 98, 42, 20, 10
sys.log("lpf = %d", mpu.getLPF());
for (int i = 0; i < 100; i++)
{
if (1 == hSens2.pin1.interruptWait(2000))
{
while (mpu.fifoAvailable())
{
if (mpu.dmpUpdateFifo() == INV_SUCCESS)
{
;
}
}
}
else
{
sys.log("MPU9250 read timeout\r\n");
}
LED3.toggle();
}
}
float IMU::getAngle()
{
static float retval = 0.0;
if (1 == hSens2.pin1.interruptWait())
{
while (mpu.fifoAvailable())
{
hSens3.pin2.write(1);
// Use dmpUpdateFifo to update the ax, gx, mx, etc. values
if (mpu.dmpUpdateFifo() == INV_SUCCESS)
{
// computeEulerAngles can be used -- after updating the
// quaternion values -- to estimate roll, pitch, and yaw
mpu.computeEulerAngles();
//printIMUData();
retval = mpu.roll;
// quatVisualisation();
}
hSens3.pin2.write(0);
}
}
return retval;
}
void IMU::getEulerAngles(float *roll, float *pitch, float *yaw)
{
if (1 == hSens2.pin1.interruptWait())
{
while (mpu.fifoAvailable())
{
hSens3.pin2.write(1);
// Use dmpUpdateFifo to update the ax, gx, mx, etc. values
if (mpu.dmpUpdateFifo() == INV_SUCCESS)
{
// computeEulerAngles can be used -- after updating the
// quaternion values -- to estimate roll, pitch, and yaw
mpu.computeEulerAngles();
*roll = -mpu.roll - 90;
if (*roll < -180)
{
*roll = *roll + 360;
}
*pitch = -mpu.pitch;
*yaw = mpu.yaw;
}
hSens3.pin2.write(0);
}
}
return;
}
void IMU::resetFifo()
{
mpu.resetFifo();
}
| 23.716216
| 101
| 0.623932
|
ygjukim
|
8ca0f097cd16299e1bdbd803ff36c7390b71ca32
| 358
|
cpp
|
C++
|
source/Views/Object/Over.cpp
|
1pkg/halfo
|
a57dc4b68d29165d6ab7ed36c7886326e414e269
|
[
"MIT"
] | null | null | null |
source/Views/Object/Over.cpp
|
1pkg/halfo
|
a57dc4b68d29165d6ab7ed36c7886326e414e269
|
[
"MIT"
] | null | null | null |
source/Views/Object/Over.cpp
|
1pkg/halfo
|
a57dc4b68d29165d6ab7ed36c7886326e414e269
|
[
"MIT"
] | null | null | null |
#include "components.hpp"
#include "Over.hpp"
namespace Views
{
namespace Object
{
Over::Over()
{
const std::array<cocos2d::Vec2, 2> & over = Master::instance().get<Components::Metric>().over();
_draw = cocos2d::DrawNode::create();
_draw->drawLine(over[0], over[1], cocos2d::Color4F::RED);
}
cocos2d::Node *
Over::node() const
{
return _draw;
}
}
}
| 14.32
| 97
| 0.664804
|
1pkg
|
8ca35884fd9fb90f98c4ca7c44b2cec9732ae88b
| 688
|
hpp
|
C++
|
include/boost/mysql/detail/protocol/text_deserialization.hpp
|
madmongo1/mysql-asio
|
26c57e92ddeebfee22e08e5ea05e7bb51248eba5
|
[
"BSL-1.0"
] | 1
|
2020-03-31T11:48:12.000Z
|
2020-03-31T11:48:12.000Z
|
include/boost/mysql/detail/protocol/text_deserialization.hpp
|
madmongo1/mysql-asio
|
26c57e92ddeebfee22e08e5ea05e7bb51248eba5
|
[
"BSL-1.0"
] | null | null | null |
include/boost/mysql/detail/protocol/text_deserialization.hpp
|
madmongo1/mysql-asio
|
26c57e92ddeebfee22e08e5ea05e7bb51248eba5
|
[
"BSL-1.0"
] | null | null | null |
#ifndef MYSQL_ASIO_IMPL_DESERIALIZE_ROW_HPP
#define MYSQL_ASIO_IMPL_DESERIALIZE_ROW_HPP
#include "boost/mysql/detail/protocol/serialization.hpp"
#include "boost/mysql/error.hpp"
#include "boost/mysql/value.hpp"
#include "boost/mysql/metadata.hpp"
#include <vector>
namespace boost {
namespace mysql {
namespace detail {
inline errc deserialize_text_value(
std::string_view from,
const field_metadata& meta,
value& output
);
inline error_code deserialize_text_row(
deserialization_context& ctx,
const std::vector<field_metadata>& meta,
std::vector<value>& output
);
} // detail
} // mysql
} // boost
#include "boost/mysql/detail/protocol/impl/text_deserialization.ipp"
#endif
| 20.848485
| 68
| 0.784884
|
madmongo1
|
8ca5be6230ad6f9f372ab1d5184738c0e07101f9
| 174
|
cpp
|
C++
|
src/peer-server/game.cpp
|
kosmigramma/HumbleNet
|
368de8d66ad31b91d0f97a413db6eab7f0c33e3a
|
[
"BSD-3-Clause"
] | 598
|
2017-06-29T17:02:45.000Z
|
2022-03-22T16:57:13.000Z
|
src/peer-server/game.cpp
|
kosmigramma/HumbleNet
|
368de8d66ad31b91d0f97a413db6eab7f0c33e3a
|
[
"BSD-3-Clause"
] | 26
|
2017-07-22T20:30:06.000Z
|
2021-08-03T08:16:59.000Z
|
src/peer-server/game.cpp
|
kosmigramma/HumbleNet
|
368de8d66ad31b91d0f97a413db6eab7f0c33e3a
|
[
"BSD-3-Clause"
] | 54
|
2017-06-30T03:40:56.000Z
|
2021-12-16T11:28:33.000Z
|
#include "game.h"
#include "p2p_connection.h"
#include "humblenet_utils.h"
namespace humblenet {
void Game::erasePeerAliases(PeerId p)
{
erase_value(aliases, p);
}
}
| 13.384615
| 38
| 0.718391
|
kosmigramma
|
8ca9ca1c97977774c424f8fbbf777f0463755626
| 3,999
|
cpp
|
C++
|
src/list.cpp
|
npeshek-spotx/libpriamcql
|
19bf933f796cd022c5f5a6737b8c8e1ebda5c490
|
[
"Apache-2.0"
] | 1
|
2021-01-11T19:26:29.000Z
|
2021-01-11T19:26:29.000Z
|
src/list.cpp
|
npeshek-spotx/libpriamcql
|
19bf933f796cd022c5f5a6737b8c8e1ebda5c490
|
[
"Apache-2.0"
] | 10
|
2020-04-22T16:17:11.000Z
|
2021-02-04T19:48:46.000Z
|
src/list.cpp
|
npeshek-spotx/libpriamcql
|
19bf933f796cd022c5f5a6737b8c8e1ebda5c490
|
[
"Apache-2.0"
] | 2
|
2019-08-15T02:07:38.000Z
|
2021-01-11T18:21:17.000Z
|
#include "priam/list.hpp"
namespace priam
{
statement_list::statement_list(size_t reserve_size)
: m_cass_collection_ptr(cass_collection_new(CassCollectionType::CASS_COLLECTION_TYPE_LIST, reserve_size))
{
}
auto statement_list::append_ascii(std::string_view data) -> bool
{
return cass_collection_append_string_n(m_cass_collection_ptr.get(), data.data(), data.length()) == CASS_OK;
}
auto statement_list::append_big_int(int64_t value) -> bool
{
return cass_collection_append_int64(m_cass_collection_ptr.get(), value) == CASS_OK;
}
auto statement_list::append_blob(blob blob) -> bool
{
return cass_collection_append_bytes(
m_cass_collection_ptr.get(), reinterpret_cast<const cass_byte_t*>(blob.data()), blob.size()) == CASS_OK;
}
auto statement_list::append_boolean(bool value) -> bool
{
return cass_collection_append_bool(m_cass_collection_ptr.get(), static_cast<cass_bool_t>(value)) == CASS_OK;
}
auto statement_list::append_counter(int64_t value) -> bool
{
return cass_collection_append_int64(m_cass_collection_ptr.get(), value) == CASS_OK;
}
auto statement_list::append_decimal(decimal value) -> bool
{
const auto& varint = value.varint();
return cass_collection_append_decimal(
m_cass_collection_ptr.get(),
reinterpret_cast<ptr<const cass_byte_t>>(varint.data()),
varint.size(),
value.scale()) == CASS_OK;
}
auto statement_list::append_double(double value) -> bool
{
return cass_collection_append_double(m_cass_collection_ptr.get(), value) == CASS_OK;
}
auto statement_list::append_float(float value) -> bool
{
return cass_collection_append_float(m_cass_collection_ptr.get(), value) == CASS_OK;
}
auto statement_list::append_int(int32_t value) -> bool
{
return cass_collection_append_int32(m_cass_collection_ptr.get(), value) == CASS_OK;
}
auto statement_list::append_text(std::string_view data) -> bool
{
return append_ascii(data);
}
auto statement_list::append_timestamp(std::time_t timestamp) -> bool
{
return cass_collection_append_uint32(m_cass_collection_ptr.get(), static_cast<cass_uint32_t>(timestamp)) == CASS_OK;
}
auto statement_list::append_uuid(std::string_view uuid) -> bool
{
CassUuid cass_uuid;
CassError rc = cass_uuid_from_string_n(uuid.data(), uuid.length(), &cass_uuid);
if (rc != CASS_OK)
{
return false;
}
return cass_collection_append_uuid(m_cass_collection_ptr.get(), cass_uuid) == CASS_OK;
}
auto statement_list::append_varchar(std::string_view data) -> bool
{
return append_ascii(data);
}
auto statement_list::append_time_uuid(std::string_view timeuuid) -> bool
{
return append_uuid(timeuuid);
}
auto statement_list::append_inet(std::string_view inet) -> bool
{
CassInet cass_inet;
CassError rc = cass_inet_from_string_n(inet.data(), inet.length(), &cass_inet);
if (rc != CASS_OK)
{
return false;
}
return cass_collection_append_inet(m_cass_collection_ptr.get(), cass_inet) == CASS_OK;
}
auto statement_list::append_date(uint32_t date) -> bool
{
return cass_collection_append_uint32(m_cass_collection_ptr.get(), date) == CASS_OK;
}
auto statement_list::append_time(int64_t time) -> bool
{
return cass_collection_append_int64(m_cass_collection_ptr.get(), time) == CASS_OK;
}
auto statement_list::append_tiny_int(int8_t value) -> bool
{
return cass_collection_append_int8(m_cass_collection_ptr.get(), value) == CASS_OK;
}
auto statement_list::append_duration(duration duration) -> bool
{
return cass_collection_append_duration(
m_cass_collection_ptr.get(), duration.months(), duration.days(), duration.nanos()) == CASS_OK;
}
auto statement_list::append_list(statement_list list) -> bool
{
return cass_collection_append_collection(m_cass_collection_ptr.get(), list.m_cass_collection_ptr.get()) == CASS_OK;
}
result_list::result_list(const CassValue* cass_value) : m_cass_value(cass_value)
{
}
} // namespace priam
| 29.843284
| 120
| 0.740685
|
npeshek-spotx
|
8cab06b90412c6aebcfb18a0c5c51f1d550f687f
| 2,356
|
cpp
|
C++
|
RayTracing/sources/hittables/BVHNode.cpp
|
MdeLaharpe/RayTracing
|
c4fe9358e09af86a6b3e392a6e67fd826334cefa
|
[
"Apache-2.0"
] | null | null | null |
RayTracing/sources/hittables/BVHNode.cpp
|
MdeLaharpe/RayTracing
|
c4fe9358e09af86a6b3e392a6e67fd826334cefa
|
[
"Apache-2.0"
] | null | null | null |
RayTracing/sources/hittables/BVHNode.cpp
|
MdeLaharpe/RayTracing
|
c4fe9358e09af86a6b3e392a6e67fd826334cefa
|
[
"Apache-2.0"
] | null | null | null |
#include "hittables/BVHNode.h"
#include <iostream>
#include <functional>
#include <algorithm>
#include "Random.h"
namespace rt
{
BVHNode::BVHNode(std::vector<std::shared_ptr<Hittable>>& list, size_t start, size_t end, float time0, float time1)
{
size_t span = end - start;
if (span == 1)
{
left = right = list[start];
}
else
{
size_t axis = static_cast<size_t>(Rand(0, 2));
std::function<bool(const std::shared_ptr<Hittable>&, const std::shared_ptr<Hittable>&)> predicate = std::bind(
[time0, time1, axis](const std::shared_ptr<Hittable>& hittable0, const std::shared_ptr<Hittable>& hittable1)
{
maths::AABB aabb0, aabb1;
if (!hittable0->BuildAABB(time0, time1, aabb0))
{
std::cerr << "No bounding volume in BVHNode constructor !" << std::endl;
return true;
}
if (!hittable1->BuildAABB(time0, time1, aabb1))
{
std::cerr << "No bounding volume in BVHNode constructor !" << std::endl;
return false;
}
return aabb0.minimum[axis] < aabb1.minimum[axis];
},
std::placeholders::_1, std::placeholders::_2
);
if (span == 2)
{
if (predicate(list[start], list[start + 1]))
{
left = list[start];
right = list[start + 1];
}
else
{
left = list[start + 1];
right = list[start];
}
}
else
{
std::sort(list.begin() + start, list.begin() + end, predicate);
size_t mid = start + span / 2;
left = std::make_shared<BVHNode>(list, start, mid, time0, time1);
right = std::make_shared<BVHNode>(list, mid, end, time0, time1);
}
}
maths::AABB aabbLeft, aabbRight;
if (left->BuildAABB(time0, time1, aabbLeft) && right->BuildAABB(time0, time1, aabbRight))
aabb = maths::Bound(aabbLeft, aabbRight);
else
{
constexpr float min = std::numeric_limits<float>::min();
constexpr float max = std::numeric_limits<float>::max();
aabb = maths::AABB({ min }, { max });
}
}
bool BVHNode::BuildAABB(float tMin, float tMax, maths::AABB& outAABB) const
{
outAABB = aabb;
return true;
}
bool BVHNode::Hit(const maths::Ray& r, float tMin, float tMax, HitRecord& rec) const
{
if (!aabb.Hit(r, tMin, tMax))
return false;
bool hitLeft = left->Hit(r, tMin, tMax, rec);
bool hitRight = right->Hit(r, tMin, hitLeft ? rec.t : tMax, rec);
return hitLeft || hitRight;
}
}
| 25.89011
| 115
| 0.621817
|
MdeLaharpe
|
8cab2b2de1eee86e838275693286227acf0ec2f8
| 1,526
|
hpp
|
C++
|
include/cdv/core/color/single_hue_interpolators.hpp
|
cpp-niel/cdv
|
9aa310c6fe66dbc7f224ace3a3d4212ca6f0ed4a
|
[
"MIT"
] | 1
|
2020-08-09T01:05:30.000Z
|
2020-08-09T01:05:30.000Z
|
include/cdv/core/color/single_hue_interpolators.hpp
|
cpp-niel/cdv
|
9aa310c6fe66dbc7f224ace3a3d4212ca6f0ed4a
|
[
"MIT"
] | null | null | null |
include/cdv/core/color/single_hue_interpolators.hpp
|
cpp-niel/cdv
|
9aa310c6fe66dbc7f224ace3a3d4212ca6f0ed4a
|
[
"MIT"
] | null | null | null |
#pragma once
#include <cdv/core/color/interpolator.hpp>
namespace cdv::interpolator
{
constexpr auto reds =
detail::color_interpolator(std::array{0xfff5f0ffu, 0xfee0d2ffu, 0xfcbba1ffu, 0xfc9272ffu, 0xfb6a4affu,
0xef3b2cffu, 0xcb181dffu, 0xa50f15ffu, 0x67000dffu});
constexpr auto greens =
detail::color_interpolator(std::array{0xf7fcf5ffu, 0xe5f5e0ffu, 0xc7e9c0ffu, 0xa1d99bffu, 0x74c476ffu,
0x41ab5dffu, 0x238b45ffu, 0x006d2cffu, 0x00441bffu});
constexpr auto blues =
detail::color_interpolator(std::array{0xf7fbffffu, 0xdeebf7ffu, 0xc6dbefffu, 0x9ecae1ffu, 0x6baed6ffu,
0x4292c6ffu, 0x2171b5ffu, 0x08519cffu, 0x08306bffu});
constexpr auto grays =
detail::color_interpolator(std::array{0xffffffffu, 0xf0f0f0ffu, 0xd9d9d9ffu, 0xbdbdbdffu, 0x969696ffu,
0x737373ffu, 0x525252ffu, 0x252525ffu, 0x000000ffu});
constexpr auto oranges =
detail::color_interpolator(std::array{0xfff5ebffu, 0xfee6ceffu, 0xfdd0a2ffu, 0xfdae6bffu, 0xfd8d3cffu,
0xf16913ffu, 0xd94801ffu, 0xa63603ffu, 0x7f2704ffu});
constexpr auto purples =
detail::color_interpolator(std::array{0xfcfbfdffu, 0xefedf5ffu, 0xdadaebffu, 0xbcbddcffu, 0x9e9ac8ffu,
0x807dbaffu, 0x6a51a3ffu, 0x54278fffu, 0x3f007dffu});
}
| 50.866667
| 110
| 0.633028
|
cpp-niel
|
8cadd710366c1d30f85e7b5b4f6e6ddf88e07a57
| 126
|
cpp
|
C++
|
IL/src/IL/Renderer/RendererAPI.cpp
|
ILLmew/IL-engine
|
8d5fd11263fcf332c2fc3afd33e73546d10efd7d
|
[
"Apache-2.0"
] | 4
|
2021-04-08T16:18:59.000Z
|
2021-09-29T12:23:33.000Z
|
IL/src/IL/Renderer/RendererAPI.cpp
|
CrystaLamb/IL-engine
|
8d5fd11263fcf332c2fc3afd33e73546d10efd7d
|
[
"Apache-2.0"
] | null | null | null |
IL/src/IL/Renderer/RendererAPI.cpp
|
CrystaLamb/IL-engine
|
8d5fd11263fcf332c2fc3afd33e73546d10efd7d
|
[
"Apache-2.0"
] | 1
|
2021-09-29T12:23:35.000Z
|
2021-09-29T12:23:35.000Z
|
#include "ilpch.h"
#include "RendererAPI.h"
namespace IL
{
RendererAPI::API RendererAPI::s_API = RendererAPI::API::OpenGL;
}
| 18
| 64
| 0.738095
|
ILLmew
|
8cb11c8c785246011cf25c3e0d2694a5d9bf7a7b
| 5,740
|
hpp
|
C++
|
tlx/die.hpp
|
SDEagle/tlx
|
f234dc33d5117d9c10baec5a822ca70ef4eadcb7
|
[
"BSL-1.0"
] | null | null | null |
tlx/die.hpp
|
SDEagle/tlx
|
f234dc33d5117d9c10baec5a822ca70ef4eadcb7
|
[
"BSL-1.0"
] | null | null | null |
tlx/die.hpp
|
SDEagle/tlx
|
f234dc33d5117d9c10baec5a822ca70ef4eadcb7
|
[
"BSL-1.0"
] | null | null | null |
/*******************************************************************************
* tlx/die.hpp
*
* Part of tlx - http://panthema.net/tlx
*
* Copyright (C) 2016-2017 Timo Bingmann <tb@panthema.net>
*
* All rights reserved. Published under the Boost Software License, Version 1.0
******************************************************************************/
#ifndef TLX_DIE_HEADER
#define TLX_DIE_HEADER
#include <cstring>
#include <sstream>
#include <string>
namespace tlx {
/******************************************************************************/
// die macros
//! die with message - either throw an exception or die via abort()
void die_with_message(const std::string& msg);
//! die with message - either throw an exception or die via abort()
void die_with_message(const char* msg, const char* file, size_t line);
//! die with message - either throw an exception or die via abort()
void die_with_message(const std::string& msg, const char* file, size_t line);
//! Instead of abort(), throw the output the message via an exception.
#define die_with_sstream(msg) \
do { \
std::ostringstream oss__; \
oss__ << msg << " @ " << __FILE__ << ':' << __LINE__; \
::tlx::die_with_message(oss__.str()); \
std::terminate(); \
} while (false)
//! Instead of abort(), throw the output the message via an exception.
#define die(msg) \
do { \
die_with_sstream("DIE: " << msg); \
} while (false)
/******************************************************************************/
// die_unless() and die_if()
//! Check condition X and die miserably if false. Same as assert() except this
//! is also active in Release mode.
#define die_unless(X) \
do { \
if (!(X)) { \
::tlx::die_with_message( \
"DIE: Assertion \"" #X "\" failed!", __FILE__, __LINE__); \
} \
} while (false)
//! Check condition X and die miserably if true. Opposite of assert() except
//! this is also active in Release mode.
#define die_if(X) \
do { \
if (X) { \
::tlx::die_with_message( \
"DIE: Assertion \"" #X "\" succeeded!", __FILE__, __LINE__); \
} \
} while (false)
/******************************************************************************/
// die_unequal()
//! helper method to compare two values in die_unequal()
template <typename TypeA, typename TypeB>
inline bool die_equal_compare(TypeA a, TypeB b) {
return a == b;
}
template <>
inline bool die_equal_compare(const char* a, const char* b) {
// compare string contents
return std::strcmp(a, b) == 0;
}
template <>
inline bool die_equal_compare(float a, float b) {
// special case for NAN
return a != a ? b != b : a == b;
}
template <>
inline bool die_equal_compare(double a, double b) {
// special case for NAN
return a != a ? b != b : a == b;
}
//! Check that X == Y or die miserably, but output the values of X and Y for
//! better debugging.
#define die_unequal(X, Y) \
do { \
auto x__ = (X); /* NOLINT */ \
auto y__ = (Y); /* NOLINT */ \
if (!::tlx::die_equal_compare(x__, y__)) \
die_with_sstream("DIE-UNEQUAL: " #X " != " #Y " : " \
"\"" << x__ << "\" != \"" << y__ << "\""); \
} while (false)
//! Check that X == Y or die miserably, but output the values of X and Y for
//! better debugging. Only active if NDEBUG is not defined.
#ifdef NDEBUG
#define assert_equal(X, Y)
#else
#define assert_equal(X, Y) die_unequal(X, Y)
#endif
/******************************************************************************/
// die_unless_throws()
//! Define to check that [code] throws and exception of given type
#define die_unless_throws(code, exception_type) \
do { \
try { \
code; \
} \
catch (const exception_type&) { \
break; \
} \
::tlx::die_with_message( \
"DIE-UNLESS-THROWS: " #code " - NO EXCEPTION " #exception_type, \
__FILE__, __LINE__); \
} while (false)
} // namespace tlx
#endif // !TLX_DIE_HEADER
/******************************************************************************/
| 41.594203
| 80
| 0.380488
|
SDEagle
|
8cb3c36ea2a4ea5ea52cb892899e85d21cad1daa
| 7,012
|
cpp
|
C++
|
Source/NTGame/Private/NTGame_PlayerController.cpp
|
AlCaTrAzzALZ/UE4-Networked-PhysX-Component
|
15289c3ea2802b5b01d81222d9b6b2f89bd8ff0f
|
[
"MIT"
] | 12
|
2017-02-09T11:15:37.000Z
|
2021-11-12T22:28:04.000Z
|
Source/NTGame/Private/NTGame_PlayerController.cpp
|
blockspacer/UE4-Networked-PhysX-Component
|
15289c3ea2802b5b01d81222d9b6b2f89bd8ff0f
|
[
"MIT"
] | null | null | null |
Source/NTGame/Private/NTGame_PlayerController.cpp
|
blockspacer/UE4-Networked-PhysX-Component
|
15289c3ea2802b5b01d81222d9b6b2f89bd8ff0f
|
[
"MIT"
] | 12
|
2019-01-27T21:01:57.000Z
|
2021-10-06T05:32:29.000Z
|
// Copyright (C) James Baxter 2017. All Rights Reserved.
#include "NTGame.h"
#include "NTGame_PlayerController.h"
ANTGame_PlayerController::ANTGame_PlayerController(const FObjectInitializer& OI)
: Super(OI)
{}
/////////////////
///// Input /////
/////////////////
void ANTGame_PlayerController::SetupInputComponent()
{
Super::SetupInputComponent();
ASSERTV(InputComponent != nullptr, TEXT("Invalid Player Input Component"));
InputComponent->BindAction(TEXT("PacketLag_Up"), IE_Pressed, this, &ANTGame_PlayerController::IncreasePacketLag);
InputComponent->BindAction(TEXT("PacketLag_Down"), IE_Pressed, this, &ANTGame_PlayerController::DecreasePacketLag);
InputComponent->BindAction(TEXT("PacketLagVar_Up"), IE_Pressed, this, &ANTGame_PlayerController::IncreasePacketLagVariance);
InputComponent->BindAction(TEXT("PacketLagVar_Down"), IE_Pressed, this, &ANTGame_PlayerController::DecreasePacketLagVariance);
InputComponent->BindAction(TEXT("PacketLoss_Up"), IE_Pressed, this, &ANTGame_PlayerController::IncreasePacketLoss);
InputComponent->BindAction(TEXT("PacketLoss_Down"), IE_Pressed, this, &ANTGame_PlayerController::DecreasePacketLoss);
InputComponent->BindAction(TEXT("PacketDupe_Up"), IE_Pressed, this, &ANTGame_PlayerController::IncreasePacketDupe);
InputComponent->BindAction(TEXT("PacketDupe_Down"), IE_Pressed, this, &ANTGame_PlayerController::DecreasePacketDupe);
InputComponent->BindAction(TEXT("PacketOrder_Toggle"), IE_Pressed, this, &ANTGame_PlayerController::TogglePacketOrder);
InputComponent->BindAction(TEXT("PacketReset"), IE_Pressed, this, &ANTGame_PlayerController::ResetPacketSettings);
InputComponent->BindAction(TEXT("ToggleDebug"), IE_Pressed, this, &ANTGame_PlayerController::ToggleDebugDrawing);
InputComponent->BindAction(TEXT("UseBoxPawn"), IE_Pressed, this, &ANTGame_PlayerController::UseBoxPawn);
InputComponent->BindAction(TEXT("UseSpherePawn"), IE_Pressed, this, &ANTGame_PlayerController::UseSpherePawn);
}
/////////////////////////////
///// Packet Loss Input /////
/////////////////////////////
void ANTGame_PlayerController::IncreasePacketLag()
{
const UNetDriver* WorldNetDriver = GetWorld()->GetNetDriver();
ASSERTV(WorldNetDriver != nullptr, TEXT("Invalid Network Driver"));
const FString CommandValue = FString::FromInt(FMath::Clamp(WorldNetDriver->PacketSimulationSettings.PktLag + 25, 0, 500));
ConsoleCommand(TEXT("Net PktLag=") + CommandValue, false);
}
void ANTGame_PlayerController::DecreasePacketLag()
{
const UNetDriver* WorldNetDriver = GetWorld()->GetNetDriver();
ASSERTV(WorldNetDriver != nullptr, TEXT("Invalid Network Driver"));
const FString CommandValue = FString::FromInt(FMath::Clamp(WorldNetDriver->PacketSimulationSettings.PktLag - 25, 0, 500));
ConsoleCommand(TEXT("Net PktLag=") + CommandValue, false);
}
void ANTGame_PlayerController::IncreasePacketLagVariance()
{
const UNetDriver* WorldNetDriver = GetWorld()->GetNetDriver();
ASSERTV(WorldNetDriver != nullptr, TEXT("Invalid Network Driver"));
const FString CommandValue = FString::FromInt(FMath::Clamp(WorldNetDriver->PacketSimulationSettings.PktLagVariance + 10, 0, 100));
ConsoleCommand(TEXT("Net PktLagVariance=") + CommandValue, false);
}
void ANTGame_PlayerController::DecreasePacketLagVariance()
{
const UNetDriver* WorldNetDriver = GetWorld()->GetNetDriver();
ASSERTV(WorldNetDriver != nullptr, TEXT("Invalid Network Driver"));
const FString CommandValue = FString::FromInt(FMath::Clamp(WorldNetDriver->PacketSimulationSettings.PktLagVariance - 10, 0, 100));
ConsoleCommand(TEXT("Net PktLagVariance=") + CommandValue, false);
}
void ANTGame_PlayerController::IncreasePacketLoss()
{
const UNetDriver* WorldNetDriver = GetWorld()->GetNetDriver();
ASSERTV(WorldNetDriver != nullptr, TEXT("Invalid Network Driver"));
const FString CommandValue = FString::FromInt(FMath::Clamp(WorldNetDriver->PacketSimulationSettings.PktLoss + 10, 0, 100));
ConsoleCommand(TEXT("Net PktLoss=") + CommandValue, false);
}
void ANTGame_PlayerController::DecreasePacketLoss()
{
const UNetDriver* WorldNetDriver = GetWorld()->GetNetDriver();
ASSERTV(WorldNetDriver != nullptr, TEXT("Invalid Network Driver"));
const FString CommandValue = FString::FromInt(FMath::Clamp(WorldNetDriver->PacketSimulationSettings.PktLoss - 10, 0, 100));
ConsoleCommand(TEXT("Net PktLoss=") + CommandValue, false);
}
void ANTGame_PlayerController::IncreasePacketDupe()
{
const UNetDriver* WorldNetDriver = GetWorld()->GetNetDriver();
ASSERTV(WorldNetDriver != nullptr, TEXT("Invalid Network Driver"));
const FString CommandValue = FString::FromInt(FMath::Clamp(WorldNetDriver->PacketSimulationSettings.PktDup + 10, 0, 100));
ConsoleCommand(TEXT("Net PktDup=") + CommandValue, false);
}
void ANTGame_PlayerController::DecreasePacketDupe()
{
const UNetDriver* WorldNetDriver = GetWorld()->GetNetDriver();
ASSERTV(WorldNetDriver != nullptr, TEXT("Invalid Network Driver"));
const FString CommandValue = FString::FromInt(FMath::Clamp(WorldNetDriver->PacketSimulationSettings.PktDup - 10, 0, 100));
ConsoleCommand(TEXT("Net PktDup=") + CommandValue, false);
}
void ANTGame_PlayerController::TogglePacketOrder()
{
const UNetDriver* WorldNetDriver = GetWorld()->GetNetDriver();
ASSERTV(WorldNetDriver != nullptr, TEXT("Invalid Network Driver"));
const int32 CurrentValue = WorldNetDriver->PacketSimulationSettings.PktOrder;
const FString CommandValue = FString::FromInt(CurrentValue > 0 ? 0 : 1);
ConsoleCommand(TEXT("Net PktOrder=") + CommandValue, false);
}
void ANTGame_PlayerController::ResetPacketSettings()
{
ConsoleCommand(TEXT("Net PktLag=0"), false);
ConsoleCommand(TEXT("Net PktLagVariance=0"), false);
ConsoleCommand(TEXT("Net PktLoss=0"), false);
ConsoleCommand(TEXT("Net PktDup=0"), false);
ConsoleCommand(TEXT("Net PktOrder=0"), false);
}
///////////////////////////////
///// Debug Drawing Input /////
///////////////////////////////
void ANTGame_PlayerController::ToggleDebugDrawing()
{
ANTGame_Pawn* MyNTPawn = Cast<ANTGame_Pawn>(GetPawn());
if (MyNTPawn)
{
MyNTPawn->GetPhysicsMovement()->bDrawDebug = !MyNTPawn->GetPhysicsMovement()->bDrawDebug;
}
}
void ANTGame_PlayerController::RequestPawnChange(const uint8 PawnID)
{
if (CurrentPawnIndex != PawnID)
{
Server_RequestPawnChange(PawnID);
}
}
void ANTGame_PlayerController::Server_RequestPawnChange_Implementation(const uint8 PawnID)
{
CurrentPawnIndex = PawnID;
ANTGame_GameMode* WorldGM = Cast<ANTGame_GameMode>(GetWorld()->GetAuthGameMode());
ASSERTV(WorldGM != nullptr, TEXT("Invalid Game Mode"));
if (GetPawn())
{
// Will unpossess and properly detach from pawn
GetPawn()->Destroy();
}
WorldGM->RestartPlayer(this);
}
///////////////////////
///// Replication /////
///////////////////////
void ANTGame_PlayerController::GetLifetimeReplicatedProps(TArray<class FLifetimeProperty> & OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME_CONDITION(ANTGame_PlayerController, CurrentPawnIndex, COND_OwnerOnly);
}
| 39.615819
| 131
| 0.758414
|
AlCaTrAzzALZ
|
8cb508704cdcc9e5908b29951a129eca983c1784
| 1,469
|
hpp
|
C++
|
Project/Model/IModel.hpp
|
Conny14156/asian-viking
|
3b8a0acfb4d98ee80be16c7ef646a157f9045650
|
[
"Zlib",
"BSD-3-Clause"
] | 1
|
2015-03-13T22:57:35.000Z
|
2015-03-13T22:57:35.000Z
|
Project/Model/IModel.hpp
|
Conny14156/asian-viking
|
3b8a0acfb4d98ee80be16c7ef646a157f9045650
|
[
"Zlib",
"BSD-3-Clause"
] | null | null | null |
Project/Model/IModel.hpp
|
Conny14156/asian-viking
|
3b8a0acfb4d98ee80be16c7ef646a157f9045650
|
[
"Zlib",
"BSD-3-Clause"
] | 2
|
2018-10-11T17:49:26.000Z
|
2018-10-24T06:06:49.000Z
|
#ifndef MODEL_HPP
#define MODEL_HPP
#include <SFML\Graphics\RenderTarget.hpp>
#include <Core\String.hpp>
#include <Core\Vector.h>
#include <Asset\ObjectSaveMode.hpp>
#include <Asset\SpriteRef.hpp>
#include <Asset\IRequestable.hpp>
class IModel : public sf::Drawable, public IRequestable
{
protected:
SpriteRef* m_render_sprite;
bool updateRequired = true;
Core::String name;
public:
SpriteRef *& getSpriteRef() { return m_render_sprite; }
virtual void updateFrame(const size_t& update_ms) = 0;
IModel();
IModel(const IModel& copy);
IModel& operator=(const IModel& right);
virtual ~IModel() = default;
void setRenderSprite(SpriteRef& texture);
virtual bool isFaceable();
virtual void setAnimation(Core::String _animation) = 0;
virtual void setTextureMap(Core::String _modOrigin, Core::String _textureMapName) = 0;
virtual void preRender(const size_t& update_ms);
virtual void setPosition(const Core::Vector2& pos);
virtual void setRotation(const float rot);
virtual void setScale(const Core::Vector2& scale);
// Inherited via Drawable
virtual void draw(sf::RenderTarget & target, sf::RenderStates states) const override;
Core::String getName() const override;
Core::String getValue() const override;
template <class Archive>
void save(Archive & ar) const
{
ar(cereal::base_class<IRequestable>(this));
}
template <class Archive>
void load(Archive & ar)
{
ar(cereal::base_class<IRequestable>(this));
}
};
#endif
| 20.690141
| 87
| 0.742682
|
Conny14156
|
8cb58dd3f2e1226c692605f58e1a68ebdbaa46c9
| 6,017
|
cc
|
C++
|
proc/elf_loader.cc
|
electrojustin/moonshine-os
|
565b25a298ca8761fe2dbef2dec6126354cd878f
|
[
"BSD-3-Clause"
] | 1
|
2021-07-12T13:37:31.000Z
|
2021-07-12T13:37:31.000Z
|
proc/elf_loader.cc
|
electrojustin/moonshine-os
|
565b25a298ca8761fe2dbef2dec6126354cd878f
|
[
"BSD-3-Clause"
] | null | null | null |
proc/elf_loader.cc
|
electrojustin/moonshine-os
|
565b25a298ca8761fe2dbef2dec6126354cd878f
|
[
"BSD-3-Clause"
] | null | null | null |
#include <stddef.h>
#include <stdint.h>
#include "filesystem/fat32.h"
#include "lib/std/memory.h"
#include "lib/std/stdio.h"
#include "lib/std/string.h"
#include "proc/elf_loader.h"
#include "proc/process.h"
namespace proc {
namespace {
using filesystem::directory_entry;
using filesystem::file_descriptor;
using filesystem::read_fat32;
using filesystem::stat_fat32;
using lib::std::kfree;
using lib::std::kmalloc;
using lib::std::krealloc;
using lib::std::make_string_copy;
using lib::std::memcpy;
using proc::process_memory_segment;
struct __attribute__((packed)) elf_header {
unsigned char ident[16];
uint16_t type;
uint16_t machine;
uint32_t version;
uint32_t entry;
uint32_t segments_offset;
uint32_t sections_offset;
uint32_t flags;
uint16_t header_size;
uint16_t segment_entry_size;
uint16_t num_segments;
uint16_t section_entry_size;
uint16_t num_sections;
uint16_t string_table_index;
};
struct __attribute__((packed)) segment_header {
uint32_t type;
uint32_t offset;
uint32_t virtual_address;
uint32_t physical_address; // Ignored
uint32_t disk_size;
uint32_t memory_size;
uint32_t flags;
uint32_t alignment;
};
constexpr uint16_t MACHINE_TYPE_X86 = 3;
constexpr uint32_t LOADABLE_SEGMENT = 1;
constexpr uint32_t INTERPRETER_SEGMENT = 3;
constexpr uint32_t TLS_SEGMENT = 7;
constexpr uint32_t EXEC = 2;
constexpr uint32_t DYN = 3;
constexpr uint32_t DEFAULT_PROGRAM_VIRTUAL_OFFSET = 0x8048000;
struct segment_list {
struct process_memory_segment *segments;
uint32_t num_segments;
char *linker_path;
};
uint8_t *load_elf_from_disk(char *path) {
struct directory_entry file_info = stat_fat32(path);
if (!file_info.name) {
return nullptr;
} else if (!file_info.size || file_info.is_directory) {
kfree(file_info.name);
return nullptr;
}
kfree(file_info.name);
// Load executable into memory
uint8_t *file_buf = (uint8_t *)kmalloc(file_info.size);
if (!read_fat32(path, file_buf, file_info.size)) {
kfree(file_buf);
return nullptr;
}
// Check the header to make sure this is actually an ELF
struct elf_header *header = (struct elf_header *)file_buf;
if (header->ident[0] != 0x7F || header->ident[1] != 'E' ||
header->ident[2] != 'L' || header->ident[3] != 'F' ||
header->machine != MACHINE_TYPE_X86) {
kfree(file_buf);
return nullptr;
}
return file_buf;
}
struct segment_list create_process_segments(uint8_t *file_buf,
uint32_t dyn_virtual_offset) {
struct segment_list ret;
ret.linker_path = nullptr;
struct elf_header *header = (struct elf_header *)file_buf;
// Find loadable segments and fill out the Process Memory Segment table
// appropriately
uint32_t num_segments = header->num_segments;
struct segment_header *segment_table =
(struct segment_header *)(file_buf + header->segments_offset);
ret.num_segments = 0;
for (int i = 0; i < num_segments; i++) {
if (segment_table[i].type == LOADABLE_SEGMENT) {
ret.num_segments++;
}
}
ret.segments = (struct process_memory_segment *)kmalloc(
ret.num_segments * sizeof(struct process_memory_segment));
char *linker_path = nullptr;
int process_segment_index = 0;
for (int i = 0; i < num_segments; i++) {
if (segment_table[i].type == LOADABLE_SEGMENT) {
ret.segments[process_segment_index].virtual_address =
(void *)(segment_table[i].virtual_address);
if (header->type == DYN) {
ret.segments[process_segment_index].virtual_address +=
dyn_virtual_offset;
}
ret.segments[process_segment_index].segment_size =
segment_table[i].memory_size;
ret.segments[process_segment_index].flags = segment_table[i].flags;
if (segment_table[i].disk_size) {
ret.segments[process_segment_index].source =
file_buf + segment_table[i].offset;
ret.segments[process_segment_index].disk_size =
segment_table[i].disk_size;
}
process_segment_index++;
} else if (segment_table[i].type == INTERPRETER_SEGMENT) {
ret.linker_path =
make_string_copy((char *)file_buf + segment_table[i].offset);
}
}
return ret;
}
} // namespace
char load_elf(char *path, int argc, char **argv, char **envp, char *working_dir,
struct file_descriptor *standard_in,
struct file_descriptor *standard_out,
struct file_descriptor *standard_error,
struct file_descriptor *open_files,
uint32_t next_file_descriptor) {
uint8_t *file_buf = load_elf_from_disk(path);
if (!file_buf) {
return 0;
}
struct segment_list segments =
create_process_segments(file_buf, DEFAULT_PROGRAM_VIRTUAL_OFFSET);
char need_path_cleanup = 0;
if (segments.linker_path) {
need_path_cleanup = 1;
kfree(segments.segments);
kfree(file_buf);
path = segments.linker_path;
// This process is dynamically linked. Load the linker into memory as well.
file_buf = load_elf_from_disk(segments.linker_path);
if (!file_buf) {
return 0;
}
segments =
create_process_segments(file_buf, DEFAULT_PROGRAM_VIRTUAL_OFFSET);
argc++;
char **old_argv = argv;
argv = (char **)kmalloc(argc * sizeof(char **));
argv[0] = make_string_copy(path);
for (int i = 1; i < argc; i++) {
argv[i] = old_argv[i - 1];
}
kfree(old_argv);
}
struct elf_header *header = (struct elf_header *)file_buf;
void *entry = (void *)header->entry;
if (header->type == DYN) {
entry += DEFAULT_PROGRAM_VIRTUAL_OFFSET;
}
// Spawn the process
char ret = spawn_new_process(
path, argc, argv, envp, segments.segments, segments.num_segments,
(void (*)())entry, working_dir, standard_in, standard_out, standard_error,
open_files, next_file_descriptor);
kfree(segments.segments);
kfree(file_buf);
if (need_path_cleanup) {
kfree(path);
}
return ret;
}
} // namespace proc
| 27.35
| 80
| 0.691208
|
electrojustin
|
8cc0c6ea9edaedb67fa0fe5ba89f1895549480dd
| 24,204
|
cpp
|
C++
|
Blizzlike/ArcEmu/C++/World/Channel.cpp
|
499453466/Lua-Other
|
43fd2b72405faf3f2074fd2a2706ef115d16faa6
|
[
"Unlicense"
] | 2
|
2015-06-23T16:26:32.000Z
|
2019-06-27T07:45:59.000Z
|
Blizzlike/ArcEmu/C++/World/Channel.cpp
|
Eduardo-Silla/Lua-Other
|
db610f946dbcaf81b3de9801f758e11a7bf2753f
|
[
"Unlicense"
] | null | null | null |
Blizzlike/ArcEmu/C++/World/Channel.cpp
|
Eduardo-Silla/Lua-Other
|
db610f946dbcaf81b3de9801f758e11a7bf2753f
|
[
"Unlicense"
] | 3
|
2015-01-10T18:22:59.000Z
|
2021-04-27T21:28:28.000Z
|
/*
* ArcEmu MMORPG Server
* Copyright (C) 2005-2007 Ascent Team <http://www.ascentemu.com/>
* Copyright (C) 2008-2011 <http://www.ArcEmu.org/>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "StdAfx.h"
Mutex m_confSettingLock;
vector<string> m_bannedChannels;
vector<string> m_minimumChannel;
uint64 voicechannelhigh = 0;
void Channel::LoadConfSettings()
{
string BannedChannels = Config.MainConfig.GetStringDefault("Channels", "BannedChannels", "");
string MinimumLevel = Config.MainConfig.GetStringDefault("Channels", "MinimumLevel", "");
m_confSettingLock.Acquire();
m_bannedChannels = StrSplit(BannedChannels, ";");
m_minimumChannel = StrSplit(MinimumLevel, ";");
m_confSettingLock.Release();
}
bool Channel::HasMember(Player* pPlayer)
{
m_lock.Acquire();
if(m_members.find(pPlayer) == m_members.end())
{
m_lock.Release();
return false;
}
else
{
m_lock.Release();
return true;
}
}
Channel::Channel(const char* name, uint32 team, uint32 type_id)
{
ChatChannelDBC* pDBC;
m_flags = 0;
m_announce = true;
m_muted = false;
m_general = false;
m_name = string(name);
m_team = team;
m_id = type_id;
m_minimumLevel = 1;
pDBC = dbcChatChannels.LookupEntryForced(type_id);
if(pDBC != NULL)
{
m_general = true;
m_announce = false;
m_flags |= 0x10; // general flag
// flags (0x01 = custom?, 0x04 = trade?, 0x20 = city?, 0x40 = lfg?, , 0x80 = voice?,
if(pDBC->flags & 0x08)
m_flags |= 0x08; // trade
if(pDBC->flags & 0x10 || pDBC->flags & 0x20)
m_flags |= 0x20; // city flag
if(pDBC->flags & 0x40000)
m_flags |= 0x40; // lfg flag
}
else
m_flags = 0x01;
for(vector<string>::iterator itr = m_minimumChannel.begin(); itr != m_minimumChannel.end(); ++itr)
{
if(stricmp(name, itr->c_str()))
{
m_minimumLevel = 10;
m_general = true;
m_announce = false;
break;
}
}
}
void Channel::AttemptJoin(Player* plr, const char* password)
{
Guard mGuard(m_lock);
WorldPacket data(SMSG_CHANNEL_NOTIFY, 100);
uint32 flags = CHANNEL_FLAG_NONE;
if(!m_general && plr->GetSession()->CanUseCommand('c'))
flags |= CHANNEL_FLAG_MODERATOR;
if(!m_password.empty() && strcmp(m_password.c_str(), password) != 0)
{
data << uint8(CHANNEL_NOTIFY_FLAG_WRONGPASS) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
if(m_bannedMembers.find(plr->GetLowGUID()) != m_bannedMembers.end())
{
data << uint8(CHANNEL_NOTIFY_FLAG_YOURBANNED) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
if(m_members.find(plr) != m_members.end())
{
data << uint8(CHANNEL_NOTIFY_FLAG_ALREADY_ON) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
if(m_members.empty() && !m_general)
flags |= CHANNEL_FLAG_OWNER;
plr->JoinedChannel(this);
m_members.insert(make_pair(plr, flags));
if(m_announce)
{
data << uint8(CHANNEL_NOTIFY_FLAG_JOINED) << m_name << plr->GetGUID();
SendToAll(&data, NULL);
}
data.clear();
if(m_flags & 0x40 && !plr->GetSession()->HasFlag(ACCOUNT_FLAG_NO_AUTOJOIN))
data << uint8(CHANNEL_NOTIFY_FLAG_YOUJOINED) << m_name << uint8(0x1A) << uint32(0) << uint32(0);
else
data << uint8(CHANNEL_NOTIFY_FLAG_YOUJOINED) << m_name << m_flags << m_id << uint32(0);
plr->GetSession()->SendPacket(&data);
}
void Channel::Part(Player* plr, bool send_packet)
{
m_lock.Acquire();
WorldPacket data(SMSG_CHANNEL_NOTIFY, 100);
uint32 flags;
MemberMap::iterator itr = m_members.find(plr);
if(itr == m_members.end())
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTON) << m_name;
plr->GetSession()->SendPacket(&data);
m_lock.Release();
return;
}
flags = itr->second;
m_members.erase(itr);
plr->LeftChannel(this);
if(flags & CHANNEL_FLAG_OWNER)
{
// we need to find a new owner
SetOwner(NULL, NULL);
}
if(plr->GetSession() && (plr->GetSession()->IsLoggingOut() || plr->m_TeleportState == 1))
{
}
else if(send_packet)
{
data << uint8(CHANNEL_NOTIFY_FLAG_YOULEFT) << m_name << m_id << uint32(0) << uint8(0);
plr->GetSession()->SendPacket(&data);
}
if(m_announce)
{
data.clear();
data << uint8(CHANNEL_NOTIFY_FLAG_LEFT) << m_name << plr->GetGUID();
SendToAll(&data);
/* data.Initialize(SMSG_PLAYER_LEFT_CHANNEL);
data << plr->GetGUID() << m_flags << m_id << m_name;
SendToAll(&data);*/
}
if(m_members.size() == 0)
{
m_lock.Release();
channelmgr.RemoveChannel(this);
}
else
m_lock.Release();
}
void Channel::SetOwner(Player* oldpl, Player* plr)
{
Guard mGuard(m_lock);
Player* pOwner = NULL;
uint32 oldflags = 0, oldflags2 = 0;
WorldPacket data(SMSG_CHANNEL_NOTIFY, 100);
if(oldpl != NULL)
{
MemberMap::iterator itr = m_members.find(oldpl);
if(m_members.end() == itr)
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTON) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
if(!(itr->second & CHANNEL_FLAG_OWNER))
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOT_OWNER) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
}
if(plr == NULL)
{
for(MemberMap::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
if(itr->second & CHANNEL_FLAG_OWNER)
{
// remove the old owner
oldflags2 = itr->second;
itr->second &= ~CHANNEL_FLAG_OWNER;
data << uint8(CHANNEL_NOTIFY_FLAG_MODE_CHG) << m_name << itr->first->GetGUID() << uint8(oldflags2) << uint8(itr->second);
SendToAll(&data);
}
else
{
if(pOwner == NULL)
{
pOwner = itr->first;
oldflags = itr->second;
itr->second |= CHANNEL_FLAG_OWNER;
}
}
}
}
else
{
for(MemberMap::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
if(itr->second & CHANNEL_FLAG_OWNER)
{
// remove the old owner
oldflags2 = itr->second;
itr->second &= ~CHANNEL_FLAG_OWNER;
data << uint8(CHANNEL_NOTIFY_FLAG_MODE_CHG) << m_name << itr->first->GetGUID() << uint8(oldflags2) << uint8(itr->second);
SendToAll(&data);
}
else
{
if(plr == itr->first)
{
pOwner = itr->first;
oldflags = itr->second;
itr->second |= CHANNEL_FLAG_OWNER;
}
}
}
}
if(pOwner == NULL)
return; // obviously no members
data.clear();
data << uint8(CHANNEL_NOTIFY_FLAG_CHGOWNER) << m_name << pOwner->GetGUID();
SendToAll(&data);
// send the mode changes
data.clear();
data << uint8(CHANNEL_NOTIFY_FLAG_MODE_CHG) << m_name << pOwner->GetGUID() << uint8(oldflags) << uint8(oldflags | CHANNEL_FLAG_OWNER);
SendToAll(&data);
}
void Channel::Invite(Player* plr, Player* new_player)
{
Guard mGuard(m_lock);
if(m_members.find(plr) == m_members.end())
{
SendNotOn(plr);
return;
}
if(m_members.find(new_player) != m_members.end())
{
SendAlreadyOn(plr, new_player);
return;
}
WorldPacket data(SMSG_CHANNEL_NOTIFY, 100);
data << uint8(CHANNEL_NOTIFY_FLAG_INVITED) << m_name << plr->GetGUID();
new_player->GetSession()->SendPacket(&data);
data.clear();
data << uint8(CHANNEL_NOTIFY_FLAG_YOU_INVITED) << m_name << new_player->GetGUID();
plr->GetSession()->SendPacket(&data);
}
void Channel::Moderate(Player* plr)
{
Guard mGuard(m_lock);
MemberMap::iterator itr = m_members.find(plr);
WorldPacket data(SMSG_CHANNEL_NOTIFY, 100);
if(m_members.end() == itr)
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTON) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
if(!(itr->second & CHANNEL_FLAG_OWNER || itr->second & CHANNEL_FLAG_MODERATOR) && !plr->GetSession()->CanUseCommand('c'))
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTMOD) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
m_muted = !m_muted;
data << uint8(m_muted ? CHANNEL_NOTIFY_FLAG_MODERATED : CHANNEL_NOTIFY_FLAG_UNMODERATED) << m_name << plr->GetGUID();
SendToAll(&data);
}
void Channel::Say(Player* plr, const char* message, Player* for_gm_client, bool forced)
{
Guard mGuard(m_lock);
MemberMap::iterator itr = m_members.find(plr);
WorldPacket data(SMSG_CHANNEL_NOTIFY, strlen(message) + 100);
if(!forced)
{
if(m_members.end() == itr)
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTON) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
if(itr->second & CHANNEL_FLAG_MUTED)
{
data << uint8(CHANNEL_NOTIFY_FLAG_YOUCANTSPEAK) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
if(m_muted && !(itr->second & CHANNEL_FLAG_VOICED) && !(itr->second & CHANNEL_FLAG_MODERATOR) && !(itr->second & CHANNEL_FLAG_OWNER))
{
data << uint8(CHANNEL_NOTIFY_FLAG_YOUCANTSPEAK) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
}
// not blizzlike but meh
if(plr->getLevel() < m_minimumLevel)
{
plr->BroadcastMessage("You must be level %u to speak in the channel, '%s'.", m_minimumLevel, m_name.c_str());
return;
}
data.SetOpcode(SMSG_MESSAGECHAT);
data << uint8(CHAT_MSG_CHANNEL);
data << uint32(0); // language
data << plr->GetGUID(); // guid
data << uint32(0); // rank?
data << m_name; // channel name
data << plr->GetGUID(); // guid again?
data << uint32(strlen(message) + 1);
data << message;
data << (uint8)(plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAG_GM) ? 4 : 0);
if(for_gm_client != NULL)
for_gm_client->GetSession()->SendPacket(&data);
else
SendToAll(&data);
}
void Channel::SendNotOn(Player* plr)
{
WorldPacket data(SMSG_CHANNEL_NOTIFY, 100);
data << uint8(CHANNEL_NOTIFY_FLAG_NOTON) << m_name;
plr->GetSession()->SendPacket(&data);
}
void Channel::SendAlreadyOn(Player* plr, Player* plr2)
{
WorldPacket data(SMSG_CHANNEL_NOTIFY, 100);
data << uint8(CHANNEL_NOTIFY_FLAG_ALREADY_ON) << m_name << plr2->GetGUID();
plr->GetSession()->SendPacket(&data);
}
void Channel::Kick(Player* plr, Player* die_player, bool ban)
{
Guard mGuard(m_lock);
MemberMap::iterator itr = m_members.find(die_player);
MemberMap::iterator me_itr = m_members.find(plr);
WorldPacket data(SMSG_CHANNEL_NOTIFY, 100);
uint32 flags;
if(me_itr == m_members.end())
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTON) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
if(itr == m_members.end())
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOT_ON_2) << m_name << die_player->GetGUID();
plr->GetSession()->SendPacket(&data);
return;
}
if(!(me_itr->second & CHANNEL_FLAG_OWNER || me_itr->second & CHANNEL_FLAG_MODERATOR) && !plr->GetSession()->CanUseCommand('a'))
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTMOD) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
flags = itr->second;
data << uint8(CHANNEL_NOTIFY_FLAG_KICKED) << m_name << die_player->GetGUID();
SendToAll(&data);
if(ban)
{
data.clear();
data << uint8(CHANNEL_NOTIFY_FLAG_BANNED) << m_name << die_player->GetGUID();
SendToAll(&data);
}
m_members.erase(itr);
if(flags & CHANNEL_FLAG_OWNER)
SetOwner(NULL, NULL);
if(ban)
m_bannedMembers.insert(die_player->GetLowGUID());
data.clear();
data << uint8(CHANNEL_NOTIFY_FLAG_YOULEFT) << m_name << m_id << uint32(0) << uint8(0);
die_player->GetSession()->SendPacket(&data);
}
void Channel::Unban(Player* plr, PlayerInfo* bplr)
{
Guard mGuard(m_lock);
MemberMap::iterator itr = m_members.find(plr);
WorldPacket data(SMSG_CHANNEL_NOTIFY, 100);
if(m_members.end() == itr)
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTON) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
if(!(itr->second & CHANNEL_FLAG_OWNER || itr->second & CHANNEL_FLAG_MODERATOR) && !plr->GetSession()->CanUseCommand('a'))
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTMOD) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
set<uint32>::iterator it2 = m_bannedMembers.find(bplr->guid);
if(it2 == m_bannedMembers.end())
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOT_ON_2) << m_name << uint64(bplr->guid);
plr->GetSession()->SendPacket(&data);
return;
}
data << uint8(CHANNEL_NOTIFY_FLAG_UNBANNED) << m_name << uint64(bplr->guid);
SendToAll(&data);
m_bannedMembers.erase(it2);
}
void Channel::Voice(Player* plr, Player* v_player)
{
Guard mGuard(m_lock);
MemberMap::iterator itr = m_members.find(plr);
MemberMap::iterator itr2 = m_members.find(v_player);
WorldPacket data(SMSG_CHANNEL_NOTIFY, 100);
if(m_members.end() == itr)
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTON) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
if(m_members.end() == itr2)
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOT_ON_2) << m_name << v_player->GetGUID();
plr->GetSession()->SendPacket(&data);
return;
}
if(!(itr->second & CHANNEL_FLAG_OWNER || itr->second & CHANNEL_FLAG_MODERATOR) && !plr->GetSession()->CanUseCommand('a'))
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTMOD) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
uint32 oldflags = itr2->second;
itr2->second |= CHANNEL_FLAG_VOICED;
data << uint8(CHANNEL_NOTIFY_FLAG_MODE_CHG) << m_name << v_player->GetGUID() << uint8(oldflags) << uint8(itr2->second);
SendToAll(&data);
}
void Channel::Devoice(Player* plr, Player* v_player)
{
Guard mGuard(m_lock);
MemberMap::iterator itr = m_members.find(plr);
MemberMap::iterator itr2 = m_members.find(v_player);
WorldPacket data(SMSG_CHANNEL_NOTIFY, 100);
if(m_members.end() == itr)
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTON) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
if(m_members.end() == itr2)
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOT_ON_2) << m_name << v_player->GetGUID();
plr->GetSession()->SendPacket(&data);
return;
}
if(!(itr->second & CHANNEL_FLAG_OWNER || itr->second & CHANNEL_FLAG_MODERATOR) && !plr->GetSession()->CanUseCommand('a'))
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTMOD) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
uint32 oldflags = itr2->second;
itr2->second &= ~CHANNEL_FLAG_VOICED;
data << uint8(CHANNEL_NOTIFY_FLAG_MODE_CHG) << m_name << v_player->GetGUID() << uint8(oldflags) << uint8(itr2->second);
SendToAll(&data);
}
void Channel::Mute(Player* plr, Player* die_player)
{
Guard mGuard(m_lock);
MemberMap::iterator itr = m_members.find(plr);
MemberMap::iterator itr2 = m_members.find(die_player);
WorldPacket data(SMSG_CHANNEL_NOTIFY, 100);
if(m_members.end() == itr)
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTON) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
if(m_members.end() == itr2)
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOT_ON_2) << m_name << die_player->GetGUID();
plr->GetSession()->SendPacket(&data);
return;
}
if(!(itr->second & CHANNEL_FLAG_OWNER || itr->second & CHANNEL_FLAG_MODERATOR) && !plr->GetSession()->CanUseCommand('a'))
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTMOD) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
uint32 oldflags = itr2->second;
itr2->second |= CHANNEL_FLAG_MUTED;
data << uint8(CHANNEL_NOTIFY_FLAG_MODE_CHG) << m_name << die_player->GetGUID() << uint8(oldflags) << uint8(itr2->second);
SendToAll(&data);
}
void Channel::Unmute(Player* plr, Player* die_player)
{
Guard mGuard(m_lock);
MemberMap::iterator itr = m_members.find(plr);
MemberMap::iterator itr2 = m_members.find(die_player);
WorldPacket data(SMSG_CHANNEL_NOTIFY, 100);
if(m_members.end() == itr)
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTON) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
if(m_members.end() == itr2)
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOT_ON_2) << m_name << die_player->GetGUID();
plr->GetSession()->SendPacket(&data);
return;
}
if(!(itr->second & CHANNEL_FLAG_OWNER || itr->second & CHANNEL_FLAG_MODERATOR) && !plr->GetSession()->CanUseCommand('a'))
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTMOD) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
uint32 oldflags = itr2->second;
itr2->second &= ~CHANNEL_FLAG_MUTED;
data << uint8(CHANNEL_NOTIFY_FLAG_MODE_CHG) << m_name << die_player->GetGUID() << uint8(oldflags) << uint8(itr2->second);
SendToAll(&data);
}
void Channel::GiveModerator(Player* plr, Player* new_player)
{
Guard mGuard(m_lock);
MemberMap::iterator itr = m_members.find(plr);
MemberMap::iterator itr2 = m_members.find(new_player);
WorldPacket data(SMSG_CHANNEL_NOTIFY, 100);
if(m_members.end() == itr)
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTON) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
if(m_members.end() == itr2)
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOT_ON_2) << m_name << new_player->GetGUID();
plr->GetSession()->SendPacket(&data);
return;
}
if(!(itr->second & CHANNEL_FLAG_OWNER || itr->second & CHANNEL_FLAG_MODERATOR))
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTMOD) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
uint32 oldflags = itr2->second;
itr2->second |= CHANNEL_FLAG_MODERATOR;
data << uint8(CHANNEL_NOTIFY_FLAG_MODE_CHG) << m_name << new_player->GetGUID() << uint8(oldflags) << uint8(itr2->second);
SendToAll(&data);
}
void Channel::TakeModerator(Player* plr, Player* new_player)
{
Guard mGuard(m_lock);
MemberMap::iterator itr = m_members.find(plr);
MemberMap::iterator itr2 = m_members.find(new_player);
WorldPacket data(SMSG_CHANNEL_NOTIFY, 100);
if(m_members.end() == itr)
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTON) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
if(m_members.end() == itr2)
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOT_ON_2) << m_name << new_player->GetGUID();
plr->GetSession()->SendPacket(&data);
return;
}
if(!(itr->second & CHANNEL_FLAG_OWNER || itr->second & CHANNEL_FLAG_MODERATOR) && !plr->GetSession()->CanUseCommand('a'))
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTMOD) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
uint32 oldflags = itr2->second;
itr2->second &= ~CHANNEL_FLAG_MODERATOR;
data << uint8(CHANNEL_NOTIFY_FLAG_MODE_CHG) << m_name << new_player->GetGUID() << uint8(oldflags) << uint8(itr2->second);
SendToAll(&data);
}
void Channel::Announce(Player* plr)
{
Guard mGuard(m_lock);
MemberMap::iterator itr = m_members.find(plr);
WorldPacket data(SMSG_CHANNEL_NOTIFY, 100);
if(m_members.end() == itr)
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTON) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
if(!(itr->second & CHANNEL_FLAG_OWNER || itr->second & CHANNEL_FLAG_MODERATOR) && !plr->GetSession()->CanUseCommand('a'))
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTMOD) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
m_announce = !m_announce;
data << uint8(m_announce ? CHANNEL_NOTIFY_FLAG_ENABLE_ANN : CHANNEL_NOTIFY_FLAG_DISABLE_ANN) << m_name << plr->GetGUID();
SendToAll(&data);
}
void Channel::Password(Player* plr, const char* pass)
{
Guard mGuard(m_lock);
MemberMap::iterator itr = m_members.find(plr);
WorldPacket data(SMSG_CHANNEL_NOTIFY, 100);
if(m_members.end() == itr)
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTON) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
if(!(itr->second & CHANNEL_FLAG_OWNER || itr->second & CHANNEL_FLAG_MODERATOR) && !plr->GetSession()->CanUseCommand('a'))
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTMOD) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
m_password = string(pass);
data << uint8(CHANNEL_NOTIFY_FLAG_SETPASS) << m_name << plr->GetGUID();
SendToAll(&data);
}
void Channel::List(Player* plr)
{
Guard mGuard(m_lock);
WorldPacket data(SMSG_CHANNEL_LIST, 50 + (m_members.size() * 9));
MemberMap::iterator itr = m_members.find(plr);
if(itr == m_members.end())
{
data.Initialize(SMSG_CHANNEL_NOTIFY);
data << uint8(CHANNEL_NOTIFY_FLAG_NOTON) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
uint8 flags;
data << uint8(1) << m_name;
data << uint8(m_flags);
data << uint32(m_members.size());
for(itr = m_members.begin(); itr != m_members.end(); ++itr)
{
data << itr->first->GetGUID();
flags = 0;
if(!(itr->second & CHANNEL_FLAG_MUTED))
flags |= 0x04; // voice flag
if(itr->second & CHANNEL_FLAG_OWNER)
flags |= 0x01; // owner flag
if(itr->second & CHANNEL_FLAG_MODERATOR)
flags |= 0x02; // moderator flag
if(!m_general)
flags |= 0x10;
data << flags;
}
plr->GetSession()->SendPacket(&data);
}
void Channel::GetOwner(Player* plr)
{
Guard mGuard(m_lock);
MemberMap::iterator itr = m_members.find(plr);
WorldPacket data(SMSG_CHANNEL_NOTIFY, 100);
if(itr == m_members.end())
{
data << uint8(CHANNEL_NOTIFY_FLAG_NOTON) << m_name;
plr->GetSession()->SendPacket(&data);
return;
}
for(itr = m_members.begin(); itr != m_members.end(); ++itr)
{
if(itr->second & CHANNEL_FLAG_OWNER)
{
data << uint8(CHANNEL_NOTIFY_FLAG_WHO_OWNER) << m_name << itr->first->GetGUID();
plr->GetSession()->SendPacket(&data);
return;
}
}
}
ChannelMgr::~ChannelMgr()
{
for(int i = 0; i < 2; ++i)
{
ChannelList::iterator itr = this->Channels[i].begin();
for(; itr != this->Channels[i].end(); ++itr)
{
delete itr->second;
}
Channels[i].clear();
}
}
Channel::~Channel()
{
m_lock.Acquire();
for(MemberMap::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
itr->first->LeftChannel(this);
m_lock.Release();
}
void Channel::SendToAll(WorldPacket* data)
{
Guard guard(m_lock);
for(MemberMap::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
itr->first->GetSession()->SendPacket(data);
}
void Channel::SendToAll(WorldPacket* data, Player* plr)
{
Guard guard(m_lock);
for(MemberMap::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
{
if(itr->first != plr)
itr->first->GetSession()->SendPacket(data);
}
}
Channel* ChannelMgr::GetCreateChannel(const char* name, Player* p, uint32 type_id)
{
ChannelList::iterator itr;
ChannelList* cl = &Channels[0];
Channel* chn;
if(seperatechannels && p != NULL && stricmp(name, sWorld.getGmClientChannel().c_str()))
cl = &Channels[p->GetTeam()];
lock.Acquire();
for(itr = cl->begin(); itr != cl->end(); ++itr)
{
if(!stricmp(name, itr->first.c_str()))
{
lock.Release();
return itr->second;
}
}
// make sure the name isn't banned
m_confSettingLock.Acquire();
for(vector<string>::iterator itr2 = m_bannedChannels.begin(); itr2 != m_bannedChannels.end(); ++itr2)
{
if(!strnicmp(name, itr2->c_str(), itr2->size()))
{
lock.Release();
m_confSettingLock.Release();
return NULL;
}
}
chn = new Channel(name, (seperatechannels && p != NULL) ? p->GetTeam() : 0, type_id);
m_confSettingLock.Release();//Channel::Channel() reads configs so we release the lock after we create the Channel.
cl->insert(make_pair(chn->m_name, chn));
lock.Release();
return chn;
}
Channel* ChannelMgr::GetChannel(const char* name, Player* p)
{
ChannelList::iterator itr;
ChannelList* cl = &Channels[0];
if(seperatechannels && stricmp(name, sWorld.getGmClientChannel().c_str()))
cl = &Channels[p->GetTeam()];
lock.Acquire();
for(itr = cl->begin(); itr != cl->end(); ++itr)
{
if(!stricmp(name, itr->first.c_str()))
{
lock.Release();
return itr->second;
}
}
lock.Release();
return NULL;
}
Channel* ChannelMgr::GetChannel(const char* name, uint32 team)
{
ChannelList::iterator itr;
ChannelList* cl = &Channels[0];
if(seperatechannels && stricmp(name, sWorld.getGmClientChannel().c_str()))
cl = &Channels[team];
lock.Acquire();
for(itr = cl->begin(); itr != cl->end(); ++itr)
{
if(!stricmp(name, itr->first.c_str()))
{
lock.Release();
return itr->second;
}
}
lock.Release();
return NULL;
}
void ChannelMgr::RemoveChannel(Channel* chn)
{
ChannelList::iterator itr;
ChannelList* cl = &Channels[0];
if(seperatechannels)
cl = &Channels[chn->m_team];
lock.Acquire();
for(itr = cl->begin(); itr != cl->end(); ++itr)
{
if(itr->second == chn)
{
cl->erase(itr);
delete chn;
lock.Release();
return;
}
}
lock.Release();
}
ChannelMgr::ChannelMgr()
{
}
| 25.831377
| 135
| 0.681912
|
499453466
|
8cc28a9b947f0da659dce3d5c1a20595bd8e169b
| 111,251
|
cpp
|
C++
|
src/samplers/SamplerCapCVT/gx_capcvt2d/generated/Ltheta_rho18.cpp
|
FrancoisGaits/utk
|
8c408dd79635f98c46ed075c098f15e23972aad0
|
[
"BSD-2-Clause-FreeBSD"
] | 44
|
2018-01-09T19:56:29.000Z
|
2022-03-03T06:38:54.000Z
|
src/samplers/SamplerCapCVT/gx_capcvt2d/generated/Ltheta_rho18.cpp
|
FrancoisGaits/utk
|
8c408dd79635f98c46ed075c098f15e23972aad0
|
[
"BSD-2-Clause-FreeBSD"
] | 16
|
2018-01-29T18:01:42.000Z
|
2022-03-31T07:01:09.000Z
|
src/samplers/SamplerCapCVT/gx_capcvt2d/generated/Ltheta_rho18.cpp
|
FrancoisGaits/utk
|
8c408dd79635f98c46ed075c098f15e23972aad0
|
[
"BSD-2-Clause-FreeBSD"
] | 12
|
2018-03-14T00:24:14.000Z
|
2022-03-03T06:40:07.000Z
|
#include "Ltheta_rho18.h"
namespace Geex {
Ltheta_rho18::Ltheta_rho18() : Function(1,8,0){}
void Ltheta_rho18::eval(bool do_f, bool do_g, bool do_H) {
if(do_f) {
{
double tmp_1 = x(7);
double tmp_2 = (tmp_1*tmp_1)+1.0;
double tmp_3 = 1.0/(tmp_2);
double tmp_4 = x(6);
double tmp_5 = sin(tmp_4);
double tmp_6 = x(4);
double tmp_7 = x(0);
double tmp_8 = -tmp_7;
double tmp_9 = tmp_6+tmp_8;
double tmp_10 = tmp_9*tmp_5*tmp_3;
double tmp_11 = cos(tmp_4);
double tmp_12 = x(1);
double tmp_13 = x(5);
double tmp_14 = -tmp_13;
double tmp_15 = tmp_12+tmp_14;
double tmp_16 = -tmp_15*tmp_11*tmp_3;
double tmp_17 = tmp_10+tmp_16;
double tmp_18 = x(3);
double tmp_19 = -tmp_18;
double tmp_20 = tmp_12+tmp_19;
double tmp_21 = tmp_11*tmp_20*tmp_3;
double tmp_22 = x(2);
double tmp_23 = tmp_8+tmp_22;
double tmp_24 = -tmp_5*tmp_23*tmp_3;
double tmp_25 = tmp_21+tmp_24;
double tmp_27 = tmp_5*tmp_20*tmp_3;
double tmp_28 = tmp_11*tmp_23*tmp_3;
double tmp_29 = tmp_28+tmp_27;
double tmp_30 = tmp_15*tmp_5*tmp_3;
double tmp_31 = tmp_9*tmp_11*tmp_3;
double tmp_32 = tmp_31+tmp_30;
double f0 = -((tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_25*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25)))-((tmp_29*((tmp_29*tmp_29)*(tmp_29*tmp_29))*((tmp_29*tmp_29)*(tmp_29*tmp_29)))*(tmp_29*((tmp_29*tmp_29)*(tmp_29*tmp_29))*((tmp_29*tmp_29)*(tmp_29*tmp_29))))-((((tmp_29*tmp_29)*(tmp_29*tmp_29))*((tmp_29*tmp_29)*(tmp_29*tmp_29)))*(((tmp_29*tmp_29)*(tmp_29*tmp_29))*((tmp_29*tmp_29)*(tmp_29*tmp_29))))*(tmp_32*tmp_32)-(tmp_29*tmp_29*tmp_29)*(tmp_32*(tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*(tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32)))-((tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29))*(((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32)))+(tmp_17*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))-(((tmp_29*tmp_29)*(tmp_29*tmp_29))*((tmp_29*tmp_29)*(tmp_29*tmp_29)))*((tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32))*(tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32)))-(((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))-((tmp_29*(tmp_29*tmp_29)*(tmp_29*tmp_29))*(tmp_29*(tmp_29*tmp_29)*(tmp_29*tmp_29)))*(((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32)))-(tmp_29*(tmp_29*(tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29))*(tmp_29*(tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29)))*(tmp_32*tmp_32*tmp_32)-(tmp_29*tmp_29)*((((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32)))*(((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32))))-(tmp_29*((tmp_29*tmp_29)*(tmp_29*tmp_29))*((tmp_29*tmp_29)*(tmp_29*tmp_29)))*(tmp_32*((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32)))+(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_25*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))-((tmp_29*tmp_29)*(tmp_29*tmp_29))*((tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*(tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32)))+(tmp_17*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))-((tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))-((tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*((tmp_25*tmp_25)*(tmp_25*tmp_25))-tmp_29*(tmp_32*(((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32)))*(((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32))))+(tmp_17*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))*tmp_25-(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*((tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25)))-((tmp_25*((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(tmp_25*((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25))))-(tmp_29*(tmp_29*(tmp_29*tmp_29)*(tmp_29*tmp_29))*(tmp_29*(tmp_29*tmp_29)*(tmp_29*tmp_29)))*(tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))-(((tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29))*((tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29)))*((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))-((tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))+(tmp_17*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*(tmp_25*tmp_25*tmp_25)-(tmp_29*(tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29))*(tmp_32*(tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32))*(tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32)))+(tmp_17*tmp_17*tmp_17)*(tmp_25*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))-((((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))*(tmp_25*tmp_25)-((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))-((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))-(tmp_29*(tmp_29*tmp_29)*(tmp_29*tmp_29))*(tmp_32*((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32)))-(tmp_29*((tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29))*((tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29)))*(tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32))-((tmp_29*(tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29))*(tmp_29*(tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29)))*((tmp_32*tmp_32)*(tmp_32*tmp_32))+tmp_17*(tmp_25*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25))))-((tmp_32*((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32)))*(tmp_32*((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32))))-(tmp_29*(((tmp_29*tmp_29)*(tmp_29*tmp_29))*((tmp_29*tmp_29)*(tmp_29*tmp_29)))*(((tmp_29*tmp_29)*(tmp_29*tmp_29))*((tmp_29*tmp_29)*(tmp_29*tmp_29))))*tmp_32-(tmp_17*tmp_17)*((((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25))))+(tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_25*((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25))))*(tmp_32*tmp_25+tmp_17*tmp_29);
f(0) = f0;
}
}
if(do_g) {
{
double tmp_1 = x(6);
double tmp_2 = cos(tmp_1);
double tmp_3 = x(7);
double tmp_4 = (tmp_3*tmp_3)+1.0;
double tmp_5 = 1.0/(tmp_4);
double tmp_6 = x(1);
double tmp_7 = x(3);
double tmp_8 = -tmp_7;
double tmp_9 = tmp_8+tmp_6;
double tmp_10 = sin(tmp_1);
double tmp_11 = tmp_5*tmp_10*tmp_9;
double tmp_12 = x(2);
double tmp_13 = x(0);
double tmp_14 = -tmp_13;
double tmp_15 = tmp_14+tmp_12;
double tmp_16 = tmp_15*tmp_2*tmp_5;
double tmp_17 = tmp_11+tmp_16;
double tmp_18 = x(5);
double tmp_19 = -tmp_18;
double tmp_20 = tmp_19+tmp_6;
double tmp_21 = tmp_5*tmp_20*tmp_10;
double tmp_22 = x(4);
double tmp_23 = tmp_14+tmp_22;
double tmp_24 = tmp_2*tmp_5*tmp_23;
double tmp_25 = tmp_21+tmp_24;
double tmp_29 = tmp_5*tmp_23*tmp_10;
double tmp_30 = -tmp_2*tmp_5*tmp_20;
double tmp_31 = tmp_30+tmp_29;
double tmp_32 = tmp_2*tmp_5*tmp_9;
double tmp_33 = -tmp_15*tmp_5*tmp_10;
double tmp_34 = tmp_33+tmp_32;
double g0_0 = -19.0*(tmp_34*tmp_25+tmp_31*tmp_17)*(tmp_5*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(((tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34))*((tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34)))*tmp_10+tmp_2*tmp_5*(tmp_17*tmp_17)*(tmp_25*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))+tmp_2*tmp_5*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))-tmp_5*((((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31))))*tmp_34*tmp_10+tmp_2*tmp_5*((((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))*tmp_25-tmp_5*((tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_34*((tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34))*((tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34)))*tmp_10+tmp_5*(tmp_31*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*((tmp_34*tmp_34)*(tmp_34*tmp_34))*tmp_10+tmp_5*(tmp_31*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31))))*tmp_10+tmp_2*tmp_5*(tmp_17*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*(tmp_25*tmp_25)-tmp_5*(tmp_31*tmp_31)*(tmp_34*(tmp_34*(tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34))*(tmp_34*(tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34)))*tmp_10+tmp_2*tmp_5*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25)))+tmp_2*tmp_5*((tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*(tmp_25*tmp_25*tmp_25)+tmp_2*tmp_5*(tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))-tmp_5*(((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*(tmp_34*(tmp_34*tmp_34)*(tmp_34*tmp_34))*tmp_10-tmp_5*(tmp_34*(((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34)))*(((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34))))*tmp_10+tmp_2*tmp_5*(tmp_17*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*((tmp_25*tmp_25)*(tmp_25*tmp_25))-tmp_5*((tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31)))*(tmp_34*(tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34))*tmp_10+tmp_5*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*((tmp_34*(tmp_34*tmp_34)*(tmp_34*tmp_34))*(tmp_34*(tmp_34*tmp_34)*(tmp_34*tmp_34)))*tmp_10-tmp_5*((tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*(tmp_34*tmp_34*tmp_34)*tmp_10-tmp_5*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(tmp_34*((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34)))*tmp_10+tmp_5*(tmp_31*((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34)))*tmp_10+tmp_5*tmp_31*((((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34)))*(((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34))))*tmp_10+tmp_2*tmp_5*(tmp_25*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25))))+tmp_2*tmp_5*((tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_25*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))+tmp_2*tmp_5*(tmp_17*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))+tmp_2*tmp_5*(tmp_17*tmp_17*tmp_17)*((tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))+tmp_5*(tmp_31*tmp_31*tmp_31)*((tmp_34*(tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34))*(tmp_34*(tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34)))*tmp_10+tmp_2*tmp_5*(tmp_17*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))+tmp_5*(tmp_31*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31)))*((tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34))*tmp_10+tmp_2*tmp_5*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_25*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25)))-tmp_5*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_34*(tmp_34*(tmp_34*tmp_34)*(tmp_34*tmp_34))*(tmp_34*(tmp_34*tmp_34)*(tmp_34*tmp_34)))*tmp_10+tmp_5*(tmp_31*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*(tmp_34*tmp_34)*tmp_10+tmp_2*tmp_5*(((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))+tmp_2*tmp_5*((tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))+tmp_2*tmp_5*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_25*((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))+tmp_2*tmp_5*tmp_17*((((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))))-(((tmp_31*((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(tmp_31*((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31))))+((tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))+(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*((tmp_34*(tmp_34*tmp_34)*(tmp_34*tmp_34))*(tmp_34*(tmp_34*tmp_34)*(tmp_34*tmp_34)))+(tmp_17*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*(tmp_25*tmp_25*tmp_25)+((tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34)))+(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*((tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25)))-(tmp_31*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*(tmp_34*tmp_34*tmp_34)+(tmp_17*tmp_17*tmp_17)*(tmp_25*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))+((((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))*(tmp_25*tmp_25)+((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))+((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(((tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34))*((tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34)))+((((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31))))*(tmp_34*tmp_34)-(tmp_31*tmp_31*tmp_31)*(tmp_34*(tmp_34*(tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34))*(tmp_34*(tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34)))+tmp_17*(tmp_25*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25))))+((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_34*(tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34))*(tmp_34*(tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34)))+((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))-tmp_31*(tmp_34*(((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34)))*(((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34))))+(tmp_31*tmp_31)*((((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34)))*(((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34))))+(tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_25*((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))+(tmp_17*tmp_17)*((((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25))))-(tmp_31*((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(tmp_34*((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34)))-(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_34*(tmp_34*(tmp_34*tmp_34)*(tmp_34*tmp_34))*(tmp_34*(tmp_34*tmp_34)*(tmp_34*tmp_34)))+(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_25*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25)))+((tmp_25*((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(tmp_25*((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25))))+(((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*((tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34))-(tmp_31*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31)))*(tmp_34*(tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34))+((tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))+(tmp_17*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))+(((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))-(tmp_31*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*(tmp_34*(tmp_34*tmp_34)*(tmp_34*tmp_34))+((tmp_34*((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34)))*(tmp_34*((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34))))+((tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*((tmp_25*tmp_25)*(tmp_25*tmp_25))+(tmp_17*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))*tmp_25-(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_34*((tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34))*((tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34)))-(tmp_31*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31))))*tmp_34+(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_25*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))+(tmp_17*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))+((tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*((tmp_34*tmp_34)*(tmp_34*tmp_34)))*(tmp_5*tmp_17*tmp_10+tmp_2*tmp_5*tmp_34+tmp_2*tmp_5*tmp_31-tmp_5*tmp_10*tmp_25);
g(0,0) = g0_0;
}
{
double tmp_1 = x(7);
double tmp_2 = (tmp_1*tmp_1)+1.0;
double tmp_3 = 1.0/(tmp_2);
double tmp_4 = x(6);
double tmp_5 = sin(tmp_4);
double tmp_6 = x(4);
double tmp_7 = x(0);
double tmp_8 = -tmp_7;
double tmp_9 = tmp_8+tmp_6;
double tmp_10 = tmp_5*tmp_9*tmp_3;
double tmp_11 = cos(tmp_4);
double tmp_12 = x(1);
double tmp_13 = x(5);
double tmp_14 = -tmp_13;
double tmp_15 = tmp_14+tmp_12;
double tmp_16 = -tmp_11*tmp_3*tmp_15;
double tmp_17 = tmp_10+tmp_16;
double tmp_18 = x(3);
double tmp_19 = -tmp_18;
double tmp_20 = tmp_19+tmp_12;
double tmp_21 = tmp_11*tmp_20*tmp_3;
double tmp_22 = x(2);
double tmp_23 = tmp_8+tmp_22;
double tmp_24 = -tmp_5*tmp_23*tmp_3;
double tmp_25 = tmp_21+tmp_24;
double tmp_27 = tmp_5*tmp_20*tmp_3;
double tmp_28 = tmp_11*tmp_23*tmp_3;
double tmp_29 = tmp_27+tmp_28;
double tmp_30 = tmp_5*tmp_3*tmp_15;
double tmp_31 = tmp_11*tmp_9*tmp_3;
double tmp_32 = tmp_30+tmp_31;
double g0_1 = 19.0*(tmp_17*tmp_29+tmp_32*tmp_25)*(tmp_11*(tmp_17*tmp_17)*(tmp_25*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))*tmp_3+tmp_5*(tmp_29*(tmp_29*tmp_29)*(tmp_29*tmp_29))*(((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32)))*tmp_3-tmp_11*(tmp_17*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*((tmp_25*tmp_25)*(tmp_25*tmp_25))*tmp_3+tmp_11*(tmp_25*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25))))*tmp_3+tmp_5*(tmp_29*(((tmp_29*tmp_29)*(tmp_29*tmp_29))*((tmp_29*tmp_29)*(tmp_29*tmp_29)))*(((tmp_29*tmp_29)*(tmp_29*tmp_29))*((tmp_29*tmp_29)*(tmp_29*tmp_29))))*tmp_3+tmp_5*((((tmp_29*tmp_29)*(tmp_29*tmp_29))*((tmp_29*tmp_29)*(tmp_29*tmp_29)))*(((tmp_29*tmp_29)*(tmp_29*tmp_29))*((tmp_29*tmp_29)*(tmp_29*tmp_29))))*tmp_32*tmp_3+tmp_5*((tmp_29*tmp_29)*(tmp_29*tmp_29))*(tmp_32*((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32)))*tmp_3+tmp_5*(tmp_29*((tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29))*((tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29)))*((tmp_32*tmp_32)*(tmp_32*tmp_32))*tmp_3+tmp_11*((((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))*tmp_25*tmp_3+tmp_11*((tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_25*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))*tmp_3+tmp_5*(tmp_29*tmp_29)*(tmp_32*(tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*(tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32)))*tmp_3-tmp_11*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))*tmp_3+tmp_5*(((tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29))*((tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29)))*(tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32))*tmp_3+tmp_5*(tmp_32*(((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32)))*(((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32))))*tmp_3+tmp_5*((tmp_29*(tmp_29*tmp_29)*(tmp_29*tmp_29))*(tmp_29*(tmp_29*tmp_29)*(tmp_29*tmp_29)))*(tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*tmp_3+tmp_5*(tmp_29*(tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29))*((tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32))*(tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32)))*tmp_3+tmp_5*(((tmp_29*tmp_29)*(tmp_29*tmp_29))*((tmp_29*tmp_29)*(tmp_29*tmp_29)))*(tmp_32*((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32)))*tmp_3+tmp_5*(tmp_29*((tmp_29*tmp_29)*(tmp_29*tmp_29))*((tmp_29*tmp_29)*(tmp_29*tmp_29)))*(((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32)))*tmp_3-tmp_11*(tmp_17*tmp_17*tmp_17)*((tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))*tmp_3+tmp_5*((tmp_29*(tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29))*(tmp_29*(tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29)))*(tmp_32*tmp_32*tmp_32)*tmp_3+tmp_5*tmp_29*((((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32)))*(((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32))))*tmp_3-tmp_11*(tmp_17*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*tmp_3+tmp_11*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_25*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25)))*tmp_3-tmp_11*(tmp_17*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*(tmp_25*tmp_25)*tmp_3-tmp_11*(tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*tmp_3+tmp_11*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_25*((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*tmp_3-tmp_11*(tmp_17*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))*tmp_3+tmp_11*((tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*(tmp_25*tmp_25*tmp_25)*tmp_3+tmp_5*(tmp_29*tmp_29*tmp_29)*((tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*(tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32)))*tmp_3-tmp_11*tmp_17*((((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25))))*tmp_3+tmp_5*(tmp_29*(tmp_29*(tmp_29*tmp_29)*(tmp_29*tmp_29))*(tmp_29*(tmp_29*tmp_29)*(tmp_29*tmp_29)))*((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*tmp_3+tmp_5*((tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29))*(tmp_32*(tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32))*(tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32)))*tmp_3+tmp_5*(tmp_29*(tmp_29*(tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29))*(tmp_29*(tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29)))*(tmp_32*tmp_32)*tmp_3+tmp_11*(((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))*tmp_3+tmp_11*((tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*tmp_3-tmp_11*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25)))*tmp_3)-((((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*((tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25)))+(tmp_29*(tmp_29*(tmp_29*tmp_29)*(tmp_29*tmp_29))*(tmp_29*(tmp_29*tmp_29)*(tmp_29*tmp_29)))*(tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))+((tmp_25*((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(tmp_25*((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25))))+(((tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29))*((tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29)))*((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))-(tmp_17*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*(tmp_25*tmp_25*tmp_25)+((tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))+(tmp_29*(tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29))*(tmp_32*(tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32))*(tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32)))+((((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))*(tmp_25*tmp_25)-(tmp_17*tmp_17*tmp_17)*(tmp_25*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))+((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))+(tmp_29*(tmp_29*tmp_29)*(tmp_29*tmp_29))*(tmp_32*((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32)))+((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))+(tmp_29*((tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29))*((tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29)))*(tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32))+((tmp_29*(tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29))*(tmp_29*(tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29)))*((tmp_32*tmp_32)*(tmp_32*tmp_32))+((tmp_32*((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32)))*(tmp_32*((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32))))-tmp_17*(tmp_25*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25))))+(tmp_29*(((tmp_29*tmp_29)*(tmp_29*tmp_29))*((tmp_29*tmp_29)*(tmp_29*tmp_29)))*(((tmp_29*tmp_29)*(tmp_29*tmp_29))*((tmp_29*tmp_29)*(tmp_29*tmp_29))))*tmp_32+(tmp_17*tmp_17)*((((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25))))-(tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_25*((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))-(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_25*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25)))+((tmp_29*((tmp_29*tmp_29)*(tmp_29*tmp_29))*((tmp_29*tmp_29)*(tmp_29*tmp_29)))*(tmp_29*((tmp_29*tmp_29)*(tmp_29*tmp_29))*((tmp_29*tmp_29)*(tmp_29*tmp_29))))+(tmp_29*tmp_29*tmp_29)*(tmp_32*(tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*(tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32)))+((((tmp_29*tmp_29)*(tmp_29*tmp_29))*((tmp_29*tmp_29)*(tmp_29*tmp_29)))*(((tmp_29*tmp_29)*(tmp_29*tmp_29))*((tmp_29*tmp_29)*(tmp_29*tmp_29))))*(tmp_32*tmp_32)+((tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29))*(((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32)))-(tmp_17*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))+(((tmp_29*tmp_29)*(tmp_29*tmp_29))*((tmp_29*tmp_29)*(tmp_29*tmp_29)))*((tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32))*(tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32)))+(((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))+(tmp_29*(tmp_29*(tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29))*(tmp_29*(tmp_29*tmp_29*tmp_29)*(tmp_29*tmp_29*tmp_29)))*(tmp_32*tmp_32*tmp_32)+((tmp_29*(tmp_29*tmp_29)*(tmp_29*tmp_29))*(tmp_29*(tmp_29*tmp_29)*(tmp_29*tmp_29)))*(((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32)))+(tmp_29*tmp_29)*((((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32)))*(((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32))))+(tmp_29*((tmp_29*tmp_29)*(tmp_29*tmp_29))*((tmp_29*tmp_29)*(tmp_29*tmp_29)))*(tmp_32*((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32)))-(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_25*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))+((tmp_29*tmp_29)*(tmp_29*tmp_29))*((tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*(tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32)))-(tmp_17*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))+((tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*((tmp_25*tmp_25)*(tmp_25*tmp_25))+tmp_29*(tmp_32*(((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32)))*(((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32))))+((tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))-(tmp_17*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))*tmp_25)*(tmp_11*tmp_29*tmp_3-tmp_5*tmp_25*tmp_3-tmp_11*tmp_32*tmp_3-tmp_17*tmp_5*tmp_3);
g(0,1) = g0_1;
}
{
double tmp_1 = x(6);
double tmp_2 = cos(tmp_1);
double tmp_3 = x(7);
double tmp_4 = (tmp_3*tmp_3)+1.0;
double tmp_5 = 1.0/(tmp_4);
double tmp_6 = x(1);
double tmp_7 = x(3);
double tmp_8 = -tmp_7;
double tmp_9 = tmp_6+tmp_8;
double tmp_10 = sin(tmp_1);
double tmp_11 = tmp_9*tmp_5*tmp_10;
double tmp_12 = x(2);
double tmp_13 = x(0);
double tmp_14 = -tmp_13;
double tmp_15 = tmp_12+tmp_14;
double tmp_16 = tmp_15*tmp_2*tmp_5;
double tmp_17 = tmp_11+tmp_16;
double tmp_18 = x(5);
double tmp_19 = -tmp_18;
double tmp_20 = tmp_6+tmp_19;
double tmp_21 = tmp_5*tmp_20*tmp_10;
double tmp_22 = x(4);
double tmp_23 = tmp_22+tmp_14;
double tmp_24 = tmp_2*tmp_5*tmp_23;
double tmp_25 = tmp_24+tmp_21;
double tmp_29 = tmp_5*tmp_23*tmp_10;
double tmp_30 = -tmp_2*tmp_5*tmp_20;
double tmp_31 = tmp_30+tmp_29;
double tmp_32 = tmp_9*tmp_2*tmp_5;
double tmp_33 = -tmp_15*tmp_5*tmp_10;
double tmp_34 = tmp_33+tmp_32;
double g0_2 = -((tmp_31*tmp_31*tmp_31)*(tmp_34*(tmp_34*(tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34))*(tmp_34*(tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34)))-((((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31))))*(tmp_34*tmp_34)-((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(((tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34))*((tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34)))-(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_25*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25)))-(tmp_17*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))-((tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34)))+(tmp_31*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*(tmp_34*tmp_34*tmp_34)-(((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))-(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*((tmp_34*(tmp_34*tmp_34)*(tmp_34*tmp_34))*(tmp_34*(tmp_34*tmp_34)*(tmp_34*tmp_34)))+(tmp_31*((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(tmp_34*((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34)))-(tmp_31*tmp_31)*((((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34)))*(((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34))))-((tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))+tmp_31*(tmp_34*(((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34)))*(((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34))))-(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_25*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))-(tmp_17*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))-((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_34*(tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34))*(tmp_34*(tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34)))-((tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*((tmp_25*tmp_25)*(tmp_25*tmp_25))-(tmp_17*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))*tmp_25-(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*((tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25)))-((tmp_34*((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34)))*(tmp_34*((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34))))+(tmp_31*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31)))*(tmp_34*(tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34))-((tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))-(tmp_17*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*(tmp_25*tmp_25*tmp_25)-(((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*((tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34))-((tmp_31*((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(tmp_31*((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31))))-(tmp_17*tmp_17*tmp_17)*(tmp_25*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))-((((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))*(tmp_25*tmp_25)-((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))+(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_34*(tmp_34*(tmp_34*tmp_34)*(tmp_34*tmp_34))*(tmp_34*(tmp_34*tmp_34)*(tmp_34*tmp_34)))-((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))-((tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*((tmp_34*tmp_34)*(tmp_34*tmp_34))+(tmp_31*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31))))*tmp_34-tmp_17*(tmp_25*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25))))+(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_34*((tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34))*((tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34)))-((tmp_25*((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(tmp_25*((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25))))+(tmp_31*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*(tmp_34*(tmp_34*tmp_34)*(tmp_34*tmp_34))-(tmp_17*tmp_17)*((((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25))))-(tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_25*((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25))))*(tmp_2*tmp_5*tmp_31-tmp_5*tmp_10*tmp_25)+(3.0*tmp_5*tmp_10*(tmp_31*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*(tmp_34*tmp_34)+tmp_5*tmp_10*(tmp_31*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31))))+14.0*tmp_2*tmp_5*(tmp_17*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*((tmp_25*tmp_25)*(tmp_25*tmp_25))+11.0*tmp_5*tmp_10*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*((tmp_34*(tmp_34*tmp_34)*(tmp_34*tmp_34))*(tmp_34*(tmp_34*tmp_34)*(tmp_34*tmp_34)))-18.0*tmp_5*tmp_10*(tmp_34*(((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34)))*(((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34))))+5.0*tmp_2*tmp_5*((tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_25*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))+9.0*tmp_5*tmp_10*(tmp_31*((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34)))-4.0*tmp_5*tmp_10*((tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*(tmp_34*tmp_34*tmp_34)+7.0*tmp_2*tmp_5*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_25*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25)))+tmp_2*tmp_5*(tmp_25*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25))))+12.0*tmp_2*tmp_5*(tmp_17*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))+4.0*tmp_2*tmp_5*(tmp_17*tmp_17*tmp_17)*((tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))-16.0*tmp_5*tmp_10*(tmp_31*tmp_31)*(tmp_34*(tmp_34*(tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34))*(tmp_34*(tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34)))+13.0*tmp_5*tmp_10*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(((tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34))*((tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34)))+11.0*tmp_2*tmp_5*((tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))+13.0*tmp_2*tmp_5*(((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))+2.0*tmp_2*tmp_5*tmp_17*((((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25))))+9.0*tmp_2*tmp_5*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_25*((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))-2.0*tmp_5*tmp_10*((((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31))))*tmp_34+7.0*tmp_5*tmp_10*(tmp_31*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31)))*((tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34))+15.0*tmp_5*tmp_10*(tmp_31*tmp_31*tmp_31)*((tmp_34*(tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34))*(tmp_34*(tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34)))-12.0*tmp_5*tmp_10*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_34*(tmp_34*(tmp_34*tmp_34)*(tmp_34*tmp_34))*(tmp_34*(tmp_34*tmp_34)*(tmp_34*tmp_34)))+3.0*tmp_2*tmp_5*(tmp_17*tmp_17)*(tmp_25*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))-6.0*tmp_5*tmp_10*(((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*(tmp_34*(tmp_34*tmp_34)*(tmp_34*tmp_34))+6.0*tmp_2*tmp_5*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))-8.0*tmp_5*tmp_10*((tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31)))*(tmp_34*(tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34))+17.0*tmp_5*tmp_10*tmp_31*((((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34)))*(((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34))))+17.0*tmp_2*tmp_5*((((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))*tmp_25-10.0*tmp_5*tmp_10*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(tmp_34*((tmp_34*tmp_34)*(tmp_34*tmp_34))*((tmp_34*tmp_34)*(tmp_34*tmp_34)))+16.0*tmp_2*tmp_5*(tmp_17*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*(tmp_25*tmp_25)+5.0*tmp_5*tmp_10*(tmp_31*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*((tmp_34*tmp_34)*(tmp_34*tmp_34))+18.0*tmp_2*tmp_5*(tmp_17*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))+8.0*tmp_2*tmp_5*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25)))-14.0*tmp_5*tmp_10*((tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_34*((tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34))*((tmp_34*tmp_34*tmp_34)*(tmp_34*tmp_34*tmp_34)))+10.0*tmp_2*tmp_5*(tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))+15.0*tmp_2*tmp_5*((tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*(tmp_25*tmp_25*tmp_25))*(tmp_25*tmp_34+tmp_17*tmp_31);
g(0,2) = g0_2;
}
{
double tmp_1 = x(6);
double tmp_2 = cos(tmp_1);
double tmp_3 = x(7);
double tmp_4 = (tmp_3*tmp_3)+1.0;
double tmp_5 = 1.0/(tmp_4);
double tmp_6 = x(1);
double tmp_7 = x(5);
double tmp_8 = -tmp_7;
double tmp_9 = tmp_6+tmp_8;
double tmp_10 = sin(tmp_1);
double tmp_11 = tmp_10*tmp_9*tmp_5;
double tmp_12 = x(4);
double tmp_13 = x(0);
double tmp_14 = -tmp_13;
double tmp_15 = tmp_14+tmp_12;
double tmp_16 = tmp_2*tmp_5*tmp_15;
double tmp_17 = tmp_16+tmp_11;
double tmp_19 = tmp_10*tmp_5*tmp_15;
double tmp_20 = -tmp_2*tmp_9*tmp_5;
double tmp_21 = tmp_20+tmp_19;
double tmp_24 = x(3);
double tmp_25 = -tmp_24;
double tmp_26 = tmp_6+tmp_25;
double tmp_27 = tmp_26*tmp_2*tmp_5;
double tmp_28 = x(2);
double tmp_29 = tmp_14+tmp_28;
double tmp_30 = -tmp_10*tmp_29*tmp_5;
double tmp_31 = tmp_30+tmp_27;
double tmp_33 = tmp_26*tmp_10*tmp_5;
double tmp_34 = tmp_29*tmp_2*tmp_5;
double tmp_35 = tmp_33+tmp_34;
double g0_3 = -(tmp_17*tmp_31+tmp_35*tmp_21)*(2.0*tmp_2*tmp_31*tmp_5*((((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))*(((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21))))-13.0*tmp_2*(((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*tmp_5*(tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21))-7.0*tmp_2*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*tmp_5*(tmp_21*(tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21))*(tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21)))+15.0*(tmp_17*tmp_17*tmp_17)*tmp_10*((tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*(tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35)))*tmp_5-15.0*tmp_2*((tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*tmp_5*(tmp_21*tmp_21*tmp_21)-tmp_2*tmp_5*(tmp_21*(((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))*(((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21))))+12.0*tmp_2*(tmp_31*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31)))*tmp_5*((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))+16.0*tmp_2*(tmp_31*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*tmp_5*(tmp_21*tmp_21)+10.0*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*tmp_10*(tmp_35*((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*tmp_5+13.0*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*tmp_10*(((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35)))*tmp_5+9.0*(tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*tmp_10*(((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*tmp_5-11.0*tmp_2*((tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31)))*tmp_5*(tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))-17.0*tmp_2*((((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31))))*tmp_5*tmp_21+5.0*(tmp_17*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*tmp_10*((tmp_35*tmp_35)*(tmp_35*tmp_35))*tmp_5+16.0*(tmp_17*tmp_17)*tmp_10*(tmp_35*(tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*(tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35)))*tmp_5+18.0*tmp_2*(tmp_31*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31))))*tmp_5+8.0*((tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))*tmp_10*(tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*tmp_5+2.0*((((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))*tmp_10*tmp_35*tmp_5+6.0*tmp_2*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*tmp_5*(((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)))-9.0*tmp_2*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*tmp_5*(tmp_21*((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))+11.0*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*tmp_10*((tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35))*(tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35)))*tmp_5+4.0*((tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*tmp_10*(tmp_35*tmp_35*tmp_35)*tmp_5-5.0*tmp_2*((tmp_31*tmp_31)*(tmp_31*tmp_31))*tmp_5*(tmp_21*((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)))+3.0*(tmp_17*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*tmp_10*(tmp_35*tmp_35)*tmp_5+7.0*(tmp_17*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))*tmp_10*((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*tmp_5+6.0*(((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*tmp_10*(tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35))*tmp_5+12.0*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*tmp_10*(tmp_35*(tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35))*(tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35)))*tmp_5+14.0*((tmp_17*tmp_17)*(tmp_17*tmp_17))*tmp_10*(tmp_35*((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35)))*tmp_5+8.0*tmp_2*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*tmp_5*((tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21))*(tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21)))+17.0*tmp_17*tmp_10*((((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*(((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35))))*tmp_5+14.0*tmp_2*(tmp_31*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*tmp_5*((tmp_21*tmp_21)*(tmp_21*tmp_21))-3.0*tmp_2*(tmp_31*tmp_31)*tmp_5*(tmp_21*(tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*(tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)))+4.0*tmp_2*(tmp_31*tmp_31*tmp_31)*tmp_5*((tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*(tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)))+10.0*tmp_2*(tmp_31*((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*tmp_5*(((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))+(tmp_17*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))*tmp_10*tmp_5+18.0*tmp_10*(tmp_35*(((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*(((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35))))*tmp_5)-(tmp_10*tmp_5*tmp_21+tmp_17*tmp_2*tmp_5)*(((tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*((tmp_35*tmp_35)*(tmp_35*tmp_35))-tmp_31*(tmp_21*(((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))*(((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21))))+(tmp_17*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))*tmp_35+(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_35*((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35)))+((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*(tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)))+(tmp_17*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*(tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35))-(tmp_31*((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(tmp_21*((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))+((tmp_31*((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(tmp_31*((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31))))+(tmp_31*tmp_31)*((((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))*(((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21))))-(tmp_31*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*(tmp_21*tmp_21*tmp_21)+((tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))+(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*((tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21))*(tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21)))+(tmp_17*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))+((tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))+(((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))+((((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31))))*(tmp_21*tmp_21)-(tmp_31*tmp_31*tmp_31)*(tmp_21*(tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*(tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)))+((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)))+(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_35*(tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35))*(tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35)))+(tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_35*((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))+(tmp_17*tmp_17)*((((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*(((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35))))+((tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*((tmp_21*tmp_21)*(tmp_21*tmp_21))+((tmp_35*((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*(tmp_35*((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35))))+tmp_17*(tmp_35*(((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*(((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35))))-(tmp_31*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31))))*tmp_21-(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_21*((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)))+((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*(tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35)))-(tmp_31*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*(tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21))+((tmp_21*((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))*(tmp_21*((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21))))+((((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))*(tmp_35*tmp_35)+(tmp_17*tmp_17*tmp_17)*(tmp_35*(tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*(tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35)))+((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35)))-(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_21*(tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21))*(tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21)))+(tmp_17*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*(tmp_35*tmp_35*tmp_35)+((tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))+(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*((tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35))*(tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35)))-(tmp_31*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31)))*(tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))+(((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)));
g(0,3) = g0_3;
}
{
double tmp_1 = x(7);
double tmp_2 = (tmp_1*tmp_1)+1.0;
double tmp_3 = 1.0/(tmp_2);
double tmp_4 = x(1);
double tmp_5 = x(3);
double tmp_6 = -tmp_5;
double tmp_7 = tmp_6+tmp_4;
double tmp_8 = x(6);
double tmp_9 = sin(tmp_8);
double tmp_10 = tmp_3*tmp_9*tmp_7;
double tmp_11 = cos(tmp_8);
double tmp_12 = x(2);
double tmp_13 = x(0);
double tmp_14 = -tmp_13;
double tmp_15 = tmp_12+tmp_14;
double tmp_16 = tmp_3*tmp_15*tmp_11;
double tmp_17 = tmp_10+tmp_16;
double tmp_19 = tmp_3*tmp_11*tmp_7;
double tmp_20 = -tmp_3*tmp_9*tmp_15;
double tmp_21 = tmp_20+tmp_19;
double tmp_24 = x(4);
double tmp_25 = tmp_14+tmp_24;
double tmp_26 = tmp_3*tmp_9*tmp_25;
double tmp_27 = x(5);
double tmp_28 = -tmp_27;
double tmp_29 = tmp_28+tmp_4;
double tmp_30 = -tmp_3*tmp_29*tmp_11;
double tmp_31 = tmp_30+tmp_26;
double tmp_33 = tmp_3*tmp_29*tmp_9;
double tmp_34 = tmp_3*tmp_25*tmp_11;
double tmp_35 = tmp_34+tmp_33;
double g0_4 = -((tmp_21*(tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21))*(tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21)))*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))-(((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)))*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))-((tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*(tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35)))*((tmp_17*tmp_17)*(tmp_17*tmp_17))-(tmp_35*(((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*(((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35))))*tmp_17+(tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*(tmp_31*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31)))-((tmp_35*((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*(tmp_35*((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35))))-(tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35))*(tmp_17*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))-(tmp_35*((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35)))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))+(tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21))*(tmp_31*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))+(tmp_21*((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)))*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))-((tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*(tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)))*((tmp_31*tmp_31)*(tmp_31*tmp_31))+(tmp_21*(((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))*(((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21))))*tmp_31-((tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))-(tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*(tmp_17*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))-(tmp_35*(tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35))*(tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35)))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))-(((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35)))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))-tmp_35*(tmp_17*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))-((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))+(tmp_21*tmp_21*tmp_21)*(tmp_31*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))-((((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))*(((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21))))*(tmp_31*tmp_31)-((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*(((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))-(((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))*((tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31)))-(tmp_35*((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*(tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))+(tmp_21*(tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*(tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)))*(tmp_31*tmp_31*tmp_31)-(tmp_35*tmp_35)*((((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))-((tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21))*(tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21)))*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))-((tmp_21*((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))*(tmp_21*((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21))))-((tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35))*(tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))-(tmp_21*tmp_21)*((((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31))))-(tmp_35*(tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*(tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35)))*(tmp_17*tmp_17*tmp_17)-((tmp_31*((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(tmp_31*((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31))))-(((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*((tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))+(tmp_21*((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))*(tmp_31*((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))-(tmp_35*tmp_35*tmp_35)*(tmp_17*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))-((((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*(((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35))))*(tmp_17*tmp_17)-((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))-((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*(((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))+tmp_21*(tmp_31*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))))*(tmp_3*tmp_9*tmp_17+tmp_3*tmp_21*tmp_11)+(4.0*tmp_3*tmp_9*((tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*(tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)))*(tmp_31*tmp_31*tmp_31)-9.0*tmp_3*tmp_9*(tmp_21*((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))+6.0*tmp_3*(tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35))*tmp_11*(((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))+9.0*tmp_3*(((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*tmp_11*(tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))-11.0*tmp_3*tmp_9*(tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*((tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31)))+18.0*tmp_3*(tmp_35*(((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*(((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35))))*tmp_11+tmp_3*tmp_11*(tmp_17*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))-tmp_3*tmp_9*(tmp_21*(((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))*(((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21))))+18.0*tmp_3*tmp_9*(tmp_31*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31))))+17.0*tmp_3*((((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*(((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35))))*tmp_11*tmp_17-3.0*tmp_3*tmp_9*(tmp_21*(tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*(tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)))*(tmp_31*tmp_31)+11.0*tmp_3*((tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35))*(tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35)))*tmp_11*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))+12.0*tmp_3*(tmp_35*(tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35))*(tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35)))*tmp_11*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))+16.0*tmp_3*(tmp_35*(tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*(tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35)))*tmp_11*(tmp_17*tmp_17)+15.0*tmp_3*((tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*(tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35)))*tmp_11*(tmp_17*tmp_17*tmp_17)+2.0*tmp_3*tmp_9*((((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))*(((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21))))*tmp_31+7.0*tmp_3*((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*tmp_11*(tmp_17*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))-13.0*tmp_3*tmp_9*(tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21))*(((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))+13.0*tmp_3*(((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35)))*tmp_11*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))+16.0*tmp_3*tmp_9*(tmp_21*tmp_21)*(tmp_31*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))+2.0*tmp_3*tmp_35*tmp_11*((((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))+10.0*tmp_3*tmp_9*(((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))*(tmp_31*((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))-17.0*tmp_3*tmp_9*tmp_21*((((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31))))+10.0*tmp_3*(tmp_35*((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*tmp_11*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))+6.0*tmp_3*tmp_9*(((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)))*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))+4.0*tmp_3*(tmp_35*tmp_35*tmp_35)*tmp_11*((tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))+8.0*tmp_3*tmp_9*((tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21))*(tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21)))*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))+3.0*tmp_3*(tmp_35*tmp_35)*tmp_11*(tmp_17*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))+14.0*tmp_3*(tmp_35*((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35)))*tmp_11*((tmp_17*tmp_17)*(tmp_17*tmp_17))-15.0*tmp_3*tmp_9*(tmp_21*tmp_21*tmp_21)*((tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))+8.0*tmp_3*(tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*tmp_11*((tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))-7.0*tmp_3*tmp_9*(tmp_21*(tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21))*(tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21)))*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))+12.0*tmp_3*tmp_9*((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*(tmp_31*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31)))+14.0*tmp_3*tmp_9*((tmp_21*tmp_21)*(tmp_21*tmp_21))*(tmp_31*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))+5.0*tmp_3*((tmp_35*tmp_35)*(tmp_35*tmp_35))*tmp_11*(tmp_17*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))-5.0*tmp_3*tmp_9*(tmp_21*((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(tmp_35*tmp_21+tmp_31*tmp_17);
g(0,4) = g0_4;
}
{
double tmp_1 = x(7);
double tmp_2 = (tmp_1*tmp_1)+1.0;
double tmp_3 = 1.0/(tmp_2);
double tmp_4 = x(6);
double tmp_5 = cos(tmp_4);
double tmp_6 = x(1);
double tmp_7 = x(3);
double tmp_8 = -tmp_7;
double tmp_9 = tmp_8+tmp_6;
double tmp_10 = tmp_5*tmp_9*tmp_3;
double tmp_11 = x(2);
double tmp_12 = x(0);
double tmp_13 = -tmp_12;
double tmp_14 = tmp_13+tmp_11;
double tmp_15 = sin(tmp_4);
double tmp_16 = -tmp_14*tmp_15*tmp_3;
double tmp_17 = tmp_10+tmp_16;
double tmp_19 = tmp_9*tmp_15*tmp_3;
double tmp_20 = tmp_14*tmp_5*tmp_3;
double tmp_21 = tmp_20+tmp_19;
double tmp_24 = x(4);
double tmp_25 = tmp_13+tmp_24;
double tmp_26 = tmp_25*tmp_15*tmp_3;
double tmp_27 = x(5);
double tmp_28 = -tmp_27;
double tmp_29 = tmp_28+tmp_6;
double tmp_30 = -tmp_5*tmp_29*tmp_3;
double tmp_31 = tmp_30+tmp_26;
double tmp_33 = tmp_29*tmp_15*tmp_3;
double tmp_34 = tmp_5*tmp_25*tmp_3;
double tmp_35 = tmp_33+tmp_34;
double g0_5 = -(11.0*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*tmp_5*((tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31)))*tmp_3+4.0*(tmp_35*tmp_35*tmp_35)*tmp_15*((tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*(tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)))*tmp_3+9.0*(((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*tmp_15*(tmp_21*((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))*tmp_3+6.0*(tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35))*tmp_15*(((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)))*tmp_3+10.0*(tmp_35*((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*tmp_15*(((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))*tmp_3-2.0*((((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))*tmp_5*tmp_31*tmp_3-8.0*((tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))*tmp_5*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*tmp_3+18.0*(tmp_35*(((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*(((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35))))*tmp_15*tmp_3-16.0*(tmp_17*tmp_17)*tmp_5*(tmp_31*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*tmp_3+5.0*(tmp_17*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*tmp_5*((tmp_31*tmp_31)*(tmp_31*tmp_31))*tmp_3+tmp_15*(tmp_21*(((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))*(((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21))))*tmp_3+9.0*(tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*tmp_5*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*tmp_3-10.0*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*tmp_5*(tmp_31*((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*tmp_3+13.0*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*tmp_5*(((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*tmp_3+11.0*((tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35))*(tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35)))*tmp_15*(tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*tmp_3+17.0*((((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*(((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35))))*tmp_15*tmp_21*tmp_3+8.0*(tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*tmp_15*((tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21))*(tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21)))*tmp_3+15.0*(tmp_17*tmp_17*tmp_17)*tmp_5*((tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*tmp_3+14.0*(tmp_35*((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35)))*tmp_15*((tmp_21*tmp_21)*(tmp_21*tmp_21))*tmp_3+3.0*(tmp_35*tmp_35)*tmp_15*(tmp_21*(tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*(tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)))*tmp_3+13.0*(((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35)))*tmp_15*(tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21))*tmp_3+7.0*((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*tmp_15*(tmp_21*(tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21))*(tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21)))*tmp_3+15.0*((tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*(tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35)))*tmp_15*(tmp_21*tmp_21*tmp_21)*tmp_3-18.0*tmp_5*(tmp_31*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31))))*tmp_3+16.0*(tmp_35*(tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*(tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35)))*tmp_15*(tmp_21*tmp_21)*tmp_3+17.0*tmp_17*tmp_5*((((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31))))*tmp_3+12.0*(tmp_35*(tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35))*(tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35)))*tmp_15*((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*tmp_3-14.0*((tmp_17*tmp_17)*(tmp_17*tmp_17))*tmp_5*(tmp_31*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))*tmp_3-12.0*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*tmp_5*(tmp_31*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31)))*tmp_3+(tmp_17*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))*tmp_5*tmp_3-6.0*(((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*tmp_5*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*tmp_3+3.0*(tmp_17*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*tmp_5*(tmp_31*tmp_31)*tmp_3+2.0*tmp_35*tmp_15*((((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))*(((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21))))*tmp_3+7.0*(tmp_17*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))*tmp_5*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*tmp_3+5.0*((tmp_35*tmp_35)*(tmp_35*tmp_35))*tmp_15*(tmp_21*((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)))*tmp_3-4.0*((tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*tmp_5*(tmp_31*tmp_31*tmp_31)*tmp_3)*(tmp_17*tmp_35+tmp_31*tmp_21)+(tmp_5*tmp_21*tmp_3-tmp_17*tmp_15*tmp_3)*((tmp_35*tmp_35)*((((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))*(((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21))))+(tmp_17*tmp_17)*((((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31))))-(tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_31*((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))+(tmp_35*((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*(tmp_21*((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))+((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))+((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*(tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)))-tmp_17*(tmp_31*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31))))+((tmp_31*((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))*(tmp_31*((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31))))+tmp_35*(tmp_21*(((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))*(((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21))))+((((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))*(tmp_31*tmp_31)-(tmp_17*tmp_17*tmp_17)*(tmp_31*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))+((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*(((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)))+((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))+((tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))+((((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*(((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35))))*(tmp_21*tmp_21)+(tmp_35*tmp_35*tmp_35)*(tmp_21*(tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*(tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)))+(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*((tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31)))+(((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*((tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21))*(tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21)))+((tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35))*(tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35)))*(((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))+(tmp_35*(tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*(tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35)))*(tmp_21*tmp_21*tmp_21)-(tmp_17*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*(tmp_31*tmp_31*tmp_31)+((tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_31*tmp_31)*(tmp_31*tmp_31))*((tmp_31*tmp_31)*(tmp_31*tmp_31)))-(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_31*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31)))+(tmp_35*((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35)))*(tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21))+(tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35))*(tmp_21*((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))*((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21)))-(tmp_17*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))+((tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*((tmp_31*tmp_31)*(tmp_31*tmp_31))+(tmp_35*(((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*(((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35))))*tmp_21-(tmp_17*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))*tmp_31+((tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*(tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35)))*((tmp_21*tmp_21)*(tmp_21*tmp_21))+((tmp_35*((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35)))*(tmp_35*((tmp_35*tmp_35)*(tmp_35*tmp_35))*((tmp_35*tmp_35)*(tmp_35*tmp_35))))-(tmp_17*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))*(tmp_31*(tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))+((tmp_21*((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21)))*(tmp_21*((tmp_21*tmp_21)*(tmp_21*tmp_21))*((tmp_21*tmp_21)*(tmp_21*tmp_21))))+(((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*((tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35)))*((tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))+(((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))*((tmp_31*tmp_31*tmp_31)*(tmp_31*tmp_31*tmp_31))+(tmp_35*(tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35))*(tmp_35*(tmp_35*tmp_35)*(tmp_35*tmp_35)))*(tmp_21*(tmp_21*tmp_21*tmp_21)*(tmp_21*tmp_21*tmp_21))+(tmp_35*(tmp_35*tmp_35*tmp_35)*(tmp_35*tmp_35*tmp_35))*(tmp_21*(tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21))*(tmp_21*(tmp_21*tmp_21)*(tmp_21*tmp_21)))-(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_31*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))*(tmp_31*(tmp_31*tmp_31)*(tmp_31*tmp_31))));
g(0,5) = g0_5;
}
{
double tmp_1 = x(7);
double tmp_2 = (tmp_1*tmp_1)+1.0;
double tmp_3 = 1.0/(tmp_2);
double tmp_4 = x(1);
double tmp_5 = x(3);
double tmp_6 = -tmp_5;
double tmp_7 = tmp_4+tmp_6;
double tmp_8 = x(6);
double tmp_9 = sin(tmp_8);
double tmp_10 = tmp_7*tmp_3*tmp_9;
double tmp_11 = cos(tmp_8);
double tmp_12 = x(2);
double tmp_13 = x(0);
double tmp_14 = -tmp_13;
double tmp_15 = tmp_12+tmp_14;
double tmp_16 = tmp_3*tmp_15*tmp_11;
double tmp_17 = tmp_10+tmp_16;
double tmp_18 = x(4);
double tmp_19 = tmp_18+tmp_14;
double tmp_20 = tmp_19*tmp_3*tmp_9;
double tmp_21 = x(5);
double tmp_22 = -tmp_21;
double tmp_23 = tmp_4+tmp_22;
double tmp_24 = -tmp_3*tmp_11*tmp_23;
double tmp_25 = tmp_24+tmp_20;
double tmp_26 = tmp_7*tmp_3*tmp_11;
double tmp_27 = -tmp_3*tmp_9*tmp_15;
double tmp_28 = tmp_27+tmp_26;
double tmp_30 = tmp_3*tmp_9*tmp_23;
double tmp_31 = tmp_19*tmp_3*tmp_11;
double tmp_32 = tmp_31+tmp_30;
double g0_6 = (5.0*(tmp_32*((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32)))*tmp_28*((tmp_17*tmp_17)*(tmp_17*tmp_17))+16.0*(tmp_32*tmp_32)*tmp_28*(tmp_17*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))+(tmp_32*(((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32)))*(((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32))))*tmp_28+6.0*tmp_32*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))*(((tmp_28*tmp_28*tmp_28)*(tmp_28*tmp_28*tmp_28))*((tmp_28*tmp_28*tmp_28)*(tmp_28*tmp_28*tmp_28)))-17.0*tmp_32*((((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25))))*tmp_28+11.0*(tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*tmp_28*((tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))+15.0*(tmp_25*tmp_25*tmp_25)*((tmp_28*(tmp_28*tmp_28*tmp_28)*(tmp_28*tmp_28*tmp_28))*(tmp_28*(tmp_28*tmp_28*tmp_28)*(tmp_28*tmp_28*tmp_28)))*tmp_17+7.0*(tmp_25*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25)))*((tmp_28*tmp_28*tmp_28)*(tmp_28*tmp_28*tmp_28))*tmp_17-18.0*(tmp_28*(((tmp_28*tmp_28)*(tmp_28*tmp_28))*((tmp_28*tmp_28)*(tmp_28*tmp_28)))*(((tmp_28*tmp_28)*(tmp_28*tmp_28))*((tmp_28*tmp_28)*(tmp_28*tmp_28))))*tmp_17+15.0*(tmp_32*tmp_32*tmp_32)*tmp_28*((tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))-18.0*(tmp_32*(((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32)))*(((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32))))*tmp_25-12.0*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*(tmp_28*(tmp_28*(tmp_28*tmp_28)*(tmp_28*tmp_28))*(tmp_28*(tmp_28*tmp_28)*(tmp_28*tmp_28)))*tmp_17-3.0*tmp_32*(tmp_25*tmp_25)*(tmp_28*(tmp_28*(tmp_28*tmp_28*tmp_28)*(tmp_28*tmp_28*tmp_28))*(tmp_28*(tmp_28*tmp_28*tmp_28)*(tmp_28*tmp_28*tmp_28)))+9.0*(tmp_32*((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32)))*tmp_28*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))+3.0*(tmp_25*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))*(tmp_28*tmp_28)*tmp_17-5.0*((tmp_32*tmp_32)*(tmp_32*tmp_32))*tmp_25*(tmp_17*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))-4.0*((tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))*(tmp_28*tmp_28*tmp_28)*tmp_17-10.0*(tmp_32*((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32)))*tmp_25*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))+9.0*(tmp_25*((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(((tmp_28*tmp_28)*(tmp_28*tmp_28))*((tmp_28*tmp_28)*(tmp_28*tmp_28)))*tmp_17+8.0*tmp_32*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*((tmp_28*(tmp_28*tmp_28)*(tmp_28*tmp_28))*(tmp_28*(tmp_28*tmp_28)*(tmp_28*tmp_28)))-10.0*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(tmp_28*((tmp_28*tmp_28)*(tmp_28*tmp_28))*((tmp_28*tmp_28)*(tmp_28*tmp_28)))*tmp_17+14.0*((tmp_32*tmp_32)*(tmp_32*tmp_32))*tmp_28*(tmp_17*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))-4.0*(tmp_32*tmp_32*tmp_32)*tmp_25*((tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))+(tmp_25*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25))))*tmp_17+17.0*tmp_25*((((tmp_28*tmp_28)*(tmp_28*tmp_28))*((tmp_28*tmp_28)*(tmp_28*tmp_28)))*(((tmp_28*tmp_28)*(tmp_28*tmp_28))*((tmp_28*tmp_28)*(tmp_28*tmp_28))))*tmp_17+10.0*tmp_32*(tmp_25*((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(((tmp_28*tmp_28)*(tmp_28*tmp_28))*((tmp_28*tmp_28)*(tmp_28*tmp_28)))-15.0*tmp_32*((tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))*(tmp_28*tmp_28*tmp_28)-8.0*(tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*tmp_25*((tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))-6.0*(((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))*(tmp_28*(tmp_28*tmp_28)*(tmp_28*tmp_28))*tmp_17+16.0*tmp_32*(tmp_25*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))*(tmp_28*tmp_28)-8.0*((tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25)))*(tmp_28*(tmp_28*tmp_28*tmp_28)*(tmp_28*tmp_28*tmp_28))*tmp_17-3.0*(tmp_32*tmp_32)*tmp_25*(tmp_17*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))-14.0*(tmp_32*((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32)))*tmp_25*((tmp_17*tmp_17)*(tmp_17*tmp_17))+11.0*(tmp_25*(tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*((tmp_28*(tmp_28*tmp_28)*(tmp_28*tmp_28))*(tmp_28*(tmp_28*tmp_28)*(tmp_28*tmp_28)))*tmp_17-7.0*((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*tmp_25*(tmp_17*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17)))-16.0*(tmp_25*tmp_25)*(tmp_28*(tmp_28*(tmp_28*tmp_28*tmp_28)*(tmp_28*tmp_28*tmp_28))*(tmp_28*(tmp_28*tmp_28*tmp_28)*(tmp_28*tmp_28*tmp_28)))*tmp_17-13.0*(((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32)))*tmp_25*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))-12.0*(tmp_32*(tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32))*(tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32)))*tmp_25*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))-16.0*(tmp_32*(tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*(tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32)))*tmp_25*(tmp_17*tmp_17)+8.0*((tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32))*(tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32)))*tmp_28*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))-5.0*tmp_32*((tmp_25*tmp_25)*(tmp_25*tmp_25))*(tmp_28*((tmp_28*tmp_28*tmp_28)*(tmp_28*tmp_28*tmp_28))*((tmp_28*tmp_28*tmp_28)*(tmp_28*tmp_28*tmp_28)))+2.0*((((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32)))*(((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32))))*tmp_28*tmp_17+18.0*tmp_28*(tmp_17*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))-15.0*((tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*(tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32)))*tmp_25*(tmp_17*tmp_17*tmp_17)+18.0*tmp_32*(tmp_25*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25))))+5.0*(tmp_25*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))*((tmp_28*tmp_28)*(tmp_28*tmp_28))*tmp_17-tmp_32*(tmp_28*(((tmp_28*tmp_28)*(tmp_28*tmp_28))*((tmp_28*tmp_28)*(tmp_28*tmp_28)))*(((tmp_28*tmp_28)*(tmp_28*tmp_28))*((tmp_28*tmp_28)*(tmp_28*tmp_28))))+14.0*tmp_32*(tmp_25*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))*((tmp_28*tmp_28)*(tmp_28*tmp_28))-2.0*tmp_32*tmp_25*((((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))+10.0*(((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32)))*tmp_28*(tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))+13.0*(tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32))*tmp_28*(((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))-11.0*tmp_32*((tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25)))*(tmp_28*(tmp_28*tmp_28*tmp_28)*(tmp_28*tmp_28*tmp_28))-9.0*(((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32)))*tmp_25*(tmp_17*((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))-6.0*(tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32))*tmp_25*(((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17)))+17.0*tmp_32*tmp_28*((((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))-13.0*tmp_32*(((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25)))*(tmp_28*(tmp_28*tmp_28)*(tmp_28*tmp_28))-2.0*((((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25))))*tmp_28*tmp_17-9.0*tmp_32*(((tmp_25*tmp_25)*(tmp_25*tmp_25))*((tmp_25*tmp_25)*(tmp_25*tmp_25)))*(tmp_28*((tmp_28*tmp_28)*(tmp_28*tmp_28))*((tmp_28*tmp_28)*(tmp_28*tmp_28)))+2.0*tmp_32*tmp_25*((((tmp_28*tmp_28)*(tmp_28*tmp_28))*((tmp_28*tmp_28)*(tmp_28*tmp_28)))*(((tmp_28*tmp_28)*(tmp_28*tmp_28))*((tmp_28*tmp_28)*(tmp_28*tmp_28))))-14.0*((tmp_25*tmp_25)*(tmp_25*tmp_25))*(tmp_28*((tmp_28*tmp_28*tmp_28)*(tmp_28*tmp_28*tmp_28))*((tmp_28*tmp_28*tmp_28)*(tmp_28*tmp_28*tmp_28)))*tmp_17-7.0*tmp_32*((tmp_25*tmp_25*tmp_25)*(tmp_25*tmp_25*tmp_25))*(tmp_28*(tmp_28*(tmp_28*tmp_28)*(tmp_28*tmp_28))*(tmp_28*(tmp_28*tmp_28)*(tmp_28*tmp_28)))-tmp_25*(tmp_17*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17)))*(((tmp_17*tmp_17)*(tmp_17*tmp_17))*((tmp_17*tmp_17)*(tmp_17*tmp_17))))+4.0*((tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*(tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32)))*tmp_28*(tmp_17*tmp_17*tmp_17)+13.0*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))*(((tmp_28*tmp_28*tmp_28)*(tmp_28*tmp_28*tmp_28))*((tmp_28*tmp_28*tmp_28)*(tmp_28*tmp_28*tmp_28)))*tmp_17+3.0*(tmp_32*(tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*(tmp_32*(tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32)))*tmp_28*(tmp_17*tmp_17)+7.0*(tmp_32*(tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32))*(tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32)))*tmp_28*((tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))+4.0*tmp_32*(tmp_25*tmp_25*tmp_25)*((tmp_28*(tmp_28*tmp_28*tmp_28)*(tmp_28*tmp_28*tmp_28))*(tmp_28*(tmp_28*tmp_28*tmp_28)*(tmp_28*tmp_28*tmp_28)))-17.0*((((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32)))*(((tmp_32*tmp_32)*(tmp_32*tmp_32))*((tmp_32*tmp_32)*(tmp_32*tmp_32))))*tmp_25*tmp_17+12.0*tmp_32*(tmp_25*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25))*(tmp_25*(tmp_25*tmp_25)*(tmp_25*tmp_25)))*((tmp_28*tmp_28*tmp_28)*(tmp_28*tmp_28*tmp_28))-11.0*((tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32))*(tmp_32*(tmp_32*tmp_32)*(tmp_32*tmp_32)))*tmp_25*(tmp_17*(tmp_17*tmp_17*tmp_17)*(tmp_17*tmp_17*tmp_17))+6.0*(((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32)))*tmp_28*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))+12.0*((tmp_32*tmp_32*tmp_32)*(tmp_32*tmp_32*tmp_32))*tmp_28*(tmp_17*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))*(tmp_17*(tmp_17*tmp_17)*(tmp_17*tmp_17))))*(tmp_32*tmp_28+tmp_25*tmp_17);
g(0,6) = g0_6;
}
{
double tmp_1 = x(7);
double tmp_2 = (tmp_1*tmp_1)+1.0;
double tmp_3 = 1.0/(tmp_2);
double tmp_4 = (tmp_3*tmp_3);
double tmp_5 = x(1);
double tmp_6 = x(3);
double tmp_7 = -tmp_6;
double tmp_8 = tmp_5+tmp_7;
double tmp_9 = x(6);
double tmp_10 = sin(tmp_9);
double tmp_11 = tmp_8*tmp_1*tmp_4*tmp_10;
double tmp_12 = cos(tmp_9);
double tmp_13 = x(2);
double tmp_14 = x(0);
double tmp_15 = -tmp_14;
double tmp_16 = tmp_13+tmp_15;
double tmp_17 = tmp_16*tmp_12*tmp_1*tmp_4;
double tmp_18 = tmp_11+tmp_17;
double tmp_19 = x(4);
double tmp_20 = tmp_19+tmp_15;
double tmp_21 = tmp_3*tmp_10*tmp_20;
double tmp_22 = x(5);
double tmp_23 = -tmp_22;
double tmp_24 = tmp_23+tmp_5;
double tmp_25 = -tmp_3*tmp_12*tmp_24;
double tmp_26 = tmp_25+tmp_21;
double tmp_28 = tmp_24*tmp_1*tmp_4*tmp_10;
double tmp_29 = tmp_12*tmp_1*tmp_4*tmp_20;
double tmp_30 = tmp_29+tmp_28;
double tmp_31 = tmp_3*tmp_12*tmp_8;
double tmp_32 = -tmp_3*tmp_16*tmp_10;
double tmp_33 = tmp_32+tmp_31;
double tmp_35 = tmp_12*tmp_8*tmp_1*tmp_4;
double tmp_36 = -tmp_16*tmp_1*tmp_4*tmp_10;
double tmp_37 = tmp_35+tmp_36;
double tmp_38 = tmp_3*tmp_24*tmp_10;
double tmp_39 = tmp_3*tmp_12*tmp_20;
double tmp_40 = tmp_38+tmp_39;
double tmp_42 = tmp_3*tmp_8*tmp_10;
double tmp_43 = tmp_3*tmp_16*tmp_12;
double tmp_44 = tmp_42+tmp_43;
double tmp_45 = tmp_12*tmp_24*tmp_1*tmp_4;
double tmp_46 = -tmp_1*tmp_4*tmp_10*tmp_20;
double tmp_47 = tmp_46+tmp_45;
double g0_7 = 2.0*(tmp_30*tmp_33-tmp_44*tmp_47+tmp_37*tmp_40+tmp_26*tmp_18)*((tmp_26*(tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26))*(tmp_33*(tmp_33*(tmp_33*tmp_33)*(tmp_33*tmp_33))*(tmp_33*(tmp_33*tmp_33)*(tmp_33*tmp_33)))-((tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44))*(((tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40))*((tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40)))-(tmp_44*tmp_44*tmp_44)*(tmp_40*(tmp_40*(tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40))*(tmp_40*(tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40)))-((((tmp_44*tmp_44)*(tmp_44*tmp_44))*((tmp_44*tmp_44)*(tmp_44*tmp_44)))*(((tmp_44*tmp_44)*(tmp_44*tmp_44))*((tmp_44*tmp_44)*(tmp_44*tmp_44))))*(tmp_40*tmp_40)-(((tmp_44*tmp_44)*(tmp_44*tmp_44))*((tmp_44*tmp_44)*(tmp_44*tmp_44)))*((tmp_40*(tmp_40*tmp_40)*(tmp_40*tmp_40))*(tmp_40*(tmp_40*tmp_40)*(tmp_40*tmp_40)))-(((tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26))*((tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26)))*((tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33))-((tmp_44*(tmp_44*tmp_44)*(tmp_44*tmp_44))*(tmp_44*(tmp_44*tmp_44)*(tmp_44*tmp_44)))*(((tmp_40*tmp_40)*(tmp_40*tmp_40))*((tmp_40*tmp_40)*(tmp_40*tmp_40)))-(tmp_44*(tmp_44*(tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44))*(tmp_44*(tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44)))*(tmp_40*tmp_40*tmp_40)+(tmp_26*(tmp_26*(tmp_26*tmp_26)*(tmp_26*tmp_26))*(tmp_26*(tmp_26*tmp_26)*(tmp_26*tmp_26)))*(tmp_33*(tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33))-((tmp_40*((tmp_40*tmp_40)*(tmp_40*tmp_40))*((tmp_40*tmp_40)*(tmp_40*tmp_40)))*(tmp_40*((tmp_40*tmp_40)*(tmp_40*tmp_40))*((tmp_40*tmp_40)*(tmp_40*tmp_40))))-(tmp_44*tmp_44)*((((tmp_40*tmp_40)*(tmp_40*tmp_40))*((tmp_40*tmp_40)*(tmp_40*tmp_40)))*(((tmp_40*tmp_40)*(tmp_40*tmp_40))*((tmp_40*tmp_40)*(tmp_40*tmp_40))))-(tmp_44*((tmp_44*tmp_44)*(tmp_44*tmp_44))*((tmp_44*tmp_44)*(tmp_44*tmp_44)))*(tmp_40*((tmp_40*tmp_40)*(tmp_40*tmp_40))*((tmp_40*tmp_40)*(tmp_40*tmp_40)))-((tmp_26*((tmp_26*tmp_26)*(tmp_26*tmp_26))*((tmp_26*tmp_26)*(tmp_26*tmp_26)))*(tmp_26*((tmp_26*tmp_26)*(tmp_26*tmp_26))*((tmp_26*tmp_26)*(tmp_26*tmp_26))))+(tmp_26*(((tmp_26*tmp_26)*(tmp_26*tmp_26))*((tmp_26*tmp_26)*(tmp_26*tmp_26)))*(((tmp_26*tmp_26)*(tmp_26*tmp_26))*((tmp_26*tmp_26)*(tmp_26*tmp_26))))*tmp_33-((tmp_44*tmp_44)*(tmp_44*tmp_44))*((tmp_40*(tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40))*(tmp_40*(tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40)))-((tmp_26*(tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26))*(tmp_26*(tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26)))*((tmp_33*tmp_33)*(tmp_33*tmp_33))+(tmp_26*((tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26))*((tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26)))*(tmp_33*(tmp_33*tmp_33)*(tmp_33*tmp_33))+(tmp_26*(tmp_26*tmp_26)*(tmp_26*tmp_26))*(tmp_33*((tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33))*((tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33)))-tmp_44*(tmp_40*(((tmp_40*tmp_40)*(tmp_40*tmp_40))*((tmp_40*tmp_40)*(tmp_40*tmp_40)))*(((tmp_40*tmp_40)*(tmp_40*tmp_40))*((tmp_40*tmp_40)*(tmp_40*tmp_40))))-((tmp_44*((tmp_44*tmp_44)*(tmp_44*tmp_44))*((tmp_44*tmp_44)*(tmp_44*tmp_44)))*(tmp_44*((tmp_44*tmp_44)*(tmp_44*tmp_44))*((tmp_44*tmp_44)*(tmp_44*tmp_44))))+(tmp_26*(tmp_26*(tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26))*(tmp_26*(tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26)))*(tmp_33*tmp_33*tmp_33)-((tmp_26*(tmp_26*tmp_26)*(tmp_26*tmp_26))*(tmp_26*(tmp_26*tmp_26)*(tmp_26*tmp_26)))*(((tmp_33*tmp_33)*(tmp_33*tmp_33))*((tmp_33*tmp_33)*(tmp_33*tmp_33)))-(((tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44))*((tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44)))*((tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40))-(tmp_44*(tmp_44*(tmp_44*tmp_44)*(tmp_44*tmp_44))*(tmp_44*(tmp_44*tmp_44)*(tmp_44*tmp_44)))*(tmp_40*(tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40))-(((tmp_26*tmp_26)*(tmp_26*tmp_26))*((tmp_26*tmp_26)*(tmp_26*tmp_26)))*((tmp_33*(tmp_33*tmp_33)*(tmp_33*tmp_33))*(tmp_33*(tmp_33*tmp_33)*(tmp_33*tmp_33)))-(tmp_44*(tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44))*(tmp_40*(tmp_40*(tmp_40*tmp_40)*(tmp_40*tmp_40))*(tmp_40*(tmp_40*tmp_40)*(tmp_40*tmp_40)))-((tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26))*(((tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33))*((tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33)))+(tmp_26*tmp_26*tmp_26)*(tmp_33*(tmp_33*(tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33))*(tmp_33*(tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33)))-((((tmp_26*tmp_26)*(tmp_26*tmp_26))*((tmp_26*tmp_26)*(tmp_26*tmp_26)))*(((tmp_26*tmp_26)*(tmp_26*tmp_26))*((tmp_26*tmp_26)*(tmp_26*tmp_26))))*(tmp_33*tmp_33)-(tmp_44*((tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44))*((tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44)))*(tmp_40*(tmp_40*tmp_40)*(tmp_40*tmp_40))-(tmp_44*(tmp_44*tmp_44)*(tmp_44*tmp_44))*(tmp_40*((tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40))*((tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40)))+tmp_26*(tmp_33*(((tmp_33*tmp_33)*(tmp_33*tmp_33))*((tmp_33*tmp_33)*(tmp_33*tmp_33)))*(((tmp_33*tmp_33)*(tmp_33*tmp_33))*((tmp_33*tmp_33)*(tmp_33*tmp_33))))-((tmp_33*((tmp_33*tmp_33)*(tmp_33*tmp_33))*((tmp_33*tmp_33)*(tmp_33*tmp_33)))*(tmp_33*((tmp_33*tmp_33)*(tmp_33*tmp_33))*((tmp_33*tmp_33)*(tmp_33*tmp_33))))-(tmp_44*(((tmp_44*tmp_44)*(tmp_44*tmp_44))*((tmp_44*tmp_44)*(tmp_44*tmp_44)))*(((tmp_44*tmp_44)*(tmp_44*tmp_44))*((tmp_44*tmp_44)*(tmp_44*tmp_44))))*tmp_40-((tmp_44*(tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44))*(tmp_44*(tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44)))*((tmp_40*tmp_40)*(tmp_40*tmp_40))-((tmp_26*tmp_26)*(tmp_26*tmp_26))*((tmp_33*(tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33))*(tmp_33*(tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33)))+(tmp_26*((tmp_26*tmp_26)*(tmp_26*tmp_26))*((tmp_26*tmp_26)*(tmp_26*tmp_26)))*(tmp_33*((tmp_33*tmp_33)*(tmp_33*tmp_33))*((tmp_33*tmp_33)*(tmp_33*tmp_33)))-(tmp_26*tmp_26)*((((tmp_33*tmp_33)*(tmp_33*tmp_33))*((tmp_33*tmp_33)*(tmp_33*tmp_33)))*(((tmp_33*tmp_33)*(tmp_33*tmp_33))*((tmp_33*tmp_33)*(tmp_33*tmp_33)))))-2.0*(tmp_44*tmp_26+tmp_40*tmp_33)*((tmp_44*(((tmp_44*tmp_44)*(tmp_44*tmp_44))*((tmp_44*tmp_44)*(tmp_44*tmp_44)))*(((tmp_44*tmp_44)*(tmp_44*tmp_44))*((tmp_44*tmp_44)*(tmp_44*tmp_44))))*tmp_30+8.0*((tmp_26*(tmp_26*tmp_26)*(tmp_26*tmp_26))*(tmp_26*(tmp_26*tmp_26)*(tmp_26*tmp_26)))*tmp_37*(tmp_33*(tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33))+2.0*tmp_44*tmp_18*((((tmp_40*tmp_40)*(tmp_40*tmp_40))*((tmp_40*tmp_40)*(tmp_40*tmp_40)))*(((tmp_40*tmp_40)*(tmp_40*tmp_40))*((tmp_40*tmp_40)*(tmp_40*tmp_40))))+2.0*((((tmp_26*tmp_26)*(tmp_26*tmp_26))*((tmp_26*tmp_26)*(tmp_26*tmp_26)))*(((tmp_26*tmp_26)*(tmp_26*tmp_26))*((tmp_26*tmp_26)*(tmp_26*tmp_26))))*tmp_37*tmp_33+5.0*(tmp_44*((tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44))*((tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44)))*((tmp_40*tmp_40)*(tmp_40*tmp_40))*tmp_30+tmp_18*(tmp_40*(((tmp_40*tmp_40)*(tmp_40*tmp_40))*((tmp_40*tmp_40)*(tmp_40*tmp_40)))*(((tmp_40*tmp_40)*(tmp_40*tmp_40))*((tmp_40*tmp_40)*(tmp_40*tmp_40))))+9.0*(((tmp_26*tmp_26)*(tmp_26*tmp_26))*((tmp_26*tmp_26)*(tmp_26*tmp_26)))*tmp_47*(tmp_33*((tmp_33*tmp_33)*(tmp_33*tmp_33))*((tmp_33*tmp_33)*(tmp_33*tmp_33)))-6.0*(tmp_26*(tmp_26*tmp_26)*(tmp_26*tmp_26))*tmp_47*(((tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33))*((tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33)))+12.0*(tmp_44*(tmp_44*(tmp_44*tmp_44)*(tmp_44*tmp_44))*(tmp_44*(tmp_44*tmp_44)*(tmp_44*tmp_44)))*tmp_18*((tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40))+16.0*(tmp_44*(tmp_44*(tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44))*(tmp_44*(tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44)))*tmp_18*(tmp_40*tmp_40)-13.0*(tmp_26*(tmp_26*tmp_26)*(tmp_26*tmp_26))*tmp_37*(((tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33))*((tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33)))+10.0*(((tmp_26*tmp_26)*(tmp_26*tmp_26))*((tmp_26*tmp_26)*(tmp_26*tmp_26)))*tmp_37*(tmp_33*((tmp_33*tmp_33)*(tmp_33*tmp_33))*((tmp_33*tmp_33)*(tmp_33*tmp_33)))+15.0*((tmp_44*(tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44))*(tmp_44*(tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44)))*tmp_18*(tmp_40*tmp_40*tmp_40)+11.0*((tmp_26*(tmp_26*tmp_26)*(tmp_26*tmp_26))*(tmp_26*(tmp_26*tmp_26)*(tmp_26*tmp_26)))*tmp_47*(tmp_33*(tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33))+17.0*((((tmp_26*tmp_26)*(tmp_26*tmp_26))*((tmp_26*tmp_26)*(tmp_26*tmp_26)))*(((tmp_26*tmp_26)*(tmp_26*tmp_26))*((tmp_26*tmp_26)*(tmp_26*tmp_26))))*tmp_47*tmp_33+7.0*((tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44))*tmp_18*(tmp_40*(tmp_40*(tmp_40*tmp_40)*(tmp_40*tmp_40))*(tmp_40*(tmp_40*tmp_40)*(tmp_40*tmp_40)))+16.0*(tmp_44*tmp_44)*(tmp_40*(tmp_40*(tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40))*(tmp_40*(tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40)))*tmp_30+13.0*(((tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44))*((tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44)))*tmp_18*(tmp_40*(tmp_40*tmp_40)*(tmp_40*tmp_40))+15.0*((tmp_26*(tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26))*(tmp_26*(tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26)))*tmp_47*(tmp_33*tmp_33*tmp_33)-16.0*(tmp_26*(tmp_26*(tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26))*(tmp_26*(tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26)))*tmp_47*(tmp_33*tmp_33)-12.0*(tmp_26*(tmp_26*(tmp_26*tmp_26)*(tmp_26*tmp_26))*(tmp_26*(tmp_26*tmp_26)*(tmp_26*tmp_26)))*tmp_47*((tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33))+13.0*(((tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26))*((tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26)))*tmp_47*(tmp_33*(tmp_33*tmp_33)*(tmp_33*tmp_33))+13.0*(tmp_44*(tmp_44*tmp_44)*(tmp_44*tmp_44))*(((tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40))*((tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40)))*tmp_30+11.0*((tmp_44*(tmp_44*tmp_44)*(tmp_44*tmp_44))*(tmp_44*(tmp_44*tmp_44)*(tmp_44*tmp_44)))*tmp_18*(tmp_40*(tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40))+17.0*((((tmp_44*tmp_44)*(tmp_44*tmp_44))*((tmp_44*tmp_44)*(tmp_44*tmp_44)))*(((tmp_44*tmp_44)*(tmp_44*tmp_44))*((tmp_44*tmp_44)*(tmp_44*tmp_44))))*tmp_18*tmp_40+7.0*((tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26))*tmp_47*(tmp_33*(tmp_33*(tmp_33*tmp_33)*(tmp_33*tmp_33))*(tmp_33*(tmp_33*tmp_33)*(tmp_33*tmp_33)))-17.0*tmp_26*tmp_37*((((tmp_33*tmp_33)*(tmp_33*tmp_33))*((tmp_33*tmp_33)*(tmp_33*tmp_33)))*(((tmp_33*tmp_33)*(tmp_33*tmp_33))*((tmp_33*tmp_33)*(tmp_33*tmp_33))))+14.0*((tmp_44*tmp_44)*(tmp_44*tmp_44))*(tmp_40*((tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40))*((tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40)))*tmp_30-2.0*tmp_26*tmp_47*((((tmp_33*tmp_33)*(tmp_33*tmp_33))*((tmp_33*tmp_33)*(tmp_33*tmp_33)))*(((tmp_33*tmp_33)*(tmp_33*tmp_33))*((tmp_33*tmp_33)*(tmp_33*tmp_33))))+12.0*((tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26))*tmp_37*(tmp_33*(tmp_33*(tmp_33*tmp_33)*(tmp_33*tmp_33))*(tmp_33*(tmp_33*tmp_33)*(tmp_33*tmp_33)))+2.0*((((tmp_44*tmp_44)*(tmp_44*tmp_44))*((tmp_44*tmp_44)*(tmp_44*tmp_44)))*(((tmp_44*tmp_44)*(tmp_44*tmp_44))*((tmp_44*tmp_44)*(tmp_44*tmp_44))))*tmp_40*tmp_30+6.0*(((tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26))*((tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26)))*tmp_37*(tmp_33*(tmp_33*tmp_33)*(tmp_33*tmp_33))+9.0*(((tmp_44*tmp_44)*(tmp_44*tmp_44))*((tmp_44*tmp_44)*(tmp_44*tmp_44)))*tmp_18*(tmp_40*((tmp_40*tmp_40)*(tmp_40*tmp_40))*((tmp_40*tmp_40)*(tmp_40*tmp_40)))+6.0*(tmp_44*(tmp_44*tmp_44)*(tmp_44*tmp_44))*tmp_18*(((tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40))*((tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40)))-3.0*(tmp_26*(tmp_26*(tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26))*(tmp_26*(tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26)))*tmp_37*(tmp_33*tmp_33)-7.0*(tmp_26*(tmp_26*(tmp_26*tmp_26)*(tmp_26*tmp_26))*(tmp_26*(tmp_26*tmp_26)*(tmp_26*tmp_26)))*tmp_37*((tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33))+4.0*((tmp_26*(tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26))*(tmp_26*(tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26)))*tmp_37*(tmp_33*tmp_33*tmp_33)+3.0*(tmp_44*(tmp_44*(tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44))*(tmp_44*(tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44)))*(tmp_40*tmp_40)*tmp_30+18.0*(tmp_40*(((tmp_40*tmp_40)*(tmp_40*tmp_40))*((tmp_40*tmp_40)*(tmp_40*tmp_40)))*(((tmp_40*tmp_40)*(tmp_40*tmp_40))*((tmp_40*tmp_40)*(tmp_40*tmp_40))))*tmp_30-11.0*(tmp_26*(tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26))*tmp_37*((tmp_33*(tmp_33*tmp_33)*(tmp_33*tmp_33))*(tmp_33*(tmp_33*tmp_33)*(tmp_33*tmp_33)))+12.0*((tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44))*(tmp_40*(tmp_40*(tmp_40*tmp_40)*(tmp_40*tmp_40))*(tmp_40*(tmp_40*tmp_40)*(tmp_40*tmp_40)))*tmp_30+5.0*((tmp_44*tmp_44)*(tmp_44*tmp_44))*tmp_18*(tmp_40*((tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40))*((tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40)))+16.0*(tmp_26*tmp_26)*tmp_37*(tmp_33*(tmp_33*(tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33))*(tmp_33*(tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33)))+7.0*(tmp_44*(tmp_44*(tmp_44*tmp_44)*(tmp_44*tmp_44))*(tmp_44*(tmp_44*tmp_44)*(tmp_44*tmp_44)))*((tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40))*tmp_30-4.0*(tmp_26*tmp_26*tmp_26)*tmp_47*((tmp_33*(tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33))*(tmp_33*(tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33)))-5.0*(tmp_26*((tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26))*((tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26)))*tmp_37*((tmp_33*tmp_33)*(tmp_33*tmp_33))-10.0*(tmp_26*((tmp_26*tmp_26)*(tmp_26*tmp_26))*((tmp_26*tmp_26)*(tmp_26*tmp_26)))*tmp_47*(((tmp_33*tmp_33)*(tmp_33*tmp_33))*((tmp_33*tmp_33)*(tmp_33*tmp_33)))+15.0*(tmp_44*tmp_44*tmp_44)*((tmp_40*(tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40))*(tmp_40*(tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40)))*tmp_30+18.0*(tmp_44*(((tmp_44*tmp_44)*(tmp_44*tmp_44))*((tmp_44*tmp_44)*(tmp_44*tmp_44)))*(((tmp_44*tmp_44)*(tmp_44*tmp_44))*((tmp_44*tmp_44)*(tmp_44*tmp_44))))*tmp_18-9.0*(tmp_26*((tmp_26*tmp_26)*(tmp_26*tmp_26))*((tmp_26*tmp_26)*(tmp_26*tmp_26)))*tmp_37*(((tmp_33*tmp_33)*(tmp_33*tmp_33))*((tmp_33*tmp_33)*(tmp_33*tmp_33)))-14.0*(tmp_26*((tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26))*((tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26)))*tmp_47*((tmp_33*tmp_33)*(tmp_33*tmp_33))+3.0*(tmp_26*tmp_26)*tmp_47*(tmp_33*(tmp_33*(tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33))*(tmp_33*(tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33)))-15.0*(tmp_26*tmp_26*tmp_26)*tmp_37*((tmp_33*(tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33))*(tmp_33*(tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33)))-8.0*(tmp_26*(tmp_26*tmp_26*tmp_26)*(tmp_26*tmp_26*tmp_26))*tmp_47*((tmp_33*(tmp_33*tmp_33)*(tmp_33*tmp_33))*(tmp_33*(tmp_33*tmp_33)*(tmp_33*tmp_33)))+18.0*tmp_37*(tmp_33*(((tmp_33*tmp_33)*(tmp_33*tmp_33))*((tmp_33*tmp_33)*(tmp_33*tmp_33)))*(((tmp_33*tmp_33)*(tmp_33*tmp_33))*((tmp_33*tmp_33)*(tmp_33*tmp_33))))+11.0*(tmp_44*(tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44))*((tmp_40*(tmp_40*tmp_40)*(tmp_40*tmp_40))*(tmp_40*(tmp_40*tmp_40)*(tmp_40*tmp_40)))*tmp_30+3.0*(tmp_44*tmp_44)*tmp_18*(tmp_40*(tmp_40*(tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40))*(tmp_40*(tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40)))+8.0*((tmp_44*(tmp_44*tmp_44)*(tmp_44*tmp_44))*(tmp_44*(tmp_44*tmp_44)*(tmp_44*tmp_44)))*(tmp_40*(tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40))*tmp_30+14.0*(tmp_44*((tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44))*((tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44)))*tmp_18*((tmp_40*tmp_40)*(tmp_40*tmp_40))+8.0*(tmp_44*(tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44))*tmp_18*((tmp_40*(tmp_40*tmp_40)*(tmp_40*tmp_40))*(tmp_40*(tmp_40*tmp_40)*(tmp_40*tmp_40)))+14.0*((tmp_26*tmp_26)*(tmp_26*tmp_26))*tmp_37*(tmp_33*((tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33))*((tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33)))+6.0*(((tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44))*((tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44)))*(tmp_40*(tmp_40*tmp_40)*(tmp_40*tmp_40))*tmp_30+5.0*((tmp_26*tmp_26)*(tmp_26*tmp_26))*tmp_47*(tmp_33*((tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33))*((tmp_33*tmp_33*tmp_33)*(tmp_33*tmp_33*tmp_33)))-18.0*(tmp_26*(((tmp_26*tmp_26)*(tmp_26*tmp_26))*((tmp_26*tmp_26)*(tmp_26*tmp_26)))*(((tmp_26*tmp_26)*(tmp_26*tmp_26))*((tmp_26*tmp_26)*(tmp_26*tmp_26))))*tmp_47+17.0*tmp_44*((((tmp_40*tmp_40)*(tmp_40*tmp_40))*((tmp_40*tmp_40)*(tmp_40*tmp_40)))*(((tmp_40*tmp_40)*(tmp_40*tmp_40))*((tmp_40*tmp_40)*(tmp_40*tmp_40))))*tmp_30+10.0*(tmp_44*((tmp_44*tmp_44)*(tmp_44*tmp_44))*((tmp_44*tmp_44)*(tmp_44*tmp_44)))*tmp_18*(((tmp_40*tmp_40)*(tmp_40*tmp_40))*((tmp_40*tmp_40)*(tmp_40*tmp_40)))-(tmp_26*(((tmp_26*tmp_26)*(tmp_26*tmp_26))*((tmp_26*tmp_26)*(tmp_26*tmp_26)))*(((tmp_26*tmp_26)*(tmp_26*tmp_26))*((tmp_26*tmp_26)*(tmp_26*tmp_26))))*tmp_37+10.0*(((tmp_44*tmp_44)*(tmp_44*tmp_44))*((tmp_44*tmp_44)*(tmp_44*tmp_44)))*(tmp_40*((tmp_40*tmp_40)*(tmp_40*tmp_40))*((tmp_40*tmp_40)*(tmp_40*tmp_40)))*tmp_30+9.0*(tmp_44*((tmp_44*tmp_44)*(tmp_44*tmp_44))*((tmp_44*tmp_44)*(tmp_44*tmp_44)))*(((tmp_40*tmp_40)*(tmp_40*tmp_40))*((tmp_40*tmp_40)*(tmp_40*tmp_40)))*tmp_30+4.0*(tmp_44*tmp_44*tmp_44)*tmp_18*((tmp_40*(tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40))*(tmp_40*(tmp_40*tmp_40*tmp_40)*(tmp_40*tmp_40*tmp_40)))+tmp_47*(tmp_33*(((tmp_33*tmp_33)*(tmp_33*tmp_33))*((tmp_33*tmp_33)*(tmp_33*tmp_33)))*(((tmp_33*tmp_33)*(tmp_33*tmp_33))*((tmp_33*tmp_33)*(tmp_33*tmp_33))))+4.0*((tmp_44*(tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44))*(tmp_44*(tmp_44*tmp_44*tmp_44)*(tmp_44*tmp_44*tmp_44)))*(tmp_40*tmp_40*tmp_40)*tmp_30);
g(0,7) = g0_7;
}
}
}
}
| 328.174041
| 16,802
| 0.723229
|
FrancoisGaits
|
bc4687634898028f3a5e11693bfc8d66a76d55b5
| 254
|
hpp
|
C++
|
include/ev_ctr_os_interface.hpp
|
leoagomes/3ds.js
|
8ab2783cc86ad81e8c0981864ffef5910a613dfe
|
[
"MIT"
] | 1
|
2022-03-14T10:45:25.000Z
|
2022-03-14T10:45:25.000Z
|
include/ev_ctr_os_interface.hpp
|
leoagomes/3ds.js
|
8ab2783cc86ad81e8c0981864ffef5910a613dfe
|
[
"MIT"
] | null | null | null |
include/ev_ctr_os_interface.hpp
|
leoagomes/3ds.js
|
8ab2783cc86ad81e8c0981864ffef5910a613dfe
|
[
"MIT"
] | null | null | null |
#pragma once
#include "event_loop.hpp"
namespace ev {
class ctr_os_interface : public event::os_interface {
public:
uint64_t get_monotonic_tick();
uint64_t millis_to_ticks(uint64_t millis);
uint64_t ticks_to_millis(uint64_t ticks);
};
};
| 16.933333
| 53
| 0.748031
|
leoagomes
|
bc537acbbc5ba27efbc2f1b0b505e1b6941a01e0
| 2,298
|
cc
|
C++
|
Code/2104-operations-on-tree.cc
|
SMartQi/Leetcode
|
9e35c65a48ba1ecd5436bbe07dd65f993588766b
|
[
"MIT"
] | 2
|
2019-12-06T14:08:57.000Z
|
2020-01-15T15:25:32.000Z
|
Code/2104-operations-on-tree.cc
|
SMartQi/Leetcode
|
9e35c65a48ba1ecd5436bbe07dd65f993588766b
|
[
"MIT"
] | 1
|
2020-01-15T16:29:16.000Z
|
2020-01-26T12:40:13.000Z
|
Code/2104-operations-on-tree.cc
|
SMartQi/Leetcode
|
9e35c65a48ba1ecd5436bbe07dd65f993588766b
|
[
"MIT"
] | null | null | null |
class LockingTree {
unordered_map<int, unordered_set<int>> child;
int par[2000];
int lockby[2000];
int n;
bool checkedChild = false;
public:
LockingTree(vector<int>& parent) {
memset(lockby, -1, sizeof(lockby));
n = parent.size();
for (int i = 0; i < n; i++) {
child[parent[i]].insert(i);
par[i] = parent[i];
}
}
bool lock(int num, int user) {
if (lockby[num] != -1) {
return false;
} else {
lockby[num] = user;
return true;
}
}
bool unlock(int num, int user) {
if (lockby[num] != -1) {
bool result = false;
if (lockby[num] == user) {
result = true;
}
if (result) {
lockby[num] = -1;
}
return result;
} else {
return false;
}
}
bool upgrade(int num, int user) {
if (lockby[num] == -1) {
// ancestors
int tmpNum = num;
while (tmpNum != -1) {
if (lockby[tmpNum] != -1) {
return false;
}
tmpNum = par[tmpNum];
}
// descendant
checkedChild = false;
check(num);
if (checkedChild) {
upgrade(num);
lockby[num] = user;
}
return checkedChild;
} else {
return false;
}
}
void check(int num) {
if (checkedChild) {
return;
}
if (lockby[num] != -1) {
checkedChild = true;
cout << num << endl;
return;
}
for (auto &c : child[num]) {
check(c);
if (checkedChild) {
return;
}
}
}
void upgrade(int num) {
lockby[num] = -1;
for (auto &c : child[num]) {
upgrade(c);
}
}
};
/**
* Your LockingTree object will be instantiated and called as such:
* LockingTree* obj = new LockingTree(parent);
* bool param_1 = obj->lock(num,user);
* bool param_2 = obj->unlock(num,user);
* bool param_3 = obj->upgrade(num,user);
*/
| 23.9375
| 67
| 0.416449
|
SMartQi
|
bc569e2d70b8d4fa78c360ecc5bba84f3e923219
| 14,047
|
cpp
|
C++
|
AnalyticNSIE/modes_ana.cpp
|
glenco/SLsimLib
|
fb7a3c450d2487a823fa3f0ae8c8ecf7945c3ebb
|
[
"MIT"
] | 2
|
2017-03-22T13:18:32.000Z
|
2021-05-01T01:54:31.000Z
|
AnalyticNSIE/modes_ana.cpp
|
glenco/SLsimLib
|
fb7a3c450d2487a823fa3f0ae8c8ecf7945c3ebb
|
[
"MIT"
] | 49
|
2016-10-05T03:08:38.000Z
|
2020-11-03T15:39:26.000Z
|
AnalyticNSIE/modes_ana.cpp
|
glenco/SLsimLib
|
fb7a3c450d2487a823fa3f0ae8c8ecf7945c3ebb
|
[
"MIT"
] | 1
|
2017-07-10T08:52:53.000Z
|
2017-07-10T08:52:53.000Z
|
/**
* Created on: March 28, 2014
* Author: D. Leier
*/
#include "lens_halos.h"
/*
PosType LensHalo::modfunc(int modnumber, PosType my_slope, PosType my_fratio){
if(modnumber==0){return 1.0;};
PosType a=amodfunc(modnumber, my_fratio);
PosType b=bmodfunc(modnumber, my_fratio);
PosType ans=a+b*log10(my_slope);
//std::cout << "modn: " << modnumber << "slope: " << my_slope << " a: "<< a << " b: " << b << " c: " << cmodfunc(my_fratio) << " d: " << dmodfunc(my_fratio) << " " << ans << std::endl;
if(modnumber % 4 == 0 && modnumber > 4){return -1.0*pow(10,ans);};
if(modnumber==4){ans+=(cmodfunc(my_fratio)/(dmodfunc(my_fratio)+my_slope)); return -1.0*pow(10.0,ans);};
return 0.0;
}
PosType LensHalo::hi_order_modfunc(PosType x, int modnumber, PosType my_slope, PosType my_fratio){
int k=modnumber/2;
double da=dmod(x,modnumber,my_slope,my_fratio), dda=ddmod(x,modnumber,my_slope,my_fratio);
PosType dans=(my_slope*my_slope-k*k)/(my_slope*my_slope-k*k+x*(2.*my_slope+1.)*da+x*x*(dda+da*da));
if(modnumber==0){return 1.0;};
PosType a=amodfunc(modnumber, my_fratio);
PosType b=bmodfunc(modnumber, my_fratio);
PosType ans=a+b*log10(my_slope);
//std::cout << "DANS: " << dans<< " " << 2.*my_slope+1. <<" " << da << std::endl;
//std::cout << "modn: " << modnumber << "slope: " << my_slope << " a: "<< a << " b: " << b << " c: " << cmodfunc(my_fratio) << " d: " << dmodfunc(my_fratio) << " " << ans << std::endl;
if(modnumber % 4 == 0 && modnumber > 4){return -1.0*pow(10.0,ans)*dans;};
if(modnumber==4){ans+=(cmodfunc(my_fratio)/(dmodfunc(my_fratio)+my_slope)); return -1.0*pow(10.0,ans)*dans;};
return 0.0;
}
PosType LensHalo::amodfunc(int modnumber, PosType my_fratio){
//PosType ans=mod_params[0][modnumber][0]+mod_params[0][modnumber][1]*my_fratio;
PosType ans=analModes(0,modnumber,0)+analModes(0,modnumber,1)*my_fratio;
if(modnumber % 4 == 0 && modnumber > 4){
//ans+=(mod_params[0][modnumber][2]/(mod_params[0][modnumber][3]-my_fratio)+mod_params[0][modnumber][4]*pow(my_fratio,mod_params[0][modnumber][5]));
ans+=(analModes(0,modnumber,2)/(analModes(0,modnumber,3)-my_fratio)+analModes(0,modnumber,4)*pow(my_fratio,analModes(0,modnumber,5)));
return -1.0*ans;
};
if(modnumber==4){
//ans+=mod_params[0][modnumber][2]*log10(mod_params[0][modnumber][3]*my_fratio/pow(1-my_fratio,mod_params[0][modnumber][4]));
ans+=analModes(0,modnumber,2)*log10(analModes(0,modnumber,3)*my_fratio/pow(1-my_fratio,analModes(0,modnumber,4)));
return -1.0*ans;
};
return 0.0;
}
PosType LensHalo::bmodfunc(int modnumber, PosType my_fratio){
//PosType ans=mod_params[1][modnumber][0]+mod_params[1][modnumber][1]*my_fratio;
PosType ans=analModes(1,modnumber,0)+analModes(1,modnumber,1)*my_fratio;
if(modnumber % 4 == 0 && modnumber > 4){
//ans+=(mod_params[1][modnumber][2]*exp(mod_params[1][modnumber][3]*pow(my_fratio,mod_params[1][modnumber][4]))+mod_params[1][modnumber][5]/my_fratio);
ans+=(analModes(1,modnumber,2)*exp(analModes(1,modnumber,3)*pow(my_fratio,analModes(1,modnumber,4)))+analModes(1,modnumber,5)/my_fratio);
return ans;
};
if(modnumber==4){
//ans+=mod_params[1][modnumber][2]/(pow(my_fratio,mod_params[1][modnumber][3])-mod_params[1][modnumber][4])+mod_params[1][modnumber][5]/pow(my_fratio,mod_params[1][modnumber][6]);
ans+=analModes(1,modnumber,2)/(pow(my_fratio,analModes(1,modnumber,3))+analModes(1,modnumber,4));
//std::cout << "JAJAJA " << analModes(1,modnumber,1) << " " << analModes(1,modnumber,2) << std::endl;
return ans;
};
return 0.0;
}
PosType LensHalo::cmodfunc(PosType my_fratio){
return 0.0079/(0.407+6.909*my_fratio)-0.454;
}
PosType LensHalo::dmodfunc(PosType my_fratio){
return 0.002/(0.028+0.709*my_fratio)-2.261;
}
PosType LensHalo::dmod(PosType x, int modnumber, PosType my_slope, PosType my_fratio){
PosType b=bmodfunc(modnumber, my_fratio);
PosType d=dmodfunc(my_fratio);
PosType c=cmodfunc(my_fratio);
PosType db=dbfunction(x); //dbnum(x)
PosType ans=b*db/(my_slope*log(10));
if(modnumber==4){
ans+=-c/(d+my_slope)/(d+my_slope)*db;
}
return ans;
}
PosType LensHalo::dlnmod_dr(PosType x, int modnumber, PosType my_slope, PosType my_fratio){
PosType b=bmodfunc(modnumber, my_fratio);
PosType d=dmodfunc(my_fratio);
PosType c=cmodfunc(my_fratio);
PosType dbdr=dbfunction(x); //dbnum(x)
PosType ans=dbdr*(b/my_slope);
if(modnumber==4){
ans+=-1.0*((c*log(10))/(d+my_slope)/(d+my_slope))*dbdr;
}
return ans;
}
PosType LensHalo::ddmod(PosType x, int modnumber, PosType my_slope, PosType my_fratio){
PosType b=bmodfunc(modnumber, my_fratio);
PosType d=dmodfunc(my_fratio);
PosType c=cmodfunc(my_fratio);
PosType db=dbfunction(x);
PosType ddb=ddbfunction(x);
PosType ans=b*(ddb/(my_slope*log(10))-(db*db/(1/my_slope/my_slope/log(10))));
if(modnumber==4){
ans+=2*c/(d+my_slope)/(d+my_slope)/(d+my_slope)*db*db-c/(d+my_slope)/(d+my_slope)*ddb;
}
return ans;
}
PosType LensHalo::ddlnmod_dr(PosType x, int modnumber, PosType my_slope, PosType my_fratio){
PosType b=bmodfunc(modnumber, my_fratio);
PosType d=dmodfunc(my_fratio);
PosType c=cmodfunc(my_fratio);
PosType db=dbfunction(x); //dbnum(x)
PosType ddb=ddbfunction(x); //ddbnum(x);
PosType ans=(ddb-db*db/my_slope)*b/my_slope;
if(modnumber==4){
ans+=(ddb-db*db*2./(d+my_slope))*(-1.0*c*log(10))/(d+my_slope)/(d+my_slope);
}
return ans;
}
*/
// fit parameters to be used in afunc and bfunc for different i
//mfunc_param [0][][] is parameter a, [1][][] is parameter b, [][i][] is the mode number 0==4,1==8 etc., [][][p_i], p_0=p_1 in eqns. (59,60)
/*PosType LensHalo::analModes(int ab, int mn, int pn){
//std::cout << mn << std::endl;
PosType arr[2][7][7] = {{{5.45400234e-01, 2.00623559e-01, 1.74273034e-01, 1.86242095e+02, 5.70675374e+00,0,0},
{0.98519072, 1.79227955, 0.19333932, 1.05911801, 1.80285544, 175.19794791,0},
{1.27286496, 2.52757113, 0.35561051, 1.07921878, 0.40027514, 37.47696142,0},
{3.90009539, 4.59744288, -8.40249184, 4.13420228, 3.31751963, 6.35692121,0},
{4.31129234, 7.55980323, -2.70971355, 1.20304148, 10.04502808, 4.77684945,0},
{28.27243869, 23.49608644, -43.13187974, 1.65596222, 22.72500104, 3.1378364,0},
{57.01022684, 33.55782426, -114.00434863, 2.08922268, 22.96852996, 2.53164822,0}},
{{7.41256977e+00,3.35544981e-02,-4.99797570e+01,-9.33421144e-02,1.01892453e+01,0,0},
{-7.15392458e+01, -1.93808978e-02, 7.48623502e+01, -1.70286774e-02, 4.20781335e+02, 3.66600276e-04,0},
{-2.67369155e+00, -3.43984326e-02, 6.08826051e+00, -4.03323814e-01, 7.02617948e+01, 3.95509769e-04,0},
{1.93036483e+00, -3.94871873e-02, 1.56471642e+00, -5.54299042e+00, 3.62847996e+01, 4.40377288e-04,0},
{2.06365018e+00, -4.79733978e-02, 1.49994453e+00, -1.21602730e+01, 2.28348079e+01, 4.49107825e-04,0},
{2.06019572e+00, -4.22588623e-02, 1.55824013e+00, -1.62854932e+01, 1.57266141e+01, 4.93672097e-04,0},
{2.09778383e+00, -7.99553494e-02, 1.58048481e+00, -3.27089042e+01, 1.36378731e+01, 4.02453963e-04,0}}};
return arr[ab][int(mn/4)-1][pn];
}
*/
void LensHalo::analModes(int modnumber, PosType my_beta, PosType q, PosType amod[3]){
PosType x=my_beta;
PosType xsq=x*x;
PosType qsq=q*q;
PosType qqq=qsq*qsq;
if(modnumber==4){
PosType p[4];
p[0]=0.999247407765171+1.57671597806174*qsq+0.226801415239749*qqq-0.00113150933379816/(0.00982744492049579+q)-1.92526147723216*q-0.876057800660322*qsq*q;
p[1]=(0.256689163217493-0.349094565459393*qsq)/(0.240187114931842+7.04774689369728*q+127.355470876729*qqq*qsq+74.7649585603172*qqq+40.6443593959714*qsq*q +7.04774689369728*qsq);
p[2]=(0.869382229417186*q-0.807125199076924)/(1.13660761698993+45.2956858226937*q+2121.94004854273*qqq*qqq+421.206428582793*qsq*q-38.4857728532176*qsq);
p[3]=(0.000640486669983527-0.00104518529303727*q)/(0.00710198457626786+0.800055447745725*q+120.581051723995*qqq*q+32.2823375097222*qsq*q+1.50311757016824*qsq-21.4518837566564*qqq);
amod[0]=p[0]*x+p[1]*xsq+p[2]*xsq*x+p[3]*xsq*xsq;
amod[1]=p[0]+p[1]*2.*x+p[2]*3.*xsq+p[3]*4.*x*xsq;
amod[2]=p[1]*2.+p[2]*6.*x+p[3]*12.*xsq;
}
if(modnumber==8){
PosType p[5];
p[0]=0.497555478681077+0.000204902074485823/x+3.50663151993971*qsq+2.34317902193599*qqq-1.94862571121286*q-0.628046645263927*qqq*q-3.77143120591481*qsq*q;
p[1]=2.48928468360676+6.903227095891*q+0.365066682291406*log(q)-2.54875770684561*sin(q)-1.50679862465651*qsq-3.24349713567861*sqrt(3.13261876573299*q);
p[2]=(q-0.921090631057856)/(7382.43442477471*qqq-0.352662146083676-42.8982972220118*q-4358.26871100734*qsq*q-121695.680019394*qqq*qsq);
p[3]=(0.0277306792378124*q-0.0217671131740949)/(0.00997700501985252+q+747.18250982068*qqq*qsq*q+43.9903595800984*qsq*q+1.61849149117731*qsq);
p[4]=26.0020256464656/(57.5695837127945+4624.73063241391*q+44981192.5548355*qqq*qsq*q+2056746.30474371*qqq+58135.4015130137*qsq);
amod[0]=p[0]*x+p[1]*xsq+p[2]*xsq*x+p[3]*xsq*xsq+p[4]*xsq*xsq*x;
amod[1]=p[0]+p[1]*2.*x+p[2]*3.*xsq+p[3]*4.*xsq*x+p[4]*5.*xsq*xsq;
amod[2]=p[1]*2.+p[2]*6.*x+p[3]*12.*xsq+p[4]*20.*xsq*x;
}
if(modnumber==12){
PosType p[5];
p[0]=(1.37787428901026*q-0.630373108405854-0.754474021902366*qsq)/(-1.7724943276976-8.84252195876267*q-2.94086666623792*qsq-28.7963682928423*qsq*q);
p[1]= (16.5298835055148*q + 55.2192594512767*qqq)/(pow(277.645516542271,q+pow(q,4.26447869683269)+sqrt(q)) - pow(46.2928262754497*q,0.0612738432254949/sqrt(q)));
p[2]=0.0285580878225644/(0.0100292334359904+q+337.859555992645*qqq*qsq+55.3098246205842*qsq*q+49.8287458342673*qqq*q+6.05384360506144*qqq+6.05384360506144*qsq);
p[3]=(q-qsq)/(0.00226252608467631+2244.83274325001*qqq+48.8491549267231*qsq-682.187594099543*qqq*q);
p[4]=0.021571960010229/(0.0333135143092527+5.96741147805435*q+4467561.92719737*qqq*qqq+1169.22725067438*qsq*q);
amod[0]=p[0]*x+p[1]*xsq+p[2]*xsq*x+p[3]*xsq*xsq+p[4]*xsq*xsq*x;
amod[1]=p[0]+p[1]*2.*x+p[2]*3.*xsq+p[3]*4.*xsq*x+p[4]*5.*xsq*xsq;
amod[2]=p[1]*2.+p[2]*6.*x+p[3]*12.*xsq+p[4]*20.*xsq*x;
}
if(modnumber==16){
PosType p[5];
p[0]=(0.0332506690007129+0.0507849727193692*qsq-0.0818798140066402*q)/(0.117773213911455+1.00258035623967*q+23.6760013441453*qqq*qqq*qsq*q+ 7.87516159052667*qsq*q);
//p[0]=(0.0341321710217401+0.0539589185062629*qsq-0.0854561071707757*q)/(0.120919700383776+1.01676574135655*q+7.44144054666771*qsq*q+0.0850587108046311*qsq);
//p[1]=0.004951452353*q/(0.0004819509283+0.00596250089042225*q+133.347137165264*qqq*qqq+4.45414660698931*qqq+0.227069236590851*qsq);
p[1]=(0.370843148866421*q-0.00313460015313055)/(0.00580285397911041+q*exp(9.3730127916388*q));
p[2]=0.0511355873898476/(0.0176742950717808+1.54692258021449*q+15325.1426627127*qqq*qqq*qsq+565.977896268815*qqq+21.574807463678*qsq);
p[3]=-0.00214038765774794/(0.000704011874446295+0.127676507519154*q+8717.84655997113*qqq*qsq*q+22.3344032381803*qsq*q);
p[4]= 0.00319327126262356/(0.00480055091351625+1.00925649375844*q+101539659.312983*qqq*qqq*q+385.154374016887*qsq*q);
amod[0]=p[0]*x+p[1]*xsq+p[2]*xsq*x+p[3]*xsq*xsq+p[4]*xsq*xsq*x;
amod[1]=p[0]+p[1]*2.*x+p[2]*3.*xsq+p[3]*4.*xsq*x+p[4]*5.*xsq*xsq;
amod[2]=p[1]*2.+p[2]*6.*x+p[3]*12.*xsq+p[4]*20.*xsq*x;
}
if(modnumber==20){
PosType p[5];
p[0]=0.00216929246186679/(0.00874532408794626+0.150239670550345*q+661.308273994221*qqq*qqq*q+17.2984134591348*qqq+0.377245995454281*qsq);
p[1]=(0.00690072719794233+1.55926022949841*qsq-qsq*q-0.623885933520025*q)/(-2.55838861366553*q-176.802304238127*qsq*q-3217.71548020031*qqq*qsq*q);
p[2]=0.0250561178602656/(0.00677502952553192+q+2747.01604139518*qqq*qsq+114.481847626077*qsq*q+4.20620916094827*qsq);
p[3]=(0.0269794302997856-0.0792906388766586*q)/(-0.0124943423636934-1.09649706499358*q-26.2275198235134*qsq-12717.1851237396*qqq*q);
p[4]=(3.84628930462709e-6-3.31250089838063e-5*q)/(4.85021837022965e-6+0.0013811919166733*q+90.5084746032337*qqq*qsq*q+0.302838155475293*qsq*q-0.00153415114620723*qsq);
amod[0]=p[0]*x+p[1]*xsq+p[2]*xsq*x+p[3]*xsq*xsq+p[4]*xsq*xsq*x;
amod[1]=p[0]+p[1]*2.*x+p[2]*3.*xsq+p[3]*4.*xsq*x+p[4]*5.*xsq*xsq;
amod[2]=p[1]*2.+p[2]*6.*x+p[3]*12.*xsq+p[4]*20.*xsq*x;
}
if(modnumber==24){
PosType p[5];
p[0]=(3.82661873893811e-5+7.56042377625885e-5*qsq-0.000109078486936465*q)/(0.000175126592499607+0.00341872621572824*q+0.0815844981491867*qsq*q-0.00451293919087288*qsq);
p[1]=(x-0.0152700264815539)/(0.0595436013358412+1256796.89494238*qqq*qqq*qsq+15685.1646694688*qqq*q+103.93281463956*qsq);
p[2]=0.0154722687102909/(0.00340798484062739+0.739971972927153*q+6733.07078343369*qqq*qsq+133.921631245673*qsq*q-890.541218846465*qqq*q);
p[3]=0.0137409320162211/(-0.00417866808304444-1.01379599610013*q-424.692345463305*qsq*q-11608361.2829203*qqq*qqq);
p[4]=1.03789139769077/(0.237233723446576+594.210136818616*q+5.14323465264109e21*qqq*qqq*qqq*qqq*q+9246244.7451883*qqq);
amod[0]=p[0]*x+p[1]*xsq+p[2]*xsq*x+p[3]*xsq*xsq+p[4]*xsq*xsq*x;
amod[1]=p[0]+p[1]*2.*x+p[2]*3.*xsq+p[3]*4.*xsq*x+p[4]*5.*xsq*xsq;
amod[2]=p[1]*2.+p[2]*6.*x+p[3]*12.*xsq+p[4]*20.*xsq*x;
}
if(modnumber==28){
std::cout << "There are yet no analytic models for Fourier modes with array index 28 or higher." << std::endl;
amod[0]=0.;
amod[1]=0.;
amod[2]=0.;
}
if(modnumber%4!=0){
amod[0]=0.;
amod[1]=0.;
amod[2]=0.;
}
amod[0]=0.;
amod[1]=0.;
amod[2]=0.;
}
| 57.569672
| 188
| 0.660853
|
glenco
|
bc57ca454ed21a6910e632bfa7b4ef22d4cacbdb
| 597
|
cpp
|
C++
|
luogu/codes/P4549.cpp
|
Tony031218/OI
|
562f5f45d0448f4eab77643b99b825405a123d92
|
[
"MIT"
] | 1
|
2018-12-22T06:43:59.000Z
|
2018-12-22T06:43:59.000Z
|
luogu/codes/P4549.cpp
|
Tony031218/OI
|
562f5f45d0448f4eab77643b99b825405a123d92
|
[
"MIT"
] | null | null | null |
luogu/codes/P4549.cpp
|
Tony031218/OI
|
562f5f45d0448f4eab77643b99b825405a123d92
|
[
"MIT"
] | null | null | null |
/*************************************************************
* > File Name : P4549.cpp
* > Author : Tony
* > Created Time : 2019/05/08 15:31:10
**************************************************************/
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL gcd(LL a, LL b) {
return b == 0 ? a : gcd(b, a % b);
}
int main() {
int n, ans = 0;
scanf("%d", &n);
for (int i = 1; i <= n; ++i) {
int a;
scanf("%d", &a);
if (a < 0) a = -a;
ans = gcd(ans, a);
}
printf("%d", ans);
return 0;
}
| 22.961538
| 63
| 0.341709
|
Tony031218
|
bc65421fd74470d7da46069c1a151d82615899f4
| 8,845
|
cpp
|
C++
|
source/utl/UTL_Analysis.cpp
|
Shakebones/VFXEpoch
|
014c51d5f98253b45b947fcecec940b20b1a5f04
|
[
"MIT"
] | null | null | null |
source/utl/UTL_Analysis.cpp
|
Shakebones/VFXEpoch
|
014c51d5f98253b45b947fcecec940b20b1a5f04
|
[
"MIT"
] | null | null | null |
source/utl/UTL_Analysis.cpp
|
Shakebones/VFXEpoch
|
014c51d5f98253b45b947fcecec940b20b1a5f04
|
[
"MIT"
] | null | null | null |
/*******************************************************************************
VFXEPOCH - Physically based simulation VFX
Copyright (c) 2016 Snow Tsui <trevor.miscellaneous@gmail.com>
All rights reserved. Use of this source code is governed by
the MIT license as written in the LICENSE file.
*******************************************************************************/
#include "UTL_Analysis.h"
namespace VFXEpoch
{
namespace Analysis
{
// How to calculate curl in the uniform grid��
// Localtion for storing the curl: Omega
// 1.Calculate u component gradient from Cell6 & Cell4
// 2.Calculate v component gradient from Cell8 & Cell2
// 3.Subtract du from dv to get curl (dv - du).
// Omega = dv - du;
/*
-------------------------
| | | |
| Cell1 | Cell2 | Cell3 |
| | | |
-------------------------
| | | |
| Cell4 | Curl | Cell6 |
| | | |
-------------------------
| | | |
| Cell7 | Cell8 | Cell9 |
| | | |
-------------------------
*/
void
computeCurl_uniform(VFXEpoch::Grid2DfScalarField& dest, VFXEpoch::Grid2DVector2DfField ref) {
float hx = 1.0f / (dest.getDimX() - 2);
float hy = 1.0f / (dest.getDimY() - 2);
for (int i = 1; i != dest.getDimY() - 1; i++){
for (int j = 1; j != dest.getDimX() - 1; j++){
float du, dv, curl;
du = 0.5f * (ref.getData(i + 1, j).m_x - ref.getData(i - 1, j).m_x) / hx;
dv = 0.5f * (ref.getData(i, j + 1).m_y - ref.getData(i, j - 1).m_y) / hy;
curl = dv - du;
dest(i, j) = curl;
}
}
}
void
computeCurl_uniform_Stokes(VFXEpoch::Grid2DfScalarField& dest, VFXEpoch::Grid2DVector2DfField ref){
// TODO: Stkes theorem based vorticity calculation
float hx = 1.0f / (dest.getDimX() - 2);
float hy = 1.0f / (dest.getDimY() - 2);
for (int i = 1; i != dest.getDimY() - 1; i++){
for (int j = 1; j != dest.getDimX() - 1; j++){
float du0, du1, dv0, dv1, coef;
coef = 1.0f / (8.0f * (hx * hy));
du0 = hx * (ref(i - 1, j - 1).m_x + 2 * ref(i, j - 1).m_x + ref(i + 1, j - 1).m_x);
du1 = hx * (ref(i + 1, j + 1).m_x + 2 * ref(i, j + 1).m_x + ref(i - 1, j + 1).m_x);
dv0 = hy * (ref(i + 1, j - 1).m_y + 2 * ref(i + 1, j).m_y + ref(i + 1, j + 1).m_y);
dv1 = hy * (ref(i - 1, j + 1).m_y + 2 * ref(i - 1, j).m_y + ref(i - 1, j - 1).m_y);
dest(i, j) = coef * (du0 + dv0 - du1 - dv1);
}
}
}
void
computeCurl_uniform_LS(VFXEpoch::Grid2DfScalarField& dest, VFXEpoch::Grid2DVector2DfField ref) {
// TODO: Least Square to get vorticity
float hx = 1.0f / (dest.getDimX() - 2);
float hy = 1.0f / (dest.getDimY() - 2);
for (int i = 2; i != dest.getDimY() - 2; i++){
for (int j = 2; j != dest.getDimX() - 2; j++){
float dv, du, coefx, coefy;
coefx = 1.0f / (10.0f * hx);
coefy = 1.0f / (10.0f * hy);
du = 2 * ref(i, j + 2).m_y + ref(i, j + 1).m_y - ref(i, j - 1).m_y - 2 * ref(i, j - 2).m_y;
dv = 2 * ref(i + 2, j).m_x + ref(i + 1, j).m_x - ref(i - 1, j).m_x - 2 * ref(i - 2, j).m_x;
dest(i, j) = coefx * dv - coefy * du;
}
}
}
void
computeCurl_uniform_Richardson(VFXEpoch::Grid2DfScalarField& dest, VFXEpoch::Grid2DVector2DfField ref){
// TODO: Richarson theorem based vorticity calculation
float hx = 1.0f / (dest.getDimX() - 2);
float hy = 1.0f / (dest.getDimY() - 2);
for (int i = 2; i != dest.getDimY() - 2; i++){
for (int j = 2; j != dest.getDimX() - 2; j++){
float dv, du, coefx, coefy;
coefx = 1.0f / (12.0f * hx);
coefy = 1.0f / (12.0f * hy);
du = -ref(i, j + 2).m_y + 8 * ref(i, j + 1).m_y - 8 * ref(i, j - 1).m_y + ref(i, j - 2).m_y;
dv = -ref(i + 2, j).m_x + 8 * ref(i + 1, j).m_x - 8 * ref(i - 1, j).m_x + ref(i - 2, j).m_x;
dest(i, j) = coefx * dv - coefy * du;
}
}
}
void
computeCurl_uniform(VFXEpoch::Grid3DVector3DfField& dest, VFXEpoch::Grid3DVector3DfField ref)
{
// TODO: Process 3D curl calculation in the uniform grid
}
// How to calculate curl in the mac grid��
// Omega = Nabla x velocity field;
// du = u2 - u1;
// dv = v2 - v1;
// Omega = du - dv;
//
/*
-------------------------
| | |
| u1
| | |
----v1-----Curl----v2----
| | |
| u2 |
| | |
-------------------------
*/
void
computeCurl_mac(VFXEpoch::Grid2DfScalarField& dest, VFXEpoch::Grid2DfScalarField u, VFXEpoch::Grid2DfScalarField v) {
for (int i = 1; i != dest.getDimY() - 1; i++){
for (int j = 1; j != dest.getDimX() - 1; j++){
float du, dv;
float curl;
du = (u(i, j) - u.getData(i - 1, j)) / u.getDy();
dv = (v(i, j) - v.getData(i, j - 1)) / v.getDx();
curl = dv - du;
dest(i, j) = curl;
}
}
}
void
computeCurl_mac(VFXEpoch::Grid3DVector3DfField& dest, VFXEpoch::Grid3DfScalarField u, VFXEpoch::Grid3DfScalarField v, VFXEpoch::Grid3DfScalarField w)
{
// TODO: Process 3D curl calculation in the uniform grid
}
void
computeGradient_uniform(VFXEpoch::Grid2DVector2DfField& dest, VFXEpoch::Grid2DfScalarField ref) {
// TODO: Compute gradients of a scalar field.
// Bugs here, central difference coef 0.5f * N;
for (int i = 1; i != dest.getDimY() - 1; i++){
for (int j = 1; j != dest.getDimX() - 1; j++){
VFXEpoch::Vector2Df data(0.5f * (dest.getDimY() - 2) * (ref(i + 1, j) - ref(i - 1, j)),
0.5f * (dest.getDimX() - 2) * (ref(i, j + 1) - ref(i, j - 1)));
dest(i, j) = data;
}
}
}
void
computeGradient_mac(VFXEpoch::Grid2DVector2DfField& dest, VFXEpoch::Grid2DfScalarField ref)
{
// TODO: Compute gradients on staggered grid.
}
void
find_vector_from_vector_potential_2D(VFXEpoch::Grid2DVector2DfField& u, VFXEpoch::Grid2DfScalarField psi)
{
// TODO: Calculate vector potential from the given function (Psi for stream function)
float dpsi_dy, dpsi_dx;
int Nx = u.getDimX() - 2;
int Ny = u.getDimY() - 2;
u.zeroVectors();
for (int i = 1; i != u.getDimY() - 1; i++){
for (int j = 1; j != u.getDimX() - 1; j++){
dpsi_dy = 0.5f * (psi(i + 1, j) - psi(i - 1, j)) * Ny;
dpsi_dx = 0.5f * (psi(i, j + 1) - psi(i, j - 1)) * Nx;
u(i, j).m_x = dpsi_dy;
u(i, j).m_y = -dpsi_dx;
}
}
}
void
computeLaplace(VFXEpoch::Grid2DfScalarField& dest, VFXEpoch::Grid2DfScalarField& ref)
{
for (int i = 1; i != dest.getDimY() - 1; i++){
for (int j = 1; j != dest.getDimX() - 1; j++){
dest(i, j) = (ref(i + 1, j) + ref(i - 1, j) + ref(i, j + 1) + ref(i, j - 1) - 4.0f * ref(i, j));
}
}
}
void
computeDivergence_uniform(VFXEpoch::Grid2DfScalarField& dest, VFXEpoch::Grid2DVector2DfField ref) {
int Nx = ref.getDimX() - 2;
int Ny = ref.getDimY() - 2;
for (int i = 1; i != dest.getDimY() - 1; i++){
for (int j = 1; j != dest.getDimX() - 1; j++){
float div(0.0);
float du(0.0f), dv(0.0f);
du = 0.5f * (ref.getData(i + 1, j).m_x - ref.getData(i - 1, j).m_x) / Nx;
dv = 0.5f * (ref.getData(i, j + 1).m_y - ref.getData(i, j - 1).m_y) / Ny;
div = du + dv;
dest(i, j) = div;
}
}
}
// TODO: Fix the bugs inside
// Access out of range
void
computeDivergence_with_weights_mac(VFXEpoch::Grid2DdScalarField& dest, float h, VFXEpoch::Grid2DfScalarField u, VFXEpoch::Grid2DfScalarField v,
VFXEpoch::Grid2DfScalarField _uw, VFXEpoch::Grid2DfScalarField _vw) {
assert(u.getDimY() == _uw.getDimY() && u.getDimX() == _uw.getDimX() &&
v.getDimY() == _vw.getDimY() && v.getDimX() == _vw.getDimX());
VFXEpoch::Zeros(dest);
LOOP_GRID2D_WITHOUT_DOMAIN_BOUNDARY(dest){
dest(i, j) = 0.0;
float k;
k = _uw(i, j+1) * u(i, j+1) / h;
dest(i, j) -= _uw(i, j+1) * u(i, j+1) / h;
dest(i, j) += _uw(i, j) * u(i, j) / h;
dest(i, j) -= _vw(i+1, j) * v(i+1, j) / h;
dest(i, j) += _vw(i, j) * v(i, j) / h;
}
}
// TODO: Fix the bugs inside
// Access out of range
void
computeDivergence_with_weights_mac(VFXEpoch::Grid2DdScalarField& dest, double h, VFXEpoch::Grid2DdScalarField u, VFXEpoch::Grid2DdScalarField v,
VFXEpoch::Grid2DdScalarField _uw, VFXEpoch::Grid2DdScalarField _vw) {
assert(u.getDimY() == _uw.getDimY() && u.getDimX() == _uw.getDimX() &&
v.getDimY() == _vw.getDimY() && v.getDimX() == _vw.getDimX());
VFXEpoch::Zeros(dest);
LOOP_GRID2D_WITHOUT_DOMAIN_BOUNDARY(dest){
dest(i, j) = 0.0;
double k;
k = _uw(i, j+1) * u(i, j+1) / h;
dest(i, j) -= _uw(i, j+1) * u(i, j+1) / h;
dest(i, j) += _uw(i, j) * u(i, j) / h;
dest(i, j) -= _vw(i+1, j) * v(i+1, j) / h;
dest(i, j) += _vw(i, j) * v(i, j) / h;
}
}
void
computeDivergence_mac(VFXEpoch::Grid2DfScalarField& dest, VFXEpoch::Grid2DfScalarField u, VFXEpoch::Grid2DfScalarField v) {
// TODO: Compute divergence on staggered grid
}
}
}
| 34.686275
| 151
| 0.534087
|
Shakebones
|
bc66190eea78b84a9f884290290f1aae532c9e9f
| 154
|
cpp
|
C++
|
old/practice/lesson8/ocpWithout.cpp
|
Lyuminarskiy/oop
|
b8c6a4b1cf8905c8bbeea5aa80769b5519307654
|
[
"MIT"
] | 3
|
2018-02-16T11:22:55.000Z
|
2018-03-23T14:10:33.000Z
|
old/practice/lesson8/ocpWithout.cpp
|
OOP-course/OOP-course
|
b8c6a4b1cf8905c8bbeea5aa80769b5519307654
|
[
"MIT"
] | null | null | null |
old/practice/lesson8/ocpWithout.cpp
|
OOP-course/OOP-course
|
b8c6a4b1cf8905c8bbeea5aa80769b5519307654
|
[
"MIT"
] | 1
|
2020-04-28T17:13:02.000Z
|
2020-04-28T17:13:02.000Z
|
// Работа с хранилищем заказов.
// Тип хранилища нельзя изменить.
struct OrderRepository
{
void load();
void save();
void update();
void del();
};
| 17.111111
| 33
| 0.675325
|
Lyuminarskiy
|
bc6d87151733a526cf53840d36df088b2a0cfcca
| 7,769
|
hpp
|
C++
|
NetworkLib/src/RangedInteger.hpp
|
Bousk/Net
|
bb77d61f870a28752fdf7509c111d446819aff31
|
[
"MIT"
] | 2
|
2021-12-29T16:29:13.000Z
|
2022-03-27T15:48:20.000Z
|
NetworkLib/src/RangedInteger.hpp
|
Bousk/Net
|
bb77d61f870a28752fdf7509c111d446819aff31
|
[
"MIT"
] | null | null | null |
NetworkLib/src/RangedInteger.hpp
|
Bousk/Net
|
bb77d61f870a28752fdf7509c111d446819aff31
|
[
"MIT"
] | 1
|
2020-10-31T23:50:23.000Z
|
2020-10-31T23:50:23.000Z
|
#pragma once
#include <Types.hpp>
#include <Serialization/Serialization.hpp>
#include <Serialization/Serializer.hpp>
#include <Serialization/Deserializer.hpp>
#include <Utils.hpp>
namespace Bousk
{
// Extract a type from a value
// Extract the most fitting type, ie : -1 => int8, 257 => uint16, ...
template<auto V, bool ForceUnsigned>
struct ExtractType
{
static_assert(std::numeric_limits<decltype(V)>::is_integer, "ExtractType must be used with integer type");
static_assert(!std::is_same_v<decltype(V), bool>, "ExtractType must not be used with bool");
using Type = std::conditional_t< V < 0
, std::conditional_t< V < std::numeric_limits<int32>::min(), int64
, std::conditional_t< V < std::numeric_limits<int16>::min(), int32
, std::conditional_t< V < std::numeric_limits<int8>::min(), int16
, int8
>>>
// > 0 : force unsigned type ?
, std::conditional_t< (V > std::numeric_limits<int64>::max()), uint64
, std::conditional_t< (V > std::numeric_limits<uint32>::max()), std::conditional_t<ForceUnsigned, uint64, int64>
, std::conditional_t< (V > std::numeric_limits<int32>::max()), std::conditional_t<ForceUnsigned, uint32, int64>
, std::conditional_t< (V > std::numeric_limits<uint16>::max()), std::conditional_t<ForceUnsigned, uint32, int32>
, std::conditional_t< (V > std::numeric_limits<int16>::max()), std::conditional_t<ForceUnsigned, uint16, int32>
, std::conditional_t< (V > std::numeric_limits<uint8>::max()), std::conditional_t<ForceUnsigned, uint16, int16>
, std::conditional_t< (V > std::numeric_limits<int8>::max()), std::conditional_t<ForceUnsigned, uint8, int16>
, std::conditional_t<ForceUnsigned, uint8, int8>
>>>>>>>
>;
};
// Promote a type to a bigger one (int32 => int64, uint8 => uint16, ...)
template<class T>
struct Promote { using Type = std::conditional_t<std::is_signed_v<T>, int64, uint64>; }; // Default, use biggest type available. Should not be used be needed to compile
template<> struct Promote<int32> { using Type = int64; };
template<> struct Promote<uint32> { using Type = uint64; };
template<> struct Promote<int16> { using Type = int32; };
template<> struct Promote<uint16> { using Type = uint32; };
template<> struct Promote<int8> { using Type = int16; };
template<> struct Promote<uint8> { using Type = uint16; };
// Return the biggest type
template<class A, class B>
struct Biggest
{
using Type = std::conditional_t<(sizeof(A) > sizeof(B)), A, B>;
};
// Find type fitting both A & B
template<class A, class B>
struct HoldingType
{
// Is it possible at all to find a fitting type for those 2 values ?
// The only way it wouldn't is if one is uint64 while the other is signed
static constexpr bool IsPossible = !((std::is_same_v<A, uint64> && std::is_signed_v<B>) || (std::is_same_v<B, uint64> && std::is_signed_v<A>));
using Type = typename std::conditional_t<!IsPossible, void
// They are same type : just use that type
, std::conditional_t<std::is_same_v<A, B>, A
// Same signed, use the biggest one
, std::conditional_t<std::is_signed_v<A> == std::is_signed_v<B>, typename Biggest<A, B>::Type
// Biggest is signed, use that one
, std::conditional_t<std::is_signed_v<typename Biggest<A, B>::Type>, typename Biggest<A, B>::Type
// Otherwise, use signed bigger than biggest
, std::make_signed_t<typename Promote<typename Biggest<A, B>::Type>::Type>
>>>>;
};
// Extract a type capable of holding both values, if possible
template<auto MIN, auto MAX>
struct FittingType
{
static_assert(MIN < MAX);
using MinType = typename ExtractType<MIN, (MIN >= 0)>::Type;
using MaxType = typename ExtractType<MAX, (MIN >= 0)>::Type;
// < MAX > int64 max would need a uint64, MIN < 0 would need a signe type : impossible
static constexpr bool IsPossible = !(MIN < 0 && MAX > std::numeric_limits<int64>::max()) || HoldingType<MinType, MaxType>::IsPossible;
using Type =
std::conditional_t<!IsPossible, void,
// Can MAX be hold by MinType ?
std::conditional_t<(MAX <= std::numeric_limits<MinType>::max()), MinType,
// Can MIN be hold by MaxType ?
std::conditional_t<(MIN >= std::numeric_limits<MaxType>::min()), MaxType,
// If not, find a type big enough to accomodate both values
typename HoldingType<MinType, MaxType>::Type
>>>;
};
template<auto MIN, auto MAX>
constexpr uint64 Range()
{
static_assert(MIN < MAX);
if constexpr (MAX < 0)
{
// Both < 0
return static_cast<uint64>(static_cast<int64>(-1)* MIN) - static_cast<uint64>(static_cast<int64>(-1)* MAX);
}
else if constexpr (MIN < 0)
{
#pragma warning(push)
#pragma warning(disable: 4307) // '*': signed integral constant overflow
return static_cast<uint64>(MAX) + static_cast<uint64>(static_cast<int64>(-1)* MIN);
#pragma warning(pop)
}
else
{
return static_cast<uint64>(MAX) - static_cast<uint64>(MIN);
}
}
template<auto MIN, auto MAX>
class RangedInteger : public Serialization::Serializable
{
static_assert(MIN < MAX, "Min & Max values must be strictly ordered");
static_assert(FittingType<MIN, MAX>::IsPossible, "Min & Max value impossible to fit in any type");
public:
using Type = typename FittingType<MIN, MAX>::Type;
static constexpr Type Min() { return MIN; }
static constexpr Type Max() { return MAX; }
static constexpr uint64 Range = Range<MIN, MAX>();
static constexpr uint8 NbBits = NbBits<Range>::Value;
RangedInteger() = default;
explicit RangedInteger(Type v) : mValue(v) { checkValue(); }
RangedInteger& operator=(Type v) { CheckValue(v); mValue = v; return *this; }
template<typename OtherType>
RangedInteger(OtherType v) { CheckValue(v); mValue = static_cast<Type>(v); }
template<typename OtherType>
RangedInteger& operator=(OtherType v) { CheckValue(v); mValue = static_cast<Type>(v); return *this; }
static constexpr bool IsWithinRange(Type v) { return (v >= Min() && v <= Max()); }
template<typename OtherType>
static constexpr bool IsWithinRange(OtherType v)
{
if constexpr (!HoldingType<Type, OtherType>::IsPossible)
{
return false;
}
else
{
using CastType = typename HoldingType<Type, OtherType>::Type; // Find a type accomodating both types
return (static_cast<CastType>(v) >= static_cast<CastType>(Min()) && static_cast<CastType>(v) <= static_cast<CastType>(Max()));
}
}
inline Type get() const { return mValue; }
inline operator Type() const { return mValue; }
bool write(Serialization::Serializer& serializer) const override { return serializer.write(get(), Min(), Max()); }
bool read(Serialization::Deserializer& deserializer) override { return deserializer.read(mValue, Min(), Max()); }
private:
void checkValue() { assert(IsWithinRange(mValue)); }
static void CheckValue(Type v) { assert(IsWithinRange(v)); }
template<typename OtherType>
void CheckValue(OtherType v) { assert(IsWithinRange(v)); }
private:
Type mValue{ Min() };
};
using UInt8 = RangedInteger<std::numeric_limits<uint8>::min(), std::numeric_limits<uint8>::max()>;
using UInt16 = RangedInteger<std::numeric_limits<uint16>::min(), std::numeric_limits<uint16>::max()>;
using UInt32 = RangedInteger<std::numeric_limits<uint32>::min(), std::numeric_limits<uint32>::max()>;
using UInt64 = RangedInteger<std::numeric_limits<uint64>::min(), std::numeric_limits<uint64>::max()>;
using Int8 = RangedInteger<std::numeric_limits<int8>::min(), std::numeric_limits<int8>::max()>;
using Int16 = RangedInteger<std::numeric_limits<int16>::min(), std::numeric_limits<int16>::max()>;
using Int32 = RangedInteger<std::numeric_limits<int32>::min(), std::numeric_limits<int32>::max()>;
using Int64 = RangedInteger<std::numeric_limits<int64>::min(), std::numeric_limits<int64>::max()>;
}
| 44.649425
| 169
| 0.693912
|
Bousk
|
bc701075e8ddb7383c108511ba233f7251802968
| 291
|
cpp
|
C++
|
1 sem/7 week/2 problem/2 problem/main.cpp
|
resueman/HW_Sem1
|
f096c7b026ce13ec4b7df5c9bea980a33697e60a
|
[
"Apache-2.0"
] | null | null | null |
1 sem/7 week/2 problem/2 problem/main.cpp
|
resueman/HW_Sem1
|
f096c7b026ce13ec4b7df5c9bea980a33697e60a
|
[
"Apache-2.0"
] | 1
|
2018-11-22T14:14:55.000Z
|
2018-11-22T14:14:55.000Z
|
1 sem/7 week/2 problem/2 problem/main.cpp
|
resueman/HW_Sem1
|
f096c7b026ce13ec4b7df5c9bea980a33697e60a
|
[
"Apache-2.0"
] | null | null | null |
#include "tree.h"
#include "test.h"
#include <iostream>
int main()
{
if (!test())
{
std::cout << "Program doesn't work";
return -1;
}
Tree* tree = readFromFile("file.txt");
printTree(tree);
std::cout << std::endl;
std::cout << treeValue(tree);
deleteTree(tree);
return 0;
}
| 13.857143
| 39
| 0.611684
|
resueman
|
bc7188daf788e2bc3edd7d78852648b7f12d3e7b
| 2,462
|
cpp
|
C++
|
Codility_StrSymmetricPoint.cpp
|
CharlieGearsTech/Codility
|
b0c4355eb68f05f24390075e3fe2fe555d40b6b9
|
[
"MIT"
] | 1
|
2021-01-31T22:59:59.000Z
|
2021-01-31T22:59:59.000Z
|
Codility_StrSymmetricPoint.cpp
|
CharlieGearsTech/Codility
|
b0c4355eb68f05f24390075e3fe2fe555d40b6b9
|
[
"MIT"
] | null | null | null |
Codility_StrSymmetricPoint.cpp
|
CharlieGearsTech/Codility
|
b0c4355eb68f05f24390075e3fe2fe555d40b6b9
|
[
"MIT"
] | null | null | null |
/*
Write a function:
int solution(string &S);
that, given a string S, returns the index (counting from 0) of a character such that the part of the string to the left of that character is a reversal of the part of the string to its right. The function should return −1 if no such index exists.
Note: reversing an empty string (i.e. a string whose length is zero) gives an empty string.
For example, given a string:
"racecar"
the function should return 3, because the substring to the left of the character "e" at index 3 is "rac", and the one to the right is "car".
Given a string:
"x"
the function should return 0, because both substrings are empty.
Write an efficient algorithm for the following assumptions:
the length of S is within the range [0..2,000,000].
*/
#include <iostream>
#include <assert.h>
#include <math.h>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <deque>
#include <stdlib.h>
#include <string>
#include <set>
#include <vector>
#include <new>
#include <memory>
#include <iterator>
#include <cctype>
#include <sstream>
using namespace std;
/*https://app.codility.com/demo/results/training4P2XJG-HXV/*/
int solution(string &S)
{
if(S.empty())
return -1;
/*Indice 0 es el indice intermedio de un string de un elemento*/
if(S.size()==1)
return 0;
/* Numeros pares no pueden tener un indice intermedio palindrome*/
if(S.size()%2==0)
return -1;
int mid= floor((float)(S.size()/2));
/*Checar del centro hacia afuera cada uno de los caracteres.*/
for(int i=1; i<=mid; ++i)
{
if(S[mid-i] != S[mid+i])
return -1;
}
return mid;
}
int main()
{
int result;
string s="racecar";
result=solution(s);
cout<<result<<endl;
assert(result==3);
s.clear();
s="x";
result=solution(s);
cout<<result<<endl;
assert(result==0);
s="";
result=solution(s);
cout<<result<<endl;
assert(result==-1);
s="civic";
result=solution(s);
cout<<result<<endl;
assert(result==2);
s="repaper";
result=solution(s);
cout<<result<<endl;
assert(result==3);
s="wow";
result=solution(s);
cout<<result<<endl;
assert(result==1);
s="redrumsirismurder";
result=solution(s);
cout<<result<<endl;
assert(result==8);
s="abc";
result=solution(s);
cout<<result<<endl;
assert(result==-1);
return 0;
}
| 20.864407
| 246
| 0.63485
|
CharlieGearsTech
|
bc72cad1897f118c42d1b17ff54854e62d6bb365
| 3,780
|
cpp
|
C++
|
src/autogen/cfdapi_get_issuance_blinding_key_json.cpp
|
fujita-cg/cfd-js
|
6113374d3f04495a30854c06c73d7094ea361fdb
|
[
"MIT"
] | null | null | null |
src/autogen/cfdapi_get_issuance_blinding_key_json.cpp
|
fujita-cg/cfd-js
|
6113374d3f04495a30854c06c73d7094ea361fdb
|
[
"MIT"
] | null | null | null |
src/autogen/cfdapi_get_issuance_blinding_key_json.cpp
|
fujita-cg/cfd-js
|
6113374d3f04495a30854c06c73d7094ea361fdb
|
[
"MIT"
] | null | null | null |
// Copyright 2019 CryptoGarage
/**
* @file cfdapi_get_issuance_blinding_key_json.cpp
*
* @brief JSONマッピングファイル (自動生成)
*/
#include <set>
#include <string>
#include <vector>
#include "cfdapi_get_issuance_blinding_key_json.h" // NOLINT
namespace cfd {
namespace js {
namespace api {
namespace json {
using cfd::core::JsonClassBase;
using cfd::core::JsonObjectVector;
using cfd::core::JsonValueVector;
using cfd::core::JsonVector;
// clang-format off
// @formatter:off
// ------------------------------------------------------------------------
// GetIssuanceBlindingKeyRequest
// ------------------------------------------------------------------------
cfd::core::JsonTableMap<GetIssuanceBlindingKeyRequest>
GetIssuanceBlindingKeyRequest::json_mapper;
std::vector<std::string> GetIssuanceBlindingKeyRequest::item_list;
void GetIssuanceBlindingKeyRequest::CollectFieldName() {
if (!json_mapper.empty()) {
return;
}
cfd::core::CLASS_FUNCTION_TABLE<GetIssuanceBlindingKeyRequest> func_table; // NOLINT
func_table = {
GetIssuanceBlindingKeyRequest::GetMasterBlindingKeyString,
GetIssuanceBlindingKeyRequest::SetMasterBlindingKeyString,
GetIssuanceBlindingKeyRequest::GetMasterBlindingKeyFieldType,
};
json_mapper.emplace("masterBlindingKey", func_table);
item_list.push_back("masterBlindingKey");
func_table = {
GetIssuanceBlindingKeyRequest::GetTxidString,
GetIssuanceBlindingKeyRequest::SetTxidString,
GetIssuanceBlindingKeyRequest::GetTxidFieldType,
};
json_mapper.emplace("txid", func_table);
item_list.push_back("txid");
func_table = {
GetIssuanceBlindingKeyRequest::GetVoutString,
GetIssuanceBlindingKeyRequest::SetVoutString,
GetIssuanceBlindingKeyRequest::GetVoutFieldType,
};
json_mapper.emplace("vout", func_table);
item_list.push_back("vout");
}
void GetIssuanceBlindingKeyRequest::ConvertFromStruct(
const GetIssuanceBlindingKeyRequestStruct& data) {
master_blinding_key_ = data.master_blinding_key;
txid_ = data.txid;
vout_ = data.vout;
ignore_items = data.ignore_items;
}
GetIssuanceBlindingKeyRequestStruct GetIssuanceBlindingKeyRequest::ConvertToStruct() const { // NOLINT
GetIssuanceBlindingKeyRequestStruct result;
result.master_blinding_key = master_blinding_key_;
result.txid = txid_;
result.vout = vout_;
result.ignore_items = ignore_items;
return result;
}
// ------------------------------------------------------------------------
// GetIssuanceBlindingKeyResponse
// ------------------------------------------------------------------------
cfd::core::JsonTableMap<GetIssuanceBlindingKeyResponse>
GetIssuanceBlindingKeyResponse::json_mapper;
std::vector<std::string> GetIssuanceBlindingKeyResponse::item_list;
void GetIssuanceBlindingKeyResponse::CollectFieldName() {
if (!json_mapper.empty()) {
return;
}
cfd::core::CLASS_FUNCTION_TABLE<GetIssuanceBlindingKeyResponse> func_table; // NOLINT
func_table = {
GetIssuanceBlindingKeyResponse::GetBlindingKeyString,
GetIssuanceBlindingKeyResponse::SetBlindingKeyString,
GetIssuanceBlindingKeyResponse::GetBlindingKeyFieldType,
};
json_mapper.emplace("blindingKey", func_table);
item_list.push_back("blindingKey");
}
void GetIssuanceBlindingKeyResponse::ConvertFromStruct(
const GetIssuanceBlindingKeyResponseStruct& data) {
blinding_key_ = data.blinding_key;
ignore_items = data.ignore_items;
}
GetIssuanceBlindingKeyResponseStruct GetIssuanceBlindingKeyResponse::ConvertToStruct() const { // NOLINT
GetIssuanceBlindingKeyResponseStruct result;
result.blinding_key = blinding_key_;
result.ignore_items = ignore_items;
return result;
}
// @formatter:on
// clang-format on
} // namespace json
} // namespace api
} // namespace js
} // namespace cfd
| 31.5
| 105
| 0.725397
|
fujita-cg
|
bc7af59e662906d453c6b6acbab8bec4c8bb97f5
| 25,204
|
cpp
|
C++
|
src/Display.cpp
|
Gbertaz/GloBoSaT
|
ab983c6c8ca8a988b6521cc4c23f9717eb877d9f
|
[
"MIT"
] | 7
|
2021-05-25T10:40:42.000Z
|
2022-01-19T15:16:53.000Z
|
src/Display.cpp
|
Gbertaz/GloBoSaT
|
ab983c6c8ca8a988b6521cc4c23f9717eb877d9f
|
[
"MIT"
] | null | null | null |
src/Display.cpp
|
Gbertaz/GloBoSaT
|
ab983c6c8ca8a988b6521cc4c23f9717eb877d9f
|
[
"MIT"
] | null | null | null |
// MIT License
//
// Copyright(c) 2021 Giovanni Bertazzoni <nottheworstdev@gmail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files(the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions :
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "Display.h"
NexDisplay myNex(Serial2);
//ChartRenderer chartAltitude(myNex, 15, 15, 210, 120);
//==============================================================================================
// NEXTION GRAPHICS EDITOR OBJECTS' NAMES
//==============================================================================================
//Object names are global so they are unique globally and not locally on the page.
//This is to avoid writing into a wrong object when changing pages quickly.
static const char *HOME_SPEED = "t0.txt";
static const char *HOME_ODOMETER = "t1.txt";
static const char *HOME_TRIP_TIME = "t2.txt";
static const char *HOME_ELEVATION = "t3.txt";
static const char *HOME_TEMPERATURE = "t4.txt";
static const char *HOME_BATTERY = "B.val"; //Battery percentage
static const char *TIME_CLOCK = "t5.txt";
static const char *TIME_TRIP = "t6.txt";
static const char *TIME_MOVING = "t7.txt";
static const char *TIME_STOPPED = "t8.txt";
static const char *TIME_LAST_STOP = "t9.txt";
static const char *TIME_DAWN = "t10.txt";
static const char *TIME_DUSK = "t11.txt";
static const char *SPEED_CURRENT = "t12.txt";
static const char *SPEED_MAX = "t13.txt";
static const char *SPEED_AVG_MOVING = "t14.txt";
static const char *SPEED_AVG_TOTAL = "t15.txt";
static const char *ELEVATION_CURRENT = "t16.txt";
static const char *ELEVATION_MAX = "t17.txt";
static const char *ELEVATION_MIN = "t18.txt";
static const char *LOCATION_LATITUDE = "t19.txt";
static const char *LOCATION_LONGITUDE = "t20.txt";
static const char *LOCATION_ODOMETER = "t21.txt";
static const char *LOCATION_HOME_DISTANCE = "t22.txt";
static const char *LOCATION_HEADING = "t23.txt";
static const char *LOCATION_SATELLITES = "t24.txt";
static const char *COMPASS_SPEED = "t25.txt";
static const char *COMPASS_DISTANCE = "t26.txt";
static const char *COMPASS_DEGREES = "p1.pic";
static const char *SETTINGS_GPS_RATE = "R.val"; //R: Rate => Gps update rate
static const char *SETTINGS_GPS_PLATFORM = "D.val"; //D: Dynamic platform
static const char *SETTINGS_GPS_MODE = "T.val"; //T: Tracking mode
static const char *SETTINGS_GPS_METERS = "M.val"; //M: Meters => required traveled meters to trigger a log on sd card
static const char *MAP_PIN_X = "xPin.val"; //X screen coordinate
static const char *MAP_PIN_Y = "yPin.val"; //Y screen coordinate
static const char *MAP_TILE_ID = "tileId.val";
static const char *HEALTH_HEART_BPM = "t27.txt";
static const char *HEALTH_HEART_MAX = "t28.txt";
static const char *HEALTH_HEART_MIN = "t29.txt";
NextionDisplay::NextionDisplay() {
myNex.currentPageId = 0;
myNex.lastPageId = 99;
_lastUpdateMillis = 0;
_pageChanged = true;
}
void NextionDisplay::setup() {
myNex.begin(115200);
delay(100);
_updateInterval = (1000 / DISPLAY_TARGET_FPS);
// Set the Nextion display to page 0
myNex.sendCommand("page 0");
}
void NextionDisplay::update(const NavData &navData) {
if(millis() - _lastUpdateMillis < _updateInterval) return;
myNex.listen();
bool newDataSent = false;
#ifdef DEBUG_DISPLAY
unsigned long t1 = millis();
#endif
//Updates only the current page
switch (myNex.currentPageId) {
case 0:
newDataSent = refreshPage0(navData);
break;
case 1:
newDataSent = refreshPage1(navData);
break;
case 2:
newDataSent = refreshPage2(navData);
break;
case 3:
newDataSent = refreshPage3(navData);
break;
case 4:
newDataSent = refreshPage4(navData);
break;
case 5:
newDataSent = refreshPage5(navData);
break;
case 6:
newDataSent = refreshPage6(navData);
break;
case 7:
newDataSent = refreshPage7(navData);
break;
case 8:
newDataSent = refreshPage8(navData);
break;
}
_pageChanged = false;
#ifdef DEBUG_DISPLAY
unsigned long updateTime = millis() - t1;
Serial.print("Display update interval: ");
Serial.print(millis() - _lastUpdateMillis - updateTime);
Serial.print(" ms");
Serial.println("");
if (newDataSent) {
Serial.print("Display update time: ");
Serial.print(updateTime);
Serial.print(" ms");
Serial.println("");
}
#endif
_lastUpdateMillis = millis();
}
void NextionDisplay::onPageChange(){
_pageChanged = true;
#ifdef DEBUG_DISPLAY
Serial.print("Display onPageChange: ");
Serial.println(myNex.currentPageId);
#endif
}
//=================================================================================================================================================
//=================================================================================================================================================
// PAGE 0 --- HOME
//=================================================================================================================================================
//=================================================================================================================================================
bool NextionDisplay::refreshPage0(const NavData &navData) {
bool newDataSent = false;
//-----------------------------
//Battery percentage
if(_lastDisplayData.batteryStatus.percentage != navData.batteryStatus.percentage || _pageChanged){
_lastDisplayData.batteryStatus = navData.batteryStatus;
myNex.setNumber(HOME_BATTERY, (uint32_t)navData.batteryStatus.percentage);
newDataSent = true;
}
//-----------------------------
//Speed with tolerance
bool send = false;
if (_lastDisplayData.speed != navData.speed || _pageChanged || send) {
_lastDisplayData.speed = navData.speed;
char data[8];
sprintf(data, "%.0f", _lastDisplayData.speed); //IF THE GPS IS IN PEDESTRIAN MODE IT MIGHT BE USEFULL TO SHOW THE DECIMALS
myNex.setText(HOME_SPEED, data);
newDataSent = true;
}
//-----------------------------
//Odometer
if (_lastDisplayData.distanceTotalKm != navData.distanceTotalKm || _pageChanged || send) {
_lastDisplayData.distanceTotalKm = navData.distanceTotalKm;
char data[9];
sprintf(data, "%.1f", (_lastDisplayData.distanceTotalKm < 1) ? _lastDisplayData.distanceTotalKm * 1000 : _lastDisplayData.distanceTotalKm);
myNex.setText(HOME_ODOMETER, data);
newDataSent = true;
}
//-----------------------------
//Moving time
if (_lastDisplayData.movingTime != navData.movingTime || _pageChanged) {
_lastDisplayData.movingTime = navData.movingTime;
char data[10];
sprintf(data, "%02d:%02d:%02d", _lastDisplayData.movingTime.hours, _lastDisplayData.movingTime.minutes, _lastDisplayData.movingTime.seconds);
myNex.setText(HOME_TRIP_TIME, data);
newDataSent = true;
}
//-----------------------------
//Altitude with tolerance
if (_lastDisplayData.altitude != navData.altitude || _pageChanged) {
_lastDisplayData.altitude = navData.altitude;
char data[6];
sprintf(data, "%.0f", _lastDisplayData.altitude);
myNex.setText(HOME_ELEVATION, data);
newDataSent = true;
}
#ifdef DEBUG_GPS_FIX_SKIPPED
//Adding the number of missed Gps fixes for debug
if (_lastDisplayData.missedFixCount != navData.missedFixCount || _pageChanged) {
_lastDisplayData.missedFixCount = navData.missedFixCount;
char data[10];
sprintf(data, "%lu", _lastDisplayData.missedFixCount);
myNex.setText(HOME_TEMPERATURE, data);
newDataSent = true;
}
#else
//-----------------------------
//Temperature
if (_lastDisplayData.temperature.current != navData.temperature.current || _pageChanged) {
_lastDisplayData.temperature = navData.temperature;
char data[10];
if(_lastDisplayData.temperature.currentValid){
sprintf(data, "%.1f\xB0 C", _lastDisplayData.temperature.current);
}
else {
sprintf(data, "n.a");
}
myNex.setText(HOME_TEMPERATURE, data);
newDataSent = true;
}
#endif
return newDataSent;
}
//=================================================================================================================================================
//=================================================================================================================================================
// PAGE 1 --- TIME
//=================================================================================================================================================
//=================================================================================================================================================
bool NextionDisplay::refreshPage1(const NavData &navData) {
bool newDataSent = false;
//-----------------------------
//Date and time
if (_lastDisplayData.date != navData.date || _lastDisplayData.timeUTC != navData.timeUTC || _pageChanged)
{
_lastDisplayData.date = navData.date;
_lastDisplayData.timeUTC = navData.timeUTC;
char data[20];
if(_lastDisplayData.date.month == 0) _lastDisplayData.date.month = 1;
sprintf(data, "%02d %s %02d:%02d", _lastDisplayData.date.day, _months[_lastDisplayData.date.month - 1], _lastDisplayData.timeUTC.hours, _lastDisplayData.timeUTC.minutes);
myNex.setText(TIME_CLOCK, data);
newDataSent = true;
}
//-----------------------------
//Total trip time
if (_lastDisplayData.totalTime != navData.totalTime || _pageChanged) {
_lastDisplayData.totalTime = navData.totalTime;
char data[6];
sprintf(data, "%02d:%02d", _lastDisplayData.totalTime.hours, _lastDisplayData.totalTime.minutes);
myNex.setText(TIME_TRIP, data);
newDataSent = true;
}
//-----------------------------
//Moving time
if (_lastDisplayData.movingTime != navData.movingTime || _pageChanged) {
_lastDisplayData.movingTime = navData.movingTime;
char data[6];
sprintf(data, "%02d:%02d", _lastDisplayData.movingTime.hours, _lastDisplayData.movingTime.minutes);
myNex.setText(TIME_MOVING, data);
newDataSent = true;
}
//-----------------------------
//Total stopped time
if (_lastDisplayData.totalStoppedTime != navData.totalStoppedTime || _pageChanged) {
_lastDisplayData.totalStoppedTime = navData.totalStoppedTime;
char data[6];
sprintf(data, "%02d:%02d", _lastDisplayData.totalStoppedTime.hours, _lastDisplayData.totalStoppedTime.minutes);
myNex.setText(TIME_STOPPED, data);
newDataSent = true;
}
//-----------------------------
//Last stopped time
if (_lastDisplayData.lastStoppedTime != navData.lastStoppedTime || _pageChanged) {
_lastDisplayData.lastStoppedTime = navData.lastStoppedTime;
char data[6];
sprintf(data, "%02d:%02d", _lastDisplayData.lastStoppedTime.hours, _lastDisplayData.lastStoppedTime.minutes);
myNex.setText(TIME_LAST_STOP, data);
newDataSent = true;
}
//-----------------------------
//Sunrise and Sunset
if (_pageChanged) {
myNex.setText(TIME_DAWN, navData.sunrise);
myNex.setText(TIME_DUSK, navData.sunset);
newDataSent = true;
}
return newDataSent;
}
//=================================================================================================================================================
//=================================================================================================================================================
// PAGE 2 --- SPEED
//=================================================================================================================================================
//=================================================================================================================================================
bool NextionDisplay::refreshPage2(const NavData &navData) {
bool newDataSent = false;
//-----------------------------
//Speed
if (_lastDisplayData.speed != navData.speed || _pageChanged) {
_lastDisplayData.speed = navData.speed;
char data[8];
sprintf(data, "%.1f", _lastDisplayData.speed);
myNex.setText(SPEED_CURRENT, data);
newDataSent = true;
}
//-----------------------------
//Max speed
if (_lastDisplayData.speedMax != navData.speedMax || _pageChanged) {
_lastDisplayData.speedMax = navData.speedMax;
char data[8];
sprintf(data, "%.1f", _lastDisplayData.speedMax);
myNex.setText(SPEED_MAX, data);
newDataSent = true;
}
//-----------------------------
//Moving average speed
if (_lastDisplayData.speedMovingAvg != navData.speedMovingAvg || _pageChanged) {
_lastDisplayData.speedMovingAvg = navData.speedMovingAvg;
char data[8];
sprintf(data, "%.1f", _lastDisplayData.speedMovingAvg);
myNex.setText(SPEED_AVG_MOVING, data);
newDataSent = true;
}
//-----------------------------
//Totale average speed (moving and not moving time)
if (_lastDisplayData.speedTotalAvg != navData.speedTotalAvg || _pageChanged) {
_lastDisplayData.speedTotalAvg = navData.speedTotalAvg;
char data[8];
sprintf(data, "%.1f", _lastDisplayData.speedTotalAvg);
myNex.setText(SPEED_AVG_TOTAL, data);
newDataSent = true;
}
return newDataSent;
}
//=================================================================================================================================================
//=================================================================================================================================================
// PAGE 3 --- ALTITUDE
//=================================================================================================================================================
//=================================================================================================================================================
bool NextionDisplay::refreshPage3(const NavData &navData) {
bool newDataSent = false;
//-----------------------------
//Current altitude
if (_lastDisplayData.altitude != navData.altitude || _pageChanged) {
_lastDisplayData.altitude = navData.altitude;
char data[6];
sprintf(data, "%.0f", _lastDisplayData.altitude);
myNex.setText(ELEVATION_CURRENT, data);
//int value = map(_lastDisplayData.altitude, 0, 5000, 0, 200);
//char dataChart[15];
//sprintf(dataChart, "add 13,0,%d", value);
//myNex.sendCommand(dataChart);
//Update chart altitude
/*ChartRenderer::point_g point;
point.value = (int)_lastDisplayData.altitude;
point.minutes = (int)_lastDisplayData.timeUTC.minutes;
chartAltitude.update(point);*/
newDataSent = true;
}
//-----------------------------
//Altitude max
if(_lastDisplayData.altitudeMax != navData.altitudeMax || _pageChanged){
_lastDisplayData.altitudeMax = navData.altitudeMax;
char data[6];
sprintf(data, "%.0f", _lastDisplayData.altitudeMax);
myNex.setText(ELEVATION_MAX, data);
newDataSent = true;
}
//-----------------------------
//Altitude min
if(_lastDisplayData.altitudeMin != navData.altitudeMin || _pageChanged){
_lastDisplayData.altitudeMin = navData.altitudeMin;
char data[6];
sprintf(data, "%.0f", _lastDisplayData.altitudeMin);
myNex.setText(ELEVATION_MIN, data);
newDataSent = true;
}
return newDataSent;
}
//=================================================================================================================================================
//=================================================================================================================================================
// PAGE 4 --- LOCATION
//=================================================================================================================================================
//=================================================================================================================================================
bool NextionDisplay::refreshPage4(const NavData &navData) {
bool newDataSent = false;
//-----------------------------
//Latitude
if(_lastDisplayData.latitudeDMS != navData.latitudeDMS || _pageChanged){
_lastDisplayData.latitudeDMS = navData.latitudeDMS;
char data[20];
//Coordinates in DMS format
sprintf(data, "%c %02d\xB0 %02d' %.2f''", _lastDisplayData.latitudeDMS.NS, _lastDisplayData.latitudeDMS.degrees, _lastDisplayData.latitudeDMS.minutes, _lastDisplayData.latitudeDMS.seconds);
myNex.setText(LOCATION_LATITUDE, data);
newDataSent = true;
}
//-----------------------------
//Longitude
if (_lastDisplayData.longitudeDMS != navData.longitudeDMS || _pageChanged) {
_lastDisplayData.longitudeDMS = navData.longitudeDMS;
char data[20];
//Coordinates in DMS format
sprintf(data, "%c%03d\xB0 %02d' %.2f''", _lastDisplayData.longitudeDMS.EW, _lastDisplayData.longitudeDMS.degrees, _lastDisplayData.longitudeDMS.minutes, _lastDisplayData.longitudeDMS.seconds);
myNex.setText(LOCATION_LONGITUDE, data);
newDataSent = true;
}
//-----------------------------
//Odometer
if (_lastDisplayData.distanceTotalKm != navData.distanceTotalKm || _pageChanged) {
_lastDisplayData.distanceTotalKm = navData.distanceTotalKm;
char data[9];
sprintf(data, "%.1f", (_lastDisplayData.distanceTotalKm < 1) ? _lastDisplayData.distanceTotalKm * 1000 : _lastDisplayData.distanceTotalKm);
myNex.setText(LOCATION_ODOMETER, data);
newDataSent = true;
}
//-----------------------------
//Distance from home (straight line)
if (_lastDisplayData.distanceFromHome != navData.distanceFromHome || _pageChanged) {
_lastDisplayData.distanceFromHome = navData.distanceFromHome;
char data[9];
sprintf(data, "%.1f", _lastDisplayData.distanceFromHome);
myNex.setText(LOCATION_HOME_DISTANCE, data);
newDataSent = true;
}
//-----------------------------
//Heading
if((int)_lastDisplayData.heading != (int)navData.heading || _pageChanged){
_lastDisplayData.heading = navData.heading;
char data[5];
sprintf(data, "%d\xB0", (int)_lastDisplayData.heading);
myNex.setText(LOCATION_HEADING, data);
newDataSent = true;
}
//-----------------------------
//Number of satellites
if (_lastDisplayData.satellites != navData.satellites || _pageChanged) {
_lastDisplayData.satellites = navData.satellites;
char data[3];
sprintf(data, "%02d", _lastDisplayData.satellites);
myNex.setText(LOCATION_SATELLITES, data);
newDataSent = true;
}
return newDataSent;
}
//=================================================================================================================================================
//=================================================================================================================================================
// PAGE 5 --- GPS SETTINGS
//=================================================================================================================================================
//=================================================================================================================================================
bool NextionDisplay::refreshPage5(const NavData &navData){
bool newDataSent = false;
//if (_lastDisplayData.gpsUpdateRate != navData.gpsUpdateRate || _pageChanged) {
_lastDisplayData.gpsUpdateRate = navData.gpsUpdateRate;
myNex.setNumber(SETTINGS_GPS_RATE, (uint32_t)navData.gpsUpdateRate);
newDataSent = true;
//}
//if (_lastDisplayData.gpsDynamicPlatform != navData.gpsDynamicPlatform || _pageChanged) {
_lastDisplayData.gpsDynamicPlatform = navData.gpsDynamicPlatform;
myNex.setNumber(SETTINGS_GPS_PLATFORM, (uint32_t)navData.gpsDynamicPlatform);
newDataSent = true;
//}
//if (_lastDisplayData.gpsTrackingMode != navData.gpsTrackingMode || _pageChanged) {
_lastDisplayData.gpsTrackingMode = navData.gpsTrackingMode;
myNex.setNumber(SETTINGS_GPS_MODE, (uint32_t)navData.gpsTrackingMode);
newDataSent = true;
//}
//if (_lastDisplayData.gpsFixTargetDistance != navData.gpsFixTargetDistance || _pageChanged) {
_lastDisplayData.gpsFixTargetDistance = navData.gpsFixTargetDistance;
myNex.setNumber(SETTINGS_GPS_METERS, (uint32_t)navData.gpsFixTargetDistance);
newDataSent = true;
//}
return newDataSent;
}
//=================================================================================================================================================
//=================================================================================================================================================
// PAGE 6 --- COMPASS
//=================================================================================================================================================
//=================================================================================================================================================
bool NextionDisplay::refreshPage6(const NavData &navData){
bool newDataSent = false;
//-----------------------------
//Bearing
if (_lastDisplayData.relativeBearing != navData.relativeBearing || _pageChanged) {
_lastDisplayData.relativeBearing = navData.relativeBearing;
uint32_t val = (uint32_t)navData.relativeBearing;
if(val == 0) val = 360;
val += 13; //Add the offset ID of the images in the Nextion display IDE
myNex.setNumber(COMPASS_DEGREES, val);
newDataSent = true;
}
//-----------------------------
//Speed
if (_lastDisplayData.speed != navData.speed || _pageChanged) {
_lastDisplayData.speed = navData.speed;
char data[8];
sprintf(data, "%.0f", _lastDisplayData.speed);
myNex.setText(COMPASS_SPEED, data);
newDataSent = true;
}
//-----------------------------
//Distance from waypoint
if (_lastDisplayData.distanceWaypoint != navData.distanceWaypoint || _pageChanged) {
_lastDisplayData.distanceWaypoint = navData.distanceWaypoint;
char data[9];
sprintf(data, "%.1f", (_lastDisplayData.distanceWaypoint * 1000));
myNex.setText(COMPASS_DISTANCE, data);
newDataSent = true;
}
return newDataSent;
}
//=================================================================================================================================================
//=================================================================================================================================================
// PAGE 7 --- MAP
//=================================================================================================================================================
//=================================================================================================================================================
bool NextionDisplay::refreshPage7(const NavData &navData){
bool newDataSent = false;
if (_lastDisplayData.mapData != navData.mapData || _pageChanged) {
_lastDisplayData.mapData = navData.mapData;
myNex.setNumber(MAP_PIN_X, (uint32_t)navData.mapData.x);
myNex.setNumber(MAP_PIN_Y, (uint32_t)navData.mapData.y);
myNex.setNumber(MAP_TILE_ID, (uint32_t)navData.mapData.tileId);
newDataSent = true;
}
return newDataSent;
}
//=================================================================================================================================================
//=================================================================================================================================================
// PAGE 8 --- HEALTH
//=================================================================================================================================================
//=================================================================================================================================================
bool NextionDisplay::refreshPage8(const NavData &navData){
bool newDataSent = false;
if (_lastDisplayData.heart.bpm != navData.heart.bpm || _pageChanged) {
_lastDisplayData.heart.bpm = navData.heart.bpm;
char data[4];
sprintf(data, "%d", (_lastDisplayData.heart.bpm));
myNex.setText(HEALTH_HEART_BPM, data);
newDataSent = true;
}
if (_lastDisplayData.heart.bpmMax != navData.heart.bpmMax || _pageChanged) {
_lastDisplayData.heart.bpmMax = navData.heart.bpmMax;
char data[4];
sprintf(data, "%d", (_lastDisplayData.heart.bpmMax));
myNex.setText(HEALTH_HEART_MAX, data);
newDataSent = true;
}
if (_lastDisplayData.heart.bpmMin != navData.heart.bpmMin || _pageChanged) {
_lastDisplayData.heart.bpmMin = navData.heart.bpmMin;
char data[4];
sprintf(data, "%d", (_lastDisplayData.heart.bpmMin));
myNex.setText(HEALTH_HEART_MIN, data);
newDataSent = true;
}
return newDataSent;
}
| 37.843844
| 194
| 0.550429
|
Gbertaz
|
bc7baf3894d834a5c2a825e6de0785025cd57eb5
| 7,908
|
cpp
|
C++
|
utillib/basenode.cpp
|
ahuachen/ethslurp
|
bc7354cc03599eaa82fdc431f7adc8b223619fc1
|
[
"MIT"
] | 3
|
2020-12-29T16:10:55.000Z
|
2021-12-20T19:13:11.000Z
|
utillib/basenode.cpp
|
ahuachen/ethslurp
|
bc7354cc03599eaa82fdc431f7adc8b223619fc1
|
[
"MIT"
] | null | null | null |
utillib/basenode.cpp
|
ahuachen/ethslurp
|
bc7354cc03599eaa82fdc431f7adc8b223619fc1
|
[
"MIT"
] | 3
|
2017-10-08T00:43:04.000Z
|
2021-12-20T19:13:16.000Z
|
/*--------------------------------------------------------------------------------
The MIT License (MIT)
Copyright (c) 2016 Great Hill Corporation
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 "basetypes.h"
#include "basenode.h"
//--------------------------------------------------------------------------------
ghRuntimeClass CBaseNode::classCBaseNode;
static CBuiltIn _biBaseNode(&CBaseNode::classCBaseNode, "CBaseNode", sizeof(CBaseNode), NULL, NULL, NO_SCHEMA);
//--------------------------------------------------------------------------------
CBaseNode::CBaseNode(void)
{
Init();
}
//--------------------------------------------------------------------------------
CBaseNode::~CBaseNode(void)
{
ASSERT(m_refCount==0);
}
//--------------------------------------------------------------------------------
void CBaseNode::Init(void)
{
m_refCount = 0;
m_deleted = FALSE;
m_schema = NO_SCHEMA;
m_showing = TRUE;
}
//--------------------------------------------------------------------------------
void CBaseNode::Copy(const CBaseNode& bn)
{
m_refCount = bn.m_refCount;
m_deleted = bn.m_deleted;
m_schema = bn.m_schema;
m_showing = bn.m_showing;
}
//--------------------------------------------------------------------------------
void CBaseNode::Reference(void)
{
m_refCount++;
}
//--------------------------------------------------------------------------------
SFInt32 CBaseNode::Dereference(void)
{
ASSERT(m_RefCount>0);
m_refCount--;
return (m_refCount==0);
}
//--------------------------------------------------------------------------------
SFBool CBaseNode::isReferenced(void) const
{
return (m_refCount);
}
//--------------------------------------------------------------------------------
SFBool CBaseNode::isDeleted(void) const
{
return (m_deleted);
}
//--------------------------------------------------------------------------------
void CBaseNode::setDeleted(SFBool del)
{
m_deleted = del;
}
//--------------------------------------------------------------------------------
SFInt32 CBaseNode::getSchema(void) const
{
return (m_schema);
}
//--------------------------------------------------------------------------------
SFBool CBaseNode::isShowing(void) const
{
return (m_showing);
}
//--------------------------------------------------------------------------------
void CBaseNode::setSchema(SFBool val)
{
m_schema = val;
}
//--------------------------------------------------------------------------------
void CBaseNode::setShowing(SFBool val)
{
m_showing = val;
}
//--------------------------------------------------------------------------------
SFBool CBaseNode::isKindOf(const ghRuntimeClass* pClass) const
{
ghRuntimeClass* pClassThis = getRuntimeClass();
return pClassThis->IsDerivedFrom(pClass);
}
//--------------------------------------------------------------------------------
ghRuntimeClass* CBaseNode::getRuntimeClass() const
{
return &CBaseNode::classCBaseNode;
}
//--------------------------------------------------------------------------------
SFString addIcon(ghRuntimeClass *pClass)
{
CBaseNode *node = pClass->CreateObject();
SFString fmt = SFString("[<table><td><td>Add ") + toLower(SFString(pClass->getClassNamePtr()).Mid(1,100)) + ": {ADD}</td></tr></table>]";
SFString ret = node->Format(fmt);
delete node;
return ret;
}
//--------------------------------------------------------------------------------
SFString CBaseNode::defaultFormat(void) const
{
SFString ret;
CFieldList *fieldList = getRuntimeClass()->GetFieldList();
if (fieldList)
{
LISTPOS lPos = fieldList->SFList<CFieldData *>::GetHeadPosition();
while (lPos)
{
CFieldData *field = fieldList->GetNextItem(lPos);
if (!field->isHidden())
ret += "["+toProper(field->getFieldName())+": {"+toUpper(field->getFieldName())+"}\n]";
}
} else
{
fprintf(stderr,"No fieldList. Did you register the class? Quitting...\n");
exit(0);
}
return ret;
}
//--------------------------------------------------------------------------------
char *CBaseNode::parseCSV(char *s, SFInt32& nFields, const SFString *fields)
{
nFields = 0;
typedef enum { OUTSIDE=0, INSIDE } parseState;
parseState state = OUTSIDE;
char *fieldVal=NULL;
while (*s)
{
switch (state)
{
case OUTSIDE:
if (*s=='\"')
{
state = INSIDE;
fieldVal=s+1;
} else if (*s=='\n')
{
return (s+1);
}
s++;
break;
case INSIDE:
if (*s == '\"')
{
*s = '\0';
if (!this->setValueByName(fields[nFields++], fieldVal))
{
// fprintf(stderr,"Bad field name %s. Quitting...", (const char*)fields[nFields-1]);
// return NULL;
}
fieldVal = NULL;
state = OUTSIDE;
}
s++;
break;
}
}
return NULL;
}
//--------------------------------------------------------------------------------
char *CBaseNode::parseJson(char *s, SFInt32& nFields)
{
typedef enum { OUTSIDE=0, IN_NAME, IN_VALUE } parseState;
parseState state = OUTSIDE;
char *fieldName=NULL;
char *fieldVal=NULL;
while (*s)
{
switch (state)
{
case OUTSIDE:
if (*s=='{')
state = IN_NAME;
s++;
break;
case IN_NAME:
if (!fieldName)
{
fieldName = s;
} else if (*s == ':')
{
state = IN_VALUE;
*s = '\0';
// printf("fn: %-10.10s fv: %-40.40s ---> %-60.60s\n" , fieldName, fieldVal, (s+1));
}
s++;
break;
case IN_VALUE:
fieldVal = s;
if (*s=='[') // array skip to end of array
{
fieldVal++;
while (*s && *s!=']')
s++;
} else
{
while (*s && *s!=',' && *s!='}')
s++;
}
*s = '\0';
// printf("fn: %-10.10s fv: %-40.40s ---> %-60.60s\n" , fieldName, fieldVal, (s+1));
nFields += this->setValueByName(fieldName, fieldVal);
fieldName = NULL;
fieldVal = NULL;
state = IN_NAME;
s++;
if (*s && *s==',')
s++;
if (*s && (*s=='{'||*s==']'))
{
finishParse();
return s;
}
break;
}
}
finishParse();
return NULL;
}
//--------------------------------------------------------------------------------
char *cleanUpJson(char *s)
{
if (!s)
return s;
char *l = s, *start = s;
while (*s)
{
if (!isWhiteSpace(*s) && *s != '\"') // zap all the white space and quotes
{
*l = *s;
l++;
}
s++;
}
*l = '\0';
return start;
}
#include "sfarchive.h"
//---------------------------------------------------------------------------
SFBool CBaseNode::SerializeHeader(SFArchive& archive)
{
if (archive.m_isReading)
{
SFString str;
archive >> m_deleted;
archive >> m_schema;
archive >> m_showing;
archive >> str; ASSERT(str == getRuntimeClass()->getClassNamePtr());
} else
{
if (m_deleted && !archive.writeDeleted())
return FALSE;
archive << m_deleted;
archive << m_schema;
archive << m_showing;
archive << getRuntimeClass()->getClassNamePtr();
}
return TRUE;
}
| 25.025316
| 138
| 0.484446
|
ahuachen
|
bc815f9396a23f69d18679f7ed8f5d31e0479101
| 2,577
|
hh
|
C++
|
hackt_docker/hackt/src/Object/ref/meta_value_reference.hh
|
broken-wheel/hacktist
|
36e832ae7dd38b27bca9be7d0889d06054dc2806
|
[
"MIT"
] | null | null | null |
hackt_docker/hackt/src/Object/ref/meta_value_reference.hh
|
broken-wheel/hacktist
|
36e832ae7dd38b27bca9be7d0889d06054dc2806
|
[
"MIT"
] | null | null | null |
hackt_docker/hackt/src/Object/ref/meta_value_reference.hh
|
broken-wheel/hacktist
|
36e832ae7dd38b27bca9be7d0889d06054dc2806
|
[
"MIT"
] | null | null | null |
/**
\file "Object/ref/meta_value_reference.hh"
$Id: meta_value_reference.hh,v 1.7 2010/01/03 01:34:43 fang Exp $
*/
#ifndef __HAC_OBJECT_REF_META_VALUE_REFERENCE_H__
#define __HAC_OBJECT_REF_META_VALUE_REFERENCE_H__
#include "util/macros.h"
#include "Object/ref/meta_value_reference_base.hh"
#include "Object/traits/class_traits_fwd.hh"
#include "util/memory/count_ptr.hh"
#include "util/boolean_types.hh"
namespace HAC {
namespace entity {
class const_param;
class unroll_context;
using util::good_bool;
using util::bad_bool;
using util::memory::count_ptr;
//=============================================================================
#define META_VALUE_REFERENCE_TEMPLATE_SIGNATURE template <class Tag>
#define META_VALUE_REFERENCE_CLASS meta_value_reference<Tag>
/**
Base class for simple and aggregate (member?)
parameter value references.
*/
META_VALUE_REFERENCE_TEMPLATE_SIGNATURE
class meta_value_reference :
public meta_value_reference_base,
public class_traits<Tag>::expr_base_type {
typedef META_VALUE_REFERENCE_CLASS this_type;
typedef class_traits<Tag> traits_type;
public:
typedef typename traits_type::expr_base_type
expr_base_type;
typedef expr_base_type interface_type;
typedef typename traits_type::const_collection_type
const_collection_type;
typedef typename traits_type::value_reference_collection_type
value_reference_collection_type;
typedef count_ptr<const interface_type> init_arg_type;
protected:
meta_value_reference() :
meta_value_reference_base(), expr_base_type() { }
public:
virtual ~meta_value_reference();
virtual ostream&
what(ostream&) const = 0;
virtual ostream&
dump(ostream&, const expr_dump_context&) const = 0;
virtual bad_bool
unroll_lvalue_references(const unroll_context&,
value_reference_collection_type&) const = 0;
/**
Equivalent of bind/mem_fun/compose/dereference...
*/
struct unroll_resolver {
const unroll_context& _context;
explicit
unroll_resolver(const unroll_context& c) : _context(c) { }
/**
\param p pointer to this_type (non-NULL).
*/
template <class P>
count_ptr<const const_param>
operator () (const P& p) const {
NEVER_NULL(p);
return p->unroll_resolve_rvalues(_context, p);
}
}; // end struct unroll_resolve_rvaluesr
virtual void
collect_transient_info(persistent_object_manager&) const = 0;
}; // end class meta_value_reference
//=============================================================================
} // end namespace entity
} // end namespace HAC
#endif // __HAC_OBJECT_REF_META_VALUE_REFERENCE_H__
| 27.709677
| 79
| 0.734575
|
broken-wheel
|
bc85665eca9e378d287694242eeca203c91a1d59
| 3,206
|
hpp
|
C++
|
Source/Utility/String/Format/Impl/ToStringImpl.hpp
|
KingKiller100/kLibrary
|
37971acd3c54f9ea0decdf78b13e47c935d4bbf0
|
[
"Apache-2.0"
] | null | null | null |
Source/Utility/String/Format/Impl/ToStringImpl.hpp
|
KingKiller100/kLibrary
|
37971acd3c54f9ea0decdf78b13e47c935d4bbf0
|
[
"Apache-2.0"
] | null | null | null |
Source/Utility/String/Format/Impl/ToStringImpl.hpp
|
KingKiller100/kLibrary
|
37971acd3c54f9ea0decdf78b13e47c935d4bbf0
|
[
"Apache-2.0"
] | null | null | null |
#pragma once
#include "../FormatSymbols.hpp"
#include "../kStringIdentity.hpp"
#include "../../Tricks/kStringData.hpp"
#include "../../../../TypeTraits/StringTraits.hpp"
#include "../../../../TypeTraits/ConditionalReference.hpp"
#include <string>
namespace klib::kString::secret::impl
{
template<class Char_t>
USE_RESULT constexpr size_t FindOpenerPosition(const std::basic_string<Char_t>& outFmt, const size_t argIndex, const size_t offset)
{
using namespace stringify;
using Str_t = std::basic_string<Char_t>;
constexpr size_t npos = type_trait::g_NoPos<Str_t>;
const auto data = outFmt.data();
Char_t buff[5]{ Char_t(), Char_t(), Char_t(), format::g_CloserSymbol<Char_t> }; // '{' 'x' 'x' '}/:' '\0'
Char_t* const pCloser = std::end(buff) - 2;
Char_t* searchStr = pCloser;
searchStr = stringify::UintToStr(searchStr, argIndex, 10);
*(--searchStr) = format::g_OpenerSymbol<Char_t>;
size_t openerPos = Find(data, searchStr, offset);
if (openerPos != npos)
return openerPos;
openerPos = Find(data, searchStr, 0);
if (openerPos != npos)
return openerPos;
*pCloser = format::g_SpecifierSymbol<Char_t>;
openerPos = Find(data, searchStr, offset);
if (openerPos != npos)
return openerPos;
openerPos = Find(data, searchStr, 0);
return openerPos;
}
template<class Char_t>
constexpr void ToStringImpl(const std::basic_string<Char_t>&, const size_t, const size_t)
{}
template<class Char_t, typename T, typename ...Ts>
constexpr void ToStringImpl(std::basic_string<Char_t>& outFmt, const size_t argIndex, const size_t offset, type_trait::SizeCondConstRef_t<T> arg, type_trait::SizeCondConstRef_t<Ts> ...argPack)
{
using namespace stringify;
using Str_t = std::basic_string<Char_t>;
constexpr auto npos = type_trait::g_NoPos<Str_t>;
try
{
size_t openerPos = FindOpenerPosition(outFmt, argIndex, offset);
size_t closerPos = Find_First_Of(GetData(outFmt), format::g_CloserSymbol<Char_t>, openerPos);
const auto initialOpenerPos = openerPos;
size_t repSize = 0;
while (openerPos != npos && closerPos != npos)
{
const auto infoSize = closerPos - openerPos;
const size_t colonPos = Find_First_Of(GetData(outFmt), format::g_SpecifierSymbol<Char_t>, openerPos);
StringWriter<Char_t> specifier;
if (openerPos < colonPos
&& closerPos > colonPos)
{
const auto startPos = colonPos + 1;
const auto count = closerPos - startPos;
specifier = outFmt.substr(startPos, count);
}
const auto replacement = Identity<Char_t, T>::MakeStr(arg, specifier);
repSize = GetSize(replacement);
outFmt.erase(openerPos, infoSize + 1);
outFmt.insert(openerPos, GetData(replacement), repSize);
if constexpr(type_trait::Is_CString_V<decltype(replacement)>)
{
delete[] replacement;
}
openerPos = FindOpenerPosition(outFmt, argIndex, openerPos + repSize);
if (openerPos != npos)
closerPos = Find_First_Of(GetData(outFmt), format::g_CloserSymbol<Char_t>, openerPos);
}
ToStringImpl<Char_t, Ts...>(outFmt, argIndex + 1, initialOpenerPos + repSize, argPack...);
}
catch (const std::exception& e)
{
throw kDebug::FormatError(e.what());
}
}
}
| 30.826923
| 193
| 0.700561
|
KingKiller100
|
bc86d3a39d5aef7ee301ba852fd3d762f4e283f1
| 1,089
|
cc
|
C++
|
benchmarks/rlpBenchmark.cc
|
ketlller/UniswapSniperBot
|
b5a508660ad133348ec74a48758b431529bf2d3e
|
[
"MIT"
] | 127
|
2021-05-03T15:04:50.000Z
|
2022-03-28T02:26:43.000Z
|
benchmarks/rlpBenchmark.cc
|
brianleect/UniswapSniperBot
|
c04c225ffb08a69e8beb5db20ff4497995eea50c
|
[
"MIT"
] | 2
|
2021-05-14T10:07:58.000Z
|
2021-07-15T20:53:02.000Z
|
benchmarks/rlpBenchmark.cc
|
brianleect/UniswapSniperBot
|
c04c225ffb08a69e8beb5db20ff4497995eea50c
|
[
"MIT"
] | 56
|
2021-05-05T00:13:07.000Z
|
2022-03-08T13:24:15.000Z
|
#include <benchmark/benchmark.h>
#include <rlp.hpp>
#include <utils.hpp>
static void encodeLength(benchmark::State &state) {
Utils::Byte output[2];
for(auto _ : state) {
benchmark::DoNotOptimize(RLP::encodeLength(255, 0x80, output));
}
}
static void encodeItem(benchmark::State &state) {
Utils::Byte buffer[255];
memset(buffer, 0xFF, 255);
RLP::Item item {
.buffer = buffer,
.length = 255,
};
Utils::Byte output[2 + 255];
for(auto _ : state) {
benchmark::DoNotOptimize(RLP::encodeItem(&item, output));
}
}
static void encodeList(benchmark::State &state) {
Utils::Byte buffer[255];
memset(buffer, 0xFF, 255);
RLP::Item item {
.buffer = buffer,
.length = 255,
};
RLP::Item items[] = { item, item, item, item, item, item, item, item, item };
Utils::Byte output[9 + (2 + 255) * 9];
for(auto _ : state) {
benchmark::DoNotOptimize(RLP::encodeList(items, 9, output));
}
}
BENCHMARK(encodeLength)->Name("RLP::encodeLength");
BENCHMARK(encodeItem)->Name("RLP::encodeItem");
BENCHMARK(encodeList)->Name("RLP::encodeList");
| 21.78
| 79
| 0.650138
|
ketlller
|
bc8a9766c483c11e04a8daa1c827e4f7af8d9aa1
| 1,517
|
cpp
|
C++
|
leetcode/medium/764. Largest Plus Sign.cpp
|
fpdjsns/Algorithm
|
0128da7c333d0c065f6d266d9e6dce4a91842525
|
[
"MIT"
] | 7
|
2019-08-05T14:49:41.000Z
|
2022-03-13T07:10:51.000Z
|
leetcode/medium/764. Largest Plus Sign.cpp
|
fpdjsns/Algorithm
|
0128da7c333d0c065f6d266d9e6dce4a91842525
|
[
"MIT"
] | null | null | null |
leetcode/medium/764. Largest Plus Sign.cpp
|
fpdjsns/Algorithm
|
0128da7c333d0c065f6d266d9e6dce4a91842525
|
[
"MIT"
] | 4
|
2021-01-04T03:45:22.000Z
|
2021-10-06T06:11:00.000Z
|
/**
* problem : https://leetcode.com/problems/largest-plus-sign/
* time/space complexity : O(N^2)
*/
class Solution {
public:
int orderOfLargestPlusSign(int n, vector<vector<int>>& mines) {
set<pair<int,int>> zeros;
for(auto mine: mines){
zeros.insert({mine[0], mine[1]});
}
vector<vector<int>> row(n, vector<int>(n,0));
vector<vector<int>> reverseRow(n, vector<int>(n,0));
vector<vector<int>> col(n, vector<int>(n,0));
vector<vector<int>> reverseCol(n, vector<int>(n,0));
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
if(zeros.find({i,j}) == zeros.end()){
row[i][j] = row[max(0, i-1)][j] + 1;
col[i][j] = col[i][max(0, j-1)] + 1;
}
}
}
for(int i=n-1; i>=0; i--){
for(int j=n-1; j>=0; j--){
if(zeros.find({i,j}) == zeros.end()){
reverseRow[i][j] = reverseRow[min(n-1, i+1)][j] + 1;
reverseCol[i][j] = reverseCol[i][min(n-1, j+1)] + 1;
}
}
}
int answer = 0;
for(int i=0; i<n; i++){
for(int j=0; j<n; j++) {
int tmp = min(row[i][j], reverseRow[i][j]);
tmp = min(col[i][j], tmp);
tmp = min(reverseCol[i][j], tmp);
answer = max(tmp, answer);
}
}
return answer;
}
};
| 31.604167
| 72
| 0.415293
|
fpdjsns
|
bc91d1fb6aa5593096062f38c9d28d40da5323b8
| 10,526
|
cpp
|
C++
|
leven/src/compute_csg.cpp
|
nickgildea/leven
|
118bf1cacb75fdb3b306ccf27477037720af86e8
|
[
"Unlicense"
] | 92
|
2017-10-08T17:26:12.000Z
|
2022-03-31T04:27:41.000Z
|
leven/src/compute_csg.cpp
|
nickgildea/leven
|
118bf1cacb75fdb3b306ccf27477037720af86e8
|
[
"Unlicense"
] | 1
|
2021-02-11T01:12:19.000Z
|
2021-02-11T01:12:19.000Z
|
leven/src/compute_csg.cpp
|
nickgildea/leven
|
118bf1cacb75fdb3b306ccf27477037720af86e8
|
[
"Unlicense"
] | 10
|
2018-01-13T14:13:52.000Z
|
2021-12-23T00:44:36.000Z
|
#include "compute_local.h"
#include "compute_program.h"
#include "volume_constants.h"
#include "volume_materials.h"
#include <Remotery.h>
#include <sstream>
// ----------------------------------------------------------------------------
int ApplyCSGOperations(
MeshGenerationContext* meshGen,
const std::vector<CSGOperationInfo>& opInfo,
const glm::ivec3& clipmapNodeMin,
const int clipmapNodeSize,
GPUDensityField& field)
{
rmt_ScopedCPUSample(ApplyCSGOperations);
if (opInfo.empty())
{
return CL_SUCCESS;
}
const cl_int4 fieldOffset = LeafScaleVec(clipmapNodeMin);
const int sampleScale = clipmapNodeSize / (LEAF_SIZE_SCALE * meshGen->voxelsPerChunk);
std::vector<CSGOperationInfo> fuckSake = opInfo;
cl::Buffer d_operations;
CL_CALL(CreateBuffer(CL_MEM_READ_ONLY, sizeof(CSGOperationInfo) * opInfo.size(), &fuckSake[0], d_operations));
auto ctx = GetComputeContext();
int index = 0;
u32 numUpdatedPoints = 0;
cl::Buffer d_compactUpdatedPoints, d_compactUpdatedMaterials;
{
rmt_ScopedCPUSample(Apply);
const int fieldBufferSize = meshGen->fieldSize * meshGen->fieldSize * meshGen->fieldSize;
cl::Buffer d_updatedIndices(ctx->context, CL_MEM_READ_WRITE, fieldBufferSize * sizeof(int));
cl::Buffer d_updatedPoints(ctx->context, CL_MEM_READ_WRITE, fieldBufferSize * sizeof(glm::ivec4));
cl::Buffer d_updatedMaterials(ctx->context, CL_MEM_READ_WRITE, fieldBufferSize * sizeof(int));
index = 0;
cl::Kernel k_applyCSGOp(meshGen->csgProgram.get(), "CSG_HermiteIndices");
CL_CALL(k_applyCSGOp.setArg(index++, fieldOffset));
CL_CALL(k_applyCSGOp.setArg(index++, (u32)opInfo.size()));
CL_CALL(k_applyCSGOp.setArg(index++, d_operations));
CL_CALL(k_applyCSGOp.setArg(index++, sampleScale));
CL_CALL(k_applyCSGOp.setArg(index++, field.materials));
CL_CALL(k_applyCSGOp.setArg(index++, d_updatedIndices));
CL_CALL(k_applyCSGOp.setArg(index++, d_updatedPoints));
CL_CALL(k_applyCSGOp.setArg(index++, d_updatedMaterials));
const cl::NDRange applyCSGSize(meshGen->fieldSize, meshGen->fieldSize, meshGen->fieldSize);
CL_CALL(ctx->queue.enqueueNDRangeKernel(k_applyCSGOp, cl::NullRange, applyCSGSize, cl::NullRange));
cl::Buffer d_updatedIndicesScan(ctx->context, CL_MEM_READ_WRITE, fieldBufferSize * sizeof(int));
numUpdatedPoints = ExclusiveScan(ctx->queue, d_updatedIndices, d_updatedIndicesScan, fieldBufferSize);
if (numUpdatedPoints <= 0)
{
// < 0 will be an error code
return numUpdatedPoints;
}
// printf("# updated points: %d\n", numUpdatedPoints);
d_compactUpdatedPoints = cl::Buffer(ctx->context, CL_MEM_READ_WRITE, numUpdatedPoints * sizeof(glm::ivec4));
d_compactUpdatedMaterials = cl::Buffer(ctx->context, CL_MEM_READ_WRITE, numUpdatedPoints * sizeof(int));
index = 0;
cl::Kernel k_compact(meshGen->csgProgram.get(), "CompactPoints");
CL_CALL(k_compact.setArg(index++, d_updatedIndices));
CL_CALL(k_compact.setArg(index++, d_updatedPoints));
CL_CALL(k_compact.setArg(index++, d_updatedMaterials));
CL_CALL(k_compact.setArg(index++, d_updatedIndicesScan));
CL_CALL(k_compact.setArg(index++, d_compactUpdatedPoints));
CL_CALL(k_compact.setArg(index++, d_compactUpdatedMaterials));
CL_CALL(ctx->queue.enqueueNDRangeKernel(k_compact, cl::NullRange, fieldBufferSize, cl::NullRange));
index = 0;
cl::Kernel k_UpdateMaterials(meshGen->csgProgram.get(), "UpdateFieldMaterials");
CL_CALL(k_UpdateMaterials.setArg(index++, d_compactUpdatedPoints));
CL_CALL(k_UpdateMaterials.setArg(index++, d_compactUpdatedMaterials));
CL_CALL(k_UpdateMaterials.setArg(index++, field.materials));
CL_CALL(ctx->queue.enqueueNDRangeKernel(k_UpdateMaterials, cl::NullRange, numUpdatedPoints, cl::NullRange));
}
unsigned int numCreatedEdges = 0;
cl::Buffer d_createdEdges;
unsigned int numInvalidatedEdges = 0;
cl::Buffer d_invalidatedEdges;
{
rmt_ScopedCPUSample(Filter);
const int numGeneratedEdges = numUpdatedPoints * 6;
// printf("# generated edges: %d\n", numGeneratedEdges);
cl::Buffer d_generatedEdgeIndices(ctx->context, CL_MEM_READ_WRITE, numGeneratedEdges * sizeof(int));
cl::Kernel k_findUpdatedEdges(meshGen->csgProgram.get(), "FindUpdatedEdges");
CL_CALL(k_findUpdatedEdges.setArg(0, d_compactUpdatedPoints));
CL_CALL(k_findUpdatedEdges.setArg(1, d_generatedEdgeIndices));
CL_CALL(ctx->queue.enqueueNDRangeKernel(k_findUpdatedEdges, cl::NullRange, numUpdatedPoints, cl::NullRange));
// FindUpdatedEdges may generate an invalid edge when processing areas near the boundary,
// in this cause a -1 will be written instead of the edge index, so we remove these invalid
// indices via a scan and compact (not sure if the order of this and the subsequent
// RemoveDuplicates call matters performance wise?)
cl::Buffer d_edgeIndicesValid(ctx->context, CL_MEM_READ_WRITE, numGeneratedEdges * sizeof(int));
cl::Kernel k_removeInvalid(meshGen->csgProgram.get(), "RemoveInvalidIndices");
CL_CALL(k_removeInvalid.setArg(0, d_generatedEdgeIndices));
CL_CALL(k_removeInvalid.setArg(1, d_edgeIndicesValid));
CL_CALL(ctx->queue.enqueueNDRangeKernel(k_removeInvalid, cl::NullRange, numGeneratedEdges, cl::NullRange));
cl::Buffer d_compactEdgeIndices;
const int numCompactEdgeIndices = CompactIndexArray(ctx->queue, d_generatedEdgeIndices,
d_edgeIndicesValid, numGeneratedEdges, d_compactEdgeIndices);
if (numCompactEdgeIndices < 0)
{
// i.e. its an error code
return numCompactEdgeIndices;
}
d_invalidatedEdges = RemoveDuplicates(ctx->queue, d_compactEdgeIndices, numCompactEdgeIndices, &numInvalidatedEdges);
// printf("%d Generated %d unique\n", numGeneratedEdges, numInvalidatedEdges);
cl::Buffer d_edgeValidity(ctx->context, CL_MEM_READ_WRITE, numInvalidatedEdges * sizeof(int));
cl::Kernel k_FilterValid(meshGen->csgProgram.get(), "FilterValidEdges");
CL_CALL(k_FilterValid.setArg(0, d_invalidatedEdges));
CL_CALL(k_FilterValid.setArg(1, field.materials));
CL_CALL(k_FilterValid.setArg(2, d_edgeValidity));
CL_CALL(ctx->queue.enqueueNDRangeKernel(k_FilterValid, cl::NullRange, numInvalidatedEdges, cl::NullRange));
numCreatedEdges = CompactIndexArray(ctx->queue, d_invalidatedEdges,
d_edgeValidity, numInvalidatedEdges, d_createdEdges);
// printf("%d created edges\n", numCreatedEdges);
}
if (numInvalidatedEdges > 0 && field.numEdges > 0)
{
rmt_ScopedCPUSample(Prune);
cl::Buffer d_fieldEdgeValidity(ctx->context, CL_MEM_READ_WRITE, field.numEdges * sizeof(int));
cl::Kernel k_PruneEdges(meshGen->csgProgram.get(), "PruneFieldEdges");
CL_CALL(k_PruneEdges.setArg(0, field.edgeIndices));
CL_CALL(k_PruneEdges.setArg(1, d_invalidatedEdges));
CL_CALL(k_PruneEdges.setArg(2, numInvalidatedEdges));
CL_CALL(k_PruneEdges.setArg(3, d_fieldEdgeValidity));
CL_CALL(ctx->queue.enqueueNDRangeKernel(k_PruneEdges, cl::NullRange, field.numEdges, cl::NullRange));
cl::Buffer fieldEdgeScan(ctx->context, CL_MEM_READ_WRITE, field.numEdges * sizeof(int));
const int numPrunedEdges = ExclusiveScan(ctx->queue, d_fieldEdgeValidity, fieldEdgeScan, field.numEdges);
if (numPrunedEdges > 0)
{
cl::Buffer d_prunedEdgeIndices(ctx->context, CL_MEM_READ_WRITE, numPrunedEdges * sizeof(int));
cl::Buffer d_prunedNormals(ctx->context, CL_MEM_READ_WRITE, numPrunedEdges * sizeof(glm::vec4));
index = 0;
cl::Kernel k_CompactEdges(meshGen->csgProgram.get(), "CompactFieldEdges");
CL_CALL(k_CompactEdges.setArg(index++, d_fieldEdgeValidity));
CL_CALL(k_CompactEdges.setArg(index++, fieldEdgeScan));
CL_CALL(k_CompactEdges.setArg(index++, field.edgeIndices));
CL_CALL(k_CompactEdges.setArg(index++, field.normals));
CL_CALL(k_CompactEdges.setArg(index++, d_prunedEdgeIndices));
CL_CALL(k_CompactEdges.setArg(index++, d_prunedNormals));
CL_CALL(ctx->queue.enqueueNDRangeKernel(k_CompactEdges, cl::NullRange, field.numEdges, cl::NullRange));
field.numEdges = numPrunedEdges;
field.edgeIndices = d_prunedEdgeIndices;
field.normals = d_prunedNormals;
}
}
if (numCreatedEdges > 0)
{
rmt_ScopedCPUSample(Create);
cl::Buffer d_createdNormals = cl::Buffer(ctx->context, CL_MEM_READ_WRITE, numCreatedEdges * sizeof(glm::vec4));
index = 0;
cl::Kernel k_FindEdgeInfo(meshGen->csgProgram.get(), "FindEdgeIntersectionInfo");
CL_CALL(k_FindEdgeInfo.setArg(index++, fieldOffset));
CL_CALL(k_FindEdgeInfo.setArg(index++, (u32)opInfo.size()));
CL_CALL(k_FindEdgeInfo.setArg(index++, d_operations));
CL_CALL(k_FindEdgeInfo.setArg(index++, sampleScale));
CL_CALL(k_FindEdgeInfo.setArg(index++, d_createdEdges));
CL_CALL(k_FindEdgeInfo.setArg(index++, d_createdNormals));
CL_CALL(ctx->queue.enqueueNDRangeKernel(k_FindEdgeInfo, cl::NullRange, numCreatedEdges, cl::NullRange));
if (field.numEdges > 0)
{
const unsigned int oldSize = field.numEdges;
const unsigned int newSize = oldSize + numCreatedEdges;
cl::Buffer combinedEdges(ctx->context, CL_MEM_READ_WRITE, newSize * sizeof(int));
cl::Buffer combinedNormals(ctx->context, CL_MEM_READ_WRITE, newSize * sizeof(glm::vec4));
CL_CALL(ctx->queue.enqueueCopyBuffer(field.edgeIndices, combinedEdges, 0, 0, oldSize * sizeof(int)));
CL_CALL(ctx->queue.enqueueCopyBuffer(field.normals, combinedNormals, 0, 0, oldSize * sizeof(glm::vec4)));
CL_CALL(ctx->queue.enqueueCopyBuffer(d_createdEdges, combinedEdges, 0, oldSize * sizeof(int), numCreatedEdges * sizeof(int)));
CL_CALL(ctx->queue.enqueueCopyBuffer(d_createdNormals, combinedNormals, 0, oldSize * sizeof(glm::vec4), numCreatedEdges * sizeof(glm::vec4)));
field.numEdges = newSize;
field.edgeIndices = combinedEdges;
field.normals = combinedNormals;
}
else
{
field.numEdges = numCreatedEdges;
field.edgeIndices = d_createdEdges;
field.normals = d_createdNormals;
}
}
return CL_SUCCESS;
}
// ----------------------------------------------------------------------------
int Compute_ApplyCSGOperations(
MeshGenerationContext* meshGen,
const std::vector<CSGOperationInfo>& opInfo,
const glm::ivec3& clipmapNodeMin,
const int clipmapNodeSize)
{
// printf("Apply: %d %d %d\n", clipmapNodeMin.x, clipmapNodeMin.y, clipmapNodeMin.z);
// printf(" origin: %.1f %.1f %.1f\n", opInfo.origin.x, opInfo.origin.y, opInfo.origin.z);
GPUDensityField field;
CL_CALL(LoadDensityField(meshGen, clipmapNodeMin, clipmapNodeSize, &field));
CL_CALL(ApplyCSGOperations(meshGen, opInfo, clipmapNodeMin, clipmapNodeSize, field));
field.lastCSGOperation += opInfo.size();
CL_CALL(StoreDensityField(meshGen, field));
return CL_SUCCESS;
}
| 43.495868
| 145
| 0.754798
|
nickgildea
|
bc9498757e2658d26bfb067d5fcc14c2f7665dff
| 10,605
|
cpp
|
C++
|
test/common/tx.cpp
|
adlerjohn/ech-cpp-dev
|
60584994266b1c83e997e831238d14f5bd015e5a
|
[
"Apache-2.0"
] | 2
|
2020-06-01T00:30:12.000Z
|
2020-06-05T18:41:48.000Z
|
test/common/tx.cpp
|
adlerjohn/ech-cpp-dev
|
60584994266b1c83e997e831238d14f5bd015e5a
|
[
"Apache-2.0"
] | null | null | null |
test/common/tx.cpp
|
adlerjohn/ech-cpp-dev
|
60584994266b1c83e997e831238d14f5bd015e5a
|
[
"Apache-2.0"
] | 1
|
2020-06-05T18:33:28.000Z
|
2020-06-05T18:33:28.000Z
|
#include "catch2/catch.hpp"
// Project includes
#include "common/tx.hpp"
using namespace ech;
using Catch::Matchers::Equals;
TEST_CASE("tx data zero", "[common][txdata]")
{
const uint32_t version = 0u;
const auto inputs = std::vector<Input>{};
const auto outputs = std::vector<TXO>{};
const uint64_t heightMin = 0u;
const uint64_t heightMax = 0u;
const uint64_t recentBlockHeight = 0u;
const auto recentBlockHash = crypto::Digest();
const auto data = TXData(version, inputs, outputs, heightMin, heightMax, recentBlockHeight, recentBlockHash);
REQUIRE_THAT("74723bc3efaf59d897623890ae3912b9be3c4c67ccee3ffcf10b36406c722c1b", Equals(data.getId().toHex()));
REQUIRE(0u == data.getVersion());
REQUIRE(data.getInputs().empty());
REQUIRE(data.getOutputs().empty());
REQUIRE(0u == data.getHeightMin());
REQUIRE(0u == data.getHeightMax());
REQUIRE(0u == data.getRecentBlockHeight());
REQUIRE("290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563" == data.getRecentBlockHash().toHex());
const auto golden = std::string(
"00000000" // version
"00000000" // input count
"00000000" // output count
"0000000000000000" // height min
"0000000000000000" // height max
"0000000000000000" // recent block height
);
REQUIRE_THAT(golden, Equals(data.toHex()));
const auto serialized = data.serialize();
auto q = std::deque<std::byte>(serialized.begin(), serialized.end());
const auto deserialized = TXData::deserialize(q);
REQUIRE_THAT(data.toHex(), Equals(deserialized.toHex()));
}
TEST_CASE("tx data random", "[common][txdata]")
{
const uint32_t version = 1u;
const auto digest = crypto::Digest("testing");
const auto outpoint = Outpoint(TXID(digest), 42u);
const auto input = Input(outpoint, 0u);
const auto inputs = std::vector<Input>{input};
const auto index = 1u;
const auto recipient = crypto::Address("deadbeefdeadbeefdeadbeefdeadbeefdeadbeef");
const auto amount = CoinAmount(42);
const auto address = crypto::Address("8a40bfaa73256b60764c1bf40675a99083efb075");
const auto color = Color(address);
const auto txo = TXO(index, recipient, amount, color);
const auto outputs = std::vector<TXO>{txo};
const uint64_t heightMin = 42u;
const uint64_t heightMax = 43u;
const uint64_t recentBlockHeight = 7u;
const auto recentBlockHash = crypto::Digest("5f16f4c7f149ac4f9510d9cf8cf384038ad348b3bcdc01915f95de12df9d1b02", true);
const auto data = TXData(version, inputs, outputs, heightMin, heightMax, recentBlockHeight, recentBlockHash);
REQUIRE_THAT("6694cb2a97e1a7c431352fa1e4e6f98e941fc6aa0cff50ccc4cdd67a49295838", Equals(data.getId().toHex()));
REQUIRE(1u == data.getVersion());
REQUIRE(1u == data.getInputs().size());
REQUIRE(1u == data.getOutputs().size());
REQUIRE(42u == data.getHeightMin());
REQUIRE(43u == data.getHeightMax());
REQUIRE(7u == data.getRecentBlockHeight());
REQUIRE("5f16f4c7f149ac4f9510d9cf8cf384038ad348b3bcdc01915f95de12df9d1b02" == data.getRecentBlockHash().toHex());
const auto golden = std::string(
"00000001" // version
"00000001" // input count
"5f16f4c7f149ac4f9510d9cf8cf384038ad348b3bcdc01915f95de12df9d1b020000002a00000000" // inputs
"00000001" // output count
"00000001deadbeefdeadbeefdeadbeefdeadbeefdeadbeef000000000000000000000000000000000000000000000000000000000000002a018a40bfaa73256b60764c1bf40675a99083efb075" // outputs
"000000000000002a" // height min
"000000000000002b" // height max
"0000000000000007" // recent block height
"5f16f4c7f149ac4f9510d9cf8cf384038ad348b3bcdc01915f95de12df9d1b02" // recent block hash
);
REQUIRE_THAT(golden, Equals(data.toHex()));
const auto serialized = data.serialize();
auto q = std::deque<std::byte>(serialized.begin(), serialized.end());
const auto deserialized = TXData::deserialize(q);
REQUIRE_THAT(data.toHex(), Equals(deserialized.toHex()));
}
TEST_CASE("tx zero", "[common][tx]")
{
const uint32_t version = 0u;
const auto inputs = std::vector<Input>{};
const auto outputs = std::vector<TXO>{};
const uint64_t heightMin = 0u;
const uint64_t heightMax = 0u;
const uint64_t recentBlockHeight = 0u;
const auto recentBlockHash = crypto::Digest();
const auto data = TXData(version, inputs, outputs, heightMin, heightMax, recentBlockHeight, recentBlockHash);
const auto witnesses = std::vector<crypto::Signature>{};
const auto tx = TX(data, witnesses);
REQUIRE_THAT("74723bc3efaf59d897623890ae3912b9be3c4c67ccee3ffcf10b36406c722c1b", Equals(tx.getData().getId().toHex()));
REQUIRE(0u == tx.getData().getVersion());
REQUIRE(tx.getData().getInputs().empty());
REQUIRE(tx.getData().getOutputs().empty());
REQUIRE(tx.getWitnesses().empty());
REQUIRE(0u == tx.getData().getHeightMin());
REQUIRE(0u == tx.getData().getHeightMax());
REQUIRE(0u == tx.getData().getRecentBlockHeight());
REQUIRE("290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563" == tx.getData().getRecentBlockHash().toHex());
const auto golden = std::string(
"00000000" //version
"00000000" // input count
"00000000" // output count
"0000000000000000" // height min
"0000000000000000" // height max
"0000000000000000" // recent block height
"00000000" // witnesses count
);
REQUIRE_THAT(golden, Equals(tx.toHex()));
const auto serialized = tx.serialize();
auto q = std::deque<std::byte>(serialized.begin(), serialized.end());
const auto deserialized = TX::deserialize(q);
REQUIRE_THAT(tx.toHex(), Equals(deserialized.toHex()));
}
TEST_CASE("tx random", "[common][tx]")
{
const auto version = 1u;
const auto digest = crypto::Digest("testing");
const auto outpoint = Outpoint(TXID(digest), 42u);
const auto input = Input(outpoint, 0u);
const auto inputs = std::vector<Input>{input};
const auto index = 1u;
const auto recipient = crypto::Address("deadbeefdeadbeefdeadbeefdeadbeefdeadbeef");
const auto amount = CoinAmount(42);
const auto address = crypto::Address("8a40bfaa73256b60764c1bf40675a99083efb075");
const auto color = Color(address);
const auto txo = TXO(index, recipient, amount, color);
const auto outputs = std::vector<TXO>{txo};
const uint64_t heightMin = 42u;
const uint64_t heightMax = 43u;
const uint64_t recentBlockHeight = 7u;
const auto recentBlockHash = crypto::Digest("5f16f4c7f149ac4f9510d9cf8cf384038ad348b3bcdc01915f95de12df9d1b02", true);
const auto data = TXData(version, inputs, outputs, heightMin, heightMax, recentBlockHeight, recentBlockHash);
SECTION("random signature")
{
const auto signature = crypto::Signature("5385685eef5fe0f2f93fa022002bb00f8b2478b9567618e47463cda72a78dcdb56a7a6bcd0bd79f709f15e0d3d53ba9909d4a3d100e25065bc0b7bd2537f39191c");
const auto witnesses = std::vector<crypto::Signature>{signature};
const auto tx = TX(data, witnesses);
REQUIRE_THAT("6694cb2a97e1a7c431352fa1e4e6f98e941fc6aa0cff50ccc4cdd67a49295838", Equals(tx.getData().getId().toHex()));
REQUIRE(1u == tx.getData().getVersion());
REQUIRE(1u == tx.getData().getInputs().size());
REQUIRE(1u == tx.getData().getOutputs().size());
REQUIRE(1u == tx.getWitnesses().size());
REQUIRE(42u == tx.getData().getHeightMin());
REQUIRE(43u == tx.getData().getHeightMax());
REQUIRE(7u == tx.getData().getRecentBlockHeight());
REQUIRE("5f16f4c7f149ac4f9510d9cf8cf384038ad348b3bcdc01915f95de12df9d1b02" == tx.getData().getRecentBlockHash().toHex());
const auto golden = std::string(
"00000001" // version
"00000001" // input count
"5f16f4c7f149ac4f9510d9cf8cf384038ad348b3bcdc01915f95de12df9d1b020000002a00000000" // inputs
"00000001" // output count
"00000001deadbeefdeadbeefdeadbeefdeadbeefdeadbeef000000000000000000000000000000000000000000000000000000000000002a018a40bfaa73256b60764c1bf40675a99083efb075" // outputs
"000000000000002a" // height min
"000000000000002b" // height max
"0000000000000007" // recent block height
"5f16f4c7f149ac4f9510d9cf8cf384038ad348b3bcdc01915f95de12df9d1b02" // recent block hash
"00000001" // witnesses count
"5385685eef5fe0f2f93fa022002bb00f8b2478b9567618e47463cda72a78dcdb56a7a6bcd0bd79f709f15e0d3d53ba9909d4a3d100e25065bc0b7bd2537f39191c" // witnesses
);
REQUIRE_THAT(golden, Equals(tx.toHex()));
const auto serialized = tx.serialize();
auto q = std::deque<std::byte>(serialized.begin(), serialized.end());
const auto deserialized = TX::deserialize(q);
REQUIRE_THAT(tx.toHex(), Equals(deserialized.toHex()));
}
SECTION("correct signature checking")
{
const auto secretKey = crypto::SecretKey("3ecb44df2159c26e0f995712d4f39b6f6e499b40749b1cf1246c37f9516cb6a4");
const auto signature = crypto::Signature(secretKey, data.serialize());
const auto witnesses = std::vector<crypto::Signature>{signature};
const auto tx = TX(data, witnesses);
const auto publicKey = crypto::PublicKey(secretKey);
REQUIRE_THAT("6694cb2a97e1a7c431352fa1e4e6f98e941fc6aa0cff50ccc4cdd67a49295838", Equals(tx.getData().getId().toHex()));
REQUIRE(1u == tx.getData().getVersion());
REQUIRE(1u == tx.getData().getInputs().size());
REQUIRE(1u == tx.getData().getOutputs().size());
REQUIRE(1u == tx.getWitnesses().size());
REQUIRE(42u == tx.getData().getHeightMin());
REQUIRE(43u == tx.getData().getHeightMax());
REQUIRE(7u == tx.getData().getRecentBlockHeight());
REQUIRE("5f16f4c7f149ac4f9510d9cf8cf384038ad348b3bcdc01915f95de12df9d1b02" == tx.getData().getRecentBlockHash().toHex());
const auto golden = std::string(
"00000001" // version
"00000001" // input count
"5f16f4c7f149ac4f9510d9cf8cf384038ad348b3bcdc01915f95de12df9d1b020000002a00000000" // inputs
"00000001" // output count
"00000001deadbeefdeadbeefdeadbeefdeadbeefdeadbeef000000000000000000000000000000000000000000000000000000000000002a018a40bfaa73256b60764c1bf40675a99083efb075" // outputs
"000000000000002a" // height min
"000000000000002b" // height max
"0000000000000007" // recent block height
"5f16f4c7f149ac4f9510d9cf8cf384038ad348b3bcdc01915f95de12df9d1b02" // recent block hash
"00000001" // witnesses count
"cc8dc23bcadc408ed155e577063fdf6dfaa1209114b0db5a8e25a9873fd50bff36aabae7663cb02397e3ac0ec55e166fda5906a126f0bd3ae1439f1a10a0b3251c" // witnesses
);
REQUIRE_THAT(golden, Equals(tx.toHex()));
REQUIRE(signature.verify(crypto::Digest(data.serialize()), crypto::Address(publicKey)));
const auto serialized = tx.serialize();
auto q = std::deque<std::byte>(serialized.begin(), serialized.end());
const auto deserialized = TX::deserialize(q);
REQUIRE_THAT(tx.toHex(), Equals(deserialized.toHex()));
}
}
TEST_CASE("tx deserialize short", "[common][tx]")
{
auto emtpy = std::deque<std::byte>{};
REQUIRE_THROWS_AS(TX::deserialize(emtpy), std::runtime_error);
}
| 44.1875
| 177
| 0.758133
|
adlerjohn
|
bc99aee4caf55f0085df2f10d1b9ab4111202db5
| 387
|
inl
|
C++
|
node_modules/lzz-gyp/lzz-source/smtc_ParamToNavCtorParam.inl
|
SuperDizor/dizornator
|
9f57dbb3f6af80283b4d977612c95190a3d47900
|
[
"ISC"
] | 3
|
2019-09-18T16:44:33.000Z
|
2021-03-29T13:45:27.000Z
|
node_modules/lzz-gyp/lzz-source/smtc_ParamToNavCtorParam.inl
|
SuperDizor/dizornator
|
9f57dbb3f6af80283b4d977612c95190a3d47900
|
[
"ISC"
] | null | null | null |
node_modules/lzz-gyp/lzz-source/smtc_ParamToNavCtorParam.inl
|
SuperDizor/dizornator
|
9f57dbb3f6af80283b4d977612c95190a3d47900
|
[
"ISC"
] | 2
|
2019-03-29T01:06:38.000Z
|
2019-09-18T16:44:34.000Z
|
// smtc_ParamToNavCtorParam.inl
//
#ifdef LZZ_ENABLE_INLINE
#define LZZ_INLINE inline
#else
#define LZZ_INLINE
#endif
namespace smtc
{
LZZ_INLINE ParamPtr ParamToNavCtorParam::operator () (ParamPtr const & param) const
{
return paramToNavCtorParam (param);
}
}
namespace smtc
{
LZZ_INLINE ParamToNavCtorParam::ParamToNavCtorParam ()
{}
}
#undef LZZ_INLINE
| 17.590909
| 85
| 0.731266
|
SuperDizor
|
bc9abf9958914fd1d4d4841944037194826cad54
| 2,356
|
hpp
|
C++
|
Assign2/DisplayModule/Messages.hpp
|
thekana/MTRN3500-Assign2
|
07083eb3aab3f3b061c42159d83cbe50b5f55c68
|
[
"OLDAP-2.5"
] | null | null | null |
Assign2/DisplayModule/Messages.hpp
|
thekana/MTRN3500-Assign2
|
07083eb3aab3f3b061c42159d83cbe50b5f55c68
|
[
"OLDAP-2.5"
] | null | null | null |
Assign2/DisplayModule/Messages.hpp
|
thekana/MTRN3500-Assign2
|
07083eb3aab3f3b061c42159d83cbe50b5f55c68
|
[
"OLDAP-2.5"
] | null | null | null |
#ifndef MTRN3500_MESSAGES_H
#define MTRN3500_MESSAGES_H
#include <vector>
#include <string>
// --- code for handling vehicle state ---
struct VehicleState
{
int remoteID;
float x;
float z; // y up
float rotation;
float speed;
float steering;
};
// --- code for handling vehicle models ---
enum ShapeType
{
UNKNOWN_SHAPE,
RECTANGULAR_PRISM,
TRIANGULAR_PRISM,
TRAPEZOIDAL_PRISM,
CYLINDER
};
union ShapeParameter
{
struct RectangularParameters
{
float xlen; // length along x-axis
float ylen; // length along y-axis
float zlen; // length along z-axis
} rect;
struct TriangularParameters
{
float alen; // length of side A (bottom)
float blen; // length of side B (left)
float angle; // angle between side A and B
float depth; // length along z-axis
} tri;
struct TrapezoidalParameters
{
float alen; // length of side A (bottom)
float blen; // length of side B (top)
float height; // distance between side A and B
float aoff; // distance A is shifted from B by, from the left
float depth; // length along z-axis
} trap;
struct CylinderParameters
{
float radius;
float depth; // length along z-axis
bool isRolling; // needs to roll with vehicle?
bool isSteering;// needs to steer with vehicle?
} cyl;
};
struct ShapeInit
{
ShapeType type;
ShapeParameter params;
float xyz[3];
float rotation;
float rgb[3];
};
struct VehicleModel
{
int remoteID;
std::vector<ShapeInit> shapes;
};
std::vector<VehicleState> GetVehicleStates(const std::string & str);
std::vector<VehicleModel> GetVehicleModels(const std::string & str);
std::vector<int> GetVehicleDisconnects(const std::string & str);
std::string GetVehicleStateStr(const VehicleState & vs);
std::string GetVehicleModelStr(const VehicleModel & vm);
std::string GetShapeInitStr(const ShapeInit & si);
std::ostream & operator<<(std::ostream & oss, const VehicleState & vs);
std::ostream & operator<<(std::ostream & oss, const VehicleModel & vs);
std::ostream & operator<<(std::ostream & oss, const ShapeInit & vs);
// --- code for handling obstacles ---
struct ObstacleState
{
float x;
float z;
float radius;
};
std::vector<ObstacleState> GetObstacles(const std::string & str);
// --- code for handling goal state ---
struct GoalState
{
float x;
float z;
};
GoalState GetGoalState(const std::string & str);
#endif
| 20.310345
| 71
| 0.707131
|
thekana
|
bc9b8d0af7dc1fa7e05f6841c20d8a6ef10c5ac8
| 330
|
cpp
|
C++
|
snippets/cpp/VS_Snippets_CodeAnalysis/FxCop.Design.CallUriOverload/cpp/FxCop.Design.CallUriOverload.cpp
|
BohdanMosiyuk/samples
|
59d435ba9e61e0fc19f5176c96b1cdbd53596142
|
[
"CC-BY-4.0",
"MIT"
] | 834
|
2017-06-24T10:40:36.000Z
|
2022-03-31T19:48:51.000Z
|
snippets/cpp/VS_Snippets_CodeAnalysis/FxCop.Design.CallUriOverload/cpp/FxCop.Design.CallUriOverload.cpp
|
BohdanMosiyuk/samples
|
59d435ba9e61e0fc19f5176c96b1cdbd53596142
|
[
"CC-BY-4.0",
"MIT"
] | 7,042
|
2017-06-23T22:34:47.000Z
|
2022-03-31T23:05:23.000Z
|
snippets/cpp/VS_Snippets_CodeAnalysis/FxCop.Design.CallUriOverload/cpp/FxCop.Design.CallUriOverload.cpp
|
BohdanMosiyuk/samples
|
59d435ba9e61e0fc19f5176c96b1cdbd53596142
|
[
"CC-BY-4.0",
"MIT"
] | 1,640
|
2017-06-23T22:31:39.000Z
|
2022-03-31T02:45:37.000Z
|
//<Snippet1>
#using <system.dll>
using namespace System;
namespace DesignLibrary
{
public ref class History
{
public:
void AddToHistory(String^ uriString)
{
Uri^ newUri = gcnew Uri(uriString);
AddToHistory(newUri);
}
void AddToHistory(Uri^ uriType) { }
};
}
//</Snippet1>
| 16.5
| 45
| 0.606061
|
BohdanMosiyuk
|
bc9e7c8941dedb8b12e5c40e4b435c3cb3681525
| 5,091
|
inl
|
C++
|
scimitar/util/biguint.inl
|
grandmaster789/scimitar
|
8f12caa2c3a9b9c6b366871d58d25f72cacbd825
|
[
"MIT"
] | null | null | null |
scimitar/util/biguint.inl
|
grandmaster789/scimitar
|
8f12caa2c3a9b9c6b366871d58d25f72cacbd825
|
[
"MIT"
] | null | null | null |
scimitar/util/biguint.inl
|
grandmaster789/scimitar
|
8f12caa2c3a9b9c6b366871d58d25f72cacbd825
|
[
"MIT"
] | null | null | null |
#pragma once
#include "biguint.h"
#include "codec/base_n.h"
#include <cassert>
namespace scimitar::util {
template <std::unsigned_integral T, int N>
template <int M>
requires (M < N)
Biguint<T, N>::Biguint(const Biguint<T, M>& x) noexcept {
int i = 0;
for (; i < M; ++i)
m_Digits[i] = x.m_Digits[i];
for (; i < N; ++i)
m_Digits[i] = 0;
}
template <std::unsigned_integral T, int N>
template <util::c_Integral U>
Biguint<T, N>::Biguint(U value)
noexcept
{
if constexpr (sizeof(U) > sizeof(T)) {
// ie Biguint<uint8_t, 8>(uint64_t some_value)
for (int i = 0; i < m_NumDigits; ++i)
m_Digits[i] = static_cast<T>(value >> i * m_BitsPerDigit);
// do we want to warn about truncation?
}
if constexpr (sizeof(U) <= sizeof(T)) {
// ie Biguint<uint64_t, 2>(int32_t some_value)
m_Digits[0] = static_cast<T>(value);
for (int i = 1; i < m_NumDigits; ++i)
m_Digits[i] = 0;
}
}
template <std::unsigned_integral T, int N>
Biguint<T, N>::Biguint(std::string_view sv, int base) noexcept :
Biguint(0)
{
// first couple of common alphabets (base 2/8/10/16) are reasonably compatible
// so we can try and use the base16 interpreter per single character
assert(
(base == 2) ||
(base == 8) ||
(base == 10) ||
(base == 16)
);
for (auto i = 0; i < sv.size(); ++i) {
auto piece = codec::Base16::int_from_char(sv[i]);
(*this) *= base;no
(*this) += piece;
}
}
template <std::unsigned_integral T, int N>
std::string Biguint<T, N>::to_string() const noexcept {
std::string result;
if (*this == 0)
result = "0";
else {
std::reverse(
std::begin(result),
std::end(result)
);
}
return result;
}
template <std::unsigned_integral T, int N>
template <int M>
requires (M < N)
Biguint<T, N>& Biguint<T, N>::operator = (const Biguint<T, M>& x) noexcept {
int i = 0;
for (; i < M; ++i)
m_Digits[i] = x.m_Digits[i];
for (; i < N; ++i)
m_Digits[i] = 0;
return *this;
}
template <std::unsigned_integral T, int N>
template <util::c_Integral U>
Biguint<T, N>& Biguint<T, N>::operator = (U value)
noexcept
{
if constexpr (sizeof(U) > sizeof(T)) {
// ie Biguint<uint32_t, 2>(uint64_t some_value)
for (int i = 0; i < m_NumDigits; ++i)
m_Digits[i] = static_cast<T>(value >> i * m_BitsPerDigit);
// do we want to warn about truncation?
}
if constexpr (sizeof(U) <= sizeof(T)) {
// ie Biguint<uint64_t, 2>(int32_t some_value)
m_Digits[0] = static_cast<T>(value);
for (int i = 1; i < m_NumDigits; ++i)
m_Digits[i] = 0;
}
return *this;
}
template <std::unsigned_integral T, int N>
Biguint<T, N>::operator bool() const noexcept {
for (auto digit : m_Digits)
if (digit)
return true;
return false;
}
template <std::unsigned_integral T, int N>
bool Biguint<T, N>::operator == (const Biguint& rhs) const noexcept {
return ((*this) <=> rhs) == std::strong_ordering::equal; // mweh
}
template <std::unsigned_integral T, int N>
std::strong_ordering Biguint<T, N>::operator <=> (const Biguint& rhs) const noexcept {
for (int i = N - 1; i >= 0; --i) {
auto digit_a = m_Digits[i];
auto digit_b = rhs.m_Digits[i];
if (digit_a < digit_b)
return std::strong_ordering::less;
if (digit_a > digit_b)
return std::strong_ordering::greater;
}
return std::strong_ordering::equal;
}
template <std::unsigned_integral T, int N>
Biguint<T, N>& Biguint<T, N>::operator += (const Biguint& rhs) noexcept {
Biguint result = 0;
return result;
}
template <std::unsigned_integral T, int N>
Biguint<T, N>& Biguint<T, N>::operator -= (const Biguint& rhs) noexcept {
return {};
}
template <std::unsigned_integral T, int N>
Biguint<T, N>& Biguint<T, N>::operator *= (const Biguint& rhs) noexcept {
return {};
}
template <std::unsigned_integral T, int N>
Biguint<T, N>& Biguint<T, N>::operator /= (const Biguint& rhs) noexcept {
return {};
}
template <std::unsigned_integral T, int N>
Biguint<T, N> Biguint<T, N>::operator + (const Biguint& rhs) const noexcept {
return {};
}
template <std::unsigned_integral T, int N>
Biguint<T, N> Biguint<T, N>::operator - (const Biguint& rhs) const noexcept {
return {};
}
template <std::unsigned_integral T, int N>
Biguint<T, N> Biguint<T, N>::operator * (const Biguint& rhs) const noexcept {
return {};
}
template <std::unsigned_integral T, int N>
Biguint<T, N> Biguint<T, N>::operator / (const Biguint& rhs) const noexcept {
return {};
}
template <std::unsigned_integral T, int N>
Biguint<T, N> Biguint<T, N>::add(const Biguint& rhs) const noexcept {
return {};
}
template <std::unsigned_integral T, int N>
Biguint<T, N> Biguint<T, N>::sub(const Biguint& rhs) const noexcept {
return {};
}
template <std::unsigned_integral T, int N>
Biguint<T, N> Biguint<T, N>::mul(const Biguint& rhs) const noexcept {
return {};
}
template <std::unsigned_integral T, int N>
Biguint<T, N>::DivResult Biguint<T, N>::div(const Biguint& rhs) const noexcept {
DivResult result = {};
return result;
}
}
| 23.246575
| 87
| 0.628364
|
grandmaster789
|
bca3d5f95c1e34ade1bb9fb18f2e42f274fb44be
| 1,440
|
hpp
|
C++
|
C++/leetcode/Out_of_Boundary_Paths/solution.hpp
|
pterodragon/programming
|
1e9c10490c3aaebe51bc06f8e0c6566e9f8b461c
|
[
"MIT"
] | 2
|
2018-10-06T14:43:13.000Z
|
2019-02-03T13:07:14.000Z
|
C++/leetcode/Out_of_Boundary_Paths/solution.hpp
|
pterodragon/programming
|
1e9c10490c3aaebe51bc06f8e0c6566e9f8b461c
|
[
"MIT"
] | null | null | null |
C++/leetcode/Out_of_Boundary_Paths/solution.hpp
|
pterodragon/programming
|
1e9c10490c3aaebe51bc06f8e0c6566e9f8b461c
|
[
"MIT"
] | null | null | null |
#ifndef SOLUTION_HPP
#define SOLUTION_HPP
#include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;
struct Input {
int m;
int n;
int N;
int i;
int j;
friend std::ostream &operator<<(std::ostream &s, const Input &x) {
return s << x.m << ", " << x.n << ", " << x.N << ", " << x.i << ", " << x.j;
}
};
class Solution {
public:
int findPaths(int m, int n, int N, int i, int j) {
// dp[x][y][n] = no of paths to move the ball out of grid boundary at
// (x, y) with n times of moving
const int mod = 1000000007;
vector<vector<int>> dp(m, vector(n, 0));
for (int a = 0; a < N; ++a) {
vector<vector<int>> t(m, vector(n, 0));
for (int x = 0; x < m; ++x) {
for (int y = 0; y < n; ++y) {
if (x > 0)
t[x][y] += dp[x - 1][y] % mod;
t[x][y] %= mod;
if (y > 0)
t[x][y] += dp[x][y - 1] % mod;
t[x][y] %= mod;
if (x < m - 1)
t[x][y] += dp[x + 1][y] % mod;
t[x][y] %= mod;
if (y < n - 1)
t[x][y] += dp[x][y + 1] % mod;
t[x][y] %= mod;
}
}
for (int x = 0; x < m; ++x) {
for (int y = 0; y < n; ++y) {
dp[x][y] =
t[x][y] + (x == 0) + (y == 0) + (x == m - 1) + (y == n - 1);
dp[x][y] %= mod;
}
}
}
return dp[i][j];
}
};
#endif /* SOLUTION_HPP */
| 24.40678
| 80
| 0.404861
|
pterodragon
|
bca87cba48152db2267b8a023bc8ef29da2f4e7e
| 508
|
cpp
|
C++
|
ExpTest/ExpTest.prj/IndexDlg.cpp
|
rrvt/ExpTest
|
94391b48afd974d0d77e5b02c04ff234fa2d9e54
|
[
"MIT"
] | null | null | null |
ExpTest/ExpTest.prj/IndexDlg.cpp
|
rrvt/ExpTest
|
94391b48afd974d0d77e5b02c04ff234fa2d9e54
|
[
"MIT"
] | null | null | null |
ExpTest/ExpTest.prj/IndexDlg.cpp
|
rrvt/ExpTest
|
94391b48afd974d0d77e5b02c04ff234fa2d9e54
|
[
"MIT"
] | null | null | null |
// IndexDlg.cpp : implementation file
//
#include "stdafx.h"
#include "IndexDlg.h"
// IndexDlg dialog
IMPLEMENT_DYNAMIC(IndexDlg, CDialogEx)
IndexDlg::IndexDlg(CWnd* pParent) : CDialogEx(IDD_Index, pParent), indexReq(_T("")), index(_T("")) { }
IndexDlg::~IndexDlg() { }
void IndexDlg::DoDataExchange(CDataExchange* pDX) {
CDialogEx::DoDataExchange(pDX);
DDX_Text(pDX, IDC_IndexReq, indexReq);
DDX_Text(pDX, IDC_Index, index);
}
BEGIN_MESSAGE_MAP(IndexDlg, CDialogEx)
END_MESSAGE_MAP()
| 18.142857
| 102
| 0.718504
|
rrvt
|
bca969beb80d122ba1dd2895e1d8e09dc9ecd3a6
| 325
|
hpp
|
C++
|
ospp/impl/mml/clipboard.hpp
|
volcoma/ospp
|
48de0844b66acf515ac17dc5e673435b33876b35
|
[
"MIT"
] | 1
|
2019-05-26T19:50:29.000Z
|
2019-05-26T19:50:29.000Z
|
ospp/impl/mml/clipboard.hpp
|
volcoma/ospp
|
48de0844b66acf515ac17dc5e673435b33876b35
|
[
"MIT"
] | null | null | null |
ospp/impl/mml/clipboard.hpp
|
volcoma/ospp
|
48de0844b66acf515ac17dc5e673435b33876b35
|
[
"MIT"
] | null | null | null |
#pragma once
#include "../../keyboard.h"
#include "config.hpp"
namespace os
{
namespace clipboard
{
namespace detail
{
namespace mml
{
inline auto get_text() noexcept -> std::string
{
return ::mml::clipboard::get_string();
}
inline void set_text(const std::string& text)
{
::mml::clipboard::set_string(text);
}
}
}
}
}
| 11.607143
| 46
| 0.686154
|
volcoma
|
bca990c4ebc334b3805cf296a810ac240e910b1e
| 3,488
|
cpp
|
C++
|
fmaimage/src/image/PixelClass.cpp
|
BenjaminSchulte/fma
|
df2aa5b0644c75dd34a92defeff9beaa4a32ffea
|
[
"MIT"
] | 14
|
2018-01-25T10:31:05.000Z
|
2022-02-19T13:08:11.000Z
|
fmaimage/src/image/PixelClass.cpp
|
BenjaminSchulte/fma
|
df2aa5b0644c75dd34a92defeff9beaa4a32ffea
|
[
"MIT"
] | 1
|
2020-12-24T10:10:28.000Z
|
2020-12-24T10:10:28.000Z
|
fmaimage/src/image/PixelClass.cpp
|
BenjaminSchulte/fma
|
df2aa5b0644c75dd34a92defeff9beaa4a32ffea
|
[
"MIT"
] | null | null | null |
#include <image/PixelClass.hpp>
#include <image/BaseCanvasClass.hpp>
#include <fma/core/Number.hpp>
#include <fma/core/String.hpp>
#include <fma/types/ClassPrototype.hpp>
#include <fma/types/Undefined.hpp>
#include <fma/types/Object.hpp>
#include <fma/interpret/ParameterList.hpp>
#include <fma/Project.hpp>
#include <sstream>
#include <iomanip>
using namespace FMA;
using namespace FMA::types;
using namespace FMA::interpret;
using namespace FMA::image;
using namespace FMA::core;
// ----------------------------------------------------------------------------
ClassPtr PixelClass::create(const ModulePtr &root, const ClassPtr &ClassObject) {
ClassPtr klass = ClassPtr(new Class("Pixel", "fmaImage::Pixel"));
klass->extends(ClassObject);
ClassPrototypePtr proto(klass->getPrototype());
proto->setMember("initialize", TypePtr(new InternalFunctionValue("initialize", PixelClass::initialize)));
proto->setMember("to_s", TypePtr(new InternalFunctionValue("to_s", PixelClass::to_s)));
root->setMember("Pixel", klass);
return klass;
}
// ----------------------------------------------------------------------------
TypePtr PixelClass::createInstance(const interpret::ContextPtr &context, const types::TypePtr &parent, uint32_t left, uint32_t top) {
ClassPtr Pixel = context->getRootLevelContext()->getMember("fmaImage")->get()->getMember("Pixel")->asClass();
if (!Pixel) {
TypePtr result(new Undefined());
return result;
}
GroupedParameterList params;
params.push_back(parent);
params.push_back(NumberClass::createInstance(context, left)->get());
params.push_back(NumberClass::createInstance(context, top)->get());
return Pixel->createInstance(context, params);
}
// ----------------------------------------------------------------------------
ResultPtr PixelClass::initialize(const ContextPtr &context, const GroupedParameterList ¶meter) {
const TypeList &args = parameter.only_args();
if (args.size() != 3) {
return ResultPtr(new Result());
}
const TypePtr &parent = args.at(0);
int64_t left = args.at(1)->convertToNumber(context);
int64_t top = args.at(2)->convertToNumber(context);
BaseCanvasAccessorPtr canvas(BaseCanvasClass::allocateAccessor(context->getProject(), parent));
Color color = canvas->get(left, top);
context->self()->setMember("__parent", parent);
context->self()->setMember("x", args.at(1));
context->self()->setMember("y", args.at(2));
context->self()->setMember("r", NumberClass::createInstance(context, color.r)->get());
context->self()->setMember("g", NumberClass::createInstance(context, color.g)->get());
context->self()->setMember("b", NumberClass::createInstance(context, color.b)->get());
context->self()->setMember("a", NumberClass::createInstance(context, color.a)->get());
return Result::executed(context, context->self());
}
// ----------------------------------------------------------------------------
ResultPtr PixelClass::to_s(const ContextPtr &context, const GroupedParameterList &) {
std::ostringstream os;
os << "#";
os << std::hex << std::setw(2) << std::setfill('0') << (uint32_t)context->self()->getMember("r")->convertToNumber(context);
os << std::hex << std::setw(2) << std::setfill('0') << (uint32_t)context->self()->getMember("g")->convertToNumber(context);
os << std::hex << std::setw(2) << std::setfill('0') << (uint32_t)context->self()->getMember("b")->convertToNumber(context);
return StringClass::createInstance(context, os.str());
}
| 42.536585
| 133
| 0.650516
|
BenjaminSchulte
|
bcaa1945e59872161cbcb64bf3445ee3e4cb4791
| 941
|
cpp
|
C++
|
Codeforces/1185C1.cpp
|
DT3264/ProgrammingContestsSolutions
|
a297f2da654c2ca2815b9aa375c2b4ca0052269d
|
[
"MIT"
] | null | null | null |
Codeforces/1185C1.cpp
|
DT3264/ProgrammingContestsSolutions
|
a297f2da654c2ca2815b9aa375c2b4ca0052269d
|
[
"MIT"
] | null | null | null |
Codeforces/1185C1.cpp
|
DT3264/ProgrammingContestsSolutions
|
a297f2da654c2ca2815b9aa375c2b4ca0052269d
|
[
"MIT"
] | null | null | null |
#include <bits/stdc++.h>
using namespace std;
struct test{
int test;
int index;
};
bool compareTests(test t1, test t2){
return t1.test<t2.test;
}
vector<test> tests, sortedTests;
int total;
void insertTest(test t){
total+=t.test;
tests.push_back(t);
sortedTests.push_back(t);
sort(sortedTests.begin(), sortedTests.end(), compareTests);
}
int getMinN(int ind, int &m){
int actTotal=total;
int res=0;
for(int i=sortedTests.size()-1; i>=0 && actTotal>m; i--){
if(sortedTests[i].index!=ind){
actTotal-=sortedTests[i].test;
res++;
}
}
return res;
}
int main(){
int n, m, i, t;
scanf("%d%d", &n, &m);
int arr[101];
scanf("%d", &t);
insertTest({t, 0});
printf("0");
int minN;
for(i=1; i<n; i++){
scanf("%d", &t);
insertTest({t, i});
minN=getMinN(i, m);
printf(" %d", minN);
}
return 0;
}
| 20.911111
| 63
| 0.539851
|
DT3264
|
bcb087db260b55e3b3ebec6c82d217785b8bafc9
| 6,310
|
cpp
|
C++
|
libs/draw/text.cpp
|
kdt3rd/gecko
|
756a4e4587eb5023495294d9b6c6d80ebd79ebde
|
[
"MIT"
] | 15
|
2017-10-18T05:08:16.000Z
|
2022-02-02T11:01:46.000Z
|
libs/draw/text.cpp
|
kdt3rd/gecko
|
756a4e4587eb5023495294d9b6c6d80ebd79ebde
|
[
"MIT"
] | null | null | null |
libs/draw/text.cpp
|
kdt3rd/gecko
|
756a4e4587eb5023495294d9b6c6d80ebd79ebde
|
[
"MIT"
] | 1
|
2018-11-10T03:12:57.000Z
|
2018-11-10T03:12:57.000Z
|
// SPDX-License-Identifier: MIT
// Copyright contributors to the gecko project.
#include "text.h"
#include <gl/element_buffer_data.h>
#include <gl/vertex_buffer_data.h>
namespace draw
{
////////////////////////////////////////
text::text( void ) : _scale( 1.F, 1.F ), _color( 0.f, 0.f, 0.f, 1.f ) {}
////////////////////////////////////////
text::text( const std::shared_ptr<script::font> &font )
: _font( font ), _scale( 1.F, 1.F ), _color( 0.f, 0.f, 0.f, 1.f )
{}
////////////////////////////////////////
text::text( const std::string &utf8 )
: _utf8( utf8 ), _scale( 1.F, 1.F ), _color( 0.f, 0.f, 0.f, 1.f )
{}
////////////////////////////////////////
text::text( const std::shared_ptr<script::font> &font, const std::string &utf8 )
: _font( font )
, _utf8( utf8 )
, _scale( 1.F, 1.F )
, _color( 0.f, 0.f, 0.f, 1.f )
{}
////////////////////////////////////////
void text::set_font( const std::shared_ptr<script::font> &font )
{
_update = ( font != _font );
_font = font;
}
////////////////////////////////////////
void text::set_text( const std::string &utf8 )
{
_update = ( utf8 != _utf8 );
_utf8 = utf8;
}
////////////////////////////////////////
void text::set_scale( const point &s ) { _scale = s; }
////////////////////////////////////////
void text::set_position( const point &p ) { _pos = p; }
////////////////////////////////////////
void text::set_color( const color &c ) { _color = c; }
////////////////////////////////////////
void text::draw( platform::context &ctxt )
{
if ( _update )
update( ctxt );
if ( _mesh.valid() )
{
auto &fgc = _stash->_font_glyph_cache;
auto x = fgc.find( _font );
if ( x != fgc.end() )
{
std::shared_ptr<gl::texture> texture = x->second.texture;
gl::api &ogl = ctxt.api();
ogl.save_matrix();
ogl.model_matrix().scale(
to_api( _scale[0] ), to_api( _scale[1] ) );
ogl.model_matrix().translate(
to_api( _pos[0] ), to_api( _pos[1] ) );
auto txt = texture->bind();
auto b = _mesh.bind();
// std::cout << "scale: " << _scale[0] << " (" << to_api( _scale[0] ) << ")"
// << _scale[1] << " (" << to_api(_scale[1]) << ")" << std::endl;
// std::cout << "pos: " << _pos[0] << " (" << to_api( _pos[0] ) << ")"
// << _pos[1] << " (" << to_api(_pos[1]) << ")" << std::endl;
// std::cout << "draw matrix: " << ogl.current_matrix() << std::endl;
b.set_uniform( _mat_pos, ogl.current_matrix() );
b.set_uniform( _col_pos, _color );
b.set_uniform( _tex_pos, static_cast<int>( txt.unit() ) );
b.draw();
ogl.restore_matrix();
}
}
}
////////////////////////////////////////
void text::rebuild( platform::context & ) { _stash.reset(); }
////////////////////////////////////////
void text::update( platform::context &ctxt )
{
_mesh.clear();
if ( !_font || _utf8.empty() )
return;
_mesh = gl::mesh();
// Create the geometry (with texture coordinates) for the text.
gl::vertex_buffer_data<gl::vec2, gl::vec2> coords;
gl::element_buffer_data tris;
{
using ptype = script::font::coord_type;
auto add_point = [&]( ptype cx, ptype cy, ptype tx, ptype ty ) {
coords.push_back(
{ cx.count(), cy.count() }, { tx.count(), ty.count() } );
};
auto add_tri = [&]( uint32_t a, uint32_t b, uint32_t c ) {
tris.push_back( a, b, c );
};
_font->render( add_point, add_tri, 0.0, 0.0, _utf8 );
}
// don't care about initialization, just need to have the structure
if ( !_stash )
ctxt.retrieve_common( this, _stash );
// Update the font texture if needed.
auto &fgc = _stash->_font_glyph_cache;
auto x = fgc.find( _font );
uint32_t curVer = _font->glyph_version();
gl::api & ogl = ctxt.api();
std::shared_ptr<gl::texture> texture;
bool storeTex = true;
if ( x != fgc.end() )
{
GlyphPack &pk = x->second;
storeTex = pk.version != curVer;
texture = pk.texture;
}
else
texture = ogl.new_texture( gl::texture::target::IMAGE_2D );
auto txt = texture->bind();
if ( storeTex )
{
txt.set_wrapping( gl::wrapping::CLAMP_TO_EDGE );
txt.set_filters( gl::filter::LINEAR, gl::filter::LINEAR );
txt.image_2d_red(
gl::format::RED,
static_cast<size_t>( _font->bitmap_width() ),
static_cast<size_t>( _font->bitmap_height() ),
gl::image_type::UNSIGNED_BYTE,
_font->bitmap().data() );
fgc[_font] = { _font->glyph_version(), texture };
}
auto prog = _stash->_program_cache;
if ( !prog )
{
auto vshader = ogl.new_vertex_shader(
R"SHADER(
#version 330
layout(location = 0) in vec2 vertex_pos;
layout(location = 1) in vec2 char_pos;
uniform mat4 matrix;
out vec2 tex_pos;
void main()
{
tex_pos = char_pos;
gl_Position = matrix * vec4( vertex_pos, 0.0, 1.0 );
}
)SHADER" );
auto fshader = ogl.new_fragment_shader(
R"SHADER(
#version 330
in vec2 tex_pos;
out vec4 frag_color;
uniform vec4 color;
uniform sampler2D textTex;
void main()
{
vec4 texColor = texture( textTex, tex_pos );
frag_color = vec4( color.r, color.g, color.b, color.a * texColor.r );
}
)SHADER" );
prog = ogl.new_program( vshader, fshader );
_stash->_program_cache = prog;
}
_mesh.set_program( prog );
{
auto tbind = _mesh.bind();
tbind.vertex_attribute( "vertex_pos", coords, 0 );
tbind.vertex_attribute( "char_pos", coords, 1 );
tbind.set_elements( tris );
_mesh.add_triangles( tris.size() );
}
_mat_pos = _mesh.get_uniform_location( "matrix" );
_col_pos = _mesh.get_uniform_location( "color" );
_tex_pos = _mesh.get_uniform_location( "textTex" );
_update = false;
}
////////////////////////////////////////
} // namespace draw
| 27.198276
| 90
| 0.495563
|
kdt3rd
|
bcb1cb80335fbc76b48b40b970d3fb86a14a4683
| 478
|
cpp
|
C++
|
modules/core/src/Dialog/gmDialogAbout.cpp
|
GraphMIC/GraphMIC
|
8fc2aeb0143ee1292c6757f010fc9e8c68823e2b
|
[
"BSD-3-Clause"
] | 43
|
2016-04-11T11:34:05.000Z
|
2022-03-31T03:37:57.000Z
|
modules/core/src/Dialog/gmDialogAbout.cpp
|
kevinlq/GraphMIC
|
8fc2aeb0143ee1292c6757f010fc9e8c68823e2b
|
[
"BSD-3-Clause"
] | 1
|
2016-05-17T12:58:16.000Z
|
2016-05-17T12:58:16.000Z
|
modules/core/src/Dialog/gmDialogAbout.cpp
|
kevinlq/GraphMIC
|
8fc2aeb0143ee1292c6757f010fc9e8c68823e2b
|
[
"BSD-3-Clause"
] | 14
|
2016-05-13T20:23:16.000Z
|
2021-12-20T10:33:19.000Z
|
#include "gmDialogAbout.hpp"
namespace gm
{
namespace Dialog
{
About* About::instance = nullptr;
About::About() : Base("About")
{
log_trace(Log::New, this);
}
auto About::Show() -> void
{
log_trace(Log::Func);
if (!instance)
{
instance = new About();
}
instance->show();
}
}
}
| 17.703704
| 41
| 0.382845
|
GraphMIC
|
bcb1ed90985fce7dd1cd633de633c54b6b485179
| 4,135
|
cpp
|
C++
|
WKC/WebKit/WKC/helpers/privates/WKCFrameLoader.cpp
|
s1rcheese/nintendo-3ds-internetbrowser-sourcecode
|
3dd05f035e0a5fc9723300623e9b9b359be64e11
|
[
"Unlicense"
] | 15
|
2016-01-05T12:43:41.000Z
|
2022-03-15T10:34:47.000Z
|
WKC/WebKit/WKC/helpers/privates/WKCFrameLoader.cpp
|
s1rcheese/nintendo-3ds-internetbrowser-sourcecode
|
3dd05f035e0a5fc9723300623e9b9b359be64e11
|
[
"Unlicense"
] | null | null | null |
WKC/WebKit/WKC/helpers/privates/WKCFrameLoader.cpp
|
s1rcheese/nintendo-3ds-internetbrowser-sourcecode
|
3dd05f035e0a5fc9723300623e9b9b359be64e11
|
[
"Unlicense"
] | 2
|
2020-11-30T18:36:01.000Z
|
2021-02-05T23:20:24.000Z
|
/*
* Copyright (c) 2011 ACCESS CO., LTD. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "helpers/WKCFrameLoader.h"
#include "helpers/privates/WKCFrameLoaderPrivate.h"
#include "FrameLoader.h"
#include "DocumentLoader.h"
#include "ResourceRequest.h"
#include "helpers/privates/WKCDocumentLoaderPrivate.h"
#include "helpers/privates/WKCResourceRequestPrivate.h"
namespace WKC {
FrameLoaderPrivate::FrameLoaderPrivate(WebCore::FrameLoader* parent)
: m_webcore(parent)
, m_wkc(*this)
, m_documentLoader(0)
, m_activeDocumentLoader(0)
, m_provisionalDocumentLoader(0)
, m_originalRequest(0)
{
}
FrameLoaderPrivate::~FrameLoaderPrivate()
{
delete m_documentLoader;
delete m_activeDocumentLoader;
delete m_provisionalDocumentLoader;
delete m_originalRequest;
}
DocumentLoader*
FrameLoaderPrivate::documentLoader()
{
WebCore::DocumentLoader* loader = m_webcore->documentLoader();
if (!loader) return 0;
if (!m_documentLoader || m_documentLoader->webcore() != loader) {
delete m_documentLoader;
m_documentLoader = new DocumentLoaderPrivate(loader);
}
return &m_documentLoader->wkc();
}
DocumentLoader*
FrameLoaderPrivate::activeDocumentLoader()
{
WebCore::DocumentLoader* loader = m_webcore->activeDocumentLoader();
if (!loader) return 0;
if (!m_activeDocumentLoader || m_activeDocumentLoader->webcore() != loader) {
delete m_activeDocumentLoader;
m_activeDocumentLoader = new DocumentLoaderPrivate(loader);
}
return &m_activeDocumentLoader->wkc();
}
DocumentLoader*
FrameLoaderPrivate::provisionalDocumentLoader()
{
WebCore::DocumentLoader* loader = m_webcore->provisionalDocumentLoader();
if (!loader)
return 0;
if (!m_provisionalDocumentLoader || m_provisionalDocumentLoader->webcore() != loader) {
delete m_provisionalDocumentLoader;
m_provisionalDocumentLoader = new DocumentLoaderPrivate(loader);
}
return &m_provisionalDocumentLoader->wkc();
}
ObjectContentType
FrameLoaderPrivate::defaultObjectContentType(const KURL& url, const String& mimeType)
{
return (ObjectContentType)WebCore::FrameLoader::defaultObjectContentType(url, mimeType);
}
const ResourceRequest&
FrameLoaderPrivate::originalRequest()
{
const WebCore::ResourceRequest& req = m_webcore->originalRequest();
delete m_originalRequest;
m_originalRequest = new ResourceRequestPrivate(req);
return m_originalRequest->wkc();
}
FrameLoadType
FrameLoaderPrivate::loadType() const
{
return (FrameLoadType)m_webcore->loadType();
}
FrameLoader::FrameLoader(FrameLoaderPrivate& parent)
: m_private(parent)
{
}
FrameLoader::~FrameLoader()
{
}
DocumentLoader*
FrameLoader::documentLoader()
{
return m_private.documentLoader();
}
DocumentLoader*
FrameLoader::activeDocumentLoader()
{
return m_private.activeDocumentLoader();
}
DocumentLoader*
FrameLoader::provisionalDocumentLoader()
{
return m_private.provisionalDocumentLoader();
}
ObjectContentType
FrameLoader::defaultObjectContentType(const KURL& url, const String& mimeType)
{
return FrameLoaderPrivate::defaultObjectContentType(url, mimeType);
}
const ResourceRequest&
FrameLoader::originalRequest() const
{
return m_private.originalRequest();
}
FrameLoadType
FrameLoader::loadType() const
{
return m_private.loadType();
}
} // namespace
| 25.524691
| 92
| 0.750665
|
s1rcheese
|
bcb6e43a4ca683d318da48b9d57e80a537f35661
| 7,479
|
cc
|
C++
|
graphicsdisplay.cc
|
woongbinchoi/Sorcery
|
d8e6e2b684490b0b6b982c704282a8b785b50d13
|
[
"MIT"
] | null | null | null |
graphicsdisplay.cc
|
woongbinchoi/Sorcery
|
d8e6e2b684490b0b6b982c704282a8b785b50d13
|
[
"MIT"
] | null | null | null |
graphicsdisplay.cc
|
woongbinchoi/Sorcery
|
d8e6e2b684490b0b6b982c704282a8b785b50d13
|
[
"MIT"
] | null | null | null |
#include "graphicsdisplay.h"
#include "card.h"
#include "board.h"
#include "enchantlist.h"
#include "ascii_graphics.h"
using namespace std;
GraphicsDisplay::GraphicsDisplay(int winSize):
width{winSize * 2}, height{winSize}, xw{winSize * 2, winSize} {
CardHeight = CARD_TEMPLATE_EMPTY.size();
CardWidth = CARD_TEMPLATE_EMPTY.at(0).length();
xtileSize = 6;
tileSize = 10;
xIndent = 250;
yIndent = 100;
xIndentPlayer1 = (xIndent - CardWidth * xtileSize) / 2;
xIndentPlayer2 = xIndentPlayer1 + xIndent + (CardWidth * 5 + 2) * xtileSize;
int Middle = 250 + xtileSize * (CardWidth * 2 + CardWidth / 2 + 2);
int yScreen = winSize;
xw.fillRectangle(0,0,Middle,yScreen,Xwindow::Blue);
xw.fillRectangle(Middle,0,Middle * 2,yScreen,Xwindow::Red);
xw.fillRectangle(xIndentPlayer1 - xtileSize, yIndent - tileSize * 4,xtileSize * (CardWidth * 5) + xIndent * 2, tileSize * (CardHeight * 5 + 15),Xwindow::White);
int Player1x = xIndentPlayer1 + tileSize * 2;
int Player2x = xIndentPlayer2 - tileSize * CardWidth / 2 - 30;
int Playery = CardHeight * 5 * tileSize + yIndent * 2 - 30;
xw.drawBigString(Player1x, Playery, "Player 1", Xwindow::Blue);
xw.drawBigString(Player2x, Playery, "Player 2", Xwindow::Red);
string HorizontalLine = CENTRE_GRAPHIC.at(0);
string UpperHorizontalLine = HorizontalLine;
string LowerHorizontalLine = HorizontalLine;
int lastElem = HorizontalLine.length() - 1;
UpperHorizontalLine.at(0) = EXTERNAL_BORDER_CHAR_TOP_LEFT.at(0);
LowerHorizontalLine.at(0) = EXTERNAL_BORDER_CHAR_BOTTOM_LEFT.at(0);
UpperHorizontalLine.at(lastElem) = EXTERNAL_BORDER_CHAR_TOP_RIGHT.at(0);
LowerHorizontalLine.at(lastElem) = EXTERNAL_BORDER_CHAR_BOTTOM_RIGHT.at(0);
xw.drawString(xIndent, yIndent, UpperHorizontalLine, Xwindow::Black);
xw.drawString(xIndent, yIndent + tileSize * CardHeight * 5, LowerHorizontalLine, Xwindow::Black);
string bar = EXTERNAL_BORDER_CHAR_UP_DOWN;
string InfoStr = bar;
string MinionStr = bar;
vector<card_template_t> temp{5, CARD_TEMPLATE_EMPTY};
Hand1Save = temp;
Hand2Save = move(temp);
vector<card_template_t> temp1{20, CARD_TEMPLATE_BORDER};
Board = move(temp1);
Board.at(1) = CARD_TEMPLATE_EMPTY;
Board.at(3) = CARD_TEMPLATE_EMPTY;
Board.at(16) = CARD_TEMPLATE_EMPTY;
Board.at(18) = CARD_TEMPLATE_EMPTY;
for (int i = 0; i < CardHeight; ++i) {
for (int j = 0; j < 5; ++j) {
if (j % 2 == 0) InfoStr += Board.at(j).at(i);
else InfoStr += Board.at(j).at(i);
MinionStr += Board.at(j + 5).at(i);
}
InfoStr += bar;
MinionStr += bar;
xw.drawString(xIndent, yIndent + tileSize * (1 + i + CardHeight * 0), InfoStr, Xwindow::Blue);
xw.drawString(xIndent, yIndent + tileSize * (1 + i + CardHeight * 1), MinionStr, Xwindow::Blue);
if (i != 10) xw.drawString(xIndent, yIndent + tileSize * (1 + i + CardHeight * 2), CENTRE_GRAPHIC.at(i), Xwindow::Black);
xw.drawString(xIndent, yIndent + tileSize * (i + CardHeight * 3), MinionStr, Xwindow::Red);
xw.drawString(xIndent, yIndent + tileSize * (i + CardHeight * 4), InfoStr, Xwindow::Red);
InfoStr = bar;
MinionStr = bar;
}
}
bool CardCompare(card_template_t &Orig, card_template_t &New) {
return Orig.at(1) == New.at(1) && Orig.at(5) == New.at(5) && Orig.at(9) == New.at(9);
}
void GraphicsDisplay::notify(Subject<State, Status> &data) {
State state = data.getState();
Player &Player1Info = state.BoardInfo->getPlayer1();
vector<unique_ptr<Card>>& Player1GraveYard = Player1Info.getGraveyard();
vector<unique_ptr<Card>>& Player1Board = Player1Info.getBoardCards();
vector<unique_ptr<Card>>& Player1Hand = Player1Info.getHand();
unique_ptr<Card>& Player1Ritual = Player1Info.getRitualCard();
Player &Player2Info = state.BoardInfo->getPlayer2();
vector<unique_ptr<Card>>& Player2GraveYard = Player2Info.getGraveyard();
vector<unique_ptr<Card>>& Player2Board = Player2Info.getBoardCards();
vector<unique_ptr<Card>>& Player2Hand = Player2Info.getHand();
unique_ptr<Card>& Player2Ritual = Player2Info.getRitualCard();
//Hand
int CurrentHand1Size = Player1Hand.size();
int CurrentHand2Size = Player2Hand.size();
card_template_t New1;
card_template_t New2;
for (int i = 0; i < 5; ++i) {
if (CurrentHand1Size <= i) New1 = CARD_TEMPLATE_EMPTY;
else New1 = Player1Hand.at(i)->getDisplay();
if (CurrentHand2Size <= i) New2 = CARD_TEMPLATE_EMPTY;
else New2 = Player2Hand.at(i)->getDisplay();
if (!CardCompare(New1, Hand1Save.at(i))) {
xw.fillRectangle(xIndentPlayer1,yIndent + tileSize * (i * (CardHeight + 1) - 3),CardWidth * xtileSize,CardHeight * tileSize,Xwindow::White);
for (int j = 0; j < CardHeight; ++j) {
int yInd = yIndent + tileSize * (j + i * (CardHeight + 1) - 2);
xw.drawString(xIndentPlayer1,yInd,New1.at(j),Xwindow::Blue);
}
Hand1Save.at(i) = move(New1);
}
if (!CardCompare(New2, Hand2Save.at(i))) {
xw.fillRectangle(xIndentPlayer2,yIndent + tileSize * (i * (CardHeight + 1) - 3),CardWidth * xtileSize,CardHeight * tileSize,Xwindow::White);
for (int j = 0; j < CardHeight; ++j) {
int yInd = yIndent + tileSize * (j + i * (CardHeight + 1) - 2);
xw.drawString(xIndentPlayer2,yInd,New2.at(j),Xwindow::Red);
}
Hand2Save.at(i) = move(New2);
}
}
Hand1Size = CurrentHand1Size;
Hand2Size = CurrentHand2Size;
//Board
int xBoard = xIndent + xtileSize;
int yBoard = yIndent + tileSize;
int xCard = CardWidth * xtileSize;
int yCard = CardHeight * tileSize;
for (int i = 0; i < 10; ++i) {
if (i == 0) {
New1 = Player1Ritual->getDisplay(); // 0
New2 = Player2Ritual->getDisplay(); // 15
} else if (i == 2) {
New1 = Player1Info.getDisplay(); // 2
New2 = Player2Info.getDisplay(); // 17
} else if (i == 4) {
if (Player1GraveYard.size() != 0) New1 = Player1GraveYard.back()->getDisplay(); // 4
else New1 = CARD_TEMPLATE_BORDER;
if (Player2GraveYard.size() != 0) New2 = Player2GraveYard.back()->getDisplay(); // 19
else New2 = CARD_TEMPLATE_BORDER;
} else if (i > 4) {
New1 = Player1Board.at(i - 5)->getDisplay(); // i
New2 = Player2Board.at(i - 5)->getDisplay(); // i + 5
} else continue;
if (!CardCompare(Board.at(i), New1)) { // assign New1 to Board vector, and draw board if notcompare, draw whitespace before
int newi = i % 5;
int newj = i / 5;
int xIndex = xBoard + newi * xCard;
int yIndex = yBoard + newj * yCard;
xw.fillRectangle(xIndex,yIndex - tileSize,xCard,yCard,Xwindow::White);
for (int i = 0; i < CardHeight; ++i) {
xw.drawString(xIndex, yIndex + tileSize * i, New1.at(i), Xwindow::Blue);
}
}
Board.at(i) = move(New1);
if (i < 5 && !CardCompare(Board.at(i + 15), New2)) { // assign New1 to Board vector, and draw board if notcompare, draw whitespace before
int newi = i % 5;
int newj = i / 5 + 4;
int xIndex = xBoard + newi * xCard;
int yIndex = yBoard + newj * yCard - tileSize;
xw.fillRectangle(xIndex,yIndex - tileSize,xCard,yCard,Xwindow::White);
for (int i = 0; i < CardHeight; ++i) {
xw.drawString(xIndex, yIndex + tileSize * i, New2.at(i), Xwindow::Red);
}
Board.at(i + 15) = move(New2);
} else if (i > 4 && !CardCompare(Board.at(i + 5), New2)) {
int newi = i % 5;
int newj = i / 5 + 2;
int xIndex = xBoard + newi * xCard;
int yIndex = yBoard + newj * yCard - tileSize;
xw.fillRectangle(xIndex,yIndex - tileSize,xCard,yCard,Xwindow::White);
for (int i = 0; i < CardHeight; ++i) {
xw.drawString(xIndex, yIndex + tileSize * i, New2.at(i), Xwindow::Red);
}
Board.at(i + 5) = move(New2);
}
}
}
| 38.158163
| 161
| 0.677898
|
woongbinchoi
|
bcbc7889a5d4177c7ae611d767a12a9d54f9d4d4
| 3,683
|
cc
|
C++
|
example/example.cc
|
wamonite/Pandrift
|
8f7d8dace2d68f030562d4698c9830d7f9624718
|
[
"MIT"
] | 3
|
2021-09-09T04:49:23.000Z
|
2022-01-23T22:33:50.000Z
|
example/example.cc
|
wamonite/Pandrift
|
8f7d8dace2d68f030562d4698c9830d7f9624718
|
[
"MIT"
] | null | null | null |
example/example.cc
|
wamonite/Pandrift
|
8f7d8dace2d68f030562d4698c9830d7f9624718
|
[
"MIT"
] | 3
|
2016-05-23T00:05:58.000Z
|
2019-06-12T06:36:21.000Z
|
/*################################################################
Pandrift
Copyright (c) 2013 Warren Moore
This software may be redistributed under the terms of the MIT License.
See the file LICENSE for details.
################################################################*/
#include "pandaFramework.h"
#include "pandaSystem.h"
#include "load_prc_file.h"
#include "world.hh"
#include "pandrift_rift_manager.hh"
#include "pandrift_display_manager.hh"
#include "boost/shared_ptr.hpp"
using namespace pandrift;
void key_escape_handler(const Event *event, void *data)
{
PandaFramework *framework = reinterpret_cast<PandaFramework*>(data);
assert(framework);
framework->set_exit_flag();
}
void key_fullscreen_handler(const Event *event, void *data)
{
// Can we use DCAST here?
WindowFramework *window_ptr = reinterpret_cast<WindowFramework*>(data);
assert(window_ptr);
PT(GraphicsWindow) graphics_window_ptr = window_ptr->get_graphics_window();
WindowProperties properties = graphics_window_ptr->get_properties();
properties.set_fullscreen(!properties.get_fullscreen());
graphics_window_ptr->request_properties(properties);
}
void key_rift_handler(const Event *event, void *data)
{
DisplayManager *display_manager = reinterpret_cast<DisplayManager*>(data);
assert(display_manager);
if (!display_manager->is_created())
{
display_manager->create_display();
}
else
{
#if 1
display_manager->set_enabled(!display_manager->is_enabled());
#else
display_manager->destroy_display();
#endif
}
cerr << "Display created? " << (display_manager->is_created() ? "Y" : "N") << endl;
cerr << "Display enabled? " << (display_manager->is_enabled() ? "Y" : "N") << endl;
}
int main(int argc, char *argv[])
{
// Create the rift manager
boost::shared_ptr<RiftManager> rift_manager_ptr(new RiftManager());
// Start the Panda framework
PandaFramework framework;
framework.open_framework(argc, argv);
framework.set_window_title("Pandrift Example");
// Override config
// load_prc_file_data("", "notify-level-glgsg debug");
load_prc_file_data("", "red-blue-stereo 0");
load_prc_file_data("", "side-by-side-stereo 0");
// Open window
WindowProperties window_properties;
framework.get_default_window_props(window_properties);
window_properties.set_size(rift_manager_ptr->get_display_width_pixels(),
rift_manager_ptr->get_display_height_pixels());
window_properties.set_fixed_size(true);
// window_properties.set_fullscreen(true);
const int cWindowFlags = 0;
PT(WindowFramework) window_ptr = framework.open_window(window_properties,
cWindowFlags);
// window_ptr->set_background_type(WindowFramework::BT_black);
// Create and configure the display manager
DisplayManager display_manager(window_ptr);
NodePath display_camera_group = display_manager.get_camera_root();
display_camera_group.reparent_to(window_ptr->get_camera_group());
display_manager.set_rift_manager(rift_manager_ptr);
// Enable keyboard
window_ptr->enable_keyboard();
framework.define_key("escape", "Exit", &key_escape_handler, &framework);
framework.define_key("f", "Toggle fullscreen", &key_fullscreen_handler, window_ptr);
framework.define_key("r", "Toggle Rift view", &key_rift_handler, &display_manager);
// Create the scene
World world(window_ptr,
window_ptr->get_render(),
window_ptr->get_camera_group());
world.set_rift_manager(rift_manager_ptr);
world.create_scene();
// Run the main loop until exit flag set
framework.main_loop();
framework.close_framework();
return 0;
}
| 31.478632
| 86
| 0.708661
|
wamonite
|
bcc2454f1f0332ef2081b2786df6a23c5a636a3a
| 5,050
|
cpp
|
C++
|
src/eleKtro/effect3d.cpp
|
aestesis/elektronika
|
870f72ca7f64942f8316b3cd8f733f43c7d2d117
|
[
"Apache-2.0"
] | 14
|
2016-05-09T01:14:03.000Z
|
2021-10-12T21:41:02.000Z
|
src/eleKtro/effect3d.cpp
|
aestesis/elektronika
|
870f72ca7f64942f8316b3cd8f733f43c7d2d117
|
[
"Apache-2.0"
] | null | null | null |
src/eleKtro/effect3d.cpp
|
aestesis/elektronika
|
870f72ca7f64942f8316b3cd8f733f43c7d2d117
|
[
"Apache-2.0"
] | 6
|
2015-08-19T01:28:54.000Z
|
2020-10-25T05:17:08.000Z
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "elektroexp.h"
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// EFFECT3D.CPP (c) YoY'03 WEB: www.aestesis.org
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include <stdio.h>
#include <d3d9.h>
#include "effect3d.h"
#include "table.h"
#include "elektro.h"
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
EDLL ACI Aeffect3d::CI = ACI("Aeffect3d", GUID(0xE4EC7600,0x00009020), &Aobject::CI, 0, NULL);
EDLL ACI Aeffect3dInfo::CI = ACI("Aeffect3dInfo", GUID(0xE4EC7600,0x00009021), &Aplugz::CI, 0, NULL);
EDLL ACI Ainput3d::CI = ACI("Ainput3d", GUID(0xE4EC7600,0x00009022), &Aobject::CI, 0, NULL);
EDLL ACI Ainput3dInfo::CI = ACI("Ainput3dInfo", GUID(0xE4EC7600,0x00009023), &Aplugz::CI, 0, NULL);
EDLL ACI Aef3dSound::CI = ACI("Aed3dSound", GUID(0xE4EC7600,0x00009024), &Anode::CI, 0, NULL);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
EDLL Aeffect3d::Aeffect3d(QIID qiid, char *name, class Aobject *f, int x, int y) : Aobject(name, f, x, y, effect3dWIDTH, effect3dHEIGHT)
{
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
EDLL Aeffect3d::~Aeffect3d()
{
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
EDLL Ainput3d::Ainput3d(QIID qiid, char *name, class Aobject *f, int x, int y) : Aobject(name, f, x, y, input3dWIDTH, input3dHEIGHT)
{
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
EDLL Ainput3d::~Ainput3d()
{
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
EDLL Aef3dSound::Aef3dSound() : Anode("ef3dSound")
{
memset(smpL, 0, sizeof(smpL));
memset(smpR, 0, sizeof(smpR));
memset(basL, 0, sizeof(smpL));
memset(basR, 0, sizeof(smpR));
memset(medL, 0, sizeof(smpL));
memset(medR, 0, sizeof(smpR));
memset(treL, 0, sizeof(smpL));
memset(treR, 0, sizeof(smpR));
bass=medium=treble=0.f;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
EDLL Aef3dSound::~Aef3dSound()
{
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
EDLL Aef3dInfo::Aef3dInfo()
{
d3d=NULL;
time=0;
dtime=0;
beat=0;
dbeat=0;
bm=blendFADE;
power=0.f;
color=0xffffffff;
colorBoost=false;
memset(in, 0, sizeof(in));
sound=NULL;
input=NULL;
effect=NULL;
inputs=null;
effects=null;
current=-1;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
EDLL Aef3dInfo::~Aef3dInfo()
{
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
| 43.913043
| 137
| 0.228119
|
aestesis
|
bcc2c4fda51af30bd0bb83bfeb934763e56dc042
| 1,257
|
cpp
|
C++
|
app/appinit.cpp
|
leolin0518/CDoc
|
52f0edaecd69f2aeec9856c473a867bab306f4b8
|
[
"Apache-2.0"
] | null | null | null |
app/appinit.cpp
|
leolin0518/CDoc
|
52f0edaecd69f2aeec9856c473a867bab306f4b8
|
[
"Apache-2.0"
] | null | null | null |
app/appinit.cpp
|
leolin0518/CDoc
|
52f0edaecd69f2aeec9856c473a867bab306f4b8
|
[
"Apache-2.0"
] | 1
|
2018-09-14T05:52:52.000Z
|
2018-09-14T05:52:52.000Z
|
#include "appinit.h"
#include "myhelper.h"
/*
* APP初始化化类
*/
AppInit::AppInit(QObject *parent) : QObject(parent)
{
mousePressed = false;
qApp->installEventFilter(this);
}
bool AppInit::eventFilter(QObject *obj, QEvent *evt)
{
QWidget *w = (QWidget *)obj;
if (!w->property("CanMove").toBool()) {
return QObject::eventFilter(obj, evt);
}
QMouseEvent *event = static_cast<QMouseEvent *>(evt);
if (event->type() == QEvent::MouseButtonPress) {
if (event->button() == Qt::LeftButton) {
mousePressed = true;
mousePoint = event->globalPos() - w->pos();
return true;
}
} else if (event->type() == QEvent::MouseButtonRelease) {
mousePressed = false;
return true;
} else if (event->type() == QEvent::MouseMove) {
if (mousePressed && (event->buttons() && Qt::LeftButton)) {
w->move(event->globalPos() - mousePoint);
return true;
}
}
return QObject::eventFilter(obj, evt);
}
//加载
void AppInit::Load()
{
MyHelper::SetUTF8Code();
MyHelper::SetChinese();
MyHelper::SetFont();
App::AppPath = QApplication::applicationDirPath();
App::ReadConfig();
MyHelper::SetStyle(App::AppStyle);
}
| 25.14
| 67
| 0.588703
|
leolin0518
|
344ab2380abc016823604592f3c505d4618c5d66
| 4,939
|
cpp
|
C++
|
src/polybench/POLYBENCH_FDTD_2D-Hip.cpp
|
crtrott/KokkosPerf
|
7f33ca298efd298474541f3e954a888d636abea4
|
[
"BSD-3-Clause"
] | 1
|
2022-03-11T22:00:42.000Z
|
2022-03-11T22:00:42.000Z
|
src/polybench/POLYBENCH_FDTD_2D-Hip.cpp
|
jonesholger/RAJAPerf
|
7b8c01cdeb32eedb832dd1cc9696d0da0831a3b5
|
[
"BSD-3-Clause"
] | null | null | null |
src/polybench/POLYBENCH_FDTD_2D-Hip.cpp
|
jonesholger/RAJAPerf
|
7b8c01cdeb32eedb832dd1cc9696d0da0831a3b5
|
[
"BSD-3-Clause"
] | null | null | null |
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
// Copyright (c) 2017-20, Lawrence Livermore National Security, LLC
// and RAJA Performance Suite project contributors.
// See the RAJAPerf/COPYRIGHT file for details.
//
// SPDX-License-Identifier: (BSD-3-Clause)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
#include "POLYBENCH_FDTD_2D.hpp"
#include "RAJA/RAJA.hpp"
#if defined(RAJA_ENABLE_HIP)
#include "common/HipDataUtils.hpp"
#include <iostream>
namespace rajaperf
{
namespace polybench
{
//
// Define thread block size for HIP execution
//
const size_t block_size = 256;
#define POLYBENCH_FDTD_2D_DATA_SETUP_HIP \
allocAndInitHipDeviceData(hz, m_hz, m_nx * m_ny); \
allocAndInitHipDeviceData(ex, m_ex, m_nx * m_ny); \
allocAndInitHipDeviceData(ey, m_ey, m_nx * m_ny); \
allocAndInitHipDeviceData(fict, m_fict, m_tsteps);
#define POLYBENCH_FDTD_2D_TEARDOWN_HIP \
getHipDeviceData(m_hz, hz, m_nx * m_ny); \
deallocHipDeviceData(ex); \
deallocHipDeviceData(ey); \
deallocHipDeviceData(fict);
__global__ void poly_fdtd2d_1(Real_ptr ey, Real_ptr fict,
Index_type ny, Index_type t)
{
Index_type j = blockIdx.x * blockDim.x + threadIdx.x;
if (j < ny) {
POLYBENCH_FDTD_2D_BODY1;
}
}
__global__ void poly_fdtd2d_2(Real_ptr ey, Real_ptr hz, Index_type ny)
{
Index_type i = blockIdx.y;
Index_type j = threadIdx.x;
if (i > 0) {
POLYBENCH_FDTD_2D_BODY2;
}
}
__global__ void poly_fdtd2d_3(Real_ptr ex, Real_ptr hz, Index_type ny)
{
Index_type i = blockIdx.y;
Index_type j = threadIdx.x;
if (j > 0) {
POLYBENCH_FDTD_2D_BODY3;
}
}
__global__ void poly_fdtd2d_4(Real_ptr hz, Real_ptr ex, Real_ptr ey,
Index_type nx, Index_type ny)
{
Index_type i = blockIdx.y;
Index_type j = threadIdx.x;
if (i < nx-1 && j < ny-1) {
POLYBENCH_FDTD_2D_BODY4;
}
}
void POLYBENCH_FDTD_2D::runHipVariant(VariantID vid)
{
const Index_type run_reps = getRunReps();
POLYBENCH_FDTD_2D_DATA_SETUP;
if ( vid == Base_HIP ) {
POLYBENCH_FDTD_2D_DATA_SETUP_HIP;
startTimer();
for (RepIndex_type irep = 0; irep < run_reps; ++irep) {
for (t = 0; t < tsteps; ++t) {
const size_t grid_size1 = RAJA_DIVIDE_CEILING_INT(ny, block_size);
hipLaunchKernelGGL((poly_fdtd2d_1), dim3(grid_size1), dim3(block_size), 0, 0, ey, fict, ny, t);
dim3 nblocks234(1, nx, 1);
dim3 nthreads_per_block234(ny, 1, 1);
hipLaunchKernelGGL((poly_fdtd2d_2), dim3(nblocks234), dim3(nthreads_per_block234),
0, 0, ey, hz, ny);
hipLaunchKernelGGL((poly_fdtd2d_3), dim3(nblocks234), dim3(nthreads_per_block234),
0, 0, ex, hz, ny);
hipLaunchKernelGGL((poly_fdtd2d_4), dim3(nblocks234), dim3(nthreads_per_block234),
0, 0, hz, ex, ey, nx, ny);
} // tstep loop
} // run_reps
stopTimer();
POLYBENCH_FDTD_2D_TEARDOWN_HIP;
} else if (vid == RAJA_HIP) {
POLYBENCH_FDTD_2D_DATA_SETUP_HIP;
POLYBENCH_FDTD_2D_VIEWS_RAJA;
using EXEC_POL1 = RAJA::hip_exec<block_size, true /*async*/>;
using EXEC_POL234 =
RAJA::KernelPolicy<
RAJA::statement::HipKernelAsync<
RAJA::statement::For<0, RAJA::hip_block_y_loop,
RAJA::statement::For<1, RAJA::hip_thread_x_loop,
RAJA::statement::Lambda<0>
>
>
>
>;
startTimer();
for (RepIndex_type irep = 0; irep < run_reps; ++irep) {
for (t = 0; t < tsteps; ++t) {
RAJA::forall<EXEC_POL1>( RAJA::RangeSegment(0, ny),
[=] __device__ (Index_type j) {
POLYBENCH_FDTD_2D_BODY1_RAJA;
});
RAJA::kernel<EXEC_POL234>(
RAJA::make_tuple(RAJA::RangeSegment{1, nx},
RAJA::RangeSegment{0, ny}),
[=] __device__ (Index_type i, Index_type j) {
POLYBENCH_FDTD_2D_BODY2_RAJA;
}
);
RAJA::kernel<EXEC_POL234>(
RAJA::make_tuple(RAJA::RangeSegment{0, nx},
RAJA::RangeSegment{1, ny}),
[=] __device__ (Index_type i, Index_type j) {
POLYBENCH_FDTD_2D_BODY3_RAJA;
}
);
RAJA::kernel<EXEC_POL234>(
RAJA::make_tuple(RAJA::RangeSegment{0, nx-1},
RAJA::RangeSegment{0, ny-1}),
[=] __device__ (Index_type i, Index_type j) {
POLYBENCH_FDTD_2D_BODY4_RAJA;
}
);
} // tstep loop
} // run_reps
stopTimer();
POLYBENCH_FDTD_2D_TEARDOWN_HIP;
} else {
std::cout << "\n POLYBENCH_FDTD_2D : Unknown Hip variant id = " << vid << std::endl;
}
}
} // end namespace polybench
} // end namespace rajaperf
#endif // RAJA_ENABLE_HIP
| 25.590674
| 103
| 0.59263
|
crtrott
|
344afde7f43af9fc259dd11323abfcfccdfa33ca
| 4,618
|
hpp
|
C++
|
2dparty/spencer_tracking_rviz_plugin/include/spencer_tracking_rviz_plugin/human_attributes_display.hpp
|
saurabhp369/pedsim_ros2
|
001491d4cd1b8df14be43673703fa232404feb84
|
[
"BSD-2-Clause"
] | 5
|
2018-12-22T08:35:08.000Z
|
2021-05-14T04:59:23.000Z
|
2dparty/spencer_tracking_rviz_plugin/include/spencer_tracking_rviz_plugin/human_attributes_display.hpp
|
saurabhp369/pedsim_ros2
|
001491d4cd1b8df14be43673703fa232404feb84
|
[
"BSD-2-Clause"
] | 2
|
2020-07-24T10:13:37.000Z
|
2020-08-24T07:16:30.000Z
|
2dparty/spencer_tracking_rviz_plugin/include/spencer_tracking_rviz_plugin/human_attributes_display.hpp
|
saurabhp369/pedsim_ros2
|
001491d4cd1b8df14be43673703fa232404feb84
|
[
"BSD-2-Clause"
] | 11
|
2018-06-08T09:15:16.000Z
|
2021-02-02T01:37:46.000Z
|
/*
* Software License Agreement (BSD License)
*
* Copyright (c) 2013-2015, Timm Linder, Social Robotics Lab, University of Freiburg
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of the copyright 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.
*/
#ifndef HUMAN_ATTRIBUTES_DISPLAY_H
#define HUMAN_ATTRIBUTES_DISPLAY_H
#ifndef Q_MOC_RUN
#include <map>
#include <boost/circular_buffer.hpp>
#include <spencer_human_attribute_msgs/HumanAttributes.h>
#include "person_display_common.h"
#include "tracked_persons_cache.h"
#include "visuals/mesh_node.h"
#endif
namespace spencer_tracking_rviz_plugin
{
/// The display which can be added in RViz to display human attributes.
class HumanAttributesDisplay: public PersonDisplayCommon<spencer_human_attribute_msgs::HumanAttributes>
{
Q_OBJECT
public:
// Constructor. pluginlib::ClassLoader creates instances by calling
// the default constructor, so make sure you have one.
HumanAttributesDisplay() {};
virtual ~HumanAttributesDisplay();
// Overrides of protected virtual functions from Display. As much
// as possible, when Displays are not enabled, they should not be
// subscribed to incoming data and should not show anything in the
// 3D view. These functions are where these connections are made
// and broken.
// Called after the constructors have run
virtual void onInitialize();
// Called periodically by the visualization manager
virtual void update(float wall_dt, float ros_dt);
protected:
// A helper to clear this display back to the initial state.
virtual void reset();
// Must be implemented by derived classes because MOC doesn't work in templates
virtual rviz::DisplayContext* getContext() {
return context_;
}
private:
struct HumanAttributeVisual {
boost::shared_ptr<Ogre::SceneNode> sceneNode;
boost::shared_ptr<MeshNode> genderMesh;
unsigned int trackId;
boost::shared_ptr<TextNode> ageGroupText;
boost::shared_ptr<TextNode> personHeightText;
};
// Functions to handle an incoming ROS message.
void processMessage(const spencer_human_attribute_msgs::HumanAttributes::ConstPtr& msg);
// Helper functions
void updateVisualStyles(boost::shared_ptr<HumanAttributeVisual>& humanAttributeVisual);
boost::shared_ptr<HumanAttributeVisual> createVisualIfNotExists(track_id trackId);
// User-editable property variables.
rviz::BoolProperty* m_render_gender_property;
rviz::BoolProperty* m_render_person_height_property;
rviz::BoolProperty* m_render_age_group_property;
rviz::FloatProperty* m_occlusion_alpha_property;
// State variables
map<track_id, boost::shared_ptr<HumanAttributeVisual> > m_humanAttributeVisuals;
Ogre::Matrix4 m_frameTransform;
TrackedPersonsCache m_trackedPersonsCache;
private Q_SLOTS:
virtual void stylesChanged();
};
} // end namespace spencer_tracking_rviz_plugin
#endif // HUMAN_ATTRIBUTES_DISPLAY_H
| 40.867257
| 107
| 0.728237
|
saurabhp369
|
344b3f6dee27e26304798b682509667dd087f416
| 3,862
|
cpp
|
C++
|
ExtLib/Aurora/Systems/RocketLibSystem/RocketLibSystemGLFW.cpp
|
Mechap/ODFAEG
|
ad4bf026ee7055aaf168c5a8e3dc57baaaf42e40
|
[
"Zlib"
] | null | null | null |
ExtLib/Aurora/Systems/RocketLibSystem/RocketLibSystemGLFW.cpp
|
Mechap/ODFAEG
|
ad4bf026ee7055aaf168c5a8e3dc57baaaf42e40
|
[
"Zlib"
] | 1
|
2020-02-14T14:19:44.000Z
|
2020-12-04T17:39:17.000Z
|
ExtLib/Aurora/Systems/RocketLibSystem/RocketLibSystemGLFW.cpp
|
Mechap/ODFAEG
|
ad4bf026ee7055aaf168c5a8e3dc57baaaf42e40
|
[
"Zlib"
] | 2
|
2021-05-23T13:45:28.000Z
|
2021-07-24T13:36:13.000Z
|
/*
* This source file is part of libRocket, the HTML/CSS Interface Middleware
*
* For the latest information, see http://www.librocket.com
*
* Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
#include "RocketLibSystem.h"
#include <Rocket/Core.h>
#include "InputGLFW.h"
#include "RocketLibSystemFileInterface.h"
#include <stdio.h>
#include <GL/glfw.h>
#include "../Systems.h"
#include "../IAssetSystem.h"
//#ifndef _WIN32
//#include <libproc.h>
//#endif
void GLFWCALL WindowResize( int width, int height );
static bool running = true;
static int g_WindowSize[4];
static RocketLibSystemFileInterface* file_interface = NULL;
bool RocketLibSystem::Initialise()
{
if( GL_FALSE == glfwInit() )
{
return false;
}
glfwSetTime(0.0);
const char* pathToAssets = gSys->pAssetSystem->GetAssetDirectory();
file_interface = new RocketLibSystemFileInterface(Rocket::Core::String(pathToAssets));
Rocket::Core::SetFileInterface(file_interface);
return true;
}
void RocketLibSystem::Shutdown()
{
glfwTerminate();
delete file_interface;
file_interface = NULL;
}
void RocketLibSystem::GetViewport( int WindowSize[4] )
{
memcpy( WindowSize, g_WindowSize, sizeof( g_WindowSize ) );
}
bool RocketLibSystem::OpenWindow(const char* name, bool attach_opengl)
{
glfwOpenWindow( 640, 768, 8, 8, 8, 8, 24, 8, GLFW_WINDOW );
glfwSetWindowTitle( name );
glfwSetWindowSizeCallback( WindowResize );
glGetIntegerv( GL_VIEWPORT, g_WindowSize);
InputGLFW::Initialise();
return true;
}
void RocketLibSystem::CloseWindow()
{
glfwCloseWindow();
}
// Flips the OpenGL buffers.
void RocketLibSystem::FlipBuffers()
{
glfwSwapBuffers();
}
void RocketLibSystem::EventLoop(RocketLibSystemIdleFunction idle_function)
{
while (running)
{
if( !glfwGetWindowParam( GLFW_OPENED ) )
{
running = false;
}
else
{
idle_function();
if( !glfwGetWindowParam( GLFW_ACTIVE ) )
{
glfwSleep( 0.1 );
}
}
}
}
void RocketLibSystem::RequestExit()
{
running = false;
}
void RocketLibSystem::DisplayError(const char* fmt, ...)
{
//not implemented
}
float RocketLibSystem::GetElapsedTime()
{
return (float)glfwGetTime();
}
void GLFWCALL WindowResize( int width, int height )
{
glViewport(0, 0, width, height);
glGetIntegerv( GL_VIEWPORT, g_WindowSize);
}
void RocketLibSystem::PreRenderRocketLib()
{
// Set up the GL state for rocket
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glDisable(GL_LIGHTING);
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glEnable( GL_ALPHA_TEST );
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, g_WindowSize[2], g_WindowSize[3], 0, -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
| 22.988095
| 90
| 0.738995
|
Mechap
|
344ca228bac72d68fe36c094379f60add6b1c3a6
| 6,630
|
cpp
|
C++
|
infer_server/tests/unit/test_request_ctrl.cpp
|
zhn6818/Cambricon_easydk
|
e696bda55c32d5b569afbd0b3869198b9ec9160e
|
[
"Apache-2.0"
] | 2
|
2021-09-14T09:00:35.000Z
|
2021-09-16T01:34:35.000Z
|
infer_server/tests/unit/test_request_ctrl.cpp
|
zhn6818/Cambricon_easydk
|
e696bda55c32d5b569afbd0b3869198b9ec9160e
|
[
"Apache-2.0"
] | null | null | null |
infer_server/tests/unit/test_request_ctrl.cpp
|
zhn6818/Cambricon_easydk
|
e696bda55c32d5b569afbd0b3869198b9ec9160e
|
[
"Apache-2.0"
] | null | null | null |
/*************************************************************************
* Copyright (C) [2020] by Cambricon, Inc. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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 <gtest/gtest.h>
#include <future>
#include <memory>
#include <random>
#include "core/request_ctrl.h"
#include "core/session.h"
namespace infer_server {
namespace {
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<int64_t> request_id_dis(0, std::numeric_limits<int64_t>::max());
std::uniform_int_distribution<uint32_t> data_num_dis(1, 100);
TEST(InferServerCore, RequestCtrl) {
int repeat_times = 10;
while (repeat_times--) {
int64_t request_id = request_id_dis(gen);
uint32_t data_num = data_num_dis(gen);
std::string tag = "test ctrl" + std::to_string(request_id);
PackagePtr out;
Status status;
bool response_done_flag = false;
bool notify_flag = false;
auto response = [&status, &out, &response_done_flag](Status s, PackagePtr pack) {
out = std::move(pack);
status = s;
response_done_flag = true;
};
auto notifier = [¬ify_flag](const RequestControl* caller) { notify_flag = true; };
std::unique_ptr<RequestControl> ctrl(new RequestControl(response, notifier, tag, request_id, data_num));
std::future<void> flag = ctrl->ResponseDonePromise();
EXPECT_EQ(tag, ctrl->Tag());
EXPECT_EQ(request_id, ctrl->RequestId());
ASSERT_EQ(data_num, ctrl->DataNum());
ASSERT_FALSE(ctrl->IsDiscarded());
ASSERT_FALSE(ctrl->IsProcessFinished());
ASSERT_TRUE(ctrl->IsSuccess());
for (uint32_t idx = 0; idx < data_num; ++idx) {
ASSERT_FALSE(ctrl->IsProcessFinished());
ASSERT_FALSE(notify_flag);
ASSERT_TRUE(ctrl->IsSuccess());
ctrl->ProcessDone(Status::SUCCESS, nullptr, idx, {});
}
ASSERT_TRUE(notify_flag);
ASSERT_TRUE(ctrl->IsProcessFinished());
ASSERT_TRUE(ctrl->IsSuccess());
ASSERT_EQ(flag.wait_for(std::chrono::milliseconds(1)), std::future_status::timeout);
ASSERT_FALSE(response_done_flag);
ctrl->Response();
ASSERT_TRUE(response_done_flag);
ctrl.reset();
ASSERT_NE(flag.wait_for(std::chrono::milliseconds(1)), std::future_status::timeout);
flag.get();
ASSERT_TRUE(out);
ASSERT_EQ(status, Status::SUCCESS);
ASSERT_EQ(out->data.size(), data_num);
}
}
auto empty_response_func = [](Status s, PackagePtr pack) {};
auto empty_notifier_func = [](const RequestControl*) {};
inline Status GenError() {
std::uniform_int_distribution<int> err_dis(1, static_cast<int>(Status::STATUS_COUNT));
return static_cast<Status>(err_dis(gen));
}
TEST(InferServerCore, RequestCtrlFailed) {
int repeat_times = 10;
while (repeat_times--) {
int64_t request_id = request_id_dis(gen);
uint32_t data_num = data_num_dis(gen);
std::uniform_int_distribution<uint32_t> error_idx_dis(0, data_num - 1);
std::set<uint32_t> err_idxs;
uint32_t err_num = error_idx_dis(gen) / 2 + 1;
while (err_idxs.size() < err_num) {
err_idxs.insert(error_idx_dis(gen));
}
std::string tag = "test ctrl" + std::to_string(request_id);
PackagePtr out;
Status status;
auto response = [&status, &out](Status s, PackagePtr pack) {
out = std::move(pack);
status = s;
};
bool notify_flag = false;
auto notifier = [¬ify_flag](const RequestControl* caller) { notify_flag = true; };
std::unique_ptr<RequestControl> ctrl(new RequestControl(response, notifier, tag, request_id, data_num));
std::future<void> flag = ctrl->ResponseDonePromise();
ASSERT_FALSE(ctrl->IsDiscarded());
ASSERT_FALSE(ctrl->IsProcessFinished());
ASSERT_TRUE(ctrl->IsSuccess());
Status first_err = Status::SUCCESS;
for (uint32_t idx = 0; idx < data_num; ++idx) {
if (err_idxs.count(idx)) {
Status err = GenError();
ASSERT_NE(err, Status::SUCCESS);
if (first_err == Status::SUCCESS) first_err = err;
ctrl->ProcessFailed(err);
EXPECT_FALSE(ctrl->IsSuccess());
} else {
ctrl->ProcessDone(Status::SUCCESS, nullptr, idx, {});
}
}
ASSERT_TRUE(notify_flag);
ASSERT_TRUE(ctrl->IsProcessFinished());
ASSERT_FALSE(ctrl->IsSuccess());
ctrl->Response();
ctrl.reset();
flag.get();
ASSERT_EQ(first_err, status);
ASSERT_TRUE(out);
ASSERT_EQ(out->data.size(), data_num);
}
}
TEST(InferServerCore, RequestCtrlDiscard) {
std::unique_ptr<RequestControl> ctrl(new RequestControl(empty_response_func, empty_notifier_func, "", 0, 4u));
ASSERT_FALSE(ctrl->IsDiscarded());
ctrl->Discard();
ASSERT_TRUE(ctrl->IsDiscarded());
}
#ifdef CNIS_RECORD_PERF
TEST(InferServerCore, RequestCtrlPerf) {
PackagePtr out;
Status status;
auto response = [&status, &out](Status s, PackagePtr pack) {
out = std::move(pack);
status = s;
};
uint32_t data_num = 4;
std::unique_ptr<RequestControl> ctrl(new RequestControl(response, empty_notifier_func, "", 0, data_num));
ctrl->BeginRecord();
std::uniform_real_distribution<float> perf_dis(0, 10000);
float a_sum = 0, b_sum = 0;
for (uint32_t idx = 0; idx < data_num; ++idx) {
float a = perf_dis(gen);
float b = perf_dis(gen);
a_sum += a;
b_sum += b;
ctrl->ProcessDone(Status::SUCCESS, nullptr, idx, {{"a", a}, {"b", b}});
}
auto perf = ctrl->Performance();
ASSERT_EQ(perf.size(), 2u);
ASSERT_NO_THROW(perf.at("a"));
ASSERT_NO_THROW(perf.at("b"));
EXPECT_FLOAT_EQ(a_sum, perf["a"]);
EXPECT_FLOAT_EQ(b_sum, perf["b"]);
ctrl->Response();
ASSERT_EQ(status, Status::SUCCESS);
ASSERT_TRUE(out);
EXPECT_EQ(out->perf, perf);
EXPECT_EQ(out->data.size(), data_num);
}
#endif
} // namespace
} // namespace infer_server
| 33.654822
| 112
| 0.669231
|
zhn6818
|
344cd6e863bcb1b431359f66c95c221534019997
| 4,022
|
cpp
|
C++
|
colorsamplerview.cpp
|
yvt/terravox
|
25412f892f295d2c259d9c5df3387d635616d555
|
[
"MIT"
] | 24
|
2015-02-26T06:38:41.000Z
|
2021-06-06T15:51:43.000Z
|
colorsamplerview.cpp
|
BuildandShoot/terravox
|
c7f5d21b053aa7c7ed3b2442d3eae65171495b5a
|
[
"MIT"
] | 17
|
2015-02-26T07:53:57.000Z
|
2017-07-28T06:31:42.000Z
|
colorsamplerview.cpp
|
yvt/terravox
|
25412f892f295d2c259d9c5df3387d635616d555
|
[
"MIT"
] | 6
|
2015-02-26T06:38:45.000Z
|
2020-03-29T19:12:10.000Z
|
#include "colorsamplerview.h"
#include <QPainter>
#include "terrainview.h"
#include <QTimer>
#include <QApplication>
#include <QPixmap>
#include "terrain.h"
ColorSamplerView::ColorSamplerView(TerrainView *view, QObject *parent) :
QObject(parent),
view(view),
active(false),
hover(false),
otherActive(false),
mouseHover(false)
{
connect(view, SIGNAL(clientMousePressed(QMouseEvent*)),
SLOT(clientMousePressed(QMouseEvent*)));
connect(view, SIGNAL(clientMouseReleased(QMouseEvent*)),
SLOT(clientMouseReleased(QMouseEvent*)));
connect(view, SIGNAL(clientMouseMoved(QMouseEvent*)),
SLOT(clientMouseMoved(QMouseEvent*)));
connect(view, SIGNAL(clientPaint(QPaintEvent*)),
SLOT(clientPaint(QPaintEvent*)));
connect(view, SIGNAL(clientEnter(QEvent*)),
SLOT(clientEnter(QEvent*)));
connect(view, SIGNAL(clientLeave(QEvent*)),
SLOT(clientLeave(QEvent*)));
connect(view, SIGNAL(terrainPaint(TerrainViewDrawingContext*)),
SLOT(terrainPaint(TerrainViewDrawingContext*)));
timer.reset(new QTimer());
timer->setInterval(30);
connect(timer.data(), SIGNAL(timeout()), SLOT(checkModifier()));
cursor = QCursor(QPixmap(":/Terravox/cursorEyedropper.png"), 5, 26);
}
ColorSamplerView::~ColorSamplerView()
{
}
void ColorSamplerView::clientMousePressed(QMouseEvent *e)
{
if (e->isAccepted()) {
otherActive = true;
}
checkModifier();
if (active) {
return;
}
if (hover && e->button() == Qt::LeftButton) {
active = true;
e->accept();
clientMouseMoved(e);
} else {
otherActive = true;
}
}
void ColorSamplerView::clientMouseReleased(QMouseEvent *e)
{
if (e->buttons() == 0) {
otherActive = false;
}
if (e->button() == Qt::LeftButton) {
active = false;
}
checkModifier();
}
void ColorSamplerView::clientMouseMoved(QMouseEvent *e)
{
cursorPos = e->pos();
checkModifier();
if (hover) {
// sample
lastSampledColor = QColor();
if (QRect(QPoint(0, 0), view->size()).contains(e->pos())) {
auto p = view->rayCast(e->pos());
Terrain *t = view->terrain().data();
auto tsz = t->size();
if (p.x() >= 0 && p.y() >= 0 && p.x() < tsz.width() && p.y() < tsz.height()) {
lastSampledColor = QColor::fromRgb(t->color(p.x(), p.y()) | 0xff000000);
}
}
if (active && lastSampledColor.isValid()) {
emit sampled(lastSampledColor);
}
view->update();
}
}
void ColorSamplerView::clientPaint(QPaintEvent *)
{
if (!hover)
return;
QPainter p(view);
p.setRenderHint(QPainter::Antialiasing);
if (lastSampledColor.isValid()) {
p.setPen(Qt::NoPen);
p.setBrush(QColor(qRgba(0, 0, 0, 128)));
p.drawEllipse(cursorPos, 7, 7);
p.setBrush(QColor(qRgba(255, 255, 255, 255)));
p.drawEllipse(cursorPos, 6, 6);
p.setBrush(lastSampledColor);
p.drawEllipse(cursorPos, 5, 5);
}
}
void ColorSamplerView::clientEnter(QEvent *)
{
//timer->start(); // FIXME: find better way...
mouseHover = true;
checkModifier();
}
void ColorSamplerView::clientLeave(QEvent *)
{
//timer->stop();
mouseHover = false;
checkModifier();
}
void ColorSamplerView::terrainPaint(TerrainViewDrawingContext *dc)
{
}
void ColorSamplerView::checkModifier(Qt::KeyboardModifiers km)
{
bool state = km & Qt::AltModifier;
state = state && mouseHover;
if (active) {
state = true;
}
if (otherActive) {
state = false;
}
if (state != hover) {
if (state) {
view->addCursorOverride(&cursor);
} else {
view->removeCursorOverride(&cursor);
}
view->update();
hover = state;
}
}
void ColorSamplerView::checkModifier()
{
checkModifier(QApplication::keyboardModifiers());
}
| 25.1375
| 90
| 0.597961
|
yvt
|
3453c1208dc9898b20a1794c78139bf799e0a4c6
| 5,091
|
cpp
|
C++
|
2.0/pio-2.2/src/hub/main.cpp
|
msmcs-robotics/robot1
|
cc467daf23eefabd4dd8ffaf053f4c72c91a1e15
|
[
"0BSD"
] | null | null | null |
2.0/pio-2.2/src/hub/main.cpp
|
msmcs-robotics/robot1
|
cc467daf23eefabd4dd8ffaf053f4c72c91a1e15
|
[
"0BSD"
] | null | null | null |
2.0/pio-2.2/src/hub/main.cpp
|
msmcs-robotics/robot1
|
cc467daf23eefabd4dd8ffaf053f4c72c91a1e15
|
[
"0BSD"
] | null | null | null |
#include <Arduino.h>
#include <Wire.h>
#include <pb_decode.h>
#include <Ultrasonic.h> // lib link - https://github.com/JRodrigoTech/Ultrasonic-HC-SR04
#include <SD.h>
#include "ref.pb.h"
// I2C packets
const auto BAUD_RATE = 115200;
const auto I2C_ADDRESS = 8;
void handle_packet(int packet_len);
// setup SD card pin
const int chipSelect = 4;
// Ultrasonic Sensors
Ultrasonic us1(A0,A1); // (Trig PIN,Echo PIN)
Ultrasonic us2(A2,A3); // pinout, pinin
Ultrasonic us3(A4,A5);
// setup motor pin variables
int m1 = 3;
int m2 = 7;
int m3 = 8;
int m4 = 9;
int p1 = 5;
int p2 = 6;
// Need to discern between manual and automatic controll in app
void setup() {
Serial.begin(BAUD_RATE);
Wire.begin(I2C_ADDRESS);
Wire.onReceive(handle_packet);
// motors (digital pins)
pinMode(m1, OUTPUT);
pinMode(m2, OUTPUT);
pinMode(m3, OUTPUT);
pinMode(m4, OUTPUT);
pinMode(p1, OUTPUT);
pinMode(p2, OUTPUT);
//sd card setup
pinMode(10, OUTPUT);
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
// don't do anything more:
return;
}
}
// Function to write High/Low(x4) and PWM values to motor pins
void drive(int rv, int lv) {
digitalWrite(m1, rv > 0 ? HIGH : LOW);
digitalWrite(m2, rv < 0 ? HIGH : LOW);
digitalWrite(m3, lv > 0 ? HIGH : LOW);
digitalWrite(m4, lv < 0 ? HIGH : LOW);
analogWrite(p1, abs(rv));
analogWrite(p2, abs(lv));
File dataFile = SD.open("manual-data.txt", FILE_WRITE);
if (dataFile) {
dataFile.println(rv+" , "+lv);
dataFile.close();
// print to the serial port too:
Serial.println("...");
} else {
Serial.println("error opening manual-data.txt");
}
}
void halt() {
digitalWrite(m1, LOW);
digitalWrite(m2, LOW);
digitalWrite(m3, LOW);
digitalWrite(m4, LOW);
}
// Decode the packet recieved from the ESP8266mod
void handle_packet(int packet_len) {
unsigned char packet_data[packet_len];
for (auto i = 0; i < packet_len; i++) {
packet_data[i] = Wire.read();
}
MotorVoltage voltage = MotorVoltage_init_zero;
auto stream = pb_istream_from_buffer(packet_data, packet_len);
/*
Make a switch to send a value that is either 1 or 0, or dont send.
If switch is on (v=1), send a constant stream to stop the robot until volates are recieved and map those voltages
Else if switch is off (v=0), send a constant stream of data the robot to run the autonomy function
Else stop the robot.
int v;
if ( v = 1) {
stop();
drive(voltage.rv, voltage.lv);
} else if (v = 0) {
autonomy();
}
*/
if (!pb_decode(&stream, &MotorVoltage_msg, &voltage)) {
Serial.print("Warning: Message decoding failed: ");
Serial.println(PB_GET_ERROR(&stream));
} else {
drive(voltage.rv, voltage.lv);
}
}
void autonomy() {
// get distances from objects
int u1 = us1.Ranging(CM);
int u2 = us2.Ranging(CM);
int u3 = us3.Ranging(CM);
// setup values for math
int rv1 = 0;
int rv2 = 0;
int rvf;
int lv1 = 0;
int lv2 = 0;
int lvf;
//put distances on a scale of PWM
// from front sensor
rv1 = map(u1, 1, 51, 0, 255);
lv1 = rv1;
// from left sensor
lv2 = map(u2, 1, 51, 0, 255);
//from right sensor
rv2 = map(u3, 1, 51, 0, 255);
/* if less than 10cm away from front,
add value to voltages so that they
will make the final voltage negative,
making the motors spin backwards.
- The added value of 255 compensates for the conversion
of distance to PWM.
- The motors slow down the closer the robot gets to a robot.
- If the robot is 10cm or less from an object, add 255, so that
when written value is rubtracted from the final value, the result
will be negative, making the motors spin backward.
- The only fallacy in this method is that if the robot is
10cm or less from objects from multiple sensors, the final
voltage will result in a value greater than 255, so the robot
will have to move straight back before turning away from multiple
objects.
*/
if (u1 <= 10) {
rv1 += 255;
lv1 += 255;
}
if (u2 <= 10) {
lv2 += 255;
}
if (u3 <= 10) {
rv2 += 255;
}
rvf = 255 - rv1 - rv2;
lvf = 255 - lv1 - lv2;
if (rvf < -255) {
rvf = -255;
}
if (lvf < -255) {
lvf = -255;
}
/*
digitalWrite(m1, rvf > 0 ? HIGH : LOW);
digitalWrite(m2, rvf < 0 ? HIGH : LOW);
digitalWrite(m3, lvf > 0 ? HIGH : LOW);
digitalWrite(m4, lvf < 0 ? HIGH : LOW);
analogWrite(p1, abs(rvf));
analogWrite(p2, abs(lvf));
*/
drive(rvf, lvf);
File dataFile = SD.open("auto-data.txt", FILE_WRITE);
if (dataFile) {
dataFile.println(rvf+" , "+lvf);
dataFile.close();
// print to the serial port too:
Serial.println("...");
} else {
Serial.println("error opening auto-data.txt");
}
}
void loop(){}
| 24.242857
| 149
| 0.602829
|
msmcs-robotics
|
34553b781399bb04075e09e25f573f4f5a61dd09
| 7,401
|
cpp
|
C++
|
Dark Basic Public Shared/Dark Basic Pro SDK/Shared/Core/SteamCheckForWorkshop.cpp
|
domydev/Dark-Basic-Pro
|
237fd8d859782cb27b9d5994f3c34bc5372b6c04
|
[
"MIT"
] | 231
|
2018-01-28T00:06:56.000Z
|
2022-03-31T21:39:56.000Z
|
Dark Basic Public Shared/Dark Basic Pro SDK/Shared/Core/SteamCheckForWorkshop.cpp
|
domydev/Dark-Basic-Pro
|
237fd8d859782cb27b9d5994f3c34bc5372b6c04
|
[
"MIT"
] | 9
|
2016-02-10T10:46:16.000Z
|
2017-12-06T17:27:51.000Z
|
Dark Basic Public Shared/Dark Basic Pro SDK/Shared/Core/SteamCheckForWorkshop.cpp
|
domydev/Dark-Basic-Pro
|
237fd8d859782cb27b9d5994f3c34bc5372b6c04
|
[
"MIT"
] | 66
|
2018-01-28T21:54:52.000Z
|
2022-02-16T22:50:57.000Z
|
#define _CRT_SECURE_NO_WARNINGS
#include "SteamCheckForWorkshop.h"
#include <stdio.h>
// Steam Multiplayer DLL functions needed
HMODULE SteamMultiplayerModule = NULL;
typedef void (*t_SteamGetWorkshopItemPathDLL)(LPSTR);
typedef int (*t_SteamIsWorkshopLoadingOnDLL)();
t_SteamGetWorkshopItemPathDLL Steam_SteamGetWorkshopItemPathDLL = NULL;
t_SteamIsWorkshopLoadingOnDLL Steam_SteamIsWorkshopLoadingOnDLL = NULL;
// End of Steam Multiplayer DLL Functions needed
bool CheckForWorkshopFile ( LPSTR VirtualFilename)
{
if ( !VirtualFilename ) return false;
if ( strlen ( VirtualFilename ) < 3 ) return false;
char* tempCharPointerCheck = NULL;
tempCharPointerCheck = strrchr( VirtualFilename, '\\' );
if ( tempCharPointerCheck == VirtualFilename+strlen(VirtualFilename)-1 ) return false;
if ( VirtualFilename[0] == '.' ) return false;
if ( strstr ( VirtualFilename , ".fpm" ) ) return false;
// encrypted file check
char szEncryptedFilename[_MAX_PATH];
char szEncryptedFilenameFolder[_MAX_PATH];
char* tempCharPointer = NULL;
strcpy ( szEncryptedFilenameFolder, VirtualFilename );
// replace and forward slashes with backslash
for ( int c = 0 ; c < strlen(szEncryptedFilenameFolder); c++ )
{
if ( szEncryptedFilenameFolder[c] == '/' )
szEncryptedFilenameFolder[c] = '\\';
}
tempCharPointer = strrchr( szEncryptedFilenameFolder, '\\' );
if ( tempCharPointer && tempCharPointer != szEncryptedFilenameFolder+strlen(szEncryptedFilenameFolder)-1 )
{
tempCharPointer[0] = 0;
sprintf ( szEncryptedFilename , "%s\\_e_%s" , szEncryptedFilenameFolder , tempCharPointer+1 );
}
else
{
sprintf ( szEncryptedFilename , "_e_%s" , szEncryptedFilenameFolder );
}
FILE* tempFile = NULL;
tempFile = fopen ( szEncryptedFilename ,"r" );
if ( tempFile )
{
fclose ( tempFile );
strcpy ( VirtualFilename , szEncryptedFilename );
return true;
}
// end of encrypted file check
// Check if the functions pointers exist, if they don't - jolly well make them!
if ( Steam_SteamIsWorkshopLoadingOnDLL==NULL )
{
// Setup pointers to Steam functions
SteamMultiplayerModule = LoadLibrary ( "SteamMultiplayer.dll" );
if ( !SteamMultiplayerModule )
{
//MessageBox(NULL, "Unable to find SteamMultiplayer", "SteamMultiplayer Error", NULL);
return false;
}
Steam_SteamGetWorkshopItemPathDLL=(t_SteamGetWorkshopItemPathDLL)GetProcAddress( SteamMultiplayerModule , "?SteamGetWorkshopItemPathDLL@@YAXPAD@Z" );
Steam_SteamIsWorkshopLoadingOnDLL=(t_SteamIsWorkshopLoadingOnDLL)GetProcAddress ( SteamMultiplayerModule , "?SteamIsWorkshopLoadingOnDLL@@YAHXZ" );
// End of setup pointers to steam functions
}
// CHECK FOR WORKSHOP ITEM
if ( !Steam_SteamIsWorkshopLoadingOnDLL || !Steam_SteamGetWorkshopItemPathDLL )
return false;
if ( Steam_SteamIsWorkshopLoadingOnDLL() == 1 )
{
char szWorkshopFilename[_MAX_PATH];
char szWorkshopFilenameFolder[_MAX_PATH];
char szWorkShopItemPath[_MAX_PATH];
Steam_SteamGetWorkshopItemPathDLL(szWorkShopItemPath);
//strcpy ( szWorkShopItemPath,"D:\\Games\\Steam\\steamapps\\workshop\\content\\266310\\378822626");
// If the string is empty then there is no active workshop item, so we can return
if ( strcmp ( szWorkShopItemPath , "" ) == 0 ) return false;
char* tempCharPointer = NULL;
strcpy ( szWorkshopFilenameFolder, VirtualFilename );
// only check if the workshop item path isnt blank
if ( strcmp ( szWorkShopItemPath , "" ) )
{
// replace and forward slashes with backslash
for ( unsigned int c = 0 ; c < strlen(szWorkshopFilenameFolder); c++ )
{
if ( szWorkshopFilenameFolder[c] == '/' )
szWorkshopFilenameFolder[c] = '\\';
if ( szWorkshopFilenameFolder[c] == '_' )
szWorkshopFilenameFolder[c] = '@';
}
// strip off any path to files folder
bool found = true;
while ( found )
{
char* stripped = strstr ( szWorkshopFilenameFolder , "Files\\" );
if ( !stripped )
stripped = strstr ( szWorkshopFilenameFolder , "files\\" );
if ( stripped )
strcpy ( szWorkshopFilenameFolder , stripped+6 );
else
found = false;
}
bool last = false;
char tempstring[MAX_PATH];
strcpy ( tempstring, szWorkshopFilenameFolder);
strcpy ( szWorkshopFilenameFolder , "" );
// replace and forward slashes with backslash
for ( unsigned int c = 0 ; c < strlen(tempstring); c++ )
{
if ( tempstring[c] == '/' || tempstring[c] == '\\' )
{
if ( last == false )
{
strcat ( szWorkshopFilenameFolder , "_" );
last = true;
}
}
else
{
strcat ( szWorkshopFilenameFolder , " " );
szWorkshopFilenameFolder[strlen(szWorkshopFilenameFolder)-1] = tempstring[c];
last = false;
}
}
//NEED TO CHECK IF THE FILE EXISTS FIRST, IF IT DOES WE COPY IT
char szTempName[_MAX_PATH];
strcpy ( szTempName , szWorkShopItemPath );
strcat ( szTempName , "\\" );
strcat ( szTempName , szWorkshopFilenameFolder );
/*FILE* tempy = NULL;
tempy = fopen ( "f:\\DUMPFILE.txt" ,"a" );
if ( tempy )
{
fputs ( szTempName , tempy );
fputs ( "\n" , tempy );
fclose ( tempy );
}*/
FILE* tempFile = NULL;
tempFile = fopen ( szTempName ,"r" );
if ( tempFile )
{
fclose ( tempFile );
int szTempNamelength = strlen(szTempName);
int virtualfilelength = strlen(VirtualFilename);
strcpy ( VirtualFilename , szTempName );
/*FILE* tempy = NULL;
tempy = fopen ( "f:\\DUMPFILE.txt" ,"a" );
if ( tempy )
{
fputs ( szWorkShopItemPath , tempy );
fputs ( "\n" , tempy );
fputs ( VirtualFilename , tempy );
fputs ( "\n" , tempy );
fputs ( "============" , tempy );
fputs ( "\n" , tempy );
fclose ( tempy );
}*/
return true;
}
else // check for encrypted version
{
char* tempCharPointer = NULL;
tempCharPointer = strrchr( szTempName, '\\' );
if ( tempCharPointer && tempCharPointer != szTempName+strlen(szTempName)-1 )
{
tempCharPointer[0] = 0;
sprintf ( szWorkshopFilename , "%s\\_w_%s" , szTempName , tempCharPointer+1 );
}
else
{
sprintf ( szWorkshopFilename , "_w_%s" , szTempName );
}
FILE* tempFile = NULL;
tempFile = fopen ( szWorkshopFilename ,"r" );
if ( tempFile )
{
fclose ( tempFile );
strcpy ( VirtualFilename , szWorkshopFilename );
return true;
}
}
}
}
return false;
// END OF CHECK FOR WORKSHOP ITEM
}
bool Steam_CanIUse_W_()
{
// Check if the functions pointers exist, if they don't - jolly well make them!
if ( Steam_SteamIsWorkshopLoadingOnDLL==NULL )
{
// Setup pointers to Steam functions
SteamMultiplayerModule = LoadLibrary ( "SteamMultiplayer.dll" );
if ( !SteamMultiplayerModule )
{
//MessageBox(NULL, "Unable to find SteamMultiplayer", "SteamMultiplayer Error", NULL);
return false;
}
Steam_SteamGetWorkshopItemPathDLL=(t_SteamGetWorkshopItemPathDLL)GetProcAddress( SteamMultiplayerModule , "?SteamGetWorkshopItemPathDLL@@YAXPAD@Z" );
Steam_SteamIsWorkshopLoadingOnDLL=(t_SteamIsWorkshopLoadingOnDLL)GetProcAddress ( SteamMultiplayerModule , "?SteamIsWorkshopLoadingOnDLL@@YAHXZ" );
// End of setup pointers to steam functions
}
if ( !Steam_SteamIsWorkshopLoadingOnDLL || !Steam_SteamGetWorkshopItemPathDLL )
return false;
if ( Steam_SteamIsWorkshopLoadingOnDLL() == 1 )
return true;
return false;
}
| 30.709544
| 151
| 0.686529
|
domydev
|
345988252dc830cd1fb53e38e8bfb2a985e84351
| 3,886
|
cpp
|
C++
|
HDUOJ/2242/tarjan_edcc.cpp
|
codgician/ACM
|
391f3ce9b89b0a4bbbe3ff60eb2369fef57460d4
|
[
"MIT"
] | 2
|
2018-02-14T01:59:31.000Z
|
2018-03-28T03:30:45.000Z
|
HDUOJ/2242/tarjan_edcc.cpp
|
codgician/ACM
|
391f3ce9b89b0a4bbbe3ff60eb2369fef57460d4
|
[
"MIT"
] | null | null | null |
HDUOJ/2242/tarjan_edcc.cpp
|
codgician/ACM
|
391f3ce9b89b0a4bbbe3ff60eb2369fef57460d4
|
[
"MIT"
] | 2
|
2017-12-30T02:46:35.000Z
|
2018-03-28T03:30:49.000Z
|
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <iomanip>
#include <climits>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <stack>
#define EDGE_SIZE 40100
#define VERTEX_SIZE 10010
using namespace std;
typedef struct _Edge
{
int to;
int next;
} Edge;
Edge arr[EDGE_SIZE];
int head[VERTEX_SIZE], arrPt;
int dfn[VERTEX_SIZE], low[VERTEX_SIZE], cntTime;
int edccId[VERTEX_SIZE], edccSize[VERTEX_SIZE], edccNum;
int roomCap[VERTEX_SIZE];
bool isBridge[EDGE_SIZE];
int bridgeNum;
Edge compArr[EDGE_SIZE];
int compHead[VERTEX_SIZE], compArrPt;
bool hasVisited[VERTEX_SIZE];
int capSum, ans;
void addEdge(int from, int to)
{
arr[arrPt] = {to, head[from]};
head[from] = arrPt++;
}
void addCompEdge(int from, int to)
{
compArr[compArrPt] = {to, compHead[from]};
compHead[from] = compArrPt++;
}
void tarjan(int cntPt, int edgeId)
{
dfn[cntPt] = cntTime;
low[cntPt] = cntTime;
cntTime++;
for (int i = head[cntPt]; i != -1; i = arr[i].next)
{
int nextPt = arr[i].to;
if (dfn[nextPt] == -1)
{
tarjan(nextPt, i);
low[cntPt] = min(low[cntPt], low[nextPt]);
if (low[nextPt] > dfn[cntPt])
{
bridgeNum++;
isBridge[i] = true;
isBridge[i ^ 1] = true;
}
}
else if (i != (edgeId ^ 1))
{
low[cntPt] = min(low[cntPt], dfn[nextPt]);
}
}
}
void dfs(int cntPt)
{
edccId[cntPt] = edccNum;
edccSize[edccNum] += roomCap[cntPt];
for (int i = head[cntPt]; i != -1; i = arr[i].next)
{
int nextPt = arr[i].to;
if (edccId[nextPt] > -1 || isBridge[i])
continue;
dfs(nextPt);
}
}
int dfs2(int cntPt)
{
hasVisited[cntPt] = true;
int nowSum = edccSize[cntPt];
for (int i = compHead[cntPt]; i != -1; i = compArr[i].next)
{
int nextPt = compArr[i].to;
if (hasVisited[nextPt])
continue;
nowSum += dfs2(nextPt);
}
ans = min(ans, abs(capSum - (nowSum << 1)));
return nowSum;
}
int main()
{
int vertexNum, edgeNum;
while (cin >> vertexNum >> edgeNum)
{
memset(head, -1, sizeof(head));
memset(compHead, -1, sizeof(compHead));
memset(dfn, -1, sizeof(dfn));
memset(edccId, -1, sizeof(edccId));
memset(edccSize, 0, sizeof(edccSize));
memset(isBridge, false, sizeof(isBridge));
memset(hasVisited, false, sizeof(hasVisited));
arrPt = 0;
compArrPt = 0;
cntTime = 0;
edccNum = 0;
bridgeNum = 0;
ans = INT_MAX;
capSum = 0;
for (int i = 0; i < vertexNum; i++)
{
cin >> roomCap[i];
capSum += roomCap[i];
}
for (int i = 0; i < edgeNum; i++)
{
int from, to;
cin >> from >> to;
addEdge(from, to);
addEdge(to, from);
}
for (int i = 0; i < vertexNum; i++)
{
if (dfn[i] == -1)
{
tarjan(i, 0);
}
}
if (bridgeNum == 0)
{
cout << "impossible" << endl;
continue;
}
for (int i = 0; i < vertexNum; i++)
{
if (edccId[i] == -1)
{
dfs(i);
edccNum++;
}
}
for (int i = 0; i < arrPt; i += 2)
{
int from = arr[i ^ 1].to;
int to = arr[i].to;
if (edccId[from] == edccId[to])
continue;
addCompEdge(edccId[from], edccId[to]);
addCompEdge(edccId[to], edccId[from]);
}
dfs2(0);
cout << ans << endl;
}
return 0;
}
| 21.234973
| 63
| 0.492795
|
codgician
|
345dafc0f0eeca907ad8fc1d640c2450986a17c8
| 1,337
|
cpp
|
C++
|
07/src/main.cpp
|
mert-kurttutan/nand2tetris_course2
|
b7ef8b4448c2b2576c338ac68a1ed5f23ab9fe6a
|
[
"MIT"
] | null | null | null |
07/src/main.cpp
|
mert-kurttutan/nand2tetris_course2
|
b7ef8b4448c2b2576c338ac68a1ed5f23ab9fe6a
|
[
"MIT"
] | null | null | null |
07/src/main.cpp
|
mert-kurttutan/nand2tetris_course2
|
b7ef8b4448c2b2576c338ac68a1ed5f23ab9fe6a
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include <parser.hpp>
#include <codewriter.hpp>
#include <utils.hpp>
#include <iomanip>
void VMTranslator(string file_name, string output_name);
void print(std::vector <string> const &a) {
std::cout << "The vector elements are : ";
for(int i=0; i < int(a.size()); i++)
std::cout << a.at(i) << "--";
std::cout << "\n";
}
int main(int argc, char **argv){
string file_name = argv[1];
string output_name = file_name.substr(0,file_name.size()-2)+"asm";
Parser my_parser = Parser(file_name);
CodeWriter my_coder = CodeWriter(output_name);
VMTranslator(file_name, output_name);
return 0;
}
void VMTranslator(string file_name, string output_name){
Parser my_parser = Parser(file_name);
CodeWriter my_coder = CodeWriter(output_name);
string current_command;
while(my_parser.hasMoreCommands()){
my_parser.advance();
if (my_parser.commandType() == "C_ARITHMETIC"){
my_coder.writeArithmetic(my_parser.arg1() );
}
else if(my_parser.commandType() == "C_PUSH" || my_parser.commandType() == "C_POP"){
my_coder.writePushPop(my_parser.commandType(), my_parser.arg1(), my_parser.arg2());
}
else{
std::cout << "oh no\n";
}
}
my_parser.close();
my_coder.close();
}
| 23.45614
| 95
| 0.62902
|
mert-kurttutan
|
345feea02687b7057157c591fd850cfb7674ba7b
| 3,115
|
cpp
|
C++
|
src/driver.cpp
|
pcdangio/ros-interface_quad_encoder
|
af2cc49acbde8f5684a65b16a18f50d54d0cdc87
|
[
"MIT"
] | null | null | null |
src/driver.cpp
|
pcdangio/ros-interface_quad_encoder
|
af2cc49acbde8f5684a65b16a18f50d54d0cdc87
|
[
"MIT"
] | 1
|
2019-05-26T18:25:43.000Z
|
2019-05-26T18:25:43.000Z
|
src/driver.cpp
|
pcdangio/ros-interface_quad_encoder
|
af2cc49acbde8f5684a65b16a18f50d54d0cdc87
|
[
"MIT"
] | null | null | null |
#include "driver.h"
#include <math.h>
// CONSTRUCTORS
driver::driver()
{
// Set default values
driver::m_current_position = 0;
driver::m_prior_state = 0;
driver::m_pulses_missed = 0;
// Set the parameters.
driver::m_cpr = 400;
// Set up the qmatrix, which is to be indexed by (prior_state, current_state)
driver::m_transition_matrix = {{0, 1, -1, 2}, {1, 0, 2, -1}, {-1, 2, 0, 1}, {2, 1, -1, 0}};
}
driver::~driver()
{
// Do nothing, virtual destructor.
}
// METHODS
void driver::initialize(uint32_t gpio_pin_a, uint32_t gpio_pin_b, uint32_t ppr)
{
// Store the cpr and spin_ratios.
driver::m_cpr = ppr * 2UL; // Two counts for each pulse (rising/falling edge).
// Call the extended class's initialize_gpio method.
initialize_gpio(gpio_pin_a, gpio_pin_b);
// Initialize the state using the extended class's read methods.
bool level_a = read_gpio(gpio_pin_a);
bool level_b = read_gpio(gpio_pin_b);
driver::m_mutex.lock();
driver::initialize_state(level_a, level_b);
driver::m_mutex.unlock();
}
void driver::set_home()
{
driver::m_mutex.lock();
// Set current position to zero.
driver::m_current_position = 0;
// Reset the missed pulses flag.
driver::m_pulses_missed = 0;
driver::m_mutex.unlock();
}
double driver::get_position(bool reset)
{
// Get current position in CPR.
driver::m_mutex.lock();
double position = static_cast<double>(driver::m_current_position);
if(reset)
{
driver::m_current_position = 0;
driver::m_pulses_missed = 0;
}
driver::m_mutex.unlock();
// Return position in radians.
return position / static_cast<double>(driver::m_cpr) * 2.0 * M_PIf64;
}
void driver::tick_a(bool level)
{
driver::m_mutex.lock();
// Calculate the new state.
uint32_t new_state = (driver::m_prior_state & 1) | (static_cast<uint32_t>(level) << 1);
// Update the encoder's state with the new state.
driver::update_state(new_state);
driver::m_mutex.unlock();
}
void driver::tick_b(bool level)
{
driver::m_mutex.lock();
// Calculate the new state.
uint32_t new_state = (driver::m_prior_state & 2) | static_cast<uint32_t>(level);
// Update the encoder's state with the new state.
driver::update_state(new_state);
driver::m_mutex.unlock();
}
void driver::initialize_state(bool level_a, bool level_b)
{
// Initialize the prior state with the current state.
driver::m_prior_state = (static_cast<uint32_t>(level_a) << 1) | static_cast<uint32_t>(level_b);
}
void driver::update_state(uint32_t new_state)
{
// Get the transition value.
int transition = driver::m_transition_matrix.at(driver::m_prior_state).at(new_state);
// Check if there was a valid transition.
if(transition == 2)
{
driver::m_pulses_missed += 1;
}
else
{
// Update the position.
driver::m_current_position += transition;
}
// Update the prior state.
driver::m_prior_state = new_state;
}
// PROPERTIES
uint64_t driver::pulses_missed()
{
return driver::m_pulses_missed;
}
| 27.8125
| 99
| 0.666453
|
pcdangio
|
34648bec9320e1871bcc01e8941a248c15a878d8
| 835
|
cpp
|
C++
|
pointers/this_pointer.cpp
|
gunnarpope/cpp_tutorials
|
e8e152668b0d12c5ce7b5152580d6ddcc731ecb7
|
[
"MIT"
] | null | null | null |
pointers/this_pointer.cpp
|
gunnarpope/cpp_tutorials
|
e8e152668b0d12c5ce7b5152580d6ddcc731ecb7
|
[
"MIT"
] | null | null | null |
pointers/this_pointer.cpp
|
gunnarpope/cpp_tutorials
|
e8e152668b0d12c5ce7b5152580d6ddcc731ecb7
|
[
"MIT"
] | null | null | null |
// how to use the this pointer
// p344 C++CompleteGuide.pdf
/*
""The this pointer points to the object that invoked pwr( ). Thus, this –>b refers to that
object's copy of b. For example, if pwr( ) had been invoked by x (as in x(4.0, 2)), then
this in the preceding statement would have been pointing to x. Writing the statement
without using this is really just shorthand.""
*/
#include <iostream>
using namespace std;
class pwr{
double b;
int e;
double val;
public:
pwr(double base, int exp);
double get_pwr() { return this->val; }
};
pwr::pwr(double base, int exp)
{
b = base;
this->e = exp;
val = 1;
if(exp==0) return;
for (; exp > 0; exp--) {val = val * b;}
}
int main()
{
pwr x(4.0, 2), y(2.5, 1), z(5.7, 0);
cout << x.get_pwr() << '\n';
cout << y.get_pwr() << '\n';
cout << z.get_pwr() << '\n';
return 0;
}
| 19.880952
| 90
| 0.623952
|
gunnarpope
|
346a0db646e964fb8401631336321228c508d189
| 806
|
hxx
|
C++
|
tests/cvmuls.hxx
|
zardchim/opencvx
|
f3727c9be5532f9a41c29f558e72aa19b6db97a4
|
[
"Unlicense"
] | 10
|
2015-01-29T23:21:06.000Z
|
2019-07-05T06:27:16.000Z
|
tests/cvmuls.hxx
|
zardchim/opencvx
|
f3727c9be5532f9a41c29f558e72aa19b6db97a4
|
[
"Unlicense"
] | null | null | null |
tests/cvmuls.hxx
|
zardchim/opencvx
|
f3727c9be5532f9a41c29f558e72aa19b6db97a4
|
[
"Unlicense"
] | 13
|
2015-04-13T20:50:36.000Z
|
2022-03-20T16:06:05.000Z
|
#ifdef _MSC_VER
#pragma warning(disable:4996)
#pragma comment(lib, "cv.lib")
#pragma comment(lib, "cxcore.lib")
#pragma comment(lib, "cvaux.lib")
#pragma comment(lib, "highgui.lib")
#endif
#include <stdio.h>
#include <stdlib.h>
#include "cv.h"
#include "cvaux.h"
#include "cxcore.h"
#include "highgui.h"
#include "cvmuls.h"
#include <cxxtest/TestSuite.h>
class MyTest : public CxxTest::TestSuite
{
public:
void test_do()
{
int D = 1, N = 2;
double a[] = {
0.4854, 0.9157
};
CvMat mat = cvMat( D, N, CV_64FC1, a );
CvMat* dst = cvCreateMat( D, N, CV_32FC1 );
cvMulS( &mat, cvScalar(0.5), dst );
TS_ASSERT_DELTA( cvmGet( dst, 0, 0 ), 0.2427, 0.0001 );
TS_ASSERT_DELTA( cvmGet( dst, 0, 1 ), 0.4578, 0.0001 );
}
};
| 23.028571
| 63
| 0.590571
|
zardchim
|
346ea73300540c234280ad163d17c9655a54a3b0
| 657
|
cpp
|
C++
|
DSA-450/04SearchSort/07repMiss.cpp
|
vikkastiwari/cpp-coding-questions
|
020790e1a3b26c7b24991427004730b3f0785c71
|
[
"MIT"
] | null | null | null |
DSA-450/04SearchSort/07repMiss.cpp
|
vikkastiwari/cpp-coding-questions
|
020790e1a3b26c7b24991427004730b3f0785c71
|
[
"MIT"
] | null | null | null |
DSA-450/04SearchSort/07repMiss.cpp
|
vikkastiwari/cpp-coding-questions
|
020790e1a3b26c7b24991427004730b3f0785c71
|
[
"MIT"
] | null | null | null |
// question link: https://practice.geeksforgeeks.org/problems/find-missing-and-repeating2512/1#
#include <bits/stdc++.h>
using namespace std;
void findTwoElement(int *arr, int n)
{
unordered_map<int, int> twice;
for (int i = 0; i < n; i++)
{
twice[arr[i]]++;
}
sort(arr, arr + n);
int missing = 0, rep = 0;
for (int i = 1; i <= n; i++)
{
if (arr[i] == i)
missing = i;
if (twice[arr[i]] > 1)
rep = i;
}
cout << rep << " " << missing;
}
int main()
{
int arr[] = {4, 3, 6, 2, 1, 1};
int n = sizeof(arr) / sizeof(int);
findTwoElement(arr, n);
return 0;
}
| 21.193548
| 95
| 0.502283
|
vikkastiwari
|
3471d96a365bb3a26e53c9ff6d13960d8babee3a
| 1,301
|
cpp
|
C++
|
detection/src/zed_rot.cpp
|
ammolitor/open_ptrack_v2
|
a4af0c24883e38a298fb65dd03f76d39ad835616
|
[
"BSD-3-Clause"
] | null | null | null |
detection/src/zed_rot.cpp
|
ammolitor/open_ptrack_v2
|
a4af0c24883e38a298fb65dd03f76d39ad835616
|
[
"BSD-3-Clause"
] | null | null | null |
detection/src/zed_rot.cpp
|
ammolitor/open_ptrack_v2
|
a4af0c24883e38a298fb65dd03f76d39ad835616
|
[
"BSD-3-Clause"
] | null | null | null |
// ROS includes:
#include <ros/ros.h>
#include <ros/package.h>
// PCL includes:
#include <pcl/conversions.h>
#include <pcl_ros/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/sample_consensus/sac_model_plane.h>
#include <pcl_conversions/pcl_conversions.h>
#include <pcl/io/pcd_io.h>
// Open PTrack includes:
#include <open_ptrack/detection/ground_segmentation.h>
#include <open_ptrack/detection/ground_based_people_detection_app.h>
#include <open_ptrack/opt_utils/conversions.h>
//Publish Messages
#include <opt_msgs/RoiRect.h>
#include <opt_msgs/Rois.h>
#include <std_msgs/String.h>
#include <sensor_msgs/CameraInfo.h>
#include <opt_msgs/Detection.h>
#include <opt_msgs/DetectionArray.h>
// Dynamic reconfigure:
#include <dynamic_reconfigure/server.h>
#include <detection/GroundBasedPeopleDetectorConfig.h>
using namespace opt_msgs;
using namespace sensor_msgs;
void pc2Callback(const sensor_msgs::PointCloud2ConstPtr& pc2){
ROS_INFO("I heard: [%s]", pc2->header.frame_id);
std::cout << "static constructor\n";
}
int main (int argc, char** argv)
{
ros::init(argc, argv, "zed_rot");
ros::NodeHandle n;
ros::Subscriber sub = n.subscribe("/zed/point_cloud/cloud_registered", 1000, pc2Callback);
ros::spin();
return 0;
}
| 26.02
| 92
| 0.760184
|
ammolitor
|
34735f7805ae19561cb3c0e7f6e785dad57e7c02
| 2,047
|
cpp
|
C++
|
C_-_Knight_Fork.cpp
|
jnvshubham7/CPP_Programming
|
a17c4a42209556495302ca305b7c3026df064041
|
[
"Apache-2.0"
] | 1
|
2021-12-22T12:37:36.000Z
|
2021-12-22T12:37:36.000Z
|
C_-_Knight_Fork.cpp
|
jnvshubham7/CPP_Programming
|
a17c4a42209556495302ca305b7c3026df064041
|
[
"Apache-2.0"
] | null | null | null |
C_-_Knight_Fork.cpp
|
jnvshubham7/CPP_Programming
|
a17c4a42209556495302ca305b7c3026df064041
|
[
"Apache-2.0"
] | null | null | null |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
// The distance between points (2,1) and (x1,y1) is (0−2)2+(0−1)2
// =5
// ;
// the distance between points
// (2,1) and (x2,y2) is (3−2)2+(3−1)2
// =5
// ;
// point
// (2,1) is a lattice point,
ll x1,y1,x2,y2;
cin>>x1>>y1>>x2>>y2;
// find and store in vector The distance between points (2,1) and (x1,y1)
//use distance formula
// find (x1-2)^2 + (y1-1)^2
// find (x2-2)^2 + (y2-1)^2
//both are equal to sqrt(5)
ll ans1=sqrt((x1-2)*(x1-2)+(y1-1)*(y1-1));
ll ans2=sqrt((x2-2)*(x2-2)+(y2-1)*(y2-1));
ll ans3=sqrt((x1-1)*(x1-1)+(y1-2)*(y1-2));
ll ans4=sqrt((x2-1)*(x2-1)+(y2-2)*(y2-2));
ll ans5=sqrt((x1-1)*(x1-1)+(y1+2)*(y1+2));
ll ans6=sqrt((x2-1)*(x2-1)+(y2+2)*(y2+2));
ll ans7=sqrt((x1+1)*(x1+1)+(y1+2)*(y1+2));
ll ans8=sqrt((x2+1)*(x2+1)+(y2+2)*(y2+2));
ll ans9=sqrt((x1+1)*(x1+1)+(y1-2)*(y1-2));
ll ans10=sqrt((x2+1)*(x2+1)+(y2-2)*(y2-2));
ll ans11=sqrt((x1+2)*(x1+2)+(y1-1)*(y1-1));
ll ans12=sqrt((x2+2)*(x2+2)+(y2-1)*(y2-1));
ll ans13=sqrt((x1+2)*(x1+2)+(y1+1)*(y1+1));
ll ans14=sqrt((x2+2)*(x2+2)+(y2+1)*(y2+1));
ll ans15=sqrt((x1-2)*(x1-2)+(y1+1)*(y1+1));
ll ans16=sqrt((x2-2)*(x2-2)+(y2+1)*(y2+1));
//print all the answers
//cout<<fixed<<setprecision(2)<<ans1<<endl;
//ceil of all answer
// if(ciel(ans1)==ceil(ans2)){
// }
if(ans1==ans2)
{
cout<<"YES"<<endl;
}
else if(ans3==ans4)
{
cout<<"YES"<<endl;
}
else if(ans5==ans6)
{
cout<<"YES"<<endl;
}
else if(ans7==ans8)
{
cout<<"YES"<<endl;
}
else if(ans9==ans10)
{
cout<<"YES"<<endl;
}
else if(ans11==ans12)
{
cout<<"YES"<<endl;
}
else if(ans13==ans14)
{
cout<<"YES"<<endl;
}
else if(ans15==ans16)
{
cout<<"YES"<<endl;
}
else
{
cout<<"NO"<<endl;
}
//print ans1 ans2
//cout<<fixed<<setprecision(2)<<ans1<<" "<<ans2<<endl;
//print ans3 ans4
//cout<<fixed<<setprecision(2)<<ans3<<" "<<ans4<<endl;
// if(ans1==ans2 || ans3==ans4)
// {
// cout<<"YES"<<endl;
// }
// else
// {
// cout<<"NO"<<endl;
// }
return 0;
}
| 15.276119
| 75
| 0.536395
|
jnvshubham7
|
34793e94eca2a38cab5c90782fa6d2d436292146
| 3,463
|
cpp
|
C++
|
src/modules/warehouse/VouchersFindDialog.cpp
|
Thorsten-Geppert/Warehouse
|
b064e5b422d0b484ca702cc4433cbda90f40e009
|
[
"BSD-3-Clause"
] | null | null | null |
src/modules/warehouse/VouchersFindDialog.cpp
|
Thorsten-Geppert/Warehouse
|
b064e5b422d0b484ca702cc4433cbda90f40e009
|
[
"BSD-3-Clause"
] | null | null | null |
src/modules/warehouse/VouchersFindDialog.cpp
|
Thorsten-Geppert/Warehouse
|
b064e5b422d0b484ca702cc4433cbda90f40e009
|
[
"BSD-3-Clause"
] | null | null | null |
#include "VouchersFindDialog.h"
#include "../lib/KeyValueDatabaseLibrary.h"
#include "Configuration.h"
#include "resources/images/WarehouseIcon.xpm"
BEGIN_EVENT_TABLE(VouchersFindDialog, wxDialog)
EVT_MENU(FIND_EVENT, VouchersFindDialog::FindKeyEvent)
EVT_MENU(CANCEL_EVENT, VouchersFindDialog::CancelKeyEvent)
END_EVENT_TABLE()
VouchersFindDialog::VouchersFindDialog(
wxWindow *parent,
wxWindowID id,
RuntimeInformationType *rit
) {
SetId(id);
this->rit = rit;
wxXmlResource::Get()->Load(rit->GRP(_N("gui"), _N("VouchersFindDialog.xml")));
wxXmlResource::Get()->LoadDialog(this, parent, _N("VouchersFindDialog"));
mainPanel = XRCCTRL(*this, "mainPanel", wxPanel);
mainBoxSizer = static_cast<wxBoxSizer *>(mainPanel->GetSizer());
findToolbarButton = XRCCTRL(*this, "findToolbarButton", ToolbarButton);
cancelToolbarButton = XRCCTRL(*this, "cancelToolbarButton", ToolbarButton);
voucherIdTextCtrl = XRCCTRL(*this, "voucherIdTextCtrl", DynSoft::DSTextCtrl);
descriptionComboBox = XRCCTRL(*this, "descriptionComboBox", wxComboBox);
invoiceIdTextCtrl = XRCCTRL(*this, "invoiceIdTextCtrl", wxTextCtrl);
companyTextCtrl = XRCCTRL(*this, "companyTextCtrl", wxTextCtrl);
notesTextCtrl = XRCCTRL(*this, "notesTextCtrl", wxTextCtrl);
yearTextCtrl = XRCCTRL(*this, "yearTextCtrl", DynSoft::DSTextCtrl);
yearTextCtrl->SetRegularExpression(DS_TEXTCTRL_REGULAR_EXPRESSION_NUMBER);
voucherIdTextCtrl->SetRegularExpression(DS_TEXTCTRL_REGULAR_EXPRESSION_NUMBER);
mainBoxSizer->SetSizeHints(this);
CONNECT_TOOLBARBUTTON(findToolbarButton, VouchersFindDialog::FindEvent);
CONNECT_TOOLBARBUTTON(cancelToolbarButton, VouchersFindDialog::CancelEvent);
wxAcceleratorEntry acceleratorEntries[3];
acceleratorEntries[0].Set(wxACCEL_NORMAL, WXK_ESCAPE, CANCEL_EVENT);
acceleratorEntries[1].Set(wxACCEL_CTRL, (int) 'w', CANCEL_EVENT);
acceleratorEntries[2].Set(wxACCEL_CTRL, (int) 'f', FIND_EVENT);
wxAcceleratorTable acceleratorTable(3, acceleratorEntries);
SetAcceleratorTable(acceleratorTable);
ICON();
}
int VouchersFindDialog::ShowModal() {
KeyValueDatabaseLibrary keyValueDatabaseLibrary(rit, _N("advanced_preferences"));
if(keyValueDatabaseLibrary.Get(_N("global.year")).ToInt() > 0)
yearTextCtrl->SetValue(keyValueDatabaseLibrary.Get(_N("global.year")).ToString());
else
yearTextCtrl->Clear();
voucherIdTextCtrl->SetFocus();
return wxDialog::ShowModal();
}
void VouchersFindDialog::FindEvent(wxMouseEvent &event) {
Find();
SKIP();
}
void VouchersFindDialog::CancelEvent(wxMouseEvent &event) {
Cancel();
SKIP();
}
void VouchersFindDialog::FindKeyEvent(wxCommandEvent &event) {
Find();
}
void VouchersFindDialog::CancelKeyEvent(wxCommandEvent &event) {
Cancel();
}
void VouchersFindDialog::Find() {
EndModal(wxID_OK);
}
void VouchersFindDialog::Cancel() {
EndModal(wxID_CANCEL);
}
VoucherEntity *VouchersFindDialog::GetVoucherEntity() const {
VoucherEntity *voucherEntity = new VoucherEntity(rit);
voucherEntity->SetValue(_N("voucherId"), voucherIdTextCtrl->GetValue());
voucherEntity->SetValue(_N("description"), descriptionComboBox->GetValue());
voucherEntity->SetValue(_N("invoiceId"), invoiceIdTextCtrl->GetValue());
voucherEntity->SetValue(_N("company"), companyTextCtrl->GetValue());
voucherEntity->SetValue(_N("notes"), notesTextCtrl->GetValue());
voucherEntity->SetSearchYear(DSCasts::ToUnsignedInt(yearTextCtrl->GetValue()));
return voucherEntity;
}
| 34.63
| 84
| 0.77274
|
Thorsten-Geppert
|
347aad507de9bd6a965e36ddf32231fb0aa739bd
| 7,199
|
hpp
|
C++
|
vector_methods.hpp
|
MrTAB/GameDevUtilities
|
aba3543efbfcfee4efeec36fe73382c1bf85e420
|
[
"MIT"
] | null | null | null |
vector_methods.hpp
|
MrTAB/GameDevUtilities
|
aba3543efbfcfee4efeec36fe73382c1bf85e420
|
[
"MIT"
] | null | null | null |
vector_methods.hpp
|
MrTAB/GameDevUtilities
|
aba3543efbfcfee4efeec36fe73382c1bf85e420
|
[
"MIT"
] | null | null | null |
/*
*
* vector_methods.hpp
*
* Utility methods for working on vectors of two floats
*
* These utility methods were created in this format for work with the Box2D
* physics engine, and thus Box2D is a dependency on this unit
*
--------------------------------------------------------------------------------
MIT License
Copyright (c) 2016 Tony Alastair Brown
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef GAME_DEV_UTILITIES_VECTOR_METHODS_HPP
#define GAME_DEV_UTILITIES_VECTOR_METHODS_HPP
#include"floats.hpp"
#include<Box2D/Common/b2Math.h>
#include<cmath>
#include<cassert>
namespace game_dev_utilities
{
namespace vector
{
// Compare two vectors for equality, returning true if they are considered equal
// under this comparison
inline bool compare (const b2Vec2 &a,const b2Vec2 &b)
{
return floats::compare(a.x,b.x) && floats::compare(a.y,b.y);
}
// Set the length of the vector. Vector itself must have non zero length
// Calling set_length on a zero length vector causes undefined behaviour.
inline void set_length (b2Vec2 &vector, const float length)
{
assert(vector.LengthSquared() != 0);
const float multiplier = length / vector.Length();
vector *= multiplier;
}
// Returns the distance between the end points of two vectors
inline float distance(const b2Vec2 &a, const b2Vec2&b)
{
return std::sqrt((a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y));
}
// Returns true if the vector is unit length.
inline bool is_unit_length (const b2Vec2 &vector)
{
return floats::compare(vector.LengthSquared(),1.0f);
}
// Returns true if the vector has zero length.
// Note that this is distinct from being the pure zero vector b2Vec2_zero,
// as exact values of 0.f are unique from very small values close to zero
inline bool is_zero_length (const b2Vec2 &vector)
{
return floats::is_zero(vector.x) && floats::is_zero(vector.y);
}
// Calculates the angle (in radians) of the vector from the positive x-axis
inline float get_angle (const b2Vec2 &vector)
{
return std::atan2(vector.y,vector.x);
}
// Set the vector as having that angle (in radians) and length.
inline void set_angle_length (b2Vec2 &vector, const float radians, const float length)
{
vector.Set(length*std::cos(radians),length*std::sin(radians));
}
// Set the angle of the vector to the given radians, maintaining length
inline void set_angle (b2Vec2 &vector, const float radians)
{
const float length = vector.Length();
vector.Set(length*std::cos(radians),length*std::sin(radians));
}
// ROtate the vector around the origin by the given radians
inline void rotate (b2Vec2 &vector, const float radians)
{
set_angle (vector, get_angle(vector) + radians);
}
// Flip the vector
inline void invert(b2Vec2 &vector)
{
vector.Set(-vector.x,-vector.y);
}
// efficiently turns vector pi/2 radians in the direction of the y axis to x axis
inline void turn_yx (b2Vec2 &vector)
{
vector.Set(vector.y,-vector.x);
}
// efficiently turns vector pi/2 radians in the direction of the x axis to y axis
inline void turn_xy (b2Vec2 &vector)
{
vector.Set(-vector.y,vector.x);
}
// Flip the vector about the x axis
inline void flip_about_x (b2Vec2 &vector)
{
vector.y = -vector.y;
}
// Flip the vector about the y axis
inline void flip_about_y (b2Vec2 &vector)
{
vector.x = -vector.x;
}
// Returns true if the length of a is greater than the length of b
// Due to the use of LenghtSquared() for efficiency, the granularity of the
// comparison is stretched meaning that there may exist a case where
// individual calculation of length above 1.0f could result in two values for
// whom the lengths return equal under compare(), and vice versa for values less
// than 1.0f. For the practical purposes for which this method has been devised,
// this is not a concern.
inline bool greater_than(const b2Vec2 &a, const b2Vec2 &b)
{
return a.LengthSquared() > b .LengthSquared() && !compare(a,b);
}
// Returns true if the length of a is less than the length of b.
// See notes on granularity above.
inline bool less_than(const b2Vec2 &a, const b2Vec2 &b)
{
return a.LengthSquared() < b .LengthSquared() && !compare(a,b);
}
// Returns true if the length of a is greater than the length of b, or if they
// have equal length.
// See notes on granularity above.
inline bool greater_than_or_equal(const b2Vec2 &a, const b2Vec2 &b)
{
return a.LengthSquared() >= b .LengthSquared() || !compare(a,b);
}
// Returns true if the length of a is less than the length of b, or if they have
// equal lengths
// See notes on granularity above.
inline bool less_than_or_equal(const b2Vec2 &a, const b2Vec2 &b)
{
return a.LengthSquared() <= b .LengthSquared() || !compare(a,b);
}
// Returns the larger lengthed of two vectors, defaulting to a if they are equal
inline b2Vec2 & largest (b2Vec2 &a, b2Vec2 &b)
{
if (greater_than_or_equal (a,b))
{
return a;
}
else
{
return b;
}
}
// Returns the smaller lengthed of two vectors, defaulting to a if they are equal
inline b2Vec2 & smallest (b2Vec2 &a, b2Vec2 &b)
{
if (less_than_or_equal (a,b))
{
return a;
}
else
{
return b;
}
}
// Linearly interpolates between vector a and b to the given ratio, and stores
// this in a
inline void interpolated (b2Vec2 &a, const b2Vec2 &b, const float ratio)
{
const float inverse = 1.0/ratio;
a.Set (ratio*b.x+inverse*a.x, ratio*b.y+inverse*a.y);
}
// Linearly interpolates between vector a and b to the given ratio, and returns
// this in c
inline b2Vec2 interpolate (b2Vec2 a, const b2Vec2 b, const float ratio)
{
const float inverse = 1.0/ratio;
b2Vec2 c;
c.Set (ratio*b.x+inverse*a.x, ratio*b.y+inverse*a.y);
return c;
}
// Returns true if the given vectors are perpendicular to each other
inline bool perpendicular_to (const b2Vec2 &a, const b2Vec2 &b)
{
return floats::is_zero(b2Dot(a,b));
}
} // namespace vector
} //
#endif //
| 30.504237
| 87
| 0.690374
|
MrTAB
|
347cd862a4aec18fe769d2334020bd7bd09862b3
| 572
|
cpp
|
C++
|
solved/o-q/professor-lazy-phd/professor.cpp
|
abuasifkhan/pc-code
|
77ce51d692acf6edcb9e47aeb7b7f06bf56e4e90
|
[
"Unlicense"
] | 13
|
2015-09-30T19:18:04.000Z
|
2021-06-26T21:11:30.000Z
|
solved/o-q/professor-lazy-phd/professor.cpp
|
sbmaruf/pc-code
|
77ce51d692acf6edcb9e47aeb7b7f06bf56e4e90
|
[
"Unlicense"
] | null | null | null |
solved/o-q/professor-lazy-phd/professor.cpp
|
sbmaruf/pc-code
|
77ce51d692acf6edcb9e47aeb7b7f06bf56e4e90
|
[
"Unlicense"
] | 13
|
2015-01-04T09:49:54.000Z
|
2021-06-03T13:18:44.000Z
|
#include <cstdio>
typedef long long i64;
int a, b;
i64 n;
int main()
{
while (true) {
scanf("%d%d%lld", &a, &b, &n);
if (a == 0) break;
int ans = 0;
switch (n % 5) {
case 0:
ans = a;
break;
case 1:
ans = b;
break;
case 2:
ans = (1+b)/a;
break;
case 3:
ans = (1+a+b)/(a*b);
break;
case 4:
ans = (1+a)/b;
break;
}
printf("%d\n", ans);
}
return 0;
}
| 15.459459
| 38
| 0.33042
|
abuasifkhan
|
34844efbf2f5c482087ba346375852e7fb460a61
| 120
|
cpp
|
C++
|
MoreRadioWheels/NativeWheel.cpp
|
LfxB/MoreNativeWheels-GTAV
|
9e8a4f67729054ba7b5e5fe61584a90c94f873ef
|
[
"MIT"
] | 2
|
2020-08-31T00:23:45.000Z
|
2022-01-16T10:32:10.000Z
|
MoreRadioWheels/NativeWheel.cpp
|
LfxB/MoreNativeWheels-GTAV
|
9e8a4f67729054ba7b5e5fe61584a90c94f873ef
|
[
"MIT"
] | null | null | null |
MoreRadioWheels/NativeWheel.cpp
|
LfxB/MoreNativeWheels-GTAV
|
9e8a4f67729054ba7b5e5fe61584a90c94f873ef
|
[
"MIT"
] | null | null | null |
#include "NativeWheel.hpp"
NativeWheel::NativeWheel(string name)
{
Name = name;
}
NativeWheel::~NativeWheel()
{
}
| 8.571429
| 37
| 0.691667
|
LfxB
|
34855cb2edcdb0e6854c5a396acabbcbd8667d40
| 907
|
hpp
|
C++
|
include/Exception.hpp
|
niniemann/sempr
|
2f3b04c031d70b9675ad441f97728a8fb839abed
|
[
"BSD-3-Clause"
] | 8
|
2018-03-28T19:45:47.000Z
|
2022-03-23T16:53:24.000Z
|
include/Exception.hpp
|
niniemann/sempr
|
2f3b04c031d70b9675ad441f97728a8fb839abed
|
[
"BSD-3-Clause"
] | 58
|
2018-01-31T11:10:04.000Z
|
2021-08-13T11:48:31.000Z
|
include/Exception.hpp
|
niniemann/sempr
|
2f3b04c031d70b9675ad441f97728a8fb839abed
|
[
"BSD-3-Clause"
] | 1
|
2018-07-04T12:30:06.000Z
|
2018-07-04T12:30:06.000Z
|
#ifndef SEMPR_CORE_EXCEPTION_HPP_
#define SEMPR_CORE_EXCEPTION_HPP_
#include <exception>
#include <string>
/// namespace only sempr. TODO: refactor the rest of the code? simplify it, use namespaces to group themes together, not code-similarities?
namespace sempr {
/**
A basic sempr-exception. Why our own? Because std::exception does not take a string to describe
what happened, and std::runtime_error is more like an error you cannot recover from, at all.
So this is just a class for exceptions thrown by sempr, with a string description.
TODO: make it a base of Geometry::TransformException
*/
class Exception : public std::exception {
std::string message_;
public:
explicit Exception(const std::string& m) : message_(m) {}
virtual const char* what() const throw() {
return message_.c_str();
}
};
}
#endif /* end of include guard SEMPR_CORE_EXCEPTION_HPP_ */
| 32.392857
| 139
| 0.732084
|
niniemann
|
348665551d12834aaadea5e31eeba8501719cea8
| 3,178
|
cpp
|
C++
|
owEngine/SceneManager.cpp
|
adan830/OpenWow
|
9b6e9c248bd185b1677fe616d2a3a81a35ca8894
|
[
"Apache-2.0"
] | null | null | null |
owEngine/SceneManager.cpp
|
adan830/OpenWow
|
9b6e9c248bd185b1677fe616d2a3a81a35ca8894
|
[
"Apache-2.0"
] | null | null | null |
owEngine/SceneManager.cpp
|
adan830/OpenWow
|
9b6e9c248bd185b1677fe616d2a3a81a35ca8894
|
[
"Apache-2.0"
] | 1
|
2020-05-11T13:32:49.000Z
|
2020-05-11T13:32:49.000Z
|
#include "stdafx.h"
// General
#include "SceneManager.h"
CSceneManager::CSceneManager(SceneNode* _rootNode) :
m_RootNode(_rootNode),
m_IntersectedNode(nullptr),
m_MainCamera(nullptr),
m_FrustrumCamera(nullptr),
m_RenderQueueDebug(false),
m_Engine(GetManager<IEngine>()),
m_Video(GetSettingsGroup<CGroupVideo>())
{
AddManager<ISceneManager>(this);
_Bindings->RegisterRenderable3DObject(this, 15);
}
CSceneManager::~CSceneManager()
{
DelManager<ISceneManager>();
_Bindings->UnregisterRenderable3DObject(this);
}
void CSceneManager::RenderRecursy(SceneNode* _node)
{
if (_node == nullptr)
{
return;
}
// CurrentNode
bool isNodeVisible = _node->PreRender3D();
_node->setVisible(isNodeVisible);
if (!isNodeVisible)
{
return;
}
m_RenderQueue.push_back(_node);
//Intersection(_node);
// Some checks
if (_node->getChilds().empty())
{
return;
}
std::sort(_node->getChilds().begin(), _node->getChilds().end(), Renderable3DObjectCompare());
// Childs
for (auto& it : _node->getChilds())
{
RenderRecursy(it);
}
}
void CSceneManager::Intersection(SceneNode * _node)
{
if (!(_node->isSelectable()))
{
return;
}
vec3 dir = screenToWord
(
_Render->getAdapter()->GetInput()->GetMouse(),
m_Video.GetWindowSize(),
_Render->getCamera()->getProjMat(),
_Render->getCamera()->getViewMat()
);
bool result = rayAABBIntersection(getCamera()->Position, dir * 100000.0f, _node->getBounds().getMin(), _node->getBounds().getMax());
if (result)
{
// First node
if (m_IntersectedNode == nullptr)
{
m_IntersectedNode = _node;
}
if (m_IntersectedNode == _node->getParent())
{
m_IntersectedNode = _node;
}
else if (m_IntersectedNode->getDrawOrder() == _node->getDrawOrder())
{
float distToOld = glm::length(getCamera()->Position - m_IntersectedNode->getBounds().getCenter()) - m_IntersectedNode->getBounds().getRadius();
float distToNew = glm::length(getCamera()->Position - _node->getBounds().getCenter()) - _node->getBounds().getRadius();
//float old = nearestDistToAABB(getCamera()->Position, m_IntersectedNode->getBounds().Min, m_IntersectedNode->getBounds().Max);
//float neww = nearestDistToAABB(getCamera()->Position, _node->getBounds().Min, _node->getBounds().Max);
if (m_IntersectedNode->getBounds().isPointInside(_node->getBounds().getCenter()))
{
m_IntersectedNode = _node;
}
else if (distToOld > distToNew)
{
m_IntersectedNode = _node;
}
}
else if (m_IntersectedNode->getDrawOrder() < _node->getDrawOrder())
{
m_IntersectedNode = _node;
}
}
}
bool CSceneManager::PreRender3D()
{
return true;
}
void CSceneManager::Render3D()
{
m_RenderQueue.clear();
if (m_RootNode != nullptr)
{
m_IntersectedNode = nullptr;
RenderRecursy(m_RootNode);
}
if (m_RenderQueue.empty())
{
return;
}
if (!m_RenderQueueDebug)
{
std::sort(m_RenderQueue.begin(), m_RenderQueue.end(), SceneNodeCompare(getCamera()));
}
for (auto& it : m_RenderQueue)
{
if (m_RenderQueueDebug)
{
//_Render->DrawBoundingBox(it->getBounds(), it->getDebugColor());
it->RenderDebug3D();
continue;
}
it->Render3D();
}
}
void CSceneManager::PostRender3D()
{
}
| 21.186667
| 146
| 0.695721
|
adan830
|
3486d65f9c86aaa01c1bb8245a5e35311989f601
| 438
|
cpp
|
C++
|
src/ui/puiframe.cpp
|
pandepic/PandaSDL
|
5e57859ea4b3870926428439b1e4c4b90e6d4cd9
|
[
"MIT"
] | 3
|
2020-09-02T00:13:23.000Z
|
2021-08-14T23:13:11.000Z
|
src/ui/puiframe.cpp
|
pandepic/PandaSDL
|
5e57859ea4b3870926428439b1e4c4b90e6d4cd9
|
[
"MIT"
] | null | null | null |
src/ui/puiframe.cpp
|
pandepic/PandaSDL
|
5e57859ea4b3870926428439b1e4c4b90e6d4cd9
|
[
"MIT"
] | 1
|
2021-06-17T05:46:19.000Z
|
2021-06-17T05:46:19.000Z
|
#include "puiframe.h"
PandaSDL::PUIFrame::PUIFrame(PUIMenu *parent, pugi::xml_node &node, const PUIWidgetBuilder &widgetBuilder)
{
Parent = parent;
auto widgetsRoot = node.child("Widgets");
_widgetContainer.Load(widgetsRoot, widgetBuilder);
}
PandaSDL::PUIFrame::~PUIFrame()
{
}
std::shared_ptr<PandaSDL::PUIWidget> PandaSDL::PUIFrame::GetWidget(std::string name)
{
return _widgetContainer.GetWidget(name);
}
| 21.9
| 106
| 0.723744
|
pandepic
|
348fc6232951f4e215e25e897501375d16f2b6ed
| 948
|
hpp
|
C++
|
headers/sourceapp.hpp
|
CNLouisLiu/cso2-launcher
|
11e054318d08a19ae923130541271cd898ac047b
|
[
"MIT"
] | 1
|
2019-12-01T20:21:36.000Z
|
2019-12-01T20:21:36.000Z
|
headers/sourceapp.hpp
|
CNLouisLiu/cso2-launcher
|
11e054318d08a19ae923130541271cd898ac047b
|
[
"MIT"
] | null | null | null |
headers/sourceapp.hpp
|
CNLouisLiu/cso2-launcher
|
11e054318d08a19ae923130541271cd898ac047b
|
[
"MIT"
] | null | null | null |
#pragma once
#include <string>
#include "appframework/AppFramework.h"
#include "tier0/ICommandLine.h"
class CAppSystemGroup;
class IFileSystem;
//-----------------------------------------------------------------------------
// Inner loop: initialize, shutdown main systems, load steam to
//-----------------------------------------------------------------------------
class CSourceAppSystemGroup : public CSteamAppSystemGroup
{
public:
CSourceAppSystemGroup( std::string szBaseDir, IFileSystem* pFs = nullptr,
CAppSystemGroup* pParent = nullptr );
// Methods of IApplication
bool Create() override;
bool PreInit() override;
int Main() override;
void PostShutdown() override;
void Destroy() override;
private:
const char* DetermineDefaultMod() const;
const char* DetermineDefaultGame() const;
const std::string m_szBaseDir;
bool m_bEditMode;
};
extern bool g_bTextMode;
| 26.333333
| 79
| 0.593882
|
CNLouisLiu
|
349c6068739ac9c08f301dceb935fd15470feaab
| 6,975
|
cpp
|
C++
|
src/apps/backend/face/face_recognizer_service.cpp
|
raymanfx/seraphim
|
4d388d21831d349fe1085bc3cb7c73f5d2b103a7
|
[
"MIT"
] | null | null | null |
src/apps/backend/face/face_recognizer_service.cpp
|
raymanfx/seraphim
|
4d388d21831d349fe1085bc3cb7c73f5d2b103a7
|
[
"MIT"
] | null | null | null |
src/apps/backend/face/face_recognizer_service.cpp
|
raymanfx/seraphim
|
4d388d21831d349fe1085bc3cb7c73f5d2b103a7
|
[
"MIT"
] | null | null | null |
/*
* (C) Copyright 2019
* The Seraphim Project Developers.
*
* SPDX-License-Identifier: MIT
*/
#include <seraphim/face/utils.h>
#include <seraphim/iop/opencv/mat.h>
#include <utils.h>
#include "face_recognizer_service.h"
using namespace sph;
using namespace sph::face;
FaceRecognizerService::FaceRecognizerService(
std::shared_ptr<sph::face::FaceDetector> face_detector,
std::shared_ptr<sph::face::FacemarkDetector> facemark_detector,
std::shared_ptr<sph::face::FaceRecognizer> face_recognizer) {
m_face_detector = face_detector;
m_face_recognizer = face_recognizer;
m_facemark_detector = facemark_detector;
}
FaceRecognizerService::~FaceRecognizerService() {
// dummy
}
bool FaceRecognizerService::handle_request(const Seraphim::Request &req, Seraphim::Response &res) {
if (req.inner().Is<Seraphim::Face::FaceRecognizer::TrainingRequest>()) {
Seraphim::Face::FaceRecognizer::TrainingRequest inner_req;
Seraphim::Face::FaceRecognizer::TrainingResponse inner_res;
req.inner().UnpackTo(&inner_req);
if (handle_training_request(inner_req, inner_res)) {
res.mutable_inner()->PackFrom(inner_res);
return true;
}
} else if (req.inner().Is<Seraphim::Face::FaceRecognizer::PredictionRequest>()) {
Seraphim::Face::FaceRecognizer::PredictionRequest inner_req;
Seraphim::Face::FaceRecognizer::PredictionResponse inner_res;
req.inner().UnpackTo(&inner_req);
if (handle_recognition_request(inner_req, inner_res)) {
res.mutable_inner()->PackFrom(inner_res);
return true;
}
}
return false;
}
bool FaceRecognizerService::handle_training_request(
const Seraphim::Face::FaceRecognizer::TrainingRequest &req,
Seraphim::Face::FaceRecognizer::TrainingResponse &res) {
CoreImage image;
std::vector<CoreImage> images;
std::vector<Polygon<int>> faces;
cv::Mat mat;
std::vector<int> labels;
if (!sph::backend::Image2DtoMat(req.image(), mat)) {
return false;
}
image = sph::iop::cv::to_image(mat);
if (image.empty()) {
return false;
}
labels.push_back(req.label());
// align the image at the eyes before training
cv::Mat alignedFace;
cv::RotatedRect alignedROI;
mat.copyTo(alignedFace);
// compute centers of the eyes
std::vector<FacemarkDetector::Facemarks> facemarks;
std::vector<cv::Point2f> eyes;
m_face_detector->detect(image, faces);
if (faces.size() != 1) {
res.set_label(-1);
} else {
Seraphim::Types::Region2D *face = res.mutable_face();
face->set_x(faces.at(0).brect().tl().x);
face->set_y(faces.at(0).brect().tl().y);
face->set_w(faces.at(0).width());
face->set_h(faces.at(0).height());
// search in the region of the previously detected face
m_facemark_detector->detect(image, faces, facemarks);
if (faces.size() == 0 || facemarks.size() == 0) {
return false;
}
// collect the eye point positions from the face
for (const auto &landmark_set : facemarks[0].landmarks) {
if (landmark_set.first == FacemarkDetector::FacemarkType::LEFT_EYE ||
landmark_set.first == FacemarkDetector::FacemarkType::RIGHT_EYE) {
cv::Point2f p;
for (const auto &point : landmark_set.second) {
p.x += point.x;
p.y += point.y;
}
p.x /= landmark_set.second.size();
p.y /= landmark_set.second.size();
eyes.push_back(p);
break;
}
}
if (eyes.size() == 0) {
std::cout << "Could not detect eyes, aborting training" << std::endl;
return false;
}
double angle = sph::face::align_face(alignedFace, eyes);
std::cout << "rot angle: " << angle << std::endl;
// rotate the face ROI by the same angle
alignedROI = cv::RotatedRect((cv::Point(faces[0].brect().br().x, faces[0].brect().br().y) +
cv::Point(faces[0].brect().tl().x, faces[0].brect().tl().y)) *
0.5,
cv::Size(faces[0].width(), faces[0].height()),
static_cast<float>(angle));
if (alignedROI.boundingRect().width > alignedFace.size().width ||
alignedROI.boundingRect().height > alignedFace.size().height) {
// the input image is too small to do proper cropping
return false;
}
// perform final cropping of the image using the minimal upright
// bounding rect
alignedFace = alignedFace(alignedROI.boundingRect());
CoreImage buf = sph::iop::cv::to_image(alignedFace);
if (image.empty()) {
return false;
}
images.push_back(buf);
m_face_recognizer->update(images, labels, req.invalidate());
res.set_label(req.label());
}
return true;
}
bool FaceRecognizerService::handle_recognition_request(
const Seraphim::Face::FaceRecognizer::PredictionRequest &req,
Seraphim::Face::FaceRecognizer::PredictionResponse &res) {
CoreImage image;
std::vector<Polygon<int>> faces;
cv::Mat mat;
cv::Rect2i roi;
std::vector<sph::face::FaceRecognizer::Prediction> preds;
if (!sph::backend::Image2DtoMat(req.image(), mat)) {
return false;
}
roi = cv::Rect2i(0, 0, mat.cols, mat.rows);
if (req.has_roi()) {
roi.x = req.roi().x();
roi.y = req.roi().y();
roi.width = req.roi().w();
roi.height = req.roi().h();
}
mat = mat(roi);
image = sph::iop::cv::to_image(mat);
if (image.empty()) {
return false;
}
m_face_detector->detect(image, faces);
for (size_t i = 0; i < faces.size(); i++) {
cv::Rect face_region(faces[i].brect().tl().x, faces[i].brect().tl().y, faces[i].width(),
faces[i].height());
image = sph::iop::cv::to_image(mat(face_region));
if (image.empty()) {
return false;
}
m_face_recognizer->predict(image, preds);
Seraphim::Types::Region2D *roi = res.add_rois();
for (size_t j = 0; j < preds.size(); j++) {
// filter results if a global threshold is set
if (req.confidence() > 0.0 && preds.at(j).confidence < req.confidence()) {
res.mutable_rois()->RemoveLast();
continue;
}
res.add_labels(preds.at(j).label);
res.add_distances(preds.at(j).confidence);
roi->set_x(faces.at(0).brect().tl().x);
roi->set_y(faces.at(0).brect().tl().y);
roi->set_w(faces.at(0).width());
roi->set_h(faces.at(0).height());
}
}
return true;
}
| 33.056872
| 100
| 0.581935
|
raymanfx
|
349ccc0d150e5cf3e08115f2234e34d0fef203dc
| 19,490
|
hpp
|
C++
|
include/vulkan/internal/struct/VkPerformance.hpp
|
skyline-emu/vkhpp
|
a4b8f74942a932ea191dc95cc4a210fea524508f
|
[
"Apache-2.0"
] | 2
|
2020-04-22T21:14:24.000Z
|
2021-11-03T18:21:12.000Z
|
include/vulkan/internal/struct/VkPerformance.hpp
|
skyline-emu/vkhpp
|
a4b8f74942a932ea191dc95cc4a210fea524508f
|
[
"Apache-2.0"
] | null | null | null |
include/vulkan/internal/struct/VkPerformance.hpp
|
skyline-emu/vkhpp
|
a4b8f74942a932ea191dc95cc4a210fea524508f
|
[
"Apache-2.0"
] | null | null | null |
// Copyright (c) 2015-2019 The Khronos Group Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// ---- Exceptions to the Apache 2.0 License: ----
//
// As an exception, if you use this Software to generate code and portions of
// this Software are embedded into the generated code as a result, you may
// redistribute such product without providing attribution as would otherwise
// be required by Sections 4(a), 4(b) and 4(d) of the License.
//
// In addition, if you combine or link code generated by this Software with
// software that is licensed under the GPLv2 or the LGPL v2.0 or 2.1
// ("`Combined Software`") and if a court of competent jurisdiction determines
// that the patent provision (Section 3), the indemnity provision (Section 9)
// or other Section of the License conflicts with the conditions of the
// applicable GPL or LGPL license, you may retroactively and prospectively
// choose to deem waived or otherwise exclude such Section(s) of the License,
// but only in their entirety and only with respect to the Combined Software.
//
// This header is generated from the Khronos Vulkan XML API Registry.
#pragma once
#include "../handles.hpp"
#include "VkAcquire.hpp"
#include "VkAcceleration.hpp"
#include "VkApplication.hpp"
#include "VkInitialize.hpp"
#include "VkAllocation.hpp"
#include "VkExternal.hpp"
#include "VkBind.hpp"
#include "VkObject.hpp"
#include "VkCooperative.hpp"
#include "VkAndroid.hpp"
#include "VkImport.hpp"
#include "VkImage.hpp"
#include "VkDescriptor.hpp"
#include "VkBase.hpp"
#include "VkAttachment.hpp"
#include "VkBuffer.hpp"
#include "VkFramebuffer.hpp"
#include "VkCalibrated.hpp"
#include "VkDevice.hpp"
#include "VkCheckpoint.hpp"
#include "VkConformance.hpp"
#include "VkClear.hpp"
#include "VkCmd.hpp"
#include "VkExtension.hpp"
#include "VkCoarse.hpp"
#include "VkCommand.hpp"
#include "VkMetal.hpp"
#include "VkFormat.hpp"
#include "VkComponent.hpp"
#include "VkCopy.hpp"
#include "VkCompute.hpp"
#include "VkPast.hpp"
#include "VkConditional.hpp"
#include "VkMapped.hpp"
#include "VkD3D.hpp"
#include "VkDebug.hpp"
#include "VkFence.hpp"
#include "VkDedicated.hpp"
#include "VkDraw.hpp"
#include "VkDispatch.hpp"
#include "VkDisplay.hpp"
#include "VkDrm.hpp"
#include "VkEvent.hpp"
#include "VkExport.hpp"
#include "VkExtent.hpp"
#include "VkFilter.hpp"
#include "VkGeometry.hpp"
#include "VkGraphics.hpp"
#include "VkHdr.hpp"
#include "VkHeadless.hpp"
#include "VkMultisample.hpp"
#include "VkI.hpp"
#include "VkIndirect.hpp"
#include "VkInput.hpp"
#include "VkOffset.hpp"
#include "VkMemory.hpp"
#include "VkInstance.hpp"
#include "VkLayer.hpp"
#include "VkMac.hpp"
#include "VkPerformance.hpp"
namespace VULKAN_HPP_NAMESPACE
{
struct PerformanceConfigurationAcquireInfoINTEL
{
VULKAN_HPP_CONSTEXPR PerformanceConfigurationAcquireInfoINTEL( VULKAN_HPP_NAMESPACE::PerformanceConfigurationTypeINTEL type_ = VULKAN_HPP_NAMESPACE::PerformanceConfigurationTypeINTEL::eCommandQueueMetricsDiscoveryActivated ) VULKAN_HPP_NOEXCEPT
: type( type_ )
{}
VULKAN_HPP_CONSTEXPR PerformanceConfigurationAcquireInfoINTEL( PerformanceConfigurationAcquireInfoINTEL const& rhs ) VULKAN_HPP_NOEXCEPT
: pNext( rhs.pNext )
, type( rhs.type )
{}
PerformanceConfigurationAcquireInfoINTEL & operator=( PerformanceConfigurationAcquireInfoINTEL const & rhs ) VULKAN_HPP_NOEXCEPT
{
memcpy( &pNext, &rhs.pNext, sizeof( PerformanceConfigurationAcquireInfoINTEL ) - offsetof( PerformanceConfigurationAcquireInfoINTEL, pNext ) );
return *this;
}
PerformanceConfigurationAcquireInfoINTEL( VkPerformanceConfigurationAcquireInfoINTEL const & rhs ) VULKAN_HPP_NOEXCEPT
{
*this = rhs;
}
PerformanceConfigurationAcquireInfoINTEL& operator=( VkPerformanceConfigurationAcquireInfoINTEL const & rhs ) VULKAN_HPP_NOEXCEPT
{
*this = *reinterpret_cast<VULKAN_HPP_NAMESPACE::PerformanceConfigurationAcquireInfoINTEL const *>(&rhs);
return *this;
}
PerformanceConfigurationAcquireInfoINTEL & setPNext( const void* pNext_ ) VULKAN_HPP_NOEXCEPT
{
pNext = pNext_;
return *this;
}
PerformanceConfigurationAcquireInfoINTEL & setType( VULKAN_HPP_NAMESPACE::PerformanceConfigurationTypeINTEL type_ ) VULKAN_HPP_NOEXCEPT
{
type = type_;
return *this;
}
operator VkPerformanceConfigurationAcquireInfoINTEL const&() const VULKAN_HPP_NOEXCEPT
{
return *reinterpret_cast<const VkPerformanceConfigurationAcquireInfoINTEL*>( this );
}
operator VkPerformanceConfigurationAcquireInfoINTEL &() VULKAN_HPP_NOEXCEPT
{
return *reinterpret_cast<VkPerformanceConfigurationAcquireInfoINTEL*>( this );
}
#if defined(VULKAN_HPP_HAS_SPACESHIP_OPERATOR)
auto operator<=>( PerformanceConfigurationAcquireInfoINTEL const& ) const = default;
#else
bool operator==( PerformanceConfigurationAcquireInfoINTEL const& rhs ) const VULKAN_HPP_NOEXCEPT
{
return ( sType == rhs.sType )
&& ( pNext == rhs.pNext )
&& ( type == rhs.type );
}
bool operator!=( PerformanceConfigurationAcquireInfoINTEL const& rhs ) const VULKAN_HPP_NOEXCEPT
{
return !operator==( rhs );
}
#endif
public:
const VULKAN_HPP_NAMESPACE::StructureType sType = StructureType::ePerformanceConfigurationAcquireInfoINTEL;
const void* pNext = {};
VULKAN_HPP_NAMESPACE::PerformanceConfigurationTypeINTEL type = VULKAN_HPP_NAMESPACE::PerformanceConfigurationTypeINTEL::eCommandQueueMetricsDiscoveryActivated;
};
static_assert( sizeof( PerformanceConfigurationAcquireInfoINTEL ) == sizeof( VkPerformanceConfigurationAcquireInfoINTEL ), "struct and wrapper have different size!" );
static_assert( std::is_standard_layout<PerformanceConfigurationAcquireInfoINTEL>::value, "struct wrapper is not a standard layout!" );
struct PerformanceMarkerInfoINTEL
{
VULKAN_HPP_CONSTEXPR PerformanceMarkerInfoINTEL( uint64_t marker_ = {} ) VULKAN_HPP_NOEXCEPT
: marker( marker_ )
{}
VULKAN_HPP_CONSTEXPR PerformanceMarkerInfoINTEL( PerformanceMarkerInfoINTEL const& rhs ) VULKAN_HPP_NOEXCEPT
: pNext( rhs.pNext )
, marker( rhs.marker )
{}
PerformanceMarkerInfoINTEL & operator=( PerformanceMarkerInfoINTEL const & rhs ) VULKAN_HPP_NOEXCEPT
{
memcpy( &pNext, &rhs.pNext, sizeof( PerformanceMarkerInfoINTEL ) - offsetof( PerformanceMarkerInfoINTEL, pNext ) );
return *this;
}
PerformanceMarkerInfoINTEL( VkPerformanceMarkerInfoINTEL const & rhs ) VULKAN_HPP_NOEXCEPT
{
*this = rhs;
}
PerformanceMarkerInfoINTEL& operator=( VkPerformanceMarkerInfoINTEL const & rhs ) VULKAN_HPP_NOEXCEPT
{
*this = *reinterpret_cast<VULKAN_HPP_NAMESPACE::PerformanceMarkerInfoINTEL const *>(&rhs);
return *this;
}
PerformanceMarkerInfoINTEL & setPNext( const void* pNext_ ) VULKAN_HPP_NOEXCEPT
{
pNext = pNext_;
return *this;
}
PerformanceMarkerInfoINTEL & setMarker( uint64_t marker_ ) VULKAN_HPP_NOEXCEPT
{
marker = marker_;
return *this;
}
operator VkPerformanceMarkerInfoINTEL const&() const VULKAN_HPP_NOEXCEPT
{
return *reinterpret_cast<const VkPerformanceMarkerInfoINTEL*>( this );
}
operator VkPerformanceMarkerInfoINTEL &() VULKAN_HPP_NOEXCEPT
{
return *reinterpret_cast<VkPerformanceMarkerInfoINTEL*>( this );
}
#if defined(VULKAN_HPP_HAS_SPACESHIP_OPERATOR)
auto operator<=>( PerformanceMarkerInfoINTEL const& ) const = default;
#else
bool operator==( PerformanceMarkerInfoINTEL const& rhs ) const VULKAN_HPP_NOEXCEPT
{
return ( sType == rhs.sType )
&& ( pNext == rhs.pNext )
&& ( marker == rhs.marker );
}
bool operator!=( PerformanceMarkerInfoINTEL const& rhs ) const VULKAN_HPP_NOEXCEPT
{
return !operator==( rhs );
}
#endif
public:
const VULKAN_HPP_NAMESPACE::StructureType sType = StructureType::ePerformanceMarkerInfoINTEL;
const void* pNext = {};
uint64_t marker = {};
};
static_assert( sizeof( PerformanceMarkerInfoINTEL ) == sizeof( VkPerformanceMarkerInfoINTEL ), "struct and wrapper have different size!" );
static_assert( std::is_standard_layout<PerformanceMarkerInfoINTEL>::value, "struct wrapper is not a standard layout!" );
struct PerformanceOverrideInfoINTEL
{
VULKAN_HPP_CONSTEXPR PerformanceOverrideInfoINTEL( VULKAN_HPP_NAMESPACE::PerformanceOverrideTypeINTEL type_ = VULKAN_HPP_NAMESPACE::PerformanceOverrideTypeINTEL::eNullHardware,
VULKAN_HPP_NAMESPACE::Bool32 enable_ = {},
uint64_t parameter_ = {} ) VULKAN_HPP_NOEXCEPT
: type( type_ )
, enable( enable_ )
, parameter( parameter_ )
{}
VULKAN_HPP_CONSTEXPR PerformanceOverrideInfoINTEL( PerformanceOverrideInfoINTEL const& rhs ) VULKAN_HPP_NOEXCEPT
: pNext( rhs.pNext )
, type( rhs.type )
, enable( rhs.enable )
, parameter( rhs.parameter )
{}
PerformanceOverrideInfoINTEL & operator=( PerformanceOverrideInfoINTEL const & rhs ) VULKAN_HPP_NOEXCEPT
{
memcpy( &pNext, &rhs.pNext, sizeof( PerformanceOverrideInfoINTEL ) - offsetof( PerformanceOverrideInfoINTEL, pNext ) );
return *this;
}
PerformanceOverrideInfoINTEL( VkPerformanceOverrideInfoINTEL const & rhs ) VULKAN_HPP_NOEXCEPT
{
*this = rhs;
}
PerformanceOverrideInfoINTEL& operator=( VkPerformanceOverrideInfoINTEL const & rhs ) VULKAN_HPP_NOEXCEPT
{
*this = *reinterpret_cast<VULKAN_HPP_NAMESPACE::PerformanceOverrideInfoINTEL const *>(&rhs);
return *this;
}
PerformanceOverrideInfoINTEL & setPNext( const void* pNext_ ) VULKAN_HPP_NOEXCEPT
{
pNext = pNext_;
return *this;
}
PerformanceOverrideInfoINTEL & setType( VULKAN_HPP_NAMESPACE::PerformanceOverrideTypeINTEL type_ ) VULKAN_HPP_NOEXCEPT
{
type = type_;
return *this;
}
PerformanceOverrideInfoINTEL & setEnable( VULKAN_HPP_NAMESPACE::Bool32 enable_ ) VULKAN_HPP_NOEXCEPT
{
enable = enable_;
return *this;
}
PerformanceOverrideInfoINTEL & setParameter( uint64_t parameter_ ) VULKAN_HPP_NOEXCEPT
{
parameter = parameter_;
return *this;
}
operator VkPerformanceOverrideInfoINTEL const&() const VULKAN_HPP_NOEXCEPT
{
return *reinterpret_cast<const VkPerformanceOverrideInfoINTEL*>( this );
}
operator VkPerformanceOverrideInfoINTEL &() VULKAN_HPP_NOEXCEPT
{
return *reinterpret_cast<VkPerformanceOverrideInfoINTEL*>( this );
}
#if defined(VULKAN_HPP_HAS_SPACESHIP_OPERATOR)
auto operator<=>( PerformanceOverrideInfoINTEL const& ) const = default;
#else
bool operator==( PerformanceOverrideInfoINTEL const& rhs ) const VULKAN_HPP_NOEXCEPT
{
return ( sType == rhs.sType )
&& ( pNext == rhs.pNext )
&& ( type == rhs.type )
&& ( enable == rhs.enable )
&& ( parameter == rhs.parameter );
}
bool operator!=( PerformanceOverrideInfoINTEL const& rhs ) const VULKAN_HPP_NOEXCEPT
{
return !operator==( rhs );
}
#endif
public:
const VULKAN_HPP_NAMESPACE::StructureType sType = StructureType::ePerformanceOverrideInfoINTEL;
const void* pNext = {};
VULKAN_HPP_NAMESPACE::PerformanceOverrideTypeINTEL type = VULKAN_HPP_NAMESPACE::PerformanceOverrideTypeINTEL::eNullHardware;
VULKAN_HPP_NAMESPACE::Bool32 enable = {};
uint64_t parameter = {};
};
static_assert( sizeof( PerformanceOverrideInfoINTEL ) == sizeof( VkPerformanceOverrideInfoINTEL ), "struct and wrapper have different size!" );
static_assert( std::is_standard_layout<PerformanceOverrideInfoINTEL>::value, "struct wrapper is not a standard layout!" );
struct PerformanceStreamMarkerInfoINTEL
{
VULKAN_HPP_CONSTEXPR PerformanceStreamMarkerInfoINTEL( uint32_t marker_ = {} ) VULKAN_HPP_NOEXCEPT
: marker( marker_ )
{}
VULKAN_HPP_CONSTEXPR PerformanceStreamMarkerInfoINTEL( PerformanceStreamMarkerInfoINTEL const& rhs ) VULKAN_HPP_NOEXCEPT
: pNext( rhs.pNext )
, marker( rhs.marker )
{}
PerformanceStreamMarkerInfoINTEL & operator=( PerformanceStreamMarkerInfoINTEL const & rhs ) VULKAN_HPP_NOEXCEPT
{
memcpy( &pNext, &rhs.pNext, sizeof( PerformanceStreamMarkerInfoINTEL ) - offsetof( PerformanceStreamMarkerInfoINTEL, pNext ) );
return *this;
}
PerformanceStreamMarkerInfoINTEL( VkPerformanceStreamMarkerInfoINTEL const & rhs ) VULKAN_HPP_NOEXCEPT
{
*this = rhs;
}
PerformanceStreamMarkerInfoINTEL& operator=( VkPerformanceStreamMarkerInfoINTEL const & rhs ) VULKAN_HPP_NOEXCEPT
{
*this = *reinterpret_cast<VULKAN_HPP_NAMESPACE::PerformanceStreamMarkerInfoINTEL const *>(&rhs);
return *this;
}
PerformanceStreamMarkerInfoINTEL & setPNext( const void* pNext_ ) VULKAN_HPP_NOEXCEPT
{
pNext = pNext_;
return *this;
}
PerformanceStreamMarkerInfoINTEL & setMarker( uint32_t marker_ ) VULKAN_HPP_NOEXCEPT
{
marker = marker_;
return *this;
}
operator VkPerformanceStreamMarkerInfoINTEL const&() const VULKAN_HPP_NOEXCEPT
{
return *reinterpret_cast<const VkPerformanceStreamMarkerInfoINTEL*>( this );
}
operator VkPerformanceStreamMarkerInfoINTEL &() VULKAN_HPP_NOEXCEPT
{
return *reinterpret_cast<VkPerformanceStreamMarkerInfoINTEL*>( this );
}
#if defined(VULKAN_HPP_HAS_SPACESHIP_OPERATOR)
auto operator<=>( PerformanceStreamMarkerInfoINTEL const& ) const = default;
#else
bool operator==( PerformanceStreamMarkerInfoINTEL const& rhs ) const VULKAN_HPP_NOEXCEPT
{
return ( sType == rhs.sType )
&& ( pNext == rhs.pNext )
&& ( marker == rhs.marker );
}
bool operator!=( PerformanceStreamMarkerInfoINTEL const& rhs ) const VULKAN_HPP_NOEXCEPT
{
return !operator==( rhs );
}
#endif
public:
const VULKAN_HPP_NAMESPACE::StructureType sType = StructureType::ePerformanceStreamMarkerInfoINTEL;
const void* pNext = {};
uint32_t marker = {};
};
static_assert( sizeof( PerformanceStreamMarkerInfoINTEL ) == sizeof( VkPerformanceStreamMarkerInfoINTEL ), "struct and wrapper have different size!" );
static_assert( std::is_standard_layout<PerformanceStreamMarkerInfoINTEL>::value, "struct wrapper is not a standard layout!" );
union PerformanceValueDataINTEL
{
PerformanceValueDataINTEL( VULKAN_HPP_NAMESPACE::PerformanceValueDataINTEL const& rhs ) VULKAN_HPP_NOEXCEPT
{
memcpy( static_cast<void*>(this), &rhs, sizeof( VULKAN_HPP_NAMESPACE::PerformanceValueDataINTEL ) );
}
PerformanceValueDataINTEL( uint32_t value32_ = {} )
{
value32 = value32_;
}
PerformanceValueDataINTEL( uint64_t value64_ )
{
value64 = value64_;
}
PerformanceValueDataINTEL( float valueFloat_ )
{
valueFloat = valueFloat_;
}
PerformanceValueDataINTEL( const char* valueString_ )
{
valueString = valueString_;
}
PerformanceValueDataINTEL & setValue32( uint32_t value32_ ) VULKAN_HPP_NOEXCEPT
{
value32 = value32_;
return *this;
}
PerformanceValueDataINTEL & setValue64( uint64_t value64_ ) VULKAN_HPP_NOEXCEPT
{
value64 = value64_;
return *this;
}
PerformanceValueDataINTEL & setValueFloat( float valueFloat_ ) VULKAN_HPP_NOEXCEPT
{
valueFloat = valueFloat_;
return *this;
}
PerformanceValueDataINTEL & setValueBool( VULKAN_HPP_NAMESPACE::Bool32 valueBool_ ) VULKAN_HPP_NOEXCEPT
{
valueBool = valueBool_;
return *this;
}
PerformanceValueDataINTEL & setValueString( const char* valueString_ ) VULKAN_HPP_NOEXCEPT
{
valueString = valueString_;
return *this;
}
VULKAN_HPP_NAMESPACE::PerformanceValueDataINTEL & operator=( VULKAN_HPP_NAMESPACE::PerformanceValueDataINTEL const & rhs ) VULKAN_HPP_NOEXCEPT
{
memcpy( static_cast<void*>(this), &rhs, sizeof( VULKAN_HPP_NAMESPACE::PerformanceValueDataINTEL ) );
return *this;
}
operator VkPerformanceValueDataINTEL const&() const
{
return *reinterpret_cast<const VkPerformanceValueDataINTEL*>(this);
}
operator VkPerformanceValueDataINTEL &()
{
return *reinterpret_cast<VkPerformanceValueDataINTEL*>(this);
}
#ifdef VULKAN_HPP_HAS_UNRESTRICTED_UNIONS
uint32_t value32;
uint64_t value64;
float valueFloat;
VULKAN_HPP_NAMESPACE::Bool32 valueBool;
const char* valueString;
#else
uint32_t value32;
uint64_t value64;
float valueFloat;
VkBool32 valueBool;
const char* valueString;
#endif /*VULKAN_HPP_HAS_UNRESTRICTED_UNIONS*/
};
struct PerformanceValueINTEL
{
PerformanceValueINTEL( VULKAN_HPP_NAMESPACE::PerformanceValueTypeINTEL type_ = VULKAN_HPP_NAMESPACE::PerformanceValueTypeINTEL::eUint32,
VULKAN_HPP_NAMESPACE::PerformanceValueDataINTEL data_ = {} ) VULKAN_HPP_NOEXCEPT
: type( type_ )
, data( data_ )
{}
PerformanceValueINTEL( PerformanceValueINTEL const& rhs ) VULKAN_HPP_NOEXCEPT
: type( rhs.type )
, data( rhs.data )
{}
PerformanceValueINTEL & operator=( PerformanceValueINTEL const & rhs ) VULKAN_HPP_NOEXCEPT
{
memcpy( static_cast<void*>(this), &rhs, sizeof( PerformanceValueINTEL ) );
return *this;
}
PerformanceValueINTEL( VkPerformanceValueINTEL const & rhs ) VULKAN_HPP_NOEXCEPT
{
*this = rhs;
}
PerformanceValueINTEL& operator=( VkPerformanceValueINTEL const & rhs ) VULKAN_HPP_NOEXCEPT
{
*this = *reinterpret_cast<VULKAN_HPP_NAMESPACE::PerformanceValueINTEL const *>(&rhs);
return *this;
}
PerformanceValueINTEL & setType( VULKAN_HPP_NAMESPACE::PerformanceValueTypeINTEL type_ ) VULKAN_HPP_NOEXCEPT
{
type = type_;
return *this;
}
PerformanceValueINTEL & setData( VULKAN_HPP_NAMESPACE::PerformanceValueDataINTEL data_ ) VULKAN_HPP_NOEXCEPT
{
data = data_;
return *this;
}
operator VkPerformanceValueINTEL const&() const VULKAN_HPP_NOEXCEPT
{
return *reinterpret_cast<const VkPerformanceValueINTEL*>( this );
}
operator VkPerformanceValueINTEL &() VULKAN_HPP_NOEXCEPT
{
return *reinterpret_cast<VkPerformanceValueINTEL*>( this );
}
public:
VULKAN_HPP_NAMESPACE::PerformanceValueTypeINTEL type = VULKAN_HPP_NAMESPACE::PerformanceValueTypeINTEL::eUint32;
VULKAN_HPP_NAMESPACE::PerformanceValueDataINTEL data = {};
};
static_assert( sizeof( PerformanceValueINTEL ) == sizeof( VkPerformanceValueINTEL ), "struct and wrapper have different size!" );
static_assert( std::is_standard_layout<PerformanceValueINTEL>::value, "struct wrapper is not a standard layout!" );
} // namespace VULKAN_HPP_NAMESPACE
| 34.495575
| 248
| 0.723756
|
skyline-emu
|
349ec6e62d5838b7a22655ea2df7ddf19c2d2928
| 511
|
cpp
|
C++
|
hw1_2/identify.cpp
|
kinstaky/CourseDataAnalysis
|
9f44f5816ca55b2419df2aa4251fa4107bd9f3fc
|
[
"MIT"
] | null | null | null |
hw1_2/identify.cpp
|
kinstaky/CourseDataAnalysis
|
9f44f5816ca55b2419df2aa4251fa4107bd9f3fc
|
[
"MIT"
] | null | null | null |
hw1_2/identify.cpp
|
kinstaky/CourseDataAnalysis
|
9f44f5816ca55b2419df2aa4251fa4107bd9f3fc
|
[
"MIT"
] | null | null | null |
void identify() {
TFile *ipf = new TFile("AddVeto.root");
TTree *tree = (TTree*)ipf->Get("tree");
tree->AddFriend("tree", "TOFNorm.root");
tree->AddFriend("tree", "QProcessor.root");
//tree->Draw("q0:ntof >> (480, 4, 20, 450, 0, 4500) ", "qLimit && tLimit && ntof > 5", "colz");
tree->Draw("q0:ce >> (480, 0, 160, 450, 0, 4500)", "tLimit && qLimit && ce > 0", "colz");
tree->Draw("q0:ce >> (480, 0, 160, 450, 0, 4500)", "tLimit && qLimit && ce > 0 && !vtLimit", "colz");
ipf->Close();
}
| 36.5
| 103
| 0.544031
|
kinstaky
|
34a20746c7007bd70d4e99263acc0fd496b26e3f
| 3,567
|
cpp
|
C++
|
src/cd++/parser/pini.cpp
|
SimulationEverywhere/CDPP_SantiSimulator
|
7dde59e48a7d8cca6d505b6d5323a57825c97a5b
|
[
"MIT"
] | 4
|
2018-10-26T20:13:27.000Z
|
2020-11-21T21:42:43.000Z
|
src/cd++/parser/pini.cpp
|
SimulationEverywhere/CDPP_SantiSimulator
|
7dde59e48a7d8cca6d505b6d5323a57825c97a5b
|
[
"MIT"
] | 13
|
2018-10-29T03:16:16.000Z
|
2020-09-16T05:57:24.000Z
|
src/cd++/parser/pini.cpp
|
SimulationEverywhere/CDPP_SantiSimulator
|
7dde59e48a7d8cca6d505b6d5323a57825c97a5b
|
[
"MIT"
] | 4
|
2019-04-28T00:20:48.000Z
|
2019-11-27T22:02:45.000Z
|
/*******************************************************************
*
* DESCRIPTION: class PIni
*
* AUTHOR: Alejandro Troccoli
*
* EMAIL: mailto://atroccol@dc.uba.ar
*
* DATE: 17/8/2000
*
*******************************************************************/
/** include files **/
#include <fstream>
#include "pini.h"
#include "strutil.h" // lowerCase
#include "prnutil.h" // operator << std::list< T >
using namespace std;
/** public functions **/
/*******************************************************************
* Function Name: machine
* Description: nombre de los atomicos asociados a una maquina
********************************************************************/
const PIni::IdList &PIni::machine( const MachineId idMachine ) const
{
if( machinesList.find(idMachine) == machinesList.end() )
{
PIniRequestException e( "Machine: Not found!" ) ;
MTHROW( e );
}
return machinesList.find( idMachine )->second ;
}
/*******************************************************************
* Function Name: parse
* Description: llama a parse con un ifstream
********************************************************************/
PIni &PIni::parse( const string &fileIn )
{
ifstream in( fileIn.c_str() );
return this->parse( in );
}
/*******************************************************************
* Function Name: parse
* Description: parsea el inifile
********************************************************************/
PIni &PIni::parse( istream & in )
{
int currentMachine;
TokenIterator cursor( in ) ;
while( cursor != TokenIterator())
{
string word;
Token tokenId = this-> readToken(cursor, word);
switch ( tokenId ) {
case def_TK:
currentMachine = str2Int(word) ;
machinesList[ currentMachine ];
break;
case id_TK:
machinesList[currentMachine] . push_back(word);
break;
}
}
return *this;
}
/*******************************************************************
* Function Name: readToken
* Description: tokenize words
********************************************************************/
PIni::Token PIni::readToken( TokenIterator &cursor, string &word )
{
word = lowerCase( *cursor );
cursor ++ ;
if( *cursor == ":" )
{
cursor ++ ;
return def_TK ;
} else
return id_TK ;
}
/*******************************************************************
* Function Name: exists
********************************************************************/
bool PIni::exists( const MachineId idMachine ) const
{
return machinesList.find( idMachine ) != machinesList.end() ;
}
/*******************************************************************
* Function Name: addGroup
* Description: add group to ini
********************************************************************/
PIni &PIni::addMachine( const MachineId idMachine )
{
machinesList[ idMachine ] ;
return *this ;
}
/*******************************************************************
* Function Name: save
********************************************************************/
PIni &PIni::save( const string &fileName )
{
ofstream out( fileName.c_str() ) ;
this->save( out ) ;
return *this;
}
/*******************************************************************
* Function Name: save
********************************************************************/
PIni &PIni::save( ostream &out )
{
PIni::MachineList::iterator cursor ;
for( cursor = machinesList.begin() ; cursor != machinesList.end() ; cursor ++ )
{
out << '[' << cursor->first << ']' << endl ;
out << cursor->second << endl ;
}
return *this ;
}
| 25.478571
| 80
| 0.428091
|
SimulationEverywhere
|
34a433909f1c704640045e20dda7348e37a767d8
| 2,120
|
cpp
|
C++
|
src/String.cpp
|
ASxa86/asx-object
|
e18d96cdbdfa3fedec0fcb7fec004e1ee0625352
|
[
"MIT"
] | null | null | null |
src/String.cpp
|
ASxa86/asx-object
|
e18d96cdbdfa3fedec0fcb7fec004e1ee0625352
|
[
"MIT"
] | null | null | null |
src/String.cpp
|
ASxa86/asx-object
|
e18d96cdbdfa3fedec0fcb7fec004e1ee0625352
|
[
"MIT"
] | null | null | null |
#include <asx-object/String.h>
namespace
{
// https://stackoverflow.com/questions/68472720/stdto-chars-minimal-floating-point-buffer-size
template <typename T>
constexpr int Log10ceil(T num)
{
return num < 10 ? 1 : 1 + Log10ceil(num / 10);
}
template <typename T>
constexpr int BufferSizeScientific()
{
return 4 + std::numeric_limits<T>::max_digits10 + std::max(2, Log10ceil(std::numeric_limits<T>::max_exponent10));
}
template <typename T>
constexpr int BufferSizeFixed()
{
return 2 + std::numeric_limits<T>::max_digits10 + std::numeric_limits<T>::max_exponent10;
}
}
std::string asx::object::ToString(float x, int precision, std::chars_format fmt)
{
std::string s;
switch(fmt)
{
case std::chars_format::scientific:
precision = std::min(precision, std::numeric_limits<float>::max_digits10 - 1);
s.resize(BufferSizeScientific<float>());
break;
case std::chars_format::fixed:
precision = std::min(precision, std::numeric_limits<float>::max_digits10 - 1);
s.resize(BufferSizeFixed<float>());
break;
case std::chars_format::general:
precision = std::min(precision, std::numeric_limits<float>::max_digits10);
s.resize(BufferSizeScientific<float>());
break;
case std::chars_format::hex:
default:
break;
}
std::to_chars(s.data(), s.data() + s.size(), x, fmt, precision);
return s;
}
std::string asx::object::ToString(double x, int precision, std::chars_format fmt)
{
std::string s;
switch(fmt)
{
case std::chars_format::scientific:
precision = std::min(precision, std::numeric_limits<double>::max_digits10 - 1);
s.resize(BufferSizeScientific<double>());
break;
case std::chars_format::fixed:
precision = std::min(precision, std::numeric_limits<double>::max_digits10 - 1);
s.resize(BufferSizeFixed<double>());
break;
case std::chars_format::general:
precision = std::min(precision, std::numeric_limits<double>::max_digits10);
s.resize(BufferSizeScientific<double>());
break;
case std::chars_format::hex:
default:
break;
}
std::to_chars(s.data(), s.data() + s.size(), x, fmt, precision);
return s;
}
| 24.651163
| 115
| 0.696698
|
ASxa86
|
34ae79771c4af6de6e8882755c1031b77728d002
| 1,347
|
hpp
|
C++
|
include/make_heap.hpp
|
vreverdy/bit-algorithms
|
bc12928d46846eb32b3d9e0a006549a947c4803f
|
[
"BSD-3-Clause"
] | 16
|
2019-06-17T23:56:15.000Z
|
2021-07-04T23:35:31.000Z
|
include/make_heap.hpp
|
bkille/bit-algorithms
|
bc12928d46846eb32b3d9e0a006549a947c4803f
|
[
"BSD-3-Clause"
] | 3
|
2019-04-28T04:53:31.000Z
|
2019-06-01T15:15:11.000Z
|
include/make_heap.hpp
|
bkille/bit-algorithms
|
bc12928d46846eb32b3d9e0a006549a947c4803f
|
[
"BSD-3-Clause"
] | 6
|
2019-03-13T19:21:36.000Z
|
2020-01-01T12:31:34.000Z
|
// =============================== MAKE HEAP =============================== //
// Project: The Experimental Bit Algorithms Library
// Name: make_heap.hpp
// Description: bit_iterator overloads for std::make_heap
// Creator: Vincent Reverdy
// Contributor(s):
// License: BSD 3-Clause License
// ========================================================================== //
#ifndef _MAKE_HEAP_HPP_INCLUDED
#define _MAKE_HEAP_HPP_INCLUDED
// ========================================================================== //
// ============================== PREAMBLE ================================== //
// C++ standard library
// Project sources
// Third-party libraries
// Miscellaneous
namespace bit {
// ========================================================================== //
// Status: to do
template <class RandomIt>
constexpr void make_heap(bit_iterator<RandomIt> first, bit_iterator<RandomIt> last) {
(first, last);
}
// Status: on hold
template <class RandomIt, class Compare>
constexpr void make_heap(bit_iterator<RandomIt> first, bit_iterator<RandomIt> last,
Compare comp) {
(first, last, comp);
}
// ========================================================================== //
} // namespace bit
#endif // _MAKE_HEAP_HPP_INCLUDED
// ========================================================================== //
| 32.071429
| 85
| 0.446177
|
vreverdy
|
34b372f8a4898f11d993543eca940fed8acadddb
| 2,115
|
cpp
|
C++
|
GLFramework/Components/CameraComponent.cpp
|
Illation/GLFramework
|
2b9d3d67d4e951e2ff5ace0241750a438d6e743f
|
[
"MIT"
] | 39
|
2016-03-23T00:39:46.000Z
|
2022-02-07T21:26:05.000Z
|
GLFramework/Components/CameraComponent.cpp
|
Illation/GLFramework
|
2b9d3d67d4e951e2ff5ace0241750a438d6e743f
|
[
"MIT"
] | 1
|
2016-03-24T14:39:45.000Z
|
2016-03-24T17:34:39.000Z
|
GLFramework/Components/CameraComponent.cpp
|
Illation/GLFramework
|
2b9d3d67d4e951e2ff5ace0241750a438d6e743f
|
[
"MIT"
] | 3
|
2016-08-15T01:27:13.000Z
|
2021-12-29T01:37:51.000Z
|
#include "stdafx.hpp"
#include "CameraComponent.hpp"
#include "../Base/Settings.hpp"
#include "../Base/Context.hpp"
#include "TransformComponent.hpp"
#include "../Graphics/Frustum.h"
#include <glm/gtc/matrix_transform.hpp>
#define CONTEXT Context::GetInstance()
CameraComponent::CameraComponent():
m_FOV(45),
m_NearPlane(0.1f),
m_FarPlane(1000.0f),
m_Size(25.0f),
m_PerspectiveProjection(true),
m_IsActive(true)
{
m_Projection = glm::mat4();
m_View = glm::mat4();
m_ViewInverse = glm::mat4();
m_ViewProjection = glm::mat4();
m_ViewProjectionInverse = glm::mat4();
m_pFrustum = new Frustum();
}
CameraComponent::~CameraComponent()
{
delete m_pFrustum;
}
void CameraComponent::Initialize()
{
}
void CameraComponent::Update()
{
if (m_PerspectiveProjection)
{
m_Projection=glm::perspectiveLH(glm::radians(m_FOV),
(float)(WINDOW.Width) / (float)WINDOW.Height, m_NearPlane, m_FarPlane);
}
else
{
float viewWidth = (m_Size>0) ? m_Size * WINDOW.GetAspectRatio() : WINDOW.Width;
float viewHeight = (m_Size>0) ? m_Size : WINDOW.Height;
m_Projection = glm::ortho(0.f, viewWidth, viewHeight, 0.f, m_NearPlane, m_FarPlane);
}
glm::vec3 worldPos = GetTransform()->GetWorldPosition();
glm::vec3 lookAt = worldPos+GetTransform()->GetForward();
glm::vec3 upVec = GetTransform()->GetUp();// glm::vec3(0, 1, 0);//
m_View = glm::lookAtLH(worldPos, lookAt, upVec);
m_ViewInverse = glm::inverse(m_View);
m_ViewProjection = m_Projection*m_View;
m_ViewProjectionInverse = glm::inverse(m_View);
//Update general frustum
if (m_FreezeTimer > 0) m_FreezeTimer -= TIME->DeltaTime();
if (m_FreezeTimer <= 0 && INPUT->IsKeyboardKeyPressed(SDL_SCANCODE_SPACE))
{
m_FreezeTimer = 1;
m_IsFrustumFrozen = !m_IsFrustumFrozen;
}
m_pFrustum->SetCullTransform(glm::mat4());//Frustum will be in world space and objects need to transform themselves
if(!m_IsFrustumFrozen)m_pFrustum->SetToCamera(this);
m_pFrustum->Update();
}
void CameraComponent::Draw()
{
//Nothing to do
}
void CameraComponent::DrawForward()
{
//Nothing to do
}
void CameraComponent::SetActive()
{
CONTEXT->pCamera = this;
}
| 24.882353
| 116
| 0.725768
|
Illation
|
34b3dac7cec0c7bc467310ce629e557054f9a804
| 2,900
|
cpp
|
C++
|
Source/MLJuceApp/MLAppWindow.cpp
|
afofo/madronalib
|
14816a124c8d3a225540ffb408e602aa024fdb4b
|
[
"MIT"
] | null | null | null |
Source/MLJuceApp/MLAppWindow.cpp
|
afofo/madronalib
|
14816a124c8d3a225540ffb408e602aa024fdb4b
|
[
"MIT"
] | null | null | null |
Source/MLJuceApp/MLAppWindow.cpp
|
afofo/madronalib
|
14816a124c8d3a225540ffb408e602aa024fdb4b
|
[
"MIT"
] | null | null | null |
// MadronaLib: a C++ framework for DSP applications.
// Copyright (c) 2013 Madrona Labs LLC. http://www.madronalabs.com
// Distributed under the MIT license: http://madrona-labs.mit-license.org/
#include "MLAppWindow.h"
// --------------------------------------------------------------------------------
#pragma mark MLAppWindow
MLAppWindow::MLAppWindow()
: DocumentWindow (MLProjectInfo::projectName,
Colour::fromHSV(0.5f, 0.0f, 0.30f, 1.f),
DocumentWindow::allButtons,
true),
mpConstrainer(0),
mUsingGL(false)
{
setResizable(true, false);
setResizeLimits (400, 300, 8192, 8192);
//commandManager.registerAllCommandsForTarget (&mBorder);
commandManager.registerAllCommandsForTarget (JUCEApplication::getInstance());
// this lets the command manager use keypresses that arrive in our window to send
// out commands
addKeyListener (commandManager.getKeyMappings());
setContentOwned(&mBorder, false);
mpConstrainer = new MLBoundsConstrainer();
setConstrainer (mpConstrainer);
setUsingNativeTitleBar (true);
// tells our menu bar model that it should watch this command manager for
// changes, and send change messages accordingly.
//&mBorder->setApplicationCommandManagerToWatch (&commandManager);
//setVisible (true);
}
MLAppWindow::~MLAppWindow()
{
// pView = 0;
// TODO String getWindowStateAsString();
// TODO bool restoreWindowStateFromString (const String& previousState);
// (the content component will be deleted automatically, so no need to do it here)
if (mpConstrainer)
{
delete mpConstrainer;
}
#if GLX
openGLContext.detach();
#endif
}
void MLAppWindow::mouseDown (const MouseEvent& e)
{
myDragger.startDraggingComponent (this, e);
}
void MLAppWindow::mouseDrag (const MouseEvent& e)
{
myDragger.dragComponent (this, e, nullptr);
}
void MLAppWindow::setGridUnits(double gx, double gy)
{
mGridUnitsX = gx;
mGridUnitsY = gy;
mpConstrainer->setFixedAspectRatio(gx/gy);
mBorder.setGridUnits(gx, gy);
}
void MLAppWindow::setContent(MLAppView* contentView)
{
mBorder.addMainView(contentView);
}
void MLAppWindow::closeButtonPressed()
{
JUCEApplication::getInstance()->systemRequestedQuit();
}
void MLAppWindow::moved()
{
// repainting here is not quite perfect because
// a flash happens when changing between
// screens of differing resolution.
// TODO could check for move to different display and only repaint in that case
repaint();
DocumentWindow::moved();
mBorder.moved();
}
void MLAppWindow::resized()
{
DocumentWindow::resized();
}
void MLAppWindow::setUsingOpenGL(bool b)
{
#if GLX
if(b != mUsingGL)
{
if(b)
{
openGLContext.attachTo (*this);
}
else
{
openGLContext.detach();
}
mUsingGL = b;
}
#endif
}
| 24.166667
| 85
| 0.67069
|
afofo
|
34b4c37afbd952aacd86039a6a80b6d253d66581
| 1,452
|
cpp
|
C++
|
src/comments/commentssortfiltermodel.cpp
|
black-sheep-dev/harbour-hafenschau
|
8384e769a0d6d5b85787e92565c475be9d2f37fa
|
[
"MIT"
] | 8
|
2021-01-09T21:37:36.000Z
|
2022-01-05T09:27:13.000Z
|
src/comments/commentssortfiltermodel.cpp
|
black-sheep-dev/harbour-hafenschau
|
8384e769a0d6d5b85787e92565c475be9d2f37fa
|
[
"MIT"
] | null | null | null |
src/comments/commentssortfiltermodel.cpp
|
black-sheep-dev/harbour-hafenschau
|
8384e769a0d6d5b85787e92565c475be9d2f37fa
|
[
"MIT"
] | 1
|
2021-03-13T11:21:03.000Z
|
2021-03-13T11:21:03.000Z
|
#include "commentssortfiltermodel.h"
#include "commentsmodel.h"
CommentsSortFilterModel::CommentsSortFilterModel(QObject *parent) :
QSortFilterProxyModel(parent)
{
setSortRole(CommentsModel::TimestampRole);
connect(this, &CommentsSortFilterModel::sortOrderChanged, this, &CommentsSortFilterModel::sortModel);
}
void CommentsSortFilterModel::setPattern(const QString &pattern)
{
m_pattern = pattern;
invalidateFilter();
}
Qt::SortOrder CommentsSortFilterModel::sortOrder() const
{
return m_sortOrder;
}
void CommentsSortFilterModel::setSortOrder(Qt::SortOrder sortOrder)
{
if (m_sortOrder == sortOrder)
return;
m_sortOrder = sortOrder;
emit sortOrderChanged(m_sortOrder);
}
void CommentsSortFilterModel::sortModel(Qt::SortOrder order)
{
this->sort(0, order);
}
bool CommentsSortFilterModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
{
const auto index = sourceModel()->index(source_row, 0, source_parent);
if (!index.isValid())
return false;
if (sourceModel()->data(index, CommentsModel::TitleRole).toString().contains(m_pattern, Qt::CaseInsensitive)
|| sourceModel()->data(index, CommentsModel::AuthorRole).toString().contains(m_pattern, Qt::CaseInsensitive)
|| sourceModel()->data(index, CommentsModel::TextRole).toString().contains(m_pattern, Qt::CaseInsensitive)) {
return true;
}
return false;
}
| 26.888889
| 121
| 0.731405
|
black-sheep-dev
|
34b52bd1ecb6656963d7055a0bceda41e19bd20c
| 12,703
|
cpp
|
C++
|
code/parser/xml_cprocessor.cpp
|
jmpcosta/arta
|
c9fdfc039e34d9d887c9e4c96bf9d506f1a66bb3
|
[
"MIT"
] | 1
|
2019-03-28T20:40:36.000Z
|
2019-03-28T20:40:36.000Z
|
code/parser/xml_cprocessor.cpp
|
jmpcosta/arta
|
c9fdfc039e34d9d887c9e4c96bf9d506f1a66bb3
|
[
"MIT"
] | null | null | null |
code/parser/xml_cprocessor.cpp
|
jmpcosta/arta
|
c9fdfc039e34d9d887c9e4c96bf9d506f1a66bb3
|
[
"MIT"
] | null | null | null |
// *****************************************************************************************
//
// File description:
//
// Author: Joao Costa
// Purpose: Implementation of a generic XML configuration processor
//
// *****************************************************************************************
// *****************************************************************************************
//
// Section: Import headers
//
// *****************************************************************************************
// Import C++ headers
#include <string>
#include <vector>
// Import Module headers
#include "defs/xml_defs.hh"
#include "defs/xml_trace_imp.hh"
#include "defs/xml_node_type.hh"
#include "defs/xml_types.hh"
#include "error/xml_error.hh"
#include "string/xml_string.hh"
// Import module declarations
#include "parser/xml_parser.hh"
#include "parser/xml_cprocessor.hh"
// *****************************************************************************************
//
// Section: Module constants
//
// *****************************************************************************************
namespace osapi
{
namespace xml
{
ARTA_CLASSNAME( cProcessor )
constexpr std::size_t NOT_FOUND = std::string::npos; // More concise wording
// *****************************************************************************************
//
// Section: Function definitions
//
// *****************************************************************************************
cProcessor::cProcessor( parser & p ) : iParser{p}
{
TRACE_POINT
try { XML_PLATFORM_UTILS::Initialize(); }
catch( const XML_EXCEPTION & e )
{ throw error( e ); }
}
cProcessor::~cProcessor()
{
TRACE_POINT
try { XML_PLATFORM_UTILS::Terminate(); }
catch(...)
{
TRACE("Exception found !")
}
}
bool cProcessor::getValue( const char * p_path, std::string & value )
{
std::size_t index, size, att;
std::vector<std::string> paths;
TRACE_ENTER
if( p_path == nullptr ) std::invalid_argument( "No path provided" );
void * p_next = getDocument( iParser );
if( p_next == nullptr ) return false;
TRACE( "Document pointer:", p_next )
std::string path( p_path );
if( ! splitPath( path, paths ) ) return false;
size = paths.size();
for( index=0; index < (size - 1) ; index++ )
{
TRACE( "Processing index:", index )
p_next = getNextElemNode( p_next, paths[ index ] );
if( p_next == nullptr ) return false;
}
// Treat the last path element differently
if( index == (size - 1) )
{
TRACE( "Processing last index:", index )
att = paths[ index ].find_first_not_of( XPATH_ATTRIBUTE_WHITESPACE );
if( att == NOT_FOUND ) att = 0; // No whitespaces before name
// Check if the name is an attribute, if not consider it as an element
if( paths[ index ][ att ] == XPATH_DELIMITER_SATTRIB ) p_next = getNextAttNode ( p_next, paths[ index ] );
else p_next = getNextElemNode( p_next, paths[ index ] );
if( p_next == nullptr ) return false;
}
// If reached the end of the road, get the value of the last node
if( ! getNodeValue( p_next, value ) ) return false;
TRACE_EXIT
return true;
}
bool cProcessor::splitPath( std::string path, std::vector<std::string> & paths )
{
TRACE( "Entering with XPATH=", path )
std::size_t cPos = 0;
std::size_t nPos = 0;
std::string token;
if( path.find( XPATH_DELIMITER_DPATH ) != std::string::npos )
throw std::logic_error( "// is not supported" );
if( path[ 0 ] == '/' ) cPos++;
do {
// TRACE( "1 - Delimiters (", cPos, ",", nPos, ")" )
nPos = path.find( XPATH_DELIMITER_PATH, cPos );
if( nPos == std::string::npos )
token = path.substr( cPos );
else
{
token = path.substr( cPos, nPos - cPos );
cPos = nPos + 1;
// TRACE( "2 - Delimiters (", cPos, ",", nPos, ")" )
}
if( token.size() == 0 ) return false;
//token.erase(0,1);
paths.push_back( token );
TRACE("Token:", token )
} while( nPos != std::string::npos );
TRACE_EXIT
return true;
}
bool cProcessor::splitPathExpression( const std::string expression, std::string & name, std::string & condition )
{
TRACE( "Entering with expression(", expression, ")." )
if( expression.size() == 0 ) return false;
std::size_t lsb = expression.find( XPATH_DELIMITER_LSB );
std::size_t rsb = expression.find( XPATH_DELIMITER_RSB );
TRACE( "LSB (", lsb, "). RSB (", rsb, ").")
if( lsb == NOT_FOUND && rsb == NOT_FOUND )
{
name = expression;
TRACE( "Leaving with Node Name:", name )
return true;
}
// Test for badly formed expression
if( (lsb == NOT_FOUND && rsb != NOT_FOUND) || (lsb != NOT_FOUND && rsb == NOT_FOUND) )
throw std::domain_error( "Malformed condition: Either [ or ] is missing." );;
// A condition exists
if( lsb != NOT_FOUND && rsb != NOT_FOUND )
{
// Sanity checks
if( rsb < lsb ) std::logic_error( "Bad XPATH condition: ] before [" );
if( expression.size() != rsb + 1 ) std::logic_error( "Bad XPATH condition: ] is not the last character" );
name = expression.substr( 0, lsb );
condition = expression.substr( lsb + 1, rsb - lsb -1 );
TRACE( "Node Name (", name, ") and Condition (", condition, ") found." )
return true;
}
// Shouldn't reach this point
return false;
}
bool cProcessor::getCondAttValue(std::string & token, std::string & value )
{
std::size_t begin = 0;
std::size_t end = 0;
TRACE( "Entering with token:", token )
if( token.size() == 0 ) return false;
begin = token.find( XPATH_ATTRIBUTE_QUOTE );
if( begin == NOT_FOUND ) throw std::domain_error( "Attribute values must be quoted" );
TRACE( "Opening quote found at position:", begin )
TRACE( "Before quote (", (begin == NOT_FOUND || begin == 0 ? EMPTY_STRING: token.substr( 0, begin - 1 ) ), ")" )
end = token.find( XPATH_ATTRIBUTE_QUOTE, begin + 1 );
if( end == NOT_FOUND ) throw std::domain_error( "Attribute values must be quoted terminated" );
TRACE( "Ending quote found at position:", end )
TRACE( "After quote (", token.substr( end + 1), ")" )
if( token.find_first_not_of( XPATH_ATTRIBUTE_QUOTE_VALUE, 0, begin - 1 ) != NOT_FOUND )
throw std::domain_error( "Illegal character(s) before attribute quote" );
if( (end + 1) != token.size() && token.find_last_not_of ( XPATH_ATTRIBUTE_QUOTE_VALUE, end + 1 ) != NOT_FOUND )
throw std::domain_error( "Illegal character(s) after attribute quote" );
value = token.substr( begin + 1, end - begin - 1 );
TRACE( "Leaving with value (", value, "):", (value.size() == 0 ? ARTA_FAILURE : ARTA_SUCCESS ) )
return ( value.size() == 0 ? false : true ); // Should empty attribute values be allowed ?
}
bool cProcessor::getCondAttName(std::string & token, std::string & name )
{
std::size_t begin = 0;
std::size_t end = 0;
std::size_t len = 0;
std::size_t i = 0;
TRACE( "Entering with token:", token )
if( token.size() == 0 ) throw std::domain_error( "No attribute name found" );
begin = token.find( XPATH_ATTRIBUTE_START );
if( begin == NOT_FOUND ) throw std::domain_error( "Attribute start token not found" );
// Verify that, before the attribute, only white spaces are allowed
i = token.find_first_not_of( XPATH_ATTRIBUTE_WHITESPACE, 0, begin - 1 );
if( i != NOT_FOUND )
{
std::string illegal = "Illegal character(s) before attribute name:" + token[ i ];
throw std::domain_error( illegal );
}
// The attribute name must contain only alphanumeric characters
for( i = begin + 1; i < name.size(); i++ )
if( ! std::isalnum( name[ i ] ) )
throw std::domain_error( "Attribute name contains invalid characters" );
end = token.find( XPATH_CHARACTER_SPACE, begin + 1 );
if( end == NOT_FOUND ) len = end;
else len = end - begin;
name = token.substr( begin + 1, len );
TRACE( "Exiting with attribute name = ", name )
return ( name.size() == 0 ? false : true );
}
bool cProcessor::splitCondition( const std::string & cond, std::string & atName, std::string & atValue )
{
std::size_t pos = 0;
std::string token;
TRACE( "Entering with condition:", cond )
pos = cond.find( XPATH_OPERATOR_EQUAL );
if( pos == NOT_FOUND ) return false; // If there is a condition, a equal condition must exist
// First process attribute name
token = cond.substr(0, pos );
if( ! getCondAttName( token, atName) ) return false;
// Next process attribute value
token = cond.substr( pos + 1 );
if( ! getCondAttValue( token, atValue) ) return false;
TRACE( "Exiting with ", ARTA_SUCCESS )
return true;
}
bool cProcessor::evalCondition( void * p_node, std::string & cond )
{
std::string atName, atValue, value;
TRACE( "Entering with condition (", cond, ")" )
if( p_node == nullptr ) std::invalid_argument( "Current node is null !" );
if( cond.size() == 0 )
{
TRACE( "Exiting with ", ARTA_SUCCESS )
return true; // No condition to search
}
if( ! splitCondition( cond, atName, atValue ) )
{
TRACE( "Exiting with ", ARTA_FAILURE )
return false;
}
// Search for the attribute in the current element
if( ! getAttributeValue( p_node, atName, value) )
{
TRACE( "Exiting with ", ARTA_FAILURE )
return false;
}
TRACE( "Leaving with ", ( atValue == value ? ARTA_SUCCESS : ARTA_FAILURE ) )
// Did we find a node that as an attribute that matches the search value?
return ( atValue == value );
}
bool cProcessor::getNameNode( void * p_node, std::string & name )
{
TRACE_ENTER
XML_NODE * p_xnode = (XML_NODE *) p_node;
//if( p_xnode->getNodeType == XML_NODE::ELEMENT_NODE ) return getElementName( p_node, name );
try {
TRACE( "Node type:", p_xnode->getNodeType() )
const XMLCh * p_name = p_xnode->getNodeName();
if( p_name == nullptr ) return false;
char * p_nodeName = XML_STRING::transcode( p_name );
if( p_nodeName == nullptr ) return false;
TRACE( "Node name:", p_nodeName )
name = p_nodeName;
XML_STRING::release( &p_nodeName );
}
catch( const XML_EXCEPTION & e )
{ throw error( e ); }
catch( const XML_DOM_EXCEPTION & e )
{ throw error( e ); }
TRACE_EXIT
return true;
}
bool cProcessor::isNextNode( void * p_node, std::string & path, std::string & condition )
{
std::string nameNode;
TRACE( "Entering with path (", path, ")")
if( p_node == nullptr ) std::invalid_argument( "Current node is null !" );
if( path.size() == 0 ) std::invalid_argument( "Path is null" );
if( ! getNameNode( p_node, nameNode ) ) return false;
// For this node to be the one, first the node name must match
if( nameNode != path )
{
TRACE( "Leaving with Name mismatch:", nameNode, "!=", path )
return false;
}
TRACE( "Matching node name. Looking for any available condition...")
// And second, if there is any condition on the node, the condition must also match
bool ret = evalCondition( p_node, condition );
TRACE( "Leaving with ", (ret ? "Success" : "Failure" ) )
return ret;
}
void * cProcessor::getNextAttNode( void * p_current, std::string & cPath )
{
void * ret = nullptr;
std::vector<std::string> list;
TRACE_ENTER
if( p_current == nullptr ) std::invalid_argument( "Current node is null !" );
if( cPath.size() == 0 ) std::invalid_argument( "Path is null" );
TRACE( "Processing next path element:", cPath )
TRACE( "Current pointer:", p_current )
// First, get the attribute name from the path
std::string atName;
if( getCondAttName( cPath, atName ) )
ret = getAttributeAddress( p_current, atName );
TRACE_EXIT
return ret;
}
void * cProcessor::getNextElemNode( void * p_current, std::string & path )
{
std::string pathNode, condition;
TRACE_ENTER
if( p_current == nullptr ) std::invalid_argument( "Current node is null !" );
if( path.size() == 0 ) std::invalid_argument( "Path is null" );
TRACE( "Processing next path element:", path )
TRACE( "Current pointer:", p_current )
if( (! splitPathExpression( path, pathNode, condition )) || (pathNode.size() == 0) ) return nullptr;
try {
XML_NODE_LIST * p_list = ((XML_NODE *) p_current)->getChildNodes();
XMLSize_t nodeCount = p_list->getLength();
TRACE( "Number of children:", nodeCount )
// Find the node we are interested
for( XMLSize_t i = 0; i < nodeCount; i++ )
{
XML_NODE * p_child = nullptr;
TRACE( "Processing item:", i )
p_child = p_list->item( i );
if( p_child == nullptr ) break;
if( isNextNode( p_child, pathNode, condition ) ) return (void *) p_child;
}
}
catch( const XML_EXCEPTION & e )
{ throw error( e ); }
catch( const XML_DOM_EXCEPTION & e )
{ throw error( e ); }
TRACE_EXIT
return nullptr;
}
} // End of namespace "xml"
} // End of namespace "osapi"
| 25.714575
| 113
| 0.609541
|
jmpcosta
|
34b80b13252c1e04619a75ea7c3d211782ace9be
| 1,969
|
hpp
|
C++
|
E_Util/Include/Vector.hpp
|
EavanKim/E_Flow_Dev
|
a8b076df8f748d4cc2f0d6da2ee01e7601f860b8
|
[
"MIT"
] | null | null | null |
E_Util/Include/Vector.hpp
|
EavanKim/E_Flow_Dev
|
a8b076df8f748d4cc2f0d6da2ee01e7601f860b8
|
[
"MIT"
] | null | null | null |
E_Util/Include/Vector.hpp
|
EavanKim/E_Flow_Dev
|
a8b076df8f748d4cc2f0d6da2ee01e7601f860b8
|
[
"MIT"
] | null | null | null |
#ifndef VECTOR_HPP__
#define VECTOR_HPP__
namespace util
{
class UTIL_EXPORTS Vector
{
public:
Vector();
Vector(__m128 _Vector);
Vector(float _x, float _y, float _z, float _a);
Vector(const Vector& other);
float x() const;
float y() const;
float z() const;
float a() const;
void set(const std::initializer_list<float>& _lst);
void set(const Vector& _other);
Vector& operator=(const std::initializer_list<float>& _lst);
Vector& operator=(const Vector& _other);
float& operator[](std::size_t _Index);
const float& operator[](std::size_t _Index) const;
Vector add(__m128 _Vector) const;
Vector add(const Vector& _Vector) const;
Vector sub(__m128 _Vector) const;
Vector sub(const Vector& _Vector) const;
Vector mul(__m128 _Vector) const;
Vector mul(const Vector& _Vector) const;
Vector div(__m128 _Vector) const;
Vector div(const Vector& _Vector) const;
Vector operator+(__m128 _Vector) const;
Vector operator+(const Vector& _Vector) const;
Vector operator-(__m128 _Vector) const;
Vector operator-(const Vector& _Vector) const;
Vector operator*(__m128 _Vector) const;
Vector operator*(const Vector& _Vector) const;
Vector operator/(__m128 _Vector) const;
Vector operator/(const Vector& _Vector) const;
Vector operator+(float _val) const;
Vector operator-(float _val) const;
Vector operator*(float _val) const;
Vector operator/(float _val) const;
float dot(__m128 _Vector) const;
float dot(const Vector& _Vector) const;
Vector cross(__m128 _Vector) const;
Vector cross(const Vector& _Vector) const;
float lengthSquared() const;
float length() const;
void normalize();
Vector normalized() const;
Vector projected(const Vector& normal) const;
Vector reflected(const Vector& noraml) const;
bool isSimiler(const Vector& _other) const;
float distanceTo(const Vector& _other) const;
std::tuple<Vector, Vector> tangential() const;
private:
__m128 _data;
};
}
#endif
| 26.608108
| 62
| 0.727273
|
EavanKim
|
34b952038bd4e593498fc451b8f0eb2b120171d3
| 1,543
|
cpp
|
C++
|
Source/Scripting/bsfScript/Generated/BsScriptSkeletonBoneInfoEx.generated.cpp
|
bsf2dev/bsf
|
b318cd4eb1b0299773d625e6c870b8d503cf539e
|
[
"MIT"
] | 1,745
|
2018-03-16T02:10:28.000Z
|
2022-03-26T17:34:21.000Z
|
Source/Scripting/bsfScript/Generated/BsScriptSkeletonBoneInfoEx.generated.cpp
|
bsf2dev/bsf
|
b318cd4eb1b0299773d625e6c870b8d503cf539e
|
[
"MIT"
] | 395
|
2018-03-16T10:18:20.000Z
|
2021-08-04T16:52:08.000Z
|
Source/Scripting/bsfScript/Generated/BsScriptSkeletonBoneInfoEx.generated.cpp
|
bsf2dev/bsf
|
b318cd4eb1b0299773d625e6c870b8d503cf539e
|
[
"MIT"
] | 267
|
2018-03-17T19:32:54.000Z
|
2022-02-17T16:55:50.000Z
|
//********************************* bs::framework - Copyright 2018-2019 Marko Pintera ************************************//
//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
#include "BsScriptSkeletonBoneInfoEx.generated.h"
#include "BsMonoMethod.h"
#include "BsMonoClass.h"
#include "BsMonoUtil.h"
namespace bs
{
ScriptSkeletonBoneInfoEx::ScriptSkeletonBoneInfoEx(MonoObject* managedInstance)
:ScriptObject(managedInstance)
{ }
void ScriptSkeletonBoneInfoEx::initRuntimeData()
{ }
MonoObject*ScriptSkeletonBoneInfoEx::box(const __SkeletonBoneInfoExInterop& value)
{
return MonoUtil::box(metaData.scriptClass->_getInternalClass(), (void*)&value);
}
__SkeletonBoneInfoExInterop ScriptSkeletonBoneInfoEx::unbox(MonoObject* value)
{
return *(__SkeletonBoneInfoExInterop*)MonoUtil::unbox(value);
}
SkeletonBoneInfoEx ScriptSkeletonBoneInfoEx::fromInterop(const __SkeletonBoneInfoExInterop& value)
{
SkeletonBoneInfoEx output;
String tmpname;
tmpname = MonoUtil::monoToString(value.name);
output.name = tmpname;
output.parent = value.parent;
output.invBindPose = value.invBindPose;
return output;
}
__SkeletonBoneInfoExInterop ScriptSkeletonBoneInfoEx::toInterop(const SkeletonBoneInfoEx& value)
{
__SkeletonBoneInfoExInterop output;
MonoString* tmpname;
tmpname = MonoUtil::stringToMono(value.name);
output.name = tmpname;
output.parent = value.parent;
output.invBindPose = value.invBindPose;
return output;
}
}
| 29.673077
| 124
| 0.73558
|
bsf2dev
|
34bad13772c44783bb48ca469eb1b7be8bbc95a8
| 6,741
|
cpp
|
C++
|
src/libtextmode/utf8.cpp
|
joelpob/ansilove-term
|
2842c41bc2429a98d51e02e2d6eb55254afa79bb
|
[
"BSD-3-Clause"
] | null | null | null |
src/libtextmode/utf8.cpp
|
joelpob/ansilove-term
|
2842c41bc2429a98d51e02e2d6eb55254afa79bb
|
[
"BSD-3-Clause"
] | null | null | null |
src/libtextmode/utf8.cpp
|
joelpob/ansilove-term
|
2842c41bc2429a98d51e02e2d6eb55254afa79bb
|
[
"BSD-3-Clause"
] | null | null | null |
#include "utf8.h"
#include <string>
uint16_t cp_437_to_unicode(const uint8_t& cp_437)
{
switch(cp_437) {
case 1:
return 0x263A;
case 2:
return 0x263B;
case 3:
return 0x2665;
case 4:
return 0x2666;
case 5:
return 0x2663;
case 6:
return 0x2660;
case 7:
return 0x2022;
case 8:
return 0x25D8;
case 9:
return 0x25CB;
case 10:
return 0x25D9;
case 11:
return 0x2642;
case 12:
return 0x2640;
case 13:
return 0x266A;
case 14:
return 0x266B;
case 15:
return 0x263C;
case 16:
return 0x25BA;
case 17:
return 0x25C4;
case 18:
return 0x2195;
case 19:
return 0x203C;
case 20:
return 0x00B6;
case 21:
return 0x00A7;
case 22:
return 0x25AC;
case 23:
return 0x21A8;
case 24:
return 0x2191;
case 25:
return 0x2193;
case 26:
return 0x2192;
case 27:
return 0x2190;
case 28:
return 0x221F;
case 29:
return 0x2194;
case 30:
return 0x25B2;
case 31:
return 0x25BC;
case 127:
return 0x2302;
case 128:
return 0x00C7;
case 129:
return 0x00FC;
case 130:
return 0x00E9;
case 131:
return 0x00E2;
case 132:
return 0x00E4;
case 133:
return 0x00E0;
case 134:
return 0x00E5;
case 135:
return 0x00E7;
case 136:
return 0x00EA;
case 137:
return 0x00EB;
case 138:
return 0x00E8;
case 139:
return 0x00EF;
case 140:
return 0x00EE;
case 141:
return 0x00EC;
case 142:
return 0x00C4;
case 143:
return 0x00C5;
case 144:
return 0x00C9;
case 145:
return 0x00E6;
case 146:
return 0x00C6;
case 147:
return 0x00F4;
case 148:
return 0x00F6;
case 149:
return 0x00F2;
case 150:
return 0x00FB;
case 151:
return 0x00F9;
case 152:
return 0x00FF;
case 153:
return 0x00D6;
case 154:
return 0x00DC;
case 155:
return 0x00A2;
case 156:
return 0x00A3;
case 157:
return 0x00A5;
case 158:
return 0x20A7;
case 159:
return 0x0192;
case 160:
return 0x00E1;
case 161:
return 0x00ED;
case 162:
return 0x00F3;
case 163:
return 0x00FA;
case 164:
return 0x00F1;
case 165:
return 0x00D1;
case 166:
return 0x00AA;
case 167:
return 0x00BA;
case 168:
return 0x00BF;
case 169:
return 0x2310;
case 170:
return 0x00AC;
case 171:
return 0x00BD;
case 172:
return 0x00BC;
case 173:
return 0x00A1;
case 174:
return 0x00AB;
case 175:
return 0x00BB;
case 176:
return 0x2591;
case 177:
return 0x2592;
case 178:
return 0x2593;
case 179:
return 0x2502;
case 180:
return 0x2524;
case 181:
return 0x2561;
case 182:
return 0x2562;
case 183:
return 0x2556;
case 184:
return 0x2555;
case 185:
return 0x2563;
case 186:
return 0x2551;
case 187:
return 0x2557;
case 188:
return 0x255D;
case 189:
return 0x255C;
case 190:
return 0x255B;
case 191:
return 0x2510;
case 192:
return 0x2514;
case 193:
return 0x2534;
case 194:
return 0x252C;
case 195:
return 0x251C;
case 196:
return 0x2500;
case 197:
return 0x253C;
case 198:
return 0x255E;
case 199:
return 0x255F;
case 200:
return 0x255A;
case 201:
return 0x2554;
case 202:
return 0x2569;
case 203:
return 0x2566;
case 204:
return 0x2560;
case 205:
return 0x2550;
case 206:
return 0x256C;
case 207:
return 0x2567;
case 208:
return 0x2568;
case 209:
return 0x2564;
case 210:
return 0x2565;
case 211:
return 0x2559;
case 212:
return 0x2558;
case 213:
return 0x2552;
case 214:
return 0x2553;
case 215:
return 0x256B;
case 216:
return 0x256A;
case 217:
return 0x2518;
case 218:
return 0x250C;
case 219:
return 0x2588;
case 220:
return 0x2584;
case 221:
return 0x258C;
case 222:
return 0x2590;
case 223:
return 0x2580;
case 224:
return 0x03B1;
case 225:
return 0x00DF;
case 226:
return 0x0393;
case 227:
return 0x03C0;
case 228:
return 0x03A3;
case 229:
return 0x03C3;
case 230:
return 0x00B5;
case 231:
return 0x03C4;
case 232:
return 0x03A6;
case 233:
return 0x0398;
case 234:
return 0x03A9;
case 235:
return 0x03B4;
case 236:
return 0x221E;
case 237:
return 0x03C6;
case 238:
return 0x03B5;
case 239:
return 0x2229;
case 240:
return 0x2261;
case 241:
return 0x00B1;
case 242:
return 0x2265;
case 243:
return 0x2264;
case 244:
return 0x2320;
case 245:
return 0x2321;
case 246:
return 0x00F7;
case 247:
return 0x2248;
case 248:
return 0x00B0;
case 249:
return 0x2219;
case 250:
return 0x00B7;
case 251:
return 0x221A;
case 252:
return 0x207F;
case 253:
return 0x00B2;
case 254:
return 0x25A0;
case 0:
case 255:
return 0x00A0;
default:
return cp_437;
}
}
std::string cp_437_code_to_string(const uint8_t& cp_437)
{
std::string string;
auto unicode = cp_437_to_unicode(cp_437);
if(unicode < 0x80) {
string += char(unicode);
} else if(unicode < 0x800) {
string += char((unicode >> 6) | 0300);
string += char((unicode & 077) | 0200);
} else {
string += char((unicode >> 12) | 0340);
string += char(((unicode >> 6) & 077) | 0200);
string += char((unicode & 077) | 0200);
}
return string;
}
std::string cp_437_to_utf8_string(std::vector<uint8_t>& vector)
{
std::string string;
for(auto& i:vector) {
string += cp_437_code_to_string(i);
}
return string;
}
| 18.829609
| 63
| 0.519804
|
joelpob
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.