blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 2 247 | content_id stringlengths 40 40 | detected_licenses listlengths 0 57 | license_type stringclasses 2 values | repo_name stringlengths 4 111 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 58 | visit_date timestamp[ns]date 2015-07-25 18:16:41 2023-09-06 10:45:08 | revision_date timestamp[ns]date 1970-01-14 14:03:36 2023-09-06 06:22:19 | committer_date timestamp[ns]date 1970-01-14 14:03:36 2023-09-06 06:22:19 | github_id int64 3.89k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 25 values | gha_event_created_at timestamp[ns]date 2012-06-07 00:51:45 2023-09-14 21:58:52 ⌀ | gha_created_at timestamp[ns]date 2008-03-27 23:40:48 2023-08-24 19:49:39 ⌀ | gha_language stringclasses 159 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 10.5M | extension stringclasses 111 values | filename stringlengths 1 195 | text stringlengths 7 10.5M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0e3114fdfc46ffa0d13c97346800bbda6543771b | 166e5a38b889a8fd6da5b1587c76cfed35df3412 | /73. Set Matrix Zeroes.cpp | 1b3f1d1597aee5b7ef26cada750b1fb642d9813c | [] | no_license | rocky2133/leetcode | b071c71c284ce5cfa8e880bcdaf2a8a3cbb06c39 | 695687f0f1c9389ac3e730c7212e8f0fd88304a0 | refs/heads/master | 2020-08-08T08:04:29.520859 | 2019-11-06T05:08:49 | 2019-11-06T05:08:49 | 213,787,234 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,231 | cpp | 73. Set Matrix Zeroes.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void setZeroes(vector<vector<int>>& matrix) {
if(matrix.size()<1||matrix[0].size()<1)
return;
int row=-1;
int col=-1;
for(int i=0;i<matrix.size();i++){
for(int j=0;j<matrix[0].size();j++){
if(matrix[i][j]==0){
row=i;
col=j;
break;
}
}
if(row!=-1)
break;
}
if(row<0||col<0)
return;
for(int i=row+1;i<matrix.size();i++){
for(int j=0;j<matrix[0].size();j++){
if(j==col)
continue;
if(matrix[i][j]==0){
matrix[i][col]=0;
matrix[row][j]=0;
}
}
}
for(int i=0;i<matrix.size();i++){
if(matrix[i][col]==0){
if(i==row)
continue;
for(int j=0;j<matrix[0].size();j++){
matrix[i][j]=0;
}
}
}
for(int i=0;i<matrix[0].size();i++){
if(matrix[row][i]==0){
for(int j=0;j<matrix.size();j++){
matrix[j][i]=0;
}
}
matrix[row][i]=0;
}
}
int main(){
vector<vector<int> > matrix = {{0,0,0,5},{4,3,1,4},{0,1,1,4},{1,2,1,3},{0,0,1,1}};
setZeroes(matrix);
for(auto i:matrix){
for(auto j:i){
cout<<j<<" ";
}
cout<<endl;
}
return 0;
} |
76f1707e88f327d766bbc3966783a9b998826aad | 4dbb45758447dcfa13c0be21e4749d62588aab70 | /iOS/Classes/Native/mscorlib_System_Resources_ResourceSet3047644174.h | 08c5034b8d5537b1b5d0736b338e3f3ff49fa83f | [
"MIT"
] | permissive | mopsicus/unity-share-plugin-ios-android | 6dd6ccd2fa05c73f0bf5e480a6f2baecb7e7a710 | 3ee99aef36034a1e4d7b156172953f9b4dfa696f | refs/heads/master | 2020-12-25T14:38:03.861759 | 2016-07-19T10:06:04 | 2016-07-19T10:06:04 | 63,676,983 | 12 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,562 | h | mscorlib_System_Resources_ResourceSet3047644174.h | #pragma once
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
// System.Resources.IResourceReader
struct IResourceReader_t2442418644;
// System.Collections.Hashtable
struct Hashtable_t1407064410;
#include "mscorlib_System_Object4170816371.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Resources.ResourceSet
struct ResourceSet_t3047644174 : public Il2CppObject
{
public:
// System.Resources.IResourceReader System.Resources.ResourceSet::Reader
Il2CppObject * ___Reader_0;
// System.Collections.Hashtable System.Resources.ResourceSet::Table
Hashtable_t1407064410 * ___Table_1;
// System.Boolean System.Resources.ResourceSet::resources_read
bool ___resources_read_2;
// System.Boolean System.Resources.ResourceSet::disposed
bool ___disposed_3;
public:
inline static int32_t get_offset_of_Reader_0() { return static_cast<int32_t>(offsetof(ResourceSet_t3047644174, ___Reader_0)); }
inline Il2CppObject * get_Reader_0() const { return ___Reader_0; }
inline Il2CppObject ** get_address_of_Reader_0() { return &___Reader_0; }
inline void set_Reader_0(Il2CppObject * value)
{
___Reader_0 = value;
Il2CppCodeGenWriteBarrier(&___Reader_0, value);
}
inline static int32_t get_offset_of_Table_1() { return static_cast<int32_t>(offsetof(ResourceSet_t3047644174, ___Table_1)); }
inline Hashtable_t1407064410 * get_Table_1() const { return ___Table_1; }
inline Hashtable_t1407064410 ** get_address_of_Table_1() { return &___Table_1; }
inline void set_Table_1(Hashtable_t1407064410 * value)
{
___Table_1 = value;
Il2CppCodeGenWriteBarrier(&___Table_1, value);
}
inline static int32_t get_offset_of_resources_read_2() { return static_cast<int32_t>(offsetof(ResourceSet_t3047644174, ___resources_read_2)); }
inline bool get_resources_read_2() const { return ___resources_read_2; }
inline bool* get_address_of_resources_read_2() { return &___resources_read_2; }
inline void set_resources_read_2(bool value)
{
___resources_read_2 = value;
}
inline static int32_t get_offset_of_disposed_3() { return static_cast<int32_t>(offsetof(ResourceSet_t3047644174, ___disposed_3)); }
inline bool get_disposed_3() const { return ___disposed_3; }
inline bool* get_address_of_disposed_3() { return &___disposed_3; }
inline void set_disposed_3(bool value)
{
___disposed_3 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
|
4e1eb3885e9d9154a43201ad222cb0499a0988e2 | e1700081b3e9fa1c74e6dd903da767a3fdeca7f5 | /libs/post/post2dbirdeye/post2dbirdeyewindowgraphicsview.cpp | dd64cb94cd9fca13665c37a4c666ebfd98ec6b19 | [
"MIT"
] | permissive | i-RIC/prepost-gui | 2fdd727625751e624245c3b9c88ca5aa496674c0 | 8de8a3ef8366adc7d489edcd500a691a44d6fdad | refs/heads/develop_v4 | 2023-08-31T09:10:21.010343 | 2023-08-31T06:54:26 | 2023-08-31T06:54:26 | 67,224,522 | 8 | 12 | MIT | 2023-08-29T23:04:45 | 2016-09-02T13:24:00 | C++ | UTF-8 | C++ | false | false | 165 | cpp | post2dbirdeyewindowgraphicsview.cpp | #include "post2dbirdeyewindowgraphicsview.h"
Post2dBirdEyeWindowGraphicsView::Post2dBirdEyeWindowGraphicsView(QWidget* parent) :
VTK3DGraphicsView(parent)
{}
|
75acec418e23381b334ea2025f85d6f0c50b3560 | dc854dd0754796397fc6a7b22344414f60ce5298 | /nvp_za_nlogn.cpp | f625e41c727fa2a62dac539ba4d16f5566ffd33a | [] | no_license | Ghytro/algo-stuff | f37655baa36366832f03b14b751bcab99ac57ee8 | 0a343a7809cad3c3e5d54124f3936d4ad50610d7 | refs/heads/master | 2023-02-05T18:55:41.347609 | 2020-12-24T18:17:51 | 2020-12-24T18:17:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,021 | cpp | nvp_za_nlogn.cpp | //надо реверс убрать, будет нвп
#include <bits/stdc++.h>
#define ll long long
#define INF 999999999999999
using namespace std;
vector<ll> a;
int main()
{
int n;
cin >> n;
a.resize(n);
for (int i = 0; i < n; i++)
cin >> a[i];
reverse(a.begin(), a.end());
//for (int i = 0; i < n; i++)
// cout << a[i] << ' ';
vector<ll> dp(n + 1, INF), num(n, -1), par(n, -1);
dp[0] = -INF;
for (int i = 0; i < n; i++)
{
auto it = lower_bound(dp.begin(), dp.end(), a[i]) - dp.begin();
dp[it] = a[i];
num[it] = i;
par[i] = num[it - 1];
}
int st = 0;
for (int i = par.size() - 1; i >= 0; i--)
{
if (par[i] != -1)
{
st = i;
break;
}
}
vector<int> ans;
ans.push_back(st);
while (par[ans.back()] != -1)
ans.push_back(par[ans.back()]);
cout << ans.size() << endl;
for (int i: ans)
cout << a.size() - i << ' ';
return 0;
}
|
3aa98956fd71f801aee16b50317393755dec419a | 44884325255b09ec189d17346e601adabe05795c | /MinimumDepthofBinaryTree/minimum_depth_of_binary_tree.cpp | d16b5c9096495c902a6504cb4905721f1bafb286 | [] | no_license | commandow/LeetCode | 931df5ba6e321026c611ca77651dfd52f5bccae7 | 2b331d44d70782aa77015851c46b843b296e934b | refs/heads/master | 2021-01-25T10:29:19.160843 | 2018-10-06T14:53:53 | 2018-10-06T14:53:53 | 26,391,744 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 809 | cpp | minimum_depth_of_binary_tree.cpp | #include <string>
#include <vector>
#include <list>
#include <iostream>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
int minDepth(TreeNode *root) {
if (root == NULL)
{
return 0;
}
if (root->left == NULL)
{
return minDepth(root->right) + 1;
}
if (root->right == NULL)
{
return minDepth(root->left) + 1;
}
int left_depth = minDepth(root->left) + 1;
int right_depth = minDepth(root->right) + 1;
return left_depth > right_depth ? right_depth : left_depth;
}
};
int main(int argc, char **argv)
{
int f;
cin >> f;
} |
8c3d6471fc3a07ce4f23ff48903e1d7729f982f9 | 1ed23d4af79d868716d160e2bdf580365d783c27 | /arduino/InteractiveLights/Networking.cpp | a287c123d78ba8421a3a779f11c13828c10e6a53 | [] | no_license | snakemode/matrix-driver | 3ec0529bd412668ce956cf368b56ed2a3d212eb4 | 7eb5f5aabdaaffecd163ec8fead775cda160d097 | refs/heads/main | 2023-03-04T01:23:52.121021 | 2021-02-19T10:41:19 | 2021-02-19T10:41:19 | 314,314,196 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 529 | cpp | Networking.cpp | #if defined(ESP32)
#include <WiFi.h>
#else
#include <ESP8266WiFi.h>
#endif
#include "DataStructures.h"
#include "Networking.h"
auto networking::ensure_wifi_connected(const char* const ssid, const char* const password) -> void
{
if (WiFi.status() == WL_CONNECTED)
{
return;
}
Serial.println(F("Connecting to "));
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(100);
}
Serial.println(WiFi.localIP());
Serial.println(F("WiFi connected"));
}
|
971adac590b09d435a1c1b5351aaf6ee9c806a88 | 6249efbcbfcad8dea47006056711126071c2a744 | /src/EntityContainer.h | 5bc103ff27f25a10d67aabf0cb47fac27d29f5d1 | [] | no_license | Adam-Weesner/Qore | 73c9eb1504a6643cd2b6c37e3aea106ea5b5c2a2 | ef733e687fc8d3afd8f24be5e16afa88e93b90fa | refs/heads/master | 2022-04-10T20:39:23.695019 | 2020-03-16T22:21:55 | 2020-03-16T22:21:55 | 245,252,486 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 621 | h | EntityContainer.h | // Qore Engine written by Adam Weesner @ 2020
#ifndef ENTITYCONTAINER_H
#define ENTITYCONTAINER_H
#include "Entity.h"
#include "Component.h"
#include <vector>
class EntityContainer
{
public:
void ClearData();
void Update(float deltaTime);
void Render();
void AddEntity(Entity* entity);
std::vector<Entity*> GetEntities() const;
unsigned int GetEntityCount();
bool IsEmpty();
std::string PrintEntities() const;
std::vector<Entity*> GetEntitiesByLayer(Layers layer) const;
private:
std::vector<Entity*> entities;
};
#endif
|
3503ed00f11b2f9d2894c249b963c9b232f836d7 | 27fd300c2c0cb92b5ce70cf203c1ac35e3f44314 | /oops/p1.cpp | b58b75d7dd54ae424c1b02188234db5a7204c0d2 | [] | no_license | kameshkotwani/cpp | 33f1b011657f1f702013ce2d1556ed19434f118a | 2b0e6a809a4ec3e61c1b6e206eb2c9ac874046c6 | refs/heads/master | 2023-06-25T16:10:44.461292 | 2021-07-27T14:07:34 | 2021-07-27T14:07:34 | 371,575,399 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 527 | cpp | p1.cpp | #include<iostream>
using namespace std;
class Base{
public:
int a;
public:
Base (){}
Base(int a):a(a){}
virtual void print(){
cout<<"Base"<<a<<endl;
}
};
class Derived : public Base{
private:
int b;
public:
Derived(int a,int b):Base(a),b(b){}
void print() override{
cout<<"Derived"<<b<<a<<endl;
}
};
int main()
{
Base b(1);
Derived d(1,2);
b.print();
d.print();
Base *bp = &d;
bp->print();
//bp->b=25; // class Base cannot access derived members of Derived Class
return EXIT_SUCCESS;
} |
813db8f760f71c92c8d953e4373fd095348a9278 | ae3cfa4efab640865f49ef41e3c8881b7d83938a | /cs260A4/cs260A4/Math/Math.h | 06df3be1b3c92c99d8118641541d08e0b0745eac | [] | no_license | Yuxuannnnnnnn/CS260A4 | 07b437fb1d6525aa78c82c391b355fa5c76f789b | 5e3193e6878a8539b45845d987b39b9780dd71ea | refs/heads/main | 2023-07-28T08:23:10.236201 | 2021-09-08T13:05:27 | 2021-09-08T13:05:27 | 389,247,740 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 659 | h | Math.h | #pragma once
#include "Vector.h"
#include "Quaternion.h"
#include "Matrix.h"
#include "Color.h"
#include "Transform.h"
#include <math.h>
#include <cmath>
namespace Math
{
const float pi = 3.14159274f;
const float epsilon = 0.001f;
int Clamp(int value, int min, int max);
float Clamp(float value, float min, float max);
float Clamp01(float value);
float MoveTowards(float a, float b, float t);
float Lerp(float a, float b, float t);
int RoundDown(float value);
int RoundDownToNearest(float value, int multiple);
float RoundDownf(float value);
float RoundDownToNearestf(float value, int multiple);
int Abs(int value);
float Abs(float value);
}
|
d4b95a18ab2d94796d83f86bd36f3cd84e0d7289 | 18cd12ee83f65eacf7f251eb26ce212eac3e073a | /Results/Optimization_2_Area/keypair/syn/systemc/LowMCEnc.cpp | 45b124ca0f0bf0e1a4f9fdff008f14d822eced01 | [] | no_license | ExplosionArt/picnic_keypair_16 | 1578b4c9b547e0ec8bc319911c93649715ee7f98 | 43e49d397b3359a3cd9bb989e3632e09ff2d0f40 | refs/heads/master | 2022-07-27T11:30:40.976465 | 2020-05-20T09:25:48 | 2020-05-20T09:25:48 | 263,677,868 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 78,638 | cpp | LowMCEnc.cpp | // ==============================================================
// RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and OpenCL
// Version: 2019.2
// Copyright (C) 1986-2019 Xilinx, Inc. All Rights Reserved.
//
// ===========================================================
#include "LowMCEnc.h"
#include "AESL_pkg.h"
using namespace std;
namespace ap_rtl {
const sc_logic LowMCEnc::ap_const_logic_1 = sc_dt::Log_1;
const sc_logic LowMCEnc::ap_const_logic_0 = sc_dt::Log_0;
const sc_lv<25> LowMCEnc::ap_ST_fsm_state1 = "1";
const sc_lv<25> LowMCEnc::ap_ST_fsm_state2 = "10";
const sc_lv<25> LowMCEnc::ap_ST_fsm_state3 = "100";
const sc_lv<25> LowMCEnc::ap_ST_fsm_state4 = "1000";
const sc_lv<25> LowMCEnc::ap_ST_fsm_state5 = "10000";
const sc_lv<25> LowMCEnc::ap_ST_fsm_state6 = "100000";
const sc_lv<25> LowMCEnc::ap_ST_fsm_state7 = "1000000";
const sc_lv<25> LowMCEnc::ap_ST_fsm_state8 = "10000000";
const sc_lv<25> LowMCEnc::ap_ST_fsm_state9 = "100000000";
const sc_lv<25> LowMCEnc::ap_ST_fsm_state10 = "1000000000";
const sc_lv<25> LowMCEnc::ap_ST_fsm_state11 = "10000000000";
const sc_lv<25> LowMCEnc::ap_ST_fsm_state12 = "100000000000";
const sc_lv<25> LowMCEnc::ap_ST_fsm_state13 = "1000000000000";
const sc_lv<25> LowMCEnc::ap_ST_fsm_state14 = "10000000000000";
const sc_lv<25> LowMCEnc::ap_ST_fsm_state15 = "100000000000000";
const sc_lv<25> LowMCEnc::ap_ST_fsm_state16 = "1000000000000000";
const sc_lv<25> LowMCEnc::ap_ST_fsm_state17 = "10000000000000000";
const sc_lv<25> LowMCEnc::ap_ST_fsm_state18 = "100000000000000000";
const sc_lv<25> LowMCEnc::ap_ST_fsm_state19 = "1000000000000000000";
const sc_lv<25> LowMCEnc::ap_ST_fsm_state20 = "10000000000000000000";
const sc_lv<25> LowMCEnc::ap_ST_fsm_state21 = "100000000000000000000";
const sc_lv<25> LowMCEnc::ap_ST_fsm_state22 = "1000000000000000000000";
const sc_lv<25> LowMCEnc::ap_ST_fsm_state23 = "10000000000000000000000";
const sc_lv<25> LowMCEnc::ap_ST_fsm_state24 = "100000000000000000000000";
const sc_lv<25> LowMCEnc::ap_ST_fsm_state25 = "1000000000000000000000000";
const sc_lv<32> LowMCEnc::ap_const_lv32_0 = "00000000000000000000000000000000";
const sc_lv<32> LowMCEnc::ap_const_lv32_B = "1011";
const sc_lv<32> LowMCEnc::ap_const_lv32_11 = "10001";
const sc_lv<32> LowMCEnc::ap_const_lv32_1 = "1";
const sc_lv<1> LowMCEnc::ap_const_lv1_0 = "0";
const sc_lv<32> LowMCEnc::ap_const_lv32_4 = "100";
const sc_lv<1> LowMCEnc::ap_const_lv1_1 = "1";
const sc_lv<32> LowMCEnc::ap_const_lv32_6 = "110";
const sc_lv<32> LowMCEnc::ap_const_lv32_8 = "1000";
const sc_lv<32> LowMCEnc::ap_const_lv32_A = "1010";
const sc_lv<32> LowMCEnc::ap_const_lv32_C = "1100";
const sc_lv<32> LowMCEnc::ap_const_lv32_E = "1110";
const sc_lv<32> LowMCEnc::ap_const_lv32_13 = "10011";
const sc_lv<32> LowMCEnc::ap_const_lv32_14 = "10100";
const sc_lv<32> LowMCEnc::ap_const_lv32_15 = "10101";
const sc_lv<32> LowMCEnc::ap_const_lv32_17 = "10111";
const sc_lv<32> LowMCEnc::ap_const_lv32_2 = "10";
const sc_lv<3> LowMCEnc::ap_const_lv3_0 = "000";
const sc_lv<32> LowMCEnc::ap_const_lv32_3 = "11";
const sc_lv<32> LowMCEnc::ap_const_lv32_5 = "101";
const sc_lv<5> LowMCEnc::ap_const_lv5_1 = "1";
const sc_lv<32> LowMCEnc::ap_const_lv32_7 = "111";
const sc_lv<32> LowMCEnc::ap_const_lv32_9 = "1001";
const sc_lv<32> LowMCEnc::ap_const_lv32_10 = "10000";
const sc_lv<5> LowMCEnc::ap_const_lv5_0 = "00000";
const sc_lv<32> LowMCEnc::ap_const_lv32_16 = "10110";
const sc_lv<32> LowMCEnc::ap_const_lv32_18 = "11000";
const sc_lv<14> LowMCEnc::ap_const_lv14_0 = "00000000000000";
const sc_lv<64> LowMCEnc::ap_const_lv64_0 = "0000000000000000000000000000000000000000000000000000000000000000";
const sc_lv<64> LowMCEnc::ap_const_lv64_1 = "1";
const sc_lv<64> LowMCEnc::ap_const_lv64_2 = "10";
const sc_lv<64> LowMCEnc::ap_const_lv64_3 = "11";
const sc_lv<32> LowMCEnc::ap_const_lv32_12 = "10010";
const sc_lv<32> LowMCEnc::ap_const_lv32_D = "1101";
const sc_lv<32> LowMCEnc::ap_const_lv32_F = "1111";
const sc_lv<3> LowMCEnc::ap_const_lv3_4 = "100";
const sc_lv<3> LowMCEnc::ap_const_lv3_1 = "1";
const sc_lv<5> LowMCEnc::ap_const_lv5_15 = "10101";
const sc_lv<9> LowMCEnc::ap_const_lv9_0 = "000000000";
const sc_lv<32> LowMCEnc::ap_const_lv32_1F = "11111";
const sc_lv<5> LowMCEnc::ap_const_lv5_1E = "11110";
const sc_lv<5> LowMCEnc::ap_const_lv5_2 = "10";
const sc_lv<5> LowMCEnc::ap_const_lv5_3 = "11";
const sc_lv<3> LowMCEnc::ap_const_lv3_5 = "101";
const sc_lv<3> LowMCEnc::ap_const_lv3_6 = "110";
const sc_lv<3> LowMCEnc::ap_const_lv3_7 = "111";
const sc_lv<8> LowMCEnc::ap_const_lv8_1 = "1";
const sc_lv<8> LowMCEnc::ap_const_lv8_FF = "11111111";
const sc_lv<14> LowMCEnc::ap_const_lv14_3E00 = "11111000000000";
const sc_lv<2> LowMCEnc::ap_const_lv2_0 = "00";
const sc_lv<7> LowMCEnc::ap_const_lv7_7C = "1111100";
const bool LowMCEnc::ap_const_boolean_1 = true;
LowMCEnc::LowMCEnc(sc_module_name name) : sc_module(name), mVcdFile(0) {
temp_matrix3_U = new LowMCEnc_temp_matg8j("temp_matrix3_U");
temp_matrix3_U->clk(ap_clk);
temp_matrix3_U->reset(ap_rst);
temp_matrix3_U->address0(temp_matrix3_address0);
temp_matrix3_U->ce0(temp_matrix3_ce0);
temp_matrix3_U->q0(temp_matrix3_q0);
roundKey_U = new LowMCEnc_roundKey("roundKey_U");
roundKey_U->clk(ap_clk);
roundKey_U->reset(ap_rst);
roundKey_U->address0(roundKey_address0);
roundKey_U->ce0(roundKey_ce0);
roundKey_U->we0(roundKey_we0);
roundKey_U->d0(grp_matrix_mul_1_fu_345_output_r_d0);
roundKey_U->q0(roundKey_q0);
temp_U = new LowMCEnc_temp("temp_U");
temp_U->clk(ap_clk);
temp_U->reset(ap_rst);
temp_U->address0(temp_address0);
temp_U->ce0(temp_ce0);
temp_U->we0(temp_we0);
temp_U->d0(temp_d0);
temp_U->q0(temp_q0);
temp_U->address1(temp_address1);
temp_U->ce1(temp_ce1);
temp_U->we1(temp_we1);
temp_U->d1(temp_d1);
temp_U->q1(temp_q1);
grp_matrix_mul_fu_336 = new matrix_mul("grp_matrix_mul_fu_336");
grp_matrix_mul_fu_336->ap_clk(ap_clk);
grp_matrix_mul_fu_336->ap_rst(ap_rst);
grp_matrix_mul_fu_336->ap_start(grp_matrix_mul_fu_336_ap_start);
grp_matrix_mul_fu_336->ap_done(grp_matrix_mul_fu_336_ap_done);
grp_matrix_mul_fu_336->ap_idle(grp_matrix_mul_fu_336_ap_idle);
grp_matrix_mul_fu_336->ap_ready(grp_matrix_mul_fu_336_ap_ready);
grp_matrix_mul_fu_336->output_r_address0(grp_matrix_mul_fu_336_output_r_address0);
grp_matrix_mul_fu_336->output_r_ce0(grp_matrix_mul_fu_336_output_r_ce0);
grp_matrix_mul_fu_336->output_r_we0(grp_matrix_mul_fu_336_output_r_we0);
grp_matrix_mul_fu_336->output_r_d0(grp_matrix_mul_fu_336_output_r_d0);
grp_matrix_mul_fu_336->output_r_q0(output_r_q0);
grp_matrix_mul_fu_336->matrix_offset(add_ln225_reg_971);
grp_matrix_mul_1_fu_345 = new matrix_mul_1("grp_matrix_mul_1_fu_345");
grp_matrix_mul_1_fu_345->ap_clk(ap_clk);
grp_matrix_mul_1_fu_345->ap_rst(ap_rst);
grp_matrix_mul_1_fu_345->ap_start(grp_matrix_mul_1_fu_345_ap_start);
grp_matrix_mul_1_fu_345->ap_done(grp_matrix_mul_1_fu_345_ap_done);
grp_matrix_mul_1_fu_345->ap_idle(grp_matrix_mul_1_fu_345_ap_idle);
grp_matrix_mul_1_fu_345->ap_ready(grp_matrix_mul_1_fu_345_ap_ready);
grp_matrix_mul_1_fu_345->output_r_address0(grp_matrix_mul_1_fu_345_output_r_address0);
grp_matrix_mul_1_fu_345->output_r_ce0(grp_matrix_mul_1_fu_345_output_r_ce0);
grp_matrix_mul_1_fu_345->output_r_we0(grp_matrix_mul_1_fu_345_output_r_we0);
grp_matrix_mul_1_fu_345->output_r_d0(grp_matrix_mul_1_fu_345_output_r_d0);
grp_matrix_mul_1_fu_345->state_address0(grp_matrix_mul_1_fu_345_state_address0);
grp_matrix_mul_1_fu_345->state_ce0(grp_matrix_mul_1_fu_345_state_ce0);
grp_matrix_mul_1_fu_345->state_q0(key_q0);
grp_matrix_mul_1_fu_345->matrix_offset(grp_matrix_mul_1_fu_345_matrix_offset);
SC_METHOD(thread_ap_clk_no_reset_);
dont_initialize();
sensitive << ( ap_clk.pos() );
SC_METHOD(thread_a_fu_542_p1);
sensitive << ( lshr_ln55_fu_536_p2 );
SC_METHOD(thread_add_ln112_fu_778_p2);
sensitive << ( add_ln226_reg_976 );
sensitive << ( zext_ln112_3_fu_774_p1 );
SC_METHOD(thread_add_ln194_fu_521_p2);
sensitive << ( bitNumber_assign_2_reg_302 );
SC_METHOD(thread_add_ln200_fu_460_p2);
sensitive << ( bitNumber_assign_2_reg_302 );
SC_METHOD(thread_add_ln201_fu_485_p2);
sensitive << ( bitNumber_assign_2_reg_302 );
SC_METHOD(thread_add_ln225_fu_737_p2);
sensitive << ( shl_ln_reg_883 );
SC_METHOD(thread_add_ln226_fu_751_p2);
sensitive << ( shl_ln1_fu_743_p3 );
SC_METHOD(thread_and_ln204_fu_584_p2);
sensitive << ( b_fu_561_p1 );
sensitive << ( c_fu_580_p1 );
SC_METHOD(thread_and_ln205_fu_631_p2);
sensitive << ( a_reg_930 );
sensitive << ( c_reg_955 );
SC_METHOD(thread_and_ln206_fu_678_p2);
sensitive << ( a_reg_930 );
sensitive << ( b_reg_943 );
SC_METHOD(thread_and_ln68_1_fu_665_p2);
sensitive << ( temp_q1 );
sensitive << ( xor_ln68_3_fu_654_p2 );
SC_METHOD(thread_and_ln68_2_fu_712_p2);
sensitive << ( temp_q1 );
sensitive << ( xor_ln68_4_fu_701_p2 );
SC_METHOD(thread_and_ln68_fu_618_p2);
sensitive << ( reg_363 );
sensitive << ( xor_ln68_fu_606_p2 );
SC_METHOD(thread_ap_CS_fsm_state1);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_CS_fsm_state10);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_CS_fsm_state11);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_CS_fsm_state12);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_CS_fsm_state13);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_CS_fsm_state14);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_CS_fsm_state15);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_CS_fsm_state16);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_CS_fsm_state17);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_CS_fsm_state18);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_CS_fsm_state19);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_CS_fsm_state2);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_CS_fsm_state20);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_CS_fsm_state21);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_CS_fsm_state22);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_CS_fsm_state23);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_CS_fsm_state24);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_CS_fsm_state25);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_CS_fsm_state3);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_CS_fsm_state4);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_CS_fsm_state5);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_CS_fsm_state6);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_CS_fsm_state7);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_CS_fsm_state8);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_CS_fsm_state9);
sensitive << ( ap_CS_fsm );
SC_METHOD(thread_ap_done);
sensitive << ( ap_start );
sensitive << ( ap_CS_fsm_state1 );
sensitive << ( ap_CS_fsm_state7 );
sensitive << ( icmp_ln184_fu_402_p2 );
SC_METHOD(thread_ap_idle);
sensitive << ( ap_start );
sensitive << ( ap_CS_fsm_state1 );
SC_METHOD(thread_ap_ready);
sensitive << ( ap_CS_fsm_state7 );
sensitive << ( icmp_ln184_fu_402_p2 );
SC_METHOD(thread_b_fu_561_p1);
sensitive << ( lshr_ln55_1_fu_555_p2 );
SC_METHOD(thread_c_fu_580_p1);
sensitive << ( lshr_ln55_3_fu_574_p2 );
SC_METHOD(thread_grp_fu_356_p2);
sensitive << ( output_r_q0 );
sensitive << ( roundKey_q0 );
SC_METHOD(thread_grp_matrix_mul_1_fu_345_ap_start);
sensitive << ( grp_matrix_mul_1_fu_345_ap_start_reg );
SC_METHOD(thread_grp_matrix_mul_1_fu_345_matrix_offset);
sensitive << ( shl_ln_reg_883 );
sensitive << ( ap_CS_fsm_state4 );
sensitive << ( ap_CS_fsm_state8 );
SC_METHOD(thread_grp_matrix_mul_fu_336_ap_start);
sensitive << ( grp_matrix_mul_fu_336_ap_start_reg );
SC_METHOD(thread_i_7_fu_390_p2);
sensitive << ( i_0_i_reg_267 );
SC_METHOD(thread_i_8_fu_801_p2);
sensitive << ( i_0_i56_reg_325 );
SC_METHOD(thread_i_fu_763_p2);
sensitive << ( i_0_i49_reg_314 );
SC_METHOD(thread_icmp_ln111_1_fu_757_p2);
sensitive << ( ap_CS_fsm_state22 );
sensitive << ( i_0_i49_reg_314 );
SC_METHOD(thread_icmp_ln111_2_fu_795_p2);
sensitive << ( ap_CS_fsm_state24 );
sensitive << ( i_0_i56_reg_325 );
SC_METHOD(thread_icmp_ln111_fu_384_p2);
sensitive << ( ap_CS_fsm_state5 );
sensitive << ( i_0_i_reg_267 );
SC_METHOD(thread_icmp_ln169_fu_367_p2);
sensitive << ( ap_CS_fsm_state2 );
sensitive << ( loop_0_reg_256 );
SC_METHOD(thread_icmp_ln184_fu_402_p2);
sensitive << ( ap_CS_fsm_state7 );
sensitive << ( r_0_reg_278 );
SC_METHOD(thread_icmp_ln189_fu_417_p2);
sensitive << ( ap_CS_fsm_state9 );
sensitive << ( loop_1_reg_290 );
SC_METHOD(thread_icmp_ln194_fu_454_p2);
sensitive << ( ap_CS_fsm_state11 );
sensitive << ( bitNumber_assign_2_reg_302 );
SC_METHOD(thread_key_address0);
sensitive << ( grp_matrix_mul_1_fu_345_state_address0 );
sensitive << ( ap_CS_fsm_state4 );
sensitive << ( ap_CS_fsm_state8 );
SC_METHOD(thread_key_ce0);
sensitive << ( grp_matrix_mul_1_fu_345_state_ce0 );
sensitive << ( ap_CS_fsm_state4 );
sensitive << ( ap_CS_fsm_state8 );
SC_METHOD(thread_loop_7_fu_423_p2);
sensitive << ( loop_1_reg_290 );
SC_METHOD(thread_loop_fu_373_p2);
sensitive << ( loop_0_reg_256 );
SC_METHOD(thread_lshr_ln55_1_fu_555_p2);
sensitive << ( zext_ln55_3_fu_551_p1 );
sensitive << ( temp_q1 );
SC_METHOD(thread_lshr_ln55_2_fu_491_p4);
sensitive << ( add_ln201_fu_485_p2 );
SC_METHOD(thread_lshr_ln55_3_fu_574_p2);
sensitive << ( temp_q0 );
sensitive << ( zext_ln55_5_fu_570_p1 );
SC_METHOD(thread_lshr_ln55_4_fu_506_p4);
sensitive << ( bitNumber_assign_2_reg_302 );
SC_METHOD(thread_lshr_ln55_fu_536_p2);
sensitive << ( reg_363 );
sensitive << ( zext_ln55_1_fu_532_p1 );
SC_METHOD(thread_lshr_ln8_fu_466_p4);
sensitive << ( add_ln200_fu_460_p2 );
SC_METHOD(thread_lshr_ln_fu_439_p4);
sensitive << ( output_r_q0 );
SC_METHOD(thread_or_ln220_2_fu_725_p5);
sensitive << ( temp_q0 );
sensitive << ( reg_363 );
sensitive << ( temp_q1 );
sensitive << ( temp_load_2_reg_966 );
SC_METHOD(thread_or_ln68_1_fu_671_p2);
sensitive << ( and_ln68_1_fu_665_p2 );
sensitive << ( shl_ln68_5_fu_660_p2 );
SC_METHOD(thread_or_ln68_2_fu_718_p2);
sensitive << ( and_ln68_2_fu_712_p2 );
sensitive << ( shl_ln68_7_fu_707_p2 );
SC_METHOD(thread_output_r_address0);
sensitive << ( zext_ln170_reg_832 );
sensitive << ( ap_CS_fsm_state5 );
sensitive << ( output_addr_2_reg_850 );
sensitive << ( ap_CS_fsm_state9 );
sensitive << ( ap_CS_fsm_state21 );
sensitive << ( ap_CS_fsm_state22 );
sensitive << ( output_addr_3_reg_989 );
sensitive << ( ap_CS_fsm_state24 );
sensitive << ( output_addr_4_reg_1007 );
sensitive << ( grp_matrix_mul_fu_336_output_r_address0 );
sensitive << ( ap_CS_fsm_state3 );
sensitive << ( ap_CS_fsm_state6 );
sensitive << ( ap_CS_fsm_state10 );
sensitive << ( ap_CS_fsm_state23 );
sensitive << ( ap_CS_fsm_state25 );
sensitive << ( zext_ln112_fu_396_p1 );
sensitive << ( zext_ln112_1_fu_769_p1 );
sensitive << ( zext_ln112_2_fu_807_p1 );
sensitive << ( ap_CS_fsm_state19 );
SC_METHOD(thread_output_r_ce0);
sensitive << ( ap_CS_fsm_state5 );
sensitive << ( ap_CS_fsm_state9 );
sensitive << ( ap_CS_fsm_state21 );
sensitive << ( ap_CS_fsm_state22 );
sensitive << ( ap_CS_fsm_state24 );
sensitive << ( grp_matrix_mul_fu_336_output_r_ce0 );
sensitive << ( ap_CS_fsm_state3 );
sensitive << ( ap_CS_fsm_state6 );
sensitive << ( ap_CS_fsm_state10 );
sensitive << ( ap_CS_fsm_state23 );
sensitive << ( ap_CS_fsm_state25 );
sensitive << ( ap_CS_fsm_state19 );
SC_METHOD(thread_output_r_d0);
sensitive << ( plaintext_q0 );
sensitive << ( ap_CS_fsm_state21 );
sensitive << ( grp_matrix_mul_fu_336_output_r_d0 );
sensitive << ( ap_CS_fsm_state3 );
sensitive << ( ap_CS_fsm_state6 );
sensitive << ( ap_CS_fsm_state10 );
sensitive << ( ap_CS_fsm_state23 );
sensitive << ( ap_CS_fsm_state25 );
sensitive << ( grp_fu_356_p2 );
sensitive << ( zext_ln192_fu_449_p1 );
sensitive << ( ap_CS_fsm_state19 );
sensitive << ( or_ln220_2_fu_725_p5 );
sensitive << ( xor_ln112_1_fu_788_p2 );
SC_METHOD(thread_output_r_we0);
sensitive << ( ap_CS_fsm_state21 );
sensitive << ( grp_matrix_mul_fu_336_output_r_we0 );
sensitive << ( ap_CS_fsm_state3 );
sensitive << ( ap_CS_fsm_state6 );
sensitive << ( ap_CS_fsm_state10 );
sensitive << ( ap_CS_fsm_state23 );
sensitive << ( ap_CS_fsm_state25 );
sensitive << ( ap_CS_fsm_state19 );
SC_METHOD(thread_plaintext_address0);
sensitive << ( ap_CS_fsm_state2 );
sensitive << ( zext_ln170_fu_379_p1 );
SC_METHOD(thread_plaintext_ce0);
sensitive << ( ap_CS_fsm_state2 );
SC_METHOD(thread_r_fu_813_p2);
sensitive << ( r_0_reg_278 );
SC_METHOD(thread_roundKey_address0);
sensitive << ( ap_CS_fsm_state5 );
sensitive << ( ap_CS_fsm_state24 );
sensitive << ( grp_matrix_mul_1_fu_345_output_r_address0 );
sensitive << ( ap_CS_fsm_state4 );
sensitive << ( ap_CS_fsm_state8 );
sensitive << ( zext_ln112_fu_396_p1 );
sensitive << ( zext_ln112_2_fu_807_p1 );
SC_METHOD(thread_roundKey_ce0);
sensitive << ( ap_CS_fsm_state5 );
sensitive << ( ap_CS_fsm_state24 );
sensitive << ( grp_matrix_mul_1_fu_345_output_r_ce0 );
sensitive << ( ap_CS_fsm_state4 );
sensitive << ( ap_CS_fsm_state8 );
SC_METHOD(thread_roundKey_we0);
sensitive << ( grp_matrix_mul_1_fu_345_output_r_we0 );
sensitive << ( ap_CS_fsm_state4 );
sensitive << ( ap_CS_fsm_state8 );
SC_METHOD(thread_shl_ln1_fu_743_p3);
sensitive << ( r_0_reg_278 );
SC_METHOD(thread_shl_ln68_3_fu_612_p2);
sensitive << ( zext_ln55_1_fu_532_p1 );
sensitive << ( zext_ln204_fu_596_p1 );
SC_METHOD(thread_shl_ln68_4_fu_649_p2);
sensitive << ( zext_ln55_3_reg_937 );
SC_METHOD(thread_shl_ln68_5_fu_660_p2);
sensitive << ( zext_ln55_3_reg_937 );
sensitive << ( zext_ln205_fu_645_p1 );
SC_METHOD(thread_shl_ln68_6_fu_696_p2);
sensitive << ( zext_ln55_5_reg_949 );
SC_METHOD(thread_shl_ln68_7_fu_707_p2);
sensitive << ( zext_ln55_5_reg_949 );
sensitive << ( zext_ln206_fu_692_p1 );
SC_METHOD(thread_shl_ln68_fu_600_p2);
sensitive << ( zext_ln55_1_fu_532_p1 );
SC_METHOD(thread_shl_ln_fu_408_p3);
sensitive << ( r_0_reg_278 );
SC_METHOD(thread_sub_ln55_1_fu_546_p2);
sensitive << ( trunc_ln194_reg_906 );
SC_METHOD(thread_sub_ln55_fu_527_p2);
sensitive << ( trunc_ln194_reg_906 );
SC_METHOD(thread_temp_address0);
sensitive << ( ap_CS_fsm_state12 );
sensitive << ( ap_CS_fsm_state18 );
sensitive << ( ap_CS_fsm_state11 );
sensitive << ( icmp_ln194_fu_454_p2 );
sensitive << ( temp_addr_9_reg_913 );
sensitive << ( temp_addr_10_reg_919 );
sensitive << ( ap_CS_fsm_state15 );
sensitive << ( ap_CS_fsm_state10 );
sensitive << ( ap_CS_fsm_state17 );
sensitive << ( zext_ln191_fu_434_p1 );
sensitive << ( zext_ln55_fu_476_p1 );
sensitive << ( zext_ln55_4_fu_516_p1 );
SC_METHOD(thread_temp_address1);
sensitive << ( ap_CS_fsm_state12 );
sensitive << ( ap_CS_fsm_state18 );
sensitive << ( temp_addr_8_reg_900 );
sensitive << ( ap_CS_fsm_state11 );
sensitive << ( temp_addr_9_reg_913 );
sensitive << ( temp_addr_10_reg_919 );
sensitive << ( ap_CS_fsm_state13 );
sensitive << ( zext_ln55_2_fu_501_p1 );
sensitive << ( ap_CS_fsm_state14 );
sensitive << ( ap_CS_fsm_state16 );
SC_METHOD(thread_temp_ce0);
sensitive << ( ap_CS_fsm_state12 );
sensitive << ( ap_CS_fsm_state18 );
sensitive << ( ap_CS_fsm_state11 );
sensitive << ( icmp_ln194_fu_454_p2 );
sensitive << ( ap_CS_fsm_state15 );
sensitive << ( ap_CS_fsm_state10 );
sensitive << ( ap_CS_fsm_state17 );
SC_METHOD(thread_temp_ce1);
sensitive << ( ap_CS_fsm_state12 );
sensitive << ( ap_CS_fsm_state18 );
sensitive << ( ap_CS_fsm_state11 );
sensitive << ( ap_CS_fsm_state13 );
sensitive << ( ap_CS_fsm_state14 );
sensitive << ( ap_CS_fsm_state16 );
SC_METHOD(thread_temp_d0);
sensitive << ( ap_CS_fsm_state15 );
sensitive << ( ap_CS_fsm_state10 );
sensitive << ( ap_CS_fsm_state17 );
sensitive << ( trunc_ln191_fu_429_p1 );
sensitive << ( or_ln68_1_fu_671_p2 );
sensitive << ( or_ln68_2_fu_718_p2 );
SC_METHOD(thread_temp_d1);
sensitive << ( ap_CS_fsm_state13 );
sensitive << ( and_ln68_fu_618_p2 );
sensitive << ( shl_ln68_3_fu_612_p2 );
SC_METHOD(thread_temp_matrix3_address0);
sensitive << ( ap_CS_fsm_state22 );
sensitive << ( zext_ln112_4_fu_783_p1 );
SC_METHOD(thread_temp_matrix3_ce0);
sensitive << ( ap_CS_fsm_state22 );
SC_METHOD(thread_temp_we0);
sensitive << ( ap_CS_fsm_state15 );
sensitive << ( ap_CS_fsm_state10 );
sensitive << ( ap_CS_fsm_state17 );
SC_METHOD(thread_temp_we1);
sensitive << ( ap_CS_fsm_state13 );
SC_METHOD(thread_trunc_ln191_fu_429_p1);
sensitive << ( output_r_q0 );
SC_METHOD(thread_trunc_ln194_fu_481_p1);
sensitive << ( bitNumber_assign_2_reg_302 );
SC_METHOD(thread_xor_ln112_1_fu_788_p2);
sensitive << ( output_r_q0 );
sensitive << ( temp_matrix3_q0 );
SC_METHOD(thread_xor_ln204_fu_590_p2);
sensitive << ( a_fu_542_p1 );
sensitive << ( and_ln204_fu_584_p2 );
SC_METHOD(thread_xor_ln205_1_fu_639_p2);
sensitive << ( xor_ln205_fu_635_p2 );
sensitive << ( and_ln205_fu_631_p2 );
SC_METHOD(thread_xor_ln205_fu_635_p2);
sensitive << ( a_reg_930 );
sensitive << ( b_reg_943 );
SC_METHOD(thread_xor_ln206_1_fu_686_p2);
sensitive << ( xor_ln206_fu_682_p2 );
sensitive << ( and_ln206_fu_678_p2 );
SC_METHOD(thread_xor_ln206_fu_682_p2);
sensitive << ( c_reg_955 );
sensitive << ( xor_ln205_reg_961 );
SC_METHOD(thread_xor_ln55_fu_565_p2);
sensitive << ( trunc_ln194_reg_906 );
SC_METHOD(thread_xor_ln68_3_fu_654_p2);
sensitive << ( shl_ln68_4_fu_649_p2 );
SC_METHOD(thread_xor_ln68_4_fu_701_p2);
sensitive << ( shl_ln68_6_fu_696_p2 );
SC_METHOD(thread_xor_ln68_fu_606_p2);
sensitive << ( shl_ln68_fu_600_p2 );
SC_METHOD(thread_zext_ln112_1_fu_769_p1);
sensitive << ( i_0_i49_reg_314 );
SC_METHOD(thread_zext_ln112_2_fu_807_p1);
sensitive << ( i_0_i56_reg_325 );
SC_METHOD(thread_zext_ln112_3_fu_774_p1);
sensitive << ( i_0_i49_reg_314 );
SC_METHOD(thread_zext_ln112_4_fu_783_p1);
sensitive << ( add_ln112_fu_778_p2 );
SC_METHOD(thread_zext_ln112_fu_396_p1);
sensitive << ( i_0_i_reg_267 );
SC_METHOD(thread_zext_ln170_fu_379_p1);
sensitive << ( loop_0_reg_256 );
SC_METHOD(thread_zext_ln191_fu_434_p1);
sensitive << ( loop_1_reg_290 );
SC_METHOD(thread_zext_ln192_fu_449_p1);
sensitive << ( lshr_ln_fu_439_p4 );
SC_METHOD(thread_zext_ln204_fu_596_p1);
sensitive << ( xor_ln204_fu_590_p2 );
SC_METHOD(thread_zext_ln205_fu_645_p1);
sensitive << ( xor_ln205_1_fu_639_p2 );
SC_METHOD(thread_zext_ln206_fu_692_p1);
sensitive << ( xor_ln206_1_fu_686_p2 );
SC_METHOD(thread_zext_ln55_1_fu_532_p1);
sensitive << ( sub_ln55_fu_527_p2 );
SC_METHOD(thread_zext_ln55_2_fu_501_p1);
sensitive << ( lshr_ln55_2_fu_491_p4 );
SC_METHOD(thread_zext_ln55_3_fu_551_p1);
sensitive << ( sub_ln55_1_fu_546_p2 );
SC_METHOD(thread_zext_ln55_4_fu_516_p1);
sensitive << ( lshr_ln55_4_fu_506_p4 );
SC_METHOD(thread_zext_ln55_5_fu_570_p1);
sensitive << ( xor_ln55_fu_565_p2 );
SC_METHOD(thread_zext_ln55_fu_476_p1);
sensitive << ( lshr_ln8_fu_466_p4 );
SC_METHOD(thread_ap_NS_fsm);
sensitive << ( ap_start );
sensitive << ( ap_CS_fsm );
sensitive << ( ap_CS_fsm_state1 );
sensitive << ( ap_CS_fsm_state2 );
sensitive << ( icmp_ln169_fu_367_p2 );
sensitive << ( ap_CS_fsm_state5 );
sensitive << ( icmp_ln111_fu_384_p2 );
sensitive << ( ap_CS_fsm_state7 );
sensitive << ( icmp_ln184_fu_402_p2 );
sensitive << ( ap_CS_fsm_state9 );
sensitive << ( ap_CS_fsm_state11 );
sensitive << ( icmp_ln194_fu_454_p2 );
sensitive << ( ap_CS_fsm_state21 );
sensitive << ( grp_matrix_mul_fu_336_ap_done );
sensitive << ( ap_CS_fsm_state22 );
sensitive << ( icmp_ln111_1_fu_757_p2 );
sensitive << ( ap_CS_fsm_state24 );
sensitive << ( icmp_ln111_2_fu_795_p2 );
sensitive << ( grp_matrix_mul_1_fu_345_ap_done );
sensitive << ( ap_CS_fsm_state4 );
sensitive << ( ap_CS_fsm_state8 );
sensitive << ( icmp_ln189_fu_417_p2 );
ap_CS_fsm = "0000000000000000000000001";
grp_matrix_mul_fu_336_ap_start_reg = SC_LOGIC_0;
grp_matrix_mul_1_fu_345_ap_start_reg = SC_LOGIC_0;
static int apTFileNum = 0;
stringstream apTFilenSS;
apTFilenSS << "LowMCEnc_sc_trace_" << apTFileNum ++;
string apTFn = apTFilenSS.str();
mVcdFile = sc_create_vcd_trace_file(apTFn.c_str());
mVcdFile->set_time_unit(1, SC_PS);
if (1) {
#ifdef __HLS_TRACE_LEVEL_PORT_HIER__
sc_trace(mVcdFile, ap_clk, "(port)ap_clk");
sc_trace(mVcdFile, ap_rst, "(port)ap_rst");
sc_trace(mVcdFile, ap_start, "(port)ap_start");
sc_trace(mVcdFile, ap_done, "(port)ap_done");
sc_trace(mVcdFile, ap_idle, "(port)ap_idle");
sc_trace(mVcdFile, ap_ready, "(port)ap_ready");
sc_trace(mVcdFile, plaintext_address0, "(port)plaintext_address0");
sc_trace(mVcdFile, plaintext_ce0, "(port)plaintext_ce0");
sc_trace(mVcdFile, plaintext_q0, "(port)plaintext_q0");
sc_trace(mVcdFile, output_r_address0, "(port)output_r_address0");
sc_trace(mVcdFile, output_r_ce0, "(port)output_r_ce0");
sc_trace(mVcdFile, output_r_we0, "(port)output_r_we0");
sc_trace(mVcdFile, output_r_d0, "(port)output_r_d0");
sc_trace(mVcdFile, output_r_q0, "(port)output_r_q0");
sc_trace(mVcdFile, key_address0, "(port)key_address0");
sc_trace(mVcdFile, key_ce0, "(port)key_ce0");
sc_trace(mVcdFile, key_q0, "(port)key_q0");
#endif
#ifdef __HLS_TRACE_LEVEL_INT__
sc_trace(mVcdFile, ap_CS_fsm, "ap_CS_fsm");
sc_trace(mVcdFile, ap_CS_fsm_state1, "ap_CS_fsm_state1");
sc_trace(mVcdFile, temp_matrix3_address0, "temp_matrix3_address0");
sc_trace(mVcdFile, temp_matrix3_ce0, "temp_matrix3_ce0");
sc_trace(mVcdFile, temp_matrix3_q0, "temp_matrix3_q0");
sc_trace(mVcdFile, temp_q0, "temp_q0");
sc_trace(mVcdFile, reg_363, "reg_363");
sc_trace(mVcdFile, ap_CS_fsm_state12, "ap_CS_fsm_state12");
sc_trace(mVcdFile, ap_CS_fsm_state18, "ap_CS_fsm_state18");
sc_trace(mVcdFile, loop_fu_373_p2, "loop_fu_373_p2");
sc_trace(mVcdFile, loop_reg_827, "loop_reg_827");
sc_trace(mVcdFile, ap_CS_fsm_state2, "ap_CS_fsm_state2");
sc_trace(mVcdFile, zext_ln170_fu_379_p1, "zext_ln170_fu_379_p1");
sc_trace(mVcdFile, zext_ln170_reg_832, "zext_ln170_reg_832");
sc_trace(mVcdFile, icmp_ln169_fu_367_p2, "icmp_ln169_fu_367_p2");
sc_trace(mVcdFile, i_7_fu_390_p2, "i_7_fu_390_p2");
sc_trace(mVcdFile, i_7_reg_845, "i_7_reg_845");
sc_trace(mVcdFile, ap_CS_fsm_state5, "ap_CS_fsm_state5");
sc_trace(mVcdFile, output_addr_2_reg_850, "output_addr_2_reg_850");
sc_trace(mVcdFile, icmp_ln111_fu_384_p2, "icmp_ln111_fu_384_p2");
sc_trace(mVcdFile, shl_ln_fu_408_p3, "shl_ln_fu_408_p3");
sc_trace(mVcdFile, shl_ln_reg_883, "shl_ln_reg_883");
sc_trace(mVcdFile, ap_CS_fsm_state7, "ap_CS_fsm_state7");
sc_trace(mVcdFile, icmp_ln184_fu_402_p2, "icmp_ln184_fu_402_p2");
sc_trace(mVcdFile, loop_7_fu_423_p2, "loop_7_fu_423_p2");
sc_trace(mVcdFile, loop_7_reg_892, "loop_7_reg_892");
sc_trace(mVcdFile, ap_CS_fsm_state9, "ap_CS_fsm_state9");
sc_trace(mVcdFile, temp_addr_8_reg_900, "temp_addr_8_reg_900");
sc_trace(mVcdFile, ap_CS_fsm_state11, "ap_CS_fsm_state11");
sc_trace(mVcdFile, icmp_ln194_fu_454_p2, "icmp_ln194_fu_454_p2");
sc_trace(mVcdFile, trunc_ln194_fu_481_p1, "trunc_ln194_fu_481_p1");
sc_trace(mVcdFile, trunc_ln194_reg_906, "trunc_ln194_reg_906");
sc_trace(mVcdFile, temp_addr_9_reg_913, "temp_addr_9_reg_913");
sc_trace(mVcdFile, temp_addr_10_reg_919, "temp_addr_10_reg_919");
sc_trace(mVcdFile, add_ln194_fu_521_p2, "add_ln194_fu_521_p2");
sc_trace(mVcdFile, add_ln194_reg_925, "add_ln194_reg_925");
sc_trace(mVcdFile, a_fu_542_p1, "a_fu_542_p1");
sc_trace(mVcdFile, a_reg_930, "a_reg_930");
sc_trace(mVcdFile, ap_CS_fsm_state13, "ap_CS_fsm_state13");
sc_trace(mVcdFile, zext_ln55_3_fu_551_p1, "zext_ln55_3_fu_551_p1");
sc_trace(mVcdFile, zext_ln55_3_reg_937, "zext_ln55_3_reg_937");
sc_trace(mVcdFile, b_fu_561_p1, "b_fu_561_p1");
sc_trace(mVcdFile, b_reg_943, "b_reg_943");
sc_trace(mVcdFile, zext_ln55_5_fu_570_p1, "zext_ln55_5_fu_570_p1");
sc_trace(mVcdFile, zext_ln55_5_reg_949, "zext_ln55_5_reg_949");
sc_trace(mVcdFile, c_fu_580_p1, "c_fu_580_p1");
sc_trace(mVcdFile, c_reg_955, "c_reg_955");
sc_trace(mVcdFile, xor_ln205_fu_635_p2, "xor_ln205_fu_635_p2");
sc_trace(mVcdFile, xor_ln205_reg_961, "xor_ln205_reg_961");
sc_trace(mVcdFile, ap_CS_fsm_state15, "ap_CS_fsm_state15");
sc_trace(mVcdFile, temp_q1, "temp_q1");
sc_trace(mVcdFile, temp_load_2_reg_966, "temp_load_2_reg_966");
sc_trace(mVcdFile, add_ln225_fu_737_p2, "add_ln225_fu_737_p2");
sc_trace(mVcdFile, add_ln225_reg_971, "add_ln225_reg_971");
sc_trace(mVcdFile, ap_CS_fsm_state20, "ap_CS_fsm_state20");
sc_trace(mVcdFile, add_ln226_fu_751_p2, "add_ln226_fu_751_p2");
sc_trace(mVcdFile, add_ln226_reg_976, "add_ln226_reg_976");
sc_trace(mVcdFile, ap_CS_fsm_state21, "ap_CS_fsm_state21");
sc_trace(mVcdFile, grp_matrix_mul_fu_336_ap_ready, "grp_matrix_mul_fu_336_ap_ready");
sc_trace(mVcdFile, grp_matrix_mul_fu_336_ap_done, "grp_matrix_mul_fu_336_ap_done");
sc_trace(mVcdFile, i_fu_763_p2, "i_fu_763_p2");
sc_trace(mVcdFile, i_reg_984, "i_reg_984");
sc_trace(mVcdFile, ap_CS_fsm_state22, "ap_CS_fsm_state22");
sc_trace(mVcdFile, output_addr_3_reg_989, "output_addr_3_reg_989");
sc_trace(mVcdFile, icmp_ln111_1_fu_757_p2, "icmp_ln111_1_fu_757_p2");
sc_trace(mVcdFile, i_8_fu_801_p2, "i_8_fu_801_p2");
sc_trace(mVcdFile, i_8_reg_1002, "i_8_reg_1002");
sc_trace(mVcdFile, ap_CS_fsm_state24, "ap_CS_fsm_state24");
sc_trace(mVcdFile, output_addr_4_reg_1007, "output_addr_4_reg_1007");
sc_trace(mVcdFile, icmp_ln111_2_fu_795_p2, "icmp_ln111_2_fu_795_p2");
sc_trace(mVcdFile, r_fu_813_p2, "r_fu_813_p2");
sc_trace(mVcdFile, roundKey_address0, "roundKey_address0");
sc_trace(mVcdFile, roundKey_ce0, "roundKey_ce0");
sc_trace(mVcdFile, roundKey_we0, "roundKey_we0");
sc_trace(mVcdFile, roundKey_q0, "roundKey_q0");
sc_trace(mVcdFile, temp_address0, "temp_address0");
sc_trace(mVcdFile, temp_ce0, "temp_ce0");
sc_trace(mVcdFile, temp_we0, "temp_we0");
sc_trace(mVcdFile, temp_d0, "temp_d0");
sc_trace(mVcdFile, temp_address1, "temp_address1");
sc_trace(mVcdFile, temp_ce1, "temp_ce1");
sc_trace(mVcdFile, temp_we1, "temp_we1");
sc_trace(mVcdFile, temp_d1, "temp_d1");
sc_trace(mVcdFile, grp_matrix_mul_fu_336_ap_start, "grp_matrix_mul_fu_336_ap_start");
sc_trace(mVcdFile, grp_matrix_mul_fu_336_ap_idle, "grp_matrix_mul_fu_336_ap_idle");
sc_trace(mVcdFile, grp_matrix_mul_fu_336_output_r_address0, "grp_matrix_mul_fu_336_output_r_address0");
sc_trace(mVcdFile, grp_matrix_mul_fu_336_output_r_ce0, "grp_matrix_mul_fu_336_output_r_ce0");
sc_trace(mVcdFile, grp_matrix_mul_fu_336_output_r_we0, "grp_matrix_mul_fu_336_output_r_we0");
sc_trace(mVcdFile, grp_matrix_mul_fu_336_output_r_d0, "grp_matrix_mul_fu_336_output_r_d0");
sc_trace(mVcdFile, grp_matrix_mul_1_fu_345_ap_start, "grp_matrix_mul_1_fu_345_ap_start");
sc_trace(mVcdFile, grp_matrix_mul_1_fu_345_ap_done, "grp_matrix_mul_1_fu_345_ap_done");
sc_trace(mVcdFile, grp_matrix_mul_1_fu_345_ap_idle, "grp_matrix_mul_1_fu_345_ap_idle");
sc_trace(mVcdFile, grp_matrix_mul_1_fu_345_ap_ready, "grp_matrix_mul_1_fu_345_ap_ready");
sc_trace(mVcdFile, grp_matrix_mul_1_fu_345_output_r_address0, "grp_matrix_mul_1_fu_345_output_r_address0");
sc_trace(mVcdFile, grp_matrix_mul_1_fu_345_output_r_ce0, "grp_matrix_mul_1_fu_345_output_r_ce0");
sc_trace(mVcdFile, grp_matrix_mul_1_fu_345_output_r_we0, "grp_matrix_mul_1_fu_345_output_r_we0");
sc_trace(mVcdFile, grp_matrix_mul_1_fu_345_output_r_d0, "grp_matrix_mul_1_fu_345_output_r_d0");
sc_trace(mVcdFile, grp_matrix_mul_1_fu_345_state_address0, "grp_matrix_mul_1_fu_345_state_address0");
sc_trace(mVcdFile, grp_matrix_mul_1_fu_345_state_ce0, "grp_matrix_mul_1_fu_345_state_ce0");
sc_trace(mVcdFile, grp_matrix_mul_1_fu_345_matrix_offset, "grp_matrix_mul_1_fu_345_matrix_offset");
sc_trace(mVcdFile, loop_0_reg_256, "loop_0_reg_256");
sc_trace(mVcdFile, ap_CS_fsm_state3, "ap_CS_fsm_state3");
sc_trace(mVcdFile, i_0_i_reg_267, "i_0_i_reg_267");
sc_trace(mVcdFile, ap_CS_fsm_state4, "ap_CS_fsm_state4");
sc_trace(mVcdFile, ap_CS_fsm_state6, "ap_CS_fsm_state6");
sc_trace(mVcdFile, r_0_reg_278, "r_0_reg_278");
sc_trace(mVcdFile, loop_1_reg_290, "loop_1_reg_290");
sc_trace(mVcdFile, ap_CS_fsm_state8, "ap_CS_fsm_state8");
sc_trace(mVcdFile, ap_CS_fsm_state10, "ap_CS_fsm_state10");
sc_trace(mVcdFile, bitNumber_assign_2_reg_302, "bitNumber_assign_2_reg_302");
sc_trace(mVcdFile, ap_CS_fsm_state17, "ap_CS_fsm_state17");
sc_trace(mVcdFile, icmp_ln189_fu_417_p2, "icmp_ln189_fu_417_p2");
sc_trace(mVcdFile, i_0_i49_reg_314, "i_0_i49_reg_314");
sc_trace(mVcdFile, ap_CS_fsm_state23, "ap_CS_fsm_state23");
sc_trace(mVcdFile, i_0_i56_reg_325, "i_0_i56_reg_325");
sc_trace(mVcdFile, ap_CS_fsm_state25, "ap_CS_fsm_state25");
sc_trace(mVcdFile, grp_matrix_mul_fu_336_ap_start_reg, "grp_matrix_mul_fu_336_ap_start_reg");
sc_trace(mVcdFile, grp_matrix_mul_1_fu_345_ap_start_reg, "grp_matrix_mul_1_fu_345_ap_start_reg");
sc_trace(mVcdFile, zext_ln112_fu_396_p1, "zext_ln112_fu_396_p1");
sc_trace(mVcdFile, zext_ln191_fu_434_p1, "zext_ln191_fu_434_p1");
sc_trace(mVcdFile, zext_ln55_fu_476_p1, "zext_ln55_fu_476_p1");
sc_trace(mVcdFile, zext_ln55_2_fu_501_p1, "zext_ln55_2_fu_501_p1");
sc_trace(mVcdFile, zext_ln55_4_fu_516_p1, "zext_ln55_4_fu_516_p1");
sc_trace(mVcdFile, zext_ln112_1_fu_769_p1, "zext_ln112_1_fu_769_p1");
sc_trace(mVcdFile, zext_ln112_4_fu_783_p1, "zext_ln112_4_fu_783_p1");
sc_trace(mVcdFile, zext_ln112_2_fu_807_p1, "zext_ln112_2_fu_807_p1");
sc_trace(mVcdFile, grp_fu_356_p2, "grp_fu_356_p2");
sc_trace(mVcdFile, zext_ln192_fu_449_p1, "zext_ln192_fu_449_p1");
sc_trace(mVcdFile, ap_CS_fsm_state19, "ap_CS_fsm_state19");
sc_trace(mVcdFile, or_ln220_2_fu_725_p5, "or_ln220_2_fu_725_p5");
sc_trace(mVcdFile, xor_ln112_1_fu_788_p2, "xor_ln112_1_fu_788_p2");
sc_trace(mVcdFile, trunc_ln191_fu_429_p1, "trunc_ln191_fu_429_p1");
sc_trace(mVcdFile, ap_CS_fsm_state14, "ap_CS_fsm_state14");
sc_trace(mVcdFile, or_ln68_1_fu_671_p2, "or_ln68_1_fu_671_p2");
sc_trace(mVcdFile, ap_CS_fsm_state16, "ap_CS_fsm_state16");
sc_trace(mVcdFile, or_ln68_2_fu_718_p2, "or_ln68_2_fu_718_p2");
sc_trace(mVcdFile, lshr_ln_fu_439_p4, "lshr_ln_fu_439_p4");
sc_trace(mVcdFile, add_ln200_fu_460_p2, "add_ln200_fu_460_p2");
sc_trace(mVcdFile, lshr_ln8_fu_466_p4, "lshr_ln8_fu_466_p4");
sc_trace(mVcdFile, add_ln201_fu_485_p2, "add_ln201_fu_485_p2");
sc_trace(mVcdFile, lshr_ln55_2_fu_491_p4, "lshr_ln55_2_fu_491_p4");
sc_trace(mVcdFile, lshr_ln55_4_fu_506_p4, "lshr_ln55_4_fu_506_p4");
sc_trace(mVcdFile, sub_ln55_fu_527_p2, "sub_ln55_fu_527_p2");
sc_trace(mVcdFile, zext_ln55_1_fu_532_p1, "zext_ln55_1_fu_532_p1");
sc_trace(mVcdFile, lshr_ln55_fu_536_p2, "lshr_ln55_fu_536_p2");
sc_trace(mVcdFile, sub_ln55_1_fu_546_p2, "sub_ln55_1_fu_546_p2");
sc_trace(mVcdFile, lshr_ln55_1_fu_555_p2, "lshr_ln55_1_fu_555_p2");
sc_trace(mVcdFile, xor_ln55_fu_565_p2, "xor_ln55_fu_565_p2");
sc_trace(mVcdFile, lshr_ln55_3_fu_574_p2, "lshr_ln55_3_fu_574_p2");
sc_trace(mVcdFile, and_ln204_fu_584_p2, "and_ln204_fu_584_p2");
sc_trace(mVcdFile, xor_ln204_fu_590_p2, "xor_ln204_fu_590_p2");
sc_trace(mVcdFile, shl_ln68_fu_600_p2, "shl_ln68_fu_600_p2");
sc_trace(mVcdFile, zext_ln204_fu_596_p1, "zext_ln204_fu_596_p1");
sc_trace(mVcdFile, xor_ln68_fu_606_p2, "xor_ln68_fu_606_p2");
sc_trace(mVcdFile, and_ln68_fu_618_p2, "and_ln68_fu_618_p2");
sc_trace(mVcdFile, shl_ln68_3_fu_612_p2, "shl_ln68_3_fu_612_p2");
sc_trace(mVcdFile, and_ln205_fu_631_p2, "and_ln205_fu_631_p2");
sc_trace(mVcdFile, xor_ln205_1_fu_639_p2, "xor_ln205_1_fu_639_p2");
sc_trace(mVcdFile, shl_ln68_4_fu_649_p2, "shl_ln68_4_fu_649_p2");
sc_trace(mVcdFile, zext_ln205_fu_645_p1, "zext_ln205_fu_645_p1");
sc_trace(mVcdFile, xor_ln68_3_fu_654_p2, "xor_ln68_3_fu_654_p2");
sc_trace(mVcdFile, and_ln68_1_fu_665_p2, "and_ln68_1_fu_665_p2");
sc_trace(mVcdFile, shl_ln68_5_fu_660_p2, "shl_ln68_5_fu_660_p2");
sc_trace(mVcdFile, xor_ln206_fu_682_p2, "xor_ln206_fu_682_p2");
sc_trace(mVcdFile, and_ln206_fu_678_p2, "and_ln206_fu_678_p2");
sc_trace(mVcdFile, xor_ln206_1_fu_686_p2, "xor_ln206_1_fu_686_p2");
sc_trace(mVcdFile, shl_ln68_6_fu_696_p2, "shl_ln68_6_fu_696_p2");
sc_trace(mVcdFile, zext_ln206_fu_692_p1, "zext_ln206_fu_692_p1");
sc_trace(mVcdFile, xor_ln68_4_fu_701_p2, "xor_ln68_4_fu_701_p2");
sc_trace(mVcdFile, and_ln68_2_fu_712_p2, "and_ln68_2_fu_712_p2");
sc_trace(mVcdFile, shl_ln68_7_fu_707_p2, "shl_ln68_7_fu_707_p2");
sc_trace(mVcdFile, shl_ln1_fu_743_p3, "shl_ln1_fu_743_p3");
sc_trace(mVcdFile, zext_ln112_3_fu_774_p1, "zext_ln112_3_fu_774_p1");
sc_trace(mVcdFile, add_ln112_fu_778_p2, "add_ln112_fu_778_p2");
sc_trace(mVcdFile, ap_NS_fsm, "ap_NS_fsm");
#endif
}
}
LowMCEnc::~LowMCEnc() {
if (mVcdFile)
sc_close_vcd_trace_file(mVcdFile);
delete temp_matrix3_U;
delete roundKey_U;
delete temp_U;
delete grp_matrix_mul_fu_336;
delete grp_matrix_mul_1_fu_345;
}
void LowMCEnc::thread_ap_clk_no_reset_() {
if ( ap_rst.read() == ap_const_logic_1) {
ap_CS_fsm = ap_ST_fsm_state1;
} else {
ap_CS_fsm = ap_NS_fsm.read();
}
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state9.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_1, icmp_ln189_fu_417_p2.read()))) {
bitNumber_assign_2_reg_302 = ap_const_lv5_0;
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state17.read())) {
bitNumber_assign_2_reg_302 = add_ln194_reg_925.read();
}
if ( ap_rst.read() == ap_const_logic_1) {
grp_matrix_mul_1_fu_345_ap_start_reg = ap_const_logic_0;
} else {
if (((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state7.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, icmp_ln184_fu_402_p2.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state2.read()) &&
esl_seteq<1,1,1>(icmp_ln169_fu_367_p2.read(), ap_const_lv1_1)))) {
grp_matrix_mul_1_fu_345_ap_start_reg = ap_const_logic_1;
} else if (esl_seteq<1,1,1>(ap_const_logic_1, grp_matrix_mul_1_fu_345_ap_ready.read())) {
grp_matrix_mul_1_fu_345_ap_start_reg = ap_const_logic_0;
}
}
if ( ap_rst.read() == ap_const_logic_1) {
grp_matrix_mul_fu_336_ap_start_reg = ap_const_logic_0;
} else {
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state20.read())) {
grp_matrix_mul_fu_336_ap_start_reg = ap_const_logic_1;
} else if (esl_seteq<1,1,1>(ap_const_logic_1, grp_matrix_mul_fu_336_ap_ready.read())) {
grp_matrix_mul_fu_336_ap_start_reg = ap_const_logic_0;
}
}
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state23.read())) {
i_0_i49_reg_314 = i_reg_984.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state21.read()) &&
esl_seteq<1,1,1>(grp_matrix_mul_fu_336_ap_done.read(), ap_const_logic_1))) {
i_0_i49_reg_314 = ap_const_lv3_0;
}
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state22.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_1, icmp_ln111_1_fu_757_p2.read()))) {
i_0_i56_reg_325 = ap_const_lv3_0;
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state25.read())) {
i_0_i56_reg_325 = i_8_reg_1002.read();
}
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state6.read())) {
i_0_i_reg_267 = i_7_reg_845.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state4.read()) &&
esl_seteq<1,1,1>(grp_matrix_mul_1_fu_345_ap_done.read(), ap_const_logic_1))) {
i_0_i_reg_267 = ap_const_lv3_0;
}
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state1.read()) &&
esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_1))) {
loop_0_reg_256 = ap_const_lv3_0;
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state3.read())) {
loop_0_reg_256 = loop_reg_827.read();
}
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state10.read())) {
loop_1_reg_290 = loop_7_reg_892.read();
} else if ((esl_seteq<1,1,1>(grp_matrix_mul_1_fu_345_ap_done.read(), ap_const_logic_1) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state8.read()))) {
loop_1_reg_290 = ap_const_lv3_0;
}
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state24.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_1, icmp_ln111_2_fu_795_p2.read()))) {
r_0_reg_278 = r_fu_813_p2.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state5.read()) &&
esl_seteq<1,1,1>(icmp_ln111_fu_384_p2.read(), ap_const_lv1_1))) {
r_0_reg_278 = ap_const_lv5_1;
}
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state13.read())) {
a_reg_930 = a_fu_542_p1.read();
b_reg_943 = b_fu_561_p1.read();
c_reg_955 = c_fu_580_p1.read();
zext_ln55_3_reg_937 = zext_ln55_3_fu_551_p1.read();
zext_ln55_5_reg_949 = zext_ln55_5_fu_570_p1.read();
}
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state12.read())) {
add_ln194_reg_925 = add_ln194_fu_521_p2.read();
temp_addr_10_reg_919 = (sc_lv<7>) (zext_ln55_4_fu_516_p1.read());
temp_addr_9_reg_913 = (sc_lv<7>) (zext_ln55_2_fu_501_p1.read());
trunc_ln194_reg_906 = trunc_ln194_fu_481_p1.read();
}
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state20.read())) {
add_ln225_reg_971 = add_ln225_fu_737_p2.read();
}
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state21.read()) && esl_seteq<1,1,1>(grp_matrix_mul_fu_336_ap_done.read(), ap_const_logic_1))) {
add_ln226_reg_976 = add_ln226_fu_751_p2.read();
}
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state5.read())) {
i_7_reg_845 = i_7_fu_390_p2.read();
}
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state24.read())) {
i_8_reg_1002 = i_8_fu_801_p2.read();
}
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state22.read())) {
i_reg_984 = i_fu_763_p2.read();
}
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state9.read())) {
loop_7_reg_892 = loop_7_fu_423_p2.read();
}
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state2.read())) {
loop_reg_827 = loop_fu_373_p2.read();
}
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state5.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, icmp_ln111_fu_384_p2.read()))) {
output_addr_2_reg_850 = (sc_lv<3>) (zext_ln112_fu_396_p1.read());
}
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state22.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, icmp_ln111_1_fu_757_p2.read()))) {
output_addr_3_reg_989 = (sc_lv<3>) (zext_ln112_1_fu_769_p1.read());
}
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state24.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, icmp_ln111_2_fu_795_p2.read()))) {
output_addr_4_reg_1007 = (sc_lv<3>) (zext_ln112_2_fu_807_p1.read());
}
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state12.read()) || esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state18.read()))) {
reg_363 = temp_q0.read();
}
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state7.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, icmp_ln184_fu_402_p2.read()))) {
shl_ln_reg_883 = shl_ln_fu_408_p3.read();
}
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state11.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, icmp_ln194_fu_454_p2.read()))) {
temp_addr_8_reg_900 = (sc_lv<7>) (zext_ln55_fu_476_p1.read());
}
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state18.read())) {
temp_load_2_reg_966 = temp_q1.read();
}
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state15.read())) {
xor_ln205_reg_961 = xor_ln205_fu_635_p2.read();
}
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state2.read()) && esl_seteq<1,1,1>(icmp_ln169_fu_367_p2.read(), ap_const_lv1_0))) {
zext_ln170_reg_832 = zext_ln170_fu_379_p1.read();
}
}
void LowMCEnc::thread_a_fu_542_p1() {
a_fu_542_p1 = lshr_ln55_fu_536_p2.read().range(1-1, 0);
}
void LowMCEnc::thread_add_ln112_fu_778_p2() {
add_ln112_fu_778_p2 = (!zext_ln112_3_fu_774_p1.read().is_01() || !add_ln226_reg_976.read().is_01())? sc_lv<7>(): (sc_biguint<7>(zext_ln112_3_fu_774_p1.read()) + sc_biguint<7>(add_ln226_reg_976.read()));
}
void LowMCEnc::thread_add_ln194_fu_521_p2() {
add_ln194_fu_521_p2 = (!ap_const_lv5_3.is_01() || !bitNumber_assign_2_reg_302.read().is_01())? sc_lv<5>(): (sc_biguint<5>(ap_const_lv5_3) + sc_biguint<5>(bitNumber_assign_2_reg_302.read()));
}
void LowMCEnc::thread_add_ln200_fu_460_p2() {
add_ln200_fu_460_p2 = (!ap_const_lv5_2.is_01() || !bitNumber_assign_2_reg_302.read().is_01())? sc_lv<5>(): (sc_biguint<5>(ap_const_lv5_2) + sc_biguint<5>(bitNumber_assign_2_reg_302.read()));
}
void LowMCEnc::thread_add_ln201_fu_485_p2() {
add_ln201_fu_485_p2 = (!ap_const_lv5_1.is_01() || !bitNumber_assign_2_reg_302.read().is_01())? sc_lv<5>(): (sc_biguint<5>(ap_const_lv5_1) + sc_biguint<5>(bitNumber_assign_2_reg_302.read()));
}
void LowMCEnc::thread_add_ln225_fu_737_p2() {
add_ln225_fu_737_p2 = (!shl_ln_reg_883.read().is_01() || !ap_const_lv14_3E00.is_01())? sc_lv<14>(): (sc_biguint<14>(shl_ln_reg_883.read()) + sc_bigint<14>(ap_const_lv14_3E00));
}
void LowMCEnc::thread_add_ln226_fu_751_p2() {
add_ln226_fu_751_p2 = (!shl_ln1_fu_743_p3.read().is_01() || !ap_const_lv7_7C.is_01())? sc_lv<7>(): (sc_biguint<7>(shl_ln1_fu_743_p3.read()) + sc_bigint<7>(ap_const_lv7_7C));
}
void LowMCEnc::thread_and_ln204_fu_584_p2() {
and_ln204_fu_584_p2 = (c_fu_580_p1.read() & b_fu_561_p1.read());
}
void LowMCEnc::thread_and_ln205_fu_631_p2() {
and_ln205_fu_631_p2 = (c_reg_955.read() & a_reg_930.read());
}
void LowMCEnc::thread_and_ln206_fu_678_p2() {
and_ln206_fu_678_p2 = (b_reg_943.read() & a_reg_930.read());
}
void LowMCEnc::thread_and_ln68_1_fu_665_p2() {
and_ln68_1_fu_665_p2 = (temp_q1.read() & xor_ln68_3_fu_654_p2.read());
}
void LowMCEnc::thread_and_ln68_2_fu_712_p2() {
and_ln68_2_fu_712_p2 = (temp_q1.read() & xor_ln68_4_fu_701_p2.read());
}
void LowMCEnc::thread_and_ln68_fu_618_p2() {
and_ln68_fu_618_p2 = (reg_363.read() & xor_ln68_fu_606_p2.read());
}
void LowMCEnc::thread_ap_CS_fsm_state1() {
ap_CS_fsm_state1 = ap_CS_fsm.read()[0];
}
void LowMCEnc::thread_ap_CS_fsm_state10() {
ap_CS_fsm_state10 = ap_CS_fsm.read()[9];
}
void LowMCEnc::thread_ap_CS_fsm_state11() {
ap_CS_fsm_state11 = ap_CS_fsm.read()[10];
}
void LowMCEnc::thread_ap_CS_fsm_state12() {
ap_CS_fsm_state12 = ap_CS_fsm.read()[11];
}
void LowMCEnc::thread_ap_CS_fsm_state13() {
ap_CS_fsm_state13 = ap_CS_fsm.read()[12];
}
void LowMCEnc::thread_ap_CS_fsm_state14() {
ap_CS_fsm_state14 = ap_CS_fsm.read()[13];
}
void LowMCEnc::thread_ap_CS_fsm_state15() {
ap_CS_fsm_state15 = ap_CS_fsm.read()[14];
}
void LowMCEnc::thread_ap_CS_fsm_state16() {
ap_CS_fsm_state16 = ap_CS_fsm.read()[15];
}
void LowMCEnc::thread_ap_CS_fsm_state17() {
ap_CS_fsm_state17 = ap_CS_fsm.read()[16];
}
void LowMCEnc::thread_ap_CS_fsm_state18() {
ap_CS_fsm_state18 = ap_CS_fsm.read()[17];
}
void LowMCEnc::thread_ap_CS_fsm_state19() {
ap_CS_fsm_state19 = ap_CS_fsm.read()[18];
}
void LowMCEnc::thread_ap_CS_fsm_state2() {
ap_CS_fsm_state2 = ap_CS_fsm.read()[1];
}
void LowMCEnc::thread_ap_CS_fsm_state20() {
ap_CS_fsm_state20 = ap_CS_fsm.read()[19];
}
void LowMCEnc::thread_ap_CS_fsm_state21() {
ap_CS_fsm_state21 = ap_CS_fsm.read()[20];
}
void LowMCEnc::thread_ap_CS_fsm_state22() {
ap_CS_fsm_state22 = ap_CS_fsm.read()[21];
}
void LowMCEnc::thread_ap_CS_fsm_state23() {
ap_CS_fsm_state23 = ap_CS_fsm.read()[22];
}
void LowMCEnc::thread_ap_CS_fsm_state24() {
ap_CS_fsm_state24 = ap_CS_fsm.read()[23];
}
void LowMCEnc::thread_ap_CS_fsm_state25() {
ap_CS_fsm_state25 = ap_CS_fsm.read()[24];
}
void LowMCEnc::thread_ap_CS_fsm_state3() {
ap_CS_fsm_state3 = ap_CS_fsm.read()[2];
}
void LowMCEnc::thread_ap_CS_fsm_state4() {
ap_CS_fsm_state4 = ap_CS_fsm.read()[3];
}
void LowMCEnc::thread_ap_CS_fsm_state5() {
ap_CS_fsm_state5 = ap_CS_fsm.read()[4];
}
void LowMCEnc::thread_ap_CS_fsm_state6() {
ap_CS_fsm_state6 = ap_CS_fsm.read()[5];
}
void LowMCEnc::thread_ap_CS_fsm_state7() {
ap_CS_fsm_state7 = ap_CS_fsm.read()[6];
}
void LowMCEnc::thread_ap_CS_fsm_state8() {
ap_CS_fsm_state8 = ap_CS_fsm.read()[7];
}
void LowMCEnc::thread_ap_CS_fsm_state9() {
ap_CS_fsm_state9 = ap_CS_fsm.read()[8];
}
void LowMCEnc::thread_ap_done() {
if (((esl_seteq<1,1,1>(ap_const_logic_0, ap_start.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state1.read())) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state7.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_1, icmp_ln184_fu_402_p2.read())))) {
ap_done = ap_const_logic_1;
} else {
ap_done = ap_const_logic_0;
}
}
void LowMCEnc::thread_ap_idle() {
if ((esl_seteq<1,1,1>(ap_const_logic_0, ap_start.read()) &&
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state1.read()))) {
ap_idle = ap_const_logic_1;
} else {
ap_idle = ap_const_logic_0;
}
}
void LowMCEnc::thread_ap_ready() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state7.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_1, icmp_ln184_fu_402_p2.read()))) {
ap_ready = ap_const_logic_1;
} else {
ap_ready = ap_const_logic_0;
}
}
void LowMCEnc::thread_b_fu_561_p1() {
b_fu_561_p1 = lshr_ln55_1_fu_555_p2.read().range(1-1, 0);
}
void LowMCEnc::thread_c_fu_580_p1() {
c_fu_580_p1 = lshr_ln55_3_fu_574_p2.read().range(1-1, 0);
}
void LowMCEnc::thread_grp_fu_356_p2() {
grp_fu_356_p2 = (roundKey_q0.read() ^ output_r_q0.read());
}
void LowMCEnc::thread_grp_matrix_mul_1_fu_345_ap_start() {
grp_matrix_mul_1_fu_345_ap_start = grp_matrix_mul_1_fu_345_ap_start_reg.read();
}
void LowMCEnc::thread_grp_matrix_mul_1_fu_345_matrix_offset() {
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state8.read())) {
grp_matrix_mul_1_fu_345_matrix_offset = shl_ln_reg_883.read();
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state4.read())) {
grp_matrix_mul_1_fu_345_matrix_offset = ap_const_lv14_0;
} else {
grp_matrix_mul_1_fu_345_matrix_offset = "XXXXXXXXXXXXXX";
}
}
void LowMCEnc::thread_grp_matrix_mul_fu_336_ap_start() {
grp_matrix_mul_fu_336_ap_start = grp_matrix_mul_fu_336_ap_start_reg.read();
}
void LowMCEnc::thread_i_7_fu_390_p2() {
i_7_fu_390_p2 = (!i_0_i_reg_267.read().is_01() || !ap_const_lv3_1.is_01())? sc_lv<3>(): (sc_biguint<3>(i_0_i_reg_267.read()) + sc_biguint<3>(ap_const_lv3_1));
}
void LowMCEnc::thread_i_8_fu_801_p2() {
i_8_fu_801_p2 = (!i_0_i56_reg_325.read().is_01() || !ap_const_lv3_1.is_01())? sc_lv<3>(): (sc_biguint<3>(i_0_i56_reg_325.read()) + sc_biguint<3>(ap_const_lv3_1));
}
void LowMCEnc::thread_i_fu_763_p2() {
i_fu_763_p2 = (!i_0_i49_reg_314.read().is_01() || !ap_const_lv3_1.is_01())? sc_lv<3>(): (sc_biguint<3>(i_0_i49_reg_314.read()) + sc_biguint<3>(ap_const_lv3_1));
}
void LowMCEnc::thread_icmp_ln111_1_fu_757_p2() {
icmp_ln111_1_fu_757_p2 = (!i_0_i49_reg_314.read().is_01() || !ap_const_lv3_4.is_01())? sc_lv<1>(): sc_lv<1>(i_0_i49_reg_314.read() == ap_const_lv3_4);
}
void LowMCEnc::thread_icmp_ln111_2_fu_795_p2() {
icmp_ln111_2_fu_795_p2 = (!i_0_i56_reg_325.read().is_01() || !ap_const_lv3_4.is_01())? sc_lv<1>(): sc_lv<1>(i_0_i56_reg_325.read() == ap_const_lv3_4);
}
void LowMCEnc::thread_icmp_ln111_fu_384_p2() {
icmp_ln111_fu_384_p2 = (!i_0_i_reg_267.read().is_01() || !ap_const_lv3_4.is_01())? sc_lv<1>(): sc_lv<1>(i_0_i_reg_267.read() == ap_const_lv3_4);
}
void LowMCEnc::thread_icmp_ln169_fu_367_p2() {
icmp_ln169_fu_367_p2 = (!loop_0_reg_256.read().is_01() || !ap_const_lv3_4.is_01())? sc_lv<1>(): sc_lv<1>(loop_0_reg_256.read() == ap_const_lv3_4);
}
void LowMCEnc::thread_icmp_ln184_fu_402_p2() {
icmp_ln184_fu_402_p2 = (!r_0_reg_278.read().is_01() || !ap_const_lv5_15.is_01())? sc_lv<1>(): sc_lv<1>(r_0_reg_278.read() == ap_const_lv5_15);
}
void LowMCEnc::thread_icmp_ln189_fu_417_p2() {
icmp_ln189_fu_417_p2 = (!loop_1_reg_290.read().is_01() || !ap_const_lv3_4.is_01())? sc_lv<1>(): sc_lv<1>(loop_1_reg_290.read() == ap_const_lv3_4);
}
void LowMCEnc::thread_icmp_ln194_fu_454_p2() {
icmp_ln194_fu_454_p2 = (!bitNumber_assign_2_reg_302.read().is_01() || !ap_const_lv5_1E.is_01())? sc_lv<1>(): (sc_biguint<5>(bitNumber_assign_2_reg_302.read()) < sc_biguint<5>(ap_const_lv5_1E));
}
void LowMCEnc::thread_key_address0() {
key_address0 = grp_matrix_mul_1_fu_345_state_address0.read();
}
void LowMCEnc::thread_key_ce0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state4.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state8.read()))) {
key_ce0 = grp_matrix_mul_1_fu_345_state_ce0.read();
} else {
key_ce0 = ap_const_logic_0;
}
}
void LowMCEnc::thread_loop_7_fu_423_p2() {
loop_7_fu_423_p2 = (!loop_1_reg_290.read().is_01() || !ap_const_lv3_1.is_01())? sc_lv<3>(): (sc_biguint<3>(loop_1_reg_290.read()) + sc_biguint<3>(ap_const_lv3_1));
}
void LowMCEnc::thread_loop_fu_373_p2() {
loop_fu_373_p2 = (!loop_0_reg_256.read().is_01() || !ap_const_lv3_1.is_01())? sc_lv<3>(): (sc_biguint<3>(loop_0_reg_256.read()) + sc_biguint<3>(ap_const_lv3_1));
}
void LowMCEnc::thread_lshr_ln55_1_fu_555_p2() {
lshr_ln55_1_fu_555_p2 = (!zext_ln55_3_fu_551_p1.read().is_01())? sc_lv<8>(): temp_q1.read() >> (unsigned short)zext_ln55_3_fu_551_p1.read().to_uint();
}
void LowMCEnc::thread_lshr_ln55_2_fu_491_p4() {
lshr_ln55_2_fu_491_p4 = add_ln201_fu_485_p2.read().range(4, 3);
}
void LowMCEnc::thread_lshr_ln55_3_fu_574_p2() {
lshr_ln55_3_fu_574_p2 = (!zext_ln55_5_fu_570_p1.read().is_01())? sc_lv<8>(): temp_q0.read() >> (unsigned short)zext_ln55_5_fu_570_p1.read().to_uint();
}
void LowMCEnc::thread_lshr_ln55_4_fu_506_p4() {
lshr_ln55_4_fu_506_p4 = bitNumber_assign_2_reg_302.read().range(4, 3);
}
void LowMCEnc::thread_lshr_ln55_fu_536_p2() {
lshr_ln55_fu_536_p2 = (!zext_ln55_1_fu_532_p1.read().is_01())? sc_lv<8>(): reg_363.read() >> (unsigned short)zext_ln55_1_fu_532_p1.read().to_uint();
}
void LowMCEnc::thread_lshr_ln8_fu_466_p4() {
lshr_ln8_fu_466_p4 = add_ln200_fu_460_p2.read().range(4, 3);
}
void LowMCEnc::thread_lshr_ln_fu_439_p4() {
lshr_ln_fu_439_p4 = output_r_q0.read().range(31, 8);
}
void LowMCEnc::thread_or_ln220_2_fu_725_p5() {
or_ln220_2_fu_725_p5 = esl_concat<24,8>(esl_concat<16,8>(esl_concat<8,8>(temp_q0.read(), temp_q1.read()), temp_load_2_reg_966.read()), reg_363.read());
}
void LowMCEnc::thread_or_ln68_1_fu_671_p2() {
or_ln68_1_fu_671_p2 = (and_ln68_1_fu_665_p2.read() | shl_ln68_5_fu_660_p2.read());
}
void LowMCEnc::thread_or_ln68_2_fu_718_p2() {
or_ln68_2_fu_718_p2 = (and_ln68_2_fu_712_p2.read() | shl_ln68_7_fu_707_p2.read());
}
void LowMCEnc::thread_output_r_address0() {
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state25.read())) {
output_r_address0 = output_addr_4_reg_1007.read();
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state24.read())) {
output_r_address0 = (sc_lv<3>) (zext_ln112_2_fu_807_p1.read());
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state23.read())) {
output_r_address0 = output_addr_3_reg_989.read();
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state22.read())) {
output_r_address0 = (sc_lv<3>) (zext_ln112_1_fu_769_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state9.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state10.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state19.read()))) {
output_r_address0 = (sc_lv<3>) (ap_const_lv64_0);
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state6.read())) {
output_r_address0 = output_addr_2_reg_850.read();
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state5.read())) {
output_r_address0 = (sc_lv<3>) (zext_ln112_fu_396_p1.read());
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state3.read())) {
output_r_address0 = (sc_lv<3>) (zext_ln170_reg_832.read());
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state21.read())) {
output_r_address0 = grp_matrix_mul_fu_336_output_r_address0.read();
} else {
output_r_address0 = (sc_lv<3>) ("XXX");
}
}
void LowMCEnc::thread_output_r_ce0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state5.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state9.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state22.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state24.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state3.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state6.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state10.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state23.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state25.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state19.read()))) {
output_r_ce0 = ap_const_logic_1;
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state21.read())) {
output_r_ce0 = grp_matrix_mul_fu_336_output_r_ce0.read();
} else {
output_r_ce0 = ap_const_logic_0;
}
}
void LowMCEnc::thread_output_r_d0() {
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state23.read())) {
output_r_d0 = xor_ln112_1_fu_788_p2.read();
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state19.read())) {
output_r_d0 = or_ln220_2_fu_725_p5.read();
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state10.read())) {
output_r_d0 = zext_ln192_fu_449_p1.read();
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state6.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state25.read()))) {
output_r_d0 = grp_fu_356_p2.read();
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state3.read())) {
output_r_d0 = plaintext_q0.read();
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state21.read())) {
output_r_d0 = grp_matrix_mul_fu_336_output_r_d0.read();
} else {
output_r_d0 = (sc_lv<32>) ("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
}
}
void LowMCEnc::thread_output_r_we0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state3.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state6.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state10.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state23.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state25.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state19.read()))) {
output_r_we0 = ap_const_logic_1;
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state21.read())) {
output_r_we0 = grp_matrix_mul_fu_336_output_r_we0.read();
} else {
output_r_we0 = ap_const_logic_0;
}
}
void LowMCEnc::thread_plaintext_address0() {
plaintext_address0 = (sc_lv<3>) (zext_ln170_fu_379_p1.read());
}
void LowMCEnc::thread_plaintext_ce0() {
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state2.read())) {
plaintext_ce0 = ap_const_logic_1;
} else {
plaintext_ce0 = ap_const_logic_0;
}
}
void LowMCEnc::thread_r_fu_813_p2() {
r_fu_813_p2 = (!r_0_reg_278.read().is_01() || !ap_const_lv5_1.is_01())? sc_lv<5>(): (sc_biguint<5>(r_0_reg_278.read()) + sc_biguint<5>(ap_const_lv5_1));
}
void LowMCEnc::thread_roundKey_address0() {
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state24.read())) {
roundKey_address0 = (sc_lv<4>) (zext_ln112_2_fu_807_p1.read());
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state5.read())) {
roundKey_address0 = (sc_lv<4>) (zext_ln112_fu_396_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state4.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state8.read()))) {
roundKey_address0 = grp_matrix_mul_1_fu_345_output_r_address0.read();
} else {
roundKey_address0 = (sc_lv<4>) ("XXXX");
}
}
void LowMCEnc::thread_roundKey_ce0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state5.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state24.read()))) {
roundKey_ce0 = ap_const_logic_1;
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state4.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state8.read()))) {
roundKey_ce0 = grp_matrix_mul_1_fu_345_output_r_ce0.read();
} else {
roundKey_ce0 = ap_const_logic_0;
}
}
void LowMCEnc::thread_roundKey_we0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state4.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state8.read()))) {
roundKey_we0 = grp_matrix_mul_1_fu_345_output_r_we0.read();
} else {
roundKey_we0 = ap_const_logic_0;
}
}
void LowMCEnc::thread_shl_ln1_fu_743_p3() {
shl_ln1_fu_743_p3 = esl_concat<5,2>(r_0_reg_278.read(), ap_const_lv2_0);
}
void LowMCEnc::thread_shl_ln68_3_fu_612_p2() {
shl_ln68_3_fu_612_p2 = (!zext_ln55_1_fu_532_p1.read().is_01())? sc_lv<8>(): zext_ln204_fu_596_p1.read() << (unsigned short)zext_ln55_1_fu_532_p1.read().to_uint();
}
void LowMCEnc::thread_shl_ln68_4_fu_649_p2() {
shl_ln68_4_fu_649_p2 = (!zext_ln55_3_reg_937.read().is_01())? sc_lv<8>(): ap_const_lv8_1 << (unsigned short)zext_ln55_3_reg_937.read().to_uint();
}
void LowMCEnc::thread_shl_ln68_5_fu_660_p2() {
shl_ln68_5_fu_660_p2 = (!zext_ln55_3_reg_937.read().is_01())? sc_lv<8>(): zext_ln205_fu_645_p1.read() << (unsigned short)zext_ln55_3_reg_937.read().to_uint();
}
void LowMCEnc::thread_shl_ln68_6_fu_696_p2() {
shl_ln68_6_fu_696_p2 = (!zext_ln55_5_reg_949.read().is_01())? sc_lv<8>(): ap_const_lv8_1 << (unsigned short)zext_ln55_5_reg_949.read().to_uint();
}
void LowMCEnc::thread_shl_ln68_7_fu_707_p2() {
shl_ln68_7_fu_707_p2 = (!zext_ln55_5_reg_949.read().is_01())? sc_lv<8>(): zext_ln206_fu_692_p1.read() << (unsigned short)zext_ln55_5_reg_949.read().to_uint();
}
void LowMCEnc::thread_shl_ln68_fu_600_p2() {
shl_ln68_fu_600_p2 = (!zext_ln55_1_fu_532_p1.read().is_01())? sc_lv<8>(): ap_const_lv8_1 << (unsigned short)zext_ln55_1_fu_532_p1.read().to_uint();
}
void LowMCEnc::thread_shl_ln_fu_408_p3() {
shl_ln_fu_408_p3 = esl_concat<5,9>(r_0_reg_278.read(), ap_const_lv9_0);
}
void LowMCEnc::thread_sub_ln55_1_fu_546_p2() {
sub_ln55_1_fu_546_p2 = (!ap_const_lv3_6.is_01() || !trunc_ln194_reg_906.read().is_01())? sc_lv<3>(): (sc_bigint<3>(ap_const_lv3_6) - sc_biguint<3>(trunc_ln194_reg_906.read()));
}
void LowMCEnc::thread_sub_ln55_fu_527_p2() {
sub_ln55_fu_527_p2 = (!ap_const_lv3_5.is_01() || !trunc_ln194_reg_906.read().is_01())? sc_lv<3>(): (sc_bigint<3>(ap_const_lv3_5) - sc_biguint<3>(trunc_ln194_reg_906.read()));
}
void LowMCEnc::thread_temp_address0() {
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state18.read())) {
temp_address0 = (sc_lv<7>) (ap_const_lv64_3);
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state17.read())) {
temp_address0 = temp_addr_10_reg_919.read();
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state15.read())) {
temp_address0 = temp_addr_9_reg_913.read();
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state12.read())) {
temp_address0 = (sc_lv<7>) (zext_ln55_4_fu_516_p1.read());
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state11.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, icmp_ln194_fu_454_p2.read()))) {
temp_address0 = (sc_lv<7>) (ap_const_lv64_0);
} else if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state11.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_1, icmp_ln194_fu_454_p2.read()))) {
temp_address0 = (sc_lv<7>) (zext_ln55_fu_476_p1.read());
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state10.read())) {
temp_address0 = (sc_lv<7>) (zext_ln191_fu_434_p1.read());
} else {
temp_address0 = (sc_lv<7>) ("XXXXXXX");
}
}
void LowMCEnc::thread_temp_address1() {
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state18.read())) {
temp_address1 = (sc_lv<7>) (ap_const_lv64_2);
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state16.read())) {
temp_address1 = temp_addr_10_reg_919.read();
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state14.read())) {
temp_address1 = temp_addr_9_reg_913.read();
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state13.read())) {
temp_address1 = temp_addr_8_reg_900.read();
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state12.read())) {
temp_address1 = (sc_lv<7>) (zext_ln55_2_fu_501_p1.read());
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state11.read())) {
temp_address1 = (sc_lv<7>) (ap_const_lv64_1);
} else {
temp_address1 = (sc_lv<7>) ("XXXXXXX");
}
}
void LowMCEnc::thread_temp_ce0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state12.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state18.read()) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state11.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_1, icmp_ln194_fu_454_p2.read())) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state15.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state10.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state17.read()) ||
(esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state11.read()) &&
esl_seteq<1,1,1>(ap_const_lv1_0, icmp_ln194_fu_454_p2.read())))) {
temp_ce0 = ap_const_logic_1;
} else {
temp_ce0 = ap_const_logic_0;
}
}
void LowMCEnc::thread_temp_ce1() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state12.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state18.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state11.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state13.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state14.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state16.read()))) {
temp_ce1 = ap_const_logic_1;
} else {
temp_ce1 = ap_const_logic_0;
}
}
void LowMCEnc::thread_temp_d0() {
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state17.read())) {
temp_d0 = or_ln68_2_fu_718_p2.read();
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state15.read())) {
temp_d0 = or_ln68_1_fu_671_p2.read();
} else if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state10.read())) {
temp_d0 = trunc_ln191_fu_429_p1.read();
} else {
temp_d0 = (sc_lv<8>) ("XXXXXXXX");
}
}
void LowMCEnc::thread_temp_d1() {
temp_d1 = (and_ln68_fu_618_p2.read() | shl_ln68_3_fu_612_p2.read());
}
void LowMCEnc::thread_temp_matrix3_address0() {
temp_matrix3_address0 = (sc_lv<7>) (zext_ln112_4_fu_783_p1.read());
}
void LowMCEnc::thread_temp_matrix3_ce0() {
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state22.read())) {
temp_matrix3_ce0 = ap_const_logic_1;
} else {
temp_matrix3_ce0 = ap_const_logic_0;
}
}
void LowMCEnc::thread_temp_we0() {
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state15.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state10.read()) ||
esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state17.read()))) {
temp_we0 = ap_const_logic_1;
} else {
temp_we0 = ap_const_logic_0;
}
}
void LowMCEnc::thread_temp_we1() {
if (esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state13.read())) {
temp_we1 = ap_const_logic_1;
} else {
temp_we1 = ap_const_logic_0;
}
}
void LowMCEnc::thread_trunc_ln191_fu_429_p1() {
trunc_ln191_fu_429_p1 = output_r_q0.read().range(8-1, 0);
}
void LowMCEnc::thread_trunc_ln194_fu_481_p1() {
trunc_ln194_fu_481_p1 = bitNumber_assign_2_reg_302.read().range(3-1, 0);
}
void LowMCEnc::thread_xor_ln112_1_fu_788_p2() {
xor_ln112_1_fu_788_p2 = (temp_matrix3_q0.read() ^ output_r_q0.read());
}
void LowMCEnc::thread_xor_ln204_fu_590_p2() {
xor_ln204_fu_590_p2 = (and_ln204_fu_584_p2.read() ^ a_fu_542_p1.read());
}
void LowMCEnc::thread_xor_ln205_1_fu_639_p2() {
xor_ln205_1_fu_639_p2 = (and_ln205_fu_631_p2.read() ^ xor_ln205_fu_635_p2.read());
}
void LowMCEnc::thread_xor_ln205_fu_635_p2() {
xor_ln205_fu_635_p2 = (b_reg_943.read() ^ a_reg_930.read());
}
void LowMCEnc::thread_xor_ln206_1_fu_686_p2() {
xor_ln206_1_fu_686_p2 = (xor_ln206_fu_682_p2.read() ^ and_ln206_fu_678_p2.read());
}
void LowMCEnc::thread_xor_ln206_fu_682_p2() {
xor_ln206_fu_682_p2 = (c_reg_955.read() ^ xor_ln205_reg_961.read());
}
void LowMCEnc::thread_xor_ln55_fu_565_p2() {
xor_ln55_fu_565_p2 = (trunc_ln194_reg_906.read() ^ ap_const_lv3_7);
}
void LowMCEnc::thread_xor_ln68_3_fu_654_p2() {
xor_ln68_3_fu_654_p2 = (shl_ln68_4_fu_649_p2.read() ^ ap_const_lv8_FF);
}
void LowMCEnc::thread_xor_ln68_4_fu_701_p2() {
xor_ln68_4_fu_701_p2 = (shl_ln68_6_fu_696_p2.read() ^ ap_const_lv8_FF);
}
void LowMCEnc::thread_xor_ln68_fu_606_p2() {
xor_ln68_fu_606_p2 = (shl_ln68_fu_600_p2.read() ^ ap_const_lv8_FF);
}
void LowMCEnc::thread_zext_ln112_1_fu_769_p1() {
zext_ln112_1_fu_769_p1 = esl_zext<64,3>(i_0_i49_reg_314.read());
}
void LowMCEnc::thread_zext_ln112_2_fu_807_p1() {
zext_ln112_2_fu_807_p1 = esl_zext<64,3>(i_0_i56_reg_325.read());
}
void LowMCEnc::thread_zext_ln112_3_fu_774_p1() {
zext_ln112_3_fu_774_p1 = esl_zext<7,3>(i_0_i49_reg_314.read());
}
void LowMCEnc::thread_zext_ln112_4_fu_783_p1() {
zext_ln112_4_fu_783_p1 = esl_zext<64,7>(add_ln112_fu_778_p2.read());
}
void LowMCEnc::thread_zext_ln112_fu_396_p1() {
zext_ln112_fu_396_p1 = esl_zext<64,3>(i_0_i_reg_267.read());
}
void LowMCEnc::thread_zext_ln170_fu_379_p1() {
zext_ln170_fu_379_p1 = esl_zext<64,3>(loop_0_reg_256.read());
}
void LowMCEnc::thread_zext_ln191_fu_434_p1() {
zext_ln191_fu_434_p1 = esl_zext<64,3>(loop_1_reg_290.read());
}
void LowMCEnc::thread_zext_ln192_fu_449_p1() {
zext_ln192_fu_449_p1 = esl_zext<32,24>(lshr_ln_fu_439_p4.read());
}
void LowMCEnc::thread_zext_ln204_fu_596_p1() {
zext_ln204_fu_596_p1 = esl_zext<8,1>(xor_ln204_fu_590_p2.read());
}
void LowMCEnc::thread_zext_ln205_fu_645_p1() {
zext_ln205_fu_645_p1 = esl_zext<8,1>(xor_ln205_1_fu_639_p2.read());
}
void LowMCEnc::thread_zext_ln206_fu_692_p1() {
zext_ln206_fu_692_p1 = esl_zext<8,1>(xor_ln206_1_fu_686_p2.read());
}
void LowMCEnc::thread_zext_ln55_1_fu_532_p1() {
zext_ln55_1_fu_532_p1 = esl_zext<8,3>(sub_ln55_fu_527_p2.read());
}
void LowMCEnc::thread_zext_ln55_2_fu_501_p1() {
zext_ln55_2_fu_501_p1 = esl_zext<64,2>(lshr_ln55_2_fu_491_p4.read());
}
void LowMCEnc::thread_zext_ln55_3_fu_551_p1() {
zext_ln55_3_fu_551_p1 = esl_zext<8,3>(sub_ln55_1_fu_546_p2.read());
}
void LowMCEnc::thread_zext_ln55_4_fu_516_p1() {
zext_ln55_4_fu_516_p1 = esl_zext<64,2>(lshr_ln55_4_fu_506_p4.read());
}
void LowMCEnc::thread_zext_ln55_5_fu_570_p1() {
zext_ln55_5_fu_570_p1 = esl_zext<8,3>(xor_ln55_fu_565_p2.read());
}
void LowMCEnc::thread_zext_ln55_fu_476_p1() {
zext_ln55_fu_476_p1 = esl_zext<64,2>(lshr_ln8_fu_466_p4.read());
}
void LowMCEnc::thread_ap_NS_fsm() {
switch (ap_CS_fsm.read().to_uint64()) {
case 1 :
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state1.read()) && esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_1))) {
ap_NS_fsm = ap_ST_fsm_state2;
} else {
ap_NS_fsm = ap_ST_fsm_state1;
}
break;
case 2 :
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state2.read()) && esl_seteq<1,1,1>(icmp_ln169_fu_367_p2.read(), ap_const_lv1_1))) {
ap_NS_fsm = ap_ST_fsm_state4;
} else {
ap_NS_fsm = ap_ST_fsm_state3;
}
break;
case 4 :
ap_NS_fsm = ap_ST_fsm_state2;
break;
case 8 :
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state4.read()) && esl_seteq<1,1,1>(grp_matrix_mul_1_fu_345_ap_done.read(), ap_const_logic_1))) {
ap_NS_fsm = ap_ST_fsm_state5;
} else {
ap_NS_fsm = ap_ST_fsm_state4;
}
break;
case 16 :
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state5.read()) && esl_seteq<1,1,1>(icmp_ln111_fu_384_p2.read(), ap_const_lv1_1))) {
ap_NS_fsm = ap_ST_fsm_state7;
} else {
ap_NS_fsm = ap_ST_fsm_state6;
}
break;
case 32 :
ap_NS_fsm = ap_ST_fsm_state5;
break;
case 64 :
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state7.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, icmp_ln184_fu_402_p2.read()))) {
ap_NS_fsm = ap_ST_fsm_state1;
} else {
ap_NS_fsm = ap_ST_fsm_state8;
}
break;
case 128 :
if ((esl_seteq<1,1,1>(grp_matrix_mul_1_fu_345_ap_done.read(), ap_const_logic_1) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state8.read()))) {
ap_NS_fsm = ap_ST_fsm_state9;
} else {
ap_NS_fsm = ap_ST_fsm_state8;
}
break;
case 256 :
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state9.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, icmp_ln189_fu_417_p2.read()))) {
ap_NS_fsm = ap_ST_fsm_state11;
} else {
ap_NS_fsm = ap_ST_fsm_state10;
}
break;
case 512 :
ap_NS_fsm = ap_ST_fsm_state9;
break;
case 1024 :
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state11.read()) && esl_seteq<1,1,1>(ap_const_lv1_0, icmp_ln194_fu_454_p2.read()))) {
ap_NS_fsm = ap_ST_fsm_state18;
} else {
ap_NS_fsm = ap_ST_fsm_state12;
}
break;
case 2048 :
ap_NS_fsm = ap_ST_fsm_state13;
break;
case 4096 :
ap_NS_fsm = ap_ST_fsm_state14;
break;
case 8192 :
ap_NS_fsm = ap_ST_fsm_state15;
break;
case 16384 :
ap_NS_fsm = ap_ST_fsm_state16;
break;
case 32768 :
ap_NS_fsm = ap_ST_fsm_state17;
break;
case 65536 :
ap_NS_fsm = ap_ST_fsm_state11;
break;
case 131072 :
ap_NS_fsm = ap_ST_fsm_state19;
break;
case 262144 :
ap_NS_fsm = ap_ST_fsm_state20;
break;
case 524288 :
ap_NS_fsm = ap_ST_fsm_state21;
break;
case 1048576 :
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state21.read()) && esl_seteq<1,1,1>(grp_matrix_mul_fu_336_ap_done.read(), ap_const_logic_1))) {
ap_NS_fsm = ap_ST_fsm_state22;
} else {
ap_NS_fsm = ap_ST_fsm_state21;
}
break;
case 2097152 :
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state22.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, icmp_ln111_1_fu_757_p2.read()))) {
ap_NS_fsm = ap_ST_fsm_state24;
} else {
ap_NS_fsm = ap_ST_fsm_state23;
}
break;
case 4194304 :
ap_NS_fsm = ap_ST_fsm_state22;
break;
case 8388608 :
if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state24.read()) && esl_seteq<1,1,1>(ap_const_lv1_1, icmp_ln111_2_fu_795_p2.read()))) {
ap_NS_fsm = ap_ST_fsm_state7;
} else {
ap_NS_fsm = ap_ST_fsm_state25;
}
break;
case 16777216 :
ap_NS_fsm = ap_ST_fsm_state24;
break;
default :
ap_NS_fsm = (sc_lv<25>) ("XXXXXXXXXXXXXXXXXXXXXXXXX");
break;
}
}
}
|
752af4bccfc9353557666d59bf59cbe4c2e0faaa | f0c08b3ddefc91f1fa342f637b0e947a9a892556 | /branches/develop/calcioIA/Calcio/Logger.cpp | 81e480aebe5af69800e6a774a6a1690d239b9fbd | [] | no_license | BackupTheBerlios/coffeestore-svn | 1db0f60ddb85ccbbdfeb9b3271a687b23e29fc8f | ddee83284fe9875bf0d04e6b7da7a2113e85a040 | refs/heads/master | 2021-01-01T05:30:22.345767 | 2009-10-11T08:55:35 | 2009-10-11T08:55:35 | 40,725,038 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 359 | cpp | Logger.cpp | #include "Logger.h"
#include <iostream>
namespace
{
LoggerWriter* loggerWriter = NULL;
}
LoggerWriter::~LoggerWriter()
{
}
void Logger::setWriter(LoggerWriter& writer)
{
loggerWriter = &writer;
}
Logger::~Logger()
{
if (loggerWriter)
loggerWriter->write(_buffer.str());
}
bool Logger::loggingEnabled()
{
return true;
}
|
cca41a60c07db1a4efa236e66a3a9b40b9fdb31e | 21f01f0ea7092df49d5f711ab627dc5628e09d49 | /Direct3D_18/Direct3D_18.v12.v12/cLight_Direction.h | 2d7c3b9160c560ada8364e4fa77b8a5a8337272c | [] | no_license | JangMiKyung/DX2_pf_ver_2 | 9a44384b8334e7a15dc2daa4b757b728ea44a7f2 | f3a919ae2c55a4fbfc1c5805d1070b575d164150 | refs/heads/master | 2020-06-14T03:32:52.045025 | 2016-12-04T02:18:30 | 2016-12-04T02:18:30 | 75,512,650 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 218 | h | cLight_Direction.h | #pragma once
#include "cLight.h"
class cLight_Direction : public cLight
{
public:
cLight_Direction();
~cLight_Direction();
virtual D3DXMATRIXA16 GetLightMatrix() override;
virtual void RenderGizmo() override;
};
|
486553c779e998e19c0181790273dfc934611def | 522539a91ef48465b47394c131899b542d061aac | /random walk/assignments/소스.cpp | 905eae0d537fce47be413c2c94a0694a13f1812e | [] | no_license | minzydal/CPP_Programming | 8b1c0545aecad1e4a6555510d2b8280817815c79 | 228a2aae76dcdf7f3541c91b02007ed672c39559 | refs/heads/master | 2022-01-07T11:49:30.896962 | 2019-05-26T09:39:17 | 2019-05-26T09:39:17 | null | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 2,202 | cpp | 소스.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
#define MAX_MOVE 100000 // 최대 이동 한도
#define N 5 // 행과 열
int i, j; //i,j 전역변수로 설정
int check(int tile[][N]); //타일 값이 모두 1이 됐는지 확인하는 변수
using namespace std;
int main(void) {
int tile[N][N] = { {0} }; // 2차원 배열 5x5생성
int x = N / 2, y = N / 2; // 현재 좌표 x, y / 중앙에 있음.
tile[x][y] = 1;
int count = 0, remainCounter, tx, ty; // 총 이동수, tx, ty = 옮겨간 위치
clock_t start, finish; // 수행시간 측정
start = clock();
srand((unsigned)time(NULL));
while (check(tile) != 1) { //타일이 모두 1이되면 while문 탈출
int num = rand() % 8; // num = 이동할 곳, 주변에 있는 8개의 타일 값 생성(0~7)
switch (num) {
case 0:
ty = y--;
count++;
break;
case 1:
tx = x++;
ty = y--;
count++;
break;
case 2:
tx = x++;
count++;
break;
case 3:
tx = x++;
ty = y++;
count++;
break;
case 4:
ty = y++;
count++;
break;
case 5:
tx = x--;
ty = y++;
count++;
break;
case 6:
tx = x--;
count++;
break;
case 7:
tx = x--;
ty = y--;
count++;
break;
}
for (i = 0; i < N; i++) { // 밟은 타일을 보기쉽게 출력
for (j = 0; j < N; j++) {
if (tile[i][j] == 1)
cout << "■ ";
else
cout << "□ ";
}
cout << endl;
}
cout << endl;
if (tile[x][y] <= tile[N][N])
x = tx;
y = ty;
for (ty = 0; ty < N; ty++)
{
for (tx = 0; tx < N; tx++)
{
if (tile[ty][tx] == 0) // 안지나간 공간이 있으면
{
remainCounter++; // remainCounter를 증가
}
}
}
if (remainCounter == 0)
break;
finish = clock();
}
cout << "총 이동 수 : " << count << endl;
cout << "수행 시간 : " << ((double)(finish - start) / CLOCKS_PER_SEC) << endl;
cout << "현재 좌표 : " << tile[x][y] << endl;
}
int check(int tile[][N]) {
for (i = 0; i < N; i++) {
for (j = 0; j < N; j++) {
if (tile[i][j] == 0)
return 0;
}
}
return 1;
} |
b3577ed4b99e5b7aa2116ef8daef0d2078ce1533 | 8458971f93f53ade69c0542d874de02aa8056b00 | /Client/src/lib/Exception.cpp | ca2bf3d17835368f59ead23f43898cb34a16d942 | [] | no_license | mowijo/ExpenseTracker | 736802bfd15763ca171d09acd82cd8abf4a1e1d0 | eefcf180bf741ac49d034a22dd738b6f4af58128 | refs/heads/master | 2021-01-20T21:01:04.004762 | 2016-06-24T06:35:01 | 2016-06-24T06:35:01 | 61,862,249 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,083 | cpp | Exception.cpp | #include "Exception.h"
class ExceptionPrivate
{
public:
QString file;
int line;
QString headline;
QString body;
QString remedy;
};
Exception::Exception()
{
d = new ExceptionPrivate;
}
Exception::~Exception()
{
delete d;
}
void Exception::setFile(const QString &file)
{
d->file = file;
}
void Exception::setLine(int line)
{
d->line = line;
}
void Exception::setHeadLine(const QString &headline)
{
d->headline = headline;
}
void Exception::setBody(const QString &body)
{
d->body = body;
}
void Exception::setRemedy(const QString &remedy)
{
d->remedy = remedy;
}
QString Exception::file() const
{
return d->file;
}
int Exception::line() const
{
return d->line;
}
QString Exception::headLine() const
{
return d->headline;
}
QString Exception::body() const
{
return d->body;
}
QString Exception::remedy() const
{
return d->remedy;
}
bool Exception::isFatal() const
{
return false;
}
FatalException::FatalException()
: Exception()
{
}
bool FatalException::isFatal() const
{
return true;
}
|
ba28cfa3e6fdc8043974cf74aa5d8168a1140ec8 | 09c5e1da26c4805bc98f49b3a76e5ce98ea4a537 | /tests/api/mpi/group/grouptest.cc | 7d05150347a815a7fe9a4579a1da491d4252cd6a | [
"BSD-3-Clause"
] | permissive | sknigh/sst-macro | e711c1c6dd938b964f882c3b0358b5ad4c1edc95 | 63833b12797bf3c4d4e203c96bd8fbc1cb042a7b | refs/heads/master | 2021-01-24T22:14:19.517590 | 2018-05-22T13:48:00 | 2018-05-22T13:48:00 | 58,085,180 | 0 | 0 | null | 2016-05-04T21:28:35 | 2016-05-04T21:28:34 | null | UTF-8 | C++ | false | false | 6,405 | cc | grouptest.cc | /**
Copyright 2009-2018 National Technology and Engineering Solutions of Sandia,
LLC (NTESS). Under the terms of Contract DE-NA-0003525, the U.S. Government
retains certain rights in this software.
Sandia National Laboratories is a multimission laboratory managed and operated
by National Technology and Engineering Solutions of Sandia, LLC., a wholly
owned subsidiary of Honeywell International, Inc., for the U.S. Department of
Energy's National Nuclear Security Administration under contract DE-NA0003525.
Copyright (c) 2009-2018, NTESS
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 Sandia Corporation 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.
Questions? Contact sst-macro-help@sandia.gov
*/
#include <sstmac/replacements/mpi.h>
#include <stdio.h>
#include <stdlib.h>
namespace grouptest {
int grouptest( int argc, char *argv[] )
{
MPI_Group g1, g2, g4, g5, g45, selfgroup, g6;
int ranks[16], size, rank, myrank, range[1][3];
int errs = 0;
int i, rin[16], rout[16], result;
MPI_Init(0,0);
MPI_Comm_group( MPI_COMM_WORLD, &g1 );
MPI_Comm_rank( MPI_COMM_WORLD, &myrank );
MPI_Comm_size( MPI_COMM_WORLD, &size );
if (size < 8) {
fprintf( stderr,
"Test requires 8 processes (16 prefered) only %d provided\n",
size );
errs++;
}
/** 16 members, this process is rank 0, return in group 1 */
ranks[0] = myrank; ranks[1] = 2; ranks[2] = 7;
if (myrank == 2) ranks[1] = 3;
if (myrank == 7) ranks[2] = 6;
MPI_Group_incl( g1, 3, ranks, &g2 );
/** Check the resulting group */
MPI_Group_size( g2, &size );
MPI_Group_rank( g2, &rank );
if (size != 3) {
fprintf( stderr, "Size should be %d, is %d\n", 3, size );
errs++;
}
if (rank != 0) {
fprintf( stderr, "Rank should be %d, is %d\n", 0, rank );
errs++;
}
rin[0] = 0; rin[1] = 1; rin[2] = 2;
MPI_Group_translate_ranks( g2, 3, rin, g1, rout );
for (i=0; i<3; i++) {
if (rout[i] != ranks[i]) {
fprintf( stderr, "translated rank[%d] %d should be %d\n",
i, rout[i], ranks[i] );
errs++;
}
}
/** Translate the process of the self group against another group */
MPI_Comm_group( MPI_COMM_SELF, &selfgroup );
rin[0] = 0;
MPI_Group_translate_ranks( selfgroup, 1, rin, g1, rout );
if (rout[0] != myrank) {
fprintf( stderr, "translated of self is %d should be %d\n",
rout[0], myrank );
errs++;
}
for (i=0; i<size; i++)
rin[i] = i;
MPI_Group_translate_ranks( g1, size, rin, selfgroup, rout );
for (i=0; i<size; i++) {
if (i == myrank && rout[i] != 0) {
fprintf( stderr, "translated world to self of %d is %d\n",
i, rout[i] );
errs++;
}
else if (i != myrank && rout[i] != MPI_UNDEFINED) {
fprintf( stderr, "translated world to self of %d should be undefined, is %d\n",
i, rout[i] );
errs++;
}
}
MPI_Group_free( &selfgroup );
/** Exclude everyone in our group */
{
int ii, *lranks, g1size;
MPI_Group_size( g1, &g1size );
lranks = (int *)malloc( g1size * sizeof(int) );
for (ii=0; ii<g1size; ii++) lranks[ii] = ii;
MPI_Group_excl( g1, g1size, lranks, &g6 );
if (g6 != MPI_GROUP_EMPTY) {
fprintf( stderr, "Group formed by excluding all ranks not empty\n" );
errs++;
MPI_Group_free( &g6 );
}
free( lranks );
}
/** Add tests for additional group operations */
/**
g2 = incl 1,3,7
g3 = excl 1,3,7
intersect ( w, g2 ) => g2
intersect ( w, g3 ) => g3
intersect ( g2, g3 ) => empty
g4 = rincl 1:n-1:2
g5 = rexcl 1:n-1:2
union( g4, g5 ) => world
g6 = rincl n-1:1:-1
g7 = rexcl n-1:1:-1
union( g6, g7 ) => concat of entries, similar to world
diff( w, g2 ) => g3
*/
MPI_Group_free( &g2 );
range[0][0] = 1;
range[0][1] = size-1;
range[0][2] = 2;
MPI_Group_range_excl( g1, 1, range, &g5 );
range[0][0] = 1;
range[0][1] = size-1;
range[0][2] = 2;
MPI_Group_range_incl( g1, 1, range, &g4 );
MPI_Group_union( g4, g5, &g45 );
MPI_Group_compare( MPI_GROUP_EMPTY, g4, &result );
if (result != MPI_UNEQUAL) {
errs++;
fprintf( stderr, "Comparison with empty group gave %d, not 3\n",
result );
}
MPI_Group_free( &g4 );
MPI_Group_free( &g5 );
MPI_Group_free( &g45 );
/** Now, duplicate the test, but using negative strides */
range[0][0] = size-1;
range[0][1] = 1;
range[0][2] = -2;
MPI_Group_range_excl( g1, 1, range, &g5 );
range[0][0] = size-1;
range[0][1] = 1;
range[0][2] = -2;
MPI_Group_range_incl( g1, 1, range, &g4 );
MPI_Group_union( g4, g5, &g45 );
MPI_Group_compare( MPI_GROUP_EMPTY, g4, &result );
if (result != MPI_UNEQUAL) {
errs++;
fprintf( stderr, "Comparison with empty group (formed with negative strides) gave %d, not 3\n",
result );
}
MPI_Group_free( &g4 );
MPI_Group_free( &g5 );
MPI_Group_free( &g45 );
MPI_Group_free( &g1 );
if (myrank == 0)
{
if (errs == 0) {
printf( " No Errors\n" );
}
else {
printf( "Found %d errors\n", errs );
}
}
MPI_Finalize();
return 0;
}
} |
d034aacd8132a66dc15fac1a6fd850dbba054547 | 35918be245e2857156fd9e646aa53c5757f33573 | /src/include/bms.hpp | b695dee0a9a65c1ee08a0f0f2f42401ac94ddff7 | [] | no_license | YvanMokwinski/WGRID | d795b635f6214d1b07cadea844c426e29c67511c | e35bc0ff51fb65cd13086aae65bb00787818188b | refs/heads/master | 2022-11-12T21:41:20.986032 | 2020-07-08T18:42:28 | 2020-07-08T18:42:28 | 258,705,105 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,534 | hpp | bms.hpp | #pragma once
#include "bms.h"
template<typename T>
wmesh_status_t bms_element_geometry(wmesh_int_t element_,
T*__restrict__ c_);
template<typename T>
wmesh_status_t bms_ordering_vertices(wmesh_int_t element_,
T*__restrict__ c_);
template<typename T>
wmesh_status_t bms_ordering_linear_shape(wmesh_int_t element_,
wmesh_int_t c_storage_,
wmesh_int_t c_m_,
wmesh_int_t c_n_,
const T * __restrict__ c_v_,
wmesh_int_t c_ld_,
wmesh_int_t ev_storage_,
wmesh_int_t ev_m_,
wmesh_int_t ev_n_,
T * __restrict__ ev_v_,
wmesh_int_t ev_ld_);
template<typename T>
wmesh_status_t bms_transform(wmesh_int_t element_,
wmesh_int_t r_n_,
const T*__restrict__ r_,
wmesh_int_t r_inc_,
wmesh_int_t c_storage_,
wmesh_int_t c_m_,
wmesh_int_t c_n_,
T * __restrict__ c_v_,
wmesh_int_t c_ld_,
const_wmesh_int_p p_,
wmesh_int_t p_inc_);
template<typename T>
wmesh_status_t bms_sparse_add(wmesh_int_t idofs_n_,
const_wmesh_int_p idofs_,
wmesh_int_t idofs_inc_,
wmesh_int_t jdofs_n_,
const_wmesh_int_p jdofs_,
wmesh_int_t jdofs_inc_,
const T * __restrict__ lmat_,
wmesh_int_t lmat_ld_,
wmesh_int_t csr_size_,
const_wmesh_int_p csr_ptr_,
const_wmesh_int_p csr_ind_,
T * __restrict__ csr_val_);
|
45837118f8748f75a3367eef231882e78218af0d | b4da4a1d95ccdc1243fd978cb0a9951a64b506ae | /p12.cpp | 904710fd2fae91c0a2dea2e001d2a163077b6e35 | [] | no_license | thehexia/cs1exam2 | 6ef3b275e96f95ac729f7d34b93fe656b943fa2f | 912c1f46303acbcca0c934fba56b05d4ec4d47f8 | refs/heads/master | 2020-12-24T21:12:08.957220 | 2016-04-11T15:27:15 | 2016-04-11T15:27:15 | 55,983,920 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 628 | cpp | p12.cpp | #include <iostream>
using namespace std;
int main()
{
int bignum[7];
int num1 = 0, num2 = 10, result, counter;
for (int i = 0; i < 7; i++)
cin >> bignum[i];
for (; num1 < 7; num1++) {
cout << bignum[num1++] << endl;
counter = bignum[num1]++;
}
// This is the line in error. If you uncomment it and compile, it will produce
// a compiler error.
//
// The result of num1 + num2 is stored in temporary memory (an rvalue).
// You cannot increment the value stored in a temporary. You require an lvalue.
result = ++(num1 + num2);
cout << num1 << " " << num2 << " " << result;
return 0;
}
|
3010a0d38729ef8c1803260539cb0355c8c9727a | 6d643e93556a7495fc536abc5b869ae4af70d84a | /1045.cpp | f89decedbec1dc2c9f39569dfa09aefd947b5729 | [] | no_license | thdwlsgus0/codeup | e6fc7647ebabf90d1793c3d2a937e1748605b76c | d32a46c675c544af7feee6746144dc5f6ef54678 | refs/heads/master | 2022-03-05T15:09:30.597341 | 2019-09-02T02:00:55 | 2019-09-02T02:00:55 | 118,220,792 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 194 | cpp | 1045.cpp | // codeup 1045 problem //
#include <cstdio>
int main(void)
{
int a,b;
scanf("%d %d", &a, &b);
printf("%d\n%d\n%d\n%d\n%d\n%.2f\n", a+b, a-b, a*b, a/b, a%b,float(a)/float(b));
return 0;
}
|
402b6ab931b9f001529064ebd019f5cb4db9d73b | 9ea624a093561c87e47b822008e35d40a136a953 | /src/OpcUaStackCore/ServiceSet/ReadRequest.cpp | 5dc2e1f97b1d0e3ff0685339ef4308ba813176dd | [
"Apache-2.0"
] | permissive | ASNeG/OpcUaStack | 399828371ed4c128360c710dcd831b41f192f27d | e7c365f006be878dcb588a83af9a0dde49bf2b5a | refs/heads/master | 2023-08-30T16:12:24.823685 | 2022-06-27T21:35:44 | 2022-06-27T21:35:44 | 149,216,768 | 141 | 41 | Apache-2.0 | 2023-08-22T09:10:17 | 2018-09-18T02:25:58 | C++ | UTF-8 | C++ | false | false | 2,430 | cpp | ReadRequest.cpp | /*
Copyright 2015 Kai Huebl (kai@huebl-sgh.de)
Lizenziert gemäß Apache Licence Version 2.0 (die „Lizenz“); Nutzung dieser
Datei nur in Übereinstimmung mit der Lizenz erlaubt.
Eine Kopie der Lizenz erhalten Sie auf http://www.apache.org/licenses/LICENSE-2.0.
Sofern nicht gemäß geltendem Recht vorgeschrieben oder schriftlich vereinbart,
erfolgt die Bereitstellung der im Rahmen der Lizenz verbreiteten Software OHNE
GEWÄHR ODER VORBEHALTE – ganz gleich, ob ausdrücklich oder stillschweigend.
Informationen über die jeweiligen Bedingungen für Genehmigungen und Einschränkungen
im Rahmen der Lizenz finden Sie in der Lizenz.
Autor: Kai Huebl (kai@huebl-sgh.de)
*/
#include "OpcUaStackCore/ServiceSet/ReadRequest.h"
namespace OpcUaStackCore
{
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
//
// OpcUa ReadRequest
//
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
ReadRequest::ReadRequest(void)
: Object()
, maxAge_()
, timestampsToReturn_()
, readValueIdArraySPtr_(constructSPtr<ReadValueIdArray>())
{
}
ReadRequest::~ReadRequest(void)
{
}
void
ReadRequest::maxAge(const OpcUaDouble& maxAge)
{
maxAge_ = maxAge;
}
OpcUaDouble
ReadRequest::maxAge(void) const
{
return maxAge_;
}
void
ReadRequest::timestampsToReturn(const OpcUaInt32& timestampsToReturn)
{
timestampsToReturn_ = timestampsToReturn;
}
OpcUaInt32
ReadRequest::timestampsToReturn(void) const
{
return timestampsToReturn_;
}
void
ReadRequest::readValueIdArray(const ReadValueIdArray::SPtr readValueIdArraySPtr)
{
readValueIdArraySPtr_ = readValueIdArraySPtr;
}
ReadValueIdArray::SPtr
ReadRequest::readValueIdArray(void) const
{
return readValueIdArraySPtr_;
}
bool
ReadRequest::opcUaBinaryEncode(std::ostream& os) const
{
OpcUaNumber::opcUaBinaryEncode(os, maxAge_);
OpcUaNumber::opcUaBinaryEncode(os, timestampsToReturn_);
readValueIdArraySPtr_->opcUaBinaryEncode(os);
return true;
}
bool
ReadRequest::opcUaBinaryDecode(std::istream& is)
{
OpcUaNumber::opcUaBinaryDecode(is, maxAge_);
OpcUaNumber::opcUaBinaryDecode(is, timestampsToReturn_);
readValueIdArraySPtr_->opcUaBinaryDecode(is);
return true;
}
}
|
16c675cfc899a10721d75a3914823c109bfbeb3c | c547b89ca549234cf2d3536bd4f7530eb83e627f | /src/ART_Version/runtime/mem_map.cc | bad86db2c2c3cba73434af9bd39bb7558dfaf5b0 | [
"NCSA",
"Apache-2.0"
] | permissive | UchihaL/AppSpear | 9c4dbf5bc8d4084a8d678cbb82311a41945a33bc | fd73d19429651fca040bb33822bc222b068791b8 | refs/heads/master | 2021-09-02T06:47:45.766224 | 2017-12-31T06:05:11 | 2017-12-31T06:05:11 | 115,843,307 | 37 | 25 | null | null | null | null | UTF-8 | C++ | false | false | 24,110 | cc | mem_map.cc | /*
* Copyright (C) 2008 The Android Open Source Project
*
* 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 "mem_map.h"
#include "thread-inl.h"
#include <inttypes.h>
#include <backtrace/BacktraceMap.h>
#include <memory>
// See CreateStartPos below.
#ifdef __BIONIC__
#include <sys/auxv.h>
#endif
#include "base/stringprintf.h"
#include "ScopedFd.h"
#include "utils.h"
#define USE_ASHMEM 1
#ifdef USE_ASHMEM
#include <cutils/ashmem.h>
#ifndef ANDROID_OS
#include <sys/resource.h>
#endif
#endif
#ifndef MAP_ANONYMOUS
#define MAP_ANONYMOUS MAP_ANON
#endif
namespace art {
static std::ostream& operator<<(
std::ostream& os,
std::pair<BacktraceMap::const_iterator, BacktraceMap::const_iterator> iters) {
for (BacktraceMap::const_iterator it = iters.first; it != iters.second; ++it) {
os << StringPrintf("0x%08x-0x%08x %c%c%c %s\n",
static_cast<uint32_t>(it->start),
static_cast<uint32_t>(it->end),
(it->flags & PROT_READ) ? 'r' : '-',
(it->flags & PROT_WRITE) ? 'w' : '-',
(it->flags & PROT_EXEC) ? 'x' : '-', it->name.c_str());
}
return os;
}
std::ostream& operator<<(std::ostream& os, const MemMap::Maps& mem_maps) {
os << "MemMap:" << std::endl;
for (auto it = mem_maps.begin(); it != mem_maps.end(); ++it) {
void* base = it->first;
MemMap* map = it->second;
CHECK_EQ(base, map->BaseBegin());
os << *map << std::endl;
}
return os;
}
MemMap::Maps* MemMap::maps_ = nullptr;
#if USE_ART_LOW_4G_ALLOCATOR
// Handling mem_map in 32b address range for 64b architectures that do not support MAP_32BIT.
// The regular start of memory allocations. The first 64KB is protected by SELinux.
static constexpr uintptr_t LOW_MEM_START = 64 * KB;
// Generate random starting position.
// To not interfere with image position, take the image's address and only place it below. Current
// formula (sketch):
//
// ART_BASE_ADDR = 0001XXXXXXXXXXXXXXX
// ----------------------------------------
// = 0000111111111111111
// & ~(kPageSize - 1) =~0000000000000001111
// ----------------------------------------
// mask = 0000111111111110000
// & random data = YYYYYYYYYYYYYYYYYYY
// -----------------------------------
// tmp = 0000YYYYYYYYYYY0000
// + LOW_MEM_START = 0000000000001000000
// --------------------------------------
// start
//
// getauxval as an entropy source is exposed in Bionic, but not in glibc before 2.16. When we
// do not have Bionic, simply start with LOW_MEM_START.
// Function is standalone so it can be tested somewhat in mem_map_test.cc.
#ifdef __BIONIC__
uintptr_t CreateStartPos(uint64_t input) {
CHECK_NE(0, ART_BASE_ADDRESS);
// Start with all bits below highest bit in ART_BASE_ADDRESS.
constexpr size_t leading_zeros = CLZ(static_cast<uint32_t>(ART_BASE_ADDRESS));
constexpr uintptr_t mask_ones = (1 << (31 - leading_zeros)) - 1;
// Lowest (usually 12) bits are not used, as aligned by page size.
constexpr uintptr_t mask = mask_ones & ~(kPageSize - 1);
// Mask input data.
return (input & mask) + LOW_MEM_START;
}
#endif
static uintptr_t GenerateNextMemPos() {
#ifdef __BIONIC__
uint8_t* random_data = reinterpret_cast<uint8_t*>(getauxval(AT_RANDOM));
// The lower 8B are taken for the stack guard. Use the upper 8B (with mask).
return CreateStartPos(*reinterpret_cast<uintptr_t*>(random_data + 8));
#else
// No auxv on host, see above.
return LOW_MEM_START;
#endif
}
// Initialize linear scan to random position.
uintptr_t MemMap::next_mem_pos_ = GenerateNextMemPos();
#endif
#if !defined(__APPLE__) // TODO: Reanable after b/16861075 BacktraceMap issue is addressed.
// Return true if the address range is contained in a single /proc/self/map entry.
static bool ContainedWithinExistingMap(uintptr_t begin,
uintptr_t end,
std::string* error_msg) {
std::unique_ptr<BacktraceMap> map(BacktraceMap::Create(getpid(), true));
if (map.get() == nullptr) {
*error_msg = StringPrintf("Failed to build process map");
return false;
}
for (BacktraceMap::const_iterator it = map->begin(); it != map->end(); ++it) {
if ((begin >= it->start && begin < it->end) // start of new within old
&& (end > it->start && end <= it->end)) { // end of new within old
return true;
}
}
std::string maps;
ReadFileToString("/proc/self/maps", &maps);
*error_msg = StringPrintf("Requested region 0x%08" PRIxPTR "-0x%08" PRIxPTR " does not overlap "
"any existing map:\n%s\n",
begin, end, maps.c_str());
return false;
}
#endif
// Return true if the address range does not conflict with any /proc/self/maps entry.
static bool CheckNonOverlapping(uintptr_t begin,
uintptr_t end,
std::string* error_msg) {
std::unique_ptr<BacktraceMap> map(BacktraceMap::Create(getpid(), true));
if (map.get() == nullptr) {
*error_msg = StringPrintf("Failed to build process map");
return false;
}
for (BacktraceMap::const_iterator it = map->begin(); it != map->end(); ++it) {
if ((begin >= it->start && begin < it->end) // start of new within old
|| (end > it->start && end < it->end) // end of new within old
|| (begin <= it->start && end > it->end)) { // start/end of new includes all of old
std::ostringstream map_info;
map_info << std::make_pair(it, map->end());
*error_msg = StringPrintf("Requested region 0x%08" PRIxPTR "-0x%08" PRIxPTR " overlaps with "
"existing map 0x%08" PRIxPTR "-0x%08" PRIxPTR " (%s)\n%s",
begin, end,
static_cast<uintptr_t>(it->start), static_cast<uintptr_t>(it->end),
it->name.c_str(),
map_info.str().c_str());
return false;
}
}
return true;
}
// CheckMapRequest to validate a non-MAP_FAILED mmap result based on
// the expected value, calling munmap if validation fails, giving the
// reason in error_msg.
//
// If the expected_ptr is nullptr, nothing is checked beyond the fact
// that the actual_ptr is not MAP_FAILED. However, if expected_ptr is
// non-null, we check that pointer is the actual_ptr == expected_ptr,
// and if not, report in error_msg what the conflict mapping was if
// found, or a generic error in other cases.
static bool CheckMapRequest(byte* expected_ptr, void* actual_ptr, size_t byte_count,
std::string* error_msg) {
// Handled first by caller for more specific error messages.
CHECK(actual_ptr != MAP_FAILED);
if (expected_ptr == nullptr) {
return true;
}
uintptr_t actual = reinterpret_cast<uintptr_t>(actual_ptr);
uintptr_t expected = reinterpret_cast<uintptr_t>(expected_ptr);
uintptr_t limit = expected + byte_count;
if (expected_ptr == actual_ptr) {
return true;
}
// We asked for an address but didn't get what we wanted, all paths below here should fail.
int result = munmap(actual_ptr, byte_count);
if (result == -1) {
PLOG(WARNING) << StringPrintf("munmap(%p, %zd) failed", actual_ptr, byte_count);
}
// We call this here so that we can try and generate a full error
// message with the overlapping mapping. There's no guarantee that
// that there will be an overlap though, since
// - The kernel is not *required* to honour expected_ptr unless MAP_FIXED is
// true, even if there is no overlap
// - There might have been an overlap at the point of mmap, but the
// overlapping region has since been unmapped.
std::string error_detail;
CheckNonOverlapping(expected, limit, &error_detail);
std::ostringstream os;
os << StringPrintf("Failed to mmap at expected address, mapped at "
"0x%08" PRIxPTR " instead of 0x%08" PRIxPTR,
actual, expected);
if (!error_detail.empty()) {
os << " : " << error_detail;
}
*error_msg = os.str();
return false;
}
MemMap* MemMap::MapAnonymous(const char* name, byte* expected_ptr, size_t byte_count, int prot,
bool low_4gb, std::string* error_msg) {
if (byte_count == 0) {
return new MemMap(name, nullptr, 0, nullptr, 0, prot, false);
}
size_t page_aligned_byte_count = RoundUp(byte_count, kPageSize);
int flags = MAP_PRIVATE | MAP_ANONYMOUS;
ScopedFd fd(-1);
#ifdef USE_ASHMEM
#ifdef HAVE_ANDROID_OS
const bool use_ashmem = true;
#else
// When not on Android ashmem is faked using files in /tmp. Ensure that such files won't
// fail due to ulimit restrictions. If they will then use a regular mmap.
struct rlimit rlimit_fsize;
CHECK_EQ(getrlimit(RLIMIT_FSIZE, &rlimit_fsize), 0);
const bool use_ashmem = (rlimit_fsize.rlim_cur == RLIM_INFINITY) ||
(page_aligned_byte_count < rlimit_fsize.rlim_cur);
#endif
if (use_ashmem) {
// android_os_Debug.cpp read_mapinfo assumes all ashmem regions associated with the VM are
// prefixed "dalvik-".
std::string debug_friendly_name("dalvik-");
debug_friendly_name += name;
fd.reset(ashmem_create_region(debug_friendly_name.c_str(), page_aligned_byte_count));
if (fd.get() == -1) {
*error_msg = StringPrintf("ashmem_create_region failed for '%s': %s", name, strerror(errno));
return nullptr;
}
flags = MAP_PRIVATE;
}
#endif
// We need to store and potentially set an error number for pretty printing of errors
int saved_errno = 0;
#ifdef __LP64__
// When requesting low_4g memory and having an expectation, the requested range should fit into
// 4GB.
if (low_4gb && (
// Start out of bounds.
(reinterpret_cast<uintptr_t>(expected_ptr) >> 32) != 0 ||
// End out of bounds. For simplicity, this will fail for the last page of memory.
(reinterpret_cast<uintptr_t>(expected_ptr + page_aligned_byte_count) >> 32) != 0)) {
*error_msg = StringPrintf("The requested address space (%p, %p) cannot fit in low_4gb",
expected_ptr, expected_ptr + page_aligned_byte_count);
return nullptr;
}
#endif
// TODO:
// A page allocator would be a useful abstraction here, as
// 1) It is doubtful that MAP_32BIT on x86_64 is doing the right job for us
// 2) The linear scheme, even with simple saving of the last known position, is very crude
#if USE_ART_LOW_4G_ALLOCATOR
// MAP_32BIT only available on x86_64.
void* actual = MAP_FAILED;
if (low_4gb && expected_ptr == nullptr) {
bool first_run = true;
for (uintptr_t ptr = next_mem_pos_; ptr < 4 * GB; ptr += kPageSize) {
if (4U * GB - ptr < page_aligned_byte_count) {
// Not enough memory until 4GB.
if (first_run) {
// Try another time from the bottom;
ptr = LOW_MEM_START - kPageSize;
first_run = false;
continue;
} else {
// Second try failed.
break;
}
}
uintptr_t tail_ptr;
// Check pages are free.
bool safe = true;
for (tail_ptr = ptr; tail_ptr < ptr + page_aligned_byte_count; tail_ptr += kPageSize) {
if (msync(reinterpret_cast<void*>(tail_ptr), kPageSize, 0) == 0) {
safe = false;
break;
} else {
DCHECK_EQ(errno, ENOMEM);
}
}
next_mem_pos_ = tail_ptr; // update early, as we break out when we found and mapped a region
if (safe == true) {
actual = mmap(reinterpret_cast<void*>(ptr), page_aligned_byte_count, prot, flags, fd.get(),
0);
if (actual != MAP_FAILED) {
// Since we didn't use MAP_FIXED the kernel may have mapped it somewhere not in the low
// 4GB. If this is the case, unmap and retry.
if (reinterpret_cast<uintptr_t>(actual) + page_aligned_byte_count < 4 * GB) {
break;
} else {
munmap(actual, page_aligned_byte_count);
actual = MAP_FAILED;
}
}
} else {
// Skip over last page.
ptr = tail_ptr;
}
}
if (actual == MAP_FAILED) {
LOG(ERROR) << "Could not find contiguous low-memory space.";
saved_errno = ENOMEM;
}
} else {
actual = mmap(expected_ptr, page_aligned_byte_count, prot, flags, fd.get(), 0);
saved_errno = errno;
}
#else
#if defined(__LP64__)
if (low_4gb && expected_ptr == nullptr) {
flags |= MAP_32BIT;
}
#endif
void* actual = mmap(expected_ptr, page_aligned_byte_count, prot, flags, fd.get(), 0);
saved_errno = errno;
#endif
if (actual == MAP_FAILED) {
std::string maps;
ReadFileToString("/proc/self/maps", &maps);
*error_msg = StringPrintf("Failed anonymous mmap(%p, %zd, 0x%x, 0x%x, %d, 0): %s\n%s",
expected_ptr, page_aligned_byte_count, prot, flags, fd.get(),
strerror(saved_errno), maps.c_str());
return nullptr;
}
std::ostringstream check_map_request_error_msg;
if (!CheckMapRequest(expected_ptr, actual, page_aligned_byte_count, error_msg)) {
return nullptr;
}
return new MemMap(name, reinterpret_cast<byte*>(actual), byte_count, actual,
page_aligned_byte_count, prot, false);
}
MemMap* MemMap::MapFileAtAddress(byte* expected_ptr, size_t byte_count, int prot, int flags, int fd,
off_t start, bool reuse, const char* filename,
std::string* error_msg) {
CHECK_NE(0, prot);
CHECK_NE(0, flags & (MAP_SHARED | MAP_PRIVATE));
// Note that we do not allow MAP_FIXED unless reuse == true, i.e we
// expect his mapping to be contained within an existing map.
if (reuse) {
// reuse means it is okay that it overlaps an existing page mapping.
// Only use this if you actually made the page reservation yourself.
CHECK(expected_ptr != nullptr);
#if !defined(__APPLE__) // TODO: Reanable after b/16861075 BacktraceMap issue is addressed.
uintptr_t expected = reinterpret_cast<uintptr_t>(expected_ptr);
uintptr_t limit = expected + byte_count;
DCHECK(ContainedWithinExistingMap(expected, limit, error_msg));
#endif
flags |= MAP_FIXED;
} else {
CHECK_EQ(0, flags & MAP_FIXED);
// Don't bother checking for an overlapping region here. We'll
// check this if required after the fact inside CheckMapRequest.
}
if (byte_count == 0) {
return new MemMap(filename, nullptr, 0, nullptr, 0, prot, false);
}
// Adjust 'offset' to be page-aligned as required by mmap.
int page_offset = start % kPageSize;
off_t page_aligned_offset = start - page_offset;
// Adjust 'byte_count' to be page-aligned as we will map this anyway.
size_t page_aligned_byte_count = RoundUp(byte_count + page_offset, kPageSize);
// The 'expected_ptr' is modified (if specified, ie non-null) to be page aligned to the file but
// not necessarily to virtual memory. mmap will page align 'expected' for us.
byte* page_aligned_expected = (expected_ptr == nullptr) ? nullptr : (expected_ptr - page_offset);
byte* actual = reinterpret_cast<byte*>(mmap(page_aligned_expected,
page_aligned_byte_count,
prot,
flags,
fd,
page_aligned_offset));
if (actual == MAP_FAILED) {
auto saved_errno = errno;
std::string maps;
ReadFileToString("/proc/self/maps", &maps);
*error_msg = StringPrintf("mmap(%p, %zd, 0x%x, 0x%x, %d, %" PRId64
") of file '%s' failed: %s\n%s",
page_aligned_expected, page_aligned_byte_count, prot, flags, fd,
static_cast<int64_t>(page_aligned_offset), filename,
strerror(saved_errno), maps.c_str());
return nullptr;
}
std::ostringstream check_map_request_error_msg;
if (!CheckMapRequest(expected_ptr, actual, page_aligned_byte_count, error_msg)) {
return nullptr;
}
return new MemMap(filename, actual + page_offset, byte_count, actual, page_aligned_byte_count,
prot, reuse);
}
MemMap::~MemMap() {
if (base_begin_ == nullptr && base_size_ == 0) {
return;
}
if (!reuse_) {
int result = munmap(base_begin_, base_size_);
if (result == -1) {
PLOG(FATAL) << "munmap failed";
}
}
// Remove it from maps_.
MutexLock mu(Thread::Current(), *Locks::mem_maps_lock_);
bool found = false;
DCHECK(maps_ != nullptr);
for (auto it = maps_->lower_bound(base_begin_), end = maps_->end();
it != end && it->first == base_begin_; ++it) {
if (it->second == this) {
found = true;
maps_->erase(it);
break;
}
}
CHECK(found) << "MemMap not found";
}
MemMap::MemMap(const std::string& name, byte* begin, size_t size, void* base_begin,
size_t base_size, int prot, bool reuse)
: name_(name), begin_(begin), size_(size), base_begin_(base_begin), base_size_(base_size),
prot_(prot), reuse_(reuse) {
if (size_ == 0) {
CHECK(begin_ == nullptr);
CHECK(base_begin_ == nullptr);
CHECK_EQ(base_size_, 0U);
} else {
CHECK(begin_ != nullptr);
CHECK(base_begin_ != nullptr);
CHECK_NE(base_size_, 0U);
// Add it to maps_.
MutexLock mu(Thread::Current(), *Locks::mem_maps_lock_);
DCHECK(maps_ != nullptr);
maps_->insert(std::make_pair(base_begin_, this));
}
};
MemMap* MemMap::RemapAtEnd(byte* new_end, const char* tail_name, int tail_prot,
std::string* error_msg) {
DCHECK_GE(new_end, Begin());
DCHECK_LE(new_end, End());
DCHECK_LE(begin_ + size_, reinterpret_cast<byte*>(base_begin_) + base_size_);
DCHECK(IsAligned<kPageSize>(begin_));
DCHECK(IsAligned<kPageSize>(base_begin_));
DCHECK(IsAligned<kPageSize>(reinterpret_cast<byte*>(base_begin_) + base_size_));
DCHECK(IsAligned<kPageSize>(new_end));
byte* old_end = begin_ + size_;
byte* old_base_end = reinterpret_cast<byte*>(base_begin_) + base_size_;
byte* new_base_end = new_end;
DCHECK_LE(new_base_end, old_base_end);
if (new_base_end == old_base_end) {
return new MemMap(tail_name, nullptr, 0, nullptr, 0, tail_prot, false);
}
size_ = new_end - reinterpret_cast<byte*>(begin_);
base_size_ = new_base_end - reinterpret_cast<byte*>(base_begin_);
DCHECK_LE(begin_ + size_, reinterpret_cast<byte*>(base_begin_) + base_size_);
size_t tail_size = old_end - new_end;
byte* tail_base_begin = new_base_end;
size_t tail_base_size = old_base_end - new_base_end;
DCHECK_EQ(tail_base_begin + tail_base_size, old_base_end);
DCHECK(IsAligned<kPageSize>(tail_base_size));
#ifdef USE_ASHMEM
// android_os_Debug.cpp read_mapinfo assumes all ashmem regions associated with the VM are
// prefixed "dalvik-".
std::string debug_friendly_name("dalvik-");
debug_friendly_name += tail_name;
ScopedFd fd(ashmem_create_region(debug_friendly_name.c_str(), tail_base_size));
int flags = MAP_PRIVATE | MAP_FIXED;
if (fd.get() == -1) {
*error_msg = StringPrintf("ashmem_create_region failed for '%s': %s",
tail_name, strerror(errno));
return nullptr;
}
#else
ScopedFd fd(-1);
int flags = MAP_PRIVATE | MAP_ANONYMOUS;
#endif
// Unmap/map the tail region.
int result = munmap(tail_base_begin, tail_base_size);
if (result == -1) {
std::string maps;
ReadFileToString("/proc/self/maps", &maps);
*error_msg = StringPrintf("munmap(%p, %zd) failed for '%s'\n%s",
tail_base_begin, tail_base_size, name_.c_str(),
maps.c_str());
return nullptr;
}
// Don't cause memory allocation between the munmap and the mmap
// calls. Otherwise, libc (or something else) might take this memory
// region. Note this isn't perfect as there's no way to prevent
// other threads to try to take this memory region here.
byte* actual = reinterpret_cast<byte*>(mmap(tail_base_begin, tail_base_size, tail_prot,
flags, fd.get(), 0));
if (actual == MAP_FAILED) {
std::string maps;
ReadFileToString("/proc/self/maps", &maps);
*error_msg = StringPrintf("anonymous mmap(%p, %zd, 0x%x, 0x%x, %d, 0) failed\n%s",
tail_base_begin, tail_base_size, tail_prot, flags, fd.get(),
maps.c_str());
return nullptr;
}
return new MemMap(tail_name, actual, tail_size, actual, tail_base_size, tail_prot, false);
}
void MemMap::MadviseDontNeedAndZero() {
if (base_begin_ != nullptr || base_size_ != 0) {
if (!kMadviseZeroes) {
memset(base_begin_, 0, base_size_);
}
int result = madvise(base_begin_, base_size_, MADV_DONTNEED);
if (result == -1) {
PLOG(WARNING) << "madvise failed";
}
}
}
bool MemMap::Protect(int prot) {
if (base_begin_ == nullptr && base_size_ == 0) {
prot_ = prot;
return true;
}
if (mprotect(base_begin_, base_size_, prot) == 0) {
prot_ = prot;
return true;
}
PLOG(ERROR) << "mprotect(" << reinterpret_cast<void*>(base_begin_) << ", " << base_size_ << ", "
<< prot << ") failed";
return false;
}
bool MemMap::CheckNoGaps(MemMap* begin_map, MemMap* end_map) {
MutexLock mu(Thread::Current(), *Locks::mem_maps_lock_);
CHECK(begin_map != nullptr);
CHECK(end_map != nullptr);
CHECK(HasMemMap(begin_map));
CHECK(HasMemMap(end_map));
CHECK_LE(begin_map->BaseBegin(), end_map->BaseBegin());
MemMap* map = begin_map;
while (map->BaseBegin() != end_map->BaseBegin()) {
MemMap* next_map = GetLargestMemMapAt(map->BaseEnd());
if (next_map == nullptr) {
// Found a gap.
return false;
}
map = next_map;
}
return true;
}
void MemMap::DumpMaps(std::ostream& os) {
MutexLock mu(Thread::Current(), *Locks::mem_maps_lock_);
DumpMapsLocked(os);
}
void MemMap::DumpMapsLocked(std::ostream& os) {
os << maps_;
}
bool MemMap::HasMemMap(MemMap* map) {
void* base_begin = map->BaseBegin();
for (auto it = maps_->lower_bound(base_begin), end = maps_->end();
it != end && it->first == base_begin; ++it) {
if (it->second == map) {
return true;
}
}
return false;
}
MemMap* MemMap::GetLargestMemMapAt(void* address) {
size_t largest_size = 0;
MemMap* largest_map = nullptr;
DCHECK(maps_ != nullptr);
for (auto it = maps_->lower_bound(address), end = maps_->end();
it != end && it->first == address; ++it) {
MemMap* map = it->second;
CHECK(map != nullptr);
if (largest_size < map->BaseSize()) {
largest_size = map->BaseSize();
largest_map = map;
}
}
return largest_map;
}
void MemMap::Init() {
MutexLock mu(Thread::Current(), *Locks::mem_maps_lock_);
if (maps_ == nullptr) {
// dex2oat calls MemMap::Init twice since its needed before the runtime is created.
maps_ = new Maps;
}
}
void MemMap::Shutdown() {
MutexLock mu(Thread::Current(), *Locks::mem_maps_lock_);
delete maps_;
maps_ = nullptr;
}
std::ostream& operator<<(std::ostream& os, const MemMap& mem_map) {
os << StringPrintf("[MemMap: %p-%p prot=0x%x %s]",
mem_map.BaseBegin(), mem_map.BaseEnd(), mem_map.GetProtect(),
mem_map.GetName().c_str());
return os;
}
} // namespace art
|
d2df45f1225e1b73b4ed525eca98cd9d7fc766d8 | 088bbcd6dab4eeb189705a61160157040153ac34 | /447B.cpp | 4ae8d43b1418f3e04cc9cdf57372ea873de3a888 | [] | no_license | pallak8398/Codeforces | b6dae7a1a1cf544a1676a91d32576eac316d78d8 | 35d120175b2bad97da0b3d1fc69521a7aa932274 | refs/heads/main | 2023-06-20T03:28:20.115619 | 2021-07-21T09:35:46 | 2021-07-21T09:35:46 | 385,713,079 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 361 | cpp | 447B.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin>>s;
int k,A[26]={0},max=0;
cin>>k;
for(int i=0;i<26;i++)
{
cin>>A[i];
if(A[i]>=max)
{
max=A[i];
}
}
int ans=0;
for(int i=0;i<s.length();i++)
{
ans+=A[s[i]-'a']*(i+1);
}
for(int i=s.length();i<s.length()+k;i++)
{
ans+=max*(i+1);
}
cout<<ans<<endl;
return 0;
} |
50448cf740f8569936a5621edfd4473b0022c862 | 14f7a1ca01d35398dc1b3c57a9aa99447bb30fbb | /tests/chrono_timer.cpp | 2b5ae9540cb1b43358b403e588157fbef29f45e6 | [
"BSD-3-Clause"
] | permissive | png85/dsnutil_cpp | dd394d8d7a5927db52717a415aa9e8589ae7f616 | d577fec7c76949ef87b7a001ac638893ca672781 | refs/heads/master | 2021-01-16T18:29:33.824868 | 2016-02-19T21:00:02 | 2016-02-19T21:00:02 | 33,381,597 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,533 | cpp | chrono_timer.cpp | #define BOOST_TEST_MODULE "dsn::chrono::timer"
#include <iostream>
#include <thread>
#include <dsnutil/chrono/timer.hpp>
#include <boost/test/unit_test.hpp>
namespace dsn {
namespace chrono {
std::ostream& operator<<(std::ostream& stream, const timer& t)
{
return stream << "timer(" << static_cast<unsigned long long>(t.elapsed().nanoseconds()) << " ns)";
}
}
}
using timer = dsn::chrono::timer;
BOOST_AUTO_TEST_CASE(default_ctor)
{
timer t;
std::cout << "default constructed timer: " << t << std::endl;
}
BOOST_AUTO_TEST_CASE(elapsed)
{
timer t;
std::cout << "testing elapsed() with t = " << t << std::endl;
auto e1 = t.elapsed();
std::cout << "e1 = " << e1.milliseconds() << "ms" << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(50));
auto e2 = t.elapsed();
std::cout << "e2 = " << e2.milliseconds() << "ms" << std::endl;
std::cout << "t = " << t << std::endl;
auto diff = e2 - e1;
BOOST_CHECK(std::chrono::duration_cast<std::chrono::milliseconds>(diff).count() >= 50);
}
BOOST_AUTO_TEST_CASE(reset)
{
timer t;
std::cout << "testing reset() with t = " << t << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(50));
auto e1 = t.elapsed();
std::cout << "e1 = " << e1.milliseconds() << "ms" << std::endl;
t.reset();
std::cout << "t after reset = " << t << std::endl;
auto e2 = t.elapsed();
std::cout << "e2 = " << e2.milliseconds() << "ms" << std::endl;
BOOST_CHECK(e2 < e1);
}
|
e4859655de35ad51ec00d3e7dbef81a9c1cb92a8 | e23bdab2890e5c25a442604d8fec84995a3a75b0 | /src/MonkeyPlayer/Utilities/AlbumTextureManager.cpp | f7225bd23f9be2cdc443d34d5b3123da05601d54 | [] | no_license | mikeallgyer/monkeyplayer | 69bebdf49c5ef149cf56e4dcb41711c2e730275f | 07090dd506a4d7646ee75a3b3478fb8173403f96 | refs/heads/master | 2020-03-26T03:18:58.753459 | 2014-02-14T14:22:33 | 2014-02-14T14:22:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,711 | cpp | AlbumTextureManager.cpp | // AlbumTextureManager.cpp
//
// (C) 2013 Mike Allgyer. All Rights Reserved.
//
// A class for dynamically loading/unloading texture
#include "d3dUtil.h"
#include <vector>
#include <string>
#include "AlbumTextureManager.h"
#include "DatabaseManager.h"
#include "FileManager.h"
#include "Logger.h"
#include "MetadataReader.h"
using namespace std;
using namespace MonkeyPlayer;
//#define TEXTURE_MGR_DBG 1
const int AlbumTextureManager::NUM_CACHEABLE_TEXTURES = 30;
const int AlbumTextureManager::MAX_WEIGHT = 5;
AlbumTextureManager* AlbumTextureManager::mInstance = NULL;
// used for synchronization
CCriticalSection AlbumTextureManager::mCritSection;
AlbumTextureManager::AlbumTextureManager()
{
mCurrIndex = 0;
mStopping = false;
mThreadStopped = false;
string albumCoverFile = FileManager::getContentAsset(std::string("Textures\\UnknownAlbum.jpg"));
D3DXCreateTextureFromFile(gDevice, albumCoverFile.c_str(), &mDefaultTexture);
AfxBeginThread(loaderThread, this);
}
AlbumTextureManager::~AlbumTextureManager()
{
for (unsigned int i = 0; i < mTextures.size(); i++)
{
ReleaseCOM(mTextures[i]->mTexture);
delete mTextures[i];
}
mTextures.clear();
}
/*static*/ AlbumTextureManager* AlbumTextureManager::instance()
{
if (mInstance == NULL)
{
mInstance = snew AlbumTextureManager();
}
return mInstance;
}
/*static*/ void AlbumTextureManager::destroy()
{
if (mInstance != NULL)
{
mInstance->mStopping = true;
int i = 6; // max 3 seconds
while (!mInstance->mThreadStopped && i > 0)
{
Sleep(500);
i--;
}
delete mInstance;
mInstance = NULL;
}
}
bool AlbumTextureManager::isTextureBad(int albumId)
{
if (mBadAlbums.find(albumId) != mBadAlbums.end())
{
return mBadAlbums[albumId];
}
return false;
}
IDirect3DTexture9* AlbumTextureManager::getTexture(int albumId)
{
bool junk;
return getTexture(albumId, junk);
}
IDirect3DTexture9* AlbumTextureManager::getTexture(int albumId, bool &usedDefault)
{
IDirect3DTexture9* tex = mDefaultTexture;
usedDefault = true;
if (albumId >= 0)
{
CSingleLock lock(&mCritSection);
lock.Lock();
#ifdef TEXTURE_MGR_DBG
Logger::instance()->write(string("AlbumTextureManager::getTexture() LOCK"));
#endif
if (mBadAlbums.find(albumId) == mBadAlbums.end())
{
for (unsigned int i = 0; i < mTextures.size(); i++)
{
if (mTextures[i]->mAlbumId == albumId)
{
tex = mTextures[i]->mTexture;
mTextures[i]->mWeight= min(MAX_WEIGHT, mTextures[i]->mWeight+ 1);
usedDefault = false;
break;
}
}
if (tex == mDefaultTexture)
{
mTexturesToLoad.insert(albumId);
}
}
#ifdef TEXTURE_MGR_DBG
Logger::instance()->write(string("AlbumTextureManager::getTexture() UNLOCK"));
#endif
lock.Unlock();
}
return tex;
}
void AlbumTextureManager::update(float dt)
{
CSingleLock lock(&mCritSection);
lock.Lock();
#ifdef TEXTURE_MGR_DBG
Logger::instance()->write(string("AlbumTextureManager::Update() LOCK"));
#endif
for (unsigned int i = 0; i < mTextures.size(); i++)
{
mTextures[i]->mWeight= max(0, mTextures[i]->mWeight- 1);
}
#ifdef TEXTURE_MGR_DBG
Logger::instance()->write(string("AlbumTextureManager::Update() UNLOCK"));
#endif
lock.Unlock();
}
int AlbumTextureManager::getIndexToReplace()
{
int index = mCurrIndex;
int minWeight = MAX_WEIGHT;
for (unsigned int i = 0; i < mTextures.size(); i++)
{
int index = (i + mCurrIndex) % mTextures.size();
if (mTextures[index]->mWeight < minWeight)
{
index = index;
minWeight = mTextures[index]->mWeight;
}
}
return index;
}
/*static*/ UINT AlbumTextureManager::loaderThread(LPVOID pParam)
{
AlbumTextureManager* mgr = (AlbumTextureManager*)pParam;
do
{
while (mgr->mTexturesToLoad.size() > 0)
{
CSingleLock lock(&mCritSection);
lock.Lock();
#ifdef TEXTURE_MGR_DBG
Logger::instance()->write(string("AlbumTextureManager::loaderThread() LOCK"));
#endif
set<int>::iterator iter = mgr->mTexturesToLoad.begin();
IDirect3DTexture9* tex = loadTexture(*iter);
if (tex != NULL)
{
if (mgr->mTextures.size() < NUM_CACHEABLE_TEXTURES)
{
AlbumTextureManager::AlbumTexture* a = snew AlbumTextureManager::AlbumTexture();
a->mAlbumId = (*iter);
a->mWeight= 0;
a->mTexture = tex;
mgr->mTextures.push_back(a);
mgr->mCurrIndex = mgr->mTextures.size() - 1;
}
else
{
int index = mgr->getIndexToReplace();
mgr->mCurrIndex = index + 2;
if (mgr->mCurrIndex >= mgr->mTextures.size())
{
mgr->mCurrIndex = 1;
}
ReleaseCOM(mgr->mTextures[index]->mTexture);
mgr->mTextures[index]->mAlbumId = (*iter);
mgr->mTextures[index]->mWeight= MAX_WEIGHT;
mgr->mTextures[index]->mTexture = tex;
}
}
else
{
mgr->mBadAlbums[*iter] = true;
}
mgr->mTexturesToLoad.erase(iter);
//mgr->mTexturesToLoad.clear();
#ifdef TEXTURE_MGR_DBG
Logger::instance()->write(string("AlbumTextureManager::loaderThread() UNLOCK"));
#endif
lock.Unlock();
Sleep(100);
}
Sleep(1000);
} while(!mgr->mStopping);
mgr->mThreadStopped = false;
return 0;
}
/*static*/ IDirect3DTexture9* AlbumTextureManager::loadTexture(int albumId)
{
vector<Track*> tracks = DatabaseManager::instance()->getTracks(albumId);
IDirect3DTexture9* tex = NULL;
AlbumArt *art = NULL;
bool found = false;
for (unsigned int i = 0; i < tracks.size(); i++)
{
if (!found)
{
art = MetadataReader::getAlbumArt(tracks[i]->Filename.c_str());
if (art != NULL)
{
found = true;
}
}
delete tracks[i];
}
if (art != NULL)
{
HRESULT hr = D3DXCreateTextureFromFileInMemory(gDevice, art->data, art->length, &tex);
if (hr != D3D_OK)
{
ReleaseCOM(tex);
tex = NULL;
}
delete art;
}
return tex;
}
|
b718973a88371ac4277123a0138b886649c30066 | 120cfe04c3123d6ddf7982c2b53304d41a92635a | /MapleStory/MapleStory/Bitmap_Manager.h | 586c972ceba13b061975bf1678e8537b3ba604cb | [] | no_license | chominju/MapleStory | d5ba0edfda71a8ff29265f0abae0c2de17b2fac7 | be52e4f007a908edd47ceb02650cda8e6244e4e9 | refs/heads/master | 2023-05-15T02:03:54.658221 | 2021-06-03T13:12:09 | 2021-06-03T13:12:09 | 365,113,563 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 654 | h | Bitmap_Manager.h | #pragma once
class CMyBitmap;
class CBitmap_Manager
{
private:
CBitmap_Manager();
~CBitmap_Manager();
public:
static CBitmap_Manager* Get_Instance()
{
if (nullptr == m_instance)
m_instance = new CBitmap_Manager;
return m_instance;
}
static void Destroy_Instance()
{
if (m_instance)
{
delete m_instance;
m_instance = nullptr;
}
}
public:
HDC Get_memDC(const TCHAR* imageKey);
void Insert_Bitmap_Manager(const TCHAR* imageKey, const TCHAR* imagePath);
Pos_int Get_Image_Size(const TCHAR* imageKey);
void Release_Bitmap_Manager();
private:
static CBitmap_Manager* m_instance;
map<const TCHAR*, CMyBitmap*> m_mapBitmap;
};
|
64f1272c98c40304a14e17d1e4b40852fae96a6c | c2ebaf489c1932ca852925219c4846377ee23dd0 | /cplusplus/exercise3/temp_conversion_header/conversions.cpp | fd0a53d5c143e09d7bd4246dad2d14c5448c0124 | [] | no_license | edlym96/misc-projects | 0c97be0b0322dd90ea489004a898593b250ee9a7 | e91a79ce91e9ed7a6575e6b8db8227a498c9f131 | refs/heads/master | 2020-06-19T21:33:41.316396 | 2019-08-08T21:37:46 | 2019-08-08T21:37:46 | 196,881,105 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 244 | cpp | conversions.cpp | #include <iostream>
#include"conversions.h"
using namespace std;
double celsius_of(int fahr){
return (static_cast<double>(5)/9) * (fahr-32);
}
double absolute_value_of(int fahr){
return ((static_cast<double>(5)/9)*(fahr-32)) + 273.15;
}
|
61ce9bc5e6a2a8b3720da66a8f62c0eb5e01cb3f | 86fc48ca33f2f155f228bb71a62e0299d8719077 | /Amaya/thotlib/internals/h/AmayaStatsThread.h | 2913ee4763bd2b9fc17ba5f51d8e036a01085365 | [] | no_license | lcarcone/amaya-test | e0af8d73df2f94c8fb338389d4e8ad7d22faae0b | bfdc10e05b1276a4d0d1e468638583b9e1aff97b | refs/heads/master | 2023-04-28T01:40:50.149309 | 2023-04-25T06:44:34 | 2023-04-25T06:44:34 | 4,123,257 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 304 | h | AmayaStatsThread.h | #ifdef _WX
#ifndef __AMAYASTATSTHREAD_H__
#define __AMAYASTATSTHREAD_H__
#include "wx/wx.h"
#include "wx/thread.h"
class AmayaStatsThread : public wxThread
{
public:
AmayaStatsThread();
virtual ~AmayaStatsThread();
void * Entry();
};
#endif // __AMAYASTATSTHREAD_H__
#endif /* #ifdef _WX */
|
8769bd623c0bb042a3de6089a3c6465a786e43e0 | 18ea049501fdaf523daefa4d8fa978385517fa24 | /module2/geometry/D_1.cpp | 13e8e3edd35bc93513921da8be4bcacd228abf21 | [] | no_license | vanka857/Algorithms-DS-3term | 0fb32f9ec1392d0aa3d23cecd4d8a45f31516741 | 7fe43f620093706aff7cd7a63d51ae46db70e7bb | refs/heads/master | 2023-03-23T03:57:36.329025 | 2021-03-12T21:43:19 | 2021-03-12T21:43:19 | 304,012,289 | 0 | 0 | null | 2021-03-12T21:43:20 | 2020-10-14T12:45:28 | C++ | UTF-8 | C++ | false | false | 2,651 | cpp | D_1.cpp | //D1. Возможно глупая ссора
// Ограничение времени 1 секунда
// Ограничение памяти 64Mb
//Ввод стандартный ввод или input.txt
// Вывод стандартный вывод или output.txt
// Арсений опять уснул. И снова на планете Ка-Пэкс без него никак —
// два фермера поссорились из-за того, что их территории могут перекрываться.
// Естественно, как самого рассудительного, Арсения позвали урегулировать конфликт.
// Для начала он решил узнать, насколько серьезен конфликт. Для этого он решил узнать,
// пересекаются ли фермы вообще. Помогите Арсению это понять, если известно,
// что каждая ферма представляет собой выпуклый многоугольник.
//
//Формат ввода
// Первая строка содержит число N точек первого многоугольника.
// Затем идут N строк с координатами точек первого многоугольника по
// часовой стрелке (координаты – действительные числа).
//
// Второй прямоугольник задается аналогично. N, M ≤ 80000.
//
//Формат вывода
// Выведите “YES”, если фермы пересекаются, и “NO”, если нет (без кавычек).
//
// Реализуйте алгоритм за O(N+M). (СУММА МИНКОВСКОГО)
#include <iostream>
#include <vector>
#include "geometry2D.cpp"
template<typename T>
Polygon<T> readPolygon(std::istream & in) {
size_t N;
in >> N;
std::vector<Point<T>> vertices;
vertices.reserve(N);
for (size_t i = 0; i < N; ++i) {
Point<T> p{};
std::cin >> p;
vertices.emplace_back(p);
}
return Polygon<T>(vertices);
}
int
main() {
using T = double;
auto K = readPolygon<T>(std::cin);
auto L_ = readPolygon<T>(std::cin);
// make reflected polygon L_
L_.reflex({0, 0});
// make Minkovskiy sum
auto sum = K + L_;
// check if "sum contains Point(0, 0)". It is equivalents to "K intersects L".
std::cout << (sum.containsPoint({0, 0}) ? "YES" : "NO") << std::endl;
} |
a4fdfe90ba52d5452d5353c6b1772f3796be959c | 809f20f852559f3d51fe31f148025ae0dcd18c57 | /layouts/layouts/CPhotoViewer.h | f0d5d4019d77a5b9f9fa86171870e9e89af3fe0a | [] | no_license | fengxinfeng/fxf | a0bc9f46dc8f59744317d41809faff3c3cc7b12c | cb8ae953fa8a1d14f0459b64e76634d31cb98793 | refs/heads/master | 2020-05-22T08:09:27.109086 | 2020-03-22T10:27:12 | 2020-03-22T10:27:12 | 11,965,616 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,506 | h | CPhotoViewer.h | #pragma once
/*
*date: 2020.03.08
*author: fengxinfeng
*/
#include "CSubVBox.h"
#include <vector>
namespace nui {
struct NMedia {
int mediatype; // 0, picture; 1, video
std::wstring imageurl; // image location
std::wstring videourl; // video location
} ;
class CPhotoViewer : public CSubVBox
{
public:
CPhotoViewer(ui::VBox *p);
~CPhotoViewer();
/*
* 二次构造
* @param data, 初始化数据
*/
void Construct(std::vector<NMedia> data);
void SetVisible(bool value);
void Start();
void Stop();
void DisplayNext();
protected:
ui::Control* CreateControl(const std::wstring& pstrClass);
//void HandleMessage(ui::EventArgs &msg);
private:
void ClickToLeft();
void ClickToRight();
void ToLeft();
void ToRight();
void AutoToLeft();
void SetBorder(int num);
void CallJS();
void PlayVideo();
void PauseVideo();
void OnLoadEnd(int httpStatusCode);
void OnAfterCreated(CefRefPtr<CefBrowser> browser);
void LoadVideo(int serno);
private:
bool m_hasinited;
std::vector<ui::Label *> m_vector;
std::vector<NMedia> m_data;
int m_StepLength;
int m_Serno;
int m_LeftMargin;
int m_RightMargin;
ui::Label *m_PlayControl;
ui::Label *m_bigimage;
int m_MiddleNO;
HWND m_hwnd;
bool m_ismoving;
nim_comp::CefControlBase* m_cefvideo;
nim_comp::CefControlBase* cef_control_dev_;
bool m_isloadend;
int m_taskwaittoload;
};
}
|
d2f44279c8a98a245539b7a5670ce351a77939a8 | 5ec06dab1409d790496ce082dacb321392b32fe9 | /clients/cpp-qt5/generated/client/OAIComAdobeGraniteTranslationCoreImplTranslationManagerImplProperties.h | be72b64bd4c1bad45a9b71504f8f727110d95da8 | [
"Apache-2.0"
] | permissive | shinesolutions/swagger-aem-osgi | e9d2385f44bee70e5bbdc0d577e99a9f2525266f | c2f6e076971d2592c1cbd3f70695c679e807396b | refs/heads/master | 2022-10-29T13:07:40.422092 | 2021-04-09T07:46:03 | 2021-04-09T07:46:03 | 190,217,155 | 3 | 3 | Apache-2.0 | 2022-10-05T03:26:20 | 2019-06-04T14:23:28 | null | UTF-8 | C++ | false | false | 2,012 | h | OAIComAdobeGraniteTranslationCoreImplTranslationManagerImplProperties.h | /**
* Adobe Experience Manager OSGI config (AEM) API
* Swagger AEM OSGI is an OpenAPI specification for Adobe Experience Manager (AEM) OSGI Configurations API
*
* OpenAPI spec version: 1.0.0-pre.0
* Contact: opensource@shinesolutions.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* OAIComAdobeGraniteTranslationCoreImplTranslationManagerImplProperties.h
*
*
*/
#ifndef OAIComAdobeGraniteTranslationCoreImplTranslationManagerImplProperties_H_
#define OAIComAdobeGraniteTranslationCoreImplTranslationManagerImplProperties_H_
#include <QJsonObject>
#include "OAIOAIConfigNodePropertyString.h"
#include "OAIObject.h"
namespace OpenAPI {
class OAIComAdobeGraniteTranslationCoreImplTranslationManagerImplProperties: public OAIObject {
public:
OAIComAdobeGraniteTranslationCoreImplTranslationManagerImplProperties();
OAIComAdobeGraniteTranslationCoreImplTranslationManagerImplProperties(QString json);
~OAIComAdobeGraniteTranslationCoreImplTranslationManagerImplProperties();
void init();
void cleanup();
QString asJson () override;
QJsonObject asJsonObject() override;
void fromJsonObject(QJsonObject json) override;
OAIComAdobeGraniteTranslationCoreImplTranslationManagerImplProperties* fromJson(QString jsonString) override;
OAIConfigNodePropertyString* getDefaultConnectorName();
void setDefaultConnectorName(OAIConfigNodePropertyString* default_connector_name);
OAIConfigNodePropertyString* getDefaultCategory();
void setDefaultCategory(OAIConfigNodePropertyString* default_category);
virtual bool isSet() override;
private:
OAIConfigNodePropertyString* default_connector_name;
bool m_default_connector_name_isSet;
OAIConfigNodePropertyString* default_category;
bool m_default_category_isSet;
};
}
#endif /* OAIComAdobeGraniteTranslationCoreImplTranslationManagerImplProperties_H_ */
|
dc81a87a151d33d0deaccca37ea2f838e878de57 | 83ceae07344b56496c90d33d0b78cb58b7c56f3e | /VideoEditorApp/convertCode/convertCode/audio_utils.h | 6a39ae7a3a119cc8410f986330efb83c7d2f8e14 | [] | no_license | Romantic-LiXuefeng/VideoEditor | aca2195a0ab9e8e0c48537f715cfae4c7732676f | 925fd839b1f2652586c7a70e21e62200fb269580 | refs/heads/master | 2021-05-13T20:30:17.471243 | 2017-04-08T04:17:53 | 2017-04-08T04:17:53 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 4,745 | h | audio_utils.h | /*
* audio_utils.h
*
* Created on: 2014年7月16日
* Author: 尚博才
*/
#ifndef AUDIO_UTILS_H_
#define AUDIO_UTILS_H_
#ifdef __ANDROID__
#include <android/log.h>
#else
#include <stdio.h>
#include <assert.h>
#endif
#include <base/f_audio_types.h>
//日志级别默认从1开始,与安卓的枚举类型值可能不对应
//通过自定义F_AUDIO_LOG_LEVEL_VERBOSE可以调整
#ifndef F_AUDIO_LOG_LEVEL_VERBOSE
#define F_AUDIO_LOG_LEVEL_VERBOSE 2
#endif
#define F_AUDIO_LOG_LEVEL_DEBUG (F_AUDIO_LOG_LEVEL_VERBOSE + 1)
#define F_AUDIO_LOG_LEVEL_INFO (F_AUDIO_LOG_LEVEL_VERBOSE + 2)
#define F_AUDIO_LOG_LEVEL_WARNING (F_AUDIO_LOG_LEVEL_VERBOSE + 3)
#define F_AUDIO_LOG_LEVEL_ERROR (F_AUDIO_LOG_LEVEL_VERBOSE + 4)
#define F_AUDIO_LOG_LEVEL_FATAL (F_AUDIO_LOG_LEVEL_VERBOSE + 5)
#define F_AUDIO_LOG_LEVEL_SILENT (F_AUDIO_LOG_LEVEL_VERBOSE + 6)
#ifndef F_AUDIO_LOG_TAG
# define F_AUDIO_LOG_TAG __FILE__
#endif
#ifndef F_AUDIO_LOG_LEVEL
# define F_AUDIO_LOG_LEVEL F_AUDIO_LOG_LEVEL_VERBOSE
#endif
#define F_AUDIO_LOG_NOOP (void) 0
#ifdef __ANDROID__ //安卓log输出到logcat
# define F_AUDIO_LOG_PRINT(level, fmt, ...) \
__android_log_print(level, F_AUDIO_LOG_TAG, "(%s:%u) %s: " fmt, \
__FILE__, __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__)
#else // 其他默认输出到控制台
# define F_AUDIO_LOG_PRINT(level, fmt, ...) \
printf("[level %d](%s:%u) %s: " fmt "\n", \
level, __FILE__, __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__)
#endif
#if F_AUDIO_LOG_LEVEL_VERBOSE >= F_AUDIO_LOG_LEVEL
# define F_AUDIO_LOG_VERBOSE(fmt, ...) \
F_AUDIO_LOG_PRINT(F_AUDIO_LOG_LEVEL_VERBOSE, fmt, ##__VA_ARGS__)
#else
# define F_AUDIO_LOG_VERBOSE(...) F_AUDIO_LOG_NOOP
#endif
#if F_AUDIO_LOG_LEVEL_DEBUG >= F_AUDIO_LOG_LEVEL
# define F_AUDIO_LOG_DEBUG(fmt, ...) \
F_AUDIO_LOG_PRINT(F_AUDIO_LOG_LEVEL_DEBUG, fmt, ##__VA_ARGS__)
#else
# define F_AUDIO_LOG_DEBUG(...) F_AUDIO_LOG_NOOP
#endif
#if F_AUDIO_LOG_LEVEL_INFO >= F_AUDIO_LOG_LEVEL
# define F_AUDIO_LOG_INFO(fmt, ...) \
F_AUDIO_LOG_PRINT(F_AUDIO_LOG_LEVEL_INFO, fmt, ##__VA_ARGS__)
#else
# define F_AUDIO_LOG_INFO(...) F_AUDIO_LOG_NOOP
#endif
#if F_AUDIO_LOG_LEVEL_WARNING >= F_AUDIO_LOG_LEVEL
# define F_AUDIO_LOG_WARNING(fmt, ...) \
F_AUDIO_LOG_PRINT(F_AUDIO_LOG_LEVEL_WARNING, fmt, ##__VA_ARGS__)
#else
# define F_AUDIO_LOG_WARNING(...) F_AUDIO_LOG_NOOP
#endif
#if F_AUDIO_LOG_LEVEL_ERROR >= F_AUDIO_LOG_LEVEL
# define F_AUDIO_LOG_ERROR(fmt, ...) \
F_AUDIO_LOG_PRINT(F_AUDIO_LOG_LEVEL_ERROR, fmt, ##__VA_ARGS__)
#else
# define F_AUDIO_LOG_ERROR(...) F_AUDIO_LOG_NOOP
#endif
#if F_AUDIO_LOG_LEVEL_FATAL >= F_AUDIO_LOG_LEVEL
# define F_AUDIO_LOG_FATAL(fmt, ...) \
F_AUDIO_LOG_PRINT(F_AUDIO_LOG_LEVEL_FATAL, fmt, ##__VA_ARGS__)
#else
# define F_AUDIO_LOG_FATAL(...) F_AUDIO_LOG_NOOP
#endif
#if F_AUDIO_LOG_LEVEL_SILENT >= F_AUDIO_LOG_LEVEL
# define F_AUDIO_LOG_SILENT(fmt, ...) \
F_AUDIO_LOG_PRINT(F_AUDIO_LOG_LEVEL_SILENT, fmt, ##__VA_ARGS__)
#else
# define F_AUDIO_LOG_SILENT(...) F_AUDIO_LOG_NOOP
#endif
#if F_AUDIO_LOG_LEVEL_SILENT >= F_AUDIO_LOG_LEVEL
# ifdef __ANDROID__
# define F_AUDIO_LOG_ASSERT(expression, fmt, ...) \
if (!(expression)) \
{ \
__android_log_assert(#expression, F_AUDIO_LOG_TAG, \
"(%s:%u) %s: " fmt, __FILE__, __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__); \
}
# else
# define F_AUDIO_LOG_ASSERT(expression, fmt, ...) \
if (!(expression)) \
{ \
printf("[level %d](%s:%u) %s: " fmt "\n", \
F_AUDIO_LOG_LEVEL_SILENT, __FILE__, __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__); \
assert(#expression); \
}
# endif
#else
# define F_AUDIO_LOG_ASSERT(...) F_AUDIO_LOG_NOOP
#endif
#ifndef INT64_C
#define INT64_C(c) (c##LL)
#define UINT64_C(c) (c##ULL)
#endif
class AudioUtil{
public:
//AudioEncoderName转字符串,编码器名称
//codec_name 输入参数
//string 输出参数
static void AudioEncoderName2String(const AudioEncoderName codec_name, char* string);
#ifndef __CANNOT_USE_LIBAV__
static int FSampleFormat2libav(FSampleFormat sample_format);
static long long AudioChannelLayout2libav(FAudioChannelLayout audio_channel_layout);
static FSampleFormat libav2FSampleFormat(int sample_format);
static FAudioChannelLayout libav2AudioChannelLayout(long long audio_channel_layout);
#endif //__CANNOT_USE_LIBAV__
};
#endif // AUDIO_UTILS_H_
|
37bc25ffdf97139a4f9d07def20577eb5142e010 | 36077401760f558cb86482ab3bc4ec036b3c6606 | /src/core/node.cpp | 136bb15eb8e4b7c1fa1dd611c00bbc5f31cb48df | [
"Apache-2.0",
"MIT"
] | permissive | binyangvip/smartmouse-simulator | 80d1e392b2ccbf37158fbe7dab40883b49058781 | de212fd4206485b41987587924c5d5c6a59a2bde | refs/heads/master | 2023-03-17T08:02:39.489556 | 2018-11-23T07:44:52 | 2018-11-23T07:44:52 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 924 | cpp | node.cpp | #include <core/node.h>
namespace ssim {
Node::Node(RowCol row_col) : row_col(row_col) {}
Node::Node(MazeIndex const row, MazeIndex const col) : row_col{row, col} {}
bool Node::operator==(Node const &other) const {
// TODO replace all && || with and or
return Row() == other.Row() and Col() == other.Col();
}
bool Node::operator!=(Node const &other) const {
return !(operator==(other));
}
void Node::Reset() {
weight = std::numeric_limits<decltype(weight)>::max();
distance = 0;
known = false;
visited = false;
}
MazeIndex Node::Row() const {
return row_col.row;
}
MazeIndex Node::Col() const {
return row_col.col;
}
RowCol Node::GetRowCol() const {
return row_col;
}
bool RowCol::operator==(const RowCol &other) const {
return row == other.row and col == other.col;
}
bool RowCol::operator!=(const RowCol &other) const {
return row != other.row or col != other.col;
}
} // namespace ssim
|
261117dc709d6fb5c2cbb0482f0aff78f695a6af | c424714fdd5bd34c4dcd1977cb6814cbdeba9a7a | /src/core/buffer.h | 3b664edf34e54096af85cf78d06a991dbfaec016 | [] | no_license | johndpope/LuisaRender | ea5d1b3678ee4aaf4b1202101c2ce258eca1acda | 7d6bb74a2174c8975c1d0757098a605ba5f8a2d5 | refs/heads/master | 2020-09-04T05:38:48.322807 | 2019-11-04T17:45:34 | 2019-11-04T17:45:34 | 219,668,898 | 1 | 0 | null | 2019-11-05T05:58:45 | 2019-11-05T05:58:44 | null | UTF-8 | C++ | false | false | 1,051 | h | buffer.h | //
// Created by Mike Smith on 2019/10/24.
//
#pragma once
#include <vector>
#include <util/noncopyable.h>
namespace luisa {
enum struct BufferStorageTag {
DEVICE_PRIVATE,
MANAGED
};
class Buffer : util::Noncopyable {
protected:
size_t _capacity;
BufferStorageTag _storage;
public:
Buffer(size_t capacity, BufferStorageTag storage) noexcept : _capacity{capacity}, _storage{storage} {};
virtual ~Buffer() noexcept = default;
virtual void upload(size_t begin, size_t end) = 0;
virtual void upload(const void *host_data, size_t size, size_t offset) = 0;
void upload() { upload(0ul, _capacity); }
void upload(const void *host_data, size_t size) { upload(host_data, size, 0ul); }
virtual void synchronize(struct KernelDispatcher &dispatch) = 0;
[[nodiscard]] virtual void *data() = 0;
[[nodiscard]] virtual const void *data() const = 0;
[[nodiscard]] size_t capacity() const noexcept { return _capacity; }
[[nodiscard]] BufferStorageTag storage() const noexcept { return _storage; }
};
}
|
2b456db7f6e9b32d6fae68ee6c056943315b2359 | 5d8fdca891885b7d0a165966cef656d931b35dea | /Week 08/findMedian.cpp | 4858214bdf899522a9fb70658d83d2510487c395 | [] | no_license | katrinechow/OSU-CS-161 | 3c8e29e5061230061748c1b3c6f44a9a81e1dd3a | f56214c45e07045071dfbe4c30c97bf63e0c9406 | refs/heads/master | 2020-06-08T16:02:58.755405 | 2019-06-22T17:02:39 | 2019-06-22T17:02:39 | 193,258,615 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 901 | cpp | findMedian.cpp | /*******************************************************************************
** Author: Katrine Chow
** Date: November 8, 2017
** Description: findMedian(int intArray[]. int size)
** This fucntion takes an array of int and the size of the array,
** and return the median of the array.
*******************************************************************************/
//Using built-in sort function.
#include <algorithm>
using std::sort;
double findMedian(int intArray[], int size)
{
//Sort the array in ascending order.
sort(intArray, intArray+size);
//If even elements, return average of the middle values.
if(size%2==0)
{
double num1 = intArray[(size/2) - 1];
double num2 = intArray[size/2];
return (num1 + num2)/2;
}
//If total elements is odd, return the number in the middle.
else
{
return intArray[(size-1)/2];
}
}
|
f3757ec737d577b92e69e881b90c4f284f820b84 | d61eab31f4d1aa5f49bcbe60f8fe21894e70da8d | /problems/leetcode/0012.cpp | d533bd9729a3174c48026a375d24e335b4d7246b | [] | no_license | JunrQ/dsa | 204adb18ce28969626a2f8aa5692e58b395a03bb | 4723bf3ada78b56f2e6c456d37adcf96eb5f8941 | refs/heads/master | 2022-12-03T05:28:09.698758 | 2020-08-14T01:10:07 | 2020-08-14T01:10:07 | 173,013,097 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,717 | cpp | 0012.cpp | /**
* 12. 整数转罗马数字
*
* 罗马数字包含以下七种字符: I, V, X, L,C,D 和 M。
*
* 字符 数值
* I 1
* V 5
* X 10
* L 50
* C 100
* D 500
* M 1000
*
* 例如, 罗马数字 2 写做 II ,即为两个并列的 1。12 写做 XII ,即为 X + II 。
* 27 写做 XXVII, 即为 XX + V + II 。
*
* 通常情况下,罗马数字中小的数字在大的数字的右边。但也存在特例,例如 4 不写做 IIII,而是 IV。
* 数字 1 在数字 5 的左边,所表示的数等于大数 5 减小数 1 得到的数值 4 。
* 同样地,数字 9 表示为 IX。这个特殊的规则只适用于以下六种情况:
*
* I 可以放在 V (5) 和 X (10) 的左边,来表示 4 和 9。
* X 可以放在 L (50) 和 C (100) 的左边,来表示 40 和 90。
* C 可以放在 D (500) 和 M (1000) 的左边,来表示 400 和 900。
* 给定一个整数,将其转为罗马数字。输入确保在 1 到 3999 的范围内。
*
*/
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
string intToRoman(int num) {
int nums[] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
string romans[] = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};
int index = 0;
string res;
while (index < 13) {
while (num >= nums[index]) {
res += romans[index]; // TODO
num -= nums[index];
}
index++;
}
return res;
}
};
|
271e6e8f6b200e8c7f7c87c25100b69e541f9b76 | c6073b089b98d9ea8410c8ccf9d5471cc54b8af7 | /src/ast.cc | 171699bb258aaa58506fa3282ee6bcb9380ed41e | [
"MIT"
] | permissive | zacklukem/llang | 8562ce7472b5ec865de0441070fe80bf44d9560e | 8538bd0deaabfca40787c709cd5dd32dd62c0c8a | refs/heads/main | 2023-04-07T18:31:15.871149 | 2021-04-12T15:22:58 | 2021-04-12T15:22:58 | 356,061,561 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,043 | cc | ast.cc | #include "ast.hh"
#include <llvm/Support/Casting.h>
using namespace llang;
std::ostream& operator<<(std::ostream& out, const llang::Node& node) {
node.print(out);
return out;
}
std::unique_ptr<Expression> VariableExpr::clone() const {
return std::make_unique<VariableExpr>(state, value);
}
std::unique_ptr<Expression> DotExpr::clone() const {
return std::make_unique<DotExpr>(lhs->clone(), rhs);
}
std::unique_ptr<Expression> ArrayAccessExpr::clone() const {
return std::make_unique<ArrayAccessExpr>(state, target->clone(), index->clone());
}
std::unique_ptr<Expression> UnaryExpr::clone() const {
return std::make_unique<UnaryExpr>(oper, rhs->clone());
}
bool PtrType::operator==(const Type& rhs) const {
// TODO: ptr el type
if (!llvm::isa<PtrType>(rhs))
return false;
return true;
}
bool IntType::operator==(const Type& rhs) const {
if (!llvm::isa<IntType>(rhs))
return false;
return true;
}
bool FloatType::operator==(const Type& rhs) const {
if (!llvm::isa<FloatType>(rhs))
return false;
return true;
}
bool StructType::operator==(const Type& rhs) const {
if (!llvm::isa<StructType>(rhs))
return false;
return true;
}
bool VoidType::operator==(const Type& rhs) const {
if (!llvm::isa<VoidType>(rhs))
return false;
return true;
}
std::string PtrType::str() const { return type->str() + "*"; }
std::string IntType::str() const { return "i" + std::to_string(size); }
std::string FloatType::str() const { return "f" + std::to_string(size); }
std::string StructType::str() const { return name.str(); }
std::string VoidType::str() const { return "void"; }
void Document::print(std::ostream& target) const {}
void Block::print(std::ostream& target) const {}
void LetStatement::print(std::ostream& target) const {}
void ReturnStatement::print(std::ostream& target) const {}
void IfStatement::print(std::ostream& target) const {}
void WhileStatement::print(std::ostream& target) const {}
void ForStatement::print(std::ostream& target) const {}
void AssignExpr::print(std::ostream& target) const {
target << "(= " << *lhs << ' ' << *rhs << ")";
}
void BinaryExpr::print(std::ostream& target) const {
target << "(";
switch (oper) {
case ADD:
target << '+';
break;
case SUB:
target << '-';
break;
case MUL:
target << '*';
break;
case DIV:
target << '/';
break;
case EQ:
target << "==";
break;
case LT:
target << "<";
break;
case GT:
target << ">";
break;
case GTE:
target << ">=";
break;
case LTE:
target << "<=";
break;
}
target << ' ' << *lhs << ' ' << *rhs << ")";
}
void UnaryExpr::print(std::ostream& target) const {
target << "("
<< "unary_temp" << ' ' << *rhs << ")";
}
void CallExpr::print(std::ostream& target) const {
target << "(" << this->target.str();
for (auto& arg : args) {
target << ' ' << *arg;
}
target << ")";
}
void VariableExpr::print(std::ostream& target) const { target << value.str(); }
void DotExpr::print(std::ostream& target) const {
target << "(. " << *lhs << ' ' << rhs.str() << ")";
}
void ArrayAccessExpr::print(std::ostream& target) const {
target << "("
<< "[]" << ' ' << *this->target << ' ' << *index << ")";
}
void FloatLiteral::print(std::ostream& target) const { target << value.str(); }
void StringLiteral::print(std::ostream& target) const { target << value.str(); }
void IntLiteral::print(std::ostream& target) const { target << value.str(); }
void StructLiteral::print(std::ostream& target) const {
target << "{" << name.str();
for (auto& field : fields) {
target << " (" << field.first.str() << ' ' << *field.second << ")";
}
target << "}";
}
void ProtoFunc::print(std::ostream& target) const {}
void ExternDecl::print(std::ostream& target) const {}
void FunctionDecl::print(std::ostream& target) const {}
void StructProto::print(std::ostream& target) const {}
void ImportDecl::print(std::ostream& target) const {
target << "import " << file_name.str() << ";";
}
|
47e11bfcbab0ccbbbf05a09910fa804be5f42aa5 | 9de0cec678bc4a3bec2b4adabef9f39ff5b4afac | /PWGJE/EMCALJetTasks/AliJetTriggerSelectionTask.cxx | a08f8cdc75def03316c96813d09615d2661dba03 | [] | permissive | alisw/AliPhysics | 91bf1bd01ab2af656a25ff10b25e618a63667d3e | 5df28b2b415e78e81273b0d9bf5c1b99feda3348 | refs/heads/master | 2023-08-31T20:41:44.927176 | 2023-08-31T14:51:12 | 2023-08-31T14:51:12 | 61,661,378 | 129 | 1,150 | BSD-3-Clause | 2023-09-14T18:48:45 | 2016-06-21T19:31:29 | C++ | UTF-8 | C++ | false | false | 4,575 | cxx | AliJetTriggerSelectionTask.cxx | // $Id$
//
// Jet trigger selection task.
//
// Author: S.Aiola
#include <TLorentzVector.h>
#include <TMath.h>
#include <TF1.h>
#include "AliVEvent.h"
#include "AliVCluster.h"
#include "AliEmcalJet.h"
#include "AliLog.h"
#include "AliVVZERO.h"
#include "AliESDUtils.h"
#include "AliJetTriggerSelectionTask.h"
ClassImp(AliJetTriggerSelectionTask)
//________________________________________________________________________
AliJetTriggerSelectionTask::AliJetTriggerSelectionTask() :
AliAnalysisTaskEmcalJet("AliJetTriggerSelectionTask", kFALSE),
fEnergyThreshold(0),
fMaxDistance2(0.0225),
fTriggerBits(AliVEvent::kEMCEJE),
fTaskSettingsOk(kFALSE),
fNTriggers(0),
fVZERO(0),
fV0ATotMult(0),
fV0CTotMult(0)
{
// Default constructor.
for (Int_t i = 0; i < 999; i++) {
fTrigPos[i][0] = -999;
fTrigPos[i][1] = -999;
}
}
//________________________________________________________________________
AliJetTriggerSelectionTask::AliJetTriggerSelectionTask(const char *name) :
AliAnalysisTaskEmcalJet(name, kFALSE),
fEnergyThreshold(0),
fMaxDistance2(0.0225),
fTriggerBits(AliVEvent::kEMCEJE),
fTaskSettingsOk(kFALSE),
fNTriggers(0),
fVZERO(0),
fV0ATotMult(0),
fV0CTotMult(0)
{
// Standard constructor.
for (Int_t i = 0; i < 999; i++) {
fTrigPos[i][0] = -999;
fTrigPos[i][1] = -999;
}
}
//________________________________________________________________________
void AliJetTriggerSelectionTask::ExecOnce()
{
// Initialize the task.
AliAnalysisTaskEmcalJet::ExecOnce();
fTaskSettingsOk = kTRUE;
fVZERO = InputEvent()->GetVZEROData();
if (!fVZERO) {
AliError(Form("%s: AliVVZERO not available, task will not be executed!",GetName()));
fTaskSettingsOk = kFALSE;
}
if (GetClusterArray() == 0) {
AliError(Form("%s: No cluster collection provided, task will not be executed!",GetName()));
fTaskSettingsOk = kFALSE;
}
if (GetJetArray() == 0) {
AliError(Form("%s: No jet collection provided, task will not be executed!",GetName()));
fTaskSettingsOk = kFALSE;
}
if (!fEnergyThreshold) {
AliError(Form("%s: No threshold function provided, task will not be executed!",GetName()));
fTaskSettingsOk = kFALSE;
}
}
//________________________________________________________________________
Bool_t AliJetTriggerSelectionTask::RetrieveEventObjects()
{
// Retrieve event objects.
if (!AliAnalysisTaskEmcalJet::RetrieveEventObjects())
return kFALSE;
if (fVZERO) {
fV0ATotMult = fVZERO->GetMTotV0A();
fV0CTotMult = fVZERO->GetMTotV0C();
}
return kTRUE;
}
//________________________________________________________________________
Bool_t AliJetTriggerSelectionTask::Run()
{
// Run the analysis.
if (!fTaskSettingsOk) return kFALSE;
FindTriggers();
SelectJets();
return kTRUE;
}
//________________________________________________________________________
void AliJetTriggerSelectionTask::FindTriggers()
{
fNTriggers = 0;
Int_t nclusters = GetNClusters();
Double_t th = fEnergyThreshold->Eval(fV0ATotMult+fV0CTotMult);
for (Int_t i = 0; i < nclusters; i++) {
if (fNTriggers >= 999) {
AliError("More than 999 triggers found!");
break;
}
AliVCluster *cluster = GetAcceptClusterFromArray(i);
if (!cluster)
continue;
//Printf("Cluster energy=%.3f, th=%.3f",cluster->E(), th);
if (cluster->E() > th) {
TLorentzVector vect;
cluster->GetMomentum(vect,fVertex);
fTrigPos[fNTriggers][0] = vect.Eta();
fTrigPos[fNTriggers][1] = vect.Phi();
fNTriggers++;
}
}
AliDebug(2,Form("%s: %d triggers found among %d candidates (cent=%.1f, mult=%.1f, th=%.2f)!",GetName(),fNTriggers,nclusters,fCent,fV0ATotMult+fV0CTotMult,th));
}
//________________________________________________________________________
void AliJetTriggerSelectionTask::SelectJets()
{
for (Int_t c = 0; c < fJetCollArray.GetEntriesFast(); c++) {
Int_t njets = GetNJets(c);
for (Int_t i = 0; i < njets; i++) {
AliEmcalJet *jet = GetAcceptJetFromArray(i,c);
if (IsTriggerJet(jet)) jet->AddTrigger(fTriggerBits);
}
}
}
//________________________________________________________________________
Bool_t AliJetTriggerSelectionTask::IsTriggerJet(AliEmcalJet *jet)
{
if (!jet) return kFALSE;
for (Int_t i = 0; i < fNTriggers; i++) {
Double_t deta = jet->Eta() - fTrigPos[i][0];
Double_t dphi = jet->Phi() - fTrigPos[i][1];
Double_t d2 = deta * deta + dphi * dphi;
if (d2 < fMaxDistance2)
return kTRUE;
}
return kFALSE;
}
|
fbc27e2e6bb60f0d44332732c136a23105701ad6 | 52ee1b432c1a346a3f697427b7ab8dfa4d64fa76 | /include/echo/concept.h | 1561f98c721e712a7f87f133d6b1332ec7a30a00 | [] | no_license | echo-ml/concept | 6db82f7bb0a20aa83e1ff9b8b1960a21d1ea62fb | 2a6fc8e026abd2a3c8c73b6daf32cb1d5b4d6879 | refs/heads/master | 2021-01-22T19:36:22.926642 | 2015-09-14T04:15:28 | 2015-09-14T04:15:28 | 33,091,520 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 312 | h | concept.h | #pragma once
#include <echo/concept/concept.h>
#include <echo/concept/fundamental.h>
#include <echo/concept/allocator.h>
#include <echo/concept/iterator.h>
#include <echo/concept/range.h>
#include <echo/concept/overload.h>
#include <echo/concept/utility.h>
namespace echo {
using echo::concept::uncvref_t;
}
|
890a74a165aa2a8e4e08740bacac993b2cc1d488 | 981c7bba380ef9663906f85aead99163eb612b73 | /MathLib/mathlib.h | 1628020f7c105a1d451b3a30d693ebd332eeb83a | [] | no_license | zvanjak/NonLinearSystemSolver | a561d4b6dd73fb634eb801789c70beba4d39413d | ee42e365d01db6dde04a06c53ca3bfcc65d7db11 | refs/heads/master | 2021-01-10T01:49:21.274897 | 2017-01-03T17:53:57 | 2017-01-03T17:53:57 | 50,660,309 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,281 | h | mathlib.h | #if !defined __MATHLIB_H
#define __MATHLIB_H
#include "calc.h"
#include "complex.h"
#include "geometry.h"
#include "polynom.h"
#include "vector.h"
#include "matrix.h"
#include "DiffSystem.h"
#include "SpecFunc.h"
#include "SparseMatrix.h"
#include "Function.h"
#include "VectorFunction.h"
#include "ODEIntegration.h"
#include "RootFinding.h"
#include "Interpolation.h"
#include "Integrate.h"
#define M_PI 3.141592654589793
#define PI 3.141592653589793
#define EULER 0.5772156649
#define SIGN(a,b) ( (b) >= 0.0 ? fabs(a): -fabs(a) )
#define SIMPLEX_MAX_ITER_NUM 500
static double dsqrarg;
#define DSQR(a) ((dsqrarg=(a)) == 0.0 ? 0.0 : dsqrarg*dsqrarg )
static float sqrarg;
#define SQR(a) ((sqrarg=(a)) == 0.0 ? 0.0 : sqrarg*sqrarg )
static double dMaxArg1, dMaxArg2;
#define DMAX(a,b) (dMaxArg1=(a),dMaxArg2=(b),(dMaxArg1)>(dMaxArg2) ? (dMaxArg1) : (dMaxArg2) )
static double dMinArg1, dMinArg2;
#define DMIN(a,b) (dMinArg1=(a),dMinArg2=(b),(dMinArg1)<(dMinArg2) ? (dMinArg1) : (dMinArg2) )
static float maxarg1, maxarg2;
#define FMAX(a,b) (maxarg1=(a), maxarg2=(b), (maxarg1) > (maxarg2) ? (maxarg1) : (maxarg2) )
static float minarg1, minarg2;
#define FMIN(a,b) (minarg1=(a), minarg2=(b), (minarg1) > (minarg2) ? (minarg1) : (minarg2) )
static int nMinArg1, nMinArg2;
#define IMIN(a,b) (nMinArg1=(a),nMinArg2=(b),(nMinArg1)<(nMinArg2) ? (nMinArg1) : (nMinArg2) )
static int iMaxArg1, iMaxArg2;
#define IMAX(a,b) (iMaxArg1=(a), iMaxArg2=(b), (iMaxArg1) > (iMaxArg2) ? (iMaxArg1) : (iMaxArg2) )
#define ALPHA 1
#define BETA 0.5
#define GAMA 2
#define EPS 1e-6
void FuncMinN( Vector StartPoint3D, int nDim, double (*func) (double *), Vector *Min );
void period( double x[], double y[], int n, double ofac, double hifac, double px[],
double py[], int np, int *nout, int *jmax, double *prob );
void avevar( double data[], unsigned long n, double *ave, double *var );
#define DIV_ZERO 1
#define FUNC_UNDEFINED 2
#define UNDEFINED_ARG 3
/*
#define SINGULAR_MATRIX
#define NO_CONVERG
#define SVD_VECTOR_W_DIM 1
#define SVD_MATRIX_V_DIM 2
#define NO_ALG_SOLUTION
#define INT_OK 0
#define CONVERGED
*/
class MathLibException
{
public:
MathLibException();
MathLibException( int nType );
~MathLibException();
int m_nType;
};
#endif |
6553c81422ff8cd81b0497c1f95877d528a7dee2 | 9939aab9b0bd1dcf8f37d4ec315ded474076b322 | /libs/full/naming_base/include/hpx/naming_base/gid_type.hpp | 2be7c5c82f2fa2afde9a27c9d2bee303e8cc19df | [
"BSL-1.0",
"LicenseRef-scancode-free-unknown"
] | permissive | STEllAR-GROUP/hpx | 1068d7c3c4a941c74d9c548d217fb82702053379 | c435525b4631c5028a9cb085fc0d27012adaab8c | refs/heads/master | 2023-08-30T00:46:26.910504 | 2023-08-29T14:59:39 | 2023-08-29T14:59:39 | 4,455,628 | 2,244 | 500 | BSL-1.0 | 2023-09-14T13:54:12 | 2012-05-26T15:02:39 | C++ | UTF-8 | C++ | false | false | 24,907 | hpp | gid_type.hpp | // Copyright (c) 2007-2022 Hartmut Kaiser
// Copyright (c) 2011 Bryce Lelbach
// Copyright (c) 2007 Richard D. Guidry Jr.
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#pragma once
#include <hpx/config.hpp>
#include <hpx/assert.hpp>
#include <hpx/concurrency/spinlock_pool.hpp>
#include <hpx/execution_base/this_thread.hpp>
#include <hpx/lock_registration/detail/register_locks.hpp>
#include <hpx/modules/itt_notify.hpp>
#include <hpx/naming_base/naming_base.hpp>
#include <hpx/serialization/serialization_fwd.hpp>
#include <hpx/serialization/traits/is_bitwise_serializable.hpp>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <iosfwd>
#include <mutex>
#include <string>
#include <hpx/config/warnings_prefix.hpp>
///////////////////////////////////////////////////////////////////////////////
// Version of gid_type (for serialization purposes)
#define HPX_GIDTYPE_VERSION 0x10
///////////////////////////////////////////////////////////////////////////////
namespace hpx::naming {
namespace detail {
constexpr bool is_locked(gid_type const& gid) noexcept;
///////////////////////////////////////////////////////////////////////
constexpr std::uint64_t strip_internal_bits_from_gid(
std::uint64_t msb) noexcept;
} // namespace detail
///////////////////////////////////////////////////////////////////////////
HPX_EXPORT gid_type operator+(
gid_type const& lhs, gid_type const& rhs) noexcept;
HPX_EXPORT gid_type operator-(
gid_type const& lhs, gid_type const& rhs) noexcept;
///////////////////////////////////////////////////////////////////////////
/// Global identifier for components across the HPX system.
struct gid_type
{
// These typedefs are for Boost.ICL.
using size_type = gid_type;
using difference_type = gid_type;
static constexpr std::uint64_t credit_base_mask = 0x1full;
static constexpr std::uint16_t credit_shift = 24;
static constexpr std::uint64_t credit_mask = credit_base_mask
<< credit_shift;
static constexpr std::uint64_t was_split_mask =
0x80000000ull; //-V112
static constexpr std::uint64_t has_credits_mask = 0x40000000ull;
static constexpr std::uint64_t is_locked_mask = 0x20000000ull;
static constexpr std::uint64_t locality_id_mask = 0xffffffff00000000ull;
static constexpr std::uint16_t locality_id_shift = 32; //-V112
static constexpr std::uint64_t virtual_memory_mask = 0x3fffffull;
// don't cache this id in the AGAS caches
static constexpr std::uint64_t dont_cache_mask = 0x800000ull; //-V112
// the object is migratable
static constexpr std::uint64_t is_migratable = 0x400000ull; //-V112
// Bit 64 is set for all dynamically assigned ids (if this is not set
// then the lsb corresponds to the lva of the referenced object).
static constexpr std::uint64_t dynamically_assigned = 0x1ull;
// Bits 65-84 are used to store the component type (20 bits) if bit
// 64 is not set.
static constexpr std::uint64_t component_type_base_mask = 0xfffffull;
static constexpr std::uint64_t component_type_shift = 1ull;
static constexpr std::uint64_t component_type_mask =
component_type_base_mask << component_type_shift;
static constexpr std::uint64_t credit_bits_mask =
credit_mask | was_split_mask | has_credits_mask;
static constexpr std::uint64_t internal_bits_mask =
credit_bits_mask | is_locked_mask | dont_cache_mask | is_migratable;
static constexpr std::uint64_t special_bits_mask =
locality_id_mask | internal_bits_mask | component_type_mask;
constexpr gid_type() noexcept = default;
explicit constexpr gid_type(std::uint64_t lsb_id) noexcept
: id_msb_(0)
, id_lsb_(lsb_id)
{
}
explicit gid_type(void* lsb_id) noexcept
: id_msb_(0)
, id_lsb_(reinterpret_cast<std::uint64_t>(lsb_id))
{
}
explicit constexpr gid_type(
std::uint64_t msb_id, std::uint64_t lsb_id) noexcept;
explicit inline gid_type(std::uint64_t msb_id, void* lsb_id) noexcept;
inline constexpr gid_type(gid_type const& rhs) noexcept;
inline constexpr gid_type(gid_type&& rhs) noexcept;
~gid_type() = default;
gid_type& operator=(std::uint64_t lsb_id) noexcept
{
HPX_ASSERT(!is_locked());
id_msb_ = 0;
id_lsb_ = lsb_id;
return *this;
}
inline gid_type& operator=(gid_type const& rhs) noexcept;
inline gid_type& operator=(gid_type&& rhs) noexcept;
explicit constexpr operator bool() const noexcept
{
return 0 != id_lsb_ || 0 != id_msb_;
}
// We support increment, decrement, addition and subtraction
gid_type& operator++() noexcept // pre-increment
{
*this += 1;
return *this;
}
gid_type operator++(int) noexcept // post-increment
{
gid_type t(*this);
++(*this);
return t;
}
gid_type& operator--() noexcept // pre-decrement
{
*this -= 1;
return *this;
}
gid_type operator--(int) noexcept // post-decrement
{
gid_type t(*this);
--(*this);
return t;
}
// GID + GID
friend HPX_EXPORT gid_type operator+(
gid_type const& lhs, gid_type const& rhs) noexcept;
gid_type operator+=(gid_type const& rhs) noexcept
{
return (*this = *this + rhs);
}
// GID + std::uint64_t
friend gid_type operator+(
gid_type const& lhs, std::uint64_t rhs) noexcept
{
return lhs + gid_type(0, rhs);
}
gid_type operator+=(std::uint64_t rhs) noexcept
{
return (*this = *this + rhs);
}
// GID - GID
friend HPX_EXPORT gid_type operator-(
gid_type const& lhs, gid_type const& rhs) noexcept;
gid_type operator-=(gid_type const& rhs) noexcept
{
return (*this = *this - rhs);
}
// GID - std::uint64_t
friend gid_type operator-(
gid_type const& lhs, std::uint64_t rhs) noexcept
{
return lhs - gid_type(0, rhs);
}
gid_type operator-=(std::uint64_t rhs) noexcept
{
return (*this = *this - rhs);
}
friend gid_type operator&(
gid_type const& lhs, std::uint64_t rhs) noexcept
{
return gid_type(lhs.id_msb_, lhs.id_lsb_ & rhs);
}
// comparison is required as well
friend constexpr bool operator==(
gid_type const& lhs, gid_type const& rhs) noexcept
{
std::int64_t lhs_msb =
detail::strip_internal_bits_from_gid(lhs.id_msb_);
std::int64_t rhs_msb =
detail::strip_internal_bits_from_gid(rhs.id_msb_);
return (lhs_msb == rhs_msb) && (lhs.id_lsb_ == rhs.id_lsb_);
}
friend constexpr bool operator!=(
gid_type const& lhs, gid_type const& rhs) noexcept
{
return !(lhs == rhs);
}
friend HPX_EXPORT bool operator<(
gid_type const& lhs, gid_type const& rhs) noexcept;
friend bool operator>=(
gid_type const& lhs, gid_type const& rhs) noexcept
{
return !(lhs < rhs);
}
friend HPX_EXPORT bool operator<=(
gid_type const& lhs, gid_type const& rhs) noexcept;
friend bool operator>(gid_type const& lhs, gid_type const& rhs) noexcept
{
return !(lhs <= rhs);
}
constexpr std::uint64_t get_msb() const noexcept
{
return id_msb_;
}
constexpr void set_msb(std::uint64_t msb) noexcept
{
id_msb_ = msb;
}
constexpr std::uint64_t get_lsb() const noexcept
{
return id_lsb_;
}
constexpr void set_lsb(std::uint64_t lsb) noexcept
{
id_lsb_ = lsb;
}
inline void set_lsb(void* lsb) noexcept
{
id_lsb_ = reinterpret_cast<std::uint64_t>(lsb);
}
std::string to_string() const;
// this type is at the same time its own mutex type
using mutex_type = gid_type;
void lock()
{
HPX_ITT_SYNC_PREPARE(this);
while (!acquire_lock())
{
util::yield_while<true>([this] { return is_locked(); },
"hpx::naming::gid_type::lock");
}
util::register_lock(this);
HPX_ITT_SYNC_ACQUIRED(this);
}
bool try_lock()
{
HPX_ITT_SYNC_PREPARE(this);
if (acquire_lock())
{
HPX_ITT_SYNC_ACQUIRED(this);
util::register_lock(this);
return true;
}
HPX_ITT_SYNC_CANCEL(this);
return false;
}
void unlock()
{
HPX_ITT_SYNC_RELEASING(this);
relinquish_lock();
util::unregister_lock(this);
HPX_ITT_SYNC_RELEASED(this);
}
constexpr mutex_type& get_mutex() const noexcept
{
return const_cast<mutex_type&>(*this);
}
private:
friend HPX_EXPORT std::ostream& operator<<(
std::ostream& os, gid_type const& id);
friend HPX_EXPORT void save(
serialization::output_archive& ar, gid_type const&, unsigned int);
friend HPX_EXPORT void load(
serialization::input_archive& ar, gid_type&, unsigned int);
// lock implementation
using spinlock_pool = util::spinlock_pool<gid_type>;
// returns whether lock has been acquired
bool acquire_lock()
{
std::lock_guard<hpx::util::detail::spinlock> l(
spinlock_pool::spinlock_for(this));
bool was_locked = (id_msb_ & is_locked_mask) ? true : false;
if (!was_locked)
{
id_msb_ |= is_locked_mask;
return true;
}
return false;
}
void relinquish_lock()
{
util::ignore_lock(this);
std::lock_guard<hpx::util::detail::spinlock> l(
spinlock_pool::spinlock_for(this));
util::reset_ignored(this);
id_msb_ &= ~is_locked_mask;
}
// this is used for assertions only, no need to acquire the lock
constexpr bool is_locked() const noexcept
{
return (id_msb_ & is_locked_mask) ? true : false;
}
friend constexpr bool detail::is_locked(gid_type const& gid) noexcept;
// actual gid
std::uint64_t id_msb_ = 0;
std::uint64_t id_lsb_ = 0;
};
HPX_EXPORT void save(
serialization::output_archive& ar, gid_type const&, unsigned int);
HPX_EXPORT void load(
serialization::input_archive& ar, gid_type&, unsigned int version);
HPX_SERIALIZATION_SPLIT_FREE(gid_type)
} // namespace hpx::naming
///////////////////////////////////////////////////////////////////////////////
// we know that we can serialize a gid as a byte sequence
HPX_IS_BITWISE_SERIALIZABLE(hpx::naming::gid_type)
namespace hpx::naming {
///////////////////////////////////////////////////////////////////////////
// Handle conversion to/from locality_id
constexpr gid_type get_gid_from_locality_id(
std::uint32_t locality_id) noexcept
{
return gid_type(
(std::uint64_t(locality_id) + 1) << gid_type::locality_id_shift,
std::uint64_t(0));
}
constexpr std::uint32_t get_locality_id_from_gid(std::uint64_t msb) noexcept
{
return std::uint32_t(msb >> gid_type::locality_id_shift) - 1;
}
constexpr std::uint32_t get_locality_id_from_gid(
gid_type const& id) noexcept
{
return get_locality_id_from_gid(id.get_msb());
}
constexpr gid_type get_locality_from_gid(gid_type const& id) noexcept
{
return get_gid_from_locality_id(get_locality_id_from_gid(id));
}
constexpr bool is_locality(gid_type const& gid) noexcept
{
return get_locality_from_gid(gid) == gid;
}
constexpr std::uint64_t replace_locality_id(
std::uint64_t msb, std::uint32_t locality_id) noexcept
{
msb &= ~gid_type::locality_id_mask;
return msb | get_gid_from_locality_id(locality_id).get_msb();
}
constexpr gid_type replace_locality_id(
gid_type const& gid, std::uint32_t locality_id) noexcept
{
std::uint64_t msb = gid.get_msb() & ~gid_type::locality_id_mask;
msb |= get_gid_from_locality_id(locality_id).get_msb();
return gid_type(msb, gid.get_lsb());
}
///////////////////////////////////////////////////////////////////////////
constexpr bool refers_to_virtual_memory(std::uint64_t msb) noexcept
{
return !(msb & gid_type::virtual_memory_mask);
}
constexpr bool refers_to_virtual_memory(gid_type const& gid) noexcept
{
return refers_to_virtual_memory(gid.get_msb());
}
///////////////////////////////////////////////////////////////////////////
constexpr bool refers_to_local_lva(gid_type const& gid) noexcept
{
return !(gid.get_msb() & gid_type::dynamically_assigned);
}
inline gid_type replace_component_type(
gid_type const& gid, std::uint32_t type) noexcept
{
std::uint64_t msb = gid.get_msb() & ~gid_type::component_type_mask;
HPX_ASSERT(!(msb & gid_type::dynamically_assigned));
msb |= ((std::uint64_t(type) << gid_type::component_type_shift) &
gid_type::component_type_mask);
return gid_type(msb, gid.get_lsb());
}
///////////////////////////////////////////////////////////////////////////
namespace detail {
///////////////////////////////////////////////////////////////////////
constexpr std::uint64_t strip_internal_bits_from_gid(
std::uint64_t msb) noexcept
{
return msb & ~gid_type::internal_bits_mask;
}
constexpr gid_type& strip_internal_bits_from_gid(gid_type& id) noexcept
{
id.set_msb(strip_internal_bits_from_gid(id.get_msb()));
return id;
}
constexpr std::uint64_t strip_internal_bits_except_dont_cache_from_gid(
std::uint64_t msb) noexcept
{
return msb &
~(gid_type::credit_bits_mask | gid_type::is_locked_mask);
}
constexpr gid_type& strip_internal_bits_except_dont_cache_from_gid(
gid_type& id) noexcept
{
id.set_msb(
strip_internal_bits_except_dont_cache_from_gid(id.get_msb()));
return id;
}
constexpr std::uint64_t strip_internal_bits_and_component_type_from_gid(
std::uint64_t msb) noexcept
{
return msb &
~(gid_type::internal_bits_mask | gid_type::component_type_mask);
}
constexpr gid_type& strip_internal_bits_and_component_type_from_gid(
gid_type& id) noexcept
{
id.set_msb(
strip_internal_bits_and_component_type_from_gid(id.get_msb()));
return id;
}
constexpr std::uint64_t get_internal_bits(std::uint64_t msb) noexcept
{
return msb &
(gid_type::internal_bits_mask | gid_type::component_type_mask);
}
constexpr std::uint64_t strip_internal_bits_and_locality_from_gid(
std::uint64_t msb) noexcept
{
return msb &
(~gid_type::special_bits_mask | gid_type::component_type_mask);
}
///////////////////////////////////////////////////////////////////////
inline constexpr std::uint32_t get_component_type_from_gid(
std::uint64_t msb) noexcept
{
HPX_ASSERT(!(msb & gid_type::dynamically_assigned));
return (msb >> gid_type::component_type_shift) &
gid_type::component_type_base_mask;
}
inline constexpr std::uint64_t add_component_type_to_gid(
std::uint64_t msb, std::uint32_t type) noexcept
{
HPX_ASSERT(!(msb & gid_type::dynamically_assigned));
return (msb & ~gid_type::component_type_mask) |
((std::uint64_t(type) << gid_type::component_type_shift) &
gid_type::component_type_mask);
}
///////////////////////////////////////////////////////////////////////
constexpr std::uint64_t strip_lock_from_gid(std::uint64_t msb) noexcept
{
return msb & ~gid_type::is_locked_mask;
}
constexpr gid_type& strip_lock_from_gid(gid_type& gid) noexcept
{
gid.set_msb(strip_lock_from_gid(gid.get_msb()));
return gid;
}
constexpr bool is_locked(gid_type const& gid) noexcept
{
return gid.is_locked();
}
///////////////////////////////////////////////////////////////////////
constexpr gid_type get_stripped_gid(gid_type const& id) noexcept
{
std::uint64_t const msb =
strip_internal_bits_from_gid(id.get_msb());
std::uint64_t const lsb = id.get_lsb();
return gid_type(msb, lsb);
}
///////////////////////////////////////////////////////////////////////
constexpr bool has_credits(gid_type const& gid) noexcept
{
return (gid.get_msb() & gid_type::has_credits_mask) ? true : false;
}
constexpr bool gid_was_split(gid_type const& gid) noexcept
{
return (gid.get_msb() & gid_type::was_split_mask) ? true : false;
}
constexpr void set_credit_split_mask_for_gid(gid_type& gid) noexcept
{
gid.set_msb(gid.get_msb() | gid_type::was_split_mask);
}
// We store the log2(credit) in the gid_type
constexpr std::int16_t log2(std::int64_t val) noexcept
{
std::int16_t ret = -1;
while (val != 0)
{
val >>= 1;
++ret;
}
return ret;
}
inline std::int64_t power2(std::int16_t log2credits) noexcept
{
HPX_ASSERT(log2credits >= 0);
return static_cast<std::int64_t>(1) << log2credits;
}
///////////////////////////////////////////////////////////////////////
constexpr bool store_in_cache(gid_type const& id) noexcept
{
return (id.get_msb() & gid_type::dont_cache_mask) ? false : true;
}
constexpr void set_dont_store_in_cache(gid_type& gid) noexcept
{
gid.set_msb(gid.get_msb() | gid_type::dont_cache_mask);
}
///////////////////////////////////////////////////////////////////////
constexpr bool is_migratable(gid_type const& id) noexcept
{
return (id.get_msb() & gid_type::is_migratable) ? true : false;
}
constexpr void set_is_migratable(gid_type& gid) noexcept
{
gid.set_msb(gid.get_msb() | gid_type::is_migratable);
}
///////////////////////////////////////////////////////////////////////
constexpr gid_type get_stripped_gid_except_dont_cache(
gid_type const& gid) noexcept
{
std::uint64_t const msb =
strip_internal_bits_except_dont_cache_from_gid(gid.get_msb());
std::uint64_t const lsb = gid.get_lsb();
return gid_type(msb, lsb);
}
constexpr std::uint64_t strip_credits_from_gid(
std::uint64_t msb) noexcept
{
return msb & ~gid_type::credit_bits_mask;
}
constexpr gid_type& strip_credits_from_gid(gid_type& gid) noexcept
{
gid.set_msb(strip_credits_from_gid(gid.get_msb()));
return gid;
}
///////////////////////////////////////////////////////////////////////
constexpr std::int16_t get_log2credit_from_gid(
gid_type const& gid) noexcept
{
HPX_ASSERT(has_credits(gid));
return std::int16_t((gid.get_msb() >> gid_type::credit_shift) &
gid_type::credit_base_mask);
}
constexpr std::int64_t get_credit_from_gid(gid_type const& gid) noexcept
{
return has_credits(gid) ?
detail::power2(get_log2credit_from_gid(gid)) :
0;
}
///////////////////////////////////////////////////////////////////////
inline void set_log2credit_for_gid(
gid_type& id, std::int16_t log2credits) noexcept
{
// credit should be a clean log2
HPX_ASSERT(log2credits >= 0);
HPX_ASSERT(0 == (log2credits & ~gid_type::credit_base_mask));
id.set_msb((id.get_msb() & ~gid_type::credit_mask) |
((std::int64_t(log2credits) << gid_type::credit_shift) &
gid_type::credit_mask) |
gid_type::has_credits_mask);
}
inline void set_credit_for_gid(
gid_type& id, std::int64_t credits) noexcept
{
if (credits != 0)
{
std::int16_t log2credits = detail::log2(credits);
HPX_ASSERT(detail::power2(log2credits) == credits);
set_log2credit_for_gid(id, log2credits);
}
else
{
strip_credits_from_gid(id);
}
}
} // namespace detail
///////////////////////////////////////////////////////////////////////////
inline constexpr gid_type const invalid_gid{};
///////////////////////////////////////////////////////////////////////////
HPX_EXPORT std::ostream& operator<<(std::ostream& os, gid_type const& id);
///////////////////////////////////////////////////////////////////////////
inline constexpr gid_type::gid_type(
std::uint64_t msb_id, std::uint64_t lsb_id) noexcept
: id_msb_(naming::detail::strip_lock_from_gid(msb_id))
, id_lsb_(lsb_id)
{
}
inline gid_type::gid_type(std::uint64_t msb_id, void* lsb_id) noexcept
: id_msb_(naming::detail::strip_lock_from_gid(msb_id))
, id_lsb_(reinterpret_cast<std::uint64_t>(lsb_id))
{
}
inline constexpr gid_type::gid_type(gid_type const& rhs) noexcept
: id_msb_(naming::detail::strip_lock_from_gid(rhs.get_msb()))
, id_lsb_(rhs.get_lsb())
{
}
inline constexpr gid_type::gid_type(gid_type&& rhs) noexcept
: id_msb_(naming::detail::strip_lock_from_gid(rhs.get_msb()))
, id_lsb_(rhs.get_lsb())
{
rhs.id_lsb_ = rhs.id_msb_ = 0;
}
inline gid_type& gid_type::operator=(gid_type const& rhs) noexcept
{
if (this != &rhs)
{
HPX_ASSERT(!is_locked());
id_msb_ = naming::detail::strip_lock_from_gid(rhs.get_msb());
id_lsb_ = rhs.get_lsb();
}
return *this;
}
inline gid_type& gid_type::operator=(gid_type&& rhs) noexcept
{
if (this != &rhs)
{
HPX_ASSERT(!is_locked());
id_msb_ = naming::detail::strip_lock_from_gid(rhs.get_msb());
id_lsb_ = rhs.get_lsb();
rhs.id_lsb_ = rhs.id_msb_ = 0;
}
return *this;
}
} // namespace hpx::naming
///////////////////////////////////////////////////////////////////////////////
namespace std {
// specialize std::hash for hpx::naming::gid_type
template <>
struct hash<hpx::naming::gid_type>
{
std::size_t operator()(::hpx::naming::gid_type const& gid) const
{
std::size_t const h1(std::hash<std::uint64_t>()(gid.get_lsb()));
std::size_t const h2(std::hash<std::uint64_t>()(
hpx::naming::detail::strip_internal_bits_from_gid(
gid.get_msb())));
return h1 ^ (h2 << 1);
}
};
} // namespace std
#include <hpx/config/warnings_suffix.hpp>
|
a2b914e94f657dcb735ae87623a45fdfb8bed43c | 5d83739af703fb400857cecc69aadaf02e07f8d1 | /Archive2/6e/e47e586fa4c51d/main.cpp | d7c2d8fbbee107ffcc1a31ba2ffa9194cdb3f79f | [] | no_license | WhiZTiM/coliru | 3a6c4c0bdac566d1aa1c21818118ba70479b0f40 | 2c72c048846c082f943e6c7f9fa8d94aee76979f | refs/heads/master | 2021-01-01T05:10:33.812560 | 2015-08-24T19:09:22 | 2015-08-24T19:09:22 | 56,789,706 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 327 | cpp | main.cpp | #include <iostream>
namespace N
{
template< typename ...types >
struct X;
template< typename ...types >
std::ostream &
operator << (std::ostream & out, X< types... > const &)
{
return out;
}
} // namespace N
int main()
{
using namespace N;
extern X< float >& x;
std::cout << x << std::endl;
return 0;
} |
385d1b04fda2b607064b08fdc2f1f6b986cb1ad6 | 900ac54ee1b249b52e55504148f14ea2cd964b10 | /Sources/Solver/Mitosis.Solvers/StaticPoleUpdater.h | 1fa2b13cf2518a191fdcb12f668d199a70cf6453 | [
"MIT"
] | permissive | m-krivov/MiCoSi | 1d5bf248bcd7908837aeee3a1fb4c7827d94dd1e | a0f32bacb2e09f23518a5629b4ccc2ca27e67209 | refs/heads/master | 2021-09-10T04:48:53.927491 | 2021-08-27T10:56:34 | 2021-08-27T10:56:34 | 165,875,825 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 474 | h | StaticPoleUpdater.h |
#pragma once
#include "Mitosis.Objects/Interfaces.h"
// Don't moves poles, sets initial position according to config file
class StaticPoleUpdater : public IPoleUpdater
{
public:
virtual void SetInitial(Pole *left, Pole *right, Random::State &state) override;
virtual void MovePoles(Pole *left, Pole *right, real time, Random::State &state) override
{ /*nothing*/ }
virtual IClonnable *Clone() const override
{ return new StaticPoleUpdater(); }
};
|
45024a26d5f656537b7597a44d88dee3b62848d7 | 1127440c1bbe7d31c6a819956e6156a478b9c3e2 | /Completed/351-400/problem357.cpp | 0d12f65dafcdaaf274fdba08ac3a9639c0a4fe55 | [] | no_license | joshkol1/Project-Euler | 18865356a23d423a1339cc3d3b4ab6594d7ef6df | aa4e11bb80faab35489e13aa19cdfec8056a5957 | refs/heads/main | 2023-06-07T17:17:24.029058 | 2023-06-01T08:40:52 | 2023-06-01T08:40:52 | 237,578,970 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,239 | cpp | problem357.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
const int MAX_VAL = 1E8;
bool prime[MAX_VAL+1];
ll total = 1;
vector<ll> init_filter;
/*
Observations:
(1) Number must contain a factor of 2 (except 1). Otheerwise, we
get odd+odd=even for d+n/d.
(2) n+1 must be prime.
The above two narrow the list of candidates downto ~500000 numbers. From
here, just brute force the divisors and test for primality of sum.
Note that precomputing primes up to 10^8 using a sieve is helpful.
*/
void init_sieve() {
memset(prime, true, sizeof prime);
prime[1] = false;
for(int i = 2; i <= MAX_VAL; i++) {
if(prime[i]) {
for(int j = 2*i; j <= MAX_VAL; j += i) {
prime[j] = false;
}
}
}
}
bool condition(ll n) {
for(int i = 1; i*i < n; i++) {
if(n%i == 0 && !prime[i+n/i]) return false;
}
return true;
}
int main() {
init_sieve();
for(ll i = 1; i < MAX_VAL/2; i+=2) {
if(prime[i+2] && prime[2*i+1]) {
init_filter.pb(2*i);
}
}
for(ll n : init_filter) {
if(condition(n)) total += n;
}
cout << total << "\n";
return 0;
} |
6b24d29594edee2102b38bdc6c335b7a82f036ce | 3b49525f291430a8e66c16c52e4c80cb07444df3 | /map.cpp | 1e7b327d75fad22738bc97c3254a0df01f7fad4c | [] | no_license | bit-hack/raycast | 4a9d0508c3db542b6349c786f10124b273f44026 | ad5bf89eaab8ebbb0d962366de22f9d90811dfbc | refs/heads/master | 2020-07-13T16:34:17.431967 | 2019-10-09T11:46:16 | 2019-10-09T11:46:16 | 205,115,567 | 2 | 1 | null | 2019-09-03T20:03:53 | 2019-08-29T08:21:06 | C++ | UTF-8 | C++ | false | false | 3,003 | cpp | map.cpp | #include <cmath>
#include <algorithm>
#include "map.h"
#include "SDL.h"
map_t map;
void map_t::calcBlockers(void) {
for (size_t y = 0; y < map_h; ++y) {
for (size_t x = 0; x < map_w; ++x) {
// XXX: check ceiling height
// if anything two tiles below us block in that direction
const uint8_t h = floor[x + y * map_w];
uint8_t flags = 0;
flags |= (getHeight_(x, y - 1) + 2) <= h ? block_up : 0;
flags |= (getHeight_(x, y + 1) + 2) <= h ? block_down : 0;
flags |= (getHeight_(x - 1, y) + 2) <= h ? block_left : 0;
flags |= (getHeight_(x + 1, y) + 2) <= h ? block_right : 0;
blockers[x + y * map_w] = flags;
}
}
}
void map_t::resolve(const vec3f_t &p, const float r, vec2f_t &res) const {
// player height
const uint8_t ph = uint8_t(p.z + 0.5f);
res = vec2f_t{ 99.f, 99.f };
const vec2i_t min{std::max<int32_t>(int32_t(p.x - r), 0),
std::max<int32_t>(int32_t(p.y - r), 0)};
const vec2i_t max{std::min<int32_t>(int32_t(p.x + r), map_w -1),
std::min<int32_t>(int32_t(p.y + r), map_h-1)};
bool setx = false, sety = false;
for (int32_t y = min.y; y <= max.y; ++y) {
for (int32_t x = min.x; x <= max.x; ++x) {
// test tile height
const uint8_t h = getHeight(x, y);
if (h <= ph + 1)
continue;
const uint8_t b = blockers[x + y * map_w];
const float dy0 = (b & block_up) ? ((y + 0.f) - (p.y + r)) : 99.f;
const float dy1 = (b & block_down) ? ((y + 1.f) - (p.y - r)) : 99.f;
const float dx0 = (b & block_left) ? ((x + 0.f) - (p.x + r)) : 99.f;
const float dx1 = (b & block_right) ? ((x + 1.f) - (p.x - r)) : 99.f;
const float rx = fabsf(dx0) < fabsf(dx1) ? dx0 : dx1;
const float ry = fabsf(dy0) < fabsf(dy1) ? dy0 : dy1;
if (fabsf(rx) < fabsf(ry)) {
res.x = fabsf(rx) < fabsf(res.x) ? rx : res.x;
setx = res.x < 98.f;
}
else {
res.y = fabsf(ry) < fabsf(res.y) ? ry : res.y;
sety = res.y < 98.f;
}
}
}
res.x = setx ? res.x : 0.f;
res.y = sety ? res.y : 0.f;
}
void map_t::load(const std::string &path) {
floor.fill(0);
floor.fill(10);
light.fill(0xff);
tex_wall.fill(0);
tex_floor.fill(1);
tex_ceil.fill(11);
FILE *fd = fopen(path.c_str(), "rb");
if (!fd) {
return;
}
if (fread(floor.data(), 1, floor.size(), fd) != floor.size()) {
// error
}
if (fread(ceil.data(), 1, ceil.size(), fd) != ceil.size()) {
// error
}
if (fread(light.data(), 1, light.size(), fd) != light.size()) {
// error
}
if (fread(tex_floor.data(), 1, light.size(), fd) != tex_floor.size()) {
// error
}
if (fread(tex_ceil.data(), 1, light.size(), fd) != tex_ceil.size()) {
// error
}
if (fread(tex_wall.data(), 1, light.size(), fd) != tex_wall.size()) {
// error
}
fclose(fd);
// scale lights up into 256 value range
for (auto &l : light) {
l *= 4;
}
calcBlockers();
}
|
f3723031aaa4b9301397929e4db37c0cd880603d | 474bb820fb472ff350bf032ee502010da0e455cb | /contest/19-04-27/g.cpp | 79d4347e084c48408fa9db42cde761e6dc6d0af5 | [] | no_license | wqrqwerqrw/acm_code | 839b1f3f50abcacec6f83acf3f002a887468b0d7 | 15b90fa1f12b8dca64d751525f9c73509f61328b | refs/heads/master | 2020-05-02T20:02:42.232841 | 2020-02-10T11:59:55 | 2020-02-10T11:59:55 | 178,177,685 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 974 | cpp | g.cpp | /*************************************************************************
> File Name: g.cpp
> Author: Wqr_
> Mail: xueduanwei@126.com
> Created Time: 2019年04月27日 星期六 14时49分26秒
************************************************************************/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
string a[110];
string b[110];
typedef pair<string, string> pai;
int n;
pai str[110];
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> str[i].second >> str[i].first;
str[i].first[0] = tolower(str[i].first[0]);
str[i].second[0] = tolower(str[i].second[0]);
}
sort(str, str + n);
for (int i = 0; i < n; i++) {
str[i].first[0] = toupper(str[i].first[0]);
str[i].second[0] = toupper(str[i].second[0]);
}
for (int i = 0; i < n; i++) {
cout << str[i].second << " " << str[i].first << endl;
}
return 0;
}
|
e837805a2ea853b239e388c020688d2a1a45c37e | 54c0a68dd87aa2c6e5a27bb61b6aa7ffbad591c0 | /src/SHADERed/UI/CreateItemUI.h | 6411617794c18171614b61c71336fe650911244b | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | stef-levesque/SHADERed | ba253c2a93d6e7f466a6f5a2790ec6be3c90e638 | 5895eea75e9cdc1cd71dc0572513c073db033364 | refs/heads/master | 2022-12-06T04:06:03.770273 | 2020-08-24T01:22:22 | 2020-08-24T01:22:22 | 266,662,800 | 2 | 0 | MIT | 2020-08-24T01:22:23 | 2020-05-25T02:13:33 | null | UTF-8 | C++ | false | false | 895 | h | CreateItemUI.h | #pragma once
#include <SHADERed/Objects/PipelineItem.h>
#include <SHADERed/Objects/ShaderVariable.h>
#include <SHADERed/UI/UIView.h>
namespace ed {
class CreateItemUI : public UIView {
public:
CreateItemUI(GUIManager* ui, InterfaceManager* objects, const std::string& name = "", bool visible = false);
virtual void OnEvent(const SDL_Event& e);
virtual void Update(float delta);
void SetOwner(const char* shaderPass);
void SetType(PipelineItem::ItemType type);
bool Create();
void Reset();
private:
void m_autoVariablePopulate(pipe::ShaderPass* pass);
void m_createFile(const std::string& filen);
std::vector<std::string> m_groups;
int m_selectedGroup;
bool m_errorOccured;
char m_owner[PIPELINE_ITEM_NAME_LENGTH];
PipelineItem m_item;
char* m_dialogPath;
bool* m_dialogShaderAuto;
std::string m_dialogShaderType;
bool m_isShaderFileAuto[3];
};
} |
5e5f4809aa059a59c6c161cb7832ce7ffea12789 | 2866b528a31d7745ca9c834a93549f15ddab24e0 | /src/agents/zero_agent.h | 40106a1065627e75059c0e409d899a6d4ebb7312 | [
"MIT"
] | permissive | purpleyoung/alphago_zero | e82a9475cd6592eeaf34c1ff71450b0d69725a74 | fed12157e868d4e1f5709962017be4298416174a | refs/heads/master | 2022-07-19T16:00:21.728412 | 2020-05-20T12:36:27 | 2020-05-20T12:36:27 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,822 | h | zero_agent.h | #ifndef RLGAMES_ZERO_AGENT
#define RLGAMES_ZERO_AGENT
#include <type_alias.h>
#include <dirichlet_distribution.h>
#include <model_base.h>
#include <go_action_encoder.h>
#include <go_zero_encoder.h>
#include <zero_episodic_exp.h>
#include <agent_base.h>
#include <cassert>
#include <array>
#include <algorithm>
#include <torch/torch.h>
namespace rlgames {
namespace s = std;
namespace t = torch;
//TODO: add temperature
template <typename Model, typename NoiseDist, typename RGen, typename Board, typename GameState, uint BF>
class ZeroAgent : public AgentBase<Board, GameState, ZeroAgent<Model, NoiseDist, RGen, Board, GameState, BF>> {
public:
static constexpr float MIN_SCORE = -1.F;
static constexpr float MAX_SCORE = 1.F;
static constexpr float TIE_SCORE = 0.F;
private:
Model& mModel;
NoiseDist mNoise;
t::Device mDevice;
RGen mGen;
ZeroEpisodicExpCollector* mExp;
uint mMaxExpand;
float mEFactor;
float mNoiseFactor;
protected:
struct Node;
//keeps tracks the statistics of each move from some node
struct Branch {
float prior;
float total_value;
long visit_count;
Node* child;
explicit Branch(float prior = 0.F, float total_value = 0, uint visit_count = 0):
prior(prior),
total_value(total_value),
visit_count(visit_count),
child(nullptr)
{}
};
struct Node {
GameState gs;
float qvalue;
uint total_count;
Branch branches[BF];
Node* parent;
uint last_midx; //array index of the last move, not Move
Node(GameState&& gs, float qvalue, float* priors, Node* parent = nullptr, uint last_midx = BF):
gs(s::move(gs)),
qvalue(qvalue),
total_count(1U),
parent(parent),
last_midx(last_midx){
for (uint i = 0; i < BF; ++i)
branches[i].prior = priors[i];
}
Node& operator=(Node&& o){
gs = s::move(o.gs);
qvalue = o.qvalue;
total_count = o.total_count;
s::memcpy(branches, o.branches, sizeof(Branch) * BF);
parent = o.parent;
last_midx = o.last_midx;
return *this;
}
Node() = default;
void add_child(uint midx, Node* child_node){
branches[midx].child = child_node;
}
bool has_child(uint midx){
if (midx >= BF) return false;
else return branches[midx].child != nullptr;
}
Node* child(uint midx){
return branches[midx].child;
}
float expected_value(uint midx){
return (branches[midx].visit_count > 0) ?
branches[midx].total_value / (float)branches[midx].visit_count :
0.F;
}
float prior(uint midx){
return branches[midx].prior;
}
uint visit_count(uint midx){
return branches[midx].visit_count;
}
void record_visit(uint midx, float value){
total_count += 1;
branches[midx].visit_count += 1;
branches[midx].total_value += value;
}
};
template <typename T>
struct BufferAllocator {
size_t index;
s::vector<T> objects;
explicit BufferAllocator(size_t sz): index(0U), objects(sz){}
T* allocate(T&& obj) noexcept {
assert(index < objects.size());
objects[index] = s::move(obj);
size_t prev_index = index;
index++;
return &objects[prev_index];
}
};
Node* create_node(BufferAllocator<Node>& arena, GameState&& gs, Node* parent = nullptr, uint midx = BF){
TensorP state = mModel.state_encoder.encode_state(gs, mDevice);
TensorP avout = mModel.model->forward(state);
t::Tensor priors = avout.x.to(t::Device(t::kCPU));
Node* new_node = arena.allocate(Node(s::move(gs), avout.y.item().to<float>(), (float*)priors.data_ptr(), parent, midx));
if (parent != nullptr){
assert(midx != BF);
parent->add_child(midx, new_node);
}
return new_node;
}
uint select_branch(Node* node){
assert(node != nullptr);
if (node->gs.is_over()) return BF;
s::vector<Move> moves = node->gs.legal_moves();
s::array<float, BF> noise = mNoise(mGen);
float tcount = node->total_count;
s::array<float, BF> score;
s::fill(s::begin(score), s::end(score), MIN_SCORE);
for (uint i = 0; i < moves.size(); ++i){
uint idx = mModel.action_encoder.move_to_idx(moves[i]);
float q = node->expected_value(idx);
float p = node->prior(idx);
float n = node->visit_count(idx);
score[idx] = q + mEFactor * ((1 - mNoiseFactor) * p + mNoiseFactor * noise[idx]) * (s::sqrt(tcount) / (n + 1));
}
uint max_idx = random_max_element(s::begin(score), s::end(score), [](float a, float b){return a < b;}) - s::begin(score);
return max_idx;
}
void append_experience(Node& root){
if (mExp){
TensorP state = mModel.state_encoder.encode_state(root.gs, mDevice);
s::vector<float> visit_counts(BF);
for (uint i = 0; i < BF; ++i)
visit_counts[i] = root.branches[i].visit_count;
mExp->append(state, visit_counts);
}
}
template <typename Iter, typename Less>
Iter random_max_element(Iter begin, Iter end, Less less){
s::vector<Iter> max_iters;
Iter it = begin;
max_iters.push_back(it);
it++;
while (it != end){
if (not less(*it, *max_iters.front())){
if (less(*max_iters.front(), *it))
max_iters.clear();
max_iters.push_back(it);
}
it++;
}
return max_iters[mGen() % max_iters.size()];
}
public:
ZeroAgent(Model& model, t::Device device, uint max_expansion, float exploration_factor, float noise_alpha, float noise_factor, uint seed):
mModel(model),
mNoise(noise_alpha),
mDevice(device),
mGen(seed),
mExp(nullptr),
mMaxExpand(max_expansion),
mEFactor(exploration_factor),
mNoiseFactor(noise_factor)
{}
Move select_move(const GameState& gs){
//root should never be a terminal state
assert(not gs.is_over());
BufferAllocator<Node> arena(mMaxExpand + 1);
GameState gs_copy = gs;
Node* root = create_node(arena, s::move(gs_copy));
for (uint r = 0; r < mMaxExpand; ++r){
Node* node = root;
uint next_midx = select_branch(node);
while (node->has_child(next_midx)){
node = node->child(next_midx); //node can be nullptr
next_midx = select_branch(node); //terminal state has no next_midx
}
float value;
if (next_midx >= BF){
//we reached terminal state, update visit count, we cannot choose
//to explore other nodes because visit count indicate best choice
value = -1.F * node->qvalue;
next_midx = node->last_midx;
node = node->parent;
} else {
//we have not expanded this node
GameState new_gs = node->gs;
Move move = mModel.action_encoder.idx_to_move(next_midx);
new_gs.apply_move(move);
Node* new_node = create_node(arena, s::move(new_gs), node, next_midx);
value = -1.F * new_node->qvalue;
}
// backup the tree to update visit counts
while (node != nullptr){
node->record_visit(next_midx, value);
next_midx = node->last_midx;
node = node->parent;
value = -1.F * value;
}
}
//collects experience, for AlphaZero, it's the visit count
//to select a move, pick the immediate branch with the highest visit
//count
append_experience(*root);
int max_midx = random_max_element(s::begin(root->branches), s::end(root->branches), [](Branch& a, Branch& b){ return a.visit_count < b.visit_count; }) - s::begin(root->branches);
return mModel.action_encoder.idx_to_move(max_midx);
}
void set_exp(ZeroEpisodicExpCollector& exp){
mExp = &exp;
}
};
} // rlgames
#endif//RLGAMES_ZERO_AGENT
|
cd217d781c2584f72e84fc3c5ba0bf850341314f | 273db14a7c56ce79ba5c1116d2e3dab56f82af9b | /src/reads_merger.cpp | faae6c536f1b2ebce4f4b7248ac805e805c5452a | [] | no_license | SvitlanaLukicheva/FastqFilesHandler | c5a8a5c276bbe2a3cb4a5505d4bcba191ee528e5 | 0e7d8c656d5e9b4cee2e1771caf01c224e37e85b | refs/heads/master | 2023-06-21T11:33:03.977976 | 2021-08-03T12:21:09 | 2021-08-03T12:21:09 | 85,825,927 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,346 | cpp | reads_merger.cpp | #include "reads_merger.hpp"
ReadsMerger::ReadsMerger(list<string> input_files, string output_file)
{
my_input_files = input_files;
my_output_file = output_file;
}
bool ReadsMerger::DoTheJob()
{
bool result = true;
output_formatter.DisplayInfo("Merging the files....");
ofstream output (my_output_file.c_str());
if(output.is_open())
{
if(my_input_files.size() % 2 != 0)
{
output_formatter.DisplayError("Invalid number of input files provided: " + my_input_files.size());
result = -1;
}
else
{
for(list<string>::iterator it=my_input_files.begin(); it != my_input_files.end(); it++)
{
string file_1 = *it;
it++;
string file_2 = *it;
output_formatter.DisplayInfo("Reading files " + file_1 + " and " + file_2);
ifstream input_1(file_1.c_str());
ifstream input_2(file_2.c_str());
if(input_1.is_open() && input_2.is_open())
merge_reads(&input_1, &input_2, &output);
else
{
output_formatter.DisplayError("Unable to open input files");
result = -1;
break;
}
}
}
output.close();
}
else
{
output_formatter.DisplayError("Unable to open the output file " + my_output_file);
result = false;
}
if(result == true)
output_formatter.DisplayInfo("Files successfully merged");
return result;
}
bool ReadsMerger::merge_reads(ifstream *input_1, ifstream *input_2, ofstream *output)
{
bool result = true;
bool please_continue = true;
while(please_continue)
{
bool write_1_ok = this->read_and_write_lines(input_1, output);
bool write_2_ok = this->read_and_write_lines(input_2, output);
if(write_1_ok && write_2_ok)
please_continue = true;
else if(write_1_ok || write_2_ok)
{
please_continue = false;
output_formatter.DisplayError("Reading failed");
result = false;
}
else
{
please_continue = false;
}
}
return result;
}
|
4ca4ec686892a798c392228f884b87f1ea5a05ab | b6b1005ad9768bfa06ebdd37df0e5de5df6790ef | /CG_TP/src/button.h | 69633adb8ee200ef4cd9c2a80f23375a0248f5df | [] | no_license | skdus531/CG_Project_Sung-Kil-Kwan | 3c49967f364b32eaab204a981da94e645cc3cb79 | ccb3b9a89af5622e1d93b85030a2c9e60fbf5216 | refs/heads/master | 2022-09-16T22:55:18.293383 | 2020-06-01T14:46:36 | 2020-06-01T14:46:36 | 262,537,641 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,868 | h | button.h | struct button_t
{
vec3 center = vec3(0); // 2D position for translation
float width = 1.0f; // radius
float height = 1.5f;
float theta = 0.0f; // rotation angle
vec3 color; // RGBA color in [0,1]
mat4 model_matrix; // modeling transformation
// public functions
void update(float t);
};
inline std::vector<button_t> create_buttons()
{
std::vector<button_t> buttons;
button_t c;
c = { vec3(10.7f,-20.0f,0.0f),1.0f,0.7f,0.0f,vec3(0.0f,0.5f,0.5f) };
buttons.emplace_back(c);
vec3 _pos[] = { vec3(1.0f, -7.0f, 0.0f), vec3(1.0f, -10.0f, 0.0f),vec3(1.0f, -13.0f, 0.0f),vec3(1.0f, -16.0f, 0.0f),vec3(-4.0f, -7.0f, 0.0f),vec3(-9.0f, -7.0f, 0.0f) };
vec3 _color[] = { vec3(1.0f,0.0f,0.0f),vec3(0.0f,0.0f,1.0f),vec3(0.0f,1.0f,0.0f),vec3(1.0f,1.0f,1.0f),vec3(1.0f,1.0f,0.0f),vec3(0.0f,0.0f,0.0f) };
for (size_t i = 0; i < 6; i++) {
button_t c;
float diff = 0.05f;
c.center = _pos[i]; c.color = _color[i]; buttons.push_back(c);
for (float diff = 0.05f, j = 0; j < 10; diff += 0.02f, j++) {
c.center.x = _pos[i].x - diff; c.center.y = _pos[i].y + diff * 3 / 2; c.color = _color[i]; buttons.push_back(c);
}
}
return buttons;
}
inline void button_t::update(float t)
{
//radius = 0.35f + cos(t) * 0.1f; // simple animation
theta = t;
float c = cos(theta), s = sin(theta);
// these transformations will be explained in later transformation lecture
mat4 scale_matrix =
{
height, 0, 0, 0,
0, width,0, 0,
0, 0, 1, 0,
0, 0, 0, 1
};
mat4 rotation_matrix =
{
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
/*c,-s, 0, 0,
s, c, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1*/
};
mat4 translate_matrix =
{
1, 0, 0, center.x,
0, 1, 0, center.y,
0, 0, 1, center.z,
0, 0, 0, 1
};
model_matrix = translate_matrix * rotation_matrix * scale_matrix;
}
|
b43614ef9c08c2a1c5edb7267ace1eca88195399 | 2479189775312ea0903300738c434c19a0fb3dcf | /src/uSendModemMsg/USM_MOOSApp.h | c504cdf38c197c08df11e2e52569886f61f8762d | [] | no_license | ucsb-coast-lab/moos-ivp-ucsb | fff18148334dc506fe5f33d24d4dd95f90cc0b3a | 327ebd5e70e6cc50c644ba474cfcf6cb09dad805 | refs/heads/master | 2023-06-11T06:26:36.893350 | 2021-07-01T21:17:10 | 2021-07-01T21:17:10 | 28,889,859 | 1 | 1 | null | 2019-06-26T18:12:20 | 2015-01-07T00:10:45 | C++ | UTF-8 | C++ | false | false | 1,641 | h | USM_MOOSApp.h | /*==========================================================================
File: USM_MOOSApp.h
Authors: Nick Nidzieko & Sean Gillen
Date: Jan/22/15
Origin: Horn Point Laboratory
Description: Allows users to send modem messages over a WHOI micromodem
needs to be running alongside iWhoiMicroModem, it should be
run in it's own window
Copyright 2015 Nick Nidzieko, Sean Gillen
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
==========================================================================*/
#ifndef USM_MOOSAPP_HEADER
#define USM_MOOSAPP_HEADER
#include "MOOS/libMOOS/MOOSLib.h"
#include <string>
#include "MBUtils.h"
#include "AngleUtils.h"
class USM_MOOSApp : public CMOOSApp
{
public:
USM_MOOSApp();
virtual ~USM_MOOSApp() {};
bool Iterate();
bool OnConnectToServer();
bool OnDisconnectFromServer();
bool OnStartUp();
//bool OnNewMail(MOOSMSG_LIST &NewMail);
std::string Dest;
std::string Cmd;
std::string PacketType;
std::string AckTimeoutSec;
};
std::string string_to_hex(const std::string&);
#endif
|
c19175a1cd7026d44abfe40880375e14efa224d7 | 154dfd2a2130a3a7731a9a9b431e8295fbf82cd2 | /POJ/POJ2187.cpp | 35298e7f3db1fe11d2a7a5d3e72b6eb1c5f13e85 | [] | no_license | ltf0501/Competitive-Programming | 1f898318eaecae14b6e040ffc7e36a9497ee288c | 9660b28d979721f2befcb590182975f10c9b6ac8 | refs/heads/master | 2022-11-20T21:08:45.651706 | 2020-07-23T11:55:05 | 2020-07-23T11:55:05 | 245,600,907 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,186 | cpp | POJ2187.cpp | #include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
#define ll long long
struct Point
{
ll x,y;
Point(){}
Point(ll _x,ll _y){x=_x,y=_y;}
bool operator < (const Point& rhs)const
{
return x!=rhs.x ? x<rhs.x : y<rhs.y;
}
Point operator + (const Point& rhs)const
{
return Point(x+rhs.x,y+rhs.y);
}
Point operator - (const Point& rhs)const
{
return Point(x-rhs.x,y-rhs.y);
}
ll operator * (const Point& rhs)const
{
return x*rhs.x+y*rhs.y;
}
ll operator ^ (const Point& rhs)const
{
return x*rhs.y-y*rhs.x;
}
};
ll dis(Point a, Point b)
{
return (a-b)*(a-b);
}
struct Geometry
{
vector<Point> v;
vector<int> convex;
void init()
{
v.clear();
convex.clear();
}
void add_point(int a,int b)
{
v.push_back(Point(a,b));
}
void Convex_Hull(int &r)
{
sort(v.begin(),v.end());
vector<int> tmp;
for(int i=0;i<(int)v.size();i++)
{
int SZ;
while((SZ=(int)tmp.size())>=2 && ((v[tmp[SZ-1]]-v[tmp[SZ-2]])^(v[i]-v[tmp[SZ-2]]))<=0)tmp.pop_back();
tmp.push_back(i);
}
r=(int)tmp.size()-1;
for(int i=0;i<(int)tmp.size();i++)convex.push_back(tmp[i]);
tmp.clear();
for(int i=(int)v.size()-1;i>=0;i--)
{
int SZ;
while((SZ=(int)tmp.size())>=2 && ((v[tmp[SZ-1]]-v[tmp[SZ-2]])^(v[i]-v[tmp[SZ-2]]))<=0)tmp.pop_back();
tmp.push_back(i);
}
for(int i=1;i<(int)tmp.size();i++)convex.push_back(tmp[i]);
}
ll cal()
{
if(v.size()==1)return 0;
if(v.size()==2)return dis(v[0],v[1]);
int r;
Convex_Hull(r);
// for(int i : convex)printf("%d: %lld %lld\n",i,v[i].x,v[i].y);
ll ans=0;
for(int i=0,j=r;i<r && r<(int)convex.size()-1;i++)
{
// printf("%d %d: %lld\n",convex[i],convex[j],dis(v[convex[i]],v[convex[j]]));
ans=max(ans,dis(v[convex[i]],v[convex[j]]));
while(((v[convex[i+1]]-v[convex[i]])^(v[convex[j+1]]-v[convex[j]]))>0)j++,ans=max(ans,dis(v[convex[i]],v[convex[j]]));
// printf("%d %d: %lld\n",convex[i],convex[j],dis(v[convex[i]],v[convex[j]]));
}
return ans;
}
};
int main()
{
int n;scanf("%d",&n);
Geometry solver;
solver.init();
for(int i=1;i<=n;i++)
{
ll x,y;scanf("%lld%lld",&x,&y);
solver.add_point(x,y);
}
printf("%lld\n",solver.cal());
return 0;
}
|
492f62da80e0843bfdafd742d0efb769af242384 | 3e35e5a3b7183b1397704e2e0b5ace1ab7d2e0c1 | /ConsoleApplication2/source03-04.cpp | b1d2dc7754c516e8f887c9a9f74e9b33581a742e | [] | no_license | sorcerer0001/ConsoleApplication2 | 9c6bd26ecd3dbb2db4ea79a6fcebcc51261adcc2 | 41c490183cdce06282d0bb51525743fc8263e092 | refs/heads/master | 2021-01-13T02:03:58.916408 | 2015-08-24T03:18:14 | 2015-08-24T03:18:14 | 40,527,302 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 489 | cpp | source03-04.cpp | #include<iostream>
using namespace std;
int sarr[101];
char s[101];
char s_[101];
int main() {
int i, n;
while (cin.getline(s, 101))
{
cout << s << endl;
for (i = 0; s[i]; ++i){
if (s[i]=='(')
{
s_[i]='$';
}
else if (s[i] == ')'){
s_[i]='?';
n = i;
while (n>0)
{
if (s_[n] == '$')
{
s_[n] = ' ';
s_[i] = ' ';
n = 0;
}
n--;
}
}
else
{
s_[i]= ' ';
}
}
cout << s_<<endl;
}
return 0;
}
|
0e3eb5b0cf1a38b9cc8adfe977de24d8ec011e4e | e7aeb92b601eb3a5a81fafa78dedb3c1dfce3fe8 | /TParty.h | c2d0cfa45e99e85dedfdc58e6baa379a9871a6c1 | [] | no_license | cryptobiu/MPCHonestMajority | 3c64a64d11b3830e593aff8084b6d2d98ca2f604 | 93eb4604d52ca7b93820f42d48bf62da8816bb69 | refs/heads/master | 2021-03-27T09:29:58.326122 | 2016-11-01T14:33:37 | 2016-11-01T14:33:37 | 86,227,287 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 753 | h | TParty.h | /*
* Party.h
*
* Created on: Aug 16, 2016
* Author: hila
*/
#ifndef PARTY_H_
#define PARTY_H_
#include "TField.h"
#include "HIM.h"
#include "stdio.h"
#include "stdlib.h"
#include <string>
#include "../../workspace/paho/src/MQTTClient.h"
#include <stdio.h>
#include <iostream>
#include <string>
#include <iostream>
#include <vector>
#include <map>
#include <iostream>
#include <cassert>
using namespace std;
class TParty {
private:
int m_pid;
bool m_is_happy;
public:
TParty(int num);
TFieldElement Interpolate(TFieldElement* alpha, int n, TFieldElement* x);
//void sendVectorToParties(TFieldElement** vector_of_x);
void sendVectorToParties(string myMessage);
void f(string myMessage);
virtual ~TParty();
};
#endif /* PARTY_H_ */
|
93dce6f1df87727fcba0bc3c13e89241d9094ead | d647a0746de08375701ac8aeb6c225c1666b4719 | /reverseNumberUsingLoop.cpp | 933bac3e0878fbe4d1ec733159fb15e24fbe6e0a | [] | no_license | Sabbir67/C-Programing-Problem | f17fa8f2206eedd43b3e261bcc6817c2410f3a1a | aff4d3b3a5265a95cad9508a88ebfd3c53190132 | refs/heads/main | 2023-07-16T03:41:24.008008 | 2021-08-31T14:10:15 | 2021-08-31T14:10:15 | 401,724,501 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 401 | cpp | reverseNumberUsingLoop.cpp | #include <iostream>
using namespace std;
int main()
{
int num , rev;
// User Input
cout<<"Please input a number ";
cin>>num; // num = 1234
// Find reverse Loop
for(rev = 0 ; num > 0 ; num = num/10 ){
rev = rev*10; // 0 ,40, 430 ,4320
rev = rev + num%10; // 4 ,43 , 432 ,4321
} // num = 123 , 12,1 ,
cout<<"Reverse Number is : "<<rev;
return 0;
}
|
85612ca4d6ad7eac6ee3202c1a99603768880456 | 2aed63d9aa027419b797e56b508417789a604a8b | /injector2degHex/case_interFoam_3mm/processor5/0.65/U | a01930def7cd05a2849fa80d1f651b8731d80fd0 | [] | no_license | icl-rocketry/injectorCFDModelling | 70137f1c6574240c7202638c3713102a3e1e9fd8 | 96591cf2cf3cd4cbd64536d8ae47ed8080ed9016 | refs/heads/main | 2023-08-25T03:30:59.244137 | 2021-10-09T21:04:45 | 2021-10-09T21:04:45 | 322,369,673 | 3 | 5 | null | null | null | null | UTF-8 | C++ | false | false | 118,342 | U | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0.65";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField nonuniform List<vector>
3352
(
(0.0467561 -43.7393 -0.000408091)
(-0.0585814 -42.7602 0.000511126)
(0.108069 -41.9213 -0.00094342)
(-0.075091 -40.8378 0.000655234)
(0.198964 -45.4781 -0.00173606)
(0.303566 -44.0591 -0.00265028)
(-0.162224 -36.3233 0.00141483)
(-0.210974 -28.4971 0.00184215)
(0.159176 -21.0548 -0.00138771)
(0.268109 -16.3533 -0.00233885)
(0.236437 -15.6333 -0.00206196)
(0.21339 -15.1266 -0.00186278)
(0.197081 -14.4359 -0.00172027)
(0.183255 -13.6056 -0.00159957)
(0.171506 -12.7007 -0.00149704)
(0.159724 -11.8047 -0.00139422)
(0.147786 -10.9591 -0.00129003)
(0.135539 -10.1756 -0.00118314)
(0.123086 -9.45165 -0.00107446)
(0.110452 -8.77973 -0.000964198)
(0.097713 -8.15135 -0.000853014)
(0.0849263 -7.55887 -0.000741414)
(0.0721653 -6.99615 -0.000630037)
(0.0595033 -6.4586 -0.000519522)
(0.0470189 -5.94295 -0.000410556)
(0.0347935 -5.44698 -0.000303848)
(0.0229118 -4.96926 -0.000200139)
(0.0114629 -4.5089 -0.000100205)
(0.000540452 -4.06541 -4.8638e-06)
(-0.00975528 -3.63852 8.50098e-05)
(-0.0193156 -3.22813 0.000168468)
(-0.028022 -2.83422 0.000244475)
(-0.0357432 -2.45685 0.000311887)
(-0.0423316 -2.09614 0.000369415)
(-0.0476186 -1.7522 0.00041559)
(-0.0514032 -1.42519 0.000448658)
(-0.0534456 -1.11531 0.000466529)
(-0.0533982 -0.8228 0.000466179)
(-0.0508973 -0.547918 0.000444416)
(0.0430368 -43.7976 -0.000375621)
(-0.0448279 -42.8128 0.000391077)
(0.0944058 -41.9583 -0.000824284)
(-0.142408 -40.9567 0.00124275)
(0.266829 -46.1715 -0.00232844)
(0.167373 -43.5763 -0.00146192)
(-0.360424 -35.6303 0.00314467)
(-0.278557 -28.773 0.00243223)
(0.165623 -21.7444 -0.00144364)
(0.31695 -16.4967 -0.00277296)
(0.253917 -15.6283 -0.00221575)
(0.222739 -15.1301 -0.00194527)
(0.203035 -14.4443 -0.00177249)
(0.187816 -13.6143 -0.00163938)
(0.176037 -12.707 -0.00153658)
(0.164128 -11.8072 -0.00143265)
(0.151782 -10.9582 -0.0013249)
(0.13888 -10.1718 -0.00121229)
(0.125685 -9.44561 -0.00109713)
(0.112308 -8.77191 -0.000980378)
(0.0988926 -8.14217 -0.000863295)
(0.0855215 -7.54868 -0.000746594)
(0.0722764 -6.98525 -0.000630992)
(0.0592229 -6.44726 -0.000517063)
(0.0464279 -5.93139 -0.000405388)
(0.0339582 -5.43541 -0.000296551)
(0.0218847 -4.95785 -0.000191172)
(0.0102846 -4.49784 -8.99235e-05)
(-0.000758353 -4.05482 6.46416e-06)
(-0.0111519 -3.62854 9.71855e-05)
(-0.0207938 -3.21887 0.000181349)
(-0.0295709 -2.82581 0.000257965)
(-0.0373572 -2.4494 0.000325936)
(-0.0440108 -2.08975 0.000384023)
(-0.0493713 -1.74698 0.000430828)
(-0.0532502 -1.42128 0.000464704)
(-0.0554334 -1.11284 0.000483783)
(-0.0556174 -0.821954 0.000485422)
(-0.0535757 -0.548998 0.000467621)
(0.0314844 -43.8247 -0.000274791)
(-0.0229936 -42.806 0.000200524)
(0.0719433 -41.8663 -0.000628326)
(-0.168904 -41.0023 0.00147403)
(0.225141 -46.3189 -0.00196496)
(-0.112192 -43.0301 0.000977945)
(-0.271514 -35.5322 0.00236947)
(-0.1085 -29.1039 0.000948257)
(0.250397 -22.1215 -0.00218375)
(0.346026 -16.5463 -0.00302277)
(0.279468 -15.6051 -0.0024389)
(0.240295 -15.12 -0.00209831)
(0.213876 -14.442 -0.00186714)
(0.194248 -13.6159 -0.00169556)
(0.180141 -12.7093 -0.00157242)
(0.167162 -11.8082 -0.00145914)
(0.154324 -10.9575 -0.0013471)
(0.141099 -10.1697 -0.00123168)
(0.127613 -9.44214 -0.00111398)
(0.113903 -8.7674 -0.000994314)
(0.100116 -8.1368 -0.000873982)
(0.0863431 -7.54261 -0.000753777)
(0.0726884 -6.97863 -0.000634598)
(0.0592323 -6.4402 -0.000517153)
(0.0460538 -5.92401 -0.000402127)
(0.0332255 -5.42783 -0.000290159)
(0.0208213 -4.95018 -0.000181891)
(0.00891791 -4.49018 -7.7992e-05)
(-0.00240284 -4.0473 2.08223e-05)
(-0.0130515 -3.62125 0.000113772)
(-0.0229291 -3.21194 0.000199995)
(-0.0319272 -2.81934 0.000278541)
(-0.0399252 -2.44351 0.000348361)
(-0.0467892 -2.08456 0.000408286)
(-0.0523719 -1.74261 0.000457029)
(-0.0565059 -1.41785 0.000493132)
(-0.0590174 -1.1105 0.000515074)
(-0.0596766 -0.820847 0.000520856)
(-0.0584093 -0.549286 0.000509814)
(0.027663 -43.8893 -0.000241432)
(-0.00701964 -42.8587 6.11136e-05)
(0.0681648 -41.7696 -0.00059542)
(-0.211341 -41.0568 0.00184439)
(0.193285 -46.4348 -0.00168711)
(-0.24709 -42.631 0.00215564)
(-0.0748625 -35.6168 0.000653739)
(0.00731437 -29.4291 -6.28507e-05)
(0.329333 -22.5083 -0.00287364)
(0.370886 -16.6009 -0.00323978)
(0.298768 -15.5813 -0.00260801)
(0.254412 -15.1075 -0.00222175)
(0.224316 -14.4378 -0.00195838)
(0.201915 -13.6169 -0.0017625)
(0.186042 -12.7117 -0.00162394)
(0.171946 -11.8091 -0.00150091)
(0.158274 -10.9562 -0.00138158)
(0.144326 -10.1663 -0.00125984)
(0.130165 -9.437 -0.00113625)
(0.115802 -8.76087 -0.00101089)
(0.10139 -8.12925 -0.000885106)
(0.0870239 -7.53432 -0.000759724)
(0.0728149 -6.96984 -0.000635709)
(0.0588453 -6.43112 -0.000513782)
(0.0451937 -5.91482 -0.000394629)
(0.0319303 -5.41865 -0.000278863)
(0.0191251 -4.94114 -0.000167095)
(0.00685062 -4.48138 -5.99581e-05)
(-0.00481542 -4.03884 4.187e-05)
(-0.0157876 -3.61322 0.000137644)
(-0.0259713 -3.20443 0.000226538)
(-0.0352625 -2.81244 0.000307643)
(-0.043547 -2.4373 0.000379965)
(-0.0507003 -2.07911 0.000442416)
(-0.0565901 -1.73802 0.00049384)
(-0.0610733 -1.41419 0.000532991)
(-0.0640185 -1.10784 0.000558719)
(-0.0652719 -0.819251 0.000569686)
(-0.0648713 -0.54875 0.000566212)
(0.0231096 -43.9428 -0.00020169)
(0.00257083 -42.8827 -2.25788e-05)
(0.0543377 -41.5748 -0.000474793)
(-0.259771 -41.0492 0.00226709)
(0.150969 -46.3994 -0.00131787)
(-0.313881 -42.4412 0.00273902)
(0.164649 -35.9208 -0.00143619)
(0.104735 -29.6881 -0.00091355)
(0.382641 -22.7867 -0.00333914)
(0.386488 -16.6266 -0.0033737)
(0.315141 -15.5463 -0.00275125)
(0.265798 -15.0905 -0.0023213)
(0.233179 -14.4303 -0.00203582)
(0.208563 -13.6152 -0.00182055)
(0.191169 -12.7123 -0.0016687)
(0.176063 -11.809 -0.00153685)
(0.161655 -10.9545 -0.0014111)
(0.1471 -10.1628 -0.00128406)
(0.132382 -9.43199 -0.00115561)
(0.117463 -8.75459 -0.0010254)
(0.102487 -8.12196 -0.00089469)
(0.0875484 -7.52627 -0.000764308)
(0.0727681 -6.96124 -0.000635306)
(0.0582376 -6.42216 -0.000508483)
(0.0440438 -5.90564 -0.000384597)
(0.0302619 -5.40941 -0.000264306)
(0.0169647 -4.93196 -0.000148243)
(0.0042252 -4.47238 -3.70469e-05)
(-0.00787986 -4.03012 6.86131e-05)
(-0.0192671 -3.6049 0.00016801)
(-0.0298448 -3.19659 0.000260343)
(-0.0395135 -2.80518 0.000344743)
(-0.0481653 -2.43071 0.000420269)
(-0.0556855 -2.07328 0.000485922)
(-0.0619572 -1.73303 0.000540679)
(-0.0668622 -1.4101 0.00058351)
(-0.070307 -1.10471 0.000613597)
(-0.0722021 -0.817074 0.000630162)
(-0.0726506 -0.547464 0.000634097)
(0.0200244 -44.0102 -0.000174755)
(0.0147411 -42.9342 -0.00012878)
(0.0481136 -41.331 -0.000420511)
(-0.296264 -41.0369 0.00258567)
(0.152412 -46.3831 -0.00133037)
(-0.248942 -42.5214 0.00217266)
(0.372357 -36.2985 -0.00324888)
(0.129497 -29.8389 -0.00113022)
(0.372862 -23.0033 -0.0032536)
(0.387512 -16.671 -0.00337977)
(0.326755 -15.5083 -0.00285237)
(0.273377 -15.0719 -0.00238753)
(0.239441 -14.4219 -0.00209056)
(0.213492 -13.613 -0.00186358)
(0.195221 -12.7125 -0.00170406)
(0.17947 -11.8085 -0.00156659)
(0.164502 -10.9523 -0.00143595)
(0.149403 -10.1587 -0.00130417)
(0.134138 -9.42628 -0.00117094)
(0.118657 -8.74752 -0.00103583)
(0.103109 -8.11384 -0.000900123)
(0.0875891 -7.51739 -0.00076467)
(0.072227 -6.95184 -0.000630591)
(0.0571196 -6.41243 -0.000498732)
(0.0423593 -5.89576 -0.000369902)
(0.0280253 -5.39951 -0.000244791)
(0.014193 -4.92218 -0.000124059)
(0.00093744 -4.46282 -8.35817e-06)
(-0.0116637 -4.02089 0.000101631)
(-0.0235268 -3.59609 0.000205182)
(-0.0345615 -3.1883 0.000301504)
(-0.0446705 -2.79749 0.000389747)
(-0.0537512 -2.42371 0.000469017)
(-0.0616972 -2.06704 0.000538386)
(-0.0684053 -1.7276 0.000596952)
(-0.0737784 -1.40555 0.000643868)
(-0.0777532 -1.10105 0.00067858)
(-0.0802866 -0.814297 0.000700713)
(-0.0815087 -0.545471 0.000711399)
(0.015063 -44.0771 -0.000131448)
(0.0282561 -42.9855 -0.000246716)
(0.0332265 -41.0205 -0.000290591)
(-0.306888 -41.0591 0.00267854)
(0.212109 -46.4648 -0.0018512)
(-0.0926084 -42.7744 0.000808333)
(0.458741 -36.5679 -0.00400306)
(0.056373 -29.8577 -0.000492515)
(0.281721 -23.1892 -0.00245758)
(0.371451 -16.7727 -0.00323762)
(0.333805 -15.4721 -0.00291314)
(0.277468 -15.0515 -0.00242321)
(0.242871 -14.4124 -0.00212058)
(0.216068 -13.6099 -0.00188608)
(0.197318 -12.7122 -0.00172237)
(0.181259 -11.8078 -0.00158221)
(0.166003 -10.9499 -0.00144906)
(0.150585 -10.1544 -0.00131449)
(0.134952 -9.42029 -0.00117805)
(0.119049 -8.74013 -0.00103925)
(0.103029 -8.10536 -0.000899439)
(0.086998 -7.50809 -0.000759518)
(0.0710935 -6.94198 -0.000620704)
(0.0554234 -6.40221 -0.000483934)
(0.0400902 -5.88536 -0.000350104)
(0.0251813 -5.38908 -0.000219975)
(0.010779 -4.91185 -9.42681e-05)
(-0.00303609 -4.45272 2.63163e-05)
(-0.0161823 -4.01112 0.000141064)
(-0.0285735 -3.58676 0.000249224)
(-0.0401178 -3.1795 0.000349994)
(-0.0507188 -2.7893 0.000442531)
(-0.0602769 -2.41621 0.000525968)
(-0.0686922 -2.0603 0.000599433)
(-0.0758723 -1.72169 0.000662118)
(-0.0817367 -1.40049 0.000713321)
(-0.0862426 -1.09686 0.000752668)
(-0.0893765 -0.810929 0.000780041)
(-0.0912682 -0.542831 0.000796572)
(0.00662027 -44.1506 -5.7758e-05)
(0.0498947 -43.0532 -0.000435549)
(0.0088875 -40.6866 -7.81415e-05)
(-0.26712 -41.2128 0.00233165)
(0.337384 -46.706 -0.00294437)
(0.0990728 -43.0482 -0.000864897)
(0.383131 -36.5729 -0.00334377)
(-0.0995921 -29.7633 0.000868421)
(0.130763 -23.4076 -0.00113919)
(0.341583 -16.9761 -0.00297548)
(0.336226 -15.4488 -0.0029333)
(0.278614 -15.0311 -0.00243303)
(0.243721 -14.4026 -0.0021281)
(0.216445 -13.6065 -0.00188939)
(0.197478 -12.712 -0.00172378)
(0.181383 -11.807 -0.00158329)
(0.166051 -10.9473 -0.00144947)
(0.150492 -10.1499 -0.00131368)
(0.134636 -9.41393 -0.0011753)
(0.118434 -8.73229 -0.00103389)
(0.102046 -8.09636 -0.000890859)
(0.0855842 -7.49823 -0.000747184)
(0.0691982 -6.93151 -0.000604168)
(0.0530056 -6.39136 -0.000462839)
(0.0371199 -5.87432 -0.000324186)
(0.0216386 -5.37802 -0.000189062)
(0.00665401 -4.9009 -5.82719e-05)
(-0.00774476 -4.442 6.74065e-05)
(-0.0214684 -4.00075 0.000187194)
(-0.0344249 -3.57683 0.000300287)
(-0.0465179 -3.17012 0.000405848)
(-0.0576492 -2.78055 0.000503013)
(-0.0677196 -2.40817 0.000590922)
(-0.076633 -2.05303 0.000668734)
(-0.084304 -1.71524 0.000735704)
(-0.0906635 -1.39489 0.000791228)
(-0.0956807 -1.09211 0.000835037)
(-0.0993567 -0.80699 0.000867141)
(-0.101806 -0.53961 0.000888538)
(-0.00724752 -44.2271 6.32779e-05)
(0.0798938 -43.1264 -0.000697354)
(-0.0296038 -40.3599 0.000257851)
(-0.182701 -41.5738 0.00159509)
(0.49344 -47.0767 -0.00430629)
(0.235119 -43.1342 -0.00205292)
(0.156092 -36.2499 -0.00136298)
(-0.277606 -29.6224 0.00242216)
(-0.0274934 -23.7005 0.000242871)
(0.309708 -17.2944 -0.00269627)
(0.335783 -15.4443 -0.00292904)
(0.277948 -15.0107 -0.00242703)
(0.242541 -14.3921 -0.00211792)
(0.214876 -13.6026 -0.00187572)
(0.195702 -12.7115 -0.00170828)
(0.179725 -11.8061 -0.00156882)
(0.16447 -10.9446 -0.00143568)
(0.148947 -10.1451 -0.0013002)
(0.133028 -9.40734 -0.00116127)
(0.116676 -8.72413 -0.00101855)
(0.100043 -8.08695 -0.000873378)
(0.0832511 -7.48789 -0.000726825)
(0.0664586 -6.9205 -0.000580262)
(0.0497951 -6.37993 -0.000434823)
(0.0333867 -5.86266 -0.000291609)
(0.0173447 -5.36631 -0.000151591)
(0.00177422 -4.88928 -1.56881e-05)
(-0.0132231 -4.43062 0.000115214)
(-0.027547 -3.98972 0.000240241)
(-0.0410959 -3.56626 0.000358505)
(-0.0537665 -3.16011 0.000469106)
(-0.0654553 -2.77119 0.000571138)
(-0.0760611 -2.39953 0.00066372)
(-0.0854883 -2.04519 0.000746017)
(-0.093655 -1.70823 0.000817313)
(-0.100498 -1.38874 0.00087706)
(-0.105992 -1.08681 0.000925028)
(-0.110142 -0.802507 0.000961267)
(-0.113039 -0.535866 0.000986572)
(-0.0256668 -44.3091 0.000224038)
(0.116974 -43.2035 -0.00102096)
(-0.079032 -40.0748 0.000689311)
(-0.0707767 -42.1663 0.000618428)
(0.632163 -47.4869 -0.00551711)
(0.24752 -42.879 -0.00216196)
(-0.134932 -35.6793 0.0011764)
(-0.391915 -29.5452 0.00342027)
(-0.136786 -24.0707 0.00119733)
(0.291595 -17.7043 -0.00253824)
(0.33473 -15.4573 -0.0029208)
(0.276489 -14.9903 -0.00241429)
(0.239949 -14.3807 -0.00209545)
(0.211784 -13.598 -0.00184878)
(0.192251 -12.7108 -0.00167817)
(0.17645 -11.8051 -0.00154025)
(0.161348 -10.9419 -0.00140843)
(0.145984 -10.1403 -0.00127434)
(0.130125 -9.40053 -0.00113593)
(0.113744 -8.71566 -0.000992962)
(0.0969741 -8.07715 -0.0008466)
(0.0799459 -7.47707 -0.000697981)
(0.0628201 -6.90895 -0.00054851)
(0.045739 -6.36788 -0.000399427)
(0.0288419 -5.85034 -0.000251948)
(0.0122558 -5.3539 -0.000107183)
(-0.00389779 -4.87696 3.38102e-05)
(-0.0195017 -4.41852 0.000170007)
(-0.0344412 -3.97798 0.000300406)
(-0.0486018 -3.55499 0.00042401)
(-0.0618698 -3.14942 0.000539825)
(-0.0741339 -2.76118 0.000646878)
(-0.0852876 -2.39027 0.000744242)
(-0.0952332 -2.03674 0.000831064)
(-0.103889 -1.70064 0.000906626)
(-0.111193 -1.38203 0.000970395)
(-0.117119 -1.08097 0.00102214)
(-0.12167 -0.79751 0.00106188)
(-0.124911 -0.531651 0.00109019)
(-0.0473723 -44.3952 0.000413476)
(0.15785 -43.2767 -0.00137769)
(-0.135136 -39.842 0.00117903)
(0.0479542 -42.9501 -0.000417723)
(0.704332 -47.796 -0.00614725)
(0.136317 -42.2609 -0.00119204)
(-0.370249 -35.0554 0.00323003)
(-0.392001 -29.6082 0.00342169)
(-0.15811 -24.4824 0.00138361)
(0.297684 -18.1509 -0.0025922)
(0.33559 -15.4762 -0.00293102)
(0.274979 -14.9681 -0.00240146)
(0.236425 -14.3675 -0.00206493)
(0.207473 -13.5922 -0.0018112)
(0.187338 -12.7096 -0.00163529)
(0.171706 -11.804 -0.00149884)
(0.156789 -10.9391 -0.00136865)
(0.141682 -10.1353 -0.0012368)
(0.125982 -9.39354 -0.00109978)
(0.109679 -8.70692 -0.000957484)
(0.0928661 -8.06699 -0.000810748)
(0.0756804 -7.46579 -0.000660755)
(0.0582826 -6.89685 -0.000508911)
(0.0408274 -6.35523 -0.000356564)
(0.0234686 -5.83735 -0.000205056)
(0.00635125 -5.34079 -5.56539e-05)
(-0.0103844 -4.8639 9.0418e-05)
(-0.0266021 -4.40567 0.000231971)
(-0.0421693 -3.96549 0.00036785)
(-0.0569561 -3.54299 0.000496919)
(-0.0708351 -3.13802 0.000618067)
(-0.0836846 -2.75047 0.000730229)
(-0.0953902 -2.38035 0.000832411)
(-0.105849 -2.02766 0.000923715)
(-0.114977 -1.69245 0.0010034)
(-0.12271 -1.37476 0.00107092)
(-0.129018 -1.07461 0.00112599)
(-0.133897 -0.792029 0.0011686)
(-0.137389 -0.527008 0.0011991)
(-0.0700764 -44.4853 0.000611629)
(0.199218 -43.3426 -0.00173872)
(-0.192887 -39.6619 0.00168311)
(0.160749 -43.8485 -0.00140216)
(0.684685 -47.8919 -0.00597613)
(-0.0288394 -41.4203 0.000249227)
(-0.45624 -34.5857 0.00398091)
(-0.278632 -29.8148 0.00243287)
(-0.102453 -24.8813 0.00089778)
(0.326861 -18.5762 -0.00284724)
(0.339393 -15.4853 -0.00296837)
(0.273608 -14.9415 -0.00239024)
(0.232208 -14.3516 -0.00202843)
(0.20215 -13.5847 -0.00176483)
(0.181196 -12.7076 -0.0015817)
(0.165707 -11.8025 -0.00144648)
(0.150995 -10.9361 -0.00131808)
(0.136215 -10.1302 -0.00118908)
(0.120747 -9.38637 -0.00105408)
(0.104597 -8.69792 -0.000913128)
(0.0878053 -8.05647 -0.000766579)
(0.0705155 -7.45406 -0.000615679)
(0.0528844 -6.8842 -0.000461799)
(0.0350805 -6.34193 -0.000306409)
(0.0172726 -5.82366 -0.000150983)
(-0.000373575 -5.32692 3.03401e-06)
(-0.0176966 -4.85005 0.000154232)
(-0.0345385 -4.39203 0.000301233)
(-0.0507462 -3.9522 0.000442701)
(-0.0661713 -3.53021 0.000577342)
(-0.0806707 -3.12586 0.000703905)
(-0.0941096 -2.73905 0.000821212)
(-0.106364 -2.36974 0.000928185)
(-0.117325 -2.01794 0.00102386)
(-0.1269 -1.68367 0.00110746)
(-0.135025 -1.36693 0.00117839)
(-0.141661 -1.06773 0.00123633)
(-0.146795 -0.78609 0.00128117)
(-0.15045 -0.521973 0.0013131)
(-0.0924004 -44.5783 0.000806462)
(0.238222 -43.399 -0.00207912)
(-0.245903 -39.5267 0.00214585)
(0.25807 -44.7651 -0.00225161)
(0.577628 -47.7488 -0.00504206)
(-0.149122 -40.5902 0.00129933)
(-0.382103 -34.375 0.00333454)
(-0.10646 -30.0998 0.000930563)
(-0.0288298 -25.2165 0.000255143)
(0.358302 -18.9469 -0.00312189)
(0.3455 -15.4746 -0.00302646)
(0.272248 -14.9081 -0.0023793)
(0.227372 -14.3324 -0.00198661)
(0.195968 -13.5751 -0.00171097)
(0.174049 -12.7045 -0.00151934)
(0.158686 -11.8006 -0.0013852)
(0.144204 -10.9328 -0.00125881)
(0.129806 -10.125 -0.00113314)
(0.114618 -9.37901 -0.00100059)
(0.0986662 -8.68865 -0.000861367)
(0.081928 -8.04557 -0.000715283)
(0.0645548 -7.44184 -0.000563656)
(0.0466994 -6.87097 -0.00040782)
(0.0285461 -6.32797 -0.000249382)
(0.0102807 -5.80923 -8.9963e-05)
(-0.00790835 -5.31226 6.8791e-05)
(-0.0258358 -4.83538 0.000225264)
(-0.0433194 -4.37754 0.000377866)
(-0.0601837 -3.93808 0.000525064)
(-0.0762596 -3.51661 0.000665385)
(-0.0913862 -3.11291 0.000797423)
(-0.105415 -2.72687 0.000919876)
(-0.118209 -2.35843 0.00103156)
(-0.129652 -2.00756 0.00113146)
(-0.139646 -1.67427 0.0012187)
(-0.148119 -1.35854 0.00129267)
(-0.155025 -1.06036 0.00135298)
(-0.160345 -0.77972 0.00139943)
(-0.164082 -0.51658 0.00143208)
(-0.112118 -44.6736 0.00097855)
(0.271984 -43.448 -0.00237376)
(-0.288063 -39.4289 0.00251384)
(0.332754 -45.6155 -0.00290355)
(0.419887 -47.4357 -0.00366551)
(-0.165863 -39.9641 0.00144603)
(-0.229512 -34.398 0.00200335)
(0.0375483 -30.3561 -0.00032625)
(-0.012765 -25.4612 0.000114915)
(0.360276 -19.2757 -0.00313928)
(0.350636 -15.4516 -0.0030756)
(0.270718 -14.8665 -0.00236669)
(0.221995 -14.3092 -0.00194011)
(0.189166 -13.5631 -0.00165173)
(0.166211 -12.7002 -0.00145094)
(0.150967 -11.7982 -0.00131784)
(0.13674 -10.9294 -0.00119366)
(0.122751 -10.1195 -0.00107156)
(0.107856 -9.37143 -0.000941573)
(0.0921059 -8.67908 -0.000804108)
(0.0754101 -8.03426 -0.000658396)
(0.0579335 -7.4291 -0.000505868)
(0.0398258 -6.8571 -0.00034783)
(0.0212905 -6.31327 -0.000186059)
(0.00253267 -5.794 -2.23441e-05)
(-0.0162336 -5.29675 0.000141447)
(-0.0347974 -4.81983 0.000303473)
(-0.0529504 -4.36217 0.000461917)
(-0.0704929 -3.92308 0.000615034)
(-0.0872338 -3.50215 0.00076116)
(-0.102994 -3.09914 0.000898726)
(-0.117608 -2.71392 0.0010263)
(-0.13093 -2.34639 0.00114258)
(-0.142831 -1.99652 0.00124648)
(-0.153208 -1.66427 0.00133707)
(-0.161982 -1.34961 0.00141366)
(-0.1691 -1.05252 0.00147582)
(-0.174535 -0.772944 0.00152328)
(-0.178279 -0.510855 0.00155599)
(-0.128589 -44.7702 0.00112229)
(0.298484 -43.4943 -0.00260502)
(-0.313446 -39.3606 0.00273539)
(0.379548 -46.3473 -0.0033121)
(0.259581 -47.0725 -0.00226643)
(-0.086958 -39.6029 0.000757932)
(-0.121554 -34.5119 0.00106123)
(0.064064 -30.4831 -0.000557859)
(-0.106197 -25.6186 0.000930414)
(0.308958 -19.6173 -0.00269084)
(0.35102 -15.4459 -0.00308177)
(0.269222 -14.8181 -0.00235391)
(0.216442 -14.2821 -0.00189205)
(0.182213 -13.5487 -0.0015912)
(0.158151 -12.6946 -0.00138061)
(0.142991 -11.7952 -0.00124823)
(0.129006 -10.9256 -0.00112616)
(0.115405 -10.1138 -0.00100745)
(0.100768 -9.36358 -0.000879701)
(0.0851686 -8.66914 -0.00074356)
(0.0684535 -8.02247 -0.000597681)
(0.050806 -7.41575 -0.000443662)
(0.0323754 -6.84252 -0.000282808)
(0.0133892 -6.29777 -0.000117103)
(-0.00592546 -5.77788 5.14719e-05)
(-0.0253266 -5.28031 0.000220804)
(-0.0445757 -4.80333 0.000388811)
(-0.0634372 -4.34585 0.000553438)
(-0.0816862 -3.90715 0.000712722)
(-0.0991093 -3.48679 0.000864802)
(-0.115508 -3.08452 0.00100795)
(-0.130703 -2.70016 0.00114058)
(-0.144534 -2.33361 0.00126132)
(-0.156865 -1.9848 0.00136896)
(-0.167585 -1.65366 0.00146255)
(-0.176609 -1.34015 0.00154133)
(-0.18388 -1.04421 0.00160481)
(-0.189362 -0.765783 0.00165269)
(-0.193039 -0.504826 0.00168482)
(-0.140649 -44.8674 0.00122755)
(0.316388 -43.5449 -0.00276126)
(-0.321225 -39.3138 0.00280325)
(0.396084 -46.9466 -0.00345655)
(0.132801 -46.76 -0.00115987)
(0.0177484 -39.4113 -0.000155702)
(-0.159513 -34.5215 0.00139204)
(-0.0687668 -30.4386 0.000601122)
(-0.295733 -25.7337 0.00258482)
(0.209047 -20.0397 -0.00181797)
(0.346089 -15.4961 -0.0030393)
(0.268542 -14.7665 -0.00234784)
(0.211545 -14.2509 -0.00184966)
(0.175856 -13.5318 -0.00153589)
(0.150538 -12.6876 -0.00131419)
(0.135329 -11.7916 -0.00118135)
(0.121496 -10.9215 -0.00106061)
(0.10818 -10.1079 -0.000944392)
(0.0936929 -9.35538 -0.000817954)
(0.078128 -8.65873 -0.000682111)
(0.0612719 -8.01008 -0.000535002)
(0.0433316 -7.40169 -0.000378429)
(0.0244615 -6.82711 -0.000213741)
(0.00491688 -6.28136 -4.31625e-05)
(-0.0150504 -5.7608 0.000131107)
(-0.0351681 -5.26286 0.000306692)
(-0.055169 -4.7858 0.000481261)
(-0.0747898 -4.32851 0.000652515)
(-0.0937804 -3.89022 0.000818272)
(-0.111906 -3.47049 0.000976481)
(-0.128949 -3.06901 0.00112525)
(-0.144716 -2.68559 0.00126288)
(-0.159035 -2.32008 0.00138788)
(-0.171763 -1.9724 0.00149898)
(-0.182781 -1.64246 0.00159518)
(-0.192001 -1.33016 0.00167568)
(-0.199361 -1.03546 0.00173994)
(-0.204822 -0.75826 0.00178762)
(-0.208361 -0.498516 0.00181856)
(-0.148722 -44.9638 0.001298)
(0.326402 -43.6059 -0.00284864)
(-0.315274 -39.2768 0.00275125)
(0.385217 -47.4266 -0.00336181)
(0.050958 -46.523 -0.000445513)
(0.0539043 -39.1917 -0.000471478)
(-0.364434 -34.2817 0.00317964)
(-0.324039 -30.2668 0.00282874)
(-0.500557 -25.8848 0.00437286)
(0.101851 -20.5831 -0.000881826)
(0.339898 -15.6265 -0.00298315)
(0.270022 -14.7154 -0.00236084)
(0.208548 -14.2159 -0.00182383)
(0.171044 -13.5122 -0.00149409)
(0.144197 -12.679 -0.00125887)
(0.128639 -11.7873 -0.00112297)
(0.114753 -10.917 -0.00100177)
(0.101515 -10.1015 -0.000886219)
(0.0869825 -9.34667 -0.000759386)
(0.071256 -8.6477 -0.000622135)
(0.0540703 -7.99695 -0.000472151)
(0.0356587 -7.38676 -0.000311465)
(0.0161849 -6.81074 -0.000141509)
(-0.00406456 -6.26391 3.52198e-05)
(-0.0248106 -5.74262 0.000216285)
(-0.0457494 -5.24429 0.000399037)
(-0.066585 -4.76717 0.00058089)
(-0.0870263 -4.31008 0.000759306)
(-0.106799 -3.87226 0.000931893)
(-0.125648 -3.4532 0.00109642)
(-0.14334 -3.05258 0.00125085)
(-0.159667 -2.67017 0.00139337)
(-0.17445 -2.30579 0.00152241)
(-0.187536 -1.95933 0.00163665)
(-0.198804 -1.63066 0.00173502)
(-0.208163 -1.31967 0.00181673)
(-0.215547 -1.02628 0.00188121)
(-0.220917 -0.750398 0.0019281)
(-0.224248 -0.491949 0.00195722)
(-0.153366 -45.0584 0.00133853)
(0.330465 -43.6798 -0.00288408)
(-0.306004 -39.2337 0.00267027)
(0.355814 -47.8122 -0.00310524)
(-0.00151384 -46.2945 1.24036e-05)
(-0.0401593 -38.7555 0.000349002)
(-0.665366 -33.7877 0.00580525)
(-0.593836 -30.0843 0.00518329)
(-0.629756 -26.1545 0.00550089)
(0.0354527 -21.2255 -0.00030221)
(0.340922 -15.8295 -0.0029874)
(0.275416 -14.6648 -0.00240903)
(0.208774 -14.1765 -0.00182615)
(0.168748 -13.4897 -0.00147427)
(0.139971 -12.6686 -0.00122203)
(0.123584 -11.782 -0.00107886)
(0.109316 -10.9118 -0.000954309)
(0.0958274 -10.0945 -0.000836578)
(0.0809603 -9.33727 -0.000706828)
(0.0647949 -8.63585 -0.000565747)
(0.0470241 -7.98286 -0.000410657)
(0.0279063 -7.37076 -0.00024381)
(0.00761947 -6.79321 -6.67586e-05)
(-0.0135171 -6.24525 0.000117712)
(-0.0351952 -5.7232 0.000306913)
(-0.0570796 -5.22449 0.000497917)
(-0.0788457 -4.74732 0.000687892)
(-0.100177 -4.29048 0.000874072)
(-0.120776 -3.85318 0.00105387)
(-0.140371 -3.43487 0.00122491)
(-0.158712 -3.0352 0.00138501)
(-0.175584 -2.65389 0.00153228)
(-0.190798 -2.29073 0.0016651)
(-0.2042 -1.94558 0.00178209)
(-0.215664 -1.61827 0.00188218)
(-0.2251 -1.30869 0.00196456)
(-0.232441 -1.0167 0.00202866)
(-0.237649 -0.742218 0.00207415)
(-0.240701 -0.485148 0.00210083)
(-0.156264 -45.1498 0.00136381)
(0.331487 -43.7615 -0.00289299)
(-0.305601 -39.1686 0.00266668)
(0.323538 -48.124 -0.00282355)
(-0.0520338 -45.9536 0.000453157)
(-0.249715 -38.0299 0.00217752)
(-0.945694 -33.1745 0.00825156)
(-0.767569 -30.0196 0.00669974)
(-0.632068 -26.5756 0.00552133)
(0.0339578 -21.8998 -0.000289224)
(0.356087 -16.0721 -0.00311518)
(0.286482 -14.6105 -0.0025082)
(0.213224 -14.1319 -0.00186546)
(0.169774 -13.4638 -0.00148347)
(0.138573 -12.6559 -0.00120987)
(0.120733 -11.7754 -0.00105398)
(0.105639 -10.9056 -0.000922229)
(0.0914644 -10.0866 -0.000798503)
(0.0758863 -9.32688 -0.000662549)
(0.0589284 -8.62292 -0.000514551)
(0.0402552 -7.96758 -0.000351588)
(0.0201463 -7.35348 -0.000176091)
(-0.00120218 -6.77434 1.02261e-05)
(-0.0234377 -6.2252 0.000204288)
(-0.0462229 -5.7024 0.000403151)
(-0.0691915 -5.20333 0.000603618)
(-0.0919926 -4.72615 0.000802627)
(-0.114286 -4.26964 0.000997207)
(-0.135756 -3.83294 0.00118461)
(-0.156114 -3.41547 0.00136231)
(-0.175103 -3.01684 0.00152806)
(-0.192497 -2.63673 0.0016799)
(-0.208106 -2.2749 0.00181616)
(-0.221773 -1.93115 0.00193547)
(-0.233375 -1.60531 0.00203675)
(-0.24282 -1.29722 0.00211923)
(-0.250048 -1.00674 0.00218234)
(-0.255021 -0.733745 0.00222577)
(-0.257722 -0.478136 0.00224939)
(-0.157698 -45.2368 0.00137632)
(0.330601 -43.8355 -0.00288526)
(-0.325519 -39.0733 0.00284041)
(0.306424 -48.3767 -0.00267419)
(-0.121528 -45.4061 0.00105942)
(-0.494185 -37.0819 0.00431101)
(-1.11377 -32.6259 0.00971879)
(-0.795567 -30.1482 0.00694459)
(-0.517167 -27.1169 0.00451873)
(0.0868316 -22.5342 -0.000750714)
(0.388436 -16.3189 -0.00339603)
(0.304445 -14.5446 -0.00266893)
(0.222383 -14.0811 -0.001946)
(0.174625 -13.434 -0.00152606)
(0.14046 -12.6406 -0.00122639)
(0.120479 -11.7671 -0.00105178)
(0.104035 -10.8981 -0.00090823)
(0.088654 -10.0774 -0.000773984)
(0.0719176 -9.31518 -0.00062792)
(0.0537519 -8.60857 -0.000469382)
(0.0338102 -7.9508 -0.000295348)
(0.0123863 -7.33464 -0.000108374)
(-0.0103014 -6.75387 8.96311e-05)
(-0.0338685 -6.20356 0.000295315)
(-0.0579487 -5.68004 0.000505481)
(-0.0821476 -5.18066 0.000716686)
(-0.10609 -4.70355 0.00092566)
(-0.129417 -4.24745 0.00112926)
(-0.151797 -3.81146 0.0013246)
(-0.172932 -3.39495 0.00150909)
(-0.192556 -2.99747 0.00168039)
(-0.210443 -2.61868 0.00183653)
(-0.226402 -2.25829 0.00197584)
(-0.240277 -1.91606 0.00209697)
(-0.25195 -1.5918 0.00219888)
(-0.261334 -1.28531 0.00228081)
(-0.268373 -0.99642 0.00234228)
(-0.273035 -0.725 0.00238301)
(-0.27531 -0.470937 0.00240291)
(-0.156854 -45.3188 0.00136896)
(0.324366 -43.8756 -0.00283084)
(-0.363711 -38.9556 0.00317371)
(0.323788 -48.5809 -0.00282575)
(-0.212706 -44.6319 0.00185493)
(-0.685509 -36.06 0.00598093)
(-1.14509 -32.271 0.00999284)
(-0.700684 -30.4723 0.00611722)
(-0.33482 -27.7154 0.00292757)
(0.167469 -23.0833 -0.00145467)
(0.436185 -16.5478 -0.00381338)
(0.329453 -14.46 -0.00289206)
(0.23628 -14.0228 -0.00206797)
(0.183452 -13.4 -0.00160336)
(0.145801 -12.6223 -0.00127307)
(0.122998 -11.7566 -0.00107378)
(0.104624 -10.8888 -0.000913391)
(0.0874711 -10.0666 -0.000763674)
(0.0690804 -9.30177 -0.000603171)
(0.0492511 -8.59246 -0.000430114)
(0.0276424 -7.93221 -0.00024153)
(0.00455578 -7.31396 -4.00451e-05)
(-0.0197644 -6.73156 0.000172208)
(-0.0449043 -6.18012 0.000391619)
(-0.0704704 -5.65594 0.000614755)
(-0.0960434 -5.15634 0.000837955)
(-0.121229 -4.67941 0.00105778)
(-0.145652 -4.22385 0.00127095)
(-0.168972 -3.78869 0.0014745)
(-0.190885 -3.37326 0.00166577)
(-0.211124 -2.97708 0.00184244)
(-0.229463 -2.59973 0.00200253)
(-0.245716 -2.2409 0.00214441)
(-0.259734 -1.90032 0.00226679)
(-0.271405 -1.57774 0.00236868)
(-0.280649 -1.27295 0.00244941)
(-0.28742 -0.985763 0.00250853)
(-0.291693 -0.716011 0.00254586)
(-0.293466 -0.463576 0.00256139)
(-0.146538 -45.395 0.00127892)
(0.301316 -43.855 -0.0026297)
(-0.399232 -38.8603 0.00348379)
(0.388636 -48.7422 -0.00339176)
(-0.311977 -43.6751 0.0027211)
(-0.780094 -35.1039 0.00680678)
(-1.07481 -32.146 0.00938035)
(-0.54319 -30.9451 0.00474346)
(-0.140196 -28.3147 0.00122927)
(0.252876 -23.539 -0.00220056)
(0.493841 -16.7532 -0.00431627)
(0.360307 -14.3525 -0.00316665)
(0.254547 -13.9558 -0.00222803)
(0.196029 -13.3614 -0.00171337)
(0.154456 -12.6005 -0.00134867)
(0.128207 -11.7435 -0.00111927)
(0.107314 -10.8773 -0.000936884)
(0.0878086 -10.0536 -0.000766638)
(0.0672474 -9.28624 -0.00058719)
(0.0452831 -8.57419 -0.0003955)
(0.021598 -7.91143 -0.000188794)
(-0.00350388 -7.29111 3.02807e-05)
(-0.029749 -6.70714 0.000259335)
(-0.0566975 -6.15465 0.000494533)
(-0.0839311 -5.62991 0.000732224)
(-0.11101 -5.13022 0.00096857)
(-0.137526 -4.65362 0.0012)
(-0.163093 -4.19874 0.00142316)
(-0.187367 -3.76457 0.00163505)
(-0.210045 -3.35038 0.001833)
(-0.230862 -2.95564 0.00201472)
(-0.249601 -2.57988 0.00217829)
(-0.266082 -2.22275 0.00232217)
(-0.280167 -1.88394 0.00244513)
(-0.291754 -1.56317 0.0025463)
(-0.300775 -1.26019 0.00262507)
(-0.307193 -0.974796 0.00268111)
(-0.310993 -0.706804 0.00271433)
(-0.312187 -0.45608 0.00272479)
(-0.122214 -45.4643 0.00106663)
(0.250657 -43.7591 -0.00218761)
(-0.394195 -38.8754 0.00344004)
(0.504036 -48.8534 -0.00439901)
(-0.397358 -42.5998 0.00346603)
(-0.784805 -34.2876 0.00684834)
(-0.956667 -32.2172 0.00835006)
(-0.375717 -31.5094 0.00328248)
(0.0302583 -28.8873 -0.00025815)
(0.331643 -23.9178 -0.00288834)
(0.555572 -16.9376 -0.00485281)
(0.395093 -14.2223 -0.0034757)
(0.276499 -13.8797 -0.00242011)
(0.211823 -13.3181 -0.00185143)
(0.166007 -12.5751 -0.00144956)
(0.135771 -11.7274 -0.00118531)
(0.111789 -10.8631 -0.000975965)
(0.0893701 -10.0381 -0.000780288)
(0.0661293 -9.26813 -0.000577453)
(0.0415691 -8.55336 -0.000363107)
(0.0154101 -7.88812 -0.000134808)
(-0.0120441 -7.26579 0.000104798)
(-0.0404885 -6.68034 0.000353048)
(-0.0694605 -6.12692 0.000605908)
(-0.0985207 -5.60178 0.000859543)
(-0.127214 -5.10217 0.00110998)
(-0.155124 -4.62607 0.00135358)
(-0.181861 -4.17206 0.00158696)
(-0.207083 -3.73906 0.00180711)
(-0.230492 -3.32629 0.00201146)
(-0.251835 -2.93315 0.00219776)
(-0.270904 -2.55914 0.00236422)
(-0.287533 -2.20386 0.00250939)
(-0.301598 -1.86695 0.00263219)
(-0.313011 -1.5481 0.00273183)
(-0.321717 -1.24705 0.00280786)
(-0.327692 -0.963549 0.00286004)
(-0.330934 -0.697408 0.00288838)
(-0.331466 -0.448475 0.00289307)
(-0.0794898 -45.5258 0.000693735)
(0.167272 -43.6022 -0.00145991)
(-0.326667 -39.1156 0.002851)
(0.65392 -48.8953 -0.00570729)
(-0.455964 -41.4514 0.00397729)
(-0.736504 -33.621 0.00642723)
(-0.829892 -32.4282 0.00724417)
(-0.225667 -32.1229 0.00197336)
(0.169348 -29.4302 -0.00147187)
(0.40741 -24.2447 -0.00354954)
(0.614911 -17.1038 -0.00536868)
(0.431569 -14.0732 -0.00379941)
(0.301077 -13.7947 -0.00263488)
(0.230009 -13.2702 -0.00201029)
(0.179748 -12.5458 -0.00156955)
(0.145093 -11.7078 -0.00126671)
(0.117508 -10.8458 -0.0010259)
(0.0916629 -10.0194 -0.000800326)
(0.0652706 -9.247 -0.000569983)
(0.0376917 -8.52955 -0.00032929)
(0.00869744 -7.86191 -7.62449e-05)
(-0.0214091 -7.23768 0.000186511)
(-0.0522896 -6.65091 0.000456025)
(-0.0834631 -6.09674 0.000728103)
(-0.114473 -5.5714 0.000998756)
(-0.144855 -5.07207 0.00126394)
(-0.17419 -4.59669 0.00151998)
(-0.202093 -4.14375 0.00176353)
(-0.228229 -3.71212 0.00199167)
(-0.252313 -3.30096 0.0022019)
(-0.274107 -2.90961 0.00239215)
(-0.293419 -2.53752 0.00256073)
(-0.310102 -2.18424 0.00270637)
(-0.324048 -1.84937 0.00282813)
(-0.335187 -1.53258 0.00292539)
(-0.343479 -1.23356 0.0029978)
(-0.348915 -0.952054 0.00304529)
(-0.351509 -0.687853 0.00306797)
(-0.351295 -0.44079 0.00306615)
(-0.0212297 -45.5788 0.000185258)
(0.0559043 -43.4138 -0.000488002)
(-0.195195 -39.6623 0.00170391)
(0.810243 -48.853 -0.00707185)
(-0.490286 -40.249 0.00427659)
(-0.671547 -33.0867 0.00586069)
(-0.707079 -32.7379 0.00617271)
(-0.0919329 -32.7636 0.000806504)
(0.28722 -29.9498 -0.00250041)
(0.485931 -24.5406 -0.00423464)
(0.670122 -17.2497 -0.00584963)
(0.467483 -13.9103 -0.00411781)
(0.326927 -13.7019 -0.00286057)
(0.249536 -13.2177 -0.00218079)
(0.194722 -12.5125 -0.0017003)
(0.155351 -11.6845 -0.00135627)
(0.123719 -10.8248 -0.00108014)
(0.0940135 -9.99728 -0.000820872)
(0.0640609 -9.22243 -0.000559455)
(0.0331037 -8.50237 -0.000289275)
(0.000972229 -7.83246 -8.8472e-06)
(-0.0320286 -7.2065 0.000279172)
(-0.0655272 -6.6186 0.000571538)
(-0.0990276 -6.06391 0.000863927)
(-0.132061 -5.53861 0.00115224)
(-0.164161 -5.03982 0.00143242)
(-0.194911 -4.5654 0.00170082)
(-0.223938 -4.11378 0.00195419)
(-0.250922 -3.68375 0.00218973)
(-0.275597 -3.27441 0.00240512)
(-0.297743 -2.88504 0.00259844)
(-0.317193 -2.51504 0.00276823)
(-0.333819 -2.16392 0.00291337)
(-0.347534 -1.83123 0.00303312)
(-0.358288 -1.51662 0.00312702)
(-0.36606 -1.21975 0.0031949)
(-0.370858 -0.940346 0.00323681)
(-0.372709 -0.678172 0.00325301)
(-0.371662 -0.433055 0.00324393)
(0.0491832 -45.6227 -0.000429288)
(-0.0756864 -43.2239 0.00066042)
(-0.0129594 -40.5538 0.000113773)
(0.935756 -48.696 -0.00816757)
(-0.5117 -39.0005 0.00446327)
(-0.613087 -32.6714 0.00535081)
(-0.58262 -33.1336 0.00508682)
(0.0382778 -33.4228 -0.000329617)
(0.399488 -30.4563 -0.00347998)
(0.57059 -24.8141 -0.00497338)
(0.720062 -17.3676 -0.00628509)
(0.50033 -13.7377 -0.00440848)
(0.352383 -13.6024 -0.00308265)
(0.269113 -13.1608 -0.00235163)
(0.209734 -12.4752 -0.00183137)
(0.1655 -11.657 -0.00144489)
(0.12948 -10.7998 -0.00113045)
(0.0955821 -9.97119 -0.000834595)
(0.0617496 -9.19399 -0.000539313)
(0.027142 -8.47146 -0.000237273)
(-0.00834716 -7.79946 7.24627e-05)
(-0.0444068 -7.17198 0.000387181)
(-0.0806328 -6.58322 0.000703355)
(-0.116519 -6.02829 0.00101657)
(-0.151588 -5.50331 0.00132266)
(-0.185379 -5.00534 0.00161759)
(-0.217486 -4.53216 0.00189784)
(-0.247553 -4.08212 0.00216029)
(-0.275283 -3.65394 0.00240234)
(-0.300432 -3.24665 0.00262187)
(-0.322807 -2.85947 0.0028172)
(-0.342266 -2.49174 0.00298707)
(-0.358707 -2.14294 0.00313061)
(-0.372067 -1.81259 0.00324726)
(-0.382317 -1.50028 0.00333676)
(-0.389456 -1.20567 0.00339911)
(-0.393508 -0.928461 0.00343452)
(-0.394519 -0.6684 0.00344338)
(-0.392552 -0.425302 0.00342627)
(0.124053 -45.6572 -0.00108273)
(-0.214305 -43.0618 0.00187017)
(0.199395 -41.7704 -0.00173931)
(0.991611 -48.3891 -0.0086554)
(-0.528148 -37.7269 0.00460671)
(-0.566497 -32.3807 0.00494453)
(-0.442469 -33.6243 0.00386401)
(0.173766 -34.098 -0.0015117)
(0.51304 -30.9519 -0.00447067)
(0.658209 -25.0634 -0.00573814)
(0.760269 -17.4471 -0.00663606)
(0.527049 -13.5596 -0.00464384)
(0.375556 -13.498 -0.00328464)
(0.287258 -13.0999 -0.00250989)
(0.223413 -12.4339 -0.0019508)
(0.174333 -11.6252 -0.00152201)
(0.133696 -10.7704 -0.00116728)
(0.0953988 -9.94075 -0.000833029)
(0.0574761 -9.16133 -0.000502047)
(0.0190533 -8.43651 -0.000166707)
(-0.0199146 -7.76264 0.000173393)
(-0.0591035 -7.13393 0.000515426)
(-0.0980797 -6.5446 0.000855606)
(-0.13633 -5.98975 0.00118946)
(-0.173376 -5.46542 0.00151281)
(-0.208769 -4.9686 0.00182173)
(-0.242119 -4.49697 0.00211283)
(-0.273095 -4.04879 0.00238321)
(-0.301427 -3.62272 0.00263053)
(-0.326902 -3.21771 0.0028529)
(-0.349356 -2.83293 0.00304892)
(-0.368675 -2.46767 0.00321757)
(-0.384787 -2.12135 0.00335824)
(-0.397653 -1.79348 0.00347058)
(-0.407269 -1.48361 0.00355455)
(-0.413653 -1.19137 0.00361032)
(-0.41685 -0.916441 0.00363826)
(-0.416921 -0.658572 0.00363893)
(-0.413944 -0.417563 0.003613)
(0.196017 -45.6821 -0.00171081)
(-0.345498 -42.9486 0.00301514)
(0.413071 -43.2263 -0.00360402)
(0.948332 -47.8978 -0.00827804)
(-0.545577 -36.4747 0.00475882)
(-0.52441 -32.2377 0.00457755)
(-0.280144 -34.2224 0.00244773)
(0.313675 -34.7821 -0.00273227)
(0.623919 -31.4272 -0.00543801)
(0.734235 -25.2785 -0.00640191)
(0.781925 -17.4804 -0.00682561)
(0.544086 -13.383 -0.00479121)
(0.394463 -13.3913 -0.00344923)
(0.302321 -13.0355 -0.00264122)
(0.234264 -12.3885 -0.00204555)
(0.180497 -11.5887 -0.00157586)
(0.135165 -10.7363 -0.00118014)
(0.0924 -9.90563 -0.00080689)
(0.0503035 -9.12415 -0.00043948)
(0.00802312 -8.39724 -7.04685e-05)
(-0.0344304 -7.7218 0.000300056)
(-0.0767121 -7.09218 0.000669086)
(-0.118363 -6.50265 0.00103262)
(-0.158868 -5.94824 0.00138615)
(-0.197754 -5.42493 0.00172556)
(-0.234589 -4.9296 0.00204707)
(-0.26901 -4.45984 0.00234752)
(-0.300713 -4.01383 0.00262426)
(-0.329464 -3.59014 0.00287522)
(-0.35508 -3.18766 0.00309885)
(-0.377434 -2.80549 0.00329399)
(-0.396444 -2.44288 0.00345994)
(-0.412065 -2.09922 0.00359633)
(-0.424288 -1.77396 0.00370306)
(-0.433131 -1.46664 0.00378028)
(-0.438635 -1.17687 0.00382837)
(-0.440863 -0.904327 0.00384786)
(-0.439891 -0.648727 0.00383943)
(-0.435813 -0.409871 0.00380389)
(0.255897 -45.6979 -0.00223342)
(-0.452547 -42.8972 0.00394939)
(0.599128 -44.7853 -0.00522779)
(0.804299 -47.2039 -0.00702131)
(-0.563285 -35.3173 0.00491356)
(-0.470778 -32.2715 0.00410978)
(-0.103428 -34.9267 0.000905859)
(0.442807 -35.4548 -0.00385883)
(0.718658 -31.864 -0.00626455)
(0.779547 -25.4461 -0.00679775)
(0.776657 -17.4683 -0.00678045)
(0.54932 -13.2201 -0.00483131)
(0.407303 -13.2857 -0.00356069)
(0.312646 -12.9683 -0.00273119)
(0.240774 -12.3389 -0.0021024)
(0.182607 -11.5473 -0.0015943)
(0.132652 -10.6971 -0.00115824)
(0.0854869 -9.86554 -0.000746587)
(0.0392666 -9.08219 -0.000343183)
(-0.00678512 -8.35348 5.87459e-05)
(-0.0526088 -7.67679 0.000458688)
(-0.0978322 -7.04664 0.000853396)
(-0.141978 -6.4573 0.0012387)
(-0.184532 -5.90374 0.00161013)
(-0.225037 -5.38184 0.00196368)
(-0.263084 -4.88837 0.00229577)
(-0.298341 -4.42082 0.00260352)
(-0.33054 -3.97729 0.00288458)
(-0.359482 -3.55626 0.00313723)
(-0.385025 -3.15655 0.00336021)
(-0.407075 -2.77722 0.00355271)
(-0.425584 -2.41745 0.00371429)
(-0.440539 -2.0766 0.00384486)
(-0.451957 -1.75409 0.00394457)
(-0.459882 -1.44944 0.00401378)
(-0.464375 -1.16225 0.00405304)
(-0.465516 -0.892163 0.00406305)
(-0.463399 -0.638904 0.00404462)
(-0.458129 -0.40226 0.00399869)
(0.296442 -45.7067 -0.00258728)
(-0.521236 -42.9121 0.00454888)
(0.735838 -46.2987 -0.00642098)
(0.591885 -46.3183 -0.00516769)
(-0.577658 -34.3327 0.00503939)
(-0.396667 -32.4988 0.00346325)
(0.0687136 -35.7045 -0.00059618)
(0.542008 -36.0909 -0.00472436)
(0.776813 -32.2399 -0.00677193)
(0.778074 -25.5568 -0.00678532)
(0.741591 -17.4252 -0.00647508)
(0.54283 -13.0837 -0.00476757)
(0.412503 -13.1843 -0.00360528)
(0.31677 -12.8987 -0.00276695)
(0.241542 -12.2853 -0.00210911)
(0.179365 -11.5009 -0.00156604)
(0.124963 -10.6526 -0.00109117)
(0.0735846 -9.82027 -0.000642737)
(0.0234179 -9.03527 -0.000204888)
(-0.0261905 -8.30508 0.000228086)
(-0.0751441 -7.62754 0.000655349)
(-0.12304 -6.99728 0.00107339)
(-0.169392 -6.40858 0.00147796)
(-0.213697 -5.8563 0.00186466)
(-0.255516 -5.33622 0.00222968)
(-0.294472 -4.845 0.00256972)
(-0.330271 -4.38002 0.0028822)
(-0.362683 -3.93928 0.00316513)
(-0.391552 -3.52119 0.00341714)
(-0.416773 -3.1245 0.00363732)
(-0.43829 -2.7482 0.00382517)
(-0.45609 -2.39145 0.00398056)
(-0.47019 -2.05356 0.00410367)
(-0.480634 -1.73394 0.00419488)
(-0.487489 -1.43207 0.00425475)
(-0.490837 -1.14754 0.00428402)
(-0.490775 -0.879997 0.00428353)
(-0.487409 -0.629142 0.0042542)
(-0.480859 -0.394763 0.00419709)
(0.312406 -45.7126 -0.0027266)
(-0.542252 -42.9955 0.0047323)
(0.812041 -47.6519 -0.00708618)
(0.371475 -45.2804 -0.0032442)
(-0.585105 -33.5716 0.00510483)
(-0.308742 -32.9107 0.00269611)
(0.207364 -36.4984 -0.00180613)
(0.591606 -36.6632 -0.00515727)
(0.779892 -32.5363 -0.00679881)
(0.724757 -25.6134 -0.00632032)
(0.681434 -17.3772 -0.00595016)
(0.524941 -12.9828 -0.00460536)
(0.408806 -13.0895 -0.00357211)
(0.313475 -12.8273 -0.00273789)
(0.235382 -12.2275 -0.00205537)
(0.169608 -11.4492 -0.0014809)
(0.110994 -10.6027 -0.000969283)
(0.0556921 -9.76961 -0.000486602)
(0.00187284 -8.98327 -1.68723e-05)
(-0.0509538 -8.25199 0.000444194)
(-0.102675 -7.57404 0.000895613)
(-0.152859 -6.94416 0.00133363)
(-0.201024 -6.35657 0.00175402)
(-0.246684 -5.80603 0.00215257)
(-0.289432 -5.2882 0.00252569)
(-0.328927 -4.79962 0.00287044)
(-0.364917 -4.33756 0.00318459)
(-0.397217 -3.89993 0.00346654)
(-0.42571 -3.48505 0.00371528)
(-0.450335 -3.0916 0.00393025)
(-0.471071 -2.71854 0.00411129)
(-0.487939 -2.36498 0.00425855)
(-0.500985 -2.0302 0.00437247)
(-0.510279 -1.71357 0.00445364)
(-0.51591 -1.41459 0.00450283)
(-0.517977 -1.13281 0.00452092)
(-0.516593 -0.867873 0.00450889)
(-0.511879 -0.619481 0.00446779)
(-0.503961 -0.387416 0.00439875)
(0.304266 -45.7218 -0.00265555)
(-0.51687 -43.1479 0.00451078)
(0.832536 -48.7924 -0.00726523)
(0.189557 -44.1591 -0.00165653)
(-0.597625 -33.0143 0.00521449)
(-0.22543 -33.4698 0.00196913)
(0.279247 -37.2451 -0.00243359)
(0.577269 -37.1481 -0.00503247)
(0.719672 -32.7483 -0.00627338)
(0.62834 -25.6345 -0.00547886)
(0.607699 -17.3512 -0.00530594)
(0.496331 -12.9199 -0.00434892)
(0.395668 -13.0031 -0.00345652)
(0.30183 -12.7544 -0.00263602)
(0.221295 -12.1653 -0.00193244)
(0.152272 -11.392 -0.00132962)
(0.0897604 -10.547 -0.000783983)
(0.0309098 -9.71342 -0.00027033)
(-0.0261542 -8.92611 0.000227721)
(-0.0817424 -8.19423 0.000712895)
(-0.13575 -7.51639 0.00118427)
(-0.187727 -6.88739 0.00163794)
(-0.237211 -6.30141 0.00206986)
(-0.283747 -5.75309 0.00247604)
(-0.326963 -5.23795 0.00285327)
(-0.366566 -4.7524 0.00319895)
(-0.402348 -4.29361 0.0035113)
(-0.43417 -3.85938 0.00378908)
(-0.461958 -3.44796 0.00403166)
(-0.485689 -3.05799 0.00423884)
(-0.505381 -2.68836 0.00441076)
(-0.521083 -2.33814 0.00454785)
(-0.532871 -2.00659 0.00465078)
(-0.540836 -1.69308 0.00472036)
(-0.545087 -1.39707 0.00475751)
(-0.54574 -1.11811 0.00476326)
(-0.54292 -0.855841 0.0047387)
(-0.536757 -0.609961 0.00468496)
(-0.527389 -0.380252 0.00460325)
(0.277365 -45.7412 -0.00242077)
(-0.455858 -43.3707 0.00397833)
(0.818147 -49.7175 -0.00713983)
(0.0519657 -42.9953 -0.000455655)
(-0.629807 -32.6063 0.00549567)
(-0.175873 -34.1101 0.00153666)
(0.257672 -37.8907 -0.00224565)
(0.492478 -37.5391 -0.00429297)
(0.602116 -32.8912 -0.00524758)
(0.507378 -25.6525 -0.00442274)
(0.535146 -17.3645 -0.00467134)
(0.460182 -12.8906 -0.00402329)
(0.373104 -12.9253 -0.00325896)
(0.28117 -12.6796 -0.00245558)
(0.198449 -12.0982 -0.00173308)
(0.12645 -11.3289 -0.00110427)
(0.0604208 -10.4853 -0.000527934)
(-0.00152362 -9.65158 1.27249e-05)
(-0.0613127 -8.8638 0.000534564)
(-0.119094 -8.13187 0.00103888)
(-0.174796 -7.45471 0.00152506)
(-0.22797 -6.82717 0.00198917)
(-0.278191 -6.24333 0.00242753)
(-0.325044 -5.6977 0.00283649)
(-0.368208 -5.18568 0.00321326)
(-0.407437 -4.70355 0.00355569)
(-0.442573 -4.24835 0.00386239)
(-0.473521 -3.81781 0.00413256)
(-0.500253 -3.4101 0.00436591)
(-0.52278 -3.0238 0.00456259)
(-0.541154 -2.65776 0.00472301)
(-0.555453 -2.31103 0.00484785)
(-0.565775 -1.98283 0.004938)
(-0.572234 -1.67253 0.00499442)
(-0.574952 -1.37956 0.0050182)
(-0.574061 -1.1035 0.00501046)
(-0.569694 -0.843946 0.0049724)
(-0.56199 -0.600621 0.00490521)
(-0.551092 -0.373301 0.00481016)
(0.240656 -45.7779 -0.00210037)
(-0.375899 -43.6685 0.00328054)
(0.794121 -50.4435 -0.00693033)
(-0.0645039 -41.778 0.000560881)
(-0.686464 -32.2854 0.00599036)
(-0.198951 -34.7383 0.00173802)
(0.131896 -38.4062 -0.00114834)
(0.337396 -37.8524 -0.00294001)
(0.443177 -32.9999 -0.00386055)
(0.380498 -25.7055 -0.00331458)
(0.475093 -17.424 -0.0041456)
(0.41867 -12.8816 -0.00365501)
(0.341228 -12.8533 -0.00298063)
(0.25096 -12.602 -0.00219191)
(0.166162 -12.0255 -0.00145132)
(0.0914145 -11.2594 -0.000798508)
(0.0223102 -10.4173 -0.000195329)
(-0.0421906 -9.58401 0.000367647)
(-0.104077 -8.79641 0.0009078)
(-0.163378 -8.06508 0.00142538)
(-0.220084 -7.38924 0.00192033)
(-0.273771 -6.76374 0.00238893)
(-0.324073 -6.18258 0.00282799)
(-0.370627 -5.64014 0.00323434)
(-0.413168 -5.13166 0.00360568)
(-0.451506 -4.6533 0.00394033)
(-0.48553 -4.202 0.00423734)
(-0.515194 -3.77541 0.00449629)
(-0.540505 -3.37163 0.00471726)
(-0.561511 -2.98918 0.00490066)
(-0.578292 -2.62688 0.00504718)
(-0.590951 -2.28375 0.0051577)
(-0.599605 -1.95901 0.00523329)
(-0.604384 -1.65199 0.00527505)
(-0.605423 -1.36215 0.00528417)
(-0.602863 -1.08902 0.00526187)
(-0.596845 -0.832233 0.0052094)
(-0.587513 -0.591499 0.005128)
(-0.575014 -0.366596 0.00501898)
(0.202799 -45.838 -0.00176995)
(-0.291977 -44.049 0.00254817)
(0.777242 -50.9821 -0.0067832)
(-0.193414 -40.4719 0.00168595)
(-0.770148 -31.9741 0.00672087)
(-0.330103 -35.2511 0.00288254)
(-0.0936014 -38.7922 0.000819328)
(0.116614 -38.1226 -0.00101344)
(0.259974 -33.1205 -0.00226152)
(0.258565 -25.8261 -0.00224936)
(0.428989 -17.5283 -0.00374205)
(0.371723 -12.8754 -0.00324541)
(0.300184 -12.7831 -0.0026228)
(0.210833 -12.5203 -0.00184184)
(0.123931 -11.9463 -0.00108279)
(0.0466405 -11.183 -0.000407743)
(-0.025025 -10.3429 0.000217793)
(-0.0914554 -9.51072 0.000797617)
(-0.15471 -8.72406 0.00134971)
(-0.214762 -7.9941 0.00187386)
(-0.271699 -7.32027 0.00237082)
(-0.325148 -6.69744 0.00283735)
(-0.374819 -6.1195 0.00327091)
(-0.420416 -5.5807 0.00366892)
(-0.461737 -5.07616 0.00402961)
(-0.498647 -4.60191 0.0043518)
(-0.531086 -4.1548 0.00463497)
(-0.559047 -3.73238 0.00487907)
(-0.582575 -3.33272 0.00508447)
(-0.601747 -2.95428 0.00525186)
(-0.616666 -2.59585 0.00538213)
(-0.627456 -2.25643 0.00547634)
(-0.634247 -1.93522 0.00553567)
(-0.637182 -1.63156 0.00556134)
(-0.636405 -1.34488 0.0055546)
(-0.63206 -1.07473 0.00551674)
(-0.624296 -0.820746 0.00544902)
(-0.613258 -0.582628 0.00535272)
(-0.599093 -0.360164 0.00522917)
(0.169951 -45.9264 -0.00148325)
(-0.215004 -44.516 0.00187645)
(0.77015 -51.3191 -0.0067215)
(-0.375156 -39.0184 0.00327205)
(-0.892751 -31.5908 0.00779097)
(-0.591876 -35.5586 0.00516702)
(-0.409444 -39.0721 0.00357558)
(-0.165742 -38.3928 0.0014506)
(0.0624746 -33.2999 -0.000537311)
(0.140992 -26.0355 -0.00122214)
(0.389664 -17.6668 -0.00339832)
(0.319401 -12.8606 -0.00279137)
(0.250244 -12.7102 -0.00218772)
(0.160648 -12.4325 -0.00140414)
(0.0715087 -11.8596 -0.000625322)
(-0.00812237 -11.0992 7.0207e-05)
(-0.0817583 -10.2619 0.000712948)
(-0.149407 -9.43178 0.00130341)
(-0.213211 -8.64699 0.00186031)
(-0.273175 -7.91924 0.0023837)
(-0.329509 -7.24815 0.0028754)
(-0.381926 -6.62862 0.00333292)
(-0.430229 -6.05443 0.00375455)
(-0.474196 -5.51973 0.00413833)
(-0.513693 -5.01949 0.0044831)
(-0.54864 -4.54965 0.00478817)
(-0.579024 -4.10698 0.0050534)
(-0.604876 -3.68894 0.00527909)
(-0.626271 -3.29355 0.00546587)
(-0.643309 -2.91924 0.00561465)
(-0.656113 -2.56479 0.00572645)
(-0.664818 -2.22916 0.00580247)
(-0.669567 -1.91155 0.00584397)
(-0.670507 -1.61129 0.00585223)
(-0.667788 -1.32782 0.00582855)
(-0.661557 -1.06069 0.00577421)
(-0.651962 -0.809524 0.00569051)
(-0.639148 -0.574042 0.00557873)
(-0.623264 -0.354032 0.00544016)
(0.143704 -46.0451 -0.00125416)
(-0.147137 -45.0627 0.00128422)
(0.754558 -51.392 -0.00658567)
(-0.646835 -37.3445 0.00564297)
(-1.07376 -31.0544 0.0093708)
(-0.994039 -35.5986 0.00867665)
(-0.812822 -39.2761 0.00709621)
(-0.509042 -38.7079 0.00444677)
(-0.151056 -33.5773 0.00132717)
(0.0178893 -26.345 -0.000146648)
(0.347582 -17.8333 -0.00303098)
(0.261851 -12.831 -0.0022936)
(0.191877 -12.6303 -0.00167938)
(0.100606 -12.3368 -0.000880534)
(0.00901148 -11.7645 -7.99299e-05)
(-0.0727484 -11.0077 0.000634244)
(-0.147706 -10.1742 0.00128853)
(-0.215797 -9.34736 0.00188287)
(-0.279274 -8.56551 0.00243691)
(-0.338269 -7.84088 0.00295185)
(-0.393143 -7.17329 0.00343082)
(-0.443727 -6.55768 0.00387235)
(-0.489927 -5.98777 0.00427562)
(-0.531605 -5.45757 0.00463943)
(-0.568694 -4.96197 0.00496318)
(-0.601167 -4.49681 0.00524665)
(-0.629052 -4.05877 0.00549008)
(-0.652414 -3.64528 0.00569403)
(-0.67135 -3.2543 0.00585936)
(-0.68598 -2.88423 0.00598711)
(-0.696437 -2.53382 0.00607843)
(-0.702864 -2.20204 0.00613457)
(-0.70541 -1.88808 0.00615684)
(-0.704223 -1.59126 0.00614653)
(-0.699454 -1.31102 0.00610495)
(-0.691247 -1.04693 0.00603338)
(-0.67975 -0.798602 0.00593308)
(-0.665105 -0.565769 0.0058053)
(-0.647455 -0.348221 0.00565133)
(0.119415 -46.1932 -0.00104216)
(-0.0800198 -45.6634 0.000698503)
(0.692869 -51.0752 -0.00604764)
(-1.01952 -35.3864 0.00889537)
(-1.33732 -30.2817 0.0116712)
(-1.52806 -35.3343 0.0133369)
(-1.30829 -39.428 0.0114211)
(-0.915774 -39.1125 0.00799659)
(-0.391363 -33.9808 0.00342559)
(-0.120995 -26.7616 0.00106674)
(0.295325 -18.0312 -0.00257508)
(0.199984 -12.7853 -0.00175877)
(0.125949 -12.5396 -0.00110517)
(0.0314437 -12.2309 -0.00027743)
(-0.062934 -11.6598 0.000547914)
(-0.146611 -10.908 0.0012789)
(-0.222237 -10.08 0.00193904)
(-0.289975 -9.25771 0.0025303)
(-0.352243 -8.47998 0.00307381)
(-0.409395 -7.75943 0.00357266)
(-0.461976 -7.09613 0.00403162)
(-0.509959 -6.48505 0.00445045)
(-0.553363 -5.91989 0.00482932)
(-0.592137 -5.39457 0.00516779)
(-0.626279 -4.9039 0.00546582)
(-0.655812 -4.44364 0.00572363)
(-0.680799 -4.01042 0.00594177)
(-0.701331 -3.6016 0.00612102)
(-0.717523 -3.21512 0.00626239)
(-0.729503 -2.84936 0.00636702)
(-0.737413 -2.50306 0.00643611)
(-0.741398 -2.17517 0.00647093)
(-0.741605 -1.86488 0.00647278)
(-0.738181 -1.57152 0.00644295)
(-0.731271 -1.29454 0.00638269)
(-0.721019 -1.03349 0.00629325)
(-0.707563 -0.788011 0.00617586)
(-0.691042 -0.557832 0.00603171)
(-0.671594 -0.34275 0.00586203)
(0.0900102 -46.3674 -0.000785521)
(-0.00496599 -46.2663 4.34813e-05)
(0.557962 -50.206 -0.00487071)
(-1.45265 -33.1092 0.0126754)
(-1.70387 -29.184 0.0148704)
(-2.15966 -34.752 0.018849)
(-1.89107 -39.5339 0.0165083)
(-1.38184 -39.6427 0.0120639)
(-0.66701 -34.5353 0.00583263)
(-0.277147 -27.2934 0.00243119)
(0.23027 -18.2727 -0.00200795)
(0.135245 -12.7245 -0.00119888)
(0.0537896 -12.4345 -0.000476669)
(-0.0454727 -12.1128 0.000393285)
(-0.143075 -11.5445 0.00124728)
(-0.228487 -10.7998 0.0019935)
(-0.3042 -9.9791 0.00265442)
(-0.370844 -9.16311 0.00323614)
(-0.431091 -8.39081 0.00376201)
(-0.485598 -7.67535 0.00423779)
(-0.535128 -7.0171 0.00467013)
(-0.57982 -6.41114 0.00506024)
(-0.619816 -5.85116 0.00540936)
(-0.655149 -5.33106 0.00571779)
(-0.68588 -4.84557 0.00598606)
(-0.712075 -4.39039 0.00621474)
(-0.733828 -3.96211 0.00640464)
(-0.751246 -3.55806 0.00655672)
(-0.764456 -3.17616 0.00667206)
(-0.773592 -2.81476 0.00675186)
(-0.778793 -2.47259 0.00679731)
(-0.780203 -2.14862 0.00680965)
(-0.777965 -1.84202 0.00679017)
(-0.772218 -1.55213 0.00674006)
(-0.763102 -1.27841 0.00666054)
(-0.750751 -1.02041 0.00655278)
(-0.735297 -0.777777 0.00641795)
(-0.71687 -0.550251 0.00625717)
(-0.695603 -0.337635 0.00607161)
(0.0532552 -46.5613 -0.000464731)
(0.0761845 -46.8055 -0.000664777)
(0.354575 -48.7131 -0.00309615)
(-1.87572 -30.4636 0.0163677)
(-2.14648 -27.6829 0.0187334)
(-2.82098 -33.8529 0.0246207)
(-2.5197 -39.5878 0.0219958)
(-1.87468 -40.3195 0.0163652)
(-0.970459 -35.2615 0.00848246)
(-0.435638 -27.951 0.00381653)
(0.15301 -18.5702 -0.00133538)
(0.0687032 -12.6501 -0.000624268)
(-0.0228912 -12.312 0.000191197)
(-0.128192 -11.9803 0.00111462)
(-0.22952 -11.4177 0.00200165)
(-0.316552 -10.6828 0.00276212)
(-0.391928 -9.87178 0.00342011)
(-0.456871 -9.06387 0.003987)
(-0.514425 -8.29838 0.00448938)
(-0.565623 -7.58904 0.00493628)
(-0.611481 -6.93659 0.00533657)
(-0.652322 -6.3363 0.00569307)
(-0.688415 -5.78191 0.00600813)
(-0.719879 -5.26732 0.0062828)
(-0.746833 -4.78721 0.0065181)
(-0.769382 -4.33726 0.00671495)
(-0.787641 -3.91402 0.00687436)
(-0.801731 -3.51481 0.00699739)
(-0.811782 -3.13753 0.00708517)
(-0.817929 -2.78052 0.00713888)
(-0.820305 -2.4425 0.00715967)
(-0.819048 -2.12246 0.00714873)
(-0.814292 -1.81955 0.00710726)
(-0.806166 -1.53313 0.00703639)
(-0.7948 -1.26266 0.00693723)
(-0.780319 -1.0077 0.00681088)
(-0.762845 -0.767917 0.00665841)
(-0.742499 -0.54304 0.00648088)
(-0.719403 -0.332884 0.00627937)
(0.0118359 -46.7651 -0.00010323)
(0.153838 -47.2157 -0.00134254)
(0.109235 -46.6181 -0.000955341)
(-2.20804 -27.4691 0.0192681)
(-2.56375 -25.7515 0.0223752)
(-3.39656 -32.653 0.0296441)
(-3.08888 -39.5802 0.0269632)
(-2.31434 -41.139 0.0202033)
(-1.26495 -36.1652 0.0110541)
(-0.562943 -28.7401 0.0049298)
(0.0689464 -18.9169 -0.000604554)
(0.000752057 -12.5633 -3.95404e-05)
(-0.101938 -12.1701 0.000879616)
(-0.214202 -11.8319 0.00186467)
(-0.319718 -11.2786 0.00278877)
(-0.408418 -10.5567 0.00356392)
(-0.483251 -9.75803 0.0042172)
(-0.546118 -8.96022 0.00476598)
(-0.600536 -8.20302 0.00524099)
(-0.647967 -7.50084 0.00565502)
(-0.689719 -6.85493 0.00601948)
(-0.726318 -6.26084 0.00633896)
(-0.758167 -5.71241 0.00661698)
(-0.78547 -5.20356 0.00685533)
(-0.808403 -4.72901 0.00705553)
(-0.827101 -4.28441 0.00721877)
(-0.841699 -3.86629 0.00734623)
(-0.852325 -3.47196 0.00743902)
(-0.859109 -3.09932 0.00749828)
(-0.862179 -2.74671 0.00752514)
(-0.861665 -2.41285 0.00752069)
(-0.85769 -2.09672 0.00748603)
(-0.850378 -1.7975 0.00742226)
(-0.839847 -1.51454 0.00733039)
(-0.826215 -1.24732 0.00721145)
(-0.809594 -0.995396 0.00706643)
(-0.790097 -0.758444 0.0068963)
(-0.767833 -0.536207 0.00670203)
(-0.742916 -0.328505 0.00648462)
(-0.0265066 -46.9677 0.000231412)
(0.214371 -47.4515 -0.00187088)
(-0.130483 -44.0655 0.00113661)
(-2.35132 -24.259 0.0205189)
(-2.797 -23.4722 0.0244109)
(-3.71603 -31.2099 0.0324322)
(-3.42307 -39.5162 0.0298798)
(-2.55955 -42.0564 0.0223464)
(-1.47463 -37.2194 0.012885)
(-0.608066 -29.6325 0.00532553)
(-0.0118405 -19.2848 9.80221e-05)
(-0.066458 -12.4638 0.000536255)
(-0.180461 -12.0081 0.00156334)
(-0.300318 -11.6668 0.00261563)
(-0.410581 -11.1266 0.00358169)
(-0.501243 -10.4214 0.00437408)
(-0.575632 -9.63784 0.00502351)
(-0.636353 -8.85227 0.00555357)
(-0.687479 -8.10491 0.00599987)
(-0.730946 -7.41097 0.00637931)
(-0.768391 -6.77235 0.00670618)
(-0.800561 -6.18495 0.006987)
(-0.828002 -5.64281 0.00722655)
(-0.851008 -5.13995 0.00742739)
(-0.869807 -4.67111 0.00759152)
(-0.884566 -4.23194 0.00772038)
(-0.895435 -3.819 0.00781529)
(-0.902546 -3.42958 0.00787739)
(-0.906026 -3.06159 0.00790782)
(-0.905998 -2.71337 0.00790763)
(-0.902578 -2.38366 0.00787782)
(-0.895879 -2.07144 0.00781938)
(-0.886012 -1.7759 0.00773331)
(-0.873083 -1.49639 0.0076205)
(-0.857194 -1.23239 0.00748187)
(-0.838448 -0.983491 0.0073183)
(-0.816944 -0.749362 0.00713065)
(-0.79278 -0.529756 0.00691979)
(-0.766062 -0.324497 0.00668666)
(-0.0542497 -47.1596 0.000473544)
(0.244597 -47.5059 -0.00213472)
(-0.297583 -41.3599 0.002595)
(-2.19615 -21.1204 0.0191653)
(-2.65031 -21.0751 0.0231306)
(-3.57669 -29.6508 0.031216)
(-3.30432 -39.4372 0.0288435)
(-2.43237 -42.9804 0.0212407)
(-1.48522 -38.3391 0.0129772)
(-0.514324 -30.5537 0.00450852)
(-0.0678765 -19.6083 0.000586509)
(-0.128266 -12.3444 0.00106293)
(-0.254569 -11.8254 0.00220823)
(-0.382797 -11.4842 0.00333483)
(-0.498666 -10.9612 0.00435035)
(-0.591907 -10.2763 0.00516537)
(-0.666324 -9.51101 0.00581508)
(-0.725187 -8.74 0.00632895)
(-0.773196 -8.0041 0.00674805)
(-0.0630113 -47.3344 0.000550005)
(0.236554 -47.4323 -0.00206456)
(-0.337737 -38.9494 0.00294566)
(-1.68014 -18.5107 0.0146624)
(-1.96128 -18.944 0.0171168)
(-2.83328 -28.1833 0.0247273)
(-2.54936 -39.4158 0.0222529)
(-1.79903 -43.7853 0.0157159)
(-1.17308 -39.3742 0.0102512)
(-0.247563 -31.3676 0.00218035)
(-0.0715045 -19.7898 0.000619087)
(-0.177509 -12.1885 0.00147837)
(-0.320172 -11.62 0.00277835)
(-0.458097 -11.2835 0.0039913)
(-0.580712 -10.7819 0.00506629)
(-0.677407 -10.1211 0.0059116)
(-0.752655 -9.37721 0.00656858)
(-0.00767889 -19.7236 6.20778e-05)
(-0.208303 -11.9675 0.00173185)
(0.046756 -43.7393 0.000408049)
(-0.0585813 -42.7602 -0.000511379)
(0.108069 -41.9213 0.000942891)
(-0.0750914 -40.8378 -0.000655576)
(0.198964 -45.4781 0.00173577)
(0.303566 -44.0591 0.00264998)
(-0.162224 -36.3233 -0.00141508)
(-0.210973 -28.4971 -0.00184302)
(0.1592 -21.0548 0.0013857)
(0.268109 -16.3533 0.00233869)
(0.236437 -15.6333 0.00206189)
(0.21339 -15.1266 0.0018627)
(0.197081 -14.4359 0.00172019)
(0.183255 -13.6056 0.0015995)
(0.171506 -12.7007 0.00149697)
(0.159724 -11.8047 0.00139416)
(0.147786 -10.9591 0.00128997)
(0.135539 -10.1756 0.00118308)
(0.123086 -9.45165 0.0010744)
(0.110452 -8.77973 0.000964143)
(0.097713 -8.15135 0.000852962)
(0.0849263 -7.55887 0.000741363)
(0.0721653 -6.99615 0.000629988)
(0.0595033 -6.4586 0.000519474)
(0.0470189 -5.94295 0.000410511)
(0.0347935 -5.44698 0.000303806)
(0.0229118 -4.96926 0.000200098)
(0.0114629 -4.5089 0.000100167)
(0.000540453 -4.06541 4.82768e-06)
(-0.00975528 -3.63852 -8.50435e-05)
(-0.0193156 -3.22813 -0.000168497)
(-0.028022 -2.83422 -0.000244503)
(-0.0357432 -2.45685 -0.000311913)
(-0.0423316 -2.09614 -0.000369439)
(-0.0476186 -1.7522 -0.000415611)
(-0.0514032 -1.42519 -0.000448677)
(-0.0534456 -1.11531 -0.000466545)
(-0.0533982 -0.8228 -0.000466193)
(-0.0508973 -0.547918 -0.000444428)
(0.0430371 -43.7976 0.000375599)
(-0.0448282 -42.8128 -0.00039135)
(0.094406 -41.9583 0.000823625)
(-0.142409 -40.9567 -0.00124311)
(0.266828 -46.1715 0.00232804)
(0.167373 -43.5763 0.00146143)
(-0.360424 -35.6303 -0.00314502)
(-0.278553 -28.773 -0.00243327)
(0.165639 -21.7444 0.00144077)
(0.316948 -16.4967 0.00277273)
(0.253917 -15.6283 0.00221567)
(0.222739 -15.1301 0.00194519)
(0.203035 -14.4443 0.00177241)
(0.187816 -13.6143 0.00163931)
(0.176037 -12.707 0.00153651)
(0.164128 -11.8072 0.00143258)
(0.151782 -10.9582 0.00132484)
(0.13888 -10.1718 0.00121223)
(0.125685 -9.44561 0.00109707)
(0.112308 -8.77191 0.000980322)
(0.0988926 -8.14217 0.000863241)
(0.0855215 -7.54868 0.000746543)
(0.0722764 -6.98525 0.000630943)
(0.0592229 -6.44726 0.000517015)
(0.0464279 -5.93139 0.000405343)
(0.0339582 -5.43541 0.000296508)
(0.0218847 -4.95785 0.000191132)
(0.0102846 -4.49784 8.98851e-05)
(-0.000758352 -4.05482 -6.5004e-06)
(-0.0111519 -3.62854 -9.72193e-05)
(-0.0207938 -3.21887 -0.000181378)
(-0.0295709 -2.82581 -0.000257993)
(-0.0373572 -2.4494 -0.000325962)
(-0.0440108 -2.08975 -0.000384047)
(-0.0493713 -1.74698 -0.000430849)
(-0.0532502 -1.42128 -0.000464723)
(-0.0554334 -1.11284 -0.0004838)
(-0.0556174 -0.821954 -0.000485437)
(-0.0535757 -0.548998 -0.000467632)
(0.0314845 -43.8247 0.000274775)
(-0.0229937 -42.806 -0.000200799)
(0.0719437 -41.8663 0.000627587)
(-0.168905 -41.0023 -0.0014744)
(0.225141 -46.3189 0.00196444)
(-0.112192 -43.0301 -0.00097853)
(-0.271513 -35.5322 -0.00236986)
(-0.108496 -29.1039 -0.000949376)
(0.250391 -22.1215 0.00218105)
(0.346025 -16.5464 0.0030225)
(0.279468 -15.6051 0.00243882)
(0.240295 -15.12 0.00209823)
(0.213876 -14.442 0.00186707)
(0.194248 -13.6159 0.00169548)
(0.180141 -12.7093 0.00157235)
(0.167162 -11.8082 0.00145907)
(0.154324 -10.9575 0.00134703)
(0.141099 -10.1697 0.00123162)
(0.127613 -9.44214 0.00111392)
(0.113903 -8.7674 0.000994257)
(0.100116 -8.1368 0.000873928)
(0.0863431 -7.54261 0.000753725)
(0.0726884 -6.97863 0.000634548)
(0.0592323 -6.4402 0.000517105)
(0.0460538 -5.92401 0.000402082)
(0.0332255 -5.42783 0.000290116)
(0.0208213 -4.95018 0.00018185)
(0.00891791 -4.49018 7.79533e-05)
(-0.00240284 -4.0473 -2.08588e-05)
(-0.0130514 -3.62125 -0.000113806)
(-0.0229292 -3.21194 -0.000200025)
(-0.0319272 -2.81934 -0.00027857)
(-0.0399252 -2.44351 -0.000348387)
(-0.0467892 -2.08456 -0.000408309)
(-0.0523719 -1.74261 -0.000457051)
(-0.0565059 -1.41785 -0.000493151)
(-0.0590174 -1.1105 -0.00051509)
(-0.0596766 -0.820847 -0.00052087)
(-0.0584093 -0.549286 -0.000509826)
(0.0276631 -43.8893 0.000241428)
(-0.00701968 -42.8587 -6.13872e-05)
(0.0681646 -41.7696 0.000594638)
(-0.211342 -41.0568 -0.00184475)
(0.193285 -46.4348 0.00168649)
(-0.24709 -42.631 -0.00215626)
(-0.0748625 -35.6168 -0.000654212)
(0.00731836 -29.4291 6.14514e-05)
(0.329334 -22.5083 0.00287049)
(0.370883 -16.6009 0.00323953)
(0.298768 -15.5813 0.00260793)
(0.254411 -15.1075 0.00222168)
(0.224316 -14.4378 0.0019583)
(0.201915 -13.6169 0.00176242)
(0.186042 -12.7117 0.00162387)
(0.171946 -11.8091 0.00150084)
(0.158274 -10.9562 0.00138151)
(0.144326 -10.1663 0.00125978)
(0.130165 -9.437 0.00113619)
(0.115802 -8.76087 0.00101083)
(0.10139 -8.12925 0.000885051)
(0.0870239 -7.53432 0.000759671)
(0.0728149 -6.96984 0.000635658)
(0.0588453 -6.43112 0.000513733)
(0.0451937 -5.91482 0.000394583)
(0.0319303 -5.41865 0.00027882)
(0.0191251 -4.94114 0.000167054)
(0.00685062 -4.48138 5.99191e-05)
(-0.00481542 -4.03884 -4.19067e-05)
(-0.0157876 -3.61322 -0.000137678)
(-0.0259713 -3.20443 -0.000226568)
(-0.0352625 -2.81244 -0.000307672)
(-0.043547 -2.4373 -0.000379991)
(-0.0507003 -2.07911 -0.000442439)
(-0.0565901 -1.73802 -0.000493861)
(-0.0610733 -1.41419 -0.00053301)
(-0.0640185 -1.10784 -0.000558736)
(-0.0652719 -0.819251 -0.000569701)
(-0.0648713 -0.54875 -0.000566224)
(0.0231092 -43.9428 0.000201684)
(0.00257104 -42.8827 2.23198e-05)
(0.0543376 -41.5748 0.000474006)
(-0.259771 -41.0492 -0.00226738)
(0.150969 -46.3994 0.0013172)
(-0.31388 -42.4412 -0.00273962)
(0.164649 -35.9208 0.00143563)
(0.104739 -29.6881 0.000911759)
(0.382641 -22.7867 0.00333579)
(0.386483 -16.6266 0.00337354)
(0.315141 -15.5463 0.00275117)
(0.265798 -15.0905 0.00232122)
(0.233179 -14.4303 0.00203574)
(0.208563 -13.6152 0.00182047)
(0.191169 -12.7123 0.00166862)
(0.176063 -11.809 0.00153678)
(0.161655 -10.9545 0.00141103)
(0.1471 -10.1628 0.00128399)
(0.132382 -9.43199 0.00115554)
(0.117463 -8.75459 0.00102534)
(0.102487 -8.12196 0.000894633)
(0.0875484 -7.52627 0.000764254)
(0.0727681 -6.96124 0.000635255)
(0.0582376 -6.42216 0.000508433)
(0.0440438 -5.90564 0.00038455)
(0.0302619 -5.40941 0.000264261)
(0.0169647 -4.93196 0.000148201)
(0.0042252 -4.47238 3.70074e-05)
(-0.00787986 -4.03012 -6.86503e-05)
(-0.0192671 -3.6049 -0.000168044)
(-0.0298449 -3.19659 -0.000260373)
(-0.0395135 -2.80518 -0.000344771)
(-0.0481653 -2.43071 -0.000420295)
(-0.0556855 -2.07328 -0.000485945)
(-0.0619572 -1.73303 -0.000540701)
(-0.0668622 -1.4101 -0.000583529)
(-0.070307 -1.10471 -0.000613614)
(-0.0722021 -0.817074 -0.000630177)
(-0.0726506 -0.547464 -0.00063411)
(0.0200244 -44.0102 0.000174769)
(0.0147403 -42.9342 0.000128537)
(0.0481138 -41.331 0.000419741)
(-0.296264 -41.0369 -0.00258583)
(0.152412 -46.3831 0.0013297)
(-0.248942 -42.5214 -0.00217322)
(0.372357 -36.2985 0.00324827)
(0.1295 -29.8389 0.00112805)
(0.372859 -23.0033 0.00325055)
(0.387507 -16.6711 0.00337971)
(0.326755 -15.5083 0.00285229)
(0.273377 -15.0719 0.00238746)
(0.239441 -14.4219 0.00209048)
(0.213492 -13.613 0.0018635)
(0.195221 -12.7125 0.00170399)
(0.17947 -11.8085 0.00156652)
(0.164502 -10.9523 0.00143588)
(0.149403 -10.1587 0.0013041)
(0.134138 -9.42628 0.00117088)
(0.118657 -8.74752 0.00103577)
(0.103109 -8.11384 0.000900065)
(0.0875891 -7.51739 0.000764614)
(0.072227 -6.95184 0.000630538)
(0.0571196 -6.41243 0.000498681)
(0.0423593 -5.89576 0.000369854)
(0.0280253 -5.39951 0.000244746)
(0.014193 -4.92218 0.000124016)
(0.000937441 -4.46282 8.31811e-06)
(-0.0116637 -4.02089 -0.000101669)
(-0.0235268 -3.59609 -0.000205217)
(-0.0345615 -3.1883 -0.000301534)
(-0.0446705 -2.79749 -0.000389776)
(-0.0537512 -2.42371 -0.000469044)
(-0.0616972 -2.06704 -0.00053841)
(-0.0684053 -1.7276 -0.000596974)
(-0.0737784 -1.40555 -0.000643888)
(-0.0777532 -1.10105 -0.000678597)
(-0.0802866 -0.814297 -0.000700728)
(-0.0815087 -0.545471 -0.000711412)
(0.0150628 -44.0771 0.00013147)
(0.0282555 -42.9855 0.000246503)
(0.0332272 -41.0205 0.000289873)
(-0.306888 -41.0591 -0.00267858)
(0.21211 -46.4648 0.00185056)
(-0.0926082 -42.7744 -0.000808893)
(0.458741 -36.5679 0.00400243)
(0.0563761 -29.8577 0.000490097)
(0.281719 -23.1892 0.00245513)
(0.371449 -16.7727 0.00323761)
(0.333805 -15.4721 0.00291306)
(0.277468 -15.0515 0.00242312)
(0.242871 -14.4124 0.0021205)
(0.216068 -13.6099 0.001886)
(0.197318 -12.7122 0.00172229)
(0.181259 -11.8078 0.00158213)
(0.166003 -10.9499 0.00144898)
(0.150585 -10.1544 0.00131442)
(0.134952 -9.42029 0.00117798)
(0.119049 -8.74013 0.00103919)
(0.103029 -8.10536 0.000899377)
(0.086998 -7.50809 0.00075946)
(0.0710935 -6.94198 0.000620649)
(0.0554234 -6.40221 0.000483882)
(0.0400902 -5.88536 0.000350055)
(0.0251813 -5.38908 0.000219929)
(0.010779 -4.91185 9.42248e-05)
(-0.00303609 -4.45272 -2.6357e-05)
(-0.0161823 -4.01112 -0.000141102)
(-0.0285735 -3.58676 -0.000249259)
(-0.0401178 -3.1795 -0.000350024)
(-0.0507188 -2.7893 -0.00044256)
(-0.0602769 -2.41621 -0.000525994)
(-0.0686922 -2.0603 -0.000599457)
(-0.0758723 -1.72169 -0.00066214)
(-0.0817367 -1.40049 -0.000713341)
(-0.0862426 -1.09686 -0.000752686)
(-0.0893765 -0.810929 -0.000780056)
(-0.0912682 -0.542831 -0.000796585)
(0.00662015 -44.1506 5.77891e-05)
(0.0498944 -43.0532 0.000435365)
(0.00888724 -40.6866 7.74921e-05)
(-0.267121 -41.2128 -0.00233163)
(0.337384 -46.706 0.00294378)
(0.0990728 -43.0482 0.000864302)
(0.383131 -36.5729 0.00334313)
(-0.0995895 -29.7633 -0.000870909)
(0.13076 -23.4076 0.00113754)
(0.341582 -16.9761 0.00297548)
(0.336226 -15.4488 0.00293322)
(0.278614 -15.0311 0.00243294)
(0.243721 -14.4026 0.002128)
(0.216445 -13.6065 0.0018893)
(0.197478 -12.712 0.00172369)
(0.181383 -11.807 0.00158321)
(0.166051 -10.9473 0.00144939)
(0.150492 -10.1499 0.00131361)
(0.134636 -9.41393 0.00117522)
(0.118434 -8.73229 0.00103383)
(0.102046 -8.09636 0.000890795)
(0.0855842 -7.49823 0.000747124)
(0.0691982 -6.93151 0.000604111)
(0.0530056 -6.39136 0.000462785)
(0.0371198 -5.87432 0.000324135)
(0.0216386 -5.37802 0.000189015)
(0.00665401 -4.9009 5.82277e-05)
(-0.00774476 -4.442 -6.74479e-05)
(-0.0214684 -4.00075 -0.000187233)
(-0.0344248 -3.57683 -0.000300323)
(-0.0465179 -3.17012 -0.000405878)
(-0.0576492 -2.78055 -0.000503043)
(-0.0677196 -2.40817 -0.000590949)
(-0.076633 -2.05303 -0.000668759)
(-0.084304 -1.71524 -0.000735726)
(-0.0906635 -1.39489 -0.000791248)
(-0.0956807 -1.09211 -0.000835055)
(-0.0993567 -0.80699 -0.000867157)
(-0.101806 -0.53961 -0.000888551)
(-0.00724753 -44.2271 -6.32422e-05)
(0.0798939 -43.1264 0.000697191)
(-0.0296037 -40.3599 -0.000258406)
(-0.182702 -41.5738 -0.00159504)
(0.49344 -47.0767 0.00430574)
(0.235119 -43.1342 0.00205227)
(0.156092 -36.2499 0.00136236)
(-0.277603 -29.6223 -0.00242456)
(-0.0274961 -23.7005 -0.000243759)
(0.309705 -17.2944 0.00269629)
(0.335783 -15.4443 0.00292896)
(0.277948 -15.0107 0.00242693)
(0.242541 -14.3921 0.00211782)
(0.214876 -13.6026 0.00187562)
(0.195702 -12.7115 0.00170818)
(0.179725 -11.8061 0.00156873)
(0.16447 -10.9446 0.00143559)
(0.148947 -10.1451 0.00130012)
(0.133028 -9.40734 0.00116119)
(0.116676 -8.72413 0.00101848)
(0.100043 -8.08695 0.000873311)
(0.0832511 -7.48789 0.000726763)
(0.0664586 -6.9205 0.000580203)
(0.0497951 -6.37993 0.000434768)
(0.0333867 -5.86266 0.000291558)
(0.0173447 -5.36631 0.000151543)
(0.00177422 -4.88928 1.56431e-05)
(-0.0132231 -4.43062 -0.000115256)
(-0.027547 -3.98972 -0.00024028)
(-0.0410959 -3.56626 -0.000358541)
(-0.0537665 -3.16011 -0.000469137)
(-0.0654553 -2.77119 -0.000571168)
(-0.0760611 -2.39953 -0.000663747)
(-0.0854883 -2.04519 -0.000746041)
(-0.093655 -1.70823 -0.000817335)
(-0.100498 -1.38874 -0.00087708)
(-0.105992 -1.08681 -0.000925046)
(-0.110142 -0.802507 -0.000961283)
(-0.113039 -0.535866 -0.000986585)
(-0.0256666 -44.3091 -0.000223997)
(0.116974 -43.2035 0.00102081)
(-0.0790316 -40.0748 -0.000689772)
(-0.0707773 -42.1663 -0.000618425)
(0.632163 -47.4869 0.00551658)
(0.24752 -42.879 0.00216124)
(-0.134933 -35.6793 -0.00117706)
(-0.391913 -29.5451 -0.00342246)
(-0.136789 -24.0707 -0.00119772)
(0.291593 -17.7043 0.00253828)
(0.33473 -15.4573 0.00292072)
(0.276489 -14.9903 0.00241417)
(0.239949 -14.3807 0.00209534)
(0.211784 -13.598 0.00184866)
(0.192251 -12.7108 0.00167806)
(0.17645 -11.8051 0.00154014)
(0.161348 -10.9419 0.00140834)
(0.145984 -10.1403 0.00127426)
(0.130125 -9.40053 0.00113585)
(0.113744 -8.71566 0.000992886)
(0.0969741 -8.07715 0.00084653)
(0.0799459 -7.47707 0.000697916)
(0.0628201 -6.90895 0.000548449)
(0.045739 -6.36788 0.00039937)
(0.0288419 -5.85034 0.000251895)
(0.0122558 -5.3539 0.000107133)
(-0.00389779 -4.87696 -3.38561e-05)
(-0.0195017 -4.41852 -0.00017005)
(-0.0344412 -3.97798 -0.000300446)
(-0.0486018 -3.55499 -0.000424046)
(-0.0618698 -3.14942 -0.000539856)
(-0.0741339 -2.76118 -0.000646908)
(-0.0852876 -2.39027 -0.00074427)
(-0.0952332 -2.03674 -0.000831089)
(-0.103889 -1.70064 -0.000906649)
(-0.111193 -1.38203 -0.000970415)
(-0.117119 -1.08097 -0.00102216)
(-0.12167 -0.79751 -0.00106189)
(-0.124911 -0.531651 -0.00109021)
(-0.047372 -44.3952 -0.000413436)
(0.15785 -43.2767 0.00137756)
(-0.135135 -39.842 -0.00117941)
(0.0479537 -42.9501 0.000417598)
(0.704332 -47.796 0.00614674)
(0.136317 -42.2609 0.00119132)
(-0.370249 -35.0554 -0.00323077)
(-0.392 -29.6082 -0.00342357)
(-0.158111 -24.4824 -0.00138378)
(0.297683 -18.1509 0.00259226)
(0.33559 -15.4762 0.00293093)
(0.274979 -14.9681 0.00240133)
(0.236425 -14.3675 0.0020648)
(0.207473 -13.5922 0.00181107)
(0.187338 -12.7096 0.00163517)
(0.171706 -11.804 0.00149873)
(0.156789 -10.9391 0.00136855)
(0.141682 -10.1353 0.0012367)
(0.125982 -9.39354 0.00109969)
(0.109679 -8.70692 0.000957404)
(0.0928661 -8.06699 0.000810674)
(0.0756804 -7.46579 0.000660687)
(0.0582826 -6.89685 0.000508847)
(0.0408274 -6.35523 0.000356505)
(0.0234686 -5.83735 0.000205001)
(0.00635125 -5.34079 5.56036e-05)
(-0.0103844 -4.8639 -9.04648e-05)
(-0.0266021 -4.40567 -0.000232015)
(-0.0421693 -3.96549 -0.00036789)
(-0.0569561 -3.54299 -0.000496955)
(-0.0708351 -3.13802 -0.000618098)
(-0.0836845 -2.75047 -0.000730259)
(-0.0953902 -2.38035 -0.000832439)
(-0.105849 -2.02766 -0.000923741)
(-0.114977 -1.69245 -0.00100342)
(-0.12271 -1.37476 -0.00107094)
(-0.129018 -1.07461 -0.00112601)
(-0.133897 -0.792029 -0.00116861)
(-0.137389 -0.527008 -0.00119911)
(-0.0700762 -44.4853 -0.000611594)
(0.199218 -43.3426 0.0017386)
(-0.192887 -39.6619 -0.00168343)
(0.160748 -43.8485 0.00140188)
(0.684685 -47.892 0.00597568)
(-0.0288393 -41.4203 -0.000249875)
(-0.45624 -34.5857 -0.00398171)
(-0.278632 -29.8148 -0.00243445)
(-0.102454 -24.8813 -0.000897901)
(0.32686 -18.5762 0.00284745)
(0.339393 -15.4853 0.00296828)
(0.273608 -14.9415 0.00239009)
(0.232208 -14.3516 0.00202828)
(0.20215 -13.5847 0.00176468)
(0.181196 -12.7076 0.00158156)
(0.165707 -11.8025 0.00144636)
(0.150995 -10.9361 0.00131796)
(0.136215 -10.1302 0.00118898)
(0.120747 -9.38637 0.00105399)
(0.104597 -8.69792 0.000913043)
(0.0878053 -8.05647 0.000766502)
(0.0705155 -7.45406 0.000615608)
(0.0528844 -6.8842 0.000461734)
(0.0350805 -6.34193 0.000306349)
(0.0172726 -5.82366 0.000150928)
(-0.000373575 -5.32692 -3.0854e-06)
(-0.0176966 -4.85005 -0.00015428)
(-0.0345385 -4.39203 -0.000301277)
(-0.0507462 -3.9522 -0.000442743)
(-0.0661713 -3.53021 -0.000577378)
(-0.0806707 -3.12586 -0.000703935)
(-0.0941096 -2.73905 -0.000821243)
(-0.106364 -2.36974 -0.000928213)
(-0.117325 -2.01794 -0.00102389)
(-0.1269 -1.68367 -0.00110749)
(-0.135025 -1.36693 -0.00117841)
(-0.141661 -1.06773 -0.00123635)
(-0.146795 -0.78609 -0.00128118)
(-0.15045 -0.521973 -0.00131311)
(-0.0924003 -44.5783 -0.000806435)
(0.238222 -43.399 0.002079)
(-0.245903 -39.5267 -0.00214612)
(0.258069 -44.7652 0.00225121)
(0.577627 -47.7488 0.00504169)
(-0.149121 -40.5902 -0.00129989)
(-0.382103 -34.375 -0.00333532)
(-0.10646 -30.0998 -0.000931922)
(-0.0288304 -25.2165 -0.000255141)
(0.358297 -18.947 0.00312245)
(0.3455 -15.4746 0.00302637)
(0.272248 -14.9081 0.00237913)
(0.227372 -14.3324 0.00198644)
(0.195968 -13.5751 0.00171081)
(0.174049 -12.7045 0.00151918)
(0.158686 -11.8006 0.00138507)
(0.144204 -10.9328 0.00125869)
(0.129806 -10.125 0.00113304)
(0.114618 -9.37901 0.00100049)
(0.0986662 -8.68865 0.000861278)
(0.081928 -8.04557 0.000715202)
(0.0645548 -7.44184 0.000563583)
(0.0466994 -6.87097 0.000407753)
(0.0285461 -6.32797 0.00024932)
(0.0102807 -5.80923 8.99063e-05)
(-0.00790835 -5.31226 -6.88434e-05)
(-0.0258358 -4.83538 -0.000225312)
(-0.0433194 -4.37754 -0.000377911)
(-0.0601837 -3.93808 -0.000525106)
(-0.0762596 -3.51661 -0.000665421)
(-0.0913862 -3.11291 -0.000797454)
(-0.105415 -2.72687 -0.000919907)
(-0.118209 -2.35843 -0.00103159)
(-0.129652 -2.00756 -0.00113148)
(-0.139646 -1.67427 -0.00121873)
(-0.148119 -1.35854 -0.00129269)
(-0.155025 -1.06036 -0.001353)
(-0.160345 -0.77972 -0.00139944)
(-0.164082 -0.51658 -0.00143209)
(-0.112118 -44.6736 -0.000978531)
(0.271984 -43.448 0.00237366)
(-0.288063 -39.4289 -0.00251407)
(0.332754 -45.6155 0.00290306)
(0.419887 -47.4357 0.0036652)
(-0.165862 -39.9641 -0.00144655)
(-0.229512 -34.398 -0.00200409)
(0.037548 -30.3561 0.000325054)
(-0.0127659 -25.4612 -0.000114591)
(0.360271 -19.2757 0.00314021)
(0.350636 -15.4516 0.00307552)
(0.270718 -14.8665 0.00236651)
(0.221995 -14.3092 0.00193992)
(0.189166 -13.5631 0.00165156)
(0.166211 -12.7002 0.00145078)
(0.150967 -11.7982 0.00131769)
(0.13674 -10.9294 0.00119353)
(0.122751 -10.1195 0.00107145)
(0.107856 -9.37143 0.000941469)
(0.0921059 -8.67908 0.000804015)
(0.0754101 -8.03426 0.000658312)
(0.0579335 -7.4291 0.000505792)
(0.0398258 -6.8571 0.000347761)
(0.0212905 -6.31327 0.000185996)
(0.00253267 -5.79399 2.22863e-05)
(-0.0162336 -5.29675 -0.000141501)
(-0.0347974 -4.81983 -0.000303523)
(-0.0529504 -4.36217 -0.000461963)
(-0.0704929 -3.92308 -0.000615077)
(-0.0872338 -3.50215 -0.000761197)
(-0.102994 -3.09914 -0.000898757)
(-0.117608 -2.71392 -0.00102633)
(-0.13093 -2.34639 -0.00114261)
(-0.142831 -1.99652 -0.0012465)
(-0.153208 -1.66427 -0.00133709)
(-0.161982 -1.34961 -0.00141369)
(-0.1691 -1.05252 -0.00147584)
(-0.174535 -0.772944 -0.0015233)
(-0.178279 -0.510855 -0.00155601)
(-0.128588 -44.7702 -0.00112228)
(0.298484 -43.4943 0.00260494)
(-0.313446 -39.3606 -0.0027356)
(0.379548 -46.3473 0.00331153)
(0.259581 -47.0725 0.00226613)
(-0.0869578 -39.6029 -0.000758469)
(-0.121553 -34.5119 -0.00106195)
(0.0640632 -30.4831 0.000556847)
(-0.106198 -25.6186 -0.00092969)
(0.308955 -19.6174 0.00269184)
(0.35102 -15.4459 0.00308168)
(0.269222 -14.8181 0.00235372)
(0.216442 -14.2821 0.00189185)
(0.182213 -13.5487 0.00159101)
(0.158151 -12.6946 0.00138044)
(0.142991 -11.7952 0.00124807)
(0.129006 -10.9256 0.00112602)
(0.115405 -10.1138 0.00100732)
(0.100768 -9.36358 0.000879592)
(0.0851686 -8.66914 0.000743463)
(0.0684535 -8.02247 0.000597595)
(0.050806 -7.41575 0.000443584)
(0.0323754 -6.84252 0.000282737)
(0.0133892 -6.29778 0.000117038)
(-0.00592546 -5.77788 -5.15307e-05)
(-0.0253266 -5.28031 -0.000220858)
(-0.0445757 -4.80333 -0.000388861)
(-0.0634372 -4.34585 -0.000553484)
(-0.0816862 -3.90715 -0.000712765)
(-0.0991093 -3.48679 -0.000864839)
(-0.115508 -3.08452 -0.00100798)
(-0.130703 -2.70016 -0.00114061)
(-0.144534 -2.33361 -0.00126135)
(-0.156865 -1.9848 -0.00136899)
(-0.167585 -1.65366 -0.00146257)
(-0.176609 -1.34015 -0.00154135)
(-0.18388 -1.04421 -0.00160483)
(-0.189362 -0.765783 -0.0016527)
(-0.193039 -0.504826 -0.00168483)
(-0.140649 -44.8674 -0.00122755)
(0.316388 -43.5449 0.00276119)
(-0.321225 -39.3138 -0.00280351)
(0.396084 -46.9466 0.00345594)
(0.132801 -46.76 0.00115954)
(0.0177481 -39.4113 0.000155081)
(-0.159513 -34.5215 -0.0013928)
(-0.068768 -30.4386 -0.000601948)
(-0.295734 -25.7337 -0.00258384)
(0.209045 -20.0398 0.00181876)
(0.346089 -15.4961 0.00303918)
(0.268542 -14.7665 0.00234764)
(0.211545 -14.2509 0.00184945)
(0.175856 -13.5318 0.00153569)
(0.150538 -12.6876 0.00131401)
(0.135329 -11.7916 0.00118119)
(0.121496 -10.9215 0.00106047)
(0.10818 -10.1079 0.000944265)
(0.0936929 -9.35538 0.000817842)
(0.078128 -8.65873 0.000682012)
(0.0612719 -8.01008 0.000534913)
(0.0433316 -7.40169 0.00037835)
(0.0244615 -6.82711 0.000213669)
(0.00491688 -6.28136 4.30969e-05)
(-0.0150504 -5.7608 -0.000131167)
(-0.0351681 -5.26286 -0.000306747)
(-0.055169 -4.7858 -0.000481312)
(-0.0747898 -4.32851 -0.000652562)
(-0.0937804 -3.89022 -0.000818315)
(-0.111906 -3.47049 -0.000976518)
(-0.128949 -3.06901 -0.00112528)
(-0.144716 -2.68559 -0.00126291)
(-0.159035 -2.32008 -0.00138791)
(-0.171763 -1.9724 -0.00149901)
(-0.182781 -1.64246 -0.0015952)
(-0.192001 -1.33016 -0.0016757)
(-0.199361 -1.03546 -0.00173996)
(-0.204822 -0.75826 -0.00178764)
(-0.208361 -0.498516 -0.00181857)
(-0.148722 -44.9638 -0.00129802)
(0.326402 -43.6059 0.00284858)
(-0.315274 -39.2768 -0.00275162)
(0.385217 -47.4266 0.0033612)
(0.0509579 -46.523 0.000445149)
(0.0539038 -39.1917 0.000470777)
(-0.364434 -34.2817 -0.00318049)
(-0.32404 -30.2668 -0.00282946)
(-0.500558 -25.8848 -0.00437189)
(0.101851 -20.5831 0.000882404)
(0.3399 -15.6265 0.00298296)
(0.270022 -14.7154 0.00236063)
(0.208548 -14.2159 0.00182361)
(0.171044 -13.5122 0.00149388)
(0.144197 -12.679 0.00125868)
(0.128639 -11.7873 0.0011228)
(0.114753 -10.917 0.00100162)
(0.101515 -10.1015 0.000886089)
(0.0869825 -9.34667 0.000759271)
(0.071256 -8.6477 0.000622034)
(0.0540703 -7.99695 0.000472061)
(0.0356587 -7.38676 0.000311385)
(0.0161849 -6.81074 0.000141437)
(-0.00406456 -6.26391 -3.52861e-05)
(-0.0248106 -5.74262 -0.000216345)
(-0.0457494 -5.24429 -0.000399092)
(-0.066585 -4.76717 -0.000580941)
(-0.0870263 -4.31008 -0.000759353)
(-0.106799 -3.87226 -0.000931936)
(-0.125648 -3.4532 -0.00109646)
(-0.14334 -3.05258 -0.00125088)
(-0.159667 -2.67017 -0.0013934)
(-0.17445 -2.30579 -0.00152244)
(-0.187536 -1.95933 -0.00163667)
(-0.198804 -1.63066 -0.00173505)
(-0.208163 -1.31967 -0.00181675)
(-0.215547 -1.02628 -0.00188123)
(-0.220917 -0.750398 -0.00192812)
(-0.224248 -0.491949 -0.00195724)
(-0.153366 -45.0584 -0.00133855)
(0.330465 -43.6798 0.00288405)
(-0.306004 -39.2337 -0.00267074)
(0.355814 -47.8122 0.00310468)
(-0.00151456 -46.2945 -1.27802e-05)
(-0.0401599 -38.7555 -0.000349703)
(-0.665366 -33.7877 -0.00580623)
(-0.593837 -30.0843 -0.00518407)
(-0.629757 -26.1545 -0.00550014)
(0.035452 -21.2255 0.000302661)
(0.340924 -15.8295 0.00298715)
(0.275416 -14.6648 0.00240881)
(0.208774 -14.1765 0.00182593)
(0.168748 -13.4897 0.00147405)
(0.139971 -12.6686 0.00122183)
(0.123584 -11.782 0.00107868)
(0.109316 -10.9118 0.000954157)
(0.0958274 -10.0945 0.000836445)
(0.0809603 -9.33727 0.000706712)
(0.0647949 -8.63585 0.000565645)
(0.0470241 -7.98286 0.000410567)
(0.0279063 -7.37076 0.000243729)
(0.00761947 -6.79321 6.66852e-05)
(-0.0135171 -6.24525 -0.000117779)
(-0.0351952 -5.7232 -0.000306973)
(-0.0570796 -5.22449 -0.000497972)
(-0.0788457 -4.74732 -0.000687943)
(-0.100177 -4.29048 -0.00087412)
(-0.120776 -3.85318 -0.00105392)
(-0.140371 -3.43487 -0.00122494)
(-0.158712 -3.0352 -0.00138504)
(-0.175584 -2.65389 -0.00153232)
(-0.190798 -2.29073 -0.00166513)
(-0.2042 -1.94558 -0.00178211)
(-0.215664 -1.61827 -0.0018822)
(-0.2251 -1.30869 -0.00196458)
(-0.232441 -1.0167 -0.00202868)
(-0.237649 -0.742218 -0.00207416)
(-0.240701 -0.485148 -0.00210084)
(-0.156264 -45.1498 -0.00136385)
(0.331487 -43.7615 0.00289297)
(-0.305601 -39.1686 -0.00266727)
(0.323538 -48.124 0.00282308)
(-0.0520345 -45.9536 -0.00045351)
(-0.249716 -38.0299 -0.00217812)
(-0.945693 -33.1745 -0.00825267)
(-0.76757 -30.0196 -0.00670067)
(-0.632069 -26.5756 -0.00552084)
(0.0339578 -21.8998 0.00028947)
(0.356089 -16.0721 0.00311488)
(0.286482 -14.6105 0.00250798)
(0.213224 -14.1319 0.00186524)
(0.169774 -13.4638 0.00148325)
(0.138573 -12.6559 0.00120967)
(0.120733 -11.7754 0.00105381)
(0.105639 -10.9056 0.000922076)
(0.0914644 -10.0866 0.00079837)
(0.0758863 -9.32688 0.000662433)
(0.0589284 -8.62292 0.000514449)
(0.0402552 -7.96758 0.000351497)
(0.0201463 -7.35348 0.000176009)
(-0.00120218 -6.77434 -1.02996e-05)
(-0.0234377 -6.2252 -0.000204355)
(-0.0462229 -5.7024 -0.000403211)
(-0.0691915 -5.20333 -0.000603674)
(-0.0919926 -4.72615 -0.000802679)
(-0.114286 -4.26964 -0.000997254)
(-0.135756 -3.83294 -0.00118465)
(-0.156114 -3.41547 -0.00136235)
(-0.175103 -3.01684 -0.00152809)
(-0.192497 -2.63673 -0.00167993)
(-0.208106 -2.2749 -0.00181619)
(-0.221773 -1.93115 -0.00193549)
(-0.233375 -1.60531 -0.00203678)
(-0.24282 -1.29722 -0.00211925)
(-0.250048 -1.00674 -0.00218236)
(-0.255021 -0.733745 -0.00222579)
(-0.257722 -0.478136 -0.00224941)
(-0.157698 -45.2368 -0.00137637)
(0.330601 -43.8355 0.00288526)
(-0.325519 -39.0733 -0.00284119)
(0.306424 -48.3767 0.00267379)
(-0.121528 -45.4061 -0.00105974)
(-0.494187 -37.0819 -0.0043115)
(-1.11377 -32.6259 -0.00971998)
(-0.795567 -30.1482 -0.00694565)
(-0.517169 -27.1169 -0.00451844)
(0.0868322 -22.5342 0.000750608)
(0.388437 -16.3189 0.00339571)
(0.304445 -14.5446 0.00266872)
(0.222383 -14.0811 0.00194578)
(0.174625 -13.434 0.00152585)
(0.14046 -12.6406 0.0012262)
(0.120479 -11.7671 0.00105161)
(0.104035 -10.8981 0.000908079)
(0.088654 -10.0774 0.000773852)
(0.0719176 -9.31518 0.000627804)
(0.0537519 -8.60857 0.00046928)
(0.0338102 -7.9508 0.000295257)
(0.0123863 -7.33464 0.000108293)
(-0.0103014 -6.75387 -8.97043e-05)
(-0.0338685 -6.20356 -0.000295381)
(-0.0579487 -5.68004 -0.000505541)
(-0.0821476 -5.18066 -0.000716741)
(-0.10609 -4.70355 -0.000925711)
(-0.129417 -4.24745 -0.00112931)
(-0.151797 -3.81146 -0.00132465)
(-0.172932 -3.39495 -0.00150912)
(-0.192556 -2.99747 -0.00168042)
(-0.210443 -2.61868 -0.00183656)
(-0.226402 -2.25829 -0.00197587)
(-0.240277 -1.91606 -0.002097)
(-0.25195 -1.5918 -0.0021989)
(-0.261334 -1.28531 -0.00228084)
(-0.268373 -0.99642 -0.0023423)
(-0.273035 -0.725 -0.00238303)
(-0.27531 -0.470937 -0.00240293)
(-0.156855 -45.3188 -0.00136901)
(0.324366 -43.8756 0.00283086)
(-0.363712 -38.9556 -0.00317458)
(0.323788 -48.5809 0.00282538)
(-0.212706 -44.6319 -0.00185521)
(-0.68551 -36.06 -0.00598138)
(-1.14509 -32.271 -0.00999401)
(-0.700684 -30.4723 -0.00611823)
(-0.334821 -27.7154 -0.00292734)
(0.16747 -23.0833 0.00145423)
(0.436185 -16.5478 0.0038131)
(0.329453 -14.46 0.00289185)
(0.23628 -14.0228 0.00206776)
(0.183452 -13.4 0.00160316)
(0.145801 -12.6223 0.00127288)
(0.122998 -11.7566 0.00107362)
(0.104624 -10.8888 0.000913243)
(0.0874711 -10.0666 0.000763545)
(0.0690805 -9.30177 0.000603058)
(0.0492511 -8.59246 0.000430014)
(0.0276424 -7.93221 0.000241441)
(0.00455578 -7.31396 3.99651e-05)
(-0.0197644 -6.73156 -0.00017228)
(-0.0449043 -6.18012 -0.000391685)
(-0.0704704 -5.65594 -0.000614815)
(-0.0960434 -5.15634 -0.00083801)
(-0.121229 -4.67941 -0.00105783)
(-0.145652 -4.22385 -0.001271)
(-0.168972 -3.78869 -0.00147454)
(-0.190885 -3.37326 -0.00166581)
(-0.211124 -2.97708 -0.00184247)
(-0.229463 -2.59973 -0.00200256)
(-0.245716 -2.2409 -0.00214444)
(-0.259734 -1.90032 -0.00226682)
(-0.271405 -1.57774 -0.00236871)
(-0.280649 -1.27295 -0.00244943)
(-0.28742 -0.985763 -0.00250855)
(-0.291693 -0.716011 -0.00254588)
(-0.293466 -0.463576 -0.0025614)
(-0.146538 -45.395 -0.00127897)
(0.301315 -43.855 0.00262971)
(-0.399231 -38.8603 -0.00348465)
(0.388637 -48.7423 0.00339141)
(-0.311978 -43.6751 -0.00272138)
(-0.780094 -35.1039 -0.00680724)
(-1.07481 -32.146 -0.00938142)
(-0.543191 -30.9451 -0.00474425)
(-0.140197 -28.3147 -0.00122899)
(0.252877 -23.539 0.00220002)
(0.493839 -16.7532 0.00431612)
(0.360307 -14.3525 0.00316646)
(0.254547 -13.9558 0.00222783)
(0.196029 -13.3614 0.00171318)
(0.154456 -12.6005 0.00134849)
(0.128207 -11.7435 0.00111911)
(0.107314 -10.8773 0.000936742)
(0.0878086 -10.0536 0.000766513)
(0.0672474 -9.28624 0.00058708)
(0.0452831 -8.57419 0.000395402)
(0.021598 -7.91143 0.000188707)
(-0.00350388 -7.29111 -3.03592e-05)
(-0.029749 -6.70714 -0.000259407)
(-0.0566975 -6.15465 -0.000494598)
(-0.0839311 -5.62991 -0.000732283)
(-0.11101 -5.13022 -0.000968625)
(-0.137526 -4.65362 -0.00120005)
(-0.163093 -4.19874 -0.00142321)
(-0.187367 -3.76457 -0.00163509)
(-0.210045 -3.35038 -0.00183303)
(-0.230862 -2.95564 -0.00201474)
(-0.249601 -2.57988 -0.00217832)
(-0.266082 -2.22275 -0.0023222)
(-0.280167 -1.88394 -0.00244516)
(-0.291754 -1.56317 -0.00254632)
(-0.300775 -1.26019 -0.00262509)
(-0.307193 -0.974796 -0.00268113)
(-0.310993 -0.706804 -0.00271434)
(-0.312187 -0.45608 -0.00272481)
(-0.122214 -45.4643 -0.00106668)
(0.250656 -43.7591 0.0021876)
(-0.394194 -38.8754 -0.00344076)
(0.504037 -48.8534 0.00439868)
(-0.397358 -42.5998 -0.00346634)
(-0.784805 -34.2876 -0.00684879)
(-0.956666 -32.2172 -0.00835095)
(-0.375718 -31.5094 -0.00328303)
(0.0302575 -28.8873 0.000258481)
(0.331643 -23.9178 0.00288798)
(0.55557 -16.9376 0.00485282)
(0.395093 -14.2223 0.00347553)
(0.276499 -13.8797 0.00241993)
(0.211823 -13.3181 0.00185125)
(0.166007 -12.5751 0.00144939)
(0.135771 -11.7274 0.00118516)
(0.111789 -10.8631 0.000975831)
(0.0893701 -10.0381 0.000780169)
(0.0661293 -9.26813 0.000577347)
(0.0415691 -8.55336 0.000363013)
(0.0154101 -7.88812 0.000134723)
(-0.0120441 -7.26579 -0.000104875)
(-0.0404885 -6.68034 -0.000353118)
(-0.0694605 -6.12692 -0.000605972)
(-0.0985207 -5.60178 -0.000859602)
(-0.127214 -5.10217 -0.00111004)
(-0.155124 -4.62607 -0.00135364)
(-0.181861 -4.17206 -0.001587)
(-0.207083 -3.73906 -0.00180716)
(-0.230492 -3.32629 -0.00201149)
(-0.251835 -2.93315 -0.00219779)
(-0.270904 -2.55914 -0.00236425)
(-0.287533 -2.20386 -0.00250942)
(-0.301598 -1.86695 -0.00263221)
(-0.313011 -1.5481 -0.00273186)
(-0.321717 -1.24705 -0.00280788)
(-0.327692 -0.963549 -0.00286006)
(-0.330934 -0.697408 -0.0028884)
(-0.331466 -0.448475 -0.00289309)
(-0.0794897 -45.5258 -0.000693799)
(0.167271 -43.6022 0.00145988)
(-0.326667 -39.1156 -0.0028515)
(0.65392 -48.8953 0.00570695)
(-0.455965 -41.4514 -0.00397765)
(-0.736504 -33.621 -0.00642761)
(-0.829891 -32.4282 -0.00724492)
(-0.225668 -32.1229 -0.00197382)
(0.169347 -29.4302 0.00147213)
(0.40741 -24.2447 0.00354947)
(0.614911 -17.1038 0.00536882)
(0.431569 -14.0732 0.00379927)
(0.301077 -13.7947 0.00263472)
(0.230009 -13.2702 0.00201013)
(0.179748 -12.5458 0.00156939)
(0.145093 -11.7078 0.00126657)
(0.117508 -10.8458 0.00102577)
(0.0916629 -10.0194 0.000800214)
(0.0652706 -9.247 0.000569883)
(0.0376917 -8.52955 0.0003292)
(0.00869744 -7.86191 7.61634e-05)
(-0.0214091 -7.23768 -0.000186585)
(-0.0522896 -6.65091 -0.000456094)
(-0.0834631 -6.09674 -0.000728166)
(-0.114473 -5.5714 -0.000998814)
(-0.144855 -5.07207 -0.00126399)
(-0.17419 -4.59669 -0.00152003)
(-0.202093 -4.14375 -0.00176358)
(-0.228229 -3.71212 -0.00199171)
(-0.252313 -3.30096 -0.00220193)
(-0.274107 -2.90961 -0.00239217)
(-0.293419 -2.53752 -0.00256076)
(-0.310102 -2.18424 -0.0027064)
(-0.324048 -1.84937 -0.00282816)
(-0.335187 -1.53258 -0.00292541)
(-0.343479 -1.23356 -0.00299783)
(-0.348915 -0.952054 -0.00304531)
(-0.351509 -0.687853 -0.00306799)
(-0.351295 -0.44079 -0.00306617)
(-0.0212297 -45.5788 -0.000185323)
(0.0559043 -43.4138 0.00048792)
(-0.195194 -39.6623 -0.00170418)
(0.810244 -48.853 0.0070715)
(-0.490286 -40.249 -0.00427705)
(-0.671548 -33.0867 -0.00586101)
(-0.707079 -32.7379 -0.00617339)
(-0.0919334 -32.7636 -0.000807024)
(0.287219 -29.9498 0.00250046)
(0.485931 -24.5406 0.00423478)
(0.670123 -17.2497 0.00584985)
(0.467483 -13.9103 0.00411772)
(0.326927 -13.7019 0.00286043)
(0.249536 -13.2177 0.00218065)
(0.194722 -12.5125 0.00170016)
(0.155351 -11.6845 0.00135614)
(0.123719 -10.8248 0.00108002)
(0.0940135 -9.99728 0.000820767)
(0.0640609 -9.22243 0.000559361)
(0.0331037 -8.50237 0.000289189)
(0.00097223 -7.83246 8.76889e-06)
(-0.0320286 -7.2065 -0.000279244)
(-0.0655272 -6.6186 -0.000571605)
(-0.0990276 -6.06391 -0.000863989)
(-0.132061 -5.53861 -0.0011523)
(-0.164161 -5.03982 -0.00143247)
(-0.194911 -4.5654 -0.00170087)
(-0.223938 -4.11378 -0.00195423)
(-0.250922 -3.68375 -0.00218977)
(-0.275597 -3.27441 -0.00240515)
(-0.297743 -2.88504 -0.00259847)
(-0.317193 -2.51504 -0.00276826)
(-0.333819 -2.16392 -0.0029134)
(-0.347534 -1.83123 -0.00303315)
(-0.358288 -1.51662 -0.00312705)
(-0.36606 -1.21975 -0.00319492)
(-0.370858 -0.940346 -0.00323683)
(-0.372709 -0.678172 -0.00325303)
(-0.371662 -0.433055 -0.00324395)
(0.0491833 -45.6227 0.000429218)
(-0.0756866 -43.2239 -0.000660535)
(-0.0129592 -40.5538 -0.000113863)
(0.935756 -48.696 0.00816718)
(-0.511701 -39.0005 -0.00446386)
(-0.613088 -32.6714 -0.00535108)
(-0.58262 -33.1336 -0.00508751)
(0.038277 -33.4228 0.000328977)
(0.399487 -30.4563 0.00347979)
(0.57059 -24.8141 0.00497353)
(0.720064 -17.3676 0.00628531)
(0.500329 -13.7377 0.00440841)
(0.352383 -13.6024 0.00308252)
(0.269113 -13.1608 0.0023515)
(0.209734 -12.4752 0.00183125)
(0.1655 -11.657 0.00144478)
(0.12948 -10.7998 0.00113035)
(0.0955821 -9.97119 0.000834498)
(0.0617496 -9.19399 0.000539225)
(0.027142 -8.47146 0.000237192)
(-0.00834716 -7.79946 -7.25377e-05)
(-0.0444068 -7.17198 -0.00038725)
(-0.0806328 -6.58322 -0.00070342)
(-0.116519 -6.02829 -0.00101663)
(-0.151588 -5.50331 -0.00132271)
(-0.185379 -5.00534 -0.00161765)
(-0.217486 -4.53216 -0.00189789)
(-0.247553 -4.08212 -0.00216034)
(-0.275283 -3.65394 -0.00240239)
(-0.300432 -3.24665 -0.0026219)
(-0.322807 -2.85947 -0.00281723)
(-0.342266 -2.49174 -0.00298711)
(-0.358707 -2.14294 -0.00313064)
(-0.372067 -1.81259 -0.00324728)
(-0.382317 -1.50028 -0.00333678)
(-0.389456 -1.20567 -0.00339913)
(-0.393508 -0.928461 -0.00343454)
(-0.394519 -0.6684 -0.0034434)
(-0.392552 -0.425302 -0.00342629)
(0.124053 -45.6572 0.00108266)
(-0.214305 -43.0618 -0.00187033)
(0.199395 -41.7704 0.00173932)
(0.991611 -48.3891 0.00865494)
(-0.528149 -37.7269 -0.00460743)
(-0.566498 -32.3807 -0.00494475)
(-0.442469 -33.6243 -0.00386475)
(0.173766 -34.098 0.001511)
(0.51304 -30.9519 0.0044703)
(0.658209 -25.0634 0.00573805)
(0.76027 -17.4472 0.00663613)
(0.52705 -13.5596 0.00464377)
(0.375556 -13.498 0.00328454)
(0.287258 -13.0999 0.00250978)
(0.223413 -12.4339 0.00195069)
(0.174333 -11.6252 0.00152191)
(0.133696 -10.7704 0.00116719)
(0.0953988 -9.94075 0.00083294)
(0.0574761 -9.16133 0.000501965)
(0.0190533 -8.43651 0.000166631)
(-0.0199146 -7.76264 -0.000173464)
(-0.0591035 -7.13393 -0.000515493)
(-0.0980797 -6.5446 -0.00085567)
(-0.13633 -5.98975 -0.00118951)
(-0.173376 -5.46542 -0.00151286)
(-0.208769 -4.9686 -0.00182178)
(-0.242119 -4.49697 -0.00211288)
(-0.273095 -4.04879 -0.00238326)
(-0.301427 -3.62272 -0.00263057)
(-0.326902 -3.21771 -0.00285293)
(-0.349356 -2.83293 -0.00304894)
(-0.368675 -2.46767 -0.00321761)
(-0.384787 -2.12135 -0.00335827)
(-0.397653 -1.79348 -0.00347061)
(-0.407269 -1.48361 -0.00355457)
(-0.413653 -1.19137 -0.00361034)
(-0.41685 -0.916441 -0.00363828)
(-0.416921 -0.658572 -0.00363895)
(-0.413944 -0.417563 -0.00361302)
(0.196018 -45.6821 0.00171074)
(-0.345498 -42.9486 -0.00301533)
(0.413071 -43.2263 0.00360409)
(0.948332 -47.8978 0.00827749)
(-0.545577 -36.4747 -0.00475975)
(-0.524411 -32.2377 -0.00457778)
(-0.280144 -34.2224 -0.00244849)
(0.313674 -34.7821 0.0027316)
(0.623919 -31.4272 0.00543749)
(0.734236 -25.2785 0.00640137)
(0.781927 -17.4805 0.00682521)
(0.544087 -13.383 0.00479109)
(0.394463 -13.3913 0.00344915)
(0.302321 -13.0355 0.00264113)
(0.234264 -12.3885 0.00204545)
(0.180497 -11.5887 0.00157577)
(0.135165 -10.7363 0.00118005)
(0.0924 -9.90563 0.000806809)
(0.0503036 -9.12415 0.000439403)
(0.00802312 -8.39724 7.03959e-05)
(-0.0344304 -7.7218 -0.000300125)
(-0.0767121 -7.09218 -0.000669151)
(-0.118363 -6.50265 -0.00103268)
(-0.158868 -5.94824 -0.0013862)
(-0.197754 -5.42493 -0.00172561)
(-0.234589 -4.9296 -0.00204712)
(-0.269009 -4.45984 -0.00234757)
(-0.300713 -4.01383 -0.0026243)
(-0.329464 -3.59014 -0.00287527)
(-0.35508 -3.18766 -0.00309888)
(-0.377434 -2.80549 -0.00329402)
(-0.396444 -2.44288 -0.00345998)
(-0.412065 -2.09922 -0.00359636)
(-0.424288 -1.77396 -0.00370309)
(-0.433131 -1.46664 -0.00378031)
(-0.438635 -1.17687 -0.00382839)
(-0.440863 -0.904327 -0.00384788)
(-0.439891 -0.648727 -0.00383945)
(-0.435813 -0.409871 -0.00380391)
(0.255897 -45.6979 0.00223336)
(-0.452547 -42.8972 -0.0039496)
(0.599129 -44.7853 0.00522792)
(0.8043 -47.2039 0.00702065)
(-0.563284 -35.3173 -0.00491469)
(-0.470778 -32.2715 -0.00411012)
(-0.103428 -34.9267 -0.000906579)
(0.442806 -35.4548 0.00385822)
(0.718659 -31.864 0.00626387)
(0.779548 -25.4461 0.00679662)
(0.77666 -17.4683 0.00677926)
(0.549322 -13.2201 0.00483112)
(0.407303 -13.2857 0.00356061)
(0.312646 -12.9683 0.00273111)
(0.240774 -12.3389 0.00210232)
(0.182607 -11.5473 0.00159422)
(0.132652 -10.6971 0.00115817)
(0.0854869 -9.86554 0.000746512)
(0.0392666 -9.08219 0.000343111)
(-0.00678512 -8.35348 -5.88149e-05)
(-0.0526088 -7.67679 -0.000458754)
(-0.0978322 -7.04664 -0.000853459)
(-0.141978 -6.4573 -0.00123876)
(-0.184532 -5.90374 -0.00161019)
(-0.225037 -5.38184 -0.00196373)
(-0.263084 -4.88837 -0.00229582)
(-0.298341 -4.42082 -0.00260357)
(-0.33054 -3.97729 -0.00288463)
(-0.359482 -3.55626 -0.00313727)
(-0.385025 -3.15655 -0.00336024)
(-0.407075 -2.77722 -0.00355273)
(-0.425584 -2.41745 -0.00371432)
(-0.440539 -2.0766 -0.00384489)
(-0.451957 -1.75409 -0.0039446)
(-0.459882 -1.44944 -0.0040138)
(-0.464375 -1.16225 -0.00405307)
(-0.465516 -0.892163 -0.00406307)
(-0.463399 -0.638904 -0.00404464)
(-0.458129 -0.40226 -0.00399871)
(0.296442 -45.7067 0.00258722)
(-0.521236 -42.9121 -0.0045491)
(0.735838 -46.2987 0.00642113)
(0.591885 -46.3183 0.00516695)
(-0.577658 -34.3327 -0.00504065)
(-0.396666 -32.4988 -0.00346371)
(0.0687132 -35.7045 0.000595585)
(0.542007 -36.0909 0.00472376)
(0.776813 -32.2399 0.00677101)
(0.778075 -25.5568 0.00678351)
(0.741595 -17.4252 0.0064729)
(0.542831 -13.0837 0.00476731)
(0.412503 -13.1843 0.0036052)
(0.31677 -12.8987 0.00276688)
(0.241542 -12.2853 0.00210904)
(0.179365 -11.5009 0.00156597)
(0.124963 -10.6526 0.0010911)
(0.0735846 -9.82027 0.000642667)
(0.0234179 -9.03527 0.00020482)
(-0.0261905 -8.30508 -0.000228152)
(-0.0751441 -7.62754 -0.000655413)
(-0.12304 -6.99728 -0.00107345)
(-0.169392 -6.40858 -0.00147802)
(-0.213697 -5.8563 -0.00186472)
(-0.255516 -5.33622 -0.00222973)
(-0.294472 -4.845 -0.00256977)
(-0.330271 -4.38002 -0.00288225)
(-0.362683 -3.93928 -0.00316518)
(-0.391552 -3.52119 -0.00341718)
(-0.416773 -3.1245 -0.00363734)
(-0.43829 -2.7482 -0.00382519)
(-0.45609 -2.39145 -0.0039806)
(-0.47019 -2.05356 -0.0041037)
(-0.480634 -1.73394 -0.00419491)
(-0.487489 -1.43207 -0.00425478)
(-0.490837 -1.14754 -0.00428405)
(-0.490775 -0.879997 -0.00428355)
(-0.487409 -0.629142 -0.00425422)
(-0.480859 -0.394763 -0.00419711)
(0.312406 -45.7126 0.00272656)
(-0.542252 -42.9955 -0.00473255)
(0.812041 -47.6519 0.00708632)
(0.371476 -45.2804 0.00324339)
(-0.585105 -33.5716 -0.00510618)
(-0.308742 -32.9107 -0.00269666)
(0.207364 -36.4984 0.00180568)
(0.591605 -36.6632 0.00515663)
(0.779892 -32.5363 0.00679758)
(0.724757 -25.6134 0.00631786)
(0.681437 -17.3772 0.0059471)
(0.524942 -12.9828 0.00460501)
(0.408806 -13.0895 0.00357204)
(0.313475 -12.8273 0.00273783)
(0.235382 -12.2275 0.0020553)
(0.169608 -11.4492 0.00148084)
(0.110994 -10.6027 0.000969217)
(0.0556921 -9.76961 0.000486536)
(0.00187284 -8.98327 1.68066e-05)
(-0.0509538 -8.25199 -0.000444258)
(-0.102675 -7.57404 -0.000895676)
(-0.152859 -6.94416 -0.00133369)
(-0.201024 -6.35657 -0.00175408)
(-0.246684 -5.80603 -0.00215262)
(-0.289432 -5.2882 -0.00252574)
(-0.328927 -4.79962 -0.00287049)
(-0.364917 -4.33756 -0.00318464)
(-0.397217 -3.89993 -0.00346659)
(-0.42571 -3.48505 -0.00371532)
(-0.450335 -3.0916 -0.00393028)
(-0.471071 -2.71854 -0.00411131)
(-0.487939 -2.36498 -0.00425859)
(-0.500985 -2.0302 -0.0043725)
(-0.510279 -1.71357 -0.00445367)
(-0.51591 -1.41459 -0.00450285)
(-0.517977 -1.13281 -0.00452095)
(-0.516593 -0.867873 -0.00450892)
(-0.511879 -0.619481 -0.00446781)
(-0.503961 -0.387416 -0.00439877)
(0.304265 -45.7218 0.00265552)
(-0.51687 -43.1479 -0.00451105)
(0.832536 -48.7924 0.00726533)
(0.189557 -44.1591 0.00165571)
(-0.597625 -33.0143 -0.00521591)
(-0.225429 -33.4698 -0.00196972)
(0.279246 -37.2451 0.00243324)
(0.577268 -37.1481 0.00503177)
(0.719673 -32.7483 0.00627189)
(0.62834 -25.6345 0.00547594)
(0.607701 -17.3512 0.00530233)
(0.496333 -12.9199 0.0043485)
(0.395668 -13.0031 0.00345644)
(0.30183 -12.7544 0.00263596)
(0.221295 -12.1653 0.00193238)
(0.152272 -11.392 0.00132956)
(0.0897604 -10.547 0.000783918)
(0.0309098 -9.71342 0.000270265)
(-0.0261542 -8.92611 -0.000227786)
(-0.0817424 -8.19423 -0.000712958)
(-0.13575 -7.51639 -0.00118434)
(-0.187727 -6.88739 -0.001638)
(-0.237211 -6.30141 -0.00206992)
(-0.283747 -5.75309 -0.0024761)
(-0.326963 -5.23795 -0.00285332)
(-0.366566 -4.7524 -0.00319901)
(-0.402348 -4.29361 -0.00351135)
(-0.43417 -3.85938 -0.00378913)
(-0.461958 -3.44796 -0.0040317)
(-0.485689 -3.05799 -0.00423887)
(-0.505381 -2.68836 -0.00441078)
(-0.521083 -2.33814 -0.00454789)
(-0.532871 -2.00659 -0.00465082)
(-0.540836 -1.69308 -0.00472039)
(-0.545087 -1.39707 -0.00475754)
(-0.54574 -1.11811 -0.00476328)
(-0.54292 -0.855841 -0.00473872)
(-0.536757 -0.609961 -0.00468498)
(-0.527389 -0.380252 -0.00460327)
(0.277366 -45.7412 0.00242075)
(-0.455858 -43.3707 -0.00397859)
(0.818147 -49.7175 0.00713989)
(0.0519653 -42.9953 0.000454915)
(-0.629807 -32.6063 -0.00549709)
(-0.175873 -34.1101 -0.00153723)
(0.257672 -37.8907 0.00224536)
(0.492478 -37.5391 0.00429223)
(0.602116 -32.8912 0.00524594)
(0.507378 -25.6525 0.00441966)
(0.535147 -17.3645 0.00466764)
(0.460184 -12.8906 0.00402286)
(0.373104 -12.9253 0.00325887)
(0.28117 -12.6796 0.00245551)
(0.198449 -12.0982 0.00173301)
(0.12645 -11.3289 0.00110421)
(0.0604208 -10.4853 0.000527869)
(-0.00152362 -9.65158 -1.27903e-05)
(-0.0613127 -8.8638 -0.000534629)
(-0.119094 -8.13187 -0.00103894)
(-0.174796 -7.45471 -0.00152512)
(-0.22797 -6.82717 -0.00198923)
(-0.278191 -6.24333 -0.00242759)
(-0.325044 -5.6977 -0.00283654)
(-0.368208 -5.18568 -0.00321331)
(-0.407437 -4.70355 -0.00355574)
(-0.442573 -4.24835 -0.00386244)
(-0.473521 -3.81781 -0.0041326)
(-0.500253 -3.4101 -0.00436596)
(-0.52278 -3.0238 -0.00456261)
(-0.541154 -2.65776 -0.00472303)
(-0.555453 -2.31103 -0.00484788)
(-0.565775 -1.98283 -0.00493803)
(-0.572234 -1.67253 -0.00499445)
(-0.574952 -1.37956 -0.00501822)
(-0.574061 -1.1035 -0.00501049)
(-0.569694 -0.843946 -0.00497242)
(-0.56199 -0.600621 -0.00490523)
(-0.551092 -0.373301 -0.00481018)
(0.240657 -45.7779 0.00210038)
(-0.375899 -43.6685 -0.00328077)
(0.794122 -50.4435 0.00693036)
(-0.0645043 -41.778 -0.000561515)
(-0.686464 -32.2853 -0.00599172)
(-0.19895 -34.7383 -0.00173849)
(0.131896 -38.4062 0.00114809)
(0.337396 -37.8524 0.0029393)
(0.443177 -32.9999 0.00385895)
(0.380498 -25.7055 0.00331163)
(0.475093 -17.424 0.00414221)
(0.418671 -12.8816 0.00365463)
(0.341228 -12.8533 0.00298053)
(0.25096 -12.602 0.00219184)
(0.166162 -12.0255 0.00145125)
(0.0914145 -11.2594 0.00079844)
(0.0223102 -10.4173 0.000195261)
(-0.0421906 -9.58401 -0.000367715)
(-0.104077 -8.79641 -0.000907867)
(-0.163378 -8.06508 -0.00142545)
(-0.220084 -7.38924 -0.00192039)
(-0.273771 -6.76374 -0.00238899)
(-0.324073 -6.18258 -0.00282805)
(-0.370627 -5.64014 -0.0032344)
(-0.413168 -5.13166 -0.00360573)
(-0.451506 -4.6533 -0.00394038)
(-0.48553 -4.202 -0.00423739)
(-0.515194 -3.77541 -0.00449634)
(-0.540505 -3.37163 -0.0047173)
(-0.561511 -2.98918 -0.00490068)
(-0.578292 -2.62688 -0.00504719)
(-0.590951 -2.28375 -0.00515774)
(-0.599605 -1.95901 -0.00523332)
(-0.604384 -1.65199 -0.00527508)
(-0.605423 -1.36215 -0.0052842)
(-0.602863 -1.08902 -0.0052619)
(-0.596845 -0.832233 -0.00520942)
(-0.587513 -0.591499 -0.00512802)
(-0.575014 -0.366596 -0.00501899)
(0.202799 -45.838 0.00176998)
(-0.291977 -44.049 -0.00254836)
(0.777243 -50.9821 0.00678322)
(-0.193414 -40.4719 -0.00168648)
(-0.770149 -31.9741 -0.00672209)
(-0.330103 -35.2511 -0.0028828)
(-0.0936009 -38.7922 -0.00081953)
(0.116614 -38.1226 0.00101282)
(0.259975 -33.1205 0.00226013)
(0.258565 -25.8261 0.00224677)
(0.428988 -17.5283 0.00373922)
(0.371723 -12.8754 0.00324507)
(0.300184 -12.7831 0.00262269)
(0.210833 -12.5203 0.00184177)
(0.123931 -11.9463 0.00108271)
(0.0466405 -11.183 0.000407669)
(-0.025025 -10.3429 -0.000217866)
(-0.0914554 -9.51072 -0.000797689)
(-0.15471 -8.72406 -0.00134978)
(-0.214762 -7.9941 -0.00187393)
(-0.271699 -7.32027 -0.00237089)
(-0.325148 -6.69744 -0.00283741)
(-0.374819 -6.1195 -0.00327097)
(-0.420416 -5.5807 -0.00366897)
(-0.461737 -5.07616 -0.00402966)
(-0.498647 -4.60191 -0.00435185)
(-0.531086 -4.1548 -0.00463502)
(-0.559047 -3.73238 -0.00487911)
(-0.582575 -3.33272 -0.00508451)
(-0.601747 -2.95428 -0.00525188)
(-0.616666 -2.59585 -0.00538215)
(-0.627456 -2.25643 -0.00547638)
(-0.634247 -1.93522 -0.0055357)
(-0.637182 -1.63156 -0.00556137)
(-0.636405 -1.34488 -0.00555463)
(-0.63206 -1.07473 -0.00551676)
(-0.624296 -0.820746 -0.00544904)
(-0.613258 -0.582628 -0.00535274)
(-0.599093 -0.360164 -0.00522919)
(0.169951 -45.9264 0.00148329)
(-0.215004 -44.516 -0.00187657)
(0.770151 -51.3191 0.00672153)
(-0.375157 -39.0184 -0.00327253)
(-0.892752 -31.5908 -0.00779203)
(-0.591876 -35.5586 -0.00516703)
(-0.409444 -39.0721 -0.00357578)
(-0.165742 -38.3928 -0.00145106)
(0.0624748 -33.2999 0.000536274)
(0.140992 -26.0355 0.00122011)
(0.389661 -17.6668 0.00339619)
(0.319402 -12.8606 0.00279107)
(0.250244 -12.7102 0.00218761)
(0.160648 -12.4325 0.00140405)
(0.0715087 -11.8596 0.000625238)
(-0.00812237 -11.0992 -7.02896e-05)
(-0.0817583 -10.2619 -0.000713028)
(-0.149407 -9.43178 -0.00130349)
(-0.213211 -8.64699 -0.00186038)
(-0.273175 -7.91924 -0.00238377)
(-0.329509 -7.24815 -0.00287547)
(-0.381926 -6.62862 -0.00333299)
(-0.430229 -6.05443 -0.00375461)
(-0.474196 -5.51973 -0.00413839)
(-0.513693 -5.01949 -0.00448316)
(-0.54864 -4.54965 -0.00478822)
(-0.579024 -4.10698 -0.00505345)
(-0.604876 -3.68894 -0.00527914)
(-0.626271 -3.29355 -0.00546592)
(-0.643309 -2.91924 -0.00561466)
(-0.656113 -2.56479 -0.00572647)
(-0.664818 -2.22916 -0.0058025)
(-0.669567 -1.91155 -0.005844)
(-0.670507 -1.61129 -0.00585226)
(-0.667788 -1.32782 -0.00582857)
(-0.661557 -1.06069 -0.00577424)
(-0.651962 -0.809524 -0.00569054)
(-0.639148 -0.574042 -0.00557875)
(-0.623264 -0.354032 -0.00544017)
(0.143704 -46.0451 0.00125423)
(-0.147137 -45.0627 -0.00128424)
(0.754558 -51.392 0.00658569)
(-0.646835 -37.3445 -0.00564353)
(-1.07376 -31.0544 -0.00937169)
(-0.994039 -35.5986 -0.00867653)
(-0.812821 -39.2761 -0.00709651)
(-0.509042 -38.7079 -0.00444711)
(-0.151056 -33.5773 -0.00132781)
(0.0178887 -26.3449 0.000145351)
(0.347578 -17.8333 0.00302974)
(0.261851 -12.831 0.00229336)
(0.191877 -12.6303 0.00167925)
(0.100606 -12.3368 0.000880432)
(0.00901147 -11.7645 7.98331e-05)
(-0.0727484 -11.0077 -0.000634337)
(-0.147706 -10.1742 -0.00128862)
(-0.215797 -9.34736 -0.00188295)
(-0.279274 -8.56551 -0.00243699)
(-0.338269 -7.84088 -0.00295192)
(-0.393143 -7.17329 -0.00343089)
(-0.443727 -6.55768 -0.00387241)
(-0.489927 -5.98777 -0.00427568)
(-0.531605 -5.45757 -0.00463949)
(-0.568694 -4.96197 -0.00496323)
(-0.601167 -4.49681 -0.0052467)
(-0.629052 -4.05877 -0.00549013)
(-0.652414 -3.64528 -0.00569408)
(-0.67135 -3.2543 -0.0058594)
(-0.68598 -2.88423 -0.00598713)
(-0.696437 -2.53382 -0.00607844)
(-0.702864 -2.20204 -0.0061346)
(-0.70541 -1.88808 -0.00615687)
(-0.704223 -1.59126 -0.00614656)
(-0.699454 -1.31102 -0.00610498)
(-0.691247 -1.04693 -0.0060334)
(-0.67975 -0.798602 -0.0059331)
(-0.665105 -0.565769 -0.00580532)
(-0.647455 -0.348221 -0.00565134)
(0.119415 -46.1932 0.00104224)
(-0.0800198 -45.6634 -0.000698446)
(0.692869 -51.0752 0.00604757)
(-1.01952 -35.3864 -0.00889608)
(-1.33732 -30.2817 -0.0116718)
(-1.52805 -35.3344 -0.0133369)
(-1.30829 -39.428 -0.0114215)
(-0.915774 -39.1125 -0.00799684)
(-0.391363 -33.9808 -0.00342585)
(-0.120996 -26.7616 -0.00106718)
(0.29532 -18.0312 0.00257493)
(0.199984 -12.7853 0.00175861)
(0.125949 -12.5396 0.00110504)
(0.0314437 -12.2309 0.000277313)
(-0.062934 -11.6598 -0.000548024)
(-0.146611 -10.908 -0.001279)
(-0.222237 -10.08 -0.00193913)
(-0.289975 -9.25771 -0.00253039)
(-0.352243 -8.47998 -0.00307389)
(-0.409395 -7.75943 -0.00357274)
(-0.461976 -7.09613 -0.0040317)
(-0.509959 -6.48505 -0.00445052)
(-0.553363 -5.91989 -0.00482939)
(-0.592137 -5.39457 -0.00516784)
(-0.626279 -4.9039 -0.00546587)
(-0.655812 -4.44364 -0.00572368)
(-0.680799 -4.01042 -0.00594182)
(-0.701331 -3.6016 -0.00612107)
(-0.717523 -3.21512 -0.00626244)
(-0.729503 -2.84936 -0.00636704)
(-0.737413 -2.50306 -0.00643612)
(-0.741398 -2.17517 -0.00647096)
(-0.741605 -1.86488 -0.00647281)
(-0.738181 -1.57152 -0.00644298)
(-0.731271 -1.29454 -0.00638272)
(-0.721019 -1.03349 -0.00629328)
(-0.707563 -0.788011 -0.00617588)
(-0.691042 -0.557832 -0.00603173)
(-0.671594 -0.34275 -0.00586205)
(0.0900102 -46.3674 0.000785613)
(-0.00496606 -46.2663 -4.33885e-05)
(0.557962 -50.206 0.00487042)
(-1.45265 -33.1092 -0.0126762)
(-1.70387 -29.184 -0.0148708)
(-2.15966 -34.752 -0.0188491)
(-1.89107 -39.5339 -0.0165089)
(-1.38184 -39.6427 -0.0120641)
(-0.66701 -34.5353 -0.00583259)
(-0.277148 -27.2934 -0.00243077)
(0.230266 -18.2727 0.0020089)
(0.135244 -12.7245 0.00119881)
(0.0537896 -12.4345 0.000476524)
(-0.0454727 -12.1128 -0.000393416)
(-0.143075 -11.5445 -0.0012474)
(-0.228487 -10.7998 -0.00199361)
(-0.3042 -9.9791 -0.00265453)
(-0.370844 -9.16311 -0.00323624)
(-0.431091 -8.39081 -0.0037621)
(-0.485598 -7.67535 -0.00423787)
(-0.535128 -7.0171 -0.0046702)
(-0.57982 -6.41114 -0.00506031)
(-0.619816 -5.85116 -0.00540943)
(-0.655149 -5.33106 -0.00571785)
(-0.68588 -4.84557 -0.00598611)
(-0.712075 -4.39039 -0.00621479)
(-0.733828 -3.96211 -0.00640469)
(-0.751246 -3.55806 -0.00655677)
(-0.764456 -3.17616 -0.00667211)
(-0.773592 -2.81476 -0.00675187)
(-0.778793 -2.47259 -0.00679732)
(-0.780203 -2.14862 -0.00680969)
(-0.777965 -1.84202 -0.0067902)
(-0.772218 -1.55213 -0.00674009)
(-0.763102 -1.27841 -0.00666057)
(-0.750751 -1.02041 -0.00655281)
(-0.735297 -0.777777 -0.00641797)
(-0.71687 -0.550251 -0.00625719)
(-0.695603 -0.337635 -0.00607163)
(0.0532552 -46.5613 0.00046483)
(0.0761845 -46.8055 0.000664885)
(0.354575 -48.7131 0.00309559)
(-1.87572 -30.4636 -0.0163685)
(-2.14648 -27.6829 -0.0187335)
(-2.82098 -33.8529 -0.0246207)
(-2.5197 -39.5878 -0.0219967)
(-1.87468 -40.3195 -0.0163653)
(-0.970459 -35.2615 -0.00848224)
(-0.435639 -27.951 -0.00381541)
(0.153007 -18.5702 0.00133718)
(0.0687023 -12.6501 0.000624282)
(-0.0228912 -12.312 -0.000191346)
(-0.128192 -11.9803 -0.00111477)
(-0.22952 -11.4177 -0.00200179)
(-0.316552 -10.6828 -0.00276224)
(-0.391928 -9.87178 -0.00342023)
(-0.456871 -9.06387 -0.00398711)
(-0.514425 -8.29838 -0.00448948)
(-0.565623 -7.58904 -0.00493637)
(-0.611481 -6.93659 -0.00533665)
(-0.652322 -6.3363 -0.00569315)
(-0.688415 -5.78191 -0.00600821)
(-0.719879 -5.26732 -0.00628286)
(-0.746833 -4.78721 -0.00651816)
(-0.769382 -4.33726 -0.00671501)
(-0.787641 -3.91402 -0.00687442)
(-0.801731 -3.51481 -0.00699744)
(-0.811782 -3.13753 -0.00708521)
(-0.817929 -2.78052 -0.00713889)
(-0.820305 -2.4425 -0.00715968)
(-0.819048 -2.12246 -0.00714877)
(-0.814292 -1.81955 -0.00710729)
(-0.806166 -1.53313 -0.00703642)
(-0.7948 -1.26266 -0.00693726)
(-0.780319 -1.0077 -0.00681091)
(-0.762845 -0.767917 -0.00665844)
(-0.742499 -0.54304 -0.0064809)
(-0.719403 -0.332884 -0.00627939)
(0.0118362 -46.7651 0.000103343)
(0.153837 -47.2157 0.00134263)
(0.109235 -46.6181 0.000954593)
(-2.20804 -27.4691 -0.0192687)
(-2.56375 -25.7515 -0.0223749)
(-3.39656 -32.653 -0.0296443)
(-3.08887 -39.5802 -0.0269641)
(-2.31434 -41.139 -0.0202035)
(-1.26495 -36.1652 -0.0110538)
(-0.562944 -28.7401 -0.00492831)
(0.0689447 -18.9169 0.000606855)
(0.000751443 -12.5633 3.96016e-05)
(-0.101938 -12.1701 -0.000879767)
(-0.214202 -11.8319 -0.00186483)
(-0.319718 -11.2786 -0.00278892)
(-0.408418 -10.5567 -0.00356406)
(-0.483251 -9.75803 -0.00421733)
(-0.546118 -8.96022 -0.00476609)
(-0.600536 -8.20302 -0.0052411)
(-0.647967 -7.50084 -0.00565512)
(-0.689719 -6.85493 -0.00601957)
(-0.726318 -6.26084 -0.00633904)
(-0.758167 -5.71241 -0.00661705)
(-0.78547 -5.20356 -0.00685539)
(-0.808403 -4.72901 -0.00705559)
(-0.827101 -4.28441 -0.00721883)
(-0.841699 -3.86629 -0.00734628)
(-0.852325 -3.47196 -0.00743906)
(-0.859109 -3.09932 -0.00749832)
(-0.862179 -2.74671 -0.00752515)
(-0.861665 -2.41285 -0.0075207)
(-0.85769 -2.09672 -0.00748607)
(-0.850378 -1.7975 -0.00742229)
(-0.839847 -1.51454 -0.00733042)
(-0.826215 -1.24732 -0.00721148)
(-0.809594 -0.995396 -0.00706646)
(-0.790097 -0.758444 -0.00689632)
(-0.767833 -0.536207 -0.00670205)
(-0.742916 -0.328505 -0.00648464)
(-0.0265066 -46.9677 -0.000231301)
(0.214371 -47.4515 0.00187098)
(-0.130483 -44.0655 -0.00113741)
(-2.35132 -24.259 -0.020519)
(-2.797 -23.4722 -0.0244104)
(-3.71603 -31.2099 -0.0324326)
(-3.42307 -39.5162 -0.0298808)
(-2.55955 -42.0564 -0.0223467)
(-1.47463 -37.2194 -0.0128848)
(-0.608067 -29.6325 -0.00532404)
(-0.0118419 -19.2848 -9.55545e-05)
(-0.0664584 -12.4638 -0.000536172)
(-0.180461 -12.0081 -0.00156349)
(-0.300318 -11.6668 -0.0026158)
(-0.410581 -11.1266 -0.00358185)
(-0.501243 -10.4214 -0.00437423)
(-0.575632 -9.63784 -0.00502364)
(-0.636353 -8.85227 -0.00555369)
(-0.687479 -8.10491 -0.00599998)
(-0.730946 -7.41097 -0.00637941)
(-0.768391 -6.77235 -0.00670627)
(-0.800561 -6.18495 -0.00698709)
(-0.828002 -5.64281 -0.00722663)
(-0.851008 -5.13995 -0.00742746)
(-0.869807 -4.67111 -0.00759158)
(-0.884566 -4.23194 -0.00772044)
(-0.895435 -3.819 -0.00781534)
(-0.902546 -3.42958 -0.00787744)
(-0.906026 -3.06159 -0.00790786)
(-0.905998 -2.71337 -0.00790763)
(-0.902578 -2.38366 -0.00787783)
(-0.895879 -2.07144 -0.00781942)
(-0.886012 -1.7759 -0.00773334)
(-0.873083 -1.49639 -0.00762053)
(-0.857194 -1.23239 -0.0074819)
(-0.838448 -0.983491 -0.00731832)
(-0.816944 -0.749362 -0.00713067)
(-0.79278 -0.529756 -0.00691982)
(-0.766062 -0.324497 -0.00668668)
(-0.0542495 -47.1596 -0.000473431)
(0.244596 -47.5059 0.00213479)
(-0.297582 -41.3599 -0.00259584)
(-2.19615 -21.1204 -0.0191649)
(-2.65031 -21.0751 -0.0231301)
(-3.5767 -29.6508 -0.0312166)
(-3.30432 -39.4372 -0.0288445)
(-2.43237 -42.9804 -0.0212412)
(-1.48522 -38.3391 -0.0129772)
(-0.514324 -30.5537 -0.00450735)
(-0.0678775 -19.6083 -0.000584252)
(-0.128266 -12.3444 -0.00106285)
(-0.254569 -11.8254 -0.00220838)
(-0.382797 -11.4842 -0.003335)
(-0.498666 -10.9612 -0.00435051)
(-0.591907 -10.2763 -0.00516553)
(-0.666324 -9.51101 -0.00581522)
(-0.725187 -8.74 -0.00632907)
(-0.773196 -8.0041 -0.00674816)
(-0.0630113 -47.3344 -0.000549907)
(0.236554 -47.4323 0.00206459)
(-0.337736 -38.9494 -0.00294673)
(-1.68014 -18.5107 -0.0146619)
(-1.96128 -18.944 -0.0171167)
(-2.83328 -28.1833 -0.0247284)
(-2.54936 -39.4158 -0.022254)
(-1.79903 -43.7853 -0.0157166)
(-1.17308 -39.3742 -0.0102515)
(-0.247562 -31.3676 -0.00217966)
(-0.071504 -19.7898 -0.000617386)
(-0.177509 -12.1885 -0.00147832)
(-0.320172 -11.62 -0.00277851)
(-0.458097 -11.2835 -0.00399148)
(-0.580712 -10.7819 -0.00506646)
(-0.677407 -10.1211 -0.00591176)
(-0.752655 -9.37721 -0.00656873)
(-0.00767736 -19.7236 -6.10907e-05)
(-0.208303 -11.9675 -0.00173184)
)
;
boundaryField
{
inlet
{
type zeroGradient;
}
outlet
{
type pressureInletOutletVelocity;
value nonuniform List<vector>
78
(
(0.0467561 -43.7393 -0.000408091)
(0.046756 -43.7393 0.000408049)
(-0.0585814 -42.7602 0.000511126)
(-0.0585813 -42.7602 -0.000511379)
(0.108069 -41.9213 -0.00094342)
(0.108069 -41.9213 0.000942891)
(-0.075091 -40.8378 0.000655234)
(-0.0750914 -40.8378 -0.000655576)
(0.198964 -45.4781 -0.00173606)
(0.198964 -45.4781 0.00173577)
(0.303566 -44.0591 -0.00265028)
(0.303566 -44.0591 0.00264998)
(-0.162224 -36.3233 0.00141483)
(-0.162224 -36.3233 -0.00141508)
(-0.210974 -28.4971 0.00184215)
(-0.210973 -28.4971 -0.00184302)
(0.159176 -21.0548 -0.00138771)
(0.1592 -21.0548 0.0013857)
(0.268109 -16.3533 -0.00233885)
(0.268109 -16.3533 0.00233869)
(0.236437 -15.6333 -0.00206196)
(0.236437 -15.6333 0.00206189)
(0.21339 -15.1266 -0.00186278)
(0.21339 -15.1266 0.0018627)
(0.197081 -14.4359 -0.00172027)
(0.197081 -14.4359 0.00172019)
(0.183255 -13.6056 -0.00159957)
(0.183255 -13.6056 0.0015995)
(0.171506 -12.7007 -0.00149704)
(0.171506 -12.7007 0.00149697)
(0.159724 -11.8047 -0.00139422)
(0.159724 -11.8047 0.00139416)
(0.147786 -10.9591 -0.00129003)
(0.147786 -10.9591 0.00128997)
(0.135539 -10.1756 -0.00118314)
(0.135539 -10.1756 0.00118308)
(0.123086 -9.45165 -0.00107446)
(0.123086 -9.45165 0.0010744)
(0.110452 -8.77973 -0.000964198)
(0.110452 -8.77973 0.000964143)
(0.097713 -8.15135 -0.000853014)
(0.097713 -8.15135 0.000852962)
(0.0849263 -7.55887 -0.000741414)
(0.0849263 -7.55887 0.000741363)
(0.0721653 -6.99615 -0.000630037)
(0.0721653 -6.99615 0.000629988)
(0.0595033 -6.4586 -0.000519522)
(0.0595033 -6.4586 0.000519474)
(0.0470189 -5.94295 -0.000410556)
(0.0470189 -5.94295 0.000410511)
(0.0347935 -5.44698 -0.000303848)
(0.0347935 -5.44698 0.000303806)
(0.0229118 -4.96926 -0.000200139)
(0.0229118 -4.96926 0.000200098)
(0.0114629 -4.5089 -0.000100205)
(0.0114629 -4.5089 0.000100167)
(0.000540452 -4.06541 -4.8638e-06)
(0.000540453 -4.06541 4.82768e-06)
(-0.00975528 -3.63852 8.50098e-05)
(-0.00975528 -3.63852 -8.50435e-05)
(-0.0193156 -3.22813 0.000168468)
(-0.0193156 -3.22813 -0.000168497)
(-0.028022 -2.83422 0.000244475)
(-0.028022 -2.83422 -0.000244503)
(-0.0357432 -2.45685 0.000311887)
(-0.0357432 -2.45685 -0.000311913)
(-0.0423316 -2.09614 0.000369415)
(-0.0423316 -2.09614 -0.000369439)
(-0.0476186 -1.7522 0.00041559)
(-0.0476186 -1.7522 -0.000415611)
(-0.0514032 -1.42519 0.000448658)
(-0.0514032 -1.42519 -0.000448677)
(-0.0534456 -1.11531 0.000466529)
(-0.0534456 -1.11531 -0.000466545)
(-0.0533982 -0.8228 0.000466179)
(-0.0533982 -0.8228 -0.000466193)
(-0.0508973 -0.547918 0.000444416)
(-0.0508973 -0.547918 -0.000444428)
)
;
}
walls
{
type noSlip;
}
side1
{
type cyclic;
}
side2
{
type cyclic;
}
procBoundary5to3
{
type processor;
value nonuniform List<vector>
84
(
(-0.0446854 -0.291505 0.00039049)
(-0.048399 -0.294719 0.000422536)
(-0.0547391 -0.296337 0.000477869)
(-0.0626447 -0.296628 0.000546879)
(-0.0716524 -0.295998 0.000625491)
(-0.0814968 -0.294589 0.000711409)
(-0.092016 -0.292523 0.000803224)
(-0.103118 -0.289907 0.000900125)
(-0.114751 -0.286824 0.00100167)
(-0.126888 -0.283339 0.00110762)
(-0.139517 -0.2795 0.00121785)
(-0.152631 -0.275348 0.00133233)
(-0.16623 -0.270916 0.00145105)
(-0.180316 -0.266232 0.00157401)
(-0.194891 -0.261321 0.00170124)
(-0.209959 -0.256209 0.00183278)
(-0.225522 -0.250917 0.00196864)
(-0.241583 -0.245468 0.00210885)
(-0.258142 -0.239884 0.0022534)
(-0.275199 -0.23419 0.00240231)
(-0.292752 -0.228407 0.00255554)
(-0.310795 -0.222562 0.00271305)
(-0.329321 -0.216679 0.00287478)
(-0.34832 -0.210784 0.00304064)
(-0.367779 -0.204905 0.00321052)
(-0.387681 -0.19907 0.00338427)
(-0.408006 -0.193307 0.0035617)
(-0.428728 -0.187645 0.00374261)
(-0.449819 -0.182114 0.00392673)
(-0.471245 -0.176742 0.00411379)
(-0.49297 -0.171559 0.00430346)
(-0.514952 -0.166591 0.00449536)
(-0.537143 -0.161865 0.0046891)
(-0.559494 -0.157407 0.00488423)
(-0.58195 -0.153239 0.00508028)
(-0.604454 -0.149382 0.00527674)
(-0.626943 -0.145852 0.00547308)
(-0.649355 -0.142665 0.00566875)
(-0.671623 -0.139832 0.00586316)
(-0.693681 -0.137359 0.00605573)
(-0.71546 -0.13525 0.00624587)
(-0.736891 -0.133505 0.00643297)
(-0.0446854 -0.291505 -0.000390499)
(-0.048399 -0.294719 -0.000422546)
(-0.0547391 -0.296337 -0.000477879)
(-0.0626447 -0.296628 -0.000546889)
(-0.0716524 -0.295998 -0.000625501)
(-0.0814968 -0.294589 -0.00071142)
(-0.092016 -0.292523 -0.000803235)
(-0.103118 -0.289907 -0.000900137)
(-0.114751 -0.286824 -0.00100168)
(-0.126888 -0.283339 -0.00110763)
(-0.139517 -0.2795 -0.00121787)
(-0.152631 -0.275348 -0.00133235)
(-0.16623 -0.270916 -0.00145106)
(-0.180316 -0.266232 -0.00157402)
(-0.194891 -0.261321 -0.00170126)
(-0.209959 -0.256209 -0.00183279)
(-0.225522 -0.250917 -0.00196865)
(-0.241583 -0.245468 -0.00210886)
(-0.258142 -0.239884 -0.00225342)
(-0.275199 -0.23419 -0.00240232)
(-0.292752 -0.228407 -0.00255555)
(-0.310795 -0.222562 -0.00271306)
(-0.329321 -0.216679 -0.00287479)
(-0.34832 -0.210784 -0.00304066)
(-0.367779 -0.204905 -0.00321054)
(-0.387681 -0.19907 -0.00338428)
(-0.408006 -0.193307 -0.00356172)
(-0.428728 -0.187645 -0.00374262)
(-0.449819 -0.182114 -0.00392675)
(-0.471245 -0.176742 -0.00411381)
(-0.49297 -0.171559 -0.00430347)
(-0.514952 -0.166591 -0.00449537)
(-0.537143 -0.161865 -0.00468911)
(-0.559494 -0.157407 -0.00488424)
(-0.58195 -0.153239 -0.00508029)
(-0.604454 -0.149382 -0.00527675)
(-0.626943 -0.145852 -0.0054731)
(-0.649355 -0.142665 -0.00566876)
(-0.671623 -0.139832 -0.00586317)
(-0.693681 -0.137359 -0.00605575)
(-0.71546 -0.13525 -0.00624588)
(-0.736891 -0.133505 -0.00643299)
)
;
}
procBoundary5to4
{
type processor;
value nonuniform List<vector>
86
(
(-0.812794 -7.31952 0.00709372)
(-0.845985 -6.68894 0.00738347)
(-0.873759 -6.10873 0.00762592)
(-0.896819 -5.57322 0.00782724)
(-0.915554 -5.07656 0.0079908)
(-0.930248 -4.61355 0.0081191)
(-0.941101 -4.1799 0.00821386)
(-0.948276 -3.77217 0.00827653)
(-0.951909 -3.38769 0.00830828)
(-0.952125 -3.02435 0.0083102)
(-0.949036 -2.68053 0.00828331)
(-0.94275 -2.35496 0.00822848)
(-0.933367 -2.04663 0.00814661)
(-0.920984 -1.75474 0.00803858)
(-0.905694 -1.47866 0.00790517)
(-0.887587 -1.21788 0.00774717)
(-0.866751 -0.971988 0.00756536)
(-0.843275 -0.740669 0.0073605)
(-0.817247 -0.523681 0.00713337)
(-0.78876 -0.320856 0.0068848)
(-0.810285 -8.62316 0.00707169)
(-0.812794 -7.31952 0.00709372)
(-0.855669 -7.90045 0.0074679)
(-0.0534567 -47.4914 0.000466618)
(0.198914 -47.3353 -0.00173609)
(-0.251719 -37.3076 0.00219532)
(-0.878433 -16.9829 0.00766632)
(-0.739684 -17.5463 0.00645523)
(-1.54201 -27.0537 0.013457)
(-1.15016 -39.5569 0.0100396)
(-0.681178 -44.3378 0.00595698)
(-0.48839 -40.1387 0.0042736)
(0.171106 -31.8925 -0.00147491)
(-0.374021 -11.3869 0.00324527)
(-0.523558 -11.064 0.00456181)
(-0.654143 -10.588 0.00570702)
(-0.755277 -9.95522 0.00659122)
(-0.810285 -8.62316 0.00707169)
(-0.83233 -9.23597 0.00726398)
(0.171106 -31.8925 -0.00147491)
(0.105081 -19.3458 -0.000924816)
(-0.374021 -11.3869 0.00324527)
(-0.223089 -11.6572 0.00184764)
(-0.812794 -7.31952 -0.00709382)
(-0.845985 -6.68894 -0.00738356)
(-0.873759 -6.10873 -0.00762601)
(-0.896819 -5.57322 -0.00782731)
(-0.915554 -5.07656 -0.00799086)
(-0.930248 -4.61355 -0.00811916)
(-0.941101 -4.1799 -0.00821392)
(-0.948276 -3.77217 -0.00827658)
(-0.951909 -3.38769 -0.00830833)
(-0.952125 -3.02435 -0.00831025)
(-0.949036 -2.68053 -0.00828331)
(-0.94275 -2.35496 -0.00822849)
(-0.933367 -2.04663 -0.00814665)
(-0.920984 -1.75474 -0.00803861)
(-0.905694 -1.47866 -0.0079052)
(-0.887587 -1.21788 -0.0077472)
(-0.866751 -0.971988 -0.00756539)
(-0.843275 -0.740669 -0.00736052)
(-0.817247 -0.523681 -0.00713339)
(-0.78876 -0.320856 -0.00688482)
(-0.810285 -8.62316 -0.00707183)
(-0.812794 -7.31952 -0.00709382)
(-0.855669 -7.90045 -0.00746802)
(-0.0534568 -47.4914 -0.000466514)
(0.198913 -47.3353 0.00173603)
(-0.251719 -37.3076 -0.00219675)
(-0.878431 -16.9829 -0.00766592)
(-0.739683 -17.5463 -0.00645549)
(-1.54201 -27.0537 -0.0134588)
(-1.15017 -39.5569 -0.0100407)
(-0.681178 -44.3378 -0.00595765)
(-0.48839 -40.1387 -0.00427415)
(0.171106 -31.8925 0.00147512)
(-0.374021 -11.3869 -0.00324542)
(-0.523558 -11.064 -0.00456199)
(-0.654143 -10.588 -0.0057072)
(-0.755277 -9.95522 -0.00659139)
(-0.810285 -8.62316 -0.00707183)
(-0.83233 -9.23597 -0.00726413)
(0.171106 -31.8925 0.00147512)
(0.105082 -19.3458 0.000925087)
(-0.374021 -11.3869 -0.00324542)
(-0.22309 -11.6572 -0.00184767)
)
;
}
}
// ************************************************************************* //
| |
a074e3cafbcd12ec7422c17adabde3fc882894a6 | c21b05d2084cfd626a93f085dd530a30ff49ab4e | /src/psmoveservice/Server/ServerRequestHandler.cpp | 07948c79354887a0776aca584e5d96c01d71302b | [
"Apache-2.0"
] | permissive | gb2111/PSMoveService | 956c70d687b2f4100af13ad6f646b8eb7102ff82 | e3ec72420ce70d8237488a2756e87c60226b6015 | refs/heads/master | 2021-01-12T12:51:29.644712 | 2017-12-29T22:12:25 | 2017-12-29T22:12:25 | 69,383,309 | 3 | 0 | Apache-2.0 | 2017-12-29T13:16:48 | 2016-09-27T17:48:14 | Objective-C | UTF-8 | C++ | false | false | 140,949 | cpp | ServerRequestHandler.cpp | //-- includes -----
#include "ServerRequestHandler.h"
#include "BluetoothRequests.h"
#include "BluetoothQueries.h"
#include "ControllerManager.h"
#include "DeviceManager.h"
#include "DeviceEnumerator.h"
#include "MathEigen.h"
#include "HMDManager.h"
#include "MorpheusHMD.h"
#include "VirtualHMD.h"
#include "OrientationFilter.h"
#include "PositionFilter.h"
#include "ProtocolVersion.h"
#include "PS3EyeTracker.h"
#include "PSDualShock4Controller.h"
#include "PSMoveController.h"
#include "PSNaviController.h"
#include "PSMoveProtocol.pb.h"
#include "ServerControllerView.h"
#include "ServerDeviceView.h"
#include "ServerNetworkManager.h"
#include "ServerTrackerView.h"
#include "ServerHMDView.h"
#include "ServerLog.h"
#include "ServerUtility.h"
#include "TrackerManager.h"
#include "VirtualController.h"
#include <cassert>
#include <bitset>
#include <map>
#include <boost/shared_ptr.hpp>
//-- pre-declarations -----
class ServerRequestHandlerImpl;
typedef boost::shared_ptr<ServerRequestHandlerImpl> ServerRequestHandlerImplPtr;
//-- definitions -----
struct RequestConnectionState
{
int connection_id;
std::bitset<ControllerManager::k_max_devices> active_controller_streams;
std::bitset<TrackerManager::k_max_devices> active_tracker_streams;
std::bitset<HMDManager::k_max_devices> active_hmd_streams;
AsyncBluetoothRequest *pending_bluetooth_request;
ControllerStreamInfo active_controller_stream_info[ControllerManager::k_max_devices];
TrackerStreamInfo active_tracker_stream_info[TrackerManager::k_max_devices];
HMDStreamInfo active_hmd_stream_info[HMDManager::k_max_devices];
RequestConnectionState()
: connection_id(-1)
, active_controller_streams()
, active_tracker_streams()
, active_hmd_streams()
, pending_bluetooth_request(nullptr)
{
for (int index = 0; index < ControllerManager::k_max_devices; ++index)
{
active_controller_stream_info[index].Clear();
}
for (int index = 0; index < TrackerManager::k_max_devices; ++index)
{
active_tracker_stream_info[index].Clear();
}
for (int index = 0; index < HMDManager::k_max_devices; ++index)
{
active_hmd_stream_info[index].Clear();
}
}
};
typedef boost::shared_ptr<RequestConnectionState> RequestConnectionStatePtr;
typedef std::map<int, RequestConnectionStatePtr> t_connection_state_map;
typedef std::map<int, RequestConnectionStatePtr>::iterator t_connection_state_iter;
typedef std::map<int, RequestConnectionStatePtr>::const_iterator t_connection_state_const_iter;
typedef std::pair<int, RequestConnectionStatePtr> t_id_connection_state_pair;
struct RequestContext
{
RequestConnectionStatePtr connection_state;
RequestPtr request;
};
//-- private implementation -----
class ServerRequestHandlerImpl
{
public:
ServerRequestHandlerImpl(DeviceManager &deviceManager)
: m_device_manager(deviceManager)
, m_connection_state_map()
{
}
virtual ~ServerRequestHandlerImpl()
{
// Without this we get a warning for deletion:
// "Delete called on 'class ServerRequestHandlerImpl' that has virtual functions but non-virtual destructor"
}
bool any_active_bluetooth_requests() const
{
bool any_active= false;
for (t_connection_state_const_iter iter= m_connection_state_map.begin(); iter != m_connection_state_map.end(); ++iter)
{
RequestConnectionStatePtr connection_state= iter->second;
if (connection_state->pending_bluetooth_request != nullptr)
{
any_active= true;
break;
}
}
return any_active;
}
void update()
{
for (t_connection_state_iter iter= m_connection_state_map.begin(); iter != m_connection_state_map.end(); ++iter)
{
int connection_id= iter->first;
RequestConnectionStatePtr connection_state= iter->second;
// Update any asynchronous bluetooth requests
if (connection_state->pending_bluetooth_request != nullptr)
{
bool delete_request;
connection_state->pending_bluetooth_request->update();
switch(connection_state->pending_bluetooth_request->getStatusCode())
{
case AsyncBluetoothRequest::running:
{
// Don't delete. Still have work to do
delete_request= false;
} break;
case AsyncBluetoothRequest::succeeded:
{
SERVER_LOG_INFO("ServerRequestHandler")
<< "Async bluetooth request("
<< connection_state->pending_bluetooth_request->getDescription()
<< ") completed.";
delete_request= true;
} break;
case AsyncBluetoothRequest::failed:
{
SERVER_LOG_ERROR("ServerRequestHandler")
<< "Async bluetooth request("
<< connection_state->pending_bluetooth_request->getDescription()
<< ") failed!";
delete_request= true;
} break;
default:
assert(0 && "unreachable");
}
if (delete_request)
{
delete connection_state->pending_bluetooth_request;
connection_state->pending_bluetooth_request= nullptr;
}
}
}
}
ResponsePtr handle_request(int connection_id, RequestPtr request)
{
// The context holds everything a handler needs to evaluate a request
RequestContext context;
context.request= request;
context.connection_state= FindOrCreateConnectionState(connection_id);
// All responses track which request they came from
PSMoveProtocol::Response *response= nullptr;
switch (request->type())
{
// Controller Requests
case PSMoveProtocol::Request_RequestType_GET_CONTROLLER_LIST:
response = new PSMoveProtocol::Response;
handle_request__get_controller_list(context, response);
break;
case PSMoveProtocol::Request_RequestType_START_CONTROLLER_DATA_STREAM:
response = new PSMoveProtocol::Response;
handle_request__start_controller_data_stream(context, response);
break;
case PSMoveProtocol::Request_RequestType_STOP_CONTROLLER_DATA_STREAM:
response = new PSMoveProtocol::Response;
handle_request__stop_controller_data_stream(context, response);
break;
case PSMoveProtocol::Request_RequestType_RESET_ORIENTATION:
response = new PSMoveProtocol::Response;
handle_request__reset_orientation(context, response);
break;
case PSMoveProtocol::Request_RequestType_UNPAIR_CONTROLLER:
response = new PSMoveProtocol::Response;
handle_request__unpair_controller(context, response);
break;
case PSMoveProtocol::Request_RequestType_PAIR_CONTROLLER:
response = new PSMoveProtocol::Response;
handle_request__pair_controller(context, response);
break;
case PSMoveProtocol::Request_RequestType_CANCEL_BLUETOOTH_REQUEST:
response = new PSMoveProtocol::Response;
handle_request__cancel_bluetooth_request(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_LED_TRACKING_COLOR:
response = new PSMoveProtocol::Response;
handle_request__set_led_tracking_color(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_CONTROLLER_MAGNETOMETER_CALIBRATION:
response = new PSMoveProtocol::Response;
handle_request__set_controller_magnetometer_calibration(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_CONTROLLER_ACCELEROMETER_CALIBRATION:
response = new PSMoveProtocol::Response;
handle_request__set_controller_accelerometer_calibration(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_CONTROLLER_GYROSCOPE_CALIBRATION:
response = new PSMoveProtocol::Response;
handle_request__set_controller_gyroscope_calibration(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_OPTICAL_NOISE_CALIBRATION:
response = new PSMoveProtocol::Response;
handle_request__set_optical_noise_calibration(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_ORIENTATION_FILTER:
response = new PSMoveProtocol::Response;
handle_request__set_orientation_filter(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_POSITION_FILTER:
response = new PSMoveProtocol::Response;
handle_request__set_position_filter(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_CONTROLLER_PREDICTION_TIME:
response = new PSMoveProtocol::Response;
handle_request__set_controller_prediction_time(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_ATTACHED_CONTROLLER:
response = new PSMoveProtocol::Response;
handle_request__set_attached_controller(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_GAMEPAD_INDEX:
response = new PSMoveProtocol::Response;
handle_request__set_gamepad_index(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_CONTROLLER_DATA_STREAM_TRACKER_INDEX:
response = new PSMoveProtocol::Response;
handle_request__set_controller_data_stream_tracker_index(context, response);
break;
// Tracker Requests
case PSMoveProtocol::Request_RequestType_GET_TRACKER_LIST:
response = new PSMoveProtocol::Response;
handle_request__get_tracker_list(context, response);
break;
case PSMoveProtocol::Request_RequestType_START_TRACKER_DATA_STREAM:
response = new PSMoveProtocol::Response;
handle_request__start_tracker_data_stream(context, response);
break;
case PSMoveProtocol::Request_RequestType_STOP_TRACKER_DATA_STREAM:
response = new PSMoveProtocol::Response;
handle_request__stop_tracker_data_stream(context, response);
break;
case PSMoveProtocol::Request_RequestType_GET_TRACKER_SETTINGS:
response = new PSMoveProtocol::Response;
handle_request__get_tracker_settings(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_TRACKER_FRAME_WIDTH:
response = new PSMoveProtocol::Response;
handle_request__set_tracker_frame_width(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_TRACKER_FRAME_HEIGHT:
response = new PSMoveProtocol::Response;
handle_request__set_tracker_frame_height(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_TRACKER_FRAME_RATE:
response = new PSMoveProtocol::Response;
handle_request__set_tracker_frame_rate(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_TRACKER_EXPOSURE:
response = new PSMoveProtocol::Response;
handle_request__set_tracker_exposure(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_TRACKER_GAIN:
response = new PSMoveProtocol::Response;
handle_request__set_tracker_gain(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_TRACKER_OPTION:
response = new PSMoveProtocol::Response;
handle_request__set_tracker_option(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_TRACKER_COLOR_PRESET:
response = new PSMoveProtocol::Response;
handle_request__set_tracker_color_preset(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_TRACKER_POSE:
response = new PSMoveProtocol::Response;
handle_request__set_tracker_pose(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_TRACKER_INTRINSICS:
response = new PSMoveProtocol::Response;
handle_request__set_tracker_intrinsics(context, response);
break;
case PSMoveProtocol::Request_RequestType_SAVE_TRACKER_PROFILE:
response = new PSMoveProtocol::Response;
handle_request__save_tracker_profile(context, response);
break;
case PSMoveProtocol::Request_RequestType_RELOAD_TRACKER_SETTINGS:
response = new PSMoveProtocol::Response;
handle_request__reload_tracker_settings(context, response);
break;
case PSMoveProtocol::Request_RequestType_APPLY_TRACKER_PROFILE:
response = new PSMoveProtocol::Response;
handle_request__apply_tracker_profile(context, response);
break;
case PSMoveProtocol::Request_RequestType_SEARCH_FOR_NEW_TRACKERS:
response = new PSMoveProtocol::Response;
handle_request__search_for_new_trackers(context, response);
break;
case PSMoveProtocol::Request_RequestType_GET_TRACKING_SPACE_SETTINGS:
response = new PSMoveProtocol::Response;
handle_request__get_tracking_space_settings(context, response);
break;
// HMD Requests
case PSMoveProtocol::Request_RequestType_GET_HMD_LIST:
response = new PSMoveProtocol::Response;
handle_request__get_hmd_list(context, response);
break;
case PSMoveProtocol::Request_RequestType_START_HMD_DATA_STREAM:
response = new PSMoveProtocol::Response;
handle_request__start_hmd_data_stream(context, response);
break;
case PSMoveProtocol::Request_RequestType_STOP_HMD_DATA_STREAM:
response = new PSMoveProtocol::Response;
handle_request__stop_hmd_data_stream(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_HMD_LED_TRACKING_COLOR:
response = new PSMoveProtocol::Response;
handle_request__set_hmd_led_tracking_color(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_HMD_ACCELEROMETER_CALIBRATION:
response = new PSMoveProtocol::Response;
handle_request__set_hmd_accelerometer_calibration(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_HMD_GYROSCOPE_CALIBRATION:
response = new PSMoveProtocol::Response;
handle_request__set_hmd_gyroscope_calibration(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_HMD_ORIENTATION_FILTER:
response = new PSMoveProtocol::Response;
handle_request__set_hmd_orientation_filter(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_HMD_POSITION_FILTER:
response = new PSMoveProtocol::Response;
handle_request__set_hmd_position_filter(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_HMD_PREDICTION_TIME:
response = new PSMoveProtocol::Response;
handle_request__set_hmd_prediction_time(context, response);
break;
case PSMoveProtocol::Request_RequestType_SET_HMD_DATA_STREAM_TRACKER_INDEX:
response = new PSMoveProtocol::Response;
handle_request__set_hmd_data_stream_tracker_index(context, response);
break;
// General Service Requests
case PSMoveProtocol::Request_RequestType_GET_SERVICE_VERSION:
response = new PSMoveProtocol::Response;
handle_request__get_service_version(context, response);
break;
default:
assert(0 && "Whoops, bad request!");
}
if (response != nullptr)
{
response->set_request_id(request->request_id());
}
return ResponsePtr(response);
}
void handle_input_data_frame(DeviceInputDataFramePtr data_frame)
{
// The context holds everything a handler needs to evaluate a request
RequestConnectionStatePtr connection_state = FindOrCreateConnectionState(data_frame->connection_id());
switch (data_frame->device_category())
{
case PSMoveProtocol::DeviceInputDataFrame::DeviceCategory::DeviceInputDataFrame_DeviceCategory_CONTROLLER:
{
handle_data_frame__controller_packet(connection_state, data_frame);
} break;
}
}
void handle_client_connection_stopped(int connection_id)
{
t_connection_state_iter iter= m_connection_state_map.find(connection_id);
if (iter != m_connection_state_map.end())
{
int connection_id= iter->first;
RequestConnectionStatePtr connection_state= iter->second;
// Cancel any pending asynchronous bluetooth requests
if (connection_state->pending_bluetooth_request != nullptr)
{
assert(connection_state->pending_bluetooth_request->getStatusCode() == AsyncBluetoothRequest::running);
connection_state->pending_bluetooth_request->cancel(AsyncBluetoothRequest::connectionClosed);
delete connection_state->pending_bluetooth_request;
connection_state->pending_bluetooth_request= nullptr;
}
// Clean up any controller state related to this connection
for (int controller_id = 0; controller_id < ControllerManager::k_max_devices; ++controller_id)
{
const ControllerStreamInfo &streamInfo = connection_state->active_controller_stream_info[controller_id];
ServerControllerViewPtr controller_view = m_device_manager.getControllerViewPtr(controller_id);
if (controller_view->getIsOpen())
{
// Clear any LED overrides we had active
//###HipsterSlot $HACK
// This implicitly assumes that only one connection had an LED override color active.
// This is technically true right now because only the config tool sets the override
// color for purposes of tracking color calibration, but this could change in the future.
if (controller_view->getIsLEDOverrideActive())
{
controller_view->clearLEDOverride();
}
// If this connection had ROI disabled, pop the ROI supression request
if (streamInfo.disable_roi)
{
controller_view->popDisableROI();
}
// Halt any controller tracking this connection had going on
if (streamInfo.include_position_data)
{
m_device_manager.getControllerViewPtr(controller_id)->stopTracking();
}
}
}
for (int tracker_id = 0; tracker_id < TrackerManager::k_max_devices; ++tracker_id)
{
// Restore any overridden camera settings from the config
if (connection_state->active_tracker_stream_info[tracker_id].has_temp_settings_override)
{
m_device_manager.getTrackerViewPtr(tracker_id)->loadSettings();
}
// Halt any shared memory streams this connection has going
if (connection_state->active_tracker_stream_info[tracker_id].streaming_video_data)
{
m_device_manager.getTrackerViewPtr(tracker_id)->stopSharedMemoryVideoStream();
}
}
// Clean up any hmd state related to this connection
for (int hmd_id = 0; hmd_id < HMDManager::k_max_devices; ++hmd_id)
{
const HMDStreamInfo &streamInfo = connection_state->active_hmd_stream_info[hmd_id];
ServerHMDViewPtr hmd_view = m_device_manager.getHMDViewPtr(hmd_id);
// Undo the ROI suppression
if (streamInfo.disable_roi)
{
m_device_manager.getHMDViewPtr(hmd_id)->popDisableROI();
}
// Halt any hmd tracking this connection had going on
if (streamInfo.include_position_data)
{
m_device_manager.getHMDViewPtr(hmd_id)->stopTracking();
}
}
// Remove the connection state from the state map
m_connection_state_map.erase(iter);
}
}
void publish_controller_data_frame(
ServerControllerView *controller_view,
ServerRequestHandler::t_generate_controller_data_frame_for_stream callback)
{
int controller_id= controller_view->getDeviceID();
// Notify any connections that care about the controller update
for (t_connection_state_iter iter= m_connection_state_map.begin(); iter != m_connection_state_map.end(); ++iter)
{
int connection_id= iter->first;
RequestConnectionStatePtr connection_state= iter->second;
if (connection_state->active_controller_streams.test(controller_id))
{
const ControllerStreamInfo &streamInfo=
connection_state->active_controller_stream_info[controller_id];
// Fill out a data frame specific to this stream using the given callback
DeviceOutputDataFramePtr data_frame(new PSMoveProtocol::DeviceOutputDataFrame);
callback(controller_view, &streamInfo, data_frame.get());
// Send the controller data frame over the network
ServerNetworkManager::get_instance()->send_device_data_frame(connection_id, data_frame);
}
}
}
void publish_tracker_data_frame(
class ServerTrackerView *tracker_view,
ServerRequestHandler::t_generate_tracker_data_frame_for_stream callback)
{
int tracker_id = tracker_view->getDeviceID();
// Notify any connections that care about the tracker update
for (t_connection_state_iter iter = m_connection_state_map.begin(); iter != m_connection_state_map.end(); ++iter)
{
int connection_id = iter->first;
RequestConnectionStatePtr connection_state = iter->second;
if (connection_state->active_tracker_streams.test(tracker_id))
{
const TrackerStreamInfo &streamInfo =
connection_state->active_tracker_stream_info[tracker_id];
// Fill out a data frame specific to this stream using the given callback
DeviceOutputDataFramePtr data_frame(new PSMoveProtocol::DeviceOutputDataFrame);
callback(tracker_view, &streamInfo, data_frame);
// Send the tracker data frame over the network
ServerNetworkManager::get_instance()->send_device_data_frame(connection_id, data_frame);
}
}
}
void publish_hmd_data_frame(
class ServerHMDView *hmd_view,
ServerRequestHandler::t_generate_hmd_data_frame_for_stream callback)
{
int hmd_id = hmd_view->getDeviceID();
// Notify any connections that care about the tracker update
for (t_connection_state_iter iter = m_connection_state_map.begin(); iter != m_connection_state_map.end(); ++iter)
{
int connection_id = iter->first;
RequestConnectionStatePtr connection_state = iter->second;
if (connection_state->active_hmd_streams.test(hmd_id))
{
const HMDStreamInfo &streamInfo =
connection_state->active_hmd_stream_info[hmd_id];
// Fill out a data frame specific to this stream using the given callback
DeviceOutputDataFramePtr data_frame(new PSMoveProtocol::DeviceOutputDataFrame);
callback(hmd_view, &streamInfo, data_frame);
// Send the hmd data frame over the network
ServerNetworkManager::get_instance()->send_device_data_frame(connection_id, data_frame);
}
}
}
protected:
RequestConnectionStatePtr FindOrCreateConnectionState(int connection_id)
{
t_connection_state_iter iter= m_connection_state_map.find(connection_id);
RequestConnectionStatePtr connection_state;
if (iter == m_connection_state_map.end())
{
connection_state= RequestConnectionStatePtr(new RequestConnectionState());
connection_state->connection_id= connection_id;
m_connection_state_map.insert(t_id_connection_state_pair(connection_id, connection_state));
}
else
{
connection_state= iter->second;
}
return connection_state;
}
// -- Controller Requests -----
inline ServerControllerView *get_controller_view_or_null(int controller_id)
{
ServerControllerView *controller_view= nullptr;
if (ServerUtility::is_index_valid(controller_id, m_device_manager.getControllerViewMaxCount()))
{
ServerControllerViewPtr controller_view_ptr= m_device_manager.getControllerViewPtr(controller_id);
if (controller_view_ptr->getIsOpen())
{
controller_view= controller_view_ptr.get();
}
}
return controller_view;
}
void handle_request__get_controller_list(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const PSMoveProtocol::Request_RequestGetControllerList& request =
context.request->request_get_controller_list();
PSMoveProtocol::Response_ResultControllerList* list= response->mutable_result_controller_list();
response->set_type(PSMoveProtocol::Response_ResponseType_CONTROLLER_LIST);
// Get the address of the bluetooth adapter cached at startup
list->set_host_serial(m_device_manager.m_controller_manager->getCachedBluetoothHostAddress());
list->set_gamepad_count(m_device_manager.m_controller_manager->getGamepadCount());
// Add of the open controllers matching the filter constraints
for (int controller_id= 0; controller_id < m_device_manager.getControllerViewMaxCount(); ++controller_id)
{
ServerControllerViewPtr controller_view= m_device_manager.getControllerViewPtr(controller_id);
const bool bIncludeUSB = request.include_usb_controllers();
const bool bIsNonUSB = controller_view->getIsBluetooth() || controller_view->getIsVirtualController();
if (controller_view->getIsOpen() && (bIncludeUSB || bIsNonUSB))
{
PSMoveProtocol::Response_ResultControllerList_ControllerInfo *controller_info= list->add_controllers();
int firmware_version = 0;
int firmware_revision = 0;
bool has_magnetometer = false;
std::string parent_controller_serial = "";
std::string orientation_filter = "";
std::string position_filter = "";
std::string gyro_gain_setting = "";
float prediction_time = 0.f;
int gamepad_index= -1;
switch(controller_view->getControllerDeviceType())
{
case CommonControllerState::PSMove:
{
const PSMoveController *controller = controller_view->castCheckedConst<PSMoveController>();
const PSMoveControllerConfig *config = controller->getConfig();
orientation_filter = config->orientation_filter_type;
position_filter = config->position_filter_type;
firmware_version = config->firmware_version;
firmware_revision = config->firmware_revision;
prediction_time = config->prediction_time;
has_magnetometer = controller->getSupportsMagnetometer();
controller_info->set_controller_type(PSMoveProtocol::PSMOVE);
}
break;
case CommonControllerState::PSNavi:
{
const PSNaviController *controller = controller_view->castCheckedConst<PSNaviController>();
const PSNaviControllerConfig &config = controller->getConfig();
controller_info->set_controller_type(PSMoveProtocol::PSNAVI);
parent_controller_serial = config.attached_to_controller;
}
break;
case CommonControllerState::PSDualShock4:
{
const PSDualShock4Controller *controller = controller_view->castCheckedConst<PSDualShock4Controller>();
const PSDualShock4ControllerConfig *config = controller->getConfig();
float radian_gain_divisor = safe_divide_with_default(1.f, config->gyro_gain, 1.f);
float degree_gain_divisor = radian_gain_divisor * k_degrees_to_radians;
// Gyro gain mode can vary from controller to controller
// Sensitivity values from Pg.15 of:
// https://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BMI055-DS000-08.pdf
if (is_nearly_equal(degree_gain_divisor, 262.4f, 1.f))
{
gyro_gain_setting = "125deg/s";
}
else if (is_nearly_equal(degree_gain_divisor, 131.2f, 1.f))
{
gyro_gain_setting = "250deg/s";
}
else if (is_nearly_equal(degree_gain_divisor, 65.6f, 1.f))
{
gyro_gain_setting = "500deg/s";
}
else if (is_nearly_equal(degree_gain_divisor, 32.8f, 1.f))
{
gyro_gain_setting = "1000deg/s";
}
else if (is_nearly_equal(degree_gain_divisor, 16.4f, 1.f))
{
gyro_gain_setting = "2000deg/s";
}
else
{
gyro_gain_setting = "custom";
}
orientation_filter = config->orientation_filter_type;
position_filter = config->position_filter_type;
prediction_time = config->prediction_time;
controller_info->set_controller_type(PSMoveProtocol::PSDUALSHOCK4);
}
break;
case CommonControllerState::VirtualController:
{
const VirtualController *controller = controller_view->castCheckedConst<VirtualController>();
const VirtualControllerConfig *config = controller->getConfig();
position_filter = config->position_filter_type;
prediction_time = config->prediction_time;
controller_info->set_controller_type(PSMoveProtocol::VIRTUALCONTROLLER);
gamepad_index= config->gamepad_index;
}
break;
default:
assert(0 && "Unhandled controller type");
}
controller_info->set_controller_id(controller_id);
controller_info->set_connection_type(
bIsNonUSB
? PSMoveProtocol::Response_ResultControllerList_ControllerInfo_ConnectionType_BLUETOOTH
: PSMoveProtocol::Response_ResultControllerList_ControllerInfo_ConnectionType_USB);
controller_info->set_tracking_color_type(
static_cast<PSMoveProtocol::TrackingColorType>(controller_view->getTrackingColorID()));
controller_info->set_device_path(controller_view->getUSBDevicePath());
controller_info->set_device_serial(controller_view->getSerial());
controller_info->set_assigned_host_serial(controller_view->getAssignedHostBluetoothAddress());
controller_info->set_parent_controller_serial(parent_controller_serial);
controller_info->set_firmware_version(firmware_version);
controller_info->set_firmware_revision(firmware_revision);
controller_info->set_has_magnetometer(has_magnetometer);
controller_info->set_orientation_filter(orientation_filter);
controller_info->set_position_filter(position_filter);
controller_info->set_gyro_gain_setting(gyro_gain_setting);
controller_info->set_prediction_time(prediction_time);
controller_info->set_gamepad_index(gamepad_index);
}
}
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
void handle_request__start_controller_data_stream(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const PSMoveProtocol::Request_RequestStartPSMoveDataStream& request=
context.request->request_start_psmove_data_stream();
int controller_id= request.controller_id();
response->set_type(PSMoveProtocol::Response_ResponseType_CONTROLLER_STREAM_STARTED);
if (ServerUtility::is_index_valid(controller_id, m_device_manager.getControllerViewMaxCount()))
{
ServerControllerViewPtr controller_view = m_device_manager.getControllerViewPtr(controller_id);
// Some controllers can only be streamed when connected via bluetooth
if (controller_view->getIsStreamable())
{
ControllerStreamInfo &streamInfo =
context.connection_state->active_controller_stream_info[controller_id];
// The controller manager will always publish updates regardless of who is listening.
// All we have to do is keep track of which connections care about the updates.
context.connection_state->active_controller_streams.set(controller_id, true);
// Set control flags for the stream
streamInfo.Clear();
streamInfo.include_position_data = request.include_position_data();
streamInfo.include_physics_data = request.include_physics_data();
streamInfo.include_raw_sensor_data = request.include_raw_sensor_data();
streamInfo.include_calibrated_sensor_data = request.include_calibrated_sensor_data();
streamInfo.include_raw_tracker_data = request.include_raw_tracker_data();
streamInfo.disable_roi = request.disable_roi();
SERVER_LOG_INFO("ServerRequestHandler") << "Start controller(" << controller_id << ") stream ("
<< "pos=" << streamInfo.include_position_data
<< ",phys=" << streamInfo.include_physics_data
<< ",raw_sens=" << streamInfo.include_raw_sensor_data
<< ",cal_sens=" << streamInfo.include_calibrated_sensor_data
<< ",trkr=" << streamInfo.include_raw_tracker_data
<< ",roi=" << streamInfo.disable_roi
<< ")";
if (streamInfo.include_position_data)
{
controller_view->startTracking();
}
// Attach the initial state of the controller
{
auto *stream_started_response= response->mutable_result_controller_stream_started();
PSMoveProtocol::DeviceOutputDataFrame* data_frame= stream_started_response->mutable_initial_data_frame();
ServerControllerView::generate_controller_data_frame_for_stream(controller_view.get(), &streamInfo, data_frame);
}
if (streamInfo.disable_roi)
{
controller_view->pushDisableROI();
}
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
SERVER_LOG_INFO("ServerRequestHandler") << "Failed to start controller(" << controller_id << ") stream: Not on stream-able connection.";
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
SERVER_LOG_INFO("ServerRequestHandler") << "Failed to start controller(" << controller_id << ") stream: Invalid controller id.";
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__stop_controller_data_stream(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
int controller_id= context.request->request_stop_psmove_data_stream().controller_id();
if (ServerUtility::is_index_valid(controller_id, m_device_manager.getControllerViewMaxCount()))
{
ServerControllerViewPtr controller_view = m_device_manager.getControllerViewPtr(controller_id);
ControllerStreamInfo &streamInfo =
context.connection_state->active_controller_stream_info[controller_id];
if (controller_view->getIsStreamable())
{
if (streamInfo.disable_roi)
{
controller_view->popDisableROI();
}
if (streamInfo.include_position_data)
{
controller_view->stopTracking();
}
if (streamInfo.led_override_active)
{
controller_view->clearLEDOverride();
}
SERVER_LOG_INFO("ServerRequestHandler") << "Stop controller(" << controller_id << ") stream";
context.connection_state->active_controller_streams.set(controller_id, false);
context.connection_state->active_controller_stream_info[controller_id].Clear();
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__reset_orientation(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int controller_id= context.request->reset_orientation().controller_id();
ServerControllerViewPtr controllerView = m_device_manager.getControllerViewPtr(controller_id);
CommonDeviceQuaternion q_pose;
q_pose.w= context.request->reset_orientation().orientation().w();
q_pose.x= context.request->reset_orientation().orientation().x();
q_pose.y= context.request->reset_orientation().orientation().y();
q_pose.z= context.request->reset_orientation().orientation().z();
if (controllerView->getIsOpen())
{
if (controllerView->recenterOrientation(q_pose))
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__unpair_controller(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int connection_id= context.connection_state->connection_id;
const int controller_id= context.request->unpair_controller().controller_id();
if (context.connection_state->pending_bluetooth_request == nullptr)
{
ServerControllerViewPtr controllerView= m_device_manager.getControllerViewPtr(controller_id);
if (controllerView->getIsOpen())
{
context.connection_state->pending_bluetooth_request =
new AsyncBluetoothUnpairDeviceRequest(connection_id, controllerView);
std::string description = context.connection_state->pending_bluetooth_request->getDescription();
if (context.connection_state->pending_bluetooth_request->start())
{
SERVER_LOG_INFO("ServerRequestHandler") << "Async bluetooth request(" << description << ") started.";
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
SERVER_LOG_ERROR("ServerRequestHandler") << "Async bluetooth request(" << description << ") failed to start!";
delete context.connection_state->pending_bluetooth_request;
context.connection_state->pending_bluetooth_request = nullptr;
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
SERVER_LOG_ERROR("ServerRequestHandler")
<< "Can't start unpair request. Controller not open. Controller ID: "
<< controller_id;
}
}
else
{
SERVER_LOG_ERROR("ServerRequestHandler")
<< "Can't start unpair request due to existing request: "
<< context.connection_state->pending_bluetooth_request->getDescription();
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__pair_controller(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int connection_id= context.connection_state->connection_id;
const int controller_id= context.request->pair_controller().controller_id();
if (context.connection_state->pending_bluetooth_request == nullptr)
{
ServerControllerViewPtr controllerView= m_device_manager.getControllerViewPtr(controller_id);
if (controllerView->getIsOpen())
{
context.connection_state->pending_bluetooth_request =
new AsyncBluetoothPairDeviceRequest(connection_id, controllerView);
if (context.connection_state->pending_bluetooth_request->start())
{
SERVER_LOG_INFO("ServerRequestHandler")
<< "Async bluetooth request("
<< context.connection_state->pending_bluetooth_request->getDescription()
<< ") started.";
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
SERVER_LOG_ERROR("ServerRequestHandler")
<< "Async bluetooth request("
<< context.connection_state->pending_bluetooth_request->getDescription()
<< ") failed to start!";
delete context.connection_state->pending_bluetooth_request;
context.connection_state->pending_bluetooth_request= nullptr;
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
SERVER_LOG_ERROR("ServerRequestHandler")
<< "Can't start pair request. Controller not open. Controller ID: "
<< controller_id;
}
}
else
{
SERVER_LOG_ERROR("ServerRequestHandler")
<< "Can't start pair request due to existing request: "
<< context.connection_state->pending_bluetooth_request->getDescription();
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__cancel_bluetooth_request(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int connection_id= context.connection_state->connection_id;
const int controller_id= context.request->cancel_bluetooth_request().controller_id();
if (context.connection_state->pending_bluetooth_request != nullptr)
{
SERVER_LOG_INFO("ServerRequestHandler")
<< "Async bluetooth request("
<< context.connection_state->pending_bluetooth_request->getDescription()
<< ") Canceled.";
context.connection_state->pending_bluetooth_request->cancel(AsyncBluetoothRequest::userRequested);
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
SERVER_LOG_ERROR("ServerRequestHandler") << "No active bluetooth operation active";
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_led_tracking_color(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int connection_id = context.connection_state->connection_id;
const int controller_id = context.request->set_led_tracking_color_request().controller_id();
const eCommonTrackingColorID newColorID=
static_cast<eCommonTrackingColorID>(context.request->set_led_tracking_color_request().color_type());
ServerControllerViewPtr ControllerView = m_device_manager.getControllerViewPtr(controller_id);
if (ControllerView &&
ControllerView->getIsStreamable() &&
(ControllerView->getControllerDeviceType() == CommonDeviceState::PSMove ||
ControllerView->getControllerDeviceType() == CommonDeviceState::PSDualShock4 ||
ControllerView->getControllerDeviceType() == CommonDeviceState::VirtualController))
{
const eCommonTrackingColorID oldColorID = ControllerView->getTrackingColorID();
if (newColorID != oldColorID)
{
// Give up control of our existing tracking color
if (oldColorID != eCommonTrackingColorID::INVALID_COLOR)
{
m_device_manager.m_tracker_manager->freeTrackingColorID(oldColorID);
}
// Take the color from any other controller that might have it
if (m_device_manager.m_tracker_manager->claimTrackingColorID(ControllerView.get(), newColorID))
{
// Assign the new color to ourselves
ControllerView->setTrackingColorID(newColorID);
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
if (oldColorID != eCommonTrackingColorID::INVALID_COLOR)
{
m_device_manager.m_tracker_manager->claimTrackingColorID(ControllerView.get(), oldColorID);
}
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
inline void set_config_vector(
const PSMoveProtocol::FloatVector &source_vector,
CommonDeviceVector &target_vector)
{
target_vector.i = source_vector.i();
target_vector.j = source_vector.j();
target_vector.k = source_vector.k();
}
void handle_request__set_controller_magnetometer_calibration(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int controller_id= context.request->set_controller_magnetometer_calibration_request().controller_id();
ServerControllerViewPtr ControllerView= m_device_manager.getControllerViewPtr(controller_id);
if (ControllerView && ControllerView->getIsOpen() && ControllerView->getControllerDeviceType() == CommonDeviceState::PSMove)
{
PSMoveController *controller= ControllerView->castChecked<PSMoveController>();
PSMoveControllerConfig *config= controller->getConfigMutable();
const auto &request= context.request->set_controller_magnetometer_calibration_request();
set_config_vector(request.ellipse_center(), config->magnetometer_center);
set_config_vector(request.ellipse_extents(), config->magnetometer_extents);
set_config_vector(request.magnetometer_identity(), config->magnetometer_identity);
config->magnetometer_fit_error = request.ellipse_fit_error();
config->magnetometer_variance= request.magnetometer_variance();
{
CommonDeviceVector basis_x, basis_y, basis_z;
set_config_vector(request.ellipse_basis_x(), basis_x);
set_config_vector(request.ellipse_basis_y(), basis_y);
set_config_vector(request.ellipse_basis_z(), basis_z);
config->magnetometer_basis_x = basis_x;
config->magnetometer_basis_y = basis_y;
config->magnetometer_basis_z = basis_z;
}
config->save();
// Reset the orientation filter state the calibration changed
ControllerView->resetPoseFilter();
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_controller_accelerometer_calibration(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int controller_id = context.request->set_controller_accelerometer_calibration_request().controller_id();
ServerControllerViewPtr ControllerView = m_device_manager.getControllerViewPtr(controller_id);
if (ControllerView && ControllerView->getIsOpen())
{
if (ControllerView->getControllerDeviceType() == CommonDeviceState::PSMove)
{
PSMoveController *controller = ControllerView->castChecked<PSMoveController>();
PSMoveControllerConfig *config = controller->getConfigMutable();
const auto &request = context.request->set_controller_accelerometer_calibration_request();
// Save the noise radius in controller config
config->accelerometer_noise_radius= request.noise_radius();
config->accelerometer_variance = request.variance();
config->save();
ControllerView->resetPoseFilter();
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else if (ControllerView->getControllerDeviceType() == CommonDeviceState::PSDualShock4)
{
PSDualShock4Controller *controller = ControllerView->castChecked<PSDualShock4Controller>();
PSDualShock4ControllerConfig *config = controller->getConfigMutable();
const auto &request = context.request->set_controller_accelerometer_calibration_request();
// Save the noise radius in controller config
config->accelerometer_noise_radius= request.noise_radius();
config->accelerometer_variance = request.variance();
config->save();
ControllerView->resetPoseFilter();
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_controller_gyroscope_calibration(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int controller_id = context.request->set_controller_gyroscope_calibration_request().controller_id();
ServerControllerViewPtr ControllerView = m_device_manager.getControllerViewPtr(controller_id);
if (ControllerView && ControllerView->getIsOpen())
{
if (ControllerView->getControllerDeviceType() == CommonDeviceState::PSDualShock4)
{
PSDualShock4Controller *controller = ControllerView->castChecked<PSDualShock4Controller>();
PSDualShock4ControllerConfig *config = controller->getConfigMutable();
const auto &request = context.request->set_controller_gyroscope_calibration_request();
bool bChanged = false;
if (request.drift() > 0.f)
{
config->gyro_drift= request.drift();
bChanged = true;
}
if (request.variance() > 0.f)
{
config->gyro_variance= request.variance();
bChanged = true;
}
const std::string gyro_gain_setting = request.gyro_gain_setting();
if (gyro_gain_setting.length() > 0)
{
// Sensitivity values from Pg.15 of:
// https://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BMI055-DS000-08.pdf
if (gyro_gain_setting == "125deg/s")
{
config->gyro_gain = 1.f / (262.4f / k_degrees_to_radians);
bChanged = true;
}
if (gyro_gain_setting == "250deg/s")
{
config->gyro_gain = 1.f / (131.2f / k_degrees_to_radians);
bChanged = true;
}
if (gyro_gain_setting == "500deg/s")
{
config->gyro_gain = 1.f / (65.6f / k_degrees_to_radians);
bChanged = true;
}
else if (gyro_gain_setting == "1000deg/s")
{
config->gyro_gain = 1.f / (32.8f / k_degrees_to_radians);
bChanged = true;
}
else if (gyro_gain_setting == "2000deg/s")
{
config->gyro_gain = 1.f / (16.4f / k_degrees_to_radians);
bChanged = true;
}
}
if (bChanged)
{
config->save();
}
ControllerView->resetPoseFilter();
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else if (ControllerView->getControllerDeviceType() == CommonDeviceState::PSMove)
{
PSMoveController *controller = ControllerView->castChecked<PSMoveController>();
PSMoveControllerConfig *config = controller->getConfigMutable();
const PSMoveProtocol::Request_RequestSetControllerGyroscopeCalibration &request =
context.request->set_controller_gyroscope_calibration_request();
bool bChanged = false;
if (request.drift() > 0.f)
{
config->gyro_drift= request.drift();
bChanged = true;
}
if (request.variance() > 0.f)
{
config->gyro_variance= request.variance();
bChanged = true;
}
if (bChanged)
{
config->save();
}
ControllerView->resetPoseFilter();
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_optical_noise_calibration(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int controller_id = context.request->request_set_optical_noise_calibration().controller_id();
ServerControllerViewPtr ControllerView = m_device_manager.getControllerViewPtr(controller_id);
const PSMoveProtocol::Request_RequestSetOpticalNoiseCalibration &request =
context.request->request_set_optical_noise_calibration();
if (ControllerView && ControllerView->getIsOpen())
{
if (ControllerView->getControllerDeviceType() == CommonDeviceState::PSDualShock4)
{
PSDualShock4Controller *controller = ControllerView->castChecked<PSDualShock4Controller>();
PSDualShock4ControllerConfig *config = controller->getConfigMutable();
config->position_variance_exp_fit_a = request.position_variance_exp_fit_a();
config->position_variance_exp_fit_b = request.position_variance_exp_fit_b();
config->orientation_variance_exp_fit_a = request.orientation_variance_exp_fit_a();
config->orientation_variance_exp_fit_b = request.orientation_variance_exp_fit_b();
config->save();
ControllerView->resetPoseFilter();
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else if (ControllerView->getControllerDeviceType() == CommonDeviceState::PSMove)
{
PSMoveController *controller = ControllerView->castChecked<PSMoveController>();
PSMoveControllerConfig *config = controller->getConfigMutable();
config->position_variance_exp_fit_a = request.position_variance_exp_fit_a();
config->position_variance_exp_fit_b = request.position_variance_exp_fit_b();
// No optical variance set for the psmove
config->save();
ControllerView->resetPoseFilter();
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else if (ControllerView->getControllerDeviceType() == CommonDeviceState::VirtualController)
{
VirtualController *controller = ControllerView->castChecked<VirtualController>();
VirtualControllerConfig *config = controller->getConfigMutable();
config->position_variance_exp_fit_a = request.position_variance_exp_fit_a();
config->position_variance_exp_fit_b = request.position_variance_exp_fit_b();
// No optical variance set for the psmove
config->save();
ControllerView->resetPoseFilter();
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_orientation_filter(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int controller_id = context.request->request_set_orientation_filter().controller_id();
ServerControllerViewPtr ControllerView = m_device_manager.getControllerViewPtr(controller_id);
const PSMoveProtocol::Request_RequestSetOrientationFilter &request =
context.request->request_set_orientation_filter();
if (ControllerView && ControllerView->getIsOpen())
{
if (ControllerView->getControllerDeviceType() == CommonDeviceState::PSDualShock4)
{
PSDualShock4Controller *controller = ControllerView->castChecked<PSDualShock4Controller>();
PSDualShock4ControllerConfig *config = controller->getConfigMutable();
if (config->orientation_filter_type != request.orientation_filter())
{
config->orientation_filter_type = request.orientation_filter();
config->save();
ControllerView->resetPoseFilter();
}
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else if (ControllerView->getControllerDeviceType() == CommonDeviceState::PSMove)
{
PSMoveController *controller = ControllerView->castChecked<PSMoveController>();
PSMoveControllerConfig *config = controller->getConfigMutable();
if (config->orientation_filter_type != request.orientation_filter())
{
config->orientation_filter_type = request.orientation_filter();
config->save();
ControllerView->resetPoseFilter();
}
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_position_filter(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int controller_id = context.request->request_set_position_filter().controller_id();
ServerControllerViewPtr ControllerView = m_device_manager.getControllerViewPtr(controller_id);
const PSMoveProtocol::Request_RequestSetPositionFilter &request =
context.request->request_set_position_filter();
if (ControllerView && ControllerView->getIsOpen())
{
if (ControllerView->getControllerDeviceType() == CommonDeviceState::PSDualShock4)
{
PSDualShock4Controller *controller = ControllerView->castChecked<PSDualShock4Controller>();
PSDualShock4ControllerConfig *config = controller->getConfigMutable();
if (config->position_filter_type != request.position_filter())
{
config->position_filter_type = request.position_filter();
config->save();
ControllerView->resetPoseFilter();
}
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else if (ControllerView->getControllerDeviceType() == CommonDeviceState::PSMove)
{
PSMoveController *controller = ControllerView->castChecked<PSMoveController>();
PSMoveControllerConfig *config = controller->getConfigMutable();
if (config->position_filter_type != request.position_filter())
{
config->position_filter_type = request.position_filter();
config->save();
ControllerView->resetPoseFilter();
}
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else if (ControllerView->getControllerDeviceType() == CommonDeviceState::VirtualController)
{
VirtualController *controller = ControllerView->castChecked<VirtualController>();
VirtualControllerConfig *config = controller->getConfigMutable();
if (config->position_filter_type != request.position_filter())
{
config->position_filter_type = request.position_filter();
config->save();
ControllerView->resetPoseFilter();
}
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_controller_prediction_time(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int controller_id = context.request->request_set_controller_prediction_time().controller_id();
ServerControllerViewPtr ControllerView = m_device_manager.getControllerViewPtr(controller_id);
const PSMoveProtocol::Request_RequestSetControllerPredictionTime &request =
context.request->request_set_controller_prediction_time();
if (ControllerView && ControllerView->getIsOpen())
{
if (ControllerView->getControllerDeviceType() == CommonDeviceState::PSDualShock4)
{
PSDualShock4Controller *controller = ControllerView->castChecked<PSDualShock4Controller>();
PSDualShock4ControllerConfig *config = controller->getConfigMutable();
if (config->prediction_time != request.prediction_time())
{
config->prediction_time = request.prediction_time();
config->save();
}
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else if (ControllerView->getControllerDeviceType() == CommonDeviceState::PSMove)
{
PSMoveController *controller = ControllerView->castChecked<PSMoveController>();
PSMoveControllerConfig *config = controller->getConfigMutable();
if (config->prediction_time != request.prediction_time())
{
config->prediction_time = request.prediction_time();
config->save();
}
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else if (ControllerView->getControllerDeviceType() == CommonDeviceState::VirtualController)
{
VirtualController *controller = ControllerView->castChecked<VirtualController>();
VirtualControllerConfig *config = controller->getConfigMutable();
if (config->prediction_time != request.prediction_time())
{
config->prediction_time = request.prediction_time();
config->save();
}
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_attached_controller(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int child_controller_id = context.request->request_set_attached_controller().child_controller_id();
const int parent_controller_id = context.request->request_set_attached_controller().parent_controller_id();
ServerControllerViewPtr ChildControllerView = m_device_manager.getControllerViewPtr(child_controller_id);
ServerControllerViewPtr ParentControllerView = m_device_manager.getControllerViewPtr(parent_controller_id);
if (ChildControllerView && ChildControllerView->getIsOpen() &&
ParentControllerView && ParentControllerView->getIsOpen() &&
ChildControllerView != ParentControllerView)
{
if (ParentControllerView->getControllerDeviceType() == CommonDeviceState::PSMove &&
ChildControllerView->getControllerDeviceType() == CommonDeviceState::PSNavi)
{
const PSMoveController *psmove = ParentControllerView->castChecked<PSMoveController>();
PSNaviController *psnavi = ChildControllerView->castChecked<PSNaviController>();
PSNaviControllerConfig &psnavi_config = psnavi->getConfigMutable();
psnavi_config.attached_to_controller = psmove->getSerial();
psnavi_config.save();
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_gamepad_index(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int controller_id = context.request->request_set_gamepad_index().controller_id();
const int gamepad_index = context.request->request_set_gamepad_index().gamepad_index();
ServerControllerViewPtr ControllerView = m_device_manager.getControllerViewPtr(controller_id);
if (ControllerView &&
ControllerView->getIsOpen() &&
ControllerView->getControllerDeviceType() == CommonDeviceState::VirtualController)
{
const int gamepadCount= DeviceManager::getInstance()->m_controller_manager->getGamepadCount();
if (gamepad_index >= -1 && gamepad_index < gamepadCount)
{
VirtualController *virtual_controller = ControllerView->castChecked<VirtualController>();
VirtualControllerConfig *config = virtual_controller->getConfigMutable();
config->gamepad_index = gamepad_index;
config->save();
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_controller_data_stream_tracker_index(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int controller_id = context.request->request_set_controller_data_stream_tracker_index().controller_id();
const int tracker_id = context.request->request_set_controller_data_stream_tracker_index().tracker_id();
if (ServerUtility::is_index_valid(controller_id, m_device_manager.getControllerViewMaxCount()) &&
ServerUtility::is_index_valid(tracker_id, m_device_manager.getTrackerViewMaxCount()))
{
ServerControllerViewPtr controller_view = m_device_manager.getControllerViewPtr(controller_id);
ControllerStreamInfo &streamInfo =
context.connection_state->active_controller_stream_info[controller_id];
if (controller_view->getIsStreamable())
{
SERVER_LOG_INFO("ServerRequestHandler") << "Set controller(" << controller_id << ") stream tracker id: " << tracker_id;
streamInfo.selected_tracker_index= tracker_id;
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
// -- tracker requests -----
inline void common_device_pose_to_protocol_pose(
const CommonDevicePose &pose,
PSMoveProtocol::Pose *result)
{
PSMoveProtocol::Orientation *orietation = result->mutable_orientation();
PSMoveProtocol::Position *position = result->mutable_position();
orietation->set_w(pose.Orientation.w);
orietation->set_x(pose.Orientation.x);
orietation->set_y(pose.Orientation.y);
orietation->set_z(pose.Orientation.z);
position->set_x(pose.PositionCm.x);
position->set_y(pose.PositionCm.y);
position->set_z(pose.PositionCm.z);
}
void handle_request__get_tracker_list(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
PSMoveProtocol::Response_ResultTrackerList* list = response->mutable_result_tracker_list();
response->set_type(PSMoveProtocol::Response_ResponseType_TRACKER_LIST);
for (int tracker_id = 0; tracker_id < m_device_manager.getTrackerViewMaxCount(); ++tracker_id)
{
ServerTrackerViewPtr tracker_view = m_device_manager.getTrackerViewPtr(tracker_id);
if (tracker_view->getIsOpen())
{
PSMoveProtocol::Response_ResultTrackerList_TrackerInfo *tracker_info = list->add_trackers();
switch (tracker_view->getTrackerDeviceType())
{
case CommonControllerState::PS3EYE:
tracker_info->set_tracker_type(PSMoveProtocol::PS3EYE);
break;
default:
assert(0 && "Unhandled tracker type");
}
switch (tracker_view->getTrackerDriverType())
{
case ITrackerInterface::Libusb:
tracker_info->set_tracker_driver(PSMoveProtocol::LIBUSB);
break;
case ITrackerInterface::CL:
tracker_info->set_tracker_driver(PSMoveProtocol::CL_EYE);
break;
case ITrackerInterface::CLMulti:
tracker_info->set_tracker_driver(PSMoveProtocol::CL_EYE_MULTICAM);
break;
// PSMoveProtocol::ISIGHT?
case ITrackerInterface::Generic_Webcam:
tracker_info->set_tracker_driver(PSMoveProtocol::GENERIC_WEBCAM);
break;
default:
assert(0 && "Unhandled tracker type");
}
tracker_info->set_tracker_id(tracker_id);
tracker_info->set_device_path(tracker_view->getUSBDevicePath());
tracker_info->set_shared_memory_name(tracker_view->getSharedMemoryStreamName());
// Get the intrinsic camera lens properties
{
float pixelWidth, pixelHeight;
float focalLengthX, focalLengthY, principalX, principalY;
float distortionK1, distortionK2, distortionK3;
float distortionP1, distortionP2;
tracker_view->getCameraIntrinsics(
focalLengthX, focalLengthY,
principalX, principalY,
distortionK1, distortionK2, distortionK3,
distortionP1, distortionP2);
tracker_view->getPixelDimensions(pixelWidth, pixelHeight);
tracker_info->mutable_tracker_focal_lengths()->set_x(focalLengthX);
tracker_info->mutable_tracker_focal_lengths()->set_y(focalLengthY);
tracker_info->mutable_tracker_principal_point()->set_x(principalX);
tracker_info->mutable_tracker_principal_point()->set_y(principalY);
tracker_info->mutable_tracker_screen_dimensions()->set_x(pixelWidth);
tracker_info->mutable_tracker_screen_dimensions()->set_y(pixelHeight);
tracker_info->set_tracker_k1(distortionK1);
tracker_info->set_tracker_k2(distortionK2);
tracker_info->set_tracker_k3(distortionK3);
tracker_info->set_tracker_p1(distortionP1);
tracker_info->set_tracker_p2(distortionP2);
}
// Get the tracker field of view properties
{
float hfov, vfov;
float zNear, zFar;
tracker_view->getFOV(hfov, vfov);
tracker_view->getZRange(zNear, zFar);
tracker_info->set_tracker_hfov(hfov);
tracker_info->set_tracker_vfov(vfov);
tracker_info->set_tracker_znear(zNear);
tracker_info->set_tracker_zfar(zFar);
}
// Get the tracker pose
{
CommonDevicePose pose= tracker_view->getTrackerPose();
common_device_pose_to_protocol_pose(pose, tracker_info->mutable_tracker_pose());
}
}
}
list->set_global_forward_degrees(m_device_manager.m_tracker_manager->getConfig().global_forward_degrees);
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
void handle_request__start_tracker_data_stream(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const PSMoveProtocol::Request_RequestStartTrackerDataStream& request =
context.request->request_start_tracker_data_stream();
int tracker_id = request.tracker_id();
if (ServerUtility::is_index_valid(tracker_id, m_device_manager.getTrackerViewMaxCount()))
{
ServerTrackerViewPtr tracker_view = m_device_manager.getTrackerViewPtr(tracker_id);
if (tracker_view->getIsOpen())
{
TrackerStreamInfo &streamInfo =
context.connection_state->active_tracker_stream_info[tracker_id];
// The tracker manager will always publish updates regardless of who is listening.
// All we have to do is keep track of which connections care about the updates.
context.connection_state->active_tracker_streams.set(tracker_id, true);
// Set control flags for the stream
streamInfo.streaming_video_data = true;
// Increment the number of stream listeners
tracker_view->startSharedMemoryVideoStream();
// Return the name of the shared memory block the video frames will be written to
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
// Device not opened
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__stop_tracker_data_stream(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
int tracker_id = context.request->request_stop_tracker_data_stream().tracker_id();
if (ServerUtility::is_index_valid(tracker_id, m_device_manager.getTrackerViewMaxCount()))
{
ServerTrackerViewPtr tracker_view = m_device_manager.getTrackerViewPtr(tracker_id);
if (tracker_view->getIsOpen())
{
context.connection_state->active_tracker_streams.set(tracker_id, false);
context.connection_state->active_tracker_stream_info[tracker_id].Clear();
// Restore any overridden camera settings from the config
if (context.connection_state->active_tracker_stream_info[tracker_id].has_temp_settings_override)
{
tracker_view->loadSettings();
}
// Decrement the number of stream listeners
tracker_view->stopSharedMemoryVideoStream();
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
// Device not opened
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__get_tracker_settings(const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int tracker_id = context.request->request_get_tracker_settings().tracker_id();
response->set_type(PSMoveProtocol::Response_ResponseType_TRACKER_SETTINGS);
if (ServerUtility::is_index_valid(tracker_id, m_device_manager.getTrackerViewMaxCount()))
{
ServerTrackerViewPtr tracker_view = m_device_manager.getTrackerViewPtr(tracker_id);
if (tracker_view->getIsOpen())
{
PSMoveProtocol::Response_ResultTrackerSettings* settings =
response->mutable_result_tracker_settings();
const int device_id = context.request->request_get_tracker_settings().device_id();
settings->set_frame_width(static_cast<float>(tracker_view->getFrameWidth()));
settings->set_frame_height(static_cast<float>(tracker_view->getFrameHeight()));
settings->set_frame_rate(static_cast<float>(tracker_view->getFrameRate()));
settings->set_exposure(static_cast<float>(tracker_view->getExposure()));
settings->set_gain(static_cast<float>(tracker_view->getGain()));
tracker_view->gatherTrackerOptions(settings);
switch (context.request->request_get_tracker_settings().device_category())
{
case PSMoveProtocol::Request_RequestGetTrackerSettings_DeviceCategory_CONTROLLER:
{
ServerControllerView *controller_view = get_controller_view_or_null(device_id);
tracker_view->gatherTrackingColorPresets(controller_view, settings);
} break;
case PSMoveProtocol::Request_RequestGetTrackerSettings_DeviceCategory_HMD:
{
ServerHMDView *hmd_view = get_hmd_view_or_null(device_id);
tracker_view->gatherTrackingColorPresets(hmd_view, settings);
} break;
}
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_tracker_frame_width(const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int tracker_id = context.request->request_set_tracker_frame_width().tracker_id();
response->set_type(PSMoveProtocol::Response_ResponseType_TRACKER_FRAME_WIDTH_UPDATED);
if (ServerUtility::is_index_valid(tracker_id, m_device_manager.getTrackerViewMaxCount()))
{
ServerTrackerViewPtr tracker_view = m_device_manager.getTrackerViewPtr(tracker_id);
if (tracker_view->getIsOpen())
{
const bool bSaveSetting = context.request->request_set_tracker_frame_width().save_setting();
const float desired_frame_width = context.request->request_set_tracker_frame_width().value();
PSMoveProtocol::Response_ResultSetTrackerFrameWidth* result_frame_width =
response->mutable_result_set_tracker_frame_width();
// Set the desired frame width on the tracker
tracker_view->setFrameWidth(desired_frame_width, bSaveSetting);
// Only save the setting if requested
if (bSaveSetting)
{
tracker_view->saveSettings();
}
else
{
context.connection_state->active_tracker_stream_info[tracker_id].has_temp_settings_override = true;
}
// Return back the actual frame width that got set
result_frame_width->set_new_frame_width(static_cast<float>(tracker_view->getFrameWidth()));
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_tracker_frame_height(const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int tracker_id = context.request->request_set_tracker_frame_height().tracker_id();
response->set_type(PSMoveProtocol::Response_ResponseType_TRACKER_FRAME_HEIGHT_UPDATED);
if (ServerUtility::is_index_valid(tracker_id, m_device_manager.getTrackerViewMaxCount()))
{
ServerTrackerViewPtr tracker_view = m_device_manager.getTrackerViewPtr(tracker_id);
if (tracker_view->getIsOpen())
{
const bool bSaveSetting = context.request->request_set_tracker_frame_height().save_setting();
const float desired_frame_height = context.request->request_set_tracker_frame_height().value();
PSMoveProtocol::Response_ResultSetTrackerFrameHeight* result_frame_height =
response->mutable_result_set_tracker_frame_height();
// Set the desired frame height on the tracker
tracker_view->setFrameHeight(desired_frame_height, bSaveSetting);
// Only save the setting if requested
if (bSaveSetting)
{
tracker_view->saveSettings();
}
else
{
context.connection_state->active_tracker_stream_info[tracker_id].has_temp_settings_override = true;
}
// Return back the actual frame height that got set
result_frame_height->set_new_frame_height(static_cast<float>(tracker_view->getFrameHeight()));
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_tracker_frame_rate(const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int tracker_id = context.request->request_set_tracker_frame_rate().tracker_id();
response->set_type(PSMoveProtocol::Response_ResponseType_TRACKER_FRAME_RATE_UPDATED);
if (ServerUtility::is_index_valid(tracker_id, m_device_manager.getTrackerViewMaxCount()))
{
ServerTrackerViewPtr tracker_view = m_device_manager.getTrackerViewPtr(tracker_id);
if (tracker_view->getIsOpen())
{
const bool bSaveSetting = context.request->request_set_tracker_frame_rate().save_setting();
const float desired_frame_rate = context.request->request_set_tracker_frame_rate().value();
PSMoveProtocol::Response_ResultSetTrackerFrameRate* result_frame_rate =
response->mutable_result_set_tracker_frame_rate();
// Set the desired frame rate on the tracker
tracker_view->setFrameRate(desired_frame_rate, bSaveSetting);
// Only save the setting if requested
if (bSaveSetting)
{
tracker_view->saveSettings();
}
else
{
context.connection_state->active_tracker_stream_info[tracker_id].has_temp_settings_override = true;
}
// Return back the actual frame rate that got set
result_frame_rate->set_new_frame_rate(static_cast<float>(tracker_view->getFrameRate()));
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_tracker_exposure(const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int tracker_id = context.request->request_set_tracker_exposure().tracker_id();
response->set_type(PSMoveProtocol::Response_ResponseType_TRACKER_EXPOSURE_UPDATED);
if (ServerUtility::is_index_valid(tracker_id, m_device_manager.getTrackerViewMaxCount()))
{
ServerTrackerViewPtr tracker_view = m_device_manager.getTrackerViewPtr(tracker_id);
if (tracker_view->getIsOpen())
{
const bool bSaveSetting= context.request->request_set_tracker_exposure().save_setting();
const float desired_exposure = context.request->request_set_tracker_exposure().value();
PSMoveProtocol::Response_ResultSetTrackerExposure* result_exposure =
response->mutable_result_set_tracker_exposure();
// Set the desired exposure on the tracker
tracker_view->setExposure(desired_exposure, bSaveSetting);
// Only save the setting if requested
if (bSaveSetting)
{
tracker_view->saveSettings();
}
else
{
context.connection_state->active_tracker_stream_info[tracker_id].has_temp_settings_override = true;
}
// Return back the actual exposure that got set
result_exposure->set_new_exposure(static_cast<float>(tracker_view->getExposure()));
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_tracker_gain(const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int tracker_id = context.request->request_set_tracker_gain().tracker_id();
response->set_type(PSMoveProtocol::Response_ResponseType_TRACKER_GAIN_UPDATED);
if (ServerUtility::is_index_valid(tracker_id, m_device_manager.getTrackerViewMaxCount()))
{
ServerTrackerViewPtr tracker_view = m_device_manager.getTrackerViewPtr(tracker_id);
if (tracker_view->getIsOpen())
{
const bool bSaveSetting = context.request->request_set_tracker_gain().save_setting();
const double desired_gain = context.request->request_set_tracker_gain().value();
PSMoveProtocol::Response_ResultSetTrackerGain* result_gain =
response->mutable_result_set_tracker_gain();
// Set the desired gain on the tracker
tracker_view->setGain(desired_gain, bSaveSetting);
// Only save the setting if requested
if (bSaveSetting)
{
tracker_view->saveSettings();
}
else
{
context.connection_state->active_tracker_stream_info[tracker_id].has_temp_settings_override = true;
}
// Return back the actual gain that got set
result_gain->set_new_gain(static_cast<float>(tracker_view->getGain()));
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_tracker_option(const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int tracker_id = context.request->request_set_tracker_gain().tracker_id();
response->set_type(PSMoveProtocol::Response_ResponseType_TRACKER_OPTION_UPDATED);
if (ServerUtility::is_index_valid(tracker_id, m_device_manager.getTrackerViewMaxCount()))
{
ServerTrackerViewPtr tracker_view = m_device_manager.getTrackerViewPtr(tracker_id);
if (tracker_view->getIsOpen())
{
const std::string &option_name = context.request->request_set_tracker_option().option_name();
const int desired_option_index = context.request->request_set_tracker_option().option_index();
PSMoveProtocol::Response_ResultSetTrackerOption* result_gain =
response->mutable_result_set_tracker_option();
// Set the desired gain on the tracker
if (tracker_view->setOptionIndex(option_name, desired_option_index))
{
// Return back the actual option index that got set
int result_option_index;
tracker_view->getOptionIndex(option_name, result_option_index);
result_gain->set_option_name(option_name);
result_gain->set_new_option_index(result_option_index);
tracker_view->saveSettings();
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_tracker_color_preset(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int tracker_id = context.request->request_set_tracker_color_preset().tracker_id();
response->set_type(PSMoveProtocol::Response_ResponseType_TRACKER_PRESET_UPDATED);
if (ServerUtility::is_index_valid(tracker_id, m_device_manager.getTrackerViewMaxCount()))
{
ServerTrackerViewPtr tracker_view = m_device_manager.getTrackerViewPtr(tracker_id);
if (tracker_view->getIsOpen())
{
const auto device_category= context.request->request_set_tracker_color_preset().device_category();
const int device_id= context.request->request_set_tracker_color_preset().device_id();
const PSMoveProtocol::TrackingColorPreset &colorPreset =
context.request->request_set_tracker_color_preset().color_preset();
const eCommonTrackingColorID colorType=
static_cast<eCommonTrackingColorID>(colorPreset.color_type());
// Set the color preset on the tracker
CommonHSVColorRange inHSVColorRange;
CommonHSVColorRange outHSVColorRange;
{
inHSVColorRange.hue_range.center= colorPreset.hue_center();
inHSVColorRange.hue_range.range = colorPreset.hue_range();
inHSVColorRange.saturation_range.center = colorPreset.saturation_center();
inHSVColorRange.saturation_range.range = colorPreset.saturation_range();
inHSVColorRange.value_range.center = colorPreset.value_center();
inHSVColorRange.value_range.range = colorPreset.value_range();
switch (device_category)
{
case PSMoveProtocol::Request_RequestSetTrackerColorPreset_DeviceCategory_CONTROLLER:
{
ServerControllerView *controller_view = get_controller_view_or_null(device_id);
// Assign the color range
tracker_view->setControllerTrackingColorPreset(controller_view, colorType, &inHSVColorRange);
// Read back what actually got set
tracker_view->getControllerTrackingColorPreset(controller_view, colorType, &outHSVColorRange);
} break;
case PSMoveProtocol::Request_RequestSetTrackerColorPreset_DeviceCategory_HMD:
{
ServerHMDView *hmd_view = get_hmd_view_or_null(device_id);
// Assign the color range
tracker_view->setHMDTrackingColorPreset(hmd_view, colorType, &inHSVColorRange);
// Read back what actually got set
tracker_view->getHMDTrackingColorPreset(hmd_view, colorType, &outHSVColorRange);
} break;
}
// tracker_view->saveSettings(); // Carried over from old generic_camera
}
// Get the resulting preset from the tracker
{
PSMoveProtocol::Response_ResultSetTrackerColorPreset *result =
response->mutable_result_set_tracker_color_preset();
result->set_tracker_id(tracker_id);
PSMoveProtocol::TrackingColorPreset *presetResult = result->mutable_new_color_preset();
presetResult->set_color_type(colorPreset.color_type());
presetResult->set_hue_center(outHSVColorRange.hue_range.center);
presetResult->set_hue_range(outHSVColorRange.hue_range.range);
presetResult->set_saturation_center(outHSVColorRange.saturation_range.center);
presetResult->set_saturation_range(outHSVColorRange.saturation_range.range);
presetResult->set_value_center(outHSVColorRange.value_range.center);
presetResult->set_value_range(outHSVColorRange.value_range.range);
}
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
inline CommonDevicePose protocol_pose_to_common_device_pose(const PSMoveProtocol::Pose &pose)
{
CommonDevicePose result;
result.Orientation.w = pose.orientation().w();
result.Orientation.x = pose.orientation().x();
result.Orientation.y = pose.orientation().y();
result.Orientation.z = pose.orientation().z();
result.PositionCm.x = pose.position().x();
result.PositionCm.y = pose.position().y();
result.PositionCm.z = pose.position().z();
return result;
}
void handle_request__set_tracker_pose(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int tracker_id = context.request->request_set_tracker_pose().tracker_id();
if (ServerUtility::is_index_valid(tracker_id, m_device_manager.getTrackerViewMaxCount()))
{
ServerTrackerViewPtr tracker_view = m_device_manager.getTrackerViewPtr(tracker_id);
if (tracker_view->getIsOpen())
{
const PSMoveProtocol::Pose &srcPose =
context.request->request_set_tracker_pose().pose();
CommonDevicePose destPose = protocol_pose_to_common_device_pose(srcPose);
tracker_view->setTrackerPose(&destPose);
tracker_view->saveSettings();
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_tracker_intrinsics(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int tracker_id = context.request->request_set_tracker_intrinsics().tracker_id();
if (ServerUtility::is_index_valid(tracker_id, m_device_manager.getTrackerViewMaxCount()))
{
ServerTrackerViewPtr tracker_view = m_device_manager.getTrackerViewPtr(tracker_id);
if (tracker_view->getIsOpen())
{
const auto &intrinsics= context.request->request_set_tracker_intrinsics();
tracker_view->setCameraIntrinsics(
intrinsics.tracker_focal_lengths().x(), intrinsics.tracker_focal_lengths().y(),
intrinsics.tracker_principal_point().x(), intrinsics.tracker_principal_point().y(),
intrinsics.tracker_k1(), intrinsics.tracker_k2(), intrinsics.tracker_k3(),
intrinsics.tracker_p1(), intrinsics.tracker_p2());
tracker_view->saveSettings();
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__save_tracker_profile(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int tracker_id = context.request->request_save_tracker_profile().tracker_id();
if (ServerUtility::is_index_valid(tracker_id, m_device_manager.getTrackerViewMaxCount()))
{
ServerTrackerViewPtr tracker_view = m_device_manager.getTrackerViewPtr(tracker_id);
if (tracker_view->getIsOpen())
{
const int controller_id= context.request->request_save_tracker_profile().controller_id();
ServerControllerView *controller_view= get_controller_view_or_null(controller_id);
TrackerProfile trackerProfile;
trackerProfile.clear();
trackerProfile.frame_width = static_cast<float>(tracker_view->getFrameWidth());
//trackerProfile.frame_height = static_cast<float>(tracker_view->getFrameHeight());
trackerProfile.frame_rate = static_cast<float>(tracker_view->getFrameRate());
trackerProfile.exposure= static_cast<float>(tracker_view->getExposure());
trackerProfile.gain = static_cast<float>(tracker_view->getGain());
for (int preset_index = 0; preset_index < eCommonTrackingColorID::MAX_TRACKING_COLOR_TYPES; ++preset_index)
{
tracker_view->getControllerTrackingColorPreset(
controller_view,
static_cast<eCommonTrackingColorID>(preset_index),
&trackerProfile.color_preset_table.color_presets[preset_index]);
}
m_device_manager.m_tracker_manager->saveDefaultTrackerProfile(&trackerProfile);
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__apply_tracker_profile(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int tracker_id = context.request->request_apply_tracker_profile().tracker_id();
response->set_type(PSMoveProtocol::Response_ResponseType_TRACKER_SETTINGS);
if (ServerUtility::is_index_valid(tracker_id, m_device_manager.getTrackerViewMaxCount()))
{
ServerTrackerViewPtr tracker_view = m_device_manager.getTrackerViewPtr(tracker_id);
if (tracker_view->getIsOpen())
{
const int controller_id= context.request->request_apply_tracker_profile().controller_id();
ServerControllerView *controller_view= get_controller_view_or_null(controller_id);
const TrackerProfile *trackerProfile =
m_device_manager.m_tracker_manager->getDefaultTrackerProfile();
// Apply the profile to the tracker
tracker_view->setFrameWidth(trackerProfile->frame_width, true);
//tracker_view->setFrameHeight(trackerProfile->frame_height, true);
tracker_view->setFrameRate(trackerProfile->frame_rate, true);
tracker_view->setExposure(trackerProfile->exposure, true);
tracker_view->setGain(trackerProfile->gain, true);
for (int preset_index = 0; preset_index < eCommonTrackingColorID::MAX_TRACKING_COLOR_TYPES; ++preset_index)
{
const CommonHSVColorRange *preset= &trackerProfile->color_preset_table.color_presets[preset_index];
const eCommonTrackingColorID color_type = static_cast<eCommonTrackingColorID>(preset_index);
tracker_view->setControllerTrackingColorPreset(controller_view, color_type, preset);
}
// Send the profile application result to the client
{
PSMoveProtocol::Response_ResultTrackerSettings* settings =
response->mutable_result_tracker_settings();
settings->set_frame_width(static_cast<float>(tracker_view->getFrameWidth()));
settings->set_frame_height(static_cast<float>(tracker_view->getFrameHeight()));
settings->set_frame_rate(static_cast<float>(tracker_view->getFrameRate()));
settings->set_exposure(static_cast<float>(tracker_view->getExposure()));
settings->set_gain(static_cast<float>(tracker_view->getGain()));
tracker_view->gatherTrackerOptions(settings);
tracker_view->gatherTrackingColorPresets(controller_view, settings);
}
tracker_view->saveSettings();
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__reload_tracker_settings(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int tracker_id = context.request->request_apply_tracker_profile().tracker_id();
response->set_type(PSMoveProtocol::Response_ResponseType_GENERAL_RESULT);
if (ServerUtility::is_index_valid(tracker_id, m_device_manager.getTrackerViewMaxCount()))
{
ServerTrackerViewPtr tracker_view = m_device_manager.getTrackerViewPtr(tracker_id);
if (tracker_view->getIsOpen())
{
tracker_view->loadSettings();
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__search_for_new_trackers(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
// The video polling threads tend to stall out when we are polling for new devices via libusb.
// Until we have a better solution, best to just shut down all of the trackers
// and then wait for them to restart next tracker device refresh.
m_device_manager.m_tracker_manager->closeAllTrackers();
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
void handle_request__get_tracking_space_settings(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
PSMoveProtocol::Response_ResultTrackingSpaceSettings* settings = response->mutable_result_tracking_space_settings();
response->set_type(PSMoveProtocol::Response_ResponseType_TRACKING_SPACE_SETTINGS);
settings->set_global_forward_degrees(m_device_manager.m_tracker_manager->getConfig().global_forward_degrees);
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
// -- hmd requests -----
inline ServerHMDView *get_hmd_view_or_null(int hmd_id)
{
ServerHMDView *hmd_view = nullptr;
if (ServerUtility::is_index_valid(hmd_id, m_device_manager.getHMDViewMaxCount()))
{
ServerHMDViewPtr hmd_view_ptr = m_device_manager.getHMDViewPtr(hmd_id);
if (hmd_view_ptr->getIsOpen())
{
hmd_view = hmd_view_ptr.get();
}
}
return hmd_view;
}
void handle_request__get_hmd_list(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
PSMoveProtocol::Response_ResultHMDList* list = response->mutable_result_hmd_list();
response->set_type(PSMoveProtocol::Response_ResponseType_HMD_LIST);
for (int hmd_id = 0; hmd_id < m_device_manager.getHMDViewMaxCount(); ++hmd_id)
{
ServerHMDViewPtr hmd_view = m_device_manager.getHMDViewPtr(hmd_id);
if (hmd_view->getIsOpen())
{
PSMoveProtocol::Response_ResultHMDList_HMDInfo *hmd_info = list->add_hmd_entries();
switch (hmd_view->getHMDDeviceType())
{
case CommonHMDState::Morpheus:
{
const MorpheusHMD *morpheusHMD= hmd_view->castCheckedConst<MorpheusHMD>();
const MorpheusHMDConfig *config= morpheusHMD->getConfig();
hmd_info->set_hmd_type(PSMoveProtocol::Morpheus);
hmd_info->set_prediction_time(config->prediction_time);
hmd_info->set_orientation_filter(config->orientation_filter_type);
hmd_info->set_position_filter(config->position_filter_type);
}
break;
case CommonHMDState::VirtualHMD:
{
const VirtualHMD *virtualHMD= hmd_view->castCheckedConst<VirtualHMD>();
const VirtualHMDConfig *config= virtualHMD->getConfig();
hmd_info->set_hmd_type(PSMoveProtocol::VirtualHMD);
hmd_info->set_prediction_time(config->prediction_time);
hmd_info->set_position_filter(config->position_filter_type);
}
break;
default:
assert(0 && "Unhandled tracker type");
}
hmd_info->set_hmd_id(hmd_id);
hmd_info->set_device_path(hmd_view->getUSBDevicePath());
hmd_info->set_tracking_color_type(static_cast<PSMoveProtocol::TrackingColorType>(hmd_view->getTrackingColorID()));
}
}
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
void handle_request__start_hmd_data_stream(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const PSMoveProtocol::Request_RequestStartHmdDataStream& request =
context.request->request_start_hmd_data_stream();
int hmd_id = request.hmd_id();
if (ServerUtility::is_index_valid(hmd_id, m_device_manager.getHMDViewMaxCount()))
{
ServerHMDViewPtr hmd_view = m_device_manager.getHMDViewPtr(hmd_id);
if (hmd_view->getIsOpen())
{
HMDStreamInfo &streamInfo =
context.connection_state->active_hmd_stream_info[hmd_id];
// The hmd manager will always publish updates regardless of who is listening.
// All we have to do is keep track of which connections care about the updates.
context.connection_state->active_hmd_streams.set(hmd_id, true);
// Set control flags for the stream
streamInfo.Clear();
streamInfo.include_position_data = request.include_position_data();
streamInfo.include_physics_data = request.include_physics_data();
streamInfo.include_raw_sensor_data = request.include_raw_sensor_data();
streamInfo.include_calibrated_sensor_data = request.include_calibrated_sensor_data();
streamInfo.include_raw_tracker_data = request.include_raw_tracker_data();
streamInfo.disable_roi = request.disable_roi();
SERVER_LOG_INFO("ServerRequestHandler") << "Start hmd(" << hmd_id << ") stream ("
<< "pos=" << streamInfo.include_position_data
<< ",phys=" << streamInfo.include_physics_data
<< ",raw_sens=" << streamInfo.include_raw_sensor_data
<< ",cal_sens=" << streamInfo.include_calibrated_sensor_data
<< ",trkr=" << streamInfo.include_raw_tracker_data
<< ",roi=" << streamInfo.disable_roi
<< ")";
if (streamInfo.disable_roi)
{
ServerHMDViewPtr hmd_view = m_device_manager.getHMDViewPtr(hmd_id);
hmd_view->pushDisableROI();
}
if (streamInfo.include_position_data)
{
ServerHMDViewPtr hmd_view = m_device_manager.getHMDViewPtr(hmd_id);
hmd_view->startTracking();
}
// Return the name of the shared memory block the video frames will be written to
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
// Device not opened
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__stop_hmd_data_stream(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
int hmd_id = context.request->request_stop_hmd_data_stream().hmd_id();
if (ServerUtility::is_index_valid(hmd_id, m_device_manager.getHMDViewMaxCount()))
{
ServerHMDViewPtr hmd_view = m_device_manager.getHMDViewPtr(hmd_id);
if (hmd_view->getIsOpen())
{
const HMDStreamInfo &streamInfo = context.connection_state->active_hmd_stream_info[hmd_id];
if (streamInfo.disable_roi)
{
hmd_view->popDisableROI();
}
if (streamInfo.include_position_data)
{
hmd_view->stopTracking();
}
context.connection_state->active_hmd_streams.set(hmd_id, false);
context.connection_state->active_hmd_stream_info[hmd_id].Clear();
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
// Device not opened
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_hmd_led_tracking_color(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int connection_id = context.connection_state->connection_id;
const int hmd_id = context.request->set_hmd_led_tracking_color_request().hmd_id();
const eCommonTrackingColorID newColorID=
static_cast<eCommonTrackingColorID>(context.request->set_hmd_led_tracking_color_request().color_type());
ServerHMDViewPtr HmdView = m_device_manager.getHMDViewPtr(hmd_id);
if (HmdView &&
HmdView->getHMDDeviceType() == CommonDeviceState::VirtualHMD)
{
const eCommonTrackingColorID oldColorID = HmdView->getTrackingColorID();
if (newColorID != oldColorID)
{
// Give up control of our existing tracking color
if (oldColorID != eCommonTrackingColorID::INVALID_COLOR)
{
m_device_manager.m_tracker_manager->freeTrackingColorID(oldColorID);
}
// Take the color from any other controller that might have it
if (m_device_manager.m_tracker_manager->claimTrackingColorID(HmdView.get(), newColorID))
{
// Assign the new color to ourselves
HmdView->setTrackingColorID(newColorID);
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
if (oldColorID != eCommonTrackingColorID::INVALID_COLOR)
{
m_device_manager.m_tracker_manager->claimTrackingColorID(HmdView.get(), oldColorID);
}
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_hmd_accelerometer_calibration(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int hmd_id = context.request->set_hmd_accelerometer_calibration_request().hmd_id();
ServerHMDViewPtr HMDView = m_device_manager.getHMDViewPtr(hmd_id);
if (HMDView && HMDView->getHMDDeviceType() == CommonDeviceState::Morpheus)
{
MorpheusHMD *hmd = HMDView->castChecked<MorpheusHMD>();
IPoseFilter *poseFilter = HMDView->getPoseFilterMutable();
MorpheusHMDConfig *config = hmd->getConfigMutable();
const auto &request = context.request->set_hmd_accelerometer_calibration_request();
// Compute the bias as 1g subtracted from the measured direction of gravity
CommonDeviceVector measured_g;
set_config_vector(request.raw_average_gravity(), measured_g);
float length = sqrtf(measured_g.i*measured_g.i + measured_g.j*measured_g.j + measured_g.k*measured_g.k);
if (length > k_real_epsilon)
{
config->raw_accelerometer_bias.i = measured_g.i * (1.f - 1.f / (length*config->accelerometer_gain.i));
config->raw_accelerometer_bias.j = measured_g.j * (1.f - 1.f / (length*config->accelerometer_gain.j));
config->raw_accelerometer_bias.k = measured_g.k * (1.f - 1.f / (length*config->accelerometer_gain.k));
}
config->raw_accelerometer_variance = request.raw_variance();
config->save();
// Reset the orientation filter state the calibration changed
poseFilter->resetState();
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_hmd_gyroscope_calibration(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int hmd_id = context.request->set_hmd_accelerometer_calibration_request().hmd_id();
ServerHMDViewPtr HMDView = m_device_manager.getHMDViewPtr(hmd_id);
if (HMDView && HMDView->getHMDDeviceType() == CommonDeviceState::Morpheus)
{
MorpheusHMD *hmd = HMDView->castChecked<MorpheusHMD>();
MorpheusHMDConfig *config = hmd->getConfigMutable();
const auto &request = context.request->set_hmd_gyroscope_calibration_request();
set_config_vector(request.raw_bias(), config->raw_gyro_bias);
config->raw_gyro_variance = request.raw_variance();
config->raw_gyro_drift = request.raw_drift();
config->save();
// Reset the orientation filter state the calibration changed
HMDView->getPoseFilterMutable()->resetState();
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_hmd_orientation_filter(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int hmd_id = context.request->request_set_hmd_orientation_filter().hmd_id();
ServerHMDViewPtr HmdView = m_device_manager.getHMDViewPtr(hmd_id);
const PSMoveProtocol::Request_RequestSetHMDOrientationFilter &request =
context.request->request_set_hmd_orientation_filter();
if (HmdView && HmdView->getIsOpen())
{
if (HmdView->getHMDDeviceType() == CommonDeviceState::Morpheus)
{
MorpheusHMD *hmd = HmdView->castChecked<MorpheusHMD>();
MorpheusHMDConfig *config = hmd->getConfigMutable();
if (config->orientation_filter_type != request.orientation_filter())
{
config->orientation_filter_type = request.orientation_filter();
config->save();
HmdView->resetPoseFilter();
}
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_hmd_position_filter(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int hmd_id = context.request->request_set_hmd_position_filter().hmd_id();
ServerHMDViewPtr HmdView = m_device_manager.getHMDViewPtr(hmd_id);
const PSMoveProtocol::Request_RequestSetHMDPositionFilter &request =
context.request->request_set_hmd_position_filter();
if (HmdView && HmdView->getIsOpen())
{
if (HmdView->getHMDDeviceType() == CommonDeviceState::Morpheus)
{
MorpheusHMD *hmd = HmdView->castChecked<MorpheusHMD>();
MorpheusHMDConfig *config = hmd->getConfigMutable();
if (config->position_filter_type != request.position_filter())
{
config->position_filter_type = request.position_filter();
config->save();
HmdView->resetPoseFilter();
}
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else if (HmdView->getHMDDeviceType() == CommonDeviceState::VirtualHMD)
{
VirtualHMD *hmd = HmdView->castChecked<VirtualHMD>();
VirtualHMDConfig *config = hmd->getConfigMutable();
if (config->position_filter_type != request.position_filter())
{
config->position_filter_type = request.position_filter();
config->save();
HmdView->resetPoseFilter();
}
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_hmd_prediction_time(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int hmd_id = context.request->request_set_hmd_prediction_time().hmd_id();
ServerHMDViewPtr HmdView = m_device_manager.getHMDViewPtr(hmd_id);
const PSMoveProtocol::Request_RequestSetHMDPredictionTime &request =
context.request->request_set_hmd_prediction_time();
if (HmdView && HmdView->getIsOpen())
{
if (HmdView->getHMDDeviceType() == CommonDeviceState::Morpheus)
{
MorpheusHMD *hmd = HmdView->castChecked<MorpheusHMD>();
MorpheusHMDConfig *config = hmd->getConfigMutable();
if (config->prediction_time != request.prediction_time())
{
config->prediction_time = request.prediction_time();
config->save();
}
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else if (HmdView->getHMDDeviceType() == CommonDeviceState::VirtualHMD)
{
VirtualHMD *hmd = HmdView->castChecked<VirtualHMD>();
VirtualHMDConfig *config = hmd->getConfigMutable();
if (config->prediction_time != request.prediction_time())
{
config->prediction_time = request.prediction_time();
config->save();
}
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__set_hmd_data_stream_tracker_index(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
const int hmd_id = context.request->request_set_hmd_data_stream_tracker_index().hmd_id();
const int tracker_id = context.request->request_set_hmd_data_stream_tracker_index().tracker_id();
if (ServerUtility::is_index_valid(hmd_id, m_device_manager.getHMDViewMaxCount()) &&
ServerUtility::is_index_valid(tracker_id, m_device_manager.getTrackerViewMaxCount()))
{
ServerHMDViewPtr hmd_view = m_device_manager.getHMDViewPtr(hmd_id);
HMDStreamInfo &streamInfo =
context.connection_state->active_hmd_stream_info[hmd_id];
SERVER_LOG_INFO("ServerRequestHandler") << "Set hmd(" << hmd_id << ") stream tracker id: " << tracker_id;
streamInfo.selected_tracker_index= tracker_id;
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
else
{
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_ERROR);
}
}
void handle_request__get_service_version(
const RequestContext &context,
PSMoveProtocol::Response *response)
{
PSMoveProtocol::Response_ResultServiceVersion* version_info = response->mutable_result_service_version();
response->set_type(PSMoveProtocol::Response_ResponseType_SERVICE_VERSION);
// Return the protocol version
version_info->set_version(PSM_PROTOCOL_VERSION_STRING);
response->set_result_code(PSMoveProtocol::Response_ResultCode_RESULT_OK);
}
// -- Data Frame Updates -----
void handle_data_frame__controller_packet(
RequestConnectionStatePtr connection_state,
DeviceInputDataFramePtr data_frame)
{
const auto &controllerDataPacket = data_frame->controller_data_packet();
const int controller_id = controllerDataPacket.controller_id();
if (ServerUtility::is_index_valid(controller_id, m_device_manager.getControllerViewMaxCount()))
{
ServerControllerViewPtr controller_view = m_device_manager.getControllerViewPtr(controller_id);
ControllerStreamInfo &streamInfo = connection_state->active_controller_stream_info[controller_id];
// Don't consider this data frame if the controller isn't in a streamable connection
// or if the sequence number is old
if (controller_view->getIsStreamable() &&
controllerDataPacket.sequence_num() > streamInfo.last_data_input_sequence_number)
{
// Remember the last sequence number we received from this connection
streamInfo.last_data_input_sequence_number = controllerDataPacket.sequence_num();
switch (controller_view->getControllerDeviceType())
{
case CommonDeviceState::eDeviceType::PSMove:
{
const auto &psmove_state= controllerDataPacket.psmove_state();
// Update the rumble
const float rumbleValue= static_cast<float>(psmove_state.rumble_value()) / 255.f;
controller_view->setControllerRumble(rumbleValue, CommonControllerState::ChannelAll);
// Update the override led color
{
unsigned char r = static_cast<unsigned char>(psmove_state.led_r());
unsigned char g = static_cast<unsigned char>(psmove_state.led_g());
unsigned char b = static_cast<unsigned char>(psmove_state.led_b());
// (0,0,0) is treated as clearing the override
if (r == 0 && g == 0 && b == 0)
{
if (controller_view->getIsLEDOverrideActive())
{
// Removes the over led color and restores the tracking color
// of the controller is currently being tracked
controller_view->clearLEDOverride();
}
}
// Otherwise we are setting the override to a new color
else
{
// Sets the bulb LED color to some new override color
// If tracking was active this likely will affect controller tracking
controller_view->setLEDOverride(r, g, b);
}
// Flag if the LED override is active
// If the stream closes and this flag is active we'll need to clear the led override
streamInfo.led_override_active= controller_view->getIsLEDOverrideActive();
}
} break;
case CommonDeviceState::eDeviceType::PSNavi:
{
// Nothing to update...
} break;
case CommonDeviceState::eDeviceType::PSDualShock4:
{
const auto &psmove_state= controllerDataPacket.psdualshock4_state();
// Update the rumble
const float bigRumbleValue= static_cast<float>(psmove_state.big_rumble_value()) / 255.f;
const float smallRumbleValue= static_cast<float>(psmove_state.small_rumble_value()) / 255.f;
controller_view->setControllerRumble(bigRumbleValue, CommonControllerState::ChannelLeft);
controller_view->setControllerRumble(smallRumbleValue, CommonControllerState::ChannelRight);
// Update the override led color
{
unsigned char r = static_cast<unsigned char>(psmove_state.led_r());
unsigned char g = static_cast<unsigned char>(psmove_state.led_g());
unsigned char b = static_cast<unsigned char>(psmove_state.led_b());
// (0,0,0) is treated as clearing the override
if (r == 0 && g == 0 && b == 0)
{
if (controller_view->getIsLEDOverrideActive())
{
// Removes the over led color and restores the tracking color
// of the controller is currently being tracked
controller_view->clearLEDOverride();
}
}
// Otherwise we are setting the override to a new color
else
{
// Sets the bulb LED color to some new override color
// If tracking was active this likely will affect controller tracking
controller_view->setLEDOverride(r, g, b);
}
// Flag if the LED override is active
// If the stream closes and this flag is active we'll need to clear the led override
streamInfo.led_override_active= controller_view->getIsLEDOverrideActive();
}
} break;
}
}
}
}
private:
DeviceManager &m_device_manager;
t_connection_state_map m_connection_state_map;
};
//-- public interface -----
ServerRequestHandler *ServerRequestHandler::m_instance = NULL;
ServerRequestHandler::ServerRequestHandler(DeviceManager *deviceManager)
: m_implementation_ptr(new ServerRequestHandlerImpl(*deviceManager))
{
}
ServerRequestHandler::~ServerRequestHandler()
{
if (m_instance != NULL)
{
SERVER_LOG_ERROR("~ServerRequestHandler") << "Request handler deleted without calling shutdown first!";
}
delete m_implementation_ptr;
}
bool ServerRequestHandler::any_active_bluetooth_requests() const
{
return m_implementation_ptr->any_active_bluetooth_requests();
}
bool ServerRequestHandler::startup()
{
m_instance= this;
return true;
}
void ServerRequestHandler::update()
{
return m_implementation_ptr->update();
}
void ServerRequestHandler::shutdown()
{
m_instance= NULL;
}
ResponsePtr ServerRequestHandler::handle_request(int connection_id, RequestPtr request)
{
return m_implementation_ptr->handle_request(connection_id, request);
}
void ServerRequestHandler::handle_input_data_frame(DeviceInputDataFramePtr data_frame)
{
return m_implementation_ptr->handle_input_data_frame(data_frame);
}
void ServerRequestHandler::handle_client_connection_stopped(int connection_id)
{
return m_implementation_ptr->handle_client_connection_stopped(connection_id);
}
void ServerRequestHandler::publish_controller_data_frame(
ServerControllerView *controller_view,
t_generate_controller_data_frame_for_stream callback)
{
return m_implementation_ptr->publish_controller_data_frame(controller_view, callback);
}
void ServerRequestHandler::publish_tracker_data_frame(
class ServerTrackerView *tracker_view,
t_generate_tracker_data_frame_for_stream callback)
{
return m_implementation_ptr->publish_tracker_data_frame(tracker_view, callback);
}
void ServerRequestHandler::publish_hmd_data_frame(
class ServerHMDView *hmd_view,
t_generate_hmd_data_frame_for_stream callback)
{
return m_implementation_ptr->publish_hmd_data_frame(hmd_view, callback);
}
|
2a770a628cf58a7b6e172d5caf025cd8415484d8 | 96bf8b7dae0ee05731227f259cab94ea6e941e36 | /FactoryMetod/AutomatBullet.h | 5fd3038e48aa7bcdd9b7559f2dbbbb4d9ce2cfed | [] | no_license | PHILOSOF/Patterns | d5d116100e72b164310845148a06d8eecac86a7e | ce72bd543a55a55dd55f0416e03dc5044f39b1d7 | refs/heads/master | 2021-01-22T18:32:55.356636 | 2017-03-22T17:53:04 | 2017-03-22T17:53:04 | 85,088,831 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 283 | h | AutomatBullet.h | #ifndef AUTOMATBULLET_H
#define AUTOMATBULLET_H
#include"AbstractBullet.h"
class AutomatBullet : public AbstractBullet
{
public:
AutomatBullet();
void setLocation(const Point3D&) ;
Point3D getLocation() ;
void setDirection(const Vector3D&) ;
Vector3D getdirection();
};
#endif |
8f786bf57c0849c01452768099e1e6b0b5bd2d90 | 51bdd8c3b70cc8a1315f30c305f585d94c3b265c | /r2016/src/Commands/IntakeBallCommandGroup.h | 1d7621d3edc5bd5cb02068ed01a19316ac72d12c | [] | no_license | GlebSoftware/frc-2016 | cedda87f9c1f73aecdf2b70b5266c5de26c3015d | 48962e035aa5ff461add60682b9ebe40948f4189 | refs/heads/master | 2021-02-09T02:42:12.506150 | 2016-11-30T01:41:08 | 2016-11-30T01:41:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 531 | h | IntakeBallCommandGroup.h | #ifndef IntakeBallCommandGroup_H
#define IntakeBallCommandGroup_H
#include "Commands/CommandGroup.h"
#include "Commands/LowerIntakeCommand.h"
#include "Commands/TurnIntakeOnFwdCommand.h"
#include "Commands/RetractKickerCommand.h"
#include "WPILib.h"
class IntakeBallCommandGroup: public CommandGroup
{
public:
IntakeBallCommandGroup() : CommandGroup("IntakeBallCommandGroup"){
//AddSequential(new RetractKickerCommand());
AddSequential(new LowerIntakeCommand());
AddSequential(new TurnIntakeOnFwdCommand());
}
};
#endif
|
72dce9b88e288d119859beabf83fddb057c2a50f | 62e2209233957936490ae628172280e961572895 | /main3d_mpi/main3D2_mpi.cpp | 734b0084c5e80137a0d4d9ad526071f6a92a0912 | [] | no_license | Singyuan/Computational-Astrophysics-Final-Project | a65eedcc1971ef394f03c4a6115b74b971ad4bc5 | 4ab5bcb4729d2dfcbdef81dc08a8a058ca99dc0c | refs/heads/master | 2020-05-20T03:09:53.335601 | 2019-06-13T11:06:56 | 2019-06-13T11:06:56 | 185,351,018 | 2 | 1 | null | 2019-06-06T14:24:42 | 2019-05-07T07:55:34 | C++ | UTF-8 | C++ | false | false | 8,716 | cpp | main3D2_mpi.cpp | #include <iostream>
// #include <stdio.h>
// #include <stdlib.h>
#include <cstdlib>
#include <cstdio>
#include <math.h>
#include <string.h>
// #include <time.h>
#include <fstream> // text
#include <omp.h> // use open mp
#include "ConstPara.h" // constant parameter
#include "matrix3D.h" // omp version
#include "Subfunc3D2std.cpp" // subfunction
#include <mpi.h>
using namespace std;
main(int argc, char *argv[])
{
// initialize MPI
int NRank, MyRank;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &MyRank);
MPI_Comm_size(MPI_COMM_WORLD, &NRank);
// this test assumes only two ranks
if (NRank != 2)
{
fprintf(stderr, "ERROR: NRank (%d) != 2\n", NRank);
MPI_Abort(MPI_COMM_WORLD, 1);
}
const int SendRank = 0;
const int RecvRank = 1;
// const int TargetRank = (MyRank + 1) % 2; // (0,1) --> (1,0)
const int NReq = 1;
int Tag;
MPI_Request Request;
// set initial condition
double t = 0.0; // time axis
matrix x(N_In); // space axis
matrix U(5, N, NY, foo); // physics variable
for (int i = 1; i <= N_In; i++)
{
x(i) = (i - 0.5) * dx; // cell-centered coordinates
}
for (int i = 1; i <= N_In; i++)
{
for (int j = 1; j <= NY_In; j++)
{
for (int k = 1; k <= foo_In; k++)
{
U.SetRow(i + nghost, j + nghost, k + nghost, InitialCondition(x(i), x(j), 0));
}
}
}
// set flux variable hold the memory
matrix LX(5, N, NY, foo);
matrix RX(5, N, NY, foo);
matrix LY(5, N, NY, foo);
matrix RY(5, N, NY, foo);
matrix fluxX_L(5);
matrix fluxX_R(5);
matrix dfluxX(5, N, NY, foo);
matrix fluxX(5, N, NY, foo);
matrix fluxY_L(5);
matrix fluxY_R(5);
matrix dfluxY(5, N, NY, foo);
matrix fluxY(5, N, NY, foo);
double dt;
double *fluxPtr;
double fluxtemp;
double *UPtr;
double Utemp;
double SendBuf[N * NY * foo * 5] = {0.0};
double RecvBuf[N * NY * foo * 5] = {0.0};
// open text
ofstream myfile("anidata.txt");
for (int i = 1; i <= N_In; i++)
{
myfile << x(i) << "\t";
}
myfile << "\r\n";
// main loop
for (int i = 0; i < largenumber; i++)
{
// set the boundary conditions
BoundaryCondition(U);
// estimate time-step from the CFL condition
dt = ComputeTimestep(U);
// dt = 0.002;
printf("t = %3.4f --> %3.4f\n", t, t + dt);
if ( MyRank == RecvRank )
{
// data reconstruction
DataReconstructionX_PLM(U, LX, RX);
// update the face-centered variables by 0.5*dt
for (int m = 2; m <= N - 1; m++)
{
for (int j = nghost + 1; j <= NY - nghost; j++)
{
for (int k = nghost + 1; k <= foo - nghost; k++)
{
fluxX_L = Conserved2FluxX(LX.GetRow(m, j, k));
fluxX_R = Conserved2FluxX(RX.GetRow(m, j, k));
dfluxX.SetRow(m, j, k, 0.5 * dt / dx * (fluxX_R - fluxX_L));
LX.SetRow(m, j, k, LX.GetRow(m, j, k) - dfluxX.GetRow(m, j, k));
RX.SetRow(m, j, k, RX.GetRow(m, j, k) - dfluxX.GetRow(m, j, k));
}
}
}
// compute fluxes
// R[j-1] is the LEFT state at the j+1/2 inteface
for (int m = nghost + 1; m <= N - nghost + 1; m++)
for (int j = nghost + 1; j <= NY - nghost; j++)
for (int k = nghost + 1; k <= foo - nghost; k++)
fluxX.SetRow(m, j, k, RoeX(RX.GetRow(m - 1, j, k), LX.GetRow(m, j, k)));
}
else
{
// data reconstruction
DataReconstructionY_PLM(U, LY, RY);
// update the face-centered variables by 0.5*dt
for (int m = nghost + 1; m <= N - nghost; m++)
{
for (int j = 2; j <= NY - 1; j++)
{
for (int k = nghost + 1; k <= foo - nghost; k++)
{
fluxY_L = Conserved2FluxY(LY.GetRow(m, j, k));
fluxY_R = Conserved2FluxY(RY.GetRow(m, j, k));
dfluxY.SetRow(m, j, k, 0.5 * dt / dx * (fluxY_R - fluxY_L));
LY.SetRow(m, j, k, LY.GetRow(m, j, k) - dfluxY.GetRow(m, j, k));
RY.SetRow(m, j, k, RY.GetRow(m, j, k) - dfluxY.GetRow(m, j, k));
}
}
}
// compute fluxes
// R[j-1] is the LEFT state at the j+1/2 inteface
for (int m = nghost + 1; m <= N - nghost; m++)
for (int j = nghost + 1; j <= NY - nghost + 1; j++)
for (int k = nghost + 1; k <= foo - nghost; k++)
fluxY.SetRow(m, j, k, RoeY(RY.GetRow(m, j - 1, k), LY.GetRow(m, j, k)));
}
Tag = 123;
if (MyRank == SendRank)
{
for (int n = 0; n < 5; n++)
for (int m = 0; m < N; m++)
for (int j = 0; j < NY; j++)
for (int k = 0; k < foo; k++)
SendBuf[k + foo * (j + NY * (m + N * n))] = fluxY(n + 1, m + 1, j + 1, k + 1);
MPI_Isend(&SendBuf, N * NY * foo * 5, MPI_DOUBLE, RecvRank, Tag, MPI_COMM_WORLD, &Request);
}
else
{
MPI_Irecv(&RecvBuf, N * NY * foo * 5, MPI_DOUBLE, SendRank, Tag, MPI_COMM_WORLD, &Request);
}
// update time
t = t + dt;
// update the volume-averaged input variables by dt
if (MyRank == RecvRank)
{
MPI_Wait(&Request, MPI_STATUSES_IGNORE);
// printf("%f ", RecvBuf[5]);
for (int n = 0; n < 5; n++)
for (int m = 0; m < N; m++)
for (int j = 0; j < NY; j++)
for (int k = 0; k < foo; k++)
fluxY(n + 1, m + 1, j + 1, k + 1) = RecvBuf[k + foo * (j + NY * (m + N * n))];
// fluxY.showY(10, 3);
for (int m = nghost + 1; m <= N - nghost; m++)
for (int j = nghost + 1; j <= NY - nghost; j++)
for (int k = nghost + 1; k <= foo - nghost; k++)
{
U.SetRow(m, j, k, U.GetRow(m, j, k) - dt / dx * (fluxX.GetRow(m + 1, j, k) - fluxX.GetRow(m, j, k)) - dt / dx * (fluxY.GetRow(m, j + 1, k) - fluxY.GetRow(m, j, k)));
}
// write text
if (myfile.is_open())
{
for (int m = nghost + 1; m <= N - nghost; m++)
{
for (int j = nghost + 1; j <= N - nghost; j++)
{
// myfile << U(1, m, j, 3) << "\t";
// myfile << pow(U(2, m, j, 3) / U(1, m, j, 3), 2.0) + pow(U(3, m, j, 3) / U(1, m, j, 3), 2.0) << "\t";
myfile << ComputePressure(U(1, m, j, 3), U(2, m, j, 3), U(3, m, j, 3), U(4, m, j, 3), U(5, m, j, 3)) << "\t";
}
myfile << "\r\n";
}
}
else
cout << "Unable to open file";
}
Tag = 321;
if (MyRank == RecvRank)
{
for (int n = 0; n < 5; n++)
for (int m = 0; m < N; m++)
for (int j = 0; j < NY; j++)
for (int k = 0; k < foo; k++)
SendBuf[k + foo * (j + NY * (m + N * n))] = U(n + 1, m + 1, j + 1, k + 1);
MPI_Isend(&SendBuf, N * NY * foo * 5, MPI_DOUBLE, SendRank, Tag, MPI_COMM_WORLD, &Request);
}
else
{
MPI_Irecv(&RecvBuf, N * NY * foo * 5, MPI_DOUBLE, RecvRank, Tag, MPI_COMM_WORLD, &Request);
}
if (MyRank == SendRank)
{
MPI_Wait(&Request, MPI_STATUSES_IGNORE);
for (int n = 0; n < 5; n++)
for (int m = 0; m < N; m++)
for (int j = 0; j < NY; j++)
for (int k = 0; k < foo; k++)
U(n + 1, m + 1, j + 1, k + 1) = RecvBuf[k + foo * (j + NY * (m + N * n))];
}
}
// terminate MPI
MPI_Finalize();
return 0;
} |
42c6767fce5bc67abc4f368cb837848e0248a65f | 1e68a055ef3ad9f522036c73825a5c19c1e5f7ca | /src/rov/robot.h | 1753f088508aeccc2615a1bcf870a3cb252a928a | [] | no_license | leroycep/squeaky-rov | c040d326426c3b914cbce576af31038f03ae9d30 | 2eb7e9ee73da588381582c6b6b0368191879ed00 | refs/heads/master | 2021-05-30T20:02:40.176170 | 2016-04-11T00:08:12 | 2016-04-11T00:08:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 958 | h | robot.h |
#ifndef _ROBOT_H_
#define _ROBOT_H_
#include <Arduino.h>
#include "motor.h"
#include "sensor.h"
#define MAX_MOTORS 9
#define MAX_SENSORS 1
namespace Robot {
class Robot {
static Robot* s_instance;
int stepper_step_pin;
int stepper_dir_pin;
int stepper_enabled_pin;
Motor** motors;
Sensor::Voltage* voltage_sensor;
Sensor::Temperature* temperature_sensor;
Sensor::Depth* depth_sensor;
int multiplexerPaPins[4];
int multiplexerRePins[4];
Robot();
public:
void setMultiplexerPaPins(int, int, int, int);
void setMultiplexerRePins(int, int, int, int);
void controlMultiplexerPa(int);
void controlMultiplexerRe(int);
void setStepperPins(int, int, int);
void controlStepper(bool, bool);
void setStepperEnabled(bool);
Motor* getMotor(int);
Sensor::Voltage* getVoltageSensor();
Sensor::Temperature* getTemperatureSensor();
Sensor::Depth* getDepthSensor();
void update();
static Robot* instance();
};
}
#endif |
debabcb722d794aceeb7786d7d07852c729d370d | ca5f51c4fecdb3cca7ffc0544c17de0c412086f8 | /Arrays/maximum and minimum/median-of-stream-of-integers.cpp | 570ce6c760e03636683ab0b66ed360d5061540a3 | [] | no_license | avinashw50w/ds_algo | f517bbb326a922258e6ef7816e6c06593a2d06aa | bc73bd617486ab8fcbbdd8a076cacd3761c6c954 | refs/heads/master | 2023-07-22T17:44:44.815336 | 2023-07-13T07:38:22 | 2023-07-13T07:38:22 | 193,303,550 | 0 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 3,761 | cpp | median-of-stream-of-integers.cpp | typedef priority_queue<int> maxHeap; // max heap
typedef priority_queue<int, vector<int>, greater<int>> minHeap; // min heap
void addNumber(int n, maxHeap &leftHeap, minHeap &rightHeap)
{
if(leftHeap.emtpy() || n < leftHeap.top())
leftHeap.push(n);
else
rightHeap.push(n);
}
void rebalance(maxHeap &leftHeap, minHeap &rightHeap)
{
if(leftHeap.size() - rightHeap.size() >= 2) {
rightHeap.push(leftHeap.top());
leftHeap.pop();
}
else if(rightHeap.size() - leftHeap.size() >= 2) {
leftHeap.push(rightHeap.top());
rightHeap.pop();
}
}
int getMedian(maxHeap &leftHeap, minHeap &rightHeap)
{
if(leftHeap.size() == rightHeap.size())
return (leftHeap.top() + rightHeap.top()) >> 1;
if(leftHeap.size() - rightHeap.size() == 1)
return leftHeap.top();
if(rightHeap.size() - leftHeap.size() == 1)
return rightHeap.top();
}
void printMedian() {
maxHeap leftHeap;
minHeap rightHeap;
int n;
while(cin >> n) {
addNumber(n, leftHeap, rightHeap);
rebalance(leftHeap, rightHeap);
cout << getMedian(leftHeap, rightHeap) << " ";
}
}
/////////////////////////////////////////////////////////////////////
double average(int n1, int n2)
{
return (n1 + n2) / 2;
}
/* we can use a max heap on left side to represent elements that are less than effective median,
and a min heap on right side to represent elements that are greater than effective median.
After processing an incoming element, the number of elements in heaps differ utmost by 1 element.
When both heaps contain same number of elements, we pick average of heaps root data as effective median.
When the heaps are not balanced, we select effective median from the root of heap containing more elements.*/
// This method maintains the condition that maxHeap size
// is always greater than or equal to minHeap size.
void addNewNumber(int randomNumber, priority_queue<int, vector<int>, greater<int>>& minHeap, priority_queue<int, vector<int>, less<int>>& maxHeap)
{
if(minHeap.size() == maxHeap.size())
{
if((!minHeap.empty()) && (randomNumber > minHeap.top()))
{
maxHeap.push(minHeap.top());
minHeap.pop();
minHeap.push(randomNumber);
}
else
{
maxHeap.push(randomNumber);
}
}
else
{
if(randomNumber > maxHeap.top())
{
minHeap.push(randomNumber);
}
else
{
minHeap.push(maxHeap.top());
maxHeap.pop();
maxHeap.push(randomNumber);
}
}
}
double getMedian(priority_queue<int, vector<int>, greater<int>> minHeap, priority_queue<int, vector<int>, less<int>> maxHeap)
{
// maxHeap is always at least as big as minHeap.
// So if maxHeap is empty, then minHeap is empty too.
if(maxHeap.empty())
return 0;
// If both maxHeap and minHeap have same sizes
// then return average of their top elements.
if(maxHeap.size() == minHeap.size())
return average(maxHeap.top(), minHeap.top());
// if maxHeap and minHeap are of different sizes then
// maxHeap must have one extra element. So return top of maxHeap.
return maxHeap.top();
}
void printMedian(int arr[], int size)
{
double median = 0; // effective median
priority_queue<int, vector<int>, greater<int>> minHeap;
priority_queue<int, vector<int>, less<int>> maxHeap;
for(int i = 0; i < size; i++)
{
addNewNumber(arr[i], minHeap, maxHeap);
median = getMedian(minHeap, maxHeap);
cout << median << endl;
}
}
int main()
{
int arr[] = {5, 15, 1, 3, 2, 8, 7, 9, 10, 6, 11, 4};
int size = sizeof(arr)/sizeof(arr[0]);
// In lieu of A, we can also use data read from a stream
printMedian(arr, size);
return 0;
}
////////////////////////////////////////////////////////////
|
5c445283f0982bb8b27604263d5dcb55d7fe0edf | 46fdb8ec69159a66eca4be620618e49edf7f29e8 | /JJongSue/D3/5431/solution.cpp | b9567b55e8d2f3267d68968f129259183ae18900 | [] | no_license | khyun-kim/SW-expert-academy-study-storage | 478c9f85a3cec4b3cfa84481b52a13ebc8ffeec4 | 34b907ddd09c355acf7c9db696f01c89b2d8a1bb | refs/heads/master | 2020-05-01T15:12:31.734700 | 2019-09-09T02:24:49 | 2019-09-09T02:24:49 | 177,540,951 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 654 | cpp | solution.cpp | #include <iostream>
#include <vector>
using namespace std;
int main(void)
{
int testcase_num = 0;
scanf("%d", &testcase_num);
for(int testcase_i=1;testcase_i<=testcase_num;testcase_i++)
{
int N=0, K=0;
scanf("%d %d", &N, &K);
vector<bool> homework(N, false);
for(int i=0;i<K;i++)
{
int tmp=0;
scanf("%d", &tmp);
homework[tmp-1] = true;
}
printf("#%d", testcase_i);
for(int i=0;i<homework.size();i++)
{
if(homework[i] == false)
printf(" %d", i+1);
}
printf("\n");
}
return 0;
} |
930558dbb8658c815a646d68ef2dc3020f8a6740 | f771479669de99f5d15f1856cafaed0be4241b8a | /source/General/Entity/SEntity.cpp | 44fba8ab9416c2f95e06803a44cdeeafd547dde9 | [] | no_license | attack51/SweetEngine | 59610aa066689c0c924b4a158e049bd3631c308d | 94352bb2c25803e3755f647377ec14af4dc85a01 | refs/heads/master | 2020-05-17T18:28:30.311920 | 2019-07-03T00:40:09 | 2019-07-03T00:40:09 | 183,884,470 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,316 | cpp | SEntity.cpp | //General Include
#include "General/SInclude.h"
//Header Include
#include "SEntity.h"
SEntity::SEntity()
{
}
SEntity::~SEntity()
{
Destroy();
}
void SEntity::Destroy()
{
RemoveParent();
}
void SEntity::SetParent(SEntity* parent)
{
RemoveParent();
if (parent)
{
m_parent = SEntitySPtr(parent);
m_parent->m_children.push_back(SEntitySPtr(this));
}
}
void SEntity::RemoveParent()
{
if (m_parent)
{
SEntitySPtr this_sptr(this);
SEntitySPtrArrayIter iter = std::find(m_parent->m_children.begin(), m_parent->m_children.end(), this_sptr);
if (iter != m_parent->m_children.end())
{
m_parent->m_children.erase(iter);
}
m_parent = nullptr;
}
}
//world
const STransform& SEntity::GetWorldTransform() const
{
return m_worldTransform;
}
bool SEntity::SetWorldTransform(const STransform& transform)
{
if (m_worldTransform == transform) return false;
m_worldTransform = transform;
RefreshRelativeTransform();
return true;
}
const SVector& SEntity::GetWorldScale() const
{
return m_worldTransform.GetScale();
}
const SQuaternion& SEntity::GetWorldRotation() const
{
return m_worldTransform.GetRotation();
}
SEulerRotator SEntity::GetWorldEulerRotation() const
{
return m_worldTransform.GetEulerRotation();
}
const SVector& SEntity::GetWorldTranslation() const
{
return m_worldTransform.GetTranslation();
}
bool SEntity::SetWorldScale(const SVector& scale)
{
if (!m_worldTransform.SetScale(scale)) return false;
RefreshRelativeTransform();
return true;
}
bool SEntity::SetWorldRotation(const SQuaternion& rotation)
{
if (!m_worldTransform.SetRotation(rotation)) return false;
RefreshRelativeTransform();
return true;
}
bool SEntity::SetWorldEulerRotation(const SEulerRotator& eulerRotation)
{
if (!m_worldTransform.SetEulerRotation(eulerRotation)) return false;
RefreshRelativeTransform();
return true;
}
bool SEntity::SetWorldTranslation(const SVector& translation)
{
if (!m_worldTransform.SetTranslation(translation)) return false;
RefreshRelativeTransform();
return true;
}
//relative
const STransform& SEntity::GetRelativeTransform() const
{
return m_relativeTransform;
}
bool SEntity::SetRelativeTransform(const STransform& transform)
{
if (m_relativeTransform == transform) return false;
m_relativeTransform = transform;
RefreshWorldTransform();
return true;
}
const SVector& SEntity::GetRelativeScale() const
{
return m_relativeTransform.GetScale();
}
const SQuaternion& SEntity::GetRelativeRotation() const
{
return m_relativeTransform.GetRotation();
}
SEulerRotator SEntity::GetRelativeEulerRotation() const
{
return m_relativeTransform.GetEulerRotation();
}
const SVector& SEntity::GetRelativeTranslation() const
{
return m_relativeTransform.GetTranslation();
}
bool SEntity::SetRelativeScale(const SVector& scale)
{
if (!m_relativeTransform.SetScale(scale)) return false;
RefreshWorldTransform();
return true;
}
bool SEntity::SetRelativeRotation(const SQuaternion& rotation)
{
if (!m_relativeTransform.SetRotation(rotation)) return false;
RefreshWorldTransform();
return true;
}
bool SEntity::SetRelativeEulerRotation(const SEulerRotator& eulerRotation)
{
if (!m_relativeTransform.SetEulerRotation(eulerRotation)) return false;
RefreshWorldTransform();
return true;
}
bool SEntity::SetRelativeTranslation(const SVector& translation)
{
if (!m_relativeTransform.SetTranslation(translation)) return false;
RefreshWorldTransform();
return true;
}
void SEntity::RefreshWorldTransform()
{
if (m_parent)
{
m_worldTransform = m_relativeTransform.ToAbsolute(m_parent->GetWorldTransform());
}
else
{
m_worldTransform = m_relativeTransform;
}
for (SEntitySPtr& child : m_children)
{
child->RefreshWorldTransform();
}
}
void SEntity::RefreshRelativeTransform()
{
if (m_parent)
{
m_relativeTransform = m_worldTransform.ToRelative(m_parent->GetWorldTransform());
}
else
{
m_relativeTransform = m_worldTransform;
}
for (SEntitySPtr& child : m_children)
{
child->RefreshWorldTransform();
}
}
|
867521f09b476750413c25694ca2183d0aa0227e | c1d7a2de68d4e4ad50e4684396d744d24affefde | /win_game/Types/Stack.h | d9a1afff11740f46fd5e9439fb3dd474aa35c496 | [] | no_license | dzoidx/Vulkan-UI-Editor | aad235b280a5ed822c52b3c2469bce23e266c8b0 | 59df698a191dade1ea6f4bd558a387d526ecabb5 | refs/heads/main | 2023-07-31T01:58:50.993495 | 2021-09-08T07:37:40 | 2021-09-08T07:38:15 | 404,239,889 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,075 | h | Stack.h | #pragma once
#include "Types.h"
template<typename T>
class Stack
{
public:
Stack() :Stack(0) {}
Stack(int32 initialCap) : top_(-1), capacity_(0), data_(0), default_()
{
if (initialCap > 0)
EnsureSize(initialCap);
}
~Stack()
{
MemoryManager::Instance()->Free(data_, capacity_);
}
T& Peek()
{
if (top_ < 0)
return default_;
return *(data_ + top_);
}
T& Pop()
{
if (top_ < 0)
return default_;
return *(data_ + top_--);
}
void Push(T val)
{
EnsureSize(top_ + 2);
++top_;
data_[top_] = val;
}
int32 GetCount() const { return top_ + 1; }
private:
void EnsureSize(int32 size)
{
if (data_ == nullptr)
{
data_ = MemoryManager::Instance()->Allocate<T>(size * sizeof(T));
capacity_ = size;
return;
}
if (capacity_ >= size)
return;
T* newArray = MemoryManager::Instance()->Allocate<T>(size * sizeof(T));
memcpy(newArray, data_, sizeof(T) * (top_ + 1));
MemoryManager::Instance()->Free(data_, capacity_);
data_ = newArray;
capacity_ = size;
}
private:
int32 top_;
int32 capacity_;
T* data_;
T default_;
}; |
b3a6083e081c57e4faece7df88c67e2afd09969c | a33aac97878b2cb15677be26e308cbc46e2862d2 | /program_data/PKU_raw/99/1065.c | 0a66622d856848208c3380a803cf8431cb0096b1 | [] | no_license | GabeOchieng/ggnn.tensorflow | f5d7d0bca52258336fc12c9de6ae38223f28f786 | 7c62c0e8427bea6c8bec2cebf157b6f1ea70a213 | refs/heads/master | 2022-05-30T11:17:42.278048 | 2020-05-02T11:33:31 | 2020-05-02T11:33:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 420 | c | 1065.c | int main(){
int n,a,i;
double b,c,d,e;
scanf("%d",&n);
b=0;
c=0;
d=0;
e=0;
for(i=1;i<=n;i++){
scanf("%d",&a);
if(a<=18){
b=b+1;
}
else if (a>=19&&a<=35){
c=c+1;}
else if(a>=36&&a<=60){
d=d+1;}
else {
e=e+1;}
}
b=((double)b/n)*100;
c=((double)c/n)*100;
d=((double)d/n)*100;
e=((double)e/n)*100;
printf("1-18: %.2lf%%\n19-35: %.2lf%%\n36-60: %.2lf%%\n60??: %.2lf%%\n",b,c,d,e);
return 0;
} |
86fcd57eb73ed152d56396150e5b29a0cd657587 | f220418683fb5f270e3f1ce40d69e5390ff4e912 | /paddle/fluid/operators/yolov3_loss_op.cc | 60508f7ab871910c38f1e4aa04c2035075d37df5 | [
"Apache-2.0"
] | permissive | wanghaoshuang/Paddle | dd36299360f44865147889249d95f49a160f689f | 8c19599bc640f51b279d95054bbd5eccde210c0c | refs/heads/slim | 2023-03-09T06:24:54.702479 | 2019-02-25T15:36:35 | 2019-02-25T15:36:35 | 91,771,236 | 3 | 3 | Apache-2.0 | 2019-03-12T05:12:23 | 2017-05-19T06:05:49 | C++ | UTF-8 | C++ | false | false | 9,880 | cc | yolov3_loss_op.cc | /* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
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 "paddle/fluid/operators/yolov3_loss_op.h"
#include "paddle/fluid/framework/op_registry.h"
namespace paddle {
namespace operators {
using framework::Tensor;
class Yolov3LossOp : public framework::OperatorWithKernel {
public:
using framework::OperatorWithKernel::OperatorWithKernel;
void InferShape(framework::InferShapeContext* ctx) const override {
PADDLE_ENFORCE(ctx->HasInput("X"),
"Input(X) of Yolov3LossOp should not be null.");
PADDLE_ENFORCE(ctx->HasInput("GTBox"),
"Input(GTBox) of Yolov3LossOp should not be null.");
PADDLE_ENFORCE(ctx->HasInput("GTLabel"),
"Input(GTLabel) of Yolov3LossOp should not be null.");
PADDLE_ENFORCE(ctx->HasOutput("Loss"),
"Output(Loss) of Yolov3LossOp should not be null.");
auto dim_x = ctx->GetInputDim("X");
auto dim_gtbox = ctx->GetInputDim("GTBox");
auto dim_gtlabel = ctx->GetInputDim("GTLabel");
auto anchors = ctx->Attrs().Get<std::vector<int>>("anchors");
auto class_num = ctx->Attrs().Get<int>("class_num");
PADDLE_ENFORCE_EQ(dim_x.size(), 4, "Input(X) should be a 4-D tensor.");
PADDLE_ENFORCE_EQ(dim_x[2], dim_x[3],
"Input(X) dim[3] and dim[4] should be euqal.");
PADDLE_ENFORCE_EQ(dim_x[1], anchors.size() / 2 * (5 + class_num),
"Input(X) dim[1] should be equal to (anchor_number * (5 "
"+ class_num)).");
PADDLE_ENFORCE_EQ(dim_gtbox.size(), 3,
"Input(GTBox) should be a 3-D tensor");
PADDLE_ENFORCE_EQ(dim_gtbox[2], 4, "Input(GTBox) dim[2] should be 5");
PADDLE_ENFORCE_EQ(dim_gtlabel.size(), 2,
"Input(GTBox) should be a 2-D tensor");
PADDLE_ENFORCE_EQ(dim_gtlabel[0], dim_gtbox[0],
"Input(GTBox) and Input(GTLabel) dim[0] should be same");
PADDLE_ENFORCE_EQ(dim_gtlabel[1], dim_gtbox[1],
"Input(GTBox) and Input(GTLabel) dim[1] should be same");
PADDLE_ENFORCE_GT(anchors.size(), 0,
"Attr(anchors) length should be greater then 0.");
PADDLE_ENFORCE_EQ(anchors.size() % 2, 0,
"Attr(anchors) length should be even integer.");
PADDLE_ENFORCE_GT(class_num, 0,
"Attr(class_num) should be an integer greater then 0.");
std::vector<int64_t> dim_out({1});
ctx->SetOutputDim("Loss", framework::make_ddim(dim_out));
}
protected:
framework::OpKernelType GetExpectedKernelType(
const framework::ExecutionContext& ctx) const override {
return framework::OpKernelType(ctx.Input<Tensor>("X")->type(),
platform::CPUPlace());
}
};
class Yolov3LossOpMaker : public framework::OpProtoAndCheckerMaker {
public:
void Make() override {
AddInput("X",
"The input tensor of YOLO v3 loss operator, "
"This is a 4-D tensor with shape of [N, C, H, W]."
"H and W should be same, and the second dimention(C) stores"
"box locations, confidence score and classification one-hot"
"key of each anchor box");
AddInput("GTBox",
"The input tensor of ground truth boxes, "
"This is a 3-D tensor with shape of [N, max_box_num, 5], "
"max_box_num is the max number of boxes in each image, "
"In the third dimention, stores x, y, w, h coordinates, "
"x, y is the center cordinate of boxes and w, h is the "
"width and height and x, y, w, h should be divided by "
"input image height to scale to [0, 1].");
AddInput("GTLabel",
"The input tensor of ground truth label, "
"This is a 2-D tensor with shape of [N, max_box_num], "
"and each element shoudl be an integer to indicate the "
"box class id.");
AddOutput("Loss",
"The output yolov3 loss tensor, "
"This is a 1-D tensor with shape of [1]");
AddAttr<int>("class_num", "The number of classes to predict.");
AddAttr<std::vector<int>>("anchors",
"The anchor width and height, "
"it will be parsed pair by pair.");
AddAttr<float>("ignore_thresh",
"The ignore threshold to ignore confidence loss.");
AddAttr<float>("loss_weight_xy", "The weight of x, y location loss.")
.SetDefault(1.0);
AddAttr<float>("loss_weight_wh", "The weight of w, h location loss.")
.SetDefault(1.0);
AddAttr<float>(
"loss_weight_conf_target",
"The weight of confidence score loss in locations with target object.")
.SetDefault(1.0);
AddAttr<float>("loss_weight_conf_notarget",
"The weight of confidence score loss in locations without "
"target object.")
.SetDefault(1.0);
AddAttr<float>("loss_weight_class", "The weight of classification loss.")
.SetDefault(1.0);
AddComment(R"DOC(
This operator generate yolov3 loss by given predict result and ground
truth boxes.
The output of previous network is in shape [N, C, H, W], while H and W
should be the same, specify the grid size, each grid point predict given
number boxes, this given number is specified by anchors, it should be
half anchors length, which following will be represented as S. In the
second dimention(the channel dimention), C should be S * (class_num + 5),
class_num is the box categoriy number of source dataset(such as coco),
so in the second dimention, stores 4 box location coordinates x, y, w, h
and confidence score of the box and class one-hot key of each anchor box.
While the 4 location coordinates if $$tx, ty, tw, th$$, the box predictions
correspnd to:
$$
b_x = \sigma(t_x) + c_x
b_y = \sigma(t_y) + c_y
b_w = p_w e^{t_w}
b_h = p_h e^{t_h}
$$
While $$c_x, c_y$$ is the left top corner of current grid and $$p_w, p_h$$
is specified by anchors.
As for confidence score, it is the logistic regression value of IoU between
anchor boxes and ground truth boxes, the score of the anchor box which has
the max IoU should be 1, and if the anchor box has IoU bigger then ignore
thresh, the confidence score loss of this anchor box will be ignored.
Therefore, the yolov3 loss consist of three major parts, box location loss,
confidence score loss, and classification loss. The MSE loss is used for
box location, and binary cross entropy loss is used for confidence score
loss and classification loss.
Final loss will be represented as follow.
$$
loss = \loss_weight_{xy} * loss_{xy} + \loss_weight_{wh} * loss_{wh}
+ \loss_weight_{conf_target} * loss_{conf_target}
+ \loss_weight_{conf_notarget} * loss_{conf_notarget}
+ \loss_weight_{class} * loss_{class}
$$
)DOC");
}
};
class Yolov3LossOpGrad : public framework::OperatorWithKernel {
public:
using framework::OperatorWithKernel::OperatorWithKernel;
void InferShape(framework::InferShapeContext* ctx) const override {
PADDLE_ENFORCE(ctx->HasInput("X"), "Input(X) should not be null");
PADDLE_ENFORCE(ctx->HasInput(framework::GradVarName("Loss")),
"Input(Loss@GRAD) should not be null");
auto dim_x = ctx->GetInputDim("X");
if (ctx->HasOutput(framework::GradVarName("X"))) {
ctx->SetOutputDim(framework::GradVarName("X"), dim_x);
}
}
protected:
framework::OpKernelType GetExpectedKernelType(
const framework::ExecutionContext& ctx) const override {
return framework::OpKernelType(ctx.Input<Tensor>("X")->type(),
platform::CPUPlace());
}
};
class Yolov3LossGradMaker : public framework::SingleGradOpDescMaker {
public:
using framework::SingleGradOpDescMaker::SingleGradOpDescMaker;
protected:
std::unique_ptr<framework::OpDesc> Apply() const override {
auto* op = new framework::OpDesc();
op->SetType("yolov3_loss_grad");
op->SetInput("X", Input("X"));
op->SetInput("GTBox", Input("GTBox"));
op->SetInput("GTLabel", Input("GTLabel"));
op->SetInput(framework::GradVarName("Loss"), OutputGrad("Loss"));
op->SetAttrMap(Attrs());
op->SetOutput(framework::GradVarName("X"), InputGrad("X"));
op->SetOutput(framework::GradVarName("GTBox"), {});
op->SetOutput(framework::GradVarName("GTLabel"), {});
return std::unique_ptr<framework::OpDesc>(op);
}
};
} // namespace operators
} // namespace paddle
namespace ops = paddle::operators;
REGISTER_OPERATOR(yolov3_loss, ops::Yolov3LossOp, ops::Yolov3LossOpMaker,
ops::Yolov3LossGradMaker);
REGISTER_OPERATOR(yolov3_loss_grad, ops::Yolov3LossOpGrad);
REGISTER_OP_CPU_KERNEL(yolov3_loss, ops::Yolov3LossKernel<float>,
ops::Yolov3LossKernel<double>);
REGISTER_OP_CPU_KERNEL(yolov3_loss_grad, ops::Yolov3LossGradKernel<float>,
ops::Yolov3LossGradKernel<double>);
|
3e037a7b6dba3323d73225300ad9cb2fc3421ead | 9af5945a855c697d40bba15cbedc8f513011532f | /hfs/perturbations.hpp | 2efedb85e7e2a343c55a295249847b25ebc1fb25 | [] | no_license | arturfb/FSSolver | 239c5693a466611a95ade2255661ab3da4e064e3 | 86ef58a9d0459d0b3ec0331e139bf23658fa8a84 | refs/heads/master | 2023-08-27T12:21:46.331727 | 2021-10-11T01:33:00 | 2021-10-11T01:33:00 | 285,350,707 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 27,410 | hpp | perturbations.hpp | /*
* Copyright (c) 2020 Marcus Ritt, Artur Brum
*
* Permission is hereby granted, free of charge, to any person (the "Person")
* obtaining a copy of this software and associated documentation files (the
* "Software"), to deal in the Software, including the rights to use, copy, modify,
* merge, publish, distribute the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* 1. The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* 2. Under no circumstances shall the Person be permitted, allowed or authorized
* to commercially exploit the Software.
* 3. Changes made to the original Software shall be labeled, demarcated or
* otherwise identified and attributed to the Person.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#pragma once
#include <vector>
#include <random>
#include <algorithm>
#include "instance.hpp"
#include "solution.hpp"
#include "constructive.hpp"
#include "ls.hpp"
#include "rules.hpp"
#include "parameters.hpp"
template<typename Tiebreak>
inline void ri(Instance& I, PFSSolution& n, std::mt19937& rng, builder& construct, Tiebreak tiebreak, Params& p) {
std::uniform_int_distribution<unsigned> dis(1, I.n);
std::vector<unsigned> available(n.pi.begin()+1, n.pi.end());
std::shuffle(available.begin(), available.end(), rng);
unsigned index = 0;
for(unsigned i = 0; i < p.dc; i++){
unsigned job = available[index];
index++;
auto pos = std::find(n.pi.begin()+1, n.pi.end(), job);
assert(pos != n.pi.end());
unsigned rp1 = pos - n.pi.begin();
unsigned rp2 = dis(rng);
while (rp2 == rp1) {
rp2 = dis(rng);
}
if (rp1 < rp2) {
for (unsigned j = rp1; j < rp2; j++) {
n.pi[j] = n.pi[j+1];
}
}
else {
for (unsigned j = rp1; j > rp2; j--) {
n.pi[j] = n.pi[j-1];
}
}
n.pi[rp2] = job;
}
if (p.obj == 'm') {
n.computeMakespan(I);
}
else if (p.obj == 'f') {
n.computeFlowtime(I);
}
else {
n.computeTotalTardiness(I);
}
}
template <typename Tiebreak>
inline void gi(Instance& I, PFSSolution& n, std::mt19937& rng, builder& construct, Tiebreak tiebreak, Params& p) {
unsigned kl = 1;
unsigned ku = I.n+1;
std::uniform_int_distribution<> dis(0);
std::vector<Job> remove(n.pi.begin()+kl-1,n.pi.begin()+ku);
unsigned left = ku-kl;
auto dst = remove.begin()+1;
for(unsigned i=0; i<p.dc; i++, dst++, left--)
std::swap(*dst,*(dst+(dis(rng)%left)));
remove.erase(dst,remove.end());
auto nend = n.pi.end();
for(unsigned i=1; i<=p.dc; i++)
nend=std::remove(n.pi.begin()+kl,nend,remove[i]);
std::fill(nend,n.pi.end(),0);
if (p.obj == 'm') {
construct.constructp(I,n,I.n-p.dc+1,kl,ku-p.dc,remove,tiebreak);
}
else if (p.obj == 'f') {
construct.constructpCsum(I,n,I.n-p.dc+1,kl,ku-p.dc,remove,tiebreak);
}
else {
construct.constructpTT(I,n,I.n-p.dc+1,kl,ku-p.dc,remove,tiebreak);
}
}
template<typename Tiebreak>
inline void rs(Instance& I, PFSSolution& n, std::mt19937& rng, builder& construct, Tiebreak tiebreak, Params& p) {
std::uniform_int_distribution<unsigned> dis(1, I.n);
std::vector<unsigned> available(n.pi.begin()+1, n.pi.end());
std::shuffle(available.begin(), available.end(), rng);
unsigned index = 0;
for(unsigned i = 0; i < p.dc; i++){
unsigned job = available[index];
index++;
auto pos = std::find(n.pi.begin()+1, n.pi.end(), job);
assert(pos != n.pi.end());
unsigned rp1 = pos - n.pi.begin();
unsigned rp2 = dis(rng);
while (rp2 == rp1) {
rp2 = dis(rng);
}
std::swap(n.pi[rp1], n.pi[rp2]);
}
if (p.obj == 'm') {
n.computeMakespan(I);
}
else if (p.obj == 'f') {
n.computeFlowtime(I);
}
else {
n.computeTotalTardiness(I);
}
}
template<typename Tiebreak>
inline void gs(Instance& I, PFSSolution& n, std::mt19937& rng, builder& construct, Tiebreak tiebreak, Params& p) {
std::vector<unsigned> available(n.pi.begin()+1, n.pi.end());
std::shuffle(available.begin(), available.end(), rng);
unsigned index = 0;
for(unsigned i = 0; i < p.dc; i++) {
unsigned rp1 = available[index];
index++;
unsigned best = std::numeric_limits<unsigned>::max();
unsigned bestj = 0;
for (unsigned j = 1; j <= I.n; j++) {
if (j != rp1) {
std::swap(n.pi[rp1], n.pi[j]);
if (p.obj == 'm') {
n.computeMakespan(I);
}
else if (p.obj == 'f') {
n.computeFlowtime(I);
}
else {
n.computeTotalTardiness(I);
}
if (n.ms < best) {
best = n.ms;
bestj = j;
}
std::swap(n.pi[rp1], n.pi[j]);
}
}
assert(bestj != 0);
std::swap(n.pi[rp1], n.pi[bestj]);
}
if (p.obj == 'm') {
n.computeMakespan(I);
}
else if (p.obj == 'f') {
n.computeFlowtime(I);
}
else {
n.computeTotalTardiness(I);
}
}
template<typename Tiebreak>
inline void ras(Instance& I, PFSSolution& n, std::mt19937& rng, builder& construct, Tiebreak tiebreak, Params& p) {
std::uniform_int_distribution<unsigned> dis(1, I.n - 1);
for(unsigned i = 0; i < p.dc; i++){
unsigned rp1 = dis(rng);
std::swap(n.pi[rp1], n.pi[rp1+1]);
}
if (p.obj == 'm') {
n.computeMakespan(I);
}
else if (p.obj == 'f') {
n.computeFlowtime(I);
}
else {
n.computeTotalTardiness(I);
}
}
template <typename Tiebreak>
inline void gi_asls(Instance& I, PFSSolution& n, std::mt19937& rng, builder& construct, Tiebreak tiebreak, Params& p) {
unsigned kl = 1;
unsigned ku = I.n+1;
std::uniform_int_distribution<> dis(0);
std::vector<Job> remove(n.pi.begin()+kl-1,n.pi.begin()+ku);
unsigned left = ku-kl;
auto dst = remove.begin()+1;
for(unsigned i = 0; i < p.dc; i++, dst++, left--)
std::swap(*dst, *(dst+(dis(rng)%left)));
remove.erase(dst, remove.end());
auto nend = n.pi.end();
for (unsigned i = 1; i <= p.dc; i++)
nend = std::remove(n.pi.begin()+kl, nend, remove[i]);
std::fill(nend, n.pi.end(), 0);
for (unsigned i = 1; i <= p.dc; i++) {
std::vector<Job> insert = { 0, remove[i] };
if (p.obj == 'm') {
construct.constructp(I,n,I.n-p.dc+i,kl,ku-p.dc+i-1,insert,tiebreak);
}
else if (p.obj == 'f') {
construct.constructpCsum(I,n,I.n-p.dc+i,kl,ku-p.dc+i-1,insert,tiebreak);
}
else {
construct.constructpTT(I,n,I.n-p.dc+i,kl,ku-p.dc+i-1,insert,tiebreak);
}
auto b = std::find(n.pi.begin()+1, n.pi.end(), remove[i]);
assert(b != n.pi.end());
unsigned best = n.ms;
unsigned bestj = 0;
unsigned index = (b - n.pi.begin()) + 1;
for (unsigned j = I.n-p.dc+i; j > index; j--) {
std::swap(n.pi[j], n.pi[j-1]);
if (p.obj == 'm') {
n.computeMakespan(I,n.pi.size()-p.dc+i);
}
else if (p.obj == 'f') {
n.computeFlowtime(I,n.pi.size()-p.dc+i);
}
else {
n.computeTotalTardiness(I,n.pi.size()-p.dc+i);
}
if (n.ms < best) {
best = n.ms;
bestj = j;
}
std::swap(n.pi[j], n.pi[j-1]);
}
if (bestj > 0) {
std::swap(n.pi[bestj], n.pi[bestj-1]);
}
}
if (p.obj == 'm') {
n.computeMakespan(I);
}
else if (p.obj == 'f') {
n.computeFlowtime(I);
}
else {
n.computeTotalTardiness(I);
}
}
template <typename Tiebreak>
inline void ils_gi(Instance& I, PFSSolution& n, std::mt19937& rng, builder& construct, Tiebreak tiebreak, Params& p) {
unsigned kl = 1;
unsigned ku = I.n+1;
std::uniform_int_distribution<> dis(0);
std::vector<Job> remove(n.pi.begin()+kl-1,n.pi.begin()+ku);
unsigned left = ku-kl;
auto dst = remove.begin()+1;
for(unsigned i=0; i<p.dc; i++, dst++, left--)
std::swap(*dst,*(dst+(dis(rng)%left)));
remove.erase(dst,remove.end());
auto nend = n.pi.end();
for(unsigned i=1; i<=p.dc; i++)
nend=std::remove(n.pi.begin()+kl,nend,remove[i]);
std::fill(nend,n.pi.end(),0);
if (p.obj == 'm') {
n.computeMakespan(I,n.pi.size()-p.dc);
}
else if (p.obj == 'f') {
n.computeFlowtime(I,n.pi.size()-p.dc);
}
else {
n.computeTotalTardiness(I,n.pi.size()-p.dc);
}
lsps_i(I,n,construct,p.obj,kl,ku-p.dc,p.dc,p.n_ls,p.start,p.timelimit,tiebreak);
if (p.obj == 'm') {
construct.constructp(I,n,I.n-p.dc+1,kl,ku-p.dc,remove,tiebreak);
}
else if (p.obj == 'f') {
construct.constructpCsum(I,n,I.n-p.dc+1,kl,ku-p.dc,remove,tiebreak);
}
else {
construct.constructpTT(I,n,I.n-p.dc+1,kl,ku-p.dc,remove,tiebreak);
}
}
template <typename Tiebreak>
inline void gi_ils(Instance& I, PFSSolution& n, std::mt19937& rng, builder& construct, Tiebreak tiebreak, Params& p) {
unsigned kl = 1;
unsigned ku = I.n+1;
std::uniform_int_distribution<> dis(0);
std::vector<Job> remove(n.pi.begin()+kl-1,n.pi.begin()+ku);
unsigned left = ku-kl;
auto dst = remove.begin()+1;
for(unsigned i = 0; i < p.dc; i++, dst++, left--)
std::swap(*dst, *(dst+(dis(rng)%left)));
remove.erase(dst, remove.end());
auto nend = n.pi.end();
for (unsigned i = 1; i <= p.dc; i++)
nend = std::remove(n.pi.begin()+kl, nend, remove[i]);
std::fill(nend, n.pi.end(), 0);
for (unsigned i = 1; i <= p.dc; i++) {
std::vector<Job> insert = { 0, remove[i] };
if (p.obj == 'm') {
construct.constructp(I,n,I.n-p.dc+i,kl,ku-p.dc+i-1,insert,tiebreak);
}
else if (p.obj == 'f') {
construct.constructpCsum(I,n,I.n-p.dc+i,kl,ku-p.dc+i-1,insert,tiebreak);
}
else {
construct.constructpTT(I,n,I.n-p.dc+i,kl,ku-p.dc+i-1,insert,tiebreak);
}
auto b = std::find(n.pi.begin()+1, n.pi.end(), remove[i]);
assert(b != n.pi.end());
insert.erase(insert.begin()+1);
nend = n.pi.end()-p.dc+i;
unsigned index = b - n.pi.begin();
if (index > 1) {
insert.push_back(n.pi[index-1]);
}
if (index < I.n-p.dc+i) {
insert.push_back(n.pi[index+1]);
}
for (unsigned j = 1; j < insert.size(); j++) {
nend = std::remove(n.pi.begin()+kl, nend, insert[j]);
}
std::fill(nend, n.pi.end(), 0);
if (p.obj == 'm') {
construct.constructp(I,n,I.n-p.dc+i-(insert.size()-1)+1,kl,ku-p.dc+i-(insert.size()-1),insert,tiebreak);
}
else if (p.obj == 'f') {
construct.constructpCsum(I,n,I.n-p.dc+i-(insert.size()-1)+1,kl,ku-p.dc+i-(insert.size()-1),insert,tiebreak);
}
else {
construct.constructpTT(I,n,I.n-p.dc+i-(insert.size()-1)+1,kl,ku-p.dc+i-(insert.size()-1),insert,tiebreak);
}
}
}
inline void giFF(Instance& I, PFSSolution& n, std::mt19937& rng, builder& construct, Params& p) {
unsigned kl = 1;
unsigned ku = I.n+1;
std::uniform_int_distribution<> dis(0);
std::vector<Job> remove(n.pi.begin()+kl-1,n.pi.begin()+ku);
unsigned left = ku-kl;
auto dst = remove.begin()+1;
for(unsigned i=0; i<p.dc; i++, dst++, left--)
std::swap(*dst,*(dst+(dis(rng)%left)));
remove.erase(dst,remove.end());
auto nend = n.pi.end();
for(unsigned i=1; i<=p.dc; i++)
nend=std::remove(n.pi.begin()+kl,nend,remove[i]);
std::fill(nend,n.pi.end(),0);
construct.constructpFF(I,n,I.n-p.dc+1,kl,ku-p.dc,remove);
}
inline void gi_aslsFF(Instance& I, PFSSolution& n, std::mt19937& rng, builder& construct, Params& p) {
unsigned kl = 1;
unsigned ku = I.n+1;
std::uniform_int_distribution<> dis(0);
std::vector<Job> remove(n.pi.begin()+kl-1,n.pi.begin()+ku);
unsigned left = ku-kl;
auto dst = remove.begin()+1;
for(unsigned i = 0; i < p.dc; i++, dst++, left--)
std::swap(*dst, *(dst+(dis(rng)%left)));
remove.erase(dst, remove.end());
auto nend = n.pi.end();
for (unsigned i = 1; i <= p.dc; i++)
nend = std::remove(n.pi.begin()+kl, nend, remove[i]);
std::fill(nend, n.pi.end(), 0);
for (unsigned i = 1; i <= p.dc; i++) {
std::vector<Job> insert = { 0, remove[i] };
construct.constructpFF(I,n,I.n-p.dc+i,kl,ku-p.dc+i-1,insert);
auto b = std::find(n.pi.begin()+1, n.pi.end(), remove[i]);
assert(b != n.pi.end());
unsigned best = n.ms;
unsigned bestj = 0;
unsigned index = (b - n.pi.begin()) + 1;
for (unsigned j = I.n-p.dc+i; j > index; j--) {
std::swap(n.pi[j], n.pi[j-1]);
n.computeMakespan(I,n.pi.size()-p.dc+i);
if (n.ms < best) {
best = n.ms;
bestj = j;
}
std::swap(n.pi[j], n.pi[j-1]);
}
if (bestj > 0) {
std::swap(n.pi[bestj], n.pi[bestj-1]);
}
}
n.computeMakespan(I);
}
inline void ils_giFF(Instance& I, PFSSolution& n, std::mt19937& rng, builder& construct, Params& p) {
unsigned kl = 1;
unsigned ku = I.n+1;
std::uniform_int_distribution<> dis(0);
std::vector<Job> remove(n.pi.begin()+kl-1,n.pi.begin()+ku);
unsigned left = ku-kl;
auto dst = remove.begin()+1;
for(unsigned i=0; i<p.dc; i++, dst++, left--)
std::swap(*dst,*(dst+(dis(rng)%left)));
remove.erase(dst,remove.end());
auto nend = n.pi.end();
for(unsigned i=1; i<=p.dc; i++)
nend=std::remove(n.pi.begin()+kl,nend,remove[i]);
std::fill(nend,n.pi.end(),0);
n.computeMakespan(I,n.pi.size()-p.dc);
lsps_iFF(I,n,construct,p.obj,kl,ku-p.dc,p.dc,p.n_ls,p.start,p.timelimit);
construct.constructpFF(I,n,I.n-p.dc+1,kl,ku-p.dc,remove);
}
inline void gi_ilsFF(Instance& I, PFSSolution& n, std::mt19937& rng, builder& construct, Params& p) {
unsigned kl = 1;
unsigned ku = I.n+1;
std::uniform_int_distribution<> dis(0);
std::vector<Job> remove(n.pi.begin()+kl-1,n.pi.begin()+ku);
unsigned left = ku-kl;
auto dst = remove.begin()+1;
for(unsigned i = 0; i < p.dc; i++, dst++, left--)
std::swap(*dst, *(dst+(dis(rng)%left)));
remove.erase(dst, remove.end());
auto nend = n.pi.end();
for (unsigned i = 1; i <= p.dc; i++)
nend = std::remove(n.pi.begin()+kl, nend, remove[i]);
std::fill(nend, n.pi.end(), 0);
for (unsigned i = 1; i <= p.dc; i++) {
std::vector<Job> insert = { 0, remove[i] };
construct.constructpFF(I,n,I.n-p.dc+i,kl,ku-p.dc+i-1,insert);
auto b = std::find(n.pi.begin()+1, n.pi.end(), remove[i]);
assert(b != n.pi.end());
insert.erase(insert.begin()+1);
nend = n.pi.end()-p.dc+i;
unsigned index = b - n.pi.begin();
if (index > 1) {
insert.push_back(n.pi[index-1]);
}
if (index < I.n-p.dc+i) {
insert.push_back(n.pi[index+1]);
}
for (unsigned j = 1; j < insert.size(); j++) {
nend = std::remove(n.pi.begin()+kl, nend, insert[j]);
}
std::fill(nend, n.pi.end(), 0);
construct.constructpFF(I,n,I.n-p.dc+i-(insert.size()-1)+1,kl,ku-p.dc+i-(insert.size()-1),insert);
}
}
inline void giIT1(Instance& I, PFSSolution& n, std::mt19937& rng, builder& construct, Params& p) {
unsigned kl = 1;
unsigned ku = I.n+1;
std::uniform_int_distribution<> dis(0);
std::vector<Job> remove(n.pi.begin()+kl-1,n.pi.begin()+ku);
unsigned left = ku-kl;
auto dst = remove.begin()+1;
for(unsigned i=0; i<p.dc; i++, dst++, left--)
std::swap(*dst,*(dst+(dis(rng)%left)));
remove.erase(dst,remove.end());
auto nend = n.pi.end();
for(unsigned i=1; i<=p.dc; i++)
nend=std::remove(n.pi.begin()+kl,nend,remove[i]);
std::fill(nend,n.pi.end(),0);
construct.constructpTT_IT1(I,n,I.n-p.dc+1,kl,ku-p.dc,remove);
}
inline void giIT2(Instance& I, PFSSolution& n, std::mt19937& rng, builder& construct, Params& p) {
unsigned kl = 1;
unsigned ku = I.n+1;
std::uniform_int_distribution<> dis(0);
std::vector<Job> remove(n.pi.begin()+kl-1,n.pi.begin()+ku);
unsigned left = ku-kl;
auto dst = remove.begin()+1;
for(unsigned i=0; i<p.dc; i++, dst++, left--)
std::swap(*dst,*(dst+(dis(rng)%left)));
remove.erase(dst,remove.end());
auto nend = n.pi.end();
for(unsigned i=1; i<=p.dc; i++)
nend=std::remove(n.pi.begin()+kl,nend,remove[i]);
std::fill(nend,n.pi.end(),0);
construct.constructpTT_IT2(I,n,I.n-p.dc+1,kl,ku-p.dc,remove);
}
inline void gi_aslsIT1(Instance& I, PFSSolution& n, std::mt19937& rng, builder& construct, Params& p) {
unsigned kl = 1;
unsigned ku = I.n+1;
std::uniform_int_distribution<> dis(0);
std::vector<Job> remove(n.pi.begin()+kl-1,n.pi.begin()+ku);
unsigned left = ku-kl;
auto dst = remove.begin()+1;
for(unsigned i = 0; i < p.dc; i++, dst++, left--)
std::swap(*dst, *(dst+(dis(rng)%left)));
remove.erase(dst, remove.end());
auto nend = n.pi.end();
for (unsigned i = 1; i <= p.dc; i++)
nend = std::remove(n.pi.begin()+kl, nend, remove[i]);
std::fill(nend, n.pi.end(), 0);
for (unsigned i = 1; i <= p.dc; i++) {
std::vector<Job> insert = { 0, remove[i] };
construct.constructpTT_IT1(I,n,I.n-p.dc+i,kl,ku-p.dc+i-1,insert);
auto b = std::find(n.pi.begin()+1, n.pi.end(), remove[i]);
assert(b != n.pi.end());
unsigned best = n.ms;
unsigned bestj = 0;
unsigned index = (b - n.pi.begin()) + 1;
for (unsigned j = I.n-p.dc+i; j > index; j--) {
std::swap(n.pi[j], n.pi[j-1]);
n.computeTotalTardiness(I,n.pi.size()-p.dc+i);
if (n.ms < best) {
best = n.ms;
bestj = j;
}
std::swap(n.pi[j], n.pi[j-1]);
}
if (bestj > 0) {
std::swap(n.pi[bestj], n.pi[bestj-1]);
}
}
n.computeTotalTardiness(I);
}
inline void gi_aslsIT2(Instance& I, PFSSolution& n, std::mt19937& rng, builder& construct, Params& p) {
unsigned kl = 1;
unsigned ku = I.n+1;
std::uniform_int_distribution<> dis(0);
std::vector<Job> remove(n.pi.begin()+kl-1,n.pi.begin()+ku);
unsigned left = ku-kl;
auto dst = remove.begin()+1;
for(unsigned i = 0; i < p.dc; i++, dst++, left--)
std::swap(*dst, *(dst+(dis(rng)%left)));
remove.erase(dst, remove.end());
auto nend = n.pi.end();
for (unsigned i = 1; i <= p.dc; i++)
nend = std::remove(n.pi.begin()+kl, nend, remove[i]);
std::fill(nend, n.pi.end(), 0);
for (unsigned i = 1; i <= p.dc; i++) {
std::vector<Job> insert = { 0, remove[i] };
construct.constructpTT_IT2(I,n,I.n-p.dc+i,kl,ku-p.dc+i-1,insert);
auto b = std::find(n.pi.begin()+1, n.pi.end(), remove[i]);
assert(b != n.pi.end());
unsigned best = n.ms;
unsigned bestj = 0;
unsigned index = (b - n.pi.begin()) + 1;
for (unsigned j = I.n-p.dc+i; j > index; j--) {
std::swap(n.pi[j], n.pi[j-1]);
n.computeTotalTardiness(I,n.pi.size()-p.dc+i);
if (n.ms < best) {
best = n.ms;
bestj = j;
}
std::swap(n.pi[j], n.pi[j-1]);
}
if (bestj > 0) {
std::swap(n.pi[bestj], n.pi[bestj-1]);
}
}
n.computeTotalTardiness(I);
}
inline void ils_giIT1(Instance& I, PFSSolution& n, std::mt19937& rng, builder& construct, Params& p) {
unsigned kl = 1;
unsigned ku = I.n+1;
std::uniform_int_distribution<> dis(0);
std::vector<Job> remove(n.pi.begin()+kl-1,n.pi.begin()+ku);
unsigned left = ku-kl;
auto dst = remove.begin()+1;
for(unsigned i=0; i<p.dc; i++, dst++, left--)
std::swap(*dst,*(dst+(dis(rng)%left)));
remove.erase(dst,remove.end());
auto nend = n.pi.end();
for(unsigned i=1; i<=p.dc; i++)
nend=std::remove(n.pi.begin()+kl,nend,remove[i]);
std::fill(nend,n.pi.end(),0);
n.computeTotalTardiness(I,n.pi.size()-p.dc);
lsps_iIT1(I,n,construct,p.obj,kl,ku-p.dc,p.dc,p.n_ls,p.start,p.timelimit);
construct.constructpTT_IT1(I,n,I.n-p.dc+1,kl,ku-p.dc,remove);
}
inline void ils_giIT2(Instance& I, PFSSolution& n, std::mt19937& rng, builder& construct, Params& p) {
unsigned kl = 1;
unsigned ku = I.n+1;
std::uniform_int_distribution<> dis(0);
std::vector<Job> remove(n.pi.begin()+kl-1,n.pi.begin()+ku);
unsigned left = ku-kl;
auto dst = remove.begin()+1;
for(unsigned i=0; i<p.dc; i++, dst++, left--)
std::swap(*dst,*(dst+(dis(rng)%left)));
remove.erase(dst,remove.end());
auto nend = n.pi.end();
for(unsigned i=1; i<=p.dc; i++)
nend=std::remove(n.pi.begin()+kl,nend,remove[i]);
std::fill(nend,n.pi.end(),0);
n.computeTotalTardiness(I,n.pi.size()-p.dc);
lsps_iIT2(I,n,construct,p.obj,kl,ku-p.dc,p.dc,p.n_ls,p.start,p.timelimit);
construct.constructpTT_IT2(I,n,I.n-p.dc+1,kl,ku-p.dc,remove);
}
inline void gi_ilsIT1(Instance& I, PFSSolution& n, std::mt19937& rng, builder& construct, Params& p) {
unsigned kl = 1;
unsigned ku = I.n+1;
std::uniform_int_distribution<> dis(0);
std::vector<Job> remove(n.pi.begin()+kl-1,n.pi.begin()+ku);
unsigned left = ku-kl;
auto dst = remove.begin()+1;
for(unsigned i = 0; i < p.dc; i++, dst++, left--)
std::swap(*dst, *(dst+(dis(rng)%left)));
remove.erase(dst, remove.end());
auto nend = n.pi.end();
for (unsigned i = 1; i <= p.dc; i++)
nend = std::remove(n.pi.begin()+kl, nend, remove[i]);
std::fill(nend, n.pi.end(), 0);
for (unsigned i = 1; i <= p.dc; i++) {
std::vector<Job> insert = { 0, remove[i] };
construct.constructpTT_IT1(I,n,I.n-p.dc+i,kl,ku-p.dc+i-1,insert);
auto b = std::find(n.pi.begin()+1, n.pi.end(), remove[i]);
assert(b != n.pi.end());
insert.erase(insert.begin()+1);
nend = n.pi.end()-p.dc+i;
unsigned index = b - n.pi.begin();
if (index > 1) {
insert.push_back(n.pi[index-1]);
}
if (index < I.n-p.dc+i) {
insert.push_back(n.pi[index+1]);
}
for (unsigned j = 1; j < insert.size(); j++) {
nend = std::remove(n.pi.begin()+kl, nend, insert[j]);
}
std::fill(nend, n.pi.end(), 0);
construct.constructpTT_IT1(I,n,I.n-p.dc+i-(insert.size()-1)+1,kl,ku-p.dc+i-(insert.size()-1),insert);
}
}
inline void gi_ilsIT2(Instance& I, PFSSolution& n, std::mt19937& rng, builder& construct, Params& p) {
unsigned kl = 1;
unsigned ku = I.n+1;
std::uniform_int_distribution<> dis(0);
std::vector<Job> remove(n.pi.begin()+kl-1,n.pi.begin()+ku);
unsigned left = ku-kl;
auto dst = remove.begin()+1;
for(unsigned i = 0; i < p.dc; i++, dst++, left--)
std::swap(*dst, *(dst+(dis(rng)%left)));
remove.erase(dst, remove.end());
auto nend = n.pi.end();
for (unsigned i = 1; i <= p.dc; i++)
nend = std::remove(n.pi.begin()+kl, nend, remove[i]);
std::fill(nend, n.pi.end(), 0);
for (unsigned i = 1; i <= p.dc; i++) {
std::vector<Job> insert = { 0, remove[i] };
construct.constructpTT_IT2(I,n,I.n-p.dc+i,kl,ku-p.dc+i-1,insert);
auto b = std::find(n.pi.begin()+1, n.pi.end(), remove[i]);
assert(b != n.pi.end());
insert.erase(insert.begin()+1);
nend = n.pi.end()-p.dc+i;
unsigned index = b - n.pi.begin();
if (index > 1) {
insert.push_back(n.pi[index-1]);
}
if (index < I.n-p.dc+i) {
insert.push_back(n.pi[index+1]);
}
for (unsigned j = 1; j < insert.size(); j++) {
nend = std::remove(n.pi.begin()+kl, nend, insert[j]);
}
std::fill(nend, n.pi.end(), 0);
construct.constructpTT_IT2(I,n,I.n-p.dc+i-(insert.size()-1)+1,kl,ku-p.dc+i-(insert.size()-1),insert);
}
}
template <typename Tiebreak>
inline void gi_np(Instance& I, NPFSSolution& n, std::mt19937& rng, nBuilder& construct, Tiebreak tiebreak, Params& params) {
unsigned dc = params.dc_np;
std::vector<Job> remove(I.n+1, 0);
std::iota(remove.begin(), remove.end(), 0);
std::shuffle(remove.begin()+1, remove.end(), rng);
remove.erase(remove.begin()+1+dc, remove.end());
for(unsigned r = 1; r < remove.size(); r++) {
for(unsigned i = 1; i <= I.m; i++) {
unsigned dj = 1;
for(unsigned j = 1; j <= I.n; j++) {
if (n.pi[i][j] != remove[r]) {
n.pi[i][dj] = n.pi[i][j];
dj++;
}
}
while (dj <= I.n) {
n.pi[i][dj] = 0;
dj++;
}
}
}
if (params.obj == 'm')
construct.constructnpNEW(n, I.n-dc+1, remove, tiebreak);
else if (params.obj == 'f')
construct.constructnpNEWCsum(n, I.n-dc+1, remove, tiebreak);
else
construct.constructnpNEWTT(n, I.n-dc+1, remove, tiebreak);
}
inline void gi_IT1_np(Instance& I, NPFSSolution& n, std::mt19937& rng, nBuilder& construct, Params& params) {
unsigned dc = params.dc_np;
std::vector<Job> remove(I.n+1, 0);
std::iota(remove.begin(), remove.end(), 0);
std::shuffle(remove.begin()+1, remove.end(), rng);
remove.erase(remove.begin()+1+dc, remove.end());
for(unsigned r = 1; r < remove.size(); r++) {
for(unsigned i = 1; i <= I.m; i++) {
unsigned dj = 1;
for(unsigned j = 1; j <= I.n; j++) {
if (n.pi[i][j] != remove[r]) {
n.pi[i][dj] = n.pi[i][j];
dj++;
}
}
while (dj <= I.n) {
n.pi[i][dj] = 0;
dj++;
}
}
}
construct.constructnpNEWTT_IT1(n, I.n-dc+1, remove);
}
inline void gi_IT2_np(Instance& I, NPFSSolution& n, std::mt19937& rng, nBuilder& construct, Params& params) {
unsigned dc = params.dc_np;
std::vector<Job> remove(I.n+1, 0);
std::iota(remove.begin(), remove.end(), 0);
std::shuffle(remove.begin()+1, remove.end(), rng);
remove.erase(remove.begin()+1+dc, remove.end());
for(unsigned r = 1; r < remove.size(); r++) {
for(unsigned i = 1; i <= I.m; i++) {
unsigned dj = 1;
for(unsigned j = 1; j <= I.n; j++) {
if (n.pi[i][j] != remove[r]) {
n.pi[i][dj] = n.pi[i][j];
dj++;
}
}
while (dj <= I.n) {
n.pi[i][dj] = 0;
dj++;
}
}
}
construct.constructnpNEWTT_IT2(n, I.n-dc+1, remove);
}
|
53ade48d9bb0962fb45d74d0c958356baf6c2020 | 64df0cf973b765fdbefebaf60a4327ddb0c4f93c | /examples/stroke/stroke_data.h | e206ef89953254063871bb8c2651be8560de616a | [] | no_license | coroner4817/tinygl | 41ee6af3ac99e6fe1670a71c34b0f3f01f7a5f07 | 43764321dda4aa5a3b68e6cc8ad3fbd26a3faa4e | refs/heads/master | 2023-02-10T01:04:08.065201 | 2020-07-21T20:01:16 | 2020-09-10T11:47:43 | 276,023,454 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,857 | h | stroke_data.h | #pragma once
#include "tinygl/common.h"
std::vector<glm::vec3> test_stroke1 = {
{-0.303165, -0.001507, 0.085891},
{-0.296921, 0.007712, 0.082226},
{-0.289813, 0.015978, 0.078059},
{-0.280842, 0.025214, 0.073351},
{-0.271236, 0.035341, 0.069314},
{-0.254088, 0.048873, 0.063034},
{-0.244863, 0.054639, 0.059778},
{-0.232702, 0.060863, 0.056778},
{-0.213871, 0.068665, 0.053328},
{-0.201756, 0.071050, 0.050882},
{-0.195662, 0.071714, 0.049912},
{-0.174885, 0.073042, 0.048609},
{-0.156864, 0.071380, 0.047530},
{-0.152091, 0.070303, 0.047238},
{-0.134531, 0.066016, 0.047813},
{-0.123939, 0.062071, 0.048713},
{-0.116051, 0.058356, 0.049759},
{-0.104560, 0.052123, 0.051597},
{-0.097327, 0.047656, 0.053019},
{-0.092422, 0.044755, 0.053996},
{-0.086530, 0.042684, 0.056288},
{-0.082899, 0.043456, 0.058154},
{-0.083339, 0.045038, 0.058755},
{-0.087070, 0.049568, 0.060844},
{-0.084568, 0.054344, 0.065377},
};
std::vector<glm::vec3> test_stroke2 = {
{-0.331100, -0.089480, 0.089438},
{-0.325670, -0.084504, 0.089643},
{-0.320819, -0.083711, 0.088236},
{-0.309943, -0.081782, 0.085915},
{-0.301214, -0.081292, 0.084585},
{-0.293370, -0.082165, 0.083208},
{-0.282535, -0.083645, 0.082777},
{-0.268001, -0.087245, 0.084239},
{-0.263511, -0.088866, 0.085326},
{-0.252675, -0.094071, 0.088781},
{-0.245301, -0.100251, 0.092516},
{-0.233499, -0.109312, 0.100710},
{-0.227430, -0.114409, 0.105819},
{-0.220028, -0.122009, 0.113748},
{-0.212476, -0.130195, 0.121895},
{-0.200454, -0.138779, 0.134773},
{-0.190888, -0.144218, 0.142623},
{-0.177298, -0.149774, 0.151555},
{-0.161906, -0.154259, 0.160056},
{-0.140762, -0.158620, 0.170251},
{-0.124232, -0.160274, 0.178389},
{-0.108191, -0.159737, 0.186267},
{-0.094410, -0.158157, 0.192748},
{-0.073246, -0.151860, 0.201825},
{-0.059584, -0.144880, 0.207409},
{-0.036156, -0.126596, 0.214599},
{-0.016644, -0.104493, 0.218749},
{-0.003830, -0.087871, 0.220167},
{0.006903, -0.072454, 0.220114},
{0.017132, -0.055696, 0.220331},
{0.028877, -0.026715, 0.217945},
{0.035037, -0.009614, 0.215203},
{0.038391, 0.008397, 0.211826},
{0.045450, 0.055899, 0.193794},
{0.046711, 0.069315, 0.186816},
{0.045708, 0.085883, 0.176237},
{0.044178, 0.101755, 0.165423},
{0.040902, 0.119431, 0.150654},
{0.036946, 0.130013, 0.137291},
{0.030613, 0.136524, 0.123256},
{0.019777, 0.140368, 0.103503},
{0.012030, 0.138866, 0.090775},
{0.005124, 0.134707, 0.077122},
{-0.002569, 0.126110, 0.063788},
{-0.012314, 0.109509, 0.048289},
{-0.019696, 0.093273, 0.038452},
{-0.024587, 0.076159, 0.031038},
{-0.028459, 0.061375, 0.027086},
{-0.035510, 0.036104, 0.023454},
{-0.041126, 0.016584, 0.023203},
{-0.047596, -0.003163, 0.024988},
{-0.051890, -0.016723, 0.027486},
{-0.056400, -0.033419, 0.031824},
{-0.059361, -0.048370, 0.037033},
{-0.062162, -0.069575, 0.045546},
{-0.064430, -0.083614, 0.052546},
{-0.068324, -0.107659, 0.067159},
{-0.069143, -0.119390, 0.075783},
{-0.068169, -0.129852, 0.083879},
{-0.065336, -0.143744, 0.098359},
{-0.065177, -0.152804, 0.109752},
{-0.065834, -0.158783, 0.118775},
{-0.067741, -0.165497, 0.130969},
{-0.069187, -0.169569, 0.142455},
{-0.072934, -0.170352, 0.156632},
{-0.076649, -0.167826, 0.166578},
{-0.082985, -0.163387, 0.177611},
{-0.087982, -0.156978, 0.186268},
{-0.094885, -0.143658, 0.194768},
{-0.101448, -0.112552, 0.199299},
{-0.104540, -0.089521, 0.198612},
{-0.104206, -0.070467, 0.196056},
{-0.102556, -0.050810, 0.192367},
{-0.087829, -0.009443, 0.176961},
{-0.076925, 0.005936, 0.169196},
{-0.064856, 0.018484, 0.160480},
{-0.055103, 0.026683, 0.153639},
{-0.019783, 0.042175, 0.135608},
{-0.007999, 0.044813, 0.130310},
{0.008012, 0.046647, 0.124516},
{0.030981, 0.046140, 0.118232},
{0.042426, 0.044111, 0.115753},
{0.055777, 0.041927, 0.113657},
{0.070586, 0.037472, 0.111904},
{0.089659, 0.028362, 0.110973},
{0.097499, 0.023133, 0.110948},
{0.107366, 0.014719, 0.111475},
{0.113930, 0.005350, 0.112520},
{0.120135, -0.006943, 0.114306},
{0.128588, -0.027878, 0.119070},
{0.131809, -0.038993, 0.122077},
{0.134440, -0.052085, 0.126506},
{0.136081, -0.062634, 0.130532},
{0.137380, -0.081462, 0.139606},
{0.138349, -0.095371, 0.146892},
{0.139890, -0.103915, 0.152996},
{0.142533, -0.110951, 0.159112},
{0.146794, -0.117740, 0.166101},
{0.153876, -0.128182, 0.177751},
{0.158567, -0.132719, 0.185541},
{0.162898, -0.135626, 0.191054},
{0.186510, -0.139950, 0.211156},
{0.194985, -0.138354, 0.216964},
{0.208014, -0.136047, 0.225321},
{0.219344, -0.130533, 0.232519},
{0.236805, -0.105619, 0.240689},
{0.245365, -0.092742, 0.242757},
{0.252936, -0.077445, 0.244750},
{0.258632, -0.057803, 0.242700},
{0.262658, -0.041762, 0.240427},
{0.264001, -0.024025, 0.237511},
{0.264007, -0.009413, 0.232515},
{0.262014, 0.014162, 0.225364},
{0.252323, 0.045205, 0.211690},
{0.245253, 0.055819, 0.205041},
{0.233022, 0.072495, 0.191311},
{0.223973, 0.078006, 0.181297},
{0.204841, 0.075456, 0.162779},
{0.192514, 0.062079, 0.148452},
{0.187427, 0.049459, 0.141565},
{0.183193, 0.033167, 0.135227},
{0.174834, -0.014833, 0.132137},
{0.173210, -0.029613, 0.133886},
{0.170671, -0.048037, 0.137835},
{0.162306, -0.074282, 0.146043},
{0.151840, -0.100559, 0.156648},
{0.144416, -0.116301, 0.163636},
{0.134745, -0.131328, 0.171135},
{0.122178, -0.146526, 0.179321},
{0.105160, -0.169248, 0.193455},
{0.095268, -0.182659, 0.202108},
{0.086920, -0.190767, 0.207964},
{0.077848, -0.196198, 0.213205},
{0.070329, -0.200399, 0.217458},
{0.063842, -0.201723, 0.219451},
{0.051539, -0.199286, 0.223386},
{0.043345, -0.197911, 0.224482},
{0.045501, -0.186940, 0.220412},
}; |
9b680d45a23739ed62d5f19d396aff27705ad38a | 07fe910f4a2c7d14e67db40ab88a8c91d9406857 | /game/mga/addons/Model_Intelligence/ConnectionPoint_Method.cpp | a86f9fbe77b7bdd35b4e1f2272483e6cf8b851b5 | [] | no_license | SEDS/GAME | e6d7f7a8bb034e421842007614d306b3a6321fde | 3e4621298624b9189b5b6b43ff002306fde23f08 | refs/heads/master | 2021-03-12T23:27:39.115003 | 2015-09-22T15:05:33 | 2015-09-22T15:05:33 | 20,278,561 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,401 | cpp | ConnectionPoint_Method.cpp | // $Id$
#include "StdAfx.h"
#include "ConnectionPoint_Method.h"
#include "Connection.h"
#include "Object_Value.h"
//
// Default Constructor
//
ConnectionPoint_Method::ConnectionPoint_Method (std::string & role)
: role_ (role)
{
}
//
// Destructor
//
ConnectionPoint_Method::~ConnectionPoint_Method (void)
{
}
//
// evaluate
//
Value * ConnectionPoint_Method::evaluate (Ocl_Context & res,
GAME::Mga::Object caller)
{
GAME::Mga::Connection conn = GAME::Mga::Connection::_narrow (caller);
GAME::Mga::ConnectionPoint point;
// Collecting the connection points of the connection
GAME::Mga::ConnectionPoints conpts;
conn->connection_points (conpts);
GAME::Mga::ConnectionPoints::iterator
cit = conpts.begin (), cit_end = conpts.end ();
// Filtering out the valid connection point
for (; cit != cit_end; ++cit)
{
if (cit->item ()->role () == this->role_)
point = cit->item ();
}
return new Object_Value (point);
}
//
// evaluate
//
Value * ConnectionPoint_Method::evaluate (Ocl_Context & res,
Value * caller)
{
Object_Value * iv = dynamic_cast <Object_Value *> (caller);
if (iv != 0)
{
GAME::Mga::Object obj = iv->value ();
GAME::Mga::Connection conn = GAME::Mga::Connection::_narrow (obj);
GAME::Mga::ConnectionPoint point;
// Collecting the connection points of the connection
GAME::Mga::ConnectionPoints conpts;
conn->connection_points (conpts);
GAME::Mga::ConnectionPoints::iterator
cit = conpts.begin (), cit_end = conpts.end ();
// Filtering out the valid connection point
for (; cit != cit_end; ++cit)
{
if (cit->item ()->role () == this->role_)
point = cit->item ();
}
return new Object_Value (point);
}
else
{
GAME::Mga::ConnectionPoint point;
return new Object_Value (point);
}
}
//
// is_filter
//
bool ConnectionPoint_Method::is_filter (void)
{
return false;
}
//
// is_association
//
bool ConnectionPoint_Method::is_association (void)
{
return false;
}
//
// is_containment
//
bool ConnectionPoint_Method::is_containment (void)
{
return false;
}
//
// is_reference
//
bool ConnectionPoint_Method::is_reference (void)
{
return false;
} |
d7721c4f166357889c624a0ce7080c9597b4c3b4 | f84344c4f667804f27e559a1e92b28b00a8a22e9 | /Database Implementation/C++/ibtree/tree/PLIDB.cc | 49efd3fade81cd8fbe69d935a68b36d88829fd01 | [] | no_license | TonHai1111/DB_Implementation | 27f79f0858767ba8ced4d460d1e9f7481968ae8b | 5a1057f2b178bc9b3337cbbfb585c5af496f47d9 | refs/heads/main | 2023-06-15T21:24:16.175190 | 2021-05-07T20:34:46 | 2021-05-07T20:34:46 | 354,896,195 | 0 | 0 | null | 2021-05-07T20:34:46 | 2021-04-05T16:20:32 | Python | UTF-8 | C++ | false | false | 5,627 | cc | PLIDB.cc | #if defined(_WIN32) || defined(_WIN64)
//It includes this library when the application runs on a windows operating system.
#include <windows.h>
#endif
#include "PLIDB.h"
constexpr unsigned int hash(const char *s, int off = 0) {
return !s[off] ? 5381 : (hash(s, off + 1) * 33) ^ s[off];
}
//This function is used to instantiate the database system with a parameter as a string to the directory where the database is located.
PLIDB::PLIDB(const std::string& dbname)
{
{
dnName= dbname + "-PLI";
CreateFolder(dnName);
iBPlusTree = new IBPlusTree(dnName);
struct stat buffer;
//Verify if the database already exists?
if (stat((dnName + "/" + "ibPlusTreeMD.dat").c_str(), &buffer) != 0)
{
//This is when the database does not previously exists and it need to be constructed with its historical initialization.
std::ifstream fin1("./listBuckets_sorted_2.txt");
Interval interval;
interval.start = 0.0;
interval.end = 0.0;
int bucketID = 0;
IBTree* tree = new IBTree(dnName, iBPlusTree->threadManager);
int count = 0;
int number = 50000;
std::string line;
bool b = false;
int i = 0;
Interval interval2;
while (std::getline(fin1, line))
{
std::vector<std::string> tokens = StringFunctions::Split(line, " ");
if (tokens[0] == "interval")
{
if (count >= number) break;
i = bucketID = -std::stoi(tokens[1].replace(tokens[1].find_first_of(':'), 1, ""));
BucketInfo bi;
bi.offset = bucketID;
interval.start = std::stof(tokens[2]);
interval.end = std::stof(tokens[3]);
if (bucketID == 0)
{
b = true;
interval2.start = interval.start;
interval2.end = interval.end;
continue;
}
tree->insertBucket(interval, bi);
count += 1;
}
}
if (b)
{
BucketInfo bi;
bi.offset = i - 1;
tree->insertBucket(interval2, bi);
}
fin1.close();
iBPlusTree->setIBTree1(tree);
iBPlusTree->copyStructure(tree);
}
else
{
//This is when the database already has been constructed and is filled with data.
std::string STRING;
std::ifstream infile;
infile.open(dnName + "/" + "Config");
getline(infile, STRING);
infile.close();
switch (hash(STRING.c_str()))
{
case hash("integer"): keyType = typeid(int).name();
Data::kt = KeyType::Integer;
break;
case hash("double"): keyType = typeid(double).name();
Data::kt = KeyType::Double;
break;
case hash("float"): keyType = typeid(float).name();
Data::kt = KeyType::Float;
break;
case hash("class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >"): keyType = typeid(std::string).name();
Data::kt = KeyType::String;
}
iBPlusTree->read();
}
}
}
void PLIDB::SetKeyType(KeyType KeyType)
{
//std::cout << "set1\n";
//std::cout << iBPlusTree->rootNode->length;
struct stat buffer;
if (stat((dnName + "/" + "ibPlusTreeMD.dat").c_str(), &buffer) != 0)
//if (iBPlusTree->rootNode->length== 0)
{
{
//std::cout << "set\n";
Data::kt = KeyType;
//typeid(int);
//const std::type_info& ktt = typeid(int);
/*const char* str = typeid(int).name();
std::cout << str << "\n";
const char* str2 = typeid(float).name();
std::cout << str2 << "\n";
const char* str3 = typeid(double).name();
std::cout << str3 << "\n";
const char* str4 = typeid(std::string).name();
std::cout << str4 << "\n";*/
switch (Data::kt)
{
case Integer: keyType = std::string(typeid(int).name());
break;
case Double: keyType = std::string(typeid(double).name());
break;
case Float: keyType = std::string(typeid(float).name());
break;
case String: keyType = std::string(typeid(std::string).name());
}
changed = true;
}
}
//else
{
//std::cout << "The type of the key is already selected.\n";
}
}
//This function is called when the database gets destructed.
PLIDB::~PLIDB()
{
{
if (changed)
{
iBPlusTree->save();
if (keyType != "")
{
std::ofstream* fout = new std::ofstream(dnName + "/" + "Config", std::ofstream::out);
(*fout) << keyType;
fout->close();
}
}
}
}
//This function is used ti insert a key with its value into the database.
int PLIDB::Put(const Data& key, const std::string& value)
{
{
changed = true;
int result = iBPlusTree->insertTuple(key, (char*)value.c_str());
return result;
}
}
//This function is used to search the database on a interval(the first parameter).
//It returns the tuples through the second parameter(ListTUples)
//The third parameter is th number of files, read and searched only to find the tuples being in the specified range.
//The fourth parameter is the total number of files, read during the search that is happening for the threads in the concurrency queue.
int PLIDB::Get(
const Interval & interval,
ReturningList* values, int* FileAccess, int* Ft)
{
{
std::string output;
return iBPlusTree->search(values, interval, FileAccess, Ft);
}
}
//This function is used to create folder on the path given by first parameter.
void PLIDB::CreateFolder(std::string ibPlusDataBase)
{
std::string x = ".//" + ibPlusDataBase;
#ifdef _WIN32 || _WIN64
DWORD ftyp = GetFileAttributesA(ibPlusDataBase.c_str());
if ((ftyp & FILE_ATTRIBUTE_DIRECTORY))
CreateDirectory(x.c_str(), NULL);
#elif __linux__
const int dir_err = mkdir(ibPlusDataBase.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
#endif
}
|
16058ae9eeec712f11027d3d5b27024ed50793cb | c4525cc972e0649ae2f27cda58391d1d952dc538 | /src/widget/label.cpp | d304455dbbe28138ca3c1377fed48806d799ddfd | [
"MIT"
] | permissive | thknepper/CPPurses | c32aa3e50dc548c8b24efd01218e0a4ea39c1cf3 | 342a389746b3efa8eac339d110ad6aeb0423b9db | refs/heads/master | 2020-12-26T05:04:35.436005 | 2019-11-28T05:22:17 | 2019-11-28T05:22:17 | 237,393,602 | 1 | 0 | MIT | 2020-01-31T08:58:47 | 2020-01-31T08:58:47 | null | UTF-8 | C++ | false | false | 373 | cpp | label.cpp | #include <cppurses/widget/widgets/label.hpp>
#include <utility>
#include <cppurses/painter/glyph_string.hpp>
#include <cppurses/widget/widgets/text_display.hpp>
namespace cppurses {
Label::Label(Glyph_string text) : Text_display{std::move(text)} {
this->set_name("Label");
this->height_policy.fixed(1);
this->disable_word_wrap();
}
} // namespace cppurses
|
2eb416d1138621a0fd03f86dbb3cc8c62e3fcdc6 | 641d206fca37ef4739468ce5a12759e7c6e1fb1e | /cpp/simulation.cpp | e55f07467d899a424429ac00bb8b43c3bd79677c | [] | no_license | herobd/thesis-code | 423cb1514ba790b562cb0b9697efb8dc78f6ddbd | 83f8bac332d3e7b1b89b8c6782339439bf022ae6 | refs/heads/master | 2021-04-15T15:56:56.732979 | 2018-03-02T23:46:25 | 2018-03-02T23:46:25 | 53,702,809 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 19,315 | cpp | simulation.cpp | #include <atomic>
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "Simulator.h"
#include "CATTSS.h"
#include "CTCWrapper.h"
using namespace std;
using namespace cv;
void controlLoop(CATTSS* cattss, atomic_bool* cont)
{
while(1)
{
cout<<"CONTROL:"<<endl<<": quit"<<endl<<": show"<<endl<<": manual"<<endl<<": save"<<endl;;
string line;
getline(cin, line);
if (line.compare("quit")==0)
{
cattss->misc("stopSpotting");
cont->store(false);
break;
}
else if (line.compare("show")==0)
{
cattss->misc("showCorpus");
}
else if (line.compare("manual")==0)
{
cattss->misc("manualFinish");
}
else if (line.compare("save")==0)
{
cattss->misc("save");
}
}
}
void threadLoop(CATTSS* cattss, Simulator* sim, atomic_bool* cont, bool noManual)
{
string prevNgram="";
int slept=0;
thread::id thread_id = this_thread::get_id();
stringstream ss;
ss<<thread_id;
string thread = ss.str();
while (cont->load())
{
BatchWraper* batch;
if (GlobalK::knowledge()->MANUAL_LINES)
{
batch= cattss->getLineBatch(500);
}
else
batch = cattss->getBatch(5,500,0,prevNgram);
if (batch->getType()==SPOTTINGS)
{
string id;
vector<string> ids;
string ngram;
vector<Location> locs;
vector<string> gt;
batch->getSpottings(&id,&ngram,&ids,&locs,>);
vector<int> labels = sim->spottings(ngram,locs,gt,prevNgram);
#ifdef DEBUG_AUTO
vector<Mat> images = batch->getImages();
for (int i=0; i<labels.size(); i++)
{
if (gt[i].length()>2)
{
string name = thread;
if (labels[i])
name+="_TRUE";
else
name+="_FALSE";
imshow(name,images.at(i));
do
{
cout<<name<<"> ["<<ngram<<"] Loc page:"<<locs[i].pageId<<", bb: "<<locs[i].x1<<" "<<locs[i].y1<<" "<<locs[i].x2<<" "<<locs[i].y2<<endl;
}
while(waitKey() != 10);//enter
}
}
#endif
cattss->updateSpottings(id,ids,labels,0);
prevNgram = ngram;
}
else if (batch->getType()==NEW_EXEMPLARS)
{
string id;
vector<string> ngrams;
vector<Location> locs;
batch->getNewExemplars(&id,&ngrams,&locs);
vector<int> labels = sim->newExemplars(ngrams,locs,prevNgram);
#ifdef DEBUG_AUTO
vector<Mat> images = batch->getImages();
for (int i=0; i<labels.size(); i++)
{
string name = thread;
if (labels[i])
name+="_TRUE";
else
name+="_FALSE";
imshow(name,images[i]);
do
{
cout<<name<<"> ["<<ngrams[i]<<"] Loc page:"<<locs[i].pageId<<", bb: "<<locs[i].x1<<" "<<locs[i].y1<<" "<<locs[i].x2<<" "<<locs[i].y2<<endl;
}
while(waitKey() != 10);//enter
}
#endif
cattss-> updateNewExemplars(id,labels,0);
prevNgram=ngrams.back();
}
else if (batch->getType()==TRANSCRIPTION)
{
string batchId;
int wordIndex;
vector<SpottingPoint> spottings;
vector<string> poss;
bool manual;
string gt;
batch->getTranscription(&batchId,&wordIndex,&spottings,&poss,&manual,>);
string trans;
if (manual)
{
trans=sim->manual(wordIndex,poss,gt,prevNgram.compare("#")==0);
prevNgram="#";
}
else
{
trans=sim->transcription(wordIndex,spottings,poss,gt,prevNgram.compare("!")==0);
prevNgram="!";
}
#ifdef DEBUG_AUTO
#endif
cattss->updateTranscription(batchId,trans,manual);
}
else if (batch->getType()==RAN_OUT)
{
//this_thread::sleep_for(chrono::minutes(15));
//slept+=15;
prevNgram="_";
if (noManual)
{
cout<<"manual hit, finishing"<<endl;
cattss->misc("stopSpotting");
cont->store(false);
string misTrans;
float accTrans,pWordsTrans;
float pWords80_100, pWords60_80, pWords40_60, pWords20_40, pWords0_20, pWords0, pWordsBad;
string misTrans_IV;
float accTrans_IV,pWordsTrans_IV;
float pWords80_100_IV, pWords60_80_IV, pWords40_60_IV, pWords20_40_IV, pWords0_20_IV, pWords0_IV;
cattss->getStats(&accTrans,&pWordsTrans, &pWords80_100, &pWords60_80, &pWords40_60, &pWords20_40, &pWords0_20, &pWords0, &pWordsBad, &misTrans,
&accTrans_IV,&pWordsTrans_IV, &pWords80_100_IV, &pWords60_80_IV, &pWords40_60_IV, &pWords20_40_IV, &pWords0_20_IV, &pWords0_IV, &misTrans_IV);
misTrans="[FINAL/MANUAL] "+misTrans;
GlobalK::knowledge()->saveTrack(accTrans,pWordsTrans, pWords80_100, pWords60_80, pWords40_60, pWords20_40, pWords0_20, pWords0, pWordsBad, misTrans,
accTrans_IV,pWordsTrans_IV, pWords80_100_IV, pWords60_80_IV, pWords40_60_IV, pWords20_40_IV, pWords0_20_IV, pWords0_IV, misTrans_IV);
GlobalK::knowledge()->writeTrack();
}
else
{
cout<<"ran out, so manual finish."<<endl;
cattss->misc("manualFinish");
}
}
else if (batch->getType()==CONTINUE_WORKING)
{
this_thread::sleep_for(chrono::minutes(1));
slept+=1;
bool spotterRunning, taskQueueEmpty;
batch->getDebug(&spotterRunning,&taskQueueEmpty);
cout<<"continue working: ";
if (spotterRunning)
cout<<"spotter running ";
else
cout<<"spotter finished ";
cout <<"taskQueue ";
if (!taskQueueEmpty)
cout<<"not ";
cout<<" empty."<<endl;
}
else
{
cout<<"Blank batch given to sim"<<endl;
if (prevNgram.compare("---")==0)
{
cattss->misc("stopSpotting");
cont->store(false);
string misTrans;
float accTrans,pWordsTrans;
float pWords80_100, pWords60_80, pWords40_60, pWords20_40, pWords0_20, pWords0, pWordsBad;
string misTrans_IV;
float accTrans_IV,pWordsTrans_IV;
float pWords80_100_IV, pWords60_80_IV, pWords40_60_IV, pWords20_40_IV, pWords0_20_IV, pWords0_IV;
cattss->getStats(&accTrans,&pWordsTrans, &pWords80_100, &pWords60_80, &pWords40_60, &pWords20_40, &pWords0_20, &pWords0, &pWordsBad, &misTrans,
&accTrans_IV,&pWordsTrans_IV, &pWords80_100_IV, &pWords60_80_IV, &pWords40_60_IV, &pWords20_40_IV, &pWords0_20_IV, &pWords0_IV, &misTrans_IV);
misTrans="[FINAL/BLANK DONE] "+misTrans;
GlobalK::knowledge()->saveTrack(accTrans,pWordsTrans, pWords80_100, pWords60_80, pWords40_60, pWords20_40, pWords0_20, pWords0, pWordsBad, misTrans,
accTrans_IV,pWordsTrans_IV, pWords80_100_IV, pWords60_80_IV, pWords40_60_IV, pWords20_40_IV, pWords0_20_IV, pWords0_IV, misTrans_IV);
GlobalK::knowledge()->writeTrack();
}
else
{
this_thread::sleep_for(chrono::minutes(1));
slept+=1;
if (prevNgram[0]=='-')
prevNgram+="-";
else
prevNgram="-";
}
}
delete batch;
}
cout<<"Thread slept: "<<slept<<endl;
}
int main(int argc, char** argv)
{
//Mat test(45036,45036,CV_32F);
/*
cout<<"1"<<endl;
CTCWrapper ctcWrapper(28, 10);
Mat cpv = Mat::zeros(27,14,CV_32F);
for (int i=0; i<7; i++)
cpv.at<float>(1,i)=1;
for (int i=7; i<14; i++)
cpv.at<float>(2,i)=1;
float loss = ctcWrapper.loss(cpv,"ab");
cout<<loss<<" "<<loss/cpv.cols<<endl;
cout<<"2"<<endl;
cpv = Mat::zeros(27,21,CV_32F);
for (int i=0; i<7; i++)
cpv.at<float>(1,i)=1;
for (int i=7; i<14; i++)
cpv.at<float>(2,i)=1;
for (int i=14; i<21; i++)
cpv.at<float>(2,i)=1;
loss = ctcWrapper.loss(cpv,"ab");
cout<<loss<<" "<<loss/cpv.cols<<endl;
cout<<"3"<<endl;
cpv = Mat::zeros(27,14,CV_32F);
for (int i=0; i<7; i++)
cpv.at<float>(2,i)=1;
for (int i=7; i<14; i++)
cpv.at<float>(1,i)=1;
loss = ctcWrapper.loss(cpv,"ab");
cout<<loss<<" "<<loss/cpv.cols<<endl;
cpv = Mat::zeros(27,14,CV_32F);
for (int i=0; i<7; i++)
cpv.at<float>(3,i)=1;
for (int i=7; i<14; i++)
cpv.at<float>(4,i)=1;
loss = ctcWrapper.loss(cpv,"ab");
cout<<loss<<" "<<loss/cpv.cols<<endl;
cpv = Mat::zeros(27,14,CV_32F);
for (int i=0; i<7; i++)
cpv.at<float>(4,i)=1;
for (int i=7; i<14; i++)
cpv.at<float>(3,i)=1;
loss = ctcWrapper.loss(cpv,"ab");
cout<<loss<<" "<<loss/cpv.cols<<endl;
cpv = Mat::zeros(27,14,CV_32F);
for (int i=0; i<7; i++)
cpv.at<float>(0,i)=1;
for (int i=7; i<14; i++)
cpv.at<float>(1,i)=1;
loss = ctcWrapper.loss(cpv,"ab");
cout<<loss<<" "<<loss/cpv.cols<<endl;
cpv = Mat::zeros(27,14,CV_32F);
for (int i=0; i<7; i++)
cpv.at<float>(0,i)=1;
for (int i=7; i<14; i++)
cpv.at<float>(0,i)=1;
loss = ctcWrapper.loss(cpv,"ab");
cout<<loss<<" "<<loss/cpv.cols<<endl;
cout<<"8"<<endl;
cpv = Mat::zeros(27,6,CV_32F);
for (int i=0; i<3; i++)
cpv.at<float>(1,i)=1;
for (int i=3; i<6; i++)
cpv.at<float>(2,i)=1;
loss = ctcWrapper.loss(cpv,"ab");
cout<<loss<<" "<<loss/cpv.cols<<endl;
cout<<"9"<<endl;
cpv = Mat::zeros(27,14,CV_32F);
for (int i=0; i<7; i++)
cpv.at<float>(1,i)=1;
for (int i=7; i<14; i++)
cpv.at<float>(2,i)=1;
cpv.at<float>(1,4)=0.5;
cpv.at<float>(3,4)=0.5;
loss = ctcWrapper.loss(cpv,"ab");
cout<<loss<<" "<<loss/cpv.cols<<endl;
return 3;
//*/
int numSpottingThreads = 1;//CNNSPPSpotter will use the same network object
int numSimThreads=1;
//set<int> nsOfInterest;
string dataname="BENTHAM";
string lexiconFile = "/home/brian/intel_index/data/wordsEnWithNames.txt";
string pageImageDir = "/home/brian/intel_index/data/bentham/BenthamDatasetR0-Images/Images/Pages";
string segmentationFile = "/home/brian/intel_index/data/bentham/ben_cattss_c_corpus.gtp";
string ngramWWFile = "/home/brian/intel_index/data/bentham/customWidths.txt";
string charSegFile = "/home/brian/intel_index/data/bentham/manual_segmentations.csv";
string spottingModelPrefix = "/home/brian/intel_index/data/bentham/network/phocnet_msf";//"model/CATTSS_BENTHAM";
string savePrefix = "save/sim_net_BENTHAM";
string SR_mode="fancy";
if (argc==1)
{
cout<<"usage: "<<argv[0]<<" savePrefix simSave.csv [numSimThreads OR -FLAGS] [fancy,take_from_top,otsu_fixed,none_take_from_top,none,gaussian_draw,fancy_one,fancy_two, two_walk, phoc_trans,cpv_trans,web_trans,cluster_step,cluster_top,manual] lexiconFile.txt pageImageDir segmentationFile.gtp ngramWWFile.txt charSegFile.csv spottingModelPrefix [i (ideal)]"<<endl;
return 0;
}
if (argc>1)
savePrefix=argv[1];
if (savePrefix.find("NAMES")!=string::npos)
dataname="NAMES";
if (savePrefix.find("noQbS")!=string::npos || savePrefix.find("NoQbS")!=string::npos)
GlobalK::knowledge()->USE_QBE=false;
else
GlobalK::knowledge()->USE_QBE=true;
if (argc>2)
GlobalK::knowledge()->setSimSave(argv[2]);
else
GlobalK::knowledge()->setSimSave("save/simulationTracking_net_BENTHAM.csv");
if (argc>3)
{
if (argv[3][0]=='-')
{
numSimThreads=0;
/* FLAGS
* e = QbS only
* a# = auto-trans at len #
* aa = no auto-approve
* w = no wait
*/
int i=1;
while (argv[3][i]!='\0')
{
if (argv[3][i]=='e')
{
GlobalK::knowledge()->USE_QBE=false;
cout<<"No QbE"<<endl;
}
else if (argv[3][i]=='a')
{
i++;
if (argv[3][i]=='a')
{
GlobalK::knowledge()->AUTO_APPROVE=false;
cout<<"No auto approving spottings"<<endl;
}
else
{
GlobalK::knowledge()->AUTO_TRANS_LEN_THRESH=argv[3][i] - '0';
cout<<"Auto transcribe words less than "<<GlobalK::knowledge()->AUTO_TRANS_LEN_THRESH<<endl;
}
}
/*else if (argv[3][i]=='w')
{
GlobalK::knowledge()->TRANS_DONT_WAIT=true;
cout<<"No waiting for transc"<<endl;
}*/
i++;
}
}
else
numSimThreads=atoi(argv[3]);
}
if (argc>4)
SR_mode=argv[4];
if (argc>5)
lexiconFile=argv[5];
if (argc>6)
pageImageDir=argv[6];
if (argc>7)
segmentationFile=argv[7];
if (argc>8)
ngramWWFile=argv[8];
if (argc>9)
charSegFile=argv[9];
if (argc>10)
spottingModelPrefix=argv[10];
if (argc>11)
{
for (int i=11; i<argc; i++)
{
if (argv[i][0]=='i')
{
GlobalK::knowledge()->IDEAL_COMB=true;
}
else if (argv[i][0]=='0' || argv[i][0]=='.')
{
GlobalK::knowledge()->MIN_SPOTTING_AP=atof(argv[i]);
}
else
cout<<"WARNING, n-grams specified in width file"<<endl;
//nsOfInterest.insert(atoi(argv[i]));
}
}
//else
//nsOfInterest.insert(2);
if (SR_mode.compare("take_from_top")==0)
{
GlobalK::knowledge()->SR_TAKE_FROM_TOP=true;
}
else if (SR_mode.compare("otsu_fixed")==0)
{
GlobalK::knowledge()->SR_OTSU_FIXED=true;
}
else if (SR_mode.compare("none_take_from_top")==0)
{
GlobalK::knowledge()->SR_TAKE_FROM_TOP=true;
GlobalK::knowledge()->SR_THRESH_NONE=true;
}
else if (SR_mode.compare("none")==0)
{
GlobalK::knowledge()->SR_THRESH_NONE=true;
}
else if (SR_mode.compare("gaussian_draw")==0)
{
GlobalK::knowledge()->SR_GAUSSIAN_DRAW=true;
}
else if (SR_mode.compare("fancy_one")==0)
{
GlobalK::knowledge()->SR_FANCY_ONE=true;
}
else if (SR_mode.compare("fancy_two")==0)
{
GlobalK::knowledge()->SR_FANCY_TWO=true;
}
else if (SR_mode.substr(0,8).compare("two_walk")==0)
{
GlobalK::knowledge()->SR_TWO_WALK=true;
if (SR_mode.length()>8)
{
GlobalK::knowledge()->TWO_WALK_REJECT_THRESHOLD=stof(SR_mode.substr(9));
cout<<"TWO_WALK_REJECT_THRESHOLD set to "<<GlobalK::knowledge()->TWO_WALK_REJECT_THRESHOLD<<endl;
}
}
else if (SR_mode.substr(0,10).compare("phoc_trans")==0)
{
GlobalK::knowledge()->PHOC_TRANS=true;
numSpottingThreads = 100;
if (SR_mode.length()>10)
{
numSpottingThreads = stoi(SR_mode.substr(10));
cout<<"trans top "<<numSpottingThreads<<"%"<<endl;
}
}
else if (SR_mode.substr(0,9).compare("cpv_trans")==0)
{
GlobalK::knowledge()->CPV_TRANS=true;
numSpottingThreads = 100;
if (SR_mode.length()>9)
{
numSpottingThreads = stoi(SR_mode.substr(9));
cout<<"trans top "<<numSpottingThreads<<"%"<<endl;
}
}
else if (SR_mode.compare("web_trans")==0)
{
GlobalK::knowledge()->WEB_TRANS=true;
}
else if (SR_mode.compare("cluster_step")==0)
{
GlobalK::knowledge()->CLUSTER=true;
numSpottingThreads = 1;
}
else if (SR_mode.compare("cluster_top")==0)
{
GlobalK::knowledge()->CLUSTER=true;
numSpottingThreads = 0;
}
else if (SR_mode.compare("manual")==0)
{
GlobalK::knowledge()->MANUAL_LINES=true;
numSpottingThreads = 0;
}
else if (SR_mode.compare("fancy")!=0)
{
cout<<"Error, unknown SpottingResults mode: "<<SR_mode<<endl;
cout<<SR_mode.substr(0,10)<<endl;
return 0;
}
#ifndef TEST_MODE
//#ifndef DEBUG_AUTO
Simulator sim(dataname,SR_mode,charSegFile);
//#else
// Simulator sim("test",charSegFile);
//#endif
#else
Simulator sim("test",SR_mode,charSegFile);
#endif
/*int avgCharWidth=-1;
if (dataname.compare("BENTHAM")==0)
avgCharWidth=37;
else if (dataname.compare("NAMES")==0)
avgCharWidth=20;
else if (dataname.compare("GW")==0)
avgCharWidth=38;
assert(avgCharWidth>0);*/
int numTaskThreads = 7;
int height = 1000;
int width = 2500;
int milli = 7000;
CATTSS* cattss = new CATTSS(lexiconFile,
pageImageDir,
segmentationFile,
spottingModelPrefix,
savePrefix,
//nsOfInterest,
ngramWWFile,//avgCharWidth,
numSpottingThreads,
numTaskThreads,
height,
width,
milli,
0,//pad
numSimThreads==0
);
if (GlobalK::knowledge()->MANUAL_LINES)
cattss->initLines(0);
atomic_bool cont(true);
vector<thread*> taskThreads(numSimThreads);
//string line;
//cout<<"WAITING FOR ENTRY BEFORE BEGINNING SIM"<<endl;
//getline(cin, line);
cout<<"SIMULATION STARTED"<<endl;
for (int i=0; i<numSimThreads; i++)
{
taskThreads[i] = new thread(threadLoop,cattss,&sim,&cont,false);
taskThreads[i]->detach();
}
if (numSimThreads==0)
{
cout<<"Non-interactive mode. Will terminate on manual."<<endl;
threadLoop(cattss,&sim,&cont,true);
}
else
controlLoop(cattss,&cont);
cout<<"---DONE---"<<endl;
cattss->save();
//delete cattss;
for (int i=0; i<numSimThreads; i++)
delete taskThreads[i];
this_thread::sleep_for(chrono::seconds(40));
delete cattss;
}
|
41feb9a02f8765f3f327d34dda4954dc7d4d0f2f | 5bcfd299db34189ceae6bf5cda00677fc5dced34 | /leetcode/clang/129. 求根到叶子节点数字之和.cpp | d1fc00c68c7f11524bcb31dcb4cc48630f2ec760 | [] | no_license | aidandan/algorithm | 40617151cbffb2279aabe4bdbc57a34ac6f722de | b29cca383654324c4004c6f5fc5ca358f3d51a92 | refs/heads/master | 2023-01-05T00:31:58.006399 | 2020-11-04T13:22:43 | 2020-11-04T13:22:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,361 | cpp | 129. 求根到叶子节点数字之和.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
};
int dfs(struct TreeNode* root, int base)
{
if (root == NULL) {
return 0;
} else {
int value = base * 10 + root->val;
int left = dfs(root->left, value);
int right = dfs(root->right, value);
// printf("v=%d, left=%d, right=%d\n", root->val, left, right);
if (left > 0 || right > 0) {
return left + right;
} else {
return value;
}
}
}
int sumNumbers(struct TreeNode* root)
{
return dfs(root, 0);
}
void createTree(struct TreeNode **root, int *a, int size)
{
if (root == NULL) {
return; // ²ÎÊýÓÐÎó
} else if(a == NULL || size == 0) {
*root = NULL;
return; // ²ÎÊýÓÐÎó
} else { // ´´½¨ ¶þ²æÊ÷
struct TreeNode* n = (struct TreeNode*)malloc(sizeof(struct TreeNode));
if (n == NULL) { // ÄÚ´æÉêÇëʧ°Ü
*root = NULL;
return;
} else {
#define MAX_NODE_COUNT 100 // ÈÏΪ×ã¹»´óÁË
struct TreeNode *que[MAX_NODE_COUNT] = { 0 };
int head = 0, tail = 0; // Ä£Äâ¶ÓÁÐ
int i = 0; // Ë÷Òý
n->val = a[i++];
n->left = NULL;
n->right = NULL;
*root = n;
que[tail++] = n;
while (head < tail) {
struct TreeNode *p = que[head++];
if (p != NULL) {
printf("%d,", p->val);
if (i < size) {
int v = a[i++];
if (v != INT_MIN) {
n = (struct TreeNode*)malloc(sizeof(struct TreeNode));
if (n == NULL) { // ÄÚ´æÉêÇëʧ°Ü
return;
} else {
n->val = v;
n->left = NULL;
n->right = NULL;
}
p->left = n;
que[tail++] = n;
}
}
if (i < size) {
int v = a[i++];
if (v != INT_MIN) {
n = (struct TreeNode*)malloc(sizeof(struct TreeNode));
if (n == NULL) { // ÄÚ´æÉêÇëʧ°Ü
return;
} else {
n->val = v;
n->left = NULL;
n->right = NULL;
}
p->right = n;
que[tail++] = n;
}
}
}
}
return;
}
}
}
void preOrderPrint(struct TreeNode* root)
{
if (root == NULL) {
return;
} else { // Ïȸù ±éÀú
printf("%d,", root->val);
preOrderPrint(root->left);
preOrderPrint(root->right);
}
}
void inOrderPrint(struct TreeNode* root)
{
if (root == NULL) {
return;
} else { // Öиù ±éÀú
inOrderPrint(root->left);
printf("%d,", root->val);
inOrderPrint(root->right);
}
}
void postOrderPrint(struct TreeNode* root)
{
if (root == NULL) {
return;
} else { // Ïȸù ±éÀú
postOrderPrint(root->left);
postOrderPrint(root->right);
printf("%d,", root->val);
}
}
void freeTree(struct TreeNode* root)
{
if (root == NULL) {
return;
} else { // ºó¸ù Ïú»Ù
freeTree(root->left);
root->left = NULL;
freeTree(root->right);
root->right = NULL;
free(root);
root = NULL;
}
}
int main()
{
// int a[] = {}; // 0±íʾnull
// int a[] = {1,2,3}; // 0±íʾnull
int a[] = {4,9,0,5,1};
int size = sizeof(a) / sizeof(a[0]);
printf("size=%d\n", size);
struct TreeNode *root = NULL;
createTree(&root, a, size);
printf("\nPre Order:");
preOrderPrint(root);
printf("\n");
printf("\nSum=%d", sumNumbers(root));
freeTree(root);
return 0;
}
|
abec3155ce857c86a309258d76f5c0fc6a7475cf | 5722258ec3ce781cd5ec13e125d71064a67c41d4 | /javafx/beans/value/ObservableValueProxyForward.h | 6ff2ae44625865b08c312af02f4fac4a0fcb97dc | [] | no_license | ISTE-SQA/HamsterJNIPP | 7312ef3e37c157b8656aa10f122cbdb510d53c2f | b29096d0baa9d93ec0aa21391b5a11b154928940 | refs/heads/master | 2022-03-19T11:27:03.765328 | 2019-10-24T15:06:26 | 2019-10-24T15:06:26 | 216,854,309 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 230 | h | ObservableValueProxyForward.h | #ifndef __javafx_beans_value_ObservableValueProxyForward_H
#define __javafx_beans_value_ObservableValueProxyForward_H
namespace javafx
{
namespace beans
{
namespace value
{
class ObservableValueProxy;
}
}
}
#endif
|
b4638d092041cadf0bb241ae8d6e86ec5736e060 | 9fd1474f516c819c60d5fb55e46d8496d07b8400 | /Project06/driver.h | 1e89f92f2fd42b3ee9a69f31c91cc1fdacc1a8c2 | [] | no_license | Haskiez/CS-1410 | d323d08508e38c904159c2f27bc1365b1a02b6b9 | 629cc16fe1935f7e1d83ea7b863a8c81dbbdc55b | refs/heads/master | 2020-06-14T17:47:58.663454 | 2016-12-08T04:53:52 | 2016-12-08T04:53:52 | 75,348,959 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 668 | h | driver.h | // Course: CS 1410
// Instructor: Professor Wagstaff
// File: project06.cpp
// Contents: Project #6 Programming Assignment
// I declare that the following source code was written
// solely by me, or provided by the instructor.
// I understand that copying any source
// code, in whole or in part, constitutes cheating, and
// that I will receive a zero in this assignment if I am
// found in violation of this policy.
// -----------------------------------------------------------
#pragma once
#include <iostream>
#include <string>
using namespace std;
int index_of(const string& s, const string& t);
int recursiveFind(const string& s, const string& t, int index);
|
0c071427768453437fa96e6ecdc8c7b794042af2 | ffbb2f0a6bc6537aa0446cd007207d699ae9ed0a | /InfinitySequence2/InfinitySequence2.cc | fd6b044ace14bb878d97d0abf9be722e859ee224 | [] | no_license | jaeho9929/algorithm | 633cdcef1ccbee823f728fccfbcbeb2a727d54d9 | 6ed579a8357b930b1780d940aec7c39b55b25ed7 | refs/heads/master | 2021-05-14T16:07:11.860948 | 2018-02-21T04:10:14 | 2018-02-21T04:10:31 | 116,011,796 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,757 | cc | InfinitySequence2.cc | #include <iostream>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <string>
#include <random>
#include <chrono>
#include <cassert>
#include <limits.h>
using namespace std;
#define __MESSAGE(s) \
std::cout << s << std::endl;
#define __TIMEMEASURE(func, ...) \
ts = std::chrono::high_resolution_clock::now(); \
std::cout << func(__VA_ARGS__) << std::endl; \
te = std::chrono::high_resolution_clock::now(); \
duration = std::chrono::duration_cast<std::chrono::microseconds>(te - ts).count(); \
std::cout << "Execution time of "<< #func " " << "; " << duration << "us" << std::endl;
#define __TIMEMEASURE_NOSTDOUT(func, ...) \
ts = std::chrono::high_resolution_clock::now(); \
func(__VA_ARGS__); \
te = std::chrono::high_resolution_clock::now(); \
duration = std::chrono::duration_cast<std::chrono::microseconds>(te - ts).count(); \
std::cout << "Execution time of "<< #func " " << "; " << duration << "us" << std::endl;
#define __TIMEMEASURE_WITHRETURN(ret ,func, ...) \
ts = std::chrono::high_resolution_clock::now(); \
ret = func(__VA_ARGS__); \
te = std::chrono::high_resolution_clock::now(); \
duration = std::chrono::duration_cast<std::chrono::microseconds>(te - ts).count(); \
std::cout << "Execution time of "<< #func " " << "; " << duration << "us" << std::endl;
long long dp[9999999];
long long dp2[9999999];
map<long long, long long> m;
const int MAX = 1000000;
long long dp3[9999999];
class InfinitySequence2{
public:
long long calc(long n, int p, int q, int x, int y)
{
return recursion(n, p, q, x, y);
}
long long recursion(long n, int p, int q, int x, int y)
{
if(n <= 0) return 1;
return recursion(n / p - x, p, q, x, y) + recursion(n / q - y, p, q, x, y);
}
long long calc2(long long n, int p, int q, int x, int y)
{
int i;
dp[0] = 1;
for(i = 1; i <= n; i++){
dp[i] = 0;
long long nexta = i / p - x;
long long nextb = i / q - y;
if(nexta <= 0) dp[i]++;
else dp[i] += dp[nexta];
if(nextb <= 0) dp[i]++;
else dp[i] += dp[nextb];
}
return dp[n];
}
long long calc3(long n, int p, int q, int x, int y)
{
return recursion2(n, p, q, x, y);
}
long long recursion2(long n, int p, int q, int x, int y)
{
if(n <= 0) return 1;
if(dp2[n] != 0) return dp2[n];
return dp2[n] = (recursion2(n / p - x, p, q, x, y) + recursion2(n / q - y, p, q, x ,y));
}
long long calc4(long n, int p, int q, int x ,int y)
{
return recursion3(n, p, q, x, y);
}
long long recursion3(long n, int p, int q, int x, int y)
{
if(n <= 0) return 1;
if(m[n] != 0) return m[n];
return m[n] = (recursion3(n / p - x, p, q, x, y) + recursion3(n / q - y, p, q, x, y));
}
long long calc5(long n, int p, int q, int x, int y)
{
return recursion4(n, p, q, x, y);
}
long long recursion4(long n, int p, int q, int x, int y)
{
if(n <= 0) return 1;
if(n < MAX){
if(dp3[n] != 0) return dp[n];
else return dp[n] = recursion4(n / p - x, p, q, x, y) + recursion4(n / q - y, p, q, x, y);
}
return recursion4(n / p - x, p, q, x, y) + recursion4(n / q - y , p, q, x, y);
}
};
int main(void)
{
//std::random_device rn;
std::chrono::high_resolution_clock::time_point ts = std::chrono::high_resolution_clock::now();
std::chrono::high_resolution_clock::time_point te = std::chrono::high_resolution_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::microseconds>(te - ts).count();
InfinitySequence2 solver;
int cc;
long n;
int p, q, x, y;
cin >> cc;
while(cc--){
cin >> n;
cin >> p;
cin >> q;
cin >> x;
cin >> y;
cout << "CASE \"" << cc << "\"" << endl;
__TIMEMEASURE(solver.calc, n, p, q, x, y);
__TIMEMEASURE(solver.calc2, n, p, q, x, y);
__TIMEMEASURE(solver.calc3, n, p, q, x, y);
__TIMEMEASURE(solver.calc4, n, p, q, x, y);
__TIMEMEASURE(solver.calc5, n, p, q, x, y);
}
// std::mt19937_64 rnd(rn());
// std::mt19937 rnd(rn());
// std::uniform_int_distribution<int> range(-10, 10);
return 0;
}
|
6ae29292f75af066f26f00caecb5df1ba5fe7694 | bf7d4b738d2f33eb4059eeef948abbeb7bcdd442 | /DeepMimicCore/scenes/SceneHeadingAMPGetup.h | 018e02eea08c923b0a76a6bbda1855ced7de286a | [
"MIT"
] | permissive | NTForked-ML/DeepMimic | 83043000a3cc2c8b747abba2c3e4ea55e574851b | 70e7c6b22b775bb9342d4e15e6ef0bd91a55c6c0 | refs/heads/master | 2022-05-29T02:05:23.939269 | 2022-04-30T17:36:51 | 2022-04-30T17:36:51 | 242,036,191 | 0 | 0 | MIT | 2022-04-30T21:52:54 | 2020-02-21T02:22:39 | C++ | UTF-8 | C++ | false | false | 1,777 | h | SceneHeadingAMPGetup.h | #pragma once
#include "scenes/SceneHeadingAMP.h"
class cSceneHeadingAMPGetup : virtual public cSceneHeadingAMP
{
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
cSceneHeadingAMPGetup();
virtual ~cSceneHeadingAMPGetup();
virtual void ParseArgs(const std::shared_ptr<cArgParser>& parser);
virtual void Init();
virtual void Update(double timestep);
virtual void Reset();
virtual double CalcReward(int agent_id) const;
virtual void RecordGoal(int agent_id, Eigen::VectorXd& out_goal) const;
virtual int GetGoalSize(int agent_id) const;
virtual void BuildGoalOffsetScale(int agent_id, Eigen::VectorXd& out_offset, Eigen::VectorXd& out_scale) const;
virtual void BuildGoalNormGroups(int agent_id, Eigen::VectorXi& out_groups) const;
virtual std::string GetName() const;
protected:
std::vector<int> mGetupMotionIDs;
std::vector<bool> mGetupMotionFlags;
double mGetupTime;
double mGetupHeightRoot;
double mGetupHeightHead;
int mHeadID;
double mRecoverEpisodeProb;
bool mIsRecoveryEpisode;
cTimer mGetupTimer;
virtual void ResetTimers();
virtual void UpdateTimers(double timestep);
virtual void InitGetupTimer();
virtual void ResetGetupTimer();
virtual void SyncGetupTimer();
virtual void UpdateGetupTimer(double timestep);
virtual void RecordGetupMotionFlags(const std::vector<int>& getup_motion_ids);
virtual void BeginGetup();
virtual void EndGetup();
virtual void UpdateTestGetup();
virtual bool HasFallenContact(const cSimCharacter& sim_char) const;
virtual double CalcGetupTime(const std::vector<int>& getup_motion_ids) const;
virtual double CalcRewardGetup(int agent_id) const;
virtual void ResetRecoveryEpisode();
virtual double CalcGetupPhase() const;
virtual bool CheckGettingUp() const;
virtual bool ActivateRecoveryEpisode();
}; |
e61b62f4b24b8899750f202bd06a758e255c624f | e5091c3a8477fa12e1adfdb1f3d826eb6e9bb2be | /UVa/money_matters.cpp | 3117b4d8de73e8eef33ef1932ed24387e3addd86 | [] | no_license | leonardoAnjos16/Competitive-Programming | 1db3793bfaa7b16fc9a2854c502b788a47f1bbe1 | 4c9390da44b2fa3c9ec4298783bfb3258b34574d | refs/heads/master | 2023-08-14T02:25:31.178582 | 2023-08-06T06:54:52 | 2023-08-06T06:54:52 | 230,381,501 | 7 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,770 | cpp | money_matters.cpp | #include <bits/stdc++.h>
using namespace std;
class UnionFind {
private:
vector<int> ds, rank;
int num_vertices;
public:
UnionFind(int num_vertices) {
ds.reserve(num_vertices);
rank.assign(num_vertices, 0);
for (int i = 0; i < num_vertices; i++) ds[i] = i;
this->num_vertices = num_vertices;
}
int find(int v) {
if (ds[v] == v) return v;
else ds[v] = find(ds[v]);
return ds[v];
}
void unite(int v1, int v2) {
int r1 = find(v1), r2 = find(v2);
if (r1 != r2) {
if (rank[r1] > rank[r2]) ds[r2] = r1;
else ds[r1] = r2;
if (rank[r1] == rank[r2]) rank[r2]++;
}
}
bool is_possible(vector<int> debts) {
vector<int> new_debts(num_vertices, 0);
for (int i = 0; i < num_vertices; i++)
new_debts[find(i)] += debts[i];
for (int i = 0; i < num_vertices; i++)
if (new_debts[i]) return false;
return true;
}
};
int main() {
int num_cases;
scanf("%d", &num_cases);
while (num_cases--) {
int num_friends, num_friendships;
scanf("%d %d", &num_friends, &num_friendships);
vector<int> debts(num_friends);
for (int i = 0; i < num_friends; i++)
scanf("%d", &debts[i]);
UnionFind ds(num_friends);
for (int i = 0; i < num_friendships; i++) {
int x, y; scanf("%d %d", &x, &y);
ds.unite(x, y);
}
printf("%s\n", ds.is_possible(debts) ? "POSSIBLE" : "IMPOSSIBLE");
}
} |
f84a5d67d6b2f085440006174c241bf11e8e194d | 22cc83be4eeaf57399a92c7039bc441edd178a67 | /src/additional/particle_information_profiler.cpp | 12de0ec3ec0865b4a394714ade4fa8bbaed1ee14 | [
"WTFPL"
] | permissive | dearshuto/ParticleBasedSimulation | 0703c12df4c266b267dd6e470fb04abb72f93d64 | 75f7f7454e39f8ed4b970a94d261385cb03b3e15 | refs/heads/master | 2022-03-03T20:57:29.036506 | 2017-02-10T02:55:33 | 2017-02-10T02:55:33 | 78,620,264 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 209 | cpp | particle_information_profiler.cpp | //
// particle_information_profiler.cpp
// CubicFineParticleSimulation
//
// Created by Shuto Shikama on 2016/12/13.
//
//
#include "particle_based_simulation/additional/particle_information_profiler.hpp"
|
9ba8c980a059feafdaef43cb3cb9f438c6dd9bb7 | 386fad5de6b1a6a9e5557947bd1aeffda8821656 | /ZeroJudge/D237.cpp | b370c6cdfde4d8f8471e28ba70436f8fe25a55a7 | [] | no_license | xxyyzz/Competitive-Programming_Solutions | 6c1f06232ab63f85d913bdd27a90eff892bfe18d | cca393f4330e784eb0f9edb44df290adc105ce3b | refs/heads/master | 2021-06-02T13:33:48.530485 | 2016-09-25T14:15:37 | 2016-09-25T14:15:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 431 | cpp | D237.cpp | /*
#include<iostream>
#include<math.h>
#include<fstream>
using namespace std;
int main(){
long long int c=2;
for(int i=3;i<2000000;i+=2)
{
bool prime=true;
for(int j=2;j<=sqrt(i);j++){ if(i%j==0){prime=false;break;} }
if(prime)c+=i;
}
ofstream o("output.txt");
o<<c;
return 0;
}
*/
#include<iostream>
int main(){
std::printf("%s","142913828922");
return 0;
}
|
c9e4f831cc8b302b96887c5a45697a2ea9cb6d7c | f9022882fe627e3bf32eb7efc556a903477a0418 | /PmacThreadTest/pmacthreadtest.h | 1c1ad741950e86b7950e21a6f90d5e6756580702 | [] | no_license | dfy9983/PmacThreadTest | 57bcf7ea4cfb41ed8133e7c365f3e84fd4ba90e2 | 045c3762063d29edd83a150f4296b5664054e80e | refs/heads/master | 2023-04-17T21:05:29.212722 | 2021-05-10T13:23:55 | 2021-05-10T13:23:55 | 359,375,804 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 513 | h | pmacthreadtest.h | #pragma once
#include <QtWidgets/QMainWindow>
#include "ui_pmacthreadtest.h"
#include "PmacThread.h"
class PmacThreadTest : public QMainWindow
{
Q_OBJECT
public:
PmacThreadTest(QWidget *parent = Q_NULLPTR);
private slots:
void on_getMotorDispBtn_clicked();
void on_startThread_clicked();
signals:
void sig_getMotorDisp1();
void sig_getMotorDisp2();
private:
Ui::PmacThreadTestClass ui;
A *a;
PmacThread * pmacthread;
QThread * qthread_pmac;
MyQPmac *mypmac;
bool threadIsStared = false;
};
|
e070807e20acf3e3bfa35f1a04b065c2c3fde7ce | c515605c34200f8a58a7e4c0dcf9daa394e4839a | /project3/globals.cpp | 28162b4f60ef8f4516315089ba9b150b47a35a68 | [] | no_license | tungfang/EE-474-Intro-Embedded-Systems | 4cfb68adebd0c4e973bc8cbea154dbd8525bc649 | d5c7bd737cb69ffb0493377a5660d1fe5bb22528 | refs/heads/master | 2020-05-05T09:55:23.731635 | 2019-12-01T03:40:27 | 2019-12-01T03:40:27 | 179,923,276 | 0 | 0 | null | 2019-05-23T00:17:04 | 2019-04-07T05:44:02 | C | UTF-8 | C++ | false | false | 2,994 | cpp | globals.cpp | #include <iostream>
#include "globals.h"
#include "MeasureSubsystem.h"
#include "ComputeSubsystem.h"
#include "DisplaySubsystem.h"
#include "StatusSubsystem.h"
#include "WarningSubsystem.h"
#include "KeypadSubsystem.h"
using namespace std;
int main()
{
cout << "Hello world!";
init();
return 0;
}
void init()
{
// Measurements
temperatureRawBuf[0] = 75;
bloodPressRawBuf[0] = 80;
pulseRateRawBuf[0] = 0;
// TFT KeyPad
functionSelect = 0;
measurementSelection = 0;
alarmAcknowledge = 0;
// Status
batteryState = 200;
//Alarm
bpOutOfRange = 0;
tempOutOfRange = 0;
pulseOutOfRange = 0;
// Warning
bpHigh = FALSE;
tempHigh = FALSE;
pulseLow = FALSE;
// TCB Linked List
linkedListData.head = NULL;
linkedListData.tail = NULL;
linkedListTCB.head = NULL;
linkedListTCB.tail = NULL;
// initialize index
tempRawIndex = bpRawIndex = prRawIndex = tempCorrectIndex = bpCorrectedIndex = prCorrectedIndex = 1;
measureSelection = NONE;
acknowledge = NONE;
measureData.temperatureRawBuf = temperatureRawBuf;
measureData.bloocPressRawBuf = bloodPressRawBuf;
measureData.pulseRateRawBuf = pulseRateRawBuf;
measureData.measurementSelectionPtr = &measureSelection;
computeData.temperatureRawBuf = temperatureRawBuf;
computeData.bloodPressRawBuf = bloodPressRawBuf;
computeData.pulseRateRawBuf = pulseRateRawBuf;
computeData.measurementSelectionPtr = &measureSelection;
computeData.temperatureCorrectedBuf = temperatureCorrectedBuf;
computeData.bloodPressCorrectedBuf = bloodPressCorrectedBuf;
computeData.pulseRateCorrectedBuf = pulseRateCorrectedBuf;
displayData.temperatureCorrectedBuff = temperatureCorrectedBuf;
displayData.bloodPressCorrectedBuf = bloodPressCorrectedBuf;
displayData.pulseRateCorrectedBuf = pulseRateCorrectedBuf;
displayData.batteryState = &batteryState;
warningAlarmData.temperatureRawBuf = temperatureRawBuf;
warningAlarmData.bloodPressRawBuf = bloodPressRawBuf;
warningAlarmData.pulseRateRawBuf = pulseRateRawBuf;
warningAlarmData.batteryState = &batteryState;
statusData.batteryState = &batteryState;
keyData.measurementSelection = &measureSelection;
keyData.alarmAcknowledge = &acknowledge;
taskQueue[0].taskDataPtr = &measureData;
taskQueue[1].taskDataPtr = &computeData;
taskQueue[2].taskDataPtr = &displayData;
taskQueue[3].taskDataPtr = &warningAlarmData;
taskQueue[4].taskDataPtr = &statusData;
taskQueue[5].taskDataPtr = &keyData;
taskQueue[6].taskDataPtr = &displayData;
// taskQueue[0].taskPtr = &MeasureSubsystemFuction;
// taskQueue[1].taskPtr = &ComputeSubsystemFunction;
// taskQueue[2].taskPtr = &DisplaySubsystemFunction;
// taskQueue[3].taskPtr = &WarningAlarmSubsystemFunction;
// taskQueue[4].taskPtr = &StatusSubsystemFunction;
// taskQueue[5].taskPtr = &KeypadSubsystemFunction;
}
|
2a9a14a3d05ed88f183a23f7375c78b431142da7 | 6c56ce8250b9d5b929b0cac18d653577772e8059 | /vdf/JobTrace.cpp | 80ac75069c920763cef5351968236e35803bee47 | [
"Apache-2.0"
] | permissive | CARV-ICS-FORTH/vine_talk | c7a58c63cb6171f8e9742aba49cb08a8f52a0b11 | f2e8b29e46618e64e11139f7701a8297d433c651 | refs/heads/master | 2021-10-16T06:36:13.457217 | 2019-02-08T16:40:51 | 2019-02-08T16:40:51 | 118,891,477 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,440 | cpp | JobTrace.cpp | /*
* Copyright 2018 Foundation for Research and Technology - Hellas
*
* 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 [1] [1]
*
* 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.
*
* Links:
* ------
* [1] http://www.apache.org/licenses/LICENSE-2.0 [1]
*/
#include "JobTrace.h"
#include "Collector.h"
#include "Misc.h"
void JobTrace :: histogram(std::ostream & os,float ratio)
{
double sdx = 950.0/(samples.size()+2);
double bar_width = 950.0/(samples.size()*1.5);
double max_task_time = std::max_element(
samples.begin(),samples.end(),Sample::byDuration)->getDuration();
os << "<svg style=\"display:flex;flex:" << ratio << "\" viewBox=\"0 0 1050 650\" data-sort=\"time\" data-boff=" << sdx << " id=\"" << _S((uint64_t)this) << "\"class=\"bar_chart\" width=\"1050\" height=\"650\">";
os << "<text x=25 y=40 font-size=30>Job Task Latency</text>";
os << "<text id='title' onClick=\"resortGraph(this,['time','cdf'])\" x=975 text-anchor=\"end\" y=40 font-size=30>👁 Start</text>";
os << "<text id='task_stuff' x=525 y=40 font-size=20 text-anchor='middle' ></text>";
os << "<g transform=\"translate(25,50)\">\n"; // Graph area from 25,25 to 425,325
std::sort(samples.begin(),samples.end(),Sample::byDuration);
for(int divs = 0 ; divs <= 10 ; divs++)
{
double y = (float)(divs*575)/10;
double time = (max_task_time/10.0)*divs;
os << "<line stroke-width=1 stroke=\"black\" x1=0 x2=950 y1=" << y;
os << " y2=" << y << "></line>\n";
os << "<text y=" << 575-y;
os << " x=950 font-size:20>";
os << autoRange(time,ns_to_secs,1000,10) << "</text>\n";
}
int hist_id = 1;
for( auto sample : samples)
{
double h = (sample.getDuration()/max_task_time)*575;
os << _RECT("",sample.getID()*sdx,575-h,bar_width,h,
" time_id=" + _S(sample.getID()) +
" hist_id=" + _S(hist_id) +
" duration='" + autoRange(sample.getDuration(),ns_to_secs,1000,100) + "'" +
" onmouseover=barInfo(this,\"" + _S((uint64_t)this) + "\"," + _S(samples.size())+")"
);
hist_id++;
}
os << "</g></svg>";
}
void JobTrace :: addSample(const Sample & sample)
{
lock.lock();
samples.push_back(sample);
if(sample.getStart() < start)
start = sample.getStart();
if(sample.getEnd() > end)
end = sample.getEnd();
samples.back().setID(samples.size());
lock.unlock();
}
size_t JobTrace :: getSize()
{
return samples.size();
}
const std::vector<Sample> & JobTrace :: getSamples() const
{
return samples;
}
bool JobTrace :: byStartTime(const std::pair<void* const, JobTrace*> & a,const std::pair<void* const, JobTrace*> & b)
{
return a.second->getStart() < b.second->getStart();
}
bool JobTrace :: byStartTimeP(const JobTrace* a,const JobTrace* b)
{
return a->getStart() < b->getStart();
}
JobTrace :: JobTrace()
: start(-1)
{
}
uint64_t JobTrace :: getStart() const
{
return start;
}
uint64_t JobTrace :: getEnd() const
{
return end;
}
uint64_t JobTrace :: getDuration() const
{
return getEnd()-getStart();
}
|
974a71aefd28bf934cbd272ef1fa6d2a951ad770 | c5f94883c66644e613d76b06c46c5d019d8e7c01 | /transport/security/encryp_handler.cc | cb620ea6403772d4b4fb040c58f59fc5a61cd1cb | [
"MIT"
] | permissive | bingo787/transport2.0 | 47f80c91640b7416e70acf4be0e864feedddbaf4 | c82057db7050d768e105adbbc63af8b3e38b1668 | refs/heads/master | 2022-04-08T08:54:04.567008 | 2020-02-24T03:59:22 | 2020-02-24T03:59:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 29 | cc | encryp_handler.cc |
#include "encryp_handler.h"
|
72a837af0dae5eb21ea81f72378c263bf58430d6 | 8df98e2d7fc51a735a75058e8609b1a9fe794dcb | /code45.cpp | 406187ab0462bbac407304a783defb8b3bf31688 | [] | no_license | SayedBhuyan/CPlusPlus_Midterm_MDC | debc332d3d996ae249e878815486d16385d708a9 | b04e9fabf6b331204db71a6f47bddd17703d271b | refs/heads/master | 2021-05-19T17:50:36.290059 | 2020-04-01T02:39:34 | 2020-04-01T02:39:34 | 252,053,701 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 688 | cpp | code45.cpp | /*
Author: Sayed Bhuyan
Exercise: 45
Description: Write a loop that reads positive integers from standard input, printing out those values that are even, separating them with spaces, and that terminates when it reads an integer that is not positive. Declare any variables that are needed.
*/
#include <iostream>
#include <string>
using namespace std;
int main()
{
int num = 0;
string numString = "";
while(1) {
cout << "Enter a number: " << endl;
cin >> num;
if (num >= 0) {
numString += to_string ( num ) + " ";
} else {
break;
}
cout << "Updated: " << numString << endl << endl;
}
return 0;
} |
7dcf1e703842fe7e2406fda83208729406a836e4 | c1bb8a5a19e8bb6a62a63ac5ae64acc5ae1673eb | /src/util/FileUtil.h | 01b38564a1a3586b54e786cc200d399ac1e581bb | [] | no_license | dedeibel/annoyme | ed1a5cb0c1924773072c5d38e4e236f0b2517ba6 | d1483f6ef2dd7bfd851f67a12154eaae08ab7a14 | refs/heads/master | 2020-05-06T12:19:19.102372 | 2013-02-12T10:12:36 | 2013-02-12T10:12:36 | 57,476 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,252 | h | FileUtil.h | /*
* Copyright (c) 2008, Benjamin Peter <BenjaminPeter@arcor.de>
* 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 author 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 Benjamin Peter ''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 Benjamin Peter 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 FILEUTIL_H
#define FILEUTIL_H
class AnnoyErrnoException;
class IllegalArgumentException;
class FileUtil
{
public:
bool copy(const std::string &src, const std::string &dst) const;
std::string findFile(const std::string &filename, const std::vector<
std::string> paths) const throw (FileNotFoundException);
std::string findFile(const std::string &filename, const std::vector<
std::string> &paths) const throw (FileNotFoundException);
void loadFile(const std::string &filename, const vector<string> paths,
char **data, unsigned int *size) const throw (FileNotFoundException);
void loadFile(const std::string &path, char** data, unsigned int* size) const
throw (FileNotFoundException);
void
listFiles(const std::string &dirname, std::vector<std::string> &files) const
throw (IllegalArgumentException);
/**
* Returns true if the directory exists and is a readable directory. If there is a problem accessing the directory, invalid path, not existing, too long, ... an exception is thrown.
*/
bool isAccessableDirectory(const std::string &path) const
throw (AnnoyErrnoException);
/**
* Returns true if the file exists and is readable. If there is a problem accessing the directory, invalid path, not existing, too long, ... an exception is thrown.
*/
bool isAccessableFile(const std::string &path) const
throw (AnnoyErrnoException);
/**
* Returns true if the directory exists and is a directory.
*/
bool isDirectory(const std::string &path) const;
/**
* Returns true if the file exists and is a file.
*/
bool isFile(const std::string &path) const;
bool isReadable(const std::string &path) const;
};
#endif // FILEUTIL_H
|
ac5ce6f9ed6f8ccef6451bfa7ed4e207d4e70eae | 38026f4db0061d71a428d3619351408d7b8a586c | /Source/gui/p4api/Cmd_PrepEdit.h | 1e1b948178588ac7c8f46cd255f89ccb64c571a5 | [
"BSD-2-Clause"
] | permissive | gorlak/P4Win | dc0f69693babe829edafc8a02d1799066b2a179e | 6986535bd9e5b0f297cacbc8ad112bb6d49a5ed3 | refs/heads/master | 2021-08-20T06:14:18.135928 | 2021-06-05T23:48:20 | 2021-06-05T23:48:20 | 89,386,061 | 11 | 4 | NOASSERTION | 2021-03-03T05:13:59 | 2017-04-25T17:03:50 | C++ | UTF-8 | C++ | false | false | 585 | h | Cmd_PrepEdit.h | //
// Copyright 1997 Nicholas J. Irias. All rights reserved.
//
//
// Cmd_PrepEdit.h
//
//
#include "P4Command.h"
class CCmd_PrepEdit : public CP4Command
{
// Construction
public:
CCmd_PrepEdit(CGuiClient *client=NULL);
DECLARE_DYNCREATE(CCmd_PrepEdit)
BOOL Run(LPCTSTR filespec, BOOL getHead, BOOL addFile);
void SetWarnIfLocked( BOOL b ) { m_WarnIfLocked = b; }
protected:
// Attributes
CString m_FileName;
BOOL m_GetHead;
BOOL m_AddFile;
BOOL m_WarnIfLocked;
// CP4Command overrides
virtual void PreProcess(BOOL& done);
};
|
7f30c48526144110274c6d4c9379f4d84f515a0f | adda2aeef1f506044e622753a9e1d986f34fde0d | /VDetector.cpp | e4f0b1d33d08a51ca7e28dd4939845d9e8a56c24 | [
"Apache-2.0"
] | permissive | YaniBion/nest | f163dff91d5e99cac90cbf12e3a3089875a02dcb | 1bd3d70a3030a96283051ca89c8898a92014f92d | refs/heads/master | 2020-05-07T09:11:24.135157 | 2019-01-13T16:14:32 | 2019-01-13T16:14:32 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,014 | cpp | VDetector.cpp | //
// VDetector.cpp
//
// Adapted from Quentin Riffard by Jacob Cutter, May 8, 2018
// *********************************************************************
// THIS DEFAULT VIRTUAL DETECTOR SHOULD ONLY BE MODIFIED BY DEVELOPERS.
// PLEASE DEFINE YOUR OWN DETECTOR (see DetectorExample_XENON10.hh).
// *********************************************************************
#include <math.h>
#include "Detectors/VDetector.hh"
VDetector::VDetector() { Initialization(); }
VDetector::~VDetector() {}
void VDetector::Initialization() {
// Primary Scintillation (S1) parameters
g1 = 0.0760; // phd per S1 phot at dtCntr (not phe). Divide out 2-PE effect
sPEres = 0.58; // single phe resolution (Gaussian assumed)
sPEthr = 0.35; // POD threshold in phe, usually used IN PLACE of sPEeff
sPEeff = 1.00; // actual efficiency, can be used in lieu of POD threshold
noise[0] = 0.0; // baseline noise mean and width in PE (Gaussian)
noise[1] = 0.0; // baseline noise mean and width in PE (Gaussian)
P_dphe = 0.2; // chance 1 photon makes 2 phe instead of 1 in Hamamatsu PMT
coinWind = 100; // S1 coincidence window in ns
coinLevel = 2; // how many PMTs have to fire for an S1 to count
numPMTs = 89; // For coincidence calculation
// Ionization and Secondary Scintillation (S2) parameters
g1_gas = 0.06; // phd per S2 photon in gas, used to get SE size
s2Fano = 3.61; // Fano-like fudge factor for SE width
s2_thr = 300.; // the S2 threshold in phe or PE, *not* phd. Affects NR most
E_gas = 12.; // field in kV/cm between liquid/gas border and anode
eLife_us = 2200.; // the drift electron mean lifetime in micro-seconds
// Thermodynamic Properties
inGas = false;
T_Kelvin = 177.; // for liquid drift speed calculation
p_bar = 2.14; // gas pressure in units of bars, it controls S2 size
// if you are getting warnings about being in gas, lower T and/or raise p
// Data Analysis Parameters and Geometry
dtCntr = 40.; // center of detector for S1 corrections, in usec.
dt_min = 20.; // minimum. Top of detector fiducial volume
dt_max = 60.; // maximum. Bottom of detector fiducial volume
radius = 50.; // millimeters
radmax = 50.;
TopDrift = 150.; // mm not cm or us (but, this *is* where dt=0)
// a z-axis value of 0 means the bottom of the detector (cathode OR bottom
// PMTs)
// In 2-phase, TopDrift=liquid/gas border. In gas detector it's GATE, not
// anode!
anode = 152.5; // the level of the anode grid-wire plane in mm
// In a gas TPC, this is not TopDrift (top of drift region), but a few mm
// above it
gate = 147.5; // mm. This is where the E-field changes (higher)
// in gas detectors, the gate is still the gate, but it's where S2 starts
cathode = 1.00; // mm. Defines point below which events are gamma-X
// 2-D (X & Y) Position Reconstruction
PosResExp = 0.015; // exp increase in pos recon res at hi r, 1/mm
PosResBase = 70.8364; // baseline unc in mm, see NEST.cpp for usage
}
|
97cc61bb07368cae8cc0861fd123eea55729245d | 08663c89313bec35b3f2debb8045ea74f76a383a | /dataMip.h | 7100b4eec565b95efbc60ac42aa3e6021eb77bc0 | [] | no_license | cmadrid1/MakingHcalPulseShapes | b5e59e54eef51f6ff59e8f235e18d7fd3c9b6152 | 95ceb23d4fa729eed2b25bc29a37895f543d7fd2 | refs/heads/master | 2021-08-19T08:35:38.678528 | 2017-11-25T14:40:14 | 2017-11-25T14:40:14 | 106,330,680 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,858 | h | dataMip.h | #include <vector>
#include <map>
#include <tuple>
std::vector<std::vector<double>> cmsNote = {{0+0.921,0},{1.828+0.921, 0.112159}, {2.856+0.921, 0.223144}, {3.883+0.921, 0.334129}, {4.644+0.921, 0.449769}, {5.673+0.921, 0.556126}, {6.168+0.921, 0.671787}, {7.196+0.921, 0.782772}, {8.755+0.921, 0.88908}, {10.579+0.921, 1.}, {14.301+0.921, 0.976535}, {17.779+0.921, 0.88367}, {20.198+0.921, 0.781641}, {22.089+0.921, 0.670401}, {23.979+0.921, 0.563794}, {27.189+0.921, 0.480211}, {29.87+0.921, 0.387411}, {33.877+0.921, 0.29913}, {36.826+0.921, 0.201686}, {41.344+0.921, 0.17815}, {45.342+0.921, 0.117641}, {50.387+0.921, 0.107945}, {55.169+0.921, 0.0890206}, {59.945+0.921, 0.0886019}, {65.253+0.921, 0.0835173}, {69.761+0.921, 0.0923813}, {75.606+0.921, 0.0687313}, {81.452+0.921, 0.040459}, {87.031+0.921, 0.0168307}, {92.602+0.921, 0.0209745}, {98.707+0.921, 0.0158192}};
std::vector<std::vector<double>> oldVaskenData = { {0+0.5,0},{1+0.5, 0.282609}, {6+0.5, 0.73913}, {11+0.5, 1.}, {16+0.5, 0.956522}, {21+0.5,0.782609}, {26+0.5, 0.565217}, {31+0.5, 0.391304}, {36+0.5, 0.282609}, {41+0.5, 0.163043}, {46+0.5, 0.108696}, {51+0.5, 0.0652174}, {56+0.5, 0.0434783}, {61+0.5, 0.0326087}, {66+0.5, 0.0217391}, {71+0.5, 0.0217391}, {76+0.5, 0.0108696}};
std::vector<std::vector<double>> newVaskenData = {{1.5, 0.}, {4, 0.28}, {6.5, 0.55}, {9, 0.92}, {11.5, 1.}, {14, 0.92}, {16.5, 0.75}, {19, 0.6}, {21.5, 0.49}, {24, 0.38}, {26.5, 0.3}, {29, 0.22}, {31.5, 0.195}, {34, 0.17}, {36.5, 0.135}, {39, 0.1}, {41.5, 0.065}, {44, 0.03}, {46.5, 0.02}, {49, 0.015}};
std::vector<std::vector<double>> deConvData = {{0+9, 7.2148e-8}, {2.5+9, 1.}, {5+9, 0.782907}, {7.5+9, 0.609704}, {10+9,0.472491}, {12.5+9, 0.36717}, {15+9, 0.286479}, {17.5+9, 0.223696}, {20+9,0.175492}, {22.5+9, 0.140742}, {25+9, 0.114989}, {27.5+9, 0.091602}, {30+9,0.0691305}, {32.5+9, 0.0483683}, {35+9, 0.0305398}, {37.5+9,0.0182155}, {40+9, 0.0107121}};
std::vector<std::vector<double>> deConvDataSpline = {{0, 0.}, {1, 0.}, {2, 0.}, {3, 0.}, {4, 0.}, {5, 0.}, {6, 0.}, {7, 0.}, {8, 0.}, {9, 0.056}, {10, 0.168}, {11, 0.28}, {12, 0.388}, {13, 0.496}, {14, 0.624}, {15, 0.772}, {16, 0.92}, {17, 0.952}, {18, 0.984}, {19, 0.984}, {20, 0.952}, {21, 0.92}, {22, 0.852}, {23, 0.784}, {24, 0.72}, {25, 0.66}, {26, 0.6}, {27, 0.556}, {28, 0.512}, {29, 0.468}, {30, 0.424}, {31, 0.38}, {32, 0.348}, {33, 0.316}, {34, 0.284}, {35, 0.252}, {36, 0.22}, {37, 0.21}, {38, 0.2}, {39, 0.19}, {40, 0.18}, {41, 0.17}, {42, 0.156}, {43, 0.142}, {44, 0.128}, {45, 0.114}, {46, 0.1}, {47, 0.086}, {48, 0.072}, {49, 0.058}, {50, 0.044}};
std::vector<std::vector<double>> laser = {{0 - 0.8 , 0.0000},
{2.5 - 0.8 , 0.0500},
{5 - 0.8 , 0.1200},
{7.5 - 0.8 , 0.3000},
{10 - 0.8 , 0.8100},
{12.5- 0.8 , 1.0000},
{15 - 0.8 , 0.5800},
{17.5- 0.8 , 0.3200},
{20 - 0.8 , 0.2300},
{22.5- 0.8 , 0.1400},
{25 - 0.8 , 0.0700},
{27.5- 0.8 , 0.0200},
{30 - 0.8 , 0.0000},
{32.5- 0.8 , 0.0000},
{35 - 0.8 , 0.0000},
{37.5- 0.8 , 0.0000},
{40 - 0.8 , 0.0000},
{42.5- 0.8 , 0.0000},
{45 - 0.8 , 0.0000},
{47.5- 0.8 , 0.0000},
{50 - 0.8 , 0.0000}};
int NumChan = 30;
std::vector<double> inputdata = {3.7665760461,4.0422160673,4.2281149251,4.2132054049,3.7893591002,3.7853358871,3.9801206355,3.9922329609,3.7813336691,3.6370119154,3.6394002971,3.3681342725,4.7382446359,4.2945539925,4.1303579261,4.4371316944,4.0908449675,3.8981446422,5.2651489220,5.1899996418,4.7089850164,4.7557141786,4.7737064049,4.6093941850,4.0151948685,3.0016563916,4.9577196389,4.1812668491,3.9242792267,3.981036542};
std::vector<double> antonInputData = {3.993252033,4.279162602,4.614747967,4.677569106,4.241711382,4.456349593,4.243378049,4.209447154,4.003313008,3.847406504,3.960268293,3.635552846,5.456808943,4.570471545,4.472073171,4.774951220,4.386089431,4.184975610,5.627140244,5.500500000,5.341067073,5.074073171,5.429469512,5.044420732,7.584536585,1.906121951,5.472626016,4.597008130,4.134069106,4.207983740};
std::vector< std::vector<double>> data = {{18,5,2,0},{18,6,2,0},{19,5,2,0},{19,6,2,0},{20,5,2,0},{20,6,2,0},{18,5,3,0},{18,6,3,0},{19,5,3,0},{19,6,3,0},{20,5,3,0},{20,6,3,0},{18,5,4,0},{18,6,4,0},{19,5,4,0},{19,6,4,0},{20,5,4,0},{20,6,4,0},{18,5,5,0},{18,6,5,0},{19,5,5,0},{19,6,5,0},{20,5,5,0},{20,6,5,0},{18,5,6,0},{18,6,6,0},{19,5,6,0},{19,6,6,0},{20,5,6,0},{20,6,6,0}};
std::vector< std::vector<double>> antonData = {{18,5,2,0},{18,6,2,0},{19,5,2,0},{19,6,2,0},{20,5,2,0},{20,6,2,0},{18,5,3,0},{18,6,3,0},{19,5,3,0},{19,6,3,0},{20,5,3,0},{20,6,3,0},{18,5,4,0},{18,6,4,0},{19,5,4,0},{19,6,4,0},{20,5,4,0},{20,6,4,0},{18,5,5,0},{18,6,5,0},{19,5,5,0},{19,6,5,0},{20,5,5,0},{20,6,5,0},{18,5,6,0},{18,6,6,0},{19,5,6,0},{19,6,6,0},{20,5,6,0},{20,6,6,0}};
|
90f5c5b2ee73ab33d11224a60dba5da4fc40b591 | 9fd9b59df6f8f11ca5e52e51db2dbcfa9fc3fd2a | /include/pstl/internal/unseq_backend_simd.h | 4ee09ebf2fb200e4a4cda2bb3a30e14146a448bf | [
"Apache-2.0"
] | permissive | rodgert/parallelstl | c188710712e674bc14a60f0cd4c531122fbc6cee | edce9abf40db9b4d929b6f2629aecf85eef9ac0e | refs/heads/master | 2020-03-21T16:36:36.607556 | 2018-06-28T19:06:52 | 2018-06-28T19:06:52 | 118,273,733 | 0 | 1 | Apache-2.0 | 2018-05-31T15:33:08 | 2018-01-20T19:25:41 | C++ | UTF-8 | C++ | false | false | 18,330 | h | unseq_backend_simd.h | /*
Copyright (c) 2017-2018 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef __PSTL_vector_impl_H
#define __PSTL_vector_impl_H
#include <algorithm> //for std::min
#include <type_traits>
#include "pstl_config.h"
#include "utils.h"
// This header defines the minimum set of vector routines required
// to support parallel STL.
namespace __pstl {
namespace unseq_backend {
template<class _Iterator, class _DifferenceType, class _Function>
_Iterator simd_walk_1(_Iterator __first, _DifferenceType __n, _Function __f) noexcept {
__PSTL_PRAGMA_SIMD
for(_DifferenceType __i = 0; __i < __n; ++__i)
__f(__first[__i]);
return __first + __n;
}
template<class _Iterator1, class _DifferenceType, class _Iterator2, class _Function>
_Iterator2 simd_walk_2(_Iterator1 __first1, _DifferenceType __n, _Iterator2 __first2, _Function __f) noexcept {
__PSTL_PRAGMA_SIMD
for(_DifferenceType __i = 0; __i < __n; ++__i)
__f(__first1[__i], __first2[__i]);
return __first2 + __n;
}
template<class _Iterator1, class _DifferenceType, class _Iterator2, class _Iterator3, class _Function>
_Iterator3 simd_walk_3(_Iterator1 __first1, _DifferenceType __n, _Iterator2 __first2, _Iterator3 __first3, _Function __f) noexcept {
__PSTL_PRAGMA_SIMD
for(_DifferenceType __i = 0; __i < __n; ++__i)
__f(__first1[__i], __first2[__i], __first3[__i]);
return __first3 + __n;
}
// TODO: check whether simd_first() can be used here
template<class _Index, class _DifferenceType, class _Pred>
bool simd_or(_Index __first, _DifferenceType __n, _Pred __pred) noexcept {
#if __PSTL_EARLYEXIT_PRESENT
_DifferenceType __i;
__PSTL_PRAGMA_VECTOR_UNALIGNED
__PSTL_PRAGMA_SIMD_EARLYEXIT
for(__i = 0; __i < __n; ++__i)
if(__pred(__first[__i]))
break;
return __i < __n;
#else
_DifferenceType __block_size = std::min<_DifferenceType>(4, __n);
const _Index __last = __first + __n;
while ( __last != __first ) {
int32_t __flag = 1;
__PSTL_PRAGMA_SIMD_REDUCTION(&:__flag)
for ( _DifferenceType __i = 0; __i < __block_size; ++__i )
if ( __pred(*(__first + __i)) )
__flag = 0;
if ( !__flag )
return true;
__first += __block_size;
if ( __last - __first >= __block_size << 1 ) {
// Double the block size. Any unnecessary iterations can be amortized against work done so far.
__block_size <<= 1;
}
else {
__block_size = __last - __first;
}
}
return false;
#endif
}
template<class _Index, class _DifferenceType, class _Compare>
_Index simd_first(_Index __first, _DifferenceType __begin, _DifferenceType __end, _Compare __comp) noexcept {
#if __PSTL_EARLYEXIT_PRESENT
_DifferenceType __i = __begin;
__PSTL_PRAGMA_VECTOR_UNALIGNED // Do not generate peel loop part
__PSTL_PRAGMA_SIMD_EARLYEXIT
for (; __i < __end; ++__i) {
if (__comp(__first, __i)) {
break;
}
}
return __first + __i;
#else
// Experiments show good block sizes like this
const _DifferenceType __block_size = 8;
alignas(64) _DifferenceType __lane[__block_size] = { 0 };
while (__end - __begin >= __block_size) {
_DifferenceType __found = 0;
__PSTL_PRAGMA_VECTOR_UNALIGNED // Do not generate peel loop part
__PSTL_PRAGMA_SIMD_REDUCTION(| :__found)
for (_DifferenceType __i = __begin; __i < __begin + __block_size; ++__i) {
const _DifferenceType __t = __comp(__first, __i);
__lane[__i - __begin] = __t;
__found |= __t;
}
if (__found) {
_DifferenceType __i;
// This will vectorize
for (__i = 0; __i < __block_size; ++__i) {
if (__lane[__i]) {
break;
}
}
return __first + __begin + __i;
}
__begin += __block_size;
}
//Keep remainder scalar
while (__begin != __end) {
if (__comp(__first, __begin)) {
return __first + __begin;
}
++__begin;
}
return __first + __end;
#endif //__PSTL_EARLYEXIT_PRESENT
}
template<class _Index1, class _DifferenceType, class _Index2, class _Pred>
std::pair<_Index1, _Index2> simd_first(_Index1 __first1, _DifferenceType __n, _Index2 __first2, _Pred __pred) noexcept {
#if __PSTL_EARLYEXIT_PRESENT
_DifferenceType __i = 0;
__PSTL_PRAGMA_VECTOR_UNALIGNED
__PSTL_PRAGMA_SIMD_EARLYEXIT
for(;__i < __n; ++__i)
if(__pred(__first1[__i], __first2[__i]))
break;
return std::make_pair(__first1 + __i, __first2 + __i);
#else
const _Index1 __last1 = __first1 + __n;
const _Index2 __last2 = __first2 + __n;
// Experiments show good block sizes like this
const _DifferenceType __block_size = 8;
alignas(64) _DifferenceType __lane[__block_size] = {0};
while ( __last1 - __first1 >= __block_size ) {
_DifferenceType __found = 0;
_DifferenceType __i;
__PSTL_PRAGMA_VECTOR_UNALIGNED // Do not generate peel loop part
__PSTL_PRAGMA_SIMD_REDUCTION(|:__found)
for ( __i = 0; __i < __block_size; ++__i ) {
const _DifferenceType __t = __pred(__first1[__i], __first2[__i]);
__lane[__i] = __t;
__found |= __t;
}
if ( __found ) {
_DifferenceType i;
// This will vectorize
for ( __i = 0; __i < __block_size; ++__i ) {
if ( __lane[__i] ) break;
}
return std::make_pair(__first1 + __i, __first2 + __i);
}
__first1 += __block_size;
__first2 += __block_size;
}
//Keep remainder scalar
for(; __last1 != __first1; ++__first1, ++__first2)
if ( __pred(*(__first1), *(__first2)) )
return std::make_pair(__first1, __first2);
return std::make_pair(__last1, __last2);
#endif //__PSTL_EARLYEXIT_PRESENT
}
template<class _Index, class _DifferenceType, class _Pred>
_DifferenceType simd_count(_Index __index, _DifferenceType __n, _Pred __pred) noexcept {
_DifferenceType __count = 0;
__PSTL_PRAGMA_SIMD_REDUCTION(+:__count)
for (_DifferenceType __i = 0; __i < __n; ++__i)
if (__pred(*(__index + __i)))
++__count;
return __count;
}
template<class _InputIterator, class _DifferenceType, class _OutputIterator, class _BinaryPredicate>
_OutputIterator simd_unique_copy(_InputIterator __first, _DifferenceType __n, _OutputIterator __result,
_BinaryPredicate __pred) noexcept {
if (__n == 0)
return __result;
_DifferenceType __cnt = 1;
__result[0] = __first[0];
__PSTL_PRAGMA_SIMD
for (_DifferenceType __i = 1; __i < __n; ++__i) {
__PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC(__cnt:1)
if (!__pred(__first[__i], __first[__i - 1])) {
__result[__cnt] = __first[__i];
++__cnt;
}
}
return __result + __cnt;
}
template<class _InputIterator, class _DifferenceType, class _OutputIterator, class _Assigner>
_OutputIterator simd_copy_move(_InputIterator __first, _DifferenceType __n, _OutputIterator __result, _Assigner __assigner) noexcept {
__PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED
__PSTL_PRAGMA_SIMD
for (_DifferenceType __i = 0; __i < __n; ++__i)
__assigner(__first + __i, __result + __i);
return __result + __n;
}
template<class _InputIterator, class _DifferenceType, class _OutputIterator, class _UnaryPredicate>
_OutputIterator simd_copy_if(_InputIterator __first, _DifferenceType __n, _OutputIterator __result, _UnaryPredicate __pred) noexcept {
_DifferenceType __cnt = 0;
__PSTL_PRAGMA_SIMD
for(_DifferenceType __i = 0; __i < __n; ++__i) {
__PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC(__cnt:1)
if(__pred(__first[__i])) {
__result[__cnt] = __first[__i];
++__cnt;
}
}
return __result + __cnt;
}
template<class _InputIterator, class _DifferenceType, class _BinaryPredicate>
_DifferenceType simd_calc_mask_2(_InputIterator __first, _DifferenceType __n, bool* __restrict __mask, _BinaryPredicate __pred) noexcept {
_DifferenceType __count = 0;
__PSTL_PRAGMA_SIMD_REDUCTION(+:__count)
for (_DifferenceType __i = 0; __i < __n; ++__i) {
__mask[__i] = !__pred(__first[__i], __first[__i - 1]);
__count += __mask[__i];
}
return __count;
}
template<class _InputIterator, class _DifferenceType, class _UnaryPredicate>
_DifferenceType simd_calc_mask_1(_InputIterator __first, _DifferenceType __n, bool* __restrict __mask, _UnaryPredicate __pred) noexcept {
_DifferenceType __count = 0;
__PSTL_PRAGMA_SIMD_REDUCTION(+:__count)
for (_DifferenceType __i = 0; __i < __n; ++__i) {
__mask[__i] = __pred(__first[__i]);
__count += __mask[__i];
}
return __count;
}
template<class _InputIterator, class _DifferenceType, class _OutputIterator>
void simd_copy_by_mask(_InputIterator __first, _DifferenceType __n, _OutputIterator __result, bool* __restrict __mask) noexcept {
_DifferenceType __cnt = 0;
__PSTL_PRAGMA_SIMD
for (_DifferenceType __i = 0; __i < __n; ++__i) {
__PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC(__cnt:1)
if (__mask[__i]) {
__result[__cnt] = __first[__i];
++__cnt;
}
}
}
template<class _InputIterator, class _DifferenceType, class _OutputIterator1, class _OutputIterator2>
void simd_partition_by_mask(_InputIterator __first, _DifferenceType __n, _OutputIterator1 __out_true, _OutputIterator2 __out_false,
bool* __mask) noexcept {
_DifferenceType __cnt_true = 0, __cnt_false = 0;
__PSTL_PRAGMA_SIMD
for (_DifferenceType __i = 0; __i < __n; ++__i) {
__PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC_2ARGS(__cnt_true:1, __cnt_false:1)
if (__mask[__i]) {
__out_true[__cnt_true] = __first[__i];
++__cnt_true;
}
else {
__out_false[__cnt_false] = __first[__i];
++__cnt_false;
}
}
}
template<class _Index, class _DifferenceType, class _Tp>
_Index simd_fill_n(_Index __first, _DifferenceType __n, const _Tp& __value) noexcept {
__PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED
__PSTL_PRAGMA_SIMD
for (_DifferenceType __i = 0; __i < __n; ++__i)
__first[__i] = __value;
return __first + __n;
}
template<class _Index, class _DifferenceType, class _Generator>
_Index simd_generate_n(_Index __first, _DifferenceType __size, _Generator __g) noexcept {
__PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED
__PSTL_PRAGMA_SIMD
for (_DifferenceType __i = 0; __i < __size; ++__i)
__first[__i] = __g();
return __first + __size;
}
template<class _Index, class _BinaryPredicate>
_Index simd_adjacent_find(_Index __first, _Index __last, _BinaryPredicate __pred, bool __or_semantic) noexcept {
if(__last - __first < 2)
return __last;
typedef typename std::iterator_traits<_Index>::difference_type _DifferenceType;
_DifferenceType __i = 0;
#if __PSTL_EARLYEXIT_PRESENT
//Some compiler versions fail to compile the following loop when iterators are used. Indices are used instead
const _DifferenceType __n = __last - __first-1;
__PSTL_PRAGMA_VECTOR_UNALIGNED
__PSTL_PRAGMA_SIMD_EARLYEXIT
for(; __i < __n; ++__i)
if(__pred(__first[__i], __first[__i + 1]))
break;
return __i < __n ? __first + __i : __last;
#else
// Experiments show good block sizes like this
//TODO: to consider tuning block_size for various data types
const _DifferenceType __block_size = 8;
alignas(64) _DifferenceType __lane[__block_size] = {0};
while ( __last - __first >= __block_size ) {
_DifferenceType __found = 0;
__PSTL_PRAGMA_VECTOR_UNALIGNED // Do not generate peel loop part
__PSTL_PRAGMA_SIMD_REDUCTION(|:__found)
for ( __i = 0; __i < __block_size-1; ++__i ) {
//TODO: to improve SIMD vectorization
const _DifferenceType __t = __pred(*(__first + __i), *(__first + __i + 1));
__lane[__i] = __t;
__found |= __t;
}
//Process a pair of elements on a boundary of a data block
if(__first + __block_size < __last && __pred(*(__first + __i), *(__first + __i + 1)))
__lane[__i] = __found = 1;
if ( __found ) {
if(__or_semantic)
return __first;
// This will vectorize
for ( __i = 0; __i < __block_size; ++__i )
if ( __lane[__i] ) break;
return __first + __i; //As far as found is true a result (lane[i] is true) is guaranteed
}
__first += __block_size;
}
//Process the rest elements
for (; __last - __first > 1; ++__first)
if(__pred(*__first, *(__first+1)))
return __first;
return __last;
#endif
}
template<typename _InputIterator1, typename _DifferenceType, typename _InputIterator2, typename _Tp, typename _BinaryOperation>
_Tp simd_transform_reduce(_InputIterator1 __first1, _DifferenceType __n, _InputIterator2 __first2, _Tp __init,
_BinaryOperation __binary_op) noexcept {
__PSTL_PRAGMA_SIMD_REDUCTION(+:__init)
for(_DifferenceType __i = 0; __i < __n; ++__i)
__init += __binary_op(__first1[__i], __first2[__i]);
return __init;
};
template<typename _InputIterator, typename _DifferenceType, typename _Tp, typename _UnaryOperation>
_Tp simd_transform_reduce(_InputIterator __first, _DifferenceType __n, _Tp __init, _UnaryOperation __unary_op) noexcept {
__PSTL_PRAGMA_SIMD_REDUCTION(+:__init)
for(_DifferenceType __i = 0; __i < __n; ++__i)
__init += __unary_op(__first[__i]);
return __init;
};
template<class _Iterator, class _DifferenceType, class _Function>
_Iterator simd_it_walk_1(_Iterator __first, _DifferenceType __n, _Function __f) noexcept {
__PSTL_PRAGMA_SIMD
for(_DifferenceType __i = 0; __i < __n; ++__i)
__f(__first + __i);
return __first + __n;
}
template<class _Iterator1, class _DifferenceType, class _Iterator2, class _Function>
_Iterator2 simd_it_walk_2(_Iterator1 __first1, _DifferenceType __n, _Iterator2 __first2, _Function __f) noexcept {
__PSTL_PRAGMA_SIMD
for (_DifferenceType __i = 0; __i < __n; ++__i)
__f(__first1 + __i, __first2 + __i);
return __first2 + __n;
}
template<class _InputIterator, class _DifferenceType, class _OutputIterator1, class _OutputIterator2, class _UnaryPredicate>
std::pair<_OutputIterator1, _OutputIterator2>
simd_partition_copy(_InputIterator __first, _DifferenceType __n, _OutputIterator1 __out_true, _OutputIterator2 __out_false,
_UnaryPredicate __pred) noexcept {
_DifferenceType __cnt_true = 0, __cnt_false = 0;
__PSTL_PRAGMA_SIMD
for (_DifferenceType __i = 0; __i < __n; ++__i) {
__PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC_2ARGS(__cnt_true:1, __cnt_false : 1)
if (__pred(__first[__i])) {
__out_true[__cnt_true] = __first[__i];
++__cnt_true;
}
else {
__out_false[__cnt_false] = __first[__i];
++__cnt_false;
}
}
return std::make_pair(__out_true + __cnt_true, __out_false + __cnt_false);
}
template<class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
_ForwardIterator1 simd_find_first_of(_ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first,
_ForwardIterator2 __s_last, _BinaryPredicate __pred) noexcept {
typedef typename std::iterator_traits<_ForwardIterator1>::difference_type _DifferencType;
const _DifferencType __n1 = __last - __first;
const _DifferencType __n2 = __s_last - __s_first;
if (__n1 == 0 || __n2 == 0) {
return __last; // according to the standard
}
// Common case
// If first sequence larger than second then we'll run simd_first with parameters of first sequence.
// Otherwise, vice versa.
if (__n1 < __n2)
{
for (; __first != __last; ++__first) {
if (simd_or(__s_first, __n2,
internal::equal_value_by_pred<decltype(*__first), _BinaryPredicate>(*__first, __pred))) {
return __first;
}
}
}
else {
for (; __s_first != __s_last; ++__s_first) {
const auto __result = unseq_backend::simd_first(__first, _DifferencType(0), __n1,
[__s_first, &__pred](_ForwardIterator1 __it, _DifferencType __i) {return __pred(__it[__i], *__s_first); });
if (__result != __last) {
return __result;
}
}
}
return __last;
}
template<class _RandomAccessIterator, class _DifferenceType, class _UnaryPredicate>
_RandomAccessIterator simd_remove_if(_RandomAccessIterator __first, _DifferenceType __n, _UnaryPredicate __pred) noexcept {
// find __first element we need to remove
auto __current = unseq_backend::simd_first(__first, _DifferenceType(0), __n,
[&__pred](_RandomAccessIterator __it, _DifferenceType __i) {return __pred(__it[__i]); });
__n -= __current - __first;
// if we have in sequence only one element that pred(current[1]) != false we can exit the function
if (__n < 2) {
return __current;
}
#if __PSTL_MONOTONIC_PRESENT
_DifferenceType __cnt = 0;
__PSTL_PRAGMA_SIMD
for (_DifferenceType __i = 1; __i < __n; ++__i) {
__PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC(__cnt:1)
if (!__pred(__current[__i])) {
__current[__cnt] = std::move(__current[__i]);
++__cnt;
}
}
return __current + __cnt;
#else
return std::remove_if(__current, __current + __n, __pred);
#endif
}
} // namespace unseq_backend
} // namespace __pstl
#endif /* __PSTL_vector_impl_H */
|
9589f920b5de9cf071770905ea113c68395ec61d | 8a5286e8c3a5cda1a357a5014d5c5ce748695c64 | /src/test/swipe_prediction_test.cpp | 9dfc8ec229305a12196cf4e47d5542abba6e6685 | [] | no_license | julesmps/keyboard-swiping | b389230c7df7daddb917047a64fb3e3564b98397 | 621a9b4d441fd80379c17a5b88300c6382578d87 | refs/heads/main | 2023-01-21T10:11:50.662184 | 2020-12-07T03:21:54 | 2020-12-07T03:21:54 | 316,784,233 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,669 | cpp | swipe_prediction_test.cpp | // Juliana Pacheco
// University of Florida
#include "src/swipe_prediction.h"
#include "gtest/gtest.h"
#include <string>
#include <utility>
#include <vector>
using source_type = std::vector<std::pair<std::string, std::size_t>>;
using input_type = std::vector<std::set<char>>;
using test_param_type = std::pair<input_type, std::string>;
testing::AssertionResult contains(const Swipe& obj, const std::string& w) {
if(obj.contains(w))
return testing::AssertionSuccess() << "Swipe contains word '" << w << '\'';
else
return testing::AssertionFailure() << "Swipe doesn't contain word '" << w << '\'';
}
template <typename T>
testing::AssertionResult contains(const std::vector<T>& vect, const T& q) {
bool found = false;
for(auto iter = vect.cbegin(); iter != vect.cend(); ++iter)
if(*iter == q) {
found = true;
break;
}
if(found)
return testing::AssertionSuccess() << "Vector contains item '" << q << '\'';
else
return testing::AssertionFailure() << "Vector doesn't contain item'" << q << '\'';
}
const source_type init_list = {
{"test", 350 },
{"pizza", 982 },
{"pasta", 953 },
{"find", 512 },
{"fiend", 42 },
{"friend", 477 },
{"utility", 98 },
{"page", 105 },
{"book", 87 },
{"fund", 66 },
{"map", 345 },
{"geography", 53 },
{"train", 612 },
{"teach", 214 }
};
Swipe swipe(init_list.cbegin(), init_list.cend());
const std::vector<test_param_type> params = {
{ { { 'T' }, { 'R', 'T' }, { 'R' }, { 'E', 'R' }, { 'E' }, { 'E', 'S', 'D' },
{ 'W', 'E', 'S', 'D' }, { 'S', 'D' }, { 'D' }, { 'D', 'F' }, { 'F' },
{ 'R', 'T', 'F' }, { 'R', 'T', 'F', 'G' }, { 'T', 'F', 'G' }, { 'T' }
}, "test" },
{ { { 'F' }, { 'R', 'T', 'F' }, { 'R', 'F' }, { 'R' }, { 'R', 'T' }, { 'T' },
{ 'T', 'Y' }, { 'Y' }, { 'Y', 'U' }, { 'U' }, { 'U', 'I' }, { 'U' },
{ 'Y', 'U' }, { 'Y' }, { 'T', 'Y' }, { 'T' }, { 'R', 'T' }, { 'R' },
{ 'E', 'R' }, { 'E' }, { 'E', 'R' }, { 'R', 'D', 'F' }, { 'R', 'F' },
{ 'F' }, { 'F', 'G' }, { 'G', 'V' }, { 'G', 'V', 'B' },
{ 'G', 'H', 'V', 'B' }, { 'G', 'H', 'B' }, { 'B' }, { 'B', 'N' }, { 'B' },
{ 'V', 'B' }, { 'G', 'V', 'B' }, { 'F', 'G', 'V' }, { 'F', 'G', 'C', 'V' },
{ 'F', 'C', 'V' }, { 'F', 'C' }, { 'D', 'F', 'C' }, { 'D', 'F', 'X', 'C' },
{ 'D', 'X', 'C' }, { 'D' }
}, "friend" },
{ { { 'P' }, { 'O', 'P' }, { 'O' }, { 'I', 'O' }, { 'I' }, { 'U', 'I' },
{ 'U' }, { 'Y', 'U', 'H', 'J' }, { 'Y', 'H' }, { 'Y', 'G', 'H' },
{ 'T', 'Y', 'G', 'H' }, { 'T', 'Y', 'G' }, { 'T', 'G' }, { 'T', 'F', 'G' },
{ 'R', 'T', 'F', 'G' }, { 'R', 'T', 'F' }, { 'R', 'F' }, { 'R', 'D', 'F' },
{ 'E', 'R', 'D', 'F' }, { 'E', 'R', 'D' }, { 'E', 'D' }, { 'E', 'S', 'D' },
{ 'W', 'E', 'S', 'D' }, { 'W', 'E', 'S' }, { 'W', 'S' }, { 'W', 'A', 'S' },
{ 'Q', 'W', 'A', 'S' }, { 'Q', 'W', 'A' }, { 'A' }, { 'A', 'S' }, { 'S' },
{ 'S', 'D' }, { 'D' }, { 'D', 'F' }, { 'E', 'R', 'D', 'F' },
{ 'R', 'D', 'F' }, { 'R', 'F' }, { 'R', 'T', 'F' }, { 'R', 'T', 'F', 'G' },
{ 'T', 'F', 'G' }, { 'T' }, { 'R', 'T' }, { 'R' }, { 'R', 'D', 'F' },
{ 'E', 'R', 'D', 'F' }, { 'E', 'R', 'D' }, { 'E', 'D' }, { 'E', 'S', 'D' },
{ 'W', 'E', 'S', 'D' }, { 'S' }, { 'A', 'S' }, { 'A' }
}, "pasta" },
{ { { 'M' }, { 'N', 'M' }, { 'N' }, { 'B', 'N' }, { 'B' }, { 'V', 'B' },
{ 'V' }, { 'C', 'V' }, { 'C' }, { 'X', 'C' }, { 'D', 'X', 'C' },
{ 'D', 'X' }, { 'S', 'D', 'X' }, { 'S', 'D', 'Z', 'X' }, { 'S', 'Z', 'X' },
{ 'S', 'Z' }, { 'A', 'S', 'Z' }, { 'A', 'S' }, { 'A' }, { 'A', 'S' },
{ 'S' }, { 'S', 'D' }, { 'D' }, { 'D', 'F' }, { 'F' }, { 'R', 'F' },
{ 'R', 'T', 'F' }, { 'R', 'T', 'F', 'G' }, { 'T', 'F', 'G' }, { 'T', 'G' },
{ 'T', 'Y', 'G' }, { 'T', 'Y', 'G', 'H' }, { 'Y', 'G', 'H' }, { 'Y', 'H' },
{ 'Y', 'U', 'H' }, { 'Y', 'U', 'H', 'J' }, { 'U', 'H', 'J' }, { 'U', 'J' },
{ 'U', 'I', 'J' }, { 'U', 'I', 'J', 'K' }, { 'I', 'J', 'K' }, { 'I', 'K' },
{ 'I', 'O', 'K' }, { 'I', 'O', 'K', 'L' }, { 'O', 'K', 'L' }, { 'O', 'L' },
{ 'O', 'P', 'L' }, { 'P', 'L' }, { 'P' }
}, "map" }
};
class SwipePredictionTest : public testing::TestWithParam<test_param_type> {};
TEST_P(SwipePredictionTest, SuggestionsContains) {
ASSERT_TRUE(contains(swipe, GetParam().second));
swipe.reset();
const input_type& input = GetParam().first;
for(const std::set<char>& keys : input)
swipe.advance(keys);
EXPECT_TRUE(contains(swipe.get(), GetParam().second));
}
INSTANTIATE_TEST_SUITE_P(PredictionMatch, SwipePredictionTest, testing::ValuesIn(params));
|
8a0ec9477b3a4581da1240fd98e56b1052f2e966 | 2ea2cd1cf25acd6992a3312e87b29c95c05d5925 | /examples/face_fitting/src/WarpingSolverState.h | d663b202289568bbbc2675ee9ed531cd3da22b15 | [] | no_license | thallolang/thallo | 3ed0ce600bdaa12a2abbfc6b939aa18c632bf05f | 22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd | refs/heads/main | 2023-07-06T14:02:57.578934 | 2021-08-13T19:23:35 | 2021-08-13T19:23:35 | 395,386,620 | 20 | 6 | null | null | null | null | UTF-8 | C++ | false | false | 1,109 | h | WarpingSolverState.h | #pragma once
#ifndef _SOLVER_STATE_
#define _SOLVER_STATE_
#include <cuda_runtime.h>
#ifndef MINF
#ifdef __CUDACC__
#define MINF __int_as_float(0xff800000)
#else
#define MINF (std::numeric_limits<float>::infinity())
#endif
#endif
//#define Stereo_ENABLED
#define LE_THREAD_SIZE 16
struct SolverInput
{
unsigned int N; // Number of vertices
unsigned int M; // Number of variables
float wReg;
int* d_numNeighbours;
int* d_neighbourIdx;
int* d_neighbourOffset;
};
struct SolverState
{
// State of the GN Solver
float2* d_target;
float3* d_mesh;
float3* d_average;
float* d_blendshapeWeights;
float3* d_blendshapeBasis;
float* d_camParams;
float2* d_Jv;
float* d_JTv;
float* d_Jv2;
float* d_delta;
float* d_r;
float* d_z;
float* d_p;
float* d_Ap;
float* d_scanAlpha;
float* d_scanBeta;
float* d_rDotzOld;
float* d_precondioner;
float* d_sumResidual;
__host__ float getSumResidual() const {
float residual;
cudaMemcpy(&residual, d_sumResidual, sizeof(float), cudaMemcpyDeviceToHost);
return residual;
}
};
#endif
|
528074e87041d9b662b7a605bdb0b7f2e95676cf | 973422e8a0ea40474b46082bbb5a146fa762e19c | /c++/0702/0702/0702.cpp | 96e2906e54eb78c807efa8852236a068170e75f3 | [] | no_license | YunHoseon/InhaStudy | 45e0e7671dc09b313a1b3b4281dead93d8f33633 | edde0627d335a2cf83dd369b6a3b0b96d6aa4461 | refs/heads/master | 2022-12-08T16:03:25.194855 | 2020-09-14T19:19:10 | 2020-09-14T19:19:10 | 273,371,294 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 1,111 | cpp | 0702.cpp | #include <iostream>
#include <time.h>
#include <random>
#define SIZE 9
using namespace std;
bool CheckSort(int arr[], int n)
{
for (int i = 0; i < n - 1; i++)
{
if (arr[i] > arr[i + 1])
{
return false;
}
}
}
int MergeSort(int arr[], int left, int right)
{
int pl = left, pr = right;
int tmp;
int tmpArr[SIZE] = { 0 };
//if ((left + right) / 2 <= 0 || right <= 0) //리스트 크기 <= 0 일 때 종료
// return 0;
return 0;
for (int i = 0; i < 9; i++)
{
cout << arr[i] << " ";
}
cout << endl;
MergeSort(arr, left, (left + right) / 2);
MergeSort(arr, (left + right) / 2 + 1, right);
/*while(1)
{
}*/
}
int main()
{
int arr[9] = { 5,1,7,4,6,2,3,9,8 };
random_device rd;
mt19937_64 gen(rd());
uniform_int_distribution<int> dis(1, SIZE*SIZE);
srand((unsigned)time(NULL));
int randNumArr[SIZE] = { 0 };
for (int i = 0; i < SIZE; i++)
{
int randNum = dis(gen);
randNumArr[i] = randNum;
}
//MergeSort(randNumArr, 0, SIZE - 1);
MergeSort(arr, 0, SIZE-1);
for (int i = 0; i < SIZE; i++) //정렬된 배열 출력
cout << arr[i] << " ";
cout << endl;
} |
89c17bdc5d6128472b7a3d3b363dede0d257376e | 52b2830bf0f99c98265d6787fb3aa4a2d388f622 | /server.cpp | 5eb55603aa355ff31b6749f4615292b60ac969e2 | [] | no_license | ospanoff/HTTP-server | ac93e61913fe18557ff773bb64c306c1f250f179 | 3989fae1743c023e6d5fd3b9c7315e710729fc10 | refs/heads/master | 2020-12-24T18:04:25.470724 | 2014-05-26T12:11:56 | 2014-05-26T12:11:56 | 29,411,914 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,678 | cpp | server.cpp | // Server @ version 2.0, name .ospanoff
// copyright (c) .ospanoff
// Ayat ".ospanoff" Ospanov
// CMC, KB MSU, 2013 - 2014
#include <set>
#include <map>
#include <algorithm>
// #include <fcntl.h>
#include "lib/sock_create.h"
#include "lib/http_ans.h"
#define MAX_CLIENT 5
int listener;
using namespace std;
void sig_chld(int o)
{
cout << "Child: ";
cout << waitpid(0, NULL, WNOHANG) << '\n';
fflush(stdout);
}
void sig_int(int o)
{
cout << "\nServer turned off";
fflush(stdout);
shutdown(listener, 2);
close(listener);
signal(SIGINT, SIG_DFL);
raise(SIGINT);
}
int main(int argc, char **argv)
{
signal(SIGCHLD, sig_chld);
signal(SIGINT, sig_int);
int sock;
int bytes_read = 1024;
int max_fd;
struct sockaddr_in cl_ad;
fd_set fd_s;
// creating socket
listener = sock_create(argc, argv);
// --endof creating socket
// listening
if (listen(listener, MAX_CLIENT) < 0) {
perror("listen");
}
// --endof listening
set <int> clients; // here is clients descriptors
clients.clear();
map <int, struct sockaddr_in> cl_addr;
cl_addr.clear();
// setting up blocking signals
sigset_t sigmask;
sigemptyset (&sigmask);
sigaddset (&sigmask, SIGCHLD);
// --endof setting up
// receiving data from clients
while (7) {
// setting up select
FD_ZERO(&fd_s);
FD_SET(listener, &fd_s);
for (set<int>::iterator i = clients.begin(); i != clients.end(); i++) {
FD_SET(*i, &fd_s);
}
max_fd = max(listener, *max_element(clients.begin(), clients.end()));
sigprocmask (SIG_BLOCK, &sigmask, 0);
if (select(max_fd+1, &fd_s, NULL, NULL, NULL) <= 0) {
perror("select");
exit(1);
}
sigprocmask (SIG_UNBLOCK, &sigmask, 0);
// endof
// connecting and reading data
if (FD_ISSET(listener, &fd_s)) { // if new client, accepting
unsigned int len = sizeof(cl_ad);
sock = accept(listener, (struct sockaddr *) &cl_ad, &len);
if (sock < 0) {
perror("accept");
exit(1);
}
// fcntl(sock, F_SETFL, O_NONBLOCK);
clients.insert(sock);
cl_addr[sock] = cl_ad;
}
for (set<int>::iterator i = clients.begin(); i != clients.end(); i++) {
if (FD_ISSET(*i, &fd_s)) { // looking for ready client
char buf[1024];
// memset(buf, 0, bytes_read);
bytes_read = recv(*i, buf, sizeof(buf), 0); //buf.size();
if (bytes_read == 0) { // if client closed sock
close(*i);
cl_addr.erase(cl_addr.find(*i));
clients.erase(*i);
if (clients.size() == 0)
break;
} else { // if we recieved inf
// cout << buf;
// fflush(stdout);
answer_client(*i, buf, cl_addr[*i]);
memset(buf, 0, 1024);
}
}
}
}
shutdown(listener, 2);
close(listener);
return 0;
} |
3ce76e7f66b59bba914dd5bf0864d701586e2003 | e858606ccacb9a78bfb48ca90b56d9469cff7a09 | /RImageBook/src/thirdparty/x64/VTK/include/mrmpi/keymultivalue.h | 373ba9f26039c65b064d940fc4c005419bd9f42d | [] | no_license | tkatsuki/rimagebook | 51f41166e98d442f7b9e2226b65046586f95dfc8 | d26a1502faf39804bf8cb06d1699de24e6d53d58 | refs/heads/master | 2021-01-19T17:59:07.539596 | 2015-06-29T21:12:57 | 2015-06-29T21:12:57 | 38,264,836 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 2,796 | h | keymultivalue.h | /* ----------------------------------------------------------------------
MR-MPI = MapReduce-MPI library
http://www.cs.sandia.gov/~sjplimp/mapreduce.html
Steve Plimpton, sjplimp@sandia.gov, Sandia National Laboratories
Copyright (2009) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the modified Berkeley Software Distribution (BSD) License.
See the README file in the top-level MapReduce directory.
------------------------------------------------------------------------- */
#ifndef KEY_MULTIVALUE_H
#define KEY_MULTIVALUE_H
#include "mpi.h"
#include "mrmpi_config.h"
namespace MAPREDUCE_NS {
class MRMPI_EXPORT KeyMultiValue {
public:
int nkey; // # of KMV pairs
int keysize; // size of keydata array
int multivaluesize; // size of multivaluedata array
int *keys; // keys[i] = where Ith key starts in keydata
int *multivalues; // multivalues[i] = where Ith mv starts in mvdata
int *nvalues; // nvalues[i] = where values for Ith multivalue
// start in valuesizes
int *valuesizes; // size of each value in all multivalues
// valuesizes[nvalues[i]] = size of 1st value
// in Ith multivalue
char *keydata; // unique keys, one after another
char *multivaluedata; // multivalues, one after another
// values in a multivalue are one after another
int maxdepth; // max depth of any one hash bucket
KeyMultiValue(MPI_Comm);
KeyMultiValue(KeyMultiValue &);
~KeyMultiValue();
void convert(class KeyValue *);
void clone(class KeyValue *);
void collapse(char *, int, class KeyValue *);
void grow_buckets(KeyValue *);
int hash(char *, int);
int find(int, char *, int, class KeyValue *);
int match(char *, char *, int);
private:
MPI_Comm comm;
class Memory *memory;
struct Unique { // a unique key
int keyindex; // index in KV of this key
int mvsize; // total size of values of this key
int nvalue; // # of values of this key
int next; // index in uniques of next key in this hash bucket
};
int nunique; // # of unique keys in KMV
int maxunique; // max # of unique keys in uniques array
Unique *uniques; // list of unique keys
int *buckets; // bucket[i] = index of 1st key entry in this bucket
int nbuckets; // # of hash buckets
int hashmask; // bit mask for mapping into hash buckets
};
}
#endif
|
d45a996f2cbdcc15df76de3a21c741e5bf4a1362 | a04c155f980601ab0468a63f510a7a7d515afcdc | /subprojects/libostd/src/concurrency.cc | d14906070bfcbc56e2d7b37f97d58f267cf5665b | [
"Zlib",
"BSD-2-Clause",
"LicenseRef-scancode-unicode"
] | permissive | Croydon/libcubescript | 4e1799e1dac05f8b343d2a2cff0100749d41c102 | ea19f705704416e84b36d51f7e5ccc7a562b9701 | refs/heads/master | 2021-08-20T09:58:40.841996 | 2020-12-01T15:48:42 | 2020-12-01T15:48:42 | 232,191,867 | 0 | 0 | NOASSERTION | 2020-01-06T21:50:50 | 2020-01-06T21:50:49 | null | UTF-8 | C++ | false | false | 804 | cc | concurrency.cc | /* Concurrency C implementation bits.
*
* This file is part of libostd. See COPYING.md for futher information.
*/
#include "ostd/concurrency.hh"
namespace ostd {
/* place the vtable in here */
coroutine_error::~coroutine_error() {}
namespace detail {
/* place the vtable in here */
stack_free_iface::~stack_free_iface() {}
} /* namespace detail */
/* non-inline for vtable placement */
coroutine_context::~coroutine_context() {
unwind();
free_stack();
}
namespace detail {
/* place the vtable here, derived from coroutine_context */
csched_task::~csched_task() {}
OSTD_EXPORT scheduler *current_scheduler = nullptr;
OSTD_EXPORT thread_local csched_task *current_csched_task = nullptr;
} /* namespace detail */
scheduler::~scheduler() {}
} /* namespace ostd */
|
46eeeb30ace13468f1cc1a1a13be6b6425d4c0c8 | 252088bf108c83f07f964926b4add845dd642b19 | /Proyecto/src/shearsort.h | 58710fbecffc218fe51ae1b677c786d9736dc6fe | [] | no_license | CursosIE/IE-0217-II-16-G7 | 712368c1d21263e3241cb3f661398461d0e0305c | 6eeaec0e81145462db91e0a14a0d10edda1d56ad | refs/heads/master | 2020-04-05T22:56:43.962895 | 2016-10-24T07:06:50 | 2016-10-24T07:06:50 | 68,149,502 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 307 | h | shearsort.h | #ifndef SHEARSORT_H
#define SHEARSORT_H
#include <cstdlib>
#include <iostream>
#include "string"
using namespace std;
class Shearsort{
public:
int n;
double **matriz;
Shearsort();
Shearsort(int n, double** matriz);
~Shearsort();
void sort();
void operator~();
};
#endif /* SHEARSORT_H */
|
59a19268b1bd0a4dbfb09d138f526474a2352f93 | 643c739968557bb3b2a8970767e2ff09e9b7f43a | /CProgramming/ConsoleApplication variable argument.cpp | 716b273a0610b953f3ec4c3815111f3366bfb952 | [] | no_license | GP101/Programming | c8a6ca033577088f2cc84575d36305f6fde8b58b | 1ae8dacfcd9203c2b849fc435bdb5672f755d1a5 | refs/heads/master | 2022-12-04T05:50:15.347205 | 2022-11-30T08:19:15 | 2022-11-30T08:19:15 | 207,066,093 | 1 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 574 | cpp | ConsoleApplication variable argument.cpp | #include <stdio.h>
#include <stdarg.h>
int g = 0;
extern int g2;
int Sum(int count_, ...)
{
g2 += 1;
register int s = 0;
//int* ap = nullptr;
va_list ap;
//ap = &count_;
va_start(ap, count_);
for (int i = 0; i < count_; ++i)
{
int k;
//k = *(ap + 1);
//ap += 1;
k = va_arg(ap, int);
s += k;
}
va_end(ap);
return s;
}
int main()
{
1;
'a';
"Hello";
1.2f;
int i = Sum(3, 1, 2, 3);
char c;
long i2;
long long i3;
printf("%i, %i, %c\r\n", i, 2+3, 'a' );
}
|
6f9154cc14ab5fe7bd61acf45684d828b4cc6f50 | 60146440b33eab5017b9353514cecea29b1b00a3 | /Linked List/actualreverseLinkedList.cpp | be18ba889bb35d25f093d2b104e553a8ffb82708 | [] | no_license | ArcheTa/DataStructures | 39f711f81de584faa850afed716335a7c1247c5d | 2c65eb90d6c90e4943b6cce838ee6b611b08f2c2 | refs/heads/main | 2023-07-22T11:57:48.045917 | 2021-09-10T12:14:06 | 2021-09-10T12:14:06 | 387,570,794 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 972 | cpp | actualreverseLinkedList.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node{
int data;
Node* next;
};
Node* head = NULL;
void Insert(int data){
Node* temp = new Node();
temp -> data = data;
temp-> next = NULL;
if(head == NULL){
head = temp;
return;
}
Node* temp2 = head;
while(temp2 -> next != NULL) temp2 = temp2 -> next;
temp2 -> next = temp;
return;
}
void Reverse(Node* p){
if(p -> next == NULL){
head = p;
return;
}
Reverse(p -> next);
/*Node* q = p->next; // last three lines could be replaced with p->next->next = p
q -> next = p;*/
p->next->next = p;
p->next = NULL;
return;
}
void Print(){
cout<<"\n List is : ";
Node* temp = head;
while(temp != NULL){
cout<<temp->data<<" ";
temp = temp -> next;
}
}
int main(){
head = NULL;
Insert(1);
Insert(2);
Insert(3);
Insert(4);
Print();
Reverse(head);
Print();
return 0;
}
|
9f6395be1bfd8d12ed613abcea84fefed82c6038 | 10db1c2891dce0938fda86579fffcf5dac3e0865 | /src/hdmint/mintpool.h | 19d07fdb7932f55b96eb6144b26b1d044fd58918 | [
"MIT"
] | permissive | gaoyuancnpe/zcoin | 2a1eeb7ad5f39e04e5f1fec5b6a8e22e33ffe80c | eb2660580600886b1ad25b425743e714f4db46d0 | refs/heads/master | 2020-06-13T09:25:22.573909 | 2019-06-28T10:31:27 | 2019-06-28T10:31:27 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,828 | h | mintpool.h | // Copyright (c) 2019 The Zcoin Core Developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <map>
#include <list>
#include "primitives/zerocoin.h"
#include "libzerocoin/bitcoin_bignum/bignum.h"
#include "uint256.h"
/**
* The MintPool only contains mint seed values that have not been added to the blockchain yet.
* When a mint is generated by the wallet, or found while syncing, the mint will be removed
* from the MintPool.
*
* The MintPool provides a convenient way to check whether mints in the blockchain belong to a
* wallet's deterministic seed.
*/
class CMintPool : public std::map<CKeyID, uint32_t> //pubcoin hash, count
{
private:
uint32_t nCountLastGenerated;
uint32_t nCountLastRemoved;
public:
CMintPool();
explicit CMintPool(uint32_t nCount);
void Add(const CKeyID& seedId, const uint32_t& nCount);
void Add(const std::pair<CKeyID, uint32_t>& pMint, bool fVerbose = false);
bool Has(const CKeyID& seedId);
bool Get(const uint32_t& nCount, std::pair<CKeyID, uint32_t>& result);
bool Get(const CKeyID& seedId, std::pair<CKeyID, uint32_t>& result);
void Remove(const CKeyID& hashPubcoin);
std::list<std::pair<CKeyID, uint32_t> > List();
void Reset();
bool Front(std::pair<CKeyID, uint32_t>& pMint);
bool Next(std::pair<CKeyID, uint32_t>& pMint);
//The count of the next mint to generate will have be a mint that is already in the pool
//therefore need to return the next value that has not been removed from the pool yet
uint32_t CountOfLastRemoved() { return nCountLastRemoved; }
//The next pool count returns the next count that will be added to the pool
uint32_t CountOfLastGenerated() { return nCountLastGenerated; }
};
|
ffefef3cda8bf00fd496cab85e4afa30e83bede5 | d7f004d5f497b0d5e836131882bb052a2f60b047 | /toggle.cpp | 3eba5a65d565db0ca8a4922cf252b8c19c58c9b6 | [] | no_license | poojagolu/cpp | e327c03261029055c058e3113e353f157ef9c539 | 0126c9ba88118d47addb292c17be773db25da227 | refs/heads/master | 2020-07-22T18:41:13.199142 | 2019-09-09T11:27:19 | 2019-09-09T11:27:19 | 207,292,309 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 426 | cpp | toggle.cpp | #include <iostream>
using namespace std;
int main()
{
char a[100], b[100];
int n;
cout << "Enter a string: ";
cin.get(a,100);
n = sizeof(a)/sizeof(a[0]);
cout << "Original string: ";
cout << a << endl;
for(int i=0; i<n; i++)
{
if(islower(a[i]))
a[i] = toupper(a[i]);
else if(isupper(a[i]))
a[i] = tolower(a[i]);
else
a[i] = a[i];
}
cout << "New string:";
cout << a << endl;
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.