blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
264
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
5
140
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
905 values
visit_date
timestamp[us]date
2015-08-09 11:21:18
2023-09-06 10:45:07
revision_date
timestamp[us]date
1997-09-14 05:04:47
2023-09-17 19:19:19
committer_date
timestamp[us]date
1997-09-14 05:04:47
2023-09-06 06:22:19
github_id
int64
3.89k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]date
2012-06-07 00:51:45
2023-09-14 21:58:39
gha_created_at
timestamp[us]date
2008-03-27 23:40:48
2023-08-21 23:17:38
gha_language
stringclasses
141 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
10.4M
extension
stringclasses
115 values
content
stringlengths
3
10.4M
authors
listlengths
1
1
author_id
stringlengths
0
158
ef71608ea1fe84627e93a06029cc9ae2fcde506f
019b4d014113506ec90d04547ab6e3a7cfeec2ea
/lib/src/pt_global_average_pooling_1d_layer.h
0cc0e1b5b16cb947a73e5503b2d24b6fac1e3da8
[ "MIT" ]
permissive
torokati44/pocket-tensor
e952f35915f9543d19e9f7afd9dd0de4fb934cf3
6cb7932278e0b24477f3cdac804aabb225947162
refs/heads/master
2021-02-03T23:37:11.807757
2020-02-28T17:09:06
2020-02-28T17:09:06
243,575,782
0
0
null
2020-02-27T17:27:47
2020-02-27T17:27:46
null
UTF-8
C++
false
false
554
h
/* * pocket-tensor (c) 2019 Gustavo Valiente gustavo.valiente@protonmail.com * Kerasify (c) 2016 Robert W. Rose * * MIT License, see LICENSE file. */ #ifndef PT_GLOBAL_AVERAGE_POOLING_1D_LAYER_H #define PT_GLOBAL_AVERAGE_POOLING_1D_LAYER_H #include "pt_layer.h" namespace pt { class GlobalAveragePooling1DLayer : public Layer { public: static std::unique_ptr<GlobalAveragePooling1DLayer> create(std::istream& stream); bool apply(LayerData& layerData) const final; protected: GlobalAveragePooling1DLayer() = default; }; } #endif
[ "torokati44@gmail.com" ]
torokati44@gmail.com
48cc4e9bfa22e7f0ffab5bdf95bb7bd6e4c4a99d
b61e3bf1a31567eaa3c4c4f48ceb25f2eeb5f8e2
/glutil/Test/pole_test.cpp
dd2d1d110839ec746a92216ef6920493d8083fb7
[ "MIT", "X11", "Zlib", "LicenseRef-scancode-public-domain" ]
permissive
Morozov-5F/glsdk
d46681354db39d59a6bfd828a25f774742c9d124
bff2b5074681bf3d2c438216e612d8a0ed80cead
refs/heads/master
2022-12-12T21:17:30.953831
2020-09-11T15:28:28
2020-09-11T15:28:28
294,645,997
2
0
NOASSERTION
2020-09-11T15:28:29
2020-09-11T09:03:27
C++
UTF-8
C++
false
false
9,081
cpp
#include <string> #include <exception> #include <stdexcept> #include <stdio.h> #include <stdlib.h> #include <glload/gl_3_3.hpp> #include <glload/gl_load.hpp> #include <GL/glfw.h> #include <glm/glm.hpp> #include <glm/gtc/type_ptr.hpp> #include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/quaternion.hpp> #include <glm/gtx/quaternion.hpp> #include <glutil/glutil.h> GLuint objectBuffer; size_t g_sizeObjectBuffer; GLuint groundBuffer; size_t g_sizeGroundBuffer; GLuint vao; GLuint program; GLuint unifCameraToClipMatrix; GLuint unifModelToCameraMatrix; void init() { gl::GenVertexArrays(1, &vao); gl::BindVertexArray(vao); const float vertexData[] = { 0.75f, 0.75f, 0.0f, 1.0f, 0.75f, -0.75f, 0.0f, 1.0f, -0.75f, -0.75f, 0.0f, 1.0f, 0.6f, 0.8f, 0.0f, 1.0f, 0.9f, 0.2f, 0.4f, 1.0f, 0.1f, 0.2f, 0.7f, 1.0f, }; g_sizeObjectBuffer = sizeof(vertexData); const float groundData[] = { 30.0f, 0.0f, 30.0f, 1.0f, 30.0f, 0.0f, -30.0f, 1.0f, -30.0f, 0.0f, 30.0f, 1.0f, -30.0f, 0.0f, -30.0f, 1.0f, 0.2f, 1.0f, 0.2f, 1.0f, 0.2f, 1.0f, 0.2f, 1.0f, 0.2f, 1.0f, 0.2f, 1.0f, 0.2f, 1.0f, 0.2f, 1.0f, }; g_sizeGroundBuffer = sizeof(groundData); gl::GenBuffers(1, &objectBuffer); gl::BindBuffer(gl::ARRAY_BUFFER, objectBuffer); gl::BufferData(gl::ARRAY_BUFFER, g_sizeObjectBuffer, vertexData, gl::STATIC_DRAW); gl::BindBuffer(gl::ARRAY_BUFFER, 0); gl::GenBuffers(1, &groundBuffer); gl::BindBuffer(gl::ARRAY_BUFFER, groundBuffer); gl::BufferData(gl::ARRAY_BUFFER, g_sizeGroundBuffer, groundData, gl::STATIC_DRAW); gl::BindBuffer(gl::ARRAY_BUFFER, 0); const std::string vertexShader( "#version 330\n" "\n" "layout(location = 0) in vec4 position;\n" "layout(location = 1) in vec4 color;\n" "\n" "smooth out vec4 theColor;\n" "\n" "uniform mat4 cameraToClipMatrix;\n" "uniform mat4 modelToCameraMatrix;\n" "\n" "void main()\n" "{\n" " vec4 cameraPos = modelToCameraMatrix * position;\n" " gl_Position = cameraToClipMatrix * cameraPos;\n" " theColor = color;\n" "}\n" ); const std::string fragmentShader( "#version 330\n" "\n" "smooth in vec4 theColor;\n" "out vec4 outputColor;\n" "\n" "void main()\n" "{\n" " outputColor = theColor;\n" "}\n" ); GLuint vertShader = glutil::CompileShader(gl::VERTEX_SHADER, vertexShader); GLuint fragShader = glutil::CompileShader(gl::FRAGMENT_SHADER, fragmentShader); program = glutil::LinkProgram(vertShader, fragShader); gl::DeleteShader(vertShader); gl::DeleteShader(fragShader); unifModelToCameraMatrix = gl::GetUniformLocation(program, "modelToCameraMatrix"); unifCameraToClipMatrix = gl::GetUniformLocation(program, "cameraToClipMatrix"); } glm::ivec2 g_windowSize(0, 0); glm::vec3 g_objPos(0.0f, 3.0f, 0.0f); glutil::ViewData g_viewData = {g_objPos, glm::angleAxis(0.0f, glm::vec3(1.0f, 0.0f, 0.0f)), 20.0f, 0.0f}; glutil::ViewScale g_viewScale = {1.0f, 50.0f, 0.5f, 0.1f, 2.0f, 0.25f, 90.0f/250.0f}; glutil::ViewPole g_viewPole(g_viewData, g_viewScale, glutil::MB_LEFT_BTN, true); glutil::ObjectData g_objData = {g_objPos, glm::fquat(1.0f, 0.0f, 0.0f, 0.0f)}; glutil::ObjectPole g_objectPole(g_objData, 90.0f/250.0f, glutil::MB_RIGHT_BTN, &g_viewPole); void DrawGround(glutil::MatrixStack &matStack) { gl::UseProgram(program); gl::UniformMatrix4fv(unifModelToCameraMatrix, 1, gl::FALSE_, glm::value_ptr(matStack.Top())); gl::BindBuffer(gl::ARRAY_BUFFER, groundBuffer); gl::EnableVertexAttribArray(0); gl::EnableVertexAttribArray(1); gl::VertexAttribPointer(0, 4, gl::FLOAT, gl::FALSE_, 0, 0); gl::VertexAttribPointer(1, 4, gl::FLOAT, gl::FALSE_, 0, (void*)(g_sizeGroundBuffer / 2)); gl::DrawArrays(gl::TRIANGLE_STRIP, 0, 4); gl::DisableVertexAttribArray(0); gl::DisableVertexAttribArray(1); gl::UseProgram(0); } void DrawObject(glutil::MatrixStack &matStack) { gl::UseProgram(program); glutil::PushStack pusher(matStack); matStack *= g_objectPole.CalcMatrix(); gl::UniformMatrix4fv(unifModelToCameraMatrix, 1, gl::FALSE_, glm::value_ptr(matStack.Top())); gl::BindBuffer(gl::ARRAY_BUFFER, objectBuffer); gl::EnableVertexAttribArray(0); gl::EnableVertexAttribArray(1); gl::VertexAttribPointer(0, 4, gl::FLOAT, gl::FALSE_, 0, 0); gl::VertexAttribPointer(1, 4, gl::FLOAT, gl::FALSE_, 0, (void*)(g_sizeObjectBuffer / 2)); gl::DrawArrays(gl::TRIANGLES, 0, 3); gl::DisableVertexAttribArray(0); gl::DisableVertexAttribArray(1); gl::UseProgram(0); } //Called to update the display. //You should call glutSwapBuffers after all of your rendering to display what you rendered. //If you need continuous updates of the screen, call glutPostRedisplay() at the end of the function. void display() { gl::ClearColor(1.0f, 1.0f, 1.0f, 1.0f); gl::ClearDepth(1.0); gl::Clear(gl::COLOR_BUFFER_BIT | gl::DEPTH_BUFFER_BIT); gl::Enable(gl::DEPTH_TEST); gl::DepthFunc(gl::LEQUAL); gl::Enable(gl::DEPTH_CLAMP); gl::UseProgram(program); glm::mat4 perspectiveMat = glm::perspective(50.0f, g_windowSize.x / (float)g_windowSize.y, 1.f, 100.0f); gl::UniformMatrix4fv(unifCameraToClipMatrix, 1, gl::FALSE_, glm::value_ptr(perspectiveMat)); glutil::MatrixStack matStack; matStack *= g_viewPole.CalcMatrix(); { glutil::PushStack pusher(matStack); DrawGround(matStack); DrawObject(matStack); } glfwSwapBuffers(); } //Called whenever the window is resized. The new window size is given, in pixels. //This is an opportunity to call glViewport or glScissor to keep up with the change in size. void reshape (int w, int h) { gl::Viewport(0, 0, (GLsizei) w, (GLsizei) h); g_windowSize.x = w; g_windowSize.y = h; } int calc_glfw_modifiers() { int ret = 0; if((glfwGetKey(GLFW_KEY_LALT) == GLFW_PRESS) || (glfwGetKey(GLFW_KEY_RALT) == GLFW_PRESS)) ret |= glutil::MM_KEY_ALT; if((glfwGetKey(GLFW_KEY_LSHIFT) == GLFW_PRESS) || (glfwGetKey(GLFW_KEY_RSHIFT) == GLFW_PRESS)) ret |= glutil::MM_KEY_SHIFT; if((glfwGetKey(GLFW_KEY_LCTRL) == GLFW_PRESS) || (glfwGetKey(GLFW_KEY_RCTRL) == GLFW_PRESS)) ret |= glutil::MM_KEY_CTRL; return ret; } void GLFWCALL mouse_button_callback(int button, int action) { glm::ivec2 mousePos(0, 0); glfwGetMousePos(&mousePos.x, &mousePos.y); int modifiers = calc_glfw_modifiers(); int poleButton = 0; switch(button) { case GLFW_MOUSE_BUTTON_LEFT: poleButton = glutil::MB_LEFT_BTN; break; case GLFW_MOUSE_BUTTON_MIDDLE: poleButton = glutil::MB_MIDDLE_BTN; break; case GLFW_MOUSE_BUTTON_RIGHT: poleButton = glutil::MB_RIGHT_BTN; break; } g_objectPole.MouseClick((glutil::MouseButtons)poleButton, action == GLFW_PRESS, modifiers, mousePos); g_viewPole.MouseClick((glutil::MouseButtons)poleButton, action == GLFW_PRESS, modifiers, mousePos); } void GLFWCALL mouse_move_callback(int x, int y) { g_objectPole.MouseMove(glm::ivec2(x, y)); g_viewPole.MouseMove(glm::ivec2(x, y)); } void GLFWCALL mouse_wheel_callback(int pos) { static int lastPos = pos; int delta = pos - lastPos; glm::ivec2 mousePos(0, 0); glfwGetMousePos(&mousePos.x, &mousePos.y); int modifiers = calc_glfw_modifiers(); g_objectPole.MouseWheel(delta, modifiers, mousePos); g_viewPole.MouseWheel(delta, modifiers, mousePos); lastPos = pos; } void GLFWCALL character_callback(int unicodePoint, int action) { //Only interested in pressing. if(action == GLFW_RELEASE) return; if(unicodePoint > 127) return; g_viewPole.CharPress((char)unicodePoint); } int main(int argc, char** argv) { if(!glfwInit()) return -1; glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3); glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3); glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); #ifdef DEBUG glfwOpenWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, gl::TRUE_); #endif glm::ivec2 wndSize(500, 500); if(!glfwOpenWindow(wndSize.x, wndSize.y, 8, 8, 8, 8, 24, 8, GLFW_WINDOW)) { glfwTerminate(); return -1; } GLFWvidmode desktopMode; glfwGetDesktopMode(&desktopMode); glm::ivec2 desktopSize(desktopMode.Width, desktopMode.Height); glm::ivec2 wndPos = glutil::CalcWindowPosition(wndSize, desktopSize, glutil::WH_LEFT, glutil::WV_CENTER); glfwSetWindowPos(wndPos.x, wndPos.y); if(!glload::LoadFunctions()) { glfwTerminate(); return -1; } glfwSetWindowTitle("GLFW Demo"); glutil::RegisterDebugOutput(glutil::STD_OUT); init(); glfwEnable(GLFW_KEY_REPEAT); glfwSetWindowSizeCallback(reshape); glfwSetMouseButtonCallback(mouse_button_callback); glfwSetMousePosCallback(mouse_move_callback); glfwSetMouseWheelCallback(mouse_wheel_callback); glfwSetCharCallback(character_callback); //Main loop while(true) { display(); if(glfwGetKey(GLFW_KEY_ESC) || !glfwGetWindowParam(GLFW_OPENED)) break; glfwSleep(0.010); } glfwTerminate(); return 0; }
[ "https://sourceforge.net/u/korval2/profile" ]
https://sourceforge.net/u/korval2/profile
3c08ccf59766f854b3f38b5f2b07b79b657c1cea
96cfaaa771c2d83fc0729d8c65c4d4707235531a
/ElectroWeakAnalysis/ZTauTau_ETau/src/ZETauRecoElectronIdFilter.cc
1ea62c157f91e793dd8ac7d8451200d0907cbc51
[]
no_license
khotilov/cmssw
a22a160023c7ce0e4d59d15ef1f1532d7227a586
7636f72278ee0796d0203ac113b492b39da33528
refs/heads/master
2021-01-15T18:51:30.061124
2013-04-20T17:18:07
2013-04-20T17:18:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,054
cc
#include "ElectroWeakAnalysis/ZTauTau_ETau/interface/ZETauRecoElectronIdFilter.h" #include "TLorentzVector.h" using namespace edm; using namespace reco; using namespace std; ZETauRecoElectronIdFilter::ZETauRecoElectronIdFilter(const edm::ParameterSet& iConfig) { m_LeptonTag = iConfig.getParameter<InputTag>("LeptonTag"); m_LeptonIdTag = iConfig.getParameter<InputTag>("LeptonIdTag"); m_HLTTag = iConfig.getParameter<InputTag>("HLTTag"); m_doMatch = iConfig.getParameter<bool>("MatchToHLT"); m_MinN = iConfig.getParameter<int>("MinN"); produces<LorentzVectorCollection>("LeptonTag"); produces<CandidateCollection>("LeptonTag"); } ZETauRecoElectronIdFilter::~ZETauRecoElectronIdFilter(){ } bool ZETauRecoElectronIdFilter::filter(edm::Event& iEvent, const edm::EventSetup& iES) { auto_ptr<CandidateCollection> product_LeptonTag(new CandidateCollection); auto_ptr<LorentzVectorCollection> product_LeptonTagVec(new LorentzVectorCollection); // Read in electrons edm::Handle<PixelMatchGsfElectronCollection> electrons; iEvent.getByLabel(m_LeptonTag,electrons); // Read in electron ID association map edm::Handle<ElectronIDAssociationCollection> electronIDAssocHandle; iEvent.getByLabel(m_LeptonIdTag, electronIDAssocHandle); // Read in HLT electrons edm::Handle<LorentzVectorCollection> hltelectrons; iEvent.getByLabel(m_HLTTag,hltelectrons); LorentzVectorCollection::const_iterator hlteit=hltelectrons->begin(); // Loop over electrons int nObjects=0; for (unsigned int i = 0; i < electrons->size(); i++){ edm::Ref<reco::PixelMatchGsfElectronCollection> electronRef(electrons,i); // Find entry in electron ID map corresponding electron reco::ElectronIDAssociationCollection::const_iterator electronIDAssocItr; electronIDAssocItr = electronIDAssocHandle->find(electronRef); const reco::ElectronIDRef& id = electronIDAssocItr->val; bool cutBasedID = id->cutBasedDecision(); LorentzVector lepton(electronRef->px(),electronRef->py(), electronRef->pz(),electronRef->energy()); bool match_hlt=false; if(!m_doMatch)match_hlt=true; if(m_doMatch){ for(;hlteit!=hltelectrons->end();++hlteit) if(deltaR((*hlteit),lepton)<0.005) match_hlt=true; } double absTrackAtVertexEta = fabs(electronRef->TrackPositionAtVtx().Eta()); if ( absTrackAtVertexEta < 0.018 || (absTrackAtVertexEta>0.423 && absTrackAtVertexEta<0.461) || (absTrackAtVertexEta>0.770 && absTrackAtVertexEta<0.806) || (absTrackAtVertexEta>1.127 && absTrackAtVertexEta<1.163) || (absTrackAtVertexEta>1.460 && absTrackAtVertexEta<1.558))continue; if(cutBasedID&&match_hlt){ Candidate* lepton_cand=electronRef->clone(); nObjects++; product_LeptonTagVec->push_back(lepton); product_LeptonTag->push_back(lepton_cand); } } bool accept =false; if(nObjects>=m_MinN) { accept=true; iEvent.put(product_LeptonTagVec,"LeptonTag"); iEvent.put(product_LeptonTag,"LeptonTag"); } return accept; }
[ "sha1-52262e9d1df117cf868d5230eec8da061794b699@cern.ch" ]
sha1-52262e9d1df117cf868d5230eec8da061794b699@cern.ch
544fe86f70f2f48d368f4951308569e0e834a9c0
04c5486c9415ea31db0d1681e48ce6ef5717d19d
/include/HistogramContainer.hpp
e5e7df6067830aecbc934d4371402bc01e8cea8d
[]
no_license
jasperlauwers/Analysis
1784a05d4a6f1428623d713cc53973d6c2b8abdb
b04bf474e103b9f2fe841cf3613d533be7312563
refs/heads/master
2020-05-21T13:29:55.948317
2017-08-06T19:12:29
2017-08-06T19:12:29
44,169,783
0
0
null
null
null
null
UTF-8
C++
false
false
887
hpp
#ifndef HistogramContainer_hpp #define HistogramContainer_hpp #include <vector> #include <string> #include <iostream> #include <cmath> #include "TH1.h" #include "SampleContainer.hpp" using namespace std; struct HistogramContainer { HistogramContainer(string name); HistogramContainer(string name, unsigned int nTotal); ~HistogramContainer(); void add(TH1* h, string histName, int color_ = 1, SampleType sampleType = SampleType::MC, const vector<double>& axisRange = vector<double>()); void add(const HistogramContainer& histContainer, int index); void pop_back(); bool check() const; void addOverflow(); void addUnderflow(); string containerName; // plotted variable vector<TH1*> histograms; vector<string> reducedNames; // sample name vector<int> color; vector<SampleType> sampleType; vector<double> axisRanges; }; #endif
[ "jasper.lauwers@uantwerpen.be" ]
jasper.lauwers@uantwerpen.be
f35caf0e60dc496370e76046558c8732c3839596
09e40a180d9a92dd39447c27529581f4f4420313
/keyValueServer.h
f841a0f1406311dc594f3b923138444be02f7eee
[]
no_license
pinghaoluo/499-pinghaol
975c2afa76fc5d7d4ce0aea5892ac5fa4b6a46e2
3142e6cabd5672486cef10f39c3516948ec2fe4f
refs/heads/testing
2020-04-16T17:05:23.119836
2019-04-09T20:33:28
2019-04-09T20:33:28
165,762,328
0
1
null
2019-04-14T18:25:59
2019-01-15T01:21:51
C++
UTF-8
C++
false
false
1,415
h
#include <algorithm> #include <cmath> #include <grpc/grpc.h> #include <grpcpp/server.h> #include <grpcpp/server_builder.h> #include <grpcpp/server_context.h> #include <grpcpp/security/server_credentials.h> #include <grpcpp/grpcpp.h> #include <cctype> #include <fstream> #include <sstream> #include <vector> #include <unordered_map> #include "keyValue.grpc.pb.h" #include "keyValueStore.h" using grpc::Server; using grpc::ServerBuilder; using grpc::ServerContext; using grpc::ServerReader; using grpc::ServerReaderWriter; using grpc::ServerWriter; using grpc::Status; using chirp::KeyValueStore; using chirp::PutRequest; using chirp::PutReply; using chirp::ContainRequest; using chirp::ContainReply; using chirp::GetRequest; using chirp::GetReply; using chirp::DeleteRequest; using chirp::DeleteReply; using namespace std; // Logic and data behind the server's behavior. class KeyValueStoreImpl final : public KeyValueStore::Service { Status put(ServerContext* context, const PutRequest* request,PutReply* reply)override; Status contain(ServerContext* context, const ContainRequest* request, ContainReply* reply)override; Status get(ServerContext* context, ServerReaderWriter<GetReply, GetRequest>* stream) override ; Status deletekey(ServerContext* context, const DeleteRequest* request,DeleteReply* reply)override; private: KeyValueMap map; };
[ "pinghao@qvsta.com" ]
pinghao@qvsta.com
edbd6f6715b424b26cf14a9a4e2c5f24bc9db1c1
d0a0992db7bd43a5bf1fba1c185c2870bb50fe67
/tensorflow/compiler/xla/pjrt/tpu_client.cc
80ea958bd928920449ff99b04069d904d69c8ae0
[ "Apache-2.0" ]
permissive
DanMitroshin/tensorflow
de3a0f3386289bcbc5da52f17b65492e2c5b63fc
74aa353842f1788bdb7506ecceaf6ba99140e165
refs/heads/master
2023-03-18T11:15:31.966663
2021-03-05T15:29:13
2021-03-05T15:29:13
344,799,362
0
0
Apache-2.0
2021-03-05T12:09:03
2021-03-05T12:09:02
null
UTF-8
C++
false
false
9,446
cc
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 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 "tensorflow/compiler/xla/pjrt/tpu_client.h" #include <memory> #include <vector> #include "absl/container/inlined_vector.h" #include "absl/memory/memory.h" #include "absl/status/status.h" #include "tensorflow/compiler/xla/client/client_library.h" #include "tensorflow/compiler/xla/pjrt/local_device_state.h" #include "tensorflow/compiler/xla/pjrt/pjrt_stream_executor_client.h" #include "tensorflow/compiler/xla/pjrt/tracked_device_buffer.h" #include "tensorflow/compiler/xla/service/shaped_buffer.h" #include "tensorflow/compiler/xla/service/tpu_computation_placer.h" #include "tensorflow/compiler/xla/shape.h" #include "tensorflow/compiler/xla/shape_util.h" #include "tensorflow/compiler/xla/status.h" #include "tensorflow/compiler/xla/util.h" #include "tensorflow/core/platform/casts.h" #include "tensorflow/core/platform/errors.h" #include "tensorflow/stream_executor/device_memory.h" #include "tensorflow/stream_executor/lib/statusor.h" #include "tensorflow/stream_executor/stream.h" #include "tensorflow/stream_executor/tpu/tpu_executable_interface.h" #include "tensorflow/stream_executor/tpu/tpu_executor_interface.h" #include "tensorflow/stream_executor/tpu/tpu_platform_interface.h" #include "tensorflow/stream_executor/tpu/tpu_stream.h" namespace tf_tpu = tensorflow::tpu; namespace xla { namespace { class TpuDeviceState : public LocalDeviceState { public: TpuDeviceState(se::StreamExecutor* executor, LocalClient* client, bool asynchronous); Status ThenMemcpyDeviceToDevice(se::Stream* transfer_stream, se::Stream* dst_stream, se::DeviceMemoryBase src_buffer, se::DeviceMemoryBase dst_buffer) override; }; TpuDeviceState::TpuDeviceState(se::StreamExecutor* executor, LocalClient* client, bool asynchronous) : LocalDeviceState(executor, client, LocalDeviceState::kAsynchronous, asynchronous, /*allow_event_reuse=*/false) {} Status TpuDeviceState::ThenMemcpyDeviceToDevice( se::Stream* transfer_stream, se::Stream* dst_stream, se::DeviceMemoryBase src_buffer, se::DeviceMemoryBase dst_buffer) { auto* transfer_tpu_stream = tensorflow::down_cast<tf_tpu::TpuStream*>( transfer_stream->implementation()); TF_RETURN_IF_ERROR(transfer_tpu_stream->EnqueueOnTpuDeviceSendRecvLocal( src_buffer, dst_buffer)); return Status::OK(); } class PjRtTpuClient : public PjRtStreamExecutorClient { public: PjRtTpuClient(LocalClient* client, std::vector<std::unique_ptr<PjRtStreamExecutorDevice>> devices, int task_id); StatusOr<DeviceAssignment> GetDefaultDeviceAssignment( int num_replicas, int num_partitions) const override; bool EnqueueD2DTransfersOnSrcStream() const override { return false; } StatusOr<absl::optional<std::string>> ExecutableFingerprint( const PjRtExecutable& executable) const override; }; PjRtTpuClient::PjRtTpuClient( LocalClient* client, std::vector<std::unique_ptr<PjRtStreamExecutorDevice>> devices, int task_id) : PjRtStreamExecutorClient(kTpuName, client, std::move(devices), task_id, /*allocator=*/nullptr, /*host_memory_allocator=*/nullptr, /*should_stage_host_to_device_transfers=*/false, /*gpu_run_options=*/nullptr) {} StatusOr<DeviceAssignment> PjRtTpuClient::GetDefaultDeviceAssignment( int num_replicas, int num_partitions) const { tf_tpu::TpuPlatformInterface* platform = tf_tpu::TpuPlatformInterface::GetRegisteredPlatform(); tf_tpu::TpuHostLocationExternal host = platform->GetTpuHostLocation(); int num_local_devices = host.Cores(kTensorCore).size(); if (num_replicas * num_partitions <= num_local_devices) { return tf_tpu::TpuComputationPlacer::AssignLocalDevices(host, num_replicas, num_partitions); } // Fallback to default global device assignment if we can't run locally. return PjRtStreamExecutorClient::GetDefaultDeviceAssignment(num_replicas, num_partitions); } StatusOr<absl::optional<std::string>> PjRtTpuClient::ExecutableFingerprint( const PjRtExecutable& executable) const { if (executable.client() != this) { return InvalidArgument( "Passed executable from different client (platform '%s') to " "PjRtTpuClient::ExecutableFingerprint", executable.client()->platform_name()); } if (executable.num_partitions() > 1) { LOG(INFO) << "ExecutableFingerprint not fully implemented for MPMD " "executables, fingerprint may not be unique."; } xla::TpuExecutableInterface* tpu_executable = tensorflow::down_cast<xla::TpuExecutableInterface*>( tensorflow::down_cast<const PjRtStreamExecutorExecutable*>( &executable) ->executables()[0] ->executable()); return absl::optional<std::string>(tpu_executable->fingerprint()); } StatusOr<std::vector<std::unique_ptr<PjRtStreamExecutorDevice>>> GetTpuDevices( LocalClient* client, std::vector<std::unique_ptr<LocalDeviceState>> local_device_states) { std::vector<std::unique_ptr<PjRtStreamExecutorDevice>> devices; tf_tpu::TpuTopologyExternal topology = tf_tpu::TpuPlatformInterface::GetRegisteredPlatform()->topology(); std::map<int, int> core_id_to_device_ordinal; for (int i = 0; i < client->device_count(); ++i) { se::StreamExecutor* executor = client->backend().stream_executor(i).ValueOrDie(); tf_tpu::TpuExecutorInterface* tpu_executor = tensorflow::down_cast<tf_tpu::TpuExecutorInterface*>( executor->implementation()); core_id_to_device_ordinal[tpu_executor->GetCoreLocationExternal().Id()] = i; } for (const tf_tpu::TpuCoreLocationExternal& core : topology.cores(TpuCoreTypeEnum::kTensorCore)) { auto it = core_id_to_device_ordinal.find(core.Id()); int device_ordinal = (it != core_id_to_device_ordinal.end()) ? it->second : -1; int task_id = topology.IdForHost(core.host_coordinates()); const tf_tpu::TpuDimensionsExternal coords = core.chip_coordinates(); std::array<int, 3> coords_array = {coords.x, coords.y, coords.z}; std::unique_ptr<LocalDeviceState> local_device_state; if (device_ordinal >= 0) { local_device_state = std::move(local_device_states[device_ordinal]); } auto device = absl::make_unique<PjRtTpuDevice>( core, std::move(local_device_state), task_id, coords_array, std::string(tf_tpu::TpuVersionEnumToString(topology.version()))); devices.push_back(std::move(device)); } return devices; } } // namespace StatusOr<std::shared_ptr<PjRtClient>> GetTpuClient( bool asynchronous, absl::Duration init_retry_timeout) { tf_tpu::TpuPlatformInterface* platform = tf_tpu::TpuPlatformInterface::GetRegisteredPlatform( /*initialize_platform=*/true, /*num_tries=*/1); if (platform == nullptr) { return InvalidArgument("TpuPlatform is not available."); } // NOTE: We retry in a loop since some pod failures are transient (e.g. some // RPCs may timeout waiting for other hosts to come up, but will succeed // at a later point if retried). auto start = absl::Now(); while (true) { Status status = platform->Initialize({}); if (status.ok()) { break; } LOG(INFO) << "TPU platform initialization failed: " << status; if ((absl::Now() - start) >= init_retry_timeout) { return status; } absl::SleepFor(absl::Microseconds(10)); } CHECK(platform->Initialized()); if (platform->VisibleDeviceCount() <= 0) { return InvalidArgument("No TPU devices found."); } LocalClientOptions options; options.set_platform(platform); TF_ASSIGN_OR_RETURN(LocalClient * client, ClientLibrary::GetOrCreateLocalClient(options)); std::vector<std::unique_ptr<LocalDeviceState>> local_device_states; local_device_states.reserve(client->device_count()); for (int i = 0; i < client->device_count(); ++i) { se::StreamExecutor* executor = client->backend().stream_executor(i).ValueOrDie(); local_device_states.push_back( absl::make_unique<TpuDeviceState>(executor, client, asynchronous)); } TF_ASSIGN_OR_RETURN(auto devices, GetTpuDevices(client, std::move(local_device_states))); int task_id = platform->GetTpuHostLocation().Id(); return std::shared_ptr<PjRtClient>( absl::make_unique<PjRtTpuClient>(client, std::move(devices), task_id)); } } // namespace xla
[ "gardener@tensorflow.org" ]
gardener@tensorflow.org
fdacca6afa4ddc5c26685ba6fecf54245226de52
260e5dec446d12a7dd3f32e331c1fde8157e5cea
/Indi/SDK/Indi_SC_LightMachineGun_Weapon_T1_classes.hpp
cd194952da4c2f9e769d6232e6dc1fdbb0dc8cb7
[]
no_license
jfmherokiller/TheOuterWorldsSdkDump
6e140fde4fcd1cade94ce0d7ea69f8a3f769e1c0
18a8c6b1f5d87bb1ad4334be4a9f22c52897f640
refs/heads/main
2023-08-30T09:27:17.723265
2021-09-17T00:24:52
2021-09-17T00:24:52
407,437,218
0
0
null
null
null
null
UTF-8
C++
false
false
762
hpp
#pragma once // TheOuterWorlds SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "Indi_SC_LightMachineGun_Weapon_T1_structs.hpp" namespace SDK { //--------------------------------------------------------------------------- //Classes //--------------------------------------------------------------------------- // BlueprintGeneratedClass SC_LightMachineGun_Weapon_T1.SC_LightMachineGun_Weapon_T1_C // 0x0000 (0x05A8 - 0x05A8) class USC_LightMachineGun_Weapon_T1_C : public USC_LightMachineGun_Weapon_Base_C { public: static UClass* StaticClass() { static auto ptr = UObject::FindClass("BlueprintGeneratedClass SC_LightMachineGun_Weapon_T1.SC_LightMachineGun_Weapon_T1_C"); return ptr; } }; } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "peterpan0413@live.com" ]
peterpan0413@live.com
99f883de0d70466894accd52e244866f8cc670d2
87ec95f68479dbbadfe0440e3183cc1e4dabbd95
/DevelopmentHelper/Converter.h
5289a64b7627d94ddcdc2d06c090c29bc43c14c6
[]
no_license
Ulle84/UllesSourceCode
106265693ce99548d03b542d4a84761bd1eb9076
822bb554bd6f9176f075a4ade28c4cc5775340ad
refs/heads/master
2021-01-24T05:58:44.763179
2017-03-19T19:14:42
2017-03-19T19:14:42
5,530,222
0
0
null
null
null
null
UTF-8
C++
false
false
267
h
#ifndef CONVERTER_H #define CONVERTER_H #include <QWidget> namespace Ui { class Converter; } class Converter : public QWidget { Q_OBJECT public: explicit Converter(QWidget *parent = 0); ~Converter(); private: Ui::Converter *ui; }; #endif // CONVERTER_H
[ "u.belitz@gmx.de" ]
u.belitz@gmx.de
5a0410643f4cca9c4bb76922cf31c6fb643dbb7d
d7ec6bf4bb59f225b5047523a281215e235201fe
/boost/mpi/exception.hpp
0ff22edf715e9eaae10d705afd998bccb253340e
[ "BSL-1.0" ]
permissive
avasopht/boost_1_55_0-llvm
0212c6371996019c268f05071d21d432b2e251c3
fba05de0ba1c2ee9011d8ef3cb9121827bae1b4d
refs/heads/master
2020-05-29T11:58:07.757068
2014-09-03T20:55:23
2014-09-03T20:55:23
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,123
hpp
// Copyright (C) 2005-2006 Douglas Gregor <doug.gregor -at- gmail.com>. // Use, modification and distribution is subject to 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) /** @file exception.hpp * * This header provides exception classes that report MPI errors to * the user and macros that translate MPI error codes into Boost.MPI * exceptions. */ #ifndef BOOST_MPI_EXCEPTION_HPP #define BOOST_MPI_EXCEPTION_HPP #include <boost/mpi/config.hpp> #include <exception> #include <boost/config.hpp> #include <boost/throw_exception.hpp> namespace boost { namespace mpi { /** @brief Catch-all exception class for MPI errors. * * Instances of this class will be thrown when an MPI error * occurs. MPI failures that trigger these exceptions may or may not * be recoverable, depending on the underlying MPI * implementation. Consult the documentation for your MPI * implementation to determine the effect of MPI errors. */ class BOOST_MPI_DECL exception : public std::exception { public: /** * Build a new @c exception exception. * * @param routine The MPI routine in which the error * occurred. This should be a pointer to a string constant: it * will not be copied. * * @param result_code The result code returned from the MPI * routine that aborted with an error. */ exception(const char* routine, int result_code); virtual ~exception() throw(); /** * A description of the error that occurred. */ virtual const char * what () const throw () { return this->message.c_str(); } /** Retrieve the name of the MPI routine that reported the error. */ const char* routine() const { return routine_; } /** * @brief Retrieve the result code returned from the MPI routine * that reported the error. */ int result_code() const { return result_code_; } /** * @brief Returns the MPI error class associated with the error that * triggered this exception. */ int error_class() const { int result; MPI_Error_class(result_code_, &result); return result; } protected: /// The MPI routine that triggered the error const char* routine_; /// The failed result code reported by the MPI implementation. int result_code_; /// The formatted error message std::string message; }; /** * Call the MPI routine MPIFunc with arguments Args (surrounded by * parentheses). If the result is not MPI_SUCCESS, use * boost::throw_exception to throw an exception or abort, depending on * BOOST_NO_EXCEPTIONS. */ #define BOOST_MPI_CHECK_RESULT( MPIFunc, Args ) \ { \ int _check_result = MPIFunc Args; \ if (_check_result != MPI_SUCCESS) \ boost::throw_exception(boost::mpi::exception(#MPIFunc, \ _check_result)); \ } } } // end namespace boost::mpi #endif // BOOST_MPI_EXCEPTION_HPP
[ "keldon.alleyne@avasopht.com" ]
keldon.alleyne@avasopht.com
b68043d304f5ff0da49455a8e4166d3ff19e44a1
c40b21b737c8906d104d6e1a63904884b8ec345d
/Framework/UTS_Sensor/SensorDriver/S5K4H7YX/S5K4H7YX.h
0492274e13c0e2e5a470ce10066cf2510bd6d2e8
[]
no_license
liupengsyk/UTS_NEW
f4eac1f327126eda4dd0bfaae0a1372a77263175
0fa04109a0f0808dd973a6f86cc0133f068ea02d
refs/heads/master
2020-06-03T02:30:18.394317
2019-01-30T02:32:32
2019-01-30T02:32:32
null
0
0
null
null
null
null
UTF-8
C++
false
false
421
h
#ifndef _S5K4H7YX_H_ #define _S5K4H7YX_H_ #include <stdint.h> #include "../../SensorDriver.h" class S5K4H7YX : public SamsungSensor { public: S5K4H7YX(); int do_prog_otp(int page, int addr, const void *data, int len); int do_read_otp(int page, int addr, void *data, int len); int wb_writeback(uint8_t *regs, int len); int do_get_sid(uint8_t *id); BOOL GetSensorId(__out CString &strSensorId); }; #endif
[ "2411804080@qq.com" ]
2411804080@qq.com
32f491a41c924f5e7c491b3d12a9e385886bbd48
cfeac52f970e8901871bd02d9acb7de66b9fb6b4
/generated/src/aws-cpp-sdk-servicecatalog-appregistry/source/model/CreateApplicationRequest.cpp
63b66a5cf7fec7152a0fff41f3dbb1e3f554fa71
[ "Apache-2.0", "MIT", "JSON" ]
permissive
aws/aws-sdk-cpp
aff116ddf9ca2b41e45c47dba1c2b7754935c585
9a7606a6c98e13c759032c2e920c7c64a6a35264
refs/heads/main
2023-08-25T11:16:55.982089
2023-08-24T18:14:53
2023-08-24T18:14:53
35,440,404
1,681
1,133
Apache-2.0
2023-09-12T15:59:33
2015-05-11T17:57:32
null
UTF-8
C++
false
false
1,226
cpp
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/servicecatalog-appregistry/model/CreateApplicationRequest.h> #include <aws/core/utils/json/JsonSerializer.h> #include <utility> using namespace Aws::AppRegistry::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; CreateApplicationRequest::CreateApplicationRequest() : m_nameHasBeenSet(false), m_descriptionHasBeenSet(false), m_tagsHasBeenSet(false), m_clientToken(Aws::Utils::UUID::PseudoRandomUUID()), m_clientTokenHasBeenSet(true) { } Aws::String CreateApplicationRequest::SerializePayload() const { JsonValue payload; if(m_nameHasBeenSet) { payload.WithString("name", m_name); } if(m_descriptionHasBeenSet) { payload.WithString("description", m_description); } if(m_tagsHasBeenSet) { JsonValue tagsJsonMap; for(auto& tagsItem : m_tags) { tagsJsonMap.WithString(tagsItem.first, tagsItem.second); } payload.WithObject("tags", std::move(tagsJsonMap)); } if(m_clientTokenHasBeenSet) { payload.WithString("clientToken", m_clientToken); } return payload.View().WriteReadable(); }
[ "sdavtaker@users.noreply.github.com" ]
sdavtaker@users.noreply.github.com
dd9ff6c56a0caa1e9a3c1dd2dfa06ba013192367
7c038f64b36e7a5222fc2d39ed86d2131f55fdb9
/include/GQE/Core/protocols/DirectoryServer.hpp
e681f054125b069a6aa4a92de661631705dcb801
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
buckle2000/gqe
8b482b9da8b1c1171a1573c544f18a3320fca957
439309c12e569b79d676e27b4f9040367cc09570
refs/heads/master
2021-01-10T12:55:05.110459
2016-03-24T04:05:13
2016-03-24T04:05:13
54,613,320
0
0
null
null
null
null
UTF-8
C++
false
false
12,294
hpp
/** * Provides the DirectoryServer class which implements the Directory protocol * used to register game servers with a directory so other players can * discover game servers available. * * @file include/GQE/Core/protocols/DirectoryServer.hpp * @author Ryan Lindeman * @date 20130112 - Initial Release */ #ifndef DIRECTORY_SERVER_HPP_INCLUDED #define DIRECTORY_SERVER_HPP_INCLUDED #include <GQE/Core/Core_types.hpp> #include <GQE/Core/interfaces/INetServer.hpp> namespace GQE { /// Provides the INetServer class for providing a network server services class GQE_API DirectoryServer: public INetServer { public: // Constants //////////////////////////////////////////////////////////////////////// /// The maximum number of Directory Clients for this server static const Uint16 MAX_DIRECTORY_CLIENTS = 1024; /// The number of seconds between time sync messages to each DirectoryClient static const float DIRECTORY_TIME_SYNC_TIMEOUT_S; /** * DirectoryServer default constructor * @param[in] theNetAlias to use for this Directory Server * @param[in] theVersionInfo to use for this Directory Server * @param[in] theNetPool derived class to use for getting INetPackets * @param[in] theScope to use for this Directory protocol * @param[in] theServerPort to listen on for incoming UDP clients */ DirectoryServer(const typeNetAlias theNetAlias, const VersionInfo theVersionInfo, INetPool& theNetPool, const NetProtocol theProtocol, const Uint16 theServerPort = DIRECTORY_SERVER_PORT); /** * DirectoryServer deconstructor */ virtual ~DirectoryServer(); /** * RegisterApp is responsible for registering theAppInfo provided with * this DirectoryServer. Registering theAppInfo must come before you can * call the RegisterServer method to register the server information. * @param[in] theAppInfo to register with this DirectoryServer. */ void RegisterApp(const typeAppInfo theAppInfo); /** * RegisterServer is responsible for registering theServerInfo provided * under theAppID specified. This will make the server public to all * clients that connect to this DirectoryServer. * @param[in] theAppID to register theServerInfo under * @param[in] theServerInfo of the server to register for this DirectoryServer */ void RegisterServer(const typeAppID theAppID, const typeServerInfo theServerInfo); /** * UnregisterServer is responsible for removing the registered server ID * sepecified from theAppID indicated. Its possible the server will * still be running but no future clients will see the registered server * after it has been unregistered. * @param[in] theAppID to register theServerInfo under * @param[in] theNetAlias of the server to unregister */ void UnregisterServer(const typeAppID theAppID, const typeNetAlias theNetAlias); /** * RegisterSubscriber is responsible for registering theNetID client * subscriber provided under theAppID specified. This will make it so * the server information changes registered under theAppID specified is * broadcast to this client. * @param[in] theAppID to register theNetID under * @param[in] theNetID of the client subscriber to register */ void RegisterSubscriber(const typeAppID theAppID, const typeNetID theNetID); /** * UnregisterSubscriber is responsible for removing theNetID of the * client subscriber from theAppID indicated. * @param[in] theAppID to register theServerInfo under * @param[in] theNetID of the client subscriber to unregister */ void UnregisterSubscriber(const typeAppID theAppID, const typeNetID theNetID); protected: // Variables //////////////////////////////////////////////////////////////////////// /** * VerifyIncoming is responsible for verifying the incoming INetPacket * message for all user defined message types. The internally processed * INetPacket messages will be verified through the VerifyInternal method. * @param[in] thePacket to be verified * @param[in] theSize received in bytes * @return true if thePacket is valid, false otherwise */ virtual bool VerifyIncoming(INetPacket& thePacket, std::size_t theSize); /** * ProcessTransaction is responsible for processing all incoming network * packet messages from each UDP client and providing an optional * immediate network packet message response. * @param[in] theIncoming INetPacket to be processed * @return pointer to outgoing INetPacket response, NULL otherwise */ virtual INetPacket* ProcessIncoming(INetPacket* theIncoming); /** * GetRegisterAppSize is responsible for returning the size of the * RegisterApp message. This way someone can modify the * CreateRegisterApp method in DirectoryClient and still have the * DirectoryServer base class validate each RegisterApp message size * correctly. * @return the RegisterApp message size */ virtual std::size_t GetRegisterAppSize(void) const; /** * ProcessRegisterApp is responsible for processing each RegisterApp * message received. * @param[in] thePacket containing the RegisterApp message */ void ProcessRegisterApp(INetPacket* thePacket); /** * GetRegisterServerSize is responsible for returning the size of the * RegisterServer message. This way someone can modify the * CreateRegisterServer method in DirectoryClient and still have the * DirectoryServer base class validate each RegisterServer message size * correctly. * @return the RegisterServer message size */ virtual std::size_t GetRegisterServerSize(void) const; /** * ProcessRegisterServer is responsible for processing each * RegisterServer message received. * @param[in] thePacket containing the RegisterServer message */ void ProcessRegisterServer(INetPacket* thePacket); /** * GetUnregisterServerSize is responsible for returning the size of the * UnregisterServer message. This way someone can modify the * CreateUnregisterServer method in DirectoryClient and still have the * DirectoryServer base class validate each RegisterServer message size * correctly. * @return the UnregisterServer message size */ virtual std::size_t GetUnregisterServerSize(void) const; /** * ProcessUnregisterServer is responsible for processing each * UnregisterServer message received. * @param[in] thePacket containing the UnregisterServer message */ void ProcessUnregisterServer(INetPacket* thePacket); /** * GetRegisterSubscriberSize is responsible for returning the size of * the RegisterSubscriber message. This way someone can modify the * CreateRegisterSubscriber method in DirectoryClient and still have the * DirectoryServer base class validate each RegisterSubscriber message * size correctly. * @return the RegisterSubscriber message size */ virtual std::size_t GetRegisterSubscriberSize(void) const; /** * ProcessRegisterSubscriber is responsible for processing each * RegisterSubscriber message received. * @param[in] thePacket containing the RegisterSubscriber message */ void ProcessRegisterSubscriber(INetPacket* thePacket); /** * GetUnregisterSubscriberSize is responsible for returning the size of * the UnregisterSubscriber message. This way someone can modify the * CreateUnregisterSubscriber method in DirectoryClient and still have * the DirectoryServer base class validate each RegisterSubscriber * message size correctly. * @return the UnregisterSubscriber message size */ virtual std::size_t GetUnregisterSubscriberSize(void) const; /** * ProcessUnregisterSubscriber is responsible for processing each * UnregisterSubscriber message received. * @param[in] thePacket containing the UnregisterSubscriber message */ void ProcessUnregisterSubscriber(INetPacket* thePacket); /** * CreateServerInfo is responsible for providing a Server Info message * that will be sent to a subscriber with theServerInfo data provided. * @param[in] theAppID of the application theServerInfo is under * @param[in] theServerInfo of the server being published * @param[in] theDeleteFlag to indicate server is now unregistered * @return pointer to INetPacket with Server Info message, NULL otherwise */ virtual INetPacket* CreateServerInfo(const typeAppID theAppID, const typeServerInfo theServerInfo, bool theDeleteFlag = false); private: // Structures //////////////////////////////////////////////////////////////////////// /// DirectoryInfo structure holds the data needed for each registered application struct DirectoryInfo { typeAppInfo app; ///< Application information std::list<typeServerInfo> servers; ///< List of servers available for this app std::list<typeNetID> subscribers; ///< List of subscribers for this app }; // Variables //////////////////////////////////////////////////////////////////////// /// Map of each registered application with this DirectoryServer std::map<const typeAppID, DirectoryInfo> mDirectory; /// Mutex to protect our directory map above sf::Mutex mDirectoryMutex; /** * Our copy constructor is private because we do not allow copies of * our DirectoryServer derived classes */ DirectoryServer(const DirectoryServer&); // Intentionally undefined /** * Our assignment operator is private because we do not allow copies * of our DirectoryServer derived classes */ DirectoryServer& operator=(const DirectoryServer&); // Intentionally undefined }; // DirectoryServer class } // namespace GQE #endif // DIRECTORY_SERVER_HPP_INCLUDED /** * @class GQE::DirectoryServer * @ingroup Core * The DirectoryServer class is responsible for providing the Directory * protocol which can be used to register a game server for others with the * Directory server which will allow others to discover game servers that are * available to connect to and use. * * Copyright (c) 2010-2013 Ryan Lindeman * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */
[ "cloudncali@localhost" ]
cloudncali@localhost
506654be2822a53903fca6e5ee1a11714f9bffc8
e092a185ff83e18fa68b6260db5e114a8b5d3151
/Sum_of_Array/Sum.cpp
d392c73317961522d228e9363973d39d59b4a969
[]
no_license
piyush928/HackerRank
c062a003d65a14fdbb98aeae4da88ed4624bc91f
95aea8a6bb7374b285f3e8944edf1ea8f2e2ae4a
refs/heads/master
2023-04-03T23:42:17.658613
2021-04-14T08:00:02
2021-04-14T08:00:02
357,790,668
0
0
null
null
null
null
UTF-8
C++
false
false
382
cpp
#include<iostream> #include<vector> using namespace std; int sum(vector<int> ar) { int len =ar.size(); cout<<"length is : " << len; int out=0; int i=0; while(len--) { out+=ar[i++]; } return out; } int main() { vector<int> ar; int i; for(i=0;i<5;i++) ar.push_back(i); cout<<"\nSum is : "<<sum(ar); }
[ "piyushyadav928@gmail.com" ]
piyushyadav928@gmail.com
d5e30dfb5a551ebb2fdf76ae233e544d25db94a6
7bd101aa6d4eaf873fb9813b78d0c7956669c6f0
/PPTShell/PPTShell/DUI/IFunctionListener.h
ec9b99f1786ec4fd9ffebfdd0ebc46959c359cc8
[]
no_license
useafter/PPTShell-1
3cf2dad609ac0adcdba0921aec587e7168ee91a0
16d9592e8fa2d219a513e9f8cfbaf7f7f3d3c296
refs/heads/master
2021-06-24T13:33:54.039140
2017-09-10T06:31:11
2017-09-10T06:35:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
227
h
#pragma once class IDeleteListener { public: virtual void OnDeleteComplete(LPCTSTR lptcsError ) = 0; }; class IRenameListener { public: virtual void OnRenameComplete(LPCTSTR lptcsError, LPCTSTR lptcsNewName) = 0; };
[ "794549193@qq.com" ]
794549193@qq.com
0aedc106fc1dae1b9e1ef11200f0585ddda5faa6
eada8eb1d9677d25d1f854e89df611b788d51804
/rionos/skinmesh-system.h
4a540524269674678e231360807c73f24b765d6e
[]
no_license
hiragisorah/deprecated-rionos
47b9d9546eba19ee5809606e925e45cd95f0002a
e74a6e9c1c26cfbd203b05a21845753a6f35eb99
refs/heads/master
2020-03-19T05:50:52.796047
2018-06-16T20:55:03
2018-06-16T20:55:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
338
h
#pragma once #include <DirectXMath.h> #include "..\seed-engine\system.h" class SkinMeshSystem : public Seed::System { public: SkinMeshSystem(std::shared_ptr<System> & self); public: void Initalize(void) override; void Finalize(void) override; void Pause(void) override; void Update(void) override; void Always(void) override; };
[ "hiragisorah@gmail.com" ]
hiragisorah@gmail.com
ef5cd5b3951067ea9685759866d689167b9430b9
9b6eced5d80668bd4328a8f3d1f75c97f04f5e08
/bluetooth/btsdp/database/SDPAttrValue.cpp
ff7f1bfed5cc675f503016efdc7b2ead0783b4d7
[]
no_license
SymbianSource/oss.FCL.sf.os.bt
3ca94a01740ac84a6a35718ad3063884ea885738
ba9e7d24a7fa29d6dd93808867c28bffa2206bae
refs/heads/master
2021-01-18T23:42:06.315016
2010-10-14T10:30:12
2010-10-14T10:30:12
72,765,157
1
0
null
null
null
null
UTF-8
C++
false
false
22,529
cpp
// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of "Eclipse Public License v1.0" // which accompanies this distribution, and is available // at the URL "http://www.eclipse.org/legal/epl-v10.html". // // Initial Contributors: // Nokia Corporation - initial contribution. // // Contributors: // // Description: // attribute value processing // // #include <btsdp.h> #include <es_sock.h> #include "attrvalueencoded.h" #include "MAttributeVisitor.h" #include "sdputil.h" #include "DataEncoder.h" const TUint8 KDummyUUIDPointer = 0xff; // ******************* CSdpAttrValue ******************************** CSdpAttrValue::CSdpAttrValue() /** Default constructor. */ { } CSdpAttrValue::~CSdpAttrValue() /** Destructor. */ { } void CSdpAttrValue::AcceptVisitorL(MSdpAttributeValueVisitor& aVisitor) /** Request a call back to pass the attribute value. When called on attributes that are not lists (not DEA or DES), then this calls MSdpAttributeValueVisitor::VisitAttributeValueL(), passing the attribute value object itself (i.e. *this), and the value attribute type. It is more useful when called on a DES or DEA object, as it then provides a simple method of enumerating each attribute in a list. @param aVisitor Abstract interface that can be implemented to receive an enumeration of the values in an attribute list. @see CSdpAttrValueList::AcceptVisitorL() @see MSdpAttributeValueVisitor::VisitAttributeValueL() */ { aVisitor.VisitAttributeValueL(*this, Type()); } // Universal Getters // Defaults are to Panic -- should only be called when overriden TUint CSdpAttrValue::Uint() const /** Gets an unsigned integer attribute value. The base class implementation panics. The size of the unsigned integer should be checked with DataSize() before calling. @return Attribute value */ { DbPanic(ESdpDbBadAttrValueGetter); return 0; } /* UIDs used by the Extension_ method for CSdpAttrValue to identify the function called. @internalComponent */ const TUint KSdpAttrValueUint64FunctionId = 0x1028654A; const TUint KSdpAttrValueUint128FunctionId = 0x1028654B; EXPORT_C void CSdpAttrValue::Uint64(TUint64& aValue) const /** Gets the value as an unsigned 64 bit integer The size of the unsigned integer should be checked with DataSize() before calling. @param aValue A 64 bit unsigned integer */ { TAny* valuePtr = &aValue; const_cast<CSdpAttrValue*>(this)->Extension_(KSdpAttrValueUint64FunctionId, valuePtr, NULL); } EXPORT_C void CSdpAttrValue::Uint128(TUint64& aLo, TUint64& aHi) const /** Gets two TUint64s, one being the high 64 bits and one being the low 64 bits of a 128 bit integer The size of the unsigned integer should be checked with DataSize() before calling. @param aLo The unsigned 64 bit integer contains the lower bits of the 128 bit integer contained in the descriptor @param aHi The unsigned 64 bit integer contains the higher bits of the 128 bit integer contained in the descriptor */ { TAny* loPtr = &aLo; TAny* hiPtr = &aHi; const_cast<CSdpAttrValue*>(this)->Extension_(KSdpAttrValueUint128FunctionId, loPtr, hiPtr); } TInt CSdpAttrValue::Int() const /** Gets a signed integer attribute value. The base class implementation panics. @return Attribute value */ { DbPanic(ESdpDbBadAttrValueGetter); return 0; } TBool CSdpAttrValue::DoesIntFit() const /** Tests if the attribute can be stored in an integer value. The base class implementation returns EFalse. @return True if the attribute can be stored in an integer value */ { return EFalse; } TInt CSdpAttrValue::Bool() const /** Gets a Boolean attribute value. The base class implementation panics. @return Attribute value */ { DbPanic(ESdpDbBadAttrValueGetter); return 0; } const TUUID& CSdpAttrValue::UUID() const /** Gets a UUID attribute value. The base class implementation panics. @return Attribute value */ { DbPanic(ESdpDbBadAttrValueGetter); return *(TUUID*)(KDummyUUIDPointer); } const TPtrC8 CSdpAttrValue::Des() const /** Gets a data buffer attribute value. The base class implementation panics. @return Attribute value */ { DbPanic(ESdpDbBadAttrValueGetter); return TPtrC8(0,0); } /** The extension method provides a polymorphic behaviour to allow interface extension. The base class implementation panics. @internalComponent */ TInt CSdpAttrValue::Extension_(TUint aExtensionId, TAny *&a0, TAny *a1) { TInt ret = KErrNone; switch(aExtensionId) { case KSdpAttrValueUint64FunctionId: case KSdpAttrValueUint128FunctionId: { DbPanic(ESdpDbBadAttrValueGetter); } break; default: { // Chain to base class ret = CBase::Extension_(aExtensionId, a0, a1); } break; } return ret; } // ******************* Concrete CSdpAttrValues ************************ // LIST CSdpAttrValueList::CSdpAttrValueList(MSdpElementBuilder *aParent) : iParent(aParent) { } void CSdpAttrValueList::ConstructL() { iList = new (ELeave) CArrayPtrFlat<CSdpAttrValue> (2); } CSdpAttrValueList::~CSdpAttrValueList() /** Destructor. */ { if ( iList ) { // Destroy all elements on this list iList->ResetAndDestroy(); delete iList; } } void CSdpAttrValueList::AcceptVisitorL(MSdpAttributeValueVisitor& aVisitor) /** Requests a call back to pass the attribute value. This provides a simple method of enumerating each element in the list. @param aVisitor Abstract interface that can be implemented to receive an enumeration of the values in the attribute list. */ { CSdpAttrValue::AcceptVisitorL(aVisitor); aVisitor.StartListL(*this); TInt items = iList->Count(); for (TInt i = 0; i < items; ++i) { (*iList)[i]->AcceptVisitorL(aVisitor); } aVisitor.EndListL(); } TUint CSdpAttrValueList::DataSize() const /** Gets the size of the list. @return Size of the list (in bytes) */ { TUint size = 0; for (TInt i = 0; i < iList->Count(); ++i) { size += TElementEncoder::EncodedSize((*iList)[i]->Type(), (*iList)[i]->DataSize()); } return size; } EXPORT_C void CSdpAttrValueList::AppendValueL(CSdpAttrValue* aValue) /** Add a new value onto the end on this list. Ownership of the passed value is transferred to this list. It will be deleted when the list is destroyed. If a leave occurs, aValue will be cleanup up automatically @param aValue Attribute value to be added onto this list. */ { CleanupStack::PushL(aValue); iList->AppendL(aValue); CleanupStack::Pop(); // aValue } MSdpElementBuilder* CSdpAttrValueList::BuildStringL(const TDesC8& aString) /** Adds a Text String element. @internalTechnology @param aString Attribute to add @return This attribute value with added element */ { CSdpAttrValue *val=CSdpAttrValueString::NewStringL(aString); AppendValueL(val); return this; } MSdpElementBuilder* CSdpAttrValueList::BuildBooleanL(TBool aBool) /** Adds a Boolean element. @internalTechnology @param aBool Attribute to add @return This attribute value with added element */ { CSdpAttrValue *val=CSdpAttrValueBoolean::NewBoolL(aBool); AppendValueL(val); return this; } MSdpElementBuilder* CSdpAttrValueList::BuildDESL() /** Adds a Data element sequence (DES). @internalTechnology This should be followed by a call to StartListL(), and then calls to add elements to the list. @return This attribute value with added element */ { CSdpAttrValueList *val=CSdpAttrValueDES::NewDESL(this); AppendValueL(val); return val; } MSdpElementBuilder* CSdpAttrValueList::BuildDEAL() /** Adds a Data element alternative (DEA). @internalTechnology This should be followed by a call to StartListL(), and then calls to add elements to the list. @return This attribute value with added element */ { CSdpAttrValueList *val=CSdpAttrValueDEA::NewDEAL(this); AppendValueL(val); return val; } MSdpElementBuilder* CSdpAttrValueList::StartListL() /** Indicates that subsequent elements added belong to a DES or DEA. @internalTechnology The end of the list should be indicated by a call to EndList(). @return This attribute value */ { return this; } MSdpElementBuilder* CSdpAttrValueList::EndListL() /** Indicates the end of a list started by StartListL(). @internalTechnology @return Parent of this attribute value */ { return iParent; } MSdpElementBuilder* CSdpAttrValueList::BuildUnknownL(TUint8 /*aType*/, TUint8 /*aSizeDesc*/, const TDesC8& /*aData*/) /** Does nothing. @internalTechnology @return This attribute value */ { //CSdpAttrValue *val=CSdpAttrValueUnknown::NewUnknownL(aType,aSizeDesc,aData); //AppendValueL(val); return this; } MSdpElementBuilder* CSdpAttrValueList::BuildNilL() /** Adds a null type element. @internalTechnology @return This attribute value with added element */ { CSdpAttrValue *val=CSdpAttrValueNil::NewNilL(); AppendValueL(val); return this; } MSdpElementBuilder* CSdpAttrValueList::BuildUintL(const TDesC8& aUint) /** Adds an unsigned integer element. @internalTechnology @param aUint Attribute to add @return This attribute value with added element */ { CSdpAttrValue *val=CSdpAttrValueUint::NewUintL(aUint); AppendValueL(val); return this; } MSdpElementBuilder* CSdpAttrValueList::BuildIntL(const TDesC8& aInt) /** Adds a signed integer element. @internalTechnology @param aInt Attribute to add @return This attribute value with added element */ { CSdpAttrValue *val=CSdpAttrValueInt::NewIntL(aInt); AppendValueL(val); return this; } MSdpElementBuilder* CSdpAttrValueList::BuildUUIDL(const TUUID& aUUID) /** Adds a UUID element. @internalTechnology @param aUUID Attribute to add @return This attribute value with added element */ { CSdpAttrValue *val=CSdpAttrValueUUID::NewUUIDL(aUUID); AppendValueL(val); return this; } MSdpElementBuilder* CSdpAttrValueList::BuildURLL(const TDesC8& aString) /** Adds a URL element. @internalTechnology @param aString URL to add @return This attribute value with added element */ { CSdpAttrValue *val=CSdpAttrValueURL::NewURLL(aString); AppendValueL(val); return this; } MSdpElementBuilder* CSdpAttrValueList::BuildEncodedL(const TDesC8& aString) /** Encode an attribute value. @internalTechnology @param aString The attribute value. @return This attribute value. */ { CSdpAttrValue* val=CSdpAttrValueEncoded::NewEncodedL(aString); AppendValueL(val); return this; } // NIL EXPORT_C CSdpAttrValueNil* CSdpAttrValueNil::NewNilL() /** Allocates and constructs a new CSdpAttrValueNil object. @return New CSdpAttrValueNil */ { CSdpAttrValueNil* val=new (ELeave) CSdpAttrValueNil(); return val; } CSdpAttrValueNil::CSdpAttrValueNil() { } CSdpAttrValueNil::~CSdpAttrValueNil() /** Destructor. */ { } TSdpElementType CSdpAttrValueNil::Type() const /** Gets the type of the attribute (always ETypeNil). @return Type of the attribute */ { return ETypeNil; } TUint CSdpAttrValueNil::DataSize() const /** Gets the size of the attribute (always 0). @return Size of the attribute (in bytes). */ { return 0; } // UINT EXPORT_C CSdpAttrValueUint* CSdpAttrValueUint::NewUintL(const TDesC8 &aUint) /** Allocates and constructs a new CSdpAttrValueUint object. @param aUint Buffer containing an unsigned integer value for the attribute @return New CSdpAttrValueUint object */ { if(aUint.Size()>KSdpMaxUintSize) { //Check less than or equal to 16 bytes = 128 bits User::Leave(KErrArgument); } CSdpAttrValueUint* val=new (ELeave) CSdpAttrValueUint(aUint); return val; } /** Replaces the current value. @param aValue The new value. The provided value must not exceed KSdpMaxUintSize. @panic USER 23 if the supplied value is too long. */ EXPORT_C void CSdpAttrValueUint::SetUintValue(const TDesC8& aValue) { // Copies data into iBuffer iUint = aValue; } CSdpAttrValueUint::CSdpAttrValueUint(const TDesC8 &aUint) : iUint(aUint) { __ASSERT_DEBUG(aUint.Size()<=KSdpMaxUintSize, User::Panic(_L("CSdpAttrValueUint Constructor"), KErrArgument)); } CSdpAttrValueUint::~CSdpAttrValueUint() /** Destructor. */ { } TSdpElementType CSdpAttrValueUint::Type() const /** Gets the attribute type. @return Attribute type. Always ETypeUint. */ { return ETypeUint; } TUint CSdpAttrValueUint::DataSize() const /** Gets the size of the attribute. @return Size of the attribute in bytes */ { return iUint.Length(); } TUint CSdpAttrValueUint::Uint() const /** Gets the value as an unsigned integer type. The size of the unsigned integer should be checked with DataSize() before calling. @return Attribute value */ { return SdpUtil::GetUint(iUint); } TBool CSdpAttrValueUint::DoesIntFit() const /** Tests if the attribute can be stored in an integer value. @return True if the attribute can be stored in an integer value */ { return (iUint.Length()>16)?EFalse:ETrue; } const TPtrC8 CSdpAttrValueUint::Des() const /** Gets the value as a data buffer. @return Attribute value */ { return TPtrC8(iUint); } /** The extension method provides a polymorphic behaviour to allow interface extension. Implements the functions for the Uint64 and Uint128 without breaking binary compatibility @internalComponent */ TInt CSdpAttrValueUint::Extension_(TUint aExtensionId, TAny *&a0, TAny *a1) { switch(aExtensionId) { case KSdpAttrValueUint64FunctionId: { TUint64* value = reinterpret_cast<TUint64*>(a0); SdpUtil::GetUint64(iUint, *value); return KErrNone; } case KSdpAttrValueUint128FunctionId: { TUint64* lo = reinterpret_cast<TUint64*>(a0); TUint64* hi = reinterpret_cast<TUint64*>(a1); SdpUtil::GetUint128(iUint, *lo, *hi); return KErrNone; } default: { // Chain to base class return CSdpAttrValue::Extension_(aExtensionId, a0, a1); } } } // INT EXPORT_C CSdpAttrValueInt* CSdpAttrValueInt::NewIntL(const TDesC8 &aInt) /** Allocates and constructs a new CSdpAttrValueInt object. @param aInt Buffer containing a signed integer value for the attribute @return New CSdpAttrValueInt object */ { if(aInt.Size()>KSdpMaxIntSize) { //Check less than 16 bytes = 128 bits User::Leave(KErrArgument); } CSdpAttrValueInt* val=new (ELeave) CSdpAttrValueInt(aInt); return val; } CSdpAttrValueInt::CSdpAttrValueInt(const TDesC8 &aInt) : iInt(aInt) { __ASSERT_DEBUG(aInt.Size()<=KSdpMaxIntSize, User::Panic(_L("CSdpAttrValueInt Constructor"), KErrArgument)); } CSdpAttrValueInt::~CSdpAttrValueInt() /** Destructor. */ { } TSdpElementType CSdpAttrValueInt::Type() const /** Gets the attribute type. @return Attribute type. Always ETypeInt. */ { return ETypeInt; } TUint CSdpAttrValueInt::DataSize() const /** Gets the size of the attribute. @return Size of the attribute in bytes */ { return iInt.Length(); } TInt CSdpAttrValueInt::Int() const /** Gets the value as a signed integer type. @return Attribute value */ { TUint uint = SdpUtil::GetUint(iInt); switch(iInt.Length()) { case 1: return (TInt8)uint; //cast to remove sign obscuring leading zeros case 2: return (TInt16)uint; //cast to remove sign obscuring leading zeros default: return uint; } } TBool CSdpAttrValueInt::DoesIntFit() const /** Tests if the attribute can be stored in an integer value. @return True if the attribute can be stored in an integer value */ { return (iInt.Length()>4)?EFalse:ETrue; } const TPtrC8 CSdpAttrValueInt::Des() const /** Gets the value as a data buffer. @return Attribute value */ { return TPtrC8(iInt); } // UUID EXPORT_C CSdpAttrValueUUID* CSdpAttrValueUUID::NewUUIDL(const TUUID& aUUID) /** Allocates and constructs a new CSdpAttrValueUUID object. @param aUUID Attribute value @return New CSdpAttrValueUUID object */ { CSdpAttrValueUUID* val=new (ELeave) CSdpAttrValueUUID(aUUID); return val; } CSdpAttrValueUUID::CSdpAttrValueUUID(const TUUID& aUUID) : iUUID(aUUID) { } CSdpAttrValueUUID::~CSdpAttrValueUUID() /** Destructor. */ { } TSdpElementType CSdpAttrValueUUID::Type() const /** Gets the attribute type. @return Attribute type. Always ETypeUUID. */ { return ETypeUUID; } TUint CSdpAttrValueUUID::DataSize() const /** Gets the size of the attribute. @return Size of the attribute in bytes */ {// HACKME change this to vary the UUID size // make sure this is synchronized with Des() return iUUID.ShortestForm().Length(); } const TUUID& CSdpAttrValueUUID::UUID() const /** Gets the attribute value. @return Attribute value */ { return iUUID; } const TPtrC8 CSdpAttrValueUUID::Des() const /** Gets the value as a data buffer. @return Attribute value */ { // return TPtrC8(iUUID.LongForm()); return TPtrC8(iUUID.ShortestForm()); } // STRING EXPORT_C CSdpAttrValueString* CSdpAttrValueString::NewStringL(const TDesC8& aString) /** Allocates and constructs a new CSdpAttrValueString object. @param aString Buffer containing a Text String value for the attribute @return New CSdpAttrValueString object */ { CSdpAttrValueString* st=new (ELeave) CSdpAttrValueString; CleanupStack::PushL(st); st->ConstructL(aString); CleanupStack::Pop(); return st; } void CSdpAttrValueString::ConstructL(const TDesC8& aString) { iBuffer=aString.AllocL(); } CSdpAttrValueString::CSdpAttrValueString() { } CSdpAttrValueString::~CSdpAttrValueString() /** Destructor. */ { delete iBuffer; } TSdpElementType CSdpAttrValueString::Type() const /** Gets the attribute type. @return Attribute type. Always ETypeString. */ { return ETypeString; } TUint CSdpAttrValueString::DataSize() const /** Gets the size of the attribute. @return Size of the attribute in bytes */ { return (*iBuffer).Length(); } const TPtrC8 CSdpAttrValueString::Des() const /** Gets the value as a data buffer. @return Attribute value */ { return TPtrC8(iBuffer->Des()); } // BOOL EXPORT_C CSdpAttrValueBoolean* CSdpAttrValueBoolean::NewBoolL(TBool aBool) /** Allocates and constructs a new CSdpAttrValueBoolean object. @param aBool Value for the attribute @return New CSdpAttrValueBoolean object */ { CSdpAttrValueBoolean* val=new (ELeave) CSdpAttrValueBoolean(aBool); return val; } CSdpAttrValueBoolean::CSdpAttrValueBoolean(TBool aBool) : iBool(aBool) { } CSdpAttrValueBoolean::~CSdpAttrValueBoolean() /** Destructor. */ { } TSdpElementType CSdpAttrValueBoolean::Type() const /** Gets the attribute type. @return Attribute type. Always ETypeBoolean. */ { return ETypeBoolean; } TUint CSdpAttrValueBoolean::DataSize() const /** Gets the size of the attribute. @return Size of the attribute in bytes. Always 1. */ { return 1; } TBool CSdpAttrValueBoolean::Bool() const /** Gets the attribute value. @return Attribute value */ { return iBool; } // DES EXPORT_C CSdpAttrValueDES* CSdpAttrValueDES::NewDESL(MSdpElementBuilder* aBuilder) /** Allocates and constructs a new CSdpAttrValueDES object. @param aBuilder Parent for list. Set to NULL if the list is not nested in another list. @return A new CSdpAttrValueDES object */ { CSdpAttrValueDES* self=new (ELeave) CSdpAttrValueDES(aBuilder); CleanupStack::PushL(self); self->CSdpAttrValueList::ConstructL(); CleanupStack::Pop(); return self; } CSdpAttrValueDES::CSdpAttrValueDES(MSdpElementBuilder *aBuilder) : CSdpAttrValueList(aBuilder) { } TSdpElementType CSdpAttrValueDES::Type() const /** Gets the attribute type. @return Attribute type. Always ETypeDES. */ { return ETypeDES; } // DEA EXPORT_C CSdpAttrValueDEA* CSdpAttrValueDEA::NewDEAL(MSdpElementBuilder* aBuilder) /** Allocates and constructs a new CSdpAttrValueDEA object. @param aBuilder Parent for list. Set to NULL if the list is not nested in another list. @return A new CSdpAttrValueDEA object */ { CSdpAttrValueDEA* self=new (ELeave) CSdpAttrValueDEA(aBuilder); CleanupStack::PushL(self); self->CSdpAttrValueList::ConstructL(); CleanupStack::Pop(); return self; } CSdpAttrValueDEA::CSdpAttrValueDEA(MSdpElementBuilder *aBuilder) : CSdpAttrValueList(aBuilder) { } /** Gets the attribute type. @return Attribute type. Always ETypeDEA. */ TSdpElementType CSdpAttrValueDEA::Type() const { return ETypeDEA; } // URL /** Allocates and constructs a new CSdpAttrValueURL object. @param aString Buffer containing the attribute value @return New CSdpAttrValueURL object */ EXPORT_C CSdpAttrValueURL* CSdpAttrValueURL::NewURLL(const TDesC8& aURL) { CSdpAttrValueURL* st=new (ELeave) CSdpAttrValueURL; CleanupStack::PushL(st); st->ConstructL(aURL); CleanupStack::Pop(); return st; } void CSdpAttrValueURL::ConstructL(const TDesC8& aURL) { iBuffer=aURL.AllocL(); } CSdpAttrValueURL::CSdpAttrValueURL() { } CSdpAttrValueURL::~CSdpAttrValueURL() /** Destructor. */ { delete iBuffer; } TSdpElementType CSdpAttrValueURL::Type() const /** Gets the attribute type. @return Attribute type. Always ETypeURL. */ { return ETypeURL; } TUint CSdpAttrValueURL::DataSize() const /** Gets the size of the attribute. @return Size of the attribute in bytes. */ { return (*iBuffer).Length(); } const TPtrC8 CSdpAttrValueURL::Des() const /** Gets the value as a data buffer. @return Attribute value */ { return TPtrC8(iBuffer->Des()); } // Encoded EXPORT_C CSdpAttrValueEncoded* CSdpAttrValueEncoded::NewEncodedL(const TDesC8& aString) { CSdpAttrValueEncoded* st=new(ELeave) CSdpAttrValueEncoded(); CleanupStack::PushL(st); st->ConstructL(aString); CleanupStack::Pop(); return st; } void CSdpAttrValueEncoded::ConstructL(const TDesC8& aString) { iBuffer=aString.AllocL(); } CSdpAttrValueEncoded::CSdpAttrValueEncoded() { } CSdpAttrValueEncoded::~CSdpAttrValueEncoded() { delete iBuffer; } TSdpElementType CSdpAttrValueEncoded::Type() const { return ETypeEncoded; } TUint CSdpAttrValueEncoded::DataSize() const { return iBuffer->Length(); } const TPtrC8 CSdpAttrValueEncoded::Des() const { return TPtrC8(iBuffer->Des()); } /** Replaces the current value. @param aValue The new value. This must be an attribute value which has been appropriately encoded, for instance using the CSdpAttrEncoderVisitor class. The data in aValue will be copied. The provided value must not exceed the length of the current data. This may be retrieved via the CSdpAttrValueEncoded::Des() function and TPtrC8::Length() function. @panic USER 23 if the supplied value is too long. */ EXPORT_C void CSdpAttrValueEncoded::SetEncodedValue(const TDesC8& aValue) { // Copies data into iBuffer *iBuffer = aValue; }
[ "kirill.dremov@nokia.com" ]
kirill.dremov@nokia.com
2db71fac18be7e72b4354ded4de2a7d45f18c464
87dea373bca483449eca7c889f8655e80376a6df
/SplashDlg.h
e4c6b5e8e77204be6f90488853f8d49056de1e7d
[]
no_license
wgwang/rstockanalyst
c19ffbd20e76a2bfcf60d9a57613d623a0e78922
c08414bf81a024a50e0e1b2e013bcf29e428d5d8
refs/heads/master
2021-01-01T20:16:14.694602
2013-09-01T13:20:17
2013-09-01T13:20:17
33,318,406
1
2
null
null
null
null
GB18030
C++
false
false
791
h
/************************************************************************/ /* 文件名称:SplashDlg.h /* 创建时间:2012-11-08 10:59 /* /* 描 述:用于程序初始化和程序退出时的闪屏窗口,继承自QDialog /************************************************************************/ #ifndef SPLASH_DLG_H #define SPLASH_DLG_H #include <QtGui> class CSplashDlg : public QWidget { Q_OBJECT public: static CSplashDlg* getSplashDlg(); private: CSplashDlg(QWidget* parent = 0); ~CSplashDlg(); public slots: void showMessage(const QString& msg, int iPro = 90); protected: virtual void showEvent(QShowEvent* event); private: static CSplashDlg* m_pSelf; QProgressBar* m_pProgressBar; QLabel* m_pLabel; }; #endif //SPLASH_DLG_H
[ "liyake04@gmail.com@4ebeba31-cbc1-aedc-ca5e-33a6bebab04a" ]
liyake04@gmail.com@4ebeba31-cbc1-aedc-ca5e-33a6bebab04a
7a2f6dd9dece8d4b26c2bc7767fd09c7187a2db4
cfff23a4ea8ae16ef9d3ca1234e7a65e7e807889
/src/timer_service.h
ec0c4c0720aa5e13e8fdaac613e06f4e4e1f146e
[ "MIT" ]
permissive
netdigger/beam
0fc1da2a8daddf11f113338266231549e8ec8297
2aa90fd6117db40a5ae96b83793681df57c11b3e
refs/heads/master
2021-01-12T18:14:33.463187
2018-09-09T06:09:00
2018-09-09T06:09:00
71,346,465
0
0
null
null
null
null
UTF-8
C++
false
false
1,189
h
/* Copyright ©2018 All right reserved, Author: netdigger*/ #ifndef __TIMER_SERVICE_H__ #define __TIMER_SERVICE_H__ #include <set> #include "beam/mutex.h" #include "beam/task.h" namespace beam { class Timer; class TimerWorker; class TimerTrigger; class TimerService : public Task { public: virtual ~TimerService(){}; static Timer* Add(Task& task, void* args, int time, bool once) { return instance_.DoAdd(task, args, time, once); }; static void Cancel(Timer* timer) { instance_.DoCancel(timer); } private: static TimerService instance_; struct TimerInfo { TimerWorker* worker; int circle_time; int trigger_time; bool operator<(const TimerInfo& info) const { if (this->trigger_time == info.trigger_time) { return this->worker < info.worker; } return this->trigger_time < info.trigger_time; } }; int elapsed_time_; Mutex mutex_; std::set<TimerInfo> workers_; TimerService(){}; TimerService(TimerService&){}; Timer* DoAdd(Task&, void*, int, bool); void DoCancel(Timer*); void Run(void*); }; } // namespace beam #endif
[ "netdigger@gmail.com" ]
netdigger@gmail.com
fa420c73a9826a7881529e311328143c87610db2
929ab1c9a3c741aa706a74d566097196c8093547
/nvpr_examples/skia/experimental/Intersection/QuadraticReduceOrder.cpp
e6ce04444a7de25f95f310e8098ec4a656087172
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-warranty-disclaimer", "BSD-3-Clause" ]
permissive
sasmaster/NVprSDK
5777a05887d5b5d52a00d15c6a6a0f091f725f8a
7d7d17424853fc200665f5b5f6f6c8448695f8a5
refs/heads/master
2023-03-16T09:58:48.996704
2020-02-05T02:40:18
2020-02-05T02:42:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,596
cpp
#include "CurveIntersection.h" #include "Extrema.h" #include "IntersectionUtilities.h" #include "LineParameters.h" static double interp_quad_coords(double a, double b, double c, double t) { double ab = interp(a, b, t); double bc = interp(b, c, t); return interp(ab, bc, t); } static int coincident_line(const Quadratic& quad, Quadratic& reduction) { reduction[0] = reduction[1] = quad[0]; return 1; } static int vertical_line(const Quadratic& quad, Quadratic& reduction) { double tValue; reduction[0] = quad[0]; reduction[1] = quad[2]; int smaller = reduction[1].y > reduction[0].y; int larger = smaller ^ 1; if (SkFindQuadExtrema(quad[0].y, quad[1].y, quad[2].y, &tValue)) { double yExtrema = interp_quad_coords(quad[0].y, quad[1].y, quad[2].y, tValue); if (reduction[smaller].y > yExtrema) { reduction[smaller].y = yExtrema; } else if (reduction[larger].y < yExtrema) { reduction[larger].y = yExtrema; } } return 2; } static int horizontal_line(const Quadratic& quad, Quadratic& reduction) { double tValue; reduction[0] = quad[0]; reduction[1] = quad[2]; int smaller = reduction[1].x > reduction[0].x; int larger = smaller ^ 1; if (SkFindQuadExtrema(quad[0].x, quad[1].x, quad[2].x, &tValue)) { double xExtrema = interp_quad_coords(quad[0].x, quad[1].x, quad[2].x, tValue); if (reduction[smaller].x > xExtrema) { reduction[smaller].x = xExtrema; } else if (reduction[larger].x < xExtrema) { reduction[larger].x = xExtrema; } } return 2; } static int check_linear(const Quadratic& quad, Quadratic& reduction, int minX, int maxX, int minY, int maxY) { int startIndex = 0; int endIndex = 2; while (quad[startIndex].approximatelyEqual(quad[endIndex])) { --endIndex; if (endIndex == 0) { printf("%s shouldn't get here if all four points are about equal", __FUNCTION__); assert(0); } } LineParameters lineParameters; lineParameters.quadEndPoints(quad, startIndex, endIndex); double normalSquared = lineParameters.normalSquared(); double distance = lineParameters.controlPtDistance(quad); // not normalized double limit = normalSquared * SquaredEpsilon; double distSq = distance * distance; if (distSq > limit) { return 0; } // four are colinear: return line formed by outside reduction[0] = quad[0]; reduction[1] = quad[2]; int sameSide; bool useX = quad[maxX].x - quad[minX].x >= quad[maxY].y - quad[minY].y; if (useX) { sameSide = sign(quad[0].x - quad[1].x) + sign(quad[2].x - quad[1].x); } else { sameSide = sign(quad[0].y - quad[1].y) + sign(quad[2].y - quad[1].y); } if ((sameSide & 3) != 2) { return 2; } double tValue; int root; if (useX) { root = SkFindQuadExtrema(quad[0].x, quad[1].x, quad[2].x, &tValue); } else { root = SkFindQuadExtrema(quad[0].y, quad[1].y, quad[2].y, &tValue); } if (root) { _Point extrema; extrema.x = interp_quad_coords(quad[0].x, quad[1].x, quad[2].x, tValue); extrema.y = interp_quad_coords(quad[0].x, quad[1].x, quad[2].x, tValue); // sameSide > 0 means mid is smaller than either [0] or [2], so replace smaller int replace; if (useX) { if (extrema.x < quad[0].x ^ extrema.x < quad[2].x) { return 2; } replace = (extrema.x < quad[0].x | extrema.x < quad[2].x) ^ quad[0].x < quad[2].x; } else { if (extrema.y < quad[0].y ^ extrema.y < quad[2].y) { return 2; } replace = (extrema.y < quad[0].y | extrema.y < quad[2].y) ^ quad[0].y < quad[2].y; } reduction[replace] = extrema; } return 2; } // reduce to a quadratic or smaller // look for identical points // look for all four points in a line // note that three points in a line doesn't simplify a cubic // look for approximation with single quadratic // save approximation with multiple quadratics for later int reduceOrder(const Quadratic& quad, Quadratic& reduction) { int index, minX, maxX, minY, maxY; int minXSet, minYSet; minX = maxX = minY = maxY = 0; minXSet = minYSet = 0; for (index = 1; index < 3; ++index) { if (quad[minX].x > quad[index].x) { minX = index; } if (quad[minY].y > quad[index].y) { minY = index; } if (quad[maxX].x < quad[index].x) { maxX = index; } if (quad[maxY].y < quad[index].y) { maxY = index; } } for (index = 0; index < 3; ++index) { if (approximately_equal(quad[index].x, quad[minX].x)) { minXSet |= 1 << index; } if (approximately_equal(quad[index].y, quad[minY].y)) { minYSet |= 1 << index; } } if (minXSet == 0xF) { // test for vertical line if (minYSet == 0xF) { // return 1 if all four are coincident return coincident_line(quad, reduction); } return vertical_line(quad, reduction); } if (minYSet == 0xF) { // test for horizontal line return horizontal_line(quad, reduction); } int result = check_linear(quad, reduction, minX, maxX, minY, maxY); if (result) { return result; } memcpy(reduction, quad, sizeof(Quadratic)); return 3; }
[ "mjk@nvidia.com" ]
mjk@nvidia.com
1249ae30a56afd3cc003aa80b5e695a9a6e6444b
55d78aa8c8510cb7bbb8547d44249a9fe4e63f16
/src/storage/LinkBatchStorage.cpp
9877688d9f7272f21b7a9e0135724bf19f839018
[]
no_license
goforbroke1006/adelantado
8e72826974fe57efc17a2fda663ea34c1a0a9054
3eaf71ed129d69cf4e5907481edd5e11649b78dd
refs/heads/master
2023-01-20T02:24:50.928279
2020-11-30T00:23:06
2020-11-30T00:23:06
311,798,109
0
0
null
null
null
null
UTF-8
C++
false
false
943
cpp
// // Created by goforbroke on 29.11.2020. // #include "LinkBatchStorage.h" #include <stdexcept> #include "common.h" LinkBatchStorage::LinkBatchStorage(PGconn *conn) : mConnection(conn) {} void LinkBatchStorage::registerLink(const std::string &address) { std::string sql = "" "INSERT INTO links (address) " "VALUES ('" + address + "') ON CONFLICT DO NOTHING"; mQueries.push_back(sql); } void LinkBatchStorage::flush() { std::string sql; for (const auto &query : mQueries) { sql.append(query).append("; "); } PGresult *res = PQexec(mConnection, sql.c_str()); if (PQresultStatus(res) != PGRES_COMMAND_OK) { char *message = PQerrorMessage(mConnection); if (isDuplicateError(message)) { throw DuplicateKeyException(message); } else { throw std::runtime_error(message); } } PQclear(res); }
[ "go.for.broke1006@gmail.com" ]
go.for.broke1006@gmail.com
08d879b13fe467242549ff5b2749e6a4762cac9e
9c0987e2a040902a82ed04d5e788a074a2161d2f
/cpp/platform/impl/windows/generated/winrt/impl/Windows.Security.Cryptography.DataProtection.1.h
9f0bfb3d395aaab4837c239babbb8ec4e2e98b04
[ "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
permissive
l1kw1d/nearby-connections
ff9119338a6bd3e5c61bc2c93d8d28b96e5ebae5
ea231c7138d3dea8cd4cd75692137e078cbdd73d
refs/heads/master
2023-06-15T04:15:54.683855
2021-07-12T23:05:16
2021-07-12T23:06:22
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,545
h
// Copyright 2020 Google LLC // // 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 // // https://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. // WARNING: Please don't edit this file. It was generated by C++/WinRT v2.0.210505.3 #ifndef WINRT_Windows_Security_Cryptography_DataProtection_1_H #define WINRT_Windows_Security_Cryptography_DataProtection_1_H #include "winrt/impl/Windows.Security.Cryptography.DataProtection.0.h" WINRT_EXPORT namespace winrt::Windows::Security::Cryptography::DataProtection { struct __declspec(empty_bases) IDataProtectionProvider : winrt::Windows::Foundation::IInspectable, impl::consume_t<IDataProtectionProvider> { IDataProtectionProvider(std::nullptr_t = nullptr) noexcept {} IDataProtectionProvider(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {} IDataProtectionProvider(IDataProtectionProvider const&) noexcept = default; IDataProtectionProvider(IDataProtectionProvider&&) noexcept = default; IDataProtectionProvider& operator=(IDataProtectionProvider const&) & noexcept = default; IDataProtectionProvider& operator=(IDataProtectionProvider&&) & noexcept = default; }; struct __declspec(empty_bases) IDataProtectionProviderFactory : winrt::Windows::Foundation::IInspectable, impl::consume_t<IDataProtectionProviderFactory> { IDataProtectionProviderFactory(std::nullptr_t = nullptr) noexcept {} IDataProtectionProviderFactory(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {} IDataProtectionProviderFactory(IDataProtectionProviderFactory const&) noexcept = default; IDataProtectionProviderFactory(IDataProtectionProviderFactory&&) noexcept = default; IDataProtectionProviderFactory& operator=(IDataProtectionProviderFactory const&) & noexcept = default; IDataProtectionProviderFactory& operator=(IDataProtectionProviderFactory&&) & noexcept = default; }; } #endif
[ "copybara-worker@google.com" ]
copybara-worker@google.com
e97998f88a6d9fd682047a934f19eecdd1c02919
98b6b3063c80b82175a1ebe2f0ab35b026967481
/CSES/Introductory Problems/GridPaths.cpp
7f2a1bd3d7fec766b51677d8bf7bef258ca26bcc
[ "MIT" ]
permissive
AakashPawanGPS/competitive-programming
02c6f8a2ad55c7274f0d4aa668efe75ee9f39859
b2f1ad3a258c00da71e468316f020a88df5d8872
refs/heads/master
2023-05-27T14:32:01.669785
2021-06-14T04:17:09
2021-06-14T04:17:09
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,260
cpp
#pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("no-stack-protector") #pragma GCC optimize("fast-math") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define deb(x) cout << #x << " is " << x << "\n" #define int long long #define MOD 1000000007LL #define PI acos(-1) template <typename T> using min_heap = priority_queue<T, vector<T>, greater<T>>; template <typename T> using max_heap = priority_queue<T>; template <class T> using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>; template <typename... T> void read(T &...args) { ((cin >> args), ...); } template <typename... T> void write(T &&...args) { ((cout << args), ...); } template <typename T> void readContainer(T &t) { for (auto &e : t) { read(e); } } template <typename T> void writeContainer(T &t) { for (const auto &e : t) { write(e, " "); } write("\n"); } string s; vector<int> dx = {0, 0, 1, -1}; vector<int> dy = {1, -1, 0, 0}; vector<vector<bool>> visited(7, vector<bool>(7, false)); int solve(int i, int j, int idx) { if (i == 6 && j == 6) return 1; if (i < 0 || j < 0 || i >= 7 || j >= 7 || visited[i][j] || idx >= 48) return 0; visited[i][j] = true; int ans = 0; if (s[idx] == 'L') { ans += solve(i, j - 1, idx + 1); } else if (s[idx] == 'R') { ans += solve(i, j + 1, idx + 1); } else if (s[idx] == 'U') { ans += solve(i - 1, j, idx + 1); } else if (s[idx] == 'D') { ans += solve(i - 1, j, idx + 1); } else { for (int k = 0; k < 4; ++k) { ans += solve(i + dx[k], j + dy[k], idx + 1); } } visited[i][j] = false; return ans; } void solve(int tc) { read(s); int ans = solve(0, 0, 0); write(ans); } signed main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif ios::sync_with_stdio(false); cin.tie(nullptr); int tc = 1; // read(tc); for (int curr = 1; curr <= tc; ++curr) { solve(curr); } return 0; }
[ "thedevelopersanjeev@gmail.com" ]
thedevelopersanjeev@gmail.com
077ac8897685a888664db7fce5ce304d386f699d
b2ee7279be8680b597a52953cb83ba035e169693
/WinGUI/NewGUI/NewColorizerEx.cpp
2229b120a0c365eb183e252acec966695b62b66c
[]
no_license
xt9852/KeePassXT
6ce8b9ec4de7987086790abea9fed48dad9be2a3
ca2f7e56078310f50e33a704334461de893ff262
refs/heads/master
2021-01-20T19:56:39.351759
2017-12-25T08:52:47
2017-12-25T08:52:47
61,785,904
5
1
null
null
null
null
UTF-8
C++
false
false
6,276
cpp
/* KeePass Password Safe - The Open-Source Password Manager Copyright (C) 2003-2017 Dominik Reichl <dominik.reichl@t-online.de> 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 2 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, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "StdAfx.h" #include "NewColorizerEx.h" #include <math.h> #include "ImageUtilEx.h" using namespace Gdiplus; float NewGUI_GetHue(COLORREF clr) { const BYTE r = GetRValue(clr); const BYTE g = GetGValue(clr); const BYTE b = GetBValue(clr); if((r == g) && (g == b)) return 0.0f; const float fr = (float)r / 255.0f; const float fg = (float)g / 255.0f; const float fb = (float)b / 255.0f; const float fMax = max(fr, max(fg, fb)); const float fMin = min(fr, min(fg, fb)); const float d = fMax - fMin; float f = 0.0f; if(fr == fMax) f = (fg - fb) / d; else if(fg == fMax) f = 2.0f + (fb - fr) / d; else if(fb == fMax) f = 4.0f + (fr - fg) / d; f *= 60.0f; if(f < 0.0f) f += 360.0f; ASSERT((f >= 0.0f) && (f <= 360.0f)); return f; } void NewGUI_ColorToHsv(COLORREF clr, float* pfHue, float* pfSaturation, float* pfValue) { ASSERT((pfHue != NULL) && (pfSaturation != NULL) && (pfValue != NULL)); const BYTE nMax = max(GetRValue(clr), max(GetGValue(clr), GetBValue(clr))); const BYTE nMin = min(GetRValue(clr), min(GetGValue(clr), GetBValue(clr))); *pfHue = NewGUI_GetHue(clr); // In degrees *pfSaturation = ((nMax == 0) ? 0.0f : (1.0f - ((float)nMin / nMax))); *pfValue = (float)nMax / 255.0f; } COLORREF NewGUI_ColorFromHsv(float fHue, float fSaturation, float fValue) { const float d = fHue / 60.0f; const float fl = floor(d); const float f = d - fl; fValue *= 255.0f; const BYTE v = (BYTE)fValue; const BYTE p = (BYTE)(fValue * (1.0f - fSaturation)); const BYTE q = (BYTE)(fValue * (1.0f - (fSaturation * f))); const BYTE t = (BYTE)(fValue * (1.0f - (fSaturation * (1.0f - f)))); const int hi = (int)fl % 6; if(hi == 0) return RGB(v, t, p); if(hi == 1) return RGB(q, v, p); if(hi == 2) return RGB(p, v, t); if(hi == 3) return RGB(p, q, v); if(hi == 4) return RGB(t, p, v); return RGB(v, p, q); } HICON NewGUI_CreateColorizedIcon(HICON hBase, HICON hOverlay, COLORREF clr, int qSize) { if(hBase == NULL) { ASSERT(FALSE); return NULL; } if(qSize <= 0) qSize = 48; // Large shell icon size Bitmap bmp(qSize, qSize, PixelFormat32bppARGB); Graphics *pg = Graphics::FromImage(&bmp); ASSERT(pg != NULL); VERIFY(pg->Clear(Color::Transparent) == Ok); VERIFY(pg->SetInterpolationMode(InterpolationModeHighQualityBicubic) == Ok); VERIFY(pg->SetSmoothingMode(SmoothingModeHighQuality) == Ok); bool bDrawDefault = true; if(qSize > 32) { Bitmap* pbmpIco = NULL; if(NewGUI_ExtractVistaIcon(hBase, &pbmpIco)) { ASSERT(pbmpIco != NULL); pg->DrawImage(pbmpIco, 0, 0, bmp.GetWidth(), bmp.GetHeight()); delete pbmpIco; bDrawDefault = false; } } if(bDrawDefault) { // Bitmap* pbmpIco = Bitmap::FromHICON(hBase); // ASSERT(pbmpIco != NULL); // pg->DrawImage(pbmpIco, 0, 0, bmp.GetWidth(), bmp.GetHeight()); // delete pbmpIco; HDC hDC = pg->GetHDC(); VERIFY(DrawIconEx(hDC, 0, 0, hBase, static_cast<int>(bmp.GetWidth()), static_cast<int>(bmp.GetHeight()), 0, NULL, DI_NORMAL) != FALSE); pg->ReleaseHDC(hDC); } // CLSID clsidPNG = { 0x557CF406, 0x1A04, 0x11D3, // { 0x9A, 0x73, 0x00, 0x00, 0xF8, 0x1E, 0xF3, 0x2E } }; // bmp.Save(L"D:\\Temp_KeePass\\ColorizedIcon.png", &clsidPNG); if(clr != DWORD_MAX) { BitmapData bd; Rect rect(0, 0, bmp.GetWidth(), bmp.GetHeight()); VERIFY(bmp.LockBits(&rect, ImageLockModeRead | ImageLockModeWrite, PixelFormat32bppARGB, &bd) == Ok); const int nBytes = abs(bd.Stride * static_cast<int>(bmp.GetHeight())); BYTE* pbArgb = (BYTE *)bd.Scan0; float fHue, fSat, fVal; NewGUI_ColorToHsv(clr, &fHue, &fSat, &fVal); for(int i = 0; i < nBytes; i += 4) { if(pbArgb[i + 3] == 0) continue; // Transparent if((pbArgb[i] == pbArgb[i + 1]) && (pbArgb[i] == pbArgb[i + 2])) continue; // Gray COLORREF clrPixel = RGB(pbArgb[i + 2], pbArgb[i + 1], pbArgb[i]); // BGRA float h, s, v; NewGUI_ColorToHsv(clrPixel, &h, &s, &v); COLORREF clrNew = NewGUI_ColorFromHsv(fHue, s, v); pbArgb[i] = GetBValue(clrNew); pbArgb[i + 1] = GetGValue(clrNew); pbArgb[i + 2] = GetRValue(clrNew); } VERIFY(bmp.UnlockBits(&bd) == Ok); } if(hOverlay != NULL) { Bitmap* pOverlay = Bitmap::FromHICON(hOverlay); pg->DrawImage(pOverlay, 0, bmp.GetHeight() / 2, bmp.GetWidth() / 2, bmp.GetHeight() / 2); delete pOverlay; } SAFE_DELETE(pg); HICON hIcon = NULL; VERIFY(bmp.GetHICON(&hIcon) == Ok); return hIcon; } void NewGUI_UpdateColorizedIcon(HICON hDefault, HICON hOverlay, COLORREF clr, int qSize, HICON* phStore, COLORREF* pcStore, HICON* phAssignable, HICON* phDestructible) { if(phAssignable == NULL) { ASSERT(FALSE); return; } if(phDestructible == NULL) { ASSERT(FALSE); return; } if(hOverlay != NULL) { *phDestructible = *phStore; *phStore = NewGUI_CreateColorizedIcon(hDefault, hOverlay, clr, qSize); *pcStore = clr; *phAssignable = *phStore; return; } if(clr == *pcStore) { *phAssignable = ((*phStore != NULL) ? *phStore : hDefault); *phDestructible = NULL; return; } *phDestructible = *phStore; if(clr == DWORD_MAX) { *phStore = NULL; *phAssignable = hDefault; } else { *phStore = NewGUI_CreateColorizedIcon(hDefault, hOverlay, clr, qSize); *phAssignable = *phStore; } *pcStore = clr; }
[ "zhanghaitao@autohome.com.cn" ]
zhanghaitao@autohome.com.cn
74c2f2eeb9d9bc74ae8c4b32bbf9382a98780ac5
5ec06dab1409d790496ce082dacb321392b32fe9
/clients/cpp-qt5/generated/client/OAIComDayCqWcmCoreStatsPageViewStatisticsImplProperties.cpp
c00570b7fed82ac5ca98f970c614650edcd46af6
[ "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
4,838
cpp
/** * 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. */ #include "OAIComDayCqWcmCoreStatsPageViewStatisticsImplProperties.h" #include "OAIHelpers.h" #include <QJsonDocument> #include <QJsonArray> #include <QObject> #include <QDebug> namespace OpenAPI { OAIComDayCqWcmCoreStatsPageViewStatisticsImplProperties::OAIComDayCqWcmCoreStatsPageViewStatisticsImplProperties(QString json) { init(); this->fromJson(json); } OAIComDayCqWcmCoreStatsPageViewStatisticsImplProperties::OAIComDayCqWcmCoreStatsPageViewStatisticsImplProperties() { init(); } OAIComDayCqWcmCoreStatsPageViewStatisticsImplProperties::~OAIComDayCqWcmCoreStatsPageViewStatisticsImplProperties() { this->cleanup(); } void OAIComDayCqWcmCoreStatsPageViewStatisticsImplProperties::init() { pageviewstatistics_trackingurl = new OAIConfigNodePropertyString(); m_pageviewstatistics_trackingurl_isSet = false; pageviewstatistics_trackingscript_enabled = new OAIConfigNodePropertyString(); m_pageviewstatistics_trackingscript_enabled_isSet = false; } void OAIComDayCqWcmCoreStatsPageViewStatisticsImplProperties::cleanup() { if(pageviewstatistics_trackingurl != nullptr) { delete pageviewstatistics_trackingurl; } if(pageviewstatistics_trackingscript_enabled != nullptr) { delete pageviewstatistics_trackingscript_enabled; } } OAIComDayCqWcmCoreStatsPageViewStatisticsImplProperties* OAIComDayCqWcmCoreStatsPageViewStatisticsImplProperties::fromJson(QString json) { QByteArray array (json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); QJsonObject jsonObject = doc.object(); this->fromJsonObject(jsonObject); return this; } void OAIComDayCqWcmCoreStatsPageViewStatisticsImplProperties::fromJsonObject(QJsonObject pJson) { ::OpenAPI::setValue(&pageviewstatistics_trackingurl, pJson["pageviewstatistics.trackingurl"], "OAIConfigNodePropertyString", "OAIConfigNodePropertyString"); ::OpenAPI::setValue(&pageviewstatistics_trackingscript_enabled, pJson["pageviewstatistics.trackingscript.enabled"], "OAIConfigNodePropertyString", "OAIConfigNodePropertyString"); } QString OAIComDayCqWcmCoreStatsPageViewStatisticsImplProperties::asJson () { QJsonObject obj = this->asJsonObject(); QJsonDocument doc(obj); QByteArray bytes = doc.toJson(); return QString(bytes); } QJsonObject OAIComDayCqWcmCoreStatsPageViewStatisticsImplProperties::asJsonObject() { QJsonObject obj; if((pageviewstatistics_trackingurl != nullptr) && (pageviewstatistics_trackingurl->isSet())){ toJsonValue(QString("pageviewstatistics.trackingurl"), pageviewstatistics_trackingurl, obj, QString("OAIConfigNodePropertyString")); } if((pageviewstatistics_trackingscript_enabled != nullptr) && (pageviewstatistics_trackingscript_enabled->isSet())){ toJsonValue(QString("pageviewstatistics.trackingscript.enabled"), pageviewstatistics_trackingscript_enabled, obj, QString("OAIConfigNodePropertyString")); } return obj; } OAIConfigNodePropertyString* OAIComDayCqWcmCoreStatsPageViewStatisticsImplProperties::getPageviewstatisticsTrackingurl() { return pageviewstatistics_trackingurl; } void OAIComDayCqWcmCoreStatsPageViewStatisticsImplProperties::setPageviewstatisticsTrackingurl(OAIConfigNodePropertyString* pageviewstatistics_trackingurl) { this->pageviewstatistics_trackingurl = pageviewstatistics_trackingurl; this->m_pageviewstatistics_trackingurl_isSet = true; } OAIConfigNodePropertyString* OAIComDayCqWcmCoreStatsPageViewStatisticsImplProperties::getPageviewstatisticsTrackingscriptEnabled() { return pageviewstatistics_trackingscript_enabled; } void OAIComDayCqWcmCoreStatsPageViewStatisticsImplProperties::setPageviewstatisticsTrackingscriptEnabled(OAIConfigNodePropertyString* pageviewstatistics_trackingscript_enabled) { this->pageviewstatistics_trackingscript_enabled = pageviewstatistics_trackingscript_enabled; this->m_pageviewstatistics_trackingscript_enabled_isSet = true; } bool OAIComDayCqWcmCoreStatsPageViewStatisticsImplProperties::isSet(){ bool isObjectUpdated = false; do{ if(pageviewstatistics_trackingurl != nullptr && pageviewstatistics_trackingurl->isSet()){ isObjectUpdated = true; break;} if(pageviewstatistics_trackingscript_enabled != nullptr && pageviewstatistics_trackingscript_enabled->isSet()){ isObjectUpdated = true; break;} }while(false); return isObjectUpdated; } }
[ "cliffano@gmail.com" ]
cliffano@gmail.com
83ea2dca55e9f83db97427dc5d0c4b891da62dd9
89c18e3ed276ca5fff7bd747548fd97a4ecf880a
/third_party/protozero/test/t/enum/testcase.cpp
0854ff5704009cdaf9c2f8de62a8b278602b80af
[ "Apache-2.0", "BSD-2-Clause" ]
permissive
developmentseed/osrm-backend
98d4705554dee6df1e2e0786bebc6b2a90494638
0c344ae98ffd3cdadd405b4991d7bf5ceb70c3b4
refs/heads/master
2021-07-05T19:29:43.092863
2020-07-21T10:43:33
2020-07-21T10:46:04
135,611,823
3
1
BSD-2-Clause
2020-07-14T08:30:16
2018-05-31T16:54:21
C++
UTF-8
C++
false
false
491
cpp
#include <testcase.hpp> #include "testcase.pb.h" int main(int c, char *argv[]) { TestEnum::Test msg; msg.set_color(TestEnum::BLACK); write_to_file(msg, "data-black.pbf"); msg.set_color(TestEnum::BLUE); write_to_file(msg, "data-blue.pbf"); msg.set_color(TestEnum::NEG); write_to_file(msg, "data-neg.pbf"); msg.set_color(TestEnum::MAX); write_to_file(msg, "data-max.pbf"); msg.set_color(TestEnum::MIN); write_to_file(msg, "data-min.pbf"); }
[ "michael.krasnyk@gmail.com" ]
michael.krasnyk@gmail.com
ec026223fd7fbdfd1d3c49ed658855356be6150c
a62342d6359a88b0aee911e549a4973fa38de9ea
/0.6.0.3/Internal/SDK/BP_Prey_Moose_Female_functions.cpp
daa4847b25e7ae57a55f05ca6a3401085e5a9bda
[]
no_license
zanzo420/Medieval-Dynasty-SDK
d020ad634328ee8ee612ba4bd7e36b36dab740ce
d720e49ae1505e087790b2743506921afb28fc18
refs/heads/main
2023-06-20T03:00:17.986041
2021-07-15T04:51:34
2021-07-15T04:51:34
386,165,085
0
0
null
null
null
null
UTF-8
C++
false
false
2,511
cpp
// Name: Medieval Dynasty, Version: 0.6.0.3 #include "../pch.h" /*!!DEFINE!!*/ /*!!HELPER_DEF!!*/ /*!!HELPER_INC!!*/ #ifdef _MSC_VER #pragma pack(push, 0x01) #endif namespace CG { //--------------------------------------------------------------------------- // Functions //--------------------------------------------------------------------------- // Function BP_Prey_Moose_Female.BP_Prey_Moose_Female_C.AnimNotify_DeathEnd // (BlueprintCallable, BlueprintEvent) void ABP_Prey_Moose_Female_C::AnimNotify_DeathEnd() { static auto fn = UObject::FindObject<UFunction>("Function BP_Prey_Moose_Female.BP_Prey_Moose_Female_C.AnimNotify_DeathEnd"); ABP_Prey_Moose_Female_C_AnimNotify_DeathEnd_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function BP_Prey_Moose_Female.BP_Prey_Moose_Female_C.EventDead // (Net, NetReliable, NetMulticast, BlueprintCallable, BlueprintEvent) void ABP_Prey_Moose_Female_C::EventDead() { static auto fn = UObject::FindObject<UFunction>("Function BP_Prey_Moose_Female.BP_Prey_Moose_Female_C.EventDead"); ABP_Prey_Moose_Female_C_EventDead_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function BP_Prey_Moose_Female.BP_Prey_Moose_Female_C.ReceiveBeginPlay // (Event, Protected, BlueprintEvent) void ABP_Prey_Moose_Female_C::ReceiveBeginPlay() { static auto fn = UObject::FindObject<UFunction>("Function BP_Prey_Moose_Female.BP_Prey_Moose_Female_C.ReceiveBeginPlay"); ABP_Prey_Moose_Female_C_ReceiveBeginPlay_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function BP_Prey_Moose_Female.BP_Prey_Moose_Female_C.ExecuteUbergraph_BP_Prey_Moose_Female // (Final) // Parameters: // int EntryPoint (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash) void ABP_Prey_Moose_Female_C::ExecuteUbergraph_BP_Prey_Moose_Female(int EntryPoint) { static auto fn = UObject::FindObject<UFunction>("Function BP_Prey_Moose_Female.BP_Prey_Moose_Female_C.ExecuteUbergraph_BP_Prey_Moose_Female"); ABP_Prey_Moose_Female_C_ExecuteUbergraph_BP_Prey_Moose_Female_Params params; params.EntryPoint = EntryPoint; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "zp2kshield@gmail.com" ]
zp2kshield@gmail.com
a619e4a08e76c0a27a183ac6c8c763c1c1d22a2e
0d188ac348c99f5f83bcfde9c83033c696e74c52
/archive/to-2006/phd-neuralsim/brainlib/BadObject.h
9f7fa4f39c88fdb120bb2ff1b6a5942a8cfd56cc
[]
no_license
pliniker/attic
ebb3085fbc7465017144f0fced1243c28e4eb82c
35b009f6bac41564e3396f272a2bc0ff1b1ec21e
refs/heads/master
2021-01-10T06:18:40.788507
2015-11-23T18:42:57
2015-11-23T18:42:57
46,632,107
0
0
null
null
null
null
UTF-8
C++
false
false
1,232
h
#ifndef BRAINLIB_BADOBJECT_H #define BRAINLIB_BADOBJECT_H #include <exception> #include <string> #include <iostream> #include "ErrorInterface.h" #include "Serializable.h" namespace nnet { /** Exception class thrown by any and every class */ class BadObject : public std::exception { // Object methods public: BadObject( SerializablePtr object, char const* wh ); ~BadObject() throw(); /** What caused the exception. * * \return string describing the error. */ char const* what() const throw(); /** In what object did the exception originate. * * \return RefCounted Serializable-derived object. */ SerializablePtr culprit() const throw(); // Object data private: SerializablePtr m_culprit; char const* m_error; mutable std::string m_formattedError; }; #define LOG_EXCEPTION_E( e ) \ { \ std::cerr << __FILE__ << ":" << __FUNCTION__ << "(" << __LINE__ \ << ") " << e.what() << std::endl; \ } #define LOG_EXCEPTION \ { \ std::cerr << __FILE__ << ":" << __FUNCTION__ << "(" << __LINE__ \ << ") unknown exception!" << std::endl; \ } }// end namespace #endif
[ "peter.liniker+github@gmail.com" ]
peter.liniker+github@gmail.com
11a8487756d505ff9ab1d0dae158797f2e4f4c44
3c9918ea8fe80ca8220d2bac41150b986568519d
/DoubleControl_plugins/Control_plugin.h
ac9532c68a00af8230542793e07242b7cdf7c637
[ "MIT" ]
permissive
1907931256/GUI_EC_PluginSrc
b250ee96bf3270d30d78cbe5a160408b958feda5
9194e67b76f3707f782f1fc17ba6e6dcb712c2a5
refs/heads/master
2022-04-06T12:27:11.070397
2019-12-17T12:14:24
2019-12-17T12:14:24
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,606
h
#ifndef CONTROL_PLUGIN_H #define CONTROL_PLUGIN_H //#include <QGenericPlugin> #include <QObject> #include "EtherCAT_UserApp.h" #include <QObject> #include "My_MotorApp_Callback.h" #include "Form_ControlTab.h" class Control_plugin : public QObject,EtherCAT_UserApp { Q_OBJECT #if QT_VERSION >= 0x050000 Q_PLUGIN_METADATA(IID UserApp_iid FILE "DoubleControl_plugins.json") #endif // QT_VERSION >= 0x050000 Q_INTERFACES(EtherCAT_UserApp) public: Control_plugin(QObject *parent = 0); virtual bool Init_Cores(); virtual bool Destroy_Cores(); virtual ~Control_plugin(); virtual bool Init_Object(); virtual EtherCAT_UserApp *get_NewAppPtr(QObject *parent = nullptr); private: Form_ControlTab *user_form_controlTab; My_MotorApp_Callback *m_motorApp_callback;//Ethercat应用回调 EtherCAT_Message *m_messageObj; QQueue<Gcode_segment> *m_GcodeSegment_Q; GcodeParser *gp_t; QString m_GcodePath; QString m_GcodePath_full; QThread *GcodeSendThread; bool controlTab_isTheta_display; bool controlTab_isLoadFileSafe;//也就是读取文件的时候,从站恢复到init状态 QString m_settingPath; int m_SlaveChoose_indexLast; int Gcode_load(QString &fileName); void Set_BottomMessage(QString message); void Set_StatusMessage(QString message, int interval); void Set_MasterStop(); protected: int Load_setting(const QString &path); int Save_setting(const QString &path); signals: // void StatusMessage_change(QString message,int interval);//状态栏信息 // void BottomMessage_change(QString message);//bottom Text message // void MasterStop_Signal();//stop master public slots: private slots: void Control_OpenGcode_clicked(); void Control_ReloadGcode_clicked(); void Control_SendGcode_clicked(); void MotorCallback_GcodeLineChange(int line); void MotorCallback_GcodePositionChange(QVector3D pos); void MotorCallback_GcodeThetaChange(QVector3D theta); void ControlTab_checkThetaDis_stateChange(int arg); void ControlTab_checkModeCalibrate_stateChange(int arg); void ControlTab_checkLoadFileSafe_stateChange(int arg); void ControlTab_jog_clicked(int button); void ControlTab_MasterIndex_currentIndexChanged(int index); void MotorCallback_MasterQuit_sig(bool isQuit); void MotorCallback_MasterScan_sig(); void ControlTab_keyPressEvent(QKeyEvent *event); void MotorCallback_BottomMsgChange_sig(QString message); }; #endif // USERAPP_PLUGIN_H
[ "liucongjunch@gmail.com" ]
liucongjunch@gmail.com
e4ffcae22b44efccf80fb28c8403103e44179a38
d44026a7e3386e8f94de39e766220fdf2a6acaa2
/Data Structures/Linked Lists/P02-Insert-A-Node-At-The-Tail-Of-A-Linked-List.cpp
ff6cfefc908e0b074df68fc8908807b560908ad3
[]
no_license
velamen2009/HackerRank
23a4ebf3c6aeffed23bfe7ba2565ddcd4134e1a7
2825cbe6b1305c5bcf0475d2a9bf33befb493581
refs/heads/master
2020-04-06T03:58:17.207289
2017-04-07T22:49:15
2017-04-07T22:49:15
83,093,511
0
0
null
null
null
null
UTF-8
C++
false
false
529
cpp
/* Insert Node at the end of a linked list head pointer input could be NULL as well for empty list Node is defined as struct Node { int data; struct Node *next; } */ Node* Insert(Node *head,int data) { // Complete this method if(NULL == head){ head = new Node(); head->data = data; return head; } Node* p = head; while(p->next){ p = p->next; } Node* q = new Node(); q->data = data; p->next = q; return head; }
[ "2565570621@qq.com" ]
2565570621@qq.com
134fa373803f8eb63df48bf1ec8a9eb601dc22c1
f71393bb1c0f9a928684529680c3390742f46f86
/SGFileGDB/GDBGeometry.cpp
5951e1ab2bb12079c76e74501657c6fd71ceaec4
[]
no_license
SupergeoTek/Open-File-Geodatabase-in-SuperGIS
0f6c8d15d941bb8a67e73247b351a1a8964dee1c
d2e8004c44cd7074f51837cd2c4d63bbe8d6fa81
refs/heads/master
2020-03-23T04:32:54.999242
2018-07-16T05:23:11
2018-07-16T05:23:11
141,089,958
0
0
null
null
null
null
BIG5
C++
false
false
55,663
cpp
#include "stdafx.h" #include "GDBGeometry.h" #define SHPP_TRISTRIP 0 #define SHPP_TRIFAN 1 #define SHPP_OUTERRING 2 #define SHPP_INNERRING 3 #define SHPP_FIRSTRING 4 #define SHPP_RING 5 #define SHPP_TRIANGLES 6 void setWKBLineString(WKBLineString* geom, int ptn, double* pXY, double* pZ, double* pM) { geom->lineString.numPoints = ptn; double* pDest = (double*)(geom->lineString.points); for (int i = 0; i < ptn; i++) { memcpy(pDest, pXY, 16); pDest += 2; pXY += 2; if (pZ) { memcpy(pDest, pZ, 8); pDest++; pZ++; } if (pM) { memcpy(pDest, pM, 8); pDest++; pM++; } } } void setWKBPolygon(WKBPolygon* geom, int ptn, double* pXY, double* pZ, double* pM, bool bClose) { geom->numRings = 1; geom->rings[0].numPoints = ptn; double* pDest = (double*)(geom->rings[0].points); for (int i = 0; i < ptn; i++) { //TRACE("%d/%d=%.2f, %.2f\n", i, ptn, pXY[0], pXY[1]); memcpy(pDest, pXY, 16); pDest += 2; pXY += 2; if (pZ) { memcpy(pDest, pZ, 8); pDest++; pZ++; } if (pM) { memcpy(pDest, pM, 8); pDest++; pM++; } } if (bClose) { double* pt0=(double*)(geom->rings[0].points); if (memcmp(pt0,(pXY-2),16) != 0) { geom->rings[0].numPoints = ptn + 1; memcpy(pDest, pt0, 16); pDest += 2; pt0 += 2; if (pZ) { memcpy(pDest, pt0, 8); pt0++; pDest++; } if (pM) memcpy(pDest, pt0, 8); } } } void WKBPolygonAddRing(WKBPolygon* geom, int ptn, double* pXY, double* pZ, double* pM) { WKS::WKSLineString* ls = geom->rings; for (int k=0; k<geom->numRings; k++) ls = NextLineString(ls, (pZ!=NULL), (pM!=NULL)); geom->numRings++; ls->numPoints = ptn; double* pDest = (double*)(ls->points); for (int i = 0; i < ptn; i++) { //TRACE("r%d/%d=%.2f, %.2f\n", i,ptn, pXY[0], pXY[1]); memcpy(pDest, pXY, 16); pDest += 2; pXY += 2; if (pZ) { memcpy(pDest, pZ, 8); pDest++; pZ++; } if (pM) { memcpy(pDest, pM, 8); pDest++; pM++; } } double* pt0 = (double*)(ls->points); if (memcmp(pt0, (pXY - 2), 16) != 0) { ls->numPoints = ptn + 1; memcpy(pDest, pt0, 16); pDest += 2; pt0 += 2; if (pZ) { memcpy(pDest, pt0, 8); pt0++; pDest++; } if (pM) memcpy(pDest, pt0, 8); } } VARIANT CreateFromMultiPatch(int nParts, int* pPartStart, int* pPtypes, int n, double* pXY, double* pZ, double* pM) { VARIANT var; var.vt = VT_EMPTY; int sizept = 16; int wtype = 0; if (pZ) { wtype = wkbZ; sizept += 8; } if (pM) { wtype += wkbM; sizept += 8; } int parti, ptn; int n2 = 0; int nPart2 = 0; int nPartType; int nring = 0; bool bNew = false; for (int k = 0; k < nParts; k++) { parti = pPartStart[k]; ptn = (k == (nParts - 1)) ? n - parti : pPartStart[k + 1] - parti; nPartType = pPtypes[k] & 0xf; if (nPartType == SHPP_OUTERRING || nPartType == SHPP_INNERRING || nPartType == SHPP_FIRSTRING || nPartType == SHPP_RING) { if ((nPartType == SHPP_OUTERRING || nPartType == SHPP_FIRSTRING)) { nPart2++; nring--; //if (nring < 0) // TRACE("r nring<0, %d\n", k); } n2 += (ptn+1); //closeRings bNew = true; nring++; } else { if (bNew) { nPart2++; bNew = false; } if (nPartType == SHPP_TRISTRIP || nPartType == SHPP_TRIFAN) { nPart2 += (ptn - 2); n2 += (4 * (ptn - 2)); } else if (nPartType == SHPP_TRIANGLES) { for (int i = 0; i < ptn - 2; i += 3) { nPart2++; n2 += 4; } } } } var.parray = SafeArrayCreateVector(VT_UI1, 0, sizeof(WKBGeometryCollection) + nPart2*sizeof(WKBPolygon)+ nring*4 + n2*sizept); if (var.parray == NULL) return var; var.vt = VT_ARRAY | VT_UI1; WKBGeometryCollection *geom; SafeArrayAccessData(var.parray, (void**)&geom); geom->byteOrder = wkbNDR; geom->wkbType = wkbMultiPolygon + wtype; geom->num_wkbGeometries = 0; // nPart2; double* pXY2 = pXY; double* pZ2 = pZ; double* pM2 = pM; double* pXY3 = pXY; double* pZ3 = pZ; double* pM3 = pM; bNew = false; WKBPolygon* geom2=NULL; WKBGeometry* tgeom = geom->WKBGeometries; tgeom->byteOrder = wkbNDR; tgeom->wkbType = wkbPolygon + wtype; for (int k = 0; k < nParts; k++) { parti = pPartStart[k]; ptn = (k == (nParts - 1)) ? n - parti : pPartStart[k + 1] - parti; pXY2 = pXY + (parti + parti); if (pZ) pZ2 = pZ + parti; if (pM) pM2 = pM + parti; nPartType = pPtypes[k] & 0xf; if (nPartType == SHPP_OUTERRING || nPartType == SHPP_INNERRING || nPartType == SHPP_FIRSTRING || nPartType == SHPP_RING) { if ((nPartType == SHPP_OUTERRING || nPartType == SHPP_FIRSTRING)) { if (geom2) { tgeom = NextGeom(tgeom); geom2 = NULL; } } if (geom2==NULL) { tgeom->byteOrder = wkbNDR; tgeom->wkbType = wkbPolygon + wtype; geom->num_wkbGeometries++; geom2 = (WKBPolygon*)tgeom; geom2->numRings = 0; } bNew = true; WKBPolygonAddRing(geom2, ptn, pXY2, pZ2, pM2); } else { if (bNew) { bNew = false; tgeom = NextGeom(tgeom); } if (nPartType == SHPP_TRISTRIP) { for (int i = 0; i < ptn - 2; i++) { tgeom->byteOrder = wkbNDR; tgeom->wkbType = wkbPolygon + wtype; geom->num_wkbGeometries++; setWKBPolygon((WKBPolygon*)tgeom, 3, pXY2, pZ2, pM2, true); tgeom = NextGeom(tgeom); pXY2 += 2; if (pZ2) pZ2++; if (pM2) pM2++; } } else if (nPartType == SHPP_TRIFAN) { double* pDest; double* p0 = pXY2; double* pZ0 = pZ2; double* pM0 = pM2; pXY2 += 2; if (pZ2) pZ2++; if (pM2) pM2++; for (int i = 0; i < ptn - 2; i++) //0, +1, +2, 0 { tgeom->byteOrder = wkbNDR; tgeom->wkbType = wkbPolygon + wtype; geom->num_wkbGeometries++; geom2 = (WKBPolygon*)tgeom; geom2->numRings = 1; geom2->rings[0].numPoints = 4; pDest = (double*)(geom2->rings[0].points); { memcpy(pDest, p0, 16); pDest += 2; if (pZ2) { memcpy(pDest, pZ0, 8); pDest++; } if (pM2) { memcpy(pDest, pM0, 8); pDest++; } memcpy(pDest, pXY2, 16); pDest += 2; pXY2 += 2; if (pZ2) { memcpy(pDest, pZ2, 8); pDest++; pZ2++; } if (pM2) { memcpy(pDest, pM2, 8); pDest++; pM2++; } memcpy(pDest, pXY2, 16); pDest += 2; if (pZ2) { memcpy(pDest, pZ2, 8); pDest++; } if (pM2) { memcpy(pDest, pM2, 8); pDest++; } memcpy(pDest, p0, 16); pDest += 2; if (pZ2) { memcpy(pDest, pZ0, 8); pDest++; } if (pM2) { memcpy(pDest, pM0, 8); pDest++; } } tgeom = NextGeom(tgeom); } geom2 = NULL; } else if (nPartType == SHPP_TRIANGLES) { for (int i = 0; i < ptn - 2; i += 3) { tgeom->byteOrder = wkbNDR; tgeom->wkbType = wkbPolygon + wtype; geom->num_wkbGeometries++; setWKBPolygon((WKBPolygon*)tgeom, 3, pXY2, pZ2, pM2, true); tgeom = NextGeom(tgeom); pXY2 += 6; if (pZ2) pZ2+=3; if (pM2) pM2+=3; } } } } if (geom->num_wkbGeometries != nPart2) TRACE(" err numwkb=%d, nPart2=%d\n", geom->num_wkbGeometries, nPart2); SafeArrayUnaccessData(var.parray); return var; } VARIANT GDBGeometryToGeometry(BYTE* pBuf, int len, WKS::WKSEnvelope* pBound) { VARIANT var; VariantInit(&var); int nSHPType = pBuf[0]; if (nSHPType == FileGDBAPI::shapeNull) return var; bool bIsExtended = (nSHPType >= FileGDBAPI::shapeGeneralPolyline && nSHPType <= FileGDBAPI::shapeGeneralMultiPatch); bool bHasZ = ( nSHPType == FileGDBAPI::shapePointZ || nSHPType == FileGDBAPI::shapePointZM || nSHPType == FileGDBAPI::shapeMultipointZ || nSHPType == FileGDBAPI::shapeMultipointZM || nSHPType == FileGDBAPI::shapePolygonZ || nSHPType == FileGDBAPI::shapePolygonZM || nSHPType == FileGDBAPI::shapePolylineZ || nSHPType == FileGDBAPI::shapePolylineZM || nSHPType == FileGDBAPI::shapeMultiPatch || nSHPType == FileGDBAPI::shapeMultiPatchM || (bIsExtended && (pBuf[3] & 0x80) != 0)); bool bHasM = ( nSHPType == FileGDBAPI::shapePointM || nSHPType == FileGDBAPI::shapePointZM || nSHPType == FileGDBAPI::shapeMultipointM || nSHPType == FileGDBAPI::shapeMultipointZM || nSHPType == FileGDBAPI::shapePolygonM || nSHPType == FileGDBAPI::shapePolygonZM || nSHPType == FileGDBAPI::shapePolylineM || nSHPType == FileGDBAPI::shapePolylineZM || nSHPType == FileGDBAPI::shapeMultiPatchM || (bIsExtended && (pBuf[3] & 0x40) != 0)); //if (nSHPType > 30) // TRACE("shptype=%d, isext=%d,bz=%d,bm=%d\n", nSHPType, bIsExtended, bHasZ, bHasM); if (nSHPType == FileGDBAPI::shapeGeneralPolyline) nSHPType = FileGDBAPI::shapePolyline; else if (nSHPType == FileGDBAPI::shapeGeneralPolygon) nSHPType = FileGDBAPI::shapePolygon; else if (nSHPType == FileGDBAPI::shapeGeneralPoint) nSHPType = FileGDBAPI::shapePoint; else if (nSHPType == FileGDBAPI::shapeGeneralMultipoint) nSHPType = FileGDBAPI::shapeMultipoint; else if (nSHPType == FileGDBAPI::shapeGeneralMultiPatch) nSHPType = FileGDBAPI::shapeMultiPatch; int sizept = 16; int wtype = 0; if (bHasZ) { wtype = wkbZ; sizept += 8; } if (bHasM) { wtype += wkbM; sizept += 8; } if (nSHPType == FileGDBAPI::shapePoint || nSHPType == FileGDBAPI::shapePointZ || nSHPType == FileGDBAPI::shapePointM || nSHPType == FileGDBAPI::shapePointZM) { if (pBound) { pBound->xMin = *(double*)(pBuf + 4); pBound->yMin = *(double*)(pBuf + 12); pBound->xMax = pBound->xMin; pBound->yMax = pBound->yMin; var.vt = VT_I4; var.lVal = 1; } else { var.vt = VT_ARRAY | VT_UI1; var.parray = SafeArrayCreateVector(VT_UI1, 0, sizeof(WKBGeometry)+ sizept); WKBPoint *geom; SafeArrayAccessData(var.parray, (void**)&geom); geom->byteOrder = wkbNDR; geom->wkbType = wkbPoint+wtype; memcpy(&geom->point, pBuf + 4, sizept); SafeArrayUnaccessData(var.parray); } } else if (nSHPType == FileGDBAPI::shapeMultipoint || nSHPType == FileGDBAPI::shapeMultipointM || nSHPType == FileGDBAPI::shapeMultipointZ || nSHPType == FileGDBAPI::shapeMultipointZM) { int n = *(int*)(pBuf + 36); if (pBound) { double v; pBound->xMin = *(double*)(pBuf + 40); pBound->yMin = *(double*)(pBuf + 48); pBound->xMax = pBound->xMin; pBound->yMax = pBound->yMin; pBuf += 56; for (int i = 1; i < n; i++) { v = *(double*)pBuf; if (v < pBound->xMin) pBound->xMin = v; else if (v > pBound->xMax) pBound->xMax = v; v = *(double*)(pBuf+8); if (v < pBound->yMin) pBound->yMin = v; else if (v > pBound->yMax) pBound->yMax = v; pBuf += 16; } var.vt = VT_I4; var.lVal = 1; } else { var.vt = VT_ARRAY | VT_UI1; var.parray = SafeArrayCreateVector(VT_UI1, 0, sizeof(WKBGeometryCollection) +(n-1)*(sizept+sizeof(WKBGeometry))+sizept); WKBGeometryCollection *geom; SafeArrayAccessData(var.parray, (void**)&geom); geom->byteOrder = wkbNDR; geom->wkbType = wkbMultiPoint+wtype; geom->num_wkbGeometries = n; WKBPoint* ptgeom; WKBGeometry* tgeom=geom->WKBGeometries; BYTE* pSrc = pBuf + 40; BYTE* pZ = pSrc + 16 + 16*n; BYTE* pM = (bHasZ) ? (pZ + 16 + 8*n) : pZ; BYTE* pDest; for (int i = 0; i < n; i++) { ptgeom = (WKBPoint*)tgeom; ptgeom->byteOrder = wkbNDR; ptgeom->wkbType = wkbPoint+wtype; pDest = (BYTE*)&(ptgeom->point); memcpy(pDest, pSrc, 16); pDest += 16; if (bHasZ) { memcpy(pDest, pZ, 8) ; pZ += 8; pDest += 8; } if (bHasM) { memcpy(pDest, pM, 8); pM += 8; pDest += 8; } pSrc += 16; tgeom = NextGeom(tgeom); } SafeArrayUnaccessData(var.parray); } } else { int nParts = *(int*)(pBuf + 36); int n= *(int*)(pBuf + 40); if (nParts < 0 || n < 0 || len<44) return var; int nSize = 44 + 4 * nParts + 16 * n; if (bHasZ) nSize += (16 + 8 * n); if (bHasM) nSize += (16 + 8 * n); int nOffset = 44 + 4 * nParts; int* pPtypes=NULL; bool bIsMultiPatch = (nSHPType == FileGDBAPI::shapeMultiPatch || nSHPType == FileGDBAPI::shapeMultiPatchM); if (bIsMultiPatch) { nSize += (4 * nParts); pPtypes = (int*)(pBuf+nOffset); nOffset += (4 * nParts); //PartType[] } //if (nSize != len) // TRACE("err len=%d, nSize=%d, nParts=%d, points=%d\n", len, nSize, nParts, n); if (nSize > len) return var; int parti; int* pPartStart = (int*)(pBuf + 44); for (int k = 0; k < nParts; k++) { parti = pPartStart[k]; if (parti < 0 || parti >= n) return var; if (k > 0 && parti <= pPartStart[k - 1]) return var; } if (pBound) { double v; pBound->xMin = *(double*)(pBuf + nOffset); pBound->yMin = *(double*)(pBuf + nOffset + 8); pBound->xMax = pBound->xMin; pBound->yMax = pBound->yMin; pBuf += nOffset + 16; for (int i = 1; i < n; i++) { v = *(double*)pBuf; if (v < pBound->xMin) pBound->xMin = v; else if (v > pBound->xMax) pBound->xMax = v; v = *(double*)(pBuf + 8); if (v < pBound->yMin) pBound->yMin = v; else if (v > pBound->yMax) pBound->yMax = v; pBuf += 16; } var.vt = VT_I4; var.lVal = 1; } else { int ptn; int offi = 16*n; double* pXY= (double*)(pBuf + nOffset); double* pZ = NULL; double* pM = NULL; if (bHasZ) { pZ = (double*)(pBuf + nOffset + 16 + offi); offi += (8*n); } if (bHasM) pM = (double*)(pBuf + nOffset + 16 + offi); var.vt = VT_ARRAY | VT_UI1; if (nSHPType == FileGDBAPI::shapePolyline || nSHPType == FileGDBAPI::shapePolylineZ || nSHPType == FileGDBAPI::shapePolylineM || nSHPType == FileGDBAPI::shapePolylineZM) { if (nParts <= 1) { var.parray = SafeArrayCreateVector(VT_UI1, 0, sizeof(WKBLineString) - 16 + n*sizept); WKBLineString *geom; SafeArrayAccessData(var.parray, (void**)&geom); geom->byteOrder = wkbNDR; geom->wkbType = wkbLineString + wtype; setWKBLineString(geom, n, pXY, pZ, pM); } else { var.parray = SafeArrayCreateVector(VT_UI1, 0, sizeof(WKBGeometryCollection)-sizeof(WKBGeometry) + nParts*(sizeof(WKBLineString)-16)+ n*sizept); WKBGeometryCollection *geom; SafeArrayAccessData(var.parray, (void**)&geom); geom->byteOrder = wkbNDR; geom->wkbType = wkbMultiLineString + wtype; geom->num_wkbGeometries = nParts; double* pXY2=pXY; double* pZ2 = pZ; double* pM2 = pM; WKBGeometry* tgeom = geom->WKBGeometries; for (int k = 0; k < nParts; k++) { parti = pPartStart[k]; ptn = (k == (nParts - 1)) ? n - parti : pPartStart[k + 1] - parti; tgeom->byteOrder = wkbNDR; tgeom->wkbType = wkbLineString + wtype; pXY2 = pXY + (parti+parti); if (pZ) pZ2 = pZ + parti; if (pM) pM2 = pM + parti; setWKBLineString((WKBLineString*)tgeom, ptn, pXY2, pZ2, pM2); tgeom = NextGeom(tgeom); } } SafeArrayUnaccessData(var.parray); } else if (nSHPType == FileGDBAPI::shapePolygon || nSHPType == FileGDBAPI::shapePolygonZ || nSHPType == FileGDBAPI::shapePolygonM || nSHPType == FileGDBAPI::shapePolygonZM) { if (nParts <= 1) { if (nParts == 1) { n -= pPartStart[0]; pXY += (pPartStart[0]+ pPartStart[0]); if (pZ) pZ += pPartStart[0]; if (pM) pM += pPartStart[0]; } var.parray = SafeArrayCreateVector(VT_UI1, 0, sizeof(WKBPolygon) - 16 + n*sizept); WKBPolygon *geom; SafeArrayAccessData(var.parray, (void**)&geom); geom->byteOrder = wkbNDR; geom->wkbType = wkbPolygon + wtype; setWKBPolygon(geom, n, pXY, pZ, pM, false); } else { var.parray = SafeArrayCreateVector(VT_UI1, 0, sizeof(WKBPolygon)+ nParts*4 + n*sizept); //var.parray = SafeArrayCreateVector(VT_UI1, 0, sizeof(WKBGeometryCollection) - sizeof(WKBGeometry) + nParts*(sizeof(WKBPolygon) - 16) + n*sizept); //WKBGeometryCollection *geom; WKBPolygon *geom; SafeArrayAccessData(var.parray, (void**)&geom); geom->byteOrder = wkbNDR; geom->wkbType = wkbPolygon + wtype; //wkbMultiPolygon + wtype; //geom->num_wkbGeometries = nParts; geom->numRings = 0; //nParts; WKS::WKSLineString* lr = geom->rings; double* pXY2 = pXY; double* pZ2 = pZ; double* pM2 = pM; //WKBGeometry* tgeom = geom->WKBGeometries; for (int k = 0; k < nParts; k++) { parti = pPartStart[k]; ptn = (k == (nParts - 1)) ? n - parti : pPartStart[k + 1] - parti; //tgeom->byteOrder = wkbNDR; //tgeom->wkbType = wkbPolygon + wtype; pXY2 = pXY + (parti + parti); if (pZ) pZ2 = pZ + parti; if (pM) pM2 = pM + parti; //setWKBPolygon((WKBPolygon*)tgeom, ptn, pXY2, pZ2, pM2, false); //tgeom = NextGeom(tgeom); WKBPolygonAddRing(geom, ptn, pXY2, pZ2, pM2); //lr = NextLineString(lr, (pZ ? true : false), (pM?true:false)); } } SafeArrayUnaccessData(var.parray); } else if (bIsMultiPatch) { var = CreateFromMultiPatch(nParts, pPartStart, pPtypes, n, pXY, pZ, pM); } } } return var; } int GeometryToGDB(BYTE* pDataSrc, int nLen, FileGDBAPI::ShapeBuffer* pShape, bool b2Z, bool b2M) { int nShpSize = 4; // All types start with integer type number int nShpZSize = 0; // Z gets tacked onto the end int nPoints = 0; int nParts = 0; if (pDataSrc==NULL || nLen<=4) { if (!pShape->Allocate(4)) return -1; pShape->inUseLength = 4; int zero = FileGDBAPI::shapeNull; memcpy(pShape->shapeBuffer, &zero, nShpSize); return 4; } WKBGeometry* pGeom = (WKBGeometry*)pDataSrc; int wType = pGeom->wkbType % wkbGeometryType::wkbType; int nt= pGeom->wkbType / wkbGeometryType::wkbType; bool bZ = ((nt&1)==1); bool bM = ((nt&2)==2); int sizePt = 16; if (bZ) sizePt+=8; if (bM) sizePt += 8; int n2CoordDims = 2; if (b2Z) n2CoordDims++; if (b2M) n2CoordDims++; int size2Pt = n2CoordDims * 8; bool bSize = false; if (wType == wkbGeometryType::wkbPoint) { nShpSize += size2Pt; bSize = true; } else if (wType == wkbGeometryType::wkbLineString) { WKBLineString *poLine = (WKBLineString*)pGeom; nPoints = poLine->lineString.numPoints; nParts = 1; } else if (wType == wkbGeometryType::wkbPolygon) { WKBPolygon *poPoly = (WKBPolygon*)pGeom; nParts = poPoly->numRings; WKS::WKSLineString* ls = poPoly->rings; for (int i = 0; i < poPoly->numRings; i++) { nPoints += ls->numPoints; ls=NextLineString(ls, bZ, bM); } } else { WKBGeometryCollection *pGC = (WKBGeometryCollection*)pGeom; WKBGeometry* tgeom = pGC->WKBGeometries; nParts = pGC->num_wkbGeometries; if (wType == wkbGeometryType::wkbGeometryCollection) wType = tgeom->wkbType % wkbGeometryType::wkbType; if (wType == wkbGeometryType::wkbMultiPoint) { nPoints = nParts; nShpSize += 16 * n2CoordDims; // xy(z)(m) box nShpSize += 4; // npoints nShpSize += size2Pt * nPoints; // points nShpZSize = 16 + 8 * nPoints; if (bZ) nShpSize += 16; if (bM) nShpSize += 16; bSize = true; } else if (wType == wkbGeometryType::wkbMultiLineString) { WKBLineString *poLine; for (int i = 0; i < pGC->num_wkbGeometries; i++) { poLine = (WKBLineString*)tgeom; nPoints += poLine->lineString.numPoints; tgeom = NextGeom(tgeom); } } else if (wType == wkbGeometryType::wkbMultiPolygon) { nParts = 0; WKBPolygon *poPoly; for (int i = 0; i < pGC->num_wkbGeometries; i++) { poPoly = (WKBPolygon*)tgeom; nParts += poPoly->numRings; WKS::WKSLineString* ls = poPoly->rings; for (int k = 0; k < poPoly->numRings; k++) { nPoints += ls->numPoints; ls = NextLineString(ls, bZ, bM); } tgeom = NextGeom(tgeom); } } } if (!bSize) { nShpSize += 16 * n2CoordDims; // xy(z)(m) box nShpSize += 4; // nparts nShpSize += 4; // npoints nShpSize += 4 * nParts; // parts[nparts] nShpSize += size2Pt * nPoints; // points nShpZSize = 16 + 8 * nPoints; if (bZ) nShpSize += 16; if (bM) nShpSize += 16; } if (!pShape->Allocate(nShpSize)) return -1; pShape->inUseLength = nShpSize; unsigned char *pabyPtr = pShape->shapeBuffer; unsigned char *pabyPtrZ = NULL; unsigned char *pabyPtrM = NULL; memset(pabyPtr, 0, nShpSize); if (b2M) pabyPtrM = pabyPtr + nShpSize - nShpZSize; if (b2Z) { if (b2M) pabyPtrZ = pabyPtrM - nShpZSize; else pabyPtrZ = pabyPtr + nShpSize - nShpZSize; } int nGType = FileGDBAPI::shapeNull; if (wType==wkbPoint) { nGType = (b2Z && b2M) ? FileGDBAPI::shapePointZM : (b2Z) ? FileGDBAPI::shapePointZ : (b2M) ? FileGDBAPI::shapePointM : FileGDBAPI::shapePoint; } else if (wType == wkbMultiPoint) { nGType = (b2Z && b2M) ? FileGDBAPI::shapeMultipointZM : (b2Z) ? FileGDBAPI::shapeMultipointZ : (b2M) ? FileGDBAPI::shapeMultipointM : FileGDBAPI::shapeMultipoint; } else if (wType == wkbLineString || wType== wkbMultiLineString) { nGType = (b2Z && b2M) ? FileGDBAPI::shapePolylineZM : (b2Z) ? FileGDBAPI::shapePolylineZ : (b2M) ? FileGDBAPI::shapePolylineM : //FileGDBAPI::shapeGeneralPolyline; FileGDBAPI::shapePolyline; } else if (wType == wkbPolygon || wType==wkbMultiPolygon) { nGType = (b2Z && b2M) ? FileGDBAPI::shapePolygonZM : (b2Z) ? FileGDBAPI::shapePolygonZ : (b2M) ? FileGDBAPI::shapePolygonM : //FileGDBAPI::shapeGeneralPolygon; FileGDBAPI::shapePolygon; } memcpy(pabyPtr, &nGType, 4); pabyPtr += 4; if (wType == wkbPoint) { WKBPoint *poPoint = (WKBPoint*)pGeom; memcpy(pabyPtr, &poPoint->point, min(sizePt, size2Pt)); return nShpSize; } WKS::WKSEnvelope envelope; envelope.xMin = FLT_MAX; envelope.xMax = -FLT_MAX; envelope.yMin = FLT_MAX; envelope.yMax = -FLT_MAX; BYTE* pabyPtrBounds = pabyPtr; //memcpy(pabyPtr, &(envelope.xMin), 8); //memcpy(pabyPtr + 8, &(envelope.yMin), 8); //memcpy(pabyPtr + 16, &(envelope.xMax), 8); //memcpy(pabyPtr + 24, &(envelope.yMax), 8); pabyPtr += 32; BYTE* pabyPtrZBounds = NULL; double minZ = FLT_MAX; double maxZ = -minZ; if (b2Z) { pabyPtrZBounds = pabyPtrZ; pabyPtrZ += 16; } double v; // Reserve space for the M bounds at the end of the XY buffer BYTE* pabyPtrMBounds = NULL; double dfMinM = FLT_MAX; double dfMaxM = -dfMinM; if (b2M) { pabyPtrMBounds = pabyPtrM; pabyPtrM += 16; } if (wType == wkbGeometryType::wkbLineString) { WKBLineString *poLine = (WKBLineString*)pGeom; memcpy(pabyPtr, &nParts, 4); pabyPtr += 4; memcpy(pabyPtr, &nPoints, 4); pabyPtr += 4; int nPartIndex = 0; memcpy(pabyPtr, &nPartIndex, 4); pabyPtr += 4; // Write in the point data double* pt=(double*)(poLine->lineString.points); for (int i = 0; i < poLine->lineString.numPoints; i++) { memcpy(pabyPtr, pt, 16); pabyPtr += 16; v = *pt; if (v < envelope.xMin) envelope.xMin = v; if (v > envelope.xMax) envelope.xMax = v; v = pt[1]; if (v < envelope.yMin) envelope.yMin = v; if (v > envelope.yMax) envelope.yMax = v; pt += 2; if (bZ) { if (b2Z) { memcpy(pabyPtrZ, pt, 8); pabyPtrZ += 8; v = *pt; if (v < minZ) minZ = v; if (v > maxZ) maxZ = v; } pt++; } if (bM) { if (b2M) { memcpy(pabyPtrM, pt, 8); pabyPtrM += 8; v = *pt; if (v < dfMinM) dfMinM = v; if (v > dfMaxM) dfMaxM = v; } pt++; } } } else if (wType == wkbGeometryType::wkbPolygon) { WKBPolygon *poPoly = (WKBPolygon*)pGeom; memcpy(pabyPtr, &nParts, 4); pabyPtr += 4; memcpy(pabyPtr, &nPoints, 4); pabyPtr += 4; // Just past the partindex[nparts] array unsigned char* pabyPoints = pabyPtr + 4 * nParts; int nPointIndexCount = 0; WKS::WKSLineString* ls = poPoly->rings; double* pt; // Outer ring must be clockwise for (int i = 0; i < poPoly->numRings; i++) { int nRingNumPoints = ls->numPoints; if (nRingNumPoints <= 2) // || !poRing->get_IsClosed()) TRACE("polygon ring point error=%d\n", i); // Write in the part index memcpy(pabyPtr, &nPointIndexCount, 4); pabyPtr += 4; pt = (double*)(ls->points); for (int k = 0; k < nRingNumPoints; k++) { memcpy(pabyPoints, pt, 16); pabyPoints += 16; v = *pt; if (v < envelope.xMin) envelope.xMin = v; if (v > envelope.xMax) envelope.xMax = v; v = pt[1]; if (v < envelope.yMin) envelope.yMin = v; if (v > envelope.yMax) envelope.yMax = v; pt += 2; if (bZ) { if (b2Z) { memcpy(pabyPtrZ, pt, 8); pabyPtrZ += 8; v = *pt; if (v < minZ) minZ = v; if (v > maxZ) maxZ = v; } pt++; } if (bM) { if (b2M) { memcpy(pabyPtrM, pt, 8); pabyPtrM += 8; v = *pt; if (v < dfMinM) dfMinM = v; if (v > dfMaxM) dfMaxM = v; } pt++; } } nPointIndexCount += nRingNumPoints; ls = NextLineString(ls, bZ, bM); } } else if (wType == wkbMultiPoint) { WKBGeometryCollection *pGC = (WKBGeometryCollection*)pGeom; WKBGeometry* tgeom = pGC->WKBGeometries; memcpy(pabyPtr, &nPoints, 4); pabyPtr += 4; double* pt; for (int i = 0; i < pGC->num_wkbGeometries; i++) { pt = (double*)&(((WKBPoint*)tgeom)->point); memcpy(pabyPtr, pt, 16); pabyPtr += 16; v = *pt; if (v < envelope.xMin) envelope.xMin = v; if (v > envelope.xMax) envelope.xMax = v; v = pt[1]; if (v < envelope.yMin) envelope.yMin = v; if (v > envelope.yMax) envelope.yMax = v; pt += 2; if (bZ) { if (b2Z) { memcpy(pabyPtrZ, pt, 8); pabyPtrZ += 8; v = *(pt); if (v < minZ) minZ = v; if (v > maxZ) maxZ = v; } pt++; } if (bM) { if (b2M) { memcpy(pabyPtrM, pt, 8); pabyPtrM += 8; v = *(pt); if (v < dfMinM) dfMinM = v; if (v > dfMaxM) dfMaxM = v; } pt++; } tgeom = NextGeom(tgeom); } } else if (wType == wkbMultiLineString) { WKBGeometryCollection *pGC = (WKBGeometryCollection*)pGeom; WKBGeometry* tgeom = pGC->WKBGeometries; memcpy(pabyPtr, &nParts, 4); pabyPtr += 4; memcpy(pabyPtr, &nPoints, 4); pabyPtr += 4; unsigned char* pabyPoints = pabyPtr + 4 * nParts; int nPointIndexCount = 0; WKBLineString *poLine; for (int i = 0; i < pGC->num_wkbGeometries; i++) { poLine = (WKBLineString*)tgeom; int nLineNumPoints = poLine->lineString.numPoints; memcpy(pabyPtr, &nPointIndexCount, 4); pabyPtr += 4; double* pt = (double*)(poLine->lineString.points); for (int k = 0; k < nLineNumPoints; k++) { memcpy(pabyPoints, pt, 16); pabyPoints += 16; v = *pt; if (v < envelope.xMin) envelope.xMin = v; if (v > envelope.xMax) envelope.xMax = v; v = pt[1]; if (v < envelope.yMin) envelope.yMin = v; if (v > envelope.yMax) envelope.yMax = v; pt += 2; if (bZ) { if (b2Z) { memcpy(pabyPtrZ, pt, 8); pabyPtrZ += 8; v = *(pt); if (v < minZ) minZ = v; if (v > maxZ) maxZ = v; } pt++; } if (bM) { if (b2M) { memcpy(pabyPtrM, pt, 8); pabyPtrM += 8; v = *(pt); if (v < dfMinM) dfMinM = v; if (v > dfMaxM) dfMaxM = v; } pt++; } } nPointIndexCount += nLineNumPoints; tgeom = NextGeom(tgeom); } } else // if ( nOGRType == wkbMultiPolygon ) { WKBGeometryCollection *pGC = (WKBGeometryCollection*)pGeom; WKBGeometry* tgeom = pGC->WKBGeometries; memcpy(pabyPtr, &nParts, 4); pabyPtr += 4; memcpy(pabyPtr, &nPoints, 4); pabyPtr += 4; unsigned char* pabyPoints = pabyPtr + 4 * nParts; int nPointIndexCount = 0; WKBPolygon *poPoly; for (int i = 0; i < pGC->num_wkbGeometries; i++) { poPoly = (WKBPolygon*)tgeom; WKS::WKSLineString* ls = poPoly->rings; double* pt; for (int j = 0; j < poPoly->numRings; j++) { int nRingNumPoints = ls->numPoints; memcpy(pabyPtr, &nPointIndexCount, 4); pabyPtr += 4; pt = (double*)(ls->points); for (int k = 0; k < nRingNumPoints; k++) { memcpy(pabyPoints, pt, 16); pabyPoints += 16; v = *pt; if (v < envelope.xMin) envelope.xMin = v; if (v > envelope.xMax) envelope.xMax = v; v = pt[1]; if (v < envelope.yMin) envelope.yMin = v; if (v > envelope.yMax) envelope.yMax = v; pt += 2; if (bZ) { if (b2Z) { memcpy(pabyPtrZ, pt, 8); pabyPtrZ += 8; v = *(pt); if (v < minZ) minZ = v; if (v > maxZ) maxZ = v; } pt++; } if (bM) { if (b2M) { memcpy(pabyPtrM, pt, 8); pabyPtrM += 8; v = *(pt); if (v < dfMinM) dfMinM = v; if (v > dfMaxM) dfMaxM = v; } pt++; } } nPointIndexCount += nRingNumPoints; ls = NextLineString(ls, bZ, bM); } tgeom = NextGeom(tgeom); } } if (envelope.xMin > envelope.xMax) { memset(&envelope, 0, sizeof(WKS::WKSEnvelope)); } memcpy(pabyPtrBounds, &envelope, 32); if (b2Z && bZ) { if (minZ > maxZ) { minZ = 0.0; maxZ = 0.0; } memcpy(pabyPtrZBounds, &(minZ), 8); memcpy(pabyPtrZBounds + 8, &(maxZ), 8); } if (b2M && bM) { if (dfMinM > dfMaxM) { dfMinM = 0.0; dfMaxM = 0.0; } memcpy(pabyPtrMBounds, &(dfMinM), 8); memcpy(pabyPtrMBounds + 8, &(dfMaxM), 8); } return nShpSize; } int GeometryToGDBMultiPatch(BYTE* pDataSrc, int nLen, FileGDBAPI::ShapeBuffer* pShape, bool b2Z, bool b2M) { WKBGeometry* pGeom = (WKBGeometry*)pDataSrc; int wType = pGeom->wkbType % wkbGeometryType::wkbType; int nt = pGeom->wkbType / wkbGeometryType::wkbType; bool bZ = ((nt & 1) == 1); bool bM = ((nt & 2) == 2); int nCoordDims = 2; if (bZ) nCoordDims++; if (bM) nCoordDims++; int sizePt = nCoordDims * 8; //目前一律為Z的 b2Z = true; b2M = false; int n2CoordDims = 2; if (b2Z) n2CoordDims++; if (b2M) n2CoordDims++; int size2Pt = n2CoordDims * 8; WKBGeometryCollection *pGC = (WKBGeometryCollection*)pGeom; WKBGeometry* tgeom; if (wType == wkbGeometryType::wkbGeometryCollection) { tgeom = pGC->WKBGeometries; wType = tgeom->wkbType % wkbGeometryType::wkbType; } if (wType != wkbGeometryType::wkbMultiPolygon && wType!= wkbGeometryType::wkbPolygon) return -1; int nParts = 0; int* panPartStart = NULL; int* panPartType = NULL; int nPoints = 0; WKS::tagWKSPoint* poPoints = NULL; double* padfZ = NULL; int nBeginLastPart = 0; double* pt; int lastPartStart = 0 ; int lastPartType = -1; WKS::tagWKSPointZ beginLastpt; WKS::tagWKSPointZ lastpt; WKS::tagWKSPointZ lastpt2; memset(&beginLastpt,0,sizeof(WKS::tagWKSPointZ)); memset(&lastpt, 0, sizeof(WKS::tagWKSPointZ)); memset(&lastpt2, 0, sizeof(WKS::tagWKSPointZ)); WKS::tagWKSPointZ ptz[4]; memset(ptz, 0, sizeof(WKS::tagWKSPointZ) * 4); WKBPolygon *poPoly; tgeom = pGC->WKBGeometries; for (int j = 0; j < pGC->num_wkbGeometries; j++) { poPoly = (WKBPolygon*)tgeom; int nRings = poPoly->numRings; WKS::WKSLineString* ls = poPoly->rings; if (nRings == 1 && ls->numPoints == 4) { pt = (double*)ls->points; for (int i = 0; i < 4; i++) { memcpy(ptz+i, pt, 16); if (bZ) ptz[i].z = pt[2]; pt += nCoordDims; } if (nParts > 0 && ((lastPartType == SHPP_TRIANGLES && nPoints - lastPartStart == 3) || lastPartType == SHPP_TRIFAN) && memcmp(ptz, &beginLastpt, 24)==0 && memcmp(ptz+1, &lastpt, 24) == 0) { lastPartType = SHPP_TRIFAN; lastpt2 = lastpt; lastpt = ptz[2]; nPoints++; } else if (nParts > 0 && ((lastPartType == SHPP_TRIANGLES && nPoints - lastPartStart == 3) || lastPartType == SHPP_TRISTRIP) && (memcmp(ptz, &lastpt2, 24) == 0) && (memcmp(ptz + 1, &lastpt, 24) == 0)) { lastPartType = SHPP_TRISTRIP; lastpt2 = lastpt; lastpt = ptz[2]; nPoints++; } else { if (nParts == 0 || lastPartType != SHPP_TRIANGLES) { nBeginLastPart = nPoints; lastPartStart = nPoints; lastPartType = SHPP_TRIANGLES; nParts++; } lastpt2 = lastpt; //pt=NextPoint(pt, 2, bZ, bM); lastpt = ptz[2]; nPoints += 3; } } else { panPartStart = new int[(nParts + nRings)]; panPartType = new int[(nParts + nRings)]; for (int i = 0; i < nRings; i++) { lastPartStart = nPoints; if (i == 0) lastPartType = SHPP_OUTERRING; else lastPartType = SHPP_INNERRING; pt = (double*)ls->points; pt += (sizePt*(ls->numPoints-1)); lastpt2 = lastpt; lastpt.x = pt[0]; lastpt.y = pt[1]; lastpt.z = (bZ)? pt[2] : 0; nPoints += ls->numPoints; ls = NextLineString(ls, bZ, bM); } nParts += nRings; } tgeom = NextGeom(tgeom); } int nShpSize = 4; // All types start with integer type number nShpSize += 16 * 2; // xy bbox nShpSize += 4; // nparts nShpSize += 4; // npoints nShpSize += 4 * nParts; // panPartStart[nparts] nShpSize += 4 * nParts; // panPartType[nparts] nShpSize += 8 * 2 * nPoints; // xy points nShpSize += 16; // z bbox nShpSize += 8 * nPoints; // z points if (!pShape->Allocate(nShpSize)) return -1; pShape->inUseLength = nShpSize; BYTE* pabyPtr = pShape->shapeBuffer; memset(pabyPtr, 0, nShpSize); int nGType = (b2M) ? FileGDBAPI::shapeMultiPatchM : FileGDBAPI::shapeMultiPatch; memcpy(pabyPtr, &nGType, 4); pabyPtr += 4; WKS::WKSEnvelope envelope; envelope.xMin = FLT_MAX; envelope.xMax = -FLT_MAX; envelope.yMin = FLT_MAX; envelope.yMax = -FLT_MAX; double minZ = FLT_MAX; double maxZ = -minZ; BYTE* pabyPtrBounds = pabyPtr; pabyPtr += 32; memcpy(pabyPtr, &nParts, 4); pabyPtr += 4; memcpy(pabyPtr, &nPoints, 4); pabyPtr += 4; panPartStart = (int*)pabyPtr; pabyPtr += (4*nParts); panPartType = (int*)pabyPtr; pabyPtr += (4 * nParts); poPoints = (WKS::tagWKSPoint*)pabyPtr; pabyPtr += (2 * 8 * nPoints); BYTE* pZBounds = pabyPtr; pabyPtr += 16; padfZ = (double*)pabyPtr; nParts = 0; nPoints = 0; nBeginLastPart = 0; tgeom = pGC->WKBGeometries; for (int j = 0; j < pGC->num_wkbGeometries; j++) { poPoly = (WKBPolygon*)tgeom; int nRings = poPoly->numRings; WKS::WKSLineString* ls = poPoly->rings; if (nRings == 1 && ls->numPoints == 4) { pt = (double*)ls->points; for (int i = 0; i < 3; i++) { memcpy(ptz + i, pt, 16); if (bZ) ptz[i].z = pt[2]; pt += nCoordDims; } if (nParts > 0 && poPoints != NULL && ((panPartType[nParts - 1] == SHPP_TRIANGLES && nPoints - panPartStart[nParts - 1] == 3) || panPartType[nParts - 1] == SHPP_TRIFAN) && ptz[0].x == poPoints[nBeginLastPart].x && ptz[0].y == poPoints[nBeginLastPart].y && ptz[0].z == padfZ[nBeginLastPart] && ptz[1].x == poPoints[nPoints - 1].x && ptz[1].y == poPoints[nPoints - 1].y && ptz[1].z == padfZ[nPoints - 1]) { panPartType[nParts - 1] = SHPP_TRIFAN; poPoints[nPoints].x = ptz[2].x; poPoints[nPoints].y = ptz[2].y; padfZ[nPoints] = ptz[2].z; nPoints++; } else if (nParts > 0 && poPoints != NULL && ((panPartType[nParts - 1] == SHPP_TRIANGLES && nPoints - panPartStart[nParts - 1] == 3) || panPartType[nParts - 1] == SHPP_TRISTRIP) && ptz[0].x == poPoints[nPoints - 2].x && ptz[0].y == poPoints[nPoints - 2].y && ptz[0].z == padfZ[nPoints - 2] && ptz[1].x == poPoints[nPoints - 1].x && ptz[1].y == poPoints[nPoints - 1].y && ptz[1].z == padfZ[nPoints - 1]) { panPartType[nParts - 1] = SHPP_TRISTRIP; poPoints[nPoints].x = ptz[2].x; poPoints[nPoints].y = ptz[2].y; padfZ[nPoints] = ptz[2].z; nPoints++; } else { if (nParts == 0 || panPartType[nParts - 1] != SHPP_TRIANGLES) { nBeginLastPart = nPoints; panPartStart[nParts] = nPoints; panPartType[nParts] = SHPP_TRIANGLES; nParts++; } for (int i = 0; i<3; i++) { poPoints[nPoints + i].x = ptz[i].x; poPoints[nPoints + i].y = ptz[i].y; padfZ[nPoints + i] = ptz[i].z; } nPoints += 3; } } else { for (int i = 0; i < nRings; i++) { panPartStart[nParts + i] = nPoints; if (i == 0) panPartType[nParts + i] = SHPP_OUTERRING; else panPartType[nParts + i] = SHPP_INNERRING; pt = (double*)ls->points; for (int k = 0; k < ls->numPoints; k++) { poPoints[nPoints + k].x = pt[0]; poPoints[nPoints + k].y = pt[1]; if (bZ) padfZ[nPoints + k] = pt[2]; pt += sizePt; } nPoints += ls->numPoints; ls = NextLineString(ls, bZ, bM); } nParts += nRings; } tgeom = NextGeom(tgeom); } if (envelope.xMin <= envelope.xMax) memcpy(pabyPtrBounds, &envelope, 32); if (bZ && (minZ <= maxZ)) { memcpy(pZBounds, &(minZ), 8); memcpy(pZBounds + 8, &(maxZ), 8); } return nShpSize; } /* int GeometryToGDB(BYTE* pDataSrc, int nLen, FileGDBAPI::ShapeBuffer& shape, bool b2Z, bool b2M) { int nShpSize = 4; // All types start with integer type number int nShpZSize = 0; // Z gets tacked onto the end int nPoints = 0; int nParts = 0; if (pDataSrc == NULL || nLen <= 4) { if (!shape.Allocate(4)) return -1; shape.inUseLength = 4; int zero = SHPT_NULL; memcpy(shape.shapeBuffer, &zero, nShpSize); return 4; } WKBGeometry* pGeom = (WKBGeometry*)pDataSrc; int wType = pGeom->wkbType % wkbGeometryType::wkbType; int nt = pGeom->wkbType / wkbGeometryType::wkbType; bool bZ = ((nt & 1) == 1); bool bM = ((nt & 2) == 2); int nCoordDims = 2; if (bZ) nCoordDims++; if (bM) nCoordDims++; int sizePt = nCoordDims * 8; if (wType == wkbGeometryType::wkbPoint) { nShpSize += sizePt; } else if (wType == wkbGeometryType::wkbLineString) { WKBLineString *poLine = (WKBLineString*)pGeom; nPoints = poLine->lineString.numPoints; nParts = 1; nShpSize += 16 * nCoordDims; // xy(z)(m) box nShpSize += 4; // nparts nShpSize += 4; // npoints nShpSize += 4; // parts[1] nShpSize += sizePt * nPoints; // points nShpZSize = 16 + 8 * nPoints; } else if (wType == wkbGeometryType::wkbPolygon) { WKBPolygon *poPoly = (WKBPolygon*)pGeom; nParts = poPoly->numRings; WKS::WKSLineString* ls = poPoly->rings; for (int i = 0; i < nParts; i++) { nPoints += ls->numPoints; ls = NextLineString(ls, bZ, bM); } nShpSize += 16 * nCoordDims; // xy(z)(m) box nShpSize += 4; // nparts nShpSize += 4; // npoints nShpSize += 4 * nParts; // parts[nparts] nShpSize += sizePt * nPoints; // points nShpZSize = 16 + 8 * nPoints; } else { WKBGeometryCollection *pGC = (WKBGeometryCollection*)pGeom; WKBGeometry* tgeom = pGC->WKBGeometries; nParts = pGC->num_wkbGeometries; if (wType == wkbGeometryType::wkbGeometryCollection) wType = tgeom->wkbType % wkbGeometryType::wkbType; if (wType == wkbGeometryType::wkbMultiPoint) { nPoints = nParts; nShpSize += 16 * nCoordDims; // xy(z)(m) box nShpSize += 4; // npoints nShpSize += sizePt * nPoints; // points nShpZSize = 16 + 8 * nPoints; } else if (wType == wkbGeometryType::wkbMultiLineString) { WKBLineString *poLine; for (int i = 0; i < nParts; i++) { poLine = (WKBLineString*)tgeom; nPoints += poLine->lineString.numPoints; tgeom = NextGeom(tgeom); } nShpSize += 16 * nCoordDims; // xy(z)(m) box nShpSize += 4; // nparts nShpSize += 4; // npoints nShpSize += 4 * nParts; // parts[nparts] nShpSize += sizePt * nPoints; // points nShpZSize = 16 + 8 * nPoints; } else if (wType == wkbGeometryType::wkbMultiPolygon) { WKBPolygon *poPoly; for (int i = 0; i < pGC->num_wkbGeometries; i++) { poPoly = (WKBPolygon*)tgeom; nParts += poPoly->numRings; WKS::WKSLineString* ls = poPoly->rings; for (int k = 0; k < nParts; k++) { nPoints += ls->numPoints; ls = NextLineString(ls, bZ, bM); } tgeom = NextGeom(tgeom); } nShpSize += 16 * nCoordDims; // xy(z)(m) box nShpSize += 4; // nparts nShpSize += 4; // npoints nShpSize += 4 * nParts; // parts[nparts] nShpSize += sizePt * nPoints; // points nShpZSize = 16 + 8 * nPoints; } } if (!shape.Allocate(nShpSize)) return -1; shape.inUseLength = nShpSize; unsigned char *pabyPtr = shape.shapeBuffer; unsigned char *pabyPtrZ = NULL; unsigned char *pabyPtrM = NULL; if (bM) pabyPtrM = pabyPtr + nShpSize - nShpZSize; if (bZ) { if (bM) pabyPtrZ = pabyPtrM - nShpZSize; else pabyPtrZ = pabyPtr + nShpSize - nShpZSize; } int nGType = SHPT_NULL; if (wType == wkbPoint) { nGType = (bZ && bM) ? SHPT_POINTZM : (bZ) ? SHPT_POINTZ : (bM) ? SHPT_POINTM : SHPT_POINT; } else if (wType == wkbMultiPoint) { nGType = (bZ && bM) ? SHPT_MULTIPOINTZM : (bZ) ? SHPT_MULTIPOINTZ : (bM) ? SHPT_MULTIPOINTM : SHPT_MULTIPOINT; } else if (wType == wkbLineString || wType == wkbMultiLineString) { nGType = (bZ && bM) ? SHPT_ARCZM : (bZ) ? SHPT_ARCZ : (bM) ? SHPT_ARCM : SHPT_ARC; } else if (wType == wkbPolygon || wType == wkbMultiPolygon) { nGType = (bZ && bM) ? SHPT_POLYGONZM : (bZ) ? SHPT_POLYGONZ : (bM) ? SHPT_POLYGONM : SHPT_POLYGON; } memcpy(pabyPtr, &nGType, 4); pabyPtr += 4; if (wType == wkbPoint) { WKBPoint *poPoint = (WKBPoint*)pGeom; memcpy(pabyPtr, &poPoint->point, sizePt); return nShpSize; } WKS::WKSEnvelope envelope; envelope.xMin = FLT_MAX; envelope.xMax = -FLT_MAX; envelope.yMin = FLT_MAX; envelope.yMax = -FLT_MAX; BYTE* pabyPtrBounds = pabyPtr; //memcpy(pabyPtr, &(envelope.xMin), 8); //memcpy(pabyPtr + 8, &(envelope.yMin), 8); //memcpy(pabyPtr + 16, &(envelope.xMax), 8); //memcpy(pabyPtr + 24, &(envelope.yMax), 8); pabyPtr += 32; BYTE* pabyPtrZBounds = NULL; double minZ = FLT_MAX; double maxZ = -minZ; if (bZ) { pabyPtrZBounds = pabyPtrZ; pabyPtrZ += 16; } double v; // Reserve space for the M bounds at the end of the XY buffer BYTE* pabyPtrMBounds = NULL; double dfMinM = FLT_MAX; double dfMaxM = -dfMinM; if (bM) { pabyPtrMBounds = pabyPtrM; pabyPtrM += 16; } if (wType == wkbGeometryType::wkbLineString) { WKBLineString *poLine = (WKBLineString*)pGeom; memcpy(pabyPtr, &nParts, 4); pabyPtr += 4; memcpy(pabyPtr, &nPoints, 4); pabyPtr += 4; int nPartIndex = 0; memcpy(pabyPtr, &nPartIndex, 4); pabyPtr += 4; // Write in the point data double* pt = (double*)(poLine->lineString.points); for (int i = 0; i < poLine->lineString.numPoints; i++) { memcpy(pabyPtr, pt, 16); pabyPtr += 16; v = *pt; if (v < envelope.xMin) envelope.xMin = v; if (v > envelope.xMax) envelope.xMax = v; v = pt[1]; if (v < envelope.yMin) envelope.yMin = v; if (v > envelope.yMax) envelope.yMax = v; pt += 2; if (bZ) { memcpy(pabyPtrZ, pt, 8); pabyPtrZ += 8; v = *pt; if (v < minZ) minZ = v; if (v > maxZ) maxZ = v; pt++; } if (bM) { memcpy(pabyPtrM, pt, 8); pabyPtrM += 8; v = *pt; if (v < dfMinM) dfMinM = v; if (v > dfMaxM) dfMaxM = v; pt++; } } } else if (wType == wkbGeometryType::wkbPolygon) { WKBPolygon *poPoly = (WKBPolygon*)pGeom; memcpy(pabyPtr, &nParts, 4); pabyPtr += 4; memcpy(pabyPtr, &nPoints, 4); pabyPtr += 4; // Just past the partindex[nparts] array unsigned char* pabyPoints = pabyPtr + 4 * nParts; int nPointIndexCount = 0; WKS::WKSLineString* ls = poPoly->rings; double* pt; // Outer ring must be clockwise for (int i = 0; i < nParts; i++) { int nRingNumPoints = ls->numPoints; if (nRingNumPoints <= 2) // || !poRing->get_IsClosed()) TRACE("polygon ring point error=%d\n", i); // Write in the part index memcpy(pabyPtr, &nPointIndexCount, 4); pabyPtr += 4; for (int k = 0; k < nRingNumPoints; k++) { pt = (double*)(ls->points); memcpy(pabyPoints, pt, 16); pabyPoints += 16; v = *pt; if (v < envelope.xMin) envelope.xMin = v; if (v > envelope.xMax) envelope.xMax = v; v = pt[1]; if (v < envelope.yMin) envelope.yMin = v; if (v > envelope.yMax) envelope.yMax = v; pt += 2; if (bZ) { memcpy(pabyPtrZ, pt, 8); pabyPtrZ += 8; v = *pt; if (v < minZ) minZ = v; if (v > maxZ) maxZ = v; pt++; } if (bM) { memcpy(pabyPtrM, pt, 8); pabyPtrM += 8; v = *pt; if (v < dfMinM) dfMinM = v; if (v > dfMaxM) dfMaxM = v; pt++; } } nPointIndexCount += nRingNumPoints; ls = NextLineString(ls, bZ, bM); } } else if (wType == wkbMultiPoint) { WKBGeometryCollection *pGC = (WKBGeometryCollection*)pGeom; WKBGeometry* tgeom = pGC->WKBGeometries; memcpy(pabyPtr, &nPoints, 4); pabyPtr += 4; double* pt; for (int i = 0; i < nPoints; i++) { pt = (double*)&(((WKBPoint*)tgeom)->point); memcpy(pabyPtr, pt, 16); pabyPtr += 16; v = *pt; if (v < envelope.xMin) envelope.xMin = v; if (v > envelope.xMax) envelope.xMax = v; v = pt[1]; if (v < envelope.yMin) envelope.yMin = v; if (v > envelope.yMax) envelope.yMax = v; pt += 2; if (bZ) { memcpy(pabyPtrZ, pt, 8); pabyPtrZ += 8; v = *(pt); if (v < minZ) minZ = v; if (v > maxZ) maxZ = v; pt++; } if (bM) { memcpy(pabyPtrM, pt, 8); pabyPtrM += 8; v = *(pt); if (v < dfMinM) dfMinM = v; if (v > dfMaxM) dfMaxM = v; pt++; } tgeom = NextGeom(tgeom); } } else if (wType == wkbMultiLineString) { WKBGeometryCollection *pGC = (WKBGeometryCollection*)pGeom; WKBGeometry* tgeom = pGC->WKBGeometries; memcpy(pabyPtr, &nParts, 4); pabyPtr += 4; memcpy(pabyPtr, &nPoints, 4); pabyPtr += 4; unsigned char* pabyPoints = pabyPtr + 4 * nParts; int nPointIndexCount = 0; WKBLineString *poLine; for (int i = 0; i < nParts; i++) { poLine = (WKBLineString*)tgeom; int nLineNumPoints = poLine->lineString.numPoints; memcpy(pabyPtr, &nPointIndexCount, 4); pabyPtr += 4; double* pt = (double*)(poLine->lineString.points); for (int k = 0; k < nLineNumPoints; k++) { memcpy(pabyPoints, pt, 16); pabyPoints += 16; v = *pt; if (v < envelope.xMin) envelope.xMin = v; if (v > envelope.xMax) envelope.xMax = v; v = pt[1]; if (v < envelope.yMin) envelope.yMin = v; if (v > envelope.yMax) envelope.yMax = v; pt += 2; if (bZ) { memcpy(pabyPtrZ, pt, 8); pabyPtrZ += 8; v = *(pt); if (v < minZ) minZ = v; if (v > maxZ) maxZ = v; pt++; } if (bM) { memcpy(pabyPtrM, pt, 8); pabyPtrM += 8; v = *(pt); if (v < dfMinM) dfMinM = v; if (v > dfMaxM) dfMaxM = v; pt++; } } nPointIndexCount += nLineNumPoints; } } else // if ( nOGRType == wkbMultiPolygon ) { WKBGeometryCollection *pGC = (WKBGeometryCollection*)pGeom; WKBGeometry* tgeom = pGC->WKBGeometries; memcpy(pabyPtr, &nParts, 4); pabyPtr += 4; memcpy(pabyPtr, &nPoints, 4); pabyPtr += 4; unsigned char* pabyPoints = pabyPtr + 4 * nParts; int nPointIndexCount = 0; WKBPolygon *poPoly; for (int i = 0; i < pGC->num_wkbGeometries; i++) { poPoly = (WKBPolygon*)pGeom; WKS::WKSLineString* ls = poPoly->rings; double* pt; for (int j = 0; j < poPoly->numRings; j++) { int nRingNumPoints = ls->numPoints; memcpy(pabyPtr, &nPointIndexCount, 4); pabyPtr += 4; for (int k = 0; k < nRingNumPoints; k++) { pt = (double*)(ls->points); memcpy(pabyPoints, pt, 16); pabyPoints += 16; v = *pt; if (v < envelope.xMin) envelope.xMin = v; if (v > envelope.xMax) envelope.xMax = v; v = pt[1]; if (v < envelope.yMin) envelope.yMin = v; if (v > envelope.yMax) envelope.yMax = v; pt += 2; if (bZ) { memcpy(pabyPtrZ, pt, 8); pabyPtrZ += 8; v = *(pt); if (v < minZ) minZ = v; if (v > maxZ) maxZ = v; pt++; } if (bM) { memcpy(pabyPtrM, pt, 8); pabyPtrM += 8; v = *(pt); if (v < dfMinM) dfMinM = v; if (v > dfMaxM) dfMaxM = v; pt++; } } nPointIndexCount += nRingNumPoints; } } } if (envelope.xMin > envelope.xMax) { memset(&envelope, 0, sizeof(WKS::WKSEnvelope)); } memcpy(pabyPtrBounds, &envelope, 32); if (bZ) { if (minZ > maxZ) { minZ = 0.0; maxZ = 0.0; } memcpy(pabyPtrZBounds, &(minZ), 8); memcpy(pabyPtrZBounds + 8, &(maxZ), 8); } if (bM) { if (dfMinM > dfMaxM) { dfMinM = 0.0; dfMaxM = 0.0; } memcpy(pabyPtrMBounds, &(dfMinM), 8); memcpy(pabyPtrMBounds + 8, &(dfMaxM), 8); } return nShpSize; } int GeometryToGDBMultiPatch(BYTE* pDataSrc, int nLen, FileGDBAPI::ShapeBuffer& shape, bool b2Z, bool b2M) { WKBGeometry* pGeom = (WKBGeometry*)pDataSrc; int wType = pGeom->wkbType % wkbGeometryType::wkbType; int nt = pGeom->wkbType / wkbGeometryType::wkbType; bool bZ = ((nt & 1) == 1); bool bM = ((nt & 2) == 2); int nCoordDims = 2; if (bZ) nCoordDims++; if (bM) nCoordDims++; WKBGeometryCollection *pGC = (WKBGeometryCollection*)pGeom; WKBGeometry* tgeom; int sizePt = nCoordDims * 8; if (wType == wkbGeometryType::wkbGeometryCollection) { tgeom = pGC->WKBGeometries; wType = tgeom->wkbType % wkbGeometryType::wkbType; } if (wType != wkbGeometryType::wkbMultiPolygon && wType != wkbGeometryType::wkbPolygon) return -1; int nParts = 0; int* panPartStart = NULL; int* panPartType = NULL; int nPoints = 0; WKS::tagWKSPoint* poPoints = NULL; double* padfZ = NULL; int nBeginLastPart = 0; double* pt; int lastPartStart = 0; int lastPartType = -1; WKS::tagWKSPointZ beginLastpt; WKS::tagWKSPointZ lastpt; WKS::tagWKSPointZ lastpt2; memset(&beginLastpt, 0, sizeof(WKS::tagWKSPointZ)); memset(&lastpt, 0, sizeof(WKS::tagWKSPointZ)); memset(&lastpt2, 0, sizeof(WKS::tagWKSPointZ)); WKBPolygon *poPoly; tgeom = pGC->WKBGeometries; for (int j = 0; j < pGC->num_wkbGeometries; j++) { poPoly = (WKBPolygon*)tgeom; int nRings = poPoly->numRings; WKS::WKSLineString* ls = poPoly->rings; pt = (double*)ls->points; if (nRings == 1 && ls->numPoints == 4) { if (nParts > 0 && ((lastPartType == SHPP_TRIANGLES && nPoints - lastPartStart == 3) || lastPartType == SHPP_TRIFAN) && pt[0] == beginLastpt.x && pt[1] == beginLastpt.y && pt[2] == beginLastpt.z && pt[3] == lastpt.x && pt[4] == lastpt.y && pt[5] == lastpt.z) { lastPartType = SHPP_TRIFAN; lastpt2 = lastpt; lastpt.x = pt[6]; lastpt.y = pt[7]; lastpt.z = pt[8]; nPoints++; } else if (nParts > 0 && ((lastPartType == SHPP_TRIANGLES && nPoints - lastPartStart == 3) || lastPartType == SHPP_TRISTRIP) && pt[0] == lastpt2.x && pt[1] == lastpt2.y && pt[2] == lastpt2.z && pt[3] == lastpt.x && pt[4] == lastpt.y && pt[5] == lastpt.z) { lastPartType = SHPP_TRISTRIP; lastpt2 = lastpt; lastpt.x = pt[6]; lastpt.y = pt[7]; lastpt.z = pt[8]; nPoints++; } else { if (nParts == 0 || lastPartType != SHPP_TRIANGLES) { nBeginLastPart = nPoints; lastPartStart = nPoints; lastPartType = SHPP_TRIANGLES; nParts++; } lastpt2 = lastpt; //pt=NextPoint(pt, 2, bZ, bM); lastpt.x = pt[6]; lastpt.y = pt[7]; lastpt.z = pt[8]; nPoints += 3; } } else { panPartStart = new int[(nParts + nRings)]; panPartType = new int[(nParts + nRings)]; for (int i = 0; i < nRings; i++) { lastPartStart = nPoints; if (i == 0) lastPartType = SHPP_OUTERRING; else lastPartType = SHPP_INNERRING; pt = (double*)ls->points; pt += (3 * (ls->numPoints - 1)); lastpt2 = lastpt; lastpt.x = pt[0]; lastpt.y = pt[1]; lastpt.z = pt[2]; nPoints += ls->numPoints; ls = NextLineString(ls, bZ, bM); } nParts += nRings; } tgeom = NextGeom(tgeom); } int nShpSize = 4; // All types start with integer type number nShpSize += 16 * 2; // xy bbox nShpSize += 4; // nparts nShpSize += 4; // npoints nShpSize += 4 * nParts; // panPartStart[nparts] nShpSize += 4 * nParts; // panPartType[nparts] nShpSize += 8 * 2 * nPoints; // xy points nShpSize += 16; // z bbox nShpSize += 8 * nPoints; // z points if (!shape.Allocate(nShpSize)) return -1; BYTE* pabyPtr = shape.shapeBuffer; memset(pabyPtr, 0, nShpSize); int nGType = SHPT_MULTIPATCH; memcpy(pabyPtr, &nGType, 4); pabyPtr += 4; WKS::WKSEnvelope envelope; envelope.xMin = FLT_MAX; envelope.xMax = -FLT_MAX; envelope.yMin = FLT_MAX; envelope.yMax = -FLT_MAX; double minZ = FLT_MAX; double maxZ = -minZ; BYTE* pabyPtrBounds = pabyPtr; pabyPtr += 32; memcpy(pabyPtr, &nParts, 4); pabyPtr += 4; memcpy(pabyPtr, &nPoints, 4); pabyPtr += 4; panPartStart = (int*)pabyPtr; pabyPtr += (4 * nParts); panPartType = (int*)pabyPtr; pabyPtr += (4 * nParts); poPoints = (WKS::tagWKSPoint*)pabyPtr; pabyPtr += (2 * 8 * nPoints); BYTE* pZBounds = pabyPtr; pabyPtr += 16; padfZ = (double*)pabyPtr; nParts = 0; nPoints = 0; nBeginLastPart = 0; tgeom = pGC->WKBGeometries; for (int j = 0; j < pGC->num_wkbGeometries; j++) { poPoly = (WKBPolygon*)tgeom; int nRings = poPoly->numRings; WKS::WKSLineString* ls = poPoly->rings; pt = (double*)ls->points; if (nRings == 1 && ls->numPoints == 4) { if (nParts > 0 && poPoints != NULL && ((panPartType[nParts - 1] == SHPP_TRIANGLES && nPoints - panPartStart[nParts - 1] == 3) || panPartType[nParts - 1] == SHPP_TRIFAN) && pt[0] == poPoints[nBeginLastPart].x && pt[1] == poPoints[nBeginLastPart].y && pt[2] == padfZ[nBeginLastPart] && pt[3] == poPoints[nPoints - 1].x && pt[4] == poPoints[nPoints - 1].y && pt[5] == padfZ[nPoints - 1]) { panPartType[nParts - 1] = SHPP_TRIFAN; poPoints[nPoints].x = pt[6]; poPoints[nPoints].y = pt[7]; padfZ[nPoints] = pt[8]; nPoints++; } else if (nParts > 0 && poPoints != NULL && ((panPartType[nParts - 1] == SHPP_TRIANGLES && nPoints - panPartStart[nParts - 1] == 3) || panPartType[nParts - 1] == SHPP_TRISTRIP) && pt[0] == poPoints[nPoints - 2].x && pt[1] == poPoints[nPoints - 2].y && pt[2] == padfZ[nPoints - 2] && pt[3] == poPoints[nPoints - 1].x && pt[4] == poPoints[nPoints - 1].y && pt[5] == padfZ[nPoints - 1]) { panPartType[nParts - 1] = SHPP_TRISTRIP; poPoints[nPoints].x = pt[6]; poPoints[nPoints].y = pt[7]; padfZ[nPoints] = pt[8]; nPoints++; } else { if (nParts == 0 || panPartType[nParts - 1] != SHPP_TRIANGLES) { nBeginLastPart = nPoints; panPartStart[nParts] = nPoints; panPartType[nParts] = SHPP_TRIANGLES; nParts++; } for (int i = 0; i<3; i++) { poPoints[nPoints + i].x = pt[0]; poPoints[nPoints + i].y = pt[1]; padfZ[nPoints + i] = pt[2]; pt += 3; } nPoints += 3; } } else { for (int i = 0; i < nRings; i++) { panPartStart[nParts + i] = nPoints; if (i == 0) panPartType[nParts + i] = SHPP_OUTERRING; else panPartType[nParts + i] = SHPP_INNERRING; pt = (double*)ls->points; for (int k = 0; k < ls->numPoints; k++) { poPoints[nPoints + k].x = pt[0]; poPoints[nPoints + k].y = pt[1]; padfZ[nPoints + k] = pt[2]; pt += 3; } nPoints += ls->numPoints; ls = NextLineString(ls, bZ, bM); } nParts += nRings; } tgeom = NextGeom(tgeom); } if (envelope.xMin <= envelope.xMax) memcpy(pabyPtrBounds, &envelope, 32); if (minZ <= maxZ) { memcpy(pZBounds, &(minZ), 8); memcpy(pZBounds + 8, &(maxZ), 8); } return nShpSize; } */
[ "leon@supergeo.com.tw" ]
leon@supergeo.com.tw
c2e9140478c39fae32599162eba825438074cd61
d0be9a869d4631c58d09ad538b0908554d204e1c
/utf8/lib/client/kernelengine/include/CGAL3.2.1/include/CGAL/kdtree_d.h
e593fd6aeb6404d3a06b64f8b16b0689154b4033
[]
no_license
World3D/pap
19ec5610393e429995f9e9b9eb8628fa597be80b
de797075062ba53037c1f68cd80ee6ab3ed55cbe
refs/heads/master
2021-05-27T08:53:38.964500
2014-07-24T08:10:40
2014-07-24T08:10:40
null
0
0
null
null
null
null
UTF-8
C++
false
false
26,973
h
// Copyright (c) 1997 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under // the terms of the Q Public License version 1.0. // See the file LICENSE.QPL distributed with CGAL. // // Licensees holding a valid commercial license may use this file in // accordance with the commercial license agreement provided with the software. // // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.2-branch/kdtree/include/CGAL/kdtree_d.h $ // $Id: kdtree_d.h 30350 2006-04-17 10:57:35Z spion $ // // // Author(s) : Sariel Har-Peled (sariel@math.tau.ac.il) // Eyal Flato (flato@math.tau.ac.il) #ifndef CGAL_KDTREE_D_H #define CGAL_KDTREE_D_H #include <cstdlib> #include <cassert> #include <cstring> #include <list> using std::list; // to avoid compiler crash on MSVC++ CGAL_BEGIN_NAMESPACE /*======================================================================= * Kdtree_interface - * This is the default interface of point. It assume that PT (the * point type have the following properties: * default constructor * int dimension() * const coord_type & operator[]( int ) const * ... operator=( const Pt & ) - copy operator \*=======================================================================*/ template <class PT> class Kdtree_interface { public: typedef PT Point; static int dimension( const PT & pnt ) { // return pnt.dimensions(); return pnt.dimension(); } static int compare( int d, const PT & a, const PT & b ) { if ( a[ d ] < b[ d ] ) return -1; if ( a[ d ] > b[ d ] ) return 1; return 0; } static void copy_coord( int d, PT & a, const PT & b ) { a[ d ] = b[ d ]; } }; template <class PT> class Kdtree_interface_2d { public: typedef PT Point; static int dimension( const PT & pnt ) { // return pnt.dimensions(); return pnt.dimension(); } static int compare( int d, const PT & a, const PT & b ) { if ( a[ d ] < b[ d ] ) return -1; if ( a[ d ] > b[ d ] ) return 1; return 0; } static void copy_coord( int d, PT & a, const PT & b ) { if ( d == 0 ) a = PT( b[ 0 ], a[1] ); else if ( d == 1 ) a = PT( a[ 0 ], b[1] ); else { assert( 0 ); } } }; template <class PT> class Kdtree_interface_3d { public: typedef PT Point; static int dimension( const PT & pnt ) { // return pnt.dimensions(); return pnt.dimension(); } static int compare( int d, const PT & a, const PT & b ) { if ( a[ d ] < b[ d ] ) return -1; if ( a[ d ] > b[ d ] ) return 1; return 0; } static void copy_coord( int d, PT & a, const PT & b ) { if ( d == 0 ) a = PT( b[ 0 ], a[1], a[ 2 ] ); else if ( d == 1 ) a = PT( a[ 0 ], b[1], a[ 2 ] ); else if ( d == 2 ) a = PT( a[ 0 ], a[1], b[ 2 ] ); else { assert( 0 ); } } }; /*========================================================================= * kdtree_d - * A the kdtree class. * * Remark: The kd-trees allocates all the memory it needs in advance, * This results in a rather efficient memory management, and a fast * iplementation. \*=========================================================================*/ template <class Traits> class Kdtree_d { class Plane; public: typedef typename Traits::Point Point; typedef list<Point> List_points; //------------------------------------------------------------------------- // Extended_Point_d - // A class for representing an extended d-dimal point: with // ability to support +/- infinity. Templated by the kd-treee interface // type. //------------------------------------------------------------------------- class ExtPoint { private: class coordinate_type { public: const Point * p_pnt; int type; //signed char type; }; coordinate_type * p_arr; int dim; Point def_pnt; void init( int _dim ) { assert( _dim > 0 ); dim = _dim; p_arr = (coordinate_type *)std::malloc( sizeof( coordinate_type ) * dim ); //printf( "p_arr(new): %p\n", (void *)p_arr ); assert( p_arr != NULL ); CGAL_CLIB_STD::memset( p_arr, 0, sizeof( coordinate_type ) * dim ); } public: enum { MINUS_INFINITY = -1, FINITE = 0, PLUS_INFINITY = 1 }; ExtPoint( int _type, int _dim ) { assert( _type == MINUS_INFINITY || _type == PLUS_INFINITY ); init( _dim ); for ( int ind = 0; ind < dim; ind++ ) p_arr[ ind ].type = _type; } ExtPoint() { p_arr = NULL; dim = -1; } ExtPoint( const ExtPoint & p ) { init( p.dim ); def_pnt = p.def_pnt; for ( int ind = 0; ind < dim; ind++ ) { p_arr[ ind ] = p.p_arr[ ind ]; if ( p.p_arr[ ind ].p_pnt == &p.def_pnt ) p_arr[ ind ].p_pnt = &def_pnt; } } ExtPoint & operator=( const ExtPoint & p ) { term(); init( p.dim ); def_pnt = p.def_pnt; for ( int ind = 0; ind < dim; ind++ ) { p_arr[ ind ] = p.p_arr[ ind ]; if ( p.p_arr[ ind ].p_pnt == &p.def_pnt ) p_arr[ ind ].p_pnt = &def_pnt; } return *this; } ExtPoint( const Point & point, int dim ) { init( dim ); def_pnt = point; for ( int ind = 0; ind < dim; ind++ ) { p_arr[ ind ].p_pnt = &def_pnt; p_arr[ ind ].type = FINITE; } } void term() { if ( p_arr != NULL ) { //printf( "a: %p\n", p_arr ); std::free( p_arr ); //printf( "_a\n" ); p_arr = NULL; } dim = 0; } ~ExtPoint() { term(); } void set_coord( int k, Point & point ) { assert( 0 <= k && k < dim ); p_arr[ k ].type = FINITE; //p_arr[ k ].p_pnt = &point; Traits::copy_coord( k, def_pnt, point ); p_arr[ k ].p_pnt = &def_pnt; } void set_coord( int k, const ExtPoint & point ) { assert( 0 <= k && k < dim ); assert( 0 <= k && k < point.dim ); p_arr[ k ] = point.p_arr[ k ]; if ( p_arr[ k ].type == FINITE ) { Traits::copy_coord( k, def_pnt, *(p_arr[ k ].p_pnt) ); p_arr[ k ].p_pnt = &def_pnt; } } int compare( int k, const ExtPoint & point ) const { assert( 0 <= k && k < dim ); // the following does not compile on msvc++... // coordinate_type & a( p_arr[ k ] ), // & b( point.p_arr[ k ] ); coordinate_type & a = p_arr[ k ]; coordinate_type & b = point.p_arr[ k ]; if ( a.type != FINITE ) { if ( b.type != FINITE ) { return a.type - b.type; } else { return a.type; } } else { if ( b.type != FINITE ) return -b.type; else return Traits::compare( k, *a.p_pnt, *b.p_pnt ); } } int compare_vector( const ExtPoint & point ) const { int ind, res; for ( ind = 0; ind < dim; ind++ ) { res = compare( ind, point ); if ( res != 0 ) return res; } return 0; } int compare( int k, const Point & point ) const { assert( 0 <= k && k < dim ); // coordinate_type & a( p_arr[ k ] ); coordinate_type & a = p_arr[ k ]; if ( a.type != FINITE ) return a.type; else return Traits::compare( k, *a.p_pnt, point ); } int dimension() const { return dim; } int get_coord_status( int d ) const { assert( 0 <= d && d < dim ); return p_arr[ d ].type; } const Point * get_coord_point( int d ) const { assert( 0 <= d && d < dim ); return p_arr[ d ].p_pnt; } }; // Box - represents an axis parallel box. class Box { public: int dim; ExtPoint left, right; private: friend class Plane; ExtPoint & get_vertex( bool f_left ) { return f_left? left : right; } public: // constructors //CHECK Box() { } Box( const Box & box ) { dim = box.dim; left = box.left; right = box.right; } Box( const Point &l, const Point &r, int _dim ) { dim = _dim; left = ExtPoint( l, dim ); right = ExtPoint( r, dim ); } Box( int _dim ) : left( ExtPoint::MINUS_INFINITY, _dim ), right( ExtPoint::PLUS_INFINITY, _dim ) { dim = _dim; } // data access void set_left( Point &l) { left = ExtPoint( l, dim ); }; void set_right( Point &r) { right = ExtPoint( r, dim ); } const ExtPoint &get_left() const { return left; } const ExtPoint &get_right() const { return right; } void set_coord_left( int k, Point & p ) { left.set_coord( k, p ); } void set_coord_right( int k, Point & p ) { right.set_coord( k, p ); } // operations bool is_in( const Box &o) const // checks if o is completely inside <this> { int dim = left.dimension(); for (int i = 0; i < dim; i++) { if ( (left.compare(i, o.get_left()) > 0 ) || (right.compare(i, o.get_right()) < 0 ) ) return false; } return true; } bool is_in( const Point & o ) const // checks if o is completely inside <this> { int dim = left.dimension(); for (int i = 0; i < dim; i++) { if ( (left.compare( i, o ) > 0 ) || (right.compare( i, o ) <= 0 ) ) return false; } return true; } bool is_coord_in_range( int k, const Point & o ) const // checks if o is completely inside <this> { return ( ! ( (left.compare( k, o ) > 0 ) || (right.compare( k, o ) <= 0 ) ) ); } bool is_intersect( const Box &o) const // checks if there is an intersection between o and this { int dim = left.dimension(); for (int i = 0; i < dim; i++) { if ( (left.compare(i, o.get_right()) >= 0) || (right.compare(i, o.get_left()) <= 0) ) return false; } return true; } // checks if there is an intersection between o and this box // only in a specific coordinate... bool is_intersect_in_dim( int d, const Box & o ) const { return (! ( (left.compare( d, o.get_right() ) >= 0 ) || (right.compare( d, o.get_left() ) <= 0) )); } // checks if there is an intersection between o and this box // only in a specific coordinate... bool is_intersect_in_dim_closed( int d, const Box & o ) const { return (! ( (left.compare( d, o.get_right() ) > 0 ) || (right.compare( d, o.get_left() ) < 0) )); } bool intersect(Box &o) // intersects this with o. the intersection will be in this // returns false if intersection is empty { int dim = left.dimension(); for (int i = 0; i < dim; i++) { // left is the maximal of the lefts if (left.compare(i, o.get_left()) == -1) left.set_coord(i, o.get_left()); // right is the minimal of the rights if (right.compare(i, o.get_right()) == 1) right.set_coord(i, o.get_right()); } return !(is_empty()); } bool is_empty() const // return true if this is not an interval (left[k] > right[k]) { int dim = left.dimension(); for (int i = 0; i < dim; i++) { if (left.compare(i, right) == 1) return true; } return false; } bool is_empty_open() const // return true if this is not an interval (left[k] > right[k]) { int dim = left.dimension(); for (int i = 0; i < dim; i++) { if ( left.compare(i, right) >= 0 ) return true; } return false; } int comp( const Box & o ) const { int res; res = left.compare_vector( o.left ); if ( res != 0 ) return res; return right.compare_vector( o.right ); } // destructor - needed in ...recursive ... DVP ~Box() { left.term(); right.term(); dim = 0; } }; private: class Plane { private: int coord; Point * normal; bool f_plus; // orientation of half space // is (0, 0, ... , +inifinity, 0, ..., 0) inside plane public: Plane() { normal = NULL; coord = 0; } Plane( int k, Point & p ) { normal = &p; coord = k; } Plane( const Plane & p ) { coord = p.coord; normal = p.normal; } void dump( void ) { std::cout << "(" << coord << ": " << *normal << ")"; } bool is_in( const Point & p ) const { int cmp; cmp = Traits::compare( coord, p, *normal ); if ( ! f_plus ) cmp = -cmp; return cmp >= 0; } void set_plane(int k, Point &p) { coord = k; normal = &p; //normal->copy( coord, p ); } void split( Box & region, bool f_neg ) { ExtPoint * p_p = &(region.get_vertex( ! f_neg )); if ( f_neg ) { if ( p_p->compare( coord, *normal ) > 0 ) p_p->set_coord( coord, *normal ); } else if ( p_p->compare( coord, *normal ) < 0 ) p_p->set_coord( coord, *normal ); } void orient_half_space( bool f_neg_side ) { f_plus = ! f_neg_side; } int get_coord() const { return coord; } }; private: class Node { public: Plane plane; Point * pnt; Node * left, * right; enum { LEFT, RIGHT }; const Plane & get_hs( int side ) const { ((Plane *)&plane)->orient_half_space( side == LEFT ); return plane; } bool is_points_in_hs( const Plane & pl ) const { if ( is_point() ) return pl.is_in( *pnt ); if ( left != NULL && ( ! left->is_points_in_hs( pl ) ) ) return false; if ( right != NULL && ( ! right->is_points_in_hs( pl ) ) ) return false; return true; } bool is_valid() const { if ( is_point() ) return true; if ( left != NULL ) if ( ! left->is_points_in_hs( get_hs( LEFT ) ) ) return false; if ( right != NULL ) if ( ! right->is_points_in_hs( get_hs( RIGHT ) ) ) return false; return true; } void dump( int depth ) { int ind; for ( ind = 0; ind < depth; ind++ ) std::cout << " "; if ( is_point() ) { std::cout << *pnt << "\n"; return; } plane.dump(); std::cout << "\n"; left->dump( depth + 1 ); for ( ind = 0; ind < depth; ind++ ) std::cout << " "; std::cout << "!!!!!!!!!!!!\n"; right->dump( depth + 1 ); } bool is_point() const { return ((left == NULL) && (right == NULL)); } typedef std::back_insert_iterator<List_points> back_iter; Node() : plane() { left = right = NULL; } void copy_subtree_points( back_iter & result, const Box & rect ) { if ( is_point() ) { if ( rect.is_in( *pnt ) ) (*result++) = *pnt; return; } if ( left != NULL ) left->copy_subtree_points( result, rect ); if ( right != NULL ) right->copy_subtree_points( result, rect ); } static void search_recursive( back_iter & result, Node * node, const Box & rect, Box & _region, Plane & plane, bool f_split_plus ) { //printf( "search_recusrive\n" ); Box * p_r = new Box( _region ); //printf( "z" ); //fflush( stdout ); plane.split( *p_r, f_split_plus ); //printf( "c" ); //fflush( stdout ); assert( node != NULL ); //printf( "b" ); //fflush( stdout ); if ( rect.is_in( *p_r ) ) { //printf( "5" ); //fflush( stdout ); node->copy_subtree_points( result, rect ); //printf( "\tsearch_recursive done...\n" ); //printf( "6" ); //fflush( stdout ); delete p_r; return; } //printf( "v" ); //fflush( stdout ); if ( rect.is_intersect_in_dim_closed( plane.get_coord(), *p_r ) ) node->search( result, rect, *p_r ); //printf( "x" ); //fflush( stdout ); delete p_r; } void search( std::back_insert_iterator<List_points> result, const Box &rect, Box &region ) { if (is_point()) { if ( rect.is_in( *pnt ) ) (*result++) = *pnt; return; } //this is not a point so it is a hypeplane if ( left != NULL ) search_recursive( result, left, rect, region, plane, true ); if ( right != NULL ) search_recursive( result, right, rect, region, plane, false ); } }; // SunPro requires this : friend class Box; friend class Node; typedef Point * Point_ptr; int size; Point * p_arr_pt; Node *root; int dim; Node * p_node_arr; int node_count; Node * malloc_node( void ) { Node * p_ret; p_ret = &(p_node_arr[ node_count ]); node_count++; assert( node_count <= ( 2 * size )); *p_ret = Node(); return p_ret; } static int comp( const Point & a, const Point & b, int dim ) { return Traits::compare( dim, a, b ); } static int partition( Point_ptr * arr, int left, int right, Point * p_pivot, int dim ) { int i, j; Point_ptr tmp; if ( left >= right ) return left; i = left; j = right; while ( i < j ) { if ( comp( *(arr[ i ]), *(arr[ j ]), dim ) > 0 ) { tmp = arr[ i ]; arr[ i ] = arr[ j ]; arr[ j ] = tmp; } if ( comp( *(arr[ i ]), *p_pivot, dim ) < 0 ) { i++; } else if ( comp( *p_pivot, *(arr[ j ]), dim ) <= 0 ) j--; } return (i > left)? i - 1 : left; } /* split the array into two sub-arrays, such that all the elements * from left to pos_mid are smaller than the elements from pos+1 to * right. */ static void split_arr( Point_ptr * arr, int left, int right, int pos_mid, int dim ) { int pos; if ( left >= right ) return; pos = partition( arr, left, right, arr[ (left + right ) / 2 ], dim ); if ( pos == pos_mid ) return; if ( pos < pos_mid ) split_arr( arr, pos+1, right, pos_mid, dim ); else split_arr( arr, left, pos, pos_mid, dim ); } static Point_ptr get_max_element( Point_ptr * arr, int left, int right, int d ) { int max_pos = left; Point mx = *(arr[ max_pos ]); for ( int ind = left + 1; ind <= right; ind++ ) if ( comp( mx, *(arr[ ind ]), d ) < 0 ) { mx = *(arr[ ind ]); max_pos = ind; } return arr[ max_pos ]; } Node *build_r( Point_ptr * arr, int left, int right, int d ) { int num, pos, next_d; Node * n; num = right - left + 1; if ( num < 1) return NULL; // if the list contains only one point, // construct a leaf for this node if ( num == 1) { //n = new node; n = malloc_node(); n->pnt = arr[ left ]; return n; } // else divide space into two regions in // dim-dim and cotinue recursively pos = (left + right) / 2; split_arr( arr, left, right, pos, d ); Point * p_median = get_max_element( arr, left, pos, d ); // create division plane; Plane plane( d, *p_median ); //n = new node; // assert( n != NULL ); n = malloc_node(); n->plane = plane; next_d = d + 1; if ( next_d >= dim ) next_d = 0; // build left sub-tree n->left = build_r( arr, left, pos, next_d ); // build right sub-tree n->right = build_r( arr, pos + 1, right, next_d ); return n; } public: typedef list<Point> list_points; Kdtree_d(int k = 2) { dim = k; root = NULL; p_arr_pt = NULL; p_node_arr = NULL; } ~Kdtree_d() { delete_all(); } bool is_valid( bool verbose = false, int level = 0 ) const { (void)verbose; (void)level; if ( root == NULL ) return true; return root->is_valid(); } void dump() { root->dump( 0); } void delete_all() { root = NULL; if ( p_arr_pt != NULL ) delete[] p_arr_pt; p_arr_pt = NULL; if ( p_node_arr != NULL ) delete[] p_node_arr; p_node_arr = NULL; } void search( std::back_insert_iterator<list_points> result, Box & rect ) { if (root == NULL) return; // it is an empty tree - nothing to search in Box region = Box( dim ); root->search( result, rect, region ); } void build(list<Point> &l) { int i; Point_ptr * p_arr; size = l.size(); p_arr_pt = new Point[ size ]; assert( p_arr_pt != NULL ); p_arr = new Point_ptr[ size ]; assert( p_arr != NULL ); p_node_arr = new Node[ 2 * size ]; assert( p_node_arr != NULL ); node_count = 0; /* fill the array */ i = 0; for ( typename std::list<Point>::iterator j = l.begin(); j != l.end(); j++ ) { p_arr_pt[ i ] = (*j); p_arr[ i ] = p_arr_pt + i; i++; } // recursively build the tree from the sorted list // starting to divide it in coordinate 0 root = build_r( p_arr, 0, size - 1, 0 ); //printf( "b\n" ); delete[] p_arr; } }; CGAL_END_NAMESPACE #endif /* CGAL_KDTREE_D_H */
[ "viticm@126.com" ]
viticm@126.com
ab7a521c1b582a8e128419986f6be616a1baf24f
9281c1a887b970b05613b6c0e7565bd9a6d112a8
/LeetCode/Solution.h
581f578d91071413bc46f0f05f6f6dea8fe10c73
[]
no_license
chubei/LeetCode
f05b4ecd6e90d278bacbb6abcc6cb77d5d638536
c92c7766aa1e5ebb156b9678fdc6db63be8dae6b
refs/heads/master
2021-01-01T05:09:14.094279
2016-10-23T17:14:32
2016-10-23T17:14:32
57,269,745
0
1
null
null
null
null
UTF-8
C++
false
false
2,889
h
#pragma once #include <vector> #include <string> #include <queue> #include <deque> #include <utility> #include <list> #include <unordered_set> #include <unordered_map> #include <map> using namespace std; struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(NULL) {} }; struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {} }; class Solution { public: vector<string> fullJustify(vector<string>& words, int maxWidth); ListNode* addTwoNumbers(ListNode* l1, ListNode* l2); int lengthOfLongestSubstring(string s); string convert(string s, int numRows); int reverse(int x); int myAtoi(string str); bool isPalindrome(int x); bool isMatch(string s, string p); bool searchMatrix(vector<vector<int>>& matrix, int target); int divide(int dividend, int divisor); vector<int> findOrder(int numCourses, vector<pair<int, int>>& prerequisites); bool canJump(vector<int>& nums); int maximalSquare(vector<vector<char>>& matrix); int numDecodings(string s); int titleToNumber(string s); int maxProduct(vector<int>& nums); vector<vector<int>> levelOrder(TreeNode* root); int calculate(string s); vector<int> singleNumber(vector<int>& nums); void rotate(vector<int>& nums, int k); vector<vector<string>> solveNQueens(int n); void deleteNode(ListNode* node); ListNode* partition(ListNode* head, int x); vector<int> lexicalOrder(int n); int firstUniqChar(string s); int lastRemaining(int n); bool isRectangleCover(vector<vector<int>>& rectangles); bool isSubsequence(string s, string t); bool validUtf8(vector<int>& data); string decodeString(string s); int longestSubstring(string s, int k); int maxRotateFunction(vector<int>& A); int integerReplacement(int n); vector<double> calcEquation(vector<pair<string, string>> equations, vector<double>& values, vector<pair<string, string>> queries); int findNthDigit(int n); vector<string> readBinaryWatch(int num); string removeKdigits(string num, int k); bool canCross(vector<int>& stones); int sumOfLeftLeaves(TreeNode* root); string toHex(int num); vector<pair<int, int>> reconstructQueue(vector<pair<int, int>>& people); int trapRainWater(vector<vector<int>>& heightMap); vector<vector<int>> palindromePairs(vector<string>& words); void reorderList(ListNode* head); string addStrings(string num1, string num2); bool canPartition(vector<int>& nums); vector<pair<int, int>> pacificAtlantic(vector<vector<int>>& matrix); int wordsTyping(vector<string>& sentence, int rows, int cols); int pathSum(TreeNode* root, int sum); vector<int> findAnagrams(string s, string p); string parseTernary(string expression); int findKthNumber(int n, int k); };
[ "914745487@qq.com" ]
914745487@qq.com
c51cc423bd876d47557b440abec49e7e1e72047c
3b04925b4271fe921020cff037b86e4a5a2ae649
/windows_embedded_ce_6_r3_170331/WINCE600/PRIVATE/TEST/MULTIMEDIA/DIRECTX/D3D/MOBILE/LIBS/VERIFTESTCASELIBS/BLENDTESTCASES/blendcases.cpp
855f33581ba652a1fb78b663ff62d5a0b52195f1
[]
no_license
fanzcsoft/windows_embedded_ce_6_r3_170331
e3a4d11bf2356630a937cbc2b7b4e25d2717000e
eccf906d61a36431d3a37fb146a5d04c5f4057a2
refs/heads/master
2022-12-27T17:14:39.430205
2020-09-28T20:09:22
2020-09-28T20:09:22
null
0
0
null
null
null
null
UTF-8
C++
false
false
26,042
cpp
// // Copyright (c) Microsoft Corporation. All rights reserved. // // // Use of this source code is subject to the terms of the Microsoft shared // source or premium shared source license agreement under which you licensed // this source code. If you did not accept the terms of the license agreement, // you are not authorized to use this source code. For the terms of the license, // please see the license agreement between you and Microsoft or, if applicable, // see the SOURCE.RTF on your install media or the root of your tools installation. // THE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES. // #include "BlendCases.h" #include "ImageManagement.h" #include "BufferTools.h" #include "BlendTools.h" #include "DebugOutput.h" #include "VerifTestCases.h" #include <tux.h> #include <tchar.h> #include <stdio.h> #include "DebugOutput.h" #define countof(x) (sizeof(x)/sizeof(*(x))) #define D3DMQA_BLEND_TOLERANCE 8 // // Resize viewport to D3DMQA_VIEWPORT_EXTENT x D3DMQA_VIEWPORT_EXTENT, centered // within original viewport extents // #define D3DMQA_VIEWPORT_EXTENT 8 // // Using the full granularity that this test is capable of is very time consuming; skip some iterations // #define D3DMQA_ITER_SKIP 8 // // GetPixel // // Gets a pixel's color from the device's frontbuffer. Uses GetPixel(hdc, ...) from CaptureBMP tool. // *** This is a very bad method to use for getting multiple pixels :VERY SLOW *** // // Arguments: // // LPDIRECT3DMOBILEDEVICE pDevice: The device from whose frontbuffer we'll be getting the pixel. // etc. // HRESULT GetPixel(LPDIRECT3DMOBILEDEVICE pDevice, int iXPos, int iYPos, BYTE * pRed, BYTE * pGreen, BYTE * pBlue) { IDirect3DMobileSurface *pFrontBuffer = NULL; HRESULT hr = S_OK; HDC hDC = NULL; D3DMDISPLAYMODE Mode; // // The current display mode is needed, to determine desired format // if( FAILED( hr = pDevice->GetDisplayMode( &Mode ) ) ) { DebugOut(DO_ERROR, L"IDirect3DMobile::GetDisplayMode failed. (hr = 0x%08x)", hr); goto cleanup; } // // Create an image surface, of the same size to receive the front buffer contents // if( FAILED( hr = pDevice->CreateImageSurface(Mode.Width, // UINT Width, Mode.Height, // INT Height, Mode.Format, // D3DMFORMAT Format, &pFrontBuffer)))// IDirect3DMobileSurface** ppSurface { DebugOut(DO_ERROR, L"IDirect3DMobileDevice::CreateImageSurface failed. (hr = 0x%08x)", hr); goto cleanup; } // // Retrieve front buffer copy // if( FAILED( hr = pDevice->GetFrontBuffer(pFrontBuffer))) // IDirect3DMobileSurface* pFrontBuffer { DebugOut(DO_ERROR, L"IDirect3DMobileDevice::GetFrontBuffer failed. (hr = 0x%08x)", hr); goto cleanup; } // // Confirm result // if (NULL == pFrontBuffer) { DebugOut(DO_ERROR, L"IDirect3DMobileDevice::GetFrontBuffer resulted in NULL LPDIRECT3DMOBILESURFACE."); hr = E_POINTER; goto cleanup; } // // Retrieve front-buffer DC // if (FAILED( hr = pFrontBuffer->GetDC(&hDC))) // HDC* phdc { DebugOut(DO_ERROR, L"IDirect3DMobileSurface::GetDC failed. (hr = 0x%08x)", hr); goto cleanup; } hr = GetPixel(hDC, iXPos, iYPos, pRed, pGreen, pBlue); cleanup: // // Cleanup front buffer if valid // if (pFrontBuffer) { // // Release the front-buffer DC // if (NULL != hDC) { if (FAILED( pFrontBuffer->ReleaseDC(hDC))) { DebugOut(DO_ERROR, L"IDirect3DMobileSurface::ReleaseDC failed."); } } if (0 != pFrontBuffer->Release()) { DebugOut(DO_ERROR, L"IDirect3DMobileSurface::Release != 0."); } } return hr; } // // CreateTestColors // // Generates color components to be used for each iteration of the test case. // // Arguments: // // UINT uiIteration: Iteration to generate color components for // DWORD *pdwColorFront: Front primitive // DWORD *pdwColorBack: Back primitive // // Return Value: // // HRESULT: Indicates success or failure // HRESULT CreateTestColors(UINT uiIteration, DWORD *pdwColorFront, DWORD *pdwColorBack) { BYTE RedFront, GreenFront, BlueFront, AlphaFront; BYTE RedBack, GreenBack, BlueBack, AlphaBack; BYTE FrontColor, BackColor; // // Enforce upper bound on iterations // if (uiIteration > D3DQA_ITERATIONS) return E_FAIL; // // ITERATION "MAP" // // | Range | Front Color | Back Color | // +---------+--------------------------+---------------+ // | 0-255 | Red w/ Variable Alpha | Red | // | 256-511 | Red w/ Variable Alpha | Green | // | 512-767 | Red w/ Variable Alpha | Blue | // | 768-1023| Green w/ Variable Alpha | Red | // |1024-1279| Green w/ Variable Alpha | Green | // |1280-1535| Green w/ Variable Alpha | Blue | // |1536-1791| Blue w/ Variable Alpha | Red | // |1792-2047| Blue w/ Variable Alpha | Green | // |2048-2303| Blue w/ Variable Alpha | Blue | // AlphaFront = uiIteration % 256; AlphaBack = 0xFF; FrontColor = uiIteration/768; BackColor = (uiIteration/256)%3; RedFront = GreenFront = BlueFront = 0x00; RedBack = GreenBack = BlueBack = 0x00; switch(FrontColor) { case 0: RedFront = 0xFF; break; case 1: GreenFront = 0xFF; break; case 2: BlueFront = 0xFF; break; } switch(BackColor) { case 0: RedBack = 0xFF; break; case 1: GreenBack = 0xFF; break; case 2: BlueBack = 0xFF; break; } *pdwColorFront = D3DMCOLOR_RGBA(RedFront,GreenFront,BlueFront,AlphaFront); *pdwColorBack = D3DMCOLOR_RGBA(RedBack ,GreenBack ,BlueBack ,AlphaBack ); return S_OK; } // // SetupIter // // Sets up the test case, which will be put to use in the render loop. // // Arguments: // // UINT uiIteration: Iteration number (frame) currently under test // LPDIRECT3DMOBILEVERTEXBUFFER: Vertex buffer // // Return Value: // // HRESULT: Indicates success or failure // HRESULT SetupIter( UINT uiIteration, LPDIRECT3DMOBILEVERTEXBUFFER *ppVB, D3DMBLEND SourceBlend, D3DMBLEND DestBlend, D3DMBLENDOP BlendOp ) { HRESULT hr; CUSTOMVERTEX *pVertices; DWORD dwColorFront, dwColorBack; if (FAILED(hr = CreateTestColors(uiIteration, // UINT uiIteration, &dwColorFront, // DWORD *pdwColorFront &dwColorBack))) // DWORD *pdwColorBack { DebugOut(DO_ERROR, L"CreateTestColors failed. (hr = 0x%08x)", hr); return hr; } // // Prepare a vertex buffer with the required color characteristics // if( FAILED( hr = (*ppVB)->Lock( 0, 0, (VOID**)&pVertices, 0 ) ) ) { DebugOut(DO_ERROR, L"Lock failed. (hr = 0x%08x)", hr); return hr; } ColorVertRange((BYTE*)(&pVertices[0]), // BYTE*, 6, // UINT uiCount dwColorBack, // DWORD dwColor sizeof(CUSTOMVERTEX), // UINT uiStride offsetof(CUSTOMVERTEX,color)); // UINT uiOffset ColorVertRange((BYTE*)(&pVertices[6]), // BYTE*, 6, // UINT uiCount dwColorFront, // DWORD dwColor sizeof(CUSTOMVERTEX), // UINT uiStride offsetof(CUSTOMVERTEX,color));// UINT uiOffset (*ppVB)->Unlock(); return S_OK; } // // DrawIter // // Draws the primitives for this iteration // // Arguments: // // UINT uiTestCase: Test case enumerator // UINT uiIteration: Iteration number (frame) currently under test // // Return Value: // // HRESULT: Indicates success or failure // HRESULT DrawIter( LPDIRECT3DMOBILEDEVICE pDevice, UINT uiTestCase, UINT uiIteration, D3DMBLEND SourceBlend, D3DMBLEND DestBlend, D3DMBLENDOP BlendOp ) { HRESULT hr; // // Render a sequence of nonindexed, geometric primitives of the specified type // from the current data input stream // pDevice->SetRenderState(D3DMRS_SRCBLEND, D3DMBLEND_ONE); pDevice->SetRenderState(D3DMRS_DESTBLEND, D3DMBLEND_ZERO); pDevice->SetRenderState(D3DMRS_BLENDOP, D3DMBLENDOP_ADD); if( FAILED( hr = pDevice->DrawPrimitive( D3DMPT_TRIANGLELIST, 0, 2 ) ) ) { DebugOut(DO_ERROR, L"DrawPrimitive failed (hr = 0x%08x)", hr); return hr; } pDevice->SetRenderState(D3DMRS_SRCBLEND, SourceBlend); pDevice->SetRenderState(D3DMRS_DESTBLEND, DestBlend); pDevice->SetRenderState(D3DMRS_BLENDOP, BlendOp); if( FAILED( hr = pDevice->DrawPrimitive( D3DMPT_TRIANGLELIST, 6, 2 ) ) ) { DebugOut(DO_ERROR, L"DrawPrimitive failed (hr = 0x%08x)", hr); return hr; } return S_OK; } /** * AdjustBlendedColors * * Takes colors returned by GDIs GetPixel and runs them through a reverse * process of removing the bit replication that GDI performs (which * provides a more accurate conversion from 5 or 6b to 8b) to conform with * the D3DM 16bpp and smaller formats. * * Parameters * * Format * The format of the frontbuffer (generally the same as the back buffer * format) * * pRed, pGreen, pBlue * [in/out] In: The GDI colors that are to be adjusted. Out: The * colors adjusted to more accurately represent the expected colors. * * bRound * Should the values be rounded to the nearest valid color (based on * format) before being truncated? This is only necessary for the * values that have been calculated. The D3DM driver should already * have rounded the color value. * * Return Value : HRESULT * Assorted errors on failure, S_OK on success. * */ HRESULT AdjustBlendedColors(D3DMFORMAT Format, BYTE * pRed, BYTE * pGreen, BYTE * pBlue, bool bRound) { DWORD dwRedMask; DWORD dwGreenMask; DWORD dwBlueMask; UINT uiRedBitCount; UINT uiGreenBitCount; UINT uiBlueBitCount; BYTE RedRounder; BYTE GreenRounder; BYTE BlueRounder; if (NULL == pRed || NULL == pBlue || NULL == pGreen) { DebugOut(DO_ERROR, L"AdjustBlendedColors called with NULL colors pointer."); return E_POINTER; } BYTE Red = *pRed; BYTE Green = *pGreen; BYTE Blue = *pBlue; switch(Format) { // Handle the 8bit per channel formats by just returning without changing anything. case D3DMFMT_R8G8B8: // Fall through case D3DMFMT_A8R8G8B8: // Fall through case D3DMFMT_X8R8G8B8: return S_OK; // Handle the 565 case formats case D3DMFMT_R5G6B5: uiRedBitCount = 5; uiGreenBitCount = 6; uiBlueBitCount = 5; break; // Handle the 555 case formats case D3DMFMT_X1R5G5B5: // Fall through case D3DMFMT_A1R5G5B5: uiRedBitCount = 5; uiGreenBitCount = 5; uiBlueBitCount = 5; break; // Handle the 444 case formats case D3DMFMT_A4R4G4B4: // Fall through case D3DMFMT_X4R4G4B4: uiRedBitCount = 4; uiGreenBitCount = 4; uiBlueBitCount = 4; break; // Handle the 332 case formats case D3DMFMT_R3G3B2: // Fall through case D3DMFMT_A8R3G3B2: uiRedBitCount = 3; uiGreenBitCount = 3; uiBlueBitCount = 2; break; // Shouldn't get here default: DebugOut(DO_ERROR, L"Cannot handle format %08x", Format); return E_INVALIDARG; } dwRedMask = ((1 << uiRedBitCount) - 1) << (8 - uiRedBitCount); dwGreenMask = ((1 << uiGreenBitCount) - 1) << (8 - uiGreenBitCount); dwBlueMask = ((1 << uiBlueBitCount) - 1) << (8 - uiBlueBitCount); if (bRound) { RedRounder = 1 << (7 - uiRedBitCount); GreenRounder = 1 << (7 - uiGreenBitCount); BlueRounder = 1 << (7 - uiBlueBitCount); // We need to guard against overflow if ((BYTE)(Red + RedRounder) > Red) Red += RedRounder; if ((BYTE)(Green + GreenRounder) > Green) Green += GreenRounder; if ((BYTE)(Blue + BlueRounder) > Blue) Blue += BlueRounder; } Red &= dwRedMask; Green &= dwGreenMask; Blue &= dwBlueMask; *pRed = Red; *pGreen = Green; *pBlue = Blue; return S_OK; } // // VerifyIter // // Compare the expected color components to the actual color components, to verify // successful execution of the test case. // // Arguments: // // UINT uiIteration: Iteration number (frame) currently under test // UINT uiTolerance: Allowable inaccuracy in color value // BYTE Red \ // BYTE Green Actual color components resulting from test // BYTE Blue / // D3DMBLEND SourceBlend: // D3DMBLEND DestBlend: // D3DMBLENDOP BlendOp: // // Return Value: // // HRESULT: Success indicates that the color components matched expectations; failure otherwise. // HRESULT VerifyIter( D3DMFORMAT Format, UINT uiIteration, UINT uiTolerance, BYTE Red, BYTE Green, BYTE Blue, D3DMBLEND SourceBlend, D3DMBLEND DestBlend, D3DMBLENDOP BlendOp ) { HRESULT hr; DWORD dwColorResult = 0; DWORD dwColorFront; DWORD dwColorBack; BYTE ExpectedRed; BYTE ExpectedGreen; BYTE ExpectedBlue; UINT uiRedDiff, uiGreenDiff, uiBlueDiff; // // Determine colors for this iteration // if (FAILED(hr = CreateTestColors(uiIteration, // UINT uiIteration, &dwColorFront, // DWORD *pdwColorFront &dwColorBack)))// DWORD *pdwColorBack { DebugOut(DO_ERROR, L"CreateTestColors failed. (hr = 0x%08x)", hr); return hr; } // // Blend source and dest // if (FAILED(hr = Blend(BlendOp, SourceBlend, DestBlend, dwColorFront, dwColorBack, &dwColorResult))) { DebugOut(DO_ERROR, L"Blend failed. (hr = 0x%08x)", hr); return hr; } ExpectedRed = D3D_GETR(dwColorResult); ExpectedGreen = D3D_GETG(dwColorResult); ExpectedBlue = D3D_GETB(dwColorResult); if (FAILED(hr = AdjustBlendedColors(Format, &Red, &Green, &Blue, false))) { DebugOut(DO_ERROR, L"Could not adjust colors based on format of frontbuffer. (hr = 0x%08x)", hr); return hr; } if (FAILED(hr = AdjustBlendedColors(Format, &ExpectedRed, &ExpectedGreen, &ExpectedBlue, true))) { DebugOut(DO_ERROR, L"Could not adjust colors based on format of frontbuffer. (hr = 0x%08x)", hr); return hr; } // // Compute absolute diffs // uiRedDiff = (UINT)abs((int)(ExpectedRed)-(int)(Red)); uiGreenDiff = (UINT)abs((int)(ExpectedGreen)-(int)(Green)); uiBlueDiff = (UINT)abs((int)(ExpectedBlue)-(int)(Blue)); // // Verify that result was close to expectations // if ((uiRedDiff > uiTolerance) || (uiGreenDiff > uiTolerance) || (uiBlueDiff > uiTolerance)) { DebugOut(DO_ERROR, L"Blending iteration failed verification: Iteration %u exceeded per-channel tolerance of %u", uiIteration, uiTolerance); DebugOut(L"Expected: [R=%u;G=%u;B=%u]", (UINT)(ExpectedRed), (UINT)(ExpectedGreen), (UINT)(ExpectedBlue)); DebugOut(L" Actual: [R=%u;G=%u;B=%u]", (UINT)Red, (UINT)(Green), (UINT)(Blue)); DebugOut(L" Diffs: [R=%u;G=%u;B=%u]", uiRedDiff, uiGreenDiff, uiBlueDiff); return E_FAIL; } return S_OK; } // // ExecuteTestCase // // Renders and verifies the results of one test case; consisting of many iterations. // // Arguments: // // UINT uiTestCase: Ordinal of test case to run // UINT uiSkipCount: If entire set of permutations is desired, set to 1; otherwise set // to "step size" indicating number of iterations to skip. For example, // 3 indicates that the following iterations will run: 0, 3, 6, 9. // UINT uiTolerance: Absolute difference allowed between expected result and actual result // // Return Value: // // INT: TPR_PASS, TPR_FAIL, TPR_ABORT, or TPR_SKIP // //INT ExecuteTestCase(UINT uiTestCase, UINT uiSkipCount, UINT uiTolerance) TESTPROCAPI BlendTest(LPVERIFTESTCASEARGS pTestCaseArgs) { DebugOut(L"Beginning ExecuteTestCase."); HRESULT hr; // // Vertex Buffer // LPDIRECT3DMOBILEVERTEXBUFFER pVB = NULL; // // Actual color component results, to compare with expected // BYTE RedResult, GreenResult, BlueResult; // // Extents of viewport // D3DMVIEWPORT OldViewport, NewViewport; // // Window client extents // RECT WndRect; // // Frame counter // UINT uiFrameIndex; // // Return value // HRESULT Result = TPR_PASS; // // Vertex buffer locked bits // CUSTOMVERTEX *pVertices = NULL; // // Sampling location for GetPixel // POINT Point; // // Index into table of permutations // DWORD dwTableIndex = pTestCaseArgs->dwTestIndex - D3DMQA_BLENDTEST_BASE; // // Skip test cases that use an unsupported feature // if (FALSE == IsBlendSupported(pTestCaseArgs->pDevice, AlphaTests[dwTableIndex].SourceBlend, AlphaTests[dwTableIndex].DestBlend, AlphaTests[dwTableIndex].BlendOp)) { DebugOut(DO_ERROR, L"Blend not supported. Skipping."); Result = TPR_SKIP; goto cleanup; } // // A vertex buffer is needed for this test; create and bind to data stream // pVB = CreateActiveBuffer(pTestCaseArgs->pDevice, // LPDIRECT3DMOBILEDEVICE pd3dDevice, D3DQA_NUMVERTS, // UINT uiNumVerts, D3DMFVF_CUSTOMVERTEX, // DWORD dwFVF, BytesPerVertex(D3DMFVF_CUSTOMVERTEX),// DWORD dwFVFSize, 0); // DWORD dwUsage if (NULL == pVB) { DebugOut(DO_ERROR, L"CreateActiveBuffer failed. Aborting."); Result = TPR_ABORT; goto cleanup; } // // Clear entire extents of original viewport before moving to smaller viewport // pTestCaseArgs->pDevice->Clear( 0, NULL, D3DMCLEAR_TARGET|D3DMCLEAR_ZBUFFER, D3DMCOLOR_XRGB(128,128,128), 1.0f, 0 ); // // Get old viewport // if( FAILED( hr = pTestCaseArgs->pDevice->GetViewport(&OldViewport) ) ) { DebugOut(DO_ERROR, L"GetViewport failed. (hr = 0x%08x) Aborting.", hr); Result = TPR_ABORT; goto cleanup; } // // Resize to very small viewport, centered within original extents // NewViewport.Width = D3DMQA_VIEWPORT_EXTENT; NewViewport.Height = D3DMQA_VIEWPORT_EXTENT; NewViewport.X = OldViewport.X + (OldViewport.Width / 2) - (NewViewport.Width / 2); NewViewport.Y = OldViewport.Y + (OldViewport.Height / 2) - (NewViewport.Height / 2); NewViewport.MinZ = OldViewport.MinZ; NewViewport.MaxZ = OldViewport.MaxZ; // // Set new viewport // if( FAILED( hr = pTestCaseArgs->pDevice->SetViewport(&NewViewport) ) ) { DebugOut(DO_ERROR, L"SetViewport failed. (hr = 0x%08x) Aborting.", hr); Result = TPR_ABORT; goto cleanup; } // // Indicate vertex format // if( FAILED( hr = pTestCaseArgs->pDevice->SetStreamSource( 0, pVB, 0) ) ) { DebugOut(DO_ERROR, L"SetFVF failed. (hr = 0x%08x) Aborting.", hr); Result = TPR_ABORT; goto cleanup; } // // This function retrieves the coordinates of a window's client area. // The left and top members are zero. // // Zero indicates failure. // if (0 == GetClientRect( pTestCaseArgs->hWnd, &WndRect)) { DebugOut(DO_ERROR, L"GetClientRect failed. (hr = 0x%08x) Aborting.", HRESULT_FROM_WIN32(GetLastError())); Result = TPR_ABORT; goto cleanup; } // // Sampling location for GetPixel // Point.x = WndRect.right / 2; Point.y = WndRect.bottom / 2; // // This function converts the client coordinates of a specified point to screen coordinates. // Zero indicates failure. // if (0 == ClientToScreen(pTestCaseArgs->hWnd, // HWND hWnd, &Point)) // LPPOINT lpPoint { DebugOut(DO_ERROR, L"ClientToScreen failed. (hr = 0x%08x) Aborting.", HRESULT_FROM_WIN32(GetLastError())); Result = TPR_ABORT; goto cleanup; } // // Informative debug spew: sampling location should be at center of client // area of window (not center of window's bounding rect) // DebugOut(L"GetPixel will sample at (%li,%li)", Point.x, Point.y); if( FAILED( hr = pVB->Lock( 0, 0, (VOID**)(&pVertices), 0 ) ) ) { DebugOut(DO_ERROR, L"Lock failed. (hr = 0x%08x) Aborting.", hr); Result = TPR_ABORT; goto cleanup; } RectangularTLTriList((BYTE*)(&pVertices[0]), // BYTE*, NewViewport.X, // UINT uiX NewViewport.Y, // UINT uiY NewViewport.Width, // UINT uiWidth NewViewport.Height, // UINT uiHeight D3DQA_DEPTH_BACK, // float fDepth sizeof(CUSTOMVERTEX)); // UINT uiStride RectangularTLTriList((BYTE*)(&pVertices[6]), // BYTE*, NewViewport.X, // UINT uiX NewViewport.Y, // UINT uiY NewViewport.Width, // UINT uiWidth NewViewport.Height, // UINT uiHeight D3DQA_DEPTH_FRONT, // float fDepth sizeof(CUSTOMVERTEX)); // UINT uiStride pVB->Unlock(); // // Prepare for vertex alpha blending test case // pTestCaseArgs->pDevice->SetRenderState(D3DMRS_DIFFUSEMATERIALSOURCE, D3DMMCS_COLOR1); pTestCaseArgs->pDevice->SetRenderState(D3DMRS_ALPHABLENDENABLE, TRUE); pTestCaseArgs->pDevice->SetRenderState(D3DMRS_ZENABLE, D3DMZB_TRUE); for (uiFrameIndex = 0; uiFrameIndex < D3DQA_ITERATIONS; uiFrameIndex+=D3DMQA_ITER_SKIP) { // // Clear the backbuffer and the zbuffer // pTestCaseArgs->pDevice->Clear( 0, NULL, D3DMCLEAR_TARGET|D3DMCLEAR_ZBUFFER, D3DMCOLOR_XRGB(0,0,0), 1.0f, 0 ); // // Set up test scenario // if (FAILED(hr = SetupIter( uiFrameIndex, // UINT uiIteration, &pVB, AlphaTests[dwTableIndex].SourceBlend, // D3DMBLEND SourceBlend AlphaTests[dwTableIndex].DestBlend, // D3DMBLEND DestBlend AlphaTests[dwTableIndex].BlendOp))) // D3DMBLENDOP BlendOp { DebugOut(DO_ERROR, L"Failed to generate vertex buffer for this iteration. (hr = 0x%08x) Aborting.", hr); Result = TPR_ABORT; goto cleanup; } // // Scene rendering is about to begin // if( FAILED( hr = pTestCaseArgs->pDevice->BeginScene() ) ) { DebugOut(DO_ERROR, L"BeginScene failed. (hr = 0x%08x) Aborting.", hr); Result = TPR_ABORT; goto cleanup; } // // Verify resulting pixel component colors // if (FAILED(hr = DrawIter(pTestCaseArgs->pDevice, // LPDIRECT3DMOBILEDEVICE pDevice dwTableIndex, // UINT dwTableIndex uiFrameIndex, // UINT uiIteration, AlphaTests[dwTableIndex].SourceBlend, // D3DMBLEND SourceBlend AlphaTests[dwTableIndex].DestBlend, // D3DMBLEND DestBlend AlphaTests[dwTableIndex].BlendOp))) // D3DMBLENDOP BlendOp { DebugOut(DO_ERROR, L"DrawIter failed. (hr = 0x%08x) Aborting.", hr); Result = TPR_ABORT; goto cleanup; } // // End the scene // if( FAILED( hr = pTestCaseArgs->pDevice->EndScene() ) ) { DebugOut(DO_ERROR, L"EndScene failed. (hr = 0x%08x) Aborting.", hr); Result = TPR_ABORT; goto cleanup; } if( FAILED( hr = pTestCaseArgs->pDevice->Present( NULL, NULL, NULL, NULL ) ) ) { DebugOut(DO_ERROR, L"Present failed. (hr = 0x%08x) Aborting.", hr); Result = TPR_ABORT; goto cleanup; } // // Retrieve captured pixel components // if (FAILED(hr = GetPixel(pTestCaseArgs->pDevice, Point.x, // int iXPos, Point.y, // int iYPos, &RedResult, // BYTE *pRed, &GreenResult, // BYTE *pGreen, &BlueResult))) // BYTE *pBlue { DebugOut(DO_ERROR, L"GetPixel failed. (hr = 0x%08x) Aborting.", hr); Result = TPR_ABORT; goto cleanup; } // // Verify resulting pixel component colors // if (FAILED(hr = VerifyIter( pTestCaseArgs->pParms->BackBufferFormat, uiFrameIndex, // UINT uiIteration, D3DMQA_BLEND_TOLERANCE, // UINT uiTolerance RedResult, // BYTE Red, GreenResult, // BYTE Green, BlueResult, // BYTE Blue AlphaTests[dwTableIndex].SourceBlend, // D3DMBLEND SourceBlend AlphaTests[dwTableIndex].DestBlend, // D3DMBLEND DestBlend AlphaTests[dwTableIndex].BlendOp))) // D3DMBLENDOP BlendOp { DebugOut(DO_ERROR, L"VerifyIter failed. (hr = 0x%08x) Failing.", hr); Result = TPR_FAIL; // // Even if test fails because of mismatch, defer the failure; additional iterations may provide // more context for debugging // } } cleanup: if( pVB != NULL ) pVB->Release(); return Result; }
[ "benjamin.barratt@icloud.com" ]
benjamin.barratt@icloud.com
26b834b34f1a20e57713cd9d2863fe6e2adb9e9f
b4b4e324cbc6159a02597aa66f52cb8e1bc43bc1
/C++ code/Uva Online Judge/Q1558(2).cpp
8c1fe39a5018c6f859ff8fc8acbcfed0ad46618e
[]
no_license
fsps60312/old-C-code
5d0ffa0796dde5ab04c839e1dc786267b67de902
b4be562c873afe9eacb45ab14f61c15b7115fc07
refs/heads/master
2022-11-30T10:55:25.587197
2017-06-03T16:23:03
2017-06-03T16:23:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
893
cpp
#include<cstdio> #include<cassert> using namespace std; int T,N; int DP[1<<21]; inline int Choose(const int s,const int v) { assert(s&(1<<v)); int ts=s; for(int i=0;i<=20;i++)if(i!=1&&!(s&(1<<i))) { for(int cnt=1;i+v*cnt<=20;cnt++)ts&=~(1<<(i+v*cnt)); } return ts; } int Win(const int s) { int &dp=DP[s]; if(dp!=-1)return dp; for(int i=2;i<=20;i++)if((s&(1<<i))) { if(Win(Choose(s,i))==0)return dp=1; } return dp=0; } int main() { scanf("%d",&T); for(int i=0;i<(1<<21);i++)DP[i]=-1; while(T--) { scanf("%d",&N); int s=0; for(int i=0,v;i<N;i++)scanf("%d",&v),s|=(1<<v),assert(v>=2&&v<=20); static int kase=1; printf("Scenario #%d:\n",kase++); if(Win(s)==0)puts("There is no winning move."); else { printf("The winning moves are:"); for(int i=2;i<=20;i++)if((s&(1<<i))&&Win(Choose(s,i))==0)printf(" %d",i); puts("."); } puts(""); } return 0; }
[ "fsps60312@yahoo.com.tw" ]
fsps60312@yahoo.com.tw
ded3111eb558cd0fdd210df22ea295bd982748ef
c1db8f7c6ce29cd42f1e3c9587099134ec00ab0e
/util.cc
97b18594ff872b44ff7414d2b28341f0daa38480
[ "Apache-2.0" ]
permissive
aruba/envoy-extn-pkm-provider
9ec930b0fc1d50022cba5be79a191cc8a0ead584
9ec94c4bee946b90db0464d8f63b1b31790e2e48
refs/heads/master
2020-05-31T22:11:53.730942
2019-08-23T20:24:23
2019-08-23T20:24:23
190,514,772
7
1
null
null
null
null
UTF-8
C++
false
false
1,453
cc
/*---------------------------------------------------------------------- * * Organization: Aruba, a Hewlett Packard Enterprise company * Copyright [2019] Hewlett Packard Enterprise Development LP. * * Licensed under the Apache License, Version 2.0 * * ----------------------------------------------------------------------*/ #include <stdio.h> #include <stdexcept> #include <iostream> #include <sstream> #include <iomanip> namespace Envoy { namespace Ssl { int c2i(char input) { if (input >= '0' && input <= '9') return input - '0'; if (input >= 'A' && input <= 'F') return input - 'A' + 10; if (input >= 'a' && input <= 'f') return input - 'a' + 10; throw std::invalid_argument("Input not hexadecimal"); } void hex2binary(const char* src, uint8_t* target) { while (*src && src[1]) { *(target) = c2i(*src) * 16 + c2i(src[1]); target ++; src += 2; } } std::string binary2hex(const void *a, size_t len) { std::ostringstream ret; const unsigned char *in = reinterpret_cast<const unsigned char *>(a); for (size_t i = 0; i < len; i++) { ret << std::hex << std::setfill('0') << std::setw(2) << std::nouppercase << (int)in[i]; } return ret.str(); } void hexdump(const void *a, size_t len) { const unsigned char *in = reinterpret_cast<const unsigned char *>(a); for (size_t i = 0; i < len; i++) { printf("%02x", in[i]); } printf("\n"); } } // namespace Ssl } // namespace Envoy
[ "scheler@arubanetworks.com" ]
scheler@arubanetworks.com
3945466d5f50f03f8db39eb3388cd802360d2db2
b87548b530288b5fcf8dffd4abf016fe552467da
/NaiveMatcher.cpp
da60b0120bbe8a73c620b19bf947e75fb204926c
[]
no_license
JayaniH/String-Matching
589df5411fbef305158d8cce540197b8b5e161b4
bac03d6aa360d1bd3438a7eeb2569674d5e8af3f
refs/heads/master
2022-01-18T09:11:13.578741
2019-06-11T17:34:07
2019-06-11T17:34:07
187,623,828
0
0
null
null
null
null
UTF-8
C++
false
false
617
cpp
#include<iostream> #include<string> using namespace std; class NaiveMatcher{ private: string text,pattern; int n,m; public: NaiveMatcher(string t, string p); void match(); }; NaiveMatcher::NaiveMatcher(string t, string p){ text = t; pattern = p; n = t.length(); m = p.length(); } void NaiveMatcher::match(){ int j; for(int i=0;i<=n-m;i++){ j=0; while(j<m && text[i+j] == pattern[j]){ cout<<text[j+j]<<endl; j++; } if(j==m){ cout<<"pattern found at index "<<i<<endl; return; } } cout<<"No match found"<<endl; } int main(){ NaiveMatcher one("abcdef","def"); one.match(); }
[ "jayani.hewa77@gmail.com" ]
jayani.hewa77@gmail.com
c7f7439be852f452fe8c2908165bd7cb8e1b36f9
7452457bf715cf50f251d086c5c9bfe0821b1538
/include/Furrovine++/Vendor/fbxsdk/scene/fbxscene.h
743b209ee688515faff3b5609f4bc8ecd79f997c
[ "MIT" ]
permissive
bananu7/Furropen
3d91c49b5b833f5f269cf5516a8f8c7cf1385cdc
968351c1268d8994116cd8312f067dd2cacdbf5b
refs/heads/master
2021-01-10T20:44:17.606000
2014-02-13T22:28:09
2014-02-13T22:28:09
null
0
0
null
null
null
null
UTF-8
C++
false
false
23,060
h
/**************************************************************************************** Copyright (C) 2013 Autodesk, Inc. All rights reserved. Use of this software is subject to the terms of the Autodesk license agreement provided at the time of installation or download, or which otherwise accompanies this software in either electronic or hard copy form. ****************************************************************************************/ //! \file fbxscene.h #ifndef _FBXSDK_SCENE_H_ #define _FBXSDK_SCENE_H_ #include <fbxsdk/fbxsdk_def.h> #include <fbxsdk/core/base/fbxset.h> #include <fbxsdk/core/base/fbxcharptrset.h> #include <fbxsdk/scene/fbxdocument.h> #include <fbxsdk/scene/animation/fbxanimevaluator.h> #include <fbxsdk/scene/geometry/fbxlayer.h> #include <fbxsdk/scene/geometry/fbxnodeattribute.h> #include <fbxsdk/fileio/fbxiosettings.h> #include <fbxsdk/fileio/fbxglobalsettings.h> #include <fbxsdk/fbxsdk_nsbegin.h> class FbxGeometry; class FbxTexture; class FbxSurfaceMaterial; class FbxCharacter; class FbxControlSetPlug; class FbxGenericNode; class FbxPose; class FbxCharacterPose; class FbxVideo; class FbxGlobalLightSettings; class FbxGlobalCameraSettings; /** This class contains the description of a 3D scene. It contains the nodes (including the root node) (FbxNode), * materials, textures, videos, gobos, * poses, characters, character poses, control set plugs, * generic nodes, * scene information, global settings, * and a global evaluator. * The nodes are structured in a tree under the scene's root node. * * When an object is created using the FBX SDK, a scene is usually passed as argument to the * object creation function to specify that the object belongs to this scene. * At this point, a connection is made with the object as source and the scene as destination. * * All objects in the scene can be queried by connection index. In addition, * generic nodes, materials, and textures can also be queried by name. In this latter case, the * first object with the queried name will be returned. * * The global evaluator (FbxAnimEvaluator) is used to compute animation values * for animated scenes. * \nosubgrouping */ class FBXSDK_DLL FbxScene : public FbxDocument { FBXSDK_OBJECT_DECLARE(FbxScene, FbxDocument); public: /** * \name Clear scene */ //@{ //! Delete the node tree below the root node and restore default settings. void Clear(); //@} /** * \name Node Tree Access */ //@{ /** Get the root node of the scene. * \return Pointer to the root node. * \remarks This node is not saved. Do not use it to apply a global transformation * to the node hierarchy. If a global transformation must be applied, insert a * new node below this one. */ FbxNode* GetRootNode() const; //@} /** * \name Texture Material and Video Access */ //@{ /** Clear, then fill, a texture array with all existing textures included in the scene. * \param pTextureArray An array of texture pointers. */ void FillTextureArray(FbxArray<FbxTexture*>& pTextureArray); /** Clear, then fill, a material array with all existing materials included in the scene. * \param pMaterialArray An array of material pointers. */ void FillMaterialArray(FbxArray<FbxSurfaceMaterial*>& pMaterialArray); //@} /** * \name Generic Node Access */ //@{ /** Get number of generic nodes in the scene. * \return Number of Generic Nodes in this scene. */ int GetGenericNodeCount() const; /** Get generic node at given index. * \param pIndex Position in the list of the generic nodes. * \return Pointer to the generic node or \c NULL if the index is out of bounds. */ FbxGenericNode* GetGenericNode(int pIndex); /** Access a generic node from its name. * \param pName Name of the generic node. * \return found generic node */ FbxGenericNode* GetGenericNode(char* pName); /** Add a generic node to this scene. * \param pGenericNode Pointer to the generic node to be added. * \return If the passed parameter is \c NULL, this method will return \c false, otherwise \c true. */ bool AddGenericNode(FbxGenericNode* pGenericNode); /** Remove the generic node from this scene. * \param pGenericNode Pointer to the generic node to be removed. * \return If the passed parameter is \c NULL, this method will return \c false, otherwise \c true. * \remarks The pointed object is not referenced by the scene anymore but is not deleted. */ bool RemoveGenericNode(FbxGenericNode* pGenericNode); //@} /** * \name Character Management */ //@{ /** Get number of characters. * \return Number of characters in this scene. */ int GetCharacterCount() const; /** Get character at given index. * \param pIndex Position in the list of the characters. * \return Pointer to the character or \c NULL if index is out of bounds. */ FbxCharacter* GetCharacter(int pIndex); /** Create a new character. * \param pName Name given to character. * \return Index of the created character. */ int CreateCharacter(const char* pName); /** Destroy character. * \param pIndex Specify which character to destroy. */ void DestroyCharacter(int pIndex); //@} /** * \name ControlSetPlug Management */ //@{ /** Get number of ControlSetPlugs. * \return Number of ControlSet plugs in this scene. */ int GetControlSetPlugCount() const; /** Get ControlSetPlug at given index. * \param pIndex Position in the list of the ControlSetPlug * \return Pointer to ControlSetPlug or \c NULL if index is out of bounds. */ FbxControlSetPlug* GetControlSetPlug(int pIndex); /** Create a new ControlSetPlug. * \param pName Name given to ControlSetPlug. * \return Index of created ControlSetPlug. */ int CreateControlSetPlug(char* pName); /** Destroy ControlSetPlug. * \param pIndex Specify which ControlSetPlug to destroy. */ void DestroyControlSetPlug(int pIndex); //@} /** * \name Character Pose Management */ //@{ /** Get number of character poses. * \return Number of character poses in this scene. * \remarks Character Poses and Poses are two distinct entities having their own lists. */ int GetCharacterPoseCount() const; /** Get character pose at given index. * \param pIndex Position in the list of character poses. * \return Pointer to the character pose or \c NULL if index is out of bounds. */ FbxCharacterPose* GetCharacterPose(int pIndex); /** Create a new character pose. * \param pName Name given to character pose. * \return Index of created character pose. */ int CreateCharacterPose(char* pName); /** Destroy character pose. * \param pIndex Specify which character pose to destroy. */ void DestroyCharacterPose(int pIndex); //@} /** * \name Pose Management */ //@{ /** Get number of poses. * \return Number of poses in the scene. * \remarks Poses and Character Poses are two distinct entities having their own lists. */ int GetPoseCount() const; /** Get pose at given index. * \param pIndex Position in the list of poses. * \return Pointer to the pose or \c NULL if index is out of bounds. */ FbxPose* GetPose(int pIndex); /** Add a pose to this scene. * \param pPose The pose (for example: bind pose, rest pose) to be added to the scene. * \return If the pose is correctly added to the scene, return \c true. Otherwise, if the pose is * already in the scene, return \c false. */ bool AddPose(FbxPose* pPose); /** Remove the specified pose from the scene. * \param pPose The pose (for example: bind pose, rest pose) to be removed from the scene. * \return If the pose was successfully removed from the scene, return \c true. Otherwise, if the * pose could not be found return \c false. */ bool RemovePose(FbxPose* pPose); /** Remove the pose at the given index from the scene. * \param pIndex Index of the pose to be removed. * \return If the pose was successfully removed from the scene, return \c true. Otherwise, if the * pose could not be found return \c false. */ bool RemovePose(int pIndex); //@} /** * \name Scene information */ //@{ /** Get the scene information. * \return Pointer to the scene information object. */ inline FbxDocumentInfo* GetSceneInfo() { return GetDocumentInfo(); } /** Set the scene information. * \param pSceneInfo Pointer to the scene information object. */ inline void SetSceneInfo(FbxDocumentInfo* pSceneInfo) { SetDocumentInfo(pSceneInfo); } //@} /** * \name Global Settings */ //@{ /** Access global settings. * \return Reference to the Global Settings. */ FbxGlobalSettings& GetGlobalSettings(); /** Const access to global settings. * \return Const reference to the Global Settings. */ const FbxGlobalSettings& GetGlobalSettings() const; //@} /** * \name Global Evaluator * The global evaluator is used to compute animation values * for animated scenes. * A typical usage would be to compute the global transform * matrix of a node \c lNode at a given time \c lTime. * \code FbxAMatrix& lGlobalMatrix = lNode->GetScene()->GetEvaluator()->GetNodeGlobalTransform(lNode, lTime); or the exact equivalent: FbxAMatrix& lGlobalMatrix = lNode->EvaluateGlobalTransform(lTime); * \endcode * * The user can create one or more evaluators in the scene. * The default evaluator is set using SetEvaluator. * When GetEvaluator is called, if the scene has no evaluator, * an evaluator is created with default values. */ //@{ /** Set the global evaluator used by this scene evaluation engine. * \param pEvaluator The evaluator to be used for evaluation processing of this scene. */ void SetEvaluator(FbxAnimEvaluator* pEvaluator); /** Get the global evaluator used by this scene evaluation engine. * If no evaluator were previously set, this function will return either the * first evaluator found attached to this scene, or a new default evaluator. * \return The evaluator to be used for evaluation processing of this scene. */ FbxAnimEvaluator* GetEvaluator(); //@} /** Clear then fill a pose array with all existing pose included in the scene. * \param pPoseArray An array of pose pointers. */ void FillPoseArray(FbxArray<FbxPose*>& pPoseArray); /** * \name Material Access */ //@{ /** Get number of materials. * \return Number of materials in this scene. */ int GetMaterialCount () const; /** Get the material at the given index. * \param pIndex Position in the list of materials. * \return Pointer to the material or \c NULL if the index is out of bounds. * \remarks pIndex must be between 0 and GetMaterialCount(). */ FbxSurfaceMaterial* GetMaterial (int pIndex); /** Get the material by its name. * \param pName Name of the material. * \return Pointer to the material or \c NULL if not found. */ FbxSurfaceMaterial* GetMaterial (char* pName); /** Add the material to this scene. * \param pMaterial Pointer to the material to be added. * \return true on successful addition. */ bool AddMaterial (FbxSurfaceMaterial* pMaterial); /** Remove the material from this scene. * \param pMaterial Pointer to the material to be removed. * \return true on successful removal. */ bool RemoveMaterial (FbxSurfaceMaterial* pMaterial); //@} /** * \name Texture Access */ //@{ /** Get number of textures (type FbxTexture). * \return Number of textures in this scene. Includes types FbxFileTexture, FbxLayeredTexture and FbxProceduralTexture. * \remarks To get the number of textures of a specific type, use GetSrcCount(). For example: * \code * int lNbFileTextures = lScene->GetSrcObjectCount<FbxFileTexture>(); * int lNbLayeredTextures = lScene->GetSrcObjectCount<FbxLayeredTexture>(); * int lNbProceduralTextures = lScene->GetSrcObjectCount<FbxProceduralTexture>(); * \endcode */ int GetTextureCount () const; /** Get the texture at the given index. pIndex must be between 0 and GetTextureCount(). * \param pIndex Position in the list of textures. * \return Pointer to the texture or \c NULL if the index is out of bounds. * \remarks To get the texture of a specific texture type, use GetSrcObject(). For example: * \code * FbxFileTexture* lFileTexture = lScene->GetSrcObject<FbxFileTexture>(i); * FbxLayeredTexture* lLayeredTexture = lScene->GetSrcObject<FbxLayeredTexture>(i); * FbxProceduralTexture* lProceduralTexture = lScene->GetSrcObject<FbxProceduralTexture>(i); * \endcode */ FbxTexture* GetTexture (int pIndex); /** Get the texture by its name. * \param pName Name of the texture. * \return Pointer to the texture or \c NULL if not found. */ FbxTexture* GetTexture (char* pName); /** Add the texture to this scene. * \param pTexture Pointer to the texture to be added. * \return \c true on successful addition. */ bool AddTexture (FbxTexture* pTexture); /** Remove the texture from this scene. * \param pTexture Pointer to the texture to be removed. * \return \c true on successful removal. */ bool RemoveTexture (FbxTexture* pTexture); //@} /** * \name Node Access */ //@{ /** Get number of nodes. * \return Number of nodes in this scene. */ int GetNodeCount () const; /** Get the node at the given index. * \param pIndex Position in the list of nodes. * \return Pointer to the node or \c NULL if the index is out of bounds. * \remarks pIndex must be between 0 and GetNodeCount(). */ FbxNode* GetNode (int pIndex); /** Add the node to this scene. * \param pNode Pointer to the node to be added. * \return true on successful addition. */ bool AddNode (FbxNode* pNode); /** Remove the node from this scene. * \param pNode Pointer to the node to be removed. * \return true on successful removal. */ bool RemoveNode (FbxNode* pNode); /** Helper method for determining the number of nodes that have * curves on surface attributes in the scene. Since the curve-on-surface * nodes are connected to nurbs geometry and not any FbxNode in the * scene, they won't normally be picked up in a graph traversal. * \return The number of curve-on-surface nodes in the scene */ int GetCurveOnSurfaceCount (); /** Get the first node with this name. * \param pName Name of the node. * \return Pointer to the node, or \c NULL if node is not found. */ FbxNode* FindNodeByName ( const FbxString& pName ); //@} /** * \name Geometry Access */ //@{ /** Get number of geometries. * \return Number of geometries in this scene. */ int GetGeometryCount () const; /** Get the geometry at the given index. * \param pIndex Position in the list of geometries. * \return Pointer to the geometry or \c NULL if the index is out of bounds. * \remarks pIndex must be between 0 and GetGeometryCount(). */ FbxGeometry* GetGeometry (int pIndex); /** Add the geometry to this scene. * \param pGeometry Pointer to the geometry to be added. * \return true on successful addition. */ bool AddGeometry (FbxGeometry* pGeometry); /** Remove the geometry from this scene. * \param pGeometry Pointer to the geometry to be removed. * \return true on successful removal. */ bool RemoveGeometry (FbxGeometry* pGeometry); //@} /** * \name Video Access */ //@{ /** Get number of videos. * \return Number of videos in this scene. */ int GetVideoCount () const; /** Get the video at the given index. * \param pIndex Position in the list of videos. * \return Pointer to the video or \c NULL if the index is out of bounds. * \remarks pIndex must be between 0 and GetVideoCount(). */ FbxVideo* GetVideo (int pIndex); /** Add the video to this scene. * \param pVideo Pointer to the video to be added. * \return true on successful addition. */ bool AddVideo (FbxVideo* pVideo); /** Remove the video from this scene. * \param pVideo Pointer to the video to be removed. * \return true on successful removal. */ bool RemoveVideo (FbxVideo* pVideo); //@} /** * \name Utilities */ //@{ /** Synchronize all the Show properties of node instances. * Walks all the node attributes defined in the scene and synchronize the Show property * of all the nodes that reference the node attribute so that they all contain the same * value. This method should be called after the FBX scene is completely created (typically * right after the calls to the FbxImporter::Import() or just before the calls to the * FbxExporter::Export(). * * \remarks Applications only need to call this method if their interpretation of the Show * property implies that setting the Show state on one instance affect all of them. * * \see FbxNode::Visibility property, FbxNode::Show property */ void SyncShowPropertyForInstance(); //@} /***************************************************************************************************************************** ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! ** *****************************************************************************************************************************/ #ifndef DOXYGEN_SHOULD_SKIP_THIS /** Clone this scene object (and everything else it contains if clone type is eDeepClone) * \param pCloneType The type of clone to be created. By default, the clone type is eDeepClone. * \param pContainer An optional parameter to specify which object will "contain" the new object. By contain, we mean the new object * will become a source to the container, connection-wise. * \return The new clone, or NULL (if the specified clone type is not supported). * \remark This method overwrites the FbxObject::Clone() method. When the clone type is "deep", the whole scene network is cloned. With the "reference" * clone type, this method is simply calling the parent's Clone() method */ virtual FbxObject* Clone(FbxObject::ECloneType pCloneType=eDeepClone, FbxObject* pContainer=NULL) const; virtual FbxObject& Copy(const FbxObject& pObject); void ConnectMaterials(); void BuildMaterialLayersDirectArray(); void ReindexMaterialConnections(); // called to make sure that eIndex is remapped to eIndexToDirect FbxSet* AddTakeTimeWarpSet(char *pTakeName); FbxSet* GetTakeTimeWarpSet(char *pTakeName); // This function will destroy the scene (and all the objects directly connected to it) without sending // the Connect notifications nor trying to disconnect the objects first. This is a bypass of the intended // workflow and should be used with care. void ForceKill(); private: virtual void Construct(const FbxScene* pFrom); virtual void Destruct(bool pRecursive); void ConnectTextureLayerElement(FbxLayerContainer* pLayerContainer, FbxLayerElement::EType pLayerType, FbxNode* pParentNode); void BuildTextureLayersDirectArrayForLayerType(FbxLayerContainer* pLayerContainer, FbxLayerElement::EType pLayerType); public: void ConvertNurbsSurfaceToNurbs(); void ConvertMeshNormals(); void ConvertNurbsCurvesToNulls(); void ConnectTextures(); void BuildTextureLayersDirectArray(); void FixInheritType(FbxNode *pNode); void UpdateScaleCompensate(FbxNode *pNode, FbxIOSettings& pIOS); FbxClassId ConvertAttributeTypeToClassID(FbxNodeAttribute::EType pAttributeType); // These data structures are only used for legacy FBX files (version 6.x and earlier). The // validity of their content is not guaranteed with the most recent versions. FbxGlobalLightSettings& GlobalLightSettings() { return *mGlobalLightSettings; } FbxGlobalCameraSettings& GlobalCameraSettings() { return *mGlobalCameraSettings; } private: FbxNode* mRootNode; FbxGlobalLightSettings* mGlobalLightSettings; FbxGlobalCameraSettings* mGlobalCameraSettings; FbxAnimEvaluator* mEvaluator; FbxCharPtrSet mTakeTimeWarpSet; #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ }; #include <fbxsdk/fbxsdk_nsend.h> #endif /* _FBXSDK_SCENE_H_ */
[ "phdofthehouse@gmail.com" ]
phdofthehouse@gmail.com
a5319c39c3db520b09993aca194b3e43e3486555
4ccc93c43061a18de9064569020eb50509e75541
/chrome/browser/chromeos/file_manager/video_player_browsertest.cc
983569261dc33bb4297b6f0cc8916d8e0098a59d
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
SaschaMester/delicium
f2bdab35d51434ac6626db6d0e60ee01911797d7
b7bc83c3b107b30453998daadaeee618e417db5a
refs/heads/master
2021-01-13T02:06:38.740273
2015-07-06T00:22:53
2015-07-06T00:22:53
38,457,128
4
1
null
null
null
null
UTF-8
C++
false
false
1,848
cc
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/chromeos/file_manager/file_manager_browsertest_base.h" #include "chromeos/chromeos_switches.h" namespace file_manager { template <GuestMode M> class VideoPlayerBrowserTestBase : public FileManagerBrowserTestBase { public: GuestMode GetGuestModeParam() const override { return M; } const char* GetTestCaseNameParam() const override { return test_case_name_.c_str(); } protected: void SetUpCommandLine(base::CommandLine* command_line) override { command_line->AppendSwitch( chromeos::switches::kEnableVideoPlayerChromecastSupport); FileManagerBrowserTestBase::SetUpCommandLine(command_line); } const char* GetTestManifestName() const override { return "video_player_test_manifest.json"; } void set_test_case_name(const std::string& name) { test_case_name_ = name; } private: std::string test_case_name_; }; typedef VideoPlayerBrowserTestBase<NOT_IN_GUEST_MODE> VideoPlayerBrowserTest; typedef VideoPlayerBrowserTestBase<IN_GUEST_MODE> VideoPlayerBrowserTestInGuestMode; IN_PROC_BROWSER_TEST_F(VideoPlayerBrowserTest, OpenSingleVideoOnDownloads) { set_test_case_name("openSingleVideoOnDownloads"); StartTest(); } IN_PROC_BROWSER_TEST_F(VideoPlayerBrowserTestInGuestMode, OpenSingleVideoOnDownloads) { set_test_case_name("openSingleVideoOnDownloads"); StartTest(); } IN_PROC_BROWSER_TEST_F(VideoPlayerBrowserTest, OpenSingleVideoOnDrive) { set_test_case_name("openSingleVideoOnDrive"); StartTest(); } IN_PROC_BROWSER_TEST_F(VideoPlayerBrowserTest, CheckInitialElements) { set_test_case_name("checkInitialElements"); StartTest(); } } // namespace file_manager
[ "g4jc@github.com" ]
g4jc@github.com
12b1ecf376ee6d0643cd7cb31655c5e6c55049d1
ab8a01ff95838916e6da377ef211e1838b7b3504
/structure/SegTree/RangeMinimumQuery.cpp
de5bfe4a69fc18fa5c3da7496e7485df6f13f680
[]
no_license
chakku000/algorithm
1b7de8a890e071dd32f9f5355d05a2cb73b53894
d6ea33177337d5dc5a6426cc6f1cc2a0ca752739
refs/heads/master
2021-06-16T19:12:25.301447
2021-02-05T15:54:26
2021-02-05T15:54:26
148,676,681
1
0
null
null
null
null
UTF-8
C++
false
false
743
cpp
template<typename T,T iniv=0> struct Segtree{ int n; vector<T> dat; Segtree(int n_){ n = 1; while(n < n_) n *= 2; dat.resize(2*n-1); for(int i=0;i<2*n-1;i++) dat[i]=iniv; } void update(int k,T a){ k+=n-1; dat[k]=a; while(k>0){ k=(k-1)/2; dat[k]=min(dat[k*2+1],dat[k*2+2]); } } T query(int a,int b,int k,int l,int r){ if(r<=a or b<=l) return iniv; else if(a<=l and r<=b) return dat[k]; else{ T vl = query(a,b,k*2+1,l,(l+r)/2); T vr = query(a,b,k*2+2,(l+r)/2,r); return min(vl,vr); } } T query(int a,int b){ return query(a,b,0,0,n); } };
[ "chakkurai0724@outlook.jp" ]
chakkurai0724@outlook.jp
5662c04bacf95aa7361c30c90444e3997b8f0c57
3809d83f905e9d3b28f3b174142795a9757a2d00
/YMusic/YMusic/src/MainWindow/YMainWindow.h
7b8442064127bcd3dd0758d360ce41d4eec7e548
[]
no_license
xywwf/myduilib
a3b14c5c58d9e5284d146a30904b44111cf79a8f
195b0383ae6555b4c24e7297413b8fccdbe88cef
refs/heads/master
2020-05-16T10:40:30.844164
2015-07-07T13:23:54
2015-07-07T13:23:54
null
0
0
null
null
null
null
GB18030
C++
false
false
7,737
h
#ifndef __YMainWindow_h #define __YMainWindow_h #pragma once #include "../../YMusic.h" #include "../LrcView/LrcView.h" #include "../MusicLib/MusicLib.h" #include "../DesktopLrc/DesktopLrcWindow.h" class YMainWindow : public YWindow , public INotifyUI , public IDialogBuilderCallback { public: YMainWindow(); virtual ~YMainWindow(); public: static LPCTSTR GetWindowClsss() ; LPCTSTR GetWindowClassName() const; UINT GetClassStyle() const; void OnFinalMessage( HWND hWnd ); CControlUI* CreateControl(LPCTSTR pstrClass); void Notify(TNotifyUI& msg); void OnValueChanged(const TNotifyUI& msg); void OnItemActivate(const TNotifyUI& msg); void OnItemSelect(const TNotifyUI& msg); void OnSelectChanged(const TNotifyUI& msg); void OnClick(const TNotifyUI& msg); void OnMenu(const TNotifyUI& msg); void OnBlur(const TNotifyUI& msg); void OnReturn(const TNotifyUI& msg); void OnTimer(const TNotifyUI& msg); void OnPlayListMenu(const TNotifyUI& msg); void OnSongListMenu(const TNotifyUI& msg); void OnSongItemMenu(const TNotifyUI& msg); bool OnVolumeLayoutUIEvent(void* pParam); void OnShowPlayModeMenu(); void OnShowMainMenu(); void OnShowMiniMode(); void OnShowSkinWindow(); void OnShowLoginWindow(); void OnShowShareWindow(); void OnGoNextLayout(const TNotifyUI& msg); void OnGoBackLayout(const TNotifyUI& msg); void OnGoDeskLayout(const TNotifyUI& msg); void OnShowLrcViewMenu(const TNotifyUI& msg); void SendNotify(LPCTSTR lpControl,LPCTSTR sType); public: void ShowTrayInfo(spSongInfoT spSong); void ShowTrayTooltip(TCHAR* szTip,TCHAR* szTitle); void ShowTrayMenu(); void TryAutoLogin(); void AddTracyIcon(); void PlayOrPause(bool bPlay = true); void NextSong(); void PrevSong(); void Stop(); void Play(); void Pause(); static void CallbackPlaying(void *data); static void CallbackPosChanged(void *data); static void CallbackEndReached(void *data); int ShowDetailAddingInfo(CFileMgr::filesArrayT files,void* param); protected: void InitVariable(); virtual LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); virtual LRESULT OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); virtual LRESULT OnMenuCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); virtual LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); virtual LRESULT OnHotKey(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); virtual LRESULT OnMoving(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); virtual LRESULT OnSizing(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); virtual LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); virtual LRESULT OnTaskbarCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); virtual LRESULT OnTaskbarButtonCreate(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL& bHandled); virtual LRESULT OnTrayNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); virtual LRESULT OnWebService(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); virtual LRESULT ProcessWindowMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); virtual LRESULT OnPlayerPlaying(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); virtual LRESULT OnPlayerPosChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); virtual LRESULT OnPlayerEndReached(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); virtual LRESULT OnUserLogin(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); virtual LRESULT OnHttpfileDownload(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); static void CallbackPlayer(void *data, UINT uMsg); /*protected:*/ public: void OnPlayListChanged(/*CNotifyCenter::NotifyT& notify*/); void OnCurPlayListChanged(/*CNotifyCenter::NotifyT& notify*/); void OnPlayListSongChanged(/*CNotifyCenter::NotifyT& notify*/); void OnNetChanged(/*CNotifyCenter::NotifyT& notify*/); void OnUserChanged(/*CNotifyCenter::NotifyT& notify*/); void OnVersionExpired(/*CNotifyCenter::NotifyT& notify*/); void OnSkinChanged(/*CNotifyCenter::NotifyT& notify*/); void OnSongStatusChanged(bool bPlay = true); void UpdateDowningProgress(); void UpdatePlayingProgress(); void UpdateBufferingProgress(); void ShowSongInfo(spSongInfoT song); void UpdateUserName(); void UpdatePlayList(); void UpdateSongList(int nPlayListId); void UpdateFavList();//收藏列表 void CreateAddSongThread(bool bOpenFile); static DWORD WINAPI _ThreadProc_AddSong(void* param); void _AddSongProc(void* param); void _AddSongProc2(unsigned int u_listId,CFileMgr::filesArrayT files); int OnAddPlayList();//添加列表 void OnOpenProperty(spSongInfoT spSong);//查看属性 void OnOpenFolderPath(LPCTSTR sPath);//打开所在目录 void ShowInfo(CString sInfo);//操作提示 int OnMenuCommandPlayList(MenuCmdMsg* pMsg); int OnMenuCommandSongList(MenuCmdMsg* pMsg); int OnMenuCommadnPlayMode(MenuCmdMsg* pMsg); int OnMenuCommandSongItem(MenuCmdMsg* pMsg); int OnMenuCommandLrcView(MenuCmdMsg* pMsg); int OnMenuCommandMainMenu(MenuCmdMsg* pMsg); void OnRemoveSongFromList(unsigned int nPlayListID,unsigned int nSongIndex); void OnRemoveSongsFromList(unsigned int nPlayListID); void OnCollectSongFromList(unsigned int nPlayListID,unsigned int nSongIndex); void OnCollectSongsFromList(unsigned int nPlayListID); void OnShareSongFromList(unsigned int nPlayListID,unsigned int nSongIndex); void OnShareSongsFromList(unsigned int nPlayListID); void OnDownLoadSongFromList(unsigned int nPlayListID,unsigned int nSongIndex); void OnDownLoadSongsFromList(unsigned int nPlayListID); void OnAddSongtoNewList(unsigned int nSongIndex,unsigned int nPlayListID,unsigned int nNewListID,bool bMove = false); void OnAddSongstoNewList(unsigned int nPlayListID,unsigned int nNewListID,bool bMove = false); void OnRemoveDumplicate(unsigned int nPlayListID); // 去重 public: typedef CComPtr<ITaskbarList4> spTaskbarListT; public: spTaskbarListT GetTaskbarList() const; YMusicLibWnd* GetMusicLibWin() const; CDesktopLrcWindow* GetDesktopLrcWin()const; YMusicLibWnd* GetMusicLibWin2() const; CDesktopLrcWindow* GetDesktopLrcWin2()const; void ShowMusicLibWin(BOOL bShow = TRUE); void ShowDesktopLrcWin(BOOL bShow = TRUE); void ShowPanelLrcTab(BOOL bShow = TRUE); void ShowSelectLrcWin(); void ShowSettingWin(); void ShowSkinWin(); void LoadSongLrc(); void SetBkColor(DWORD dwCor); void SetBkImage(LPCTSTR szImage); void AddReceive(SkinChangedReceiver* win); void BroadCast(); private: DECLARE_SINGLETON_CLASS(YMainWindow); private: typedef struct uiCompent { CListUI* _pPlayList; CListUI* _pSongList; CAnimationTabLayoutUI *_pTabLayout; CFadeCheckBoxUI* _pVolumeBtn; CSliderUI* _pVolumeSlider; CTabLayoutUI* _pVolumeTab; CLabelUI* _pTimeUsed; CLabelUI* _pTimeTotal; CSliderUI* _pPlayProgress; CLabelUI* _pSongName; CLabelUI* _pAlbumName; CFadeCheckBoxUI* _pCollect; CFadeButtonUI* _pShare; CHorizontalLayoutUI* _pInfoLayout; CLabelUI* _pInfoLabel; CLabelUI* _pCountLabel; CAnimationTabLayoutUI *_pLrcViewTab; CLrcViewUI* _pLrcView1; }_UICompent; uiCompent _ui; bool _bOpenFile; HICON _hOnlineIcon; HICON _hOfflineIcon; CTrayIconController _trayIcon; spTaskbarListT _pTaskbarList; YMusicLibWnd* m_pMusicLibWnd; CDesktopLrcWindow* m_pDesktopLrcWnd; UINT _uTaskbarButtonCreateMsg; UINT _uTaskbarCreatedMsg; SkinChangedObserver skin_changed_observer_; }; #endif//__YMainWindow_h
[ "389465209@qq.com" ]
389465209@qq.com
c88999d1ea58009391a2ec0fbd4f9ee748711bb4
94ed2113af11ba8b716fb959c5ac0a32c5549c18
/tests/pyre.lib/grid/index_fill.cc
13ddf25fa77808f62b12814c137d9ae96fe42135
[ "BSD-3-Clause" ]
permissive
avalentino/pyre
85ba21388514dc8c206d5136760e23b39aba1cae
7e1f0287eb7eba1c6d1ef385e5160079283ac363
refs/heads/main
2023-03-23T04:58:02.903369
2021-03-09T17:37:11
2021-03-09T17:37:11
347,723,195
0
0
NOASSERTION
2021-03-14T18:43:34
2021-03-14T18:43:33
null
UTF-8
C++
false
false
1,298
cc
// -*- c++ -*- // // michael a.g. aïvázis <michael.aivazis@para-sim.com> // (c) 1998-2021 all rights reserved // support #include <cassert> // get the grid #include <pyre/grid.h> // type alias using idx_t = pyre::grid::index_t<4>; // exercise the filling constructor int main(int argc, char * argv[]) { // initialize the journal pyre::journal::init(argc, argv); pyre::journal::application("index_fill"); // make a channel pyre::journal::debug_t channel("pyre.grid.index"); // pick a value constexpr idx_t::rank_type u = 42; // make a const index constexpr idx_t idx_1 { u }; // show me channel << "idx_1: " << idx_1 << pyre::journal::endl(__HERE__); // verify the contents static_assert (idx_1[0] == u); static_assert (idx_1[1] == u); static_assert (idx_1[2] == u); static_assert (idx_1[3] == u); // again, at runtime idx_t::rank_type v = argc; // with another index const idx_t idx_2 { v }; // show me channel << "idx_2: " << idx_2 << pyre::journal::endl(__HERE__); // verify the contents assert(( idx_2[0] == v )); assert(( idx_2[1] == v )); assert(( idx_2[2] == v )); assert(( idx_2[3] == v )); // all done return 0; } // end of file
[ "michael.aivazis@para-sim.com" ]
michael.aivazis@para-sim.com
61dbb82368ea137f87392238687efd3450c0c919
8834b745b49a9593507c7854804f982680733fc5
/初级算法/验证二叉搜索树/C++/citation.cpp
c6443ef82c03e1b5610e782ce1efb1315cfa8cd5
[]
no_license
xingkaihao/Leetcode
739105eb6416d0480a36f532b8abf894980465d2
61b6a4ce0854b81e9a095b8ba0fba91fe92c60b5
refs/heads/master
2020-04-08T02:26:00.583629
2019-08-22T02:32:20
2019-08-22T02:32:20
158,935,556
0
0
null
null
null
null
GB18030
C++
false
false
691
cpp
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; * 思路和python一样,注意INT64_MIN=-2^32、INT64_MAX=2^32-1,以及long数据类型的使用。 */ class Solution { public: bool isValidBST(TreeNode* root) { return ValidBST(root, INT64_MIN, INT64_MAX); } bool ValidBST(TreeNode* root, long small, long large){ if(root==NULL) return true; if(small >= root->val || large <= root->val) return false; return ValidBST(root->left, small, root->val) && ValidBST(root->right, root->val, large); } };
[ "18202419054@163.com" ]
18202419054@163.com
f20a42f3d12996465ec5fb214b064e04abd244e9
88dcce19274d00eb1ad4970fb14242a98d214b8f
/Packages/java/io/ByteArrayOutputStream.cxx
5942d985ab486ee15e8f8226457db545026b47ae
[ "MIT" ]
permissive
Brandon-T/Aries
0802db9dac0fe6204c3c520bbfac9fbdbcd8a689
4e8c4f5454e8c7c5cd0611b1b38b5be8186f86ca
refs/heads/master
2021-09-07T16:02:21.520864
2018-02-25T18:25:24
2018-02-25T18:25:24
104,820,745
0
0
null
null
null
null
UTF-8
C++
false
false
2,012
cxx
// // ByteArrayOutputStream.cxx // Aries // // Created by Brandon on 2017-08-26. // Copyright © 2017 Brandon. All rights reserved. // #include "ByteArrayOutputStream.hxx" using java::io::ByteArrayOutputStream; ByteArrayOutputStream::ByteArrayOutputStream(JVM* jvm) : OutputStream(nullptr) { if (jvm) { this->vm = jvm; this->cls = JVMRef<jclass>(this->vm, this->vm->FindClass("Ljava/io/ByteArrayOutputStream;")); jmethodID constructor = this->vm->GetMethodID(this->cls.get(), "<init>", "()V"); this->inst = JVMRef<jobject>(this->vm, vm->NewObject(this->cls.get(), constructor)); } } ByteArrayOutputStream::ByteArrayOutputStream(JVM* jvm, jint size) : OutputStream(nullptr) { if (jvm) { this->vm = vm; this->cls = JVMRef<jclass>(this->vm, this->vm->FindClass("Ljava/io/ByteArrayOutputStream;")); jmethodID constructor = this->vm->GetMethodID(this->cls.get(), "<init>", "(I)V"); this->inst = JVMRef<jobject>(this->vm, this->vm->NewObject(this->cls.get(), constructor, size)); } } void ByteArrayOutputStream::reset() { jmethodID resetMethod = this->vm->GetMethodID(this->cls.get(), "reset", "()V"); this->vm->CallVoidMethod(this->inst.get(), resetMethod); } int ByteArrayOutputStream::size() { jmethodID sizeMethod = this->vm->GetMethodID(this->cls.get(), "size", "()I"); return this->vm->CallIntMethod(this->inst.get(), sizeMethod); } Array<jbyte> ByteArrayOutputStream::toByteArray() { jmethodID toByteArrayMethod = this->vm->GetMethodID(this->cls.get(), "toByteArray", "()[B"); jbyteArray bytes = static_cast<jbyteArray>(this->vm->CallObjectMethod(this->inst.get(), toByteArrayMethod)); return Array<jbyte>(this->vm, bytes); } void ByteArrayOutputStream::writeTo(OutputStream out) { jmethodID writeToMethod = this->vm->GetMethodID(this->cls.get(), "writeTo", "(Ljava/io/OutputStream;)V"); this->vm->CallVoidMethod(this->inst.get(), writeToMethod, out.ref().get()); }
[ "JustBrandonT@gmail.com" ]
JustBrandonT@gmail.com
95c35696a4febe1cf3ea84ae5dda10a16b27caa7
a0d4581536b07075171dc22ccedd683ad5a0a573
/internal/.laplacian/testing/testing_chetrd_gpu.cpp
b17d7e9229fc1487a9ad669dc27a74fd49b21d57
[ "Apache-2.0" ]
permissive
KyungWonPark/Correlation
0e3a37c3819b1f377ec90b8fa26198bb2afad72b
827b3c369161e1e5be1b29c73364dcf0cd44d1c0
refs/heads/master
2023-04-18T15:41:45.549415
2021-04-30T01:15:05
2021-04-30T01:15:05
297,269,204
0
0
null
null
null
null
UTF-8
C++
false
false
8,535
cpp
/* -- MAGMA (version 2.5.3) -- Univ. of Tennessee, Knoxville Univ. of California, Berkeley Univ. of Colorado, Denver @date March 2020 @author Raffaele Solca @author Stan Tomov @author Azzam Haidar @author Mark Gates @generated from testing/testing_zhetrd_gpu.cpp, normal z -> c, Sun Mar 29 20:48:33 2020 */ // includes, system #include <stdlib.h> #include <stdio.h> #include <string.h> #include <math.h> // includes, project #include "flops.h" #include "magma_v2.h" #include "magma_lapack.h" #include "testings.h" #define COMPLEX /* //////////////////////////////////////////////////////////////////////////// -- Testing chetrd_gpu */ int main( int argc, char** argv) { TESTING_CHECK( magma_init() ); magma_print_environment(); real_Double_t gflops, gpu_perf, cpu_perf, gpu_time, cpu_time; float eps; magmaFloatComplex *h_A, *h_R, *h_Q, *h_work, *work; magmaFloatComplex_ptr d_R, dwork; magmaFloatComplex *tau; float *diag, *offdiag; float result[2] = {0., 0.}; magma_int_t N, lda, ldda, lwork, info, nb, ldwork; magma_int_t ione = 1; magma_int_t itwo = 2; magma_int_t ithree = 3; int status = 0; #ifdef COMPLEX float *rwork; #endif eps = lapackf77_slamch( "E" ); magma_opts opts; opts.parse_opts( argc, argv ); float tol = opts.tolerance * lapackf77_slamch("E"); printf("%% Available versions (specify with --version):\n"); printf("%% 1 - magma_chetrd_gpu: uses CHEMV from CUBLAS (default)\n"); printf("%% 2 - magma_chetrd2_gpu: uses CHEMV from MAGMA BLAS that requires extra space\n\n"); printf("%% uplo = %s, version %lld\n", lapack_uplo_const(opts.uplo), (long long) opts.version); printf("%% N CPU Gflop/s (sec) GPU Gflop/s (sec) |A-QHQ^H|/N|A| |I-QQ^H|/N\n"); printf("%%==========================================================================\n"); for( int itest = 0; itest < opts.ntest; ++itest ) { for( int iter = 0; iter < opts.niter; ++iter ) { N = opts.nsize[itest]; lda = N; ldda = magma_roundup( N, opts.align ); // multiple of 32 by default nb = magma_get_chetrd_nb(N); lwork = N*nb; /* We suppose the magma nb is bigger than lapack nb */ gflops = FLOPS_CHETRD( N ) / 1e9; ldwork = ldda*magma_ceildiv(N,64) + 2*ldda*nb; TESTING_CHECK( magma_cmalloc_cpu( &h_A, lda*N )); TESTING_CHECK( magma_cmalloc_cpu( &tau, N )); TESTING_CHECK( magma_smalloc_cpu( &diag, N )); TESTING_CHECK( magma_smalloc_cpu( &offdiag, N-1 )); TESTING_CHECK( magma_cmalloc_pinned( &h_R, lda*N )); TESTING_CHECK( magma_cmalloc_pinned( &h_work, lwork )); TESTING_CHECK( magma_cmalloc( &d_R, ldda*N )); TESTING_CHECK( magma_cmalloc( &dwork, ldwork )); /* ==================================================================== Initialize the matrix =================================================================== */ magma_generate_matrix( opts, N, N, h_A, lda ); magma_csetmatrix( N, N, h_A, lda, d_R, ldda, opts.queue ); /* ==================================================================== Performs operation using MAGMA =================================================================== */ gpu_time = magma_wtime(); if (opts.version == 1) { magma_chetrd_gpu( opts.uplo, N, d_R, ldda, diag, offdiag, tau, h_R, lda, h_work, lwork, &info ); } else { magma_chetrd2_gpu( opts.uplo, N, d_R, ldda, diag, offdiag, tau, h_R, lda, h_work, lwork, dwork, ldwork, &info ); } gpu_time = magma_wtime() - gpu_time; gpu_perf = gflops / gpu_time; if (info != 0) { printf("magma_chetrd_gpu returned error %lld: %s.\n", (long long) info, magma_strerror( info )); } /* ===================================================================== Check the factorization =================================================================== */ if ( opts.check ) { TESTING_CHECK( magma_cmalloc_cpu( &h_Q, lda*N )); TESTING_CHECK( magma_cmalloc_cpu( &work, 2*N*N )); #ifdef COMPLEX TESTING_CHECK( magma_smalloc_cpu( &rwork, N )); #endif magma_cgetmatrix( N, N, d_R, ldda, h_R, lda, opts.queue ); magma_cgetmatrix( N, N, d_R, ldda, h_Q, lda, opts.queue ); lapackf77_cungtr( lapack_uplo_const(opts.uplo), &N, h_Q, &lda, tau, h_work, &lwork, &info ); lapackf77_chet21( &itwo, lapack_uplo_const(opts.uplo), &N, &ione, h_A, &lda, diag, offdiag, h_Q, &lda, h_R, &lda, tau, work, #ifdef COMPLEX rwork, #endif &result[0] ); lapackf77_chet21( &ithree, lapack_uplo_const(opts.uplo), &N, &ione, h_A, &lda, diag, offdiag, h_Q, &lda, h_R, &lda, tau, work, #ifdef COMPLEX rwork, #endif &result[1] ); result[0] *= eps; result[1] *= eps; magma_free_cpu( h_Q ); magma_free_cpu( work ); #ifdef COMPLEX magma_free_cpu( rwork ); #endif } /* ===================================================================== Performs operation using LAPACK =================================================================== */ if ( opts.lapack ) { cpu_time = magma_wtime(); lapackf77_chetrd( lapack_uplo_const(opts.uplo), &N, h_A, &lda, diag, offdiag, tau, h_work, &lwork, &info ); cpu_time = magma_wtime() - cpu_time; cpu_perf = gflops / cpu_time; if (info != 0) { printf("lapackf77_chetrd returned error %lld: %s.\n", (long long) info, magma_strerror( info )); } } /* ===================================================================== Print performance and error. =================================================================== */ if ( opts.lapack ) { printf("%5lld %7.2f (%7.2f) %7.2f (%7.2f)", (long long) N, cpu_perf, cpu_time, gpu_perf, gpu_time ); } else { printf("%5lld --- ( --- ) %7.2f (%7.2f)", (long long) N, gpu_perf, gpu_time ); } if ( opts.check ) { printf(" %8.2e %8.2e %s\n", result[0], result[1], ((result[0] < tol && result[1] < tol) ? "ok" : "failed") ); status += ! (result[0] < tol && result[1] < tol); } else { printf(" --- ---\n"); } magma_free_cpu( h_A ); magma_free_cpu( tau ); magma_free_cpu( diag ); magma_free_cpu( offdiag ); magma_free_pinned( h_R ); magma_free_pinned( h_work ); magma_free( d_R ); magma_free( dwork ); fflush( stdout ); } if ( opts.niter > 1 ) { printf( "\n" ); } } opts.cleanup(); TESTING_CHECK( magma_finalize() ); return status; }
[ "kw.park.person@gmail.com" ]
kw.park.person@gmail.com
de321cc13e61e2a01a5f8e4f3e51d095272922cb
eca94558a71f2882ffe6753ae7ee8c5092c52bb3
/RSA/RSA_Task_3.cpp
91adfe7f7cedbaef64ea91ffd73aaeeae10ff370
[]
no_license
SamS034/RSA-Project
ff339a68ac9aacf364db761d1a64f53cb9323de3
22e5d2e519c382f58d9c3195e6542fa4a8faaa61
refs/heads/master
2020-06-07T23:02:48.141965
2019-06-21T14:28:53
2019-06-21T14:28:53
193,111,006
0
0
null
null
null
null
UTF-8
C++
false
false
746
cpp
// RSA Task 3 // Written by Samuel Shen #include<stdio.h> #include<openssl/bn.h> #define NBITS 256 void printBN(char *msg, BIGNUM * a) { char * number_str = BN_bn2hex(a); printf("%s %s\n", msg, number_str); OPENSSL_free(number_str); } int main () { BN_CTX *ctx = BN_CTX_new(); BIGNUM *y = BN_new(); BIGNUM *d = BN_new(); BIGNUM *x = BN_new(); BIGNUM *n = BN_new(); BN_hex2bn(&y, "8C0F971DF2F3672B28811407E2DABBE1DA0FEBBBDFC7DCB67396567EA1E2493F"); BN_hex2bn(&d, "74D806F9F3A62BAE331FFE3F0A68AFE35B3D2E4794148AACBC26AA381CD7D30D"); BN_hex2bn(&n, "DCBFFE3E51F62E09CE7032E2677A78946A849DC4CDDE3A4D0CB81629242FB1A5"); // RSA Decryption BN_mod_exp(x, y, d, n, ctx); printBN("x = ", x); }
[ "sshen1014@gmail.com" ]
sshen1014@gmail.com
19b7c021796645b23955d68815e8b7a2148e6820
0b45aa221f069d9cd781dafa14bc2099b20fb03e
/tags/2.28.2/sdk/tests/test_feature/source/test_unsaferef.cpp
cdf18dce5a507c2ec9a0d77c25f438f8331f33e6
[]
no_license
svn2github/angelscript
f2d16c2f32d89a364823904d6ca3048222951f8d
6af5956795e67f8b41c6a23d20e369fe2c5ee554
refs/heads/master
2023-09-03T07:42:01.087488
2015-01-12T00:00:30
2015-01-12T00:00:30
19,475,268
0
1
null
null
null
null
UTF-8
C++
false
false
14,136
cpp
#include "utils.h" #include "scriptmath3d.h" namespace TestUnsafeRef { static const char * const TESTNAME = "TestUnsafeRef"; static const char *script1 = "void Test() \n" "{ \n" " int[] arr = {0}; \n" " TestRefInt(arr[0]); \n" " Assert(arr[0] == 23); \n" " int a = 0; \n" " TestRefInt(a); \n" " Assert(a == 23); \n" " string[] sa = {\"\"}; \n" " TestRefString(sa[0]); \n" " Assert(sa[0] == \"ref\"); \n" " string s = \"\"; \n" " TestRefString(s); \n" " Assert(s == \"ref\"); \n" "} \n" "void TestRefInt(int &ref) \n" "{ \n" " ref = 23; \n" "} \n" "void TestRefString(string &ref) \n" "{ \n" " ref = \"ref\"; \n" "} \n"; struct Str { public: Str() {}; Str(const Str &o) {str = o.str;} static void StringConstruct(Str *p) { new(p) Str(); } static void StringCopyConstruct(const Str &o, Str *p) { new(p) Str(o); } static void StringDestruct(Str *p) { p->~Str(); } static Str StringFactory(unsigned int length, const char *s) { Str str; str.str = s; return str; } bool opEquals(const Str &o) { return str == o.str; } Str &opAssign(const Str &o) { str = o.str; return *this; } std::string str; }; bool Test() { bool fail = false; int r; COutStream out; CBufferedOutStream bout; asIScriptEngine *engine = asCreateScriptEngine(ANGELSCRIPT_VERSION); engine->SetEngineProperty(asEP_ALLOW_UNSAFE_REFERENCES, 1); engine->SetMessageCallback(asMETHOD(COutStream,Callback), &out, asCALL_THISCALL); RegisterScriptArray(engine, true); RegisterScriptString(engine); r = engine->RegisterGlobalFunction("void Assert(bool)", asFUNCTION(Assert), asCALL_GENERIC); assert( r >= 0 ); asIScriptModule *mod = engine->GetModule(0, asGM_ALWAYS_CREATE); mod->AddScriptSection(TESTNAME, script1); r = mod->Build(); if( r < 0 ) { TEST_FAILED; printf("%s: Failed to compile the script\n", TESTNAME); } asIScriptContext *ctx = engine->CreateContext(); r = ExecuteString(engine, "Test()", mod, ctx); if( r != asEXECUTION_FINISHED ) { TEST_FAILED; printf("%s: Execution failed: %d\n", TESTNAME, r); } if( ctx ) ctx->Release(); engine->Release(); // Test value class with unsafe ref { asIScriptEngine *engine = asCreateScriptEngine(ANGELSCRIPT_VERSION); engine->SetEngineProperty(asEP_ALLOW_UNSAFE_REFERENCES, 1); engine->SetMessageCallback(asMETHOD(COutStream,Callback), &out, asCALL_THISCALL); RegisterScriptMath3D(engine); asIScriptModule *mod = engine->GetModule(0, asGM_ALWAYS_CREATE); mod->AddScriptSection(TESTNAME, "class Good \n" "{ \n" " vector3 _val; \n" " Good(const vector3& in val) \n" " { \n" " _val = val; \n" " } \n" "}; \n" "class Bad \n" "{ \n" " vector3 _val; \n" " Bad(const vector3& val) \n" " { \n" " _val = val; \n" " } \n" "}; \n" "void test() \n" "{ \n" " // runs fine \n" " for (int i = 0; i < 2; i++) \n" " Good(vector3(1, 2, 3)); \n" " // causes vm stack corruption \n" " for (int i = 0; i < 2; i++) \n" " Bad(vector3(1, 2, 3)); \n" "} \n"); r = mod->Build(); if( r < 0 ) TEST_FAILED; r = ExecuteString(engine, "test()", mod); if( r != asEXECUTION_FINISHED ) TEST_FAILED; engine->Release(); } // Test ref to primitives { bout.buffer = ""; asIScriptEngine *engine = asCreateScriptEngine(ANGELSCRIPT_VERSION); engine->SetEngineProperty(asEP_ALLOW_UNSAFE_REFERENCES, 1); engine->SetMessageCallback(asMETHOD(CBufferedOutStream,Callback), &bout, asCALL_THISCALL); asIScriptModule *mod = engine->GetModule(0, asGM_ALWAYS_CREATE); mod->AddScriptSection(TESTNAME, "void func(){ \n" " float a; \n" " uint8 b; \n" " int c; \n" " funcA(c, a, b); \n" "} \n" "void funcA(float& a, uint8& b, int& c) {} \n"); r = mod->Build(); if( r >= 0 ) TEST_FAILED; if( bout.buffer != "TestUnsafeRef (1, 1) : Info : Compiling void func()\n" "TestUnsafeRef (5, 3) : Error : No matching signatures to 'funcA(int, float, uint8)'\n" "TestUnsafeRef (5, 3) : Info : Candidates are:\n" "TestUnsafeRef (5, 3) : Info : void funcA(float&inout, uint8&inout, int&inout)\n" ) { printf("%s", bout.buffer.c_str()); TEST_FAILED; } engine->Release(); } // Test problem found by TheAtom // Passing an inout reference to a handle to a function wasn't working properly { bout.buffer = ""; asIScriptEngine *engine = asCreateScriptEngine(ANGELSCRIPT_VERSION); engine->SetEngineProperty(asEP_ALLOW_UNSAFE_REFERENCES, 1); engine->SetMessageCallback(asMETHOD(CBufferedOutStream,Callback), &bout, asCALL_THISCALL); engine->RegisterGlobalFunction("void assert(bool)", asFUNCTION(Assert), asCALL_GENERIC); asIScriptModule *mod = engine->GetModule(0, asGM_ALWAYS_CREATE); mod->AddScriptSection(TESTNAME, "class T { int a; } \n" "void f(T@& p) { \n" " T t; \n" " t.a = 42; \n" " @p = t; \n" // or p=t; in which case t is copied "} \n"); r = mod->Build(); if( r < 0 ) TEST_FAILED; if( bout.buffer != "" ) { printf("%s", bout.buffer.c_str()); TEST_FAILED; } r = ExecuteString(engine, "T @t; f(t); assert( t.a == 42 );\n", mod); if( r != asEXECUTION_FINISHED ) TEST_FAILED; engine->Release(); } // http://www.gamedev.net/topic/624722-bug-with/ { bout.buffer = ""; asIScriptEngine *engine = asCreateScriptEngine(ANGELSCRIPT_VERSION); engine->SetEngineProperty(asEP_ALLOW_UNSAFE_REFERENCES, 1); engine->SetMessageCallback(asMETHOD(CBufferedOutStream,Callback), &bout, asCALL_THISCALL); engine->RegisterGlobalFunction("void assert(bool)", asFUNCTION(Assert), asCALL_GENERIC); asIScriptModule *mod = engine->GetModule(0, asGM_ALWAYS_CREATE); mod->AddScriptSection(TESTNAME, "class T { T() { val = 123; } int val; } \n" "T g_t; \n" "T &GetTest() { return g_t; } \n" "void f(T@& t) { \n" " assert( t.val == 123 ); \n" "} \n" "void func() { \n" " f(GetTest()); \n" " f(@GetTest()); \n" " T @t = GetTest(); \n" " f(t); \n" "} \n"); r = mod->Build(); if( r >= 0 ) TEST_FAILED; if( bout.buffer != "TestUnsafeRef (7, 1) : Info : Compiling void func()\n" "TestUnsafeRef (8, 3) : Error : No matching signatures to 'f(T)'\n" "TestUnsafeRef (8, 3) : Info : Candidates are:\n" "TestUnsafeRef (8, 3) : Info : void f(T@&inout)\n" ) { printf("%s", bout.buffer.c_str()); TEST_FAILED; } engine->Release(); } // http://www.gamedev.net/topic/624722-bug-with/ { bout.buffer = ""; asIScriptEngine *engine = asCreateScriptEngine(ANGELSCRIPT_VERSION); engine->SetEngineProperty(asEP_ALLOW_UNSAFE_REFERENCES, 1); engine->SetMessageCallback(asMETHOD(CBufferedOutStream,Callback), &bout, asCALL_THISCALL); engine->RegisterGlobalFunction("void assert(bool)", asFUNCTION(Assert), asCALL_GENERIC); asIScriptModule *mod = engine->GetModule(0, asGM_ALWAYS_CREATE); mod->AddScriptSection(TESTNAME, "class T { T() { val = 123; } int val; } \n" "T g_t; \n" "T &GetTest() { return g_t; } \n" "void f(T@& t) { \n" " assert( t.val == 123 ); \n" "} \n" "void func() { \n" " f(cast<T>(GetTest())); \n" " f(@GetTest()); \n" "} \n"); r = mod->Build(); if( r < 0 ) TEST_FAILED; if( bout.buffer != "" ) { printf("%s", bout.buffer.c_str()); TEST_FAILED; } asIScriptContext *ctx = engine->CreateContext(); r = ExecuteString(engine, "func()", mod, ctx); if( r != asEXECUTION_FINISHED ) { TEST_FAILED; if( r == asEXECUTION_EXCEPTION ) PrintException(ctx, true); } ctx->Release(); engine->Release(); } // http://www.gamedev.net/topic/636443-there-is-no-copy-operator-for-the-type-val-available/ { bout.buffer = ""; asIScriptEngine *engine = asCreateScriptEngine(ANGELSCRIPT_VERSION); engine->SetEngineProperty(asEP_ALLOW_UNSAFE_REFERENCES, 1); engine->SetMessageCallback(asMETHOD(CBufferedOutStream,Callback), &bout, asCALL_THISCALL); engine->RegisterGlobalFunction("void assert(bool)", asFUNCTION(Assert), asCALL_GENERIC); engine->RegisterObjectType("Val", sizeof(int), asOBJ_VALUE | asOBJ_APP_PRIMITIVE); engine->RegisterObjectBehaviour("Val", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(0), asCALL_GENERIC); // With unsafe references the copy constructor doesn't have to be in, it can be inout too engine->RegisterObjectBehaviour("Val", asBEHAVE_CONSTRUCT, "void f(const Val &)", asFUNCTION(0), asCALL_GENERIC); engine->RegisterObjectBehaviour("Val", asBEHAVE_DESTRUCT, "void f()", asFUNCTION(0), asCALL_GENERIC); asIScriptModule *mod = engine->GetModule(0, asGM_ALWAYS_CREATE); mod->AddScriptSection(TESTNAME, "Val GetVal() \n" "{ \n" " Val ret; \n" " return ret; \n" "} \n"); r = mod->Build(); if( r < 0 ) TEST_FAILED; if( bout.buffer != "" ) { printf("%s", bout.buffer.c_str()); TEST_FAILED; } engine->Release(); } // Test passing literal constant to parameter reference // http://www.gamedev.net/topic/653394-global-references/ { bout.buffer = ""; asIScriptEngine *engine = asCreateScriptEngine(ANGELSCRIPT_VERSION); engine->SetEngineProperty(asEP_ALLOW_UNSAFE_REFERENCES, 1); engine->SetMessageCallback(asMETHOD(CBufferedOutStream,Callback), &bout, asCALL_THISCALL); engine->RegisterGlobalFunction("void assert(bool)", asFUNCTION(Assert), asCALL_GENERIC); engine->RegisterGlobalFunction("void func(const int &)", asFUNCTION(0), asCALL_GENERIC); asIScriptModule *mod = engine->GetModule(0, asGM_ALWAYS_CREATE); mod->AddScriptSection(TESTNAME, "const int value = 42; \n" "void main() { \n" " func(value); \n" "} \n"); r = mod->Build(); if( r < 0 ) TEST_FAILED; if( bout.buffer != "" ) { printf("%s", bout.buffer.c_str()); TEST_FAILED; } engine->Release(); } #ifndef AS_MAX_PORTABILITY // Test with copy constructor that takes unsafe reference // http://www.gamedev.net/topic/638613-asassert-in-file-as-compillercpp-line-675/ { bout.buffer = ""; asIScriptEngine *engine = asCreateScriptEngine(ANGELSCRIPT_VERSION); engine->SetEngineProperty(asEP_ALLOW_UNSAFE_REFERENCES, 1); engine->SetMessageCallback(asMETHOD(CBufferedOutStream,Callback), &bout, asCALL_THISCALL); engine->RegisterGlobalFunction("void assert(bool)", asFUNCTION(Assert), asCALL_GENERIC); r = engine->RegisterObjectType("string", sizeof(Str), asOBJ_VALUE | asOBJ_APP_CLASS_CDAK); assert( r >= 0 ); r = engine->RegisterStringFactory("string", asFUNCTION(Str::StringFactory), asCALL_CDECL); assert( r >= 0 ); r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(Str::StringConstruct), asCALL_CDECL_OBJLAST); assert( r >= 0 ); // Copy constructor takes an unsafe reference r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT, "void f(const string &)", asFUNCTION(Str::StringCopyConstruct), asCALL_CDECL_OBJLAST); assert( r >= 0 ); r = engine->RegisterObjectBehaviour("string", asBEHAVE_DESTRUCT, "void f()", asFUNCTION(Str::StringDestruct), asCALL_CDECL_OBJLAST); assert( r >= 0 ); r = engine->RegisterObjectMethod("string", "bool opEquals(const string &in)", asMETHOD(Str, opEquals), asCALL_THISCALL); asIScriptModule *mod = engine->GetModule(0, asGM_ALWAYS_CREATE); mod->AddScriptSection(TESTNAME, "void SetTexture( string txt ) { assert( txt == 'test' ); } \n" "void startGame( ) \n" "{ \n" " SetTexture('test'); \n" "} \n"); r = mod->Build(); if( r < 0 ) TEST_FAILED; if( bout.buffer != "" ) { printf("%s", bout.buffer.c_str()); TEST_FAILED; } r = ExecuteString(engine, "startGame();", mod); if( r != asEXECUTION_FINISHED ) TEST_FAILED; engine->Release(); } #endif #ifndef AS_MAX_PORTABILITY // Test with assignment operator that takes unsafe reference { bout.buffer = ""; asIScriptEngine *engine = asCreateScriptEngine(ANGELSCRIPT_VERSION); engine->SetEngineProperty(asEP_ALLOW_UNSAFE_REFERENCES, 1); engine->SetMessageCallback(asMETHOD(CBufferedOutStream,Callback), &bout, asCALL_THISCALL); engine->RegisterGlobalFunction("void assert(bool)", asFUNCTION(Assert), asCALL_GENERIC); r = engine->RegisterObjectType("string", sizeof(Str), asOBJ_VALUE | asOBJ_APP_CLASS_CDAK); assert( r >= 0 ); r = engine->RegisterStringFactory("string", asFUNCTION(Str::StringFactory), asCALL_CDECL); assert( r >= 0 ); r = engine->RegisterObjectBehaviour("string", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(Str::StringConstruct), asCALL_CDECL_OBJLAST); assert( r >= 0 ); r = engine->RegisterObjectBehaviour("string", asBEHAVE_DESTRUCT, "void f()", asFUNCTION(Str::StringDestruct), asCALL_CDECL_OBJLAST); assert( r >= 0 ); // Assignment operator takes an unsafe reference r = engine->RegisterObjectMethod("string", "string &opAssign(const string &)", asMETHOD(Str, opAssign), asCALL_THISCALL); assert( r >= 0 ); r = engine->RegisterObjectMethod("string", "bool opEquals(const string &in)", asMETHOD(Str, opEquals), asCALL_THISCALL); asIScriptModule *mod = engine->GetModule(0, asGM_ALWAYS_CREATE); mod->AddScriptSection(TESTNAME, "void SetTexture( string txt ) { assert( txt == 'test' ); } \n" "void startGame( ) \n" "{ \n" " SetTexture('test'); \n" "} \n"); r = mod->Build(); if( r < 0 ) TEST_FAILED; if( bout.buffer != "" ) { printf("%s", bout.buffer.c_str()); TEST_FAILED; } r = ExecuteString(engine, "startGame();", mod); if( r != asEXECUTION_FINISHED ) TEST_FAILED; engine->Release(); } #endif // Success return fail; } } // namespace
[ "angelcode@404ce1b2-830e-0410-a2e2-b09542c77caf" ]
angelcode@404ce1b2-830e-0410-a2e2-b09542c77caf
b98fe2557835d4cc7a5dd3f5d6f15aa9ea506e44
85b690ce5b5952b6d886946e0bae43b975004a11
/Application/Input/openfoam-org/processor0/0.25/phi
8e030464a432429ddc77f395f7c7080a78d7e19d
[]
no_license
pace-gt/PACE-ProvBench
c89820cf160c0577e05447d553a70b0e90d54d45
4c55dda0e9edb4a381712a50656855732af3e51a
refs/heads/master
2023-03-12T06:56:30.228126
2021-02-25T22:49:07
2021-02-25T22:49:07
257,307,245
1
0
null
null
null
null
UTF-8
C++
false
false
49,504
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 5.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class surfaceScalarField; location "0.25"; object phi; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 3 -1 0 0 0 0]; internalField nonuniform List<scalar> 3781 ( -2.18516e-06 2.18516e-06 -9.84133e-07 -1.20102e-06 1.89666e-06 -2.88079e-06 5.36141e-06 -3.46475e-06 8.86214e-06 -3.50073e-06 1.21809e-05 -3.31873e-06 1.52651e-05 -3.08427e-06 1.81284e-05 -2.86328e-06 2.08074e-05 -2.67903e-06 2.33443e-05 -2.53687e-06 2.57785e-05 -2.43417e-06 2.81439e-05 -2.36542e-06 3.04686e-05 -2.32469e-06 3.27752e-05 -2.30665e-06 3.5082e-05 -2.30674e-06 3.7403e-05 -2.32101e-06 3.9749e-05 -2.34598e-06 4.21275e-05 -2.37849e-06 4.4543e-05 -2.4155e-06 4.6997e-05 -2.45401e-06 4.94879e-05 -2.49091e-06 5.20108e-05 -2.52288e-06 5.4557e-05 -2.54628e-06 5.71141e-05 -2.55702e-06 5.96644e-05 -2.55038e-06 6.21853e-05 -2.52087e-06 6.46472e-05 -2.46192e-06 6.70128e-05 -2.36557e-06 6.92348e-05 -2.22195e-06 7.12531e-05 -2.01838e-06 7.29908e-05 -1.73768e-06 7.43427e-05 -1.35192e-06 7.51575e-05 -8.14774e-07 7.52091e-05 -5.15668e-08 7.402e-05 1.18912e-06 7.12419e-05 2.77809e-06 6.64608e-05 4.78108e-06 5.92807e-05 7.18011e-06 4.9456e-05 9.82466e-06 3.71362e-05 1.23198e-05 2.30744e-05 1.40618e-05 8.70911e-06 1.43653e-05 -4.26803e-06 1.29771e-05 9.28606e-06 3.2911e-07 1.85605e-06 2.323e-06 -3.19491e-06 5.18325e-06 -5.74104e-06 8.31656e-06 -6.59806e-06 1.14469e-05 -6.63102e-06 1.44545e-05 -6.32639e-06 1.73003e-05 -5.93006e-06 1.99897e-05 -5.55268e-06 2.25474e-05 -5.23676e-06 2.50037e-05 -4.99314e-06 2.73882e-05 -4.81866e-06 2.97275e-05 -4.70476e-06 3.20445e-05 -4.64168e-06 3.4358e-05 -4.62014e-06 3.66831e-05 -4.63184e-06 3.90315e-05 -4.66936e-06 4.14115e-05 -4.72602e-06 4.38286e-05 -4.79559e-06 4.62852e-05 -4.87209e-06 4.87807e-05 -4.94956e-06 5.13117e-05 -5.02189e-06 5.38714e-05 -5.08257e-06 5.64496e-05 -5.12448e-06 5.90323e-05 -5.13967e-06 6.16009e-05 -5.11902e-06 6.41319e-05 -5.05189e-06 6.65956e-05 -4.92565e-06 6.89551e-05 -4.72504e-06 7.11645e-05 -4.43134e-06 7.31672e-05 -4.02109e-06 7.48938e-05 -3.46422e-06 7.62628e-05 -2.72097e-06 7.71886e-05 -1.74055e-06 7.76013e-05 -4.64234e-07 7.75372e-05 1.25316e-06 7.67997e-05 3.51559e-06 7.51143e-05 6.46654e-06 7.20742e-05 1.02202e-05 6.71135e-05 1.47853e-05 5.95416e-05 1.98917e-05 4.88279e-05 2.47754e-05 3.51973e-05 2.79959e-05 2.03591e-05 2.78153e-05 2.2165e-05 1.73297e-06 1.23077e-07 4.26745e-06 -5.7294e-06 7.17219e-06 -8.64578e-06 1.01464e-05 -9.5723e-06 1.30512e-05 -9.5358e-06 1.58355e-05 -9.11072e-06 1.84907e-05 -8.58521e-06 2.10292e-05 -8.09121e-06 2.34729e-05 -7.68045e-06 2.5846e-05 -7.36623e-06 2.81719e-05 -7.1446e-06 3.04719e-05 -7.00473e-06 3.27642e-05 -6.93399e-06 3.5064e-05 -6.91995e-06 3.73834e-05 -6.9512e-06 3.97314e-05 -7.01731e-06 4.21141e-05 -7.10871e-06 4.45349e-05 -7.21641e-06 4.69945e-05 -7.33171e-06 4.94909e-05 -7.44593e-06 5.20191e-05 -7.55017e-06 5.45716e-05 -7.63498e-06 5.71371e-05 -7.69004e-06 5.97012e-05 -7.70379e-06 6.22452e-05 -7.66303e-06 6.47457e-05 -7.55238e-06 6.71737e-05 -7.3536e-06 6.94935e-05 -7.04484e-06 7.16617e-05 -6.59954e-06 7.36257e-05 -5.98507e-06 7.53224e-05 -5.16092e-06 7.6678e-05 -4.07659e-06 7.76067e-05 -2.66921e-06 7.8007e-05 -8.64563e-07 7.78127e-05 1.44749e-06 7.69336e-05 4.39469e-06 7.52798e-05 8.12032e-06 7.27454e-05 1.27545e-05 6.9173e-05 1.83578e-05 6.42653e-05 2.47994e-05 5.75092e-05 3.15315e-05 4.82759e-05 3.72293e-05 3.64721e-05 3.96191e-05 3.56206e-05 2.25543e-06 -2.13235e-06 5.30065e-06 -8.77462e-06 8.39019e-06 -1.17353e-05 1.13458e-05 -1.25279e-05 1.41383e-05 -1.23283e-05 1.67835e-05 -1.17559e-05 1.9307e-05 -1.11087e-05 2.1735e-05 -1.05193e-05 2.40921e-05 -1.00376e-05 2.64007e-05 -9.67474e-06 2.86805e-05 -9.42446e-06 3.09492e-05 -9.27339e-06 3.32214e-05 -9.20624e-06 3.55094e-05 -9.20792e-06 3.78225e-05 -9.26431e-06 4.01676e-05 -9.36239e-06 4.25489e-05 -9.49003e-06 4.49683e-05 -9.63577e-06 4.7425e-05 -9.78846e-06 4.99161e-05 -9.93699e-06 5.24358e-05 -1.00699e-05 5.49759e-05 -1.0175e-05 5.75249e-05 -1.02391e-05 6.00684e-05 -1.02472e-05 6.25878e-05 -1.01824e-05 6.50602e-05 -1.00249e-05 6.74579e-05 -9.75124e-06 6.97467e-05 -9.3337e-06 7.18859e-05 -8.7387e-06 7.38263e-05 -7.92552e-06 7.55099e-05 -6.8445e-06 7.68684e-05 -5.43508e-06 7.78229e-05 -3.62369e-06 7.82824e-05 -1.32405e-06 7.81574e-05 1.57245e-06 7.73601e-05 5.19195e-06 7.58128e-05 9.66767e-06 7.3452e-05 1.51153e-05 7.02228e-05 2.1587e-05 6.60351e-05 2.89872e-05 6.0655e-05 3.69116e-05 5.35394e-05 4.43449e-05 4.39153e-05 4.92431e-05 4.82388e-05 2.48383e-06 -4.61618e-06 5.84367e-06 -1.21345e-05 9.08653e-06 -1.49782e-05 1.2061e-05 -1.55024e-05 1.4801e-05 -1.50683e-05 1.73668e-05 -1.43217e-05 1.98093e-05 -1.35512e-05 2.21665e-05 -1.28764e-05 2.44668e-05 -1.23379e-05 2.67328e-05 -1.19407e-05 2.89826e-05 -1.16742e-05 3.12313e-05 -1.15221e-05 3.34912e-05 -1.14662e-05 3.57723e-05 -1.1489e-05 3.8082e-05 -1.1574e-05 4.04253e-05 -1.17057e-05 4.28051e-05 -1.18699e-05 4.52221e-05 -1.20528e-05 4.76748e-05 -1.22411e-05 5.01594e-05 -1.24216e-05 5.26698e-05 -1.25804e-05 5.51976e-05 -1.27028e-05 5.77314e-05 -1.27729e-05 6.02569e-05 -1.27727e-05 6.27562e-05 -1.26817e-05 6.52073e-05 -1.2476e-05 6.75836e-05 -1.21276e-05 6.98532e-05 -1.16032e-05 7.19775e-05 -1.08631e-05 7.39113e-05 -9.85927e-06 7.56008e-05 -8.53402e-06 7.69836e-05 -6.81784e-06 7.79877e-05 -4.62779e-06 7.85311e-05 -1.86745e-06 7.85272e-05 1.57636e-06 7.78899e-05 5.8292e-06 7.65396e-05 1.1018e-05 7.44067e-05 1.72481e-05 7.14291e-05 2.45647e-05 6.7527e-05 3.28893e-05 6.25339e-05 4.19046e-05 5.60512e-05 5.08276e-05 4.73109e-05 5.79834e-05 6.02348e-05 2.62613e-06 -7.24232e-06 6.14046e-06 -1.56488e-05 9.44849e-06 -1.82862e-05 1.24187e-05 -1.84726e-05 1.51204e-05 -1.777e-05 1.76369e-05 -1.68382e-05 2.00315e-05 -1.59458e-05 2.23478e-05 -1.51927e-05 2.46164e-05 -1.46065e-05 2.68596e-05 -1.41838e-05 2.90944e-05 -1.39091e-05 3.13344e-05 -1.37621e-05 3.35902e-05 -1.3722e-05 3.587e-05 -1.37688e-05 3.81798e-05 -1.38837e-05 4.05234e-05 -1.40493e-05 4.29028e-05 -1.42492e-05 4.53178e-05 -1.44678e-05 4.77665e-05 -1.46898e-05 5.02448e-05 -1.48999e-05 5.27466e-05 -1.50821e-05 5.52634e-05 -1.52196e-05 5.77843e-05 -1.52938e-05 6.02954e-05 -1.52838e-05 6.27796e-05 -1.51659e-05 6.52162e-05 -1.49125e-05 6.75799e-05 -1.44913e-05 6.98408e-05 -1.38641e-05 7.19632e-05 -1.29855e-05 7.39051e-05 -1.18012e-05 7.56173e-05 -1.02462e-05 7.70426e-05 -8.24318e-06 7.81157e-05 -5.70084e-06 7.87622e-05 -2.514e-06 7.89022e-05 1.43642e-06 7.84529e-05 6.27846e-06 7.73323e-05 1.21386e-05 7.54594e-05 1.9121e-05 7.2748e-05 2.7276e-05 6.90861e-05 3.65513e-05 6.42865e-05 4.67042e-05 5.79867e-05 5.71274e-05 4.94911e-05 6.64789e-05 7.20495e-05 2.73217e-06 -9.97448e-06 6.29616e-06 -1.92128e-05 9.58974e-06 -2.15798e-05 1.25182e-05 -2.1401e-05 1.51747e-05 -2.04266e-05 1.76522e-05 -1.93157e-05 2.00162e-05 -1.83098e-05 2.23103e-05 -1.74868e-05 2.45642e-05 -1.68604e-05 2.67991e-05 -1.64187e-05 2.90306e-05 -1.61407e-05 3.1271e-05 -1.60024e-05 3.35293e-05 -1.59803e-05 3.58125e-05 -1.60521e-05 3.81256e-05 -1.61969e-05 4.04717e-05 -1.63953e-05 4.28518e-05 -1.66294e-05 4.52657e-05 -1.68817e-05 4.7711e-05 -1.71351e-05 5.01837e-05 -1.73726e-05 5.26779e-05 -1.75763e-05 5.51855e-05 -1.77272e-05 5.76959e-05 -1.78043e-05 6.01962e-05 -1.77841e-05 6.26702e-05 -1.76399e-05 6.50983e-05 -1.73406e-05 6.7457e-05 -1.685e-05 6.97184e-05 -1.61256e-05 7.18497e-05 -1.51167e-05 7.38121e-05 -1.37636e-05 7.55606e-05 -1.19948e-05 7.70435e-05 -9.72605e-06 7.82014e-05 -6.85871e-06 7.89674e-05 -3.28e-06 7.92683e-05 1.13552e-06 7.90261e-05 6.52063e-06 7.81583e-05 1.30064e-05 7.6575e-05 2.07043e-05 7.41703e-05 2.96807e-05 7.08021e-05 3.99195e-05 6.62509e-05 5.12554e-05 6.01396e-05 6.32387e-05 5.17851e-05 7.48335e-05 8.38336e-05 2.8124e-06 -1.27869e-05 6.35458e-06 -2.2755e-05 9.5751e-06 -2.48003e-05 1.24295e-05 -2.42555e-05 1.50292e-05 -2.30262e-05 1.7468e-05 -2.17545e-05 1.9808e-05 -2.06498e-05 2.2089e-05 -1.97679e-05 2.43378e-05 -1.91092e-05 2.65731e-05 -1.8654e-05 2.88088e-05 -1.83763e-05 3.10553e-05 -1.82489e-05 3.33205e-05 -1.82456e-05 3.56105e-05 -1.8342e-05 3.79291e-05 -1.85155e-05 4.02789e-05 -1.87451e-05 4.26607e-05 -1.90112e-05 4.5074e-05 -1.92949e-05 4.75165e-05 -1.95776e-05 4.99845e-05 -1.98406e-05 5.24722e-05 -2.00641e-05 5.49723e-05 -2.02273e-05 5.74749e-05 -2.03069e-05 5.99677e-05 -2.0277e-05 6.24357e-05 -2.01079e-05 6.48608e-05 -1.97656e-05 6.7221e-05 -1.92102e-05 6.94906e-05 -1.83952e-05 7.16394e-05 -1.72655e-05 7.3632e-05 -1.57561e-05 7.54276e-05 -1.37904e-05 7.69795e-05 -1.12779e-05 7.82345e-05 -8.11371e-06 7.91329e-05 -4.17839e-06 7.96088e-05 6.59615e-07 7.95903e-05 6.5391e-06 7.89976e-05 1.35992e-05 7.77381e-05 2.19637e-05 7.56967e-05 3.17221e-05 7.27159e-05 4.29003e-05 6.85591e-05 5.54122e-05 6.28363e-05 6.89615e-05 5.48512e-05 8.28187e-05 9.53747e-05 2.86835e-06 -1.56552e-05 6.33691e-06 -2.62235e-05 9.44407e-06 -2.79075e-05 1.22018e-05 -2.70132e-05 1.4734e-05 -2.55583e-05 1.71307e-05 -2.41513e-05 1.94474e-05 -2.29664e-05 2.17181e-05 -2.20386e-05 2.39653e-05 -2.13564e-05 2.62047e-05 -2.08934e-05 2.84476e-05 -2.06193e-05 3.0703e-05 -2.05042e-05 3.29772e-05 -2.05198e-05 3.52751e-05 -2.06399e-05 3.76e-05 -2.08405e-05 3.99541e-05 -2.10992e-05 4.23378e-05 -2.1395e-05 4.47507e-05 -2.17078e-05 4.71908e-05 -2.20177e-05 4.96545e-05 -2.23043e-05 5.2137e-05 -2.25465e-05 5.46312e-05 -2.27214e-05 5.71281e-05 -2.28038e-05 5.96166e-05 -2.27654e-05 6.20825e-05 -2.25739e-05 6.45091e-05 -2.21922e-05 6.68763e-05 -2.15774e-05 6.91601e-05 -2.06791e-05 7.13331e-05 -1.94384e-05 7.3363e-05 -1.77861e-05 7.52132e-05 -1.56406e-05 7.68418e-05 -1.29066e-05 7.82021e-05 -9.47392e-06 7.92413e-05 -5.21768e-06 7.99018e-05 -8.66725e-10 8.01194e-05 6.3215e-06 7.98209e-05 1.38977e-05 7.89187e-05 2.2866e-05 7.73012e-05 3.33396e-05 7.48166e-05 4.53849e-05 7.12412e-05 5.89876e-05 6.62115e-05 7.39911e-05 5.90664e-05 8.99638e-05 0.000105983 2.89998e-06 -1.85552e-05 6.25597e-06 -2.95795e-05 9.22326e-06 -3.08748e-05 1.18699e-05 -2.96599e-05 1.43268e-05 -2.80152e-05 1.6677e-05 -2.65015e-05 1.89679e-05 -2.52573e-05 2.1227e-05 -2.42977e-05 2.34721e-05 -2.36015e-05 2.57153e-05 -2.31366e-05 2.79655e-05 -2.28696e-05 3.02295e-05 -2.27682e-05 3.25123e-05 -2.28026e-05 3.48177e-05 -2.29453e-05 3.71484e-05 -2.31712e-05 3.95061e-05 -2.34568e-05 4.18912e-05 -2.37801e-05 4.43033e-05 -2.41199e-05 4.67408e-05 -2.44552e-05 4.92008e-05 -2.47643e-05 5.16787e-05 -2.50245e-05 5.41685e-05 -2.52112e-05 5.66619e-05 -2.52973e-05 5.91487e-05 -2.52521e-05 6.16159e-05 -2.50411e-05 6.40479e-05 -2.46243e-05 6.64262e-05 -2.39556e-05 6.87289e-05 -2.29817e-05 7.09306e-05 -2.16401e-05 7.30023e-05 -1.98578e-05 7.49111e-05 -1.75494e-05 7.66202e-05 -1.46157e-05 7.80887e-05 -1.09424e-05 7.92715e-05 -6.40045e-06 8.01192e-05 -8.48595e-07 8.05772e-05 5.86346e-06 8.05829e-05 1.3892e-05 8.00608e-05 2.33881e-05 7.8916e-05 3.44843e-05 7.70247e-05 4.72763e-05 7.42144e-05 6.17979e-05 7.0217e-05 7.79886e-05 6.45334e-05 9.56474e-05 0.000114499 2.9582e-06 -2.15134e-05 6.23006e-06 -3.28514e-05 9.08975e-06 -3.37344e-05 1.16609e-05 -3.22311e-05 1.4079e-05 -3.04332e-05 1.64191e-05 -2.88416e-05 1.87204e-05 -2.75585e-05 2.10044e-05 -2.65818e-05 2.32844e-05 -2.58814e-05 2.55689e-05 -2.54212e-05 2.78644e-05 -2.5165e-05 3.01755e-05 -2.50793e-05 3.25059e-05 -2.5133e-05 3.48583e-05 -2.52977e-05 3.72348e-05 -2.55477e-05 3.96366e-05 -2.58587e-05 4.20645e-05 -2.6208e-05 4.45181e-05 -2.65736e-05 4.69962e-05 -2.69333e-05 4.94964e-05 -2.72644e-05 5.20148e-05 -2.75429e-05 5.45459e-05 -2.77423e-05 5.70823e-05 -2.78337e-05 5.96143e-05 -2.77842e-05 6.213e-05 -2.75567e-05 6.46144e-05 -2.71087e-05 6.70501e-05 -2.63913e-05 6.94164e-05 -2.5348e-05 7.16897e-05 -2.39134e-05 7.38432e-05 -2.20113e-05 7.58471e-05 -1.95533e-05 7.76685e-05 -1.64371e-05 7.92716e-05 -1.25455e-05 8.06179e-05 -7.74679e-06 8.16662e-05 -1.89691e-06 8.23716e-05 5.15805e-06 8.26839e-05 1.35797e-05 8.25444e-05 2.35276e-05 8.18835e-05 3.51452e-05 8.0621e-05 4.85387e-05 7.86672e-05 6.37518e-05 7.59205e-05 8.07353e-05 7.22364e-05 9.93316e-05 0.00011935 2.96814e-06 -2.44816e-05 6.09872e-06 -3.5982e-05 8.81016e-06 -3.64459e-05 1.12748e-05 -3.46957e-05 1.36264e-05 -3.27849e-05 1.59302e-05 -3.11454e-05 1.82167e-05 -2.9845e-05 2.05012e-05 -2.88662e-05 2.2792e-05 -2.81722e-05 2.50944e-05 -2.77236e-05 2.74119e-05 -2.74825e-05 2.97471e-05 -2.74145e-05 3.21022e-05 -2.7488e-05 3.44788e-05 -2.76744e-05 3.68784e-05 -2.79473e-05 3.93021e-05 -2.82823e-05 4.17504e-05 -2.86563e-05 4.42235e-05 -2.90466e-05 4.67204e-05 -2.94303e-05 4.92396e-05 -2.97836e-05 5.17778e-05 -3.0081e-05 5.43302e-05 -3.02947e-05 5.68902e-05 -3.03937e-05 5.94488e-05 -3.03428e-05 6.19947e-05 -3.01026e-05 6.45139e-05 -2.96279e-05 6.69897e-05 -2.88671e-05 6.94027e-05 -2.7761e-05 7.17306e-05 -2.62413e-05 7.39488e-05 -2.42295e-05 7.60302e-05 -2.16347e-05 7.79456e-05 -1.83525e-05 7.96643e-05 -1.42642e-05 8.11544e-05 -9.23681e-06 8.23827e-05 -3.1252e-06 8.33149e-05 4.22577e-06 8.39154e-05 1.29793e-05 8.41451e-05 2.32979e-05 8.39647e-05 3.53256e-05 8.3342e-05 4.91614e-05 8.22708e-05 6.48231e-05 8.08038e-05 8.22022e-05 7.91168e-05 0.000101019 0.000120784 2.95477e-06 -2.74363e-05 5.92158e-06 -3.89488e-05 8.47432e-06 -3.89986e-05 1.08265e-05 -3.70478e-05 1.31064e-05 -3.50648e-05 1.53681e-05 -3.34071e-05 1.76337e-05 -3.21107e-05 1.99125e-05 -3.11451e-05 2.22085e-05 -3.04682e-05 2.45232e-05 -3.00383e-05 2.68575e-05 -2.98169e-05 2.9212e-05 -2.9769e-05 3.15873e-05 -2.98633e-05 3.3984e-05 -3.00711e-05 3.6403e-05 -3.03663e-05 3.88453e-05 -3.07245e-05 4.13114e-05 -3.11225e-05 4.38019e-05 -3.15371e-05 4.63165e-05 -3.19449e-05 4.88541e-05 -3.23212e-05 5.14123e-05 -3.26393e-05 5.39871e-05 -3.28695e-05 5.65725e-05 -3.2979e-05 5.91599e-05 -3.29303e-05 6.17387e-05 -3.26814e-05 6.42951e-05 -3.21844e-05 6.6813e-05 -3.1385e-05 6.92736e-05 -3.02215e-05 7.16555e-05 -2.86232e-05 7.39353e-05 -2.65094e-05 7.6088e-05 -2.37874e-05 7.80872e-05 -2.03518e-05 7.99062e-05 -1.60831e-05 8.15181e-05 -1.08487e-05 8.2897e-05 -4.50409e-06 8.40182e-05 3.10455e-06 8.48594e-05 1.2138e-05 8.54008e-05 2.27565e-05 8.56297e-05 3.50967e-05 8.55524e-05 4.92387e-05 8.52159e-05 6.51596e-05 8.47428e-05 8.26753e-05 8.43777e-05 0.000101384 0.000120646 2.91909e-06 -3.03554e-05 5.70306e-06 -4.17327e-05 8.0893e-06 -4.13849e-05 1.03243e-05 -3.92828e-05 1.25271e-05 -3.72676e-05 1.47407e-05 -3.56208e-05 1.69792e-05 -3.43491e-05 1.9246e-05 -3.34118e-05 2.15406e-05 -3.27628e-05 2.38614e-05 -3.23591e-05 2.62066e-05 -3.2162e-05 2.85746e-05 -3.21371e-05 3.09647e-05 -3.22533e-05 3.33765e-05 -3.24829e-05 3.58104e-05 -3.28003e-05 3.82673e-05 -3.31814e-05 4.07479e-05 -3.36031e-05 4.32532e-05 -3.40424e-05 4.57836e-05 -3.44753e-05 4.83388e-05 -3.48764e-05 5.0917e-05 -3.52175e-05 5.35149e-05 -3.54675e-05 5.6127e-05 -3.5591e-05 5.87452e-05 -3.55485e-05 6.13587e-05 -3.52949e-05 6.3954e-05 -3.47796e-05 6.65146e-05 -3.39457e-05 6.90216e-05 -3.27286e-05 7.14539e-05 -3.10555e-05 7.37884e-05 -2.88438e-05 7.60008e-05 -2.59998e-05 7.80662e-05 -2.24172e-05 7.99602e-05 -1.79771e-05 8.16592e-05 -1.25477e-05 8.31422e-05 -5.98711e-06 8.43919e-05 1.85493e-06 8.53966e-05 1.11333e-05 8.61525e-05 2.20006e-05 8.66684e-05 3.45808e-05 8.69776e-05 4.89295e-05 8.71529e-05 6.49843e-05 8.73282e-05 8.24999e-05 8.77174e-05 0.000100994 0.000119784 2.86233e-06 -3.32177e-05 5.44657e-06 -4.4317e-05 7.6597e-06 -4.3598e-05 9.77279e-06 -4.13959e-05 1.18932e-05 -3.9388e-05 1.40527e-05 -3.77802e-05 1.62575e-05 -3.6554e-05 1.85057e-05 -3.566e-05 2.07924e-05 -3.50496e-05 2.31128e-05 -3.46795e-05 2.54624e-05 -3.45116e-05 2.78377e-05 -3.45124e-05 3.02366e-05 -3.46522e-05 3.2658e-05 -3.49043e-05 3.51017e-05 -3.5244e-05 3.75685e-05 -3.56482e-05 4.00597e-05 -3.60943e-05 4.25766e-05 -3.65593e-05 4.51205e-05 -3.70192e-05 4.76918e-05 -3.74476e-05 5.02895e-05 -3.78152e-05 5.29108e-05 -3.80888e-05 5.55505e-05 -3.82308e-05 5.82007e-05 -3.81986e-05 6.08501e-05 -3.79443e-05 6.34846e-05 -3.74141e-05 6.60869e-05 -3.65479e-05 6.86369e-05 -3.52786e-05 7.11126e-05 -3.35312e-05 7.349e-05 -3.12213e-05 7.57443e-05 -2.82541e-05 7.78504e-05 -2.45233e-05 7.97836e-05 -1.99103e-05 8.15213e-05 -1.42855e-05 8.30441e-05 -7.50984e-06 8.4338e-05 5.60947e-07 8.53985e-05 1.00729e-05 8.62337e-05 2.11654e-05 8.68704e-05 3.3944e-05 8.7364e-05 4.84359e-05 8.78042e-05 6.45441e-05 8.83249e-05 8.19792e-05 8.91197e-05 0.0001002 0.000118513 2.78583e-06 -3.60036e-05 5.15416e-06 -4.66853e-05 7.18737e-06 -4.56312e-05 9.17335e-06 -4.33819e-05 1.12056e-05 -4.14203e-05 1.33049e-05 -3.98795e-05 1.54699e-05 -3.8719e-05 1.76931e-05 -3.78832e-05 1.99656e-05 -3.73221e-05 2.22791e-05 -3.6993e-05 2.46266e-05 -3.68591e-05 2.70029e-05 -3.68887e-05 2.94044e-05 -3.70538e-05 3.18293e-05 -3.73292e-05 3.42772e-05 -3.76919e-05 3.67489e-05 -3.81199e-05 3.92461e-05 -3.85915e-05 4.1771e-05 -3.90842e-05 4.43254e-05 -3.95736e-05 4.69107e-05 -4.00329e-05 4.95266e-05 -4.04311e-05 5.2171e-05 -4.07331e-05 5.48387e-05 -4.08985e-05 5.75212e-05 -4.08812e-05 6.02067e-05 -4.06298e-05 6.28793e-05 -4.00867e-05 6.55199e-05 -3.91885e-05 6.81065e-05 -3.78652e-05 7.06146e-05 -3.60393e-05 7.30182e-05 -3.36248e-05 7.529e-05 -3.05259e-05 7.74025e-05 -2.66358e-05 7.93286e-05 -2.18365e-05 8.1043e-05 -1.59998e-05 8.25235e-05 -8.99029e-06 8.37546e-05 -6.70199e-07 8.47331e-05 9.09442e-06 8.54755e-05 2.0423e-05 8.60263e-05 3.33931e-05 8.6468e-05 4.79942e-05 8.69163e-05 6.40959e-05 8.75114e-05 8.13841e-05 8.84504e-05 9.92606e-05 0.000117051 2.69111e-06 -3.86947e-05 4.82605e-06 -4.88202e-05 6.67099e-06 -4.74762e-05 8.5236e-06 -4.52345e-05 1.04618e-05 -4.33585e-05 1.24951e-05 -4.19127e-05 1.46146e-05 -4.08385e-05 1.68072e-05 -4.00758e-05 1.90597e-05 -3.95746e-05 2.13604e-05 -3.92937e-05 2.36998e-05 -3.91985e-05 2.60708e-05 -3.92597e-05 2.84687e-05 -3.94517e-05 3.08911e-05 -3.97515e-05 3.33372e-05 -4.0138e-05 3.58083e-05 -4.05909e-05 3.83065e-05 -4.10897e-05 4.08348e-05 -4.16124e-05 4.3396e-05 -4.21349e-05 4.59924e-05 -4.26293e-05 4.86246e-05 -4.30633e-05 5.12908e-05 -4.33993e-05 5.39856e-05 -4.35934e-05 5.67e-05 -4.35956e-05 5.94201e-05 -4.33499e-05 6.21277e-05 -4.27944e-05 6.48009e-05 -4.18617e-05 6.74141e-05 -4.04784e-05 6.99393e-05 -3.85645e-05 7.23465e-05 -3.6032e-05 7.46044e-05 -3.27838e-05 7.66809e-05 -2.87123e-05 7.85436e-05 -2.36992e-05 8.01606e-05 -1.76168e-05 8.15015e-05 -1.03312e-05 8.25424e-05 -1.71109e-06 8.32736e-05 8.36317e-06 8.37159e-05 1.99807e-05 8.39329e-05 3.31761e-05 8.40498e-05 4.78773e-05 8.42453e-05 6.39005e-05 8.46916e-05 8.09378e-05 8.56e-05 9.83522e-05 0.00011552 2.58e-06 -4.12747e-05 4.45957e-06 -5.06998e-05 6.10496e-06 -4.91215e-05 7.81694e-06 -4.69465e-05 9.65553e-06 -4.51971e-05 1.16181e-05 -4.38753e-05 1.36878e-05 -4.29082e-05 1.58454e-05 -4.22334e-05 1.80732e-05 -4.18024e-05 2.03561e-05 -4.15765e-05 2.26819e-05 -4.15244e-05 2.50419e-05 -4.16198e-05 2.74303e-05 -4.18401e-05 2.9844e-05 -4.21652e-05 3.22823e-05 -4.25764e-05 3.47468e-05 -4.30554e-05 3.72403e-05 -4.35832e-05 3.97667e-05 -4.41388e-05 4.233e-05 -4.46982e-05 4.49336e-05 -4.52329e-05 4.75788e-05 -4.57086e-05 5.02643e-05 -4.60848e-05 5.29843e-05 -4.63134e-05 5.57282e-05 -4.63394e-05 5.84797e-05 -4.61013e-05 6.12171e-05 -4.55318e-05 6.39138e-05 -4.45585e-05 6.65397e-05 -4.31042e-05 6.90614e-05 -4.10862e-05 7.14437e-05 -3.84143e-05 7.36496e-05 -3.49897e-05 7.56403e-05 -3.0703e-05 7.73756e-05 -2.54345e-05 7.88131e-05 -1.90543e-05 7.99086e-05 -1.14266e-05 8.06202e-05 -2.42274e-06 8.09205e-05 8.06287e-06 8.08218e-05 2.00794e-05 8.04009e-05 3.35971e-05 7.98564e-05 4.84218e-05 7.95211e-05 6.42358e-05 7.97393e-05 8.07196e-05 8.06665e-05 9.7425e-05 0.000113871 2.4537e-06 -4.37284e-05 4.04693e-06 -5.2293e-05 5.47807e-06 -5.05527e-05 7.04205e-06 -4.85105e-05 8.77681e-06 -4.69318e-05 1.0666e-05 -4.57645e-05 1.26836e-05 -4.49257e-05 1.48038e-05 -4.43536e-05 1.70039e-05 -4.40025e-05 1.92652e-05 -4.38378e-05 2.15732e-05 -4.38323e-05 2.39172e-05 -4.39638e-05 2.62905e-05 -4.42133e-05 2.86895e-05 -4.45642e-05 3.11137e-05 -4.50006e-05 3.35652e-05 -4.55068e-05 3.60475e-05 -4.60655e-05 3.85658e-05 -4.66571e-05 4.11253e-05 -4.72578e-05 4.37306e-05 -4.78382e-05 4.63841e-05 -4.83621e-05 4.90847e-05 -4.87853e-05 5.18259e-05 -4.90546e-05 5.45951e-05 -4.91086e-05 5.73724e-05 -4.88786e-05 6.01311e-05 -4.82905e-05 6.28388e-05 -4.72661e-05 6.54586e-05 -4.5724e-05 6.79509e-05 -4.35785e-05 7.02738e-05 -4.07373e-05 7.23836e-05 -3.70994e-05 7.42336e-05 -3.2553e-05 7.57741e-05 -2.69751e-05 7.69503e-05 -2.02305e-05 7.76997e-05 -1.21761e-05 7.79531e-05 -2.67612e-06 7.76408e-05 8.37514e-06 7.67435e-05 2.09767e-05 7.5368e-05 3.49726e-05 7.391e-05 4.98797e-05 7.28751e-05 6.52707e-05 7.30259e-05 8.05688e-05 7.43154e-05 9.61355e-05 0.000111878 2.3086e-06 -4.6037e-05 3.57144e-06 -5.35559e-05 4.77199e-06 -5.17532e-05 6.18289e-06 -4.99214e-05 7.81298e-06 -4.85619e-05 9.62945e-06 -4.7581e-05 1.15958e-05 -4.68921e-05 1.36788e-05 -4.64366e-05 1.58504e-05 -4.61742e-05 1.80883e-05 -4.60757e-05 2.03752e-05 -4.61193e-05 2.26991e-05 -4.62876e-05 2.50522e-05 -4.65664e-05 2.74308e-05 -4.69428e-05 2.98345e-05 -4.74044e-05 3.22659e-05 -4.79382e-05 3.47298e-05 -4.85295e-05 3.72325e-05 -4.91598e-05 3.97806e-05 -4.98059e-05 4.23802e-05 -5.04378e-05 4.50349e-05 -5.10168e-05 4.77438e-05 -5.14943e-05 5.04999e-05 -5.18107e-05 5.32877e-05 -5.18964e-05 5.60822e-05 -5.16732e-05 5.88504e-05 -5.10586e-05 6.15518e-05 -4.99675e-05 6.41417e-05 -4.83139e-05 6.65726e-05 -4.60094e-05 6.8796e-05 -4.29607e-05 7.07609e-05 -3.90644e-05 7.24132e-05 -3.42053e-05 7.36944e-05 -2.82562e-05 7.45379e-05 -2.1074e-05 7.48619e-05 -1.25001e-05 7.45784e-05 -2.39259e-06 7.35712e-05 9.38238e-06 7.17408e-05 2.28071e-05 6.91154e-05 3.7598e-05 6.65951e-05 5.24e-05 6.49362e-05 6.69297e-05 6.56321e-05 7.98729e-05 6.82092e-05 9.35584e-05 0.000109325 2.12726e-06 -4.81642e-05 3.00338e-06 -5.4432e-05 3.96132e-06 -5.27112e-05 5.22023e-06 -5.11803e-05 6.75045e-06 -5.00922e-05 8.49975e-06 -4.93303e-05 1.04196e-05 -4.88119e-05 1.24688e-05 -4.84857e-05 1.46136e-05 -4.8319e-05 1.68278e-05 -4.82899e-05 1.9092e-05 -4.83834e-05 2.13926e-05 -4.85882e-05 2.37211e-05 -4.88949e-05 2.60736e-05 -4.92953e-05 2.84502e-05 -4.97809e-05 3.0854e-05 -5.03421e-05 3.3291e-05 -5.09664e-05 3.57688e-05 -5.16375e-05 3.82957e-05 -5.23328e-05 4.08796e-05 -5.30216e-05 4.35253e-05 -5.36625e-05 4.6233e-05 -5.42019e-05 4.89943e-05 -5.45721e-05 5.17904e-05 -5.46925e-05 5.45903e-05 -5.44731e-05 5.73518e-05 -5.38202e-05 6.00249e-05 -5.26406e-05 6.25549e-05 -5.08439e-05 6.48863e-05 -4.83408e-05 6.69643e-05 -4.50386e-05 6.87326e-05 -4.08327e-05 7.01307e-05 -3.56033e-05 7.10932e-05 -2.92187e-05 7.15492e-05 -2.15301e-05 7.14105e-05 -1.23613e-05 7.06076e-05 -1.58976e-06 6.8747e-05 1.1243e-05 6.5451e-05 2.61032e-05 6.06492e-05 4.23998e-05 5.75354e-05 5.55138e-05 5.65912e-05 6.78738e-05 5.80238e-05 7.84403e-05 6.24615e-05 8.91206e-05 6.6547e-05 0.000105239 0.000122734 1.86281e-06 -5.00271e-05 2.29918e-06 -5.48684e-05 3.01728e-06 -5.34293e-05 4.13575e-06 -5.22987e-05 5.57857e-06 -5.1535e-05 7.27204e-06 -5.10237e-05 9.15469e-06 -5.06946e-05 1.11767e-05 -5.05077e-05 1.32987e-05 -5.0441e-05 1.5491e-05 -5.04822e-05 1.7732e-05 -5.06244e-05 2.00069e-05 -5.08631e-05 2.23068e-05 -5.11948e-05 2.46278e-05 -5.16163e-05 2.69702e-05 -5.21234e-05 2.93381e-05 -5.271e-05 3.17384e-05 -5.33667e-05 3.41802e-05 -5.40793e-05 3.66735e-05 -5.48262e-05 3.92281e-05 -5.55762e-05 4.18509e-05 -5.62853e-05 4.45431e-05 -5.68941e-05 4.72959e-05 -5.73249e-05 5.00864e-05 -5.74829e-05 5.28753e-05 -5.7262e-05 5.56095e-05 -5.65543e-05 5.82262e-05 -5.52573e-05 6.06596e-05 -5.32773e-05 6.28461e-05 -5.05273e-05 6.4727e-05 -4.69196e-05 6.62435e-05 -4.23492e-05 6.73301e-05 -3.66899e-05 6.79293e-05 -2.9818e-05 6.79895e-05 -2.15902e-05 6.736e-05 -1.17318e-05 6.56471e-05 1.23067e-07 6.14683e-05 1.54219e-05 5.90567e-05 2.85148e-05 5.77529e-05 4.37035e-05 5.63108e-05 5.69559e-05 5.58996e-05 6.82851e-05 5.68224e-05 7.75175e-05 5.97539e-05 8.6189e-05 6.51664e-05 9.98268e-05 0.000122455 1.42724e-06 -5.14543e-05 1.41033e-06 -5.48514e-05 1.91704e-06 -5.3936e-05 2.91924e-06 -5.3301e-05 4.29523e-06 -5.2911e-05 5.94993e-06 -5.26784e-05 7.80861e-06 -5.25533e-05 9.8128e-06 -5.25119e-05 1.1918e-05 -5.25462e-05 1.40912e-05 -5.26555e-05 1.63094e-05 -5.28426e-05 1.85569e-05 -5.31106e-05 2.08246e-05 -5.34625e-05 2.31086e-05 -5.39004e-05 2.54097e-05 -5.44245e-05 2.77325e-05 -5.50328e-05 3.00849e-05 -5.57191e-05 3.24772e-05 -5.64715e-05 3.49212e-05 -5.72702e-05 3.74289e-05 -5.80839e-05 4.00096e-05 -5.88661e-05 4.26669e-05 -5.95513e-05 4.5392e-05 -6.00501e-05 4.81578e-05 -6.02486e-05 5.09147e-05 -6.0019e-05 5.35953e-05 -5.92349e-05 5.61211e-05 -5.77832e-05 5.84132e-05 -5.55694e-05 6.04007e-05 -5.25148e-05 6.20241e-05 -4.8543e-05 6.32282e-05 -4.35533e-05 6.39665e-05 -3.74283e-05 6.42087e-05 -3.00602e-05 6.38702e-05 -2.12516e-05 6.18741e-05 -9.73576e-06 5.99769e-05 2.0203e-06 5.96006e-05 1.57981e-05 5.84755e-05 2.96398e-05 5.83226e-05 4.38564e-05 5.85674e-05 5.67111e-05 5.89887e-05 6.78638e-05 5.94231e-05 7.70831e-05 6.03635e-05 8.52486e-05 6.44207e-05 9.57697e-05 0.000124234 7.04751e-07 -5.2159e-05 3.11706e-07 -5.44584e-05 6.58531e-07 -5.42828e-05 1.57801e-06 -5.42204e-05 2.91406e-06 -5.4247e-05 4.55129e-06 -5.43157e-05 6.4018e-06 -5.44038e-05 8.39897e-06 -5.45091e-05 1.04938e-05 -5.46409e-05 1.26511e-05 -5.48129e-05 1.48469e-05 -5.50383e-05 1.70654e-05 -5.5329e-05 1.92973e-05 -5.56945e-05 2.1539e-05 -5.6142e-05 2.37913e-05 -5.66768e-05 2.60592e-05 -5.73007e-05 2.83512e-05 -5.8011e-05 3.06784e-05 -5.87988e-05 3.30542e-05 -5.9646e-05 3.54924e-05 -6.05221e-05 3.80058e-05 -6.13794e-05 4.06013e-05 -6.21469e-05 4.3273e-05 -6.27217e-05 4.5989e-05 -6.29647e-05 4.86872e-05 -6.27172e-05 5.12815e-05 -6.18291e-05 5.36741e-05 -6.01757e-05 5.57706e-05 -5.76659e-05 5.74929e-05 -5.42372e-05 5.87894e-05 -4.98395e-05 5.9644e-05 -4.44078e-05 6.00551e-05 -3.78394e-05 6.00135e-05 -3.00185e-05 5.8244e-05 -1.94821e-05 5.81861e-05 -9.67787e-06 5.7603e-05 2.60346e-06 5.74039e-05 1.59972e-05 5.73669e-05 2.96768e-05 5.81057e-05 4.31176e-05 5.93201e-05 5.54967e-05 6.06962e-05 6.64876e-05 6.17303e-05 7.60489e-05 6.19752e-05 8.50037e-05 6.16122e-05 9.61326e-05 0.000126494 -3.99784e-07 -5.17593e-05 -9.6671e-07 -5.38915e-05 -7.26206e-07 -5.45233e-05 1.47023e-07 -5.50937e-05 1.47322e-06 -5.55732e-05 3.11565e-06 -5.59581e-05 4.9734e-06 -5.62615e-05 6.97297e-06 -5.65086e-05 9.06225e-06 -5.67302e-05 1.12054e-05 -5.6956e-05 1.33782e-05 -5.72112e-05 1.55653e-05 -5.75161e-05 1.77577e-05 -5.78868e-05 1.99515e-05 -5.83359e-05 2.21476e-05 -5.88729e-05 2.43508e-05 -5.95039e-05 2.65694e-05 -6.02296e-05 2.88146e-05 -6.1044e-05 3.11002e-05 -6.19316e-05 3.34418e-05 -6.28637e-05 3.58552e-05 -6.37928e-05 3.83536e-05 -6.46454e-05 4.09372e-05 -6.53052e-05 4.35709e-05 -6.55984e-05 4.61764e-05 -6.53228e-05 4.86436e-05 -6.42963e-05 5.085e-05 -6.23821e-05 5.26842e-05 -5.95001e-05 5.40684e-05 -5.56213e-05 5.49966e-05 -5.07677e-05 5.55209e-05 -4.49322e-05 5.56855e-05 -3.8004e-05 5.54328e-05 -2.97658e-05 5.55291e-05 -1.95785e-05 5.44795e-05 -8.62818e-06 5.36181e-05 3.46484e-06 5.31809e-05 1.64344e-05 5.33469e-05 2.95107e-05 5.42868e-05 4.21778e-05 5.58865e-05 5.3897e-05 5.79001e-05 6.4474e-05 5.97948e-05 7.41542e-05 6.04916e-05 8.43069e-05 5.79703e-05 9.8654e-05 0.000127436 -1.54605e-06 -5.02132e-05 -2.32195e-06 -5.31156e-05 -2.15695e-06 -5.46883e-05 -1.29579e-06 -5.59548e-05 4.80118e-08 -5.6917e-05 1.71363e-06 -5.76237e-05 3.58847e-06 -5.81364e-05 5.59426e-06 -5.85144e-05 7.67792e-06 -5.88139e-05 9.80442e-06 -5.90825e-05 1.19509e-05 -5.93577e-05 1.41026e-05 -5.96679e-05 1.62509e-05 -6.0035e-05 1.83915e-05 -6.04765e-05 2.05245e-05 -6.1006e-05 2.2654e-05 -6.16334e-05 2.47871e-05 -6.23627e-05 2.69337e-05 -6.31905e-05 2.91064e-05 -6.41043e-05 3.13208e-05 -6.50781e-05 3.35949e-05 -6.60669e-05 3.59505e-05 -6.7001e-05 3.84004e-05 -6.77551e-05 4.09095e-05 -6.81074e-05 4.33778e-05 -6.77911e-05 4.56638e-05 -6.65822e-05 4.76156e-05 -6.4334e-05 4.91131e-05 -6.09977e-05 5.01233e-05 -5.66315e-05 5.07089e-05 -5.13533e-05 5.09939e-05 -4.52172e-05 5.09125e-05 -3.79226e-05 5.06377e-05 -2.9491e-05 4.98996e-05 -1.88403e-05 4.861e-05 -7.33856e-06 4.73283e-05 4.74653e-06 4.65217e-05 1.72411e-05 4.64439e-05 2.95885e-05 4.7239e-05 4.13827e-05 4.88584e-05 5.22776e-05 5.10955e-05 6.22368e-05 5.34416e-05 7.18082e-05 5.50485e-05 8.26999e-05 5.41066e-05 9.95958e-05 0.00012731 -2.57829e-06 -4.76349e-05 -3.55206e-06 -5.21418e-05 -3.46221e-06 -5.47782e-05 -2.60026e-06 -5.68168e-05 -1.2306e-06 -5.82867e-05 4.58998e-07 -5.93133e-05 2.34579e-06 -6.00231e-05 4.34923e-06 -6.05179e-05 6.41741e-06 -6.08821e-05 8.51767e-06 -6.11828e-05 1.06293e-05 -6.14693e-05 1.27386e-05 -6.17772e-05 1.48368e-05 -6.21333e-05 1.6919e-05 -6.25586e-05 1.89835e-05 -6.30705e-05 2.10329e-05 -6.36828e-05 2.3072e-05 -6.44018e-05 2.51073e-05 -6.52258e-05 2.7148e-05 -6.61451e-05 2.92063e-05 -6.71363e-05 3.12981e-05 -6.81588e-05 3.34547e-05 -6.91575e-05 3.57121e-05 -7.00126e-05 3.80398e-05 -7.04351e-05 4.03091e-05 -7.00604e-05 4.23395e-05 -6.86126e-05 4.39521e-05 -6.59466e-05 4.50688e-05 -6.21144e-05 4.57427e-05 -5.73054e-05 4.61029e-05 -5.17135e-05 4.61349e-05 -4.52492e-05 4.58963e-05 -3.7684e-05 4.45762e-05 -2.81709e-05 4.28773e-05 -1.71413e-05 4.09965e-05 -5.45777e-06 3.92512e-05 6.4918e-06 3.8056e-05 1.84364e-05 3.76593e-05 2.99852e-05 3.82044e-05 4.08375e-05 3.96731e-05 5.08089e-05 4.18985e-05 6.00114e-05 4.44867e-05 6.922e-05 4.66962e-05 8.04904e-05 4.83659e-05 9.7926e-05 0.000125093 -3.07092e-06 -4.4564e-05 -4.2689e-06 -5.09438e-05 -4.34191e-06 -5.47052e-05 -3.52183e-06 -5.76369e-05 -2.15799e-06 -5.96505e-05 -4.77503e-07 -6.09938e-05 1.38801e-06 -6.18887e-05 3.35845e-06 -6.24883e-05 5.3846e-06 -6.29082e-05 7.437e-06 -6.32352e-05 9.49713e-06 -6.35294e-05 1.15521e-05 -6.38321e-05 1.35923e-05 -6.41736e-05 1.5611e-05 -6.45773e-05 1.7604e-05 -6.50635e-05 1.95716e-05 -6.56504e-05 2.15151e-05 -6.63452e-05 2.34358e-05 -6.71466e-05 2.53368e-05 -6.80461e-05 2.72216e-05 -6.90211e-05 2.90944e-05 -7.00315e-05 3.09899e-05 -7.1053e-05 3.29827e-05 -7.20054e-05 3.50521e-05 -7.25045e-05 3.70334e-05 -7.20418e-05 3.87103e-05 -7.02894e-05 3.99247e-05 -6.7161e-05 4.06792e-05 -6.28689e-05 4.11261e-05 -5.77523e-05 4.12908e-05 -5.18781e-05 4.1101e-05 -4.50594e-05 3.96457e-05 -3.62287e-05 3.7386e-05 -2.59111e-05 3.48801e-05 -1.46354e-05 3.24065e-05 -2.98417e-06 3.02432e-05 8.65508e-06 2.87025e-05 1.99771e-05 2.80002e-05 3.06876e-05 2.82623e-05 4.05754e-05 2.95067e-05 4.95645e-05 3.1656e-05 5.78621e-05 3.459e-05 6.62861e-05 3.81181e-05 7.69623e-05 4.23293e-05 9.37149e-05 0.000120745 -2.01871e-06 -4.25453e-05 -3.75863e-06 -4.92039e-05 -4.40412e-06 -5.40597e-05 -3.74567e-06 -5.82953e-05 -2.46635e-06 -6.09298e-05 -8.70337e-07 -6.25898e-05 9.03277e-07 -6.36623e-05 2.77974e-06 -6.43648e-05 4.71499e-06 -6.48434e-05 6.68169e-06 -6.52019e-05 8.66186e-06 -6.55096e-05 1.06421e-05 -6.58123e-05 1.26116e-05 -6.61431e-05 1.45603e-05 -6.65261e-05 1.64804e-05 -6.69836e-05 1.83697e-05 -6.75397e-05 2.02254e-05 -6.82009e-05 2.20426e-05 -6.89638e-05 2.38167e-05 -6.98201e-05 2.554e-05 -7.07444e-05 2.71903e-05 -7.16819e-05 2.8784e-05 -7.26468e-05 3.04356e-05 -7.36569e-05 3.21406e-05 -7.42095e-05 3.37071e-05 -7.36083e-05 3.49381e-05 -7.15205e-05 3.57517e-05 -6.79745e-05 3.62574e-05 -6.33746e-05 3.65415e-05 -5.80364e-05 3.6507e-05 -5.18437e-05 3.50213e-05 -4.35738e-05 3.25291e-05 -3.37365e-05 2.95191e-05 -2.29011e-05 2.64114e-05 -1.15277e-05 2.34881e-05 -6.08763e-08 2.09939e-05 1.11493e-05 1.91609e-05 2.18101e-05 1.81618e-05 3.16867e-05 1.81089e-05 4.06283e-05 1.90553e-05 4.86181e-05 2.10226e-05 5.58947e-05 2.41e-05 6.32088e-05 2.85944e-05 7.24678e-05 3.47739e-05 8.75355e-05 0.000114648 2.88032e-06 -4.54256e-05 -7.82965e-07 -4.55406e-05 -3.15148e-06 -5.16912e-05 -2.96991e-06 -5.84769e-05 -1.93571e-06 -6.1964e-05 -5.35794e-07 -6.39897e-05 1.05542e-06 -6.52535e-05 2.7644e-06 -6.60738e-05 4.54901e-06 -6.66281e-05 6.38199e-06 -6.70349e-05 8.24359e-06 -6.73712e-05 1.0119e-05 -6.76877e-05 1.19965e-05 -6.80205e-05 1.38635e-05 -6.83932e-05 1.5708e-05 -6.88281e-05 1.75259e-05 -6.93576e-05 1.93102e-05 -6.99853e-05 2.10507e-05 -7.07043e-05 2.27365e-05 -7.15059e-05 2.43547e-05 -7.23626e-05 2.58607e-05 -7.31878e-05 2.72031e-05 -7.39892e-05 2.84579e-05 -7.49117e-05 2.96499e-05 -7.54015e-05 3.06458e-05 -7.46042e-05 3.1376e-05 -7.22507e-05 3.18894e-05 -6.8488e-05 3.22005e-05 -6.36857e-05 3.2311e-05 -5.81469e-05 3.08498e-05 -5.03825e-05 2.82435e-05 -4.09674e-05 2.49726e-05 -3.04656e-05 2.14194e-05 -1.9348e-05 1.79102e-05 -8.01843e-06 1.4686e-05 3.16341e-06 1.1949e-05 1.38863e-05 9.87284e-06 2.38863e-05 8.58871e-06 3.29708e-05 8.1869e-06 4.10301e-05 8.72638e-06 4.80786e-05 1.02637e-05 5.43574e-05 1.29299e-05 6.05427e-05 1.70949e-05 6.83028e-05 2.32545e-05 8.13759e-05 0.000107981 1.70814e-05 -6.2507e-05 7.44542e-06 -3.59047e-05 9.38403e-07 -4.51841e-05 -8.11564e-07 -5.67269e-05 -5.76248e-07 -6.21994e-05 4.52147e-07 -6.50181e-05 1.79705e-06 -6.65984e-05 3.30387e-06 -6.75806e-05 4.90795e-06 -6.82321e-05 6.57597e-06 -6.87029e-05 8.28951e-06 -6.90847e-05 1.00336e-05 -6.94319e-05 1.17976e-05 -6.97844e-05 1.35688e-05 -7.01645e-05 1.5335e-05 -7.05943e-05 1.70875e-05 -7.111e-05 1.88136e-05 -7.17114e-05 2.05011e-05 -7.23919e-05 2.21331e-05 -7.31378e-05 2.36951e-05 -7.39247e-05 2.51892e-05 -7.4682e-05 2.64902e-05 -7.52902e-05 2.73313e-05 -7.57528e-05 2.78572e-05 -7.59274e-05 2.82195e-05 -7.49665e-05 2.84993e-05 -7.25305e-05 2.86219e-05 -6.86106e-05 2.87659e-05 -6.38297e-05 2.72536e-05 -5.66347e-05 2.45697e-05 -4.76986e-05 2.11435e-05 -3.75412e-05 1.73287e-05 -2.66508e-05 1.34242e-05 -1.54435e-05 9.67681e-06 -4.27103e-06 6.2765e-06 6.56373e-06 3.38211e-06 1.67806e-05 1.11902e-06 2.61494e-05 -4.2127e-07 3.45111e-05 -1.17813e-06 4.1787e-05 -1.11109e-06 4.80115e-05 -1.75976e-07 5.34222e-05 1.71488e-06 5.86518e-05 4.84611e-06 6.51716e-05 9.83329e-06 7.63887e-05 9.93773e-05 8.14671e-06 -7.06537e-05 5.04669e-06 -3.28046e-05 3.40605e-06 -4.35435e-05 2.27737e-06 -5.55983e-05 1.66858e-06 -6.15906e-05 1.79692e-06 -6.51465e-05 2.7011e-06 -6.75026e-05 4.06412e-06 -6.89436e-05 5.50946e-06 -6.96775e-05 7.03682e-06 -7.02302e-05 8.63456e-06 -7.06825e-05 1.02773e-05 -7.10746e-05 1.19453e-05 -7.14524e-05 1.36395e-05 -7.18587e-05 1.53636e-05 -7.23184e-05 1.71025e-05 -7.28489e-05 1.8847e-05 -7.34558e-05 2.0583e-05 -7.41278e-05 2.22848e-05 -7.48397e-05 2.39275e-05 -7.55674e-05 2.56977e-05 -7.64522e-05 2.71152e-05 -7.67076e-05 2.73518e-05 -7.59895e-05 2.69108e-05 -7.54863e-05 2.63115e-05 -7.43672e-05 2.63053e-05 -7.25243e-05 2.62206e-05 -6.85258e-05 2.44407e-05 -6.20498e-05 2.15917e-05 -5.37857e-05 1.80107e-05 -4.41176e-05 1.40075e-05 -3.35381e-05 9.84707e-06 -2.24903e-05 5.75105e-06 -1.13474e-05 1.89642e-06 -4.1642e-07 -1.57219e-06 1.00324e-05 -4.5372e-06 1.97457e-05 -6.91467e-06 2.85269e-05 -8.65065e-06 3.62471e-05 -9.71666e-06 4.2853e-05 -1.00986e-05 4.83935e-05 -9.76953e-06 5.30932e-05 -8.65443e-06 5.75367e-05 -6.48369e-06 6.30008e-05 -2.35614e-06 7.22612e-05 9.09162e-05 -7.04794e-06 -6.36058e-05 3.98258e-07 -4.02507e-05 5.14115e-06 -4.82864e-05 6.22284e-06 -5.66799e-05 6.43349e-06 -6.18013e-05 6.41824e-06 -6.51312e-05 6.3643e-06 -6.74486e-05 6.43043e-06 -6.90097e-05 6.68473e-06 -6.99318e-05 7.70108e-06 -7.12466e-05 9.13513e-06 -7.21165e-05 1.07355e-05 -7.2675e-05 1.241e-05 -7.31269e-05 1.41458e-05 -7.35945e-05 1.59388e-05 -7.41114e-05 1.7761e-05 -7.46711e-05 1.9594e-05 -7.52889e-05 2.14137e-05 -7.59475e-05 2.31606e-05 -7.65865e-05 2.47352e-05 -7.7142e-05 2.6172e-05 -7.7889e-05 2.7276e-05 -7.78116e-05 2.76458e-05 -7.63592e-05 2.73079e-05 -7.51484e-05 2.6723e-05 -7.37824e-05 2.51931e-05 -7.09944e-05 2.26879e-05 -6.60206e-05 1.94425e-05 -5.88044e-05 1.55977e-05 -4.99409e-05 1.13855e-05 -3.99055e-05 7.01893e-06 -2.91715e-05 2.68234e-06 -1.81538e-05 -1.47135e-06 -7.19375e-06 -5.318e-06 3.43022e-06 -8.75025e-06 1.34646e-05 -1.169e-05 2.26854e-05 -1.40914e-05 3.09282e-05 -1.59355e-05 3.80912e-05 -1.72235e-05 4.4141e-05 -1.79636e-05 4.91336e-05 -1.81409e-05 5.32705e-05 -1.76521e-05 5.70478e-05 -1.61633e-05 6.1512e-05 -1.26137e-05 6.87115e-05 8.25056e-05 -6.93255e-06 -5.66733e-05 2.65376e-06 -4.98371e-05 8.2768e-06 -5.39095e-05 1.03798e-05 -5.87829e-05 1.10476e-05 -6.24691e-05 1.12071e-05 -6.52907e-05 1.12699e-05 -6.75114e-05 1.14993e-05 -6.92391e-05 1.21974e-05 -7.06299e-05 1.29117e-05 -7.19609e-05 1.37804e-05 -7.29852e-05 1.48671e-05 -7.37618e-05 1.61429e-05 -7.44026e-05 1.75976e-05 -7.50491e-05 1.91854e-05 -7.56993e-05 2.08532e-05 -7.63388e-05 2.2557e-05 -7.69927e-05 2.41669e-05 -7.75575e-05 2.56276e-05 -7.80472e-05 2.68438e-05 -7.83582e-05 2.74001e-05 -7.84453e-05 2.73783e-05 -7.77898e-05 2.717e-05 -7.61509e-05 2.62938e-05 -7.42722e-05 2.44251e-05 -7.19137e-05 2.16142e-05 -6.81835e-05 1.79599e-05 -6.23663e-05 1.38198e-05 -5.46644e-05 9.37637e-06 -4.54975e-05 4.81242e-06 -3.53415e-05 2.84313e-07 -2.46434e-05 -4.07701e-06 -1.37925e-05 -8.1658e-06 -3.10498e-06 -1.18939e-05 7.15827e-06 -1.51883e-05 1.6759e-05 -1.80065e-05 2.55036e-05 -2.03349e-05 3.32567e-05 -2.21845e-05 3.99407e-05 -2.35824e-05 4.55389e-05 -2.45583e-05 5.01095e-05 -2.51118e-05 5.3824e-05 -2.51378e-05 5.70738e-05 -2.42725e-05 6.06467e-05 -2.15273e-05 6.59664e-05 7.56353e-05 -1.93261e-06 -5.47407e-05 5.28543e-06 -5.70551e-05 1.04049e-05 -5.90289e-05 1.30131e-05 -6.13912e-05 1.42361e-05 -6.36921e-05 1.47987e-05 -6.58532e-05 1.51063e-05 -6.78189e-05 1.54287e-05 -6.95615e-05 1.59014e-05 -7.11027e-05 1.64282e-05 -7.24877e-05 1.70845e-05 -7.36415e-05 1.79232e-05 -7.46005e-05 1.89511e-05 -7.54306e-05 2.01102e-05 -7.62082e-05 2.1346e-05 -7.69351e-05 2.26012e-05 -7.7594e-05 2.37843e-05 -7.81758e-05 2.48369e-05 -7.86101e-05 2.56513e-05 -7.88615e-05 2.61146e-05 -7.88215e-05 2.60235e-05 -7.83542e-05 2.54066e-05 -7.71729e-05 2.4447e-05 -7.51914e-05 2.28011e-05 -7.26263e-05 2.01778e-05 -6.92904e-05 1.65785e-05 -6.45842e-05 1.23536e-05 -5.81413e-05 7.77709e-06 -5.00879e-05 3.06684e-06 -4.07873e-05 -1.61084e-06 -3.06639e-05 -6.12501e-06 -2.01293e-05 -1.03756e-05 -9.54183e-06 -1.42869e-05 8.06287e-07 -1.77961e-05 1.06675e-05 -2.08604e-05 1.98233e-05 -2.34656e-05 2.81088e-05 -2.56239e-05 3.5415e-05 -2.73698e-05 4.16866e-05 -2.87528e-05 4.69218e-05 -2.98236e-05 5.11802e-05 -3.0607e-05 5.46075e-05 -3.10313e-05 5.74981e-05 -3.0789e-05 6.04044e-05 -2.90604e-05 6.42378e-05 7.06337e-05 8.83848e-07 -5.56245e-05 6.81351e-06 -6.29848e-05 1.1316e-05 -6.35314e-05 1.40749e-05 -6.415e-05 1.56949e-05 -6.53122e-05 1.66541e-05 -6.68124e-05 1.72654e-05 -6.84302e-05 1.77334e-05 -7.00295e-05 1.81726e-05 -7.15418e-05 1.86167e-05 -7.29318e-05 1.91311e-05 -7.41559e-05 1.97536e-05 -7.52229e-05 2.04835e-05 -7.61605e-05 2.12754e-05 -7.70001e-05 2.20781e-05 -7.77378e-05 2.28364e-05 -7.83524e-05 2.34732e-05 -7.88126e-05 2.39221e-05 -7.9059e-05 2.40841e-05 -7.90235e-05 2.38618e-05 -7.85991e-05 2.3154e-05 -7.76464e-05 2.19661e-05 -7.5985e-05 2.02936e-05 -7.35188e-05 1.79372e-05 -7.02699e-05 1.47294e-05 -6.60826e-05 1.07497e-05 -6.06045e-05 6.26747e-06 -5.36591e-05 1.55053e-06 -4.5371e-05 -3.19035e-06 -3.60464e-05 -7.79667e-06 -2.60575e-05 -1.2153e-05 -1.57729e-05 -1.61782e-05 -5.51666e-06 -1.98154e-05 4.44352e-06 -2.30208e-05 1.38728e-05 -2.57746e-05 2.25772e-05 -2.80841e-05 3.04183e-05 -2.99804e-05 3.73113e-05 -3.1515e-05 4.32213e-05 -3.27543e-05 4.81611e-05 -3.37686e-05 5.21945e-05 -3.46134e-05 5.54523e-05 -3.52799e-05 5.81645e-05 -3.55955e-05 6.072e-05 -3.50692e-05 6.37115e-05 6.8171e-05 2.28213e-06 -5.79067e-05 7.38025e-06 -6.80829e-05 1.12231e-05 -6.73742e-05 1.38875e-05 -6.68144e-05 1.57142e-05 -6.71389e-05 1.69594e-05 -6.80576e-05 1.78199e-05 -6.92907e-05 1.84439e-05 -7.06536e-05 1.89339e-05 -7.20318e-05 1.93542e-05 -7.33521e-05 1.97634e-05 -7.45651e-05 2.0193e-05 -7.56525e-05 2.06433e-05 -7.66108e-05 2.10847e-05 -7.74415e-05 2.14749e-05 -7.81279e-05 2.17622e-05 -7.86397e-05 2.18835e-05 -7.89339e-05 2.17701e-05 -7.89455e-05 2.13422e-05 -7.85957e-05 2.05208e-05 -7.77777e-05 1.92389e-05 -7.63644e-05 1.74701e-05 -7.42162e-05 1.5188e-05 -7.12368e-05 1.22893e-05 -6.73712e-05 8.70378e-06 -6.24971e-05 4.53327e-06 -5.6434e-05 -7.08311e-10 -4.91251e-05 -4.66665e-06 -4.0705e-05 -9.27177e-06 -3.14413e-05 -1.36696e-05 -2.16598e-05 -1.77572e-05 -1.16853e-05 -2.14668e-05 -1.80712e-06 -2.47524e-05 7.72915e-06 -2.75855e-05 1.67059e-05 -2.99633e-05 2.49549e-05 -3.19076e-05 3.23626e-05 -3.34624e-05 3.88659e-05 -3.46891e-05 4.4448e-05 -3.56634e-05 4.91355e-05 -3.64678e-05 5.29989e-05 -3.71793e-05 5.61638e-05 -3.78435e-05 5.88288e-05 -3.84205e-05 6.1297e-05 -3.87139e-05 6.40048e-05 6.76528e-05 3.30452e-06 -6.12112e-05 7.33343e-06 -7.21118e-05 1.04285e-05 -7.04693e-05 1.28454e-05 -6.92314e-05 1.47092e-05 -6.90027e-05 1.61054e-05 -6.94538e-05 1.71277e-05 -7.03129e-05 1.78688e-05 -7.13947e-05 1.8409e-05 -7.25719e-05 1.88113e-05 -7.37545e-05 1.91251e-05 -7.48789e-05 1.93781e-05 -7.59055e-05 1.95747e-05 -7.68074e-05 1.96959e-05 -7.75627e-05 1.97084e-05 -7.81404e-05 1.95678e-05 -7.84992e-05 1.92197e-05 -7.85857e-05 1.86042e-05 -7.83301e-05 1.76563e-05 -7.76477e-05 1.63143e-05 -7.64357e-05 1.45286e-05 -7.45788e-05 1.2273e-05 -7.19606e-05 9.52505e-06 -6.84887e-05 6.24768e-06 -6.40938e-05 2.44439e-06 -5.86938e-05 -1.7758e-06 -5.22138e-05 -6.22872e-06 -4.46722e-05 -1.07185e-05 -3.62152e-05 -1.50753e-05 -2.70845e-05 -1.91689e-05 -1.75662e-05 -2.29084e-05 -7.94587e-06 -2.62357e-05 1.52022e-06 -2.91128e-05 1.06062e-05 -3.15239e-05 1.91169e-05 -3.34777e-05 2.69088e-05 -3.50057e-05 3.38906e-05 -3.61584e-05 4.00186e-05 -3.70015e-05 4.52911e-05 -3.76118e-05 4.97458e-05 -3.80725e-05 5.34596e-05 -3.84637e-05 5.65549e-05 -3.88471e-05 5.92122e-05 -3.92371e-05 6.16869e-05 -3.95617e-05 6.43294e-05 6.76349e-05 3.8376e-06 -6.50488e-05 6.79275e-06 -7.50669e-05 9.18143e-06 -7.2858e-05 1.12804e-05 -7.13304e-05 1.3048e-05 -7.07703e-05 1.44587e-05 -7.08645e-05 1.55338e-05 -7.13881e-05 1.63199e-05 -7.21808e-05 1.68694e-05 -7.31215e-05 1.72307e-05 -7.41157e-05 1.74424e-05 -7.50906e-05 1.75279e-05 -7.59909e-05 1.74927e-05 -7.67723e-05 1.73246e-05 -7.73946e-05 1.69977e-05 -7.78135e-05 1.64754e-05 -7.79769e-05 1.57126e-05 -7.78229e-05 1.46599e-05 -7.72773e-05 1.32663e-05 -7.62542e-05 1.14867e-05 -7.4656e-05 9.28778e-06 -7.23798e-05 6.65367e-06 -6.93265e-05 3.58072e-06 -6.54158e-05 7.61256e-08 -6.05892e-05 -3.81391e-06 -5.48037e-05 -7.97813e-06 -4.80496e-05 -1.22584e-05 -4.03919e-05 -1.64888e-05 -3.19847e-05 -2.05238e-05 -2.30496e-05 -2.425e-05 -1.384e-05 -2.75886e-05 -4.60737e-06 -3.04895e-05 4.42115e-06 -3.29223e-05 1.30391e-05 -3.48811e-05 2.10758e-05 -3.63832e-05 2.84109e-05 -3.74654e-05 3.49728e-05 -3.81807e-05 4.07339e-05 -3.85942e-05 4.57045e-05 -3.8778e-05 4.99297e-05 -3.8807e-05 5.34886e-05 -3.87497e-05 5.64976e-05 -3.86554e-05 5.91178e-05 -3.85316e-05 6.15632e-05 -3.83142e-05 6.41121e-05 6.71059e-05 3.83552e-06 -6.88843e-05 5.85187e-06 -7.70833e-05 7.66288e-06 -7.4669e-05 9.42487e-06 -7.30923e-05 1.10009e-05 -7.23463e-05 1.23107e-05 -7.21743e-05 1.33335e-05 -7.24108e-05 1.40812e-05 -7.29285e-05 1.4581e-05 -7.36213e-05 1.48634e-05 -7.43981e-05 1.49547e-05 -7.51819e-05 1.48718e-05 -7.59081e-05 1.46192e-05 -7.65197e-05 1.41879e-05 -7.69633e-05 1.35578e-05 -7.71833e-05 1.26995e-05 -7.71186e-05 1.15775e-05 -7.67009e-05 1.01536e-05 -7.58535e-05 8.39119e-06 -7.44918e-05 6.26031e-06 -7.25252e-05 3.74366e-06 -6.98632e-05 8.40506e-07 -6.64233e-05 -2.43284e-06 -6.21425e-05 -6.04009e-06 -5.6982e-05 -9.91202e-06 -5.09318e-05 -1.39379e-05 -4.40237e-05 -1.79795e-05 -3.63503e-05 -2.18959e-05 -2.80683e-05 -2.55629e-05 -1.93825e-05 -2.88837e-05 -1.05192e-05 -3.17909e-05 -1.70019e-06 -3.42418e-05 6.87201e-06 -3.62142e-05 1.50115e-05 -3.77104e-05 2.2572e-05 -3.87536e-05 2.9454e-05 -3.93838e-05 3.5603e-05 -3.9654e-05 4.10041e-05 -3.96255e-05 4.5676e-05 -3.93631e-05 4.96673e-05 -3.89294e-05 5.30549e-05 -3.83768e-05 5.5945e-05 -3.7734e-05 5.8475e-05 -3.69879e-05 6.08171e-05 -3.60568e-05 6.3181e-05 6.57903e-05 3.40474e-06 -7.2289e-05 4.66221e-06 -7.83408e-05 6.01376e-06 -7.60206e-05 7.43464e-06 -7.45132e-05 8.75272e-06 -7.36644e-05 9.87293e-06 -7.32946e-05 1.07541e-05 -7.32919e-05 1.13861e-05 -7.35605e-05 1.17756e-05 -7.40107e-05 1.19363e-05 -7.45589e-05 1.18827e-05 -7.51283e-05 1.1624e-05 -7.56494e-05 1.11618e-05 -7.60575e-05 1.04883e-05 -7.62899e-05 9.58761e-06 -7.62826e-05 8.43714e-06 -7.59681e-05 7.01044e-06 -7.52742e-05 5.28058e-06 -7.41236e-05 3.22414e-06 -7.24353e-05 8.25937e-07 -7.0127e-05 -1.91649e-06 -6.71208e-05 -4.98835e-06 -6.33515e-05 -8.35646e-06 -5.87744e-05 -1.19661e-05 -5.33722e-05 -1.57368e-05 -4.71611e-05 -1.95615e-05 -4.01991e-05 -2.33179e-05 -3.25939e-05 -2.68853e-05 -2.4501e-05 -3.0158e-05 -1.61098e-05 -3.30544e-05 -7.62287e-06 -3.55181e-05 7.63543e-07 -3.75138e-05 8.86774e-06 -3.90283e-05 1.6526e-05 -4.00704e-05 2.36141e-05 -4.06676e-05 3.00512e-05 -4.08616e-05 3.5797e-05 -4.07038e-05 4.08462e-05 -4.02509e-05 4.52231e-05 -3.956e-05 4.89763e-05 -3.8682e-05 5.21769e-05 -3.76548e-05 5.49178e-05 -3.6492e-05 5.73122e-05 -3.51682e-05 5.94933e-05 -3.3598e-05 6.16108e-05 6.38055e-05 2.6896e-06 -7.49786e-05 3.37448e-06 -7.90257e-05 4.3399e-06 -7.6986e-05 5.41342e-06 -7.55867e-05 6.42804e-06 -7.4679e-05 7.295e-06 -7.41615e-05 7.96649e-06 -7.39634e-05 8.41919e-06 -7.40132e-05 8.64502e-06 -7.42366e-05 8.64442e-06 -7.45583e-05 8.42076e-06 -7.49046e-05 7.97607e-06 -7.52047e-05 7.30821e-06 -7.53896e-05 6.40964e-06 -7.53913e-05 5.2677e-06 -7.51406e-05 3.86586e-06 -7.45663e-05 2.18599e-06 -7.35944e-05 2.11506e-07 -7.21492e-05 -2.0689e-06 -7.01549e-05 -4.65711e-06 -6.75388e-05 -7.54165e-06 -6.42362e-05 -1.06946e-05 -6.01985e-05 -1.40702e-05 -5.53988e-05 -1.76032e-05 -4.98392e-05 -2.12088e-05 -4.35556e-05 -2.47856e-05 -3.66223e-05 -2.82249e-05 -2.91546e-05 -3.14228e-05 -2.13031e-05 -3.429e-05 -1.32425e-05 -3.67584e-05 -5.15452e-06 -3.8782e-05 2.78722e-06 -4.03337e-05 1.04195e-05 -4.14084e-05 1.76006e-05 -4.20206e-05 2.42263e-05 -4.22011e-05 3.02317e-05 -4.19923e-05 3.55882e-05 -4.14436e-05 4.02975e-05 -4.06066e-05 4.43861e-05 -3.95312e-05 4.79009e-05 -3.82597e-05 5.09054e-05 -3.68201e-05 5.34782e-05 -3.52185e-05 5.57106e-05 -3.34276e-05 5.77025e-05 -3.13741e-05 5.95572e-05 6.13638e-05 1.8389e-06 -7.68175e-05 2.10296e-06 -7.92897e-05 2.71538e-06 -7.75984e-05 3.4305e-06 -7.63018e-05 4.1114e-06 -7.53599e-05 4.68277e-06 -7.47328e-05 5.0968e-06 -7.43774e-05 5.32322e-06 -7.42396e-05 5.34406e-06 -7.42574e-05 5.14955e-06 -7.43638e-05 4.7343e-06 -7.44894e-05 4.09412e-06 -7.45646e-05 3.22369e-06 -7.45192e-05 2.1152e-06 -7.42828e-05 7.58489e-07 -7.37839e-05 -8.57735e-07 -7.295e-05 -2.74393e-06 -7.17082e-05 -4.90714e-06 -6.99859e-05 -7.34785e-06 -6.77142e-05 -1.00565e-05 -6.48301e-05 -1.30101e-05 -1.61707e-05 -1.94838e-05 -2.28791e-05 -2.62719e-05 -2.95679e-05 -3.26708e-05 -3.54912e-05 -3.7954e-05 -4.00033e-05 -4.16028e-05 -4.27342e-05 -4.33993e-05 -4.36181e-05 -4.34235e-05 -4.28574e-05 -4.19668e-05 -4.07993e-05 -3.93988e-05 -3.78012e-05 -3.6029e-05 -3.40862e-05 -3.19516e-05 -2.95706e-05 9.70406e-07 9.18377e-07 1.18498e-06 1.53156e-06 1.861e-06 2.11195e-06 2.23888e-06 2.20793e-06 1.99497e-06 1.58328e-06 9.61168e-07 1.19613e-07 -9.49392e-07 -2.25374e-06 -3.80103e-06 -5.59774e-06 -7.64762e-06 -9.94945e-06 -1.24945e-05 ) ; boundaryField { leftWall { type calculated; value uniform 0; } rightWall { type calculated; value nonuniform 0(); } lowerWall { type calculated; value uniform 0; } atmosphere { type calculated; value nonuniform 0(); } defaultFaces { type empty; value nonuniform 0(); } procBoundary0to1 { type processor; value nonuniform List<scalar> 44 ( -1.35541e-05 7.48025e-06 2.30165e-05 3.12971e-05 3.53149e-05 3.76765e-05 4.00009e-05 4.33101e-05 4.84577e-05 5.60177e-05 6.73849e-05 7.76837e-05 8.45151e-05 8.85795e-05 9.03904e-05 8.99123e-05 8.7131e-05 8.23162e-05 7.63077e-05 7.0763e-05 -0.00012482 6.86323e-05 6.54453e-05 6.26421e-05 5.93524e-05 5.70277e-05 5.4233e-05 5.05832e-05 4.66771e-05 4.08709e-05 2.99211e-05 1.84373e-05 6.10488e-06 -4.20298e-06 -1.46571e-05 -2.40587e-05 -3.26065e-05 -3.81957e-05 -3.95438e-05 -3.77854e-05 -3.47412e-05 -3.16131e-05 -2.89323e-05 -2.68567e-05 ) ; } procBoundary0to2 { type processor; value nonuniform List<scalar> 46 ( -6.12826e-05 -5.70379e-05 -5.20857e-05 -4.6444e-05 -4.01629e-05 -3.33264e-05 -2.60516e-05 -1.84827e-05 -1.07797e-05 -3.10539e-06 4.38662e-06 1.15508e-05 1.82658e-05 2.4445e-05 3.0037e-05 3.50222e-05 3.94069e-05 4.32185e-05 4.65004e-05 4.93079e-05 5.17061e-05 5.37678e-05 5.55678e-05 5.71763e-05 5.86499e-05 -7.77879e-05 -7.92376e-05 -7.7865e-05 -7.66485e-05 -7.56894e-05 -7.49838e-05 -7.45043e-05 -7.42087e-05 -7.40444e-05 -7.3952e-05 -7.38672e-05 -7.3723e-05 -7.34502e-05 -7.29785e-05 -7.22366e-05 -7.11533e-05 -6.96583e-05 -6.76842e-05 -6.51693e-05 -1.52636e-05 -6.20611e-05 ) ; } } // ************************************************************************* //
[ "fang.liu@oit.gatech.edu" ]
fang.liu@oit.gatech.edu
682ab0ad7a3e94fdebd2cba033d5ea15bd1d4555
0964b7defb8e49d90b0f98cecb27ef8dda06474a
/res/res_lib.cpp
5f66661d6046cbf11a209ca042976622010a1b54
[]
no_license
WindyValley/Snake
f1fdb4c704544430bbe934c4f837d4cc457fac84
615e16de8b4e7068ae95e3702318cdb2b18cac40
refs/heads/main
2023-03-18T19:49:51.386169
2021-02-09T12:37:57
2021-02-09T12:37:57
337,026,982
0
0
null
null
null
null
UTF-8
C++
false
false
317
cpp
#include "Resource.h" Resource res_bk = LOAD_RESOURCE(res_bk_mp3); Resource res_tada = LOAD_RESOURCE(res_tada_wav); Resource res_body = LOAD_RESOURCE(res_body_bmp); Resource res_button = LOAD_RESOURCE(res_button_bmp); Resource res_food = LOAD_RESOURCE(res_food_bmp); Resource res_font = LOAD_RESOURCE(res_simkai_ttf);
[ "2519087323@qq.com" ]
2519087323@qq.com
fff3123d93bc1a534d87521449d88c1b8a29f03e
b22588340d7925b614a735bbbde1b351ad657ffc
/athena/Trigger/TrigAnalysis/TriggerMatchingTool/Root/MatchingTool.cxx
eded98786d9b0efee4f1c7cc6720a3c681c3f01e
[]
no_license
rushioda/PIXELVALID_athena
90befe12042c1249cbb3655dde1428bb9b9a42ce
22df23187ef85e9c3120122c8375ea0e7d8ea440
refs/heads/master
2020-12-14T22:01:15.365949
2020-01-19T03:59:35
2020-01-19T03:59:35
234,836,993
1
0
null
null
null
null
UTF-8
C++
false
false
7,581
cxx
/* Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ #include "TriggerMatchingTool/MatchingTool.h" #include "TriggerMatchingTool/MatchingImplementation.h" #include "xAODBase/IParticle.h" #include "FourMomUtils/xAODP4Helpers.h" namespace Trig { MatchingTool::MatchingTool(const std::string& name) : asg::AsgTool(name), m_impl(new Trig::MatchingImplementation(*this)), m_trigDecTool("Trig::TrigDecisionTool/TrigDecisionTool"), m_matchingThreshold(0) { declareProperty( "TrigDecisionTool", m_trigDecTool); #ifndef XAOD_STANDALONE // declareProperty( "DefaultMatchingThreshold", m_matchingThreshold = 0.4)->declareUpdateHandler(&MatchingTool::updateThreshold, this ); auto props = getProperties(); for( Property* prop : props ) { if( prop->name() != "OutputLevel" ) { continue; } prop->declareUpdateHandler( &MatchingTool::updateOutputLevel, this ); break; } #else // declareProperty( "DefaultMatchingThreshold", m_matchingThreshold = 0.4); #endif } #ifndef XAOD_STANDALONE void MatchingTool::updateOutputLevel(Property& p) { this->msg_update_handler(p); //calls original handler impl()->msg().setLevel(AthMessaging::msg().level()); //pass on our message level to the matchingimplementation } void MatchingTool::updateThreshold(Property& /*p*/) { ATH_MSG_DEBUG("Matching Threshold is updated to:" << m_matchingThreshold); impl()->setThreshold( m_matchingThreshold ); } #endif MatchingTool::~MatchingTool(){ delete m_impl; } StatusCode MatchingTool::initialize() { impl()->setThreshold( m_matchingThreshold ); ATH_CHECK( m_trigDecTool.retrieve() ); return StatusCode::SUCCESS; } bool MatchingTool::matchCombination(const std::vector<const xAOD::IParticle*>& recoObjects, Trig::Combination& comb, const std::string& chain){ std::map<xAOD::Type::ObjectType,std::vector<const xAOD::IParticle*> > type_separated; for(const auto& obj : recoObjects){ if(type_separated.find(obj->type()) == type_separated.end()){ std::vector<const xAOD::IParticle*> typevec; type_separated[obj->type()] = typevec; } type_separated[obj->type()].push_back(obj); } ATH_MSG_DEBUG("found: " << type_separated.size() << " unique objects types to match"); for(auto& type_vec : type_separated){ ATH_MSG_DEBUG("type: " << type_vec.first << "(" << type_vec.second.size() << " elements)"); } bool overall_status = true; std::map<xAOD::Type::ObjectType,bool> status; for(auto& type_vec : type_separated){ auto single_status = matchSingleType(type_vec.second, comb, chain); ATH_MSG_DEBUG("type: " << type_vec.first << " status: " << single_status); status[type_vec.first] = single_status; overall_status = overall_status && single_status; } return overall_status; } bool MatchingTool::matchSingleType(const std::vector<const xAOD::IParticle*>& recoObjects, Trig::Combination& comb, const std::string& chain){ ATH_MSG_DEBUG("matching combination with " << comb.tes().size() << " TEs"); auto recoType = recoObjects.at(0)->type(); ATH_MSG_DEBUG("reco type is " << recoType); HLT::class_id_type clid = 0; std::string container_typename(""); // This hack is to make Offline electrons to be matched to online HLT CaloClusters if HLT chain is _etcut type if (recoType == xAOD::Type::Electron && chain.find("etcut") != std::string::npos && chain.find("trkcut") == std::string::npos){ ATH_MSG_DEBUG("Electron offline and matching electron etcut chain. Try to match to cluster instead!: " ); recoType=xAOD::Type::CaloCluster; } if(m_typeMap.isKnown(recoType)){ auto clid_container = m_typeMap.get(recoType); clid = clid_container.first; container_typename = clid_container.second; ATH_MSG_DEBUG("getting trigger features (clid: " << clid << " and type: " << container_typename << ")"); } else{ ATH_MSG_WARNING("could not find corresponding trigger type, can't match"); return false; } auto iparticle_feats = comb.getIParticle(clid,container_typename); ATH_MSG_DEBUG("found: " << iparticle_feats.size() << " xAOD::IParticle"); for(auto& feat : iparticle_feats){ ATH_MSG_DEBUG(" ==> pt: " << feat.cptr()->pt() << " and eta: " << feat.cptr()->eta() << " address: " << feat.cptr()); } if(recoObjects.size() > iparticle_feats.size()){ ATH_MSG_WARNING("more reco objects (" << recoObjects.size() << ") than trigger object (" << iparticle_feats.size() << "). no hope of matching!"); return false; } ATH_MSG_DEBUG("now matching: " << recoObjects.size() << " reco objects to " << iparticle_feats.size() << " trigger objects"); std::vector<const xAOD::IParticle*> trigObjects; for(auto& feat : iparticle_feats){trigObjects.push_back(feat.cptr());} auto distance_matrix = distanceMatrix(recoObjects,trigObjects); ATH_MSG_DEBUG("made distance matrix"); bool match_result = impl()->matchDistanceMatrix(distance_matrix); ATH_MSG_DEBUG("got matching result: " << match_result); return match_result; } bool MatchingTool::match(const xAOD::IParticle& recoObject, const std::string& chain, double matchThreshold, bool rerun) { impl()->setThreshold( matchThreshold ); std::vector<const xAOD::IParticle*> recoObjects(1,&recoObject); bool out = match(recoObjects, chain, rerun); impl()->setThreshold( m_matchingThreshold ); return out; } bool MatchingTool::match(const std::vector<const xAOD::IParticle*>& recoObjects, const std::string& chain, double matchThreshold, bool rerun) { impl()->setThreshold( matchThreshold ); bool out = match(recoObjects, chain, rerun); impl()->setThreshold( m_matchingThreshold ); return out; } bool MatchingTool::match(const std::vector<const xAOD::IParticle*>& recoObjects, const std::string& chain, bool rerun){ ATH_MSG_DEBUG("matching " << recoObjects.size() << " reco objects to chain: " << chain ); auto chainGroup = impl()->tdt()->getChainGroup(chain); bool decision; if (!rerun) decision = chainGroup->isPassed(); else decision = chainGroup->isPassed(TrigDefs::Physics | TrigDefs::allowResurrectedDecision); ATH_MSG_DEBUG(chain << " is passed: " << decision); if(!decision) return false; auto featureContainer = chainGroup->features(); auto combinations = featureContainer.getCombinations(); ATH_MSG_DEBUG("chain has: " << combinations.size() << " combos"); bool result = false; for(auto& comb : combinations){ bool combResult = matchCombination(recoObjects,comb, chain); ATH_MSG_DEBUG("matching result for this combination: " << combResult); result = result || combResult; if(result) break; //no need to continue if result is true } ATH_MSG_DEBUG("overall matching result: " << result); return result; } Trig::MatchingImplementation* MatchingTool::impl(){ return m_impl; } double MatchingTool::IParticleMetric(const xAOD::IParticle* lhs, const xAOD::IParticle* rhs){ return xAOD::P4Helpers::deltaR(lhs,rhs,false /*use pseudorapidity to avoid calling p4*/);//return lhs->p4().DeltaR(rhs->p4()); } std::vector<std::vector<double> > MatchingTool::distanceMatrix(const std::vector<const xAOD::IParticle*>& reco, const std::vector<const xAOD::IParticle*>& trigger){ std::vector<std::vector<double> > rows; for(const auto& rec : reco){ std::vector<double> distances_to_rec; for(const auto& trig : trigger){ distances_to_rec.push_back(IParticleMetric(rec,trig)); } rows.push_back(distances_to_rec); } return rows; } } //Trig namespace
[ "rushioda@lxplus754.cern.ch" ]
rushioda@lxplus754.cern.ch
e400483e9823d89bca7632407967d4f92db053cb
400e2b1fafda60fb8990ed209d70d8192f732845
/MTS_Project/APP.h
a678b1331f8b9e1875c1244d3aba86e74d6d8bd3
[]
no_license
Eichenherz/MTS_Project
3e8e6a9b1458bb8bc3fe0affd4e10f6e3a4fbf4b
24e3f95ed8b5f762b609253dc2b3bf447dfff500
refs/heads/master
2020-04-01T18:40:21.776320
2018-10-21T17:31:26
2018-10-21T17:31:26
153,507,404
0
0
null
null
null
null
UTF-8
C++
false
false
1,127
h
#pragma once #include "FrameworkWin.h" #include "GFX.h" #include <string> #include "Keyboard.h" #include "Mouse.h" #include <memory> class HWNDKey { private: HWNDKey( const HWNDKey& ) = delete; HWNDKey& operator=( const HWNDKey& ) = delete; protected: HWNDKey() = default; private: friend GFX::GFX( HWNDKey& key ); protected: HWND h_app_wnd = nullptr; }; class APP_WND : public HWNDKey { public: APP_WND( HINSTANCE h_inst ); ~APP_WND(); APP_WND( const APP_WND& ) = delete; APP_WND( APP_WND&& ) = delete; APP_WND& operator=( const APP_WND& ) = delete; APP_WND& operator=( APP_WND&& ) = delete; bool Process_Message(); auto Get_WND_Handler(); private: static LRESULT CALLBACK Wnd_Proc( HWND hwnd, UINT msg, WPARAM w_param, LPARAM l_param ); static LRESULT CALLBACK Wnd_Proc_Thunk( HWND hwnd, UINT msg, WPARAM w_param, LPARAM l_param ); LRESULT Handle_Msg( HWND hwnd, UINT msg, WPARAM w_param, LPARAM l_param ); public: std::unique_ptr<DirectX::Keyboard> p_kbd; std::unique_ptr<DirectX::Mouse> p_mouse; private: // WIN32 Attributes HINSTANCE h_app_inst; static constexpr char name[] = "order*"; };
[ "pelesliviu@yahoo.com" ]
pelesliviu@yahoo.com
690ddb310d016c6552c0b47ba3ee04b142a65ebb
a36760c5009a62fbca7a00026e551eedbe5e1ac3
/289B.cpp
1e11c78b38e01c20e6351f0db33341133526aa6f
[]
no_license
StuartRyder/A2OJ
ebf93a5c8f78b43d9ff15eac924b53af6787dc55
90889f3c60aa0d5dbe89a59b231959a2fbc41c13
refs/heads/master
2023-07-14T04:27:47.681565
2021-08-27T10:04:21
2021-08-27T10:04:21
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,680
cpp
#include<bits/stdc++.h> #include<iostream> #include <iterator> #include <unordered_map> #include <string> #include <algorithm> #include <math.h> #include <vector> #include <map> #include <fstream> #include <cstdlib> #include <ctime> #include <limits.h> #include <random> using namespace std; #define pb push_back #define REP(i,n) for(int i=0;i<n;i++) #define FOR(i,a,b) for(int i=a;i<=b;i++) #define all(v) v.begin(),v.end() #define F first #define S second #define vl vector<ll> #define vi vector<int> #define itr(a) ::iterator a #define lb lower_bound #define ub upper_bound #define ULL unsigned long long #define ret return #define ll long long int #define in(n,arr) for(auto i=0 ; i<n ; i++) cin>>arr[i] #define out(n,arr) for(auto i=0 ; i<n ; i++) cout<<arr[i]<<" "; cout<<endl #define fastio ios::sync_with_stdio(false);cin.tie(0); /* Created By Stuart Ryder aka Anurag Srivastava*/ void compute(){ ll n,m,d; cin>>n>>m>>d; ll a[n][m]={-1}; ll c=0;ll b[n*m]; for(auto i=0;i<n;i++) for(auto j=0;j<m;j++) {cin>>a[i][j];c+=a[i][j];} ll k=0; for(auto i=0;i<n;i++){ for(auto j=0;j<m;j++,k++) b[k]=a[i][j]; } sort(b,b+n*m); ll ans=0; for(auto i=0;i<n*m;i++){ ans+=abs(b[i]-b[((n*m)/2)])/d; if(abs(b[i]-b[((n*m)/2)])%d!=0) { cout<<-1<<endl;return; } } cout<<ans<<endl; } int main(){ fastio; compute(); }
[ "53661892+StuartRyder@users.noreply.github.com" ]
53661892+StuartRyder@users.noreply.github.com
55756aa18f5f81bf1dd98b2e3f690574c99bb8a1
0c9c751411ef9260686f5651c4461f897c00b7d3
/w5-1_vectorFieldOfLife/src/vectorField.h
6cda5a139b0e1390a55f7b733d24cf386c1230f8
[]
no_license
firmread/firm_algo2012
0418c562f48036e543c9152da932188dc366199b
a523a561f106d23641a28a8c987521ebe21368f3
refs/heads/master
2020-04-18T16:24:08.059888
2012-12-18T02:36:19
2012-12-18T02:36:19
5,781,577
4
1
null
null
null
null
UTF-8
C++
false
false
1,254
h
#ifndef VECTORFIELD_H #define VECTORFIELD_H #include "ofMain.h" class vectorField { public: // the internal dimensions of the field: (ie, 60x40, etc) int fieldWidth; int fieldHeight; int fieldSize; // total number of "pixels", ie w * h // the external dimensions of the field: (ie, 1024x768) int externalWidth; int externalHeight; vector <ofVec2f> field; vectorField(); virtual ~vectorField(); void setupField(int innerW, int innerH, int outerW, int outerH); // pass in internal dimensions and outer dimensions void clear(); void fadeField(float fadeAmount); void randomizeField(float scale); void draw(); ofVec2f getForceFromPos(float xpos, float ypos); void addOutwardCircle(float x, float y, float radius, float strength); void addInwardCircle(float x, float y, float radius, float strength); void addClockwiseCircle(float x, float y, float radius, float strength); void addCounterClockwiseCircle(float x, float y, float radius, float strength); void addVectorCircle(float x, float y, float vx, float vy, float radius, float strength); protected: private: }; #endif // VECTORFIELD_H
[ "litchirhythm@gmail.com" ]
litchirhythm@gmail.com
6df8e3cd28522bd531e06d8b8dbf48bdaee52bbb
deb4cec49c88117c17297c81644e8c02f42cfad5
/RStarTree/RStarBoundingBox.h
5051c1db8429dff52532635aa63b11cd0e38d771
[]
no_license
danini-the-panini/straylight
7a96fa01d1f9729d0e0505e536c674c7b5874e3a
e3ec8477080d09b5dabe6269888e6b47a7b85907
refs/heads/master
2021-05-27T22:10:53.789421
2014-03-19T21:14:02
2014-03-19T21:14:02
null
0
0
null
null
null
null
UTF-8
C++
false
false
9,194
h
/* * Copyright (c) 2008 Dustin Spicuzza <dustin@virtualroadside.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public License * as published by the Free Software Foundation. * * This program is distributed in the hope that it 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, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef RStarBoundingBox_H #define RStarBoundingBox_H #include <limits> #include <utility> #include <cstddef> #include <string> #include <sstream> #include "../Ray.h" template <std::size_t dimensions> struct RStarBoundingBox { // edges[x].first is low value, edges[x].second is high value std::pair<double, double> edges[dimensions]; // forces all edges to their extremes so we can stretch() it void reset() { for (std::size_t axis = 0; axis < dimensions; axis++) { edges[axis].first = std::numeric_limits<double>::max(); edges[axis].second = std::numeric_limits<double>::min(); } } // returns a new bounding box that has the maximum boundaries static RStarBoundingBox MaximumBounds() { RStarBoundingBox<dimensions> bound; bound.reset(); return bound; } // fits another box inside of this box, returns true if a stretch occured bool stretch(const RStarBoundingBox<dimensions> &bb) { bool ret = false; for (std::size_t axis = 0; axis < dimensions; axis++) { if (edges[axis].first > bb.edges[axis].first) { edges[axis].first = bb.edges[axis].first - 0.001; ret = true; } if (edges[axis].second < bb.edges[axis].second) { edges[axis].second = bb.edges[axis].second + 0.001; ret = true; } } return ret; } // the sum of all deltas between edges inline double edgeDeltas() const { double distance = 0; for (std::size_t axis = 0; axis < dimensions; axis++) distance += edges[axis].second - edges[axis].first; return distance; } // calculates the area of a bounding box inline double area() const { double area = 1; for (std::size_t axis = 0; axis < dimensions; axis++) area *= edges[axis].second - edges[axis].first; return area; } // this determines if a bounding box is fully contained within this bounding box inline bool encloses(const RStarBoundingBox<dimensions>& bb) const { // if (y1 < x1 || x2 < y2) for (std::size_t axis = 0; axis < dimensions; axis++) if (bb.edges[axis].first < edges[axis].first || edges[axis].second < bb.edges[axis].second) return false; return true; } // a quicker way to determine if two bounding boxes overlap inline bool overlaps(const RStarBoundingBox<dimensions>& bb) const { // do it this way so theres no equal signs (in case of doubles) // if (!(x1 < y2) && !(x2 > y1)) for (std::size_t axis = 0; axis < dimensions; axis++) { if (!(edges[axis].first < bb.edges[axis].second) || !(bb.edges[axis].first < edges[axis].second)) return false; } return true; } // calculates the total overlapping area of two boxes double overlap(const RStarBoundingBox<dimensions>& bb) const { double area = 1.0; for (std::size_t axis = 0; area && axis < dimensions; axis++) { // this makes it easier to understand const double x1 = edges[axis].first; const double x2 = edges[axis].second; const double y1 = bb.edges[axis].first; const double y2 = bb.edges[axis].second; // left edge outside left edge if (x1 < y1) { // and right edge inside left edge if (y1 < x2) { // right edge outside right edge if (y2 < x2) area *= y2 - y1; else area *= x2 - y1; continue; } } // right edge inside left edge else if (x1 < y2) { // right edge outside right edge if (x2 < y2) area *= x2 - x1; else area *= y2 - x1; continue; } // if we get here, there is no overlap return 0.0; } return area; } /** * Check whether the given ray intersects this BoundingBox. * * @param r The ray to intersect with this BoundingBox. * * @return True if the ray intersects this BoundingBox, false otherwise. */ bool intersect(const Ray& r) const { Vector min(edges[0].first , edges[1].first, edges[2].first ); Vector max(edges[0].second, edges[1].second, edges[2].second); return r.intersect(min, max); } // sums the total distances from the center of another bounding box double distanceFromCenter(const RStarBoundingBox<dimensions>& bb) const { double distance = 0, t; for (std::size_t axis = 0; axis < dimensions; axis++) { t = (edges[axis].first + edges[axis].second + bb.edges[axis].first + bb.edges[axis].second) /2.0; distance += t*t; } return distance; } // determines if two bounding boxes are identical bool operator==(const RStarBoundingBox<dimensions>& bb) { for (std::size_t axis = 0; axis < dimensions; axis++) if (edges[axis].first != bb.edges[axis].first || edges[axis].second != bb.edges[axis].second) return false; return true; } // very slow, use for debugging only std::string ToString() const { std::stringstream name(""); name << "["; for (std::size_t axis = 0; axis < dimensions; axis++) { name << "(" << edges[axis].first << "," << edges[axis].second << ")"; if (axis != dimensions -1) name << ","; } name << "]"; return name.str(); } }; template <std::size_t dimensions> struct RStarBoundedItem { typedef RStarBoundingBox<dimensions> BoundingBox; BoundingBox bound; }; /********************************************************** * Functor used to iterate over a set and stretch a * bounding box **********************************************************/ // for_each(items.begin(), items.end(), StretchBoundedItem::BoundingBox(bound)); template <typename BoundedItem> struct StretchBoundingBox : public std::unary_function< const BoundedItem * const, void > { typename BoundedItem::BoundingBox * m_bound; explicit StretchBoundingBox(typename BoundedItem::BoundingBox * bound) : m_bound(bound) {} void operator() (const BoundedItem * const item) { m_bound->stretch(item->bound); } }; /********************************************************** * R* Tree related functors used for sorting BoundedItems * * TODO: Take advantage of type traits **********************************************************/ template <typename BoundedItem> struct SortBoundedItemsByFirstEdge : public std::binary_function< const BoundedItem * const, const BoundedItem * const, bool > { const std::size_t m_axis; explicit SortBoundedItemsByFirstEdge (const std::size_t axis) : m_axis(axis) {} bool operator() (const BoundedItem * const bi1, const BoundedItem * const bi2) const { return bi1->bound.edges[m_axis].first < bi2->bound.edges[m_axis].first; } }; template <typename BoundedItem> struct SortBoundedItemsBySecondEdge : public std::binary_function< const BoundedItem * const, const BoundedItem * const, bool > { const std::size_t m_axis; explicit SortBoundedItemsBySecondEdge (const std::size_t axis) : m_axis(axis) {} bool operator() (const BoundedItem * const bi1, const BoundedItem * const bi2) const { return bi1->bound.edges[m_axis].second < bi2->bound.edges[m_axis].second; } }; template <typename BoundedItem> struct SortBoundedItemsByDistanceFromCenter : public std::binary_function< const BoundedItem * const, const BoundedItem * const, bool > { const typename BoundedItem::BoundingBox * const m_center; explicit SortBoundedItemsByDistanceFromCenter(const typename BoundedItem::BoundingBox * const center) : m_center(center) {} bool operator() (const BoundedItem * const bi1, const BoundedItem * const bi2) const { return bi1->bound.distanceFromCenter(*m_center) < bi2->bound.distanceFromCenter(*m_center); } }; template <typename BoundedItem> struct SortBoundedItemsByAreaEnlargement : public std::binary_function< const BoundedItem * const, const BoundedItem * const, bool > { const double area; explicit SortBoundedItemsByAreaEnlargement(const typename BoundedItem::BoundingBox * center) : area(center->area()) {} bool operator() (const BoundedItem * const bi1, const BoundedItem * const bi2) const { return area - bi1->bound.area() < area - bi2->bound.area(); } }; template <typename BoundedItem> struct SortBoundedItemsByOverlapEnlargement : public std::binary_function< const BoundedItem * const, const BoundedItem * const, bool > { const typename BoundedItem::BoundingBox * const m_center; explicit SortBoundedItemsByOverlapEnlargement(const typename BoundedItem::BoundingBox * const center) : m_center(center) {} bool operator() (const BoundedItem * const bi1, const BoundedItem * const bi2) const { return bi1->bound.overlap(*m_center) < bi2->bound.overlap(*m_center); } }; #endif
[ "jellymann@gmail.com" ]
jellymann@gmail.com
67980b710889f3953d374ea85430783e1d08ad88
316f9a129df23b91a403233af4015314a636a2ae
/Generators.h
756c7075d37678091cccf477eeda2f8c4c35072e
[]
no_license
Bartlomiej-Kochutek/generatory-liczb-losowych
a7d128a69a87ee36e24120280b977c2efc76f8f4
24f8749cbd8c81f821c0d4fbc04cce7215b0e461
refs/heads/master
2020-03-26T02:21:56.507759
2018-08-12T06:01:11
2018-08-12T06:01:11
144,407,079
0
0
null
null
null
null
WINDOWS-1250
C++
false
false
2,446
h
#ifndef GENERATORS_H #define GENERATORS_H #include "Class.h" //funkcja zwraca: 0 jeżeli użytkownik chce wybrać rodzaj generatora losującego, 1 jeżeli użytkownik chce wyjść z programu int menu_1() { std::cout << "\n1 - wybierz generator \n2 - wyjscie z programu\n"; unsigned int x; x = pobierz_unsigned(1, 2); x--; return x; } //funkcja zwraca wartość odpowiadającą wybranemu generatorowi int menu_2() { std::cout << "\n1 - Park-Miller \n2 - Kwadratowy kongruencyjny\n3 - Mersenne Twister \n"; unsigned int x; x = pobierz_unsigned(1, 3); return x; } //funkcja alokująca odpowiedni generator void ustaw_wsk(Generator* & wsk_generator) { switch (menu_2()) { case 1: wsk_generator = dynamic_cast<Generator*>(new ParkMiller); break; case 2: wsk_generator = dynamic_cast<Generator*>(new Kwadratowy); break; case 3: wsk_generator = dynamic_cast<Generator*>(new MersenneTwister); break; } } //funkcja dealokująca dany generator void usun_wsk(Generator* & wsk_generator) { delete wsk_generator; wsk_generator = nullptr; } //funkcja wywoływana po wybraniu generatora, zwraca wartość odpowiadającą wyborowi użytkownika int menu_3() { std::cout << "\n1 - losuj \n2 - losuj jeden element \n3 - rysuj rozklad \n4 - rysuj wykres \n5 - wyswietl wylosowane \n6 - wyswietl jeden element"; std::cout << "\n7 - wczytaj z pliku CSV\n8 - zapisz do pliku CSV\n9 - zmien parametry \n10 - zmien generator (usuwa wylosowane)\n11 - usun wylosowane\n12 - wyjscie z programu \n"; unsigned int x; x = pobierz_unsigned(1, 12); return x; } //funkcja wykonująca działania zaproponowane użytkownikowi przez "menu_3". Zwraca 1 jeżeli użytkownik chce zamknąć program; 0 jeśli chce zmienić generator bool funkcje(Generator* & wsk_generator) { while(1){ switch (menu_3()) { case 1: wsk_generator->losuj(); break; case 2: (*wsk_generator)++; break; case 3: wsk_generator->rysuj_rozklad(); break; case 4: wsk_generator->rysuj_wykres(); break; case 5: std::cout << *wsk_generator; break; case 6: wsk_generator->wyswietl_jeden(); break; case 7: wsk_generator->wczytaj_z_pliku(); break; case 8: wsk_generator->zapisz_do_pliku(); break; case 9: wsk_generator->pobierz_wszystkie_parametry(); break; case 10: usun_wsk(wsk_generator); return 0; case 11: wsk_generator->usun_wylosowane(); break; case 12: usun_wsk(wsk_generator); return 1; } } } #endif
[ "42279043+Bartlomiej-Kochutek@users.noreply.github.com" ]
42279043+Bartlomiej-Kochutek@users.noreply.github.com
888fb7ec18bae20ba8d006d9401be6ef57ef5c83
572775c1f819621529934afd7c59ba65eeddb019
/cStudy/MemSerialize/serialize/serialize.h
c6834eaa25013cafa842a2bc339459c53cfb5881
[]
no_license
heartofHui/Linux-server-study
a6e6b3c14ae5abdb0b19a5b55e8660ecf154a4d8
25f566e500bda03548d3d28159257f1091c81b07
refs/heads/master
2021-01-21T21:47:10.588299
2018-02-12T05:02:47
2018-02-12T05:02:47
53,730,869
0
0
null
null
null
null
UTF-8
C++
false
false
1,070
h
#ifndef __MEMORY_SERIALIZE #define __MEMORY_SERIALIZE #include <string> #include <string.h> #include <stdlib.h> #define INI_BUFF_SIZE 128 #define MAX_BUFF_SIZE 2048 const int32_t _i = 1; // TPC/IP协议网络字节序大多采用的是大端模式,因此本地数据在进行网络传输时需要转换为网络字节序 #define isBigEndian() ((*(char*)& _i)==0) class Buffer { public: unsigned char* data; int32_t next; size_t size; Buffer(); ~Buffer(); Buffer(unsigned char * src, int32_t s); Buffer(Buffer& other); }; void beNetData(int32_t& t); void beNetData(int64_t& t); void beNetData(float & t); void beNetData(double& t); bool reserve_space(Buffer* b, size_t bytes); void MemSerialize(int32_t t, Buffer* b); void MemSerialize(int64_t t, Buffer* b); void MemSerialize(float t, Buffer* b); void MemSerialize(double t, Buffer* b); void MemSerialize(char* s, Buffer* b); void MemDeseriaize(int32_t& t, Buffer& b, int32_t size); void MemDeseriaize(int64_t& t, Buffer& b, int32_t size); void MemDeseriaize(char* s, Buffer& b, int32_t size); #endif
[ "chenhui@17paipai.cn" ]
chenhui@17paipai.cn
63ee22dbb5794d5db4ed957746f8c95e15c84e2d
1d4ad8135173b1361e42ddf962068aded35097a2
/Clickmap Picker/cl_Graphics.h
b3d59ae3cb8c86204884b32c0d298d11f68bd379
[ "MIT" ]
permissive
SimpleRepos/Clickmap-Picker
4ac1e0495fefbaef82d7eb4777b27909f9d456a1
3c9899fd84e2a6a853a27b019358202cb48b343d
refs/heads/master
2021-01-20T13:27:02.182145
2017-06-15T02:43:55
2017-06-15T02:43:55
90,494,369
0
0
null
null
null
null
UTF-8
C++
false
false
1,219
h
#pragma once #include "st_ColorF.h" #include <atlbase.h> #include <d3d11.h> #include "cl_Window.h" class GfxFactory; class Graphics { public: Graphics(Window& win); ~Graphics(); void clear(const ColorF& color = ColorF::BLACK); void clearEx(bool clearTarget, bool clearDepth, bool clearStencil, const ColorF& color = ColorF::BLACK, float depth = 1.0f, UINT8 stencil = 0); void draw(UINT vertexCount); void drawIndexed(UINT indexCount, UINT startOffset = 0); void present(); const Window::Dimensions VIEWPORT_DIMS; GfxFactory createFactory(); void setStencilReferenceValue(uint8_t val); uint8_t fetchStencilValue(int x, int y); private: CComPtr<ID3D11Device> device; CComPtr<ID3D11DeviceContext> context; CComPtr<IDXGISwapChain> swapChain; CComPtr<ID3D11RenderTargetView> backBuffer; CComPtr<ID3D11DepthStencilView> depthStencilView; CComPtr<ID3D11DepthStencilState> depthStencilState; CComPtr<ID3D11ShaderResourceView> depthStencilSRV; #if defined(DEBUG) || defined(_DEBUG) CComPtr<ID3D11Debug> debug; #endif void generateDeviceContextAndSwapChain(HWND winHandle); void generateBackBufferView(); void generateDepthStencil(); void setTargetsAndViewport(); };
[ "a" ]
a
22487d67a8f6afe273eb0fc457e3b8929255c46b
46279163a543cd8820bdc38133404d79e787c5d2
/aten/src/ATen/test/tensor_iterator_test.cpp
aecff33946f4f831f961a7d2eb9c17ce11400db0
[ "BSD-3-Clause", "LicenseRef-scancode-generic-cla", "BSL-1.0", "Apache-2.0", "BSD-2-Clause" ]
permissive
erwincoumans/pytorch
31738b65e7b998bfdc28d0e8afa7dadeeda81a08
ae9f39eb580c4d92157236d64548b055f71cf14b
refs/heads/master
2023-01-23T10:27:33.628897
2020-12-06T01:22:00
2020-12-06T01:23:40
318,930,000
5
1
NOASSERTION
2020-12-06T01:58:57
2020-12-06T01:58:56
null
UTF-8
C++
false
false
11,721
cpp
#include <gtest/gtest.h> #include <thread> #include <ATen/ATen.h> #include <ATen/native/TensorIterator.h> #include <ATen/native/cpu/Loops.h> using namespace at; // An operation with a CUDA tensor and CPU scalar should keep the scalar // on the CPU (and lift it to a parameter). TEST(TensorIteratorTest, CPUScalar) { if (!at::hasCUDA()) return; Tensor out; auto x = at::randn({5, 5}, kCUDA); auto y = at::ones(1, kCPU).squeeze(); auto iter = TensorIterator::binary_op(out, x, y); EXPECT_TRUE(iter.device(0).is_cuda()) << "result should be CUDA"; EXPECT_TRUE(iter.device(1).is_cuda()) << "x should be CUDA"; EXPECT_TRUE(iter.device(2).is_cpu()) << "y should be CPU"; } // Verifies multiple zero-dim CPU inputs are not coerced to CUDA TEST(TensorIteratorTest, CPUScalarInputs) { if (!at::hasCUDA()) return; Tensor out = at::empty({5, 5}, kCUDA); auto x = at::ones(1, kCPU).squeeze(); auto y = at::ones(1, kCPU).squeeze(); ASSERT_ANY_THROW(TensorIterator::binary_op(out, x, y)); } // Mixing CPU and CUDA tensors should raise an exception (if the CPU tensor isn't zero-dim) TEST(TensorIteratorTest, MixedDevices) { if (!at::hasCUDA()) return; Tensor out; auto x = at::randn({5, 5}, kCUDA); auto y = at::ones({5}, kCPU); ASSERT_ANY_THROW(TensorIterator::binary_op(out, x, y)); } Tensor random_tensor_for_type(at::ScalarType scalar_type) { if (at::isFloatingType(scalar_type)) { return at::randn({5, 5}, at::device(kCPU).dtype(scalar_type)); } else if (scalar_type == kBool) { return at::randint(0, 2, {5, 5}, at::device(kCPU).dtype(scalar_type)); } else { return at::randint(1, 10, {5, 5}, at::device(kCPU).dtype(scalar_type)); } } #define UNARY_TEST_ITER_FOR_TYPE(ctype,name) \ TEST(TensorIteratorTest, SerialLoopUnary_##name) { \ Tensor out; \ auto in = random_tensor_for_type(k##name); \ auto expected = in.add(1); \ auto iter = TensorIterator::unary_op(out, in); \ at::native::cpu_serial_kernel(iter, [=](ctype a) -> ctype { return a + 1; }); \ ASSERT_ANY_THROW(out.equal(expected)); \ } #define NO_OUTPUT_UNARY_TEST_ITER_FOR_TYPE(ctype,name) \ TEST(TensorIteratorTest, SerialLoopUnaryNoOutput_##name) { \ auto in = random_tensor_for_type(k##name); \ auto iter = at::TensorIteratorConfig() \ .add_input(in) \ .build(); \ int64_t acc = 0; \ at::native::cpu_serial_kernel(iter, [&](ctype a) -> void { acc++; }); \ EXPECT_TRUE(acc == in.numel()); \ } #define BINARY_TEST_ITER_FOR_TYPE(ctype,name) \ TEST(TensorIteratorTest, SerialLoopBinary_##name) { \ Tensor out; \ auto in1 = random_tensor_for_type(k##name); \ auto in2 = random_tensor_for_type(k##name); \ auto expected = in1.add(in2); \ auto iter = TensorIterator::binary_op(out, in1, in2); \ at::native::cpu_serial_kernel(iter, [=](ctype a, ctype b) -> ctype { return a + b; }); \ ASSERT_ANY_THROW(out.equal(expected)); \ } #define NO_OUTPUT_BINARY_TEST_ITER_FOR_TYPE(ctype,name) \ TEST(TensorIteratorTest, SerialLoopBinaryNoOutput_##name) { \ auto in1 = random_tensor_for_type(k##name); \ auto in2 = random_tensor_for_type(k##name); \ auto iter = at::TensorIteratorConfig() \ .add_input(in1) \ .add_input(in2) \ .build(); \ int64_t acc = 0; \ at::native::cpu_serial_kernel(iter, [&](ctype a, ctype b) -> void { acc++; }); \ EXPECT_TRUE(acc == in1.numel()); \ } #define POINTWISE_TEST_ITER_FOR_TYPE(ctype,name) \ TEST(TensorIteratorTest, SerialLoopPointwise_##name) { \ Tensor out; \ auto in1 = random_tensor_for_type(k##name); \ auto in2 = random_tensor_for_type(k##name); \ auto in3 = random_tensor_for_type(k##name); \ auto expected = in1.add(in2).add(in3); \ auto iter = at::TensorIteratorConfig() \ .add_output(out) \ .add_input(in1) \ .add_input(in2) \ .add_input(in3) \ .build(); \ at::native::cpu_serial_kernel(iter, [=](ctype a, ctype b, ctype c) -> ctype { return a + b + c; }); \ ASSERT_ANY_THROW(out.equal(expected)); \ } #define NO_OUTPUT_POINTWISE_TEST_ITER_FOR_TYPE(ctype,name) \ TEST(TensorIteratorTest, SerialLoopPoinwiseNoOutput_##name) { \ auto in1 = random_tensor_for_type(k##name); \ auto in2 = random_tensor_for_type(k##name); \ auto in3 = random_tensor_for_type(k##name); \ auto iter = at::TensorIteratorConfig() \ .add_input(in1) \ .add_input(in2) \ .add_input(in3) \ .build(); \ int64_t acc = 0; \ at::native::cpu_serial_kernel(iter, [&](ctype a, ctype b, ctype c) -> void { acc++; }); \ EXPECT_TRUE(acc == in1.numel()); \ } // The alternative way to calculate a < b is (b - a).clamp(0).toBool() // To prevent an overflow in subtraction (b - a) for unsigned types(unit, bool) // we will convert in to int first #define COMPARISON_TEST_ITER_FOR_TYPE(ctype,name) \ TEST(TensorIteratorTest, ComparisonLoopBinary_##name) { \ auto in1 = random_tensor_for_type(k##name); \ auto in2 = random_tensor_for_type(k##name); \ Tensor out = at::empty({0}, in1.options().dtype(kBool)); \ Tensor diff; \ if (k##name == kByte || k##name == kBool) { \ diff = in2.to(kInt).sub(in1.to(kInt)); \ } else { \ diff = in2.sub(in1); \ } \ auto expected = diff.clamp_min(0).to(kBool); \ auto iter = TensorIterator::comparison_op(out, in1, in2); \ at::native::cpu_serial_kernel(iter, [=](ctype a, ctype b) -> bool { return a < b; }); \ EXPECT_TRUE(out.equal(expected)); \ } AT_FORALL_SCALAR_TYPES(UNARY_TEST_ITER_FOR_TYPE) AT_FORALL_SCALAR_TYPES(BINARY_TEST_ITER_FOR_TYPE) AT_FORALL_SCALAR_TYPES(POINTWISE_TEST_ITER_FOR_TYPE) AT_FORALL_SCALAR_TYPES(NO_OUTPUT_UNARY_TEST_ITER_FOR_TYPE) AT_FORALL_SCALAR_TYPES(NO_OUTPUT_BINARY_TEST_ITER_FOR_TYPE) AT_FORALL_SCALAR_TYPES(NO_OUTPUT_POINTWISE_TEST_ITER_FOR_TYPE) AT_FORALL_SCALAR_TYPES_AND(Bool, COMPARISON_TEST_ITER_FOR_TYPE) TEST(TensorIteratorTest, SerialLoopSingleThread) { std::thread::id thread_id = std::this_thread::get_id(); Tensor out; auto x = at::zeros({50000}, at::TensorOptions(kCPU).dtype(kInt)); auto iter = TensorIterator::unary_op(out, x); at::native::cpu_serial_kernel(iter, [=](int a) -> int { std::thread::id lambda_thread_id = std::this_thread::get_id(); EXPECT_TRUE(lambda_thread_id == thread_id); return a + 1; }); } TEST(TensorIteratorTest, InputDType) { auto iter = at::TensorIteratorConfig() .check_all_same_dtype(false) .add_output(at::ones({1, 1}, at::dtype(at::kBool))) .add_input(at::ones({1, 1}, at::dtype(at::kFloat))) .add_input(at::ones({1, 1}, at::dtype(at::kDouble))) .build(); EXPECT_TRUE(iter.input_dtype() == at::kFloat); EXPECT_TRUE(iter.input_dtype(0) == at::kFloat); EXPECT_TRUE(iter.input_dtype(1) == at::kDouble); } TEST(TensorIteratorTest, ComputeCommonDTypeInputOnly) { auto iter = at::TensorIteratorConfig() .add_output(at::ones({1, 1}, at::dtype(at::kBool))) .add_input(at::ones({1, 1}, at::dtype(at::kFloat))) .add_input(at::ones({1, 1}, at::dtype(at::kDouble))) .promote_inputs_to_common_dtype(true) .build(); EXPECT_TRUE(iter.dtype(0) == at::kBool); EXPECT_TRUE(iter.dtype(1) == at::kDouble); EXPECT_TRUE(iter.dtype(2) == at::kDouble); EXPECT_TRUE(iter.common_dtype() == at::kDouble); } TEST(TensorIteratorTest, DoNotComputeCommonDTypeInputOnly) { auto iter = at::TensorIteratorConfig() .check_all_same_dtype(false) .add_output(at::ones({1, 1}, at::dtype(at::kLong))) .add_input(at::ones({1, 1}, at::dtype(at::kFloat))) .add_input(at::ones({1, 1}, at::dtype(at::kDouble))) .build(); EXPECT_TRUE(iter.dtype(0) == at::kLong); EXPECT_TRUE(iter.dtype(1) == at::kFloat); EXPECT_TRUE(iter.dtype(2) == at::kDouble); } TEST(TensorIteratorTest, FailNonPromotingBinaryOp) { Tensor out; at::TensorIteratorConfig config; config.add_output(out); config.add_input(at::ones({1,1}, at::dtype(at::kDouble))); config.add_input(at::ones({1,1}, at::dtype(at::kInt))); ASSERT_ANY_THROW(config.build()); }
[ "facebook-github-bot@users.noreply.github.com" ]
facebook-github-bot@users.noreply.github.com
0b448fe766d5bfcf0214f2ed822291b605bf027e
970435316dad58c62f7ed82bbc3674eac1d2e493
/include/BFieldMap.h
d7fbef3627a23a851b4916e952e0a5eef2d3c0ca
[]
no_license
abaty/OpenGL_LHC
24498a435fe79f78f87a5ac85dbec965cdcebb42
6820a088b4d915dd069fd4f16f9108bf164a4362
refs/heads/master
2021-06-15T23:35:23.764215
2018-11-04T21:45:32
2018-11-04T21:45:32
146,665,005
0
1
null
2021-02-15T23:07:30
2018-08-29T22:17:56
PostScript
UTF-8
C++
false
false
388
h
#pragma once #include "glm/glm.hpp" #include "include/Solenoid.h" #include <vector> #include <mutex> class BFieldMap { public: BFieldMap(); ~BFieldMap(); glm::vec3 getBField(glm::vec3 r); void addMagnet( Solenoid *s); void removeMagnet(int i); std::vector < std::mutex * > mutex_BFieldMap; int nThreads; private: std::vector< Solenoid* > magnets; size_t magVecSize = 0; };
[ "abaty@mit.edu" ]
abaty@mit.edu
8b0792310f414a9389d6836d6fa50168205629ce
e082c8ffb3f8fa05d242fffb5b68c66d0d179d53
/cpus/common/dis.cc
415ee3cdbbdd7acee556aaad4b2bd1402f20cd4a
[]
no_license
pratikab/CS422-HW3
5bfdd789d524708590dcd9e1e60cd3204f8957a8
7da63a7e46acdb75829a3c5494a5bda8ecfdd3f8
refs/heads/master
2021-01-18T17:46:15.253658
2017-04-15T17:12:01
2017-04-15T17:12:01
86,813,829
0
0
null
null
null
null
UTF-8
C++
false
false
5,877
cc
/*-*-mode:c++-*-********************************************************** * * Copyright (c) 1999 Cornell University * School of Electrical Engineering * Ithaca, NY 14853 * All Rights Reserved * * Permission to use, copy, modify, and distribute this software * and its documentation for any purpose and without fee is hereby * granted, provided that the above copyright notice appear in all * copies. Cornell University makes no representations * about the suitability of this software for any purpose. It is * provided "as is" without express or implied warranty. Export of this * software outside of the United States of America may require an * export license. * * $Id: dis.cc,v 1.1.1.1 2006/05/23 13:53:58 mainakc Exp $ * *************************************************************************/ #include "opcodes.h" #include <stdlib.h> #include <string.h> #include <stdio.h> #include "dis.h" static char *regname[] = { "0", "at", "v0", "v1", "a0", "a1", "a2", "a3", "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra" }; static void sprintreg (char *s, int type, int num) { char tmp[10]; if (type == DIS_TYPE_NUMBER) { sprintf (tmp, "$%d", num); } else { sprintf (tmp, "$%s", regname[num]); } strcat (s, tmp); } static void fpsprintreg (char *s, int type, int num) { char tmp[10]; sprintf (tmp, "$f%d", num); strcat (s, tmp); } char getfmt(MipsInsn mi) { switch (mi.freg.fmt) { case 0x10: return 's'; case 0x11: return 'd'; case 0x14: return 'w'; default: return 'x'; } } char *mips_dis_insn (int type, unsigned int ins) { static char buf[128]; char tmp[32]; MipsInsn mi; int i; mi.data = ins; if (mi.data == 0) { sprintf (buf, "[%08x] nop", 0); return buf; } #define OUTPUT(en,str,op,flags) \ case op: \ sprintf (buf, "[%08x] %s\t", mi.data, str); #define FPOUTPUT(en,str,op,flags) \ case op: \ if (USE_FMT(flags)) { \ sprintf (buf, "[%08x] %s.%c\t", mi.data, str, getfmt(mi)); \ } \ else if ((flags) & P_BRANCH) { \ sprintf (buf, "[%08x] %s%c\t", mi.data, str, (mi.freg.ft==0x1)?'t':'f');\ } \ else \ sprintf (buf, "[%08x] %s\t", mi.data, str); switch (mi.reg.op) { case 0x0: switch (mi.reg.func) { #define SPECIAL(en,str,op,flags) \ OUTPUT(en,str,op,flags); \ if (USE_RD(flags)) { \ sprintreg (buf, type, mi.reg.rd); \ strcat (buf, ","); \ } \ if (USE_RS(flags)) { \ sprintreg (buf, type, mi.reg.rs); \ if (USE_RT(flags)) \ strcat (buf, ","); \ } \ if (USE_RT(flags)){ \ sprintreg (buf, type, mi.reg.rt); \ if (!USE_RS (flags)) { \ sprintf (tmp, ",%d", mi.reg.sa); \ strcat (buf, tmp); \ } \ } \ break; #include "opcodes.def" default: sprintf (buf, "[%08x] unknown special", mi.data); break; } break; case 0x11: switch (mi.freg.fmt) { #define COP1CTL(en,str,op,flags) \ FPOUTPUT(en,str,op,flags); \ if (USE_RT(flags)) { \ fpsprintreg (buf, type, mi.freg.ft); \ if (USE_RS(flags)) \ strcat (buf, ","); \ } \ if (USE_RS(flags)){ \ fpsprintreg (buf, type, mi.freg.fs); \ } \ break; #include "opcodes.def" default: switch (mi.freg.func) { #define COP1FCN(en,str,op,flags) \ FPOUTPUT(en,str,op,flags); \ if (USE_RD(flags)) { \ fpsprintreg (buf, type, mi.freg.fd); \ strcat (buf, ","); \ } \ if (USE_RS(flags)) { \ fpsprintreg (buf, type, mi.freg.fs); \ if (USE_RT(flags)) \ strcat (buf, ","); \ } \ if (USE_RT(flags)){ \ fpsprintreg (buf, type, mi.freg.ft); \ } \ break; #include "opcodes.def" default: sprintf (buf, "[%08x] unknown fpu", mi.data); break; } } break; case 0x1: switch (mi.reg.rt) { #define REGIMM(en,str,op,flags) \ OUTPUT(en,str,op,flags); \ if (USE_RS(flags)) { \ sprintreg (buf, type, mi.imm.rs); \ strcat (buf, ","); \ } \ sprintf (tmp, "%d", 4*(signed int)mi.imm.imm); \ strcat (buf, tmp); \ break; #include "opcodes.def" default: sprintf (buf, "[%08x] unknown regimm", mi.data); break; } break; #define MAINOP(en,str,op,flags) \ OUTPUT(en,str,op,flags); \ if (JUMPIMM(flags)) { \ int offset = mi.tgt.tgt; \ offset <<= 2; \ sprintf (tmp, "%x", offset); \ strcat (buf, tmp); \ } \ else if ((flags) & P_LDST) { \ if ((flags) & (F_USE_RT|F_USE_RTW)) { \ sprintreg (buf, type, mi.imm.rt); \ strcat (buf,","); \ } \ sprintf (tmp, "%d(", (signed int)mi.imm.imm|((mi.imm.imm>>15) ? 0xffff0000 : 0)); \ strcat (buf, tmp); \ sprintreg (buf, type, mi.imm.rs); \ strcat (buf,")"); \ } \ else if ((flags) & P_BRANCH) { \ if (USE_RS (flags)) { \ sprintreg (buf, type, mi.imm.rs); \ strcat (buf, ","); \ } \ if (USE_RT (flags)) { \ sprintreg (buf, type, mi.imm.rt); \ strcat (buf, ","); \ } \ sprintf (tmp, "%d", 4*(signed int)mi.imm.imm); \ strcat (buf, tmp); \ } \ else if ((flags) & IMM_REG) { \ sprintreg (buf, type, mi.imm.rt); \ strcat (buf, ","); \ sprintreg (buf, type, mi.imm.rs); \ if ((flags) & F_SIGNED_IMM) \ sprintf (tmp, ",%d", (signed int)mi.imm.imm); \ else \ sprintf (tmp, ",0x%x", (signed int)mi.imm.imm); \ strcat (buf, tmp); \ } \ break; #include "opcodes.def" default: sprintf (buf,"[%08x] unknown mainop", mi.data); break; } return buf; }
[ "pratikab@iitk.ac.in" ]
pratikab@iitk.ac.in
b36d45aa994ba3f041a136ad87538bad44b61198
5a77b5092acf817ac37a5fafd006feea434dd0d6
/Doxygen_Graphviz/DesignPatternExample/品味Java的21種設計模式/dp_cpp/facade/example3/Business.cpp
7da347226721a7c729f3180733424122fc558768
[]
no_license
shihyu/MyTool
dfc94f507b848fb112483a635ef95e6a196c1969
3bfd1667ad86b3db63d82424cb4fa447cbe515af
refs/heads/master
2023-05-27T19:09:10.538570
2023-05-17T15:58:18
2023-05-17T15:58:18
14,722,815
33
21
null
null
null
null
UTF-8
C++
false
false
529
cpp
#include "Business.h" namespace cn { namespace javass { namespace dp { namespace facade { namespace example3 { void Business::generate() { //1:从配置管理里面获取相应的配置信息 ConfigModel *cm = ConfigManager::getInstance()->getConfigData(); if(cm->isNeedGenBusiness()) { //2:按照要求去生成相应的代码,并保存成文件 puts("正在生成逻辑层代码文件"); } } } } } } }
[ "jason_yao@htc.com" ]
jason_yao@htc.com
3ef8bbd1752e4f2c6920c2c9128f4b6ff6783581
19eb97436a3be9642517ea9c4095fe337fd58a00
/private/inet/mshtml/src/site/lequill/qviewserv.cxx
b904d7ecc383182628d0d03a2d192e8b6c93178f
[]
no_license
oturan-boga/Windows2000
7d258fd0f42a225c2be72f2b762d799bd488de58
8b449d6659840b6ba19465100d21ca07a0e07236
refs/heads/main
2023-04-09T23:13:21.992398
2021-04-22T11:46:21
2021-04-22T11:46:21
360,495,781
2
0
null
null
null
null
UTF-8
C++
false
false
63,913
cxx
#include "headers.hxx" #ifndef X_FORMKRNL_HXX_ #define X_FORMKRNL_HXX_ #include "formkrnl.hxx" #endif #ifndef X_CARET_HXX_ #define X_CARET_HXX_ #include "caret.hxx" #endif #ifndef X_TPOINTER_HXX_ #define X_TPOINTER_HXX_ #include "tpointer.hxx" #endif #ifndef X_DISPNODE_HXX_ #define X_DISPNODE_HXX_ #include "dispnode.hxx" #endif #ifndef X_DISPSCROLLER_HXX_ #define X_DISPSCROLLER_HXX_ #include "dispscroller.hxx" #endif #ifndef X_IRANGE_HXX_ #define X_IRANGE_HXX_ #include "irange.hxx" #endif #ifndef X_TREEPOS_HXX_ #define X_TREEPOS_HXX_ #include "treepos.hxx" #endif #ifndef X_FLOWLYT_HXX_ #define X_FLOWLYT_HXX_ #include "flowlyt.hxx" #endif #ifndef X_LAYOUT_HXX_ #define X_LAYOUT_HXX_ #include "layout.hxx" #endif #ifndef _X_ADORNER_HXX_ #define _X_ADORNER_HXX_ #include "adorner.hxx" #endif #ifndef X_MISCPROT_H_ #define X_MISCPROT_H_ #include "miscprot.h" #endif #ifndef X_QUILGLUE_H_ #define X_QUILGLUE_H_ #include "quilglue.hxx" #endif // Externs void ConvertVariantFromTwipsToHTML(VARIANT *); HRESULT ConvertVariantFromHTMLToTwips(VARIANT *); MtDefine(CDocRegionFromMarkupPointers_aryRects_pv, Locals, "CDoc::RegionFromMarkupPointers aryRects::_pv") DeclareTag(tagSelectionTimer, "Selection", "Selection Timer Actions in CDoc") DeclareTag(tagViewServicesErrors, "ViewServices", "Show Viewservices errors") //////////////////////////////////////////////////////////////// // IHTMLViewServices methods HRESULT CDoc::MoveMarkupPointerToPoint( POINT pt, IMarkupPointer * pPointer, BOOL * pfNotAtBOL, BOOL * pfRightOfCp, BOOL fScrollIntoView ) { RRETURN( THR( MoveMarkupPointerToPointEx( pt, pPointer, TRUE, pfNotAtBOL, pfRightOfCp, fScrollIntoView ))); // Default to global coordinates } HRESULT CDoc::MoveMarkupPointerToPointEx( POINT pt, IMarkupPointer * pPointer, BOOL fGlobalCoordinates, BOOL * pfNotAtBOL, BOOL * pfRightOfCp, BOOL fScrollIntoView ) { HRESULT hr = E_FAIL; CMarkupPointer * pPointerInternal = NULL; POINT ptContent; CTreeNode * pTreeNode = GetNodeFromPoint( pt, fGlobalCoordinates, &ptContent ); if( pTreeNode == NULL ) goto Cleanup; hr = THR( pPointer->QueryInterface( CLSID_CMarkupPointer, (void **) &pPointerInternal )); if( FAILED( hr )) goto Cleanup; hr = THR( MovePointerToPointInternal( ptContent, pTreeNode, pPointerInternal, pfNotAtBOL, pfRightOfCp, fScrollIntoView )); Cleanup: RRETURN( hr ); } HRESULT CDoc::MoveMarkupPointerToMessage( IMarkupPointer * pPointer , SelectionMessage * pMessage, BOOL * pfNotAtBOL, BOOL * pfRightOfCp, BOOL * pfValidTree, BOOL fScrollIntoView ) { HRESULT hr = S_OK; BOOL fValidTree = FALSE; CTreeNode * pTreeNode = NULL; CTreePos* ptp = NULL; CMarkupPointer * pPointerInternal = NULL; CMarkup * pPointerMarkup = NULL; CMarkup * pCookieMarkup = NULL; hr = THR( pPointer->QueryInterface(CLSID_CMarkupPointer, (void **)&pPointerInternal )); if( FAILED( hr )) goto Cleanup; pTreeNode = static_cast<CTreeNode*>( pMessage->elementCookie ); // // HACK : If pTreeNode is NULL or is the ROOT, we assume we are doing a virtual hit // test and the mouse is out of bounds. Instead of doing the fValidTree junk, // we use the global point translated to local coordinates on the passed in Markup // Pointer's layout. This is a complete hack for moving the end point of selection // around correctly. (johnbed) // marka - just using the layout of the passed in pointer won't work ! // // Known Issues // 1) We are using flow layout boundaries here. We should be making this determination // in the editor, not way down here. This breaks the ability to virtual hit test // in tables, for instance. if( pTreeNode == NULL || pTreeNode->Element()->Tag() == ETAG_ROOT ) { CFlowLayout * pLayout = NULL; pTreeNode = GetNodeFromPoint( pMessage->pt , TRUE, NULL, NULL); if ( ! pTreeNode ) pTreeNode = PrimaryMarkup()->GetElementClient()->GetFirstBranch(); Assert( pTreeNode ); // Stuff the resolved tree node back into the message... pMessage->elementCookie = static_cast<VOID *>( pTreeNode ); pLayout = GetFlowLayoutForSelection( pTreeNode ); if( pLayout == NULL ) goto Cleanup; CPoint myPt( pMessage->pt ); pLayout->TransformPoint( &myPt, COORDSYS_GLOBAL, COORDSYS_CONTENT, NULL ); // Stuff the resolved point back into the message... pMessage->ptContent.x = myPt.x; pMessage->ptContent.y = myPt.y; fValidTree = TRUE; // 'cause we are forcing it to be true... } else { // // Figure out if we are in the same tree as the passed in pointer. Fail if the // passed in pointer is unpositioned. Note that we have to do this BEFORE we // move the tree pointer. // pCookieMarkup = pTreeNode->GetMarkup(); ptp = pPointerInternal->TreePos(); if( ptp ) { pPointerMarkup = ptp->GetMarkup(); fValidTree = ( pCookieMarkup == pPointerMarkup ); } else { fValidTree = FALSE; } } hr = THR( MovePointerToPointInternal( pMessage->ptContent, pTreeNode, pPointerInternal, pfNotAtBOL, pfRightOfCp, fScrollIntoView )); if( FAILED( hr )) goto Cleanup; Cleanup: if ( pfValidTree ) *pfValidTree = fValidTree; RRETURN(hr); } HRESULT CDoc::MovePointerToPointInternal( POINT tContentPoint, CTreeNode * pNode, CMarkupPointer * pPointer, BOOL * pfNotAtBOL, BOOL * pfRightOfCp, BOOL fScrollIntoView ) { HRESULT hr = S_OK; LONG cp = 0; BOOL fNotAtBOL; BOOL fRightOfCp; BOOL fPsuedoHit = TRUE; CFlowLayout * pFlowLayout = NULL; CMarkup * pMarkup = NULL; CTreePos * ptp = NULL; BOOL fPtNotAtBOL = FALSE; pFlowLayout = GetFlowLayoutForSelection( pNode ); if(!pFlowLayout) goto Error; { LONG cpMin = pFlowLayout->GetContentFirstCp(); LONG cpMax = pFlowLayout->GetContentLastCp(); CLinePtr rp( pFlowLayout->GetDisplay() ); // // BUGBUG : (johnbed) this is a completely arbitrary hack, but I have to // improvise since I don't know what line I'm on // fPtNotAtBOL = tContentPoint.x > 15; if (!FExternalLayout()) { cp = pFlowLayout->GetDisplay()->CpFromPoint( tContentPoint, // Point &rp, // Line Pointer &ptp, // Tree Pos NULL, // Flow Layout FALSE, // stuff... FALSE, FALSE, &fRightOfCp, NULL, NULL ); } else { if (pFlowLayout->GetQuillGlue()) { cp = pFlowLayout->GetQuillGlue()->CpFromPoint( tContentPoint, // Point &rp, // Line Pointer &ptp, // Tree Pos NULL, // Flow Layout FALSE, // stuff... FALSE, FALSE, &fRightOfCp, NULL, NULL ); } #if DBG == 1 // Debug Only else { Assert(pFlowLayout->GetQuillGlue() != NULL); } #endif } if( cp < cpMin ) { cp = cpMin; rp.RpSetCp( cp , fPtNotAtBOL ); } else if ( cp > cpMax ) { cp = cpMax; rp.RpSetCp( cp , fPtNotAtBOL ); } fNotAtBOL = rp.RpGetIch() != 0; // Caret OK at BOL if click } // // If we are positioned on a line that contains no text, // then we should be at the beginning of that line // // TODO - Implement this in today's world // // Prepare results // if( pfNotAtBOL ) *pfNotAtBOL = fNotAtBOL; if( pfRightOfCp ) *pfRightOfCp = fRightOfCp; pMarkup = pFlowLayout->GetContentMarkup(); if( ! pMarkup ) goto Error; hr = pPointer->MoveToCp( cp, pMarkup ); if( hr ) goto Error; Assert( pPointer->TreePos()->GetCp( FALSE ) == cp ); #if DBG == 1 // Debug Only // // Test that the pointer is in a valid position // { CTreeNode * pTst = pPointer->CurrentScope(); if( pTst ) { if( pTst->Element()->Tag() == ETAG_ROOT ) TraceTag( ( tagViewServicesErrors, " MovePointerToPointInternal --- Root element ")); } else { TraceTag( ( tagViewServicesErrors, " MovePointerToPointInternal --- current scope is null ")); } } #endif // DBG == 1 // // Scroll this point into view // if( fScrollIntoView && pFlowLayout && OK( hr ) ) { LONG d = 5; CRect r( tContentPoint.x - d, tContentPoint.y - d, tContentPoint.x + d, tContentPoint.y + d ); pFlowLayout->ScrollRectIntoView( r, SP_MINIMAL, SP_MINIMAL ); } goto Cleanup; Error: TraceTag( ( tagViewServicesErrors, " MovePointerToPointInternal --- Failed ")); return( E_UNEXPECTED ); Cleanup: RRETURN(hr); } // // GetCharFormatInfo // // Pass in a MarkupPointer, a family mask, and a pointer to a // data struct, we populate the struct and mark the mask in the // struct to denote which fields are sucessfully set. // We return S_FALSE if there is an error getting the format info. // Note that it is possible that the command will partially // complete sucessfully. In such a case, check the eFamily field // in the struct to see how far we got. HRESULT CDoc::GetCharFormatInfo( IMarkupPointer *pPointer, WORD wFamily, HTMLCharFormatData *pInfo ) { HRESULT hr = S_OK; CMarkupPointer * pPointerInternal; CTreeNode * pNode; const CCharFormat * pCFormat; pInfo->dwSize = sizeof( pInfo ); pInfo->wFamilyFlags = CHAR_FORMAT_None; // Cast the passed in IMarkupPointer to a CMarkupPointer so I can get at internal goodness hr = THR( pPointer->QueryInterface(CLSID_CMarkupPointer, (void **)&pPointerInternal )); if (hr) goto Cleanup; pNode = pPointerInternal->CurrentScope(); pCFormat = pNode->GetCharFormat(); if( ! pCFormat ) { hr = S_FALSE; goto Cleanup; } // from pFormat, just copy the appropriate data into the struct... if( (wFamily & CHAR_FORMAT_FontStyle) == CHAR_FORMAT_FontStyle ) { pInfo->fBold = pCFormat->_fBold; pInfo->fItalic = pCFormat->_fItalic; pInfo->fUnderline = pCFormat->_fUnderline; pInfo->fOverline = pCFormat->_fOverline; pInfo->fStrike = pCFormat->_fStrikeOut; pInfo->fSubScript = pCFormat->_fSubscript; pInfo->fSuperScript = pCFormat->_fSuperscript; pInfo->wFamilyFlags = pInfo->wFamilyFlags | CHAR_FORMAT_FontStyle; } if( (wFamily & CHAR_FORMAT_FontInfo) == CHAR_FORMAT_FontInfo ) { pInfo->fExplicitFace = pCFormat->_fExplicitFace; pInfo->wWeight = pCFormat->_wWeight; pInfo->wFontSize = pCFormat->GetHeightInTwips( this ); pInfo->wFamilyFlags = pInfo->wFamilyFlags | CHAR_FORMAT_FontInfo; } if( (wFamily & CHAR_FORMAT_FontName) == CHAR_FORMAT_FontName ) { _tcscpy( pInfo->szFont, pCFormat->GetFaceName() ); pInfo->wFamilyFlags = pInfo->wFamilyFlags | CHAR_FORMAT_FontName; } if( (wFamily & CHAR_FORMAT_ColorInfo) == CHAR_FORMAT_ColorInfo ) { const CFancyFormat * pFFormat; pFFormat = pNode->GetFancyFormat(); pInfo->fHasBgColor = pCFormat->_fHasBgColor; pInfo->dwTextColor = pCFormat->_ccvTextColor.GetIntoRGB(); // Now we need to dig into the fancy format to get the bg color. // If we can't get it, we don't want to completely error out. // By returning S_FALSE, but still setting the ColorInfo flag, // we indicate that the rest of the color info is valid. pInfo->wFamilyFlags = pInfo->wFamilyFlags | CHAR_FORMAT_ColorInfo; if( ! pFFormat ) { hr = S_FALSE; goto Cleanup; } pInfo->dwBackColor = pFFormat->_ccvBackColor.GetIntoRGB(); } if( (wFamily & CHAR_FORMAT_ParaFormat) == CHAR_FORMAT_ParaFormat ) { const CParaFormat * pPFormat; pPFormat = pNode->GetParaFormat(); if( pPFormat == NULL ) goto Cleanup; if( pPFormat->_fPre ) { // Trident lies if we are in an input or a textarea. This messes up css pre-ness CMarkup * pMarkup = pPointerInternal->Markup(); CTreeNode * pPreNode = pMarkup->SearchBranchForTag( pNode, ETAG_PRE ); pInfo->fPre = ! ( pPreNode == NULL ); } pInfo->fRTL = pPFormat->_fRTL; pInfo->wFamilyFlags = pInfo->wFamilyFlags | CHAR_FORMAT_ParaFormat; } Cleanup: RRETURN( hr ); } HRESULT CDoc::ConvertVariantFromHTMLToTwips(VARIANT *pvarargIn) { return ::ConvertVariantFromHTMLToTwips(pvarargIn); } HRESULT CDoc::ConvertVariantFromTwipsToHTML(VARIANT *pvarargIn) { ::ConvertVariantFromTwipsToHTML(pvarargIn); return S_OK; } HRESULT CDoc::GetLineInfo(IMarkupPointer *pPointer, BOOL fAtEndOfLine, HTMLPtrDispInfoRec *pInfo) { HRESULT hr = S_OK; CMarkupPointer * pPointerInternal; CFlowLayout * pFlowLayout; POINT pt; CTreePos * ptp = NULL; CTreeNode * pNode = NULL; CCharFormat const * pCharFormat = NULL; LONG cp; hr = THR( pPointer->QueryInterface(CLSID_CMarkupPointer, (void **)&pPointerInternal )); if (hr) goto Cleanup; Assert( pPointerInternal->IsPositioned() ); ptp = pPointerInternal->TreePos(); pNode = pPointerInternal->CurrentScope(); pCharFormat = pNode->GetCharFormat(); pFlowLayout = GetFlowLayoutForSelection(pNode); if(!pFlowLayout) { hr = OLE_E_BLANK; goto Cleanup; } if (FExternalLayout()) { if (pFlowLayout->GetQuillGlue()) { hr = pFlowLayout->GetQuillGlue()->GetLineInfo(ptp, pFlowLayout, fAtEndOfLine, pInfo); } else { Assert(("No Quill !!!", pFlowLayout->GetQuillGlue() != NULL)); hr = OLE_E_BLANK; goto Cleanup; } } else // // fill in the structure with metrics from current position // { CLinePtr rp(pFlowLayout->GetDisplay()); cp = ptp->GetCp(); CCalcInfo CI; CI.Init(pFlowLayout); BOOL fComplexLine; // // Query Position Info // if (-1 == pFlowLayout->GetDisplay()->PointFromTp( cp, NULL, fAtEndOfLine, pt, &rp, TA_BASELINE, &CI, &fComplexLine )) { hr = OLE_E_BLANK; goto Cleanup; } pInfo->lXPosition = pt.x; pInfo->lBaseline = pt.y; pInfo->fRightToLeft = rp->_fRTL; Assert( pFlowLayout->ElementOwner()->Tag() != ETAG_ROOT ); if( pFlowLayout->ElementOwner()->Tag() != ETAG_ROOT ) { pInfo->lLineHeight = rp->_yHeight; pInfo->lDescent = rp->_yDescent; pInfo->lTextHeight = rp->_yHeight - rp->_yDescent; } else { pInfo->lLineHeight = 0; pInfo->lDescent = 0; pInfo->lTextHeight = 1; } // // try to compute true text height // { CCcs * pccs; pccs = fc().GetCcs( CI._hdc, &CI, pCharFormat ); if(!pccs) goto Cleanup; pInfo->lTextHeight = pccs->_yHeight + pccs->_yOffset; pccs->Release(); } } Cleanup: RRETURN(hr); } HRESULT CDoc::GetElementsInZOrder(POINT pt, IHTMLElement **rgElements, DWORD *pCount) { return E_NOTIMPL; // REVIEW (tomlaw): NetDocs can wait for this } HRESULT CDoc::GetTopElement(POINT pt, IHTMLElement **ppElement) { return elementFromPoint(pt.x,pt.y,ppElement); // REVIEW (tomlaw): be more precise about z-ordering? } HRESULT CDoc::MoveMarkupPointer( IMarkupPointer * pPointer, LAYOUT_MOVE_UNIT eUnit, LONG lXCurReally, BOOL * pfNotAtBOL ) { HRESULT hr = S_OK; CFlowLayout *pFlowLayout; CElement *pElemInternal = NULL; CTreeNode *pNode; CMarkup * pMarkup = NULL; CMarkupPointer *pPointerInternal = NULL; LONG cp; // InterfacePointers hr = pPointer->QueryInterface(CLSID_CMarkupPointer, (void **)&pPointerInternal); if (hr) goto Cleanup; // get element for current position so we can get it's flow layout pNode = pPointerInternal->CurrentScope(); if (!pNode) { hr = E_UNEXPECTED; goto Cleanup; } pElemInternal = pNode->Element(); Assert(pElemInternal); pFlowLayout = GetFlowLayoutForSelection(pNode); if(!pFlowLayout) { hr = OLE_E_BLANK; goto Cleanup; } // get cp for current position cp = pPointerInternal->TreePos()->GetCp(); // // use layout to get new position // pMarkup = pNode->GetMarkup(); // Get the line where we are positioned. if (FExternalLayout()) { if (eUnit != LAYOUT_MOVE_UNIT_TopOfWindow && eUnit != LAYOUT_MOVE_UNIT_BottomOfWindow) { if (pFlowLayout->GetQuillGlue()) hr = pFlowLayout->GetQuillGlue()->MoveMarkupPointer(pPointerInternal, eUnit, lXCurReally, *pfNotAtBOL); else { Assert(("No Quill !!!", pFlowLayout->GetQuillGlue() != NULL)); hr = OLE_E_BLANK; } goto Cleanup; } } switch (eUnit) { case LAYOUT_MOVE_UNIT_CurrentLineStart: { CLinePtr rp(pFlowLayout->GetDisplay()); rp.RpSetCp( cp , *pfNotAtBOL ); cp = cp - rp.GetIch(); // Check that we are sane if( cp < 1 || cp > pMarkup->Cch() ) goto Cleanup; *pfNotAtBOL = FALSE; // move pointer to new position hr = pPointerInternal->MoveToCp(cp, pMarkup , *pfNotAtBOL ); break; } case LAYOUT_MOVE_UNIT_CurrentLineEnd: { CLinePtr rp(pFlowLayout->GetDisplay()); rp.RpSetCp( cp , *pfNotAtBOL ); cp = (cp - rp.GetIch()) + rp.GetAdjustedLineLength(); // Check that we are sane if( cp < 1 || cp > pMarkup->Cch() ) goto Cleanup; *pfNotAtBOL = TRUE ; // move pointer to new position hr = pPointerInternal->MoveToCp(cp, pMarkup , *pfNotAtBOL ); break; } case LAYOUT_MOVE_UNIT_TopOfWindow: { // // BUGBUG: We need to be a bit more precise about where the // top of the first line is // // Go to top of window, not container... POINT pt; pt.x = 12; pt.y = 12; hr = THR( MoveMarkupPointerToPointEx( pt, pPointer, TRUE, pfNotAtBOL, NULL, FALSE )); goto Cleanup; } case LAYOUT_MOVE_UNIT_BottomOfWindow: { // // BUGBUG: More precision about the actual end of line needed // // Little harder, first have to calc the window size CSize szScreen; CPoint pt; // // Get the rect of the document's window // CView * pView = GetActiveView(); if( pView == NULL ) goto Cleanup; pView->GetViewSize( &szScreen ); pt = szScreen.AsPoint(); Assert( pt.x > 0 && pt.y > 0 ); pt.x -= 25; pt.y -= 25; hr = THR( MoveMarkupPointerToPointEx( pt, pPointer, TRUE, pfNotAtBOL, NULL, FALSE )); goto Cleanup; } case LAYOUT_MOVE_UNIT_PreviousLine: { CLinePtr rp(pFlowLayout->GetDisplay()); // Move one line up. This may cause the txt site to be different. rp.RpSetCp( cp , *pfNotAtBOL ); pFlowLayout = pFlowLayout->GetDisplay()->MoveLineUpOrDown(NAVIGATE_UP, rp, lXCurReally, &cp, pfNotAtBOL); // Check that we are sane if( cp < 1 || cp > pMarkup->Cch() ) goto Cleanup; // move pointer to new position hr = pPointerInternal->MoveToCp(cp, pMarkup , *pfNotAtBOL ); break; } case LAYOUT_MOVE_UNIT_NextLine: { CLinePtr rp(pFlowLayout->GetDisplay()); // Move down line up. This may cause the txt site to be different. rp.RpSetCp( cp , *pfNotAtBOL ); pFlowLayout = pFlowLayout->GetDisplay()->MoveLineUpOrDown(NAVIGATE_DOWN, rp, lXCurReally, &cp, pfNotAtBOL); // Check that we are sane if( cp < 1 || cp > pMarkup->Cch() ) goto Cleanup; // move pointer to new position hr = pPointerInternal->MoveToCp(cp, pMarkup , *pfNotAtBOL ); break; } default: return E_NOTIMPL; } Cleanup: return hr; } HRESULT CDoc::RegionFromMarkupPointers( IMarkupPointer *pPointerStart, IMarkupPointer *pPointerEnd, HRGN *phrgn) { HRESULT hr; CMarkupPointer * pStart = NULL; CMarkupPointer * pEnd = NULL; RECT rcBounding = g_Zero.rc; CStackDataAry<RECT, 4> aryRects(Mt(CDocRegionFromMarkupPointers_aryRects_pv)); // check parameters if ( !pPointerStart || !pPointerEnd || !phrgn ) { hr = E_POINTER; goto Cleanup; } // clean the out parameter *phrgn = NULL; // Get the CMarkupPointer values for the IMarkupPointer // parameters we received hr = pPointerStart->QueryInterface( CLSID_CMarkupPointer, (void **)&pStart ); if ( hr ) goto Cleanup; hr = pPointerEnd->QueryInterface( CLSID_CMarkupPointer, (void **)&pEnd ); if ( hr ) goto Cleanup; // We better have these pointers. Assert( pStart ); Assert( pEnd ); // Get rectangles hr = RegionFromMarkupPointers( pStart, pEnd, &aryRects, &rcBounding ); if ( hr ) goto Cleanup; //BUGBUG: [FerhanE] // The code below has to change in order to return a region that contains // multiple rectangles. To do that, a region must be created for each // member of the rect. array and combined with the complete region. // // Current code only returns the region for the bounding rectangle. // Create and return BOUNDING region *phrgn = CreateRectRgn( rcBounding.left ,rcBounding.top, rcBounding.right, rcBounding.bottom ); Cleanup: RRETURN( hr ); } HRESULT CDoc::RegionFromMarkupPointers( CMarkupPointer * pStart, CMarkupPointer * pEnd, CDataAry<RECT> * paryRects, RECT * pBoundingRect = NULL ) { HRESULT hr = S_OK; CTreeNode * pTreeNode = NULL; CFlowLayout * pFlowLayout = NULL; long cpStart = 0; // Starting cp. long cpEnd = 0; // Ending cp CElement * pElem = NULL; if ( !pStart || !pEnd || !paryRects) { hr = E_POINTER; goto Cleanup; } // Calculate the starting and ending cps cpStart = pStart->TreePos()->GetCp(); cpEnd = pEnd->TreePos()->GetCp(); //Get the flow layout that the markup pointer is placed in. pTreeNode = pStart->CurrentScope(); if ( !pTreeNode ) goto Error; pFlowLayout = GetFlowLayoutForSelection(pTreeNode); if ( !pFlowLayout ) goto Error; // get the element we are in. pElem = pTreeNode->Element(); // Get the rectangles. pFlowLayout->GetDisplay()->RegionFromElement( pElem, paryRects, NULL, NULL, 0 , cpStart, cpEnd, pBoundingRect ); Cleanup: RRETURN( hr ); Error: RRETURN( E_FAIL ); } HRESULT CDoc::GetCurrentSelectionRenderingServices( ISelectionRenderingServices ** ppSelRenSvc ) { HRESULT hr = S_OK; Assert( _pElemCurrent || _pElemEditContext ); CMarkup * pMarkup = GetCurrentMarkup(); if ( pMarkup ) { hr = THR( pMarkup->QueryInterface( IID_ISelectionRenderingServices, ( void**) ppSelRenSvc )); } else hr = E_FAIL; RRETURN ( hr ) ; } HRESULT CDoc::GetCurrentSelectionSegmentList( ISegmentList ** ppSegment) { HRESULT hr = S_OK; Assert( _pElemCurrent || _pElemEditContext ); CMarkup * pMarkup = GetCurrentMarkup(); if ( pMarkup ) { hr = THR( pMarkup->QueryInterface( IID_ISegmentList, ( void**) ppSegment )); } else hr = E_FAIL; RRETURN ( hr ) ; } CMarkup * CDoc::GetCurrentMarkup() { CMarkup * pMarkup = NULL; if (_pElemEditContext) { pMarkup = _pElemEditContext->GetMarkup(); } else if (_pElemCurrent) { if (_pElemCurrent->HasSlaveMarkupPtr()) { pMarkup = _pElemCurrent->GetSlaveMarkupPtr(); } else { pMarkup = _pElemCurrent->GetMarkup(); } } return pMarkup; } //+==================================================================================== // // Method: ShouldObjectHaveBorder // // Synopsis: Check to see if the _fNoUIActivateInDesign flag is set. // Used by mshtmled to decide whether to create a UI Active border around this // element ( presumed to be an Object tag - as all the other rules are fixed ). // //------------------------------------------------------------------------------------ HRESULT CDoc::ShouldObjectHaveBorder ( IHTMLElement* pIElement, BOOL* pfDrawBorder ) { HRESULT hr; CElement * pElement = NULL; CLayout* pLayout = NULL; if (! pIElement) { hr = E_INVALIDARG; goto Cleanup; } hr = THR_NOTRACE( pIElement->QueryInterface( CLSID_CElement, (void **) & pElement ) ); if (hr) goto Cleanup; pLayout = pElement->GetLayout(); *pfDrawBorder = ! pLayout->_fNoUIActivateInDesign ; Cleanup: RRETURN( hr ); } //+==================================================================================== // // Method: IsCaretVisible // // Synopsis: Checks for caret visibility - if there's no caret - return false. // //------------------------------------------------------------------------------------ BOOL CDoc::IsCaretVisible() { BOOL fVisible = FALSE; if ( _pCaret ) { _pCaret->IsVisible( & fVisible ); } return fVisible; } HRESULT CDoc::GetCaret( IHTMLCaret ** ppCaret ) { HRESULT hr = S_OK; // bugbug (johnbed) : when CView comes into being, the caret will be // stored there and will require a view pointer as well. // lazily construct the caret... if( _pCaret == NULL ) { _pCaret = new CCaret( this ); if( _pCaret == NULL ) goto Error; _pCaret->AddRef(); // Doc holds a ref to caret, released in passivate _pCaret->Init(); // Init the object _pCaret->Hide(); // Default to hidden - host or edit can show after move. } hr = _pCaret->QueryInterface( IID_IHTMLCaret, (void **) ppCaret ); RRETURN( hr ); Error: return E_OUTOFMEMORY; } HRESULT CDoc::IsLayoutElement ( IHTMLElement * pIElement, BOOL * fResult ) { HRESULT hr; CElement * pElement = NULL; if (! pIElement) { hr = E_INVALIDARG; goto Cleanup; } hr = THR_NOTRACE( pIElement->QueryInterface( CLSID_CElement, (void **) & pElement ) ); if (hr) goto Cleanup; *fResult = pElement->HasLayout(); Cleanup: RRETURN( hr ); } HRESULT CDoc::IsBlockElement ( IHTMLElement * pIElement, BOOL * fResult ) { HRESULT hr; CElement * pElement = NULL; if (! pIElement) { hr = E_INVALIDARG; goto Cleanup; } hr = THR_NOTRACE( pIElement->QueryInterface( CLSID_CElement, (void **) & pElement ) ); if (hr) goto Cleanup; *fResult = pElement->IsBlockElement(); Cleanup: RRETURN( hr ); } HRESULT CDoc::IsEditableElement ( IHTMLElement * pIElement, BOOL * fResult ) { HRESULT hr; CElement * pElement = NULL; if (! pIElement) { hr = E_INVALIDARG; goto Cleanup; } hr = pIElement->QueryInterface( CLSID_CElement, (void **) & pElement ); if (hr) goto Cleanup; *fResult = pElement->IsEditable(); Cleanup: RRETURN( hr ); } HRESULT CDoc::IsContainerElement( IHTMLElement * pIElement, BOOL * pfContainer, BOOL * pfHTML) { HRESULT hr; CElement * pElement = NULL; if (!pIElement) { hr = E_INVALIDARG; goto Cleanup; } hr = THR_NOTRACE( pIElement->QueryInterface( CLSID_CElement, (void **) & pElement ) ); if (hr) goto Cleanup; if (pfContainer) *pfContainer = pElement->HasFlag(TAGDESC_CONTAINER); if (pfHTML) *pfHTML = pElement->HasFlag(TAGDESC_ACCEPTHTML); Cleanup: RRETURN(hr); } HRESULT CDoc::GetFlowElement ( IMarkupPointer * pIPointer, IHTMLElement ** ppIElement ) { HRESULT hr; BOOL fPositioned = FALSE; CFlowLayout * pFlowLayout; CTreeNode * pTreeNode = NULL; CMarkupPointer * pMarkupPointer = NULL; CElement * pElement = NULL; if (! pIPointer) { hr = E_INVALIDARG; goto Cleanup; } hr = THR( pIPointer->IsPositioned( & fPositioned, NULL ) ); if (hr) goto Cleanup; if (! fPositioned) { hr = E_INVALIDARG; goto Cleanup; } hr = THR_NOTRACE( pIPointer->QueryInterface(CLSID_CMarkupPointer, (void **) &pMarkupPointer) ); if (hr) goto Cleanup; hr = S_FALSE; pTreeNode = (pMarkupPointer->IsPositioned() ) ? pMarkupPointer->CurrentScope() : NULL; if (! pTreeNode) goto Cleanup; pFlowLayout = GetFlowLayoutForSelection(pTreeNode); if (! pFlowLayout) goto Cleanup; pElement = pFlowLayout->ElementContent(); Assert(pElement); if (! pElement) goto Cleanup; hr = THR_NOTRACE( pElement->QueryInterface( IID_IHTMLElement, (void **) ppIElement ) ); if (hr) goto Cleanup; Cleanup: RRETURN1( hr, S_FALSE ); } //+==================================================================================== // // Method:GetElementFromCookie // // Synopsis: Return the IHTMLElement for an "element cookie" // // The "element cookie" is the CTreeNode which was passed to the edit dll, but not exposed // //------------------------------------------------------------------------------------ HRESULT CDoc::GetElementFromCookie( void* elementCookie, IHTMLElement** ppElement ) { HRESULT hr = S_OK; CTreeNode* pTreeNode ; CElement* pElement; if ( elementCookie ) { pTreeNode = static_cast<CTreeNode*>( elementCookie ); pElement = pTreeNode->Element(); if ( pElement->_etag == ETAG_TXTSLAVE ) { pElement= pElement->MarkupMaster(); } hr = THR( pElement->QueryInterface( IID_IHTMLElement, (void**) ppElement ) ); } else hr = E_INVALIDARG; RRETURN ( hr ); } HRESULT CDoc::GetViewHWND( HWND * pHWND ) { RRETURN( GetWindow( pHWND ) ); } HRESULT CDoc::DoTheDarnPasteHTML ( IMarkupPointer * pIPointerStart, IMarkupPointer * pIPointerFinish, HGLOBAL hGlobalHtml ) { HRESULT hr = S_OK; CMarkupPointer * pPointerStart; CMarkupPointer * pPointerFinish; Assert( pIPointerStart && hGlobalHtml ); hr = THR( pIPointerStart->QueryInterface( CLSID_CMarkupPointer, (void **) & pPointerStart ) ); if (hr) goto Cleanup; if (!pIPointerFinish) pIPointerFinish = pIPointerStart; hr = THR( pIPointerFinish->QueryInterface( CLSID_CMarkupPointer, (void **) & pPointerFinish ) ); if (hr) goto Cleanup; EnsureTotalOrder ( pPointerStart, pPointerFinish ); HRESULT HandleUIPasteHTML ( CMarkupPointer * pPointerTargetStart, CMarkupPointer * pPointerTargetFinish, HGLOBAL hglobal ); hr = THR( HandleUIPasteHTML( pPointerStart, pPointerFinish, hGlobalHtml ) ); Cleanup: RRETURN( hr ); } //+==================================================================================== // // Method:InflateBlockElement // // Synopsis: Sets break on empty flag // //------------------------------------------------------------------------------------ HRESULT CDoc::InflateBlockElement( IHTMLElement * pElem ) { HRESULT hr; CElement* pElement; hr = pElem->QueryInterface(CLSID_CElement, (LPVOID *)&pElement); if (SUCCEEDED(hr)) pElement->_fBreakOnEmpty = TRUE; RRETURN ( hr ); } //+==================================================================================== // // Method:InflateBlockElement // // Synopsis: Sets break on empty flag // //------------------------------------------------------------------------------------ HRESULT CDoc::IsMultiLineFlowElement( IHTMLElement * pIElement, BOOL * pfMultiLine) { HRESULT hr; CElement *pElement; CFlowLayout *pLayout; *pfMultiLine = FALSE; hr = pIElement->QueryInterface(CLSID_CElement, (LPVOID *)&pElement); if (SUCCEEDED(hr)) { pLayout = pElement->GetFlowLayout(); if (pLayout) *pfMultiLine = pLayout->GetMultiLine(); } RRETURN(hr); } //+==================================================================================== // // Method: FireOnSelectStartFromMessage // // Synopsis: Allows external Selection Managers to Fire_onDragStart into Elements. // //------------------------------------------------------------------------------------ HRESULT CDoc::FireOnSelectStartFromMessage( SelectionMessage *pSelectionMessage ) { CTreeNode* pNode = static_cast< CTreeNode * >( pSelectionMessage->elementCookie ); if( pNode == NULL ) return( E_FAIL ); else return( THR( pNode->Element()->Fire_onselectstart(pNode))); } HRESULT CDoc::FireCancelableEvent( IHTMLElement * pIElement, LONG dispidMethod, LONG dispidProp, BSTR bstrEventType, BOOL * pfResult) { HRESULT hr; CElement * pElement; BOOL fResult; hr = THR(pIElement->QueryInterface(CLSID_CElement, (void **) &pElement)); if (hr) goto Cleanup; fResult = pElement->BubbleCancelableEvent(NULL, 0, dispidMethod, dispidProp, bstrEventType, (BYTE *) VTS_NONE); if (pfResult) *pfResult = fResult; Cleanup: RRETURN(hr); } //+==================================================================================== // // Method: AddElementAdorner // // Synopsis: Create a CElementAdorner, and add it to our array of adorners. // //------------------------------------------------------------------------------------ HRESULT CDoc::AddElementAdorner( IHTMLElement* pIElement, IElementAdorner * pIElementAdorner, void** ppeCookie) { HRESULT hr = S_OK; CElementAdorner * pAdorner = NULL; CElement* pElement = NULL ; CView* pView; if ( !pIElement || !pIElementAdorner || !ppeCookie) { hr = E_INVALIDARG; goto Cleanup; } hr = THR( pIElement->QueryInterface( CLSID_CElement, (void **) & pElement ) ); if ( hr ) goto Cleanup; if ( pElement->_etag == ETAG_TXTSLAVE ) { pElement = pElement->MarkupMaster(); } pView = GetActiveView() ; if ( !pView ) { hr = E_FAIL; goto Cleanup; } pAdorner = DYNCAST( CElementAdorner, pView->CreateAdorner( pElement ) ); if ( !pAdorner ) { hr = E_OUTOFMEMORY; goto Cleanup; } pAdorner->SetSite( pIElementAdorner ); pAdorner->AddRef(); *ppeCookie = static_cast<void*> ( pAdorner ) ; Cleanup: RRETURN ( hr ); } //+==================================================================================== // // Method: RemoveElementAdorner // // Synopsis: Remove an ElementAdorner from our array - using the cookie we're given. // //------------------------------------------------------------------------------------ HRESULT CDoc::RemoveElementAdorner( void* peCookie) { HRESULT hr; if ( !peCookie ) { hr = E_INVALIDARG; } else { CElementAdorner* pAdorner = static_cast<CElementAdorner*> (peCookie); CView* pView = pAdorner->GetView(); if ( ( pView ) && ( _ulRefs != ULREF_IN_DESTRUCTOR ) && ( pView->Doc() != NULL ) ) { pView->OpenView(); pView->RemoveAdorner( pAdorner ); } pAdorner->Release(); hr = S_OK; } RRETURN ( hr ); } //+==================================================================================== // // Method: GetElementAdornerBounds // // Synopsis: Get the bounds of this adorner - in Global coordinates. // // HACK - This should be part of an interface - so the 'AdornerClient' does so directly. // // //------------------------------------------------------------------------------------ HRESULT CDoc::GetElementAdornerBounds( void* peAdornerCookie, RECT* pRectBounds ) { CElementAdorner* pAdorner; HRESULT hr; if ( !peAdornerCookie || !pRectBounds ) { hr = E_INVALIDARG; } else { pAdorner = static_cast<CElementAdorner*> ( peAdornerCookie); Assert( pAdorner ); Assert( pAdorner->GetView()->IsValidAdorner( pAdorner ) ); pAdorner->GetBounds( pRectBounds ); hr = S_OK; } RRETURN ( hr ); } HRESULT CDoc::IsNoScopeElement( IHTMLElement* pIElement, BOOL* pfNoScope ) { HRESULT hr = S_OK; CElement* pElement = NULL; if ( pIElement ) { hr = THR( pIElement->QueryInterface( CLSID_CElement, (void** ) & pElement )); if ( hr ) goto Cleanup; if ( pfNoScope ) *pfNoScope = pElement->IsNoScope(); } else { hr = E_INVALIDARG; } Cleanup: RRETURN ( hr ); } HRESULT CDoc::GetOuterContainer( IHTMLElement* pIElement, IHTMLElement** ppIOuterElement, BOOL fIgnoreOutermostContainer, BOOL * pfHitContainer ) { HRESULT hr = S_OK; CElement* pElement = NULL ; CTreeNode* pCurNode ; CElement* pOuterElement = NULL; // // If we aren't given an element - then we'll return the body as outer element // if ( pIElement ) { hr = THR( pIElement->QueryInterface( CLSID_CElement, (void** ) & pElement )); if ( hr ) goto Cleanup; pCurNode = pElement->GetFirstBranch(); while ( pCurNode ) { if ( pCurNode->Element()->HasFlag(TAGDESC_CONTAINER) ) { pOuterElement = pCurNode->Element(); break; } pCurNode = pCurNode->Parent(); } if (( pOuterElement->_etag == ETAG_BODY ) && ( fIgnoreOutermostContainer )) pOuterElement = FALSE; } else { pOuterElement = PrimaryMarkup()->GetElementClient(); } if ( ( ppIOuterElement ) && ( pOuterElement ) ) { hr = THR( pOuterElement->QueryInterface( IID_IHTMLElement, (void**) ppIOuterElement )); } if ( pfHitContainer ) { *pfHitContainer = ( pOuterElement != NULL ) ; } Cleanup: RRETURN ( hr ); } HRESULT CDoc::ScrollElement( IHTMLElement* pIElement, LONG lPercentToScroll, POINT* pScrollDelta ) { // TODO (johnbed) now we only scroll vertically, in fact, we ignore eDirection // all together. Fix this some day. HRESULT hr = S_OK; CElement * pElement = NULL; CTreeNode * pNode = NULL; CFlowLayout * pFlowLayout = NULL; CDispNode * pDispNode = NULL; CDispScroller * pScroller = NULL; SIZE szBefore; SIZE szAfter; pScrollDelta->x = 0; pScrollDelta->y = 0; hr = pIElement->QueryInterface( CLSID_CElement, (void **)&pElement ); if (hr) goto Cleanup; pNode = pElement->GetFirstBranch(); pFlowLayout = GetFlowLayoutForSelection( pNode ); pDispNode = pFlowLayout->GetElementDispNode( NULL, TRUE ); if( ! pDispNode->IsScroller() ) goto Cleanup; // nothing to do pScroller = (CDispScroller *) pDispNode; // For some reason, compiler barfs here, but this is the // "safe" thing to do. // pScroller = dynamic_cast<CDispScroller *>( pDispNode ); if( pScroller == NULL ) goto Error; pScroller->GetScrollOffset( &szBefore ); pFlowLayout->ScrollByPercent( CSize( 0, lPercentToScroll )); pScroller->GetScrollOffset( &szAfter ); pScrollDelta->x = szAfter.cx - szBefore.cx; pScrollDelta->y = szAfter.cy - szBefore.cy; goto Cleanup; Error: hr = E_FAIL; Cleanup: RRETURN( hr ); } HRESULT CDoc::GetScrollingElement( IMarkupPointer* pPosition, IHTMLElement* pIBoundary, IHTMLElement** ppElement ) { HRESULT hr = E_FAIL; Assert( ppElement != NULL ); CMarkupPointer * pPtr = NULL; CElement * pBoundary = NULL; CElement * pTest = NULL; CTreeNode * pNode = NULL; CLayout * pLayout = NULL; CDispNode * pDispNode = NULL; BOOL fDone = FALSE; *ppElement = NULL; hr = pPosition->QueryInterface( CLSID_CMarkupPointer, (void **)&pPtr ); if (hr) goto Cleanup; hr = pIBoundary->QueryInterface( CLSID_CElement, (void **)&pBoundary ); if (hr) goto Cleanup; pNode = pPtr->CurrentScope(); while( pNode && ! fDone ) { pTest = pNode->Element(); if( pTest == NULL ) goto Cleanup; pLayout = pTest->GetLayout(); pDispNode = (pLayout == NULL ? NULL : pLayout->GetElementDispNode( NULL, TRUE )); if( pDispNode && pDispNode->IsScroller() ) { hr = THR( pNode->Element()->QueryInterface( IID_IHTMLElement, (void **) ppElement )); if( hr ) { *ppElement = NULL; goto Cleanup; } fDone = TRUE; } if( pTest == pBoundary ) // This may not be the right way to do this comparison fDone = TRUE; pNode = pNode->Parent(); } Cleanup: return( hr ); } // declared in formkrnl.hxx CTreeNode * CDoc::GetNodeFromPoint( const POINT & pt, BOOL fGlobalCoordinates, POINT * pptContent /* = NULL */, LONG * plCpMaybe /* = NULL */ ) { CTreeNode * pTreeNode = NULL; POINT ptContent; CDispNode * pDispNode = NULL; DWORD dwCoordSys; CView * pView = NULL; HITTESTRESULTS HTRslts; HTC htcResult = HTC_NO; DWORD dwHTFlags = HT_VIRTUALHITTEST | // Turn on virtual hit testing HT_NOGRABTEST | // Ignore grab handles if they exist HT_IGNORESCROLL; // Ignore testing scroll bars if( fGlobalCoordinates ) dwCoordSys = CDispNode::COORDSYS_GLOBAL; else dwCoordSys = CDispNode::COORDSYS_CONTENT; // // Do a hit test to figure out what node would be hit by this point. // I know this seems like a lot of work to just get the TreeNode, // but we have to do this. Also, we can't trust the cp returned in // HTRslts. Some day, perhaps we can. // pView = GetActiveView(); if( pView == NULL ) goto Cleanup; htcResult = pView->HitTestPoint( pt, dwCoordSys, dwHTFlags, &HTRslts, &pTreeNode, ptContent, &pDispNode ); Cleanup: if( pptContent != NULL ) { pptContent->x = ptContent.x; pptContent->y = ptContent.y; } if( plCpMaybe != NULL ) { *plCpMaybe = HTRslts.cpHit; } return pTreeNode; } CFlowLayout * CDoc::GetFlowLayoutForSelection( CTreeNode * pNode ) { CMarkup * pMarkup; CFlowLayout * pFlowLayout = pNode->GetFlowLayout(); // Handle slave markups if (!pFlowLayout) { pMarkup = pNode->GetMarkup(); if (pMarkup->Master()) { pFlowLayout = pMarkup->Master()->HasFlowLayout(); } } return pFlowLayout; } //+==================================================================================== // // Method: StartHTMLEditorDblClickTimer // // Synopsis: Sets the MouseMove Timer interval for WM_TIMER // //------------------------------------------------------------------------------------ HRESULT CDoc::SetHTMLEditorMouseMoveTimer() { HRESULT hr = S_OK; SetMouseMoveTimer( g_iDragDelay ); RRETURN ( hr ); } //+==================================================================================== // // Method: StartHTMLEditorDblClickTimer // // Synopsis: Starts the DoubleClick Timer for the selection tracker. Used by ProcessFollowUpAction // Sets up OnEditDblClkTimer // to recieve ticks from WM_TIMER. // //------------------------------------------------------------------------------------ HRESULT CDoc::StartHTMLEditorDblClickTimer() { HRESULT hr = S_OK; Assert( ! _fInEditTimer ); hr = THR(FormsSetTimer( this, ONTICK_METHOD(CDoc, OnEditDblClkTimer, oneditdblclktimer), SELTRACK_DBLCLK_TIMERID, GetDoubleClickTime())); WHEN_DBG( _fInEditTimer= TRUE ); TraceTag((tagSelectionTimer, "StartHTMLEditor DblClickTImer")); RRETURN ( hr ); } //+==================================================================================== // // Method:StopHTMLEditorDblClickTimer // // Synopsis: Stops the DoubleClickTimer for the Selection Tracker // //------------------------------------------------------------------------------------ HRESULT CDoc::StopHTMLEditorDblClickTimer() { HRESULT hr = S_OK; hr = THR( FormsKillTimer( this, SELTRACK_DBLCLK_TIMERID ) ); TraceTag((tagSelectionTimer, "StopHTMLEditor DblClickTImer")); WHEN_DBG( _fInEditTimer = FALSE ); RRETURN1 ( hr, S_FALSE ); // False if there was no timer. } HRESULT CDoc::HTMLEditorTakeCapture( ) { HRESULT hr = S_OK; Assert( State() >= OS_INPLACE); Assert( ! _fInEditCapture ); SetMouseCapture( MOUSECAPTURE_METHOD( CDoc, HandleEditMessageCapture, handleeditmessagecapture), (void *) this, FALSE, FALSE ); _fInEditCapture = TRUE ; RRETURN ( hr ); } HRESULT CDoc::HTMLEditorReleaseCapture( ) { HRESULT hr = S_OK; Assert( _fInEditCapture ); SetMouseCapture(NULL, NULL); _fInEditCapture = FALSE ; RRETURN ( hr ); } //+==================================================================================== // // Method: AdjustEditContext // // Synopsis: External Adjust EditContext Routine. // //------------------------------------------------------------------------------------ HRESULT CDoc::AdjustEditContext ( IHTMLElement* pStartElement, IHTMLElement** ppEditThisElement, IMarkupPointer* pIStart, IMarkupPointer* pIEnd , BOOL * pfEditThisEditable, BOOL * pfEditParentEditable, BOOL * pfNoScopeElement ) { HRESULT hr = S_OK; CElement* pElementInternal = NULL; CElement* pOuterElement = NULL; hr = THR( pStartElement->QueryInterface( CLSID_CElement , ( void**) & pElementInternal )); if ( hr ) goto Cleanup; hr = THR( AdjustEditContext( pElementInternal, & pOuterElement, pIStart, pIEnd, pfEditThisEditable, pfEditParentEditable, pfNoScopeElement, TRUE )); if ( hr ) goto Cleanup; if ( ( !hr ) && ( ppEditThisElement ) ) { Assert( pOuterElement ); hr = THR( pOuterElement->QueryInterface( IID_IHTMLElement, (void**) ppEditThisElement )); } Cleanup: RRETURN( hr ); } //+==================================================================================== // // Method: AdjustEditContext // // Synopsis: Adjust the Markup Pointers to completely enclose the allowed editing region. // and Return the Element "I really should be editing" // // During editing - we never bypass this enclosed region // // Rules for the Element "I really should be editing" // // If the Element has a slave markup ptr - the elemnet I really want is a slave // // If we are in Browse Mode - move the pointers inside the outermost _fContainer (BODY, HTMLAREA, BUTTON) // // Else if we are in edit mode - move the pointers until they enclose the outermost editable element. // // BUGBUG - this should be in edit dll as it is some dancing of pointers. // But we want to hide "inner tree ness" hence it must be here. // //------------------------------------------------------------------------------------ HRESULT CDoc::AdjustEditContext( CElement* pStartElement, CElement** ppEditThisElement, IMarkupPointer* pIStart, IMarkupPointer* pIEnd , BOOL * pfEditThisEditable, BOOL * pfEditParentEditable, BOOL * pfNoScopeElement , BOOL fSetCurrencyIfInvalid /* = FALSE*/) { HRESULT hr = S_OK; CElement* pEditableElement = NULL; CElement* pCurElement = NULL; IHTMLElement* pICurElement = NULL; CTreeNode* pCurNode = FALSE; BOOL fNoScope = FALSE; if ( pStartElement->HasSlaveMarkupPtr()) { pEditableElement = pStartElement->GetSlaveMarkupPtr()->FirstElement(); } else if ( _fDesignMode ) { // // Look for the first container. This is our editable element // if ( pStartElement->IsNoScope() ) { pEditableElement = pStartElement; fNoScope = TRUE; } else { pCurNode = pStartElement->GetFirstBranch(); while ( pCurNode ) { pCurElement = pCurNode->Element(); // // We stop on Containers, Absolute or Relative Positioned objects // or objects that have a width or a height // // BUGBUG: this logic is probably still wrong according to JohnBed, // but works better than the code under ifdef NEVER // if ( ( pCurElement->HasFlowLayout() ) || ( pCurElement->_etag == ETAG_TXTSLAVE ) ) #ifdef NEVER ( pCurElement->HasFlag(TAGDESC_CONTAINER) ) || ( pCurElement->HasFlag(TAGDESC_ACCEPTHTML) ) || ( pCurNode->IsAbsolute() ) || ( pCurNode->IsRelative() ) || ( ! (pCurNode->GetCascadedwidth()).IsNull() ) || ( ! (pCurNode->GetCascadedheight()).IsNull() ) ) #endif { pEditableElement = pCurElement; break; } pCurNode = pCurNode->Parent(); } } if ( ! pEditableElement ) pEditableElement = PrimaryMarkup()->GetElementClient(); } else { // // Move until you hit the outermost editable element // BOOL fFoundEditableElement = pStartElement->_fEditAtBrowse; pCurNode = pStartElement->GetFirstBranch(); while ( pCurNode ) { pCurElement = pCurNode->Element(); if ( ( pCurElement->_fEditAtBrowse ) || ( pCurElement->_etag == ETAG_TXTSLAVE ) ) { pEditableElement = pCurElement; fFoundEditableElement = TRUE; if ( pCurElement->_etag == ETAG_TXTSLAVE ) break; } if ( fFoundEditableElement && ( !pCurElement->_fEditAtBrowse ) ) { break; } pCurNode = pCurNode->Parent(); } if ( ! fFoundEditableElement ) { // // We're in browse mode, there is nothing editable. // assume this is a selection in the body. Make the context the body. // pEditableElement = PrimaryMarkup()->GetElementClient(); } } // Clear the old selection, if the edit context is changing if (_pElemEditContext != pEditableElement) { hr = THR(NotifySelection(SELECT_NOTIFY_DESTROY_SELECTION, NULL)); if (hr) goto Cleanup; } if ( pEditableElement ) { hr = THR( pEditableElement->QueryInterface( IID_IHTMLElement, (void**) & pICurElement )); if ( hr ) goto Cleanup; if ( ! fNoScope ) { hr = THR( pIStart->MoveAdjacentToElement( pICurElement, ELEM_ADJ_AfterBegin )); if ( hr ) goto Cleanup; hr = THR( pIEnd->MoveAdjacentToElement( pICurElement, ELEM_ADJ_BeforeEnd )); if ( hr ) goto Cleanup; } else { hr = THR( pIStart->MoveAdjacentToElement( pICurElement, ELEM_ADJ_BeforeBegin )); if ( hr ) goto Cleanup; hr = THR( pIEnd->MoveAdjacentToElement( pICurElement, ELEM_ADJ_AfterEnd )); if ( hr ) goto Cleanup; } } _pElemEditContext = pEditableElement; if ( ppEditThisElement ) { *ppEditThisElement = pEditableElement; } if ( pfEditThisEditable ) { *pfEditThisEditable = pEditableElement->IsEditable(FALSE); } if ( pfEditParentEditable ) { // // BUGBUG - more master/slave bizzaritude ! Getting the parent on the slave // goes to the root. // if ( pEditableElement->_etag != ETAG_TXTSLAVE ) pCurNode = pEditableElement->GetFirstBranch()->Parent(); else pCurNode = pEditableElement->MarkupMaster()->GetFirstBranch()->Parent(); if ( pCurNode ) * pfEditParentEditable = pCurNode->Element()->IsEditable(FALSE); } if ( pfNoScopeElement ) { *pfNoScopeElement = fNoScope; } Cleanup: ReleaseInterface( pICurElement ); RRETURN ( hr ); } //+==================================================================================== // // Method: ScrollPointersIntoView // // Synopsis: Given two pointers ( that denote a selection). Do the "right thing" to scroll // them into view. // //------------------------------------------------------------------------------------ HRESULT CDoc::ScrollPointersIntoView( IMarkupPointer * pStart, IMarkupPointer * pEnd) { HRESULT hr = S_OK; CTreeNode* pNode; CFlowLayout* pFlowLayout ; CMarkupPointer* pPointerInternal = NULL; HTMLPtrDispInfoRec liStart, liEnd; int deltaY = 0; CRect rc; hr = THR(GetLineInfo( pStart, FALSE, &liStart )); if ( hr ) goto Cleanup; hr = THR( GetLineInfo( pEnd, FALSE, & liEnd )); if ( hr ) goto Cleanup; deltaY = 2 * max( liStart.lLineHeight, liEnd.lLineHeight ); // I want at least 2 lines of visiblity in all directions - may take tweaking to get right rc.left = min( liStart.lXPosition, liEnd.lXPosition); rc.top = min( liStart.lBaseline, liEnd.lBaseline) - deltaY ; rc.right = rc.left + abs( liEnd.lXPosition - liStart.lXPosition ) ; rc.bottom = rc.top + abs( liEnd.lBaseline - liStart.lBaseline ) + deltaY ; hr = THR( pStart->QueryInterface(CLSID_CMarkupPointer, (void **)&pPointerInternal )); if ( hr ) goto Cleanup; pNode = pPointerInternal->CurrentScope(); pFlowLayout = GetFlowLayoutForSelection( pNode ); pFlowLayout->TransformRect( & rc, COORDSYS_GLOBAL, COORDSYS_CONTENT, FALSE, NULL ); pFlowLayout->ScrollRectIntoView( rc, SP_BOTTOMRIGHT , SP_BOTTOMRIGHT ); Cleanup: RRETURN ( hr ); } HRESULT CDoc::ScrollPointerIntoView( IMarkupPointer * pPointer, POINTER_SCROLLPIN eScrollAmount ) { // TODO: Implement HRESULT hr = S_OK; CMarkupPointer * pPointerInternal = NULL; CTreeNode * pNode = NULL; CFlowLayout * pFlowLayout = NULL; HTMLPtrDispInfoRec LineInfo; SCROLLPIN ePin = SP_MINIMAL; GetLineInfo( pPointer, FALSE, &LineInfo ); LONG x, y, delta; x = LineInfo.lXPosition; y = LineInfo.lBaseline; delta = 2 * LineInfo.lLineHeight; // I want at least 2 lines of visiblity in all directions - may take tweaking to get right CRect rc( x - delta, y - delta, x + delta, y + delta ); hr = THR( pPointer->QueryInterface(CLSID_CMarkupPointer, (void **)&pPointerInternal )); if (hr) return E_FAIL; switch( eScrollAmount ) { case POINTER_SCROLLPIN_TopLeft: ePin = SP_TOPLEFT; break; case POINTER_SCROLLPIN_BottomRight: ePin = SP_BOTTOMRIGHT; break; default: ePin = SP_MINIMAL; break; } pNode = pPointerInternal->CurrentScope(); pFlowLayout = GetFlowLayoutForSelection( pNode ); pFlowLayout->ScrollRectIntoView( rc, ePin , ePin ); return hr; } HRESULT CDoc::ArePointersInSameMarkup( IMarkupPointer * pP1, IMarkupPointer * pP2, BOOL * pfSameMarkup ) { HRESULT hr = S_OK; CMarkupPointer * p1 = NULL; CMarkupPointer * p2 = NULL; CMarkup * pM1 = NULL; CMarkup * pM2 = NULL; hr = THR( pP1->QueryInterface(CLSID_CMarkupPointer, (void **)&p1 )); if (hr) goto Cleanup; hr = THR( pP2->QueryInterface(CLSID_CMarkupPointer, (void **)&p2 )); if (hr) goto Cleanup; pM1 = p1->Markup(); pM2 = p2->Markup(); // NOTE: two unpositioned markups are NOT in the same tree *pfSameMarkup = ( pM1 != NULL && ((DWORD) pM1 == (DWORD) pM2 )); Cleanup: RRETURN( hr ); } //+==================================================================================== // // Method: DragEleemnt // // Synopsis: Allow a Drag/Drop. // //------------------------------------------------------------------------------------ HRESULT CDoc::DragElement(IHTMLElement* pIElement, DWORD dwKeyState) { HRESULT hr = S_OK; CElement* pElement = NULL; hr = THR( pIElement->QueryInterface( CLSID_CElement, ( void** ) & pElement )); if ( hr ) goto Cleanup; pElement->DragElement( GetFlowLayoutForSelection( _pElemEditContext->GetFirstBranch() ), dwKeyState, NULL); Cleanup: RRETURN ( hr ); }
[ "mehmetyilmaz3371@gmail.com" ]
mehmetyilmaz3371@gmail.com
200383dc1735cc063b67d2e79028ea2bbaeccade
d941ec30c110a71b34aea0291a67ebf24e849ca4
/EntityAntFarm/physics_system.h
f1c5c44e3d18b72cbd6ff4b9d94a7f43ddb7e512
[]
no_license
clockwork-prism/EntityAntFarm
f318ce38340b024d18814698c6f8953196d2ce14
49fbed425183432836135ca7162848224ef8a363
refs/heads/master
2023-02-07T02:54:42.020837
2020-12-29T22:27:49
2020-12-29T22:27:49
280,737,384
0
0
null
2020-12-29T22:27:50
2020-07-18T20:50:38
C++
UTF-8
C++
false
false
578
h
#pragma once #include "EntityManager.h" #include "Managers.h" #include <iostream> class PhysicsSystem { private: const EntityManager* entityManager; PositionManager* positionManager; VelocityManager* velocityManager; HistoryManager* historyManager; void _update_positions(); public: PhysicsSystem( EntityManager* _entityManager, PositionManager* _position, VelocityManager* _velocity, HistoryManager* _history ) : entityManager{ _entityManager }, positionManager{ _position }, velocityManager{ _velocity }, historyManager{ _history } {} void step(); };
[ "rwalroth89@gmail.com" ]
rwalroth89@gmail.com
b30b1aa3444f73e7d8c416e1d3ab78d2b9650802
9ada6ca9bd5e669eb3e903f900bae306bf7fd75e
/case3/ddtFoam_Tutorial/0.003550000/OH
d240432a4ac9d82cd830d1eece28865475656096
[]
no_license
ptroyen/DDT
a6c8747f3a924a7039b71c96ee7d4a1618ad4197
6e6ddc7937324b04b22fbfcf974f9c9ea24e48bf
refs/heads/master
2020-05-24T15:04:39.786689
2018-01-28T21:36:40
2018-01-28T21:36:40
null
0
0
null
null
null
null
UTF-8
C++
false
false
141,938
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.1.1 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0.003550000"; object OH; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 0 0 0 0 0]; internalField nonuniform List<scalar> 12384 ( 0.01625 0.0170899 0.0170113 0.016362 0.0152899 0.0133938 0.0105959 0.00802249 0.00491092 0.00298346 0.00151798 0.00303663 0.00353905 0.00353055 0.000855088 0.000923934 0.00117336 0.00144685 0.00182761 0.00208008 0.00212874 0.00228257 0.00220049 0.00233901 0.0023239 0.00249998 0.00242551 0.00276821 0.00270548 0.00302339 0.00292602 0.00330514 0.00314576 0.00369766 0.0039938 0.00431288 0.00358461 0.00250426 0.0015625 0.00106024 0.00103294 0.00190984 0.0033242 0.00301274 0.00333234 0.00328186 0.00296792 0.00277921 0.00268377 0.0026583 0.0025932 0.00264624 0.00268276 0.00309671 0.00333759 0.00398091 0.0044662 0.00511104 0.00580597 0.0065121 0.00616629 0.00625315 0.00636592 0.0058551 0.00620269 0.0059733 0.00567498 0.00542874 0.00473245 0.00420447 0.00347961 0.00236484 0.00153243 0.00178652 0.00280162 0.00269729 0.0025895 0.0025715 0.00264158 0.00282015 0.00307611 0.00331739 0.00347604 0.00364443 0.00362903 0.00361838 0.00363178 0.00360918 0.00359648 0.00358422 0.00354472 0.00349327 0.00348331 0.00342293 0.00338795 0.00325696 0.00319161 0.00309514 0.00343701 0.00259647 0.00191104 0.00233588 0.00338008 0.00277116 0.00278434 0.00232538 0.00186375 0.00151146 0.00156398 0.00165133 0.00202992 0.00214863 0.0024868 0.00245198 0.00252318 0.00226006 0.00223615 0.00200163 0.00193951 0.00183345 0.00176041 0.00179034 0.00188944 0.00199272 0.00215343 0.00243224 0.00288155 0.00335996 0.00351995 0.00352228 0.00350042 0.00266158 0.0020863 0.00314587 0.00204573 0.00231508 0.00292239 0.00349703 0.00357548 0.00358929 0.00352151 0.00314696 0.00241682 0.00165981 0.00133739 0.00116238 0.00102408 0.000854023 0.000860117 0.000752094 0.000813231 0.000726115 0.000846871 0.000761811 0.000790689 0.000933798 0.000808141 0.0018214 0.00147273 0.0024707 0.00336965 0.00189785 0.00107404 0.00164583 0.00228828 0.00234374 0.00295843 0.00216429 0.000381241 0.000155374 0.000148624 0.000367194 0.00342159 0.00155164 0.000907745 0.00080745 0.000908505 0.00108554 0.001275 0.00146035 0.0016892 0.00185002 0.00206153 0.00199954 0.00178901 0.00136908 0.00101566 0.000788196 0.000450957 0.000419064 0.000350544 0.000415042 0.00059668 0.000715937 0.0011615 0.00123182 0.0014513 0.00163801 0.0020437 0.00224404 0.00261832 0.00284619 0.00312222 0.00305436 0.00284355 0.0015961 0.000629397 0.00037545 0.000458893 0.000638738 0.000972772 0.00115512 0.00286255 0.00265223 0.00323875 0.00332962 0.00293905 0.00220832 0.00133586 0.000760446 0.000541884 0.000676376 0.000702728 0.0008873 0.000683681 0.000547518 0.000480682 0.000817221 0.00121657 0.00173618 0.00160469 0.00198822 0.00195912 0.00154762 0.00162799 0.000741627 0.000984875 0.000884973 0.000870412 0.000890453 0.000891789 0.000920492 0.000946383 0.000978918 0.00101613 0.00105982 0.00110752 0.00119368 0.00133863 0.00155809 0.0019225 0.00244631 0.00282404 0.00309914 0.00126104 0.000940798 0.000807575 0.000783162 0.000978828 0.00136279 0.00159171 0.00178959 0.00212296 0.00239107 0.00235903 0.00184266 0.00130035 0.000858318 0.000633514 0.000611442 0.000548047 0.000489408 0.000472766 0.000443384 0.000459642 0.000640507 0.00100208 0.00124606 0.00169897 0.00221963 0.00266516 0.00307182 0.00325874 0.0032764 0.000323292 0.000320161 0.000342612 0.000351851 0.000408981 0.000473416 0.000554695 0.000662431 0.000796645 0.000979286 0.00169661 0.00166394 0.00153958 0.00114022 0.00111095 0.00107661 0.00101496 0.000988877 0.000917306 0.000914746 0.00101529 0.00108131 0.00125966 0.00127285 0.00163611 0.00173804 0.00227268 0.00249813 0.00295904 0.00301533 0.000332045 0.000291182 0.000276837 0.000279075 0.000305459 0.000332481 0.000360404 0.000400237 0.000458296 0.000453562 0.000575797 0.000768483 0.000821424 0.000908784 0.00104803 0.00116986 0.00116132 0.00125027 0.00116376 0.00121288 0.00111249 0.00112471 0.00106957 0.0010626 0.00109568 0.00117877 0.00131763 0.00163674 0.00176047 0.00184008 0.00158068 0.000838369 0.000500327 0.000246217 0.000323159 0.000281176 0.000268298 0.000308876 0.000300077 0.000336077 0.00038595 0.000459725 0.000578959 0.00069723 0.000914282 0.00100969 0.00108945 0.00106282 0.00117838 0.00109805 0.00164555 0.0034116 0.00393997 0.00418237 0.00391977 0.0038134 0.00385494 0.00447286 0.0058984 0.00693385 0.0180276 0.0110404 0.00859575 0.0078324 0.00811061 0.00923319 0.0130677 0.014877 0.0130359 0.00726431 0.00295334 0.0015393 0.00292557 0.00350501 0.000798945 0.00182781 0.0036016 0.00482624 0.00526175 0.0054378 0.00537349 0.00528825 0.00489887 0.004612 0.00406644 0.00374685 0.00344047 0.00344688 0.00333009 0.00352995 0.00337303 0.00365938 0.00358235 0.00416174 0.00471288 0.00556844 0.00497204 0.003295 0.00180392 0.00111288 0.00106034 0.00209392 0.00335258 0.00301562 0.00330361 0.00322898 0.00267238 0.0024506 0.0023678 0.00236404 0.00232323 0.00237346 0.00243623 0.00261694 0.00278984 0.00293805 0.00320949 0.00383083 0.00477111 0.00586184 0.00653498 0.0074942 0.00690692 0.00695396 0.00662188 0.0063051 0.00587825 0.00576787 0.00548498 0.00496413 0.00378257 0.00243339 0.00154454 0.00182755 0.00278555 0.00257011 0.00261035 0.00318335 0.00355289 0.00352984 0.0035534 0.00359867 0.0035708 0.00332208 0.00344841 0.00340749 0.00357775 0.003672 0.0036505 0.00363307 0.0036229 0.00360949 0.00359234 0.00352137 0.00343487 0.00328789 0.00314775 0.00299136 0.00315825 0.00347804 0.00286584 0.00222481 0.00297621 0.00288565 0.00282904 0.00211169 0.00173482 0.00240914 0.0033234 0.00305905 0.00251341 0.00212236 0.00193886 0.00183658 0.00192828 0.00216762 0.00248769 0.00309235 0.00346209 0.00351498 0.00318193 0.00292056 0.00279174 0.00273933 0.00276399 0.00293004 0.00323713 0.00351053 0.00345787 0.00346753 0.00349174 0.00282071 0.00205414 0.0031238 0.00210508 0.00285225 0.003393 0.00356114 0.00335176 0.00242243 0.0012222 0.00074977 0.000568151 0.0005538 0.00057761 0.000560854 0.000477012 0.000431976 0.000352956 0.000362357 0.000369571 0.000385265 0.000365409 0.000366567 0.000362998 0.000376449 0.000445443 0.00113198 0.00147894 0.00181689 0.00279304 0.00287267 0.00127432 0.00151483 0.000865716 0.00103591 0.0011602 0.000444551 0.000163881 0.000108022 0.000225399 0.00119764 0.00256901 0.00164855 0.00180314 0.00262674 0.0035038 0.00281602 0.00157698 0.00106565 0.00080023 0.000700376 0.000635207 0.000635773 0.000727319 0.000952224 0.00212943 0.00341382 0.00164788 0.000833557 0.000424728 0.000422548 0.000576217 0.000755585 0.00121473 0.0017466 0.00245914 0.00276722 0.00338989 0.00338287 0.00327195 0.00330659 0.0031097 0.00336578 0.00240977 0.000884252 0.000431511 0.000351264 0.00053271 0.000778264 0.00274924 0.000659558 0.000119289 8.09436e-05 6.70606e-05 6.40239e-05 7.26368e-05 8.98907e-05 0.000174551 0.000654832 0.00279539 0.000645405 0.000522712 0.000987299 0.000854479 0.000890652 0.000990052 0.00106993 0.00122645 0.0017837 0.00208676 0.00200317 0.00166587 0.00118827 0.000701442 0.000405942 0.000359612 0.000308581 0.00030672 0.000372928 0.000465532 0.000531172 0.000547189 0.000527487 0.000464865 0.0003796 0.00030666 0.000245787 0.000219678 0.000198929 0.000190349 0.000266728 0.000488712 0.000983164 0.0011433 0.000905112 0.000676407 0.000573665 0.000718318 0.00105398 0.00118353 0.00125774 0.00139513 0.00162879 0.00153676 0.00126776 0.000961471 0.000814297 0.000730071 0.000613481 0.000583151 0.000526526 0.000381608 0.000260307 0.000210482 0.000170019 0.000135758 0.000155386 0.000202751 0.00022606 0.000317892 0.00047329 0.000853148 0.00135537 0.000314419 0.000301538 0.000309447 0.000332659 0.000343308 0.000385906 0.000423595 0.000491411 0.000620266 0.000730232 0.000884715 0.0012489 0.00111046 0.000737247 0.000696454 0.000617921 0.00050476 0.000441343 0.000406026 0.000355108 0.000265211 0.000218335 0.00020253 0.000175212 0.000176725 0.000209562 0.000295388 0.000491642 0.00112556 0.00195612 0.000303615 0.00027185 0.000260135 0.000248763 0.000264986 0.000273553 0.000308655 0.000395043 0.000488859 0.000610118 0.000457049 0.000428553 0.000367423 0.000373175 0.000329779 0.000323638 0.000304286 0.000316002 0.000336583 0.000376616 0.000393209 0.000371199 0.000301787 0.000288046 0.000230467 0.000204452 0.000292855 0.000473509 0.000711982 0.00106598 0.00121563 0.00078439 0.000633814 0.000519501 0.000430768 0.000364178 0.000395558 0.000373536 0.000355978 0.000338133 0.000322358 0.000317277 0.000321585 0.000308176 0.000348417 0.000399237 0.000468618 0.000517084 0.000426695 0.000779209 0.000866557 0.00101234 0.00154928 0.00120398 0.00148734 0.00136859 0.00143014 0.00125288 0.00139761 0.00189288 0.00458308 0.00347841 0.00318893 0.00318239 0.00310034 0.00336319 0.00386253 0.00540329 0.00872724 0.0126841 0.00838872 0.00270783 0.00188589 0.00288041 0.000953309 0.00390174 0.0054833 0.00583443 0.00561752 0.00542852 0.0051246 0.00504575 0.00482 0.00499268 0.00533233 0.00508607 0.00445153 0.00398128 0.00370508 0.00380115 0.00365464 0.00395158 0.00395823 0.00496062 0.00592642 0.0073295 0.00648029 0.0039525 0.00188823 0.00100626 0.00107502 0.00228836 0.00336725 0.00312862 0.00331616 0.00305348 0.00261205 0.00245246 0.00242176 0.00230819 0.00218457 0.0022323 0.00240714 0.00275185 0.0031234 0.00330896 0.00338617 0.00354597 0.00413892 0.00494726 0.00586983 0.00755262 0.00756054 0.00808351 0.00719294 0.00628701 0.00558792 0.00536811 0.00561684 0.00542262 0.0041368 0.00224417 0.00156217 0.0020588 0.00271932 0.00277419 0.00351415 0.00347377 0.00336817 0.00201863 0.00126537 0.00085017 0.000751636 0.000721941 0.000713057 0.000760131 0.000822478 0.000927883 0.00122416 0.00150031 0.00218142 0.00251628 0.00301141 0.00338452 0.00360418 0.00350676 0.00326674 0.00300234 0.00299764 0.00338398 0.00341601 0.00291702 0.00290302 0.00322365 0.00277676 0.00213249 0.00307987 0.00282985 0.00211511 0.00162926 0.00139036 0.00116957 0.00109527 0.00104327 0.00105949 0.00114741 0.00131891 0.00163715 0.0021424 0.00261744 0.00308623 0.00338641 0.00347351 0.00350777 0.00351545 0.00350776 0.00346458 0.00324785 0.00303921 0.00314798 0.00335701 0.00277092 0.00199258 0.00299696 0.00232673 0.00332689 0.00359259 0.00279481 0.00128733 0.000630953 0.00047533 0.000472754 0.000464488 0.000426736 0.000352864 0.000356196 0.000384518 0.000423675 0.000462032 0.00049114 0.000542134 0.00055975 0.000530228 0.000508599 0.00046537 0.000361691 0.000350187 0.000630972 0.00119559 0.00154285 0.00207397 0.00335142 0.0016484 0.00146962 0.000130035 0.000182949 0.000217372 0.000123664 8.04697e-05 0.000145322 0.00101505 0.00337266 0.00281676 0.00338278 0.00229908 0.000926238 0.000515296 0.000372851 0.000303777 0.000270241 0.000253116 0.000237288 0.00023548 0.000229743 0.000236387 0.000241623 0.000314624 0.000568515 0.00300895 0.00198859 0.000590422 0.000464993 0.000580549 0.000661758 0.0017733 0.00286278 0.00312757 0.00326688 0.0033919 0.00343527 0.00261805 0.00180637 0.0019405 0.00308369 0.00203445 0.000557154 0.000368435 0.000413369 0.000720562 0.0029308 0.000228163 9.38185e-05 5.23454e-05 4.25704e-05 3.96072e-05 3.50965e-05 3.09994e-05 2.74482e-05 2.50313e-05 3.70196e-05 0.000126569 0.000954672 0.00153229 0.000501457 0.00160856 0.00115901 0.00100165 0.00122901 0.0017032 0.00197258 0.00191094 0.00187547 0.00160601 0.00167769 0.00152442 0.00165875 0.00341741 0.00309362 0.00123726 0.000705876 0.000508807 0.000458804 0.000455228 0.000487393 0.00061204 0.000845279 0.00150288 0.00336833 0.00262903 0.00100867 0.000292158 0.000112532 0.000109543 0.000190622 0.000984745 0.00079222 0.000532206 0.00039637 0.000440642 0.000637252 0.000768322 0.000723937 0.000882261 0.00103515 0.00107311 0.000934746 0.000987771 0.00102683 0.00108529 0.0013099 0.00151667 0.00197581 0.00262778 0.00302662 0.00314056 0.00278245 0.00217613 0.00142133 0.00100369 0.000601931 0.000334364 0.000235803 0.000206277 0.000286327 0.000284845 0.000279248 0.000271124 0.000296224 0.00028852 0.000345119 0.000404314 0.000582253 0.00095685 0.0011642 0.0028911 0.00428306 0.00352828 0.00179761 0.00130216 0.00122078 0.00115865 0.00128735 0.00168899 0.00332308 0.00259653 0.0013816 0.000422636 0.0002115 0.00012783 0.000106725 0.000109685 0.000136314 0.000224281 0.000415436 0.000284834 0.000257534 0.000251666 0.000250267 0.00025792 0.000430626 0.000765363 0.00155021 0.00315457 0.00399165 0.00357828 0.00284321 0.00323414 0.00342454 0.00253416 0.00133378 0.000749164 0.000391735 0.000275655 0.000213923 0.000196116 0.000187048 0.000172529 0.000165596 0.000160763 0.000126497 0.000115067 0.000122951 0.000201934 0.000387553 0.00093236 0.00110572 0.00144076 0.00160145 0.00183998 0.00210716 0.00220246 0.00228198 0.00206428 0.00200745 0.00167028 0.00134111 0.000896596 0.000672845 0.000557171 0.000416559 0.000457451 0.000398222 0.00060155 0.00095499 0.00109123 0.00118229 0.00100194 0.00177237 0.0023276 0.00280535 0.00308528 0.00268333 0.00177961 0.00116392 0.00223448 0.00319998 0.00432583 0.00408992 0.00345175 0.00252981 0.00244011 0.00268299 0.00383617 0.00598704 0.0106944 0.00805911 0.0021684 0.00223634 0.0019564 0.0050378 0.00578686 0.006048 0.00585185 0.00535511 0.00517157 0.00495536 0.00488751 0.00467957 0.00511825 0.00556006 0.00530285 0.00418401 0.00394599 0.00367388 0.00388045 0.00391304 0.00445695 0.00579139 0.0076357 0.00881661 0.00745816 0.0038315 0.00141754 0.000698845 0.000863012 0.0019071 0.00330095 0.00337873 0.0032165 0.00299305 0.00273614 0.00263231 0.00235935 0.00208122 0.00199037 0.00219475 0.00259876 0.00323927 0.00364984 0.00360514 0.00370947 0.00388817 0.00419588 0.00446407 0.00520556 0.00592528 0.00708619 0.00809315 0.00778348 0.00643763 0.00511505 0.0046105 0.00510909 0.00553513 0.00428418 0.00205903 0.00167415 0.0023659 0.00280844 0.00351875 0.0034601 0.0016722 0.000646864 0.000443656 0.000437833 0.000491378 0.000523876 0.000608506 0.000624583 0.000627273 0.000635101 0.000672329 0.000735367 0.000863836 0.00119769 0.00151604 0.00229481 0.00300576 0.00346258 0.00349529 0.00334163 0.00303352 0.0029284 0.00321436 0.00345869 0.00319963 0.00288434 0.00326365 0.00263153 0.00289945 0.00297065 0.00257432 0.00227028 0.00182954 0.001458 0.00124864 0.00111897 0.0010476 0.00101671 0.00102103 0.00109808 0.00127758 0.00150327 0.00184859 0.00223966 0.00263099 0.00299425 0.00321768 0.00331957 0.00320009 0.00288495 0.00251045 0.00241491 0.0027312 0.00304957 0.0025144 0.00190946 0.00296184 0.00263675 0.003532 0.00251022 0.000941913 0.000490987 0.000450366 0.000462902 0.000440668 0.000393294 0.000365318 0.00039607 0.000439377 0.000480333 0.000510112 0.000571141 0.000636023 0.000704266 0.000739108 0.000752633 0.000765252 0.000711786 0.000511123 0.000413349 0.000352635 0.000904251 0.00132809 0.001793 0.00321701 0.00190559 0.00147188 7.26945e-05 7.32167e-05 7.23538e-05 4.99956e-05 0.000102309 0.000433513 0.00336868 0.0033469 0.00281489 0.000967163 0.000482832 0.000346865 0.000289856 0.000272628 0.000264083 0.000254705 0.000245015 0.000241873 0.000250232 0.000266545 0.000285009 0.000292003 0.000272598 0.000311632 0.000908243 0.00329808 0.00083596 0.0005103 0.000559623 0.000590702 0.00282188 0.00322352 0.00282517 0.00235327 0.00229169 0.00289332 0.00347304 0.00187884 0.00140719 0.00322425 0.00165645 0.00051593 0.000355001 0.000456648 0.00160537 0.00041076 6.8807e-05 5.95669e-05 5.48595e-05 5.23562e-05 4.98934e-05 4.60537e-05 3.92714e-05 3.71594e-05 4.36525e-05 3.49689e-05 3.68696e-05 7.02805e-05 0.00103722 0.000962275 0.00212462 0.00170877 0.00141637 0.0013812 0.00163885 0.00188414 0.00188424 0.00212689 0.00283237 0.0025421 0.000438343 0.000174463 9.97542e-05 7.73853e-05 6.84453e-05 6.65637e-05 6.51339e-05 6.30763e-05 6.18114e-05 6.09955e-05 6.05969e-05 6.27474e-05 6.95928e-05 9.41701e-05 0.00016846 0.000469498 0.00302981 0.000999702 0.000107082 7.72821e-05 0.000769882 0.000627095 0.000474686 0.000370945 0.000340359 0.000399461 0.000466894 0.00054367 0.000569234 0.000757806 0.000826499 0.000976687 0.00130373 0.00184465 0.0025401 0.00329395 0.00196652 0.000737394 0.00041987 0.000318827 0.000264958 0.000237034 0.000234282 0.000276433 0.000392738 0.000800322 0.00328717 0.00137933 0.000303058 0.00015302 0.000242699 0.000256386 0.000255146 0.000274024 0.000293384 0.000442004 0.000552056 0.00117294 0.0023695 0.00411888 0.000913859 0.000809508 0.000339488 0.000314188 0.000244309 0.000205189 0.0001762 0.000175178 0.00018087 0.000214085 0.000233909 0.00033945 0.00140909 0.00291043 0.000688324 0.0001843 9.70718e-05 8.7923e-05 0.000113919 0.000185511 0.000251383 0.000252493 0.000293688 0.000308899 0.000442538 0.00107502 0.0035492 0.00154921 0.000635913 0.000585197 0.00031093 0.000260917 0.000183357 0.000175122 0.000172773 0.000237042 0.000425411 0.00139286 0.00264132 0.00110991 0.000541409 0.000353686 0.000210533 0.000184738 0.000164992 0.000133179 0.000113898 8.5816e-05 9.54708e-05 0.000156966 0.0010239 0.00261401 0.0045885 0.00509763 0.00240083 0.00137421 0.000902726 0.000773988 0.000586761 0.000564227 0.00082801 0.0012375 0.00315718 0.00488249 0.00278997 0.00197905 0.00132887 0.00150658 0.00197507 0.00227212 0.00259274 0.00262685 0.0031434 0.00396211 0.00664896 0.0091306 0.0100428 0.0080436 0.00445308 0.00136892 0.00426011 0.00965681 0.0119584 0.0117959 0.00889801 0.00523069 0.00336656 0.00289811 0.00310512 0.00420671 0.00661569 0.0100164 0.00544188 0.00176792 0.00342961 0.00536159 0.00603231 0.00628399 0.00609888 0.00561257 0.0052303 0.00516383 0.00528064 0.00551505 0.00587343 0.00607343 0.00522788 0.00414681 0.00371541 0.0036775 0.00368802 0.00408034 0.00506988 0.00725334 0.00914507 0.00974677 0.00698402 0.0024721 0.000671572 0.000269891 0.000376604 0.000904679 0.00230563 0.00340048 0.00318892 0.00295208 0.00282643 0.00237089 0.00195956 0.00189379 0.00199319 0.0023977 0.00312019 0.00381631 0.00362081 0.00322295 0.00322812 0.00372931 0.00414303 0.00454363 0.00488711 0.00502484 0.00627423 0.00725567 0.00705704 0.00582969 0.00449335 0.00425765 0.00471644 0.00550319 0.00394117 0.00184617 0.0018738 0.00281541 0.00323091 0.00347488 0.00109842 0.00035201 0.000328163 0.00050603 0.00102958 0.00161997 0.00243351 0.00263377 0.0024906 0.00206075 0.00152945 0.00132737 0.00124126 0.00132145 0.00152907 0.00225327 0.00298883 0.00350024 0.00349849 0.00344628 0.00324084 0.00297435 0.00285736 0.00318821 0.00346255 0.00337675 0.00312749 0.00318615 0.00271961 0.00357079 0.00315987 0.00307219 0.00324383 0.00261383 0.00198617 0.00155743 0.00129263 0.00122231 0.00109532 0.00115807 0.00113443 0.00130468 0.00147504 0.00175862 0.00207578 0.00240345 0.00265898 0.00272804 0.00255191 0.00220698 0.00185965 0.00174685 0.00189238 0.00227944 0.00254708 0.00213576 0.00186326 0.00286804 0.00293186 0.00295786 0.00106382 0.00050478 0.000450695 0.000474598 0.000435346 0.00038226 0.000366821 0.000394353 0.000439405 0.000443273 0.000414632 0.000424096 0.000484964 0.000595994 0.000677278 0.000696665 0.000764789 0.00072362 0.000724927 0.000550279 0.00045883 0.000295278 0.000760503 0.00109634 0.00148281 0.00318928 0.00188553 0.00153574 5.27187e-05 4.15216e-05 3.63496e-05 5.22243e-05 0.000278707 0.00198388 0.00340721 0.00258633 0.000787619 0.000436906 0.000345653 0.000305323 0.000292472 0.000287047 0.000273572 0.000262296 0.000245301 0.00024131 0.000275697 0.000387865 0.000557537 0.000718498 0.000533781 0.00048783 0.000804324 0.00338978 0.00127151 0.000601757 0.000545556 0.000434759 0.00350001 0.00311294 0.00198008 0.001496 0.00150464 0.00181954 0.00315285 0.00240949 0.00141603 0.00317473 0.00135112 0.000510599 0.00035123 0.00048759 0.00323134 0.000140159 5.40053e-05 5.68107e-05 5.91504e-05 6.05616e-05 6.17161e-05 5.86635e-05 5.64848e-05 5.13209e-05 4.01166e-05 5.33713e-05 5.1842e-05 3.91115e-05 0.000227068 0.00119472 0.00267111 0.00181764 0.00149643 0.00139142 0.00159358 0.00175866 0.00187517 0.00306716 0.00125155 0.000173323 6.2517e-05 4.49515e-05 4.43936e-05 6.05329e-05 5.53574e-05 6.62817e-05 6.07345e-05 6.14364e-05 5.81658e-05 5.44809e-05 4.92745e-05 4.36736e-05 3.95497e-05 3.8651e-05 4.12233e-05 5.85833e-05 0.000156019 0.00128423 0.000828847 6.41326e-05 0.00051785 0.000468784 0.000471038 0.000477733 0.000412101 0.000352549 0.000368101 0.000360569 0.00046115 0.000662784 0.000960084 0.00137508 0.00231563 0.0033377 0.0024 0.0010186 0.000455057 0.000284637 0.000210363 0.000226077 0.000179708 0.000190201 0.000177532 0.000164755 0.000158347 0.000138647 0.00021741 0.000586403 0.00263801 0.000323419 0.000215014 0.000224139 0.000251415 0.000321359 0.000409273 0.000650031 0.00107826 0.00251687 0.00279372 0.000835081 0.000535372 0.000674938 0.000905453 0.000725802 0.000657758 0.000509606 0.000481601 0.00037769 0.000246463 0.000208051 0.000137007 0.000110383 0.000114661 0.000178575 0.000801857 0.00207452 0.000379048 0.000143371 9.37617e-05 0.000104215 0.000230103 0.000295802 0.000437693 0.000525973 0.00103822 0.00326638 0.000874734 0.000430595 0.000596822 0.000654699 0.00105178 0.000774374 0.000437622 0.000345053 0.000174913 0.000103693 8.89591e-05 8.2042e-05 0.000144576 0.000441401 0.00307693 0.00182975 0.000572424 0.000379741 0.00026466 0.000193941 0.000157547 0.000111124 8.56428e-05 8.94317e-05 0.00165214 0.00543162 0.00270742 0.000797139 0.000508603 0.000241251 0.000219098 0.000154325 0.000165984 0.000162826 0.000183789 0.000227905 0.000287853 0.000453048 0.00119271 0.00377046 0.00761352 0.00753331 0.00724746 0.00742243 0.00753508 0.00785636 0.00807819 0.00631804 0.00311638 0.00282855 0.00314557 0.00374406 0.00764021 0.00412423 0.00697544 0.0103039 0.0083628 0.0089897 0.0113365 0.00992606 0.00680682 0.0051787 0.00507296 0.00528547 0.00663903 0.0086415 0.0089424 0.00188101 0.00461418 0.00537248 0.0065749 0.00699073 0.00628445 0.0063687 0.007006 0.00715272 0.00698816 0.00672336 0.00631435 0.00541487 0.00435038 0.00379248 0.00358776 0.00346532 0.00369108 0.0045302 0.00673259 0.00896277 0.0101257 0.00924355 0.00388964 0.000839033 0.00023628 0.000118203 0.000200834 0.000509065 0.0014175 0.00311261 0.00307166 0.00289713 0.00233717 0.00186741 0.00187452 0.00198799 0.00215007 0.00259799 0.00342383 0.00358337 0.00307314 0.00291016 0.00297927 0.00329644 0.00398073 0.0041823 0.00496309 0.00510441 0.00569162 0.00561295 0.00536341 0.00452193 0.00407899 0.00406668 0.00461571 0.00573512 0.00297886 0.00173495 0.00209088 0.00300739 0.00348402 0.00139937 0.000293393 0.000295707 0.00075459 0.00219469 0.00354825 0.00332747 0.00325145 0.00323496 0.00336846 0.00353799 0.00359983 0.00338271 0.00314781 0.00315559 0.00341587 0.0035505 0.0034756 0.00331707 0.00318564 0.00310483 0.00297314 0.0027632 0.00283333 0.0032892 0.00347418 0.00343589 0.00337486 0.00306363 0.00304159 0.00217895 0.000863811 0.00107562 0.00223427 0.00337033 0.0030617 0.00255452 0.00215555 0.00193614 0.00177427 0.00167229 0.00163279 0.00167947 0.00180077 0.00195229 0.00206627 0.00209051 0.00197604 0.00175802 0.00148944 0.00134116 0.00124802 0.00124526 0.00140346 0.00170767 0.00188574 0.00169054 0.00180389 0.00287446 0.00319612 0.00164573 0.000600079 0.000454846 0.000458601 0.000424373 0.000362223 0.000332758 0.000338511 0.000354353 0.000325971 0.000285164 0.000285324 0.000351731 0.00046791 0.000598904 0.000636384 0.000618041 0.000648941 0.00061751 0.000492458 0.000483076 0.000427233 0.000307575 0.000751113 0.00105903 0.00148032 0.00346474 0.00171328 0.00167292 4.49576e-05 2.71263e-05 3.64412e-05 0.000131548 0.00102451 0.00324343 0.00270501 0.00099266 0.000466177 0.000371006 0.000329408 0.000300821 0.000288693 0.00027696 0.000261712 0.000242935 0.000222516 0.000229527 0.000293515 0.000615712 0.00146631 0.00279254 0.00239511 0.00163561 0.00220945 0.00317192 0.00143017 0.000677824 0.000476845 0.000379815 0.00354186 0.00249368 0.00155116 0.00135408 0.00127878 0.00163896 0.00285755 0.00247913 0.00144123 0.0033813 0.00120483 0.000597005 0.000401541 0.000578329 0.00176622 9.87277e-05 6.03556e-05 6.50881e-05 6.34552e-05 6.22392e-05 6.65064e-05 6.78793e-05 6.79269e-05 6.97567e-05 6.65844e-05 5.80534e-05 5.08647e-05 5.31334e-05 0.000211752 0.00323108 0.00270582 0.00183104 0.00136218 0.00127513 0.0013949 0.00187423 0.00274428 0.00151035 0.000231928 7.00207e-05 5.66783e-05 5.67136e-05 7.53016e-05 9.72616e-05 9.31424e-05 9.43188e-05 9.5436e-05 9.08941e-05 8.95257e-05 8.26813e-05 6.98153e-05 6.10836e-05 5.01767e-05 3.96735e-05 3.49513e-05 3.41412e-05 4.20553e-05 0.000121229 0.00169695 0.00025808 0.000347653 0.000415921 0.000576239 0.000791017 0.000840042 0.000550932 0.00035237 0.00029826 0.000358362 0.000605235 0.00120752 0.00227181 0.00339373 0.00141035 0.00073906 0.000435751 0.000283557 0.00025842 0.000278424 0.000366156 0.000389247 0.0004318 0.000468354 0.000366038 0.000243121 0.000226451 0.000184376 0.000198737 0.000350824 0.00311977 0.000208256 0.000311192 0.000379234 0.000557229 0.000625163 0.00101014 0.0019361 0.00400166 0.000844506 0.000602909 0.000583934 0.00178625 0.00169087 0.00182283 0.00106484 0.00108951 0.000866614 0.000791316 0.000582404 0.000408844 0.000255659 0.000137141 8.56223e-05 5.43053e-05 7.38171e-05 0.000264417 0.003348 0.000553167 0.000142716 9.35812e-05 0.000231229 0.000400512 0.00090047 0.00120908 0.0023783 0.00126878 0.000349279 0.000356132 0.000712701 0.00242042 0.00399269 0.00386336 0.00355613 0.00268239 0.00155964 0.000608515 0.000193651 8.35633e-05 4.94444e-05 5.7834e-05 0.000106698 0.000448074 0.00310269 0.00139682 0.000731329 0.000428163 0.000275855 0.000174907 0.000101413 8.33101e-05 0.00230836 0.00347415 0.00072601 0.00060484 0.000292591 0.000361314 0.000346341 0.000588121 0.00101165 0.00100379 0.000650871 0.000568909 0.000253862 0.000244248 0.000185626 0.000517584 0.00185195 0.00419906 0.00649455 0.00799167 0.00693254 0.00527161 0.00301466 0.00169718 0.00122087 0.000763127 0.00114461 0.00367694 0.00866455 0.00546328 0.00819855 0.00803943 0.00670539 0.00811528 0.00908398 0.0106035 0.0112131 0.0104229 0.00970691 0.0090348 0.00888869 0.00955158 0.00852488 0.00293315 0.00507972 0.00553355 0.0072992 0.00742403 0.00706622 0.00751691 0.00571502 0.00439816 0.00405273 0.00420212 0.00425694 0.00392081 0.00371255 0.00347737 0.00329521 0.00332842 0.00427477 0.00645383 0.00882562 0.00986332 0.00947383 0.00394563 0.000831858 0.00027135 0.00013568 0.000177806 0.000533611 0.00106067 0.00156295 0.00282246 0.00297771 0.00242361 0.00181349 0.00193418 0.00212707 0.00212901 0.00217879 0.00246747 0.00321154 0.00381214 0.0034903 0.00312 0.00312615 0.00303452 0.00329587 0.00346468 0.00359747 0.00420316 0.00414401 0.00419387 0.00400164 0.0037567 0.00347877 0.00393463 0.00501975 0.00563799 0.00223457 0.00147664 0.00207776 0.00311904 0.00283418 0.000447794 0.000262219 0.000620078 0.0023202 0.00348675 0.00299114 0.00290272 0.00298514 0.00307859 0.00313349 0.00317433 0.00326899 0.00334816 0.00336521 0.00322994 0.00307773 0.00290256 0.00275412 0.00267112 0.00267106 0.00270522 0.00263768 0.00269499 0.00303262 0.00343237 0.00349044 0.00339702 0.00347282 0.00279658 0.00276135 0.00076925 0.000374096 0.000473358 0.000841313 0.00133204 0.00252452 0.00324157 0.00349672 0.00344177 0.00332369 0.00315606 0.00293722 0.00265861 0.0025441 0.00230812 0.00232951 0.00219557 0.00219594 0.00206227 0.00200659 0.00183548 0.0017059 0.0015457 0.00144896 0.00149574 0.00150459 0.00149419 0.00180225 0.0028369 0.0034622 0.000915043 0.000520877 0.000434319 0.000428543 0.000354635 0.000303364 0.000284468 0.00027151 0.000251206 0.000222544 0.00021251 0.000250763 0.000343962 0.00049053 0.00060083 0.000559866 0.000515378 0.000507071 0.000493818 0.000492605 0.000437147 0.000415302 0.000428308 0.000821933 0.0010795 0.00170135 0.00312076 0.00155594 0.00167644 4.1342e-05 2.62569e-05 6.09876e-05 0.00039356 0.0025093 0.00302617 0.00137815 0.000621418 0.000428244 0.000343124 0.000296426 0.000274684 0.000250056 0.000244859 0.000232113 0.000221383 0.000203121 0.000212138 0.000296779 0.000874297 0.00352542 0.00256572 0.00223912 0.00239787 0.00238373 0.00164264 0.000952056 0.00056958 0.00044184 0.000377801 0.00309944 0.00184118 0.00142345 0.00151206 0.00154063 0.00194048 0.00337528 0.00182924 0.00212856 0.00298515 0.00113165 0.000751403 0.000511133 0.000884115 0.00117785 9.37783e-05 6.46458e-05 6.5136e-05 6.43067e-05 6.58537e-05 6.74581e-05 6.85451e-05 7.13489e-05 8.66952e-05 0.000102886 0.000102011 9.61396e-05 0.000113466 0.000281397 0.00138253 0.00223969 0.00173045 0.00125901 0.00119246 0.00137353 0.00222215 0.00267129 0.000376497 9.97772e-05 6.19384e-05 6.02671e-05 7.32921e-05 9.18628e-05 0.000113398 0.000109664 0.000120285 0.000115007 0.000114464 0.000110169 0.000106612 0.000100032 8.68844e-05 6.78507e-05 5.41836e-05 3.9895e-05 3.31708e-05 3.15096e-05 4.01639e-05 0.000137252 0.00253751 0.000298156 0.000508947 0.00122515 0.00265934 0.00268767 0.00168053 0.000716602 0.00037623 0.000315227 0.000453146 0.00121882 0.00312094 0.00194635 0.000715969 0.000433557 0.000328469 0.000284791 0.000287909 0.000379038 0.000467869 0.000541745 0.00055058 0.000516686 0.000487256 0.000448701 0.000327575 0.000251911 0.000183874 0.00014168 0.00017003 0.000418638 0.000737118 0.00125677 0.00160158 0.00138433 0.00173733 0.00325223 0.00223781 0.000726739 0.00054993 0.00148157 0.00275971 0.00249852 0.00156298 0.00134202 0.00100572 0.000776328 0.0006733 0.00067167 0.000417977 0.000320237 0.00018094 0.000116476 6.68751e-05 5.01332e-05 4.45899e-05 0.000176735 0.00344526 0.000450575 0.000102855 0.000281778 0.00082036 0.00218636 0.00290572 0.00286028 0.000619674 0.000393328 0.000526756 0.00145833 0.00379801 0.00333469 0.00209476 0.00289639 0.00293968 0.00305081 0.00220837 0.000812616 0.000279733 0.000102013 4.95584e-05 3.55882e-05 4.46396e-05 0.000164713 0.00104332 0.0028696 0.00147528 0.000683934 0.00037951 0.00016998 9.52386e-05 0.00392974 0.00135876 0.000838732 0.000378438 0.00046964 0.000644489 0.00172857 0.00539496 0.00581896 0.00604088 0.00556941 0.00525985 0.00203053 0.000655912 0.000167252 0.000314088 0.00044683 0.00104266 0.00175972 0.00228057 0.0024518 0.00187069 0.00116472 0.000705558 0.000368676 0.000353592 0.000476137 0.00128435 0.00598782 0.0073896 0.00861568 0.00775182 0.00849863 0.0100588 0.00946281 0.00831079 0.0080585 0.00767363 0.00776205 0.00892065 0.00920598 0.00760892 0.005221 0.0038146 0.00503014 0.00675768 0.00826334 0.00779845 0.00807228 0.00590784 0.00358344 0.00286062 0.00308128 0.00340622 0.00339251 0.00338203 0.0031274 0.00303586 0.00321661 0.00445059 0.00682962 0.00901601 0.00959352 0.008426 0.00301972 0.000877993 0.00054013 0.000322663 0.000322071 0.000960235 0.00198648 0.00211391 0.00198045 0.00267314 0.0025911 0.00200191 0.00201645 0.00228706 0.00218859 0.00203965 0.00202934 0.00220775 0.00265916 0.00318811 0.00350756 0.00354582 0.00354963 0.00354932 0.00356214 0.00356635 0.00377065 0.00380131 0.00443724 0.00415509 0.004037 0.00370033 0.00389739 0.00465717 0.00590647 0.00371722 0.0015492 0.00138429 0.00208755 0.00301749 0.00208273 0.000313979 0.000349307 0.00106361 0.00292661 0.00334387 0.00280466 0.00272724 0.00289187 0.00296952 0.00296694 0.00295099 0.00288128 0.00282077 0.00270781 0.00260519 0.00253441 0.00249367 0.00247171 0.00246662 0.002497 0.00253161 0.00268739 0.00296696 0.00331205 0.00349551 0.00354305 0.00350922 0.00300106 0.00298646 0.00172938 0.000401975 0.000238691 0.000334684 0.000501437 0.000722016 0.00105824 0.00128355 0.0016942 0.00176016 0.00213649 0.00210865 0.00225942 0.00219412 0.00213039 0.00199375 0.00185006 0.00153115 0.00137554 0.00129727 0.00120047 0.00163548 0.00233841 0.00348021 0.00320883 0.00240127 0.00187758 0.00168087 0.0019385 0.0025668 0.00332615 0.000658849 0.00046705 0.000439062 0.000400324 0.000334325 0.000289816 0.000259458 0.000227973 0.000200227 0.000184318 0.000190657 0.000242856 0.000348568 0.000485416 0.000579573 0.000500719 0.000459359 0.000499733 0.000512002 0.000500333 0.000646388 0.000712155 0.000707001 0.000937062 0.00126458 0.00312928 0.0024617 0.00143353 0.00165207 4.30449e-05 3.09814e-05 0.000138471 0.00119877 0.00304891 0.00236911 0.000933856 0.000518429 0.000389187 0.000299044 0.000253229 0.000222927 0.00020866 0.000211505 0.000212939 0.000198416 0.000180727 0.000193429 0.000317703 0.00106735 0.00345036 0.00208028 0.00153167 0.00131383 0.00104478 0.000770519 0.000621173 0.000709944 0.00103663 0.000915068 0.0021774 0.00151031 0.0016035 0.00200377 0.0024117 0.00301879 0.00323586 0.00187534 0.00284703 0.00227696 0.00119624 0.0010045 0.00075874 0.00133903 0.00136989 0.000124811 6.51611e-05 6.34607e-05 6.34542e-05 6.50913e-05 6.673e-05 6.63733e-05 7.07016e-05 8.48923e-05 0.000120392 0.000172085 0.000214476 0.000316311 0.000659793 0.00129585 0.00213352 0.00150421 0.00118136 0.00108295 0.00169524 0.00333137 0.000759562 0.000172776 8.21566e-05 5.94044e-05 7.12361e-05 9.05844e-05 0.000110502 0.000136 0.00014438 0.000148082 0.000146504 0.000130859 0.000118263 0.000115497 0.000112237 0.00010332 8.3517e-05 6.3442e-05 4.85542e-05 3.42603e-05 2.73914e-05 2.81657e-05 3.70291e-05 0.000118978 0.000281786 0.000623666 0.00264958 0.00178315 0.00109138 0.00205024 0.00293789 0.000902348 0.000373725 0.000382619 0.000890819 0.00322038 0.00118506 0.000475398 0.000361711 0.000313744 0.000296354 0.000389217 0.000453947 0.000579161 0.000712137 0.000710711 0.000730487 0.00059211 0.000599388 0.000423229 0.000269677 0.000181563 0.000148592 0.000126394 0.000887987 0.00113309 0.00207699 0.0037196 0.00374818 0.00341171 0.00413878 0.00172313 0.000736453 0.000838202 0.00178926 0.00306341 0.00259959 0.00290936 0.00194361 0.00141591 0.00101648 0.000752812 0.000653625 0.00054234 0.000461843 0.000230207 0.000140466 8.2475e-05 5.7375e-05 3.86512e-05 3.57737e-05 0.000211107 0.00216474 0.00014521 0.000400027 0.00158364 0.00295596 0.0022607 0.00100735 0.000463081 0.000346195 0.000756281 0.00299639 0.00360284 0.00199281 0.00175283 0.00169109 0.00161002 0.00168877 0.00219323 0.000876383 0.000469377 0.000206926 9.8852e-05 3.89923e-05 3.1081e-05 3.86263e-05 8.47505e-05 0.000303372 0.00179003 0.00268818 0.00104792 0.000354024 0.000100112 0.00331051 0.00145785 0.000419847 0.000468055 0.000343803 0.000765318 0.00245906 0.005168 0.00584396 0.00478165 0.00623904 0.00491787 0.00630092 0.00318246 0.000462323 0.00038298 0.000264728 0.000397225 0.000645537 0.000821191 0.000932837 0.000858844 0.000588399 0.000371003 0.00026688 0.000197873 0.000425448 0.00175169 0.00449203 0.0098948 0.00789164 0.0097999 0.0113149 0.0096519 0.0105029 0.00736832 0.0054938 0.00500984 0.0058386 0.00727623 0.00669024 0.00499649 0.00477977 0.00506914 0.00554804 0.00621583 0.00721091 0.0084314 0.00845432 0.00837496 0.00753664 0.00498799 0.00290245 0.00225091 0.00223273 0.00252224 0.00265449 0.00268077 0.00299397 0.00365544 0.00535433 0.00772448 0.00894562 0.0089382 0.00614863 0.00223274 0.00123448 0.00112077 0.000722737 0.000600748 0.00123189 0.00203534 0.00210342 0.00193914 0.00196926 0.00212708 0.00188603 0.00200567 0.00223257 0.00241201 0.00247154 0.00217561 0.00194523 0.0018742 0.00192574 0.00202779 0.00222122 0.00248114 0.00276049 0.00302225 0.00319499 0.00331418 0.00341392 0.00348 0.00350587 0.00351757 0.00352365 0.00387203 0.00449978 0.00454915 0.00482991 0.00561344 0.00442802 0.00196001 0.00133637 0.00186465 0.00288151 0.00332101 0.00346517 0.00179052 0.000664286 0.000269684 0.000473118 0.000963913 0.00236776 0.00346797 0.00282093 0.00260297 0.00262318 0.00268164 0.00266352 0.00262208 0.00259472 0.00257247 0.00259059 0.00258942 0.00261127 0.00261077 0.00263227 0.00266253 0.00273088 0.00284368 0.00304706 0.00329733 0.00347497 0.00350165 0.00344104 0.0030214 0.00293537 0.00340524 0.00130604 0.000438319 0.000401122 0.000214034 0.000218418 0.000334752 0.000482143 0.00067747 0.000843992 0.00106956 0.00124396 0.00132386 0.00137742 0.00138194 0.00127645 0.00116172 0.00102072 0.000934631 0.000828285 0.000826729 0.000823781 0.000812533 0.000758518 0.000686547 0.000709655 0.000818111 0.00129553 0.00273357 0.00343565 0.00254572 0.00231805 0.00254773 0.00297698 0.00351767 0.002147 0.000493707 0.000429982 0.000458318 0.000447401 0.000426123 0.000387747 0.000320047 0.000272 0.000227331 0.000202883 0.000210983 0.000261786 0.000350132 0.000461916 0.000572102 0.000499174 0.000452963 0.000613799 0.000851896 0.00119645 0.00132863 0.00145091 0.00134266 0.0015477 0.00282964 0.00321037 0.00183648 0.00129309 0.0014843 0.00327377 0.000146397 4.09416e-05 5.65684e-05 0.00037379 0.00238625 0.00304785 0.00160067 0.000756523 0.000461552 0.00032891 0.000249242 0.000196834 0.000187321 0.000188948 0.00021304 0.000213167 0.000193585 0.000173721 0.000176781 0.000267013 0.0007528 0.00277693 0.00330365 0.0027219 0.00228423 0.00159065 0.00122745 0.00136368 0.00182481 0.00210081 0.00200942 0.00185935 0.001663 0.00148194 0.00165812 0.00230073 0.00307183 0.00345721 0.0035008 0.00244035 0.00196189 0.0035139 0.00201069 0.00141803 0.00138639 0.00130181 0.00196805 0.00215653 0.000208233 7.67629e-05 5.9807e-05 6.08035e-05 6.81745e-05 6.69189e-05 6.58425e-05 6.4353e-05 7.78676e-05 0.000137209 0.000271273 0.000468013 0.000743786 0.00220872 0.00349938 0.00295639 0.00188159 0.00159361 0.00132779 0.00101443 0.0012486 0.00216775 0.00158459 0.000327015 0.000106215 7.54756e-05 6.13596e-05 7.49316e-05 0.000108586 0.000117854 0.000164851 0.000165351 0.00017479 0.000160027 0.000137644 0.000114818 0.000109535 0.000110266 0.000105242 8.23256e-05 5.87416e-05 4.71359e-05 3.65869e-05 2.41935e-05 2.10088e-05 2.37832e-05 5.59939e-05 0.000680902 0.00251421 0.00061707 0.000417201 0.00152594 0.00246854 0.000525368 0.000406042 0.000791645 0.00350015 0.00100809 0.000454431 0.000639426 0.00240417 0.00122211 0.000434795 0.000333833 0.000339953 0.000371894 0.000491262 0.0005676 0.000724961 0.000812435 0.000907555 0.00126458 0.00143411 0.00115279 0.000773441 0.000385564 0.000180753 0.000105573 7.88593e-05 0.000111863 0.00018758 0.000604097 0.00317712 0.00167854 0.00262192 0.00423947 0.00371401 0.0034597 0.00157176 0.000902121 0.000852239 0.00174782 0.0036814 0.00350864 0.00292132 0.0030659 0.0021781 0.00126559 0.00077159 0.000628414 0.000584392 0.000510988 0.000297439 0.000172015 7.99857e-05 6.08705e-05 5.04587e-05 3.9435e-05 4.48415e-05 0.000532984 0.000256451 0.000321559 0.00121362 0.000770955 0.00312319 0.0015456 0.000943123 0.000717949 0.000557513 0.000538793 0.00125128 0.00341517 0.0036377 0.00241431 0.00155304 0.0014371 0.00144269 0.00151688 0.00116527 0.000797163 0.00032215 0.000166258 0.000109396 8.16455e-05 4.92148e-05 3.85828e-05 3.4861e-05 5.82774e-05 0.000151259 0.000670018 0.00373846 0.00107003 0.000169994 0.000163498 0.00022004 0.00301063 0.00150726 0.000805054 0.000505242 0.000472525 0.00041039 0.000905634 0.00162297 0.0022572 0.00268953 0.0045289 0.00496538 0.00450485 0.00324032 0.000739314 0.000468151 0.000290932 0.000276992 0.000330391 0.000422345 0.000480948 0.000458948 0.000390057 0.000241585 0.000224596 0.000116752 0.000206513 0.000489923 0.00210304 0.00134468 0.00193 0.000735039 0.00672979 0.0116515 0.00906306 0.00783063 0.00957368 0.0068274 0.00456045 0.00445444 0.00529413 0.00669082 0.0069338 0.00571085 0.00513121 0.00535193 0.00593356 0.00647434 0.00724797 0.00798624 0.00868065 0.00845978 0.00797929 0.00616217 0.00420861 0.00316128 0.00275546 0.00282117 0.00321455 0.00382359 0.00490262 0.00662559 0.0078015 0.00795991 0.00646432 0.00337818 0.00172153 0.0014599 0.00157561 0.00123523 0.000921397 0.00115246 0.0019156 0.00221502 0.00210001 0.00202633 0.00201178 0.00208135 0.00243165 0.00263965 0.00289271 0.00274764 0.00223181 0.00195059 0.00182857 0.00184984 0.001922 0.00219806 0.00268432 0.00320628 0.00349487 0.00351923 0.00351623 0.00353124 0.00354613 0.00357085 0.00357724 0.00355014 0.00352024 0.00343372 0.00362225 0.0043852 0.00482422 0.00362265 0.00190921 0.00171618 0.00246582 0.00340617 0.00347292 0.00324859 0.00144067 0.000527282 0.000276655 0.000258817 0.000420692 0.000638149 0.00119141 0.00285634 0.00335193 0.00268459 0.00247548 0.00244731 0.00241879 0.00238313 0.00241385 0.00243343 0.00248207 0.00257183 0.00267982 0.00279093 0.00289988 0.0029802 0.00307335 0.00317763 0.00328762 0.00338179 0.00336257 0.00317881 0.00284466 0.00275374 0.00343742 0.00128894 0.000393652 0.000210279 0.000240336 0.000205407 0.000256073 0.000397518 0.000597054 0.000836212 0.00121307 0.00148108 0.00171096 0.00195038 0.00209132 0.00195274 0.00177255 0.00155126 0.00148117 0.00149133 0.00163745 0.00194496 0.00238762 0.00242826 0.00301389 0.00227178 0.00209622 0.00125951 0.000977769 0.00109164 0.0016926 0.00340203 0.00310098 0.00282497 0.00330857 0.0029499 0.00105934 0.000438162 0.000441358 0.000484029 0.000504454 0.000539619 0.000552278 0.000535478 0.000464936 0.000366115 0.000294975 0.000282529 0.000311993 0.000378773 0.000444288 0.000536032 0.000565195 0.000480416 0.000625843 0.00117051 0.00173184 0.00218922 0.00250696 0.0026111 0.00292049 0.00345953 0.0024994 0.00140826 0.00108468 0.00101398 0.00235197 8.4013e-05 5.65517e-05 0.00014585 0.000906802 0.00309723 0.00286744 0.00134544 0.000679341 0.000415554 0.000276836 0.000198084 0.00016867 0.000171846 0.000203852 0.000244101 0.000241099 0.000203895 0.000166844 0.000163834 0.000221186 0.000417771 0.000838266 0.00133665 0.00168728 0.00287543 0.00337698 0.00268802 0.00230727 0.00228862 0.00195005 0.00168573 0.00149863 0.00148377 0.00160146 0.00219107 0.00302731 0.0035613 0.00340436 0.00280832 0.00234318 0.00294404 0.00317367 0.00197808 0.00183518 0.00211921 0.00221277 0.00299678 0.0022952 0.000354346 0.000103481 6.17341e-05 6.26483e-05 7.97749e-05 6.33899e-05 6.49165e-05 6.43821e-05 8.05991e-05 0.000114454 0.000358584 0.000834854 0.00148526 0.00279816 0.00341832 0.00290763 0.00207083 0.00159842 0.00117508 0.00116237 0.00134403 0.00336998 0.000738303 0.000191244 9.04202e-05 7.29737e-05 6.46075e-05 8.0187e-05 0.000104389 0.000136504 0.000164136 0.00018374 0.000179219 0.000176989 0.000149075 0.000116269 0.000100714 0.00010035 0.000100458 7.09848e-05 4.13684e-05 3.16716e-05 3.08884e-05 2.60706e-05 1.85994e-05 1.86415e-05 2.2091e-05 4.52313e-05 8.81487e-05 0.000762323 0.00100383 0.0006795 0.0012277 0.00343037 0.000869113 0.000391085 0.000551573 0.00318654 0.00148829 0.000803847 0.00159747 0.00255351 0.00048675 0.000322099 0.000359754 0.000413816 0.000541976 0.000725717 0.000951011 0.00125806 0.00154342 0.00217356 0.00242705 0.00263699 0.00173768 0.000675144 0.000243049 8.65002e-05 4.45966e-05 4.04375e-05 4.49571e-05 5.90753e-05 0.000165738 0.00113315 0.00381433 0.00375096 0.00195975 0.00178422 0.00137847 0.000923879 0.00100158 0.00104011 0.00324333 0.00348493 0.00348027 0.0034186 0.00211485 0.00122365 0.000706501 0.000589747 0.000556715 0.000556485 0.000295394 0.000185731 8.06281e-05 5.98034e-05 5.62611e-05 4.21942e-05 4.20523e-05 7.73541e-05 0.00246267 0.000481699 0.000995401 0.0028019 0.00108839 0.000676815 0.000471702 0.000530691 0.00057056 0.000662796 0.00111102 0.00173433 0.00170001 0.00102216 0.000869914 0.000983148 0.00159912 0.0014939 0.000917921 0.000414619 0.000239537 0.000159769 9.8146e-05 5.35361e-05 4.64667e-05 3.9367e-05 4.28579e-05 4.097e-05 5.24535e-05 9.24773e-05 0.000313665 0.00145787 0.00140929 0.000349451 0.000365252 0.000972214 0.00290368 0.00452457 0.00479318 0.00316949 0.00142503 0.001568 0.00145233 0.00245085 0.00368788 0.00354161 0.00386139 0.00314305 0.00137592 0.000548169 0.000477952 0.000271709 0.000289269 0.000267091 0.0002759 0.000267242 0.000305087 0.000285063 0.000224517 0.000175628 0.000106131 0.000150775 0.000312955 0.000625208 0.00149563 0.000613694 0.000320657 0.00555403 0.0106316 0.00798497 0.00726757 0.00896297 0.00640675 0.00363484 0.00375623 0.00479591 0.00628214 0.00700046 0.00650587 0.00528849 0.00511142 0.00529459 0.00532913 0.00534966 0.0059063 0.00728716 0.00817515 0.00821493 0.00798639 0.00715063 0.00601386 0.00557119 0.00555116 0.00594955 0.0065149 0.00685357 0.00653662 0.00550254 0.00330695 0.00178309 0.00164851 0.00167461 0.00162568 0.00142434 0.00122581 0.00139868 0.00194615 0.00233231 0.00226738 0.0023083 0.00253272 0.0028239 0.00304239 0.00338542 0.00341239 0.00328163 0.00287011 0.00239935 0.00213537 0.00220149 0.00243008 0.00295352 0.00345584 0.00355186 0.00354803 0.00349688 0.00323711 0.00318391 0.00332137 0.00353651 0.00359148 0.00350694 0.00349431 0.00356486 0.00348859 0.00325595 0.00323895 0.00259701 0.00184795 0.00182543 0.0028588 0.00324143 0.00237387 0.00186216 0.00110599 0.000467033 0.000254261 0.000197033 0.000254892 0.000358531 0.000450267 0.000600248 0.000954718 0.00218138 0.00354468 0.00319171 0.00290643 0.00280111 0.0027444 0.00269041 0.0026468 0.00256587 0.00249614 0.0025487 0.00264789 0.00276093 0.00289232 0.0029487 0.00299528 0.00300501 0.00289584 0.00280569 0.00275128 0.0029996 0.00348297 0.00148809 0.000429459 0.000232695 0.000205238 0.000257439 0.00025593 0.00025472 0.0003664 0.000563339 0.000869524 0.00135423 0.00197933 0.00241385 0.00264086 0.00282957 0.00290008 0.00279203 0.00276255 0.00287318 0.00288273 0.00280485 0.00264439 0.0027644 0.00268309 0.00280303 0.00313518 0.0032035 0.00312335 0.00163997 0.00116184 0.0011819 0.00177421 0.00358093 0.00323899 0.00355144 0.00153512 0.000661332 0.000397418 0.000401025 0.00037612 0.000366634 0.000372524 0.000441721 0.000562701 0.000664474 0.00060991 0.00048394 0.000436688 0.000439421 0.000452247 0.000446755 0.000493169 0.0006052 0.000566939 0.000534407 0.000775479 0.00141209 0.00219968 0.0027844 0.00309322 0.00340517 0.00308715 0.00194408 0.00106092 0.000863021 0.001399 0.000263677 6.91529e-05 0.000106944 0.000421019 0.00229658 0.00327059 0.00248804 0.00118229 0.000601892 0.000352486 0.000230719 0.000171611 0.000155063 0.000172047 0.000237534 0.000298111 0.000283342 0.000218025 0.000168329 0.000150617 0.000163106 0.000225449 0.000344245 0.000430531 0.000551968 0.000918618 0.0021237 0.00348684 0.00286664 0.00238187 0.00201434 0.00170155 0.00163547 0.00164036 0.00187317 0.00236722 0.0030784 0.00358018 0.00357491 0.00321619 0.00331234 0.00355116 0.00272978 0.00223857 0.00258859 0.00320811 0.00351848 0.00324515 0.00149975 0.000455987 0.000147555 7.6141e-05 5.47489e-05 8.13141e-05 6.09973e-05 6.18154e-05 6.14737e-05 7.61855e-05 0.00011667 0.000314805 0.000936532 0.00135515 0.00140006 0.00206735 0.00341983 0.0028408 0.00173178 0.00143407 0.00132611 0.00192663 0.00298379 0.000455835 0.000157463 8.19844e-05 6.78456e-05 6.89563e-05 7.8086e-05 0.000102098 0.000119021 0.000160652 0.000168428 0.000180064 0.000169828 0.000152516 0.000115997 9.62352e-05 9.37777e-05 9.52866e-05 6.42246e-05 2.98114e-05 1.79844e-05 1.86614e-05 2.06956e-05 1.82813e-05 1.31082e-05 1.46281e-05 2.16595e-05 2.69354e-05 3.94627e-05 0.000299708 0.00355932 0.00144665 0.000996641 0.00201553 0.0031714 0.000675417 0.000507224 0.00157782 0.00285223 0.00223415 0.00340111 0.000941742 0.000411422 0.000373648 0.000435637 0.00055597 0.000734025 0.00106527 0.00133349 0.00166116 0.00225299 0.00310678 0.00306111 0.00252517 0.000917894 0.000331614 8.67367e-05 3.03756e-05 1.65163e-05 1.74669e-05 2.56629e-05 4.57021e-05 0.000147474 0.000683406 0.00259087 0.00172978 0.00110864 0.00103038 0.00079659 0.000800105 0.00083366 0.00131129 0.00247071 0.00200981 0.00145029 0.00103715 0.000789619 0.000556652 0.000516874 0.000559934 0.000488928 0.000277291 0.000134985 7.6653e-05 5.64036e-05 4.06998e-05 5.7087e-05 4.59719e-05 3.15428e-05 0.000236714 0.00378299 0.000760227 0.00279911 0.00145263 0.000677172 0.00052343 0.000441188 0.00039454 0.000473687 0.000547282 0.000498172 0.000588977 0.000503379 0.000903194 0.00146047 0.00171609 0.00148551 0.000555022 0.000273965 0.000137147 8.66135e-05 6.71346e-05 5.95126e-05 4.42289e-05 4.36697e-05 3.73961e-05 3.74653e-05 3.92166e-05 4.08371e-05 6.24544e-05 0.000120835 0.000441847 0.00243814 0.00219959 0.0014081 0.00151526 0.00215569 0.00241024 0.0037461 0.00479154 0.00460454 0.00433181 0.00361903 0.0029924 0.002608 0.00119501 0.000925867 0.000367805 0.00034747 0.000245059 0.000321044 0.000309314 0.0002756 0.000230897 0.000257565 0.000244085 0.000260157 0.000193559 0.000180232 0.00012165 0.000129564 0.000189289 0.000261904 0.000307508 0.000163949 7.00056e-05 0.00461627 0.00958976 0.00820601 0.00788839 0.00874337 0.00616471 0.00284761 0.00278105 0.00396202 0.00584561 0.006871 0.00658477 0.00553743 0.00494766 0.00515143 0.00485108 0.00392401 0.00327552 0.00404056 0.00526251 0.00630293 0.00717609 0.00750087 0.00744884 0.00710802 0.00697092 0.00648286 0.00570516 0.00449388 0.00292206 0.00186531 0.00180934 0.00179976 0.0017407 0.00163161 0.00152095 0.00152096 0.00179375 0.00225442 0.00249218 0.00249784 0.00251655 0.0027872 0.00311704 0.00344095 0.00349952 0.00332259 0.0032306 0.00337362 0.00346464 0.00333219 0.00324554 0.00342469 0.00356784 0.00352652 0.00343398 0.00358976 0.00351465 0.00324804 0.0030628 0.00300505 0.0031979 0.00351326 0.00359201 0.00346527 0.00342707 0.00354355 0.00335722 0.00283283 0.00227213 0.00190461 0.0020497 0.00299653 0.00310653 0.00158268 0.00110599 0.000732565 0.000427503 0.00023981 0.000179744 0.000185671 0.000277952 0.000405743 0.000473918 0.000464501 0.000473651 0.000614795 0.00102526 0.00215096 0.00313566 0.00335913 0.00343698 0.00350241 0.00345729 0.0033996 0.00320684 0.0028902 0.0029018 0.00269358 0.00275494 0.00266177 0.00270419 0.00272233 0.00287364 0.00309753 0.00350016 0.00301795 0.00103696 0.000427436 0.000209359 0.000249407 0.000277856 0.000341228 0.000336989 0.000339448 0.000295852 0.000376511 0.000609696 0.00110058 0.00195515 0.00260668 0.00302129 0.00348416 0.00354486 0.0035645 0.00355802 0.00344843 0.00314171 0.00238792 0.00170376 0.00162682 0.00182458 0.00249697 0.00288178 0.00345135 0.00340784 0.00285518 0.0014716 0.00118696 0.00150144 0.00319503 0.00352404 0.00298006 0.000960519 0.000470414 0.000354836 0.000324188 0.000308891 0.000320919 0.000308422 0.00034463 0.000359066 0.0005631 0.000716434 0.00070908 0.000647601 0.000597814 0.000590987 0.000519073 0.000483708 0.000560395 0.000668504 0.000651091 0.000628193 0.00077798 0.00119025 0.00179429 0.0027411 0.00351518 0.00278696 0.00162077 0.00122707 0.00233911 0.00088681 0.000106608 0.000127253 0.000391625 0.00145611 0.00321939 0.00317999 0.0022236 0.00108223 0.000572894 0.000321984 0.000210666 0.000159929 0.000150257 0.000184685 0.000308088 0.000408091 0.000329807 0.000224766 0.000165955 0.000143156 0.000138451 0.000153217 0.000177881 0.000233444 0.000257261 0.000444203 0.000933879 0.00255547 0.00352883 0.00308857 0.00247629 0.00216591 0.00207016 0.00215171 0.00238183 0.00259409 0.00282717 0.0031068 0.00337051 0.00350725 0.00340659 0.00309322 0.00278709 0.00295365 0.0035486 0.00269501 0.00153893 0.00111693 0.000695113 0.00038904 0.000173323 9.85984e-05 5.96698e-05 6.31195e-05 5.62805e-05 5.71916e-05 6.17114e-05 8.04698e-05 9.90389e-05 0.000219468 0.000445076 0.000553569 0.00045243 0.000527816 0.00105417 0.00292587 0.00292304 0.00201425 0.00195148 0.00315478 0.0014935 0.000369637 0.00015815 8.76728e-05 6.90196e-05 6.75349e-05 7.48369e-05 8.66289e-05 0.000104514 0.000108597 0.000135588 0.000140404 0.000144709 0.000120162 0.000104251 8.95147e-05 8.90035e-05 9.13586e-05 5.41851e-05 1.85734e-05 1.02667e-05 1.09436e-05 1.29376e-05 1.34186e-05 1.2082e-05 1.11313e-05 1.26293e-05 1.60388e-05 2.00145e-05 3.38299e-05 0.000113197 0.000763071 0.00259478 0.0033338 0.00325647 0.0034595 0.00134542 0.00070324 0.000844231 0.00224941 0.00291731 0.00149051 0.000671981 0.000467657 0.000473239 0.000585799 0.000892989 0.00113572 0.00190059 0.00269014 0.0035859 0.00390582 0.00336673 0.00196659 0.000898368 0.000271234 8.2972e-05 1.93667e-05 9.43412e-06 8.12268e-06 1.04975e-05 1.75416e-05 3.73947e-05 0.000140614 0.000712142 0.00172246 0.00139079 0.000916425 0.000722386 0.000650891 0.000697787 0.0006143 0.000758787 0.000479282 0.000524168 0.000470207 0.000530277 0.000489029 0.00055093 0.000527976 0.000436151 0.000192403 8.6292e-05 6.23444e-05 4.22909e-05 4.86736e-05 5.55407e-05 5.63348e-05 5.92432e-05 5.97092e-05 0.000210549 0.0013738 0.00402102 0.00391594 0.00476017 0.00229428 0.00120776 0.000836123 0.000708114 0.000768796 0.000849435 0.00134146 0.00252636 0.00276307 0.0016991 0.000820446 0.000547509 0.000207355 0.000115816 7.74653e-05 7.21197e-05 6.58969e-05 4.34327e-05 4.14593e-05 3.6257e-05 3.72263e-05 3.4043e-05 3.65981e-05 3.77212e-05 3.64992e-05 4.07507e-05 4.58875e-05 8.40464e-05 0.000158953 0.000424073 0.000891902 0.00343483 0.00431082 0.00340517 0.00296222 0.00158961 0.00135486 0.000895782 0.000763452 0.000592244 0.000303381 0.000110566 0.000130063 0.00017059 0.00016385 0.000304158 0.000355959 0.000315407 0.000257953 0.000213289 0.000250109 0.000203606 0.000217636 0.000171735 0.000154075 0.00012677 0.00012412 9.59393e-05 0.000113673 9.09863e-05 6.93524e-05 0.00385102 0.00912492 0.0101055 0.0101912 0.00952248 0.00658886 0.00255608 0.00211889 0.0027227 0.00460419 0.00599622 0.00572205 0.00462295 0.0041869 0.00483206 0.00515736 0.00360189 0.00207291 0.00182262 0.0023412 0.00298502 0.00374222 0.00456851 0.004908 0.00489938 0.00447918 0.00386736 0.00287157 0.00195687 0.00205321 0.00216013 0.00214355 0.00204862 0.00194862 0.00191297 0.00200727 0.00226815 0.00256249 0.00274189 0.00276144 0.00270831 0.00285395 0.00309638 0.00337023 0.00350903 0.0033153 0.00280885 0.00278444 0.00251039 0.00237399 0.00268347 0.00285938 0.0028336 0.00276614 0.0028243 0.00311829 0.00350303 0.0035365 0.00335081 0.00305975 0.00281976 0.00276518 0.00290506 0.00316732 0.00336294 0.00332251 0.00310216 0.00258973 0.00220939 0.00210106 0.00238174 0.00326542 0.00289141 0.0014465 0.000962246 0.000692754 0.000462024 0.000292415 0.000206545 0.000175625 0.000202398 0.000290168 0.000497657 0.000804778 0.000752913 0.000490186 0.000376708 0.000361312 0.000507686 0.00086641 0.00124033 0.00143111 0.0018819 0.00234671 0.00294244 0.00346879 0.00342808 0.00338788 0.00315303 0.00317409 0.00318293 0.00337167 0.00353802 0.0034008 0.00243195 0.00132024 0.000699761 0.000377243 0.00022443 0.000187171 0.000256382 0.000400402 0.00048454 0.00049366 0.000415739 0.000376784 0.000328513 0.000344267 0.000613637 0.00119716 0.00250332 0.00333891 0.00349313 0.00347673 0.00336785 0.0034472 0.00351508 0.00318463 0.00218244 0.00146294 0.00117146 0.00132057 0.00213307 0.00315114 0.00328943 0.00358974 0.00312527 0.00223358 0.0018803 0.00246347 0.00333793 0.00342868 0.00165276 0.000649458 0.000365852 0.000367684 0.000314898 0.000305547 0.000289525 0.000296618 0.000329124 0.000352427 0.000415297 0.000695714 0.000812164 0.000765135 0.000694631 0.000717543 0.000752949 0.000600726 0.000501634 0.000606981 0.000732297 0.000803342 0.000841906 0.00102853 0.00137959 0.00231383 0.00345168 0.00297915 0.00275309 0.00320605 0.000644318 0.00025448 0.000228875 0.00047364 0.00128618 0.0030868 0.00337081 0.00317862 0.00223133 0.0011545 0.000570129 0.000327321 0.000213299 0.000159412 0.000157625 0.000239443 0.000424079 0.000505675 0.000357921 0.00022277 0.00016638 0.000144426 0.000119766 0.000114577 0.000129299 0.000141996 0.000162553 0.000205206 0.00038676 0.00076989 0.00150596 0.0032224 0.00346697 0.00308198 0.00291214 0.00292833 0.00311385 0.00330391 0.00338651 0.00339131 0.00333252 0.00327974 0.00327626 0.00332861 0.00353682 0.00311483 0.00162932 0.000859218 0.000564373 0.000408937 0.000320925 0.000238452 0.000154214 9.7198e-05 6.53498e-05 5.63137e-05 5.31689e-05 5.33961e-05 5.8286e-05 8.39289e-05 9.65499e-05 0.000141904 0.000168926 0.000140499 0.000115261 0.000146971 0.000240958 0.000485145 0.001305 0.00296057 0.00338928 0.00243862 0.000972546 0.000347162 0.000178443 0.000108554 8.34895e-05 7.34277e-05 7.40377e-05 7.82256e-05 8.79609e-05 9.30076e-05 9.92556e-05 0.000104103 0.00010286 9.53789e-05 8.5713e-05 8.13413e-05 8.54942e-05 8.67893e-05 3.90524e-05 1.08935e-05 6.43845e-06 6.92832e-06 9.26763e-06 1.01629e-05 9.70788e-06 9.31743e-06 9.43851e-06 1.06319e-05 1.19007e-05 1.45844e-05 2.00138e-05 3.92488e-05 7.43837e-05 0.000181223 0.000459385 0.00102946 0.00127738 0.00112554 0.000807948 0.000749374 0.000955582 0.0009732 0.000784471 0.000590767 0.000556203 0.000663894 0.000722209 0.0011957 0.0023019 0.00363807 0.00357798 0.00348914 0.00289827 0.00138872 0.000509921 0.000151432 4.03001e-05 1.22884e-05 6.81366e-06 5.12605e-06 6.6207e-06 9.64793e-06 1.73158e-05 3.65945e-05 0.000113243 0.000462484 0.00114776 0.00108412 0.0010152 0.000760034 0.000692518 0.000617067 0.000421118 0.0004761 0.000409021 0.00041786 0.000476927 0.000509115 0.00053908 0.000457503 0.000258281 0.000108315 3.90456e-05 3.01315e-05 3.9246e-05 4.79689e-05 5.84297e-05 7.51541e-05 6.69206e-05 5.37747e-05 5.76644e-05 9.06114e-05 0.000342095 0.00146656 0.00421922 0.00459813 0.00449957 0.0040733 0.00368874 0.00315063 0.00328126 0.00208074 0.00123578 0.000635407 0.000269643 0.000112977 7.18398e-05 7.01795e-05 7.47891e-05 6.06973e-05 6.19377e-05 5.17083e-05 4.78539e-05 3.13416e-05 3.00473e-05 2.97074e-05 2.859e-05 2.8341e-05 3.12112e-05 3.36665e-05 2.85304e-05 2.72698e-05 2.43459e-05 2.4075e-05 1.93313e-05 3.1279e-05 5.36478e-05 0.00010015 0.000111609 0.000204072 0.000233035 0.000235251 0.000174714 0.000134721 0.000131184 8.58114e-05 0.000114347 9.11756e-05 0.000107832 0.000159792 0.000292784 0.000377986 0.000361582 0.000292046 0.000291865 0.000244593 0.000267816 0.000215786 0.000219343 0.000152626 0.000142347 6.66238e-05 7.57015e-05 8.60433e-05 7.68575e-05 5.06605e-05 0.0029477 0.00902966 0.010813 0.0110549 0.0103165 0.0087182 0.00382418 0.00207257 0.00176068 0.00217411 0.00302008 0.00311955 0.0024431 0.00226075 0.00356729 0.00519592 0.00439945 0.00198734 0.00133313 0.00147189 0.00199425 0.00253594 0.00307734 0.00353924 0.00369377 0.00352148 0.00306063 0.00250897 0.00274411 0.00298097 0.00305342 0.00297016 0.00269823 0.00248116 0.00247263 0.00260695 0.00281517 0.00297651 0.00298315 0.00302197 0.00297076 0.00305818 0.00310756 0.00329248 0.00347918 0.00341981 0.0028403 0.00244397 0.00193176 0.0015616 0.0014836 0.00153044 0.00167446 0.00195265 0.00225028 0.00267233 0.00314525 0.00356907 0.00351775 0.00328063 0.00297538 0.00270108 0.00253428 0.00245977 0.00248578 0.00250502 0.00242572 0.00239311 0.00252939 0.00306417 0.00350436 0.00262827 0.00145755 0.00108016 0.000813264 0.000660568 0.000488455 0.000385121 0.000295158 0.000289509 0.000319208 0.000375644 0.000576776 0.00125624 0.00230586 0.00158426 0.00067791 0.000299685 0.000263708 0.000372502 0.000611158 0.000831164 0.0011637 0.00141687 0.00184173 0.0022976 0.00261482 0.00284219 0.00295398 0.00289912 0.00245929 0.00185975 0.00133441 0.000918489 0.000663424 0.000445826 0.000311373 0.000248725 0.000190716 0.000188777 0.000385021 0.000407079 0.000562403 0.000541258 0.000499446 0.000496581 0.000441726 0.000345186 0.000297933 0.000512143 0.00112479 0.00238985 0.00355364 0.00334261 0.00314627 0.00308846 0.00326383 0.0035065 0.00288978 0.0016014 0.00107976 0.000883234 0.00119655 0.00202622 0.00271515 0.00279847 0.00306076 0.00316228 0.00292397 0.00310464 0.00291063 0.00204266 0.000863977 0.000449095 0.000411804 0.000388979 0.000355496 0.000321511 0.00031718 0.000345722 0.000370891 0.00039312 0.000527628 0.000798604 0.00106495 0.000949064 0.000734262 0.000684907 0.000816121 0.000890319 0.00064905 0.000526149 0.00056926 0.00068814 0.000808496 0.00101021 0.00122928 0.00150565 0.00196829 0.00225684 0.00123727 0.000659511 0.000417104 0.000476627 0.000938682 0.00208016 0.00290864 0.0032654 0.00326938 0.00297446 0.00211178 0.00114262 0.000616287 0.000347187 0.000225868 0.000178367 0.000197564 0.000321756 0.0005922 0.000638241 0.000308412 0.000207158 0.000150353 0.000112395 0.000118109 0.000100565 9.84929e-05 9.83602e-05 0.000107051 0.000113053 0.000148222 0.000234717 0.000421958 0.000719354 0.00140183 0.00262067 0.00332718 0.00340915 0.00319338 0.00277247 0.00235234 0.00207545 0.00204017 0.00207304 0.00188602 0.00143514 0.00109787 0.000728068 0.000439941 0.000320173 0.000242361 0.000184163 0.000157766 0.000131023 0.000105987 8.96412e-05 6.64539e-05 5.84756e-05 5.1668e-05 5.38316e-05 7.13512e-05 8.7302e-05 8.63344e-05 9.33323e-05 9.34338e-05 5.78514e-05 4.2365e-05 4.13449e-05 5.49342e-05 8.60534e-05 0.000158601 0.000279893 0.000457641 0.000482713 0.000471107 0.00027736 0.000182249 0.000136838 0.000103383 9.0444e-05 8.6006e-05 7.80033e-05 8.05877e-05 7.87842e-05 7.72766e-05 7.57623e-05 7.66648e-05 7.0255e-05 7.0986e-05 7.60198e-05 8.50756e-05 7.73627e-05 2.60495e-05 6.96312e-06 5.81057e-06 6.11908e-06 6.50791e-06 6.8847e-06 6.89776e-06 7.00347e-06 7.13494e-06 8.139e-06 9.13287e-06 1.05194e-05 1.1277e-05 1.26301e-05 1.52599e-05 2.01799e-05 3.19082e-05 6.06674e-05 0.000116743 0.00026486 0.000299379 0.000442881 0.000435286 0.000556888 0.000519801 0.000573894 0.000649102 0.000681745 0.000909509 0.00155541 0.00339143 0.00378141 0.00306856 0.00241365 0.00134866 0.000617913 0.000222121 7.61722e-05 2.17364e-05 7.11956e-06 4.9948e-06 5.10249e-06 6.10662e-06 7.8609e-06 1.05014e-05 1.73466e-05 2.91499e-05 5.78466e-05 0.0001563 0.000404694 0.000700411 0.000970681 0.00096648 0.000936608 0.000801147 0.000627579 0.000464157 0.000588028 0.000516046 0.000471134 0.000396605 0.000205001 0.000115005 3.85942e-05 2.15572e-05 2.64225e-05 2.27953e-05 5.30614e-05 6.81462e-05 7.55717e-05 7.42715e-05 6.84495e-05 5.52315e-05 4.8071e-05 5.65113e-05 9.35064e-05 0.000200944 0.000367688 0.000561635 0.00055531 0.000429651 0.00026928 0.000193053 0.00010861 6.13403e-05 3.64729e-05 2.30374e-05 2.77817e-05 1.10177e-05 2.67629e-05 4.58529e-05 5.36331e-05 5.86377e-05 5.33875e-05 3.70303e-05 3.29723e-05 3.00251e-05 3.06202e-05 2.5534e-05 2.46394e-05 2.21262e-05 2.26713e-05 2.50538e-05 2.08654e-05 2.33352e-05 1.42899e-05 1.69807e-05 1.67127e-05 1.26388e-05 2.89305e-05 1.48951e-05 6.93298e-05 6.39967e-05 0.000117919 0.00015237 0.000177958 0.000128039 0.000127278 9.17987e-05 0.000113893 9.97987e-05 0.000192035 0.000232778 0.000370498 0.000362994 0.000362953 0.000341069 0.000344147 0.000299854 0.000281085 0.000226179 0.000199564 0.000102806 7.20123e-05 9.00668e-05 7.07355e-05 8.42199e-05 8.12092e-05 0.00204179 0.00768431 0.00959018 0.00890168 0.00926135 0.00894056 0.00599333 0.00365914 0.00224328 0.00160399 0.00133311 0.00121158 0.00110331 0.00111268 0.00202406 0.00480682 0.00590092 0.00327633 0.00149716 0.00140619 0.00253223 0.0042702 0.00590129 0.00669546 0.00663515 0.00607096 0.00512945 0.0040787 0.00310058 0.00223158 0.0016215 0.00148856 0.00202337 0.0032144 0.00337222 0.00316365 0.00312079 0.00309037 0.00311155 0.00312163 0.00312442 0.00316163 0.0031591 0.00320192 0.00326322 0.00343511 0.00347387 0.00314304 0.00254569 0.00194963 0.00151893 0.0014202 0.00142159 0.00149854 0.00180251 0.00218968 0.00261106 0.00312192 0.0034856 0.00353832 0.00345525 0.00317573 0.00291803 0.00271327 0.00261601 0.00262131 0.00275599 0.00294036 0.00328599 0.00349181 0.00323931 0.00266099 0.00208364 0.00162881 0.00138565 0.0012154 0.00106935 0.000923923 0.000804805 0.000785954 0.000801001 0.000870646 0.00116433 0.00189036 0.00313097 0.00345948 0.00350803 0.000969369 0.000269966 0.000176558 0.000283 0.000447459 0.000603219 0.000749756 0.000886617 0.00106448 0.00110259 0.00126415 0.00112641 0.00111599 0.000896216 0.000789893 0.000659496 0.000531245 0.000451082 0.000387713 0.000335492 0.000305301 0.000321158 0.00033448 0.000408118 0.000645698 0.000658386 0.000538083 0.000483779 0.000422778 0.000473739 0.000439425 0.000346972 0.000309881 0.000331645 0.000642579 0.00175617 0.00354036 0.00321375 0.00303409 0.00303295 0.00319824 0.00348089 0.00306792 0.00148535 0.00091718 0.000711357 0.00076775 0.000930971 0.00117756 0.00120175 0.00138652 0.00134551 0.00121742 0.000951123 0.000689294 0.000505487 0.000500191 0.000475168 0.000448211 0.00040404 0.000390036 0.000353368 0.000413036 0.000498871 0.000782432 0.00114648 0.00141705 0.00159242 0.0013942 0.000853606 0.00056053 0.000646777 0.0010877 0.00118359 0.000808316 0.000577029 0.000476073 0.000484447 0.000540648 0.000620879 0.00066515 0.000647931 0.00054322 0.000511148 0.0005069 0.000591543 0.000635493 0.000953655 0.00107561 0.0012304 0.00131617 0.00130704 0.00118011 0.000828977 0.000588438 0.000401845 0.000276464 0.000220735 0.000218618 0.000274914 0.000460965 0.000759477 0.000722531 0.000351277 0.000182703 0.000127181 0.000129458 0.000105316 8.88611e-05 6.86342e-05 8.15306e-05 8.26122e-05 8.55734e-05 8.4392e-05 9.9295e-05 0.000127608 0.00018073 0.000291443 0.000448218 0.000679019 0.000941214 0.00121826 0.00123844 0.00105294 0.00080649 0.000679969 0.000557495 0.000463116 0.000378909 0.000287373 0.000223069 0.000180946 0.000149553 0.000132079 0.000115759 0.000104181 9.25566e-05 8.85559e-05 8.66524e-05 6.15008e-05 5.46879e-05 5.8156e-05 6.2722e-05 8.61373e-05 8.65429e-05 7.28389e-05 9.08715e-05 8.29023e-05 5.04076e-05 3.54897e-05 3.322e-05 3.17967e-05 3.23398e-05 3.66035e-05 4.68496e-05 6.02083e-05 7.27523e-05 9.81297e-05 9.09132e-05 9.88763e-05 8.78333e-05 8.68427e-05 7.43971e-05 7.62903e-05 6.6868e-05 6.7612e-05 6.30539e-05 6.30975e-05 6.27984e-05 6.27564e-05 6.40038e-05 6.77775e-05 7.73979e-05 8.75776e-05 6.46896e-05 1.52507e-05 6.21973e-06 6.14674e-06 6.02965e-06 6.0672e-06 6.17719e-06 6.34594e-06 6.55633e-06 6.71757e-06 6.98153e-06 7.21331e-06 8.95908e-06 9.13762e-06 9.88138e-06 1.00891e-05 1.0578e-05 1.07587e-05 1.19534e-05 1.44167e-05 2.10516e-05 3.16526e-05 5.26964e-05 8.32093e-05 0.000102496 0.0001766 0.000153195 0.000293979 0.000389988 0.000574967 0.00138227 0.00224037 0.00186354 0.00122774 0.00073743 0.000372228 0.000160674 6.63744e-05 2.93459e-05 8.65942e-06 5.07939e-06 5.12575e-06 6.11503e-06 6.95655e-06 8.1431e-06 9.65982e-06 1.0755e-05 1.0948e-05 1.39583e-05 1.93386e-05 3.24197e-05 5.41695e-05 9.05175e-05 0.000199703 0.000342664 0.00031263 0.000225673 0.000233269 0.000155269 0.000151334 0.000110837 8.12583e-05 5.22379e-05 3.28827e-05 1.87788e-05 1.35756e-05 1.99935e-05 1.87154e-05 6.07948e-05 6.56933e-05 7.32442e-05 7.59169e-05 6.70145e-05 5.93282e-05 5.20854e-05 4.86203e-05 4.58141e-05 4.83793e-05 5.37923e-05 5.13392e-05 3.97681e-05 3.10696e-05 1.85101e-05 1.55922e-05 8.6053e-06 9.24274e-06 6.97858e-06 7.32305e-06 7.86633e-06 6.8321e-06 1.53113e-05 5.63239e-05 5.73313e-05 5.45605e-05 3.94988e-05 4.04281e-05 2.93981e-05 2.74566e-05 2.4302e-05 2.43815e-05 2.09017e-05 1.9326e-05 2.11813e-05 1.83311e-05 1.63625e-05 1.66199e-05 1.58007e-05 1.5182e-05 1.52347e-05 1.55164e-05 2.2014e-05 1.37339e-05 7.06966e-05 3.1816e-05 0.000169457 0.000175183 0.000191148 0.00018457 0.000127789 0.0001248 9.17348e-05 9.0103e-05 0.000170651 0.000252455 0.000299681 0.000347004 0.000378467 0.00045103 0.000418911 0.000364527 0.000307543 0.000276872 0.000170383 0.000115768 9.07841e-05 8.80042e-05 8.69714e-05 8.37241e-05 8.90706e-05 0.00147644 0.00575765 0.00819887 0.00641679 0.00544464 0.00583249 0.00469878 0.00398843 0.00316066 0.00250817 0.00194489 0.00157225 0.00147722 0.00149421 0.00218504 0.00363587 0.00646059 0.00633104 0.00253792 0.00147287 0.00236183 0.00557577 0.00688731 0.00510725 0.00407596 0.00355567 0.00319789 0.00281966 0.00246298 0.00214242 0.0019611 0.00173562 0.0015401 0.00140321 0.00105012 0.00103148 0.000969408 0.00242306 0.00348915 0.00330835 0.00312391 0.00308608 0.00313957 0.00325747 0.00326726 0.00324176 0.00323792 0.00329938 0.00345907 0.00334168 0.00269466 0.00225016 0.0020705 0.0021199 0.0020875 0.00225963 0.00251672 0.00269754 0.0029849 0.00314899 0.00338508 0.00353111 0.00344583 0.00327801 0.00318043 0.00312986 0.00316435 0.0031956 0.00330501 0.00340905 0.00344748 0.00346723 0.00347981 0.00347536 0.00349174 0.00348455 0.00349168 0.00348513 0.00347649 0.00345939 0.00344118 0.00343792 0.00343243 0.00342569 0.00337953 0.00326388 0.0031733 0.00321647 0.00142884 0.000136606 0.00014006 0.00020858 0.000276404 0.000356226 0.000433293 0.000569424 0.000480992 0.000705631 0.000555668 0.00068988 0.000640493 0.000584683 0.000537708 0.000511015 0.000499658 0.000480539 0.000463397 0.000452754 0.000449316 0.000427704 0.000440796 0.000433499 0.00054333 0.000466469 0.000413582 0.000361854 0.000336975 0.000325517 0.000359525 0.000389814 0.000341279 0.000228339 0.000354571 0.00147869 0.00352598 0.00331906 0.00322625 0.00317904 0.00323945 0.00344606 0.0030543 0.00190491 0.00129607 0.00100206 0.00079277 0.000716587 0.000689712 0.000589089 0.00053965 0.000486064 0.000494658 0.000560354 0.000607273 0.000612673 0.000583636 0.000509794 0.000454238 0.000437544 0.000558472 0.000848079 0.00126495 0.00188255 0.00242172 0.00248688 0.0022966 0.00179708 0.00112828 0.000594903 0.000475587 0.000695737 0.00144349 0.00171092 0.00111209 0.000595404 0.000427983 0.000400786 0.000378521 0.000369291 0.000337312 0.000316043 0.00033145 0.000341766 0.000310649 0.000306705 0.000309063 0.000341652 0.00033305 0.00036844 0.000364249 0.000355364 0.000338109 0.000312431 0.000292971 0.000284984 0.000293452 0.000315727 0.000401902 0.000532761 0.000838646 0.000750339 0.000362113 0.0001775 0.000117159 0.000117853 9.97258e-05 8.66581e-05 7.4173e-05 7.22732e-05 7.00264e-05 7.39171e-05 7.42841e-05 6.88313e-05 7.06696e-05 8.38645e-05 9.91725e-05 0.000126708 0.000163576 0.000207024 0.000266984 0.000312209 0.00035507 0.000376996 0.000372181 0.000352499 0.000317948 0.000276642 0.000264453 0.000235057 0.000211615 0.000192502 0.000175641 0.000168021 0.000169554 0.000152233 0.00013094 0.000131201 0.000122547 9.63863e-05 8.31519e-05 8.79869e-05 9.03519e-05 8.54636e-05 6.17684e-05 8.36715e-05 0.000100559 9.1356e-05 7.8446e-05 7.03394e-05 6.79508e-05 6.5948e-05 6.31563e-05 6.00636e-05 5.8565e-05 5.90523e-05 5.93885e-05 6.42611e-05 6.12814e-05 6.47026e-05 6.4012e-05 6.59801e-05 6.65485e-05 6.4412e-05 6.66999e-05 6.62557e-05 6.76023e-05 6.74641e-05 7.56771e-05 7.70191e-05 8.01248e-05 8.39231e-05 9.00759e-05 4.88471e-05 8.58342e-06 6.29405e-06 6.46112e-06 6.46888e-06 6.49589e-06 6.53233e-06 6.56193e-06 6.62348e-06 6.72845e-06 6.7533e-06 6.87547e-06 6.93941e-06 7.03912e-06 7.18556e-06 7.09418e-06 7.81318e-06 7.03437e-06 7.16003e-06 6.66564e-06 7.65394e-06 6.46161e-06 8.76855e-06 8.35863e-06 1.15749e-05 1.22986e-05 1.80109e-05 2.07661e-05 3.07705e-05 5.76996e-05 0.000137838 0.000215932 0.000175245 0.000119221 6.18614e-05 4.80408e-05 3.35762e-05 2.88739e-05 1.53993e-05 5.04985e-06 5.70228e-06 5.94719e-06 5.46811e-06 6.33841e-06 5.87706e-06 5.96735e-06 6.12534e-06 5.8105e-06 5.81265e-06 5.66971e-06 6.381e-06 7.26287e-06 9.72097e-06 1.10638e-05 1.18874e-05 2.24094e-05 1.62573e-05 2.01171e-05 2.25981e-05 2.1213e-05 1.92192e-05 2.09225e-05 1.78869e-05 1.75013e-05 1.09905e-05 1.08549e-05 2.14182e-05 2.17663e-05 6.94943e-05 6.69423e-05 6.9233e-05 6.48825e-05 6.08366e-05 5.22369e-05 4.69499e-05 4.24165e-05 4.073e-05 3.89955e-05 3.68686e-05 3.03705e-05 2.127e-05 1.52691e-05 1.10949e-05 9.58468e-06 5.84772e-06 6.79568e-06 6.50453e-06 6.67894e-06 7.85582e-06 6.91621e-06 1.33133e-05 5.13447e-05 5.48782e-05 4.06462e-05 3.65498e-05 2.44886e-05 2.51991e-05 1.73232e-05 1.97074e-05 1.57567e-05 1.82661e-05 1.4041e-05 1.57408e-05 1.52448e-05 1.37404e-05 1.48202e-05 1.23276e-05 1.37881e-05 1.70803e-05 6.52695e-06 2.53344e-05 6.5387e-06 5.2256e-05 2.0768e-05 0.000162545 0.00014706 0.00024253 0.00020968 0.00017477 0.000111247 0.000106288 8.64577e-05 0.000124568 0.000262488 0.00027558 0.000333233 0.000435106 0.000497374 0.000462687 0.000415545 0.000345631 0.000290824 0.000211256 0.000113305 0.000132503 8.0327e-05 0.000133243 0.000120905 0.000105952 0.0164951 0.017102 0.0169694 0.0163887 0.0152749 0.0133119 0.0108096 0.00781465 0.00553965 0.00279798 0.00175222 0.00281145 0.00351076 0.00354301 0.000846516 0.000927758 0.00118346 0.00150337 0.00179357 0.00199686 0.00220522 0.00218189 0.00231142 0.00225979 0.00240951 0.00236656 0.00263841 0.00255819 0.00290505 0.00281509 0.00317537 0.00303852 0.00342719 0.00348893 0.00414051 0.00415855 0.00356813 0.00252756 0.00156979 0.00107315 0.000999932 0.00191512 0.00329938 0.00305826 0.00337867 0.00322284 0.00296468 0.00279505 0.00268463 0.00262095 0.00264439 0.0026213 0.00279373 0.00291603 0.00348427 0.00389686 0.00451088 0.00505456 0.00589573 0.0062192 0.00655195 0.00603205 0.00586432 0.00652498 0.00602419 0.00585999 0.00571824 0.00530608 0.00497234 0.00397652 0.00342962 0.00240411 0.00148803 0.00176563 0.00280701 0.00269336 0.00256795 0.00256372 0.00265054 0.00283249 0.00308568 0.00328747 0.00349407 0.00358406 0.00363816 0.00363873 0.00361335 0.00361115 0.00359978 0.0035746 0.00354171 0.00352312 0.00347965 0.00343327 0.00334331 0.00332418 0.00318076 0.00306753 0.00344994 0.00282631 0.00194484 0.00201955 0.00339364 0.00265676 0.00277503 0.00236918 0.00186675 0.00156852 0.00149974 0.00177693 0.00184514 0.00225178 0.00239739 0.00261826 0.00236412 0.00235728 0.00219713 0.00210151 0.00192382 0.00182254 0.00177855 0.00179194 0.00186461 0.00197574 0.00213985 0.00242754 0.00288003 0.0033594 0.00351721 0.00351881 0.00351257 0.0025082 0.00217455 0.00315287 0.0020465 0.00241974 0.00292434 0.00350972 0.00358198 0.00358178 0.003508 0.00314986 0.00240569 0.00166866 0.00133635 0.00115685 0.0010053 0.000933162 0.000793045 0.000836309 0.000735484 0.000819635 0.000742445 0.00080127 0.000791392 0.000814966 0.0014076 0.000917616 0.00213633 0.00219161 0.00334333 0.00182681 0.00106245 0.00161401 0.00218678 0.00240124 0.00294726 0.00199735 0.000402299 0.000165371 0.000140088 0.000395621 0.00330916 0.00139278 0.000923888 0.000838466 0.000910006 0.00103286 0.00128112 0.00151194 0.00170993 0.00190912 0.00195236 0.00203732 0.00174383 0.00141377 0.0010216 0.000636057 0.00057109 0.000368545 0.000339037 0.000433257 0.000543513 0.000775739 0.001168 0.00128028 0.00142942 0.00174513 0.00192253 0.00231256 0.00248347 0.00284399 0.00298804 0.00320175 0.00275481 0.00159686 0.000541836 0.000384049 0.000449117 0.000690206 0.000800188 0.00158623 0.00218913 0.00338146 0.00352188 0.00355175 0.00310975 0.0019518 0.00118717 0.000731512 0.00059639 0.000540003 0.00075132 0.000946407 0.000766332 0.000704699 0.000755469 0.000787168 0.000917483 0.0012024 0.00220663 0.00211514 0.00196691 0.00187415 0.00108099 0.00131725 0.000856328 0.000882232 0.000936319 0.00095083 0.000991394 0.00102588 0.00104938 0.00106595 0.00108538 0.00114339 0.00127267 0.00146397 0.00172303 0.00196974 0.0022951 0.00262848 0.00295474 0.0031468 0.00123516 0.00113006 0.000794872 0.000726841 0.00101618 0.00137997 0.0016238 0.00181768 0.00210869 0.00240478 0.00238272 0.00197273 0.00138462 0.00106027 0.000806287 0.000610392 0.000534446 0.000511146 0.000437825 0.000466795 0.000547637 0.000611315 0.000776025 0.00125024 0.0017839 0.00234847 0.00289758 0.00317171 0.00322957 0.00324338 0.000332122 0.000335598 0.000330981 0.000349259 0.0003984 0.000467175 0.000538765 0.000651498 0.000800586 0.00131678 0.00146911 0.00205127 0.00140544 0.00105023 0.000982033 0.000971018 0.000884561 0.000778584 0.00074668 0.000865199 0.00093572 0.00104218 0.00111724 0.00133435 0.00136946 0.00176855 0.00197004 0.00254193 0.00303985 0.0034176 0.000306483 0.000295324 0.000261908 0.000279282 0.000304766 0.00034958 0.000372083 0.000384967 0.000446621 0.000527937 0.000609387 0.000689782 0.000779506 0.000927452 0.00109033 0.00114129 0.00123674 0.00116363 0.00121333 0.00110519 0.00112135 0.00104673 0.00103769 0.00101183 0.00103262 0.00110252 0.00128848 0.00144628 0.00191073 0.00236253 0.00164765 0.000866918 0.00040888 0.000401331 0.000274886 0.000261092 0.000295184 0.000275538 0.000319729 0.000330368 0.000375072 0.000442196 0.000548149 0.000665341 0.000826354 0.00104505 0.00117828 0.00123684 0.00104867 0.00107905 0.00124813 0.0030718 0.00462408 0.00442225 0.00431362 0.00406515 0.00423133 0.00465508 0.00525956 0.00636093 0.0149401 0.0103384 0.00869746 0.00801997 0.00834128 0.0104042 0.012419 0.0158591 0.0131295 0.00678005 0.00289594 0.0015505 0.00290423 0.003342 0.0007916 0.00173162 0.00374316 0.00479298 0.00527303 0.00539101 0.00545636 0.00520744 0.00499029 0.00455834 0.00413119 0.00369742 0.0034966 0.00332712 0.0034888 0.00334996 0.00358465 0.00343915 0.00379201 0.00395883 0.00493852 0.00547165 0.00498239 0.00329316 0.0018229 0.00111813 0.00102989 0.0020077 0.00331477 0.00303685 0.00335802 0.00312645 0.00274776 0.00242464 0.00237592 0.00235252 0.00234469 0.00234144 0.00246987 0.00260661 0.00278681 0.00293741 0.0031328 0.00390101 0.00474343 0.00581304 0.00699802 0.00684512 0.00725387 0.00701052 0.00669537 0.00618134 0.00594784 0.00570211 0.00555831 0.00482887 0.00360564 0.00244911 0.00151288 0.0018674 0.00277612 0.00255359 0.00269513 0.00322229 0.0035497 0.00353882 0.0035516 0.00358463 0.00347504 0.00349155 0.00332409 0.00343265 0.00354061 0.00358279 0.00365608 0.00364306 0.00362301 0.00360175 0.00358581 0.00352773 0.00342333 0.00330394 0.00314637 0.00299424 0.00315101 0.00346462 0.00292557 0.00244913 0.0030639 0.00307628 0.00285348 0.00210808 0.00176691 0.00235063 0.0033331 0.00303168 0.0025148 0.00215175 0.00189387 0.00187511 0.00193066 0.00213284 0.00256912 0.00302767 0.00343836 0.00353677 0.00317206 0.00298135 0.00283278 0.00279961 0.00281416 0.00297705 0.00326751 0.00350578 0.00345683 0.00346964 0.00348768 0.00275625 0.00204637 0.00301762 0.00210656 0.00281204 0.00344245 0.00357164 0.0033836 0.00237989 0.00122432 0.000750072 0.000567672 0.000559687 0.0005771 0.000560267 0.000495578 0.00042475 0.000341025 0.000359692 0.000373769 0.00037301 0.000376029 0.000357903 0.000365321 0.000395644 0.00065182 0.00101312 0.00156294 0.00182837 0.0027754 0.00282538 0.00133559 0.00151874 0.000809084 0.00111169 0.00110825 0.000484718 0.000162229 0.00011823 0.000179132 0.00158505 0.00281281 0.00164612 0.00177233 0.00266376 0.00347995 0.0027446 0.00150893 0.00112334 0.000831921 0.000716034 0.000670803 0.000663572 0.000703072 0.00103046 0.0017467 0.00340444 0.00202219 0.000713856 0.000431236 0.000435419 0.000583939 0.000717947 0.00124015 0.00185902 0.0024079 0.00304834 0.00315578 0.00342344 0.00341768 0.00312211 0.00333752 0.00337413 0.00243089 0.000895258 0.000418299 0.00035097 0.000552786 0.000830835 0.00260724 0.000522189 0.000154228 5.79635e-05 6.35671e-05 6.24919e-05 6.3946e-05 0.000105268 0.000249011 0.00134142 0.00298648 0.000950125 0.0004741 0.000729549 0.000796869 0.000659447 0.000691396 0.00102367 0.00161325 0.0018092 0.00198563 0.00191959 0.00161421 0.00113802 0.000701041 0.000474986 0.000289202 0.000301833 0.000340138 0.00037748 0.000437694 0.000481725 0.000495803 0.00047143 0.000423586 0.0003602 0.000323173 0.000313652 0.000297269 0.000285825 0.000330368 0.00045607 0.000744538 0.0013 0.00120128 0.000913932 0.000608224 0.000535862 0.000655143 0.000961578 0.00119578 0.00120005 0.00153672 0.00166456 0.00154982 0.00113497 0.000922719 0.000784432 0.000738949 0.0007241 0.000602916 0.00051194 0.000391405 0.000259401 0.000164714 0.000138062 0.000164932 0.000177258 0.000210079 0.000279604 0.000425896 0.000614575 0.000800597 0.00124758 0.000313642 0.000312031 0.000310848 0.000311238 0.000342003 0.000372305 0.000392927 0.000456878 0.000604641 0.000715252 0.000881209 0.00109323 0.00126352 0.000627041 0.000568226 0.000522609 0.000498866 0.000453698 0.000423393 0.000339226 0.000288542 0.000213442 0.000185317 0.000196295 0.000182902 0.000238876 0.000346296 0.000601856 0.00116807 0.00144561 0.000302984 0.000278736 0.000253284 0.000252827 0.000261438 0.000285244 0.000325149 0.000389961 0.000519693 0.000612008 0.000528472 0.000392478 0.000391406 0.000309372 0.000322277 0.000330774 0.000383286 0.000460757 0.000467046 0.000419003 0.000358547 0.00030165 0.000294484 0.000237407 0.000222614 0.000231184 0.000223357 0.000346071 0.000745201 0.00102213 0.0010444 0.000887538 0.000606082 0.000489563 0.000428773 0.000413864 0.000380601 0.000398254 0.000385342 0.000359152 0.000326688 0.000315428 0.000310852 0.00033026 0.00031981 0.000346676 0.000441209 0.000431945 0.000583278 0.000539591 0.000924687 0.00121049 0.000954113 0.00149829 0.0014148 0.00148855 0.00129367 0.00135818 0.00136984 0.00140136 0.00406043 0.00331598 0.00322682 0.00309653 0.00312039 0.00335674 0.00392537 0.00541061 0.00868965 0.0127514 0.00848651 0.00297134 0.0016618 0.00285667 0.000948455 0.00397662 0.00547301 0.00578245 0.00570136 0.00531456 0.00522662 0.00492008 0.00493898 0.00499624 0.00532041 0.00511661 0.00444228 0.00395265 0.00381428 0.00364189 0.00385387 0.00370833 0.00422923 0.00465484 0.00623115 0.00713353 0.00647484 0.00403121 0.00182682 0.00104127 0.00103894 0.0022504 0.00335667 0.00314226 0.00326434 0.00305174 0.00258607 0.00246585 0.00242063 0.00230393 0.00220884 0.00220729 0.00242786 0.00275161 0.0031047 0.00332814 0.003378 0.00353955 0.00408132 0.00497858 0.00623535 0.00677517 0.00834454 0.00774785 0.00726634 0.00624732 0.00561001 0.00535468 0.00555931 0.0054025 0.00406515 0.00232154 0.00157124 0.00203008 0.00272025 0.00277186 0.00350728 0.00346647 0.00337024 0.00203935 0.0011815 0.000862326 0.00076175 0.000703048 0.000731088 0.000755395 0.000838714 0.00101233 0.00121861 0.00148736 0.0018965 0.002622 0.003147 0.00348405 0.00362509 0.00351646 0.00324896 0.00300488 0.00299152 0.00338272 0.00341595 0.00284305 0.00275204 0.00315717 0.00273673 0.00206916 0.00302371 0.00285536 0.00209534 0.00168144 0.0013413 0.00120856 0.00107915 0.00105074 0.00106285 0.00112755 0.00133695 0.0016642 0.00209746 0.00263056 0.00308278 0.00337627 0.00347933 0.00350102 0.00352297 0.00350968 0.0034602 0.00324821 0.00303046 0.00314371 0.0033367 0.00278374 0.00199824 0.00297087 0.00233575 0.003275 0.0035722 0.00286569 0.00126612 0.000633029 0.000476047 0.000459247 0.00045802 0.000427119 0.00035399 0.000354905 0.000387932 0.000418787 0.000460519 0.0005023 0.000523911 0.000557488 0.000534509 0.000514578 0.000438081 0.000415272 0.00030183 0.000609288 0.00116494 0.0015596 0.00210594 0.00335666 0.00166119 0.00149837 0.000131476 0.000177532 0.00022135 0.000115682 7.9825e-05 0.000168382 0.00069762 0.00337564 0.00284429 0.00342613 0.00234931 0.000925257 0.000514072 0.000379656 0.000301284 0.000272141 0.000249898 0.000240145 0.000229967 0.000231893 0.000230382 0.000258057 0.000293483 0.000670924 0.00236266 0.00173312 0.000642891 0.000455523 0.000579435 0.000695443 0.00177061 0.0028271 0.00319716 0.0032226 0.00340769 0.00341493 0.00270472 0.00192866 0.00199795 0.00337499 0.00172803 0.000597663 0.000342213 0.000426889 0.000625613 0.00250461 0.000294205 7.65294e-05 6.28345e-05 3.45659e-05 3.71498e-05 3.46607e-05 3.27452e-05 2.72335e-05 3.1127e-05 4.06132e-05 0.000101915 0.000999753 0.00127204 0.000847375 0.00128982 0.00118361 0.00124122 0.00132796 0.00151718 0.00178332 0.00202322 0.00186065 0.0017512 0.00135323 0.00139258 0.00256224 0.00314952 0.00261996 0.00138595 0.000871579 0.00069679 0.000645645 0.00066088 0.000759145 0.00101214 0.00153469 0.00305784 0.00327844 0.00183197 0.000712525 0.000224198 0.00012084 0.000122924 0.000209821 0.00100655 0.000685923 0.000470138 0.000396794 0.000430534 0.000601317 0.000744444 0.000824205 0.000830944 0.000955246 0.000986146 0.000970656 0.000911152 0.00103555 0.00124505 0.00143604 0.00167685 0.00201775 0.00269647 0.00317757 0.00324373 0.00314865 0.00271044 0.0018931 0.00107843 0.000600116 0.000324679 0.000227028 0.000200684 0.0002487 0.000288861 0.000281635 0.000280303 0.000264797 0.00030876 0.000309655 0.000461992 0.000671304 0.000835505 0.00195313 0.00307037 0.00440053 0.00177773 0.000940539 0.000788833 0.000782131 0.000802945 0.000887098 0.00126315 0.00199711 0.00356231 0.00166426 0.000608653 0.000208916 0.000121014 9.77848e-05 0.000100226 0.000126397 0.000291003 0.000559024 0.000275013 0.000260177 0.000255357 0.00025425 0.000276987 0.00037535 0.000765158 0.00174413 0.00312999 0.00413301 0.00311086 0.0021654 0.00182955 0.00323801 0.00304823 0.00148642 0.000580039 0.000355553 0.000227294 0.00020318 0.000178947 0.000190768 0.000192673 0.000170053 0.000146519 0.000137127 0.000117948 0.000124019 0.000207779 0.0003068 0.00109836 0.00131166 0.00135826 0.00161486 0.00191634 0.00212723 0.00236757 0.00227598 0.00229449 0.00193099 0.00165186 0.00124615 0.00103129 0.000744699 0.000535301 0.00050622 0.000358067 0.000449386 0.000576098 0.00100166 0.00137943 0.00119369 0.00136085 0.0012652 0.00201574 0.00290865 0.00287603 0.00229721 0.00153105 0.00115724 0.00221762 0.00329178 0.00402534 0.00428449 0.00327659 0.00262828 0.00237335 0.00273485 0.00370364 0.0063993 0.0100335 0.00798396 0.00216571 0.00210681 0.00196652 0.00508153 0.00584231 0.00600004 0.00581915 0.00541921 0.00509402 0.00496597 0.00476714 0.00481807 0.00492927 0.00578626 0.00512701 0.00438282 0.00376556 0.00383699 0.00372032 0.00396903 0.00451163 0.00569761 0.00767292 0.0089027 0.00737398 0.00382097 0.00139303 0.00067501 0.000813167 0.001921 0.00319449 0.00334731 0.00324113 0.00299271 0.00273258 0.00263516 0.002362 0.00208004 0.0020069 0.00215529 0.00261625 0.00325884 0.0035712 0.00376821 0.00360744 0.00392442 0.00413186 0.00462725 0.00501938 0.00602823 0.00718949 0.00809315 0.00779347 0.00635225 0.00511262 0.00465212 0.00495949 0.0055726 0.00420873 0.00204748 0.00168574 0.00241136 0.00280634 0.00350977 0.00347055 0.00166479 0.000614468 0.000439613 0.000450793 0.000481962 0.000552212 0.000600043 0.00062518 0.000636245 0.000630499 0.00067234 0.000736571 0.000852666 0.00119835 0.00151521 0.00225908 0.00298151 0.00344987 0.00350207 0.0033519 0.00302687 0.00291424 0.00321731 0.0034719 0.00322684 0.00301921 0.00329811 0.00264203 0.00291062 0.00303067 0.00258762 0.00228976 0.0018408 0.00146503 0.00124723 0.00111599 0.00106575 0.00100448 0.00102888 0.00110261 0.00125897 0.00152833 0.00185046 0.00223801 0.00261199 0.00294617 0.00318415 0.00327069 0.00317383 0.00286194 0.00250063 0.0024445 0.00274963 0.00306081 0.00254012 0.00195457 0.00293816 0.00259588 0.0035593 0.00256332 0.000971027 0.000488872 0.000455239 0.000464373 0.000440274 0.000394211 0.000365486 0.000396432 0.000440223 0.000479271 0.00051692 0.000566503 0.000634563 0.000694765 0.000748331 0.000766341 0.00074167 0.00070489 0.000570619 0.000381295 0.000335557 0.000941532 0.00131964 0.00175536 0.00321348 0.0018283 0.00152996 7.23559e-05 7.32159e-05 7.01565e-05 5.26715e-05 9.55561e-05 0.000654039 0.00275916 0.00337566 0.00282934 0.00093871 0.000484754 0.000343049 0.000288753 0.000271648 0.000265014 0.000253312 0.000245551 0.000243623 0.000247824 0.000267846 0.000290141 0.000279865 0.000268019 0.000336199 0.000783145 0.00287258 0.000966682 0.000521631 0.000556043 0.000520947 0.00284826 0.00321591 0.00278567 0.00231676 0.00236324 0.00294034 0.00341079 0.0018941 0.00154663 0.00300556 0.00138059 0.000517453 0.000331611 0.000467726 0.00148879 0.00054148 7.68865e-05 6.11301e-05 5.24004e-05 5.29392e-05 5.00904e-05 4.39864e-05 3.7909e-05 3.38503e-05 4.03841e-05 4.58236e-05 3.78912e-05 8.9178e-05 0.00131718 0.000714567 0.00250202 0.00150497 0.00134399 0.0014337 0.00153941 0.00171738 0.00184213 0.00189422 0.00282702 0.00200958 0.000410103 0.000153496 9.59094e-05 7.75571e-05 7.4052e-05 6.9639e-05 6.70218e-05 6.64806e-05 6.5064e-05 6.51067e-05 6.64277e-05 7.03094e-05 8.4694e-05 0.00010978 0.000187402 0.000509997 0.00335894 0.000765995 9.86216e-05 7.37352e-05 0.000712257 0.000585584 0.000462486 0.000381857 0.000339573 0.000381587 0.000497553 0.0004685 0.000586704 0.000699893 0.000891951 0.00108305 0.00144247 0.00205174 0.00279962 0.00335207 0.00169246 0.00071457 0.000422269 0.000294915 0.000246207 0.000229687 0.000239973 0.000267495 0.000386308 0.00078946 0.00328433 0.00134283 0.000320601 0.000152691 0.0002485 0.000244412 0.000252476 0.000260077 0.000358345 0.000401918 0.000760663 0.00116725 0.00253871 0.00307784 0.0012264 0.000446047 0.000537154 0.000233936 0.000212763 0.00020657 0.000176917 0.000167475 0.000177707 0.000170155 0.000205215 0.000323657 0.000705012 0.00332526 0.00075373 0.000208753 9.84165e-05 9.2725e-05 0.000102659 0.000181183 0.000253016 0.000263705 0.000299915 0.000315002 0.000407011 0.00114431 0.00333113 0.0012523 0.000894022 0.000414709 0.000356774 0.000216565 0.000187791 0.000153903 0.000176345 0.000260123 0.000542327 0.0020318 0.00240772 0.000954097 0.000435948 0.000308053 0.000278827 0.000198962 0.000166736 0.000149988 0.000118341 9.77534e-05 9.91552e-05 0.000130103 0.00114822 0.00248988 0.00443298 0.0046485 0.00266278 0.00131577 0.000881756 0.000697923 0.000640628 0.000653562 0.000815319 0.00140956 0.00312277 0.00463924 0.00323762 0.00163622 0.00143526 0.00152934 0.00212231 0.00252347 0.00253004 0.00278212 0.00322043 0.00449908 0.00634507 0.00874607 0.00958491 0.0101739 0.00631969 0.00204702 0.00386795 0.00972453 0.0119896 0.0117461 0.00887499 0.00522523 0.00346123 0.00289053 0.0030961 0.00424485 0.00638559 0.0101858 0.00530164 0.00175966 0.00342041 0.0053242 0.00601995 0.00648611 0.00601323 0.00547153 0.00545126 0.00531853 0.00537371 0.00553535 0.00590933 0.0062471 0.00514978 0.00416361 0.00374556 0.00363277 0.00374105 0.0040129 0.00520534 0.00711919 0.00916741 0.00970029 0.00703654 0.00248142 0.000658142 0.000276803 0.000347319 0.000913847 0.00218771 0.00338971 0.00315658 0.00296076 0.0027746 0.00238326 0.00196036 0.00187154 0.00201256 0.00236207 0.00314296 0.00394712 0.00341826 0.00325286 0.00333183 0.00356362 0.00423849 0.00443658 0.00463263 0.0054905 0.00603655 0.00713617 0.00718475 0.00579852 0.00447469 0.00422133 0.00473781 0.00562375 0.00380206 0.00187163 0.00189221 0.00275716 0.00323308 0.00348337 0.00107282 0.000351731 0.000335838 0.00051048 0.000969087 0.00170177 0.00231727 0.00262207 0.00254457 0.00218408 0.00155673 0.00135781 0.00125661 0.00133614 0.00161129 0.00227574 0.00297704 0.00347282 0.00351506 0.00343946 0.00324608 0.00296898 0.00286335 0.00317837 0.00345718 0.00338303 0.00311511 0.00323245 0.00269372 0.00350837 0.00314249 0.00307655 0.00324675 0.00265439 0.00196484 0.0015284 0.00135156 0.0011594 0.00116652 0.0010848 0.00119489 0.00127818 0.00147588 0.00174877 0.00206492 0.00242166 0.00266964 0.00274462 0.00259917 0.00223401 0.00189539 0.00174748 0.00185767 0.00224656 0.00251449 0.00207219 0.00182073 0.00300139 0.00290836 0.0030207 0.0010507 0.000501138 0.00045186 0.000474257 0.000435299 0.000383449 0.000366847 0.000393775 0.000439164 0.000443047 0.000416194 0.000429056 0.000483516 0.000579243 0.000673414 0.0007511 0.000712086 0.000747621 0.00067494 0.000646869 0.00043592 0.000291499 0.000739769 0.00114609 0.00152596 0.00313064 0.00179697 0.00158944 5.29243e-05 4.13486e-05 3.7028e-05 5.70156e-05 0.000250231 0.00226763 0.00341125 0.00235782 0.000787013 0.000449576 0.000345408 0.000305051 0.000294578 0.000284117 0.000276792 0.000258632 0.000245987 0.000245051 0.000273518 0.00038064 0.000589918 0.000674898 0.000580527 0.00045325 0.000776324 0.00337218 0.00123365 0.000593674 0.000522443 0.000465995 0.00350579 0.00304577 0.00206798 0.0015335 0.00139521 0.00195929 0.00304304 0.00237861 0.00139018 0.00342626 0.00127037 0.000539006 0.000344111 0.000519407 0.00332194 0.00013634 5.08057e-05 6.09205e-05 5.98835e-05 6.09653e-05 6.01794e-05 6.19175e-05 5.72761e-05 5.01331e-05 4.54871e-05 4.47791e-05 4.19343e-05 4.04685e-05 0.000266853 0.00129786 0.00273896 0.00194063 0.00141507 0.00136379 0.00140619 0.00161091 0.0020521 0.0030704 0.000946803 0.000144408 5.64549e-05 4.69516e-05 5.12015e-05 4.7905e-05 6.47328e-05 5.99616e-05 6.20239e-05 5.94516e-05 5.86416e-05 5.45584e-05 4.96936e-05 4.53627e-05 4.1231e-05 4.00604e-05 4.20247e-05 5.99482e-05 0.000157299 0.00128768 0.000772892 6.58711e-05 0.000477044 0.000487684 0.000497952 0.000502565 0.000428963 0.000357755 0.000339454 0.000368562 0.000408891 0.000640041 0.000979781 0.00165985 0.0027903 0.00338856 0.0019338 0.000801195 0.00042645 0.000252781 0.000270505 0.000215566 0.000186993 0.000180974 0.00017792 0.000167843 0.000156612 0.00015852 0.000197837 0.000655365 0.00256041 0.000365479 0.000210655 0.000231116 0.000268884 0.000308192 0.000469383 0.000650515 0.00125845 0.00259339 0.00336328 0.000696307 0.000525312 0.000787854 0.000894776 0.000950679 0.000705179 0.000631993 0.000476867 0.000344581 0.000284271 0.000180065 0.000143085 9.5424e-05 0.00010036 0.000150593 0.000664088 0.00234715 0.000392967 0.000112512 9.37832e-05 0.000134917 0.000230418 0.000293994 0.000469641 0.000537182 0.000808374 0.00310166 0.000796052 0.000423339 0.000372212 0.000830704 0.000831972 0.000753629 0.00075511 0.000345808 0.000209595 0.000119704 8.61835e-05 9.89292e-05 0.00016678 0.00055869 0.00331211 0.00132044 0.000854675 0.000424694 0.000290515 0.000211287 0.000158874 0.000121809 8.42594e-05 8.7915e-05 0.00146976 0.00595201 0.00233762 0.00100041 0.000419565 0.000287898 0.000203595 0.00020886 0.000184031 0.000155875 0.000238028 0.000230667 0.000285124 0.000533056 0.00103336 0.00368531 0.00737842 0.00802929 0.00762767 0.00697748 0.0076382 0.00810396 0.00802477 0.0058452 0.00454387 0.00327225 0.00383353 0.00672842 0.0100556 0.00295555 0.00656483 0.0106481 0.00806748 0.00932236 0.0110369 0.0100918 0.00654536 0.00531674 0.0049247 0.00537239 0.00655578 0.00863665 0.00911052 0.00189466 0.00460618 0.00540645 0.00646792 0.0068488 0.00647309 0.0063854 0.00671527 0.00708681 0.00681752 0.00662245 0.00618501 0.00529464 0.00440409 0.00376292 0.00356064 0.00352654 0.00362913 0.0046396 0.00659051 0.00908719 0.00999211 0.00929623 0.00381808 0.000845752 0.000219378 0.000125533 0.000191647 0.000506615 0.00132867 0.00306702 0.003098 0.0028894 0.00238934 0.00188616 0.00186965 0.00197322 0.00217025 0.00257877 0.00344039 0.00371329 0.00305625 0.002891 0.0030203 0.00340071 0.00373247 0.00453833 0.00462604 0.00531421 0.00557907 0.00566709 0.00523738 0.0046881 0.00393512 0.00405188 0.00467829 0.00579774 0.00317043 0.00166506 0.00205377 0.00305731 0.00346733 0.00139996 0.000290077 0.000295646 0.00072332 0.00232161 0.00353765 0.00331129 0.00325937 0.00333876 0.00343295 0.00354039 0.00359405 0.0033769 0.00313954 0.00314783 0.00336124 0.00354282 0.00348462 0.00331978 0.00320462 0.00310576 0.00297061 0.00276203 0.00283659 0.003289 0.00347092 0.00340566 0.00338967 0.00297951 0.0030326 0.00207123 0.000846571 0.00104539 0.00223058 0.00338373 0.00307809 0.00253049 0.0021752 0.00192545 0.00177936 0.00166951 0.00162299 0.00167594 0.00179158 0.00193045 0.00206027 0.00207489 0.00196213 0.00171796 0.00146182 0.00128515 0.00121559 0.00126552 0.00142698 0.00173143 0.00189185 0.00170362 0.00181614 0.00287393 0.0032172 0.00160421 0.000606594 0.000442223 0.000461103 0.000420672 0.000363755 0.000332658 0.000339905 0.000354433 0.000327183 0.000284231 0.000286484 0.000352275 0.000468059 0.000580701 0.000643017 0.00064482 0.000615549 0.000654429 0.000576235 0.000540558 0.000394792 0.000321318 0.000712626 0.00106327 0.00139647 0.00344014 0.00167292 0.00163617 4.50441e-05 2.70404e-05 3.65933e-05 0.000131075 0.000945805 0.00324869 0.00273497 0.000948563 0.000481065 0.000379801 0.000326632 0.000302302 0.000287927 0.000275935 0.000261136 0.000245121 0.000226638 0.000227928 0.00029063 0.000600126 0.00154213 0.00292952 0.00280472 0.00185939 0.00216964 0.00324939 0.00144062 0.000676092 0.00047618 0.000385735 0.00351596 0.00246294 0.00154427 0.00130582 0.00132545 0.00155592 0.00287371 0.0023067 0.00160497 0.00341768 0.00116108 0.000620743 0.000400176 0.000633968 0.0016991 9.18996e-05 5.37554e-05 6.78986e-05 6.35472e-05 6.33832e-05 6.43434e-05 6.60303e-05 6.83021e-05 7.2212e-05 7.12199e-05 5.71024e-05 5.10368e-05 5.20882e-05 0.000189893 0.00327537 0.00252275 0.00191477 0.0014365 0.00124372 0.00138203 0.00174399 0.00291584 0.00133814 0.000208304 7.01652e-05 4.61749e-05 6.22729e-05 8.20977e-05 8.76982e-05 9.58531e-05 9.79697e-05 9.43283e-05 9.41869e-05 8.87012e-05 8.20568e-05 7.04692e-05 6.17937e-05 5.15315e-05 4.02448e-05 3.5751e-05 3.45783e-05 4.11725e-05 0.000114612 0.0014656 0.000322261 0.000339744 0.000409448 0.000605042 0.00094797 0.000855268 0.000539665 0.000361683 0.000318436 0.000324806 0.000558683 0.00122293 0.0027103 0.00293471 0.00127222 0.000703953 0.000419568 0.000289386 0.000266911 0.000285142 0.000325215 0.000429003 0.000450531 0.000412527 0.000377429 0.000277867 0.00024329 0.000175423 0.000190574 0.000317749 0.00333208 0.000231451 0.000275351 0.000384865 0.000509102 0.000731316 0.00108332 0.00229959 0.00393523 0.00108921 0.000515484 0.000864314 0.00136166 0.00260704 0.00142435 0.00126672 0.000816435 0.000848702 0.000701518 0.000532041 0.000341545 0.000230977 0.000146111 8.06653e-05 6.43811e-05 6.68623e-05 0.000236028 0.00352949 0.00054897 0.000124302 9.72595e-05 0.000234895 0.000448256 0.000895056 0.00135363 0.00226745 0.0012487 0.000448157 0.000421221 0.000875106 0.00311928 0.00413991 0.00382496 0.00303797 0.00334816 0.00180039 0.000662584 0.000214122 8.69719e-05 5.75607e-05 5.14373e-05 0.000119611 0.000776387 0.00339246 0.00159131 0.00082425 0.000452577 0.000276042 0.000176325 0.000101069 8.39026e-05 0.00273065 0.00253532 0.00118513 0.000416443 0.000417622 0.000305596 0.000452572 0.000752349 0.00102352 0.00112354 0.00112988 0.000485695 0.000369318 0.000169633 0.000288155 0.000489942 0.00140009 0.00392989 0.0066388 0.00771355 0.00737965 0.0048184 0.00282877 0.00156143 0.000747425 0.000723756 0.000879522 0.00142837 0.00416854 0.00655431 0.00788218 0.00798734 0.00688401 0.00790142 0.00909049 0.0104602 0.0113966 0.0103981 0.00963481 0.00914013 0.00879506 0.00955702 0.00862377 0.00297765 0.00503242 0.00558409 0.00746932 0.00737009 0.00713727 0.00764939 0.00608337 0.0045012 0.00428281 0.00450097 0.00434269 0.00407867 0.0036014 0.00350434 0.00329259 0.00338478 0.00422709 0.00643262 0.00888454 0.00977202 0.00947527 0.00393148 0.000849349 0.000284176 0.000142257 0.000178857 0.000514183 0.00116259 0.00160186 0.00274717 0.00291772 0.00242862 0.00182873 0.00193786 0.00210868 0.00214542 0.00215944 0.00248046 0.00319906 0.00378792 0.00344842 0.00322391 0.00306575 0.00314324 0.00314359 0.00344196 0.00392626 0.00385976 0.00429868 0.00427053 0.00395892 0.00375813 0.00373428 0.00403413 0.00504475 0.00538393 0.00213875 0.00154335 0.00210239 0.00305282 0.00286469 0.000438539 0.000263964 0.000619305 0.00221955 0.0034764 0.00298837 0.00285489 0.00294222 0.00306344 0.00312901 0.00319547 0.00327798 0.00334556 0.00330663 0.00324117 0.0030631 0.00288747 0.0027579 0.00265735 0.00268578 0.00268736 0.00264427 0.00268516 0.00304376 0.00345088 0.00350201 0.00339329 0.00348095 0.00284674 0.00276811 0.000773478 0.000375244 0.000495809 0.000771695 0.00142309 0.00247338 0.00328684 0.00346844 0.00346843 0.0033273 0.00313391 0.00291079 0.00275536 0.00252346 0.0024895 0.00226604 0.00230501 0.00220995 0.00218828 0.00208371 0.00197857 0.00176695 0.00152894 0.00145469 0.0014627 0.00150689 0.00149342 0.0018154 0.00273127 0.00345849 0.000925488 0.000521877 0.000434426 0.00042733 0.000357719 0.000302131 0.000283849 0.000270995 0.00025166 0.000223443 0.000211054 0.00024962 0.000349412 0.000482805 0.000597344 0.000577401 0.00050794 0.0005062 0.000497383 0.000471415 0.000463825 0.00040237 0.000501909 0.000787706 0.00106358 0.00174603 0.00320609 0.00149325 0.00172615 4.12899e-05 2.62074e-05 5.56842e-05 0.000408695 0.00254194 0.00299403 0.00132226 0.000641625 0.000422536 0.000344664 0.00029878 0.000270507 0.000256517 0.000237792 0.000235539 0.000217883 0.000197618 0.000212019 0.000308796 0.00088492 0.00346193 0.00269789 0.00234623 0.00245201 0.00228939 0.00172521 0.000945045 0.000578268 0.000428367 0.000353642 0.00314896 0.0018556 0.00141912 0.0014671 0.00162744 0.00197083 0.00336488 0.00207524 0.00191039 0.00295096 0.00113579 0.000754168 0.000515224 0.00092747 0.00126647 9.56708e-05 5.99102e-05 6.75652e-05 6.37341e-05 6.50781e-05 6.70366e-05 6.83199e-05 7.34284e-05 8.32599e-05 9.89066e-05 0.000100731 9.26904e-05 0.000125612 0.000320889 0.00120627 0.00232509 0.00169816 0.00129596 0.00118037 0.00145962 0.00238726 0.00235158 0.000424292 0.000104038 5.90728e-05 5.65806e-05 7.81645e-05 0.000100925 0.000100914 0.000117636 0.000114165 0.000117794 0.000112535 0.000111091 0.000106903 9.96985e-05 8.70113e-05 6.74942e-05 5.47247e-05 3.99254e-05 3.34344e-05 3.11766e-05 3.95887e-05 0.000128904 0.00151774 0.00029494 0.000454904 0.00111567 0.00256953 0.00295472 0.00179294 0.000715321 0.000352883 0.00031251 0.000446973 0.00114454 0.00334263 0.0013197 0.000637312 0.000443201 0.000334459 0.000256221 0.000304639 0.000378714 0.000474683 0.000566972 0.000598935 0.000556028 0.000512273 0.000399734 0.000324144 0.000269608 0.000181993 0.000140856 0.00018035 0.000307445 0.000740432 0.00147779 0.00157539 0.00155275 0.00187038 0.00339017 0.00220526 0.000690371 0.000593165 0.00118853 0.00292776 0.00219366 0.00191962 0.00123835 0.000891561 0.000875665 0.000742748 0.000605846 0.000542004 0.000300813 0.000203625 0.000104505 6.82238e-05 4.10914e-05 4.53503e-05 0.000136553 0.00334154 0.00035081 9.63023e-05 0.000302741 0.000908919 0.00206459 0.00297309 0.00311607 0.000569735 0.000291502 0.000525796 0.00206744 0.00300537 0.00260224 0.00288549 0.00264794 0.00333673 0.00319974 0.00233976 0.000932245 0.000316499 0.000114911 4.52116e-05 3.31124e-05 5.32645e-05 0.00017744 0.000892701 0.00328644 0.00147839 0.000736247 0.000355464 0.000170213 9.2869e-05 0.00345287 0.0018577 0.000496337 0.000503554 0.000395221 0.000725032 0.001882 0.003807 0.00568336 0.00568355 0.00638989 0.00576973 0.00244199 0.000513564 0.000317009 0.000194094 0.000514351 0.00101701 0.00188475 0.00253301 0.0023479 0.0018649 0.00115394 0.000661029 0.000445005 0.000287229 0.000553418 0.00246275 0.00794472 0.00749773 0.00821798 0.00783361 0.00831363 0.0102611 0.00930408 0.00845699 0.00808257 0.00764081 0.00778644 0.00892993 0.00923847 0.00749179 0.00524056 0.00377428 0.00503443 0.00669426 0.00829922 0.00793369 0.00781151 0.00580166 0.0034041 0.00279802 0.0028864 0.00315938 0.00330519 0.00321978 0.00318496 0.00299057 0.0032857 0.00431532 0.00694873 0.00886839 0.00967975 0.00846803 0.00293458 0.000890421 0.000491303 0.000323125 0.000329226 0.000986637 0.00183902 0.00193385 0.00196291 0.00250684 0.00262347 0.00203182 0.00199542 0.0022733 0.00219055 0.00204397 0.0020261 0.00222243 0.00265838 0.00318032 0.00351349 0.00353973 0.00354963 0.00355143 0.00355301 0.00357703 0.00375355 0.00410064 0.00400742 0.0044097 0.00391962 0.0036374 0.0037369 0.00462141 0.00581249 0.00393007 0.00149706 0.00134719 0.00215898 0.00313166 0.00220789 0.000318426 0.000345132 0.0010718 0.00288783 0.00331855 0.00284195 0.00277375 0.00285884 0.00292044 0.00291423 0.00292045 0.00287154 0.00280776 0.00272601 0.00260832 0.00253314 0.00249132 0.00247652 0.00247211 0.00247072 0.00257287 0.00266725 0.0029527 0.00328347 0.00347738 0.00352567 0.00351626 0.00297095 0.00289781 0.00172904 0.000421967 0.00023677 0.000339548 0.000479096 0.000743917 0.000998477 0.00138224 0.00146523 0.00196737 0.00199186 0.00222384 0.00217048 0.0022662 0.0020937 0.00205264 0.00175254 0.00152937 0.00140349 0.00122374 0.00131829 0.00139194 0.0023718 0.00345792 0.00320711 0.00243445 0.001886 0.00170994 0.00193275 0.00262061 0.00334548 0.000664475 0.00046042 0.000438349 0.000401133 0.000334373 0.000290128 0.000258563 0.000227954 0.00019923 0.000185128 0.000188883 0.000245466 0.000346314 0.000482375 0.000589805 0.000503902 0.000460346 0.000485562 0.000517399 0.000588033 0.000655321 0.000645495 0.000692862 0.000978565 0.00124888 0.00320565 0.00247255 0.00142627 0.00163387 4.40609e-05 3.12958e-05 0.000152344 0.00104524 0.00321102 0.00241512 0.000929328 0.000522489 0.000385807 0.00029978 0.0002545 0.000222013 0.000212041 0.000214282 0.000212962 0.000201857 0.00018507 0.00019144 0.000294694 0.00103166 0.00345378 0.00203255 0.00152067 0.00129341 0.00102317 0.000744465 0.000599499 0.000730178 0.00102681 0.000814089 0.00215504 0.00149924 0.00162103 0.00211387 0.00235727 0.00293492 0.00320016 0.00165472 0.00304396 0.00241997 0.00120414 0.00098907 0.00076868 0.00136615 0.00142742 0.000129499 6.46946e-05 6.43784e-05 6.1903e-05 6.48872e-05 6.84447e-05 6.85724e-05 6.87837e-05 8.25704e-05 0.000127513 0.000169414 0.000218281 0.000313938 0.000814576 0.00150954 0.00200305 0.00152394 0.00111923 0.00123986 0.00169289 0.00341935 0.000628452 0.000169948 7.56209e-05 6.3736e-05 6.36541e-05 9.24813e-05 0.000114141 0.000127463 0.000148304 0.000152924 0.000140134 0.000130019 0.000117765 0.000115107 0.000113208 0.000103017 8.36265e-05 6.32656e-05 4.81678e-05 3.46378e-05 2.73118e-05 2.6659e-05 3.62413e-05 0.000104413 0.000320227 0.000611009 0.00238789 0.00182897 0.000804448 0.00155563 0.00299382 0.000827918 0.000386918 0.000401547 0.000810975 0.00328482 0.000912547 0.000448341 0.000369035 0.000312721 0.00032741 0.000387749 0.000472137 0.000579262 0.00066606 0.000741969 0.000720088 0.000731239 0.000551724 0.00037972 0.000276638 0.000186479 0.000148675 0.000127964 0.00100057 0.00129345 0.00247605 0.00366169 0.0036458 0.00330642 0.00412637 0.0016819 0.000732373 0.000736847 0.00247042 0.00330775 0.00261339 0.00202733 0.00242818 0.00169231 0.000990326 0.000720943 0.000669565 0.000612592 0.000358967 0.000231958 0.000118006 7.68255e-05 5.24604e-05 4.00644e-05 3.93578e-05 0.000173397 0.00207025 0.000106027 0.000325016 0.00194899 0.00340415 0.00225542 0.00122005 0.000527491 0.000477851 0.000863605 0.00240991 0.00288306 0.00259027 0.00150868 0.00137857 0.00179447 0.0024498 0.00149052 0.0010577 0.000431567 0.000197758 9.61356e-05 5.42362e-05 3.21858e-05 2.9665e-05 7.37821e-05 0.000304333 0.00160724 0.0026421 0.00104906 0.000296259 0.000109892 0.00423087 0.000855398 0.00070195 0.000384959 0.000427514 0.000649245 0.00226076 0.00503272 0.00531945 0.00446055 0.00489867 0.00595879 0.00547667 0.00198775 0.000787283 0.000201308 0.000331463 0.000424655 0.000641633 0.000896067 0.000937458 0.000770878 0.000609788 0.000406824 0.00023026 0.000221226 0.000278195 0.000720053 0.00445703 0.00768413 0.00775062 0.0097707 0.010955 0.00986272 0.010553 0.00741461 0.00548246 0.00497908 0.00585933 0.00729035 0.00671724 0.00502013 0.00481682 0.00502301 0.00562597 0.00614275 0.00723197 0.00856287 0.00851163 0.0082055 0.00774445 0.0048777 0.003023 0.00242265 0.00247564 0.0026373 0.00271924 0.00281871 0.0029363 0.00362177 0.00531751 0.00778782 0.00896752 0.00897526 0.00600367 0.00233859 0.00122753 0.0011702 0.000710801 0.00059415 0.0011985 0.00207935 0.00211186 0.00195799 0.00194411 0.0020822 0.00190115 0.00200139 0.00227591 0.00244234 0.00249177 0.00219512 0.00193013 0.00189205 0.00191579 0.00203344 0.00221364 0.00247437 0.00276661 0.00302847 0.00318945 0.00331402 0.00341454 0.00347664 0.00352042 0.00351133 0.00351027 0.00366003 0.00462691 0.00456219 0.00477412 0.00566102 0.00423463 0.0018211 0.00137994 0.00176052 0.00270846 0.00325151 0.00349186 0.00165181 0.000621904 0.000271698 0.000476473 0.00093779 0.00233055 0.00347282 0.00280112 0.00262516 0.00262955 0.00271125 0.00269742 0.00262082 0.00260093 0.00259214 0.00257136 0.00259931 0.00260841 0.00261869 0.00262205 0.00266684 0.00272753 0.00284765 0.00307814 0.00330755 0.00349672 0.00350516 0.00349921 0.00301402 0.00284515 0.00334564 0.00132185 0.000445906 0.000408983 0.000209411 0.000218529 0.000337322 0.000471489 0.000691621 0.000833342 0.001086 0.00121582 0.00132347 0.00141222 0.0013531 0.00126567 0.00117493 0.000989404 0.000940332 0.000833903 0.000825325 0.000830477 0.000796277 0.000760446 0.000712931 0.00072012 0.000813563 0.0012592 0.00267452 0.00346222 0.00258435 0.00231789 0.00259409 0.00295606 0.00352267 0.00214001 0.000491665 0.000428341 0.000460858 0.000449203 0.000425539 0.000386724 0.000321175 0.000270945 0.000229454 0.000200089 0.000211455 0.000263109 0.000349123 0.000466286 0.000564762 0.000501777 0.000453446 0.000606569 0.000876599 0.00116486 0.00135722 0.00134376 0.00140023 0.00163055 0.00268535 0.0032595 0.00178056 0.00131179 0.00148 0.00327223 0.000145783 4.15244e-05 5.71568e-05 0.000345304 0.00247399 0.00305087 0.00164855 0.000749071 0.00046717 0.000327507 0.000248571 0.000201518 0.000180802 0.000193377 0.000208142 0.000213208 0.00018923 0.000171661 0.000179053 0.000283709 0.000757225 0.00287796 0.00327331 0.00273703 0.00215769 0.00150884 0.00108941 0.00118422 0.00191233 0.00244277 0.00215842 0.00194579 0.00159348 0.00146972 0.00163809 0.00232811 0.00296596 0.00349851 0.00351391 0.00232503 0.00209979 0.00353349 0.00198415 0.00141955 0.0013982 0.00125939 0.00197827 0.00201426 0.000212849 7.36629e-05 6.06554e-05 6.66353e-05 7.20307e-05 6.49899e-05 6.58187e-05 6.51081e-05 8.17495e-05 0.000122903 0.000270369 0.00046004 0.000806855 0.00232162 0.00344691 0.00286253 0.00197437 0.00164798 0.00126897 0.00120055 0.00118911 0.00220397 0.00183606 0.000282484 0.00011094 6.60658e-05 6.38268e-05 7.7688e-05 9.57604e-05 0.000143399 0.00014723 0.00017493 0.000170511 0.000163915 0.000140289 0.000115376 0.00010974 0.000109748 0.000105419 8.26621e-05 5.87694e-05 4.7018e-05 3.66137e-05 2.60472e-05 2.07866e-05 2.27069e-05 4.99786e-05 0.000626516 0.00354072 0.000738648 0.000435868 0.00141011 0.00285813 0.00061788 0.000410908 0.000742806 0.0034371 0.00106254 0.000479485 0.000637823 0.00237628 0.00107831 0.000399675 0.000342589 0.000345772 0.00038307 0.000458814 0.00060554 0.000748904 0.000830552 0.000922589 0.00106284 0.0012967 0.00135211 0.000794947 0.000389132 0.00018731 0.000111013 7.89269e-05 0.000119879 0.000232258 0.000846963 0.00292481 0.00181169 0.00291117 0.00419205 0.00378539 0.00348636 0.0015823 0.000806174 0.000859352 0.00225719 0.00313727 0.00327624 0.00364051 0.00292328 0.00214346 0.00125392 0.000783178 0.000631631 0.000614386 0.000474228 0.000306723 0.000148369 8.43155e-05 6.35551e-05 4.72858e-05 2.87173e-05 4.70239e-05 0.000562191 0.000383347 0.000354018 0.00129679 0.00089143 0.00326202 0.000929692 0.000770882 0.000692099 0.000526245 0.000505936 0.00133902 0.00255753 0.00313734 0.00241814 0.00193898 0.00135674 0.00147639 0.00160502 0.00137043 0.000694578 0.000378142 0.000201849 0.000104971 5.30829e-05 4.08883e-05 3.43263e-05 3.92437e-05 6.01767e-05 0.000169688 0.000614237 0.00362804 0.000983424 0.000128516 7.12958e-05 0.000895465 0.00261649 0.0016251 0.000574694 0.000459449 0.00035014 0.000551841 0.000752698 0.0011217 0.00161293 0.00188111 0.00420389 0.00480218 0.00533161 0.00247046 0.000995537 0.000344513 0.000285975 0.000299741 0.000314112 0.000400945 0.000455691 0.000434626 0.000361122 0.000303533 0.000157667 0.000187418 0.000216032 0.000794996 0.00172206 0.0043259 0.000990762 0.00114184 0.00661655 0.01188 0.00906733 0.00763607 0.00973843 0.00692778 0.00444907 0.00443515 0.00529411 0.00668251 0.00688815 0.00572147 0.00514016 0.00536155 0.00594627 0.00646275 0.00721281 0.00796463 0.00862461 0.00858967 0.00791008 0.00624363 0.00403191 0.00286245 0.00268204 0.00282834 0.00312594 0.00379463 0.00511967 0.00652655 0.00773939 0.00804206 0.00631253 0.00345191 0.00171922 0.001443 0.00158275 0.00123594 0.000932328 0.0011501 0.00191743 0.00221362 0.0020993 0.0020191 0.00202524 0.00206755 0.00239872 0.00261452 0.00286933 0.00273888 0.00226734 0.00193216 0.00185401 0.0018359 0.00193485 0.00219677 0.00267696 0.00320481 0.00348991 0.00351717 0.00352331 0.00352482 0.00354989 0.00356006 0.00356771 0.00355854 0.00350778 0.00342574 0.00345237 0.00454984 0.00474109 0.00367221 0.00184116 0.00162557 0.00251016 0.0034041 0.00346492 0.00322483 0.00133551 0.000542618 0.000280638 0.000261813 0.000417125 0.000641196 0.00118823 0.00290505 0.00337133 0.00277505 0.00258177 0.00251754 0.00246826 0.00243605 0.00240962 0.00242882 0.00248593 0.0025603 0.00268633 0.00280757 0.00288596 0.00298031 0.00307032 0.00315283 0.00329207 0.00335105 0.00332225 0.00315402 0.0028606 0.00281018 0.00338895 0.00137306 0.000392059 0.000195958 0.00024293 0.000206335 0.000255915 0.000395325 0.000600187 0.000853533 0.00120582 0.00144174 0.00179168 0.00195647 0.00202706 0.00204426 0.00172062 0.00154976 0.00147664 0.00156192 0.00167329 0.00203207 0.00227054 0.00261853 0.00245435 0.00313881 0.00168069 0.00123827 0.000985698 0.00110931 0.00162883 0.00345967 0.00311402 0.00281995 0.00330581 0.00297076 0.00105547 0.000440628 0.000441244 0.00048282 0.000504936 0.000539962 0.00055653 0.000527118 0.00046287 0.000360696 0.000294284 0.000281466 0.000312578 0.000377491 0.000442525 0.000532517 0.000553924 0.000486247 0.000626507 0.00117294 0.00181167 0.00231392 0.00241449 0.00267413 0.00307204 0.00349701 0.0024903 0.00141967 0.00107593 0.00100128 0.00261876 8.36573e-05 5.44838e-05 0.000142007 0.000876409 0.00313625 0.00279313 0.00131753 0.000684403 0.000414895 0.000275216 0.000200511 0.000169342 0.000172022 0.000204986 0.000242992 0.000240997 0.000202203 0.000167044 0.00016095 0.000207874 0.000414124 0.000819599 0.00134034 0.00180235 0.002636 0.0034489 0.00274287 0.00234495 0.00216836 0.00195985 0.00171704 0.00149452 0.00144275 0.0016399 0.00217297 0.00304043 0.00357725 0.00338781 0.00274854 0.00243993 0.00283915 0.00313574 0.00198199 0.00183457 0.00205611 0.00228893 0.00294114 0.00227107 0.000354505 0.000103609 6.14448e-05 6.70564e-05 8.69993e-05 6.43172e-05 6.37273e-05 6.34172e-05 7.60278e-05 0.000128734 0.000357832 0.000822439 0.0013513 0.00271839 0.00341413 0.00281864 0.00209468 0.00146574 0.00123718 0.00110248 0.00142347 0.00317715 0.000784528 0.00017624 9.05903e-05 6.40128e-05 6.75165e-05 8.00014e-05 0.000103483 0.000137483 0.000168792 0.000176961 0.000186254 0.000172095 0.000154878 0.000113686 0.000100615 0.000100934 0.000100827 7.13508e-05 4.15409e-05 3.23708e-05 3.12291e-05 2.62412e-05 1.87219e-05 1.80711e-05 2.0377e-05 4.20876e-05 9.46994e-05 0.000679201 0.00184848 0.00052697 0.00136306 0.0031309 0.00100834 0.000382988 0.000573677 0.00275537 0.00163053 0.00085322 0.00160594 0.0024779 0.000467315 0.000328218 0.000362252 0.000414463 0.000534031 0.000724293 0.000965051 0.000968007 0.00134014 0.00164882 0.00247888 0.00260742 0.00165266 0.000707445 0.000248668 9.34367e-05 4.86161e-05 4.14036e-05 4.2839e-05 5.40659e-05 0.000131615 0.000827997 0.00373974 0.00326766 0.00174501 0.00179142 0.00140425 0.000852503 0.00078563 0.00163641 0.00220747 0.00370087 0.00360686 0.00297117 0.00238123 0.00114026 0.000720525 0.00058426 0.000607129 0.000464097 0.000364364 0.000180143 8.04016e-05 5.94552e-05 4.78746e-05 4.17921e-05 2.78926e-05 7.50798e-05 0.00366645 0.000306749 0.000997017 0.00307871 0.000911847 0.000626289 0.000460609 0.000539916 0.000476054 0.000655771 0.00125005 0.00170973 0.00142009 0.00117974 0.000937953 0.00112773 0.00133924 0.00154232 0.000924719 0.000523422 0.000234543 0.000124133 8.10112e-05 7.05736e-05 4.32594e-05 4.69093e-05 3.56797e-05 3.78234e-05 4.99625e-05 0.000103768 0.000307437 0.00161144 0.00135041 0.000256673 0.000382869 0.00109543 0.00234717 0.0049915 0.00485879 0.00203015 0.00158382 0.000937404 0.00165375 0.00180056 0.00302439 0.00523357 0.0053445 0.00402053 0.00117009 0.000567259 0.000280626 0.000362375 0.000271519 0.000261059 0.000269923 0.000315006 0.000306543 0.00027827 0.000217977 0.000138757 0.00014159 0.00012255 0.000230278 0.000887981 0.000708613 0.000558587 0.000173292 0.00575917 0.0104508 0.00816357 0.00728315 0.00891556 0.00648358 0.00373236 0.00375872 0.00479799 0.00630375 0.00703978 0.00635438 0.00544998 0.00511191 0.0052787 0.00533277 0.00539403 0.00585378 0.00733963 0.008049 0.00819371 0.00792936 0.00717 0.00620617 0.00549202 0.00564016 0.00602404 0.00641841 0.00681117 0.00677071 0.00531956 0.00335936 0.00181713 0.00164961 0.00168516 0.00161812 0.00141604 0.00121039 0.00140605 0.00198253 0.00230825 0.00229677 0.00229451 0.0025534 0.00282745 0.00307759 0.00334184 0.00340633 0.00326691 0.00287444 0.00237805 0.0022077 0.00214885 0.00242051 0.00295907 0.00345676 0.0035529 0.00354745 0.00349351 0.00324396 0.00316968 0.00333124 0.00353822 0.00359944 0.0035059 0.00345862 0.00356409 0.00348123 0.00325515 0.00308967 0.00271797 0.00189468 0.00188839 0.0028143 0.00332522 0.00240091 0.00186116 0.00106716 0.000446372 0.00024776 0.000195382 0.000257702 0.000357162 0.000448568 0.000595871 0.000977385 0.00227519 0.00353254 0.00309451 0.00283652 0.00275612 0.00271855 0.00269839 0.00262612 0.0025754 0.00249377 0.00253808 0.0026423 0.00279702 0.00286795 0.0029649 0.00300649 0.00299645 0.00290286 0.00277247 0.00277669 0.00294674 0.00352383 0.00132766 0.000443701 0.000219754 0.000221289 0.000248069 0.000243329 0.000245271 0.000369897 0.000559196 0.000868749 0.00136985 0.00197368 0.00233292 0.0026757 0.00286921 0.00285613 0.00279847 0.00278073 0.00282079 0.0028603 0.00279147 0.00268572 0.00271825 0.00260921 0.00280015 0.00303004 0.00340001 0.00281364 0.00178819 0.00114146 0.0011836 0.0018452 0.00357424 0.00325135 0.00353919 0.00156402 0.00066305 0.00039359 0.000400769 0.00037602 0.000363278 0.000373798 0.000435661 0.000566847 0.000660446 0.000606929 0.000485579 0.000435255 0.000438768 0.000450565 0.000452126 0.000495268 0.000597147 0.000567818 0.000533662 0.000769271 0.00139331 0.00216582 0.00267977 0.00301639 0.00351803 0.0032898 0.00193284 0.00107268 0.000831639 0.00143612 0.000259097 6.97322e-05 0.000109944 0.000433748 0.00225003 0.00321221 0.0024571 0.00117324 0.000614475 0.000355492 0.000232423 0.000169678 0.000152812 0.000171743 0.000243264 0.000300854 0.000280103 0.000246611 0.000165393 0.000150263 0.000167587 0.000231695 0.000323731 0.000436803 0.000501412 0.00091911 0.00224718 0.00355653 0.00298915 0.00251091 0.00199025 0.00173104 0.00162482 0.00166952 0.00191635 0.00240165 0.00305262 0.00355211 0.00352323 0.00320875 0.00329964 0.00353539 0.00273691 0.00226473 0.00261105 0.00321903 0.00348306 0.00325979 0.00145862 0.000464429 0.000155871 7.14051e-05 6.22482e-05 7.08984e-05 5.97601e-05 6.17391e-05 6.3735e-05 7.86461e-05 0.000109791 0.000318216 0.00095308 0.00135925 0.0013943 0.00210874 0.00339567 0.00276906 0.00171205 0.00129491 0.00133516 0.00178567 0.00276197 0.000465414 0.000150529 8.39728e-05 6.62632e-05 6.5951e-05 8.24595e-05 9.64953e-05 0.000133011 0.000149609 0.0001746 0.000174271 0.00017303 0.000149797 0.000115714 9.70371e-05 9.32109e-05 9.53808e-05 6.40002e-05 2.98043e-05 1.81133e-05 1.86086e-05 2.06763e-05 1.83904e-05 1.32415e-05 1.29585e-05 2.16877e-05 2.43107e-05 5.20043e-05 0.000409989 0.00331498 0.00111186 0.0013057 0.00202831 0.00328847 0.000692339 0.000501796 0.00144758 0.00299325 0.00226286 0.00339546 0.000916289 0.000405773 0.000370485 0.000430632 0.000555376 0.000868217 0.00110937 0.00168545 0.00229321 0.00281457 0.00317341 0.0037072 0.00230183 0.00101693 0.000290005 9.20508e-05 3.32013e-05 1.8505e-05 1.75116e-05 2.22765e-05 3.02863e-05 9.31767e-05 0.00049709 0.002296 0.00191452 0.00122464 0.000996593 0.000892592 0.000731595 0.00118589 0.00136123 0.00169194 0.00229987 0.00135754 0.0010615 0.000737455 0.000586228 0.000502278 0.00059232 0.000459222 0.00029879 0.000150047 7.48296e-05 5.38376e-05 5.2013e-05 4.8355e-05 4.73244e-05 5.02868e-05 0.000216771 0.00367831 0.00129377 0.00303707 0.00144806 0.000654635 0.000560581 0.000429123 0.000403972 0.000468067 0.000474237 0.000572527 0.000392001 0.00057261 0.000948401 0.00155575 0.00188749 0.00116342 0.000669126 0.000222347 0.000134368 0.000100637 7.23041e-05 4.67716e-05 4.3798e-05 3.51922e-05 4.07281e-05 3.36521e-05 3.47219e-05 4.39484e-05 6.57246e-05 0.000127548 0.00042432 0.00262252 0.00200301 0.0012008 0.00129028 0.00189532 0.00311261 0.00353137 0.00409923 0.00506265 0.00472135 0.00447381 0.00412255 0.00306736 0.00196199 0.000724685 0.00046269 0.000211017 0.000311317 0.000311049 0.000327896 0.000269312 0.000251008 0.000228756 0.00025254 0.000221964 0.000222266 0.000154718 0.000148843 0.000138718 0.000182195 0.000290401 0.00030084 0.000204973 0.000115417 0.00500219 0.00921441 0.00822021 0.00782391 0.00917057 0.00580432 0.00291931 0.00280411 0.00394307 0.0058437 0.00681076 0.00659541 0.00554088 0.005011 0.00509059 0.00496853 0.00385496 0.00339235 0.00401906 0.00534294 0.00638809 0.00717415 0.00766708 0.00742758 0.00719873 0.00684943 0.00650799 0.00571699 0.00437176 0.00288179 0.0018742 0.00180441 0.00179691 0.00173796 0.00163016 0.00153631 0.00152172 0.00178816 0.00223494 0.00250795 0.00249091 0.00253643 0.00274726 0.0031377 0.00343972 0.00350448 0.00335096 0.00322685 0.00341608 0.00346869 0.00331887 0.00326715 0.0034245 0.00355461 0.00352298 0.00342773 0.00359104 0.00351155 0.00325265 0.00306724 0.0030078 0.00318785 0.00351847 0.00359076 0.00343866 0.00351314 0.00357704 0.00333316 0.00282027 0.00227732 0.00192407 0.00198824 0.00298728 0.00306619 0.00155691 0.00108419 0.00072383 0.000422863 0.000236732 0.000177237 0.000188248 0.000275456 0.000401715 0.000477991 0.000464374 0.000467548 0.000599927 0.00101692 0.00205236 0.0030701 0.00332918 0.00340201 0.00349337 0.00345519 0.00340421 0.00319659 0.00297866 0.0027333 0.00284684 0.00264993 0.00271087 0.00270521 0.00273418 0.00286363 0.00314034 0.00350872 0.00284677 0.00111052 0.000418356 0.000223575 0.000206372 0.000277315 0.000374536 0.000330272 0.000323246 0.000300943 0.000370369 0.00062535 0.00113026 0.00179126 0.00255142 0.00317967 0.00338854 0.00357848 0.00354744 0.00356744 0.00346232 0.00307808 0.00236543 0.00179154 0.00170246 0.00199786 0.00230448 0.00307584 0.00329331 0.00358453 0.00280009 0.0014406 0.00118802 0.00150567 0.00322146 0.00351333 0.00301149 0.000965074 0.000471491 0.000358062 0.000324064 0.000312477 0.000314835 0.000321523 0.000316244 0.000338403 0.000566773 0.000712891 0.000715633 0.000638387 0.000598351 0.000589195 0.00053679 0.000484426 0.000558836 0.00066054 0.000647636 0.000631967 0.000779354 0.00117433 0.00178418 0.00275647 0.0035371 0.00293198 0.00157378 0.00120508 0.00227826 0.00083016 0.000104918 0.000128165 0.000366328 0.00147426 0.00316237 0.00322544 0.0022879 0.00110805 0.000551232 0.000319611 0.000210648 0.000160567 0.00015084 0.000185336 0.000295858 0.000404161 0.000327063 0.000230748 0.000168835 0.000147274 0.000137268 0.000151437 0.000187293 0.000224727 0.00027477 0.000437515 0.00102535 0.00254895 0.00352845 0.00299744 0.00257213 0.00218427 0.00208054 0.00208737 0.00229723 0.00251553 0.00279126 0.00313654 0.00339321 0.00351338 0.00337396 0.00309121 0.00280197 0.00293717 0.00353238 0.00266292 0.0015155 0.00111137 0.000740626 0.000387733 0.000179377 8.89933e-05 6.27516e-05 5.49018e-05 5.55247e-05 5.73639e-05 6.04735e-05 7.88123e-05 0.000100622 0.00022272 0.000449063 0.00050467 0.000448899 0.000560301 0.00108909 0.00288731 0.00290824 0.00198033 0.00195796 0.00311001 0.0014211 0.000374029 0.00014938 8.95086e-05 6.81985e-05 6.67385e-05 7.59967e-05 8.97458e-05 9.80666e-05 0.000114806 0.000125243 0.000148366 0.000142861 0.000128298 0.000103929 8.9644e-05 8.91352e-05 9.08494e-05 5.40464e-05 1.85284e-05 1.01688e-05 1.07961e-05 1.30486e-05 1.32519e-05 1.19025e-05 1.0948e-05 1.23164e-05 1.61467e-05 1.9044e-05 3.34288e-05 0.000162725 0.000694633 0.00263555 0.00350678 0.00298352 0.0035336 0.00137333 0.000703308 0.000819364 0.00217238 0.00292866 0.00143364 0.000700774 0.000460596 0.00048209 0.000583274 0.000736773 0.00109348 0.00170254 0.00263903 0.00300105 0.0034058 0.00342054 0.00245113 0.000876737 0.000274138 6.87946e-05 2.33549e-05 1.11085e-05 8.62466e-06 9.68673e-06 1.53319e-05 2.86587e-05 8.84966e-05 0.000428903 0.00154299 0.00148615 0.000919061 0.000780258 0.000667863 0.000599253 0.000790208 0.000610483 0.000629107 0.000458479 0.000498135 0.000489079 0.000495894 0.000529212 0.000583474 0.000401955 0.000222207 0.000107942 5.40987e-05 4.25345e-05 4.23943e-05 5.35753e-05 6.5259e-05 4.93995e-05 5.76662e-05 0.000228068 0.00209185 0.00331347 0.00402436 0.00411914 0.00187791 0.00120004 0.000857553 0.00078244 0.000792357 0.00082578 0.00148145 0.00298606 0.00282592 0.00195219 0.000788975 0.000512808 0.000294966 0.000115066 8.86081e-05 8.11098e-05 5.25382e-05 4.77028e-05 3.63388e-05 3.59415e-05 3.17571e-05 3.72071e-05 3.71039e-05 3.74162e-05 4.00192e-05 3.48103e-05 5.11208e-05 6.87937e-05 0.000153753 0.000344162 0.000816285 0.00184873 0.00238448 0.00214863 0.00153515 0.00200143 0.00157602 0.00128612 0.000517806 0.000344877 0.000368829 0.000361855 0.000175308 0.000111635 0.000233109 0.000295333 0.00034961 0.000310302 0.000242852 0.000240236 0.000207116 0.000249139 0.000196359 0.000196607 0.000140332 0.000116113 9.45924e-05 0.000148043 0.00011594 8.84183e-05 4.72635e-05 0.00413437 0.00896297 0.0101884 0.00959185 0.0103998 0.00613473 0.00273007 0.00210823 0.00273284 0.00459609 0.00606599 0.0056768 0.00458426 0.00426847 0.0047993 0.00510157 0.00359976 0.002036 0.0018605 0.00232204 0.00295326 0.00379744 0.00448891 0.00495048 0.0048485 0.004553 0.00382389 0.00292733 0.00195363 0.00206179 0.00214223 0.00215317 0.00205009 0.00193267 0.00191835 0.0020122 0.00225962 0.00256824 0.00275723 0.00272705 0.00274693 0.00282887 0.00308146 0.00337326 0.00350836 0.00332043 0.00282621 0.00277273 0.00251702 0.00238366 0.00268283 0.00285035 0.00285111 0.0027601 0.00282686 0.00312829 0.00349377 0.0035408 0.00333547 0.00305067 0.00285051 0.00275474 0.00291049 0.00315621 0.00333276 0.00332896 0.00305911 0.00262155 0.00219992 0.0020767 0.00240435 0.00325535 0.00290019 0.00143934 0.000979942 0.000695177 0.000461938 0.000295651 0.0002061 0.000191452 0.000213968 0.000285707 0.000524513 0.000784528 0.000770457 0.000492907 0.000361885 0.000371444 0.000510213 0.000887031 0.00125053 0.00144855 0.00189616 0.00236283 0.00293214 0.00344236 0.0034409 0.00328414 0.00326624 0.00310861 0.00319293 0.00336963 0.00355215 0.0033864 0.00247016 0.00132092 0.000699813 0.000370315 0.000220832 0.000169707 0.00028516 0.000369941 0.000485439 0.000511726 0.000471224 0.000374283 0.000342088 0.000344324 0.000600755 0.00119428 0.00242399 0.00338613 0.00351643 0.00346208 0.00338522 0.00342502 0.0035162 0.0032062 0.00215677 0.00142835 0.00114502 0.00137688 0.0021774 0.00291747 0.00340946 0.00337772 0.00325713 0.00226118 0.00182961 0.0024457 0.00337094 0.0034444 0.00166215 0.000651467 0.000366762 0.000366816 0.000312421 0.000307265 0.000303927 0.000297072 0.000314423 0.000350206 0.000410507 0.000693315 0.000812389 0.000766439 0.000697453 0.000720761 0.00074608 0.00057761 0.000508969 0.000604571 0.000733973 0.000806739 0.000837215 0.00103391 0.00136867 0.00234575 0.00339644 0.00306003 0.00270761 0.00318823 0.000655578 0.000247475 0.000209361 0.00048116 0.00140267 0.00305074 0.00347222 0.00315311 0.00225186 0.00111496 0.000593763 0.000332126 0.000211039 0.000162525 0.000165611 0.000242125 0.000437958 0.000509268 0.000377581 0.000224614 0.000166068 0.000141569 0.000126634 0.000115955 0.000120716 0.000146614 0.000157847 0.000216433 0.000369694 0.000769684 0.00163525 0.00306887 0.00344919 0.00306322 0.00285142 0.00299009 0.00324562 0.00338801 0.00339404 0.0033109 0.00326074 0.00329259 0.00330869 0.00337325 0.00351024 0.00328114 0.00162242 0.000852185 0.000564831 0.000415523 0.000305461 0.000233244 0.00014575 0.00010208 6.36549e-05 5.57858e-05 5.35628e-05 5.2962e-05 6.02529e-05 8.55985e-05 9.76914e-05 0.000142313 0.000168792 0.000146896 0.000119099 0.000141333 0.000248862 0.000526191 0.00124012 0.00297099 0.00342493 0.0025637 0.000884751 0.00037128 0.000175794 0.000108744 8.41134e-05 7.38566e-05 7.27733e-05 7.87574e-05 8.58443e-05 9.39716e-05 0.000100513 0.000103672 0.000103292 9.50183e-05 8.6084e-05 8.08664e-05 8.55062e-05 8.67334e-05 3.9283e-05 1.10113e-05 6.44908e-06 6.97148e-06 9.21643e-06 9.97418e-06 9.69418e-06 8.87669e-06 9.31511e-06 1.04528e-05 1.21513e-05 1.55371e-05 2.25193e-05 3.66666e-05 8.33076e-05 0.000179997 0.000443226 0.000941854 0.0014235 0.00106631 0.000793629 0.000766648 0.000898457 0.00105578 0.000758579 0.00060595 0.000578855 0.000613967 0.000873868 0.0011653 0.00253375 0.00330403 0.00364178 0.00351947 0.00225599 0.00123601 0.000509751 0.000163343 4.85031e-05 1.25817e-05 7.23467e-06 5.3885e-06 5.72219e-06 8.8815e-06 1.41685e-05 2.8258e-05 7.77186e-05 0.000259938 0.000912571 0.00106758 0.00101599 0.00088116 0.000609491 0.000514603 0.000554666 0.000379972 0.000368838 0.000457594 0.000458376 0.00050169 0.000557392 0.000468735 0.000272816 0.000109627 4.02336e-05 3.79541e-05 3.39849e-05 4.13312e-05 6.43254e-05 6.81354e-05 6.84577e-05 5.62623e-05 5.57747e-05 9.90812e-05 0.000398667 0.00174073 0.00446767 0.00452768 0.00439616 0.0042774 0.00351799 0.00313262 0.00285995 0.00262581 0.00102933 0.000485359 0.000271239 9.90848e-05 4.68267e-05 7.43318e-05 5.84922e-05 7.4421e-05 6.19094e-05 5.55016e-05 4.03812e-05 3.72134e-05 2.90782e-05 3.02322e-05 2.72002e-05 3.09414e-05 3.0368e-05 3.08304e-05 3.00428e-05 2.72334e-05 2.47013e-05 2.12595e-05 2.69282e-05 2.96139e-05 4.56473e-05 5.54206e-05 0.000138309 0.000140958 0.00020675 0.000248071 0.000271689 0.00018934 0.000137704 0.000157068 0.000104243 0.000118929 0.000116924 0.000173921 0.000310611 0.000368943 0.00034991 0.00031241 0.000268673 0.00027572 0.000225082 0.000237623 0.000185945 0.000185294 8.45543e-05 0.00010641 8.48107e-05 6.28618e-05 7.02355e-05 6.51252e-05 0.00307569 0.00869501 0.0112106 0.0105786 0.0110515 0.0081656 0.00404787 0.00209005 0.00176062 0.00216172 0.00301034 0.00317545 0.00244232 0.00233242 0.00353928 0.0052268 0.0045337 0.0020157 0.00125066 0.00151733 0.00198816 0.0024993 0.00312556 0.00350081 0.00372592 0.00349955 0.00308102 0.00247363 0.00274164 0.00296633 0.00308006 0.00294859 0.00270861 0.00249193 0.0024554 0.0026138 0.00282674 0.00294913 0.00301156 0.00298682 0.00302559 0.00300978 0.00311718 0.00331119 0.0034805 0.00342036 0.00282556 0.00245489 0.00200748 0.0015413 0.00150724 0.00151657 0.0016849 0.00193157 0.00228614 0.00266965 0.00313719 0.00356205 0.00352467 0.00328053 0.0029765 0.0026976 0.00252355 0.00247749 0.00248863 0.00248957 0.00242413 0.00238825 0.0025477 0.00305949 0.0035082 0.00259188 0.00146743 0.00107455 0.000804943 0.000665296 0.000489993 0.000386206 0.000293883 0.000286856 0.00031237 0.000370951 0.000544274 0.00124179 0.00229761 0.00170675 0.000686411 0.000299868 0.000266123 0.000370725 0.000605151 0.00083268 0.00116485 0.00141508 0.00187924 0.00229821 0.00255509 0.00285257 0.00303099 0.00284738 0.00250352 0.00187053 0.001336 0.000923052 0.000650795 0.000451812 0.000312484 0.000243564 0.000206422 0.000263819 0.000274197 0.000487224 0.000529373 0.000537223 0.000502844 0.000511674 0.000417697 0.000350734 0.000296841 0.000516827 0.00112297 0.00249602 0.00350613 0.00335081 0.00314867 0.00311783 0.00326049 0.00351024 0.00281404 0.0015556 0.00108713 0.000901416 0.00119483 0.00185267 0.00278765 0.00296075 0.00309119 0.00301033 0.00305126 0.00306552 0.00291854 0.00205095 0.000866499 0.000450043 0.000411801 0.000389669 0.000353051 0.000337406 0.000327333 0.000346088 0.000357534 0.000389228 0.000524004 0.000801047 0.00106587 0.000946676 0.000731128 0.000677647 0.00081527 0.000903921 0.000648247 0.000522004 0.000566038 0.000680067 0.000812544 0.000995233 0.00125259 0.00149888 0.00223051 0.00217912 0.00122444 0.000650511 0.000428839 0.000514851 0.000891433 0.00181801 0.003019 0.00330345 0.00327751 0.00297957 0.00204266 0.00116557 0.000608693 0.00033919 0.000218781 0.000176456 0.000186827 0.000315351 0.000589671 0.000640225 0.000364467 0.000196347 0.000157752 0.000112636 0.000112312 9.96535e-05 9.586e-05 0.000102939 0.000103277 0.000113822 0.000153008 0.000238051 0.00039758 0.000757496 0.00135338 0.00252228 0.00323966 0.00353336 0.00341979 0.00290341 0.00227963 0.00198892 0.0020066 0.00204764 0.00191858 0.00152586 0.00107915 0.000629129 0.000457242 0.000303173 0.000240607 0.000188806 0.000160192 0.000132697 0.000110546 8.21926e-05 6.62113e-05 5.69743e-05 5.35081e-05 5.38468e-05 6.95608e-05 8.80005e-05 8.63233e-05 9.48117e-05 9.3227e-05 5.71164e-05 4.24752e-05 4.27588e-05 5.37097e-05 8.4088e-05 0.00015594 0.000281586 0.000461535 0.00052727 0.000413195 0.000294082 0.000184225 0.000131003 0.000104592 9.20398e-05 8.2075e-05 8.18942e-05 7.79012e-05 7.78424e-05 7.84096e-05 7.82882e-05 7.44179e-05 7.03541e-05 7.13734e-05 7.21207e-05 8.47961e-05 7.86512e-05 2.63605e-05 6.98206e-06 5.78626e-06 6.0911e-06 6.50861e-06 6.75551e-06 7.00086e-06 6.98959e-06 7.11665e-06 8.14236e-06 9.33669e-06 1.04452e-05 1.18972e-05 1.26394e-05 1.55582e-05 2.0023e-05 3.12932e-05 5.51247e-05 0.000134322 0.000202584 0.000385084 0.000383175 0.000468849 0.000476397 0.000596515 0.000550347 0.000614656 0.000694777 0.000850646 0.00177257 0.00335437 0.00405034 0.00330437 0.00242846 0.00157999 0.000645595 0.000216584 7.14745e-05 2.11691e-05 7.04835e-06 5.15991e-06 5.04721e-06 6.19897e-06 7.24045e-06 1.05501e-05 1.51911e-05 2.32069e-05 4.894e-05 0.0001176 0.000315938 0.000775481 0.000937163 0.000936982 0.000887794 0.00084461 0.000526198 0.000632182 0.000480345 0.000569653 0.000488724 0.000340716 0.000241454 9.42549e-05 5.34887e-05 2.2982e-05 1.15797e-05 4.10227e-05 4.17947e-05 6.13631e-05 7.57106e-05 7.57743e-05 6.39218e-05 5.50812e-05 4.67522e-05 5.72444e-05 0.000100773 0.000234203 0.00044917 0.000614538 0.000621572 0.00046438 0.000281043 0.000175063 0.000117183 6.39266e-05 3.07825e-05 2.73202e-05 1.68713e-05 1.17396e-05 2.49557e-05 5.50265e-05 6.99547e-05 5.91032e-05 4.87761e-05 4.45715e-05 3.36121e-05 3.32936e-05 2.68281e-05 2.81124e-05 2.38621e-05 2.40566e-05 2.59092e-05 2.23694e-05 2.50609e-05 1.73617e-05 1.97252e-05 1.26317e-05 1.1705e-05 2.41352e-05 1.16938e-05 4.83844e-05 2.90367e-05 9.40425e-05 0.00013427 0.000165052 0.000117873 0.000132613 0.00010609 0.000122045 8.73057e-05 0.000119779 0.000116253 0.000320783 0.000328646 0.000377116 0.000333384 0.000369904 0.000330606 0.000296527 0.000258972 0.000263667 0.000165896 0.000127106 9.02927e-05 6.13774e-05 7.94312e-05 7.10388e-05 7.3854e-05 0.00239981 0.00810745 0.0100099 0.00845388 0.00978488 0.00837359 0.00629089 0.00363945 0.00225579 0.00156019 0.00131016 0.00126172 0.00106869 0.00113996 0.00197714 0.00481624 0.00583235 0.0035213 0.00135255 0.00147307 0.00252619 0.00424465 0.00587318 0.0067214 0.00662992 0.0060843 0.00512659 0.00411536 0.00302101 0.00217819 0.00171656 0.00138507 0.00214505 0.00310048 0.00336686 0.00323082 0.00308314 0.00309592 0.00311143 0.00312314 0.0031335 0.00312777 0.00318192 0.00319926 0.0032579 0.0034334 0.00347476 0.0031726 0.00255736 0.001938 0.00150742 0.00143409 0.00140875 0.00152456 0.00176406 0.00218022 0.00263175 0.00311705 0.00349142 0.0035378 0.00345326 0.00318538 0.00290929 0.00269824 0.00263092 0.00263053 0.00270911 0.00298137 0.00328298 0.00349399 0.00323347 0.00263475 0.00209018 0.00161919 0.00137768 0.00122301 0.001059 0.000900136 0.000806016 0.000785943 0.000807309 0.000993761 0.00123188 0.00200566 0.00323084 0.0034581 0.00351884 0.000966205 0.000269319 0.000175644 0.00028403 0.000444017 0.000606445 0.00075043 0.000875949 0.00103512 0.00120724 0.00114291 0.00120428 0.00104576 0.000971386 0.000776381 0.000658168 0.000533069 0.000453251 0.00038711 0.000334143 0.000302278 0.000297878 0.000365927 0.000480464 0.00053245 0.000664768 0.000584739 0.000488883 0.000426181 0.000473543 0.000431698 0.000361547 0.000296108 0.000329671 0.000661412 0.00162871 0.00354417 0.00322823 0.00306684 0.00305404 0.00316832 0.00348268 0.0029662 0.00148318 0.000955198 0.000704133 0.000753336 0.000962434 0.0011232 0.00126343 0.00139881 0.00134243 0.00121769 0.000951853 0.000689624 0.000507079 0.000497671 0.000474537 0.000449516 0.000409015 0.000379044 0.000395463 0.000386683 0.000495372 0.000792457 0.00113602 0.00142249 0.00159027 0.00139056 0.000853727 0.000564286 0.000642183 0.00107282 0.00118102 0.00080865 0.000577441 0.000477187 0.00048449 0.000544432 0.000618249 0.000654197 0.000625006 0.000554713 0.000505914 0.000507707 0.000586301 0.000703077 0.000976304 0.00113347 0.00121765 0.00129486 0.00135216 0.00112448 0.000838472 0.0005975 0.00039473 0.000277672 0.000227042 0.000221758 0.00028739 0.000462602 0.000764741 0.000708792 0.000358775 0.000185554 0.000129625 0.000127805 0.000106326 8.07314e-05 8.07133e-05 8.14482e-05 8.56566e-05 8.06582e-05 8.78298e-05 9.84105e-05 0.000125482 0.000184209 0.000285289 0.000463802 0.000708622 0.000977336 0.00113396 0.00112963 0.00102288 0.000823281 0.000695121 0.00056171 0.00045728 0.000366472 0.000285562 0.000229939 0.00018009 0.000158979 0.000130726 0.000110737 0.000102246 9.62993e-05 9.34726e-05 7.05225e-05 6.96162e-05 5.70645e-05 5.16818e-05 6.30594e-05 8.68349e-05 8.70408e-05 7.19111e-05 8.86364e-05 8.28175e-05 5.15761e-05 3.57299e-05 3.28118e-05 3.23955e-05 3.33221e-05 3.67693e-05 4.59562e-05 6.05842e-05 7.94269e-05 8.40269e-05 0.000103925 9.19129e-05 9.20435e-05 8.0738e-05 8.1467e-05 6.96272e-05 7.15965e-05 6.53154e-05 6.48314e-05 6.19446e-05 6.25562e-05 6.29374e-05 6.43598e-05 6.85125e-05 7.6076e-05 8.89852e-05 6.35376e-05 1.54821e-05 6.21553e-06 6.1159e-06 6.01393e-06 6.07136e-06 6.23804e-06 6.44087e-06 6.55975e-06 6.71632e-06 6.85505e-06 7.29327e-06 8.28887e-06 9.54493e-06 9.63759e-06 1.0137e-05 1.03202e-05 1.09675e-05 1.15203e-05 1.49188e-05 2.0146e-05 3.36668e-05 5.13539e-05 7.35639e-05 0.000127608 0.000143108 0.000242629 0.000257643 0.000409682 0.000630383 0.00117791 0.00201749 0.00183772 0.00121287 0.000714908 0.000353987 0.00015257 7.11626e-05 3.30261e-05 9.39311e-06 4.98444e-06 5.05849e-06 6.21138e-06 7.07071e-06 8.0568e-06 9.28258e-06 1.04169e-05 1.04394e-05 1.30452e-05 1.84231e-05 3.06689e-05 5.66023e-05 8.9101e-05 0.000182021 0.000325578 0.000307439 0.00026726 0.000196738 0.000185096 0.000132357 0.000105992 7.81091e-05 5.30398e-05 3.12097e-05 2.01615e-05 1.2301e-05 1.01474e-05 3.68614e-05 3.99518e-05 6.66058e-05 7.57143e-05 7.43193e-05 6.90594e-05 5.97879e-05 5.25742e-05 4.81581e-05 4.66183e-05 5.00362e-05 5.45161e-05 5.60694e-05 4.28813e-05 3.19468e-05 2.50976e-05 1.19013e-05 1.04963e-05 7.90934e-06 8.54537e-06 7.44817e-06 7.01812e-06 7.8373e-06 2.92565e-05 5.12054e-05 6.47443e-05 4.9051e-05 4.56397e-05 3.2117e-05 3.18048e-05 2.60113e-05 2.54568e-05 2.19683e-05 2.19567e-05 2.18861e-05 1.97212e-05 2.08788e-05 1.77422e-05 1.74772e-05 1.77391e-05 1.60693e-05 1.60836e-05 1.27791e-05 1.17535e-05 3.33779e-05 1.56544e-05 0.000123623 9.37035e-05 0.000203035 0.000206627 0.000161514 0.00014506 0.000107531 0.000114442 0.000120377 0.000117554 0.00023098 0.000351089 0.000328784 0.000425308 0.00041296 0.000439857 0.000369253 0.000325677 0.000249861 0.000194514 0.000128124 9.34816e-05 8.33853e-05 9.12783e-05 0.000101251 0.000104308 0.00152019 0.00713348 0.00931557 0.0054659 0.00615491 0.00536205 0.0049936 0.00390546 0.00317303 0.00251445 0.00195038 0.00160823 0.00140596 0.00161069 0.00201215 0.00390848 0.00633149 0.00633366 0.00270215 0.00137216 0.0025029 0.00538945 0.00696185 0.00510138 0.00405934 0.0035612 0.00321258 0.00284424 0.002479 0.00213237 0.00195423 0.00177514 0.00156008 0.00131573 0.00115275 0.000961855 0.000972399 0.00237371 0.00346197 0.00334157 0.0031006 0.00306959 0.00318243 0.0032371 0.00327736 0.00325301 0.00322972 0.00328049 0.0034672 0.0033515 0.0026725 0.00224996 0.00210584 0.00201999 0.00214357 0.00229461 0.00245724 0.00277012 0.00293577 0.00317088 0.00336602 0.00352608 0.00344984 0.0032461 0.00318574 0.00315769 0.00313035 0.00322193 0.00330565 0.00340294 0.0034502 0.00346257 0.00346844 0.00348755 0.00348096 0.00349147 0.00348855 0.00348811 0.00347472 0.00345672 0.00344497 0.00343548 0.0034319 0.0034236 0.00339005 0.00325099 0.00318327 0.00317831 0.00143568 0.000136834 0.000139265 0.000205105 0.000273094 0.000372536 0.000431415 0.000464635 0.000665836 0.000499753 0.000712561 0.000611634 0.000653474 0.000573441 0.000557216 0.00050583 0.000498966 0.000483299 0.000462857 0.000451969 0.000439283 0.000445524 0.000418344 0.000417126 0.000451191 0.000535446 0.000399371 0.000361181 0.000334478 0.000332509 0.000368027 0.000379632 0.000310227 0.000281054 0.000339259 0.00159602 0.00350878 0.00330037 0.00323352 0.00321848 0.00324316 0.00345843 0.00324389 0.00207874 0.00122342 0.000918124 0.000779053 0.000760645 0.000628585 0.000580631 0.000528164 0.000486501 0.00049726 0.00056322 0.000603678 0.000613272 0.000575881 0.000510873 0.000438159 0.000432767 0.000604625 0.000813006 0.00130872 0.00187849 0.00235851 0.00255684 0.00232117 0.00175855 0.00113926 0.000601855 0.000475598 0.000693263 0.00143813 0.00166182 0.00111361 0.000579557 0.00043763 0.000390503 0.000387497 0.000363686 0.000337879 0.000316673 0.000347016 0.000350676 0.000318986 0.000299927 0.000314812 0.000316996 0.000363138 0.000358088 0.000364806 0.000357019 0.00033971 0.000308948 0.000296084 0.000286229 0.000285179 0.000314539 0.000389013 0.000575288 0.000807907 0.000758053 0.00035629 0.000176073 0.000112628 0.000121307 0.000101381 7.83735e-05 7.35946e-05 7.05679e-05 7.2356e-05 7.33352e-05 7.01447e-05 7.16413e-05 7.27729e-05 8.07096e-05 0.000101179 0.00012458 0.000161855 0.00020767 0.000262704 0.000313165 0.000356583 0.000374354 0.000371569 0.000350259 0.000319713 0.000277005 0.000262861 0.000240012 0.000212523 0.000183415 0.0001784 0.000168874 0.00015797 0.000157152 0.000150855 0.000136751 0.00010948 9.37083e-05 9.41373e-05 8.70963e-05 8.97443e-05 8.59259e-05 5.83814e-05 8.03467e-05 9.67178e-05 9.80689e-05 7.45709e-05 6.79129e-05 6.41067e-05 6.42875e-05 6.31204e-05 5.98005e-05 5.79852e-05 5.84713e-05 6.15657e-05 5.99324e-05 6.54101e-05 6.27841e-05 6.62207e-05 6.59657e-05 6.48733e-05 6.62969e-05 6.44511e-05 6.73616e-05 6.76302e-05 6.9018e-05 6.98591e-05 7.92815e-05 7.98641e-05 8.46462e-05 8.84917e-05 5.09937e-05 8.90221e-06 6.26637e-06 6.4089e-06 6.4464e-06 6.46551e-06 6.4861e-06 6.56063e-06 6.63621e-06 6.65612e-06 6.75307e-06 6.7894e-06 6.95114e-06 7.03856e-06 7.05072e-06 7.2402e-06 7.078e-06 7.15558e-06 6.86658e-06 7.14638e-06 6.49469e-06 8.03572e-06 6.95083e-06 9.91831e-06 1.02978e-05 1.45137e-05 1.60906e-05 2.15338e-05 3.39668e-05 5.31497e-05 0.000151691 0.000210874 0.000196964 0.000100749 7.37377e-05 4.14063e-05 3.5765e-05 3.4306e-05 2.07321e-05 5.5858e-06 4.98865e-06 6.0007e-06 6.2107e-06 5.86894e-06 5.74999e-06 6.12108e-06 5.9652e-06 5.97708e-06 5.49784e-06 5.81944e-06 6.4778e-06 7.61001e-06 8.44573e-06 1.31365e-05 1.96129e-05 1.63072e-05 1.66399e-05 1.54087e-05 1.74454e-05 1.76453e-05 1.90357e-05 1.80585e-05 1.82646e-05 1.32333e-05 1.3817e-05 1.12776e-05 9.82468e-06 3.42611e-05 4.08171e-05 7.39484e-05 7.28984e-05 6.7471e-05 5.83738e-05 5.41964e-05 4.83805e-05 4.31009e-05 4.00854e-05 3.79845e-05 3.61436e-05 2.90718e-05 2.30225e-05 1.63941e-05 1.0813e-05 5.43547e-06 5.9283e-06 6.27351e-06 7.02601e-06 6.95101e-06 6.62859e-06 7.73884e-06 1.56333e-05 5.002e-05 4.36409e-05 4.07138e-05 3.06565e-05 3.07485e-05 2.18706e-05 2.24356e-05 1.71502e-05 1.81982e-05 1.57683e-05 1.7871e-05 1.462e-05 1.43598e-05 1.45428e-05 1.25202e-05 1.50095e-05 1.11685e-05 8.65653e-06 2.07521e-05 6.63641e-06 3.68491e-05 7.36284e-06 7.88625e-05 5.7331e-05 0.000225001 0.000200222 0.000219728 0.000160676 0.000128172 7.97359e-05 0.000103775 0.000153017 0.000184342 0.000308122 0.000382138 0.00041668 0.000470144 0.000464482 0.000412727 0.000363638 0.00028923 0.000171638 0.000156503 8.69982e-05 0.000134959 0.000100453 0.000108927 0.000108183 ) ; boundaryField { wand { type zeroGradient; } frontAndBack { type empty; } } // ************************************************************************* //
[ "ubuntu@ip-172-31-45-175.eu-west-1.compute.internal" ]
ubuntu@ip-172-31-45-175.eu-west-1.compute.internal
c875f534f3eabffa601d473b3f62cfd6ad810e40
50ebc266be198c2f47929f50b61fa70317301bee
/roborobo3/include/MultiNEAT/Genome.h
f03f5143e2cb53cbb24abf7fb082a6dab282cd21
[]
no_license
TrulsStenrud/GNP-with-roborob3
dddec8f1b0e5dce6b85c1b1d051f46fa24cceb9c
ea6a359abb24ee3dbcc76f7d8c93136774217c38
refs/heads/master
2023-05-08T21:55:00.354065
2021-06-04T11:02:29
2021-06-04T11:02:29
338,026,683
1
0
null
null
null
null
UTF-8
C++
false
false
27,323
h
#ifndef _GENOME_H #define _GENOME_H /////////////////////////////////////////////////////////////////////////////////////////// // MultiNEAT - Python/C++ NeuroEvolution of Augmenting Topologies Library // // Copyright (C) 2012 Peter Chervenski // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 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 WARRbbbbbbbbbbANTY; 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 Lesser General Public License // along with this program. If not, see < http://www.gnu.org/licenses/ >. // // Contact info: // // Peter Chervenski < spookey@abv.bg > // Shane Ryan < shane.mcdonald.ryan@gmail.com > /////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // File: Genome.h // Description: Definition for the Genome class. /////////////////////////////////////////////////////////////////////////////// #ifdef USE_BOOST_PYTHON #include <boost/python.hpp> #include <boost/archive/text_oarchive.hpp> #include <boost/archive/text_iarchive.hpp> #include <boost/serialization/vector.hpp> #include <boost/shared_ptr.hpp> #endif #include <boost/shared_ptr.hpp> #include <boost/graph/graph_traits.hpp> #include <boost/graph/adjacency_list.hpp> #include <boost/graph/topological_sort.hpp> #include <vector> #include <queue> #include "NeuralNetwork.h" #include "Substrate.h" #include "Innovation.h" #include "Genes.h" #include "Assert.h" #include "PhenotypeBehavior.h" #include "Random.h" namespace NEAT { ////////////////////////////////////////////// // The Genome class ////////////////////////////////////////////// // forward class Innovation; class InnovationDatabase; class PhenotypeBehavior; extern ActivationFunction GetRandomActivation(Parameters &a_Parameters, RNG &a_RNG); namespace bs = boost; typedef bs::adjacency_list <bs::vecS, bs::vecS, bs::directedS> Graph; typedef bs::graph_traits<Graph>::vertex_descriptor Vertex; class Genome { ///////////////////// // Members ///////////////////// private: // ID of genome int m_ID; // How many inputs/outputs int m_NumInputs; int m_NumOutputs; // The genome's fitness score double m_Fitness; // The genome's adjusted fitness score double m_AdjustedFitness; // The depth of the network int m_Depth; // how many individuals this genome should spawn double m_OffspringAmount; //////////////////// // Private methods // Returns true if the specified neuron ID is present in the genome bool HasNeuronID(int a_id) const; // Returns true if the specified link is present in the genome bool HasLink(int a_n1id, int a_n2id) const; // Returns true if the specified link is present in the genome bool HasLinkByInnovID(int a_id) const; // Removes the link with the specified innovation ID void RemoveLinkGene(int a_innovid); // Remove node // Links connected to this node are also removed void RemoveNeuronGene(int a_id); // Returns the count of links inputting from the specified neuron ID int LinksInputtingFrom(int a_id) const; // Returns the count of links outputting to the specified neuron ID int LinksOutputtingTo(int a_id) const; // A recursive function returning the max depth from the specified neuron to the inputs unsigned int NeuronDepth(int a_NeuronID, unsigned int a_Depth); // Returns true is the specified neuron ID is a dead end or isolated bool IsDeadEndNeuron(int a_id) const; public: // The two lists of genes std::vector<NeuronGene> m_NeuronGenes; std::vector<LinkGene> m_LinkGenes; // To have traits that belong to the genome itself Gene m_GenomeGene; // tells whether this genome was evaluated already // used in steady state evolution bool m_Evaluated; // the initial genome complexity int m_initial_num_neurons; int m_initial_num_links; // A pointer to a class representing the phenotype's behavior // Used in novelty searches PhenotypeBehavior *m_PhenotypeBehavior; // A Python object behavior #ifdef USE_BOOST_PYTHON py::object m_behavior; #endif //////////////////////////// // Constructors //////////////////////////// Genome(); // copy constructor Genome(const Genome &a_g); // assignment operator Genome &operator=(const Genome &a_g); // comparison operator (nessesary for boost::python) // todo: implement a better comparison technique bool operator==(Genome const &other) const { return m_ID == other.m_ID; } // Builds this genome from a file Genome(const char *a_filename); // Builds this genome from an opened file Genome(std::ifstream &a_DataFile); // This creates a CTRNN fully-connected genome //Genome(int a_ID, int a_NumInputs, int a_NumHidden, int a_NumOutputs, // ActivationFunction a_OutputActType, ActivationFunction a_HiddenActType, const Parameters &a_Parameters); //Genome(unsigned int a_ID, unsigned int a_NumInputs, unsigned int a_NumHidden, unsigned int a_NumOutputs,Specifier // ActivationFunction a_OutputActType, ActivationFunction a_HiddenActType, const Parameters &a_Parameters); // This creates a standart minimal genome - perceptron-like structure Genome(int a_ID, int a_NumInputs, int a_NumHidden, // ignored for seed_type == 0, specifies number of hidden units if seed_type == 1 int a_NumOutputs, bool a_FS_NEAT, ActivationFunction a_OutputActType, ActivationFunction a_HiddenActType, int a_SeedType, const Parameters &a_Parameters, int a_NumLayers, int a_FS_NEAT_links); ///////////// // Other possible constructors for different types of networks go here // TODO //////////////////////////// // Destructor //////////////////////////// //////////////////////////// // Methods //////////////////////////// //////////////////// // Accessor methods NeuronGene GetNeuronByID(int a_ID) const; NeuronGene GetNeuronByIndex(int a_idx) const; LinkGene GetLinkByInnovID(int a_ID) const; LinkGene GetLinkByIndex(int a_idx) const; // A little helper function to find the index of a neuron, given its ID int GetNeuronIndex(int a_id) const; // A little helper function to find the index of a link, given its innovation ID int GetLinkIndex(int a_innovid) const; unsigned int NumNeurons() const { return static_cast<unsigned int>(m_NeuronGenes.size()); } unsigned int NumLinks() const { return static_cast<unsigned int>(m_LinkGenes.size()); } unsigned int NumInputs() const { return m_NumInputs; } unsigned int NumOutputs() const { return m_NumOutputs; } void SetNeuronXY(unsigned int a_idx, int a_x, int a_y); void SetNeuronX(unsigned int a_idx, int a_x); void SetNeuronY(unsigned int a_idx, int a_y); double GetFitness() const; double GetAdjFitness() const; void SetFitness(double a_f); void SetAdjFitness(double a_af); int GetID() const; void SetID(int a_id); unsigned int GetDepth() const; void SetDepth(unsigned int a_d); // Returns true if there is any dead end in the network bool HasDeadEnds() const; // Returns true if there is any looping path in the network bool HasLoops(); bool FailsConstraints(const Parameters &a_Parameters) { bool fails = false; if (HasDeadEnds() || (NumLinks() == 0)) { return true; // no reason to continue } if ((HasLoops() && (a_Parameters.AllowLoops == false))) { return true; } // Custom constraints if (a_Parameters.CustomConstraints != NULL) { if (a_Parameters.CustomConstraints(*this)) { return true; } } // for Python-based custom constraint callbacks #ifdef USE_BOOST_PYTHON if (a_Parameters.pyCustomConstraints.ptr() != py::object().ptr()) // is it not None? { return py::extract<bool>(a_Parameters.pyCustomConstraints(*this)); } #endif // add more constraints here return false; } double GetOffspringAmount() const; void SetOffspringAmount(double a_oa); // This builds a fastnetwork structure out from the genome void BuildPhenotype(NeuralNetwork &net); // Projects the phenotype's weights back to the genome void DerivePhenotypicChanges(NeuralNetwork &a_Net); //////////// // Other possible methods for building a phenotype go here // Like CPPN/HyperNEAT stuff //////////// void BuildHyperNEATPhenotype(NeuralNetwork &net, Substrate &subst); #ifdef USE_BOOST_PYTHON py::dict TraitMap2Dict(std::map< std::string, Trait>& tmap) { py::dict traits; for(auto tit=tmap.begin(); tit!=tmap.end(); tit++) { bool doit = false; if (tit->second.dep_key != "") { // there is such trait.. if (tmap.count(tit->second.dep_key) != 0) { // and it has the right value? for(int ix=0; ix < tit->second.dep_values.size(); ix++) { if (tmap[tit->second.dep_key].value == tit->second.dep_values[ix]) { doit = true; break; } } } } else { doit = true; } if (doit) { TraitType t = tit->second.value; if (t.type() == typeid(int)) { traits[tit->first] = bs::get<int>(t); } if (t.type() == typeid(double)) { traits[tit->first] = bs::get<double>(t); } if (t.type() == typeid(std::string)) { traits[tit->first] = bs::get<std::string>(t); } if (t.type() == typeid(intsetelement)) { traits[tit->first] = (bs::get<intsetelement>(t)).value; } if (t.type() == typeid(floatsetelement)) { traits[tit->first] = (bs::get<floatsetelement>(t)).value; } if (t.type() == typeid(py::object)) { traits[tit->first] = bs::get<py::object>(t); } } } return traits; } std::map< std::string, Trait> Dict2TraitMap(py::dict d) { py::list ks = d.keys(); std::map< std::string, Trait> ts; for(int i=0 ; i<py::len(ks); i++) { py::object key = ks[i]; py::object po = d[key]; Trait t; t.value = po; ts[py::extract<std::string>(key)] = t; } return ts; }; py::object GetNeuronTraits() { py::list neurons; for(auto it=m_NeuronGenes.begin(); it != m_NeuronGenes.end(); it++) { py::dict traits = TraitMap2Dict((*it).m_Traits); py::list little; little.append( (*it).ID() ); if ((*it).Type() == INPUT) { little.append( "input" ); } else if ((*it).Type() == BIAS) { little.append( "bias" ); } else if ((*it).Type() == HIDDEN) { little.append( "hidden" ); } else if ((*it).Type() == OUTPUT) { little.append( "output" ); } little.append( traits ); neurons.append( little ); } return neurons; } py::object GetLinkTraits(bool with_weights=false) { py::list links; for(auto it=m_LinkGenes.begin(); it != m_LinkGenes.end(); it++) { py::dict traits = TraitMap2Dict((*it).m_Traits); py::list little; little.append( (*it).FromNeuronID() ); little.append( (*it).ToNeuronID() ); little.append( traits ); if (with_weights) { little.append( (*it).m_Weight ); } links.append( little ); } return links; } py::dict GetGenomeTraits() { return TraitMap2Dict(m_GenomeGene.m_Traits); } void SetGenomeTraits(py::dict traits) { m_GenomeGene.m_Traits = Dict2TraitMap(traits); } #endif // Saves this genome to a file void Save(const char *a_filename); // Saves this genome to an already opened file for writing void Save(FILE *a_fstream); void PrintTraits(std::map< std::string, Trait>& traits); void PrintAllTraits(); // returns the max neuron ID int GetLastNeuronID() const; // returns the max innovation Id int GetLastInnovationID() const; // Sorts the genes of the genome // The neurons by IDs and the links by innovation numbers. void SortGenes(); // overload '<' used for sorting. From fittest to poorest. friend bool operator<(const Genome &a_lhs, const Genome &a_rhs) { return (a_lhs.m_Fitness > a_rhs.m_Fitness); } // Returns true if this genome and a_G are compatible (belong in the same species) bool IsCompatibleWith(Genome &a_G, Parameters &a_Parameters); // returns the absolute compatibility distance between this genome and a_G double CompatibilityDistance(Genome &a_G, Parameters &a_Parameters); // Calculates the network depth void CalculateDepth(); //////////// // Mutation //////////// // Adds a new neuron to the genome // returns true if succesful bool Mutate_AddNeuron(InnovationDatabase &a_Innovs, const Parameters &a_Parameters, RNG &a_RNG); // Adds a new link to the genome // returns true if succesful bool Mutate_AddLink(InnovationDatabase &a_Innovs, const Parameters &a_Parameters, RNG &a_RNG); // Remove a random link from the genome // A cleanup procedure is invoked so any dead-ends or stranded neurons are also deleted // returns true if succesful bool Mutate_RemoveLink(RNG &a_RNG); // Removes a hidden neuron having only one input and only one output with // a direct link between them. bool Mutate_RemoveSimpleNeuron(InnovationDatabase &a_Innovs, const Parameters &a_Parameters, RNG &a_RNG); // Perturbs the weights bool Mutate_LinkWeights(const Parameters &a_Parameters, RNG &a_RNG); // Set all link weights to random values between [-R .. R] void Randomize_LinkWeights(const Parameters &a_Parameters, RNG &a_RNG); // Set all traits to random values void Randomize_Traits(const Parameters& a_Parameters, RNG &a_RNG); // Perturbs the A parameters of the neuron activation functions bool Mutate_NeuronActivations_A(const Parameters &a_Parameters, RNG &a_RNG); // Perturbs the B parameters of the neuron activation functions bool Mutate_NeuronActivations_B(const Parameters &a_Parameters, RNG &a_RNG); // Changes the activation function type for a random neuron bool Mutate_NeuronActivation_Type(const Parameters &a_Parameters, RNG &a_RNG); // Perturbs the neuron time constants bool Mutate_NeuronTimeConstants(const Parameters &a_Parameters, RNG &a_RNG); // Perturbs the neuron biases bool Mutate_NeuronBiases(const Parameters &a_Parameters, RNG &a_RNG); // Perturbs the neuron traits bool Mutate_NeuronTraits(const Parameters &a_Parameters, RNG &a_RNG); // Perturbs the link traits bool Mutate_LinkTraits(const Parameters &a_Parameters, RNG &a_RNG); // Perturbs the genome traits bool Mutate_GenomeTraits(const Parameters &a_Parameters, RNG &a_RNG); /////////// // Mating /////////// // Mate this genome with dad and return the baby // If this is multipoint mating, genes are inherited randomly // If the a_averagemating bool is true, then the genes are averaged // Disjoint and excess genes are inherited from the fittest parent // If fitness is equal, the smaller genome is assumed to be the better one Genome Mate(Genome &a_dad, bool a_averagemating, bool a_interspecies, RNG &a_RNG, Parameters &a_Parameters); ////////// // Utility ////////// // Search the genome for isolated structure and clean it up // Returns true is something was removed bool Cleanup(); //////////////////// // new stuff bool IsEvaluated() const; void SetEvaluated(); void ResetEvaluated(); #if 0 // disabling because of errors I can't fix right now ///////////////////////////////////////////// // Evolvable Substrate HyperNEAT //////////////////////////////////////////// // A connection between two points. Stores weight and the coordinates of the points struct TempConnection { std::vector<double> source; std::vector<double> target; double weight; TempConnection() { source.reserve(3); target.reserve(3); weight = 0; } TempConnection(std::vector<double> t_source, std::vector<double> t_target, double t_weight) { source = t_source; target = t_target; weight = t_weight; source.reserve(3); target.reserve(3); } TempConnection(std::vector<double> t_source, std::vector<double> t_target, double t_weight, unsigned int coord_size) { source = t_source; target = t_target; weight = t_weight; } ~TempConnection() {}; bool operator==(const TempConnection &rhs) const { return (source == rhs.source && target == rhs.target); } bool operator!=(const TempConnection &rhs) const { return (source != rhs.source && target != rhs.target); } }; // A quadpoint in the HyperCube. struct QuadPoint { double x; double y; double z; double width; double weight; double height; double variance; int level; // Do I use this? double leo; std::vector<boost::shared_ptr<QuadPoint> > children; QuadPoint() { x = y = z = width = height = weight = variance = leo = 0; level = 0; children.reserve(4); } QuadPoint(double t_x, double t_y, double t_width, double t_height, int t_level) { x = t_x; y = t_y; z = 0.0; width = t_width; height = t_height; level = t_level; weight = 0.0; leo = 0.0; variance = 0.0; children.reserve(4); children.clear(); } // Mind the Z QuadPoint(double t_x, double t_y, double t_z, double t_width, double t_height, int t_level) { x = t_x; y = t_y; z = t_z; width = t_width; height = t_height; level = t_level; weight = 0.0; variance = 0.0; leo = 0.0; children.reserve(4); children.clear(); } ~QuadPoint() { }; }; struct nTree { std::vector<double> coord; double weight; double varience; int lvl; double width; double leo = 0.0; std::vector<boost::shared_ptr<nTree> > children; nTree(std::vector<double> coord_in, double wdth, double level) { width = wdth; lvl = level; coord = coord_in; }; public: void set_children() { for(unsigned int ix = 0; ix < 2**coord.size(); ix++){ std::string sum_permute = toBinary(ix, coord.size()); std::vector<double> child_coords; int child_param_len = sum_permute.length(); child_coords.reserve(child_param_len); for(unsigned int sign_ix = 0; sign_ix < child_param_len; sign_ix++) { if(sum_permute[sign_ix] == "0") { child_coords.push_back(coord[sign_ix] + width/2.0); } else { child_coords.push_back(coord[sign_ix] - width/2.0); } children.push_back(new nTree(child_coords, width/2.0, sslvl+1)); } } } string toBinary(unsigned int n, int min_len) { std::string r; while(n!=0) { r=(n%2==0 ?"0":"1")+r; n/=2; } if(r.length() < min_len) { int diff = min_len - r.length(); for(unsigned int x = 0; x < diff; x++) { r = '0' +r; } } return r; } }; void BuildESHyperNEATPhenotypeND(NeuralNetwork &a_net, Substrate &subst, Parameters &params); void BuildESHyperNEATPhenotype(NeuralNetwork &a_net, Substrate &subst, Parameters &params); void DivideInitialize(const std::vector<double> &node, boost::shared_ptr<QuadPoint> &root, NeuralNetwork &cppn, Parameters &params, const bool &outgoing, const double &z_coord); void PruneExpress(const std::vector<double> &node, boost::shared_ptr<QuadPoint> &root, NeuralNetwork &cppn, Parameters &params, std::vector<Genome::TempConnection> &connections, const bool &outgoing); void DivideInitializeND(const std::vector<double> &node, boost::shared_ptr<nTree> &root, NeuralNetwork &cppn, Parameters &params, const bool &outgoing, const double &z_coord); void PruneExpressND(const std::vector<double> &node, boost::shared_ptr<nTree> &root, NeuralNetwork &cppn, Parameters &params, std::vector<Genome::TempConnection> &connections, const bool &outgoing); void CollectValues(std::vector<double> &vals, boost::shared_ptr<QuadPoint> &point); double Variance(boost::shared_ptr<QuadPoint> &point); void Clean_Net(std::vector<Connection> &connections, unsigned int input_count, unsigned int output_count, unsigned int hidden_count); #endif #ifdef USE_BOOST_PYTHON // Serialization friend class boost::serialization::access; template<class Archive> void serialize(Archive & ar, const unsigned int version) { ar & m_ID; ar & m_NeuronGenes; ar & m_LinkGenes; //ar & m_GenomeGene; ar & m_NumInputs; ar & m_NumOutputs; ar & m_Fitness; ar & m_AdjustedFitness; ar & m_Depth; ar & m_OffspringAmount; ar & m_Evaluated; ar & m_initial_num_neurons; ar & m_initial_num_links; //ar & m_PhenotypeBehavior; // todo: think about how we will handle the behaviors with pickle } #endif }; #ifdef USE_BOOST_PYTHON struct Genome_pickle_suite : py::pickle_suite { static py::object getstate(const Genome& a) { std::ostringstream os; boost::archive::text_oarchive oa(os); oa << a; return py::str (os.str()); } static void setstate(Genome& a, py::object entries) { py::str s = py::extract<py::str> (entries)(); std::string st = py::extract<std::string> (s)(); std::istringstream is (st); boost::archive::text_iarchive ia (is); ia >> a; } }; #endif #define DBG(x) { std::cerr << x << std::endl; } } // namespace NEAT #endif
[ "fossfredrik@protonmail.com" ]
fossfredrik@protonmail.com
6e477176c32edcba4207ee92534f07676ef71a3c
740fdf1cca74bdb8f930a7907a48f9bdd9b5fbd3
/chromeos/geolocation/simple_geolocation_provider.cc
4f085e55ec251d732bf81b7660efdbb225dc976e
[ "BSD-3-Clause" ]
permissive
hefen1/chromium
a1384249e2bb7669df189235a1ff49ac11fc5790
52f0b6830e000ca7c5e9aa19488af85be792cc88
refs/heads/master
2016-09-05T18:20:24.971432
2015-03-23T14:53:29
2015-03-23T14:53:29
32,579,801
0
2
null
null
null
null
UTF-8
C++
false
false
2,474
cc
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chromeos/geolocation/simple_geolocation_provider.h" #include <algorithm> #include <iterator> #include "base/bind.h" #include "base/time/time.h" #include "chromeos/geolocation/geoposition.h" #include "net/url_request/url_request_context_getter.h" #include "url/gurl.h" namespace chromeos { namespace { const char kDefaultGeolocationProviderUrl[] = "https://www.googleapis.com/geolocation/v1/geolocate?"; } // namespace SimpleGeolocationProvider::SimpleGeolocationProvider( net::URLRequestContextGetter* url_context_getter, const GURL& url) : url_context_getter_(url_context_getter), url_(url) { } SimpleGeolocationProvider::~SimpleGeolocationProvider() { DCHECK(thread_checker_.CalledOnValidThread()); } void SimpleGeolocationProvider::RequestGeolocation( base::TimeDelta timeout, SimpleGeolocationRequest::ResponseCallback callback) { DCHECK(thread_checker_.CalledOnValidThread()); SimpleGeolocationRequest* request( new SimpleGeolocationRequest(url_context_getter_.get(), url_, timeout)); requests_.push_back(request); // SimpleGeolocationProvider owns all requests. It is safe to pass unretained // "this" because destruction of SimpleGeolocationProvider cancels all // requests. SimpleGeolocationRequest::ResponseCallback callback_tmp( base::Bind(&SimpleGeolocationProvider::OnGeolocationResponse, base::Unretained(this), request, callback)); request->MakeRequest(callback_tmp); } // static GURL SimpleGeolocationProvider::DefaultGeolocationProviderURL() { return GURL(kDefaultGeolocationProviderUrl); } void SimpleGeolocationProvider::OnGeolocationResponse( SimpleGeolocationRequest* request, SimpleGeolocationRequest::ResponseCallback callback, const Geoposition& geoposition, bool server_error, const base::TimeDelta elapsed) { DCHECK(thread_checker_.CalledOnValidThread()); callback.Run(geoposition, server_error, elapsed); ScopedVector<SimpleGeolocationRequest>::iterator position = std::find(requests_.begin(), requests_.end(), request); DCHECK(position != requests_.end()); if (position != requests_.end()) { std::swap(*position, *requests_.rbegin()); requests_.resize(requests_.size() - 1); } } } // namespace chromeos
[ "hefen2007303257@gmail.com" ]
hefen2007303257@gmail.com
566f607748f56c7617115131614c155b13c33e2c
9472670a8487ef8bd70b327829df0c73ded6df20
/PROGRAMACION Y ESTRUCTURA DE DATOS/tads/abb_/tad08.cpp
8db1f6579ecf84961b1a7982b738c484a63226ac
[]
no_license
josemygel/Temario-Ingenieria-Software-UA
246b4f7044ae5f5f8fcb171ad6b01040d19396fa
32cc45fcaee9d3d7282796f083691ec9d4551848
refs/heads/master
2023-05-10T23:38:04.608129
2020-08-02T08:08:04
2020-08-02T08:08:04
216,786,952
17
12
null
2023-05-07T02:16:11
2019-10-22T10:31:00
HTML
UTF-8
C++
false
false
419
cpp
#include <iostream> #include "tabbcalendario.h" using namespace std; int main(void) { TABBCalendario a; TCalendario c1(1, 1,2000,(char *)"fecha"),c2(2,2,2000,(char *)"fecha"),c3(3,3,2000,(char *)"fecha"); a.Insertar(c1); a.Insertar(c2); a.Insertar(c3); TABBCalendario b(a); cout<<"Inorden="<<b.Inorden()<<endl; TABBCalendario c,d(c); cout<<"Inorden="<<d.Inorden()<<endl; return 0; }
[ "josemygel@gmail.com" ]
josemygel@gmail.com
1d14d6b4167e17541bb3d555644fde4b23b49a8a
6983c5932b104164b3fc1548bc6932755bef96dc
/Capstone/Capstone/Variations.cpp
51a157b3093b14adbdb3ccd51a318eeb3fec06af
[]
no_license
jlfurtado/Neumont-PRO390-Capstone
d7c10005f190905d3cbd7d2bef33813a43022f17
498afd1a22d76ad61a50926837d6c4e8d04e864d
refs/heads/master
2020-03-23T18:39:28.788641
2018-07-22T19:14:43
2018-07-22T19:14:43
141,923,286
0
0
null
null
null
null
UTF-8
C++
false
false
2,676
cpp
#include "Variations.h" #include "MathUtility.h" namespace Capstone { using namespace DirectX; float Variations::ScalarUniform(float v1, float v2) { return MathUtility::Rand(MathUtility::Min(v1, v2), MathUtility::Max(v1, v2)); } XMVECTOR Variations::VectorComponentUniform(const XMVECTOR & v1, const XMVECTOR & v2) { XMFLOAT4 f1, f2; XMStoreFloat4(&f1, v1); XMStoreFloat4(&f2, v2); return XMVectorSet(ScalarUniform(f1.x, f2.x), ScalarUniform(f1.y, f2.y), ScalarUniform(f1.z, f2.z), ScalarUniform(f1.w, f2.w)); } XMVECTOR Variations::VectorUniform(const XMVECTOR & v1, const XMVECTOR & v2) { float t = ScalarUniform(0.0f, 1.0f); return (v1 * t) + ((1.0f - t) * v2); } void Variations::TripleVectorUniform(const DirectX::XMVECTOR & l1, const DirectX::XMVECTOR & h1, DirectX::XMVECTOR * pOut1, const DirectX::XMVECTOR & l2, const DirectX::XMVECTOR & h2, DirectX::XMVECTOR * pOut2, const DirectX::XMVECTOR & l3, const DirectX::XMVECTOR & h3, DirectX::XMVECTOR * pOut3) { float t = ScalarUniform(0.0f, 1.0f); *pOut1 = ((l1 * t) + ((1.0f - t) * h1)); *pOut2 = ((l2 * t) + ((1.0f - t) * h2)); *pOut3 = ((l3 * t) + ((1.0f - t) * h3)); } float Variations::ScalarBellApproximation(float v1, float v2, int sampleSize) { float low = MathUtility::Min(v1, v2); float max = MathUtility::Max(v1, v2); float avg = MathUtility::Rand(low, max); for (int i = 1; i < sampleSize; ++i) { avg += MathUtility::Rand(low, max); } return avg / sampleSize; } XMVECTOR Variations::VectorComponentBellApproximation(const XMVECTOR & v1, const XMVECTOR & v2, int sampleSize) { XMFLOAT4 f1, f2; XMStoreFloat4(&f1, v1); XMStoreFloat4(&f2, v2); return XMVectorSet(ScalarBellApproximation(f1.x, f2.x, sampleSize), ScalarBellApproximation(f1.y, f2.y, sampleSize), ScalarBellApproximation(f1.z, f2.z, sampleSize), ScalarBellApproximation(f1.w, f2.w, sampleSize)); } XMVECTOR Variations::VectorBellApproximation(const XMVECTOR & v1, const XMVECTOR & v2, int sampleSize) { float t = ScalarBellApproximation(0.0f, 1.0f, sampleSize); return (v1 * t) + ((1.0f - t) * v2); } void Variations::TripleVectorBellApproximation(const DirectX::XMVECTOR & l1, const DirectX::XMVECTOR & h1, DirectX::XMVECTOR * pOut1, const DirectX::XMVECTOR & l2, const DirectX::XMVECTOR & h2, DirectX::XMVECTOR * pOut2, const DirectX::XMVECTOR & l3, const DirectX::XMVECTOR & h3, DirectX::XMVECTOR * pOut3, int sampleSize) { float t = ScalarBellApproximation(0.0f, 1.0f, sampleSize); *pOut1 = (l1 * t) + ((1.0f - t) * h1); *pOut2 = (l2 * t) + ((1.0f - t) * h2); *pOut3 = (l3 * t) + ((1.0f - t) * h3); } }
[ "justin.l.furtado@gmail.com" ]
justin.l.furtado@gmail.com
63dc0ddd33fd9a117766e699e90680179d7ed93d
a0f040e88a59df2312f05744e1d9ce9650aed54b
/main.cpp
5447d0f605ea26f225eb13b7ef5bd65eb81c9fca
[]
no_license
JaredEzz/RelationalDatabase
989eb1d51d510340736211b8640951230f895677
bda3995b1bcd5d06cc222e04282934f44d6c6816
refs/heads/master
2020-12-03T08:19:37.814756
2020-01-01T18:21:34
2020-01-01T18:21:34
231,249,305
0
0
null
null
null
null
UTF-8
C++
false
false
135
cpp
#include <iostream> #include "Database.h" int main(int argc, char* argv[]) { Database myDatabase(argv[1],argv[2]); return 0; }
[ "jhasson@simplifile.com" ]
jhasson@simplifile.com
6a418c1d6e5617c47584759208fcffcb9dcecd35
be60deba39fb2c4ba04c32222666d8513524f5de
/lib/node_modules/@stdlib/blas/ext/base/dsumkbn/src/addon.cpp
1b784bf9e26fc40461242e25303af87f033898e5
[ "Apache-2.0", "MIT", "SunPro", "BSD-3-Clause", "BSL-1.0", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
jroell/stdlib
c7c418a60e460c556408d20dd925069e590b6b32
8400dff8ed6cd96e30b97b8dade5c856999f3394
refs/heads/develop
2023-07-19T18:56:06.058340
2021-02-08T04:42:29
2021-02-08T04:42:29
338,688,797
0
0
Apache-2.0
2023-07-05T15:32:26
2021-02-13T23:10:24
null
UTF-8
C++
false
false
3,573
cpp
/** * @license Apache-2.0 * * Copyright (c) 2020 The Stdlib Authors. * * 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 "stdlib/blas/ext/base/dsumkbn.h" #include <node_api.h> #include <stdint.h> #include <stdbool.h> #include <assert.h> /** * Add-on namespace. */ namespace stdlib_blas_ext_base_dsumkbn { /** * Computes the sum of double-precision floating-point strided array elements using an improved Kahan–Babuška algorithm. * * ## Notes * * - When called from JavaScript, the function expects three arguments: * * - `N`: number of indexed elements * - `X`: input array * - `stride`: stride length */ napi_value node_dsumkbn( napi_env env, napi_callback_info info ) { napi_status status; size_t argc = 3; napi_value argv[ 3 ]; status = napi_get_cb_info( env, info, &argc, argv, nullptr, nullptr ); assert( status == napi_ok ); if ( argc < 3 ) { napi_throw_error( env, nullptr, "invalid invocation. Must provide 3 arguments." ); return nullptr; } napi_valuetype vtype0; status = napi_typeof( env, argv[ 0 ], &vtype0 ); assert( status == napi_ok ); if ( vtype0 != napi_number ) { napi_throw_type_error( env, nullptr, "invalid argument. First argument must be a number." ); return nullptr; } bool res; status = napi_is_typedarray( env, argv[ 1 ], &res ); assert( status == napi_ok ); if ( res == false ) { napi_throw_type_error( env, nullptr, "invalid argument. Second argument must be a Float64Array." ); return nullptr; } napi_valuetype vtype2; status = napi_typeof( env, argv[ 2 ], &vtype2 ); assert( status == napi_ok ); if ( vtype2 != napi_number ) { napi_throw_type_error( env, nullptr, "invalid argument. Third argument must be a number." ); return nullptr; } int64_t N; status = napi_get_value_int64( env, argv[ 0 ], &N ); assert( status == napi_ok ); int64_t stride; status = napi_get_value_int64( env, argv[ 2 ], &stride ); assert( status == napi_ok ); napi_typedarray_type vtype1; size_t xlen; void *X; status = napi_get_typedarray_info( env, argv[ 1 ], &vtype1, &xlen, &X, nullptr, nullptr ); assert( status == napi_ok ); if ( vtype1 != napi_float64_array ) { napi_throw_type_error( env, nullptr, "invalid argument. Second argument must be a Float64Array." ); return nullptr; } if ( (N-1)*llabs(stride) >= (int64_t)xlen ) { napi_throw_range_error( env, nullptr, "invalid argument. Second argument has insufficient elements based on the associated stride and the number of indexed elements." ); return nullptr; } napi_value v; status = napi_create_double( env, stdlib_strided_dsumkbn( N, (double *)X, stride ), &v ); assert( status == napi_ok ); return v; } napi_value Init( napi_env env, napi_value exports ) { napi_status status; napi_value fcn; status = napi_create_function( env, "exports", NAPI_AUTO_LENGTH, node_dsumkbn, NULL, &fcn ); assert( status == napi_ok ); return fcn; } NAPI_MODULE( NODE_GYP_MODULE_NAME, Init ) } // end namespace stdlib_blas_ext_base_dsumkbn
[ "kgryte@gmail.com" ]
kgryte@gmail.com
8a00abd8d850136d5c4f1ef2ad67c471f59c4132
9f8051f0e83cca6d559e6d9cd77cfebc68a4b3b6
/print.cpp
c1db8501e39ade57b2badbbcc3d5f3aecd97a37e
[]
no_license
Warchild33/FormantSynth
88631a1c97861a3a4b23c0d8dc0dbfd05c672972
8706521d228183da0564877518921aa0a98c61a4
refs/heads/master
2021-06-27T15:54:37.790572
2019-04-30T18:41:16
2019-04-30T18:41:16
133,503,356
0
1
null
null
null
null
UTF-8
C++
false
false
2,218
cpp
/********************************************************************** * Project App6 * * print.cpp * * Author: Vladimir Baranov * * 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 2 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. **********************************************************************/ #include <QWidget> #include <QSignalMapper> #include <stdio.h> #include "print.h" ConsolePrn cns; char mu_printftmp[10000]; ConsolePrn::ConsolePrn() { timer.restart(); } void map_to_prn(QObject* w) { QObject::connect(&cns, SIGNAL( print_sig(const QString &) ), w, SLOT(print(const QString &)) ); } void unmap_from_prn(QObject* w) { QObject::disconnect(&cns, SIGNAL( print_sig(const QString &) ), w, SLOT(print(const QString &)) ); } void ConsolePrn::prn(char* str) { QString s = QString(tr(str)); emit print_sig(s); } void ConsolePrn::prn_skip(char* str) { if( timer.elapsed() > 500) { QString s = QString(tr(str)); emit print_sig(s); timer.restart(); } } void ConsolePrn::prn2(QString str) { emit print_sig(str); } void prn2(QString str) { cns.prn2(str); } void print(QString str) { cns.prn2(str); } void prn(const char* fmt,...) { va_list ap; va_start(ap, fmt); #ifdef WIN32 _vsnprintf(mu_printftmp, 60000, fmt, ap); #else vsnprintf(mu_printftmp, 60000, fmt, ap); #endif va_end(ap); cns.prn(mu_printftmp); } void prn_skip(const char* fmt,...) { va_list ap; va_start(ap, fmt); #ifdef WIN32 _vsnprintf(mu_printftmp, 60000, fmt, ap); #else vsnprintf(mu_printftmp, 60000, fmt, ap); #endif va_end(ap); cns.prn_skip(mu_printftmp); }
[ "vdbarster@gmail.com" ]
vdbarster@gmail.com
eed9e9e376f2b80c6152bb9002954d55dd814a03
93427e5015233aea8284ab7dc37a4b59b9d6c500
/lct/link-cut-base.hpp
6853f2cb98e5c0999fac2aa5c86969c851cba8db
[ "CC0-1.0" ]
permissive
zxc123qwe456asd789/library
fd978a387c8dd805ef1a7ffc1118272c6878b64a
13c01442cc5082da181acdaa414554ace30b6ae3
refs/heads/master
2023-05-28T22:50:47.466753
2021-06-12T04:10:24
2021-06-12T04:10:24
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,734
hpp
#pragma once template <typename Splay> struct LinkCutBase : Splay { using Node = typename Splay::Node; using Ptr = Node*; virtual Ptr expose(Ptr t) { Ptr rp = nullptr; for (Ptr cur = t; cur; cur = cur->p) { this->splay(cur); cur->r = rp; this->update(cur); rp = cur; } this->splay(t); return rp; } virtual void link(Ptr u, Ptr v) { evert(u); expose(v); u->p = v; } void cut(Ptr u, Ptr v) { evert(u); expose(v); assert(u->p == v); v->l = u->p = nullptr; this->update(v); } void evert(Ptr t) { expose(t); this->toggle(t); this->push(t); } Ptr lca(Ptr u, Ptr v) { if (get_root(u) != get_root(v)) return nullptr; expose(u); return expose(v); } Ptr get_kth(Ptr x, int k) { expose(x); while (x) { this->push(x); if (x->r && x->r->sz > k) { x = x->r; } else { if (x->r) k -= x->r->sz; if (k == 0) return x; k -= 1; x = x->l; } } return nullptr; } Ptr get_root(Ptr x) { expose(x); while (x->l) this->push(x), x = x->l; return x; } Ptr get_parent(Ptr x) { expose(x); Ptr p = x->l; if(p == nullptr) return nullptr; while (true) { this->push(p); if (p->r == nullptr) return p; p = p->r; } exit(1); } virtual void set_key(Ptr t, const decltype(Node::key)& key) { this->splay(t); t->key = key; this->update(t); } virtual decltype(Node::key) get_key(Ptr t) { return t->key; } decltype(Node::key) fold(Ptr u, Ptr v) { evert(u); expose(v); return v->sum; } }; /** * @brief Link/Cut Tree(base) * @docs docs/lct/link-cut-tree.md */
[ "suteakadapyon3@gmail.com" ]
suteakadapyon3@gmail.com
70605b297ac46acd80b5ff95784a8dc8b3ae11b4
bd3abc74927dcb18a3276cddc2b269cabb436364
/server.cpp
3b2889bfa75f5ae99d8b8415ab05f8f979d17d41
[ "Apache-2.0" ]
permissive
youngslab/generic_network_framework
ad7269371cb93228bbbbd8cd68f72897d39df94f
ec64e46b35004813e3179675cd56eec3e355336b
refs/heads/main
2023-07-29T21:13:39.063422
2021-09-23T09:31:48
2021-09-23T09:38:58
409,529,137
0
0
null
null
null
null
UTF-8
C++
false
false
625
cpp
#include <iostream> #include <fmt/format.h> #include "network/server.hpp" #include "common.hpp" class ChatServer : public gnf::GenericServer<boost::asio::ip::tcp::socket, ChatMessageType> { void onMessageRecieved(int id, const gnf::Message<ChatMessageType> &msg) override { std::cout << fmt::format("{}) recieved msg", id); } void onSessionCreated(int id) override { std::cout << fmt::format("{}) session created", id); } public: using gnf::GenericServer<boost::asio::ip::tcp::socket, ChatMessageType>::GenericServer; }; int main() { ChatServer server(8765, 2); while (1) { } }
[ "jaeyoungs.park@gmail.com" ]
jaeyoungs.park@gmail.com
9af74f0483b8c622a7de19d27d810b5840fc2bed
66d59c42fc88270bed4ce6ab18e7b6b573b4cf1a
/331. Verify Preorder Serialization of a Binary Tree/331. Verify Preorder Serialization of a Binary Tree/_template2.cpp
a85bb95316c1489559e4adfaaf307977e1efa2f7
[]
no_license
bluebambu/Leetcode_cpp
0e749322c5081ee6b61191931c853ab0ce9094f9
7a21e391d7a6bde4c202e46047880c30195bb023
refs/heads/master
2022-05-28T13:11:06.991523
2020-05-03T00:36:13
2020-05-03T00:36:13
260,799,312
0
0
null
null
null
null
UTF-8
C++
false
false
4,449
cpp
// _template.cpp : Defines the entry point for the console application. // #include <stdafx.h> #include <iostream> #include <functional> #include <bitset> #include <stdlib.h> #include <math.h> #include <list> #include <vector> #include <algorithm> // std::for_each #include <unordered_map> #include <queue> #include <stack> #include <unordered_set> #include <set> #include <map> #include <utility> #include <sstream> #include <string> #include <chrono> using namespace std; inline int exchg(int &a, int &b) { int c = a; a = b; b = c; } inline int log2(int N){ return log10(N) / log10(2); } inline float min(float a, float b) { return a < b ? a : b; } struct TreeNode { TreeNode(int a) :val(a), left(nullptr), right(nullptr) {} TreeNode(int a, TreeNode* x, TreeNode* y) :val(a), left(x), right(y) {} TreeNode() :val(0), left(nullptr), right(nullptr) {} int val; TreeNode *left; TreeNode *right; }; void print(TreeNode* root){ queue<TreeNode*> q; q.push(root); while (q.size()){ int n = q.size(); for (int i = 0; i < n; ++i){ TreeNode* front = q.front(); q.pop(); if (!front) cout << "# "; else{ cout << front->val << " "; q.push(front->left); q.push(front->right); } } cout << endl; } } template <typename C> void prt1Layer(C v){ for (auto i : v) cout << i << " "; cout << endl; } template <typename C> void prt2Layer(C v){ for (auto i : v){ for (auto j : i) cout << j << " "; cout << endl; } cout << endl; } template <typename C> void mapprt(C v){ for (auto i : v) cout << i.first << " " << i.second << endl; cout << endl; } //////////////////////////////////////////////////////////////// class Solution { public: string next(string& s, int& i){ int j = i; while (j < s.size() && s[j] != ',') ++j; string res = s.substr(i, j - i); i = j + 1; return res; } bool isValidSerialization(string preorder) { stack<bool> st; st.push(true); int i = 0; while (!st.empty() || i==preorder.size()){ string cur = next(preorder, i); if (cur == "#"){ st.pop(); } else{ st.push(true); } } return st.empty() && i == preorder.size()+1; } }; // pass class Solution2 { public: string next(string& s, int& i){ int j = i; while (j < s.size() && s[j] != ',') ++j; string res = s.substr(i, j - i); i = j + 1; return res; } bool isValidSerialization(string preorder) { preorder.push_back(','); int cnt = 1; int i = 0; while (i < preorder.size()){ string cur = next(preorder, i); if (cur == "#") cnt -= 1; else cnt += 1; if (cnt < 0 || (cnt == 0 && cur == "#" && i < preorder.size())) return false; } return cnt == 0; } }; class Solution3 { public: string next(string& s, int& i){ int j = i; while (j < s.size() && s[j] != ',') ++j; string res = s.substr(i, j - i); i = j + 1; return res; } bool isValidSerialization(string preorder) { int cnt = 1; int i = 0; while (i < preorder.size()){ string cur = next(preorder, i); cnt -= 1; if (cnt < 0) return false; if (cur != "#") cnt += 2; } return cnt == 0; } }; class Solution4{ public: bool isValidSerialization(string preorder) { int i = 0; return valid(preorder, i) && i >= preorder.size(); } bool valid(string& s, int& i){ if (i >= s.size()) return false; int j = i + 1; while (j < s.size() && s[j] != ',') ++j; string cur = s.substr(i, j - i); i = j + 1; if (cur == "#"){ return true; } return valid(s, i) && valid(s, i); } }; int main(){ Solution4 a; cout << a.isValidSerialization("1,#, #, 1") << endl; cout << a.isValidSerialization("1,#") << endl; cout << a.isValidSerialization("9,3,4,#,#,1,#,#,2,#,6,#,#") << endl; vector<int> b = { 4, 1, -9, 0, INT_MAX }; //TreeNode* tree = new TreeNode(6,new TreeNode(3, new TreeNode(1), new TreeNode(4)),new TreeNode(8, new TreeNode(7), new TreeNode(9))); TreeNode* tree = new TreeNode(6, new TreeNode(3, new TreeNode(1), new TreeNode(4)), new TreeNode(8, new TreeNode(7), new TreeNode(9))); /* 6 3 8 1 4 7 9 auto /////////////////////////// */ start = std::chrono::high_resolution_clock::now(); auto elapsed = std::chrono::high_resolution_clock::now() - start; long long microseconds = std::chrono::duration_cast<std::chrono::microseconds>(elapsed).count(); cout << endl << microseconds << " microseconds elapsed..." << endl; }
[ "electricitymouse@gmail.com" ]
electricitymouse@gmail.com
337918fd284be5a2f942ada550b7785326bac942
5ebd5cee801215bc3302fca26dbe534e6992c086
/blazetest/src/mathtest/smatsmatsub/MZaMIa.cpp
c97a6cfb0f45e79c402322868bce33f7d3ff9aef
[ "BSD-3-Clause" ]
permissive
mhochsteger/blaze
c66d8cf179deeab4f5bd692001cc917fe23e1811
fd397e60717c4870d942055496d5b484beac9f1a
refs/heads/master
2020-09-17T01:56:48.483627
2019-11-20T05:40:29
2019-11-20T05:41:35
223,951,030
0
0
null
null
null
null
UTF-8
C++
false
false
3,996
cpp
//================================================================================================= /*! // \file src/mathtest/smatsmatsub/MCaMIa.cpp // \brief Source file for the MCaMIa sparse matrix/sparse matrix subtraction math test // // Copyright (C) 2012-2019 Klaus Iglberger - All Rights Reserved // // This file is part of the Blaze library. You can redistribute it and/or modify it under // the terms of the New (Revised) BSD License. Redistribution and use in source and binary // forms, with or without modification, are permitted provided that the following conditions // are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, this list // of conditions and the following disclaimer in the documentation and/or other materials // provided with the distribution. // 3. Neither the names of the Blaze development group nor the names of its contributors // may be used to endorse or promote products derived from this software without specific // prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR // BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH // DAMAGE. */ //================================================================================================= //************************************************************************************************* // Includes //************************************************************************************************* #include <cstdlib> #include <iostream> #include <blaze/math/IdentityMatrix.h> #include <blaze/math/ZeroMatrix.h> #include <blazetest/mathtest/Creator.h> #include <blazetest/mathtest/smatsmatsub/OperationTest.h> #include <blazetest/system/MathTest.h> #ifdef BLAZE_USE_HPX_THREADS # include <hpx/hpx_main.hpp> #endif //================================================================================================= // // MAIN FUNCTION // //================================================================================================= //************************************************************************************************* int main() { std::cout << " Running 'MCaMIa'..." << std::endl; using blazetest::mathtest::TypeA; try { // Matrix type definitions using MCa = blaze::ZeroMatrix<TypeA>; using MIa = blaze::IdentityMatrix<TypeA>; // Creator type definitions using CMCa = blazetest::Creator<MCa>; using CMIa = blazetest::Creator<MIa>; // Running tests with small matrices for( size_t i=0UL; i<=6UL; ++i ) { RUN_SMATSMATSUB_OPERATION_TEST( CMCa( i, i ), CMIa( i ) ); } // Running tests with large matrices RUN_SMATSMATSUB_OPERATION_TEST( CMCa( 67UL, 67UL ), CMIa( 67UL ) ); RUN_SMATSMATSUB_OPERATION_TEST( CMCa( 128UL, 128UL ), CMIa( 128UL ) ); } catch( std::exception& ex ) { std::cerr << "\n\n ERROR DETECTED during sparse matrix/sparse matrix subtraction:\n" << ex.what() << "\n"; return EXIT_FAILURE; } return EXIT_SUCCESS; } //*************************************************************************************************
[ "klaus.iglberger@gmail.com" ]
klaus.iglberger@gmail.com
876705bb1387644a8ed29cc58e9b42995481a933
33035c05aad9bca0b0cefd67529bdd70399a9e04
/src/boost_log_attributes_constant.hpp
f1a016514fee7170b6918150e347ad333c1b407d
[ "LicenseRef-scancode-unknown-license-reference", "BSL-1.0" ]
permissive
elvisbugs/BoostForArduino
7e2427ded5fd030231918524f6a91554085a8e64
b8c912bf671868e2182aa703ed34076c59acf474
refs/heads/master
2023-03-25T13:11:58.527671
2021-03-27T02:37:29
2021-03-27T02:37:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
45
hpp
#include <boost/log/attributes/constant.hpp>
[ "k@kekyo.net" ]
k@kekyo.net
e5822f013e7fd8e3764d48f3a3bfe0ae40d68a1e
9ac9d9b845ce40119fc25fb7c2ab143a8e531f75
/Source/ArenaBattle/Public/ABSaveGame.h
2e9b3c4fb42349c4955377bad78a916d0f63cd68
[]
no_license
Duckbae-G/Unreal-Lee-Deuk-Woo-Practice
a2c318ea76e0fa38182f4a39480247c2b2ea78d5
9e25830b948647466676785110146e7c327ac424
refs/heads/master
2020-07-04T04:44:33.187252
2019-08-24T04:29:22
2019-08-24T04:29:22
202,158,806
0
0
null
null
null
null
UTF-8
C++
false
false
473
h
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "ArenaBattle.h" #include "GameFramework/SaveGame.h" #include "ABSaveGame.generated.h" /** * */ UCLASS() class ARENABATTLE_API UABSaveGame : public USaveGame { GENERATED_BODY() public: UABSaveGame(); UPROPERTY() int32 Level; UPROPERTY() int32 Exp; UPROPERTY() FString PlayerName; UPROPERTY() int32 HighScore; UPROPERTY() int32 CharacterIndex; };
[ "Duckbae-G@users.noreply.github.com" ]
Duckbae-G@users.noreply.github.com
9e81c2514caa23db79526a80256365904612ffb6
590eb4cc4d0fe83d9740ce478f857ca3a98e7dae
/OGDF/include/ogdf/basic/SubsetEnumerator.h
c2ba858f29e129ac4602ed90d866190d405b416e
[ "LGPL-2.1-or-later", "GPL-3.0-only", "GPL-1.0-or-later", "EPL-1.0", "MIT", "GPL-2.0-only", "LicenseRef-scancode-generic-exception", "LGPL-2.0-only", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
cerebis/MetaCarvel
d0ca77645e9a964e349144974a05e17fa48c6e99
a047290e88769773d43e0a9f877a88c2a8df89d5
refs/heads/master
2020-12-05T05:40:19.460644
2020-01-06T05:38:34
2020-01-06T05:38:34
232,023,146
0
0
MIT
2020-01-06T04:22:00
2020-01-06T04:21:59
null
UTF-8
C++
false
false
6,599
h
/** \file * \brief A class that allows to enumerate k-subsets of lists. * * \author Stephan Beyer * * \par License: * This file is part of the Open Graph Drawing Framework (OGDF). * * \par * Copyright (C)<br> * See README.txt in the root directory of the OGDF installation for details. * * \par * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * Version 2 or 3 as published by the Free Software Foundation; * see the file LICENSE.txt included in the packaging of this file * for details. * * \par * 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. * * \par * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * * \see http://www.gnu.org/copyleft/gpl.html ***************************************************************/ #ifdef _MSC_VER #pragma once #endif #ifndef OGDF_SUBSET_ENUMERATOR_H #define OGDF_SUBSET_ENUMERATOR_H #include <ogdf/basic/List.h> namespace ogdf { //! Enumerator for k-subsets of a given type. /** * <H3>Usage examples</H3> * <ul> * <li> Enumerate all subsets of edges with cardinality 3: * \code * List<edge> edges; * * do_something_eg_fill_edges(); * * SubsetEnumerator<edge> edgeSubset(edges); * * for (subset.begin(3); subset.valid(); subset.next()) { * do_something_with(subset[0], subset[1], subset[2]); * } * \endcode * </li> * <li> Enumerate all subsets of edges: * \code * SubsetEnumerator<edge> edgeSubset(edges); * * for (subset.begin(); subset.valid(); subset.next()) { * for (int i = 0; i < subset.size(); ++i) { * do_something_with(subset[i]); * } * do_stuff(); * } * \endcode * </li> * <li> Do something with element lists and complement lists of all 2-, 3-, and 4-element subsets * \code * SubsetEnumerator<edge> edgeSubset(edges); * * for (subset.begin(2, 4); subset.valid(); subset.next()) { * List<edge> list1, list2; * subset.list(list1, list2); * // if subset = { 1, 3, 4 } of { 1, 2, 3, 4, 5 }, * // then list1 = 1 3 4 and list2 = 2 5 * do_something_with(list1); * do_another_things_with(list2); * } * \endcode * </li> * </ul> * * Please note that the internal data structures of SubsetEnumerator do not use references of the type T. * Hence, T should either be a simple type or a pointer to a complex type (which is also only sane for Lists, too). * Otherwise the data structure will slow down due to extensive implicit copying. */ template<typename T> class SubsetEnumerator { protected: const List<T> &m_set; bool m_valid; int m_maxCard; Array<T> m_subset; Array<int> m_index; void initSubset(int card) { if (card >= 0 && card <= m_subset.size()) { m_index.init(card); for (int i = 0; i < card; ++i) { m_index[i] = i; } m_valid = true; } } public: //! \brief Constructor. //! @param set The list of elements we want to enumerate subsets for. SubsetEnumerator(const List<T> &set) : m_set(set) , m_valid(false) , m_subset(set.size()) { int i = 0; for(const T &x : m_set) { m_subset[i++] = x; } } //! Initialize the SubsetEnumerator to enumerate subsets of cardinalities from low to high. void begin(int low, int high) { m_maxCard = high; initSubset(low); } //! Initialize the SubsetEnumerator to enumerate subsets of given cardinality. void begin(int card) { begin(card, card); } //! Initialize the SubsetEnumerator to enumerate all subsets. void begin() { begin(0, m_set.size()); } //! Return the cardinality of the subset. int size() const { return m_index.size(); } //! Is the current subset valid? If not, all subsets have already been enumerated. bool valid() const { return m_valid; } //! Check in O(subset cardinality) whether the argument is a member of the subset. bool hasMember(const T &element) const { for (int i = 0; i < m_index.size(); ++i) { if (element == m_subset[m_index[i]]) { return true; } } return false; } //! Get element of subset by index (starting from 0). T operator[](int i) const { OGDF_ASSERT(i >= 0); OGDF_ASSERT(i < m_index.size()); return m_subset[m_index[i]]; } //! Obtain the next subset if possible. The result should be checked using the valid() method. void next() { if (m_valid) { const int t = m_index.size(); if (t == 0) { // last (empty) subset has been found if (t < m_maxCard) { initSubset(t + 1); } else { m_valid = false; } return; } const int n = m_subset.size(); int i; for (i = t - 1; m_index[i] == i + n - t; --i) { if (i == 0) { // the last subset of this cardinality has been found if (t < m_maxCard) { initSubset(t + 1); } else { m_valid = false; } return; } } for (++m_index[i]; i < t - 1; ++i) { m_index[i + 1] = m_index[i] + 1; } } } //! Obtain (append) a list of the elements in the subset. void list(List<T> &list) const { for (int i = 0; i < m_index.size(); ++i) { list.pushBack(m_subset[m_index[i]]); } } //! Obtain an array of the elements in the subset. void array(Array<T> &array) const { array.init(m_index.size()); for (int i = 0; i < m_index.size(); ++i) { array[i] = m_subset[m_index[i]]; } } //! Obtain (append) a list of the elements in the subset and a list of the other elements of the set. void list(List<T> &list, List<T> &complement) const { int j = 0; for (int i = 0; i < m_subset.size(); ++i) { if (j < m_index.size() && m_index[j] == i) { list.pushBack(m_subset[i]); ++j; } else { complement.pushBack(m_subset[i]); } } } }; // prints subset to output stream os using delimiter delim template<class T> void print(ostream &os, const SubsetEnumerator<T> &subset, string delim = " ") { OGDF_ASSERT(subset.valid()); if (subset.size() > 0) { os << subset[0]; } for (int i = 1; i < subset.size(); ++i) { os << delim << subset[i]; } } // prints subset to output stream os template<class T> ostream &operator<<(ostream &os, const SubsetEnumerator<T> &subset) { print(os, subset); return os; } } #endif // OGDF_SUBSET_ENUMERATOR_H
[ "jayg@cbcbsub00.umiacs.umd.edu" ]
jayg@cbcbsub00.umiacs.umd.edu
5a30b925992a519ef36a2c2c0fc34cf8c610f6c9
f9672fe53738f0cdcce7c064a33aa6c6c596c36e
/samples/cpp/std/remove-from-vector/sample.cpp
caa7608cb7700cae3b1bf2b673c8f6721e846656
[]
no_license
blockspacer/misc-1
f7ae418708c15ae3fa95cf8cb51ea8a95fae5d4c
7c3e328264b6e68d12691915f09da367ec4821f9
refs/heads/master
2023-03-21T00:49:39.184726
2019-03-22T09:19:03
2019-03-22T09:19:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
523
cpp
#include <iostream> #include <algorithm> #include <string> #include <vector> struct A { A(const std::string& s) : s(s) {} std::string s; }; int main() { std::vector<A> va{A("1"), A("2"), A("2"), A("3")}; std::cout << va.size() << std::endl; va.erase( std::remove_if( va.begin(), va.end(), [](const A& a) -> bool { return a.s == "2"; } ), va.end() ); std::cout << va.size() << std::endl; return 0; }
[ "pkostikov@yandex-team.ru" ]
pkostikov@yandex-team.ru
ac60d01b8930b74df8263394f3d7faed14a46b38
50a4611fd1d7a2fcdf407bd94932ebdfdc5d84fc
/RepeatedString/main.cpp
8a7fcbff914490e90a301e7773ea3d9eabf75681
[]
no_license
iamchinu97/HackerrankRepository_1
39cf7d777e845435905cfc1865d5b6f10c45605a
df015fb35372ac1f53d820a562d9f90faf010e55
refs/heads/master
2021-04-29T12:01:01.818566
2018-02-16T06:02:35
2018-02-16T06:02:35
121,719,480
0
1
null
null
null
null
UTF-8
C++
false
false
502
cpp
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); string s; long n,counta=0,total,factor; int i=0,len,remain; cin>>s; cin>>n; len=s.length(); for(i=0;i<len;i++) { if(s[i]=='a') counta++; } factor=n/s.length(); total=factor*counta; remain=n%s.length(); for(i=0;i<remain;i++) { if(s[i]=='a') total++; } cout<<total; return 0; }
[ "shimpichinmay@gmail.com" ]
shimpichinmay@gmail.com
2e8f9dc7ab5bce5d6ac61b0e7dadaa33f78a2d46
6477f79d8dde7d6d5d7c2f7639c2bec9bb21bdc2
/CSE 432/Lab3.cpp
3b60ff77cfde1d718c74a45b937cd352f7e5976d
[]
no_license
atrimuhammad/Assignment
9123682b2c2370e8076d94793b2ea6c08f7ad778
d291c889311015cae032f432ed495cd165402f6b
refs/heads/master
2020-09-08T07:47:59.313859
2015-11-23T16:33:40
2015-11-23T16:33:40
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,955
cpp
#include<graphics.h> #include<conio.h> void drawLine(int x0, int y0, int x1, int y1) { int dx = abs(x1-x0), sx = x0<x1 ? 1 : -1; int dy = abs(y1-y0), sy = y0<y1 ? 1 : -1; int err = (dx>dy ? dx : -dy)/2, e2; while(true) { putpixel(x0,y0,WHITE); if (x0==x1 && y0==y1) break; e2 = err; if (e2 > -dx) { err -= dy; x0 += sx; } if (e2 < dy) { err += dx; y0 += sy; } } } bool isValid(int X,int Y,int W,int H) { return X>=W/2 and Y>=H/2; } void DrawEllipse (int xc, int yc, int width, int height,int W,int H) { int a2 = width * width; int b2 = height * height; int fa2 = 4 * a2, fb2 = 4 * b2; int x, y, sigma; for (x = 0, y = height, sigma = 2*b2+a2*(1-2*height); b2*x <= a2*y; x++) { if(isValid(xc+x,yc+y,W,H)) putpixel( xc + x, yc + y,WHITE); if(isValid(xc-x,yc+y,W,H)) putpixel (xc - x, yc + y,WHITE); if(isValid(xc+x,yc-y,W,H)) putpixel (xc + x, yc - y,WHITE); if(isValid(xc-x,yc-y,W,H)) putpixel (xc - x, yc - y,WHITE); if (sigma >= 0) { sigma += fa2 * (1 - y); y--; } sigma += b2 * ((4 * x) + 6); } for (x = width, y = 0, sigma = 2*a2+b2*(1-2*width); a2*y <= b2*x; y++) { if(isValid(xc+x,yc+y,W,H)) putpixel (xc + x, yc + y,WHITE); if(isValid(xc-x,yc+y,W,H)) putpixel (xc - x, yc + y,WHITE); if(isValid(xc+x,yc-y,W,H)) putpixel (xc + x, yc - y,WHITE); if(isValid(xc-x,yc-y,W,H)) putpixel (xc - x, yc - y,WHITE); if (sigma >= 0) { sigma += fb2 * (1 - x); x--; } sigma += a2 * ((4 * y) + 6); } } int main() { int w=400,H=400; initwindow(400,400); drawLine(0,H/2,w,H/2); drawLine(w/2,0,w/2,H); DrawEllipse(200,200,60,80,w,H); getch(); closegraph(); return 0; }
[ "tanvir002700@gmail.com" ]
tanvir002700@gmail.com
cfaec8ac01220305d9acbc6f98bd3dc3d47867a4
1bf6613e21a5695582a8e6d9aaa643af4a1a5fa8
/src/chrome/browser/net/.svn/text-base/ssl_config_service_manager_pref.cc.svn-base
c193463d0d4287968998f13cc0e32041685b386a
[ "BSD-3-Clause" ]
permissive
pqrkchqps/MusicBrowser
ef5c9603105b4f4508a430d285334667ec3c1445
03216439d1cc3dae160f440417fcb557bb72f8e4
refs/heads/master
2020-05-20T05:12:14.141094
2013-05-31T02:21:07
2013-05-31T02:21:07
10,395,498
1
2
null
null
null
null
UTF-8
C++
false
false
13,280
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/net/ssl_config_service_manager.h" #include <algorithm> #include <string> #include <vector> #include "base/basictypes.h" #include "base/bind.h" #include "base/prefs/pref_change_registrar.h" #include "base/prefs/pref_member.h" #include "base/prefs/pref_registry_simple.h" #include "base/prefs/pref_service.h" #include "chrome/browser/content_settings/content_settings_utils.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/content_settings.h" #include "chrome/common/pref_names.h" #include "content/public/browser/browser_thread.h" #include "net/ssl/ssl_cipher_suite_names.h" #include "net/ssl/ssl_config_service.h" using content::BrowserThread; namespace { // Converts a ListValue of StringValues into a vector of strings. Any Values // which cannot be converted will be skipped. std::vector<std::string> ListValueToStringVector(const ListValue* value) { std::vector<std::string> results; results.reserve(value->GetSize()); std::string s; for (ListValue::const_iterator it = value->begin(); it != value->end(); ++it) { if (!(*it)->GetAsString(&s)) continue; results.push_back(s); } return results; } // Parses a vector of cipher suite strings, returning a sorted vector // containing the underlying SSL/TLS cipher suites. Unrecognized/invalid // cipher suites will be ignored. std::vector<uint16> ParseCipherSuites( const std::vector<std::string>& cipher_strings) { std::vector<uint16> cipher_suites; cipher_suites.reserve(cipher_strings.size()); for (std::vector<std::string>::const_iterator it = cipher_strings.begin(); it != cipher_strings.end(); ++it) { uint16 cipher_suite = 0; if (!net::ParseSSLCipherString(*it, &cipher_suite)) { LOG(ERROR) << "Ignoring unrecognized or unparsable cipher suite: " << *it; continue; } cipher_suites.push_back(cipher_suite); } std::sort(cipher_suites.begin(), cipher_suites.end()); return cipher_suites; } // Returns the string representation of an SSL protocol version. Returns an // empty string on error. std::string SSLProtocolVersionToString(uint16 version) { switch (version) { case net::SSL_PROTOCOL_VERSION_SSL3: return "ssl3"; case net::SSL_PROTOCOL_VERSION_TLS1: return "tls1"; case net::SSL_PROTOCOL_VERSION_TLS1_1: return "tls1.1"; case net::SSL_PROTOCOL_VERSION_TLS1_2: return "tls1.2"; default: NOTREACHED(); return std::string(); } } // Returns the SSL protocol version (as a uint16) represented by a string. // Returns 0 if the string is invalid. uint16 SSLProtocolVersionFromString(const std::string& version_str) { uint16 version = 0; // Invalid. if (version_str == "ssl3") { version = net::SSL_PROTOCOL_VERSION_SSL3; } else if (version_str == "tls1") { version = net::SSL_PROTOCOL_VERSION_TLS1; } else if (version_str == "tls1.1") { version = net::SSL_PROTOCOL_VERSION_TLS1_1; } else if (version_str == "tls1.2") { version = net::SSL_PROTOCOL_VERSION_TLS1_2; } return version; } } // namespace //////////////////////////////////////////////////////////////////////////////// // SSLConfigServicePref // An SSLConfigService which stores a cached version of the current SSLConfig // prefs, which are updated by SSLConfigServiceManagerPref when the prefs // change. class SSLConfigServicePref : public net::SSLConfigService { public: SSLConfigServicePref() {} // Store SSL config settings in |config|. Must only be called from IO thread. virtual void GetSSLConfig(net::SSLConfig* config) OVERRIDE; private: // Allow the pref watcher to update our internal state. friend class SSLConfigServiceManagerPref; virtual ~SSLConfigServicePref() {} // This method is posted to the IO thread from the browser thread to carry the // new config information. void SetNewSSLConfig(const net::SSLConfig& new_config); // Cached value of prefs, should only be accessed from IO thread. net::SSLConfig cached_config_; DISALLOW_COPY_AND_ASSIGN(SSLConfigServicePref); }; void SSLConfigServicePref::GetSSLConfig(net::SSLConfig* config) { *config = cached_config_; } void SSLConfigServicePref::SetNewSSLConfig( const net::SSLConfig& new_config) { net::SSLConfig orig_config = cached_config_; cached_config_ = new_config; ProcessConfigUpdate(orig_config, new_config); } //////////////////////////////////////////////////////////////////////////////// // SSLConfigServiceManagerPref // The manager for holding and updating an SSLConfigServicePref instance. class SSLConfigServiceManagerPref : public SSLConfigServiceManager { public: SSLConfigServiceManagerPref(PrefService* local_state, PrefService* user_prefs); virtual ~SSLConfigServiceManagerPref() {} // Register local_state SSL preferences. static void RegisterPrefs(PrefRegistrySimple* registry); virtual net::SSLConfigService* Get() OVERRIDE; private: // Callback for preference changes. This will post the changes to the IO // thread with SetNewSSLConfig. void OnPreferenceChanged(PrefService* prefs, const std::string& pref_name); // Store SSL config settings in |config|, directly from the preferences. Must // only be called from UI thread. void GetSSLConfigFromPrefs(net::SSLConfig* config); // Processes changes to the disabled cipher suites preference, updating the // cached list of parsed SSL/TLS cipher suites that are disabled. void OnDisabledCipherSuitesChange(PrefService* local_state); // Processes changes to the default cookie settings. void OnDefaultContentSettingsChange(PrefService* user_prefs); PrefChangeRegistrar local_state_change_registrar_; PrefChangeRegistrar user_prefs_change_registrar_; // The local_state prefs (should only be accessed from UI thread) BooleanPrefMember rev_checking_enabled_; StringPrefMember ssl_version_min_; StringPrefMember ssl_version_max_; BooleanPrefMember channel_id_enabled_; BooleanPrefMember ssl_record_splitting_disabled_; // The cached list of disabled SSL cipher suites. std::vector<uint16> disabled_cipher_suites_; // The user_prefs prefs (should only be accessed from UI thread). // |have_user_prefs_| will be false if no user_prefs are associated with this // instance. bool have_user_prefs_; BooleanPrefMember block_third_party_cookies_; // Cached value of if cookies are disabled by default. bool cookies_disabled_; scoped_refptr<SSLConfigServicePref> ssl_config_service_; DISALLOW_COPY_AND_ASSIGN(SSLConfigServiceManagerPref); }; SSLConfigServiceManagerPref::SSLConfigServiceManagerPref( PrefService* local_state, PrefService* user_prefs) : have_user_prefs_(!!user_prefs), ssl_config_service_(new SSLConfigServicePref()) { DCHECK(local_state); PrefChangeRegistrar::NamedChangeCallback local_state_callback = base::Bind( &SSLConfigServiceManagerPref::OnPreferenceChanged, base::Unretained(this), local_state); rev_checking_enabled_.Init( prefs::kCertRevocationCheckingEnabled, local_state, local_state_callback); ssl_version_min_.Init( prefs::kSSLVersionMin, local_state, local_state_callback); ssl_version_max_.Init( prefs::kSSLVersionMax, local_state, local_state_callback); channel_id_enabled_.Init( prefs::kEnableOriginBoundCerts, local_state, local_state_callback); ssl_record_splitting_disabled_.Init( prefs::kDisableSSLRecordSplitting, local_state, local_state_callback); local_state_change_registrar_.Init(local_state); local_state_change_registrar_.Add( prefs::kCipherSuiteBlacklist, local_state_callback); OnDisabledCipherSuitesChange(local_state); if (user_prefs) { PrefChangeRegistrar::NamedChangeCallback user_prefs_callback = base::Bind( &SSLConfigServiceManagerPref::OnPreferenceChanged, base::Unretained(this), user_prefs); block_third_party_cookies_.Init( prefs::kBlockThirdPartyCookies, user_prefs, user_prefs_callback); user_prefs_change_registrar_.Init(user_prefs); user_prefs_change_registrar_.Add( prefs::kDefaultContentSettings, user_prefs_callback); OnDefaultContentSettingsChange(user_prefs); } // Initialize from UI thread. This is okay as there shouldn't be anything on // the IO thread trying to access it yet. GetSSLConfigFromPrefs(&ssl_config_service_->cached_config_); } // static void SSLConfigServiceManagerPref::RegisterPrefs(PrefRegistrySimple* registry) { net::SSLConfig default_config; registry->RegisterBooleanPref(prefs::kCertRevocationCheckingEnabled, default_config.rev_checking_enabled); std::string version_min_str = SSLProtocolVersionToString(default_config.version_min); std::string version_max_str = SSLProtocolVersionToString(default_config.version_max); registry->RegisterStringPref(prefs::kSSLVersionMin, version_min_str); registry->RegisterStringPref(prefs::kSSLVersionMax, version_max_str); registry->RegisterBooleanPref(prefs::kEnableOriginBoundCerts, default_config.channel_id_enabled); registry->RegisterBooleanPref(prefs::kDisableSSLRecordSplitting, !default_config.false_start_enabled); registry->RegisterListPref(prefs::kCipherSuiteBlacklist); } net::SSLConfigService* SSLConfigServiceManagerPref::Get() { return ssl_config_service_; } void SSLConfigServiceManagerPref::OnPreferenceChanged( PrefService* prefs, const std::string& pref_name_in) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(prefs); if (pref_name_in == prefs::kCipherSuiteBlacklist) OnDisabledCipherSuitesChange(prefs); else if (pref_name_in == prefs::kDefaultContentSettings) OnDefaultContentSettingsChange(prefs); net::SSLConfig new_config; GetSSLConfigFromPrefs(&new_config); // Post a task to |io_loop| with the new configuration, so it can // update |cached_config_|. BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind( &SSLConfigServicePref::SetNewSSLConfig, ssl_config_service_.get(), new_config)); } void SSLConfigServiceManagerPref::GetSSLConfigFromPrefs( net::SSLConfig* config) { config->rev_checking_enabled = rev_checking_enabled_.GetValue(); std::string version_min_str = ssl_version_min_.GetValue(); std::string version_max_str = ssl_version_max_.GetValue(); config->version_min = net::SSLConfigService::default_version_min(); config->version_max = net::SSLConfigService::default_version_max(); uint16 version_min = SSLProtocolVersionFromString(version_min_str); uint16 version_max = SSLProtocolVersionFromString(version_max_str); if (version_min) { // TODO(wtc): get the minimum SSL protocol version supported by the // SSLClientSocket class. Right now it happens to be the same as the // default minimum SSL protocol version because we enable all supported // versions by default. uint16 supported_version_min = config->version_min; config->version_min = std::max(supported_version_min, version_min); } if (version_max) { // TODO(wtc): get the maximum SSL protocol version supported by the // SSLClientSocket class. uint16 supported_version_max = config->version_max; config->version_max = std::min(supported_version_max, version_max); } config->disabled_cipher_suites = disabled_cipher_suites_; config->channel_id_enabled = channel_id_enabled_.GetValue(); if (have_user_prefs_ && (cookies_disabled_ || block_third_party_cookies_.GetValue())) config->channel_id_enabled = false; // disabling False Start also happens to disable record splitting. config->false_start_enabled = !ssl_record_splitting_disabled_.GetValue(); SSLConfigServicePref::SetSSLConfigFlags(config); } void SSLConfigServiceManagerPref::OnDisabledCipherSuitesChange( PrefService* local_state) { const ListValue* value = local_state->GetList(prefs::kCipherSuiteBlacklist); disabled_cipher_suites_ = ParseCipherSuites(ListValueToStringVector(value)); } void SSLConfigServiceManagerPref::OnDefaultContentSettingsChange( PrefService* user_prefs) { const DictionaryValue* value = user_prefs->GetDictionary( prefs::kDefaultContentSettings); int default_cookie_settings = -1; cookies_disabled_ = ( value && value->GetInteger( content_settings::GetTypeName(CONTENT_SETTINGS_TYPE_COOKIES), &default_cookie_settings) && default_cookie_settings == CONTENT_SETTING_BLOCK); } //////////////////////////////////////////////////////////////////////////////// // SSLConfigServiceManager // static SSLConfigServiceManager* SSLConfigServiceManager::CreateDefaultManager( PrefService* local_state, PrefService* user_prefs) { return new SSLConfigServiceManagerPref(local_state, user_prefs); } // static void SSLConfigServiceManager::RegisterPrefs(PrefRegistrySimple* registry) { SSLConfigServiceManagerPref::RegisterPrefs(registry); }
[ "creps002@umn.edu" ]
creps002@umn.edu
bbf8232ab23b01293e9d7e75cdcfdb88318333b2
00c1bc41087bff3ce8bec5dc00465dd104c7ae3b
/Source/SimpleShooter/KillEmAllGameMode.h
b5f32a16ccf74eb4c614511b37479d14098d0a1d
[]
no_license
JustenK/SimpleShooter
2b1f1c7dd0fc7a72519248a31dfc6707b7ecc375
9638d69eddd2e32990fa76d687448bf9d8173896
refs/heads/master
2023-01-13T01:43:55.570502
2020-11-17T22:50:09
2020-11-17T22:50:09
312,165,754
0
0
null
null
null
null
UTF-8
C++
false
false
437
h
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" #include "SimpleShooterGameModeBase.h" #include "KillEmAllGameMode.generated.h" /** * */ UCLASS() class SIMPLESHOOTER_API AKillEmAllGameMode : public ASimpleShooterGameModeBase { GENERATED_BODY() public: virtual void PawnKilled(APawn* PawnKilled) override; private: void EndGame(bool bIsPlayerWinner); };
[ "hannan3@uci.edu" ]
hannan3@uci.edu
d5c16ec525c4d8b9d5ffcfd618f82eb8fbe8649f
9ca59450eb56d9aff26ce9792c0302d4e22e19c4
/ant_vr_sdk/Geometry.h
bceaadbcb3d49e9776236d724a1496dd8dec420c
[]
no_license
mzhg/opengl_study
a21aa1a06196afe836ef3dfd420c0d6ca2576bd5
bceaee18804afbf9a3f30b96e215d4d0e27912d1
refs/heads/master
2020-07-28T21:03:15.465756
2017-04-01T10:11:41
2017-04-01T10:11:41
73,694,502
1
1
null
null
null
null
UTF-8
C++
false
false
7,951
h
#pragma once #include "Spatial.h" #include "Shape3D.h" #include "Node.h" namespace jet { namespace util { /** * <code>Geometry</code> defines a leaf node of the scene graph. The leaf node * contains the geometric data for rendering objects. It manages all rendering * information such as a {@link Material} object to define how the surface * should be shaded and the {@link Mesh} data to contain the actual geometry. */ class Geometry : public Spatial { public: /** * Create a geometry node with mesh data. * The material of the geometry is null, it cannot * be rendered until it is set. * * @param name The name of this geometry * @param mesh The mesh data for this geometry */ Geometry(const std::string& name, ShapePtr pMesh) : Spatial(name) { // For backwards compatibility, only clear the "requires // update" flag if we are not a subclass of Geometry. // This prevents subclass from silently failing to receive // updates when they upgrade. setRequiresUpdates(strcmp(typeid(this).name(), "Geometry") != 0); m_pMesh = pMesh; } bool checkCulling(Camera* pCam) override { if (isGrouped()) { setLastFrustumIntersection(FrustumIntersect::OUTSIDE); return false; } return Spatial::checkCulling(pCam); } /** * @return If ignoreTransform mode is set. * * @see Geometry#setIgnoreTransform(boolean) */ bool isIgnoreTransform() const { return m_bIgnoreTransform;} /** * @param ignoreTransform If true, the geometry's transform will not be applied. */ void setIgnoreTransform(bool ignoreTransform) { m_bIgnoreTransform = ignoreTransform;} /** * Sets the LOD level to use when rendering the mesh of this geometry. * Level 0 indicates that the default index buffer should be used, * levels [1, LodLevels + 1] represent the levels set on the mesh * with {@link Mesh#setLodLevels(com.jme3.scene.VertexBuffer[]) }. * * @param lod The lod level to set */ void setLodLevel(int lod); /** * Returns the LOD level set with {@link #setLodLevel(int) }. * * @return the LOD level set */ int getLodLevel() const { return m_iLodLevel; } /** * Returns this geometry's mesh vertex count. * * @return this geometry's mesh vertex count. * * @see Mesh#getVertexCount() */ int getVertexCount() { return m_pMesh->getVertexCount();} #if 0 /** * Returns this geometry's mesh triangle count. * * @return this geometry's mesh triangle count. * * @see Mesh#getTriangleCount() */ int getTriangleCount() { return m_pMesh->getTriangleCount();} #endif /** * Sets the mesh to use for this geometry when rendering. * * @param mesh the mesh to use for this geometry * */ void setMesh(ShapePtr pMesh); /** * Returns the mesh to use for this geometry * * @return the mesh to use for this geometry * * @see #setMesh(com.jme3.scene.Mesh) */ ShapePtr getMesh() { return m_pMesh; } /** * Sets the material to use for this geometry. * * @param material the material to use for this geometry */ void setMaterial(MaterialPtr pMaterial) override; /** * Returns the material that is used for this geometry. * * @return the material that is used for this geometry * * @see #setMaterial(com.jme3.material.Material) */ MaterialPtr getMaterial() const {return m_pMaterial;} /** * @return The bounding volume of the mesh, in model space. */ const BoundingVolumePtr getModelBound() { return m_pWorldBound; } /** * Updates the bounding volume of the mesh. Should be called when the * mesh has been modified. */ void updateModelBound() { // m_pMesh->updateBound(); TODO setBoundRefresh(); } /** * <code>updateWorldBound</code> updates the bounding volume that contains * this geometry. The location of the geometry is based on the location of * all this node's parents. * * @see Spatial#updateWorldBound() */ void updateWorldBound() override; void updateWorldTransforms() override; void updateWorldLightList() override; /** * Associate this <code>Geometry</code> with a {@link SpatialManager}. * * Should only be called by the parent {@link Node}. * * @param node Which {@link GeometryGroupNode} to associate with. * @param startIndex The starting index of this geometry in the group. */ void associateWithSpatialManager(class SpatialManager* pNode, int iStartIndex); /** * Removes the {@link GeometryGroupNode} association from this * <code>Geometry</code>. * * Should only be called by the parent {@link GeometryGroupNode}. */ void unassociateFromGroupNode(); void setParent(Node* pParent) override; /** * Indicate that the transform of this spatial has changed and that * a refresh is required. */ // NOTE: Spatial has an identical implementation of this method, // thus it was commented out. // @Override // protected void setTransformRefresh() { // refreshFlags |= RF_TRANSFORM; // setBoundRefresh(); // } /** * Recomputes the matrix returned by {@link Geometry#getWorldMatrix() }. * This will require a localized transform update for this geometry. */ void computeWorldMatrix(); /** * A {@link Matrix4f matrix} that transforms the {@link Geometry#getMesh() mesh} * from model space to world space. This matrix is computed based on the * {@link Geometry#getWorldTransform() world transform} of this geometry. * In order to receive updated values, you must call {@link Geometry#computeWorldMatrix() } * before using this method. * * @return Matrix to transform from local space to world space */ const glm::mat4& getWorldMatrix() { return m_WorldTransform.getCombinedMatrix(); } /** * Sets the model bound to use for this geometry. * This alters the bound used on the mesh as well via * {@link Mesh#setBound(com.jme3.bounding.BoundingVolume) } and * forces the world bounding volume to be recomputed. * * @param modelBound The model bound to set */ void setModelBound(BoundingVolumePtr modelBound) { #if 0 this.worldBound = null; mesh.setBound(modelBound); #endif m_pWorldBound = modelBound; setBoundRefresh(); // NOTE: Calling updateModelBound() would cause the mesh // to recompute the bound based on the geometry thus making // this call useless! //updateModelBound(); } #if 0 public int collideWith(Collidable other, CollisionResults results) { // Force bound to update checkDoBoundUpdate(); // Update transform, and compute cached world matrix computeWorldMatrix(); assert(refreshFlags & (RF_BOUND | RF_TRANSFORM)) == 0; if (mesh != null) { // NOTE: BIHTree in mesh already checks collision with the // mesh's bound int prevSize = results.size(); int added = mesh.collideWith(other, cachedWorldMat, worldBound, results); int newSize = results.size(); for (int i = prevSize; i < newSize; i++) { results.getCollisionDirect(i).setGeometry(this); } return added; } return 0; } @Override public void depthFirstTraversal(SceneGraphVisitor visitor, DFSMode mode) { visitor.visit(this); } @Override protected void breadthFirstTraversal(SceneGraphVisitor visitor, Queue<Spatial> queue) { } #endif /** * Determine whether this <code>Geometry</code> is managed by a * {@link GeometryGroupNode} or not. * * @return True if managed by a {@link GeometryGroupNode}. */ bool isGrouped() const { return m_pGroupNode != nullptr;} ~Geometry(); protected: ShapePtr m_pMesh; int m_iLodLevel; MaterialPtr m_pMaterial; bool m_bIgnoreTransform; class SpatialManager* m_pGroupNode; int m_iStartIndex; }; } }
[ "mzhg001@sina.com" ]
mzhg001@sina.com
f480c394a1f11cf6be787b7430242ee7891d3ff0
066517a18bf680315a47b56613ac76c240818444
/tools/rdf3xload/TempFile.cpp
db1162286d5947b1d24aa43ce4438fc1e12d06ae
[]
no_license
YeXiaoRain/rdf3x-0.3.8
0da62625b6e547b84740d909983af5b0906ad10c
5970ee5228f78d3bcb4ccea70c56b6895d14d7b2
refs/heads/master
2021-01-20T12:10:25.299856
2017-02-21T06:51:00
2017-02-21T06:51:00
82,644,389
6
1
null
null
null
null
UTF-8
C++
false
false
5,242
cpp
#include "TempFile.hpp" #include <sstream> #include <cassert> #include <cstring> //--------------------------------------------------------------------------- // RDF-3X // (c) 2008 Thomas Neumann. Web site: http://www.mpi-inf.mpg.de/~neumann/rdf3x // // This work is licensed under the Creative Commons // Attribution-Noncommercial-Share Alike 3.0 Unported License. To view a copy // of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ // or send a letter to Creative Commons, 171 Second Street, Suite 300, // San Francisco, California, 94105, USA. //--------------------------------------------------------------------------- using namespace std; //--------------------------------------------------------------------------- /// The next id unsigned TempFile::id = 0; //--------------------------------------------------------------------------- string TempFile::newSuffix() // Construct a new suffix { stringstream buffer; buffer << '.' << (id++); return buffer.str(); } //--------------------------------------------------------------------------- TempFile::TempFile(const string& baseName) : baseName(baseName),fileName(baseName+newSuffix()),out(fileName.c_str(),ios::out|ios::binary|ios::trunc),writePointer(0) // Constructor { } //--------------------------------------------------------------------------- TempFile::~TempFile() // Destructor { discard(); } //--------------------------------------------------------------------------- void TempFile::swap(TempFile& other) // Swap two file references { // We only support filed files assert(!out.is_open()); assert(!other.out.is_open()); // Swap the names baseName.swap(other.baseName); fileName.swap(other.fileName); } //--------------------------------------------------------------------------- void TempFile::flush() // Flush the file { if (writePointer) { out.write(writeBuffer,writePointer); writePointer=0; } out.flush(); } //--------------------------------------------------------------------------- void TempFile::close() // Close the file { flush(); out.close(); } //--------------------------------------------------------------------------- void TempFile::discard() // Discard the file { close(); remove(fileName.c_str()); } //--------------------------------------------------------------------------- void TempFile::writeString(unsigned len,const char* str) // Write a string { writeId(len); write(len,str); } //--------------------------------------------------------------------------- void TempFile::writeId(uint64_t id) // Write a id { while (id>=128) { unsigned char c=static_cast<unsigned char>(id|128); if (writePointer==bufferSize) { out.write(writeBuffer,writePointer); writePointer=0; } writeBuffer[writePointer++]=c; id>>=7; } if (writePointer==bufferSize) { out.write(writeBuffer,writePointer); writePointer=0; } writeBuffer[writePointer++]=static_cast<unsigned char>(id); } //--------------------------------------------------------------------------- void TempFile::write(unsigned len,const char* data) // Raw write { // Fill the buffer if (writePointer+len>bufferSize) { unsigned remaining=bufferSize-writePointer; memcpy(writeBuffer+writePointer,data,remaining); out.write(writeBuffer,bufferSize); writePointer=0; len-=remaining; data+=remaining; } // Write big chunks if any if (writePointer+len>bufferSize) { assert(writePointer==0); unsigned chunks=len/bufferSize; out.write(data,chunks*bufferSize); len-=chunks*bufferSize; data+=chunks*bufferSize; } // And fill the rest memcpy(writeBuffer+writePointer,data,len); writePointer+=len; } //--------------------------------------------------------------------------- const char* TempFile::skipId(const char* reader) // Skip an id { while ((*reinterpret_cast<const unsigned char*>(reader))&128) ++reader; return reader+1; } //--------------------------------------------------------------------------- const char* TempFile::skipString(const char* reader) // Skip a string { uint64_t rawLen; reader=readId(reader,rawLen); unsigned len=static_cast<unsigned>(rawLen); return reader+len; } //--------------------------------------------------------------------------- const char* TempFile::readId(const char* reader,uint64_t& result) // Read an id { unsigned shift=0; uint64_t id=0; while (true) { unsigned char c=*reinterpret_cast<const unsigned char*>(reader++); if (c&128) { id|=static_cast<uint64_t>(c&0x7F)<<shift; shift+=7; } else { id|=static_cast<uint64_t>(c)<<shift; break; } } result=id; return reader; } //--------------------------------------------------------------------------- const char* TempFile::readString(const char* reader,unsigned& len,const char*& str) // Read a string { uint64_t rawLen; reader=readId(reader,rawLen); len=static_cast<unsigned>(rawLen); str=reader; return reader+len; } //---------------------------------------------------------------------------
[ "yexiaorain@gmail.com" ]
yexiaorain@gmail.com
30fdaba7f0259feaf65cf7846eff2fc7929cab18
e1333d5619d725d8e1dec88e93611f6b411e1c95
/checkout/Game.h
6d18b332f11c6b9dc223ab18d3644ce243d935b6
[]
no_license
jishansingh/basicOpenGL
af16ab0449b6376fe94d4147c6f2a3478ee9a34d
5e909f7a3604c1912bd88e2225bf70ec9a0c2a5b
refs/heads/master
2021-04-14T13:56:40.743498
2020-03-22T17:29:42
2020-03-22T17:29:42
249,235,438
0
0
null
null
null
null
UTF-8
C++
false
false
1,838
h
#pragma once #include"libs.h" #include"Texture.h" #include"Shader.h" #include"Material.h" #include"Mesh.h" #include"Primitives.h" #include"Model.h" #include"objLoader.h" class Game { private: //variables GLFWwindow* window; int WINDOW_WIDTH; int WINDOW_HEIGHT; int framebufferwidth; int framebufferheight; int glMajorVer; int glMinorVer; //view matrix glm::mat4 viewMatrix; glm::vec3 cameraPos; glm::vec3 cameraFront; glm::vec3 worldUp; //projection Matrix glm::mat4 projectionMatrix; float fov; float nearPlane; float farPlane; //update time float dt; float curTime; float lastTime; //mouse Positions double lastMouseX; double lastMouseY; double mouseX; double mouseY; double mouseOffsetX; double mouseOffsetY; bool firstMouse; //object properties and looks std::vector<Shader*>objShader; std::vector<std::pair<Texture*, Texture*> >objTexture; std::vector<Material*>objMaterial; std::vector<Mesh*>objMesh; std::vector<glm::vec3>lightPos; std::vector<Model*>models; //functions void initialize(const char* window_title, bool resizable); void initGLFW(); void initGLEW(); void initOpenGLOption(); void initViewMatrix(); void initProjection(); //init shaders textures material void initShaders(); void initTextures(); void initMaterials(); //init mesh light void initMesh(); void initLight(); //init uniforms void initUniform(); void initModel(); void updateKeyboardInput(); void updateMouseInput(); void updateUniform(); void updateDT(); //static variables public: Game(const char* window_title, int width, int height, int gl_major_ver, int gl_minor_ver, bool resizable); virtual ~Game(); int getWindowShouldClose(); void setWindowShouldClose(); void update(); void render(); static void frameBufferResizeCallback(GLFWwindow* window, int fbW, int fbH); };
[ "singhjishan2@gmail.com" ]
singhjishan2@gmail.com
b3506e6e8ab175d2d213c4a4fbefef3b499cb893
405ea7a35a23f05a1d2f7b0656dd006d96891dfa
/tensorflow/compiler/mlir/tools/kernel_gen/kernel_creator.cc
b65e9f563705fb13e9b0b545bbf448d86347a903
[ "Apache-2.0" ]
permissive
nikhilsanghi/tensorflow-1
32d9d6222a187aad1f47deb807b36ef4226883bd
f5cc613bdac1ca289493ee956b1777420ff07c6b
refs/heads/master
2023-02-13T18:20:19.326298
2021-01-12T06:09:48
2021-01-12T06:15:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
16,376
cc
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 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. ==============================================================================*/ //===- kernel_creator.cc ----------------------------------------*- C++ -*-===// // // This file implements the function to compile a TF kernel function to gpu // binary (hsaco for AMD, cubin for NVIDIA) or to a gpu binary with host side. // //===----------------------------------------------------------------------===// #include "tensorflow/compiler/mlir/tools/kernel_gen/kernel_creator.h" #include "llvm/Support/raw_ostream.h" #include "mlir/Conversion/AffineToStandard/AffineToStandard.h" // from @llvm-project #include "mlir/Conversion/GPUCommon/GPUCommonPass.h" // from @llvm-project #include "mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h" // from @llvm-project #include "mlir/Conversion/SCFToGPU/SCFToGPUPass.h" // from @llvm-project #include "mlir/Conversion/SCFToStandard/SCFToStandard.h" // from @llvm-project #include "mlir/Conversion/ShapeToStandard/ShapeToStandard.h" // from @llvm-project #include "mlir/Dialect/GPU/GPUDialect.h" // from @llvm-project #include "mlir/Dialect/GPU/ParallelLoopMapper.h" // from @llvm-project #include "mlir/Dialect/GPU/Passes.h" // from @llvm-project #include "mlir/Dialect/LLVMIR/LLVMDialect.h" // from @llvm-project #include "mlir/Dialect/LLVMIR/NVVMDialect.h" // from @llvm-project #include "mlir/Dialect/Linalg/Passes.h" // from @llvm-project #include "mlir/Dialect/Linalg/Transforms/Transforms.h" // from @llvm-project #include "mlir/Dialect/SCF/Passes.h" // from @llvm-project #include "mlir/Dialect/SCF/SCF.h" // from @llvm-project #include "mlir/Dialect/SCF/Transforms.h" // from @llvm-project #include "mlir/Dialect/Shape/Transforms/Passes.h" // from @llvm-project #include "mlir/Dialect/StandardOps/IR/Ops.h" // from @llvm-project #include "mlir/Dialect/StandardOps/Transforms/Passes.h" // from @llvm-project #include "mlir/Parser.h" // from @llvm-project #include "mlir/Pass/Pass.h" // from @llvm-project #include "mlir/Pass/PassManager.h" // from @llvm-project #include "mlir/Transforms/Bufferize.h" // from @llvm-project #include "mlir/Transforms/DialectConversion.h" // from @llvm-project #include "mlir/Transforms/GreedyPatternRewriteDriver.h" // from @llvm-project #include "mlir/Transforms/Passes.h" // from @llvm-project #include "tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/IR/chlo_ops.h" #include "tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops.h" #include "tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/transforms/passes.h" #include "tensorflow/compiler/mlir/tensorflow/dialect_registration.h" #include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.h" #include "tensorflow/compiler/mlir/tensorflow/utils/dump_mlir_util.h" #include "tensorflow/compiler/mlir/tools/kernel_gen/transforms/passes.h" #include "tensorflow/compiler/mlir/xla/transforms/passes.h" #include "tensorflow/compiler/xla/util.h" #include "tensorflow/core/platform/logging.h" #include "tensorflow/core/platform/path.h" namespace tensorflow { namespace kernel_gen { namespace { using tensorflow::Status; using xla::InternalError; using xla::StatusOr; constexpr llvm::StringRef kGpuBinaryAttrName = "gpu.binary"; // TODO(herhut): Remove this once leftover tensor_to_memref are handled in core. namespace { struct RemoveUnusedTensorToMemrefOperations : public mlir::PassWrapper<RemoveUnusedTensorToMemrefOperations, mlir::FunctionPass> { void runOnFunction() override { getFunction().walk([](mlir::TensorToMemrefOp op) { // Drop all tensor_to_memref that have no more users. Currently this will // not happen, as tensor_to_memref has a side-effect. See // https://reviews.llvm.org/D91967 for a dicsussion. if (op.memref().getUsers().empty()) { op.erase(); } }); } }; } // end anonymous namespace Status LowerTFtoGPU(mlir::ModuleOp module, llvm::ArrayRef<uint32_t> tile_sizes, llvm::ArrayRef<uint32_t> unroll_factors, bool embed_memref_prints) { mlir::PassManager pm(module.getContext()); applyTensorflowAndCLOptions(pm); pm.addNestedPass<mlir::FuncOp>(mlir::mhlo::createLegalizeTFPass( /*allow_partial_conversion=*/false, /*legalize_chlo=*/false)); pm.addNestedPass<mlir::FuncOp>(mlir::createTransformUnrankedHloPass()); pm.addNestedPass<mlir::FuncOp>(mlir::mhlo::createChloLegalizeToHloPass()); pm.addNestedPass<mlir::FuncOp>(mlir::createCanonicalizerPass()); pm.addNestedPass<mlir::FuncOp>(mlir::createCSEPass()); pm.addNestedPass<mlir::FuncOp>(mlir::createCanonicalizerPass()); // Transform HLO operations to LinAlg. pm.addNestedPass<mlir::FuncOp>(::mlir::mhlo::createLegalizeHloToLinalgPass()); pm.addPass(mlir::createCanonicalizerPass()); pm.addNestedPass<mlir::FuncOp>(mlir::createCSEPass()); // We have to anticipate later unrolling in tiling to make sure that we get // the requested tiling after unrolling. Compute the new tiling here if // needed. llvm::SmallVector<int64_t, 4> tiling_for_unrolling, inner_tile; tiling_for_unrolling.reserve(tile_sizes.size()); for (auto pair : llvm::zip(tile_sizes, unroll_factors)) { tiling_for_unrolling.push_back(std::get<0>(pair) * std::get<1>(pair)); inner_tile.push_back(std::get<1>(pair)); } tiling_for_unrolling.append( tile_sizes.drop_front(unroll_factors.size()).begin(), tile_sizes.end()); // Fuse linalg operations. pm.addNestedPass<mlir::FuncOp>(mlir::createLinalgFusionOfTensorOpsPass()); // Partial bufferization: Transforms inparticular HLO and Linalg operations to // their corresponding LHLO operations and converts the function signature. // Leaves shape operations untouched. // // TODO(pifon): Rename the pass to CreateHloLinalgBufferizePass or bufferize // in 2 steps: first Linalg, then Hlo. That would need refactoring of // BufferizeTypeConverter. pm.addPass(mlir::kernel_gen::transforms::CreateHloBufferizePass()); pm.addNestedPass<::mlir::FuncOp>(::mlir::createCanonicalizerPass()); pm.addNestedPass<::mlir::FuncOp>(::mlir::createCSEPass()); // Find candidates for buffer reuse. This is only successful if buffer size // equality can be determined based on `linalg.generic` operations. pm.addNestedPass<mlir::FuncOp>( mlir::kernel_gen::transforms::CreateBufferReusePass()); pm.addNestedPass<mlir::FuncOp>( mlir::createLinalgTilingToParallelLoopsPass((tiling_for_unrolling))); // Transform the Linalg ops inside of the loop nest into parallel loops. pm.addNestedPass<mlir::FuncOp>( ::mlir::createConvertLinalgToParallelLoopsPass()); // Canonicalize the code to simplify index computations. This is needed so // that loop bounds have the same value. pm.addNestedPass<::mlir::FuncOp>(::mlir::createCanonicalizerPass()); pm.addNestedPass<::mlir::FuncOp>(::mlir::createCSEPass()); // Fuse the inner-most loops. pm.addNestedPass<mlir::FuncOp>( mlir::kernel_gen::transforms::CreateFuseInnerParallelLoopsPass()); // Run CSE to ensure that loads and stores to the same subview get // recognized as such. pm.addNestedPass<::mlir::FuncOp>(::mlir::createCSEPass()); if (!unroll_factors.empty()) { pm.addNestedPass<mlir::FuncOp>( ::mlir::createParallelLoopTilingPass(inner_tile)); } // Some basic cleanup. pm.addNestedPass<::mlir::FuncOp>(::mlir::createCanonicalizerPass()); pm.addNestedPass<::mlir::FuncOp>(::mlir::createCSEPass()); // Greedily map the remaining loop to GPU hardware dimensions. pm.addNestedPass<::mlir::FuncOp>( mlir::kernel_gen::transforms::CreateMapParallelLoopsPass()); // Now lower the shape computations, bufferize all remaining ops and insert // deallocs. pm.addNestedPass<mlir::FuncOp>(::mlir::createBufferHoistingPass()); pm.addNestedPass<mlir::FuncOp>(mlir::createCopyRemovalPass()); // Expand memref_reshape to its ranked form so that we can propagate // scalars and avoid allocation. pm.addNestedPass<mlir::FuncOp>(mlir::createStdExpandOpsPass()); pm.addPass(mlir::createCanonicalizerPass()); pm.addPass(mlir::kernel_gen::transforms::CreateShapeToDescriptorsPass()); // Before bufferizing further, remove unused tensor_to_memref, so that we do // not create allocations for tensor computations that are not actually // needed. pm.addPass(mlir::createCanonicalizerPass()); // TODO(herhut) Remove once handled in mlir core. pm.addNestedPass<mlir::FuncOp>( std::make_unique<RemoveUnusedTensorToMemrefOperations>()); pm.addPass(mlir::createCanonicalizerPass()); pm.addNestedPass<mlir::FuncOp>(mlir::createCSEPass()); // Before inserting more allocs, map the ones we already have to the // tf runtime. That ensures that all allocations for the actual computation // end up on the device, whereas allocations for shape computation and host // side things remain on the host. // Longer term, this should be handled by proper device placement. pm.addPass(mlir::kernel_gen::tf_framework:: CreateEmbedTFFrameworkFunctionAndAllocPass()); pm.addPass(mlir::kernel_gen::transforms::CreateFinalBufferizePass()); pm.addNestedPass<mlir::FuncOp>(mlir::createPromoteBuffersToStackPass(64)); // TODO(herhut): Depends on https://bugs.llvm.org/show_bug.cgi?id=48385. // We also cannot properly free temporaries until // https://llvm.discourse.group/t/remove-tight-coupling-of-the-bufferdeallocation-pass-to-std-and-linalg-operations/2162 // is resolved. // pm.addNestedPass<mlir::FuncOp>(::mlir::createBufferDeallocationPass()); // Apply the mapping and go to GPU. We cannot do this earlier due to missing // interfaces on the GPU dialect. // TODO(b/174830459): Move up once implemented. pm.addNestedPass<::mlir::FuncOp>(mlir::createParallelLoopToGpuPass()); // Some basic cleanup. pm.addNestedPass<::mlir::FuncOp>(::mlir::createCanonicalizerPass()); pm.addNestedPass<::mlir::FuncOp>(::mlir::createCSEPass()); // Make loops with min bounds into a conditional plus static bounds. // Only do this if we unrolled in the first place. if (!unroll_factors.empty()) { pm.addNestedPass<::mlir::FuncOp>(mlir::createForLoopSpecializationPass()); } // Approximate Tanh using standard operations. pm.addNestedPass<::mlir::FuncOp>( ::mlir::mhlo::createLegalizeTrigonometricToApproximationPass()); // Take launches to launches with kernels. pm.addPass(::mlir::createGpuKernelOutliningPass()); pm.addPass(::mlir::createLowerAffinePass()); // Constraints are removed as late as possible and before lowering to CFG. pm.addNestedPass<::mlir::FuncOp>(::mlir::createConvertShapeConstraintsPass()); pm.addNestedPass<::mlir::FuncOp>(::mlir::createCanonicalizerPass()); pm.addPass(::mlir::createLowerToCFGPass()); // Map asserts to the tensorflow framework. pm.addPass( mlir::kernel_gen::tf_framework::CreateEmbedTFFrameworkAssertPass()); if (embed_memref_prints) { pm.addNestedPass<::mlir::FuncOp>( mlir::kernel_gen::transforms::CreateEmbedMemRefPrintsPass()); } if (failed(pm.run(module))) { return InternalError("Lowering to GPU kernels failed."); } return Status::OK(); } Status LowerKernelBodiesToLowLevelIr(mlir::ModuleOp module) { #if !defined(TENSORFLOW_USE_ROCM) && !defined(GOOGLE_CUDA) return InternalError( "Neither TENSORFLOW_USE_ROCM nor GOOGLE_CUDA are defined." " Did you specify either --config=rocm or --config=cuda ?"); #endif mlir::PassManager pm(module.getContext()); // We cannot verify as the signature of the kernel is rewritten. // pm.enableVerifier(false); tensorflow::applyTensorflowAndCLOptions(pm); auto& kernelPm = pm.nest<::mlir::gpu::GPUModuleOp>(); kernelPm.addPass(::mlir::createLowerToCFGPass()); #if TENSORFLOW_USE_ROCM kernelPm.addPass(mlir::kernel_gen::transforms::CreateGpuKernelToRocdlPass()); #elif GOOGLE_CUDA kernelPm.addPass(mlir::kernel_gen::transforms::CreateGpuKernelToNvvmPass()); #endif // Remove all location information to prevent a debug build. pm.addPass(::mlir::createStripDebugInfoPass()); if (failed(pm.run(module))) { return InternalError("Lowering to low-level device IR failed."); } return Status::OK(); } Status AmendKernelLLVMIRWithStaticKnowledge(mlir::ModuleOp module) { mlir::PassManager pm(module.getContext()); applyTensorflowAndCLOptions(pm); pm.addNestedPass<mlir::FuncOp>( mlir::kernel_gen::transforms::CreatePropagateShapeKnowledgeToKernels()); pm.addNestedPass<mlir::FuncOp>( mlir::kernel_gen::transforms::CreatePropagateTfAbiKnowledgeToKernels()); return failed(pm.run(module)) ? InternalError("Amending LLVMIR with static knowledge failed.") : Status::OK(); } Status GenerateDeviceCode(mlir::ModuleOp module, llvm::StringRef gpu_binary_attr_name, llvm::ArrayRef<std::string> architectures, bool generate_fatbin, bool print_ptx, bool enable_ftz) { mlir::PassManager pm(module.getContext()); applyTensorflowAndCLOptions(pm); auto& kernel_pm = pm.nest<mlir::gpu::GPUModuleOp>(); // Remove debug information to ensure we do not create debug PTX. kernel_pm.addPass(mlir::createStripDebugInfoPass()); kernel_pm.addPass(mlir::kernel_gen::transforms::CreateGpuKernelToBlobPass( gpu_binary_attr_name, architectures, generate_fatbin, print_ptx, enable_ftz)); return failed(pm.run(module)) ? InternalError("Generating device code failed.") : Status::OK(); } Status LowerHostSideToFinalForm(mlir::ModuleOp module) { mlir::PassManager pm(module.getContext()); applyTensorflowAndCLOptions(pm); pm.addPass(mlir::kernel_gen::transforms::CreateTFKernelToLLVMPass( kGpuBinaryAttrName)); pm.addPass(mlir::createCanonicalizerPass()); pm.addPass(mlir::createCSEPass()); return failed(pm.run(module)) ? InternalError("Final lowering of host side failed.") : Status::OK(); } } // namespace StatusOr<mlir::OwningModuleRef> GenerateKernelForTfCode( mlir::MLIRContext& context, llvm::StringRef tf_code, llvm::ArrayRef<std::string> architectures, llvm::ArrayRef<uint32_t> tile_sizes, llvm::ArrayRef<uint32_t> unroll_factors, bool embed_memref_prints, bool generate_fatbin, bool print_ptx, bool enable_ftz) { auto& registry = context.getDialectRegistry(); mlir::RegisterAllTensorFlowDialects(registry); registry.insert<mlir::chlo::HloClientDialect, mlir::mhlo::MhloDialect>(); mlir::OwningModuleRef module = mlir::parseSourceString(tf_code, &context); TF_RETURN_IF_ERROR(LowerTFtoGPU(module.get(), tile_sizes, unroll_factors, embed_memref_prints)); TF_RETURN_IF_ERROR(LowerKernelBodiesToLowLevelIr(module.get())); TF_RETURN_IF_ERROR(AmendKernelLLVMIRWithStaticKnowledge(module.get())); TF_RETURN_IF_ERROR(GenerateDeviceCode(module.get(), kGpuBinaryAttrName, architectures, generate_fatbin, print_ptx, enable_ftz)); TF_RETURN_IF_ERROR(LowerHostSideToFinalForm(module.get())); return module; } StatusOr<std::string> ExtractGpuBinary(mlir::ModuleOp module) { auto gpu_modules = module.getOps<mlir::gpu::GPUModuleOp>(); if (std::distance(gpu_modules.begin(), gpu_modules.end()) != 1) { return InternalError("There should be exactly one GPU Module"); } mlir::gpu::GPUModuleOp gpu_mod = *gpu_modules.begin(); auto blob = gpu_mod->getAttrOfType<mlir::StringAttr>(kGpuBinaryAttrName); if (blob == nullptr) { return InternalError("No binary blob found in the module"); } return blob.getValue().str(); } } // namespace kernel_gen } // namespace tensorflow
[ "gardener@tensorflow.org" ]
gardener@tensorflow.org
d53ac8dd64dd233cdc7d3c18fe4bcec76892dbef
101f3142bbcaf856f1a7824b2307364ed1315381
/Problem9.cpp
ea8e98c0d306ac42732e0513ff4570e70828acd9
[]
no_license
jwgreens/ProjectEuler
49de5c6181ac2d07f6aa44be07691f59bb37757a
7fd434f3ab6740fbe2b3038068f7d49f241087bb
refs/heads/master
2021-01-10T09:30:54.397054
2016-02-15T20:28:41
2016-02-15T20:28:41
51,762,777
0
0
null
null
null
null
UTF-8
C++
false
false
633
cpp
//There exists exactly one Pythagorean triplet for which a + b + c = 1000. //Find the product abc. #include <iostream> #include <math.h> using namespace std; int main() { bool flag = false; int c; for (int a = 1; a < 1000; a++) { for (int b = 1; b < 1000; b ++) { if ((a + b + sqrt(a*a + b*b)) == 1000) { c = sqrt(a*a + b*b); cout << a << " " << b << " " << c << endl; cout << a*b*c << endl; flag = true; } } if (flag == true) { break; } } return 0; }
[ "s1572908@inf.ed.ac.uk" ]
s1572908@inf.ed.ac.uk
07efc432829fc76b4c75c8f1a1f524543953124b
21805ed99bee0b9ccb2506ac4644f70c23b7c2ba
/CodeGenerator.cpp
2ec8cd2978a09d5cdd8c30c2ab117af02294bc0e
[]
no_license
mhagans/project4
7fd155bba9a2f74f1edb11b6476e5986446050bb
c805682531a8e35d907fd9542e9ab019a99ac137
refs/heads/master
2021-01-01T16:30:17.974776
2015-04-21T22:21:52
2015-04-21T22:21:52
38,394,450
0
0
null
null
null
null
UTF-8
C++
false
false
17,780
cpp
// // Created by Marcus on 4/12/2015. // #include "CodeGenerator.h" #include <iostream> #include <string> #include <sstream> using namespace std; CodeGenerator::CodeGenerator() { lineIndex = 1; tempVarIndex = 0; } void CodeGenerator::FunctionLine(string type, string id, int params) { char buffer[100]; currentFunctionID = id.c_str(); sprintf(buffer, "%-9d %-14s %-14s %-14s %-d\n", lineIndex, "func", id.c_str(), type.c_str(), params); printf("%s", buffer); lineIndex++; } void CodeGenerator::printParam() { char buffer[100]; sprintf(buffer, "%-9d %-14s %-14s %-14s %-s\n", lineIndex, "param", " ", " ", " "); printf("%s", buffer); lineIndex++; } void CodeGenerator::VarAllocation(string id) { char buffer[100]; sprintf(buffer, "%-9d %-14s %-14d %-14s %-s\n", lineIndex, "alloc", 4, " ", id.c_str()); printf("%s", buffer); lineIndex++; } void CodeGenerator::VarAllocation(string id, string num) { char buffer[100]; int size; istringstream(num) >> size; sprintf(buffer, "%-9d %-14s %-14d %-14s %-s\n", lineIndex, "alloc", 4, " ", id.c_str()); printf("%s", buffer); lineIndex++; for (int i = 0; i < size-1; i++) { sprintf(buffer, "%-9d %-14s %-14d %-14s %-s\n", lineIndex, "alloc", 4, " ", " "); printf("%s", buffer); lineIndex++; } } void CodeGenerator::Evaluate(queue<string> evalQue) { string rightSide; string leftSide; string firstOperand; string secondOperand; int operatorID; string compareOperator; char currentEvalTop; string arrayID = ""; string arrayPOS = ""; queue<string> arrayStack; do { if (evalQue.front()[1] == '$') { evalQue.front().erase(evalQue.front().begin()+1); } currentEvalTop = evalQue.front()[0]; switch (currentEvalTop) { case '-': case '+': if (operatorQue.empty()) { // Check to see if the stack is empty operatorQue.push(evalQue.front()); evalQue.pop(); }else { // Check to see if a ( is on the top if(operatorQue.top()[0] == '(') { operatorQue.push(evalQue.front()); }else { // check to see if there is * or / at the top of stack if (operatorQue.top()[0] == '*' || operatorQue.top()[0] == '/') { secondOperand = operandQue.top(); operandQue.pop(); firstOperand = operandQue.top(); operandQue.pop(); // check to see if * or / then Assign a a enum for * or / if(operatorQue.top()[0] == '*') { operatorID = MULT; }else { operatorID = DIV; } ArithimiticFunction(firstOperand, secondOperand, operatorID); operatorQue.push(evalQue.front()); }else { // add + or - since no higher precedence is there operatorQue.push(evalQue.front()); evalQue.pop(); } } } break; case '*': case '/': if (operatorQue.empty()) { operandQue.push(evalQue.front()); evalQue.pop(); }else { if (operatorQue.top()[0] == '(') { operatorQue.push(evalQue.front()); evalQue.pop(); }else { operatorQue.push(evalQue.front()); evalQue.pop(); } } break; case '=': operatorQue.push(evalQue.front()); evalQue.pop(); break; case '(': operatorQue.push(evalQue.front()); evalQue.pop(); break; case ')': break; case '<': case '>': if(operatorQue.empty()) { operatorQue.push(evalQue.front()); evalQue.pop(); } else { if(operatorQue.top()[0] == '*' || operatorQue.top()[0] == '/' || operatorQue.top()[0] == '+' || operatorQue.top()[0] == '-') { secondOperand = operandQue.top(); operandQue.pop(); firstOperand = operandQue.top(); operandQue.pop(); char operatorTop = operatorQue.top()[0]; operatorQue.pop(); switch (operatorTop) { case '+': operatorID = PLUS; break; case '-': operatorID = SUB; break; case '*': operatorID = MULT; break; case '/': operatorID = DIV; break; } ArithimiticFunction(firstOperand, secondOperand, operatorID); operatorQue.push(evalQue.front()); evalQue.pop(); } } break; case '[': arrayID = operandQue.top(); operandQue.pop(); operatorID = ARRAY; evalQue.pop(); while (evalQue.front()[0] != ']') { arrayStack.push(evalQue.front()); evalQue.pop(); } evalQue.pop(); if(arrayStack.size() > 1) { Evaluate(arrayStack); } else { arrayPOS = arrayStack.front(); ArithimiticFunction(arrayID, arrayPOS, operatorID); } break; default: operandQue.push(evalQue.front()); evalQue.pop(); } } while (!evalQue.empty()); do { secondOperand = operandQue.top(); operandQue.pop(); firstOperand = operandQue.top(); operandQue.pop(); switch (operatorQue.top()[0]) { case '+': operatorID = PLUS; break; case '-': operatorID = SUB; break; case '*': operatorID = MULT; break; case '/': operatorID = DIV; break; case '<': if(operatorQue.top().compare("<=") == 0) { operatorID = LTEQ; } else { operatorID = LT; } break; case '>': if(operatorQue.top().compare(">=") == 0) { operatorID = GTEQ; } else { operatorID = GT; } break; case '!': operatorID = NTEQ; break; case '=': if(operatorQue.top().compare("==") == 0) { operatorID = ISEQUAL; } else { operatorID = EQUAL; } break; } ArithimiticFunction(firstOperand, secondOperand, operatorID); operatorQue.pop(); } while (!operatorQue.empty()); } void CodeGenerator::ArithimiticFunction(string operandOne, string operandTwo, int operatorID) { char buffer[100]; int jumpIndex; string jumpSign; ostringstream convert; convert << tempVarIndex; string tempID; tempID = "_t" + convert.str(); switch (operatorID) { case PLUS: sprintf(buffer, "%-9d %-14s %-14s %-14s %-s\n", lineIndex, "add", operandOne.c_str(), operandTwo.c_str(), tempID.c_str()); printQue.push_back(buffer); operandQue.push(tempID); lineIndex++; tempVarIndex++; break; case SUB: sprintf(buffer, "%-9d %-14s %-14s %-14s %-s\n", lineIndex, "sub", operandOne.c_str(), operandTwo.c_str(), tempID.c_str()); printQue.push_back(buffer); operandQue.push(tempID); lineIndex++; tempVarIndex++; break; case MULT: sprintf(buffer, "%-9d %-14s %-14s %-14s %-s\n", lineIndex, "mult", operandOne.c_str(), operandTwo.c_str(), tempID.c_str()); printQue.push_back(buffer); operandQue.push(tempID); lineIndex++; tempVarIndex++; break; case DIV: sprintf(buffer, "%-9d %-14s %-14s %-14s %-s\n", lineIndex, "div", operandOne.c_str(), operandTwo.c_str(), tempID.c_str()); printQue.push_back(buffer); operandQue.push(tempID); lineIndex++; tempVarIndex++; break; case LT: case GT: sprintf(buffer, "%-9d %-14s %-14s %-14s %-s\n", lineIndex, "COMP", operandOne.c_str(), operandTwo.c_str(), tempID.c_str()); printQue.push_back(buffer); operandQue.push(tempID); lineIndex++; tempVarIndex++; if (operatorID == GT) { jumpSign = "JG"; }else { jumpSign = "JL"; } sprintf(buffer, "%-9d %-14s %-14s %-14s %-s\n", lineIndex, jumpSign.c_str(), operandQue.top().c_str(), " ", "$"); operandQue.pop(); //printf("%s", buffer); printQue.push_back(buffer); lineIndex++; break; case ISEQUAL: sprintf(buffer, "%-9d %-14s %-14s %-14s %-s\n", lineIndex, "COMP", operandOne.c_str(), operandTwo.c_str(), tempID.c_str()); printQue.push_back(buffer); operandQue.push(tempID); lineIndex++; tempVarIndex++; sprintf(buffer, "%-9d %-14s %-14s %-14s %-s\n", lineIndex, "EQ", operandQue.top().c_str(), " ", "$"); operandQue.pop(); //printf("%s", buffer); printQue.push_back(buffer); lineIndex++; case NTEQ: sprintf(buffer, "%-9d %-14s %-14s %-14s %-s\n", lineIndex, "COMP", operandOne.c_str(), operandTwo.c_str(), tempID.c_str()); printQue.push_back(buffer); operandQue.push(tempID); lineIndex++; tempVarIndex++; sprintf(buffer, "%-9d %-14s %-14s %-14s %-s\n", lineIndex, "NTEQ", operandQue.top().c_str(), " ", "$"); operandQue.pop(); //printf("%s", buffer); printQue.push_back(buffer); lineIndex++; case EQUAL: sprintf(buffer, "%-9d %-14s %-14s %-14s %-s\n", lineIndex, "assign", operandTwo.c_str(), " ", operandOne.c_str()); printQue.push_back(buffer); lineIndex++; break; case LTEQ: case GTEQ: sprintf(buffer, "%-9d %-14s %-14s %-14s %-s\n", lineIndex, "COMP", operandOne.c_str(), operandTwo.c_str(), tempID.c_str()); printQue.push_back(buffer); operandQue.push(tempID); lineIndex++; tempVarIndex++; if (operatorID == GTEQ) { jumpSign = "JGTE"; }else { jumpSign = "JLTE"; } sprintf(buffer, "%-9d %-14s %-14s %-14s %-s\n", lineIndex, jumpSign.c_str(), operandQue.top().c_str(), " ", "$"); operandQue.pop(); //printf("%s", buffer); printQue.push_back(buffer); lineIndex++; break; case ARRAY: string temp2 = tempID; sprintf(buffer, "%-9d %-14s %-14s %-14s %-s\n", lineIndex, "mult", "4", operandTwo.c_str(), tempID.c_str()); printQue.push_back(buffer); //operandQue.push(tempID); lineIndex++; tempVarIndex++; ostringstream convert; convert << tempVarIndex; tempID = "_t" + convert.str(); sprintf(buffer, "%-9d %-14s %-14s %-14s %-s\n", lineIndex, "disp", operandOne.c_str(), temp2.c_str(), tempID.c_str()); printQue.push_back(buffer); operandQue.push(tempID); lineIndex++; tempVarIndex++; break; } } void CodeGenerator::PrintStmt() { for (deque<string>::iterator it= printQue.begin(); it != printQue.end(); ++it) { cout << *it; } while(!printQue.empty()) { printQue.pop_front(); } } void CodeGenerator::WhileReturn() { char buffer[100]; ostringstream convert; convert << currentFunction; string jumpRe = convert.str(); sprintf(buffer, "%-9d %-14s %-14s %-14s %-s\n", lineIndex, "JR", " ", " ", jumpRe.c_str()); printQue.push_back(buffer); lineIndex++; for (deque<string>::iterator it= printQue.begin(); it != printQue.end(); ++it) { ostringstream testNumber; string replacement = *it; if(replacement[55] == '$') { testNumber << lineIndex; replacement.replace(54,7, " " + testNumber.str() + "\n"); printQue.erase(it); printQue.insert(it+1, replacement); break; } } } void CodeGenerator::FunctionEnd(string id) { char buffer[100]; sprintf(buffer, "%-9d %-14s %-14s %-14s %-s\n", lineIndex, "end", "func", id.c_str(), " "); printQue.push_back(buffer); lineIndex++; PrintStmt(); } void CodeGenerator::ReturnEval(queue<string> retnQue) { queue<string> evalQue; bool started = false; char buffer[100]; while(!retnQue.empty()) { if(retnQue.front()[0] == '(' && !started) { retnQue.pop(); started = true; } else { if (retnQue.front()[0] == ')' && started && retnQue.size() == 1) { retnQue.pop(); } else { evalQue.push(retnQue.front()); retnQue.pop(); } } } if (evalQue.size() == 1){ operandQue.push(evalQue.front()); evalQue.pop(); }else{ Evaluate(evalQue); } sprintf(buffer, "%-9d %-14s %-14s %-14s %-s\n", lineIndex, "return", " ", " ", operandQue.top().c_str()); printQue.push_back(buffer); operandQue.pop(); lineIndex++; } void CodeGenerator::ArgPrint(queue<string> argQue, int numberOfArgs){ stack<string> argStack; vector<string> args; while (!argQue.empty()) { argStack.push(argQue.front()); argQue.pop(); } for (int i = numberOfArgs - 1; i >= 0; i--) { args.push_back(argStack.top()); argStack.pop(); } char buffer[100]; for (int i = args.size() - 1; i >= 0; i--) { sprintf(buffer, "%-9d %-14s %-14s %-14s %-s\n", lineIndex, "arg", " ", " ", args[i].c_str()); printQue.push_back(buffer); lineIndex++; } } void CodeGenerator::FactorPrint(queue<string> factorQue, int argCount) { char buffer[100]; ostringstream convert; convert << tempVarIndex; string tempID; tempID = "_t" + convert.str(); string operandOne = factorQue.front().c_str(); factorQue.pop(); factorQue.pop(); string operandTwo = factorQue.front().c_str(); factorQue.pop(); sprintf(buffer, "%-9d %-14s %-14s %-14d %-s\n", lineIndex, "call", operandTwo.c_str(), argCount, tempID.c_str()); printQue.push_back(buffer); lineIndex++; tempVarIndex++; sprintf(buffer, "%-9d %-14s %-14s %-14s %-s\n", lineIndex, "assign", tempID.c_str(), " ", operandOne.c_str()); printQue.push_back(buffer); lineIndex++; tempVarIndex++; } void CodeGenerator::IfFunction() { char buffer[100]; ostringstream convert; convert << lineIndex + 1; string jumpRe = convert.str(); ifJumpValue = lineIndex + 1; sprintf(buffer, "%-9d %-14s %-14s %-14s %-s\n", lineIndex, "J", " ", " ", jumpRe.c_str()); printQue.push_back(buffer); lineIndex++; for (deque<string>::iterator it= printQue.begin(); it != printQue.end(); ++it) { string replacement = *it; if(replacement[55] == '$') { replacement.replace(54,7, " " + jumpRe + "\n"); printQue.erase(it); printQue.insert(it+1, replacement); break; } } } void CodeGenerator::ElseFunction() { ostringstream convert; convert << ifJumpValue; string jumpRe = convert.str(); bool passOne = false; for (deque<string>::iterator it= printQue.begin(); it != printQue.end(); ++it) { string replacement = *it; size_t pos = replacement.find(jumpRe, 55); if(pos == 55) { ostringstream testNumber; testNumber << lineIndex; replacement.replace(54,7, " " + testNumber.str() + "\n"); printQue.erase(it); if(passOne) { printQue.insert(it, replacement); break; } else { printQue.insert(it+1, replacement); passOne = true; } } } }
[ "marcuschagans@gmail.com" ]
marcuschagans@gmail.com
438d760aeb3d52eeede72a9aa7d4b273ed84e9f3
b60776fe3c35b48485b3e9fd85c38e2954e0186b
/Trees/printAllNodesAtDistanceKFromGivenNode.cpp
d73759b5caa977e18387feaf66e4c7b0ded1ff96
[]
no_license
aniket-gore/practice-codes
88994ef1719f21f1b1ae4c21b6fd7ad80d581e6b
4b3fbfb73da8cd1f2786717e4e8927bac69eefb2
refs/heads/master
2021-01-17T21:24:00.879741
2017-08-17T01:37:32
2017-08-17T01:37:32
36,997,219
0
0
null
null
null
null
UTF-8
C++
false
false
2,537
cpp
#include<iostream> using namespace std; // Time = O(n) // http://www.geeksforgeeks.org/print-nodes-distance-k-given-node-binary-tree/ /* Recursive function to print all the nodes at distance k in the tree (or subtree) rooted with given root. See */ struct node { int data; struct node *left, *right; }; void printkdistanceNodeDown(node *root, int k) { // Base Case if (root == NULL || k < 0) return; // If we reach a k distant node, print it if (k==0) { cout << root->data << endl; return; } // Recur for left and right subtrees printkdistanceNodeDown(root->left, k-1); printkdistanceNodeDown(root->right, k-1); } // Prints all nodes at distance k from a given target node. // The k distant nodes may be upward or downward. This function // Returns distance of root from target node, it returns -1 if target // node is not present in tree rooted with root. int printkdistanceNode(node* root, node* target , int k) { // Base Case 1: If tree is empty, return -1 if (root == NULL) return -1; // If target is same as root. Use the downward function // to print all nodes at distance k in subtree rooted with // target or root if (root == target) { printkdistanceNodeDown(root, k); return 0; } // Recur for left subtree int dl = printkdistanceNode(root->left, target, k); // Check if target node was found in left subtree if (dl != -1) { // If root is at distance k from target, print root // Note that dl is Distance of root's left child from target if (dl + 1 == k) cout << root->data << endl; // Else go to right subtree and print all k-dl-2 distant nodes // Note that the right child is 2 edges away from left child else printkdistanceNodeDown(root->right, k-dl-2); // Add 1 to the distance and return value for parent calls return 1 + dl; } // MIRROR OF ABOVE CODE FOR RIGHT SUBTREE // Note that we reach here only when node was not found in left subtree int dr = printkdistanceNode(root->right, target, k); if (dr != -1) { if (dr + 1 == k) cout << root->data << endl; else printkdistanceNodeDown(root->left, k-dr-2); return 1 + dr; } // If target was neither present in left nor in right subtree return -1; }
[ "aniketgore05@gmail.com" ]
aniketgore05@gmail.com
765aa160cd4c31cd457cd026023964421c8b736e
5f16210532e677e817d01b4023629ba858c5b5ce
/src/qt/qtipcserver.cpp
f8092748a748785b43b1766f9b5bf417cff47027
[ "MIT" ]
permissive
tulipcoins/tulipcoin
509648aedca976131ca611206f1ad41621515904
5e14b1e488b0672ca405a2732603b1e091e2bbd2
refs/heads/master
2021-05-13T23:23:40.968992
2018-01-12T12:50:13
2018-01-12T12:50:13
116,513,389
5
3
null
null
null
null
UTF-8
C++
false
false
4,929
cpp
// Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <boost/version.hpp> #if defined(WIN32) && BOOST_VERSION == 104900 #define BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME #define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME #endif #include "qtipcserver.h" #include "guiconstants.h" #include "ui_interface.h" #include "util.h" #include <boost/algorithm/string/predicate.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/interprocess/ipc/message_queue.hpp> #include <boost/version.hpp> #if defined(WIN32) && (!defined(BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME) || !defined(BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME) || BOOST_VERSION < 104900) #warning Compiling without BOOST_INTERPROCESS_HAS_WINDOWS_KERNEL_BOOTTIME and BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME uncommented in boost/interprocess/detail/tmp_dir_helpers.hpp or using a boost version before 1.49 may have unintended results see svn.boost.org/trac/boost/ticket/5392 #endif using namespace boost; using namespace boost::interprocess; using namespace boost::posix_time; #if defined MAC_OSX || defined __FreeBSD__ // URI handling not implemented on OSX yet void ipcScanRelay(int argc, char *argv[]) { } void ipcInit(int argc, char *argv[]) { } #else static void ipcThread2(void* pArg); static bool ipcScanCmd(int argc, char *argv[], bool fRelay) { // Check for URI in argv bool fSent = false; for (int i = 1; i < argc; i++) { if (boost::algorithm::istarts_with(argv[i], "tulipcoin:")) { const char *strURI = argv[i]; try { boost::interprocess::message_queue mq(boost::interprocess::open_only, BITCOINURI_QUEUE_NAME); if (mq.try_send(strURI, strlen(strURI), 0)) fSent = true; else if (fRelay) break; } catch (boost::interprocess::interprocess_exception &ex) { // don't log the "file not found" exception, because that's normal for // the first start of the first instance if (ex.get_error_code() != boost::interprocess::not_found_error || !fRelay) { printf("main() - boost interprocess exception #%d: %s\n", ex.get_error_code(), ex.what()); break; } } } } return fSent; } void ipcScanRelay(int argc, char *argv[]) { if (ipcScanCmd(argc, argv, true)) exit(0); } static void ipcThread(void* pArg) { // Make this thread recognisable as the GUI-IPC thread RenameThread("tulipcoin-gui-ipc"); try { ipcThread2(pArg); } catch (std::exception& e) { PrintExceptionContinue(&e, "ipcThread()"); } catch (...) { PrintExceptionContinue(NULL, "ipcThread()"); } printf("ipcThread exited\n"); } static void ipcThread2(void* pArg) { printf("ipcThread started\n"); message_queue* mq = (message_queue*)pArg; char buffer[MAX_URI_LENGTH + 1] = ""; size_t nSize = 0; unsigned int nPriority = 0; while (true) { ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(100); if (mq->timed_receive(&buffer, sizeof(buffer), nSize, nPriority, d)) { uiInterface.ThreadSafeHandleURI(std::string(buffer, nSize)); MilliSleep(1000); } if (fShutdown) break; } // Remove message queue message_queue::remove(BITCOINURI_QUEUE_NAME); // Cleanup allocated memory delete mq; } void ipcInit(int argc, char *argv[]) { message_queue* mq = NULL; char buffer[MAX_URI_LENGTH + 1] = ""; size_t nSize = 0; unsigned int nPriority = 0; try { mq = new message_queue(open_or_create, BITCOINURI_QUEUE_NAME, 2, MAX_URI_LENGTH); // Make sure we don't lose any bitcoin: URIs for (int i = 0; i < 2; i++) { ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(1); if (mq->timed_receive(&buffer, sizeof(buffer), nSize, nPriority, d)) { uiInterface.ThreadSafeHandleURI(std::string(buffer, nSize)); } else break; } // Make sure only one bitcoin instance is listening message_queue::remove(BITCOINURI_QUEUE_NAME); delete mq; mq = new message_queue(open_or_create, BITCOINURI_QUEUE_NAME, 2, MAX_URI_LENGTH); } catch (interprocess_exception &ex) { printf("ipcInit() - boost interprocess exception #%d: %s\n", ex.get_error_code(), ex.what()); return; } if (!NewThread(ipcThread, mq)) { delete mq; return; } ipcScanCmd(argc, argv, false); } #endif
[ "cricketcoin@yahoo.com" ]
cricketcoin@yahoo.com
b3e711d1d336dbf7e6c3a771712948e797d7c771
a91151da47ddd7690c2a5317326f67effb7f665b
/lib/cpp/src/thrift/transport/TSocketPool.cpp
55cdef72f1ec9f12f72d6a53f5cb54ef8d752b93
[ "Apache-2.0", "MIT", "LicenseRef-scancode-public-domain-disclaimer", "FSFAP" ]
permissive
shivam00/thrift
8ce84c032168760057a3282dfe2abd6c8810e420
d81e9e3d22c130ef5ddba7b06fb9802267d9d1d7
refs/heads/master
2020-03-30T07:37:16.444343
2019-01-15T16:39:07
2019-01-15T16:39:07
150,953,345
2
0
null
null
null
null
UTF-8
C++
false
false
7,042
cpp
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 <thrift/thrift-config.h> #include <algorithm> #include <iostream> #include <thrift/transport/TSocketPool.h> using std::pair; using std::string; using std::vector; namespace apache { namespace thrift { namespace transport { using stdcxx::shared_ptr; /** * TSocketPoolServer implementation * */ TSocketPoolServer::TSocketPoolServer() : host_(""), port_(0), socket_(THRIFT_INVALID_SOCKET), lastFailTime_(0), consecutiveFailures_(0) { } /** * Constructor for TSocketPool server */ TSocketPoolServer::TSocketPoolServer(const string& host, int port) : host_(host), port_(port), socket_(THRIFT_INVALID_SOCKET), lastFailTime_(0), consecutiveFailures_(0) { } /** * TSocketPool implementation. * */ TSocketPool::TSocketPool() : TSocket(), numRetries_(1), retryInterval_(60), maxConsecutiveFailures_(1), randomize_(true), alwaysTryLast_(true) { } TSocketPool::TSocketPool(const vector<string>& hosts, const vector<int>& ports) : TSocket(), numRetries_(1), retryInterval_(60), maxConsecutiveFailures_(1), randomize_(true), alwaysTryLast_(true) { if (hosts.size() != ports.size()) { GlobalOutput("TSocketPool::TSocketPool: hosts.size != ports.size"); throw TTransportException(TTransportException::BAD_ARGS); } for (unsigned int i = 0; i < hosts.size(); ++i) { addServer(hosts[i], ports[i]); } } TSocketPool::TSocketPool(const vector<pair<string, int> >& servers) : TSocket(), numRetries_(1), retryInterval_(60), maxConsecutiveFailures_(1), randomize_(true), alwaysTryLast_(true) { for (unsigned i = 0; i < servers.size(); ++i) { addServer(servers[i].first, servers[i].second); } } TSocketPool::TSocketPool(const vector<shared_ptr<TSocketPoolServer> >& servers) : TSocket(), servers_(servers), numRetries_(1), retryInterval_(60), maxConsecutiveFailures_(1), randomize_(true), alwaysTryLast_(true) { } TSocketPool::TSocketPool(const string& host, int port) : TSocket(), numRetries_(1), retryInterval_(60), maxConsecutiveFailures_(1), randomize_(true), alwaysTryLast_(true) { addServer(host, port); } TSocketPool::~TSocketPool() { vector<shared_ptr<TSocketPoolServer> >::const_iterator iter = servers_.begin(); vector<shared_ptr<TSocketPoolServer> >::const_iterator iterEnd = servers_.end(); for (; iter != iterEnd; ++iter) { setCurrentServer(*iter); TSocketPool::close(); } } void TSocketPool::addServer(const string& host, int port) { servers_.push_back(shared_ptr<TSocketPoolServer>(new TSocketPoolServer(host, port))); } void TSocketPool::addServer(shared_ptr<TSocketPoolServer>& server) { if (server) { servers_.push_back(server); } } void TSocketPool::setServers(const vector<shared_ptr<TSocketPoolServer> >& servers) { servers_ = servers; } void TSocketPool::getServers(vector<shared_ptr<TSocketPoolServer> >& servers) { servers = servers_; } void TSocketPool::setNumRetries(int numRetries) { numRetries_ = numRetries; } void TSocketPool::setRetryInterval(int retryInterval) { retryInterval_ = retryInterval; } void TSocketPool::setMaxConsecutiveFailures(int maxConsecutiveFailures) { maxConsecutiveFailures_ = maxConsecutiveFailures; } void TSocketPool::setRandomize(bool randomize) { randomize_ = randomize; } void TSocketPool::setAlwaysTryLast(bool alwaysTryLast) { alwaysTryLast_ = alwaysTryLast; } void TSocketPool::setCurrentServer(const shared_ptr<TSocketPoolServer>& server) { currentServer_ = server; host_ = server->host_; port_ = server->port_; socket_ = server->socket_; } /** * This function throws an exception if socket open fails. When socket * opens fails, the socket in the current server is reset. */ /* TODO: without apc we ignore a lot of functionality from the php version */ void TSocketPool::open() { size_t numServers = servers_.size(); if (numServers == 0) { socket_ = THRIFT_INVALID_SOCKET; throw TTransportException(TTransportException::NOT_OPEN); } if (isOpen()) { return; } if (randomize_ && numServers > 1) { random_shuffle(servers_.begin(), servers_.end()); } for (size_t i = 0; i < numServers; ++i) { shared_ptr<TSocketPoolServer>& server = servers_[i]; // Impersonate the server socket setCurrentServer(server); if (isOpen()) { // already open means we're done return; } bool retryIntervalPassed = (server->lastFailTime_ == 0); bool isLastServer = alwaysTryLast_ ? (i == (numServers - 1)) : false; if (server->lastFailTime_ > 0) { // The server was marked as down, so check if enough time has elapsed to retry time_t elapsedTime = time(NULL) - server->lastFailTime_; if (elapsedTime > retryInterval_) { retryIntervalPassed = true; } } if (retryIntervalPassed || isLastServer) { for (int j = 0; j < numRetries_; ++j) { try { TSocket::open(); } catch (const TException &e) { string errStr = "TSocketPool::open failed " + getSocketInfo() + ": " + e.what(); GlobalOutput(errStr.c_str()); socket_ = THRIFT_INVALID_SOCKET; continue; } // Copy over the opened socket so that we can keep it persistent server->socket_ = socket_; // reset lastFailTime_ is required server->lastFailTime_ = 0; // success return; } ++server->consecutiveFailures_; if (server->consecutiveFailures_ > maxConsecutiveFailures_) { // Mark server as down server->consecutiveFailures_ = 0; server->lastFailTime_ = time(NULL); } } } GlobalOutput("TSocketPool::open: all connections failed"); throw TTransportException(TTransportException::NOT_OPEN); } void TSocketPool::close() { TSocket::close(); if (currentServer_) { currentServer_->socket_ = THRIFT_INVALID_SOCKET; } } } } } // apache::thrift::transport
[ "shivam.gupta0002@gmail.com" ]
shivam.gupta0002@gmail.com
8db0709146352020c34bf5a95c5190d356e21d1b
f3f8e60e4c527d2757646bbdc85eca2f8bad5ce6
/luogu/涂色.cpp
353d86a10f66542cd4a42c52fc46c62e61a7816f
[]
no_license
cristiano-xw/c-homework
ff7a76bab907d3b8d62a777f9333620610c6efc0
21d15779e20b41d923bbfa547206798411ec208b
refs/heads/main
2023-04-03T01:50:07.678108
2021-04-09T13:33:09
2021-04-09T13:33:09
311,077,437
1
0
null
null
null
null
GB18030
C++
false
false
644
cpp
#include<bits/stdc++.h> using namespace std; char s[55]; int dp[55][55]; int n=0; //dp[i][j]表示从i到j需要的次数 int main() { scanf("%s",s+1);//我从第一位开始读入 int n=0; n=strlen(s+1);//找出长度 memset(dp,127,sizeof(dp)); for(int i=1;i<=n;i++) { dp[i][i]=1; //初始化 } for(int k=1;k<n;k++)//区间长度 { for(int i=1,j=i+k;j<=n;i++,j++)//遍历 { if(s[i]==s[j])//区间两端点相等 { dp[i][j]=min(dp[i][j-1],dp[i+1][j]); } else { for(int t=i;t<j;t++) { dp[i][j]=min(dp[i][j],dp[i][t]+dp[t+1][j]); } } } } cout<<dp[1][n]; return 0; }
[ "1531887383@qq.com" ]
1531887383@qq.com
0e01d9c22a62b08d39cbdd51e157100fc23caf5f
5c189101e85c86f7809cdfff1d2c025434fe4e9b
/VanControlCenter/LCDStringMsg.cpp
d856cd6583b9a7f069074c61c264e8e1133c6b18
[]
no_license
o-s-e/VanControlCenter
f259af78f9cfd74ce4ee58aac7084b7eed10f04f
134c3b6f4f6b0207d70d7a0346a3153286eb4247
refs/heads/master
2020-12-31T05:40:43.999629
2018-01-24T16:11:59
2018-01-24T16:11:59
80,650,269
0
0
null
null
null
null
UTF-8
C++
false
false
861
cpp
#include "LCDStringMsg.h" void LcdStringMsg::init(byte widgetIndex, Genie* parent) { this->widgetIndex_ = widgetIndex; this->parent_ = parent; } void LcdStringMsg::clear() { //Replace all char except \n with with space for (uint16_t i = 0; i < buffer_.length(); i++) { if (buffer_.charAt(i) != '\n') { buffer_.setCharAt(i, ' '); } } //Update screen repaint(); //Clear the buffer buffer_.remove(0, buffer_.length()); } const String& LcdStringMsg::getMessage() { return buffer_; } void LcdStringMsg::repaint() { parent_->WriteStr(widgetIndex_, const_cast<char*>(buffer_.c_str())); } void LcdStringMsg::setMessage(const String& str) { clear(); buffer_ += str; repaint(); } void LcdStringMsg::setMessage(const char* str) { clear(); buffer_ += str; repaint(); }
[ "ose@recommind.com" ]
ose@recommind.com
a87339253b2c536c2c17cf0d3aa2210272acc078
04251e142abab46720229970dab4f7060456d361
/lib/rosetta/source/src/numeric/random/WeightedSampler.hh
f01ae89cfea26ca14e320008da20eb32d7b49e37
[]
no_license
sailfish009/binding_affinity_calculator
216257449a627d196709f9743ca58d8764043f12
7af9ce221519e373aa823dadc2005de7a377670d
refs/heads/master
2022-12-29T11:15:45.164881
2020-10-22T09:35:32
2020-10-22T09:35:32
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,542
hh
// -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*- // vi: set ts=2 noet: // // (c) Copyright Rosetta Commons Member Institutions. // (c) This file is part of the Rosetta software suite and is made available under license. // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons. // (c) For more information, see http://www.rosettacommons.org. Questions about this can be // (c) addressed to University of Washington CoMotion, email: license@uw.edu. /// @file numeric/random/WeightedSampler.hh /// /// @brief a class to generate random positive integers using a given set of weights /// @author Colin A. Smith #ifndef INCLUDED_numeric_random_WeightedSampler_hh #define INCLUDED_numeric_random_WeightedSampler_hh // numeric forward headers #include <numeric/random/WeightedSampler.fwd.hh> // numeric headers #include <numeric/random/random.fwd.hh> #include <numeric/types.hh> // External library headers #include <utility/vector1.hh> namespace numeric { namespace random { /// @brief class WeightedSampler { public: // Creation /// @brief Constructor WeightedSampler(); /// @brief Constructor WeightedSampler( numeric::Size num_weights ); /// @brief Constructor WeightedSampler( utility::vector1<numeric::Real> const & weights ); /// @brief Destructor virtual ~WeightedSampler(); /// @brief Copy constructor WeightedSampler( WeightedSampler const & ); /// @brief Copy operator WeightedSampler & operator=( WeightedSampler const & ); public: // Methods /// @brief get weights utility::vector1<numeric::Real> const & weights() const { return weights_; } /// @brief set weights void weights( utility::vector1<numeric::Real> const & weights ) { weights_ = weights; cumulative_distribution_valid_ = false; } /// @brief add a single weight to the end void add_weight( numeric::Real weight ) { weights_.push_back(weight); cumulative_distribution_valid_ = false; } /// @brief set a single weight void set_weight( numeric::Size weight_num, numeric::Real weight ) { weights_[weight_num] = weight; cumulative_distribution_valid_ = false; } /// @brief clear weights void clear() { weights_.clear(); cumulative_distribution_valid_ = false; } /// @brief get number of weights numeric::Size size() const { return weights_.size(); } /// @brief resize weights void resize( numeric::Size num_weights, numeric::Real default_weight = 0 ) { weights_.resize(num_weights, default_weight); } /// @brief get a random sample using the default random generator numeric::Size random_sample() const; /// @brief get a random sample by passing a random generator numeric::Size random_sample( numeric::random::RandomGenerator& ) const; /// @brief get a random sample by passing a random number from 0 to 1 numeric::Size random_sample( numeric::Real randnum ) const; /// @brief Update the internal cumulative distribution results /// Returns false if there's an issue with updating the distribution /// (e.g. empty or all zero weights) bool update_cumulative_distribution() const; private: // Fields utility::vector1<numeric::Real> weights_; mutable utility::vector1<numeric::Real> cumulative_distribution_; mutable bool cumulative_distribution_valid_; }; // WeightedSampler std::ostream & operator<< (std::ostream & out, WeightedSampler const & sampler ); } // namespace random } // namespace numeric #endif // INCLUDED_numeric_random_WeightedSampler_HH
[ "lzhangbk@connect.ust.hk" ]
lzhangbk@connect.ust.hk
56b12514fbabac98f849e51f69fcb5180470236b
15b175f579a1d549a84a088c01db343ffc3afa5d
/src/netbase.cpp
c3ac9d4d926f8da9565516aff1dea1bf0feca54f
[ "MIT" ]
permissive
ArchieMakeator/makeator1
cf1ea5de3b4511b1a552d75a081d63fb4054e408
23e5e979b4a5f8c0b3b1b025da7fd9df992114e1
refs/heads/master
2020-03-22T08:29:31.042498
2018-11-24T15:37:23
2018-11-24T15:37:23
139,769,737
0
0
null
null
null
null
UTF-8
C++
false
false
43,449
cpp
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifdef HAVE_CONFIG_H #include "config/chronos-config.h" #endif #include "netbase.h" #include "hash.h" #include "sync.h" #include "uint256.h" #include "random.h" #include "util.h" #include "utilstrencodings.h" #ifdef HAVE_GETADDRINFO_A #include <netdb.h> #endif #ifndef WIN32 #if HAVE_INET_PTON #include <arpa/inet.h> #endif #include <fcntl.h> #endif #include <boost/algorithm/string/case_conv.hpp> // for to_lower() #include <boost/algorithm/string/predicate.hpp> // for startswith() and endswith() #include <boost/thread.hpp> #if !defined(HAVE_MSG_NOSIGNAL) && !defined(MSG_NOSIGNAL) #define MSG_NOSIGNAL 0 #endif using namespace std; // Settings static proxyType proxyInfo[NET_MAX]; static proxyType nameProxy; static CCriticalSection cs_proxyInfos; int nConnectTimeout = DEFAULT_CONNECT_TIMEOUT; bool fNameLookup = false; static const unsigned char pchIPv4[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff}; // Need ample time for negotiation for very slow proxies such as Tor (milliseconds) static const int SOCKS5_RECV_TIMEOUT = 20 * 1000; enum Network ParseNetwork(std::string net) { boost::to_lower(net); if (net == "ipv4") return NET_IPV4; if (net == "ipv6") return NET_IPV6; if (net == "tor" || net == "onion") return NET_TOR; return NET_UNROUTABLE; } std::string GetNetworkName(enum Network net) { switch (net) { case NET_IPV4: return "ipv4"; case NET_IPV6: return "ipv6"; case NET_TOR: return "onion"; default: return ""; } } void SplitHostPort(std::string in, int& portOut, std::string& hostOut) { size_t colon = in.find_last_of(':'); // if a : is found, and it either follows a [...], or no other : is in the string, treat it as port separator bool fHaveColon = colon != in.npos; bool fBracketed = fHaveColon && (in[0] == '[' && in[colon - 1] == ']'); // if there is a colon, and in[0]=='[', colon is not 0, so in[colon-1] is safe bool fMultiColon = fHaveColon && (in.find_last_of(':', colon - 1) != in.npos); if (fHaveColon && (colon == 0 || fBracketed || !fMultiColon)) { int32_t n; if (ParseInt32(in.substr(colon + 1), &n) && n > 0 && n < 0x10000) { in = in.substr(0, colon); portOut = n; } } if (in.size() > 0 && in[0] == '[' && in[in.size() - 1] == ']') hostOut = in.substr(1, in.size() - 2); else hostOut = in; } bool static LookupIntern(const char* pszName, std::vector<CNetAddr>& vIP, unsigned int nMaxSolutions, bool fAllowLookup) { vIP.clear(); { CNetAddr addr; if (addr.SetSpecial(std::string(pszName))) { vIP.push_back(addr); return true; } } #ifdef HAVE_GETADDRINFO_A struct in_addr ipv4_addr; #ifdef HAVE_INET_PTON if (inet_pton(AF_INET, pszName, &ipv4_addr) > 0) { vIP.push_back(CNetAddr(ipv4_addr)); return true; } struct in6_addr ipv6_addr; if (inet_pton(AF_INET6, pszName, &ipv6_addr) > 0) { vIP.push_back(CNetAddr(ipv6_addr)); return true; } #else ipv4_addr.s_addr = inet_addr(pszName); if (ipv4_addr.s_addr != INADDR_NONE) { vIP.push_back(CNetAddr(ipv4_addr)); return true; } #endif #endif struct addrinfo aiHint; memset(&aiHint, 0, sizeof(struct addrinfo)); aiHint.ai_socktype = SOCK_STREAM; aiHint.ai_protocol = IPPROTO_TCP; aiHint.ai_family = AF_UNSPEC; #ifdef WIN32 aiHint.ai_flags = fAllowLookup ? 0 : AI_NUMERICHOST; #else aiHint.ai_flags = fAllowLookup ? AI_ADDRCONFIG : AI_NUMERICHOST; #endif struct addrinfo* aiRes = NULL; #ifdef HAVE_GETADDRINFO_A struct gaicb gcb, *query = &gcb; memset(query, 0, sizeof(struct gaicb)); gcb.ar_name = pszName; gcb.ar_request = &aiHint; int nErr = getaddrinfo_a(GAI_NOWAIT, &query, 1, NULL); if (nErr) return false; do { // Should set the timeout limit to a resonable value to avoid // generating unnecessary checking call during the polling loop, // while it can still response to stop request quick enough. // 2 seconds looks fine in our situation. struct timespec ts = {2, 0}; gai_suspend(&query, 1, &ts); boost::this_thread::interruption_point(); nErr = gai_error(query); if (0 == nErr) aiRes = query->ar_result; } while (nErr == EAI_INPROGRESS); #else int nErr = getaddrinfo(pszName, NULL, &aiHint, &aiRes); #endif if (nErr) return false; struct addrinfo* aiTrav = aiRes; while (aiTrav != NULL && (nMaxSolutions == 0 || vIP.size() < nMaxSolutions)) { if (aiTrav->ai_family == AF_INET) { assert(aiTrav->ai_addrlen >= sizeof(sockaddr_in)); vIP.push_back(CNetAddr(((struct sockaddr_in*)(aiTrav->ai_addr))->sin_addr)); } if (aiTrav->ai_family == AF_INET6) { assert(aiTrav->ai_addrlen >= sizeof(sockaddr_in6)); vIP.push_back(CNetAddr(((struct sockaddr_in6*)(aiTrav->ai_addr))->sin6_addr)); } aiTrav = aiTrav->ai_next; } freeaddrinfo(aiRes); return (vIP.size() > 0); } bool LookupHost(const char* pszName, std::vector<CNetAddr>& vIP, unsigned int nMaxSolutions, bool fAllowLookup) { std::string strHost(pszName); if (strHost.empty()) return false; if (boost::algorithm::starts_with(strHost, "[") && boost::algorithm::ends_with(strHost, "]")) { strHost = strHost.substr(1, strHost.size() - 2); } return LookupIntern(strHost.c_str(), vIP, nMaxSolutions, fAllowLookup); } bool Lookup(const char* pszName, std::vector<CService>& vAddr, int portDefault, bool fAllowLookup, unsigned int nMaxSolutions) { if (pszName[0] == 0) return false; int port = portDefault; std::string hostname = ""; SplitHostPort(std::string(pszName), port, hostname); std::vector<CNetAddr> vIP; bool fRet = LookupIntern(hostname.c_str(), vIP, nMaxSolutions, fAllowLookup); if (!fRet) return false; vAddr.resize(vIP.size()); for (unsigned int i = 0; i < vIP.size(); i++) vAddr[i] = CService(vIP[i], port); return true; } bool Lookup(const char* pszName, CService& addr, int portDefault, bool fAllowLookup) { std::vector<CService> vService; bool fRet = Lookup(pszName, vService, portDefault, fAllowLookup, 1); if (!fRet) return false; addr = vService[0]; return true; } bool LookupNumeric(const char* pszName, CService& addr, int portDefault) { return Lookup(pszName, addr, portDefault, false); } struct timeval MillisToTimeval(int64_t nTimeout) { struct timeval timeout; timeout.tv_sec = nTimeout / 1000; timeout.tv_usec = (nTimeout % 1000) * 1000; return timeout; } /** * Read bytes from socket. This will either read the full number of bytes requested * or return False on error or timeout. * This function can be interrupted by boost thread interrupt. * * @param data Buffer to receive into * @param len Length of data to receive * @param timeout Timeout in milliseconds for receive operation * * @note This function requires that hSocket is in non-blocking mode. */ bool static InterruptibleRecv(char* data, size_t len, int timeout, SOCKET& hSocket) { int64_t curTime = GetTimeMillis(); int64_t endTime = curTime + timeout; // Maximum time to wait in one select call. It will take up until this time (in millis) // to break off in case of an interruption. const int64_t maxWait = 1000; while (len > 0 && curTime < endTime) { ssize_t ret = recv(hSocket, data, len, 0); // Optimistically try the recv first if (ret > 0) { len -= ret; data += ret; } else if (ret == 0) { // Unexpected disconnection return false; } else { // Other error or blocking int nErr = WSAGetLastError(); if (nErr == WSAEINPROGRESS || nErr == WSAEWOULDBLOCK || nErr == WSAEINVAL) { if (!IsSelectableSocket(hSocket)) { return false; } struct timeval tval = MillisToTimeval(std::min(endTime - curTime, maxWait)); fd_set fdset; FD_ZERO(&fdset); FD_SET(hSocket, &fdset); int nRet = select(hSocket + 1, &fdset, NULL, NULL, &tval); if (nRet == SOCKET_ERROR) { return false; } } else { return false; } } boost::this_thread::interruption_point(); curTime = GetTimeMillis(); } return len == 0; } struct ProxyCredentials { std::string username; std::string password; }; /** Connect using SOCKS5 (as described in RFC1928) */ bool static Socks5(string strDest, int port, const ProxyCredentials *auth, SOCKET& hSocket) { LogPrintf("SOCKS5 connecting %s\n", strDest); if (strDest.size() > 255) { CloseSocket(hSocket); return error("Hostname too long"); } // Accepted authentication methods std::vector<uint8_t> vSocks5Init; vSocks5Init.push_back(0x05); if (auth) { vSocks5Init.push_back(0x02); // # METHODS vSocks5Init.push_back(0x00); // X'00' NO AUTHENTICATION REQUIRED vSocks5Init.push_back(0x02); // X'02' USERNAME/PASSWORD (RFC1929) } else { vSocks5Init.push_back(0x01); // # METHODS vSocks5Init.push_back(0x00); // X'00' NO AUTHENTICATION REQUIRED } ssize_t ret = send(hSocket, (const char*)begin_ptr(vSocks5Init), vSocks5Init.size(), MSG_NOSIGNAL); if (ret != (ssize_t)vSocks5Init.size()) { CloseSocket(hSocket); return error("Error sending to proxy"); } char pchRet1[2]; if (!InterruptibleRecv(pchRet1, 2, SOCKS5_RECV_TIMEOUT, hSocket)) { CloseSocket(hSocket); return error("Error reading proxy response"); } if (pchRet1[0] != 0x05) { CloseSocket(hSocket); return error("Proxy failed to initialize"); } if (pchRet1[1] == 0x02 && auth) { // Perform username/password authentication (as described in RFC1929) std::vector<uint8_t> vAuth; vAuth.push_back(0x01); if (auth->username.size() > 255 || auth->password.size() > 255) return error("Proxy username or password too long"); vAuth.push_back(auth->username.size()); vAuth.insert(vAuth.end(), auth->username.begin(), auth->username.end()); vAuth.push_back(auth->password.size()); vAuth.insert(vAuth.end(), auth->password.begin(), auth->password.end()); ret = send(hSocket, (const char*)begin_ptr(vAuth), vAuth.size(), MSG_NOSIGNAL); if (ret != (ssize_t)vAuth.size()) { CloseSocket(hSocket); return error("Error sending authentication to proxy"); } LogPrint("proxy", "SOCKS5 sending proxy authentication %s:%s\n", auth->username, auth->password); char pchRetA[2]; if (!InterruptibleRecv(pchRetA, 2, SOCKS5_RECV_TIMEOUT, hSocket)) { CloseSocket(hSocket); return error("Error reading proxy authentication response"); } if (pchRetA[0] != 0x01 || pchRetA[1] != 0x00) { CloseSocket(hSocket); return error("Proxy authentication unsuccesful"); } } else if (pchRet1[1] == 0x00) { // Perform no authentication } else { CloseSocket(hSocket); return error("Proxy requested wrong authentication method %02x", pchRet1[1]); } std::vector<uint8_t> vSocks5; vSocks5.push_back(0x05); // VER protocol version vSocks5.push_back(0x01); // CMD CONNECT vSocks5.push_back(0x00); // RSV Reserved vSocks5.push_back(0x03); // ATYP DOMAINNAME vSocks5.push_back(strDest.size()); // Length<=255 is checked at beginning of function vSocks5.insert(vSocks5.end(), strDest.begin(), strDest.end()); vSocks5.push_back((port >> 8) & 0xFF); vSocks5.push_back((port >> 0) & 0xFF); ret = send(hSocket, (const char*)begin_ptr(vSocks5), vSocks5.size(), MSG_NOSIGNAL); if (ret != (ssize_t)vSocks5.size()) { CloseSocket(hSocket); return error("Error sending to proxy"); } char pchRet2[4]; if (!InterruptibleRecv(pchRet2, 4, SOCKS5_RECV_TIMEOUT, hSocket)) { CloseSocket(hSocket); return error("Error reading proxy response"); } if (pchRet2[0] != 0x05) { CloseSocket(hSocket); return error("Proxy failed to accept request"); } if (pchRet2[1] != 0x00) { CloseSocket(hSocket); switch (pchRet2[1]) { case 0x01: return error("Proxy error: general failure"); case 0x02: return error("Proxy error: connection not allowed"); case 0x03: return error("Proxy error: network unreachable"); case 0x04: return error("Proxy error: host unreachable"); case 0x05: return error("Proxy error: connection refused"); case 0x06: return error("Proxy error: TTL expired"); case 0x07: return error("Proxy error: protocol error"); case 0x08: return error("Proxy error: address type not supported"); default: return error("Proxy error: unknown"); } } if (pchRet2[2] != 0x00) { CloseSocket(hSocket); return error("Error: malformed proxy response"); } char pchRet3[256]; switch (pchRet2[3]) { case 0x01: ret = InterruptibleRecv(pchRet3, 4, SOCKS5_RECV_TIMEOUT, hSocket); break; case 0x04: ret = InterruptibleRecv(pchRet3, 16, SOCKS5_RECV_TIMEOUT, hSocket); break; case 0x03: { ret = InterruptibleRecv(pchRet3, 1, SOCKS5_RECV_TIMEOUT, hSocket); if (!ret) { CloseSocket(hSocket); return error("Error reading from proxy"); } int nRecv = pchRet3[0]; ret = InterruptibleRecv(pchRet3, nRecv, SOCKS5_RECV_TIMEOUT, hSocket); break; } default: CloseSocket(hSocket); return error("Error: malformed proxy response"); } if (!ret) { CloseSocket(hSocket); return error("Error reading from proxy"); } if (!InterruptibleRecv(pchRet3, 2, SOCKS5_RECV_TIMEOUT, hSocket)) { CloseSocket(hSocket); return error("Error reading from proxy"); } LogPrintf("SOCKS5 connected %s\n", strDest); return true; } bool static ConnectSocketDirectly(const CService& addrConnect, SOCKET& hSocketRet, int nTimeout) { hSocketRet = INVALID_SOCKET; struct sockaddr_storage sockaddr; socklen_t len = sizeof(sockaddr); if (!addrConnect.GetSockAddr((struct sockaddr*)&sockaddr, &len)) { LogPrintf("Cannot connect to %s: unsupported network\n", addrConnect.ToString()); return false; } SOCKET hSocket = socket(((struct sockaddr*)&sockaddr)->sa_family, SOCK_STREAM, IPPROTO_TCP); if (hSocket == INVALID_SOCKET) return false; #ifdef SO_NOSIGPIPE int set = 1; // Different way of disabling SIGPIPE on BSD setsockopt(hSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&set, sizeof(int)); #endif // Set to non-blocking if (!SetSocketNonBlocking(hSocket, true)) return error("ConnectSocketDirectly: Setting socket to non-blocking failed, error %s\n", NetworkErrorString(WSAGetLastError())); if (connect(hSocket, (struct sockaddr*)&sockaddr, len) == SOCKET_ERROR) { int nErr = WSAGetLastError(); // WSAEINVAL is here because some legacy version of winsock uses it if (nErr == WSAEINPROGRESS || nErr == WSAEWOULDBLOCK || nErr == WSAEINVAL) { struct timeval timeout = MillisToTimeval(nTimeout); fd_set fdset; FD_ZERO(&fdset); FD_SET(hSocket, &fdset); int nRet = select(hSocket + 1, NULL, &fdset, NULL, &timeout); if (nRet == 0) { LogPrint("net", "connection to %s timeout\n", addrConnect.ToString()); CloseSocket(hSocket); return false; } if (nRet == SOCKET_ERROR) { LogPrintf("select() for %s failed: %s\n", addrConnect.ToString(), NetworkErrorString(WSAGetLastError())); CloseSocket(hSocket); return false; } socklen_t nRetSize = sizeof(nRet); #ifdef WIN32 if (getsockopt(hSocket, SOL_SOCKET, SO_ERROR, (char*)(&nRet), &nRetSize) == SOCKET_ERROR) #else if (getsockopt(hSocket, SOL_SOCKET, SO_ERROR, &nRet, &nRetSize) == SOCKET_ERROR) #endif { LogPrintf("getsockopt() for %s failed: %s\n", addrConnect.ToString(), NetworkErrorString(WSAGetLastError())); CloseSocket(hSocket); return false; } if (nRet != 0) { LogPrintf("connect() to %s failed after select(): %s\n", addrConnect.ToString(), NetworkErrorString(nRet)); CloseSocket(hSocket); return false; } } #ifdef WIN32 else if (WSAGetLastError() != WSAEISCONN) #else else #endif { LogPrintf("connect() to %s failed: %s\n", addrConnect.ToString(), NetworkErrorString(WSAGetLastError())); CloseSocket(hSocket); return false; } } hSocketRet = hSocket; return true; } bool SetProxy(enum Network net, const proxyType &addrProxy) { assert(net >= 0 && net < NET_MAX); if (!addrProxy.IsValid()) return false; LOCK(cs_proxyInfos); proxyInfo[net] = addrProxy; return true; } bool GetProxy(enum Network net, proxyType& proxyInfoOut) { assert(net >= 0 && net < NET_MAX); LOCK(cs_proxyInfos); if (!proxyInfo[net].IsValid()) return false; proxyInfoOut = proxyInfo[net]; return true; } bool SetNameProxy(const proxyType &addrProxy) { if (!addrProxy.IsValid()) return false; LOCK(cs_proxyInfos); nameProxy = addrProxy; return true; } bool GetNameProxy(proxyType &nameProxyOut) { LOCK(cs_proxyInfos); if (!nameProxy.IsValid()) return false; nameProxyOut = nameProxy; return true; } bool HaveNameProxy() { LOCK(cs_proxyInfos); return nameProxy.IsValid(); } bool IsProxy(const CNetAddr& addr) { LOCK(cs_proxyInfos); for (int i = 0; i < NET_MAX; i++) { if (addr == (CNetAddr)proxyInfo[i].proxy) return true; } return false; } static bool ConnectThroughProxy(const proxyType &proxy, const std::string strDest, int port, SOCKET& hSocketRet, int nTimeout, bool *outProxyConnectionFailed) { SOCKET hSocket = INVALID_SOCKET; // first connect to proxy server if (!ConnectSocketDirectly(proxy.proxy, hSocket, nTimeout)) { if (outProxyConnectionFailed) *outProxyConnectionFailed = true; return false; } // do socks negotiation if (proxy.randomize_credentials) { ProxyCredentials random_auth; random_auth.username = strprintf("%i", insecure_rand()); random_auth.password = strprintf("%i", insecure_rand()); if (!Socks5(strDest, (unsigned short)port, &random_auth, hSocket)) return false; } else { if (!Socks5(strDest, (unsigned short)port, 0, hSocket)) return false; } hSocketRet = hSocket; return true; } bool ConnectSocket(const CService &addrDest, SOCKET& hSocketRet, int nTimeout, bool *outProxyConnectionFailed) { proxyType proxy; if (outProxyConnectionFailed) *outProxyConnectionFailed = false; if (GetProxy(addrDest.GetNetwork(), proxy)) return ConnectThroughProxy(proxy, addrDest.ToStringIP(), addrDest.GetPort(), hSocketRet, nTimeout, outProxyConnectionFailed); else // no proxy needed (none set for target network) return ConnectSocketDirectly(addrDest, hSocketRet, nTimeout); } bool ConnectSocketByName(CService& addr, SOCKET& hSocketRet, const char* pszDest, int portDefault, int nTimeout, bool* outProxyConnectionFailed) { string strDest; int port = portDefault; if (outProxyConnectionFailed) *outProxyConnectionFailed = false; SplitHostPort(string(pszDest), port, strDest); proxyType nameProxy; GetNameProxy(nameProxy); CService addrResolved(CNetAddr(strDest, fNameLookup && !HaveNameProxy()), port); if (addrResolved.IsValid()) { addr = addrResolved; return ConnectSocket(addr, hSocketRet, nTimeout); } addr = CService("0.0.0.0:0"); if (!HaveNameProxy()) return false; return ConnectThroughProxy(nameProxy, strDest, port, hSocketRet, nTimeout, outProxyConnectionFailed); } void CNetAddr::Init() { memset(ip, 0, sizeof(ip)); } void CNetAddr::SetIP(const CNetAddr& ipIn) { memcpy(ip, ipIn.ip, sizeof(ip)); } void CNetAddr::SetRaw(Network network, const uint8_t* ip_in) { switch (network) { case NET_IPV4: memcpy(ip, pchIPv4, 12); memcpy(ip + 12, ip_in, 4); break; case NET_IPV6: memcpy(ip, ip_in, 16); break; default: assert(!"invalid network"); } } static const unsigned char pchOnionCat[] = {0xFD, 0x87, 0xD8, 0x7E, 0xEB, 0x43}; bool CNetAddr::SetSpecial(const std::string& strName) { if (strName.size() > 6 && strName.substr(strName.size() - 6, 6) == ".onion") { std::vector<unsigned char> vchAddr = DecodeBase32(strName.substr(0, strName.size() - 6).c_str()); if (vchAddr.size() != 16 - sizeof(pchOnionCat)) return false; memcpy(ip, pchOnionCat, sizeof(pchOnionCat)); for (unsigned int i = 0; i < 16 - sizeof(pchOnionCat); i++) ip[i + sizeof(pchOnionCat)] = vchAddr[i]; return true; } return false; } CNetAddr::CNetAddr() { Init(); } CNetAddr::CNetAddr(const struct in_addr& ipv4Addr) { SetRaw(NET_IPV4, (const uint8_t*)&ipv4Addr); } CNetAddr::CNetAddr(const struct in6_addr& ipv6Addr) { SetRaw(NET_IPV6, (const uint8_t*)&ipv6Addr); } CNetAddr::CNetAddr(const char* pszIp, bool fAllowLookup) { Init(); std::vector<CNetAddr> vIP; if (LookupHost(pszIp, vIP, 1, fAllowLookup)) *this = vIP[0]; } CNetAddr::CNetAddr(const std::string& strIp, bool fAllowLookup) { Init(); std::vector<CNetAddr> vIP; if (LookupHost(strIp.c_str(), vIP, 1, fAllowLookup)) *this = vIP[0]; } unsigned int CNetAddr::GetByte(int n) const { return ip[15 - n]; } bool CNetAddr::IsIPv4() const { return (memcmp(ip, pchIPv4, sizeof(pchIPv4)) == 0); } bool CNetAddr::IsIPv6() const { return (!IsIPv4() && !IsTor()); } bool CNetAddr::IsRFC1918() const { return IsIPv4() && (GetByte(3) == 10 || (GetByte(3) == 192 && GetByte(2) == 168) || (GetByte(3) == 172 && (GetByte(2) >= 16 && GetByte(2) <= 31))); } bool CNetAddr::IsRFC2544() const { return IsIPv4() && GetByte(3) == 198 && (GetByte(2) == 18 || GetByte(2) == 19); } bool CNetAddr::IsRFC3927() const { return IsIPv4() && (GetByte(3) == 169 && GetByte(2) == 254); } bool CNetAddr::IsRFC6598() const { return IsIPv4() && GetByte(3) == 100 && GetByte(2) >= 64 && GetByte(2) <= 127; } bool CNetAddr::IsRFC5737() const { return IsIPv4() && ((GetByte(3) == 192 && GetByte(2) == 0 && GetByte(1) == 2) || (GetByte(3) == 198 && GetByte(2) == 51 && GetByte(1) == 100) || (GetByte(3) == 203 && GetByte(2) == 0 && GetByte(1) == 113)); } bool CNetAddr::IsRFC3849() const { return GetByte(15) == 0x20 && GetByte(14) == 0x01 && GetByte(13) == 0x0D && GetByte(12) == 0xB8; } bool CNetAddr::IsRFC3964() const { return (GetByte(15) == 0x20 && GetByte(14) == 0x02); } bool CNetAddr::IsRFC6052() const { static const unsigned char pchRFC6052[] = {0, 0x64, 0xFF, 0x9B, 0, 0, 0, 0, 0, 0, 0, 0}; return (memcmp(ip, pchRFC6052, sizeof(pchRFC6052)) == 0); } bool CNetAddr::IsRFC4380() const { return (GetByte(15) == 0x20 && GetByte(14) == 0x01 && GetByte(13) == 0 && GetByte(12) == 0); } bool CNetAddr::IsRFC4862() const { static const unsigned char pchRFC4862[] = {0xFE, 0x80, 0, 0, 0, 0, 0, 0}; return (memcmp(ip, pchRFC4862, sizeof(pchRFC4862)) == 0); } bool CNetAddr::IsRFC4193() const { return ((GetByte(15) & 0xFE) == 0xFC); } bool CNetAddr::IsRFC6145() const { static const unsigned char pchRFC6145[] = {0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0, 0}; return (memcmp(ip, pchRFC6145, sizeof(pchRFC6145)) == 0); } bool CNetAddr::IsRFC4843() const { return (GetByte(15) == 0x20 && GetByte(14) == 0x01 && GetByte(13) == 0x00 && (GetByte(12) & 0xF0) == 0x10); } bool CNetAddr::IsTor() const { return (memcmp(ip, pchOnionCat, sizeof(pchOnionCat)) == 0); } bool CNetAddr::IsLocal() const { // IPv4 loopback if (IsIPv4() && (GetByte(3) == 127 || GetByte(3) == 0)) return true; // IPv6 loopback (::1/128) static const unsigned char pchLocal[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; if (memcmp(ip, pchLocal, 16) == 0) return true; return false; } bool CNetAddr::IsMulticast() const { return (IsIPv4() && (GetByte(3) & 0xF0) == 0xE0) || (GetByte(15) == 0xFF); } bool CNetAddr::IsValid() const { // Cleanup 3-byte shifted addresses caused by garbage in size field // of addr messages from versions before 0.2.9 checksum. // Two consecutive addr messages look like this: // header20 vectorlen3 addr26 addr26 addr26 header20 vectorlen3 addr26 addr26 addr26... // so if the first length field is garbled, it reads the second batch // of addr misaligned by 3 bytes. if (memcmp(ip, pchIPv4 + 3, sizeof(pchIPv4) - 3) == 0) return false; // unspecified IPv6 address (::/128) unsigned char ipNone[16] = {}; if (memcmp(ip, ipNone, 16) == 0) return false; // documentation IPv6 address if (IsRFC3849()) return false; if (IsIPv4()) { // INADDR_NONE uint32_t ipNone = INADDR_NONE; if (memcmp(ip + 12, &ipNone, 4) == 0) return false; // 0 ipNone = 0; if (memcmp(ip + 12, &ipNone, 4) == 0) return false; } return true; } bool CNetAddr::IsRoutable() const { return IsValid() && !(IsRFC1918() || IsRFC2544() || IsRFC3927() || IsRFC4862() || IsRFC6598() || IsRFC5737() || (IsRFC4193() && !IsTor()) || IsRFC4843() || IsLocal()); } enum Network CNetAddr::GetNetwork() const { if (!IsRoutable()) return NET_UNROUTABLE; if (IsIPv4()) return NET_IPV4; if (IsTor()) return NET_TOR; return NET_IPV6; } std::string CNetAddr::ToStringIP() const { if (IsTor()) return EncodeBase32(&ip[6], 10) + ".onion"; CService serv(*this, 0); struct sockaddr_storage sockaddr; socklen_t socklen = sizeof(sockaddr); if (serv.GetSockAddr((struct sockaddr*)&sockaddr, &socklen)) { char name[1025] = ""; if (!getnameinfo((const struct sockaddr*)&sockaddr, socklen, name, sizeof(name), NULL, 0, NI_NUMERICHOST)) return std::string(name); } if (IsIPv4()) return strprintf("%u.%u.%u.%u", GetByte(3), GetByte(2), GetByte(1), GetByte(0)); else return strprintf("%x:%x:%x:%x:%x:%x:%x:%x", GetByte(15) << 8 | GetByte(14), GetByte(13) << 8 | GetByte(12), GetByte(11) << 8 | GetByte(10), GetByte(9) << 8 | GetByte(8), GetByte(7) << 8 | GetByte(6), GetByte(5) << 8 | GetByte(4), GetByte(3) << 8 | GetByte(2), GetByte(1) << 8 | GetByte(0)); } std::string CNetAddr::ToString() const { return ToStringIP(); } bool operator==(const CNetAddr& a, const CNetAddr& b) { return (memcmp(a.ip, b.ip, 16) == 0); } bool operator!=(const CNetAddr& a, const CNetAddr& b) { return (memcmp(a.ip, b.ip, 16) != 0); } bool operator<(const CNetAddr& a, const CNetAddr& b) { return (memcmp(a.ip, b.ip, 16) < 0); } bool CNetAddr::GetInAddr(struct in_addr* pipv4Addr) const { if (!IsIPv4()) return false; memcpy(pipv4Addr, ip + 12, 4); return true; } bool CNetAddr::GetIn6Addr(struct in6_addr* pipv6Addr) const { memcpy(pipv6Addr, ip, 16); return true; } // get canonical identifier of an address' group // no two connections will be attempted to addresses with the same group std::vector<unsigned char> CNetAddr::GetGroup() const { std::vector<unsigned char> vchRet; int nClass = NET_IPV6; int nStartByte = 0; int nBits = 16; // all local addresses belong to the same group if (IsLocal()) { nClass = 255; nBits = 0; } // all unroutable addresses belong to the same group if (!IsRoutable()) { nClass = NET_UNROUTABLE; nBits = 0; } // for IPv4 addresses, '1' + the 16 higher-order bits of the IP // includes mapped IPv4, SIIT translated IPv4, and the well-known prefix else if (IsIPv4() || IsRFC6145() || IsRFC6052()) { nClass = NET_IPV4; nStartByte = 12; } // for 6to4 tunnelled addresses, use the encapsulated IPv4 address else if (IsRFC3964()) { nClass = NET_IPV4; nStartByte = 2; } // for Teredo-tunnelled IPv6 addresses, use the encapsulated IPv4 address else if (IsRFC4380()) { vchRet.push_back(NET_IPV4); vchRet.push_back(GetByte(3) ^ 0xFF); vchRet.push_back(GetByte(2) ^ 0xFF); return vchRet; } else if (IsTor()) { nClass = NET_TOR; nStartByte = 6; nBits = 4; } // for he.net, use /36 groups else if (GetByte(15) == 0x20 && GetByte(14) == 0x01 && GetByte(13) == 0x04 && GetByte(12) == 0x70) nBits = 36; // for the rest of the IPv6 network, use /32 groups else nBits = 32; vchRet.push_back(nClass); while (nBits >= 8) { vchRet.push_back(GetByte(15 - nStartByte)); nStartByte++; nBits -= 8; } if (nBits > 0) vchRet.push_back(GetByte(15 - nStartByte) | ((1 << nBits) - 1)); return vchRet; } uint64_t CNetAddr::GetHash() const { uint256 hash = Hash(&ip[0], &ip[16]); uint64_t nRet; memcpy(&nRet, &hash, sizeof(nRet)); return nRet; } // private extensions to enum Network, only returned by GetExtNetwork, // and only used in GetReachabilityFrom static const int NET_UNKNOWN = NET_MAX + 0; static const int NET_TEREDO = NET_MAX + 1; int static GetExtNetwork(const CNetAddr* addr) { if (addr == NULL) return NET_UNKNOWN; if (addr->IsRFC4380()) return NET_TEREDO; return addr->GetNetwork(); } /** Calculates a metric for how reachable (*this) is from a given partner */ int CNetAddr::GetReachabilityFrom(const CNetAddr* paddrPartner) const { enum Reachability { REACH_UNREACHABLE, REACH_DEFAULT, REACH_TEREDO, REACH_IPV6_WEAK, REACH_IPV4, REACH_IPV6_STRONG, REACH_PRIVATE }; if (!IsRoutable()) return REACH_UNREACHABLE; int ourNet = GetExtNetwork(this); int theirNet = GetExtNetwork(paddrPartner); bool fTunnel = IsRFC3964() || IsRFC6052() || IsRFC6145(); switch (theirNet) { case NET_IPV4: switch (ourNet) { default: return REACH_DEFAULT; case NET_IPV4: return REACH_IPV4; } case NET_IPV6: switch (ourNet) { default: return REACH_DEFAULT; case NET_TEREDO: return REACH_TEREDO; case NET_IPV4: return REACH_IPV4; case NET_IPV6: return fTunnel ? REACH_IPV6_WEAK : REACH_IPV6_STRONG; // only prefer giving our IPv6 address if it's not tunnelled } case NET_TOR: switch (ourNet) { default: return REACH_DEFAULT; case NET_IPV4: return REACH_IPV4; // Tor users can connect to IPv4 as well case NET_TOR: return REACH_PRIVATE; } case NET_TEREDO: switch (ourNet) { default: return REACH_DEFAULT; case NET_TEREDO: return REACH_TEREDO; case NET_IPV6: return REACH_IPV6_WEAK; case NET_IPV4: return REACH_IPV4; } case NET_UNKNOWN: case NET_UNROUTABLE: default: switch (ourNet) { default: return REACH_DEFAULT; case NET_TEREDO: return REACH_TEREDO; case NET_IPV6: return REACH_IPV6_WEAK; case NET_IPV4: return REACH_IPV4; case NET_TOR: return REACH_PRIVATE; // either from Tor, or don't care about our address } } } void CService::Init() { port = 0; } CService::CService() { Init(); } CService::CService(const CNetAddr& cip, unsigned short portIn) : CNetAddr(cip), port(portIn) { } CService::CService(const struct in_addr& ipv4Addr, unsigned short portIn) : CNetAddr(ipv4Addr), port(portIn) { } CService::CService(const struct in6_addr& ipv6Addr, unsigned short portIn) : CNetAddr(ipv6Addr), port(portIn) { } CService::CService(const struct sockaddr_in& addr) : CNetAddr(addr.sin_addr), port(ntohs(addr.sin_port)) { assert(addr.sin_family == AF_INET); } CService::CService(const struct sockaddr_in6& addr) : CNetAddr(addr.sin6_addr), port(ntohs(addr.sin6_port)) { assert(addr.sin6_family == AF_INET6); } bool CService::SetSockAddr(const struct sockaddr* paddr) { switch (paddr->sa_family) { case AF_INET: *this = CService(*(const struct sockaddr_in*)paddr); return true; case AF_INET6: *this = CService(*(const struct sockaddr_in6*)paddr); return true; default: return false; } } CService::CService(const char* pszIpPort, bool fAllowLookup) { Init(); CService ip; if (Lookup(pszIpPort, ip, 0, fAllowLookup)) *this = ip; } CService::CService(const char* pszIpPort, int portDefault, bool fAllowLookup) { Init(); CService ip; if (Lookup(pszIpPort, ip, portDefault, fAllowLookup)) *this = ip; } CService::CService(const std::string& strIpPort, bool fAllowLookup) { Init(); CService ip; if (Lookup(strIpPort.c_str(), ip, 0, fAllowLookup)) *this = ip; } CService::CService(const std::string& strIpPort, int portDefault, bool fAllowLookup) { Init(); CService ip; if (Lookup(strIpPort.c_str(), ip, portDefault, fAllowLookup)) *this = ip; } unsigned short CService::GetPort() const { return port; } bool operator==(const CService& a, const CService& b) { return (CNetAddr)a == (CNetAddr)b && a.port == b.port; } bool operator!=(const CService& a, const CService& b) { return (CNetAddr)a != (CNetAddr)b || a.port != b.port; } bool operator<(const CService& a, const CService& b) { return (CNetAddr)a < (CNetAddr)b || ((CNetAddr)a == (CNetAddr)b && a.port < b.port); } bool CService::GetSockAddr(struct sockaddr* paddr, socklen_t* addrlen) const { if (IsIPv4()) { if (*addrlen < (socklen_t)sizeof(struct sockaddr_in)) return false; *addrlen = sizeof(struct sockaddr_in); struct sockaddr_in* paddrin = (struct sockaddr_in*)paddr; memset(paddrin, 0, *addrlen); if (!GetInAddr(&paddrin->sin_addr)) return false; paddrin->sin_family = AF_INET; paddrin->sin_port = htons(port); return true; } if (IsIPv6()) { if (*addrlen < (socklen_t)sizeof(struct sockaddr_in6)) return false; *addrlen = sizeof(struct sockaddr_in6); struct sockaddr_in6* paddrin6 = (struct sockaddr_in6*)paddr; memset(paddrin6, 0, *addrlen); if (!GetIn6Addr(&paddrin6->sin6_addr)) return false; paddrin6->sin6_family = AF_INET6; paddrin6->sin6_port = htons(port); return true; } return false; } std::vector<unsigned char> CService::GetKey() const { std::vector<unsigned char> vKey; vKey.resize(18); memcpy(&vKey[0], ip, 16); vKey[16] = port / 0x100; vKey[17] = port & 0x0FF; return vKey; } std::string CService::ToStringPort() const { return strprintf("%u", port); } std::string CService::ToStringIPPort() const { if (IsIPv4() || IsTor()) { return ToStringIP() + ":" + ToStringPort(); } else { return "[" + ToStringIP() + "]:" + ToStringPort(); } } std::string CService::ToString() const { return ToStringIPPort(); } void CService::SetPort(unsigned short portIn) { port = portIn; } CSubNet::CSubNet() : valid(false) { memset(netmask, 0, sizeof(netmask)); } CSubNet::CSubNet(const std::string& strSubnet, bool fAllowLookup) { size_t slash = strSubnet.find_last_of('/'); std::vector<CNetAddr> vIP; valid = true; // Default to /32 (IPv4) or /128 (IPv6), i.e. match single address memset(netmask, 255, sizeof(netmask)); std::string strAddress = strSubnet.substr(0, slash); if (LookupHost(strAddress.c_str(), vIP, 1, fAllowLookup)) { network = vIP[0]; if (slash != strSubnet.npos) { std::string strNetmask = strSubnet.substr(slash + 1); int32_t n; // IPv4 addresses start at offset 12, and first 12 bytes must match, so just offset n const int astartofs = network.IsIPv4() ? 12 : 0; if (ParseInt32(strNetmask, &n)) // If valid number, assume /24 symtex { if (n >= 0 && n <= (128 - astartofs * 8)) // Only valid if in range of bits of address { n += astartofs * 8; // Clear bits [n..127] for (; n < 128; ++n) netmask[n >> 3] &= ~(1 << (7 - (n & 7))); } else { valid = false; } } else // If not a valid number, try full netmask syntax { if (LookupHost(strNetmask.c_str(), vIP, 1, false)) // Never allow lookup for netmask { // Copy only the *last* four bytes in case of IPv4, the rest of the mask should stay 1's as // we don't want pchIPv4 to be part of the mask. for (int x = astartofs; x < 16; ++x) netmask[x] = vIP[0].ip[x]; } else { valid = false; } } } } else { valid = false; } // Normalize network according to netmask for (int x = 0; x < 16; ++x) network.ip[x] &= netmask[x]; } CSubNet::CSubNet(const CNetAddr &addr): valid(addr.IsValid()) { memset(netmask, 255, sizeof(netmask)); network = addr; } bool CSubNet::Match(const CNetAddr& addr) const { if (!valid || !addr.IsValid()) return false; for (int x = 0; x < 16; ++x) if ((addr.ip[x] & netmask[x]) != network.ip[x]) return false; return true; } static inline int NetmaskBits(uint8_t x) { switch(x) { case 0x00: return 0; break; case 0x80: return 1; break; case 0xc0: return 2; break; case 0xe0: return 3; break; case 0xf0: return 4; break; case 0xf8: return 5; break; case 0xfc: return 6; break; case 0xfe: return 7; break; case 0xff: return 8; break; default: return -1; break; } } std::string CSubNet::ToString() const { /* Parse binary 1{n}0{N-n} to see if mask can be represented as /n */ int cidr = 0; bool valid_cidr = true; int n = network.IsIPv4() ? 12 : 0; for (; n < 16 && netmask[n] == 0xff; ++n) cidr += 8; if (n < 16) { int bits = NetmaskBits(netmask[n]); if (bits < 0) valid_cidr = false; else cidr += bits; ++n; } for (; n < 16 && valid_cidr; ++n) if (netmask[n] != 0x00) valid_cidr = false; /* Format output */ std::string strNetmask; if (valid_cidr) { strNetmask = strprintf("%u", cidr); } else { if (network.IsIPv4()) strNetmask = strprintf("%u.%u.%u.%u", netmask[12], netmask[13], netmask[14], netmask[15]); else strNetmask = strprintf("%x:%x:%x:%x:%x:%x:%x:%x", netmask[0] << 8 | netmask[1], netmask[2] << 8 | netmask[3], netmask[4] << 8 | netmask[5], netmask[6] << 8 | netmask[7], netmask[8] << 8 | netmask[9], netmask[10] << 8 | netmask[11], netmask[12] << 8 | netmask[13], netmask[14] << 8 | netmask[15]); } return network.ToString() + "/" + strNetmask; } bool CSubNet::IsValid() const { return valid; } bool operator==(const CSubNet& a, const CSubNet& b) { return a.valid == b.valid && a.network == b.network && !memcmp(a.netmask, b.netmask, 16); } bool operator!=(const CSubNet& a, const CSubNet& b) { return !(a == b); } bool operator<(const CSubNet& a, const CSubNet& b) { return (a.network < b.network || (a.network == b.network && memcmp(a.netmask, b.netmask, 16) < 0)); } #ifdef WIN32 std::string NetworkErrorString(int err) { char buf[256]; buf[0] = 0; if (FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK, NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, sizeof(buf), NULL)) { return strprintf("%s (%d)", buf, err); } else { return strprintf("Unknown error (%d)", err); } } #else std::string NetworkErrorString(int err) { char buf[256]; const char* s = buf; buf[0] = 0; /* Too bad there are two incompatible implementations of the * thread-safe strerror. */ #ifdef STRERROR_R_CHAR_P /* GNU variant can return a pointer outside the passed buffer */ s = strerror_r(err, buf, sizeof(buf)); #else /* POSIX variant always returns message in buffer */ if (strerror_r(err, buf, sizeof(buf))) buf[0] = 0; #endif return strprintf("%s (%d)", s, err); } #endif bool CloseSocket(SOCKET& hSocket) { if (hSocket == INVALID_SOCKET) return false; #ifdef WIN32 int ret = closesocket(hSocket); #else int ret = close(hSocket); #endif hSocket = INVALID_SOCKET; return ret != SOCKET_ERROR; } bool SetSocketNonBlocking(SOCKET& hSocket, bool fNonBlocking) { if (fNonBlocking) { #ifdef WIN32 u_long nOne = 1; if (ioctlsocket(hSocket, FIONBIO, &nOne) == SOCKET_ERROR) { #else int fFlags = fcntl(hSocket, F_GETFL, 0); if (fcntl(hSocket, F_SETFL, fFlags | O_NONBLOCK) == SOCKET_ERROR) { #endif CloseSocket(hSocket); return false; } } else { #ifdef WIN32 u_long nZero = 0; if (ioctlsocket(hSocket, FIONBIO, &nZero) == SOCKET_ERROR) { #else int fFlags = fcntl(hSocket, F_GETFL, 0); if (fcntl(hSocket, F_SETFL, fFlags & ~O_NONBLOCK) == SOCKET_ERROR) { #endif CloseSocket(hSocket); return false; } } return true; }
[ "developer@chronoschain.co" ]
developer@chronoschain.co
5e9b1ca0b84b9bd2776be8904387d03ded6429ac
651f3a1d79f5ef5a6a86e5ad2004ccd064d4d3ac
/src/v5_hal/firmware/src/auton/auton_routines/TestPoseAuton.cpp
e6d857efe153941a6c071ee668b5e8c7a5601cc2
[]
no_license
sbreeden25/ChangeUp
bff3dc046cd636f57b810a23de0ab797b7f5df4d
f16681946e4b90692f518f39d083ff93f9926f5b
refs/heads/master
2023-08-15T11:44:44.814152
2021-06-20T04:45:34
2021-06-20T04:45:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
453
cpp
#include "auton/auton_routines/TestPoseAuton.h" TestPoseAuton::TestPoseAuton(IDriveNode* drive_node, OdometryNode* odom_node) : Auton("Test Pose Node"), m_drive_node(drive_node), m_odom_node(odom_node) { } void TestPoseAuton::AddNodes() { Pose pose(Vector2d(0., 10.), Rotation2Dd(0.)); m_pose_node = new AutonNode(10, new DriveToPoseAction(m_drive_node, m_odom_node, pose)); Auton::AddFirstNode(m_pose_node); }
[ "nathan.dupont01@gmail.com" ]
nathan.dupont01@gmail.com
f15e6d5b0f1ad0e51062af6b5eee539946820344
a50dca02b270c16d26e293f4b21706c4862d8059
/Engine/CollidableEntity.cpp
5d98594cc89318d7b16eb2052abe1167ed681bd6
[]
no_license
AlexandruScutaru/Engine
45e3a02bb822208401e1c745ba86bebe52e492ca
90bca5e28e0eba26fed29891d9d0860cdafe46ec
refs/heads/master
2021-06-28T01:16:43.691513
2019-06-24T19:26:23
2019-06-24T19:26:23
117,293,538
0
0
null
null
null
null
UTF-8
C++
false
false
352
cpp
#include "CollidableEntity.h" namespace renderer{ CollidableEntity::CollidableEntity(){} CollidableEntity::CollidableEntity(const CollidableEntity & other){ m_colBodies = other.m_colBodies; } CollidableEntity::~CollidableEntity(){} void CollidableEntity::removeColBody(size_t index){ m_colBodies.erase(m_colBodies.begin() + index); } }
[ "alex_cw15@yahoo.com" ]
alex_cw15@yahoo.com
b29d487d9b56876fd757e08b345468958997170f
318a9cf9dee4f0d208f149f622e8c093bad29878
/LEDbasis/LEDbasis.ino
0840fe46a661cd35583ac82ee9110e177cd13ad8
[]
no_license
Creativeguru97/HardWareGetStarted
63b9d9b6b14dfb742fb09b7e57674be4b2903aa5
8ddd5b4614d905dc80a040e628633c1e91eaf407
refs/heads/master
2020-07-13T15:34:13.875538
2019-08-30T11:38:09
2019-08-30T11:38:09
205,107,116
1
0
null
null
null
null
UTF-8
C++
false
false
841
ino
int redPin = 13; int yellowPin = 12; int redWaitTimeOn = 1000; int redWaitTimeOff = 500; int yellowWaitTimeOn = 1000; int yellowWaitTimeOff = 500; void setup() { Serial.begin(9600);//Open channel between usb port //9600 is pretty typical number. //If we gonna be reading from pins, it's an INPUT //If we gonna be writing and sending to pins, it's an OUTPUT pinMode(redPin, OUTPUT); pinMode(yellowPin, OUTPUT); } void loop() { //Set LOW to turn voltage 0v, HIGH to turn on to certain voltage. for(int i = 0; i < 4; i++){ Serial.println(i); digitalWrite(redPin, HIGH); delay(redWaitTimeOn); digitalWrite(redPin, LOW); delay(redWaitTimeOff); } Serial.println(" "); digitalWrite(yellowPin, HIGH); delay(yellowWaitTimeOn); digitalWrite(yellowPin, LOW); delay(yellowWaitTimeOff); }
[ "worldapple2630@gmail.com" ]
worldapple2630@gmail.com
b3450477da4420c4589139bc80993eba4c4c463c
c369fb0a8e71d9a69708f77d28e8c41f3b07b325
/PublicCommands/Commands/test.cpp
2b9ffe15522416af74830e9e4be6b16e678e4a17
[]
no_license
EasyROS/ezpublic
f4c2b1b7f5999dfcfb7c064bf3b3cd3cddaea0b1
6fa98b378e37d18d94567de89bf2f0b0363a4828
refs/heads/master
2020-04-03T08:54:00.536259
2019-06-28T06:42:13
2019-06-28T06:42:13
155,148,518
0
0
null
null
null
null
UTF-8
C++
false
false
348
cpp
#include "lsCommand.hpp" #include "cdCommand.hpp" #include <iostream> using namespace std; int main() { EZIO *pRoot = new directory("/"); ls *LS = new ls(); (new cd())->init(pRoot); LS->init(pRoot); LS->Command->pwd = "/"; LS->Command->cmd = "ls"; LS->Command->btn = "cmt"; LS->Command->run(); return 0; }
[ "ls.dean.ch@gmail.com" ]
ls.dean.ch@gmail.com
d2bf604d5a203d4f01057c3ee7359ecb1a24497b
570cc278bcd8e076adf412f5c86d8df3d1f67f81
/KlapuriMultiPitch/EssentiaMelodiaVsVamp/main.cpp
3c76f6da1762d05ef6d748b870cc331500ec9c0a
[]
no_license
jhuiac/EssentiaProject
035df8271aa92994c2fde44a35b10f170e2f1c33
1dde133f114649c8ddcecef369ef5aef5b12fdc3
refs/heads/master
2020-03-14T22:53:04.003433
2015-06-11T15:54:38
2015-06-11T15:54:38
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,056
cpp
////////////////////////////////////////////////////////////////////// // Extracts the pitch using the monophonic melodia implementation. // ////////////////////////////////////////////////////////////////////// #include <iostream> #include <fstream> #include "essentia.h" #include "taglib.h" #include "fftw3.h" #include "avcodec.h" #include <essentia/algorithmfactory.h> #include <essentia/essentiamath.h> #include <essentia/pool.h> using namespace std; using namespace essentia; using namespace essentia::standard; int main(int argc, const char * argv[]) { // file path string audioFilename="/Users/GinSonic/MTG/EssentiaProject/KlapuriMultiPitch/EssentiaMelodiaVsVamp/test.wav"; // parameters int sampleRate = 44100; int frameSize = 2048; int hopSize = 128; // algorithm setup essentia::init(); AlgorithmFactory& factory = standard::AlgorithmFactory::instance(); Algorithm* audio = factory.create("MonoLoader","filename", audioFilename,"sampleRate", sampleRate); Algorithm* multiPitch = factory.create("MultiPitchKlapuri", "sampleRate", sampleRate); vector<Real> audioVec; vector<vector<Real> >pitchMulti; audio->output("audio").set(audioVec); multiPitch->input("signal").set(audioVec); multiPitch->output("pitch").set(pitchMulti); // Compute audio->compute(); multiPitch->compute(); // write to file string csvFilenameMulti="/Users/GinSonic/MTG/EssentiaProject/KlapuriMultiPitch/EssentiaMelodiaVsVamp/test.csv"; ofstream outFileMulti; outFileMulti.open(csvFilenameMulti); for (int ii=0; ii<pitchMulti.size(); ii++){ cout << pitchMulti[ii] << endl; for (int jj=0; jj<pitchMulti[ii].size(); jj++){ outFileMulti << float(ii)*hopSize/sampleRate << ", " << pitchMulti[ii][jj] << endl; cout << float(ii)*hopSize/sampleRate << ", " << pitchMulti[ii][jj] << endl; } } // clean up delete audio; essentia::shutdown(); return 0; }
[ "nadine.kroher@upf.edu" ]
nadine.kroher@upf.edu